From: Cris Di Sclafani Date: Fri, 29 Jan 2021 11:56:06 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/fonts.googleapis.com/icon?a=commitdiff_plain;h=3a91bc549bb3255f086793b233e76dfd3e9c7dcb;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 63e0970..0ae3afd 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.14", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-01-29T11:48:54.212Z", "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 0e5b235..a34e927 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 _0xfdc7=['INTEGER'];(function(_0x140f1d,_0x222c14){var _0xe94183=function(_0x1410da){while(--_0x1410da){_0x140f1d['push'](_0x140f1d['shift']());}};_0xe94183(++_0x222c14);}(_0xfdc7,0x1b7));var _0x7fdc=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0xfdc7[_0xbd3a05];return _0x101f90;};'use strict';var Sequelize=require('sequelize');module['exports']={'ChatInteractionId':{'type':Sequelize[_0x7fdc('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x7fdc('0x0')],'primaryKey':!![]}}; \ No newline at end of file +var _0x7b8d=['exports','INTEGER'];(function(_0x3ddfb4,_0x2d50e7){var _0x34051e=function(_0xbe6933){while(--_0xbe6933){_0x3ddfb4['push'](_0x3ddfb4['shift']());}};_0x34051e(++_0x2d50e7);}(_0x7b8d,0xfa));var _0xd7b8=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x7b8d[_0x46a38b];return _0x346e75;};'use strict';var Sequelize=require('sequelize');module[_0xd7b8('0x0')]={'ChatInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xd7b8('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index 62709ac..2147f5e 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 _0x9b03=['includeAll','options','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','update','then','destroy','UserChatInteractions','error','name','send','index','map','UserChatInteraction','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','params','rawAttributes'];(function(_0xf464f2,_0x157270){var _0x2a934d=function(_0x49578c){while(--_0x49578c){_0xf464f2['push'](_0xf464f2['shift']());}};_0x2a934d(++_0x157270);}(_0x9b03,0x102));var _0x39b0=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9b03[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0x39b0('0x0'));var emlformat=require(_0x39b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x39b0('0x2'));var jsonpatch=require(_0x39b0('0x3'));var rp=require(_0x39b0('0x4'));var moment=require(_0x39b0('0x5'));var BPromise=require(_0x39b0('0x6'));var Mustache=require('mustache');var util=require(_0x39b0('0x7'));var path=require('path');var sox=require(_0x39b0('0x8'));var csv=require(_0x39b0('0x9'));var ejs=require(_0x39b0('0xa'));var fs=require('fs');var _=require(_0x39b0('0xb'));var squel=require(_0x39b0('0xc'));var crypto=require(_0x39b0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x39b0('0xe'));var toCsv=require(_0x39b0('0x9'));var querystring=require(_0x39b0('0xf'));var Papa=require(_0x39b0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x39b0('0x11'));var as=require(_0x39b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39b0('0x13'))(_0x39b0('0x14'));var utils=require(_0x39b0('0x15'));var config=require(_0x39b0('0x16'));var licenseUtil=require(_0x39b0('0x17'));var db=require(_0x39b0('0x18'))['db'];function respondWithStatusCode(_0x32656c,_0x307115){_0x307115=_0x307115||0xcc;return function(_0x15796c){if(_0x15796c){return _0x32656c[_0x39b0('0x19')](_0x307115);}return _0x32656c[_0x39b0('0x1a')](_0x307115)[_0x39b0('0x1b')]();};}function respondWithResult(_0x3decc5,_0xaa4557){_0xaa4557=_0xaa4557||0xc8;return function(_0x2a3b2c){if(_0x2a3b2c){return _0x3decc5['status'](_0xaa4557)[_0x39b0('0x1c')](_0x2a3b2c);}};}function respondWithFilteredResult(_0x5f2e5b,_0x5c47f1){return function(_0x2824d4){if(_0x2824d4){var _0x28e53a=_0x2824d4['count'],_0xfb0468=_0x5c47f1[_0x39b0('0x1d')],_0x2207a4=_0x5c47f1[_0x39b0('0x1d')]+_0x5c47f1[_0x39b0('0x1e')],_0x159543;if(_0x2207a4>=_0x28e53a){_0x2207a4=_0x28e53a;_0x159543=0xc8;}else{_0x159543=0xce;}_0x5f2e5b[_0x39b0('0x1a')](_0x159543);return _0x5f2e5b[_0x39b0('0x1f')](_0x39b0('0x20'),_0xfb0468+'-'+_0x2207a4+'/'+_0x28e53a)['json'](_0x2824d4);}return null;};}function patchUpdates(_0x1ed3ec){return function(_0x4558b3){try{jsonpatch[_0x39b0('0x21')](_0x4558b3,_0x1ed3ec,!![]);}catch(_0x15bde6){return BPromise['reject'](_0x15bde6);}return _0x4558b3['save']();};}function saveUpdates(_0x84c2cf,_0x5d80b7){return function(_0x1558b1){if(_0x1558b1){return _0x1558b1[_0x39b0('0x22')](_0x84c2cf)[_0x39b0('0x23')](function(_0x394c38){return _0x394c38;});}return null;};}function removeEntity(_0xbc1976,_0x2a30f7){return function(_0x43d701){if(_0x43d701){return _0x43d701[_0x39b0('0x24')]()['then'](function(){var _0x18095f=_0x43d701['get']({'plain':!![]});var _0x2d1560=_0x39b0('0x25');return db['UserProfileResource'][_0x39b0('0x24')]({'where':{'type':_0x2d1560,'resourceId':_0x18095f['id']}})['then'](function(){return _0x43d701;});})[_0x39b0('0x23')](function(){_0xbc1976[_0x39b0('0x1a')](0xcc)[_0x39b0('0x1b')]();});}};}function handleEntityNotFound(_0x32102e,_0x33f6be){return function(_0x2e4412){if(!_0x2e4412){_0x32102e['sendStatus'](0x194);}return _0x2e4412;};}function handleError(_0x15b47f,_0x3572f8){_0x3572f8=_0x3572f8||0x1f4;return function(_0x5b4a24){logger[_0x39b0('0x26')](_0x5b4a24['stack']);if(_0x5b4a24[_0x39b0('0x27')]){delete _0x5b4a24[_0x39b0('0x27')];}_0x15b47f[_0x39b0('0x1a')](_0x3572f8)[_0x39b0('0x28')](_0x5b4a24);};}exports[_0x39b0('0x29')]=function(_0xe0a811,_0x23a58a){var _0x1552e1={},_0x591f68={},_0x892b58={'count':0x0,'rows':[]};var _0x5a778a=_[_0x39b0('0x2a')](db[_0x39b0('0x2b')]['rawAttributes'],function(_0x1f9658){return{'name':_0x1f9658[_0x39b0('0x2c')],'type':_0x1f9658[_0x39b0('0x2d')][_0x39b0('0x2e')]};});_0x591f68['model']=_['map'](_0x5a778a,_0x39b0('0x27'));_0x591f68['query']=_[_0x39b0('0x2f')](_0xe0a811[_0x39b0('0x30')]);_0x591f68[_0x39b0('0x31')]=_['intersection'](_0x591f68[_0x39b0('0x32')],_0x591f68['query']);_0x1552e1[_0x39b0('0x33')]=_[_0x39b0('0x34')](_0x591f68[_0x39b0('0x32')],qs[_0x39b0('0x35')](_0xe0a811['query'][_0x39b0('0x35')]));_0x1552e1['attributes']=_0x1552e1['attributes'][_0x39b0('0x36')]?_0x1552e1[_0x39b0('0x33')]:_0x591f68[_0x39b0('0x32')];if(!_0xe0a811[_0x39b0('0x30')][_0x39b0('0x37')](_0x39b0('0x38'))){_0x1552e1[_0x39b0('0x1e')]=qs[_0x39b0('0x1e')](_0xe0a811[_0x39b0('0x30')][_0x39b0('0x1e')]);_0x1552e1[_0x39b0('0x1d')]=qs['offset'](_0xe0a811[_0x39b0('0x30')][_0x39b0('0x1d')]);}_0x1552e1[_0x39b0('0x39')]=qs[_0x39b0('0x3a')](_0xe0a811[_0x39b0('0x30')][_0x39b0('0x3a')]);_0x1552e1['where']=qs[_0x39b0('0x31')](_[_0x39b0('0x3b')](_0xe0a811['query'],_0x591f68[_0x39b0('0x31')]),_0x5a778a);if(_0xe0a811[_0x39b0('0x30')][_0x39b0('0x3c')]){_0x1552e1['where']=_[_0x39b0('0x3d')](_0x1552e1[_0x39b0('0x3e')],{'$or':_[_0x39b0('0x2a')](_0x5a778a,function(_0x149fe6){if(_0x149fe6['type']!==_0x39b0('0x3f')){var _0xa18991={};_0xa18991[_0x149fe6[_0x39b0('0x27')]]={'$like':'%'+_0xe0a811[_0x39b0('0x30')][_0x39b0('0x3c')]+'%'};return _0xa18991;}})});}_0x1552e1=_[_0x39b0('0x3d')]({},_0x1552e1,_0xe0a811['options']);var _0x1e671b={'where':_0x1552e1['where']};return db[_0x39b0('0x2b')]['count'](_0x1e671b)[_0x39b0('0x23')](function(_0x5b95b7){_0x892b58['count']=_0x5b95b7;if(_0xe0a811['query']['includeAll']){_0x1552e1[_0x39b0('0x40')]=[{'all':!![]}];}return db[_0x39b0('0x2b')][_0x39b0('0x41')](_0x1552e1);})['then'](function(_0x3c737f){_0x892b58[_0x39b0('0x42')]=_0x3c737f;return _0x892b58;})[_0x39b0('0x23')](respondWithFilteredResult(_0x23a58a,_0x1552e1))[_0x39b0('0x43')](handleError(_0x23a58a,null));};exports['show']=function(_0x43b687,_0x480f76){var _0x2d214f={'raw':!![],'where':{'id':_0x43b687[_0x39b0('0x44')]['id']}},_0xac38d4={};_0xac38d4[_0x39b0('0x32')]=_[_0x39b0('0x2f')](db['UserChatInteraction'][_0x39b0('0x45')]);_0xac38d4[_0x39b0('0x30')]=_[_0x39b0('0x2f')](_0x43b687[_0x39b0('0x30')]);_0xac38d4[_0x39b0('0x31')]=_[_0x39b0('0x34')](_0xac38d4[_0x39b0('0x32')],_0xac38d4[_0x39b0('0x30')]);_0x2d214f['attributes']=_[_0x39b0('0x34')](_0xac38d4[_0x39b0('0x32')],qs[_0x39b0('0x35')](_0x43b687['query']['fields']));_0x2d214f[_0x39b0('0x33')]=_0x2d214f[_0x39b0('0x33')]['length']?_0x2d214f[_0x39b0('0x33')]:_0xac38d4[_0x39b0('0x32')];if(_0x43b687[_0x39b0('0x30')][_0x39b0('0x46')]){_0x2d214f[_0x39b0('0x40')]=[{'all':!![]}];}_0x2d214f=_[_0x39b0('0x3d')]({},_0x2d214f,_0x43b687[_0x39b0('0x47')]);return db[_0x39b0('0x2b')]['find'](_0x2d214f)[_0x39b0('0x23')](handleEntityNotFound(_0x480f76,null))[_0x39b0('0x23')](respondWithResult(_0x480f76,null))['catch'](handleError(_0x480f76,null));};exports['create']=function(_0x43493b,_0x38c901){return db[_0x39b0('0x2b')]['create'](_0x43493b[_0x39b0('0x48')],{})[_0x39b0('0x23')](function(_0x4a05d7){var _0x4c7c34=_0x43493b[_0x39b0('0x49')][_0x39b0('0x4a')]({'plain':!![]});if(!_0x4c7c34)throw new Error(_0x39b0('0x4b'));if(_0x4c7c34[_0x39b0('0x4c')]===_0x39b0('0x49')){var _0x3b8e6d=_0x4a05d7['get']({'plain':!![]});var _0x49be1d='UserChatInteractions';return db[_0x39b0('0x4d')][_0x39b0('0x4e')]({'where':{'name':_0x49be1d,'userProfileId':_0x4c7c34[_0x39b0('0x4f')]},'raw':!![]})[_0x39b0('0x23')](function(_0x4e9dce){if(_0x4e9dce&&_0x4e9dce['autoAssociation']===0x0){return db['UserProfileResource'][_0x39b0('0x50')]({'name':_0x3b8e6d[_0x39b0('0x27')],'resourceId':_0x3b8e6d['id'],'type':_0x4e9dce['name'],'sectionId':_0x4e9dce['id']},{})[_0x39b0('0x23')](function(){return _0x4a05d7;});}else{return _0x4a05d7;}})[_0x39b0('0x43')](function(_0x1bdb2b){logger[_0x39b0('0x26')](_0x39b0('0x51'),_0x1bdb2b);throw _0x1bdb2b;});}return _0x4a05d7;})[_0x39b0('0x23')](respondWithResult(_0x38c901,0xc9))['catch'](handleError(_0x38c901,null));};exports[_0x39b0('0x22')]=function(_0x357e50,_0x434845){if(_0x357e50['body']['id']){delete _0x357e50['body']['id'];}return db['UserChatInteraction'][_0x39b0('0x4e')]({'where':{'id':_0x357e50[_0x39b0('0x44')]['id']}})[_0x39b0('0x23')](handleEntityNotFound(_0x434845,null))[_0x39b0('0x23')](saveUpdates(_0x357e50[_0x39b0('0x48')],null))['then'](respondWithResult(_0x434845,null))[_0x39b0('0x43')](handleError(_0x434845,null));};exports['destroy']=function(_0x61c47c,_0x4f0bfe){return db[_0x39b0('0x2b')][_0x39b0('0x4e')]({'where':{'id':_0x61c47c[_0x39b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f0bfe,null))[_0x39b0('0x23')](removeEntity(_0x4f0bfe,null))[_0x39b0('0x43')](handleError(_0x4f0bfe,null));}; \ No newline at end of file +var _0xdb9a=['type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','catch','show','params','length','includeAll','include','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','UserChatInteractions','UserProfileResource','end','error','stack','name','send','UserChatInteraction','rawAttributes','fieldName'];(function(_0x2718b8,_0x51f0e0){var _0x4ddafc=function(_0x1fa8c3){while(--_0x1fa8c3){_0x2718b8['push'](_0x2718b8['shift']());}};_0x4ddafc(++_0x51f0e0);}(_0xdb9a,0xce));var _0xadb9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb9a[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0xadb9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xadb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xadb9('0x2'));var rp=require(_0xadb9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xadb9('0x4'));var util=require(_0xadb9('0x5'));var path=require(_0xadb9('0x6'));var sox=require(_0xadb9('0x7'));var csv=require(_0xadb9('0x8'));var ejs=require(_0xadb9('0x9'));var fs=require('fs');var _=require(_0xadb9('0xa'));var squel=require(_0xadb9('0xb'));var crypto=require('crypto');var jsforce=require(_0xadb9('0xc'));var deskjs=require(_0xadb9('0xd'));var toCsv=require(_0xadb9('0x8'));var querystring=require(_0xadb9('0xe'));var Papa=require(_0xadb9('0xf'));var Redis=require('ioredis');var authService=require(_0xadb9('0x10'));var qs=require(_0xadb9('0x11'));var as=require(_0xadb9('0x12'));var hardwareService=require(_0xadb9('0x13'));var logger=require(_0xadb9('0x14'))(_0xadb9('0x15'));var utils=require(_0xadb9('0x16'));var config=require(_0xadb9('0x17'));var licenseUtil=require(_0xadb9('0x18'));var db=require(_0xadb9('0x19'))['db'];function respondWithStatusCode(_0x569fe0,_0x11a7d3){_0x11a7d3=_0x11a7d3||0xcc;return function(_0x566d06){if(_0x566d06){return _0x569fe0[_0xadb9('0x1a')](_0x11a7d3);}return _0x569fe0[_0xadb9('0x1b')](_0x11a7d3)['end']();};}function respondWithResult(_0x3cce1d,_0x9e6483){_0x9e6483=_0x9e6483||0xc8;return function(_0x317e47){if(_0x317e47){return _0x3cce1d['status'](_0x9e6483)[_0xadb9('0x1c')](_0x317e47);}};}function respondWithFilteredResult(_0x5021d3,_0x4d6025){return function(_0x3e784e){if(_0x3e784e){var _0xf9b577=_0x3e784e[_0xadb9('0x1d')],_0x3a8237=_0x4d6025['offset'],_0x3ad6a1=_0x4d6025[_0xadb9('0x1e')]+_0x4d6025[_0xadb9('0x1f')],_0x3b6c66;if(_0x3ad6a1>=_0xf9b577){_0x3ad6a1=_0xf9b577;_0x3b6c66=0xc8;}else{_0x3b6c66=0xce;}_0x5021d3[_0xadb9('0x1b')](_0x3b6c66);return _0x5021d3['set'](_0xadb9('0x20'),_0x3a8237+'-'+_0x3ad6a1+'/'+_0xf9b577)[_0xadb9('0x1c')](_0x3e784e);}return null;};}function patchUpdates(_0xa5676a){return function(_0x4330bb){try{jsonpatch[_0xadb9('0x21')](_0x4330bb,_0xa5676a,!![]);}catch(_0x26df30){return BPromise[_0xadb9('0x22')](_0x26df30);}return _0x4330bb[_0xadb9('0x23')]();};}function saveUpdates(_0x1fddac,_0x11e8c0){return function(_0xb72376){if(_0xb72376){return _0xb72376[_0xadb9('0x24')](_0x1fddac)['then'](function(_0xfa7051){return _0xfa7051;});}return null;};}function removeEntity(_0x5d2e27,_0x16496a){return function(_0x5ec7cc){if(_0x5ec7cc){return _0x5ec7cc[_0xadb9('0x25')]()[_0xadb9('0x26')](function(){var _0x566c8c=_0x5ec7cc['get']({'plain':!![]});var _0x43d689=_0xadb9('0x27');return db[_0xadb9('0x28')][_0xadb9('0x25')]({'where':{'type':_0x43d689,'resourceId':_0x566c8c['id']}})['then'](function(){return _0x5ec7cc;});})[_0xadb9('0x26')](function(){_0x5d2e27[_0xadb9('0x1b')](0xcc)[_0xadb9('0x29')]();});}};}function handleEntityNotFound(_0x5ac6e3,_0x139762){return function(_0x5be912){if(!_0x5be912){_0x5ac6e3[_0xadb9('0x1a')](0x194);}return _0x5be912;};}function handleError(_0xfbd858,_0x3f1cd1){_0x3f1cd1=_0x3f1cd1||0x1f4;return function(_0x569520){logger[_0xadb9('0x2a')](_0x569520[_0xadb9('0x2b')]);if(_0x569520[_0xadb9('0x2c')]){delete _0x569520[_0xadb9('0x2c')];}_0xfbd858[_0xadb9('0x1b')](_0x3f1cd1)[_0xadb9('0x2d')](_0x569520);};}exports['index']=function(_0x1a05ac,_0x483146){var _0x4c8def={},_0x38b67c={},_0x3f5ca3={'count':0x0,'rows':[]};var _0x5783ce=_['map'](db[_0xadb9('0x2e')][_0xadb9('0x2f')],function(_0x1461d3){return{'name':_0x1461d3[_0xadb9('0x30')],'type':_0x1461d3[_0xadb9('0x31')][_0xadb9('0x32')]};});_0x38b67c[_0xadb9('0x33')]=_['map'](_0x5783ce,_0xadb9('0x2c'));_0x38b67c['query']=_[_0xadb9('0x34')](_0x1a05ac[_0xadb9('0x35')]);_0x38b67c[_0xadb9('0x36')]=_[_0xadb9('0x37')](_0x38b67c[_0xadb9('0x33')],_0x38b67c['query']);_0x4c8def['attributes']=_[_0xadb9('0x37')](_0x38b67c[_0xadb9('0x33')],qs[_0xadb9('0x38')](_0x1a05ac[_0xadb9('0x35')]['fields']));_0x4c8def[_0xadb9('0x39')]=_0x4c8def[_0xadb9('0x39')]['length']?_0x4c8def[_0xadb9('0x39')]:_0x38b67c['model'];if(!_0x1a05ac[_0xadb9('0x35')][_0xadb9('0x3a')](_0xadb9('0x3b'))){_0x4c8def[_0xadb9('0x1f')]=qs[_0xadb9('0x1f')](_0x1a05ac['query'][_0xadb9('0x1f')]);_0x4c8def[_0xadb9('0x1e')]=qs['offset'](_0x1a05ac[_0xadb9('0x35')][_0xadb9('0x1e')]);}_0x4c8def[_0xadb9('0x3c')]=qs[_0xadb9('0x3d')](_0x1a05ac['query']['sort']);_0x4c8def[_0xadb9('0x3e')]=qs[_0xadb9('0x36')](_[_0xadb9('0x3f')](_0x1a05ac[_0xadb9('0x35')],_0x38b67c[_0xadb9('0x36')]),_0x5783ce);if(_0x1a05ac[_0xadb9('0x35')][_0xadb9('0x40')]){_0x4c8def[_0xadb9('0x3e')]=_[_0xadb9('0x41')](_0x4c8def['where'],{'$or':_[_0xadb9('0x42')](_0x5783ce,function(_0x3b00f6){if(_0x3b00f6[_0xadb9('0x31')]!=='VIRTUAL'){var _0x360b36={};_0x360b36[_0x3b00f6[_0xadb9('0x2c')]]={'$like':'%'+_0x1a05ac[_0xadb9('0x35')]['filter']+'%'};return _0x360b36;}})});}_0x4c8def=_[_0xadb9('0x41')]({},_0x4c8def,_0x1a05ac['options']);var _0x44a1fc={'where':_0x4c8def[_0xadb9('0x3e')]};return db['UserChatInteraction'][_0xadb9('0x1d')](_0x44a1fc)[_0xadb9('0x26')](function(_0x4c39fe){_0x3f5ca3[_0xadb9('0x1d')]=_0x4c39fe;if(_0x1a05ac[_0xadb9('0x35')]['includeAll']){_0x4c8def['include']=[{'all':!![]}];}return db[_0xadb9('0x2e')]['findAll'](_0x4c8def);})[_0xadb9('0x26')](function(_0x2ea4cc){_0x3f5ca3['rows']=_0x2ea4cc;return _0x3f5ca3;})[_0xadb9('0x26')](respondWithFilteredResult(_0x483146,_0x4c8def))[_0xadb9('0x43')](handleError(_0x483146,null));};exports[_0xadb9('0x44')]=function(_0x1f1882,_0x113b47){var _0x86f11e={'raw':!![],'where':{'id':_0x1f1882[_0xadb9('0x45')]['id']}},_0x4c758c={};_0x4c758c[_0xadb9('0x33')]=_[_0xadb9('0x34')](db[_0xadb9('0x2e')][_0xadb9('0x2f')]);_0x4c758c[_0xadb9('0x35')]=_[_0xadb9('0x34')](_0x1f1882[_0xadb9('0x35')]);_0x4c758c[_0xadb9('0x36')]=_[_0xadb9('0x37')](_0x4c758c[_0xadb9('0x33')],_0x4c758c[_0xadb9('0x35')]);_0x86f11e[_0xadb9('0x39')]=_[_0xadb9('0x37')](_0x4c758c[_0xadb9('0x33')],qs[_0xadb9('0x38')](_0x1f1882[_0xadb9('0x35')][_0xadb9('0x38')]));_0x86f11e[_0xadb9('0x39')]=_0x86f11e[_0xadb9('0x39')][_0xadb9('0x46')]?_0x86f11e['attributes']:_0x4c758c[_0xadb9('0x33')];if(_0x1f1882[_0xadb9('0x35')][_0xadb9('0x47')]){_0x86f11e[_0xadb9('0x48')]=[{'all':!![]}];}_0x86f11e=_[_0xadb9('0x41')]({},_0x86f11e,_0x1f1882[_0xadb9('0x49')]);return db[_0xadb9('0x2e')][_0xadb9('0x4a')](_0x86f11e)[_0xadb9('0x26')](handleEntityNotFound(_0x113b47,null))[_0xadb9('0x26')](respondWithResult(_0x113b47,null))[_0xadb9('0x43')](handleError(_0x113b47,null));};exports[_0xadb9('0x4b')]=function(_0x31a635,_0x40a361){return db[_0xadb9('0x2e')][_0xadb9('0x4b')](_0x31a635[_0xadb9('0x4c')],{})[_0xadb9('0x26')](function(_0x8548b6){var _0xbf9ce7=_0x31a635['user'][_0xadb9('0x4d')]({'plain':!![]});if(!_0xbf9ce7)throw new Error(_0xadb9('0x4e'));if(_0xbf9ce7[_0xadb9('0x4f')]===_0xadb9('0x50')){var _0x4616d0=_0x8548b6[_0xadb9('0x4d')]({'plain':!![]});var _0x387c1e=_0xadb9('0x27');return db[_0xadb9('0x51')][_0xadb9('0x4a')]({'where':{'name':_0x387c1e,'userProfileId':_0xbf9ce7[_0xadb9('0x52')]},'raw':!![]})[_0xadb9('0x26')](function(_0x2f5a2d){if(_0x2f5a2d&&_0x2f5a2d[_0xadb9('0x53')]===0x0){return db['UserProfileResource'][_0xadb9('0x4b')]({'name':_0x4616d0[_0xadb9('0x2c')],'resourceId':_0x4616d0['id'],'type':_0x2f5a2d[_0xadb9('0x2c')],'sectionId':_0x2f5a2d['id']},{})[_0xadb9('0x26')](function(){return _0x8548b6;});}else{return _0x8548b6;}})[_0xadb9('0x43')](function(_0x4c1c23){logger['error'](_0xadb9('0x54'),_0x4c1c23);throw _0x4c1c23;});}return _0x8548b6;})[_0xadb9('0x26')](respondWithResult(_0x40a361,0xc9))[_0xadb9('0x43')](handleError(_0x40a361,null));};exports[_0xadb9('0x24')]=function(_0x563813,_0x7e4d7d){if(_0x563813[_0xadb9('0x4c')]['id']){delete _0x563813['body']['id'];}return db[_0xadb9('0x2e')][_0xadb9('0x4a')]({'where':{'id':_0x563813[_0xadb9('0x45')]['id']}})[_0xadb9('0x26')](handleEntityNotFound(_0x7e4d7d,null))[_0xadb9('0x26')](saveUpdates(_0x563813['body'],null))['then'](respondWithResult(_0x7e4d7d,null))['catch'](handleError(_0x7e4d7d,null));};exports[_0xadb9('0x25')]=function(_0x1ad6bd,_0x2b8863){return db[_0xadb9('0x2e')]['find']({'where':{'id':_0x1ad6bd[_0xadb9('0x45')]['id']}})[_0xadb9('0x26')](handleEntityNotFound(_0x2b8863,null))['then'](removeEntity(_0x2b8863,null))[_0xadb9('0x43')](handleError(_0x2b8863,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index d7c3ce3..f98d392 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 _0xa80f=['user_has_chat_interactions','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','UserChatInteraction'];(function(_0x453ff1,_0x51d06b){var _0x36f097=function(_0x5af956){while(--_0x5af956){_0x453ff1['push'](_0x453ff1['shift']());}};_0x36f097(++_0x51d06b);}(_0xa80f,0x1e5));var _0xfa80=function(_0x1e1962,_0x5a2061){_0x1e1962=_0x1e1962-0x0;var _0x3c06be=_0xa80f[_0x1e1962];return _0x3c06be;};'use strict';var _=require(_0xfa80('0x0'));var util=require(_0xfa80('0x1'));var logger=require(_0xfa80('0x2'))(_0xfa80('0x3'));var moment=require(_0xfa80('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa80('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa80('0x6'));var config=require(_0xfa80('0x7'));var attributes=require('./UserChatInteraction.attributes');module['exports']=function(_0x36599d,_0x317fe0){return _0x36599d[_0xfa80('0x8')](_0xfa80('0x9'),attributes,{'tableName':_0xfa80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd75=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserChatInteraction.attributes','define','util'];(function(_0x2976d5,_0x394a5e){var _0x4b57e0=function(_0x3c9508){while(--_0x3c9508){_0x2976d5['push'](_0x2976d5['shift']());}};_0x4b57e0(++_0x394a5e);}(_0xdd75,0x18b));var _0x5dd7=function(_0x273502,_0x1c173c){_0x273502=_0x273502-0x0;var _0x379e87=_0xdd75[_0x273502];return _0x379e87;};'use strict';var _=require('lodash');var util=require(_0x5dd7('0x0'));var logger=require(_0x5dd7('0x1'))(_0x5dd7('0x2'));var moment=require(_0x5dd7('0x3'));var BPromise=require(_0x5dd7('0x4'));var rp=require(_0x5dd7('0x5'));var fs=require('fs');var path=require(_0x5dd7('0x6'));var rimraf=require(_0x5dd7('0x7'));var config=require(_0x5dd7('0x8'));var attributes=require(_0x5dd7('0x9'));module['exports']=function(_0x441085,_0x4019b7){return _0x441085[_0x5dd7('0xa')]('UserChatInteraction',attributes,{'tableName':'user_has_chat_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index cbe608a..867b7cd 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 _0xa7ca=['UserChatInteraction,\x20%s,\x20%s,\x20%s','error','code','UserChatInteraction,\x20%s,\x20%s','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xa7ca,0xfe));var _0xaa7c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa7ca[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa7c('0x0'));var BPromise=require('bluebird');var rs=require(_0xaa7c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa7c('0x2'))['db'];var utils=require(_0xaa7c('0x3'));var logger=require(_0xaa7c('0x4'))(_0xaa7c('0x5'));var config=require(_0xaa7c('0x6'));var jayson=require(_0xaa7c('0x7'));var client=jayson['client'][_0xaa7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eafa6,_0x1e6407,_0x3d9c42){return new BPromise(function(_0x454eba,_0x34b2e3){return client[_0xaa7c('0x9')](_0x1eafa6,_0x3d9c42)['then'](function(_0x1b49ac){logger[_0xaa7c('0xa')]('UserChatInteraction,\x20%s,\x20%s',_0x1e6407,'request\x20sent');logger[_0xaa7c('0xb')](_0xaa7c('0xc'),_0x1e6407,'request\x20sent',JSON['stringify'](_0x1b49ac));if(_0x1b49ac[_0xaa7c('0xd')]){if(_0x1b49ac['error'][_0xaa7c('0xe')]===0x1f4){logger['error'](_0xaa7c('0xf'),_0x1e6407,_0x1b49ac[_0xaa7c('0xd')]['message']);return _0x34b2e3(_0x1b49ac[_0xaa7c('0xd')][_0xaa7c('0x10')]);}logger[_0xaa7c('0xd')](_0xaa7c('0xf'),_0x1e6407,_0x1b49ac[_0xaa7c('0xd')][_0xaa7c('0x10')]);return _0x454eba(_0x1b49ac[_0xaa7c('0xd')]['message']);}else{logger[_0xaa7c('0xa')](_0xaa7c('0xf'),_0x1e6407,'request\x20sent');_0x454eba(_0x1b49ac[_0xaa7c('0x11')][_0xaa7c('0x10')]);}})[_0xaa7c('0x12')](function(_0xc6827c){logger[_0xaa7c('0xd')](_0xaa7c('0xf'),_0x1e6407,_0xc6827c);_0x34b2e3(_0xc6827c);});});} \ No newline at end of file +var _0x6fee=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x4299c4,_0xb792f4){var _0x8785c9=function(_0x10e4a9){while(--_0x10e4a9){_0x4299c4['push'](_0x4299c4['shift']());}};_0x8785c9(++_0xb792f4);}(_0x6fee,0xad));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe6fe('0x0'));var moment=require(_0xe6fe('0x1'));var BPromise=require(_0xe6fe('0x2'));var rs=require(_0xe6fe('0x3'));var fs=require('fs');var Redis=require(_0xe6fe('0x4'));var db=require(_0xe6fe('0x5'))['db'];var utils=require(_0xe6fe('0x6'));var logger=require(_0xe6fe('0x7'))(_0xe6fe('0x8'));var config=require(_0xe6fe('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe6fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38be30,_0x26259e,_0x270a68){return new BPromise(function(_0x128e78,_0x19011e){return client[_0xe6fe('0xb')](_0x38be30,_0x270a68)[_0xe6fe('0xc')](function(_0x33df8c){logger[_0xe6fe('0xd')](_0xe6fe('0xe'),_0x26259e,_0xe6fe('0xf'));logger[_0xe6fe('0x10')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x26259e,_0xe6fe('0xf'),JSON['stringify'](_0x33df8c));if(_0x33df8c[_0xe6fe('0x11')]){if(_0x33df8c[_0xe6fe('0x11')][_0xe6fe('0x12')]===0x1f4){logger[_0xe6fe('0x11')](_0xe6fe('0xe'),_0x26259e,_0x33df8c[_0xe6fe('0x11')]['message']);return _0x19011e(_0x33df8c[_0xe6fe('0x11')]['message']);}logger[_0xe6fe('0x11')](_0xe6fe('0xe'),_0x26259e,_0x33df8c[_0xe6fe('0x11')][_0xe6fe('0x13')]);return _0x128e78(_0x33df8c[_0xe6fe('0x11')][_0xe6fe('0x13')]);}else{logger['info'](_0xe6fe('0xe'),_0x26259e,_0xe6fe('0xf'));_0x128e78(_0x33df8c[_0xe6fe('0x14')][_0xe6fe('0x13')]);}})[_0xe6fe('0x15')](function(_0x15ada0){logger['error'](_0xe6fe('0xe'),_0x26259e,_0x15ada0);_0x19011e(_0x15ada0);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index 1f80da9..b0ae9ef 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 _0xf717=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserChatInteraction.controller','get','isAuthenticated','index','show','put','/:id','update','delete'];(function(_0x15e2a4,_0x399f42){var _0x3d8cde=function(_0x113e34){while(--_0x113e34){_0x15e2a4['push'](_0x15e2a4['shift']());}};_0x3d8cde(++_0x399f42);}(_0xf717,0xfe));var _0x7f71=function(_0x3a16a8,_0x29c536){_0x3a16a8=_0x3a16a8-0x0;var _0x2ab7b6=_0xf717[_0x3a16a8];return _0x2ab7b6;};'use strict';var multer=require(_0x7f71('0x0'));var util=require('util');var path=require(_0x7f71('0x1'));var timeout=require(_0x7f71('0x2'));var express=require('express');var router=express[_0x7f71('0x3')]();var auth=require(_0x7f71('0x4'));var interaction=require(_0x7f71('0x5'));var config=require(_0x7f71('0x6'));var controller=require(_0x7f71('0x7'));router[_0x7f71('0x8')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xa')]);router[_0x7f71('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7f71('0xb')]);router['post']('/',auth[_0x7f71('0x9')](),controller['create']);router[_0x7f71('0xc')](_0x7f71('0xd'),auth[_0x7f71('0x9')](),controller[_0x7f71('0xe')]);router[_0x7f71('0xf')]('/:id',auth[_0x7f71('0x9')](),controller[_0x7f71('0x10')]);module[_0x7f71('0x11')]=router; \ No newline at end of file +var _0xf745=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x51e8c4,_0xb80d6){var _0xbc9969=function(_0x47e58a){while(--_0x47e58a){_0x51e8c4['push'](_0x51e8c4['shift']());}};_0xbc9969(++_0xb80d6);}(_0xf745,0x138));var _0x5f74=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf745[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x5f74('0x0'));var util=require(_0x5f74('0x1'));var path=require(_0x5f74('0x2'));var timeout=require(_0x5f74('0x3'));var express=require(_0x5f74('0x4'));var router=express[_0x5f74('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5f74('0x6'));var config=require(_0x5f74('0x7'));var controller=require('./UserChatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5f74('0x8')]);router['get'](_0x5f74('0x9'),auth[_0x5f74('0xa')](),controller[_0x5f74('0xb')]);router[_0x5f74('0xc')]('/',auth['isAuthenticated'](),controller[_0x5f74('0xd')]);router['put'](_0x5f74('0x9'),auth[_0x5f74('0xa')](),controller[_0x5f74('0xe')]);router[_0x5f74('0xf')](_0x5f74('0x9'),auth[_0x5f74('0xa')](),controller[_0x5f74('0x10')]);module[_0x5f74('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 2724480..44f2d23 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 _0xfa5c=['exports','INTEGER','sequelize'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xfa5c,0xcb));var _0xcfa5=function(_0xc9a8fd,_0x300263){_0xc9a8fd=_0xc9a8fd-0x0;var _0x4fb369=_0xfa5c[_0xc9a8fd];return _0x4fb369;};'use strict';var Sequelize=require(_0xcfa5('0x0'));module[_0xcfa5('0x1')]={'FaxInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xcfa5('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x22e8=['INTEGER'];(function(_0x473150,_0xc3b8e){var _0x13d585=function(_0x546231){while(--_0x546231){_0x473150['push'](_0x473150['shift']());}};_0x13d585(++_0xc3b8e);}(_0x22e8,0xb0));var _0x822e=function(_0x3b3a02,_0x556603){_0x3b3a02=_0x3b3a02-0x0;var _0x48a62d=_0x22e8[_0x3b3a02];return _0x48a62d;};'use strict';var Sequelize=require('sequelize');module['exports']={'FaxInteractionId':{'type':Sequelize[_0x822e('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x822e('0x0')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 71723ce..41d8e95 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 _0x2691=['UserFaxInteractions','destroy','error','stack','name','send','index','map','UserFaxInteraction','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','UserProfileResource','update','params','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','get'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x2691,0x79));var _0x1269=function(_0x113888,_0x741ec7){_0x113888=_0x113888-0x0;var _0x548a9b=_0x2691[_0x113888];return _0x548a9b;};'use strict';var pdf=require(_0x1269('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1269('0x1'));var rp=require(_0x1269('0x2'));var moment=require('moment');var BPromise=require(_0x1269('0x3'));var Mustache=require(_0x1269('0x4'));var util=require(_0x1269('0x5'));var path=require(_0x1269('0x6'));var sox=require('sox');var csv=require(_0x1269('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1269('0x8'));var squel=require(_0x1269('0x9'));var crypto=require(_0x1269('0xa'));var jsforce=require(_0x1269('0xb'));var deskjs=require(_0x1269('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1269('0xd'));var Papa=require(_0x1269('0xe'));var Redis=require(_0x1269('0xf'));var authService=require(_0x1269('0x10'));var qs=require(_0x1269('0x11'));var as=require(_0x1269('0x12'));var hardwareService=require(_0x1269('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1269('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1269('0x15'));var db=require(_0x1269('0x16'))['db'];function respondWithStatusCode(_0x4b319b,_0x544dbf){_0x544dbf=_0x544dbf||0xcc;return function(_0x1a4859){if(_0x1a4859){return _0x4b319b[_0x1269('0x17')](_0x544dbf);}return _0x4b319b[_0x1269('0x18')](_0x544dbf)[_0x1269('0x19')]();};}function respondWithResult(_0x43e5fd,_0x486ba3){_0x486ba3=_0x486ba3||0xc8;return function(_0x13451d){if(_0x13451d){return _0x43e5fd['status'](_0x486ba3)['json'](_0x13451d);}};}function respondWithFilteredResult(_0x2f1159,_0x598456){return function(_0x2a1781){if(_0x2a1781){var _0x3d7a02=_0x2a1781[_0x1269('0x1a')],_0x2001fc=_0x598456[_0x1269('0x1b')],_0x10a4a9=_0x598456[_0x1269('0x1b')]+_0x598456[_0x1269('0x1c')],_0x21b0db;if(_0x10a4a9>=_0x3d7a02){_0x10a4a9=_0x3d7a02;_0x21b0db=0xc8;}else{_0x21b0db=0xce;}_0x2f1159['status'](_0x21b0db);return _0x2f1159['set'](_0x1269('0x1d'),_0x2001fc+'-'+_0x10a4a9+'/'+_0x3d7a02)[_0x1269('0x1e')](_0x2a1781);}return null;};}function patchUpdates(_0x4d38b1){return function(_0xa0efa5){try{jsonpatch['apply'](_0xa0efa5,_0x4d38b1,!![]);}catch(_0x52b76a){return BPromise[_0x1269('0x1f')](_0x52b76a);}return _0xa0efa5[_0x1269('0x20')]();};}function saveUpdates(_0x3c4dac,_0x58aff3){return function(_0x275db0){if(_0x275db0){return _0x275db0['update'](_0x3c4dac)[_0x1269('0x21')](function(_0x4b694a){return _0x4b694a;});}return null;};}function removeEntity(_0x4ed5eb,_0x3bd4ba){return function(_0x43d09e){if(_0x43d09e){return _0x43d09e['destroy']()['then'](function(){var _0x55a17f=_0x43d09e[_0x1269('0x22')]({'plain':!![]});var _0x5d8c9e=_0x1269('0x23');return db['UserProfileResource'][_0x1269('0x24')]({'where':{'type':_0x5d8c9e,'resourceId':_0x55a17f['id']}})['then'](function(){return _0x43d09e;});})[_0x1269('0x21')](function(){_0x4ed5eb[_0x1269('0x18')](0xcc)[_0x1269('0x19')]();});}};}function handleEntityNotFound(_0x3d29e4,_0x130675){return function(_0x42fd97){if(!_0x42fd97){_0x3d29e4[_0x1269('0x17')](0x194);}return _0x42fd97;};}function handleError(_0x388021,_0x514432){_0x514432=_0x514432||0x1f4;return function(_0x30b1de){logger[_0x1269('0x25')](_0x30b1de[_0x1269('0x26')]);if(_0x30b1de[_0x1269('0x27')]){delete _0x30b1de[_0x1269('0x27')];}_0x388021[_0x1269('0x18')](_0x514432)[_0x1269('0x28')](_0x30b1de);};}exports[_0x1269('0x29')]=function(_0xd25055,_0x5d932c){var _0x151342={},_0x41f232={},_0x1e43e5={'count':0x0,'rows':[]};var _0x3879aa=_[_0x1269('0x2a')](db[_0x1269('0x2b')]['rawAttributes'],function(_0x352f98){return{'name':_0x352f98[_0x1269('0x2c')],'type':_0x352f98[_0x1269('0x2d')][_0x1269('0x2e')]};});_0x41f232[_0x1269('0x2f')]=_[_0x1269('0x2a')](_0x3879aa,_0x1269('0x27'));_0x41f232['query']=_[_0x1269('0x30')](_0xd25055[_0x1269('0x31')]);_0x41f232[_0x1269('0x32')]=_['intersection'](_0x41f232[_0x1269('0x2f')],_0x41f232[_0x1269('0x31')]);_0x151342[_0x1269('0x33')]=_[_0x1269('0x34')](_0x41f232[_0x1269('0x2f')],qs[_0x1269('0x35')](_0xd25055[_0x1269('0x31')][_0x1269('0x35')]));_0x151342[_0x1269('0x33')]=_0x151342[_0x1269('0x33')][_0x1269('0x36')]?_0x151342['attributes']:_0x41f232[_0x1269('0x2f')];if(!_0xd25055['query'][_0x1269('0x37')](_0x1269('0x38'))){_0x151342[_0x1269('0x1c')]=qs[_0x1269('0x1c')](_0xd25055['query'][_0x1269('0x1c')]);_0x151342[_0x1269('0x1b')]=qs[_0x1269('0x1b')](_0xd25055[_0x1269('0x31')][_0x1269('0x1b')]);}_0x151342['order']=qs['sort'](_0xd25055[_0x1269('0x31')]['sort']);_0x151342[_0x1269('0x39')]=qs[_0x1269('0x32')](_[_0x1269('0x3a')](_0xd25055['query'],_0x41f232[_0x1269('0x32')]),_0x3879aa);if(_0xd25055['query']['filter']){_0x151342[_0x1269('0x39')]=_[_0x1269('0x3b')](_0x151342[_0x1269('0x39')],{'$or':_[_0x1269('0x2a')](_0x3879aa,function(_0x25ae94){if(_0x25ae94[_0x1269('0x2d')]!==_0x1269('0x3c')){var _0x29de1e={};_0x29de1e[_0x25ae94[_0x1269('0x27')]]={'$like':'%'+_0xd25055[_0x1269('0x31')][_0x1269('0x3d')]+'%'};return _0x29de1e;}})});}_0x151342=_[_0x1269('0x3b')]({},_0x151342,_0xd25055[_0x1269('0x3e')]);var _0x1bee51={'where':_0x151342[_0x1269('0x39')]};return db['UserFaxInteraction'][_0x1269('0x1a')](_0x1bee51)[_0x1269('0x21')](function(_0x2d2ef6){_0x1e43e5['count']=_0x2d2ef6;if(_0xd25055[_0x1269('0x31')][_0x1269('0x3f')]){_0x151342[_0x1269('0x40')]=[{'all':!![]}];}return db['UserFaxInteraction'][_0x1269('0x41')](_0x151342);})[_0x1269('0x21')](function(_0x15fba6){_0x1e43e5[_0x1269('0x42')]=_0x15fba6;return _0x1e43e5;})['then'](respondWithFilteredResult(_0x5d932c,_0x151342))[_0x1269('0x43')](handleError(_0x5d932c,null));};exports['show']=function(_0x37f08f,_0x9a8e6a){var _0x35308a={'raw':!![],'where':{'id':_0x37f08f['params']['id']}},_0x153275={};_0x153275[_0x1269('0x2f')]=_[_0x1269('0x30')](db[_0x1269('0x2b')][_0x1269('0x44')]);_0x153275[_0x1269('0x31')]=_['keys'](_0x37f08f[_0x1269('0x31')]);_0x153275[_0x1269('0x32')]=_[_0x1269('0x34')](_0x153275[_0x1269('0x2f')],_0x153275[_0x1269('0x31')]);_0x35308a[_0x1269('0x33')]=_[_0x1269('0x34')](_0x153275['model'],qs[_0x1269('0x35')](_0x37f08f['query'][_0x1269('0x35')]));_0x35308a[_0x1269('0x33')]=_0x35308a['attributes'][_0x1269('0x36')]?_0x35308a['attributes']:_0x153275['model'];if(_0x37f08f[_0x1269('0x31')][_0x1269('0x3f')]){_0x35308a['include']=[{'all':!![]}];}_0x35308a=_['merge']({},_0x35308a,_0x37f08f[_0x1269('0x3e')]);return db[_0x1269('0x2b')][_0x1269('0x45')](_0x35308a)[_0x1269('0x21')](handleEntityNotFound(_0x9a8e6a,null))[_0x1269('0x21')](respondWithResult(_0x9a8e6a,null))[_0x1269('0x43')](handleError(_0x9a8e6a,null));};exports[_0x1269('0x46')]=function(_0x46458a,_0x578f41){return db[_0x1269('0x2b')][_0x1269('0x46')](_0x46458a[_0x1269('0x47')],{})[_0x1269('0x21')](function(_0x244bba){var _0x517d88=_0x46458a[_0x1269('0x48')][_0x1269('0x22')]({'plain':!![]});if(!_0x517d88)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517d88['role']==='user'){var _0x3298c2=_0x244bba['get']({'plain':!![]});var _0x5b1833=_0x1269('0x23');return db[_0x1269('0x49')][_0x1269('0x45')]({'where':{'name':_0x5b1833,'userProfileId':_0x517d88[_0x1269('0x4a')]},'raw':!![]})['then'](function(_0xacff1){if(_0xacff1&&_0xacff1['autoAssociation']===0x0){return db[_0x1269('0x4b')][_0x1269('0x46')]({'name':_0x3298c2[_0x1269('0x27')],'resourceId':_0x3298c2['id'],'type':_0xacff1[_0x1269('0x27')],'sectionId':_0xacff1['id']},{})[_0x1269('0x21')](function(){return _0x244bba;});}else{return _0x244bba;}})[_0x1269('0x43')](function(_0x330a1c){logger[_0x1269('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x330a1c);throw _0x330a1c;});}return _0x244bba;})[_0x1269('0x21')](respondWithResult(_0x578f41,0xc9))['catch'](handleError(_0x578f41,null));};exports[_0x1269('0x4c')]=function(_0xb711ab,_0x21c190){if(_0xb711ab[_0x1269('0x47')]['id']){delete _0xb711ab['body']['id'];}return db[_0x1269('0x2b')][_0x1269('0x45')]({'where':{'id':_0xb711ab[_0x1269('0x4d')]['id']}})[_0x1269('0x21')](handleEntityNotFound(_0x21c190,null))[_0x1269('0x21')](saveUpdates(_0xb711ab[_0x1269('0x47')],null))[_0x1269('0x21')](respondWithResult(_0x21c190,null))['catch'](handleError(_0x21c190,null));};exports['destroy']=function(_0x1c9c94,_0x238c19){return db[_0x1269('0x2b')][_0x1269('0x45')]({'where':{'id':_0x1c9c94[_0x1269('0x4d')]['id']}})['then'](handleEntityNotFound(_0x238c19,null))[_0x1269('0x21')](removeEntity(_0x238c19,null))[_0x1269('0x43')](handleError(_0x238c19,null));}; \ No newline at end of file +var _0x15dc=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','reject','save','update','then','destroy','get','UserFaxInteractions','UserProfileResource','sendStatus','error','stack','name','index','map','UserFaxInteraction','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x37449e,_0x328f3a){var _0x2d22ad=function(_0x27080c){while(--_0x27080c){_0x37449e['push'](_0x37449e['shift']());}};_0x2d22ad(++_0x328f3a);}(_0x15dc,0x191));var _0xc15d=function(_0xdff4d0,_0x284cbf){_0xdff4d0=_0xdff4d0-0x0;var _0x9f262a=_0x15dc[_0xdff4d0];return _0x9f262a;};'use strict';var pdf=require(_0xc15d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc15d('0x1'));var zipdir=require(_0xc15d('0x2'));var jsonpatch=require(_0xc15d('0x3'));var rp=require('request-promise');var moment=require(_0xc15d('0x4'));var BPromise=require(_0xc15d('0x5'));var Mustache=require(_0xc15d('0x6'));var util=require(_0xc15d('0x7'));var path=require(_0xc15d('0x8'));var sox=require(_0xc15d('0x9'));var csv=require('to-csv');var ejs=require(_0xc15d('0xa'));var fs=require('fs');var _=require(_0xc15d('0xb'));var squel=require(_0xc15d('0xc'));var crypto=require(_0xc15d('0xd'));var jsforce=require(_0xc15d('0xe'));var deskjs=require(_0xc15d('0xf'));var toCsv=require(_0xc15d('0x10'));var querystring=require(_0xc15d('0x11'));var Papa=require('papaparse');var Redis=require(_0xc15d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc15d('0x13'));var as=require(_0xc15d('0x14'));var hardwareService=require(_0xc15d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc15d('0x16'));var config=require(_0xc15d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc15d('0x18'))['db'];function respondWithStatusCode(_0x3809b2,_0x5000a2){_0x5000a2=_0x5000a2||0xcc;return function(_0x4dc17b){if(_0x4dc17b){return _0x3809b2['sendStatus'](_0x5000a2);}return _0x3809b2[_0xc15d('0x19')](_0x5000a2)[_0xc15d('0x1a')]();};}function respondWithResult(_0xee3b11,_0x2bac51){_0x2bac51=_0x2bac51||0xc8;return function(_0x417734){if(_0x417734){return _0xee3b11[_0xc15d('0x19')](_0x2bac51)['json'](_0x417734);}};}function respondWithFilteredResult(_0x9e4143,_0x29260a){return function(_0x22e961){if(_0x22e961){var _0x5a8e80=_0x22e961[_0xc15d('0x1b')],_0x315718=_0x29260a[_0xc15d('0x1c')],_0x107a2a=_0x29260a['offset']+_0x29260a[_0xc15d('0x1d')],_0x2b0fe9;if(_0x107a2a>=_0x5a8e80){_0x107a2a=_0x5a8e80;_0x2b0fe9=0xc8;}else{_0x2b0fe9=0xce;}_0x9e4143[_0xc15d('0x19')](_0x2b0fe9);return _0x9e4143[_0xc15d('0x1e')]('Content-Range',_0x315718+'-'+_0x107a2a+'/'+_0x5a8e80)['json'](_0x22e961);}return null;};}function patchUpdates(_0x48f51f){return function(_0x256464){try{jsonpatch['apply'](_0x256464,_0x48f51f,!![]);}catch(_0x212cc9){return BPromise[_0xc15d('0x1f')](_0x212cc9);}return _0x256464[_0xc15d('0x20')]();};}function saveUpdates(_0x2af0f3,_0x301113){return function(_0x2eca0e){if(_0x2eca0e){return _0x2eca0e[_0xc15d('0x21')](_0x2af0f3)[_0xc15d('0x22')](function(_0xce941f){return _0xce941f;});}return null;};}function removeEntity(_0x2e3c9a,_0x8eba7f){return function(_0x4c3a0c){if(_0x4c3a0c){return _0x4c3a0c[_0xc15d('0x23')]()['then'](function(){var _0xa3face=_0x4c3a0c[_0xc15d('0x24')]({'plain':!![]});var _0x5e22d9=_0xc15d('0x25');return db[_0xc15d('0x26')]['destroy']({'where':{'type':_0x5e22d9,'resourceId':_0xa3face['id']}})[_0xc15d('0x22')](function(){return _0x4c3a0c;});})[_0xc15d('0x22')](function(){_0x2e3c9a[_0xc15d('0x19')](0xcc)[_0xc15d('0x1a')]();});}};}function handleEntityNotFound(_0x4acfe2,_0x1a24e6){return function(_0x343943){if(!_0x343943){_0x4acfe2[_0xc15d('0x27')](0x194);}return _0x343943;};}function handleError(_0x248f07,_0x13587e){_0x13587e=_0x13587e||0x1f4;return function(_0x57bee9){logger[_0xc15d('0x28')](_0x57bee9[_0xc15d('0x29')]);if(_0x57bee9[_0xc15d('0x2a')]){delete _0x57bee9[_0xc15d('0x2a')];}_0x248f07[_0xc15d('0x19')](_0x13587e)['send'](_0x57bee9);};}exports[_0xc15d('0x2b')]=function(_0xb8b14c,_0x4c02b2){var _0x512d17={},_0x2d98a0={},_0x156d6b={'count':0x0,'rows':[]};var _0x24469a=_[_0xc15d('0x2c')](db[_0xc15d('0x2d')][_0xc15d('0x2e')],function(_0xa01110){return{'name':_0xa01110[_0xc15d('0x2f')],'type':_0xa01110[_0xc15d('0x30')]['key']};});_0x2d98a0[_0xc15d('0x31')]=_[_0xc15d('0x2c')](_0x24469a,'name');_0x2d98a0[_0xc15d('0x32')]=_['keys'](_0xb8b14c[_0xc15d('0x32')]);_0x2d98a0['filters']=_[_0xc15d('0x33')](_0x2d98a0[_0xc15d('0x31')],_0x2d98a0[_0xc15d('0x32')]);_0x512d17[_0xc15d('0x34')]=_[_0xc15d('0x33')](_0x2d98a0['model'],qs[_0xc15d('0x35')](_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x35')]));_0x512d17[_0xc15d('0x34')]=_0x512d17[_0xc15d('0x34')][_0xc15d('0x36')]?_0x512d17[_0xc15d('0x34')]:_0x2d98a0[_0xc15d('0x31')];if(!_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x37')](_0xc15d('0x38'))){_0x512d17[_0xc15d('0x1d')]=qs[_0xc15d('0x1d')](_0xb8b14c['query'][_0xc15d('0x1d')]);_0x512d17[_0xc15d('0x1c')]=qs[_0xc15d('0x1c')](_0xb8b14c['query'][_0xc15d('0x1c')]);}_0x512d17[_0xc15d('0x39')]=qs['sort'](_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x3a')]);_0x512d17[_0xc15d('0x3b')]=qs[_0xc15d('0x3c')](_[_0xc15d('0x3d')](_0xb8b14c['query'],_0x2d98a0[_0xc15d('0x3c')]),_0x24469a);if(_0xb8b14c['query']['filter']){_0x512d17[_0xc15d('0x3b')]=_[_0xc15d('0x3e')](_0x512d17[_0xc15d('0x3b')],{'$or':_['map'](_0x24469a,function(_0x37e7cb){if(_0x37e7cb[_0xc15d('0x30')]!==_0xc15d('0x3f')){var _0x2f5631={};_0x2f5631[_0x37e7cb[_0xc15d('0x2a')]]={'$like':'%'+_0xb8b14c['query'][_0xc15d('0x40')]+'%'};return _0x2f5631;}})});}_0x512d17=_[_0xc15d('0x3e')]({},_0x512d17,_0xb8b14c['options']);var _0x350461={'where':_0x512d17[_0xc15d('0x3b')]};return db[_0xc15d('0x2d')][_0xc15d('0x1b')](_0x350461)[_0xc15d('0x22')](function(_0x3a7647){_0x156d6b[_0xc15d('0x1b')]=_0x3a7647;if(_0xb8b14c[_0xc15d('0x32')][_0xc15d('0x41')]){_0x512d17[_0xc15d('0x42')]=[{'all':!![]}];}return db[_0xc15d('0x2d')][_0xc15d('0x43')](_0x512d17);})['then'](function(_0x280177){_0x156d6b['rows']=_0x280177;return _0x156d6b;})['then'](respondWithFilteredResult(_0x4c02b2,_0x512d17))['catch'](handleError(_0x4c02b2,null));};exports[_0xc15d('0x44')]=function(_0x584f70,_0x405aa2){var _0x44c8b7={'raw':!![],'where':{'id':_0x584f70[_0xc15d('0x45')]['id']}},_0x2a4d78={};_0x2a4d78['model']=_[_0xc15d('0x46')](db[_0xc15d('0x2d')][_0xc15d('0x2e')]);_0x2a4d78[_0xc15d('0x32')]=_[_0xc15d('0x46')](_0x584f70[_0xc15d('0x32')]);_0x2a4d78[_0xc15d('0x3c')]=_['intersection'](_0x2a4d78[_0xc15d('0x31')],_0x2a4d78[_0xc15d('0x32')]);_0x44c8b7[_0xc15d('0x34')]=_[_0xc15d('0x33')](_0x2a4d78[_0xc15d('0x31')],qs[_0xc15d('0x35')](_0x584f70[_0xc15d('0x32')][_0xc15d('0x35')]));_0x44c8b7[_0xc15d('0x34')]=_0x44c8b7[_0xc15d('0x34')][_0xc15d('0x36')]?_0x44c8b7['attributes']:_0x2a4d78[_0xc15d('0x31')];if(_0x584f70[_0xc15d('0x32')][_0xc15d('0x41')]){_0x44c8b7[_0xc15d('0x42')]=[{'all':!![]}];}_0x44c8b7=_[_0xc15d('0x3e')]({},_0x44c8b7,_0x584f70[_0xc15d('0x47')]);return db[_0xc15d('0x2d')][_0xc15d('0x48')](_0x44c8b7)[_0xc15d('0x22')](handleEntityNotFound(_0x405aa2,null))[_0xc15d('0x22')](respondWithResult(_0x405aa2,null))[_0xc15d('0x49')](handleError(_0x405aa2,null));};exports[_0xc15d('0x4a')]=function(_0x1e084c,_0x406dae){return db['UserFaxInteraction'][_0xc15d('0x4a')](_0x1e084c[_0xc15d('0x4b')],{})[_0xc15d('0x22')](function(_0x3d6eb0){var _0x3e67b0=_0x1e084c[_0xc15d('0x4c')][_0xc15d('0x24')]({'plain':!![]});if(!_0x3e67b0)throw new Error(_0xc15d('0x4d'));if(_0x3e67b0[_0xc15d('0x4e')]==='user'){var _0x45b1e2=_0x3d6eb0[_0xc15d('0x24')]({'plain':!![]});var _0xd58757=_0xc15d('0x25');return db[_0xc15d('0x4f')]['find']({'where':{'name':_0xd58757,'userProfileId':_0x3e67b0[_0xc15d('0x50')]},'raw':!![]})[_0xc15d('0x22')](function(_0x467e42){if(_0x467e42&&_0x467e42['autoAssociation']===0x0){return db['UserProfileResource'][_0xc15d('0x4a')]({'name':_0x45b1e2['name'],'resourceId':_0x45b1e2['id'],'type':_0x467e42['name'],'sectionId':_0x467e42['id']},{})[_0xc15d('0x22')](function(){return _0x3d6eb0;});}else{return _0x3d6eb0;}})[_0xc15d('0x49')](function(_0x249f97){logger[_0xc15d('0x28')](_0xc15d('0x51'),_0x249f97);throw _0x249f97;});}return _0x3d6eb0;})[_0xc15d('0x22')](respondWithResult(_0x406dae,0xc9))[_0xc15d('0x49')](handleError(_0x406dae,null));};exports[_0xc15d('0x21')]=function(_0x44af31,_0x2fd489){if(_0x44af31[_0xc15d('0x4b')]['id']){delete _0x44af31[_0xc15d('0x4b')]['id'];}return db['UserFaxInteraction'][_0xc15d('0x48')]({'where':{'id':_0x44af31[_0xc15d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fd489,null))[_0xc15d('0x22')](saveUpdates(_0x44af31[_0xc15d('0x4b')],null))['then'](respondWithResult(_0x2fd489,null))[_0xc15d('0x49')](handleError(_0x2fd489,null));};exports[_0xc15d('0x23')]=function(_0x173297,_0x1738bf){return db['UserFaxInteraction'][_0xc15d('0x48')]({'where':{'id':_0x173297[_0xc15d('0x45')]['id']}})[_0xc15d('0x22')](handleEntityNotFound(_0x1738bf,null))[_0xc15d('0x22')](removeEntity(_0x1738bf,null))[_0xc15d('0x49')](handleError(_0x1738bf,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 004642e..b6612d9 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 _0x2032=['user_has_fax_interactions','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./UserFaxInteraction.attributes','exports','define','UserFaxInteraction'];(function(_0x337ea3,_0x39dec5){var _0x19e033=function(_0xf4785f){while(--_0xf4785f){_0x337ea3['push'](_0x337ea3['shift']());}};_0x19e033(++_0x39dec5);}(_0x2032,0xd9));var _0x2203=function(_0x259007,_0x548a53){_0x259007=_0x259007-0x0;var _0x2466d1=_0x2032[_0x259007];return _0x2466d1;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x4cccfc,_0x1b0d1c){var _0x2103b3=function(_0x3f99db){while(--_0x3f99db){_0x4cccfc['push'](_0x4cccfc['shift']());}};_0x2103b3(++_0x1b0d1c);}(_0xdb28,0x106));var _0x8db2=function(_0x106590,_0x143a18){_0x106590=_0x106590-0x0;var _0x104fbc=_0xdb28[_0x106590];return _0x104fbc;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./UserFaxInteraction.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index 277c71a..465534f 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 _0x0f57=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','UserFaxInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3a77c9,_0x426b79){var _0x1de22e=function(_0x4ae6ac){while(--_0x4ae6ac){_0x3a77c9['push'](_0x3a77c9['shift']());}};_0x1de22e(++_0x426b79);}(_0x0f57,0xba));var _0x70f5=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x0f57[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x70f5('0x0'));var util=require(_0x70f5('0x1'));var moment=require(_0x70f5('0x2'));var BPromise=require(_0x70f5('0x3'));var rs=require(_0x70f5('0x4'));var fs=require('fs');var Redis=require(_0x70f5('0x5'));var db=require(_0x70f5('0x6'))['db'];var utils=require(_0x70f5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x70f5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70f5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13db35,_0x34afaf,_0xe2fec8){return new BPromise(function(_0x7b539d,_0x73fb74){return client[_0x70f5('0xa')](_0x13db35,_0xe2fec8)[_0x70f5('0xb')](function(_0x59856b){logger['info'](_0x70f5('0xc'),_0x34afaf,_0x70f5('0xd'));logger['debug']('UserFaxInteraction,\x20%s,\x20%s,\x20%s',_0x34afaf,_0x70f5('0xd'),JSON[_0x70f5('0xe')](_0x59856b));if(_0x59856b[_0x70f5('0xf')]){if(_0x59856b[_0x70f5('0xf')][_0x70f5('0x10')]===0x1f4){logger[_0x70f5('0xf')](_0x70f5('0xc'),_0x34afaf,_0x59856b[_0x70f5('0xf')][_0x70f5('0x11')]);return _0x73fb74(_0x59856b[_0x70f5('0xf')]['message']);}logger[_0x70f5('0xf')](_0x70f5('0xc'),_0x34afaf,_0x59856b[_0x70f5('0xf')][_0x70f5('0x11')]);return _0x7b539d(_0x59856b[_0x70f5('0xf')]['message']);}else{logger[_0x70f5('0x12')](_0x70f5('0xc'),_0x34afaf,_0x70f5('0xd'));_0x7b539d(_0x59856b['result'][_0x70f5('0x11')]);}})[_0x70f5('0x13')](function(_0xed3d5c){logger[_0x70f5('0xf')](_0x70f5('0xc'),_0x34afaf,_0xed3d5c);_0x73fb74(_0xed3d5c);});});} \ No newline at end of file +var _0x361f=['request','then','info','UserFaxInteraction,\x20%s,\x20%s','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x339bb2,_0x271e84){var _0x323ba1=function(_0xe5160a){while(--_0xe5160a){_0x339bb2['push'](_0x339bb2['shift']());}};_0x323ba1(++_0x271e84);}(_0x361f,0xc8));var _0xf361=function(_0x317aa3,_0x6dd3a9){_0x317aa3=_0x317aa3-0x0;var _0x309c1f=_0x361f[_0x317aa3];return _0x309c1f;};'use strict';var _=require(_0xf361('0x0'));var util=require('util');var moment=require(_0xf361('0x1'));var BPromise=require('bluebird');var rs=require(_0xf361('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf361('0x3'))['db'];var utils=require(_0xf361('0x4'));var logger=require('../../config/logger')(_0xf361('0x5'));var config=require(_0xf361('0x6'));var jayson=require(_0xf361('0x7'));var client=jayson[_0xf361('0x8')][_0xf361('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287e4a,_0x5436cb,_0x57de06){return new BPromise(function(_0x4c7f26,_0x15552d){return client[_0xf361('0xa')](_0x287e4a,_0x57de06)[_0xf361('0xb')](function(_0x4d7ff8){logger[_0xf361('0xc')](_0xf361('0xd'),_0x5436cb,'request\x20sent');logger['debug'](_0xf361('0xe'),_0x5436cb,_0xf361('0xf'),JSON['stringify'](_0x4d7ff8));if(_0x4d7ff8[_0xf361('0x10')]){if(_0x4d7ff8[_0xf361('0x10')][_0xf361('0x11')]===0x1f4){logger['error']('UserFaxInteraction,\x20%s,\x20%s',_0x5436cb,_0x4d7ff8[_0xf361('0x10')][_0xf361('0x12')]);return _0x15552d(_0x4d7ff8['error'][_0xf361('0x12')]);}logger[_0xf361('0x10')]('UserFaxInteraction,\x20%s,\x20%s',_0x5436cb,_0x4d7ff8[_0xf361('0x10')]['message']);return _0x4c7f26(_0x4d7ff8[_0xf361('0x10')][_0xf361('0x12')]);}else{logger[_0xf361('0xc')](_0xf361('0xd'),_0x5436cb,'request\x20sent');_0x4c7f26(_0x4d7ff8[_0xf361('0x13')]['message']);}})[_0xf361('0x14')](function(_0x469d5d){logger[_0xf361('0x10')](_0xf361('0xd'),_0x5436cb,_0x469d5d);_0x15552d(_0x469d5d);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 666cb01..fd0a7e7 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 _0x72ea=['util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','post','put','update','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72ea,0x109));var _0xa72e=function(_0x11b409,_0x5ab032){_0x11b409=_0x11b409-0x0;var _0x3df1c1=_0x72ea[_0x11b409];return _0x3df1c1;};'use strict';var multer=require(_0xa72e('0x0'));var util=require(_0xa72e('0x1'));var path=require(_0xa72e('0x2'));var timeout=require(_0xa72e('0x3'));var express=require('express');var router=express[_0xa72e('0x4')]();var auth=require(_0xa72e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./UserFaxInteraction.controller');router[_0xa72e('0x6')]('/',auth[_0xa72e('0x7')](),controller[_0xa72e('0x8')]);router[_0xa72e('0x6')](_0xa72e('0x9'),auth[_0xa72e('0x7')](),controller['show']);router[_0xa72e('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa72e('0xb')](_0xa72e('0x9'),auth['isAuthenticated'](),controller[_0xa72e('0xc')]);router['delete'](_0xa72e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa72e('0xd')]=router; \ No newline at end of file +var _0x166e=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','update','destroy','exports','multer'];(function(_0x5c43e1,_0x4c1705){var _0x397fa7=function(_0x4485e8){while(--_0x4485e8){_0x5c43e1['push'](_0x5c43e1['shift']());}};_0x397fa7(++_0x4c1705);}(_0x166e,0x9f));var _0xe166=function(_0x2f067b,_0x23d257){_0x2f067b=_0x2f067b-0x0;var _0x1b7a26=_0x166e[_0x2f067b];return _0x1b7a26;};'use strict';var multer=require(_0xe166('0x0'));var util=require(_0xe166('0x1'));var path=require(_0xe166('0x2'));var timeout=require(_0xe166('0x3'));var express=require(_0xe166('0x4'));var router=express[_0xe166('0x5')]();var auth=require(_0xe166('0x6'));var interaction=require(_0xe166('0x7'));var config=require('../../config/environment');var controller=require('./UserFaxInteraction.controller');router[_0xe166('0x8')]('/',auth[_0xe166('0x9')](),controller[_0xe166('0xa')]);router['get'](_0xe166('0xb'),auth[_0xe166('0x9')](),controller['show']);router[_0xe166('0xc')]('/',auth[_0xe166('0x9')](),controller['create']);router['put']('/:id',auth[_0xe166('0x9')](),controller[_0xe166('0xd')]);router['delete'](_0xe166('0xb'),auth[_0xe166('0x9')](),controller[_0xe166('0xe')]);module[_0xe166('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 6e35b79..aa366d1 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 _0x800b=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x800b,0xb9));var _0xb800=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x800b[_0xe15270];return _0x1e813b;};'use strict';var Sequelize=require(_0xb800('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0xb800('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xb800('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xf49b=['exports','INTEGER'];(function(_0x1bc7ac,_0x1eed0e){var _0x5a35d7=function(_0x1496c6){while(--_0x1496c6){_0x1bc7ac['push'](_0x1bc7ac['shift']());}};_0x5a35d7(++_0x1eed0e);}(_0xf49b,0xe4));var _0xbf49=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf49b[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xbf49('0x0')]={'MailInteractionId':{'type':Sequelize[_0xbf49('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xbf49('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index 8a64bb8..363a64d 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 _0xa5ab=['update','destroy','get','UserMailInteractions','UserProfileResource','sendStatus','error','stack','name','send','index','UserMailInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','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','status','end','json','count','offset','limit','Content-Range','save'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0xa5ab,0x1d2));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xba5a('0x0'));var emlformat=require(_0xba5a('0x1'));var rimraf=require(_0xba5a('0x2'));var zipdir=require(_0xba5a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba5a('0x4'));var Mustache=require(_0xba5a('0x5'));var util=require(_0xba5a('0x6'));var path=require(_0xba5a('0x7'));var sox=require(_0xba5a('0x8'));var csv=require('to-csv');var ejs=require(_0xba5a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xba5a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xba5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xba5a('0xc'));var Papa=require(_0xba5a('0xd'));var Redis=require('ioredis');var authService=require(_0xba5a('0xe'));var qs=require(_0xba5a('0xf'));var as=require(_0xba5a('0x10'));var hardwareService=require(_0xba5a('0x11'));var logger=require(_0xba5a('0x12'))(_0xba5a('0x13'));var utils=require(_0xba5a('0x14'));var config=require(_0xba5a('0x15'));var licenseUtil=require(_0xba5a('0x16'));var db=require(_0xba5a('0x17'))['db'];function respondWithStatusCode(_0x20b7d4,_0x4c153e){_0x4c153e=_0x4c153e||0xcc;return function(_0x4eb034){if(_0x4eb034){return _0x20b7d4['sendStatus'](_0x4c153e);}return _0x20b7d4[_0xba5a('0x18')](_0x4c153e)[_0xba5a('0x19')]();};}function respondWithResult(_0x464c0c,_0x2807f4){_0x2807f4=_0x2807f4||0xc8;return function(_0x3a2d4a){if(_0x3a2d4a){return _0x464c0c['status'](_0x2807f4)[_0xba5a('0x1a')](_0x3a2d4a);}};}function respondWithFilteredResult(_0x17a0cf,_0x1b5239){return function(_0x457262){if(_0x457262){var _0x3b4f8f=_0x457262[_0xba5a('0x1b')],_0x3f4b6a=_0x1b5239[_0xba5a('0x1c')],_0x1d167b=_0x1b5239[_0xba5a('0x1c')]+_0x1b5239[_0xba5a('0x1d')],_0x85f071;if(_0x1d167b>=_0x3b4f8f){_0x1d167b=_0x3b4f8f;_0x85f071=0xc8;}else{_0x85f071=0xce;}_0x17a0cf[_0xba5a('0x18')](_0x85f071);return _0x17a0cf['set'](_0xba5a('0x1e'),_0x3f4b6a+'-'+_0x1d167b+'/'+_0x3b4f8f)['json'](_0x457262);}return null;};}function patchUpdates(_0x220a64){return function(_0x5b0284){try{jsonpatch['apply'](_0x5b0284,_0x220a64,!![]);}catch(_0x4d24d4){return BPromise['reject'](_0x4d24d4);}return _0x5b0284[_0xba5a('0x1f')]();};}function saveUpdates(_0x29f506,_0x1612ae){return function(_0x2eb1b6){if(_0x2eb1b6){return _0x2eb1b6[_0xba5a('0x20')](_0x29f506)['then'](function(_0x1f095c){return _0x1f095c;});}return null;};}function removeEntity(_0x4fcd1e,_0x5f4bb7){return function(_0x12b0b4){if(_0x12b0b4){return _0x12b0b4[_0xba5a('0x21')]()['then'](function(){var _0x11d521=_0x12b0b4[_0xba5a('0x22')]({'plain':!![]});var _0x49c217=_0xba5a('0x23');return db[_0xba5a('0x24')][_0xba5a('0x21')]({'where':{'type':_0x49c217,'resourceId':_0x11d521['id']}})['then'](function(){return _0x12b0b4;});})['then'](function(){_0x4fcd1e[_0xba5a('0x18')](0xcc)[_0xba5a('0x19')]();});}};}function handleEntityNotFound(_0x1a0a3e,_0x514163){return function(_0x23d5ce){if(!_0x23d5ce){_0x1a0a3e[_0xba5a('0x25')](0x194);}return _0x23d5ce;};}function handleError(_0x30a45c,_0x5c7a42){_0x5c7a42=_0x5c7a42||0x1f4;return function(_0x397e0e){logger[_0xba5a('0x26')](_0x397e0e[_0xba5a('0x27')]);if(_0x397e0e[_0xba5a('0x28')]){delete _0x397e0e['name'];}_0x30a45c[_0xba5a('0x18')](_0x5c7a42)[_0xba5a('0x29')](_0x397e0e);};}exports[_0xba5a('0x2a')]=function(_0x184a83,_0x83da11){var _0x637a1e={},_0x372a93={},_0x1a7bb0={'count':0x0,'rows':[]};var _0x314e12=_['map'](db[_0xba5a('0x2b')][_0xba5a('0x2c')],function(_0x388a1e){return{'name':_0x388a1e[_0xba5a('0x2d')],'type':_0x388a1e[_0xba5a('0x2e')][_0xba5a('0x2f')]};});_0x372a93[_0xba5a('0x30')]=_[_0xba5a('0x31')](_0x314e12,_0xba5a('0x28'));_0x372a93[_0xba5a('0x32')]=_[_0xba5a('0x33')](_0x184a83[_0xba5a('0x32')]);_0x372a93[_0xba5a('0x34')]=_[_0xba5a('0x35')](_0x372a93[_0xba5a('0x30')],_0x372a93[_0xba5a('0x32')]);_0x637a1e[_0xba5a('0x36')]=_[_0xba5a('0x35')](_0x372a93[_0xba5a('0x30')],qs['fields'](_0x184a83[_0xba5a('0x32')][_0xba5a('0x37')]));_0x637a1e[_0xba5a('0x36')]=_0x637a1e[_0xba5a('0x36')][_0xba5a('0x38')]?_0x637a1e[_0xba5a('0x36')]:_0x372a93[_0xba5a('0x30')];if(!_0x184a83['query'][_0xba5a('0x39')](_0xba5a('0x3a'))){_0x637a1e[_0xba5a('0x1d')]=qs[_0xba5a('0x1d')](_0x184a83[_0xba5a('0x32')][_0xba5a('0x1d')]);_0x637a1e[_0xba5a('0x1c')]=qs['offset'](_0x184a83[_0xba5a('0x32')]['offset']);}_0x637a1e[_0xba5a('0x3b')]=qs['sort'](_0x184a83[_0xba5a('0x32')][_0xba5a('0x3c')]);_0x637a1e[_0xba5a('0x3d')]=qs[_0xba5a('0x34')](_[_0xba5a('0x3e')](_0x184a83[_0xba5a('0x32')],_0x372a93[_0xba5a('0x34')]),_0x314e12);if(_0x184a83[_0xba5a('0x32')][_0xba5a('0x3f')]){_0x637a1e[_0xba5a('0x3d')]=_[_0xba5a('0x40')](_0x637a1e[_0xba5a('0x3d')],{'$or':_[_0xba5a('0x31')](_0x314e12,function(_0x1eab99){if(_0x1eab99[_0xba5a('0x2e')]!==_0xba5a('0x41')){var _0x354a48={};_0x354a48[_0x1eab99['name']]={'$like':'%'+_0x184a83[_0xba5a('0x32')]['filter']+'%'};return _0x354a48;}})});}_0x637a1e=_[_0xba5a('0x40')]({},_0x637a1e,_0x184a83[_0xba5a('0x42')]);var _0x3097db={'where':_0x637a1e[_0xba5a('0x3d')]};return db[_0xba5a('0x2b')]['count'](_0x3097db)[_0xba5a('0x43')](function(_0x254b6e){_0x1a7bb0[_0xba5a('0x1b')]=_0x254b6e;if(_0x184a83[_0xba5a('0x32')][_0xba5a('0x44')]){_0x637a1e[_0xba5a('0x45')]=[{'all':!![]}];}return db[_0xba5a('0x2b')]['findAll'](_0x637a1e);})[_0xba5a('0x43')](function(_0x3959dc){_0x1a7bb0[_0xba5a('0x46')]=_0x3959dc;return _0x1a7bb0;})[_0xba5a('0x43')](respondWithFilteredResult(_0x83da11,_0x637a1e))[_0xba5a('0x47')](handleError(_0x83da11,null));};exports[_0xba5a('0x48')]=function(_0x4bcde0,_0x5962ab){var _0x5917ea={'raw':!![],'where':{'id':_0x4bcde0['params']['id']}},_0x3f899e={};_0x3f899e[_0xba5a('0x30')]=_['keys'](db[_0xba5a('0x2b')][_0xba5a('0x2c')]);_0x3f899e[_0xba5a('0x32')]=_['keys'](_0x4bcde0[_0xba5a('0x32')]);_0x3f899e[_0xba5a('0x34')]=_[_0xba5a('0x35')](_0x3f899e['model'],_0x3f899e[_0xba5a('0x32')]);_0x5917ea[_0xba5a('0x36')]=_[_0xba5a('0x35')](_0x3f899e['model'],qs[_0xba5a('0x37')](_0x4bcde0[_0xba5a('0x32')][_0xba5a('0x37')]));_0x5917ea[_0xba5a('0x36')]=_0x5917ea[_0xba5a('0x36')][_0xba5a('0x38')]?_0x5917ea[_0xba5a('0x36')]:_0x3f899e[_0xba5a('0x30')];if(_0x4bcde0[_0xba5a('0x32')][_0xba5a('0x44')]){_0x5917ea[_0xba5a('0x45')]=[{'all':!![]}];}_0x5917ea=_['merge']({},_0x5917ea,_0x4bcde0[_0xba5a('0x42')]);return db[_0xba5a('0x2b')][_0xba5a('0x49')](_0x5917ea)[_0xba5a('0x43')](handleEntityNotFound(_0x5962ab,null))['then'](respondWithResult(_0x5962ab,null))[_0xba5a('0x47')](handleError(_0x5962ab,null));};exports[_0xba5a('0x4a')]=function(_0x3d3f3a,_0x2c880f){return db[_0xba5a('0x2b')][_0xba5a('0x4a')](_0x3d3f3a[_0xba5a('0x4b')],{})[_0xba5a('0x43')](function(_0x1fecc6){var _0x567834=_0x3d3f3a[_0xba5a('0x4c')][_0xba5a('0x22')]({'plain':!![]});if(!_0x567834)throw new Error(_0xba5a('0x4d'));if(_0x567834['role']===_0xba5a('0x4c')){var _0x5c3c0b=_0x1fecc6[_0xba5a('0x22')]({'plain':!![]});var _0x2ea016='UserMailInteractions';return db[_0xba5a('0x4e')]['find']({'where':{'name':_0x2ea016,'userProfileId':_0x567834[_0xba5a('0x4f')]},'raw':!![]})[_0xba5a('0x43')](function(_0x4ad193){if(_0x4ad193&&_0x4ad193[_0xba5a('0x50')]===0x0){return db['UserProfileResource'][_0xba5a('0x4a')]({'name':_0x5c3c0b[_0xba5a('0x28')],'resourceId':_0x5c3c0b['id'],'type':_0x4ad193['name'],'sectionId':_0x4ad193['id']},{})[_0xba5a('0x43')](function(){return _0x1fecc6;});}else{return _0x1fecc6;}})[_0xba5a('0x47')](function(_0x221c7c){logger['error'](_0xba5a('0x51'),_0x221c7c);throw _0x221c7c;});}return _0x1fecc6;})[_0xba5a('0x43')](respondWithResult(_0x2c880f,0xc9))[_0xba5a('0x47')](handleError(_0x2c880f,null));};exports[_0xba5a('0x20')]=function(_0x167410,_0x4bf308){if(_0x167410[_0xba5a('0x4b')]['id']){delete _0x167410[_0xba5a('0x4b')]['id'];}return db['UserMailInteraction'][_0xba5a('0x49')]({'where':{'id':_0x167410[_0xba5a('0x52')]['id']}})[_0xba5a('0x43')](handleEntityNotFound(_0x4bf308,null))[_0xba5a('0x43')](saveUpdates(_0x167410[_0xba5a('0x4b')],null))[_0xba5a('0x43')](respondWithResult(_0x4bf308,null))['catch'](handleError(_0x4bf308,null));};exports['destroy']=function(_0x4bbed5,_0x4d4daf){return db[_0xba5a('0x2b')][_0xba5a('0x49')]({'where':{'id':_0x4bbed5[_0xba5a('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d4daf,null))[_0xba5a('0x43')](removeEntity(_0x4d4daf,null))[_0xba5a('0x47')](handleError(_0x4d4daf,null));}; \ No newline at end of file +var _0x4892=['create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','json','apply','reject','save','update','then','get','UserMailInteractions','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','UserMailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0xc60b8d,_0x2d220a){var _0x42349a=function(_0x3bd09e){while(--_0x3bd09e){_0xc60b8d['push'](_0xc60b8d['shift']());}};_0x42349a(++_0x2d220a);}(_0x4892,0x1b0));var _0x2489=function(_0x29d753,_0x118d2d){_0x29d753=_0x29d753-0x0;var _0x55682a=_0x4892[_0x29d753];return _0x55682a;};'use strict';var pdf=require(_0x2489('0x0'));var emlformat=require(_0x2489('0x1'));var rimraf=require(_0x2489('0x2'));var zipdir=require(_0x2489('0x3'));var jsonpatch=require(_0x2489('0x4'));var rp=require('request-promise');var moment=require(_0x2489('0x5'));var BPromise=require(_0x2489('0x6'));var Mustache=require('mustache');var util=require(_0x2489('0x7'));var path=require(_0x2489('0x8'));var sox=require(_0x2489('0x9'));var csv=require(_0x2489('0xa'));var ejs=require(_0x2489('0xb'));var fs=require('fs');var _=require(_0x2489('0xc'));var squel=require(_0x2489('0xd'));var crypto=require(_0x2489('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2489('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2489('0x10'));var Redis=require(_0x2489('0x11'));var authService=require(_0x2489('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2489('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2489('0x14'))(_0x2489('0x15'));var utils=require(_0x2489('0x16'));var config=require(_0x2489('0x17'));var licenseUtil=require(_0x2489('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1257f5,_0x3a5cfb){_0x3a5cfb=_0x3a5cfb||0xcc;return function(_0x1824c3){if(_0x1824c3){return _0x1257f5['sendStatus'](_0x3a5cfb);}return _0x1257f5[_0x2489('0x19')](_0x3a5cfb)[_0x2489('0x1a')]();};}function respondWithResult(_0x1c74a0,_0x2e0bcd){_0x2e0bcd=_0x2e0bcd||0xc8;return function(_0x4bbc4d){if(_0x4bbc4d){return _0x1c74a0[_0x2489('0x19')](_0x2e0bcd)['json'](_0x4bbc4d);}};}function respondWithFilteredResult(_0x1c0a5d,_0x5df47b){return function(_0x1374e8){if(_0x1374e8){var _0x3f6274=_0x1374e8[_0x2489('0x1b')],_0x36197b=_0x5df47b['offset'],_0xc1b535=_0x5df47b[_0x2489('0x1c')]+_0x5df47b[_0x2489('0x1d')],_0x46413e;if(_0xc1b535>=_0x3f6274){_0xc1b535=_0x3f6274;_0x46413e=0xc8;}else{_0x46413e=0xce;}_0x1c0a5d[_0x2489('0x19')](_0x46413e);return _0x1c0a5d[_0x2489('0x1e')]('Content-Range',_0x36197b+'-'+_0xc1b535+'/'+_0x3f6274)[_0x2489('0x1f')](_0x1374e8);}return null;};}function patchUpdates(_0x79d5b8){return function(_0xdc51d4){try{jsonpatch[_0x2489('0x20')](_0xdc51d4,_0x79d5b8,!![]);}catch(_0x4d7462){return BPromise[_0x2489('0x21')](_0x4d7462);}return _0xdc51d4[_0x2489('0x22')]();};}function saveUpdates(_0x30e0d3,_0x53a28d){return function(_0x146326){if(_0x146326){return _0x146326[_0x2489('0x23')](_0x30e0d3)['then'](function(_0x540158){return _0x540158;});}return null;};}function removeEntity(_0x41be80,_0x50d7b0){return function(_0x540860){if(_0x540860){return _0x540860['destroy']()[_0x2489('0x24')](function(){var _0x32170f=_0x540860[_0x2489('0x25')]({'plain':!![]});var _0x27d3e5=_0x2489('0x26');return db[_0x2489('0x27')][_0x2489('0x28')]({'where':{'type':_0x27d3e5,'resourceId':_0x32170f['id']}})['then'](function(){return _0x540860;});})['then'](function(){_0x41be80[_0x2489('0x19')](0xcc)[_0x2489('0x1a')]();});}};}function handleEntityNotFound(_0x57f86,_0x1449b8){return function(_0x1d31f1){if(!_0x1d31f1){_0x57f86[_0x2489('0x29')](0x194);}return _0x1d31f1;};}function handleError(_0x588c21,_0x510e4e){_0x510e4e=_0x510e4e||0x1f4;return function(_0xc3711a){logger[_0x2489('0x2a')](_0xc3711a[_0x2489('0x2b')]);if(_0xc3711a[_0x2489('0x2c')]){delete _0xc3711a[_0x2489('0x2c')];}_0x588c21[_0x2489('0x19')](_0x510e4e)['send'](_0xc3711a);};}exports[_0x2489('0x2d')]=function(_0x39a36c,_0x1fb9b9){var _0x18748b={},_0x503c39={},_0x526278={'count':0x0,'rows':[]};var _0x498b84=_[_0x2489('0x2e')](db[_0x2489('0x2f')][_0x2489('0x30')],function(_0x37b513){return{'name':_0x37b513[_0x2489('0x31')],'type':_0x37b513[_0x2489('0x32')][_0x2489('0x33')]};});_0x503c39[_0x2489('0x34')]=_[_0x2489('0x2e')](_0x498b84,_0x2489('0x2c'));_0x503c39[_0x2489('0x35')]=_[_0x2489('0x36')](_0x39a36c[_0x2489('0x35')]);_0x503c39[_0x2489('0x37')]=_[_0x2489('0x38')](_0x503c39[_0x2489('0x34')],_0x503c39[_0x2489('0x35')]);_0x18748b[_0x2489('0x39')]=_[_0x2489('0x38')](_0x503c39[_0x2489('0x34')],qs[_0x2489('0x3a')](_0x39a36c['query'][_0x2489('0x3a')]));_0x18748b[_0x2489('0x39')]=_0x18748b[_0x2489('0x39')][_0x2489('0x3b')]?_0x18748b[_0x2489('0x39')]:_0x503c39[_0x2489('0x34')];if(!_0x39a36c['query'][_0x2489('0x3c')](_0x2489('0x3d'))){_0x18748b['limit']=qs[_0x2489('0x1d')](_0x39a36c[_0x2489('0x35')][_0x2489('0x1d')]);_0x18748b[_0x2489('0x1c')]=qs[_0x2489('0x1c')](_0x39a36c[_0x2489('0x35')][_0x2489('0x1c')]);}_0x18748b[_0x2489('0x3e')]=qs[_0x2489('0x3f')](_0x39a36c[_0x2489('0x35')]['sort']);_0x18748b[_0x2489('0x40')]=qs['filters'](_[_0x2489('0x41')](_0x39a36c[_0x2489('0x35')],_0x503c39[_0x2489('0x37')]),_0x498b84);if(_0x39a36c[_0x2489('0x35')][_0x2489('0x42')]){_0x18748b[_0x2489('0x40')]=_[_0x2489('0x43')](_0x18748b[_0x2489('0x40')],{'$or':_['map'](_0x498b84,function(_0x41d302){if(_0x41d302[_0x2489('0x32')]!==_0x2489('0x44')){var _0x4e0b80={};_0x4e0b80[_0x41d302[_0x2489('0x2c')]]={'$like':'%'+_0x39a36c[_0x2489('0x35')][_0x2489('0x42')]+'%'};return _0x4e0b80;}})});}_0x18748b=_[_0x2489('0x43')]({},_0x18748b,_0x39a36c[_0x2489('0x45')]);var _0x10a017={'where':_0x18748b[_0x2489('0x40')]};return db['UserMailInteraction'][_0x2489('0x1b')](_0x10a017)[_0x2489('0x24')](function(_0x34efd8){_0x526278[_0x2489('0x1b')]=_0x34efd8;if(_0x39a36c['query'][_0x2489('0x46')]){_0x18748b[_0x2489('0x47')]=[{'all':!![]}];}return db['UserMailInteraction'][_0x2489('0x48')](_0x18748b);})[_0x2489('0x24')](function(_0x295a29){_0x526278[_0x2489('0x49')]=_0x295a29;return _0x526278;})[_0x2489('0x24')](respondWithFilteredResult(_0x1fb9b9,_0x18748b))[_0x2489('0x4a')](handleError(_0x1fb9b9,null));};exports[_0x2489('0x4b')]=function(_0x445cd2,_0x1b67cd){var _0x1a7775={'raw':!![],'where':{'id':_0x445cd2[_0x2489('0x4c')]['id']}},_0x407e99={};_0x407e99[_0x2489('0x34')]=_[_0x2489('0x36')](db['UserMailInteraction'][_0x2489('0x30')]);_0x407e99[_0x2489('0x35')]=_[_0x2489('0x36')](_0x445cd2['query']);_0x407e99[_0x2489('0x37')]=_[_0x2489('0x38')](_0x407e99['model'],_0x407e99[_0x2489('0x35')]);_0x1a7775[_0x2489('0x39')]=_['intersection'](_0x407e99[_0x2489('0x34')],qs[_0x2489('0x3a')](_0x445cd2[_0x2489('0x35')][_0x2489('0x3a')]));_0x1a7775[_0x2489('0x39')]=_0x1a7775[_0x2489('0x39')][_0x2489('0x3b')]?_0x1a7775[_0x2489('0x39')]:_0x407e99[_0x2489('0x34')];if(_0x445cd2[_0x2489('0x35')][_0x2489('0x46')]){_0x1a7775['include']=[{'all':!![]}];}_0x1a7775=_['merge']({},_0x1a7775,_0x445cd2[_0x2489('0x45')]);return db[_0x2489('0x2f')][_0x2489('0x4d')](_0x1a7775)['then'](handleEntityNotFound(_0x1b67cd,null))[_0x2489('0x24')](respondWithResult(_0x1b67cd,null))[_0x2489('0x4a')](handleError(_0x1b67cd,null));};exports[_0x2489('0x4e')]=function(_0x148d91,_0x3a3e61){return db[_0x2489('0x2f')][_0x2489('0x4e')](_0x148d91['body'],{})[_0x2489('0x24')](function(_0x5677c0){var _0x5aa68c=_0x148d91[_0x2489('0x4f')][_0x2489('0x25')]({'plain':!![]});if(!_0x5aa68c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aa68c[_0x2489('0x50')]===_0x2489('0x4f')){var _0x58a32a=_0x5677c0['get']({'plain':!![]});var _0x4667f1='UserMailInteractions';return db[_0x2489('0x51')][_0x2489('0x4d')]({'where':{'name':_0x4667f1,'userProfileId':_0x5aa68c['userProfileId']},'raw':!![]})['then'](function(_0xa2e892){if(_0xa2e892&&_0xa2e892[_0x2489('0x52')]===0x0){return db['UserProfileResource'][_0x2489('0x4e')]({'name':_0x58a32a[_0x2489('0x2c')],'resourceId':_0x58a32a['id'],'type':_0xa2e892[_0x2489('0x2c')],'sectionId':_0xa2e892['id']},{})[_0x2489('0x24')](function(){return _0x5677c0;});}else{return _0x5677c0;}})[_0x2489('0x4a')](function(_0x5a2c0a){logger[_0x2489('0x2a')](_0x2489('0x53'),_0x5a2c0a);throw _0x5a2c0a;});}return _0x5677c0;})['then'](respondWithResult(_0x3a3e61,0xc9))[_0x2489('0x4a')](handleError(_0x3a3e61,null));};exports[_0x2489('0x23')]=function(_0x24b1c6,_0x2d6aaf){if(_0x24b1c6[_0x2489('0x54')]['id']){delete _0x24b1c6[_0x2489('0x54')]['id'];}return db[_0x2489('0x2f')][_0x2489('0x4d')]({'where':{'id':_0x24b1c6[_0x2489('0x4c')]['id']}})[_0x2489('0x24')](handleEntityNotFound(_0x2d6aaf,null))['then'](saveUpdates(_0x24b1c6[_0x2489('0x54')],null))[_0x2489('0x24')](respondWithResult(_0x2d6aaf,null))[_0x2489('0x4a')](handleError(_0x2d6aaf,null));};exports[_0x2489('0x28')]=function(_0x3a3cd2,_0x379e1c){return db[_0x2489('0x2f')]['find']({'where':{'id':_0x3a3cd2[_0x2489('0x4c')]['id']}})[_0x2489('0x24')](handleEntityNotFound(_0x379e1c,null))['then'](removeEntity(_0x379e1c,null))['catch'](handleError(_0x379e1c,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 0c1004f..6988501 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 _0xcdd2=['./UserMailInteraction.attributes','exports','define','UserMailInteraction','user_has_mail_interactions','lodash','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x287520,_0x3dea8e){var _0x58df35=function(_0xc72b88){while(--_0xc72b88){_0x287520['push'](_0x287520['shift']());}};_0x58df35(++_0x3dea8e);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require('../../config/logger')(_0x2cdd('0x2'));var moment=require('moment');var BPromise=require(_0x2cdd('0x3'));var rp=require(_0x2cdd('0x4'));var fs=require('fs');var path=require(_0x2cdd('0x5'));var rimraf=require('rimraf');var config=require(_0x2cdd('0x6'));var attributes=require(_0x2cdd('0x7'));module[_0x2cdd('0x8')]=function(_0x1afa82,_0xc4bd9b){return _0x1afa82[_0x2cdd('0x9')](_0x2cdd('0xa'),attributes,{'tableName':_0x2cdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eaf=['../../config/environment','exports','define','UserMailInteraction','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4dcefd,_0x189f76){var _0xad1798=function(_0x27c602){while(--_0x27c602){_0x4dcefd['push'](_0x4dcefd['shift']());}};_0xad1798(++_0x189f76);}(_0x3eaf,0x190));var _0xf3ea=function(_0x17b74f,_0x1574ee){_0x17b74f=_0x17b74f-0x0;var _0x1e256b=_0x3eaf[_0x17b74f];return _0x1e256b;};'use strict';var _=require(_0xf3ea('0x0'));var util=require(_0xf3ea('0x1'));var logger=require(_0xf3ea('0x2'))(_0xf3ea('0x3'));var moment=require(_0xf3ea('0x4'));var BPromise=require(_0xf3ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3ea('0x6'));var rimraf=require(_0xf3ea('0x7'));var config=require(_0xf3ea('0x8'));var attributes=require('./UserMailInteraction.attributes');module[_0xf3ea('0x9')]=function(_0x526261,_0x3b5ca9){return _0x526261[_0xf3ea('0xa')](_0xf3ea('0xb'),attributes,{'tableName':'user_has_mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.rpc.js b/server/api/UserMailInteraction/UserMailInteraction.rpc.js index 8ad2886..db096b2 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 _0x84a5=['http','request','then','info','UserMailInteraction,\x20%s,\x20%s','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x24b88f,_0x22ea38){var _0x34a652=function(_0xa0fb48){while(--_0xa0fb48){_0x24b88f['push'](_0x24b88f['shift']());}};_0x34a652(++_0x22ea38);}(_0x84a5,0x165));var _0x584a=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x84a5[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0x584a('0x0'));var moment=require(_0x584a('0x1'));var BPromise=require(_0x584a('0x2'));var rs=require(_0x584a('0x3'));var fs=require('fs');var Redis=require(_0x584a('0x4'));var db=require(_0x584a('0x5'))['db'];var utils=require(_0x584a('0x6'));var logger=require(_0x584a('0x7'))(_0x584a('0x8'));var config=require(_0x584a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x584a('0xa')][_0x584a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194acd,_0x570bc1,_0x20f79d){return new BPromise(function(_0x26ede3,_0x24a33a){return client[_0x584a('0xc')](_0x194acd,_0x20f79d)[_0x584a('0xd')](function(_0x7fb568){logger[_0x584a('0xe')](_0x584a('0xf'),_0x570bc1,'request\x20sent');logger[_0x584a('0x10')](_0x584a('0x11'),_0x570bc1,_0x584a('0x12'),JSON['stringify'](_0x7fb568));if(_0x7fb568[_0x584a('0x13')]){if(_0x7fb568[_0x584a('0x13')]['code']===0x1f4){logger[_0x584a('0x13')]('UserMailInteraction,\x20%s,\x20%s',_0x570bc1,_0x7fb568[_0x584a('0x13')][_0x584a('0x14')]);return _0x24a33a(_0x7fb568[_0x584a('0x13')][_0x584a('0x14')]);}logger[_0x584a('0x13')](_0x584a('0xf'),_0x570bc1,_0x7fb568[_0x584a('0x13')]['message']);return _0x26ede3(_0x7fb568[_0x584a('0x13')][_0x584a('0x14')]);}else{logger[_0x584a('0xe')](_0x584a('0xf'),_0x570bc1,'request\x20sent');_0x26ede3(_0x7fb568[_0x584a('0x15')][_0x584a('0x14')]);}})[_0x584a('0x16')](function(_0x3c0aca){logger[_0x584a('0x13')](_0x584a('0xf'),_0x570bc1,_0x3c0aca);_0x24a33a(_0x3c0aca);});});} \ No newline at end of file +var _0xf971=['info','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x53767b,_0x3aa30b){var _0x29f67b=function(_0xd1d3e8){while(--_0xd1d3e8){_0x53767b['push'](_0x53767b['shift']());}};_0x29f67b(++_0x3aa30b);}(_0xf971,0x17e));var _0x1f97=function(_0x5f2901,_0x1efed1){_0x5f2901=_0x5f2901-0x0;var _0x4e4cf4=_0xf971[_0x5f2901];return _0x4e4cf4;};'use strict';var _=require(_0x1f97('0x0'));var util=require('util');var moment=require(_0x1f97('0x1'));var BPromise=require(_0x1f97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f97('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f97('0x4'));var logger=require(_0x1f97('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1f97('0x6'));var client=jayson[_0x1f97('0x7')][_0x1f97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615a6,_0x834b08,_0x354f64){return new BPromise(function(_0x489805,_0x413e10){return client['request'](_0x1615a6,_0x354f64)[_0x1f97('0x9')](function(_0x3162fb){logger['info'](_0x1f97('0xa'),_0x834b08,_0x1f97('0xb'));logger[_0x1f97('0xc')](_0x1f97('0xd'),_0x834b08,_0x1f97('0xb'),JSON[_0x1f97('0xe')](_0x3162fb));if(_0x3162fb['error']){if(_0x3162fb[_0x1f97('0xf')]['code']===0x1f4){logger[_0x1f97('0xf')](_0x1f97('0xa'),_0x834b08,_0x3162fb[_0x1f97('0xf')][_0x1f97('0x10')]);return _0x413e10(_0x3162fb[_0x1f97('0xf')][_0x1f97('0x10')]);}logger[_0x1f97('0xf')](_0x1f97('0xa'),_0x834b08,_0x3162fb[_0x1f97('0xf')]['message']);return _0x489805(_0x3162fb['error'][_0x1f97('0x10')]);}else{logger[_0x1f97('0x11')](_0x1f97('0xa'),_0x834b08,_0x1f97('0xb'));_0x489805(_0x3162fb[_0x1f97('0x12')][_0x1f97('0x10')]);}})['catch'](function(_0x34f6a7){logger[_0x1f97('0xf')]('UserMailInteraction,\x20%s,\x20%s',_0x834b08,_0x34f6a7);_0x413e10(_0x34f6a7);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index db1bee6..c01eeb4 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 _0x7a54=['Router','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0xf9e2e7,_0x5aa9dd){var _0x721206=function(_0xc736b){while(--_0xc736b){_0xf9e2e7['push'](_0xf9e2e7['shift']());}};_0x721206(++_0x5aa9dd);}(_0x7a54,0x106));var _0x47a5=function(_0x2cedb4,_0x16ca9d){_0x2cedb4=_0x2cedb4-0x0;var _0x3a2c6e=_0x7a54[_0x2cedb4];return _0x3a2c6e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x5fab=['../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x29e4ac,_0x581359){var _0x430493=function(_0x3f2f9c){while(--_0x3f2f9c){_0x29e4ac['push'](_0x29e4ac['shift']());}};_0x430493(++_0x581359);}(_0x5fab,0x177));var _0xb5fa=function(_0x56e423,_0x98016e){_0x56e423=_0x56e423-0x0;var _0x331ddb=_0x5fab[_0x56e423];return _0x331ddb;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xb5fa('0xe')]);router[_0xb5fa('0xf')](_0xb5fa('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xb5fa('0x11')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x12')]);module[_0xb5fa('0x13')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 1a158af..29b4e2b 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 _0x8d39=['INTEGER'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x8d39,0x108));var _0x98d3=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x8d39[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require('sequelize');module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0x98d3('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x98d3('0x0')],'primaryKey':!![]}}; \ No newline at end of file +var _0x20ea=['sequelize','exports','INTEGER'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x20ea,0x1c5));var _0xa20e=function(_0x2dc5fb,_0x286604){_0x2dc5fb=_0x2dc5fb-0x0;var _0x2cb12a=_0x20ea[_0x2dc5fb];return _0x2cb12a;};'use strict';var Sequelize=require(_0xa20e('0x0'));module[_0xa20e('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0xa20e('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa20e('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 cc28e85..6de21d1 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 _0x89f7=['filter','merge','VIRTUAL','options','UserOpenchannelInteraction','include','findAll','rows','catch','show','params','rawAttributes','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','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','set','Content-Range','json','reject','save','update','then','get','sendStatus','stack','name','send','index','map','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x5b7a8a,_0xb3bfe3){var _0xd2094e=function(_0x3547de){while(--_0x3547de){_0x5b7a8a['push'](_0x5b7a8a['shift']());}};_0xd2094e(++_0xb3bfe3);}(_0x89f7,0x105));var _0x789f=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x89f7[_0x7791d5];return _0x5ce288;};'use strict';var pdf=require(_0x789f('0x0'));var emlformat=require(_0x789f('0x1'));var rimraf=require(_0x789f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x789f('0x3'));var rp=require('request-promise');var moment=require(_0x789f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x789f('0x5'));var util=require(_0x789f('0x6'));var path=require(_0x789f('0x7'));var sox=require(_0x789f('0x8'));var csv=require('to-csv');var ejs=require(_0x789f('0x9'));var fs=require('fs');var _=require(_0x789f('0xa'));var squel=require(_0x789f('0xb'));var crypto=require(_0x789f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x789f('0xd'));var querystring=require(_0x789f('0xe'));var Papa=require(_0x789f('0xf'));var Redis=require('ioredis');var authService=require(_0x789f('0x10'));var qs=require(_0x789f('0x11'));var as=require(_0x789f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x789f('0x13'));var licenseUtil=require(_0x789f('0x14'));var db=require(_0x789f('0x15'))['db'];function respondWithStatusCode(_0x137c31,_0x8819db){_0x8819db=_0x8819db||0xcc;return function(_0x3c9259){if(_0x3c9259){return _0x137c31['sendStatus'](_0x8819db);}return _0x137c31[_0x789f('0x16')](_0x8819db)[_0x789f('0x17')]();};}function respondWithResult(_0x103241,_0xe767ad){_0xe767ad=_0xe767ad||0xc8;return function(_0x4c16cb){if(_0x4c16cb){return _0x103241[_0x789f('0x16')](_0xe767ad)['json'](_0x4c16cb);}};}function respondWithFilteredResult(_0x7fd299,_0x511ca4){return function(_0x51207b){if(_0x51207b){var _0x264258=_0x51207b[_0x789f('0x18')],_0x1223ac=_0x511ca4[_0x789f('0x19')],_0x2d6055=_0x511ca4[_0x789f('0x19')]+_0x511ca4['limit'],_0x137f51;if(_0x2d6055>=_0x264258){_0x2d6055=_0x264258;_0x137f51=0xc8;}else{_0x137f51=0xce;}_0x7fd299[_0x789f('0x16')](_0x137f51);return _0x7fd299[_0x789f('0x1a')](_0x789f('0x1b'),_0x1223ac+'-'+_0x2d6055+'/'+_0x264258)[_0x789f('0x1c')](_0x51207b);}return null;};}function patchUpdates(_0x2d60b3){return function(_0xe4bb84){try{jsonpatch['apply'](_0xe4bb84,_0x2d60b3,!![]);}catch(_0xa3bcb4){return BPromise[_0x789f('0x1d')](_0xa3bcb4);}return _0xe4bb84[_0x789f('0x1e')]();};}function saveUpdates(_0x5f2999,_0x2b2ab0){return function(_0x3b4743){if(_0x3b4743){return _0x3b4743[_0x789f('0x1f')](_0x5f2999)[_0x789f('0x20')](function(_0x3bb029){return _0x3bb029;});}return null;};}function removeEntity(_0x590d01,_0x2611d8){return function(_0x162855){if(_0x162855){return _0x162855['destroy']()[_0x789f('0x20')](function(){var _0xf9781f=_0x162855[_0x789f('0x21')]({'plain':!![]});var _0x8e445f='UserOpenchannelInteraction';return db['UserProfileResource']['destroy']({'where':{'type':_0x8e445f,'resourceId':_0xf9781f['id']}})[_0x789f('0x20')](function(){return _0x162855;});})[_0x789f('0x20')](function(){_0x590d01['status'](0xcc)[_0x789f('0x17')]();});}};}function handleEntityNotFound(_0x435293,_0x726a09){return function(_0x509736){if(!_0x509736){_0x435293[_0x789f('0x22')](0x194);}return _0x509736;};}function handleError(_0x3a831d,_0x4307f7){_0x4307f7=_0x4307f7||0x1f4;return function(_0x4344ea){logger['error'](_0x4344ea[_0x789f('0x23')]);if(_0x4344ea[_0x789f('0x24')]){delete _0x4344ea[_0x789f('0x24')];}_0x3a831d[_0x789f('0x16')](_0x4307f7)[_0x789f('0x25')](_0x4344ea);};}exports[_0x789f('0x26')]=function(_0x5141e5,_0x33c4b8){var _0x3fe22b={},_0x6c6859={},_0x1dca2b={'count':0x0,'rows':[]};var _0x3a2a12=_[_0x789f('0x27')](db['UserOpenchannelInteraction']['rawAttributes'],function(_0x1e1421){return{'name':_0x1e1421['fieldName'],'type':_0x1e1421[_0x789f('0x28')]['key']};});_0x6c6859[_0x789f('0x29')]=_[_0x789f('0x27')](_0x3a2a12,_0x789f('0x24'));_0x6c6859[_0x789f('0x2a')]=_[_0x789f('0x2b')](_0x5141e5[_0x789f('0x2a')]);_0x6c6859[_0x789f('0x2c')]=_['intersection'](_0x6c6859[_0x789f('0x29')],_0x6c6859['query']);_0x3fe22b[_0x789f('0x2d')]=_['intersection'](_0x6c6859[_0x789f('0x29')],qs[_0x789f('0x2e')](_0x5141e5[_0x789f('0x2a')][_0x789f('0x2e')]));_0x3fe22b[_0x789f('0x2d')]=_0x3fe22b[_0x789f('0x2d')][_0x789f('0x2f')]?_0x3fe22b['attributes']:_0x6c6859[_0x789f('0x29')];if(!_0x5141e5[_0x789f('0x2a')][_0x789f('0x30')](_0x789f('0x31'))){_0x3fe22b[_0x789f('0x32')]=qs[_0x789f('0x32')](_0x5141e5['query']['limit']);_0x3fe22b[_0x789f('0x19')]=qs[_0x789f('0x19')](_0x5141e5['query'][_0x789f('0x19')]);}_0x3fe22b[_0x789f('0x33')]=qs['sort'](_0x5141e5[_0x789f('0x2a')][_0x789f('0x34')]);_0x3fe22b[_0x789f('0x35')]=qs['filters'](_[_0x789f('0x36')](_0x5141e5[_0x789f('0x2a')],_0x6c6859[_0x789f('0x2c')]),_0x3a2a12);if(_0x5141e5['query'][_0x789f('0x37')]){_0x3fe22b['where']=_[_0x789f('0x38')](_0x3fe22b['where'],{'$or':_[_0x789f('0x27')](_0x3a2a12,function(_0x20a414){if(_0x20a414[_0x789f('0x28')]!==_0x789f('0x39')){var _0x56ab24={};_0x56ab24[_0x20a414['name']]={'$like':'%'+_0x5141e5[_0x789f('0x2a')][_0x789f('0x37')]+'%'};return _0x56ab24;}})});}_0x3fe22b=_[_0x789f('0x38')]({},_0x3fe22b,_0x5141e5[_0x789f('0x3a')]);var _0x13710e={'where':_0x3fe22b[_0x789f('0x35')]};return db[_0x789f('0x3b')][_0x789f('0x18')](_0x13710e)[_0x789f('0x20')](function(_0x4b99c3){_0x1dca2b[_0x789f('0x18')]=_0x4b99c3;if(_0x5141e5[_0x789f('0x2a')]['includeAll']){_0x3fe22b[_0x789f('0x3c')]=[{'all':!![]}];}return db[_0x789f('0x3b')][_0x789f('0x3d')](_0x3fe22b);})['then'](function(_0x2f4ad9){_0x1dca2b[_0x789f('0x3e')]=_0x2f4ad9;return _0x1dca2b;})['then'](respondWithFilteredResult(_0x33c4b8,_0x3fe22b))[_0x789f('0x3f')](handleError(_0x33c4b8,null));};exports[_0x789f('0x40')]=function(_0x20a7d5,_0x2c43ee){var _0x4bc122={'raw':!![],'where':{'id':_0x20a7d5[_0x789f('0x41')]['id']}},_0x5c98df={};_0x5c98df['model']=_[_0x789f('0x2b')](db['UserOpenchannelInteraction'][_0x789f('0x42')]);_0x5c98df[_0x789f('0x2a')]=_['keys'](_0x20a7d5['query']);_0x5c98df[_0x789f('0x2c')]=_['intersection'](_0x5c98df['model'],_0x5c98df[_0x789f('0x2a')]);_0x4bc122[_0x789f('0x2d')]=_['intersection'](_0x5c98df['model'],qs['fields'](_0x20a7d5[_0x789f('0x2a')]['fields']));_0x4bc122['attributes']=_0x4bc122[_0x789f('0x2d')][_0x789f('0x2f')]?_0x4bc122[_0x789f('0x2d')]:_0x5c98df[_0x789f('0x29')];if(_0x20a7d5[_0x789f('0x2a')][_0x789f('0x43')]){_0x4bc122[_0x789f('0x3c')]=[{'all':!![]}];}_0x4bc122=_[_0x789f('0x38')]({},_0x4bc122,_0x20a7d5[_0x789f('0x3a')]);return db['UserOpenchannelInteraction'][_0x789f('0x44')](_0x4bc122)[_0x789f('0x20')](handleEntityNotFound(_0x2c43ee,null))[_0x789f('0x20')](respondWithResult(_0x2c43ee,null))['catch'](handleError(_0x2c43ee,null));};exports[_0x789f('0x45')]=function(_0x30fbc8,_0x292837){return db[_0x789f('0x3b')]['create'](_0x30fbc8[_0x789f('0x46')],{})[_0x789f('0x20')](function(_0x596c82){var _0x218c5d=_0x30fbc8[_0x789f('0x47')][_0x789f('0x21')]({'plain':!![]});if(!_0x218c5d)throw new Error(_0x789f('0x48'));if(_0x218c5d[_0x789f('0x49')]==='user'){var _0x3e1cb6=_0x596c82[_0x789f('0x21')]({'plain':!![]});var _0x48a4fa='UserOpenchannelInteraction';return db[_0x789f('0x4a')]['find']({'where':{'name':_0x48a4fa,'userProfileId':_0x218c5d[_0x789f('0x4b')]},'raw':!![]})[_0x789f('0x20')](function(_0x1cdb86){if(_0x1cdb86&&_0x1cdb86[_0x789f('0x4c')]===0x0){return db[_0x789f('0x4d')][_0x789f('0x45')]({'name':_0x3e1cb6[_0x789f('0x24')],'resourceId':_0x3e1cb6['id'],'type':_0x1cdb86[_0x789f('0x24')],'sectionId':_0x1cdb86['id']},{})[_0x789f('0x20')](function(){return _0x596c82;});}else{return _0x596c82;}})[_0x789f('0x3f')](function(_0x5a077e){logger['error'](_0x789f('0x4e'),_0x5a077e);throw _0x5a077e;});}return _0x596c82;})[_0x789f('0x20')](respondWithResult(_0x292837,0xc9))[_0x789f('0x3f')](handleError(_0x292837,null));};exports[_0x789f('0x1f')]=function(_0x4d5700,_0x37bdbf){if(_0x4d5700[_0x789f('0x46')]['id']){delete _0x4d5700['body']['id'];}return db['UserOpenchannelInteraction'][_0x789f('0x44')]({'where':{'id':_0x4d5700[_0x789f('0x41')]['id']}})[_0x789f('0x20')](handleEntityNotFound(_0x37bdbf,null))[_0x789f('0x20')](saveUpdates(_0x4d5700[_0x789f('0x46')],null))[_0x789f('0x20')](respondWithResult(_0x37bdbf,null))['catch'](handleError(_0x37bdbf,null));};exports['destroy']=function(_0x298cef,_0x434128){return db[_0x789f('0x3b')][_0x789f('0x44')]({'where':{'id':_0x298cef['params']['id']}})['then'](handleEntityNotFound(_0x434128,null))[_0x789f('0x20')](removeEntity(_0x434128,null))[_0x789f('0x3f')](handleError(_0x434128,null));}; \ No newline at end of file +var _0x152b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserOpenchannelInteraction','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x152b,0x1e7));var _0xb152=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x152b[_0x373096];return _0x14a6d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb152('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb152('0x1'));var moment=require(_0xb152('0x2'));var BPromise=require(_0xb152('0x3'));var Mustache=require(_0xb152('0x4'));var util=require(_0xb152('0x5'));var path=require(_0xb152('0x6'));var sox=require('sox');var csv=require(_0xb152('0x7'));var ejs=require(_0xb152('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb152('0x9'));var crypto=require(_0xb152('0xa'));var jsforce=require(_0xb152('0xb'));var deskjs=require(_0xb152('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb152('0xd'));var Redis=require(_0xb152('0xe'));var authService=require(_0xb152('0xf'));var qs=require(_0xb152('0x10'));var as=require(_0xb152('0x11'));var hardwareService=require(_0xb152('0x12'));var logger=require('../../config/logger')(_0xb152('0x13'));var utils=require(_0xb152('0x14'));var config=require(_0xb152('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb152('0x16'))['db'];function respondWithStatusCode(_0x6ffa58,_0x2c85ff){_0x2c85ff=_0x2c85ff||0xcc;return function(_0x53bc0d){if(_0x53bc0d){return _0x6ffa58[_0xb152('0x17')](_0x2c85ff);}return _0x6ffa58[_0xb152('0x18')](_0x2c85ff)[_0xb152('0x19')]();};}function respondWithResult(_0x3121ae,_0x1d80c9){_0x1d80c9=_0x1d80c9||0xc8;return function(_0x2035de){if(_0x2035de){return _0x3121ae['status'](_0x1d80c9)[_0xb152('0x1a')](_0x2035de);}};}function respondWithFilteredResult(_0x1d6a5b,_0x11a8a8){return function(_0x2d529f){if(_0x2d529f){var _0x3b15c8=_0x2d529f[_0xb152('0x1b')],_0x44855f=_0x11a8a8[_0xb152('0x1c')],_0x29e6f2=_0x11a8a8['offset']+_0x11a8a8['limit'],_0x2c9b99;if(_0x29e6f2>=_0x3b15c8){_0x29e6f2=_0x3b15c8;_0x2c9b99=0xc8;}else{_0x2c9b99=0xce;}_0x1d6a5b['status'](_0x2c9b99);return _0x1d6a5b[_0xb152('0x1d')](_0xb152('0x1e'),_0x44855f+'-'+_0x29e6f2+'/'+_0x3b15c8)[_0xb152('0x1a')](_0x2d529f);}return null;};}function patchUpdates(_0x115641){return function(_0x1217a2){try{jsonpatch[_0xb152('0x1f')](_0x1217a2,_0x115641,!![]);}catch(_0x537625){return BPromise[_0xb152('0x20')](_0x537625);}return _0x1217a2[_0xb152('0x21')]();};}function saveUpdates(_0x357f99,_0x4e448b){return function(_0x5b0f0b){if(_0x5b0f0b){return _0x5b0f0b[_0xb152('0x22')](_0x357f99)[_0xb152('0x23')](function(_0x35bc33){return _0x35bc33;});}return null;};}function removeEntity(_0x1c6868,_0x3605ec){return function(_0x27fcd0){if(_0x27fcd0){return _0x27fcd0[_0xb152('0x24')]()[_0xb152('0x23')](function(){var _0x1a9b46=_0x27fcd0['get']({'plain':!![]});var _0x75fd78=_0xb152('0x25');return db['UserProfileResource'][_0xb152('0x24')]({'where':{'type':_0x75fd78,'resourceId':_0x1a9b46['id']}})[_0xb152('0x23')](function(){return _0x27fcd0;});})['then'](function(){_0x1c6868[_0xb152('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ad5a3,_0x3b585c){return function(_0x502e7b){if(!_0x502e7b){_0x5ad5a3[_0xb152('0x17')](0x194);}return _0x502e7b;};}function handleError(_0x40081c,_0x15fe3f){_0x15fe3f=_0x15fe3f||0x1f4;return function(_0x30e4a9){logger[_0xb152('0x26')](_0x30e4a9[_0xb152('0x27')]);if(_0x30e4a9[_0xb152('0x28')]){delete _0x30e4a9[_0xb152('0x28')];}_0x40081c[_0xb152('0x18')](_0x15fe3f)[_0xb152('0x29')](_0x30e4a9);};}exports[_0xb152('0x2a')]=function(_0x5c8ca0,_0x5b59e9){var _0x2fbd24={},_0x5c1258={},_0x2f328e={'count':0x0,'rows':[]};var _0xdce042=_[_0xb152('0x2b')](db[_0xb152('0x25')]['rawAttributes'],function(_0x3128fa){return{'name':_0x3128fa[_0xb152('0x2c')],'type':_0x3128fa[_0xb152('0x2d')]['key']};});_0x5c1258[_0xb152('0x2e')]=_[_0xb152('0x2b')](_0xdce042,_0xb152('0x28'));_0x5c1258[_0xb152('0x2f')]=_['keys'](_0x5c8ca0[_0xb152('0x2f')]);_0x5c1258[_0xb152('0x30')]=_[_0xb152('0x31')](_0x5c1258['model'],_0x5c1258[_0xb152('0x2f')]);_0x2fbd24[_0xb152('0x32')]=_[_0xb152('0x31')](_0x5c1258[_0xb152('0x2e')],qs[_0xb152('0x33')](_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x33')]));_0x2fbd24[_0xb152('0x32')]=_0x2fbd24['attributes'][_0xb152('0x34')]?_0x2fbd24[_0xb152('0x32')]:_0x5c1258[_0xb152('0x2e')];if(!_0x5c8ca0['query']['hasOwnProperty'](_0xb152('0x35'))){_0x2fbd24[_0xb152('0x36')]=qs[_0xb152('0x36')](_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x36')]);_0x2fbd24[_0xb152('0x1c')]=qs[_0xb152('0x1c')](_0x5c8ca0['query'][_0xb152('0x1c')]);}_0x2fbd24[_0xb152('0x37')]=qs[_0xb152('0x38')](_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x38')]);_0x2fbd24[_0xb152('0x39')]=qs[_0xb152('0x30')](_[_0xb152('0x3a')](_0x5c8ca0[_0xb152('0x2f')],_0x5c1258[_0xb152('0x30')]),_0xdce042);if(_0x5c8ca0[_0xb152('0x2f')]['filter']){_0x2fbd24[_0xb152('0x39')]=_['merge'](_0x2fbd24[_0xb152('0x39')],{'$or':_['map'](_0xdce042,function(_0x7c40ee){if(_0x7c40ee['type']!==_0xb152('0x3b')){var _0x372203={};_0x372203[_0x7c40ee[_0xb152('0x28')]]={'$like':'%'+_0x5c8ca0[_0xb152('0x2f')][_0xb152('0x3c')]+'%'};return _0x372203;}})});}_0x2fbd24=_['merge']({},_0x2fbd24,_0x5c8ca0[_0xb152('0x3d')]);var _0x4c5465={'where':_0x2fbd24['where']};return db[_0xb152('0x25')][_0xb152('0x1b')](_0x4c5465)['then'](function(_0x5a53de){_0x2f328e['count']=_0x5a53de;if(_0x5c8ca0['query'][_0xb152('0x3e')]){_0x2fbd24[_0xb152('0x3f')]=[{'all':!![]}];}return db[_0xb152('0x25')]['findAll'](_0x2fbd24);})[_0xb152('0x23')](function(_0x226f56){_0x2f328e[_0xb152('0x40')]=_0x226f56;return _0x2f328e;})[_0xb152('0x23')](respondWithFilteredResult(_0x5b59e9,_0x2fbd24))[_0xb152('0x41')](handleError(_0x5b59e9,null));};exports[_0xb152('0x42')]=function(_0x24357a,_0x3cceb9){var _0x2d7112={'raw':!![],'where':{'id':_0x24357a[_0xb152('0x43')]['id']}},_0x5d97b1={};_0x5d97b1[_0xb152('0x2e')]=_['keys'](db[_0xb152('0x25')][_0xb152('0x44')]);_0x5d97b1[_0xb152('0x2f')]=_[_0xb152('0x45')](_0x24357a['query']);_0x5d97b1[_0xb152('0x30')]=_['intersection'](_0x5d97b1[_0xb152('0x2e')],_0x5d97b1[_0xb152('0x2f')]);_0x2d7112[_0xb152('0x32')]=_[_0xb152('0x31')](_0x5d97b1['model'],qs[_0xb152('0x33')](_0x24357a[_0xb152('0x2f')][_0xb152('0x33')]));_0x2d7112[_0xb152('0x32')]=_0x2d7112[_0xb152('0x32')][_0xb152('0x34')]?_0x2d7112['attributes']:_0x5d97b1[_0xb152('0x2e')];if(_0x24357a['query']['includeAll']){_0x2d7112[_0xb152('0x3f')]=[{'all':!![]}];}_0x2d7112=_['merge']({},_0x2d7112,_0x24357a[_0xb152('0x3d')]);return db[_0xb152('0x25')]['find'](_0x2d7112)[_0xb152('0x23')](handleEntityNotFound(_0x3cceb9,null))[_0xb152('0x23')](respondWithResult(_0x3cceb9,null))[_0xb152('0x41')](handleError(_0x3cceb9,null));};exports[_0xb152('0x46')]=function(_0x58003b,_0x58c207){return db[_0xb152('0x25')][_0xb152('0x46')](_0x58003b[_0xb152('0x47')],{})['then'](function(_0x437b20){var _0x19e606=_0x58003b[_0xb152('0x48')][_0xb152('0x49')]({'plain':!![]});if(!_0x19e606)throw new Error(_0xb152('0x4a'));if(_0x19e606[_0xb152('0x4b')]===_0xb152('0x48')){var _0x16bcda=_0x437b20[_0xb152('0x49')]({'plain':!![]});var _0xbcf51a='UserOpenchannelInteraction';return db[_0xb152('0x4c')][_0xb152('0x4d')]({'where':{'name':_0xbcf51a,'userProfileId':_0x19e606[_0xb152('0x4e')]},'raw':!![]})[_0xb152('0x23')](function(_0x984731){if(_0x984731&&_0x984731[_0xb152('0x4f')]===0x0){return db['UserProfileResource'][_0xb152('0x46')]({'name':_0x16bcda[_0xb152('0x28')],'resourceId':_0x16bcda['id'],'type':_0x984731['name'],'sectionId':_0x984731['id']},{})[_0xb152('0x23')](function(){return _0x437b20;});}else{return _0x437b20;}})['catch'](function(_0x28a3fb){logger[_0xb152('0x26')](_0xb152('0x50'),_0x28a3fb);throw _0x28a3fb;});}return _0x437b20;})['then'](respondWithResult(_0x58c207,0xc9))[_0xb152('0x41')](handleError(_0x58c207,null));};exports[_0xb152('0x22')]=function(_0xd31282,_0x4a3339){if(_0xd31282['body']['id']){delete _0xd31282[_0xb152('0x47')]['id'];}return db[_0xb152('0x25')]['find']({'where':{'id':_0xd31282['params']['id']}})[_0xb152('0x23')](handleEntityNotFound(_0x4a3339,null))[_0xb152('0x23')](saveUpdates(_0xd31282[_0xb152('0x47')],null))['then'](respondWithResult(_0x4a3339,null))[_0xb152('0x41')](handleError(_0x4a3339,null));};exports[_0xb152('0x24')]=function(_0x3cdbf3,_0xcb7b79){return db[_0xb152('0x25')][_0xb152('0x4d')]({'where':{'id':_0x3cdbf3['params']['id']}})[_0xb152('0x23')](handleEntityNotFound(_0xcb7b79,null))[_0xb152('0x23')](removeEntity(_0xcb7b79,null))[_0xb152('0x41')](handleError(_0xcb7b79,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index 58f61c6..b2302a7 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 _0xe7a7=['path','../../config/environment','./UserOpenchannelInteraction.attributes','exports','define','UserOpenchannelInteraction','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33e1d3,_0x1f7c57){var _0x4836=function(_0x48f88a){while(--_0x48f88a){_0x33e1d3['push'](_0x33e1d3['shift']());}};_0x4836(++_0x1f7c57);}(_0xe7a7,0x199));var _0x7e7a=function(_0x172250,_0x454614){_0x172250=_0x172250-0x0;var _0x5b2056=_0xe7a7[_0x172250];return _0x5b2056;};'use strict';var _=require(_0x7e7a('0x0'));var util=require(_0x7e7a('0x1'));var logger=require(_0x7e7a('0x2'))(_0x7e7a('0x3'));var moment=require(_0x7e7a('0x4'));var BPromise=require(_0x7e7a('0x5'));var rp=require(_0x7e7a('0x6'));var fs=require('fs');var path=require(_0x7e7a('0x7'));var rimraf=require('rimraf');var config=require(_0x7e7a('0x8'));var attributes=require(_0x7e7a('0x9'));module[_0x7e7a('0xa')]=function(_0x272dd7,_0x10dafb){return _0x272dd7[_0x7e7a('0xb')](_0x7e7a('0xc'),attributes,{'tableName':'user_has_openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9251=['user_has_openchannel_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./UserOpenchannelInteraction.attributes','exports','UserOpenchannelInteraction'];(function(_0x514a57,_0x3f68f0){var _0x5814ac=function(_0x538d37){while(--_0x538d37){_0x514a57['push'](_0x514a57['shift']());}};_0x5814ac(++_0x3f68f0);}(_0x9251,0x1ef));var _0x1925=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x9251[_0x34021d];return _0x16597b;};'use strict';var _=require(_0x1925('0x0'));var util=require(_0x1925('0x1'));var logger=require(_0x1925('0x2'))(_0x1925('0x3'));var moment=require(_0x1925('0x4'));var BPromise=require(_0x1925('0x5'));var rp=require(_0x1925('0x6'));var fs=require('fs');var path=require(_0x1925('0x7'));var rimraf=require(_0x1925('0x8'));var config=require('../../config/environment');var attributes=require(_0x1925('0x9'));module[_0x1925('0xa')]=function(_0x55d1e9,_0x2e019e){return _0x55d1e9['define'](_0x1925('0xb'),attributes,{'tableName':_0x1925('0xc'),'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 6795608..09a42fa 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 _0x49fe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis'];(function(_0x368502,_0x1b8bfb){var _0x44bc6e=function(_0x265af3){while(--_0x265af3){_0x368502['push'](_0x368502['shift']());}};_0x44bc6e(++_0x1b8bfb);}(_0x49fe,0x75));var _0xe49f=function(_0x47458b,_0x17fb1a){_0x47458b=_0x47458b-0x0;var _0x393cad=_0x49fe[_0x47458b];return _0x393cad;};'use strict';var _=require(_0xe49f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe49f('0x1'));var fs=require('fs');var Redis=require(_0xe49f('0x2'));var db=require(_0xe49f('0x3'))['db'];var utils=require(_0xe49f('0x4'));var logger=require(_0xe49f('0x5'))(_0xe49f('0x6'));var config=require(_0xe49f('0x7'));var jayson=require(_0xe49f('0x8'));var client=jayson[_0xe49f('0x9')][_0xe49f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0591c,_0x2a7c98,_0x6f1120){return new BPromise(function(_0x574f52,_0x306059){return client[_0xe49f('0xb')](_0xe0591c,_0x6f1120)['then'](function(_0x1eefb2){logger['info'](_0xe49f('0xc'),_0x2a7c98,_0xe49f('0xd'));logger['debug'](_0xe49f('0xe'),_0x2a7c98,_0xe49f('0xd'),JSON[_0xe49f('0xf')](_0x1eefb2));if(_0x1eefb2[_0xe49f('0x10')]){if(_0x1eefb2[_0xe49f('0x10')]['code']===0x1f4){logger[_0xe49f('0x10')](_0xe49f('0xc'),_0x2a7c98,_0x1eefb2['error'][_0xe49f('0x11')]);return _0x306059(_0x1eefb2[_0xe49f('0x10')][_0xe49f('0x11')]);}logger[_0xe49f('0x10')](_0xe49f('0xc'),_0x2a7c98,_0x1eefb2['error'][_0xe49f('0x11')]);return _0x574f52(_0x1eefb2[_0xe49f('0x10')]['message']);}else{logger['info'](_0xe49f('0xc'),_0x2a7c98,_0xe49f('0xd'));_0x574f52(_0x1eefb2[_0xe49f('0x12')][_0xe49f('0x11')]);}})[_0xe49f('0x13')](function(_0x35e3ed){logger['error'](_0xe49f('0xc'),_0x2a7c98,_0x35e3ed);_0x306059(_0x35e3ed);});});} \ No newline at end of file +var _0x6237=['http','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x54228c,_0x401158){var _0x52b709=function(_0x38f8cd){while(--_0x38f8cd){_0x54228c['push'](_0x54228c['shift']());}};_0x52b709(++_0x401158);}(_0x6237,0xc4));var _0x7623=function(_0x5c7883,_0x2d0e2e){_0x5c7883=_0x5c7883-0x0;var _0x2e4777=_0x6237[_0x5c7883];return _0x2e4777;};'use strict';var _=require(_0x7623('0x0'));var util=require(_0x7623('0x1'));var moment=require(_0x7623('0x2'));var BPromise=require(_0x7623('0x3'));var rs=require(_0x7623('0x4'));var fs=require('fs');var Redis=require(_0x7623('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7623('0x6'));var logger=require(_0x7623('0x7'))(_0x7623('0x8'));var config=require('../../config/environment');var jayson=require(_0x7623('0x9'));var client=jayson[_0x7623('0xa')][_0x7623('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3457da,_0x4c1464,_0x2f43b6){return new BPromise(function(_0x25fea2,_0x1fbc97){return client['request'](_0x3457da,_0x2f43b6)[_0x7623('0xc')](function(_0xb98922){logger[_0x7623('0xd')](_0x7623('0xe'),_0x4c1464,_0x7623('0xf'));logger['debug'](_0x7623('0x10'),_0x4c1464,'request\x20sent',JSON[_0x7623('0x11')](_0xb98922));if(_0xb98922[_0x7623('0x12')]){if(_0xb98922[_0x7623('0x12')][_0x7623('0x13')]===0x1f4){logger[_0x7623('0x12')](_0x7623('0xe'),_0x4c1464,_0xb98922['error'][_0x7623('0x14')]);return _0x1fbc97(_0xb98922[_0x7623('0x12')]['message']);}logger['error'](_0x7623('0xe'),_0x4c1464,_0xb98922['error']['message']);return _0x25fea2(_0xb98922[_0x7623('0x12')][_0x7623('0x14')]);}else{logger[_0x7623('0xd')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x4c1464,'request\x20sent');_0x25fea2(_0xb98922[_0x7623('0x15')][_0x7623('0x14')]);}})[_0x7623('0x16')](function(_0x2ca890){logger[_0x7623('0x12')](_0x7623('0xe'),_0x4c1464,_0x2ca890);_0x1fbc97(_0x2ca890);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 69f1b7a..466a7b2 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 _0x25bf=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller','index','get','/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path'];(function(_0x1eef1b,_0x1c71f2){var _0x4da0aa=function(_0x1d7d29){while(--_0x1d7d29){_0x1eef1b['push'](_0x1eef1b['shift']());}};_0x4da0aa(++_0x1c71f2);}(_0x25bf,0x177));var _0xf25b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x25bf[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf25b('0x0'));var util=require(_0xf25b('0x1'));var path=require(_0xf25b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf25b('0x3'));var router=express[_0xf25b('0x4')]();var auth=require(_0xf25b('0x5'));var interaction=require(_0xf25b('0x6'));var config=require(_0xf25b('0x7'));var controller=require(_0xf25b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf25b('0x9')]);router[_0xf25b('0xa')](_0xf25b('0xb'),auth[_0xf25b('0xc')](),controller[_0xf25b('0xd')]);router[_0xf25b('0xe')]('/',auth[_0xf25b('0xc')](),controller['create']);router['put']('/:id',auth[_0xf25b('0xc')](),controller[_0xf25b('0xf')]);router[_0xf25b('0x10')]('/:id',auth[_0xf25b('0xc')](),controller[_0xf25b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6779=['./UserOpenchannelInteraction.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x5534b7,_0xbe6ba4){var _0x34af05=function(_0x2f8d94){while(--_0x2f8d94){_0x5534b7['push'](_0x5534b7['shift']());}};_0x34af05(++_0xbe6ba4);}(_0x6779,0x1bb));var _0x9677=function(_0x3c368e,_0x5496e6){_0x3c368e=_0x3c368e-0x0;var _0xa76859=_0x6779[_0x3c368e];return _0xa76859;};'use strict';var multer=require('multer');var util=require(_0x9677('0x0'));var path=require(_0x9677('0x1'));var timeout=require(_0x9677('0x2'));var express=require(_0x9677('0x3'));var router=express[_0x9677('0x4')]();var auth=require(_0x9677('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9677('0x6'));var controller=require(_0x9677('0x7'));router[_0x9677('0x8')]('/',auth[_0x9677('0x9')](),controller[_0x9677('0xa')]);router[_0x9677('0x8')](_0x9677('0xb'),auth[_0x9677('0x9')](),controller[_0x9677('0xc')]);router[_0x9677('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9677('0xe')](_0x9677('0xb'),auth[_0x9677('0x9')](),controller[_0x9677('0xf')]);router['delete']('/:id',auth[_0x9677('0x9')](),controller[_0x9677('0x10')]);module[_0x9677('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 2937b42..3ba0cc0 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 _0x91da=['INTEGER','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x91da,0x166));var _0xa91d=function(_0x1b02e9,_0x532963){_0x1b02e9=_0x1b02e9-0x0;var _0x5e7f61=_0x91da[_0x1b02e9];return _0x5e7f61;};'use strict';var Sequelize=require(_0xa91d('0x0'));module[_0xa91d('0x1')]={'SmsInteractionId':{'type':Sequelize[_0xa91d('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xa91d('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xbf90=['sequelize','INTEGER'];(function(_0x1efd6d,_0xa1657e){var _0x22d6e3=function(_0x3fc028){while(--_0x3fc028){_0x1efd6d['push'](_0x1efd6d['shift']());}};_0x22d6e3(++_0xa1657e);}(_0xbf90,0x1b4));var _0x0bf9=function(_0x2a02ca,_0x1003e8){_0x2a02ca=_0x2a02ca-0x0;var _0x5d058e=_0xbf90[_0x2a02ca];return _0x5d058e;};'use strict';var Sequelize=require(_0x0bf9('0x0'));module['exports']={'SmsInteractionId':{'type':Sequelize[_0x0bf9('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0bf9('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 8cfedbb..24b8778 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(_0x3b6751,_0x41e393){var _0x4449f0=function(_0x25699a){while(--_0x25699a){_0x3b6751['push'](_0x3b6751['shift']());}};_0x4449f0(++_0x41e393);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x36b087,_0x19caa9){var _0x41123e=function(_0x1e4693){while(--_0x1e4693){_0x36b087['push'](_0x36b087['shift']());}};_0x41123e(++_0x19caa9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 0b78f0f..7e76638 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 _0xb993=['define','user_has_sms_interactions','util','../../config/logger','api','bluebird','request-promise','./UserSmsInteraction.attributes','exports'];(function(_0x51c4ee,_0x113035){var _0x3421cb=function(_0x1db285){while(--_0x1db285){_0x51c4ee['push'](_0x51c4ee['shift']());}};_0x3421cb(++_0x113035);}(_0xb993,0x1bb));var _0x3b99=function(_0x3d1cdb,_0x3eca9f){_0x3d1cdb=_0x3d1cdb-0x0;var _0x225c13=_0xb993[_0x3d1cdb];return _0x225c13;};'use strict';var _=require('lodash');var util=require(_0x3b99('0x0'));var logger=require(_0x3b99('0x1'))(_0x3b99('0x2'));var moment=require('moment');var BPromise=require(_0x3b99('0x3'));var rp=require(_0x3b99('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3b99('0x5'));module[_0x3b99('0x6')]=function(_0x50caf3,_0x53188b){return _0x50caf3[_0x3b99('0x7')]('UserSmsInteraction',attributes,{'tableName':_0x3b99('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ed=['path','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','lodash','../../config/logger','moment','request-promise'];(function(_0xd83e3,_0x162b7b){var _0x83645b=function(_0xdcf001){while(--_0xdcf001){_0xd83e3['push'](_0xd83e3['shift']());}};_0x83645b(++_0x162b7b);}(_0xa5ed,0x1d5));var _0xda5e=function(_0x5ab3c3,_0x36beda){_0x5ab3c3=_0x5ab3c3-0x0;var _0x25d4e4=_0xa5ed[_0x5ab3c3];return _0x25d4e4;};'use strict';var _=require(_0xda5e('0x0'));var util=require('util');var logger=require(_0xda5e('0x1'))('api');var moment=require(_0xda5e('0x2'));var BPromise=require('bluebird');var rp=require(_0xda5e('0x3'));var fs=require('fs');var path=require(_0xda5e('0x4'));var rimraf=require('rimraf');var config=require(_0xda5e('0x5'));var attributes=require(_0xda5e('0x6'));module[_0xda5e('0x7')]=function(_0x26f95f,_0x6a96fc){return _0x26f95f[_0xda5e('0x8')](_0xda5e('0x9'),attributes,{'tableName':_0xda5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js b/server/api/UserSmsInteraction/UserSmsInteraction.rpc.js index f8849d4..7d2174e 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 _0x886a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x886a,0x164));var _0xa886=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x886a[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require(_0xa886('0x0'));var util=require(_0xa886('0x1'));var moment=require(_0xa886('0x2'));var BPromise=require(_0xa886('0x3'));var rs=require(_0xa886('0x4'));var fs=require('fs');var Redis=require(_0xa886('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa886('0x6'));var logger=require(_0xa886('0x7'))(_0xa886('0x8'));var config=require(_0xa886('0x9'));var jayson=require(_0xa886('0xa'));var client=jayson['client'][_0xa886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab4a9,_0x24e9d2,_0x4a74a0){return new BPromise(function(_0x5850c8,_0xe5c31a){return client[_0xa886('0xc')](_0x5ab4a9,_0x4a74a0)['then'](function(_0x25f876){logger[_0xa886('0xd')](_0xa886('0xe'),_0x24e9d2,_0xa886('0xf'));logger[_0xa886('0x10')](_0xa886('0x11'),_0x24e9d2,_0xa886('0xf'),JSON[_0xa886('0x12')](_0x25f876));if(_0x25f876[_0xa886('0x13')]){if(_0x25f876['error'][_0xa886('0x14')]===0x1f4){logger[_0xa886('0x13')]('UserSmsInteraction,\x20%s,\x20%s',_0x24e9d2,_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);return _0xe5c31a(_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);}logger[_0xa886('0x13')](_0xa886('0xe'),_0x24e9d2,_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);return _0x5850c8(_0x25f876[_0xa886('0x13')][_0xa886('0x15')]);}else{logger[_0xa886('0xd')](_0xa886('0xe'),_0x24e9d2,'request\x20sent');_0x5850c8(_0x25f876[_0xa886('0x16')][_0xa886('0x15')]);}})[_0xa886('0x17')](function(_0x3f5a09){logger['error'](_0xa886('0xe'),_0x24e9d2,_0x3f5a09);_0xe5c31a(_0x3f5a09);});});} \ No newline at end of file +var _0x57c3=['catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserSmsInteraction,\x20%s,\x20%s','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0xe7d5ae,_0x5e6ff3){var _0x227e7b=function(_0x272ce3){while(--_0x272ce3){_0xe7d5ae['push'](_0xe7d5ae['shift']());}};_0x227e7b(++_0x5e6ff3);}(_0x57c3,0x135));var _0x357c=function(_0x547f8b,_0x4660ff){_0x547f8b=_0x547f8b-0x0;var _0x2c7521=_0x57c3[_0x547f8b];return _0x2c7521;};'use strict';var _=require('lodash');var util=require(_0x357c('0x0'));var moment=require(_0x357c('0x1'));var BPromise=require('bluebird');var rs=require(_0x357c('0x2'));var fs=require('fs');var Redis=require(_0x357c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x357c('0x4'));var logger=require(_0x357c('0x5'))(_0x357c('0x6'));var config=require(_0x357c('0x7'));var jayson=require(_0x357c('0x8'));var client=jayson[_0x357c('0x9')][_0x357c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39b426,_0x42f90e,_0x34a16c){return new BPromise(function(_0x3e9de9,_0x1921ee){return client[_0x357c('0xb')](_0x39b426,_0x34a16c)['then'](function(_0x3039ce){logger['info'](_0x357c('0xc'),_0x42f90e,'request\x20sent');logger['debug'](_0x357c('0xd'),_0x42f90e,_0x357c('0xe'),JSON[_0x357c('0xf')](_0x3039ce));if(_0x3039ce[_0x357c('0x10')]){if(_0x3039ce[_0x357c('0x10')][_0x357c('0x11')]===0x1f4){logger['error']('UserSmsInteraction,\x20%s,\x20%s',_0x42f90e,_0x3039ce[_0x357c('0x10')]['message']);return _0x1921ee(_0x3039ce[_0x357c('0x10')]['message']);}logger[_0x357c('0x10')](_0x357c('0xc'),_0x42f90e,_0x3039ce[_0x357c('0x10')]['message']);return _0x3e9de9(_0x3039ce[_0x357c('0x10')][_0x357c('0x12')]);}else{logger[_0x357c('0x13')](_0x357c('0xc'),_0x42f90e,_0x357c('0xe'));_0x3e9de9(_0x3039ce[_0x357c('0x14')][_0x357c('0x12')]);}})[_0x357c('0x15')](function(_0x5bccea){logger['error'](_0x357c('0xc'),_0x42f90e,_0x5bccea);_0x1921ee(_0x5bccea);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 862e902..115df6c 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 _0x388e=['delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x2f3e68,_0x42de33){var _0x332daf=function(_0x3febc4){while(--_0x3febc4){_0x2f3e68['push'](_0x2f3e68['shift']());}};_0x332daf(++_0x42de33);}(_0x388e,0x1b5));var _0xe388=function(_0x5d952a,_0x379b02){_0x5d952a=_0x5d952a-0x0;var _0x2d7019=_0x388e[_0x5d952a];return _0x2d7019;};'use strict';var multer=require('multer');var util=require(_0xe388('0x0'));var path=require(_0xe388('0x1'));var timeout=require('connect-timeout');var express=require(_0xe388('0x2'));var router=express['Router']();var auth=require(_0xe388('0x3'));var interaction=require(_0xe388('0x4'));var config=require('../../config/environment');var controller=require('./UserSmsInteraction.controller');router[_0xe388('0x5')]('/',auth[_0xe388('0x6')](),controller[_0xe388('0x7')]);router[_0xe388('0x5')](_0xe388('0x8'),auth['isAuthenticated'](),controller[_0xe388('0x9')]);router[_0xe388('0xa')]('/',auth[_0xe388('0x6')](),controller['create']);router[_0xe388('0xb')](_0xe388('0x8'),auth[_0xe388('0x6')](),controller[_0xe388('0xc')]);router[_0xe388('0xd')](_0xe388('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xe388('0xe')]=router; \ No newline at end of file +var _0xaaf5=['connect-timeout','express','../../components/interaction/service','./UserSmsInteraction.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4c96e4,_0x2fe2ea){var _0x2dd5d2=function(_0x3f040d){while(--_0x3f040d){_0x4c96e4['push'](_0x4c96e4['shift']());}};_0x2dd5d2(++_0x2fe2ea);}(_0xaaf5,0x10d));var _0x5aaf=function(_0x18662a,_0x393120){_0x18662a=_0x18662a-0x0;var _0xfdcd66=_0xaaf5[_0x18662a];return _0xfdcd66;};'use strict';var multer=require(_0x5aaf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5aaf('0x1'));var express=require(_0x5aaf('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5aaf('0x3'));var config=require('../../config/environment');var controller=require(_0x5aaf('0x4'));router['get']('/',auth[_0x5aaf('0x5')](),controller['index']);router[_0x5aaf('0x6')](_0x5aaf('0x7'),auth[_0x5aaf('0x5')](),controller[_0x5aaf('0x8')]);router[_0x5aaf('0x9')]('/',auth[_0x5aaf('0x5')](),controller['create']);router[_0x5aaf('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5aaf('0xb')]);router[_0x5aaf('0xc')](_0x5aaf('0x7'),auth[_0x5aaf('0x5')](),controller[_0x5aaf('0xd')]);module[_0x5aaf('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 33c46b1..47b8ef9 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 _0xbc8f=['exports','INTEGER'];(function(_0x107d60,_0x1d1078){var _0x287309=function(_0x41f357){while(--_0x41f357){_0x107d60['push'](_0x107d60['shift']());}};_0x287309(++_0x1d1078);}(_0xbc8f,0x154));var _0xfbc8=function(_0x1b4e62,_0x544a7c){_0x1b4e62=_0x1b4e62-0x0;var _0x5dd46f=_0xbc8f[_0x1b4e62];return _0x5dd46f;};'use strict';var Sequelize=require('sequelize');module[_0xfbc8('0x0')]={'WhatsappInteractionId':{'type':Sequelize[_0xfbc8('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xfbc8('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xa120=['INTEGER','sequelize','exports'];(function(_0x46dce0,_0x2e12a8){var _0x254615=function(_0x172af0){while(--_0x172af0){_0x46dce0['push'](_0x46dce0['shift']());}};_0x254615(++_0x2e12a8);}(_0xa120,0xf4));var _0x0a12=function(_0x1db55c,_0x3eb48f){_0x1db55c=_0x1db55c-0x0;var _0x447229=_0xa120[_0x1db55c];return _0x447229;};'use strict';var Sequelize=require(_0x0a12('0x0'));module[_0x0a12('0x1')]={'WhatsappInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0a12('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 add7737..99d5d21 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 _0xd497=['to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','UserWhatsappInteraction','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserWhatsappInteractions','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xd497,0xe7));var _0x7d49=function(_0x10d6ca,_0x265cfe){_0x10d6ca=_0x10d6ca-0x0;var _0x44cfe1=_0xd497[_0x10d6ca];return _0x44cfe1;};'use strict';var pdf=require(_0x7d49('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d49('0x1'));var zipdir=require(_0x7d49('0x2'));var jsonpatch=require(_0x7d49('0x3'));var rp=require(_0x7d49('0x4'));var moment=require(_0x7d49('0x5'));var BPromise=require(_0x7d49('0x6'));var Mustache=require('mustache');var util=require(_0x7d49('0x7'));var path=require('path');var sox=require(_0x7d49('0x8'));var csv=require(_0x7d49('0x9'));var ejs=require(_0x7d49('0xa'));var fs=require('fs');var _=require(_0x7d49('0xb'));var squel=require('squel');var crypto=require(_0x7d49('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d49('0xd'));var toCsv=require(_0x7d49('0x9'));var querystring=require(_0x7d49('0xe'));var Papa=require(_0x7d49('0xf'));var Redis=require(_0x7d49('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7d49('0x11'));var as=require(_0x7d49('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d49('0x13'))(_0x7d49('0x14'));var utils=require('../../config/utils');var config=require(_0x7d49('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d49('0x16'))['db'];function respondWithStatusCode(_0x1fc80f,_0x4f5339){_0x4f5339=_0x4f5339||0xcc;return function(_0x4857e1){if(_0x4857e1){return _0x1fc80f[_0x7d49('0x17')](_0x4f5339);}return _0x1fc80f[_0x7d49('0x18')](_0x4f5339)['end']();};}function respondWithResult(_0x50a29d,_0xc46baa){_0xc46baa=_0xc46baa||0xc8;return function(_0x2ba8bb){if(_0x2ba8bb){return _0x50a29d[_0x7d49('0x18')](_0xc46baa)['json'](_0x2ba8bb);}};}function respondWithFilteredResult(_0x370885,_0xf1a5cb){return function(_0x2f9080){if(_0x2f9080){var _0x4e50af=_0x2f9080[_0x7d49('0x19')],_0x1da438=_0xf1a5cb[_0x7d49('0x1a')],_0x292172=_0xf1a5cb['offset']+_0xf1a5cb[_0x7d49('0x1b')],_0x275252;if(_0x292172>=_0x4e50af){_0x292172=_0x4e50af;_0x275252=0xc8;}else{_0x275252=0xce;}_0x370885[_0x7d49('0x18')](_0x275252);return _0x370885[_0x7d49('0x1c')]('Content-Range',_0x1da438+'-'+_0x292172+'/'+_0x4e50af)[_0x7d49('0x1d')](_0x2f9080);}return null;};}function patchUpdates(_0x439a7c){return function(_0x5d755b){try{jsonpatch['apply'](_0x5d755b,_0x439a7c,!![]);}catch(_0x3bbb23){return BPromise[_0x7d49('0x1e')](_0x3bbb23);}return _0x5d755b[_0x7d49('0x1f')]();};}function saveUpdates(_0xe70f8b,_0x447322){return function(_0x4abafa){if(_0x4abafa){return _0x4abafa[_0x7d49('0x20')](_0xe70f8b)[_0x7d49('0x21')](function(_0x282d21){return _0x282d21;});}return null;};}function removeEntity(_0x551702,_0x58fa09){return function(_0x3b192b){if(_0x3b192b){return _0x3b192b[_0x7d49('0x22')]()[_0x7d49('0x21')](function(){var _0x136192=_0x3b192b[_0x7d49('0x23')]({'plain':!![]});var _0x2c357e='UserWhatsappInteractions';return db[_0x7d49('0x24')][_0x7d49('0x22')]({'where':{'type':_0x2c357e,'resourceId':_0x136192['id']}})[_0x7d49('0x21')](function(){return _0x3b192b;});})['then'](function(){_0x551702[_0x7d49('0x18')](0xcc)[_0x7d49('0x25')]();});}};}function handleEntityNotFound(_0x38717f,_0x4b21fc){return function(_0x5ca09f){if(!_0x5ca09f){_0x38717f[_0x7d49('0x17')](0x194);}return _0x5ca09f;};}function handleError(_0x2e2be2,_0x47acfa){_0x47acfa=_0x47acfa||0x1f4;return function(_0x3d8972){logger[_0x7d49('0x26')](_0x3d8972[_0x7d49('0x27')]);if(_0x3d8972[_0x7d49('0x28')]){delete _0x3d8972[_0x7d49('0x28')];}_0x2e2be2[_0x7d49('0x18')](_0x47acfa)['send'](_0x3d8972);};}exports['index']=function(_0x5a3ba4,_0x45ffa1){var _0x5b62ca={},_0x53b02c={},_0x3f5ed1={'count':0x0,'rows':[]};var _0x3d7bad=_['map'](db[_0x7d49('0x29')][_0x7d49('0x2a')],function(_0x15cf72){return{'name':_0x15cf72[_0x7d49('0x2b')],'type':_0x15cf72[_0x7d49('0x2c')][_0x7d49('0x2d')]};});_0x53b02c[_0x7d49('0x2e')]=_[_0x7d49('0x2f')](_0x3d7bad,_0x7d49('0x28'));_0x53b02c[_0x7d49('0x30')]=_['keys'](_0x5a3ba4[_0x7d49('0x30')]);_0x53b02c[_0x7d49('0x31')]=_[_0x7d49('0x32')](_0x53b02c[_0x7d49('0x2e')],_0x53b02c[_0x7d49('0x30')]);_0x5b62ca[_0x7d49('0x33')]=_[_0x7d49('0x32')](_0x53b02c[_0x7d49('0x2e')],qs['fields'](_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x34')]));_0x5b62ca[_0x7d49('0x33')]=_0x5b62ca[_0x7d49('0x33')][_0x7d49('0x35')]?_0x5b62ca[_0x7d49('0x33')]:_0x53b02c['model'];if(!_0x5a3ba4['query']['hasOwnProperty'](_0x7d49('0x36'))){_0x5b62ca[_0x7d49('0x1b')]=qs['limit'](_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x1b')]);_0x5b62ca[_0x7d49('0x1a')]=qs['offset'](_0x5a3ba4[_0x7d49('0x30')]['offset']);}_0x5b62ca[_0x7d49('0x37')]=qs[_0x7d49('0x38')](_0x5a3ba4['query'][_0x7d49('0x38')]);_0x5b62ca['where']=qs[_0x7d49('0x31')](_[_0x7d49('0x39')](_0x5a3ba4[_0x7d49('0x30')],_0x53b02c['filters']),_0x3d7bad);if(_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x3a')]){_0x5b62ca[_0x7d49('0x3b')]=_[_0x7d49('0x3c')](_0x5b62ca[_0x7d49('0x3b')],{'$or':_[_0x7d49('0x2f')](_0x3d7bad,function(_0x284e10){if(_0x284e10[_0x7d49('0x2c')]!==_0x7d49('0x3d')){var _0x4b84d9={};_0x4b84d9[_0x284e10[_0x7d49('0x28')]]={'$like':'%'+_0x5a3ba4[_0x7d49('0x30')][_0x7d49('0x3a')]+'%'};return _0x4b84d9;}})});}_0x5b62ca=_[_0x7d49('0x3c')]({},_0x5b62ca,_0x5a3ba4[_0x7d49('0x3e')]);var _0x198b52={'where':_0x5b62ca[_0x7d49('0x3b')]};return db[_0x7d49('0x29')][_0x7d49('0x19')](_0x198b52)[_0x7d49('0x21')](function(_0x821c1){_0x3f5ed1[_0x7d49('0x19')]=_0x821c1;if(_0x5a3ba4[_0x7d49('0x30')]['includeAll']){_0x5b62ca[_0x7d49('0x3f')]=[{'all':!![]}];}return db[_0x7d49('0x29')][_0x7d49('0x40')](_0x5b62ca);})['then'](function(_0x5c8add){_0x3f5ed1[_0x7d49('0x41')]=_0x5c8add;return _0x3f5ed1;})[_0x7d49('0x21')](respondWithFilteredResult(_0x45ffa1,_0x5b62ca))[_0x7d49('0x42')](handleError(_0x45ffa1,null));};exports['show']=function(_0x5ab558,_0x184cc2){var _0x1bb506={'raw':!![],'where':{'id':_0x5ab558[_0x7d49('0x43')]['id']}},_0x366e11={};_0x366e11['model']=_[_0x7d49('0x44')](db[_0x7d49('0x29')][_0x7d49('0x2a')]);_0x366e11[_0x7d49('0x30')]=_[_0x7d49('0x44')](_0x5ab558[_0x7d49('0x30')]);_0x366e11[_0x7d49('0x31')]=_[_0x7d49('0x32')](_0x366e11[_0x7d49('0x2e')],_0x366e11['query']);_0x1bb506[_0x7d49('0x33')]=_[_0x7d49('0x32')](_0x366e11['model'],qs[_0x7d49('0x34')](_0x5ab558['query'][_0x7d49('0x34')]));_0x1bb506['attributes']=_0x1bb506[_0x7d49('0x33')][_0x7d49('0x35')]?_0x1bb506['attributes']:_0x366e11[_0x7d49('0x2e')];if(_0x5ab558[_0x7d49('0x30')][_0x7d49('0x45')]){_0x1bb506[_0x7d49('0x3f')]=[{'all':!![]}];}_0x1bb506=_[_0x7d49('0x3c')]({},_0x1bb506,_0x5ab558[_0x7d49('0x3e')]);return db[_0x7d49('0x29')][_0x7d49('0x46')](_0x1bb506)['then'](handleEntityNotFound(_0x184cc2,null))[_0x7d49('0x21')](respondWithResult(_0x184cc2,null))['catch'](handleError(_0x184cc2,null));};exports[_0x7d49('0x47')]=function(_0x374b62,_0x4a9137){return db[_0x7d49('0x29')][_0x7d49('0x47')](_0x374b62[_0x7d49('0x48')],{})[_0x7d49('0x21')](function(_0x2c9b9b){var _0xe3cb72=_0x374b62['user'][_0x7d49('0x23')]({'plain':!![]});if(!_0xe3cb72)throw new Error(_0x7d49('0x49'));if(_0xe3cb72[_0x7d49('0x4a')]===_0x7d49('0x4b')){var _0x3c902c=_0x2c9b9b[_0x7d49('0x23')]({'plain':!![]});var _0x4c9724=_0x7d49('0x4c');return db[_0x7d49('0x4d')][_0x7d49('0x46')]({'where':{'name':_0x4c9724,'userProfileId':_0xe3cb72[_0x7d49('0x4e')]},'raw':!![]})[_0x7d49('0x21')](function(_0x239c70){if(_0x239c70&&_0x239c70['autoAssociation']===0x0){return db[_0x7d49('0x24')]['create']({'name':_0x3c902c[_0x7d49('0x28')],'resourceId':_0x3c902c['id'],'type':_0x239c70[_0x7d49('0x28')],'sectionId':_0x239c70['id']},{})[_0x7d49('0x21')](function(){return _0x2c9b9b;});}else{return _0x2c9b9b;}})['catch'](function(_0x4e9490){logger['error'](_0x7d49('0x4f'),_0x4e9490);throw _0x4e9490;});}return _0x2c9b9b;})['then'](respondWithResult(_0x4a9137,0xc9))[_0x7d49('0x42')](handleError(_0x4a9137,null));};exports[_0x7d49('0x20')]=function(_0x164c0b,_0x52a547){if(_0x164c0b[_0x7d49('0x48')]['id']){delete _0x164c0b[_0x7d49('0x48')]['id'];}return db[_0x7d49('0x29')]['find']({'where':{'id':_0x164c0b[_0x7d49('0x43')]['id']}})['then'](handleEntityNotFound(_0x52a547,null))[_0x7d49('0x21')](saveUpdates(_0x164c0b[_0x7d49('0x48')],null))[_0x7d49('0x21')](respondWithResult(_0x52a547,null))[_0x7d49('0x42')](handleError(_0x52a547,null));};exports[_0x7d49('0x22')]=function(_0x433068,_0x3d0108){return db[_0x7d49('0x29')][_0x7d49('0x46')]({'where':{'id':_0x433068[_0x7d49('0x43')]['id']}})[_0x7d49('0x21')](handleEntityNotFound(_0x3d0108,null))[_0x7d49('0x21')](removeEntity(_0x3d0108,null))['catch'](handleError(_0x3d0108,null));}; \ No newline at end of file +var _0x3298=['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','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','UserWhatsappInteraction','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserWhatsappInteractions','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','desk.js'];(function(_0x2cf1d8,_0x3d3512){var _0x2872dd=function(_0x1aabc7){while(--_0x1aabc7){_0x2cf1d8['push'](_0x2cf1d8['shift']());}};_0x2872dd(++_0x3d3512);}(_0x3298,0x137));var _0x8329=function(_0xa1b92e,_0x163513){_0xa1b92e=_0xa1b92e-0x0;var _0x3722c4=_0x3298[_0xa1b92e];return _0x3722c4;};'use strict';var pdf=require(_0x8329('0x0'));var emlformat=require(_0x8329('0x1'));var rimraf=require(_0x8329('0x2'));var zipdir=require(_0x8329('0x3'));var jsonpatch=require(_0x8329('0x4'));var rp=require('request-promise');var moment=require(_0x8329('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8329('0x6'));var path=require('path');var sox=require(_0x8329('0x7'));var csv=require(_0x8329('0x8'));var ejs=require(_0x8329('0x9'));var fs=require('fs');var _=require(_0x8329('0xa'));var squel=require('squel');var crypto=require(_0x8329('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8329('0xc'));var toCsv=require(_0x8329('0x8'));var querystring=require(_0x8329('0xd'));var Papa=require(_0x8329('0xe'));var Redis=require(_0x8329('0xf'));var authService=require(_0x8329('0x10'));var qs=require(_0x8329('0x11'));var as=require(_0x8329('0x12'));var hardwareService=require(_0x8329('0x13'));var logger=require(_0x8329('0x14'))('api');var utils=require(_0x8329('0x15'));var config=require(_0x8329('0x16'));var licenseUtil=require(_0x8329('0x17'));var db=require(_0x8329('0x18'))['db'];function respondWithStatusCode(_0x1635c9,_0x5438f4){_0x5438f4=_0x5438f4||0xcc;return function(_0x4afb26){if(_0x4afb26){return _0x1635c9[_0x8329('0x19')](_0x5438f4);}return _0x1635c9[_0x8329('0x1a')](_0x5438f4)['end']();};}function respondWithResult(_0x4f45cd,_0x36a87c){_0x36a87c=_0x36a87c||0xc8;return function(_0x191a12){if(_0x191a12){return _0x4f45cd['status'](_0x36a87c)[_0x8329('0x1b')](_0x191a12);}};}function respondWithFilteredResult(_0x34c413,_0x320346){return function(_0x4857f4){if(_0x4857f4){var _0x4fceeb=_0x4857f4[_0x8329('0x1c')],_0x348219=_0x320346[_0x8329('0x1d')],_0x2a71e8=_0x320346[_0x8329('0x1d')]+_0x320346[_0x8329('0x1e')],_0x389e82;if(_0x2a71e8>=_0x4fceeb){_0x2a71e8=_0x4fceeb;_0x389e82=0xc8;}else{_0x389e82=0xce;}_0x34c413[_0x8329('0x1a')](_0x389e82);return _0x34c413['set'](_0x8329('0x1f'),_0x348219+'-'+_0x2a71e8+'/'+_0x4fceeb)[_0x8329('0x1b')](_0x4857f4);}return null;};}function patchUpdates(_0x3d6f49){return function(_0x20db15){try{jsonpatch['apply'](_0x20db15,_0x3d6f49,!![]);}catch(_0x1a3212){return BPromise[_0x8329('0x20')](_0x1a3212);}return _0x20db15['save']();};}function saveUpdates(_0x25a23e,_0x4c501c){return function(_0x4f9208){if(_0x4f9208){return _0x4f9208[_0x8329('0x21')](_0x25a23e)[_0x8329('0x22')](function(_0x1f05d4){return _0x1f05d4;});}return null;};}function removeEntity(_0x25b40b,_0x3e6ba7){return function(_0x4e3705){if(_0x4e3705){return _0x4e3705['destroy']()[_0x8329('0x22')](function(){var _0x125fcd=_0x4e3705['get']({'plain':!![]});var _0x3515db='UserWhatsappInteractions';return db['UserProfileResource'][_0x8329('0x23')]({'where':{'type':_0x3515db,'resourceId':_0x125fcd['id']}})['then'](function(){return _0x4e3705;});})[_0x8329('0x22')](function(){_0x25b40b[_0x8329('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1059aa,_0x1c6795){return function(_0x177def){if(!_0x177def){_0x1059aa['sendStatus'](0x194);}return _0x177def;};}function handleError(_0x5384b1,_0x1f73a9){_0x1f73a9=_0x1f73a9||0x1f4;return function(_0x3a16fe){logger[_0x8329('0x24')](_0x3a16fe[_0x8329('0x25')]);if(_0x3a16fe[_0x8329('0x26')]){delete _0x3a16fe[_0x8329('0x26')];}_0x5384b1['status'](_0x1f73a9)[_0x8329('0x27')](_0x3a16fe);};}exports['index']=function(_0x3e6c62,_0x11d955){var _0x258729={},_0x359dd7={},_0x1de830={'count':0x0,'rows':[]};var _0x195527=_['map'](db['UserWhatsappInteraction']['rawAttributes'],function(_0x1ea249){return{'name':_0x1ea249['fieldName'],'type':_0x1ea249[_0x8329('0x28')][_0x8329('0x29')]};});_0x359dd7[_0x8329('0x2a')]=_[_0x8329('0x2b')](_0x195527,_0x8329('0x26'));_0x359dd7[_0x8329('0x2c')]=_[_0x8329('0x2d')](_0x3e6c62['query']);_0x359dd7[_0x8329('0x2e')]=_['intersection'](_0x359dd7[_0x8329('0x2a')],_0x359dd7[_0x8329('0x2c')]);_0x258729[_0x8329('0x2f')]=_[_0x8329('0x30')](_0x359dd7[_0x8329('0x2a')],qs[_0x8329('0x31')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x31')]));_0x258729[_0x8329('0x2f')]=_0x258729[_0x8329('0x2f')]['length']?_0x258729[_0x8329('0x2f')]:_0x359dd7['model'];if(!_0x3e6c62[_0x8329('0x2c')][_0x8329('0x32')](_0x8329('0x33'))){_0x258729[_0x8329('0x1e')]=qs[_0x8329('0x1e')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x1e')]);_0x258729[_0x8329('0x1d')]=qs[_0x8329('0x1d')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x1d')]);}_0x258729[_0x8329('0x34')]=qs[_0x8329('0x35')](_0x3e6c62[_0x8329('0x2c')][_0x8329('0x35')]);_0x258729['where']=qs[_0x8329('0x2e')](_[_0x8329('0x36')](_0x3e6c62[_0x8329('0x2c')],_0x359dd7[_0x8329('0x2e')]),_0x195527);if(_0x3e6c62['query'][_0x8329('0x37')]){_0x258729[_0x8329('0x38')]=_['merge'](_0x258729[_0x8329('0x38')],{'$or':_[_0x8329('0x2b')](_0x195527,function(_0x503ec8){if(_0x503ec8['type']!==_0x8329('0x39')){var _0x5d5407={};_0x5d5407[_0x503ec8['name']]={'$like':'%'+_0x3e6c62[_0x8329('0x2c')][_0x8329('0x37')]+'%'};return _0x5d5407;}})});}_0x258729=_[_0x8329('0x3a')]({},_0x258729,_0x3e6c62[_0x8329('0x3b')]);var _0x582594={'where':_0x258729['where']};return db[_0x8329('0x3c')][_0x8329('0x1c')](_0x582594)['then'](function(_0x5b8d2b){_0x1de830[_0x8329('0x1c')]=_0x5b8d2b;if(_0x3e6c62[_0x8329('0x2c')][_0x8329('0x3d')]){_0x258729[_0x8329('0x3e')]=[{'all':!![]}];}return db[_0x8329('0x3c')][_0x8329('0x3f')](_0x258729);})[_0x8329('0x22')](function(_0x104524){_0x1de830[_0x8329('0x40')]=_0x104524;return _0x1de830;})[_0x8329('0x22')](respondWithFilteredResult(_0x11d955,_0x258729))[_0x8329('0x41')](handleError(_0x11d955,null));};exports[_0x8329('0x42')]=function(_0x4beae4,_0x6d6d1c){var _0x1d2450={'raw':!![],'where':{'id':_0x4beae4[_0x8329('0x43')]['id']}},_0x5d98c4={};_0x5d98c4[_0x8329('0x2a')]=_[_0x8329('0x2d')](db[_0x8329('0x3c')][_0x8329('0x44')]);_0x5d98c4[_0x8329('0x2c')]=_[_0x8329('0x2d')](_0x4beae4[_0x8329('0x2c')]);_0x5d98c4[_0x8329('0x2e')]=_[_0x8329('0x30')](_0x5d98c4['model'],_0x5d98c4[_0x8329('0x2c')]);_0x1d2450[_0x8329('0x2f')]=_[_0x8329('0x30')](_0x5d98c4[_0x8329('0x2a')],qs['fields'](_0x4beae4[_0x8329('0x2c')][_0x8329('0x31')]));_0x1d2450[_0x8329('0x2f')]=_0x1d2450[_0x8329('0x2f')]['length']?_0x1d2450['attributes']:_0x5d98c4[_0x8329('0x2a')];if(_0x4beae4['query'][_0x8329('0x3d')]){_0x1d2450[_0x8329('0x3e')]=[{'all':!![]}];}_0x1d2450=_[_0x8329('0x3a')]({},_0x1d2450,_0x4beae4['options']);return db['UserWhatsappInteraction'][_0x8329('0x45')](_0x1d2450)['then'](handleEntityNotFound(_0x6d6d1c,null))['then'](respondWithResult(_0x6d6d1c,null))[_0x8329('0x41')](handleError(_0x6d6d1c,null));};exports[_0x8329('0x46')]=function(_0x317c18,_0x265968){return db[_0x8329('0x3c')][_0x8329('0x46')](_0x317c18[_0x8329('0x47')],{})[_0x8329('0x22')](function(_0xf5fbe4){var _0x188157=_0x317c18[_0x8329('0x48')][_0x8329('0x49')]({'plain':!![]});if(!_0x188157)throw new Error(_0x8329('0x4a'));if(_0x188157[_0x8329('0x4b')]===_0x8329('0x48')){var _0x564498=_0xf5fbe4['get']({'plain':!![]});var _0x22600a=_0x8329('0x4c');return db[_0x8329('0x4d')]['find']({'where':{'name':_0x22600a,'userProfileId':_0x188157['userProfileId']},'raw':!![]})[_0x8329('0x22')](function(_0x42e450){if(_0x42e450&&_0x42e450[_0x8329('0x4e')]===0x0){return db[_0x8329('0x4f')][_0x8329('0x46')]({'name':_0x564498[_0x8329('0x26')],'resourceId':_0x564498['id'],'type':_0x42e450[_0x8329('0x26')],'sectionId':_0x42e450['id']},{})['then'](function(){return _0xf5fbe4;});}else{return _0xf5fbe4;}})['catch'](function(_0x11f9d6){logger[_0x8329('0x24')](_0x8329('0x50'),_0x11f9d6);throw _0x11f9d6;});}return _0xf5fbe4;})[_0x8329('0x22')](respondWithResult(_0x265968,0xc9))[_0x8329('0x41')](handleError(_0x265968,null));};exports[_0x8329('0x21')]=function(_0x595803,_0x34e675){if(_0x595803[_0x8329('0x47')]['id']){delete _0x595803['body']['id'];}return db[_0x8329('0x3c')]['find']({'where':{'id':_0x595803[_0x8329('0x43')]['id']}})['then'](handleEntityNotFound(_0x34e675,null))['then'](saveUpdates(_0x595803[_0x8329('0x47')],null))[_0x8329('0x22')](respondWithResult(_0x34e675,null))['catch'](handleError(_0x34e675,null));};exports[_0x8329('0x23')]=function(_0xa2ef25,_0x3f1d3b){return db['UserWhatsappInteraction']['find']({'where':{'id':_0xa2ef25[_0x8329('0x43')]['id']}})[_0x8329('0x22')](handleEntityNotFound(_0x3f1d3b,null))[_0x8329('0x22')](removeEntity(_0x3f1d3b,null))[_0x8329('0x41')](handleError(_0x3f1d3b,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 2ea0bfc..514c4ca 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 _0x3551=['user_has_whatsapp_interactions','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','define','UserWhatsappInteraction'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3551,0x135));var _0x1355=function(_0x31e634,_0xdae36){_0x31e634=_0x31e634-0x0;var _0x4b2505=_0x3551[_0x31e634];return _0x4b2505;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1355('0x0'));var moment=require(_0x1355('0x1'));var BPromise=require(_0x1355('0x2'));var rp=require(_0x1355('0x3'));var fs=require('fs');var path=require(_0x1355('0x4'));var rimraf=require(_0x1355('0x5'));var config=require(_0x1355('0x6'));var attributes=require(_0x1355('0x7'));module['exports']=function(_0xd5ad25,_0x4321a8){return _0xd5ad25[_0x1355('0x8')](_0x1355('0x9'),attributes,{'tableName':_0x1355('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8824=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0x8824,0xe0));var _0x4882=function(_0x55b735,_0xaee0a7){_0x55b735=_0x55b735-0x0;var _0x33931d=_0x8824[_0x55b735];return _0x33931d;};'use strict';var _=require(_0x4882('0x0'));var util=require(_0x4882('0x1'));var logger=require(_0x4882('0x2'))(_0x4882('0x3'));var moment=require(_0x4882('0x4'));var BPromise=require(_0x4882('0x5'));var rp=require(_0x4882('0x6'));var fs=require('fs');var path=require(_0x4882('0x7'));var rimraf=require(_0x4882('0x8'));var config=require(_0x4882('0x9'));var attributes=require(_0x4882('0xa'));module[_0x4882('0xb')]=function(_0x3a0d90,_0x30e4f3){return _0x3a0d90[_0x4882('0xc')](_0x4882('0xd'),attributes,{'tableName':_0x4882('0xe'),'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 84c8a80..6eb8fdf 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 _0xa5b6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash'];(function(_0x40aa59,_0x36b8bd){var _0x436c2c=function(_0x27b66c){while(--_0x27b66c){_0x40aa59['push'](_0x40aa59['shift']());}};_0x436c2c(++_0x36b8bd);}(_0xa5b6,0x149));var _0x6a5b=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0xa5b6[_0x29e2af];return _0x1ea06a;};'use strict';var _=require(_0x6a5b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a5b('0x1'));var rs=require(_0x6a5b('0x2'));var fs=require('fs');var Redis=require(_0x6a5b('0x3'));var db=require(_0x6a5b('0x4'))['db'];var utils=require(_0x6a5b('0x5'));var logger=require(_0x6a5b('0x6'))(_0x6a5b('0x7'));var config=require(_0x6a5b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a5b('0x9')][_0x6a5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ed665,_0xc08bfe,_0x32de2f){return new BPromise(function(_0x4b7649,_0x5aa864){return client[_0x6a5b('0xb')](_0x1ed665,_0x32de2f)[_0x6a5b('0xc')](function(_0x404b02){logger['info'](_0x6a5b('0xd'),_0xc08bfe,_0x6a5b('0xe'));logger[_0x6a5b('0xf')](_0x6a5b('0x10'),_0xc08bfe,'request\x20sent',JSON[_0x6a5b('0x11')](_0x404b02));if(_0x404b02[_0x6a5b('0x12')]){if(_0x404b02['error'][_0x6a5b('0x13')]===0x1f4){logger[_0x6a5b('0x12')](_0x6a5b('0xd'),_0xc08bfe,_0x404b02['error']['message']);return _0x5aa864(_0x404b02[_0x6a5b('0x12')][_0x6a5b('0x14')]);}logger[_0x6a5b('0x12')](_0x6a5b('0xd'),_0xc08bfe,_0x404b02[_0x6a5b('0x12')][_0x6a5b('0x14')]);return _0x4b7649(_0x404b02[_0x6a5b('0x12')][_0x6a5b('0x14')]);}else{logger[_0x6a5b('0x15')](_0x6a5b('0xd'),_0xc08bfe,'request\x20sent');_0x4b7649(_0x404b02['result'][_0x6a5b('0x14')]);}})['catch'](function(_0x429ed4){logger[_0x6a5b('0x12')](_0x6a5b('0xd'),_0xc08bfe,_0x429ed4);_0x5aa864(_0x429ed4);});});} \ No newline at end of file +var _0xbb63=['../../config/logger','rpc','../../config/environment','client','http','then','info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x1aab86,_0x46a993){var _0x549b72=function(_0x53a272){while(--_0x53a272){_0x1aab86['push'](_0x1aab86['shift']());}};_0x549b72(++_0x46a993);}(_0xbb63,0x119));var _0x3bb6=function(_0x1c4db2,_0x3cb299){_0x1c4db2=_0x1c4db2-0x0;var _0x2bbfd7=_0xbb63[_0x1c4db2];return _0x2bbfd7;};'use strict';var _=require(_0x3bb6('0x0'));var util=require('util');var moment=require(_0x3bb6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bb6('0x2'));var db=require(_0x3bb6('0x3'))['db'];var utils=require(_0x3bb6('0x4'));var logger=require(_0x3bb6('0x5'))(_0x3bb6('0x6'));var config=require(_0x3bb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3bb6('0x8')][_0x3bb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1beb1d,_0x63cb2c,_0x2181ca){return new BPromise(function(_0x401aee,_0x5d39db){return client['request'](_0x1beb1d,_0x2181ca)[_0x3bb6('0xa')](function(_0x580b62){logger[_0x3bb6('0xb')](_0x3bb6('0xc'),_0x63cb2c,_0x3bb6('0xd'));logger[_0x3bb6('0xe')](_0x3bb6('0xf'),_0x63cb2c,'request\x20sent',JSON[_0x3bb6('0x10')](_0x580b62));if(_0x580b62[_0x3bb6('0x11')]){if(_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x12')]===0x1f4){logger['error']('UserWhatsappInteraction,\x20%s,\x20%s',_0x63cb2c,_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x13')]);return _0x5d39db(_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x13')]);}logger['error'](_0x3bb6('0xc'),_0x63cb2c,_0x580b62[_0x3bb6('0x11')][_0x3bb6('0x13')]);return _0x401aee(_0x580b62[_0x3bb6('0x11')]['message']);}else{logger['info'](_0x3bb6('0xc'),_0x63cb2c,_0x3bb6('0xd'));_0x401aee(_0x580b62[_0x3bb6('0x14')]['message']);}})[_0x3bb6('0x15')](function(_0x3455ab){logger[_0x3bb6('0x11')](_0x3bb6('0xc'),_0x63cb2c,_0x3455ab);_0x5d39db(_0x3455ab);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 10779fc..d3a2f91 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 _0x2e54=['index','get','post','create','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','isAuthenticated'];(function(_0x124925,_0x3e58d7){var _0x44370b=function(_0xcd213a){while(--_0xcd213a){_0x124925['push'](_0x124925['shift']());}};_0x44370b(++_0x3e58d7);}(_0x2e54,0x1dd));var _0x42e5=function(_0x52de8a,_0x16092f){_0x52de8a=_0x52de8a-0x0;var _0x4dd3a9=_0x2e54[_0x52de8a];return _0x4dd3a9;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var auth=require(_0x42e5('0x4'));var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router['get']('/',auth[_0x42e5('0x8')](),controller[_0x42e5('0x9')]);router[_0x42e5('0xa')]('/:id',auth[_0x42e5('0x8')](),controller['show']);router[_0x42e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router[_0x42e5('0xd')](_0x42e5('0xe'),auth[_0x42e5('0x8')](),controller[_0x42e5('0xf')]);router[_0x42e5('0x10')](_0x42e5('0xe'),auth[_0x42e5('0x8')](),controller[_0x42e5('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfa20=['./UserWhatsappInteraction.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb3b7e,_0x261956){var _0x448662=function(_0x485714){while(--_0x485714){_0xb3b7e['push'](_0xb3b7e['shift']());}};_0x448662(++_0x261956);}(_0xfa20,0x141));var _0x0fa2=function(_0x3d829d,_0x5af899){_0x3d829d=_0x3d829d-0x0;var _0x318701=_0xfa20[_0x3d829d];return _0x318701;};'use strict';var multer=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var path=require(_0x0fa2('0x2'));var timeout=require(_0x0fa2('0x3'));var express=require(_0x0fa2('0x4'));var router=express[_0x0fa2('0x5')]();var auth=require(_0x0fa2('0x6'));var interaction=require(_0x0fa2('0x7'));var config=require(_0x0fa2('0x8'));var controller=require(_0x0fa2('0x9'));router[_0x0fa2('0xa')]('/',auth['isAuthenticated'](),controller[_0x0fa2('0xb')]);router[_0x0fa2('0xa')]('/:id',auth[_0x0fa2('0xc')](),controller[_0x0fa2('0xd')]);router[_0x0fa2('0xe')]('/',auth[_0x0fa2('0xc')](),controller[_0x0fa2('0xf')]);router[_0x0fa2('0x10')](_0x0fa2('0x11'),auth[_0x0fa2('0xc')](),controller[_0x0fa2('0x12')]);router[_0x0fa2('0x13')]('/:id',auth[_0x0fa2('0xc')](),controller[_0x0fa2('0x14')]);module[_0x0fa2('0x15')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 8e7971c..aaf353f 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 _0xcadb=['getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL'];(function(_0x2cc14a,_0x1eb1f7){var _0x9534e3=function(_0xd86c85){while(--_0xd86c85){_0x2cc14a['push'](_0x2cc14a['shift']());}};_0x9534e3(++_0x1eb1f7);}(_0xcadb,0x11b));var _0xbcad=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xcadb[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require(_0xbcad('0x0'));module['exports']={'name':{'type':Sequelize[_0xbcad('0x1')],'get':function(_0x7a9068){return this[_0xbcad('0x2')](_0xbcad('0x3'));}},'action':{'type':Sequelize[_0xbcad('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbcad('0x5'),'integration',_0xbcad('0x6'),_0xbcad('0x7'),_0xbcad('0x8'),_0xbcad('0x9'),_0xbcad('0xa'),_0xbcad('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xbcad('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0xbcad('0x4')](0x1000),'comment':_0xbcad('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xbcad('0xd')},'data4':{'type':Sequelize[_0xbcad('0x4')](0x1000)},'data5':{'type':Sequelize[_0xbcad('0x4')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xbcad('0xe')]}}; \ No newline at end of file +var _0x76b2=['VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','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'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x76b2,0xcf));var _0x276b=function(_0x2a4265,_0x2e1d7c){_0x2a4265=_0x2a4265-0x0;var _0x2a1492=_0x76b2[_0x2a4265];return _0x2a1492;};'use strict';var Sequelize=require(_0x276b('0x0'));module['exports']={'name':{'type':Sequelize[_0x276b('0x1')],'get':function(_0x50bf3b){return this[_0x276b('0x2')]('action');}},'action':{'type':Sequelize[_0x276b('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x276b('0x4'),_0x276b('0x5'),_0x276b('0x6'),_0x276b('0x7'),_0x276b('0x8'),_0x276b('0x9'),_0x276b('0xa'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x276b('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x276b('0xc')},'data2':{'type':Sequelize[_0x276b('0x3')](0x1000),'comment':_0x276b('0xd')},'data3':{'type':Sequelize[_0x276b('0x3')](0x1000),'comment':_0x276b('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x276b('0x3')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x276b('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6dd93c0..86c6307 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 _0x81d4=['update','then','error','name','send','body','Action','catch','destroy','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set','json','save'];(function(_0x13a36f,_0x5505bd){var _0x15cc2a=function(_0x1f8927){while(--_0x1f8927){_0x13a36f['push'](_0x13a36f['shift']());}};_0x15cc2a(++_0x5505bd);}(_0x81d4,0x197));var _0x481d=function(_0x570889,_0x2eab0e){_0x570889=_0x570889-0x0;var _0x1a500b=_0x81d4[_0x570889];return _0x1a500b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x481d('0x0'));var rimraf=require(_0x481d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x481d('0x2'));var rp=require(_0x481d('0x3'));var moment=require(_0x481d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x481d('0x5'));var path=require(_0x481d('0x6'));var sox=require(_0x481d('0x7'));var csv=require('to-csv');var ejs=require(_0x481d('0x8'));var fs=require('fs');var _=require(_0x481d('0x9'));var squel=require(_0x481d('0xa'));var crypto=require(_0x481d('0xb'));var jsforce=require(_0x481d('0xc'));var deskjs=require(_0x481d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x481d('0xe'));var Papa=require(_0x481d('0xf'));var Redis=require(_0x481d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x481d('0x11'));var as=require(_0x481d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x481d('0x13'))(_0x481d('0x14'));var utils=require(_0x481d('0x15'));var config=require(_0x481d('0x16'));var licenseUtil=require(_0x481d('0x17'));var db=require(_0x481d('0x18'))['db'];function respondWithStatusCode(_0x9c7a08,_0x4e33fc){_0x4e33fc=_0x4e33fc||0xcc;return function(_0x3a751f){if(_0x3a751f){return _0x9c7a08['sendStatus'](_0x4e33fc);}return _0x9c7a08['status'](_0x4e33fc)[_0x481d('0x19')]();};}function respondWithResult(_0x18bd93,_0x2f32c8){_0x2f32c8=_0x2f32c8||0xc8;return function(_0x5cbe7e){if(_0x5cbe7e){return _0x18bd93[_0x481d('0x1a')](_0x2f32c8)['json'](_0x5cbe7e);}};}function respondWithFilteredResult(_0x1e3df6,_0x15bba7){return function(_0x222f72){if(_0x222f72){var _0x1bda12=_0x222f72[_0x481d('0x1b')],_0x879e29=_0x15bba7[_0x481d('0x1c')],_0x59c5d5=_0x15bba7['offset']+_0x15bba7[_0x481d('0x1d')],_0x63b8c1;if(_0x59c5d5>=_0x1bda12){_0x59c5d5=_0x1bda12;_0x63b8c1=0xc8;}else{_0x63b8c1=0xce;}_0x1e3df6['status'](_0x63b8c1);return _0x1e3df6[_0x481d('0x1e')]('Content-Range',_0x879e29+'-'+_0x59c5d5+'/'+_0x1bda12)[_0x481d('0x1f')](_0x222f72);}return null;};}function patchUpdates(_0x59cdbc){return function(_0x30ef03){try{jsonpatch['apply'](_0x30ef03,_0x59cdbc,!![]);}catch(_0x2c52bc){return BPromise['reject'](_0x2c52bc);}return _0x30ef03[_0x481d('0x20')]();};}function saveUpdates(_0x41a4de,_0x4d56ea){return function(_0x2d1daa){if(_0x2d1daa){return _0x2d1daa[_0x481d('0x21')](_0x41a4de)[_0x481d('0x22')](function(_0x48d0b1){return _0x48d0b1;});}return null;};}function removeEntity(_0x45745b,_0x4ab1e8){return function(_0x560b33){if(_0x560b33){return _0x560b33['destroy']()[_0x481d('0x22')](function(){_0x45745b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x280586,_0x237c02){return function(_0x10e8a1){if(!_0x10e8a1){_0x280586['sendStatus'](0x194);}return _0x10e8a1;};}function handleError(_0x100020,_0x469a86){_0x469a86=_0x469a86||0x1f4;return function(_0x51e3a){logger[_0x481d('0x23')](_0x51e3a['stack']);if(_0x51e3a[_0x481d('0x24')]){delete _0x51e3a[_0x481d('0x24')];}_0x100020['status'](_0x469a86)[_0x481d('0x25')](_0x51e3a);};}exports[_0x481d('0x21')]=function(_0x4001b9,_0x5173b2){if(_0x4001b9['body']['id']){delete _0x4001b9[_0x481d('0x26')]['id'];}return db[_0x481d('0x27')]['find']({'where':{'id':_0x4001b9['params']['id']}})[_0x481d('0x22')](handleEntityNotFound(_0x5173b2,null))[_0x481d('0x22')](saveUpdates(_0x4001b9[_0x481d('0x26')],null))[_0x481d('0x22')](respondWithResult(_0x5173b2,null))[_0x481d('0x28')](handleError(_0x5173b2,null));};exports[_0x481d('0x29')]=function(_0x44c319,_0x1bfff7){return db[_0x481d('0x27')][_0x481d('0x2a')]({'where':{'id':_0x44c319[_0x481d('0x2b')]['id']}})[_0x481d('0x22')](handleEntityNotFound(_0x1bfff7,null))['then'](removeEntity(_0x1bfff7,null))[_0x481d('0x28')](handleError(_0x1bfff7,null));}; \ No newline at end of file +var _0xe7de=['name','send','body','find','catch','Action','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0xb9a1a2,_0x47681f){var _0x390542=function(_0x11205a){while(--_0x11205a){_0xb9a1a2['push'](_0xb9a1a2['shift']());}};_0x390542(++_0x47681f);}(_0xe7de,0x165));var _0xee7d=function(_0x4b589b,_0x1a1ee8){_0x4b589b=_0x4b589b-0x0;var _0x44f3fb=_0xe7de[_0x4b589b];return _0x44f3fb;};'use strict';var pdf=require(_0xee7d('0x0'));var emlformat=require(_0xee7d('0x1'));var rimraf=require(_0xee7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee7d('0x3'));var moment=require(_0xee7d('0x4'));var BPromise=require(_0xee7d('0x5'));var Mustache=require(_0xee7d('0x6'));var util=require(_0xee7d('0x7'));var path=require(_0xee7d('0x8'));var sox=require(_0xee7d('0x9'));var csv=require(_0xee7d('0xa'));var ejs=require(_0xee7d('0xb'));var fs=require('fs');var _=require(_0xee7d('0xc'));var squel=require(_0xee7d('0xd'));var crypto=require(_0xee7d('0xe'));var jsforce=require(_0xee7d('0xf'));var deskjs=require(_0xee7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee7d('0x11'));var Papa=require(_0xee7d('0x12'));var Redis=require(_0xee7d('0x13'));var authService=require(_0xee7d('0x14'));var qs=require(_0xee7d('0x15'));var as=require(_0xee7d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x17'))('api');var utils=require(_0xee7d('0x18'));var config=require(_0xee7d('0x19'));var licenseUtil=require(_0xee7d('0x1a'));var db=require(_0xee7d('0x1b'))['db'];function respondWithStatusCode(_0xdfb04b,_0xb4c933){_0xb4c933=_0xb4c933||0xcc;return function(_0x3e9daa){if(_0x3e9daa){return _0xdfb04b[_0xee7d('0x1c')](_0xb4c933);}return _0xdfb04b[_0xee7d('0x1d')](_0xb4c933)[_0xee7d('0x1e')]();};}function respondWithResult(_0x41ca24,_0x47eb16){_0x47eb16=_0x47eb16||0xc8;return function(_0x4bfdab){if(_0x4bfdab){return _0x41ca24[_0xee7d('0x1d')](_0x47eb16)[_0xee7d('0x1f')](_0x4bfdab);}};}function respondWithFilteredResult(_0x4ab8a6,_0x1211a1){return function(_0x1a2976){if(_0x1a2976){var _0x1dc47c=_0x1a2976[_0xee7d('0x20')],_0x5c40f8=_0x1211a1[_0xee7d('0x21')],_0x3f76e6=_0x1211a1[_0xee7d('0x21')]+_0x1211a1[_0xee7d('0x22')],_0x2bcd81;if(_0x3f76e6>=_0x1dc47c){_0x3f76e6=_0x1dc47c;_0x2bcd81=0xc8;}else{_0x2bcd81=0xce;}_0x4ab8a6['status'](_0x2bcd81);return _0x4ab8a6[_0xee7d('0x23')](_0xee7d('0x24'),_0x5c40f8+'-'+_0x3f76e6+'/'+_0x1dc47c)[_0xee7d('0x1f')](_0x1a2976);}return null;};}function patchUpdates(_0x597981){return function(_0x277738){try{jsonpatch['apply'](_0x277738,_0x597981,!![]);}catch(_0x1ef8ea){return BPromise[_0xee7d('0x25')](_0x1ef8ea);}return _0x277738[_0xee7d('0x26')]();};}function saveUpdates(_0x4f6445,_0x113a05){return function(_0x52b104){if(_0x52b104){return _0x52b104[_0xee7d('0x27')](_0x4f6445)[_0xee7d('0x28')](function(_0x269835){return _0x269835;});}return null;};}function removeEntity(_0xed4f9f,_0x52eaf4){return function(_0x32ad6e){if(_0x32ad6e){return _0x32ad6e[_0xee7d('0x29')]()[_0xee7d('0x28')](function(){_0xed4f9f[_0xee7d('0x1d')](0xcc)[_0xee7d('0x1e')]();});}};}function handleEntityNotFound(_0x4d0efb,_0x172850){return function(_0x34af16){if(!_0x34af16){_0x4d0efb[_0xee7d('0x1c')](0x194);}return _0x34af16;};}function handleError(_0x56a680,_0x1a2fe5){_0x1a2fe5=_0x1a2fe5||0x1f4;return function(_0x293382){logger[_0xee7d('0x2a')](_0x293382['stack']);if(_0x293382[_0xee7d('0x2b')]){delete _0x293382[_0xee7d('0x2b')];}_0x56a680[_0xee7d('0x1d')](_0x1a2fe5)[_0xee7d('0x2c')](_0x293382);};}exports[_0xee7d('0x27')]=function(_0x1b4492,_0xb727c9){if(_0x1b4492[_0xee7d('0x2d')]['id']){delete _0x1b4492[_0xee7d('0x2d')]['id'];}return db['Action'][_0xee7d('0x2e')]({'where':{'id':_0x1b4492['params']['id']}})['then'](handleEntityNotFound(_0xb727c9,null))[_0xee7d('0x28')](saveUpdates(_0x1b4492['body'],null))[_0xee7d('0x28')](respondWithResult(_0xb727c9,null))[_0xee7d('0x2f')](handleError(_0xb727c9,null));};exports['destroy']=function(_0x6b6174,_0x1d1990){return db[_0xee7d('0x30')][_0xee7d('0x2e')]({'where':{'id':_0x6b6174[_0xee7d('0x31')]['id']}})['then'](handleEntityNotFound(_0x1d1990,null))[_0xee7d('0x28')](removeEntity(_0x1d1990,null))[_0xee7d('0x2f')](handleError(_0x1d1990,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 546e967..5526b8b 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 _0xc954=['rimraf','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x36c97e,_0x41f0c3){var _0x41841b=function(_0x1e8dda){while(--_0x1e8dda){_0x36c97e['push'](_0x36c97e['shift']());}};_0x41841b(++_0x41f0c3);}(_0xc954,0xeb));var _0x4c95=function(_0x4a0332,_0x4a5358){_0x4a0332=_0x4a0332-0x0;var _0x845d4d=_0xc954[_0x4a0332];return _0x845d4d;};'use strict';var _=require(_0x4c95('0x0'));var util=require(_0x4c95('0x1'));var logger=require(_0x4c95('0x2'))('api');var moment=require(_0x4c95('0x3'));var BPromise=require(_0x4c95('0x4'));var rp=require(_0x4c95('0x5'));var fs=require('fs');var path=require(_0x4c95('0x6'));var rimraf=require(_0x4c95('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c95('0x8'));module[_0x4c95('0x9')]=function(_0x33e143,_0x4fd966){return _0x33e143['define']('Action',attributes,{'tableName':_0x4c95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d48=['exports','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./action.attributes'];(function(_0x122cfb,_0x2d1b8a){var _0x1f0dc2=function(_0x171d0d){while(--_0x171d0d){_0x122cfb['push'](_0x122cfb['shift']());}};_0x1f0dc2(++_0x2d1b8a);}(_0x0d48,0x18d));var _0x80d4=function(_0x22b9b7,_0x203492){_0x22b9b7=_0x22b9b7-0x0;var _0xbd7673=_0x0d48[_0x22b9b7];return _0xbd7673;};'use strict';var _=require(_0x80d4('0x0'));var util=require(_0x80d4('0x1'));var logger=require(_0x80d4('0x2'))('api');var moment=require(_0x80d4('0x3'));var BPromise=require(_0x80d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d4('0x5'));var rimraf=require(_0x80d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x80d4('0x7'));module[_0x80d4('0x8')]=function(_0x18f377,_0x11caa8){return _0x18f377['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 0d9c399..f444d65 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x107c11,_0xbaba1d){var _0x1b07aa=function(_0x40eefc){while(--_0x40eefc){_0x107c11['push'](_0x107c11['shift']());}};_0x1b07aa(++_0xbaba1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 26f9dc3..255bd59 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 _0x3b60=['/:id','destroy','multer','util','path','express','Router','../../components/auth/service','put','update','delete'];(function(_0x16e0f5,_0x4ec0f3){var _0x4839d5=function(_0x296b8f){while(--_0x296b8f){_0x16e0f5['push'](_0x16e0f5['shift']());}};_0x4839d5(++_0x4ec0f3);}(_0x3b60,0x86));var _0x03b6=function(_0x42f362,_0x25ff81){_0x42f362=_0x42f362-0x0;var _0x2caffc=_0x3b60[_0x42f362];return _0x2caffc;};'use strict';var multer=require(_0x03b6('0x0'));var util=require(_0x03b6('0x1'));var path=require(_0x03b6('0x2'));var timeout=require('connect-timeout');var express=require(_0x03b6('0x3'));var router=express[_0x03b6('0x4')]();var auth=require(_0x03b6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0x03b6('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x03b6('0x7')]);router[_0x03b6('0x8')](_0x03b6('0x9'),auth['isAuthenticated'](),controller[_0x03b6('0xa')]);module['exports']=router; \ No newline at end of file +var _0x4b08=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','multer','util'];(function(_0x5e2d0b,_0xc52482){var _0x3d84d9=function(_0x2e326e){while(--_0x2e326e){_0x5e2d0b['push'](_0x5e2d0b['shift']());}};_0x3d84d9(++_0xc52482);}(_0x4b08,0x112));var _0x84b0=function(_0x9068a1,_0x1db890){_0x9068a1=_0x9068a1-0x0;var _0xa396b8=_0x4b08[_0x9068a1];return _0xa396b8;};'use strict';var multer=require(_0x84b0('0x0'));var util=require(_0x84b0('0x1'));var path=require(_0x84b0('0x2'));var timeout=require(_0x84b0('0x3'));var express=require(_0x84b0('0x4'));var router=express['Router']();var auth=require(_0x84b0('0x5'));var interaction=require(_0x84b0('0x6'));var config=require(_0x84b0('0x7'));var controller=require('./action.controller');router[_0x84b0('0x8')]('/:id',auth[_0x84b0('0x9')](),controller[_0x84b0('0xa')]);router[_0x84b0('0xb')]('/:id',auth[_0x84b0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e1f5726..f3f89eb 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 _0xa93e=['STRING','TEXT','sequelize'];(function(_0x538124,_0x345055){var _0x5b43c3=function(_0x9bef80){while(--_0x9bef80){_0x538124['push'](_0x538124['shift']());}};_0x5b43c3(++_0x345055);}(_0xa93e,0x12b));var _0xea93=function(_0x153d1b,_0x19b066){_0x153d1b=_0x153d1b-0x0;var _0x43e1dc=_0xa93e[_0x153d1b];return _0x43e1dc;};'use strict';var Sequelize=require(_0xea93('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xea93('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xea93('0x2')]},'joins':{'type':Sequelize[_0xea93('0x2')]}}; \ No newline at end of file +var _0x72a9=['STRING','TEXT','sequelize'];(function(_0x40c488,_0x5abea5){var _0x526b6=function(_0x162552){while(--_0x162552){_0x40c488['push'](_0x40c488['shift']());}};_0x526b6(++_0x5abea5);}(_0x72a9,0x113));var _0x972a=function(_0x10c8ed,_0x321b59){_0x10c8ed=_0x10c8ed-0x0;var _0x2dbe22=_0x72a9[_0x10c8ed];return _0x2dbe22;};'use strict';var Sequelize=require(_0x972a('0x0'));module['exports']={'name':{'type':Sequelize[_0x972a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x972a('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x972a('0x2')]},'joins':{'type':Sequelize[_0x972a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b11d5d2..c6f39b8 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 _0x26c6=['name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','preview','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%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\x20EMPTY','rules','operator','group','field','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','ValidationErrorItem','DESC','SELECT','No\x20available\x20data','output','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','dbH','status','end','json','count','limit','Content-Range','reject','save','then','CustomReports','UserProfileResource','error','stack'];(function(_0x294de8,_0x56ca77){var _0x2914e5=function(_0x2338a2){while(--_0x2338a2){_0x294de8['push'](_0x294de8['shift']());}};_0x2914e5(++_0x56ca77);}(_0x26c6,0x128));var _0x626c=function(_0x2cb89c,_0x2fd266){_0x2cb89c=_0x2cb89c-0x0;var _0x366213=_0x26c6[_0x2cb89c];return _0x366213;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x626c('0x0'));var rimraf=require(_0x626c('0x1'));var zipdir=require(_0x626c('0x2'));var jsonpatch=require(_0x626c('0x3'));var rp=require('request-promise');var moment=require(_0x626c('0x4'));var BPromise=require(_0x626c('0x5'));var Mustache=require(_0x626c('0x6'));var util=require(_0x626c('0x7'));var path=require(_0x626c('0x8'));var sox=require(_0x626c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x626c('0xa'));var crypto=require(_0x626c('0xb'));var jsforce=require(_0x626c('0xc'));var deskjs=require(_0x626c('0xd'));var toCsv=require(_0x626c('0xe'));var querystring=require(_0x626c('0xf'));var Papa=require(_0x626c('0x10'));var Redis=require(_0x626c('0x11'));var authService=require(_0x626c('0x12'));var qs=require(_0x626c('0x13'));var as=require(_0x626c('0x14'));var hardwareService=require(_0x626c('0x15'));var logger=require(_0x626c('0x16'))(_0x626c('0x17'));var utils=require(_0x626c('0x18'));var config=require(_0x626c('0x19'));var licenseUtil=require(_0x626c('0x1a'));var db=require(_0x626c('0x1b'))['db'];var dbH=require(_0x626c('0x1b'))[_0x626c('0x1c')];function respondWithStatusCode(_0x34005f,_0x55d748){_0x55d748=_0x55d748||0xcc;return function(_0x29c73d){if(_0x29c73d){return _0x34005f['sendStatus'](_0x55d748);}return _0x34005f[_0x626c('0x1d')](_0x55d748)[_0x626c('0x1e')]();};}function respondWithResult(_0x4cc04d,_0x1a79bb){_0x1a79bb=_0x1a79bb||0xc8;return function(_0x2f2d81){if(_0x2f2d81){return _0x4cc04d[_0x626c('0x1d')](_0x1a79bb)[_0x626c('0x1f')](_0x2f2d81);}};}function respondWithFilteredResult(_0x4c5d8b,_0x75c4bb){return function(_0x98e3c){if(_0x98e3c){var _0x29f5f6=_0x98e3c[_0x626c('0x20')],_0x47a8c4=_0x75c4bb['offset'],_0x5cbb36=_0x75c4bb['offset']+_0x75c4bb[_0x626c('0x21')],_0x2bfa2c;if(_0x5cbb36>=_0x29f5f6){_0x5cbb36=_0x29f5f6;_0x2bfa2c=0xc8;}else{_0x2bfa2c=0xce;}_0x4c5d8b[_0x626c('0x1d')](_0x2bfa2c);return _0x4c5d8b['set'](_0x626c('0x22'),_0x47a8c4+'-'+_0x5cbb36+'/'+_0x29f5f6)[_0x626c('0x1f')](_0x98e3c);}return null;};}function patchUpdates(_0x24e98e){return function(_0xec3cef){try{jsonpatch['apply'](_0xec3cef,_0x24e98e,!![]);}catch(_0x46dfaa){return BPromise[_0x626c('0x23')](_0x46dfaa);}return _0xec3cef[_0x626c('0x24')]();};}function saveUpdates(_0x3267ff,_0x3218f9){return function(_0x558789){if(_0x558789){return _0x558789['update'](_0x3267ff)[_0x626c('0x25')](function(_0x3a7faa){return _0x3a7faa;});}return null;};}function removeEntity(_0x200dde,_0x2500db){return function(_0x4eea75){if(_0x4eea75){return _0x4eea75['destroy']()[_0x626c('0x25')](function(){var _0x1f652b=_0x4eea75['get']({'plain':!![]});var _0x217fdc=_0x626c('0x26');return db[_0x626c('0x27')]['destroy']({'where':{'type':_0x217fdc,'resourceId':_0x1f652b['id']}})[_0x626c('0x25')](function(){return _0x4eea75;});})[_0x626c('0x25')](function(){_0x200dde['status'](0xcc)[_0x626c('0x1e')]();});}};}function handleEntityNotFound(_0x3f3444,_0x92e344){return function(_0x783b43){if(!_0x783b43){_0x3f3444['sendStatus'](0x194);}return _0x783b43;};}function handleError(_0x4601f1,_0x15fdfd){_0x15fdfd=_0x15fdfd||0x1f4;return function(_0x402398){logger[_0x626c('0x28')](_0x402398[_0x626c('0x29')]);if(_0x402398[_0x626c('0x2a')]){delete _0x402398[_0x626c('0x2a')];}_0x4601f1[_0x626c('0x1d')](_0x15fdfd)[_0x626c('0x2b')](_0x402398);};}exports[_0x626c('0x2c')]=function(_0x2434b9,_0xbf2418){var _0x50dfff={},_0x34e593={},_0xa1b61={'count':0x0,'rows':[]};var _0xf9dbaf=_['map'](db[_0x626c('0x2d')][_0x626c('0x2e')],function(_0xd03be7){return{'name':_0xd03be7[_0x626c('0x2f')],'type':_0xd03be7[_0x626c('0x30')][_0x626c('0x31')]};});_0x34e593[_0x626c('0x32')]=_[_0x626c('0x33')](_0xf9dbaf,_0x626c('0x2a'));_0x34e593[_0x626c('0x34')]=_[_0x626c('0x35')](_0x2434b9[_0x626c('0x34')]);_0x34e593[_0x626c('0x36')]=_[_0x626c('0x37')](_0x34e593[_0x626c('0x32')],_0x34e593[_0x626c('0x34')]);_0x50dfff[_0x626c('0x38')]=_[_0x626c('0x37')](_0x34e593[_0x626c('0x32')],qs[_0x626c('0x39')](_0x2434b9[_0x626c('0x34')]['fields']));_0x50dfff[_0x626c('0x38')]=_0x50dfff[_0x626c('0x38')][_0x626c('0x3a')]?_0x50dfff['attributes']:_0x34e593[_0x626c('0x32')];if(!_0x2434b9[_0x626c('0x34')][_0x626c('0x3b')](_0x626c('0x3c'))){_0x50dfff[_0x626c('0x21')]=qs['limit'](_0x2434b9['query'][_0x626c('0x21')]);_0x50dfff[_0x626c('0x3d')]=qs[_0x626c('0x3d')](_0x2434b9[_0x626c('0x34')][_0x626c('0x3d')]);}_0x50dfff[_0x626c('0x3e')]=qs['sort'](_0x2434b9[_0x626c('0x34')]['sort']);_0x50dfff[_0x626c('0x3f')]=qs[_0x626c('0x36')](_[_0x626c('0x40')](_0x2434b9[_0x626c('0x34')],_0x34e593[_0x626c('0x36')]),_0xf9dbaf);if(_0x2434b9[_0x626c('0x34')][_0x626c('0x41')]){_0x50dfff['where']=_[_0x626c('0x42')](_0x50dfff[_0x626c('0x3f')],{'$or':_[_0x626c('0x33')](_0xf9dbaf,function(_0x68fa7a){if(_0x68fa7a[_0x626c('0x30')]!==_0x626c('0x43')){var _0x5e7f8e={};_0x5e7f8e[_0x68fa7a['name']]={'$like':'%'+_0x2434b9[_0x626c('0x34')][_0x626c('0x41')]+'%'};return _0x5e7f8e;}})});}_0x50dfff=_[_0x626c('0x42')]({},_0x50dfff,_0x2434b9['options']);var _0x4fecec={'where':_0x50dfff['where']};return db[_0x626c('0x2d')]['count'](_0x4fecec)[_0x626c('0x25')](function(_0x283240){_0xa1b61[_0x626c('0x20')]=_0x283240;if(_0x2434b9[_0x626c('0x34')][_0x626c('0x44')]){_0x50dfff['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x50dfff);})[_0x626c('0x25')](function(_0x5ac5a2){_0xa1b61[_0x626c('0x45')]=_0x5ac5a2;return _0xa1b61;})[_0x626c('0x25')](respondWithFilteredResult(_0xbf2418,_0x50dfff))[_0x626c('0x46')](handleError(_0xbf2418,null));};exports['show']=function(_0x805cae,_0x20440d){var _0x587a6a={'raw':![],'where':{'id':_0x805cae[_0x626c('0x47')]['id']}},_0x4a4055={};_0x4a4055['model']=_[_0x626c('0x35')](db[_0x626c('0x2d')]['rawAttributes']);_0x4a4055['query']=_[_0x626c('0x35')](_0x805cae[_0x626c('0x34')]);_0x4a4055['filters']=_['intersection'](_0x4a4055[_0x626c('0x32')],_0x4a4055['query']);_0x587a6a[_0x626c('0x38')]=_[_0x626c('0x37')](_0x4a4055['model'],qs[_0x626c('0x39')](_0x805cae[_0x626c('0x34')]['fields']));_0x587a6a[_0x626c('0x38')]=_0x587a6a[_0x626c('0x38')][_0x626c('0x3a')]?_0x587a6a[_0x626c('0x38')]:_0x4a4055[_0x626c('0x32')];if(_0x805cae[_0x626c('0x34')][_0x626c('0x44')]){_0x587a6a[_0x626c('0x48')]=[{'all':!![]}];}_0x587a6a=_['merge']({},_0x587a6a,_0x805cae['options']);return db[_0x626c('0x2d')][_0x626c('0x49')](_0x587a6a)[_0x626c('0x25')](handleEntityNotFound(_0x20440d,null))[_0x626c('0x25')](respondWithResult(_0x20440d,null))[_0x626c('0x46')](handleError(_0x20440d,null));};exports[_0x626c('0x4a')]=function(_0x49e94c,_0x17ca1f){return db[_0x626c('0x2d')][_0x626c('0x4a')](_0x49e94c[_0x626c('0x4b')],{})[_0x626c('0x25')](function(_0x3292ed){var _0x48dd48=_0x49e94c[_0x626c('0x4c')][_0x626c('0x4d')]({'plain':!![]});if(!_0x48dd48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48dd48[_0x626c('0x4e')]===_0x626c('0x4c')){var _0x207c78=_0x3292ed['get']({'plain':!![]});var _0x82de15='Reports';return db[_0x626c('0x4f')][_0x626c('0x49')]({'where':{'name':_0x82de15,'userProfileId':_0x48dd48['userProfileId']},'raw':!![]})[_0x626c('0x25')](function(_0x40c03d){if(_0x40c03d&&_0x40c03d[_0x626c('0x50')]===0x0){return db[_0x626c('0x27')][_0x626c('0x4a')]({'name':_0x207c78[_0x626c('0x2a')],'resourceId':_0x207c78['id'],'type':_0x626c('0x26'),'sectionId':_0x40c03d['id']},{})[_0x626c('0x25')](function(){return _0x3292ed;});}else{return _0x3292ed;}})[_0x626c('0x46')](function(_0xf4833d){logger[_0x626c('0x28')](_0x626c('0x51'),_0xf4833d);throw _0xf4833d;});}return _0x3292ed;})['then'](respondWithResult(_0x17ca1f,0xc9))['catch'](handleError(_0x17ca1f,null));};exports[_0x626c('0x52')]=function(_0x22337a,_0x49cacf){if(_0x22337a[_0x626c('0x4b')]['id']){delete _0x22337a[_0x626c('0x4b')]['id'];}return db[_0x626c('0x2d')][_0x626c('0x49')]({'where':{'id':_0x22337a[_0x626c('0x47')]['id']}})[_0x626c('0x25')](handleEntityNotFound(_0x49cacf,null))[_0x626c('0x25')](saveUpdates(_0x22337a[_0x626c('0x4b')],null))[_0x626c('0x25')](respondWithResult(_0x49cacf,null))[_0x626c('0x46')](handleError(_0x49cacf,null));};exports[_0x626c('0x53')]=function(_0xa4e9cc,_0x361b6b){return db['AnalyticCustomReport'][_0x626c('0x49')]({'where':{'id':_0xa4e9cc['params']['id']}})[_0x626c('0x25')](handleEntityNotFound(_0x361b6b,null))['then'](removeEntity(_0x361b6b,null))[_0x626c('0x46')](handleError(_0x361b6b,null));};exports[_0x626c('0x54')]=function(_0x4d8d48,_0x28b59a){var _0x41c3e9=0xa;var _0x335ff1=['join',_0x626c('0x55'),_0x626c('0x56'),'cross_join'];var _0x3fe6a1={'SUM':_0x626c('0x57'),'COUNT':_0x626c('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x626c('0x59'),'MIN':_0x626c('0x5a'),'AVG':_0x626c('0x5b'),'GROUP_CONCAT':_0x626c('0x5c'),'GROUP_CONCAT ASC':_0x626c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x516319={'SEC_TO_TIME':_0x626c('0x5e'),'DATE':_0x626c('0x5f'),'HOUR':_0x626c('0x60'),'ROUND':_0x626c('0x61'),'UNIX_TIMESTAMP':_0x626c('0x62')};var _0x32a315=function(_0x2759cb){return!_[_0x626c('0x63')]([_0x626c('0x64'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x626c('0x65')],_0x2759cb);};var _0x1ef07b=function(_0x5d1c04){if(!_0x5d1c04||!_0x5d1c04[_0x626c('0x66')][_0x626c('0x3a')]){return'';}for(var _0x2e2445='(',_0x630cb8=0x0;_0x630cb8<_0x5d1c04[_0x626c('0x66')][_0x626c('0x3a')];_0x630cb8+=0x1){_0x630cb8>0x0&&(_0x2e2445+='\x20'+_0x5d1c04[_0x626c('0x67')]+'\x20');_0x2e2445+=_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x68')]?_0x1ef07b(_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x68')]):_0x5d1c04['rules'][_0x630cb8][_0x626c('0x69')]+'\x20'+_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x6a')]+(_0x32a315(_0x5d1c04[_0x626c('0x66')][_0x630cb8][_0x626c('0x6a')])?'\x20'+_0x5d1c04['rules'][_0x630cb8][_0x626c('0x6b')]:'');}return _0x2e2445+')';};var _0xa1256b={'where':{'id':_0x4d8d48[_0x626c('0x47')]['id']}},_0x2dee6e,_0x3a4b75,_0x377904,_0x47026d,_0x7dea60;_0xa1256b=_[_0x626c('0x42')]({},_0xa1256b,_0x4d8d48[_0x626c('0x6c')]);return db[_0x626c('0x2d')][_0x626c('0x49')](_0xa1256b)[_0x626c('0x25')](function(_0x2b157a){if(_0x2b157a){_0x2dee6e=_0x2b157a;return _0x2b157a[_0x626c('0x6d')]();}return null;})[_0x626c('0x25')](function(_0x3e49e0){if(_0x3e49e0){if(!_0x3e49e0[_0x626c('0x3a')]){throw new db[(_0x626c('0x6e'))]['ValidationErrorItem'](_0x626c('0x6f'),0x193);}_0x3a4b75=_0x3e49e0;return db[_0x626c('0x70')][_0x626c('0x71')]({'raw':!![]});}return null;})[_0x626c('0x25')](function(_0xc41e0e){if(_0xc41e0e){_0x377904=_[_0x626c('0x72')](_0xc41e0e,'id');var _0x1e8a31;var _0x198597=squel[_0x626c('0x73')]();_0x198597[_0x626c('0x74')](_0x2dee6e[_0x626c('0x75')]);for(var _0x43fd90=0x0;_0x43fd90<_0x3a4b75[_0x626c('0x3a')];_0x43fd90+=0x1){_0x1e8a31=_0x3a4b75[_0x43fd90][_0x626c('0x76')]?_0x377904[_0x3a4b75[_0x43fd90]['MetricId']][_0x626c('0x77')]:_0x3a4b75[_0x43fd90][_0x626c('0x69')];_0x1e8a31=_0x3a4b75[_0x43fd90][_0x626c('0x78')]?_['replace'](_0x3fe6a1[_0x3a4b75[_0x43fd90][_0x626c('0x78')]],'%s',_0x1e8a31):_0x1e8a31;_0x1e8a31=_0x3a4b75[_0x43fd90][_0x626c('0x79')]?_[_0x626c('0x7a')](_0x516319[_0x3a4b75[_0x43fd90][_0x626c('0x79')]],'%s',_0x1e8a31):_0x1e8a31;if(_0x3a4b75[_0x43fd90][_0x626c('0x7b')]){_0x198597[_0x626c('0x68')](_0x1e8a31);}_0x3a4b75[_0x43fd90][_0x626c('0x7c')]&&_0x198597[_0x626c('0x3e')](_0x1e8a31,_0x3a4b75[_0x43fd90][_0x626c('0x7c')]==='DESC'?![]:!![]);_0x198597[_0x626c('0x69')](_0x1e8a31,_0x3a4b75[_0x43fd90][_0x626c('0x7d')]||_0x1e8a31);}if(_0x2dee6e['joins']){_0x2dee6e[_0x626c('0x7e')]=JSON[_0x626c('0x7f')](_0x2dee6e[_0x626c('0x7e')]);for(var _0xd8a682=0x0;_0xd8a682<_0x2dee6e[_0x626c('0x7e')][_0x626c('0x3a')];_0xd8a682+=0x1){if(_0x2dee6e[_0x626c('0x7e')][_0xd8a682]['type']&&_[_0x626c('0x63')](_0x335ff1,_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x30')])&&_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x80')]&&_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x81')]&&_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x82')]){_0x198597[_0x2dee6e['joins'][_0xd8a682]['type']](_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x81')],null,util[_0x626c('0x79')](_0x626c('0x83'),_0x2dee6e[_0x626c('0x75')],_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x80')],_0x2dee6e[_0x626c('0x7e')][_0xd8a682]['foreignTable'],_0x2dee6e[_0x626c('0x7e')][_0xd8a682][_0x626c('0x82')]));}}}if(_0x2dee6e[_0x626c('0x84')]){_0x2dee6e[_0x626c('0x84')]=JSON[_0x626c('0x7f')](_0x2dee6e[_0x626c('0x84')]);_0x198597['where'](_0x1ef07b(_0x2dee6e[_0x626c('0x84')][_0x626c('0x68')]));}_0x7dea60=_0x198597[_0x626c('0x85')]();_0x198597[_0x626c('0x21')](_0x41c3e9);_0x198597[_0x626c('0x3d')](0x0);logger[_0x626c('0x86')](_0x626c('0x87'),_0x198597[_0x626c('0x88')]());return db['sequelize']['query'](_0x198597[_0x626c('0x88')](),{'type':db[_0x626c('0x89')][_0x626c('0x8a')]['SELECT']});}})['then'](respondWithResult(_0x28b59a,null))['catch'](handleError(_0x28b59a,null));};function runReport(_0x39e6f7,_0x57d838,_0x229b8c){var _0x2814c6=_0x57d838[_0x626c('0x2a')];var _0xd17036=0xa;var _0x14683b=[_0x626c('0x8b'),'left_join',_0x626c('0x56'),'cross_join'];var _0x594a76={'SUM':_0x626c('0x57'),'COUNT':_0x626c('0x58'),'COUNT DISTINCT':_0x626c('0x8c'),'MAX':_0x626c('0x59'),'MIN':_0x626c('0x5a'),'AVG':_0x626c('0x5b'),'GROUP_CONCAT':_0x626c('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3c01fe={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x626c('0x60'),'ROUND':_0x626c('0x61'),'UNIX_TIMESTAMP':_0x626c('0x62')};var _0x182f27=function(_0x496bee){return!_[_0x626c('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x626c('0x8d'),_0x626c('0x65')],_0x496bee);};var _0x517987=function(_0x4a8a46){if(!_0x4a8a46||!_0x4a8a46[_0x626c('0x66')][_0x626c('0x3a')]){return'';}for(var _0x18ebd6='(',_0x58928=0x0;_0x58928<_0x4a8a46[_0x626c('0x66')][_0x626c('0x3a')];_0x58928+=0x1){_0x58928>0x0&&(_0x18ebd6+='\x20'+_0x4a8a46[_0x626c('0x67')]+'\x20');_0x18ebd6+=_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x68')]?_0x517987(_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x68')]):_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x69')]+'\x20'+_0x4a8a46[_0x626c('0x66')][_0x58928]['condition']+(_0x182f27(_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x6a')])?'\x20'+_0x4a8a46[_0x626c('0x66')][_0x58928][_0x626c('0x6b')]:'');}return _0x18ebd6+')';};var _0x15f04d={'where':{'id':_0x39e6f7['id']}},_0x5b0d72,_0x1c24f2,_0xc2771d,_0x3a904a,_0x1728c5;_0x15f04d=_[_0x626c('0x42')]({},_0x15f04d,_0x229b8c);return db[_0x626c('0x2d')][_0x626c('0x49')](_0x15f04d)['then'](function(_0x5777bb){if(_0x5777bb){_0x5b0d72=_0x5777bb;return _0x5777bb[_0x626c('0x6d')]();}return null;})[_0x626c('0x25')](function(_0x4c1ce8){if(_0x4c1ce8){if(!_0x4c1ce8['length']){throw new db[(_0x626c('0x6e'))][(_0x626c('0x8e'))](_0x626c('0x6f'),0x193);}_0x1c24f2=_0x4c1ce8;return db[_0x626c('0x70')][_0x626c('0x71')]({'raw':!![]});}return null;})[_0x626c('0x25')](function(_0x42f03b){if(_0x42f03b){_0xc2771d=_[_0x626c('0x72')](_0x42f03b,'id');var _0x3a933c;var _0x397054=squel[_0x626c('0x73')]();_0x397054[_0x626c('0x74')](_0x5b0d72[_0x626c('0x75')]);for(var _0x3e3505=0x0;_0x3e3505<_0x1c24f2[_0x626c('0x3a')];_0x3e3505+=0x1){_0x3a933c=_0x1c24f2[_0x3e3505][_0x626c('0x76')]?_0xc2771d[_0x1c24f2[_0x3e3505][_0x626c('0x76')]]['metric']:_0x1c24f2[_0x3e3505][_0x626c('0x69')];_0x3a933c=_0x1c24f2[_0x3e3505][_0x626c('0x78')]?_[_0x626c('0x7a')](_0x594a76[_0x1c24f2[_0x3e3505]['function']],'%s',_0x3a933c):_0x3a933c;_0x3a933c=_0x1c24f2[_0x3e3505][_0x626c('0x79')]?_[_0x626c('0x7a')](_0x3c01fe[_0x1c24f2[_0x3e3505]['format']],'%s',_0x3a933c):_0x3a933c;if(_0x1c24f2[_0x3e3505][_0x626c('0x7b')]){_0x397054[_0x626c('0x68')](_0x3a933c);}_0x1c24f2[_0x3e3505][_0x626c('0x7c')]&&_0x397054['order'](_0x3a933c,_0x1c24f2[_0x3e3505]['orderBy']===_0x626c('0x8f')?![]:!![]);_0x397054[_0x626c('0x69')](_0x3a933c,_0x1c24f2[_0x3e3505][_0x626c('0x7d')]||_0x3a933c);}if(_0x5b0d72[_0x626c('0x7e')]){_0x5b0d72[_0x626c('0x7e')]=JSON[_0x626c('0x7f')](_0x5b0d72[_0x626c('0x7e')]);for(var _0x1c994f=0x0;_0x1c994f<_0x5b0d72[_0x626c('0x7e')][_0x626c('0x3a')];_0x1c994f+=0x1){if(_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x30')]&&_['includes'](_0x14683b,_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x30')])&&_0x5b0d72['joins'][_0x1c994f][_0x626c('0x80')]&&_0x5b0d72[_0x626c('0x7e')][_0x1c994f]['foreignTable']&&_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x82')]){_0x397054[_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x30')]](_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x81')],null,util[_0x626c('0x79')](_0x626c('0x83'),_0x5b0d72['table'],_0x5b0d72['joins'][_0x1c994f][_0x626c('0x80')],_0x5b0d72[_0x626c('0x7e')][_0x1c994f][_0x626c('0x81')],_0x5b0d72['joins'][_0x1c994f][_0x626c('0x82')]));}}}if(_0x5b0d72[_0x626c('0x84')]){_0x5b0d72['conditions']=JSON[_0x626c('0x7f')](_0x5b0d72[_0x626c('0x84')]);_0x397054[_0x626c('0x3f')](_0x517987(_0x5b0d72['conditions'][_0x626c('0x68')]));}_0x1728c5=_0x397054[_0x626c('0x85')]();_0x397054[_0x626c('0x21')](_0xd17036);_0x397054['offset'](0x0);logger[_0x626c('0x86')](_0x626c('0x87'),_0x397054['toString']());return db[_0x626c('0x89')][_0x626c('0x34')](_0x397054[_0x626c('0x88')](),{'type':db['sequelize'][_0x626c('0x8a')][_0x626c('0x90')]});}})[_0x626c('0x25')](function(_0x40b37e){if(!_0x40b37e['length']){throw new db[(_0x626c('0x6e'))][(_0x626c('0x8e'))](_0x626c('0x91'),0xcc);}if(_0x57d838[_0x626c('0x92')]==='web'){return null;}var _0x390d57=_[_0x626c('0x42')](_0x57d838,{'name':_0x57d838['fullPath']||_0x57d838['name']||_0x5b0d72['name'],'basename':_0x2814c6,'savename':util[_0x626c('0x79')](_0x626c('0x93'),_0x57d838[_0x626c('0x2a')]||_0x5b0d72['name'],require(_0x626c('0x94'))[_0x626c('0x95')](0x4),_0x57d838['output']||_0x626c('0x96')),'reportId':_0x5b0d72['id'],'reportType':_0x626c('0x97')});return db[_0x626c('0x98')][_0x626c('0x4a')](_0x390d57,{'raw':!![]});})[_0x626c('0x25')](function(_0x49d8fe){if(_0x5b0d72[_0x626c('0x75')]===_0x626c('0x99')){_0x1728c5['where'](_0x5b0d72[_0x626c('0x75')]+_0x626c('0x9a'),_0x57d838[_0x626c('0x9b')],_0x57d838[_0x626c('0x9c')]);}else{_0x1728c5[_0x626c('0x3f')](_0x5b0d72['table']+_0x626c('0x9d'),_0x57d838[_0x626c('0x9b')],_0x57d838[_0x626c('0x9c')]);}if(_0x49d8fe){logger[_0x626c('0x9e')](_0x626c('0x9f'),_0x1728c5['toString']());require('child_process')[_0x626c('0xa0')](path[_0x626c('0x8b')](__dirname,_0x626c('0xa1'),_0x49d8fe['output']),[_0x49d8fe['id'],_0x1728c5[_0x626c('0x88')](),path[_0x626c('0x8b')](__dirname,_0x626c('0xa2'),_0x49d8fe[_0x626c('0xa3')]),_0x2814c6]);return _0x49d8fe;}else{var _0x4ff0cc=squel[_0x626c('0x73')]();_0x4ff0cc[_0x626c('0x74')]('('+_0x1728c5[_0x626c('0x88')]()+')','countTable');_0x4ff0cc[_0x626c('0x69')](_0x626c('0xa4'),_0x626c('0x20'));_0x1728c5[_0x626c('0x21')](_0x57d838[_0x626c('0x21')]||_0xd17036);_0x1728c5[_0x626c('0x3d')](_0x57d838[_0x626c('0x3d')]||0x0);return dbH[_0x626c('0x89')][_0x626c('0x34')](_0x4ff0cc[_0x626c('0x88')](),{'type':dbH['sequelize'][_0x626c('0x8a')][_0x626c('0x90')]})[_0x626c('0x25')](function(_0x4c2fd7){if(!_0x4c2fd7[_0x626c('0x3a')]){_0x3a904a=0x0;}else{_0x3a904a=_0x4c2fd7[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x1728c5[_0x626c('0x88')](),{'type':dbH[_0x626c('0x89')][_0x626c('0x8a')][_0x626c('0x90')]});})['then'](function(_0x4bd54e){return{'rows':_0x4bd54e||[],'count':_0x3a904a};});}});}exports[_0x626c('0xa5')]=function(_0x270626,_0x5cc5ad){return runReport(_0x270626[_0x626c('0x47')],_0x270626[_0x626c('0x34')],_0x270626[_0x626c('0x6c')])[_0x626c('0x25')](respondWithResult(_0x5cc5ad,null))[_0x626c('0x46')](handleError(_0x5cc5ad,null));};exports[_0x626c('0xa6')]=runReport;exports[_0x626c('0x34')]=function(_0x583f30,_0x1c071c){var _0x5dcb62=0xa;var _0x3b4d45=[_0x626c('0x8b'),_0x626c('0x55'),_0x626c('0x56'),_0x626c('0xa7')];var _0x1fa9f5={'SUM':_0x626c('0x57'),'COUNT':_0x626c('0x58'),'COUNT DISTINCT':_0x626c('0x8c'),'MAX':_0x626c('0x59'),'MIN':_0x626c('0x5a'),'AVG':_0x626c('0x5b'),'GROUP_CONCAT':_0x626c('0x5c'),'GROUP_CONCAT ASC':_0x626c('0x5d'),'GROUP_CONCAT DESC':_0x626c('0xa8')};var _0x48c5df={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x626c('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x626c('0x61'),'UNIX_TIMESTAMP':_0x626c('0x62')};var _0x12175b=function(_0x4df3b9){return!_[_0x626c('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4df3b9);};var _0x486d2b=function(_0x1416d9){if(!_0x1416d9||!_0x1416d9[_0x626c('0x66')][_0x626c('0x3a')]){return'';}for(var _0x3df467='(',_0xb71e6b=0x0;_0xb71e6b<_0x1416d9['rules'][_0x626c('0x3a')];_0xb71e6b+=0x1){_0xb71e6b>0x0&&(_0x3df467+='\x20'+_0x1416d9['operator']+'\x20');_0x3df467+=_0x1416d9['rules'][_0xb71e6b][_0x626c('0x68')]?_0x486d2b(_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x68')]):_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x69')]+'\x20'+_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x6a')]+(_0x12175b(_0x1416d9[_0x626c('0x66')][_0xb71e6b][_0x626c('0x6a')])?'\x20'+_0x1416d9[_0x626c('0x66')][_0xb71e6b]['value']:'');}return _0x3df467+')';};var _0xa043fa={'where':{'id':_0x583f30[_0x626c('0x47')]['id']}},_0x134e16,_0x507f39,_0x34ae15,_0x3c2a7c,_0x3474a0;_0xa043fa=_['merge']({},_0xa043fa,_0x583f30[_0x626c('0x6c')]);return db['AnalyticCustomReport'][_0x626c('0x49')](_0xa043fa)[_0x626c('0x25')](function(_0x216de4){if(_0x216de4){_0x134e16=_0x216de4;return _0x216de4[_0x626c('0x6d')]();}return null;})[_0x626c('0x25')](function(_0x52634d){if(_0x52634d){if(!_0x52634d[_0x626c('0x3a')]){throw new db[(_0x626c('0x6e'))][(_0x626c('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x507f39=_0x52634d;return db[_0x626c('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x873998){if(_0x873998){_0x34ae15=_[_0x626c('0x72')](_0x873998,'id');var _0x24eb8d;var _0x185038=squel['select']();_0x185038[_0x626c('0x74')](_0x134e16['table']);for(var _0x30b94b=0x0;_0x30b94b<_0x507f39[_0x626c('0x3a')];_0x30b94b+=0x1){_0x24eb8d=_0x507f39[_0x30b94b]['MetricId']?_0x34ae15[_0x507f39[_0x30b94b]['MetricId']][_0x626c('0x77')]:_0x507f39[_0x30b94b]['field'];_0x24eb8d=_0x507f39[_0x30b94b][_0x626c('0x78')]?_['replace'](_0x1fa9f5[_0x507f39[_0x30b94b]['function']],'%s',_0x24eb8d):_0x24eb8d;_0x24eb8d=_0x507f39[_0x30b94b][_0x626c('0x79')]?_[_0x626c('0x7a')](_0x48c5df[_0x507f39[_0x30b94b][_0x626c('0x79')]],'%s',_0x24eb8d):_0x24eb8d;if(_0x507f39[_0x30b94b][_0x626c('0x7b')]){_0x185038[_0x626c('0x68')](_0x24eb8d);}_0x507f39[_0x30b94b][_0x626c('0x7c')]&&_0x185038[_0x626c('0x3e')](_0x24eb8d,_0x507f39[_0x30b94b][_0x626c('0x7c')]===_0x626c('0x8f')?![]:!![]);_0x185038[_0x626c('0x69')](_0x24eb8d,_0x507f39[_0x30b94b][_0x626c('0x7d')]||_0x24eb8d);}if(_0x134e16[_0x626c('0x7e')]){_0x134e16[_0x626c('0x7e')]=JSON[_0x626c('0x7f')](_0x134e16['joins']);for(var _0x58534a=0x0;_0x58534a<_0x134e16[_0x626c('0x7e')]['length'];_0x58534a+=0x1){if(_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x30')]&&_[_0x626c('0x63')](_0x3b4d45,_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x30')])&&_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x80')]&&_0x134e16[_0x626c('0x7e')][_0x58534a]['foreignTable']&&_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x82')]){_0x185038[_0x134e16['joins'][_0x58534a][_0x626c('0x30')]](_0x134e16['joins'][_0x58534a][_0x626c('0x81')],null,util[_0x626c('0x79')](_0x626c('0x83'),_0x134e16[_0x626c('0x75')],_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x80')],_0x134e16['joins'][_0x58534a][_0x626c('0x81')],_0x134e16[_0x626c('0x7e')][_0x58534a][_0x626c('0x82')]));}}}if(_0x134e16[_0x626c('0x84')]){_0x134e16[_0x626c('0x84')]=JSON[_0x626c('0x7f')](_0x134e16[_0x626c('0x84')]);_0x185038[_0x626c('0x3f')](_0x486d2b(_0x134e16[_0x626c('0x84')][_0x626c('0x68')]));}_0x3474a0=_0x185038[_0x626c('0x85')]();_0x185038[_0x626c('0x21')](_0x5dcb62);_0x185038[_0x626c('0x3d')](0x0);logger[_0x626c('0x86')](_0x626c('0x87'),_0x185038[_0x626c('0x88')]());return db[_0x626c('0x89')]['query'](_0x185038[_0x626c('0x88')](),{'type':db[_0x626c('0x89')][_0x626c('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x3474a0[_0x626c('0x88')]()};})['then'](respondWithResult(_0x1c071c,null))[_0x626c('0x46')](handleError(_0x1c071c,null));}; \ No newline at end of file +var _0x0b99=['group','field','condition','value','getFields','ValidationErrorItem','findAll','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','DATE(%s)','AnalyticMetric','groupBy','parse','sequelize','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','rows','catch','show','params','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','preview','join','left_join','right_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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0x0b99,0xec));var _0x90b9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0b99[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x90b9('0x0'));var zipdir=require(_0x90b9('0x1'));var jsonpatch=require(_0x90b9('0x2'));var rp=require(_0x90b9('0x3'));var moment=require(_0x90b9('0x4'));var BPromise=require(_0x90b9('0x5'));var Mustache=require(_0x90b9('0x6'));var util=require(_0x90b9('0x7'));var path=require(_0x90b9('0x8'));var sox=require(_0x90b9('0x9'));var csv=require('to-csv');var ejs=require(_0x90b9('0xa'));var fs=require('fs');var _=require(_0x90b9('0xb'));var squel=require(_0x90b9('0xc'));var crypto=require(_0x90b9('0xd'));var jsforce=require(_0x90b9('0xe'));var deskjs=require(_0x90b9('0xf'));var toCsv=require(_0x90b9('0x10'));var querystring=require(_0x90b9('0x11'));var Papa=require(_0x90b9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x90b9('0x13'));var as=require(_0x90b9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90b9('0x15'));var utils=require(_0x90b9('0x16'));var config=require(_0x90b9('0x17'));var licenseUtil=require(_0x90b9('0x18'));var db=require(_0x90b9('0x19'))['db'];var dbH=require(_0x90b9('0x19'))[_0x90b9('0x1a')];function respondWithStatusCode(_0x5e7dcc,_0x33cbc7){_0x33cbc7=_0x33cbc7||0xcc;return function(_0x441e86){if(_0x441e86){return _0x5e7dcc[_0x90b9('0x1b')](_0x33cbc7);}return _0x5e7dcc[_0x90b9('0x1c')](_0x33cbc7)['end']();};}function respondWithResult(_0x51f30b,_0x2acee6){_0x2acee6=_0x2acee6||0xc8;return function(_0x53e18c){if(_0x53e18c){return _0x51f30b[_0x90b9('0x1c')](_0x2acee6)[_0x90b9('0x1d')](_0x53e18c);}};}function respondWithFilteredResult(_0x2eb656,_0x37d5f0){return function(_0x26a9e4){if(_0x26a9e4){var _0x12a0a5=_0x26a9e4[_0x90b9('0x1e')],_0x3faac5=_0x37d5f0[_0x90b9('0x1f')],_0xefcce4=_0x37d5f0[_0x90b9('0x1f')]+_0x37d5f0[_0x90b9('0x20')],_0x29b1fc;if(_0xefcce4>=_0x12a0a5){_0xefcce4=_0x12a0a5;_0x29b1fc=0xc8;}else{_0x29b1fc=0xce;}_0x2eb656[_0x90b9('0x1c')](_0x29b1fc);return _0x2eb656['set'](_0x90b9('0x21'),_0x3faac5+'-'+_0xefcce4+'/'+_0x12a0a5)[_0x90b9('0x1d')](_0x26a9e4);}return null;};}function patchUpdates(_0x39b8bd){return function(_0xecea63){try{jsonpatch[_0x90b9('0x22')](_0xecea63,_0x39b8bd,!![]);}catch(_0x420880){return BPromise[_0x90b9('0x23')](_0x420880);}return _0xecea63[_0x90b9('0x24')]();};}function saveUpdates(_0x98e59e,_0x5d75ce){return function(_0x5679f7){if(_0x5679f7){return _0x5679f7[_0x90b9('0x25')](_0x98e59e)[_0x90b9('0x26')](function(_0x26d7db){return _0x26d7db;});}return null;};}function removeEntity(_0x3b30c9,_0x491303){return function(_0x52bdde){if(_0x52bdde){return _0x52bdde[_0x90b9('0x27')]()['then'](function(){var _0x5f3760=_0x52bdde['get']({'plain':!![]});var _0x299c20=_0x90b9('0x28');return db[_0x90b9('0x29')]['destroy']({'where':{'type':_0x299c20,'resourceId':_0x5f3760['id']}})['then'](function(){return _0x52bdde;});})['then'](function(){_0x3b30c9[_0x90b9('0x1c')](0xcc)[_0x90b9('0x2a')]();});}};}function handleEntityNotFound(_0x3a0061,_0x38fcc2){return function(_0x3a99e6){if(!_0x3a99e6){_0x3a0061['sendStatus'](0x194);}return _0x3a99e6;};}function handleError(_0x18fe5a,_0x4ef0b9){_0x4ef0b9=_0x4ef0b9||0x1f4;return function(_0x4232eb){logger[_0x90b9('0x2b')](_0x4232eb[_0x90b9('0x2c')]);if(_0x4232eb['name']){delete _0x4232eb[_0x90b9('0x2d')];}_0x18fe5a['status'](_0x4ef0b9)[_0x90b9('0x2e')](_0x4232eb);};}exports[_0x90b9('0x2f')]=function(_0x162859,_0x88a7f5){var _0x5becd0={},_0x555d48={},_0x484192={'count':0x0,'rows':[]};var _0x43f6e0=_[_0x90b9('0x30')](db[_0x90b9('0x31')][_0x90b9('0x32')],function(_0x4690d8){return{'name':_0x4690d8[_0x90b9('0x33')],'type':_0x4690d8[_0x90b9('0x34')]['key']};});_0x555d48[_0x90b9('0x35')]=_[_0x90b9('0x30')](_0x43f6e0,'name');_0x555d48[_0x90b9('0x36')]=_[_0x90b9('0x37')](_0x162859[_0x90b9('0x36')]);_0x555d48['filters']=_[_0x90b9('0x38')](_0x555d48['model'],_0x555d48[_0x90b9('0x36')]);_0x5becd0[_0x90b9('0x39')]=_[_0x90b9('0x38')](_0x555d48['model'],qs[_0x90b9('0x3a')](_0x162859[_0x90b9('0x36')]['fields']));_0x5becd0[_0x90b9('0x39')]=_0x5becd0[_0x90b9('0x39')][_0x90b9('0x3b')]?_0x5becd0[_0x90b9('0x39')]:_0x555d48['model'];if(!_0x162859['query'][_0x90b9('0x3c')](_0x90b9('0x3d'))){_0x5becd0[_0x90b9('0x20')]=qs[_0x90b9('0x20')](_0x162859[_0x90b9('0x36')][_0x90b9('0x20')]);_0x5becd0['offset']=qs['offset'](_0x162859[_0x90b9('0x36')][_0x90b9('0x1f')]);}_0x5becd0['order']=qs[_0x90b9('0x3e')](_0x162859['query']['sort']);_0x5becd0['where']=qs[_0x90b9('0x3f')](_[_0x90b9('0x40')](_0x162859[_0x90b9('0x36')],_0x555d48[_0x90b9('0x3f')]),_0x43f6e0);if(_0x162859[_0x90b9('0x36')][_0x90b9('0x41')]){_0x5becd0[_0x90b9('0x42')]=_[_0x90b9('0x43')](_0x5becd0[_0x90b9('0x42')],{'$or':_[_0x90b9('0x30')](_0x43f6e0,function(_0xb5db1){if(_0xb5db1[_0x90b9('0x34')]!=='VIRTUAL'){var _0x2e607b={};_0x2e607b[_0xb5db1[_0x90b9('0x2d')]]={'$like':'%'+_0x162859['query'][_0x90b9('0x41')]+'%'};return _0x2e607b;}})});}_0x5becd0=_[_0x90b9('0x43')]({},_0x5becd0,_0x162859[_0x90b9('0x44')]);var _0x463daf={'where':_0x5becd0[_0x90b9('0x42')]};return db[_0x90b9('0x31')]['count'](_0x463daf)[_0x90b9('0x26')](function(_0x5398a1){_0x484192[_0x90b9('0x1e')]=_0x5398a1;if(_0x162859['query'][_0x90b9('0x45')]){_0x5becd0['include']=[{'all':!![]}];}return db[_0x90b9('0x31')]['findAll'](_0x5becd0);})[_0x90b9('0x26')](function(_0x1ff64d){_0x484192[_0x90b9('0x46')]=_0x1ff64d;return _0x484192;})[_0x90b9('0x26')](respondWithFilteredResult(_0x88a7f5,_0x5becd0))[_0x90b9('0x47')](handleError(_0x88a7f5,null));};exports[_0x90b9('0x48')]=function(_0x9144bd,_0x21f3fd){var _0x21268b={'raw':![],'where':{'id':_0x9144bd[_0x90b9('0x49')]['id']}},_0x2ac3ed={};_0x2ac3ed[_0x90b9('0x35')]=_[_0x90b9('0x37')](db['AnalyticCustomReport']['rawAttributes']);_0x2ac3ed['query']=_[_0x90b9('0x37')](_0x9144bd[_0x90b9('0x36')]);_0x2ac3ed['filters']=_[_0x90b9('0x38')](_0x2ac3ed[_0x90b9('0x35')],_0x2ac3ed[_0x90b9('0x36')]);_0x21268b['attributes']=_[_0x90b9('0x38')](_0x2ac3ed[_0x90b9('0x35')],qs[_0x90b9('0x3a')](_0x9144bd[_0x90b9('0x36')]['fields']));_0x21268b[_0x90b9('0x39')]=_0x21268b[_0x90b9('0x39')]['length']?_0x21268b[_0x90b9('0x39')]:_0x2ac3ed['model'];if(_0x9144bd[_0x90b9('0x36')][_0x90b9('0x45')]){_0x21268b[_0x90b9('0x4a')]=[{'all':!![]}];}_0x21268b=_['merge']({},_0x21268b,_0x9144bd[_0x90b9('0x44')]);return db[_0x90b9('0x31')]['find'](_0x21268b)['then'](handleEntityNotFound(_0x21f3fd,null))['then'](respondWithResult(_0x21f3fd,null))[_0x90b9('0x47')](handleError(_0x21f3fd,null));};exports[_0x90b9('0x4b')]=function(_0x5215b3,_0x10187f){return db[_0x90b9('0x31')]['create'](_0x5215b3['body'],{})[_0x90b9('0x26')](function(_0x122e7d){var _0xb4682=_0x5215b3['user'][_0x90b9('0x4c')]({'plain':!![]});if(!_0xb4682)throw new Error(_0x90b9('0x4d'));if(_0xb4682[_0x90b9('0x4e')]===_0x90b9('0x4f')){var _0x356702=_0x122e7d[_0x90b9('0x4c')]({'plain':!![]});var _0x406ede=_0x90b9('0x50');return db[_0x90b9('0x51')]['find']({'where':{'name':_0x406ede,'userProfileId':_0xb4682[_0x90b9('0x52')]},'raw':!![]})[_0x90b9('0x26')](function(_0x1138f3){if(_0x1138f3&&_0x1138f3[_0x90b9('0x53')]===0x0){return db[_0x90b9('0x29')][_0x90b9('0x4b')]({'name':_0x356702[_0x90b9('0x2d')],'resourceId':_0x356702['id'],'type':_0x90b9('0x28'),'sectionId':_0x1138f3['id']},{})[_0x90b9('0x26')](function(){return _0x122e7d;});}else{return _0x122e7d;}})[_0x90b9('0x47')](function(_0x22eb61){logger['error'](_0x90b9('0x54'),_0x22eb61);throw _0x22eb61;});}return _0x122e7d;})['then'](respondWithResult(_0x10187f,0xc9))[_0x90b9('0x47')](handleError(_0x10187f,null));};exports['update']=function(_0x4ee2a2,_0x5714db){if(_0x4ee2a2[_0x90b9('0x55')]['id']){delete _0x4ee2a2[_0x90b9('0x55')]['id'];}return db[_0x90b9('0x31')][_0x90b9('0x56')]({'where':{'id':_0x4ee2a2[_0x90b9('0x49')]['id']}})[_0x90b9('0x26')](handleEntityNotFound(_0x5714db,null))[_0x90b9('0x26')](saveUpdates(_0x4ee2a2[_0x90b9('0x55')],null))[_0x90b9('0x26')](respondWithResult(_0x5714db,null))[_0x90b9('0x47')](handleError(_0x5714db,null));};exports['destroy']=function(_0x46682e,_0x2fb1a4){return db[_0x90b9('0x31')]['find']({'where':{'id':_0x46682e[_0x90b9('0x49')]['id']}})[_0x90b9('0x26')](handleEntityNotFound(_0x2fb1a4,null))['then'](removeEntity(_0x2fb1a4,null))['catch'](handleError(_0x2fb1a4,null));};exports[_0x90b9('0x57')]=function(_0x344a4e,_0x9bac75){var _0x548477=0xa;var _0xb53dbd=[_0x90b9('0x58'),_0x90b9('0x59'),_0x90b9('0x5a'),_0x90b9('0x5b')];var _0x46242a={'SUM':_0x90b9('0x5c'),'COUNT':_0x90b9('0x5d'),'COUNT DISTINCT':_0x90b9('0x5e'),'MAX':_0x90b9('0x5f'),'MIN':_0x90b9('0x60'),'AVG':_0x90b9('0x61'),'GROUP_CONCAT':_0x90b9('0x62'),'GROUP_CONCAT ASC':_0x90b9('0x63'),'GROUP_CONCAT DESC':_0x90b9('0x64')};var _0x2bce79={'SEC_TO_TIME':_0x90b9('0x65'),'DATE':'DATE(%s)','HOUR':_0x90b9('0x66'),'ROUND':_0x90b9('0x67'),'UNIX_TIMESTAMP':_0x90b9('0x68')};var _0x429568=function(_0x40eab1){return!_[_0x90b9('0x69')]([_0x90b9('0x6a'),_0x90b9('0x6b'),_0x90b9('0x6c'),_0x90b9('0x6d')],_0x40eab1);};var _0x36a6b5=function(_0x5f4ac4){if(!_0x5f4ac4||!_0x5f4ac4[_0x90b9('0x6e')][_0x90b9('0x3b')]){return'';}for(var _0x3c4dce='(',_0x31812f=0x0;_0x31812f<_0x5f4ac4[_0x90b9('0x6e')][_0x90b9('0x3b')];_0x31812f+=0x1){_0x31812f>0x0&&(_0x3c4dce+='\x20'+_0x5f4ac4[_0x90b9('0x6f')]+'\x20');_0x3c4dce+=_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x70')]?_0x36a6b5(_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x70')]):_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x71')]+'\x20'+_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x72')]+(_0x429568(_0x5f4ac4['rules'][_0x31812f][_0x90b9('0x72')])?'\x20'+_0x5f4ac4[_0x90b9('0x6e')][_0x31812f][_0x90b9('0x73')]:'');}return _0x3c4dce+')';};var _0x257244={'where':{'id':_0x344a4e['params']['id']}},_0x31ff9e,_0x33542b,_0x22e02b,_0x3c6458,_0x363f07;_0x257244=_[_0x90b9('0x43')]({},_0x257244,_0x344a4e[_0x90b9('0x44')]);return db['AnalyticCustomReport'][_0x90b9('0x56')](_0x257244)[_0x90b9('0x26')](function(_0x73f464){if(_0x73f464){_0x31ff9e=_0x73f464;return _0x73f464[_0x90b9('0x74')]();}return null;})[_0x90b9('0x26')](function(_0xea473f){if(_0xea473f){if(!_0xea473f[_0x90b9('0x3b')]){throw new db['Sequelize'][(_0x90b9('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x33542b=_0xea473f;return db['AnalyticMetric'][_0x90b9('0x76')]({'raw':!![]});}return null;})[_0x90b9('0x26')](function(_0x1c1280){if(_0x1c1280){_0x22e02b=_['keyBy'](_0x1c1280,'id');var _0x1037ad;var _0x40db25=squel[_0x90b9('0x77')]();_0x40db25[_0x90b9('0x78')](_0x31ff9e[_0x90b9('0x79')]);for(var _0x367529=0x0;_0x367529<_0x33542b['length'];_0x367529+=0x1){_0x1037ad=_0x33542b[_0x367529][_0x90b9('0x7a')]?_0x22e02b[_0x33542b[_0x367529][_0x90b9('0x7a')]][_0x90b9('0x7b')]:_0x33542b[_0x367529][_0x90b9('0x71')];_0x1037ad=_0x33542b[_0x367529][_0x90b9('0x7c')]?_[_0x90b9('0x7d')](_0x46242a[_0x33542b[_0x367529][_0x90b9('0x7c')]],'%s',_0x1037ad):_0x1037ad;_0x1037ad=_0x33542b[_0x367529]['format']?_[_0x90b9('0x7d')](_0x2bce79[_0x33542b[_0x367529][_0x90b9('0x7e')]],'%s',_0x1037ad):_0x1037ad;if(_0x33542b[_0x367529]['groupBy']){_0x40db25['group'](_0x1037ad);}_0x33542b[_0x367529][_0x90b9('0x7f')]&&_0x40db25[_0x90b9('0x80')](_0x1037ad,_0x33542b[_0x367529]['orderBy']===_0x90b9('0x81')?![]:!![]);_0x40db25[_0x90b9('0x71')](_0x1037ad,_0x33542b[_0x367529][_0x90b9('0x82')]||_0x1037ad);}if(_0x31ff9e[_0x90b9('0x83')]){_0x31ff9e[_0x90b9('0x83')]=JSON['parse'](_0x31ff9e[_0x90b9('0x83')]);for(var _0x56b55e=0x0;_0x56b55e<_0x31ff9e[_0x90b9('0x83')][_0x90b9('0x3b')];_0x56b55e+=0x1){if(_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x34')]&&_[_0x90b9('0x69')](_0xb53dbd,_0x31ff9e['joins'][_0x56b55e][_0x90b9('0x34')])&&_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x84')]&&_0x31ff9e['joins'][_0x56b55e][_0x90b9('0x85')]&&_0x31ff9e[_0x90b9('0x83')][_0x56b55e]['foreignKey']){_0x40db25[_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x34')]](_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x85')],null,util[_0x90b9('0x7e')](_0x90b9('0x86'),_0x31ff9e[_0x90b9('0x79')],_0x31ff9e[_0x90b9('0x83')][_0x56b55e]['parentKey'],_0x31ff9e['joins'][_0x56b55e][_0x90b9('0x85')],_0x31ff9e[_0x90b9('0x83')][_0x56b55e][_0x90b9('0x87')]));}}}if(_0x31ff9e[_0x90b9('0x88')]){_0x31ff9e[_0x90b9('0x88')]=JSON['parse'](_0x31ff9e[_0x90b9('0x88')]);_0x40db25[_0x90b9('0x42')](_0x36a6b5(_0x31ff9e[_0x90b9('0x88')]['group']));}_0x363f07=_0x40db25[_0x90b9('0x89')]();_0x40db25['limit'](_0x548477);_0x40db25['offset'](0x0);logger[_0x90b9('0x8a')](_0x90b9('0x8b'),_0x40db25[_0x90b9('0x8c')]());return db['sequelize'][_0x90b9('0x36')](_0x40db25[_0x90b9('0x8c')](),{'type':db['sequelize'][_0x90b9('0x8d')]['SELECT']});}})['then'](respondWithResult(_0x9bac75,null))['catch'](handleError(_0x9bac75,null));};function runReport(_0x44bcb2,_0x27affa,_0x518875){var _0x15b6bf=_0x27affa[_0x90b9('0x2d')];var _0x37a3a2=0xa;var _0x433a06=[_0x90b9('0x58'),_0x90b9('0x59'),_0x90b9('0x5a'),_0x90b9('0x5b')];var _0x5f1883={'SUM':'SUM(%s)','COUNT':_0x90b9('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x90b9('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x90b9('0x62'),'GROUP_CONCAT ASC':_0x90b9('0x63'),'GROUP_CONCAT DESC':_0x90b9('0x64')};var _0x254a29={'SEC_TO_TIME':_0x90b9('0x65'),'DATE':_0x90b9('0x8e'),'HOUR':_0x90b9('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x90b9('0x68')};var _0x3e2257=function(_0xb6f3af){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x90b9('0x6c'),_0x90b9('0x6d')],_0xb6f3af);};var _0x3a2787=function(_0xedd2ab){if(!_0xedd2ab||!_0xedd2ab[_0x90b9('0x6e')][_0x90b9('0x3b')]){return'';}for(var _0x23f119='(',_0x1d7b4b=0x0;_0x1d7b4b<_0xedd2ab['rules'][_0x90b9('0x3b')];_0x1d7b4b+=0x1){_0x1d7b4b>0x0&&(_0x23f119+='\x20'+_0xedd2ab[_0x90b9('0x6f')]+'\x20');_0x23f119+=_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x70')]?_0x3a2787(_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x70')]):_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x71')]+'\x20'+_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x72')]+(_0x3e2257(_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x72')])?'\x20'+_0xedd2ab[_0x90b9('0x6e')][_0x1d7b4b][_0x90b9('0x73')]:'');}return _0x23f119+')';};var _0x2b8715={'where':{'id':_0x44bcb2['id']}},_0x4ea074,_0x24208f,_0x3d5ca1,_0xf940a2,_0x392892;_0x2b8715=_[_0x90b9('0x43')]({},_0x2b8715,_0x518875);return db['AnalyticCustomReport'][_0x90b9('0x56')](_0x2b8715)['then'](function(_0x1227a4){if(_0x1227a4){_0x4ea074=_0x1227a4;return _0x1227a4[_0x90b9('0x74')]();}return null;})['then'](function(_0x4af2a3){if(_0x4af2a3){if(!_0x4af2a3[_0x90b9('0x3b')]){throw new db['Sequelize'][(_0x90b9('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x24208f=_0x4af2a3;return db[_0x90b9('0x8f')][_0x90b9('0x76')]({'raw':!![]});}return null;})[_0x90b9('0x26')](function(_0x42354b){if(_0x42354b){_0x3d5ca1=_['keyBy'](_0x42354b,'id');var _0x17630a;var _0x44e136=squel['select']();_0x44e136[_0x90b9('0x78')](_0x4ea074[_0x90b9('0x79')]);for(var _0x58786b=0x0;_0x58786b<_0x24208f['length'];_0x58786b+=0x1){_0x17630a=_0x24208f[_0x58786b]['MetricId']?_0x3d5ca1[_0x24208f[_0x58786b][_0x90b9('0x7a')]][_0x90b9('0x7b')]:_0x24208f[_0x58786b][_0x90b9('0x71')];_0x17630a=_0x24208f[_0x58786b][_0x90b9('0x7c')]?_[_0x90b9('0x7d')](_0x5f1883[_0x24208f[_0x58786b][_0x90b9('0x7c')]],'%s',_0x17630a):_0x17630a;_0x17630a=_0x24208f[_0x58786b]['format']?_[_0x90b9('0x7d')](_0x254a29[_0x24208f[_0x58786b]['format']],'%s',_0x17630a):_0x17630a;if(_0x24208f[_0x58786b][_0x90b9('0x90')]){_0x44e136[_0x90b9('0x70')](_0x17630a);}_0x24208f[_0x58786b]['orderBy']&&_0x44e136[_0x90b9('0x80')](_0x17630a,_0x24208f[_0x58786b]['orderBy']===_0x90b9('0x81')?![]:!![]);_0x44e136[_0x90b9('0x71')](_0x17630a,_0x24208f[_0x58786b]['alias']||_0x17630a);}if(_0x4ea074[_0x90b9('0x83')]){_0x4ea074['joins']=JSON[_0x90b9('0x91')](_0x4ea074['joins']);for(var _0x2e475d=0x0;_0x2e475d<_0x4ea074[_0x90b9('0x83')][_0x90b9('0x3b')];_0x2e475d+=0x1){if(_0x4ea074[_0x90b9('0x83')][_0x2e475d]['type']&&_[_0x90b9('0x69')](_0x433a06,_0x4ea074[_0x90b9('0x83')][_0x2e475d]['type'])&&_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x84')]&&_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x85')]&&_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x87')]){_0x44e136[_0x4ea074[_0x90b9('0x83')][_0x2e475d]['type']](_0x4ea074[_0x90b9('0x83')][_0x2e475d]['foreignTable'],null,util[_0x90b9('0x7e')](_0x90b9('0x86'),_0x4ea074[_0x90b9('0x79')],_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x84')],_0x4ea074['joins'][_0x2e475d]['foreignTable'],_0x4ea074[_0x90b9('0x83')][_0x2e475d][_0x90b9('0x87')]));}}}if(_0x4ea074[_0x90b9('0x88')]){_0x4ea074['conditions']=JSON[_0x90b9('0x91')](_0x4ea074['conditions']);_0x44e136['where'](_0x3a2787(_0x4ea074[_0x90b9('0x88')]['group']));}_0x392892=_0x44e136['clone']();_0x44e136['limit'](_0x37a3a2);_0x44e136[_0x90b9('0x1f')](0x0);logger[_0x90b9('0x8a')](_0x90b9('0x8b'),_0x44e136[_0x90b9('0x8c')]());return db['sequelize'][_0x90b9('0x36')](_0x44e136[_0x90b9('0x8c')](),{'type':db[_0x90b9('0x92')][_0x90b9('0x8d')][_0x90b9('0x93')]});}})[_0x90b9('0x26')](function(_0x52e314){if(!_0x52e314[_0x90b9('0x3b')]){throw new db['Sequelize'][(_0x90b9('0x75'))](_0x90b9('0x94'),0xcc);}if(_0x27affa[_0x90b9('0x95')]===_0x90b9('0x96')){return null;}var _0x4e216b=_[_0x90b9('0x43')](_0x27affa,{'name':_0x27affa[_0x90b9('0x97')]||_0x27affa[_0x90b9('0x2d')]||_0x4ea074[_0x90b9('0x2d')],'basename':_0x15b6bf,'savename':util[_0x90b9('0x7e')](_0x90b9('0x98'),_0x27affa[_0x90b9('0x2d')]||_0x4ea074[_0x90b9('0x2d')],require('randomstring')[_0x90b9('0x99')](0x4),_0x27affa[_0x90b9('0x95')]||_0x90b9('0x9a')),'reportId':_0x4ea074['id'],'reportType':_0x90b9('0x9b')});return db[_0x90b9('0x9c')][_0x90b9('0x4b')](_0x4e216b,{'raw':!![]});})[_0x90b9('0x26')](function(_0x224731){if(_0x4ea074[_0x90b9('0x79')]===_0x90b9('0x9d')){_0x392892[_0x90b9('0x42')](_0x4ea074[_0x90b9('0x79')]+_0x90b9('0x9e'),_0x27affa[_0x90b9('0x9f')],_0x27affa[_0x90b9('0xa0')]);}else{_0x392892[_0x90b9('0x42')](_0x4ea074[_0x90b9('0x79')]+_0x90b9('0xa1'),_0x27affa[_0x90b9('0x9f')],_0x27affa[_0x90b9('0xa0')]);}if(_0x224731){logger['info'](_0x90b9('0xa2'),_0x392892[_0x90b9('0x8c')]());require(_0x90b9('0xa3'))[_0x90b9('0xa4')](path[_0x90b9('0x58')](__dirname,_0x90b9('0xa5'),_0x224731[_0x90b9('0x95')]),[_0x224731['id'],_0x392892[_0x90b9('0x8c')](),path[_0x90b9('0x58')](__dirname,_0x90b9('0xa6'),_0x224731[_0x90b9('0xa7')]),_0x15b6bf]);return _0x224731;}else{var _0x24e04b=squel[_0x90b9('0x77')]();_0x24e04b[_0x90b9('0x78')]('('+_0x392892[_0x90b9('0x8c')]()+')','countTable');_0x24e04b[_0x90b9('0x71')](_0x90b9('0xa8'),_0x90b9('0x1e'));_0x392892[_0x90b9('0x20')](_0x27affa['limit']||_0x37a3a2);_0x392892[_0x90b9('0x1f')](_0x27affa[_0x90b9('0x1f')]||0x0);return dbH[_0x90b9('0x92')][_0x90b9('0x36')](_0x24e04b[_0x90b9('0x8c')](),{'type':dbH['sequelize'][_0x90b9('0x8d')][_0x90b9('0x93')]})[_0x90b9('0x26')](function(_0x37e304){if(!_0x37e304[_0x90b9('0x3b')]){_0xf940a2=0x0;}else{_0xf940a2=_0x37e304[0x0][_0x90b9('0x1e')]||0x0;}return dbH['sequelize'][_0x90b9('0x36')](_0x392892[_0x90b9('0x8c')](),{'type':dbH[_0x90b9('0x92')][_0x90b9('0x8d')][_0x90b9('0x93')]});})[_0x90b9('0x26')](function(_0x312e3e){return{'rows':_0x312e3e||[],'count':_0xf940a2};});}});}exports[_0x90b9('0xa9')]=function(_0x32c97f,_0x5b006f){return runReport(_0x32c97f['params'],_0x32c97f[_0x90b9('0x36')],_0x32c97f[_0x90b9('0x44')])['then'](respondWithResult(_0x5b006f,null))[_0x90b9('0x47')](handleError(_0x5b006f,null));};exports[_0x90b9('0xaa')]=runReport;exports[_0x90b9('0x36')]=function(_0x214557,_0x113ba7){var _0x2096f4=0xa;var _0x4be406=[_0x90b9('0x58'),_0x90b9('0x59'),_0x90b9('0x5a'),_0x90b9('0x5b')];var _0x492775={'SUM':_0x90b9('0x5c'),'COUNT':_0x90b9('0x5d'),'COUNT DISTINCT':_0x90b9('0x5e'),'MAX':_0x90b9('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x90b9('0x62'),'GROUP_CONCAT ASC':_0x90b9('0x63'),'GROUP_CONCAT DESC':_0x90b9('0x64')};var _0x4ddb91={'SEC_TO_TIME':_0x90b9('0x65'),'DATE':_0x90b9('0x8e'),'HOUR':_0x90b9('0x66'),'ROUND':_0x90b9('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x6f76bd=function(_0x41d346){return!_['includes']([_0x90b9('0x6a'),_0x90b9('0x6b'),'IS\x20EMPTY',_0x90b9('0x6d')],_0x41d346);};var _0x256b6e=function(_0x2783b5){if(!_0x2783b5||!_0x2783b5[_0x90b9('0x6e')][_0x90b9('0x3b')]){return'';}for(var _0x1ead71='(',_0x134364=0x0;_0x134364<_0x2783b5[_0x90b9('0x6e')]['length'];_0x134364+=0x1){_0x134364>0x0&&(_0x1ead71+='\x20'+_0x2783b5['operator']+'\x20');_0x1ead71+=_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x70')]?_0x256b6e(_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x70')]):_0x2783b5['rules'][_0x134364][_0x90b9('0x71')]+'\x20'+_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x72')]+(_0x6f76bd(_0x2783b5[_0x90b9('0x6e')][_0x134364]['condition'])?'\x20'+_0x2783b5[_0x90b9('0x6e')][_0x134364][_0x90b9('0x73')]:'');}return _0x1ead71+')';};var _0x3752e4={'where':{'id':_0x214557[_0x90b9('0x49')]['id']}},_0x3e11bb,_0x3d016d,_0x26dc4c,_0x303ef4,_0xc3355f;_0x3752e4=_[_0x90b9('0x43')]({},_0x3752e4,_0x214557[_0x90b9('0x44')]);return db[_0x90b9('0x31')][_0x90b9('0x56')](_0x3752e4)[_0x90b9('0x26')](function(_0x5fdca1){if(_0x5fdca1){_0x3e11bb=_0x5fdca1;return _0x5fdca1[_0x90b9('0x74')]();}return null;})['then'](function(_0x484223){if(_0x484223){if(!_0x484223[_0x90b9('0x3b')]){throw new db[(_0x90b9('0xab'))][(_0x90b9('0x75'))](_0x90b9('0xac'),0x193);}_0x3d016d=_0x484223;return db['AnalyticMetric'][_0x90b9('0x76')]({'raw':!![]});}return null;})[_0x90b9('0x26')](function(_0x264388){if(_0x264388){_0x26dc4c=_[_0x90b9('0xad')](_0x264388,'id');var _0xf616da;var _0x5c3a2d=squel[_0x90b9('0x77')]();_0x5c3a2d[_0x90b9('0x78')](_0x3e11bb['table']);for(var _0x49e158=0x0;_0x49e158<_0x3d016d['length'];_0x49e158+=0x1){_0xf616da=_0x3d016d[_0x49e158][_0x90b9('0x7a')]?_0x26dc4c[_0x3d016d[_0x49e158][_0x90b9('0x7a')]][_0x90b9('0x7b')]:_0x3d016d[_0x49e158]['field'];_0xf616da=_0x3d016d[_0x49e158]['function']?_[_0x90b9('0x7d')](_0x492775[_0x3d016d[_0x49e158][_0x90b9('0x7c')]],'%s',_0xf616da):_0xf616da;_0xf616da=_0x3d016d[_0x49e158]['format']?_['replace'](_0x4ddb91[_0x3d016d[_0x49e158][_0x90b9('0x7e')]],'%s',_0xf616da):_0xf616da;if(_0x3d016d[_0x49e158][_0x90b9('0x90')]){_0x5c3a2d[_0x90b9('0x70')](_0xf616da);}_0x3d016d[_0x49e158][_0x90b9('0x7f')]&&_0x5c3a2d['order'](_0xf616da,_0x3d016d[_0x49e158][_0x90b9('0x7f')]===_0x90b9('0x81')?![]:!![]);_0x5c3a2d[_0x90b9('0x71')](_0xf616da,_0x3d016d[_0x49e158][_0x90b9('0x82')]||_0xf616da);}if(_0x3e11bb['joins']){_0x3e11bb['joins']=JSON[_0x90b9('0x91')](_0x3e11bb[_0x90b9('0x83')]);for(var _0x4205b2=0x0;_0x4205b2<_0x3e11bb['joins']['length'];_0x4205b2+=0x1){if(_0x3e11bb['joins'][_0x4205b2][_0x90b9('0x34')]&&_[_0x90b9('0x69')](_0x4be406,_0x3e11bb['joins'][_0x4205b2][_0x90b9('0x34')])&&_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x84')]&&_0x3e11bb[_0x90b9('0x83')][_0x4205b2]['foreignTable']&&_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x87')]){_0x5c3a2d[_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x34')]](_0x3e11bb['joins'][_0x4205b2][_0x90b9('0x85')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3e11bb[_0x90b9('0x79')],_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x84')],_0x3e11bb['joins'][_0x4205b2]['foreignTable'],_0x3e11bb[_0x90b9('0x83')][_0x4205b2][_0x90b9('0x87')]));}}}if(_0x3e11bb[_0x90b9('0x88')]){_0x3e11bb[_0x90b9('0x88')]=JSON[_0x90b9('0x91')](_0x3e11bb['conditions']);_0x5c3a2d['where'](_0x256b6e(_0x3e11bb[_0x90b9('0x88')][_0x90b9('0x70')]));}_0xc3355f=_0x5c3a2d[_0x90b9('0x89')]();_0x5c3a2d['limit'](_0x2096f4);_0x5c3a2d[_0x90b9('0x1f')](0x0);logger[_0x90b9('0x8a')](_0x90b9('0x8b'),_0x5c3a2d[_0x90b9('0x8c')]());return db['sequelize'][_0x90b9('0x36')](_0x5c3a2d[_0x90b9('0x8c')](),{'type':db['sequelize']['QueryTypes'][_0x90b9('0x93')]});}})[_0x90b9('0x26')](function(){return{'sql':_0xc3355f[_0x90b9('0x8c')]()};})[_0x90b9('0x26')](respondWithResult(_0x113ba7,null))['catch'](handleError(_0x113ba7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index dd4bc12..5f03e52 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 _0x732f=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x732f,0xf2));var _0xf732=function(_0x3accdb,_0x187888){_0x3accdb=_0x3accdb-0x0;var _0x4dab57=_0x732f[_0x3accdb];return _0x4dab57;};'use strict';var _=require(_0xf732('0x0'));var util=require(_0xf732('0x1'));var logger=require(_0xf732('0x2'))('api');var moment=require(_0xf732('0x3'));var BPromise=require(_0xf732('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf732('0x5'));var rimraf=require(_0xf732('0x6'));var config=require(_0xf732('0x7'));var attributes=require(_0xf732('0x8'));module['exports']=function(_0x573fba,_0x11295d){return _0x573fba['define'](_0xf732('0x9'),attributes,{'tableName':_0xf732('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76a4=['./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','bluebird','request-promise','path'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x76a4,0x136));var _0x476a=function(_0x4287a2,_0x288a84){_0x4287a2=_0x4287a2-0x0;var _0x16aa67=_0x76a4[_0x4287a2];return _0x16aa67;};'use strict';var _=require(_0x476a('0x0'));var util=require(_0x476a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x476a('0x2'));var rp=require(_0x476a('0x3'));var fs=require('fs');var path=require(_0x476a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x476a('0x5'));module[_0x476a('0x6')]=function(_0x2074cc,_0x2883f7){return _0x2074cc['define'](_0x476a('0x7'),attributes,{'tableName':_0x476a('0x8'),'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 08a1765..23900db 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 _0x9c11=['request\x20sent','debug','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x7101a5,_0x32ff66){var _0x258a99=function(_0x3c7298){while(--_0x3c7298){_0x7101a5['push'](_0x7101a5['shift']());}};_0x258a99(++_0x32ff66);}(_0x9c11,0xf1));var _0x19c1=function(_0x187b1b,_0x3b90c9){_0x187b1b=_0x187b1b-0x0;var _0x4e2087=_0x9c11[_0x187b1b];return _0x4e2087;};'use strict';var _=require(_0x19c1('0x0'));var util=require(_0x19c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x19c1('0x2'));var fs=require('fs');var Redis=require(_0x19c1('0x3'));var db=require(_0x19c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x19c1('0x5'))(_0x19c1('0x6'));var config=require(_0x19c1('0x7'));var jayson=require(_0x19c1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36a0d3,_0x526c5d,_0xf0f02e){return new BPromise(function(_0x51df30,_0x27ba1a){return client['request'](_0x36a0d3,_0xf0f02e)[_0x19c1('0x9')](function(_0x1271dc){logger['info'](_0x19c1('0xa'),_0x526c5d,_0x19c1('0xb'));logger[_0x19c1('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x526c5d,_0x19c1('0xb'),JSON['stringify'](_0x1271dc));if(_0x1271dc[_0x19c1('0xd')]){if(_0x1271dc[_0x19c1('0xd')][_0x19c1('0xe')]===0x1f4){logger[_0x19c1('0xd')](_0x19c1('0xa'),_0x526c5d,_0x1271dc[_0x19c1('0xd')]['message']);return _0x27ba1a(_0x1271dc[_0x19c1('0xd')]['message']);}logger[_0x19c1('0xd')](_0x19c1('0xa'),_0x526c5d,_0x1271dc['error'][_0x19c1('0xf')]);return _0x51df30(_0x1271dc[_0x19c1('0xd')]['message']);}else{logger[_0x19c1('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x526c5d,_0x19c1('0xb'));_0x51df30(_0x1271dc[_0x19c1('0x11')][_0x19c1('0xf')]);}})['catch'](function(_0x6813b2){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x526c5d,_0x6813b2);_0x27ba1a(_0x6813b2);});});} \ No newline at end of file +var _0x2219=['error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','request\x20sent','stringify','code'];(function(_0x43747e,_0x13b832){var _0x7fb853=function(_0x4b1028){while(--_0x4b1028){_0x43747e['push'](_0x43747e['shift']());}};_0x7fb853(++_0x13b832);}(_0x2219,0x9d));var _0x9221=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x2219[_0x461886];return _0x295e0a;};'use strict';var _=require(_0x9221('0x0'));var util=require(_0x9221('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9221('0x2'));var fs=require('fs');var Redis=require(_0x9221('0x3'));var db=require(_0x9221('0x4'))['db'];var utils=require(_0x9221('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9221('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9221('0x7')][_0x9221('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24546e,_0x4801b5,_0xef7a38){return new BPromise(function(_0x4a1c77,_0x3bdc6e){return client['request'](_0x24546e,_0xef7a38)[_0x9221('0x9')](function(_0x435bde){logger[_0x9221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'),JSON[_0x9221('0xc')](_0x435bde));if(_0x435bde['error']){if(_0x435bde['error'][_0x9221('0xd')]===0x1f4){logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x435bde[_0x9221('0xe')][_0x9221('0x10')]);return _0x3bdc6e(_0x435bde[_0x9221('0xe')]['message']);}logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x435bde[_0x9221('0xe')]['message']);return _0x4a1c77(_0x435bde[_0x9221('0xe')]['message']);}else{logger[_0x9221('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4801b5,_0x9221('0xb'));_0x4a1c77(_0x435bde[_0x9221('0x11')]['message']);}})[_0x9221('0x12')](function(_0x86231f){logger[_0x9221('0xe')](_0x9221('0xf'),_0x4801b5,_0x86231f);_0x3bdc6e(_0x86231f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a536651..9a9fa23 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 _0xed66=['express','Router','./analyticCustomReport.controller','isAuthenticated','get','show','/:id/preview','/:id/run','run','query','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2e6744,_0x495160){var _0x20ef10=function(_0x5540d6){while(--_0x5540d6){_0x2e6744['push'](_0x2e6744['shift']());}};_0x20ef10(++_0x495160);}(_0xed66,0x1a0));var _0x6ed6=function(_0x213295,_0x465d81){_0x213295=_0x213295-0x0;var _0x43a797=_0xed66[_0x213295];return _0x43a797;};'use strict';var multer=require(_0x6ed6('0x0'));var util=require(_0x6ed6('0x1'));var path=require(_0x6ed6('0x2'));var timeout=require(_0x6ed6('0x3'));var express=require(_0x6ed6('0x4'));var router=express[_0x6ed6('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ed6('0x6'));router['get']('/',auth[_0x6ed6('0x7')](),controller['index']);router[_0x6ed6('0x8')]('/:id',auth[_0x6ed6('0x7')](),controller[_0x6ed6('0x9')]);router['get'](_0x6ed6('0xa'),auth[_0x6ed6('0x7')](),controller['preview']);router[_0x6ed6('0x8')](_0x6ed6('0xb'),auth[_0x6ed6('0x7')](),controller[_0x6ed6('0xc')]);router[_0x6ed6('0x8')]('/:id/query',auth[_0x6ed6('0x7')](),controller[_0x6ed6('0xd')]);router['post']('/',auth[_0x6ed6('0x7')](),controller[_0x6ed6('0xe')]);router[_0x6ed6('0xf')](_0x6ed6('0x10'),auth[_0x6ed6('0x7')](),controller['update']);router[_0x6ed6('0x11')](_0x6ed6('0x10'),auth[_0x6ed6('0x7')](),controller[_0x6ed6('0x12')]);module[_0x6ed6('0x13')]=router; \ No newline at end of file +var _0x995a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','run','post','create','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x357236,_0x4ed379){var _0x4e6626=function(_0x4eb4db){while(--_0x4eb4db){_0x357236['push'](_0x357236['shift']());}};_0x4e6626(++_0x4ed379);}(_0x995a,0xd8));var _0xa995=function(_0x95dfb1,_0x3c3d38){_0x95dfb1=_0x95dfb1-0x0;var _0x3e5ea4=_0x995a[_0x95dfb1];return _0x3e5ea4;};'use strict';var multer=require(_0xa995('0x0'));var util=require(_0xa995('0x1'));var path=require('path');var timeout=require(_0xa995('0x2'));var express=require(_0xa995('0x3'));var router=express[_0xa995('0x4')]();var auth=require(_0xa995('0x5'));var interaction=require(_0xa995('0x6'));var config=require(_0xa995('0x7'));var controller=require(_0xa995('0x8'));router[_0xa995('0x9')]('/',auth[_0xa995('0xa')](),controller['index']);router['get'](_0xa995('0xb'),auth['isAuthenticated'](),controller[_0xa995('0xc')]);router[_0xa995('0x9')](_0xa995('0xd'),auth[_0xa995('0xa')](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xa995('0xe')]);router[_0xa995('0x9')]('/:id/query',auth[_0xa995('0xa')](),controller['query']);router[_0xa995('0xf')]('/',auth[_0xa995('0xa')](),controller[_0xa995('0x10')]);router['put'](_0xa995('0xb'),auth[_0xa995('0xa')](),controller[_0xa995('0x11')]);router['delete'](_0xa995('0xb'),auth['isAuthenticated'](),controller[_0xa995('0x12')]);module[_0xa995('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 893c83e..08c52b3 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 _0x8a59=['TEXT','exports','STRING'];(function(_0x378a9c,_0xb40ffb){var _0x319c46=function(_0xb2544f){while(--_0xb2544f){_0x378a9c['push'](_0x378a9c['shift']());}};_0x319c46(++_0xb40ffb);}(_0x8a59,0x160));var _0x98a5=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x8a59[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require('sequelize');module[_0x98a5('0x0')]={'name':{'type':Sequelize[_0x98a5('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x98a5('0x1')]},'table':{'type':Sequelize[_0x98a5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x98a5('0x2')]}}; \ No newline at end of file +var _0x029c=['STRING','TEXT','exports'];(function(_0x713a06,_0x2eebcb){var _0x4844e7=function(_0x702361){while(--_0x702361){_0x713a06['push'](_0x713a06['shift']());}};_0x4844e7(++_0x2eebcb);}(_0x029c,0x1ac));var _0xc029=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x029c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc029('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc029('0x1')]},'parent':{'type':Sequelize[_0xc029('0x1')]},'table':{'type':Sequelize[_0xc029('0x1')]},'conditions':{'type':Sequelize[_0xc029('0x2')]},'joins':{'type':Sequelize[_0xc029('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 3a7780c..3b924b7 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 _0x77a3=['join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','group','rules','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MIN(%s)','ValidationErrorItem','clone','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview'];(function(_0x5a9514,_0x4e4ef4){var _0x22c8e2=function(_0x183160){while(--_0x183160){_0x5a9514['push'](_0x5a9514['shift']());}};_0x22c8e2(++_0x4e4ef4);}(_0x77a3,0xfc));var _0x377a=function(_0xbc5e8,_0x1ff5e4){_0xbc5e8=_0xbc5e8-0x0;var _0x364892=_0x77a3[_0xbc5e8];return _0x364892;};'use strict';var pdf=require(_0x377a('0x0'));var emlformat=require(_0x377a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x377a('0x2'));var rp=require(_0x377a('0x3'));var moment=require(_0x377a('0x4'));var BPromise=require(_0x377a('0x5'));var Mustache=require(_0x377a('0x6'));var util=require(_0x377a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x377a('0x8'));var ejs=require(_0x377a('0x9'));var fs=require('fs');var _=require(_0x377a('0xa'));var squel=require(_0x377a('0xb'));var crypto=require(_0x377a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x377a('0x8'));var querystring=require(_0x377a('0xd'));var Papa=require(_0x377a('0xe'));var Redis=require(_0x377a('0xf'));var authService=require(_0x377a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x377a('0x11'));var hardwareService=require(_0x377a('0x12'));var logger=require(_0x377a('0x13'))(_0x377a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x377a('0x15'))['db'];var dbH=require(_0x377a('0x15'))[_0x377a('0x16')];function respondWithStatusCode(_0x2353ab,_0x349a6f){_0x349a6f=_0x349a6f||0xcc;return function(_0x55fc27){if(_0x55fc27){return _0x2353ab[_0x377a('0x17')](_0x349a6f);}return _0x2353ab[_0x377a('0x18')](_0x349a6f)[_0x377a('0x19')]();};}function respondWithResult(_0xc15f34,_0x36ce14){_0x36ce14=_0x36ce14||0xc8;return function(_0x452ecf){if(_0x452ecf){return _0xc15f34[_0x377a('0x18')](_0x36ce14)['json'](_0x452ecf);}};}function respondWithFilteredResult(_0x191e3b,_0x214028){return function(_0x19c504){if(_0x19c504){var _0x39b986=_0x19c504[_0x377a('0x1a')],_0x3d609c=_0x214028[_0x377a('0x1b')],_0x2de49c=_0x214028[_0x377a('0x1b')]+_0x214028[_0x377a('0x1c')],_0x3c680c;if(_0x2de49c>=_0x39b986){_0x2de49c=_0x39b986;_0x3c680c=0xc8;}else{_0x3c680c=0xce;}_0x191e3b[_0x377a('0x18')](_0x3c680c);return _0x191e3b[_0x377a('0x1d')](_0x377a('0x1e'),_0x3d609c+'-'+_0x2de49c+'/'+_0x39b986)[_0x377a('0x1f')](_0x19c504);}return null;};}function patchUpdates(_0x38bc91){return function(_0x118141){try{jsonpatch['apply'](_0x118141,_0x38bc91,!![]);}catch(_0x411cfe){return BPromise[_0x377a('0x20')](_0x411cfe);}return _0x118141[_0x377a('0x21')]();};}function saveUpdates(_0x59485c,_0x111d1b){return function(_0x2bbaed){if(_0x2bbaed){return _0x2bbaed['update'](_0x59485c)['then'](function(_0x16170b){return _0x16170b;});}return null;};}function removeEntity(_0x11dd15,_0x23959a){return function(_0x108e81){if(_0x108e81){return _0x108e81[_0x377a('0x22')]()[_0x377a('0x23')](function(){var _0x3b278c=_0x108e81[_0x377a('0x24')]({'plain':!![]});var _0x53d913='DefaultReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x53d913,'resourceId':_0x3b278c['id']}})[_0x377a('0x23')](function(){return _0x108e81;});})[_0x377a('0x23')](function(){_0x11dd15[_0x377a('0x18')](0xcc)[_0x377a('0x19')]();});}};}function handleEntityNotFound(_0xe112e3,_0x206de0){return function(_0x3d1ff8){if(!_0x3d1ff8){_0xe112e3[_0x377a('0x17')](0x194);}return _0x3d1ff8;};}function handleError(_0x38cfee,_0x160790){_0x160790=_0x160790||0x1f4;return function(_0x3048a8){logger[_0x377a('0x25')](_0x3048a8[_0x377a('0x26')]);if(_0x3048a8[_0x377a('0x27')]){delete _0x3048a8[_0x377a('0x27')];}_0x38cfee[_0x377a('0x18')](_0x160790)[_0x377a('0x28')](_0x3048a8);};}exports[_0x377a('0x29')]=function(_0x29a0bf,_0x574226){var _0x3c0c93={},_0x352175={},_0x28bd91={'count':0x0,'rows':[]};var _0x3b8c84=_[_0x377a('0x2a')](db['AnalyticDefaultReport'][_0x377a('0x2b')],function(_0x241012){return{'name':_0x241012[_0x377a('0x2c')],'type':_0x241012['type'][_0x377a('0x2d')]};});_0x352175['model']=_[_0x377a('0x2a')](_0x3b8c84,_0x377a('0x27'));_0x352175[_0x377a('0x2e')]=_['keys'](_0x29a0bf[_0x377a('0x2e')]);_0x352175[_0x377a('0x2f')]=_[_0x377a('0x30')](_0x352175['model'],_0x352175[_0x377a('0x2e')]);_0x3c0c93[_0x377a('0x31')]=_[_0x377a('0x30')](_0x352175[_0x377a('0x32')],qs[_0x377a('0x33')](_0x29a0bf[_0x377a('0x2e')][_0x377a('0x33')]));_0x3c0c93[_0x377a('0x31')]=_0x3c0c93[_0x377a('0x31')][_0x377a('0x34')]?_0x3c0c93[_0x377a('0x31')]:_0x352175[_0x377a('0x32')];if(!_0x29a0bf['query'][_0x377a('0x35')](_0x377a('0x36'))){_0x3c0c93[_0x377a('0x1c')]=qs[_0x377a('0x1c')](_0x29a0bf['query']['limit']);_0x3c0c93[_0x377a('0x1b')]=qs[_0x377a('0x1b')](_0x29a0bf[_0x377a('0x2e')][_0x377a('0x1b')]);}_0x3c0c93[_0x377a('0x37')]=qs[_0x377a('0x38')](_0x29a0bf['query'][_0x377a('0x38')]);_0x3c0c93[_0x377a('0x39')]=qs[_0x377a('0x2f')](_[_0x377a('0x3a')](_0x29a0bf['query'],_0x352175[_0x377a('0x2f')]),_0x3b8c84);if(_0x29a0bf[_0x377a('0x2e')][_0x377a('0x3b')]){_0x3c0c93[_0x377a('0x39')]=_[_0x377a('0x3c')](_0x3c0c93[_0x377a('0x39')],{'$or':_[_0x377a('0x2a')](_0x3b8c84,function(_0x5b0b7b){if(_0x5b0b7b[_0x377a('0x3d')]!==_0x377a('0x3e')){var _0x9cf21f={};_0x9cf21f[_0x5b0b7b['name']]={'$like':'%'+_0x29a0bf[_0x377a('0x2e')][_0x377a('0x3b')]+'%'};return _0x9cf21f;}})});}_0x3c0c93=_['merge']({},_0x3c0c93,_0x29a0bf['options']);var _0x86998b={'where':_0x3c0c93[_0x377a('0x39')]};return db[_0x377a('0x3f')][_0x377a('0x1a')](_0x86998b)[_0x377a('0x23')](function(_0x17582a){_0x28bd91[_0x377a('0x1a')]=_0x17582a;if(_0x29a0bf[_0x377a('0x2e')][_0x377a('0x40')]){_0x3c0c93[_0x377a('0x41')]=[{'all':!![]}];}return db[_0x377a('0x3f')][_0x377a('0x42')](_0x3c0c93);})[_0x377a('0x23')](function(_0x141409){_0x28bd91[_0x377a('0x43')]=_0x141409;return _0x28bd91;})['then'](respondWithFilteredResult(_0x574226,_0x3c0c93))[_0x377a('0x44')](handleError(_0x574226,null));};exports['show']=function(_0x520dac,_0x490873){var _0xfe03e2={'raw':!![],'where':{'id':_0x520dac['params']['id']}},_0x333b02={};_0x333b02[_0x377a('0x32')]=_[_0x377a('0x45')](db[_0x377a('0x3f')][_0x377a('0x2b')]);_0x333b02[_0x377a('0x2e')]=_[_0x377a('0x45')](_0x520dac[_0x377a('0x2e')]);_0x333b02[_0x377a('0x2f')]=_[_0x377a('0x30')](_0x333b02[_0x377a('0x32')],_0x333b02[_0x377a('0x2e')]);_0xfe03e2['attributes']=_[_0x377a('0x30')](_0x333b02['model'],qs['fields'](_0x520dac[_0x377a('0x2e')]['fields']));_0xfe03e2[_0x377a('0x31')]=_0xfe03e2[_0x377a('0x31')][_0x377a('0x34')]?_0xfe03e2[_0x377a('0x31')]:_0x333b02[_0x377a('0x32')];if(_0x520dac[_0x377a('0x2e')][_0x377a('0x40')]){_0xfe03e2[_0x377a('0x41')]=[{'all':!![]}];}_0xfe03e2=_['merge']({},_0xfe03e2,_0x520dac[_0x377a('0x46')]);return db[_0x377a('0x3f')][_0x377a('0x47')](_0xfe03e2)[_0x377a('0x23')](handleEntityNotFound(_0x490873,null))[_0x377a('0x23')](respondWithResult(_0x490873,null))[_0x377a('0x44')](handleError(_0x490873,null));};exports[_0x377a('0x48')]=function(_0x10897c,_0x181e52){return db['AnalyticDefaultReport'][_0x377a('0x48')](_0x10897c[_0x377a('0x49')],{})[_0x377a('0x23')](function(_0x59d242){var _0x5aabe6=_0x10897c['user']['get']({'plain':!![]});if(!_0x5aabe6)throw new Error(_0x377a('0x4a'));if(_0x5aabe6['role']===_0x377a('0x4b')){var _0x462d34=_0x59d242[_0x377a('0x24')]({'plain':!![]});var _0x5f3805=_0x377a('0x4c');return db[_0x377a('0x4d')][_0x377a('0x47')]({'where':{'name':_0x5f3805,'userProfileId':_0x5aabe6[_0x377a('0x4e')]},'raw':!![]})[_0x377a('0x23')](function(_0x506f3c){if(_0x506f3c&&_0x506f3c[_0x377a('0x4f')]===0x0){return db[_0x377a('0x50')]['create']({'name':_0x462d34[_0x377a('0x27')],'resourceId':_0x462d34['id'],'type':_0x377a('0x51'),'sectionId':_0x506f3c['id']},{})[_0x377a('0x23')](function(){return _0x59d242;});}else{return _0x59d242;}})[_0x377a('0x44')](function(_0x3d57e1){logger[_0x377a('0x25')](_0x377a('0x52'),_0x3d57e1);throw _0x3d57e1;});}return _0x59d242;})[_0x377a('0x23')](respondWithResult(_0x181e52,0xc9))['catch'](handleError(_0x181e52,null));};exports[_0x377a('0x53')]=function(_0x15000b,_0x28ab26){if(_0x15000b[_0x377a('0x49')]['id']){delete _0x15000b[_0x377a('0x49')]['id'];}return db['AnalyticDefaultReport']['find']({'where':{'id':_0x15000b[_0x377a('0x54')]['id']}})[_0x377a('0x23')](handleEntityNotFound(_0x28ab26,null))[_0x377a('0x23')](saveUpdates(_0x15000b[_0x377a('0x49')],null))[_0x377a('0x23')](respondWithResult(_0x28ab26,null))[_0x377a('0x44')](handleError(_0x28ab26,null));};exports[_0x377a('0x22')]=function(_0x55b527,_0x3b4f90){return db[_0x377a('0x3f')][_0x377a('0x47')]({'where':{'id':_0x55b527[_0x377a('0x54')]['id']}})[_0x377a('0x23')](handleEntityNotFound(_0x3b4f90,null))['then'](removeEntity(_0x3b4f90,null))[_0x377a('0x44')](handleError(_0x3b4f90,null));};exports[_0x377a('0x55')]=function(_0x173e02,_0x1b216f){var _0x194a41=0xa;var _0x5575bc=[_0x377a('0x56'),_0x377a('0x57'),_0x377a('0x58'),_0x377a('0x59')];var _0x5e630a={'SUM':_0x377a('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x377a('0x5b'),'MAX':_0x377a('0x5c'),'MIN':'MIN(%s)','AVG':_0x377a('0x5d'),'GROUP_CONCAT':_0x377a('0x5e'),'GROUP_CONCAT ASC':_0x377a('0x5f'),'GROUP_CONCAT DESC':_0x377a('0x60')};var _0x219eec={'SEC_TO_TIME':_0x377a('0x61'),'DATE':_0x377a('0x62'),'HOUR':_0x377a('0x63'),'ROUND':_0x377a('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x465fe5=function(_0x38ba14){return!_[_0x377a('0x65')]([_0x377a('0x66'),_0x377a('0x67'),_0x377a('0x68'),_0x377a('0x69')],_0x38ba14);};var _0x33ab18=function(_0x14e043){if(!_0x14e043||!_0x14e043['rules'][_0x377a('0x34')]){return'';}for(var _0x19f7f7='(',_0x2914e9=0x0;_0x2914e9<_0x14e043['rules'][_0x377a('0x34')];_0x2914e9+=0x1){_0x2914e9>0x0&&(_0x19f7f7+='\x20'+_0x14e043[_0x377a('0x6a')]+'\x20');_0x19f7f7+=_0x14e043['rules'][_0x2914e9][_0x377a('0x6b')]?_0x33ab18(_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6b')]):_0x14e043[_0x377a('0x6c')][_0x2914e9]['field']+'\x20'+_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6d')]+(_0x465fe5(_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6d')])?'\x20'+_0x14e043[_0x377a('0x6c')][_0x2914e9][_0x377a('0x6e')]:'');}return _0x19f7f7+')';};var _0x5d375b={'where':{'id':_0x173e02[_0x377a('0x54')]['id']}},_0x59a11b,_0x3970e4,_0x298877,_0x1d9000,_0x5b2be8;_0x5d375b=_[_0x377a('0x3c')]({},_0x5d375b,_0x173e02[_0x377a('0x46')]);return db['AnalyticDefaultReport'][_0x377a('0x47')](_0x5d375b)['then'](function(_0x40a0ca){if(_0x40a0ca){_0x59a11b=_0x40a0ca;return _0x40a0ca[_0x377a('0x6f')]();}return null;})[_0x377a('0x23')](function(_0x538c8c){if(_0x538c8c){if(!_0x538c8c[_0x377a('0x34')]){throw new db[(_0x377a('0x70'))]['ValidationErrorItem'](_0x377a('0x71'),0x193);}_0x3970e4=_0x538c8c;return db[_0x377a('0x72')][_0x377a('0x42')]({'raw':!![]});}return null;})[_0x377a('0x23')](function(_0x20412b){if(_0x20412b){_0x298877=_[_0x377a('0x73')](_0x20412b,'id');var _0x3e7b28;var _0x24c1b7=squel[_0x377a('0x74')]();_0x24c1b7[_0x377a('0x75')](_0x59a11b['table']);for(var _0x2ea26c=0x0;_0x2ea26c<_0x3970e4[_0x377a('0x34')];_0x2ea26c+=0x1){_0x3e7b28=_0x3970e4[_0x2ea26c]['MetricId']?_0x298877[_0x3970e4[_0x2ea26c][_0x377a('0x76')]][_0x377a('0x77')]:_0x3970e4[_0x2ea26c][_0x377a('0x78')];_0x3e7b28=_0x3970e4[_0x2ea26c][_0x377a('0x79')]?_[_0x377a('0x7a')](_0x5e630a[_0x3970e4[_0x2ea26c][_0x377a('0x79')]],'%s',_0x3e7b28):_0x3e7b28;_0x3e7b28=_0x3970e4[_0x2ea26c][_0x377a('0x7b')]?_[_0x377a('0x7a')](_0x219eec[_0x3970e4[_0x2ea26c][_0x377a('0x7b')]],'%s',_0x3e7b28):_0x3e7b28;if(_0x3970e4[_0x2ea26c][_0x377a('0x7c')]){_0x24c1b7[_0x377a('0x6b')](_0x3e7b28);}_0x3970e4[_0x2ea26c][_0x377a('0x7d')]&&_0x24c1b7[_0x377a('0x37')](_0x3e7b28,_0x3970e4[_0x2ea26c][_0x377a('0x7d')]===_0x377a('0x7e')?![]:!![]);_0x24c1b7[_0x377a('0x78')](_0x3e7b28,_0x3970e4[_0x2ea26c][_0x377a('0x7f')]||_0x3e7b28);}if(_0x59a11b[_0x377a('0x80')]){_0x59a11b[_0x377a('0x80')]=JSON[_0x377a('0x81')](_0x59a11b[_0x377a('0x80')]);for(var _0x2de848=0x0;_0x2de848<_0x59a11b[_0x377a('0x80')][_0x377a('0x34')];_0x2de848+=0x1){if(_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x3d')]&&_[_0x377a('0x65')](_0x5575bc,_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x3d')])&&_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x82')]&&_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x83')]&&_0x59a11b[_0x377a('0x80')][_0x2de848]['foreignKey']){_0x24c1b7[_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x3d')]](_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x83')],null,util[_0x377a('0x7b')](_0x377a('0x84'),_0x59a11b[_0x377a('0x85')],_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x82')],_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x83')],_0x59a11b[_0x377a('0x80')][_0x2de848][_0x377a('0x86')]));}}}if(_0x59a11b[_0x377a('0x87')]){_0x59a11b[_0x377a('0x87')]=JSON[_0x377a('0x81')](_0x59a11b['conditions']);_0x24c1b7['where'](_0x33ab18(_0x59a11b['conditions'][_0x377a('0x6b')]));}_0x5b2be8=_0x24c1b7['clone']();_0x24c1b7[_0x377a('0x1c')](_0x194a41);_0x24c1b7['offset'](0x0);logger[_0x377a('0x88')](_0x377a('0x89'),_0x24c1b7[_0x377a('0x8a')]());return db[_0x377a('0x8b')]['query'](_0x24c1b7[_0x377a('0x8a')](),{'type':db[_0x377a('0x8b')][_0x377a('0x8c')][_0x377a('0x8d')]});}})[_0x377a('0x23')](respondWithResult(_0x1b216f,null))[_0x377a('0x44')](handleError(_0x1b216f,null));};function runReport(_0x51209d,_0x228624,_0x1db830){var _0x45a076=_0x228624[_0x377a('0x27')];var _0x14eb0d=0xa;var _0x5171c7=[_0x377a('0x56'),_0x377a('0x57'),'right_join',_0x377a('0x59')];var _0x5d69fe={'SUM':_0x377a('0x5a'),'COUNT':_0x377a('0x8e'),'COUNT DISTINCT':_0x377a('0x5b'),'MAX':'MAX(%s)','MIN':_0x377a('0x8f'),'AVG':_0x377a('0x5d'),'GROUP_CONCAT':_0x377a('0x5e'),'GROUP_CONCAT ASC':_0x377a('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2898cc={'SEC_TO_TIME':_0x377a('0x61'),'DATE':_0x377a('0x62'),'HOUR':_0x377a('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5a89fa=function(_0x666a78){return!_[_0x377a('0x65')]([_0x377a('0x66'),_0x377a('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x666a78);};var _0x222883=function(_0x353572){if(!_0x353572||!_0x353572[_0x377a('0x6c')][_0x377a('0x34')]){return'';}for(var _0x2c7fbd='(',_0xd849aa=0x0;_0xd849aa<_0x353572['rules'][_0x377a('0x34')];_0xd849aa+=0x1){_0xd849aa>0x0&&(_0x2c7fbd+='\x20'+_0x353572[_0x377a('0x6a')]+'\x20');_0x2c7fbd+=_0x353572['rules'][_0xd849aa]['group']?_0x222883(_0x353572[_0x377a('0x6c')][_0xd849aa][_0x377a('0x6b')]):_0x353572[_0x377a('0x6c')][_0xd849aa][_0x377a('0x78')]+'\x20'+_0x353572['rules'][_0xd849aa][_0x377a('0x6d')]+(_0x5a89fa(_0x353572[_0x377a('0x6c')][_0xd849aa]['condition'])?'\x20'+_0x353572[_0x377a('0x6c')][_0xd849aa][_0x377a('0x6e')]:'');}return _0x2c7fbd+')';};var _0x364c94={'where':{'id':_0x51209d['id']}},_0x28c5a9,_0x2e7d50,_0x4cbc19,_0x32a215,_0x3b3f88;_0x364c94=_[_0x377a('0x3c')]({},_0x364c94,_0x1db830);return db[_0x377a('0x3f')]['find'](_0x364c94)[_0x377a('0x23')](function(_0x4a91fc){if(_0x4a91fc){_0x28c5a9=_0x4a91fc;return _0x4a91fc[_0x377a('0x6f')]();}return null;})['then'](function(_0x2c4b76){if(_0x2c4b76){if(!_0x2c4b76[_0x377a('0x34')]){throw new db[(_0x377a('0x70'))][(_0x377a('0x90'))](_0x377a('0x71'),0x193);}_0x2e7d50=_0x2c4b76;return db[_0x377a('0x72')][_0x377a('0x42')]({'raw':!![]});}return null;})[_0x377a('0x23')](function(_0x21938c){if(_0x21938c){_0x4cbc19=_[_0x377a('0x73')](_0x21938c,'id');var _0x598a12;var _0x33433a=squel[_0x377a('0x74')]();_0x33433a['from'](_0x28c5a9[_0x377a('0x85')]);for(var _0x11c11a=0x0;_0x11c11a<_0x2e7d50[_0x377a('0x34')];_0x11c11a+=0x1){_0x598a12=_0x2e7d50[_0x11c11a][_0x377a('0x76')]?_0x4cbc19[_0x2e7d50[_0x11c11a][_0x377a('0x76')]][_0x377a('0x77')]:_0x2e7d50[_0x11c11a][_0x377a('0x78')];_0x598a12=_0x2e7d50[_0x11c11a]['function']?_[_0x377a('0x7a')](_0x5d69fe[_0x2e7d50[_0x11c11a]['function']],'%s',_0x598a12):_0x598a12;_0x598a12=_0x2e7d50[_0x11c11a]['format']?_['replace'](_0x2898cc[_0x2e7d50[_0x11c11a][_0x377a('0x7b')]],'%s',_0x598a12):_0x598a12;if(_0x2e7d50[_0x11c11a]['groupBy']){_0x33433a[_0x377a('0x6b')](_0x598a12);}_0x2e7d50[_0x11c11a][_0x377a('0x7d')]&&_0x33433a['order'](_0x598a12,_0x2e7d50[_0x11c11a][_0x377a('0x7d')]===_0x377a('0x7e')?![]:!![]);_0x33433a[_0x377a('0x78')](_0x598a12,_0x2e7d50[_0x11c11a][_0x377a('0x7f')]||_0x598a12);}if(_0x28c5a9['joins']){_0x28c5a9[_0x377a('0x80')]=JSON[_0x377a('0x81')](_0x28c5a9[_0x377a('0x80')]);for(var _0x2e63da=0x0;_0x2e63da<_0x28c5a9[_0x377a('0x80')][_0x377a('0x34')];_0x2e63da+=0x1){if(_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x3d')]&&_['includes'](_0x5171c7,_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x3d')])&&_0x28c5a9[_0x377a('0x80')][_0x2e63da]['parentKey']&&_0x28c5a9[_0x377a('0x80')][_0x2e63da]['foreignTable']&&_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x86')]){_0x33433a[_0x28c5a9[_0x377a('0x80')][_0x2e63da]['type']](_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x83')],null,util[_0x377a('0x7b')]('%s.%s\x20=\x20%s.%s',_0x28c5a9[_0x377a('0x85')],_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x82')],_0x28c5a9[_0x377a('0x80')][_0x2e63da][_0x377a('0x83')],_0x28c5a9['joins'][_0x2e63da][_0x377a('0x86')]));}}}if(_0x28c5a9[_0x377a('0x87')]){_0x28c5a9[_0x377a('0x87')]=JSON[_0x377a('0x81')](_0x28c5a9[_0x377a('0x87')]);_0x33433a[_0x377a('0x39')](_0x222883(_0x28c5a9[_0x377a('0x87')][_0x377a('0x6b')]));}_0x3b3f88=_0x33433a[_0x377a('0x91')]();_0x33433a[_0x377a('0x1c')](_0x14eb0d);_0x33433a['offset'](0x0);logger['debug']('Limited\x20Query:',_0x33433a['toString']());return db[_0x377a('0x8b')][_0x377a('0x2e')](_0x33433a['toString'](),{'type':db[_0x377a('0x8b')]['QueryTypes'][_0x377a('0x8d')]});}})['then'](function(_0x166c03){if(!_0x166c03[_0x377a('0x34')]){throw new db[(_0x377a('0x70'))][(_0x377a('0x90'))](_0x377a('0x92'),0xcc);}if(_0x228624[_0x377a('0x93')]===_0x377a('0x94')){return null;}var _0xeee50e=_[_0x377a('0x3c')](_0x228624,{'name':_0x228624[_0x377a('0x95')]||_0x228624[_0x377a('0x27')]||_0x28c5a9[_0x377a('0x27')],'basename':_0x45a076,'savename':util[_0x377a('0x7b')]('%s-%s.%s',_0x228624['name']||_0x28c5a9[_0x377a('0x27')],require(_0x377a('0x96'))[_0x377a('0x97')](0x4),_0x228624[_0x377a('0x93')]||_0x377a('0x98')),'reportId':_0x28c5a9['id'],'reportType':_0x377a('0x99')});return db[_0x377a('0x9a')]['create'](_0xeee50e,{'raw':!![]});})[_0x377a('0x23')](function(_0x4d8bf9){if(_0x28c5a9[_0x377a('0x85')]===_0x377a('0x9b')){_0x3b3f88[_0x377a('0x39')](_0x28c5a9['table']+_0x377a('0x9c'),_0x228624[_0x377a('0x9d')],_0x228624['endDate']);}else{_0x3b3f88[_0x377a('0x39')](_0x28c5a9[_0x377a('0x85')]+_0x377a('0x9e'),_0x228624['startDate'],_0x228624[_0x377a('0x9f')]);}if(_0x4d8bf9){logger[_0x377a('0xa0')](_0x377a('0xa1'),_0x3b3f88['toString']());require(_0x377a('0xa2'))[_0x377a('0xa3')](path['join'](__dirname,'../../components/export/',_0x4d8bf9[_0x377a('0x93')]),[_0x4d8bf9['id'],_0x3b3f88[_0x377a('0x8a')](),path['join'](__dirname,_0x377a('0xa4'),_0x4d8bf9[_0x377a('0xa5')]),_0x45a076]);return _0x4d8bf9;}else{var _0x5b6705=squel['select']();_0x5b6705[_0x377a('0x75')]('('+_0x3b3f88[_0x377a('0x8a')]()+')',_0x377a('0xa6'));_0x5b6705['field'](_0x377a('0xa7'),_0x377a('0x1a'));_0x3b3f88['limit'](_0x228624[_0x377a('0x1c')]||_0x14eb0d);_0x3b3f88[_0x377a('0x1b')](_0x228624[_0x377a('0x1b')]||0x0);return dbH[_0x377a('0x8b')]['query'](_0x5b6705['toString'](),{'type':dbH[_0x377a('0x8b')][_0x377a('0x8c')][_0x377a('0x8d')]})[_0x377a('0x23')](function(_0x20c2c0){if(!_0x20c2c0['length']){_0x32a215=0x0;}else{_0x32a215=_0x20c2c0[0x0][_0x377a('0x1a')]||0x0;}return dbH[_0x377a('0x8b')][_0x377a('0x2e')](_0x3b3f88[_0x377a('0x8a')](),{'type':dbH['sequelize'][_0x377a('0x8c')][_0x377a('0x8d')]});})['then'](function(_0x2e8015){return{'rows':_0x2e8015||[],'count':_0x32a215};});}});}exports[_0x377a('0xa8')]=function(_0x27f946,_0x562f29){return runReport(_0x27f946[_0x377a('0x54')],_0x27f946[_0x377a('0x2e')],_0x27f946[_0x377a('0x46')])['then'](respondWithResult(_0x562f29,null))[_0x377a('0x44')](handleError(_0x562f29,null));};exports['runReport']=runReport;exports[_0x377a('0x2e')]=function(_0x10ff7d,_0x5e5f26){var _0x1a5159=0xa;var _0x345292=[_0x377a('0x56'),'left_join',_0x377a('0x58'),_0x377a('0x59')];var _0x3c8293={'SUM':'SUM(%s)','COUNT':_0x377a('0x8e'),'COUNT DISTINCT':_0x377a('0x5b'),'MAX':_0x377a('0x5c'),'MIN':_0x377a('0x8f'),'AVG':_0x377a('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x377a('0x5f'),'GROUP_CONCAT DESC':_0x377a('0x60')};var _0x5ca149={'SEC_TO_TIME':_0x377a('0x61'),'DATE':_0x377a('0x62'),'HOUR':_0x377a('0x63'),'ROUND':_0x377a('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3a3ca2=function(_0x56908c){return!_[_0x377a('0x65')](['IS\x20NULL',_0x377a('0x67'),_0x377a('0x68'),_0x377a('0x69')],_0x56908c);};var _0x3f7222=function(_0x2247c0){if(!_0x2247c0||!_0x2247c0['rules'][_0x377a('0x34')]){return'';}for(var _0x5d5dde='(',_0x91cc13=0x0;_0x91cc13<_0x2247c0[_0x377a('0x6c')][_0x377a('0x34')];_0x91cc13+=0x1){_0x91cc13>0x0&&(_0x5d5dde+='\x20'+_0x2247c0[_0x377a('0x6a')]+'\x20');_0x5d5dde+=_0x2247c0[_0x377a('0x6c')][_0x91cc13][_0x377a('0x6b')]?_0x3f7222(_0x2247c0['rules'][_0x91cc13]['group']):_0x2247c0[_0x377a('0x6c')][_0x91cc13]['field']+'\x20'+_0x2247c0[_0x377a('0x6c')][_0x91cc13][_0x377a('0x6d')]+(_0x3a3ca2(_0x2247c0['rules'][_0x91cc13][_0x377a('0x6d')])?'\x20'+_0x2247c0[_0x377a('0x6c')][_0x91cc13][_0x377a('0x6e')]:'');}return _0x5d5dde+')';};var _0x24c067={'where':{'id':_0x10ff7d['params']['id']}},_0x501984,_0x5f0d2b,_0x37b0bb,_0x2d5c9b,_0x196985;_0x24c067=_[_0x377a('0x3c')]({},_0x24c067,_0x10ff7d[_0x377a('0x46')]);return db[_0x377a('0x3f')][_0x377a('0x47')](_0x24c067)[_0x377a('0x23')](function(_0x2b8351){if(_0x2b8351){_0x501984=_0x2b8351;return _0x2b8351[_0x377a('0x6f')]();}return null;})[_0x377a('0x23')](function(_0x594ed6){if(_0x594ed6){if(!_0x594ed6['length']){throw new db[(_0x377a('0x70'))]['ValidationErrorItem'](_0x377a('0x71'),0x193);}_0x5f0d2b=_0x594ed6;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x377a('0x23')](function(_0x51c407){if(_0x51c407){_0x37b0bb=_['keyBy'](_0x51c407,'id');var _0x4dc220;var _0x319c20=squel[_0x377a('0x74')]();_0x319c20['from'](_0x501984[_0x377a('0x85')]);for(var _0xb6557b=0x0;_0xb6557b<_0x5f0d2b[_0x377a('0x34')];_0xb6557b+=0x1){_0x4dc220=_0x5f0d2b[_0xb6557b][_0x377a('0x76')]?_0x37b0bb[_0x5f0d2b[_0xb6557b][_0x377a('0x76')]]['metric']:_0x5f0d2b[_0xb6557b][_0x377a('0x78')];_0x4dc220=_0x5f0d2b[_0xb6557b][_0x377a('0x79')]?_[_0x377a('0x7a')](_0x3c8293[_0x5f0d2b[_0xb6557b][_0x377a('0x79')]],'%s',_0x4dc220):_0x4dc220;_0x4dc220=_0x5f0d2b[_0xb6557b][_0x377a('0x7b')]?_[_0x377a('0x7a')](_0x5ca149[_0x5f0d2b[_0xb6557b]['format']],'%s',_0x4dc220):_0x4dc220;if(_0x5f0d2b[_0xb6557b][_0x377a('0x7c')]){_0x319c20['group'](_0x4dc220);}_0x5f0d2b[_0xb6557b][_0x377a('0x7d')]&&_0x319c20[_0x377a('0x37')](_0x4dc220,_0x5f0d2b[_0xb6557b][_0x377a('0x7d')]===_0x377a('0x7e')?![]:!![]);_0x319c20[_0x377a('0x78')](_0x4dc220,_0x5f0d2b[_0xb6557b][_0x377a('0x7f')]||_0x4dc220);}if(_0x501984[_0x377a('0x80')]){_0x501984['joins']=JSON['parse'](_0x501984[_0x377a('0x80')]);for(var _0x46889e=0x0;_0x46889e<_0x501984[_0x377a('0x80')][_0x377a('0x34')];_0x46889e+=0x1){if(_0x501984['joins'][_0x46889e][_0x377a('0x3d')]&&_[_0x377a('0x65')](_0x345292,_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x3d')])&&_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x82')]&&_0x501984[_0x377a('0x80')][_0x46889e]['foreignTable']&&_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x86')]){_0x319c20[_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x3d')]](_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x83')],null,util[_0x377a('0x7b')]('%s.%s\x20=\x20%s.%s',_0x501984[_0x377a('0x85')],_0x501984['joins'][_0x46889e][_0x377a('0x82')],_0x501984['joins'][_0x46889e][_0x377a('0x83')],_0x501984[_0x377a('0x80')][_0x46889e][_0x377a('0x86')]));}}}if(_0x501984[_0x377a('0x87')]){_0x501984[_0x377a('0x87')]=JSON[_0x377a('0x81')](_0x501984['conditions']);_0x319c20['where'](_0x3f7222(_0x501984[_0x377a('0x87')][_0x377a('0x6b')]));}_0x196985=_0x319c20[_0x377a('0x91')]();_0x319c20[_0x377a('0x1c')](_0x1a5159);_0x319c20[_0x377a('0x1b')](0x0);logger[_0x377a('0x88')](_0x377a('0x89'),_0x319c20[_0x377a('0x8a')]());return db['sequelize']['query'](_0x319c20[_0x377a('0x8a')](),{'type':db[_0x377a('0x8b')]['QueryTypes'][_0x377a('0x8d')]});}})[_0x377a('0x23')](function(){return{'sql':_0x196985['toString']()};})[_0x377a('0x23')](respondWithResult(_0x5e5f26,null))['catch'](handleError(_0x5e5f26,null));}; \ No newline at end of file +var _0x3549=['orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','ValidationErrorItem','keyBy','select','groupBy','debug','web','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','run','AVG(%s)','HOUR(%s)','ROUND(%s)','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','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','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','from','table','MetricId','metric','replace','function','format'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0x3549,0x179));var _0x9354=function(_0x375921,_0x5c862e){_0x375921=_0x375921-0x0;var _0x1eba9a=_0x3549[_0x375921];return _0x1eba9a;};'use strict';var pdf=require(_0x9354('0x0'));var emlformat=require(_0x9354('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9354('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9354('0x3'));var moment=require(_0x9354('0x4'));var BPromise=require(_0x9354('0x5'));var Mustache=require(_0x9354('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9354('0x7'));var ejs=require(_0x9354('0x8'));var fs=require('fs');var _=require(_0x9354('0x9'));var squel=require(_0x9354('0xa'));var crypto=require(_0x9354('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9354('0xc'));var toCsv=require(_0x9354('0x7'));var querystring=require(_0x9354('0xd'));var Papa=require(_0x9354('0xe'));var Redis=require(_0x9354('0xf'));var authService=require(_0x9354('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9354('0x11'));var hardwareService=require(_0x9354('0x12'));var logger=require('../../config/logger')(_0x9354('0x13'));var utils=require('../../config/utils');var config=require(_0x9354('0x14'));var licenseUtil=require(_0x9354('0x15'));var db=require(_0x9354('0x16'))['db'];var dbH=require(_0x9354('0x16'))['dbH'];function respondWithStatusCode(_0x96704b,_0x1e0a89){_0x1e0a89=_0x1e0a89||0xcc;return function(_0x5f464e){if(_0x5f464e){return _0x96704b[_0x9354('0x17')](_0x1e0a89);}return _0x96704b[_0x9354('0x18')](_0x1e0a89)['end']();};}function respondWithResult(_0x9d6faf,_0x5b5d9a){_0x5b5d9a=_0x5b5d9a||0xc8;return function(_0x104700){if(_0x104700){return _0x9d6faf[_0x9354('0x18')](_0x5b5d9a)[_0x9354('0x19')](_0x104700);}};}function respondWithFilteredResult(_0x5494cf,_0x41ab57){return function(_0x115454){if(_0x115454){var _0x39a892=_0x115454[_0x9354('0x1a')],_0x56a948=_0x41ab57[_0x9354('0x1b')],_0x3f02ce=_0x41ab57[_0x9354('0x1b')]+_0x41ab57[_0x9354('0x1c')],_0x7c0c15;if(_0x3f02ce>=_0x39a892){_0x3f02ce=_0x39a892;_0x7c0c15=0xc8;}else{_0x7c0c15=0xce;}_0x5494cf[_0x9354('0x18')](_0x7c0c15);return _0x5494cf[_0x9354('0x1d')]('Content-Range',_0x56a948+'-'+_0x3f02ce+'/'+_0x39a892)[_0x9354('0x19')](_0x115454);}return null;};}function patchUpdates(_0x30b8d3){return function(_0x1a91d5){try{jsonpatch[_0x9354('0x1e')](_0x1a91d5,_0x30b8d3,!![]);}catch(_0x8729b6){return BPromise[_0x9354('0x1f')](_0x8729b6);}return _0x1a91d5[_0x9354('0x20')]();};}function saveUpdates(_0x47676b,_0x18c98a){return function(_0x5c73ec){if(_0x5c73ec){return _0x5c73ec[_0x9354('0x21')](_0x47676b)[_0x9354('0x22')](function(_0x1e6315){return _0x1e6315;});}return null;};}function removeEntity(_0x680d44,_0x141a2f){return function(_0x1e156e){if(_0x1e156e){return _0x1e156e[_0x9354('0x23')]()[_0x9354('0x22')](function(){var _0x11a245=_0x1e156e[_0x9354('0x24')]({'plain':!![]});var _0x392265='DefaultReports';return db[_0x9354('0x25')][_0x9354('0x23')]({'where':{'type':_0x392265,'resourceId':_0x11a245['id']}})['then'](function(){return _0x1e156e;});})[_0x9354('0x22')](function(){_0x680d44[_0x9354('0x18')](0xcc)[_0x9354('0x26')]();});}};}function handleEntityNotFound(_0x29113c,_0x4f90b2){return function(_0x5dc490){if(!_0x5dc490){_0x29113c[_0x9354('0x17')](0x194);}return _0x5dc490;};}function handleError(_0xe627d0,_0x3dbe20){_0x3dbe20=_0x3dbe20||0x1f4;return function(_0xb2f424){logger[_0x9354('0x27')](_0xb2f424[_0x9354('0x28')]);if(_0xb2f424[_0x9354('0x29')]){delete _0xb2f424[_0x9354('0x29')];}_0xe627d0[_0x9354('0x18')](_0x3dbe20)[_0x9354('0x2a')](_0xb2f424);};}exports[_0x9354('0x2b')]=function(_0x55407c,_0x4d8491){var _0x2f3aab={},_0x2df35a={},_0x504f61={'count':0x0,'rows':[]};var _0xf7978f=_[_0x9354('0x2c')](db[_0x9354('0x2d')][_0x9354('0x2e')],function(_0x281fc4){return{'name':_0x281fc4[_0x9354('0x2f')],'type':_0x281fc4[_0x9354('0x30')][_0x9354('0x31')]};});_0x2df35a[_0x9354('0x32')]=_[_0x9354('0x2c')](_0xf7978f,_0x9354('0x29'));_0x2df35a['query']=_['keys'](_0x55407c['query']);_0x2df35a[_0x9354('0x33')]=_[_0x9354('0x34')](_0x2df35a[_0x9354('0x32')],_0x2df35a[_0x9354('0x35')]);_0x2f3aab[_0x9354('0x36')]=_[_0x9354('0x34')](_0x2df35a['model'],qs[_0x9354('0x37')](_0x55407c[_0x9354('0x35')][_0x9354('0x37')]));_0x2f3aab[_0x9354('0x36')]=_0x2f3aab[_0x9354('0x36')][_0x9354('0x38')]?_0x2f3aab[_0x9354('0x36')]:_0x2df35a[_0x9354('0x32')];if(!_0x55407c[_0x9354('0x35')][_0x9354('0x39')](_0x9354('0x3a'))){_0x2f3aab['limit']=qs['limit'](_0x55407c[_0x9354('0x35')][_0x9354('0x1c')]);_0x2f3aab[_0x9354('0x1b')]=qs[_0x9354('0x1b')](_0x55407c[_0x9354('0x35')]['offset']);}_0x2f3aab[_0x9354('0x3b')]=qs[_0x9354('0x3c')](_0x55407c[_0x9354('0x35')][_0x9354('0x3c')]);_0x2f3aab['where']=qs[_0x9354('0x33')](_[_0x9354('0x3d')](_0x55407c[_0x9354('0x35')],_0x2df35a[_0x9354('0x33')]),_0xf7978f);if(_0x55407c[_0x9354('0x35')][_0x9354('0x3e')]){_0x2f3aab[_0x9354('0x3f')]=_[_0x9354('0x40')](_0x2f3aab[_0x9354('0x3f')],{'$or':_[_0x9354('0x2c')](_0xf7978f,function(_0x50eaec){if(_0x50eaec[_0x9354('0x30')]!=='VIRTUAL'){var _0x586ea5={};_0x586ea5[_0x50eaec[_0x9354('0x29')]]={'$like':'%'+_0x55407c[_0x9354('0x35')][_0x9354('0x3e')]+'%'};return _0x586ea5;}})});}_0x2f3aab=_[_0x9354('0x40')]({},_0x2f3aab,_0x55407c[_0x9354('0x41')]);var _0x329013={'where':_0x2f3aab[_0x9354('0x3f')]};return db[_0x9354('0x2d')][_0x9354('0x1a')](_0x329013)[_0x9354('0x22')](function(_0x4304af){_0x504f61['count']=_0x4304af;if(_0x55407c[_0x9354('0x35')]['includeAll']){_0x2f3aab[_0x9354('0x42')]=[{'all':!![]}];}return db[_0x9354('0x2d')][_0x9354('0x43')](_0x2f3aab);})[_0x9354('0x22')](function(_0x2b9b95){_0x504f61['rows']=_0x2b9b95;return _0x504f61;})[_0x9354('0x22')](respondWithFilteredResult(_0x4d8491,_0x2f3aab))[_0x9354('0x44')](handleError(_0x4d8491,null));};exports[_0x9354('0x45')]=function(_0x19975a,_0x589f9d){var _0x2c0aee={'raw':!![],'where':{'id':_0x19975a[_0x9354('0x46')]['id']}},_0x455bd5={};_0x455bd5[_0x9354('0x32')]=_[_0x9354('0x47')](db['AnalyticDefaultReport'][_0x9354('0x2e')]);_0x455bd5[_0x9354('0x35')]=_['keys'](_0x19975a[_0x9354('0x35')]);_0x455bd5[_0x9354('0x33')]=_[_0x9354('0x34')](_0x455bd5[_0x9354('0x32')],_0x455bd5['query']);_0x2c0aee[_0x9354('0x36')]=_[_0x9354('0x34')](_0x455bd5[_0x9354('0x32')],qs[_0x9354('0x37')](_0x19975a['query']['fields']));_0x2c0aee[_0x9354('0x36')]=_0x2c0aee[_0x9354('0x36')][_0x9354('0x38')]?_0x2c0aee['attributes']:_0x455bd5[_0x9354('0x32')];if(_0x19975a[_0x9354('0x35')][_0x9354('0x48')]){_0x2c0aee[_0x9354('0x42')]=[{'all':!![]}];}_0x2c0aee=_[_0x9354('0x40')]({},_0x2c0aee,_0x19975a[_0x9354('0x41')]);return db[_0x9354('0x2d')][_0x9354('0x49')](_0x2c0aee)[_0x9354('0x22')](handleEntityNotFound(_0x589f9d,null))[_0x9354('0x22')](respondWithResult(_0x589f9d,null))[_0x9354('0x44')](handleError(_0x589f9d,null));};exports['create']=function(_0x3f3555,_0x3e6cee){return db[_0x9354('0x2d')][_0x9354('0x4a')](_0x3f3555[_0x9354('0x4b')],{})[_0x9354('0x22')](function(_0x5562bb){var _0x216668=_0x3f3555[_0x9354('0x4c')][_0x9354('0x24')]({'plain':!![]});if(!_0x216668)throw new Error(_0x9354('0x4d'));if(_0x216668[_0x9354('0x4e')]===_0x9354('0x4c')){var _0xd68920=_0x5562bb[_0x9354('0x24')]({'plain':!![]});var _0x14d32c=_0x9354('0x4f');return db[_0x9354('0x50')][_0x9354('0x49')]({'where':{'name':_0x14d32c,'userProfileId':_0x216668[_0x9354('0x51')]},'raw':!![]})[_0x9354('0x22')](function(_0x51a7bb){if(_0x51a7bb&&_0x51a7bb[_0x9354('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0xd68920[_0x9354('0x29')],'resourceId':_0xd68920['id'],'type':'DefaultReports','sectionId':_0x51a7bb['id']},{})[_0x9354('0x22')](function(){return _0x5562bb;});}else{return _0x5562bb;}})['catch'](function(_0x51fa71){logger[_0x9354('0x27')](_0x9354('0x53'),_0x51fa71);throw _0x51fa71;});}return _0x5562bb;})['then'](respondWithResult(_0x3e6cee,0xc9))[_0x9354('0x44')](handleError(_0x3e6cee,null));};exports[_0x9354('0x21')]=function(_0x36184a,_0x53284c){if(_0x36184a[_0x9354('0x4b')]['id']){delete _0x36184a[_0x9354('0x4b')]['id'];}return db[_0x9354('0x2d')][_0x9354('0x49')]({'where':{'id':_0x36184a[_0x9354('0x46')]['id']}})[_0x9354('0x22')](handleEntityNotFound(_0x53284c,null))['then'](saveUpdates(_0x36184a[_0x9354('0x4b')],null))[_0x9354('0x22')](respondWithResult(_0x53284c,null))[_0x9354('0x44')](handleError(_0x53284c,null));};exports[_0x9354('0x23')]=function(_0x3e4912,_0x56673f){return db[_0x9354('0x2d')][_0x9354('0x49')]({'where':{'id':_0x3e4912[_0x9354('0x46')]['id']}})[_0x9354('0x22')](handleEntityNotFound(_0x56673f,null))['then'](removeEntity(_0x56673f,null))[_0x9354('0x44')](handleError(_0x56673f,null));};exports[_0x9354('0x54')]=function(_0x1ed0cd,_0x40c8d5){var _0x505b4c=0xa;var _0xb3def9=['join',_0x9354('0x55'),_0x9354('0x56'),_0x9354('0x57')];var _0x4a3e5d={'SUM':'SUM(%s)','COUNT':_0x9354('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9354('0x59'),'MIN':_0x9354('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9354('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9354('0x5c')};var _0x5b3433={'SEC_TO_TIME':_0x9354('0x5d'),'DATE':_0x9354('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9354('0x5f')};var _0x50e5f3=function(_0x51f6f6){return!_['includes']([_0x9354('0x60'),_0x9354('0x61'),'IS\x20EMPTY',_0x9354('0x62')],_0x51f6f6);};var _0x2d0f68=function(_0x1df7ba){if(!_0x1df7ba||!_0x1df7ba[_0x9354('0x63')][_0x9354('0x38')]){return'';}for(var _0x28fad9='(',_0x51d1c1=0x0;_0x51d1c1<_0x1df7ba[_0x9354('0x63')][_0x9354('0x38')];_0x51d1c1+=0x1){_0x51d1c1>0x0&&(_0x28fad9+='\x20'+_0x1df7ba[_0x9354('0x64')]+'\x20');_0x28fad9+=_0x1df7ba['rules'][_0x51d1c1][_0x9354('0x65')]?_0x2d0f68(_0x1df7ba['rules'][_0x51d1c1][_0x9354('0x65')]):_0x1df7ba['rules'][_0x51d1c1][_0x9354('0x66')]+'\x20'+_0x1df7ba[_0x9354('0x63')][_0x51d1c1][_0x9354('0x67')]+(_0x50e5f3(_0x1df7ba[_0x9354('0x63')][_0x51d1c1][_0x9354('0x67')])?'\x20'+_0x1df7ba[_0x9354('0x63')][_0x51d1c1][_0x9354('0x68')]:'');}return _0x28fad9+')';};var _0x2b9306={'where':{'id':_0x1ed0cd[_0x9354('0x46')]['id']}},_0x10736e,_0x3cae02,_0x15c9b1,_0x82122f,_0x2ccef2;_0x2b9306=_[_0x9354('0x40')]({},_0x2b9306,_0x1ed0cd[_0x9354('0x41')]);return db['AnalyticDefaultReport'][_0x9354('0x49')](_0x2b9306)[_0x9354('0x22')](function(_0x2e8f75){if(_0x2e8f75){_0x10736e=_0x2e8f75;return _0x2e8f75[_0x9354('0x69')]();}return null;})[_0x9354('0x22')](function(_0x49b24b){if(_0x49b24b){if(!_0x49b24b[_0x9354('0x38')]){throw new db[(_0x9354('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cae02=_0x49b24b;return db[_0x9354('0x6b')][_0x9354('0x43')]({'raw':!![]});}return null;})[_0x9354('0x22')](function(_0x2ef277){if(_0x2ef277){_0x15c9b1=_['keyBy'](_0x2ef277,'id');var _0x26809e;var _0x3b22d0=squel['select']();_0x3b22d0[_0x9354('0x6c')](_0x10736e[_0x9354('0x6d')]);for(var _0x2b893e=0x0;_0x2b893e<_0x3cae02[_0x9354('0x38')];_0x2b893e+=0x1){_0x26809e=_0x3cae02[_0x2b893e][_0x9354('0x6e')]?_0x15c9b1[_0x3cae02[_0x2b893e][_0x9354('0x6e')]][_0x9354('0x6f')]:_0x3cae02[_0x2b893e][_0x9354('0x66')];_0x26809e=_0x3cae02[_0x2b893e]['function']?_[_0x9354('0x70')](_0x4a3e5d[_0x3cae02[_0x2b893e][_0x9354('0x71')]],'%s',_0x26809e):_0x26809e;_0x26809e=_0x3cae02[_0x2b893e][_0x9354('0x72')]?_['replace'](_0x5b3433[_0x3cae02[_0x2b893e]['format']],'%s',_0x26809e):_0x26809e;if(_0x3cae02[_0x2b893e]['groupBy']){_0x3b22d0[_0x9354('0x65')](_0x26809e);}_0x3cae02[_0x2b893e][_0x9354('0x73')]&&_0x3b22d0['order'](_0x26809e,_0x3cae02[_0x2b893e]['orderBy']===_0x9354('0x74')?![]:!![]);_0x3b22d0[_0x9354('0x66')](_0x26809e,_0x3cae02[_0x2b893e][_0x9354('0x75')]||_0x26809e);}if(_0x10736e[_0x9354('0x76')]){_0x10736e['joins']=JSON[_0x9354('0x77')](_0x10736e['joins']);for(var _0x45ba38=0x0;_0x45ba38<_0x10736e[_0x9354('0x76')][_0x9354('0x38')];_0x45ba38+=0x1){if(_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x30')]&&_[_0x9354('0x78')](_0xb3def9,_0x10736e['joins'][_0x45ba38]['type'])&&_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x79')]&&_0x10736e['joins'][_0x45ba38][_0x9354('0x7a')]&&_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x7b')]){_0x3b22d0[_0x10736e['joins'][_0x45ba38][_0x9354('0x30')]](_0x10736e[_0x9354('0x76')][_0x45ba38]['foreignTable'],null,util[_0x9354('0x72')](_0x9354('0x7c'),_0x10736e[_0x9354('0x6d')],_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x79')],_0x10736e[_0x9354('0x76')][_0x45ba38][_0x9354('0x7a')],_0x10736e[_0x9354('0x76')][_0x45ba38]['foreignKey']));}}}if(_0x10736e[_0x9354('0x7d')]){_0x10736e[_0x9354('0x7d')]=JSON[_0x9354('0x77')](_0x10736e[_0x9354('0x7d')]);_0x3b22d0['where'](_0x2d0f68(_0x10736e[_0x9354('0x7d')][_0x9354('0x65')]));}_0x2ccef2=_0x3b22d0[_0x9354('0x7e')]();_0x3b22d0['limit'](_0x505b4c);_0x3b22d0[_0x9354('0x1b')](0x0);logger['debug'](_0x9354('0x7f'),_0x3b22d0[_0x9354('0x80')]());return db[_0x9354('0x81')]['query'](_0x3b22d0[_0x9354('0x80')](),{'type':db['sequelize'][_0x9354('0x82')][_0x9354('0x83')]});}})[_0x9354('0x22')](respondWithResult(_0x40c8d5,null))[_0x9354('0x44')](handleError(_0x40c8d5,null));};function runReport(_0x4e21e4,_0x2ce213,_0x466b83){var _0x2893d6=_0x2ce213[_0x9354('0x29')];var _0x40ec3f=0xa;var _0xa780fe=['join',_0x9354('0x55'),'right_join',_0x9354('0x57')];var _0x423598={'SUM':_0x9354('0x84'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9354('0x85'),'MAX':_0x9354('0x59'),'MIN':_0x9354('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9354('0x5c')};var _0x211816={'SEC_TO_TIME':_0x9354('0x5d'),'DATE':_0x9354('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9354('0x5f')};var _0x3f7ef9=function(_0x1241c0){return!_[_0x9354('0x78')]([_0x9354('0x60'),'IS\x20NOT\x20NULL',_0x9354('0x86'),_0x9354('0x62')],_0x1241c0);};var _0x16771d=function(_0x3a30e1){if(!_0x3a30e1||!_0x3a30e1[_0x9354('0x63')][_0x9354('0x38')]){return'';}for(var _0x3dcfb6='(',_0x538499=0x0;_0x538499<_0x3a30e1[_0x9354('0x63')][_0x9354('0x38')];_0x538499+=0x1){_0x538499>0x0&&(_0x3dcfb6+='\x20'+_0x3a30e1[_0x9354('0x64')]+'\x20');_0x3dcfb6+=_0x3a30e1['rules'][_0x538499][_0x9354('0x65')]?_0x16771d(_0x3a30e1[_0x9354('0x63')][_0x538499]['group']):_0x3a30e1['rules'][_0x538499]['field']+'\x20'+_0x3a30e1['rules'][_0x538499]['condition']+(_0x3f7ef9(_0x3a30e1[_0x9354('0x63')][_0x538499]['condition'])?'\x20'+_0x3a30e1[_0x9354('0x63')][_0x538499]['value']:'');}return _0x3dcfb6+')';};var _0x270e38={'where':{'id':_0x4e21e4['id']}},_0x2743a4,_0x28cea0,_0x190f93,_0x557706,_0x47f024;_0x270e38=_[_0x9354('0x40')]({},_0x270e38,_0x466b83);return db['AnalyticDefaultReport'][_0x9354('0x49')](_0x270e38)[_0x9354('0x22')](function(_0x24728f){if(_0x24728f){_0x2743a4=_0x24728f;return _0x24728f['getFields']();}return null;})['then'](function(_0x2a3aaf){if(_0x2a3aaf){if(!_0x2a3aaf[_0x9354('0x38')]){throw new db[(_0x9354('0x6a'))][(_0x9354('0x87'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x28cea0=_0x2a3aaf;return db['AnalyticMetric'][_0x9354('0x43')]({'raw':!![]});}return null;})[_0x9354('0x22')](function(_0x33f738){if(_0x33f738){_0x190f93=_[_0x9354('0x88')](_0x33f738,'id');var _0xeeaf81;var _0x59ca22=squel[_0x9354('0x89')]();_0x59ca22[_0x9354('0x6c')](_0x2743a4[_0x9354('0x6d')]);for(var _0x43b0e9=0x0;_0x43b0e9<_0x28cea0[_0x9354('0x38')];_0x43b0e9+=0x1){_0xeeaf81=_0x28cea0[_0x43b0e9][_0x9354('0x6e')]?_0x190f93[_0x28cea0[_0x43b0e9][_0x9354('0x6e')]][_0x9354('0x6f')]:_0x28cea0[_0x43b0e9]['field'];_0xeeaf81=_0x28cea0[_0x43b0e9][_0x9354('0x71')]?_[_0x9354('0x70')](_0x423598[_0x28cea0[_0x43b0e9]['function']],'%s',_0xeeaf81):_0xeeaf81;_0xeeaf81=_0x28cea0[_0x43b0e9][_0x9354('0x72')]?_[_0x9354('0x70')](_0x211816[_0x28cea0[_0x43b0e9][_0x9354('0x72')]],'%s',_0xeeaf81):_0xeeaf81;if(_0x28cea0[_0x43b0e9][_0x9354('0x8a')]){_0x59ca22['group'](_0xeeaf81);}_0x28cea0[_0x43b0e9][_0x9354('0x73')]&&_0x59ca22[_0x9354('0x3b')](_0xeeaf81,_0x28cea0[_0x43b0e9]['orderBy']===_0x9354('0x74')?![]:!![]);_0x59ca22[_0x9354('0x66')](_0xeeaf81,_0x28cea0[_0x43b0e9][_0x9354('0x75')]||_0xeeaf81);}if(_0x2743a4['joins']){_0x2743a4['joins']=JSON[_0x9354('0x77')](_0x2743a4[_0x9354('0x76')]);for(var _0x18451=0x0;_0x18451<_0x2743a4['joins'][_0x9354('0x38')];_0x18451+=0x1){if(_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x30')]&&_[_0x9354('0x78')](_0xa780fe,_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x30')])&&_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x79')]&&_0x2743a4['joins'][_0x18451][_0x9354('0x7a')]&&_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x7b')]){_0x59ca22[_0x2743a4[_0x9354('0x76')][_0x18451][_0x9354('0x30')]](_0x2743a4['joins'][_0x18451][_0x9354('0x7a')],null,util[_0x9354('0x72')]('%s.%s\x20=\x20%s.%s',_0x2743a4[_0x9354('0x6d')],_0x2743a4[_0x9354('0x76')][_0x18451]['parentKey'],_0x2743a4['joins'][_0x18451]['foreignTable'],_0x2743a4[_0x9354('0x76')][_0x18451]['foreignKey']));}}}if(_0x2743a4[_0x9354('0x7d')]){_0x2743a4[_0x9354('0x7d')]=JSON[_0x9354('0x77')](_0x2743a4[_0x9354('0x7d')]);_0x59ca22[_0x9354('0x3f')](_0x16771d(_0x2743a4[_0x9354('0x7d')][_0x9354('0x65')]));}_0x47f024=_0x59ca22['clone']();_0x59ca22['limit'](_0x40ec3f);_0x59ca22[_0x9354('0x1b')](0x0);logger[_0x9354('0x8b')]('Limited\x20Query:',_0x59ca22['toString']());return db['sequelize']['query'](_0x59ca22['toString'](),{'type':db[_0x9354('0x81')][_0x9354('0x82')][_0x9354('0x83')]});}})[_0x9354('0x22')](function(_0x55586d){if(!_0x55586d[_0x9354('0x38')]){throw new db['Sequelize'][(_0x9354('0x87'))]('No\x20available\x20data',0xcc);}if(_0x2ce213['output']===_0x9354('0x8c')){return null;}var _0x449bea=_[_0x9354('0x40')](_0x2ce213,{'name':_0x2ce213['fullPath']||_0x2ce213[_0x9354('0x29')]||_0x2743a4[_0x9354('0x29')],'basename':_0x2893d6,'savename':util['format'](_0x9354('0x8d'),_0x2ce213[_0x9354('0x29')]||_0x2743a4[_0x9354('0x29')],require(_0x9354('0x8e'))[_0x9354('0x8f')](0x4),_0x2ce213['output']||_0x9354('0x90')),'reportId':_0x2743a4['id'],'reportType':_0x9354('0x91')});return db[_0x9354('0x92')][_0x9354('0x4a')](_0x449bea,{'raw':!![]});})[_0x9354('0x22')](function(_0x3fbaf5){if(_0x2743a4['table']===_0x9354('0x93')){_0x47f024[_0x9354('0x3f')](_0x2743a4[_0x9354('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2ce213[_0x9354('0x94')],_0x2ce213[_0x9354('0x95')]);}else{_0x47f024[_0x9354('0x3f')](_0x2743a4[_0x9354('0x6d')]+_0x9354('0x96'),_0x2ce213[_0x9354('0x94')],_0x2ce213[_0x9354('0x95')]);}if(_0x3fbaf5){logger[_0x9354('0x97')](_0x9354('0x98'),_0x47f024[_0x9354('0x80')]());require('child_process')[_0x9354('0x99')](path['join'](__dirname,_0x9354('0x9a'),_0x3fbaf5[_0x9354('0x9b')]),[_0x3fbaf5['id'],_0x47f024[_0x9354('0x80')](),path['join'](__dirname,_0x9354('0x9c'),_0x3fbaf5[_0x9354('0x9d')]),_0x2893d6]);return _0x3fbaf5;}else{var _0x4a8017=squel[_0x9354('0x89')]();_0x4a8017[_0x9354('0x6c')]('('+_0x47f024[_0x9354('0x80')]()+')',_0x9354('0x9e'));_0x4a8017['field'](_0x9354('0x9f'),_0x9354('0x1a'));_0x47f024[_0x9354('0x1c')](_0x2ce213[_0x9354('0x1c')]||_0x40ec3f);_0x47f024[_0x9354('0x1b')](_0x2ce213[_0x9354('0x1b')]||0x0);return dbH['sequelize']['query'](_0x4a8017[_0x9354('0x80')](),{'type':dbH[_0x9354('0x81')]['QueryTypes'][_0x9354('0x83')]})[_0x9354('0x22')](function(_0x5f0474){if(!_0x5f0474[_0x9354('0x38')]){_0x557706=0x0;}else{_0x557706=_0x5f0474[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x47f024[_0x9354('0x80')](),{'type':dbH[_0x9354('0x81')]['QueryTypes'][_0x9354('0x83')]});})[_0x9354('0x22')](function(_0x418ec1){return{'rows':_0x418ec1||[],'count':_0x557706};});}});}exports[_0x9354('0xa0')]=function(_0x4f377f,_0x55c6fc){return runReport(_0x4f377f[_0x9354('0x46')],_0x4f377f[_0x9354('0x35')],_0x4f377f[_0x9354('0x41')])[_0x9354('0x22')](respondWithResult(_0x55c6fc,null))[_0x9354('0x44')](handleError(_0x55c6fc,null));};exports['runReport']=runReport;exports[_0x9354('0x35')]=function(_0x320e33,_0x5958d4){var _0x1f2e1e=0xa;var _0x6e95c5=['join',_0x9354('0x55'),'right_join',_0x9354('0x57')];var _0x45e766={'SUM':'SUM(%s)','COUNT':_0x9354('0x58'),'COUNT DISTINCT':_0x9354('0x85'),'MAX':_0x9354('0x59'),'MIN':_0x9354('0x5a'),'AVG':_0x9354('0xa1'),'GROUP_CONCAT':_0x9354('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc43b55={'SEC_TO_TIME':_0x9354('0x5d'),'DATE':'DATE(%s)','HOUR':_0x9354('0xa2'),'ROUND':_0x9354('0xa3'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x51e66b=function(_0x16e279){return!_[_0x9354('0x78')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x9354('0x86'),_0x9354('0x62')],_0x16e279);};var _0x287bbf=function(_0xd540b6){if(!_0xd540b6||!_0xd540b6[_0x9354('0x63')][_0x9354('0x38')]){return'';}for(var _0x2e0195='(',_0x20f770=0x0;_0x20f770<_0xd540b6[_0x9354('0x63')][_0x9354('0x38')];_0x20f770+=0x1){_0x20f770>0x0&&(_0x2e0195+='\x20'+_0xd540b6[_0x9354('0x64')]+'\x20');_0x2e0195+=_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x65')]?_0x287bbf(_0xd540b6[_0x9354('0x63')][_0x20f770]['group']):_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x66')]+'\x20'+_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x67')]+(_0x51e66b(_0xd540b6[_0x9354('0x63')][_0x20f770]['condition'])?'\x20'+_0xd540b6[_0x9354('0x63')][_0x20f770][_0x9354('0x68')]:'');}return _0x2e0195+')';};var _0x2f2283={'where':{'id':_0x320e33['params']['id']}},_0x592e4c,_0x2ca80d,_0x35baa7,_0x3e0b88,_0x595012;_0x2f2283=_[_0x9354('0x40')]({},_0x2f2283,_0x320e33[_0x9354('0x41')]);return db[_0x9354('0x2d')][_0x9354('0x49')](_0x2f2283)[_0x9354('0x22')](function(_0x6ac0ac){if(_0x6ac0ac){_0x592e4c=_0x6ac0ac;return _0x6ac0ac[_0x9354('0x69')]();}return null;})[_0x9354('0x22')](function(_0x120645){if(_0x120645){if(!_0x120645[_0x9354('0x38')]){throw new db[(_0x9354('0x6a'))][(_0x9354('0x87'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2ca80d=_0x120645;return db[_0x9354('0x6b')][_0x9354('0x43')]({'raw':!![]});}return null;})[_0x9354('0x22')](function(_0x58d605){if(_0x58d605){_0x35baa7=_[_0x9354('0x88')](_0x58d605,'id');var _0x1cdb2f;var _0x14b7b4=squel[_0x9354('0x89')]();_0x14b7b4[_0x9354('0x6c')](_0x592e4c[_0x9354('0x6d')]);for(var _0x304ad2=0x0;_0x304ad2<_0x2ca80d[_0x9354('0x38')];_0x304ad2+=0x1){_0x1cdb2f=_0x2ca80d[_0x304ad2][_0x9354('0x6e')]?_0x35baa7[_0x2ca80d[_0x304ad2][_0x9354('0x6e')]][_0x9354('0x6f')]:_0x2ca80d[_0x304ad2]['field'];_0x1cdb2f=_0x2ca80d[_0x304ad2]['function']?_[_0x9354('0x70')](_0x45e766[_0x2ca80d[_0x304ad2]['function']],'%s',_0x1cdb2f):_0x1cdb2f;_0x1cdb2f=_0x2ca80d[_0x304ad2][_0x9354('0x72')]?_[_0x9354('0x70')](_0xc43b55[_0x2ca80d[_0x304ad2]['format']],'%s',_0x1cdb2f):_0x1cdb2f;if(_0x2ca80d[_0x304ad2][_0x9354('0x8a')]){_0x14b7b4[_0x9354('0x65')](_0x1cdb2f);}_0x2ca80d[_0x304ad2][_0x9354('0x73')]&&_0x14b7b4['order'](_0x1cdb2f,_0x2ca80d[_0x304ad2][_0x9354('0x73')]===_0x9354('0x74')?![]:!![]);_0x14b7b4[_0x9354('0x66')](_0x1cdb2f,_0x2ca80d[_0x304ad2]['alias']||_0x1cdb2f);}if(_0x592e4c['joins']){_0x592e4c[_0x9354('0x76')]=JSON['parse'](_0x592e4c[_0x9354('0x76')]);for(var _0x283f68=0x0;_0x283f68<_0x592e4c[_0x9354('0x76')][_0x9354('0x38')];_0x283f68+=0x1){if(_0x592e4c['joins'][_0x283f68][_0x9354('0x30')]&&_[_0x9354('0x78')](_0x6e95c5,_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x30')])&&_0x592e4c[_0x9354('0x76')][_0x283f68]['parentKey']&&_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x7a')]&&_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x7b')]){_0x14b7b4[_0x592e4c[_0x9354('0x76')][_0x283f68]['type']](_0x592e4c['joins'][_0x283f68][_0x9354('0x7a')],null,util['format'](_0x9354('0x7c'),_0x592e4c['table'],_0x592e4c[_0x9354('0x76')][_0x283f68]['parentKey'],_0x592e4c[_0x9354('0x76')][_0x283f68]['foreignTable'],_0x592e4c[_0x9354('0x76')][_0x283f68][_0x9354('0x7b')]));}}}if(_0x592e4c[_0x9354('0x7d')]){_0x592e4c[_0x9354('0x7d')]=JSON[_0x9354('0x77')](_0x592e4c['conditions']);_0x14b7b4['where'](_0x287bbf(_0x592e4c['conditions']['group']));}_0x595012=_0x14b7b4[_0x9354('0x7e')]();_0x14b7b4['limit'](_0x1f2e1e);_0x14b7b4[_0x9354('0x1b')](0x0);logger[_0x9354('0x8b')](_0x9354('0x7f'),_0x14b7b4[_0x9354('0x80')]());return db[_0x9354('0x81')][_0x9354('0x35')](_0x14b7b4[_0x9354('0x80')](),{'type':db[_0x9354('0x81')][_0x9354('0x82')][_0x9354('0x83')]});}})[_0x9354('0x22')](function(){return{'sql':_0x595012[_0x9354('0x80')]()};})[_0x9354('0x22')](respondWithResult(_0x5958d4,null))['catch'](handleError(_0x5958d4,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ee28866..26d8d0e 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 _0x0460=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x3683db,_0x589556){var _0x3b07c5=function(_0x29f856){while(--_0x29f856){_0x3683db['push'](_0x3683db['shift']());}};_0x3b07c5(++_0x589556);}(_0x0460,0xab));var _0x0046=function(_0xa4affe,_0x1d1398){_0xa4affe=_0xa4affe-0x0;var _0x402bab=_0x0460[_0xa4affe];return _0x402bab;};'use strict';var _=require(_0x0046('0x0'));var util=require(_0x0046('0x1'));var logger=require(_0x0046('0x2'))('api');var moment=require(_0x0046('0x3'));var BPromise=require(_0x0046('0x4'));var rp=require(_0x0046('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0046('0x6'));var config=require('../../config/environment');var attributes=require(_0x0046('0x7'));module[_0x0046('0x8')]=function(_0x21ec7c,_0x2aee0d){return _0x21ec7c[_0x0046('0x9')](_0x0046('0xa'),attributes,{'tableName':_0x0046('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6055=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6055,0x15e));var _0x5605=function(_0x33727e,_0x4b8475){_0x33727e=_0x33727e-0x0;var _0x96ecb4=_0x6055[_0x33727e];return _0x96ecb4;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var logger=require(_0x5605('0x2'))(_0x5605('0x3'));var moment=require(_0x5605('0x4'));var BPromise=require(_0x5605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x6'));var rimraf=require(_0x5605('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x5605('0x8')]=function(_0x4b8056,_0x5c64fe){return _0x4b8056[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':_0x5605('0xb'),'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 21c0728..a584a48 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 _0x5b05=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x27262a,_0x4de20c){var _0x514f44=function(_0x1a7132){while(--_0x1a7132){_0x27262a['push'](_0x27262a['shift']());}};_0x514f44(++_0x4de20c);}(_0x5b05,0x190));var _0x55b0=function(_0x2e36df,_0x455689){_0x2e36df=_0x2e36df-0x0;var _0x43bca3=_0x5b05[_0x2e36df];return _0x43bca3;};'use strict';var _=require('lodash');var util=require(_0x55b0('0x0'));var moment=require(_0x55b0('0x1'));var BPromise=require(_0x55b0('0x2'));var rs=require(_0x55b0('0x3'));var fs=require('fs');var Redis=require(_0x55b0('0x4'));var db=require(_0x55b0('0x5'))['db'];var utils=require(_0x55b0('0x6'));var logger=require(_0x55b0('0x7'))(_0x55b0('0x8'));var config=require(_0x55b0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0c407,_0x46c475,_0x355e20){return new BPromise(function(_0xdf375f,_0x598abf){return client[_0x55b0('0xb')](_0xe0c407,_0x355e20)[_0x55b0('0xc')](function(_0xc1d43){logger[_0x55b0('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x46c475,'request\x20sent');logger[_0x55b0('0xe')](_0x55b0('0xf'),_0x46c475,_0x55b0('0x10'),JSON[_0x55b0('0x11')](_0xc1d43));if(_0xc1d43[_0x55b0('0x12')]){if(_0xc1d43[_0x55b0('0x12')]['code']===0x1f4){logger[_0x55b0('0x12')](_0x55b0('0x13'),_0x46c475,_0xc1d43['error'][_0x55b0('0x14')]);return _0x598abf(_0xc1d43[_0x55b0('0x12')][_0x55b0('0x14')]);}logger[_0x55b0('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x46c475,_0xc1d43['error']['message']);return _0xdf375f(_0xc1d43[_0x55b0('0x12')]['message']);}else{logger[_0x55b0('0xd')](_0x55b0('0x13'),_0x46c475,'request\x20sent');_0xdf375f(_0xc1d43[_0x55b0('0x15')][_0x55b0('0x14')]);}})[_0x55b0('0x16')](function(_0x947f96){logger[_0x55b0('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x46c475,_0x947f96);_0x598abf(_0x947f96);});});} \ No newline at end of file +var _0x515d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x594b52,_0x232e60){var _0x36b369=function(_0x5b421e){while(--_0x5b421e){_0x594b52['push'](_0x594b52['shift']());}};_0x36b369(++_0x232e60);}(_0x515d,0x104));var _0xd515=function(_0x4df974,_0x46b306){_0x4df974=_0x4df974-0x0;var _0x39bf27=_0x515d[_0x4df974];return _0x39bf27;};'use strict';var _=require('lodash');var util=require(_0xd515('0x0'));var moment=require(_0xd515('0x1'));var BPromise=require(_0xd515('0x2'));var rs=require(_0xd515('0x3'));var fs=require('fs');var Redis=require(_0xd515('0x4'));var db=require(_0xd515('0x5'))['db'];var utils=require(_0xd515('0x6'));var logger=require(_0xd515('0x7'))('rpc');var config=require(_0xd515('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd515('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1130fc,_0x43d633,_0x26a25d){return new BPromise(function(_0x2ec6e2,_0x55a0da){return client[_0xd515('0xa')](_0x1130fc,_0x26a25d)[_0xd515('0xb')](function(_0x138086){logger[_0xd515('0xc')](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));logger['debug'](_0xd515('0xf'),_0x43d633,_0xd515('0xe'),JSON[_0xd515('0x10')](_0x138086));if(_0x138086[_0xd515('0x11')]){if(_0x138086['error'][_0xd515('0x12')]===0x1f4){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x55a0da(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x138086[_0xd515('0x11')][_0xd515('0x13')]);return _0x2ec6e2(_0x138086[_0xd515('0x11')][_0xd515('0x13')]);}else{logger['info'](_0xd515('0xd'),_0x43d633,_0xd515('0xe'));_0x2ec6e2(_0x138086[_0xd515('0x14')][_0xd515('0x13')]);}})[_0xd515('0x15')](function(_0x33dbb6){logger[_0xd515('0x11')](_0xd515('0xd'),_0x43d633,_0x33dbb6);_0x55a0da(_0x33dbb6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3b3a326..e119d50 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 _0x17a8=['/:id/run','run','/:id/query','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','/:id/preview'];(function(_0x33f3dd,_0x4d3df7){var _0x4a91b6=function(_0x295fd2){while(--_0x295fd2){_0x33f3dd['push'](_0x33f3dd['shift']());}};_0x4a91b6(++_0x4d3df7);}(_0x17a8,0x7b));var _0x817a=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0x17a8[_0x12c076];return _0x2ddd18;};'use strict';var multer=require(_0x817a('0x0'));var util=require(_0x817a('0x1'));var path=require(_0x817a('0x2'));var timeout=require(_0x817a('0x3'));var express=require(_0x817a('0x4'));var router=express[_0x817a('0x5')]();var auth=require(_0x817a('0x6'));var interaction=require(_0x817a('0x7'));var config=require(_0x817a('0x8'));var controller=require(_0x817a('0x9'));router[_0x817a('0xa')]('/',auth['isAuthenticated'](),controller[_0x817a('0xb')]);router[_0x817a('0xa')](_0x817a('0xc'),auth[_0x817a('0xd')](),controller['show']);router['get'](_0x817a('0xe'),auth[_0x817a('0xd')](),controller['preview']);router[_0x817a('0xa')](_0x817a('0xf'),auth[_0x817a('0xd')](),controller[_0x817a('0x10')]);router[_0x817a('0xa')](_0x817a('0x11'),auth[_0x817a('0xd')](),controller['query']);router[_0x817a('0x12')]('/',auth[_0x817a('0xd')](),controller[_0x817a('0x13')]);router[_0x817a('0x14')](_0x817a('0xc'),auth[_0x817a('0xd')](),controller['update']);router[_0x817a('0x15')]('/:id',auth[_0x817a('0xd')](),controller['destroy']);module[_0x817a('0x16')]=router; \ No newline at end of file +var _0x94d9=['../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x395b5f,_0x484d26){var _0x326e43=function(_0x6c670e){while(--_0x6c670e){_0x395b5f['push'](_0x395b5f['shift']());}};_0x326e43(++_0x484d26);}(_0x94d9,0x1c5));var _0x994d=function(_0x5c07c0,_0x520c4f){_0x5c07c0=_0x5c07c0-0x0;var _0xbed828=_0x94d9[_0x5c07c0];return _0xbed828;};'use strict';var multer=require('multer');var util=require(_0x994d('0x0'));var path=require(_0x994d('0x1'));var timeout=require(_0x994d('0x2'));var express=require(_0x994d('0x3'));var router=express[_0x994d('0x4')]();var auth=require(_0x994d('0x5'));var interaction=require(_0x994d('0x6'));var config=require(_0x994d('0x7'));var controller=require(_0x994d('0x8'));router[_0x994d('0x9')]('/',auth[_0x994d('0xa')](),controller[_0x994d('0xb')]);router[_0x994d('0x9')](_0x994d('0xc'),auth[_0x994d('0xa')](),controller[_0x994d('0xd')]);router['get'](_0x994d('0xe'),auth['isAuthenticated'](),controller[_0x994d('0xf')]);router[_0x994d('0x9')](_0x994d('0x10'),auth[_0x994d('0xa')](),controller[_0x994d('0x11')]);router['get'](_0x994d('0x12'),auth['isAuthenticated'](),controller[_0x994d('0x13')]);router['post']('/',auth[_0x994d('0xa')](),controller['create']);router[_0x994d('0x14')](_0x994d('0xc'),auth[_0x994d('0xa')](),controller[_0x994d('0x15')]);router['delete'](_0x994d('0xc'),auth[_0x994d('0xa')](),controller[_0x994d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 9dfc560..4873284 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 _0x932b=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','DATE'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x932b,0x10c));var _0xb932=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x932b[_0x5f36cd];return _0x49832a;};'use strict';var Sequelize=require(_0xb932('0x0'));var moment=require(_0xb932('0x1'));module['exports']={'name':{'type':Sequelize[_0xb932('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xb932('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xb932('0x3')](_0xb932('0x4'),_0xb932('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xb932('0x4')},'savename':{'type':Sequelize[_0xb932('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb932('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb932('0x3')](_0xb932('0x7'),_0xb932('0x8')),'allowNull':![],'defaultValue':_0xb932('0x7')},'reportId':{'type':Sequelize[_0xb932('0x9')](0xb)[_0xb932('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x279d=['pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv'];(function(_0x13daa2,_0x223f9c){var _0x54681e=function(_0x5c6f87){while(--_0x5c6f87){_0x13daa2['push'](_0x13daa2['shift']());}};_0x54681e(++_0x223f9c);}(_0x279d,0x14b));var _0xd279=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x279d[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0xd279('0x0'));var moment=require('moment');module[_0xd279('0x1')]={'name':{'type':Sequelize[_0xd279('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd279('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd279('0x3')](_0xd279('0x4'),_0xd279('0x5'),_0xd279('0x6')),'allowNull':![],'defaultValue':_0xd279('0x4')},'savename':{'type':Sequelize[_0xd279('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xd279('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0xd279('0x8'),_0xd279('0x9')),'allowNull':![],'defaultValue':_0xd279('0x8')},'reportId':{'type':Sequelize[_0xd279('0xa')](0xb)[_0xd279('0xb')]},'reportType':{'type':Sequelize[_0xd279('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 312da16..7c23f71 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 _0xc3c2=['error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','rawAttributes','find','create','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource'];(function(_0x4f26c0,_0x241b6d){var _0x72e46=function(_0x538c5f){while(--_0x538c5f){_0x4f26c0['push'](_0x4f26c0['shift']());}};_0x72e46(++_0x241b6d);}(_0xc3c2,0x8e));var _0x2c3c=function(_0x19a26a,_0x34030b){_0x19a26a=_0x19a26a-0x0;var _0x405a27=_0xc3c2[_0x19a26a];return _0x405a27;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c3c('0x0'));var rimraf=require(_0x2c3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c3c('0x2'));var rp=require('request-promise');var moment=require(_0x2c3c('0x3'));var BPromise=require(_0x2c3c('0x4'));var Mustache=require(_0x2c3c('0x5'));var util=require(_0x2c3c('0x6'));var path=require(_0x2c3c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c3c('0x8'));var squel=require(_0x2c3c('0x9'));var crypto=require(_0x2c3c('0xa'));var jsforce=require(_0x2c3c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c3c('0xc'));var Papa=require('papaparse');var Redis=require(_0x2c3c('0xd'));var authService=require(_0x2c3c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2c3c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c3c('0x10'));var utils=require(_0x2c3c('0x11'));var config=require(_0x2c3c('0x12'));var licenseUtil=require(_0x2c3c('0x13'));var db=require(_0x2c3c('0x14'))['db'];function respondWithStatusCode(_0x4e520d,_0x11a9ce){_0x11a9ce=_0x11a9ce||0xcc;return function(_0x344d6b){if(_0x344d6b){return _0x4e520d[_0x2c3c('0x15')](_0x11a9ce);}return _0x4e520d[_0x2c3c('0x16')](_0x11a9ce)['end']();};}function respondWithResult(_0x571d19,_0x382936){_0x382936=_0x382936||0xc8;return function(_0x467903){if(_0x467903){return _0x571d19[_0x2c3c('0x16')](_0x382936)[_0x2c3c('0x17')](_0x467903);}};}function respondWithFilteredResult(_0x22c71e,_0x189e88){return function(_0x52b836){if(_0x52b836){var _0x112e96=_0x52b836[_0x2c3c('0x18')],_0x3854da=_0x189e88[_0x2c3c('0x19')],_0x1b81cf=_0x189e88['offset']+_0x189e88[_0x2c3c('0x1a')],_0x48cfc1;if(_0x1b81cf>=_0x112e96){_0x1b81cf=_0x112e96;_0x48cfc1=0xc8;}else{_0x48cfc1=0xce;}_0x22c71e[_0x2c3c('0x16')](_0x48cfc1);return _0x22c71e['set']('Content-Range',_0x3854da+'-'+_0x1b81cf+'/'+_0x112e96)['json'](_0x52b836);}return null;};}function patchUpdates(_0x44d4de){return function(_0x1046b5){try{jsonpatch[_0x2c3c('0x1b')](_0x1046b5,_0x44d4de,!![]);}catch(_0x3b010d){return BPromise[_0x2c3c('0x1c')](_0x3b010d);}return _0x1046b5[_0x2c3c('0x1d')]();};}function saveUpdates(_0x318f6d,_0xeb46b2){return function(_0x561f5c){if(_0x561f5c){return _0x561f5c[_0x2c3c('0x1e')](_0x318f6d)[_0x2c3c('0x1f')](function(_0x1a9337){return _0x1a9337;});}return null;};}function removeEntity(_0x56ad3d,_0x5e2dca){return function(_0x1b045a){if(_0x1b045a){return _0x1b045a[_0x2c3c('0x20')]()[_0x2c3c('0x1f')](function(){var _0x514654=_0x1b045a[_0x2c3c('0x21')]({'plain':!![]});var _0x4a9780=_0x2c3c('0x22');return db[_0x2c3c('0x23')][_0x2c3c('0x20')]({'where':{'type':_0x4a9780,'resourceId':_0x514654['id']}})[_0x2c3c('0x1f')](function(){return _0x1b045a;});})['then'](function(){_0x56ad3d[_0x2c3c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3610da,_0x100934){return function(_0x5ae651){if(!_0x5ae651){_0x3610da[_0x2c3c('0x15')](0x194);}return _0x5ae651;};}function handleError(_0x1d629d,_0x5777c8){_0x5777c8=_0x5777c8||0x1f4;return function(_0x834af2){logger[_0x2c3c('0x24')](_0x834af2[_0x2c3c('0x25')]);if(_0x834af2['name']){delete _0x834af2[_0x2c3c('0x26')];}_0x1d629d[_0x2c3c('0x16')](_0x5777c8)[_0x2c3c('0x27')](_0x834af2);};}exports[_0x2c3c('0x28')]=function(_0x362e35,_0x19e236){var _0x33a04d={},_0x1223a6={},_0x4433bf={'count':0x0,'rows':[]};var _0xff6218=_[_0x2c3c('0x29')](db[_0x2c3c('0x2a')]['rawAttributes'],function(_0xd31a21){return{'name':_0xd31a21[_0x2c3c('0x2b')],'type':_0xd31a21[_0x2c3c('0x2c')][_0x2c3c('0x2d')]};});_0x1223a6[_0x2c3c('0x2e')]=_[_0x2c3c('0x29')](_0xff6218,_0x2c3c('0x26'));_0x1223a6[_0x2c3c('0x2f')]=_[_0x2c3c('0x30')](_0x362e35[_0x2c3c('0x2f')]);_0x1223a6['filters']=_[_0x2c3c('0x31')](_0x1223a6[_0x2c3c('0x2e')],_0x1223a6[_0x2c3c('0x2f')]);_0x33a04d[_0x2c3c('0x32')]=_[_0x2c3c('0x31')](_0x1223a6[_0x2c3c('0x2e')],qs[_0x2c3c('0x33')](_0x362e35[_0x2c3c('0x2f')][_0x2c3c('0x33')]));_0x33a04d[_0x2c3c('0x32')]=_0x33a04d['attributes'][_0x2c3c('0x34')]?_0x33a04d[_0x2c3c('0x32')]:_0x1223a6[_0x2c3c('0x2e')];if(!_0x362e35[_0x2c3c('0x2f')]['hasOwnProperty'](_0x2c3c('0x35'))){_0x33a04d[_0x2c3c('0x1a')]=qs[_0x2c3c('0x1a')](_0x362e35[_0x2c3c('0x2f')]['limit']);_0x33a04d[_0x2c3c('0x19')]=qs['offset'](_0x362e35['query'][_0x2c3c('0x19')]);}_0x33a04d[_0x2c3c('0x36')]=qs[_0x2c3c('0x37')](_0x362e35[_0x2c3c('0x2f')][_0x2c3c('0x37')]);_0x33a04d[_0x2c3c('0x38')]=qs[_0x2c3c('0x39')](_[_0x2c3c('0x3a')](_0x362e35[_0x2c3c('0x2f')],_0x1223a6[_0x2c3c('0x39')]),_0xff6218);if(_0x362e35['query'][_0x2c3c('0x3b')]){_0x33a04d[_0x2c3c('0x38')]=_['merge'](_0x33a04d[_0x2c3c('0x38')],{'$or':_[_0x2c3c('0x29')](_0xff6218,function(_0x7c1a29){if(_0x7c1a29[_0x2c3c('0x2c')]!==_0x2c3c('0x3c')){var _0x3a3afc={};_0x3a3afc[_0x7c1a29[_0x2c3c('0x26')]]={'$like':'%'+_0x362e35[_0x2c3c('0x2f')]['filter']+'%'};return _0x3a3afc;}})});}_0x33a04d=_[_0x2c3c('0x3d')]({},_0x33a04d,_0x362e35['options']);var _0x22fc02={'where':_0x33a04d[_0x2c3c('0x38')]};return db[_0x2c3c('0x2a')]['count'](_0x22fc02)['then'](function(_0x124d95){_0x4433bf['count']=_0x124d95;if(_0x362e35[_0x2c3c('0x2f')][_0x2c3c('0x3e')]){_0x33a04d[_0x2c3c('0x3f')]=[{'all':!![]}];}return db[_0x2c3c('0x2a')]['findAll'](_0x33a04d);})[_0x2c3c('0x1f')](function(_0xf82b3){_0x4433bf[_0x2c3c('0x40')]=_0xf82b3;return _0x4433bf;})[_0x2c3c('0x1f')](respondWithFilteredResult(_0x19e236,_0x33a04d))[_0x2c3c('0x41')](handleError(_0x19e236,null));};exports[_0x2c3c('0x42')]=function(_0x1a9224,_0x73577b){var _0x33b727={'raw':!![],'where':{'id':_0x1a9224['params']['id']}},_0x5ae3ea={};_0x5ae3ea[_0x2c3c('0x2e')]=_[_0x2c3c('0x30')](db['AnalyticExtractedReport'][_0x2c3c('0x43')]);_0x5ae3ea[_0x2c3c('0x2f')]=_[_0x2c3c('0x30')](_0x1a9224[_0x2c3c('0x2f')]);_0x5ae3ea['filters']=_[_0x2c3c('0x31')](_0x5ae3ea[_0x2c3c('0x2e')],_0x5ae3ea[_0x2c3c('0x2f')]);_0x33b727['attributes']=_['intersection'](_0x5ae3ea[_0x2c3c('0x2e')],qs['fields'](_0x1a9224[_0x2c3c('0x2f')]['fields']));_0x33b727[_0x2c3c('0x32')]=_0x33b727['attributes'][_0x2c3c('0x34')]?_0x33b727[_0x2c3c('0x32')]:_0x5ae3ea['model'];if(_0x1a9224[_0x2c3c('0x2f')][_0x2c3c('0x3e')]){_0x33b727[_0x2c3c('0x3f')]=[{'all':!![]}];}_0x33b727=_[_0x2c3c('0x3d')]({},_0x33b727,_0x1a9224['options']);return db[_0x2c3c('0x2a')][_0x2c3c('0x44')](_0x33b727)[_0x2c3c('0x1f')](handleEntityNotFound(_0x73577b,null))['then'](respondWithResult(_0x73577b,null))['catch'](handleError(_0x73577b,null));};exports[_0x2c3c('0x45')]=function(_0x419b35,_0x6054d0){return db[_0x2c3c('0x2a')][_0x2c3c('0x45')](_0x419b35['body'],{})['then'](function(_0x1d5576){var _0x46705d=_0x419b35[_0x2c3c('0x46')][_0x2c3c('0x21')]({'plain':!![]});if(!_0x46705d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46705d['role']===_0x2c3c('0x46')){var _0x419ce8=_0x1d5576[_0x2c3c('0x21')]({'plain':!![]});var _0x41ed51='ExtractedReports';return db['UserProfileSection'][_0x2c3c('0x44')]({'where':{'name':_0x41ed51,'userProfileId':_0x46705d[_0x2c3c('0x47')]},'raw':!![]})[_0x2c3c('0x1f')](function(_0x9effef){if(_0x9effef&&_0x9effef[_0x2c3c('0x48')]===0x0){return db[_0x2c3c('0x23')]['create']({'name':_0x419ce8[_0x2c3c('0x26')],'resourceId':_0x419ce8['id'],'type':_0x9effef[_0x2c3c('0x26')],'sectionId':_0x9effef['id']},{})[_0x2c3c('0x1f')](function(){return _0x1d5576;});}else{return _0x1d5576;}})[_0x2c3c('0x41')](function(_0x396935){logger[_0x2c3c('0x24')](_0x2c3c('0x49'),_0x396935);throw _0x396935;});}return _0x1d5576;})[_0x2c3c('0x1f')](respondWithResult(_0x6054d0,0xc9))['catch'](handleError(_0x6054d0,null));};exports[_0x2c3c('0x1e')]=function(_0x40a8c5,_0x1c6573){if(_0x40a8c5[_0x2c3c('0x4a')]['id']){delete _0x40a8c5['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x40a8c5[_0x2c3c('0x4b')]['id']}})[_0x2c3c('0x1f')](handleEntityNotFound(_0x1c6573,null))[_0x2c3c('0x1f')](saveUpdates(_0x40a8c5[_0x2c3c('0x4a')],null))[_0x2c3c('0x1f')](respondWithResult(_0x1c6573,null))[_0x2c3c('0x41')](handleError(_0x1c6573,null));};exports['destroy']=function(_0x2ed858,_0x484731){return db[_0x2c3c('0x2a')]['find']({'where':{'id':_0x2ed858[_0x2c3c('0x4b')]['id']}})[_0x2c3c('0x1f')](handleEntityNotFound(_0x484731,null))['then'](removeEntity(_0x484731,null))['catch'](handleError(_0x484731,null));};exports[_0x2c3c('0x4c')]=function(_0x367837,_0x4af739,_0x1b51e7){return db['AnalyticExtractedReport'][_0x2c3c('0x44')]({'where':{'id':_0x367837[_0x2c3c('0x4b')]['id']},'attributes':[_0x2c3c('0x26'),_0x2c3c('0x4d'),_0x2c3c('0x4e'),'output'],'raw':!![]})[_0x2c3c('0x1f')](handleEntityNotFound(_0x4af739,null))[_0x2c3c('0x1f')](function(_0x2912ac){if(_0x2912ac){if(!fs[_0x2c3c('0x4f')](path[_0x2c3c('0x50')](config[_0x2c3c('0x51')],_0x2c3c('0x52'),_0x2912ac['savename']))){throw new db[(_0x2c3c('0x53'))]['ValidationError'](_0x2c3c('0x54'));}if(_0x367837[_0x2c3c('0x2f')][_0x2c3c('0x55')]){return _0x4af739[_0x2c3c('0x15')](0xc8);}return _0x4af739[_0x2c3c('0x4c')](path[_0x2c3c('0x50')](config[_0x2c3c('0x51')],_0x2c3c('0x52'),_0x2912ac[_0x2c3c('0x4e')]),util['format'](_0x2c3c('0x56'),_0x2912ac['basename']||_0x2912ac['name'],_0x2912ac[_0x2c3c('0x57')][_0x2c3c('0x58')]()));}})[_0x2c3c('0x41')](handleError(_0x4af739,null));}; \ No newline at end of file +var _0x88e9=['findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','root','format','%s.%s','basename','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','Content-Range','json','save','update','destroy','then','get','ExtractedReports','UserProfileResource','end','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x88e9,0x198));var _0x988e=function(_0x1e71fd,_0x38ce90){_0x1e71fd=_0x1e71fd-0x0;var _0x39282a=_0x88e9[_0x1e71fd];return _0x39282a;};'use strict';var pdf=require(_0x988e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x988e('0x1'));var zipdir=require(_0x988e('0x2'));var jsonpatch=require(_0x988e('0x3'));var rp=require(_0x988e('0x4'));var moment=require('moment');var BPromise=require(_0x988e('0x5'));var Mustache=require(_0x988e('0x6'));var util=require(_0x988e('0x7'));var path=require(_0x988e('0x8'));var sox=require(_0x988e('0x9'));var csv=require(_0x988e('0xa'));var ejs=require(_0x988e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x988e('0xc'));var jsforce=require(_0x988e('0xd'));var deskjs=require(_0x988e('0xe'));var toCsv=require(_0x988e('0xa'));var querystring=require(_0x988e('0xf'));var Papa=require(_0x988e('0x10'));var Redis=require(_0x988e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x988e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x988e('0x13'))('api');var utils=require(_0x988e('0x14'));var config=require(_0x988e('0x15'));var licenseUtil=require(_0x988e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1afe17,_0x59db0b){_0x59db0b=_0x59db0b||0xcc;return function(_0x502b6a){if(_0x502b6a){return _0x1afe17[_0x988e('0x17')](_0x59db0b);}return _0x1afe17[_0x988e('0x18')](_0x59db0b)['end']();};}function respondWithResult(_0x1b1d25,_0xcf5b43){_0xcf5b43=_0xcf5b43||0xc8;return function(_0x5b7f6e){if(_0x5b7f6e){return _0x1b1d25[_0x988e('0x18')](_0xcf5b43)['json'](_0x5b7f6e);}};}function respondWithFilteredResult(_0x2e02b8,_0x17bdd2){return function(_0x3e8aa8){if(_0x3e8aa8){var _0x51d34d=_0x3e8aa8[_0x988e('0x19')],_0x1f6a66=_0x17bdd2[_0x988e('0x1a')],_0x4236bd=_0x17bdd2[_0x988e('0x1a')]+_0x17bdd2[_0x988e('0x1b')],_0x34f140;if(_0x4236bd>=_0x51d34d){_0x4236bd=_0x51d34d;_0x34f140=0xc8;}else{_0x34f140=0xce;}_0x2e02b8[_0x988e('0x18')](_0x34f140);return _0x2e02b8['set'](_0x988e('0x1c'),_0x1f6a66+'-'+_0x4236bd+'/'+_0x51d34d)[_0x988e('0x1d')](_0x3e8aa8);}return null;};}function patchUpdates(_0x2dc83d){return function(_0x5ca189){try{jsonpatch['apply'](_0x5ca189,_0x2dc83d,!![]);}catch(_0x23ae24){return BPromise['reject'](_0x23ae24);}return _0x5ca189[_0x988e('0x1e')]();};}function saveUpdates(_0x27a551,_0x50a70d){return function(_0x240dbe){if(_0x240dbe){return _0x240dbe[_0x988e('0x1f')](_0x27a551)['then'](function(_0x113c34){return _0x113c34;});}return null;};}function removeEntity(_0x1bd0d2,_0x48a493){return function(_0x37119b){if(_0x37119b){return _0x37119b[_0x988e('0x20')]()[_0x988e('0x21')](function(){var _0x4fb8ed=_0x37119b[_0x988e('0x22')]({'plain':!![]});var _0x4b90e7=_0x988e('0x23');return db[_0x988e('0x24')][_0x988e('0x20')]({'where':{'type':_0x4b90e7,'resourceId':_0x4fb8ed['id']}})['then'](function(){return _0x37119b;});})[_0x988e('0x21')](function(){_0x1bd0d2[_0x988e('0x18')](0xcc)[_0x988e('0x25')]();});}};}function handleEntityNotFound(_0x5d35c4,_0x17ba12){return function(_0x3cb567){if(!_0x3cb567){_0x5d35c4[_0x988e('0x17')](0x194);}return _0x3cb567;};}function handleError(_0xf05dfd,_0xdd1abf){_0xdd1abf=_0xdd1abf||0x1f4;return function(_0x42935f){logger['error'](_0x42935f[_0x988e('0x26')]);if(_0x42935f[_0x988e('0x27')]){delete _0x42935f[_0x988e('0x27')];}_0xf05dfd[_0x988e('0x18')](_0xdd1abf)[_0x988e('0x28')](_0x42935f);};}exports[_0x988e('0x29')]=function(_0x188df5,_0x219537){var _0x377939={},_0x530f80={},_0x356f96={'count':0x0,'rows':[]};var _0x2e7c1d=_[_0x988e('0x2a')](db[_0x988e('0x2b')]['rawAttributes'],function(_0x306861){return{'name':_0x306861[_0x988e('0x2c')],'type':_0x306861[_0x988e('0x2d')][_0x988e('0x2e')]};});_0x530f80[_0x988e('0x2f')]=_['map'](_0x2e7c1d,_0x988e('0x27'));_0x530f80['query']=_[_0x988e('0x30')](_0x188df5[_0x988e('0x31')]);_0x530f80[_0x988e('0x32')]=_[_0x988e('0x33')](_0x530f80['model'],_0x530f80['query']);_0x377939[_0x988e('0x34')]=_[_0x988e('0x33')](_0x530f80[_0x988e('0x2f')],qs[_0x988e('0x35')](_0x188df5[_0x988e('0x31')]['fields']));_0x377939['attributes']=_0x377939[_0x988e('0x34')][_0x988e('0x36')]?_0x377939[_0x988e('0x34')]:_0x530f80['model'];if(!_0x188df5[_0x988e('0x31')][_0x988e('0x37')](_0x988e('0x38'))){_0x377939[_0x988e('0x1b')]=qs[_0x988e('0x1b')](_0x188df5[_0x988e('0x31')][_0x988e('0x1b')]);_0x377939['offset']=qs['offset'](_0x188df5[_0x988e('0x31')][_0x988e('0x1a')]);}_0x377939[_0x988e('0x39')]=qs[_0x988e('0x3a')](_0x188df5[_0x988e('0x31')][_0x988e('0x3a')]);_0x377939[_0x988e('0x3b')]=qs['filters'](_[_0x988e('0x3c')](_0x188df5[_0x988e('0x31')],_0x530f80['filters']),_0x2e7c1d);if(_0x188df5['query'][_0x988e('0x3d')]){_0x377939[_0x988e('0x3b')]=_[_0x988e('0x3e')](_0x377939[_0x988e('0x3b')],{'$or':_[_0x988e('0x2a')](_0x2e7c1d,function(_0x1f67f4){if(_0x1f67f4['type']!==_0x988e('0x3f')){var _0x4ad06d={};_0x4ad06d[_0x1f67f4[_0x988e('0x27')]]={'$like':'%'+_0x188df5[_0x988e('0x31')]['filter']+'%'};return _0x4ad06d;}})});}_0x377939=_[_0x988e('0x3e')]({},_0x377939,_0x188df5[_0x988e('0x40')]);var _0x2bb8d4={'where':_0x377939[_0x988e('0x3b')]};return db['AnalyticExtractedReport'][_0x988e('0x19')](_0x2bb8d4)[_0x988e('0x21')](function(_0x532989){_0x356f96['count']=_0x532989;if(_0x188df5['query'][_0x988e('0x41')]){_0x377939[_0x988e('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x988e('0x43')](_0x377939);})['then'](function(_0x381567){_0x356f96['rows']=_0x381567;return _0x356f96;})[_0x988e('0x21')](respondWithFilteredResult(_0x219537,_0x377939))[_0x988e('0x44')](handleError(_0x219537,null));};exports[_0x988e('0x45')]=function(_0x5bbd6f,_0x38d7da){var _0x2abc09={'raw':!![],'where':{'id':_0x5bbd6f[_0x988e('0x46')]['id']}},_0x2eca72={};_0x2eca72[_0x988e('0x2f')]=_[_0x988e('0x30')](db[_0x988e('0x2b')]['rawAttributes']);_0x2eca72[_0x988e('0x31')]=_[_0x988e('0x30')](_0x5bbd6f[_0x988e('0x31')]);_0x2eca72['filters']=_[_0x988e('0x33')](_0x2eca72['model'],_0x2eca72[_0x988e('0x31')]);_0x2abc09[_0x988e('0x34')]=_['intersection'](_0x2eca72[_0x988e('0x2f')],qs[_0x988e('0x35')](_0x5bbd6f[_0x988e('0x31')][_0x988e('0x35')]));_0x2abc09[_0x988e('0x34')]=_0x2abc09['attributes'][_0x988e('0x36')]?_0x2abc09[_0x988e('0x34')]:_0x2eca72[_0x988e('0x2f')];if(_0x5bbd6f['query'][_0x988e('0x41')]){_0x2abc09['include']=[{'all':!![]}];}_0x2abc09=_['merge']({},_0x2abc09,_0x5bbd6f[_0x988e('0x40')]);return db[_0x988e('0x2b')][_0x988e('0x47')](_0x2abc09)[_0x988e('0x21')](handleEntityNotFound(_0x38d7da,null))[_0x988e('0x21')](respondWithResult(_0x38d7da,null))['catch'](handleError(_0x38d7da,null));};exports[_0x988e('0x48')]=function(_0x586058,_0x42002b){return db[_0x988e('0x2b')][_0x988e('0x48')](_0x586058[_0x988e('0x49')],{})['then'](function(_0x46c344){var _0x1fd8d3=_0x586058[_0x988e('0x4a')][_0x988e('0x22')]({'plain':!![]});if(!_0x1fd8d3)throw new Error(_0x988e('0x4b'));if(_0x1fd8d3[_0x988e('0x4c')]===_0x988e('0x4a')){var _0x2879d3=_0x46c344[_0x988e('0x22')]({'plain':!![]});var _0x5b4c4e=_0x988e('0x23');return db[_0x988e('0x4d')]['find']({'where':{'name':_0x5b4c4e,'userProfileId':_0x1fd8d3['userProfileId']},'raw':!![]})['then'](function(_0x4f5637){if(_0x4f5637&&_0x4f5637[_0x988e('0x4e')]===0x0){return db[_0x988e('0x24')][_0x988e('0x48')]({'name':_0x2879d3[_0x988e('0x27')],'resourceId':_0x2879d3['id'],'type':_0x4f5637[_0x988e('0x27')],'sectionId':_0x4f5637['id']},{})[_0x988e('0x21')](function(){return _0x46c344;});}else{return _0x46c344;}})['catch'](function(_0x3f37cf){logger[_0x988e('0x4f')](_0x988e('0x50'),_0x3f37cf);throw _0x3f37cf;});}return _0x46c344;})[_0x988e('0x21')](respondWithResult(_0x42002b,0xc9))[_0x988e('0x44')](handleError(_0x42002b,null));};exports[_0x988e('0x1f')]=function(_0x22add3,_0x45642e){if(_0x22add3[_0x988e('0x49')]['id']){delete _0x22add3[_0x988e('0x49')]['id'];}return db[_0x988e('0x2b')]['find']({'where':{'id':_0x22add3[_0x988e('0x46')]['id']}})[_0x988e('0x21')](handleEntityNotFound(_0x45642e,null))[_0x988e('0x21')](saveUpdates(_0x22add3['body'],null))[_0x988e('0x21')](respondWithResult(_0x45642e,null))['catch'](handleError(_0x45642e,null));};exports[_0x988e('0x20')]=function(_0x51f484,_0x5df0f6){return db[_0x988e('0x2b')][_0x988e('0x47')]({'where':{'id':_0x51f484[_0x988e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5df0f6,null))[_0x988e('0x21')](removeEntity(_0x5df0f6,null))[_0x988e('0x44')](handleError(_0x5df0f6,null));};exports[_0x988e('0x51')]=function(_0x19bf18,_0x1bc659,_0x356f9b){return db[_0x988e('0x2b')]['find']({'where':{'id':_0x19bf18[_0x988e('0x46')]['id']},'attributes':[_0x988e('0x27'),'basename',_0x988e('0x52'),_0x988e('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x1bc659,null))[_0x988e('0x21')](function(_0x14c1f0){if(_0x14c1f0){if(!fs[_0x988e('0x54')](path['join'](config['root'],_0x988e('0x55'),_0x14c1f0['savename']))){throw new db[(_0x988e('0x56'))][(_0x988e('0x57'))](_0x988e('0x58'));}if(_0x19bf18[_0x988e('0x31')]['exists']){return _0x1bc659['sendStatus'](0xc8);}return _0x1bc659[_0x988e('0x51')](path[_0x988e('0x59')](config[_0x988e('0x5a')],_0x988e('0x55'),_0x14c1f0[_0x988e('0x52')]),util[_0x988e('0x5b')](_0x988e('0x5c'),_0x14c1f0[_0x988e('0x5d')]||_0x14c1f0[_0x988e('0x27')],_0x14c1f0['output'][_0x988e('0x5e')]()));}})[_0x988e('0x44')](handleError(_0x1bc659,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3ba96b7..00be143 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 _0xde45=['moment','bluebird','path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','api'];(function(_0x25d4c6,_0x2e4c65){var _0x24b07c=function(_0x571ed0){while(--_0x571ed0){_0x25d4c6['push'](_0x25d4c6['shift']());}};_0x24b07c(++_0x2e4c65);}(_0xde45,0x131));var _0x5de4=function(_0x395361,_0x277071){_0x395361=_0x395361-0x0;var _0x327f71=_0xde45[_0x395361];return _0x327f71;};'use strict';var _=require(_0x5de4('0x0'));var util=require('util');var logger=require(_0x5de4('0x1'))(_0x5de4('0x2'));var moment=require(_0x5de4('0x3'));var BPromise=require(_0x5de4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5de4('0x5'));var rimraf=require(_0x5de4('0x6'));var config=require('../../config/environment');var attributes=require(_0x5de4('0x7'));module[_0x5de4('0x8')]=function(_0xa26a5b,_0x5ca968){return _0xa26a5b[_0x5de4('0x9')](_0x5de4('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x235ba7,_0xf32628){var _0x2ff3f7=function(_0x28da31){while(--_0x28da31){_0x235ba7['push'](_0x235ba7['shift']());}};_0x2ff3f7(++_0xf32628);}(_0x3de3,0x1ab));var _0x33de=function(_0x1d70e0,_0x4fb9d9){_0x1d70e0=_0x1d70e0-0x0;var _0x390829=_0x3de3[_0x1d70e0];return _0x390829;};'use strict';var _=require(_0x33de('0x0'));var util=require(_0x33de('0x1'));var logger=require(_0x33de('0x2'))(_0x33de('0x3'));var moment=require(_0x33de('0x4'));var BPromise=require(_0x33de('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33de('0x6'));var rimraf=require(_0x33de('0x7'));var config=require(_0x33de('0x8'));var attributes=require(_0x33de('0x9'));module[_0x33de('0xa')]=function(_0x2a3254,_0x55f0c3){return _0x2a3254['define'](_0x33de('0xb'),attributes,{'tableName':_0x33de('0xc'),'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 bd6c041..8ac5ad4 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 _0xacac=['../../config/logger','client','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31f538,_0x110cb9){var _0x399533=function(_0x13d66e){while(--_0x13d66e){_0x31f538['push'](_0x31f538['shift']());}};_0x399533(++_0x110cb9);}(_0xacac,0xdd));var _0xcaca=function(_0x33b020,_0x1d9776){_0x33b020=_0x33b020-0x0;var _0x4ba3f5=_0xacac[_0x33b020];return _0x4ba3f5;};'use strict';var _=require(_0xcaca('0x0'));var util=require(_0xcaca('0x1'));var moment=require(_0xcaca('0x2'));var BPromise=require('bluebird');var rs=require(_0xcaca('0x3'));var fs=require('fs');var Redis=require(_0xcaca('0x4'));var db=require(_0xcaca('0x5'))['db'];var utils=require(_0xcaca('0x6'));var logger=require(_0xcaca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcaca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300f50,_0x1815b7,_0x4bc239){return new BPromise(function(_0x4f5844,_0xb1846){return client['request'](_0x300f50,_0x4bc239)[_0xcaca('0x9')](function(_0x518038){logger[_0xcaca('0xa')](_0xcaca('0xb'),_0x1815b7,_0xcaca('0xc'));logger['debug'](_0xcaca('0xd'),_0x1815b7,_0xcaca('0xc'),JSON['stringify'](_0x518038));if(_0x518038['error']){if(_0x518038[_0xcaca('0xe')][_0xcaca('0xf')]===0x1f4){logger[_0xcaca('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1815b7,_0x518038[_0xcaca('0xe')][_0xcaca('0x10')]);return _0xb1846(_0x518038[_0xcaca('0xe')][_0xcaca('0x10')]);}logger['error'](_0xcaca('0xb'),_0x1815b7,_0x518038[_0xcaca('0xe')]['message']);return _0x4f5844(_0x518038[_0xcaca('0xe')][_0xcaca('0x10')]);}else{logger[_0xcaca('0xa')](_0xcaca('0xb'),_0x1815b7,'request\x20sent');_0x4f5844(_0x518038[_0xcaca('0x11')][_0xcaca('0x10')]);}})[_0xcaca('0x12')](function(_0x2e618b){logger['error'](_0xcaca('0xb'),_0x1815b7,_0x2e618b);_0xb1846(_0x2e618b);});});} \ No newline at end of file +var _0x0ec2=['http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x0ec2,0xcf));var _0x20ec=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0x0ec2[_0x5d88c0];return _0x1b40f0;};'use strict';var _=require(_0x20ec('0x0'));var util=require(_0x20ec('0x1'));var moment=require(_0x20ec('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ec('0x3'));var db=require(_0x20ec('0x4'))['db'];var utils=require(_0x20ec('0x5'));var logger=require(_0x20ec('0x6'))(_0x20ec('0x7'));var config=require(_0x20ec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ddcd8,_0x4ee144,_0x40651d){return new BPromise(function(_0x43d40e,_0x5e888f){return client['request'](_0x3ddcd8,_0x40651d)[_0x20ec('0xa')](function(_0x1daec4){logger['info'](_0x20ec('0xb'),_0x4ee144,_0x20ec('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4ee144,'request\x20sent',JSON['stringify'](_0x1daec4));if(_0x1daec4[_0x20ec('0xd')]){if(_0x1daec4[_0x20ec('0xd')][_0x20ec('0xe')]===0x1f4){logger[_0x20ec('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ee144,_0x1daec4[_0x20ec('0xd')][_0x20ec('0xf')]);return _0x5e888f(_0x1daec4[_0x20ec('0xd')][_0x20ec('0xf')]);}logger[_0x20ec('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ee144,_0x1daec4['error'][_0x20ec('0xf')]);return _0x43d40e(_0x1daec4[_0x20ec('0xd')][_0x20ec('0xf')]);}else{logger['info'](_0x20ec('0xb'),_0x4ee144,_0x20ec('0xc'));_0x43d40e(_0x1daec4[_0x20ec('0x10')]['message']);}})[_0x20ec('0x11')](function(_0x4a2da9){logger[_0x20ec('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ee144,_0x4a2da9);_0x5e888f(_0x4a2da9);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index cf0c7f3..fabaab1 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 _0x7008=['express','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post','put','update','delete','exports','path'];(function(_0x16a9d9,_0x1fc64b){var _0x22a786=function(_0x3ef4d7){while(--_0x3ef4d7){_0x16a9d9['push'](_0x16a9d9['shift']());}};_0x22a786(++_0x1fc64b);}(_0x7008,0x1ec));var _0x8700=function(_0x3625bb,_0x58af09){_0x3625bb=_0x3625bb-0x0;var _0x225dfa=_0x7008[_0x3625bb];return _0x225dfa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8700('0x0'));var timeout=require('connect-timeout');var express=require(_0x8700('0x1'));var router=express['Router']();var auth=require(_0x8700('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8700('0x3'));var controller=require(_0x8700('0x4'));router['get']('/',auth[_0x8700('0x5')](),controller[_0x8700('0x6')]);router[_0x8700('0x7')](_0x8700('0x8'),auth['isAuthenticated'](),controller[_0x8700('0x9')]);router[_0x8700('0x7')](_0x8700('0xa'),auth[_0x8700('0x5')](),controller[_0x8700('0xb')]);router[_0x8700('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8700('0xd')](_0x8700('0x8'),auth[_0x8700('0x5')](),controller[_0x8700('0xe')]);router[_0x8700('0xf')](_0x8700('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x8700('0x10')]=router; \ No newline at end of file +var _0xb64e=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0xfcfe92,_0x14ea66){var _0x166ba1=function(_0x45f01a){while(--_0x45f01a){_0xfcfe92['push'](_0xfcfe92['shift']());}};_0x166ba1(++_0x14ea66);}(_0xb64e,0x89));var _0xeb64=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xb64e[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0xeb64('0x0'));var util=require(_0xeb64('0x1'));var path=require('path');var timeout=require(_0xeb64('0x2'));var express=require(_0xeb64('0x3'));var router=express[_0xeb64('0x4')]();var auth=require(_0xeb64('0x5'));var interaction=require(_0xeb64('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xeb64('0x7')]('/',auth[_0xeb64('0x8')](),controller[_0xeb64('0x9')]);router[_0xeb64('0x7')](_0xeb64('0xa'),auth[_0xeb64('0x8')](),controller[_0xeb64('0xb')]);router[_0xeb64('0x7')]('/:id/download',auth[_0xeb64('0x8')](),controller['download']);router[_0xeb64('0xc')]('/',auth['isAuthenticated'](),controller[_0xeb64('0xd')]);router[_0xeb64('0xe')](_0xeb64('0xa'),auth[_0xeb64('0x8')](),controller[_0xeb64('0xf')]);router['delete'](_0xeb64('0xa'),auth[_0xeb64('0x8')](),controller[_0xeb64('0x10')]);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 30d9880..c832683 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 _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x122c5c,_0x3f9ee6){var _0xb9e7f=function(_0x7c219){while(--_0x7c219){_0x122c5c['push'](_0x122c5c['shift']());}};_0xb9e7f(++_0x3f9ee6);}(_0x7a54,0x106));var _0x47a5=function(_0x399c89,_0x5267ab){_0x399c89=_0x399c89-0x0;var _0x3eee38=_0x7a54[_0x399c89];return _0x3eee38;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3d0b10,_0x993cdd){var _0x16121b=function(_0xb8a246){while(--_0xb8a246){_0x3d0b10['push'](_0x3d0b10['shift']());}};_0x16121b(++_0x993cdd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x5fc3[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 4459617..ae3b3df 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 _0xc5b4=['update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','query','intersection','attributes','model','fields','length','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','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','end','count','offset','limit','set','Content-Range','json','apply','save'];(function(_0x473192,_0x2c416d){var _0x4aed1f=function(_0x4741bf){while(--_0x4741bf){_0x473192['push'](_0x473192['shift']());}};_0x4aed1f(++_0x2c416d);}(_0xc5b4,0x165));var _0x4c5b=function(_0x5e5241,_0x36a826){_0x5e5241=_0x5e5241-0x0;var _0x45c70c=_0xc5b4[_0x5e5241];return _0x45c70c;};'use strict';var pdf=require(_0x4c5b('0x0'));var emlformat=require(_0x4c5b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c5b('0x3'));var moment=require(_0x4c5b('0x4'));var BPromise=require(_0x4c5b('0x5'));var Mustache=require(_0x4c5b('0x6'));var util=require(_0x4c5b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4c5b('0x8'));var ejs=require(_0x4c5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c5b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4c5b('0x8'));var querystring=require(_0x4c5b('0xb'));var Papa=require(_0x4c5b('0xc'));var Redis=require('ioredis');var authService=require(_0x4c5b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4c5b('0xe'));var hardwareService=require(_0x4c5b('0xf'));var logger=require(_0x4c5b('0x10'))(_0x4c5b('0x11'));var utils=require(_0x4c5b('0x12'));var config=require(_0x4c5b('0x13'));var licenseUtil=require(_0x4c5b('0x14'));var db=require(_0x4c5b('0x15'))['db'];function respondWithStatusCode(_0x4a3ed8,_0x4ba244){_0x4ba244=_0x4ba244||0xcc;return function(_0x8c3986){if(_0x8c3986){return _0x4a3ed8[_0x4c5b('0x16')](_0x4ba244);}return _0x4a3ed8[_0x4c5b('0x17')](_0x4ba244)[_0x4c5b('0x18')]();};}function respondWithResult(_0x461d6a,_0x7b1546){_0x7b1546=_0x7b1546||0xc8;return function(_0x35e96d){if(_0x35e96d){return _0x461d6a[_0x4c5b('0x17')](_0x7b1546)['json'](_0x35e96d);}};}function respondWithFilteredResult(_0x2ba9d0,_0x4c6522){return function(_0x122baa){if(_0x122baa){var _0x2c5ce9=_0x122baa[_0x4c5b('0x19')],_0x3f1ed9=_0x4c6522[_0x4c5b('0x1a')],_0x3cccb2=_0x4c6522[_0x4c5b('0x1a')]+_0x4c6522[_0x4c5b('0x1b')],_0x28ac34;if(_0x3cccb2>=_0x2c5ce9){_0x3cccb2=_0x2c5ce9;_0x28ac34=0xc8;}else{_0x28ac34=0xce;}_0x2ba9d0[_0x4c5b('0x17')](_0x28ac34);return _0x2ba9d0[_0x4c5b('0x1c')](_0x4c5b('0x1d'),_0x3f1ed9+'-'+_0x3cccb2+'/'+_0x2c5ce9)[_0x4c5b('0x1e')](_0x122baa);}return null;};}function patchUpdates(_0x46466c){return function(_0x34c45c){try{jsonpatch[_0x4c5b('0x1f')](_0x34c45c,_0x46466c,!![]);}catch(_0x566ba1){return BPromise['reject'](_0x566ba1);}return _0x34c45c[_0x4c5b('0x20')]();};}function saveUpdates(_0x9d9050,_0x33f332){return function(_0x1e472e){if(_0x1e472e){return _0x1e472e[_0x4c5b('0x21')](_0x9d9050)[_0x4c5b('0x22')](function(_0x43fcac){return _0x43fcac;});}return null;};}function removeEntity(_0x5a2d59,_0x268767){return function(_0x1618a5){if(_0x1618a5){return _0x1618a5['destroy']()['then'](function(){_0x5a2d59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f358b,_0x436c8e){return function(_0x4af3ff){if(!_0x4af3ff){_0x4f358b[_0x4c5b('0x16')](0x194);}return _0x4af3ff;};}function handleError(_0x1704d2,_0x519af9){_0x519af9=_0x519af9||0x1f4;return function(_0x181a2b){logger[_0x4c5b('0x23')](_0x181a2b[_0x4c5b('0x24')]);if(_0x181a2b[_0x4c5b('0x25')]){delete _0x181a2b['name'];}_0x1704d2[_0x4c5b('0x17')](_0x519af9)[_0x4c5b('0x26')](_0x181a2b);};}exports[_0x4c5b('0x27')]=function(_0x38ea70,_0x1f95f6){var _0x2d3975={},_0xbb6cfe={},_0x30ac06={'count':0x0,'rows':[]};var _0x17b62a=_[_0x4c5b('0x28')](db[_0x4c5b('0x29')][_0x4c5b('0x2a')],function(_0x2aec4b){return{'name':_0x2aec4b['fieldName'],'type':_0x2aec4b[_0x4c5b('0x2b')][_0x4c5b('0x2c')]};});_0xbb6cfe['model']=_['map'](_0x17b62a,_0x4c5b('0x25'));_0xbb6cfe[_0x4c5b('0x2d')]=_['keys'](_0x38ea70[_0x4c5b('0x2d')]);_0xbb6cfe['filters']=_[_0x4c5b('0x2e')](_0xbb6cfe['model'],_0xbb6cfe[_0x4c5b('0x2d')]);_0x2d3975[_0x4c5b('0x2f')]=_[_0x4c5b('0x2e')](_0xbb6cfe[_0x4c5b('0x30')],qs[_0x4c5b('0x31')](_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x31')]));_0x2d3975[_0x4c5b('0x2f')]=_0x2d3975[_0x4c5b('0x2f')][_0x4c5b('0x32')]?_0x2d3975['attributes']:_0xbb6cfe[_0x4c5b('0x30')];if(!_0x38ea70['query']['hasOwnProperty']('nolimit')){_0x2d3975['limit']=qs[_0x4c5b('0x1b')](_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x1b')]);_0x2d3975[_0x4c5b('0x1a')]=qs[_0x4c5b('0x1a')](_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x1a')]);}_0x2d3975[_0x4c5b('0x33')]=qs[_0x4c5b('0x34')](_0x38ea70[_0x4c5b('0x2d')]['sort']);_0x2d3975[_0x4c5b('0x35')]=qs['filters'](_['pick'](_0x38ea70['query'],_0xbb6cfe[_0x4c5b('0x36')]),_0x17b62a);if(_0x38ea70['query']['filter']){_0x2d3975['where']=_[_0x4c5b('0x37')](_0x2d3975[_0x4c5b('0x35')],{'$or':_[_0x4c5b('0x28')](_0x17b62a,function(_0x144e16){if(_0x144e16[_0x4c5b('0x2b')]!==_0x4c5b('0x38')){var _0x852211={};_0x852211[_0x144e16[_0x4c5b('0x25')]]={'$like':'%'+_0x38ea70[_0x4c5b('0x2d')][_0x4c5b('0x39')]+'%'};return _0x852211;}})});}_0x2d3975=_[_0x4c5b('0x37')]({},_0x2d3975,_0x38ea70['options']);var _0x3aa537={'where':_0x2d3975['where']};return db[_0x4c5b('0x29')][_0x4c5b('0x19')](_0x3aa537)[_0x4c5b('0x22')](function(_0x1ab027){_0x30ac06[_0x4c5b('0x19')]=_0x1ab027;if(_0x38ea70['query'][_0x4c5b('0x3a')]){_0x2d3975[_0x4c5b('0x3b')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4c5b('0x3c')](_0x2d3975);})['then'](function(_0x35ed7d){_0x30ac06[_0x4c5b('0x3d')]=_0x35ed7d;return _0x30ac06;})['then'](respondWithFilteredResult(_0x1f95f6,_0x2d3975))[_0x4c5b('0x3e')](handleError(_0x1f95f6,null));};exports[_0x4c5b('0x3f')]=function(_0xcd807d,_0x57a376){var _0x1694af={'raw':![],'where':{'id':_0xcd807d[_0x4c5b('0x40')]['id']}},_0x394766={};_0x394766['model']=_[_0x4c5b('0x41')](db[_0x4c5b('0x29')][_0x4c5b('0x2a')]);_0x394766['query']=_['keys'](_0xcd807d[_0x4c5b('0x2d')]);_0x394766[_0x4c5b('0x36')]=_[_0x4c5b('0x2e')](_0x394766['model'],_0x394766['query']);_0x1694af[_0x4c5b('0x2f')]=_['intersection'](_0x394766[_0x4c5b('0x30')],qs[_0x4c5b('0x31')](_0xcd807d[_0x4c5b('0x2d')]['fields']));_0x1694af['attributes']=_0x1694af[_0x4c5b('0x2f')][_0x4c5b('0x32')]?_0x1694af[_0x4c5b('0x2f')]:_0x394766[_0x4c5b('0x30')];if(_0xcd807d[_0x4c5b('0x2d')]['includeAll']){_0x1694af['include']=[{'all':!![]}];}_0x1694af=_[_0x4c5b('0x37')]({},_0x1694af,_0xcd807d[_0x4c5b('0x42')]);return db[_0x4c5b('0x29')][_0x4c5b('0x43')](_0x1694af)[_0x4c5b('0x22')](handleEntityNotFound(_0x57a376,null))['then'](respondWithResult(_0x57a376,null))[_0x4c5b('0x3e')](handleError(_0x57a376,null));};exports['create']=function(_0x487954,_0x528492){return db[_0x4c5b('0x29')]['create'](_0x487954[_0x4c5b('0x44')],{})[_0x4c5b('0x22')](respondWithResult(_0x528492,0xc9))[_0x4c5b('0x3e')](handleError(_0x528492,null));};exports[_0x4c5b('0x45')]=function(_0xbb4f6c,_0x4d7c73){return db[_0x4c5b('0x29')][_0x4c5b('0x45')](_0xbb4f6c['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4d7c73,0xc9))[_0x4c5b('0x3e')](handleError(_0x4d7c73,null));};exports[_0x4c5b('0x21')]=function(_0x772203,_0x6e8127){if(_0x772203[_0x4c5b('0x44')]['id']){delete _0x772203[_0x4c5b('0x44')]['id'];}return db[_0x4c5b('0x29')]['find']({'where':{'id':_0x772203[_0x4c5b('0x40')]['id']}})['then'](handleEntityNotFound(_0x6e8127,null))[_0x4c5b('0x22')](saveUpdates(_0x772203['body'],null))[_0x4c5b('0x22')](respondWithResult(_0x6e8127,null))['catch'](handleError(_0x6e8127,null));};exports[_0x4c5b('0x46')]=function(_0x27b508,_0x5a8651){return db[_0x4c5b('0x29')][_0x4c5b('0x43')]({'where':{'id':_0x27b508[_0x4c5b('0x40')]['id']}})['then'](handleEntityNotFound(_0x5a8651,null))[_0x4c5b('0x22')](removeEntity(_0x5a8651,null))['catch'](handleError(_0x5a8651,null));};exports[_0x4c5b('0x47')]=function(_0x237dbf,_0x4359ce){return db[_0x4c5b('0x29')][_0x4c5b('0x46')]({'where':{'id':_0x237dbf['query'][_0x4c5b('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x4c5b('0x22')](respondWithResult(_0x4359ce,0xcc))[_0x4c5b('0x3e')](handleError(_0x4359ce,null));};exports[_0x4c5b('0x49')]=function(_0x32a9e0,_0x55ed41,_0x3cc95c){return db[_0x4c5b('0x4a')]['findOne']({'where':{'id':_0x32a9e0[_0x4c5b('0x40')]['id']}})[_0x4c5b('0x22')](handleEntityNotFound(_0x55ed41,null))[_0x4c5b('0x22')](function(_0x60521f){if(_0x60521f){return db[_0x4c5b('0x4b')][_0x4c5b('0x4c')](function(_0x378a3c){return db[_0x4c5b('0x29')][_0x4c5b('0x46')]({'where':{'CustomReportId':_0x32a9e0[_0x4c5b('0x40')]['id']},'transaction':_0x378a3c})[_0x4c5b('0x22')](function(_0x29d97d){var _0x5895ca=_[_0x4c5b('0x28')](_0x32a9e0[_0x4c5b('0x44')],function(_0x3c91d0){delete _0x3c91d0['id'];_0x3c91d0[_0x4c5b('0x4d')]=_0x32a9e0['params']['id'];return _0x3c91d0;});return db['AnalyticFieldReport'][_0x4c5b('0x45')](_0x5895ca,{'transaction':_0x378a3c});});})[_0x4c5b('0x22')](function(){return db[_0x4c5b('0x29')][_0x4c5b('0x3c')]({'where':{'CustomReportId':_0x32a9e0[_0x4c5b('0x40')]['id']}});});}})[_0x4c5b('0x22')](respondWithResult(_0x55ed41,null))[_0x4c5b('0x3e')](handleError(_0x55ed41,null));}; \ No newline at end of file +var _0x72d8=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x480ab1,_0x2ab18d){var _0xb8e7b4=function(_0x9ea56d){while(--_0x9ea56d){_0x480ab1['push'](_0x480ab1['shift']());}};_0xb8e7b4(++_0x2ab18d);}(_0x72d8,0x135));var _0x872d=function(_0x585199,_0x10d223){_0x585199=_0x585199-0x0;var _0x4f5eaf=_0x72d8[_0x585199];return _0x4f5eaf;};'use strict';var pdf=require(_0x872d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x872d('0x1'));var zipdir=require(_0x872d('0x2'));var jsonpatch=require(_0x872d('0x3'));var rp=require(_0x872d('0x4'));var moment=require(_0x872d('0x5'));var BPromise=require(_0x872d('0x6'));var Mustache=require(_0x872d('0x7'));var util=require(_0x872d('0x8'));var path=require(_0x872d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x872d('0xa'));var fs=require('fs');var _=require(_0x872d('0xb'));var squel=require(_0x872d('0xc'));var crypto=require(_0x872d('0xd'));var jsforce=require(_0x872d('0xe'));var deskjs=require(_0x872d('0xf'));var toCsv=require(_0x872d('0x10'));var querystring=require(_0x872d('0x11'));var Papa=require('papaparse');var Redis=require(_0x872d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x872d('0x13'));var as=require(_0x872d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x872d('0x15'))('api');var utils=require(_0x872d('0x16'));var config=require(_0x872d('0x17'));var licenseUtil=require(_0x872d('0x18'));var db=require(_0x872d('0x19'))['db'];function respondWithStatusCode(_0x1ac371,_0x91657b){_0x91657b=_0x91657b||0xcc;return function(_0xd6cc4e){if(_0xd6cc4e){return _0x1ac371[_0x872d('0x1a')](_0x91657b);}return _0x1ac371[_0x872d('0x1b')](_0x91657b)[_0x872d('0x1c')]();};}function respondWithResult(_0x4b9767,_0x5d3233){_0x5d3233=_0x5d3233||0xc8;return function(_0x24254b){if(_0x24254b){return _0x4b9767[_0x872d('0x1b')](_0x5d3233)[_0x872d('0x1d')](_0x24254b);}};}function respondWithFilteredResult(_0x268ec1,_0xb754a5){return function(_0xac9df1){if(_0xac9df1){var _0x438f1e=_0xac9df1['count'],_0x30a1c8=_0xb754a5[_0x872d('0x1e')],_0x476eeb=_0xb754a5[_0x872d('0x1e')]+_0xb754a5[_0x872d('0x1f')],_0x21fad3;if(_0x476eeb>=_0x438f1e){_0x476eeb=_0x438f1e;_0x21fad3=0xc8;}else{_0x21fad3=0xce;}_0x268ec1[_0x872d('0x1b')](_0x21fad3);return _0x268ec1['set'](_0x872d('0x20'),_0x30a1c8+'-'+_0x476eeb+'/'+_0x438f1e)[_0x872d('0x1d')](_0xac9df1);}return null;};}function patchUpdates(_0x2377ec){return function(_0x56e4ec){try{jsonpatch[_0x872d('0x21')](_0x56e4ec,_0x2377ec,!![]);}catch(_0x35e56f){return BPromise[_0x872d('0x22')](_0x35e56f);}return _0x56e4ec[_0x872d('0x23')]();};}function saveUpdates(_0x1d94fb,_0x3b57ac){return function(_0x4c6b0c){if(_0x4c6b0c){return _0x4c6b0c['update'](_0x1d94fb)[_0x872d('0x24')](function(_0x1a5bf8){return _0x1a5bf8;});}return null;};}function removeEntity(_0x186cd0,_0x342cb1){return function(_0x200f67){if(_0x200f67){return _0x200f67[_0x872d('0x25')]()[_0x872d('0x24')](function(){_0x186cd0['status'](0xcc)[_0x872d('0x1c')]();});}};}function handleEntityNotFound(_0x499b7e,_0x19450f){return function(_0x19b0b7){if(!_0x19b0b7){_0x499b7e['sendStatus'](0x194);}return _0x19b0b7;};}function handleError(_0x476034,_0x433d22){_0x433d22=_0x433d22||0x1f4;return function(_0x4d64f4){logger[_0x872d('0x26')](_0x4d64f4[_0x872d('0x27')]);if(_0x4d64f4['name']){delete _0x4d64f4[_0x872d('0x28')];}_0x476034['status'](_0x433d22)['send'](_0x4d64f4);};}exports[_0x872d('0x29')]=function(_0xa2a2a7,_0x53fb33){var _0x52a956={},_0x286355={},_0x2dcab9={'count':0x0,'rows':[]};var _0x54c107=_[_0x872d('0x2a')](db[_0x872d('0x2b')]['rawAttributes'],function(_0x3f9839){return{'name':_0x3f9839[_0x872d('0x2c')],'type':_0x3f9839[_0x872d('0x2d')]['key']};});_0x286355[_0x872d('0x2e')]=_[_0x872d('0x2a')](_0x54c107,_0x872d('0x28'));_0x286355[_0x872d('0x2f')]=_['keys'](_0xa2a2a7[_0x872d('0x2f')]);_0x286355['filters']=_[_0x872d('0x30')](_0x286355[_0x872d('0x2e')],_0x286355['query']);_0x52a956[_0x872d('0x31')]=_['intersection'](_0x286355[_0x872d('0x2e')],qs['fields'](_0xa2a2a7['query'][_0x872d('0x32')]));_0x52a956[_0x872d('0x31')]=_0x52a956[_0x872d('0x31')][_0x872d('0x33')]?_0x52a956['attributes']:_0x286355[_0x872d('0x2e')];if(!_0xa2a2a7[_0x872d('0x2f')]['hasOwnProperty'](_0x872d('0x34'))){_0x52a956[_0x872d('0x1f')]=qs[_0x872d('0x1f')](_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x1f')]);_0x52a956['offset']=qs[_0x872d('0x1e')](_0xa2a2a7[_0x872d('0x2f')]['offset']);}_0x52a956[_0x872d('0x35')]=qs[_0x872d('0x36')](_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x36')]);_0x52a956[_0x872d('0x37')]=qs[_0x872d('0x38')](_['pick'](_0xa2a2a7[_0x872d('0x2f')],_0x286355[_0x872d('0x38')]),_0x54c107);if(_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x39')]){_0x52a956['where']=_[_0x872d('0x3a')](_0x52a956[_0x872d('0x37')],{'$or':_[_0x872d('0x2a')](_0x54c107,function(_0x3bdd3c){if(_0x3bdd3c[_0x872d('0x2d')]!==_0x872d('0x3b')){var _0x18acd2={};_0x18acd2[_0x3bdd3c[_0x872d('0x28')]]={'$like':'%'+_0xa2a2a7[_0x872d('0x2f')][_0x872d('0x39')]+'%'};return _0x18acd2;}})});}_0x52a956=_['merge']({},_0x52a956,_0xa2a2a7['options']);var _0x986b49={'where':_0x52a956[_0x872d('0x37')]};return db['AnalyticFieldReport']['count'](_0x986b49)[_0x872d('0x24')](function(_0x13de03){_0x2dcab9['count']=_0x13de03;if(_0xa2a2a7['query'][_0x872d('0x3c')]){_0x52a956[_0x872d('0x3d')]=[{'all':!![]}];}return db[_0x872d('0x2b')][_0x872d('0x3e')](_0x52a956);})[_0x872d('0x24')](function(_0x174298){_0x2dcab9[_0x872d('0x3f')]=_0x174298;return _0x2dcab9;})[_0x872d('0x24')](respondWithFilteredResult(_0x53fb33,_0x52a956))[_0x872d('0x40')](handleError(_0x53fb33,null));};exports[_0x872d('0x41')]=function(_0x3ed936,_0x5015dd){var _0x2e458c={'raw':![],'where':{'id':_0x3ed936[_0x872d('0x42')]['id']}},_0x4eeef4={};_0x4eeef4[_0x872d('0x2e')]=_[_0x872d('0x43')](db[_0x872d('0x2b')]['rawAttributes']);_0x4eeef4[_0x872d('0x2f')]=_[_0x872d('0x43')](_0x3ed936['query']);_0x4eeef4[_0x872d('0x38')]=_[_0x872d('0x30')](_0x4eeef4[_0x872d('0x2e')],_0x4eeef4['query']);_0x2e458c['attributes']=_[_0x872d('0x30')](_0x4eeef4[_0x872d('0x2e')],qs[_0x872d('0x32')](_0x3ed936[_0x872d('0x2f')][_0x872d('0x32')]));_0x2e458c[_0x872d('0x31')]=_0x2e458c[_0x872d('0x31')][_0x872d('0x33')]?_0x2e458c[_0x872d('0x31')]:_0x4eeef4[_0x872d('0x2e')];if(_0x3ed936['query'][_0x872d('0x3c')]){_0x2e458c['include']=[{'all':!![]}];}_0x2e458c=_[_0x872d('0x3a')]({},_0x2e458c,_0x3ed936[_0x872d('0x44')]);return db[_0x872d('0x2b')][_0x872d('0x45')](_0x2e458c)[_0x872d('0x24')](handleEntityNotFound(_0x5015dd,null))[_0x872d('0x24')](respondWithResult(_0x5015dd,null))[_0x872d('0x40')](handleError(_0x5015dd,null));};exports[_0x872d('0x46')]=function(_0x2b63f8,_0x594b65){return db[_0x872d('0x2b')]['create'](_0x2b63f8[_0x872d('0x47')],{})[_0x872d('0x24')](respondWithResult(_0x594b65,0xc9))['catch'](handleError(_0x594b65,null));};exports[_0x872d('0x48')]=function(_0xc8f960,_0x941680){return db['AnalyticFieldReport'][_0x872d('0x48')](_0xc8f960[_0x872d('0x47')],{'raw':![],'individualHooks':!![]})[_0x872d('0x24')](respondWithResult(_0x941680,0xc9))['catch'](handleError(_0x941680,null));};exports['update']=function(_0x1514f0,_0x406be2){if(_0x1514f0[_0x872d('0x47')]['id']){delete _0x1514f0[_0x872d('0x47')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x1514f0[_0x872d('0x42')]['id']}})[_0x872d('0x24')](handleEntityNotFound(_0x406be2,null))[_0x872d('0x24')](saveUpdates(_0x1514f0[_0x872d('0x47')],null))[_0x872d('0x24')](respondWithResult(_0x406be2,null))[_0x872d('0x40')](handleError(_0x406be2,null));};exports[_0x872d('0x25')]=function(_0x2ec1f8,_0x51448e){return db[_0x872d('0x2b')][_0x872d('0x45')]({'where':{'id':_0x2ec1f8[_0x872d('0x42')]['id']}})[_0x872d('0x24')](handleEntityNotFound(_0x51448e,null))[_0x872d('0x24')](removeEntity(_0x51448e,null))['catch'](handleError(_0x51448e,null));};exports[_0x872d('0x49')]=function(_0x3ad71e,_0x1a2dee){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x3ad71e[_0x872d('0x2f')][_0x872d('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1a2dee,0xcc))[_0x872d('0x40')](handleError(_0x1a2dee,null));};exports[_0x872d('0x4b')]=function(_0x3411d5,_0x43009d,_0x1b0b08){return db[_0x872d('0x4c')]['findOne']({'where':{'id':_0x3411d5['params']['id']}})[_0x872d('0x24')](handleEntityNotFound(_0x43009d,null))[_0x872d('0x24')](function(_0x1837fc){if(_0x1837fc){return db[_0x872d('0x4d')][_0x872d('0x4e')](function(_0x563b91){return db[_0x872d('0x2b')][_0x872d('0x25')]({'where':{'CustomReportId':_0x3411d5['params']['id']},'transaction':_0x563b91})[_0x872d('0x24')](function(_0x225753){var _0x49517f=_[_0x872d('0x2a')](_0x3411d5[_0x872d('0x47')],function(_0x462571){delete _0x462571['id'];_0x462571[_0x872d('0x4f')]=_0x3411d5[_0x872d('0x42')]['id'];return _0x462571;});return db['AnalyticFieldReport'][_0x872d('0x48')](_0x49517f,{'transaction':_0x563b91});});})[_0x872d('0x24')](function(){return db['AnalyticFieldReport'][_0x872d('0x3e')]({'where':{'CustomReportId':_0x3411d5[_0x872d('0x42')]['id']}});});}})[_0x872d('0x24')](respondWithResult(_0x43009d,null))[_0x872d('0x40')](handleError(_0x43009d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ec15ecc..abfbc20 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 _0x8d3c=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x16cfb0,_0x28d646){var _0x3d8504=function(_0x415941){while(--_0x415941){_0x16cfb0['push'](_0x16cfb0['shift']());}};_0x3d8504(++_0x28d646);}(_0x8d3c,0x9b));var _0xc8d3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8d3c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc8d3('0x0'));var util=require('util');var logger=require(_0xc8d3('0x1'))(_0xc8d3('0x2'));var moment=require(_0xc8d3('0x3'));var BPromise=require(_0xc8d3('0x4'));var rp=require(_0xc8d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8d3('0x6'));var config=require(_0xc8d3('0x7'));var attributes=require(_0xc8d3('0x8'));module[_0xc8d3('0x9')]=function(_0x2f8e67,_0x5da8b5){return _0x2f8e67[_0xc8d3('0xa')](_0xc8d3('0xb'),attributes,{'tableName':_0xc8d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6833=['rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment','request-promise','path'];(function(_0x1deafa,_0x3686f4){var _0x270f78=function(_0x150daa){while(--_0x150daa){_0x1deafa['push'](_0x1deafa['shift']());}};_0x270f78(++_0x3686f4);}(_0x6833,0xa5));var _0x3683=function(_0x558137,_0x2073b0){_0x558137=_0x558137-0x0;var _0xdb81d9=_0x6833[_0x558137];return _0xdb81d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3683('0x0'))(_0x3683('0x1'));var moment=require(_0x3683('0x2'));var BPromise=require('bluebird');var rp=require(_0x3683('0x3'));var fs=require('fs');var path=require(_0x3683('0x4'));var rimraf=require(_0x3683('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x3683('0x6')]=function(_0x544bbd,_0x5014af){return _0x544bbd[_0x3683('0x7')](_0x3683('0x8'),attributes,{'tableName':_0x3683('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 114c2e2..9942c88 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 _0x2434=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','moment'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x2434,0x135));var _0x4243=function(_0x1184ce,_0x451bf7){_0x1184ce=_0x1184ce-0x0;var _0x303f3f=_0x2434[_0x1184ce];return _0x303f3f;};'use strict';var _=require(_0x4243('0x0'));var util=require(_0x4243('0x1'));var moment=require(_0x4243('0x2'));var BPromise=require(_0x4243('0x3'));var rs=require(_0x4243('0x4'));var fs=require('fs');var Redis=require(_0x4243('0x5'));var db=require(_0x4243('0x6'))['db'];var utils=require(_0x4243('0x7'));var logger=require(_0x4243('0x8'))('rpc');var config=require(_0x4243('0x9'));var jayson=require(_0x4243('0xa'));var client=jayson[_0x4243('0xb')][_0x4243('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x181117,_0x8e7aff,_0x53c804){return new BPromise(function(_0x3c0630,_0x2c512a){return client[_0x4243('0xd')](_0x181117,_0x53c804)[_0x4243('0xe')](function(_0x3151dd){logger[_0x4243('0xf')](_0x4243('0x10'),_0x8e7aff,_0x4243('0x11'));logger[_0x4243('0x12')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x8e7aff,_0x4243('0x11'),JSON[_0x4243('0x13')](_0x3151dd));if(_0x3151dd['error']){if(_0x3151dd['error'][_0x4243('0x14')]===0x1f4){logger[_0x4243('0x15')](_0x4243('0x10'),_0x8e7aff,_0x3151dd['error'][_0x4243('0x16')]);return _0x2c512a(_0x3151dd['error']['message']);}logger[_0x4243('0x15')](_0x4243('0x10'),_0x8e7aff,_0x3151dd['error'][_0x4243('0x16')]);return _0x3c0630(_0x3151dd[_0x4243('0x15')][_0x4243('0x16')]);}else{logger[_0x4243('0xf')](_0x4243('0x10'),_0x8e7aff,_0x4243('0x11'));_0x3c0630(_0x3151dd[_0x4243('0x17')]['message']);}})['catch'](function(_0x1cb7d5){logger[_0x4243('0x15')](_0x4243('0x10'),_0x8e7aff,_0x1cb7d5);_0x2c512a(_0x1cb7d5);});});} \ No newline at end of file +var _0x9d8f=['request\x20sent','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x4d515d,_0x108c96){var _0x58fe07=function(_0x2e18bf){while(--_0x2e18bf){_0x4d515d['push'](_0x4d515d['shift']());}};_0x58fe07(++_0x108c96);}(_0x9d8f,0x132));var _0xf9d8=function(_0x14c500,_0x4d1d6a){_0x14c500=_0x14c500-0x0;var _0x45ee40=_0x9d8f[_0x14c500];return _0x45ee40;};'use strict';var _=require(_0xf9d8('0x0'));var util=require('util');var moment=require(_0xf9d8('0x1'));var BPromise=require(_0xf9d8('0x2'));var rs=require(_0xf9d8('0x3'));var fs=require('fs');var Redis=require(_0xf9d8('0x4'));var db=require(_0xf9d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9d8('0x6'))(_0xf9d8('0x7'));var config=require(_0xf9d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9d8('0x9')][_0xf9d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d285,_0xe27bb9,_0x394184){return new BPromise(function(_0x59bf49,_0x5a1265){return client[_0xf9d8('0xb')](_0x25d285,_0x394184)[_0xf9d8('0xc')](function(_0x49b97a){logger[_0xf9d8('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,'request\x20sent');logger[_0xf9d8('0xe')](_0xf9d8('0xf'),_0xe27bb9,_0xf9d8('0x10'),JSON['stringify'](_0x49b97a));if(_0x49b97a[_0xf9d8('0x11')]){if(_0x49b97a[_0xf9d8('0x11')][_0xf9d8('0x12')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,_0x49b97a['error'][_0xf9d8('0x13')]);return _0x5a1265(_0x49b97a[_0xf9d8('0x11')][_0xf9d8('0x13')]);}logger[_0xf9d8('0x11')](_0xf9d8('0x14'),_0xe27bb9,_0x49b97a['error'][_0xf9d8('0x13')]);return _0x59bf49(_0x49b97a['error'][_0xf9d8('0x13')]);}else{logger[_0xf9d8('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,_0xf9d8('0x10'));_0x59bf49(_0x49b97a[_0xf9d8('0x15')][_0xf9d8('0x13')]);}})[_0xf9d8('0x16')](function(_0x4c1cfe){logger[_0xf9d8('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0xe27bb9,_0x4c1cfe);_0x5a1265(_0x4c1cfe);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d31d589..97eefdf 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x4e2b4c,_0x212abb){var _0x3947eb=function(_0x35e32f){while(--_0x35e32f){_0x4e2b4c['push'](_0x4e2b4c['shift']());}};_0x3947eb(++_0x212abb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x5fc3[_0x9b3efc];return _0x200f05;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x314d3f,_0x249185){var _0x54a5a5=function(_0x528619){while(--_0x528619){_0x314d3f['push'](_0x314d3f['shift']());}};_0x54a5a5(++_0x249185);}(_0x814b,0x1a2));var _0xb814=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0x814b[_0x301c34];return _0x1a8c5a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9ec9ea7..243eb2b 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 _0xe027=['name','TEXT','sequelize','exports','STRING'];(function(_0x57f152,_0x34be17){var _0x283d82=function(_0x150b50){while(--_0x150b50){_0x57f152['push'](_0x57f152['shift']());}};_0x283d82(++_0x34be17);}(_0xe027,0x106));var _0x7e02=function(_0x2a3778,_0x3a9653){_0x2a3778=_0x2a3778-0x0;var _0x427785=_0xe027[_0x2a3778];return _0x427785;};'use strict';var Sequelize=require(_0x7e02('0x0'));module[_0x7e02('0x1')]={'name':{'type':Sequelize[_0x7e02('0x2')],'allowNull':![],'unique':_0x7e02('0x3')},'table':{'type':Sequelize[_0x7e02('0x2')]},'metric':{'type':Sequelize[_0x7e02('0x4')]},'description':{'type':Sequelize[_0x7e02('0x2')]}}; \ No newline at end of file +var _0x8769=['TEXT','STRING','sequelize','exports','name'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8769,0x110));var _0x9876=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x8769[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9876('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x9876('0x3')]},'description':{'type':Sequelize[_0x9876('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 70930ad..591eb9a 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 _0x93d2=['nolimit','limit','sort','where','filter','merge','type','VIRTUAL','name','options','include','findAll','rows','catch','includeAll','find','create','user','get','role','Metrics','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','stack','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x408c37,_0x52cfc2){var _0x417066=function(_0x3d0b63){while(--_0x3d0b63){_0x408c37['push'](_0x408c37['shift']());}};_0x417066(++_0x52cfc2);}(_0x93d2,0x1aa));var _0x293d=function(_0x41015c,_0x5aa973){_0x41015c=_0x41015c-0x0;var _0x44bb9f=_0x93d2[_0x41015c];return _0x44bb9f;};'use strict';var pdf=require(_0x293d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x293d('0x1'));var zipdir=require(_0x293d('0x2'));var jsonpatch=require(_0x293d('0x3'));var rp=require(_0x293d('0x4'));var moment=require(_0x293d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x293d('0x6'));var util=require(_0x293d('0x7'));var path=require(_0x293d('0x8'));var sox=require(_0x293d('0x9'));var csv=require(_0x293d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x293d('0xb'));var squel=require(_0x293d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x293d('0xd'));var toCsv=require(_0x293d('0xa'));var querystring=require('querystring');var Papa=require(_0x293d('0xe'));var Redis=require(_0x293d('0xf'));var authService=require(_0x293d('0x10'));var qs=require(_0x293d('0x11'));var as=require(_0x293d('0x12'));var hardwareService=require(_0x293d('0x13'));var logger=require(_0x293d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x293d('0x15'));var licenseUtil=require(_0x293d('0x16'));var db=require(_0x293d('0x17'))['db'];function respondWithStatusCode(_0x539d6a,_0x32d790){_0x32d790=_0x32d790||0xcc;return function(_0x32b0b7){if(_0x32b0b7){return _0x539d6a[_0x293d('0x18')](_0x32d790);}return _0x539d6a['status'](_0x32d790)[_0x293d('0x19')]();};}function respondWithResult(_0x39dda4,_0xc1a991){_0xc1a991=_0xc1a991||0xc8;return function(_0x5ce00d){if(_0x5ce00d){return _0x39dda4[_0x293d('0x1a')](_0xc1a991)[_0x293d('0x1b')](_0x5ce00d);}};}function respondWithFilteredResult(_0x331b11,_0x4d522a){return function(_0x2effa1){if(_0x2effa1){var _0x256ed9=_0x2effa1[_0x293d('0x1c')],_0x17ab13=_0x4d522a[_0x293d('0x1d')],_0x11af38=_0x4d522a['offset']+_0x4d522a['limit'],_0x3ca38b;if(_0x11af38>=_0x256ed9){_0x11af38=_0x256ed9;_0x3ca38b=0xc8;}else{_0x3ca38b=0xce;}_0x331b11[_0x293d('0x1a')](_0x3ca38b);return _0x331b11[_0x293d('0x1e')](_0x293d('0x1f'),_0x17ab13+'-'+_0x11af38+'/'+_0x256ed9)[_0x293d('0x1b')](_0x2effa1);}return null;};}function patchUpdates(_0x4dfb3b){return function(_0x4b2527){try{jsonpatch[_0x293d('0x20')](_0x4b2527,_0x4dfb3b,!![]);}catch(_0x288578){return BPromise[_0x293d('0x21')](_0x288578);}return _0x4b2527['save']();};}function saveUpdates(_0x2723cf,_0x258094){return function(_0x59ef6f){if(_0x59ef6f){return _0x59ef6f[_0x293d('0x22')](_0x2723cf)['then'](function(_0x4d9875){return _0x4d9875;});}return null;};}function removeEntity(_0x370f99,_0x46dda5){return function(_0x47a030){if(_0x47a030){return _0x47a030[_0x293d('0x23')]()[_0x293d('0x24')](function(){var _0x4cc871=_0x47a030['get']({'plain':!![]});var _0x55466b='Metrics';return db[_0x293d('0x25')][_0x293d('0x23')]({'where':{'type':_0x55466b,'resourceId':_0x4cc871['id']}})[_0x293d('0x24')](function(){return _0x47a030;});})[_0x293d('0x24')](function(){_0x370f99[_0x293d('0x1a')](0xcc)[_0x293d('0x19')]();});}};}function handleEntityNotFound(_0x2eec3d,_0x5c5feb){return function(_0x43b32f){if(!_0x43b32f){_0x2eec3d['sendStatus'](0x194);}return _0x43b32f;};}function handleError(_0x1ad7f0,_0x2fe5aa){_0x2fe5aa=_0x2fe5aa||0x1f4;return function(_0x7a9bdd){logger[_0x293d('0x26')](_0x7a9bdd[_0x293d('0x27')]);if(_0x7a9bdd['name']){delete _0x7a9bdd['name'];}_0x1ad7f0[_0x293d('0x1a')](_0x2fe5aa)['send'](_0x7a9bdd);};}exports['index']=function(_0x36c582,_0x1b9efd){var _0x235e93={},_0x1b485b={},_0x40bf44={'count':0x0,'rows':[]};var _0x34845d=_[_0x293d('0x28')](db[_0x293d('0x29')][_0x293d('0x2a')],function(_0x3fdb7b){return{'name':_0x3fdb7b[_0x293d('0x2b')],'type':_0x3fdb7b['type'][_0x293d('0x2c')]};});_0x1b485b[_0x293d('0x2d')]=_['map'](_0x34845d,'name');_0x1b485b[_0x293d('0x2e')]=_[_0x293d('0x2f')](_0x36c582[_0x293d('0x2e')]);_0x1b485b[_0x293d('0x30')]=_[_0x293d('0x31')](_0x1b485b[_0x293d('0x2d')],_0x1b485b[_0x293d('0x2e')]);_0x235e93['attributes']=_[_0x293d('0x31')](_0x1b485b[_0x293d('0x2d')],qs[_0x293d('0x32')](_0x36c582[_0x293d('0x2e')][_0x293d('0x32')]));_0x235e93[_0x293d('0x33')]=_0x235e93[_0x293d('0x33')][_0x293d('0x34')]?_0x235e93[_0x293d('0x33')]:_0x1b485b[_0x293d('0x2d')];if(!_0x36c582[_0x293d('0x2e')][_0x293d('0x35')](_0x293d('0x36'))){_0x235e93[_0x293d('0x37')]=qs[_0x293d('0x37')](_0x36c582[_0x293d('0x2e')][_0x293d('0x37')]);_0x235e93[_0x293d('0x1d')]=qs[_0x293d('0x1d')](_0x36c582[_0x293d('0x2e')][_0x293d('0x1d')]);}_0x235e93['order']=qs['sort'](_0x36c582[_0x293d('0x2e')][_0x293d('0x38')]);_0x235e93[_0x293d('0x39')]=qs[_0x293d('0x30')](_['pick'](_0x36c582[_0x293d('0x2e')],_0x1b485b[_0x293d('0x30')]),_0x34845d);if(_0x36c582[_0x293d('0x2e')][_0x293d('0x3a')]){_0x235e93['where']=_[_0x293d('0x3b')](_0x235e93['where'],{'$or':_[_0x293d('0x28')](_0x34845d,function(_0xbc64a2){if(_0xbc64a2[_0x293d('0x3c')]!==_0x293d('0x3d')){var _0x29d4fa={};_0x29d4fa[_0xbc64a2[_0x293d('0x3e')]]={'$like':'%'+_0x36c582['query']['filter']+'%'};return _0x29d4fa;}})});}_0x235e93=_[_0x293d('0x3b')]({},_0x235e93,_0x36c582[_0x293d('0x3f')]);var _0x1fa33a={'where':_0x235e93[_0x293d('0x39')]};return db['AnalyticMetric'][_0x293d('0x1c')](_0x1fa33a)[_0x293d('0x24')](function(_0x3c0400){_0x40bf44[_0x293d('0x1c')]=_0x3c0400;if(_0x36c582[_0x293d('0x2e')]['includeAll']){_0x235e93[_0x293d('0x40')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x293d('0x41')](_0x235e93);})[_0x293d('0x24')](function(_0x949d10){_0x40bf44[_0x293d('0x42')]=_0x949d10;return _0x40bf44;})[_0x293d('0x24')](respondWithFilteredResult(_0x1b9efd,_0x235e93))[_0x293d('0x43')](handleError(_0x1b9efd,null));};exports['show']=function(_0x5ecead,_0x4c57e6){var _0xdf965d={'raw':!![],'where':{'id':_0x5ecead['params']['id']}},_0x36d510={};_0x36d510[_0x293d('0x2d')]=_[_0x293d('0x2f')](db['AnalyticMetric'][_0x293d('0x2a')]);_0x36d510[_0x293d('0x2e')]=_[_0x293d('0x2f')](_0x5ecead[_0x293d('0x2e')]);_0x36d510[_0x293d('0x30')]=_[_0x293d('0x31')](_0x36d510[_0x293d('0x2d')],_0x36d510['query']);_0xdf965d[_0x293d('0x33')]=_[_0x293d('0x31')](_0x36d510['model'],qs[_0x293d('0x32')](_0x5ecead[_0x293d('0x2e')][_0x293d('0x32')]));_0xdf965d[_0x293d('0x33')]=_0xdf965d[_0x293d('0x33')][_0x293d('0x34')]?_0xdf965d['attributes']:_0x36d510['model'];if(_0x5ecead[_0x293d('0x2e')][_0x293d('0x44')]){_0xdf965d['include']=[{'all':!![]}];}_0xdf965d=_[_0x293d('0x3b')]({},_0xdf965d,_0x5ecead[_0x293d('0x3f')]);return db[_0x293d('0x29')][_0x293d('0x45')](_0xdf965d)[_0x293d('0x24')](handleEntityNotFound(_0x4c57e6,null))[_0x293d('0x24')](respondWithResult(_0x4c57e6,null))[_0x293d('0x43')](handleError(_0x4c57e6,null));};exports['create']=function(_0x42f15f,_0x29d87a){return db[_0x293d('0x29')][_0x293d('0x46')](_0x42f15f['body'],{})[_0x293d('0x24')](function(_0x5b6cd2){var _0x4facb0=_0x42f15f[_0x293d('0x47')][_0x293d('0x48')]({'plain':!![]});if(!_0x4facb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4facb0[_0x293d('0x49')]==='user'){var _0x347bfa=_0x5b6cd2[_0x293d('0x48')]({'plain':!![]});var _0x1e77f7=_0x293d('0x4a');return db[_0x293d('0x4b')]['find']({'where':{'name':_0x1e77f7,'userProfileId':_0x4facb0['userProfileId']},'raw':!![]})['then'](function(_0x1c5c7d){if(_0x1c5c7d&&_0x1c5c7d[_0x293d('0x4c')]===0x0){return db[_0x293d('0x25')][_0x293d('0x46')]({'name':_0x347bfa[_0x293d('0x3e')],'resourceId':_0x347bfa['id'],'type':_0x1c5c7d[_0x293d('0x3e')],'sectionId':_0x1c5c7d['id']},{})[_0x293d('0x24')](function(){return _0x5b6cd2;});}else{return _0x5b6cd2;}})[_0x293d('0x43')](function(_0x2dda10){logger[_0x293d('0x26')](_0x293d('0x4d'),_0x2dda10);throw _0x2dda10;});}return _0x5b6cd2;})['then'](respondWithResult(_0x29d87a,0xc9))[_0x293d('0x43')](handleError(_0x29d87a,null));};exports['update']=function(_0xde519a,_0x281262){if(_0xde519a[_0x293d('0x4e')]['id']){delete _0xde519a[_0x293d('0x4e')]['id'];}return db[_0x293d('0x29')][_0x293d('0x45')]({'where':{'id':_0xde519a[_0x293d('0x4f')]['id']}})[_0x293d('0x24')](handleEntityNotFound(_0x281262,null))[_0x293d('0x24')](saveUpdates(_0xde519a[_0x293d('0x4e')],null))[_0x293d('0x24')](respondWithResult(_0x281262,null))['catch'](handleError(_0x281262,null));};exports[_0x293d('0x23')]=function(_0x498718,_0x134df7){return db[_0x293d('0x29')][_0x293d('0x45')]({'where':{'id':_0x498718['params']['id']}})[_0x293d('0x24')](handleEntityNotFound(_0x134df7,null))[_0x293d('0x24')](removeEntity(_0x134df7,null))[_0x293d('0x43')](handleError(_0x134df7,null));}; \ No newline at end of file +var _0x2b2d=['send','index','map','AnalyticMetric','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name'];(function(_0x487d10,_0x555612){var _0x1620db=function(_0x23056a){while(--_0x23056a){_0x487d10['push'](_0x487d10['shift']());}};_0x1620db(++_0x555612);}(_0x2b2d,0x127));var _0xd2b2=function(_0x42160c,_0x30e856){_0x42160c=_0x42160c-0x0;var _0xdba9cb=_0x2b2d[_0x42160c];return _0xdba9cb;};'use strict';var pdf=require(_0xd2b2('0x0'));var emlformat=require(_0xd2b2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd2b2('0x2'));var rp=require(_0xd2b2('0x3'));var moment=require(_0xd2b2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2b2('0x5'));var path=require(_0xd2b2('0x6'));var sox=require(_0xd2b2('0x7'));var csv=require(_0xd2b2('0x8'));var ejs=require(_0xd2b2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd2b2('0xa'));var crypto=require(_0xd2b2('0xb'));var jsforce=require(_0xd2b2('0xc'));var deskjs=require(_0xd2b2('0xd'));var toCsv=require(_0xd2b2('0x8'));var querystring=require(_0xd2b2('0xe'));var Papa=require(_0xd2b2('0xf'));var Redis=require(_0xd2b2('0x10'));var authService=require(_0xd2b2('0x11'));var qs=require(_0xd2b2('0x12'));var as=require(_0xd2b2('0x13'));var hardwareService=require(_0xd2b2('0x14'));var logger=require(_0xd2b2('0x15'))(_0xd2b2('0x16'));var utils=require(_0xd2b2('0x17'));var config=require(_0xd2b2('0x18'));var licenseUtil=require(_0xd2b2('0x19'));var db=require(_0xd2b2('0x1a'))['db'];function respondWithStatusCode(_0x3c28e6,_0x55983e){_0x55983e=_0x55983e||0xcc;return function(_0x35c5c5){if(_0x35c5c5){return _0x3c28e6['sendStatus'](_0x55983e);}return _0x3c28e6[_0xd2b2('0x1b')](_0x55983e)[_0xd2b2('0x1c')]();};}function respondWithResult(_0x4e7072,_0x24acc3){_0x24acc3=_0x24acc3||0xc8;return function(_0x459e54){if(_0x459e54){return _0x4e7072[_0xd2b2('0x1b')](_0x24acc3)[_0xd2b2('0x1d')](_0x459e54);}};}function respondWithFilteredResult(_0x31c9cb,_0x8fdd8b){return function(_0x3494a6){if(_0x3494a6){var _0x4a52d6=_0x3494a6[_0xd2b2('0x1e')],_0x3a96cc=_0x8fdd8b['offset'],_0x5bb6d1=_0x8fdd8b['offset']+_0x8fdd8b['limit'],_0x3def31;if(_0x5bb6d1>=_0x4a52d6){_0x5bb6d1=_0x4a52d6;_0x3def31=0xc8;}else{_0x3def31=0xce;}_0x31c9cb[_0xd2b2('0x1b')](_0x3def31);return _0x31c9cb[_0xd2b2('0x1f')](_0xd2b2('0x20'),_0x3a96cc+'-'+_0x5bb6d1+'/'+_0x4a52d6)['json'](_0x3494a6);}return null;};}function patchUpdates(_0x1de7d9){return function(_0x26f657){try{jsonpatch[_0xd2b2('0x21')](_0x26f657,_0x1de7d9,!![]);}catch(_0xf7a184){return BPromise[_0xd2b2('0x22')](_0xf7a184);}return _0x26f657['save']();};}function saveUpdates(_0x3dcfa4,_0x2271a1){return function(_0x45a50a){if(_0x45a50a){return _0x45a50a[_0xd2b2('0x23')](_0x3dcfa4)[_0xd2b2('0x24')](function(_0x4bda7a){return _0x4bda7a;});}return null;};}function removeEntity(_0x4073bc,_0x532bc5){return function(_0x3e63df){if(_0x3e63df){return _0x3e63df[_0xd2b2('0x25')]()['then'](function(){var _0xcb1e9f=_0x3e63df[_0xd2b2('0x26')]({'plain':!![]});var _0xa3ba6e=_0xd2b2('0x27');return db[_0xd2b2('0x28')][_0xd2b2('0x25')]({'where':{'type':_0xa3ba6e,'resourceId':_0xcb1e9f['id']}})['then'](function(){return _0x3e63df;});})[_0xd2b2('0x24')](function(){_0x4073bc['status'](0xcc)[_0xd2b2('0x1c')]();});}};}function handleEntityNotFound(_0xa3c3dd,_0x5c782a){return function(_0xfd5b36){if(!_0xfd5b36){_0xa3c3dd[_0xd2b2('0x29')](0x194);}return _0xfd5b36;};}function handleError(_0x5bf271,_0x185f4f){_0x185f4f=_0x185f4f||0x1f4;return function(_0x18757b){logger[_0xd2b2('0x2a')](_0x18757b[_0xd2b2('0x2b')]);if(_0x18757b[_0xd2b2('0x2c')]){delete _0x18757b['name'];}_0x5bf271[_0xd2b2('0x1b')](_0x185f4f)[_0xd2b2('0x2d')](_0x18757b);};}exports[_0xd2b2('0x2e')]=function(_0x534ddb,_0x52bacb){var _0x1381aa={},_0x52fa6c={},_0x116a89={'count':0x0,'rows':[]};var _0x555d6c=_[_0xd2b2('0x2f')](db[_0xd2b2('0x30')]['rawAttributes'],function(_0x2c30e8){return{'name':_0x2c30e8[_0xd2b2('0x31')],'type':_0x2c30e8[_0xd2b2('0x32')][_0xd2b2('0x33')]};});_0x52fa6c[_0xd2b2('0x34')]=_[_0xd2b2('0x2f')](_0x555d6c,_0xd2b2('0x2c'));_0x52fa6c[_0xd2b2('0x35')]=_['keys'](_0x534ddb[_0xd2b2('0x35')]);_0x52fa6c[_0xd2b2('0x36')]=_[_0xd2b2('0x37')](_0x52fa6c[_0xd2b2('0x34')],_0x52fa6c[_0xd2b2('0x35')]);_0x1381aa['attributes']=_[_0xd2b2('0x37')](_0x52fa6c['model'],qs[_0xd2b2('0x38')](_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x38')]));_0x1381aa[_0xd2b2('0x39')]=_0x1381aa[_0xd2b2('0x39')][_0xd2b2('0x3a')]?_0x1381aa[_0xd2b2('0x39')]:_0x52fa6c[_0xd2b2('0x34')];if(!_0x534ddb[_0xd2b2('0x35')]['hasOwnProperty'](_0xd2b2('0x3b'))){_0x1381aa[_0xd2b2('0x3c')]=qs[_0xd2b2('0x3c')](_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x3c')]);_0x1381aa[_0xd2b2('0x3d')]=qs[_0xd2b2('0x3d')](_0x534ddb[_0xd2b2('0x35')]['offset']);}_0x1381aa['order']=qs[_0xd2b2('0x3e')](_0x534ddb['query']['sort']);_0x1381aa[_0xd2b2('0x3f')]=qs[_0xd2b2('0x36')](_[_0xd2b2('0x40')](_0x534ddb[_0xd2b2('0x35')],_0x52fa6c[_0xd2b2('0x36')]),_0x555d6c);if(_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x41')]){_0x1381aa[_0xd2b2('0x3f')]=_['merge'](_0x1381aa[_0xd2b2('0x3f')],{'$or':_['map'](_0x555d6c,function(_0x19bbc3){if(_0x19bbc3[_0xd2b2('0x32')]!==_0xd2b2('0x42')){var _0x5811dc={};_0x5811dc[_0x19bbc3[_0xd2b2('0x2c')]]={'$like':'%'+_0x534ddb[_0xd2b2('0x35')][_0xd2b2('0x41')]+'%'};return _0x5811dc;}})});}_0x1381aa=_['merge']({},_0x1381aa,_0x534ddb['options']);var _0x469480={'where':_0x1381aa['where']};return db[_0xd2b2('0x30')]['count'](_0x469480)[_0xd2b2('0x24')](function(_0x10d3ea){_0x116a89['count']=_0x10d3ea;if(_0x534ddb['query'][_0xd2b2('0x43')]){_0x1381aa[_0xd2b2('0x44')]=[{'all':!![]}];}return db[_0xd2b2('0x30')][_0xd2b2('0x45')](_0x1381aa);})['then'](function(_0x161dbf){_0x116a89[_0xd2b2('0x46')]=_0x161dbf;return _0x116a89;})[_0xd2b2('0x24')](respondWithFilteredResult(_0x52bacb,_0x1381aa))['catch'](handleError(_0x52bacb,null));};exports[_0xd2b2('0x47')]=function(_0x390caf,_0x419ca0){var _0x3093f6={'raw':!![],'where':{'id':_0x390caf[_0xd2b2('0x48')]['id']}},_0x351eb8={};_0x351eb8[_0xd2b2('0x34')]=_[_0xd2b2('0x49')](db['AnalyticMetric']['rawAttributes']);_0x351eb8['query']=_['keys'](_0x390caf['query']);_0x351eb8['filters']=_[_0xd2b2('0x37')](_0x351eb8[_0xd2b2('0x34')],_0x351eb8[_0xd2b2('0x35')]);_0x3093f6[_0xd2b2('0x39')]=_[_0xd2b2('0x37')](_0x351eb8[_0xd2b2('0x34')],qs[_0xd2b2('0x38')](_0x390caf[_0xd2b2('0x35')][_0xd2b2('0x38')]));_0x3093f6[_0xd2b2('0x39')]=_0x3093f6[_0xd2b2('0x39')][_0xd2b2('0x3a')]?_0x3093f6[_0xd2b2('0x39')]:_0x351eb8[_0xd2b2('0x34')];if(_0x390caf['query']['includeAll']){_0x3093f6['include']=[{'all':!![]}];}_0x3093f6=_[_0xd2b2('0x4a')]({},_0x3093f6,_0x390caf[_0xd2b2('0x4b')]);return db[_0xd2b2('0x30')][_0xd2b2('0x4c')](_0x3093f6)[_0xd2b2('0x24')](handleEntityNotFound(_0x419ca0,null))[_0xd2b2('0x24')](respondWithResult(_0x419ca0,null))[_0xd2b2('0x4d')](handleError(_0x419ca0,null));};exports[_0xd2b2('0x4e')]=function(_0x43888f,_0x68449e){return db['AnalyticMetric'][_0xd2b2('0x4e')](_0x43888f[_0xd2b2('0x4f')],{})[_0xd2b2('0x24')](function(_0x2beae5){var _0x30f630=_0x43888f['user'][_0xd2b2('0x26')]({'plain':!![]});if(!_0x30f630)throw new Error(_0xd2b2('0x50'));if(_0x30f630['role']===_0xd2b2('0x51')){var _0x15a2b6=_0x2beae5[_0xd2b2('0x26')]({'plain':!![]});var _0x4e3690='Metrics';return db[_0xd2b2('0x52')][_0xd2b2('0x4c')]({'where':{'name':_0x4e3690,'userProfileId':_0x30f630[_0xd2b2('0x53')]},'raw':!![]})[_0xd2b2('0x24')](function(_0x1da44c){if(_0x1da44c&&_0x1da44c[_0xd2b2('0x54')]===0x0){return db[_0xd2b2('0x28')]['create']({'name':_0x15a2b6[_0xd2b2('0x2c')],'resourceId':_0x15a2b6['id'],'type':_0x1da44c['name'],'sectionId':_0x1da44c['id']},{})[_0xd2b2('0x24')](function(){return _0x2beae5;});}else{return _0x2beae5;}})['catch'](function(_0x15ee8c){logger[_0xd2b2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15ee8c);throw _0x15ee8c;});}return _0x2beae5;})[_0xd2b2('0x24')](respondWithResult(_0x68449e,0xc9))[_0xd2b2('0x4d')](handleError(_0x68449e,null));};exports[_0xd2b2('0x23')]=function(_0x490faf,_0x4d9ea0){if(_0x490faf['body']['id']){delete _0x490faf[_0xd2b2('0x4f')]['id'];}return db[_0xd2b2('0x30')][_0xd2b2('0x4c')]({'where':{'id':_0x490faf[_0xd2b2('0x48')]['id']}})[_0xd2b2('0x24')](handleEntityNotFound(_0x4d9ea0,null))[_0xd2b2('0x24')](saveUpdates(_0x490faf['body'],null))[_0xd2b2('0x24')](respondWithResult(_0x4d9ea0,null))[_0xd2b2('0x4d')](handleError(_0x4d9ea0,null));};exports['destroy']=function(_0x3b9830,_0x267b34){return db[_0xd2b2('0x30')]['find']({'where':{'id':_0x3b9830[_0xd2b2('0x48')]['id']}})[_0xd2b2('0x24')](handleEntityNotFound(_0x267b34,null))[_0xd2b2('0x24')](removeEntity(_0x267b34,null))[_0xd2b2('0x4d')](handleError(_0x267b34,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4bee585..fda9306 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 _0x12e5=['rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x12e5,0x102));var _0x512e=function(_0x3eaa7b,_0xe3ef2e){_0x3eaa7b=_0x3eaa7b-0x0;var _0x381a70=_0x12e5[_0x3eaa7b];return _0x381a70;};'use strict';var _=require(_0x512e('0x0'));var util=require(_0x512e('0x1'));var logger=require(_0x512e('0x2'))(_0x512e('0x3'));var moment=require(_0x512e('0x4'));var BPromise=require(_0x512e('0x5'));var rp=require(_0x512e('0x6'));var fs=require('fs');var path=require(_0x512e('0x7'));var rimraf=require(_0x512e('0x8'));var config=require('../../config/environment');var attributes=require(_0x512e('0x9'));module[_0x512e('0xa')]=function(_0x53f532,_0x1c234d){return _0x53f532[_0x512e('0xb')](_0x512e('0xc'),attributes,{'tableName':_0x512e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb44a,0xa6));var _0xab44=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xb44a[_0x4394b6];return _0x360244;};'use strict';var _=require(_0xab44('0x0'));var util=require('util');var logger=require(_0xab44('0x1'))(_0xab44('0x2'));var moment=require('moment');var BPromise=require(_0xab44('0x3'));var rp=require(_0xab44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab44('0x5'));var config=require(_0xab44('0x6'));var attributes=require(_0xab44('0x7'));module[_0xab44('0x8')]=function(_0x2d19e9,_0x4505a8){return _0x2d19e9['define'](_0xab44('0x9'),attributes,{'tableName':_0xab44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 5fbf647..4f91540 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 _0x66a0=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x66a0,0xe8));var _0x066a=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0x66a0[_0x143cfd];return _0x2cb5f5;};'use strict';var _=require(_0x066a('0x0'));var util=require(_0x066a('0x1'));var moment=require(_0x066a('0x2'));var BPromise=require(_0x066a('0x3'));var rs=require(_0x066a('0x4'));var fs=require('fs');var Redis=require(_0x066a('0x5'));var db=require(_0x066a('0x6'))['db'];var utils=require(_0x066a('0x7'));var logger=require('../../config/logger')(_0x066a('0x8'));var config=require(_0x066a('0x9'));var jayson=require(_0x066a('0xa'));var client=jayson['client'][_0x066a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23b5d6,_0x2ef87c,_0x194fcc){return new BPromise(function(_0x135989,_0x5dc9fe){return client[_0x066a('0xc')](_0x23b5d6,_0x194fcc)[_0x066a('0xd')](function(_0x49eeae){logger[_0x066a('0xe')](_0x066a('0xf'),_0x2ef87c,_0x066a('0x10'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2ef87c,_0x066a('0x10'),JSON[_0x066a('0x11')](_0x49eeae));if(_0x49eeae['error']){if(_0x49eeae['error'][_0x066a('0x12')]===0x1f4){logger[_0x066a('0x13')](_0x066a('0xf'),_0x2ef87c,_0x49eeae['error'][_0x066a('0x14')]);return _0x5dc9fe(_0x49eeae[_0x066a('0x13')]['message']);}logger[_0x066a('0x13')](_0x066a('0xf'),_0x2ef87c,_0x49eeae['error']['message']);return _0x135989(_0x49eeae['error']['message']);}else{logger[_0x066a('0xe')](_0x066a('0xf'),_0x2ef87c,_0x066a('0x10'));_0x135989(_0x49eeae[_0x066a('0x15')][_0x066a('0x14')]);}})[_0x066a('0x16')](function(_0x7a0df4){logger[_0x066a('0x13')](_0x066a('0xf'),_0x2ef87c,_0x7a0df4);_0x5dc9fe(_0x7a0df4);});});} \ No newline at end of file +var _0xd449=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55c3be,_0x24029d){var _0x25011d=function(_0x542fee){while(--_0x542fee){_0x55c3be['push'](_0x55c3be['shift']());}};_0x25011d(++_0x24029d);}(_0xd449,0x17b));var _0x9d44=function(_0x405dc0,_0x5f2898){_0x405dc0=_0x405dc0-0x0;var _0x1ed46d=_0xd449[_0x405dc0];return _0x1ed46d;};'use strict';var _=require(_0x9d44('0x0'));var util=require(_0x9d44('0x1'));var moment=require(_0x9d44('0x2'));var BPromise=require(_0x9d44('0x3'));var rs=require(_0x9d44('0x4'));var fs=require('fs');var Redis=require(_0x9d44('0x5'));var db=require(_0x9d44('0x6'))['db'];var utils=require(_0x9d44('0x7'));var logger=require(_0x9d44('0x8'))(_0x9d44('0x9'));var config=require(_0x9d44('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9d44('0xb')][_0x9d44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x728234,_0x17aea3,_0x57166d){return new BPromise(function(_0x3ce183,_0xf2250e){return client[_0x9d44('0xd')](_0x728234,_0x57166d)[_0x9d44('0xe')](function(_0x23b038){logger[_0x9d44('0xf')](_0x9d44('0x10'),_0x17aea3,_0x9d44('0x11'));logger[_0x9d44('0x12')](_0x9d44('0x13'),_0x17aea3,_0x9d44('0x11'),JSON[_0x9d44('0x14')](_0x23b038));if(_0x23b038[_0x9d44('0x15')]){if(_0x23b038[_0x9d44('0x15')][_0x9d44('0x16')]===0x1f4){logger[_0x9d44('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x17aea3,_0x23b038[_0x9d44('0x15')][_0x9d44('0x17')]);return _0xf2250e(_0x23b038[_0x9d44('0x15')][_0x9d44('0x17')]);}logger[_0x9d44('0x15')](_0x9d44('0x10'),_0x17aea3,_0x23b038[_0x9d44('0x15')][_0x9d44('0x17')]);return _0x3ce183(_0x23b038['error'][_0x9d44('0x17')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x17aea3,_0x9d44('0x11'));_0x3ce183(_0x23b038[_0x9d44('0x18')][_0x9d44('0x17')]);}})['catch'](function(_0x13386f){logger[_0x9d44('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x17aea3,_0x13386f);_0xf2250e(_0x13386f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 00e6f4b..7179f38 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 _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x1261,0x144));var _0x1126=function(_0x16b994,_0x22872a){_0x16b994=_0x16b994-0x0;var _0xfc3e0f=_0x1261[_0x16b994];return _0xfc3e0f;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc2c7=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id'];(function(_0xa55f23,_0x148a48){var _0x5172c0=function(_0x1c6cee){while(--_0x1c6cee){_0xa55f23['push'](_0xa55f23['shift']());}};_0x5172c0(++_0x148a48);}(_0xc2c7,0x134));var _0x7c2c=function(_0x39d332,_0x870fcc){_0x39d332=_0x39d332-0x0;var _0x49b7e3=_0xc2c7[_0x39d332];return _0x49b7e3;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var auth=require(_0x7c2c('0x5'));var interaction=require(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x9')]);router[_0x7c2c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7c2c('0xb')]('/',auth[_0x7c2c('0x8')](),controller[_0x7c2c('0xc')]);router[_0x7c2c('0xd')](_0x7c2c('0xe'),auth['isAuthenticated'](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x10')](_0x7c2c('0xe'),auth[_0x7c2c('0x8')](),controller[_0x7c2c('0x11')]);module[_0x7c2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6434a31..53fadcb 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 _0x0f8b=['TEXT','sequelize'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x0f8b,0xcf));var _0xb0f8=function(_0x56081c,_0xe70620){_0x56081c=_0x56081c-0x0;var _0x38c5ba=_0x0f8b[_0x56081c];return _0x38c5ba;};'use strict';var Sequelize=require(_0xb0f8('0x0'));module['exports']={'tree':{'type':Sequelize[_0xb0f8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9620=['TEXT','sequelize','exports'];(function(_0x39674c,_0x3abbe1){var _0x5cf0c0=function(_0x2918d5){while(--_0x2918d5){_0x39674c['push'](_0x39674c['shift']());}};_0x5cf0c0(++_0x3abbe1);}(_0x9620,0x10f));var _0x0962=function(_0x20ae19,_0x367fb4){_0x20ae19=_0x20ae19-0x0;var _0xd245d2=_0x9620[_0x20ae19];return _0xd245d2;};'use strict';var Sequelize=require(_0x0962('0x0'));module[_0x0962('0x1')]={'tree':{'type':Sequelize[_0x0962('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ca14dd1..2d075cb 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 _0xe486=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','then','rows','show','params','keys','find','create','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x52b666,_0x25135a){var _0x619580=function(_0x299cc3){while(--_0x299cc3){_0x52b666['push'](_0x52b666['shift']());}};_0x619580(++_0x25135a);}(_0xe486,0x108));var _0x6e48=function(_0x2ce185,_0xc0446d){_0x2ce185=_0x2ce185-0x0;var _0x207213=_0xe486[_0x2ce185];return _0x207213;};'use strict';var pdf=require(_0x6e48('0x0'));var emlformat=require(_0x6e48('0x1'));var rimraf=require(_0x6e48('0x2'));var zipdir=require(_0x6e48('0x3'));var jsonpatch=require(_0x6e48('0x4'));var rp=require('request-promise');var moment=require(_0x6e48('0x5'));var BPromise=require(_0x6e48('0x6'));var Mustache=require(_0x6e48('0x7'));var util=require('util');var path=require(_0x6e48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e48('0x9'));var squel=require(_0x6e48('0xa'));var crypto=require('crypto');var jsforce=require(_0x6e48('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6e48('0xc'));var querystring=require('querystring');var Papa=require(_0x6e48('0xd'));var Redis=require('ioredis');var authService=require(_0x6e48('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6e48('0xf'));var hardwareService=require(_0x6e48('0x10'));var logger=require(_0x6e48('0x11'))(_0x6e48('0x12'));var utils=require('../../config/utils');var config=require(_0x6e48('0x13'));var licenseUtil=require(_0x6e48('0x14'));var db=require(_0x6e48('0x15'))['db'];function respondWithStatusCode(_0x10d2c8,_0x1ea9cf){_0x1ea9cf=_0x1ea9cf||0xcc;return function(_0x21dfe4){if(_0x21dfe4){return _0x10d2c8[_0x6e48('0x16')](_0x1ea9cf);}return _0x10d2c8['status'](_0x1ea9cf)[_0x6e48('0x17')]();};}function respondWithResult(_0x6d7b43,_0x33fed2){_0x33fed2=_0x33fed2||0xc8;return function(_0x256022){if(_0x256022){return _0x6d7b43[_0x6e48('0x18')](_0x33fed2)[_0x6e48('0x19')](_0x256022);}};}function respondWithFilteredResult(_0x29130a,_0x292a9c){return function(_0x258302){if(_0x258302){var _0x437277=_0x258302[_0x6e48('0x1a')],_0x290efa=_0x292a9c[_0x6e48('0x1b')],_0x2c21c4=_0x292a9c['offset']+_0x292a9c[_0x6e48('0x1c')],_0x5c9ae5;if(_0x2c21c4>=_0x437277){_0x2c21c4=_0x437277;_0x5c9ae5=0xc8;}else{_0x5c9ae5=0xce;}_0x29130a[_0x6e48('0x18')](_0x5c9ae5);return _0x29130a[_0x6e48('0x1d')](_0x6e48('0x1e'),_0x290efa+'-'+_0x2c21c4+'/'+_0x437277)[_0x6e48('0x19')](_0x258302);}return null;};}function patchUpdates(_0x65138){return function(_0x14ac4b){try{jsonpatch['apply'](_0x14ac4b,_0x65138,!![]);}catch(_0x1a3eb0){return BPromise[_0x6e48('0x1f')](_0x1a3eb0);}return _0x14ac4b['save']();};}function saveUpdates(_0x1ea93c,_0x1a741c){return function(_0x25f6b3){if(_0x25f6b3){return _0x25f6b3[_0x6e48('0x20')](_0x1ea93c)['then'](function(_0x2ae9a2){return _0x2ae9a2;});}return null;};}function removeEntity(_0x2646a1,_0x43424f){return function(_0x43abff){if(_0x43abff){return _0x43abff[_0x6e48('0x21')]()['then'](function(){_0x2646a1[_0x6e48('0x18')](0xcc)[_0x6e48('0x17')]();});}};}function handleEntityNotFound(_0x3584f1,_0x245881){return function(_0x1795e1){if(!_0x1795e1){_0x3584f1[_0x6e48('0x16')](0x194);}return _0x1795e1;};}function handleError(_0x597813,_0x3c2fbc){_0x3c2fbc=_0x3c2fbc||0x1f4;return function(_0x2184b9){logger[_0x6e48('0x22')](_0x2184b9[_0x6e48('0x23')]);if(_0x2184b9[_0x6e48('0x24')]){delete _0x2184b9['name'];}_0x597813['status'](_0x3c2fbc)[_0x6e48('0x25')](_0x2184b9);};}exports['index']=function(_0xc7eb6a,_0x363ff6){var _0x1aaca7={},_0x1b40e9={},_0x4d1791={'count':0x0,'rows':[]};var _0x4952b6=_[_0x6e48('0x26')](db['AnalyticTreeReport'][_0x6e48('0x27')],function(_0x4ba0ce){return{'name':_0x4ba0ce[_0x6e48('0x28')],'type':_0x4ba0ce[_0x6e48('0x29')]['key']};});_0x1b40e9[_0x6e48('0x2a')]=_[_0x6e48('0x26')](_0x4952b6,_0x6e48('0x24'));_0x1b40e9[_0x6e48('0x2b')]=_['keys'](_0xc7eb6a['query']);_0x1b40e9['filters']=_[_0x6e48('0x2c')](_0x1b40e9[_0x6e48('0x2a')],_0x1b40e9[_0x6e48('0x2b')]);_0x1aaca7[_0x6e48('0x2d')]=_[_0x6e48('0x2c')](_0x1b40e9[_0x6e48('0x2a')],qs['fields'](_0xc7eb6a['query'][_0x6e48('0x2e')]));_0x1aaca7[_0x6e48('0x2d')]=_0x1aaca7[_0x6e48('0x2d')][_0x6e48('0x2f')]?_0x1aaca7[_0x6e48('0x2d')]:_0x1b40e9['model'];if(!_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x30')](_0x6e48('0x31'))){_0x1aaca7[_0x6e48('0x1c')]=qs['limit'](_0xc7eb6a['query']['limit']);_0x1aaca7[_0x6e48('0x1b')]=qs[_0x6e48('0x1b')](_0xc7eb6a['query']['offset']);}_0x1aaca7[_0x6e48('0x32')]=qs[_0x6e48('0x33')](_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x33')]);_0x1aaca7[_0x6e48('0x34')]=qs[_0x6e48('0x35')](_[_0x6e48('0x36')](_0xc7eb6a[_0x6e48('0x2b')],_0x1b40e9[_0x6e48('0x35')]),_0x4952b6);if(_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x37')]){_0x1aaca7['where']=_[_0x6e48('0x38')](_0x1aaca7[_0x6e48('0x34')],{'$or':_[_0x6e48('0x26')](_0x4952b6,function(_0x4e46d0){if(_0x4e46d0[_0x6e48('0x29')]!==_0x6e48('0x39')){var _0x399f20={};_0x399f20[_0x4e46d0[_0x6e48('0x24')]]={'$like':'%'+_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x37')]+'%'};return _0x399f20;}})});}_0x1aaca7=_[_0x6e48('0x38')]({},_0x1aaca7,_0xc7eb6a[_0x6e48('0x3a')]);var _0x449c46={'where':_0x1aaca7[_0x6e48('0x34')]};return db[_0x6e48('0x3b')][_0x6e48('0x1a')](_0x449c46)['then'](function(_0x326991){_0x4d1791['count']=_0x326991;if(_0xc7eb6a[_0x6e48('0x2b')][_0x6e48('0x3c')]){_0x1aaca7[_0x6e48('0x3d')]=[{'all':!![]}];}return db[_0x6e48('0x3b')]['findAll'](_0x1aaca7);})[_0x6e48('0x3e')](function(_0x5205bc){_0x4d1791[_0x6e48('0x3f')]=_0x5205bc;return _0x4d1791;})[_0x6e48('0x3e')](respondWithFilteredResult(_0x363ff6,_0x1aaca7))['catch'](handleError(_0x363ff6,null));};exports[_0x6e48('0x40')]=function(_0x4d78c1,_0x26a801){var _0x6b706e={'raw':!![],'where':{'id':_0x4d78c1[_0x6e48('0x41')]['id']}},_0x3c161d={};_0x3c161d[_0x6e48('0x2a')]=_[_0x6e48('0x42')](db[_0x6e48('0x3b')]['rawAttributes']);_0x3c161d[_0x6e48('0x2b')]=_['keys'](_0x4d78c1['query']);_0x3c161d[_0x6e48('0x35')]=_[_0x6e48('0x2c')](_0x3c161d[_0x6e48('0x2a')],_0x3c161d[_0x6e48('0x2b')]);_0x6b706e[_0x6e48('0x2d')]=_['intersection'](_0x3c161d[_0x6e48('0x2a')],qs[_0x6e48('0x2e')](_0x4d78c1['query'][_0x6e48('0x2e')]));_0x6b706e[_0x6e48('0x2d')]=_0x6b706e[_0x6e48('0x2d')][_0x6e48('0x2f')]?_0x6b706e['attributes']:_0x3c161d[_0x6e48('0x2a')];if(_0x4d78c1[_0x6e48('0x2b')][_0x6e48('0x3c')]){_0x6b706e[_0x6e48('0x3d')]=[{'all':!![]}];}_0x6b706e=_['merge']({},_0x6b706e,_0x4d78c1[_0x6e48('0x3a')]);return db[_0x6e48('0x3b')][_0x6e48('0x43')](_0x6b706e)[_0x6e48('0x3e')](handleEntityNotFound(_0x26a801,null))[_0x6e48('0x3e')](respondWithResult(_0x26a801,null))['catch'](handleError(_0x26a801,null));};exports[_0x6e48('0x44')]=function(_0x46c1b1,_0x3e0c9b){return db[_0x6e48('0x3b')]['create'](_0x46c1b1['body'],{})[_0x6e48('0x3e')](respondWithResult(_0x3e0c9b,0xc9))[_0x6e48('0x45')](handleError(_0x3e0c9b,null));};exports[_0x6e48('0x20')]=function(_0x131173,_0x3b4a2d){if(_0x131173[_0x6e48('0x46')]['id']){delete _0x131173[_0x6e48('0x46')]['id'];}return db[_0x6e48('0x3b')][_0x6e48('0x43')]({'where':{'id':_0x131173[_0x6e48('0x41')]['id']}})[_0x6e48('0x3e')](handleEntityNotFound(_0x3b4a2d,null))[_0x6e48('0x3e')](saveUpdates(_0x131173[_0x6e48('0x46')],null))[_0x6e48('0x3e')](respondWithResult(_0x3b4a2d,null))[_0x6e48('0x45')](handleError(_0x3b4a2d,null));};exports['destroy']=function(_0x3fc5fa,_0x3aca77){return db[_0x6e48('0x3b')][_0x6e48('0x43')]({'where':{'id':_0x3fc5fa[_0x6e48('0x41')]['id']}})['then'](handleEntityNotFound(_0x3aca77,null))[_0x6e48('0x3e')](removeEntity(_0x3aca77,null))[_0x6e48('0x45')](handleError(_0x3aca77,null));}; \ No newline at end of file +var _0x4baf=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','AnalyticTreeReport','fieldName','type','key','model','map','keys','query','filters'];(function(_0xb7e8b0,_0x278fad){var _0xf72202=function(_0x4fea55){while(--_0x4fea55){_0xb7e8b0['push'](_0xb7e8b0['shift']());}};_0xf72202(++_0x278fad);}(_0x4baf,0x177));var _0xf4ba=function(_0x434ba4,_0x4a5665){_0x434ba4=_0x434ba4-0x0;var _0x49844e=_0x4baf[_0x434ba4];return _0x49844e;};'use strict';var pdf=require(_0xf4ba('0x0'));var emlformat=require(_0xf4ba('0x1'));var rimraf=require(_0xf4ba('0x2'));var zipdir=require(_0xf4ba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ba('0x4'));var moment=require(_0xf4ba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4ba('0x6'));var util=require(_0xf4ba('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4ba('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf4ba('0x9'));var jsforce=require(_0xf4ba('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ba('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4ba('0xc'));var qs=require(_0xf4ba('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf4ba('0xe'));var utils=require(_0xf4ba('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xf4ba('0x10'));var db=require(_0xf4ba('0x11'))['db'];function respondWithStatusCode(_0x217d05,_0x431c63){_0x431c63=_0x431c63||0xcc;return function(_0x29f2d8){if(_0x29f2d8){return _0x217d05[_0xf4ba('0x12')](_0x431c63);}return _0x217d05['status'](_0x431c63)[_0xf4ba('0x13')]();};}function respondWithResult(_0x4d3aae,_0x316c1b){_0x316c1b=_0x316c1b||0xc8;return function(_0x34d59a){if(_0x34d59a){return _0x4d3aae[_0xf4ba('0x14')](_0x316c1b)[_0xf4ba('0x15')](_0x34d59a);}};}function respondWithFilteredResult(_0x248c6e,_0x95ebce){return function(_0x3e36af){if(_0x3e36af){var _0xf996c=_0x3e36af[_0xf4ba('0x16')],_0x48c11f=_0x95ebce['offset'],_0x26f666=_0x95ebce[_0xf4ba('0x17')]+_0x95ebce[_0xf4ba('0x18')],_0x8a0ae3;if(_0x26f666>=_0xf996c){_0x26f666=_0xf996c;_0x8a0ae3=0xc8;}else{_0x8a0ae3=0xce;}_0x248c6e[_0xf4ba('0x14')](_0x8a0ae3);return _0x248c6e[_0xf4ba('0x19')](_0xf4ba('0x1a'),_0x48c11f+'-'+_0x26f666+'/'+_0xf996c)[_0xf4ba('0x15')](_0x3e36af);}return null;};}function patchUpdates(_0x48e40e){return function(_0x3fe140){try{jsonpatch[_0xf4ba('0x1b')](_0x3fe140,_0x48e40e,!![]);}catch(_0x47c1dd){return BPromise[_0xf4ba('0x1c')](_0x47c1dd);}return _0x3fe140[_0xf4ba('0x1d')]();};}function saveUpdates(_0x4b7a3e,_0x14fa66){return function(_0x4cec4b){if(_0x4cec4b){return _0x4cec4b['update'](_0x4b7a3e)['then'](function(_0x18b75a){return _0x18b75a;});}return null;};}function removeEntity(_0x5f7a15,_0x55a1d9){return function(_0x4eee8f){if(_0x4eee8f){return _0x4eee8f[_0xf4ba('0x1e')]()['then'](function(){_0x5f7a15[_0xf4ba('0x14')](0xcc)[_0xf4ba('0x13')]();});}};}function handleEntityNotFound(_0x30fb3b,_0x30bf2e){return function(_0x5f121c){if(!_0x5f121c){_0x30fb3b['sendStatus'](0x194);}return _0x5f121c;};}function handleError(_0x1e0d9f,_0x558a63){_0x558a63=_0x558a63||0x1f4;return function(_0x340256){logger[_0xf4ba('0x1f')](_0x340256[_0xf4ba('0x20')]);if(_0x340256[_0xf4ba('0x21')]){delete _0x340256['name'];}_0x1e0d9f[_0xf4ba('0x14')](_0x558a63)[_0xf4ba('0x22')](_0x340256);};}exports[_0xf4ba('0x23')]=function(_0x44199f,_0x434177){var _0x3231aa={},_0x34373a={},_0x16d4f3={'count':0x0,'rows':[]};var _0x1e5cab=_['map'](db[_0xf4ba('0x24')]['rawAttributes'],function(_0x1d49d0){return{'name':_0x1d49d0[_0xf4ba('0x25')],'type':_0x1d49d0[_0xf4ba('0x26')][_0xf4ba('0x27')]};});_0x34373a[_0xf4ba('0x28')]=_[_0xf4ba('0x29')](_0x1e5cab,_0xf4ba('0x21'));_0x34373a['query']=_[_0xf4ba('0x2a')](_0x44199f[_0xf4ba('0x2b')]);_0x34373a[_0xf4ba('0x2c')]=_['intersection'](_0x34373a[_0xf4ba('0x28')],_0x34373a[_0xf4ba('0x2b')]);_0x3231aa[_0xf4ba('0x2d')]=_[_0xf4ba('0x2e')](_0x34373a[_0xf4ba('0x28')],qs[_0xf4ba('0x2f')](_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x2f')]));_0x3231aa['attributes']=_0x3231aa[_0xf4ba('0x2d')][_0xf4ba('0x30')]?_0x3231aa[_0xf4ba('0x2d')]:_0x34373a[_0xf4ba('0x28')];if(!_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x31')](_0xf4ba('0x32'))){_0x3231aa['limit']=qs[_0xf4ba('0x18')](_0x44199f['query'][_0xf4ba('0x18')]);_0x3231aa['offset']=qs[_0xf4ba('0x17')](_0x44199f['query'][_0xf4ba('0x17')]);}_0x3231aa[_0xf4ba('0x33')]=qs['sort'](_0x44199f['query']['sort']);_0x3231aa[_0xf4ba('0x34')]=qs[_0xf4ba('0x2c')](_[_0xf4ba('0x35')](_0x44199f[_0xf4ba('0x2b')],_0x34373a[_0xf4ba('0x2c')]),_0x1e5cab);if(_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x36')]){_0x3231aa[_0xf4ba('0x34')]=_[_0xf4ba('0x37')](_0x3231aa[_0xf4ba('0x34')],{'$or':_[_0xf4ba('0x29')](_0x1e5cab,function(_0x5ed830){if(_0x5ed830[_0xf4ba('0x26')]!=='VIRTUAL'){var _0x477feb={};_0x477feb[_0x5ed830[_0xf4ba('0x21')]]={'$like':'%'+_0x44199f[_0xf4ba('0x2b')]['filter']+'%'};return _0x477feb;}})});}_0x3231aa=_[_0xf4ba('0x37')]({},_0x3231aa,_0x44199f[_0xf4ba('0x38')]);var _0x5b0019={'where':_0x3231aa['where']};return db[_0xf4ba('0x24')][_0xf4ba('0x16')](_0x5b0019)[_0xf4ba('0x39')](function(_0x146843){_0x16d4f3[_0xf4ba('0x16')]=_0x146843;if(_0x44199f[_0xf4ba('0x2b')][_0xf4ba('0x3a')]){_0x3231aa[_0xf4ba('0x3b')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xf4ba('0x3c')](_0x3231aa);})[_0xf4ba('0x39')](function(_0x236c2c){_0x16d4f3[_0xf4ba('0x3d')]=_0x236c2c;return _0x16d4f3;})[_0xf4ba('0x39')](respondWithFilteredResult(_0x434177,_0x3231aa))[_0xf4ba('0x3e')](handleError(_0x434177,null));};exports[_0xf4ba('0x3f')]=function(_0x4d4909,_0x4f5fbe){var _0x54a564={'raw':!![],'where':{'id':_0x4d4909[_0xf4ba('0x40')]['id']}},_0x4c25f2={};_0x4c25f2[_0xf4ba('0x28')]=_[_0xf4ba('0x2a')](db[_0xf4ba('0x24')][_0xf4ba('0x41')]);_0x4c25f2[_0xf4ba('0x2b')]=_['keys'](_0x4d4909['query']);_0x4c25f2[_0xf4ba('0x2c')]=_[_0xf4ba('0x2e')](_0x4c25f2[_0xf4ba('0x28')],_0x4c25f2[_0xf4ba('0x2b')]);_0x54a564['attributes']=_['intersection'](_0x4c25f2[_0xf4ba('0x28')],qs[_0xf4ba('0x2f')](_0x4d4909[_0xf4ba('0x2b')][_0xf4ba('0x2f')]));_0x54a564[_0xf4ba('0x2d')]=_0x54a564[_0xf4ba('0x2d')][_0xf4ba('0x30')]?_0x54a564[_0xf4ba('0x2d')]:_0x4c25f2[_0xf4ba('0x28')];if(_0x4d4909[_0xf4ba('0x2b')][_0xf4ba('0x3a')]){_0x54a564[_0xf4ba('0x3b')]=[{'all':!![]}];}_0x54a564=_[_0xf4ba('0x37')]({},_0x54a564,_0x4d4909[_0xf4ba('0x38')]);return db[_0xf4ba('0x24')][_0xf4ba('0x42')](_0x54a564)['then'](handleEntityNotFound(_0x4f5fbe,null))['then'](respondWithResult(_0x4f5fbe,null))[_0xf4ba('0x3e')](handleError(_0x4f5fbe,null));};exports[_0xf4ba('0x43')]=function(_0x130c8e,_0xedb9af){return db[_0xf4ba('0x24')]['create'](_0x130c8e['body'],{})[_0xf4ba('0x39')](respondWithResult(_0xedb9af,0xc9))[_0xf4ba('0x3e')](handleError(_0xedb9af,null));};exports[_0xf4ba('0x44')]=function(_0xb17291,_0x532108){if(_0xb17291[_0xf4ba('0x45')]['id']){delete _0xb17291[_0xf4ba('0x45')]['id'];}return db[_0xf4ba('0x24')][_0xf4ba('0x42')]({'where':{'id':_0xb17291[_0xf4ba('0x40')]['id']}})[_0xf4ba('0x39')](handleEntityNotFound(_0x532108,null))[_0xf4ba('0x39')](saveUpdates(_0xb17291[_0xf4ba('0x45')],null))[_0xf4ba('0x39')](respondWithResult(_0x532108,null))['catch'](handleError(_0x532108,null));};exports[_0xf4ba('0x1e')]=function(_0x841312,_0x10f996){return db[_0xf4ba('0x24')][_0xf4ba('0x42')]({'where':{'id':_0x841312[_0xf4ba('0x40')]['id']}})['then'](handleEntityNotFound(_0x10f996,null))[_0xf4ba('0x39')](removeEntity(_0x10f996,null))[_0xf4ba('0x3e')](handleError(_0x10f996,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d639a54..7806ff8 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 _0x10ad=['exports','define','AnalyticTreeReport','analytics_report_trees','api','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x10ad,0xf4));var _0xd10a=function(_0x513012,_0x27a25d){_0x513012=_0x513012-0x0;var _0x54a0ae=_0x10ad[_0x513012];return _0x54a0ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd10a('0x0'));var moment=require('moment');var BPromise=require(_0xd10a('0x1'));var rp=require(_0xd10a('0x2'));var fs=require('fs');var path=require(_0xd10a('0x3'));var rimraf=require(_0xd10a('0x4'));var config=require('../../config/environment');var attributes=require(_0xd10a('0x5'));module[_0xd10a('0x6')]=function(_0x3658f5,_0x425715){return _0x3658f5[_0xd10a('0x7')](_0xd10a('0x8'),attributes,{'tableName':_0xd10a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7de=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports'];(function(_0x401dba,_0x4ddd33){var _0x42f909=function(_0x3b0247){while(--_0x3b0247){_0x401dba['push'](_0x401dba['shift']());}};_0x42f909(++_0x4ddd33);}(_0xb7de,0xc7));var _0xeb7d=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xb7de[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var logger=require(_0xeb7d('0x2'))('api');var moment=require(_0xeb7d('0x3'));var BPromise=require(_0xeb7d('0x4'));var rp=require(_0xeb7d('0x5'));var fs=require('fs');var path=require(_0xeb7d('0x6'));var rimraf=require(_0xeb7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7d('0x8'));module[_0xeb7d('0x9')]=function(_0xadf4,_0x433c32){return _0xadf4[_0xeb7d('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index c1fa71d..52e4382 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 _0xb4b0=['http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb4b0,0x187));var _0x0b4b=function(_0x552b24,_0xa566c3){_0x552b24=_0x552b24-0x0;var _0x45bd92=_0xb4b0[_0x552b24];return _0x45bd92;};'use strict';var _=require(_0x0b4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0b4b('0x1'));var rs=require(_0x0b4b('0x2'));var fs=require('fs');var Redis=require(_0x0b4b('0x3'));var db=require(_0x0b4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b4b('0x5'))(_0x0b4b('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b4b('0x7'));var client=jayson[_0x0b4b('0x8')][_0x0b4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c3d7a,_0x2d2280,_0x3ea74b){return new BPromise(function(_0x3dd5b6,_0xef2ea2){return client[_0x0b4b('0xa')](_0x5c3d7a,_0x3ea74b)[_0x0b4b('0xb')](function(_0x2f669f){logger[_0x0b4b('0xc')](_0x0b4b('0xd'),_0x2d2280,'request\x20sent');logger['debug'](_0x0b4b('0xe'),_0x2d2280,'request\x20sent',JSON['stringify'](_0x2f669f));if(_0x2f669f[_0x0b4b('0xf')]){if(_0x2f669f[_0x0b4b('0xf')]['code']===0x1f4){logger['error'](_0x0b4b('0xd'),_0x2d2280,_0x2f669f[_0x0b4b('0xf')][_0x0b4b('0x10')]);return _0xef2ea2(_0x2f669f['error'][_0x0b4b('0x10')]);}logger[_0x0b4b('0xf')](_0x0b4b('0xd'),_0x2d2280,_0x2f669f[_0x0b4b('0xf')][_0x0b4b('0x10')]);return _0x3dd5b6(_0x2f669f[_0x0b4b('0xf')][_0x0b4b('0x10')]);}else{logger[_0x0b4b('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x2d2280,_0x0b4b('0x11'));_0x3dd5b6(_0x2f669f[_0x0b4b('0x12')][_0x0b4b('0x10')]);}})[_0x0b4b('0x13')](function(_0x3d0578){logger['error'](_0x0b4b('0xd'),_0x2d2280,_0x3d0578);_0xef2ea2(_0x3d0578);});});} \ No newline at end of file +var _0xf580=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1def1f,_0x230a88){var _0x3fb6ad=function(_0x52a66f){while(--_0x52a66f){_0x1def1f['push'](_0x1def1f['shift']());}};_0x3fb6ad(++_0x230a88);}(_0xf580,0x71));var _0x0f58=function(_0xdb7468,_0x4efe3b){_0xdb7468=_0xdb7468-0x0;var _0x438ed0=_0xf580[_0xdb7468];return _0x438ed0;};'use strict';var _=require(_0x0f58('0x0'));var util=require(_0x0f58('0x1'));var moment=require(_0x0f58('0x2'));var BPromise=require(_0x0f58('0x3'));var rs=require(_0x0f58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f58('0x5'))['db'];var utils=require(_0x0f58('0x6'));var logger=require(_0x0f58('0x7'))(_0x0f58('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f58('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2da258,_0x24bed4,_0x1da550){return new BPromise(function(_0x26a2be,_0x333780){return client[_0x0f58('0xa')](_0x2da258,_0x1da550)['then'](function(_0x5881fd){logger['info'](_0x0f58('0xb'),_0x24bed4,_0x0f58('0xc'));logger[_0x0f58('0xd')](_0x0f58('0xe'),_0x24bed4,'request\x20sent',JSON[_0x0f58('0xf')](_0x5881fd));if(_0x5881fd[_0x0f58('0x10')]){if(_0x5881fd[_0x0f58('0x10')][_0x0f58('0x11')]===0x1f4){logger[_0x0f58('0x10')](_0x0f58('0xb'),_0x24bed4,_0x5881fd[_0x0f58('0x10')][_0x0f58('0x12')]);return _0x333780(_0x5881fd[_0x0f58('0x10')]['message']);}logger['error'](_0x0f58('0xb'),_0x24bed4,_0x5881fd[_0x0f58('0x10')][_0x0f58('0x12')]);return _0x26a2be(_0x5881fd[_0x0f58('0x10')][_0x0f58('0x12')]);}else{logger[_0x0f58('0x13')](_0x0f58('0xb'),_0x24bed4,_0x0f58('0xc'));_0x26a2be(_0x5881fd[_0x0f58('0x14')]['message']);}})[_0x0f58('0x15')](function(_0x2b05ca){logger[_0x0f58('0x10')](_0x0f58('0xb'),_0x24bed4,_0x2b05ca);_0x333780(_0x2b05ca);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b76c641..0b430f2 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 _0x1727=['post','create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2c1bde,_0x3be150){var _0x571de0=function(_0x3a1c56){while(--_0x3a1c56){_0x2c1bde['push'](_0x2c1bde['shift']());}};_0x571de0(++_0x3be150);}(_0x1727,0x1db));var _0x7172=function(_0x2453a7,_0x324b18){_0x2453a7=_0x2453a7-0x0;var _0x48056a=_0x1727[_0x2453a7];return _0x48056a;};'use strict';var multer=require(_0x7172('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7172('0x1'));var express=require(_0x7172('0x2'));var router=express[_0x7172('0x3')]();var auth=require(_0x7172('0x4'));var interaction=require(_0x7172('0x5'));var config=require(_0x7172('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x7172('0x7')]('/',auth[_0x7172('0x8')](),controller[_0x7172('0x9')]);router[_0x7172('0x7')]('/:id',auth[_0x7172('0x8')](),controller[_0x7172('0xa')]);router[_0x7172('0xb')]('/',auth['isAuthenticated'](),controller[_0x7172('0xc')]);router['put'](_0x7172('0xd'),auth[_0x7172('0x8')](),controller[_0x7172('0xe')]);router[_0x7172('0xf')](_0x7172('0xd'),auth[_0x7172('0x8')](),controller[_0x7172('0x10')]);module[_0x7172('0x11')]=router; \ No newline at end of file +var _0xf8a3=['isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','/:id','post'];(function(_0x46f047,_0x23a936){var _0x352bef=function(_0x99c3cb){while(--_0x99c3cb){_0x46f047['push'](_0x46f047['shift']());}};_0x352bef(++_0x23a936);}(_0xf8a3,0xa6));var _0x3f8a=function(_0x4d1d50,_0x4feedb){_0x4d1d50=_0x4d1d50-0x0;var _0x2ae3aa=_0xf8a3[_0x4d1d50];return _0x2ae3aa;};'use strict';var multer=require(_0x3f8a('0x0'));var util=require(_0x3f8a('0x1'));var path=require(_0x3f8a('0x2'));var timeout=require(_0x3f8a('0x3'));var express=require('express');var router=express[_0x3f8a('0x4')]();var auth=require(_0x3f8a('0x5'));var interaction=require(_0x3f8a('0x6'));var config=require('../../config/environment');var controller=require(_0x3f8a('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3f8a('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3f8a('0x9')]('/',auth[_0x3f8a('0xa')](),controller['create']);router[_0x3f8a('0xb')]('/:id',auth[_0x3f8a('0xa')](),controller[_0x3f8a('0xc')]);router[_0x3f8a('0xd')]('/:id',auth[_0x3f8a('0xa')](),controller[_0x3f8a('0xe')]);module[_0x3f8a('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2dd1486..9a4b148 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 _0xccb5=['STRING','sequelize'];(function(_0x27fb7e,_0x52a07b){var _0x3d9970=function(_0x1bd936){while(--_0x1bd936){_0x27fb7e['push'](_0x27fb7e['shift']());}};_0x3d9970(++_0x52a07b);}(_0xccb5,0xa9));var _0x5ccb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xccb5[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5ccb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x5ccb('0x1')]},'type':{'type':Sequelize[_0x5ccb('0x1')]}}; \ No newline at end of file +var _0xf4bd=['sequelize','exports','STRING'];(function(_0x5ac65f,_0x285b8){var _0x31164e=function(_0x684dbe){while(--_0x684dbe){_0x5ac65f['push'](_0x5ac65f['shift']());}};_0x31164e(++_0x285b8);}(_0xf4bd,0xe4));var _0xdf4b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf4bd[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xdf4b('0x0'));module[_0xdf4b('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xdf4b('0x2')]},'type':{'type':Sequelize[_0xdf4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1e574e2..24b7904 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 _0x98e0=['keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','clone','get','omit','createdAt','body','create','file','originalname','basename','filename','download','findOne','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','Attachment','rawAttributes','fieldName','type','key','map','query'];(function(_0x5a8fab,_0x59f5dd){var _0xa041b0=function(_0x350b06){while(--_0x350b06){_0x5a8fab['push'](_0x5a8fab['shift']());}};_0xa041b0(++_0x59f5dd);}(_0x98e0,0xc6));var _0x098e=function(_0x47ac9a,_0xb6a104){_0x47ac9a=_0x47ac9a-0x0;var _0x5f2aa0=_0x98e0[_0x47ac9a];return _0x5f2aa0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x098e('0x0'));var rimraf=require(_0x098e('0x1'));var zipdir=require(_0x098e('0x2'));var jsonpatch=require(_0x098e('0x3'));var rp=require(_0x098e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x098e('0x5'));var path=require(_0x098e('0x6'));var sox=require(_0x098e('0x7'));var csv=require(_0x098e('0x8'));var ejs=require(_0x098e('0x9'));var fs=require('fs');var _=require(_0x098e('0xa'));var squel=require(_0x098e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x098e('0xc'));var toCsv=require(_0x098e('0x8'));var querystring=require(_0x098e('0xd'));var Papa=require(_0x098e('0xe'));var Redis=require(_0x098e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x098e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x098e('0x11'));var logger=require(_0x098e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x098e('0x13'));var licenseUtil=require(_0x098e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dfdb4,_0x2c7159){_0x2c7159=_0x2c7159||0xcc;return function(_0x4a58af){if(_0x4a58af){return _0x4dfdb4[_0x098e('0x15')](_0x2c7159);}return _0x4dfdb4['status'](_0x2c7159)['end']();};}function respondWithResult(_0x37da3d,_0x51d299){_0x51d299=_0x51d299||0xc8;return function(_0x5a506a){if(_0x5a506a){return _0x37da3d[_0x098e('0x16')](_0x51d299)[_0x098e('0x17')](_0x5a506a);}};}function respondWithFilteredResult(_0x49a44f,_0x4ae134){return function(_0xe717ba){if(_0xe717ba){var _0x28656a=_0xe717ba[_0x098e('0x18')],_0x348267=_0x4ae134['offset'],_0x51ea48=_0x4ae134[_0x098e('0x19')]+_0x4ae134[_0x098e('0x1a')],_0x2427c8;if(_0x51ea48>=_0x28656a){_0x51ea48=_0x28656a;_0x2427c8=0xc8;}else{_0x2427c8=0xce;}_0x49a44f[_0x098e('0x16')](_0x2427c8);return _0x49a44f['set'](_0x098e('0x1b'),_0x348267+'-'+_0x51ea48+'/'+_0x28656a)[_0x098e('0x17')](_0xe717ba);}return null;};}function patchUpdates(_0x3e860f){return function(_0xc5c550){try{jsonpatch[_0x098e('0x1c')](_0xc5c550,_0x3e860f,!![]);}catch(_0x464c65){return BPromise[_0x098e('0x1d')](_0x464c65);}return _0xc5c550['save']();};}function saveUpdates(_0x36b8c4,_0x3e68ad){return function(_0x5e3c44){if(_0x5e3c44){return _0x5e3c44[_0x098e('0x1e')](_0x36b8c4)[_0x098e('0x1f')](function(_0x473646){return _0x473646;});}return null;};}function removeEntity(_0x450638,_0x267bc4){return function(_0x3961b2){if(_0x3961b2){return _0x3961b2[_0x098e('0x20')]()[_0x098e('0x1f')](function(){_0x450638[_0x098e('0x16')](0xcc)[_0x098e('0x21')]();});}};}function handleEntityNotFound(_0x4d8f01,_0x4624c6){return function(_0x521adc){if(!_0x521adc){_0x4d8f01[_0x098e('0x15')](0x194);}return _0x521adc;};}function handleError(_0x1283e0,_0x31c235){_0x31c235=_0x31c235||0x1f4;return function(_0x38e93e){logger[_0x098e('0x22')](_0x38e93e[_0x098e('0x23')]);if(_0x38e93e[_0x098e('0x24')]){delete _0x38e93e[_0x098e('0x24')];}_0x1283e0[_0x098e('0x16')](_0x31c235)[_0x098e('0x25')](_0x38e93e);};}exports['index']=function(_0x5cab6b,_0x1c8a83){var _0x138232={},_0x43ad4e={},_0x262207={'count':0x0,'rows':[]};var _0x6604f3=_['map'](db[_0x098e('0x26')][_0x098e('0x27')],function(_0x4e6e3a){return{'name':_0x4e6e3a[_0x098e('0x28')],'type':_0x4e6e3a[_0x098e('0x29')][_0x098e('0x2a')]};});_0x43ad4e['model']=_[_0x098e('0x2b')](_0x6604f3,_0x098e('0x24'));_0x43ad4e[_0x098e('0x2c')]=_[_0x098e('0x2d')](_0x5cab6b[_0x098e('0x2c')]);_0x43ad4e[_0x098e('0x2e')]=_[_0x098e('0x2f')](_0x43ad4e[_0x098e('0x30')],_0x43ad4e[_0x098e('0x2c')]);_0x138232['attributes']=_[_0x098e('0x2f')](_0x43ad4e[_0x098e('0x30')],qs[_0x098e('0x31')](_0x5cab6b[_0x098e('0x2c')][_0x098e('0x31')]));_0x138232[_0x098e('0x32')]=_0x138232[_0x098e('0x32')][_0x098e('0x33')]?_0x138232[_0x098e('0x32')]:_0x43ad4e[_0x098e('0x30')];if(!_0x5cab6b[_0x098e('0x2c')]['hasOwnProperty']('nolimit')){_0x138232[_0x098e('0x1a')]=qs[_0x098e('0x1a')](_0x5cab6b[_0x098e('0x2c')][_0x098e('0x1a')]);_0x138232[_0x098e('0x19')]=qs[_0x098e('0x19')](_0x5cab6b['query'][_0x098e('0x19')]);}_0x138232[_0x098e('0x34')]=qs[_0x098e('0x35')](_0x5cab6b[_0x098e('0x2c')][_0x098e('0x35')]);_0x138232[_0x098e('0x36')]=qs[_0x098e('0x2e')](_[_0x098e('0x37')](_0x5cab6b['query'],_0x43ad4e[_0x098e('0x2e')]),_0x6604f3);if(_0x5cab6b[_0x098e('0x2c')][_0x098e('0x38')]){_0x138232['where']=_[_0x098e('0x39')](_0x138232[_0x098e('0x36')],{'$or':_['map'](_0x6604f3,function(_0x3470bb){if(_0x3470bb[_0x098e('0x29')]!=='VIRTUAL'){var _0x22702d={};_0x22702d[_0x3470bb[_0x098e('0x24')]]={'$like':'%'+_0x5cab6b[_0x098e('0x2c')][_0x098e('0x38')]+'%'};return _0x22702d;}})});}_0x138232=_[_0x098e('0x39')]({},_0x138232,_0x5cab6b[_0x098e('0x3a')]);var _0x2615d6={'where':_0x138232[_0x098e('0x36')]};return db['Attachment'][_0x098e('0x18')](_0x2615d6)[_0x098e('0x1f')](function(_0x41a569){_0x262207[_0x098e('0x18')]=_0x41a569;if(_0x5cab6b[_0x098e('0x2c')][_0x098e('0x3b')]){_0x138232['include']=[{'all':!![]}];}return db[_0x098e('0x26')][_0x098e('0x3c')](_0x138232);})[_0x098e('0x1f')](function(_0x413fca){_0x262207[_0x098e('0x3d')]=_0x413fca;return _0x262207;})[_0x098e('0x1f')](respondWithFilteredResult(_0x1c8a83,_0x138232))[_0x098e('0x3e')](handleError(_0x1c8a83,null));};exports[_0x098e('0x3f')]=function(_0x53563e,_0x1742a0){var _0x45ef20={'raw':!![],'where':{'id':_0x53563e[_0x098e('0x40')]['id']}},_0x5bea38={};_0x5bea38[_0x098e('0x30')]=_[_0x098e('0x2d')](db['Attachment'][_0x098e('0x27')]);_0x5bea38[_0x098e('0x2c')]=_['keys'](_0x53563e['query']);_0x5bea38[_0x098e('0x2e')]=_['intersection'](_0x5bea38['model'],_0x5bea38[_0x098e('0x2c')]);_0x45ef20['attributes']=_[_0x098e('0x2f')](_0x5bea38[_0x098e('0x30')],qs[_0x098e('0x31')](_0x53563e[_0x098e('0x2c')][_0x098e('0x31')]));_0x45ef20[_0x098e('0x32')]=_0x45ef20[_0x098e('0x32')][_0x098e('0x33')]?_0x45ef20[_0x098e('0x32')]:_0x5bea38[_0x098e('0x30')];if(_0x53563e[_0x098e('0x2c')][_0x098e('0x3b')]){_0x45ef20[_0x098e('0x41')]=[{'all':!![]}];}_0x45ef20=_[_0x098e('0x39')]({},_0x45ef20,_0x53563e[_0x098e('0x3a')]);return db[_0x098e('0x26')][_0x098e('0x42')](_0x45ef20)['then'](handleEntityNotFound(_0x1742a0,null))[_0x098e('0x1f')](respondWithResult(_0x1742a0,null))[_0x098e('0x3e')](handleError(_0x1742a0,null));};exports[_0x098e('0x43')]=function(_0x27827a,_0x325b6f){var _0x50ed03={'where':{'id':_0x27827a['params']['id']}},_0x23083f={};_0x23083f[_0x098e('0x30')]=_['keys'](db['Attachment']['rawAttributes']);_0x50ed03[_0x098e('0x32')]=_[_0x098e('0x2f')](_0x23083f['model'],qs[_0x098e('0x31')](_0x27827a[_0x098e('0x2c')][_0x098e('0x31')]));_0x50ed03[_0x098e('0x32')]=_0x50ed03[_0x098e('0x32')][_0x098e('0x33')]?_0x50ed03[_0x098e('0x32')]:_0x23083f[_0x098e('0x30')];if(_0x27827a[_0x098e('0x2c')][_0x098e('0x3b')]){_0x50ed03['include']=[{'all':!![]}];}_0x50ed03=_[_0x098e('0x39')]({},_0x50ed03,_0x27827a[_0x098e('0x3a')]);return db['Attachment'][_0x098e('0x42')](_0x50ed03)[_0x098e('0x1f')](handleEntityNotFound(_0x325b6f,null))[_0x098e('0x1f')](function(_0x362c3c){if(_0x362c3c){var _0x5a5d32=_0x362c3c[_0x098e('0x44')]({'plain':!![]});_0x5a5d32=qs[_0x098e('0x45')](_0x5a5d32,['id',_0x098e('0x46'),'updatedAt']);_0x27827a[_0x098e('0x47')]=_[_0x098e('0x45')](_0x27827a['body'],['id','createdAt','updatedAt']);return db[_0x098e('0x26')][_0x098e('0x48')](_[_0x098e('0x39')](_0x5a5d32,_0x27827a[_0x098e('0x47')]),{'include':_0x27827a['query'][_0x098e('0x3b')]?[{'all':!![]}]:undefined});}})[_0x098e('0x1f')](respondWithResult(_0x325b6f,0xc9))[_0x098e('0x3e')](handleError(_0x325b6f,null));};exports[_0x098e('0x1e')]=function(_0x35c476,_0x286db0){if(_0x35c476[_0x098e('0x47')]['id']){delete _0x35c476[_0x098e('0x47')]['id'];}return db[_0x098e('0x26')]['find']({'where':{'id':_0x35c476[_0x098e('0x40')]['id']}})[_0x098e('0x1f')](handleEntityNotFound(_0x286db0,null))[_0x098e('0x1f')](saveUpdates(_0x35c476[_0x098e('0x47')],null))[_0x098e('0x1f')](respondWithResult(_0x286db0,null))[_0x098e('0x3e')](handleError(_0x286db0,null));};exports[_0x098e('0x20')]=function(_0x45d528,_0x4eeb8e){return db['Attachment'][_0x098e('0x42')]({'where':{'id':_0x45d528[_0x098e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4eeb8e,null))[_0x098e('0x1f')](removeEntity(_0x4eeb8e,null))['catch'](handleError(_0x4eeb8e,null));};exports['create']=function(_0x11b7f8,_0xc42211,_0x28aa9c){_0x11b7f8['body'][_0x098e('0x24')]=_0x11b7f8[_0x098e('0x49')][_0x098e('0x4a')];_0x11b7f8[_0x098e('0x47')][_0x098e('0x4b')]=_0x11b7f8[_0x098e('0x49')][_0x098e('0x4c')];_0x11b7f8[_0x098e('0x47')][_0x098e('0x29')]=_0x11b7f8['file']['mimetype'];return db[_0x098e('0x26')][_0x098e('0x48')](_0x11b7f8[_0x098e('0x47')])[_0x098e('0x1f')](respondWithResult(_0xc42211,0xc9))['catch'](handleError(_0xc42211,null));};exports[_0x098e('0x4d')]=function(_0x367135,_0x3af295,_0x38ddd0){return db[_0x098e('0x26')][_0x098e('0x4e')]({'where':{'id':_0x367135['params']['id']},'raw':!![]})[_0x098e('0x1f')](handleEntityNotFound(_0x3af295,null))[_0x098e('0x1f')](function(_0x2b551f){if(_0x2b551f){return _0x3af295[_0x098e('0x4d')](path[_0x098e('0x4f')](config['root'],_0x098e('0x50'),_0x2b551f[_0x098e('0x4b')]));}})[_0x098e('0x3e')](handleError(_0x3af295,null));}; \ No newline at end of file +var _0x43e4=['show','params','options','find','omit','createdAt','updatedAt','body','create','originalname','basename','filename','file','mimetype','download','findOne','root','server/files/attachments/','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x43e4,0x10e));var _0x443e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x43e4[_0x122096];return _0x3d1966;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x443e('0x0'));var rimraf=require(_0x443e('0x1'));var zipdir=require(_0x443e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x443e('0x3'));var BPromise=require(_0x443e('0x4'));var Mustache=require('mustache');var util=require(_0x443e('0x5'));var path=require(_0x443e('0x6'));var sox=require(_0x443e('0x7'));var csv=require(_0x443e('0x8'));var ejs=require(_0x443e('0x9'));var fs=require('fs');var _=require(_0x443e('0xa'));var squel=require(_0x443e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x443e('0xc'));var toCsv=require(_0x443e('0x8'));var querystring=require('querystring');var Papa=require(_0x443e('0xd'));var Redis=require('ioredis');var authService=require(_0x443e('0xe'));var qs=require(_0x443e('0xf'));var as=require(_0x443e('0x10'));var hardwareService=require(_0x443e('0x11'));var logger=require(_0x443e('0x12'))(_0x443e('0x13'));var utils=require(_0x443e('0x14'));var config=require(_0x443e('0x15'));var licenseUtil=require(_0x443e('0x16'));var db=require(_0x443e('0x17'))['db'];function respondWithStatusCode(_0x55f495,_0x6bdca4){_0x6bdca4=_0x6bdca4||0xcc;return function(_0x290286){if(_0x290286){return _0x55f495[_0x443e('0x18')](_0x6bdca4);}return _0x55f495[_0x443e('0x19')](_0x6bdca4)[_0x443e('0x1a')]();};}function respondWithResult(_0x49fce3,_0x2753dd){_0x2753dd=_0x2753dd||0xc8;return function(_0xe30faa){if(_0xe30faa){return _0x49fce3[_0x443e('0x19')](_0x2753dd)[_0x443e('0x1b')](_0xe30faa);}};}function respondWithFilteredResult(_0x1b2ffd,_0x382223){return function(_0xecbe22){if(_0xecbe22){var _0x4d3143=_0xecbe22[_0x443e('0x1c')],_0x478f95=_0x382223[_0x443e('0x1d')],_0x2d6866=_0x382223['offset']+_0x382223[_0x443e('0x1e')],_0x3a91c4;if(_0x2d6866>=_0x4d3143){_0x2d6866=_0x4d3143;_0x3a91c4=0xc8;}else{_0x3a91c4=0xce;}_0x1b2ffd[_0x443e('0x19')](_0x3a91c4);return _0x1b2ffd[_0x443e('0x1f')](_0x443e('0x20'),_0x478f95+'-'+_0x2d6866+'/'+_0x4d3143)[_0x443e('0x1b')](_0xecbe22);}return null;};}function patchUpdates(_0x5f471d){return function(_0x16ee17){try{jsonpatch[_0x443e('0x21')](_0x16ee17,_0x5f471d,!![]);}catch(_0x1836fe){return BPromise['reject'](_0x1836fe);}return _0x16ee17[_0x443e('0x22')]();};}function saveUpdates(_0x4271d9,_0x1a6b91){return function(_0x5bee52){if(_0x5bee52){return _0x5bee52[_0x443e('0x23')](_0x4271d9)[_0x443e('0x24')](function(_0x5461fd){return _0x5461fd;});}return null;};}function removeEntity(_0x3315ed,_0xc7afe0){return function(_0xa8b06c){if(_0xa8b06c){return _0xa8b06c[_0x443e('0x25')]()[_0x443e('0x24')](function(){_0x3315ed[_0x443e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32864c,_0x5fda13){return function(_0x2a714d){if(!_0x2a714d){_0x32864c['sendStatus'](0x194);}return _0x2a714d;};}function handleError(_0x355a1e,_0x1ee168){_0x1ee168=_0x1ee168||0x1f4;return function(_0x3e68b5){logger[_0x443e('0x26')](_0x3e68b5['stack']);if(_0x3e68b5[_0x443e('0x27')]){delete _0x3e68b5[_0x443e('0x27')];}_0x355a1e['status'](_0x1ee168)['send'](_0x3e68b5);};}exports[_0x443e('0x28')]=function(_0x36a2a9,_0x38b912){var _0x4a6c92={},_0x42708e={},_0x2406cb={'count':0x0,'rows':[]};var _0x4cff4d=_[_0x443e('0x29')](db[_0x443e('0x2a')][_0x443e('0x2b')],function(_0x2ecb7d){return{'name':_0x2ecb7d[_0x443e('0x2c')],'type':_0x2ecb7d[_0x443e('0x2d')]['key']};});_0x42708e[_0x443e('0x2e')]=_[_0x443e('0x29')](_0x4cff4d,_0x443e('0x27'));_0x42708e[_0x443e('0x2f')]=_[_0x443e('0x30')](_0x36a2a9[_0x443e('0x2f')]);_0x42708e[_0x443e('0x31')]=_[_0x443e('0x32')](_0x42708e['model'],_0x42708e[_0x443e('0x2f')]);_0x4a6c92['attributes']=_[_0x443e('0x32')](_0x42708e[_0x443e('0x2e')],qs['fields'](_0x36a2a9[_0x443e('0x2f')][_0x443e('0x33')]));_0x4a6c92[_0x443e('0x34')]=_0x4a6c92['attributes'][_0x443e('0x35')]?_0x4a6c92[_0x443e('0x34')]:_0x42708e[_0x443e('0x2e')];if(!_0x36a2a9[_0x443e('0x2f')][_0x443e('0x36')](_0x443e('0x37'))){_0x4a6c92['limit']=qs[_0x443e('0x1e')](_0x36a2a9[_0x443e('0x2f')][_0x443e('0x1e')]);_0x4a6c92[_0x443e('0x1d')]=qs[_0x443e('0x1d')](_0x36a2a9[_0x443e('0x2f')]['offset']);}_0x4a6c92['order']=qs[_0x443e('0x38')](_0x36a2a9['query'][_0x443e('0x38')]);_0x4a6c92[_0x443e('0x39')]=qs[_0x443e('0x31')](_[_0x443e('0x3a')](_0x36a2a9[_0x443e('0x2f')],_0x42708e[_0x443e('0x31')]),_0x4cff4d);if(_0x36a2a9[_0x443e('0x2f')][_0x443e('0x3b')]){_0x4a6c92[_0x443e('0x39')]=_['merge'](_0x4a6c92['where'],{'$or':_[_0x443e('0x29')](_0x4cff4d,function(_0x2df401){if(_0x2df401[_0x443e('0x2d')]!==_0x443e('0x3c')){var _0x2a0fed={};_0x2a0fed[_0x2df401[_0x443e('0x27')]]={'$like':'%'+_0x36a2a9[_0x443e('0x2f')]['filter']+'%'};return _0x2a0fed;}})});}_0x4a6c92=_[_0x443e('0x3d')]({},_0x4a6c92,_0x36a2a9['options']);var _0x77a927={'where':_0x4a6c92[_0x443e('0x39')]};return db['Attachment'][_0x443e('0x1c')](_0x77a927)[_0x443e('0x24')](function(_0x53571b){_0x2406cb[_0x443e('0x1c')]=_0x53571b;if(_0x36a2a9[_0x443e('0x2f')][_0x443e('0x3e')]){_0x4a6c92[_0x443e('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x443e('0x40')](_0x4a6c92);})['then'](function(_0x21869c){_0x2406cb['rows']=_0x21869c;return _0x2406cb;})['then'](respondWithFilteredResult(_0x38b912,_0x4a6c92))[_0x443e('0x41')](handleError(_0x38b912,null));};exports[_0x443e('0x42')]=function(_0x3436c4,_0x1a7a25){var _0x4d09f5={'raw':!![],'where':{'id':_0x3436c4[_0x443e('0x43')]['id']}},_0x1ab793={};_0x1ab793['model']=_[_0x443e('0x30')](db['Attachment'][_0x443e('0x2b')]);_0x1ab793[_0x443e('0x2f')]=_[_0x443e('0x30')](_0x3436c4[_0x443e('0x2f')]);_0x1ab793[_0x443e('0x31')]=_['intersection'](_0x1ab793[_0x443e('0x2e')],_0x1ab793[_0x443e('0x2f')]);_0x4d09f5[_0x443e('0x34')]=_[_0x443e('0x32')](_0x1ab793[_0x443e('0x2e')],qs['fields'](_0x3436c4[_0x443e('0x2f')][_0x443e('0x33')]));_0x4d09f5[_0x443e('0x34')]=_0x4d09f5[_0x443e('0x34')]['length']?_0x4d09f5['attributes']:_0x1ab793['model'];if(_0x3436c4[_0x443e('0x2f')][_0x443e('0x3e')]){_0x4d09f5[_0x443e('0x3f')]=[{'all':!![]}];}_0x4d09f5=_[_0x443e('0x3d')]({},_0x4d09f5,_0x3436c4[_0x443e('0x44')]);return db[_0x443e('0x2a')]['find'](_0x4d09f5)['then'](handleEntityNotFound(_0x1a7a25,null))[_0x443e('0x24')](respondWithResult(_0x1a7a25,null))[_0x443e('0x41')](handleError(_0x1a7a25,null));};exports['clone']=function(_0x5a6c79,_0x5cae88){var _0x3e99d8={'where':{'id':_0x5a6c79['params']['id']}},_0x4100d={};_0x4100d[_0x443e('0x2e')]=_[_0x443e('0x30')](db[_0x443e('0x2a')][_0x443e('0x2b')]);_0x3e99d8['attributes']=_[_0x443e('0x32')](_0x4100d[_0x443e('0x2e')],qs[_0x443e('0x33')](_0x5a6c79[_0x443e('0x2f')][_0x443e('0x33')]));_0x3e99d8['attributes']=_0x3e99d8[_0x443e('0x34')][_0x443e('0x35')]?_0x3e99d8[_0x443e('0x34')]:_0x4100d['model'];if(_0x5a6c79[_0x443e('0x2f')][_0x443e('0x3e')]){_0x3e99d8[_0x443e('0x3f')]=[{'all':!![]}];}_0x3e99d8=_['merge']({},_0x3e99d8,_0x5a6c79[_0x443e('0x44')]);return db[_0x443e('0x2a')][_0x443e('0x45')](_0x3e99d8)['then'](handleEntityNotFound(_0x5cae88,null))[_0x443e('0x24')](function(_0x577d95){if(_0x577d95){var _0x1027c2=_0x577d95['get']({'plain':!![]});_0x1027c2=qs[_0x443e('0x46')](_0x1027c2,['id',_0x443e('0x47'),_0x443e('0x48')]);_0x5a6c79[_0x443e('0x49')]=_[_0x443e('0x46')](_0x5a6c79[_0x443e('0x49')],['id',_0x443e('0x47'),_0x443e('0x48')]);return db['Attachment'][_0x443e('0x4a')](_['merge'](_0x1027c2,_0x5a6c79[_0x443e('0x49')]),{'include':_0x5a6c79[_0x443e('0x2f')][_0x443e('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5cae88,0xc9))[_0x443e('0x41')](handleError(_0x5cae88,null));};exports[_0x443e('0x23')]=function(_0x20f0a3,_0x3b9e61){if(_0x20f0a3[_0x443e('0x49')]['id']){delete _0x20f0a3[_0x443e('0x49')]['id'];}return db[_0x443e('0x2a')][_0x443e('0x45')]({'where':{'id':_0x20f0a3['params']['id']}})[_0x443e('0x24')](handleEntityNotFound(_0x3b9e61,null))[_0x443e('0x24')](saveUpdates(_0x20f0a3[_0x443e('0x49')],null))['then'](respondWithResult(_0x3b9e61,null))[_0x443e('0x41')](handleError(_0x3b9e61,null));};exports[_0x443e('0x25')]=function(_0x43014a,_0x5478ca){return db[_0x443e('0x2a')]['find']({'where':{'id':_0x43014a[_0x443e('0x43')]['id']}})[_0x443e('0x24')](handleEntityNotFound(_0x5478ca,null))[_0x443e('0x24')](removeEntity(_0x5478ca,null))[_0x443e('0x41')](handleError(_0x5478ca,null));};exports[_0x443e('0x4a')]=function(_0x43176b,_0xaac13,_0x4523fe){_0x43176b[_0x443e('0x49')]['name']=_0x43176b['file'][_0x443e('0x4b')];_0x43176b['body'][_0x443e('0x4c')]=_0x43176b['file'][_0x443e('0x4d')];_0x43176b['body'][_0x443e('0x2d')]=_0x43176b[_0x443e('0x4e')][_0x443e('0x4f')];return db[_0x443e('0x2a')]['create'](_0x43176b[_0x443e('0x49')])[_0x443e('0x24')](respondWithResult(_0xaac13,0xc9))[_0x443e('0x41')](handleError(_0xaac13,null));};exports[_0x443e('0x50')]=function(_0x1e62c4,_0x3986be,_0x263781){return db[_0x443e('0x2a')][_0x443e('0x51')]({'where':{'id':_0x1e62c4[_0x443e('0x43')]['id']},'raw':!![]})[_0x443e('0x24')](handleEntityNotFound(_0x3986be,null))[_0x443e('0x24')](function(_0x43b021){if(_0x43b021){return _0x3986be[_0x443e('0x50')](path['join'](config[_0x443e('0x52')],_0x443e('0x53'),_0x43b021['basename']));}})[_0x443e('0x41')](handleError(_0x3986be,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7f4b42e..0c17f46 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 _0xdf92=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','api','moment','bluebird','request-promise'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xdf92,0x10c));var _0x2df9=function(_0x4b1041,_0x3ec6a2){_0x4b1041=_0x4b1041-0x0;var _0x3f918e=_0xdf92[_0x4b1041];return _0x3f918e;};'use strict';var _=require(_0x2df9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2df9('0x1'));var moment=require(_0x2df9('0x2'));var BPromise=require(_0x2df9('0x3'));var rp=require(_0x2df9('0x4'));var fs=require('fs');var path=require(_0x2df9('0x5'));var rimraf=require(_0x2df9('0x6'));var config=require(_0x2df9('0x7'));var attributes=require(_0x2df9('0x8'));module[_0x2df9('0x9')]=function(_0x125317,_0x5b6e79){return _0x125317[_0x2df9('0xa')](_0x2df9('0xb'),attributes,{'tableName':_0x2df9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3aa=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash'];(function(_0x4039fb,_0xfe2645){var _0x2ae743=function(_0x5bb365){while(--_0x5bb365){_0x4039fb['push'](_0x4039fb['shift']());}};_0x2ae743(++_0xfe2645);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x37df6c,_0x2a9666){_0x37df6c=_0x37df6c-0x0;var _0x41f7aa=_0xf3aa[_0x37df6c];return _0x41f7aa;};'use strict';var _=require(_0xaf3a('0x0'));var util=require(_0xaf3a('0x1'));var logger=require(_0xaf3a('0x2'))(_0xaf3a('0x3'));var moment=require('moment');var BPromise=require(_0xaf3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaf3a('0x5'));var config=require(_0xaf3a('0x6'));var attributes=require(_0xaf3a('0x7'));module[_0xaf3a('0x8')]=function(_0x3050e3,_0x141196){return _0x3050e3[_0xaf3a('0x9')](_0xaf3a('0xa'),attributes,{'tableName':'attachments','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 b02b3cb..3a0e4cb 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 _0xdabd=['options','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','body'];(function(_0x335af8,_0x56c707){var _0x4f7220=function(_0x27ccf9){while(--_0x27ccf9){_0x335af8['push'](_0x335af8['shift']());}};_0x4f7220(++_0x56c707);}(_0xdabd,0xbf));var _0xddab=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xdabd[_0x519756];return _0x37047e;};'use strict';var _=require(_0xddab('0x0'));var util=require(_0xddab('0x1'));var moment=require(_0xddab('0x2'));var BPromise=require(_0xddab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xddab('0x5'));var logger=require(_0xddab('0x6'))(_0xddab('0x7'));var config=require(_0xddab('0x8'));var jayson=require(_0xddab('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54511d,_0x2074ac,_0x3de23d){return new BPromise(function(_0x137a88,_0x4ff608){return client[_0xddab('0xa')](_0x54511d,_0x3de23d)[_0xddab('0xb')](function(_0x197ea1){logger[_0xddab('0xc')](_0xddab('0xd'),_0x2074ac,_0xddab('0xe'));logger[_0xddab('0xf')](_0xddab('0x10'),_0x2074ac,_0xddab('0xe'),JSON['stringify'](_0x197ea1));if(_0x197ea1[_0xddab('0x11')]){if(_0x197ea1[_0xddab('0x11')][_0xddab('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x2074ac,_0x197ea1[_0xddab('0x11')][_0xddab('0x13')]);return _0x4ff608(_0x197ea1[_0xddab('0x11')]['message']);}logger[_0xddab('0x11')](_0xddab('0xd'),_0x2074ac,_0x197ea1[_0xddab('0x11')][_0xddab('0x13')]);return _0x137a88(_0x197ea1['error'][_0xddab('0x13')]);}else{logger[_0xddab('0xc')](_0xddab('0xd'),_0x2074ac,_0xddab('0xe'));_0x137a88(_0x197ea1[_0xddab('0x14')]['message']);}})['catch'](function(_0x4495ea){logger['error'](_0xddab('0xd'),_0x2074ac,_0x4495ea);_0x4ff608(_0x4495ea);});});}exports[_0xddab('0x15')]=function(_0x107701){var _0x634831=this;return new Promise(function(_0x3339b1,_0x2f306b){return db[_0xddab('0x16')][_0xddab('0x17')](_0x107701[_0xddab('0x18')],{'raw':_0x107701[_0xddab('0x19')]?_0x107701[_0xddab('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4ca67e){logger['info'](_0xddab('0x15'),_0x107701);logger[_0xddab('0xf')]('CreateAttachment',_0x107701,JSON['stringify'](_0x4ca67e));_0x3339b1(_0x4ca67e);})[_0xddab('0x1a')](function(_0x4199eb){logger[_0xddab('0x11')]('CreateAttachment',_0x4199eb[_0xddab('0x13')],_0x107701);_0x2f306b(_0x634831[_0xddab('0x11')](0x1f4,_0x4199eb[_0xddab('0x13')]));});});}; \ No newline at end of file +var _0x54f5=['request\x20sent','stringify','error','message','result','catch','CreateAttachment','Attachment','create','body','options','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x29265b,_0x1d301f){var _0x2434be=function(_0x190420){while(--_0x190420){_0x29265b['push'](_0x29265b['shift']());}};_0x2434be(++_0x1d301f);}(_0x54f5,0x178));var _0x554f=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x54f5[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0x554f('0x0'));var util=require('util');var moment=require(_0x554f('0x1'));var BPromise=require('bluebird');var rs=require(_0x554f('0x2'));var fs=require('fs');var Redis=require(_0x554f('0x3'));var db=require(_0x554f('0x4'))['db'];var utils=require(_0x554f('0x5'));var logger=require('../../config/logger')(_0x554f('0x6'));var config=require(_0x554f('0x7'));var jayson=require(_0x554f('0x8'));var client=jayson['client'][_0x554f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1eb26b,_0x270dd9,_0x4ae347){return new BPromise(function(_0x2776ec,_0x20a19d){return client[_0x554f('0xa')](_0x1eb26b,_0x4ae347)[_0x554f('0xb')](function(_0x2dff9b){logger[_0x554f('0xc')](_0x554f('0xd'),_0x270dd9,_0x554f('0xe'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x270dd9,_0x554f('0xe'),JSON[_0x554f('0xf')](_0x2dff9b));if(_0x2dff9b[_0x554f('0x10')]){if(_0x2dff9b['error']['code']===0x1f4){logger[_0x554f('0x10')](_0x554f('0xd'),_0x270dd9,_0x2dff9b['error']['message']);return _0x20a19d(_0x2dff9b[_0x554f('0x10')][_0x554f('0x11')]);}logger[_0x554f('0x10')](_0x554f('0xd'),_0x270dd9,_0x2dff9b[_0x554f('0x10')][_0x554f('0x11')]);return _0x2776ec(_0x2dff9b[_0x554f('0x10')][_0x554f('0x11')]);}else{logger[_0x554f('0xc')](_0x554f('0xd'),_0x270dd9,'request\x20sent');_0x2776ec(_0x2dff9b[_0x554f('0x12')][_0x554f('0x11')]);}})[_0x554f('0x13')](function(_0x3ee8e0){logger[_0x554f('0x10')](_0x554f('0xd'),_0x270dd9,_0x3ee8e0);_0x20a19d(_0x3ee8e0);});});}exports[_0x554f('0x14')]=function(_0x51dab2){var _0x481b15=this;return new Promise(function(_0x3b01be,_0x591d23){return db[_0x554f('0x15')][_0x554f('0x16')](_0x51dab2[_0x554f('0x17')],{'raw':_0x51dab2[_0x554f('0x18')]?_0x51dab2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e119b){logger[_0x554f('0xc')]('CreateAttachment',_0x51dab2);logger[_0x554f('0x19')](_0x554f('0x14'),_0x51dab2,JSON[_0x554f('0xf')](_0x1e119b));_0x3b01be(_0x1e119b);})['catch'](function(_0x258473){logger[_0x554f('0x10')](_0x554f('0x14'),_0x258473[_0x554f('0x11')],_0x51dab2);_0x591d23(_0x481b15['error'](0x1f4,_0x258473['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 09f9fde..95c62ee 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 _0x66d8=['/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','single','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','download','post'];(function(_0x1de85c,_0x2ba61c){var _0x3f4960=function(_0x117af3){while(--_0x117af3){_0x1de85c['push'](_0x1de85c['shift']());}};_0x3f4960(++_0x2ba61c);}(_0x66d8,0x1c1));var _0x866d=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0x66d8[_0xf4d05];return _0x47c971;};'use strict';var multer=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var path=require(_0x866d('0x2'));var timeout=require(_0x866d('0x3'));var express=require(_0x866d('0x4'));var router=express[_0x866d('0x5')]();var auth=require(_0x866d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x866d('0x7'));var controller=require(_0x866d('0x8'));router[_0x866d('0x9')]('/',auth['isAuthenticated'](),controller[_0x866d('0xa')]);router['get'](_0x866d('0xb'),auth[_0x866d('0xc')](),controller[_0x866d('0xd')]);router[_0x866d('0x9')]('/:id/download',auth[_0x866d('0xc')](),controller[_0x866d('0xe')]);router[_0x866d('0xf')](_0x866d('0x10'),auth[_0x866d('0xc')](),controller[_0x866d('0x11')]);var upload=multer({'storage':multer[_0x866d('0x12')]({'destination':function(_0x2ad68f,_0x1da8d9,_0x709155){_0x709155(null,path[_0x866d('0x13')](config[_0x866d('0x14')],_0x866d('0x15')));},'filename':function(_0x317e0f,_0x501e56,_0x109fc4){_0x109fc4(null,util[_0x866d('0x16')](_0x866d('0x17'),Date[_0x866d('0x18')](),_0x501e56['originalname'][_0x866d('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x866d('0xf')]('/',upload[_0x866d('0x1a')]('file'),controller['create']);router[_0x866d('0x1b')](_0x866d('0xb'),auth[_0x866d('0xc')](),controller[_0x866d('0x1c')]);router['delete'](_0x866d('0xb'),auth[_0x866d('0xc')](),controller[_0x866d('0x1d')]);module[_0x866d('0x1e')]=router; \ No newline at end of file +var _0x7348=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','post','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','file','create','put','delete','destroy','exports','util'];(function(_0x5e46d7,_0xd36bbb){var _0xce1f6d=function(_0x3285be){while(--_0x3285be){_0x5e46d7['push'](_0x5e46d7['shift']());}};_0xce1f6d(++_0xd36bbb);}(_0x7348,0x16b));var _0x8734=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7348[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x8734('0x0'));var path=require(_0x8734('0x1'));var timeout=require('connect-timeout');var express=require(_0x8734('0x2'));var router=express[_0x8734('0x3')]();var auth=require(_0x8734('0x4'));var interaction=require(_0x8734('0x5'));var config=require(_0x8734('0x6'));var controller=require('./attachment.controller');router[_0x8734('0x7')]('/',auth['isAuthenticated'](),controller[_0x8734('0x8')]);router['get'](_0x8734('0x9'),auth[_0x8734('0xa')](),controller[_0x8734('0xb')]);router['get'](_0x8734('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x8734('0xd')]('/:id/clone',auth[_0x8734('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x8734('0xe')]({'destination':function(_0x398e71,_0x2ab38d,_0x326d26){_0x326d26(null,path['join'](config[_0x8734('0xf')],_0x8734('0x10')));},'filename':function(_0x32b0be,_0x9c3bf3,_0xca1e47){_0xca1e47(null,util[_0x8734('0x11')](_0x8734('0x12'),Date['now'](),_0x9c3bf3[_0x8734('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0x8734('0x14')),controller[_0x8734('0x15')]);router[_0x8734('0x16')](_0x8734('0x9'),auth[_0x8734('0xa')](),controller['update']);router[_0x8734('0x17')](_0x8734('0x9'),auth['isAuthenticated'](),controller[_0x8734('0x18')]);module[_0x8734('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e9a2e2f..81e9753 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 _0xc14a=['moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','profile','email','callback','authenticate','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','value','user','agent','blockedAt','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20'];(function(_0x4b52d6,_0x989c59){var _0x436cc4=function(_0x1e8fe6){while(--_0x1e8fe6){_0x4b52d6['push'](_0x4b52d6['shift']());}};_0x436cc4(++_0x989c59);}(_0xc14a,0x138));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xac14('0x0'));var passport=require(_0xac14('0x1'));var GoogleStrategy=require(_0xac14('0x2'))['Strategy'];var moment=require(_0xac14('0x3'));var db=require(_0xac14('0x4'))['db'];var config=require(_0xac14('0x5'));var signToken=require(_0xac14('0x6'))[_0xac14('0x7')];var utils=require(_0xac14('0x8'));exports[_0xac14('0x9')]=passport['authenticate'](_0xac14('0xa'),{'failureRedirect':'/login','scope':[_0xac14('0xb'),_0xac14('0xc')],'session':![]});exports[_0xac14('0xd')]=passport[_0xac14('0xe')](_0xac14('0xa'),{'failureRedirect':'/login','session':![]});passport[_0xac14('0xf')](new GoogleStrategy({'clientID':config[_0xac14('0xa')]?config['google'][_0xac14('0x10')]:'id','clientSecret':config[_0xac14('0xa')]?config['google']['clientSecret']:_0xac14('0x11'),'callbackURL':config[_0xac14('0xa')]?config[_0xac14('0xa')][_0xac14('0x12')]:''},function(_0x204199,_0x16e16b,_0xdf6cad,_0x48c50b){var _0x23706f,_0x5c0d95;return db[_0xac14('0x13')][_0xac14('0x14')]({'where':{'id':0x1},'attributes':[_0xac14('0x15'),_0xac14('0x16')],'raw':!![]})[_0xac14('0x17')](function(_0xcc2259){_0x23706f=_0xcc2259;return db[_0xac14('0x18')]['find']({'where':{'email':_[_0xac14('0x19')](_0xdf6cad['emails'],_0xac14('0x1a')),'role':{'$or':['admin',_0xac14('0x1b'),_0xac14('0x1c')]}}});})[_0xac14('0x17')](function(_0x3fdf86){_0x5c0d95=_0x3fdf86;if(_0x5c0d95){if(_0x5c0d95['disabled']){return _0x48c50b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x23706f['blockDuration']>0x0){if(_0x5c0d95['blocked']){if(moment(_0x5c0d95[_0xac14('0x1d')])[_0xac14('0x1e')](_0x23706f[_0xac14('0x16')],'minutes')>moment()){return _0x48c50b(_0xac14('0x1f'));}else{return utils[_0xac14('0x20')](_0x5c0d95,0x0,![],null)[_0xac14('0x17')](function(){return utils[_0xac14('0x21')](_0x5c0d95);})['then'](function(){return _0x48c50b(null,_0x5c0d95);});}}else{return utils['getLicense'](_0x5c0d95)[_0xac14('0x17')](function(){return _0x48c50b(null,_0x5c0d95);});}}else{return utils[_0xac14('0x21')](_0x5c0d95)[_0xac14('0x17')](function(){return _0x48c50b(null,_0x5c0d95);});}}return _0x48c50b('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xac14('0x22')](function(_0x40dd6f){_0x48c50b(_0x40dd6f);});})); \ No newline at end of file +var _0x58d4=['profile','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','then','User','emails','value','admin','user','agent','disabled','blockDuration','blocked','blockedAt','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login'];(function(_0x2c89e9,_0x1756cc){var _0x55b4b5=function(_0x366cc9){while(--_0x366cc9){_0x2c89e9['push'](_0x2c89e9['shift']());}};_0x55b4b5(++_0x1756cc);}(_0x58d4,0x16a));var _0x458d=function(_0x4df8d9,_0x5818fb){_0x4df8d9=_0x4df8d9-0x0;var _0x223be6=_0x58d4[_0x4df8d9];return _0x223be6;};'use strict';var _=require(_0x458d('0x0'));var passport=require(_0x458d('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x458d('0x2')];var moment=require(_0x458d('0x3'));var db=require(_0x458d('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x458d('0x5'))[_0x458d('0x6')];var utils=require(_0x458d('0x7'));exports[_0x458d('0x8')]=passport[_0x458d('0x9')](_0x458d('0xa'),{'failureRedirect':_0x458d('0xb'),'scope':[_0x458d('0xc'),'email'],'session':![]});exports['callback']=passport[_0x458d('0x9')](_0x458d('0xa'),{'failureRedirect':_0x458d('0xb'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x458d('0xa')]?config[_0x458d('0xa')][_0x458d('0xd')]:'id','clientSecret':config[_0x458d('0xa')]?config['google'][_0x458d('0xe')]:_0x458d('0xf'),'callbackURL':config[_0x458d('0xa')]?config[_0x458d('0xa')][_0x458d('0x10')]:''},function(_0x4e5b43,_0x41da65,_0x48fec5,_0x38fa31){var _0xbbc875,_0x26da3a;return db[_0x458d('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x458d('0x12'),'blockDuration'],'raw':!![]})[_0x458d('0x13')](function(_0x59fa4f){_0xbbc875=_0x59fa4f;return db[_0x458d('0x14')]['find']({'where':{'email':_['map'](_0x48fec5[_0x458d('0x15')],_0x458d('0x16')),'role':{'$or':[_0x458d('0x17'),_0x458d('0x18'),_0x458d('0x19')]}}});})[_0x458d('0x13')](function(_0x38a2ca){_0x26da3a=_0x38a2ca;if(_0x26da3a){if(_0x26da3a[_0x458d('0x1a')]){return _0x38fa31('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xbbc875[_0x458d('0x1b')]>0x0){if(_0x26da3a[_0x458d('0x1c')]){if(moment(_0x26da3a[_0x458d('0x1d')])['add'](_0xbbc875[_0x458d('0x1b')],'minutes')>moment()){return _0x38fa31(_0x458d('0x1e'));}else{return utils[_0x458d('0x1f')](_0x26da3a,0x0,![],null)[_0x458d('0x13')](function(){return utils[_0x458d('0x20')](_0x26da3a);})[_0x458d('0x13')](function(){return _0x38fa31(null,_0x26da3a);});}}else{return utils['getLicense'](_0x26da3a)['then'](function(){return _0x38fa31(null,_0x26da3a);});}}else{return utils['getLicense'](_0x26da3a)[_0x458d('0x13')](function(){return _0x38fa31(null,_0x26da3a);});}}return _0x38fa31(_0x458d('0x1e'));})[_0x458d('0x21')](function(_0x5a0b9b){_0x38fa31(_0x5a0b9b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7efb899..8efa117 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 _0x94b1=['../../components/auth/service','login','get','/callback','callback','setTokenCookie','passport','./authGoogle.controller','../user/user.controller.js'];(function(_0x2142fa,_0x1e9945){var _0x350983=function(_0x125657){while(--_0x125657){_0x2142fa['push'](_0x2142fa['shift']());}};_0x350983(++_0x1e9945);}(_0x94b1,0x102));var _0x194b=function(_0x1c85ef,_0x51e609){_0x1c85ef=_0x1c85ef-0x0;var _0x2ed48b=_0x94b1[_0x1c85ef];return _0x2ed48b;};'use strict';var express=require('express');var passport=require(_0x194b('0x0'));var router=express['Router']();var controller=require(_0x194b('0x1'));var userController=require(_0x194b('0x2'));var authService=require(_0x194b('0x3'));router['get']('/',controller[_0x194b('0x4')]);router[_0x194b('0x5')](_0x194b('0x6'),controller[_0x194b('0x7')],authService['isMiddleware'],userController[_0x194b('0x4')],authService[_0x194b('0x8')]);module['exports']=router; \ No newline at end of file +var _0x385b=['callback','isMiddleware','login','setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x119b79,_0x4b0875){var _0x3da1f8=function(_0x464505){while(--_0x464505){_0x119b79['push'](_0x119b79['shift']());}};_0x3da1f8(++_0x4b0875);}(_0x385b,0x1a7));var _0xb385=function(_0x2a32e1,_0x2dd0ff){_0x2a32e1=_0x2a32e1-0x0;var _0x1691d2=_0x385b[_0x2a32e1];return _0x1691d2;};'use strict';var express=require('express');var passport=require(_0xb385('0x0'));var router=express['Router']();var controller=require(_0xb385('0x1'));var userController=require(_0xb385('0x2'));var authService=require(_0xb385('0x3'));router[_0xb385('0x4')]('/',controller['login']);router[_0xb385('0x4')](_0xb385('0x5'),controller[_0xb385('0x6')],authService[_0xb385('0x7')],userController[_0xb385('0x8')],authService[_0xb385('0x9')]);module[_0xb385('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d3bdc69..41a4694 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 _0x6a55=['clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','SendMail','error','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','email','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','jayson/promise','moment','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes'];(function(_0x149627,_0x37e919){var _0x24e317=function(_0x4fe691){while(--_0x4fe691){_0x149627['push'](_0x149627['shift']());}};_0x24e317(++_0x37e919);}(_0x6a55,0xdb));var _0x56a5=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x6a55[_0xfd495c];return _0x561dd8;};'use strict';var util=require(_0x56a5('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x56a5('0x1'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x56a5('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0x56a5('0x3'));var utils=require('../../config/utils');var client=jayson[_0x56a5('0x4')][_0x56a5('0x5')]({'port':0x232b});function localAuthenticate(_0x42d164,_0x293ea1,_0x444c65,_0x2272d9){var _0x2b8f57,_0x387dcb;return db['Setting'][_0x56a5('0x6')]({'where':{'id':0x1},'attributes':[_0x56a5('0x7'),_0x56a5('0x8')],'raw':!![]})[_0x56a5('0x9')](function(_0x3f4fe0){_0x2b8f57=_0x3f4fe0;return _0x42d164[_0x56a5('0x6')]({'attributes':['id',_0x56a5('0xa'),_0x56a5('0xb'),_0x56a5('0xc'),'role','disabled',_0x56a5('0xd'),_0x56a5('0xe'),_0x56a5('0xf')],'where':{'name':_0x293ea1,'role':{'$or':[_0x56a5('0x10'),_0x56a5('0x11'),_0x56a5('0x12')]}}});})['then'](function(_0x4a6dc5){if(!_0x4a6dc5||_0x4a6dc5&&_0x4a6dc5[_0x56a5('0xa')]!==_0x293ea1){throw new Error(_0x56a5('0x13'));}else{_0x387dcb=_0x4a6dc5;return _0x387dcb;}})[_0x56a5('0x9')](function(){_0x387dcb[_0x56a5('0x14')](_0x444c65,function(_0x310c32,_0x2db112){var _0xe3091f=_0x387dcb['loginAttempts']+0x1;if(_0x310c32){return _0x2272d9(_0x310c32);}else if(!_0x2db112){if(_0x387dcb[_0x56a5('0x15')]){return _0x2272d9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2b8f57[_0x56a5('0x7')]>0x0){if(_0x387dcb['blocked']){if(_0x2b8f57[_0x56a5('0x8')]>0x0){if(moment(_0x387dcb[_0x56a5('0xe')])[_0x56a5('0x16')](_0x2b8f57[_0x56a5('0x8')],_0x56a5('0x17'))>moment()){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}else{return utils[_0x56a5('0x18')](_0x387dcb,_0xe3091f,![],null)['then'](function(){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});});}}else{return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}}else{if(_0xe3091f>=_0x2b8f57[_0x56a5('0x7')]){return utils[_0x56a5('0x18')](_0x387dcb,0x0,!![],moment())['then'](function(){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});});}else{return utils[_0x56a5('0x18')](_0x387dcb,_0xe3091f,![],null)[_0x56a5('0x9')](function(){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});});}}}else{return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}}else{if(_0x387dcb['disabled']){return _0x2272d9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2b8f57[_0x56a5('0x7')]>0x0){if(_0x387dcb[_0x56a5('0xd')]){if(_0x2b8f57['blockDuration']>0x0){if(moment(_0x387dcb[_0x56a5('0xe')])[_0x56a5('0x16')](_0x2b8f57[_0x56a5('0x8')],_0x56a5('0x17'))>moment()){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}else{return utils[_0x56a5('0x18')](_0x387dcb,0x0,![],null)[_0x56a5('0x9')](function(){return utils[_0x56a5('0x19')](_0x387dcb);})[_0x56a5('0x9')](function(){return _0x2272d9(null,_0x387dcb);});}}else{return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}}else{return utils[_0x56a5('0x18')](_0x387dcb,0x0,![],null)[_0x56a5('0x9')](function(){return utils[_0x56a5('0x19')](_0x387dcb);})['then'](function(){return _0x2272d9(null,_0x387dcb);})[_0x56a5('0x1a')](function(_0x2d8e68){return _0x2272d9(null,![],_0x2d8e68);});}}else{if(_0x387dcb[_0x56a5('0xd')]){return _0x2272d9(null,![],{'message':_0x56a5('0x13')});}else{return utils[_0x56a5('0x19')](_0x387dcb)['then'](function(){return _0x2272d9(null,_0x387dcb);});}}}});})[_0x56a5('0x1a')](function(_0x54ec36){return _0x2272d9(null,![],_0x54ec36);});}function sendServiceMail(_0x2efde7){return db[_0x56a5('0x1b')][_0x56a5('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x56a5('0xa'),'email'],'include':[{'model':db[_0x56a5('0x1d')],'as':_0x56a5('0x1e')}]})[_0x56a5('0x9')](function(_0x51ef6f){if(!_0x51ef6f){throw new Error(_0x56a5('0x1f'));}var _0x29dbe7={'tls':{'rejectUnauthorized':![]}};if(_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x20')]){_0x29dbe7[_0x56a5('0x20')]=_0x51ef6f['Smtp'][_0x56a5('0x20')];}else{_0x29dbe7[_0x56a5('0x21')]=_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x21')];_0x29dbe7[_0x56a5('0x22')]=_0x51ef6f['Smtp']['port'];_0x29dbe7[_0x56a5('0x23')]=_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x23')];}if(_0x51ef6f['Smtp'][_0x56a5('0x24')]){_0x29dbe7[_0x56a5('0x25')]={'user':_0x51ef6f['Smtp']['user'],'pass':_0x51ef6f['Smtp']['pass']};}var _0x423e3a={'account':_0x29dbe7,'message':_[_0x56a5('0x26')]({'from':util[_0x56a5('0x27')]('\x22%s\x22\x20<%s>',_0x51ef6f[_0x56a5('0xa')],_0x51ef6f['email']||_0x51ef6f[_0x56a5('0x1e')][_0x56a5('0x11')])},_0x2efde7)};return client['request'](_0x56a5('0x28'),_0x423e3a);})['then'](function(_0x112e26){if(_0x112e26[_0x56a5('0x29')]){throw new Error(util[_0x56a5('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x112e26[_0x56a5('0x29')][_0x56a5('0x2a')]||JSON[_0x56a5('0x2b')](_0x112e26['error'])));}return!![];});}function handleError(_0x2ec273,_0x2b4fc7,_0xce6a1d){return _0x2ec273[_0x56a5('0x2c')](_0x2b4fc7||0x1f4)[_0x56a5('0x2d')]({'message':_0xce6a1d?_0xce6a1d['message']||_0xce6a1d:''});}exports['login']=function(_0xbbe90e,_0x84f99a,_0x2b4661){passport[_0x56a5('0x14')](_0x56a5('0x2e'),function(_0xaeda55,_0x16e747,_0x652028){var _0x1fe853=_0xaeda55||_0x652028;if(_0x1fe853){return handleError(_0x84f99a,0x191,_0x1fe853);}if(!_0x16e747){return handleError(_0x84f99a,0x194,{'message':_0x56a5('0x2f')});}else{var _0xbd9cab={'payload':{'id':_0x16e747['id'],'role':_0x16e747[_0x56a5('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0x56a5('0x31')](_0xbd9cab)[_0x56a5('0x9')](function(_0x102242){_0x84f99a[_0x56a5('0x32')]({'id':_0x16e747['id'],'token':_0x102242,'statusCall':'','isAlreadyLogged':_0x16e747[_0x56a5('0x33')]});});}})(_0xbbe90e,_0x84f99a,_0x2b4661);};exports[_0x56a5('0x34')]=function(_0xf0f6c8,_0xa88ae1,_0x6a7b4c){if(!_0xf0f6c8[_0x56a5('0x35')]['email']){return handleError(_0xa88ae1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xe63fd5=rs['generate']();_0xf0f6c8[_0x56a5('0x35')][_0x56a5('0x36')]=_0xf0f6c8[_0x56a5('0x35')][_0x56a5('0x36')][_0x56a5('0x37')]()[_0x56a5('0x38')]();var _0x5618f9;return db['Setting'][_0x56a5('0x6')]({'where':{'id':0x1},'attributes':[_0x56a5('0x7'),_0x56a5('0x8')],'raw':!![]})[_0x56a5('0x9')](function(_0x29b3e7){_0x5618f9=_0x29b3e7;return db[_0x56a5('0x39')]['find']({'where':{'email':_0xf0f6c8[_0x56a5('0x35')][_0x56a5('0x36')]}});})['then'](function(_0x925f9b){if(!_0x925f9b){throw new Error(_0x56a5('0x3a'));}if(_0x925f9b[_0x56a5('0x15')]){throw new Error(_0x56a5('0x3b'));}if(_0x925f9b['blocked']){if(moment(_0x925f9b[_0x56a5('0xe')])['add'](_0x5618f9[_0x56a5('0x8')],_0x56a5('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x925f9b[_0x56a5('0xd')]=![];_0x925f9b['blockedAt']=null;}}_0x925f9b[_0x56a5('0x3c')]=_0xe63fd5;_0x925f9b[_0x56a5('0x3d')]=Date['now']()+0x36ee80;return _0x925f9b[_0x56a5('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0xf0f6c8[_0x56a5('0x35')]['email'],'subject':_0x56a5('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x56a5('0x40')+_0x56a5('0x41')+_0xf0f6c8[_0x56a5('0x42')][_0x56a5('0x21')]+_0x56a5('0x43')+_0xe63fd5+'\x0a\x0a'+_0x56a5('0x44')});})[_0x56a5('0x9')](function(){_0xa88ae1['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x56a5('0x1a')](function(_0x1bec14){return handleError(_0xa88ae1,0x1f4,_0x1bec14);});};exports[_0x56a5('0x45')]=function(_0x55d2e2,_0x16ba8d,_0x38aa81){return db[_0x56a5('0x39')]['find']({'where':{'resetPasswordToken':_0x55d2e2[_0x56a5('0x46')][_0x56a5('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x56a5('0x9')](function(_0x1080f8){if(!_0x1080f8){throw new Error(_0x56a5('0x48'));}return db[_0x56a5('0x49')][_0x56a5('0x6')]({'attributes':['id','securePassword',_0x56a5('0x4a'),_0x56a5('0x4b')]})[_0x56a5('0x9')](function(_0x4444ed){if(_0x4444ed[_0x56a5('0x4c')])authService['validatePasswordPattern'](_0x55d2e2[_0x56a5('0x35')][_0x56a5('0xb')]);if(!_0x4444ed['enforcePasswordHistory']||!_0x1080f8[_0x56a5('0x4d')])return _0x1080f8;authService[_0x56a5('0x4e')](_0x55d2e2[_0x56a5('0x35')]['password'],_0x1080f8[_0x56a5('0x4d')],_0x4444ed['passwordHistoryLimit']);return _0x1080f8;})[_0x56a5('0x9')](function(){_0x1080f8['password']=_0x55d2e2[_0x56a5('0x35')][_0x56a5('0xb')];_0x1080f8[_0x56a5('0x3c')]=null;_0x1080f8[_0x56a5('0x3d')]=null;return _0x1080f8['save']();});})[_0x56a5('0x9')](function(){_0x16ba8d['status'](0xc8)[_0x56a5('0x2d')]({'message':_0x56a5('0x4f')});})[_0x56a5('0x1a')](function(_0x3d8b81){return handleError(_0x16ba8d,0x1f4,_0x3d8b81);});};passport[_0x56a5('0x50')](new LocalStrategy({'usernameField':_0x56a5('0xa'),'passwordField':_0x56a5('0xb')},function(_0x1c84e9,_0x331bbd,_0x76c6bb){return localAuthenticate(db['User'],_0x1c84e9,_0x331bbd,_0x76c6bb);})); \ No newline at end of file +var _0xafc4=['headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','send','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','disabled','getLicense','catch','find','MailServerOut','Smtp','service','host','port','secure','authentication','pass','merge','format','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xafc4,0x69));var _0x4afc=function(_0x2e9495,_0x233e11){_0x2e9495=_0x2e9495-0x0;var _0x33a76e=_0xafc4[_0x2e9495];return _0x33a76e;};'use strict';var util=require(_0x4afc('0x0'));var passport=require('passport');var LocalStrategy=require(_0x4afc('0x1'))['Strategy'];var jayson=require(_0x4afc('0x2'));var _=require(_0x4afc('0x3'));var rs=require(_0x4afc('0x4'));var moment=require(_0x4afc('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x4afc('0x6')][_0x4afc('0x7')]({'port':0x232b});function localAuthenticate(_0x16953b,_0x1bb281,_0xc828d9,_0xaf053d){var _0x5e1e29,_0x31e165;return db[_0x4afc('0x8')][_0x4afc('0x9')]({'where':{'id':0x1},'attributes':[_0x4afc('0xa'),_0x4afc('0xb')],'raw':!![]})[_0x4afc('0xc')](function(_0x5542ec){_0x5e1e29=_0x5542ec;return _0x16953b['findOne']({'attributes':['id',_0x4afc('0xd'),'password',_0x4afc('0xe'),_0x4afc('0xf'),'disabled',_0x4afc('0x10'),_0x4afc('0x11'),_0x4afc('0x12')],'where':{'name':_0x1bb281,'role':{'$or':[_0x4afc('0x13'),_0x4afc('0x14'),_0x4afc('0x15')]}}});})[_0x4afc('0xc')](function(_0x23b03e){if(!_0x23b03e||_0x23b03e&&_0x23b03e['name']!==_0x1bb281){throw new Error(_0x4afc('0x16'));}else{_0x31e165=_0x23b03e;return _0x31e165;}})[_0x4afc('0xc')](function(){_0x31e165[_0x4afc('0x17')](_0xc828d9,function(_0x1e2c31,_0x5f2dc9){var _0x4e32e8=_0x31e165[_0x4afc('0x12')]+0x1;if(_0x1e2c31){return _0xaf053d(_0x1e2c31);}else if(!_0x5f2dc9){if(_0x31e165['disabled']){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else if(_0x5e1e29[_0x4afc('0xa')]>0x0){if(_0x31e165[_0x4afc('0x10')]){if(_0x5e1e29[_0x4afc('0xb')]>0x0){if(moment(_0x31e165[_0x4afc('0x11')])[_0x4afc('0x18')](_0x5e1e29[_0x4afc('0xb')],_0x4afc('0x19'))>moment()){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else{return utils[_0x4afc('0x1a')](_0x31e165,_0x4e32e8,![],null)[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{if(_0x4e32e8>=_0x5e1e29[_0x4afc('0xa')]){return utils[_0x4afc('0x1a')](_0x31e165,0x0,!![],moment())[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x4afc('0x1a')](_0x31e165,_0x4e32e8,![],null)[_0x4afc('0xc')](function(){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});});}}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{if(_0x31e165[_0x4afc('0x1b')]){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else if(_0x5e1e29[_0x4afc('0xa')]>0x0){if(_0x31e165['blocked']){if(_0x5e1e29[_0x4afc('0xb')]>0x0){if(moment(_0x31e165[_0x4afc('0x11')])['add'](_0x5e1e29[_0x4afc('0xb')],'minutes')>moment()){return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}else{return utils[_0x4afc('0x1a')](_0x31e165,0x0,![],null)[_0x4afc('0xc')](function(){return utils[_0x4afc('0x1c')](_0x31e165);})[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);});}}else{return _0xaf053d(null,![],{'message':_0x4afc('0x16')});}}else{return utils[_0x4afc('0x1a')](_0x31e165,0x0,![],null)[_0x4afc('0xc')](function(){return utils[_0x4afc('0x1c')](_0x31e165);})[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);})[_0x4afc('0x1d')](function(_0x359c07){return _0xaf053d(null,![],_0x359c07);});}}else{if(_0x31e165[_0x4afc('0x10')]){return _0xaf053d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4afc('0x1c')](_0x31e165)[_0x4afc('0xc')](function(){return _0xaf053d(null,_0x31e165);});}}}});})[_0x4afc('0x1d')](function(_0x4e254d){return _0xaf053d(null,![],_0x4e254d);});}function sendServiceMail(_0x52212d){return db['MailAccount'][_0x4afc('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x4afc('0xd'),'email'],'include':[{'model':db[_0x4afc('0x1f')],'as':_0x4afc('0x20')}]})['then'](function(_0x514278){if(!_0x514278){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3bae1a={'tls':{'rejectUnauthorized':![]}};if(_0x514278[_0x4afc('0x20')][_0x4afc('0x21')]){_0x3bae1a[_0x4afc('0x21')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x21')];}else{_0x3bae1a['host']=_0x514278[_0x4afc('0x20')][_0x4afc('0x22')];_0x3bae1a[_0x4afc('0x23')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x23')];_0x3bae1a[_0x4afc('0x24')]=_0x514278[_0x4afc('0x20')][_0x4afc('0x24')];}if(_0x514278['Smtp'][_0x4afc('0x25')]){_0x3bae1a['auth']={'user':_0x514278['Smtp'][_0x4afc('0x14')],'pass':_0x514278[_0x4afc('0x20')][_0x4afc('0x26')]};}var _0x3d4ab5={'account':_0x3bae1a,'message':_[_0x4afc('0x27')]({'from':util[_0x4afc('0x28')]('\x22%s\x22\x20<%s>',_0x514278[_0x4afc('0xd')],_0x514278[_0x4afc('0x29')]||_0x514278[_0x4afc('0x20')][_0x4afc('0x14')])},_0x52212d)};return client[_0x4afc('0x2a')](_0x4afc('0x2b'),_0x3d4ab5);})['then'](function(_0x22eea2){if(_0x22eea2[_0x4afc('0x2c')]){throw new Error(util[_0x4afc('0x28')](_0x4afc('0x2d'),_0x22eea2['error']['message']||JSON[_0x4afc('0x2e')](_0x22eea2[_0x4afc('0x2c')])));}return!![];});}function handleError(_0x17ea03,_0x5edfe1,_0x5790a2){return _0x17ea03[_0x4afc('0x2f')](_0x5edfe1||0x1f4)['send']({'message':_0x5790a2?_0x5790a2['message']||_0x5790a2:''});}exports[_0x4afc('0x30')]=function(_0x1dc853,_0x2be40e,_0x3e41f5){passport[_0x4afc('0x17')](_0x4afc('0x31'),function(_0x453e12,_0x29c0df,_0x3ccc5a){var _0x38f762=_0x453e12||_0x3ccc5a;if(_0x38f762){return handleError(_0x2be40e,0x191,_0x38f762);}if(!_0x29c0df){return handleError(_0x2be40e,0x194,{'message':_0x4afc('0x32')});}else{var _0x3ef2aa={'payload':{'id':_0x29c0df['id'],'role':_0x29c0df[_0x4afc('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x4afc('0x33')](_0x3ef2aa)[_0x4afc('0xc')](function(_0x5589be){_0x2be40e[_0x4afc('0x34')]({'id':_0x29c0df['id'],'token':_0x5589be,'statusCall':'','isAlreadyLogged':_0x29c0df[_0x4afc('0x35')]});});}})(_0x1dc853,_0x2be40e,_0x3e41f5);};exports[_0x4afc('0x36')]=function(_0xe6db12,_0x12db1d,_0x260b06){if(!_0xe6db12[_0x4afc('0x37')]['email']){return handleError(_0x12db1d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5ee5d7=rs[_0x4afc('0x38')]();_0xe6db12[_0x4afc('0x37')]['email']=_0xe6db12[_0x4afc('0x37')][_0x4afc('0x29')][_0x4afc('0x39')]()[_0x4afc('0x3a')]();var _0x545109;return db[_0x4afc('0x8')][_0x4afc('0x9')]({'where':{'id':0x1},'attributes':[_0x4afc('0xa'),_0x4afc('0xb')],'raw':!![]})[_0x4afc('0xc')](function(_0x2404fc){_0x545109=_0x2404fc;return db['User'][_0x4afc('0x1e')]({'where':{'email':_0xe6db12['body'][_0x4afc('0x29')]}});})[_0x4afc('0xc')](function(_0x212441){if(!_0x212441){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x212441['disabled']){throw new Error(_0x4afc('0x3b'));}if(_0x212441[_0x4afc('0x10')]){if(moment(_0x212441[_0x4afc('0x11')])[_0x4afc('0x18')](_0x545109[_0x4afc('0xb')],_0x4afc('0x19'))>moment()){throw new Error(_0x4afc('0x3c'));}else{_0x212441[_0x4afc('0x10')]=![];_0x212441['blockedAt']=null;}}_0x212441[_0x4afc('0x3d')]=_0x5ee5d7;_0x212441[_0x4afc('0x3e')]=Date['now']()+0x36ee80;return _0x212441[_0x4afc('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0xe6db12[_0x4afc('0x37')][_0x4afc('0x29')],'subject':_0x4afc('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x4afc('0x41')+_0x4afc('0x42')+_0xe6db12[_0x4afc('0x43')][_0x4afc('0x22')]+_0x4afc('0x44')+_0x5ee5d7+'\x0a\x0a'+_0x4afc('0x45')});})['then'](function(){_0x12db1d['status'](0xc8)['send']({'message':_0x4afc('0x46')});})[_0x4afc('0x1d')](function(_0x42e274){return handleError(_0x12db1d,0x1f4,_0x42e274);});};exports[_0x4afc('0x47')]=function(_0xb5cca9,_0x122cbc,_0x22e8b0){return db[_0x4afc('0x48')][_0x4afc('0x1e')]({'where':{'resetPasswordToken':_0xb5cca9[_0x4afc('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x4afc('0x4a')]()}}})['then'](function(_0x4861a5){if(!_0x4861a5){throw new Error(_0x4afc('0x4b'));}return db['Setting'][_0x4afc('0x9')]({'attributes':['id',_0x4afc('0x4c'),_0x4afc('0x4d'),_0x4afc('0x4e')]})['then'](function(_0x46461f){if(_0x46461f['securePassword'])authService[_0x4afc('0x4f')](_0xb5cca9[_0x4afc('0x37')][_0x4afc('0x50')]);if(!_0x46461f[_0x4afc('0x4d')]||!_0x4861a5[_0x4afc('0x51')])return _0x4861a5;authService[_0x4afc('0x52')](_0xb5cca9[_0x4afc('0x37')][_0x4afc('0x50')],_0x4861a5[_0x4afc('0x51')],_0x46461f[_0x4afc('0x4e')]);return _0x4861a5;})[_0x4afc('0xc')](function(){_0x4861a5[_0x4afc('0x50')]=_0xb5cca9['body'][_0x4afc('0x50')];_0x4861a5[_0x4afc('0x3d')]=null;_0x4861a5[_0x4afc('0x3e')]=null;return _0x4861a5[_0x4afc('0x3f')]();});})[_0x4afc('0xc')](function(){_0x122cbc[_0x4afc('0x2f')](0xc8)[_0x4afc('0x53')]({'message':_0x4afc('0x54')});})[_0x4afc('0x1d')](function(_0x3df333){return handleError(_0x122cbc,0x1f4,_0x3df333);});};passport[_0x4afc('0x55')](new LocalStrategy({'usernameField':_0x4afc('0xd'),'passwordField':_0x4afc('0x50')},function(_0x5c1421,_0x2abf25,_0x549ee4){return localAuthenticate(db[_0x4afc('0x48')],_0x5c1421,_0x2abf25,_0x549ee4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0edcb96..fa8f3fc 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 _0x7985=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x7985,0x1a3));var _0x5798=function(_0x2e5405,_0x42ec09){_0x2e5405=_0x2e5405-0x0;var _0x2f0270=_0x7985[_0x2e5405];return _0x2f0270;};'use strict';var express=require(_0x5798('0x0'));var router=express[_0x5798('0x1')]();var controller=require(_0x5798('0x2'));router[_0x5798('0x3')]('/',controller[_0x5798('0x4')]);router[_0x5798('0x3')](_0x5798('0x5'),controller[_0x5798('0x6')]);router[_0x5798('0x3')](_0x5798('0x7'),controller[_0x5798('0x8')]);module[_0x5798('0x9')]=router; \ No newline at end of file +var _0x0e0d=['/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller','login','post'];(function(_0x1b591b,_0x6d2e2b){var _0x3c24f0=function(_0x265093){while(--_0x265093){_0x1b591b['push'](_0x1b591b['shift']());}};_0x3c24f0(++_0x6d2e2b);}(_0x0e0d,0xdc));var _0xd0e0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0e0d[_0x2641f9];return _0x585741;};'use strict';var express=require(_0xd0e0('0x0'));var router=express[_0xd0e0('0x1')]();var controller=require(_0xd0e0('0x2'));router['post']('/',controller[_0xd0e0('0x3')]);router[_0xd0e0('0x4')](_0xd0e0('0x5'),controller[_0xd0e0('0x6')]);router['post'](_0xd0e0('0x7'),controller[_0xd0e0('0x8')]);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 24f5755..e726102 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 _0x9be0=['sequelize','STRING','BOOLEAN'];(function(_0x214d54,_0x133c72){var _0x44ca46=function(_0xe42b02){while(--_0xe42b02){_0x214d54['push'](_0x214d54['shift']());}};_0x44ca46(++_0x133c72);}(_0x9be0,0xc3));var _0x09be=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9be0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x09be('0x0'));module['exports']={'name':{'type':Sequelize[_0x09be('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x09be('0x1')]},'status':{'type':Sequelize[_0x09be('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xdcc8=['INTEGER','sequelize','exports','STRING'];(function(_0x2bd9c7,_0x4b96cf){var _0x2328a8=function(_0x37c945){while(--_0x37c945){_0x2bd9c7['push'](_0x2bd9c7['shift']());}};_0x2328a8(++_0x4b96cf);}(_0xdcc8,0x1d9));var _0x8dcc=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xdcc8[_0xcf5436];return _0xc4f5c8;};'use strict';var Sequelize=require(_0x8dcc('0x0'));module[_0x8dcc('0x1')]={'name':{'type':Sequelize[_0x8dcc('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8dcc('0x2')]},'description':{'type':Sequelize[_0x8dcc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8dcc('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 7f694b7..c23e9fc 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(_0x2cbc30,_0x3235e6){var _0x22ff4b=function(_0x1401ca){while(--_0x1401ca){_0x2cbc30['push'](_0x2cbc30['shift']());}};_0x22ff4b(++_0x3235e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x40beba,_0x2917e2){var _0x3ababf=function(_0x29fbb7){while(--_0x29fbb7){_0x40beba['push'](_0x40beba['shift']());}};_0x3ababf(++_0x2917e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 3e550fc..65cac62 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 _0x35ff=['../../config/logger','moment','bluebird','path','../../config/environment','./automation.attributes','exports','define','tools_automations','util'];(function(_0x12f1fe,_0x87aef0){var _0x26fc9d=function(_0x573f0c){while(--_0x573f0c){_0x12f1fe['push'](_0x12f1fe['shift']());}};_0x26fc9d(++_0x87aef0);}(_0x35ff,0xb3));var _0xf35f=function(_0x2ca7a2,_0xf1a332){_0x2ca7a2=_0x2ca7a2-0x0;var _0x308bcf=_0x35ff[_0x2ca7a2];return _0x308bcf;};'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')]('Automation',attributes,{'tableName':_0xf35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3077=['lodash','../../config/logger','moment','request-promise','path','rimraf','define','Automation','tools_automations'];(function(_0x133407,_0x25d043){var _0x1d9232=function(_0x360dd8){while(--_0x360dd8){_0x133407['push'](_0x133407['shift']());}};_0x1d9232(++_0x25d043);}(_0x3077,0x144));var _0x7307=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3077[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x7307('0x0'));var util=require('util');var logger=require(_0x7307('0x1'))('api');var moment=require(_0x7307('0x2'));var BPromise=require('bluebird');var rp=require(_0x7307('0x3'));var fs=require('fs');var path=require(_0x7307('0x4'));var rimraf=require(_0x7307('0x5'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module['exports']=function(_0x483a8c,_0x502b12){return _0x483a8c[_0x7307('0x6')](_0x7307('0x7'),attributes,{'tableName':_0x7307('0x8'),'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 c2054c4..ce3e0c2 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 _0x5a3b=['client','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x452f70,_0x204445){var _0x44d233=function(_0x3be093){while(--_0x3be093){_0x452f70['push'](_0x452f70['shift']());}};_0x44d233(++_0x204445);}(_0x5a3b,0x14b));var _0xb5a3=function(_0x4540dc,_0x5c7be9){_0x4540dc=_0x4540dc-0x0;var _0x4ac018=_0x5a3b[_0x4540dc];return _0x4ac018;};'use strict';var _=require(_0xb5a3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb5a3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5a3('0x2'));var db=require(_0xb5a3('0x3'))['db'];var utils=require(_0xb5a3('0x4'));var logger=require(_0xb5a3('0x5'))(_0xb5a3('0x6'));var config=require(_0xb5a3('0x7'));var jayson=require(_0xb5a3('0x8'));var client=jayson[_0xb5a3('0x9')][_0xb5a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b563,_0x3572db,_0x5b2ab1){return new BPromise(function(_0xb6f0f0,_0x296401){return client[_0xb5a3('0xb')](_0x36b563,_0x5b2ab1)[_0xb5a3('0xc')](function(_0x2f93e5){logger[_0xb5a3('0xd')](_0xb5a3('0xe'),_0x3572db,'request\x20sent');logger['debug'](_0xb5a3('0xf'),_0x3572db,_0xb5a3('0x10'),JSON['stringify'](_0x2f93e5));if(_0x2f93e5['error']){if(_0x2f93e5['error'][_0xb5a3('0x11')]===0x1f4){logger['error'](_0xb5a3('0xe'),_0x3572db,_0x2f93e5['error']['message']);return _0x296401(_0x2f93e5[_0xb5a3('0x12')][_0xb5a3('0x13')]);}logger[_0xb5a3('0x12')](_0xb5a3('0xe'),_0x3572db,_0x2f93e5[_0xb5a3('0x12')][_0xb5a3('0x13')]);return _0xb6f0f0(_0x2f93e5[_0xb5a3('0x12')][_0xb5a3('0x13')]);}else{logger[_0xb5a3('0xd')]('Automation,\x20%s,\x20%s',_0x3572db,_0xb5a3('0x10'));_0xb6f0f0(_0x2f93e5['result'][_0xb5a3('0x13')]);}})['catch'](function(_0x3ce9f8){logger['error'](_0xb5a3('0xe'),_0x3572db,_0x3ce9f8);_0x296401(_0x3ce9f8);});});} \ No newline at end of file +var _0x16e8=['message','catch','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5232c4,_0x27a478){var _0x408bc9=function(_0x321f2d){while(--_0x321f2d){_0x5232c4['push'](_0x5232c4['shift']());}};_0x408bc9(++_0x27a478);}(_0x16e8,0x1ab));var _0x816e=function(_0x242278,_0x140d7f){_0x242278=_0x242278-0x0;var _0x557d3a=_0x16e8[_0x242278];return _0x557d3a;};'use strict';var _=require(_0x816e('0x0'));var util=require('util');var moment=require(_0x816e('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(_0x816e('0x2'));var logger=require(_0x816e('0x3'))(_0x816e('0x4'));var config=require(_0x816e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x816e('0x6')][_0x816e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c8165,_0x50e42f,_0x41c0dd){return new BPromise(function(_0x434d43,_0x120093){return client[_0x816e('0x8')](_0x5c8165,_0x41c0dd)['then'](function(_0x29bd05){logger[_0x816e('0x9')](_0x816e('0xa'),_0x50e42f,_0x816e('0xb'));logger['debug'](_0x816e('0xc'),_0x50e42f,_0x816e('0xb'),JSON['stringify'](_0x29bd05));if(_0x29bd05[_0x816e('0xd')]){if(_0x29bd05[_0x816e('0xd')][_0x816e('0xe')]===0x1f4){logger[_0x816e('0xd')](_0x816e('0xa'),_0x50e42f,_0x29bd05['error'][_0x816e('0xf')]);return _0x120093(_0x29bd05[_0x816e('0xd')][_0x816e('0xf')]);}logger[_0x816e('0xd')](_0x816e('0xa'),_0x50e42f,_0x29bd05[_0x816e('0xd')][_0x816e('0xf')]);return _0x434d43(_0x29bd05[_0x816e('0xd')][_0x816e('0xf')]);}else{logger[_0x816e('0x9')]('Automation,\x20%s,\x20%s',_0x50e42f,'request\x20sent');_0x434d43(_0x29bd05['result']['message']);}})[_0x816e('0x10')](function(_0x5a38ea){logger['error']('Automation,\x20%s,\x20%s',_0x50e42f,_0x5a38ea);_0x120093(_0x5a38ea);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 15ef6d5..7d3df8c 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 _0x5e0e=['getActions','post','create','addConditions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x5e0e,0x1c3));var _0xe5e0=function(_0x89c40f,_0xd92eb2){_0x89c40f=_0x89c40f-0x0;var _0x17acbb=_0x5e0e[_0x89c40f];return _0x17acbb;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require(_0xe5e0('0x2'));var timeout=require(_0xe5e0('0x3'));var express=require(_0xe5e0('0x4'));var router=express[_0xe5e0('0x5')]();var auth=require(_0xe5e0('0x6'));var interaction=require(_0xe5e0('0x7'));var config=require(_0xe5e0('0x8'));var controller=require(_0xe5e0('0x9'));router[_0xe5e0('0xa')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xc')]);router['get'](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xa')](_0xe5e0('0xf'),auth[_0xe5e0('0xb')](),controller['getConditions']);router['get'](_0xe5e0('0x10'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x11')]);router[_0xe5e0('0x12')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x13')]);router[_0xe5e0('0x12')](_0xe5e0('0xf'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x12')](_0xe5e0('0x10'),auth['isAuthenticated'](),controller['addActions']);router[_0xe5e0('0x15')]('/:id',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x16')]);router[_0xe5e0('0x17')](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x18')]);module[_0xe5e0('0x19')]=router; \ No newline at end of file +var _0x6b74=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x40967b,_0x192c3b){var _0xea18da=function(_0x387f4f){while(--_0x387f4f){_0x40967b['push'](_0x40967b['shift']());}};_0xea18da(++_0x192c3b);}(_0x6b74,0xcc));var _0x46b7=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x6b74[_0x144b30];return _0x1bb7bc;};'use strict';var multer=require(_0x46b7('0x0'));var util=require(_0x46b7('0x1'));var path=require('path');var timeout=require(_0x46b7('0x2'));var express=require(_0x46b7('0x3'));var router=express['Router']();var auth=require(_0x46b7('0x4'));var interaction=require(_0x46b7('0x5'));var config=require(_0x46b7('0x6'));var controller=require('./automation.controller');router['get']('/',auth[_0x46b7('0x7')](),controller[_0x46b7('0x8')]);router['get'](_0x46b7('0x9'),auth[_0x46b7('0x7')](),controller['show']);router[_0x46b7('0xa')](_0x46b7('0xb'),auth[_0x46b7('0x7')](),controller[_0x46b7('0xc')]);router['get'](_0x46b7('0xd'),auth[_0x46b7('0x7')](),controller[_0x46b7('0xe')]);router[_0x46b7('0xf')]('/',auth[_0x46b7('0x7')](),controller[_0x46b7('0x10')]);router[_0x46b7('0xf')](_0x46b7('0xb'),auth[_0x46b7('0x7')](),controller[_0x46b7('0x11')]);router['post'](_0x46b7('0xd'),auth[_0x46b7('0x7')](),controller[_0x46b7('0x12')]);router[_0x46b7('0x13')](_0x46b7('0x9'),auth['isAuthenticated'](),controller[_0x46b7('0x14')]);router['delete'](_0x46b7('0x9'),auth[_0x46b7('0x7')](),controller[_0x46b7('0x15')]);module[_0x46b7('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c7a7021..7ce1957 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 _0xe476=['ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ivr','STRING','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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,*,*,*'];(function(_0x5db3b4,_0x54c36c){var _0x28ec4f=function(_0x3aafd4){while(--_0x3aafd4){_0x5db3b4['push'](_0x5db3b4['shift']());}};_0x28ec4f(++_0x54c36c);}(_0xe476,0x193));var _0x6e47=function(_0x598bf4,_0x18b713){_0x598bf4=_0x598bf4-0x0;var _0x2f8020=_0xe476[_0x598bf4];return _0x2f8020;};'use strict';var Sequelize=require(_0x6e47('0x0'));module[_0x6e47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e47('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x6e47('0x3')),'allowNull':![],'defaultValue':_0x6e47('0x3')},'description':{'type':Sequelize[_0x6e47('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x6e47('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6e47('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6e47('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6e47('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x6e47('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x6e47('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6e47('0x4')],'defaultValue':_0x6e47('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x6e47('0xf')](_0x6e47('0x10'),_0x6e47('0x11'),'onlyIfOpen'),'defaultValue':_0x6e47('0x10')},'dialAMDActive':{'type':Sequelize[_0x6e47('0x12')],'defaultValue':0x0,'comment':_0x6e47('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6e47('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x6e47('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6e47('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6e47('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e47('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6e47('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6e47('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6e47('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6e47('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6e47('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6e47('0x5')](0x9)[_0x6e47('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e47('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6e47('0xf')](_0x6e47('0x1d'),'ASC'),'defaultValue':_0x6e47('0x1d')},'dialPrefix':{'type':Sequelize[_0x6e47('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e47('0x1e')},'dialCutDigit':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e47('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6e47('0x5')](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)[_0x6e47('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6e47('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e47('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e47('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e47('0x25')}}; \ No newline at end of file +var _0x608c=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC'];(function(_0x347dbe,_0x4d8899){var _0x29c81e=function(_0x168e05){while(--_0x168e05){_0x347dbe['push'](_0x347dbe['shift']());}};_0x29c81e(++_0x4d8899);}(_0x608c,0x185));var _0xc608=function(_0x53d55c,_0x2e3d2b){_0x53d55c=_0x53d55c-0x0;var _0x35b1ed=_0x608c[_0x53d55c];return _0x35b1ed;};'use strict';var Sequelize=require(_0xc608('0x0'));module[_0xc608('0x1')]={'name':{'type':Sequelize[_0xc608('0x2')],'unique':_0xc608('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc608('0x4')](_0xc608('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xc608('0x2')]},'active':{'type':Sequelize[_0xc608('0x6')],'defaultValue':0x0,'comment':_0xc608('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xc608('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc608('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc608('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc608('0xa')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc608('0x8')],'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[_0xc608('0x2')],'defaultValue':_0xc608('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc608('0x4')](_0xc608('0xf'),_0xc608('0x10'),_0xc608('0x11')),'defaultValue':_0xc608('0xf')},'dialAMDActive':{'type':Sequelize[_0xc608('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc608('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc608('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc608('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc608('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc608('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc608('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc608('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc608('0xa')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc608('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc608('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc608('0xa')](0x9)[_0xc608('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc608('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc608('0x1b'),_0xc608('0x1c')),'defaultValue':_0xc608('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc608('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc608('0x1d')},'dialCutDigit':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc608('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc608('0xa')](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc608('0xa')](0x3)[_0xc608('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc608('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc608('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc608('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6930991..76002c1 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x27828c,_0x150789){var _0x23786e=function(_0x299862){while(--_0x299862){_0x27828c['push'](_0x27828c['shift']());}};_0x23786e(++_0x150789);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x2271e7,_0x6f9edb){var _0xe67a83=function(_0x367b2e){while(--_0x367b2e){_0x2271e7['push'](_0x2271e7['shift']());}};_0xe67a83(++_0x6f9edb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index c069a1e..3754d93 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 _0xd651=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','campaigns'];(function(_0x519628,_0x1f52f4){var _0x3e39c4=function(_0x19d881){while(--_0x19d881){_0x519628['push'](_0x519628['shift']());}};_0x3e39c4(++_0x1f52f4);}(_0xd651,0x82));var _0x1d65=function(_0x3883c8,_0x50ad6b){_0x3883c8=_0x3883c8-0x0;var _0x800e61=_0xd651[_0x3883c8];return _0x800e61;};'use strict';var _=require(_0x1d65('0x0'));var util=require(_0x1d65('0x1'));var logger=require(_0x1d65('0x2'))(_0x1d65('0x3'));var moment=require(_0x1d65('0x4'));var BPromise=require(_0x1d65('0x5'));var rp=require(_0x1d65('0x6'));var fs=require('fs');var path=require(_0x1d65('0x7'));var rimraf=require(_0x1d65('0x8'));var config=require(_0x1d65('0x9'));var attributes=require(_0x1d65('0xa'));module[_0x1d65('0xb')]=function(_0x5d9ac3,_0x42e51e){return _0x5d9ac3['define']('Campaign',attributes,{'tableName':_0x1d65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3175=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns'];(function(_0xd6dabc,_0x28d763){var _0x5eb6fa=function(_0x32d109){while(--_0x32d109){_0xd6dabc['push'](_0xd6dabc['shift']());}};_0x5eb6fa(++_0x28d763);}(_0x3175,0x18c));var _0x5317=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x3175[_0x15e6fe];return _0x34894d;};'use strict';var _=require(_0x5317('0x0'));var util=require(_0x5317('0x1'));var logger=require(_0x5317('0x2'))(_0x5317('0x3'));var moment=require('moment');var BPromise=require(_0x5317('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5317('0x5'));var config=require(_0x5317('0x6'));var attributes=require(_0x5317('0x7'));module[_0x5317('0x8')]=function(_0x104c63,_0x52c257){return _0x104c63[_0x5317('0x9')](_0x5317('0xa'),attributes,{'tableName':_0x5317('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a22ce80..29eac00 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x4a19ed,_0x352056){var _0x22c786=function(_0x153267){while(--_0x153267){_0x4a19ed['push'](_0x4a19ed['shift']());}};_0x22c786(++_0x352056);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x38ddb2,_0x1141e1){var _0x22ee32=function(_0x4f48d7){while(--_0x4f48d7){_0x38ddb2['push'](_0x38ddb2['shift']());}};_0x22ee32(++_0x1141e1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 306be33..fa8d27d 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 _0xd431=['create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x3b5e65,_0x1b1bf4){var _0x4d423b=function(_0x1a5a57){while(--_0x1a5a57){_0x3b5e65['push'](_0x3b5e65['shift']());}};_0x4d423b(++_0x1b1bf4);}(_0xd431,0x135));var _0x1d43=function(_0x578a78,_0xfdd763){_0x578a78=_0x578a78-0x0;var _0x5b517b=_0xd431[_0x578a78];return _0x5b517b;};'use strict';var multer=require(_0x1d43('0x0'));var util=require(_0x1d43('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d43('0x2'));var router=express[_0x1d43('0x3')]();var auth=require(_0x1d43('0x4'));var interaction=require(_0x1d43('0x5'));var config=require(_0x1d43('0x6'));var controller=require(_0x1d43('0x7'));router['get']('/',auth[_0x1d43('0x8')](),controller[_0x1d43('0x9')]);router[_0x1d43('0xa')](_0x1d43('0xb'),auth[_0x1d43('0x8')](),controller['show']);router[_0x1d43('0xa')]('/:id/hoppers',auth[_0x1d43('0x8')](),controller[_0x1d43('0xc')]);router[_0x1d43('0xa')](_0x1d43('0xd'),auth[_0x1d43('0x8')](),controller[_0x1d43('0xe')]);router[_0x1d43('0xa')](_0x1d43('0xf'),auth[_0x1d43('0x8')](),controller['getHopperFinals']);router[_0x1d43('0xa')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x1d43('0x10')]);router[_0x1d43('0xa')](_0x1d43('0x11'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x12')]);router[_0x1d43('0xa')](_0x1d43('0x13'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x14')]);router['post']('/',auth[_0x1d43('0x8')](),controller[_0x1d43('0x15')]);router[_0x1d43('0x16')](_0x1d43('0x17'),auth['isAuthenticated'](),controller[_0x1d43('0x18')]);router[_0x1d43('0x16')](_0x1d43('0x11'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x19')]);router[_0x1d43('0x16')](_0x1d43('0x13'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x1a')]);router[_0x1d43('0x1b')](_0x1d43('0xb'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x1c')]);router[_0x1d43('0x1d')](_0x1d43('0xb'),auth[_0x1d43('0x8')](),controller[_0x1d43('0x1e')]);router['delete'](_0x1d43('0x11'),auth[_0x1d43('0x8')](),controller['removeLists']);router[_0x1d43('0x1d')]('/:id/blacklists',auth[_0x1d43('0x8')](),controller[_0x1d43('0x1f')]);module[_0x1d43('0x20')]=router; \ No newline at end of file +var _0x07ea=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','getHoppers','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x151d4a,_0xbc53e7){var _0xce4d46=function(_0x2c444b){while(--_0x2c444b){_0x151d4a['push'](_0x151d4a['shift']());}};_0xce4d46(++_0xbc53e7);}(_0x07ea,0x177));var _0xa07e=function(_0x3d0dc2,_0x5b3ee4){_0x3d0dc2=_0x3d0dc2-0x0;var _0x2b9e29=_0x07ea[_0x3d0dc2];return _0x2b9e29;};'use strict';var multer=require(_0xa07e('0x0'));var util=require(_0xa07e('0x1'));var path=require(_0xa07e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa07e('0x3')]();var auth=require(_0xa07e('0x4'));var interaction=require(_0xa07e('0x5'));var config=require(_0xa07e('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0xa07e('0x7')](),controller[_0xa07e('0x8')]);router['get'](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller['show']);router['get']('/:id/hoppers',auth[_0xa07e('0x7')](),controller[_0xa07e('0xa')]);router[_0xa07e('0xb')](_0xa07e('0xc'),auth[_0xa07e('0x7')](),controller[_0xa07e('0xd')]);router[_0xa07e('0xb')](_0xa07e('0xe'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xa07e('0xb')](_0xa07e('0xf'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x10')]);router[_0xa07e('0xb')](_0xa07e('0x11'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x12')]);router[_0xa07e('0xb')](_0xa07e('0x13'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x14')]);router[_0xa07e('0x15')]('/',auth[_0xa07e('0x7')](),controller[_0xa07e('0x16')]);router[_0xa07e('0x15')]('/:id/clone',auth[_0xa07e('0x7')](),controller['clone']);router[_0xa07e('0x15')](_0xa07e('0x11'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x17')]);router[_0xa07e('0x15')](_0xa07e('0x13'),auth['isAuthenticated'](),controller[_0xa07e('0x18')]);router[_0xa07e('0x19')](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x1a')]);router['delete'](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x1b')]);router[_0xa07e('0x1c')](_0xa07e('0x11'),auth[_0xa07e('0x7')](),controller['removeLists']);router[_0xa07e('0x1c')]('/:id/blacklists',auth[_0xa07e('0x7')](),controller[_0xa07e('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 04c88ea..9996791 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 _0x397c=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0xcd9f1c,_0x4ecdce){var _0x1259fe=function(_0x383cff){while(--_0x383cff){_0xcd9f1c['push'](_0xcd9f1c['shift']());}};_0x1259fe(++_0x4ecdce);}(_0x397c,0x1c9));var _0xc397=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x397c[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0xc397('0x0'));module[_0xc397('0x1')]={'key':{'type':Sequelize[_0xc397('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xc397('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xc397('0x2')]},'name':{'type':Sequelize[_0xc397('0x4')],'get':function(){return this[_0xc397('0x5')](_0xc397('0x6'));}}}; \ No newline at end of file +var _0xf95e=['sequelize','exports','TEXT','STRING','VIRTUAL','key'];(function(_0x2c469a,_0x59bf69){var _0x5efb79=function(_0x1d0a87){while(--_0x1d0a87){_0x2c469a['push'](_0x2c469a['shift']());}};_0x5efb79(++_0x59bf69);}(_0xf95e,0x10e));var _0xef95=function(_0x2fa095,_0x5bed1a){_0x2fa095=_0x2fa095-0x0;var _0x34b3de=_0xf95e[_0x2fa095];return _0x34b3de;};'use strict';var Sequelize=require(_0xef95('0x0'));module[_0xef95('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xef95('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xef95('0x3')]},'name':{'type':Sequelize[_0xef95('0x4')],'get':function(){return this['getDataValue'](_0xef95('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f26adf9..2547f96 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x5700b8,_0x466567){var _0x4f3646=function(_0x2e60c1){while(--_0x2e60c1){_0x5700b8['push'](_0x5700b8['shift']());}};_0x4f3646(++_0x466567);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 4cdf429..5817642 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 _0x2567=['lodash','util','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0xdefacb,_0x511ca0){var _0x2ca364=function(_0x2aa0ed){while(--_0x2aa0ed){_0xdefacb['push'](_0xdefacb['shift']());}};_0x2ca364(++_0x511ca0);}(_0x2567,0x1c7));var _0x7256=function(_0x3825e6,_0xe169de){_0x3825e6=_0x3825e6-0x0;var _0xd75004=_0x2567[_0x3825e6];return _0xd75004;};'use strict';var _=require(_0x7256('0x0'));var util=require(_0x7256('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7256('0x2'));var BPromise=require(_0x7256('0x3'));var rp=require(_0x7256('0x4'));var fs=require('fs');var path=require(_0x7256('0x5'));var rimraf=require('rimraf');var config=require(_0x7256('0x6'));var attributes=require(_0x7256('0x7'));module[_0x7256('0x8')]=function(_0x321fc0,_0x2d195b){return _0x321fc0['define'](_0x7256('0x9'),attributes,{'tableName':_0x7256('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7256('0xb'),'collate':_0x7256('0xc')});}; \ No newline at end of file +var _0x67ae=['path','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ae,0xbe));var _0xe67a=function(_0x1df107,_0x46509d){_0x1df107=_0x1df107-0x0;var _0x1cebc2=_0x67ae[_0x1df107];return _0x1cebc2;};'use strict';var _=require('lodash');var util=require(_0xe67a('0x0'));var logger=require(_0xe67a('0x1'))(_0xe67a('0x2'));var moment=require(_0xe67a('0x3'));var BPromise=require(_0xe67a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe67a('0x5'));var rimraf=require('rimraf');var config=require(_0xe67a('0x6'));var attributes=require(_0xe67a('0x7'));module[_0xe67a('0x8')]=function(_0x34d397,_0x4554c6){return _0x34d397[_0xe67a('0x9')]('CannedAnswer',attributes,{'tableName':_0xe67a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe67a('0xb'),'collate':_0xe67a('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 96ec445..8907312 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 _0x1028=['http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d6478,_0x12f001){var _0x5db1ec=function(_0x1f2dd3){while(--_0x1f2dd3){_0x3d6478['push'](_0x3d6478['shift']());}};_0x5db1ec(++_0x12f001);}(_0x1028,0x155));var _0x8102=function(_0x19fa95,_0x1cca0a){_0x19fa95=_0x19fa95-0x0;var _0x58a835=_0x1028[_0x19fa95];return _0x58a835;};'use strict';var _=require(_0x8102('0x0'));var util=require(_0x8102('0x1'));var moment=require(_0x8102('0x2'));var BPromise=require('bluebird');var rs=require(_0x8102('0x3'));var fs=require('fs');var Redis=require(_0x8102('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8102('0x5'));var logger=require(_0x8102('0x6'))(_0x8102('0x7'));var config=require(_0x8102('0x8'));var jayson=require(_0x8102('0x9'));var client=jayson[_0x8102('0xa')][_0x8102('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4105a1,_0x41c2af,_0x4a4a99){return new BPromise(function(_0x272b30,_0xc2b37){return client[_0x8102('0xc')](_0x4105a1,_0x4a4a99)['then'](function(_0xc7c933){logger[_0x8102('0xd')](_0x8102('0xe'),_0x41c2af,_0x8102('0xf'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x41c2af,_0x8102('0xf'),JSON[_0x8102('0x10')](_0xc7c933));if(_0xc7c933[_0x8102('0x11')]){if(_0xc7c933['error'][_0x8102('0x12')]===0x1f4){logger[_0x8102('0x11')](_0x8102('0xe'),_0x41c2af,_0xc7c933[_0x8102('0x11')]['message']);return _0xc2b37(_0xc7c933['error'][_0x8102('0x13')]);}logger[_0x8102('0x11')](_0x8102('0xe'),_0x41c2af,_0xc7c933[_0x8102('0x11')][_0x8102('0x13')]);return _0x272b30(_0xc7c933[_0x8102('0x11')][_0x8102('0x13')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x41c2af,_0x8102('0xf'));_0x272b30(_0xc7c933[_0x8102('0x14')][_0x8102('0x13')]);}})[_0x8102('0x15')](function(_0x8e809d){logger['error'](_0x8102('0xe'),_0x41c2af,_0x8e809d);_0xc2b37(_0x8e809d);});});} \ No newline at end of file +var _0xc4bd=['info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4bd,0x15a));var _0xdc4b=function(_0xf0e4e4,_0x1b8e97){_0xf0e4e4=_0xf0e4e4-0x0;var _0x283a0d=_0xc4bd[_0xf0e4e4];return _0x283a0d;};'use strict';var _=require(_0xdc4b('0x0'));var util=require(_0xdc4b('0x1'));var moment=require(_0xdc4b('0x2'));var BPromise=require(_0xdc4b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc4b('0x4'));var db=require(_0xdc4b('0x5'))['db'];var utils=require(_0xdc4b('0x6'));var logger=require(_0xdc4b('0x7'))(_0xdc4b('0x8'));var config=require(_0xdc4b('0x9'));var jayson=require(_0xdc4b('0xa'));var client=jayson[_0xdc4b('0xb')][_0xdc4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31a749,_0x173dde,_0x15bff2){return new BPromise(function(_0x4e6da2,_0x488096){return client[_0xdc4b('0xd')](_0x31a749,_0x15bff2)['then'](function(_0x31f3a2){logger[_0xdc4b('0xe')](_0xdc4b('0xf'),_0x173dde,'request\x20sent');logger[_0xdc4b('0x10')](_0xdc4b('0x11'),_0x173dde,_0xdc4b('0x12'),JSON[_0xdc4b('0x13')](_0x31f3a2));if(_0x31f3a2[_0xdc4b('0x14')]){if(_0x31f3a2[_0xdc4b('0x14')]['code']===0x1f4){logger[_0xdc4b('0x14')](_0xdc4b('0xf'),_0x173dde,_0x31f3a2[_0xdc4b('0x14')]['message']);return _0x488096(_0x31f3a2[_0xdc4b('0x14')][_0xdc4b('0x15')]);}logger[_0xdc4b('0x14')](_0xdc4b('0xf'),_0x173dde,_0x31f3a2['error'][_0xdc4b('0x15')]);return _0x4e6da2(_0x31f3a2[_0xdc4b('0x14')]['message']);}else{logger[_0xdc4b('0xe')](_0xdc4b('0xf'),_0x173dde,'request\x20sent');_0x4e6da2(_0x31f3a2[_0xdc4b('0x16')][_0xdc4b('0x15')]);}})[_0xdc4b('0x17')](function(_0x3a66d4){logger[_0xdc4b('0x14')](_0xdc4b('0xf'),_0x173dde,_0x3a66d4);_0x488096(_0x3a66d4);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index b13db1d..6a09efe 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 _0x3757=['get','isAuthenticated','index','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xee674,_0x48c45c){var _0x870bd4=function(_0x7acbb5){while(--_0x7acbb5){_0xee674['push'](_0xee674['shift']());}};_0x870bd4(++_0x48c45c);}(_0x3757,0xf8));var _0x7375=function(_0x4bb416,_0x5af42f){_0x4bb416=_0x4bb416-0x0;var _0x1663d5=_0x3757[_0x4bb416];return _0x1663d5;};'use strict';var multer=require('multer');var util=require(_0x7375('0x0'));var path=require(_0x7375('0x1'));var timeout=require(_0x7375('0x2'));var express=require(_0x7375('0x3'));var router=express[_0x7375('0x4')]();var auth=require(_0x7375('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7375('0x6'));var controller=require('./cannedAnswer.controller');router[_0x7375('0x7')]('/',auth[_0x7375('0x8')](),controller[_0x7375('0x9')]);router[_0x7375('0x7')]('/:id',auth[_0x7375('0x8')](),controller['show']);router['post']('/',auth[_0x7375('0x8')](),controller[_0x7375('0xa')]);router[_0x7375('0xb')]('/:id',auth[_0x7375('0x8')](),controller[_0x7375('0xc')]);router['delete']('/:id',auth[_0x7375('0x8')](),controller[_0x7375('0xd')]);module[_0x7375('0xe')]=router; \ No newline at end of file +var _0x93a0=['destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x7712a,_0x554787){var _0x4d815a=function(_0x2d8844){while(--_0x2d8844){_0x7712a['push'](_0x7712a['shift']());}};_0x4d815a(++_0x554787);}(_0x93a0,0x1f2));var _0x093a=function(_0x4e43ab,_0x148206){_0x4e43ab=_0x4e43ab-0x0;var _0x8a4a51=_0x93a0[_0x4e43ab];return _0x8a4a51;};'use strict';var multer=require(_0x093a('0x0'));var util=require(_0x093a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x093a('0x2'));var router=express['Router']();var auth=require(_0x093a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x093a('0x4'));var controller=require('./cannedAnswer.controller');router[_0x093a('0x5')]('/',auth[_0x093a('0x6')](),controller[_0x093a('0x7')]);router[_0x093a('0x5')]('/:id',auth[_0x093a('0x6')](),controller[_0x093a('0x8')]);router[_0x093a('0x9')]('/',auth[_0x093a('0x6')](),controller[_0x093a('0xa')]);router[_0x093a('0xb')](_0x093a('0xc'),auth['isAuthenticated'](),controller[_0x093a('0xd')]);router['delete'](_0x093a('0xc'),auth[_0x093a('0x6')](),controller[_0x093a('0xe')]);module[_0x093a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index db1d951..f8da6af 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 _0x5f35=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x5f35,0x199));var _0x55f3=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x5f35[_0x45346d];return _0x5ce7ca;};'use strict';var Sequelize=require(_0x55f3('0x0'));module[_0x55f3('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x55f3('0x2')},'clid':{'type':Sequelize[_0x55f3('0x3')]},'src':{'type':Sequelize[_0x55f3('0x3')]},'dst':{'type':Sequelize[_0x55f3('0x3')]},'dcontext':{'type':Sequelize[_0x55f3('0x3')]},'channel':{'type':Sequelize[_0x55f3('0x3')]},'dstchannel':{'type':Sequelize[_0x55f3('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x55f3('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x55f3('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x55f3('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x55f3('0x3')]},'uniqueid':{'type':Sequelize[_0x55f3('0x3')]},'linkedid':{'type':Sequelize[_0x55f3('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x55f3('0x3')]},'type':{'type':Sequelize[_0x55f3('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a05=['INTEGER','exports','DATE','STRING'];(function(_0xbc835a,_0x4f2231){var _0xc708b6=function(_0x5ac732){while(--_0x5ac732){_0xbc835a['push'](_0xbc835a['shift']());}};_0xc708b6(++_0x4f2231);}(_0x0a05,0x125));var _0x50a0=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0x0a05[_0x219cc1];return _0x177034;};'use strict';var Sequelize=require('sequelize');module[_0x50a0('0x0')]={'calldate':{'type':Sequelize[_0x50a0('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x50a0('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x50a0('0x2')]},'dcontext':{'type':Sequelize[_0x50a0('0x2')]},'channel':{'type':Sequelize[_0x50a0('0x2')]},'dstchannel':{'type':Sequelize[_0x50a0('0x2')]},'lastapp':{'type':Sequelize[_0x50a0('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x50a0('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x50a0('0x2')]},'amaflags':{'type':Sequelize[_0x50a0('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x50a0('0x2')]},'uniqueid':{'type':Sequelize[_0x50a0('0x2')]},'linkedid':{'type':Sequelize[_0x50a0('0x2')]},'sequence':{'type':Sequelize[_0x50a0('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x50a0('0x2')]},'tag':{'type':Sequelize[_0x50a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8049df1..70970d8 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 _0x262d=['sort','pick','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x2bba73,_0x82bb5d){var _0x19870b=function(_0x404d5f){while(--_0x404d5f){_0x2bba73['push'](_0x2bba73['shift']());}};_0x19870b(++_0x82bb5d);}(_0x262d,0x64));var _0xd262=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x262d[_0x138f59];return _0x3d114d;};'use strict';var pdf=require(_0xd262('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd262('0x1'));var zipdir=require(_0xd262('0x2'));var jsonpatch=require(_0xd262('0x3'));var rp=require(_0xd262('0x4'));var moment=require(_0xd262('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd262('0x6'));var sox=require(_0xd262('0x7'));var csv=require(_0xd262('0x8'));var ejs=require(_0xd262('0x9'));var fs=require('fs');var _=require(_0xd262('0xa'));var squel=require(_0xd262('0xb'));var crypto=require(_0xd262('0xc'));var jsforce=require(_0xd262('0xd'));var deskjs=require(_0xd262('0xe'));var toCsv=require(_0xd262('0x8'));var querystring=require(_0xd262('0xf'));var Papa=require(_0xd262('0x10'));var Redis=require(_0xd262('0x11'));var authService=require(_0xd262('0x12'));var qs=require(_0xd262('0x13'));var as=require(_0xd262('0x14'));var hardwareService=require(_0xd262('0x15'));var logger=require(_0xd262('0x16'))(_0xd262('0x17'));var utils=require(_0xd262('0x18'));var config=require(_0xd262('0x19'));var licenseUtil=require(_0xd262('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e2c38,_0x508217){_0x508217=_0x508217||0xcc;return function(_0x59c4f8){if(_0x59c4f8){return _0x2e2c38[_0xd262('0x1b')](_0x508217);}return _0x2e2c38['status'](_0x508217)['end']();};}function respondWithResult(_0x1d8bbb,_0x263de6){_0x263de6=_0x263de6||0xc8;return function(_0x39834e){if(_0x39834e){return _0x1d8bbb[_0xd262('0x1c')](_0x263de6)[_0xd262('0x1d')](_0x39834e);}};}function respondWithFilteredResult(_0x5c7c8a,_0x5bb1bb){return function(_0xa38e62){if(_0xa38e62){var _0x3fadd7=_0xa38e62[_0xd262('0x1e')],_0x3c0eac=_0x5bb1bb[_0xd262('0x1f')],_0x355906=_0x5bb1bb[_0xd262('0x1f')]+_0x5bb1bb[_0xd262('0x20')],_0x586ad8;if(_0x355906>=_0x3fadd7){_0x355906=_0x3fadd7;_0x586ad8=0xc8;}else{_0x586ad8=0xce;}_0x5c7c8a[_0xd262('0x1c')](_0x586ad8);return _0x5c7c8a[_0xd262('0x21')](_0xd262('0x22'),_0x3c0eac+'-'+_0x355906+'/'+_0x3fadd7)['json'](_0xa38e62);}return null;};}function patchUpdates(_0x45c08f){return function(_0x5de32b){try{jsonpatch[_0xd262('0x23')](_0x5de32b,_0x45c08f,!![]);}catch(_0x572b0f){return BPromise[_0xd262('0x24')](_0x572b0f);}return _0x5de32b[_0xd262('0x25')]();};}function saveUpdates(_0x308465,_0x1f28a8){return function(_0x3edc1b){if(_0x3edc1b){return _0x3edc1b['update'](_0x308465)[_0xd262('0x26')](function(_0x3e5946){return _0x3e5946;});}return null;};}function removeEntity(_0x3d32e0,_0xd2eebb){return function(_0x10f239){if(_0x10f239){return _0x10f239[_0xd262('0x27')]()['then'](function(){_0x3d32e0[_0xd262('0x1c')](0xcc)[_0xd262('0x28')]();});}};}function handleEntityNotFound(_0x4bcd27,_0x306695){return function(_0x16593d){if(!_0x16593d){_0x4bcd27[_0xd262('0x1b')](0x194);}return _0x16593d;};}function handleError(_0x38d69b,_0x4915c6){_0x4915c6=_0x4915c6||0x1f4;return function(_0x2365e1){logger[_0xd262('0x29')](_0x2365e1[_0xd262('0x2a')]);if(_0x2365e1[_0xd262('0x2b')]){delete _0x2365e1[_0xd262('0x2b')];}_0x38d69b[_0xd262('0x1c')](_0x4915c6)[_0xd262('0x2c')](_0x2365e1);};}exports[_0xd262('0x2d')]=function(_0x21e00c,_0x3b0b38){var _0x48106d={},_0x229b49={},_0xecb504={'count':0x0,'rows':[]};var _0x18a857=_[_0xd262('0x2e')](db[_0xd262('0x2f')][_0xd262('0x30')],function(_0x2f0206){return{'name':_0x2f0206[_0xd262('0x31')],'type':_0x2f0206['type'][_0xd262('0x32')]};});_0x229b49[_0xd262('0x33')]=_[_0xd262('0x2e')](_0x18a857,_0xd262('0x2b'));_0x229b49['query']=_[_0xd262('0x34')](_0x21e00c[_0xd262('0x35')]);_0x229b49['filters']=_[_0xd262('0x36')](_0x229b49[_0xd262('0x33')],_0x229b49['query']);_0x48106d[_0xd262('0x37')]=_[_0xd262('0x36')](_0x229b49[_0xd262('0x33')],qs[_0xd262('0x38')](_0x21e00c['query'][_0xd262('0x38')]));_0x48106d[_0xd262('0x37')]=_0x48106d['attributes'][_0xd262('0x39')]?_0x48106d[_0xd262('0x37')]:_0x229b49[_0xd262('0x33')];if(!_0x21e00c[_0xd262('0x35')][_0xd262('0x3a')]('nolimit')){_0x48106d[_0xd262('0x20')]=qs[_0xd262('0x20')](_0x21e00c[_0xd262('0x35')][_0xd262('0x20')]);_0x48106d[_0xd262('0x1f')]=qs['offset'](_0x21e00c[_0xd262('0x35')]['offset']);}_0x48106d[_0xd262('0x3b')]=qs[_0xd262('0x3c')](_0x21e00c[_0xd262('0x35')][_0xd262('0x3c')]);_0x48106d['where']=qs['filters'](_[_0xd262('0x3d')](_0x21e00c[_0xd262('0x35')],_0x229b49[_0xd262('0x3e')]),_0x18a857);if(_0x21e00c[_0xd262('0x35')][_0xd262('0x3f')]){_0x48106d[_0xd262('0x40')]=_['merge'](_0x48106d[_0xd262('0x40')],{'$or':_[_0xd262('0x2e')](_0x18a857,function(_0x6c9f9f){if(_0x6c9f9f[_0xd262('0x41')]!==_0xd262('0x42')){var _0x3613d0={};_0x3613d0[_0x6c9f9f[_0xd262('0x2b')]]={'$like':'%'+_0x21e00c['query'][_0xd262('0x3f')]+'%'};return _0x3613d0;}})});}_0x48106d=_[_0xd262('0x43')]({},_0x48106d,_0x21e00c[_0xd262('0x44')]);var _0x21c517={'where':_0x48106d[_0xd262('0x40')]};return db[_0xd262('0x2f')][_0xd262('0x1e')](_0x21c517)[_0xd262('0x26')](function(_0x2e3599){_0xecb504[_0xd262('0x1e')]=_0x2e3599;if(_0x21e00c[_0xd262('0x35')][_0xd262('0x45')]){_0x48106d[_0xd262('0x46')]=[{'all':!![]}];}return db[_0xd262('0x2f')][_0xd262('0x47')](_0x48106d);})[_0xd262('0x26')](function(_0x5dd927){_0xecb504['rows']=_0x5dd927;return _0xecb504;})[_0xd262('0x26')](respondWithFilteredResult(_0x3b0b38,_0x48106d))[_0xd262('0x48')](handleError(_0x3b0b38,null));};exports[_0xd262('0x49')]=function(_0x4f7fe5,_0x82c5a1){var _0x57789f={'raw':!![],'where':{'id':_0x4f7fe5[_0xd262('0x4a')]['id']}},_0x12f799={};_0x12f799['model']=_[_0xd262('0x34')](db[_0xd262('0x2f')]['rawAttributes']);_0x12f799[_0xd262('0x35')]=_[_0xd262('0x34')](_0x4f7fe5['query']);_0x12f799[_0xd262('0x3e')]=_[_0xd262('0x36')](_0x12f799[_0xd262('0x33')],_0x12f799[_0xd262('0x35')]);_0x57789f[_0xd262('0x37')]=_['intersection'](_0x12f799['model'],qs['fields'](_0x4f7fe5[_0xd262('0x35')][_0xd262('0x38')]));_0x57789f[_0xd262('0x37')]=_0x57789f['attributes']['length']?_0x57789f[_0xd262('0x37')]:_0x12f799[_0xd262('0x33')];if(_0x4f7fe5[_0xd262('0x35')]['includeAll']){_0x57789f[_0xd262('0x46')]=[{'all':!![]}];}_0x57789f=_[_0xd262('0x43')]({},_0x57789f,_0x4f7fe5['options']);return db[_0xd262('0x2f')][_0xd262('0x4b')](_0x57789f)[_0xd262('0x26')](handleEntityNotFound(_0x82c5a1,null))[_0xd262('0x26')](respondWithResult(_0x82c5a1,null))[_0xd262('0x48')](handleError(_0x82c5a1,null));};exports[_0xd262('0x4c')]=function(_0x4ad908,_0x362e86){return db[_0xd262('0x2f')]['create'](_0x4ad908[_0xd262('0x4d')],{})[_0xd262('0x26')](respondWithResult(_0x362e86,0xc9))[_0xd262('0x48')](handleError(_0x362e86,null));};exports[_0xd262('0x4e')]=function(_0x24c458,_0x445be1){if(_0x24c458[_0xd262('0x4d')]['id']){delete _0x24c458['body']['id'];}return db[_0xd262('0x2f')][_0xd262('0x4b')]({'where':{'id':_0x24c458['params']['id']}})[_0xd262('0x26')](handleEntityNotFound(_0x445be1,null))[_0xd262('0x26')](saveUpdates(_0x24c458[_0xd262('0x4d')],null))[_0xd262('0x26')](respondWithResult(_0x445be1,null))[_0xd262('0x48')](handleError(_0x445be1,null));};exports[_0xd262('0x27')]=function(_0x581391,_0x1e9c4e){return db[_0xd262('0x2f')][_0xd262('0x4b')]({'where':{'id':_0x581391[_0xd262('0x4a')]['id']}})[_0xd262('0x26')](handleEntityNotFound(_0x1e9c4e,null))[_0xd262('0x26')](removeEntity(_0x1e9c4e,null))[_0xd262('0x48')](handleError(_0x1e9c4e,null));};exports[_0xd262('0x4f')]=function(_0x14ada8,_0x554ad6){return db[_0xd262('0x2f')][_0xd262('0x4f')]()['then'](respondWithResult(_0x554ad6,null))[_0xd262('0x48')](handleError(_0x554ad6,null));}; \ No newline at end of file +var _0x1bd1=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1372d6,_0x1d5b02){var _0x23e4fc=function(_0x483bd3){while(--_0x483bd3){_0x1372d6['push'](_0x1372d6['shift']());}};_0x23e4fc(++_0x1d5b02);}(_0x1bd1,0x149));var _0x11bd=function(_0xff6e4,_0x3d82fb){_0xff6e4=_0xff6e4-0x0;var _0x3ada16=_0x1bd1[_0xff6e4];return _0x3ada16;};'use strict';var pdf=require(_0x11bd('0x0'));var emlformat=require(_0x11bd('0x1'));var rimraf=require(_0x11bd('0x2'));var zipdir=require(_0x11bd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11bd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x11bd('0x5'));var util=require(_0x11bd('0x6'));var path=require(_0x11bd('0x7'));var sox=require(_0x11bd('0x8'));var csv=require(_0x11bd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11bd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x11bd('0xb'));var toCsv=require(_0x11bd('0x9'));var querystring=require(_0x11bd('0xc'));var Papa=require('papaparse');var Redis=require(_0x11bd('0xd'));var authService=require(_0x11bd('0xe'));var qs=require(_0x11bd('0xf'));var as=require(_0x11bd('0x10'));var hardwareService=require(_0x11bd('0x11'));var logger=require(_0x11bd('0x12'))(_0x11bd('0x13'));var utils=require('../../config/utils');var config=require(_0x11bd('0x14'));var licenseUtil=require(_0x11bd('0x15'));var db=require(_0x11bd('0x16'))['db'];function respondWithStatusCode(_0x2822ae,_0x1c2cae){_0x1c2cae=_0x1c2cae||0xcc;return function(_0x4675cb){if(_0x4675cb){return _0x2822ae[_0x11bd('0x17')](_0x1c2cae);}return _0x2822ae['status'](_0x1c2cae)[_0x11bd('0x18')]();};}function respondWithResult(_0x458c8a,_0x787ba1){_0x787ba1=_0x787ba1||0xc8;return function(_0x42a703){if(_0x42a703){return _0x458c8a[_0x11bd('0x19')](_0x787ba1)[_0x11bd('0x1a')](_0x42a703);}};}function respondWithFilteredResult(_0x48b342,_0x1e9483){return function(_0x229def){if(_0x229def){var _0x130fb6=_0x229def['count'],_0x330b9b=_0x1e9483[_0x11bd('0x1b')],_0xd0ed1e=_0x1e9483['offset']+_0x1e9483[_0x11bd('0x1c')],_0x4ace12;if(_0xd0ed1e>=_0x130fb6){_0xd0ed1e=_0x130fb6;_0x4ace12=0xc8;}else{_0x4ace12=0xce;}_0x48b342['status'](_0x4ace12);return _0x48b342[_0x11bd('0x1d')](_0x11bd('0x1e'),_0x330b9b+'-'+_0xd0ed1e+'/'+_0x130fb6)['json'](_0x229def);}return null;};}function patchUpdates(_0x28c0dc){return function(_0x3b9a63){try{jsonpatch['apply'](_0x3b9a63,_0x28c0dc,!![]);}catch(_0x250ac9){return BPromise[_0x11bd('0x1f')](_0x250ac9);}return _0x3b9a63[_0x11bd('0x20')]();};}function saveUpdates(_0x118d74,_0x4a822c){return function(_0x36fcec){if(_0x36fcec){return _0x36fcec['update'](_0x118d74)[_0x11bd('0x21')](function(_0x28a023){return _0x28a023;});}return null;};}function removeEntity(_0x4798aa,_0xff1a34){return function(_0x4719ad){if(_0x4719ad){return _0x4719ad[_0x11bd('0x22')]()[_0x11bd('0x21')](function(){_0x4798aa['status'](0xcc)[_0x11bd('0x18')]();});}};}function handleEntityNotFound(_0x5a62cd,_0x3a5778){return function(_0x30f916){if(!_0x30f916){_0x5a62cd['sendStatus'](0x194);}return _0x30f916;};}function handleError(_0x59244a,_0x34c39a){_0x34c39a=_0x34c39a||0x1f4;return function(_0x3fce90){logger[_0x11bd('0x23')](_0x3fce90[_0x11bd('0x24')]);if(_0x3fce90['name']){delete _0x3fce90[_0x11bd('0x25')];}_0x59244a['status'](_0x34c39a)[_0x11bd('0x26')](_0x3fce90);};}exports[_0x11bd('0x27')]=function(_0x9a1e96,_0x5ce880){var _0x427e30={},_0xc982d7={},_0x65b7d9={'count':0x0,'rows':[]};var _0x17ad5e=_[_0x11bd('0x28')](db[_0x11bd('0x29')]['rawAttributes'],function(_0x5a1371){return{'name':_0x5a1371[_0x11bd('0x2a')],'type':_0x5a1371[_0x11bd('0x2b')][_0x11bd('0x2c')]};});_0xc982d7[_0x11bd('0x2d')]=_[_0x11bd('0x28')](_0x17ad5e,_0x11bd('0x25'));_0xc982d7[_0x11bd('0x2e')]=_['keys'](_0x9a1e96[_0x11bd('0x2e')]);_0xc982d7[_0x11bd('0x2f')]=_[_0x11bd('0x30')](_0xc982d7['model'],_0xc982d7['query']);_0x427e30[_0x11bd('0x31')]=_[_0x11bd('0x30')](_0xc982d7[_0x11bd('0x2d')],qs[_0x11bd('0x32')](_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x32')]));_0x427e30[_0x11bd('0x31')]=_0x427e30[_0x11bd('0x31')]['length']?_0x427e30['attributes']:_0xc982d7[_0x11bd('0x2d')];if(!_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x33')]('nolimit')){_0x427e30['limit']=qs[_0x11bd('0x1c')](_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x1c')]);_0x427e30[_0x11bd('0x1b')]=qs['offset'](_0x9a1e96[_0x11bd('0x2e')]['offset']);}_0x427e30[_0x11bd('0x34')]=qs[_0x11bd('0x35')](_0x9a1e96[_0x11bd('0x2e')]['sort']);_0x427e30[_0x11bd('0x36')]=qs[_0x11bd('0x2f')](_[_0x11bd('0x37')](_0x9a1e96[_0x11bd('0x2e')],_0xc982d7['filters']),_0x17ad5e);if(_0x9a1e96[_0x11bd('0x2e')][_0x11bd('0x38')]){_0x427e30[_0x11bd('0x36')]=_['merge'](_0x427e30[_0x11bd('0x36')],{'$or':_[_0x11bd('0x28')](_0x17ad5e,function(_0x43db16){if(_0x43db16['type']!=='VIRTUAL'){var _0xcc2d6b={};_0xcc2d6b[_0x43db16[_0x11bd('0x25')]]={'$like':'%'+_0x9a1e96['query'][_0x11bd('0x38')]+'%'};return _0xcc2d6b;}})});}_0x427e30=_[_0x11bd('0x39')]({},_0x427e30,_0x9a1e96['options']);var _0x4b4bee={'where':_0x427e30[_0x11bd('0x36')]};return db[_0x11bd('0x29')]['count'](_0x4b4bee)['then'](function(_0x10ae33){_0x65b7d9['count']=_0x10ae33;if(_0x9a1e96['query'][_0x11bd('0x3a')]){_0x427e30[_0x11bd('0x3b')]=[{'all':!![]}];}return db[_0x11bd('0x29')][_0x11bd('0x3c')](_0x427e30);})['then'](function(_0x272d16){_0x65b7d9['rows']=_0x272d16;return _0x65b7d9;})[_0x11bd('0x21')](respondWithFilteredResult(_0x5ce880,_0x427e30))[_0x11bd('0x3d')](handleError(_0x5ce880,null));};exports[_0x11bd('0x3e')]=function(_0x4ff48e,_0x3b144d){var _0x4c2f8b={'raw':!![],'where':{'id':_0x4ff48e[_0x11bd('0x3f')]['id']}},_0x77e04f={};_0x77e04f[_0x11bd('0x2d')]=_['keys'](db[_0x11bd('0x29')][_0x11bd('0x40')]);_0x77e04f['query']=_['keys'](_0x4ff48e[_0x11bd('0x2e')]);_0x77e04f[_0x11bd('0x2f')]=_[_0x11bd('0x30')](_0x77e04f[_0x11bd('0x2d')],_0x77e04f[_0x11bd('0x2e')]);_0x4c2f8b['attributes']=_[_0x11bd('0x30')](_0x77e04f[_0x11bd('0x2d')],qs['fields'](_0x4ff48e['query'][_0x11bd('0x32')]));_0x4c2f8b[_0x11bd('0x31')]=_0x4c2f8b['attributes']['length']?_0x4c2f8b[_0x11bd('0x31')]:_0x77e04f['model'];if(_0x4ff48e['query']['includeAll']){_0x4c2f8b['include']=[{'all':!![]}];}_0x4c2f8b=_[_0x11bd('0x39')]({},_0x4c2f8b,_0x4ff48e['options']);return db[_0x11bd('0x29')]['find'](_0x4c2f8b)['then'](handleEntityNotFound(_0x3b144d,null))[_0x11bd('0x21')](respondWithResult(_0x3b144d,null))['catch'](handleError(_0x3b144d,null));};exports[_0x11bd('0x41')]=function(_0x24f23e,_0x5a223b){return db[_0x11bd('0x29')][_0x11bd('0x41')](_0x24f23e[_0x11bd('0x42')],{})[_0x11bd('0x21')](respondWithResult(_0x5a223b,0xc9))[_0x11bd('0x3d')](handleError(_0x5a223b,null));};exports['update']=function(_0x22bf7f,_0x4f208f){if(_0x22bf7f[_0x11bd('0x42')]['id']){delete _0x22bf7f[_0x11bd('0x42')]['id'];}return db[_0x11bd('0x29')][_0x11bd('0x43')]({'where':{'id':_0x22bf7f['params']['id']}})[_0x11bd('0x21')](handleEntityNotFound(_0x4f208f,null))['then'](saveUpdates(_0x22bf7f[_0x11bd('0x42')],null))[_0x11bd('0x21')](respondWithResult(_0x4f208f,null))[_0x11bd('0x3d')](handleError(_0x4f208f,null));};exports[_0x11bd('0x22')]=function(_0xecaf27,_0x34dce2){return db[_0x11bd('0x29')][_0x11bd('0x43')]({'where':{'id':_0xecaf27[_0x11bd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x34dce2,null))[_0x11bd('0x21')](removeEntity(_0x34dce2,null))[_0x11bd('0x3d')](handleError(_0x34dce2,null));};exports[_0x11bd('0x44')]=function(_0x3efd5c,_0x1a6198){return db[_0x11bd('0x29')][_0x11bd('0x44')]()[_0x11bd('0x21')](respondWithResult(_0x1a6198,null))[_0x11bd('0x3d')](handleError(_0x1a6198,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5043731..470ee09 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 _0xc1c6=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','Cdr'];(function(_0xca6cb2,_0x29d8bc){var _0x33d214=function(_0x26d57a){while(--_0x26d57a){_0xca6cb2['push'](_0xca6cb2['shift']());}};_0x33d214(++_0x29d8bc);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x38e886,_0x4cd19c){_0x38e886=_0x38e886-0x0;var _0x4422b0=_0xc1c6[_0x38e886];return _0x4422b0;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'calldate','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['disposition']},{'name':_0x6c1c('0xd'),'fields':[_0x6c1c('0xd')]},{'name':_0x6c1c('0xe'),'fields':[_0x6c1c('0xe')]},{'name':'uniqueid','fields':[_0x6c1c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4819=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','Cdr'];(function(_0x312e66,_0x53721b){var _0x42794a=function(_0x27a4b6){while(--_0x27a4b6){_0x312e66['push'](_0x312e66['shift']());}};_0x42794a(++_0x53721b);}(_0x4819,0xcd));var _0x9481=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x4819[_0x3bfdde];return _0x3f752a;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['calldate']},{'name':_0x9481('0xe'),'fields':['disposition']},{'name':_0x9481('0xf'),'fields':['dst']},{'name':_0x9481('0x10'),'fields':[_0x9481('0x10')]},{'name':_0x9481('0x11'),'fields':[_0x9481('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6818b02..9cbfab8 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 _0x7a7b=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x3f4265,_0xfd8046){var _0x5d4525=function(_0x1883e1){while(--_0x1883e1){_0x3f4265['push'](_0x3f4265['shift']());}};_0x5d4525(++_0xfd8046);}(_0x7a7b,0xd0));var _0xb7a7=function(_0x12f7d6,_0x4be9ad){_0x12f7d6=_0x12f7d6-0x0;var _0xcac6e5=_0x7a7b[_0x12f7d6];return _0xcac6e5;};'use strict';var _=require(_0xb7a7('0x0'));var util=require(_0xb7a7('0x1'));var moment=require(_0xb7a7('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7a7('0x4'))['db'];var utils=require(_0xb7a7('0x5'));var logger=require(_0xb7a7('0x6'))(_0xb7a7('0x7'));var config=require(_0xb7a7('0x8'));var jayson=require(_0xb7a7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12d364,_0x20993e,_0xcae982){return new BPromise(function(_0x5a1ae1,_0xc64973){return client[_0xb7a7('0xa')](_0x12d364,_0xcae982)[_0xb7a7('0xb')](function(_0x3ba3d7){logger['info']('Cdr,\x20%s,\x20%s',_0x20993e,'request\x20sent');logger[_0xb7a7('0xc')](_0xb7a7('0xd'),_0x20993e,_0xb7a7('0xe'),JSON['stringify'](_0x3ba3d7));if(_0x3ba3d7[_0xb7a7('0xf')]){if(_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x10')]===0x1f4){logger[_0xb7a7('0xf')]('Cdr,\x20%s,\x20%s',_0x20993e,_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x11')]);return _0xc64973(_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x11')]);}logger[_0xb7a7('0xf')](_0xb7a7('0x12'),_0x20993e,_0x3ba3d7[_0xb7a7('0xf')]['message']);return _0x5a1ae1(_0x3ba3d7[_0xb7a7('0xf')][_0xb7a7('0x11')]);}else{logger['info'](_0xb7a7('0x12'),_0x20993e,_0xb7a7('0xe'));_0x5a1ae1(_0x3ba3d7[_0xb7a7('0x13')][_0xb7a7('0x11')]);}})[_0xb7a7('0x14')](function(_0x25a9fb){logger['error']('Cdr,\x20%s,\x20%s',_0x20993e,_0x25a9fb);_0xc64973(_0x25a9fb);});});} \ No newline at end of file +var _0x24f4=['bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x24f4,0x1f2));var _0x424f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x424f('0x0'));var moment=require(_0x424f('0x1'));var BPromise=require(_0x424f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x424f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x424f('0x4'));var config=require(_0x424f('0x5'));var jayson=require(_0x424f('0x6'));var client=jayson[_0x424f('0x7')][_0x424f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x769cea,_0x56d92f,_0x54fca1){return new BPromise(function(_0x34ff64,_0xf32758){return client[_0x424f('0x9')](_0x769cea,_0x54fca1)[_0x424f('0xa')](function(_0x5dc693){logger[_0x424f('0xb')](_0x424f('0xc'),_0x56d92f,_0x424f('0xd'));logger[_0x424f('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x56d92f,'request\x20sent',JSON[_0x424f('0xf')](_0x5dc693));if(_0x5dc693['error']){if(_0x5dc693[_0x424f('0x10')][_0x424f('0x11')]===0x1f4){logger[_0x424f('0x10')](_0x424f('0xc'),_0x56d92f,_0x5dc693[_0x424f('0x10')]['message']);return _0xf32758(_0x5dc693[_0x424f('0x10')][_0x424f('0x12')]);}logger[_0x424f('0x10')]('Cdr,\x20%s,\x20%s',_0x56d92f,_0x5dc693[_0x424f('0x10')]['message']);return _0x34ff64(_0x5dc693[_0x424f('0x10')][_0x424f('0x12')]);}else{logger[_0x424f('0xb')]('Cdr,\x20%s,\x20%s',_0x56d92f,'request\x20sent');_0x34ff64(_0x5dc693['result'][_0x424f('0x12')]);}})[_0x424f('0x13')](function(_0x5b75da){logger[_0x424f('0x10')](_0x424f('0xc'),_0x56d92f,_0x5b75da);_0xf32758(_0x5b75da);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 82e432c..31fd62e 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 _0xd8f7=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer'];(function(_0x40c656,_0x27b0fa){var _0x553a28=function(_0x49ce84){while(--_0x49ce84){_0x40c656['push'](_0x40c656['shift']());}};_0x553a28(++_0x27b0fa);}(_0xd8f7,0xef));var _0x7d8f=function(_0x3de9fe,_0x3a7be9){_0x3de9fe=_0x3de9fe-0x0;var _0x547d09=_0xd8f7[_0x3de9fe];return _0x547d09;};'use strict';var multer=require(_0x7d8f('0x0'));var util=require(_0x7d8f('0x1'));var path=require('path');var timeout=require(_0x7d8f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x7d8f('0x3'));var interaction=require(_0x7d8f('0x4'));var config=require(_0x7d8f('0x5'));var controller=require('./cdr.controller');router[_0x7d8f('0x6')]('/',auth['isAuthenticated'](),controller[_0x7d8f('0x7')]);router[_0x7d8f('0x6')]('/describe',auth[_0x7d8f('0x8')](),controller['describe']);router['get'](_0x7d8f('0x9'),auth['isAuthenticated'](),controller[_0x7d8f('0xa')]);router[_0x7d8f('0xb')]('/',auth[_0x7d8f('0x8')](),controller[_0x7d8f('0xc')]);router[_0x7d8f('0xd')](_0x7d8f('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7d8f('0x9'),auth['isAuthenticated'](),controller[_0x7d8f('0xe')]);module[_0x7d8f('0xf')]=router; \ No newline at end of file +var _0x9826=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./cdr.controller','isAuthenticated','/describe','get','post','put','/:id','update'];(function(_0x29d2b7,_0x5892c7){var _0x109807=function(_0x351d6d){while(--_0x351d6d){_0x29d2b7['push'](_0x29d2b7['shift']());}};_0x109807(++_0x5892c7);}(_0x9826,0x69));var _0x6982=function(_0x52d8f3,_0x2dd866){_0x52d8f3=_0x52d8f3-0x0;var _0x4247b3=_0x9826[_0x52d8f3];return _0x4247b3;};'use strict';var multer=require(_0x6982('0x0'));var util=require(_0x6982('0x1'));var path=require(_0x6982('0x2'));var timeout=require('connect-timeout');var express=require(_0x6982('0x3'));var router=express['Router']();var auth=require(_0x6982('0x4'));var interaction=require(_0x6982('0x5'));var config=require('../../config/environment');var controller=require(_0x6982('0x6'));router['get']('/',auth[_0x6982('0x7')](),controller['index']);router['get'](_0x6982('0x8'),auth[_0x6982('0x7')](),controller['describe']);router[_0x6982('0x9')]('/:id',auth[_0x6982('0x7')](),controller['show']);router[_0x6982('0xa')]('/',auth[_0x6982('0x7')](),controller['create']);router[_0x6982('0xb')](_0x6982('0xc'),auth[_0x6982('0x7')](),controller[_0x6982('0xd')]);router[_0x6982('0xe')]('/:id',auth[_0x6982('0x7')](),controller[_0x6982('0xf')]);module[_0x6982('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index b658f3e..5c9d774 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 _0x9907=['noop','TEXT','*,*,*,*','STRING'];(function(_0x4d73fc,_0x56f819){var _0x48a4cd=function(_0x188906){while(--_0x188906){_0x4d73fc['push'](_0x4d73fc['shift']());}};_0x48a4cd(++_0x56f819);}(_0x9907,0x1c7));var _0x7990=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x9907[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7990('0x0')],'allowNull':![],'defaultValue':_0x7990('0x1')},'appdata':{'type':Sequelize[_0x7990('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7990('0x0')],'defaultValue':_0x7990('0x3')}}; \ No newline at end of file +var _0x4469=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x180ab8,_0x385215){var _0x416953=function(_0x2563ae){while(--_0x2563ae){_0x180ab8['push'](_0x180ab8['shift']());}};_0x416953(++_0x385215);}(_0x4469,0x12f));var _0x9446=function(_0x118e5a,_0x251168){_0x118e5a=_0x118e5a-0x0;var _0x41a093=_0x4469[_0x118e5a];return _0x41a093;};'use strict';var Sequelize=require(_0x9446('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9446('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9446('0x2')],'allowNull':![],'defaultValue':_0x9446('0x3')},'appdata':{'type':Sequelize[_0x9446('0x4')]()},'description':{'type':Sequelize[_0x9446('0x2')]},'interval':{'type':Sequelize[_0x9446('0x2')],'defaultValue':_0x9446('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 26647f5..3f0a023 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 _0x72af=['save','update','then','destroy','error','stack','name','send','show','model','ChatApplication','query','filters','intersection','fields','attributes','length','includeAll','merge','find','catch','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x57e07b,_0x3a3c77){var _0x2a7b65=function(_0x4a42c4){while(--_0x4a42c4){_0x57e07b['push'](_0x57e07b['shift']());}};_0x2a7b65(++_0x3a3c77);}(_0x72af,0x1bf));var _0xf72a=function(_0x3a59e2,_0x502e43){_0x3a59e2=_0x3a59e2-0x0;var _0x226b63=_0x72af[_0x3a59e2];return _0x226b63;};'use strict';var pdf=require(_0xf72a('0x0'));var emlformat=require(_0xf72a('0x1'));var rimraf=require(_0xf72a('0x2'));var zipdir=require(_0xf72a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf72a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf72a('0x5'));var util=require(_0xf72a('0x6'));var path=require(_0xf72a('0x7'));var sox=require(_0xf72a('0x8'));var csv=require('to-csv');var ejs=require(_0xf72a('0x9'));var fs=require('fs');var _=require(_0xf72a('0xa'));var squel=require(_0xf72a('0xb'));var crypto=require(_0xf72a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf72a('0xd'));var toCsv=require(_0xf72a('0xe'));var querystring=require(_0xf72a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf72a('0x10'));var authService=require(_0xf72a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf72a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf72a('0x13'))(_0xf72a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf72a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c1c1a,_0x2dc455){_0x2dc455=_0x2dc455||0xcc;return function(_0x3499a5){if(_0x3499a5){return _0x2c1c1a[_0xf72a('0x16')](_0x2dc455);}return _0x2c1c1a[_0xf72a('0x17')](_0x2dc455)[_0xf72a('0x18')]();};}function respondWithResult(_0x449484,_0xbed691){_0xbed691=_0xbed691||0xc8;return function(_0x5a279e){if(_0x5a279e){return _0x449484['status'](_0xbed691)[_0xf72a('0x19')](_0x5a279e);}};}function respondWithFilteredResult(_0x515bc5,_0xfaae47){return function(_0x49e932){if(_0x49e932){var _0x1b025d=_0x49e932[_0xf72a('0x1a')],_0x3ca7c6=_0xfaae47[_0xf72a('0x1b')],_0x201d59=_0xfaae47[_0xf72a('0x1b')]+_0xfaae47[_0xf72a('0x1c')],_0x5768e9;if(_0x201d59>=_0x1b025d){_0x201d59=_0x1b025d;_0x5768e9=0xc8;}else{_0x5768e9=0xce;}_0x515bc5['status'](_0x5768e9);return _0x515bc5['set'](_0xf72a('0x1d'),_0x3ca7c6+'-'+_0x201d59+'/'+_0x1b025d)[_0xf72a('0x19')](_0x49e932);}return null;};}function patchUpdates(_0x2c104c){return function(_0x4ef62e){try{jsonpatch['apply'](_0x4ef62e,_0x2c104c,!![]);}catch(_0x54e460){return BPromise['reject'](_0x54e460);}return _0x4ef62e[_0xf72a('0x1e')]();};}function saveUpdates(_0x5a044d,_0x34075a){return function(_0x572268){if(_0x572268){return _0x572268[_0xf72a('0x1f')](_0x5a044d)[_0xf72a('0x20')](function(_0x2f6aaf){return _0x2f6aaf;});}return null;};}function removeEntity(_0x4cc4c6,_0x43857a){return function(_0x3e09a0){if(_0x3e09a0){return _0x3e09a0[_0xf72a('0x21')]()['then'](function(){_0x4cc4c6[_0xf72a('0x17')](0xcc)[_0xf72a('0x18')]();});}};}function handleEntityNotFound(_0x1c7bb7,_0x171ac9){return function(_0x57720d){if(!_0x57720d){_0x1c7bb7[_0xf72a('0x16')](0x194);}return _0x57720d;};}function handleError(_0x550660,_0x57c24a){_0x57c24a=_0x57c24a||0x1f4;return function(_0x7201fd){logger[_0xf72a('0x22')](_0x7201fd[_0xf72a('0x23')]);if(_0x7201fd[_0xf72a('0x24')]){delete _0x7201fd[_0xf72a('0x24')];}_0x550660[_0xf72a('0x17')](_0x57c24a)[_0xf72a('0x25')](_0x7201fd);};}exports[_0xf72a('0x26')]=function(_0x14f60d,_0x1808d4){var _0x218d77={'raw':!![],'where':{'id':_0x14f60d['params']['id']}},_0x4f8a63={};_0x4f8a63[_0xf72a('0x27')]=_['keys'](db[_0xf72a('0x28')]['rawAttributes']);_0x4f8a63['query']=_['keys'](_0x14f60d[_0xf72a('0x29')]);_0x4f8a63[_0xf72a('0x2a')]=_[_0xf72a('0x2b')](_0x4f8a63['model'],_0x4f8a63[_0xf72a('0x29')]);_0x218d77['attributes']=_[_0xf72a('0x2b')](_0x4f8a63[_0xf72a('0x27')],qs[_0xf72a('0x2c')](_0x14f60d['query'][_0xf72a('0x2c')]));_0x218d77['attributes']=_0x218d77[_0xf72a('0x2d')][_0xf72a('0x2e')]?_0x218d77[_0xf72a('0x2d')]:_0x4f8a63[_0xf72a('0x27')];if(_0x14f60d[_0xf72a('0x29')][_0xf72a('0x2f')]){_0x218d77['include']=[{'all':!![]}];}_0x218d77=_[_0xf72a('0x30')]({},_0x218d77,_0x14f60d['options']);return db[_0xf72a('0x28')][_0xf72a('0x31')](_0x218d77)[_0xf72a('0x20')](handleEntityNotFound(_0x1808d4,null))[_0xf72a('0x20')](respondWithResult(_0x1808d4,null))[_0xf72a('0x32')](handleError(_0x1808d4,null));};exports[_0xf72a('0x1f')]=function(_0xfc0c11,_0x12741a){if(_0xfc0c11[_0xf72a('0x33')]['id']){delete _0xfc0c11[_0xf72a('0x33')]['id'];}return db[_0xf72a('0x28')][_0xf72a('0x31')]({'where':{'id':_0xfc0c11[_0xf72a('0x34')]['id']}})[_0xf72a('0x20')](handleEntityNotFound(_0x12741a,null))[_0xf72a('0x20')](saveUpdates(_0xfc0c11['body'],null))[_0xf72a('0x20')](respondWithResult(_0x12741a,null))[_0xf72a('0x32')](handleError(_0x12741a,null));};exports[_0xf72a('0x21')]=function(_0x362111,_0x2c8c4e){return db['ChatApplication'][_0xf72a('0x31')]({'where':{'id':_0x362111[_0xf72a('0x34')]['id']}})['then'](handleEntityNotFound(_0x2c8c4e,null))[_0xf72a('0x20')](removeEntity(_0x2c8c4e,null))[_0xf72a('0x32')](handleError(_0x2c8c4e,null));}; \ No newline at end of file +var _0x6678=['../../config/environment','sendStatus','status','count','offset','limit','set','json','apply','reject','update','then','end','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','filters','intersection','query','attributes','fields','length','includeAll','include','merge','find','catch','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6678,0x1aa));var _0x8667=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x6678[_0x29e0eb];return _0x597d2d;};'use strict';var pdf=require(_0x8667('0x0'));var emlformat=require(_0x8667('0x1'));var rimraf=require(_0x8667('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8667('0x3'));var moment=require(_0x8667('0x4'));var BPromise=require(_0x8667('0x5'));var Mustache=require(_0x8667('0x6'));var util=require(_0x8667('0x7'));var path=require(_0x8667('0x8'));var sox=require(_0x8667('0x9'));var csv=require(_0x8667('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8667('0xb'));var jsforce=require(_0x8667('0xc'));var deskjs=require(_0x8667('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8667('0xe'));var Papa=require(_0x8667('0xf'));var Redis=require(_0x8667('0x10'));var authService=require(_0x8667('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8667('0x12'));var hardwareService=require(_0x8667('0x13'));var logger=require(_0x8667('0x14'))('api');var utils=require(_0x8667('0x15'));var config=require(_0x8667('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41064f,_0x1d6799){_0x1d6799=_0x1d6799||0xcc;return function(_0x481a30){if(_0x481a30){return _0x41064f[_0x8667('0x17')](_0x1d6799);}return _0x41064f[_0x8667('0x18')](_0x1d6799)['end']();};}function respondWithResult(_0x3af73f,_0x6c36e){_0x6c36e=_0x6c36e||0xc8;return function(_0x352423){if(_0x352423){return _0x3af73f[_0x8667('0x18')](_0x6c36e)['json'](_0x352423);}};}function respondWithFilteredResult(_0x114576,_0x1cd186){return function(_0x136160){if(_0x136160){var _0x3469b9=_0x136160[_0x8667('0x19')],_0x45de4f=_0x1cd186[_0x8667('0x1a')],_0x5ebfc6=_0x1cd186[_0x8667('0x1a')]+_0x1cd186[_0x8667('0x1b')],_0x40ac49;if(_0x5ebfc6>=_0x3469b9){_0x5ebfc6=_0x3469b9;_0x40ac49=0xc8;}else{_0x40ac49=0xce;}_0x114576[_0x8667('0x18')](_0x40ac49);return _0x114576[_0x8667('0x1c')]('Content-Range',_0x45de4f+'-'+_0x5ebfc6+'/'+_0x3469b9)[_0x8667('0x1d')](_0x136160);}return null;};}function patchUpdates(_0x279468){return function(_0x269910){try{jsonpatch[_0x8667('0x1e')](_0x269910,_0x279468,!![]);}catch(_0x5993f0){return BPromise[_0x8667('0x1f')](_0x5993f0);}return _0x269910['save']();};}function saveUpdates(_0x1e0467,_0x127bd6){return function(_0x466c97){if(_0x466c97){return _0x466c97[_0x8667('0x20')](_0x1e0467)[_0x8667('0x21')](function(_0x476a96){return _0x476a96;});}return null;};}function removeEntity(_0x5366bb,_0x3451db){return function(_0x3111ba){if(_0x3111ba){return _0x3111ba['destroy']()[_0x8667('0x21')](function(){_0x5366bb[_0x8667('0x18')](0xcc)[_0x8667('0x22')]();});}};}function handleEntityNotFound(_0x5da326,_0x28691c){return function(_0x25dd17){if(!_0x25dd17){_0x5da326['sendStatus'](0x194);}return _0x25dd17;};}function handleError(_0x581783,_0x4f6224){_0x4f6224=_0x4f6224||0x1f4;return function(_0x13762d){logger['error'](_0x13762d[_0x8667('0x23')]);if(_0x13762d['name']){delete _0x13762d[_0x8667('0x24')];}_0x581783[_0x8667('0x18')](_0x4f6224)[_0x8667('0x25')](_0x13762d);};}exports[_0x8667('0x26')]=function(_0x257844,_0x4c4758){var _0x443ff3={'raw':!![],'where':{'id':_0x257844[_0x8667('0x27')]['id']}},_0x2eb7f1={};_0x2eb7f1[_0x8667('0x28')]=_[_0x8667('0x29')](db[_0x8667('0x2a')][_0x8667('0x2b')]);_0x2eb7f1['query']=_['keys'](_0x257844['query']);_0x2eb7f1[_0x8667('0x2c')]=_[_0x8667('0x2d')](_0x2eb7f1[_0x8667('0x28')],_0x2eb7f1[_0x8667('0x2e')]);_0x443ff3[_0x8667('0x2f')]=_[_0x8667('0x2d')](_0x2eb7f1[_0x8667('0x28')],qs[_0x8667('0x30')](_0x257844[_0x8667('0x2e')][_0x8667('0x30')]));_0x443ff3['attributes']=_0x443ff3[_0x8667('0x2f')][_0x8667('0x31')]?_0x443ff3[_0x8667('0x2f')]:_0x2eb7f1['model'];if(_0x257844[_0x8667('0x2e')][_0x8667('0x32')]){_0x443ff3[_0x8667('0x33')]=[{'all':!![]}];}_0x443ff3=_[_0x8667('0x34')]({},_0x443ff3,_0x257844['options']);return db[_0x8667('0x2a')][_0x8667('0x35')](_0x443ff3)[_0x8667('0x21')](handleEntityNotFound(_0x4c4758,null))[_0x8667('0x21')](respondWithResult(_0x4c4758,null))[_0x8667('0x36')](handleError(_0x4c4758,null));};exports[_0x8667('0x20')]=function(_0x3f8f39,_0x344294){if(_0x3f8f39[_0x8667('0x37')]['id']){delete _0x3f8f39[_0x8667('0x37')]['id'];}return db[_0x8667('0x2a')][_0x8667('0x35')]({'where':{'id':_0x3f8f39['params']['id']}})[_0x8667('0x21')](handleEntityNotFound(_0x344294,null))['then'](saveUpdates(_0x3f8f39[_0x8667('0x37')],null))[_0x8667('0x21')](respondWithResult(_0x344294,null))['catch'](handleError(_0x344294,null));};exports['destroy']=function(_0x3ab225,_0x4c42e4){return db[_0x8667('0x2a')][_0x8667('0x35')]({'where':{'id':_0x3ab225['params']['id']}})[_0x8667('0x21')](handleEntityNotFound(_0x4c42e4,null))[_0x8667('0x21')](removeEntity(_0x4c42e4,null))[_0x8667('0x36')](handleError(_0x4c42e4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2c6c1db..afb2a37 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 b087373..086e683 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 _0xd966=['http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x2fe975,_0x13249a){var _0x41a20d=function(_0x1578a1){while(--_0x1578a1){_0x2fe975['push'](_0x2fe975['shift']());}};_0x41a20d(++_0x13249a);}(_0xd966,0x1e7));var _0x6d96=function(_0x43747e,_0x13b832){_0x43747e=_0x43747e-0x0;var _0x7fb853=_0xd966[_0x43747e];return _0x7fb853;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d96('0x0'));var BPromise=require('bluebird');var rs=require(_0x6d96('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d96('0x2'))['db'];var utils=require(_0x6d96('0x3'));var logger=require(_0x6d96('0x4'))('rpc');var config=require(_0x6d96('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d96('0x6')][_0x6d96('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x515a22,_0x5e781f,_0x4fc530){return new BPromise(function(_0x2a696d,_0x5e54c3){return client['request'](_0x515a22,_0x4fc530)[_0x6d96('0x8')](function(_0x146e28){logger[_0x6d96('0x9')](_0x6d96('0xa'),_0x5e781f,_0x6d96('0xb'));logger[_0x6d96('0xc')](_0x6d96('0xd'),_0x5e781f,_0x6d96('0xb'),JSON['stringify'](_0x146e28));if(_0x146e28[_0x6d96('0xe')]){if(_0x146e28[_0x6d96('0xe')][_0x6d96('0xf')]===0x1f4){logger[_0x6d96('0xe')](_0x6d96('0xa'),_0x5e781f,_0x146e28[_0x6d96('0xe')][_0x6d96('0x10')]);return _0x5e54c3(_0x146e28[_0x6d96('0xe')][_0x6d96('0x10')]);}logger[_0x6d96('0xe')](_0x6d96('0xa'),_0x5e781f,_0x146e28[_0x6d96('0xe')][_0x6d96('0x10')]);return _0x2a696d(_0x146e28[_0x6d96('0xe')]['message']);}else{logger[_0x6d96('0x9')](_0x6d96('0xa'),_0x5e781f,_0x6d96('0xb'));_0x2a696d(_0x146e28[_0x6d96('0x11')]['message']);}})[_0x6d96('0x12')](function(_0x1abe07){logger['error'](_0x6d96('0xa'),_0x5e781f,_0x1abe07);_0x5e54c3(_0x1abe07);});});} \ No newline at end of file +var _0xf11f=['rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4d1965,_0x43152e){var _0xdcfade=function(_0x3d3b8a){while(--_0x3d3b8a){_0x4d1965['push'](_0x4d1965['shift']());}};_0xdcfade(++_0x43152e);}(_0xf11f,0x16a));var _0xff11=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0xf11f[_0xffd8b0];return _0x301ba0;};'use strict';var _=require('lodash');var util=require(_0xff11('0x0'));var moment=require(_0xff11('0x1'));var BPromise=require(_0xff11('0x2'));var rs=require(_0xff11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff11('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff11('0x5'))(_0xff11('0x6'));var config=require(_0xff11('0x7'));var jayson=require(_0xff11('0x8'));var client=jayson[_0xff11('0x9')][_0xff11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d7e0,_0x91b2d7,_0x362839){return new BPromise(function(_0x22d83b,_0x4a4feb){return client[_0xff11('0xb')](_0x9d7e0,_0x362839)[_0xff11('0xc')](function(_0x2a3a39){logger['info'](_0xff11('0xd'),_0x91b2d7,'request\x20sent');logger[_0xff11('0xe')](_0xff11('0xf'),_0x91b2d7,'request\x20sent',JSON[_0xff11('0x10')](_0x2a3a39));if(_0x2a3a39[_0xff11('0x11')]){if(_0x2a3a39[_0xff11('0x11')]['code']===0x1f4){logger[_0xff11('0x11')](_0xff11('0xd'),_0x91b2d7,_0x2a3a39['error'][_0xff11('0x12')]);return _0x4a4feb(_0x2a3a39[_0xff11('0x11')][_0xff11('0x12')]);}logger[_0xff11('0x11')](_0xff11('0xd'),_0x91b2d7,_0x2a3a39[_0xff11('0x11')][_0xff11('0x12')]);return _0x22d83b(_0x2a3a39[_0xff11('0x11')][_0xff11('0x12')]);}else{logger[_0xff11('0x13')]('ChatApplication,\x20%s,\x20%s',_0x91b2d7,_0xff11('0x14'));_0x22d83b(_0x2a3a39[_0xff11('0x15')][_0xff11('0x12')]);}})[_0xff11('0x16')](function(_0x26b5f8){logger['error'](_0xff11('0xd'),_0x91b2d7,_0x26b5f8);_0x4a4feb(_0x26b5f8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3ad6a6f..a119ad9 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 _0xee88=['util','path','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','multer'];(function(_0x980a04,_0x3f1a86){var _0x4be21f=function(_0x53fa2d){while(--_0x53fa2d){_0x980a04['push'](_0x980a04['shift']());}};_0x4be21f(++_0x3f1a86);}(_0xee88,0x1df));var _0x8ee8=function(_0x4c7959,_0x46d94f){_0x4c7959=_0x4c7959-0x0;var _0xab8fe8=_0xee88[_0x4c7959];return _0xab8fe8;};'use strict';var multer=require(_0x8ee8('0x0'));var util=require(_0x8ee8('0x1'));var path=require(_0x8ee8('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ee8('0x3'));var router=express[_0x8ee8('0x4')]();var auth=require(_0x8ee8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8ee8('0x6'));var controller=require(_0x8ee8('0x7'));router[_0x8ee8('0x8')](_0x8ee8('0x9'),auth[_0x8ee8('0xa')](),controller[_0x8ee8('0xb')]);router[_0x8ee8('0xc')]('/:id',auth[_0x8ee8('0xa')](),controller[_0x8ee8('0xd')]);router['delete'](_0x8ee8('0x9'),auth['isAuthenticated'](),controller[_0x8ee8('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf43b=['get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./chatApplication.controller'];(function(_0x1c15d1,_0x412776){var _0x278c59=function(_0x350236){while(--_0x350236){_0x1c15d1['push'](_0x1c15d1['shift']());}};_0x278c59(++_0x412776);}(_0xf43b,0x1e4));var _0xbf43=function(_0x2372a1,_0x4c6967){_0x2372a1=_0x2372a1-0x0;var _0x146610=_0xf43b[_0x2372a1];return _0x146610;};'use strict';var multer=require(_0xbf43('0x0'));var util=require('util');var path=require(_0xbf43('0x1'));var timeout=require(_0xbf43('0x2'));var express=require('express');var router=express[_0xbf43('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf43('0x4'));var config=require('../../config/environment');var controller=require(_0xbf43('0x5'));router[_0xbf43('0x6')]('/:id',auth[_0xbf43('0x7')](),controller['show']);router[_0xbf43('0x8')](_0xbf43('0x9'),auth['isAuthenticated'](),controller[_0xbf43('0xa')]);router[_0xbf43('0xb')]('/:id',auth[_0xbf43('0x7')](),controller[_0xbf43('0xc')]);module[_0xbf43('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 806d872..b2622c1 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 _0x218c=['BOOLEAN','exports','STRING'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x218c,0x118));var _0xc218=function(_0x17968b,_0xd64399){_0x17968b=_0x17968b-0x0;var _0x4eabd9=_0x218c[_0x17968b];return _0x4eabd9;};'use strict';var Sequelize=require('sequelize');module[_0xc218('0x0')]={'name':{'type':Sequelize[_0xc218('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc218('0x1')]},'write':{'type':Sequelize[_0xc218('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0aa1=['STRING','sequelize','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0aa1,0xaf));var _0x10aa=function(_0x145ef5,_0x2b1108){_0x145ef5=_0x145ef5-0x0;var _0x1634ba=_0x0aa1[_0x145ef5];return _0x1634ba;};'use strict';var Sequelize=require(_0x10aa('0x0'));module[_0x10aa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x10aa('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 82d9fec..b269f87 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 _0x2ace=['request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','json','reject','update','then','destroy','stack','name','index','map','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','ChatGroup','includeAll','findAll','rows','params','rawAttributes','include','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','filter','getMembers','removeMembers','addMessage','ChatGroupId','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','ChatGroup,\x20%s,\x20%s'];(function(_0xdad5b8,_0x4164d3){var _0x55b0bd=function(_0x3ca225){while(--_0x3ca225){_0xdad5b8['push'](_0xdad5b8['shift']());}};_0x55b0bd(++_0x4164d3);}(_0x2ace,0x17e));var _0xe2ac=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0x2ace[_0x3f670b];return _0x1c0978;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2ac('0x0'));var rimraf=require(_0xe2ac('0x1'));var zipdir=require(_0xe2ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ac('0x3'));var moment=require(_0xe2ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe2ac('0x5'));var util=require(_0xe2ac('0x6'));var path=require(_0xe2ac('0x7'));var sox=require(_0xe2ac('0x8'));var csv=require(_0xe2ac('0x9'));var ejs=require(_0xe2ac('0xa'));var fs=require('fs');var _=require(_0xe2ac('0xb'));var squel=require(_0xe2ac('0xc'));var crypto=require(_0xe2ac('0xd'));var jsforce=require(_0xe2ac('0xe'));var deskjs=require(_0xe2ac('0xf'));var toCsv=require(_0xe2ac('0x9'));var querystring=require(_0xe2ac('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe2ac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe2ac('0x12'));var hardwareService=require(_0xe2ac('0x13'));var logger=require('../../config/logger')(_0xe2ac('0x14'));var utils=require(_0xe2ac('0x15'));var config=require(_0xe2ac('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2ac('0x17'))['db'];config[_0xe2ac('0x18')]=_[_0xe2ac('0x19')](config[_0xe2ac('0x18')],{'host':_0xe2ac('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2ac('0x18')]));require('./chatGroup.socket')[_0xe2ac('0x1b')](socket);var jayson=require(_0xe2ac('0x1c'));var client=jayson[_0xe2ac('0x1d')][_0xe2ac('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3bec11,_0xbddfba,_0x445bca,_0x2f3caf){return new BPromise(function(_0x170693,_0x4e1851){var _0x557ef6=_0x2f3caf||client;return _0x557ef6[_0xe2ac('0x1f')](_0x3bec11,_0x445bca)['then'](function(_0x415665){logger[_0xe2ac('0x20')](_0xe2ac('0x21'),_0xbddfba,_0xe2ac('0x22'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xbddfba,'request\x20sent',JSON[_0xe2ac('0x23')](_0x415665));if(_0x415665[_0xe2ac('0x24')]){if(_0x415665[_0xe2ac('0x24')][_0xe2ac('0x25')]===0x1f4){logger[_0xe2ac('0x24')](_0xe2ac('0x21'),_0xbddfba,_0x415665['error']['message']);return _0x4e1851(_0x415665[_0xe2ac('0x24')]['message']);}logger[_0xe2ac('0x24')](_0xe2ac('0x21'),_0xbddfba,_0x415665[_0xe2ac('0x24')][_0xe2ac('0x26')]);return _0x170693(_0x415665[_0xe2ac('0x24')][_0xe2ac('0x26')]);}else{logger[_0xe2ac('0x20')](_0xe2ac('0x21'),_0xbddfba,_0xe2ac('0x22'));_0x170693(_0x415665['result']['message']);}})[_0xe2ac('0x27')](function(_0x4c9981){logger[_0xe2ac('0x24')](_0xe2ac('0x21'),_0xbddfba,_0x4c9981);_0x4e1851(_0x4c9981);});});}function respondWithStatusCode(_0x55711b,_0x192649){_0x192649=_0x192649||0xcc;return function(_0x47b950){if(_0x47b950){return _0x55711b[_0xe2ac('0x28')](_0x192649);}return _0x55711b[_0xe2ac('0x29')](_0x192649)[_0xe2ac('0x2a')]();};}function respondWithResult(_0x557cb2,_0x2702cd){_0x2702cd=_0x2702cd||0xc8;return function(_0x2caff4){if(_0x2caff4){return _0x557cb2['status'](_0x2702cd)['json'](_0x2caff4);}};}function respondWithFilteredResult(_0x3201e8,_0x2d816f){return function(_0x2b50aa){if(_0x2b50aa){var _0x23bef4=_0x2b50aa[_0xe2ac('0x2b')],_0x486ee3=_0x2d816f[_0xe2ac('0x2c')],_0x2ccd98=_0x2d816f[_0xe2ac('0x2c')]+_0x2d816f[_0xe2ac('0x2d')],_0x5f32e8;if(_0x2ccd98>=_0x23bef4){_0x2ccd98=_0x23bef4;_0x5f32e8=0xc8;}else{_0x5f32e8=0xce;}_0x3201e8[_0xe2ac('0x29')](_0x5f32e8);return _0x3201e8[_0xe2ac('0x2e')]('Content-Range',_0x486ee3+'-'+_0x2ccd98+'/'+_0x23bef4)[_0xe2ac('0x2f')](_0x2b50aa);}return null;};}function patchUpdates(_0x4d0c1d){return function(_0x493d18){try{jsonpatch['apply'](_0x493d18,_0x4d0c1d,!![]);}catch(_0x2e4984){return BPromise[_0xe2ac('0x30')](_0x2e4984);}return _0x493d18['save']();};}function saveUpdates(_0xb07e8a,_0x3b9938){return function(_0x4e7286){if(_0x4e7286){return _0x4e7286[_0xe2ac('0x31')](_0xb07e8a)[_0xe2ac('0x32')](function(_0x58d8bb){return _0x58d8bb;});}return null;};}function removeEntity(_0x4b9e5e,_0xd4db2a){return function(_0x5d34a2){if(_0x5d34a2){return _0x5d34a2[_0xe2ac('0x33')]()[_0xe2ac('0x32')](function(){_0x4b9e5e[_0xe2ac('0x29')](0xcc)[_0xe2ac('0x2a')]();});}};}function handleEntityNotFound(_0x1f68a6,_0x42b5d7){return function(_0x34bff6){if(!_0x34bff6){_0x1f68a6[_0xe2ac('0x28')](0x194);}return _0x34bff6;};}function handleError(_0x16a023,_0x4ced94){_0x4ced94=_0x4ced94||0x1f4;return function(_0x14cb81){logger[_0xe2ac('0x24')](_0x14cb81[_0xe2ac('0x34')]);if(_0x14cb81[_0xe2ac('0x35')]){delete _0x14cb81[_0xe2ac('0x35')];}_0x16a023[_0xe2ac('0x29')](_0x4ced94)['send'](_0x14cb81);};}exports[_0xe2ac('0x36')]=function(_0x4b2529,_0x37bf0e){var _0x25b5a8={},_0x3cab70={},_0x15f6d8={'count':0x0,'rows':[]};var _0x5a2025=_[_0xe2ac('0x37')](db['ChatGroup']['rawAttributes'],function(_0x570ba9){return{'name':_0x570ba9['fieldName'],'type':_0x570ba9[_0xe2ac('0x38')][_0xe2ac('0x39')]};});_0x3cab70['model']=_[_0xe2ac('0x37')](_0x5a2025,_0xe2ac('0x35'));_0x3cab70[_0xe2ac('0x3a')]=_[_0xe2ac('0x3b')](_0x4b2529[_0xe2ac('0x3a')]);_0x3cab70[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x3cab70['model'],_0x3cab70[_0xe2ac('0x3a')]);_0x25b5a8['attributes']=_['intersection'](_0x3cab70[_0xe2ac('0x3e')],qs[_0xe2ac('0x3f')](_0x4b2529[_0xe2ac('0x3a')][_0xe2ac('0x3f')]));_0x25b5a8[_0xe2ac('0x40')]=_0x25b5a8[_0xe2ac('0x40')][_0xe2ac('0x41')]?_0x25b5a8[_0xe2ac('0x40')]:_0x3cab70['model'];if(!_0x4b2529[_0xe2ac('0x3a')][_0xe2ac('0x42')](_0xe2ac('0x43'))){_0x25b5a8[_0xe2ac('0x2d')]=qs[_0xe2ac('0x2d')](_0x4b2529['query'][_0xe2ac('0x2d')]);_0x25b5a8[_0xe2ac('0x2c')]=qs['offset'](_0x4b2529['query'][_0xe2ac('0x2c')]);}_0x25b5a8[_0xe2ac('0x44')]=qs[_0xe2ac('0x45')](_0x4b2529[_0xe2ac('0x3a')][_0xe2ac('0x45')]);_0x25b5a8['where']=qs[_0xe2ac('0x3c')](_['pick'](_0x4b2529[_0xe2ac('0x3a')],_0x3cab70[_0xe2ac('0x3c')]),_0x5a2025);if(_0x4b2529[_0xe2ac('0x3a')]['filter']){_0x25b5a8[_0xe2ac('0x46')]=_[_0xe2ac('0x47')](_0x25b5a8[_0xe2ac('0x46')],{'$or':_[_0xe2ac('0x37')](_0x5a2025,function(_0xfef752){if(_0xfef752[_0xe2ac('0x38')]!==_0xe2ac('0x48')){var _0x30eda2={};_0x30eda2[_0xfef752['name']]={'$like':'%'+_0x4b2529[_0xe2ac('0x3a')]['filter']+'%'};return _0x30eda2;}})});}_0x25b5a8=_['merge']({},_0x25b5a8,_0x4b2529[_0xe2ac('0x49')]);var _0x21f488={'where':_0x25b5a8[_0xe2ac('0x46')]};return db[_0xe2ac('0x4a')][_0xe2ac('0x2b')](_0x21f488)[_0xe2ac('0x32')](function(_0x3715ad){_0x15f6d8[_0xe2ac('0x2b')]=_0x3715ad;if(_0x4b2529['query'][_0xe2ac('0x4b')]){_0x25b5a8['include']=[{'all':!![]}];}return db[_0xe2ac('0x4a')][_0xe2ac('0x4c')](_0x25b5a8);})[_0xe2ac('0x32')](function(_0x350e4b){_0x15f6d8[_0xe2ac('0x4d')]=_0x350e4b;return _0x15f6d8;})[_0xe2ac('0x32')](respondWithFilteredResult(_0x37bf0e,_0x25b5a8))['catch'](handleError(_0x37bf0e,null));};exports['show']=function(_0x55916d,_0xd054e0){var _0x1b4c77={'raw':!![],'where':{'id':_0x55916d[_0xe2ac('0x4e')]['id']}},_0x32a422={};_0x32a422[_0xe2ac('0x3e')]=_['keys'](db['ChatGroup'][_0xe2ac('0x4f')]);_0x32a422['query']=_['keys'](_0x55916d[_0xe2ac('0x3a')]);_0x32a422[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x32a422[_0xe2ac('0x3e')],_0x32a422[_0xe2ac('0x3a')]);_0x1b4c77[_0xe2ac('0x40')]=_[_0xe2ac('0x3d')](_0x32a422[_0xe2ac('0x3e')],qs[_0xe2ac('0x3f')](_0x55916d[_0xe2ac('0x3a')]['fields']));_0x1b4c77[_0xe2ac('0x40')]=_0x1b4c77[_0xe2ac('0x40')]['length']?_0x1b4c77[_0xe2ac('0x40')]:_0x32a422[_0xe2ac('0x3e')];if(_0x55916d['query'][_0xe2ac('0x4b')]){_0x1b4c77[_0xe2ac('0x50')]=[{'all':!![]}];}_0x1b4c77=_['merge']({},_0x1b4c77,_0x55916d[_0xe2ac('0x49')]);return db[_0xe2ac('0x4a')]['find'](_0x1b4c77)[_0xe2ac('0x32')](handleEntityNotFound(_0xd054e0,null))[_0xe2ac('0x32')](respondWithResult(_0xd054e0,null))[_0xe2ac('0x27')](handleError(_0xd054e0,null));};exports[_0xe2ac('0x51')]=function(_0x501df6,_0xfa3865){return db['ChatGroup'][_0xe2ac('0x51')](_0x501df6[_0xe2ac('0x52')],{})[_0xe2ac('0x32')](respondWithResult(_0xfa3865,0xc9))[_0xe2ac('0x27')](handleError(_0xfa3865,null));};exports[_0xe2ac('0x31')]=function(_0x5cca8a,_0x36bf87){if(_0x5cca8a[_0xe2ac('0x52')]['id']){delete _0x5cca8a[_0xe2ac('0x52')]['id'];}return db[_0xe2ac('0x4a')][_0xe2ac('0x53')]({'where':{'id':_0x5cca8a[_0xe2ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36bf87,null))[_0xe2ac('0x32')](saveUpdates(_0x5cca8a[_0xe2ac('0x52')],null))[_0xe2ac('0x32')](respondWithResult(_0x36bf87,null))[_0xe2ac('0x27')](handleError(_0x36bf87,null));};exports[_0xe2ac('0x33')]=function(_0xceaf52,_0x1a7782){return db[_0xe2ac('0x4a')]['find']({'where':{'id':_0xceaf52['params']['id']}})[_0xe2ac('0x32')](handleEntityNotFound(_0x1a7782,null))[_0xe2ac('0x32')](removeEntity(_0x1a7782,null))['catch'](handleError(_0x1a7782,null));};exports[_0xe2ac('0x54')]=function(_0x20447d,_0x36412f){return db[_0xe2ac('0x4a')]['describe']()['then'](respondWithResult(_0x36412f,null))['catch'](handleError(_0x36412f,null));};exports[_0xe2ac('0x55')]=function(_0x142acf,_0x1076ab,_0x15916f){return db[_0xe2ac('0x56')]['count']({'where':{'ChatGroupId':_0x142acf[_0xe2ac('0x4e')]['id'],'ToId':_0x142acf[_0xe2ac('0x57')]['id'],'read':![]}})[_0xe2ac('0x32')](function(_0xdd18d){return{'id':_[_0xe2ac('0x58')](_0x142acf[_0xe2ac('0x4e')]['id']),'count':_0xdd18d};})[_0xe2ac('0x32')](respondWithResult(_0x1076ab,null))[_0xe2ac('0x27')](handleError(_0x1076ab,null));};exports[_0xe2ac('0x59')]=function(_0x5cddd6,_0x5092e7,_0x8dd497){return db[_0xe2ac('0x4a')]['find']({'where':{'id':_0x5cddd6['params']['id']}})['then'](handleEntityNotFound(_0x5092e7,null))[_0xe2ac('0x32')](function(_0x3e43b7){if(_0x3e43b7){return _0x3e43b7[_0xe2ac('0x59')](_0x5cddd6[_0xe2ac('0x52')][_0xe2ac('0x5a')],_[_0xe2ac('0x5b')](_0x5cddd6[_0xe2ac('0x52')],['ids','id'])||{});}})[_0xe2ac('0x32')](respondWithResult(_0x5092e7,null))[_0xe2ac('0x27')](handleError(_0x5092e7,null));};exports['getMembers']=function(_0x2e98e1,_0x2301b3,_0x58b3f4){var _0x3b584b={};var _0x3ef371={};var _0x2091a2;var _0x382c2b;return db[_0xe2ac('0x4a')]['findOne']({'where':{'id':_0x2e98e1[_0xe2ac('0x4e')]['id']}})[_0xe2ac('0x32')](handleEntityNotFound(_0x2301b3,null))[_0xe2ac('0x32')](function(_0x45e3fd){if(_0x45e3fd){_0x2091a2=_0x45e3fd;_0x3ef371['model']=_[_0xe2ac('0x3b')](db[_0xe2ac('0x5c')][_0xe2ac('0x4f')]);_0x3ef371['query']=_[_0xe2ac('0x3b')](_0x2e98e1[_0xe2ac('0x3a')]);_0x3ef371[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x3ef371[_0xe2ac('0x3e')],_0x3ef371[_0xe2ac('0x3a')]);_0x3b584b[_0xe2ac('0x40')]=_['intersection'](_0x3ef371[_0xe2ac('0x3e')],qs[_0xe2ac('0x3f')](_0x2e98e1[_0xe2ac('0x3a')][_0xe2ac('0x3f')]));_0x3b584b[_0xe2ac('0x40')]=_0x3b584b[_0xe2ac('0x40')]['length']?_0x3b584b[_0xe2ac('0x40')]:_0x3ef371['model'];_0x3b584b['order']=qs['sort'](_0x2e98e1[_0xe2ac('0x3a')][_0xe2ac('0x45')]);_0x3b584b['where']=qs[_0xe2ac('0x3c')](_['pick'](_0x2e98e1[_0xe2ac('0x3a')],_0x3ef371[_0xe2ac('0x3c')]));if(_0x2e98e1[_0xe2ac('0x3a')][_0xe2ac('0x5d')]){_0x3b584b['where']=_[_0xe2ac('0x47')](_0x3b584b[_0xe2ac('0x46')],{'$or':_['map'](_0x3b584b[_0xe2ac('0x40')],function(_0x198710){var _0x187ae7={};_0x187ae7[_0x198710]={'$like':'%'+_0x2e98e1['query'][_0xe2ac('0x5d')]+'%'};return _0x187ae7;})});}_0x3b584b=_['merge']({},_0x3b584b,_0x2e98e1['options']);return _0x2091a2[_0xe2ac('0x5e')](_0x3b584b);}})[_0xe2ac('0x32')](function(_0x107673){if(_0x107673){_0x382c2b=_0x107673['length'];if(!_0x2e98e1['query']['hasOwnProperty'](_0xe2ac('0x43'))){_0x3b584b[_0xe2ac('0x2d')]=qs[_0xe2ac('0x2d')](_0x2e98e1[_0xe2ac('0x3a')]['limit']);_0x3b584b[_0xe2ac('0x2c')]=qs[_0xe2ac('0x2c')](_0x2e98e1[_0xe2ac('0x3a')]['offset']);}return _0x2091a2[_0xe2ac('0x5e')](_0x3b584b);}})[_0xe2ac('0x32')](function(_0x2373e3){if(_0x2373e3){return _0x2373e3?{'count':_0x382c2b,'rows':_0x2373e3}:null;}})[_0xe2ac('0x32')](respondWithResult(_0x2301b3,null))[_0xe2ac('0x27')](handleError(_0x2301b3,null));};exports[_0xe2ac('0x5f')]=function(_0xb4c51f,_0x235fc8,_0x763b5b){return db[_0xe2ac('0x4a')]['find']({'where':{'id':_0xb4c51f[_0xe2ac('0x4e')]['id']}})[_0xe2ac('0x32')](handleEntityNotFound(_0x235fc8,null))[_0xe2ac('0x32')](function(_0x58479f){if(_0x58479f){return _0x58479f[_0xe2ac('0x5f')](_0xb4c51f[_0xe2ac('0x3a')][_0xe2ac('0x5a')]);}})['then'](respondWithStatusCode(_0x235fc8,null))[_0xe2ac('0x27')](handleError(_0x235fc8,null));};exports[_0xe2ac('0x60')]=function(_0x32e98b,_0x5a5fe2,_0x340b17){if(_0x32e98b[_0xe2ac('0x52')]['id']){delete _0x32e98b[_0xe2ac('0x52')]['id'];}return db['ChatGroup'][_0xe2ac('0x53')]({'where':{'id':_0x32e98b[_0xe2ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a5fe2,null))[_0xe2ac('0x32')](function(_0x1992a2){if(_0x1992a2){_0x32e98b[_0xe2ac('0x52')][_0xe2ac('0x61')]=_0x1992a2['id'];return db[_0xe2ac('0x56')][_0xe2ac('0x51')](_0x32e98b[_0xe2ac('0x52')]);}})[_0xe2ac('0x32')](respondWithResult(_0x5a5fe2,null))[_0xe2ac('0x27')](handleError(_0x5a5fe2,null));};exports['getMessages']=function(_0x54171b,_0x5dd520,_0x4bdaa9){var _0x309a72={};var _0x1244de={};var _0x672d7c;var _0x17fe36;return db[_0xe2ac('0x4a')]['findOne']({'where':{'id':_0x54171b[_0xe2ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dd520,null))[_0xe2ac('0x32')](function(_0x3c730e){if(_0x3c730e){_0x672d7c=_0x3c730e;_0x1244de[_0xe2ac('0x3e')]=_[_0xe2ac('0x3b')](db['ChatInternalMessage'][_0xe2ac('0x4f')]);_0x1244de['query']=_['keys'](_0x54171b[_0xe2ac('0x3a')]);_0x1244de[_0xe2ac('0x3c')]=_[_0xe2ac('0x3d')](_0x1244de[_0xe2ac('0x3e')],_0x1244de[_0xe2ac('0x3a')]);_0x309a72[_0xe2ac('0x40')]=_[_0xe2ac('0x3d')](_0x1244de['model'],qs[_0xe2ac('0x3f')](_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x3f')]));_0x309a72['attributes']=_0x309a72[_0xe2ac('0x40')]['length']?_0x309a72[_0xe2ac('0x40')]:_0x1244de[_0xe2ac('0x3e')];_0x309a72['order']=qs['sort'](_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x45')]);_0x309a72[_0xe2ac('0x46')]=qs[_0xe2ac('0x3c')](_[_0xe2ac('0x62')](_0x54171b[_0xe2ac('0x3a')],_0x1244de[_0xe2ac('0x3c')]));if(_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x5d')]){_0x309a72[_0xe2ac('0x46')]=_[_0xe2ac('0x47')](_0x309a72[_0xe2ac('0x46')],{'$or':_[_0xe2ac('0x37')](_0x309a72['attributes'],function(_0x57c99e){var _0x3efe6f={};_0x3efe6f[_0x57c99e]={'$like':'%'+_0x54171b[_0xe2ac('0x3a')]['filter']+'%'};return _0x3efe6f;})});}if(_0x54171b['query'][_0xe2ac('0x63')]){var _0x5cba39=_0x54171b['query'][_0xe2ac('0x63')][_0xe2ac('0x64')](',');var _0x56bce6={};_0x56bce6[_0x5cba39[0x0]]={'$gte':moment(_0x5cba39[0x1])[_0xe2ac('0x65')](_0xe2ac('0x66'))};_0x309a72[_0xe2ac('0x46')]=_[_0xe2ac('0x47')](_0x309a72[_0xe2ac('0x46')],_0x56bce6);}_0x309a72=_[_0xe2ac('0x47')]({},_0x309a72,_0x54171b['options']);return _0x672d7c[_0xe2ac('0x67')](_0x309a72);}})[_0xe2ac('0x32')](function(_0x3e139c){if(_0x3e139c){_0x17fe36=_0x3e139c['length'];if(!_0x54171b['query'][_0xe2ac('0x42')]('nolimit')){_0x309a72[_0xe2ac('0x2d')]=qs[_0xe2ac('0x2d')](_0x54171b[_0xe2ac('0x3a')][_0xe2ac('0x2d')]);_0x309a72['offset']=qs['offset'](_0x54171b[_0xe2ac('0x3a')]['offset']);}return _0x672d7c[_0xe2ac('0x67')](_0x309a72);}})[_0xe2ac('0x32')](function(_0x1e24f3){if(_0x1e24f3){return _0x1e24f3?{'count':_0x17fe36,'rows':_0x1e24f3}:null;}})[_0xe2ac('0x32')](respondWithResult(_0x5dd520,null))[_0xe2ac('0x27')](handleError(_0x5dd520,null));}; \ No newline at end of file +var _0xba34=['limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','filter','where','merge','VIRTUAL','options','count','findAll','rows','params','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','User','order','sort','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xba34,0x119));var _0x4ba3=function(_0x41f36a,_0x5acabd){_0x41f36a=_0x41f36a-0x0;var _0x5ad7be=_0xba34[_0x41f36a];return _0x5ad7be;};'use strict';var pdf=require(_0x4ba3('0x0'));var emlformat=require(_0x4ba3('0x1'));var rimraf=require(_0x4ba3('0x2'));var zipdir=require(_0x4ba3('0x3'));var jsonpatch=require(_0x4ba3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ba3('0x5'));var util=require(_0x4ba3('0x6'));var path=require(_0x4ba3('0x7'));var sox=require(_0x4ba3('0x8'));var csv=require(_0x4ba3('0x9'));var ejs=require(_0x4ba3('0xa'));var fs=require('fs');var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x9'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];config[_0x4ba3('0x19')]=_['defaults'](config[_0x4ba3('0x19')],{'host':_0x4ba3('0x1a'),'port':0x18eb});var socket=require(_0x4ba3('0x1b'))(new Redis(config[_0x4ba3('0x19')]));require(_0x4ba3('0x1c'))[_0x4ba3('0x1d')](socket);var jayson=require(_0x4ba3('0x1e'));var client=jayson[_0x4ba3('0x1f')][_0x4ba3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x401366,_0x36638b,_0x301359,_0x29a9d1){return new BPromise(function(_0x25f584,_0x40e75b){var _0x1b7776=_0x29a9d1||client;return _0x1b7776['request'](_0x401366,_0x301359)[_0x4ba3('0x21')](function(_0x788277){logger[_0x4ba3('0x22')](_0x4ba3('0x23'),_0x36638b,'request\x20sent');logger[_0x4ba3('0x24')](_0x4ba3('0x25'),_0x36638b,_0x4ba3('0x26'),JSON[_0x4ba3('0x27')](_0x788277));if(_0x788277[_0x4ba3('0x28')]){if(_0x788277[_0x4ba3('0x28')]['code']===0x1f4){logger['error'](_0x4ba3('0x23'),_0x36638b,_0x788277['error'][_0x4ba3('0x29')]);return _0x40e75b(_0x788277[_0x4ba3('0x28')][_0x4ba3('0x29')]);}logger[_0x4ba3('0x28')](_0x4ba3('0x23'),_0x36638b,_0x788277[_0x4ba3('0x28')]['message']);return _0x25f584(_0x788277[_0x4ba3('0x28')][_0x4ba3('0x29')]);}else{logger['info'](_0x4ba3('0x23'),_0x36638b,'request\x20sent');_0x25f584(_0x788277[_0x4ba3('0x2a')][_0x4ba3('0x29')]);}})[_0x4ba3('0x2b')](function(_0x37e6f3){logger[_0x4ba3('0x28')](_0x4ba3('0x23'),_0x36638b,_0x37e6f3);_0x40e75b(_0x37e6f3);});});}function respondWithStatusCode(_0x159596,_0xe1f7d2){_0xe1f7d2=_0xe1f7d2||0xcc;return function(_0x6cecf3){if(_0x6cecf3){return _0x159596[_0x4ba3('0x2c')](_0xe1f7d2);}return _0x159596['status'](_0xe1f7d2)[_0x4ba3('0x2d')]();};}function respondWithResult(_0x13c353,_0x2311ed){_0x2311ed=_0x2311ed||0xc8;return function(_0x5adaab){if(_0x5adaab){return _0x13c353[_0x4ba3('0x2e')](_0x2311ed)[_0x4ba3('0x2f')](_0x5adaab);}};}function respondWithFilteredResult(_0x44d78c,_0x5a3588){return function(_0x10cae6){if(_0x10cae6){var _0x843276=_0x10cae6['count'],_0x34ecb4=_0x5a3588[_0x4ba3('0x30')],_0x22394d=_0x5a3588[_0x4ba3('0x30')]+_0x5a3588[_0x4ba3('0x31')],_0x4a339e;if(_0x22394d>=_0x843276){_0x22394d=_0x843276;_0x4a339e=0xc8;}else{_0x4a339e=0xce;}_0x44d78c[_0x4ba3('0x2e')](_0x4a339e);return _0x44d78c[_0x4ba3('0x32')](_0x4ba3('0x33'),_0x34ecb4+'-'+_0x22394d+'/'+_0x843276)['json'](_0x10cae6);}return null;};}function patchUpdates(_0x27444b){return function(_0x28f36c){try{jsonpatch[_0x4ba3('0x34')](_0x28f36c,_0x27444b,!![]);}catch(_0xbf95b3){return BPromise[_0x4ba3('0x35')](_0xbf95b3);}return _0x28f36c[_0x4ba3('0x36')]();};}function saveUpdates(_0x457236,_0x272a49){return function(_0x133e76){if(_0x133e76){return _0x133e76[_0x4ba3('0x37')](_0x457236)['then'](function(_0x5a453f){return _0x5a453f;});}return null;};}function removeEntity(_0x4e2af0,_0x2d226a){return function(_0xd033d7){if(_0xd033d7){return _0xd033d7[_0x4ba3('0x38')]()[_0x4ba3('0x21')](function(){_0x4e2af0[_0x4ba3('0x2e')](0xcc)[_0x4ba3('0x2d')]();});}};}function handleEntityNotFound(_0x137551,_0xe1abe8){return function(_0x2f3495){if(!_0x2f3495){_0x137551[_0x4ba3('0x2c')](0x194);}return _0x2f3495;};}function handleError(_0x437a20,_0x3439cb){_0x3439cb=_0x3439cb||0x1f4;return function(_0x54535c){logger[_0x4ba3('0x28')](_0x54535c[_0x4ba3('0x39')]);if(_0x54535c[_0x4ba3('0x3a')]){delete _0x54535c['name'];}_0x437a20[_0x4ba3('0x2e')](_0x3439cb)['send'](_0x54535c);};}exports[_0x4ba3('0x3b')]=function(_0x1cc70e,_0x426e11){var _0x2b213b={},_0xf892e1={},_0x3d977c={'count':0x0,'rows':[]};var _0x53e39a=_[_0x4ba3('0x3c')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')],function(_0x4b702b){return{'name':_0x4b702b[_0x4ba3('0x3f')],'type':_0x4b702b[_0x4ba3('0x40')]['key']};});_0xf892e1[_0x4ba3('0x41')]=_['map'](_0x53e39a,'name');_0xf892e1[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x1cc70e[_0x4ba3('0x42')]);_0xf892e1[_0x4ba3('0x44')]=_[_0x4ba3('0x45')](_0xf892e1['model'],_0xf892e1[_0x4ba3('0x42')]);_0x2b213b[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0xf892e1[_0x4ba3('0x41')],qs[_0x4ba3('0x47')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x2b213b[_0x4ba3('0x46')]=_0x2b213b['attributes'][_0x4ba3('0x48')]?_0x2b213b[_0x4ba3('0x46')]:_0xf892e1[_0x4ba3('0x41')];if(!_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x49')](_0x4ba3('0x4a'))){_0x2b213b[_0x4ba3('0x31')]=qs[_0x4ba3('0x31')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x31')]);_0x2b213b[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x30')]);}_0x2b213b['order']=qs['sort'](_0x1cc70e['query']['sort']);_0x2b213b['where']=qs[_0x4ba3('0x44')](_['pick'](_0x1cc70e[_0x4ba3('0x42')],_0xf892e1['filters']),_0x53e39a);if(_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x2b213b[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x2b213b[_0x4ba3('0x4c')],{'$or':_['map'](_0x53e39a,function(_0x138467){if(_0x138467['type']!==_0x4ba3('0x4e')){var _0x50f27a={};_0x50f27a[_0x138467[_0x4ba3('0x3a')]]={'$like':'%'+_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x4b')]+'%'};return _0x50f27a;}})});}_0x2b213b=_[_0x4ba3('0x4d')]({},_0x2b213b,_0x1cc70e[_0x4ba3('0x4f')]);var _0xb5b940={'where':_0x2b213b[_0x4ba3('0x4c')]};return db['ChatGroup'][_0x4ba3('0x50')](_0xb5b940)[_0x4ba3('0x21')](function(_0x1e418c){_0x3d977c[_0x4ba3('0x50')]=_0x1e418c;if(_0x1cc70e[_0x4ba3('0x42')]['includeAll']){_0x2b213b['include']=[{'all':!![]}];}return db[_0x4ba3('0x3d')][_0x4ba3('0x51')](_0x2b213b);})[_0x4ba3('0x21')](function(_0x4b4de9){_0x3d977c[_0x4ba3('0x52')]=_0x4b4de9;return _0x3d977c;})[_0x4ba3('0x21')](respondWithFilteredResult(_0x426e11,_0x2b213b))[_0x4ba3('0x2b')](handleError(_0x426e11,null));};exports['show']=function(_0x47f588,_0x34dc04){var _0x482a83={'raw':!![],'where':{'id':_0x47f588[_0x4ba3('0x53')]['id']}},_0x439acf={};_0x439acf[_0x4ba3('0x41')]=_[_0x4ba3('0x43')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')]);_0x439acf['query']=_[_0x4ba3('0x43')](_0x47f588[_0x4ba3('0x42')]);_0x439acf['filters']=_[_0x4ba3('0x45')](_0x439acf[_0x4ba3('0x41')],_0x439acf[_0x4ba3('0x42')]);_0x482a83[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0x439acf['model'],qs[_0x4ba3('0x47')](_0x47f588[_0x4ba3('0x42')]['fields']));_0x482a83[_0x4ba3('0x46')]=_0x482a83[_0x4ba3('0x46')][_0x4ba3('0x48')]?_0x482a83[_0x4ba3('0x46')]:_0x439acf[_0x4ba3('0x41')];if(_0x47f588[_0x4ba3('0x42')][_0x4ba3('0x54')]){_0x482a83[_0x4ba3('0x55')]=[{'all':!![]}];}_0x482a83=_[_0x4ba3('0x4d')]({},_0x482a83,_0x47f588[_0x4ba3('0x4f')]);return db[_0x4ba3('0x3d')][_0x4ba3('0x56')](_0x482a83)[_0x4ba3('0x21')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x21')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x2b')](handleError(_0x34dc04,null));};exports['create']=function(_0x5e7ed5,_0x589d82){return db[_0x4ba3('0x3d')][_0x4ba3('0x57')](_0x5e7ed5[_0x4ba3('0x58')],{})[_0x4ba3('0x21')](respondWithResult(_0x589d82,0xc9))[_0x4ba3('0x2b')](handleError(_0x589d82,null));};exports['update']=function(_0x3920c0,_0x4620ae){if(_0x3920c0[_0x4ba3('0x58')]['id']){delete _0x3920c0[_0x4ba3('0x58')]['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x3920c0[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4620ae,null))[_0x4ba3('0x21')](saveUpdates(_0x3920c0[_0x4ba3('0x58')],null))[_0x4ba3('0x21')](respondWithResult(_0x4620ae,null))[_0x4ba3('0x2b')](handleError(_0x4620ae,null));};exports[_0x4ba3('0x38')]=function(_0x328314,_0x4fa64d){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x328314[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4fa64d,null))[_0x4ba3('0x21')](removeEntity(_0x4fa64d,null))[_0x4ba3('0x2b')](handleError(_0x4fa64d,null));};exports[_0x4ba3('0x59')]=function(_0x3f6174,_0x581512){return db[_0x4ba3('0x3d')][_0x4ba3('0x59')]()[_0x4ba3('0x21')](respondWithResult(_0x581512,null))['catch'](handleError(_0x581512,null));};exports[_0x4ba3('0x5a')]=function(_0x4b072c,_0x1b7c4e,_0x4cc10a){return db[_0x4ba3('0x5b')][_0x4ba3('0x50')]({'where':{'ChatGroupId':_0x4b072c[_0x4ba3('0x53')]['id'],'ToId':_0x4b072c['user']['id'],'read':![]}})[_0x4ba3('0x21')](function(_0xaef1b){return{'id':_[_0x4ba3('0x5c')](_0x4b072c[_0x4ba3('0x53')]['id']),'count':_0xaef1b};})[_0x4ba3('0x21')](respondWithResult(_0x1b7c4e,null))['catch'](handleError(_0x1b7c4e,null));};exports[_0x4ba3('0x5d')]=function(_0x252195,_0x34cc21,_0x469ef0){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x252195[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x34cc21,null))[_0x4ba3('0x21')](function(_0x6b3329){if(_0x6b3329){return _0x6b3329[_0x4ba3('0x5d')](_0x252195['body'][_0x4ba3('0x5e')],_[_0x4ba3('0x5f')](_0x252195['body'],['ids','id'])||{});}})[_0x4ba3('0x21')](respondWithResult(_0x34cc21,null))[_0x4ba3('0x2b')](handleError(_0x34cc21,null));};exports['getMembers']=function(_0x220c83,_0x30bb71,_0x1fb2aa){var _0x589214={};var _0x1f5815={};var _0x46224;var _0x1af489;return db[_0x4ba3('0x3d')][_0x4ba3('0x60')]({'where':{'id':_0x220c83[_0x4ba3('0x53')]['id']}})['then'](handleEntityNotFound(_0x30bb71,null))[_0x4ba3('0x21')](function(_0x2c0408){if(_0x2c0408){_0x46224=_0x2c0408;_0x1f5815[_0x4ba3('0x41')]=_['keys'](db[_0x4ba3('0x61')][_0x4ba3('0x3e')]);_0x1f5815[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x220c83[_0x4ba3('0x42')]);_0x1f5815[_0x4ba3('0x44')]=_[_0x4ba3('0x45')](_0x1f5815[_0x4ba3('0x41')],_0x1f5815['query']);_0x589214['attributes']=_[_0x4ba3('0x45')](_0x1f5815['model'],qs[_0x4ba3('0x47')](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x589214['attributes']=_0x589214[_0x4ba3('0x46')][_0x4ba3('0x48')]?_0x589214[_0x4ba3('0x46')]:_0x1f5815['model'];_0x589214[_0x4ba3('0x62')]=qs['sort'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x63')]);_0x589214['where']=qs[_0x4ba3('0x44')](_[_0x4ba3('0x64')](_0x220c83[_0x4ba3('0x42')],_0x1f5815[_0x4ba3('0x44')]));if(_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x589214[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x589214[_0x4ba3('0x4c')],{'$or':_['map'](_0x589214[_0x4ba3('0x46')],function(_0x306e2f){var _0x3853e1={};_0x3853e1[_0x306e2f]={'$like':'%'+_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x4b')]+'%'};return _0x3853e1;})});}_0x589214=_[_0x4ba3('0x4d')]({},_0x589214,_0x220c83[_0x4ba3('0x4f')]);return _0x46224[_0x4ba3('0x65')](_0x589214);}})[_0x4ba3('0x21')](function(_0x1a3180){if(_0x1a3180){_0x1af489=_0x1a3180[_0x4ba3('0x48')];if(!_0x220c83[_0x4ba3('0x42')]['hasOwnProperty'](_0x4ba3('0x4a'))){_0x589214[_0x4ba3('0x31')]=qs['limit'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x31')]);_0x589214['offset']=qs['offset'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x30')]);}return _0x46224[_0x4ba3('0x65')](_0x589214);}})[_0x4ba3('0x21')](function(_0x37b966){if(_0x37b966){return _0x37b966?{'count':_0x1af489,'rows':_0x37b966}:null;}})[_0x4ba3('0x21')](respondWithResult(_0x30bb71,null))[_0x4ba3('0x2b')](handleError(_0x30bb71,null));};exports[_0x4ba3('0x66')]=function(_0x516c41,_0x272480,_0x5bab62){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x516c41[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x272480,null))[_0x4ba3('0x21')](function(_0x254f91){if(_0x254f91){return _0x254f91[_0x4ba3('0x66')](_0x516c41[_0x4ba3('0x42')]['ids']);}})[_0x4ba3('0x21')](respondWithStatusCode(_0x272480,null))[_0x4ba3('0x2b')](handleError(_0x272480,null));};exports[_0x4ba3('0x67')]=function(_0x5a1872,_0x9bd44d,_0xdab676){if(_0x5a1872[_0x4ba3('0x58')]['id']){delete _0x5a1872[_0x4ba3('0x58')]['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x5a1872[_0x4ba3('0x53')]['id']}})['then'](handleEntityNotFound(_0x9bd44d,null))['then'](function(_0x42ce25){if(_0x42ce25){_0x5a1872['body'][_0x4ba3('0x68')]=_0x42ce25['id'];return db[_0x4ba3('0x5b')][_0x4ba3('0x57')](_0x5a1872[_0x4ba3('0x58')]);}})['then'](respondWithResult(_0x9bd44d,null))['catch'](handleError(_0x9bd44d,null));};exports[_0x4ba3('0x69')]=function(_0x2b2132,_0x4e856e,_0x62f9cf){var _0x39fb64={};var _0x6a2d81={};var _0x1e8232;var _0x329609;return db[_0x4ba3('0x3d')][_0x4ba3('0x60')]({'where':{'id':_0x2b2132['params']['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4e856e,null))[_0x4ba3('0x21')](function(_0x211d2b){if(_0x211d2b){_0x1e8232=_0x211d2b;_0x6a2d81['model']=_[_0x4ba3('0x43')](db[_0x4ba3('0x5b')]['rawAttributes']);_0x6a2d81[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x2b2132['query']);_0x6a2d81['filters']=_['intersection'](_0x6a2d81['model'],_0x6a2d81[_0x4ba3('0x42')]);_0x39fb64[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0x6a2d81[_0x4ba3('0x41')],qs[_0x4ba3('0x47')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x39fb64['attributes']=_0x39fb64[_0x4ba3('0x46')]['length']?_0x39fb64[_0x4ba3('0x46')]:_0x6a2d81['model'];_0x39fb64[_0x4ba3('0x62')]=qs[_0x4ba3('0x63')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x63')]);_0x39fb64[_0x4ba3('0x4c')]=qs['filters'](_['pick'](_0x2b2132[_0x4ba3('0x42')],_0x6a2d81[_0x4ba3('0x44')]));if(_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x39fb64[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x39fb64[_0x4ba3('0x4c')],{'$or':_[_0x4ba3('0x3c')](_0x39fb64[_0x4ba3('0x46')],function(_0x35441e){var _0x217ea4={};_0x217ea4[_0x35441e]={'$like':'%'+_0x2b2132[_0x4ba3('0x42')]['filter']+'%'};return _0x217ea4;})});}if(_0x2b2132[_0x4ba3('0x42')]['$gte']){var _0x3f5309=_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x6a')][_0x4ba3('0x6b')](',');var _0x48cd14={};_0x48cd14[_0x3f5309[0x0]]={'$gte':moment(_0x3f5309[0x1])[_0x4ba3('0x6c')](_0x4ba3('0x6d'))};_0x39fb64[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x39fb64['where'],_0x48cd14);}_0x39fb64=_['merge']({},_0x39fb64,_0x2b2132[_0x4ba3('0x4f')]);return _0x1e8232[_0x4ba3('0x69')](_0x39fb64);}})[_0x4ba3('0x21')](function(_0x5db456){if(_0x5db456){_0x329609=_0x5db456[_0x4ba3('0x48')];if(!_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x49')](_0x4ba3('0x4a'))){_0x39fb64[_0x4ba3('0x31')]=qs[_0x4ba3('0x31')](_0x2b2132['query'][_0x4ba3('0x31')]);_0x39fb64['offset']=qs[_0x4ba3('0x30')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x30')]);}return _0x1e8232[_0x4ba3('0x69')](_0x39fb64);}})['then'](function(_0x11be49){if(_0x11be49){return _0x11be49?{'count':_0x329609,'rows':_0x11be49}:null;}})[_0x4ba3('0x21')](respondWithResult(_0x4e856e,null))['catch'](handleError(_0x4e856e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 12bee57..c77dd3b 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x10b6ab,_0x47ed19){var _0x32410e=function(_0x5c7050){while(--_0x5c7050){_0x10b6ab['push'](_0x10b6ab['shift']());}};_0x32410e(++_0x47ed19);}(_0x0b0e,0x187));var _0xe0b0=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x0b0e[_0x184759];return _0xf26d5f;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x2032,0xd9));var _0x2203=function(_0x20334b,_0x1c4df8){_0x20334b=_0x20334b-0x0;var _0x42e1bb=_0x2032[_0x20334b];return _0x42e1bb;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8282b5e..4c68b0d 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 _0xbc1c=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','util','api','bluebird','request-promise'];(function(_0x537ba7,_0x57383f){var _0x273c3c=function(_0x2525af){while(--_0x2525af){_0x537ba7['push'](_0x537ba7['shift']());}};_0x273c3c(++_0x57383f);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x483e77,_0x433e9b){_0x483e77=_0x483e77-0x0;var _0x359df0=_0xbc1c[_0x483e77];return _0x359df0;};'use strict';var _=require('lodash');var util=require(_0xcbc1('0x0'));var logger=require('../../config/logger')(_0xcbc1('0x1'));var moment=require('moment');var BPromise=require(_0xcbc1('0x2'));var rp=require(_0xcbc1('0x3'));var fs=require('fs');var path=require(_0xcbc1('0x4'));var rimraf=require(_0xcbc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module[_0xcbc1('0x7')]=function(_0x54c13c,_0x27da8d){return _0x54c13c[_0xcbc1('0x8')](_0xcbc1('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a32=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash'];(function(_0x262158,_0x3e3c22){var _0x158652=function(_0x224097){while(--_0x224097){_0x262158['push'](_0x262158['shift']());}};_0x158652(++_0x3e3c22);}(_0x3a32,0x9b));var _0x23a3=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x3a32[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var logger=require(_0x23a3('0x2'))(_0x23a3('0x3'));var moment=require(_0x23a3('0x4'));var BPromise=require(_0x23a3('0x5'));var rp=require(_0x23a3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23a3('0x7'));var attributes=require(_0x23a3('0x8'));module['exports']=function(_0x3b1735,_0x529b70){return _0x3b1735[_0x23a3('0x9')](_0x23a3('0xa'),attributes,{'tableName':_0x23a3('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 f519466..4c84f91 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 _0xe0e0=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatGroup,\x20%s,\x20%s','util','moment','bluebird','randomstring'];(function(_0xd586c8,_0x40476b){var _0x1b1fc1=function(_0x1151df){while(--_0x1151df){_0xd586c8['push'](_0xd586c8['shift']());}};_0x1b1fc1(++_0x40476b);}(_0xe0e0,0x1af));var _0x0e0e=function(_0x4a8eb2,_0x504d05){_0x4a8eb2=_0x4a8eb2-0x0;var _0x238e36=_0xe0e0[_0x4a8eb2];return _0x238e36;};'use strict';var _=require('lodash');var util=require(_0x0e0e('0x0'));var moment=require(_0x0e0e('0x1'));var BPromise=require(_0x0e0e('0x2'));var rs=require(_0x0e0e('0x3'));var fs=require('fs');var Redis=require(_0x0e0e('0x4'));var db=require(_0x0e0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e0e('0x6'))('rpc');var config=require(_0x0e0e('0x7'));var jayson=require(_0x0e0e('0x8'));var client=jayson[_0x0e0e('0x9')][_0x0e0e('0xa')]({'port':0x232a});config[_0x0e0e('0xb')]=_[_0x0e0e('0xc')](config['redis'],{'host':_0x0e0e('0xd'),'port':0x18eb});var socket=require(_0x0e0e('0xe'))(new Redis(config[_0x0e0e('0xb')]));require(_0x0e0e('0xf'))[_0x0e0e('0x10')](socket);function respondWithRpcPromise(_0x84195e,_0x1a1c17,_0x25c674){return new BPromise(function(_0x36ea2b,_0x24661a){return client[_0x0e0e('0x11')](_0x84195e,_0x25c674)[_0x0e0e('0x12')](function(_0x46988c){logger[_0x0e0e('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1a1c17,_0x0e0e('0x14'));logger[_0x0e0e('0x15')](_0x0e0e('0x16'),_0x1a1c17,_0x0e0e('0x14'),JSON['stringify'](_0x46988c));if(_0x46988c[_0x0e0e('0x17')]){if(_0x46988c[_0x0e0e('0x17')][_0x0e0e('0x18')]===0x1f4){logger[_0x0e0e('0x17')]('ChatGroup,\x20%s,\x20%s',_0x1a1c17,_0x46988c[_0x0e0e('0x17')]['message']);return _0x24661a(_0x46988c[_0x0e0e('0x17')][_0x0e0e('0x19')]);}logger[_0x0e0e('0x17')]('ChatGroup,\x20%s,\x20%s',_0x1a1c17,_0x46988c[_0x0e0e('0x17')][_0x0e0e('0x19')]);return _0x36ea2b(_0x46988c['error'][_0x0e0e('0x19')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x1a1c17,'request\x20sent');_0x36ea2b(_0x46988c[_0x0e0e('0x1a')]['message']);}})[_0x0e0e('0x1b')](function(_0x1732ff){logger[_0x0e0e('0x17')](_0x0e0e('0x1c'),_0x1a1c17,_0x1732ff);_0x24661a(_0x1732ff);});});} \ No newline at end of file +var _0x1b90=['error','message','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x1b90,0xde));var _0x01b9=function(_0x20497e,_0x23a72a){_0x20497e=_0x20497e-0x0;var _0x2eb086=_0x1b90[_0x20497e];return _0x2eb086;};'use strict';var _=require(_0x01b9('0x0'));var util=require(_0x01b9('0x1'));var moment=require(_0x01b9('0x2'));var BPromise=require(_0x01b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x01b9('0x5'))(_0x01b9('0x6'));var config=require(_0x01b9('0x7'));var jayson=require(_0x01b9('0x8'));var client=jayson[_0x01b9('0x9')][_0x01b9('0xa')]({'port':0x232a});config[_0x01b9('0xb')]=_['defaults'](config[_0x01b9('0xb')],{'host':_0x01b9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01b9('0xb')]));require('./chatGroup.socket')[_0x01b9('0xd')](socket);function respondWithRpcPromise(_0x4056ef,_0x220f6b,_0x5c07d3){return new BPromise(function(_0xac67eb,_0x4fe814){return client[_0x01b9('0xe')](_0x4056ef,_0x5c07d3)[_0x01b9('0xf')](function(_0x20c255){logger[_0x01b9('0x10')](_0x01b9('0x11'),_0x220f6b,_0x01b9('0x12'));logger[_0x01b9('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x220f6b,_0x01b9('0x12'),JSON['stringify'](_0x20c255));if(_0x20c255['error']){if(_0x20c255[_0x01b9('0x14')]['code']===0x1f4){logger[_0x01b9('0x14')]('ChatGroup,\x20%s,\x20%s',_0x220f6b,_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);return _0x4fe814(_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);}logger[_0x01b9('0x14')](_0x01b9('0x11'),_0x220f6b,_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);return _0xac67eb(_0x20c255[_0x01b9('0x14')][_0x01b9('0x15')]);}else{logger[_0x01b9('0x10')](_0x01b9('0x11'),_0x220f6b,_0x01b9('0x12'));_0xac67eb(_0x20c255['result'][_0x01b9('0x15')]);}})['catch'](function(_0x268237){logger[_0x01b9('0x14')](_0x01b9('0x11'),_0x220f6b,_0x268237);_0x4fe814(_0x268237);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5885667..3c9cb78 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 _0x9944=['chatGroup:','./chatGroup.events','save','remove','update','emit','register','length'];(function(_0x46f059,_0x2dbdc0){var _0x5698df=function(_0x55c210){while(--_0x55c210){_0x46f059['push'](_0x46f059['shift']());}};_0x5698df(++_0x2dbdc0);}(_0x9944,0xc9));var _0x4994=function(_0x5b8228,_0x2fd3f0){_0x5b8228=_0x5b8228-0x0;var _0x346061=_0x9944[_0x5b8228];return _0x346061;};'use strict';var ChatGroupEvents=require(_0x4994('0x0'));var events=[_0x4994('0x1'),_0x4994('0x2'),_0x4994('0x3')];function createListener(_0x1e511b,_0x1202cf){return function(_0x58e477){_0x1202cf[_0x4994('0x4')](_0x1e511b,_0x58e477);};}function removeListener(_0x418ba3,_0x1bbb75){return function(){ChatGroupEvents['removeListener'](_0x418ba3,_0x1bbb75);};}exports[_0x4994('0x5')]=function(_0x2ca947){for(var _0x111836=0x0,_0x4d9364=events[_0x4994('0x6')];_0x111836<_0x4d9364;_0x111836++){var _0x261796=events[_0x111836];var _0x41a69e=createListener(_0x4994('0x7')+_0x261796,_0x2ca947);ChatGroupEvents['on'](_0x261796,_0x41a69e);}}; \ No newline at end of file +var _0xf05b=['./chatGroup.events','save','remove','update','removeListener','chatGroup:'];(function(_0x468fe2,_0x450e2e){var _0x340e7d=function(_0x5896d9){while(--_0x5896d9){_0x468fe2['push'](_0x468fe2['shift']());}};_0x340e7d(++_0x450e2e);}(_0xf05b,0x13e));var _0xbf05=function(_0x5349eb,_0x6329e3){_0x5349eb=_0x5349eb-0x0;var _0x307ea6=_0xf05b[_0x5349eb];return _0x307ea6;};'use strict';var ChatGroupEvents=require(_0xbf05('0x0'));var events=[_0xbf05('0x1'),_0xbf05('0x2'),_0xbf05('0x3')];function createListener(_0x1419b5,_0x2c1e47){return function(_0x4360b2){_0x2c1e47['emit'](_0x1419b5,_0x4360b2);};}function removeListener(_0x9b8253,_0x21e64a){return function(){ChatGroupEvents[_0xbf05('0x4')](_0x9b8253,_0x21e64a);};}exports['register']=function(_0x12726e){for(var _0x30dd8a=0x0,_0x3779cb=events['length'];_0x30dd8a<_0x3779cb;_0x30dd8a++){var _0x3e24e3=events[_0x30dd8a];var _0x4d391c=createListener(_0xbf05('0x5')+_0x3e24e3,_0x12726e);ChatGroupEvents['on'](_0x3e24e3,_0x4d391c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d4d6de2..79cc3b0 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 _0x4290=['describe','/:id','isAuthenticated','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','removeMembers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get'];(function(_0xf7dacf,_0x54e074){var _0x5ebe51=function(_0x4011a4){while(--_0x4011a4){_0xf7dacf['push'](_0xf7dacf['shift']());}};_0x5ebe51(++_0x54e074);}(_0x4290,0x1eb));var _0x0429=function(_0x2019df,_0x3c86af){_0x2019df=_0x2019df-0x0;var _0x32870c=_0x4290[_0x2019df];return _0x32870c;};'use strict';var multer=require(_0x0429('0x0'));var util=require(_0x0429('0x1'));var path=require('path');var timeout=require(_0x0429('0x2'));var express=require(_0x0429('0x3'));var router=express[_0x0429('0x4')]();var auth=require(_0x0429('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0429('0x6'));var controller=require(_0x0429('0x7'));router[_0x0429('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0429('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0429('0x9')]);router[_0x0429('0x8')](_0x0429('0xa'),auth[_0x0429('0xb')](),controller['show']);router[_0x0429('0x8')](_0x0429('0xc'),auth[_0x0429('0xb')](),controller[_0x0429('0xd')]);router['get'](_0x0429('0xe'),auth[_0x0429('0xb')](),controller[_0x0429('0xf')]);router[_0x0429('0x8')](_0x0429('0x10'),auth['isAuthenticated'](),controller[_0x0429('0x11')]);router[_0x0429('0x12')]('/',auth[_0x0429('0xb')](),controller['create']);router['post'](_0x0429('0xe'),auth[_0x0429('0xb')](),controller[_0x0429('0x13')]);router[_0x0429('0x12')](_0x0429('0x10'),auth[_0x0429('0xb')](),controller[_0x0429('0x14')]);router[_0x0429('0x15')](_0x0429('0xa'),auth['isAuthenticated'](),controller[_0x0429('0x16')]);router[_0x0429('0x17')](_0x0429('0xa'),auth[_0x0429('0xb')](),controller['destroy']);router['delete'](_0x0429('0xe'),auth[_0x0429('0xb')](),controller[_0x0429('0x18')]);module['exports']=router; \ No newline at end of file +var _0x429c=['removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','/:id','update','delete','destroy'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x429c,0x1bc));var _0xc429=function(_0x176eb5,_0x5ef548){_0x176eb5=_0x176eb5-0x0;var _0xf66001=_0x429c[_0x176eb5];return _0xf66001;};'use strict';var multer=require(_0xc429('0x0'));var util=require('util');var path=require(_0xc429('0x1'));var timeout=require(_0xc429('0x2'));var express=require(_0xc429('0x3'));var router=express[_0xc429('0x4')]();var auth=require(_0xc429('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc429('0x6'));var controller=require(_0xc429('0x7'));router[_0xc429('0x8')]('/',auth[_0xc429('0x9')](),controller[_0xc429('0xa')]);router[_0xc429('0x8')](_0xc429('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc429('0x8')]('/:id/unread',auth[_0xc429('0x9')](),controller[_0xc429('0xc')]);router[_0xc429('0x8')](_0xc429('0xd'),auth[_0xc429('0x9')](),controller['getMembers']);router[_0xc429('0x8')](_0xc429('0xe'),auth[_0xc429('0x9')](),controller[_0xc429('0xf')]);router[_0xc429('0x10')]('/',auth[_0xc429('0x9')](),controller[_0xc429('0x11')]);router[_0xc429('0x10')](_0xc429('0xd'),auth['isAuthenticated'](),controller[_0xc429('0x12')]);router[_0xc429('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc429('0x13')]);router['put'](_0xc429('0x14'),auth['isAuthenticated'](),controller[_0xc429('0x15')]);router[_0xc429('0x16')](_0xc429('0x14'),auth[_0xc429('0x9')](),controller[_0xc429('0x17')]);router[_0xc429('0x16')](_0xc429('0xd'),auth[_0xc429('0x9')](),controller[_0xc429('0x18')]);module[_0xc429('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 011d744..e979d3e 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 _0xa96a=['sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa96a,0xa5));var _0xaa96=function(_0x30b8ad,_0x38cf22){_0x30b8ad=_0x30b8ad-0x0;var _0x260c2f=_0xa96a[_0x30b8ad];return _0x260c2f;};'use strict';var Sequelize=require(_0xaa96('0x0'));module['exports']={'closed':{'type':Sequelize[_0xaa96('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xaa96('0x2')]},'ratingType':{'type':Sequelize[_0xaa96('0x3')](_0xaa96('0x4'),_0xaa96('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xaa96('0x6')]},'pathTranscript':{'type':Sequelize[_0xaa96('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa96('0x7')]},'thirdDisposition':{'type':Sequelize[_0xaa96('0x7')]},'note':{'type':Sequelize[_0xaa96('0x7')]},'browserName':{'type':Sequelize[_0xaa96('0x7')]},'browserVersion':{'type':Sequelize[_0xaa96('0x7')]},'osName':{'type':Sequelize[_0xaa96('0x7')]},'osVersion':{'type':Sequelize[_0xaa96('0x7')]},'deviceModel':{'type':Sequelize[_0xaa96('0x7')]},'deviceVendor':{'type':Sequelize[_0xaa96('0x7')]},'deviceType':{'type':Sequelize[_0xaa96('0x7')]},'referer':{'type':Sequelize[_0xaa96('0x6')]},'customerIp':{'type':Sequelize[_0xaa96('0x7')]},'formData':{'type':Sequelize['TEXT'](_0xaa96('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xaa96('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xaa96('0x3')]('in',_0xaa96('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xaa96('0x7')]},'customerPort':{'type':Sequelize[_0xaa96('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xaa96('0x6')]}}; \ No newline at end of file +var _0xcca7=['ENUM','star','thumb','TEXT','STRING','DATE','out','exports','BOOLEAN'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcca7,0xe8));var _0x7cca=function(_0x419217,_0x1fe67f){_0x419217=_0x419217-0x0;var _0x234cea=_0xcca7[_0x419217];return _0x234cea;};'use strict';var Sequelize=require('sequelize');module[_0x7cca('0x0')]={'closed':{'type':Sequelize[_0x7cca('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x7cca('0x2')](_0x7cca('0x3'),_0x7cca('0x4')),'defaultValue':_0x7cca('0x3')},'ratingMessage':{'type':Sequelize[_0x7cca('0x5')]},'pathTranscript':{'type':Sequelize[_0x7cca('0x5')]},'mailTranscript':{'type':Sequelize[_0x7cca('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7cca('0x7')]},'disposition':{'type':Sequelize[_0x7cca('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7cca('0x6')]},'note':{'type':Sequelize[_0x7cca('0x6')]},'browserName':{'type':Sequelize[_0x7cca('0x6')]},'browserVersion':{'type':Sequelize[_0x7cca('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7cca('0x6')]},'deviceModel':{'type':Sequelize[_0x7cca('0x6')]},'deviceVendor':{'type':Sequelize[_0x7cca('0x6')]},'deviceType':{'type':Sequelize[_0x7cca('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7cca('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x7cca('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7cca('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7cca('0x2')]('in',_0x7cca('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7cca('0x6')]},'customerPort':{'type':Sequelize[_0x7cca('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7cca('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e839ea0..e7e73ee 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 _0xb846=['journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','length','keyBy','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','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','rows','show','params','create','body','update','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Attachment','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','CmContact','ContactId','format','%s%d','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','secret','includeAgent','setTags','spread','emit','removeTags','download','unix','server','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','direction','ChatWebsite','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','Owner','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','result','status','end','json','count','offset','set','reject','destroy','sendStatus','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','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','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','buildExpression','some','compact','isEmpty','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','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)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','ChatWebsiteId'];(function(_0x35c348,_0x377b7){var _0x14b47a=function(_0x24d855){while(--_0x24d855){_0x35c348['push'](_0x35c348['shift']());}};_0x14b47a(++_0x377b7);}(_0xb846,0x1d0));var _0x6b84=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb846[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x6b84('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b84('0x1'));var jsonpatch=require(_0x6b84('0x2'));var rp=require(_0x6b84('0x3'));var moment=require(_0x6b84('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b84('0x5'));var path=require(_0x6b84('0x6'));var sox=require(_0x6b84('0x7'));var csv=require(_0x6b84('0x8'));var ejs=require(_0x6b84('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b84('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6b84('0xb'));var toCsv=require(_0x6b84('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b84('0xc'));var qs=require(_0x6b84('0xd'));var as=require(_0x6b84('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6b84('0xf'));var config=require(_0x6b84('0x10'));var licenseUtil=require(_0x6b84('0x11'));var db=require(_0x6b84('0x12'))['db'];config[_0x6b84('0x13')]=_[_0x6b84('0x14')](config[_0x6b84('0x13')],{'host':_0x6b84('0x15'),'port':0x18eb});var socket=require(_0x6b84('0x16'))(new Redis(config[_0x6b84('0x13')]));require(_0x6b84('0x17'))[_0x6b84('0x18')](socket);var jayson=require(_0x6b84('0x19'));var client=jayson['client'][_0x6b84('0x1a')]({'port':0x232b});var client9004=jayson['client'][_0x6b84('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x2673ad,_0x33b0ac,_0x15714b,_0x100b1e){return new BPromise(function(_0x1ff8d9,_0x13496a){var _0x24a2ca=_0x100b1e||client;return _0x24a2ca[_0x6b84('0x1b')](_0x2673ad,_0x15714b)[_0x6b84('0x1c')](function(_0xd798f){logger[_0x6b84('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x33b0ac,_0x6b84('0x1e'));logger[_0x6b84('0x1f')](_0x6b84('0x20'),_0x33b0ac,_0x6b84('0x1e'),JSON[_0x6b84('0x21')](_0xd798f));if(_0xd798f[_0x6b84('0x22')]){if(_0xd798f['error']['code']===0x1f4){logger[_0x6b84('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x33b0ac,_0xd798f[_0x6b84('0x22')][_0x6b84('0x23')]);return _0x13496a(_0xd798f[_0x6b84('0x22')][_0x6b84('0x23')]);}logger['error'](_0x6b84('0x24'),_0x33b0ac,_0xd798f['error']['message']);return _0x1ff8d9(_0xd798f[_0x6b84('0x22')][_0x6b84('0x23')]);}else{logger[_0x6b84('0x1d')](_0x6b84('0x24'),_0x33b0ac,_0x6b84('0x1e'));_0x1ff8d9(_0xd798f[_0x6b84('0x25')][_0x6b84('0x23')]);}})['catch'](function(_0xb16a64){logger['error'](_0x6b84('0x24'),_0x33b0ac,_0xb16a64);_0x13496a(_0xb16a64);});});}function respondWithStatusCode(_0x2d99bc,_0x8674f0){_0x8674f0=_0x8674f0||0xcc;return function(_0x3617bc){if(_0x3617bc){return _0x2d99bc['sendStatus'](_0x8674f0);}return _0x2d99bc[_0x6b84('0x26')](_0x8674f0)[_0x6b84('0x27')]();};}function respondWithResult(_0x3355f1,_0x4d315a){_0x4d315a=_0x4d315a||0xc8;return function(_0x20bf16){if(_0x20bf16){return _0x3355f1['status'](_0x4d315a)[_0x6b84('0x28')](_0x20bf16);}};}function respondWithFilteredResult(_0x3a9873,_0x395880){return function(_0x599602){if(_0x599602){var _0x37b9e3=_0x599602[_0x6b84('0x29')],_0x2ae34f=_0x395880[_0x6b84('0x2a')],_0xba147=_0x395880['offset']+_0x395880['limit'],_0x1d3e0e;if(_0xba147>=_0x37b9e3){_0xba147=_0x37b9e3;_0x1d3e0e=0xc8;}else{_0x1d3e0e=0xce;}_0x3a9873[_0x6b84('0x26')](_0x1d3e0e);return _0x3a9873[_0x6b84('0x2b')]('Content-Range',_0x2ae34f+'-'+_0xba147+'/'+_0x37b9e3)['json'](_0x599602);}return null;};}function patchUpdates(_0x30fd96){return function(_0x5e0203){try{jsonpatch['apply'](_0x5e0203,_0x30fd96,!![]);}catch(_0x20f3a4){return BPromise[_0x6b84('0x2c')](_0x20f3a4);}return _0x5e0203['save']();};}function saveUpdates(_0x4713f9,_0x1a1899){return function(_0x39629e){if(_0x39629e){return _0x39629e['update'](_0x4713f9)['then'](function(_0x3304ea){return _0x3304ea;});}return null;};}function removeEntity(_0x4fe5a0,_0x30c63e){return function(_0x1ec6c9){if(_0x1ec6c9){return _0x1ec6c9[_0x6b84('0x2d')]()[_0x6b84('0x1c')](function(){_0x4fe5a0[_0x6b84('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x472266,_0x3bec64){return function(_0x5130d4){if(!_0x5130d4){_0x472266[_0x6b84('0x2e')](0x194);}return _0x5130d4;};}function handleError(_0xf8019,_0x3f7d28){_0x3f7d28=_0x3f7d28||0x1f4;return function(_0x6e2cc4){logger['error'](_0x6e2cc4[_0x6b84('0x2f')]);if(_0x6e2cc4['name']){delete _0x6e2cc4[_0x6b84('0x30')];}_0xf8019[_0x6b84('0x26')](_0x3f7d28)[_0x6b84('0x31')](_0x6e2cc4);};}function getInteractionUsers(_0x339164,_0x443cbc){return new BPromise(function(_0x3a9446,_0x982111){try{if(_0x443cbc[_0x339164['id']]){_0x339164[_0x6b84('0x32')]=_[_0x6b84('0x33')](_0x443cbc[_0x339164['id']],function(_0x462ddb){return{'id':_0x462ddb['id'],'fullname':_0x462ddb[_0x6b84('0x34')]};});}}catch(_0x51b535){_0x982111(_0x51b535);}_0x3a9446(_0x339164);});}function getInteractionTags(_0x183761,_0x440185){return new BPromise(function(_0x2a4dc2,_0x4061f0){try{if(_0x183761['TagIds']){_0x183761[_0x6b84('0x35')]=[];_0x183761[_0x6b84('0x36')][_0x6b84('0x37')](',')[_0x6b84('0x38')](function(_0x4e1be2){_0x183761[_0x6b84('0x35')][_0x6b84('0x39')](_0x440185[_0x4e1be2]);});}delete _0x183761['TagIds'];}catch(_0x2d99e6){_0x4061f0(_0x2d99e6);}_0x2a4dc2(_0x183761);});}function updateChatInteraction(_0x133592,_0x58964f,_0x1c468a){return new BPromise(function(_0x3c2b3f,_0x19c9af){return getInteractionUsers(_0x133592,_0x1c468a)[_0x6b84('0x1c')](function(_0x49637b){return getInteractionTags(_0x49637b,_0x58964f);})['then'](function(_0x13052d){_0x3c2b3f(_0x13052d);})[_0x6b84('0x3a')](function(_0x201c2f){_0x19c9af(_0x201c2f);});});}exports[_0x6b84('0x3b')]=function(_0x3bb31f,_0x5a8913){var _0x1624cc={},_0x5d4761={},_0x10f7f4={'count':0x0,'rows':[]};var _0x1e23ae=_[_0x6b84('0x33')](db[_0x6b84('0x3c')][_0x6b84('0x3d')],function(_0x462d80){return{'name':_0x462d80[_0x6b84('0x3e')],'type':_0x462d80[_0x6b84('0x3f')][_0x6b84('0x40')]};});_0x5d4761[_0x6b84('0x41')]=_[_0x6b84('0x33')](_0x1e23ae,_0x6b84('0x30'));_0x5d4761[_0x6b84('0x42')]=_[_0x6b84('0x43')](_0x3bb31f['query']);_0x5d4761[_0x6b84('0x44')]=_['intersection'](_0x5d4761[_0x6b84('0x41')],_0x5d4761[_0x6b84('0x42')]);_0x1624cc[_0x6b84('0x45')]=_[_0x6b84('0x46')](_0x5d4761['model'],qs['fields'](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x47')]));_0x1624cc[_0x6b84('0x45')]=_0x1624cc[_0x6b84('0x45')]['length']?_0x1624cc[_0x6b84('0x45')]:_0x5d4761['model'];if(!_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x48')](_0x6b84('0x49'))){_0x1624cc[_0x6b84('0x4a')]=qs['limit'](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x4a')]);_0x1624cc['offset']=qs[_0x6b84('0x2a')](_0x3bb31f[_0x6b84('0x42')]['offset']);}_0x1624cc[_0x6b84('0x4b')]=qs['sort'](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x4c')]);_0x1624cc[_0x6b84('0x4d')]=qs['filters'](_[_0x6b84('0x4e')](_0x3bb31f['query'],_0x5d4761['filters']),_0x1e23ae);var _0x2dbd22=[];var _0x12c25c=squel['select']()[_0x6b84('0x4f')]('id')[_0x6b84('0x4f')](_0x6b84('0x30'))[_0x6b84('0x4f')](_0x6b84('0x50'))[_0x6b84('0x51')]('tools_tags');var _0x84ea38=squel[_0x6b84('0x52')]()['field']('u.id')['field'](_0x6b84('0x53'))[_0x6b84('0x4f')](_0x6b84('0x54'))[_0x6b84('0x51')](_0x6b84('0x55'),'ui')[_0x6b84('0x56')](_0x6b84('0x57'),'u',_0x6b84('0x58'));var _0x35b6fd=squel[_0x6b84('0x52')]()['from'](_0x6b84('0x59'),'i')[_0x6b84('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6b84('0x56')](_0x6b84('0x57'),'o',_0x6b84('0x5a'))['left_join'](_0x6b84('0x5b'),'a',_0x6b84('0x5c'))[_0x6b84('0x56')](_0x6b84('0x5d'),'me',_0x6b84('0x5e'))[_0x6b84('0x56')]('chat_interaction_has_tags','it',_0x6b84('0x5f'))[_0x6b84('0x56')]('tools_tags','t',_0x6b84('0x60'));var _0x3b997e=squel[_0x6b84('0x61')]();var _0x2639ee=[];var _0x2a538c=squel['expr']();var _0x15c4a8;if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x62')]){_0x15c4a8=as['parseSearch'](_0x3bb31f['query']['search']);var _0x314e71=_0x15c4a8['sqlOperator'];for(var _0x37256c=0x0;_0x37256c<_0x15c4a8[_0x6b84('0x63')]['length'];_0x37256c++){var _0x2a79f9=_0x15c4a8[_0x6b84('0x63')][_0x37256c];var _0x291305='i';var _0x86b94d=_[_0x6b84('0x64')](_0x1e23ae,[_0x6b84('0x30'),_0x2a79f9[_0x6b84('0x4f')]]);if(!_0x86b94d){switch(_0x2a79f9[_0x6b84('0x4f')]){case _0x6b84('0x65'):if(_0x2a79f9[_0x6b84('0x66')]==0x1){_0x35b6fd['having']('`'+_0x2a79f9[_0x6b84('0x4f')]+_0x6b84('0x67'));}else{_0x35b6fd[_0x6b84('0x68')]('`'+_0x2a79f9[_0x6b84('0x4f')]+_0x6b84('0x69'));}break;case'Contact':if(_0x2a79f9['operator']===_0x6b84('0x6a')){if(_0x2a79f9['value']['split']('\x20')['length']>0x1){_0x3b997e[_0x314e71](_0x6b84('0x6b'),qs[_0x6b84('0x6c')](_0x2a79f9['value']),null);}else{var _0x50a894='%'+_0x2a79f9['value']+'%';_0x3b997e[_0x314e71]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x50a894,_0x50a894,_0x50a894);}}else{_0x86b94d=_['find'](_0x1e23ae,[_0x6b84('0x30'),'ContactId']);_0x2a79f9[_0x6b84('0x4f')]='ContactId';_0x50f2c9=as['buildExpression'](_0x291305,_0x86b94d['type'],_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9['text'],_0x50f2c9['value'][_0x6b84('0x6d')],_0x50f2c9['value']['end']);}break;case _0x6b84('0x6e'):var _0x15456e=_0x2a79f9[_0x6b84('0x66')][_0x6b84('0x37')](',')[_0x6b84('0x33')](function(_0xa05e99){return Number(_0xa05e99);});_0x15456e[_0x6b84('0x38')](function(_0x3b625c){_0x2a538c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3b625c+',%');});_0x2639ee=_[_0x6b84('0x6f')](_0x2639ee,_0x15456e);break;case _0x6b84('0x70'):if(_0x2a79f9['operator']===_0x6b84('0x6a')){_0x3b997e[_0x314e71](_0x6b84('0x71'),'%'+_0x2a79f9[_0x6b84('0x66')]+'%',null);}else{_0x86b94d=_[_0x6b84('0x64')](_0x1e23ae,['name',_0x6b84('0x72')]);_0x2a79f9['field']=_0x6b84('0x72');_0x50f2c9=as['buildExpression'](_0x291305,_0x86b94d['type'],_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9[_0x6b84('0x73')],_0x50f2c9[_0x6b84('0x66')]['start'],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x27')]);}break;case'body':_0x50f2c9=as[_0x6b84('0x74')]('me',null,_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9[_0x6b84('0x73')],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x6d')],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x27')]);break;}}else{var _0x50f2c9=as[_0x6b84('0x74')](_0x291305,_0x86b94d[_0x6b84('0x3f')],_0x2a79f9);_0x3b997e[_0x314e71](_0x50f2c9[_0x6b84('0x73')],_0x50f2c9[_0x6b84('0x66')][_0x6b84('0x6d')],_0x50f2c9[_0x6b84('0x66')]['end']);}}}else{var _0x12b407=_(_0x3bb31f['query'])['keys']()[_0x6b84('0x33')](function(_0x186fc4){return _[_0x6b84('0x75')](_0x1e23ae,[_0x6b84('0x30'),_0x186fc4])?_0x186fc4:undefined;})[_0x6b84('0x76')]()[_0x6b84('0x66')]();if(!_[_0x6b84('0x77')](_0x12b407)){_0x12b407[_0x6b84('0x38')](function(_0x1aac98){if(_0x1aac98==='ChatWebsiteId'){_0x35b6fd['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x6b84('0x78')](_0x3bb31f[_0x6b84('0x42')][_0x1aac98]));}else if(_0x1aac98===_0x6b84('0x79')){var _0x251800=JSON[_0x6b84('0x7a')](_0x3bb31f[_0x6b84('0x42')][_0x1aac98])[_0x6b84('0x7b')];var _0x54722a=JSON[_0x6b84('0x7a')](_0x3bb31f[_0x6b84('0x42')][_0x1aac98])['$lte'];_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x7c'),_0x251800,_0x54722a);}else{if(_0x3bb31f[_0x6b84('0x42')][_0x1aac98]===_0x6b84('0x7d')){_0x35b6fd[_0x6b84('0x4d')]('i.'+_0x1aac98+_0x6b84('0x7e'));}else{_0x35b6fd[_0x6b84('0x4d')]('i.'+_0x1aac98+_0x6b84('0x7f'),_0x3bb31f['query'][_0x1aac98]);}}});}if(_0x3bb31f['query'][_0x6b84('0x80')]){if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x80')]==0x1){_0x35b6fd[_0x6b84('0x68')]('`unreadMessages`\x20=\x200');}else{_0x35b6fd[_0x6b84('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')]){_0x2639ee=_[_0x6b84('0x82')](_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')])?_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')]:new Array(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x81')]);_0x2639ee[_0x6b84('0x38')](function(_0x2b149d){_0x2a538c['or'](_0x6b84('0x83'),'%,'+_0x2b149d+',%');});}if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x84')]){var _0x21f065=_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x84')][_0x6b84('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6b84('0x86')](_0x21f065)){_0x3b997e['or'](_0x6b84('0x87'),_0x21f065+'%');}else{_0x3b997e['or'](_0x6b84('0x88'),qs['getFullTextValue'](_0x21f065))['or'](_0x6b84('0x89'),_0x21f065+'%');}}}_0x35b6fd[_0x6b84('0x4d')](_0x3b997e);_0x35b6fd[_0x6b84('0x8a')]('i.id');var _0x4cb50f={'type':db[_0x6b84('0x8b')][_0x6b84('0x8c')][_0x6b84('0x8d')],'raw':!![]};var _0x1d0919=_0x35b6fd['clone']();_0x1d0919[_0x6b84('0x4f')](_0x6b84('0x8e'));_0x1d0919[_0x6b84('0x4f')](_0x6b84('0x8f'),'unreadMessages');if(_0x1624cc[_0x6b84('0x4b')]){_0x1624cc[_0x6b84('0x4b')]['forEach'](function(_0xb8e528){var _0x2c334c=_0xb8e528[0x0]===_0x6b84('0x90')?_0xb8e528[0x0]:'i.'+_0xb8e528[0x0];_0x35b6fd['order'](_0x2c334c,_0xb8e528[0x1]===_0x6b84('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x2639ee)){_0x35b6fd['having'](_0x2a538c);_0x1d0919[_0x6b84('0x4d')](_0x6b84('0x92'),_0x2639ee);}BPromise['resolve']()[_0x6b84('0x1c')](function(){if(!_0x15c4a8){if(_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x93')]||_0x3bb31f['query'][_0x6b84('0x94')])return;_0x1d0919[_0x6b84('0x4d')](_0x6b84('0x95'));_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x95'));return;}if(_0x3bb31f[_0x6b84('0x96')][_0x6b84('0x97')]!==_0x6b84('0x98'))return;return _0x3bb31f[_0x6b84('0x96')][_0x6b84('0x99')]({'attributes':['id'],'raw':!![]})[_0x6b84('0x1c')](function(_0x10f13a){if(_[_0x6b84('0x77')](_0x10f13a)){_0x1d0919[_0x6b84('0x4d')](_0x6b84('0x9a'));_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x9a'));}else{_0x1d0919['where'](_0x6b84('0x9b'),_[_0x6b84('0x33')](_0x10f13a,'id'));_0x35b6fd[_0x6b84('0x4d')](_0x6b84('0x9b'),_[_0x6b84('0x33')](_0x10f13a,'id'));}});})[_0x6b84('0x1c')](function(){if(_0x3bb31f[_0x6b84('0x96')][_0x6b84('0x97')]===_0x6b84('0x98')&&!_0x15c4a8&&!_0x3bb31f[_0x6b84('0x42')][_0x6b84('0x93')])return[];return db[_0x6b84('0x9c')][_0x6b84('0x42')](_0x1d0919[_0x6b84('0x9d')](),_0x4cb50f);})[_0x6b84('0x1c')](function(_0x2b18ec){_0x10f7f4[_0x6b84('0x29')]=_0x2b18ec[_0x6b84('0x9e')];if(_0x10f7f4[_0x6b84('0x29')]===0x0)return[];return db[_0x6b84('0x9c')]['query'](_0x12c25c['toString'](),_0x4cb50f)[_0x6b84('0x1c')](function(_0x41d6af){_0x2dbd22=_[_0x6b84('0x9f')](_0x41d6af,'id');_0x4cb50f=_[_0x6b84('0xa0')](_0x4cb50f,{'model':db[_0x6b84('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bb31f['query'][_0x6b84('0x47')]){_0x1624cc[_0x6b84('0x45')][_0x6b84('0x38')](function(_0x7fc0b8){_0x35b6fd[_0x6b84('0x4f')]('i.'+_0x7fc0b8);});}else{_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0x8f'),_0x6b84('0x65'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa1'),'Account.key');_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa2'),'Account.mandatoryDisposition');_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa3'),_0x6b84('0x90'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa4'));_0x35b6fd['field'](_0x6b84('0xa5'),_0x6b84('0xa6'));_0x35b6fd[_0x6b84('0x4f')]('c.lastName',_0x6b84('0xa7'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xa8'),'Contact.email');_0x35b6fd['field']('c.phone',_0x6b84('0xa9'));_0x35b6fd['field'](_0x6b84('0xaa'),_0x6b84('0xab'));_0x35b6fd['field'](_0x6b84('0xac'),_0x6b84('0xad'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xae'),_0x6b84('0xaf'));_0x35b6fd[_0x6b84('0x4f')](_0x6b84('0xb0'),_0x6b84('0xb1'));_0x35b6fd['field'](_0x6b84('0xb2'),_0x6b84('0x36'));}if(_0x1624cc[_0x6b84('0x4a')])_0x35b6fd[_0x6b84('0x4a')](_0x1624cc[_0x6b84('0x4a')]);if(_0x1624cc[_0x6b84('0x2a')])_0x35b6fd[_0x6b84('0x2a')](_0x1624cc[_0x6b84('0x2a')]);return db[_0x6b84('0x9c')][_0x6b84('0x42')](_0x35b6fd[_0x6b84('0x9d')](),_0x4cb50f);})[_0x6b84('0x1c')](function(_0x503033){_0x84ea38[_0x6b84('0x4d')](_0x6b84('0xb3'),_[_0x6b84('0x33')](_0x503033,'id'));return db['sequelize'][_0x6b84('0x42')](_0x84ea38[_0x6b84('0x9d')](),_0x4cb50f)[_0x6b84('0x1c')](function(_0x33b7e8){var _0x58c0f6=_[_0x6b84('0xb4')](_0x33b7e8,_0x6b84('0xb5'));var _0x292908=[];_0x503033[_0x6b84('0x38')](function(_0x2c5bff){_0x292908[_0x6b84('0x39')](updateChatInteraction(_0x2c5bff,_0x2dbd22,_0x58c0f6));});return BPromise['all'](_0x292908);});});})[_0x6b84('0x1c')](function(_0x1e2ba4){_0x10f7f4[_0x6b84('0xb6')]=_0x1e2ba4;return _0x10f7f4;})[_0x6b84('0x1c')](respondWithFilteredResult(_0x5a8913,_0x1624cc))[_0x6b84('0x3a')](handleError(_0x5a8913,null));};exports[_0x6b84('0xb7')]=function(_0x3e6a36,_0xca9c19){var _0x509bf9={'raw':![],'where':{'id':_0x3e6a36[_0x6b84('0xb8')]['id']}},_0x179966={};_0x179966[_0x6b84('0x41')]=_[_0x6b84('0x43')](db[_0x6b84('0x3c')][_0x6b84('0x3d')]);_0x179966[_0x6b84('0x42')]=_['keys'](_0x3e6a36['query']);_0x179966[_0x6b84('0x44')]=_[_0x6b84('0x46')](_0x179966[_0x6b84('0x41')],_0x179966[_0x6b84('0x42')]);_0x509bf9[_0x6b84('0x45')]=_['intersection'](_0x179966[_0x6b84('0x41')],qs[_0x6b84('0x47')](_0x3e6a36[_0x6b84('0x42')][_0x6b84('0x47')]));_0x509bf9[_0x6b84('0x45')]=_0x509bf9[_0x6b84('0x45')]['length']?_0x509bf9[_0x6b84('0x45')]:_0x179966['model'];if(_0x3e6a36[_0x6b84('0x42')]['includeAll']){_0x509bf9['include']=[{'all':!![]}];}_0x509bf9=_['merge']({},_0x509bf9,_0x3e6a36['options']);return db['ChatInteraction'][_0x6b84('0x64')](_0x509bf9)[_0x6b84('0x1c')](handleEntityNotFound(_0xca9c19,null))['then'](respondWithResult(_0xca9c19,null))['catch'](handleError(_0xca9c19,null));};exports[_0x6b84('0xb9')]=function(_0x255fb5,_0x2bc84f){return db[_0x6b84('0x3c')][_0x6b84('0xb9')](_0x255fb5[_0x6b84('0xba')],{})['then'](respondWithResult(_0x2bc84f,0xc9))['catch'](handleError(_0x2bc84f,null));};exports[_0x6b84('0xbb')]=function(_0x23a521,_0x3a6287){if(_0x23a521[_0x6b84('0xba')]['id']){delete _0x23a521[_0x6b84('0xba')]['id'];}return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x23a521[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x3a6287,null))['then'](saveUpdates(_0x23a521['body'],null))[_0x6b84('0x1c')](respondWithResult(_0x3a6287,null))[_0x6b84('0x3a')](handleError(_0x3a6287,null));};exports[_0x6b84('0x2d')]=function(_0x536a25,_0x8a89c1){return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x536a25[_0x6b84('0xb8')]['id']}})['then'](handleEntityNotFound(_0x8a89c1,null))[_0x6b84('0x1c')](removeEntity(_0x8a89c1,null))['catch'](handleError(_0x8a89c1,null));};exports['describe']=function(_0x1723b2,_0x1afd92){return db[_0x6b84('0x3c')][_0x6b84('0xbc')]()[_0x6b84('0x1c')](respondWithResult(_0x1afd92,null))[_0x6b84('0x3a')](handleError(_0x1afd92,null));};exports[_0x6b84('0xbd')]=function(_0x3201b2,_0x57f0b7){var _0x28d284=_0x3201b2[_0x6b84('0xb8')]['id'];var _0x3fa193;var _0x474695;var _0xc1a7b7;return db['ChatInteraction']['findOne']({'where':{'id':_0x28d284}})['then'](function(_0x568962){_0x3fa193=_0x568962;return db['ChatWebsite'][_0x6b84('0xbe')]({'where':{'id':_0x568962['ChatWebsiteId']},'attributes':['id',_0x6b84('0xbf'),_0x6b84('0xc0')],'raw':!![]});})[_0x6b84('0x1c')](function(_0x3a8976){if(_0x3a8976&&_0x3a8976[_0x6b84('0xbf')]&&_0x3a8976[_0x6b84('0xc0')]){_0x474695=_0x3a8976;var _0x38ea5f={'rejectUnauthorized':![],'method':'POST','uri':_0x6b84('0xc1'),'headers':{'X-APIKEY':_0x3a8976[_0x6b84('0xbf')]},'body':{'name':_0x6b84('0xc2')+_0x28d284},'redirect':_0x6b84('0xc3'),'json':!![]};return rp(_0x38ea5f);}else{throw new db[(_0x6b84('0x8b'))][(_0x6b84('0xc4'))](_0x6b84('0xc5'));}})[_0x6b84('0x1c')](function(_0x5a19a1){_0xc1a7b7=_0x5a19a1;if(_0xc1a7b7['id']){var _0x1be09d={'body':_0xc1a7b7[_0x6b84('0xc6')],'ChatWebsiteId':_0x474695['id'],'ChatInteractionId':_0x3fa193['id'],'direction':_0x6b84('0xc7'),'UserId':_0x3201b2[_0x6b84('0x96')]['id']};return db[_0x6b84('0xc8')][_0x6b84('0xb9')](_0x1be09d,{});}else{throw new db[(_0x6b84('0x8b'))]['ValidationError'](_0x6b84('0xc9'));}})['then'](function(){return _0x3fa193[_0x6b84('0xca')]({'vidaooSessionId':_0xc1a7b7['id']});})[_0x6b84('0x1c')](respondWithResult(_0x57f0b7,null))['catch'](handleError(_0x57f0b7,null));};exports['customUpdate']=function(_0x488ac0,_0x3d06a3){if(_0x488ac0['body']['id']){delete _0x488ac0[_0x6b84('0xba')]['id'];}return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x488ac0['params']['id']}})['then'](handleEntityNotFound(_0x3d06a3,null))[_0x6b84('0x1c')](saveUpdates(_0x488ac0[_0x6b84('0xba')],null))[_0x6b84('0x1c')](respondWithResult(_0x3d06a3,null))[_0x6b84('0x3a')](handleError(_0x3d06a3,null));};exports[_0x6b84('0xcb')]=function(_0x37a63f,_0x2eb1fc,_0x27509c){if(_0x37a63f[_0x6b84('0xba')]['id']){delete _0x37a63f[_0x6b84('0xba')]['id'];}return db[_0x6b84('0x3c')]['find']({'where':{'id':_0x37a63f[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](function(_0x76be9b){if(!_0x76be9b){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x6b84('0xcc'));_0x2eb1fc[_0x6b84('0x2e')](0x194);}else{if(_0x76be9b[_0x6b84('0x72')]){throw new db[(_0x6b84('0x8b'))]['ValidationError'](_0x6b84('0xcd'));}}return _0x76be9b;})['then'](function(_0x5b4561){if(_0x5b4561){return _0x5b4561['update']({'closed':_0x37a63f[_0x6b84('0xba')]['closed'],'disposition':_0x37a63f[_0x6b84('0xba')][_0x6b84('0xce')]})['then'](function(_0x341856){return _0x341856;});}})[_0x6b84('0x1c')](function(_0x13149c){return respondWithRpcPromise(_0x6b84('0xcf'),'abandon',_0x37a63f[_0x6b84('0xba')],client9004);})[_0x6b84('0x1c')](respondWithResult(_0x2eb1fc,null))[_0x6b84('0x3a')](handleError(_0x2eb1fc,null));};exports['attachmentUpload']=function(_0x2d6e37,_0x4cd4cd,_0x32b8b6){_0x2d6e37[_0x6b84('0xba')][_0x6b84('0x30')]=_0x2d6e37[_0x6b84('0xd0')][_0x6b84('0xd1')];_0x2d6e37['body'][_0x6b84('0xd2')]=_0x2d6e37[_0x6b84('0xd0')][_0x6b84('0xd3')];_0x2d6e37[_0x6b84('0xba')][_0x6b84('0x3f')]=_0x2d6e37[_0x6b84('0xd0')][_0x6b84('0xd4')];return db['Attachment'][_0x6b84('0xb9')](_0x2d6e37[_0x6b84('0xba')])[_0x6b84('0x1c')](respondWithResult(_0x4cd4cd,0xc9))[_0x6b84('0x3a')](handleError(_0x4cd4cd,null));};exports[_0x6b84('0xd5')]=function(_0x3b918e,_0x517ddd,_0x2dcecc){return db['ChatInteraction']['findOne']({'where':{'id':_0x3b918e['params']['id']},'raw':!![]})[_0x6b84('0x1c')](handleEntityNotFound(_0x517ddd,null))[_0x6b84('0x1c')](function(_0x2bf73b){if(_0x2bf73b){if(_0x2bf73b[_0x6b84('0xd6')]){return _0x517ddd[_0x6b84('0x26')](0x193)[_0x6b84('0x28')]({'status':0x193,'message':'Unauthorized'});}return db[_0x6b84('0xd7')][_0x6b84('0xbe')]({'where':{'id':_0x3b918e[_0x6b84('0x42')][_0x6b84('0xd8')]},'raw':!![]})[_0x6b84('0x1c')](handleEntityNotFound(_0x517ddd,null));}})['then'](function(_0x214d93){if(_0x214d93){return _0x517ddd['download'](path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0xdb'),_0x214d93[_0x6b84('0xd2')]));}})[_0x6b84('0x3a')](handleError(_0x517ddd,null));};exports[_0x6b84('0xdc')]=function(_0x2ff772,_0x46298d){var _0x2f59d1=null;var _0x2407dd=null;var _0x5d3b4a=null;var _0x159b1e=null;if(_0x2ff772['body']['id']){delete _0x2ff772['body']['id'];}if(_0x2ff772[_0x6b84('0xba')][_0x6b84('0xdd')]){_0x159b1e=path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0xde'),util['format'](_0x6b84('0xdf'),Date['now']()));_0x2ff772[_0x6b84('0xba')][_0x6b84('0xe0')]=_0x159b1e;}return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x2ff772['params']['id']},'include':[{'model':db[_0x6b84('0xc8')],'as':_0x6b84('0xe1'),'include':[{'model':db[_0x6b84('0x70')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x46298d,null))[_0x6b84('0x1c')](saveUpdates(_0x2ff772[_0x6b84('0xba')],null))['then'](function(_0x440fb8){if(_0x440fb8){_0x2f59d1=_0x440fb8;return db['ChatWebsite'][_0x6b84('0x64')]({'where':{'id':_0x2f59d1[_0x6b84('0x93')]}});}})[_0x6b84('0x1c')](function(_0xcf7da9){if(_0xcf7da9){_0x5d3b4a=_0xcf7da9;return db[_0x6b84('0xe2')][_0x6b84('0x64')]({'where':{'id':_0x2f59d1[_0x6b84('0xe3')]}});}})['then'](function(_0x560b4a){if(_0x560b4a){_0x2407dd=_0x560b4a;if(_0x159b1e){var _0x4d99b6=null;for(var _0x57dd80=0x1;_0x57dd80<_0x2f59d1[_0x6b84('0xe1')]['length'];++_0x57dd80){_0x4d99b6=_0x2f59d1[_0x6b84('0xe1')][_0x57dd80];var _0x2e127b=_0x4d99b6['UserId']?util[_0x6b84('0xe4')](_0x6b84('0xe5'),_0x5d3b4a[_0x6b84('0xe6')],_0x4d99b6[_0x6b84('0x72')]):_0x6b84('0xe7');var _0x5b8981=_0x2ff772[_0x6b84('0xba')]['customer']||util['format'](_0x6b84('0xe5'),_0x6b84('0xe8'),_0x4d99b6[_0x6b84('0xe3')]);switch(_0x5d3b4a[_0x6b84('0xe9')]){case'website_alias':_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?util[_0x6b84('0xe4')](_0x6b84('0xe5'),_0x5d3b4a[_0x6b84('0xe6')],_0x4d99b6[_0x6b84('0x72')]):_0x6b84('0xe7');break;case _0x6b84('0xea'):_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?_0x4d99b6[_0x6b84('0x70')][_0x6b84('0xeb')]||_0x4d99b6['User']['fullname']:'System';break;case'agent_fullname':_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?_0x4d99b6[_0x6b84('0x70')][_0x6b84('0x34')]:_0x6b84('0xe7');break;default:_0x2e127b=_0x4d99b6[_0x6b84('0x72')]?util['format'](_0x6b84('0xe5'),_0x5d3b4a[_0x6b84('0xe6')],_0x4d99b6[_0x6b84('0x72')]):_0x6b84('0xe7');}var _0x2e8d45=util[_0x6b84('0xe4')](_0x6b84('0xec'),moment(_0x4d99b6[_0x6b84('0x79')])[_0x6b84('0xe4')](_0x6b84('0xed')),_0x4d99b6['direction']==='in'?_0x5b8981:_0x2e127b,_0x4d99b6[_0x6b84('0xba')]);if(!_0x4d99b6['secret']){fs['appendFileSync'](_0x159b1e,_0x2e8d45);}}return db[_0x6b84('0xee')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x6b84('0xef')],'as':_0x6b84('0xf0'),'raw':!![]}]});}}})['then'](function(_0x5b5bd7){if(_0x5b5bd7&&_0x5b5bd7[_0x6b84('0xf0')]&&_0x2ff772[_0x6b84('0xba')]){var _0x9067cd={'tls':{'rejectUnauthorized':![]}};if(_0x5b5bd7[_0x6b84('0xf0')]['service']){_0x9067cd[_0x6b84('0xf1')]=_0x5b5bd7['Smtp']['service'];}else{_0x9067cd[_0x6b84('0xf2')]=_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0xf2')];_0x9067cd[_0x6b84('0xf3')]=_0x5b5bd7[_0x6b84('0xf0')]['port'];_0x9067cd[_0x6b84('0xf4')]=_0x5b5bd7['Smtp']['secure'];}if(_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0xf5')]){_0x9067cd[_0x6b84('0xf6')]={'user':_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0x96')],'pass':_0x5b5bd7[_0x6b84('0xf0')][_0x6b84('0xf7')]};}return respondWithRpcPromise(_0x6b84('0xf8'),_0x6b84('0xf9'),{'account':_0x9067cd,'message':{'from':util['format'](_0x6b84('0xfa'),_0x5b5bd7[_0x6b84('0x30')],_0x5b5bd7['email']||_0x5b5bd7[_0x6b84('0xf0')]['user']),'to':_0x2ff772[_0x6b84('0xba')][_0x6b84('0xdd')],'subject':_0x6b84('0xfb'),'text':util[_0x6b84('0xe4')](_0x6b84('0xfc'),_0x2ff772['body'][_0x6b84('0xdd')]),'attachments':[{'path':_0x159b1e}]}})['then'](function(){return _0x2f59d1;})[_0x6b84('0x3a')](function(_0x3e2ef4){console[_0x6b84('0x22')](_0x3e2ef4);});}else{return _0x2f59d1;}})[_0x6b84('0x1c')](respondWithStatusCode(_0x46298d,0xc8))[_0x6b84('0x3a')](handleError(_0x46298d,null));};exports[_0x6b84('0xfd')]=function(_0x46b5ee,_0x11bfa1,_0x5cc307){return db[_0x6b84('0xc8')][_0x6b84('0x64')]({'where':{'id':_0x46b5ee[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x11bfa1,null))[_0x6b84('0x1c')](function(_0x521213){if(_0x521213){return _0x521213[_0x6b84('0xfd')](_0x46b5ee['body'][_0x6b84('0xfe')],_[_0x6b84('0xff')](_0x46b5ee[_0x6b84('0xba')],[_0x6b84('0xfe'),'id'])||{});}})[_0x6b84('0x1c')](respondWithResult(_0x11bfa1,null))['catch'](handleError(_0x11bfa1,null));};exports[_0x6b84('0x100')]=function(_0x279bf,_0x458734,_0x3d10e3){var _0x39b58d={'raw':![],'where':{}};var _0xf19321={};var _0x3185e4={'count':0x0,'rows':[]};return db[_0x6b84('0x3c')]['findOne']({'where':{'id':_0x279bf['params']['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x458734,null))[_0x6b84('0x1c')](function(_0x571eb0){if(_0x571eb0){_0xf19321[_0x6b84('0x41')]=_[_0x6b84('0x43')](db[_0x6b84('0xc8')][_0x6b84('0x3d')]);_0xf19321['query']=_[_0x6b84('0x43')](_0x279bf[_0x6b84('0x42')]);_0xf19321[_0x6b84('0x44')]=_['intersection'](_0xf19321[_0x6b84('0x41')],_0xf19321[_0x6b84('0x42')]);_0x39b58d[_0x6b84('0x45')]=_[_0x6b84('0x46')](_0xf19321[_0x6b84('0x41')],qs[_0x6b84('0x47')](_0x279bf[_0x6b84('0x42')][_0x6b84('0x47')]));_0x39b58d[_0x6b84('0x45')]=_0x39b58d[_0x6b84('0x45')][_0x6b84('0x9e')]?_0x39b58d[_0x6b84('0x45')]:_0xf19321['model'];if(!_0x279bf[_0x6b84('0x42')][_0x6b84('0x48')]('nolimit')){_0x39b58d['limit']=qs['limit'](_0x279bf[_0x6b84('0x42')][_0x6b84('0x4a')]);_0x39b58d[_0x6b84('0x2a')]=qs['offset'](_0x279bf[_0x6b84('0x42')]['offset']);}_0x39b58d[_0x6b84('0x4b')]=qs[_0x6b84('0x4c')](_0x279bf[_0x6b84('0x42')][_0x6b84('0x4c')]);_0x39b58d['where']=qs['filters'](_[_0x6b84('0x4e')](_0x279bf[_0x6b84('0x42')],_0xf19321[_0x6b84('0x44')]));_0x39b58d[_0x6b84('0x4d')][_0x6b84('0xb5')]=_0x571eb0['id'];if(_0x279bf[_0x6b84('0x42')][_0x6b84('0x84')]){_0x39b58d[_0x6b84('0x4d')]=_[_0x6b84('0xa0')](_0x39b58d[_0x6b84('0x4d')],{'$or':_[_0x6b84('0x33')](_0x39b58d[_0x6b84('0x45')],function(_0x5eb70f){var _0xd4e51a={};_0xd4e51a[_0x5eb70f]={'$like':'%'+_0x279bf[_0x6b84('0x42')]['filter']+'%'};return _0xd4e51a;})});}if(_0x279bf['query']['$gte']){var _0x2e4f2b=_0x279bf[_0x6b84('0x42')][_0x6b84('0x7b')][_0x6b84('0x37')](',');var _0x2307f7={};_0x2307f7[_0x2e4f2b[0x0]]={'$gte':moment(_0x2e4f2b[0x1])[_0x6b84('0xe4')](_0x6b84('0x101'))};_0x39b58d[_0x6b84('0x4d')]=_[_0x6b84('0xa0')](_0x39b58d[_0x6b84('0x4d')],_0x2307f7);}_0x39b58d=_['merge']({},_0x39b58d,_0x279bf[_0x6b84('0x102')]);return db[_0x6b84('0xc8')][_0x6b84('0x29')]({'where':_0x39b58d['where']})['then'](function(_0x5bca81){_0x3185e4['count']=_0x5bca81;if(_0x279bf[_0x6b84('0x42')]['includeAll']){_0x39b58d[_0x6b84('0x103')]=[{'all':!![]}];}return db[_0x6b84('0xc8')][_0x6b84('0x104')](_0x39b58d);})[_0x6b84('0x1c')](function(_0x139125){_0x3185e4['rows']=_0x139125;return _0x3185e4;});}})[_0x6b84('0x1c')](respondWithFilteredResult(_0x458734,_0x39b58d))[_0x6b84('0x3a')](handleError(_0x458734,null));};exports['getMyMessages']=function(_0x6bacf6,_0x578f7b,_0x5a6295){var _0x4e4d7f={'where':{}},_0x2d2cb9={},_0x4179d5={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x6bacf6['params']['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x578f7b,null))['then'](function(_0x47e197){if(_0x47e197){_0x2d2cb9['model']=_['keys'](db[_0x6b84('0xc8')]['rawAttributes']);_0x2d2cb9[_0x6b84('0x42')]=_[_0x6b84('0x43')](_0x6bacf6[_0x6b84('0x42')]);_0x2d2cb9[_0x6b84('0x44')]=_[_0x6b84('0x46')](_0x2d2cb9[_0x6b84('0x41')],_0x2d2cb9[_0x6b84('0x42')]);_0x4e4d7f[_0x6b84('0x45')]=_[_0x6b84('0x46')](_0x2d2cb9[_0x6b84('0x41')],qs[_0x6b84('0x47')](_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x47')]));_0x4e4d7f[_0x6b84('0x45')]=_0x4e4d7f[_0x6b84('0x45')][_0x6b84('0x9e')]?_0x4e4d7f['attributes']:_0x2d2cb9[_0x6b84('0x41')];if(!_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x48')]('nolimit')){_0x4e4d7f['limit']=qs[_0x6b84('0x4a')](_0x6bacf6['query'][_0x6b84('0x4a')]);_0x4e4d7f['offset']=qs[_0x6b84('0x2a')](_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x2a')]);}_0x4e4d7f[_0x6b84('0x4b')]=qs[_0x6b84('0x4c')](_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x4c')]);_0x4e4d7f['where']=qs[_0x6b84('0x44')](_[_0x6b84('0x4e')](_0x6bacf6[_0x6b84('0x42')],_0x2d2cb9['filters']));_0x4e4d7f[_0x6b84('0x4d')][_0x6b84('0xb5')]=_0x47e197['id'];if(_0x6bacf6[_0x6b84('0x42')]['filter']){_0x4e4d7f[_0x6b84('0x4d')]=_[_0x6b84('0xa0')](_0x4e4d7f[_0x6b84('0x4d')],{'$or':_[_0x6b84('0x33')](_0x4e4d7f[_0x6b84('0x45')],function(_0xc8ebee){var _0x387f49={};_0x387f49[_0xc8ebee]={'$like':'%'+_0x6bacf6[_0x6b84('0x42')][_0x6b84('0x84')]+'%'};return _0x387f49;})});}_0x4e4d7f['where'][_0x6b84('0x105')]=![];if(_0x6bacf6[_0x6b84('0x42')]['id']){_0x4e4d7f[_0x6b84('0x4d')]['id']={'$gt':_0x6bacf6[_0x6b84('0x42')]['id']};}_0x4e4d7f=_[_0x6b84('0xa0')]({},_0x4e4d7f,_0x6bacf6['options']);return db[_0x6b84('0xc8')][_0x6b84('0x29')]({'where':_0x4e4d7f[_0x6b84('0x4d')]})['then'](function(_0x3d5b2c){_0x4179d5[_0x6b84('0x29')]=_0x3d5b2c;_0x4e4d7f[_0x6b84('0x103')]=[];if(_0x6bacf6['query'][_0x6b84('0x106')]){_0x4e4d7f[_0x6b84('0x103')][_0x6b84('0x39')]({'model':db[_0x6b84('0x70')],'as':_0x6b84('0x70'),'attributes':['id',_0x6b84('0x34'),'alias']});}if(_0x6bacf6[_0x6b84('0x42')]['includeAll']){_0x4e4d7f[_0x6b84('0x103')]=[{'all':!![]}];}return db[_0x6b84('0xc8')][_0x6b84('0x104')](_0x4e4d7f);})[_0x6b84('0x1c')](function(_0x1178dc){_0x4179d5[_0x6b84('0xb6')]=_0x1178dc;return _0x4179d5;});}})[_0x6b84('0x1c')](respondWithFilteredResult(_0x578f7b,_0x4e4d7f))['catch'](handleError(_0x578f7b,null));};exports['addTags']=function(_0x236898,_0x5739ce,_0x398ad1){return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x236898[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x5739ce,null))[_0x6b84('0x1c')](function(_0x1191c5){if(_0x1191c5){return _0x1191c5[_0x6b84('0x107')](_0x236898[_0x6b84('0xba')]['ids'],_[_0x6b84('0xff')](_0x236898['body'],[_0x6b84('0xfe'),'id'])||{})[_0x6b84('0x108')](function(){return db['Tag']['findAll']({'attributes':['id',_0x6b84('0x30'),_0x6b84('0x50')],'where':{'id':_0x236898[_0x6b84('0xba')][_0x6b84('0xfe')]}});})[_0x6b84('0x1c')](function(_0x23858d){socket[_0x6b84('0x109')]('chatInteractionTags:save',{'id':Number(_0x236898[_0x6b84('0xb8')]['id']),'tags':_0x23858d||[]});return{'id':Number(_0x236898['params']['id']),'tags':_0x23858d||[]};});}})[_0x6b84('0x1c')](respondWithResult(_0x5739ce,null))['catch'](handleError(_0x5739ce,null));};exports['removeTags']=function(_0x1fd1f6,_0x113b93,_0xb497f5){return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x1fd1f6[_0x6b84('0xb8')]['id']}})[_0x6b84('0x1c')](handleEntityNotFound(_0x113b93,null))['then'](function(_0x29c90){if(_0x29c90){return _0x29c90[_0x6b84('0x10a')](_0x1fd1f6[_0x6b84('0x42')][_0x6b84('0xfe')]);}})[_0x6b84('0x1c')](respondWithStatusCode(_0x113b93,null))[_0x6b84('0x3a')](handleError(_0x113b93,null));};exports[_0x6b84('0x10b')]=function(_0x1c681b,_0x545e8d){var _0x3206d3=moment()[_0x6b84('0x10c')]()[_0x6b84('0x9d')]();var _0x4c0073=path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0x10d'),'files',_0x6b84('0x10e'));var _0x140cbc=path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0x10d'),'files',_0x6b84('0x10f'));var _0x313403=path[_0x6b84('0xd9')](_0x4c0073,_0x3206d3);var _0x46d5c4=util[_0x6b84('0xe4')](_0x6b84('0x110'),_0x1c681b['params']['id'],_0x3206d3);var _0x37c3af=path['join'](_0x4c0073,_0x46d5c4);var _0x1a8800=[];_0x1a8800[_0x6b84('0x39')]({'model':db[_0x6b84('0x70')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1a8800[_0x6b84('0x39')]({'model':db[_0x6b84('0xe2')],'as':_0x6b84('0x111'),'attributes':['id',_0x6b84('0x112'),'lastName'],'raw':!![]});if(_0x1c681b[_0x6b84('0x42')][_0x6b84('0x10f')]){_0x1a8800[_0x6b84('0x39')]({'model':db[_0x6b84('0xd7')],'as':_0x6b84('0xd7'),'raw':!![]});}var _0x2cfbb5=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x6b84('0xba'),_0x6b84('0x79'),_0x6b84('0x113'),_0x6b84('0x105'),_0x6b84('0x80')],'include':_0x1a8800}];_0x2cfbb5[_0x6b84('0x39')]({'model':db[_0x6b84('0x114')],'as':_0x6b84('0x115'),'attributes':['id',_0x6b84('0x30')]});_0x2cfbb5['push']({'model':db[_0x6b84('0x70')],'as':'Owner','attributes':['id',_0x6b84('0x34')]});return db[_0x6b84('0x3c')][_0x6b84('0x64')]({'where':{'id':_0x1c681b[_0x6b84('0xb8')]['id']},'include':_0x2cfbb5})[_0x6b84('0x1c')](handleEntityNotFound(_0x545e8d,null))[_0x6b84('0x1c')](function(_0x352f4a){if(_0x352f4a){var _0x4cdcbe=_0x352f4a[_0x6b84('0x116')]({'plain':!![]});fs[_0x6b84('0x117')](_0x313403);var _0x448088={'format':'A4','border':_0x6b84('0x118'),'header':{'height':_0x6b84('0x119'),'contents':{'first':_0x6b84('0x11a')}},'footer':{'height':_0x6b84('0x11b'),'contents':{'default':util[_0x6b84('0xe4')](_0x6b84('0x11c'),util['format']('%s\x20#%d',_0x6b84('0x11d'),_0x4cdcbe['id']),moment()[_0x6b84('0xe4')]('YYYY-MM-DD')['toString']())}}};var _0x6aa63c={'channel':_0x6b84('0x11d'),'account':_0x4cdcbe[_0x6b84('0x115')]['name'],'agent':_0x4cdcbe[_0x6b84('0x11e')]?_0x4cdcbe[_0x6b84('0x11e')][_0x6b84('0x34')]:_0x6b84('0x11f'),'createdAt':moment(_0x4cdcbe[_0x6b84('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x6b84('0x9d')](),'closedAt':_0x4cdcbe[_0x6b84('0xd6')]?moment(_0x4cdcbe[_0x6b84('0x120')])[_0x6b84('0xe4')](_0x6b84('0x101'))[_0x6b84('0x9d')]():'','disposition':_0x4cdcbe[_0x6b84('0xce')],'chatInfo':{'browser':_0x4cdcbe[_0x6b84('0x121')],'os':_0x4cdcbe[_0x6b84('0x122')],'referer':_0x4cdcbe['referer'],'customerIp':_0x4cdcbe[_0x6b84('0x123')],'customerPort':_0x4cdcbe[_0x6b84('0x124')]?_0x4cdcbe[_0x6b84('0x124')]:_0x6b84('0x11f')},'messages':_(_0x4cdcbe[_0x6b84('0xe1')])[_0x6b84('0x125')]()[_0x6b84('0x84')]({'secret':![]})[_0x6b84('0x33')](function(_0x4d6f83){if(_0x4d6f83[_0x6b84('0xd7')]){var _0x4335a4=path[_0x6b84('0xd9')](_0x140cbc,_0x4d6f83[_0x6b84('0xd7')][_0x6b84('0xd2')]);if(fs[_0x6b84('0x126')](_0x4335a4)){fs[_0x6b84('0x127')](_0x4335a4)['pipe'](fs[_0x6b84('0x128')](path[_0x6b84('0xd9')](_0x313403,_0x4d6f83['Attachment'][_0x6b84('0xd2')])));}}return{'date':moment(_0x4d6f83['createdAt'])[_0x6b84('0xe4')](_0x6b84('0x101'))['toString'](),'sender':_0x4d6f83[_0x6b84('0x113')]==='out'?_0x4d6f83[_0x6b84('0x70')]?_0x4d6f83['User'][_0x6b84('0x34')]:'System':_0x4d6f83[_0x6b84('0x111')][_0x6b84('0x112')]+(_0x4d6f83[_0x6b84('0x111')]['lastName']?'\x20'+_0x4d6f83[_0x6b84('0x111')][_0x6b84('0x129')]:''),'body':_0x4d6f83[_0x6b84('0xd7')]?_0x4d6f83[_0x6b84('0xd7')]['basename']:_0x4d6f83[_0x6b84('0xba')],'direction':_0x4d6f83[_0x6b84('0x113')]===_0x6b84('0xc7')?'A':'C','secret':_0x4d6f83['secret'],'read':_0x4d6f83[_0x6b84('0x80')],'attachment':_0x4d6f83[_0x6b84('0xd7')]};})[_0x6b84('0x66')]()};return ejs[_0x6b84('0x12a')](path[_0x6b84('0xd9')](config[_0x6b84('0xda')],_0x6b84('0x10d'),_0x6b84('0x12b'),_0x6b84('0x12c')),{'interaction':_0x6aa63c})[_0x6b84('0x1c')](function(_0x57aab3){return new BPromise(function(_0x435c8e,_0x1a9889){pdf['create'](_0x57aab3,_0x448088)[_0x6b84('0x12d')](path[_0x6b84('0xd9')](_0x313403,_0x6b84('0x12e')+_0x4cdcbe['id']+'-'+_0x3206d3+_0x6b84('0x12f')),function(_0x50036d,_0x159c6c){if(_0x50036d)return _0x1a9889(_0x50036d);_0x435c8e(_0x159c6c);});});})[_0x6b84('0x1c')](function(){return new BPromise(function(_0x10f78b,_0x148e36){zipdir(_0x313403,{'saveTo':_0x37c3af},function(_0x203275,_0x875dfd){if(_0x203275)return _0x148e36(_0x203275);return _0x10f78b(_0x875dfd);});})[_0x6b84('0x1c')](function(){return new BPromise(function(_0x26f8ba,_0x4efeea){rimraf(_0x313403,function(_0x1daa23){if(_0x1daa23)_0x4efeea(_0x1daa23);return _0x26f8ba();});});})['then'](function(){return _0x545e8d[_0x6b84('0x10b')](_0x37c3af,_0x46d5c4,function(_0x394e40){if(_0x394e40){console['log'](_0x6b84('0x130'),_0x394e40);}else{fs[_0x6b84('0x131')](_0x37c3af);}});});});}else{return _0x545e8d[_0x6b84('0x2e')](0xc8);}})[_0x6b84('0x3a')](handleError(_0x545e8d,null));}; \ No newline at end of file +var _0xcce8=['POST','MotionCWB:','follow','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','CmContact','Messages','agentAlias','System','%s%d','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','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','ids','omit','getMessages','rawAttributes','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','alias','setTags','spread','emit','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','10px','40px','30px','%s\x20#%d','Chat','YYYY-MM-DD','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','tail','basename','createReadStream','pipe','createWriteStream','direction','firstName','renderFile','views','downloadInteraction.html','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','index','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\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','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','merge','ChatInteraction','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','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','sequelize','groupBy','ChatInteractionId','push','all','rows','show','params','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation'];(function(_0x4de738,_0x62487d){var _0x19632b=function(_0x39a513){while(--_0x39a513){_0x4de738['push'](_0x4de738['shift']());}};_0x19632b(++_0x62487d);}(_0xcce8,0x1a5));var _0x8cce=function(_0x5b2763,_0x45372a){_0x5b2763=_0x5b2763-0x0;var _0x4ffc7f=_0xcce8[_0x5b2763];return _0x4ffc7f;};'use strict';var pdf=require(_0x8cce('0x0'));var emlformat=require(_0x8cce('0x1'));var rimraf=require(_0x8cce('0x2'));var zipdir=require(_0x8cce('0x3'));var jsonpatch=require(_0x8cce('0x4'));var rp=require(_0x8cce('0x5'));var moment=require(_0x8cce('0x6'));var BPromise=require(_0x8cce('0x7'));var Mustache=require(_0x8cce('0x8'));var util=require(_0x8cce('0x9'));var path=require('path');var sox=require(_0x8cce('0xa'));var csv=require(_0x8cce('0xb'));var ejs=require(_0x8cce('0xc'));var fs=require('fs');var _=require(_0x8cce('0xd'));var squel=require(_0x8cce('0xe'));var crypto=require(_0x8cce('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8cce('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cce('0x11'));var qs=require(_0x8cce('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cce('0x13'));var logger=require(_0x8cce('0x14'))(_0x8cce('0x15'));var utils=require('../../config/utils');var config=require(_0x8cce('0x16'));var licenseUtil=require(_0x8cce('0x17'));var db=require(_0x8cce('0x18'))['db'];config[_0x8cce('0x19')]=_['defaults'](config[_0x8cce('0x19')],{'host':_0x8cce('0x1a'),'port':0x18eb});var socket=require(_0x8cce('0x1b'))(new Redis(config[_0x8cce('0x19')]));require('./chatInteraction.socket')[_0x8cce('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8cce('0x1d')]({'port':0x232b});var client9004=jayson['client'][_0x8cce('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3e13e5,_0x13fa21,_0x17706c,_0xdbbfe3){return new BPromise(function(_0x251edd,_0xdf18b0){var _0x44fd50=_0xdbbfe3||client;return _0x44fd50[_0x8cce('0x1e')](_0x3e13e5,_0x17706c)[_0x8cce('0x1f')](function(_0x4f017b){logger[_0x8cce('0x20')](_0x8cce('0x21'),_0x13fa21,'request\x20sent');logger[_0x8cce('0x22')](_0x8cce('0x23'),_0x13fa21,_0x8cce('0x24'),JSON[_0x8cce('0x25')](_0x4f017b));if(_0x4f017b[_0x8cce('0x26')]){if(_0x4f017b['error'][_0x8cce('0x27')]===0x1f4){logger[_0x8cce('0x26')](_0x8cce('0x21'),_0x13fa21,_0x4f017b[_0x8cce('0x26')]['message']);return _0xdf18b0(_0x4f017b[_0x8cce('0x26')]['message']);}logger[_0x8cce('0x26')](_0x8cce('0x21'),_0x13fa21,_0x4f017b[_0x8cce('0x26')][_0x8cce('0x28')]);return _0x251edd(_0x4f017b['error'][_0x8cce('0x28')]);}else{logger[_0x8cce('0x20')](_0x8cce('0x21'),_0x13fa21,_0x8cce('0x24'));_0x251edd(_0x4f017b[_0x8cce('0x29')]['message']);}})[_0x8cce('0x2a')](function(_0x3e191d){logger[_0x8cce('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x13fa21,_0x3e191d);_0xdf18b0(_0x3e191d);});});}function respondWithStatusCode(_0x4d3260,_0x3b55c4){_0x3b55c4=_0x3b55c4||0xcc;return function(_0x592e11){if(_0x592e11){return _0x4d3260['sendStatus'](_0x3b55c4);}return _0x4d3260[_0x8cce('0x2b')](_0x3b55c4)[_0x8cce('0x2c')]();};}function respondWithResult(_0x2c2fe9,_0x2b82b8){_0x2b82b8=_0x2b82b8||0xc8;return function(_0x419c2b){if(_0x419c2b){return _0x2c2fe9[_0x8cce('0x2b')](_0x2b82b8)[_0x8cce('0x2d')](_0x419c2b);}};}function respondWithFilteredResult(_0x16d469,_0x28d61b){return function(_0x3b1c49){if(_0x3b1c49){var _0x4cb528=_0x3b1c49[_0x8cce('0x2e')],_0x41eb3c=_0x28d61b[_0x8cce('0x2f')],_0x18afd0=_0x28d61b['offset']+_0x28d61b[_0x8cce('0x30')],_0x445918;if(_0x18afd0>=_0x4cb528){_0x18afd0=_0x4cb528;_0x445918=0xc8;}else{_0x445918=0xce;}_0x16d469[_0x8cce('0x2b')](_0x445918);return _0x16d469[_0x8cce('0x31')](_0x8cce('0x32'),_0x41eb3c+'-'+_0x18afd0+'/'+_0x4cb528)[_0x8cce('0x2d')](_0x3b1c49);}return null;};}function patchUpdates(_0x4038a3){return function(_0x42b9f4){try{jsonpatch[_0x8cce('0x33')](_0x42b9f4,_0x4038a3,!![]);}catch(_0x3f8448){return BPromise[_0x8cce('0x34')](_0x3f8448);}return _0x42b9f4['save']();};}function saveUpdates(_0x45b363,_0x139207){return function(_0x48e120){if(_0x48e120){return _0x48e120[_0x8cce('0x35')](_0x45b363)[_0x8cce('0x1f')](function(_0x2f739e){return _0x2f739e;});}return null;};}function removeEntity(_0x42ccf1,_0x3ed4ea){return function(_0x45af8a){if(_0x45af8a){return _0x45af8a[_0x8cce('0x36')]()[_0x8cce('0x1f')](function(){_0x42ccf1[_0x8cce('0x2b')](0xcc)[_0x8cce('0x2c')]();});}};}function handleEntityNotFound(_0x5d1392,_0x1bded9){return function(_0x246636){if(!_0x246636){_0x5d1392[_0x8cce('0x37')](0x194);}return _0x246636;};}function handleError(_0x4b8cfc,_0x2c60b4){_0x2c60b4=_0x2c60b4||0x1f4;return function(_0x5f2004){logger[_0x8cce('0x26')](_0x5f2004[_0x8cce('0x38')]);if(_0x5f2004[_0x8cce('0x39')]){delete _0x5f2004['name'];}_0x4b8cfc[_0x8cce('0x2b')](_0x2c60b4)[_0x8cce('0x3a')](_0x5f2004);};}function getInteractionUsers(_0x9a8616,_0x302882){return new BPromise(function(_0x56d45e,_0x51462f){try{if(_0x302882[_0x9a8616['id']]){_0x9a8616[_0x8cce('0x3b')]=_[_0x8cce('0x3c')](_0x302882[_0x9a8616['id']],function(_0xd8b56b){return{'id':_0xd8b56b['id'],'fullname':_0xd8b56b[_0x8cce('0x3d')]};});}}catch(_0xaa7bab){_0x51462f(_0xaa7bab);}_0x56d45e(_0x9a8616);});}function getInteractionTags(_0x304686,_0xace26d){return new BPromise(function(_0x3189e2,_0x3c6267){try{if(_0x304686[_0x8cce('0x3e')]){_0x304686[_0x8cce('0x3f')]=[];_0x304686[_0x8cce('0x3e')]['split'](',')[_0x8cce('0x40')](function(_0x3a37f7){_0x304686['Tags']['push'](_0xace26d[_0x3a37f7]);});}delete _0x304686[_0x8cce('0x3e')];}catch(_0xfa44ae){_0x3c6267(_0xfa44ae);}_0x3189e2(_0x304686);});}function updateChatInteraction(_0x4ee788,_0x102448,_0x5769c6){return new BPromise(function(_0xaa2f89,_0x2786ce){return getInteractionUsers(_0x4ee788,_0x5769c6)['then'](function(_0x434091){return getInteractionTags(_0x434091,_0x102448);})[_0x8cce('0x1f')](function(_0x32e110){_0xaa2f89(_0x32e110);})[_0x8cce('0x2a')](function(_0x50d3d3){_0x2786ce(_0x50d3d3);});});}exports[_0x8cce('0x41')]=function(_0x208922,_0x3942cf){var _0x3d6ca3={},_0x399548={},_0x1b434a={'count':0x0,'rows':[]};var _0x1d3fd5=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x1d6166){return{'name':_0x1d6166[_0x8cce('0x42')],'type':_0x1d6166[_0x8cce('0x43')][_0x8cce('0x44')]};});_0x399548[_0x8cce('0x45')]=_[_0x8cce('0x3c')](_0x1d3fd5,_0x8cce('0x39'));_0x399548[_0x8cce('0x46')]=_[_0x8cce('0x47')](_0x208922[_0x8cce('0x46')]);_0x399548[_0x8cce('0x48')]=_[_0x8cce('0x49')](_0x399548[_0x8cce('0x45')],_0x399548[_0x8cce('0x46')]);_0x3d6ca3['attributes']=_[_0x8cce('0x49')](_0x399548[_0x8cce('0x45')],qs[_0x8cce('0x4a')](_0x208922['query'][_0x8cce('0x4a')]));_0x3d6ca3[_0x8cce('0x4b')]=_0x3d6ca3[_0x8cce('0x4b')][_0x8cce('0x4c')]?_0x3d6ca3[_0x8cce('0x4b')]:_0x399548[_0x8cce('0x45')];if(!_0x208922[_0x8cce('0x46')][_0x8cce('0x4d')]('nolimit')){_0x3d6ca3[_0x8cce('0x30')]=qs[_0x8cce('0x30')](_0x208922['query'][_0x8cce('0x30')]);_0x3d6ca3['offset']=qs['offset'](_0x208922[_0x8cce('0x46')][_0x8cce('0x2f')]);}_0x3d6ca3['order']=qs[_0x8cce('0x4e')](_0x208922[_0x8cce('0x46')][_0x8cce('0x4e')]);_0x3d6ca3[_0x8cce('0x4f')]=qs[_0x8cce('0x48')](_[_0x8cce('0x50')](_0x208922[_0x8cce('0x46')],_0x399548[_0x8cce('0x48')]),_0x1d3fd5);var _0xd04185=[];var _0x5be9a2=squel[_0x8cce('0x51')]()[_0x8cce('0x52')]('id')['field'](_0x8cce('0x39'))[_0x8cce('0x52')](_0x8cce('0x53'))[_0x8cce('0x54')](_0x8cce('0x55'));var _0x21a00b=squel[_0x8cce('0x51')]()[_0x8cce('0x52')](_0x8cce('0x56'))['field'](_0x8cce('0x57'))[_0x8cce('0x52')]('ui.ChatInteractionId')['from'](_0x8cce('0x58'),'ui')[_0x8cce('0x59')]('users','u',_0x8cce('0x5a'));var _0x5d2b47=squel[_0x8cce('0x51')]()[_0x8cce('0x54')](_0x8cce('0x5b'),'i')[_0x8cce('0x59')](_0x8cce('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8cce('0x59')](_0x8cce('0x5d'),'o',_0x8cce('0x5e'))[_0x8cce('0x59')](_0x8cce('0x5f'),'a',_0x8cce('0x60'))[_0x8cce('0x59')]('chat_messages','me',_0x8cce('0x61'))[_0x8cce('0x59')](_0x8cce('0x62'),'it',_0x8cce('0x63'))[_0x8cce('0x59')]('tools_tags','t',_0x8cce('0x64'));var _0x3542fa=squel['expr']();var _0xc3f0c5=[];var _0x53706b=squel[_0x8cce('0x65')]();var _0x3309b7;if(_0x208922['query'][_0x8cce('0x66')]){_0x3309b7=as['parseSearch'](_0x208922['query'][_0x8cce('0x66')]);var _0x4a989b=_0x3309b7[_0x8cce('0x67')];for(var _0x53614b=0x0;_0x53614b<_0x3309b7['conditions'][_0x8cce('0x4c')];_0x53614b++){var _0x51f0cb=_0x3309b7['conditions'][_0x53614b];var _0x4db26c='i';var _0x536902=_[_0x8cce('0x68')](_0x1d3fd5,[_0x8cce('0x39'),_0x51f0cb[_0x8cce('0x52')]]);if(!_0x536902){switch(_0x51f0cb[_0x8cce('0x52')]){case _0x8cce('0x69'):if(_0x51f0cb[_0x8cce('0x6a')]==0x1){_0x5d2b47[_0x8cce('0x6b')]('`'+_0x51f0cb[_0x8cce('0x52')]+_0x8cce('0x6c'));}else{_0x5d2b47['having']('`'+_0x51f0cb['field']+_0x8cce('0x6d'));}break;case _0x8cce('0x6e'):if(_0x51f0cb[_0x8cce('0x6f')]==='$substring'){if(_0x51f0cb['value'][_0x8cce('0x70')]('\x20')[_0x8cce('0x4c')]>0x1){_0x3542fa[_0x4a989b](_0x8cce('0x71'),qs[_0x8cce('0x72')](_0x51f0cb['value']),null);}else{var _0x833fba='%'+_0x51f0cb[_0x8cce('0x6a')]+'%';_0x3542fa[_0x4a989b](_0x8cce('0x73'),_0x833fba,_0x833fba,_0x833fba);}}else{_0x536902=_['find'](_0x1d3fd5,[_0x8cce('0x39'),_0x8cce('0x74')]);_0x51f0cb[_0x8cce('0x52')]=_0x8cce('0x74');_0x1242a4=as[_0x8cce('0x75')](_0x4db26c,_0x536902[_0x8cce('0x43')],_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x2c')]);}break;case'Tag':var _0x35df13=_0x51f0cb[_0x8cce('0x6a')]['split'](',')[_0x8cce('0x3c')](function(_0x12c1fe){return Number(_0x12c1fe);});_0x35df13['forEach'](function(_0x43e61d){_0x53706b['or'](_0x8cce('0x78'),'%,'+_0x43e61d+',%');});_0xc3f0c5=_['union'](_0xc3f0c5,_0x35df13);break;case _0x8cce('0x79'):if(_0x51f0cb['operator']===_0x8cce('0x7a')){_0x3542fa[_0x4a989b](_0x8cce('0x7b'),'%'+_0x51f0cb[_0x8cce('0x6a')]+'%',null);}else{_0x536902=_[_0x8cce('0x68')](_0x1d3fd5,[_0x8cce('0x39'),_0x8cce('0x7c')]);_0x51f0cb['field']='UserId';_0x1242a4=as['buildExpression'](_0x4db26c,_0x536902[_0x8cce('0x43')],_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')]['end']);}break;case _0x8cce('0x7d'):_0x1242a4=as[_0x8cce('0x75')]('me',null,_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x2c')]);break;}}else{var _0x1242a4=as[_0x8cce('0x75')](_0x4db26c,_0x536902[_0x8cce('0x43')],_0x51f0cb);_0x3542fa[_0x4a989b](_0x1242a4[_0x8cce('0x76')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x77')],_0x1242a4[_0x8cce('0x6a')][_0x8cce('0x2c')]);}}}else{var _0x186c92=_(_0x208922[_0x8cce('0x46')])[_0x8cce('0x47')]()['map'](function(_0x157d6f){return _[_0x8cce('0x7e')](_0x1d3fd5,[_0x8cce('0x39'),_0x157d6f])?_0x157d6f:undefined;})['compact']()[_0x8cce('0x6a')]();if(!_['isEmpty'](_0x186c92)){_0x186c92[_0x8cce('0x40')](function(_0x4e1176){if(_0x4e1176==='ChatWebsiteId'){_0x5d2b47[_0x8cce('0x4f')](_0x8cce('0x7f'),[][_0x8cce('0x80')](_0x208922[_0x8cce('0x46')][_0x4e1176]));}else if(_0x4e1176===_0x8cce('0x81')){var _0x37edc8=JSON['parse'](_0x208922[_0x8cce('0x46')][_0x4e1176])[_0x8cce('0x82')];var _0x48ca19=JSON[_0x8cce('0x83')](_0x208922['query'][_0x4e1176])[_0x8cce('0x84')];_0x5d2b47[_0x8cce('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x37edc8,_0x48ca19);}else{if(_0x208922[_0x8cce('0x46')][_0x4e1176]===_0x8cce('0x85')){_0x5d2b47[_0x8cce('0x4f')]('i.'+_0x4e1176+'\x20IS\x20NULL');}else{_0x5d2b47[_0x8cce('0x4f')]('i.'+_0x4e1176+_0x8cce('0x86'),_0x208922[_0x8cce('0x46')][_0x4e1176]);}}});}if(_0x208922[_0x8cce('0x46')][_0x8cce('0x87')]){if(_0x208922['query'][_0x8cce('0x87')]==0x1){_0x5d2b47['having'](_0x8cce('0x88'));}else{_0x5d2b47[_0x8cce('0x6b')]('`unreadMessages`\x20>\x200');}}if(_0x208922[_0x8cce('0x46')]['tag']){_0xc3f0c5=_['isArray'](_0x208922[_0x8cce('0x46')][_0x8cce('0x89')])?_0x208922[_0x8cce('0x46')][_0x8cce('0x89')]:new Array(_0x208922['query'][_0x8cce('0x89')]);_0xc3f0c5[_0x8cce('0x40')](function(_0x4debbe){_0x53706b['or'](_0x8cce('0x78'),'%,'+_0x4debbe+',%');});}if(_0x208922['query'][_0x8cce('0x8a')]){var _0x50a9c=_0x208922['query']['filter'][_0x8cce('0x8b')]('\x5c','\x5c\x5c')[_0x8cce('0x8b')](/'/g,'\x27\x27');if(qs[_0x8cce('0x8c')](_0x50a9c)){_0x3542fa['or'](_0x8cce('0x8d'),_0x50a9c+'%');}else{_0x3542fa['or'](_0x8cce('0x8e'),qs['getFullTextValue'](_0x50a9c))['or'](_0x8cce('0x8f'),_0x50a9c+'%');}}}_0x5d2b47['where'](_0x3542fa);_0x5d2b47[_0x8cce('0x90')]('i.id');var _0x3f9ab4={'type':db[_0x8cce('0x91')][_0x8cce('0x92')][_0x8cce('0x93')],'raw':!![]};var _0x52f6eb=_0x5d2b47['clone']();_0x52f6eb['field']('i.id');_0x52f6eb[_0x8cce('0x52')](_0x8cce('0x94'),_0x8cce('0x69'));if(_0x3d6ca3[_0x8cce('0x95')]){_0x3d6ca3[_0x8cce('0x95')][_0x8cce('0x40')](function(_0x3001af){var _0x18ea62=_0x3001af[0x0]===_0x8cce('0x96')?_0x3001af[0x0]:'i.'+_0x3001af[0x0];_0x5d2b47[_0x8cce('0x95')](_0x18ea62,_0x3001af[0x1]===_0x8cce('0x97')?![]:!![]);});}if(!_[_0x8cce('0x98')](_0xc3f0c5)){_0x5d2b47[_0x8cce('0x6b')](_0x53706b);_0x52f6eb['where'](_0x8cce('0x99'),_0xc3f0c5);}BPromise['resolve']()[_0x8cce('0x1f')](function(){if(!_0x3309b7){if(_0x208922[_0x8cce('0x46')][_0x8cce('0x9a')]||_0x208922['query'][_0x8cce('0x9b')])return;_0x52f6eb[_0x8cce('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5d2b47['where'](_0x8cce('0x9c'));return;}if(_0x208922['user'][_0x8cce('0x9d')]!==_0x8cce('0x9e'))return;return _0x208922[_0x8cce('0x9f')][_0x8cce('0xa0')]({'attributes':['id'],'raw':!![]})[_0x8cce('0x1f')](function(_0x97dbdd){if(_[_0x8cce('0x98')](_0x97dbdd)){_0x52f6eb[_0x8cce('0x4f')](_0x8cce('0xa1'));_0x5d2b47['where'](_0x8cce('0xa1'));}else{_0x52f6eb['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x8cce('0x3c')](_0x97dbdd,'id'));_0x5d2b47[_0x8cce('0x4f')](_0x8cce('0x7f'),_[_0x8cce('0x3c')](_0x97dbdd,'id'));}});})['then'](function(){if(_0x208922[_0x8cce('0x9f')][_0x8cce('0x9d')]===_0x8cce('0x9e')&&!_0x3309b7&&!_0x208922[_0x8cce('0x46')][_0x8cce('0x9a')])return[];return db['sequelize']['query'](_0x52f6eb[_0x8cce('0xa2')](),_0x3f9ab4);})['then'](function(_0x21ea41){_0x1b434a[_0x8cce('0x2e')]=_0x21ea41['length'];if(_0x1b434a[_0x8cce('0x2e')]===0x0)return[];return db['sequelize'][_0x8cce('0x46')](_0x5be9a2[_0x8cce('0xa2')](),_0x3f9ab4)[_0x8cce('0x1f')](function(_0x410792){_0xd04185=_['keyBy'](_0x410792,'id');_0x3f9ab4=_[_0x8cce('0xa3')](_0x3f9ab4,{'model':db[_0x8cce('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x208922[_0x8cce('0x46')][_0x8cce('0x4a')]){_0x3d6ca3[_0x8cce('0x4b')][_0x8cce('0x40')](function(_0x52eec7){_0x5d2b47[_0x8cce('0x52')]('i.'+_0x52eec7);});}else{_0x5d2b47['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5d2b47['field']('a.key',_0x8cce('0xa5'));_0x5d2b47['field']('a.mandatoryDisposition',_0x8cce('0xa6'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xa7'),_0x8cce('0x96'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xa8'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xa9'),_0x8cce('0xaa'));_0x5d2b47[_0x8cce('0x52')]('c.lastName',_0x8cce('0xab'));_0x5d2b47[_0x8cce('0x52')]('c.email',_0x8cce('0xac'));_0x5d2b47['field'](_0x8cce('0xad'),_0x8cce('0xae'));_0x5d2b47['field'](_0x8cce('0xaf'),'Contact.mobile');_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xb0'),_0x8cce('0xb1'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xb2'),_0x8cce('0xb3'));_0x5d2b47[_0x8cce('0x52')](_0x8cce('0xb4'),_0x8cce('0xb5'));_0x5d2b47['field'](_0x8cce('0xb6'),_0x8cce('0x3e'));}if(_0x3d6ca3['limit'])_0x5d2b47[_0x8cce('0x30')](_0x3d6ca3[_0x8cce('0x30')]);if(_0x3d6ca3['offset'])_0x5d2b47[_0x8cce('0x2f')](_0x3d6ca3['offset']);return db['sequelize'][_0x8cce('0x46')](_0x5d2b47[_0x8cce('0xa2')](),_0x3f9ab4);})[_0x8cce('0x1f')](function(_0x587629){_0x21a00b['where'](_0x8cce('0xb7'),_[_0x8cce('0x3c')](_0x587629,'id'));return db[_0x8cce('0xb8')][_0x8cce('0x46')](_0x21a00b[_0x8cce('0xa2')](),_0x3f9ab4)[_0x8cce('0x1f')](function(_0x21a4d0){var _0x4bcdf7=_[_0x8cce('0xb9')](_0x21a4d0,_0x8cce('0xba'));var _0x553a75=[];_0x587629[_0x8cce('0x40')](function(_0x411365){_0x553a75[_0x8cce('0xbb')](updateChatInteraction(_0x411365,_0xd04185,_0x4bcdf7));});return BPromise[_0x8cce('0xbc')](_0x553a75);});});})[_0x8cce('0x1f')](function(_0x401a37){_0x1b434a[_0x8cce('0xbd')]=_0x401a37;return _0x1b434a;})['then'](respondWithFilteredResult(_0x3942cf,_0x3d6ca3))[_0x8cce('0x2a')](handleError(_0x3942cf,null));};exports[_0x8cce('0xbe')]=function(_0x3ddea0,_0x4a073c){var _0x44d924={'raw':![],'where':{'id':_0x3ddea0[_0x8cce('0xbf')]['id']}},_0x368177={};_0x368177[_0x8cce('0x45')]=_[_0x8cce('0x47')](db[_0x8cce('0xa4')]['rawAttributes']);_0x368177['query']=_[_0x8cce('0x47')](_0x3ddea0[_0x8cce('0x46')]);_0x368177['filters']=_['intersection'](_0x368177[_0x8cce('0x45')],_0x368177['query']);_0x44d924[_0x8cce('0x4b')]=_['intersection'](_0x368177['model'],qs[_0x8cce('0x4a')](_0x3ddea0[_0x8cce('0x46')][_0x8cce('0x4a')]));_0x44d924[_0x8cce('0x4b')]=_0x44d924['attributes'][_0x8cce('0x4c')]?_0x44d924[_0x8cce('0x4b')]:_0x368177[_0x8cce('0x45')];if(_0x3ddea0[_0x8cce('0x46')]['includeAll']){_0x44d924[_0x8cce('0xc0')]=[{'all':!![]}];}_0x44d924=_[_0x8cce('0xa3')]({},_0x44d924,_0x3ddea0[_0x8cce('0xc1')]);return db[_0x8cce('0xa4')][_0x8cce('0x68')](_0x44d924)[_0x8cce('0x1f')](handleEntityNotFound(_0x4a073c,null))[_0x8cce('0x1f')](respondWithResult(_0x4a073c,null))[_0x8cce('0x2a')](handleError(_0x4a073c,null));};exports['create']=function(_0x5b377f,_0x5cd42c){return db[_0x8cce('0xa4')][_0x8cce('0xc2')](_0x5b377f['body'],{})['then'](respondWithResult(_0x5cd42c,0xc9))[_0x8cce('0x2a')](handleError(_0x5cd42c,null));};exports[_0x8cce('0x35')]=function(_0x5bd0e7,_0x44f549){if(_0x5bd0e7[_0x8cce('0x7d')]['id']){delete _0x5bd0e7['body']['id'];}return db[_0x8cce('0xa4')][_0x8cce('0x68')]({'where':{'id':_0x5bd0e7[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x44f549,null))['then'](saveUpdates(_0x5bd0e7[_0x8cce('0x7d')],null))[_0x8cce('0x1f')](respondWithResult(_0x44f549,null))[_0x8cce('0x2a')](handleError(_0x44f549,null));};exports[_0x8cce('0x36')]=function(_0x9d4aec,_0x34b6e4){return db[_0x8cce('0xa4')]['find']({'where':{'id':_0x9d4aec[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x34b6e4,null))[_0x8cce('0x1f')](removeEntity(_0x34b6e4,null))[_0x8cce('0x2a')](handleError(_0x34b6e4,null));};exports['describe']=function(_0x29968a,_0x4b5445){return db['ChatInteraction'][_0x8cce('0xc3')]()['then'](respondWithResult(_0x4b5445,null))[_0x8cce('0x2a')](handleError(_0x4b5445,null));};exports[_0x8cce('0xc4')]=function(_0x53781e,_0x290340){var _0x35445b=_0x53781e[_0x8cce('0xbf')]['id'];var _0x13dd22;var _0x2bc7b6;var _0x434929;return db[_0x8cce('0xa4')]['findOne']({'where':{'id':_0x35445b}})[_0x8cce('0x1f')](function(_0x4629fa){_0x13dd22=_0x4629fa;return db[_0x8cce('0xc5')][_0x8cce('0xc6')]({'where':{'id':_0x4629fa[_0x8cce('0x9a')]},'attributes':['id',_0x8cce('0xc7'),_0x8cce('0xc8')],'raw':!![]});})[_0x8cce('0x1f')](function(_0x5672f4){if(_0x5672f4&&_0x5672f4['vidaooApiKey']&&_0x5672f4[_0x8cce('0xc8')]){_0x2bc7b6=_0x5672f4;var _0x401a3b={'rejectUnauthorized':![],'method':_0x8cce('0xc9'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x5672f4[_0x8cce('0xc7')]},'body':{'name':_0x8cce('0xca')+_0x35445b},'redirect':_0x8cce('0xcb'),'json':!![]};return rp(_0x401a3b);}else{throw new db[(_0x8cce('0x91'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x8cce('0x1f')](function(_0x5e729c){_0x434929=_0x5e729c;if(_0x434929['id']){var _0x1213fe={'body':_0x434929[_0x8cce('0xcc')],'ChatWebsiteId':_0x2bc7b6['id'],'ChatInteractionId':_0x13dd22['id'],'direction':_0x8cce('0xcd'),'UserId':_0x53781e[_0x8cce('0x9f')]['id']};return db[_0x8cce('0xce')][_0x8cce('0xc2')](_0x1213fe,{});}else{throw new db[(_0x8cce('0x91'))][(_0x8cce('0xcf'))](_0x8cce('0xd0'));}})['then'](function(){return _0x13dd22[_0x8cce('0xd1')]({'vidaooSessionId':_0x434929['id']});})[_0x8cce('0x1f')](respondWithResult(_0x290340,null))[_0x8cce('0x2a')](handleError(_0x290340,null));};exports['customUpdate']=function(_0x1327dc,_0x1e5e59){if(_0x1327dc[_0x8cce('0x7d')]['id']){delete _0x1327dc[_0x8cce('0x7d')]['id'];}return db[_0x8cce('0xa4')]['find']({'where':{'id':_0x1327dc['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x1e5e59,null))[_0x8cce('0x1f')](saveUpdates(_0x1327dc['body'],null))[_0x8cce('0x1f')](respondWithResult(_0x1e5e59,null))['catch'](handleError(_0x1e5e59,null));};exports[_0x8cce('0xd2')]=function(_0x15404e,_0x404bbb,_0x3f9a41){if(_0x15404e[_0x8cce('0x7d')]['id']){delete _0x15404e[_0x8cce('0x7d')]['id'];}return db[_0x8cce('0xa4')]['find']({'where':{'id':_0x15404e[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](function(_0x29c98e){if(!_0x29c98e){logger[_0x8cce('0x26')](_0x8cce('0xd3'),_0x8cce('0xd2'),0x194,'entity\x20not\x20found');_0x404bbb[_0x8cce('0x37')](0x194);}else{if(_0x29c98e[_0x8cce('0x7c')]){throw new db['Sequelize'][(_0x8cce('0xcf'))](_0x8cce('0xd4'));}}return _0x29c98e;})[_0x8cce('0x1f')](function(_0x18bf93){if(_0x18bf93){return _0x18bf93[_0x8cce('0x35')]({'closed':_0x15404e[_0x8cce('0x7d')][_0x8cce('0xd5')],'disposition':_0x15404e[_0x8cce('0x7d')][_0x8cce('0xd6')]})[_0x8cce('0x1f')](function(_0x5c8d37){return _0x5c8d37;});}})[_0x8cce('0x1f')](function(_0x47b369){return respondWithRpcPromise(_0x8cce('0xd7'),_0x8cce('0xd2'),_0x15404e['body'],client9004);})[_0x8cce('0x1f')](respondWithResult(_0x404bbb,null))['catch'](handleError(_0x404bbb,null));};exports[_0x8cce('0xd8')]=function(_0x15cc93,_0xb1fbe0,_0x518528){_0x15cc93[_0x8cce('0x7d')][_0x8cce('0x39')]=_0x15cc93['file']['originalname'];_0x15cc93[_0x8cce('0x7d')]['basename']=_0x15cc93[_0x8cce('0xd9')][_0x8cce('0xda')];_0x15cc93['body'][_0x8cce('0x43')]=_0x15cc93[_0x8cce('0xd9')][_0x8cce('0xdb')];return db[_0x8cce('0xdc')][_0x8cce('0xc2')](_0x15cc93[_0x8cce('0x7d')])['then'](respondWithResult(_0xb1fbe0,0xc9))[_0x8cce('0x2a')](handleError(_0xb1fbe0,null));};exports[_0x8cce('0xdd')]=function(_0x35accf,_0x11fa93,_0x30986c){return db[_0x8cce('0xa4')]['findOne']({'where':{'id':_0x35accf[_0x8cce('0xbf')]['id']},'raw':!![]})[_0x8cce('0x1f')](handleEntityNotFound(_0x11fa93,null))[_0x8cce('0x1f')](function(_0x24b7f6){if(_0x24b7f6){if(_0x24b7f6[_0x8cce('0xd5')]){return _0x11fa93['status'](0x193)[_0x8cce('0x2d')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x8cce('0xc6')]({'where':{'id':_0x35accf['query'][_0x8cce('0xde')]},'raw':!![]})[_0x8cce('0x1f')](handleEntityNotFound(_0x11fa93,null));}})[_0x8cce('0x1f')](function(_0x1a975b){if(_0x1a975b){return _0x11fa93[_0x8cce('0xdf')](path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0xe2'),_0x1a975b['basename']));}})[_0x8cce('0x2a')](handleError(_0x11fa93,null));};exports[_0x8cce('0xe3')]=function(_0x41ecbc,_0x5a69d3){var _0x37179f=null;var _0x75c346=null;var _0xd25fc6=null;var _0x3f808f=null;if(_0x41ecbc[_0x8cce('0x7d')]['id']){delete _0x41ecbc['body']['id'];}if(_0x41ecbc['body'][_0x8cce('0xe4')]){_0x3f808f=path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0xe5'),util[_0x8cce('0xe6')](_0x8cce('0xe7'),Date['now']()));_0x41ecbc['body'][_0x8cce('0xe8')]=_0x3f808f;}return db[_0x8cce('0xa4')][_0x8cce('0x68')]({'where':{'id':_0x41ecbc[_0x8cce('0xbf')]['id']},'include':[{'model':db[_0x8cce('0xce')],'as':'Messages','include':[{'model':db['User'],'as':_0x8cce('0x79')}]}]})[_0x8cce('0x1f')](handleEntityNotFound(_0x5a69d3,null))[_0x8cce('0x1f')](saveUpdates(_0x41ecbc['body'],null))[_0x8cce('0x1f')](function(_0x49a9c0){if(_0x49a9c0){_0x37179f=_0x49a9c0;return db['ChatWebsite'][_0x8cce('0x68')]({'where':{'id':_0x37179f[_0x8cce('0x9a')]}});}})[_0x8cce('0x1f')](function(_0x3178ed){if(_0x3178ed){_0xd25fc6=_0x3178ed;return db[_0x8cce('0xe9')]['find']({'where':{'id':_0x37179f[_0x8cce('0x74')]}});}})[_0x8cce('0x1f')](function(_0x254d1c){if(_0x254d1c){_0x75c346=_0x254d1c;if(_0x3f808f){var _0x1c471e=null;for(var _0x49ec9f=0x1;_0x49ec9f<_0x37179f[_0x8cce('0xea')][_0x8cce('0x4c')];++_0x49ec9f){_0x1c471e=_0x37179f[_0x8cce('0xea')][_0x49ec9f];var _0x1f425a=_0x1c471e[_0x8cce('0x7c')]?util[_0x8cce('0xe6')]('%s%d',_0xd25fc6[_0x8cce('0xeb')],_0x1c471e[_0x8cce('0x7c')]):_0x8cce('0xec');var _0x23c2a2=_0x41ecbc[_0x8cce('0x7d')]['customer']||util[_0x8cce('0xe6')](_0x8cce('0xed'),'Visitor',_0x1c471e[_0x8cce('0x74')]);switch(_0xd25fc6['agentIdentifier']){case'website_alias':_0x1f425a=_0x1c471e['UserId']?util[_0x8cce('0xe6')](_0x8cce('0xed'),_0xd25fc6[_0x8cce('0xeb')],_0x1c471e['UserId']):_0x8cce('0xec');break;case _0x8cce('0xee'):_0x1f425a=_0x1c471e[_0x8cce('0x7c')]?_0x1c471e[_0x8cce('0x79')]['alias']||_0x1c471e[_0x8cce('0x79')][_0x8cce('0x3d')]:'System';break;case _0x8cce('0xef'):_0x1f425a=_0x1c471e[_0x8cce('0x7c')]?_0x1c471e['User']['fullname']:'System';break;default:_0x1f425a=_0x1c471e[_0x8cce('0x7c')]?util['format'](_0x8cce('0xed'),_0xd25fc6[_0x8cce('0xeb')],_0x1c471e[_0x8cce('0x7c')]):_0x8cce('0xec');}var _0x454677=util[_0x8cce('0xe6')](_0x8cce('0xf0'),moment(_0x1c471e['createdAt'])[_0x8cce('0xe6')](_0x8cce('0xf1')),_0x1c471e['direction']==='in'?_0x23c2a2:_0x1f425a,_0x1c471e['body']);if(!_0x1c471e[_0x8cce('0xf2')]){fs[_0x8cce('0xf3')](_0x3f808f,_0x454677);}}return db[_0x8cce('0xf4')][_0x8cce('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0x8cce('0xf5')],'as':_0x8cce('0xf6'),'raw':!![]}]});}}})[_0x8cce('0x1f')](function(_0x1f0cae){if(_0x1f0cae&&_0x1f0cae['Smtp']&&_0x41ecbc[_0x8cce('0x7d')]){var _0x40c098={'tls':{'rejectUnauthorized':![]}};if(_0x1f0cae['Smtp'][_0x8cce('0xf7')]){_0x40c098[_0x8cce('0xf7')]=_0x1f0cae[_0x8cce('0xf6')][_0x8cce('0xf7')];}else{_0x40c098[_0x8cce('0xf8')]=_0x1f0cae[_0x8cce('0xf6')]['host'];_0x40c098[_0x8cce('0xf9')]=_0x1f0cae['Smtp']['port'];_0x40c098[_0x8cce('0xfa')]=_0x1f0cae[_0x8cce('0xf6')]['secure'];}if(_0x1f0cae['Smtp'][_0x8cce('0xfb')]){_0x40c098[_0x8cce('0xfc')]={'user':_0x1f0cae['Smtp']['user'],'pass':_0x1f0cae[_0x8cce('0xf6')][_0x8cce('0xfd')]};}return respondWithRpcPromise('SendMail',_0x8cce('0xfe'),{'account':_0x40c098,'message':{'from':util[_0x8cce('0xe6')](_0x8cce('0xff'),_0x1f0cae[_0x8cce('0x39')],_0x1f0cae[_0x8cce('0x100')]||_0x1f0cae[_0x8cce('0xf6')][_0x8cce('0x9f')]),'to':_0x41ecbc[_0x8cce('0x7d')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x8cce('0xe6')](_0x8cce('0x101'),_0x41ecbc[_0x8cce('0x7d')][_0x8cce('0xe4')]),'attachments':[{'path':_0x3f808f}]}})['then'](function(){return _0x37179f;})['catch'](function(_0x21fc40){console[_0x8cce('0x26')](_0x21fc40);});}else{return _0x37179f;}})[_0x8cce('0x1f')](respondWithStatusCode(_0x5a69d3,0xc8))[_0x8cce('0x2a')](handleError(_0x5a69d3,null));};exports[_0x8cce('0x102')]=function(_0x1a5932,_0x40c97f,_0x40e24e){return db[_0x8cce('0xce')][_0x8cce('0x68')]({'where':{'id':_0x1a5932[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x40c97f,null))[_0x8cce('0x1f')](function(_0x500d28){if(_0x500d28){return _0x500d28[_0x8cce('0x102')](_0x1a5932[_0x8cce('0x7d')][_0x8cce('0x103')],_[_0x8cce('0x104')](_0x1a5932[_0x8cce('0x7d')],[_0x8cce('0x103'),'id'])||{});}})[_0x8cce('0x1f')](respondWithResult(_0x40c97f,null))['catch'](handleError(_0x40c97f,null));};exports[_0x8cce('0x105')]=function(_0x2ebfe6,_0x387686,_0x244a01){var _0x42cd93={'raw':![],'where':{}};var _0x51270f={};var _0x2d29ae={'count':0x0,'rows':[]};return db[_0x8cce('0xa4')][_0x8cce('0xc6')]({'where':{'id':_0x2ebfe6[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x387686,null))[_0x8cce('0x1f')](function(_0x49295a){if(_0x49295a){_0x51270f[_0x8cce('0x45')]=_[_0x8cce('0x47')](db[_0x8cce('0xce')][_0x8cce('0x106')]);_0x51270f[_0x8cce('0x46')]=_[_0x8cce('0x47')](_0x2ebfe6[_0x8cce('0x46')]);_0x51270f[_0x8cce('0x48')]=_[_0x8cce('0x49')](_0x51270f[_0x8cce('0x45')],_0x51270f[_0x8cce('0x46')]);_0x42cd93[_0x8cce('0x4b')]=_[_0x8cce('0x49')](_0x51270f[_0x8cce('0x45')],qs[_0x8cce('0x4a')](_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x4a')]));_0x42cd93[_0x8cce('0x4b')]=_0x42cd93[_0x8cce('0x4b')]['length']?_0x42cd93[_0x8cce('0x4b')]:_0x51270f[_0x8cce('0x45')];if(!_0x2ebfe6[_0x8cce('0x46')]['hasOwnProperty'](_0x8cce('0x107'))){_0x42cd93[_0x8cce('0x30')]=qs[_0x8cce('0x30')](_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x30')]);_0x42cd93[_0x8cce('0x2f')]=qs['offset'](_0x2ebfe6['query'][_0x8cce('0x2f')]);}_0x42cd93[_0x8cce('0x95')]=qs[_0x8cce('0x4e')](_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x4e')]);_0x42cd93['where']=qs['filters'](_['pick'](_0x2ebfe6['query'],_0x51270f[_0x8cce('0x48')]));_0x42cd93[_0x8cce('0x4f')]['ChatInteractionId']=_0x49295a['id'];if(_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x8a')]){_0x42cd93[_0x8cce('0x4f')]=_[_0x8cce('0xa3')](_0x42cd93['where'],{'$or':_['map'](_0x42cd93[_0x8cce('0x4b')],function(_0x37a3e8){var _0x1f0a80={};_0x1f0a80[_0x37a3e8]={'$like':'%'+_0x2ebfe6['query']['filter']+'%'};return _0x1f0a80;})});}if(_0x2ebfe6[_0x8cce('0x46')]['$gte']){var _0x26ace2=_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x82')][_0x8cce('0x70')](',');var _0x20cbb3={};_0x20cbb3[_0x26ace2[0x0]]={'$gte':moment(_0x26ace2[0x1])['format'](_0x8cce('0x108'))};_0x42cd93[_0x8cce('0x4f')]=_[_0x8cce('0xa3')](_0x42cd93['where'],_0x20cbb3);}_0x42cd93=_[_0x8cce('0xa3')]({},_0x42cd93,_0x2ebfe6[_0x8cce('0xc1')]);return db[_0x8cce('0xce')][_0x8cce('0x2e')]({'where':_0x42cd93['where']})[_0x8cce('0x1f')](function(_0x1b810c){_0x2d29ae[_0x8cce('0x2e')]=_0x1b810c;if(_0x2ebfe6[_0x8cce('0x46')][_0x8cce('0x109')]){_0x42cd93['include']=[{'all':!![]}];}return db[_0x8cce('0xce')][_0x8cce('0x10a')](_0x42cd93);})[_0x8cce('0x1f')](function(_0x594d73){_0x2d29ae['rows']=_0x594d73;return _0x2d29ae;});}})[_0x8cce('0x1f')](respondWithFilteredResult(_0x387686,_0x42cd93))[_0x8cce('0x2a')](handleError(_0x387686,null));};exports[_0x8cce('0x10b')]=function(_0x522db9,_0x578749,_0x25ab0c){var _0x4acc09={'where':{}},_0xf9dc9c={},_0x372b42={'count':0x0,'rows':[]};return db[_0x8cce('0xa4')]['findOne']({'where':{'id':_0x522db9['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x578749,null))[_0x8cce('0x1f')](function(_0x2f860c){if(_0x2f860c){_0xf9dc9c[_0x8cce('0x45')]=_[_0x8cce('0x47')](db[_0x8cce('0xce')][_0x8cce('0x106')]);_0xf9dc9c[_0x8cce('0x46')]=_[_0x8cce('0x47')](_0x522db9[_0x8cce('0x46')]);_0xf9dc9c[_0x8cce('0x48')]=_[_0x8cce('0x49')](_0xf9dc9c[_0x8cce('0x45')],_0xf9dc9c[_0x8cce('0x46')]);_0x4acc09[_0x8cce('0x4b')]=_[_0x8cce('0x49')](_0xf9dc9c[_0x8cce('0x45')],qs[_0x8cce('0x4a')](_0x522db9[_0x8cce('0x46')]['fields']));_0x4acc09[_0x8cce('0x4b')]=_0x4acc09[_0x8cce('0x4b')][_0x8cce('0x4c')]?_0x4acc09[_0x8cce('0x4b')]:_0xf9dc9c[_0x8cce('0x45')];if(!_0x522db9[_0x8cce('0x46')][_0x8cce('0x4d')](_0x8cce('0x107'))){_0x4acc09[_0x8cce('0x30')]=qs[_0x8cce('0x30')](_0x522db9['query'][_0x8cce('0x30')]);_0x4acc09[_0x8cce('0x2f')]=qs[_0x8cce('0x2f')](_0x522db9[_0x8cce('0x46')][_0x8cce('0x2f')]);}_0x4acc09[_0x8cce('0x95')]=qs[_0x8cce('0x4e')](_0x522db9[_0x8cce('0x46')][_0x8cce('0x4e')]);_0x4acc09[_0x8cce('0x4f')]=qs[_0x8cce('0x48')](_[_0x8cce('0x50')](_0x522db9[_0x8cce('0x46')],_0xf9dc9c[_0x8cce('0x48')]));_0x4acc09[_0x8cce('0x4f')][_0x8cce('0xba')]=_0x2f860c['id'];if(_0x522db9[_0x8cce('0x46')]['filter']){_0x4acc09[_0x8cce('0x4f')]=_[_0x8cce('0xa3')](_0x4acc09[_0x8cce('0x4f')],{'$or':_[_0x8cce('0x3c')](_0x4acc09[_0x8cce('0x4b')],function(_0x14fcb9){var _0x27f175={};_0x27f175[_0x14fcb9]={'$like':'%'+_0x522db9[_0x8cce('0x46')][_0x8cce('0x8a')]+'%'};return _0x27f175;})});}_0x4acc09[_0x8cce('0x4f')][_0x8cce('0xf2')]=![];if(_0x522db9[_0x8cce('0x46')]['id']){_0x4acc09[_0x8cce('0x4f')]['id']={'$gt':_0x522db9[_0x8cce('0x46')]['id']};}_0x4acc09=_[_0x8cce('0xa3')]({},_0x4acc09,_0x522db9[_0x8cce('0xc1')]);return db[_0x8cce('0xce')][_0x8cce('0x2e')]({'where':_0x4acc09[_0x8cce('0x4f')]})['then'](function(_0x36b115){_0x372b42['count']=_0x36b115;_0x4acc09[_0x8cce('0xc0')]=[];if(_0x522db9['query']['includeAgent']){_0x4acc09['include'][_0x8cce('0xbb')]({'model':db['User'],'as':'User','attributes':['id','fullname',_0x8cce('0x10c')]});}if(_0x522db9[_0x8cce('0x46')][_0x8cce('0x109')]){_0x4acc09['include']=[{'all':!![]}];}return db['ChatMessage'][_0x8cce('0x10a')](_0x4acc09);})[_0x8cce('0x1f')](function(_0x26ebfa){_0x372b42['rows']=_0x26ebfa;return _0x372b42;});}})[_0x8cce('0x1f')](respondWithFilteredResult(_0x578749,_0x4acc09))[_0x8cce('0x2a')](handleError(_0x578749,null));};exports['addTags']=function(_0x3d2f0f,_0x23ab5b,_0x30f004){return db['ChatInteraction'][_0x8cce('0x68')]({'where':{'id':_0x3d2f0f[_0x8cce('0xbf')]['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x23ab5b,null))['then'](function(_0x8b6b33){if(_0x8b6b33){return _0x8b6b33[_0x8cce('0x10d')](_0x3d2f0f['body'][_0x8cce('0x103')],_[_0x8cce('0x104')](_0x3d2f0f['body'],[_0x8cce('0x103'),'id'])||{})[_0x8cce('0x10e')](function(){return db['Tag']['findAll']({'attributes':['id',_0x8cce('0x39'),_0x8cce('0x53')],'where':{'id':_0x3d2f0f[_0x8cce('0x7d')]['ids']}});})['then'](function(_0x1bdbcb){socket[_0x8cce('0x10f')]('chatInteractionTags:save',{'id':Number(_0x3d2f0f[_0x8cce('0xbf')]['id']),'tags':_0x1bdbcb||[]});return{'id':Number(_0x3d2f0f['params']['id']),'tags':_0x1bdbcb||[]};});}})['then'](respondWithResult(_0x23ab5b,null))['catch'](handleError(_0x23ab5b,null));};exports[_0x8cce('0x110')]=function(_0x532dc4,_0x112df0,_0x20c781){return db[_0x8cce('0xa4')][_0x8cce('0x68')]({'where':{'id':_0x532dc4['params']['id']}})[_0x8cce('0x1f')](handleEntityNotFound(_0x112df0,null))[_0x8cce('0x1f')](function(_0x2539f4){if(_0x2539f4){return _0x2539f4[_0x8cce('0x110')](_0x532dc4[_0x8cce('0x46')][_0x8cce('0x103')]);}})[_0x8cce('0x1f')](respondWithStatusCode(_0x112df0,null))[_0x8cce('0x2a')](handleError(_0x112df0,null));};exports[_0x8cce('0xdf')]=function(_0x5c2137,_0x90b9b8){var _0x31ab43=moment()[_0x8cce('0x111')]()['toString']();var _0xaa1a71=path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0x112'),_0x8cce('0x113'),_0x8cce('0x114'));var _0x5152fd=path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0x112'),_0x8cce('0x113'),_0x8cce('0x115'));var _0x585383=path[_0x8cce('0xe0')](_0xaa1a71,_0x31ab43);var _0x589603=util[_0x8cce('0xe6')](_0x8cce('0x116'),_0x5c2137[_0x8cce('0xbf')]['id'],_0x31ab43);var _0x506731=path[_0x8cce('0xe0')](_0xaa1a71,_0x589603);var _0x95f37f=[];_0x95f37f[_0x8cce('0xbb')]({'model':db[_0x8cce('0x79')],'as':_0x8cce('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x95f37f['push']({'model':db[_0x8cce('0xe9')],'as':_0x8cce('0x6e'),'attributes':['id','firstName',_0x8cce('0x117')],'raw':!![]});if(_0x5c2137['query'][_0x8cce('0x115')]){_0x95f37f[_0x8cce('0xbb')]({'model':db['Attachment'],'as':_0x8cce('0xdc'),'raw':!![]});}var _0x7a68d=[{'model':db[_0x8cce('0xce')],'as':_0x8cce('0xea'),'attributes':['id',_0x8cce('0x7d'),'createdAt','direction',_0x8cce('0xf2'),_0x8cce('0x87')],'include':_0x95f37f}];_0x7a68d[_0x8cce('0xbb')]({'model':db[_0x8cce('0xc5')],'as':_0x8cce('0x118'),'attributes':['id','name']});_0x7a68d['push']({'model':db[_0x8cce('0x79')],'as':_0x8cce('0x119'),'attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x5c2137[_0x8cce('0xbf')]['id']},'include':_0x7a68d})['then'](handleEntityNotFound(_0x90b9b8,null))[_0x8cce('0x1f')](function(_0x1c5232){if(_0x1c5232){var _0x324248=_0x1c5232[_0x8cce('0x11a')]({'plain':!![]});fs[_0x8cce('0x11b')](_0x585383);var _0x2d6597={'format':'A4','border':_0x8cce('0x11c'),'header':{'height':_0x8cce('0x11d'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x8cce('0x11e'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x8cce('0xe6')](_0x8cce('0x11f'),_0x8cce('0x120'),_0x324248['id']),moment()[_0x8cce('0xe6')](_0x8cce('0x121'))['toString']())}}};var _0x24f9ba={'channel':'Chat','account':_0x324248['Account'][_0x8cce('0x39')],'agent':_0x324248[_0x8cce('0x119')]?_0x324248['Owner']['fullname']:'N.A.','createdAt':moment(_0x324248[_0x8cce('0x81')])[_0x8cce('0xe6')](_0x8cce('0x108'))[_0x8cce('0xa2')](),'closedAt':_0x324248[_0x8cce('0xd5')]?moment(_0x324248[_0x8cce('0x122')])[_0x8cce('0xe6')](_0x8cce('0x108'))[_0x8cce('0xa2')]():'','disposition':_0x324248[_0x8cce('0xd6')],'chatInfo':{'browser':_0x324248[_0x8cce('0x123')],'os':_0x324248[_0x8cce('0x124')],'referer':_0x324248[_0x8cce('0x125')],'customerIp':_0x324248[_0x8cce('0x126')],'customerPort':_0x324248[_0x8cce('0x127')]?_0x324248[_0x8cce('0x127')]:_0x8cce('0x128')},'messages':_(_0x324248['Messages'])[_0x8cce('0x129')]()[_0x8cce('0x8a')]({'secret':![]})['map'](function(_0x42ddb7){if(_0x42ddb7['Attachment']){var _0x32e519=path['join'](_0x5152fd,_0x42ddb7[_0x8cce('0xdc')][_0x8cce('0x12a')]);if(fs['existsSync'](_0x32e519)){fs[_0x8cce('0x12b')](_0x32e519)[_0x8cce('0x12c')](fs[_0x8cce('0x12d')](path['join'](_0x585383,_0x42ddb7[_0x8cce('0xdc')][_0x8cce('0x12a')])));}}return{'date':moment(_0x42ddb7[_0x8cce('0x81')])[_0x8cce('0xe6')](_0x8cce('0x108'))[_0x8cce('0xa2')](),'sender':_0x42ddb7[_0x8cce('0x12e')]===_0x8cce('0xcd')?_0x42ddb7[_0x8cce('0x79')]?_0x42ddb7['User']['fullname']:_0x8cce('0xec'):_0x42ddb7['Contact'][_0x8cce('0x12f')]+(_0x42ddb7[_0x8cce('0x6e')][_0x8cce('0x117')]?'\x20'+_0x42ddb7[_0x8cce('0x6e')][_0x8cce('0x117')]:''),'body':_0x42ddb7[_0x8cce('0xdc')]?_0x42ddb7['Attachment'][_0x8cce('0x12a')]:_0x42ddb7[_0x8cce('0x7d')],'direction':_0x42ddb7['direction']===_0x8cce('0xcd')?'A':'C','secret':_0x42ddb7[_0x8cce('0xf2')],'read':_0x42ddb7[_0x8cce('0x87')],'attachment':_0x42ddb7[_0x8cce('0xdc')]};})[_0x8cce('0x6a')]()};return ejs[_0x8cce('0x130')](path[_0x8cce('0xe0')](config[_0x8cce('0xe1')],_0x8cce('0x112'),_0x8cce('0x131'),_0x8cce('0x132')),{'interaction':_0x24f9ba})[_0x8cce('0x1f')](function(_0x59b7a){return new BPromise(function(_0x2fb16c,_0x16aaa6){pdf[_0x8cce('0xc2')](_0x59b7a,_0x2d6597)['toFile'](path[_0x8cce('0xe0')](_0x585383,_0x8cce('0x133')+_0x324248['id']+'-'+_0x31ab43+'.pdf'),function(_0x4261ef,_0x10fcc0){if(_0x4261ef)return _0x16aaa6(_0x4261ef);_0x2fb16c(_0x10fcc0);});});})[_0x8cce('0x1f')](function(){return new BPromise(function(_0xf836f2,_0x5a4994){zipdir(_0x585383,{'saveTo':_0x506731},function(_0xc76de6,_0x3be21d){if(_0xc76de6)return _0x5a4994(_0xc76de6);return _0xf836f2(_0x3be21d);});})[_0x8cce('0x1f')](function(){return new BPromise(function(_0x13aa09,_0x301a40){rimraf(_0x585383,function(_0x2fbc30){if(_0x2fbc30)_0x301a40(_0x2fbc30);return _0x13aa09();});});})[_0x8cce('0x1f')](function(){return _0x90b9b8[_0x8cce('0xdf')](_0x506731,_0x589603,function(_0x151a4b){if(_0x151a4b){console[_0x8cce('0x134')](_0x8cce('0x135'),_0x151a4b);}else{fs[_0x8cce('0x136')](_0x506731);}});});});}else{return _0x90b9b8[_0x8cce('0x37')](0xc8);}})['catch'](handleError(_0x90b9b8,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 1cc5adc..63a94b8 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 _0xdbb9=['Users','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','setDataValue'];(function(_0x22e4ee,_0x57e857){var _0x281efb=function(_0x4f7475){while(--_0x4f7475){_0x22e4ee['push'](_0x22e4ee['shift']());}};_0x281efb(++_0x57e857);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x551d08,_0x60e772){_0x551d08=_0x551d08-0x0;var _0x785c8=_0xdbb9[_0x551d08];return _0x785c8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x9dbb('0x0'))['db'][_0x9dbb('0x1')];var ChatMessage=require(_0x9dbb('0x0'))['db'][_0x9dbb('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9dbb('0x3'),'afterUpdate':_0x9dbb('0x4'),'afterDestroy':_0x9dbb('0x5')};function emitEvent(_0x3b4460){return function(_0xb960a5,_0x398f78,_0x4c7cb2){_0xb960a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x28c5c0){_0xb960a5[_0x9dbb('0x6')](_0x9dbb('0x7'),_0x28c5c0['map'](function(_0x59b2fc){return{'id':_0x59b2fc['id']};}));return ChatMessage[_0x9dbb('0x8')]({'where':{'ChatInteractionId':_0xb960a5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dbb('0x9')](function(_0x37f00d){_0xb960a5['setDataValue'](_0x9dbb('0xa'),_0x37f00d[_0x9dbb('0xb')]);ChatInteractionEvents[_0x9dbb('0xc')](_0x3b4460+':'+_0xb960a5['id'],_0xb960a5);ChatInteractionEvents[_0x9dbb('0xc')](_0x3b4460,_0xb960a5);_0x4c7cb2(null);})['catch'](_0x4c7cb2(null));};}for(var e in events){if(events[_0x9dbb('0xd')](e)){var event=events[e];ChatInteraction[_0x9dbb('0xe')](e,emitEvent(event));}}module[_0x9dbb('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x91d2=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1c6c0d,_0x164210){var _0x3e6970=function(_0x598e06){while(--_0x598e06){_0x1c6c0d['push'](_0x1c6c0d['shift']());}};_0x3e6970(++_0x164210);}(_0x91d2,0x188));var _0x291d=function(_0x3cf8bb,_0x29e863){_0x3cf8bb=_0x3cf8bb-0x0;var _0x367eb5=_0x91d2[_0x3cf8bb];return _0x367eb5;};'use strict';var EventEmitter=require(_0x291d('0x0'));var ChatInteraction=require(_0x291d('0x1'))['db'][_0x291d('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x291d('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x291d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x291d('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc2febe){return function(_0x41179c,_0x18ae71,_0x56ade4){_0x41179c[_0x291d('0x6')]({'attributes':['id'],'raw':!![]})[_0x291d('0x7')](function(_0x3b934c){_0x41179c[_0x291d('0x8')](_0x291d('0x9'),_0x3b934c[_0x291d('0xa')](function(_0x151d2d){return{'id':_0x151d2d['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x41179c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x291d('0x7')](function(_0x411c93){_0x41179c[_0x291d('0x8')](_0x291d('0xb'),_0x411c93[_0x291d('0xc')]);ChatInteractionEvents[_0x291d('0xd')](_0xc2febe+':'+_0x41179c['id'],_0x41179c);ChatInteractionEvents[_0x291d('0xd')](_0xc2febe,_0x41179c);_0x56ade4(null);})[_0x291d('0xe')](_0x56ade4(null));};}for(var e in events){if(events[_0x291d('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x291d('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8560c6b..f1f299f 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 _0x9086=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','utf8mb4'];(function(_0x11d0f3,_0x345358){var _0xd2c64=function(_0x3551fe){while(--_0x3551fe){_0x11d0f3['push'](_0x11d0f3['shift']());}};_0xd2c64(++_0x345358);}(_0x9086,0x1cb));var _0x6908=function(_0xdb255f,_0x3e9f0d){_0xdb255f=_0xdb255f-0x0;var _0x922e3c=_0x9086[_0xdb255f];return _0x922e3c;};'use strict';var _=require(_0x6908('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6908('0x1'));var moment=require(_0x6908('0x2'));var BPromise=require(_0x6908('0x3'));var rp=require(_0x6908('0x4'));var fs=require('fs');var path=require(_0x6908('0x5'));var rimraf=require(_0x6908('0x6'));var config=require(_0x6908('0x7'));var attributes=require(_0x6908('0x8'));module[_0x6908('0x9')]=function(_0x39440a,_0x3c6609){return _0x39440a[_0x6908('0xa')]('ChatInteraction',attributes,{'tableName':_0x6908('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x572f94,_0x124915,_0x28e0b8){if(_0x572f94[_0x6908('0xc')](_0x6908('0xd'))){_0x572f94[_0x6908('0xe')]=moment()[_0x6908('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x28e0b8(null,_0x572f94);}},'charset':_0x6908('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xef43=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0xef43,0xd6));var _0x3ef4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xef43[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x3ef4('0x0'));var logger=require(_0x3ef4('0x1'))(_0x3ef4('0x2'));var moment=require(_0x3ef4('0x3'));var BPromise=require(_0x3ef4('0x4'));var rp=require(_0x3ef4('0x5'));var fs=require('fs');var path=require(_0x3ef4('0x6'));var rimraf=require(_0x3ef4('0x7'));var config=require(_0x3ef4('0x8'));var attributes=require(_0x3ef4('0x9'));module['exports']=function(_0x220632,_0x22c907){return _0x220632[_0x3ef4('0xa')](_0x3ef4('0xb'),attributes,{'tableName':_0x3ef4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d18d2,_0x4baefd,_0x2011c6){if(_0x1d18d2[_0x3ef4('0xd')](_0x3ef4('0xe'))){_0x1d18d2[_0x3ef4('0xf')]=moment()[_0x3ef4('0x10')](_0x3ef4('0x11'));}_0x2011c6(null,_0x1d18d2);}},'charset':_0x3ef4('0x12'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 32956ba..77641ae 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 _0xa913=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','options','raw','where','attributes','limit','ChatInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird'];(function(_0x3087eb,_0x20f88f){var _0x557eea=function(_0x3528af){while(--_0x3528af){_0x3087eb['push'](_0x3087eb['shift']());}};_0x557eea(++_0x20f88f);}(_0xa913,0x72));var _0x3a91=function(_0x5269f8,_0x327626){_0x5269f8=_0x5269f8-0x0;var _0x15e61b=_0xa913[_0x5269f8];return _0x15e61b;};'use strict';var _=require(_0x3a91('0x0'));var util=require('util');var moment=require(_0x3a91('0x1'));var BPromise=require(_0x3a91('0x2'));var rs=require(_0x3a91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a91('0x4'));var logger=require('../../config/logger')(_0x3a91('0x5'));var config=require(_0x3a91('0x6'));var jayson=require(_0x3a91('0x7'));var client=jayson['client'][_0x3a91('0x8')]({'port':0x232a});config[_0x3a91('0x9')]=_[_0x3a91('0xa')](config[_0x3a91('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a91('0xb'))(new Redis(config[_0x3a91('0x9')]));require(_0x3a91('0xc'))[_0x3a91('0xd')](socket);function respondWithRpcPromise(_0x2b924c,_0x1db748,_0x162f6f){return new BPromise(function(_0x1a4a5c,_0xf251aa){return client[_0x3a91('0xe')](_0x2b924c,_0x162f6f)[_0x3a91('0xf')](function(_0x32e9f6){logger[_0x3a91('0x10')](_0x3a91('0x11'),_0x1db748,_0x3a91('0x12'));logger[_0x3a91('0x13')](_0x3a91('0x14'),_0x1db748,_0x3a91('0x12'),JSON[_0x3a91('0x15')](_0x32e9f6));if(_0x32e9f6[_0x3a91('0x16')]){if(_0x32e9f6[_0x3a91('0x16')]['code']===0x1f4){logger[_0x3a91('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x1db748,_0x32e9f6[_0x3a91('0x16')]['message']);return _0xf251aa(_0x32e9f6[_0x3a91('0x16')][_0x3a91('0x17')]);}logger['error'](_0x3a91('0x11'),_0x1db748,_0x32e9f6[_0x3a91('0x16')][_0x3a91('0x17')]);return _0x1a4a5c(_0x32e9f6[_0x3a91('0x16')][_0x3a91('0x17')]);}else{logger['info'](_0x3a91('0x11'),_0x1db748,_0x3a91('0x12'));_0x1a4a5c(_0x32e9f6[_0x3a91('0x18')][_0x3a91('0x17')]);}})[_0x3a91('0x19')](function(_0x28bf85){logger[_0x3a91('0x16')](_0x3a91('0x11'),_0x1db748,_0x28bf85);_0xf251aa(_0x28bf85);});});}exports[_0x3a91('0x1a')]=function(_0x384fc2){var _0xb58f2f=this;return new Promise(function(_0x4004b1,_0x522cf2){return db['ChatInteraction']['update'](_0x384fc2['body'],{'raw':_0x384fc2[_0x3a91('0x1b')]?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x384fc2[_0x3a91('0x1b')]?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1d')]||null:null,'attributes':_0x384fc2['options']?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1e')]||null:null,'limit':_0x384fc2['options']?_0x384fc2[_0x3a91('0x1b')][_0x3a91('0x1f')]||null:null})[_0x3a91('0xf')](function(_0x25b088){logger['info'](_0x3a91('0x1a'),_0x384fc2);logger[_0x3a91('0x13')](_0x3a91('0x1a'),_0x384fc2,JSON[_0x3a91('0x15')](_0x25b088));_0x4004b1(_0x25b088);})[_0x3a91('0x19')](function(_0x5ba55f){logger[_0x3a91('0x16')](_0x3a91('0x1a'),_0x5ba55f[_0x3a91('0x17')],_0x384fc2);_0x522cf2(_0xb58f2f[_0x3a91('0x16')](0x1f4,_0x5ba55f['message']));});});};exports['AddTagsToChatInteraction']=function(_0x58dec0){return new Promise(function(_0xaca27b,_0x2f8a43){return db[_0x3a91('0x20')][_0x3a91('0x21')]({'where':_0x58dec0[_0x3a91('0x1b')]?_0x58dec0[_0x3a91('0x1b')][_0x3a91('0x1d')]||null:null})[_0x3a91('0xf')](function(_0x130a01){if(_0x130a01){return _0x130a01[_0x3a91('0x22')](_0x58dec0[_0x3a91('0x23')][_0x3a91('0x24')],_[_0x3a91('0x25')](_0x58dec0[_0x3a91('0x23')],[_0x3a91('0x24'),'id'])||{});}})['spread'](function(_0x28e515){logger[_0x3a91('0x10')](_0x3a91('0x26'),_0x58dec0);logger['debug'](_0x3a91('0x26'),_0x58dec0,JSON['stringify'](_0x28e515));_0xaca27b(_0x28e515);})[_0x3a91('0x19')](function(_0x504e7c){logger[_0x3a91('0x16')](_0x3a91('0x26'),_0x504e7c[_0x3a91('0x17')],_0x58dec0);_0x2f8a43(_this[_0x3a91('0x16')](0x1f4,_0x504e7c['message']));});});}; \ No newline at end of file +var _0xa76a=['body','options','raw','where','attributes','catch','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update'];(function(_0x4d67e7,_0x1b1950){var _0x1c1cb4=function(_0xf9e8de){while(--_0xf9e8de){_0x4d67e7['push'](_0x4d67e7['shift']());}};_0x1c1cb4(++_0x1b1950);}(_0xa76a,0xe3));var _0xaa76=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xa76a[_0x725a4c];return _0x37b2cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa76('0x0'));var BPromise=require(_0xaa76('0x1'));var rs=require(_0xaa76('0x2'));var fs=require('fs');var Redis=require(_0xaa76('0x3'));var db=require(_0xaa76('0x4'))['db'];var utils=require(_0xaa76('0x5'));var logger=require(_0xaa76('0x6'))('rpc');var config=require(_0xaa76('0x7'));var jayson=require(_0xaa76('0x8'));var client=jayson[_0xaa76('0x9')][_0xaa76('0xa')]({'port':0x232a});config[_0xaa76('0xb')]=_[_0xaa76('0xc')](config[_0xaa76('0xb')],{'host':_0xaa76('0xd'),'port':0x18eb});var socket=require(_0xaa76('0xe'))(new Redis(config['redis']));require(_0xaa76('0xf'))['register'](socket);function respondWithRpcPromise(_0x3969a5,_0x19e54d,_0x4f75ef){return new BPromise(function(_0x54ae23,_0x495e86){return client[_0xaa76('0x10')](_0x3969a5,_0x4f75ef)[_0xaa76('0x11')](function(_0x2cb905){logger[_0xaa76('0x12')](_0xaa76('0x13'),_0x19e54d,_0xaa76('0x14'));logger[_0xaa76('0x15')](_0xaa76('0x16'),_0x19e54d,_0xaa76('0x14'),JSON[_0xaa76('0x17')](_0x2cb905));if(_0x2cb905[_0xaa76('0x18')]){if(_0x2cb905[_0xaa76('0x18')][_0xaa76('0x19')]===0x1f4){logger[_0xaa76('0x18')](_0xaa76('0x13'),_0x19e54d,_0x2cb905[_0xaa76('0x18')]['message']);return _0x495e86(_0x2cb905[_0xaa76('0x18')]['message']);}logger[_0xaa76('0x18')](_0xaa76('0x13'),_0x19e54d,_0x2cb905[_0xaa76('0x18')][_0xaa76('0x1a')]);return _0x54ae23(_0x2cb905[_0xaa76('0x18')][_0xaa76('0x1a')]);}else{logger[_0xaa76('0x12')](_0xaa76('0x13'),_0x19e54d,_0xaa76('0x14'));_0x54ae23(_0x2cb905[_0xaa76('0x1b')][_0xaa76('0x1a')]);}})['catch'](function(_0x2c2a38){logger[_0xaa76('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x19e54d,_0x2c2a38);_0x495e86(_0x2c2a38);});});}exports[_0xaa76('0x1c')]=function(_0x5a1720){var _0x2b6bfb=this;return new Promise(function(_0x41ea31,_0x43ffa4){return db[_0xaa76('0x1d')][_0xaa76('0x1e')](_0x5a1720[_0xaa76('0x1f')],{'raw':_0x5a1720[_0xaa76('0x20')]?_0x5a1720[_0xaa76('0x20')][_0xaa76('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a1720[_0xaa76('0x20')]?_0x5a1720[_0xaa76('0x20')][_0xaa76('0x22')]||null:null,'attributes':_0x5a1720['options']?_0x5a1720['options'][_0xaa76('0x23')]||null:null,'limit':_0x5a1720['options']?_0x5a1720[_0xaa76('0x20')]['limit']||null:null})[_0xaa76('0x11')](function(_0x3700b4){logger[_0xaa76('0x12')]('UpdateChatInteraction',_0x5a1720);logger['debug'](_0xaa76('0x1c'),_0x5a1720,JSON['stringify'](_0x3700b4));_0x41ea31(_0x3700b4);})[_0xaa76('0x24')](function(_0x2be2a3){logger[_0xaa76('0x18')](_0xaa76('0x1c'),_0x2be2a3['message'],_0x5a1720);_0x43ffa4(_0x2b6bfb['error'](0x1f4,_0x2be2a3['message']));});});};exports[_0xaa76('0x25')]=function(_0x1fb711){return new Promise(function(_0x83a532,_0x27cbac){return db['ChatInteraction'][_0xaa76('0x26')]({'where':_0x1fb711[_0xaa76('0x20')]?_0x1fb711[_0xaa76('0x20')][_0xaa76('0x22')]||null:null})[_0xaa76('0x11')](function(_0x27c4a6){if(_0x27c4a6){return _0x27c4a6[_0xaa76('0x27')](_0x1fb711['body'][_0xaa76('0x28')],_['omit'](_0x1fb711[_0xaa76('0x1f')],[_0xaa76('0x28'),'id'])||{});}})[_0xaa76('0x29')](function(_0x42f3fb){logger['info'](_0xaa76('0x2a'),_0x1fb711);logger[_0xaa76('0x15')](_0xaa76('0x2a'),_0x1fb711,JSON['stringify'](_0x42f3fb));_0x83a532(_0x42f3fb);})[_0xaa76('0x24')](function(_0x34955f){logger[_0xaa76('0x18')](_0xaa76('0x2a'),_0x34955f['message'],_0x1fb711);_0x27cbac(_this[_0xaa76('0x18')](0x1f4,_0x34955f[_0xaa76('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4f171a2..8f19df5 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 _0x9d38=['chatInteraction:','./chatInteraction.events','save','emit'];(function(_0x362b05,_0x1d95fb){var _0x39ab83=function(_0x3f9d64){while(--_0x3f9d64){_0x362b05['push'](_0x362b05['shift']());}};_0x39ab83(++_0x1d95fb);}(_0x9d38,0xe5));var _0x89d3=function(_0x25ebfe,_0x1394eb){_0x25ebfe=_0x25ebfe-0x0;var _0x1ca13f=_0x9d38[_0x25ebfe];return _0x1ca13f;};'use strict';var ChatInteractionEvents=require(_0x89d3('0x0'));var events=[_0x89d3('0x1'),'remove','update'];function createListener(_0x13cb78,_0x5a892b){return function(_0x2df9cc){_0x5a892b[_0x89d3('0x2')](_0x13cb78,_0x2df9cc);};}function removeListener(_0x10f541,_0x2ee6d0){return function(){ChatInteractionEvents['removeListener'](_0x10f541,_0x2ee6d0);};}exports['register']=function(_0x5e422){for(var _0x3a244c=0x0,_0x5edcf7=events['length'];_0x3a244c<_0x5edcf7;_0x3a244c++){var _0x5ae980=events[_0x3a244c];var _0x142415=createListener(_0x89d3('0x3')+_0x5ae980,_0x5e422);ChatInteractionEvents['on'](_0x5ae980,_0x142415);}}; \ No newline at end of file +var _0x5a82=['update','emit','register','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5a82,0x108));var _0x25a8=function(_0x3464e0,_0x1b8e8a){_0x3464e0=_0x3464e0-0x0;var _0x266ab2=_0x5a82[_0x3464e0];return _0x266ab2;};'use strict';var ChatInteractionEvents=require(_0x25a8('0x0'));var events=['save',_0x25a8('0x1'),_0x25a8('0x2')];function createListener(_0x245e61,_0x74edf2){return function(_0x49a9bf){_0x74edf2[_0x25a8('0x3')](_0x245e61,_0x49a9bf);};}function removeListener(_0x546912,_0x3a88a7){return function(){ChatInteractionEvents['removeListener'](_0x546912,_0x3a88a7);};}exports[_0x25a8('0x4')]=function(_0xc34c5d){for(var _0x278e79=0x0,_0x2bffbf=events[_0x25a8('0x5')];_0x278e79<_0x2bffbf;_0x278e79++){var _0x4e8cda=events[_0x278e79];var _0x40d747=createListener(_0x25a8('0x6')+_0x4e8cda,_0xc34c5d);ChatInteractionEvents['on'](_0x4e8cda,_0x40d747);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2e2e0c4..00ec4ca 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 _0x8535=['destroy','removeTags','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chat','chatinteraction:destroy'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x8535,0x19b));var _0x5853=function(_0x4a5796,_0x19838a){_0x4a5796=_0x4a5796-0x0;var _0x2d7379=_0x8535[_0x4a5796];return _0x2d7379;};'use strict';var multer=require('multer');var util=require(_0x5853('0x0'));var path=require(_0x5853('0x1'));var timeout=require('connect-timeout');var express=require(_0x5853('0x2'));var router=express['Router']();var auth=require(_0x5853('0x3'));var interaction=require(_0x5853('0x4'));var config=require(_0x5853('0x5'));var controller=require(_0x5853('0x6'));router[_0x5853('0x7')]('/',auth['isAuthenticated'](),controller[_0x5853('0x8')]);router[_0x5853('0x7')](_0x5853('0x9'),auth[_0x5853('0xa')](),controller[_0x5853('0xb')]);router[_0x5853('0x7')](_0x5853('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x5853('0xd')]);router['get']('/:id/attachment_download',auth[_0x5853('0xe')](),controller[_0x5853('0xf')]);router[_0x5853('0x7')](_0x5853('0x10'),auth[_0x5853('0xa')](),controller['getMessages']);router[_0x5853('0x7')](_0x5853('0x11'),auth[_0x5853('0xe')](),controller[_0x5853('0x12')]);router[_0x5853('0x7')](_0x5853('0x13'),auth[_0x5853('0xa')](),controller[_0x5853('0x14')]);router[_0x5853('0x15')]('/',auth[_0x5853('0xa')](),controller['create']);router[_0x5853('0x15')](_0x5853('0x16'),auth[_0x5853('0xa')](),controller[_0x5853('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f89b9,_0x47c269,_0xb3472a){_0xb3472a(null,path[_0x5853('0x18')](config[_0x5853('0x19')],_0x5853('0x1a')));},'filename':function(_0x4c290a,_0x1a504b,_0x2ab340){_0x2ab340(null,util['format'](_0x5853('0x1b'),Date[_0x5853('0x1c')](),_0x1a504b['originalname'][_0x5853('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5853('0x1e'),upload[_0x5853('0x1f')](_0x5853('0x20')),controller['attachmentUpload']);router['post'](_0x5853('0x10'),auth[_0x5853('0xe')](),controller[_0x5853('0x21')]);router[_0x5853('0x15')](_0x5853('0x22'),auth[_0x5853('0xa')](),interaction[_0x5853('0x23')]('chat','chatinteraction:addtags'),controller[_0x5853('0x24')]);router[_0x5853('0x25')]('/:id',auth[_0x5853('0xa')](),interaction[_0x5853('0x23')]('chat',_0x5853('0x26')),controller[_0x5853('0x27')]);router[_0x5853('0x25')](_0x5853('0x28'),controller[_0x5853('0x29')]);router[_0x5853('0x25')](_0x5853('0x2a'),auth[_0x5853('0xe')](),controller[_0x5853('0x2b')]);router[_0x5853('0x25')](_0x5853('0x2c'),controller['close']);router[_0x5853('0x2d')]('/:id',auth[_0x5853('0xa')](),interaction['tracked'](_0x5853('0x2e'),_0x5853('0x2f')),controller[_0x5853('0x30')]);router['delete'](_0x5853('0x22'),auth[_0x5853('0xa')](),controller[_0x5853('0x31')]);module[_0x5853('0x32')]=router; \ No newline at end of file +var _0xe360=['show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','single','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/:id'];(function(_0x2db9c8,_0x2c9a49){var _0x493551=function(_0x494e5a){while(--_0x494e5a){_0x2db9c8['push'](_0x2db9c8['shift']());}};_0x493551(++_0x2c9a49);}(_0xe360,0x119));var _0x0e36=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xe360[_0x5e6cb8];return _0x3faeb3;};'use strict';var multer=require('multer');var util=require(_0x0e36('0x0'));var path=require(_0x0e36('0x1'));var timeout=require(_0x0e36('0x2'));var express=require(_0x0e36('0x3'));var router=express[_0x0e36('0x4')]();var auth=require(_0x0e36('0x5'));var interaction=require(_0x0e36('0x6'));var config=require(_0x0e36('0x7'));var controller=require(_0x0e36('0x8'));router[_0x0e36('0x9')]('/',auth[_0x0e36('0xa')](),controller[_0x0e36('0xb')]);router[_0x0e36('0x9')]('/describe',auth[_0x0e36('0xa')](),controller['describe']);router[_0x0e36('0x9')](_0x0e36('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x0e36('0xd')]);router[_0x0e36('0x9')](_0x0e36('0xe'),auth[_0x0e36('0xf')](),controller[_0x0e36('0x10')]);router[_0x0e36('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0e36('0x11')]);router['get'](_0x0e36('0x12'),auth[_0x0e36('0xf')](),controller[_0x0e36('0x13')]);router['get'](_0x0e36('0x14'),auth['isAuthenticated'](),controller['download']);router[_0x0e36('0x15')]('/',auth[_0x0e36('0xa')](),controller[_0x0e36('0x16')]);router[_0x0e36('0x15')](_0x0e36('0x17'),auth[_0x0e36('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x0e36('0x18')]({'destination':function(_0x5453d6,_0x11246c,_0x46e25f){_0x46e25f(null,path['join'](config[_0x0e36('0x19')],_0x0e36('0x1a')));},'filename':function(_0x3fba3b,_0x38f8b7,_0x223e4f){_0x223e4f(null,util[_0x0e36('0x1b')](_0x0e36('0x1c'),Date['now'](),_0x38f8b7[_0x0e36('0x1d')][_0x0e36('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0e36('0x15')]('/:id/attachment_upload',upload[_0x0e36('0x1f')]('file'),controller['attachmentUpload']);router[_0x0e36('0x15')](_0x0e36('0x20'),auth[_0x0e36('0xf')](),controller[_0x0e36('0x21')]);router[_0x0e36('0x15')](_0x0e36('0x22'),auth[_0x0e36('0xa')](),interaction[_0x0e36('0x23')](_0x0e36('0x24'),_0x0e36('0x25')),controller['addTags']);router[_0x0e36('0x26')](_0x0e36('0xc'),auth[_0x0e36('0xa')](),interaction['tracked']('chat','chatinteraction:update'),controller[_0x0e36('0x27')]);router[_0x0e36('0x26')](_0x0e36('0x28'),controller[_0x0e36('0x29')]);router[_0x0e36('0x26')](_0x0e36('0x2a'),auth[_0x0e36('0xf')](),controller['abandon']);router['put']('/:id/close',controller[_0x0e36('0x2b')]);router['delete'](_0x0e36('0xc'),auth[_0x0e36('0xa')](),interaction[_0x0e36('0x23')](_0x0e36('0x24'),_0x0e36('0x2c')),controller[_0x0e36('0x2d')]);router[_0x0e36('0x2e')](_0x0e36('0x22'),auth[_0x0e36('0xa')](),controller[_0x0e36('0x2f')]);module[_0x0e36('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a5855e4..def42f4 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 _0x0295=['sequelize','medium'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0295,0x1f0));var _0x5029=function(_0x1ef726,_0x16fdea){_0x1ef726=_0x1ef726-0x0;var _0x4c3c66=_0x0295[_0x1ef726];return _0x4c3c66;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x294bd1,_0x24e0cb){var _0x55603d=function(_0xde5d4d){while(--_0xde5d4d){_0x294bd1['push'](_0x294bd1['shift']());}};_0x55603d(++_0x24e0cb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36bdfc,_0x3c67f1){_0x36bdfc=_0x36bdfc-0x0;var _0x22a5be=_0x5f2f[_0x36bdfc];return _0x22a5be;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 541a4a5..2b13167 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 _0x6f0b=['rows','catch','show','params','options','create','body','find','describe','get','messages','createdAt','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','read','-createdAt','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','then','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','count','includeAll','include','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f0b,0x94));var _0xb6f0=function(_0x5bff5d,_0x120b46){_0x5bff5d=_0x5bff5d-0x0;var _0x3e7af3=_0x6f0b[_0x5bff5d];return _0x3e7af3;};'use strict';var pdf=require(_0xb6f0('0x0'));var emlformat=require(_0xb6f0('0x1'));var rimraf=require(_0xb6f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb6f0('0x3'));var rp=require(_0xb6f0('0x4'));var moment=require(_0xb6f0('0x5'));var BPromise=require(_0xb6f0('0x6'));var Mustache=require(_0xb6f0('0x7'));var util=require(_0xb6f0('0x8'));var path=require('path');var sox=require(_0xb6f0('0x9'));var csv=require(_0xb6f0('0xa'));var ejs=require(_0xb6f0('0xb'));var fs=require('fs');var _=require(_0xb6f0('0xc'));var squel=require(_0xb6f0('0xd'));var crypto=require(_0xb6f0('0xe'));var jsforce=require(_0xb6f0('0xf'));var deskjs=require(_0xb6f0('0x10'));var toCsv=require(_0xb6f0('0xa'));var querystring=require(_0xb6f0('0x11'));var Papa=require(_0xb6f0('0x12'));var Redis=require(_0xb6f0('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb6f0('0x14'));var as=require(_0xb6f0('0x15'));var hardwareService=require(_0xb6f0('0x16'));var logger=require(_0xb6f0('0x17'))(_0xb6f0('0x18'));var utils=require(_0xb6f0('0x19'));var config=require(_0xb6f0('0x1a'));var licenseUtil=require(_0xb6f0('0x1b'));var db=require(_0xb6f0('0x1c'))['db'];config[_0xb6f0('0x1d')]=_['defaults'](config[_0xb6f0('0x1d')],{'host':_0xb6f0('0x1e'),'port':0x18eb});var socket=require(_0xb6f0('0x1f'))(new Redis(config[_0xb6f0('0x1d')]));require(_0xb6f0('0x20'))['register'](socket);function respondWithStatusCode(_0x460c12,_0x12e555){_0x12e555=_0x12e555||0xcc;return function(_0x3c34d7){if(_0x3c34d7){return _0x460c12[_0xb6f0('0x21')](_0x12e555);}return _0x460c12[_0xb6f0('0x22')](_0x12e555)[_0xb6f0('0x23')]();};}function respondWithResult(_0x3f93fe,_0x21b671){_0x21b671=_0x21b671||0xc8;return function(_0x411efd){if(_0x411efd){return _0x3f93fe['status'](_0x21b671)[_0xb6f0('0x24')](_0x411efd);}};}function respondWithFilteredResult(_0x16b832,_0x3adac5){return function(_0xe4f25c){if(_0xe4f25c){var _0x258e2d=_0xe4f25c['count'],_0x428146=_0x3adac5['offset'],_0x14863c=_0x3adac5[_0xb6f0('0x25')]+_0x3adac5[_0xb6f0('0x26')],_0x40d896;if(_0x14863c>=_0x258e2d){_0x14863c=_0x258e2d;_0x40d896=0xc8;}else{_0x40d896=0xce;}_0x16b832[_0xb6f0('0x22')](_0x40d896);return _0x16b832[_0xb6f0('0x27')]('Content-Range',_0x428146+'-'+_0x14863c+'/'+_0x258e2d)[_0xb6f0('0x24')](_0xe4f25c);}return null;};}function patchUpdates(_0x2599b7){return function(_0x457146){try{jsonpatch[_0xb6f0('0x28')](_0x457146,_0x2599b7,!![]);}catch(_0x4854f3){return BPromise['reject'](_0x4854f3);}return _0x457146[_0xb6f0('0x29')]();};}function saveUpdates(_0x5672f0,_0x4183e3){return function(_0x3b0712){if(_0x3b0712){return _0x3b0712[_0xb6f0('0x2a')](_0x5672f0)['then'](function(_0x452741){return _0x452741;});}return null;};}function removeEntity(_0x1b5638,_0x3bf6bf){return function(_0x195907){if(_0x195907){return _0x195907[_0xb6f0('0x2b')]()[_0xb6f0('0x2c')](function(){_0x1b5638[_0xb6f0('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35806b,_0xc9bc77){return function(_0xc1050f){if(!_0xc1050f){_0x35806b['sendStatus'](0x194);}return _0xc1050f;};}function handleError(_0x50ec3a,_0x40946e){_0x40946e=_0x40946e||0x1f4;return function(_0xbd539c){logger[_0xb6f0('0x2d')](_0xbd539c['stack']);if(_0xbd539c[_0xb6f0('0x2e')]){delete _0xbd539c[_0xb6f0('0x2e')];}_0x50ec3a[_0xb6f0('0x22')](_0x40946e)[_0xb6f0('0x2f')](_0xbd539c);};}exports[_0xb6f0('0x30')]=function(_0x1a4165,_0x4790c6){var _0xb3b455={},_0x45f0fc={},_0x164e6a={'count':0x0,'rows':[]};var _0x22f2e9=_[_0xb6f0('0x31')](db[_0xb6f0('0x32')][_0xb6f0('0x33')],function(_0xad8295){return{'name':_0xad8295[_0xb6f0('0x34')],'type':_0xad8295['type'][_0xb6f0('0x35')]};});_0x45f0fc['model']=_[_0xb6f0('0x31')](_0x22f2e9,'name');_0x45f0fc[_0xb6f0('0x36')]=_[_0xb6f0('0x37')](_0x1a4165[_0xb6f0('0x36')]);_0x45f0fc['filters']=_[_0xb6f0('0x38')](_0x45f0fc['model'],_0x45f0fc[_0xb6f0('0x36')]);_0xb3b455[_0xb6f0('0x39')]=_[_0xb6f0('0x38')](_0x45f0fc[_0xb6f0('0x3a')],qs[_0xb6f0('0x3b')](_0x1a4165[_0xb6f0('0x36')][_0xb6f0('0x3b')]));_0xb3b455[_0xb6f0('0x39')]=_0xb3b455[_0xb6f0('0x39')][_0xb6f0('0x3c')]?_0xb3b455[_0xb6f0('0x39')]:_0x45f0fc['model'];if(!_0x1a4165[_0xb6f0('0x36')][_0xb6f0('0x3d')]('nolimit')){_0xb3b455[_0xb6f0('0x26')]=qs[_0xb6f0('0x26')](_0x1a4165[_0xb6f0('0x36')][_0xb6f0('0x26')]);_0xb3b455[_0xb6f0('0x25')]=qs[_0xb6f0('0x25')](_0x1a4165['query'][_0xb6f0('0x25')]);}_0xb3b455[_0xb6f0('0x3e')]=qs[_0xb6f0('0x3f')](_0x1a4165['query'][_0xb6f0('0x3f')]);_0xb3b455[_0xb6f0('0x40')]=qs[_0xb6f0('0x41')](_['pick'](_0x1a4165['query'],_0x45f0fc[_0xb6f0('0x41')]),_0x22f2e9);if(_0x1a4165['query'][_0xb6f0('0x42')]){_0xb3b455[_0xb6f0('0x40')]=_[_0xb6f0('0x43')](_0xb3b455[_0xb6f0('0x40')],{'$or':_[_0xb6f0('0x31')](_0x22f2e9,function(_0x2ae260){if(_0x2ae260[_0xb6f0('0x44')]!==_0xb6f0('0x45')){var _0x15d539={};_0x15d539[_0x2ae260[_0xb6f0('0x2e')]]={'$like':'%'+_0x1a4165['query']['filter']+'%'};return _0x15d539;}})});}_0xb3b455=_[_0xb6f0('0x43')]({},_0xb3b455,_0x1a4165['options']);var _0x315ea7={'where':_0xb3b455[_0xb6f0('0x40')]};return db[_0xb6f0('0x32')][_0xb6f0('0x46')](_0x315ea7)[_0xb6f0('0x2c')](function(_0x1fd247){_0x164e6a[_0xb6f0('0x46')]=_0x1fd247;if(_0x1a4165['query'][_0xb6f0('0x47')]){_0xb3b455[_0xb6f0('0x48')]=[{'all':!![]}];}return db[_0xb6f0('0x32')][_0xb6f0('0x49')](_0xb3b455);})[_0xb6f0('0x2c')](function(_0x128ca2){_0x164e6a[_0xb6f0('0x4a')]=_0x128ca2;return _0x164e6a;})[_0xb6f0('0x2c')](respondWithFilteredResult(_0x4790c6,_0xb3b455))[_0xb6f0('0x4b')](handleError(_0x4790c6,null));};exports[_0xb6f0('0x4c')]=function(_0x2c882e,_0x2f556f){var _0x18cdce={'raw':!![],'where':{'id':_0x2c882e[_0xb6f0('0x4d')]['id']}},_0x5e4a71={};_0x5e4a71[_0xb6f0('0x3a')]=_[_0xb6f0('0x37')](db[_0xb6f0('0x32')][_0xb6f0('0x33')]);_0x5e4a71['query']=_['keys'](_0x2c882e['query']);_0x5e4a71['filters']=_['intersection'](_0x5e4a71['model'],_0x5e4a71[_0xb6f0('0x36')]);_0x18cdce[_0xb6f0('0x39')]=_[_0xb6f0('0x38')](_0x5e4a71['model'],qs['fields'](_0x2c882e['query'][_0xb6f0('0x3b')]));_0x18cdce[_0xb6f0('0x39')]=_0x18cdce[_0xb6f0('0x39')][_0xb6f0('0x3c')]?_0x18cdce[_0xb6f0('0x39')]:_0x5e4a71['model'];if(_0x2c882e[_0xb6f0('0x36')][_0xb6f0('0x47')]){_0x18cdce['include']=[{'all':!![]}];}_0x18cdce=_['merge']({},_0x18cdce,_0x2c882e[_0xb6f0('0x4e')]);return db['ChatInternalMessage']['find'](_0x18cdce)[_0xb6f0('0x2c')](handleEntityNotFound(_0x2f556f,null))[_0xb6f0('0x2c')](respondWithResult(_0x2f556f,null))[_0xb6f0('0x4b')](handleError(_0x2f556f,null));};exports[_0xb6f0('0x4f')]=function(_0x274d44,_0x14979c){return db['ChatInternalMessage'][_0xb6f0('0x4f')](_0x274d44[_0xb6f0('0x50')],{})[_0xb6f0('0x2c')](respondWithResult(_0x14979c,0xc9))[_0xb6f0('0x4b')](handleError(_0x14979c,null));};exports[_0xb6f0('0x2a')]=function(_0x936ca1,_0x4f93fa){if(_0x936ca1[_0xb6f0('0x50')]['id']){delete _0x936ca1[_0xb6f0('0x50')]['id'];}return db[_0xb6f0('0x32')][_0xb6f0('0x51')]({'where':{'id':_0x936ca1[_0xb6f0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f93fa,null))[_0xb6f0('0x2c')](saveUpdates(_0x936ca1[_0xb6f0('0x50')],null))[_0xb6f0('0x2c')](respondWithResult(_0x4f93fa,null))['catch'](handleError(_0x4f93fa,null));};exports[_0xb6f0('0x2b')]=function(_0x251ae7,_0x46d6c9){return db[_0xb6f0('0x32')][_0xb6f0('0x51')]({'where':{'id':_0x251ae7['params']['id']}})[_0xb6f0('0x2c')](handleEntityNotFound(_0x46d6c9,null))['then'](removeEntity(_0x46d6c9,null))[_0xb6f0('0x4b')](handleError(_0x46d6c9,null));};exports[_0xb6f0('0x52')]=function(_0x22da57,_0x50ba15){return db[_0xb6f0('0x32')][_0xb6f0('0x52')]()[_0xb6f0('0x2c')](respondWithResult(_0x50ba15,null))[_0xb6f0('0x4b')](handleError(_0x50ba15,null));};function wrapUser(_0x26dc84){return function(_0x24ebc9){var _0x140501=_0x26dc84[_0xb6f0('0x53')]({'plain':!![]});_0x140501[_0xb6f0('0x54')]=[];if(_0x24ebc9){_0x140501['lastMessageAt']=_0x24ebc9[_0xb6f0('0x55')];_0x140501['lastMessage']=_0x24ebc9;}else{_0x140501[_0xb6f0('0x56')]=moment(0x0)['format'](_0xb6f0('0x57'));_0x140501['lastMessage']={};}return _0x140501;};}exports[_0xb6f0('0x58')]=function(_0x274dc2,_0xd8409b,_0x412d2e){var _0x184953=[];return db['User'][_0xb6f0('0x49')]({'where':{'role':[_0xb6f0('0x59'),_0xb6f0('0x5a'),_0xb6f0('0x5b')]},'attributes':['id',_0xb6f0('0x5c'),'name',_0xb6f0('0x5d'),_0xb6f0('0x5e'),'internal',_0xb6f0('0x5f'),_0xb6f0('0x60'),_0xb6f0('0x61'),_0xb6f0('0x62')],'order':qs['sort'](_0xb6f0('0x63')),'include':[{'model':db[_0xb6f0('0x64')],'as':_0xb6f0('0x65'),'attributes':['id','name',_0xb6f0('0x44')],'through':{'attributes':[]}}]})['then'](function(_0x3a254b){if(_0x3a254b){var _0x21a4ff=_0x274dc2[_0xb6f0('0x5b')]['get']({'plain':!![]});if(!_0x21a4ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21a4ff['role']===_0xb6f0('0x5b')){return db[_0xb6f0('0x66')][_0xb6f0('0x51')]({'where':{'name':_0xb6f0('0x67'),'userProfileId':_0x21a4ff['userProfileId']},'raw':!![]})['then'](function(_0x537ba4){if(_0x537ba4){if(_0x537ba4[_0xb6f0('0x68')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x537ba4['id']},'raw':!![]})['then'](function(_0x5bb1a5){var _0x53d06a=[];if(_[_0xb6f0('0x69')](_0x5bb1a5)){_0x53d06a=_['filter'](_0x3a254b,function(_0x13049b){if(_0x13049b[_0xb6f0('0x5d')]!==_0xb6f0('0x59')){return _0x13049b;}});return _0x53d06a;}else{for(var _0x4753f5=0x0;_0x4753f5<_0x3a254b[_0xb6f0('0x3c')];_0x4753f5++){var _0x1caa16=_0x3a254b[_0x4753f5];if(_0x1caa16[_0xb6f0('0x5d')]===_0xb6f0('0x59')){var _0xa4fc78=_[_0xb6f0('0x51')](_0x5bb1a5,function(_0x2c005e){return _0x2c005e[_0xb6f0('0x6a')]===_0x1caa16['id'];});if(_0xa4fc78)_0x53d06a['push'](_0x1caa16);}else{_0x53d06a[_0xb6f0('0x6b')](_0x1caa16);}}return _0x53d06a;}});}else{return _0x3a254b;}}else{var _0x629923=_[_0xb6f0('0x42')](_0x3a254b,function(_0x2e0766){if(_0x2e0766[_0xb6f0('0x5d')]!==_0xb6f0('0x59')){return _0x2e0766;}});return _0x629923;}});}else{return _0x3a254b;}}})[_0xb6f0('0x2c')](function(_0x533ff8){var _0x50e71c=[];if(_0x533ff8){_0x184953=_0x533ff8;for(var _0x27fc9a=0x0;_0x27fc9a<_0x533ff8[_0xb6f0('0x3c')];_0x27fc9a+=0x1){_0x184953[_0x27fc9a][_0xb6f0('0x54')]=[];_0x50e71c[_0xb6f0('0x6b')](db['ChatInternalMessage'][_0xb6f0('0x51')]({'where':{'FromId':[_0x274dc2[_0xb6f0('0x5b')]['id'],_0x533ff8[_0x27fc9a]['id']],'ToId':[_0x274dc2[_0xb6f0('0x5b')]['id'],_0x533ff8[_0x27fc9a]['id']],'ChatGroupId':null},'attributes':['id',_0xb6f0('0x55'),'FromId','ToId',_0xb6f0('0x6c'),_0xb6f0('0x50')],'order':qs[_0xb6f0('0x3f')](_0xb6f0('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb6f0('0x2c')](wrapUser(_0x533ff8[_0x27fc9a])));}return BPromise[_0xb6f0('0x6e')](_0x50e71c);}return[];})[_0xb6f0('0x2c')](function(_0x43243e){return{'rows':_0x43243e,'count':_0x43243e[_0xb6f0('0x3c')]};})[_0xb6f0('0x2c')](respondWithResult(_0xd8409b,null))['catch'](handleError(_0xd8409b,null));}; \ No newline at end of file +var _0xfeaf=['UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','status','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','model','query','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','intersection','find','catch','create','body','describe','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','agent','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId'];(function(_0xc83a19,_0x40f352){var _0x489adf=function(_0x3375f0){while(--_0x3375f0){_0xc83a19['push'](_0xc83a19['shift']());}};_0x489adf(++_0x40f352);}(_0xfeaf,0x73));var _0xffea=function(_0x2cb008,_0x4480b1){_0x2cb008=_0x2cb008-0x0;var _0x5b3c72=_0xfeaf[_0x2cb008];return _0x5b3c72;};'use strict';var pdf=require(_0xffea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xffea('0x1'));var zipdir=require(_0xffea('0x2'));var jsonpatch=require(_0xffea('0x3'));var rp=require(_0xffea('0x4'));var moment=require(_0xffea('0x5'));var BPromise=require(_0xffea('0x6'));var Mustache=require(_0xffea('0x7'));var util=require(_0xffea('0x8'));var path=require(_0xffea('0x9'));var sox=require(_0xffea('0xa'));var csv=require(_0xffea('0xb'));var ejs=require(_0xffea('0xc'));var fs=require('fs');var _=require(_0xffea('0xd'));var squel=require('squel');var crypto=require(_0xffea('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xffea('0xf'));var toCsv=require(_0xffea('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xffea('0x10'));var qs=require(_0xffea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffea('0x12'));var logger=require(_0xffea('0x13'))(_0xffea('0x14'));var utils=require(_0xffea('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xffea('0x16')]=_[_0xffea('0x17')](config[_0xffea('0x16')],{'host':_0xffea('0x18'),'port':0x18eb});var socket=require(_0xffea('0x19'))(new Redis(config['redis']));require(_0xffea('0x1a'))['register'](socket);function respondWithStatusCode(_0xf58b0b,_0x481627){_0x481627=_0x481627||0xcc;return function(_0x810622){if(_0x810622){return _0xf58b0b[_0xffea('0x1b')](_0x481627);}return _0xf58b0b['status'](_0x481627)[_0xffea('0x1c')]();};}function respondWithResult(_0x4bfedb,_0x3150d0){_0x3150d0=_0x3150d0||0xc8;return function(_0x809d1d){if(_0x809d1d){return _0x4bfedb['status'](_0x3150d0)[_0xffea('0x1d')](_0x809d1d);}};}function respondWithFilteredResult(_0x5e20d9,_0x490397){return function(_0x35c089){if(_0x35c089){var _0x1a1bbd=_0x35c089[_0xffea('0x1e')],_0x569245=_0x490397[_0xffea('0x1f')],_0x13116b=_0x490397[_0xffea('0x1f')]+_0x490397['limit'],_0x215721;if(_0x13116b>=_0x1a1bbd){_0x13116b=_0x1a1bbd;_0x215721=0xc8;}else{_0x215721=0xce;}_0x5e20d9['status'](_0x215721);return _0x5e20d9[_0xffea('0x20')](_0xffea('0x21'),_0x569245+'-'+_0x13116b+'/'+_0x1a1bbd)[_0xffea('0x1d')](_0x35c089);}return null;};}function patchUpdates(_0x119844){return function(_0x52885c){try{jsonpatch[_0xffea('0x22')](_0x52885c,_0x119844,!![]);}catch(_0x44ea7f){return BPromise[_0xffea('0x23')](_0x44ea7f);}return _0x52885c[_0xffea('0x24')]();};}function saveUpdates(_0x17ccc8,_0x1c841b){return function(_0x567f60){if(_0x567f60){return _0x567f60[_0xffea('0x25')](_0x17ccc8)[_0xffea('0x26')](function(_0xa9de44){return _0xa9de44;});}return null;};}function removeEntity(_0x5cdd1b,_0x322a65){return function(_0x338efe){if(_0x338efe){return _0x338efe['destroy']()[_0xffea('0x26')](function(){_0x5cdd1b[_0xffea('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc39bc,_0x21def0){return function(_0xd3de7e){if(!_0xd3de7e){_0xcc39bc[_0xffea('0x1b')](0x194);}return _0xd3de7e;};}function handleError(_0x3e97d7,_0x590e74){_0x590e74=_0x590e74||0x1f4;return function(_0x1c8923){logger[_0xffea('0x28')](_0x1c8923[_0xffea('0x29')]);if(_0x1c8923['name']){delete _0x1c8923[_0xffea('0x2a')];}_0x3e97d7[_0xffea('0x27')](_0x590e74)[_0xffea('0x2b')](_0x1c8923);};}exports[_0xffea('0x2c')]=function(_0xddc041,_0x235609){var _0x4471ca={},_0x1532fc={},_0x11d16b={'count':0x0,'rows':[]};var _0x34cca2=_[_0xffea('0x2d')](db[_0xffea('0x2e')]['rawAttributes'],function(_0x282afd){return{'name':_0x282afd[_0xffea('0x2f')],'type':_0x282afd[_0xffea('0x30')]['key']};});_0x1532fc[_0xffea('0x31')]=_[_0xffea('0x2d')](_0x34cca2,_0xffea('0x2a'));_0x1532fc[_0xffea('0x32')]=_['keys'](_0xddc041[_0xffea('0x32')]);_0x1532fc['filters']=_['intersection'](_0x1532fc[_0xffea('0x31')],_0x1532fc[_0xffea('0x32')]);_0x4471ca['attributes']=_['intersection'](_0x1532fc['model'],qs['fields'](_0xddc041[_0xffea('0x32')][_0xffea('0x33')]));_0x4471ca['attributes']=_0x4471ca['attributes'][_0xffea('0x34')]?_0x4471ca[_0xffea('0x35')]:_0x1532fc[_0xffea('0x31')];if(!_0xddc041[_0xffea('0x32')][_0xffea('0x36')](_0xffea('0x37'))){_0x4471ca['limit']=qs[_0xffea('0x38')](_0xddc041['query'][_0xffea('0x38')]);_0x4471ca['offset']=qs[_0xffea('0x1f')](_0xddc041[_0xffea('0x32')][_0xffea('0x1f')]);}_0x4471ca[_0xffea('0x39')]=qs['sort'](_0xddc041['query'][_0xffea('0x3a')]);_0x4471ca[_0xffea('0x3b')]=qs[_0xffea('0x3c')](_['pick'](_0xddc041[_0xffea('0x32')],_0x1532fc[_0xffea('0x3c')]),_0x34cca2);if(_0xddc041[_0xffea('0x32')][_0xffea('0x3d')]){_0x4471ca[_0xffea('0x3b')]=_[_0xffea('0x3e')](_0x4471ca[_0xffea('0x3b')],{'$or':_[_0xffea('0x2d')](_0x34cca2,function(_0x5b29a2){if(_0x5b29a2[_0xffea('0x30')]!==_0xffea('0x3f')){var _0x56284c={};_0x56284c[_0x5b29a2[_0xffea('0x2a')]]={'$like':'%'+_0xddc041[_0xffea('0x32')][_0xffea('0x3d')]+'%'};return _0x56284c;}})});}_0x4471ca=_[_0xffea('0x3e')]({},_0x4471ca,_0xddc041[_0xffea('0x40')]);var _0x9a4606={'where':_0x4471ca[_0xffea('0x3b')]};return db['ChatInternalMessage']['count'](_0x9a4606)['then'](function(_0xf20854){_0x11d16b['count']=_0xf20854;if(_0xddc041[_0xffea('0x32')][_0xffea('0x41')]){_0x4471ca[_0xffea('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xffea('0x43')](_0x4471ca);})['then'](function(_0x2ef905){_0x11d16b[_0xffea('0x44')]=_0x2ef905;return _0x11d16b;})[_0xffea('0x26')](respondWithFilteredResult(_0x235609,_0x4471ca))['catch'](handleError(_0x235609,null));};exports['show']=function(_0x3ab783,_0x44e305){var _0x2459f5={'raw':!![],'where':{'id':_0x3ab783[_0xffea('0x45')]['id']}},_0x28c09a={};_0x28c09a[_0xffea('0x31')]=_[_0xffea('0x46')](db[_0xffea('0x2e')][_0xffea('0x47')]);_0x28c09a[_0xffea('0x32')]=_[_0xffea('0x46')](_0x3ab783[_0xffea('0x32')]);_0x28c09a[_0xffea('0x3c')]=_['intersection'](_0x28c09a['model'],_0x28c09a[_0xffea('0x32')]);_0x2459f5[_0xffea('0x35')]=_[_0xffea('0x48')](_0x28c09a[_0xffea('0x31')],qs[_0xffea('0x33')](_0x3ab783['query'][_0xffea('0x33')]));_0x2459f5[_0xffea('0x35')]=_0x2459f5[_0xffea('0x35')][_0xffea('0x34')]?_0x2459f5[_0xffea('0x35')]:_0x28c09a[_0xffea('0x31')];if(_0x3ab783[_0xffea('0x32')][_0xffea('0x41')]){_0x2459f5[_0xffea('0x42')]=[{'all':!![]}];}_0x2459f5=_[_0xffea('0x3e')]({},_0x2459f5,_0x3ab783[_0xffea('0x40')]);return db[_0xffea('0x2e')][_0xffea('0x49')](_0x2459f5)[_0xffea('0x26')](handleEntityNotFound(_0x44e305,null))[_0xffea('0x26')](respondWithResult(_0x44e305,null))[_0xffea('0x4a')](handleError(_0x44e305,null));};exports[_0xffea('0x4b')]=function(_0x1cf037,_0x3d322b){return db[_0xffea('0x2e')][_0xffea('0x4b')](_0x1cf037[_0xffea('0x4c')],{})[_0xffea('0x26')](respondWithResult(_0x3d322b,0xc9))[_0xffea('0x4a')](handleError(_0x3d322b,null));};exports['update']=function(_0xdabd3c,_0x51399c){if(_0xdabd3c[_0xffea('0x4c')]['id']){delete _0xdabd3c['body']['id'];}return db[_0xffea('0x2e')][_0xffea('0x49')]({'where':{'id':_0xdabd3c[_0xffea('0x45')]['id']}})[_0xffea('0x26')](handleEntityNotFound(_0x51399c,null))[_0xffea('0x26')](saveUpdates(_0xdabd3c[_0xffea('0x4c')],null))[_0xffea('0x26')](respondWithResult(_0x51399c,null))[_0xffea('0x4a')](handleError(_0x51399c,null));};exports['destroy']=function(_0x43be6b,_0x5b0fa9){return db['ChatInternalMessage'][_0xffea('0x49')]({'where':{'id':_0x43be6b[_0xffea('0x45')]['id']}})[_0xffea('0x26')](handleEntityNotFound(_0x5b0fa9,null))[_0xffea('0x26')](removeEntity(_0x5b0fa9,null))['catch'](handleError(_0x5b0fa9,null));};exports[_0xffea('0x4d')]=function(_0x3a2356,_0x23324e){return db[_0xffea('0x2e')][_0xffea('0x4d')]()['then'](respondWithResult(_0x23324e,null))[_0xffea('0x4a')](handleError(_0x23324e,null));};function wrapUser(_0x3b5aad){return function(_0x2e81ba){var _0x41b2cc=_0x3b5aad['get']({'plain':!![]});_0x41b2cc[_0xffea('0x4e')]=[];if(_0x2e81ba){_0x41b2cc[_0xffea('0x4f')]=_0x2e81ba[_0xffea('0x50')];_0x41b2cc['lastMessage']=_0x2e81ba;}else{_0x41b2cc[_0xffea('0x4f')]=moment(0x0)[_0xffea('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x41b2cc[_0xffea('0x52')]={};}return _0x41b2cc;};}exports[_0xffea('0x53')]=function(_0x41040b,_0x11ed57,_0x554066){var _0x4f49be=[];return db[_0xffea('0x54')][_0xffea('0x43')]({'where':{'role':[_0xffea('0x55'),'admin',_0xffea('0x56')]},'attributes':['id',_0xffea('0x57'),_0xffea('0x2a'),_0xffea('0x58'),_0xffea('0x59'),_0xffea('0x5a'),_0xffea('0x5b'),'lastLoginAt',_0xffea('0x5c'),_0xffea('0x5d')],'order':qs[_0xffea('0x3a')](_0xffea('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0xffea('0x5f'),'attributes':['id','name',_0xffea('0x30')],'through':{'attributes':[]}}]})[_0xffea('0x26')](function(_0x13d929){if(_0x13d929){var _0x3567b6=_0x41040b[_0xffea('0x56')]['get']({'plain':!![]});if(!_0x3567b6)throw new Error(_0xffea('0x60'));if(_0x3567b6[_0xffea('0x58')]===_0xffea('0x56')){return db['UserProfileSection']['find']({'where':{'name':_0xffea('0x61'),'userProfileId':_0x3567b6[_0xffea('0x62')]},'raw':!![]})['then'](function(_0x1e8489){if(_0x1e8489){if(_0x1e8489['autoAssociation']===0x0){return db[_0xffea('0x63')][_0xffea('0x43')]({'where':{'sectionId':_0x1e8489['id']},'raw':!![]})[_0xffea('0x26')](function(_0x21002f){var _0x3128a1=[];if(_[_0xffea('0x64')](_0x21002f)){_0x3128a1=_[_0xffea('0x3d')](_0x13d929,function(_0x34ef67){if(_0x34ef67[_0xffea('0x58')]!=='agent'){return _0x34ef67;}});return _0x3128a1;}else{for(var _0x38fbb6=0x0;_0x38fbb6<_0x13d929[_0xffea('0x34')];_0x38fbb6++){var _0x5e62f2=_0x13d929[_0x38fbb6];if(_0x5e62f2[_0xffea('0x58')]==='agent'){var _0x593e95=_[_0xffea('0x49')](_0x21002f,function(_0x434a14){return _0x434a14[_0xffea('0x65')]===_0x5e62f2['id'];});if(_0x593e95)_0x3128a1['push'](_0x5e62f2);}else{_0x3128a1[_0xffea('0x66')](_0x5e62f2);}}return _0x3128a1;}});}else{return _0x13d929;}}else{var _0x426528=_['filter'](_0x13d929,function(_0x3f525a){if(_0x3f525a[_0xffea('0x58')]!==_0xffea('0x55')){return _0x3f525a;}});return _0x426528;}});}else{return _0x13d929;}}})[_0xffea('0x26')](function(_0x58c351){var _0x55349c=[];if(_0x58c351){_0x4f49be=_0x58c351;for(var _0x434c55=0x0;_0x434c55<_0x58c351[_0xffea('0x34')];_0x434c55+=0x1){_0x4f49be[_0x434c55][_0xffea('0x4e')]=[];_0x55349c[_0xffea('0x66')](db['ChatInternalMessage'][_0xffea('0x49')]({'where':{'FromId':[_0x41040b['user']['id'],_0x58c351[_0x434c55]['id']],'ToId':[_0x41040b[_0xffea('0x56')]['id'],_0x58c351[_0x434c55]['id']],'ChatGroupId':null},'attributes':['id',_0xffea('0x50'),_0xffea('0x67'),'ToId',_0xffea('0x68'),'body'],'order':qs['sort'](_0xffea('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x58c351[_0x434c55])));}return BPromise[_0xffea('0x6a')](_0x55349c);}return[];})[_0xffea('0x26')](function(_0x4b5a09){return{'rows':_0x4b5a09,'count':_0x4b5a09[_0xffea('0x34')]};})['then'](respondWithResult(_0x11ed57,null))[_0xffea('0x4a')](handleError(_0x11ed57,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d0b4bbe..95bfaec 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 _0x61b8=['exports','events','../../mysqldb','ChatInternalMessage','save','emit','hasOwnProperty','hook'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x61b8,0x169));var _0x861b=function(_0x4eb780,_0x478e25){_0x4eb780=_0x4eb780-0x0;var _0x214fca=_0x61b8[_0x4eb780];return _0x214fca;};'use strict';var EventEmitter=require(_0x861b('0x0'));var ChatInternalMessage=require(_0x861b('0x1'))['db'][_0x861b('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x861b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x37b79f){return function(_0x10e70b,_0x4b139c,_0x56a7a9){ChatInternalMessageEvents[_0x861b('0x4')](_0x37b79f+':'+_0x10e70b['id'],_0x10e70b);ChatInternalMessageEvents[_0x861b('0x4')](_0x37b79f,_0x10e70b);_0x56a7a9(null);};}for(var e in events){if(events[_0x861b('0x5')](e)){var event=events[e];ChatInternalMessage[_0x861b('0x6')](e,emitEvent(event));}}module[_0x861b('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1c55=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x1c55,0x1e3));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x51c5('0x0'));var ChatInternalMessage=require(_0x51c5('0x1'))['db'][_0x51c5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x51c5('0x3')](0x0);var events={'afterCreate':_0x51c5('0x4'),'afterUpdate':_0x51c5('0x5'),'afterDestroy':_0x51c5('0x6')};function emitEvent(_0xe10c0e){return function(_0xa01afc,_0x29fab9,_0x49156c){ChatInternalMessageEvents[_0x51c5('0x7')](_0xe10c0e+':'+_0xa01afc['id'],_0xa01afc);ChatInternalMessageEvents[_0x51c5('0x7')](_0xe10c0e,_0xa01afc);_0x49156c(null);};}for(var e in events){if(events[_0x51c5('0x8')](e)){var event=events[e];ChatInternalMessage[_0x51c5('0x9')](e,emitEvent(event));}}module[_0x51c5('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 03f4302..60e8a6d 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 _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x3f010d,_0x1392cc){var _0x45e0bb=function(_0x3ef95d){while(--_0x3ef95d){_0x3f010d['push'](_0x3f010d['shift']());}};_0x45e0bb(++_0x1392cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 352f5b1..b16c054 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 _0xe0ca=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xe0ca,0xb1));var _0xae0c=function(_0x4eafcf,_0x458eb5){_0x4eafcf=_0x4eafcf-0x0;var _0x431945=_0xe0ca[_0x4eafcf];return _0x431945;};'use strict';var _=require(_0xae0c('0x0'));var util=require(_0xae0c('0x1'));var moment=require(_0xae0c('0x2'));var BPromise=require(_0xae0c('0x3'));var rs=require(_0xae0c('0x4'));var fs=require('fs');var Redis=require(_0xae0c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae0c('0x6'));var logger=require(_0xae0c('0x7'))(_0xae0c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae0c('0x9')][_0xae0c('0xa')]({'port':0x232a});config[_0xae0c('0xb')]=_[_0xae0c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae0c('0xb')]));require(_0xae0c('0xd'))[_0xae0c('0xe')](socket);function respondWithRpcPromise(_0x907201,_0x490a79,_0x2f3465){return new BPromise(function(_0x5e9b42,_0x449a54){return client[_0xae0c('0xf')](_0x907201,_0x2f3465)[_0xae0c('0x10')](function(_0x447ff){logger['info'](_0xae0c('0x11'),_0x490a79,_0xae0c('0x12'));logger['debug'](_0xae0c('0x13'),_0x490a79,'request\x20sent',JSON[_0xae0c('0x14')](_0x447ff));if(_0x447ff[_0xae0c('0x15')]){if(_0x447ff[_0xae0c('0x15')]['code']===0x1f4){logger['error'](_0xae0c('0x11'),_0x490a79,_0x447ff[_0xae0c('0x15')][_0xae0c('0x16')]);return _0x449a54(_0x447ff[_0xae0c('0x15')]['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x490a79,_0x447ff[_0xae0c('0x15')]['message']);return _0x5e9b42(_0x447ff[_0xae0c('0x15')]['message']);}else{logger[_0xae0c('0x17')](_0xae0c('0x11'),_0x490a79,'request\x20sent');_0x5e9b42(_0x447ff[_0xae0c('0x18')][_0xae0c('0x16')]);}})['catch'](function(_0x307329){logger[_0xae0c('0x15')](_0xae0c('0x11'),_0x490a79,_0x307329);_0x449a54(_0x307329);});});} \ No newline at end of file +var _0xc05b=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ab976,_0x481420){var _0x252db5=function(_0x1cadce){while(--_0x1cadce){_0x3ab976['push'](_0x3ab976['shift']());}};_0x252db5(++_0x481420);}(_0xc05b,0xb8));var _0xbc05=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xc05b[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var moment=require('moment');var BPromise=require(_0xbc05('0x2'));var rs=require(_0xbc05('0x3'));var fs=require('fs');var Redis=require(_0xbc05('0x4'));var db=require(_0xbc05('0x5'))['db'];var utils=require(_0xbc05('0x6'));var logger=require(_0xbc05('0x7'))(_0xbc05('0x8'));var config=require(_0xbc05('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc05('0xa')][_0xbc05('0xb')]({'port':0x232a});config[_0xbc05('0xc')]=_[_0xbc05('0xd')](config['redis'],{'host':_0xbc05('0xe'),'port':0x18eb});var socket=require(_0xbc05('0xf'))(new Redis(config[_0xbc05('0xc')]));require(_0xbc05('0x10'))[_0xbc05('0x11')](socket);function respondWithRpcPromise(_0x40c5d1,_0x399178,_0x131e47){return new BPromise(function(_0x4d23be,_0x53c85a){return client['request'](_0x40c5d1,_0x131e47)[_0xbc05('0x12')](function(_0x1ff740){logger[_0xbc05('0x13')](_0xbc05('0x14'),_0x399178,_0xbc05('0x15'));logger[_0xbc05('0x16')](_0xbc05('0x17'),_0x399178,_0xbc05('0x15'),JSON[_0xbc05('0x18')](_0x1ff740));if(_0x1ff740[_0xbc05('0x19')]){if(_0x1ff740[_0xbc05('0x19')][_0xbc05('0x1a')]===0x1f4){logger[_0xbc05('0x19')](_0xbc05('0x14'),_0x399178,_0x1ff740[_0xbc05('0x19')][_0xbc05('0x1b')]);return _0x53c85a(_0x1ff740['error'][_0xbc05('0x1b')]);}logger['error'](_0xbc05('0x14'),_0x399178,_0x1ff740['error'][_0xbc05('0x1b')]);return _0x4d23be(_0x1ff740['error'][_0xbc05('0x1b')]);}else{logger[_0xbc05('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x399178,_0xbc05('0x15'));_0x4d23be(_0x1ff740[_0xbc05('0x1c')]['message']);}})[_0xbc05('0x1d')](function(_0x45628b){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x399178,_0x45628b);_0x53c85a(_0x45628b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6122792..b2cfa6f 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 _0x61a1=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5d3391,_0x26043f){var _0x24cd40=function(_0x5e9b68){while(--_0x5e9b68){_0x5d3391['push'](_0x5d3391['shift']());}};_0x24cd40(++_0x26043f);}(_0x61a1,0x127));var _0x161a=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x61a1[_0x4a82ac];return _0x58ee97;};'use strict';var ChatInternalMessageEvents=require(_0x161a('0x0'));var events=[_0x161a('0x1'),_0x161a('0x2'),_0x161a('0x3')];function createListener(_0x180d9a,_0x4fd537){return function(_0x16162f){_0x4fd537[_0x161a('0x4')](_0x180d9a,_0x16162f);};}function removeListener(_0x52aadb,_0x1775e8){return function(){ChatInternalMessageEvents[_0x161a('0x5')](_0x52aadb,_0x1775e8);};}exports[_0x161a('0x6')]=function(_0x1442cf){for(var _0x1bb0ac=0x0,_0x45b1e8=events[_0x161a('0x7')];_0x1bb0ac<_0x45b1e8;_0x1bb0ac++){var _0x182e6c=events[_0x1bb0ac];var _0x3e07e5=createListener(_0x161a('0x8')+_0x182e6c,_0x1442cf);ChatInternalMessageEvents['on'](_0x182e6c,_0x3e07e5);}}; \ No newline at end of file +var _0xa4ba=['remove','update','removeListener','register','save'];(function(_0x4b81b6,_0x4a3dd1){var _0x5d1879=function(_0x216a43){while(--_0x216a43){_0x4b81b6['push'](_0x4b81b6['shift']());}};_0x5d1879(++_0x4a3dd1);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa4ba[_0x4ae6ef];return _0x3cbb4e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xaa4b('0x0'),_0xaa4b('0x1'),_0xaa4b('0x2')];function createListener(_0x27f13f,_0x55304b){return function(_0x102c1d){_0x55304b['emit'](_0x27f13f,_0x102c1d);};}function removeListener(_0x54f0ce,_0xeb83b1){return function(){ChatInternalMessageEvents[_0xaa4b('0x3')](_0x54f0ce,_0xeb83b1);};}exports[_0xaa4b('0x4')]=function(_0x146035){for(var _0x4809a9=0x0,_0x40f127=events['length'];_0x4809a9<_0x40f127;_0x4809a9++){var _0x3a6f0d=events[_0x4809a9];var _0x50ce72=createListener('chatInternalMessage:'+_0x3a6f0d,_0x146035);ChatInternalMessageEvents['on'](_0x3a6f0d,_0x50ce72);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8f84374..85b6326 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 _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x25f7ae,_0x52ccd4){var _0x429699=function(_0x279235){while(--_0x279235){_0x25f7ae['push'](_0x25f7ae['shift']());}};_0x429699(++_0x52ccd4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 +var _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0xb6fa1c,_0x5333c5){var _0x576211=function(_0x2eb30e){while(--_0x2eb30e){_0xb6fa1c['push'](_0xb6fa1c['shift']());}};_0x576211(++_0x5333c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xcb91[_0x51bda1];return _0x1ce08c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 863333b..eb33878 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 _0x1ab2=['TEXT','sequelize','BOOLEAN','out','DATE','STRING'];(function(_0x3d69a5,_0x2fd801){var _0x13170a=function(_0x443980){while(--_0x443980){_0x3d69a5['push'](_0x3d69a5['shift']());}};_0x13170a(++_0x2fd801);}(_0x1ab2,0x12d));var _0x21ab=function(_0x5e7fe7,_0x722a27){_0x5e7fe7=_0x5e7fe7-0x0;var _0x4497d7=_0x1ab2[_0x5e7fe7];return _0x4497d7;};'use strict';var Sequelize=require(_0x21ab('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x21ab('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x21ab('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x21ab('0x2')),'defaultValue':_0x21ab('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x21ab('0x3')]},'providerName':{'type':Sequelize[_0x21ab('0x4')]},'providerResponse':{'type':Sequelize[_0x21ab('0x5')]}}; \ No newline at end of file +var _0x04e8=['BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT','medium'];(function(_0x2a37a4,_0x464b98){var _0x29d935=function(_0xff7180){while(--_0xff7180){_0x2a37a4['push'](_0x2a37a4['shift']());}};_0x29d935(++_0x464b98);}(_0x04e8,0x1ad));var _0x804e=function(_0x436001,_0x2c2b15){_0x436001=_0x436001-0x0;var _0x44cd04=_0x04e8[_0x436001];return _0x44cd04;};'use strict';var Sequelize=require('sequelize');module[_0x804e('0x0')]={'body':{'type':Sequelize[_0x804e('0x1')](_0x804e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x804e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x804e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x804e('0x4')]('in',_0x804e('0x5')),'defaultValue':_0x804e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x804e('0x6')]},'providerName':{'type':Sequelize[_0x804e('0x7')]},'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 0f41502..e193b9c 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 _0x8cac=['accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','format','channel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SIP/%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','stack','name','index','map','ChatMessage','rawAttributes','key','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','create','body','find','describe','chat-interactions'];(function(_0x1d210d,_0x1fd62f){var _0xf7cb18=function(_0x5ce8ef){while(--_0x5ce8ef){_0x1d210d['push'](_0x1d210d['shift']());}};_0xf7cb18(++_0x1fd62f);}(_0x8cac,0x94));var _0xc8ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8cac[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xc8ca('0x0'));var emlformat=require(_0xc8ca('0x1'));var rimraf=require(_0xc8ca('0x2'));var zipdir=require(_0xc8ca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8ca('0x4'));var moment=require('moment');var BPromise=require(_0xc8ca('0x5'));var Mustache=require(_0xc8ca('0x6'));var util=require(_0xc8ca('0x7'));var path=require(_0xc8ca('0x8'));var sox=require(_0xc8ca('0x9'));var csv=require(_0xc8ca('0xa'));var ejs=require(_0xc8ca('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc8ca('0xc'));var crypto=require(_0xc8ca('0xd'));var jsforce=require(_0xc8ca('0xe'));var deskjs=require(_0xc8ca('0xf'));var toCsv=require(_0xc8ca('0xa'));var querystring=require(_0xc8ca('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc8ca('0x11'));var qs=require(_0xc8ca('0x12'));var as=require(_0xc8ca('0x13'));var hardwareService=require(_0xc8ca('0x14'));var logger=require(_0xc8ca('0x15'))(_0xc8ca('0x16'));var utils=require(_0xc8ca('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8ca('0x18'));var db=require(_0xc8ca('0x19'))['db'];config['redis']=_[_0xc8ca('0x1a')](config[_0xc8ca('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc8ca('0x1c'))(new Redis(config[_0xc8ca('0x1b')]));require(_0xc8ca('0x1d'))[_0xc8ca('0x1e')](socket);var jayson=require(_0xc8ca('0x1f'));var client=jayson[_0xc8ca('0x20')][_0xc8ca('0x21')]({'port':0x232c});var client9002=jayson[_0xc8ca('0x20')][_0xc8ca('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x38cae7,_0x2e5dca,_0x212a88,_0x2043bb){return new BPromise(function(_0x2f5632,_0x24e81f){var _0x3b83fa=_0x2043bb||client;return _0x3b83fa[_0xc8ca('0x22')](_0x38cae7,_0x212a88)['then'](function(_0x5725c8){logger['info'](_0xc8ca('0x23'),_0x2e5dca,_0xc8ca('0x24'));logger[_0xc8ca('0x25')](_0xc8ca('0x26'),_0x2e5dca,'request\x20sent',JSON['stringify'](_0x5725c8));if(_0x5725c8[_0xc8ca('0x27')]){if(_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x28')]===0x1f4){logger[_0xc8ca('0x27')]('ChatMessage,\x20%s,\x20%s',_0x2e5dca,_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);return _0x24e81f(_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);}logger[_0xc8ca('0x27')](_0xc8ca('0x23'),_0x2e5dca,_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);return _0x2f5632(_0x5725c8[_0xc8ca('0x27')][_0xc8ca('0x29')]);}else{logger[_0xc8ca('0x2a')](_0xc8ca('0x23'),_0x2e5dca,_0xc8ca('0x24'));_0x2f5632(_0x5725c8[_0xc8ca('0x2b')][_0xc8ca('0x29')]);}})[_0xc8ca('0x2c')](function(_0x4cfcf2){logger[_0xc8ca('0x27')](_0xc8ca('0x23'),_0x2e5dca,_0x4cfcf2);_0x24e81f(_0x4cfcf2);});});}function respondWithStatusCode(_0x598861,_0x4da3f7){_0x4da3f7=_0x4da3f7||0xcc;return function(_0x5b057d){if(_0x5b057d){return _0x598861[_0xc8ca('0x2d')](_0x4da3f7);}return _0x598861[_0xc8ca('0x2e')](_0x4da3f7)[_0xc8ca('0x2f')]();};}function respondWithResult(_0x84fb8f,_0x50a1cb){_0x50a1cb=_0x50a1cb||0xc8;return function(_0x369d8d){if(_0x369d8d){return _0x84fb8f['status'](_0x50a1cb)['json'](_0x369d8d);}};}function respondWithFilteredResult(_0x9c90dc,_0x4fe980){return function(_0x4c431c){if(_0x4c431c){var _0x330767=_0x4c431c[_0xc8ca('0x30')],_0x14b44c=_0x4fe980[_0xc8ca('0x31')],_0x2833e5=_0x4fe980[_0xc8ca('0x31')]+_0x4fe980[_0xc8ca('0x32')],_0x44f372;if(_0x2833e5>=_0x330767){_0x2833e5=_0x330767;_0x44f372=0xc8;}else{_0x44f372=0xce;}_0x9c90dc['status'](_0x44f372);return _0x9c90dc[_0xc8ca('0x33')]('Content-Range',_0x14b44c+'-'+_0x2833e5+'/'+_0x330767)[_0xc8ca('0x34')](_0x4c431c);}return null;};}function patchUpdates(_0x2fe9a6){return function(_0xd56f3c){try{jsonpatch['apply'](_0xd56f3c,_0x2fe9a6,!![]);}catch(_0x2c8553){return BPromise[_0xc8ca('0x35')](_0x2c8553);}return _0xd56f3c[_0xc8ca('0x36')]();};}function saveUpdates(_0x3d8dbc,_0x5b1b48){return function(_0x26011f){if(_0x26011f){return _0x26011f[_0xc8ca('0x37')](_0x3d8dbc)[_0xc8ca('0x38')](function(_0x5223eb){return _0x5223eb;});}return null;};}function removeEntity(_0x41c0f5,_0x22adac){return function(_0x1e2624){if(_0x1e2624){return _0x1e2624['destroy']()['then'](function(){_0x41c0f5[_0xc8ca('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x869af,_0x22befb){return function(_0x183fc9){if(!_0x183fc9){_0x869af[_0xc8ca('0x2d')](0x194);}return _0x183fc9;};}function handleError(_0x2d1b00,_0x54d2bc){_0x54d2bc=_0x54d2bc||0x1f4;return function(_0x14edf8){logger['error'](_0x14edf8[_0xc8ca('0x39')]);if(_0x14edf8[_0xc8ca('0x3a')]){delete _0x14edf8[_0xc8ca('0x3a')];}_0x2d1b00[_0xc8ca('0x2e')](_0x54d2bc)['send'](_0x14edf8);};}exports[_0xc8ca('0x3b')]=function(_0x5cac52,_0x185260){var _0x489f9b={},_0x57aef6={},_0x470b6b={'count':0x0,'rows':[]};var _0x221ea0=_[_0xc8ca('0x3c')](db[_0xc8ca('0x3d')][_0xc8ca('0x3e')],function(_0x3970aa){return{'name':_0x3970aa['fieldName'],'type':_0x3970aa['type'][_0xc8ca('0x3f')]};});_0x57aef6[_0xc8ca('0x40')]=_[_0xc8ca('0x3c')](_0x221ea0,_0xc8ca('0x3a'));_0x57aef6['query']=_['keys'](_0x5cac52['query']);_0x57aef6[_0xc8ca('0x41')]=_[_0xc8ca('0x42')](_0x57aef6[_0xc8ca('0x40')],_0x57aef6['query']);_0x489f9b['attributes']=_[_0xc8ca('0x42')](_0x57aef6[_0xc8ca('0x40')],qs[_0xc8ca('0x43')](_0x5cac52[_0xc8ca('0x44')]['fields']));_0x489f9b[_0xc8ca('0x45')]=_0x489f9b[_0xc8ca('0x45')][_0xc8ca('0x46')]?_0x489f9b['attributes']:_0x57aef6[_0xc8ca('0x40')];if(!_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x47')](_0xc8ca('0x48'))){_0x489f9b[_0xc8ca('0x32')]=qs['limit'](_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x32')]);_0x489f9b[_0xc8ca('0x31')]=qs[_0xc8ca('0x31')](_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x31')]);}_0x489f9b[_0xc8ca('0x49')]=qs[_0xc8ca('0x4a')](_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x4a')]);_0x489f9b['where']=qs[_0xc8ca('0x41')](_[_0xc8ca('0x4b')](_0x5cac52[_0xc8ca('0x44')],_0x57aef6['filters']),_0x221ea0);if(_0x5cac52[_0xc8ca('0x44')]['filter']){_0x489f9b[_0xc8ca('0x4c')]=_[_0xc8ca('0x4d')](_0x489f9b[_0xc8ca('0x4c')],{'$or':_['map'](_0x221ea0,function(_0x31b945){if(_0x31b945[_0xc8ca('0x4e')]!==_0xc8ca('0x4f')){var _0x5403d5={};_0x5403d5[_0x31b945[_0xc8ca('0x3a')]]={'$like':'%'+_0x5cac52[_0xc8ca('0x44')]['filter']+'%'};return _0x5403d5;}})});}_0x489f9b=_[_0xc8ca('0x4d')]({},_0x489f9b,_0x5cac52[_0xc8ca('0x50')]);var _0x25aaa3={'where':_0x489f9b[_0xc8ca('0x4c')]};return db[_0xc8ca('0x3d')]['count'](_0x25aaa3)[_0xc8ca('0x38')](function(_0x245fef){_0x470b6b[_0xc8ca('0x30')]=_0x245fef;if(_0x5cac52[_0xc8ca('0x44')][_0xc8ca('0x51')]){_0x489f9b[_0xc8ca('0x52')]=[{'all':!![]}];}return db[_0xc8ca('0x3d')][_0xc8ca('0x53')](_0x489f9b);})[_0xc8ca('0x38')](function(_0x2fd2f8){_0x470b6b[_0xc8ca('0x54')]=_0x2fd2f8;return _0x470b6b;})[_0xc8ca('0x38')](respondWithFilteredResult(_0x185260,_0x489f9b))[_0xc8ca('0x2c')](handleError(_0x185260,null));};exports['show']=function(_0x1be200,_0x2aa7a7){var _0x3a14f7={'raw':!![],'where':{'id':_0x1be200[_0xc8ca('0x55')]['id']}},_0x2eb72d={};_0x2eb72d['model']=_[_0xc8ca('0x56')](db['ChatMessage'][_0xc8ca('0x3e')]);_0x2eb72d[_0xc8ca('0x44')]=_[_0xc8ca('0x56')](_0x1be200[_0xc8ca('0x44')]);_0x2eb72d[_0xc8ca('0x41')]=_[_0xc8ca('0x42')](_0x2eb72d[_0xc8ca('0x40')],_0x2eb72d[_0xc8ca('0x44')]);_0x3a14f7[_0xc8ca('0x45')]=_[_0xc8ca('0x42')](_0x2eb72d[_0xc8ca('0x40')],qs[_0xc8ca('0x43')](_0x1be200[_0xc8ca('0x44')][_0xc8ca('0x43')]));_0x3a14f7[_0xc8ca('0x45')]=_0x3a14f7[_0xc8ca('0x45')]['length']?_0x3a14f7[_0xc8ca('0x45')]:_0x2eb72d[_0xc8ca('0x40')];if(_0x1be200[_0xc8ca('0x44')][_0xc8ca('0x51')]){_0x3a14f7['include']=[{'all':!![]}];}_0x3a14f7=_['merge']({},_0x3a14f7,_0x1be200['options']);return db[_0xc8ca('0x3d')]['find'](_0x3a14f7)['then'](handleEntityNotFound(_0x2aa7a7,null))[_0xc8ca('0x38')](respondWithResult(_0x2aa7a7,null))['catch'](handleError(_0x2aa7a7,null));};exports[_0xc8ca('0x57')]=function(_0x34ed37,_0x28fdd9){return db[_0xc8ca('0x3d')][_0xc8ca('0x57')](_0x34ed37[_0xc8ca('0x58')],{})[_0xc8ca('0x38')](respondWithResult(_0x28fdd9,0xc9))[_0xc8ca('0x2c')](handleError(_0x28fdd9,null));};exports[_0xc8ca('0x37')]=function(_0x50ec3a,_0x26fe0d){if(_0x50ec3a[_0xc8ca('0x58')]['id']){delete _0x50ec3a['body']['id'];}return db[_0xc8ca('0x3d')]['find']({'where':{'id':_0x50ec3a[_0xc8ca('0x55')]['id']}})[_0xc8ca('0x38')](handleEntityNotFound(_0x26fe0d,null))[_0xc8ca('0x38')](saveUpdates(_0x50ec3a[_0xc8ca('0x58')],null))[_0xc8ca('0x38')](respondWithResult(_0x26fe0d,null))['catch'](handleError(_0x26fe0d,null));};exports['destroy']=function(_0x196c0b,_0xe74148){return db[_0xc8ca('0x3d')][_0xc8ca('0x59')]({'where':{'id':_0x196c0b['params']['id']}})[_0xc8ca('0x38')](handleEntityNotFound(_0xe74148,null))['then'](removeEntity(_0xe74148,null))[_0xc8ca('0x2c')](handleError(_0xe74148,null));};exports[_0xc8ca('0x5a')]=function(_0x1aec41,_0x4088be){return db[_0xc8ca('0x3d')][_0xc8ca('0x5a')]()[_0xc8ca('0x38')](respondWithResult(_0x4088be,null))[_0xc8ca('0x2c')](handleError(_0x4088be,null));};var interaction_log=require('../../config/logger')(_0xc8ca('0x5b'));exports[_0xc8ca('0x5c')]=function(_0x27d0e1,_0x3d608e,_0x57bbf2){var _0xba6bb3={'channel':'chat'};if(_0x27d0e1[_0xc8ca('0x58')]['id']){delete _0x27d0e1[_0xc8ca('0x58')]['id'];}_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x5d')]=!![];_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x5e')]=moment()['format'](_0xc8ca('0x5f'));_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x60')]=_0x27d0e1['body'][_0xc8ca('0x60')]||_0x27d0e1[_0xc8ca('0x61')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x27d0e1['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc8ca('0x62')}]})[_0xc8ca('0x38')](handleEntityNotFound(_0x3d608e,null))[_0xc8ca('0x38')](saveUpdates(_0x27d0e1['body'],null))[_0xc8ca('0x38')](function(_0x6d6f33){if(_0x6d6f33){_0xba6bb3[_0xc8ca('0x29')]=_0x6d6f33[_0xc8ca('0x63')]({'plain':!![]});return db[_0xc8ca('0x64')][_0xc8ca('0x59')]({'where':{'id':_0x6d6f33[_0xc8ca('0x65')]}});}return null;})[_0xc8ca('0x38')](handleEntityNotFound(_0x3d608e,null))['then'](function(_0xdf0bec){if(_0xdf0bec){return _0xdf0bec['update']({'UserId':_0x27d0e1[_0xc8ca('0x58')][_0xc8ca('0x60')],'read1stAt':_['isNil'](_0xdf0bec[_0xc8ca('0x66')])?moment()['format'](_0xc8ca('0x5f')):undefined});}return null;})[_0xc8ca('0x38')](function(_0x30514c){if(_0x30514c){_0xba6bb3['interaction']=_0x30514c[_0xc8ca('0x63')]({'plain':!![]});interaction_log['info'](_0xc8ca('0x67'),_0x27d0e1[_0xc8ca('0x61')]['id'],_0x27d0e1[_0xc8ca('0x61')][_0xc8ca('0x3a')],_0x27d0e1[_0xc8ca('0x61')][_0xc8ca('0x68')],_0xba6bb3[_0xc8ca('0x69')]['id'],_0x27d0e1[_0xc8ca('0x58')]?JSON['stringify'](_0x27d0e1[_0xc8ca('0x58')]):_0xc8ca('0x6a'));return respondWithRpcPromise(_0xc8ca('0x6b'),_0xc8ca('0x6c'),_0xba6bb3);}return null;})[_0xc8ca('0x38')](function(_0x1fb9a0){if(_0x1fb9a0){if(_0x27d0e1['body'][_0xc8ca('0x6d')]){_0xba6bb3[_0xc8ca('0x29')][_0xc8ca('0x6e')]=util[_0xc8ca('0x6f')]('SIP/%s',_0x27d0e1[_0xc8ca('0x61')]['name']);_0xba6bb3[_0xc8ca('0x29')][_0xc8ca('0x70')]=_0xba6bb3[_0xc8ca('0x70')];_0xba6bb3[_0xc8ca('0x29')][_0xc8ca('0x71')]=_0xc8ca('0x5c');return respondWithRpcPromise('EventManager',_0xc8ca('0x72'),{'event':'acceptmessage','message':_[_0xc8ca('0x4d')](_0xba6bb3[_0xc8ca('0x29')],JSON[_0xc8ca('0x73')](_0xba6bb3[_0xc8ca('0x69')][_0xc8ca('0x74')]))},client9002)['then'](function(){return _0xba6bb3;});}return _0xba6bb3;}return null;})[_0xc8ca('0x38')](respondWithResult(_0x3d608e,null))[_0xc8ca('0x2c')](handleError(_0x3d608e,null));};var interaction_log=require('../../config/logger')(_0xc8ca('0x5b'));exports['reject']=function(_0x40c869,_0x3e51b9,_0x2d4e85){var _0x1d73d2={'agent':{},'channel':'chat'};if(_0x40c869[_0xc8ca('0x58')]['id']){delete _0x40c869[_0xc8ca('0x58')]['id'];}_0x40c869[_0xc8ca('0x58')][_0xc8ca('0x60')]=_0x40c869[_0xc8ca('0x58')][_0xc8ca('0x60')]||_0x40c869[_0xc8ca('0x61')]['id'];_0x1d73d2['agent']['id']=_0x40c869[_0xc8ca('0x58')]['UserId'];return db[_0xc8ca('0x3d')][_0xc8ca('0x59')]({'where':{'id':_0x40c869['params']['id'],'UserId':null}})[_0xc8ca('0x38')](handleEntityNotFound(_0x3e51b9,null))[_0xc8ca('0x38')](function(_0x2325dc){if(_0x2325dc){_0x1d73d2[_0xc8ca('0x29')]=_0x2325dc[_0xc8ca('0x63')]({'plain':!![]});return db[_0xc8ca('0x64')][_0xc8ca('0x59')]({'where':{'id':_0x2325dc[_0xc8ca('0x65')]}});}return null;})[_0xc8ca('0x38')](handleEntityNotFound(_0x3e51b9,null))['then'](function(_0x54f601){if(_0x54f601){_0x1d73d2[_0xc8ca('0x69')]=_0x54f601[_0xc8ca('0x63')]({'plain':!![]});interaction_log[_0xc8ca('0x2a')](_0xc8ca('0x75'),_0x40c869[_0xc8ca('0x61')]['id'],_0x40c869['user'][_0xc8ca('0x3a')],_0x40c869[_0xc8ca('0x61')][_0xc8ca('0x68')],_0x1d73d2[_0xc8ca('0x69')]['id'],_0x40c869[_0xc8ca('0x58')]?JSON['stringify'](_0x40c869['body']):'null');return respondWithRpcPromise(_0xc8ca('0x76'),'rejectMessage',_0x1d73d2);}return null;})[_0xc8ca('0x38')](function(_0x353687){if(_0x353687){_0x353687['message'][_0xc8ca('0x6e')]=util[_0xc8ca('0x6f')](_0xc8ca('0x77'),_0x40c869[_0xc8ca('0x61')][_0xc8ca('0x3a')]);_0x353687[_0xc8ca('0x29')][_0xc8ca('0x70')]=_0x1d73d2[_0xc8ca('0x70')];_0x353687[_0xc8ca('0x29')]['event']='reject';respondWithRpcPromise(_0xc8ca('0x72'),_0xc8ca('0x72'),{'event':'rejectmessage','message':_0x353687[_0xc8ca('0x29')]},client9002);return _0x1d73d2;}return null;})[_0xc8ca('0x38')](respondWithResult(_0x3e51b9,null))[_0xc8ca('0x2c')](handleError(_0x3e51b9,null));}; \ No newline at end of file +var _0x7846=['destroy','name','send','index','map','ChatMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','update','describe','../../config/logger','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','set','json','apply','reject'];(function(_0x177179,_0x2580aa){var _0xe94765=function(_0x17b8a9){while(--_0x17b8a9){_0x177179['push'](_0x177179['shift']());}};_0xe94765(++_0x2580aa);}(_0x7846,0x1b0));var _0x6784=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x7846[_0xd39959];return _0x1ff69c;};'use strict';var pdf=require(_0x6784('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6784('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6784('0x2'));var moment=require('moment');var BPromise=require(_0x6784('0x3'));var Mustache=require(_0x6784('0x4'));var util=require(_0x6784('0x5'));var path=require(_0x6784('0x6'));var sox=require(_0x6784('0x7'));var csv=require(_0x6784('0x8'));var ejs=require(_0x6784('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6784('0xa'));var crypto=require(_0x6784('0xb'));var jsforce=require(_0x6784('0xc'));var deskjs=require(_0x6784('0xd'));var toCsv=require(_0x6784('0x8'));var querystring=require(_0x6784('0xe'));var Papa=require(_0x6784('0xf'));var Redis=require(_0x6784('0x10'));var authService=require(_0x6784('0x11'));var qs=require(_0x6784('0x12'));var as=require(_0x6784('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6784('0x14'));var utils=require(_0x6784('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6784('0x16'));var db=require(_0x6784('0x17'))['db'];config['redis']=_[_0x6784('0x18')](config[_0x6784('0x19')],{'host':_0x6784('0x1a'),'port':0x18eb});var socket=require(_0x6784('0x1b'))(new Redis(config[_0x6784('0x19')]));require(_0x6784('0x1c'))[_0x6784('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6784('0x1e')][_0x6784('0x1f')]({'port':0x232c});var client9002=jayson[_0x6784('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5411d8,_0x268f60,_0x31f66e,_0x7474e7){return new BPromise(function(_0x1e3428,_0x3b9f15){var _0x1d8b18=_0x7474e7||client;return _0x1d8b18[_0x6784('0x20')](_0x5411d8,_0x31f66e)[_0x6784('0x21')](function(_0x462464){logger[_0x6784('0x22')](_0x6784('0x23'),_0x268f60,_0x6784('0x24'));logger['debug'](_0x6784('0x25'),_0x268f60,_0x6784('0x24'),JSON[_0x6784('0x26')](_0x462464));if(_0x462464['error']){if(_0x462464[_0x6784('0x27')][_0x6784('0x28')]===0x1f4){logger[_0x6784('0x27')]('ChatMessage,\x20%s,\x20%s',_0x268f60,_0x462464['error'][_0x6784('0x29')]);return _0x3b9f15(_0x462464['error'][_0x6784('0x29')]);}logger[_0x6784('0x27')](_0x6784('0x23'),_0x268f60,_0x462464['error'][_0x6784('0x29')]);return _0x1e3428(_0x462464['error'][_0x6784('0x29')]);}else{logger[_0x6784('0x22')](_0x6784('0x23'),_0x268f60,_0x6784('0x24'));_0x1e3428(_0x462464[_0x6784('0x2a')][_0x6784('0x29')]);}})[_0x6784('0x2b')](function(_0x5ca4e2){logger[_0x6784('0x27')](_0x6784('0x23'),_0x268f60,_0x5ca4e2);_0x3b9f15(_0x5ca4e2);});});}function respondWithStatusCode(_0x3f71e7,_0xd9e54b){_0xd9e54b=_0xd9e54b||0xcc;return function(_0x21e742){if(_0x21e742){return _0x3f71e7[_0x6784('0x2c')](_0xd9e54b);}return _0x3f71e7[_0x6784('0x2d')](_0xd9e54b)[_0x6784('0x2e')]();};}function respondWithResult(_0x5bf02c,_0x5c66e){_0x5c66e=_0x5c66e||0xc8;return function(_0x4385fc){if(_0x4385fc){return _0x5bf02c[_0x6784('0x2d')](_0x5c66e)['json'](_0x4385fc);}};}function respondWithFilteredResult(_0x1204c7,_0x9a2175){return function(_0x58c163){if(_0x58c163){var _0x271889=_0x58c163['count'],_0x3b6094=_0x9a2175['offset'],_0x1fc9d6=_0x9a2175[_0x6784('0x2f')]+_0x9a2175['limit'],_0x49fd54;if(_0x1fc9d6>=_0x271889){_0x1fc9d6=_0x271889;_0x49fd54=0xc8;}else{_0x49fd54=0xce;}_0x1204c7[_0x6784('0x2d')](_0x49fd54);return _0x1204c7[_0x6784('0x30')]('Content-Range',_0x3b6094+'-'+_0x1fc9d6+'/'+_0x271889)[_0x6784('0x31')](_0x58c163);}return null;};}function patchUpdates(_0x12a153){return function(_0x4f4fea){try{jsonpatch[_0x6784('0x32')](_0x4f4fea,_0x12a153,!![]);}catch(_0x4eea6d){return BPromise[_0x6784('0x33')](_0x4eea6d);}return _0x4f4fea['save']();};}function saveUpdates(_0x11371e,_0x5131bc){return function(_0x2b23b7){if(_0x2b23b7){return _0x2b23b7['update'](_0x11371e)[_0x6784('0x21')](function(_0x38ab2a){return _0x38ab2a;});}return null;};}function removeEntity(_0x1245a7,_0x1a953d){return function(_0x338db4){if(_0x338db4){return _0x338db4[_0x6784('0x34')]()['then'](function(){_0x1245a7[_0x6784('0x2d')](0xcc)[_0x6784('0x2e')]();});}};}function handleEntityNotFound(_0x53754a,_0x360472){return function(_0x5807fa){if(!_0x5807fa){_0x53754a[_0x6784('0x2c')](0x194);}return _0x5807fa;};}function handleError(_0x2c0bf5,_0x5c7a16){_0x5c7a16=_0x5c7a16||0x1f4;return function(_0x24edbf){logger[_0x6784('0x27')](_0x24edbf['stack']);if(_0x24edbf[_0x6784('0x35')]){delete _0x24edbf[_0x6784('0x35')];}_0x2c0bf5[_0x6784('0x2d')](_0x5c7a16)[_0x6784('0x36')](_0x24edbf);};}exports[_0x6784('0x37')]=function(_0x496ef5,_0x18e9f6){var _0x469cdc={},_0x57b650={},_0x254fe4={'count':0x0,'rows':[]};var _0x552d5f=_[_0x6784('0x38')](db[_0x6784('0x39')]['rawAttributes'],function(_0x4b984b){return{'name':_0x4b984b[_0x6784('0x3a')],'type':_0x4b984b['type'][_0x6784('0x3b')]};});_0x57b650['model']=_[_0x6784('0x38')](_0x552d5f,_0x6784('0x35'));_0x57b650[_0x6784('0x3c')]=_[_0x6784('0x3d')](_0x496ef5[_0x6784('0x3c')]);_0x57b650[_0x6784('0x3e')]=_[_0x6784('0x3f')](_0x57b650[_0x6784('0x40')],_0x57b650[_0x6784('0x3c')]);_0x469cdc[_0x6784('0x41')]=_['intersection'](_0x57b650['model'],qs[_0x6784('0x42')](_0x496ef5[_0x6784('0x3c')][_0x6784('0x42')]));_0x469cdc[_0x6784('0x41')]=_0x469cdc[_0x6784('0x41')][_0x6784('0x43')]?_0x469cdc['attributes']:_0x57b650[_0x6784('0x40')];if(!_0x496ef5[_0x6784('0x3c')][_0x6784('0x44')](_0x6784('0x45'))){_0x469cdc[_0x6784('0x46')]=qs[_0x6784('0x46')](_0x496ef5[_0x6784('0x3c')]['limit']);_0x469cdc[_0x6784('0x2f')]=qs[_0x6784('0x2f')](_0x496ef5['query'][_0x6784('0x2f')]);}_0x469cdc[_0x6784('0x47')]=qs[_0x6784('0x48')](_0x496ef5[_0x6784('0x3c')][_0x6784('0x48')]);_0x469cdc[_0x6784('0x49')]=qs[_0x6784('0x3e')](_[_0x6784('0x4a')](_0x496ef5[_0x6784('0x3c')],_0x57b650[_0x6784('0x3e')]),_0x552d5f);if(_0x496ef5['query'][_0x6784('0x4b')]){_0x469cdc[_0x6784('0x49')]=_[_0x6784('0x4c')](_0x469cdc[_0x6784('0x49')],{'$or':_[_0x6784('0x38')](_0x552d5f,function(_0x384ff1){if(_0x384ff1[_0x6784('0x4d')]!==_0x6784('0x4e')){var _0x48aa6d={};_0x48aa6d[_0x384ff1['name']]={'$like':'%'+_0x496ef5['query']['filter']+'%'};return _0x48aa6d;}})});}_0x469cdc=_[_0x6784('0x4c')]({},_0x469cdc,_0x496ef5['options']);var _0x41ddcc={'where':_0x469cdc['where']};return db[_0x6784('0x39')][_0x6784('0x4f')](_0x41ddcc)['then'](function(_0x248a99){_0x254fe4[_0x6784('0x4f')]=_0x248a99;if(_0x496ef5[_0x6784('0x3c')][_0x6784('0x50')]){_0x469cdc[_0x6784('0x51')]=[{'all':!![]}];}return db[_0x6784('0x39')][_0x6784('0x52')](_0x469cdc);})[_0x6784('0x21')](function(_0x4ef76b){_0x254fe4[_0x6784('0x53')]=_0x4ef76b;return _0x254fe4;})[_0x6784('0x21')](respondWithFilteredResult(_0x18e9f6,_0x469cdc))[_0x6784('0x2b')](handleError(_0x18e9f6,null));};exports[_0x6784('0x54')]=function(_0x227491,_0x1c559c){var _0x3bb7fd={'raw':!![],'where':{'id':_0x227491[_0x6784('0x55')]['id']}},_0x2c2d30={};_0x2c2d30[_0x6784('0x40')]=_[_0x6784('0x3d')](db[_0x6784('0x39')][_0x6784('0x56')]);_0x2c2d30['query']=_[_0x6784('0x3d')](_0x227491[_0x6784('0x3c')]);_0x2c2d30[_0x6784('0x3e')]=_[_0x6784('0x3f')](_0x2c2d30['model'],_0x2c2d30['query']);_0x3bb7fd['attributes']=_[_0x6784('0x3f')](_0x2c2d30[_0x6784('0x40')],qs[_0x6784('0x42')](_0x227491[_0x6784('0x3c')][_0x6784('0x42')]));_0x3bb7fd[_0x6784('0x41')]=_0x3bb7fd[_0x6784('0x41')][_0x6784('0x43')]?_0x3bb7fd['attributes']:_0x2c2d30[_0x6784('0x40')];if(_0x227491['query']['includeAll']){_0x3bb7fd[_0x6784('0x51')]=[{'all':!![]}];}_0x3bb7fd=_[_0x6784('0x4c')]({},_0x3bb7fd,_0x227491['options']);return db[_0x6784('0x39')][_0x6784('0x57')](_0x3bb7fd)[_0x6784('0x21')](handleEntityNotFound(_0x1c559c,null))[_0x6784('0x21')](respondWithResult(_0x1c559c,null))[_0x6784('0x2b')](handleError(_0x1c559c,null));};exports['create']=function(_0x436e63,_0x12730b){return db[_0x6784('0x39')]['create'](_0x436e63[_0x6784('0x58')],{})['then'](respondWithResult(_0x12730b,0xc9))[_0x6784('0x2b')](handleError(_0x12730b,null));};exports[_0x6784('0x59')]=function(_0x2e9d7e,_0x4df267){if(_0x2e9d7e[_0x6784('0x58')]['id']){delete _0x2e9d7e[_0x6784('0x58')]['id'];}return db['ChatMessage'][_0x6784('0x57')]({'where':{'id':_0x2e9d7e[_0x6784('0x55')]['id']}})[_0x6784('0x21')](handleEntityNotFound(_0x4df267,null))[_0x6784('0x21')](saveUpdates(_0x2e9d7e[_0x6784('0x58')],null))[_0x6784('0x21')](respondWithResult(_0x4df267,null))[_0x6784('0x2b')](handleError(_0x4df267,null));};exports[_0x6784('0x34')]=function(_0x36bc05,_0x513739){return db[_0x6784('0x39')][_0x6784('0x57')]({'where':{'id':_0x36bc05[_0x6784('0x55')]['id']}})[_0x6784('0x21')](handleEntityNotFound(_0x513739,null))['then'](removeEntity(_0x513739,null))['catch'](handleError(_0x513739,null));};exports[_0x6784('0x5a')]=function(_0x5dc9e6,_0x4c3992){return db[_0x6784('0x39')][_0x6784('0x5a')]()[_0x6784('0x21')](respondWithResult(_0x4c3992,null))['catch'](handleError(_0x4c3992,null));};var interaction_log=require(_0x6784('0x5b'))(_0x6784('0x5c'));exports[_0x6784('0x5d')]=function(_0x46cb35,_0x12640d,_0x49033a){var _0x36e985={'channel':_0x6784('0x5e')};if(_0x46cb35[_0x6784('0x58')]['id']){delete _0x46cb35[_0x6784('0x58')]['id'];}_0x46cb35['body'][_0x6784('0x5f')]=!![];_0x46cb35[_0x6784('0x58')]['readAt']=moment()[_0x6784('0x60')](_0x6784('0x61'));_0x46cb35[_0x6784('0x58')][_0x6784('0x62')]=_0x46cb35[_0x6784('0x58')][_0x6784('0x62')]||_0x46cb35['user']['id'];return db[_0x6784('0x39')][_0x6784('0x57')]({'where':{'id':_0x46cb35[_0x6784('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x6784('0x63')],'as':_0x6784('0x64')}]})[_0x6784('0x21')](handleEntityNotFound(_0x12640d,null))[_0x6784('0x21')](saveUpdates(_0x46cb35[_0x6784('0x58')],null))[_0x6784('0x21')](function(_0x55637c){if(_0x55637c){_0x36e985[_0x6784('0x29')]=_0x55637c[_0x6784('0x65')]({'plain':!![]});return db['ChatInteraction'][_0x6784('0x57')]({'where':{'id':_0x55637c['ChatInteractionId']}});}return null;})[_0x6784('0x21')](handleEntityNotFound(_0x12640d,null))[_0x6784('0x21')](function(_0x38fd17){if(_0x38fd17){return _0x38fd17[_0x6784('0x59')]({'UserId':_0x46cb35['body'][_0x6784('0x62')],'read1stAt':_[_0x6784('0x66')](_0x38fd17[_0x6784('0x67')])?moment()['format'](_0x6784('0x61')):undefined});}return null;})[_0x6784('0x21')](function(_0x23836c){if(_0x23836c){_0x36e985[_0x6784('0x68')]=_0x23836c['get']({'plain':!![]});interaction_log['info'](_0x6784('0x69'),_0x46cb35[_0x6784('0x6a')]['id'],_0x46cb35['user'][_0x6784('0x35')],_0x46cb35['user'][_0x6784('0x6b')],_0x36e985[_0x6784('0x68')]['id'],_0x46cb35[_0x6784('0x58')]?JSON[_0x6784('0x26')](_0x46cb35['body']):_0x6784('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x6784('0x6d'),_0x36e985);}return null;})['then'](function(_0x5d23a7){if(_0x5d23a7){if(_0x46cb35[_0x6784('0x58')][_0x6784('0x6e')]){_0x36e985[_0x6784('0x29')][_0x6784('0x6f')]=util[_0x6784('0x60')](_0x6784('0x70'),_0x46cb35[_0x6784('0x6a')][_0x6784('0x35')]);_0x36e985[_0x6784('0x29')][_0x6784('0x71')]=_0x36e985['channel'];_0x36e985[_0x6784('0x29')][_0x6784('0x72')]='accept';return respondWithRpcPromise(_0x6784('0x73'),_0x6784('0x73'),{'event':'acceptmessage','message':_[_0x6784('0x4c')](_0x36e985['message'],JSON['parse'](_0x36e985[_0x6784('0x68')]['formData']))},client9002)[_0x6784('0x21')](function(){return _0x36e985;});}return _0x36e985;}return null;})[_0x6784('0x21')](respondWithResult(_0x12640d,null))['catch'](handleError(_0x12640d,null));};var interaction_log=require('../../config/logger')(_0x6784('0x5c'));exports[_0x6784('0x33')]=function(_0x91de63,_0x19f7b6,_0x2416cb){var _0x1ace3c={'agent':{},'channel':_0x6784('0x5e')};if(_0x91de63[_0x6784('0x58')]['id']){delete _0x91de63[_0x6784('0x58')]['id'];}_0x91de63[_0x6784('0x58')][_0x6784('0x62')]=_0x91de63[_0x6784('0x58')]['UserId']||_0x91de63[_0x6784('0x6a')]['id'];_0x1ace3c['agent']['id']=_0x91de63['body']['UserId'];return db[_0x6784('0x39')]['find']({'where':{'id':_0x91de63['params']['id'],'UserId':null}})[_0x6784('0x21')](handleEntityNotFound(_0x19f7b6,null))['then'](function(_0x1ce111){if(_0x1ce111){_0x1ace3c[_0x6784('0x29')]=_0x1ce111[_0x6784('0x65')]({'plain':!![]});return db[_0x6784('0x74')][_0x6784('0x57')]({'where':{'id':_0x1ce111[_0x6784('0x75')]}});}return null;})[_0x6784('0x21')](handleEntityNotFound(_0x19f7b6,null))[_0x6784('0x21')](function(_0xe31bff){if(_0xe31bff){_0x1ace3c[_0x6784('0x68')]=_0xe31bff[_0x6784('0x65')]({'plain':!![]});interaction_log[_0x6784('0x22')](_0x6784('0x76'),_0x91de63[_0x6784('0x6a')]['id'],_0x91de63[_0x6784('0x6a')][_0x6784('0x35')],_0x91de63[_0x6784('0x6a')][_0x6784('0x6b')],_0x1ace3c['interaction']['id'],_0x91de63['body']?JSON[_0x6784('0x26')](_0x91de63[_0x6784('0x58')]):_0x6784('0x6c'));return respondWithRpcPromise(_0x6784('0x77'),'rejectMessage',_0x1ace3c);}return null;})[_0x6784('0x21')](function(_0x38301f){if(_0x38301f){_0x38301f['message'][_0x6784('0x6f')]=util[_0x6784('0x60')]('SIP/%s',_0x91de63[_0x6784('0x6a')]['name']);_0x38301f['message'][_0x6784('0x71')]=_0x1ace3c[_0x6784('0x71')];_0x38301f['message'][_0x6784('0x72')]='reject';respondWithRpcPromise(_0x6784('0x73'),_0x6784('0x73'),{'event':_0x6784('0x78'),'message':_0x38301f[_0x6784('0x29')]},client9002);return _0x1ace3c;}return null;})[_0x6784('0x21')](respondWithResult(_0x19f7b6,null))[_0x6784('0x2b')](handleError(_0x19f7b6,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9ed1e62..11d278c 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 _0x44ed=['ChatMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0x44ed,0x15d));var _0xd44e=function(_0x47f0b6,_0x3daf1a){_0x47f0b6=_0x47f0b6-0x0;var _0x53c469=_0x44ed[_0x47f0b6];return _0x53c469;};'use strict';var EventEmitter=require(_0xd44e('0x0'));var ChatMessage=require(_0xd44e('0x1'))['db'][_0xd44e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd44e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd44e('0x4')};function emitEvent(_0x369e12){return function(_0x2c50b0,_0x450da6,_0x49f34b){ChatMessageEvents['emit'](_0x369e12+':'+_0x2c50b0['id'],_0x2c50b0);ChatMessageEvents[_0xd44e('0x5')](_0x369e12,_0x2c50b0);_0x49f34b(null);};}for(var e in events){if(events[_0xd44e('0x6')](e)){var event=events[e];ChatMessage[_0xd44e('0x7')](e,emitEvent(event));}}module[_0xd44e('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xf158=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x399334,_0x4e7be9){var _0x37e5ef=function(_0x414671){while(--_0x414671){_0x399334['push'](_0x399334['shift']());}};_0x37e5ef(++_0x4e7be9);}(_0xf158,0x79));var _0x8f15=function(_0x175961,_0x2a1df0){_0x175961=_0x175961-0x0;var _0xa9c4ee=_0xf158[_0x175961];return _0xa9c4ee;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8f15('0x0'))['db'][_0x8f15('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8f15('0x2')](0x0);var events={'afterCreate':_0x8f15('0x3'),'afterUpdate':_0x8f15('0x4'),'afterDestroy':'remove'};function emitEvent(_0x362529){return function(_0x20a7b4,_0x453c87,_0x8ecdb3){ChatMessageEvents[_0x8f15('0x5')](_0x362529+':'+_0x20a7b4['id'],_0x20a7b4);ChatMessageEvents[_0x8f15('0x5')](_0x362529,_0x20a7b4);_0x8ecdb3(null);};}for(var e in events){if(events[_0x8f15('0x6')](e)){var event=events[e];ChatMessage[_0x8f15('0x7')](e,emitEvent(event));}}module[_0x8f15('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 0967954..8fac9b9 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 _0xb352=['then','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','findOne'];(function(_0x505db3,_0xf39b41){var _0x2306ac=function(_0x494a2c){while(--_0x494a2c){_0x505db3['push'](_0x505db3['shift']());}};_0x2306ac(++_0xf39b41);}(_0xb352,0x99));var _0x2b35=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xb352[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x2b35('0x0'));var util=require('util');var logger=require(_0x2b35('0x1'))(_0x2b35('0x2'));var moment=require(_0x2b35('0x3'));var BPromise=require(_0x2b35('0x4'));var rp=require(_0x2b35('0x5'));var fs=require('fs');var path=require(_0x2b35('0x6'));var rimraf=require(_0x2b35('0x7'));var config=require(_0x2b35('0x8'));var attributes=require('./chatMessage.attributes');module[_0x2b35('0x9')]=function(_0x572023,_0x2003b2){return _0x572023[_0x2b35('0xa')](_0x2b35('0xb'),attributes,{'tableName':_0x2b35('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x2b35('0xd')],'type':_0x2b35('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x461d73,_0x468c13,_0x4e4113){var _0x4ecc79=_0x572023['models'];var _0x41b37f=_0x461d73[_0x2b35('0xf')]({'plain':!![]});if(_0x41b37f[_0x2b35('0x10')]['toLowerCase']()==='in'||_0x41b37f[_0x2b35('0x10')][_0x2b35('0x11')]()===_0x2b35('0x12')&&!_0x41b37f[_0x2b35('0x13')]&&!_[_0x2b35('0x14')](_0x41b37f['UserId'])){_0x4ecc79['ChatInteraction'][_0x2b35('0x15')]({'where':{'id':_0x41b37f['ChatInteractionId']}})[_0x2b35('0x16')](function(_0x25dc9e){if(_0x25dc9e){_0x25dc9e['update']({'lastMsgAt':_0x41b37f['createdAt'],'lastMsgDirection':_0x41b37f['direction'][_0x2b35('0x11')]()});}})['catch'](function(_0x7e0cce){console['error'](_0x7e0cce);});}_0x4e4113();}},'charset':_0x2b35('0x17'),'collate':_0x2b35('0x18')});}; \ No newline at end of file +var _0xc31a=['bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash'];(function(_0x537b8b,_0xe4edc9){var _0xbd8b33=function(_0x39370e){while(--_0x39370e){_0x537b8b['push'](_0x537b8b['shift']());}};_0xbd8b33(++_0xe4edc9);}(_0xc31a,0x19f));var _0xac31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc31a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xac31('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xac31('0x1'));var rp=require(_0xac31('0x2'));var fs=require('fs');var path=require(_0xac31('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac31('0x4'));module[_0xac31('0x5')]=function(_0x3b62ed,_0x5952fb){return _0x3b62ed[_0xac31('0x6')](_0xac31('0x7'),attributes,{'tableName':_0xac31('0x8'),'paranoid':![],'indexes':[{'name':_0xac31('0x9'),'fields':[_0xac31('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x484981,_0x242038,_0x180e10){var _0x2fa100=_0x3b62ed[_0xac31('0xb')];var _0x199039=_0x484981[_0xac31('0xc')]({'plain':!![]});if(_0x199039[_0xac31('0xd')]['toLowerCase']()==='in'||_0x199039[_0xac31('0xd')][_0xac31('0xe')]()===_0xac31('0xf')&&!_0x199039[_0xac31('0x10')]&&!_[_0xac31('0x11')](_0x199039[_0xac31('0x12')])){_0x2fa100[_0xac31('0x13')][_0xac31('0x14')]({'where':{'id':_0x199039['ChatInteractionId']}})[_0xac31('0x15')](function(_0x1e8d27){if(_0x1e8d27){_0x1e8d27[_0xac31('0x16')]({'lastMsgAt':_0x199039[_0xac31('0x17')],'lastMsgDirection':_0x199039[_0xac31('0xd')]['toLowerCase']()});}})[_0xac31('0x18')](function(_0x254c56){console['error'](_0x254c56);});}_0x180e10();}},'charset':'utf8mb4','collate':_0xac31('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 8a6ca4c..17551cc 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 _0x4009=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','options','lodash','util','bluebird','randomstring'];(function(_0x1780ec,_0x3af2fa){var _0x5c5663=function(_0x23eac9){while(--_0x23eac9){_0x1780ec['push'](_0x1780ec['shift']());}};_0x5c5663(++_0x3af2fa);}(_0x4009,0x1a0));var _0x9400=function(_0x3b5337,_0xe882e7){_0x3b5337=_0x3b5337-0x0;var _0x6b807c=_0x4009[_0x3b5337];return _0x6b807c;};'use strict';var _=require(_0x9400('0x0'));var util=require(_0x9400('0x1'));var moment=require('moment');var BPromise=require(_0x9400('0x2'));var rs=require(_0x9400('0x3'));var fs=require('fs');var Redis=require(_0x9400('0x4'));var db=require(_0x9400('0x5'))['db'];var utils=require(_0x9400('0x6'));var logger=require(_0x9400('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9400('0x8'));var client=jayson['client'][_0x9400('0x9')]({'port':0x232a});config['redis']=_[_0x9400('0xa')](config['redis'],{'host':_0x9400('0xb'),'port':0x18eb});var socket=require(_0x9400('0xc'))(new Redis(config[_0x9400('0xd')]));require(_0x9400('0xe'))['register'](socket);function respondWithRpcPromise(_0x31e00b,_0x4e528d,_0x249290){return new BPromise(function(_0x13b733,_0x1eae28){return client[_0x9400('0xf')](_0x31e00b,_0x249290)[_0x9400('0x10')](function(_0x91c18a){logger[_0x9400('0x11')]('ChatMessage,\x20%s,\x20%s',_0x4e528d,_0x9400('0x12'));logger[_0x9400('0x13')](_0x9400('0x14'),_0x4e528d,'request\x20sent',JSON[_0x9400('0x15')](_0x91c18a));if(_0x91c18a[_0x9400('0x16')]){if(_0x91c18a[_0x9400('0x16')]['code']===0x1f4){logger['error'](_0x9400('0x17'),_0x4e528d,_0x91c18a[_0x9400('0x16')][_0x9400('0x18')]);return _0x1eae28(_0x91c18a[_0x9400('0x16')][_0x9400('0x18')]);}logger[_0x9400('0x16')]('ChatMessage,\x20%s,\x20%s',_0x4e528d,_0x91c18a['error'][_0x9400('0x18')]);return _0x13b733(_0x91c18a[_0x9400('0x16')][_0x9400('0x18')]);}else{logger[_0x9400('0x11')](_0x9400('0x17'),_0x4e528d,'request\x20sent');_0x13b733(_0x91c18a[_0x9400('0x19')][_0x9400('0x18')]);}})[_0x9400('0x1a')](function(_0x44174e){logger[_0x9400('0x16')](_0x9400('0x17'),_0x4e528d,_0x44174e);_0x1eae28(_0x44174e);});});}exports[_0x9400('0x1b')]=function(_0x253fa){var _0x33edeb=this;return new Promise(function(_0x3d8684,_0x54adb7){return db[_0x9400('0x1c')]['create'](_0x253fa['body'],{'raw':_0x253fa[_0x9400('0x1d')]?_0x253fa[_0x9400('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x9400('0x10')](function(_0x38bccc){logger[_0x9400('0x11')](_0x9400('0x1b'),_0x253fa);logger[_0x9400('0x13')](_0x9400('0x1b'),_0x253fa,JSON[_0x9400('0x15')](_0x38bccc));_0x3d8684(_0x38bccc);})[_0x9400('0x1a')](function(_0x30b48f){logger[_0x9400('0x16')](_0x9400('0x1b'),_0x30b48f['message'],_0x253fa);_0x54adb7(_0x33edeb['error'](0x1f4,_0x30b48f[_0x9400('0x18')]));});});}; \ No newline at end of file +var _0xa054=['redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','options','raw','CreateChatMessage','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x498f41,_0x350d11){var _0x87eea=function(_0x56ce92){while(--_0x56ce92){_0x498f41['push'](_0x498f41['shift']());}};_0x87eea(++_0x350d11);}(_0xa054,0x1ab));var _0x4a05=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xa054[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var util=require(_0x4a05('0x0'));var moment=require(_0x4a05('0x1'));var BPromise=require(_0x4a05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4a05('0x3'))('rpc');var config=require(_0x4a05('0x4'));var jayson=require(_0x4a05('0x5'));var client=jayson[_0x4a05('0x6')][_0x4a05('0x7')]({'port':0x232a});config[_0x4a05('0x8')]=_[_0x4a05('0x9')](config[_0x4a05('0x8')],{'host':_0x4a05('0xa'),'port':0x18eb});var socket=require(_0x4a05('0xb'))(new Redis(config['redis']));require(_0x4a05('0xc'))['register'](socket);function respondWithRpcPromise(_0x3c4e5a,_0x1cf478,_0x3e2d51){return new BPromise(function(_0x446539,_0x108d30){return client['request'](_0x3c4e5a,_0x3e2d51)[_0x4a05('0xd')](function(_0x5cf75d){logger[_0x4a05('0xe')](_0x4a05('0xf'),_0x1cf478,_0x4a05('0x10'));logger[_0x4a05('0x11')](_0x4a05('0x12'),_0x1cf478,_0x4a05('0x10'),JSON[_0x4a05('0x13')](_0x5cf75d));if(_0x5cf75d[_0x4a05('0x14')]){if(_0x5cf75d['error'][_0x4a05('0x15')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1cf478,_0x5cf75d['error'][_0x4a05('0x16')]);return _0x108d30(_0x5cf75d['error'][_0x4a05('0x16')]);}logger[_0x4a05('0x14')](_0x4a05('0xf'),_0x1cf478,_0x5cf75d[_0x4a05('0x14')][_0x4a05('0x16')]);return _0x446539(_0x5cf75d[_0x4a05('0x14')][_0x4a05('0x16')]);}else{logger[_0x4a05('0xe')]('ChatMessage,\x20%s,\x20%s',_0x1cf478,_0x4a05('0x10'));_0x446539(_0x5cf75d[_0x4a05('0x17')][_0x4a05('0x16')]);}})[_0x4a05('0x18')](function(_0x26d023){logger['error'](_0x4a05('0xf'),_0x1cf478,_0x26d023);_0x108d30(_0x26d023);});});}exports['CreateChatMessage']=function(_0x50c4c9){var _0x40b746=this;return new Promise(function(_0xe16c46,_0x5f5dfe){return db[_0x4a05('0x19')]['create'](_0x50c4c9['body'],{'raw':_0x50c4c9[_0x4a05('0x1a')]?_0x50c4c9[_0x4a05('0x1a')][_0x4a05('0x1b')]===undefined?!![]:![]:!![]})[_0x4a05('0xd')](function(_0x516b9e){logger[_0x4a05('0xe')](_0x4a05('0x1c'),_0x50c4c9);logger[_0x4a05('0x11')](_0x4a05('0x1c'),_0x50c4c9,JSON[_0x4a05('0x13')](_0x516b9e));_0xe16c46(_0x516b9e);})[_0x4a05('0x18')](function(_0x2cfda4){logger['error'](_0x4a05('0x1c'),_0x2cfda4[_0x4a05('0x16')],_0x50c4c9);_0x5f5dfe(_0x40b746[_0x4a05('0x14')](0x1f4,_0x2cfda4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1bfe2e2..ebf2826 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 _0xe2fe=['update','emit','register','length','./chatMessage.events'];(function(_0x3b6646,_0x466c7c){var _0x464ac8=function(_0x1f857d){while(--_0x1f857d){_0x3b6646['push'](_0x3b6646['shift']());}};_0x464ac8(++_0x466c7c);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var ChatMessageEvents=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(){ChatMessageEvents['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('chatMessage:'+_0x5a7975,_0x2b7e7c);ChatMessageEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file +var _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x2675,0x75));var _0x5267=function(_0xaaf1dd,_0x131aa5){_0xaaf1dd=_0xaaf1dd-0x0;var _0x1546b7=_0x2675[_0xaaf1dd];return _0x1546b7;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index acf4de4..e86b773 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 _0x7523=['destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','index','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','put','/:id','update','/:id/reject','reject','delete'];(function(_0x5bc025,_0x553741){var _0x4cf244=function(_0x46a384){while(--_0x46a384){_0x5bc025['push'](_0x5bc025['shift']());}};_0x4cf244(++_0x553741);}(_0x7523,0x152));var _0x3752=function(_0x222913,_0x264f1b){_0x222913=_0x222913-0x0;var _0x5d4b00=_0x7523[_0x222913];return _0x5d4b00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3752('0x0'));var timeout=require(_0x3752('0x1'));var express=require(_0x3752('0x2'));var router=express['Router']();var auth=require(_0x3752('0x3'));var interaction=require(_0x3752('0x4'));var config=require('../../config/environment');var controller=require(_0x3752('0x5'));router[_0x3752('0x6')]('/',auth['isAuthenticated'](),controller[_0x3752('0x7')]);router[_0x3752('0x6')]('/describe',auth[_0x3752('0x8')](),controller[_0x3752('0x9')]);router[_0x3752('0x6')]('/:id',auth[_0x3752('0x8')](),controller[_0x3752('0xa')]);router[_0x3752('0xb')]('/',auth[_0x3752('0x8')](),interaction[_0x3752('0xc')](_0x3752('0xd'),_0x3752('0xe')),controller[_0x3752('0xf')]);router[_0x3752('0x10')](_0x3752('0x11'),controller[_0x3752('0x12')]);router['put']('/:id/accept',auth[_0x3752('0x8')](),controller['accept']);router[_0x3752('0x10')](_0x3752('0x13'),auth[_0x3752('0x8')](),controller[_0x3752('0x14')]);router[_0x3752('0x15')](_0x3752('0x11'),auth['isAuthenticated'](),controller[_0x3752('0x16')]);module[_0x3752('0x17')]=router; \ No newline at end of file +var _0xd21e=['post','chat','chatmessage:create','put','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x420b42,_0x2cf1d7){var _0x4d2fbf=function(_0x4f3b4){while(--_0x4f3b4){_0x420b42['push'](_0x420b42['shift']());}};_0x4d2fbf(++_0x2cf1d7);}(_0xd21e,0x11c));var _0xed21=function(_0x565ae4,_0x44dce7){_0x565ae4=_0x565ae4-0x0;var _0x4f5c97=_0xd21e[_0x565ae4];return _0x4f5c97;};'use strict';var multer=require(_0xed21('0x0'));var util=require(_0xed21('0x1'));var path=require(_0xed21('0x2'));var timeout=require(_0xed21('0x3'));var express=require(_0xed21('0x4'));var router=express[_0xed21('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed21('0x6'));var controller=require(_0xed21('0x7'));router[_0xed21('0x8')]('/',auth['isAuthenticated'](),controller[_0xed21('0x9')]);router[_0xed21('0x8')](_0xed21('0xa'),auth[_0xed21('0xb')](),controller[_0xed21('0xc')]);router[_0xed21('0x8')](_0xed21('0xd'),auth[_0xed21('0xb')](),controller[_0xed21('0xe')]);router[_0xed21('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xed21('0x10'),_0xed21('0x11')),controller['create']);router[_0xed21('0x12')](_0xed21('0xd'),controller['update']);router[_0xed21('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0xed21('0x13')]);router['put'](_0xed21('0x14'),auth['isAuthenticated'](),controller[_0xed21('0x15')]);router['delete'](_0xed21('0xd'),auth[_0xed21('0xb')](),controller[_0xed21('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 76524b9..4f3398c 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 _0xcbf8=['medium','sequelize','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xcbf8,0x121));var _0x8cbf=function(_0x427b63,_0x11f446){_0x427b63=_0x427b63-0x0;var _0x32a211=_0xcbf8[_0x427b63];return _0x32a211;};'use strict';var Sequelize=require(_0x8cbf('0x0'));module['exports']={'body':{'type':Sequelize[_0x8cbf('0x1')](_0x8cbf('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x8b5e=['TEXT','medium','exports'];(function(_0x45b2fb,_0xb2178a){var _0x4109a0=function(_0x3c0860){while(--_0x3c0860){_0x45b2fb['push'](_0x45b2fb['shift']());}};_0x4109a0(++_0xb2178a);}(_0x8b5e,0x110));var _0xe8b5=function(_0xda85f7,_0x23017a){_0xda85f7=_0xda85f7-0x0;var _0x354a8d=_0x8b5e[_0xda85f7];return _0x354a8d;};'use strict';var Sequelize=require('sequelize');module[_0xe8b5('0x0')]={'body':{'type':Sequelize[_0xe8b5('0x1')](_0xe8b5('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 508fee2..5064b5f 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 _0xf4f4=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','ChatOfflineMessage','includeAll','include','rows','catch','params','keys','rawAttributes','find','create','body','describe','html-pdf'];(function(_0x5378a1,_0x258b11){var _0x462b69=function(_0x3d4d0e){while(--_0x3d4d0e){_0x5378a1['push'](_0x5378a1['shift']());}};_0x462b69(++_0x258b11);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x59de9b,_0x517095){_0x59de9b=_0x59de9b-0x0;var _0x4f1348=_0xf4f4[_0x59de9b];return _0x4f1348;};'use strict';var pdf=require(_0x4f4f('0x0'));var emlformat=require(_0x4f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require(_0x4f4f('0x4'));var moment=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var Mustache=require('mustache');var util=require(_0x4f4f('0x7'));var path=require('path');var sox=require(_0x4f4f('0x8'));var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=_0x47ab66[_0x4f4f('0x1c')],_0x422894=_0x4c68f4[_0x4f4f('0x1d')],_0x8d65a2=_0x4c68f4[_0x4f4f('0x1d')]+_0x4c68f4[_0x4f4f('0x1e')],_0x2d21ed;if(_0x8d65a2>=_0x58de77){_0x8d65a2=_0x58de77;_0x2d21ed=0xc8;}else{_0x2d21ed=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x2d21ed);return _0x19f2fd[_0x4f4f('0x1f')](_0x4f4f('0x20'),_0x422894+'-'+_0x8d65a2+'/'+_0x58de77)[_0x4f4f('0x21')](_0x47ab66);}return null;};}function patchUpdates(_0x43f43b){return function(_0x499277){try{jsonpatch[_0x4f4f('0x22')](_0x499277,_0x43f43b,!![]);}catch(_0x4622c2){return BPromise[_0x4f4f('0x23')](_0x4622c2);}return _0x499277[_0x4f4f('0x24')]();};}function saveUpdates(_0x302a79,_0x460b4d){return function(_0x2eedcc){if(_0x2eedcc){return _0x2eedcc[_0x4f4f('0x25')](_0x302a79)[_0x4f4f('0x26')](function(_0x2509a8){return _0x2509a8;});}return null;};}function removeEntity(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x27')]()['then'](function(){_0x469a1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272125,_0x43e661){return function(_0x5186ac){if(!_0x5186ac){_0x272125[_0x4f4f('0x28')](0x194);}return _0x5186ac;};}function handleError(_0x15859c,_0xcf19ac){_0xcf19ac=_0xcf19ac||0x1f4;return function(_0x2ec92a){logger[_0x4f4f('0x29')](_0x2ec92a[_0x4f4f('0x2a')]);if(_0x2ec92a[_0x4f4f('0x2b')]){delete _0x2ec92a['name'];}_0x15859c[_0x4f4f('0x1b')](_0xcf19ac)[_0x4f4f('0x2c')](_0x2ec92a);};}exports[_0x4f4f('0x2d')]=function(_0x15c79c,_0x18e864){var _0x4ad33d={},_0x23df57={},_0xaf3de1={'count':0x0,'rows':[]};var _0x7180f8=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x73b8bb){return{'name':_0x73b8bb['fieldName'],'type':_0x73b8bb[_0x4f4f('0x2e')][_0x4f4f('0x2f')]};});_0x23df57[_0x4f4f('0x30')]=_['map'](_0x7180f8,_0x4f4f('0x2b'));_0x23df57[_0x4f4f('0x31')]=_['keys'](_0x15c79c[_0x4f4f('0x31')]);_0x23df57[_0x4f4f('0x32')]=_[_0x4f4f('0x33')](_0x23df57['model'],_0x23df57[_0x4f4f('0x31')]);_0x4ad33d[_0x4f4f('0x34')]=_['intersection'](_0x23df57['model'],qs[_0x4f4f('0x35')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x35')]));_0x4ad33d[_0x4f4f('0x34')]=_0x4ad33d[_0x4f4f('0x34')][_0x4f4f('0x36')]?_0x4ad33d[_0x4f4f('0x34')]:_0x23df57[_0x4f4f('0x30')];if(!_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x37')]('nolimit')){_0x4ad33d['limit']=qs[_0x4f4f('0x1e')](_0x15c79c['query'][_0x4f4f('0x1e')]);_0x4ad33d[_0x4f4f('0x1d')]=qs[_0x4f4f('0x1d')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x1d')]);}_0x4ad33d[_0x4f4f('0x38')]=qs[_0x4f4f('0x39')](_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x39')]);_0x4ad33d[_0x4f4f('0x3a')]=qs[_0x4f4f('0x32')](_[_0x4f4f('0x3b')](_0x15c79c['query'],_0x23df57[_0x4f4f('0x32')]),_0x7180f8);if(_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x3c')]){_0x4ad33d[_0x4f4f('0x3a')]=_[_0x4f4f('0x3d')](_0x4ad33d[_0x4f4f('0x3a')],{'$or':_[_0x4f4f('0x3e')](_0x7180f8,function(_0x32b077){if(_0x32b077[_0x4f4f('0x2e')]!=='VIRTUAL'){var _0xbd62c5={};_0xbd62c5[_0x32b077[_0x4f4f('0x2b')]]={'$like':'%'+_0x15c79c[_0x4f4f('0x31')]['filter']+'%'};return _0xbd62c5;}})});}_0x4ad33d=_['merge']({},_0x4ad33d,_0x15c79c[_0x4f4f('0x3f')]);var _0x95a296={'where':_0x4ad33d[_0x4f4f('0x3a')]};return db[_0x4f4f('0x40')][_0x4f4f('0x1c')](_0x95a296)[_0x4f4f('0x26')](function(_0x1c012d){_0xaf3de1[_0x4f4f('0x1c')]=_0x1c012d;if(_0x15c79c[_0x4f4f('0x31')][_0x4f4f('0x41')]){_0x4ad33d[_0x4f4f('0x42')]=[{'all':!![]}];}return db[_0x4f4f('0x40')]['findAll'](_0x4ad33d);})[_0x4f4f('0x26')](function(_0x1b031e){_0xaf3de1[_0x4f4f('0x43')]=_0x1b031e;return _0xaf3de1;})[_0x4f4f('0x26')](respondWithFilteredResult(_0x18e864,_0x4ad33d))[_0x4f4f('0x44')](handleError(_0x18e864,null));};exports['show']=function(_0x5c06a1,_0x134710){var _0xa070ad={'raw':!![],'where':{'id':_0x5c06a1[_0x4f4f('0x45')]['id']}},_0x2064e9={};_0x2064e9['model']=_[_0x4f4f('0x46')](db['ChatOfflineMessage'][_0x4f4f('0x47')]);_0x2064e9['query']=_['keys'](_0x5c06a1[_0x4f4f('0x31')]);_0x2064e9['filters']=_[_0x4f4f('0x33')](_0x2064e9[_0x4f4f('0x30')],_0x2064e9['query']);_0xa070ad[_0x4f4f('0x34')]=_[_0x4f4f('0x33')](_0x2064e9['model'],qs[_0x4f4f('0x35')](_0x5c06a1[_0x4f4f('0x31')][_0x4f4f('0x35')]));_0xa070ad[_0x4f4f('0x34')]=_0xa070ad[_0x4f4f('0x34')][_0x4f4f('0x36')]?_0xa070ad[_0x4f4f('0x34')]:_0x2064e9[_0x4f4f('0x30')];if(_0x5c06a1[_0x4f4f('0x31')][_0x4f4f('0x41')]){_0xa070ad[_0x4f4f('0x42')]=[{'all':!![]}];}_0xa070ad=_[_0x4f4f('0x3d')]({},_0xa070ad,_0x5c06a1[_0x4f4f('0x3f')]);return db[_0x4f4f('0x40')][_0x4f4f('0x48')](_0xa070ad)['then'](handleEntityNotFound(_0x134710,null))[_0x4f4f('0x26')](respondWithResult(_0x134710,null))['catch'](handleError(_0x134710,null));};exports['create']=function(_0x31349a,_0x4363c9){return db['ChatOfflineMessage'][_0x4f4f('0x49')](_0x31349a[_0x4f4f('0x4a')],{})[_0x4f4f('0x26')](respondWithResult(_0x4363c9,0xc9))[_0x4f4f('0x44')](handleError(_0x4363c9,null));};exports[_0x4f4f('0x25')]=function(_0x545dd6,_0xd4625a){if(_0x545dd6[_0x4f4f('0x4a')]['id']){delete _0x545dd6[_0x4f4f('0x4a')]['id'];}return db[_0x4f4f('0x40')][_0x4f4f('0x48')]({'where':{'id':_0x545dd6[_0x4f4f('0x45')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0xd4625a,null))[_0x4f4f('0x26')](saveUpdates(_0x545dd6[_0x4f4f('0x4a')],null))['then'](respondWithResult(_0xd4625a,null))[_0x4f4f('0x44')](handleError(_0xd4625a,null));};exports[_0x4f4f('0x27')]=function(_0x4b33a5,_0x5ac4df){return db['ChatOfflineMessage'][_0x4f4f('0x48')]({'where':{'id':_0x4b33a5[_0x4f4f('0x45')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x5ac4df,null))['then'](removeEntity(_0x5ac4df,null))[_0x4f4f('0x44')](handleError(_0x5ac4df,null));};exports['describe']=function(_0xf13a0,_0x1c181e){return db[_0x4f4f('0x40')][_0x4f4f('0x4b')]()[_0x4f4f('0x26')](respondWithResult(_0x1c181e,null))[_0x4f4f('0x44')](handleError(_0x1c181e,null));}; \ No newline at end of file +var _0x25c9=['includeAll','include','findAll','show','params','merge','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatOfflineMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','count'];(function(_0x136c93,_0x3542d6){var _0x4ae852=function(_0x410cc2){while(--_0x410cc2){_0x136c93['push'](_0x136c93['shift']());}};_0x4ae852(++_0x3542d6);}(_0x25c9,0x1d9));var _0x925c=function(_0x118fa9,_0x219b95){_0x118fa9=_0x118fa9-0x0;var _0x161649=_0x25c9[_0x118fa9];return _0x161649;};'use strict';var pdf=require(_0x925c('0x0'));var emlformat=require(_0x925c('0x1'));var rimraf=require(_0x925c('0x2'));var zipdir=require(_0x925c('0x3'));var jsonpatch=require(_0x925c('0x4'));var rp=require(_0x925c('0x5'));var moment=require(_0x925c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x925c('0x7'));var util=require('util');var path=require(_0x925c('0x8'));var sox=require(_0x925c('0x9'));var csv=require('to-csv');var ejs=require(_0x925c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x925c('0xb'));var crypto=require(_0x925c('0xc'));var jsforce=require(_0x925c('0xd'));var deskjs=require(_0x925c('0xe'));var toCsv=require(_0x925c('0xf'));var querystring=require('querystring');var Papa=require(_0x925c('0x10'));var Redis=require(_0x925c('0x11'));var authService=require(_0x925c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x925c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x925c('0x14'))(_0x925c('0x15'));var utils=require(_0x925c('0x16'));var config=require(_0x925c('0x17'));var licenseUtil=require(_0x925c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x454e3a,_0x4414d1){_0x4414d1=_0x4414d1||0xcc;return function(_0x2fdd3b){if(_0x2fdd3b){return _0x454e3a['sendStatus'](_0x4414d1);}return _0x454e3a[_0x925c('0x19')](_0x4414d1)[_0x925c('0x1a')]();};}function respondWithResult(_0x2f8f5a,_0x3859f9){_0x3859f9=_0x3859f9||0xc8;return function(_0x4df95a){if(_0x4df95a){return _0x2f8f5a['status'](_0x3859f9)[_0x925c('0x1b')](_0x4df95a);}};}function respondWithFilteredResult(_0x68093d,_0x2f8156){return function(_0x255285){if(_0x255285){var _0x824020=_0x255285['count'],_0x330af5=_0x2f8156[_0x925c('0x1c')],_0x3f79fe=_0x2f8156[_0x925c('0x1c')]+_0x2f8156[_0x925c('0x1d')],_0x531853;if(_0x3f79fe>=_0x824020){_0x3f79fe=_0x824020;_0x531853=0xc8;}else{_0x531853=0xce;}_0x68093d[_0x925c('0x19')](_0x531853);return _0x68093d[_0x925c('0x1e')](_0x925c('0x1f'),_0x330af5+'-'+_0x3f79fe+'/'+_0x824020)['json'](_0x255285);}return null;};}function patchUpdates(_0x36fb59){return function(_0x1c6a50){try{jsonpatch[_0x925c('0x20')](_0x1c6a50,_0x36fb59,!![]);}catch(_0x17ee54){return BPromise[_0x925c('0x21')](_0x17ee54);}return _0x1c6a50[_0x925c('0x22')]();};}function saveUpdates(_0x53fb3d,_0x504df6){return function(_0x35dbd6){if(_0x35dbd6){return _0x35dbd6[_0x925c('0x23')](_0x53fb3d)[_0x925c('0x24')](function(_0x53e67d){return _0x53e67d;});}return null;};}function removeEntity(_0xb1a660,_0x51468e){return function(_0x291327){if(_0x291327){return _0x291327[_0x925c('0x25')]()[_0x925c('0x24')](function(){_0xb1a660[_0x925c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274950,_0x1adfff){return function(_0x32c21f){if(!_0x32c21f){_0x274950[_0x925c('0x26')](0x194);}return _0x32c21f;};}function handleError(_0x4a5520,_0x18a7c2){_0x18a7c2=_0x18a7c2||0x1f4;return function(_0x33aac6){logger[_0x925c('0x27')](_0x33aac6[_0x925c('0x28')]);if(_0x33aac6[_0x925c('0x29')]){delete _0x33aac6[_0x925c('0x29')];}_0x4a5520[_0x925c('0x19')](_0x18a7c2)[_0x925c('0x2a')](_0x33aac6);};}exports[_0x925c('0x2b')]=function(_0x21b9e5,_0x4de001){var _0x1000fc={},_0x439d48={},_0x23cefe={'count':0x0,'rows':[]};var _0x2787b4=_['map'](db[_0x925c('0x2c')][_0x925c('0x2d')],function(_0x169a2f){return{'name':_0x169a2f[_0x925c('0x2e')],'type':_0x169a2f['type'][_0x925c('0x2f')]};});_0x439d48['model']=_['map'](_0x2787b4,_0x925c('0x29'));_0x439d48[_0x925c('0x30')]=_[_0x925c('0x31')](_0x21b9e5[_0x925c('0x30')]);_0x439d48[_0x925c('0x32')]=_[_0x925c('0x33')](_0x439d48[_0x925c('0x34')],_0x439d48[_0x925c('0x30')]);_0x1000fc['attributes']=_[_0x925c('0x33')](_0x439d48[_0x925c('0x34')],qs[_0x925c('0x35')](_0x21b9e5['query'][_0x925c('0x35')]));_0x1000fc[_0x925c('0x36')]=_0x1000fc['attributes'][_0x925c('0x37')]?_0x1000fc[_0x925c('0x36')]:_0x439d48[_0x925c('0x34')];if(!_0x21b9e5[_0x925c('0x30')][_0x925c('0x38')](_0x925c('0x39'))){_0x1000fc[_0x925c('0x1d')]=qs[_0x925c('0x1d')](_0x21b9e5[_0x925c('0x30')][_0x925c('0x1d')]);_0x1000fc[_0x925c('0x1c')]=qs[_0x925c('0x1c')](_0x21b9e5['query'][_0x925c('0x1c')]);}_0x1000fc[_0x925c('0x3a')]=qs[_0x925c('0x3b')](_0x21b9e5[_0x925c('0x30')][_0x925c('0x3b')]);_0x1000fc[_0x925c('0x3c')]=qs[_0x925c('0x32')](_['pick'](_0x21b9e5[_0x925c('0x30')],_0x439d48[_0x925c('0x32')]),_0x2787b4);if(_0x21b9e5['query'][_0x925c('0x3d')]){_0x1000fc[_0x925c('0x3c')]=_['merge'](_0x1000fc[_0x925c('0x3c')],{'$or':_[_0x925c('0x3e')](_0x2787b4,function(_0x6d069){if(_0x6d069['type']!==_0x925c('0x3f')){var _0x192516={};_0x192516[_0x6d069[_0x925c('0x29')]]={'$like':'%'+_0x21b9e5[_0x925c('0x30')][_0x925c('0x3d')]+'%'};return _0x192516;}})});}_0x1000fc=_['merge']({},_0x1000fc,_0x21b9e5[_0x925c('0x40')]);var _0x3382ee={'where':_0x1000fc[_0x925c('0x3c')]};return db['ChatOfflineMessage'][_0x925c('0x41')](_0x3382ee)[_0x925c('0x24')](function(_0x340d26){_0x23cefe[_0x925c('0x41')]=_0x340d26;if(_0x21b9e5['query'][_0x925c('0x42')]){_0x1000fc[_0x925c('0x43')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x925c('0x44')](_0x1000fc);})[_0x925c('0x24')](function(_0x2283d2){_0x23cefe['rows']=_0x2283d2;return _0x23cefe;})[_0x925c('0x24')](respondWithFilteredResult(_0x4de001,_0x1000fc))['catch'](handleError(_0x4de001,null));};exports[_0x925c('0x45')]=function(_0x188ffa,_0x512c6f){var _0x47e3dd={'raw':!![],'where':{'id':_0x188ffa[_0x925c('0x46')]['id']}},_0x13621f={};_0x13621f['model']=_[_0x925c('0x31')](db['ChatOfflineMessage'][_0x925c('0x2d')]);_0x13621f[_0x925c('0x30')]=_[_0x925c('0x31')](_0x188ffa['query']);_0x13621f['filters']=_[_0x925c('0x33')](_0x13621f[_0x925c('0x34')],_0x13621f[_0x925c('0x30')]);_0x47e3dd[_0x925c('0x36')]=_['intersection'](_0x13621f['model'],qs[_0x925c('0x35')](_0x188ffa[_0x925c('0x30')][_0x925c('0x35')]));_0x47e3dd['attributes']=_0x47e3dd[_0x925c('0x36')][_0x925c('0x37')]?_0x47e3dd[_0x925c('0x36')]:_0x13621f['model'];if(_0x188ffa[_0x925c('0x30')]['includeAll']){_0x47e3dd[_0x925c('0x43')]=[{'all':!![]}];}_0x47e3dd=_[_0x925c('0x47')]({},_0x47e3dd,_0x188ffa[_0x925c('0x40')]);return db[_0x925c('0x2c')][_0x925c('0x48')](_0x47e3dd)[_0x925c('0x24')](handleEntityNotFound(_0x512c6f,null))[_0x925c('0x24')](respondWithResult(_0x512c6f,null))[_0x925c('0x49')](handleError(_0x512c6f,null));};exports['create']=function(_0x4d25ea,_0x1208b1){return db[_0x925c('0x2c')][_0x925c('0x4a')](_0x4d25ea[_0x925c('0x4b')],{})['then'](respondWithResult(_0x1208b1,0xc9))[_0x925c('0x49')](handleError(_0x1208b1,null));};exports[_0x925c('0x23')]=function(_0x327775,_0x35f065){if(_0x327775[_0x925c('0x4b')]['id']){delete _0x327775['body']['id'];}return db[_0x925c('0x2c')][_0x925c('0x48')]({'where':{'id':_0x327775[_0x925c('0x46')]['id']}})[_0x925c('0x24')](handleEntityNotFound(_0x35f065,null))['then'](saveUpdates(_0x327775['body'],null))[_0x925c('0x24')](respondWithResult(_0x35f065,null))[_0x925c('0x49')](handleError(_0x35f065,null));};exports[_0x925c('0x25')]=function(_0x2fe99f,_0x1196d8){return db[_0x925c('0x2c')][_0x925c('0x48')]({'where':{'id':_0x2fe99f[_0x925c('0x46')]['id']}})[_0x925c('0x24')](handleEntityNotFound(_0x1196d8,null))[_0x925c('0x24')](removeEntity(_0x1196d8,null))[_0x925c('0x49')](handleError(_0x1196d8,null));};exports[_0x925c('0x4c')]=function(_0x84e97c,_0x34d004){return db[_0x925c('0x2c')][_0x925c('0x4c')]()['then'](respondWithResult(_0x34d004,null))[_0x925c('0x49')](handleError(_0x34d004,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4fc5c21..635849e 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 _0x5636=['bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1da63d,_0x10a600){var _0xd41645=function(_0x371afa){while(--_0x371afa){_0x1da63d['push'](_0x1da63d['shift']());}};_0xd41645(++_0x10a600);}(_0x5636,0x102));var _0x6563=function(_0x20005c,_0xdb2d77){_0x20005c=_0x20005c-0x0;var _0x39d7ef=_0x5636[_0x20005c];return _0x39d7ef;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6563('0xb'),'collate':_0x6563('0xc')});}; \ No newline at end of file +var _0xa37e=['bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x14028a,_0x23e0f1){var _0x17bbb6=function(_0x3e6b3c){while(--_0x3e6b3c){_0x14028a['push'](_0x14028a['shift']());}};_0x17bbb6(++_0x23e0f1);}(_0xa37e,0x97));var _0xea37=function(_0x3e568d,_0x11e839){_0x3e568d=_0x3e568d-0x0;var _0x4a2886=_0xa37e[_0x3e568d];return _0x4a2886;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea37('0x9'),'collate':_0xea37('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index cbdd8a5..57f043e 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 _0x9ec2=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9ec2,0xda));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x29ec('0x0'));var util=require(_0x29ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29ec('0x2'));var fs=require('fs');var Redis=require(_0x29ec('0x3'));var db=require(_0x29ec('0x4'))['db'];var utils=require(_0x29ec('0x5'));var logger=require(_0x29ec('0x6'))(_0x29ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x29ec('0x8'));var client=jayson[_0x29ec('0x9')][_0x29ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x302ce0,_0x1ce55d,_0x1dc540){return new BPromise(function(_0x5b5885,_0x481db4){return client[_0x29ec('0xb')](_0x302ce0,_0x1dc540)[_0x29ec('0xc')](function(_0x556fe3){logger[_0x29ec('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ce55d,_0x29ec('0xe'));logger[_0x29ec('0xf')](_0x29ec('0x10'),_0x1ce55d,_0x29ec('0xe'),JSON['stringify'](_0x556fe3));if(_0x556fe3[_0x29ec('0x11')]){if(_0x556fe3['error'][_0x29ec('0x12')]===0x1f4){logger['error'](_0x29ec('0x13'),_0x1ce55d,_0x556fe3[_0x29ec('0x11')]['message']);return _0x481db4(_0x556fe3['error']['message']);}logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x1ce55d,_0x556fe3[_0x29ec('0x11')][_0x29ec('0x14')]);return _0x5b5885(_0x556fe3[_0x29ec('0x11')][_0x29ec('0x14')]);}else{logger[_0x29ec('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ce55d,_0x29ec('0xe'));_0x5b5885(_0x556fe3[_0x29ec('0x15')][_0x29ec('0x14')]);}})[_0x29ec('0x16')](function(_0x15439f){logger[_0x29ec('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1ce55d,_0x15439f);_0x481db4(_0x15439f);});});} \ No newline at end of file +var _0x4022=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xc89a30,_0x5e8cf6){var _0x4d9488=function(_0x471704){while(--_0x471704){_0xc89a30['push'](_0xc89a30['shift']());}};_0x4d9488(++_0x5e8cf6);}(_0x4022,0xed));var _0x2402=function(_0x22760d,_0x34c88f){_0x22760d=_0x22760d-0x0;var _0x184582=_0x4022[_0x22760d];return _0x184582;};'use strict';var _=require('lodash');var util=require(_0x2402('0x0'));var moment=require(_0x2402('0x1'));var BPromise=require(_0x2402('0x2'));var rs=require(_0x2402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2402('0x4'))['db'];var utils=require(_0x2402('0x5'));var logger=require('../../config/logger')(_0x2402('0x6'));var config=require(_0x2402('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2402('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fbf3a,_0x4ca65e,_0x1607f0){return new BPromise(function(_0x291cb9,_0x5407c0){return client[_0x2402('0x9')](_0x1fbf3a,_0x1607f0)[_0x2402('0xa')](function(_0x97837e){logger[_0x2402('0xb')](_0x2402('0xc'),_0x4ca65e,'request\x20sent');logger['debug'](_0x2402('0xd'),_0x4ca65e,_0x2402('0xe'),JSON[_0x2402('0xf')](_0x97837e));if(_0x97837e[_0x2402('0x10')]){if(_0x97837e[_0x2402('0x10')][_0x2402('0x11')]===0x1f4){logger['error'](_0x2402('0xc'),_0x4ca65e,_0x97837e[_0x2402('0x10')][_0x2402('0x12')]);return _0x5407c0(_0x97837e['error']['message']);}logger[_0x2402('0x10')](_0x2402('0xc'),_0x4ca65e,_0x97837e[_0x2402('0x10')][_0x2402('0x12')]);return _0x291cb9(_0x97837e[_0x2402('0x10')]['message']);}else{logger[_0x2402('0xb')](_0x2402('0xc'),_0x4ca65e,_0x2402('0xe'));_0x291cb9(_0x97837e[_0x2402('0x13')][_0x2402('0x12')]);}})[_0x2402('0x14')](function(_0x54a380){logger[_0x2402('0x10')](_0x2402('0xc'),_0x4ca65e,_0x54a380);_0x5407c0(_0x54a380);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 59e506e..585726b 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 _0xc3e5=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x406b9c,_0x400dd0){var _0x24389b=function(_0x193383){while(--_0x193383){_0x406b9c['push'](_0x406b9c['shift']());}};_0x24389b(++_0x400dd0);}(_0xc3e5,0x107));var _0x5c3e=function(_0x38e3b9,_0x5109ac){_0x38e3b9=_0x38e3b9-0x0;var _0x194d19=_0xc3e5[_0x38e3b9];return _0x194d19;};'use strict';var multer=require('multer');var util=require(_0x5c3e('0x0'));var path=require(_0x5c3e('0x1'));var timeout=require(_0x5c3e('0x2'));var express=require(_0x5c3e('0x3'));var router=express['Router']();var auth=require(_0x5c3e('0x4'));var interaction=require(_0x5c3e('0x5'));var config=require(_0x5c3e('0x6'));var controller=require(_0x5c3e('0x7'));router[_0x5c3e('0x8')]('/',auth[_0x5c3e('0x9')](),controller['index']);router[_0x5c3e('0x8')](_0x5c3e('0xa'),auth[_0x5c3e('0x9')](),controller[_0x5c3e('0xb')]);router[_0x5c3e('0x8')](_0x5c3e('0xc'),auth['isAuthenticated'](),controller[_0x5c3e('0xd')]);router[_0x5c3e('0xe')]('/',auth[_0x5c3e('0x9')](),controller['create']);router['put']('/:id',auth[_0x5c3e('0x9')](),controller[_0x5c3e('0xf')]);router[_0x5c3e('0x10')](_0x5c3e('0xc'),auth[_0x5c3e('0x9')](),controller[_0x5c3e('0x11')]);module[_0x5c3e('0x12')]=router; \ No newline at end of file +var _0x8f7a=['util','path','connect-timeout','express','Router','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x317fa5,_0x4d1a62){var _0x455117=function(_0x1c0fd2){while(--_0x1c0fd2){_0x317fa5['push'](_0x317fa5['shift']());}};_0x455117(++_0x4d1a62);}(_0x8f7a,0xfc));var _0xa8f7=function(_0x19085d,_0x5d8bc0){_0x19085d=_0x19085d-0x0;var _0xdb3f69=_0x8f7a[_0x19085d];return _0xdb3f69;};'use strict';var multer=require('multer');var util=require(_0xa8f7('0x0'));var path=require(_0xa8f7('0x1'));var timeout=require(_0xa8f7('0x2'));var express=require(_0xa8f7('0x3'));var router=express[_0xa8f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa8f7('0x5'));router[_0xa8f7('0x6')]('/',auth['isAuthenticated'](),controller[_0xa8f7('0x7')]);router['get'](_0xa8f7('0x8'),auth[_0xa8f7('0x9')](),controller['describe']);router[_0xa8f7('0x6')](_0xa8f7('0xa'),auth[_0xa8f7('0x9')](),controller[_0xa8f7('0xb')]);router[_0xa8f7('0xc')]('/',auth[_0xa8f7('0x9')](),controller['create']);router[_0xa8f7('0xd')](_0xa8f7('0xa'),auth[_0xa8f7('0x9')](),controller[_0xa8f7('0xe')]);router[_0xa8f7('0xf')]('/:id',auth[_0xa8f7('0x9')](),controller[_0xa8f7('0x10')]);module[_0xa8f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c4fe76b..97f8153 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 _0xbca5=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x1eb326,_0x53c40b){var _0x468d1c=function(_0x33fa68){while(--_0x33fa68){_0x1eb326['push'](_0x1eb326['shift']());}};_0x468d1c(++_0x53c40b);}(_0xbca5,0xba));var _0x5bca=function(_0x527228,_0x2bf9d1){_0x527228=_0x527228-0x0;var _0x18fc82=_0xbca5[_0x527228];return _0x18fc82;};'use strict';var Sequelize=require(_0x5bca('0x0'));module[_0x5bca('0x1')]={'name':{'type':Sequelize[_0x5bca('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5bca('0x3')](_0x5bca('0x4'),_0x5bca('0x5')),'defaultValue':_0x5bca('0x4')},'selector':{'type':Sequelize[_0x5bca('0x2')]},'timeout':{'type':Sequelize[_0x5bca('0x6')]}}; \ No newline at end of file +var _0x4667=['timeout','STRING','INTEGER','ENUM','mouseOver'];(function(_0x101cbc,_0x3df009){var _0x4e6167=function(_0x3a5543){while(--_0x3a5543){_0x101cbc['push'](_0x101cbc['shift']());}};_0x4e6167(++_0x3df009);}(_0x4667,0x1d4));var _0x7466=function(_0x5e32cb,_0x4a7d72){_0x5e32cb=_0x5e32cb-0x0;var _0x118b5d=_0x4667[_0x5e32cb];return _0x118b5d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7466('0x0')](_0x7466('0x1'),_0x7466('0x2')),'defaultValue':_0x7466('0x1')},'selector':{'type':Sequelize[_0x7466('0x3')]},'timeout':{'type':Sequelize[_0x7466('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 11b3b4b..5a6f623 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 _0xbcac=['count','offset','limit','Content-Range','apply','save','update','destroy','then','end','error','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','merge','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x513743,_0x57dd3){var _0x3509f8=function(_0x2d9556){while(--_0x2d9556){_0x513743['push'](_0x513743['shift']());}};_0x3509f8(++_0x57dd3);}(_0xbcac,0x111));var _0xcbca=function(_0x436624,_0x1aaf79){_0x436624=_0x436624-0x0;var _0x4473ba=_0xbcac[_0x436624];return _0x4473ba;};'use strict';var pdf=require(_0xcbca('0x0'));var emlformat=require(_0xcbca('0x1'));var rimraf=require(_0xcbca('0x2'));var zipdir=require(_0xcbca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcbca('0x4'));var BPromise=require(_0xcbca('0x5'));var Mustache=require(_0xcbca('0x6'));var util=require(_0xcbca('0x7'));var path=require(_0xcbca('0x8'));var sox=require(_0xcbca('0x9'));var csv=require(_0xcbca('0xa'));var ejs=require(_0xcbca('0xb'));var fs=require('fs');var _=require(_0xcbca('0xc'));var squel=require('squel');var crypto=require(_0xcbca('0xd'));var jsforce=require(_0xcbca('0xe'));var deskjs=require(_0xcbca('0xf'));var toCsv=require(_0xcbca('0xa'));var querystring=require(_0xcbca('0x10'));var Papa=require(_0xcbca('0x11'));var Redis=require(_0xcbca('0x12'));var authService=require(_0xcbca('0x13'));var qs=require(_0xcbca('0x14'));var as=require(_0xcbca('0x15'));var hardwareService=require(_0xcbca('0x16'));var logger=require(_0xcbca('0x17'))(_0xcbca('0x18'));var utils=require(_0xcbca('0x19'));var config=require(_0xcbca('0x1a'));var licenseUtil=require(_0xcbca('0x1b'));var db=require(_0xcbca('0x1c'))['db'];function respondWithStatusCode(_0xae0070,_0x46397a){_0x46397a=_0x46397a||0xcc;return function(_0xb1a466){if(_0xb1a466){return _0xae0070[_0xcbca('0x1d')](_0x46397a);}return _0xae0070[_0xcbca('0x1e')](_0x46397a)['end']();};}function respondWithResult(_0x8df3eb,_0x2a58cc){_0x2a58cc=_0x2a58cc||0xc8;return function(_0x229b1b){if(_0x229b1b){return _0x8df3eb[_0xcbca('0x1e')](_0x2a58cc)[_0xcbca('0x1f')](_0x229b1b);}};}function respondWithFilteredResult(_0x406999,_0xacd950){return function(_0x31b4d0){if(_0x31b4d0){var _0x1444df=_0x31b4d0[_0xcbca('0x20')],_0xfc6004=_0xacd950[_0xcbca('0x21')],_0x1f09d4=_0xacd950[_0xcbca('0x21')]+_0xacd950[_0xcbca('0x22')],_0x416f0c;if(_0x1f09d4>=_0x1444df){_0x1f09d4=_0x1444df;_0x416f0c=0xc8;}else{_0x416f0c=0xce;}_0x406999[_0xcbca('0x1e')](_0x416f0c);return _0x406999['set'](_0xcbca('0x23'),_0xfc6004+'-'+_0x1f09d4+'/'+_0x1444df)[_0xcbca('0x1f')](_0x31b4d0);}return null;};}function patchUpdates(_0x132644){return function(_0x481a00){try{jsonpatch[_0xcbca('0x24')](_0x481a00,_0x132644,!![]);}catch(_0x268f48){return BPromise['reject'](_0x268f48);}return _0x481a00[_0xcbca('0x25')]();};}function saveUpdates(_0x31e55a,_0x10fdc1){return function(_0x169641){if(_0x169641){return _0x169641[_0xcbca('0x26')](_0x31e55a)['then'](function(_0x513552){return _0x513552;});}return null;};}function removeEntity(_0x49cd87,_0x190830){return function(_0x1e913c){if(_0x1e913c){return _0x1e913c[_0xcbca('0x27')]()[_0xcbca('0x28')](function(){_0x49cd87[_0xcbca('0x1e')](0xcc)[_0xcbca('0x29')]();});}};}function handleEntityNotFound(_0x48bde1,_0x4435cb){return function(_0x23436d){if(!_0x23436d){_0x48bde1['sendStatus'](0x194);}return _0x23436d;};}function handleError(_0x5071e5,_0x4c65e9){_0x4c65e9=_0x4c65e9||0x1f4;return function(_0x487130){logger[_0xcbca('0x2a')](_0x487130['stack']);if(_0x487130[_0xcbca('0x2b')]){delete _0x487130[_0xcbca('0x2b')];}_0x5071e5['status'](_0x4c65e9)[_0xcbca('0x2c')](_0x487130);};}exports[_0xcbca('0x2d')]=function(_0x5123ad,_0x204854){var _0x53a923={'raw':!![],'where':{'id':_0x5123ad[_0xcbca('0x2e')]['id']}},_0x46a87d={};_0x46a87d[_0xcbca('0x2f')]=_['keys'](db[_0xcbca('0x30')][_0xcbca('0x31')]);_0x46a87d[_0xcbca('0x32')]=_['keys'](_0x5123ad['query']);_0x46a87d[_0xcbca('0x33')]=_[_0xcbca('0x34')](_0x46a87d[_0xcbca('0x2f')],_0x46a87d[_0xcbca('0x32')]);_0x53a923[_0xcbca('0x35')]=_[_0xcbca('0x34')](_0x46a87d[_0xcbca('0x2f')],qs['fields'](_0x5123ad[_0xcbca('0x32')][_0xcbca('0x36')]));_0x53a923['attributes']=_0x53a923[_0xcbca('0x35')][_0xcbca('0x37')]?_0x53a923[_0xcbca('0x35')]:_0x46a87d[_0xcbca('0x2f')];if(_0x5123ad['query']['includeAll']){_0x53a923['include']=[{'all':!![]}];}_0x53a923=_[_0xcbca('0x38')]({},_0x53a923,_0x5123ad['options']);return db[_0xcbca('0x30')][_0xcbca('0x39')](_0x53a923)['then'](handleEntityNotFound(_0x204854,null))['then'](respondWithResult(_0x204854,null))[_0xcbca('0x3a')](handleError(_0x204854,null));};exports[_0xcbca('0x3b')]=function(_0x2db689,_0x180357){return db['ChatProactiveAction'][_0xcbca('0x3b')](_0x2db689[_0xcbca('0x3c')],{})[_0xcbca('0x28')](respondWithResult(_0x180357,0xc9))[_0xcbca('0x3a')](handleError(_0x180357,null));};exports['update']=function(_0x3becc8,_0x485768){if(_0x3becc8[_0xcbca('0x3c')]['id']){delete _0x3becc8[_0xcbca('0x3c')]['id'];}return db[_0xcbca('0x30')][_0xcbca('0x39')]({'where':{'id':_0x3becc8[_0xcbca('0x2e')]['id']}})[_0xcbca('0x28')](handleEntityNotFound(_0x485768,null))[_0xcbca('0x28')](saveUpdates(_0x3becc8[_0xcbca('0x3c')],null))[_0xcbca('0x28')](respondWithResult(_0x485768,null))[_0xcbca('0x3a')](handleError(_0x485768,null));};exports[_0xcbca('0x27')]=function(_0x2a14be,_0x427599){return db[_0xcbca('0x30')][_0xcbca('0x39')]({'where':{'id':_0x2a14be['params']['id']}})[_0xcbca('0x28')](handleEntityNotFound(_0x427599,null))[_0xcbca('0x28')](removeEntity(_0x427599,null))[_0xcbca('0x3a')](handleError(_0x427599,null));}; \ No newline at end of file +var _0xae62=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','show','params','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','include','merge','find','catch','create','body','html-pdf','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x1bc1a8,_0x47c6de){var _0x1467b9=function(_0x16dc46){while(--_0x16dc46){_0x1bc1a8['push'](_0x1bc1a8['shift']());}};_0x1467b9(++_0x47c6de);}(_0xae62,0xf6));var _0x2ae6=function(_0x59f063,_0x1d7528){_0x59f063=_0x59f063-0x0;var _0x3d6c03=_0xae62[_0x59f063];return _0x3d6c03;};'use strict';var pdf=require(_0x2ae6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ae6('0x1'));var rp=require(_0x2ae6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ae6('0x3'));var sox=require(_0x2ae6('0x4'));var csv=require(_0x2ae6('0x5'));var ejs=require(_0x2ae6('0x6'));var fs=require('fs');var _=require(_0x2ae6('0x7'));var squel=require('squel');var crypto=require(_0x2ae6('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x2ae6('0x9'));var toCsv=require(_0x2ae6('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2ae6('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x2ae6('0xb'));var as=require(_0x2ae6('0xc'));var hardwareService=require(_0x2ae6('0xd'));var logger=require(_0x2ae6('0xe'))(_0x2ae6('0xf'));var utils=require(_0x2ae6('0x10'));var config=require(_0x2ae6('0x11'));var licenseUtil=require(_0x2ae6('0x12'));var db=require(_0x2ae6('0x13'))['db'];function respondWithStatusCode(_0x2ec5e9,_0x238224){_0x238224=_0x238224||0xcc;return function(_0x5ef94e){if(_0x5ef94e){return _0x2ec5e9[_0x2ae6('0x14')](_0x238224);}return _0x2ec5e9[_0x2ae6('0x15')](_0x238224)[_0x2ae6('0x16')]();};}function respondWithResult(_0x154f90,_0x8cba08){_0x8cba08=_0x8cba08||0xc8;return function(_0x14d487){if(_0x14d487){return _0x154f90[_0x2ae6('0x15')](_0x8cba08)[_0x2ae6('0x17')](_0x14d487);}};}function respondWithFilteredResult(_0x4ae87c,_0x350100){return function(_0x37215a){if(_0x37215a){var _0x5c5075=_0x37215a[_0x2ae6('0x18')],_0x5147d9=_0x350100[_0x2ae6('0x19')],_0x1d82d2=_0x350100[_0x2ae6('0x19')]+_0x350100[_0x2ae6('0x1a')],_0x2f6079;if(_0x1d82d2>=_0x5c5075){_0x1d82d2=_0x5c5075;_0x2f6079=0xc8;}else{_0x2f6079=0xce;}_0x4ae87c['status'](_0x2f6079);return _0x4ae87c[_0x2ae6('0x1b')](_0x2ae6('0x1c'),_0x5147d9+'-'+_0x1d82d2+'/'+_0x5c5075)['json'](_0x37215a);}return null;};}function patchUpdates(_0x18b49b){return function(_0x9d5bea){try{jsonpatch[_0x2ae6('0x1d')](_0x9d5bea,_0x18b49b,!![]);}catch(_0x5b891d){return BPromise['reject'](_0x5b891d);}return _0x9d5bea[_0x2ae6('0x1e')]();};}function saveUpdates(_0x51d313,_0x49ff5c){return function(_0x3bf668){if(_0x3bf668){return _0x3bf668[_0x2ae6('0x1f')](_0x51d313)[_0x2ae6('0x20')](function(_0x3035a6){return _0x3035a6;});}return null;};}function removeEntity(_0x2018ad,_0x3dd76){return function(_0x2c1427){if(_0x2c1427){return _0x2c1427[_0x2ae6('0x21')]()[_0x2ae6('0x20')](function(){_0x2018ad[_0x2ae6('0x15')](0xcc)[_0x2ae6('0x16')]();});}};}function handleEntityNotFound(_0x307940,_0x30ebb2){return function(_0x2391a4){if(!_0x2391a4){_0x307940[_0x2ae6('0x14')](0x194);}return _0x2391a4;};}function handleError(_0x6de840,_0x211e47){_0x211e47=_0x211e47||0x1f4;return function(_0x3dc5a2){logger[_0x2ae6('0x22')](_0x3dc5a2[_0x2ae6('0x23')]);if(_0x3dc5a2[_0x2ae6('0x24')]){delete _0x3dc5a2[_0x2ae6('0x24')];}_0x6de840[_0x2ae6('0x15')](_0x211e47)['send'](_0x3dc5a2);};}exports[_0x2ae6('0x25')]=function(_0x190f1f,_0x4ae457){var _0x38aeb7={'raw':!![],'where':{'id':_0x190f1f[_0x2ae6('0x26')]['id']}},_0x3d3e5f={};_0x3d3e5f['model']=_['keys'](db[_0x2ae6('0x27')][_0x2ae6('0x28')]);_0x3d3e5f['query']=_['keys'](_0x190f1f[_0x2ae6('0x29')]);_0x3d3e5f[_0x2ae6('0x2a')]=_[_0x2ae6('0x2b')](_0x3d3e5f['model'],_0x3d3e5f[_0x2ae6('0x29')]);_0x38aeb7[_0x2ae6('0x2c')]=_[_0x2ae6('0x2b')](_0x3d3e5f[_0x2ae6('0x2d')],qs[_0x2ae6('0x2e')](_0x190f1f[_0x2ae6('0x29')]['fields']));_0x38aeb7['attributes']=_0x38aeb7['attributes'][_0x2ae6('0x2f')]?_0x38aeb7[_0x2ae6('0x2c')]:_0x3d3e5f[_0x2ae6('0x2d')];if(_0x190f1f[_0x2ae6('0x29')]['includeAll']){_0x38aeb7[_0x2ae6('0x30')]=[{'all':!![]}];}_0x38aeb7=_[_0x2ae6('0x31')]({},_0x38aeb7,_0x190f1f['options']);return db['ChatProactiveAction'][_0x2ae6('0x32')](_0x38aeb7)[_0x2ae6('0x20')](handleEntityNotFound(_0x4ae457,null))[_0x2ae6('0x20')](respondWithResult(_0x4ae457,null))[_0x2ae6('0x33')](handleError(_0x4ae457,null));};exports[_0x2ae6('0x34')]=function(_0x294916,_0x4d0107){return db[_0x2ae6('0x27')][_0x2ae6('0x34')](_0x294916[_0x2ae6('0x35')],{})[_0x2ae6('0x20')](respondWithResult(_0x4d0107,0xc9))[_0x2ae6('0x33')](handleError(_0x4d0107,null));};exports['update']=function(_0x22a9a5,_0x3692f7){if(_0x22a9a5[_0x2ae6('0x35')]['id']){delete _0x22a9a5['body']['id'];}return db[_0x2ae6('0x27')][_0x2ae6('0x32')]({'where':{'id':_0x22a9a5[_0x2ae6('0x26')]['id']}})[_0x2ae6('0x20')](handleEntityNotFound(_0x3692f7,null))[_0x2ae6('0x20')](saveUpdates(_0x22a9a5[_0x2ae6('0x35')],null))['then'](respondWithResult(_0x3692f7,null))[_0x2ae6('0x33')](handleError(_0x3692f7,null));};exports[_0x2ae6('0x21')]=function(_0x3405f2,_0x58c7f3){return db[_0x2ae6('0x27')]['find']({'where':{'id':_0x3405f2[_0x2ae6('0x26')]['id']}})['then'](handleEntityNotFound(_0x58c7f3,null))['then'](removeEntity(_0x58c7f3,null))[_0x2ae6('0x33')](handleError(_0x58c7f3,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 379bf9a..d8accb4 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 _0xfdc7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x4d1828,_0x103c6b){var _0x32a374=function(_0x1a73f0){while(--_0x1a73f0){_0x4d1828['push'](_0x4d1828['shift']());}};_0x32a374(++_0x103c6b);}(_0xfdc7,0x1d9));var _0x7fdc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xfdc7[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7fdc('0x0'));var moment=require(_0x7fdc('0x1'));var BPromise=require(_0x7fdc('0x2'));var rp=require(_0x7fdc('0x3'));var fs=require('fs');var path=require(_0x7fdc('0x4'));var rimraf=require(_0x7fdc('0x5'));var config=require(_0x7fdc('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x7fdc('0x7')]=function(_0x523003,_0x49ba9c){return _0x523003[_0x7fdc('0x8')](_0x7fdc('0x9'),attributes,{'tableName':_0x7fdc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8867=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x643b38,_0x3481a8){var _0x450bfc=function(_0x31b241){while(--_0x31b241){_0x643b38['push'](_0x643b38['shift']());}};_0x450bfc(++_0x3481a8);}(_0x8867,0x131));var _0x7886=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x8867[_0x1e2080];return _0x260111;};'use strict';var _=require(_0x7886('0x0'));var util=require(_0x7886('0x1'));var logger=require(_0x7886('0x2'))(_0x7886('0x3'));var moment=require('moment');var BPromise=require(_0x7886('0x4'));var rp=require(_0x7886('0x5'));var fs=require('fs');var path=require(_0x7886('0x6'));var rimraf=require(_0x7886('0x7'));var config=require(_0x7886('0x8'));var attributes=require(_0x7886('0x9'));module[_0x7886('0xa')]=function(_0x16ee5e,_0x17a691){return _0x16ee5e['define'](_0x7886('0xb'),attributes,{'tableName':_0x7886('0xc'),'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 cebfcc9..3e2a743 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 _0x10e7=['message','ChatProactiveAction,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10e7,0x147));var _0x710e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x10e7[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x710e('0x0'));var BPromise=require('bluebird');var rs=require(_0x710e('0x1'));var fs=require('fs');var Redis=require(_0x710e('0x2'));var db=require(_0x710e('0x3'))['db'];var utils=require(_0x710e('0x4'));var logger=require(_0x710e('0x5'))(_0x710e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x710e('0x7')][_0x710e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d139,_0x47f2ff,_0x1c6535){return new BPromise(function(_0x38cdb3,_0x5110f9){return client['request'](_0x31d139,_0x1c6535)[_0x710e('0x9')](function(_0x3d8f5f){logger[_0x710e('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x710e('0xb'));logger['debug'](_0x710e('0xc'),_0x47f2ff,_0x710e('0xb'),JSON['stringify'](_0x3d8f5f));if(_0x3d8f5f[_0x710e('0xd')]){if(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xe')]===0x1f4){logger[_0x710e('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);return _0x5110f9(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);}logger[_0x710e('0xd')](_0x710e('0x10'),_0x47f2ff,_0x3d8f5f['error'][_0x710e('0xf')]);return _0x38cdb3(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);}else{logger[_0x710e('0xa')](_0x710e('0x10'),_0x47f2ff,_0x710e('0xb'));_0x38cdb3(_0x3d8f5f[_0x710e('0x11')]['message']);}})[_0x710e('0x12')](function(_0x585d7a){logger[_0x710e('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x585d7a);_0x5110f9(_0x585d7a);});});} \ No newline at end of file +var _0xa75d=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43b360,_0x3ebf0a){var _0x551b40=function(_0x4d0504){while(--_0x4d0504){_0x43b360['push'](_0x43b360['shift']());}};_0x551b40(++_0x3ebf0a);}(_0xa75d,0xf3));var _0xda75=function(_0x47f550,_0x141aa2){_0x47f550=_0x47f550-0x0;var _0x4a5316=_0xa75d[_0x47f550];return _0x4a5316;};'use strict';var _=require(_0xda75('0x0'));var util=require(_0xda75('0x1'));var moment=require(_0xda75('0x2'));var BPromise=require(_0xda75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda75('0x4'))['db'];var utils=require(_0xda75('0x5'));var logger=require(_0xda75('0x6'))(_0xda75('0x7'));var config=require(_0xda75('0x8'));var jayson=require(_0xda75('0x9'));var client=jayson[_0xda75('0xa')][_0xda75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20f963,_0x36abc3,_0x3d90e8){return new BPromise(function(_0x39ecdd,_0x40d949){return client[_0xda75('0xc')](_0x20f963,_0x3d90e8)[_0xda75('0xd')](function(_0x59f01f){logger[_0xda75('0xe')](_0xda75('0xf'),_0x36abc3,'request\x20sent');logger[_0xda75('0x10')](_0xda75('0x11'),_0x36abc3,'request\x20sent',JSON[_0xda75('0x12')](_0x59f01f));if(_0x59f01f[_0xda75('0x13')]){if(_0x59f01f[_0xda75('0x13')][_0xda75('0x14')]===0x1f4){logger['error'](_0xda75('0xf'),_0x36abc3,_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);return _0x40d949(_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);}logger[_0xda75('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x36abc3,_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);return _0x39ecdd(_0x59f01f[_0xda75('0x13')][_0xda75('0x15')]);}else{logger[_0xda75('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x36abc3,_0xda75('0x16'));_0x39ecdd(_0x59f01f['result']['message']);}})['catch'](function(_0x2918f3){logger[_0xda75('0x13')](_0xda75('0xf'),_0x36abc3,_0x2918f3);_0x40d949(_0x2918f3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3ce233e..c8cdd6e 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 _0x67f5=['/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1c2cd7,_0x4ec333){var _0x2a46f9=function(_0x46bd9c){while(--_0x46bd9c){_0x1c2cd7['push'](_0x1c2cd7['shift']());}};_0x2a46f9(++_0x4ec333);}(_0x67f5,0x99));var _0x567f=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x67f5[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x567f('0x0'));var util=require(_0x567f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x567f('0x2'));var router=express[_0x567f('0x3')]();var auth=require(_0x567f('0x4'));var interaction=require(_0x567f('0x5'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x567f('0x6')](_0x567f('0x7'),auth['isAuthenticated'](),controller[_0x567f('0x8')]);router[_0x567f('0x9')]('/',auth[_0x567f('0xa')](),controller['create']);router[_0x567f('0xb')](_0x567f('0x7'),auth[_0x567f('0xa')](),controller[_0x567f('0xc')]);router[_0x567f('0xd')](_0x567f('0x7'),auth[_0x567f('0xa')](),controller[_0x567f('0xe')]);module[_0x567f('0xf')]=router; \ No newline at end of file +var _0x078c=['/:id','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post','create','put','update'];(function(_0x5358a5,_0x3b3843){var _0x1f1ef0=function(_0x28e800){while(--_0x28e800){_0x5358a5['push'](_0x5358a5['shift']());}};_0x1f1ef0(++_0x3b3843);}(_0x078c,0xa5));var _0xc078=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x078c[_0x25b4a4];return _0x707267;};'use strict';var multer=require('multer');var util=require(_0xc078('0x0'));var path=require(_0xc078('0x1'));var timeout=require(_0xc078('0x2'));var express=require(_0xc078('0x3'));var router=express['Router']();var auth=require(_0xc078('0x4'));var interaction=require(_0xc078('0x5'));var config=require(_0xc078('0x6'));var controller=require(_0xc078('0x7'));router[_0xc078('0x8')]('/:id',auth[_0xc078('0x9')](),controller[_0xc078('0xa')]);router[_0xc078('0xb')]('/',auth[_0xc078('0x9')](),controller[_0xc078('0xc')]);router[_0xc078('0xd')]('/:id',auth[_0xc078('0x9')](),controller[_0xc078('0xe')]);router['delete'](_0xc078('0xf'),auth[_0xc078('0x9')](),controller[_0xc078('0x10')]);module[_0xc078('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ab587f1..711f7c8 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 _0x25cc=['STRING','INTEGER','ENUM','rrmemory','exports'];(function(_0x4815f4,_0x17ad21){var _0x33b6b2=function(_0x53a917){while(--_0x53a917){_0x4815f4['push'](_0x4815f4['shift']());}};_0x33b6b2(++_0x17ad21);}(_0x25cc,0xe5));var _0xc25c=function(_0x4e897e,_0x5970fe){_0x4e897e=_0x4e897e-0x0;var _0x5d39cc=_0x25cc[_0x4e897e];return _0x5d39cc;};'use strict';var Sequelize=require('sequelize');module[_0xc25c('0x0')]={'name':{'type':Sequelize[_0xc25c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc25c('0x1')]},'timeout':{'type':Sequelize[_0xc25c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc25c('0x3')](_0xc25c('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x072f=['beepall','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x2d447b,_0x3e0215){var _0x14106a=function(_0x6388){while(--_0x6388){_0x2d447b['push'](_0x2d447b['shift']());}};_0x14106a(++_0x3e0215);}(_0x072f,0xb0));var _0xf072=function(_0x35daba,_0x38f48f){_0x35daba=_0x35daba-0x0;var _0x57971a=_0x072f[_0x35daba];return _0x57971a;};'use strict';var Sequelize=require(_0xf072('0x0'));module[_0xf072('0x1')]={'name':{'type':Sequelize[_0xf072('0x2')],'unique':_0xf072('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf072('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf072('0x4')](_0xf072('0x5'),_0xf072('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9ced591..4101c20 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 _0xfb4e=['omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','map','VIRTUAL','ChatQueue','includeAll','include','findAll','rows','length','options','find','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','findOne','hasOwnProperty','pick','ChatQueueId','filter','User','agent','chatPause','updatedAt','createdAt','format','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','UserChatQueue','findOrCreate','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','union','compact','transaction','removeAgents','userChatQueue:remove','addAgents'];(function(_0x401e64,_0x213090){var _0x216dcc=function(_0x12d88a){while(--_0x12d88a){_0x401e64['push'](_0x401e64['shift']());}};_0x216dcc(++_0x213090);}(_0xfb4e,0x1bd));var _0xefb4=function(_0x144035,_0x571993){_0x144035=_0x144035-0x0;var _0x518a5b=_0xfb4e[_0x144035];return _0x518a5b;};'use strict';var pdf=require(_0xefb4('0x0'));var emlformat=require(_0xefb4('0x1'));var rimraf=require(_0xefb4('0x2'));var zipdir=require(_0xefb4('0x3'));var jsonpatch=require(_0xefb4('0x4'));var rp=require('request-promise');var moment=require(_0xefb4('0x5'));var BPromise=require(_0xefb4('0x6'));var Mustache=require(_0xefb4('0x7'));var util=require(_0xefb4('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xefb4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefb4('0xa'));var squel=require(_0xefb4('0xb'));var crypto=require(_0xefb4('0xc'));var jsforce=require(_0xefb4('0xd'));var deskjs=require(_0xefb4('0xe'));var toCsv=require(_0xefb4('0x9'));var querystring=require(_0xefb4('0xf'));var Papa=require(_0xefb4('0x10'));var Redis=require(_0xefb4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xefb4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefb4('0x13'));var logger=require(_0xefb4('0x14'))('api');var utils=require(_0xefb4('0x15'));var config=require(_0xefb4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xefb4('0x17'))['db'];config[_0xefb4('0x18')]=_[_0xefb4('0x19')](config[_0xefb4('0x18')],{'host':_0xefb4('0x1a'),'port':0x18eb});var socket=require(_0xefb4('0x1b'))(new Redis(config[_0xefb4('0x18')]));require(_0xefb4('0x1c'))[_0xefb4('0x1d')](socket);var jayson=require(_0xefb4('0x1e'));var client=jayson[_0xefb4('0x1f')][_0xefb4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x45f0fd,_0x407a8b,_0x474f14,_0x3782ec){return new BPromise(function(_0x5e1222,_0x11a773){var _0x4a3095=_0x3782ec||client;return _0x4a3095['request'](_0x45f0fd,_0x474f14)[_0xefb4('0x21')](function(_0x1b5fda){logger[_0xefb4('0x22')](_0xefb4('0x23'),_0x407a8b,_0xefb4('0x24'));logger[_0xefb4('0x25')](_0xefb4('0x26'),_0x407a8b,_0xefb4('0x24'),JSON[_0xefb4('0x27')](_0x1b5fda));if(_0x1b5fda[_0xefb4('0x28')]){if(_0x1b5fda[_0xefb4('0x28')][_0xefb4('0x29')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x407a8b,_0x1b5fda[_0xefb4('0x28')][_0xefb4('0x2a')]);return _0x11a773(_0x1b5fda[_0xefb4('0x28')][_0xefb4('0x2a')]);}logger[_0xefb4('0x28')](_0xefb4('0x23'),_0x407a8b,_0x1b5fda['error'][_0xefb4('0x2a')]);return _0x5e1222(_0x1b5fda[_0xefb4('0x28')]['message']);}else{logger[_0xefb4('0x22')]('ChatQueue,\x20%s,\x20%s',_0x407a8b,_0xefb4('0x24'));_0x5e1222(_0x1b5fda[_0xefb4('0x2b')][_0xefb4('0x2a')]);}})[_0xefb4('0x2c')](function(_0x8e2705){logger[_0xefb4('0x28')](_0xefb4('0x23'),_0x407a8b,_0x8e2705);_0x11a773(_0x8e2705);});});}function respondWithStatusCode(_0x490ead,_0x35b6bc){_0x35b6bc=_0x35b6bc||0xcc;return function(_0x33d168){if(_0x33d168){return _0x490ead['sendStatus'](_0x35b6bc);}return _0x490ead[_0xefb4('0x2d')](_0x35b6bc)[_0xefb4('0x2e')]();};}function respondWithResult(_0x14b1ac,_0x45ef7a){_0x45ef7a=_0x45ef7a||0xc8;return function(_0x151514){if(_0x151514){return _0x14b1ac[_0xefb4('0x2d')](_0x45ef7a)[_0xefb4('0x2f')](_0x151514);}};}function respondWithFilteredResult(_0x174f65,_0x8d5511){return function(_0x2b70ca){if(_0x2b70ca){var _0xda7079=_0x2b70ca[_0xefb4('0x30')],_0x4ce943=_0x8d5511['offset'],_0x158e67=_0x8d5511[_0xefb4('0x31')]+_0x8d5511[_0xefb4('0x32')],_0x46c6ac;if(_0x158e67>=_0xda7079){_0x158e67=_0xda7079;_0x46c6ac=0xc8;}else{_0x46c6ac=0xce;}_0x174f65[_0xefb4('0x2d')](_0x46c6ac);return _0x174f65['set']('Content-Range',_0x4ce943+'-'+_0x158e67+'/'+_0xda7079)[_0xefb4('0x2f')](_0x2b70ca);}return null;};}function patchUpdates(_0x158353){return function(_0x4b6810){try{jsonpatch[_0xefb4('0x33')](_0x4b6810,_0x158353,!![]);}catch(_0x5b0348){return BPromise[_0xefb4('0x34')](_0x5b0348);}return _0x4b6810[_0xefb4('0x35')]();};}function saveUpdates(_0x1e3722,_0x55d136){return function(_0x28482f){if(_0x28482f){return _0x28482f[_0xefb4('0x36')](_0x1e3722)[_0xefb4('0x21')](function(_0x12f582){return _0x12f582;});}return null;};}function removeEntity(_0x5e7b51,_0x3ce981){return function(_0x561708){if(_0x561708){return _0x561708[_0xefb4('0x37')]()[_0xefb4('0x21')](function(){var _0x11a13c=_0x561708['get']({'plain':!![]});var _0x5e288f=_0xefb4('0x38');return db[_0xefb4('0x39')][_0xefb4('0x37')]({'where':{'type':_0x5e288f,'resourceId':_0x11a13c['id']}})[_0xefb4('0x21')](function(){return _0x561708;});})[_0xefb4('0x21')](function(){_0x5e7b51['status'](0xcc)[_0xefb4('0x2e')]();});}};}function handleEntityNotFound(_0x126a37,_0x2bdcf9){return function(_0x1f5978){if(!_0x1f5978){_0x126a37['sendStatus'](0x194);}return _0x1f5978;};}function handleError(_0x2de95b,_0x64f726){_0x64f726=_0x64f726||0x1f4;return function(_0x44db0c){logger[_0xefb4('0x28')](_0x44db0c[_0xefb4('0x3a')]);if(_0x44db0c[_0xefb4('0x3b')]){delete _0x44db0c[_0xefb4('0x3b')];}_0x2de95b[_0xefb4('0x2d')](_0x64f726)[_0xefb4('0x3c')](_0x44db0c);};}exports[_0xefb4('0x3d')]=function(_0x34908c,_0x3d8a92){var _0x484df8={},_0x5637a5={},_0x497e37={'count':0x0,'rows':[]};var _0x130113=_['map'](db['ChatQueue'][_0xefb4('0x3e')],function(_0x26d73e){return{'name':_0x26d73e[_0xefb4('0x3f')],'type':_0x26d73e[_0xefb4('0x40')][_0xefb4('0x41')]};});_0x5637a5[_0xefb4('0x42')]=_['map'](_0x130113,_0xefb4('0x3b'));_0x5637a5[_0xefb4('0x43')]=_[_0xefb4('0x44')](_0x34908c['query']);_0x5637a5['filters']=_[_0xefb4('0x45')](_0x5637a5[_0xefb4('0x42')],_0x5637a5[_0xefb4('0x43')]);_0x484df8[_0xefb4('0x46')]=_['intersection'](_0x5637a5['model'],qs[_0xefb4('0x47')](_0x34908c[_0xefb4('0x43')][_0xefb4('0x47')]));_0x484df8['attributes']=_0x484df8[_0xefb4('0x46')]['length']?_0x484df8['attributes']:_0x5637a5[_0xefb4('0x42')];if(!_0x34908c[_0xefb4('0x43')]['hasOwnProperty'](_0xefb4('0x48'))){_0x484df8['limit']=qs[_0xefb4('0x32')](_0x34908c[_0xefb4('0x43')][_0xefb4('0x32')]);_0x484df8[_0xefb4('0x31')]=qs['offset'](_0x34908c[_0xefb4('0x43')][_0xefb4('0x31')]);}_0x484df8[_0xefb4('0x49')]=qs[_0xefb4('0x4a')](_0x34908c[_0xefb4('0x43')][_0xefb4('0x4a')]);_0x484df8[_0xefb4('0x4b')]=qs[_0xefb4('0x4c')](_['pick'](_0x34908c[_0xefb4('0x43')],_0x5637a5['filters']),_0x130113);if(_0x34908c['query']['filter']){_0x484df8[_0xefb4('0x4b')]=_[_0xefb4('0x4d')](_0x484df8[_0xefb4('0x4b')],{'$or':_[_0xefb4('0x4e')](_0x130113,function(_0x400f98){if(_0x400f98[_0xefb4('0x40')]!==_0xefb4('0x4f')){var _0x518b93={};_0x518b93[_0x400f98[_0xefb4('0x3b')]]={'$like':'%'+_0x34908c['query']['filter']+'%'};return _0x518b93;}})});}_0x484df8=_[_0xefb4('0x4d')]({},_0x484df8,_0x34908c['options']);var _0x49af57={'where':_0x484df8[_0xefb4('0x4b')]};return db[_0xefb4('0x50')][_0xefb4('0x30')](_0x49af57)['then'](function(_0x40cd0a){_0x497e37[_0xefb4('0x30')]=_0x40cd0a;if(_0x34908c[_0xefb4('0x43')][_0xefb4('0x51')]){_0x484df8[_0xefb4('0x52')]=[{'all':!![]}];}return db[_0xefb4('0x50')][_0xefb4('0x53')](_0x484df8);})[_0xefb4('0x21')](function(_0x516b54){_0x497e37[_0xefb4('0x54')]=_0x516b54;return _0x497e37;})[_0xefb4('0x21')](respondWithFilteredResult(_0x3d8a92,_0x484df8))['catch'](handleError(_0x3d8a92,null));};exports['show']=function(_0x2b9481,_0x107884){var _0x443405={'raw':!![],'where':{'id':_0x2b9481['params']['id']}},_0x34ae29={};_0x34ae29[_0xefb4('0x42')]=_['keys'](db[_0xefb4('0x50')]['rawAttributes']);_0x34ae29['query']=_[_0xefb4('0x44')](_0x2b9481['query']);_0x34ae29[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x34ae29[_0xefb4('0x42')],_0x34ae29[_0xefb4('0x43')]);_0x443405['attributes']=_[_0xefb4('0x45')](_0x34ae29[_0xefb4('0x42')],qs[_0xefb4('0x47')](_0x2b9481[_0xefb4('0x43')][_0xefb4('0x47')]));_0x443405['attributes']=_0x443405[_0xefb4('0x46')][_0xefb4('0x55')]?_0x443405[_0xefb4('0x46')]:_0x34ae29[_0xefb4('0x42')];if(_0x2b9481[_0xefb4('0x43')][_0xefb4('0x51')]){_0x443405['include']=[{'all':!![]}];}_0x443405=_[_0xefb4('0x4d')]({},_0x443405,_0x2b9481[_0xefb4('0x56')]);return db[_0xefb4('0x50')][_0xefb4('0x57')](_0x443405)[_0xefb4('0x21')](handleEntityNotFound(_0x107884,null))[_0xefb4('0x21')](respondWithResult(_0x107884,null))['catch'](handleError(_0x107884,null));};exports['create']=function(_0x24e46e,_0x4e612e){return db[_0xefb4('0x50')][_0xefb4('0x58')](_0x24e46e[_0xefb4('0x59')],{})[_0xefb4('0x21')](function(_0x246e44){var _0x4a4a9d=_0x24e46e['user'][_0xefb4('0x5a')]({'plain':!![]});if(!_0x4a4a9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a4a9d['role']===_0xefb4('0x5b')){var _0x200a8d=_0x246e44[_0xefb4('0x5a')]({'plain':!![]});var _0x4ce9a1=_0xefb4('0x38');return db[_0xefb4('0x5c')][_0xefb4('0x57')]({'where':{'name':_0x4ce9a1,'userProfileId':_0x4a4a9d[_0xefb4('0x5d')]},'raw':!![]})[_0xefb4('0x21')](function(_0x5abe67){if(_0x5abe67&&_0x5abe67[_0xefb4('0x5e')]===0x0){return db[_0xefb4('0x39')]['create']({'name':_0x200a8d[_0xefb4('0x3b')],'resourceId':_0x200a8d['id'],'type':_0x5abe67[_0xefb4('0x3b')],'sectionId':_0x5abe67['id']},{})[_0xefb4('0x21')](function(){return _0x246e44;});}else{return _0x246e44;}})[_0xefb4('0x2c')](function(_0x5aab90){logger[_0xefb4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aab90);throw _0x5aab90;});}return _0x246e44;})[_0xefb4('0x21')](respondWithResult(_0x4e612e,0xc9))[_0xefb4('0x2c')](handleError(_0x4e612e,null));};exports[_0xefb4('0x36')]=function(_0x32f816,_0x40d383){if(_0x32f816[_0xefb4('0x59')]['id']){delete _0x32f816[_0xefb4('0x59')]['id'];}return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0x32f816['params']['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x40d383,null))[_0xefb4('0x21')](saveUpdates(_0x32f816[_0xefb4('0x59')],null))[_0xefb4('0x21')](respondWithResult(_0x40d383,null))[_0xefb4('0x2c')](handleError(_0x40d383,null));};exports[_0xefb4('0x37')]=function(_0x104460,_0x3125c4){return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0x104460[_0xefb4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3125c4,null))['then'](removeEntity(_0x3125c4,null))[_0xefb4('0x2c')](handleError(_0x3125c4,null));};exports[_0xefb4('0x60')]=function(_0x10f37b,_0x25bbb4){return db['ChatQueue'][_0xefb4('0x60')]()[_0xefb4('0x21')](respondWithResult(_0x25bbb4,null))[_0xefb4('0x2c')](handleError(_0x25bbb4,null));};exports[_0xefb4('0x61')]=function(_0x62c2e4,_0x302f90,_0x3bee64){var _0x2386a1={'raw':!![],'where':{}},_0x22fda6={},_0x483e96;return db[_0xefb4('0x50')][_0xefb4('0x62')]({'where':{'id':_0x62c2e4[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x302f90,null))[_0xefb4('0x21')](function(_0x21f15c){if(_0x21f15c){_0x483e96=_0x21f15c['get']({'plain':!![]});_0x22fda6[_0xefb4('0x42')]=_[_0xefb4('0x44')](db['UserChatQueue'][_0xefb4('0x3e')]);_0x22fda6[_0xefb4('0x43')]=_['keys'](_0x62c2e4[_0xefb4('0x43')]);_0x22fda6[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x22fda6[_0xefb4('0x42')],_0x22fda6['query']);_0x2386a1['attributes']=_[_0xefb4('0x45')](_0x22fda6[_0xefb4('0x42')],qs[_0xefb4('0x47')](_0x62c2e4[_0xefb4('0x43')]['fields']));_0x2386a1['attributes']=_0x2386a1[_0xefb4('0x46')][_0xefb4('0x55')]?_0x2386a1[_0xefb4('0x46')]:_0x22fda6[_0xefb4('0x42')];if(!_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x63')](_0xefb4('0x48'))){_0x2386a1['limit']=qs[_0xefb4('0x32')](_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x32')]);_0x2386a1['offset']=qs[_0xefb4('0x31')](_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x31')]);}_0x2386a1[_0xefb4('0x49')]=qs[_0xefb4('0x4a')](_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x4a')]);_0x2386a1[_0xefb4('0x4b')]=qs[_0xefb4('0x4c')](_[_0xefb4('0x64')](_0x62c2e4[_0xefb4('0x43')],_0x22fda6[_0xefb4('0x4c')]));_0x2386a1['where'][_0xefb4('0x65')]=_0x21f15c['id'];if(_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x66')]){_0x2386a1[_0xefb4('0x4b')]=_['merge'](_0x2386a1['where'],{'$or':_['map'](_0x2386a1[_0xefb4('0x46')],function(_0xcb826a){var _0x33cd7e={};_0x33cd7e[_0xcb826a]={'$like':'%'+_0x62c2e4[_0xefb4('0x43')][_0xefb4('0x66')]+'%'};return _0x33cd7e;})});}_0x2386a1=_[_0xefb4('0x4d')]({},_0x2386a1,_0x62c2e4[_0xefb4('0x56')]);return db['UserChatQueue'][_0xefb4('0x53')](_0x2386a1);}})[_0xefb4('0x21')](function(_0x50e934){if(_0x50e934){return db[_0xefb4('0x67')]['findAndCountAll']({'where':{'id':_[_0xefb4('0x4e')](_0x50e934,'UserId'),'role':_0xefb4('0x68')},'attributes':['id',_0xefb4('0x3b'),_0xefb4('0x69'),_0xefb4('0x6a'),_0xefb4('0x6b')]});}})[_0xefb4('0x21')](function(_0xf85c22){if(_0xf85c22){return{'count':_0xf85c22[_0xefb4('0x30')],'rows':_[_0xefb4('0x4e')](_0xf85c22['rows'],function(_0x2f2de7){return{'membername':_0x2f2de7[_0xefb4('0x3b')],'UserId':_0x2f2de7['id'],'queue_name':_0x483e96['name'],'ChatQueueId':_0x483e96['id'],'interface':util[_0xefb4('0x6c')]('%s/%s','SIP',_0x2f2de7[_0xefb4('0x3b')]),'penalty':0x0,'paused':_0x2f2de7[_0xefb4('0x69')],'createdAt':_0x2f2de7[_0xefb4('0x6b')],'updatedAt':_0x2f2de7[_0xefb4('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xefb4('0x21')](respondWithFilteredResult(_0x302f90,_0x2386a1))[_0xefb4('0x2c')](handleError(_0x302f90,null));};exports[_0xefb4('0x6d')]=function(_0x2bb5e0,_0xffef0a,_0x269e53){var _0x1b3955={};var _0x40d3ce={};var _0x4d46ce;var _0x201152;return db[_0xefb4('0x50')][_0xefb4('0x62')]({'where':{'id':_0x2bb5e0[_0xefb4('0x5f')]['id']}})['then'](handleEntityNotFound(_0xffef0a,null))['then'](function(_0x251943){if(_0x251943){_0x4d46ce=_0x251943;_0x40d3ce['model']=_['keys'](db['Team'][_0xefb4('0x3e')]);_0x40d3ce['query']=_['keys'](_0x2bb5e0[_0xefb4('0x43')]);_0x40d3ce[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x40d3ce[_0xefb4('0x42')],_0x40d3ce['query']);_0x1b3955['attributes']=_[_0xefb4('0x45')](_0x40d3ce[_0xefb4('0x42')],qs[_0xefb4('0x47')](_0x2bb5e0['query'][_0xefb4('0x47')]));_0x1b3955[_0xefb4('0x46')]=_0x1b3955['attributes'][_0xefb4('0x55')]?_0x1b3955['attributes']:_0x40d3ce[_0xefb4('0x42')];_0x1b3955['order']=qs[_0xefb4('0x4a')](_0x2bb5e0['query'][_0xefb4('0x4a')]);_0x1b3955['where']=qs[_0xefb4('0x4c')](_['pick'](_0x2bb5e0[_0xefb4('0x43')],_0x40d3ce['filters']));if(_0x2bb5e0['query']['filter']){_0x1b3955[_0xefb4('0x4b')]=_[_0xefb4('0x4d')](_0x1b3955[_0xefb4('0x4b')],{'$or':_['map'](_0x1b3955['attributes'],function(_0x15bf56){var _0x2793a9={};_0x2793a9[_0x15bf56]={'$like':'%'+_0x2bb5e0[_0xefb4('0x43')][_0xefb4('0x66')]+'%'};return _0x2793a9;})});}_0x1b3955=_['merge']({},_0x1b3955,_0x2bb5e0[_0xefb4('0x56')]);return _0x4d46ce['getTeams'](_0x1b3955);}})[_0xefb4('0x21')](function(_0x384f82){if(_0x384f82){_0x201152=_0x384f82[_0xefb4('0x55')];if(!_0x2bb5e0[_0xefb4('0x43')]['hasOwnProperty'](_0xefb4('0x48'))){_0x1b3955[_0xefb4('0x32')]=qs[_0xefb4('0x32')](_0x2bb5e0['query'][_0xefb4('0x32')]);_0x1b3955[_0xefb4('0x31')]=qs[_0xefb4('0x31')](_0x2bb5e0['query'][_0xefb4('0x31')]);}return _0x4d46ce[_0xefb4('0x6d')](_0x1b3955);}})[_0xefb4('0x21')](function(_0xc8062f){if(_0xc8062f){return _0xc8062f?{'count':_0x201152,'rows':_0xc8062f}:null;}})['then'](respondWithResult(_0xffef0a,null))[_0xefb4('0x2c')](handleError(_0xffef0a,null));};exports[_0xefb4('0x6e')]=function(_0x3e37a8,_0x578330,_0x115388){var _0x28770f=_0x3e37a8[_0xefb4('0x59')][_0xefb4('0x6f')];return db[_0xefb4('0x70')][_0xefb4('0x53')]({'where':{'id':_0x28770f},'attributes':['id'],'include':[{'model':db[_0xefb4('0x67')],'as':_0xefb4('0x71'),'attributes':['id',_0xefb4('0x3b'),'online',_0xefb4('0x72'),'interface'],'raw':!![]}]})[_0xefb4('0x21')](function(_0x14080d){if(_0x14080d){var _0xfd5a61=_[_0xefb4('0x73')](_0x14080d,function(_0xf8efac){var _0x3e9c1d=_0xf8efac[_0xefb4('0x5a')]({'plain':!![]});return _0x3e9c1d[_0xefb4('0x71')];});return db['ChatQueue'][_0xefb4('0x57')]({'where':{'id':_0x3e37a8['params']['id']}})['then'](function(_0x17048f){return db[_0xefb4('0x74')]['transaction'](function(_0x26544a){return _0x17048f[_0xefb4('0x6e')](_0x28770f,{'transaction':_0x26544a})[_0xefb4('0x21')](function(){return BPromise[_0xefb4('0x75')](_0xfd5a61,function(_0x4935b0){return db[_0xefb4('0x76')][_0xefb4('0x77')]({'where':{'UserId':_0x4935b0['id'],'ChatQueueId':_0x3e37a8['params']['id']},'transaction':_0x26544a});});})[_0xefb4('0x21')](function(){_0xfd5a61['forEach'](function(_0x195c71){socket[_0xefb4('0x78')](_0xefb4('0x79'),{'UserId':_0x195c71['id'],'ChatQueueId':_0x17048f['id']});});});});});}})['then'](respondWithStatusCode(_0x578330,null))[_0xefb4('0x2c')](handleError(_0x578330,null));};exports[_0xefb4('0x7a')]=function(_0x681d5e,_0x862911,_0x48e785){return db['Team']['findAll']({'where':{'id':_0x681d5e['query'][_0xefb4('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xefb4('0x21')](handleEntityNotFound(_0x862911,null))[_0xefb4('0x21')](function(_0x5bacb5){var _0x50bf65=_[_0xefb4('0x4e')](_0x5bacb5,'id');var _0x516d96=[];var _0x3ba1e0=[];var _0x24b222=squel[_0xefb4('0x7b')]();_0x24b222['field'](_0xefb4('0x7c'))[_0xefb4('0x7d')]('team_has_chat_queues','tq')[_0xefb4('0x7e')](_0xefb4('0x7f'),'ut',_0xefb4('0x80'))[_0xefb4('0x4b')](_0xefb4('0x81'),_0x681d5e['params']['id']);for(var _0x4d5a14=0x0;_0x4d5a14<_0x5bacb5[_0xefb4('0x55')];_0x4d5a14+=0x1){let _0x5e0a56=_0x5bacb5[_0x4d5a14];for(var _0x2bf79b=0x0;_0x2bf79b<_0x5e0a56[_0xefb4('0x71')][_0xefb4('0x55')];_0x2bf79b+=0x1){let _0x37cf21=_0x5e0a56['Agents'][_0x2bf79b];var _0x2cffd3=_0x24b222[_0xefb4('0x82')]();_0x2cffd3[_0xefb4('0x4b')]('ut.UserId\x20=\x20?',_0x37cf21['id']);_0x3ba1e0[_0xefb4('0x83')](db[_0xefb4('0x74')][_0xefb4('0x43')](_0x2cffd3[_0xefb4('0x84')](),{'type':db[_0xefb4('0x74')][_0xefb4('0x85')][_0xefb4('0x86')]})[_0xefb4('0x21')](function(_0x218424){if(_0x218424['length']===0x1){return _0x37cf21['id'];}else{var _0x5944f5=_[_0xefb4('0x87')](_[_0xefb4('0x4e')](_0x218424,'TeamId'),function(_0x4d4ae9){return _[_0xefb4('0x88')](_0x50bf65,_0x4d4ae9);});if(_0x5944f5){return _0x37cf21['id'];}}}));}}return BPromise['all'](_0x3ba1e0)[_0xefb4('0x21')](function(_0x835640){_0x516d96=_(_0x516d96)[_0xefb4('0x89')](_0x835640)[_0xefb4('0x8a')]()['value']();return db['ChatQueue'][_0xefb4('0x57')]({'where':{'id':_0x681d5e[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](function(_0x3276f8){return db[_0xefb4('0x74')][_0xefb4('0x8b')](function(_0x2e8e59){return _0x3276f8[_0xefb4('0x7a')](_0x681d5e[_0xefb4('0x43')][_0xefb4('0x6f')],{'transaction':_0x2e8e59})[_0xefb4('0x21')](function(){if(!_['isEmpty'](_0x516d96)){return _0x3276f8[_0xefb4('0x8c')](_0x516d96,{'transaction':_0x2e8e59});}})[_0xefb4('0x21')](function(){_0x516d96['forEach'](function(_0x39926f){socket[_0xefb4('0x78')](_0xefb4('0x8d'),{'UserId':_0x39926f,'ChatQueueId':_0x3276f8['id']});});});});});});})[_0xefb4('0x21')](respondWithStatusCode(_0x862911,null))[_0xefb4('0x2c')](handleError(_0x862911,null));};exports[_0xefb4('0x8e')]=function(_0x1a3201,_0x3f6c06,_0x1a2161){return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0x1a3201[_0xefb4('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3f6c06,null))['then'](function(_0x184a38){if(_0x184a38){return _0x184a38[_0xefb4('0x8e')](_0x1a3201[_0xefb4('0x59')]['ids'],_[_0xefb4('0x8f')](_0x1a3201['body'],['ids','id'])||{})[_0xefb4('0x90')](function(_0x13315b){for(var _0x3c4d78=0x0;_0x3c4d78<_0x1a3201['body']['ids'][_0xefb4('0x55')];_0x3c4d78+=0x1){socket[_0xefb4('0x78')](_0xefb4('0x79'),{'UserId':_0x1a3201['body'][_0xefb4('0x6f')][_0x3c4d78],'ChatQueueId':_0x1a3201[_0xefb4('0x5f')]['id']});}return _0x13315b;});}})[_0xefb4('0x21')](respondWithResult(_0x3f6c06,null))[_0xefb4('0x2c')](handleError(_0x3f6c06,null));};exports['removeAgents']=function(_0xe8481f,_0x349d19,_0x5203e5){return db[_0xefb4('0x50')][_0xefb4('0x57')]({'where':{'id':_0xe8481f[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x349d19,null))[_0xefb4('0x21')](function(_0x442ccf){if(_0x442ccf){return _0x442ccf['removeAgents'](_0xe8481f[_0xefb4('0x43')][_0xefb4('0x6f')])['then'](function(){if(_[_0xefb4('0x91')](_0xe8481f['query'][_0xefb4('0x6f')])){for(var _0x545f65=0x0;_0x545f65<_0xe8481f[_0xefb4('0x43')]['ids']['length'];_0x545f65+=0x1){socket['emit'](_0xefb4('0x8d'),{'UserId':Number(_0xe8481f['query'][_0xefb4('0x6f')][_0x545f65]),'ChatQueueId':Number(_0xe8481f[_0xefb4('0x5f')]['id'])});}}else{socket[_0xefb4('0x78')](_0xefb4('0x8d'),{'UserId':Number(_0xe8481f[_0xefb4('0x43')][_0xefb4('0x6f')]),'ChatQueueId':Number(_0xe8481f[_0xefb4('0x5f')]['id'])});}});}})[_0xefb4('0x21')](respondWithStatusCode(_0x349d19,null))[_0xefb4('0x2c')](handleError(_0x349d19,null));};exports['getAgents']=function(_0x2298d4,_0x3a2002,_0x5b235e){var _0x571ee4={};var _0x2ce672={};var _0x45af55;var _0x343d18;return db[_0xefb4('0x50')][_0xefb4('0x62')]({'where':{'id':_0x2298d4[_0xefb4('0x5f')]['id']}})[_0xefb4('0x21')](handleEntityNotFound(_0x3a2002,null))['then'](function(_0x2eb177){if(_0x2eb177){_0x45af55=_0x2eb177;_0x2ce672[_0xefb4('0x42')]=_[_0xefb4('0x44')](db['User'][_0xefb4('0x3e')]);_0x2ce672[_0xefb4('0x43')]=_[_0xefb4('0x44')](_0x2298d4[_0xefb4('0x43')]);_0x2ce672[_0xefb4('0x4c')]=_[_0xefb4('0x45')](_0x2ce672[_0xefb4('0x42')],_0x2ce672[_0xefb4('0x43')]);_0x571ee4[_0xefb4('0x46')]=_[_0xefb4('0x45')](_0x2ce672['model'],qs['fields'](_0x2298d4['query'][_0xefb4('0x47')]));_0x571ee4[_0xefb4('0x46')]=_0x571ee4[_0xefb4('0x46')]['length']?_0x571ee4[_0xefb4('0x46')]:_0x2ce672[_0xefb4('0x42')];_0x571ee4['order']=qs['sort'](_0x2298d4[_0xefb4('0x43')][_0xefb4('0x4a')]);_0x571ee4['where']=qs[_0xefb4('0x4c')](_[_0xefb4('0x64')](_0x2298d4[_0xefb4('0x43')],_0x2ce672[_0xefb4('0x4c')]));if(_0x2298d4['query'][_0xefb4('0x66')]){_0x571ee4[_0xefb4('0x4b')]=_[_0xefb4('0x4d')](_0x571ee4[_0xefb4('0x4b')],{'$or':_['map'](_0x571ee4[_0xefb4('0x46')],function(_0x55222c){var _0xf62ad1={};_0xf62ad1[_0x55222c]={'$like':'%'+_0x2298d4[_0xefb4('0x43')][_0xefb4('0x66')]+'%'};return _0xf62ad1;})});}_0x571ee4=_[_0xefb4('0x4d')]({},_0x571ee4,_0x2298d4[_0xefb4('0x56')]);return _0x45af55[_0xefb4('0x92')](_0x571ee4);}})[_0xefb4('0x21')](function(_0x502ccd){if(_0x502ccd){_0x343d18=_0x502ccd['length'];if(!_0x2298d4[_0xefb4('0x43')][_0xefb4('0x63')](_0xefb4('0x48'))){_0x571ee4['limit']=qs[_0xefb4('0x32')](_0x2298d4['query']['limit']);_0x571ee4[_0xefb4('0x31')]=qs[_0xefb4('0x31')](_0x2298d4[_0xefb4('0x43')]['offset']);}return _0x45af55[_0xefb4('0x92')](_0x571ee4);}})['then'](function(_0x56dd63){if(_0x56dd63){return _0x56dd63?{'count':_0x343d18,'rows':_0x56dd63}:null;}})[_0xefb4('0x21')](respondWithResult(_0x3a2002,null))['catch'](handleError(_0x3a2002,null));}; \ No newline at end of file +var _0x2d1b=['code','ChatQueue,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','set','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','map','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatQueue','count','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','ids','Team','Agents','voicePause','interface','sequelize','addTeams','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','transaction','isEmpty','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2d1b,0x71));var _0xb2d1=function(_0x19980b,_0xd37e12){_0x19980b=_0x19980b-0x0;var _0x33fac3=_0x2d1b[_0x19980b];return _0x33fac3;};'use strict';var pdf=require(_0xb2d1('0x0'));var emlformat=require(_0xb2d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb2d1('0x2'));var jsonpatch=require(_0xb2d1('0x3'));var rp=require(_0xb2d1('0x4'));var moment=require(_0xb2d1('0x5'));var BPromise=require(_0xb2d1('0x6'));var Mustache=require(_0xb2d1('0x7'));var util=require(_0xb2d1('0x8'));var path=require(_0xb2d1('0x9'));var sox=require('sox');var csv=require(_0xb2d1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2d1('0xb'));var squel=require(_0xb2d1('0xc'));var crypto=require(_0xb2d1('0xd'));var jsforce=require(_0xb2d1('0xe'));var deskjs=require(_0xb2d1('0xf'));var toCsv=require(_0xb2d1('0xa'));var querystring=require(_0xb2d1('0x10'));var Papa=require(_0xb2d1('0x11'));var Redis=require(_0xb2d1('0x12'));var authService=require(_0xb2d1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb2d1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2d1('0x15'))(_0xb2d1('0x16'));var utils=require(_0xb2d1('0x17'));var config=require(_0xb2d1('0x18'));var licenseUtil=require(_0xb2d1('0x19'));var db=require(_0xb2d1('0x1a'))['db'];config[_0xb2d1('0x1b')]=_['defaults'](config['redis'],{'host':_0xb2d1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2d1('0x1b')]));require('./chatQueue.socket')[_0xb2d1('0x1d')](socket);var jayson=require(_0xb2d1('0x1e'));var client=jayson[_0xb2d1('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd418db,_0x2df977,_0x1f7332,_0x4311da){return new BPromise(function(_0x399692,_0x1adf2a){var _0x5cd905=_0x4311da||client;return _0x5cd905[_0xb2d1('0x20')](_0xd418db,_0x1f7332)[_0xb2d1('0x21')](function(_0x5dedd2){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2df977,_0xb2d1('0x22'));logger[_0xb2d1('0x23')](_0xb2d1('0x24'),_0x2df977,_0xb2d1('0x22'),JSON[_0xb2d1('0x25')](_0x5dedd2));if(_0x5dedd2[_0xb2d1('0x26')]){if(_0x5dedd2['error'][_0xb2d1('0x27')]===0x1f4){logger[_0xb2d1('0x26')](_0xb2d1('0x28'),_0x2df977,_0x5dedd2[_0xb2d1('0x26')]['message']);return _0x1adf2a(_0x5dedd2[_0xb2d1('0x26')][_0xb2d1('0x29')]);}logger[_0xb2d1('0x26')]('ChatQueue,\x20%s,\x20%s',_0x2df977,_0x5dedd2[_0xb2d1('0x26')]['message']);return _0x399692(_0x5dedd2[_0xb2d1('0x26')]['message']);}else{logger['info'](_0xb2d1('0x28'),_0x2df977,_0xb2d1('0x22'));_0x399692(_0x5dedd2['result'][_0xb2d1('0x29')]);}})[_0xb2d1('0x2a')](function(_0x5878a3){logger['error'](_0xb2d1('0x28'),_0x2df977,_0x5878a3);_0x1adf2a(_0x5878a3);});});}function respondWithStatusCode(_0x5b2f0b,_0x228bd2){_0x228bd2=_0x228bd2||0xcc;return function(_0x56a7fb){if(_0x56a7fb){return _0x5b2f0b['sendStatus'](_0x228bd2);}return _0x5b2f0b[_0xb2d1('0x2b')](_0x228bd2)[_0xb2d1('0x2c')]();};}function respondWithResult(_0x5c6ce1,_0x486b80){_0x486b80=_0x486b80||0xc8;return function(_0x29e810){if(_0x29e810){return _0x5c6ce1['status'](_0x486b80)[_0xb2d1('0x2d')](_0x29e810);}};}function respondWithFilteredResult(_0x2a9b95,_0x23cf2a){return function(_0x4ee25c){if(_0x4ee25c){var _0x3465a1=_0x4ee25c['count'],_0x7c701=_0x23cf2a[_0xb2d1('0x2e')],_0x242a3f=_0x23cf2a[_0xb2d1('0x2e')]+_0x23cf2a[_0xb2d1('0x2f')],_0x559b09;if(_0x242a3f>=_0x3465a1){_0x242a3f=_0x3465a1;_0x559b09=0xc8;}else{_0x559b09=0xce;}_0x2a9b95[_0xb2d1('0x2b')](_0x559b09);return _0x2a9b95[_0xb2d1('0x30')]('Content-Range',_0x7c701+'-'+_0x242a3f+'/'+_0x3465a1)[_0xb2d1('0x2d')](_0x4ee25c);}return null;};}function patchUpdates(_0x5cc646){return function(_0x1cd608){try{jsonpatch[_0xb2d1('0x31')](_0x1cd608,_0x5cc646,!![]);}catch(_0xd01992){return BPromise[_0xb2d1('0x32')](_0xd01992);}return _0x1cd608[_0xb2d1('0x33')]();};}function saveUpdates(_0x173f94,_0x280e63){return function(_0x2dc276){if(_0x2dc276){return _0x2dc276[_0xb2d1('0x34')](_0x173f94)[_0xb2d1('0x21')](function(_0x40a733){return _0x40a733;});}return null;};}function removeEntity(_0xda479c,_0x545ca5){return function(_0x334c50){if(_0x334c50){return _0x334c50[_0xb2d1('0x35')]()[_0xb2d1('0x21')](function(){var _0x304157=_0x334c50['get']({'plain':!![]});var _0xbe366d=_0xb2d1('0x36');return db[_0xb2d1('0x37')][_0xb2d1('0x35')]({'where':{'type':_0xbe366d,'resourceId':_0x304157['id']}})[_0xb2d1('0x21')](function(){return _0x334c50;});})[_0xb2d1('0x21')](function(){_0xda479c[_0xb2d1('0x2b')](0xcc)[_0xb2d1('0x2c')]();});}};}function handleEntityNotFound(_0x415b37,_0x560f2b){return function(_0x5d417d){if(!_0x5d417d){_0x415b37[_0xb2d1('0x38')](0x194);}return _0x5d417d;};}function handleError(_0x57f066,_0x4e6106){_0x4e6106=_0x4e6106||0x1f4;return function(_0x2ebc56){logger['error'](_0x2ebc56[_0xb2d1('0x39')]);if(_0x2ebc56[_0xb2d1('0x3a')]){delete _0x2ebc56['name'];}_0x57f066['status'](_0x4e6106)[_0xb2d1('0x3b')](_0x2ebc56);};}exports[_0xb2d1('0x3c')]=function(_0x48d992,_0x1a07c2){var _0x38dc62={},_0x49e405={},_0x69d340={'count':0x0,'rows':[]};var _0x62eb27=_[_0xb2d1('0x3d')](db['ChatQueue']['rawAttributes'],function(_0x18ece2){return{'name':_0x18ece2['fieldName'],'type':_0x18ece2[_0xb2d1('0x3e')]['key']};});_0x49e405['model']=_[_0xb2d1('0x3d')](_0x62eb27,_0xb2d1('0x3a'));_0x49e405[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x48d992['query']);_0x49e405['filters']=_[_0xb2d1('0x41')](_0x49e405[_0xb2d1('0x42')],_0x49e405[_0xb2d1('0x3f')]);_0x38dc62[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x49e405[_0xb2d1('0x42')],qs[_0xb2d1('0x44')](_0x48d992[_0xb2d1('0x3f')]['fields']));_0x38dc62[_0xb2d1('0x43')]=_0x38dc62[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x38dc62[_0xb2d1('0x43')]:_0x49e405[_0xb2d1('0x42')];if(!_0x48d992['query'][_0xb2d1('0x46')](_0xb2d1('0x47'))){_0x38dc62[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x2f')]);_0x38dc62['offset']=qs[_0xb2d1('0x2e')](_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x2e')]);}_0x38dc62['order']=qs[_0xb2d1('0x48')](_0x48d992['query'][_0xb2d1('0x48')]);_0x38dc62[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x48d992[_0xb2d1('0x3f')],_0x49e405['filters']),_0x62eb27);if(_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x4c')]){_0x38dc62[_0xb2d1('0x49')]=_[_0xb2d1('0x4d')](_0x38dc62[_0xb2d1('0x49')],{'$or':_[_0xb2d1('0x3d')](_0x62eb27,function(_0x1ca967){if(_0x1ca967[_0xb2d1('0x3e')]!==_0xb2d1('0x4e')){var _0x4dfd38={};_0x4dfd38[_0x1ca967[_0xb2d1('0x3a')]]={'$like':'%'+_0x48d992[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0x4dfd38;}})});}_0x38dc62=_[_0xb2d1('0x4d')]({},_0x38dc62,_0x48d992[_0xb2d1('0x4f')]);var _0x6bc61={'where':_0x38dc62['where']};return db[_0xb2d1('0x50')]['count'](_0x6bc61)[_0xb2d1('0x21')](function(_0x3525f8){_0x69d340[_0xb2d1('0x51')]=_0x3525f8;if(_0x48d992[_0xb2d1('0x3f')]['includeAll']){_0x38dc62[_0xb2d1('0x52')]=[{'all':!![]}];}return db[_0xb2d1('0x50')][_0xb2d1('0x53')](_0x38dc62);})[_0xb2d1('0x21')](function(_0x2a162a){_0x69d340[_0xb2d1('0x54')]=_0x2a162a;return _0x69d340;})['then'](respondWithFilteredResult(_0x1a07c2,_0x38dc62))['catch'](handleError(_0x1a07c2,null));};exports[_0xb2d1('0x55')]=function(_0x3897bc,_0x14942f){var _0x4e5458={'raw':!![],'where':{'id':_0x3897bc[_0xb2d1('0x56')]['id']}},_0x4ccd1f={};_0x4ccd1f[_0xb2d1('0x42')]=_[_0xb2d1('0x40')](db['ChatQueue'][_0xb2d1('0x57')]);_0x4ccd1f['query']=_[_0xb2d1('0x40')](_0x3897bc[_0xb2d1('0x3f')]);_0x4ccd1f[_0xb2d1('0x4a')]=_[_0xb2d1('0x41')](_0x4ccd1f[_0xb2d1('0x42')],_0x4ccd1f[_0xb2d1('0x3f')]);_0x4e5458[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x4ccd1f[_0xb2d1('0x42')],qs[_0xb2d1('0x44')](_0x3897bc[_0xb2d1('0x3f')][_0xb2d1('0x44')]));_0x4e5458[_0xb2d1('0x43')]=_0x4e5458['attributes'][_0xb2d1('0x45')]?_0x4e5458[_0xb2d1('0x43')]:_0x4ccd1f['model'];if(_0x3897bc[_0xb2d1('0x3f')][_0xb2d1('0x58')]){_0x4e5458[_0xb2d1('0x52')]=[{'all':!![]}];}_0x4e5458=_[_0xb2d1('0x4d')]({},_0x4e5458,_0x3897bc[_0xb2d1('0x4f')]);return db[_0xb2d1('0x50')][_0xb2d1('0x59')](_0x4e5458)[_0xb2d1('0x21')](handleEntityNotFound(_0x14942f,null))[_0xb2d1('0x21')](respondWithResult(_0x14942f,null))[_0xb2d1('0x2a')](handleError(_0x14942f,null));};exports[_0xb2d1('0x5a')]=function(_0x3e397b,_0x5d38fb){return db[_0xb2d1('0x50')]['create'](_0x3e397b[_0xb2d1('0x5b')],{})['then'](function(_0x51d04e){var _0x2c0447=_0x3e397b['user'][_0xb2d1('0x5c')]({'plain':!![]});if(!_0x2c0447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c0447[_0xb2d1('0x5d')]===_0xb2d1('0x5e')){var _0x582154=_0x51d04e[_0xb2d1('0x5c')]({'plain':!![]});var _0x4b9a56=_0xb2d1('0x36');return db[_0xb2d1('0x5f')][_0xb2d1('0x59')]({'where':{'name':_0x4b9a56,'userProfileId':_0x2c0447[_0xb2d1('0x60')]},'raw':!![]})[_0xb2d1('0x21')](function(_0x4d9a22){if(_0x4d9a22&&_0x4d9a22[_0xb2d1('0x61')]===0x0){return db[_0xb2d1('0x37')][_0xb2d1('0x5a')]({'name':_0x582154[_0xb2d1('0x3a')],'resourceId':_0x582154['id'],'type':_0x4d9a22[_0xb2d1('0x3a')],'sectionId':_0x4d9a22['id']},{})[_0xb2d1('0x21')](function(){return _0x51d04e;});}else{return _0x51d04e;}})[_0xb2d1('0x2a')](function(_0x572eff){logger[_0xb2d1('0x26')](_0xb2d1('0x62'),_0x572eff);throw _0x572eff;});}return _0x51d04e;})['then'](respondWithResult(_0x5d38fb,0xc9))[_0xb2d1('0x2a')](handleError(_0x5d38fb,null));};exports[_0xb2d1('0x34')]=function(_0x50b2fc,_0x31b293){if(_0x50b2fc[_0xb2d1('0x5b')]['id']){delete _0x50b2fc[_0xb2d1('0x5b')]['id'];}return db[_0xb2d1('0x50')]['find']({'where':{'id':_0x50b2fc[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x31b293,null))[_0xb2d1('0x21')](saveUpdates(_0x50b2fc[_0xb2d1('0x5b')],null))[_0xb2d1('0x21')](respondWithResult(_0x31b293,null))[_0xb2d1('0x2a')](handleError(_0x31b293,null));};exports['destroy']=function(_0x4fc9b3,_0xc9929c){return db[_0xb2d1('0x50')][_0xb2d1('0x59')]({'where':{'id':_0x4fc9b3['params']['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0xc9929c,null))[_0xb2d1('0x21')](removeEntity(_0xc9929c,null))[_0xb2d1('0x2a')](handleError(_0xc9929c,null));};exports[_0xb2d1('0x63')]=function(_0x220204,_0x695947){return db[_0xb2d1('0x50')][_0xb2d1('0x63')]()[_0xb2d1('0x21')](respondWithResult(_0x695947,null))[_0xb2d1('0x2a')](handleError(_0x695947,null));};exports[_0xb2d1('0x64')]=function(_0x3413ab,_0x49e60a,_0x17d744){var _0x191089={'raw':!![],'where':{}},_0x480597={},_0x3048db;return db[_0xb2d1('0x50')][_0xb2d1('0x65')]({'where':{'id':_0x3413ab[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x49e60a,null))['then'](function(_0x29fcf8){if(_0x29fcf8){_0x3048db=_0x29fcf8['get']({'plain':!![]});_0x480597[_0xb2d1('0x42')]=_[_0xb2d1('0x40')](db[_0xb2d1('0x66')][_0xb2d1('0x57')]);_0x480597[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x3413ab[_0xb2d1('0x3f')]);_0x480597[_0xb2d1('0x4a')]=_[_0xb2d1('0x41')](_0x480597['model'],_0x480597[_0xb2d1('0x3f')]);_0x191089[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x480597['model'],qs['fields'](_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x44')]));_0x191089[_0xb2d1('0x43')]=_0x191089[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x191089['attributes']:_0x480597[_0xb2d1('0x42')];if(!_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x46')]('nolimit')){_0x191089[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x2f')]);_0x191089[_0xb2d1('0x2e')]=qs['offset'](_0x3413ab[_0xb2d1('0x3f')]['offset']);}_0x191089[_0xb2d1('0x67')]=qs['sort'](_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x48')]);_0x191089[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x3413ab[_0xb2d1('0x3f')],_0x480597[_0xb2d1('0x4a')]));_0x191089['where'][_0xb2d1('0x68')]=_0x29fcf8['id'];if(_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x4c')]){_0x191089['where']=_[_0xb2d1('0x4d')](_0x191089[_0xb2d1('0x49')],{'$or':_[_0xb2d1('0x3d')](_0x191089[_0xb2d1('0x43')],function(_0x42ef2){var _0x1fb469={};_0x1fb469[_0x42ef2]={'$like':'%'+_0x3413ab[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0x1fb469;})});}_0x191089=_['merge']({},_0x191089,_0x3413ab[_0xb2d1('0x4f')]);return db['UserChatQueue'][_0xb2d1('0x53')](_0x191089);}})[_0xb2d1('0x21')](function(_0x1c76a0){if(_0x1c76a0){return db[_0xb2d1('0x69')][_0xb2d1('0x6a')]({'where':{'id':_[_0xb2d1('0x3d')](_0x1c76a0,_0xb2d1('0x6b')),'role':'agent'},'attributes':['id','name','chatPause',_0xb2d1('0x6c'),_0xb2d1('0x6d')]});}})[_0xb2d1('0x21')](function(_0x2af75a){if(_0x2af75a){return{'count':_0x2af75a['count'],'rows':_['map'](_0x2af75a[_0xb2d1('0x54')],function(_0x113dfb){return{'membername':_0x113dfb[_0xb2d1('0x3a')],'UserId':_0x113dfb['id'],'queue_name':_0x3048db[_0xb2d1('0x3a')],'ChatQueueId':_0x3048db['id'],'interface':util[_0xb2d1('0x6e')](_0xb2d1('0x6f'),'SIP',_0x113dfb['name']),'penalty':0x0,'paused':_0x113dfb[_0xb2d1('0x70')],'createdAt':_0x113dfb['createdAt'],'updatedAt':_0x113dfb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x49e60a,_0x191089))['catch'](handleError(_0x49e60a,null));};exports[_0xb2d1('0x71')]=function(_0x35dd9b,_0x433f1c,_0x45ad71){var _0x3dbc66={};var _0x433f33={};var _0x9eddb5;var _0xb0e406;return db[_0xb2d1('0x50')][_0xb2d1('0x65')]({'where':{'id':_0x35dd9b[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x433f1c,null))[_0xb2d1('0x21')](function(_0x457ede){if(_0x457ede){_0x9eddb5=_0x457ede;_0x433f33[_0xb2d1('0x42')]=_[_0xb2d1('0x40')](db['Team'][_0xb2d1('0x57')]);_0x433f33[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x35dd9b[_0xb2d1('0x3f')]);_0x433f33['filters']=_[_0xb2d1('0x41')](_0x433f33['model'],_0x433f33[_0xb2d1('0x3f')]);_0x3dbc66[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x433f33[_0xb2d1('0x42')],qs[_0xb2d1('0x44')](_0x35dd9b[_0xb2d1('0x3f')]['fields']));_0x3dbc66[_0xb2d1('0x43')]=_0x3dbc66[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x3dbc66[_0xb2d1('0x43')]:_0x433f33[_0xb2d1('0x42')];_0x3dbc66[_0xb2d1('0x67')]=qs[_0xb2d1('0x48')](_0x35dd9b[_0xb2d1('0x3f')]['sort']);_0x3dbc66[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x35dd9b[_0xb2d1('0x3f')],_0x433f33[_0xb2d1('0x4a')]));if(_0x35dd9b['query'][_0xb2d1('0x4c')]){_0x3dbc66[_0xb2d1('0x49')]=_[_0xb2d1('0x4d')](_0x3dbc66[_0xb2d1('0x49')],{'$or':_[_0xb2d1('0x3d')](_0x3dbc66[_0xb2d1('0x43')],function(_0x536b68){var _0x1e5af2={};_0x1e5af2[_0x536b68]={'$like':'%'+_0x35dd9b[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0x1e5af2;})});}_0x3dbc66=_['merge']({},_0x3dbc66,_0x35dd9b['options']);return _0x9eddb5[_0xb2d1('0x71')](_0x3dbc66);}})[_0xb2d1('0x21')](function(_0x4de7b7){if(_0x4de7b7){_0xb0e406=_0x4de7b7[_0xb2d1('0x45')];if(!_0x35dd9b['query']['hasOwnProperty']('nolimit')){_0x3dbc66[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x35dd9b[_0xb2d1('0x3f')]['limit']);_0x3dbc66[_0xb2d1('0x2e')]=qs[_0xb2d1('0x2e')](_0x35dd9b['query'][_0xb2d1('0x2e')]);}return _0x9eddb5[_0xb2d1('0x71')](_0x3dbc66);}})[_0xb2d1('0x21')](function(_0x38ee10){if(_0x38ee10){return _0x38ee10?{'count':_0xb0e406,'rows':_0x38ee10}:null;}})[_0xb2d1('0x21')](respondWithResult(_0x433f1c,null))[_0xb2d1('0x2a')](handleError(_0x433f1c,null));};exports['addTeams']=function(_0x322424,_0xab5db0,_0x521733){var _0x270f4b=_0x322424['body'][_0xb2d1('0x72')];return db[_0xb2d1('0x73')][_0xb2d1('0x53')]({'where':{'id':_0x270f4b},'attributes':['id'],'include':[{'model':db[_0xb2d1('0x69')],'as':_0xb2d1('0x74'),'attributes':['id',_0xb2d1('0x3a'),'online',_0xb2d1('0x75'),_0xb2d1('0x76')],'raw':!![]}]})[_0xb2d1('0x21')](function(_0x5420b0){if(_0x5420b0){var _0x5aaef6=_['flatMap'](_0x5420b0,function(_0xe862ae){var _0x1c4b79=_0xe862ae['get']({'plain':!![]});return _0x1c4b79['Agents'];});return db[_0xb2d1('0x50')][_0xb2d1('0x59')]({'where':{'id':_0x322424[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](function(_0x3ce58f){return db[_0xb2d1('0x77')]['transaction'](function(_0x35b5a1){return _0x3ce58f[_0xb2d1('0x78')](_0x270f4b,{'transaction':_0x35b5a1})['then'](function(){return BPromise['each'](_0x5aaef6,function(_0x3267a0){return db[_0xb2d1('0x66')]['findOrCreate']({'where':{'UserId':_0x3267a0['id'],'ChatQueueId':_0x322424[_0xb2d1('0x56')]['id']},'transaction':_0x35b5a1});});})[_0xb2d1('0x21')](function(){_0x5aaef6[_0xb2d1('0x79')](function(_0x1cae7b){socket[_0xb2d1('0x7a')](_0xb2d1('0x7b'),{'UserId':_0x1cae7b['id'],'ChatQueueId':_0x3ce58f['id']});});});});});}})[_0xb2d1('0x21')](respondWithStatusCode(_0xab5db0,null))[_0xb2d1('0x2a')](handleError(_0xab5db0,null));};exports[_0xb2d1('0x7c')]=function(_0x378754,_0x1fb596,_0x551ab7){return db[_0xb2d1('0x73')][_0xb2d1('0x53')]({'where':{'id':_0x378754[_0xb2d1('0x3f')][_0xb2d1('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb2d1('0x69')],'as':_0xb2d1('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb2d1('0x21')](handleEntityNotFound(_0x1fb596,null))[_0xb2d1('0x21')](function(_0x4fc980){var _0x279112=_[_0xb2d1('0x3d')](_0x4fc980,'id');var _0x5a2b99=[];var _0x96eb9d=[];var _0x2fa865=squel[_0xb2d1('0x7d')]();_0x2fa865['field'](_0xb2d1('0x7e'))[_0xb2d1('0x7f')](_0xb2d1('0x80'),'tq')[_0xb2d1('0x81')](_0xb2d1('0x82'),'ut',_0xb2d1('0x83'))[_0xb2d1('0x49')](_0xb2d1('0x84'),_0x378754['params']['id']);for(var _0x2c31c5=0x0;_0x2c31c5<_0x4fc980[_0xb2d1('0x45')];_0x2c31c5+=0x1){let _0x377e69=_0x4fc980[_0x2c31c5];for(var _0x3453d7=0x0;_0x3453d7<_0x377e69[_0xb2d1('0x74')][_0xb2d1('0x45')];_0x3453d7+=0x1){let _0x2c93b3=_0x377e69[_0xb2d1('0x74')][_0x3453d7];var _0x428e2d=_0x2fa865[_0xb2d1('0x85')]();_0x428e2d['where'](_0xb2d1('0x86'),_0x2c93b3['id']);_0x96eb9d[_0xb2d1('0x87')](db[_0xb2d1('0x77')][_0xb2d1('0x3f')](_0x428e2d[_0xb2d1('0x88')](),{'type':db['sequelize'][_0xb2d1('0x89')]['SELECT']})[_0xb2d1('0x21')](function(_0x4e2f3a){if(_0x4e2f3a[_0xb2d1('0x45')]===0x1){return _0x2c93b3['id'];}else{var _0x4aa241=_[_0xb2d1('0x8a')](_[_0xb2d1('0x3d')](_0x4e2f3a,'TeamId'),function(_0x491972){return _[_0xb2d1('0x8b')](_0x279112,_0x491972);});if(_0x4aa241){return _0x2c93b3['id'];}}}));}}return BPromise[_0xb2d1('0x8c')](_0x96eb9d)[_0xb2d1('0x21')](function(_0x131777){_0x5a2b99=_(_0x5a2b99)[_0xb2d1('0x8d')](_0x131777)[_0xb2d1('0x8e')]()[_0xb2d1('0x8f')]();return db['ChatQueue'][_0xb2d1('0x59')]({'where':{'id':_0x378754['params']['id']}})[_0xb2d1('0x21')](function(_0x329fc3){return db[_0xb2d1('0x77')][_0xb2d1('0x90')](function(_0x3256d5){return _0x329fc3[_0xb2d1('0x7c')](_0x378754[_0xb2d1('0x3f')][_0xb2d1('0x72')],{'transaction':_0x3256d5})['then'](function(){if(!_[_0xb2d1('0x91')](_0x5a2b99)){return _0x329fc3['removeAgents'](_0x5a2b99,{'transaction':_0x3256d5});}})[_0xb2d1('0x21')](function(){_0x5a2b99[_0xb2d1('0x79')](function(_0x125c6d){socket[_0xb2d1('0x7a')](_0xb2d1('0x92'),{'UserId':_0x125c6d,'ChatQueueId':_0x329fc3['id']});});});});});});})[_0xb2d1('0x21')](respondWithStatusCode(_0x1fb596,null))['catch'](handleError(_0x1fb596,null));};exports[_0xb2d1('0x93')]=function(_0x2b6933,_0x4e28dd,_0x6d3e87){return db['ChatQueue'][_0xb2d1('0x59')]({'where':{'id':_0x2b6933[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x4e28dd,null))[_0xb2d1('0x21')](function(_0x272ab4){if(_0x272ab4){return _0x272ab4[_0xb2d1('0x93')](_0x2b6933[_0xb2d1('0x5b')][_0xb2d1('0x72')],_['omit'](_0x2b6933[_0xb2d1('0x5b')],['ids','id'])||{})[_0xb2d1('0x94')](function(_0x54d4e1){for(var _0x3d6983=0x0;_0x3d6983<_0x2b6933[_0xb2d1('0x5b')][_0xb2d1('0x72')][_0xb2d1('0x45')];_0x3d6983+=0x1){socket[_0xb2d1('0x7a')](_0xb2d1('0x7b'),{'UserId':_0x2b6933[_0xb2d1('0x5b')]['ids'][_0x3d6983],'ChatQueueId':_0x2b6933['params']['id']});}return _0x54d4e1;});}})[_0xb2d1('0x21')](respondWithResult(_0x4e28dd,null))[_0xb2d1('0x2a')](handleError(_0x4e28dd,null));};exports['removeAgents']=function(_0x28da0c,_0x1d7441,_0x6558a5){return db[_0xb2d1('0x50')]['find']({'where':{'id':_0x28da0c[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x1d7441,null))[_0xb2d1('0x21')](function(_0x2aa742){if(_0x2aa742){return _0x2aa742[_0xb2d1('0x95')](_0x28da0c[_0xb2d1('0x3f')]['ids'])[_0xb2d1('0x21')](function(){if(_[_0xb2d1('0x96')](_0x28da0c['query']['ids'])){for(var _0x361861=0x0;_0x361861<_0x28da0c[_0xb2d1('0x3f')][_0xb2d1('0x72')][_0xb2d1('0x45')];_0x361861+=0x1){socket[_0xb2d1('0x7a')]('userChatQueue:remove',{'UserId':Number(_0x28da0c['query'][_0xb2d1('0x72')][_0x361861]),'ChatQueueId':Number(_0x28da0c[_0xb2d1('0x56')]['id'])});}}else{socket[_0xb2d1('0x7a')](_0xb2d1('0x92'),{'UserId':Number(_0x28da0c[_0xb2d1('0x3f')][_0xb2d1('0x72')]),'ChatQueueId':Number(_0x28da0c[_0xb2d1('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d7441,null))[_0xb2d1('0x2a')](handleError(_0x1d7441,null));};exports[_0xb2d1('0x97')]=function(_0x493990,_0x383cba,_0x265532){var _0x156050={};var _0x4534f6={};var _0x542350;var _0x1eb369;return db[_0xb2d1('0x50')]['findOne']({'where':{'id':_0x493990[_0xb2d1('0x56')]['id']}})[_0xb2d1('0x21')](handleEntityNotFound(_0x383cba,null))['then'](function(_0x235f6c){if(_0x235f6c){_0x542350=_0x235f6c;_0x4534f6['model']=_[_0xb2d1('0x40')](db[_0xb2d1('0x69')][_0xb2d1('0x57')]);_0x4534f6[_0xb2d1('0x3f')]=_[_0xb2d1('0x40')](_0x493990['query']);_0x4534f6[_0xb2d1('0x4a')]=_['intersection'](_0x4534f6[_0xb2d1('0x42')],_0x4534f6[_0xb2d1('0x3f')]);_0x156050[_0xb2d1('0x43')]=_[_0xb2d1('0x41')](_0x4534f6[_0xb2d1('0x42')],qs['fields'](_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x44')]));_0x156050[_0xb2d1('0x43')]=_0x156050[_0xb2d1('0x43')][_0xb2d1('0x45')]?_0x156050[_0xb2d1('0x43')]:_0x4534f6[_0xb2d1('0x42')];_0x156050['order']=qs['sort'](_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x48')]);_0x156050[_0xb2d1('0x49')]=qs[_0xb2d1('0x4a')](_[_0xb2d1('0x4b')](_0x493990[_0xb2d1('0x3f')],_0x4534f6['filters']));if(_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x4c')]){_0x156050[_0xb2d1('0x49')]=_[_0xb2d1('0x4d')](_0x156050['where'],{'$or':_['map'](_0x156050[_0xb2d1('0x43')],function(_0x41cc01){var _0xe3e1b1={};_0xe3e1b1[_0x41cc01]={'$like':'%'+_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x4c')]+'%'};return _0xe3e1b1;})});}_0x156050=_[_0xb2d1('0x4d')]({},_0x156050,_0x493990[_0xb2d1('0x4f')]);return _0x542350['getAgents'](_0x156050);}})[_0xb2d1('0x21')](function(_0x1eb512){if(_0x1eb512){_0x1eb369=_0x1eb512[_0xb2d1('0x45')];if(!_0x493990['query'][_0xb2d1('0x46')](_0xb2d1('0x47'))){_0x156050[_0xb2d1('0x2f')]=qs[_0xb2d1('0x2f')](_0x493990[_0xb2d1('0x3f')][_0xb2d1('0x2f')]);_0x156050['offset']=qs[_0xb2d1('0x2e')](_0x493990[_0xb2d1('0x3f')]['offset']);}return _0x542350[_0xb2d1('0x97')](_0x156050);}})[_0xb2d1('0x21')](function(_0x29e1aa){if(_0x29e1aa){return _0x29e1aa?{'count':_0x1eb369,'rows':_0x29e1aa}:null;}})[_0xb2d1('0x21')](respondWithResult(_0x383cba,null))[_0xb2d1('0x2a')](handleError(_0x383cba,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 396cad6..9c6bc00 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(_0x4f8fcf,_0x1caa89){var _0x2b7958=function(_0x3a96b8){while(--_0x3a96b8){_0x4f8fcf['push'](_0x4f8fcf['shift']());}};_0x2b7958(++_0x1caa89);}(_0x5f2f,0x73));var _0xf5f2=function(_0x187949,_0x14e3d9){_0x187949=_0x187949-0x0;var _0x4b348c=_0x5f2f[_0x187949];return _0x4b348c;};'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 _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x17c038,_0x12868e){var _0x547a2d=function(_0x538beb){while(--_0x538beb){_0x17c038['push'](_0x17c038['shift']());}};_0x547a2d(++_0x12868e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3074f1,_0x4901aa){_0x3074f1=_0x3074f1-0x0;var _0x149af8=_0x0b0e[_0x3074f1];return _0x149af8;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ad24272..279ee9b 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 _0x5ca4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash'];(function(_0x1040f4,_0x121c51){var _0x43563b=function(_0x177ef8){while(--_0x177ef8){_0x1040f4['push'](_0x1040f4['shift']());}};_0x43563b(++_0x121c51);}(_0x5ca4,0x11d));var _0x45ca=function(_0x5a9c7a,_0x51fa85){_0x5a9c7a=_0x5a9c7a-0x0;var _0x4888a1=_0x5ca4[_0x5a9c7a];return _0x4888a1;};'use strict';var _=require(_0x45ca('0x0'));var util=require(_0x45ca('0x1'));var logger=require(_0x45ca('0x2'))('api');var moment=require(_0x45ca('0x3'));var BPromise=require(_0x45ca('0x4'));var rp=require(_0x45ca('0x5'));var fs=require('fs');var path=require(_0x45ca('0x6'));var rimraf=require(_0x45ca('0x7'));var config=require(_0x45ca('0x8'));var attributes=require(_0x45ca('0x9'));module[_0x45ca('0xa')]=function(_0x401d57,_0x2203dc){return _0x401d57['define'](_0x45ca('0xb'),attributes,{'tableName':_0x45ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe787=['exports','define','ChatQueue','chat_queues','util','api','bluebird','request-promise','rimraf','./chatQueue.attributes'];(function(_0x41779e,_0x52f603){var _0x10be61=function(_0x1afdd9){while(--_0x1afdd9){_0x41779e['push'](_0x41779e['shift']());}};_0x10be61(++_0x52f603);}(_0xe787,0x130));var _0x7e78=function(_0xdf3db6,_0x2a1952){_0xdf3db6=_0xdf3db6-0x0;var _0x4b7a65=_0xe787[_0xdf3db6];return _0x4b7a65;};'use strict';var _=require('lodash');var util=require(_0x7e78('0x0'));var logger=require('../../config/logger')(_0x7e78('0x1'));var moment=require('moment');var BPromise=require(_0x7e78('0x2'));var rp=require(_0x7e78('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e78('0x4'));var config=require('../../config/environment');var attributes=require(_0x7e78('0x5'));module[_0x7e78('0x6')]=function(_0x1c0edd,_0x4f5ce0){return _0x1c0edd[_0x7e78('0x7')](_0x7e78('0x8'),attributes,{'tableName':_0x7e78('0x9'),'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 85c5e8d..7d46d54 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 _0x6302=['http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','ChatQueue','findAll','options','where','limit','include','map','model','attributes','debug','ShowChatQueue','find','raw','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6302,0x109));var _0x2630=function(_0x541c36,_0xbc5950){_0x541c36=_0x541c36-0x0;var _0x252704=_0x6302[_0x541c36];return _0x252704;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var moment=require(_0x2630('0x1'));var BPromise=require(_0x2630('0x2'));var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2630('0x5'));var jayson=require(_0x2630('0x6'));var client=jayson[_0x2630('0x7')][_0x2630('0x8')]({'port':0x232a});config[_0x2630('0x9')]=_[_0x2630('0xa')](config[_0x2630('0x9')],{'host':_0x2630('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2630('0xc'))[_0x2630('0xd')](socket);function respondWithRpcPromise(_0x582c0c,_0x115d6d,_0x517124){return new BPromise(function(_0x1d1b18,_0x569a0c){return client[_0x2630('0xe')](_0x582c0c,_0x517124)[_0x2630('0xf')](function(_0x28d302){logger[_0x2630('0x10')](_0x2630('0x11'),_0x115d6d,_0x2630('0x12'));logger['debug'](_0x2630('0x13'),_0x115d6d,_0x2630('0x12'),JSON[_0x2630('0x14')](_0x28d302));if(_0x28d302[_0x2630('0x15')]){if(_0x28d302['error'][_0x2630('0x16')]===0x1f4){logger[_0x2630('0x15')](_0x2630('0x11'),_0x115d6d,_0x28d302['error'][_0x2630('0x17')]);return _0x569a0c(_0x28d302['error'][_0x2630('0x17')]);}logger[_0x2630('0x15')](_0x2630('0x11'),_0x115d6d,_0x28d302[_0x2630('0x15')][_0x2630('0x17')]);return _0x1d1b18(_0x28d302[_0x2630('0x15')][_0x2630('0x17')]);}else{logger[_0x2630('0x10')]('ChatQueue,\x20%s,\x20%s',_0x115d6d,_0x2630('0x12'));_0x1d1b18(_0x28d302['result']['message']);}})['catch'](function(_0x17d98b){logger[_0x2630('0x15')](_0x2630('0x11'),_0x115d6d,_0x17d98b);_0x569a0c(_0x17d98b);});});}exports[_0x2630('0x18')]=function(_0x1c292c){var _0x7ec957=this;return new Promise(function(_0x4364a0,_0x608d15){return db[_0x2630('0x19')][_0x2630('0x1a')]({'raw':_0x1c292c[_0x2630('0x1b')]?_0x1c292c[_0x2630('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c292c['options']?_0x1c292c[_0x2630('0x1b')][_0x2630('0x1c')]||null:null,'attributes':_0x1c292c['options']?_0x1c292c[_0x2630('0x1b')]['attributes']||null:null,'limit':_0x1c292c[_0x2630('0x1b')]?_0x1c292c[_0x2630('0x1b')][_0x2630('0x1d')]||null:null,'include':_0x1c292c[_0x2630('0x1b')]?_0x1c292c['options'][_0x2630('0x1e')]?_[_0x2630('0x1f')](_0x1c292c[_0x2630('0x1b')][_0x2630('0x1e')],function(_0x3468dc){return{'model':db[_0x3468dc[_0x2630('0x20')]],'as':_0x3468dc['as'],'attributes':_0x3468dc[_0x2630('0x21')],'include':_0x3468dc[_0x2630('0x1e')]?_['map'](_0x3468dc['include'],function(_0x1e57d6){return{'model':db[_0x1e57d6[_0x2630('0x20')]],'as':_0x1e57d6['as'],'attributes':_0x1e57d6[_0x2630('0x21')],'include':_0x1e57d6['include']?_[_0x2630('0x1f')](_0x1e57d6[_0x2630('0x1e')],function(_0x3e0f49){return{'model':db[_0x3e0f49['model']],'as':_0x3e0f49['as'],'attributes':_0x3e0f49[_0x2630('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x336226){logger['info'](_0x2630('0x18'),_0x1c292c);logger[_0x2630('0x22')]('GetChatQueue',_0x1c292c,JSON[_0x2630('0x14')](_0x336226));_0x4364a0(_0x336226);})['catch'](function(_0x547d25){logger[_0x2630('0x15')](_0x2630('0x18'),_0x547d25['message'],_0x1c292c);_0x608d15(_0x7ec957[_0x2630('0x15')](0x1f4,_0x547d25[_0x2630('0x17')]));});});};exports[_0x2630('0x23')]=function(_0x2ee2b6){var _0x2abe44=this;return new Promise(function(_0x355fe7,_0x357035){return db['ChatQueue'][_0x2630('0x24')]({'raw':_0x2ee2b6[_0x2630('0x1b')]?_0x2ee2b6['options'][_0x2630('0x25')]===undefined?!![]:![]:!![],'where':_0x2ee2b6['options']?_0x2ee2b6[_0x2630('0x1b')]['where']||null:null,'attributes':_0x2ee2b6['options']?_0x2ee2b6[_0x2630('0x1b')][_0x2630('0x21')]||null:null,'include':_0x2ee2b6[_0x2630('0x1b')]?_0x2ee2b6['options'][_0x2630('0x1e')]?_[_0x2630('0x1f')](_0x2ee2b6['options'][_0x2630('0x1e')],function(_0x3975d1){return{'model':db[_0x3975d1['model']],'as':_0x3975d1['as'],'attributes':_0x3975d1[_0x2630('0x21')],'include':_0x3975d1['include']?_[_0x2630('0x1f')](_0x3975d1[_0x2630('0x1e')],function(_0x55bb15){return{'model':db[_0x55bb15[_0x2630('0x20')]],'as':_0x55bb15['as'],'attributes':_0x55bb15[_0x2630('0x21')],'include':_0x55bb15['include']?_[_0x2630('0x1f')](_0x55bb15[_0x2630('0x1e')],function(_0x369908){return{'model':db[_0x369908[_0x2630('0x20')]],'as':_0x369908['as'],'attributes':_0x369908[_0x2630('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2630('0xf')](function(_0x22de2d){logger[_0x2630('0x10')](_0x2630('0x23'),_0x2ee2b6);logger['debug'](_0x2630('0x23'),_0x2ee2b6,JSON['stringify'](_0x22de2d));_0x355fe7(_0x22de2d);})[_0x2630('0x26')](function(_0x3d7106){logger[_0x2630('0x15')](_0x2630('0x23'),_0x3d7106[_0x2630('0x17')],_0x2ee2b6);_0x357035(_0x2abe44[_0x2630('0x15')](0x1f4,_0x3d7106['message']));});});}; \ No newline at end of file +var _0x6351=['ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','include','map','model','then','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatQueue.socket','request'];(function(_0x2b90e4,_0x47049c){var _0x42c402=function(_0x48c5c0){while(--_0x48c5c0){_0x2b90e4['push'](_0x2b90e4['shift']());}};_0x42c402(++_0x47049c);}(_0x6351,0x12f));var _0x1635=function(_0x351865,_0x595cbe){_0x351865=_0x351865-0x0;var _0x28e5ff=_0x6351[_0x351865];return _0x28e5ff;};'use strict';var _=require(_0x1635('0x0'));var util=require(_0x1635('0x1'));var moment=require(_0x1635('0x2'));var BPromise=require(_0x1635('0x3'));var rs=require(_0x1635('0x4'));var fs=require('fs');var Redis=require(_0x1635('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1635('0x6'));var logger=require(_0x1635('0x7'))(_0x1635('0x8'));var config=require(_0x1635('0x9'));var jayson=require(_0x1635('0xa'));var client=jayson[_0x1635('0xb')][_0x1635('0xc')]({'port':0x232a});config[_0x1635('0xd')]=_['defaults'](config[_0x1635('0xd')],{'host':_0x1635('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1635('0xf'))['register'](socket);function respondWithRpcPromise(_0x171ac7,_0xf373ff,_0x4f109e){return new BPromise(function(_0x114dc4,_0xfcb242){return client[_0x1635('0x10')](_0x171ac7,_0x4f109e)['then'](function(_0x59a50f){logger['info'](_0x1635('0x11'),_0xf373ff,_0x1635('0x12'));logger[_0x1635('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xf373ff,'request\x20sent',JSON[_0x1635('0x14')](_0x59a50f));if(_0x59a50f['error']){if(_0x59a50f[_0x1635('0x15')][_0x1635('0x16')]===0x1f4){logger[_0x1635('0x15')](_0x1635('0x11'),_0xf373ff,_0x59a50f[_0x1635('0x15')]['message']);return _0xfcb242(_0x59a50f['error'][_0x1635('0x17')]);}logger[_0x1635('0x15')]('ChatQueue,\x20%s,\x20%s',_0xf373ff,_0x59a50f['error'][_0x1635('0x17')]);return _0x114dc4(_0x59a50f[_0x1635('0x15')][_0x1635('0x17')]);}else{logger[_0x1635('0x18')](_0x1635('0x11'),_0xf373ff,_0x1635('0x12'));_0x114dc4(_0x59a50f[_0x1635('0x19')][_0x1635('0x17')]);}})[_0x1635('0x1a')](function(_0x5e19a3){logger[_0x1635('0x15')](_0x1635('0x11'),_0xf373ff,_0x5e19a3);_0xfcb242(_0x5e19a3);});});}exports[_0x1635('0x1b')]=function(_0x4e1534){var _0x1b4c92=this;return new Promise(function(_0x57c947,_0x29fbbc){return db[_0x1635('0x1c')]['findAll']({'raw':_0x4e1534['options']?_0x4e1534[_0x1635('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1534['options']?_0x4e1534['options'][_0x1635('0x1e')]||null:null,'attributes':_0x4e1534[_0x1635('0x1d')]?_0x4e1534[_0x1635('0x1d')][_0x1635('0x1f')]||null:null,'limit':_0x4e1534[_0x1635('0x1d')]?_0x4e1534['options'][_0x1635('0x20')]||null:null,'include':_0x4e1534[_0x1635('0x1d')]?_0x4e1534[_0x1635('0x1d')][_0x1635('0x21')]?_[_0x1635('0x22')](_0x4e1534[_0x1635('0x1d')]['include'],function(_0x21a7ac){return{'model':db[_0x21a7ac['model']],'as':_0x21a7ac['as'],'attributes':_0x21a7ac[_0x1635('0x1f')],'include':_0x21a7ac[_0x1635('0x21')]?_[_0x1635('0x22')](_0x21a7ac['include'],function(_0x4aec56){return{'model':db[_0x4aec56[_0x1635('0x23')]],'as':_0x4aec56['as'],'attributes':_0x4aec56['attributes'],'include':_0x4aec56[_0x1635('0x21')]?_[_0x1635('0x22')](_0x4aec56[_0x1635('0x21')],function(_0x3bff45){return{'model':db[_0x3bff45[_0x1635('0x23')]],'as':_0x3bff45['as'],'attributes':_0x3bff45[_0x1635('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1635('0x24')](function(_0x57fb1e){logger[_0x1635('0x18')]('GetChatQueue',_0x4e1534);logger['debug'](_0x1635('0x1b'),_0x4e1534,JSON[_0x1635('0x14')](_0x57fb1e));_0x57c947(_0x57fb1e);})['catch'](function(_0x2c5420){logger[_0x1635('0x15')](_0x1635('0x1b'),_0x2c5420[_0x1635('0x17')],_0x4e1534);_0x29fbbc(_0x1b4c92[_0x1635('0x15')](0x1f4,_0x2c5420[_0x1635('0x17')]));});});};exports[_0x1635('0x25')]=function(_0x14333e){var _0x2121fb=this;return new Promise(function(_0x1195f5,_0x636fd9){return db[_0x1635('0x1c')][_0x1635('0x26')]({'raw':_0x14333e[_0x1635('0x1d')]?_0x14333e[_0x1635('0x1d')][_0x1635('0x27')]===undefined?!![]:![]:!![],'where':_0x14333e['options']?_0x14333e[_0x1635('0x1d')][_0x1635('0x1e')]||null:null,'attributes':_0x14333e['options']?_0x14333e[_0x1635('0x1d')][_0x1635('0x1f')]||null:null,'include':_0x14333e[_0x1635('0x1d')]?_0x14333e[_0x1635('0x1d')][_0x1635('0x21')]?_[_0x1635('0x22')](_0x14333e[_0x1635('0x1d')][_0x1635('0x21')],function(_0x2cad12){return{'model':db[_0x2cad12['model']],'as':_0x2cad12['as'],'attributes':_0x2cad12[_0x1635('0x1f')],'include':_0x2cad12[_0x1635('0x21')]?_[_0x1635('0x22')](_0x2cad12[_0x1635('0x21')],function(_0x195ee0){return{'model':db[_0x195ee0[_0x1635('0x23')]],'as':_0x195ee0['as'],'attributes':_0x195ee0[_0x1635('0x1f')],'include':_0x195ee0[_0x1635('0x21')]?_['map'](_0x195ee0[_0x1635('0x21')],function(_0x53d95b){return{'model':db[_0x53d95b[_0x1635('0x23')]],'as':_0x53d95b['as'],'attributes':_0x53d95b[_0x1635('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1635('0x24')](function(_0x57ab92){logger[_0x1635('0x18')](_0x1635('0x25'),_0x14333e);logger['debug'](_0x1635('0x25'),_0x14333e,JSON[_0x1635('0x14')](_0x57ab92));_0x1195f5(_0x57ab92);})[_0x1635('0x1a')](function(_0x565aab){logger[_0x1635('0x15')]('ShowChatQueue',_0x565aab[_0x1635('0x17')],_0x14333e);_0x636fd9(_0x2121fb[_0x1635('0x15')](0x1f4,_0x565aab[_0x1635('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0b879bd..04a9f14 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x36f6fb,_0x249aa3){var _0x39c006=function(_0x2ba353){while(--_0x2ba353){_0x36f6fb['push'](_0x36f6fb['shift']());}};_0x39c006(++_0x249aa3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a98b6,_0x5436bb){_0x1a98b6=_0x1a98b6-0x0;var _0x38bac6=_0x5f2f[_0x1a98b6];return _0x38bac6;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x57591e,_0x228d28){var _0x2add02=function(_0xdf89dd){while(--_0xdf89dd){_0x57591e['push'](_0x57591e['shift']());}};_0x2add02(++_0x228d28);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ac907bd..e668efa 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 _0xa1dd=['/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x24d4da,_0x57c43d){var _0x3e9102=function(_0x3a12b2){while(--_0x3a12b2){_0x24d4da['push'](_0x24d4da['shift']());}};_0x3e9102(++_0x57c43d);}(_0xa1dd,0x15e));var _0xda1d=function(_0x36c465,_0x5c21bf){_0x36c465=_0x36c465-0x0;var _0x122e60=_0xa1dd[_0x36c465];return _0x122e60;};'use strict';var multer=require(_0xda1d('0x0'));var util=require(_0xda1d('0x1'));var path=require(_0xda1d('0x2'));var timeout=require(_0xda1d('0x3'));var express=require(_0xda1d('0x4'));var router=express[_0xda1d('0x5')]();var auth=require(_0xda1d('0x6'));var interaction=require(_0xda1d('0x7'));var config=require('../../config/environment');var controller=require(_0xda1d('0x8'));router[_0xda1d('0x9')]('/',auth[_0xda1d('0xa')](),controller[_0xda1d('0xb')]);router[_0xda1d('0x9')](_0xda1d('0xc'),auth['isAuthenticated'](),controller[_0xda1d('0xd')]);router[_0xda1d('0x9')](_0xda1d('0xe'),auth['isAuthenticated'](),controller[_0xda1d('0xf')]);router['get']('/:id/members',auth[_0xda1d('0xa')](),controller[_0xda1d('0x10')]);router['get']('/:id/teams',auth[_0xda1d('0xa')](),controller[_0xda1d('0x11')]);router[_0xda1d('0x9')](_0xda1d('0x12'),auth['isAuthenticated'](),controller[_0xda1d('0x13')]);router[_0xda1d('0x14')]('/',auth['isAuthenticated'](),controller[_0xda1d('0x15')]);router['post'](_0xda1d('0x16'),auth[_0xda1d('0xa')](),controller[_0xda1d('0x17')]);router[_0xda1d('0x14')](_0xda1d('0x12'),auth[_0xda1d('0xa')](),controller['addAgents']);router[_0xda1d('0x18')](_0xda1d('0xe'),auth[_0xda1d('0xa')](),controller[_0xda1d('0x19')]);router[_0xda1d('0x1a')](_0xda1d('0xe'),auth[_0xda1d('0xa')](),controller['destroy']);router[_0xda1d('0x1a')](_0xda1d('0x16'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xda1d('0x1a')]('/:id/users',auth[_0xda1d('0xa')](),controller[_0xda1d('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xce5a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout'];(function(_0x1cb4ac,_0x4c7bba){var _0x414348=function(_0x1127f4){while(--_0x1127f4){_0x1cb4ac['push'](_0x1cb4ac['shift']());}};_0x414348(++_0x4c7bba);}(_0xce5a,0x93));var _0xace5=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xce5a[_0x403c20];return _0x2b271a;};'use strict';var multer=require('multer');var util=require(_0xace5('0x0'));var path=require(_0xace5('0x1'));var timeout=require(_0xace5('0x2'));var express=require(_0xace5('0x3'));var router=express[_0xace5('0x4')]();var auth=require(_0xace5('0x5'));var interaction=require(_0xace5('0x6'));var config=require(_0xace5('0x7'));var controller=require('./chatQueue.controller');router[_0xace5('0x8')]('/',auth[_0xace5('0x9')](),controller[_0xace5('0xa')]);router['get'](_0xace5('0xb'),auth['isAuthenticated'](),controller[_0xace5('0xc')]);router[_0xace5('0x8')](_0xace5('0xd'),auth[_0xace5('0x9')](),controller[_0xace5('0xe')]);router[_0xace5('0x8')](_0xace5('0xf'),auth['isAuthenticated'](),controller[_0xace5('0x10')]);router[_0xace5('0x8')](_0xace5('0x11'),auth[_0xace5('0x9')](),controller[_0xace5('0x12')]);router[_0xace5('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xace5('0x13')]('/',auth[_0xace5('0x9')](),controller[_0xace5('0x14')]);router[_0xace5('0x13')](_0xace5('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xace5('0x13')](_0xace5('0x15'),auth[_0xace5('0x9')](),controller[_0xace5('0x16')]);router[_0xace5('0x17')](_0xace5('0xd'),auth[_0xace5('0x9')](),controller[_0xace5('0x18')]);router[_0xace5('0x19')]('/:id',auth[_0xace5('0x9')](),controller[_0xace5('0x1a')]);router[_0xace5('0x19')](_0xace5('0x11'),auth[_0xace5('0x9')](),controller[_0xace5('0x1b')]);router[_0xace5('0x19')](_0xace5('0x15'),auth[_0xace5('0x9')](),controller[_0xace5('0x1c')]);module[_0xace5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1e2a5b2..caab015 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 _0x443b=['STRING','DATE','moment','sequelize','exports'];(function(_0x5171ee,_0x49024d){var _0x306409=function(_0x48f94b){while(--_0x48f94b){_0x5171ee['push'](_0x5171ee['shift']());}};_0x306409(++_0x49024d);}(_0x443b,0xe3));var _0xb443=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x443b[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xb443('0x0'));var Sequelize=require(_0xb443('0x1'));module[_0xb443('0x2')]={'uniqueid':{'type':Sequelize[_0xb443('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb443('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb443('0x4')]},'exitAt':{'type':Sequelize[_0xb443('0x4')]},'reason':{'type':Sequelize[_0xb443('0x3')]}}; \ No newline at end of file +var _0x2283=['moment','sequelize','exports','DATE'];(function(_0x51171d,_0x4e363f){var _0x40ab70=function(_0x29bf4d){while(--_0x29bf4d){_0x51171d['push'](_0x51171d['shift']());}};_0x40ab70(++_0x4e363f);}(_0x2283,0x1dc));var _0x3228=function(_0x313c3f,_0x54abd6){_0x313c3f=_0x313c3f-0x0;var _0x1aef06=_0x2283[_0x313c3f];return _0x1aef06;};'use strict';var moment=require(_0x3228('0x0'));var Sequelize=require(_0x3228('0x1'));module[_0x3228('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3228('0x3')]},'leaveAt':{'type':Sequelize[_0x3228('0x3')]},'acceptAt':{'type':Sequelize[_0x3228('0x3')]},'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 e56d799..0f11415 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 _0x90cf=['show','params','include','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','index','ChatQueueReport','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x906ca6,_0x592235){var _0x12dd8b=function(_0x20f636){while(--_0x20f636){_0x906ca6['push'](_0x906ca6['shift']());}};_0x12dd8b(++_0x592235);}(_0x90cf,0x9c));var _0xf90c=function(_0x334fc2,_0x443008){_0x334fc2=_0x334fc2-0x0;var _0x4cba29=_0x90cf[_0x334fc2];return _0x4cba29;};'use strict';var pdf=require(_0xf90c('0x0'));var emlformat=require(_0xf90c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf90c('0x2'));var jsonpatch=require(_0xf90c('0x3'));var rp=require(_0xf90c('0x4'));var moment=require(_0xf90c('0x5'));var BPromise=require(_0xf90c('0x6'));var Mustache=require('mustache');var util=require(_0xf90c('0x7'));var path=require('path');var sox=require(_0xf90c('0x8'));var csv=require('to-csv');var ejs=require(_0xf90c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf90c('0xa'));var crypto=require(_0xf90c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf90c('0xc'));var querystring=require(_0xf90c('0xd'));var Papa=require(_0xf90c('0xe'));var Redis=require(_0xf90c('0xf'));var authService=require(_0xf90c('0x10'));var qs=require(_0xf90c('0x11'));var as=require(_0xf90c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf90c('0x13'))(_0xf90c('0x14'));var utils=require(_0xf90c('0x15'));var config=require(_0xf90c('0x16'));var licenseUtil=require(_0xf90c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d521,_0x42acc4){_0x42acc4=_0x42acc4||0xcc;return function(_0x41d856){if(_0x41d856){return _0x42d521[_0xf90c('0x18')](_0x42acc4);}return _0x42d521['status'](_0x42acc4)[_0xf90c('0x19')]();};}function respondWithResult(_0x1ea706,_0x5419d4){_0x5419d4=_0x5419d4||0xc8;return function(_0x43ceeb){if(_0x43ceeb){return _0x1ea706[_0xf90c('0x1a')](_0x5419d4)[_0xf90c('0x1b')](_0x43ceeb);}};}function respondWithFilteredResult(_0x5a0fd8,_0x25d79b){return function(_0x2f8478){if(_0x2f8478){var _0x2551e8=_0x2f8478[_0xf90c('0x1c')],_0x3ccd1f=_0x25d79b[_0xf90c('0x1d')],_0x1e8211=_0x25d79b['offset']+_0x25d79b[_0xf90c('0x1e')],_0x1ea016;if(_0x1e8211>=_0x2551e8){_0x1e8211=_0x2551e8;_0x1ea016=0xc8;}else{_0x1ea016=0xce;}_0x5a0fd8[_0xf90c('0x1a')](_0x1ea016);return _0x5a0fd8['set'](_0xf90c('0x1f'),_0x3ccd1f+'-'+_0x1e8211+'/'+_0x2551e8)[_0xf90c('0x1b')](_0x2f8478);}return null;};}function patchUpdates(_0x502688){return function(_0x395960){try{jsonpatch[_0xf90c('0x20')](_0x395960,_0x502688,!![]);}catch(_0x410813){return BPromise[_0xf90c('0x21')](_0x410813);}return _0x395960[_0xf90c('0x22')]();};}function saveUpdates(_0x5e1e61,_0xb95d03){return function(_0xa724bb){if(_0xa724bb){return _0xa724bb['update'](_0x5e1e61)[_0xf90c('0x23')](function(_0x453b6e){return _0x453b6e;});}return null;};}function removeEntity(_0x564301,_0x5ae47a){return function(_0x129033){if(_0x129033){return _0x129033[_0xf90c('0x24')]()['then'](function(){_0x564301[_0xf90c('0x1a')](0xcc)[_0xf90c('0x19')]();});}};}function handleEntityNotFound(_0x2251d8,_0x1d9854){return function(_0x511739){if(!_0x511739){_0x2251d8[_0xf90c('0x18')](0x194);}return _0x511739;};}function handleError(_0x4ceb90,_0x2bc5ec){_0x2bc5ec=_0x2bc5ec||0x1f4;return function(_0x515a44){logger[_0xf90c('0x25')](_0x515a44[_0xf90c('0x26')]);if(_0x515a44['name']){delete _0x515a44['name'];}_0x4ceb90[_0xf90c('0x1a')](_0x2bc5ec)['send'](_0x515a44);};}exports[_0xf90c('0x27')]=function(_0x2dedaa,_0x394b96){var _0x5df1e3={},_0x52be3f={},_0x49e242={'count':0x0,'rows':[]};var _0x1a6f78=_['map'](db[_0xf90c('0x28')]['rawAttributes'],function(_0x4745a9){return{'name':_0x4745a9[_0xf90c('0x29')],'type':_0x4745a9[_0xf90c('0x2a')]['key']};});_0x52be3f[_0xf90c('0x2b')]=_[_0xf90c('0x2c')](_0x1a6f78,_0xf90c('0x2d'));_0x52be3f[_0xf90c('0x2e')]=_[_0xf90c('0x2f')](_0x2dedaa[_0xf90c('0x2e')]);_0x52be3f[_0xf90c('0x30')]=_[_0xf90c('0x31')](_0x52be3f['model'],_0x52be3f[_0xf90c('0x2e')]);_0x5df1e3[_0xf90c('0x32')]=_[_0xf90c('0x31')](_0x52be3f['model'],qs[_0xf90c('0x33')](_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x33')]));_0x5df1e3['attributes']=_0x5df1e3['attributes'][_0xf90c('0x34')]?_0x5df1e3[_0xf90c('0x32')]:_0x52be3f[_0xf90c('0x2b')];if(!_0x2dedaa[_0xf90c('0x2e')]['hasOwnProperty'](_0xf90c('0x35'))){_0x5df1e3[_0xf90c('0x1e')]=qs[_0xf90c('0x1e')](_0x2dedaa['query']['limit']);_0x5df1e3[_0xf90c('0x1d')]=qs['offset'](_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x1d')]);}_0x5df1e3[_0xf90c('0x36')]=qs[_0xf90c('0x37')](_0x2dedaa['query'][_0xf90c('0x37')]);_0x5df1e3[_0xf90c('0x38')]=qs['filters'](_[_0xf90c('0x39')](_0x2dedaa[_0xf90c('0x2e')],_0x52be3f[_0xf90c('0x30')]),_0x1a6f78);if(_0x2dedaa['query'][_0xf90c('0x3a')]){_0x5df1e3[_0xf90c('0x38')]=_[_0xf90c('0x3b')](_0x5df1e3[_0xf90c('0x38')],{'$or':_[_0xf90c('0x2c')](_0x1a6f78,function(_0x1fd88e){if(_0x1fd88e['type']!==_0xf90c('0x3c')){var _0x487d0b={};_0x487d0b[_0x1fd88e[_0xf90c('0x2d')]]={'$like':'%'+_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x3a')]+'%'};return _0x487d0b;}})});}_0x5df1e3=_[_0xf90c('0x3b')]({},_0x5df1e3,_0x2dedaa[_0xf90c('0x3d')]);var _0x845449={'where':_0x5df1e3[_0xf90c('0x38')]};return db[_0xf90c('0x28')][_0xf90c('0x1c')](_0x845449)['then'](function(_0x58d568){_0x49e242['count']=_0x58d568;if(_0x2dedaa[_0xf90c('0x2e')][_0xf90c('0x3e')]){_0x5df1e3['include']=[{'all':!![]}];}return db[_0xf90c('0x28')][_0xf90c('0x3f')](_0x5df1e3);})[_0xf90c('0x23')](function(_0x3f8134){_0x49e242[_0xf90c('0x40')]=_0x3f8134;return _0x49e242;})[_0xf90c('0x23')](respondWithFilteredResult(_0x394b96,_0x5df1e3))[_0xf90c('0x41')](handleError(_0x394b96,null));};exports[_0xf90c('0x42')]=function(_0x15c3f0,_0x1783d3){var _0x18adf3={'raw':!![],'where':{'id':_0x15c3f0[_0xf90c('0x43')]['id']}},_0x3435a2={};_0x3435a2['model']=_[_0xf90c('0x2f')](db[_0xf90c('0x28')]['rawAttributes']);_0x3435a2[_0xf90c('0x2e')]=_[_0xf90c('0x2f')](_0x15c3f0[_0xf90c('0x2e')]);_0x3435a2[_0xf90c('0x30')]=_[_0xf90c('0x31')](_0x3435a2[_0xf90c('0x2b')],_0x3435a2[_0xf90c('0x2e')]);_0x18adf3[_0xf90c('0x32')]=_[_0xf90c('0x31')](_0x3435a2[_0xf90c('0x2b')],qs[_0xf90c('0x33')](_0x15c3f0[_0xf90c('0x2e')][_0xf90c('0x33')]));_0x18adf3[_0xf90c('0x32')]=_0x18adf3[_0xf90c('0x32')][_0xf90c('0x34')]?_0x18adf3[_0xf90c('0x32')]:_0x3435a2[_0xf90c('0x2b')];if(_0x15c3f0['query']['includeAll']){_0x18adf3[_0xf90c('0x44')]=[{'all':!![]}];}_0x18adf3=_[_0xf90c('0x3b')]({},_0x18adf3,_0x15c3f0[_0xf90c('0x3d')]);return db[_0xf90c('0x28')][_0xf90c('0x45')](_0x18adf3)['then'](handleEntityNotFound(_0x1783d3,null))[_0xf90c('0x23')](respondWithResult(_0x1783d3,null))[_0xf90c('0x41')](handleError(_0x1783d3,null));};exports[_0xf90c('0x46')]=function(_0x452492,_0x383560){return db[_0xf90c('0x28')]['create'](_0x452492[_0xf90c('0x47')],{})[_0xf90c('0x23')](respondWithResult(_0x383560,0xc9))[_0xf90c('0x41')](handleError(_0x383560,null));};exports[_0xf90c('0x48')]=function(_0x86a452,_0x44c92c){if(_0x86a452[_0xf90c('0x47')]['id']){delete _0x86a452[_0xf90c('0x47')]['id'];}return db[_0xf90c('0x28')]['find']({'where':{'id':_0x86a452[_0xf90c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44c92c,null))[_0xf90c('0x23')](saveUpdates(_0x86a452[_0xf90c('0x47')],null))[_0xf90c('0x23')](respondWithResult(_0x44c92c,null))[_0xf90c('0x41')](handleError(_0x44c92c,null));};exports[_0xf90c('0x24')]=function(_0x538a51,_0x31be4b){return db[_0xf90c('0x28')][_0xf90c('0x45')]({'where':{'id':_0x538a51[_0xf90c('0x43')]['id']}})[_0xf90c('0x23')](handleEntityNotFound(_0x31be4b,null))[_0xf90c('0x23')](removeEntity(_0x31be4b,null))[_0xf90c('0x41')](handleError(_0x31be4b,null));};exports['describe']=function(_0x4c631a,_0x3cc4c6){return db[_0xf90c('0x28')][_0xf90c('0x49')]()[_0xf90c('0x23')](respondWithResult(_0x3cc4c6,null))['catch'](handleError(_0x3cc4c6,null));}; \ No newline at end of file +var _0xb104=['name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xb104,0x72));var _0x4b10=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xb104[_0x38537f];return _0x141e23;};'use strict';var pdf=require(_0x4b10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b10('0x1'));var zipdir=require(_0x4b10('0x2'));var jsonpatch=require(_0x4b10('0x3'));var rp=require(_0x4b10('0x4'));var moment=require(_0x4b10('0x5'));var BPromise=require(_0x4b10('0x6'));var Mustache=require(_0x4b10('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4b10('0x8'));var csv=require(_0x4b10('0x9'));var ejs=require(_0x4b10('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4b10('0xb'));var crypto=require(_0x4b10('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4b10('0xd'));var toCsv=require(_0x4b10('0x9'));var querystring=require(_0x4b10('0xe'));var Papa=require(_0x4b10('0xf'));var Redis=require(_0x4b10('0x10'));var authService=require(_0x4b10('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4b10('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b10('0x13'))(_0x4b10('0x14'));var utils=require('../../config/utils');var config=require(_0x4b10('0x15'));var licenseUtil=require(_0x4b10('0x16'));var db=require(_0x4b10('0x17'))['db'];function respondWithStatusCode(_0x1c68f2,_0x3a0356){_0x3a0356=_0x3a0356||0xcc;return function(_0x1f48dd){if(_0x1f48dd){return _0x1c68f2[_0x4b10('0x18')](_0x3a0356);}return _0x1c68f2['status'](_0x3a0356)[_0x4b10('0x19')]();};}function respondWithResult(_0x107827,_0x47a922){_0x47a922=_0x47a922||0xc8;return function(_0x2afa12){if(_0x2afa12){return _0x107827[_0x4b10('0x1a')](_0x47a922)[_0x4b10('0x1b')](_0x2afa12);}};}function respondWithFilteredResult(_0x368657,_0xcfc6c4){return function(_0x4cf824){if(_0x4cf824){var _0x3ff184=_0x4cf824['count'],_0x269840=_0xcfc6c4[_0x4b10('0x1c')],_0x50f4fd=_0xcfc6c4[_0x4b10('0x1c')]+_0xcfc6c4[_0x4b10('0x1d')],_0x55bd9d;if(_0x50f4fd>=_0x3ff184){_0x50f4fd=_0x3ff184;_0x55bd9d=0xc8;}else{_0x55bd9d=0xce;}_0x368657[_0x4b10('0x1a')](_0x55bd9d);return _0x368657['set'](_0x4b10('0x1e'),_0x269840+'-'+_0x50f4fd+'/'+_0x3ff184)[_0x4b10('0x1b')](_0x4cf824);}return null;};}function patchUpdates(_0x49753e){return function(_0x245a02){try{jsonpatch[_0x4b10('0x1f')](_0x245a02,_0x49753e,!![]);}catch(_0x556de8){return BPromise[_0x4b10('0x20')](_0x556de8);}return _0x245a02[_0x4b10('0x21')]();};}function saveUpdates(_0x181b7b,_0x2ce637){return function(_0xd166bd){if(_0xd166bd){return _0xd166bd[_0x4b10('0x22')](_0x181b7b)[_0x4b10('0x23')](function(_0x5177ad){return _0x5177ad;});}return null;};}function removeEntity(_0x463504,_0x11432c){return function(_0x511d8b){if(_0x511d8b){return _0x511d8b['destroy']()[_0x4b10('0x23')](function(){_0x463504['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2c3a,_0x51975f){return function(_0xc300c){if(!_0xc300c){_0x2a2c3a['sendStatus'](0x194);}return _0xc300c;};}function handleError(_0x10e60f,_0x93d203){_0x93d203=_0x93d203||0x1f4;return function(_0x1d94e6){logger[_0x4b10('0x24')](_0x1d94e6[_0x4b10('0x25')]);if(_0x1d94e6['name']){delete _0x1d94e6[_0x4b10('0x26')];}_0x10e60f[_0x4b10('0x1a')](_0x93d203)['send'](_0x1d94e6);};}exports[_0x4b10('0x27')]=function(_0x3298bd,_0x411ff5){var _0x45544d={},_0x4cd7a0={},_0x4572f1={'count':0x0,'rows':[]};var _0x7936c0=_[_0x4b10('0x28')](db[_0x4b10('0x29')][_0x4b10('0x2a')],function(_0x5dc491){return{'name':_0x5dc491[_0x4b10('0x2b')],'type':_0x5dc491[_0x4b10('0x2c')][_0x4b10('0x2d')]};});_0x4cd7a0[_0x4b10('0x2e')]=_[_0x4b10('0x28')](_0x7936c0,_0x4b10('0x26'));_0x4cd7a0[_0x4b10('0x2f')]=_[_0x4b10('0x30')](_0x3298bd[_0x4b10('0x2f')]);_0x4cd7a0[_0x4b10('0x31')]=_['intersection'](_0x4cd7a0['model'],_0x4cd7a0['query']);_0x45544d['attributes']=_[_0x4b10('0x32')](_0x4cd7a0[_0x4b10('0x2e')],qs[_0x4b10('0x33')](_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x33')]));_0x45544d[_0x4b10('0x34')]=_0x45544d[_0x4b10('0x34')]['length']?_0x45544d[_0x4b10('0x34')]:_0x4cd7a0['model'];if(!_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x35')](_0x4b10('0x36'))){_0x45544d['limit']=qs[_0x4b10('0x1d')](_0x3298bd[_0x4b10('0x2f')]['limit']);_0x45544d[_0x4b10('0x1c')]=qs[_0x4b10('0x1c')](_0x3298bd['query'][_0x4b10('0x1c')]);}_0x45544d[_0x4b10('0x37')]=qs[_0x4b10('0x38')](_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x38')]);_0x45544d[_0x4b10('0x39')]=qs[_0x4b10('0x31')](_[_0x4b10('0x3a')](_0x3298bd[_0x4b10('0x2f')],_0x4cd7a0['filters']),_0x7936c0);if(_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x3b')]){_0x45544d[_0x4b10('0x39')]=_[_0x4b10('0x3c')](_0x45544d['where'],{'$or':_[_0x4b10('0x28')](_0x7936c0,function(_0x27f5b0){if(_0x27f5b0[_0x4b10('0x2c')]!==_0x4b10('0x3d')){var _0x4beb0d={};_0x4beb0d[_0x27f5b0[_0x4b10('0x26')]]={'$like':'%'+_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x3b')]+'%'};return _0x4beb0d;}})});}_0x45544d=_[_0x4b10('0x3c')]({},_0x45544d,_0x3298bd['options']);var _0x5e9b4d={'where':_0x45544d[_0x4b10('0x39')]};return db[_0x4b10('0x29')][_0x4b10('0x3e')](_0x5e9b4d)['then'](function(_0x2fbd9d){_0x4572f1[_0x4b10('0x3e')]=_0x2fbd9d;if(_0x3298bd[_0x4b10('0x2f')][_0x4b10('0x3f')]){_0x45544d[_0x4b10('0x40')]=[{'all':!![]}];}return db[_0x4b10('0x29')][_0x4b10('0x41')](_0x45544d);})[_0x4b10('0x23')](function(_0x26a8c9){_0x4572f1[_0x4b10('0x42')]=_0x26a8c9;return _0x4572f1;})['then'](respondWithFilteredResult(_0x411ff5,_0x45544d))[_0x4b10('0x43')](handleError(_0x411ff5,null));};exports[_0x4b10('0x44')]=function(_0x352dda,_0x495bce){var _0x3333a5={'raw':!![],'where':{'id':_0x352dda[_0x4b10('0x45')]['id']}},_0x34b753={};_0x34b753[_0x4b10('0x2e')]=_['keys'](db[_0x4b10('0x29')]['rawAttributes']);_0x34b753['query']=_[_0x4b10('0x30')](_0x352dda[_0x4b10('0x2f')]);_0x34b753[_0x4b10('0x31')]=_['intersection'](_0x34b753['model'],_0x34b753[_0x4b10('0x2f')]);_0x3333a5[_0x4b10('0x34')]=_[_0x4b10('0x32')](_0x34b753[_0x4b10('0x2e')],qs[_0x4b10('0x33')](_0x352dda[_0x4b10('0x2f')]['fields']));_0x3333a5['attributes']=_0x3333a5[_0x4b10('0x34')]['length']?_0x3333a5['attributes']:_0x34b753[_0x4b10('0x2e')];if(_0x352dda['query'][_0x4b10('0x3f')]){_0x3333a5[_0x4b10('0x40')]=[{'all':!![]}];}_0x3333a5=_[_0x4b10('0x3c')]({},_0x3333a5,_0x352dda[_0x4b10('0x46')]);return db[_0x4b10('0x29')][_0x4b10('0x47')](_0x3333a5)[_0x4b10('0x23')](handleEntityNotFound(_0x495bce,null))[_0x4b10('0x23')](respondWithResult(_0x495bce,null))[_0x4b10('0x43')](handleError(_0x495bce,null));};exports[_0x4b10('0x48')]=function(_0x51e825,_0xfd54af){return db[_0x4b10('0x29')][_0x4b10('0x48')](_0x51e825[_0x4b10('0x49')],{})['then'](respondWithResult(_0xfd54af,0xc9))[_0x4b10('0x43')](handleError(_0xfd54af,null));};exports['update']=function(_0x24677b,_0x5d8761){if(_0x24677b[_0x4b10('0x49')]['id']){delete _0x24677b[_0x4b10('0x49')]['id'];}return db['ChatQueueReport'][_0x4b10('0x47')]({'where':{'id':_0x24677b[_0x4b10('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d8761,null))['then'](saveUpdates(_0x24677b[_0x4b10('0x49')],null))['then'](respondWithResult(_0x5d8761,null))[_0x4b10('0x43')](handleError(_0x5d8761,null));};exports[_0x4b10('0x4a')]=function(_0xb7e0e0,_0x5f51a6){return db[_0x4b10('0x29')][_0x4b10('0x47')]({'where':{'id':_0xb7e0e0[_0x4b10('0x45')]['id']}})[_0x4b10('0x23')](handleEntityNotFound(_0x5f51a6,null))['then'](removeEntity(_0x5f51a6,null))[_0x4b10('0x43')](handleError(_0x5f51a6,null));};exports['describe']=function(_0x208fd3,_0x1ea6c2){return db[_0x4b10('0x29')][_0x4b10('0x4b')]()[_0x4b10('0x23')](respondWithResult(_0x1ea6c2,null))['catch'](handleError(_0x1ea6c2,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 08d9b83..8b2740c 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 _0xab48=['../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xab48,0xc6));var _0x8ab4=function(_0x46c1a8,_0x363524){_0x46c1a8=_0x46c1a8-0x0;var _0x1d2217=_0xab48[_0x46c1a8];return _0x1d2217;};'use strict';var _=require(_0x8ab4('0x0'));var util=require('util');var logger=require(_0x8ab4('0x1'))('api');var moment=require(_0x8ab4('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ab4('0x3'));var fs=require('fs');var path=require(_0x8ab4('0x4'));var rimraf=require(_0x8ab4('0x5'));var config=require(_0x8ab4('0x6'));var attributes=require(_0x8ab4('0x7'));module[_0x8ab4('0x8')]=function(_0x55e587,_0x10c524){return _0x55e587['define'](_0x8ab4('0x9'),attributes,{'tableName':_0x8ab4('0xa'),'paranoid':![],'indexes':[{'name':_0x8ab4('0xb'),'fields':[_0x8ab4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4235=['ChatQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x186550,_0x26f3ee){var _0x4b4c70=function(_0x2e255e){while(--_0x2e255e){_0x186550['push'](_0x186550['shift']());}};_0x4b4c70(++_0x26f3ee);}(_0x4235,0x9e));var _0x5423=function(_0x2ecbfd,_0x5bacbc){_0x2ecbfd=_0x2ecbfd-0x0;var _0x2c65a2=_0x4235[_0x2ecbfd];return _0x2c65a2;};'use strict';var _=require(_0x5423('0x0'));var util=require(_0x5423('0x1'));var logger=require('../../config/logger')(_0x5423('0x2'));var moment=require(_0x5423('0x3'));var BPromise=require(_0x5423('0x4'));var rp=require(_0x5423('0x5'));var fs=require('fs');var path=require(_0x5423('0x6'));var rimraf=require('rimraf');var config=require(_0x5423('0x7'));var attributes=require(_0x5423('0x8'));module[_0x5423('0x9')]=function(_0x327e7d,_0x4d8e84){return _0x327e7d[_0x5423('0xa')](_0x5423('0xb'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x5423('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0b299bc..5c6c18d 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 _0x5ca8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','body','raw','where','attributes','lodash','util','moment'];(function(_0x14de31,_0x42bceb){var _0x36403f=function(_0x470d49){while(--_0x470d49){_0x14de31['push'](_0x14de31['shift']());}};_0x36403f(++_0x42bceb);}(_0x5ca8,0x195));var _0x85ca=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ca8[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x85ca('0x0'));var util=require(_0x85ca('0x1'));var moment=require(_0x85ca('0x2'));var BPromise=require(_0x85ca('0x3'));var rs=require(_0x85ca('0x4'));var fs=require('fs');var Redis=require(_0x85ca('0x5'));var db=require(_0x85ca('0x6'))['db'];var utils=require(_0x85ca('0x7'));var logger=require(_0x85ca('0x8'))(_0x85ca('0x9'));var config=require(_0x85ca('0xa'));var jayson=require(_0x85ca('0xb'));var client=jayson[_0x85ca('0xc')][_0x85ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xae6367,_0x457b99,_0x56977f){return new BPromise(function(_0x3a4041,_0x248742){return client['request'](_0xae6367,_0x56977f)[_0x85ca('0xe')](function(_0x42a075){logger[_0x85ca('0xf')](_0x85ca('0x10'),_0x457b99,_0x85ca('0x11'));logger['debug'](_0x85ca('0x12'),_0x457b99,_0x85ca('0x11'),JSON[_0x85ca('0x13')](_0x42a075));if(_0x42a075[_0x85ca('0x14')]){if(_0x42a075['error'][_0x85ca('0x15')]===0x1f4){logger[_0x85ca('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x457b99,_0x42a075['error'][_0x85ca('0x16')]);return _0x248742(_0x42a075[_0x85ca('0x14')][_0x85ca('0x16')]);}logger['error'](_0x85ca('0x10'),_0x457b99,_0x42a075[_0x85ca('0x14')][_0x85ca('0x16')]);return _0x3a4041(_0x42a075[_0x85ca('0x14')][_0x85ca('0x16')]);}else{logger['info'](_0x85ca('0x10'),_0x457b99,_0x85ca('0x11'));_0x3a4041(_0x42a075[_0x85ca('0x17')][_0x85ca('0x16')]);}})[_0x85ca('0x18')](function(_0x240266){logger[_0x85ca('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x457b99,_0x240266);_0x248742(_0x240266);});});}exports['CreateChatQueueReport']=function(_0x198cee){var _0x3c04a4=this;return new Promise(function(_0x1ee378,_0x1b4414){return db['ChatQueueReport'][_0x85ca('0x19')](_0x198cee['body'],{'raw':_0x198cee[_0x85ca('0x1a')]?_0x198cee[_0x85ca('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c9402){logger[_0x85ca('0xf')]('CreateChatQueueReport',_0x198cee);logger['debug'](_0x85ca('0x1b'),_0x198cee,JSON[_0x85ca('0x13')](_0x4c9402));_0x1ee378(_0x4c9402);})[_0x85ca('0x18')](function(_0x39f203){logger[_0x85ca('0x14')]('CreateChatQueueReport',_0x39f203[_0x85ca('0x16')],_0x198cee);_0x1b4414(_0x3c04a4['error'](0x1f4,_0x39f203['message']));});});};exports[_0x85ca('0x1c')]=function(_0x1c51d1){var _0x15b8ae=this;return new Promise(function(_0x49b81b,_0xf052cc){return db[_0x85ca('0x1d')]['update'](_0x1c51d1[_0x85ca('0x1e')],{'raw':_0x1c51d1[_0x85ca('0x1a')]?_0x1c51d1['options'][_0x85ca('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c51d1[_0x85ca('0x1a')]?_0x1c51d1[_0x85ca('0x1a')][_0x85ca('0x20')]||null:null,'attributes':_0x1c51d1[_0x85ca('0x1a')]?_0x1c51d1[_0x85ca('0x1a')][_0x85ca('0x21')]||null:null,'limit':_0x1c51d1['options']?_0x1c51d1[_0x85ca('0x1a')]['limit']||null:null})[_0x85ca('0xe')](function(_0x1e30bc){logger[_0x85ca('0xf')](_0x85ca('0x1c'),_0x1c51d1);logger['debug'](_0x85ca('0x1c'),_0x1c51d1,JSON[_0x85ca('0x13')](_0x1e30bc));_0x49b81b(_0x1e30bc);})['catch'](function(_0x1eb502){logger[_0x85ca('0x14')](_0x85ca('0x1c'),_0x1eb502[_0x85ca('0x16')],_0x1c51d1);_0xf052cc(_0x15b8ae[_0x85ca('0x14')](0x1f4,_0x1eb502['message']));});});}; \ No newline at end of file +var _0xfc31=['../../config/environment','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3f16f6,_0x3854b5){var _0x18dcdb=function(_0xff47b1){while(--_0xff47b1){_0x3f16f6['push'](_0x3f16f6['shift']());}};_0x18dcdb(++_0x3854b5);}(_0xfc31,0xf9));var _0x1fc3=function(_0x552d5b,_0x4d16f4){_0x552d5b=_0x552d5b-0x0;var _0xb5bee1=_0xfc31[_0x552d5b];return _0xb5bee1;};'use strict';var _=require(_0x1fc3('0x0'));var util=require(_0x1fc3('0x1'));var moment=require('moment');var BPromise=require(_0x1fc3('0x2'));var rs=require(_0x1fc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1fc3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fc3('0x5'))(_0x1fc3('0x6'));var config=require(_0x1fc3('0x7'));var jayson=require(_0x1fc3('0x8'));var client=jayson[_0x1fc3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4957b3,_0x4ee0b1,_0x9f7917){return new BPromise(function(_0x8f58f3,_0x1dd227){return client[_0x1fc3('0xa')](_0x4957b3,_0x9f7917)[_0x1fc3('0xb')](function(_0x3494a1){logger['info'](_0x1fc3('0xc'),_0x4ee0b1,_0x1fc3('0xd'));logger[_0x1fc3('0xe')](_0x1fc3('0xf'),_0x4ee0b1,_0x1fc3('0xd'),JSON[_0x1fc3('0x10')](_0x3494a1));if(_0x3494a1[_0x1fc3('0x11')]){if(_0x3494a1['error']['code']===0x1f4){logger[_0x1fc3('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4ee0b1,_0x3494a1['error']['message']);return _0x1dd227(_0x3494a1[_0x1fc3('0x11')][_0x1fc3('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4ee0b1,_0x3494a1[_0x1fc3('0x11')][_0x1fc3('0x12')]);return _0x8f58f3(_0x3494a1[_0x1fc3('0x11')]['message']);}else{logger[_0x1fc3('0x13')](_0x1fc3('0xc'),_0x4ee0b1,_0x1fc3('0xd'));_0x8f58f3(_0x3494a1[_0x1fc3('0x14')][_0x1fc3('0x12')]);}})[_0x1fc3('0x15')](function(_0x2d08e5){logger[_0x1fc3('0x11')](_0x1fc3('0xc'),_0x4ee0b1,_0x2d08e5);_0x1dd227(_0x2d08e5);});});}exports[_0x1fc3('0x16')]=function(_0x15e6cd){var _0x229204=this;return new Promise(function(_0xcf7ffb,_0x3c946a){return db[_0x1fc3('0x17')]['create'](_0x15e6cd[_0x1fc3('0x18')],{'raw':_0x15e6cd[_0x1fc3('0x19')]?_0x15e6cd[_0x1fc3('0x19')][_0x1fc3('0x1a')]===undefined?!![]:![]:!![]})[_0x1fc3('0xb')](function(_0x2b2ec3){logger[_0x1fc3('0x13')]('CreateChatQueueReport',_0x15e6cd);logger[_0x1fc3('0xe')](_0x1fc3('0x16'),_0x15e6cd,JSON['stringify'](_0x2b2ec3));_0xcf7ffb(_0x2b2ec3);})[_0x1fc3('0x15')](function(_0x5791f7){logger[_0x1fc3('0x11')](_0x1fc3('0x16'),_0x5791f7[_0x1fc3('0x12')],_0x15e6cd);_0x3c946a(_0x229204[_0x1fc3('0x11')](0x1f4,_0x5791f7['message']));});});};exports[_0x1fc3('0x1b')]=function(_0x6131f1){var _0x49f6b6=this;return new Promise(function(_0x50b25a,_0x58bb41){return db['ChatQueueReport'][_0x1fc3('0x1c')](_0x6131f1[_0x1fc3('0x18')],{'raw':_0x6131f1['options']?_0x6131f1[_0x1fc3('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6131f1[_0x1fc3('0x19')]?_0x6131f1[_0x1fc3('0x19')][_0x1fc3('0x1d')]||null:null,'attributes':_0x6131f1[_0x1fc3('0x19')]?_0x6131f1[_0x1fc3('0x19')][_0x1fc3('0x1e')]||null:null,'limit':_0x6131f1[_0x1fc3('0x19')]?_0x6131f1[_0x1fc3('0x19')][_0x1fc3('0x1f')]||null:null})[_0x1fc3('0xb')](function(_0x232bdf){logger[_0x1fc3('0x13')](_0x1fc3('0x1b'),_0x6131f1);logger[_0x1fc3('0xe')](_0x1fc3('0x1b'),_0x6131f1,JSON[_0x1fc3('0x10')](_0x232bdf));_0x50b25a(_0x232bdf);})[_0x1fc3('0x15')](function(_0x210ac0){logger['error']('UpdateChatQueueReport',_0x210ac0[_0x1fc3('0x12')],_0x6131f1);_0x58bb41(_0x49f6b6[_0x1fc3('0x11')](0x1f4,_0x210ac0[_0x1fc3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 56b85d4..9067c32 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 _0x5543=['isAuthenticated','get','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','/describe'];(function(_0x226121,_0x5217df){var _0x501a63=function(_0x4f6362){while(--_0x4f6362){_0x226121['push'](_0x226121['shift']());}};_0x501a63(++_0x5217df);}(_0x5543,0x1d0));var _0x3554=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x5543[_0x31bab3];return _0x4fd382;};'use strict';var multer=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var path=require(_0x3554('0x2'));var timeout=require(_0x3554('0x3'));var express=require('express');var router=express[_0x3554('0x4')]();var auth=require(_0x3554('0x5'));var interaction=require(_0x3554('0x6'));var config=require(_0x3554('0x7'));var controller=require(_0x3554('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3554('0x9')]);router['get'](_0x3554('0xa'),auth[_0x3554('0xb')](),controller['describe']);router[_0x3554('0xc')](_0x3554('0xd'),auth[_0x3554('0xb')](),controller[_0x3554('0xe')]);router[_0x3554('0xf')]('/',auth['isAuthenticated'](),controller[_0x3554('0x10')]);router[_0x3554('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3554('0xd'),auth[_0x3554('0xb')](),controller[_0x3554('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc853=['put','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc853,0xf1));var _0x3c85=function(_0x5d0db5,_0x148cba){_0x5d0db5=_0x5d0db5-0x0;var _0x2c13e1=_0xc853[_0x5d0db5];return _0x2c13e1;};'use strict';var multer=require(_0x3c85('0x0'));var util=require(_0x3c85('0x1'));var path=require(_0x3c85('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c85('0x3'));var router=express[_0x3c85('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3c85('0x5'));var config=require('../../config/environment');var controller=require(_0x3c85('0x6'));router['get']('/',auth[_0x3c85('0x7')](),controller['index']);router['get'](_0x3c85('0x8'),auth[_0x3c85('0x7')](),controller[_0x3c85('0x9')]);router['get'](_0x3c85('0xa'),auth['isAuthenticated'](),controller[_0x3c85('0xb')]);router[_0x3c85('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c85('0xd')]);router[_0x3c85('0xe')](_0x3c85('0xa'),auth[_0x3c85('0x7')](),controller['update']);router[_0x3c85('0xf')]('/:id',auth[_0x3c85('0x7')](),controller[_0x3c85('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 628c99f..ed56eed 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 _0x23de=['DATE','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x23de,0x1a8));var _0xe23d=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x23de[_0x328534];return _0x2796c0;};'use strict';var moment=require(_0xe23d('0x0'));var Sequelize=require(_0xe23d('0x1'));module[_0xe23d('0x2')]={'uniqueid':{'type':Sequelize[_0xe23d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe23d('0x4')](_0xe23d('0x5'),_0xe23d('0x6'),'queue'),'allowNull':![],'defaultValue':_0xe23d('0x7')},'transferredAt':{'type':Sequelize[_0xe23d('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa619=['account','agent','queue','DATE','NOW','moment','exports','STRING'];(function(_0x5629e9,_0x5e670d){var _0x5280ab=function(_0x48d650){while(--_0x48d650){_0x5629e9['push'](_0x5629e9['shift']());}};_0x5280ab(++_0x5e670d);}(_0xa619,0x1e5));var _0x9a61=function(_0x3f753d,_0x34caab){_0x3f753d=_0x3f753d-0x0;var _0x36131d=_0xa619[_0x3f753d];return _0x36131d;};'use strict';var moment=require(_0x9a61('0x0'));var Sequelize=require('sequelize');module[_0x9a61('0x1')]={'uniqueid':{'type':Sequelize[_0x9a61('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9a61('0x3'),_0x9a61('0x4'),_0x9a61('0x5')),'allowNull':![],'defaultValue':_0x9a61('0x5')},'transferredAt':{'type':Sequelize[_0x9a61('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x9a61('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d8c0595..8948ca9 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 _0xb91b=['create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','then','stack','send','index','map','ChatTransferReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','type','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','length','merge','find'];(function(_0x15f8d7,_0x5df371){var _0x4f17c2=function(_0xeac47d){while(--_0xeac47d){_0x15f8d7['push'](_0x15f8d7['shift']());}};_0x4f17c2(++_0x5df371);}(_0xb91b,0x99));var _0xbb91=function(_0xce0491,_0x400a1e){_0xce0491=_0xce0491-0x0;var _0x4fde94=_0xb91b[_0xce0491];return _0x4fde94;};'use strict';var pdf=require(_0xbb91('0x0'));var emlformat=require(_0xbb91('0x1'));var rimraf=require(_0xbb91('0x2'));var zipdir=require(_0xbb91('0x3'));var jsonpatch=require(_0xbb91('0x4'));var rp=require(_0xbb91('0x5'));var moment=require(_0xbb91('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbb91('0x7'));var util=require(_0xbb91('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb91('0x9'));var fs=require('fs');var _=require(_0xbb91('0xa'));var squel=require('squel');var crypto=require(_0xbb91('0xb'));var jsforce=require(_0xbb91('0xc'));var deskjs=require(_0xbb91('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbb91('0xe'));var Papa=require('papaparse');var Redis=require(_0xbb91('0xf'));var authService=require(_0xbb91('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbb91('0x11'));var hardwareService=require(_0xbb91('0x12'));var logger=require(_0xbb91('0x13'))('api');var utils=require(_0xbb91('0x14'));var config=require(_0xbb91('0x15'));var licenseUtil=require(_0xbb91('0x16'));var db=require(_0xbb91('0x17'))['db'];function respondWithStatusCode(_0x1bf521,_0x10a10c){_0x10a10c=_0x10a10c||0xcc;return function(_0x366eb7){if(_0x366eb7){return _0x1bf521[_0xbb91('0x18')](_0x10a10c);}return _0x1bf521['status'](_0x10a10c)[_0xbb91('0x19')]();};}function respondWithResult(_0x53c87b,_0xb1fe6a){_0xb1fe6a=_0xb1fe6a||0xc8;return function(_0x467dc2){if(_0x467dc2){return _0x53c87b[_0xbb91('0x1a')](_0xb1fe6a)['json'](_0x467dc2);}};}function respondWithFilteredResult(_0x3933d0,_0x5d9af9){return function(_0x11b70c){if(_0x11b70c){var _0x343e1e=_0x11b70c[_0xbb91('0x1b')],_0x11364e=_0x5d9af9['offset'],_0x13e737=_0x5d9af9[_0xbb91('0x1c')]+_0x5d9af9[_0xbb91('0x1d')],_0x55d858;if(_0x13e737>=_0x343e1e){_0x13e737=_0x343e1e;_0x55d858=0xc8;}else{_0x55d858=0xce;}_0x3933d0['status'](_0x55d858);return _0x3933d0[_0xbb91('0x1e')]('Content-Range',_0x11364e+'-'+_0x13e737+'/'+_0x343e1e)[_0xbb91('0x1f')](_0x11b70c);}return null;};}function patchUpdates(_0x5074bf){return function(_0x4479ef){try{jsonpatch[_0xbb91('0x20')](_0x4479ef,_0x5074bf,!![]);}catch(_0x4dd3fc){return BPromise[_0xbb91('0x21')](_0x4dd3fc);}return _0x4479ef['save']();};}function saveUpdates(_0x118e58,_0x139bda){return function(_0x45e255){if(_0x45e255){return _0x45e255[_0xbb91('0x22')](_0x118e58)[_0xbb91('0x23')](function(_0x1d4fed){return _0x1d4fed;});}return null;};}function removeEntity(_0x3808b3,_0x3ca9b8){return function(_0x351151){if(_0x351151){return _0x351151['destroy']()['then'](function(){_0x3808b3['status'](0xcc)[_0xbb91('0x19')]();});}};}function handleEntityNotFound(_0x579e7a,_0xed0f5){return function(_0x3bf365){if(!_0x3bf365){_0x579e7a[_0xbb91('0x18')](0x194);}return _0x3bf365;};}function handleError(_0x43a3c3,_0x46b658){_0x46b658=_0x46b658||0x1f4;return function(_0x4d8298){logger['error'](_0x4d8298[_0xbb91('0x24')]);if(_0x4d8298['name']){delete _0x4d8298['name'];}_0x43a3c3['status'](_0x46b658)[_0xbb91('0x25')](_0x4d8298);};}exports[_0xbb91('0x26')]=function(_0x225204,_0x16cabf){var _0x2d8399={},_0xba073e={},_0x1c5e83={'count':0x0,'rows':[]};var _0x42218d=_[_0xbb91('0x27')](db[_0xbb91('0x28')][_0xbb91('0x29')],function(_0x50bbdd){return{'name':_0x50bbdd['fieldName'],'type':_0x50bbdd['type'][_0xbb91('0x2a')]};});_0xba073e[_0xbb91('0x2b')]=_[_0xbb91('0x27')](_0x42218d,'name');_0xba073e[_0xbb91('0x2c')]=_[_0xbb91('0x2d')](_0x225204[_0xbb91('0x2c')]);_0xba073e['filters']=_['intersection'](_0xba073e[_0xbb91('0x2b')],_0xba073e[_0xbb91('0x2c')]);_0x2d8399['attributes']=_[_0xbb91('0x2e')](_0xba073e[_0xbb91('0x2b')],qs['fields'](_0x225204[_0xbb91('0x2c')][_0xbb91('0x2f')]));_0x2d8399[_0xbb91('0x30')]=_0x2d8399['attributes']['length']?_0x2d8399['attributes']:_0xba073e['model'];if(!_0x225204[_0xbb91('0x2c')][_0xbb91('0x31')]('nolimit')){_0x2d8399['limit']=qs['limit'](_0x225204[_0xbb91('0x2c')][_0xbb91('0x1d')]);_0x2d8399['offset']=qs[_0xbb91('0x1c')](_0x225204['query'][_0xbb91('0x1c')]);}_0x2d8399[_0xbb91('0x32')]=qs['sort'](_0x225204[_0xbb91('0x2c')][_0xbb91('0x33')]);_0x2d8399[_0xbb91('0x34')]=qs['filters'](_[_0xbb91('0x35')](_0x225204[_0xbb91('0x2c')],_0xba073e[_0xbb91('0x36')]),_0x42218d);if(_0x225204[_0xbb91('0x2c')][_0xbb91('0x37')]){_0x2d8399[_0xbb91('0x34')]=_['merge'](_0x2d8399['where'],{'$or':_['map'](_0x42218d,function(_0x27df93){if(_0x27df93[_0xbb91('0x38')]!==_0xbb91('0x39')){var _0x230209={};_0x230209[_0x27df93[_0xbb91('0x3a')]]={'$like':'%'+_0x225204[_0xbb91('0x2c')][_0xbb91('0x37')]+'%'};return _0x230209;}})});}_0x2d8399=_['merge']({},_0x2d8399,_0x225204[_0xbb91('0x3b')]);var _0x5566e4={'where':_0x2d8399['where']};return db['ChatTransferReport'][_0xbb91('0x1b')](_0x5566e4)[_0xbb91('0x23')](function(_0x512e1a){_0x1c5e83[_0xbb91('0x1b')]=_0x512e1a;if(_0x225204[_0xbb91('0x2c')][_0xbb91('0x3c')]){_0x2d8399[_0xbb91('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xbb91('0x3e')](_0x2d8399);})[_0xbb91('0x23')](function(_0x28fd1c){_0x1c5e83[_0xbb91('0x3f')]=_0x28fd1c;return _0x1c5e83;})[_0xbb91('0x23')](respondWithFilteredResult(_0x16cabf,_0x2d8399))[_0xbb91('0x40')](handleError(_0x16cabf,null));};exports[_0xbb91('0x41')]=function(_0x5ca63c,_0x2b1d81){var _0x244a51={'raw':!![],'where':{'id':_0x5ca63c['params']['id']}},_0x18c40d={};_0x18c40d[_0xbb91('0x2b')]=_[_0xbb91('0x2d')](db['ChatTransferReport'][_0xbb91('0x29')]);_0x18c40d['query']=_[_0xbb91('0x2d')](_0x5ca63c[_0xbb91('0x2c')]);_0x18c40d[_0xbb91('0x36')]=_[_0xbb91('0x2e')](_0x18c40d[_0xbb91('0x2b')],_0x18c40d['query']);_0x244a51[_0xbb91('0x30')]=_[_0xbb91('0x2e')](_0x18c40d[_0xbb91('0x2b')],qs[_0xbb91('0x2f')](_0x5ca63c[_0xbb91('0x2c')][_0xbb91('0x2f')]));_0x244a51[_0xbb91('0x30')]=_0x244a51[_0xbb91('0x30')][_0xbb91('0x42')]?_0x244a51['attributes']:_0x18c40d[_0xbb91('0x2b')];if(_0x5ca63c[_0xbb91('0x2c')][_0xbb91('0x3c')]){_0x244a51[_0xbb91('0x3d')]=[{'all':!![]}];}_0x244a51=_[_0xbb91('0x43')]({},_0x244a51,_0x5ca63c[_0xbb91('0x3b')]);return db['ChatTransferReport'][_0xbb91('0x44')](_0x244a51)[_0xbb91('0x23')](handleEntityNotFound(_0x2b1d81,null))[_0xbb91('0x23')](respondWithResult(_0x2b1d81,null))[_0xbb91('0x40')](handleError(_0x2b1d81,null));};exports[_0xbb91('0x45')]=function(_0x463be0,_0x2cde9c){return db[_0xbb91('0x28')][_0xbb91('0x45')](_0x463be0[_0xbb91('0x46')],{})['then'](respondWithResult(_0x2cde9c,0xc9))[_0xbb91('0x40')](handleError(_0x2cde9c,null));};exports['update']=function(_0x52b5c9,_0x5c0d49){if(_0x52b5c9[_0xbb91('0x46')]['id']){delete _0x52b5c9[_0xbb91('0x46')]['id'];}return db[_0xbb91('0x28')][_0xbb91('0x44')]({'where':{'id':_0x52b5c9[_0xbb91('0x47')]['id']}})[_0xbb91('0x23')](handleEntityNotFound(_0x5c0d49,null))[_0xbb91('0x23')](saveUpdates(_0x52b5c9[_0xbb91('0x46')],null))[_0xbb91('0x23')](respondWithResult(_0x5c0d49,null))['catch'](handleError(_0x5c0d49,null));};exports[_0xbb91('0x48')]=function(_0x5a875a,_0x5665b0){return db[_0xbb91('0x28')]['find']({'where':{'id':_0x5a875a['params']['id']}})[_0xbb91('0x23')](handleEntityNotFound(_0x5665b0,null))['then'](removeEntity(_0x5665b0,null))[_0xbb91('0x40')](handleError(_0x5665b0,null));};exports[_0xbb91('0x49')]=function(_0x2af9f9,_0xf41c82){return db[_0xbb91('0x28')][_0xbb91('0x49')]()[_0xbb91('0x23')](respondWithResult(_0xf41c82,null))[_0xbb91('0x40')](handleError(_0xf41c82,null));}; \ No newline at end of file +var _0x7d85=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto'];(function(_0x15db61,_0x36b1b7){var _0x2e8178=function(_0x3cedf2){while(--_0x3cedf2){_0x15db61['push'](_0x15db61['shift']());}};_0x2e8178(++_0x36b1b7);}(_0x7d85,0x87));var _0x57d8=function(_0x345d55,_0x7bee08){_0x345d55=_0x345d55-0x0;var _0x59802b=_0x7d85[_0x345d55];return _0x59802b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57d8('0x0'));var rimraf=require(_0x57d8('0x1'));var zipdir=require(_0x57d8('0x2'));var jsonpatch=require(_0x57d8('0x3'));var rp=require(_0x57d8('0x4'));var moment=require(_0x57d8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57d8('0x6'));var util=require(_0x57d8('0x7'));var path=require(_0x57d8('0x8'));var sox=require('sox');var csv=require(_0x57d8('0x9'));var ejs=require(_0x57d8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57d8('0xb'));var crypto=require(_0x57d8('0xc'));var jsforce=require(_0x57d8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x57d8('0x9'));var querystring=require(_0x57d8('0xe'));var Papa=require(_0x57d8('0xf'));var Redis=require(_0x57d8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x57d8('0x11'));var as=require(_0x57d8('0x12'));var hardwareService=require(_0x57d8('0x13'));var logger=require(_0x57d8('0x14'))(_0x57d8('0x15'));var utils=require('../../config/utils');var config=require(_0x57d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x701e18,_0xaf0b96){_0xaf0b96=_0xaf0b96||0xcc;return function(_0x3c5df7){if(_0x3c5df7){return _0x701e18[_0x57d8('0x17')](_0xaf0b96);}return _0x701e18[_0x57d8('0x18')](_0xaf0b96)[_0x57d8('0x19')]();};}function respondWithResult(_0x376d20,_0x50d48a){_0x50d48a=_0x50d48a||0xc8;return function(_0x36816a){if(_0x36816a){return _0x376d20[_0x57d8('0x18')](_0x50d48a)[_0x57d8('0x1a')](_0x36816a);}};}function respondWithFilteredResult(_0xb4961b,_0x1c103f){return function(_0x21b99b){if(_0x21b99b){var _0x41e397=_0x21b99b['count'],_0x877819=_0x1c103f[_0x57d8('0x1b')],_0x32d7de=_0x1c103f[_0x57d8('0x1b')]+_0x1c103f['limit'],_0x2a7aae;if(_0x32d7de>=_0x41e397){_0x32d7de=_0x41e397;_0x2a7aae=0xc8;}else{_0x2a7aae=0xce;}_0xb4961b[_0x57d8('0x18')](_0x2a7aae);return _0xb4961b[_0x57d8('0x1c')]('Content-Range',_0x877819+'-'+_0x32d7de+'/'+_0x41e397)[_0x57d8('0x1a')](_0x21b99b);}return null;};}function patchUpdates(_0x457447){return function(_0x34b49d){try{jsonpatch[_0x57d8('0x1d')](_0x34b49d,_0x457447,!![]);}catch(_0xc6dd6c){return BPromise[_0x57d8('0x1e')](_0xc6dd6c);}return _0x34b49d[_0x57d8('0x1f')]();};}function saveUpdates(_0x19ab96,_0x13670f){return function(_0x3c3b3a){if(_0x3c3b3a){return _0x3c3b3a[_0x57d8('0x20')](_0x19ab96)[_0x57d8('0x21')](function(_0x29cc9d){return _0x29cc9d;});}return null;};}function removeEntity(_0x4b0489,_0x4eeb6d){return function(_0x23fd99){if(_0x23fd99){return _0x23fd99[_0x57d8('0x22')]()['then'](function(){_0x4b0489[_0x57d8('0x18')](0xcc)[_0x57d8('0x19')]();});}};}function handleEntityNotFound(_0x3c5c30,_0x46d074){return function(_0x4527eb){if(!_0x4527eb){_0x3c5c30[_0x57d8('0x17')](0x194);}return _0x4527eb;};}function handleError(_0x1224b2,_0x2a0a7a){_0x2a0a7a=_0x2a0a7a||0x1f4;return function(_0x5dc95c){logger['error'](_0x5dc95c[_0x57d8('0x23')]);if(_0x5dc95c[_0x57d8('0x24')]){delete _0x5dc95c['name'];}_0x1224b2[_0x57d8('0x18')](_0x2a0a7a)[_0x57d8('0x25')](_0x5dc95c);};}exports['index']=function(_0x2b68f8,_0x39127b){var _0x141131={},_0x1ddcde={},_0x382b42={'count':0x0,'rows':[]};var _0x2020af=_[_0x57d8('0x26')](db[_0x57d8('0x27')][_0x57d8('0x28')],function(_0x39d8dd){return{'name':_0x39d8dd['fieldName'],'type':_0x39d8dd[_0x57d8('0x29')][_0x57d8('0x2a')]};});_0x1ddcde['model']=_[_0x57d8('0x26')](_0x2020af,'name');_0x1ddcde[_0x57d8('0x2b')]=_[_0x57d8('0x2c')](_0x2b68f8[_0x57d8('0x2b')]);_0x1ddcde[_0x57d8('0x2d')]=_[_0x57d8('0x2e')](_0x1ddcde[_0x57d8('0x2f')],_0x1ddcde[_0x57d8('0x2b')]);_0x141131[_0x57d8('0x30')]=_[_0x57d8('0x2e')](_0x1ddcde[_0x57d8('0x2f')],qs['fields'](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x31')]));_0x141131[_0x57d8('0x30')]=_0x141131[_0x57d8('0x30')][_0x57d8('0x32')]?_0x141131[_0x57d8('0x30')]:_0x1ddcde[_0x57d8('0x2f')];if(!_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x33')](_0x57d8('0x34'))){_0x141131[_0x57d8('0x35')]=qs[_0x57d8('0x35')](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x35')]);_0x141131['offset']=qs[_0x57d8('0x1b')](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x1b')]);}_0x141131[_0x57d8('0x36')]=qs[_0x57d8('0x37')](_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x37')]);_0x141131['where']=qs[_0x57d8('0x2d')](_[_0x57d8('0x38')](_0x2b68f8['query'],_0x1ddcde[_0x57d8('0x2d')]),_0x2020af);if(_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x39')]){_0x141131[_0x57d8('0x3a')]=_[_0x57d8('0x3b')](_0x141131[_0x57d8('0x3a')],{'$or':_['map'](_0x2020af,function(_0x1e26d4){if(_0x1e26d4[_0x57d8('0x29')]!==_0x57d8('0x3c')){var _0x40ce0e={};_0x40ce0e[_0x1e26d4[_0x57d8('0x24')]]={'$like':'%'+_0x2b68f8[_0x57d8('0x2b')][_0x57d8('0x39')]+'%'};return _0x40ce0e;}})});}_0x141131=_[_0x57d8('0x3b')]({},_0x141131,_0x2b68f8[_0x57d8('0x3d')]);var _0x2ab96e={'where':_0x141131['where']};return db[_0x57d8('0x27')][_0x57d8('0x3e')](_0x2ab96e)[_0x57d8('0x21')](function(_0x3509e3){_0x382b42['count']=_0x3509e3;if(_0x2b68f8[_0x57d8('0x2b')]['includeAll']){_0x141131[_0x57d8('0x3f')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x57d8('0x40')](_0x141131);})[_0x57d8('0x21')](function(_0x5f4731){_0x382b42[_0x57d8('0x41')]=_0x5f4731;return _0x382b42;})[_0x57d8('0x21')](respondWithFilteredResult(_0x39127b,_0x141131))[_0x57d8('0x42')](handleError(_0x39127b,null));};exports[_0x57d8('0x43')]=function(_0x149876,_0x38425a){var _0xde7b0d={'raw':!![],'where':{'id':_0x149876['params']['id']}},_0x9ba5fa={};_0x9ba5fa['model']=_['keys'](db[_0x57d8('0x27')]['rawAttributes']);_0x9ba5fa[_0x57d8('0x2b')]=_['keys'](_0x149876[_0x57d8('0x2b')]);_0x9ba5fa[_0x57d8('0x2d')]=_[_0x57d8('0x2e')](_0x9ba5fa['model'],_0x9ba5fa[_0x57d8('0x2b')]);_0xde7b0d[_0x57d8('0x30')]=_['intersection'](_0x9ba5fa['model'],qs[_0x57d8('0x31')](_0x149876['query']['fields']));_0xde7b0d[_0x57d8('0x30')]=_0xde7b0d['attributes']['length']?_0xde7b0d['attributes']:_0x9ba5fa[_0x57d8('0x2f')];if(_0x149876[_0x57d8('0x2b')][_0x57d8('0x44')]){_0xde7b0d['include']=[{'all':!![]}];}_0xde7b0d=_[_0x57d8('0x3b')]({},_0xde7b0d,_0x149876['options']);return db['ChatTransferReport'][_0x57d8('0x45')](_0xde7b0d)[_0x57d8('0x21')](handleEntityNotFound(_0x38425a,null))[_0x57d8('0x21')](respondWithResult(_0x38425a,null))[_0x57d8('0x42')](handleError(_0x38425a,null));};exports[_0x57d8('0x46')]=function(_0x254d07,_0x1fa1c7){return db[_0x57d8('0x27')][_0x57d8('0x46')](_0x254d07[_0x57d8('0x47')],{})[_0x57d8('0x21')](respondWithResult(_0x1fa1c7,0xc9))[_0x57d8('0x42')](handleError(_0x1fa1c7,null));};exports['update']=function(_0x24fa1c,_0x18320c){if(_0x24fa1c[_0x57d8('0x47')]['id']){delete _0x24fa1c[_0x57d8('0x47')]['id'];}return db[_0x57d8('0x27')][_0x57d8('0x45')]({'where':{'id':_0x24fa1c['params']['id']}})['then'](handleEntityNotFound(_0x18320c,null))[_0x57d8('0x21')](saveUpdates(_0x24fa1c['body'],null))[_0x57d8('0x21')](respondWithResult(_0x18320c,null))[_0x57d8('0x42')](handleError(_0x18320c,null));};exports[_0x57d8('0x22')]=function(_0x2c379d,_0x380546){return db[_0x57d8('0x27')][_0x57d8('0x45')]({'where':{'id':_0x2c379d[_0x57d8('0x48')]['id']}})[_0x57d8('0x21')](handleEntityNotFound(_0x380546,null))[_0x57d8('0x21')](removeEntity(_0x380546,null))[_0x57d8('0x42')](handleError(_0x380546,null));};exports[_0x57d8('0x49')]=function(_0xafcb68,_0x158be2){return db[_0x57d8('0x27')][_0x57d8('0x49')]()['then'](respondWithResult(_0x158be2,null))[_0x57d8('0x42')](handleError(_0x158be2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 89cb104..3f9293f 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 _0xa421=['../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xa421,0x1b8));var _0x1a42=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xa421[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x1a42('0x0'));var util=require(_0x1a42('0x1'));var logger=require(_0x1a42('0x2'))(_0x1a42('0x3'));var moment=require(_0x1a42('0x4'));var BPromise=require(_0x1a42('0x5'));var rp=require(_0x1a42('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a42('0x7'));var config=require(_0x1a42('0x8'));var attributes=require(_0x1a42('0x9'));module[_0x1a42('0xa')]=function(_0x4d5ca2,_0x5eac2b){return _0x4d5ca2[_0x1a42('0xb')]('ChatTransferReport',attributes,{'tableName':_0x1a42('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1a42('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6828=['exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x2b1b1b,_0x28a22f){var _0x525975=function(_0x377618){while(--_0x377618){_0x2b1b1b['push'](_0x2b1b1b['shift']());}};_0x525975(++_0x28a22f);}(_0x6828,0xe6));var _0x8682=function(_0x1c4a61,_0x4a2338){_0x1c4a61=_0x1c4a61-0x0;var _0xcd27df=_0x6828[_0x1c4a61];return _0xcd27df;};'use strict';var _=require(_0x8682('0x0'));var util=require(_0x8682('0x1'));var logger=require(_0x8682('0x2'))(_0x8682('0x3'));var moment=require('moment');var BPromise=require(_0x8682('0x4'));var rp=require(_0x8682('0x5'));var fs=require('fs');var path=require(_0x8682('0x6'));var rimraf=require(_0x8682('0x7'));var config=require(_0x8682('0x8'));var attributes=require(_0x8682('0x9'));module[_0x8682('0xa')]=function(_0x13c75a,_0x1c0055){return _0x13c75a[_0x8682('0xb')](_0x8682('0xc'),attributes,{'tableName':_0x8682('0xd'),'paranoid':![],'indexes':[{'name':_0x8682('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 92f9c1b..d8fb078 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 _0xee1e=['http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c0317,_0x54e894){var _0x3fc8eb=function(_0xb8361a){while(--_0xb8361a){_0x2c0317['push'](_0x2c0317['shift']());}};_0x3fc8eb(++_0x54e894);}(_0xee1e,0x109));var _0xeee1=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0xee1e[_0x1b664d];return _0x43af6b;};'use strict';var _=require(_0xeee1('0x0'));var util=require('util');var moment=require(_0xeee1('0x1'));var BPromise=require(_0xeee1('0x2'));var rs=require(_0xeee1('0x3'));var fs=require('fs');var Redis=require(_0xeee1('0x4'));var db=require(_0xeee1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeee1('0x6'))(_0xeee1('0x7'));var config=require(_0xeee1('0x8'));var jayson=require(_0xeee1('0x9'));var client=jayson[_0xeee1('0xa')][_0xeee1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fc4b2,_0x2f8229,_0x28703e){return new BPromise(function(_0x5a4a9d,_0x138407){return client['request'](_0x3fc4b2,_0x28703e)[_0xeee1('0xc')](function(_0x376b2c){logger[_0xeee1('0xd')](_0xeee1('0xe'),_0x2f8229,_0xeee1('0xf'));logger[_0xeee1('0x10')](_0xeee1('0x11'),_0x2f8229,_0xeee1('0xf'),JSON[_0xeee1('0x12')](_0x376b2c));if(_0x376b2c[_0xeee1('0x13')]){if(_0x376b2c['error'][_0xeee1('0x14')]===0x1f4){logger[_0xeee1('0x13')](_0xeee1('0xe'),_0x2f8229,_0x376b2c[_0xeee1('0x13')][_0xeee1('0x15')]);return _0x138407(_0x376b2c[_0xeee1('0x13')][_0xeee1('0x15')]);}logger[_0xeee1('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x2f8229,_0x376b2c['error'][_0xeee1('0x15')]);return _0x5a4a9d(_0x376b2c[_0xeee1('0x13')][_0xeee1('0x15')]);}else{logger[_0xeee1('0xd')](_0xeee1('0xe'),_0x2f8229,_0xeee1('0xf'));_0x5a4a9d(_0x376b2c['result'][_0xeee1('0x15')]);}})[_0xeee1('0x16')](function(_0x269e25){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2f8229,_0x269e25);_0x138407(_0x269e25);});});} \ No newline at end of file +var _0xa28c=['request\x20sent','debug','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa28c,0x14a));var _0xca28=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xa28c[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xca28('0x0'));var util=require('util');var moment=require(_0xca28('0x1'));var BPromise=require(_0xca28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca28('0x3'));var db=require(_0xca28('0x4'))['db'];var utils=require(_0xca28('0x5'));var logger=require(_0xca28('0x6'))('rpc');var config=require(_0xca28('0x7'));var jayson=require(_0xca28('0x8'));var client=jayson[_0xca28('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba840e,_0x3d793f,_0x10f88d){return new BPromise(function(_0x4327a3,_0xfebb83){return client['request'](_0xba840e,_0x10f88d)['then'](function(_0xd7025e){logger[_0xca28('0xa')](_0xca28('0xb'),_0x3d793f,_0xca28('0xc'));logger[_0xca28('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x3d793f,_0xca28('0xc'),JSON[_0xca28('0xe')](_0xd7025e));if(_0xd7025e[_0xca28('0xf')]){if(_0xd7025e[_0xca28('0xf')][_0xca28('0x10')]===0x1f4){logger[_0xca28('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x3d793f,_0xd7025e[_0xca28('0xf')][_0xca28('0x11')]);return _0xfebb83(_0xd7025e[_0xca28('0xf')][_0xca28('0x11')]);}logger[_0xca28('0xf')](_0xca28('0xb'),_0x3d793f,_0xd7025e[_0xca28('0xf')][_0xca28('0x11')]);return _0x4327a3(_0xd7025e['error'][_0xca28('0x11')]);}else{logger['info'](_0xca28('0xb'),_0x3d793f,'request\x20sent');_0x4327a3(_0xd7025e['result'][_0xca28('0x11')]);}})['catch'](function(_0x4a4bb5){logger[_0xca28('0xf')](_0xca28('0xb'),_0x3d793f,_0x4a4bb5);_0xfebb83(_0x4a4bb5);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4bdcffe..9d933ef 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4b6470,_0x5d7257){var _0x5679f0=function(_0x4d3024){while(--_0x4d3024){_0x4b6470['push'](_0x4b6470['shift']());}};_0x5679f0(++_0x5d7257);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9708a66..c80db8a 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 _0x9a96=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','name','text','input','parse','getDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x1d750e,_0x4bde92){var _0x1daae5=function(_0x18d26a){while(--_0x18d26a){_0x1d750e['push'](_0x1d750e['shift']());}};_0x1daae5(++_0x4bde92);}(_0x9a96,0xd0));var _0x69a9=function(_0x5e33e1,_0xaf0b6f){_0x5e33e1=_0x5e33e1-0x0;var _0x1bfcc3=_0x9a96[_0x5e33e1];return _0x1bfcc3;};'use strict';var Sequelize=require(_0x69a9('0x0'));var rs=require(_0x69a9('0x1'));module[_0x69a9('0x2')]={'name':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'unique':_0x69a9('0x4')},'description':{'type':Sequelize[_0x69a9('0x3')]},'mapKey':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x5')},'mapKeyOffline':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x5')},'key':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0x6')},'customerAlias':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':_0x69a9('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x69a9('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':_0x69a9('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x69a9('0x3')]},'animation':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x69a9('0xb')]('rounded',_0x69a9('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xd')},'start_chat_button':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xe')},'header_offline':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xf')},'download_transcript':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x69a9('0x11')]},'closingQuestion':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0x14')},'placeholderMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0x16')},'closingMessageButton':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0xe')},'skipMessageButton':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x17')},'conditionAgreement':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x69a9('0x18'),_0x69a9('0x19')),'defaultValue':_0x69a9('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x69a9('0x1a'),'type':_0x69a9('0x1b'),'required':!![]},'props':{'title':_0x69a9('0x1a'),'helpText':''}},{'type':_0x69a9('0x1c'),'props':{'title':_0x69a9('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x69a9('0x1d')](this[_0x69a9('0x1e')]('onlineForm')):{};},'set':function(_0x56314f){return this['setDataValue'](_0x69a9('0x1f'),JSON[_0x69a9('0x20')](_0x56314f));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x69a9('0x20')]({'items':[{'type':_0x69a9('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x69a9('0x5'),'type':'email'},'variable':null},{'type':_0x69a9('0x21'),'config':{'placeholder':_0x69a9('0x22')},'props':{'title':_0x69a9('0x22'),'helpText':_0x69a9('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x69a9('0x1e')](_0x69a9('0x24'))?JSON[_0x69a9('0x1d')](this[_0x69a9('0x1e')](_0x69a9('0x24'))):{};},'set':function(_0x2672e9){return this[_0x69a9('0x25')]('offlineForm',JSON[_0x69a9('0x20')](_0x2672e9));}},'token':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':function(){return rs[_0x69a9('0x26')]();}},'autoclose':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x69a9('0x3')]},'forwardOffline':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x69a9('0x3')]},'waitingTitle':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x28')},'offlineMessageBody':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x17')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x69a9('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x69a9('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x69a9('0x3')]},'notificationTemplate':{'type':Sequelize[_0x69a9('0x11')],'defaultValue':function(){return _0x69a9('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2c')},'verticalAlignment':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x69a9('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x69a9('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':_0x69a9('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x69a9('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':_0x69a9('0x2f')},'systemAvatar':{'type':Sequelize[_0x69a9('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x69a9('0xa')],'defaultValue':![],'comment':_0x69a9('0x30'),'set':function(_0x587dee){if(!_0x587dee)this[_0x69a9('0x25')](_0x69a9('0x31'),null);this[_0x69a9('0x25')]('mandatoryDisposition',_0x587dee);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6753=['bottom_right','alternate','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','text','name','input','getDataValue','onlineForm','parse','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6753,0xa1));var _0x3675=function(_0x11b39e,_0x5d7e04){_0x11b39e=_0x11b39e-0x0;var _0x4a8729=_0x6753[_0x11b39e];return _0x4a8729;};'use strict';var Sequelize=require(_0x3675('0x0'));var rs=require(_0x3675('0x1'));module[_0x3675('0x2')]={'name':{'type':Sequelize[_0x3675('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3675('0x4')},'description':{'type':Sequelize[_0x3675('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x6')},'customerAlias':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':_0x3675('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':_0x3675('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':_0x3675('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3675('0x3')]},'animation':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3675('0xb')](_0x3675('0xc'),_0x3675('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0xe')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0xf')},'offline_chat_button':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x10')},'header_offline':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x11')},'download_transcript':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3675('0x13')]},'closingQuestion':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x15')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x16')},'placeholderMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x17')},'closingMessage':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x18')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x10')},'skipMessageButton':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x3675('0xb')](_0x3675('0x19'),_0x3675('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3675('0x13')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0x3675('0x1b'),'required':!![]},'props':{'title':_0x3675('0x1c'),'helpText':''}},{'type':_0x3675('0x1d'),'props':{'title':_0x3675('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3675('0x5'),'type':_0x3675('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3675('0x1e')](_0x3675('0x1f'))?JSON[_0x3675('0x20')](this[_0x3675('0x1e')](_0x3675('0x1f'))):{};},'set':function(_0x53f77e){return this['setDataValue'](_0x3675('0x1f'),JSON[_0x3675('0x21')](_0x53f77e));}},'offlineForm':{'type':Sequelize[_0x3675('0x13')],'defaultValue':function(){return JSON[_0x3675('0x21')]({'items':[{'type':_0x3675('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x3675('0x22'),'config':{'placeholder':_0x3675('0x23')},'props':{'title':'Comments','helpText':_0x3675('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x3675('0x1e')](_0x3675('0x25'))?JSON[_0x3675('0x20')](this['getDataValue']('offlineForm')):{};},'set':function(_0x3ab457){return this['setDataValue'](_0x3675('0x25'),JSON[_0x3675('0x21')](_0x3ab457));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3675('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3675('0x3')]},'forwardOffline':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x27')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x2c')},'sendUnmanaged':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3675('0x13')]},'showAgentAvatar':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3675('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3675('0x13')],'defaultValue':function(){return _0x3675('0x2d');}},'notificationSound':{'type':Sequelize[_0x3675('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3675('0x3')],'defaultValue':_0x3675('0x2f')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3675('0x30')},'defaultTitle':{'type':Sequelize[_0x3675('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3675('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3675('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3675('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3675('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3675('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x3675('0x13')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![],'comment':_0x3675('0x31'),'set':function(_0x11f775){if(!_0x11f775)this[_0x3675('0x32')]('mandatoryDispositionPauseId',null);this[_0x3675('0x32')](_0x3675('0x33'),_0x11f775);}},'vidaooEscalation':{'type':Sequelize[_0x3675('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3675('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 9096753..0a5b8d5 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 _0x718e=['Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','filename','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','sitepic','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','headers','chat','CmContact','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','List','account','applications','list','asc','Applications','cf-connecting-ip','x-forwarded-for','x-real-port','referer','browser','%s\x20%s','version','unknown','device','vendor','format','%s\x20%s\x20%s','type','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','firstName','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','some','server/files/chat/iframe.js','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','get','ChatWebsites','UserProfileResource','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','rawAttributes','filters','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId'];(function(_0x1786ab,_0x2dbb7c){var _0x25f463=function(_0x176a73){while(--_0x176a73){_0x1786ab['push'](_0x1786ab['shift']());}};_0x25f463(++_0x2dbb7c);}(_0x718e,0x1d4));var _0xe718=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x718e[_0x117821];return _0x4ae9ff;};'use strict';var pdf=require(_0xe718('0x0'));var emlformat=require(_0xe718('0x1'));var rimraf=require(_0xe718('0x2'));var zipdir=require(_0xe718('0x3'));var jsonpatch=require(_0xe718('0x4'));var rp=require(_0xe718('0x5'));var moment=require(_0xe718('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe718('0x7'));var path=require(_0xe718('0x8'));var sox=require(_0xe718('0x9'));var csv=require(_0xe718('0xa'));var ejs=require(_0xe718('0xb'));var fs=require('fs');var _=require(_0xe718('0xc'));var squel=require(_0xe718('0xd'));var crypto=require(_0xe718('0xe'));var jsforce=require(_0xe718('0xf'));var deskjs=require(_0xe718('0x10'));var toCsv=require(_0xe718('0xa'));var querystring=require('querystring');var Papa=require(_0xe718('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe718('0x12'));var as=require(_0xe718('0x13'));var hardwareService=require(_0xe718('0x14'));var logger=require(_0xe718('0x15'))(_0xe718('0x16'));var utils=require(_0xe718('0x17'));var config=require(_0xe718('0x18'));var licenseUtil=require(_0xe718('0x19'));var db=require(_0xe718('0x1a'))['db'];config['redis']=_[_0xe718('0x1b')](config[_0xe718('0x1c')],{'host':_0xe718('0x1d'),'port':0x18eb});var socket=require(_0xe718('0x1e'))(new Redis(config['redis']));require(_0xe718('0x1f'))[_0xe718('0x20')](socket);var jayson=require(_0xe718('0x21'));var client=jayson[_0xe718('0x22')][_0xe718('0x23')]({'port':0x232c});var client9002=jayson[_0xe718('0x22')][_0xe718('0x23')]({'port':0x232a});var client9003=jayson[_0xe718('0x22')][_0xe718('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x1a8352,_0x271c07,_0x55b376,_0x30e5c5){return new BPromise(function(_0x209a61,_0x1fe9f4){var _0x2a9a78=_0x30e5c5||client;return _0x2a9a78[_0xe718('0x24')](_0x1a8352,_0x55b376)['then'](function(_0x1fe942){logger[_0xe718('0x25')](_0xe718('0x26'),_0x271c07,'request\x20sent');logger[_0xe718('0x27')](_0xe718('0x28'),_0x271c07,_0xe718('0x29'),JSON[_0xe718('0x2a')](_0x1fe942));if(_0x1fe942[_0xe718('0x2b')]){if(_0x1fe942[_0xe718('0x2b')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x271c07,_0x1fe942[_0xe718('0x2b')][_0xe718('0x2c')]);return _0x1fe9f4(_0x1fe942[_0xe718('0x2b')]['message']);}logger[_0xe718('0x2b')](_0xe718('0x26'),_0x271c07,_0x1fe942[_0xe718('0x2b')]['message']);return _0x209a61(_0x1fe942[_0xe718('0x2b')][_0xe718('0x2c')]);}else{logger[_0xe718('0x25')](_0xe718('0x26'),_0x271c07,_0xe718('0x29'));_0x209a61(_0x1fe942[_0xe718('0x2d')][_0xe718('0x2c')]);}})[_0xe718('0x2e')](function(_0x5a00db){logger[_0xe718('0x2b')](_0xe718('0x26'),_0x271c07,_0x5a00db);_0x1fe9f4(_0x5a00db);});});}function respondWithStatusCode(_0x496ad1,_0x4933f5){_0x4933f5=_0x4933f5||0xcc;return function(_0x4828cd){if(_0x4828cd){return _0x496ad1[_0xe718('0x2f')](_0x4933f5);}return _0x496ad1[_0xe718('0x30')](_0x4933f5)['end']();};}function respondWithResult(_0x48c5cc,_0x4a6318){_0x4a6318=_0x4a6318||0xc8;return function(_0x466cd7){if(_0x466cd7){return _0x48c5cc[_0xe718('0x30')](_0x4a6318)[_0xe718('0x31')](_0x466cd7);}};}function respondWithFilteredResult(_0x5270ca,_0x119c3d){return function(_0x291fa9){if(_0x291fa9){var _0x21d534=_0x291fa9['count'],_0x123bb7=_0x119c3d[_0xe718('0x32')],_0x155f2c=_0x119c3d[_0xe718('0x32')]+_0x119c3d[_0xe718('0x33')],_0x3d5714;if(_0x155f2c>=_0x21d534){_0x155f2c=_0x21d534;_0x3d5714=0xc8;}else{_0x3d5714=0xce;}_0x5270ca['status'](_0x3d5714);return _0x5270ca['set'](_0xe718('0x34'),_0x123bb7+'-'+_0x155f2c+'/'+_0x21d534)[_0xe718('0x31')](_0x291fa9);}return null;};}function patchUpdates(_0x3d00b7){return function(_0x4852b3){try{jsonpatch['apply'](_0x4852b3,_0x3d00b7,!![]);}catch(_0x233acf){return BPromise[_0xe718('0x35')](_0x233acf);}return _0x4852b3[_0xe718('0x36')]();};}function saveUpdates(_0x51984a,_0x4ec900){return function(_0x42ce34){if(_0x42ce34){return _0x42ce34[_0xe718('0x37')](_0x51984a)[_0xe718('0x38')](function(_0x133d27){return _0x133d27;});}return null;};}function removeEntity(_0x4ca928,_0x2f67d7){return function(_0x3a6230){if(_0x3a6230){return _0x3a6230['destroy']()[_0xe718('0x38')](function(){var _0x25cdab=_0x3a6230[_0xe718('0x39')]({'plain':!![]});var _0x2ad577=_0xe718('0x3a');return db[_0xe718('0x3b')][_0xe718('0x3c')]({'where':{'type':_0x2ad577,'resourceId':_0x25cdab['id']}})[_0xe718('0x38')](function(){return _0x3a6230;});})[_0xe718('0x38')](function(){_0x4ca928[_0xe718('0x30')](0xcc)[_0xe718('0x3d')]();});}};}function handleEntityNotFound(_0x39dde8,_0xc7dbe1){return function(_0x58f2bd){if(!_0x58f2bd){_0x39dde8[_0xe718('0x2f')](0x194);}return _0x58f2bd;};}function handleError(_0x380e90,_0x565b90){_0x565b90=_0x565b90||0x1f4;return function(_0x40bf2e){logger[_0xe718('0x2b')](_0x40bf2e[_0xe718('0x3e')]);if(_0x40bf2e[_0xe718('0x3f')]){delete _0x40bf2e[_0xe718('0x3f')];}_0x380e90[_0xe718('0x30')](_0x565b90)[_0xe718('0x40')](_0x40bf2e);};}exports['index']=function(_0x54f9f3,_0xc6c2db){var _0x2c473f={'include':[{'model':db[_0xe718('0x41')],'as':_0xe718('0x42')}]},_0x11d2f3={},_0x4dbec5={'count':0x0,'rows':[]};var _0x48e4f0=_[_0xe718('0x43')](db[_0xe718('0x44')]['rawAttributes'],function(_0x33f189){return{'name':_0x33f189[_0xe718('0x45')],'type':_0x33f189['type'][_0xe718('0x46')]};});_0x11d2f3[_0xe718('0x47')]=_['map'](_0x48e4f0,_0xe718('0x3f'));_0x11d2f3[_0xe718('0x48')]=_[_0xe718('0x49')](_0x54f9f3[_0xe718('0x48')]);_0x11d2f3['filters']=_['intersection'](_0x11d2f3[_0xe718('0x47')],_0x11d2f3[_0xe718('0x48')]);_0x2c473f[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x11d2f3[_0xe718('0x47')],qs['fields'](_0x54f9f3[_0xe718('0x48')][_0xe718('0x4c')]));_0x2c473f['attributes']=_0x2c473f[_0xe718('0x4a')][_0xe718('0x4d')]?_0x2c473f[_0xe718('0x4a')]:_0x11d2f3[_0xe718('0x47')];if(!_0x54f9f3['query'][_0xe718('0x4e')]('nolimit')){_0x2c473f[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x54f9f3['query'][_0xe718('0x33')]);_0x2c473f[_0xe718('0x32')]=qs['offset'](_0x54f9f3['query']['offset']);}_0x2c473f[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x54f9f3['query'][_0xe718('0x50')]);_0x2c473f[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x54f9f3[_0xe718('0x48')],_0x11d2f3['filters']),_0x48e4f0);if(_0x54f9f3['query'][_0xe718('0x53')]){_0x2c473f['where']=_[_0xe718('0x54')](_0x2c473f['where'],{'$or':_['map'](_0x48e4f0,function(_0x4ff4a7){if(_0x4ff4a7['type']!==_0xe718('0x55')){var _0x5e3d9a={};_0x5e3d9a[_0x4ff4a7[_0xe718('0x3f')]]={'$like':'%'+_0x54f9f3['query'][_0xe718('0x53')]+'%'};return _0x5e3d9a;}})});}_0x2c473f=_['merge']({},_0x2c473f,_0x54f9f3[_0xe718('0x56')]);var _0x96de2f={'where':_0x2c473f[_0xe718('0x51')]};return db['ChatWebsite'][_0xe718('0x57')](_0x96de2f)[_0xe718('0x38')](function(_0xba2192){_0x4dbec5[_0xe718('0x57')]=_0xba2192;if(_0x54f9f3[_0xe718('0x48')]['includeAll']){_0x2c473f[_0xe718('0x58')]=[{'all':!![]}];}return db['ChatWebsite'][_0xe718('0x59')](_0x2c473f);})[_0xe718('0x38')](function(_0x30d1c0){_0x4dbec5['rows']=_0x30d1c0;return _0x4dbec5;})[_0xe718('0x38')](respondWithFilteredResult(_0xc6c2db,_0x2c473f))[_0xe718('0x2e')](handleError(_0xc6c2db,null));};exports[_0xe718('0x5a')]=function(_0x4c5850,_0x55e111){var _0x529130={'raw':![],'where':{'id':_0x4c5850[_0xe718('0x5b')]['id']},'include':[{'model':db[_0xe718('0x41')],'as':_0xe718('0x42')}]},_0x40cf2e={};_0x40cf2e[_0xe718('0x47')]=_[_0xe718('0x49')](db['ChatWebsite'][_0xe718('0x5c')]);_0x40cf2e[_0xe718('0x48')]=_[_0xe718('0x49')](_0x4c5850[_0xe718('0x48')]);_0x40cf2e[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x40cf2e[_0xe718('0x47')],_0x40cf2e[_0xe718('0x48')]);_0x529130[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x40cf2e['model'],qs['fields'](_0x4c5850[_0xe718('0x48')][_0xe718('0x4c')]));_0x529130['attributes']=_0x529130[_0xe718('0x4a')]['length']?_0x529130[_0xe718('0x4a')]:_0x40cf2e[_0xe718('0x47')];if(_0x4c5850[_0xe718('0x48')][_0xe718('0x5e')]){_0x529130['include']=[{'all':!![]}];}_0x529130=_[_0xe718('0x54')]({},_0x529130,_0x4c5850[_0xe718('0x56')]);return db['ChatWebsite'][_0xe718('0x5f')](_0x529130)[_0xe718('0x38')](handleEntityNotFound(_0x55e111,null))[_0xe718('0x38')](respondWithResult(_0x55e111,null))[_0xe718('0x2e')](handleError(_0x55e111,null));};exports['create']=function(_0x300191,_0x45ee96){return db[_0xe718('0x44')][_0xe718('0x60')](_0x300191[_0xe718('0x61')],{})[_0xe718('0x38')](function(_0x32d491){var _0x210c85=_0x300191[_0xe718('0x62')][_0xe718('0x39')]({'plain':!![]});if(!_0x210c85)throw new Error(_0xe718('0x63'));if(_0x210c85[_0xe718('0x64')]===_0xe718('0x62')){var _0x436390=_0x32d491[_0xe718('0x39')]({'plain':!![]});var _0x4e91fa=_0xe718('0x3a');return db[_0xe718('0x65')][_0xe718('0x5f')]({'where':{'name':_0x4e91fa,'userProfileId':_0x210c85[_0xe718('0x66')]},'raw':!![]})[_0xe718('0x38')](function(_0x38dda8){if(_0x38dda8&&_0x38dda8['autoAssociation']===0x0){return db[_0xe718('0x3b')][_0xe718('0x60')]({'name':_0x436390['name'],'resourceId':_0x436390['id'],'type':_0x38dda8[_0xe718('0x3f')],'sectionId':_0x38dda8['id']},{})[_0xe718('0x38')](function(){return _0x32d491;});}else{return _0x32d491;}})[_0xe718('0x2e')](function(_0x49a630){logger[_0xe718('0x2b')](_0xe718('0x67'),_0x49a630);throw _0x49a630;});}return _0x32d491;})['then'](respondWithResult(_0x45ee96,0xc9))['catch'](handleError(_0x45ee96,null));};exports[_0xe718('0x37')]=function(_0x48139e,_0xfd5d2f){if(_0x48139e['body']['id']){delete _0x48139e[_0xe718('0x61')]['id'];}return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x48139e[_0xe718('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xe718('0x38')](handleEntityNotFound(_0xfd5d2f,null))[_0xe718('0x38')](saveUpdates(_0x48139e['body'],null))[_0xe718('0x38')](respondWithResult(_0xfd5d2f,null))[_0xe718('0x2e')](handleError(_0xfd5d2f,null));};exports[_0xe718('0x3c')]=function(_0x2a0319,_0x37e96c){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x2a0319[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x37e96c,null))[_0xe718('0x38')](removeEntity(_0x37e96c,null))[_0xe718('0x2e')](handleError(_0x37e96c,null));};exports[_0xe718('0x68')]=function(_0x388330,_0x26c8bd){return db[_0xe718('0x44')][_0xe718('0x68')]()[_0xe718('0x38')](respondWithResult(_0x26c8bd,null))[_0xe718('0x2e')](handleError(_0x26c8bd,null));};exports['addDisposition']=function(_0x27eb97,_0x2c1e53,_0x2530ef){if(_0x27eb97[_0xe718('0x61')]['id']){delete _0x27eb97['body']['id'];}return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x27eb97[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x2c1e53,null))[_0xe718('0x38')](function(_0x1ea279){if(_0x1ea279){_0x27eb97[_0xe718('0x61')][_0xe718('0x69')]=_0x1ea279['id'];return db[_0xe718('0x6a')][_0xe718('0x60')](_0x27eb97[_0xe718('0x61')]);}})[_0xe718('0x38')](respondWithResult(_0x2c1e53,null))[_0xe718('0x2e')](handleError(_0x2c1e53,null));};exports[_0xe718('0x6b')]=function(_0x574e24,_0x473a05,_0x3742a0){var _0x43445f={'raw':![],'where':{}};var _0x44f182={};var _0x47e179={'count':0x0,'rows':[]};return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x574e24[_0xe718('0x5b')]['id']}})['then'](handleEntityNotFound(_0x473a05,null))[_0xe718('0x38')](function(_0x45bd1c){if(_0x45bd1c){_0x44f182['model']=_['keys'](db['Disposition']['rawAttributes']);_0x44f182['query']=_[_0xe718('0x49')](_0x574e24[_0xe718('0x48')]);_0x44f182['filters']=_['intersection'](_0x44f182[_0xe718('0x47')],_0x44f182[_0xe718('0x48')]);_0x43445f['attributes']=_['intersection'](_0x44f182['model'],qs[_0xe718('0x4c')](_0x574e24['query'][_0xe718('0x4c')]));_0x43445f[_0xe718('0x4a')]=_0x43445f['attributes'][_0xe718('0x4d')]?_0x43445f['attributes']:_0x44f182[_0xe718('0x47')];if(!_0x574e24[_0xe718('0x48')][_0xe718('0x4e')](_0xe718('0x6d'))){_0x43445f[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x574e24[_0xe718('0x48')][_0xe718('0x33')]);_0x43445f[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x574e24[_0xe718('0x48')][_0xe718('0x32')]);}_0x43445f['order']=qs[_0xe718('0x50')](_0x574e24[_0xe718('0x48')]['sort']);_0x43445f[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x574e24['query'],_0x44f182[_0xe718('0x5d')]));_0x43445f[_0xe718('0x51')][_0xe718('0x69')]=_0x45bd1c['id'];if(_0x574e24['query'][_0xe718('0x53')]){_0x43445f['where']=_['merge'](_0x43445f[_0xe718('0x51')],{'$or':_[_0xe718('0x43')](_0x43445f[_0xe718('0x4a')],function(_0x3a405e){var _0xe682fc={};_0xe682fc[_0x3a405e]={'$like':'%'+_0x574e24[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0xe682fc;})});}_0x43445f=_[_0xe718('0x54')]({},_0x43445f,_0x574e24['options']);return db[_0xe718('0x6a')]['count']({'where':_0x43445f[_0xe718('0x51')]})[_0xe718('0x38')](function(_0x4160b9){_0x47e179[_0xe718('0x57')]=_0x4160b9;if(_0x574e24[_0xe718('0x48')][_0xe718('0x5e')]){_0x43445f[_0xe718('0x58')]=[{'all':!![]}];}return db[_0xe718('0x6a')][_0xe718('0x59')](_0x43445f);})[_0xe718('0x38')](function(_0x3e7a4b){_0x47e179[_0xe718('0x6e')]=_0x3e7a4b;return _0x47e179;});}})['then'](respondWithFilteredResult(_0x473a05,_0x43445f))['catch'](handleError(_0x473a05,null));};exports[_0xe718('0x6f')]=function(_0x3ca2b6,_0x9904cd,_0x11628a){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x3ca2b6[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x9904cd,null))[_0xe718('0x38')](function(_0x499057){if(_0x499057){return _0x499057[_0xe718('0x6f')](_0x3ca2b6[_0xe718('0x48')][_0xe718('0x70')]);}})[_0xe718('0x38')](respondWithStatusCode(_0x9904cd,null))['catch'](handleError(_0x9904cd,null));};exports['addAnswer']=function(_0x4a0390,_0x23f7df,_0x17ad06){if(_0x4a0390[_0xe718('0x61')]['id']){delete _0x4a0390[_0xe718('0x61')]['id'];}return db['ChatWebsite'][_0xe718('0x5f')]({'where':{'id':_0x4a0390[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x23f7df,null))[_0xe718('0x38')](function(_0x90709b){if(_0x90709b){_0x4a0390[_0xe718('0x61')][_0xe718('0x69')]=_0x90709b['id'];return db['CannedAnswer']['create'](_0x4a0390[_0xe718('0x61')]);}})['then'](respondWithResult(_0x23f7df,null))['catch'](handleError(_0x23f7df,null));};exports[_0xe718('0x71')]=function(_0x13cf69,_0x3d80bb,_0x53e720){var _0x4d3e48={'raw':![],'where':{}};var _0x376f0f={};var _0x27a89e={'count':0x0,'rows':[]};return db[_0xe718('0x44')]['findOne']({'where':{'id':_0x13cf69[_0xe718('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d80bb,null))['then'](function(_0x3f5a83){if(_0x3f5a83){_0x376f0f['model']=_[_0xe718('0x49')](db[_0xe718('0x72')][_0xe718('0x5c')]);_0x376f0f[_0xe718('0x48')]=_[_0xe718('0x49')](_0x13cf69[_0xe718('0x48')]);_0x376f0f[_0xe718('0x5d')]=_['intersection'](_0x376f0f[_0xe718('0x47')],_0x376f0f[_0xe718('0x48')]);_0x4d3e48['attributes']=_[_0xe718('0x4b')](_0x376f0f[_0xe718('0x47')],qs[_0xe718('0x4c')](_0x13cf69[_0xe718('0x48')][_0xe718('0x4c')]));_0x4d3e48[_0xe718('0x4a')]=_0x4d3e48['attributes'][_0xe718('0x4d')]?_0x4d3e48[_0xe718('0x4a')]:_0x376f0f[_0xe718('0x47')];if(!_0x13cf69[_0xe718('0x48')][_0xe718('0x4e')](_0xe718('0x6d'))){_0x4d3e48[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x13cf69[_0xe718('0x48')]['limit']);_0x4d3e48[_0xe718('0x32')]=qs['offset'](_0x13cf69[_0xe718('0x48')]['offset']);}_0x4d3e48[_0xe718('0x4f')]=qs['sort'](_0x13cf69[_0xe718('0x48')][_0xe718('0x50')]);_0x4d3e48[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x13cf69[_0xe718('0x48')],_0x376f0f['filters']));_0x4d3e48[_0xe718('0x51')][_0xe718('0x69')]=_0x3f5a83['id'];if(_0x13cf69[_0xe718('0x48')][_0xe718('0x53')]){_0x4d3e48['where']=_[_0xe718('0x54')](_0x4d3e48[_0xe718('0x51')],{'$or':_['map'](_0x4d3e48[_0xe718('0x4a')],function(_0x68525a){var _0x19705c={};_0x19705c[_0x68525a]={'$like':'%'+_0x13cf69[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x19705c;})});}_0x4d3e48=_[_0xe718('0x54')]({},_0x4d3e48,_0x13cf69[_0xe718('0x56')]);return db[_0xe718('0x72')][_0xe718('0x57')]({'where':_0x4d3e48[_0xe718('0x51')]})[_0xe718('0x38')](function(_0x176141){_0x27a89e[_0xe718('0x57')]=_0x176141;if(_0x13cf69[_0xe718('0x48')][_0xe718('0x5e')]){_0x4d3e48['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe718('0x59')](_0x4d3e48);})[_0xe718('0x38')](function(_0x5aa335){_0x27a89e['rows']=_0x5aa335;return _0x27a89e;});}})[_0xe718('0x38')](respondWithFilteredResult(_0x3d80bb,_0x4d3e48))['catch'](handleError(_0x3d80bb,null));};exports[_0xe718('0x73')]=function(_0x4b976c,_0x36ef20,_0x4a8d41){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x4b976c[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x36ef20,null))[_0xe718('0x38')](function(_0x10986a){if(_0x10986a){return _0x10986a[_0xe718('0x73')](_0x4b976c[_0xe718('0x48')][_0xe718('0x70')]);}})['then'](respondWithStatusCode(_0x36ef20,null))['catch'](handleError(_0x36ef20,null));};exports[_0xe718('0x74')]=function(_0x423aca,_0x529ab1,_0x520191){_0x423aca[_0xe718('0x61')]['sitepic']=_0x423aca[_0xe718('0x75')]['filename'];return db[_0xe718('0x44')]['find']({'where':{'id':_0x423aca['params']['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x529ab1,null))[_0xe718('0x38')](saveUpdates(_0x423aca[_0xe718('0x61')],null))[_0xe718('0x38')](respondWithResult(_0x529ab1,null))[_0xe718('0x2e')](handleError(_0x529ab1,null));};exports[_0xe718('0x76')]=function(_0x411171,_0xf15a9f,_0x247747){_0x411171[_0xe718('0x61')][_0xe718('0x77')]=_0x411171[_0xe718('0x75')]['filename'];return db[_0xe718('0x44')]['find']({'where':{'id':_0x411171[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0xf15a9f,null))[_0xe718('0x38')](saveUpdates(_0x411171[_0xe718('0x61')],null))['then'](respondWithResult(_0xf15a9f,null))[_0xe718('0x2e')](handleError(_0xf15a9f,null));};exports[_0xe718('0x78')]=function(_0x5bb785,_0x2c5cac,_0x3f3c59){_0x5bb785['body'][_0xe718('0x79')]=_0x5bb785[_0xe718('0x75')][_0xe718('0x7a')];return db[_0xe718('0x44')]['find']({'where':{'id':_0x5bb785[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x2c5cac,null))[_0xe718('0x38')](saveUpdates(_0x5bb785[_0xe718('0x61')],null))[_0xe718('0x38')](respondWithResult(_0x2c5cac,null))[_0xe718('0x2e')](handleError(_0x2c5cac,null));};exports['addSystemAvatar']=function(_0x3d637d,_0x1cd3bf,_0x91f145){_0x3d637d[_0xe718('0x61')][_0xe718('0x7b')]=_0x3d637d[_0xe718('0x75')]['filename'];return db[_0xe718('0x44')]['find']({'where':{'id':_0x3d637d['params']['id']}})['then'](handleEntityNotFound(_0x1cd3bf,null))['then'](saveUpdates(_0x3d637d[_0xe718('0x61')],null))['then'](respondWithResult(_0x1cd3bf,null))[_0xe718('0x2e')](handleError(_0x1cd3bf,null));};exports[_0xe718('0x7c')]=function(_0x2ae3d3,_0x13ed3b,_0xc05a4f){var _0x11143a=path[_0xe718('0x7d')](config['root'],_0xe718('0x7e'));var _0x33bc05={'where':{'id':_0x2ae3d3[_0xe718('0x5b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xe59147=![];return require(_0xe718('0x19'))[_0xe718('0x7f')]()[_0xe718('0x38')](function(_0xf531c9){if(_0xf531c9){_0xe59147=_0xf531c9[_0xe718('0x80')];}})[_0xe718('0x38')](function(){return db['ChatWebsite'][_0xe718('0x5f')](_0x33bc05);})[_0xe718('0x38')](handleEntityNotFound(_0x13ed3b,null))['then'](function(_0x52ea1f){if(_0x52ea1f){if(!_[_0xe718('0x81')](_0x52ea1f[_0xe718('0x82')])){if(fs[_0xe718('0x83')](path['join'](config[_0xe718('0x84')],_0xe718('0x85'),_0x52ea1f[_0xe718('0x82')]))&&_0xe59147){_0x11143a=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x85'),_0x52ea1f['sitepic']);}}return _0x13ed3b[_0xe718('0x86')](_0x11143a);}})[_0xe718('0x2e')](handleError(_0x13ed3b,null));};exports[_0xe718('0x87')]=function(_0x134e38,_0x50c80d,_0x23bbbe){var _0x385418=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x88'));var _0x42e0c9={'where':{'id':_0x134e38[_0xe718('0x5b')]['id']},'attributes':['id',_0xe718('0x77')],'raw':!![]};return db[_0xe718('0x44')]['find'](_0x42e0c9)['then'](handleEntityNotFound(_0x50c80d,null))[_0xe718('0x38')](function(_0x90a562){if(_0x90a562){if(!_[_0xe718('0x81')](_0x90a562['agentAvatar'])){if(fs[_0xe718('0x83')](path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x89'),_0x90a562[_0xe718('0x77')]))){_0x385418=path[_0xe718('0x7d')](config[_0xe718('0x84')],'server/files/images/avatars/',_0x90a562[_0xe718('0x77')]);}}return _0x50c80d['download'](_0x385418);}})[_0xe718('0x2e')](handleError(_0x50c80d,null));};exports[_0xe718('0x8a')]=function(_0x4f7525,_0x3d5b83,_0x434ccb){var _0x49db00=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x8b'));var _0x230dea={'where':{'id':_0x4f7525[_0xe718('0x5b')]['id']},'attributes':['id',_0xe718('0x79'),'showCustomerAvatar'],'raw':!![]};return db[_0xe718('0x44')][_0xe718('0x5f')](_0x230dea)[_0xe718('0x38')](handleEntityNotFound(_0x3d5b83,null))['then'](function(_0x2bf596){if(_0x2bf596){if(!_[_0xe718('0x81')](_0x2bf596['customerAvatar'])){if(fs[_0xe718('0x83')](path[_0xe718('0x7d')](config['root'],_0xe718('0x89'),_0x2bf596[_0xe718('0x79')]))&&_0x2bf596[_0xe718('0x8c')]){_0x49db00=path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x89'),_0x2bf596[_0xe718('0x79')]);}}return _0x3d5b83['download'](_0x49db00);}})[_0xe718('0x2e')](handleError(_0x3d5b83,null));};exports[_0xe718('0x8d')]=function(_0x48d46b,_0x5af1c7,_0x2bd464){var _0x4fd805=path['join'](config[_0xe718('0x84')],'server/files/images/avatars/system_avatar.png');var _0x385bf4={'where':{'id':_0x48d46b[_0xe718('0x5b')]['id']},'attributes':['id',_0xe718('0x7b')],'raw':!![]};return db[_0xe718('0x44')][_0xe718('0x5f')](_0x385bf4)['then'](handleEntityNotFound(_0x5af1c7,null))['then'](function(_0x490a78){if(_0x490a78){if(!_[_0xe718('0x81')](_0x490a78['systemAvatar'])){if(fs[_0xe718('0x83')](path[_0xe718('0x7d')](config[_0xe718('0x84')],'server/files/images/avatars/',_0x490a78[_0xe718('0x7b')]))){_0x4fd805=path[_0xe718('0x7d')](config['root'],_0xe718('0x89'),_0x490a78['systemAvatar']);}}return _0x5af1c7[_0xe718('0x86')](_0x4fd805);}})[_0xe718('0x2e')](handleError(_0x5af1c7,null));};exports[_0xe718('0x8e')]=function(_0x2f35ba,_0x4db480,_0x4bb2a8){var _0x536b13=require(_0xe718('0x8f'));var _0x3e276e=new _0x536b13();var _0x4b6c1b=_0x3e276e['setUA'](_0x2f35ba[_0xe718('0x90')]['user-agent'])['getResult']();var _0x49664b={'body':_0x2f35ba['body'],'channel':_0xe718('0x91')};var _0x2f68bf=[];var _0x49c9ae=[];var _0x3023d5={};var _0x32ccfb=![];return db[_0xe718('0x92')][_0xe718('0x68')]()[_0xe718('0x38')](function(_0xc177ba){if(!_0xc177ba){throw new db['Sequelize'][(_0xe718('0x93'))]('no\x20available\x20attributes');}_0x2f68bf=_[_0xe718('0x94')](_[_0xe718('0x49')](_0xc177ba),['createdAt',_0xe718('0x95')]);_0x49c9ae=_[_0xe718('0x94')](_[_0xe718('0x49')](_0xc177ba),[_0xe718('0x96'),'updatedAt',_0xe718('0x97'),_0xe718('0x98')]);if(_0x2f35ba[_0xe718('0x61')]['id']){delete _0x2f35ba['body']['id'];}if(_['isNil'](_0x2f35ba[_0xe718('0x61')][_0xe718('0x99')])){throw new db['Sequelize']['ValidationError'](_0xe718('0x9a'));}if(_[_0xe718('0x81')](_0x2f35ba[_0xe718('0x61')][_0xe718('0x61')])||_0x2f35ba[_0xe718('0x61')][_0xe718('0x61')]===''){throw new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0x9c'));}if(_[_0xe718('0x81')](_0x2f35ba[_0xe718('0x61')][_0xe718('0x9d')])){throw new db['Sequelize'][(_0xe718('0x93'))](_0xe718('0x9e')+_0x49c9ae);}if(!_[_0xe718('0x9f')](_0x49c9ae,_0x2f35ba['body'][_0xe718('0x9d')])){throw new db['Sequelize'][(_0xe718('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49c9ae);}_0x3023d5[_0x2f35ba[_0xe718('0x61')][_0xe718('0x9d')]]=_0x2f35ba[_0xe718('0x61')][_0xe718('0x99')];})[_0xe718('0x38')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2f35ba[_0xe718('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe718('0x92')],'as':_0xe718('0xa0'),'where':_0x3023d5,'limit':0x1,'order':[['updatedAt',_0xe718('0xa1')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x4db480,null))[_0xe718('0x38')](function(_0x181041){if(_0x181041&&_0x181041[_0xe718('0xa2')]){_0x49664b[_0xe718('0xa3')]=_0x181041;_0x49664b[_0xe718('0xa4')]=_0x181041['Applications'];_0x49664b[_0xe718('0xa5')]=_0x181041['List'];_0x49664b[_0xe718('0xa4')]=_['orderBy'](_0x49664b['applications'],['priority'],[_0xe718('0xa6')]);if(_0x49664b[_0xe718('0xa3')]['Applications']){delete _0x49664b['account'][_0xe718('0xa7')];}if(_0x49664b['account'][_0xe718('0xa2')]&&_0x49664b[_0xe718('0xa3')][_0xe718('0xa2')][_0xe718('0xa0')][_0xe718('0x4d')]){return _0x49664b[_0xe718('0xa3')]['List'][_0xe718('0xa0')][0x0];}var _0x479b3d=_[_0xe718('0x1b')](_0x2f35ba[_0xe718('0x61')],{'firstName':_0x2f35ba['body'][_0xe718('0x99')],'ListId':_0x181041['ListId']});_0x479b3d[_0x2f35ba[_0xe718('0x61')][_0xe718('0x9d')]]=_0x2f35ba[_0xe718('0x61')][_0xe718('0x99')];return db['CmContact'][_0xe718('0x60')](_0x479b3d,{'fields':_0x2f68bf,'raw':!![]});}})[_0xe718('0x38')](handleEntityNotFound(_0x4db480,null))[_0xe718('0x38')](function(_0x40a68a){_0x49664b['contact']=_0x40a68a;var _0x6d1b82=_0x2f35ba[_0xe718('0x61')]['customerIp'];if(_0x2f35ba['headers'][_0xe718('0xa8')]){_0x6d1b82=_0x2f35ba['headers'][_0xe718('0xa8')];}else if(_0x2f35ba[_0xe718('0x90')][_0xe718('0xa9')]){_0x6d1b82=_['first'](_0x2f35ba['headers'][_0xe718('0xa9')]['split'](','));}if(_0x40a68a){var _0x4377fd={'ContactId':_0x40a68a['id'],'ChatWebsiteId':_0x2f35ba[_0xe718('0x5b')]['id'],'from':(_0x40a68a['firstName']||'')+'\x20'+(_0x40a68a['lastName']||''),'customerIp':_0x6d1b82,'customerPort':_0x2f35ba[_0xe718('0x90')][_0xe718('0xaa')]?_0x2f35ba[_0xe718('0x90')][_0xe718('0xaa')]:null,'referer':_0x2f35ba[_0xe718('0x61')][_0xe718('0xab')],'browserName':_0x4b6c1b[_0xe718('0xac')]['name']&&_0x4b6c1b[_0xe718('0xac')]['version']?util['format'](_0xe718('0xad'),_0x4b6c1b[_0xe718('0xac')][_0xe718('0x3f')],_0x4b6c1b[_0xe718('0xac')][_0xe718('0xae')]):_0xe718('0xaf'),'browserVersion':_0x4b6c1b[_0xe718('0xac')][_0xe718('0xae')]||_0xe718('0xaf'),'osName':util['format']('%s\x20%s',_0x4b6c1b['os'][_0xe718('0x3f')],_0x4b6c1b['os'][_0xe718('0xae')]),'osVersion':_0x4b6c1b['os'][_0xe718('0xae')],'deviceModel':_0x4b6c1b[_0xe718('0xb0')][_0xe718('0x47')]&&_0x4b6c1b[_0xe718('0xb0')][_0xe718('0xb1')]?util[_0xe718('0xb2')](_0xe718('0xb3'),_0x4b6c1b[_0xe718('0xb0')][_0xe718('0x47')],_0x4b6c1b['device']['vendor'],_0x4b6c1b[_0xe718('0xb0')][_0xe718('0xb4')]):null,'deviceVendor':_0x4b6c1b['device']['vendor'],'deviceType':_0x4b6c1b[_0xe718('0xb0')][_0xe718('0xb4')],'formData':JSON[_0xe718('0x2a')](_0x2f35ba[_0xe718('0x61')])};var _0x17dedb={'ChatWebsiteId':_0x2f35ba[_0xe718('0x5b')]['id'],'closed':![]};if(_0x2f35ba[_0xe718('0x61')]['threadId']){_0x17dedb[_0xe718('0xb5')]=_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')];return db['ChatInteraction'][_0xe718('0x5f')]({'where':_0x17dedb})['then'](function(_0x345752){if(_0x345752){return[_0x345752,![]];}_0x4377fd[_0xe718('0xb5')]=_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')];_0x4377fd[_0xe718('0xb6')]=_0x2f35ba['body'][_0xe718('0xb6')];return db[_0xe718('0xb7')][_0xe718('0x60')](_0x4377fd)[_0xe718('0x38')](function(_0x183e03){return[_0x183e03,!![]];});});}_0x17dedb[_0xe718('0xb8')]=_0x40a68a['id'];if(_0x2f35ba[_0xe718('0x61')][_0xe718('0xb9')]&&_0x2f35ba[_0xe718('0x61')]['interaction']['id']){_0x17dedb['id']=_0x2f35ba['body'][_0xe718('0xb9')]['id'];return db[_0xe718('0xb7')][_0xe718('0x5f')]({'where':_0x17dedb})[_0xe718('0x38')](function(_0x5a3e0d){if(_0x5a3e0d){return[_0x5a3e0d,![]];}return db[_0xe718('0xb7')][_0xe718('0x60')](_0x4377fd)[_0xe718('0x38')](function(_0x1299c6){return[_0x1299c6,!![]];});});}return db[_0xe718('0xb7')]['create'](_0x4377fd)[_0xe718('0x38')](function(_0x26d8b6){return[_0x26d8b6,!![]];});}})[_0xe718('0xba')](function(_0xb62386,_0x27e1a1){if(_0xb62386){_0x32ccfb=_0x27e1a1;if(!_0x27e1a1){var _0xeac610={'from':(_0x49664b['contact'][_0xe718('0xbb')]||'')+'\x20'+(_0x49664b[_0xe718('0xbc')][_0xe718('0xbd')]||'')};if(_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')]&&_0x2f35ba[_0xe718('0x61')]['messageId']&&_0x2f35ba[_0xe718('0x61')][_0xe718('0xb5')]!=_0x2f35ba[_0xe718('0x61')]['messageId']){_0xeac610['threadId']=_0x2f35ba[_0xe718('0x61')][_0xe718('0xbe')];}return _0xb62386[_0xe718('0x37')](_0xeac610);}else{return _0xb62386;}}})[_0xe718('0x38')](function(_0x426a36){_0x49664b[_0xe718('0xb9')]=_0x426a36['get']({'plain':!![]});_0x49664b[_0xe718('0xb9')][_0xe718('0xbf')]=_0x32ccfb;if(_0x49664b['interaction']['created']){if(_0x49664b[_0xe718('0xa3')][_0xe718('0xc0')]){_0x49664b[_0xe718('0xa4')][_0xe718('0xc1')]({'id':0x0,'priority':_0x49664b[_0xe718('0xa4')][_0xe718('0x4d')]+0x1,'app':_0xe718('0xc2'),'appdata':_0xe718('0xc3'),'interval':_0xe718('0xc4')});}}return db[_0xe718('0xc5')][_0xe718('0x60')]({'body':_0x2f35ba[_0xe718('0x61')][_0xe718('0x61')],'ChatWebsiteId':_0x2f35ba[_0xe718('0x5b')]['id'],'ChatInteractionId':_0x426a36['id'],'direction':'in','ContactId':_0x49664b['contact']['id'],'AttachmentId':_0x2f35ba[_0xe718('0x61')][_0xe718('0xc6')]});})['then'](function(_0x4a3ae2){_0x49664b[_0xe718('0x2c')]=_0x4a3ae2;if(_0x49664b[_0xe718('0xb9')][_0xe718('0xc7')]){return db[_0xe718('0xc8')][_0xe718('0x5f')]({'attributes':['id',_0xe718('0x3f')],'where':{'id':_0x49664b[_0xe718('0xb9')][_0xe718('0xc7')]}})[_0xe718('0x38')](function(_0x1a12cb){if(_0x1a12cb){_0x49664b[_0xe718('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe718('0xc9'),'appdata':_0x1a12cb[_0xe718('0x3f')]+','+(_0x49664b[_0xe718('0xa3')][_0xe718('0xca')]||0xa),'interval':'*,*,*,*'});_0x49664b['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xe718('0xcb'),_0x49664b);});}return respondWithRpcPromise(_0xe718('0xcc'),_0xe718('0xcb'),_0x49664b);})[_0xe718('0x38')](function(_0x395551){respondWithRpcPromise(_0xe718('0xcd'),_0xe718('0xcd'),{'event':_0xe718('0x8e'),'message':_0x395551},client9002);return _0x395551;})[_0xe718('0x38')](respondWithResult(_0x4db480,null))[_0xe718('0x2e')](handleError(_0x4db480,null));};exports[_0xe718('0xce')]=function(_0x62f01b,_0x41353c,_0x470b56){var _0x433b85,_0x58d030,_0x26865d;var _0xb7eb7b=[];var _0x26d667=[];var _0x5af3fc={};return db[_0xe718('0x92')][_0xe718('0x68')]()[_0xe718('0x38')](function(_0x5eac43){if(!_0x5eac43){throw new db[(_0xe718('0x9b'))]['ValidationError'](_0xe718('0xcf'));}_0x26d667=_[_0xe718('0x94')](_[_0xe718('0x49')](_0x5eac43),['createdAt','updatedAt']);_0xb7eb7b=_[_0xe718('0x94')](_[_0xe718('0x49')](_0x5eac43),[_0xe718('0x96'),_0xe718('0x95'),_0xe718('0x97'),_0xe718('0x98')]);if(_0x62f01b[_0xe718('0x61')]['id']){delete _0x62f01b[_0xe718('0x61')]['id'];}if(_[_0xe718('0x81')](_0x62f01b[_0xe718('0x61')][_0xe718('0x99')])){throw _0x41353c[_0xe718('0x30')](0x1f4)['send'](new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0x9a')));}if(_[_0xe718('0x81')](_0x62f01b[_0xe718('0x61')]['body'])||_0x62f01b[_0xe718('0x61')]['body']===''){throw _0x41353c[_0xe718('0x30')](0x1f4)[_0xe718('0x40')](new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0x9c')));}if(_[_0xe718('0x81')](_0x62f01b[_0xe718('0x61')][_0xe718('0xd0')])){throw _0x41353c[_0xe718('0x30')](0x1f4)[_0xe718('0x40')](new db[(_0xe718('0x9b'))][(_0xe718('0x93'))](_0xe718('0xd1')+_0xb7eb7b));}if(!_[_0xe718('0x9f')](_0xb7eb7b,_0x62f01b[_0xe718('0x61')]['mapKeyOffline'])){throw _0x41353c[_0xe718('0x30')](0x1f4)[_0xe718('0x40')](new db['Sequelize'][(_0xe718('0x93'))](_0xe718('0xd2')+_0xb7eb7b));}_0x5af3fc[_0x62f01b[_0xe718('0x61')]['mapKeyOffline']]=_0x62f01b['body'][_0xe718('0x99')];})[_0xe718('0x38')](function(){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x62f01b[_0xe718('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xe718('0xa2')}]});})[_0xe718('0x38')](handleEntityNotFound(_0x41353c,null))[_0xe718('0x38')](function(_0x384a11){if(_0x384a11&&_0x384a11['List']){_0x58d030=_0x384a11;var _0x480385=_['defaults'](_0x62f01b[_0xe718('0x61')],{'firstName':_0x62f01b[_0xe718('0x61')][_0xe718('0x99')],'phone':_0x62f01b['body']['from'],'ListId':_0x384a11[_0xe718('0x98')]});_0x480385[_0x62f01b['body'][_0xe718('0xd0')]]=_0x62f01b[_0xe718('0x61')][_0xe718('0x99')];return db['CmContact']['findOrCreate']({'where':_0x5af3fc,'defaults':_0x480385});}})['spread'](function(_0x200198){if(_0x200198){_0x26865d=_0x200198;var _0xb765cb=fs[_0xe718('0xd3')](path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0xd4')),_0xe718('0xd5'));var _0x1358e1=ejs[_0xe718('0xd6')](_0xb765cb,{'body':_['toPairs'](_0x62f01b['body'][_0xe718('0x61')]),'bodyTitle':_0x58d030[_0xe718('0xd7')]});return db[_0xe718('0xd8')][_0xe718('0x60')]({'body':_0x1358e1,'ContactId':_0x200198['id'],'ChatWebsiteId':_0x58d030['id']});}})['then'](function(_0x2305c4){if(_0x2305c4){_0x433b85=_0x2305c4;return db[_0xe718('0xd9')][_0xe718('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0xe718('0xda')],'as':_0xe718('0xdb'),'raw':!![]}]});}})['then'](function(_0x4743eb){if(_0x4743eb&&_0x4743eb[_0xe718('0xdb')]&&_0x58d030[_0xe718('0xdc')]){var _0x2ede0c={'tls':{'rejectUnauthorized':![]}};if(_0x4743eb[_0xe718('0xdb')]['service']){_0x2ede0c['service']=_0x4743eb['Smtp'][_0xe718('0xdd')];}else{_0x2ede0c[_0xe718('0xde')]=_0x4743eb[_0xe718('0xdb')][_0xe718('0xde')];_0x2ede0c[_0xe718('0xdf')]=_0x4743eb[_0xe718('0xdb')][_0xe718('0xdf')];_0x2ede0c['secure']=_0x4743eb[_0xe718('0xdb')][_0xe718('0xe0')];}if(_0x4743eb['Smtp'][_0xe718('0xe1')]){_0x2ede0c[_0xe718('0xe2')]={'user':_0x4743eb[_0xe718('0xdb')][_0xe718('0x62')],'pass':_0x4743eb[_0xe718('0xdb')][_0xe718('0xe3')]};}return respondWithRpcPromise(_0xe718('0xe4'),_0xe718('0xe5'),{'account':_0x2ede0c,'message':{'from':util[_0xe718('0xb2')](_0xe718('0xe6'),_0x4743eb[_0xe718('0x3f')],_0x4743eb[_0xe718('0xe7')]||_0x4743eb[_0xe718('0xdb')][_0xe718('0x62')]),'to':_0x58d030[_0xe718('0xdc')],'subject':_0x58d030[_0xe718('0xe8')],'text':_0x433b85['body']}},client9003)[_0xe718('0x38')](function(){return _0x433b85;})[_0xe718('0x2e')](function(_0x36fefb){console[_0xe718('0x2b')](_0x36fefb);});}})[_0xe718('0x38')](function(){if(_0x433b85){return _0x433b85;}})[_0xe718('0x38')](respondWithResult(_0x41353c,null))[_0xe718('0x2e')](handleError(_0x41353c,null));};exports[_0xe718('0xe9')]=function(_0x549ec1,_0xae9327,_0x504411){return db[_0xe718('0xb7')]['find']({'where':{'id':_0x549ec1[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0xae9327,null))['then'](function(_0xbe15dc){if(_0xbe15dc){return _0xbe15dc[_0xe718('0xe9')](_0x549ec1[_0xe718('0x61')]['ids'],_[_0xe718('0xea')](_0x549ec1[_0xe718('0x61')],[_0xe718('0x70'),'id'])||{});}})[_0xe718('0x38')](respondWithResult(_0xae9327,null))[_0xe718('0x2e')](handleError(_0xae9327,null));};exports[_0xe718('0xeb')]=function(_0x4fce24,_0x27cb75,_0x58d01e){var _0x26129a={'raw':![],'where':{}};var _0x36d1bc={};var _0x32ae15={'count':0x0,'rows':[]};return db[_0xe718('0x44')]['findOne']({'where':{'id':_0x4fce24[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x27cb75,null))['then'](function(_0xb9b25){if(_0xb9b25){_0x36d1bc[_0xe718('0x47')]=_[_0xe718('0x49')](db['ChatInteraction']['rawAttributes']);_0x36d1bc[_0xe718('0x48')]=_['keys'](_0x4fce24['query']);_0x36d1bc[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x36d1bc['model'],_0x36d1bc[_0xe718('0x48')]);_0x26129a[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x36d1bc['model'],qs[_0xe718('0x4c')](_0x4fce24[_0xe718('0x48')][_0xe718('0x4c')]));_0x26129a[_0xe718('0x4a')]=_0x26129a['attributes']['length']?_0x26129a[_0xe718('0x4a')]:_0x36d1bc[_0xe718('0x47')];if(!_0x4fce24['query'][_0xe718('0x4e')](_0xe718('0x6d'))){_0x26129a['limit']=qs[_0xe718('0x33')](_0x4fce24[_0xe718('0x48')]['limit']);_0x26129a['offset']=qs[_0xe718('0x32')](_0x4fce24[_0xe718('0x48')][_0xe718('0x32')]);}_0x26129a[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x4fce24['query']['sort']);_0x26129a[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x4fce24[_0xe718('0x48')],_0x36d1bc[_0xe718('0x5d')]));_0x26129a[_0xe718('0x51')][_0xe718('0x69')]=_0xb9b25['id'];if(_0x4fce24[_0xe718('0x48')]['filter']){_0x26129a['where']=_['merge'](_0x26129a[_0xe718('0x51')],{'$or':_[_0xe718('0x43')](_0x26129a[_0xe718('0x4a')],function(_0x9ab65){var _0x5b0334={};_0x5b0334[_0x9ab65]={'$like':'%'+_0x4fce24[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x5b0334;})});}_0x26129a=_['merge']({},_0x26129a,_0x4fce24[_0xe718('0x56')]);return db[_0xe718('0xb7')][_0xe718('0x57')]({'where':_0x26129a['where']})['then'](function(_0x406156){_0x32ae15['count']=_0x406156;if(_0x4fce24[_0xe718('0x48')][_0xe718('0x5e')]){_0x26129a[_0xe718('0x58')]=[{'model':db[_0xe718('0x92')],'as':_0xe718('0xec'),'required':![]},{'model':db[_0xe718('0xc8')],'as':'Owner','attributes':['name','fullname',_0xe718('0xed')],'required':![]},{'model':db[_0xe718('0xee')],'as':_0xe718('0xef'),'attributes':['id',_0xe718('0x3f'),_0xe718('0xf0')],'where':_0x4fce24[_0xe718('0x48')][_0xe718('0xf1')]?{'id':_0x4fce24['query'][_0xe718('0xf1')]}:undefined,'required':_0x4fce24[_0xe718('0x48')][_0xe718('0xf1')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x26129a);})[_0xe718('0x38')](function(_0x409f56){_0x32ae15['rows']=_0x409f56;return _0x32ae15;});}})[_0xe718('0x38')](respondWithFilteredResult(_0x27cb75,_0x26129a))['catch'](handleError(_0x27cb75,null));};function iftimePromise(_0x4cb9b7,_0x1cb2ff){return respondWithRpcPromise('Command',_0xe718('0xf2'),{'command':_0x1cb2ff[_0xe718('0xf3')]?util['format'](_0xe718('0xf4'),_0x4cb9b7[_0xe718('0xf5')],_0x1cb2ff[_0xe718('0xf3')]):util[_0xe718('0xb2')](_0xe718('0xf6'),_0x4cb9b7[_0xe718('0xf5')])},client9002)[_0xe718('0x38')](function(_0x1fa335){var _0xf71edb=_0x1fa335&&_0x1fa335[_0xe718('0xf7')](_0xe718('0xf8'))>=0x0?!![]:![];logger[_0xe718('0x25')](_0xe718('0xf9'),_0x1cb2ff['id'],_0x4cb9b7['id'],_0x4cb9b7[_0xe718('0xf5')],_0xf71edb?'ONLINE':_0xe718('0xfa'),_0x1cb2ff['timezone']?_0x1cb2ff[_0xe718('0xf3')]:'No\x20timezone');return _0xf71edb;})[_0xe718('0x2e')](function(_0x5eabed){logger[_0xe718('0x2b')](_0xe718('0xf9'),_0x1cb2ff['id'],_0x4cb9b7['id'],_0x4cb9b7['interval'],util[_0xe718('0xfb')](_0x5eabed,{'showHidden':![],'depth':null}),_0x1cb2ff[_0xe718('0xf3')]?_0x1cb2ff[_0xe718('0xf3')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x33ca21,_0x79774e,_0x91e744){var _0xda3712=0x0;var _0x4dd4a0=0x0;var _0xa03eec=![];var _0x387b17;var _0x481529;return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x33ca21['params']['id']},'include':[{'model':db[_0xe718('0xfc')],'as':_0xe718('0xfc'),'include':[{'model':db[_0xe718('0xfc')],'as':_0xe718('0xfd'),'attributes':['id',_0xe718('0xf5')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x79774e,null))[_0xe718('0x38')](function(_0xb9bdc1){if(_0xb9bdc1){_0x387b17=_0xb9bdc1;return _0xb9bdc1[_0xe718('0xfe')]({'raw':!![]});}})['then'](function(_0x6f1e14){if(_0x387b17){if(_0x6f1e14){_0x481529=_0x6f1e14;}}return require(_0xe718('0x19'))['getLicense']();})[_0xe718('0x38')](function(_0x4735e7){if(_0x4735e7){_0x4dd4a0=_0x4735e7[_0xe718('0xff')];_0xa03eec=_0x4735e7[_0xe718('0x80')];}})[_0xe718('0x38')](function(){return db[_0xe718('0xb7')][_0xe718('0x57')]({'where':{'closed':![]}});})[_0xe718('0x38')](function(_0x30c2b8){_0xda3712=_0x30c2b8;if(_0x4dd4a0&&_0x30c2b8>_0x4dd4a0){return db[_0xe718('0x100')][_0xe718('0x6c')]({'where':{'id':0x1}})[_0xe718('0x38')](function(_0x39eb5a){if(_0x39eb5a){_0x39eb5a[_0xe718('0x101')]('chatLicenseExceeded');}});}})[_0xe718('0x38')](function(){if(_0x387b17[_0xe718('0xfc')]&&_0x387b17['Interval'][_0xe718('0xfd')]){var _0x3b22ae=[];for(var _0x28f847=0x0;_0x28f847<_0x387b17[_0xe718('0xfc')]['Intervals'][_0xe718('0x4d')];_0x28f847++){var _0x48d2a9=_0x387b17[_0xe718('0xfc')][_0xe718('0xfd')][_0x28f847][_0xe718('0x39')]({'plain':!![]});_0x3b22ae[_0xe718('0xc1')](iftimePromise(_0x48d2a9,_0x387b17));}return BPromise['all'](_0x3b22ae)['then'](function(_0xc34ec9){return _[_0xe718('0x102')](_0xc34ec9);});}else{return!![];}})[_0xe718('0x38')](function(_0x27c6db){var _0x58834f=fs[_0xe718('0xd3')](path[_0xe718('0x7d')](config[_0xe718('0x84')],_0xe718('0x103')),_0xe718('0xd5'));var _0x1d40c2={'remote':_0x387b17[_0xe718('0x104')],'query':querystring[_0xe718('0x2a')](_[_0xe718('0x54')](_0x387b17['get']({'plain':!![]}),{'customerIp':_0x33ca21[_0xe718('0x90')][_0xe718('0xa9')]||_0x33ca21['headers']['x-real-ip']||_0x33ca21[_0xe718('0x105')][_0xe718('0x106')]||_0x33ca21['ip'],'referer':_0x33ca21[_0xe718('0x90')][_0xe718('0xab')],'openedInteractions':_0xda3712,'maxInteractions':_0x4dd4a0,'virtual':_0xa03eec[_0xe718('0xff')],'online':_0x27c6db,'custom':_0xa03eec}))[_0xe718('0x107')](/'/g,'\x5c\x27')};_0x79774e[_0xe718('0x40')](ejs[_0xe718('0xd6')](Mustache[_0xe718('0xd6')](_0x58834f,_0x1d40c2),{'proactiveActions':_0x481529,'alignment':_0x387b17[_0xe718('0x108')],'verticalAlignment':_0x387b17[_0xe718('0x109')],'div_color':_0x387b17[_0xe718('0xf0')],'text_color':_0x387b17[_0xe718('0x10a')]}));})[_0xe718('0x2e')](handleError(_0x79774e,null));};exports['addApplications']=function(_0x599402,_0x5bcf16,_0x39b073){return db[_0xe718('0x44')]['findOne']({'where':{'id':_0x599402[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x5bcf16,null))['then'](function(_0x58189d){if(_0x58189d){return db[_0xe718('0x10b')][_0xe718('0x10c')](function(_0x42f111){return db[_0xe718('0x10d')][_0xe718('0x3c')]({'where':{'ChatWebsiteId':_0x599402[_0xe718('0x5b')]['id']},'transaction':_0x42f111})[_0xe718('0x38')](function(_0x25fce2){var _0x15035c=_[_0xe718('0x43')](_0x599402[_0xe718('0x61')],function(_0xad998f){_0xad998f[_0xe718('0x69')]=_0x599402[_0xe718('0x5b')]['id'];return _0xad998f;});return db[_0xe718('0x10d')][_0xe718('0x10e')](_0x15035c,{'transaction':_0x42f111});});})[_0xe718('0x38')](function(){return db[_0xe718('0x10d')][_0xe718('0x10f')]({'where':{'ChatWebsiteId':_0x599402['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5bcf16,null))[_0xe718('0x2e')](handleError(_0x5bcf16,null));};exports[_0xe718('0x110')]=function(_0x53f97c,_0x36eada,_0x5f5573){var _0x1b64ec={};var _0x5a9006={};var _0x508f8c;var _0x1dbd9d;return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x53f97c[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x36eada,null))[_0xe718('0x38')](function(_0x653384){if(_0x653384){_0x508f8c=_0x653384;_0x5a9006[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0x10d')][_0xe718('0x5c')]);_0x5a9006[_0xe718('0x48')]=_[_0xe718('0x49')](_0x53f97c['query']);_0x5a9006[_0xe718('0x5d')]=_['intersection'](_0x5a9006[_0xe718('0x47')],_0x5a9006[_0xe718('0x48')]);_0x1b64ec[_0xe718('0x4a')]=_['intersection'](_0x5a9006[_0xe718('0x47')],qs[_0xe718('0x4c')](_0x53f97c[_0xe718('0x48')][_0xe718('0x4c')]));_0x1b64ec[_0xe718('0x4a')]=_0x1b64ec[_0xe718('0x4a')][_0xe718('0x4d')]?_0x1b64ec['attributes']:_0x5a9006[_0xe718('0x47')];_0x1b64ec['order']=qs[_0xe718('0x50')](_0x53f97c[_0xe718('0x48')]['sort']);_0x1b64ec[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x53f97c[_0xe718('0x48')],_0x5a9006['filters']));if(_0x53f97c[_0xe718('0x48')]['filter']){_0x1b64ec[_0xe718('0x51')]=_['merge'](_0x1b64ec['where'],{'$or':_[_0xe718('0x43')](_0x1b64ec[_0xe718('0x4a')],function(_0x211867){var _0x3c8383={};_0x3c8383[_0x211867]={'$like':'%'+_0x53f97c[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x3c8383;})});}_0x1b64ec=_[_0xe718('0x54')]({},_0x1b64ec,_0x53f97c['options']);return _0x508f8c[_0xe718('0x110')](_0x1b64ec);}})[_0xe718('0x38')](function(_0x1b1fe6){if(_0x1b1fe6){_0x1dbd9d=_0x1b1fe6[_0xe718('0x4d')];if(!_0x53f97c[_0xe718('0x48')]['hasOwnProperty'](_0xe718('0x6d'))){_0x1b64ec[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x53f97c[_0xe718('0x48')][_0xe718('0x33')]);_0x1b64ec[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x53f97c['query'][_0xe718('0x32')]);}return _0x508f8c[_0xe718('0x110')](_0x1b64ec);}})[_0xe718('0x38')](function(_0x5d2ad3){if(_0x5d2ad3){return _0x5d2ad3?{'count':_0x1dbd9d,'rows':_0x5d2ad3}:null;}})[_0xe718('0x38')](respondWithResult(_0x36eada,null))[_0xe718('0x2e')](handleError(_0x36eada,null));};exports['addProactiveActions']=function(_0x558d15,_0x29c6b7,_0x1ebb88){return db['chatProactiveAction'][_0xe718('0x5f')]({'where':{'id':_0x558d15[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x29c6b7,null))[_0xe718('0x38')](function(_0x1ad690){if(_0x1ad690){return _0x1ad690['addProactiveActions'](_0x558d15[_0xe718('0x61')][_0xe718('0x70')],_[_0xe718('0xea')](_0x558d15[_0xe718('0x61')],[_0xe718('0x70'),'id'])||{});}})[_0xe718('0x38')](respondWithResult(_0x29c6b7,null))['catch'](handleError(_0x29c6b7,null));};exports['getProactiveActions']=function(_0x1f3eb2,_0x51ebf8,_0x231d5f){var _0x49aa40={};var _0x284061={};var _0x3306ab;var _0x1d1099;return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x1f3eb2[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x51ebf8,null))[_0xe718('0x38')](function(_0x3569e5){if(_0x3569e5){_0x3306ab=_0x3569e5;_0x284061[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0x111')][_0xe718('0x5c')]);_0x284061[_0xe718('0x48')]=_['keys'](_0x1f3eb2[_0xe718('0x48')]);_0x284061[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x284061['model'],_0x284061[_0xe718('0x48')]);_0x49aa40[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x284061['model'],qs[_0xe718('0x4c')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x4c')]));_0x49aa40[_0xe718('0x4a')]=_0x49aa40[_0xe718('0x4a')][_0xe718('0x4d')]?_0x49aa40['attributes']:_0x284061['model'];_0x49aa40[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x50')]);_0x49aa40[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x1f3eb2[_0xe718('0x48')],_0x284061['filters']));if(_0x1f3eb2[_0xe718('0x48')][_0xe718('0x53')]){_0x49aa40[_0xe718('0x51')]=_[_0xe718('0x54')](_0x49aa40[_0xe718('0x51')],{'$or':_[_0xe718('0x43')](_0x49aa40[_0xe718('0x4a')],function(_0x4c0bf2){var _0x2cb5fc={};_0x2cb5fc[_0x4c0bf2]={'$like':'%'+_0x1f3eb2['query'][_0xe718('0x53')]+'%'};return _0x2cb5fc;})});}_0x49aa40=_[_0xe718('0x54')]({},_0x49aa40,_0x1f3eb2['options']);return _0x3306ab[_0xe718('0xfe')](_0x49aa40);}})[_0xe718('0x38')](function(_0x5cb121){if(_0x5cb121){_0x1d1099=_0x5cb121['length'];if(!_0x1f3eb2[_0xe718('0x48')][_0xe718('0x4e')]('nolimit')){_0x49aa40[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x33')]);_0x49aa40[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x1f3eb2[_0xe718('0x48')][_0xe718('0x32')]);}return _0x3306ab[_0xe718('0xfe')](_0x49aa40);}})[_0xe718('0x38')](function(_0x17c83f){if(_0x17c83f){return _0x17c83f?{'count':_0x1d1099,'rows':_0x17c83f}:null;}})[_0xe718('0x38')](respondWithResult(_0x51ebf8,null))[_0xe718('0x2e')](handleError(_0x51ebf8,null));};exports[_0xe718('0x112')]=function(_0x304994,_0x188d3d,_0x267825){var _0xdf2cfb=_0x304994[_0xe718('0x48')][_0xe718('0x113')]===_0xe718('0x114')?_0xe718('0x115'):_0xe718('0x116');return db['ChatWebsite']['find']({'attributes':['id',_0xdf2cfb],'where':{'id':_0x304994[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x188d3d,null))['then'](function(_0x6c320d){if(_0x6c320d){var _0x267293=_0x6c320d[_0xdf2cfb];var _0x2aa199=_0x267293&&_0x267293[_0xe718('0x117')]?_0x267293[_0xe718('0x117')]:[];_0x188d3d[_0xe718('0x40')]({'fromKey':_[_0xe718('0x81')](_0x267293[_0xe718('0x118')])?undefined:_0x267293[_0xe718('0x118')],'count':_0x2aa199[_0xe718('0x4d')],'rows':_0x2aa199});}})[_0xe718('0x2e')](handleError(_0x188d3d,null));};exports[_0xe718('0x119')]=function(_0x520d0d,_0x527060,_0x1faa16){var _0x48ee9c={'raw':![],'where':{}};var _0x1b11d8={};var _0x28c8fd={'count':0x0,'rows':[]};return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x520d0d[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x527060,null))[_0xe718('0x38')](function(_0x5dd7bc){if(_0x5dd7bc){_0x1b11d8[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0xd8')][_0xe718('0x5c')]);_0x1b11d8[_0xe718('0x48')]=_[_0xe718('0x49')](_0x520d0d[_0xe718('0x48')]);_0x1b11d8[_0xe718('0x5d')]=_[_0xe718('0x4b')](_0x1b11d8[_0xe718('0x47')],_0x1b11d8[_0xe718('0x48')]);_0x48ee9c[_0xe718('0x4a')]=_['intersection'](_0x1b11d8[_0xe718('0x47')],qs['fields'](_0x520d0d[_0xe718('0x48')][_0xe718('0x4c')]));_0x48ee9c[_0xe718('0x4a')]=_0x48ee9c['attributes'][_0xe718('0x4d')]?_0x48ee9c[_0xe718('0x4a')]:_0x1b11d8['model'];if(!_0x520d0d['query']['hasOwnProperty'](_0xe718('0x6d'))){_0x48ee9c['limit']=qs[_0xe718('0x33')](_0x520d0d[_0xe718('0x48')][_0xe718('0x33')]);_0x48ee9c[_0xe718('0x32')]=qs[_0xe718('0x32')](_0x520d0d[_0xe718('0x48')]['offset']);}_0x48ee9c[_0xe718('0x4f')]=qs['sort'](_0x520d0d[_0xe718('0x48')][_0xe718('0x50')]);_0x48ee9c[_0xe718('0x51')]=qs[_0xe718('0x5d')](_[_0xe718('0x52')](_0x520d0d[_0xe718('0x48')],_0x1b11d8[_0xe718('0x5d')]));_0x48ee9c[_0xe718('0x51')][_0xe718('0x69')]=_0x5dd7bc['id'];if(_0x520d0d['query']['filter']){_0x48ee9c[_0xe718('0x51')]=_[_0xe718('0x54')](_0x48ee9c[_0xe718('0x51')],{'$or':_['map'](_0x48ee9c['attributes'],function(_0x161933){var _0x289674={};_0x289674[_0x161933]={'$like':'%'+_0x520d0d[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x289674;})});}_0x48ee9c=_[_0xe718('0x54')]({},_0x48ee9c,_0x520d0d['options']);return db['ChatOfflineMessage'][_0xe718('0x57')]({'where':_0x48ee9c['where']})[_0xe718('0x38')](function(_0x5a9e45){_0x28c8fd[_0xe718('0x57')]=_0x5a9e45;if(_0x520d0d[_0xe718('0x48')][_0xe718('0x5e')]){_0x48ee9c[_0xe718('0x58')]=[{'all':!![]}];}else{_0x48ee9c['include']=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0xe718('0xd8')]['findAll'](_0x48ee9c);})[_0xe718('0x38')](function(_0x50213d){_0x28c8fd['rows']=_0x50213d;return _0x28c8fd;});}})[_0xe718('0x38')](respondWithFilteredResult(_0x527060,_0x48ee9c))[_0xe718('0x2e')](handleError(_0x527060,null));};exports[_0xe718('0x11a')]=function(_0x64ad6,_0x402736,_0x819556){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0x64ad6[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x402736,null))['then'](function(_0x7d6383){if(_0x7d6383){return _0x7d6383['addAgents'](_0x64ad6[_0xe718('0x61')][_0xe718('0x70')],_[_0xe718('0xea')](_0x64ad6['body'],[_0xe718('0x70'),'id'])||{})[_0xe718('0xba')](function(_0x332ca7){for(var _0x436e91=0x0;_0x436e91<_0x64ad6['body'][_0xe718('0x70')][_0xe718('0x4d')];_0x436e91+=0x1){socket[_0xe718('0x11b')]('userChatWebsite:save',{'UserId':_0x64ad6['body'][_0xe718('0x70')][_0x436e91],'ChatWebsiteId':_0x64ad6['params']['id']});}return _0x332ca7;});}})[_0xe718('0x38')](respondWithResult(_0x402736,null))['catch'](handleError(_0x402736,null));};exports[_0xe718('0x11c')]=function(_0xc8747c,_0x2bec4b,_0x49828c){return db[_0xe718('0x44')][_0xe718('0x5f')]({'where':{'id':_0xc8747c[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x2bec4b,null))[_0xe718('0x38')](function(_0x5af647){if(_0x5af647){return _0x5af647['removeAgents'](_0xc8747c['query'][_0xe718('0x70')])[_0xe718('0x38')](function(){if(_['isArray'](_0xc8747c['query'][_0xe718('0x70')])){for(var _0xb2327f=0x0;_0xb2327f<_0xc8747c[_0xe718('0x48')][_0xe718('0x70')][_0xe718('0x4d')];_0xb2327f+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xc8747c[_0xe718('0x48')][_0xe718('0x70')][_0xb2327f]),'ChatWebsiteId':Number(_0xc8747c[_0xe718('0x5b')]['id'])});}}else{socket[_0xe718('0x11b')](_0xe718('0x11d'),{'UserId':Number(_0xc8747c[_0xe718('0x48')][_0xe718('0x70')]),'ChatWebsiteId':Number(_0xc8747c[_0xe718('0x5b')]['id'])});}});}})[_0xe718('0x38')](respondWithStatusCode(_0x2bec4b,null))[_0xe718('0x2e')](handleError(_0x2bec4b,null));};exports[_0xe718('0x11e')]=function(_0x86ba5d,_0x441e9d,_0x131620){var _0x3e24fe={};var _0x4b2aa4={};var _0x16bfff;var _0x1d9c15;return db[_0xe718('0x44')][_0xe718('0x6c')]({'where':{'id':_0x86ba5d[_0xe718('0x5b')]['id']}})[_0xe718('0x38')](handleEntityNotFound(_0x441e9d,null))[_0xe718('0x38')](function(_0x41257a){if(_0x41257a){_0x16bfff=_0x41257a;_0x4b2aa4[_0xe718('0x47')]=_[_0xe718('0x49')](db[_0xe718('0xc8')]['rawAttributes']);_0x4b2aa4[_0xe718('0x48')]=_['keys'](_0x86ba5d['query']);_0x4b2aa4[_0xe718('0x5d')]=_['intersection'](_0x4b2aa4[_0xe718('0x47')],_0x4b2aa4['query']);_0x3e24fe[_0xe718('0x4a')]=_[_0xe718('0x4b')](_0x4b2aa4['model'],qs[_0xe718('0x4c')](_0x86ba5d['query'][_0xe718('0x4c')]));_0x3e24fe[_0xe718('0x4a')]=_0x3e24fe[_0xe718('0x4a')][_0xe718('0x4d')]?_0x3e24fe['attributes']:_0x4b2aa4['model'];_0x3e24fe[_0xe718('0x4f')]=qs[_0xe718('0x50')](_0x86ba5d[_0xe718('0x48')]['sort']);_0x3e24fe[_0xe718('0x51')]=qs['filters'](_[_0xe718('0x52')](_0x86ba5d[_0xe718('0x48')],_0x4b2aa4['filters']));if(_0x86ba5d[_0xe718('0x48')]['filter']){_0x3e24fe[_0xe718('0x51')]=_[_0xe718('0x54')](_0x3e24fe['where'],{'$or':_[_0xe718('0x43')](_0x3e24fe['attributes'],function(_0x13b86){var _0x2a2800={};_0x2a2800[_0x13b86]={'$like':'%'+_0x86ba5d[_0xe718('0x48')][_0xe718('0x53')]+'%'};return _0x2a2800;})});}_0x3e24fe=_[_0xe718('0x54')]({},_0x3e24fe,_0x86ba5d[_0xe718('0x56')]);return _0x16bfff[_0xe718('0x11e')](_0x3e24fe);}})[_0xe718('0x38')](function(_0x71f0b1){if(_0x71f0b1){_0x1d9c15=_0x71f0b1[_0xe718('0x4d')];if(!_0x86ba5d['query']['hasOwnProperty'](_0xe718('0x6d'))){_0x3e24fe[_0xe718('0x33')]=qs[_0xe718('0x33')](_0x86ba5d[_0xe718('0x48')][_0xe718('0x33')]);_0x3e24fe[_0xe718('0x32')]=qs['offset'](_0x86ba5d[_0xe718('0x48')][_0xe718('0x32')]);}return _0x16bfff[_0xe718('0x11e')](_0x3e24fe);}})['then'](function(_0x506d68){if(_0x506d68){return _0x506d68?{'count':_0x1d9c15,'rows':_0x506d68}:null;}})['then'](respondWithResult(_0x441e9d,null))[_0xe718('0x2e')](handleError(_0x441e9d,null));}; \ No newline at end of file +var _0xb83d=['systemAvatar','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','account','applications','Applications','list','priority','Contacts','defaults','customerIp','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','forcedOwnership','Start','EventManager','offline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-forwarded-for','x-real-ip','replace','render','textColor','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','User','eml-format','zip-dir','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','redis','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','Disposition','order','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png'];(function(_0x48fa89,_0x40bb61){var _0x1d9aeb=function(_0x1e9ce6){while(--_0x1e9ce6){_0x48fa89['push'](_0x48fa89['shift']());}};_0x1d9aeb(++_0x40bb61);}(_0xb83d,0x98));var _0xdb83=function(_0x222e2d,_0x1036b6){_0x222e2d=_0x222e2d-0x0;var _0x2f0355=_0xb83d[_0x222e2d];return _0x2f0355;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdb83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb83('0x2'));var Mustache=require('mustache');var util=require(_0xdb83('0x3'));var path=require(_0xdb83('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdb83('0x5'));var fs=require('fs');var _=require(_0xdb83('0x6'));var squel=require('squel');var crypto=require(_0xdb83('0x7'));var jsforce=require(_0xdb83('0x8'));var deskjs=require(_0xdb83('0x9'));var toCsv=require(_0xdb83('0xa'));var querystring=require(_0xdb83('0xb'));var Papa=require('papaparse');var Redis=require(_0xdb83('0xc'));var authService=require(_0xdb83('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xdb83('0xe'));var hardwareService=require(_0xdb83('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdb83('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdb83('0x11')]=_['defaults'](config[_0xdb83('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb83('0x12'))(new Redis(config[_0xdb83('0x11')]));require(_0xdb83('0x13'))[_0xdb83('0x14')](socket);var jayson=require(_0xdb83('0x15'));var client=jayson[_0xdb83('0x16')][_0xdb83('0x17')]({'port':0x232c});var client9002=jayson[_0xdb83('0x16')][_0xdb83('0x17')]({'port':0x232a});var client9003=jayson[_0xdb83('0x16')][_0xdb83('0x17')]({'port':0x232b});function respondWithRpcPromise(_0x4bc8c0,_0x19fdaa,_0xe0b672,_0x2cc09d){return new BPromise(function(_0x846f78,_0x3df609){var _0x494aa0=_0x2cc09d||client;return _0x494aa0[_0xdb83('0x18')](_0x4bc8c0,_0xe0b672)[_0xdb83('0x19')](function(_0x5932e2){logger['info'](_0xdb83('0x1a'),_0x19fdaa,'request\x20sent');logger['debug'](_0xdb83('0x1b'),_0x19fdaa,_0xdb83('0x1c'),JSON[_0xdb83('0x1d')](_0x5932e2));if(_0x5932e2[_0xdb83('0x1e')]){if(_0x5932e2[_0xdb83('0x1e')][_0xdb83('0x1f')]===0x1f4){logger[_0xdb83('0x1e')](_0xdb83('0x1a'),_0x19fdaa,_0x5932e2[_0xdb83('0x1e')][_0xdb83('0x20')]);return _0x3df609(_0x5932e2[_0xdb83('0x1e')][_0xdb83('0x20')]);}logger[_0xdb83('0x1e')](_0xdb83('0x1a'),_0x19fdaa,_0x5932e2[_0xdb83('0x1e')]['message']);return _0x846f78(_0x5932e2[_0xdb83('0x1e')]['message']);}else{logger[_0xdb83('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x19fdaa,_0xdb83('0x1c'));_0x846f78(_0x5932e2['result']['message']);}})[_0xdb83('0x22')](function(_0x450570){logger[_0xdb83('0x1e')](_0xdb83('0x1a'),_0x19fdaa,_0x450570);_0x3df609(_0x450570);});});}function respondWithStatusCode(_0x5d918e,_0x5e1a0f){_0x5e1a0f=_0x5e1a0f||0xcc;return function(_0x123c1b){if(_0x123c1b){return _0x5d918e[_0xdb83('0x23')](_0x5e1a0f);}return _0x5d918e[_0xdb83('0x24')](_0x5e1a0f)[_0xdb83('0x25')]();};}function respondWithResult(_0x33262d,_0x160e00){_0x160e00=_0x160e00||0xc8;return function(_0x30bab5){if(_0x30bab5){return _0x33262d[_0xdb83('0x24')](_0x160e00)[_0xdb83('0x26')](_0x30bab5);}};}function respondWithFilteredResult(_0x1bb9ba,_0x2b039b){return function(_0x10a327){if(_0x10a327){var _0x277de1=_0x10a327[_0xdb83('0x27')],_0x5241e1=_0x2b039b[_0xdb83('0x28')],_0x535b21=_0x2b039b[_0xdb83('0x28')]+_0x2b039b['limit'],_0x2f7e0c;if(_0x535b21>=_0x277de1){_0x535b21=_0x277de1;_0x2f7e0c=0xc8;}else{_0x2f7e0c=0xce;}_0x1bb9ba['status'](_0x2f7e0c);return _0x1bb9ba['set'](_0xdb83('0x29'),_0x5241e1+'-'+_0x535b21+'/'+_0x277de1)[_0xdb83('0x26')](_0x10a327);}return null;};}function patchUpdates(_0x433493){return function(_0x57d50e){try{jsonpatch[_0xdb83('0x2a')](_0x57d50e,_0x433493,!![]);}catch(_0x455ab5){return BPromise['reject'](_0x455ab5);}return _0x57d50e[_0xdb83('0x2b')]();};}function saveUpdates(_0x4fcf56,_0x2590d7){return function(_0xd734c){if(_0xd734c){return _0xd734c[_0xdb83('0x2c')](_0x4fcf56)[_0xdb83('0x19')](function(_0x50562e){return _0x50562e;});}return null;};}function removeEntity(_0x3e8111,_0x2c2848){return function(_0x47d450){if(_0x47d450){return _0x47d450[_0xdb83('0x2d')]()[_0xdb83('0x19')](function(){var _0x1e6985=_0x47d450[_0xdb83('0x2e')]({'plain':!![]});var _0x35e178=_0xdb83('0x2f');return db[_0xdb83('0x30')][_0xdb83('0x2d')]({'where':{'type':_0x35e178,'resourceId':_0x1e6985['id']}})[_0xdb83('0x19')](function(){return _0x47d450;});})[_0xdb83('0x19')](function(){_0x3e8111[_0xdb83('0x24')](0xcc)[_0xdb83('0x25')]();});}};}function handleEntityNotFound(_0xc71490,_0x422786){return function(_0x16d1f1){if(!_0x16d1f1){_0xc71490[_0xdb83('0x23')](0x194);}return _0x16d1f1;};}function handleError(_0x1e972c,_0x40d0ca){_0x40d0ca=_0x40d0ca||0x1f4;return function(_0x1cdf9c){logger['error'](_0x1cdf9c['stack']);if(_0x1cdf9c[_0xdb83('0x31')]){delete _0x1cdf9c[_0xdb83('0x31')];}_0x1e972c['status'](_0x40d0ca)['send'](_0x1cdf9c);};}exports[_0xdb83('0x32')]=function(_0x59050d,_0x3ae760){var _0xb1de11={'include':[{'model':db[_0xdb83('0x33')],'as':_0xdb83('0x34')}]},_0x1f53bc={},_0x20947a={'count':0x0,'rows':[]};var _0x374934=_[_0xdb83('0x35')](db[_0xdb83('0x36')]['rawAttributes'],function(_0x3336a8){return{'name':_0x3336a8[_0xdb83('0x37')],'type':_0x3336a8[_0xdb83('0x38')][_0xdb83('0x39')]};});_0x1f53bc[_0xdb83('0x3a')]=_[_0xdb83('0x35')](_0x374934,_0xdb83('0x31'));_0x1f53bc[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x59050d[_0xdb83('0x3b')]);_0x1f53bc[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x1f53bc[_0xdb83('0x3a')],_0x1f53bc[_0xdb83('0x3b')]);_0xb1de11[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x1f53bc['model'],qs['fields'](_0x59050d[_0xdb83('0x3b')]['fields']));_0xb1de11[_0xdb83('0x3f')]=_0xb1de11[_0xdb83('0x3f')][_0xdb83('0x40')]?_0xb1de11[_0xdb83('0x3f')]:_0x1f53bc[_0xdb83('0x3a')];if(!_0x59050d[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0xb1de11[_0xdb83('0x43')]=qs['limit'](_0x59050d[_0xdb83('0x3b')]['limit']);_0xb1de11[_0xdb83('0x28')]=qs['offset'](_0x59050d[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0xb1de11['order']=qs[_0xdb83('0x44')](_0x59050d['query'][_0xdb83('0x44')]);_0xb1de11[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x59050d[_0xdb83('0x3b')],_0x1f53bc[_0xdb83('0x3d')]),_0x374934);if(_0x59050d[_0xdb83('0x3b')][_0xdb83('0x47')]){_0xb1de11[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0xb1de11[_0xdb83('0x45')],{'$or':_['map'](_0x374934,function(_0x917915){if(_0x917915['type']!==_0xdb83('0x49')){var _0x52ace8={};_0x52ace8[_0x917915[_0xdb83('0x31')]]={'$like':'%'+_0x59050d[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x52ace8;}})});}_0xb1de11=_['merge']({},_0xb1de11,_0x59050d['options']);var _0x51fe7c={'where':_0xb1de11[_0xdb83('0x45')]};return db[_0xdb83('0x36')][_0xdb83('0x27')](_0x51fe7c)['then'](function(_0x315de2){_0x20947a['count']=_0x315de2;if(_0x59050d[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0xb1de11[_0xdb83('0x4b')]=[{'all':!![]}];}return db[_0xdb83('0x36')][_0xdb83('0x4c')](_0xb1de11);})['then'](function(_0x360fb4){_0x20947a['rows']=_0x360fb4;return _0x20947a;})[_0xdb83('0x19')](respondWithFilteredResult(_0x3ae760,_0xb1de11))[_0xdb83('0x22')](handleError(_0x3ae760,null));};exports[_0xdb83('0x4d')]=function(_0x4bcbe1,_0x230c1a){var _0x1d1add={'raw':![],'where':{'id':_0x4bcbe1[_0xdb83('0x4e')]['id']},'include':[{'model':db['Pause'],'as':_0xdb83('0x34')}]},_0x29d96c={};_0x29d96c['model']=_[_0xdb83('0x3c')](db[_0xdb83('0x36')][_0xdb83('0x4f')]);_0x29d96c['query']=_[_0xdb83('0x3c')](_0x4bcbe1[_0xdb83('0x3b')]);_0x29d96c[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x29d96c[_0xdb83('0x3a')],_0x29d96c['query']);_0x1d1add[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x29d96c[_0xdb83('0x3a')],qs['fields'](_0x4bcbe1[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x1d1add[_0xdb83('0x3f')]=_0x1d1add[_0xdb83('0x3f')]['length']?_0x1d1add[_0xdb83('0x3f')]:_0x29d96c[_0xdb83('0x3a')];if(_0x4bcbe1['query'][_0xdb83('0x4a')]){_0x1d1add[_0xdb83('0x4b')]=[{'all':!![]}];}_0x1d1add=_[_0xdb83('0x48')]({},_0x1d1add,_0x4bcbe1[_0xdb83('0x51')]);return db['ChatWebsite'][_0xdb83('0x52')](_0x1d1add)[_0xdb83('0x19')](handleEntityNotFound(_0x230c1a,null))[_0xdb83('0x19')](respondWithResult(_0x230c1a,null))[_0xdb83('0x22')](handleError(_0x230c1a,null));};exports[_0xdb83('0x53')]=function(_0xaee0c,_0x486e89){return db['ChatWebsite'][_0xdb83('0x53')](_0xaee0c[_0xdb83('0x54')],{})[_0xdb83('0x19')](function(_0x171193){var _0x3b78c9=_0xaee0c[_0xdb83('0x55')]['get']({'plain':!![]});if(!_0x3b78c9)throw new Error(_0xdb83('0x56'));if(_0x3b78c9[_0xdb83('0x57')]===_0xdb83('0x55')){var _0x19d844=_0x171193[_0xdb83('0x2e')]({'plain':!![]});var _0x4db11f=_0xdb83('0x2f');return db[_0xdb83('0x58')][_0xdb83('0x52')]({'where':{'name':_0x4db11f,'userProfileId':_0x3b78c9[_0xdb83('0x59')]},'raw':!![]})['then'](function(_0x1632f8){if(_0x1632f8&&_0x1632f8[_0xdb83('0x5a')]===0x0){return db[_0xdb83('0x30')][_0xdb83('0x53')]({'name':_0x19d844[_0xdb83('0x31')],'resourceId':_0x19d844['id'],'type':_0x1632f8[_0xdb83('0x31')],'sectionId':_0x1632f8['id']},{})['then'](function(){return _0x171193;});}else{return _0x171193;}})[_0xdb83('0x22')](function(_0x10000b){logger[_0xdb83('0x1e')](_0xdb83('0x5b'),_0x10000b);throw _0x10000b;});}return _0x171193;})[_0xdb83('0x19')](respondWithResult(_0x486e89,0xc9))['catch'](handleError(_0x486e89,null));};exports['update']=function(_0x47f387,_0x1efff8){if(_0x47f387[_0xdb83('0x54')]['id']){delete _0x47f387[_0xdb83('0x54')]['id'];}return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x47f387[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0x33')],'as':_0xdb83('0x34')}]})['then'](handleEntityNotFound(_0x1efff8,null))[_0xdb83('0x19')](saveUpdates(_0x47f387[_0xdb83('0x54')],null))[_0xdb83('0x19')](respondWithResult(_0x1efff8,null))['catch'](handleError(_0x1efff8,null));};exports[_0xdb83('0x2d')]=function(_0x3254dc,_0x416b1d){return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x3254dc[_0xdb83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x416b1d,null))[_0xdb83('0x19')](removeEntity(_0x416b1d,null))['catch'](handleError(_0x416b1d,null));};exports[_0xdb83('0x5c')]=function(_0x4640ec,_0x9b2023){return db[_0xdb83('0x36')][_0xdb83('0x5c')]()[_0xdb83('0x19')](respondWithResult(_0x9b2023,null))['catch'](handleError(_0x9b2023,null));};exports['addDisposition']=function(_0x14d9fa,_0x297317,_0xde890c){if(_0x14d9fa[_0xdb83('0x54')]['id']){delete _0x14d9fa[_0xdb83('0x54')]['id'];}return db[_0xdb83('0x36')]['find']({'where':{'id':_0x14d9fa[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x297317,null))[_0xdb83('0x19')](function(_0x4d09e0){if(_0x4d09e0){_0x14d9fa[_0xdb83('0x54')]['ChatWebsiteId']=_0x4d09e0['id'];return db['Disposition'][_0xdb83('0x53')](_0x14d9fa[_0xdb83('0x54')]);}})[_0xdb83('0x19')](respondWithResult(_0x297317,null))[_0xdb83('0x22')](handleError(_0x297317,null));};exports['getDispositions']=function(_0x7950d8,_0x2f6710,_0x371f4a){var _0x30d895={'raw':![],'where':{}};var _0x42555d={};var _0xfa4da7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdb83('0x5d')]({'where':{'id':_0x7950d8['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x2f6710,null))['then'](function(_0x5a208b){if(_0x5a208b){_0x42555d[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db[_0xdb83('0x5e')][_0xdb83('0x4f')]);_0x42555d[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x7950d8['query']);_0x42555d[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x42555d['model'],_0x42555d[_0xdb83('0x3b')]);_0x30d895[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x42555d[_0xdb83('0x3a')],qs[_0xdb83('0x50')](_0x7950d8[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x30d895['attributes']=_0x30d895['attributes'][_0xdb83('0x40')]?_0x30d895[_0xdb83('0x3f')]:_0x42555d[_0xdb83('0x3a')];if(!_0x7950d8[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0x30d895[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x7950d8[_0xdb83('0x3b')]['limit']);_0x30d895[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x7950d8['query'][_0xdb83('0x28')]);}_0x30d895[_0xdb83('0x5f')]=qs[_0xdb83('0x44')](_0x7950d8[_0xdb83('0x3b')]['sort']);_0x30d895[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x7950d8[_0xdb83('0x3b')],_0x42555d[_0xdb83('0x3d')]));_0x30d895[_0xdb83('0x45')][_0xdb83('0x60')]=_0x5a208b['id'];if(_0x7950d8['query']['filter']){_0x30d895[_0xdb83('0x45')]=_['merge'](_0x30d895[_0xdb83('0x45')],{'$or':_['map'](_0x30d895['attributes'],function(_0x1bb252){var _0x56e18c={};_0x56e18c[_0x1bb252]={'$like':'%'+_0x7950d8[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x56e18c;})});}_0x30d895=_[_0xdb83('0x48')]({},_0x30d895,_0x7950d8[_0xdb83('0x51')]);return db[_0xdb83('0x5e')][_0xdb83('0x27')]({'where':_0x30d895[_0xdb83('0x45')]})[_0xdb83('0x19')](function(_0x4d4903){_0xfa4da7[_0xdb83('0x27')]=_0x4d4903;if(_0x7950d8[_0xdb83('0x3b')]['includeAll']){_0x30d895[_0xdb83('0x4b')]=[{'all':!![]}];}return db[_0xdb83('0x5e')][_0xdb83('0x4c')](_0x30d895);})[_0xdb83('0x19')](function(_0x3fbb4e){_0xfa4da7[_0xdb83('0x61')]=_0x3fbb4e;return _0xfa4da7;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x2f6710,_0x30d895))[_0xdb83('0x22')](handleError(_0x2f6710,null));};exports[_0xdb83('0x62')]=function(_0x59ce90,_0x26c92e,_0x59ddc9){return db['ChatWebsite']['find']({'where':{'id':_0x59ce90[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x26c92e,null))[_0xdb83('0x19')](function(_0xb6577d){if(_0xb6577d){return _0xb6577d[_0xdb83('0x62')](_0x59ce90[_0xdb83('0x3b')][_0xdb83('0x63')]);}})['then'](respondWithStatusCode(_0x26c92e,null))['catch'](handleError(_0x26c92e,null));};exports[_0xdb83('0x64')]=function(_0x358178,_0x2d0bc8,_0x497539){if(_0x358178[_0xdb83('0x54')]['id']){delete _0x358178[_0xdb83('0x54')]['id'];}return db[_0xdb83('0x36')]['find']({'where':{'id':_0x358178['params']['id']}})['then'](handleEntityNotFound(_0x2d0bc8,null))[_0xdb83('0x19')](function(_0xc3f6c){if(_0xc3f6c){_0x358178[_0xdb83('0x54')][_0xdb83('0x60')]=_0xc3f6c['id'];return db[_0xdb83('0x65')][_0xdb83('0x53')](_0x358178[_0xdb83('0x54')]);}})[_0xdb83('0x19')](respondWithResult(_0x2d0bc8,null))['catch'](handleError(_0x2d0bc8,null));};exports[_0xdb83('0x66')]=function(_0x414d66,_0x1952c4,_0x2bec29){var _0x4429f4={'raw':![],'where':{}};var _0x86697e={};var _0x47a4e6={'count':0x0,'rows':[]};return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x414d66[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x1952c4,null))[_0xdb83('0x19')](function(_0x450962){if(_0x450962){_0x86697e[_0xdb83('0x3a')]=_['keys'](db[_0xdb83('0x65')][_0xdb83('0x4f')]);_0x86697e['query']=_[_0xdb83('0x3c')](_0x414d66[_0xdb83('0x3b')]);_0x86697e[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x86697e[_0xdb83('0x3a')],_0x86697e['query']);_0x4429f4[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x86697e[_0xdb83('0x3a')],qs[_0xdb83('0x50')](_0x414d66[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x4429f4[_0xdb83('0x3f')]=_0x4429f4[_0xdb83('0x3f')]['length']?_0x4429f4[_0xdb83('0x3f')]:_0x86697e[_0xdb83('0x3a')];if(!_0x414d66['query']['hasOwnProperty'](_0xdb83('0x42'))){_0x4429f4[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x414d66[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x4429f4[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x414d66[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0x4429f4['order']=qs[_0xdb83('0x44')](_0x414d66['query'][_0xdb83('0x44')]);_0x4429f4['where']=qs['filters'](_[_0xdb83('0x46')](_0x414d66[_0xdb83('0x3b')],_0x86697e[_0xdb83('0x3d')]));_0x4429f4[_0xdb83('0x45')][_0xdb83('0x60')]=_0x450962['id'];if(_0x414d66[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x4429f4[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x4429f4[_0xdb83('0x45')],{'$or':_[_0xdb83('0x35')](_0x4429f4[_0xdb83('0x3f')],function(_0x1d7e8c){var _0xa72152={};_0xa72152[_0x1d7e8c]={'$like':'%'+_0x414d66[_0xdb83('0x3b')]['filter']+'%'};return _0xa72152;})});}_0x4429f4=_['merge']({},_0x4429f4,_0x414d66[_0xdb83('0x51')]);return db['CannedAnswer'][_0xdb83('0x27')]({'where':_0x4429f4[_0xdb83('0x45')]})[_0xdb83('0x19')](function(_0x130697){_0x47a4e6[_0xdb83('0x27')]=_0x130697;if(_0x414d66[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0x4429f4['include']=[{'all':!![]}];}return db[_0xdb83('0x65')][_0xdb83('0x4c')](_0x4429f4);})['then'](function(_0x14ab40){_0x47a4e6[_0xdb83('0x61')]=_0x14ab40;return _0x47a4e6;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x1952c4,_0x4429f4))[_0xdb83('0x22')](handleError(_0x1952c4,null));};exports[_0xdb83('0x67')]=function(_0x40ba72,_0x24bc38,_0xb4af2e){return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x40ba72[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x24bc38,null))[_0xdb83('0x19')](function(_0x31d937){if(_0x31d937){return _0x31d937[_0xdb83('0x67')](_0x40ba72[_0xdb83('0x3b')][_0xdb83('0x63')]);}})[_0xdb83('0x19')](respondWithStatusCode(_0x24bc38,null))['catch'](handleError(_0x24bc38,null));};exports[_0xdb83('0x68')]=function(_0x31fb12,_0x279fbb,_0x1c4f00){_0x31fb12[_0xdb83('0x54')][_0xdb83('0x69')]=_0x31fb12[_0xdb83('0x6a')][_0xdb83('0x6b')];return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x31fb12[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x279fbb,null))[_0xdb83('0x19')](saveUpdates(_0x31fb12[_0xdb83('0x54')],null))['then'](respondWithResult(_0x279fbb,null))[_0xdb83('0x22')](handleError(_0x279fbb,null));};exports[_0xdb83('0x6c')]=function(_0x226728,_0x45a504,_0x8ba3b3){_0x226728[_0xdb83('0x54')][_0xdb83('0x6d')]=_0x226728[_0xdb83('0x6a')]['filename'];return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x226728['params']['id']}})['then'](handleEntityNotFound(_0x45a504,null))[_0xdb83('0x19')](saveUpdates(_0x226728['body'],null))[_0xdb83('0x19')](respondWithResult(_0x45a504,null))[_0xdb83('0x22')](handleError(_0x45a504,null));};exports[_0xdb83('0x6e')]=function(_0x26d83f,_0x363d0d,_0x2d8328){_0x26d83f['body'][_0xdb83('0x6f')]=_0x26d83f['file'][_0xdb83('0x6b')];return db['ChatWebsite'][_0xdb83('0x52')]({'where':{'id':_0x26d83f[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x363d0d,null))[_0xdb83('0x19')](saveUpdates(_0x26d83f['body'],null))[_0xdb83('0x19')](respondWithResult(_0x363d0d,null))['catch'](handleError(_0x363d0d,null));};exports[_0xdb83('0x70')]=function(_0x4034ba,_0x304b6c,_0x34bdbd){_0x4034ba[_0xdb83('0x54')]['systemAvatar']=_0x4034ba[_0xdb83('0x6a')][_0xdb83('0x6b')];return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x4034ba[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x304b6c,null))['then'](saveUpdates(_0x4034ba[_0xdb83('0x54')],null))[_0xdb83('0x19')](respondWithResult(_0x304b6c,null))['catch'](handleError(_0x304b6c,null));};exports[_0xdb83('0x71')]=function(_0x1dbc46,_0x15b376,_0x195637){var _0x19c7a6=path['join'](config[_0xdb83('0x72')],_0xdb83('0x73'));var _0x314c4a={'where':{'id':_0x1dbc46['params']['id']},'attributes':['id',_0xdb83('0x69')],'raw':!![]};var _0x109625=![];return require('../../config/license/util')[_0xdb83('0x74')]()[_0xdb83('0x19')](function(_0x409b77){if(_0x409b77){_0x109625=_0x409b77[_0xdb83('0x75')];}})[_0xdb83('0x19')](function(){return db[_0xdb83('0x36')][_0xdb83('0x52')](_0x314c4a);})[_0xdb83('0x19')](handleEntityNotFound(_0x15b376,null))[_0xdb83('0x19')](function(_0x1e9102){if(_0x1e9102){if(!_[_0xdb83('0x76')](_0x1e9102[_0xdb83('0x69')])){if(fs[_0xdb83('0x77')](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x79'),_0x1e9102[_0xdb83('0x69')]))&&_0x109625){_0x19c7a6=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x79'),_0x1e9102[_0xdb83('0x69')]);}}return _0x15b376[_0xdb83('0x7a')](_0x19c7a6);}})[_0xdb83('0x22')](handleError(_0x15b376,null));};exports[_0xdb83('0x7b')]=function(_0x76a567,_0x5ca66a,_0x117fa8){var _0x5a4d11=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x7c'));var _0x1e890a={'where':{'id':_0x76a567[_0xdb83('0x4e')]['id']},'attributes':['id',_0xdb83('0x6d')],'raw':!![]};return db[_0xdb83('0x36')]['find'](_0x1e890a)[_0xdb83('0x19')](handleEntityNotFound(_0x5ca66a,null))[_0xdb83('0x19')](function(_0x16e52a){if(_0x16e52a){if(!_[_0xdb83('0x76')](_0x16e52a[_0xdb83('0x6d')])){if(fs[_0xdb83('0x77')](path[_0xdb83('0x78')](config['root'],_0xdb83('0x7d'),_0x16e52a['agentAvatar']))){_0x5a4d11=path['join'](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0x16e52a[_0xdb83('0x6d')]);}}return _0x5ca66a[_0xdb83('0x7a')](_0x5a4d11);}})[_0xdb83('0x22')](handleError(_0x5ca66a,null));};exports['getCustomerAvatar']=function(_0x14a0c6,_0xf482df,_0x268ad6){var _0x4d4cee=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x7e'));var _0x564d2a={'where':{'id':_0x14a0c6['params']['id']},'attributes':['id','customerAvatar',_0xdb83('0x7f')],'raw':!![]};return db[_0xdb83('0x36')][_0xdb83('0x52')](_0x564d2a)[_0xdb83('0x19')](handleEntityNotFound(_0xf482df,null))['then'](function(_0xbec92f){if(_0xbec92f){if(!_[_0xdb83('0x76')](_0xbec92f['customerAvatar'])){if(fs[_0xdb83('0x77')](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0xbec92f[_0xdb83('0x6f')]))&&_0xbec92f['showCustomerAvatar']){_0x4d4cee=path['join'](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0xbec92f['customerAvatar']);}}return _0xf482df['download'](_0x4d4cee);}})[_0xdb83('0x22')](handleError(_0xf482df,null));};exports[_0xdb83('0x80')]=function(_0x3e00dd,_0x3f0416,_0xf7a5a2){var _0x1d785e=path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0x81'));var _0x1493da={'where':{'id':_0x3e00dd['params']['id']},'attributes':['id',_0xdb83('0x82')],'raw':!![]};return db['ChatWebsite'][_0xdb83('0x52')](_0x1493da)[_0xdb83('0x19')](handleEntityNotFound(_0x3f0416,null))[_0xdb83('0x19')](function(_0x488c8f){if(_0x488c8f){if(!_[_0xdb83('0x76')](_0x488c8f['systemAvatar'])){if(fs[_0xdb83('0x77')](path['join'](config[_0xdb83('0x72')],_0xdb83('0x7d'),_0x488c8f[_0xdb83('0x82')]))){_0x1d785e=path['join'](config['root'],_0xdb83('0x7d'),_0x488c8f[_0xdb83('0x82')]);}}return _0x3f0416['download'](_0x1d785e);}})['catch'](handleError(_0x3f0416,null));};exports[_0xdb83('0x83')]=function(_0x1435d1,_0x2a7c60,_0x1cdb07){var _0x546e43=require(_0xdb83('0x84'));var _0xd0e6c4=new _0x546e43();var _0x34ef42=_0xd0e6c4[_0xdb83('0x85')](_0x1435d1[_0xdb83('0x86')]['user-agent'])[_0xdb83('0x87')]();var _0x2ed948={'body':_0x1435d1[_0xdb83('0x54')],'channel':_0xdb83('0x88')};var _0x11b320=[];var _0x5e51ef=[];var _0x424721={};var _0x5714a8=![];return db[_0xdb83('0x89')][_0xdb83('0x5c')]()[_0xdb83('0x19')](function(_0x35ad21){if(!_0x35ad21){throw new db[(_0xdb83('0x8a'))]['ValidationError'](_0xdb83('0x8b'));}_0x11b320=_['difference'](_['keys'](_0x35ad21),[_0xdb83('0x8c'),_0xdb83('0x8d')]);_0x5e51ef=_[_0xdb83('0x8e')](_[_0xdb83('0x3c')](_0x35ad21),[_0xdb83('0x8c'),_0xdb83('0x8d'),_0xdb83('0x8f'),_0xdb83('0x90')]);if(_0x1435d1[_0xdb83('0x54')]['id']){delete _0x1435d1[_0xdb83('0x54')]['id'];}if(_[_0xdb83('0x76')](_0x1435d1[_0xdb83('0x54')]['from'])){throw new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x92'));}if(_[_0xdb83('0x76')](_0x1435d1[_0xdb83('0x54')][_0xdb83('0x54')])||_0x1435d1[_0xdb83('0x54')]['body']===''){throw new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x93'));}if(_[_0xdb83('0x76')](_0x1435d1['body'][_0xdb83('0x94')])){throw new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x95')+_0x5e51ef);}if(!_[_0xdb83('0x96')](_0x5e51ef,_0x1435d1[_0xdb83('0x54')][_0xdb83('0x94')])){throw new db[(_0xdb83('0x8a'))]['ValidationError'](_0xdb83('0x97')+_0x5e51ef);}_0x424721[_0x1435d1[_0xdb83('0x54')][_0xdb83('0x94')]]=_0x1435d1[_0xdb83('0x54')][_0xdb83('0x98')];})[_0xdb83('0x19')](function(){return db[_0xdb83('0x36')]['find']({'where':{'id':_0x1435d1[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0x99')],'as':_0xdb83('0x9a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x424721,'limit':0x1,'order':[[_0xdb83('0x8d'),'DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2a7c60,null))[_0xdb83('0x19')](function(_0x1e0b63){if(_0x1e0b63&&_0x1e0b63[_0xdb83('0x9a')]){_0x2ed948[_0xdb83('0x9b')]=_0x1e0b63;_0x2ed948[_0xdb83('0x9c')]=_0x1e0b63[_0xdb83('0x9d')];_0x2ed948[_0xdb83('0x9e')]=_0x1e0b63[_0xdb83('0x9a')];_0x2ed948[_0xdb83('0x9c')]=_['orderBy'](_0x2ed948['applications'],[_0xdb83('0x9f')],['asc']);if(_0x2ed948[_0xdb83('0x9b')]['Applications']){delete _0x2ed948[_0xdb83('0x9b')][_0xdb83('0x9d')];}if(_0x2ed948['account'][_0xdb83('0x9a')]&&_0x2ed948[_0xdb83('0x9b')][_0xdb83('0x9a')]['Contacts']['length']){return _0x2ed948[_0xdb83('0x9b')][_0xdb83('0x9a')][_0xdb83('0xa0')][0x0];}var _0x3e400b=_[_0xdb83('0xa1')](_0x1435d1['body'],{'firstName':_0x1435d1[_0xdb83('0x54')][_0xdb83('0x98')],'ListId':_0x1e0b63['ListId']});_0x3e400b[_0x1435d1[_0xdb83('0x54')]['mapKey']]=_0x1435d1['body']['from'];return db[_0xdb83('0x89')][_0xdb83('0x53')](_0x3e400b,{'fields':_0x11b320,'raw':!![]});}})[_0xdb83('0x19')](handleEntityNotFound(_0x2a7c60,null))[_0xdb83('0x19')](function(_0x27bc84){_0x2ed948['contact']=_0x27bc84;var _0x5e5810=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xa2')];if(_0x1435d1[_0xdb83('0x86')][_0xdb83('0xa3')]){_0x5e5810=_0x1435d1[_0xdb83('0x86')]['cf-connecting-ip'];}else if(_0x1435d1['headers']['x-forwarded-for']){_0x5e5810=_[_0xdb83('0xa4')](_0x1435d1[_0xdb83('0x86')]['x-forwarded-for'][_0xdb83('0xa5')](','));}if(_0x27bc84){var _0x41aaa5={'ContactId':_0x27bc84['id'],'ChatWebsiteId':_0x1435d1[_0xdb83('0x4e')]['id'],'from':(_0x27bc84[_0xdb83('0xa6')]||'')+'\x20'+(_0x27bc84[_0xdb83('0xa7')]||''),'customerIp':_0x5e5810,'customerPort':_0x1435d1[_0xdb83('0x86')][_0xdb83('0xa8')]?_0x1435d1[_0xdb83('0x86')][_0xdb83('0xa8')]:null,'referer':_0x1435d1[_0xdb83('0x54')][_0xdb83('0xa9')],'browserName':_0x34ef42[_0xdb83('0xaa')][_0xdb83('0x31')]&&_0x34ef42['browser'][_0xdb83('0xab')]?util[_0xdb83('0xac')](_0xdb83('0xad'),_0x34ef42[_0xdb83('0xaa')][_0xdb83('0x31')],_0x34ef42[_0xdb83('0xaa')][_0xdb83('0xab')]):_0xdb83('0xae'),'browserVersion':_0x34ef42['browser']['version']||_0xdb83('0xae'),'osName':util[_0xdb83('0xac')](_0xdb83('0xad'),_0x34ef42['os']['name'],_0x34ef42['os'][_0xdb83('0xab')]),'osVersion':_0x34ef42['os'][_0xdb83('0xab')],'deviceModel':_0x34ef42[_0xdb83('0xaf')][_0xdb83('0x3a')]&&_0x34ef42[_0xdb83('0xaf')]['vendor']?util[_0xdb83('0xac')](_0xdb83('0xb0'),_0x34ef42[_0xdb83('0xaf')]['model'],_0x34ef42[_0xdb83('0xaf')][_0xdb83('0xb1')],_0x34ef42[_0xdb83('0xaf')][_0xdb83('0x38')]):null,'deviceVendor':_0x34ef42[_0xdb83('0xaf')][_0xdb83('0xb1')],'deviceType':_0x34ef42[_0xdb83('0xaf')][_0xdb83('0x38')],'formData':JSON[_0xdb83('0x1d')](_0x1435d1[_0xdb83('0x54')])};var _0xa7521e={'ChatWebsiteId':_0x1435d1['params']['id'],'closed':![]};if(_0x1435d1[_0xdb83('0x54')]['threadId']){_0xa7521e[_0xdb83('0xb2')]=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')];return db[_0xdb83('0xb3')][_0xdb83('0x52')]({'where':_0xa7521e})[_0xdb83('0x19')](function(_0x64ea82){if(_0x64ea82){return[_0x64ea82,![]];}_0x41aaa5['threadId']=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')];_0x41aaa5[_0xdb83('0xb4')]=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb4')];return db[_0xdb83('0xb3')]['create'](_0x41aaa5)['then'](function(_0x42bd75){return[_0x42bd75,!![]];});});}_0xa7521e[_0xdb83('0xb5')]=_0x27bc84['id'];if(_0x1435d1['body'][_0xdb83('0xb6')]&&_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb6')]['id']){_0xa7521e['id']=_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb6')]['id'];return db[_0xdb83('0xb3')][_0xdb83('0x52')]({'where':_0xa7521e})[_0xdb83('0x19')](function(_0x48b5fc){if(_0x48b5fc){return[_0x48b5fc,![]];}return db['ChatInteraction']['create'](_0x41aaa5)[_0xdb83('0x19')](function(_0x952256){return[_0x952256,!![]];});});}return db['ChatInteraction'][_0xdb83('0x53')](_0x41aaa5)['then'](function(_0x586041){return[_0x586041,!![]];});}})['spread'](function(_0x109a4b,_0x34ba19){if(_0x109a4b){_0x5714a8=_0x34ba19;if(!_0x34ba19){var _0x4c216b={'from':(_0x2ed948[_0xdb83('0xb7')]['firstName']||'')+'\x20'+(_0x2ed948[_0xdb83('0xb7')]['lastName']||'')};if(_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')]&&_0x1435d1['body'][_0xdb83('0xb8')]&&_0x1435d1[_0xdb83('0x54')][_0xdb83('0xb2')]!=_0x1435d1['body'][_0xdb83('0xb8')]){_0x4c216b[_0xdb83('0xb2')]=_0x1435d1['body'][_0xdb83('0xb8')];}return _0x109a4b[_0xdb83('0x2c')](_0x4c216b);}else{return _0x109a4b;}}})[_0xdb83('0x19')](function(_0x22debe){_0x2ed948[_0xdb83('0xb6')]=_0x22debe['get']({'plain':!![]});_0x2ed948[_0xdb83('0xb6')][_0xdb83('0xb9')]=_0x5714a8;if(_0x2ed948[_0xdb83('0xb6')]['created']){if(_0x2ed948['account'][_0xdb83('0xba')]){_0x2ed948['applications'][_0xdb83('0xbb')]({'id':0x0,'priority':_0x2ed948[_0xdb83('0x9c')][_0xdb83('0x40')]+0x1,'app':_0xdb83('0xbc'),'appdata':_0xdb83('0xbd'),'interval':_0xdb83('0xbe')});}}return db[_0xdb83('0xbf')]['create']({'body':_0x1435d1[_0xdb83('0x54')]['body'],'ChatWebsiteId':_0x1435d1[_0xdb83('0x4e')]['id'],'ChatInteractionId':_0x22debe['id'],'direction':'in','ContactId':_0x2ed948[_0xdb83('0xb7')]['id'],'AttachmentId':_0x1435d1['body'][_0xdb83('0xc0')]});})[_0xdb83('0x19')](function(_0x2de67d){_0x2ed948['message']=_0x2de67d;if(_0x2ed948[_0xdb83('0xb6')]['UserId']){return db['User'][_0xdb83('0x52')]({'attributes':['id',_0xdb83('0x31')],'where':{'id':_0x2ed948[_0xdb83('0xb6')][_0xdb83('0xc1')]}})['then'](function(_0x25eb9b){if(_0x25eb9b){_0x2ed948['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xdb83('0xc2'),'appdata':_0x25eb9b['name']+','+(_0x2ed948[_0xdb83('0x9b')]['waitForTheAssignedAgent']||0xa),'interval':_0xdb83('0xbe')});_0x2ed948[_0xdb83('0xc3')]=!![];}return respondWithRpcPromise(_0xdb83('0xc4'),'startRouting',_0x2ed948);});}return respondWithRpcPromise('Start','startRouting',_0x2ed948);})[_0xdb83('0x19')](function(_0x68f25c){respondWithRpcPromise(_0xdb83('0xc5'),_0xdb83('0xc5'),{'event':_0xdb83('0x83'),'message':_0x68f25c},client9002);return _0x68f25c;})[_0xdb83('0x19')](respondWithResult(_0x2a7c60,null))[_0xdb83('0x22')](handleError(_0x2a7c60,null));};exports[_0xdb83('0xc6')]=function(_0x52bb7c,_0x32bcf1,_0x30fd21){var _0x2b60dc,_0x110dfa,_0x5aea20;var _0xac7256=[];var _0x1f3b65=[];var _0x58177={};return db[_0xdb83('0x89')]['describe']()[_0xdb83('0x19')](function(_0x210a7c){if(!_0x210a7c){throw new db[(_0xdb83('0x8a'))]['ValidationError'](_0xdb83('0x8b'));}_0x1f3b65=_[_0xdb83('0x8e')](_[_0xdb83('0x3c')](_0x210a7c),['createdAt',_0xdb83('0x8d')]);_0xac7256=_[_0xdb83('0x8e')](_[_0xdb83('0x3c')](_0x210a7c),['createdAt',_0xdb83('0x8d'),'CompanyId',_0xdb83('0x90')]);if(_0x52bb7c['body']['id']){delete _0x52bb7c['body']['id'];}if(_[_0xdb83('0x76')](_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x98')])){throw _0x32bcf1['status'](0x1f4)['send'](new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x92')));}if(_[_0xdb83('0x76')](_0x52bb7c['body']['body'])||_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x54')]===''){throw _0x32bcf1[_0xdb83('0x24')](0x1f4)[_0xdb83('0xc7')](new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0x93')));}if(_[_0xdb83('0x76')](_0x52bb7c[_0xdb83('0x54')]['mapKeyOffline'])){throw _0x32bcf1['status'](0x1f4)[_0xdb83('0xc7')](new db[(_0xdb83('0x8a'))][(_0xdb83('0x91'))](_0xdb83('0xc8')+_0xac7256));}if(!_[_0xdb83('0x96')](_0xac7256,_0x52bb7c[_0xdb83('0x54')][_0xdb83('0xc9')])){throw _0x32bcf1[_0xdb83('0x24')](0x1f4)['send'](new db['Sequelize'][(_0xdb83('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xac7256));}_0x58177[_0x52bb7c[_0xdb83('0x54')][_0xdb83('0xc9')]]=_0x52bb7c['body'][_0xdb83('0x98')];})[_0xdb83('0x19')](function(){return db['ChatWebsite'][_0xdb83('0x52')]({'where':{'id':_0x52bb7c[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0x99')],'as':_0xdb83('0x9a')}]});})[_0xdb83('0x19')](handleEntityNotFound(_0x32bcf1,null))[_0xdb83('0x19')](function(_0x4b3abe){if(_0x4b3abe&&_0x4b3abe[_0xdb83('0x9a')]){_0x110dfa=_0x4b3abe;var _0x5da5cc=_['defaults'](_0x52bb7c[_0xdb83('0x54')],{'firstName':_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x98')],'phone':_0x52bb7c[_0xdb83('0x54')][_0xdb83('0x98')],'ListId':_0x4b3abe['ListId']});_0x5da5cc[_0x52bb7c[_0xdb83('0x54')]['mapKeyOffline']]=_0x52bb7c['body'][_0xdb83('0x98')];return db['CmContact'][_0xdb83('0xca')]({'where':_0x58177,'defaults':_0x5da5cc});}})[_0xdb83('0xcb')](function(_0x341d41){if(_0x341d41){_0x5aea20=_0x341d41;var _0x50de1b=fs[_0xdb83('0xcc')](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0xcd')),'utf8');var _0x4fbac7=ejs['render'](_0x50de1b,{'body':_[_0xdb83('0xce')](_0x52bb7c['body']['body']),'bodyTitle':_0x110dfa[_0xdb83('0xcf')]});return db[_0xdb83('0xd0')]['create']({'body':_0x4fbac7,'ContactId':_0x341d41['id'],'ChatWebsiteId':_0x110dfa['id']});}})[_0xdb83('0x19')](function(_0x1ac6c3){if(_0x1ac6c3){_0x2b60dc=_0x1ac6c3;return db[_0xdb83('0xd1')][_0xdb83('0x5d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xdb83('0xd2'),'raw':!![]}]});}})[_0xdb83('0x19')](function(_0x1c6e03){if(_0x1c6e03&&_0x1c6e03[_0xdb83('0xd2')]&&_0x110dfa[_0xdb83('0xd3')]){var _0x4b3fba={'tls':{'rejectUnauthorized':![]}};if(_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd4')]){_0x4b3fba[_0xdb83('0xd4')]=_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd4')];}else{_0x4b3fba['host']=_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd5')];_0x4b3fba[_0xdb83('0xd6')]=_0x1c6e03[_0xdb83('0xd2')]['port'];_0x4b3fba[_0xdb83('0xd7')]=_0x1c6e03['Smtp']['secure'];}if(_0x1c6e03[_0xdb83('0xd2')]['authentication']){_0x4b3fba[_0xdb83('0xd8')]={'user':_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0x55')],'pass':_0x1c6e03[_0xdb83('0xd2')][_0xdb83('0xd9')]};}return respondWithRpcPromise('SendMail',_0xdb83('0xda'),{'account':_0x4b3fba,'message':{'from':util['format'](_0xdb83('0xdb'),_0x1c6e03[_0xdb83('0x31')],_0x1c6e03[_0xdb83('0xdc')]||_0x1c6e03[_0xdb83('0xd2')]['user']),'to':_0x110dfa[_0xdb83('0xd3')],'subject':_0x110dfa[_0xdb83('0xdd')],'text':_0x2b60dc['body']}},client9003)[_0xdb83('0x19')](function(){return _0x2b60dc;})[_0xdb83('0x22')](function(_0x3810fa){console['error'](_0x3810fa);});}})[_0xdb83('0x19')](function(){if(_0x2b60dc){return _0x2b60dc;}})['then'](respondWithResult(_0x32bcf1,null))[_0xdb83('0x22')](handleError(_0x32bcf1,null));};exports[_0xdb83('0xde')]=function(_0x2240a7,_0x1c9e6a,_0x5538e7){return db[_0xdb83('0xb3')]['find']({'where':{'id':_0x2240a7['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x1c9e6a,null))[_0xdb83('0x19')](function(_0x286012){if(_0x286012){return _0x286012['addInteraction'](_0x2240a7['body'][_0xdb83('0x63')],_[_0xdb83('0xdf')](_0x2240a7[_0xdb83('0x54')],[_0xdb83('0x63'),'id'])||{});}})['then'](respondWithResult(_0x1c9e6a,null))[_0xdb83('0x22')](handleError(_0x1c9e6a,null));};exports['getInteractions']=function(_0x118089,_0x580bb3,_0x478ba9){var _0x2db036={'raw':![],'where':{}};var _0x2d482a={};var _0x36a62c={'count':0x0,'rows':[]};return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x118089[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x580bb3,null))[_0xdb83('0x19')](function(_0x274a49){if(_0x274a49){_0x2d482a[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db['ChatInteraction'][_0xdb83('0x4f')]);_0x2d482a['query']=_['keys'](_0x118089[_0xdb83('0x3b')]);_0x2d482a[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x2d482a[_0xdb83('0x3a')],_0x2d482a[_0xdb83('0x3b')]);_0x2db036[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x2d482a[_0xdb83('0x3a')],qs[_0xdb83('0x50')](_0x118089['query'][_0xdb83('0x50')]));_0x2db036[_0xdb83('0x3f')]=_0x2db036[_0xdb83('0x3f')][_0xdb83('0x40')]?_0x2db036[_0xdb83('0x3f')]:_0x2d482a[_0xdb83('0x3a')];if(!_0x118089[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0x2db036['limit']=qs[_0xdb83('0x43')](_0x118089[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x2db036['offset']=qs[_0xdb83('0x28')](_0x118089[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0x2db036[_0xdb83('0x5f')]=qs[_0xdb83('0x44')](_0x118089[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x2db036[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x118089[_0xdb83('0x3b')],_0x2d482a[_0xdb83('0x3d')]));_0x2db036['where']['ChatWebsiteId']=_0x274a49['id'];if(_0x118089['query'][_0xdb83('0x47')]){_0x2db036[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x2db036['where'],{'$or':_[_0xdb83('0x35')](_0x2db036['attributes'],function(_0x50c7b7){var _0x4cb025={};_0x4cb025[_0x50c7b7]={'$like':'%'+_0x118089[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x4cb025;})});}_0x2db036=_[_0xdb83('0x48')]({},_0x2db036,_0x118089[_0xdb83('0x51')]);return db[_0xdb83('0xb3')][_0xdb83('0x27')]({'where':_0x2db036[_0xdb83('0x45')]})[_0xdb83('0x19')](function(_0x457417){_0x36a62c[_0xdb83('0x27')]=_0x457417;if(_0x118089[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0x2db036[_0xdb83('0x4b')]=[{'model':db['CmContact'],'as':_0xdb83('0xe0'),'required':![]},{'model':db['User'],'as':_0xdb83('0xe1'),'attributes':[_0xdb83('0x31'),_0xdb83('0xe2'),'internal'],'required':![]},{'model':db[_0xdb83('0xe3')],'as':_0xdb83('0xe4'),'attributes':['id','name',_0xdb83('0xe5')],'where':_0x118089['query'][_0xdb83('0xe6')]?{'id':_0x118089['query'][_0xdb83('0xe6')]}:undefined,'required':_0x118089[_0xdb83('0x3b')][_0xdb83('0xe6')]?!![]:![]}];}return db[_0xdb83('0xb3')]['findAll'](_0x2db036);})[_0xdb83('0x19')](function(_0x53c068){_0x36a62c['rows']=_0x53c068;return _0x36a62c;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x580bb3,_0x2db036))[_0xdb83('0x22')](handleError(_0x580bb3,null));};function iftimePromise(_0x29f3ae,_0x4b49b5){return respondWithRpcPromise(_0xdb83('0xe7'),_0xdb83('0xe8'),{'command':_0x4b49b5[_0xdb83('0xe9')]?util[_0xdb83('0xac')](_0xdb83('0xea'),_0x29f3ae['interval'],_0x4b49b5[_0xdb83('0xe9')]):util[_0xdb83('0xac')](_0xdb83('0xeb'),_0x29f3ae[_0xdb83('0xec')])},client9002)[_0xdb83('0x19')](function(_0x104983){var _0x241f27=_0x104983&&_0x104983[_0xdb83('0xed')](_0xdb83('0xee'))>=0x0?!![]:![];logger[_0xdb83('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4b49b5['id'],_0x29f3ae['id'],_0x29f3ae['interval'],_0x241f27?'ONLINE':_0xdb83('0xef'),_0x4b49b5[_0xdb83('0xe9')]?_0x4b49b5['timezone']:_0xdb83('0xf0'));return _0x241f27;})[_0xdb83('0x22')](function(_0x2e6718){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4b49b5['id'],_0x29f3ae['id'],_0x29f3ae[_0xdb83('0xec')],util[_0xdb83('0xf1')](_0x2e6718,{'showHidden':![],'depth':null}),_0x4b49b5[_0xdb83('0xe9')]?_0x4b49b5[_0xdb83('0xe9')]:'No\x20timezone');return![];});}exports[_0xdb83('0xe8')]=function(_0x2fe171,_0x50c078,_0x574ff4){var _0x314a98=0x0;var _0x1b5dce=0x0;var _0x366980=![];var _0x51a252;var _0x4dbfb1;return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x2fe171[_0xdb83('0x4e')]['id']},'include':[{'model':db[_0xdb83('0xf2')],'as':_0xdb83('0xf2'),'include':[{'model':db[_0xdb83('0xf2')],'as':_0xdb83('0xf3'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x50c078,null))[_0xdb83('0x19')](function(_0x4548f1){if(_0x4548f1){_0x51a252=_0x4548f1;return _0x4548f1['getProactiveActions']({'raw':!![]});}})[_0xdb83('0x19')](function(_0x33625a){if(_0x51a252){if(_0x33625a){_0x4dbfb1=_0x33625a;}}return require(_0xdb83('0xf4'))[_0xdb83('0x74')]();})['then'](function(_0x29ab51){if(_0x29ab51){_0x1b5dce=_0x29ab51[_0xdb83('0xf5')];_0x366980=_0x29ab51[_0xdb83('0x75')];}})[_0xdb83('0x19')](function(){return db[_0xdb83('0xb3')][_0xdb83('0x27')]({'where':{'closed':![]}});})[_0xdb83('0x19')](function(_0x410f71){_0x314a98=_0x410f71;if(_0x1b5dce&&_0x410f71>_0x1b5dce){return db[_0xdb83('0xf6')][_0xdb83('0x5d')]({'where':{'id':0x1}})[_0xdb83('0x19')](function(_0x3dac03){if(_0x3dac03){_0x3dac03[_0xdb83('0xf7')](_0xdb83('0xf8'));}});}})[_0xdb83('0x19')](function(){if(_0x51a252['Interval']&&_0x51a252[_0xdb83('0xf2')][_0xdb83('0xf3')]){var _0x239b3d=[];for(var _0x210a59=0x0;_0x210a59<_0x51a252[_0xdb83('0xf2')][_0xdb83('0xf3')][_0xdb83('0x40')];_0x210a59++){var _0x144ab1=_0x51a252[_0xdb83('0xf2')][_0xdb83('0xf3')][_0x210a59][_0xdb83('0x2e')]({'plain':!![]});_0x239b3d[_0xdb83('0xbb')](iftimePromise(_0x144ab1,_0x51a252));}return BPromise[_0xdb83('0xf9')](_0x239b3d)[_0xdb83('0x19')](function(_0x13e94d){return _[_0xdb83('0xfa')](_0x13e94d);});}else{return!![];}})[_0xdb83('0x19')](function(_0x28cebd){var _0x3defec=fs['readFileSync'](path[_0xdb83('0x78')](config[_0xdb83('0x72')],_0xdb83('0xfb')),_0xdb83('0xfc'));var _0x2c8b75={'remote':_0x51a252[_0xdb83('0xfd')],'query':querystring['stringify'](_[_0xdb83('0x48')](_0x51a252['get']({'plain':!![]}),{'customerIp':_0x2fe171['headers'][_0xdb83('0xfe')]||_0x2fe171[_0xdb83('0x86')][_0xdb83('0xff')]||_0x2fe171['connection']['remoteAddress']||_0x2fe171['ip'],'referer':_0x2fe171[_0xdb83('0x86')][_0xdb83('0xa9')],'openedInteractions':_0x314a98,'maxInteractions':_0x1b5dce,'virtual':_0x366980[_0xdb83('0xf5')],'online':_0x28cebd,'custom':_0x366980}))[_0xdb83('0x100')](/'/g,'\x5c\x27')};_0x50c078['send'](ejs['render'](Mustache[_0xdb83('0x101')](_0x3defec,_0x2c8b75),{'proactiveActions':_0x4dbfb1,'alignment':_0x51a252['alignment'],'verticalAlignment':_0x51a252['verticalAlignment'],'div_color':_0x51a252[_0xdb83('0xe5')],'text_color':_0x51a252[_0xdb83('0x102')]}));})[_0xdb83('0x22')](handleError(_0x50c078,null));};exports['addApplications']=function(_0x1a34ff,_0x176db4,_0x492047){return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x1a34ff[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x176db4,null))['then'](function(_0x4b6b9a){if(_0x4b6b9a){return db['sequelize'][_0xdb83('0x103')](function(_0x40eb4a){return db[_0xdb83('0x104')][_0xdb83('0x2d')]({'where':{'ChatWebsiteId':_0x1a34ff['params']['id']},'transaction':_0x40eb4a})[_0xdb83('0x19')](function(_0x2dbd84){var _0x387a6b=_[_0xdb83('0x35')](_0x1a34ff[_0xdb83('0x54')],function(_0x55a328){_0x55a328[_0xdb83('0x60')]=_0x1a34ff[_0xdb83('0x4e')]['id'];return _0x55a328;});return db['ChatApplication'][_0xdb83('0x105')](_0x387a6b,{'transaction':_0x40eb4a});});})[_0xdb83('0x19')](function(){return db[_0xdb83('0x104')][_0xdb83('0x106')]({'where':{'ChatWebsiteId':_0x1a34ff[_0xdb83('0x4e')]['id']},'order':_0xdb83('0x9f')});});}})['then'](respondWithResult(_0x176db4,null))[_0xdb83('0x22')](handleError(_0x176db4,null));};exports[_0xdb83('0x107')]=function(_0x383e48,_0x420773,_0x46eb90){var _0x8c29e={};var _0x2c4efb={};var _0x56c01b;var _0x589dde;return db[_0xdb83('0x36')][_0xdb83('0x5d')]({'where':{'id':_0x383e48['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x420773,null))[_0xdb83('0x19')](function(_0x48cc0c){if(_0x48cc0c){_0x56c01b=_0x48cc0c;_0x2c4efb['model']=_[_0xdb83('0x3c')](db[_0xdb83('0x104')][_0xdb83('0x4f')]);_0x2c4efb[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x383e48[_0xdb83('0x3b')]);_0x2c4efb[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x2c4efb['model'],_0x2c4efb[_0xdb83('0x3b')]);_0x8c29e[_0xdb83('0x3f')]=_['intersection'](_0x2c4efb['model'],qs[_0xdb83('0x50')](_0x383e48[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x8c29e[_0xdb83('0x3f')]=_0x8c29e[_0xdb83('0x3f')]['length']?_0x8c29e['attributes']:_0x2c4efb['model'];_0x8c29e[_0xdb83('0x5f')]=qs['sort'](_0x383e48[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x8c29e[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x383e48[_0xdb83('0x3b')],_0x2c4efb[_0xdb83('0x3d')]));if(_0x383e48[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x8c29e[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x8c29e[_0xdb83('0x45')],{'$or':_[_0xdb83('0x35')](_0x8c29e[_0xdb83('0x3f')],function(_0x8d7f25){var _0x366b42={};_0x366b42[_0x8d7f25]={'$like':'%'+_0x383e48['query'][_0xdb83('0x47')]+'%'};return _0x366b42;})});}_0x8c29e=_[_0xdb83('0x48')]({},_0x8c29e,_0x383e48[_0xdb83('0x51')]);return _0x56c01b[_0xdb83('0x107')](_0x8c29e);}})[_0xdb83('0x19')](function(_0xf19dfd){if(_0xf19dfd){_0x589dde=_0xf19dfd['length'];if(!_0x383e48[_0xdb83('0x3b')]['hasOwnProperty'](_0xdb83('0x42'))){_0x8c29e[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x383e48[_0xdb83('0x3b')]['limit']);_0x8c29e[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x383e48['query'][_0xdb83('0x28')]);}return _0x56c01b[_0xdb83('0x107')](_0x8c29e);}})['then'](function(_0x400c2f){if(_0x400c2f){return _0x400c2f?{'count':_0x589dde,'rows':_0x400c2f}:null;}})[_0xdb83('0x19')](respondWithResult(_0x420773,null))[_0xdb83('0x22')](handleError(_0x420773,null));};exports[_0xdb83('0x108')]=function(_0x26c133,_0x381ef7,_0x8876fb){return db[_0xdb83('0x109')][_0xdb83('0x52')]({'where':{'id':_0x26c133[_0xdb83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x381ef7,null))[_0xdb83('0x19')](function(_0x453fc1){if(_0x453fc1){return _0x453fc1[_0xdb83('0x108')](_0x26c133['body'][_0xdb83('0x63')],_[_0xdb83('0xdf')](_0x26c133[_0xdb83('0x54')],['ids','id'])||{});}})['then'](respondWithResult(_0x381ef7,null))[_0xdb83('0x22')](handleError(_0x381ef7,null));};exports[_0xdb83('0x10a')]=function(_0x2bee80,_0xaa55f2,_0x25bd73){var _0x5d6931={};var _0x1ec9ba={};var _0x3eac0e;var _0x4af340;return db['ChatWebsite'][_0xdb83('0x5d')]({'where':{'id':_0x2bee80[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0xaa55f2,null))[_0xdb83('0x19')](function(_0xfca476){if(_0xfca476){_0x3eac0e=_0xfca476;_0x1ec9ba[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db[_0xdb83('0x10b')][_0xdb83('0x4f')]);_0x1ec9ba[_0xdb83('0x3b')]=_[_0xdb83('0x3c')](_0x2bee80[_0xdb83('0x3b')]);_0x1ec9ba[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x1ec9ba['model'],_0x1ec9ba['query']);_0x5d6931[_0xdb83('0x3f')]=_['intersection'](_0x1ec9ba['model'],qs[_0xdb83('0x50')](_0x2bee80['query']['fields']));_0x5d6931['attributes']=_0x5d6931[_0xdb83('0x3f')][_0xdb83('0x40')]?_0x5d6931['attributes']:_0x1ec9ba[_0xdb83('0x3a')];_0x5d6931['order']=qs[_0xdb83('0x44')](_0x2bee80[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x5d6931['where']=qs['filters'](_[_0xdb83('0x46')](_0x2bee80['query'],_0x1ec9ba[_0xdb83('0x3d')]));if(_0x2bee80[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x5d6931['where']=_[_0xdb83('0x48')](_0x5d6931[_0xdb83('0x45')],{'$or':_['map'](_0x5d6931[_0xdb83('0x3f')],function(_0x502769){var _0x5b2199={};_0x5b2199[_0x502769]={'$like':'%'+_0x2bee80[_0xdb83('0x3b')]['filter']+'%'};return _0x5b2199;})});}_0x5d6931=_['merge']({},_0x5d6931,_0x2bee80[_0xdb83('0x51')]);return _0x3eac0e['getProactiveActions'](_0x5d6931);}})[_0xdb83('0x19')](function(_0x4f9439){if(_0x4f9439){_0x4af340=_0x4f9439[_0xdb83('0x40')];if(!_0x2bee80[_0xdb83('0x3b')][_0xdb83('0x41')](_0xdb83('0x42'))){_0x5d6931[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x2bee80['query'][_0xdb83('0x43')]);_0x5d6931[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x2bee80['query'][_0xdb83('0x28')]);}return _0x3eac0e[_0xdb83('0x10a')](_0x5d6931);}})[_0xdb83('0x19')](function(_0x441673){if(_0x441673){return _0x441673?{'count':_0x4af340,'rows':_0x441673}:null;}})['then'](respondWithResult(_0xaa55f2,null))[_0xdb83('0x22')](handleError(_0xaa55f2,null));};exports[_0xdb83('0x10c')]=function(_0xf579eb,_0x369e61,_0x5a3a54){var _0x4eafbc=_0xf579eb[_0xdb83('0x3b')][_0xdb83('0x10d')]==='false'?'offlineForm':_0xdb83('0x10e');return db[_0xdb83('0x36')][_0xdb83('0x52')]({'attributes':['id',_0x4eafbc],'where':{'id':_0xf579eb[_0xdb83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x369e61,null))[_0xdb83('0x19')](function(_0x17d4cf){if(_0x17d4cf){var _0x5df2b4=_0x17d4cf[_0x4eafbc];var _0x536f7c=_0x5df2b4&&_0x5df2b4['items']?_0x5df2b4[_0xdb83('0x10f')]:[];_0x369e61[_0xdb83('0xc7')]({'fromKey':_[_0xdb83('0x76')](_0x5df2b4['fromKey'])?undefined:_0x5df2b4[_0xdb83('0x110')],'count':_0x536f7c[_0xdb83('0x40')],'rows':_0x536f7c});}})['catch'](handleError(_0x369e61,null));};exports[_0xdb83('0x111')]=function(_0x51ed6e,_0x2e680b,_0x49508f){var _0x4805bd={'raw':![],'where':{}};var _0x5c956f={};var _0x3ed3d3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdb83('0x5d')]({'where':{'id':_0x51ed6e[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x2e680b,null))[_0xdb83('0x19')](function(_0x3c7677){if(_0x3c7677){_0x5c956f['model']=_[_0xdb83('0x3c')](db[_0xdb83('0xd0')][_0xdb83('0x4f')]);_0x5c956f[_0xdb83('0x3b')]=_['keys'](_0x51ed6e[_0xdb83('0x3b')]);_0x5c956f['filters']=_['intersection'](_0x5c956f[_0xdb83('0x3a')],_0x5c956f['query']);_0x4805bd['attributes']=_[_0xdb83('0x3e')](_0x5c956f[_0xdb83('0x3a')],qs['fields'](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x4805bd['attributes']=_0x4805bd['attributes'][_0xdb83('0x40')]?_0x4805bd[_0xdb83('0x3f')]:_0x5c956f[_0xdb83('0x3a')];if(!_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x41')]('nolimit')){_0x4805bd[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x4805bd[_0xdb83('0x28')]=qs['offset'](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x28')]);}_0x4805bd[_0xdb83('0x5f')]=qs[_0xdb83('0x44')](_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x44')]);_0x4805bd[_0xdb83('0x45')]=qs[_0xdb83('0x3d')](_[_0xdb83('0x46')](_0x51ed6e[_0xdb83('0x3b')],_0x5c956f['filters']));_0x4805bd[_0xdb83('0x45')][_0xdb83('0x60')]=_0x3c7677['id'];if(_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x47')]){_0x4805bd[_0xdb83('0x45')]=_[_0xdb83('0x48')](_0x4805bd['where'],{'$or':_[_0xdb83('0x35')](_0x4805bd['attributes'],function(_0x41c405){var _0x135dcb={};_0x135dcb[_0x41c405]={'$like':'%'+_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x47')]+'%'};return _0x135dcb;})});}_0x4805bd=_['merge']({},_0x4805bd,_0x51ed6e[_0xdb83('0x51')]);return db[_0xdb83('0xd0')][_0xdb83('0x27')]({'where':_0x4805bd['where']})[_0xdb83('0x19')](function(_0x14b5d4){_0x3ed3d3[_0xdb83('0x27')]=_0x14b5d4;if(_0x51ed6e[_0xdb83('0x3b')][_0xdb83('0x4a')]){_0x4805bd[_0xdb83('0x4b')]=[{'all':!![]}];}else{_0x4805bd[_0xdb83('0x4b')]=[{'model':db[_0xdb83('0x89')],'as':_0xdb83('0xe0'),'required':![]}];}return db[_0xdb83('0xd0')][_0xdb83('0x4c')](_0x4805bd);})[_0xdb83('0x19')](function(_0x52023c){_0x3ed3d3[_0xdb83('0x61')]=_0x52023c;return _0x3ed3d3;});}})[_0xdb83('0x19')](respondWithFilteredResult(_0x2e680b,_0x4805bd))['catch'](handleError(_0x2e680b,null));};exports[_0xdb83('0x112')]=function(_0x172edf,_0x48b24c,_0x40f99f){return db[_0xdb83('0x36')][_0xdb83('0x52')]({'where':{'id':_0x172edf['params']['id']}})['then'](handleEntityNotFound(_0x48b24c,null))[_0xdb83('0x19')](function(_0x497037){if(_0x497037){return _0x497037['addAgents'](_0x172edf['body'][_0xdb83('0x63')],_[_0xdb83('0xdf')](_0x172edf[_0xdb83('0x54')],[_0xdb83('0x63'),'id'])||{})['spread'](function(_0x40d395){for(var _0x2caf1d=0x0;_0x2caf1d<_0x172edf[_0xdb83('0x54')][_0xdb83('0x63')][_0xdb83('0x40')];_0x2caf1d+=0x1){socket[_0xdb83('0x113')](_0xdb83('0x114'),{'UserId':_0x172edf[_0xdb83('0x54')][_0xdb83('0x63')][_0x2caf1d],'ChatWebsiteId':_0x172edf['params']['id']});}return _0x40d395;});}})[_0xdb83('0x19')](respondWithResult(_0x48b24c,null))[_0xdb83('0x22')](handleError(_0x48b24c,null));};exports[_0xdb83('0x115')]=function(_0x454fb9,_0x373723,_0x2a57a0){return db[_0xdb83('0x36')]['find']({'where':{'id':_0x454fb9[_0xdb83('0x4e')]['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x373723,null))[_0xdb83('0x19')](function(_0x598a2c){if(_0x598a2c){return _0x598a2c[_0xdb83('0x115')](_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')])[_0xdb83('0x19')](function(){if(_[_0xdb83('0x116')](_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')])){for(var _0xeb4ee3=0x0;_0xeb4ee3<_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')][_0xdb83('0x40')];_0xeb4ee3+=0x1){socket[_0xdb83('0x113')]('userChatWebsite:remove',{'UserId':Number(_0x454fb9['query'][_0xdb83('0x63')][_0xeb4ee3]),'ChatWebsiteId':Number(_0x454fb9[_0xdb83('0x4e')]['id'])});}}else{socket[_0xdb83('0x113')](_0xdb83('0x117'),{'UserId':Number(_0x454fb9[_0xdb83('0x3b')][_0xdb83('0x63')]),'ChatWebsiteId':Number(_0x454fb9[_0xdb83('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x373723,null))[_0xdb83('0x22')](handleError(_0x373723,null));};exports[_0xdb83('0x118')]=function(_0x34de9e,_0x23628f,_0x78833b){var _0x2b72f1={};var _0x9fa083={};var _0x115c80;var _0x237c71;return db[_0xdb83('0x36')]['findOne']({'where':{'id':_0x34de9e['params']['id']}})[_0xdb83('0x19')](handleEntityNotFound(_0x23628f,null))[_0xdb83('0x19')](function(_0x599904){if(_0x599904){_0x115c80=_0x599904;_0x9fa083[_0xdb83('0x3a')]=_[_0xdb83('0x3c')](db[_0xdb83('0x119')]['rawAttributes']);_0x9fa083['query']=_[_0xdb83('0x3c')](_0x34de9e[_0xdb83('0x3b')]);_0x9fa083[_0xdb83('0x3d')]=_[_0xdb83('0x3e')](_0x9fa083[_0xdb83('0x3a')],_0x9fa083[_0xdb83('0x3b')]);_0x2b72f1[_0xdb83('0x3f')]=_[_0xdb83('0x3e')](_0x9fa083['model'],qs[_0xdb83('0x50')](_0x34de9e[_0xdb83('0x3b')][_0xdb83('0x50')]));_0x2b72f1['attributes']=_0x2b72f1[_0xdb83('0x3f')][_0xdb83('0x40')]?_0x2b72f1[_0xdb83('0x3f')]:_0x9fa083['model'];_0x2b72f1['order']=qs['sort'](_0x34de9e['query'][_0xdb83('0x44')]);_0x2b72f1[_0xdb83('0x45')]=qs['filters'](_[_0xdb83('0x46')](_0x34de9e[_0xdb83('0x3b')],_0x9fa083['filters']));if(_0x34de9e[_0xdb83('0x3b')]['filter']){_0x2b72f1['where']=_['merge'](_0x2b72f1[_0xdb83('0x45')],{'$or':_['map'](_0x2b72f1[_0xdb83('0x3f')],function(_0x228ed8){var _0xf0b8ad={};_0xf0b8ad[_0x228ed8]={'$like':'%'+_0x34de9e['query']['filter']+'%'};return _0xf0b8ad;})});}_0x2b72f1=_[_0xdb83('0x48')]({},_0x2b72f1,_0x34de9e['options']);return _0x115c80['getAgents'](_0x2b72f1);}})[_0xdb83('0x19')](function(_0x50ca26){if(_0x50ca26){_0x237c71=_0x50ca26['length'];if(!_0x34de9e[_0xdb83('0x3b')]['hasOwnProperty'](_0xdb83('0x42'))){_0x2b72f1[_0xdb83('0x43')]=qs[_0xdb83('0x43')](_0x34de9e[_0xdb83('0x3b')][_0xdb83('0x43')]);_0x2b72f1[_0xdb83('0x28')]=qs[_0xdb83('0x28')](_0x34de9e[_0xdb83('0x3b')][_0xdb83('0x28')]);}return _0x115c80[_0xdb83('0x118')](_0x2b72f1);}})['then'](function(_0x1ad629){if(_0x1ad629){return _0x1ad629?{'count':_0x237c71,'rows':_0x1ad629}:null;}})[_0xdb83('0x19')](respondWithResult(_0x23628f,null))['catch'](handleError(_0x23628f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 1723705..8c9e20c 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 _0xc39c=['hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit'];(function(_0x1711b0,_0x429531){var _0x2668ae=function(_0x307ced){while(--_0x307ced){_0x1711b0['push'](_0x1711b0['shift']());}};_0x2668ae(++_0x429531);}(_0xc39c,0xd2));var _0xcc39=function(_0x2341bd,_0xca9782){_0x2341bd=_0x2341bd-0x0;var _0x8a1b3=_0xc39c[_0x2341bd];return _0x8a1b3;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xcc39('0x0'))['db'][_0xcc39('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcc39('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc39('0x3'),'afterDestroy':_0xcc39('0x4')};function emitEvent(_0x2da5dd){return function(_0x5bc333,_0x29c6c2,_0x535eae){ChatWebsiteEvents[_0xcc39('0x5')](_0x2da5dd+':'+_0x5bc333['id'],_0x5bc333);ChatWebsiteEvents[_0xcc39('0x5')](_0x2da5dd,_0x5bc333);_0x535eae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xcc39('0x6')](e,emitEvent(event));}}module[_0xcc39('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3308=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x20ac35,_0x278bff){var _0x147230=function(_0xe5cc5c){while(--_0xe5cc5c){_0x20ac35['push'](_0x20ac35['shift']());}};_0x147230(++_0x278bff);}(_0x3308,0x12e));var _0x8330=function(_0x2ac6f6,_0x41fe18){_0x2ac6f6=_0x2ac6f6-0x0;var _0x52796b=_0x3308[_0x2ac6f6];return _0x52796b;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8330('0x0')](0x0);var events={'afterCreate':_0x8330('0x1'),'afterUpdate':_0x8330('0x2'),'afterDestroy':_0x8330('0x3')};function emitEvent(_0x508fce){return function(_0x5f52e6,_0x28d8af,_0x1e706f){ChatWebsiteEvents[_0x8330('0x4')](_0x508fce+':'+_0x5f52e6['id'],_0x5f52e6);ChatWebsiteEvents[_0x8330('0x4')](_0x508fce,_0x5f52e6);_0x1e706f(null);};}for(var e in events){if(events[_0x8330('0x5')](e)){var event=events[e];ChatWebsite[_0x8330('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1eaf774..5cd49fa 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 _0x6215=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatWebsite','chat_websites'];(function(_0x77308f,_0x2179da){var _0x1dc727=function(_0x52b685){while(--_0x52b685){_0x77308f['push'](_0x77308f['shift']());}};_0x1dc727(++_0x2179da);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var logger=require(_0x5621('0x2'))('api');var moment=require(_0x5621('0x3'));var BPromise=require(_0x5621('0x4'));var rp=require(_0x5621('0x5'));var fs=require('fs');var path=require(_0x5621('0x6'));var rimraf=require(_0x5621('0x7'));var config=require(_0x5621('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x52f3c6,_0x5ae3af){return _0x52f3c6[_0x5621('0x9')](_0x5621('0xa'),attributes,{'tableName':_0x5621('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bc=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x416fb1,_0x5d71e5){var _0x2f2aa9=function(_0x1ce333){while(--_0x1ce333){_0x416fb1['push'](_0x416fb1['shift']());}};_0x2f2aa9(++_0x5d71e5);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'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 b71222d..c2c65a7 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 _0x1a85=['catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1a5288,_0x4b41a6){var _0x336e26=function(_0x441118){while(--_0x441118){_0x1a5288['push'](_0x1a5288['shift']());}};_0x336e26(++_0x4b41a6);}(_0x1a85,0x178));var _0x51a8=function(_0x6b23f3,_0x4189c9){_0x6b23f3=_0x6b23f3-0x0;var _0x473e8f=_0x1a85[_0x6b23f3];return _0x473e8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});} \ No newline at end of file +var _0x8e3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x42dc89,_0x45bace){var _0x5bdfbb=function(_0x51fb75){while(--_0x51fb75){_0x42dc89['push'](_0x42dc89['shift']());}};_0x5bdfbb(++_0x45bace);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index eb907d5..fab94cb 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x1ed46f,_0x7691d7){var _0x43b931=function(_0x5f2454){while(--_0x5f2454){_0x1ed46f['push'](_0x1ed46f['shift']());}};_0x43b931(++_0x7691d7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0xb10b[_0x3b4455];return _0x34dd09;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14fd93,_0x1904f2){_0x14fd93=_0x14fd93-0x0;var _0x2a2afd=_0x5f2f[_0x14fd93];return _0x2a2afd;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index daa7089..b6c44c1 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 _0x5cb1=['/:id/users','create','post','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','/:id/logo','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','put','update','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages'];(function(_0x452b59,_0x162fd3){var _0x15273c=function(_0x10c71f){while(--_0x10c71f){_0x452b59['push'](_0x452b59['shift']());}};_0x15273c(++_0x162fd3);}(_0x5cb1,0x117));var _0x15cb=function(_0x340907,_0x4a9781){_0x340907=_0x340907-0x0;var _0x1cd555=_0x5cb1[_0x340907];return _0x1cd555;};'use strict';var multer=require('multer');var util=require(_0x15cb('0x0'));var path=require(_0x15cb('0x1'));var timeout=require(_0x15cb('0x2'));var express=require(_0x15cb('0x3'));var router=express[_0x15cb('0x4')]();var auth=require(_0x15cb('0x5'));var interaction=require(_0x15cb('0x6'));var config=require(_0x15cb('0x7'));var controller=require(_0x15cb('0x8'));router[_0x15cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x15cb('0xa')]);router[_0x15cb('0x9')](_0x15cb('0xb'),auth[_0x15cb('0xc')](),controller['describe']);router[_0x15cb('0x9')](_0x15cb('0xd'),auth[_0x15cb('0xc')](),controller[_0x15cb('0xe')]);router[_0x15cb('0x9')](_0x15cb('0xf'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x10')]);router[_0x15cb('0x9')](_0x15cb('0x11'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x12')]);router['get']('/:id/logo',controller[_0x15cb('0x13')]);router[_0x15cb('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x15cb('0x9')](_0x15cb('0x14'),controller['getCustomerAvatar']);router[_0x15cb('0x9')](_0x15cb('0x15'),controller[_0x15cb('0x16')]);router[_0x15cb('0x9')](_0x15cb('0x17'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x18')]);router['get']('/:id/snippet',controller['getSnippet']);router[_0x15cb('0x9')](_0x15cb('0x19'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x1a')]);router[_0x15cb('0x9')](_0x15cb('0x1b'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x1c')]);router[_0x15cb('0x9')]('/:id/fields',controller[_0x15cb('0x1d')]);router[_0x15cb('0x9')](_0x15cb('0x1e'),auth[_0x15cb('0xc')](),controller['getOfflineMessages']);router[_0x15cb('0x9')](_0x15cb('0x1f'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x15cb('0xc')](),controller[_0x15cb('0x20')]);router[_0x15cb('0x21')](_0x15cb('0xf'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x22')]);router[_0x15cb('0x21')](_0x15cb('0x11'),auth[_0x15cb('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0x4e7b8a,_0x409639,_0x47e693){_0x47e693(null,path[_0x15cb('0x24')](config[_0x15cb('0x25')],'server/files/images/logos/'));},'filename':function(_0x3eee42,_0x3c4fee,_0x33b09e){_0x33b09e(null,util[_0x15cb('0x26')](_0x15cb('0x27'),Date[_0x15cb('0x28')](),_0x3c4fee[_0x15cb('0x29')]));}})});router[_0x15cb('0x21')](_0x15cb('0x2a'),upload['single'](_0x15cb('0x2b')),controller[_0x15cb('0x2c')]);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0xa8f5f7,_0x2e5e7e,_0x593bfc){_0x593bfc(null,path[_0x15cb('0x24')](config[_0x15cb('0x25')],_0x15cb('0x2d')));},'filename':function(_0x4dc8ee,_0x265b83,_0x414916){_0x414916(null,util[_0x15cb('0x26')](_0x15cb('0x27'),Date[_0x15cb('0x28')](),_0x265b83[_0x15cb('0x29')]));}})});router['post'](_0x15cb('0x2e'),upload['single'](_0x15cb('0x2b')),controller[_0x15cb('0x2f')]);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0x284ade,_0x3af3ee,_0x30c43e){_0x30c43e(null,path['join'](config['root'],_0x15cb('0x2d')));},'filename':function(_0x58f72b,_0x2f0748,_0x2f414e){_0x2f414e(null,util[_0x15cb('0x26')](_0x15cb('0x27'),Date['now'](),_0x2f0748[_0x15cb('0x29')]));}})});router[_0x15cb('0x21')]('/:id/customer_avatar',upload[_0x15cb('0x30')](_0x15cb('0x2b')),controller[_0x15cb('0x31')]);var upload=multer({'storage':multer[_0x15cb('0x23')]({'destination':function(_0x2c8a25,_0x1c306e,_0x406390){_0x406390(null,path[_0x15cb('0x24')](config['root'],_0x15cb('0x2d')));},'filename':function(_0x7f47b9,_0x406cac,_0x284c38){_0x284c38(null,util[_0x15cb('0x26')]('%s-%s',Date[_0x15cb('0x28')](),_0x406cac[_0x15cb('0x29')]));}})});router[_0x15cb('0x21')](_0x15cb('0x15'),upload[_0x15cb('0x30')](_0x15cb('0x2b')),controller[_0x15cb('0x32')]);router['post'](_0x15cb('0x33'),controller[_0x15cb('0x34')]);router[_0x15cb('0x21')](_0x15cb('0x35'),controller['offline']);router[_0x15cb('0x21')]('/:id/interactions',auth[_0x15cb('0xc')](),controller[_0x15cb('0x36')]);router['post'](_0x15cb('0x19'),auth[_0x15cb('0xc')](),controller[_0x15cb('0x37')]);router[_0x15cb('0x21')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x15cb('0x38')]);router[_0x15cb('0x21')](_0x15cb('0x1f'),auth['isAuthenticated'](),controller['addAgents']);router[_0x15cb('0x39')](_0x15cb('0xd'),auth['isAuthenticated'](),controller[_0x15cb('0x3a')]);router['delete'](_0x15cb('0xd'),auth[_0x15cb('0xc')](),controller['destroy']);router[_0x15cb('0x3b')](_0x15cb('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x15cb('0x3b')](_0x15cb('0x11'),auth[_0x15cb('0xc')](),controller['removeAnswers']);router[_0x15cb('0x3b')](_0x15cb('0x1f'),auth['isAuthenticated'](),controller[_0x15cb('0x3c')]);module[_0x15cb('0x3d')]=router; \ No newline at end of file +var _0xa7fc=['getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','server/files/images/avatars/','originalname','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users'];(function(_0x96359,_0x220250){var _0x13ce0f=function(_0x41d54a){while(--_0x41d54a){_0x96359['push'](_0x96359['shift']());}};_0x13ce0f(++_0x220250);}(_0xa7fc,0xe7));var _0xca7f=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0xa7fc[_0x156a0d];return _0x98a9ba;};'use strict';var multer=require(_0xca7f('0x0'));var util=require('util');var path=require(_0xca7f('0x1'));var timeout=require(_0xca7f('0x2'));var express=require(_0xca7f('0x3'));var router=express['Router']();var auth=require(_0xca7f('0x4'));var interaction=require(_0xca7f('0x5'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0xca7f('0x6')]('/',auth[_0xca7f('0x7')](),controller['index']);router[_0xca7f('0x6')]('/describe',auth[_0xca7f('0x7')](),controller[_0xca7f('0x8')]);router[_0xca7f('0x6')](_0xca7f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xca7f('0x6')](_0xca7f('0xa'),auth['isAuthenticated'](),controller[_0xca7f('0xb')]);router['get'](_0xca7f('0xc'),auth[_0xca7f('0x7')](),controller[_0xca7f('0xd')]);router[_0xca7f('0x6')](_0xca7f('0xe'),controller[_0xca7f('0xf')]);router[_0xca7f('0x6')](_0xca7f('0x10'),controller[_0xca7f('0x11')]);router['get'](_0xca7f('0x12'),controller[_0xca7f('0x13')]);router['get'](_0xca7f('0x14'),controller[_0xca7f('0x15')]);router[_0xca7f('0x6')](_0xca7f('0x16'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x17')]);router[_0xca7f('0x6')]('/:id/snippet',controller[_0xca7f('0x18')]);router[_0xca7f('0x6')](_0xca7f('0x19'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x1a')]);router[_0xca7f('0x6')]('/:id/proactive_actions',auth[_0xca7f('0x7')](),controller[_0xca7f('0x1b')]);router[_0xca7f('0x6')](_0xca7f('0x1c'),controller[_0xca7f('0x1d')]);router[_0xca7f('0x6')](_0xca7f('0x1e'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x1f')]);router['get'](_0xca7f('0x20'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x21')]);router[_0xca7f('0x22')]('/',auth[_0xca7f('0x7')](),controller[_0xca7f('0x23')]);router[_0xca7f('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xca7f('0x24')]);router[_0xca7f('0x22')](_0xca7f('0xc'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x25')]);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x568dbb,_0x40c2c9,_0x575c97){_0x575c97(null,path[_0xca7f('0x27')](config[_0xca7f('0x28')],_0xca7f('0x29')));},'filename':function(_0x2b6586,_0x4bf51b,_0x3ad3cb){_0x3ad3cb(null,util[_0xca7f('0x2a')](_0xca7f('0x2b'),Date[_0xca7f('0x2c')](),_0x4bf51b['originalname']));}})});router['post']('/:id/logo',upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller[_0xca7f('0x2f')]);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x4723a5,_0x1aa8b6,_0x43a3c9){_0x43a3c9(null,path[_0xca7f('0x27')](config['root'],_0xca7f('0x30')));},'filename':function(_0x193612,_0x4754d9,_0x5d8858){_0x5d8858(null,util['format'](_0xca7f('0x2b'),Date['now'](),_0x4754d9[_0xca7f('0x31')]));}})});router[_0xca7f('0x22')](_0xca7f('0x10'),upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x4ba7a8,_0x1e9986,_0xa077fc){_0xa077fc(null,path[_0xca7f('0x27')](config['root'],_0xca7f('0x30')));},'filename':function(_0x4c5328,_0x4f4e6b,_0x33945c){_0x33945c(null,util[_0xca7f('0x2a')](_0xca7f('0x2b'),Date[_0xca7f('0x2c')](),_0x4f4e6b[_0xca7f('0x31')]));}})});router[_0xca7f('0x22')](_0xca7f('0x12'),upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller[_0xca7f('0x32')]);var upload=multer({'storage':multer[_0xca7f('0x26')]({'destination':function(_0x1bc09d,_0xa8ba42,_0x300495){_0x300495(null,path['join'](config[_0xca7f('0x28')],_0xca7f('0x30')));},'filename':function(_0x45e8e4,_0x9ee75,_0x3fe58a){_0x3fe58a(null,util[_0xca7f('0x2a')](_0xca7f('0x2b'),Date['now'](),_0x9ee75['originalname']));}})});router[_0xca7f('0x22')](_0xca7f('0x14'),upload[_0xca7f('0x2d')](_0xca7f('0x2e')),controller['addSystemAvatar']);router['post'](_0xca7f('0x33'),controller[_0xca7f('0x34')]);router[_0xca7f('0x22')](_0xca7f('0x35'),controller[_0xca7f('0x36')]);router[_0xca7f('0x22')](_0xca7f('0x16'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x37')]);router[_0xca7f('0x22')]('/:id/applications',auth[_0xca7f('0x7')](),controller[_0xca7f('0x38')]);router[_0xca7f('0x22')]('/:id/proactive_actions',auth[_0xca7f('0x7')](),controller[_0xca7f('0x39')]);router[_0xca7f('0x22')](_0xca7f('0x20'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x3a')]);router[_0xca7f('0x3b')](_0xca7f('0x9'),auth['isAuthenticated'](),controller[_0xca7f('0x3c')]);router[_0xca7f('0x3d')](_0xca7f('0x9'),auth[_0xca7f('0x7')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xca7f('0x7')](),controller[_0xca7f('0x3e')]);router[_0xca7f('0x3d')](_0xca7f('0xc'),auth['isAuthenticated'](),controller[_0xca7f('0x3f')]);router[_0xca7f('0x3d')](_0xca7f('0x20'),auth[_0xca7f('0x7')](),controller[_0xca7f('0x40')]);module[_0xca7f('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3fcaaa0..45e9a86 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 _0x8cad=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x245fd0,_0xcc4572){var _0x166e3b=function(_0x4a6733){while(--_0x4a6733){_0x245fd0['push'](_0x245fd0['shift']());}};_0x166e3b(++_0xcc4572);}(_0x8cad,0xfe));var _0xd8ca=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x8cad[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0x4'),_0xd8ca('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xd8ca('0x2')]},'data2':{'type':Sequelize[_0xd8ca('0x2')]}}; \ No newline at end of file +var _0x714c=['AmazonAWS','Google','exports','STRING','ENUM'];(function(_0x700278,_0x5c4895){var _0x14da28=function(_0x2f9f08){while(--_0x2f9f08){_0x700278['push'](_0x700278['shift']());}};_0x14da28(++_0x5c4895);}(_0x714c,0x18d));var _0xc714=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x714c[_0x5d6e35];return _0x5d7ada;};'use strict';var Sequelize=require('sequelize');module[_0xc714('0x0')]={'name':{'type':Sequelize[_0xc714('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc714('0x2')](_0xc714('0x3'),_0xc714('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc714('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b2f8455..3c82827 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 _0x936a=['error','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x936a,0x103));var _0xa936=function(_0x87395d,_0x2a89c3){_0x87395d=_0x87395d-0x0;var _0x396385=_0x936a[_0x87395d];return _0x396385;};'use strict';var pdf=require(_0xa936('0x0'));var emlformat=require(_0xa936('0x1'));var rimraf=require(_0xa936('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa936('0x3'));var moment=require(_0xa936('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa936('0x5'));var path=require('path');var sox=require(_0xa936('0x6'));var csv=require(_0xa936('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa936('0x8'));var crypto=require(_0xa936('0x9'));var jsforce=require(_0xa936('0xa'));var deskjs=require(_0xa936('0xb'));var toCsv=require(_0xa936('0x7'));var querystring=require(_0xa936('0xc'));var Papa=require(_0xa936('0xd'));var Redis=require(_0xa936('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa936('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa936('0x10'));var logger=require('../../config/logger')(_0xa936('0x11'));var utils=require(_0xa936('0x12'));var config=require(_0xa936('0x13'));var licenseUtil=require(_0xa936('0x14'));var db=require(_0xa936('0x15'))['db'];function respondWithStatusCode(_0x408a6b,_0x32f8fc){_0x32f8fc=_0x32f8fc||0xcc;return function(_0x31d62f){if(_0x31d62f){return _0x408a6b[_0xa936('0x16')](_0x32f8fc);}return _0x408a6b[_0xa936('0x17')](_0x32f8fc)[_0xa936('0x18')]();};}function respondWithResult(_0x1adfb3,_0x4e4c2e){_0x4e4c2e=_0x4e4c2e||0xc8;return function(_0x3d3586){if(_0x3d3586){return _0x1adfb3[_0xa936('0x17')](_0x4e4c2e)[_0xa936('0x19')](_0x3d3586);}};}function respondWithFilteredResult(_0x12ea91,_0x3dab2c){return function(_0x17ab3d){if(_0x17ab3d){var _0x47bfdd=_0x17ab3d[_0xa936('0x1a')],_0x930991=_0x3dab2c[_0xa936('0x1b')],_0x1c4655=_0x3dab2c[_0xa936('0x1b')]+_0x3dab2c[_0xa936('0x1c')],_0x45640c;if(_0x1c4655>=_0x47bfdd){_0x1c4655=_0x47bfdd;_0x45640c=0xc8;}else{_0x45640c=0xce;}_0x12ea91[_0xa936('0x17')](_0x45640c);return _0x12ea91[_0xa936('0x1d')](_0xa936('0x1e'),_0x930991+'-'+_0x1c4655+'/'+_0x47bfdd)['json'](_0x17ab3d);}return null;};}function patchUpdates(_0x541f84){return function(_0x292eca){try{jsonpatch[_0xa936('0x1f')](_0x292eca,_0x541f84,!![]);}catch(_0x1c627c){return BPromise[_0xa936('0x20')](_0x1c627c);}return _0x292eca[_0xa936('0x21')]();};}function saveUpdates(_0x2a354a,_0x4903b1){return function(_0x430347){if(_0x430347){return _0x430347[_0xa936('0x22')](_0x2a354a)[_0xa936('0x23')](function(_0x50e8a5){return _0x50e8a5;});}return null;};}function removeEntity(_0x23fece,_0x1b0985){return function(_0x337046){if(_0x337046){return _0x337046[_0xa936('0x24')]()[_0xa936('0x23')](function(){_0x23fece[_0xa936('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ae4a9,_0xdd6a13){return function(_0x58a780){if(!_0x58a780){_0x7ae4a9[_0xa936('0x16')](0x194);}return _0x58a780;};}function handleError(_0x41bdee,_0x3709a6){_0x3709a6=_0x3709a6||0x1f4;return function(_0x481f57){logger[_0xa936('0x25')](_0x481f57[_0xa936('0x26')]);if(_0x481f57[_0xa936('0x27')]){delete _0x481f57[_0xa936('0x27')];}_0x41bdee[_0xa936('0x17')](_0x3709a6)[_0xa936('0x28')](_0x481f57);};}exports[_0xa936('0x29')]=function(_0x2c6363,_0x2d1936){var _0x3ff2ee={},_0x374f1e={},_0x255a89={'count':0x0,'rows':[]};var _0x35af68=_[_0xa936('0x2a')](db[_0xa936('0x2b')][_0xa936('0x2c')],function(_0x581c09){return{'name':_0x581c09[_0xa936('0x2d')],'type':_0x581c09[_0xa936('0x2e')]['key']};});_0x374f1e[_0xa936('0x2f')]=_['map'](_0x35af68,'name');_0x374f1e[_0xa936('0x30')]=_[_0xa936('0x31')](_0x2c6363[_0xa936('0x30')]);_0x374f1e[_0xa936('0x32')]=_[_0xa936('0x33')](_0x374f1e['model'],_0x374f1e[_0xa936('0x30')]);_0x3ff2ee[_0xa936('0x34')]=_[_0xa936('0x33')](_0x374f1e[_0xa936('0x2f')],qs[_0xa936('0x35')](_0x2c6363[_0xa936('0x30')][_0xa936('0x35')]));_0x3ff2ee[_0xa936('0x34')]=_0x3ff2ee[_0xa936('0x34')]['length']?_0x3ff2ee['attributes']:_0x374f1e[_0xa936('0x2f')];if(!_0x2c6363[_0xa936('0x30')]['hasOwnProperty'](_0xa936('0x36'))){_0x3ff2ee[_0xa936('0x1c')]=qs[_0xa936('0x1c')](_0x2c6363['query']['limit']);_0x3ff2ee['offset']=qs[_0xa936('0x1b')](_0x2c6363[_0xa936('0x30')][_0xa936('0x1b')]);}_0x3ff2ee[_0xa936('0x37')]=qs[_0xa936('0x38')](_0x2c6363['query'][_0xa936('0x38')]);_0x3ff2ee[_0xa936('0x39')]=qs[_0xa936('0x32')](_[_0xa936('0x3a')](_0x2c6363[_0xa936('0x30')],_0x374f1e['filters']),_0x35af68);if(_0x2c6363[_0xa936('0x30')][_0xa936('0x3b')]){_0x3ff2ee['where']=_[_0xa936('0x3c')](_0x3ff2ee[_0xa936('0x39')],{'$or':_[_0xa936('0x2a')](_0x35af68,function(_0xdfa154){if(_0xdfa154[_0xa936('0x2e')]!==_0xa936('0x3d')){var _0x4a0cd2={};_0x4a0cd2[_0xdfa154['name']]={'$like':'%'+_0x2c6363[_0xa936('0x30')][_0xa936('0x3b')]+'%'};return _0x4a0cd2;}})});}_0x3ff2ee=_['merge']({},_0x3ff2ee,_0x2c6363[_0xa936('0x3e')]);var _0x41c677={'where':_0x3ff2ee[_0xa936('0x39')]};return db[_0xa936('0x2b')][_0xa936('0x1a')](_0x41c677)[_0xa936('0x23')](function(_0x731ff2){_0x255a89[_0xa936('0x1a')]=_0x731ff2;if(_0x2c6363[_0xa936('0x30')][_0xa936('0x3f')]){_0x3ff2ee[_0xa936('0x40')]=[{'all':!![]}];}return db[_0xa936('0x2b')][_0xa936('0x41')](_0x3ff2ee);})['then'](function(_0xe005a1){_0x255a89[_0xa936('0x42')]=_0xe005a1;return _0x255a89;})[_0xa936('0x23')](respondWithFilteredResult(_0x2d1936,_0x3ff2ee))[_0xa936('0x43')](handleError(_0x2d1936,null));};exports[_0xa936('0x44')]=function(_0x4ea49c,_0xce06da){var _0x5f192f={'raw':!![],'where':{'id':_0x4ea49c[_0xa936('0x45')]['id']}},_0x321418={};_0x321418[_0xa936('0x2f')]=_[_0xa936('0x31')](db[_0xa936('0x2b')]['rawAttributes']);_0x321418['query']=_[_0xa936('0x31')](_0x4ea49c[_0xa936('0x30')]);_0x321418['filters']=_[_0xa936('0x33')](_0x321418['model'],_0x321418[_0xa936('0x30')]);_0x5f192f['attributes']=_[_0xa936('0x33')](_0x321418[_0xa936('0x2f')],qs['fields'](_0x4ea49c['query'][_0xa936('0x35')]));_0x5f192f['attributes']=_0x5f192f[_0xa936('0x34')][_0xa936('0x46')]?_0x5f192f['attributes']:_0x321418[_0xa936('0x2f')];if(_0x4ea49c['query'][_0xa936('0x3f')]){_0x5f192f[_0xa936('0x40')]=[{'all':!![]}];}_0x5f192f=_['merge']({},_0x5f192f,_0x4ea49c[_0xa936('0x3e')]);return db[_0xa936('0x2b')][_0xa936('0x47')](_0x5f192f)['then'](handleEntityNotFound(_0xce06da,null))['then'](respondWithResult(_0xce06da,null))['catch'](handleError(_0xce06da,null));};exports[_0xa936('0x48')]=function(_0x13c0d3,_0x119c8c){return db[_0xa936('0x2b')][_0xa936('0x48')](_0x13c0d3[_0xa936('0x49')],{})['then'](respondWithResult(_0x119c8c,0xc9))['catch'](handleError(_0x119c8c,null));};exports[_0xa936('0x22')]=function(_0x11cb82,_0x440fed){if(_0x11cb82[_0xa936('0x49')]['id']){delete _0x11cb82[_0xa936('0x49')]['id'];}return db[_0xa936('0x2b')]['find']({'where':{'id':_0x11cb82['params']['id']}})[_0xa936('0x23')](handleEntityNotFound(_0x440fed,null))['then'](saveUpdates(_0x11cb82[_0xa936('0x49')],null))['then'](respondWithResult(_0x440fed,null))[_0xa936('0x43')](handleError(_0x440fed,null));};exports[_0xa936('0x24')]=function(_0x498d1d,_0x4730f3){return db[_0xa936('0x2b')][_0xa936('0x47')]({'where':{'id':_0x498d1d[_0xa936('0x45')]['id']}})[_0xa936('0x23')](handleEntityNotFound(_0x4730f3,null))[_0xa936('0x23')](removeEntity(_0x4730f3,null))['catch'](handleError(_0x4730f3,null));}; \ No newline at end of file +var _0xabe7=['show','params','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','end','status','json','count','set','apply','reject','then','destroy','sendStatus','error','stack','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x443520,_0x2fe333){var _0x20afa5=function(_0x13cf74){while(--_0x13cf74){_0x443520['push'](_0x443520['shift']());}};_0x20afa5(++_0x2fe333);}(_0xabe7,0x1b0));var _0x7abe=function(_0x52c06e,_0x37b1a0){_0x52c06e=_0x52c06e-0x0;var _0x5ab3c4=_0xabe7[_0x52c06e];return _0x5ab3c4;};'use strict';var pdf=require(_0x7abe('0x0'));var emlformat=require(_0x7abe('0x1'));var rimraf=require(_0x7abe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7abe('0x3'));var rp=require(_0x7abe('0x4'));var moment=require(_0x7abe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7abe('0x6'));var util=require(_0x7abe('0x7'));var path=require('path');var sox=require(_0x7abe('0x8'));var csv=require(_0x7abe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7abe('0xa'));var squel=require(_0x7abe('0xb'));var crypto=require(_0x7abe('0xc'));var jsforce=require(_0x7abe('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7abe('0xe'));var Papa=require(_0x7abe('0xf'));var Redis=require(_0x7abe('0x10'));var authService=require(_0x7abe('0x11'));var qs=require(_0x7abe('0x12'));var as=require(_0x7abe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7abe('0x14'));var utils=require('../../config/utils');var config=require(_0x7abe('0x15'));var licenseUtil=require(_0x7abe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x344bcc,_0x1852aa){_0x1852aa=_0x1852aa||0xcc;return function(_0x52b4fe){if(_0x52b4fe){return _0x344bcc['sendStatus'](_0x1852aa);}return _0x344bcc['status'](_0x1852aa)[_0x7abe('0x17')]();};}function respondWithResult(_0x4ae3f0,_0x2b7f07){_0x2b7f07=_0x2b7f07||0xc8;return function(_0x3e5e11){if(_0x3e5e11){return _0x4ae3f0[_0x7abe('0x18')](_0x2b7f07)[_0x7abe('0x19')](_0x3e5e11);}};}function respondWithFilteredResult(_0x4738a2,_0xcd4c2c){return function(_0x4e0d20){if(_0x4e0d20){var _0x4fe2f4=_0x4e0d20[_0x7abe('0x1a')],_0x467052=_0xcd4c2c['offset'],_0x4a6cbf=_0xcd4c2c['offset']+_0xcd4c2c['limit'],_0x35929f;if(_0x4a6cbf>=_0x4fe2f4){_0x4a6cbf=_0x4fe2f4;_0x35929f=0xc8;}else{_0x35929f=0xce;}_0x4738a2['status'](_0x35929f);return _0x4738a2[_0x7abe('0x1b')]('Content-Range',_0x467052+'-'+_0x4a6cbf+'/'+_0x4fe2f4)[_0x7abe('0x19')](_0x4e0d20);}return null;};}function patchUpdates(_0x17b180){return function(_0x28041b){try{jsonpatch[_0x7abe('0x1c')](_0x28041b,_0x17b180,!![]);}catch(_0xe86293){return BPromise[_0x7abe('0x1d')](_0xe86293);}return _0x28041b['save']();};}function saveUpdates(_0x368f9d,_0x5d5a1c){return function(_0x185018){if(_0x185018){return _0x185018['update'](_0x368f9d)[_0x7abe('0x1e')](function(_0x447e0a){return _0x447e0a;});}return null;};}function removeEntity(_0x9a758f,_0x1a2b22){return function(_0x15e0c3){if(_0x15e0c3){return _0x15e0c3[_0x7abe('0x1f')]()['then'](function(){_0x9a758f[_0x7abe('0x18')](0xcc)[_0x7abe('0x17')]();});}};}function handleEntityNotFound(_0x4e4293,_0x3b1f2d){return function(_0x43f61a){if(!_0x43f61a){_0x4e4293[_0x7abe('0x20')](0x194);}return _0x43f61a;};}function handleError(_0x37ec2b,_0x244b54){_0x244b54=_0x244b54||0x1f4;return function(_0x19ce00){logger[_0x7abe('0x21')](_0x19ce00[_0x7abe('0x22')]);if(_0x19ce00['name']){delete _0x19ce00['name'];}_0x37ec2b[_0x7abe('0x18')](_0x244b54)['send'](_0x19ce00);};}exports['index']=function(_0x5c3366,_0x2339a4){var _0xa6a52d={},_0x39cd99={},_0x2fe37e={'count':0x0,'rows':[]};var _0x2a07c2=_[_0x7abe('0x23')](db[_0x7abe('0x24')][_0x7abe('0x25')],function(_0x20cfd9){return{'name':_0x20cfd9[_0x7abe('0x26')],'type':_0x20cfd9[_0x7abe('0x27')][_0x7abe('0x28')]};});_0x39cd99[_0x7abe('0x29')]=_[_0x7abe('0x23')](_0x2a07c2,_0x7abe('0x2a'));_0x39cd99[_0x7abe('0x2b')]=_[_0x7abe('0x2c')](_0x5c3366['query']);_0x39cd99[_0x7abe('0x2d')]=_[_0x7abe('0x2e')](_0x39cd99[_0x7abe('0x29')],_0x39cd99[_0x7abe('0x2b')]);_0xa6a52d[_0x7abe('0x2f')]=_[_0x7abe('0x2e')](_0x39cd99[_0x7abe('0x29')],qs[_0x7abe('0x30')](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x30')]));_0xa6a52d[_0x7abe('0x2f')]=_0xa6a52d[_0x7abe('0x2f')][_0x7abe('0x31')]?_0xa6a52d[_0x7abe('0x2f')]:_0x39cd99[_0x7abe('0x29')];if(!_0x5c3366['query'][_0x7abe('0x32')](_0x7abe('0x33'))){_0xa6a52d['limit']=qs[_0x7abe('0x34')](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x34')]);_0xa6a52d[_0x7abe('0x35')]=qs['offset'](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x35')]);}_0xa6a52d['order']=qs[_0x7abe('0x36')](_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x36')]);_0xa6a52d[_0x7abe('0x37')]=qs[_0x7abe('0x2d')](_[_0x7abe('0x38')](_0x5c3366[_0x7abe('0x2b')],_0x39cd99[_0x7abe('0x2d')]),_0x2a07c2);if(_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x39')]){_0xa6a52d[_0x7abe('0x37')]=_['merge'](_0xa6a52d[_0x7abe('0x37')],{'$or':_['map'](_0x2a07c2,function(_0x415419){if(_0x415419[_0x7abe('0x27')]!==_0x7abe('0x3a')){var _0x22d41a={};_0x22d41a[_0x415419[_0x7abe('0x2a')]]={'$like':'%'+_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x39')]+'%'};return _0x22d41a;}})});}_0xa6a52d=_['merge']({},_0xa6a52d,_0x5c3366[_0x7abe('0x3b')]);var _0x4a5f6a={'where':_0xa6a52d[_0x7abe('0x37')]};return db[_0x7abe('0x24')][_0x7abe('0x1a')](_0x4a5f6a)[_0x7abe('0x1e')](function(_0x2c87cf){_0x2fe37e['count']=_0x2c87cf;if(_0x5c3366[_0x7abe('0x2b')][_0x7abe('0x3c')]){_0xa6a52d[_0x7abe('0x3d')]=[{'all':!![]}];}return db[_0x7abe('0x24')][_0x7abe('0x3e')](_0xa6a52d);})['then'](function(_0x86a746){_0x2fe37e[_0x7abe('0x3f')]=_0x86a746;return _0x2fe37e;})[_0x7abe('0x1e')](respondWithFilteredResult(_0x2339a4,_0xa6a52d))[_0x7abe('0x40')](handleError(_0x2339a4,null));};exports[_0x7abe('0x41')]=function(_0x1eb0c0,_0x3db589){var _0x35d48a={'raw':!![],'where':{'id':_0x1eb0c0[_0x7abe('0x42')]['id']}},_0x1377c1={};_0x1377c1[_0x7abe('0x29')]=_[_0x7abe('0x2c')](db[_0x7abe('0x24')][_0x7abe('0x25')]);_0x1377c1['query']=_[_0x7abe('0x2c')](_0x1eb0c0[_0x7abe('0x2b')]);_0x1377c1[_0x7abe('0x2d')]=_['intersection'](_0x1377c1['model'],_0x1377c1[_0x7abe('0x2b')]);_0x35d48a['attributes']=_[_0x7abe('0x2e')](_0x1377c1[_0x7abe('0x29')],qs[_0x7abe('0x30')](_0x1eb0c0[_0x7abe('0x2b')][_0x7abe('0x30')]));_0x35d48a[_0x7abe('0x2f')]=_0x35d48a[_0x7abe('0x2f')]['length']?_0x35d48a['attributes']:_0x1377c1[_0x7abe('0x29')];if(_0x1eb0c0['query']['includeAll']){_0x35d48a[_0x7abe('0x3d')]=[{'all':!![]}];}_0x35d48a=_[_0x7abe('0x43')]({},_0x35d48a,_0x1eb0c0[_0x7abe('0x3b')]);return db[_0x7abe('0x24')][_0x7abe('0x44')](_0x35d48a)[_0x7abe('0x1e')](handleEntityNotFound(_0x3db589,null))[_0x7abe('0x1e')](respondWithResult(_0x3db589,null))[_0x7abe('0x40')](handleError(_0x3db589,null));};exports[_0x7abe('0x45')]=function(_0x535e7d,_0x269723){return db[_0x7abe('0x24')][_0x7abe('0x45')](_0x535e7d[_0x7abe('0x46')],{})[_0x7abe('0x1e')](respondWithResult(_0x269723,0xc9))[_0x7abe('0x40')](handleError(_0x269723,null));};exports['update']=function(_0x35c32d,_0x273c6){if(_0x35c32d['body']['id']){delete _0x35c32d[_0x7abe('0x46')]['id'];}return db[_0x7abe('0x24')][_0x7abe('0x44')]({'where':{'id':_0x35c32d[_0x7abe('0x42')]['id']}})[_0x7abe('0x1e')](handleEntityNotFound(_0x273c6,null))['then'](saveUpdates(_0x35c32d[_0x7abe('0x46')],null))[_0x7abe('0x1e')](respondWithResult(_0x273c6,null))[_0x7abe('0x40')](handleError(_0x273c6,null));};exports[_0x7abe('0x1f')]=function(_0x182b12,_0x391769){return db[_0x7abe('0x24')][_0x7abe('0x44')]({'where':{'id':_0x182b12[_0x7abe('0x42')]['id']}})['then'](handleEntityNotFound(_0x391769,null))[_0x7abe('0x1e')](removeEntity(_0x391769,null))[_0x7abe('0x40')](handleError(_0x391769,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 16757c4..f96af0c 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 _0xf647=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','moment','request-promise','path','../../config/environment'];(function(_0x5c9655,_0x431222){var _0x552d60=function(_0x48c502){while(--_0x48c502){_0x5c9655['push'](_0x5c9655['shift']());}};_0x552d60(++_0x431222);}(_0xf647,0x18a));var _0x7f64=function(_0x4db622,_0x449ae1){_0x4db622=_0x4db622-0x0;var _0x477f5b=_0xf647[_0x4db622];return _0x477f5b;};'use strict';var _=require(_0x7f64('0x0'));var util=require(_0x7f64('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f64('0x2'));var BPromise=require('bluebird');var rp=require(_0x7f64('0x3'));var fs=require('fs');var path=require(_0x7f64('0x4'));var rimraf=require('rimraf');var config=require(_0x7f64('0x5'));var attributes=require(_0x7f64('0x6'));module[_0x7f64('0x7')]=function(_0x441375,_0x1a3194){return _0x441375[_0x7f64('0x8')](_0x7f64('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd43=['CloudProvider','cloud_providers','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x42e565,_0x3a6c33){var _0x16c40b=function(_0x18974f){while(--_0x18974f){_0x42e565['push'](_0x42e565['shift']());}};_0x16c40b(++_0x3a6c33);}(_0xbd43,0xde));var _0x3bd4=function(_0x5954ae,_0x3fae55){_0x5954ae=_0x5954ae-0x0;var _0x7f562d=_0xbd43[_0x5954ae];return _0x7f562d;};'use strict';var _=require(_0x3bd4('0x0'));var util=require(_0x3bd4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3bd4('0x2'));var BPromise=require(_0x3bd4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bd4('0x4'));var rimraf=require(_0x3bd4('0x5'));var config=require(_0x3bd4('0x6'));var attributes=require(_0x3bd4('0x7'));module[_0x3bd4('0x8')]=function(_0x140845,_0x3b39ea){return _0x140845['define'](_0x3bd4('0x9'),attributes,{'tableName':_0x3bd4('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 51c6de8..f30e9a5 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 _0x4c59=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x4c59,0xa3));var _0x94c5=function(_0x3386a6,_0x474678){_0x3386a6=_0x3386a6-0x0;var _0x362b74=_0x4c59[_0x3386a6];return _0x362b74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x94c5('0x0'));var BPromise=require(_0x94c5('0x1'));var rs=require(_0x94c5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c5('0x3'))['db'];var utils=require(_0x94c5('0x4'));var logger=require(_0x94c5('0x5'))(_0x94c5('0x6'));var config=require(_0x94c5('0x7'));var jayson=require(_0x94c5('0x8'));var client=jayson[_0x94c5('0x9')][_0x94c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9ba0,_0x57140a,_0x50f96b){return new BPromise(function(_0x53a626,_0x1e5b53){return client[_0x94c5('0xb')](_0x3f9ba0,_0x50f96b)[_0x94c5('0xc')](function(_0x136345){logger[_0x94c5('0xd')](_0x94c5('0xe'),_0x57140a,_0x94c5('0xf'));logger['debug'](_0x94c5('0x10'),_0x57140a,_0x94c5('0xf'),JSON[_0x94c5('0x11')](_0x136345));if(_0x136345['error']){if(_0x136345[_0x94c5('0x12')][_0x94c5('0x13')]===0x1f4){logger['error'](_0x94c5('0xe'),_0x57140a,_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);return _0x1e5b53(_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);}logger[_0x94c5('0x12')]('CloudProvider,\x20%s,\x20%s',_0x57140a,_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);return _0x53a626(_0x136345[_0x94c5('0x12')][_0x94c5('0x14')]);}else{logger[_0x94c5('0xd')]('CloudProvider,\x20%s,\x20%s',_0x57140a,_0x94c5('0xf'));_0x53a626(_0x136345['result'][_0x94c5('0x14')]);}})['catch'](function(_0x16e616){logger[_0x94c5('0x12')](_0x94c5('0xe'),_0x57140a,_0x16e616);_0x1e5b53(_0x16e616);});});} \ No newline at end of file +var _0x109c=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x2c6256,_0x404ccf){var _0x4db857=function(_0x40bb9f){while(--_0x40bb9f){_0x2c6256['push'](_0x2c6256['shift']());}};_0x4db857(++_0x404ccf);}(_0x109c,0x9c));var _0xc109=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x109c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc109('0x0'));var util=require(_0xc109('0x1'));var moment=require(_0xc109('0x2'));var BPromise=require(_0xc109('0x3'));var rs=require(_0xc109('0x4'));var fs=require('fs');var Redis=require(_0xc109('0x5'));var db=require(_0xc109('0x6'))['db'];var utils=require(_0xc109('0x7'));var logger=require(_0xc109('0x8'))(_0xc109('0x9'));var config=require('../../config/environment');var jayson=require(_0xc109('0xa'));var client=jayson[_0xc109('0xb')][_0xc109('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f8988,_0x28ee08,_0xbed534){return new BPromise(function(_0x61769a,_0x574a5f){return client[_0xc109('0xd')](_0x1f8988,_0xbed534)[_0xc109('0xe')](function(_0x346bab){logger[_0xc109('0xf')](_0xc109('0x10'),_0x28ee08,_0xc109('0x11'));logger[_0xc109('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x28ee08,_0xc109('0x11'),JSON['stringify'](_0x346bab));if(_0x346bab['error']){if(_0x346bab[_0xc109('0x13')]['code']===0x1f4){logger[_0xc109('0x13')](_0xc109('0x10'),_0x28ee08,_0x346bab['error'][_0xc109('0x14')]);return _0x574a5f(_0x346bab[_0xc109('0x13')]['message']);}logger[_0xc109('0x13')](_0xc109('0x10'),_0x28ee08,_0x346bab['error']['message']);return _0x61769a(_0x346bab['error'][_0xc109('0x14')]);}else{logger[_0xc109('0xf')](_0xc109('0x10'),_0x28ee08,_0xc109('0x11'));_0x61769a(_0x346bab[_0xc109('0x15')]['message']);}})['catch'](function(_0x2313a3){logger[_0xc109('0x13')]('CloudProvider,\x20%s,\x20%s',_0x28ee08,_0x2313a3);_0x574a5f(_0x2313a3);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 59edc19..412b7b3 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 _0xa9c0=['./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f1749,_0x998e73){var _0x9a9ab3=function(_0x37ee0b){while(--_0x37ee0b){_0x4f1749['push'](_0x4f1749['shift']());}};_0x9a9ab3(++_0x998e73);}(_0xa9c0,0x6a));var _0x0a9c=function(_0x8a268b,_0xcdad0c){_0x8a268b=_0x8a268b-0x0;var _0x1a909e=_0xa9c0[_0x8a268b];return _0x1a909e;};'use strict';var multer=require(_0x0a9c('0x0'));var util=require(_0x0a9c('0x1'));var path=require('path');var timeout=require(_0x0a9c('0x2'));var express=require(_0x0a9c('0x3'));var router=express[_0x0a9c('0x4')]();var auth=require(_0x0a9c('0x5'));var interaction=require(_0x0a9c('0x6'));var config=require(_0x0a9c('0x7'));var controller=require(_0x0a9c('0x8'));router[_0x0a9c('0x9')]('/',auth[_0x0a9c('0xa')](),controller[_0x0a9c('0xb')]);router['get'](_0x0a9c('0xc'),auth['isAuthenticated'](),controller[_0x0a9c('0xd')]);router[_0x0a9c('0xe')]('/',auth['isAuthenticated'](),controller[_0x0a9c('0xf')]);router[_0x0a9c('0x10')](_0x0a9c('0xc'),auth[_0x0a9c('0xa')](),controller[_0x0a9c('0x11')]);router['delete'](_0x0a9c('0xc'),auth[_0x0a9c('0xa')](),controller['destroy']);module[_0x0a9c('0x12')]=router; \ No newline at end of file +var _0x9fba=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','isAuthenticated','show','put','/:id','update','destroy','multer','util'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x9fba,0x11b));var _0xa9fb=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x9fba[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0xa9fb('0x0'));var util=require(_0xa9fb('0x1'));var path=require(_0xa9fb('0x2'));var timeout=require(_0xa9fb('0x3'));var express=require(_0xa9fb('0x4'));var router=express['Router']();var auth=require(_0xa9fb('0x5'));var interaction=require(_0xa9fb('0x6'));var config=require('../../config/environment');var controller=require(_0xa9fb('0x7'));router[_0xa9fb('0x8')]('/',auth[_0xa9fb('0x9')](),controller['index']);router[_0xa9fb('0x8')]('/:id',auth[_0xa9fb('0x9')](),controller[_0xa9fb('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa9fb('0xb')](_0xa9fb('0xc'),auth[_0xa9fb('0x9')](),controller[_0xa9fb('0xd')]);router['delete'](_0xa9fb('0xc'),auth[_0xa9fb('0x9')](),controller[_0xa9fb('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 76f8b43..4dbfb62 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 _0xbba6=['name','exports','STRING'];(function(_0x1180c7,_0x11eaf0){var _0x150b77=function(_0x53fe27){while(--_0x53fe27){_0x1180c7['push'](_0x1180c7['shift']());}};_0x150b77(++_0x11eaf0);}(_0xbba6,0x133));var _0x6bba=function(_0x2caff6,_0x3aed98){_0x2caff6=_0x2caff6-0x0;var _0x544461=_0xbba6[_0x2caff6];return _0x544461;};'use strict';var Sequelize=require('sequelize');module[_0x6bba('0x0')]={'name':{'type':Sequelize[_0x6bba('0x1')],'unique':_0x6bba('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6bba('0x1')]},'companyId':{'type':Sequelize[_0x6bba('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6bba('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6bba('0x1')]},'city':{'type':Sequelize[_0x6bba('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6bba('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6bba('0x1')]},'sStreet':{'type':Sequelize[_0x6bba('0x1')]},'sPostalCode':{'type':Sequelize[_0x6bba('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x6bba('0x1')]},'description':{'type':Sequelize[_0x6bba('0x1')]}}; \ No newline at end of file +var _0x569c=['name','STRING'];(function(_0x48e4a4,_0x15df90){var _0x5e0849=function(_0x315254){while(--_0x315254){_0x48e4a4['push'](_0x48e4a4['shift']());}};_0x5e0849(++_0x15df90);}(_0x569c,0x1a8));var _0xc569=function(_0x2b4ac7,_0x33859a){_0x2b4ac7=_0x2b4ac7-0x0;var _0x2ba2c9=_0x569c[_0x2b4ac7];return _0x2ba2c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc569('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc569('0x1')]},'phone':{'type':Sequelize[_0xc569('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc569('0x1')]},'street':{'type':Sequelize[_0xc569('0x1')]},'postalCode':{'type':Sequelize[_0xc569('0x1')]},'city':{'type':Sequelize[_0xc569('0x1')]},'country':{'type':Sequelize[_0xc569('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc569('0x1')]},'sStreet':{'type':Sequelize[_0xc569('0x1')]},'sPostalCode':{'type':Sequelize[_0xc569('0x1')]},'sCity':{'type':Sequelize[_0xc569('0x1')]},'sCountry':{'type':Sequelize[_0xc569('0x1')]},'description':{'type':Sequelize[_0xc569('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8cebe3f..b057dd0 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 _0x380f=['../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','sort','pick','filter','where','map','options','includeAll','include','findAll','catch','show','rawAttributes','merge','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addContacts','CmContact','ids','omit','getContacts','order','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x43cafe,_0x971954){var _0x28926d=function(_0x1a2656){while(--_0x1a2656){_0x43cafe['push'](_0x43cafe['shift']());}};_0x28926d(++_0x971954);}(_0x380f,0x97));var _0xf380=function(_0x5324d4,_0x2d901f){_0x5324d4=_0x5324d4-0x0;var _0x3ca0d6=_0x380f[_0x5324d4];return _0x3ca0d6;};'use strict';var pdf=require(_0xf380('0x0'));var emlformat=require(_0xf380('0x1'));var rimraf=require(_0xf380('0x2'));var zipdir=require(_0xf380('0x3'));var jsonpatch=require(_0xf380('0x4'));var rp=require(_0xf380('0x5'));var moment=require(_0xf380('0x6'));var BPromise=require(_0xf380('0x7'));var Mustache=require(_0xf380('0x8'));var util=require(_0xf380('0x9'));var path=require(_0xf380('0xa'));var sox=require(_0xf380('0xb'));var csv=require('to-csv');var ejs=require(_0xf380('0xc'));var fs=require('fs');var _=require(_0xf380('0xd'));var squel=require(_0xf380('0xe'));var crypto=require('crypto');var jsforce=require(_0xf380('0xf'));var deskjs=require(_0xf380('0x10'));var toCsv=require(_0xf380('0x11'));var querystring=require(_0xf380('0x12'));var Papa=require(_0xf380('0x13'));var Redis=require('ioredis');var authService=require(_0xf380('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf380('0x15'));var hardwareService=require(_0xf380('0x16'));var logger=require(_0xf380('0x17'))(_0xf380('0x18'));var utils=require('../../config/utils');var config=require(_0xf380('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x97a270,_0x60b887){_0x60b887=_0x60b887||0xcc;return function(_0x3cf894){if(_0x3cf894){return _0x97a270[_0xf380('0x1a')](_0x60b887);}return _0x97a270[_0xf380('0x1b')](_0x60b887)[_0xf380('0x1c')]();};}function respondWithResult(_0x2e886f,_0x49f529){_0x49f529=_0x49f529||0xc8;return function(_0x59830b){if(_0x59830b){return _0x2e886f[_0xf380('0x1b')](_0x49f529)[_0xf380('0x1d')](_0x59830b);}};}function respondWithFilteredResult(_0x348024,_0x2e7223){return function(_0x58826c){if(_0x58826c){var _0x469e7a=_0x58826c[_0xf380('0x1e')],_0x22f92f=_0x2e7223['offset'],_0x57bd46=_0x2e7223[_0xf380('0x1f')]+_0x2e7223[_0xf380('0x20')],_0x28a4fb;if(_0x57bd46>=_0x469e7a){_0x57bd46=_0x469e7a;_0x28a4fb=0xc8;}else{_0x28a4fb=0xce;}_0x348024['status'](_0x28a4fb);return _0x348024['set'](_0xf380('0x21'),_0x22f92f+'-'+_0x57bd46+'/'+_0x469e7a)[_0xf380('0x1d')](_0x58826c);}return null;};}function patchUpdates(_0x2f1b98){return function(_0x5e70fd){try{jsonpatch[_0xf380('0x22')](_0x5e70fd,_0x2f1b98,!![]);}catch(_0x12806a){return BPromise[_0xf380('0x23')](_0x12806a);}return _0x5e70fd[_0xf380('0x24')]();};}function saveUpdates(_0x19c3a2,_0x262513){return function(_0x422710){if(_0x422710){return _0x422710['update'](_0x19c3a2)[_0xf380('0x25')](function(_0x50f272){return _0x50f272;});}return null;};}function removeEntity(_0x21d1ae,_0x1f40e0){return function(_0x5b48a1){if(_0x5b48a1){return _0x5b48a1[_0xf380('0x26')]()['then'](function(){var _0x1453dd=_0x5b48a1[_0xf380('0x27')]({'plain':!![]});var _0x1332ce=_0xf380('0x28');return db[_0xf380('0x29')][_0xf380('0x26')]({'where':{'type':_0x1332ce,'resourceId':_0x1453dd['id']}})[_0xf380('0x25')](function(){return _0x5b48a1;});})['then'](function(){_0x21d1ae[_0xf380('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445bbb,_0x5af21d){return function(_0x4f4d07){if(!_0x4f4d07){_0x445bbb['sendStatus'](0x194);}return _0x4f4d07;};}function handleError(_0x13a983,_0x3242ef){_0x3242ef=_0x3242ef||0x1f4;return function(_0x3beb4e){logger[_0xf380('0x2a')](_0x3beb4e[_0xf380('0x2b')]);if(_0x3beb4e[_0xf380('0x2c')]){delete _0x3beb4e['name'];}_0x13a983[_0xf380('0x1b')](_0x3242ef)[_0xf380('0x2d')](_0x3beb4e);};}exports[_0xf380('0x2e')]=function(_0xa6b3c9,_0x82179f){var _0x55279c={},_0x23e52c={},_0x308027={'count':0x0,'rows':[]};return db[_0xf380('0x2f')][_0xf380('0x30')]()['then'](function(_0x3de8ac){_0x23e52c[_0xf380('0x31')]=_[_0xf380('0x32')](_0x3de8ac);_0x23e52c[_0xf380('0x33')]=_['keys'](_0xa6b3c9[_0xf380('0x33')]);_0x23e52c[_0xf380('0x34')]=_[_0xf380('0x35')](_0x23e52c[_0xf380('0x31')],_0x23e52c[_0xf380('0x33')]);_0x55279c['attributes']=_[_0xf380('0x35')](_0x23e52c[_0xf380('0x31')],qs[_0xf380('0x36')](_0xa6b3c9[_0xf380('0x33')][_0xf380('0x36')]));_0x55279c[_0xf380('0x37')]=_0x55279c['attributes'][_0xf380('0x38')]?_0x55279c[_0xf380('0x37')]:_0x23e52c[_0xf380('0x31')];if(!_0xa6b3c9[_0xf380('0x33')]['hasOwnProperty']('nolimit')){_0x55279c[_0xf380('0x20')]=qs[_0xf380('0x20')](_0xa6b3c9[_0xf380('0x33')][_0xf380('0x20')]);_0x55279c['offset']=qs['offset'](_0xa6b3c9[_0xf380('0x33')][_0xf380('0x1f')]);}_0x55279c['order']=qs[_0xf380('0x39')](_0xa6b3c9['query'][_0xf380('0x39')]);_0x55279c['where']=qs[_0xf380('0x34')](_[_0xf380('0x3a')](_0xa6b3c9[_0xf380('0x33')],_0x23e52c[_0xf380('0x34')]),_0x3de8ac);if(_0xa6b3c9[_0xf380('0x33')][_0xf380('0x3b')]){_0x55279c['where']=_['merge'](_0x55279c[_0xf380('0x3c')],{'$or':_[_0xf380('0x3d')](_0x55279c[_0xf380('0x37')],function(_0x5f233d){var _0x1ae1ff={};_0x1ae1ff[_0x5f233d]={'$like':'%'+_0xa6b3c9['query']['filter']+'%'};return _0x1ae1ff;})});}_0x55279c=_['merge']({},_0x55279c,_0xa6b3c9[_0xf380('0x3e')]);var _0x1069ee={'where':_0x55279c[_0xf380('0x3c')]};return db[_0xf380('0x2f')][_0xf380('0x1e')](_0x1069ee)['then'](function(_0x108bfa){_0x308027[_0xf380('0x1e')]=_0x108bfa;if(_0xa6b3c9[_0xf380('0x33')][_0xf380('0x3f')]){_0x55279c[_0xf380('0x40')]=[{'all':!![]}];}return db[_0xf380('0x2f')][_0xf380('0x41')](_0x55279c);})[_0xf380('0x25')](function(_0xc0cb0b){_0x308027['rows']=_0xc0cb0b;return _0x308027;})[_0xf380('0x25')](respondWithFilteredResult(_0x82179f,_0x55279c))[_0xf380('0x42')](handleError(_0x82179f,null));})[_0xf380('0x42')](handleError(_0x82179f,null));};exports[_0xf380('0x43')]=function(_0x7746d4,_0x9a2584){var _0x4368e4={'raw':![],'where':{'id':_0x7746d4['params']['id']}},_0x5df0b6={};_0x5df0b6[_0xf380('0x31')]=_['keys'](db[_0xf380('0x2f')][_0xf380('0x44')]);_0x5df0b6[_0xf380('0x33')]=_[_0xf380('0x32')](_0x7746d4[_0xf380('0x33')]);_0x5df0b6[_0xf380('0x34')]=_[_0xf380('0x35')](_0x5df0b6[_0xf380('0x31')],_0x5df0b6[_0xf380('0x33')]);_0x4368e4[_0xf380('0x37')]=_[_0xf380('0x35')](_0x5df0b6[_0xf380('0x31')],qs[_0xf380('0x36')](_0x7746d4[_0xf380('0x33')]['fields']));_0x4368e4[_0xf380('0x37')]=_0x4368e4[_0xf380('0x37')][_0xf380('0x38')]?_0x4368e4['attributes']:_0x5df0b6[_0xf380('0x31')];if(_0x7746d4[_0xf380('0x33')][_0xf380('0x3f')]){_0x4368e4[_0xf380('0x40')]=[{'all':!![]}];}_0x4368e4=_[_0xf380('0x45')]({},_0x4368e4,_0x7746d4[_0xf380('0x3e')]);return db[_0xf380('0x2f')][_0xf380('0x46')](_0x4368e4)[_0xf380('0x25')](handleEntityNotFound(_0x9a2584,null))['then'](respondWithResult(_0x9a2584,null))['catch'](handleError(_0x9a2584,null));};exports[_0xf380('0x47')]=function(_0x3f3712,_0x6b3a44){return db[_0xf380('0x2f')][_0xf380('0x47')](_0x3f3712[_0xf380('0x48')],{})['then'](function(_0x15fe76){var _0x30952d=_0x3f3712[_0xf380('0x49')]['get']({'plain':!![]});if(!_0x30952d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30952d[_0xf380('0x4a')]===_0xf380('0x49')){var _0x3e2655=_0x15fe76[_0xf380('0x27')]({'plain':!![]});var _0x5efd27='Companies';return db[_0xf380('0x4b')][_0xf380('0x46')]({'where':{'name':_0x5efd27,'userProfileId':_0x30952d[_0xf380('0x4c')]},'raw':!![]})[_0xf380('0x25')](function(_0x8bc915){if(_0x8bc915&&_0x8bc915['autoAssociation']===0x0){return db[_0xf380('0x29')][_0xf380('0x47')]({'name':_0x3e2655[_0xf380('0x2c')],'resourceId':_0x3e2655['id'],'type':_0x8bc915[_0xf380('0x2c')],'sectionId':_0x8bc915['id']},{})[_0xf380('0x25')](function(){return _0x15fe76;});}else{return _0x15fe76;}})[_0xf380('0x42')](function(_0x58affe){logger[_0xf380('0x2a')](_0xf380('0x4d'),_0x58affe);throw _0x58affe;});}return _0x15fe76;})[_0xf380('0x25')](respondWithResult(_0x6b3a44,0xc9))['catch'](handleError(_0x6b3a44,null));};exports[_0xf380('0x4e')]=function(_0x1ffc2d,_0x19531e){if(_0x1ffc2d[_0xf380('0x48')]['id']){delete _0x1ffc2d[_0xf380('0x48')]['id'];}return db[_0xf380('0x2f')][_0xf380('0x46')]({'where':{'id':_0x1ffc2d[_0xf380('0x4f')]['id']}})['then'](handleEntityNotFound(_0x19531e,null))[_0xf380('0x25')](saveUpdates(_0x1ffc2d[_0xf380('0x48')],null))['then'](respondWithResult(_0x19531e,null))[_0xf380('0x42')](handleError(_0x19531e,null));};exports[_0xf380('0x26')]=function(_0x29beff,_0x4f8677){return db[_0xf380('0x2f')][_0xf380('0x46')]({'where':{'id':_0x29beff[_0xf380('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f8677,null))[_0xf380('0x25')](removeEntity(_0x4f8677,null))[_0xf380('0x42')](handleError(_0x4f8677,null));};exports[_0xf380('0x30')]=function(_0x1b29cb,_0x528235){return db[_0xf380('0x2f')][_0xf380('0x30')]()['then'](respondWithResult(_0x528235,null))['catch'](handleError(_0x528235,null));};exports[_0xf380('0x50')]=function(_0xb7a2b6,_0x6cb536,_0x31d6ff){return db[_0xf380('0x51')]['find']({'where':{'id':_0xb7a2b6[_0xf380('0x4f')]['id']}})[_0xf380('0x25')](handleEntityNotFound(_0x6cb536,null))[_0xf380('0x25')](function(_0x100ebd){if(_0x100ebd){return _0x100ebd[_0xf380('0x50')](_0xb7a2b6['body'][_0xf380('0x52')],_[_0xf380('0x53')](_0xb7a2b6[_0xf380('0x48')],[_0xf380('0x52'),'id'])||{});}})['then'](respondWithResult(_0x6cb536,null))['catch'](handleError(_0x6cb536,null));};exports[_0xf380('0x54')]=function(_0x37ff9f,_0x779fb,_0x10937a){var _0x46e033={};var _0x3bac48={};var _0x3d24c7;var _0x4fc248;return db[_0xf380('0x2f')]['findOne']({'where':{'id':_0x37ff9f[_0xf380('0x4f')]['id']}})[_0xf380('0x25')](handleEntityNotFound(_0x779fb,null))['then'](function(_0x194ee2){if(_0x194ee2){_0x3d24c7=_0x194ee2;_0x3bac48[_0xf380('0x31')]=_[_0xf380('0x32')](db['CmContact']['rawAttributes']);_0x3bac48[_0xf380('0x33')]=_[_0xf380('0x32')](_0x37ff9f[_0xf380('0x33')]);_0x3bac48[_0xf380('0x34')]=_[_0xf380('0x35')](_0x3bac48[_0xf380('0x31')],_0x3bac48[_0xf380('0x33')]);_0x46e033[_0xf380('0x37')]=_[_0xf380('0x35')](_0x3bac48[_0xf380('0x31')],qs['fields'](_0x37ff9f['query'][_0xf380('0x36')]));_0x46e033[_0xf380('0x37')]=_0x46e033[_0xf380('0x37')][_0xf380('0x38')]?_0x46e033[_0xf380('0x37')]:_0x3bac48['model'];_0x46e033[_0xf380('0x55')]=qs['sort'](_0x37ff9f[_0xf380('0x33')][_0xf380('0x39')]);_0x46e033[_0xf380('0x3c')]=qs[_0xf380('0x34')](_['pick'](_0x37ff9f[_0xf380('0x33')],_0x3bac48[_0xf380('0x34')]));if(_0x37ff9f[_0xf380('0x33')][_0xf380('0x3b')]){_0x46e033['where']=_[_0xf380('0x45')](_0x46e033[_0xf380('0x3c')],{'$or':_[_0xf380('0x3d')](_0x46e033[_0xf380('0x37')],function(_0x5f27ff){var _0xa26baf={};_0xa26baf[_0x5f27ff]={'$like':'%'+_0x37ff9f[_0xf380('0x33')][_0xf380('0x3b')]+'%'};return _0xa26baf;})});}_0x46e033=_[_0xf380('0x45')]({},_0x46e033,_0x37ff9f[_0xf380('0x3e')]);return _0x3d24c7[_0xf380('0x54')](_0x46e033);}})[_0xf380('0x25')](function(_0xb71707){if(_0xb71707){_0x4fc248=_0xb71707[_0xf380('0x38')];if(!_0x37ff9f[_0xf380('0x33')]['hasOwnProperty'](_0xf380('0x56'))){_0x46e033[_0xf380('0x20')]=qs[_0xf380('0x20')](_0x37ff9f[_0xf380('0x33')][_0xf380('0x20')]);_0x46e033[_0xf380('0x1f')]=qs[_0xf380('0x1f')](_0x37ff9f[_0xf380('0x33')][_0xf380('0x1f')]);}return _0x3d24c7[_0xf380('0x54')](_0x46e033);}})['then'](function(_0x3a4050){if(_0x3a4050){return _0x3a4050?{'count':_0x4fc248,'rows':_0x3a4050}:null;}})[_0xf380('0x25')](respondWithResult(_0x779fb,null))['catch'](handleError(_0x779fb,null));}; \ No newline at end of file +var _0xa97f=['merge','map','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','addContacts','CmContact','ids','getContacts','findOne','options','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','Companies','UserProfileResource','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xa97f,0x6d));var _0xfa97=function(_0x212fe8,_0x3edb40){_0x212fe8=_0x212fe8-0x0;var _0x42bac3=_0xa97f[_0x212fe8];return _0x42bac3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa97('0x0'));var rimraf=require(_0xfa97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa97('0x2'));var rp=require(_0xfa97('0x3'));var moment=require(_0xfa97('0x4'));var BPromise=require(_0xfa97('0x5'));var Mustache=require(_0xfa97('0x6'));var util=require(_0xfa97('0x7'));var path=require(_0xfa97('0x8'));var sox=require(_0xfa97('0x9'));var csv=require('to-csv');var ejs=require(_0xfa97('0xa'));var fs=require('fs');var _=require(_0xfa97('0xb'));var squel=require(_0xfa97('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa97('0xd'));var deskjs=require(_0xfa97('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa97('0xf'));var Papa=require(_0xfa97('0x10'));var Redis=require(_0xfa97('0x11'));var authService=require(_0xfa97('0x12'));var qs=require(_0xfa97('0x13'));var as=require(_0xfa97('0x14'));var hardwareService=require(_0xfa97('0x15'));var logger=require(_0xfa97('0x16'))(_0xfa97('0x17'));var utils=require(_0xfa97('0x18'));var config=require(_0xfa97('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa97('0x1a'))['db'];function respondWithStatusCode(_0x54d9fa,_0x5221f9){_0x5221f9=_0x5221f9||0xcc;return function(_0x4caa80){if(_0x4caa80){return _0x54d9fa[_0xfa97('0x1b')](_0x5221f9);}return _0x54d9fa[_0xfa97('0x1c')](_0x5221f9)[_0xfa97('0x1d')]();};}function respondWithResult(_0x419807,_0x20cee2){_0x20cee2=_0x20cee2||0xc8;return function(_0x79dd4d){if(_0x79dd4d){return _0x419807[_0xfa97('0x1c')](_0x20cee2)['json'](_0x79dd4d);}};}function respondWithFilteredResult(_0x5392d3,_0x16c8c8){return function(_0x2c0a63){if(_0x2c0a63){var _0x47c7db=_0x2c0a63[_0xfa97('0x1e')],_0x27a39e=_0x16c8c8[_0xfa97('0x1f')],_0x450328=_0x16c8c8[_0xfa97('0x1f')]+_0x16c8c8[_0xfa97('0x20')],_0x4b2eb7;if(_0x450328>=_0x47c7db){_0x450328=_0x47c7db;_0x4b2eb7=0xc8;}else{_0x4b2eb7=0xce;}_0x5392d3['status'](_0x4b2eb7);return _0x5392d3[_0xfa97('0x21')](_0xfa97('0x22'),_0x27a39e+'-'+_0x450328+'/'+_0x47c7db)[_0xfa97('0x23')](_0x2c0a63);}return null;};}function patchUpdates(_0x530e34){return function(_0x45b773){try{jsonpatch['apply'](_0x45b773,_0x530e34,!![]);}catch(_0x5eb490){return BPromise[_0xfa97('0x24')](_0x5eb490);}return _0x45b773['save']();};}function saveUpdates(_0x20848c,_0x4d84a6){return function(_0x2687b0){if(_0x2687b0){return _0x2687b0[_0xfa97('0x25')](_0x20848c)[_0xfa97('0x26')](function(_0x2376be){return _0x2376be;});}return null;};}function removeEntity(_0x1a5a83,_0x48e3de){return function(_0x213609){if(_0x213609){return _0x213609[_0xfa97('0x27')]()[_0xfa97('0x26')](function(){var _0x3f601a=_0x213609[_0xfa97('0x28')]({'plain':!![]});var _0x2b4a13=_0xfa97('0x29');return db[_0xfa97('0x2a')][_0xfa97('0x27')]({'where':{'type':_0x2b4a13,'resourceId':_0x3f601a['id']}})[_0xfa97('0x26')](function(){return _0x213609;});})[_0xfa97('0x26')](function(){_0x1a5a83[_0xfa97('0x1c')](0xcc)[_0xfa97('0x1d')]();});}};}function handleEntityNotFound(_0x4534c7,_0x784950){return function(_0x363a65){if(!_0x363a65){_0x4534c7['sendStatus'](0x194);}return _0x363a65;};}function handleError(_0x53d4e0,_0x1b60f8){_0x1b60f8=_0x1b60f8||0x1f4;return function(_0x360d2a){logger['error'](_0x360d2a['stack']);if(_0x360d2a[_0xfa97('0x2b')]){delete _0x360d2a[_0xfa97('0x2b')];}_0x53d4e0['status'](_0x1b60f8)[_0xfa97('0x2c')](_0x360d2a);};}exports[_0xfa97('0x2d')]=function(_0x1e8f92,_0xf0d04a){var _0x49cc49={},_0x366493={},_0x6c5b23={'count':0x0,'rows':[]};return db[_0xfa97('0x2e')][_0xfa97('0x2f')]()[_0xfa97('0x26')](function(_0x39da0a){_0x366493[_0xfa97('0x30')]=_[_0xfa97('0x31')](_0x39da0a);_0x366493[_0xfa97('0x32')]=_[_0xfa97('0x31')](_0x1e8f92[_0xfa97('0x32')]);_0x366493['filters']=_[_0xfa97('0x33')](_0x366493[_0xfa97('0x30')],_0x366493[_0xfa97('0x32')]);_0x49cc49[_0xfa97('0x34')]=_[_0xfa97('0x33')](_0x366493[_0xfa97('0x30')],qs[_0xfa97('0x35')](_0x1e8f92[_0xfa97('0x32')]['fields']));_0x49cc49[_0xfa97('0x34')]=_0x49cc49['attributes'][_0xfa97('0x36')]?_0x49cc49[_0xfa97('0x34')]:_0x366493[_0xfa97('0x30')];if(!_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x37')](_0xfa97('0x38'))){_0x49cc49[_0xfa97('0x20')]=qs['limit'](_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x20')]);_0x49cc49['offset']=qs[_0xfa97('0x1f')](_0x1e8f92[_0xfa97('0x32')]['offset']);}_0x49cc49[_0xfa97('0x39')]=qs['sort'](_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x3a')]);_0x49cc49['where']=qs[_0xfa97('0x3b')](_[_0xfa97('0x3c')](_0x1e8f92[_0xfa97('0x32')],_0x366493[_0xfa97('0x3b')]),_0x39da0a);if(_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x3d')]){_0x49cc49[_0xfa97('0x3e')]=_[_0xfa97('0x3f')](_0x49cc49['where'],{'$or':_[_0xfa97('0x40')](_0x49cc49[_0xfa97('0x34')],function(_0x392852){var _0x2ad95c={};_0x2ad95c[_0x392852]={'$like':'%'+_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x3d')]+'%'};return _0x2ad95c;})});}_0x49cc49=_['merge']({},_0x49cc49,_0x1e8f92['options']);var _0xe0fc44={'where':_0x49cc49['where']};return db[_0xfa97('0x2e')][_0xfa97('0x1e')](_0xe0fc44)['then'](function(_0x4c3ddb){_0x6c5b23[_0xfa97('0x1e')]=_0x4c3ddb;if(_0x1e8f92[_0xfa97('0x32')][_0xfa97('0x41')]){_0x49cc49[_0xfa97('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xfa97('0x43')](_0x49cc49);})['then'](function(_0x4a2d54){_0x6c5b23[_0xfa97('0x44')]=_0x4a2d54;return _0x6c5b23;})[_0xfa97('0x26')](respondWithFilteredResult(_0xf0d04a,_0x49cc49))[_0xfa97('0x45')](handleError(_0xf0d04a,null));})['catch'](handleError(_0xf0d04a,null));};exports['show']=function(_0x1a52fb,_0x36f41e){var _0x55b16b={'raw':![],'where':{'id':_0x1a52fb[_0xfa97('0x46')]['id']}},_0x302c42={};_0x302c42[_0xfa97('0x30')]=_[_0xfa97('0x31')](db[_0xfa97('0x2e')][_0xfa97('0x47')]);_0x302c42[_0xfa97('0x32')]=_[_0xfa97('0x31')](_0x1a52fb['query']);_0x302c42[_0xfa97('0x3b')]=_[_0xfa97('0x33')](_0x302c42[_0xfa97('0x30')],_0x302c42[_0xfa97('0x32')]);_0x55b16b['attributes']=_[_0xfa97('0x33')](_0x302c42[_0xfa97('0x30')],qs[_0xfa97('0x35')](_0x1a52fb[_0xfa97('0x32')]['fields']));_0x55b16b[_0xfa97('0x34')]=_0x55b16b[_0xfa97('0x34')][_0xfa97('0x36')]?_0x55b16b[_0xfa97('0x34')]:_0x302c42['model'];if(_0x1a52fb[_0xfa97('0x32')][_0xfa97('0x41')]){_0x55b16b['include']=[{'all':!![]}];}_0x55b16b=_[_0xfa97('0x3f')]({},_0x55b16b,_0x1a52fb['options']);return db[_0xfa97('0x2e')]['find'](_0x55b16b)[_0xfa97('0x26')](handleEntityNotFound(_0x36f41e,null))[_0xfa97('0x26')](respondWithResult(_0x36f41e,null))[_0xfa97('0x45')](handleError(_0x36f41e,null));};exports['create']=function(_0x591fdf,_0x185f39){return db[_0xfa97('0x2e')][_0xfa97('0x48')](_0x591fdf[_0xfa97('0x49')],{})['then'](function(_0x465900){var _0x2ed925=_0x591fdf[_0xfa97('0x4a')]['get']({'plain':!![]});if(!_0x2ed925)throw new Error(_0xfa97('0x4b'));if(_0x2ed925['role']===_0xfa97('0x4a')){var _0x4ca1e4=_0x465900[_0xfa97('0x28')]({'plain':!![]});var _0x1bef5f=_0xfa97('0x29');return db[_0xfa97('0x4c')][_0xfa97('0x4d')]({'where':{'name':_0x1bef5f,'userProfileId':_0x2ed925[_0xfa97('0x4e')]},'raw':!![]})[_0xfa97('0x26')](function(_0x52ce51){if(_0x52ce51&&_0x52ce51['autoAssociation']===0x0){return db[_0xfa97('0x2a')]['create']({'name':_0x4ca1e4['name'],'resourceId':_0x4ca1e4['id'],'type':_0x52ce51[_0xfa97('0x2b')],'sectionId':_0x52ce51['id']},{})[_0xfa97('0x26')](function(){return _0x465900;});}else{return _0x465900;}})[_0xfa97('0x45')](function(_0x3adc3d){logger[_0xfa97('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3adc3d);throw _0x3adc3d;});}return _0x465900;})[_0xfa97('0x26')](respondWithResult(_0x185f39,0xc9))['catch'](handleError(_0x185f39,null));};exports[_0xfa97('0x25')]=function(_0x148527,_0xb706b1){if(_0x148527[_0xfa97('0x49')]['id']){delete _0x148527['body']['id'];}return db['CmCompany'][_0xfa97('0x4d')]({'where':{'id':_0x148527[_0xfa97('0x46')]['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0xb706b1,null))[_0xfa97('0x26')](saveUpdates(_0x148527[_0xfa97('0x49')],null))['then'](respondWithResult(_0xb706b1,null))[_0xfa97('0x45')](handleError(_0xb706b1,null));};exports[_0xfa97('0x27')]=function(_0x1e3b80,_0x4209e7){return db[_0xfa97('0x2e')]['find']({'where':{'id':_0x1e3b80[_0xfa97('0x46')]['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0x4209e7,null))['then'](removeEntity(_0x4209e7,null))[_0xfa97('0x45')](handleError(_0x4209e7,null));};exports['describe']=function(_0x541a4a,_0x4cda04){return db['CmCompany'][_0xfa97('0x2f')]()['then'](respondWithResult(_0x4cda04,null))[_0xfa97('0x45')](handleError(_0x4cda04,null));};exports[_0xfa97('0x50')]=function(_0x584fd2,_0x109bf3,_0x399a1c){return db[_0xfa97('0x51')][_0xfa97('0x4d')]({'where':{'id':_0x584fd2[_0xfa97('0x46')]['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0x109bf3,null))[_0xfa97('0x26')](function(_0x5c55fc){if(_0x5c55fc){return _0x5c55fc[_0xfa97('0x50')](_0x584fd2[_0xfa97('0x49')][_0xfa97('0x52')],_['omit'](_0x584fd2[_0xfa97('0x49')],[_0xfa97('0x52'),'id'])||{});}})['then'](respondWithResult(_0x109bf3,null))[_0xfa97('0x45')](handleError(_0x109bf3,null));};exports[_0xfa97('0x53')]=function(_0x33a5d5,_0x3424b1,_0x55c7d4){var _0x5113ec={};var _0xef5307={};var _0x52f300;var _0x473f63;return db[_0xfa97('0x2e')][_0xfa97('0x54')]({'where':{'id':_0x33a5d5['params']['id']}})[_0xfa97('0x26')](handleEntityNotFound(_0x3424b1,null))[_0xfa97('0x26')](function(_0x2fa348){if(_0x2fa348){_0x52f300=_0x2fa348;_0xef5307[_0xfa97('0x30')]=_[_0xfa97('0x31')](db[_0xfa97('0x51')][_0xfa97('0x47')]);_0xef5307[_0xfa97('0x32')]=_[_0xfa97('0x31')](_0x33a5d5[_0xfa97('0x32')]);_0xef5307['filters']=_['intersection'](_0xef5307[_0xfa97('0x30')],_0xef5307[_0xfa97('0x32')]);_0x5113ec[_0xfa97('0x34')]=_['intersection'](_0xef5307[_0xfa97('0x30')],qs[_0xfa97('0x35')](_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x35')]));_0x5113ec[_0xfa97('0x34')]=_0x5113ec[_0xfa97('0x34')]['length']?_0x5113ec[_0xfa97('0x34')]:_0xef5307[_0xfa97('0x30')];_0x5113ec[_0xfa97('0x39')]=qs['sort'](_0x33a5d5['query'][_0xfa97('0x3a')]);_0x5113ec['where']=qs[_0xfa97('0x3b')](_[_0xfa97('0x3c')](_0x33a5d5[_0xfa97('0x32')],_0xef5307[_0xfa97('0x3b')]));if(_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x3d')]){_0x5113ec[_0xfa97('0x3e')]=_[_0xfa97('0x3f')](_0x5113ec[_0xfa97('0x3e')],{'$or':_[_0xfa97('0x40')](_0x5113ec[_0xfa97('0x34')],function(_0x10ffcd){var _0xbe2621={};_0xbe2621[_0x10ffcd]={'$like':'%'+_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x3d')]+'%'};return _0xbe2621;})});}_0x5113ec=_[_0xfa97('0x3f')]({},_0x5113ec,_0x33a5d5[_0xfa97('0x55')]);return _0x52f300[_0xfa97('0x53')](_0x5113ec);}})[_0xfa97('0x26')](function(_0x145b6d){if(_0x145b6d){_0x473f63=_0x145b6d[_0xfa97('0x36')];if(!_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x37')]('nolimit')){_0x5113ec[_0xfa97('0x20')]=qs['limit'](_0x33a5d5['query']['limit']);_0x5113ec[_0xfa97('0x1f')]=qs[_0xfa97('0x1f')](_0x33a5d5[_0xfa97('0x32')][_0xfa97('0x1f')]);}return _0x52f300['getContacts'](_0x5113ec);}})[_0xfa97('0x26')](function(_0x147a47){if(_0x147a47){return _0x147a47?{'count':_0x473f63,'rows':_0x147a47}:null;}})[_0xfa97('0x26')](respondWithResult(_0x3424b1,null))[_0xfa97('0x45')](handleError(_0x3424b1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 85a6e86..01718ec 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 _0xc997=['bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','util','../../config/logger','api','moment'];(function(_0x499a43,_0x3cbee7){var _0x4e607e=function(_0xd7f146){while(--_0xd7f146){_0x499a43['push'](_0x499a43['shift']());}};_0x4e607e(++_0x3cbee7);}(_0xc997,0x1ac));var _0x7c99=function(_0x313e5f,_0x27c27f){_0x313e5f=_0x313e5f-0x0;var _0x3e76c6=_0xc997[_0x313e5f];return _0x3e76c6;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('CmCompany',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x815b=['./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x815b,0xb4));var _0xb815=function(_0x5736b7,_0x43cf28){_0x5736b7=_0x5736b7-0x0;var _0x27cd4e=_0x815b[_0x5736b7];return _0x27cd4e;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var logger=require(_0xb815('0x2'))(_0xb815('0x3'));var moment=require(_0xb815('0x4'));var BPromise=require('bluebird');var rp=require(_0xb815('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb815('0x6'));var attributes=require(_0xb815('0x7'));module[_0xb815('0x8')]=function(_0x5a5c18,_0x466899){return _0x5a5c18[_0xb815('0x9')]('CmCompany',attributes,{'tableName':_0xb815('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 30b8ec2..a1a1234 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 _0x4185=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x4c272f,_0x18d107){var _0xd08a10=function(_0x148083){while(--_0x148083){_0x4c272f['push'](_0x4c272f['shift']());}};_0xd08a10(++_0x18d107);}(_0x4185,0x69));var _0x5418=function(_0x1b8ad2,_0x39acef){_0x1b8ad2=_0x1b8ad2-0x0;var _0x262c25=_0x4185[_0x1b8ad2];return _0x262c25;};'use strict';var _=require(_0x5418('0x0'));var util=require(_0x5418('0x1'));var moment=require(_0x5418('0x2'));var BPromise=require(_0x5418('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5418('0x4'));var db=require(_0x5418('0x5'))['db'];var utils=require(_0x5418('0x6'));var logger=require(_0x5418('0x7'))('rpc');var config=require(_0x5418('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5418('0x9')][_0x5418('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c41cd,_0x2ff57f,_0x57b71f){return new BPromise(function(_0x23568e,_0x4bb5b1){return client[_0x5418('0xb')](_0x4c41cd,_0x57b71f)[_0x5418('0xc')](function(_0x6cdd3d){logger[_0x5418('0xd')](_0x5418('0xe'),_0x2ff57f,_0x5418('0xf'));logger[_0x5418('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2ff57f,_0x5418('0xf'),JSON[_0x5418('0x11')](_0x6cdd3d));if(_0x6cdd3d[_0x5418('0x12')]){if(_0x6cdd3d['error'][_0x5418('0x13')]===0x1f4){logger[_0x5418('0x12')](_0x5418('0xe'),_0x2ff57f,_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);return _0x4bb5b1(_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);}logger[_0x5418('0x12')](_0x5418('0xe'),_0x2ff57f,_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);return _0x23568e(_0x6cdd3d[_0x5418('0x12')][_0x5418('0x14')]);}else{logger['info'](_0x5418('0xe'),_0x2ff57f,_0x5418('0xf'));_0x23568e(_0x6cdd3d[_0x5418('0x15')][_0x5418('0x14')]);}})[_0x5418('0x16')](function(_0x13fa4a){logger[_0x5418('0x12')]('CmCompany,\x20%s,\x20%s',_0x2ff57f,_0x13fa4a);_0x4bb5b1(_0x13fa4a);});});} \ No newline at end of file +var _0x8f87=['client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x43a55f,_0x39a263){var _0x504877=function(_0x4f0ac8){while(--_0x4f0ac8){_0x43a55f['push'](_0x43a55f['shift']());}};_0x504877(++_0x39a263);}(_0x8f87,0x109));var _0x78f8=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x8f87[_0x533110];return _0xc3c866;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x78f8('0x0'));var rs=require(_0x78f8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78f8('0x2'))['db'];var utils=require(_0x78f8('0x3'));var logger=require(_0x78f8('0x4'))(_0x78f8('0x5'));var config=require(_0x78f8('0x6'));var jayson=require(_0x78f8('0x7'));var client=jayson[_0x78f8('0x8')][_0x78f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb159a,_0x1eab97,_0x36b9be){return new BPromise(function(_0x4635e8,_0x1075f8){return client[_0x78f8('0xa')](_0xb159a,_0x36b9be)[_0x78f8('0xb')](function(_0xe466e1){logger['info'](_0x78f8('0xc'),_0x1eab97,_0x78f8('0xd'));logger[_0x78f8('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1eab97,_0x78f8('0xd'),JSON[_0x78f8('0xf')](_0xe466e1));if(_0xe466e1[_0x78f8('0x10')]){if(_0xe466e1[_0x78f8('0x10')][_0x78f8('0x11')]===0x1f4){logger[_0x78f8('0x10')](_0x78f8('0xc'),_0x1eab97,_0xe466e1['error'][_0x78f8('0x12')]);return _0x1075f8(_0xe466e1['error'][_0x78f8('0x12')]);}logger[_0x78f8('0x10')](_0x78f8('0xc'),_0x1eab97,_0xe466e1['error']['message']);return _0x4635e8(_0xe466e1[_0x78f8('0x10')][_0x78f8('0x12')]);}else{logger[_0x78f8('0x13')](_0x78f8('0xc'),_0x1eab97,_0x78f8('0xd'));_0x4635e8(_0xe466e1[_0x78f8('0x14')]['message']);}})['catch'](function(_0x109f86){logger[_0x78f8('0x10')](_0x78f8('0xc'),_0x1eab97,_0x109f86);_0x1075f8(_0x109f86);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 6c61c4d..fcd0701 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 _0x5204=['addContacts','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id/contacts','getContacts','post','create'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5204,0xdf));var _0x4520=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x5204[_0x5a7d5f];return _0x5dcded;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var auth=require(_0x4520('0x5'));var interaction=require(_0x4520('0x6'));var config=require('../../config/environment');var controller=require(_0x4520('0x7'));router['get']('/',auth[_0x4520('0x8')](),controller[_0x4520('0x9')]);router[_0x4520('0xa')](_0x4520('0xb'),auth[_0x4520('0x8')](),controller[_0x4520('0xc')]);router[_0x4520('0xa')]('/:id',auth[_0x4520('0x8')](),controller['show']);router[_0x4520('0xa')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0xe')]);router[_0x4520('0xf')]('/',auth[_0x4520('0x8')](),controller[_0x4520('0x10')]);router[_0x4520('0xf')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0x11')]);router[_0x4520('0x12')](_0x4520('0x13'),auth[_0x4520('0x8')](),controller[_0x4520('0x14')]);router[_0x4520('0x15')](_0x4520('0x13'),auth[_0x4520('0x8')](),controller[_0x4520('0x16')]);module[_0x4520('0x17')]=router; \ No newline at end of file +var _0xc1c6=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','getContacts','post','/:id/contacts','put','delete','destroy','exports'];(function(_0x2c69dd,_0x5e57f7){var _0x44d269=function(_0x32e9ed){while(--_0x32e9ed){_0x2c69dd['push'](_0x2c69dd['shift']());}};_0x44d269(++_0x5e57f7);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x17f75c,_0x252406){_0x17f75c=_0x17f75c-0x0;var _0x5bde93=_0xc1c6[_0x17f75c];return _0x5bde93;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/describe',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0x8')](_0x6c1c('0xa'),auth['isAuthenticated'](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x8')]('/:id/contacts',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0xc')]);router[_0x6c1c('0xd')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xd')](_0x6c1c('0xe'),auth[_0x6c1c('0x7')](),controller['addContacts']);router[_0x6c1c('0xf')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['update']);router[_0x6c1c('0x10')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f41e432..2c6950c 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 _0x62f0=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x455ccf,_0x1afbde){var _0x26fe4f=function(_0x355e84){while(--_0x355e84){_0x455ccf['push'](_0x455ccf['shift']());}};_0x26fe4f(++_0x1afbde);}(_0x62f0,0x156));var _0x062f=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x62f0[_0x1460f6];return _0x46ce94;};'use strict';var _=require(_0x062f('0x0'));var Sequelize=require(_0x062f('0x1'));module[_0x062f('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x062f('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x062f('0x3')]},'dateOfBirth':{'type':Sequelize[_0x062f('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x062f('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x062f('0x3')]},'url':{'type':Sequelize[_0x062f('0x3')]},'facebook':{'type':Sequelize[_0x062f('0x3')]},'fb_data':{'type':Sequelize[_0x062f('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x062f('0x3')]},'teams':{'type':Sequelize[_0x062f('0x3')]},'viber':{'type':Sequelize[_0x062f('0x3')]},'line':{'type':Sequelize[_0x062f('0x3')]},'wechat':{'type':Sequelize[_0x062f('0x3')]},'telegram':{'type':Sequelize[_0x062f('0x3')]},'UserId':{'type':Sequelize[_0x062f('0x4')]},'priority':{'type':Sequelize[_0x062f('0x4')](0x2)[_0x062f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x062f('0x6')],'defaultValue':Sequelize[_0x062f('0x7')]}}; \ No newline at end of file +var _0x208a=['INTEGER','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x4dbda8,_0xbce830){var _0x1149ed=function(_0x299a39){while(--_0x299a39){_0x4dbda8['push'](_0x4dbda8['shift']());}};_0x1149ed(++_0xbce830);}(_0x208a,0x1e2));var _0xa208=function(_0x2031cf,_0x2de6ee){_0x2031cf=_0x2031cf-0x0;var _0x290057=_0x208a[_0x2031cf];return _0x290057;};'use strict';var _=require(_0xa208('0x0'));var Sequelize=require(_0xa208('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xa208('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa208('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa208('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa208('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa208('0x3')]},'phone':{'type':Sequelize[_0xa208('0x2')]},'mobile':{'type':Sequelize[_0xa208('0x2')]},'fax':{'type':Sequelize[_0xa208('0x2')]},'email':{'type':Sequelize[_0xa208('0x2')]},'url':{'type':Sequelize[_0xa208('0x2')]},'facebook':{'type':Sequelize[_0xa208('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xa208('0x2')]},'teams':{'type':Sequelize[_0xa208('0x2')]},'viber':{'type':Sequelize[_0xa208('0x2')]},'line':{'type':Sequelize[_0xa208('0x2')]},'wechat':{'type':Sequelize[_0xa208('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xa208('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa208('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 30b0815..77c6cfb 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 _0xb764=['getTags','findOne','rawAttributes','options','setTags','ids','getHoppers','ContactId','include','getHopperHistories','CmHopperHistory','getJscriptySessions','includeAll','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','parse','import','No\x20ListId\x20specified','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','CmContact','keys','length','startsWith','cf_','push','trimStart','all','fieldType','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','left_join','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','search','parseSearch','sqlOperator','conditions','Tag','split','map','forEach','User','dateOfBirth','datetime','castTo','DATE','type','value','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','rows','find','params','catch','describe','tags','columnName','displayName','CmCustomField','findAll','custom','values','body','get','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','SmsQueueReport','JscriptySessionReport','create','bulkCreate','each','duplicates','$or','findOrCreate','show','Tags','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','text','phone'];(function(_0x165a17,_0xbe780f){var _0x4f9f1c=function(_0x179ac2){while(--_0x179ac2){_0x165a17['push'](_0x165a17['shift']());}};_0x4f9f1c(++_0xbe780f);}(_0xb764,0x11d));var _0x4b76=function(_0x412710,_0x37d3db){_0x412710=_0x412710-0x0;var _0x2aeb83=_0xb764[_0x412710];return _0x2aeb83;};'use strict';var pdf=require(_0x4b76('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b76('0x1'));var zipdir=require(_0x4b76('0x2'));var jsonpatch=require(_0x4b76('0x3'));var rp=require(_0x4b76('0x4'));var moment=require('moment');var BPromise=require(_0x4b76('0x5'));var Mustache=require(_0x4b76('0x6'));var util=require(_0x4b76('0x7'));var path=require('path');var sox=require(_0x4b76('0x8'));var csv=require(_0x4b76('0x9'));var ejs=require(_0x4b76('0xa'));var fs=require('fs');var _=require(_0x4b76('0xb'));var squel=require(_0x4b76('0xc'));var crypto=require(_0x4b76('0xd'));var jsforce=require(_0x4b76('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4b76('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b76('0xf'));var authService=require(_0x4b76('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4b76('0x11'));var hardwareService=require(_0x4b76('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4b76('0x13'));var config=require(_0x4b76('0x14'));var licenseUtil=require(_0x4b76('0x15'));var db=require(_0x4b76('0x16'))['db'];config['redis']=_[_0x4b76('0x17')](config[_0x4b76('0x18')],{'host':_0x4b76('0x19'),'port':0x18eb});var socket=require(_0x4b76('0x1a'))(new Redis(config[_0x4b76('0x18')]));require(_0x4b76('0x1b'))[_0x4b76('0x1c')](socket);function respondWithStatusCode(_0x820ad0,_0x24e6b8){_0x24e6b8=_0x24e6b8||0xcc;return function(_0x2f9607){if(_0x2f9607){return _0x820ad0[_0x4b76('0x1d')](_0x24e6b8);}return _0x820ad0[_0x4b76('0x1e')](_0x24e6b8)[_0x4b76('0x1f')]();};}function respondWithResult(_0x2ca399,_0x906af1){_0x906af1=_0x906af1||0xc8;return function(_0x38584d){if(_0x38584d){return _0x2ca399['status'](_0x906af1)['json'](_0x38584d);}};}function respondWithFilteredResult(_0x57466a,_0xb2e736){return function(_0x3a46f){if(_0x3a46f){var _0x38d6e4=_0x3a46f[_0x4b76('0x20')],_0x383d8f=_0xb2e736[_0x4b76('0x21')],_0x4ffe2b=_0xb2e736[_0x4b76('0x21')]+_0xb2e736[_0x4b76('0x22')],_0x3abbba;if(_0x4ffe2b>=_0x38d6e4){_0x4ffe2b=_0x38d6e4;_0x3abbba=0xc8;}else{_0x3abbba=0xce;}_0x57466a[_0x4b76('0x1e')](_0x3abbba);return _0x57466a[_0x4b76('0x23')](_0x4b76('0x24'),_0x383d8f+'-'+_0x4ffe2b+'/'+_0x38d6e4)[_0x4b76('0x25')](_0x3a46f);}return null;};}function patchUpdates(_0x2535a8){return function(_0x3e8c21){try{jsonpatch['apply'](_0x3e8c21,_0x2535a8,!![]);}catch(_0x37f81c){return BPromise[_0x4b76('0x26')](_0x37f81c);}return _0x3e8c21[_0x4b76('0x27')]();};}function saveUpdates(_0x181845,_0x36fcbd){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa['update'](_0x181845)['then'](function(_0x3535f7){return _0x3535f7;});}return null;};}function removeEntity(_0x305302,_0x46d179){return function(_0xbbf16c){if(_0xbbf16c){return _0xbbf16c[_0x4b76('0x28')]()[_0x4b76('0x29')](function(){_0x305302['status'](0xcc)[_0x4b76('0x1f')]();});}};}function handleEntityNotFound(_0x351cf3,_0x5ef046){return function(_0xfd2e4f){if(!_0xfd2e4f){_0x351cf3[_0x4b76('0x1d')](0x194);}return _0xfd2e4f;};}function handleError(_0x343c2d,_0xc2a266){_0xc2a266=_0xc2a266||0x1f4;return function(_0x473f04){logger[_0x4b76('0x2a')](_0x473f04[_0x4b76('0x2b')]);if(_0x473f04['name']){delete _0x473f04[_0x4b76('0x2c')];}_0x343c2d[_0x4b76('0x1e')](_0xc2a266)[_0x4b76('0x2d')](_0x473f04);};}exports[_0x4b76('0x2e')]=function(_0x484c97,_0x4a63fc){var _0x1e1349={},_0x535550={},_0x19573c={'count':0x0,'rows':[]};return db[_0x4b76('0x2f')]['describe']()[_0x4b76('0x29')](function(_0x1467ac){var _0x478cf0=[];for(var _0x3dc2c8=0x0;_0x3dc2c80x1){_0x1085f9['or'](_0x4b76('0x66'),qs[_0x4b76('0x67')](_0x2f9bb5),null);}else{if(qs[_0x4b76('0x68')](_0x2f9bb5)){_0x1085f9['or'](_0x4b76('0x69'),_0x2f9bb5+'%');_0x1085f9['or'](_0x4b76('0x6a'),_0x2f9bb5+'%');_0x1085f9['or']('c.mobile\x20LIKE\x20?',_0x2f9bb5+'%');_0x1085f9['or'](_0x4b76('0x6b'),_0x2f9bb5+'%');}else if(qs[_0x4b76('0x6c')](_0x2f9bb5)){_0x1085f9['or'](_0x4b76('0x6d'),_0x2f9bb5+'%');}else{_0x1085f9['or'](_0x4b76('0x6e'),'%'+_0x2f9bb5+'%');_0x1085f9['or'](_0x4b76('0x6f'),'%'+_0x2f9bb5+'%');_0x1085f9['or']('c.email\x20LIKE\x20?','%'+_0x2f9bb5+'%');}}}}_0x594d47[_0x4b76('0x42')](_0x1085f9);_0x594d47[_0x4b76('0x70')](_0x4b76('0x71'));var _0x4fa1b9={'type':db[_0x4b76('0x72')][_0x4b76('0x73')]['SELECT'],'raw':!![]};var _0x23d353=_0x594d47[_0x4b76('0x74')]()[_0x4b76('0x45')]('c.id');if(_0x1e1349[_0x4b76('0x40')]){_0x1e1349[_0x4b76('0x40')]['forEach'](function(_0x312ab6){_0x594d47[_0x4b76('0x40')]('c.'+_0x312ab6[0x0],_0x312ab6[0x1]===_0x4b76('0x75')?![]:!![]);});}if(!_[_0x4b76('0x76')](_0x5508cf)){_0x594d47[_0x4b76('0x77')](_0x35d8e0);_0x23d353[_0x4b76('0x42')](_0x4b76('0x78'),_0x5508cf);}BPromise[_0x4b76('0x79')]()['then'](function(){if(!_0x28e573)return;if(_0x484c97[_0x4b76('0x7a')]['role']!==_0x4b76('0x7b'))return;if(!_[_0x4b76('0x7c')](_0x28e573[_0x4b76('0x4f')],['field',_0x4b76('0x54')])){return _0x484c97[_0x4b76('0x7a')][_0x4b76('0x7d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x266167){if(_['isEmpty'](_0x266167)){_0x23d353[_0x4b76('0x42')](_0x4b76('0x7e'));_0x594d47[_0x4b76('0x42')](_0x4b76('0x7e'));}else{_0x23d353['where'](_0x4b76('0x60'),_[_0x4b76('0x52')](_0x266167,'id'));_0x594d47['where'](_0x4b76('0x60'),_[_0x4b76('0x52')](_0x266167,'id'));}});}})[_0x4b76('0x29')](function(){if(_0x484c97[_0x4b76('0x7a')][_0x4b76('0x7f')]===_0x4b76('0x7b')&&!_0x28e573&&!_0x484c97[_0x4b76('0x39')][_0x4b76('0x5f')])return[];return db[_0x4b76('0x80')]['query'](_0x23d353[_0x4b76('0x81')](),_0x4fa1b9);})[_0x4b76('0x29')](function(_0x26dfc8){_0x19573c['count']=_0x26dfc8[_0x4b76('0x31')];if(_0x19573c[_0x4b76('0x20')]===0x0)return[];return db[_0x4b76('0x80')][_0x4b76('0x39')](_0x130c13[_0x4b76('0x81')](),_0x4fa1b9)[_0x4b76('0x29')](function(_0x13b834){_0x2b1e8b=_[_0x4b76('0x82')](_0x13b834,'id');_0x4fa1b9=_[_0x4b76('0x83')](_0x4fa1b9,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x484c97[_0x4b76('0x39')][_0x4b76('0x3c')]){_0x1e1349[_0x4b76('0x3d')][_0x4b76('0x53')](function(_0xc6c881){_0x594d47[_0x4b76('0x45')]('c.'+_0xc6c881);});}else{_0x594d47['field'](_0x4b76('0x71'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x84'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x85'));_0x594d47[_0x4b76('0x45')]('c.phone');_0x594d47['field']('c.mobile');_0x594d47[_0x4b76('0x45')]('c.fax');_0x594d47[_0x4b76('0x45')](_0x4b76('0x86'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x87'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x88'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x89'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x8a'));_0x594d47[_0x4b76('0x45')](_0x4b76('0x8b'),_0x4b76('0x8c'));}if(_0x1e1349[_0x4b76('0x22')])_0x594d47[_0x4b76('0x22')](_0x1e1349[_0x4b76('0x22')]);if(_0x1e1349['offset'])_0x594d47['offset'](_0x1e1349[_0x4b76('0x21')]);return db[_0x4b76('0x80')]['query'](_0x594d47[_0x4b76('0x81')](),_0x4fa1b9);});})[_0x4b76('0x29')](function(_0x1abc5){_0x1abc5[_0x4b76('0x53')](function(_0xd1ef92){if(_0xd1ef92[_0x4b76('0x8c')]){_0xd1ef92['Tags']=[];_0xd1ef92['TagIds'][_0x4b76('0x51')](',')[_0x4b76('0x53')](function(_0x3340c9){_0xd1ef92['Tags']['push'](_0x2b1e8b[_0x3340c9]);});}delete _0xd1ef92['TagIds'];});_0x19573c[_0x4b76('0x8d')]=_0x1abc5;return _0x19573c;})[_0x4b76('0x29')](respondWithFilteredResult(_0x4a63fc,_0x1e1349));})['catch'](handleError(_0x4a63fc,null));};exports['destroy']=function(_0x4edcee,_0x174624){return db['CmContact'][_0x4b76('0x8e')]({'where':{'id':_0x4edcee[_0x4b76('0x8f')]['id']}})['then'](handleEntityNotFound(_0x174624,null))[_0x4b76('0x29')](removeEntity(_0x174624,null))[_0x4b76('0x90')](handleError(_0x174624,null));};exports[_0x4b76('0x91')]=function(_0x5cc7f4,_0x37fce2){return db['CmContact'][_0x4b76('0x91')]()[_0x4b76('0x29')](function(_0x36088c){delete _0x36088c[_0x4b76('0x92')];for(var _0x36009f=0x0;_0x36009f=_0x51bb07){_0x4e8c7b=_0x51bb07;_0x33dc09=0xc8;}else{_0x33dc09=0xce;}_0xd88298[_0x0625('0x1d')](_0x33dc09);return _0xd88298[_0x0625('0x21')](_0x0625('0x22'),_0x20eb30+'-'+_0x4e8c7b+'/'+_0x51bb07)[_0x0625('0x23')](_0xb7b942);}return null;};}function patchUpdates(_0x3f0f49){return function(_0x2cae1d){try{jsonpatch[_0x0625('0x24')](_0x2cae1d,_0x3f0f49,!![]);}catch(_0x19de63){return BPromise[_0x0625('0x25')](_0x19de63);}return _0x2cae1d[_0x0625('0x26')]();};}function saveUpdates(_0x21266a,_0x327bec){return function(_0xe0737e){if(_0xe0737e){return _0xe0737e[_0x0625('0x27')](_0x21266a)[_0x0625('0x28')](function(_0x3d715d){return _0x3d715d;});}return null;};}function removeEntity(_0xbf62d1,_0x25d137){return function(_0x4d7a91){if(_0x4d7a91){return _0x4d7a91['destroy']()['then'](function(){_0xbf62d1[_0x0625('0x1d')](0xcc)[_0x0625('0x1e')]();});}};}function handleEntityNotFound(_0x533633,_0x476b71){return function(_0x3effd8){if(!_0x3effd8){_0x533633[_0x0625('0x1c')](0x194);}return _0x3effd8;};}function handleError(_0x5617be,_0x1766b5){_0x1766b5=_0x1766b5||0x1f4;return function(_0x1fe7e){logger[_0x0625('0x29')](_0x1fe7e['stack']);if(_0x1fe7e[_0x0625('0x2a')]){delete _0x1fe7e[_0x0625('0x2a')];}_0x5617be[_0x0625('0x1d')](_0x1766b5)[_0x0625('0x2b')](_0x1fe7e);};}exports['index']=function(_0x1488a1,_0x5cab6a){var _0x16b4f1={},_0x4d0a69={},_0x1143b9={'count':0x0,'rows':[]};return db['CmContact'][_0x0625('0x2c')]()['then'](function(_0x691a75){var _0x4533fc=[];for(var _0xed012a=0x0;_0xed012a0x1){_0x1a34fa['or'](_0x0625('0x69'),qs[_0x0625('0x6a')](_0x6f05b7),null);}else{if(qs[_0x0625('0x6b')](_0x6f05b7)){_0x1a34fa['or'](_0x0625('0x6c'),_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x6d'),_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x6e'),_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x6f'),_0x6f05b7+'%');}else if(qs[_0x0625('0x70')](_0x6f05b7)){_0x1a34fa['or']('c.email\x20LIKE\x20?',_0x6f05b7+'%');}else{_0x1a34fa['or']('c.firstName\x20LIKE\x20?','%'+_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x71'),'%'+_0x6f05b7+'%');_0x1a34fa['or'](_0x0625('0x72'),'%'+_0x6f05b7+'%');}}}}_0x4ed7e9[_0x0625('0x4a')](_0x1a34fa);_0x4ed7e9[_0x0625('0x73')]('c.id');var _0xb383f7={'type':db['Sequelize'][_0x0625('0x74')]['SELECT'],'raw':!![]};var _0x386d98=_0x4ed7e9['clone']()[_0x0625('0x42')](_0x0625('0x75'));if(_0x16b4f1[_0x0625('0x76')]){_0x16b4f1['order'][_0x0625('0x52')](function(_0x1ae0b9){_0x4ed7e9[_0x0625('0x76')]('c.'+_0x1ae0b9[0x0],_0x1ae0b9[0x1]===_0x0625('0x77')?![]:!![]);});}if(!_[_0x0625('0x62')](_0x336cf3)){_0x4ed7e9[_0x0625('0x78')](_0x5db772);_0x386d98[_0x0625('0x4a')](_0x0625('0x79'),_0x336cf3);}BPromise[_0x0625('0x7a')]()[_0x0625('0x28')](function(){if(!_0x184ba7)return;if(_0x1488a1[_0x0625('0x7b')][_0x0625('0x7c')]!==_0x0625('0x7d'))return;if(!_[_0x0625('0x7e')](_0x184ba7[_0x0625('0x4e')],[_0x0625('0x42'),_0x0625('0x55')])){return _0x1488a1[_0x0625('0x7b')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0xd4c0a4){if(_[_0x0625('0x62')](_0xd4c0a4)){_0x386d98[_0x0625('0x4a')](_0x0625('0x7f'));_0x4ed7e9['where']('c.ListId\x20IS\x20NULL');}else{_0x386d98[_0x0625('0x4a')]('c.ListId\x20IN\x20?',_[_0x0625('0x5e')](_0xd4c0a4,'id'));_0x4ed7e9[_0x0625('0x4a')](_0x0625('0x64'),_[_0x0625('0x5e')](_0xd4c0a4,'id'));}});}})['then'](function(){if(_0x1488a1[_0x0625('0x7b')][_0x0625('0x7c')]===_0x0625('0x7d')&&!_0x184ba7&&!_0x1488a1['query']['ListId'])return[];return db[_0x0625('0x80')][_0x0625('0x38')](_0x386d98['toString'](),_0xb383f7);})[_0x0625('0x28')](function(_0x1a1607){_0x1143b9[_0x0625('0x1f')]=_0x1a1607[_0x0625('0x2e')];if(_0x1143b9[_0x0625('0x1f')]===0x0)return[];return db['sequelize'][_0x0625('0x38')](_0x2fb876[_0x0625('0x81')](),_0xb383f7)[_0x0625('0x28')](function(_0x3e5ef8){_0xc37b62=_[_0x0625('0x82')](_0x3e5ef8,'id');_0xb383f7=_[_0x0625('0x83')](_0xb383f7,{'model':db[_0x0625('0x84')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1488a1[_0x0625('0x38')][_0x0625('0x3c')]){_0x16b4f1[_0x0625('0x3b')][_0x0625('0x52')](function(_0x486c26){_0x4ed7e9['field']('c.'+_0x486c26);});}else{_0x4ed7e9[_0x0625('0x42')]('c.id');_0x4ed7e9['field'](_0x0625('0x85'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x86'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x87'));_0x4ed7e9[_0x0625('0x42')]('c.mobile');_0x4ed7e9[_0x0625('0x42')]('c.fax');_0x4ed7e9[_0x0625('0x42')](_0x0625('0x88'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x89'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x8a'));_0x4ed7e9[_0x0625('0x42')]('c.deletedAt');_0x4ed7e9[_0x0625('0x42')](_0x0625('0x8b'));_0x4ed7e9[_0x0625('0x42')](_0x0625('0x8c'),'TagIds');}if(_0x16b4f1[_0x0625('0x3e')])_0x4ed7e9['limit'](_0x16b4f1['limit']);if(_0x16b4f1['offset'])_0x4ed7e9[_0x0625('0x20')](_0x16b4f1[_0x0625('0x20')]);return db[_0x0625('0x80')][_0x0625('0x38')](_0x4ed7e9[_0x0625('0x81')](),_0xb383f7);});})[_0x0625('0x28')](function(_0x4fca5c){_0x4fca5c[_0x0625('0x52')](function(_0x496c44){if(_0x496c44[_0x0625('0x8d')]){_0x496c44[_0x0625('0x8e')]=[];_0x496c44[_0x0625('0x8d')][_0x0625('0x51')](',')[_0x0625('0x52')](function(_0x3b01f3){_0x496c44[_0x0625('0x8e')]['push'](_0xc37b62[_0x3b01f3]);});}delete _0x496c44[_0x0625('0x8d')];});_0x1143b9[_0x0625('0x8f')]=_0x4fca5c;return _0x1143b9;})[_0x0625('0x28')](respondWithFilteredResult(_0x5cab6a,_0x16b4f1));})[_0x0625('0x90')](handleError(_0x5cab6a,null));};exports[_0x0625('0x91')]=function(_0x41bb8c,_0x28daba){return db[_0x0625('0x84')][_0x0625('0x4f')]({'where':{'id':_0x41bb8c[_0x0625('0x92')]['id']}})[_0x0625('0x28')](handleEntityNotFound(_0x28daba,null))['then'](removeEntity(_0x28daba,null))[_0x0625('0x90')](handleError(_0x28daba,null));};exports[_0x0625('0x2c')]=function(_0x4ca4c7,_0x1a2be3){return db[_0x0625('0x84')][_0x0625('0x2c')]()['then'](function(_0x175704){delete _0x175704[_0x0625('0x93')];for(var _0x43b928=0x0;_0x43b928{}\s\\|]/g,'-');_0xccb3b(null,util[_0x4ae2('0x1a')]('%s-%s%s',path['basename'](_0x343db1[_0x4ae2('0x19')],path[_0x4ae2('0x1b')](_0x343db1[_0x4ae2('0x19')])),Date[_0x4ae2('0x1c')](),path[_0x4ae2('0x1b')](_0x343db1['originalname'])));}})});router[_0x4ae2('0x12')]('/csv',upload[_0x4ae2('0x1d')](_0x4ae2('0x1e')),controller[_0x4ae2('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43f112,_0x6f0cc6,_0x2454b3){_0x2454b3(null,path[_0x4ae2('0x17')](config[_0x4ae2('0x18')],_0x4ae2('0x20')));},'filename':function(_0x5b2e65,_0x5962b0,_0x9508d7){_0x5962b0[_0x4ae2('0x19')]=_0x5962b0[_0x4ae2('0x19')][_0x4ae2('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9508d7(null,util[_0x4ae2('0x1a')](_0x4ae2('0x22'),path['basename'](_0x5962b0['originalname'],path[_0x4ae2('0x1b')](_0x5962b0['originalname'])),Date['now'](),path['extname'](_0x5962b0[_0x4ae2('0x19')])));}})});router[_0x4ae2('0x12')]('/upload',upload[_0x4ae2('0x1d')](_0x4ae2('0x1e')),controller[_0x4ae2('0x23')]);router[_0x4ae2('0x12')](_0x4ae2('0x24'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x25')]);router[_0x4ae2('0x26')](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x27')]);router[_0x4ae2('0x28')](_0x4ae2('0x9'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x29')]);module[_0x4ae2('0x2a')]=router; \ No newline at end of file +var _0x7da7=['isAuthenticated','index','/describe','describe','get','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','getJscriptySessions','post','/merge','merge','create','/create_many','setTags','diskStorage','join','root','originalname','replace','format','now','extname','/csv','single','server/files/tmp','%s-%s%s','file','upload','/upload/:id','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./cmContact.controller'];(function(_0x190145,_0x563a56){var _0x35f024=function(_0x2de282){while(--_0x2de282){_0x190145['push'](_0x190145['shift']());}};_0x35f024(++_0x563a56);}(_0x7da7,0x10d));var _0x77da=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x7da7[_0x15fc3c];return _0x94c5c8;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0x7')](),controller[_0x77da('0xf')]);router['get'](_0x77da('0x10'),auth[_0x77da('0x7')](),controller[_0x77da('0x11')]);router[_0x77da('0xb')]('/:id/hopper_histories',auth[_0x77da('0x7')](),controller[_0x77da('0x12')]);router[_0x77da('0xb')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x77da('0x13')]);router[_0x77da('0xb')]('/:id/jscripty_sessions',auth[_0x77da('0x7')](),controller[_0x77da('0x14')]);router[_0x77da('0x15')](_0x77da('0x16'),auth['isAuthenticated'](),controller[_0x77da('0x17')]);router['post']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x18')]);router[_0x77da('0x15')](_0x77da('0x19'),auth['isAuthenticated'](),controller['bulkCreate']);router['post']('/:id/tags',auth[_0x77da('0x7')](),controller[_0x77da('0x1a')]);var upload=multer({'storage':multer[_0x77da('0x1b')]({'destination':function(_0x335dcb,_0x19a00c,_0x12d2b1){_0x12d2b1(null,path[_0x77da('0x1c')](config[_0x77da('0x1d')],'server/files/tmp'));},'filename':function(_0x492063,_0xd5a809,_0x4d1512){_0xd5a809['originalname']=_0xd5a809[_0x77da('0x1e')][_0x77da('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d1512(null,util[_0x77da('0x20')]('%s-%s%s',path['basename'](_0xd5a809[_0x77da('0x1e')],path['extname'](_0xd5a809[_0x77da('0x1e')])),Date[_0x77da('0x21')](),path[_0x77da('0x22')](_0xd5a809[_0x77da('0x1e')])));}})});router[_0x77da('0x15')](_0x77da('0x23'),upload[_0x77da('0x24')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0x77da('0x1b')]({'destination':function(_0x2d009f,_0x835167,_0xbd06b7){_0xbd06b7(null,path['join'](config[_0x77da('0x1d')],_0x77da('0x25')));},'filename':function(_0x470c9f,_0x36115b,_0x446ae7){_0x36115b['originalname']=_0x36115b[_0x77da('0x1e')][_0x77da('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x446ae7(null,util[_0x77da('0x20')](_0x77da('0x26'),path['basename'](_0x36115b['originalname'],path['extname'](_0x36115b[_0x77da('0x1e')])),Date[_0x77da('0x21')](),path[_0x77da('0x22')](_0x36115b[_0x77da('0x1e')])));}})});router[_0x77da('0x15')]('/upload',upload[_0x77da('0x24')](_0x77da('0x27')),controller[_0x77da('0x28')]);router[_0x77da('0x15')](_0x77da('0x29'),auth[_0x77da('0x7')](),controller['import']);router[_0x77da('0x2a')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0x2b')]);router[_0x77da('0x2c')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index d2d720d..d44ede0 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 _0x96fd=['PHONE','exports','STRING','INTEGER'];(function(_0x370987,_0x16ce5a){var _0x4382db=function(_0x2ba31b){while(--_0x2ba31b){_0x370987['push'](_0x370987['shift']());}};_0x4382db(++_0x16ce5a);}(_0x96fd,0x1e9));var _0xd96f=function(_0x1bccda,_0x1009e2){_0x1bccda=_0x1bccda-0x0;var _0x486285=_0x96fd[_0x1bccda];return _0x486285;};'use strict';var Sequelize=require('sequelize');module[_0xd96f('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xd96f('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xd96f('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xd96f('0x3')},'OrderBy':{'type':Sequelize[_0xd96f('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x7e02=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7e02,0x71));var _0x27e0=function(_0x38ec19,_0x1ab472){_0x38ec19=_0x38ec19-0x0;var _0x1e0ee3=_0x7e02[_0x38ec19];return _0x1e0ee3;};'use strict';var Sequelize=require(_0x27e0('0x0'));module[_0x27e0('0x1')]={'CmContactId':{'type':Sequelize[_0x27e0('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x27e0('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x27e0('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x27e0('0x3')],'defaultValue':_0x27e0('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index c5d597c..32f41a9 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 _0x053c=['include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','index','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll'];(function(_0x5ad96e,_0x2e0eb4){var _0x20d419=function(_0x15ddd2){while(--_0x15ddd2){_0x5ad96e['push'](_0x5ad96e['shift']());}};_0x20d419(++_0x2e0eb4);}(_0x053c,0xfc));var _0xc053=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x053c[_0x432682];return _0x463d05;};'use strict';var pdf=require(_0xc053('0x0'));var emlformat=require(_0xc053('0x1'));var rimraf=require(_0xc053('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc053('0x3'));var moment=require(_0xc053('0x4'));var BPromise=require(_0xc053('0x5'));var Mustache=require(_0xc053('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc053('0x7'));var csv=require('to-csv');var ejs=require(_0xc053('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc053('0x9'));var jsforce=require(_0xc053('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc053('0xb'));var querystring=require('querystring');var Papa=require(_0xc053('0xc'));var Redis=require(_0xc053('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc053('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc053('0xf'));var logger=require(_0xc053('0x10'))(_0xc053('0x11'));var utils=require(_0xc053('0x12'));var config=require(_0xc053('0x13'));var licenseUtil=require(_0xc053('0x14'));var db=require(_0xc053('0x15'))['db'];function respondWithStatusCode(_0x2cc68a,_0x2bc207){_0x2bc207=_0x2bc207||0xcc;return function(_0x57f00e){if(_0x57f00e){return _0x2cc68a[_0xc053('0x16')](_0x2bc207);}return _0x2cc68a[_0xc053('0x17')](_0x2bc207)[_0xc053('0x18')]();};}function respondWithResult(_0x8e1cb3,_0x235e12){_0x235e12=_0x235e12||0xc8;return function(_0x7ea9f3){if(_0x7ea9f3){return _0x8e1cb3[_0xc053('0x17')](_0x235e12)[_0xc053('0x19')](_0x7ea9f3);}};}function respondWithFilteredResult(_0x54a7d0,_0x181107){return function(_0x264c0e){if(_0x264c0e){var _0x8a4b1b=_0x264c0e[_0xc053('0x1a')],_0xb50f73=_0x181107['offset'],_0x116d00=_0x181107[_0xc053('0x1b')]+_0x181107['limit'],_0x590540;if(_0x116d00>=_0x8a4b1b){_0x116d00=_0x8a4b1b;_0x590540=0xc8;}else{_0x590540=0xce;}_0x54a7d0['status'](_0x590540);return _0x54a7d0['set'](_0xc053('0x1c'),_0xb50f73+'-'+_0x116d00+'/'+_0x8a4b1b)['json'](_0x264c0e);}return null;};}function patchUpdates(_0xad63e2){return function(_0x3603ec){try{jsonpatch[_0xc053('0x1d')](_0x3603ec,_0xad63e2,!![]);}catch(_0x23287e){return BPromise[_0xc053('0x1e')](_0x23287e);}return _0x3603ec[_0xc053('0x1f')]();};}function saveUpdates(_0x3ce3c9,_0x302d88){return function(_0x4af9dd){if(_0x4af9dd){return _0x4af9dd['update'](_0x3ce3c9)[_0xc053('0x20')](function(_0x4d9a88){return _0x4d9a88;});}return null;};}function removeEntity(_0x3970fe,_0x2657f8){return function(_0x2d58f2){if(_0x2d58f2){return _0x2d58f2[_0xc053('0x21')]()['then'](function(){var _0xe57474=_0x2d58f2[_0xc053('0x22')]({'plain':!![]});var _0x27e75d='CmContactHasItems';return db[_0xc053('0x23')][_0xc053('0x21')]({'where':{'type':_0x27e75d,'resourceId':_0xe57474['id']}})[_0xc053('0x20')](function(){return _0x2d58f2;});})['then'](function(){_0x3970fe[_0xc053('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c535,_0x3514c5){return function(_0x253ece){if(!_0x253ece){_0x31c535[_0xc053('0x16')](0x194);}return _0x253ece;};}function handleError(_0x1c94e3,_0x5810da){_0x5810da=_0x5810da||0x1f4;return function(_0x4255da){logger['error'](_0x4255da[_0xc053('0x24')]);if(_0x4255da['name']){delete _0x4255da[_0xc053('0x25')];}_0x1c94e3[_0xc053('0x17')](_0x5810da)['send'](_0x4255da);};}exports[_0xc053('0x26')]=function(_0x259092,_0x5d1328){var _0x20e643={},_0x7f37dd={},_0x105eaa={'count':0x0,'rows':[]};var _0x5cf192=_['map'](db[_0xc053('0x27')]['rawAttributes'],function(_0x51cdb3){return{'name':_0x51cdb3[_0xc053('0x28')],'type':_0x51cdb3[_0xc053('0x29')][_0xc053('0x2a')]};});_0x7f37dd[_0xc053('0x2b')]=_['map'](_0x5cf192,_0xc053('0x25'));_0x7f37dd[_0xc053('0x2c')]=_[_0xc053('0x2d')](_0x259092[_0xc053('0x2c')]);_0x7f37dd[_0xc053('0x2e')]=_[_0xc053('0x2f')](_0x7f37dd['model'],_0x7f37dd['query']);_0x20e643[_0xc053('0x30')]=_['intersection'](_0x7f37dd[_0xc053('0x2b')],qs[_0xc053('0x31')](_0x259092[_0xc053('0x2c')][_0xc053('0x31')]));_0x20e643[_0xc053('0x30')]=_0x20e643[_0xc053('0x30')][_0xc053('0x32')]?_0x20e643[_0xc053('0x30')]:_0x7f37dd[_0xc053('0x2b')];if(!_0x259092[_0xc053('0x2c')][_0xc053('0x33')]('nolimit')){_0x20e643[_0xc053('0x34')]=qs[_0xc053('0x34')](_0x259092[_0xc053('0x2c')][_0xc053('0x34')]);_0x20e643[_0xc053('0x1b')]=qs['offset'](_0x259092[_0xc053('0x2c')][_0xc053('0x1b')]);}_0x20e643[_0xc053('0x35')]=qs[_0xc053('0x36')](_0x259092[_0xc053('0x2c')][_0xc053('0x36')]);_0x20e643[_0xc053('0x37')]=qs[_0xc053('0x2e')](_['pick'](_0x259092['query'],_0x7f37dd[_0xc053('0x2e')]),_0x5cf192);if(_0x259092[_0xc053('0x2c')][_0xc053('0x38')]){_0x20e643[_0xc053('0x37')]=_[_0xc053('0x39')](_0x20e643[_0xc053('0x37')],{'$or':_[_0xc053('0x3a')](_0x5cf192,function(_0x9156d0){if(_0x9156d0[_0xc053('0x29')]!==_0xc053('0x3b')){var _0x33e91d={};_0x33e91d[_0x9156d0['name']]={'$like':'%'+_0x259092[_0xc053('0x2c')][_0xc053('0x38')]+'%'};return _0x33e91d;}})});}_0x20e643=_[_0xc053('0x39')]({},_0x20e643,_0x259092[_0xc053('0x3c')]);var _0x1c4073={'where':_0x20e643[_0xc053('0x37')]};return db[_0xc053('0x27')]['count'](_0x1c4073)[_0xc053('0x20')](function(_0x193e99){_0x105eaa[_0xc053('0x1a')]=_0x193e99;if(_0x259092[_0xc053('0x2c')]['includeAll']){_0x20e643['include']=[{'all':!![]}];}return db[_0xc053('0x27')][_0xc053('0x3d')](_0x20e643);})[_0xc053('0x20')](function(_0x39638f){_0x105eaa[_0xc053('0x3e')]=_0x39638f;return _0x105eaa;})[_0xc053('0x20')](respondWithFilteredResult(_0x5d1328,_0x20e643))[_0xc053('0x3f')](handleError(_0x5d1328,null));};exports[_0xc053('0x40')]=function(_0x16fb9e,_0x568f3d){var _0x190873={'raw':!![],'where':{'id':_0x16fb9e[_0xc053('0x41')]['id']}},_0x24a9e7={};_0x24a9e7[_0xc053('0x2b')]=_[_0xc053('0x2d')](db[_0xc053('0x27')][_0xc053('0x42')]);_0x24a9e7[_0xc053('0x2c')]=_[_0xc053('0x2d')](_0x16fb9e['query']);_0x24a9e7[_0xc053('0x2e')]=_[_0xc053('0x2f')](_0x24a9e7['model'],_0x24a9e7['query']);_0x190873[_0xc053('0x30')]=_[_0xc053('0x2f')](_0x24a9e7[_0xc053('0x2b')],qs['fields'](_0x16fb9e['query']['fields']));_0x190873[_0xc053('0x30')]=_0x190873[_0xc053('0x30')][_0xc053('0x32')]?_0x190873[_0xc053('0x30')]:_0x24a9e7[_0xc053('0x2b')];if(_0x16fb9e[_0xc053('0x2c')][_0xc053('0x43')]){_0x190873[_0xc053('0x44')]=[{'all':!![]}];}_0x190873=_['merge']({},_0x190873,_0x16fb9e['options']);return db[_0xc053('0x27')][_0xc053('0x45')](_0x190873)['then'](handleEntityNotFound(_0x568f3d,null))[_0xc053('0x20')](respondWithResult(_0x568f3d,null))[_0xc053('0x3f')](handleError(_0x568f3d,null));};exports[_0xc053('0x46')]=function(_0x539aca,_0x428df2){return db[_0xc053('0x27')][_0xc053('0x46')](_0x539aca['body'],{})['then'](function(_0x5a1072){var _0x2afdbb=_0x539aca[_0xc053('0x47')][_0xc053('0x22')]({'plain':!![]});if(!_0x2afdbb)throw new Error(_0xc053('0x48'));if(_0x2afdbb[_0xc053('0x49')]==='user'){var _0x4b7be0=_0x5a1072[_0xc053('0x22')]({'plain':!![]});var _0x24dd02='CmContactHasItems';return db[_0xc053('0x4a')]['find']({'where':{'name':_0x24dd02,'userProfileId':_0x2afdbb[_0xc053('0x4b')]},'raw':!![]})[_0xc053('0x20')](function(_0x487722){if(_0x487722&&_0x487722[_0xc053('0x4c')]===0x0){return db[_0xc053('0x23')][_0xc053('0x46')]({'name':_0x4b7be0[_0xc053('0x25')],'resourceId':_0x4b7be0['id'],'type':_0x487722[_0xc053('0x25')],'sectionId':_0x487722['id']},{})['then'](function(){return _0x5a1072;});}else{return _0x5a1072;}})['catch'](function(_0x38d3bc){logger[_0xc053('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38d3bc);throw _0x38d3bc;});}return _0x5a1072;})[_0xc053('0x20')](respondWithResult(_0x428df2,0xc9))[_0xc053('0x3f')](handleError(_0x428df2,null));};exports[_0xc053('0x4e')]=function(_0x32397b,_0x49a41c){if(_0x32397b[_0xc053('0x4f')]['id']){delete _0x32397b[_0xc053('0x4f')]['id'];}return db[_0xc053('0x27')][_0xc053('0x45')]({'where':{'id':_0x32397b[_0xc053('0x41')]['id']}})[_0xc053('0x20')](handleEntityNotFound(_0x49a41c,null))[_0xc053('0x20')](saveUpdates(_0x32397b[_0xc053('0x4f')],null))[_0xc053('0x20')](respondWithResult(_0x49a41c,null))['catch'](handleError(_0x49a41c,null));};exports[_0xc053('0x21')]=function(_0x477869,_0x27b200){return db[_0xc053('0x27')][_0xc053('0x45')]({'where':{'id':_0x477869[_0xc053('0x41')]['id']}})[_0xc053('0x20')](handleEntityNotFound(_0x27b200,null))['then'](removeEntity(_0x27b200,null))[_0xc053('0x3f')](handleError(_0x27b200,null));}; \ No newline at end of file +var _0x8e61=['attributes','length','nolimit','order','sort','where','pick','merge','CmContactHasItem','count','includeAll','include','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields'];(function(_0xff6c6c,_0x13ea5e){var _0x110a47=function(_0x76c089){while(--_0x76c089){_0xff6c6c['push'](_0xff6c6c['shift']());}};_0x110a47(++_0x13ea5e);}(_0x8e61,0x163));var _0x18e6=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8e61[_0x550d12];return _0x12103d;};'use strict';var pdf=require(_0x18e6('0x0'));var emlformat=require(_0x18e6('0x1'));var rimraf=require(_0x18e6('0x2'));var zipdir=require(_0x18e6('0x3'));var jsonpatch=require(_0x18e6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x18e6('0x5'));var Mustache=require(_0x18e6('0x6'));var util=require(_0x18e6('0x7'));var path=require(_0x18e6('0x8'));var sox=require(_0x18e6('0x9'));var csv=require(_0x18e6('0xa'));var ejs=require(_0x18e6('0xb'));var fs=require('fs');var _=require(_0x18e6('0xc'));var squel=require(_0x18e6('0xd'));var crypto=require(_0x18e6('0xe'));var jsforce=require(_0x18e6('0xf'));var deskjs=require(_0x18e6('0x10'));var toCsv=require(_0x18e6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x18e6('0x11'));var authService=require(_0x18e6('0x12'));var qs=require(_0x18e6('0x13'));var as=require(_0x18e6('0x14'));var hardwareService=require(_0x18e6('0x15'));var logger=require('../../config/logger')(_0x18e6('0x16'));var utils=require('../../config/utils');var config=require(_0x18e6('0x17'));var licenseUtil=require(_0x18e6('0x18'));var db=require(_0x18e6('0x19'))['db'];function respondWithStatusCode(_0x29ac6b,_0x5a75f1){_0x5a75f1=_0x5a75f1||0xcc;return function(_0x770d3b){if(_0x770d3b){return _0x29ac6b[_0x18e6('0x1a')](_0x5a75f1);}return _0x29ac6b[_0x18e6('0x1b')](_0x5a75f1)[_0x18e6('0x1c')]();};}function respondWithResult(_0x2f24f2,_0x46b6a1){_0x46b6a1=_0x46b6a1||0xc8;return function(_0x3a69e4){if(_0x3a69e4){return _0x2f24f2[_0x18e6('0x1b')](_0x46b6a1)[_0x18e6('0x1d')](_0x3a69e4);}};}function respondWithFilteredResult(_0x1ea9e4,_0x1aa03e){return function(_0x730dc9){if(_0x730dc9){var _0x2a7e0d=_0x730dc9['count'],_0x2ba3e6=_0x1aa03e[_0x18e6('0x1e')],_0x253ac7=_0x1aa03e[_0x18e6('0x1e')]+_0x1aa03e[_0x18e6('0x1f')],_0x37f751;if(_0x253ac7>=_0x2a7e0d){_0x253ac7=_0x2a7e0d;_0x37f751=0xc8;}else{_0x37f751=0xce;}_0x1ea9e4[_0x18e6('0x1b')](_0x37f751);return _0x1ea9e4[_0x18e6('0x20')](_0x18e6('0x21'),_0x2ba3e6+'-'+_0x253ac7+'/'+_0x2a7e0d)[_0x18e6('0x1d')](_0x730dc9);}return null;};}function patchUpdates(_0x5e64d8){return function(_0x4cc5b7){try{jsonpatch[_0x18e6('0x22')](_0x4cc5b7,_0x5e64d8,!![]);}catch(_0x5827c5){return BPromise['reject'](_0x5827c5);}return _0x4cc5b7[_0x18e6('0x23')]();};}function saveUpdates(_0x4c756a,_0x3a88ec){return function(_0x408918){if(_0x408918){return _0x408918[_0x18e6('0x24')](_0x4c756a)[_0x18e6('0x25')](function(_0x47ea78){return _0x47ea78;});}return null;};}function removeEntity(_0x5449e3,_0x12ea33){return function(_0x1a012a){if(_0x1a012a){return _0x1a012a[_0x18e6('0x26')]()['then'](function(){var _0x756caa=_0x1a012a['get']({'plain':!![]});var _0x30b225='CmContactHasItems';return db[_0x18e6('0x27')]['destroy']({'where':{'type':_0x30b225,'resourceId':_0x756caa['id']}})[_0x18e6('0x25')](function(){return _0x1a012a;});})[_0x18e6('0x25')](function(){_0x5449e3[_0x18e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18801b,_0x32b1c1){return function(_0x3d06ee){if(!_0x3d06ee){_0x18801b[_0x18e6('0x1a')](0x194);}return _0x3d06ee;};}function handleError(_0x58a24c,_0x5b609d){_0x5b609d=_0x5b609d||0x1f4;return function(_0x1088ec){logger[_0x18e6('0x28')](_0x1088ec[_0x18e6('0x29')]);if(_0x1088ec[_0x18e6('0x2a')]){delete _0x1088ec['name'];}_0x58a24c[_0x18e6('0x1b')](_0x5b609d)[_0x18e6('0x2b')](_0x1088ec);};}exports[_0x18e6('0x2c')]=function(_0x186761,_0x3111f3){var _0x2245c5={},_0x30c07d={},_0x1936b3={'count':0x0,'rows':[]};var _0x2ef630=_['map'](db['CmContactHasItem'][_0x18e6('0x2d')],function(_0x484ea9){return{'name':_0x484ea9[_0x18e6('0x2e')],'type':_0x484ea9[_0x18e6('0x2f')]['key']};});_0x30c07d[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x2ef630,_0x18e6('0x2a'));_0x30c07d['query']=_[_0x18e6('0x32')](_0x186761[_0x18e6('0x33')]);_0x30c07d[_0x18e6('0x34')]=_[_0x18e6('0x35')](_0x30c07d[_0x18e6('0x30')],_0x30c07d[_0x18e6('0x33')]);_0x2245c5['attributes']=_[_0x18e6('0x35')](_0x30c07d[_0x18e6('0x30')],qs['fields'](_0x186761['query'][_0x18e6('0x36')]));_0x2245c5[_0x18e6('0x37')]=_0x2245c5[_0x18e6('0x37')][_0x18e6('0x38')]?_0x2245c5[_0x18e6('0x37')]:_0x30c07d['model'];if(!_0x186761['query']['hasOwnProperty'](_0x18e6('0x39'))){_0x2245c5[_0x18e6('0x1f')]=qs[_0x18e6('0x1f')](_0x186761[_0x18e6('0x33')]['limit']);_0x2245c5[_0x18e6('0x1e')]=qs[_0x18e6('0x1e')](_0x186761[_0x18e6('0x33')]['offset']);}_0x2245c5[_0x18e6('0x3a')]=qs[_0x18e6('0x3b')](_0x186761[_0x18e6('0x33')]['sort']);_0x2245c5[_0x18e6('0x3c')]=qs[_0x18e6('0x34')](_[_0x18e6('0x3d')](_0x186761[_0x18e6('0x33')],_0x30c07d['filters']),_0x2ef630);if(_0x186761[_0x18e6('0x33')]['filter']){_0x2245c5[_0x18e6('0x3c')]=_['merge'](_0x2245c5[_0x18e6('0x3c')],{'$or':_[_0x18e6('0x31')](_0x2ef630,function(_0x147d30){if(_0x147d30['type']!=='VIRTUAL'){var _0x4416e1={};_0x4416e1[_0x147d30[_0x18e6('0x2a')]]={'$like':'%'+_0x186761['query']['filter']+'%'};return _0x4416e1;}})});}_0x2245c5=_[_0x18e6('0x3e')]({},_0x2245c5,_0x186761['options']);var _0x3ef0e0={'where':_0x2245c5[_0x18e6('0x3c')]};return db[_0x18e6('0x3f')][_0x18e6('0x40')](_0x3ef0e0)[_0x18e6('0x25')](function(_0x451d99){_0x1936b3[_0x18e6('0x40')]=_0x451d99;if(_0x186761[_0x18e6('0x33')][_0x18e6('0x41')]){_0x2245c5[_0x18e6('0x42')]=[{'all':!![]}];}return db[_0x18e6('0x3f')]['findAll'](_0x2245c5);})[_0x18e6('0x25')](function(_0x474b77){_0x1936b3[_0x18e6('0x43')]=_0x474b77;return _0x1936b3;})[_0x18e6('0x25')](respondWithFilteredResult(_0x3111f3,_0x2245c5))[_0x18e6('0x44')](handleError(_0x3111f3,null));};exports[_0x18e6('0x45')]=function(_0xedf9b6,_0x150cca){var _0x323cc1={'raw':!![],'where':{'id':_0xedf9b6[_0x18e6('0x46')]['id']}},_0x300f7a={};_0x300f7a[_0x18e6('0x30')]=_[_0x18e6('0x32')](db[_0x18e6('0x3f')][_0x18e6('0x2d')]);_0x300f7a[_0x18e6('0x33')]=_[_0x18e6('0x32')](_0xedf9b6[_0x18e6('0x33')]);_0x300f7a[_0x18e6('0x34')]=_['intersection'](_0x300f7a[_0x18e6('0x30')],_0x300f7a[_0x18e6('0x33')]);_0x323cc1[_0x18e6('0x37')]=_['intersection'](_0x300f7a[_0x18e6('0x30')],qs[_0x18e6('0x36')](_0xedf9b6[_0x18e6('0x33')][_0x18e6('0x36')]));_0x323cc1[_0x18e6('0x37')]=_0x323cc1[_0x18e6('0x37')][_0x18e6('0x38')]?_0x323cc1[_0x18e6('0x37')]:_0x300f7a[_0x18e6('0x30')];if(_0xedf9b6[_0x18e6('0x33')][_0x18e6('0x41')]){_0x323cc1['include']=[{'all':!![]}];}_0x323cc1=_[_0x18e6('0x3e')]({},_0x323cc1,_0xedf9b6['options']);return db[_0x18e6('0x3f')][_0x18e6('0x47')](_0x323cc1)[_0x18e6('0x25')](handleEntityNotFound(_0x150cca,null))['then'](respondWithResult(_0x150cca,null))[_0x18e6('0x44')](handleError(_0x150cca,null));};exports[_0x18e6('0x48')]=function(_0x3becf4,_0x1583ea){return db[_0x18e6('0x3f')]['create'](_0x3becf4['body'],{})[_0x18e6('0x25')](function(_0x733826){var _0x4b6d0a=_0x3becf4['user'][_0x18e6('0x49')]({'plain':!![]});if(!_0x4b6d0a)throw new Error(_0x18e6('0x4a'));if(_0x4b6d0a[_0x18e6('0x4b')]===_0x18e6('0x4c')){var _0x36cc3f=_0x733826[_0x18e6('0x49')]({'plain':!![]});var _0x1ad7af='CmContactHasItems';return db[_0x18e6('0x4d')][_0x18e6('0x47')]({'where':{'name':_0x1ad7af,'userProfileId':_0x4b6d0a[_0x18e6('0x4e')]},'raw':!![]})[_0x18e6('0x25')](function(_0x3a33e7){if(_0x3a33e7&&_0x3a33e7[_0x18e6('0x4f')]===0x0){return db[_0x18e6('0x27')][_0x18e6('0x48')]({'name':_0x36cc3f[_0x18e6('0x2a')],'resourceId':_0x36cc3f['id'],'type':_0x3a33e7['name'],'sectionId':_0x3a33e7['id']},{})[_0x18e6('0x25')](function(){return _0x733826;});}else{return _0x733826;}})[_0x18e6('0x44')](function(_0x2d4f9c){logger[_0x18e6('0x28')](_0x18e6('0x50'),_0x2d4f9c);throw _0x2d4f9c;});}return _0x733826;})[_0x18e6('0x25')](respondWithResult(_0x1583ea,0xc9))[_0x18e6('0x44')](handleError(_0x1583ea,null));};exports['update']=function(_0xd4bc05,_0x4f8e28){if(_0xd4bc05[_0x18e6('0x51')]['id']){delete _0xd4bc05[_0x18e6('0x51')]['id'];}return db[_0x18e6('0x3f')][_0x18e6('0x47')]({'where':{'id':_0xd4bc05[_0x18e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f8e28,null))[_0x18e6('0x25')](saveUpdates(_0xd4bc05[_0x18e6('0x51')],null))[_0x18e6('0x25')](respondWithResult(_0x4f8e28,null))[_0x18e6('0x44')](handleError(_0x4f8e28,null));};exports[_0x18e6('0x26')]=function(_0x3f9557,_0x524037){return db[_0x18e6('0x3f')][_0x18e6('0x47')]({'where':{'id':_0x3f9557[_0x18e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x524037,null))['then'](removeEntity(_0x524037,null))['catch'](handleError(_0x524037,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 66540a3..8c56e2d 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 _0x71ab=['exports','define','CmContactHasItem','cm_contact_has_items','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x293200,_0x95f715){var _0x20864f=function(_0x165c9d){while(--_0x165c9d){_0x293200['push'](_0x293200['shift']());}};_0x20864f(++_0x95f715);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x3b06d9,_0x1be782){var _0x6d3ac8=function(_0x2f0f7e){while(--_0x2f0f7e){_0x3b06d9['push'](_0x3b06d9['shift']());}};_0x6d3ac8(++_0x1be782);}(_0x7278,0x161));var _0x8727=function(_0x306bd8,_0x145cae){_0x306bd8=_0x306bd8-0x0;var _0x47faaa=_0x7278[_0x306bd8];return _0x47faaa;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 0c5ba55..ee0b153 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 _0xbb7c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5029e4,_0x4ed85f){var _0x4187c6=function(_0x380fd7){while(--_0x380fd7){_0x5029e4['push'](_0x5029e4['shift']());}};_0x4187c6(++_0x4ed85f);}(_0xbb7c,0x17a));var _0xcbb7=function(_0x5d973f,_0x37ba33){_0x5d973f=_0x5d973f-0x0;var _0x4bff69=_0xbb7c[_0x5d973f];return _0x4bff69;};'use strict';var _=require(_0xcbb7('0x0'));var util=require(_0xcbb7('0x1'));var moment=require(_0xcbb7('0x2'));var BPromise=require(_0xcbb7('0x3'));var rs=require(_0xcbb7('0x4'));var fs=require('fs');var Redis=require(_0xcbb7('0x5'));var db=require(_0xcbb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbb7('0x7'))(_0xcbb7('0x8'));var config=require(_0xcbb7('0x9'));var jayson=require(_0xcbb7('0xa'));var client=jayson[_0xcbb7('0xb')][_0xcbb7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f359e,_0x1a9c84,_0x56f5ea){return new BPromise(function(_0x316c06,_0x255b0f){return client['request'](_0x3f359e,_0x56f5ea)['then'](function(_0xadeb65){logger[_0xcbb7('0xd')](_0xcbb7('0xe'),_0x1a9c84,_0xcbb7('0xf'));logger[_0xcbb7('0x10')](_0xcbb7('0x11'),_0x1a9c84,_0xcbb7('0xf'),JSON[_0xcbb7('0x12')](_0xadeb65));if(_0xadeb65[_0xcbb7('0x13')]){if(_0xadeb65[_0xcbb7('0x13')][_0xcbb7('0x14')]===0x1f4){logger[_0xcbb7('0x13')](_0xcbb7('0xe'),_0x1a9c84,_0xadeb65['error']['message']);return _0x255b0f(_0xadeb65[_0xcbb7('0x13')][_0xcbb7('0x15')]);}logger[_0xcbb7('0x13')](_0xcbb7('0xe'),_0x1a9c84,_0xadeb65[_0xcbb7('0x13')][_0xcbb7('0x15')]);return _0x316c06(_0xadeb65['error'][_0xcbb7('0x15')]);}else{logger[_0xcbb7('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x1a9c84,_0xcbb7('0xf'));_0x316c06(_0xadeb65[_0xcbb7('0x16')][_0xcbb7('0x15')]);}})[_0xcbb7('0x17')](function(_0x18ef80){logger[_0xcbb7('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x1a9c84,_0x18ef80);_0x255b0f(_0x18ef80);});});} \ No newline at end of file +var _0x415a=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x50798c,_0x297629){var _0x3e3066=function(_0x4067d8){while(--_0x4067d8){_0x50798c['push'](_0x50798c['shift']());}};_0x3e3066(++_0x297629);}(_0x415a,0x1df));var _0xa415=function(_0x16a25b,_0x210efd){_0x16a25b=_0x16a25b-0x0;var _0x36890a=_0x415a[_0x16a25b];return _0x36890a;};'use strict';var _=require('lodash');var util=require(_0xa415('0x0'));var moment=require(_0xa415('0x1'));var BPromise=require(_0xa415('0x2'));var rs=require(_0xa415('0x3'));var fs=require('fs');var Redis=require(_0xa415('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa415('0x5'))(_0xa415('0x6'));var config=require(_0xa415('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa415('0x8')][_0xa415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2420cc,_0x4c1ea0,_0x115405){return new BPromise(function(_0x9983c8,_0x58c3fc){return client['request'](_0x2420cc,_0x115405)[_0xa415('0xa')](function(_0xb51f2){logger[_0xa415('0xb')](_0xa415('0xc'),_0x4c1ea0,_0xa415('0xd'));logger['debug'](_0xa415('0xe'),_0x4c1ea0,_0xa415('0xd'),JSON[_0xa415('0xf')](_0xb51f2));if(_0xb51f2[_0xa415('0x10')]){if(_0xb51f2['error'][_0xa415('0x11')]===0x1f4){logger['error'](_0xa415('0xc'),_0x4c1ea0,_0xb51f2['error']['message']);return _0x58c3fc(_0xb51f2[_0xa415('0x10')][_0xa415('0x12')]);}logger[_0xa415('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4c1ea0,_0xb51f2['error'][_0xa415('0x12')]);return _0x9983c8(_0xb51f2['error'][_0xa415('0x12')]);}else{logger[_0xa415('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4c1ea0,_0xa415('0xd'));_0x9983c8(_0xb51f2['result']['message']);}})[_0xa415('0x13')](function(_0x22c054){logger[_0xa415('0x10')](_0xa415('0xc'),_0x4c1ea0,_0x22c054);_0x58c3fc(_0x22c054);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 042c91b..2727cd3 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 _0x89bc=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','/:id','update','delete','multer','util'];(function(_0x2a3990,_0xd4355c){var _0x32d362=function(_0x58bdca){while(--_0x58bdca){_0x2a3990['push'](_0x2a3990['shift']());}};_0x32d362(++_0xd4355c);}(_0x89bc,0xdf));var _0xc89b=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x89bc[_0x44c325];return _0x55f09e;};'use strict';var multer=require(_0xc89b('0x0'));var util=require(_0xc89b('0x1'));var path=require(_0xc89b('0x2'));var timeout=require(_0xc89b('0x3'));var express=require(_0xc89b('0x4'));var router=express[_0xc89b('0x5')]();var auth=require(_0xc89b('0x6'));var interaction=require(_0xc89b('0x7'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0xc89b('0x8')]('/',auth[_0xc89b('0x9')](),controller[_0xc89b('0xa')]);router[_0xc89b('0x8')]('/:id',auth[_0xc89b('0x9')](),controller['show']);router[_0xc89b('0xb')]('/',auth[_0xc89b('0x9')](),controller['create']);router['put'](_0xc89b('0xc'),auth['isAuthenticated'](),controller[_0xc89b('0xd')]);router[_0xc89b('0xe')](_0xc89b('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc8f4=['./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xc8f4,0x77));var _0x4c8f=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0xc8f4[_0x118afa];return _0x167d76;};'use strict';var multer=require(_0x4c8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4c8f('0x1'));var express=require(_0x4c8f('0x2'));var router=express[_0x4c8f('0x3')]();var auth=require(_0x4c8f('0x4'));var interaction=require(_0x4c8f('0x5'));var config=require(_0x4c8f('0x6'));var controller=require(_0x4c8f('0x7'));router['get']('/',auth[_0x4c8f('0x8')](),controller[_0x4c8f('0x9')]);router[_0x4c8f('0xa')](_0x4c8f('0xb'),auth[_0x4c8f('0x8')](),controller[_0x4c8f('0xc')]);router[_0x4c8f('0xd')]('/',auth[_0x4c8f('0x8')](),controller[_0x4c8f('0xe')]);router[_0x4c8f('0xf')](_0x4c8f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4c8f('0x10')](_0x4c8f('0xb'),auth[_0x4c8f('0x8')](),controller['destroy']);module[_0x4c8f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 1991b41..1fdee4a 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 _0x6fb5=['exports','INTEGER','STRING','sequelize'];(function(_0xd6a479,_0x1817cc){var _0x2a86d9=function(_0x617468){while(--_0x617468){_0xd6a479['push'](_0xd6a479['shift']());}};_0x2a86d9(++_0x1817cc);}(_0x6fb5,0x1d3));var _0x56fb=function(_0x39f38f,_0x172389){_0x39f38f=_0x39f38f-0x0;var _0xae1df7=_0x6fb5[_0x39f38f];return _0xae1df7;};'use strict';var Sequelize=require(_0x56fb('0x0'));module[_0x56fb('0x1')]={'CmContactId':{'type':Sequelize[_0x56fb('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x56fb('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xe325=['STRING','sequelize','INTEGER'];(function(_0x5caede,_0x438cca){var _0x259946=function(_0x38cfb9){while(--_0x38cfb9){_0x5caede['push'](_0x5caede['shift']());}};_0x259946(++_0x438cca);}(_0xe325,0xc4));var _0x5e32=function(_0x476b5f,_0x1f9952){_0x476b5f=_0x476b5f-0x0;var _0x5a23d8=_0xe325[_0x476b5f];return _0x5a23d8;};'use strict';var Sequelize=require(_0x5e32('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x5e32('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x5e32('0x2')],'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 23668af..c39fea8 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 _0x6bd5=['lodash','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','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasPhones','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','CmContactHasPhone','include','rows','catch','show','params','fields','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs'];(function(_0x4c9c9d,_0x4eaa40){var _0x58322b=function(_0xa47cbb){while(--_0xa47cbb){_0x4c9c9d['push'](_0x4c9c9d['shift']());}};_0x58322b(++_0x4eaa40);}(_0x6bd5,0x1e3));var _0x56bd=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6bd5[_0x39c734];return _0xb2a2f9;};'use strict';var pdf=require(_0x56bd('0x0'));var emlformat=require(_0x56bd('0x1'));var rimraf=require(_0x56bd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56bd('0x3'));var rp=require('request-promise');var moment=require(_0x56bd('0x4'));var BPromise=require(_0x56bd('0x5'));var Mustache=require('mustache');var util=require(_0x56bd('0x6'));var path=require('path');var sox=require(_0x56bd('0x7'));var csv=require('to-csv');var ejs=require(_0x56bd('0x8'));var fs=require('fs');var _=require(_0x56bd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x56bd('0xa'));var deskjs=require(_0x56bd('0xb'));var toCsv=require(_0x56bd('0xc'));var querystring=require(_0x56bd('0xd'));var Papa=require(_0x56bd('0xe'));var Redis=require(_0x56bd('0xf'));var authService=require(_0x56bd('0x10'));var qs=require(_0x56bd('0x11'));var as=require(_0x56bd('0x12'));var hardwareService=require(_0x56bd('0x13'));var logger=require(_0x56bd('0x14'))(_0x56bd('0x15'));var utils=require(_0x56bd('0x16'));var config=require(_0x56bd('0x17'));var licenseUtil=require(_0x56bd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12ab99,_0x3359f4){_0x3359f4=_0x3359f4||0xcc;return function(_0x192b58){if(_0x192b58){return _0x12ab99['sendStatus'](_0x3359f4);}return _0x12ab99[_0x56bd('0x19')](_0x3359f4)[_0x56bd('0x1a')]();};}function respondWithResult(_0x1aab9a,_0x4da0e4){_0x4da0e4=_0x4da0e4||0xc8;return function(_0x506093){if(_0x506093){return _0x1aab9a['status'](_0x4da0e4)['json'](_0x506093);}};}function respondWithFilteredResult(_0x539afe,_0x25377d){return function(_0x85e449){if(_0x85e449){var _0x188974=_0x85e449[_0x56bd('0x1b')],_0x5dc98b=_0x25377d[_0x56bd('0x1c')],_0x2f352a=_0x25377d['offset']+_0x25377d[_0x56bd('0x1d')],_0x245778;if(_0x2f352a>=_0x188974){_0x2f352a=_0x188974;_0x245778=0xc8;}else{_0x245778=0xce;}_0x539afe['status'](_0x245778);return _0x539afe[_0x56bd('0x1e')](_0x56bd('0x1f'),_0x5dc98b+'-'+_0x2f352a+'/'+_0x188974)['json'](_0x85e449);}return null;};}function patchUpdates(_0x1b304f){return function(_0x5b47a0){try{jsonpatch[_0x56bd('0x20')](_0x5b47a0,_0x1b304f,!![]);}catch(_0x178975){return BPromise[_0x56bd('0x21')](_0x178975);}return _0x5b47a0[_0x56bd('0x22')]();};}function saveUpdates(_0x413430,_0x3c5750){return function(_0x213549){if(_0x213549){return _0x213549[_0x56bd('0x23')](_0x413430)[_0x56bd('0x24')](function(_0x2ebbee){return _0x2ebbee;});}return null;};}function removeEntity(_0x31c5f9,_0xe75eb4){return function(_0x111d4a){if(_0x111d4a){return _0x111d4a[_0x56bd('0x25')]()['then'](function(){var _0x58f707=_0x111d4a[_0x56bd('0x26')]({'plain':!![]});var _0x4391d3=_0x56bd('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4391d3,'resourceId':_0x58f707['id']}})[_0x56bd('0x24')](function(){return _0x111d4a;});})['then'](function(){_0x31c5f9[_0x56bd('0x19')](0xcc)[_0x56bd('0x1a')]();});}};}function handleEntityNotFound(_0x5ca21b,_0x231a6c){return function(_0x5351e0){if(!_0x5351e0){_0x5ca21b[_0x56bd('0x28')](0x194);}return _0x5351e0;};}function handleError(_0x1c1f3b,_0x449d30){_0x449d30=_0x449d30||0x1f4;return function(_0x79c7ab){logger['error'](_0x79c7ab['stack']);if(_0x79c7ab[_0x56bd('0x29')]){delete _0x79c7ab[_0x56bd('0x29')];}_0x1c1f3b['status'](_0x449d30)[_0x56bd('0x2a')](_0x79c7ab);};}exports[_0x56bd('0x2b')]=function(_0x1b4c79,_0x536360){var _0x5e5e61={},_0x4064d0={},_0x4cb47f={'count':0x0,'rows':[]};var _0xceb58=_[_0x56bd('0x2c')](db['CmContactHasPhone'][_0x56bd('0x2d')],function(_0x19bd25){return{'name':_0x19bd25[_0x56bd('0x2e')],'type':_0x19bd25['type'][_0x56bd('0x2f')]};});_0x4064d0[_0x56bd('0x30')]=_[_0x56bd('0x2c')](_0xceb58,_0x56bd('0x29'));_0x4064d0[_0x56bd('0x31')]=_[_0x56bd('0x32')](_0x1b4c79['query']);_0x4064d0[_0x56bd('0x33')]=_[_0x56bd('0x34')](_0x4064d0['model'],_0x4064d0['query']);_0x5e5e61['attributes']=_[_0x56bd('0x34')](_0x4064d0[_0x56bd('0x30')],qs['fields'](_0x1b4c79[_0x56bd('0x31')]['fields']));_0x5e5e61[_0x56bd('0x35')]=_0x5e5e61[_0x56bd('0x35')][_0x56bd('0x36')]?_0x5e5e61[_0x56bd('0x35')]:_0x4064d0['model'];if(!_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x37')](_0x56bd('0x38'))){_0x5e5e61[_0x56bd('0x1d')]=qs['limit'](_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x1d')]);_0x5e5e61[_0x56bd('0x1c')]=qs[_0x56bd('0x1c')](_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x1c')]);}_0x5e5e61['order']=qs[_0x56bd('0x39')](_0x1b4c79['query'][_0x56bd('0x39')]);_0x5e5e61[_0x56bd('0x3a')]=qs[_0x56bd('0x33')](_['pick'](_0x1b4c79['query'],_0x4064d0['filters']),_0xceb58);if(_0x1b4c79[_0x56bd('0x31')][_0x56bd('0x3b')]){_0x5e5e61[_0x56bd('0x3a')]=_['merge'](_0x5e5e61[_0x56bd('0x3a')],{'$or':_[_0x56bd('0x2c')](_0xceb58,function(_0x2799e4){if(_0x2799e4[_0x56bd('0x3c')]!==_0x56bd('0x3d')){var _0x8ac68d={};_0x8ac68d[_0x2799e4[_0x56bd('0x29')]]={'$like':'%'+_0x1b4c79[_0x56bd('0x31')]['filter']+'%'};return _0x8ac68d;}})});}_0x5e5e61=_[_0x56bd('0x3e')]({},_0x5e5e61,_0x1b4c79[_0x56bd('0x3f')]);var _0xaa5805={'where':_0x5e5e61[_0x56bd('0x3a')]};return db[_0x56bd('0x40')][_0x56bd('0x1b')](_0xaa5805)['then'](function(_0x13ea9a){_0x4cb47f[_0x56bd('0x1b')]=_0x13ea9a;if(_0x1b4c79['query']['includeAll']){_0x5e5e61[_0x56bd('0x41')]=[{'all':!![]}];}return db[_0x56bd('0x40')]['findAll'](_0x5e5e61);})[_0x56bd('0x24')](function(_0x408dd2){_0x4cb47f[_0x56bd('0x42')]=_0x408dd2;return _0x4cb47f;})['then'](respondWithFilteredResult(_0x536360,_0x5e5e61))[_0x56bd('0x43')](handleError(_0x536360,null));};exports[_0x56bd('0x44')]=function(_0x3ecd8a,_0x329c1b){var _0x335bb3={'raw':!![],'where':{'id':_0x3ecd8a[_0x56bd('0x45')]['id']}},_0x8e5edb={};_0x8e5edb[_0x56bd('0x30')]=_[_0x56bd('0x32')](db['CmContactHasPhone'][_0x56bd('0x2d')]);_0x8e5edb[_0x56bd('0x31')]=_[_0x56bd('0x32')](_0x3ecd8a[_0x56bd('0x31')]);_0x8e5edb[_0x56bd('0x33')]=_[_0x56bd('0x34')](_0x8e5edb[_0x56bd('0x30')],_0x8e5edb['query']);_0x335bb3[_0x56bd('0x35')]=_[_0x56bd('0x34')](_0x8e5edb['model'],qs[_0x56bd('0x46')](_0x3ecd8a['query'][_0x56bd('0x46')]));_0x335bb3[_0x56bd('0x35')]=_0x335bb3['attributes'][_0x56bd('0x36')]?_0x335bb3[_0x56bd('0x35')]:_0x8e5edb['model'];if(_0x3ecd8a['query'][_0x56bd('0x47')]){_0x335bb3[_0x56bd('0x41')]=[{'all':!![]}];}_0x335bb3=_['merge']({},_0x335bb3,_0x3ecd8a[_0x56bd('0x3f')]);return db[_0x56bd('0x40')]['find'](_0x335bb3)[_0x56bd('0x24')](handleEntityNotFound(_0x329c1b,null))[_0x56bd('0x24')](respondWithResult(_0x329c1b,null))[_0x56bd('0x43')](handleError(_0x329c1b,null));};exports[_0x56bd('0x48')]=function(_0x5c9d4c,_0x4d3ef6){return db[_0x56bd('0x40')]['create'](_0x5c9d4c[_0x56bd('0x49')],{})[_0x56bd('0x24')](function(_0x37bdf2){var _0x224d42=_0x5c9d4c[_0x56bd('0x4a')][_0x56bd('0x26')]({'plain':!![]});if(!_0x224d42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x224d42[_0x56bd('0x4b')]==='user'){var _0x199816=_0x37bdf2[_0x56bd('0x26')]({'plain':!![]});var _0x349c0b=_0x56bd('0x27');return db[_0x56bd('0x4c')][_0x56bd('0x4d')]({'where':{'name':_0x349c0b,'userProfileId':_0x224d42[_0x56bd('0x4e')]},'raw':!![]})[_0x56bd('0x24')](function(_0x35b468){if(_0x35b468&&_0x35b468['autoAssociation']===0x0){return db[_0x56bd('0x4f')][_0x56bd('0x48')]({'name':_0x199816[_0x56bd('0x29')],'resourceId':_0x199816['id'],'type':_0x35b468[_0x56bd('0x29')],'sectionId':_0x35b468['id']},{})[_0x56bd('0x24')](function(){return _0x37bdf2;});}else{return _0x37bdf2;}})[_0x56bd('0x43')](function(_0x302cfe){logger[_0x56bd('0x50')](_0x56bd('0x51'),_0x302cfe);throw _0x302cfe;});}return _0x37bdf2;})[_0x56bd('0x24')](respondWithResult(_0x4d3ef6,0xc9))['catch'](handleError(_0x4d3ef6,null));};exports[_0x56bd('0x23')]=function(_0x50cfb6,_0xacbf57){if(_0x50cfb6[_0x56bd('0x49')]['id']){delete _0x50cfb6[_0x56bd('0x49')]['id'];}return db[_0x56bd('0x40')][_0x56bd('0x4d')]({'where':{'id':_0x50cfb6[_0x56bd('0x45')]['id']}})[_0x56bd('0x24')](handleEntityNotFound(_0xacbf57,null))[_0x56bd('0x24')](saveUpdates(_0x50cfb6[_0x56bd('0x49')],null))['then'](respondWithResult(_0xacbf57,null))['catch'](handleError(_0xacbf57,null));};exports['destroy']=function(_0x4f76ba,_0x5e3475){return db[_0x56bd('0x40')][_0x56bd('0x4d')]({'where':{'id':_0x4f76ba[_0x56bd('0x45')]['id']}})[_0x56bd('0x24')](handleEntityNotFound(_0x5e3475,null))[_0x56bd('0x24')](removeEntity(_0x5e3475,null))[_0x56bd('0x43')](handleError(_0x5e3475,null));}; \ No newline at end of file +var _0xfacb=['limit','status','set','apply','reject','save','update','destroy','then','get','CmContactHasPhones','sendStatus','error','CmContactHasPhone','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','params','includeAll','include','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','end','json','offset'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xfacb,0x17f));var _0xbfac=function(_0x4c5d74,_0x10d7f1){_0x4c5d74=_0x4c5d74-0x0;var _0x3609cd=_0xfacb[_0x4c5d74];return _0x3609cd;};'use strict';var pdf=require(_0xbfac('0x0'));var emlformat=require(_0xbfac('0x1'));var rimraf=require(_0xbfac('0x2'));var zipdir=require(_0xbfac('0x3'));var jsonpatch=require(_0xbfac('0x4'));var rp=require(_0xbfac('0x5'));var moment=require(_0xbfac('0x6'));var BPromise=require(_0xbfac('0x7'));var Mustache=require(_0xbfac('0x8'));var util=require('util');var path=require(_0xbfac('0x9'));var sox=require(_0xbfac('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbfac('0xb'));var squel=require(_0xbfac('0xc'));var crypto=require(_0xbfac('0xd'));var jsforce=require(_0xbfac('0xe'));var deskjs=require(_0xbfac('0xf'));var toCsv=require(_0xbfac('0x10'));var querystring=require('querystring');var Papa=require(_0xbfac('0x11'));var Redis=require(_0xbfac('0x12'));var authService=require(_0xbfac('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbfac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfac('0x15'))('api');var utils=require(_0xbfac('0x16'));var config=require(_0xbfac('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b364c,_0x55581a){_0x55581a=_0x55581a||0xcc;return function(_0x33b30b){if(_0x33b30b){return _0x2b364c['sendStatus'](_0x55581a);}return _0x2b364c['status'](_0x55581a)[_0xbfac('0x18')]();};}function respondWithResult(_0x46a113,_0x496357){_0x496357=_0x496357||0xc8;return function(_0x4faebb){if(_0x4faebb){return _0x46a113['status'](_0x496357)[_0xbfac('0x19')](_0x4faebb);}};}function respondWithFilteredResult(_0xa13d0b,_0x18295e){return function(_0x147e1){if(_0x147e1){var _0x3b1b61=_0x147e1['count'],_0x138014=_0x18295e['offset'],_0x1cc6a4=_0x18295e[_0xbfac('0x1a')]+_0x18295e[_0xbfac('0x1b')],_0x39753b;if(_0x1cc6a4>=_0x3b1b61){_0x1cc6a4=_0x3b1b61;_0x39753b=0xc8;}else{_0x39753b=0xce;}_0xa13d0b[_0xbfac('0x1c')](_0x39753b);return _0xa13d0b[_0xbfac('0x1d')]('Content-Range',_0x138014+'-'+_0x1cc6a4+'/'+_0x3b1b61)[_0xbfac('0x19')](_0x147e1);}return null;};}function patchUpdates(_0xa4dfdb){return function(_0x53d691){try{jsonpatch[_0xbfac('0x1e')](_0x53d691,_0xa4dfdb,!![]);}catch(_0x5ac16f){return BPromise[_0xbfac('0x1f')](_0x5ac16f);}return _0x53d691[_0xbfac('0x20')]();};}function saveUpdates(_0x3f7556,_0x49918a){return function(_0x79f1df){if(_0x79f1df){return _0x79f1df[_0xbfac('0x21')](_0x3f7556)['then'](function(_0x5137cb){return _0x5137cb;});}return null;};}function removeEntity(_0x37de25,_0x32b2f7){return function(_0x1a13a8){if(_0x1a13a8){return _0x1a13a8[_0xbfac('0x22')]()[_0xbfac('0x23')](function(){var _0x247fb3=_0x1a13a8[_0xbfac('0x24')]({'plain':!![]});var _0x2316d5=_0xbfac('0x25');return db['UserProfileResource'][_0xbfac('0x22')]({'where':{'type':_0x2316d5,'resourceId':_0x247fb3['id']}})['then'](function(){return _0x1a13a8;});})[_0xbfac('0x23')](function(){_0x37de25[_0xbfac('0x1c')](0xcc)[_0xbfac('0x18')]();});}};}function handleEntityNotFound(_0x3eca1e,_0x168a88){return function(_0x429ad1){if(!_0x429ad1){_0x3eca1e[_0xbfac('0x26')](0x194);}return _0x429ad1;};}function handleError(_0x5b4499,_0xcd55b7){_0xcd55b7=_0xcd55b7||0x1f4;return function(_0x6fcfff){logger[_0xbfac('0x27')](_0x6fcfff['stack']);if(_0x6fcfff['name']){delete _0x6fcfff['name'];}_0x5b4499['status'](_0xcd55b7)['send'](_0x6fcfff);};}exports['index']=function(_0x18f89f,_0x3e3cd2){var _0x531711={},_0x5ce93f={},_0x25d570={'count':0x0,'rows':[]};var _0x384ad5=_['map'](db[_0xbfac('0x28')][_0xbfac('0x29')],function(_0x32369d){return{'name':_0x32369d[_0xbfac('0x2a')],'type':_0x32369d[_0xbfac('0x2b')][_0xbfac('0x2c')]};});_0x5ce93f[_0xbfac('0x2d')]=_[_0xbfac('0x2e')](_0x384ad5,_0xbfac('0x2f'));_0x5ce93f[_0xbfac('0x30')]=_[_0xbfac('0x31')](_0x18f89f['query']);_0x5ce93f['filters']=_[_0xbfac('0x32')](_0x5ce93f[_0xbfac('0x2d')],_0x5ce93f[_0xbfac('0x30')]);_0x531711['attributes']=_[_0xbfac('0x32')](_0x5ce93f[_0xbfac('0x2d')],qs[_0xbfac('0x33')](_0x18f89f[_0xbfac('0x30')][_0xbfac('0x33')]));_0x531711['attributes']=_0x531711['attributes'][_0xbfac('0x34')]?_0x531711[_0xbfac('0x35')]:_0x5ce93f['model'];if(!_0x18f89f['query'][_0xbfac('0x36')](_0xbfac('0x37'))){_0x531711['limit']=qs[_0xbfac('0x1b')](_0x18f89f['query'][_0xbfac('0x1b')]);_0x531711[_0xbfac('0x1a')]=qs[_0xbfac('0x1a')](_0x18f89f[_0xbfac('0x30')]['offset']);}_0x531711[_0xbfac('0x38')]=qs[_0xbfac('0x39')](_0x18f89f[_0xbfac('0x30')][_0xbfac('0x39')]);_0x531711[_0xbfac('0x3a')]=qs[_0xbfac('0x3b')](_[_0xbfac('0x3c')](_0x18f89f['query'],_0x5ce93f[_0xbfac('0x3b')]),_0x384ad5);if(_0x18f89f[_0xbfac('0x30')][_0xbfac('0x3d')]){_0x531711['where']=_[_0xbfac('0x3e')](_0x531711[_0xbfac('0x3a')],{'$or':_[_0xbfac('0x2e')](_0x384ad5,function(_0x227c6f){if(_0x227c6f['type']!==_0xbfac('0x3f')){var _0x19cec5={};_0x19cec5[_0x227c6f[_0xbfac('0x2f')]]={'$like':'%'+_0x18f89f[_0xbfac('0x30')]['filter']+'%'};return _0x19cec5;}})});}_0x531711=_[_0xbfac('0x3e')]({},_0x531711,_0x18f89f[_0xbfac('0x40')]);var _0x3c5c4f={'where':_0x531711[_0xbfac('0x3a')]};return db[_0xbfac('0x28')][_0xbfac('0x41')](_0x3c5c4f)[_0xbfac('0x23')](function(_0xc3f6d3){_0x25d570[_0xbfac('0x41')]=_0xc3f6d3;if(_0x18f89f[_0xbfac('0x30')]['includeAll']){_0x531711['include']=[{'all':!![]}];}return db[_0xbfac('0x28')][_0xbfac('0x42')](_0x531711);})[_0xbfac('0x23')](function(_0x2d45ae){_0x25d570[_0xbfac('0x43')]=_0x2d45ae;return _0x25d570;})[_0xbfac('0x23')](respondWithFilteredResult(_0x3e3cd2,_0x531711))[_0xbfac('0x44')](handleError(_0x3e3cd2,null));};exports['show']=function(_0x4fc959,_0x49296a){var _0x105c10={'raw':!![],'where':{'id':_0x4fc959[_0xbfac('0x45')]['id']}},_0x16db94={};_0x16db94[_0xbfac('0x2d')]=_[_0xbfac('0x31')](db['CmContactHasPhone'][_0xbfac('0x29')]);_0x16db94[_0xbfac('0x30')]=_['keys'](_0x4fc959[_0xbfac('0x30')]);_0x16db94['filters']=_['intersection'](_0x16db94[_0xbfac('0x2d')],_0x16db94[_0xbfac('0x30')]);_0x105c10[_0xbfac('0x35')]=_[_0xbfac('0x32')](_0x16db94[_0xbfac('0x2d')],qs[_0xbfac('0x33')](_0x4fc959[_0xbfac('0x30')]['fields']));_0x105c10['attributes']=_0x105c10[_0xbfac('0x35')]['length']?_0x105c10[_0xbfac('0x35')]:_0x16db94['model'];if(_0x4fc959[_0xbfac('0x30')][_0xbfac('0x46')]){_0x105c10[_0xbfac('0x47')]=[{'all':!![]}];}_0x105c10=_['merge']({},_0x105c10,_0x4fc959['options']);return db[_0xbfac('0x28')][_0xbfac('0x48')](_0x105c10)[_0xbfac('0x23')](handleEntityNotFound(_0x49296a,null))['then'](respondWithResult(_0x49296a,null))[_0xbfac('0x44')](handleError(_0x49296a,null));};exports[_0xbfac('0x49')]=function(_0x5f2db6,_0x1ebd0e){return db[_0xbfac('0x28')]['create'](_0x5f2db6['body'],{})[_0xbfac('0x23')](function(_0x687753){var _0x41cb2e=_0x5f2db6[_0xbfac('0x4a')][_0xbfac('0x24')]({'plain':!![]});if(!_0x41cb2e)throw new Error(_0xbfac('0x4b'));if(_0x41cb2e[_0xbfac('0x4c')]===_0xbfac('0x4a')){var _0x297e40=_0x687753['get']({'plain':!![]});var _0x337469=_0xbfac('0x25');return db[_0xbfac('0x4d')][_0xbfac('0x48')]({'where':{'name':_0x337469,'userProfileId':_0x41cb2e[_0xbfac('0x4e')]},'raw':!![]})[_0xbfac('0x23')](function(_0xeaa4e4){if(_0xeaa4e4&&_0xeaa4e4[_0xbfac('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x297e40[_0xbfac('0x2f')],'resourceId':_0x297e40['id'],'type':_0xeaa4e4[_0xbfac('0x2f')],'sectionId':_0xeaa4e4['id']},{})['then'](function(){return _0x687753;});}else{return _0x687753;}})['catch'](function(_0x510dd4){logger[_0xbfac('0x27')](_0xbfac('0x50'),_0x510dd4);throw _0x510dd4;});}return _0x687753;})[_0xbfac('0x23')](respondWithResult(_0x1ebd0e,0xc9))[_0xbfac('0x44')](handleError(_0x1ebd0e,null));};exports[_0xbfac('0x21')]=function(_0x3b29fc,_0x39a690){if(_0x3b29fc['body']['id']){delete _0x3b29fc[_0xbfac('0x51')]['id'];}return db[_0xbfac('0x28')][_0xbfac('0x48')]({'where':{'id':_0x3b29fc[_0xbfac('0x45')]['id']}})[_0xbfac('0x23')](handleEntityNotFound(_0x39a690,null))['then'](saveUpdates(_0x3b29fc[_0xbfac('0x51')],null))[_0xbfac('0x23')](respondWithResult(_0x39a690,null))[_0xbfac('0x44')](handleError(_0x39a690,null));};exports[_0xbfac('0x22')]=function(_0x4cbe42,_0x3ebf9f){return db[_0xbfac('0x28')][_0xbfac('0x48')]({'where':{'id':_0x4cbe42[_0xbfac('0x45')]['id']}})[_0xbfac('0x23')](handleEntityNotFound(_0x3ebf9f,null))[_0xbfac('0x23')](removeEntity(_0x3ebf9f,null))[_0xbfac('0x44')](handleError(_0x3ebf9f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index c423e50..6659948 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 _0x2b1e=['path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','api','moment','request-promise'];(function(_0x5e9f6a,_0x2b7d54){var _0xc7246a=function(_0x256d27){while(--_0x256d27){_0x5e9f6a['push'](_0x5e9f6a['shift']());}};_0xc7246a(++_0x2b7d54);}(_0x2b1e,0x19b));var _0xe2b1=function(_0x318dce,_0x166f0f){_0x318dce=_0x318dce-0x0;var _0x1d98f7=_0x2b1e[_0x318dce];return _0x1d98f7;};'use strict';var _=require(_0xe2b1('0x0'));var util=require(_0xe2b1('0x1'));var logger=require('../../config/logger')(_0xe2b1('0x2'));var moment=require(_0xe2b1('0x3'));var BPromise=require('bluebird');var rp=require(_0xe2b1('0x4'));var fs=require('fs');var path=require(_0xe2b1('0x5'));var rimraf=require(_0xe2b1('0x6'));var config=require(_0xe2b1('0x7'));var attributes=require(_0xe2b1('0x8'));module[_0xe2b1('0x9')]=function(_0x518e2a,_0x5b11bc){return _0x518e2a[_0xe2b1('0xa')](_0xe2b1('0xb'),attributes,{'tableName':_0xe2b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64b3=['../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','cm_contact_has_phones','lodash','api','moment','bluebird','path','rimraf'];(function(_0x220322,_0x5e7888){var _0xb45500=function(_0x304b81){while(--_0x304b81){_0x220322['push'](_0x220322['shift']());}};_0xb45500(++_0x5e7888);}(_0x64b3,0x1de));var _0x364b=function(_0x1aca3,_0x55a012){_0x1aca3=_0x1aca3-0x0;var _0x42d55f=_0x64b3[_0x1aca3];return _0x42d55f;};'use strict';var _=require(_0x364b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x364b('0x1'));var moment=require(_0x364b('0x2'));var BPromise=require(_0x364b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x364b('0x4'));var rimraf=require(_0x364b('0x5'));var config=require(_0x364b('0x6'));var attributes=require(_0x364b('0x7'));module[_0x364b('0x8')]=function(_0x42092d,_0x53ae27){return _0x42092d['define'](_0x364b('0x9'),attributes,{'tableName':_0x364b('0xa'),'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 03db564..bdc837a 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 _0xb201=['stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb201,0x117));var _0x1b20=function(_0x77e35c,_0x4ce416){_0x77e35c=_0x77e35c-0x0;var _0x58b3ca=_0xb201[_0x77e35c];return _0x58b3ca;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var moment=require(_0x1b20('0x1'));var BPromise=require(_0x1b20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b20('0x3'));var db=require(_0x1b20('0x4'))['db'];var utils=require(_0x1b20('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b20('0x6'));var jayson=require(_0x1b20('0x7'));var client=jayson['client'][_0x1b20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a1b64,_0x44ce5f,_0x158a41){return new BPromise(function(_0x3f0519,_0x35eaa5){return client[_0x1b20('0x9')](_0x4a1b64,_0x158a41)['then'](function(_0x389092){logger[_0x1b20('0xa')](_0x1b20('0xb'),_0x44ce5f,_0x1b20('0xc'));logger[_0x1b20('0xd')](_0x1b20('0xe'),_0x44ce5f,_0x1b20('0xc'),JSON[_0x1b20('0xf')](_0x389092));if(_0x389092['error']){if(_0x389092['error'][_0x1b20('0x10')]===0x1f4){logger[_0x1b20('0x11')](_0x1b20('0xb'),_0x44ce5f,_0x389092['error'][_0x1b20('0x12')]);return _0x35eaa5(_0x389092['error'][_0x1b20('0x12')]);}logger[_0x1b20('0x11')](_0x1b20('0xb'),_0x44ce5f,_0x389092['error'][_0x1b20('0x12')]);return _0x3f0519(_0x389092[_0x1b20('0x11')]['message']);}else{logger['info'](_0x1b20('0xb'),_0x44ce5f,_0x1b20('0xc'));_0x3f0519(_0x389092[_0x1b20('0x13')]['message']);}})[_0x1b20('0x14')](function(_0x2be1ed){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x44ce5f,_0x2be1ed);_0x35eaa5(_0x2be1ed);});});} \ No newline at end of file +var _0x4c9d=['../../config/environment','jayson/promise','client','request','info','CmContactHasPhone,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f43d1,_0xf9c6e2){var _0x2454fc=function(_0x34dbbe){while(--_0x34dbbe){_0x4f43d1['push'](_0x4f43d1['shift']());}};_0x2454fc(++_0xf9c6e2);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4c9d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd4c9('0x0'));var util=require(_0xd4c9('0x1'));var moment=require(_0xd4c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4c9('0x3'));var fs=require('fs');var Redis=require(_0xd4c9('0x4'));var db=require(_0xd4c9('0x5'))['db'];var utils=require(_0xd4c9('0x6'));var logger=require(_0xd4c9('0x7'))(_0xd4c9('0x8'));var config=require(_0xd4c9('0x9'));var jayson=require(_0xd4c9('0xa'));var client=jayson[_0xd4c9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b511,_0x13c314,_0x37b94e){return new BPromise(function(_0x3f9d50,_0x8ecc5a){return client[_0xd4c9('0xc')](_0x48b511,_0x37b94e)['then'](function(_0x18419f){logger[_0xd4c9('0xd')](_0xd4c9('0xe'),_0x13c314,'request\x20sent');logger['debug']('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x13c314,'request\x20sent',JSON['stringify'](_0x18419f));if(_0x18419f[_0xd4c9('0xf')]){if(_0x18419f['error'][_0xd4c9('0x10')]===0x1f4){logger[_0xd4c9('0xf')](_0xd4c9('0xe'),_0x13c314,_0x18419f['error'][_0xd4c9('0x11')]);return _0x8ecc5a(_0x18419f[_0xd4c9('0xf')][_0xd4c9('0x11')]);}logger[_0xd4c9('0xf')](_0xd4c9('0xe'),_0x13c314,_0x18419f[_0xd4c9('0xf')][_0xd4c9('0x11')]);return _0x3f9d50(_0x18419f[_0xd4c9('0xf')][_0xd4c9('0x11')]);}else{logger[_0xd4c9('0xd')](_0xd4c9('0xe'),_0x13c314,'request\x20sent');_0x3f9d50(_0x18419f[_0xd4c9('0x12')][_0xd4c9('0x11')]);}})['catch'](function(_0x5cec88){logger[_0xd4c9('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x13c314,_0x5cec88);_0x8ecc5a(_0x5cec88);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 5693b40..a23b83a 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 _0xbea0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','isAuthenticated','show','post','/:id','update','delete','destroy','exports','util','path'];(function(_0x4be8c8,_0x4be2f6){var _0x42c7e9=function(_0x488b71){while(--_0x488b71){_0x4be8c8['push'](_0x4be8c8['shift']());}};_0x42c7e9(++_0x4be2f6);}(_0xbea0,0xa9));var _0x0bea=function(_0x528be9,_0xea36cd){_0x528be9=_0x528be9-0x0;var _0x209b83=_0xbea0[_0x528be9];return _0x209b83;};'use strict';var multer=require('multer');var util=require(_0x0bea('0x0'));var path=require(_0x0bea('0x1'));var timeout=require(_0x0bea('0x2'));var express=require(_0x0bea('0x3'));var router=express[_0x0bea('0x4')]();var auth=require(_0x0bea('0x5'));var interaction=require(_0x0bea('0x6'));var config=require(_0x0bea('0x7'));var controller=require(_0x0bea('0x8'));router[_0x0bea('0x9')]('/',auth['isAuthenticated'](),controller[_0x0bea('0xa')]);router[_0x0bea('0x9')]('/:id',auth[_0x0bea('0xb')](),controller[_0x0bea('0xc')]);router[_0x0bea('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0bea('0xe'),auth['isAuthenticated'](),controller[_0x0bea('0xf')]);router[_0x0bea('0x10')](_0x0bea('0xe'),auth['isAuthenticated'](),controller[_0x0bea('0x11')]);module[_0x0bea('0x12')]=router; \ No newline at end of file +var _0xfe30=['put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','/:id','post','create'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0xfe30,0xc9));var _0x0fe3=function(_0x124728,_0x463dca){_0x124728=_0x124728-0x0;var _0x8eb20f=_0xfe30[_0x124728];return _0x8eb20f;};'use strict';var multer=require(_0x0fe3('0x0'));var util=require(_0x0fe3('0x1'));var path=require(_0x0fe3('0x2'));var timeout=require(_0x0fe3('0x3'));var express=require(_0x0fe3('0x4'));var router=express[_0x0fe3('0x5')]();var auth=require(_0x0fe3('0x6'));var interaction=require(_0x0fe3('0x7'));var config=require(_0x0fe3('0x8'));var controller=require(_0x0fe3('0x9'));router[_0x0fe3('0xa')]('/',auth[_0x0fe3('0xb')](),controller['index']);router[_0x0fe3('0xa')](_0x0fe3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0fe3('0xd')]('/',auth[_0x0fe3('0xb')](),controller[_0x0fe3('0xe')]);router[_0x0fe3('0xf')](_0x0fe3('0xc'),auth[_0x0fe3('0xb')](),controller['update']);router[_0x0fe3('0x10')](_0x0fe3('0xc'),auth[_0x0fe3('0xb')](),controller['destroy']);module[_0x0fe3('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5874e49..2c20a5a 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 _0xde50=['TEXT','long','type','values','isArray','stringify','ENUM','voice','exports','VIRTUAL','getDataValue','STRING','setDataValue'];(function(_0x58f66d,_0x440726){var _0x1a2303=function(_0x4c9e32){while(--_0x4c9e32){_0x58f66d['push'](_0x58f66d['shift']());}};_0x1a2303(++_0x440726);}(_0xde50,0x140));var _0x0de5=function(_0x36acb6,_0x572bf7){_0x36acb6=_0x36acb6-0x0;var _0x3b5cef=_0xde50[_0x36acb6];return _0x3b5cef;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x0de5('0x0')]={'name':{'type':Sequelize[_0x0de5('0x1')],'get':function(_0x13190a){return this[_0x0de5('0x2')]('alias');}},'alias':{'type':Sequelize[_0x0de5('0x3')],'allowNull':![],'set':function(_0x5c22bc){this[_0x0de5('0x4')]('alias',_0x5c22bc?_0x5c22bc:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x0de5('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x0de5('0x5')](_0x0de5('0x6')),'get':function(){if(this['getDataValue'](_0x0de5('0x7'))==='select'){return JSON['parse'](this['getDataValue'](_0x0de5('0x8')));}else{return this[_0x0de5('0x2')](_0x0de5('0x8'));}},'set':function(_0x5a165a){if(Array[_0x0de5('0x9')](_0x5a165a)){this[_0x0de5('0x4')]('values',JSON[_0x0de5('0xa')](_0x5a165a));}else{this[_0x0de5('0x4')](_0x0de5('0x8'),_0x5a165a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0de5('0xb')](_0x0de5('0xc'))}}; \ No newline at end of file +var _0x3148=['stringify','BOOLEAN','ENUM','sequelize','lodash','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','select','parse','values','isArray'];(function(_0x2cd8d0,_0x5ddefb){var _0x49a221=function(_0x6abeb2){while(--_0x6abeb2){_0x2cd8d0['push'](_0x2cd8d0['shift']());}};_0x49a221(++_0x5ddefb);}(_0x3148,0x1d3));var _0x8314=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0x3148[_0x5b7963];return _0x57f611;};'use strict';var Sequelize=require(_0x8314('0x0'));var _=require(_0x8314('0x1'));module['exports']={'name':{'type':Sequelize[_0x8314('0x2')],'get':function(_0xf80bf9){return this[_0x8314('0x3')](_0x8314('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x35ee55){this[_0x8314('0x5')](_0x8314('0x4'),_0x35ee55?_0x35ee55:this[_0x8314('0x3')](_0x8314('0x6')));}},'type':{'type':Sequelize[_0x8314('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x8314('0x8')]('long'),'get':function(){if(this[_0x8314('0x3')]('type')===_0x8314('0x9')){return JSON[_0x8314('0xa')](this[_0x8314('0x3')](_0x8314('0xb')));}else{return this[_0x8314('0x3')]('values');}},'set':function(_0x5b5459){if(Array[_0x8314('0xc')](_0x5b5459)){this[_0x8314('0x5')](_0x8314('0xb'),JSON[_0x8314('0xd')](_0x5b5459));}else{this['setDataValue'](_0x8314('0xb'),_0x5b5459);}}},'required':{'type':Sequelize[_0x8314('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8314('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8664503..85eafd8 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 _0x53ba=['reject','update','then','destroy','sendStatus','error','stack','name','index','map','CmCustomField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','body','find','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x53ba,0x18a));var _0xa53b=function(_0x33a430,_0x2dfe3b){_0x33a430=_0x33a430-0x0;var _0x269cee=_0x53ba[_0x33a430];return _0x269cee;};'use strict';var pdf=require(_0xa53b('0x0'));var emlformat=require(_0xa53b('0x1'));var rimraf=require(_0xa53b('0x2'));var zipdir=require(_0xa53b('0x3'));var jsonpatch=require(_0xa53b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa53b('0x5'));var Mustache=require(_0xa53b('0x6'));var util=require(_0xa53b('0x7'));var path=require(_0xa53b('0x8'));var sox=require(_0xa53b('0x9'));var csv=require(_0xa53b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa53b('0xb'));var squel=require(_0xa53b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa53b('0xd'));var deskjs=require(_0xa53b('0xe'));var toCsv=require(_0xa53b('0xa'));var querystring=require('querystring');var Papa=require(_0xa53b('0xf'));var Redis=require(_0xa53b('0x10'));var authService=require(_0xa53b('0x11'));var qs=require(_0xa53b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa53b('0x13'));var logger=require(_0xa53b('0x14'))(_0xa53b('0x15'));var utils=require(_0xa53b('0x16'));var config=require(_0xa53b('0x17'));var licenseUtil=require(_0xa53b('0x18'));var db=require(_0xa53b('0x19'))['db'];function respondWithStatusCode(_0x5c72d2,_0x3aac02){_0x3aac02=_0x3aac02||0xcc;return function(_0x1c3d33){if(_0x1c3d33){return _0x5c72d2['sendStatus'](_0x3aac02);}return _0x5c72d2[_0xa53b('0x1a')](_0x3aac02)['end']();};}function respondWithResult(_0x1445ed,_0x4851b2){_0x4851b2=_0x4851b2||0xc8;return function(_0x8e2b3b){if(_0x8e2b3b){return _0x1445ed['status'](_0x4851b2)[_0xa53b('0x1b')](_0x8e2b3b);}};}function respondWithFilteredResult(_0x17de05,_0x24fa3d){return function(_0x520f70){if(_0x520f70){var _0x2d6b6f=_0x520f70['count'],_0x2ba991=_0x24fa3d[_0xa53b('0x1c')],_0x4e008c=_0x24fa3d[_0xa53b('0x1c')]+_0x24fa3d[_0xa53b('0x1d')],_0x36a5a4;if(_0x4e008c>=_0x2d6b6f){_0x4e008c=_0x2d6b6f;_0x36a5a4=0xc8;}else{_0x36a5a4=0xce;}_0x17de05[_0xa53b('0x1a')](_0x36a5a4);return _0x17de05[_0xa53b('0x1e')]('Content-Range',_0x2ba991+'-'+_0x4e008c+'/'+_0x2d6b6f)['json'](_0x520f70);}return null;};}function patchUpdates(_0x1d2643){return function(_0xcbd883){try{jsonpatch['apply'](_0xcbd883,_0x1d2643,!![]);}catch(_0x3d18d8){return BPromise[_0xa53b('0x1f')](_0x3d18d8);}return _0xcbd883['save']();};}function saveUpdates(_0x3d8f6c,_0x3c2c9f){return function(_0x515a3e){if(_0x515a3e){return _0x515a3e[_0xa53b('0x20')](_0x3d8f6c)[_0xa53b('0x21')](function(_0x190665){return _0x190665;});}return null;};}function removeEntity(_0x5cd5d7,_0x268d50){return function(_0x252bef){if(_0x252bef){return _0x252bef[_0xa53b('0x22')]()[_0xa53b('0x21')](function(){_0x5cd5d7[_0xa53b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3007,_0x1dbe41){return function(_0x433c61){if(!_0x433c61){_0x4b3007[_0xa53b('0x23')](0x194);}return _0x433c61;};}function handleError(_0x1047ac,_0x555b1e){_0x555b1e=_0x555b1e||0x1f4;return function(_0x1c91bb){logger[_0xa53b('0x24')](_0x1c91bb[_0xa53b('0x25')]);if(_0x1c91bb[_0xa53b('0x26')]){delete _0x1c91bb[_0xa53b('0x26')];}_0x1047ac[_0xa53b('0x1a')](_0x555b1e)['send'](_0x1c91bb);};}exports[_0xa53b('0x27')]=function(_0x427b61,_0x1207bb){var _0x511698={},_0x1d0aa6={},_0x593e3d={'count':0x0,'rows':[]};var _0x2db367=_[_0xa53b('0x28')](db[_0xa53b('0x29')][_0xa53b('0x2a')],function(_0xb5b15e){return{'name':_0xb5b15e['fieldName'],'type':_0xb5b15e[_0xa53b('0x2b')][_0xa53b('0x2c')]};});_0x1d0aa6[_0xa53b('0x2d')]=_['differenceBy'](_[_0xa53b('0x28')](_0x2db367,'name'),['name']);_0x1d0aa6['query']=_[_0xa53b('0x2e')](_0x427b61[_0xa53b('0x2f')]);_0x1d0aa6[_0xa53b('0x30')]=_[_0xa53b('0x31')](_0x1d0aa6[_0xa53b('0x2d')],_0x1d0aa6[_0xa53b('0x2f')]);_0x511698[_0xa53b('0x32')]=_[_0xa53b('0x31')](_0x1d0aa6['model'],qs[_0xa53b('0x33')](_0x427b61[_0xa53b('0x2f')][_0xa53b('0x33')]));_0x511698[_0xa53b('0x32')]=_0x511698['attributes']['length']?_0x511698[_0xa53b('0x32')]:_0x1d0aa6[_0xa53b('0x2d')];if(!_0x427b61[_0xa53b('0x2f')]['hasOwnProperty']('nolimit')){_0x511698[_0xa53b('0x1d')]=qs['limit'](_0x427b61[_0xa53b('0x2f')][_0xa53b('0x1d')]);_0x511698[_0xa53b('0x1c')]=qs[_0xa53b('0x1c')](_0x427b61[_0xa53b('0x2f')]['offset']);}_0x511698[_0xa53b('0x34')]=qs[_0xa53b('0x35')](_0x427b61[_0xa53b('0x2f')][_0xa53b('0x35')]);_0x511698['where']=qs[_0xa53b('0x30')](_[_0xa53b('0x36')](_0x427b61[_0xa53b('0x2f')],_0x1d0aa6['filters']),_0x2db367);if(_0x427b61['query'][_0xa53b('0x37')]){_0x511698[_0xa53b('0x38')]=_[_0xa53b('0x39')](_0x511698['where'],{'$or':_['map'](_0x2db367,function(_0xf179ce){if(_0xf179ce['type']!==_0xa53b('0x3a')){var _0x5a8ff5={};_0x5a8ff5[_0xf179ce[_0xa53b('0x26')]]={'$like':'%'+_0x427b61['query'][_0xa53b('0x37')]+'%'};return _0x5a8ff5;}})});}_0x511698=_[_0xa53b('0x39')]({},_0x511698,_0x427b61[_0xa53b('0x3b')]);var _0x1da9e8={'where':_0x511698['where']};return db[_0xa53b('0x29')][_0xa53b('0x3c')](_0x1da9e8)[_0xa53b('0x21')](function(_0x45b705){_0x593e3d['count']=_0x45b705;if(_0x427b61[_0xa53b('0x2f')][_0xa53b('0x3d')]){_0x511698[_0xa53b('0x3e')]=[{'all':!![]}];}return db[_0xa53b('0x29')][_0xa53b('0x3f')](_0x511698);})['then'](function(_0x31c365){_0x593e3d[_0xa53b('0x40')]=_0x31c365;return _0x593e3d;})[_0xa53b('0x21')](respondWithFilteredResult(_0x1207bb,_0x511698))[_0xa53b('0x41')](handleError(_0x1207bb,null));};exports[_0xa53b('0x42')]=function(_0x5af256,_0x4fca0e){var _0x22f834={'raw':!![],'where':{'id':_0x5af256[_0xa53b('0x43')]['id']}},_0x24e029={};_0x24e029[_0xa53b('0x2d')]=_[_0xa53b('0x2e')](db[_0xa53b('0x29')]['rawAttributes']);_0x24e029[_0xa53b('0x2f')]=_[_0xa53b('0x2e')](_0x5af256[_0xa53b('0x2f')]);_0x24e029['filters']=_[_0xa53b('0x31')](_0x24e029['model'],_0x24e029[_0xa53b('0x2f')]);_0x22f834['attributes']=_[_0xa53b('0x31')](_0x24e029[_0xa53b('0x2d')],qs[_0xa53b('0x33')](_0x5af256[_0xa53b('0x2f')]['fields']));_0x22f834[_0xa53b('0x32')]=_0x22f834[_0xa53b('0x32')]['length']?_0x22f834[_0xa53b('0x32')]:_0x24e029[_0xa53b('0x2d')];if(_0x5af256[_0xa53b('0x2f')][_0xa53b('0x3d')]){_0x22f834[_0xa53b('0x3e')]=[{'all':!![]}];}_0x22f834=_['merge']({},_0x22f834,_0x5af256['options']);return db[_0xa53b('0x29')]['find'](_0x22f834)[_0xa53b('0x21')](handleEntityNotFound(_0x4fca0e,null))[_0xa53b('0x21')](respondWithResult(_0x4fca0e,null))['catch'](handleError(_0x4fca0e,null));};exports[_0xa53b('0x20')]=function(_0x57c362,_0x1ee080){if(_0x57c362['body']['id']){delete _0x57c362[_0xa53b('0x44')]['id'];}return db[_0xa53b('0x29')][_0xa53b('0x45')]({'where':{'id':_0x57c362['params']['id']}})['then'](handleEntityNotFound(_0x1ee080,null))[_0xa53b('0x21')](saveUpdates(_0x57c362[_0xa53b('0x44')],null))['then'](respondWithResult(_0x1ee080,null))[_0xa53b('0x41')](handleError(_0x1ee080,null));};exports[_0xa53b('0x22')]=function(_0xcf792f,_0xbce704){return db[_0xa53b('0x29')]['find']({'where':{'id':_0xcf792f[_0xa53b('0x43')]['id']}})[_0xa53b('0x21')](handleEntityNotFound(_0xbce704,null))['then'](removeEntity(_0xbce704,null))['catch'](handleError(_0xbce704,null));};exports[_0xa53b('0x46')]=function(_0x3eac55,_0x1cf7ad){var _0x44f324;return db[_0xa53b('0x47')][_0xa53b('0x48')](function(_0x116bef){return db['CmCustomField'][_0xa53b('0x46')](_0x3eac55[_0xa53b('0x44')],{'transaction':_0x116bef})[_0xa53b('0x21')](function(_0x1c0a19){_0x44f324=_0x1c0a19;var _0x50bd35={'type':db[_0xa53b('0x49')]['TEXT'],'transaction':_0x116bef};switch(_0x3eac55[_0xa53b('0x44')][_0xa53b('0x2b')]){case _0xa53b('0x4a'):_0x50bd35[_0xa53b('0x2b')]=db[_0xa53b('0x49')][_0xa53b('0x4b')];break;case _0xa53b('0x4c'):_0x50bd35[_0xa53b('0x2b')]=db[_0xa53b('0x49')][_0xa53b('0x4d')];break;case _0xa53b('0x4e'):_0x50bd35[_0xa53b('0x2b')]=db['Sequelize'][_0xa53b('0x4f')];_0x50bd35[_0xa53b('0x50')]=![];break;default:}return db[_0xa53b('0x47')][_0xa53b('0x51')][_0xa53b('0x52')](_0xa53b('0x53'),util[_0xa53b('0x54')]('cf_%d',_0x44f324['id']),_0x50bd35);})[_0xa53b('0x21')](function(){return _0x44f324;});})[_0xa53b('0x21')](respondWithResult(_0x1cf7ad,0xc9))[_0xa53b('0x41')](handleError(_0x1cf7ad,null));}; \ No newline at end of file +var _0x6f54=['differenceBy','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','catch','show','include','find','body','destroy','params','sequelize','transaction','create','Sequelize','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0x6f54,0xc6));var _0x46f5=function(_0x3baac8,_0x251192){_0x3baac8=_0x3baac8-0x0;var _0x20964d=_0x6f54[_0x3baac8];return _0x20964d;};'use strict';var pdf=require(_0x46f5('0x0'));var emlformat=require(_0x46f5('0x1'));var rimraf=require(_0x46f5('0x2'));var zipdir=require(_0x46f5('0x3'));var jsonpatch=require(_0x46f5('0x4'));var rp=require(_0x46f5('0x5'));var moment=require('moment');var BPromise=require(_0x46f5('0x6'));var Mustache=require(_0x46f5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x46f5('0x8'));var ejs=require(_0x46f5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x46f5('0xa'));var crypto=require(_0x46f5('0xb'));var jsforce=require(_0x46f5('0xc'));var deskjs=require(_0x46f5('0xd'));var toCsv=require(_0x46f5('0x8'));var querystring=require('querystring');var Papa=require(_0x46f5('0xe'));var Redis=require(_0x46f5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x46f5('0x10'));var hardwareService=require(_0x46f5('0x11'));var logger=require(_0x46f5('0x12'))(_0x46f5('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x46f5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a497e,_0x2cfe79){_0x2cfe79=_0x2cfe79||0xcc;return function(_0x292234){if(_0x292234){return _0x3a497e[_0x46f5('0x15')](_0x2cfe79);}return _0x3a497e[_0x46f5('0x16')](_0x2cfe79)[_0x46f5('0x17')]();};}function respondWithResult(_0x24c7ab,_0x43b847){_0x43b847=_0x43b847||0xc8;return function(_0x2d01f0){if(_0x2d01f0){return _0x24c7ab[_0x46f5('0x16')](_0x43b847)[_0x46f5('0x18')](_0x2d01f0);}};}function respondWithFilteredResult(_0x15507c,_0x33df2e){return function(_0x17134f){if(_0x17134f){var _0xaf3243=_0x17134f[_0x46f5('0x19')],_0x2e5f44=_0x33df2e['offset'],_0x42a92c=_0x33df2e[_0x46f5('0x1a')]+_0x33df2e['limit'],_0x1ee391;if(_0x42a92c>=_0xaf3243){_0x42a92c=_0xaf3243;_0x1ee391=0xc8;}else{_0x1ee391=0xce;}_0x15507c['status'](_0x1ee391);return _0x15507c[_0x46f5('0x1b')]('Content-Range',_0x2e5f44+'-'+_0x42a92c+'/'+_0xaf3243)[_0x46f5('0x18')](_0x17134f);}return null;};}function patchUpdates(_0x92e901){return function(_0x4c4ed0){try{jsonpatch[_0x46f5('0x1c')](_0x4c4ed0,_0x92e901,!![]);}catch(_0x1999a9){return BPromise[_0x46f5('0x1d')](_0x1999a9);}return _0x4c4ed0[_0x46f5('0x1e')]();};}function saveUpdates(_0x4dcf22,_0x5e9c7d){return function(_0x2f2091){if(_0x2f2091){return _0x2f2091[_0x46f5('0x1f')](_0x4dcf22)['then'](function(_0x2915c3){return _0x2915c3;});}return null;};}function removeEntity(_0x107caa,_0x4e0c8a){return function(_0x1638d6){if(_0x1638d6){return _0x1638d6['destroy']()[_0x46f5('0x20')](function(){_0x107caa[_0x46f5('0x16')](0xcc)[_0x46f5('0x17')]();});}};}function handleEntityNotFound(_0x5322f0,_0x4e04e8){return function(_0x1c8b45){if(!_0x1c8b45){_0x5322f0[_0x46f5('0x15')](0x194);}return _0x1c8b45;};}function handleError(_0x247252,_0x38ef0e){_0x38ef0e=_0x38ef0e||0x1f4;return function(_0x104ba3){logger[_0x46f5('0x21')](_0x104ba3[_0x46f5('0x22')]);if(_0x104ba3[_0x46f5('0x23')]){delete _0x104ba3[_0x46f5('0x23')];}_0x247252[_0x46f5('0x16')](_0x38ef0e)[_0x46f5('0x24')](_0x104ba3);};}exports['index']=function(_0x3af38f,_0x140d87){var _0x50b3c0={},_0x1ce46e={},_0x7f52e5={'count':0x0,'rows':[]};var _0x121c11=_[_0x46f5('0x25')](db[_0x46f5('0x26')][_0x46f5('0x27')],function(_0x502294){return{'name':_0x502294[_0x46f5('0x28')],'type':_0x502294[_0x46f5('0x29')]['key']};});_0x1ce46e['model']=_[_0x46f5('0x2a')](_['map'](_0x121c11,_0x46f5('0x23')),[_0x46f5('0x23')]);_0x1ce46e['query']=_[_0x46f5('0x2b')](_0x3af38f[_0x46f5('0x2c')]);_0x1ce46e[_0x46f5('0x2d')]=_[_0x46f5('0x2e')](_0x1ce46e['model'],_0x1ce46e[_0x46f5('0x2c')]);_0x50b3c0['attributes']=_[_0x46f5('0x2e')](_0x1ce46e[_0x46f5('0x2f')],qs[_0x46f5('0x30')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x30')]));_0x50b3c0[_0x46f5('0x31')]=_0x50b3c0[_0x46f5('0x31')]['length']?_0x50b3c0[_0x46f5('0x31')]:_0x1ce46e[_0x46f5('0x2f')];if(!_0x3af38f['query'][_0x46f5('0x32')](_0x46f5('0x33'))){_0x50b3c0['limit']=qs[_0x46f5('0x34')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x34')]);_0x50b3c0['offset']=qs[_0x46f5('0x1a')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x1a')]);}_0x50b3c0[_0x46f5('0x35')]=qs[_0x46f5('0x36')](_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x36')]);_0x50b3c0['where']=qs[_0x46f5('0x2d')](_[_0x46f5('0x37')](_0x3af38f[_0x46f5('0x2c')],_0x1ce46e['filters']),_0x121c11);if(_0x3af38f[_0x46f5('0x2c')][_0x46f5('0x38')]){_0x50b3c0['where']=_[_0x46f5('0x39')](_0x50b3c0[_0x46f5('0x3a')],{'$or':_[_0x46f5('0x25')](_0x121c11,function(_0x28fd67){if(_0x28fd67[_0x46f5('0x29')]!==_0x46f5('0x3b')){var _0x2143cd={};_0x2143cd[_0x28fd67[_0x46f5('0x23')]]={'$like':'%'+_0x3af38f[_0x46f5('0x2c')]['filter']+'%'};return _0x2143cd;}})});}_0x50b3c0=_[_0x46f5('0x39')]({},_0x50b3c0,_0x3af38f[_0x46f5('0x3c')]);var _0x19824f={'where':_0x50b3c0[_0x46f5('0x3a')]};return db[_0x46f5('0x26')]['count'](_0x19824f)[_0x46f5('0x20')](function(_0x32ffe7){_0x7f52e5[_0x46f5('0x19')]=_0x32ffe7;if(_0x3af38f[_0x46f5('0x2c')]['includeAll']){_0x50b3c0['include']=[{'all':!![]}];}return db[_0x46f5('0x26')][_0x46f5('0x3d')](_0x50b3c0);})[_0x46f5('0x20')](function(_0x3a6f68){_0x7f52e5['rows']=_0x3a6f68;return _0x7f52e5;})[_0x46f5('0x20')](respondWithFilteredResult(_0x140d87,_0x50b3c0))[_0x46f5('0x3e')](handleError(_0x140d87,null));};exports[_0x46f5('0x3f')]=function(_0x1dd63d,_0x35b56c){var _0x3024a7={'raw':!![],'where':{'id':_0x1dd63d['params']['id']}},_0x2dfc6d={};_0x2dfc6d[_0x46f5('0x2f')]=_[_0x46f5('0x2b')](db[_0x46f5('0x26')][_0x46f5('0x27')]);_0x2dfc6d[_0x46f5('0x2c')]=_[_0x46f5('0x2b')](_0x1dd63d[_0x46f5('0x2c')]);_0x2dfc6d[_0x46f5('0x2d')]=_['intersection'](_0x2dfc6d[_0x46f5('0x2f')],_0x2dfc6d[_0x46f5('0x2c')]);_0x3024a7[_0x46f5('0x31')]=_['intersection'](_0x2dfc6d[_0x46f5('0x2f')],qs['fields'](_0x1dd63d[_0x46f5('0x2c')][_0x46f5('0x30')]));_0x3024a7['attributes']=_0x3024a7[_0x46f5('0x31')]['length']?_0x3024a7[_0x46f5('0x31')]:_0x2dfc6d[_0x46f5('0x2f')];if(_0x1dd63d['query']['includeAll']){_0x3024a7[_0x46f5('0x40')]=[{'all':!![]}];}_0x3024a7=_[_0x46f5('0x39')]({},_0x3024a7,_0x1dd63d[_0x46f5('0x3c')]);return db[_0x46f5('0x26')][_0x46f5('0x41')](_0x3024a7)[_0x46f5('0x20')](handleEntityNotFound(_0x35b56c,null))[_0x46f5('0x20')](respondWithResult(_0x35b56c,null))[_0x46f5('0x3e')](handleError(_0x35b56c,null));};exports['update']=function(_0x2db716,_0x404dcd){if(_0x2db716['body']['id']){delete _0x2db716[_0x46f5('0x42')]['id'];}return db[_0x46f5('0x26')]['find']({'where':{'id':_0x2db716['params']['id']}})[_0x46f5('0x20')](handleEntityNotFound(_0x404dcd,null))['then'](saveUpdates(_0x2db716[_0x46f5('0x42')],null))[_0x46f5('0x20')](respondWithResult(_0x404dcd,null))[_0x46f5('0x3e')](handleError(_0x404dcd,null));};exports[_0x46f5('0x43')]=function(_0x4975da,_0x3d2442){return db[_0x46f5('0x26')]['find']({'where':{'id':_0x4975da[_0x46f5('0x44')]['id']}})[_0x46f5('0x20')](handleEntityNotFound(_0x3d2442,null))[_0x46f5('0x20')](removeEntity(_0x3d2442,null))[_0x46f5('0x3e')](handleError(_0x3d2442,null));};exports['create']=function(_0x4ae2fa,_0x4fc4b9){var _0x5d81ca;return db[_0x46f5('0x45')][_0x46f5('0x46')](function(_0x5cac4c){return db[_0x46f5('0x26')][_0x46f5('0x47')](_0x4ae2fa[_0x46f5('0x42')],{'transaction':_0x5cac4c})['then'](function(_0x48b47b){_0x5d81ca=_0x48b47b;var _0x46d36c={'type':db[_0x46f5('0x48')]['TEXT'],'transaction':_0x5cac4c};switch(_0x4ae2fa[_0x46f5('0x42')][_0x46f5('0x29')]){case _0x46f5('0x49'):_0x46d36c[_0x46f5('0x29')]=db[_0x46f5('0x48')]['TEXT'];break;case'number':_0x46d36c[_0x46f5('0x29')]=db[_0x46f5('0x48')]['INTEGER'];break;case _0x46f5('0x4a'):_0x46d36c[_0x46f5('0x29')]=db[_0x46f5('0x48')][_0x46f5('0x4b')];_0x46d36c[_0x46f5('0x4c')]=![];break;default:}return db[_0x46f5('0x45')][_0x46f5('0x4d')][_0x46f5('0x4e')]('cm_contacts',util['format'](_0x46f5('0x4f'),_0x5d81ca['id']),_0x46d36c);})[_0x46f5('0x20')](function(){return _0x5d81ca;});})[_0x46f5('0x20')](respondWithResult(_0x4fc4b9,0xc9))[_0x46f5('0x3e')](handleError(_0x4fc4b9,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 40d9a09..08c6530 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 _0x6ad3=['request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x6ad3,0xe5));var _0x36ad=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x6ad3[_0x4bbe00];return _0x3999d2;};'use strict';var _=require(_0x36ad('0x0'));var util=require('util');var logger=require(_0x36ad('0x1'))(_0x36ad('0x2'));var moment=require(_0x36ad('0x3'));var BPromise=require(_0x36ad('0x4'));var rp=require(_0x36ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36ad('0x6'));var config=require(_0x36ad('0x7'));var attributes=require(_0x36ad('0x8'));module[_0x36ad('0x9')]=function(_0x19e1c4,_0x2ae432){return _0x19e1c4[_0x36ad('0xa')](_0x36ad('0xb'),attributes,{'tableName':_0x36ad('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78bd=['request-promise','path','rimraf','./cmCustomField.attributes','define','cm_custom_fields','lodash','util','../../config/logger','bluebird'];(function(_0x2dd08f,_0x5ee018){var _0x27967a=function(_0x57b2b0){while(--_0x57b2b0){_0x2dd08f['push'](_0x2dd08f['shift']());}};_0x27967a(++_0x5ee018);}(_0x78bd,0x1f0));var _0xd78b=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x78bd[_0x1d6a82];return _0x5834ac;};'use strict';var _=require(_0xd78b('0x0'));var util=require(_0xd78b('0x1'));var logger=require(_0xd78b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd78b('0x3'));var rp=require(_0xd78b('0x4'));var fs=require('fs');var path=require(_0xd78b('0x5'));var rimraf=require(_0xd78b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd78b('0x7'));module['exports']=function(_0x34c39d,_0x4fbcae){return _0x34c39d[_0xd78b('0x8')]('CmCustomField',attributes,{'tableName':_0xd78b('0x9'),'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 edc00c3..2d33573 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 _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x26d2b0,_0x16b1d0){var _0x13fa84=function(_0x1e00b1){while(--_0x1e00b1){_0x26d2b0['push'](_0x26d2b0['shift']());}};_0x13fa84(++_0x16b1d0);}(_0xd3d1,0x172));var _0x1d3d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd3d1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file +var _0x303a=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x303a,0x1a0));var _0xa303=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x303a[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('CmCustomField,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('CmCustomField,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('CmCustomField,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 322843f..a4fcfc9 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 _0x946d=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put'];(function(_0xc612fc,_0x1a4d6b){var _0x1ed090=function(_0x1ef973){while(--_0x1ef973){_0xc612fc['push'](_0xc612fc['shift']());}};_0x1ed090(++_0x1a4d6b);}(_0x946d,0xad));var _0xd946=function(_0x3bf167,_0x118b04){_0x3bf167=_0x3bf167-0x0;var _0x4f4ca4=_0x946d[_0x3bf167];return _0x4f4ca4;};'use strict';var multer=require(_0xd946('0x0'));var util=require(_0xd946('0x1'));var path=require(_0xd946('0x2'));var timeout=require(_0xd946('0x3'));var express=require('express');var router=express[_0xd946('0x4')]();var auth=require(_0xd946('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd946('0x6'));var controller=require('./cmCustomField.controller');router[_0xd946('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd946('0x7')](_0xd946('0x8'),auth[_0xd946('0x9')](),controller[_0xd946('0xa')]);router[_0xd946('0xb')]('/',auth[_0xd946('0x9')](),controller[_0xd946('0xc')]);router[_0xd946('0xd')]('/:id',auth[_0xd946('0x9')](),controller['update']);router[_0xd946('0xe')](_0xd946('0x8'),auth[_0xd946('0x9')](),controller[_0xd946('0xf')]);module[_0xd946('0x10')]=router; \ No newline at end of file +var _0xf62d=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xf62d,0x13e));var _0xdf62=function(_0x1492e4,_0x53dbe6){_0x1492e4=_0x1492e4-0x0;var _0x583dbb=_0xf62d[_0x1492e4];return _0x583dbb;};'use strict';var multer=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var path=require(_0xdf62('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf62('0x3'));var router=express[_0xdf62('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf62('0x5'));var config=require(_0xdf62('0x6'));var controller=require(_0xdf62('0x7'));router[_0xdf62('0x8')]('/',auth[_0xdf62('0x9')](),controller['index']);router[_0xdf62('0x8')](_0xdf62('0xa'),auth[_0xdf62('0x9')](),controller[_0xdf62('0xb')]);router[_0xdf62('0xc')]('/',auth[_0xdf62('0x9')](),controller[_0xdf62('0xd')]);router[_0xdf62('0xe')](_0xdf62('0xa'),auth[_0xdf62('0x9')](),controller['update']);router['delete']('/:id',auth[_0xdf62('0x9')](),controller[_0xdf62('0xf')]);module[_0xdf62('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0590545..6f56fab 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 _0x0f4d=['INTEGER','BOOLEAN','UNSIGNED','contactListQueue','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ad968,_0x201fe7){var _0x124c94=function(_0x24ea98){while(--_0x24ea98){_0x2ad968['push'](_0x2ad968['shift']());}};_0x124c94(++_0x201fe7);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x2e4fd3,_0x1530dc){_0x2e4fd3=_0x2e4fd3-0x0;var _0x6fe43d=_0x0f4d[_0x2e4fd3];return _0x6fe43d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xd0f4('0x0')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd0f4('0x1')],'defaultValue':moment()[_0xd0f4('0x2')](_0xd0f4('0x3'))},'countbusyretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd0f4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd0f4('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xd0f4('0x4')](0x2)[_0xd0f4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd0f4('0x4')],'unique':_0xd0f4('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xd0f4('0x7')},'UserId':{'type':Sequelize[_0xd0f4('0x4')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xd0f4('0x7')},'CampaignId':{'type':Sequelize[_0xd0f4('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd0f4('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc978=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8c97('0x0'));var Sequelize=require(_0x8c97('0x1'));module[_0x8c97('0x2')]={'phone':{'type':Sequelize[_0x8c97('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8c97('0x5')],'defaultValue':moment()['format'](_0x8c97('0x6'))},'countbusyretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8c97('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8c97('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8c97('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8c97('0x7')],'unique':_0x8c97('0x9')},'ListId':{'type':Sequelize[_0x8c97('0x7')],'unique':_0x8c97('0x9')},'UserId':{'type':Sequelize[_0x8c97('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8c97('0x9')},'CampaignId':{'type':Sequelize[_0x8c97('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index d6bdc9f..ec345f9 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 _0x1ba2=['campaigntype','ivr','CmContact','ContactId','firstName','isNil','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','then','includeAll','findAll','params','include','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','membername','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone'];(function(_0x21470d,_0x284f75){var _0x22a83d=function(_0xab71cc){while(--_0xab71cc){_0x21470d['push'](_0x21470d['shift']());}};_0x22a83d(++_0x284f75);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x21ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21ba('0x2'));var rp=require(_0x21ba('0x3'));var moment=require(_0x21ba('0x4'));var BPromise=require(_0x21ba('0x5'));var Mustache=require(_0x21ba('0x6'));var util=require('util');var path=require(_0x21ba('0x7'));var sox=require(_0x21ba('0x8'));var csv=require('to-csv');var ejs=require(_0x21ba('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x21ba('0xa'));var crypto=require(_0x21ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21ba('0xd'));var Papa=require(_0x21ba('0xe'));var Redis=require('ioredis');var authService=require(_0x21ba('0xf'));var qs=require(_0x21ba('0x10'));var as=require(_0x21ba('0x11'));var hardwareService=require(_0x21ba('0x12'));var logger=require(_0x21ba('0x13'))(_0x21ba('0x14'));var utils=require(_0x21ba('0x15'));var config=require(_0x21ba('0x16'));var licenseUtil=require(_0x21ba('0x17'));var db=require(_0x21ba('0x18'))['db'];function respondWithStatusCode(_0x10fae1,_0x2bc413){_0x2bc413=_0x2bc413||0xcc;return function(_0x48f552){if(_0x48f552){return _0x10fae1['sendStatus'](_0x2bc413);}return _0x10fae1[_0x21ba('0x19')](_0x2bc413)[_0x21ba('0x1a')]();};}function respondWithResult(_0x214f8e,_0x4f43e2){_0x4f43e2=_0x4f43e2||0xc8;return function(_0x4b9fd2){if(_0x4b9fd2){return _0x214f8e[_0x21ba('0x19')](_0x4f43e2)['json'](_0x4b9fd2);}};}function respondWithFilteredResult(_0x3591cd,_0x494588){return function(_0x179063){if(_0x179063){var _0x2e7b03=_0x179063['count'],_0x17df0e=_0x494588[_0x21ba('0x1b')],_0x1c2bac=_0x494588['offset']+_0x494588[_0x21ba('0x1c')],_0x10b9e6;if(_0x1c2bac>=_0x2e7b03){_0x1c2bac=_0x2e7b03;_0x10b9e6=0xc8;}else{_0x10b9e6=0xce;}_0x3591cd[_0x21ba('0x19')](_0x10b9e6);return _0x3591cd[_0x21ba('0x1d')](_0x21ba('0x1e'),_0x17df0e+'-'+_0x1c2bac+'/'+_0x2e7b03)[_0x21ba('0x1f')](_0x179063);}return null;};}function patchUpdates(_0x260c98){return function(_0x1eb6ed){try{jsonpatch[_0x21ba('0x20')](_0x1eb6ed,_0x260c98,!![]);}catch(_0x4b8d7a){return BPromise[_0x21ba('0x21')](_0x4b8d7a);}return _0x1eb6ed[_0x21ba('0x22')]();};}function saveUpdates(_0x58ba99,_0x213a83){return function(_0x5d1c55){if(_0x5d1c55){return _0x5d1c55[_0x21ba('0x23')](_0x58ba99)['then'](function(_0x430bbd){return _0x430bbd;});}return null;};}function removeEntity(_0x43383f,_0x30ac7a){return function(_0x7abe9d){if(_0x7abe9d){return _0x7abe9d['destroy']()['then'](function(){_0x43383f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e4b49,_0x1529ec){return function(_0x209ec8){if(!_0x209ec8){_0x2e4b49[_0x21ba('0x24')](0x194);}return _0x209ec8;};}function handleError(_0x328d9f,_0x472656){_0x472656=_0x472656||0x1f4;return function(_0x2f4d96){logger[_0x21ba('0x25')](_0x2f4d96[_0x21ba('0x26')]);if(_0x2f4d96[_0x21ba('0x27')]){delete _0x2f4d96[_0x21ba('0x27')];}_0x328d9f[_0x21ba('0x19')](_0x472656)[_0x21ba('0x28')](_0x2f4d96);};}exports[_0x21ba('0x29')]=function(_0x1aca0c,_0x38d430){var _0x19c367={},_0x2dccbf={},_0x2567f9={'count':0x0,'rows':[]};var _0x33800c=_[_0x21ba('0x2a')](db[_0x21ba('0x2b')][_0x21ba('0x2c')],function(_0x1b4ebe){return{'name':_0x1b4ebe[_0x21ba('0x2d')],'type':_0x1b4ebe[_0x21ba('0x2e')][_0x21ba('0x2f')]};});_0x2dccbf[_0x21ba('0x30')]=_[_0x21ba('0x2a')](_0x33800c,_0x21ba('0x27'));_0x2dccbf[_0x21ba('0x31')]=_[_0x21ba('0x32')](_0x1aca0c['query']);_0x2dccbf[_0x21ba('0x33')]=_[_0x21ba('0x34')](_0x2dccbf[_0x21ba('0x30')],_0x2dccbf[_0x21ba('0x31')]);_0x2dccbf['filters']=_['concat'](_0x2dccbf[_0x21ba('0x33')],[_0x21ba('0x35'),_0x21ba('0x36'),_0x21ba('0x37'),_0x21ba('0x38'),'$lt',_0x21ba('0x39'),'$ne',_0x21ba('0x3a'),_0x21ba('0x3b'),_0x21ba('0x3c'),_0x21ba('0x3d'),_0x21ba('0x3e'),_0x21ba('0x3f'),_0x21ba('0x40'),_0x21ba('0x41'),_0x21ba('0x42'),'$notILike','$like',_0x21ba('0x43'),_0x21ba('0x44'),_0x21ba('0x45'),_0x21ba('0x46')]);_0x19c367['attributes']=_[_0x21ba('0x34')](_0x2dccbf[_0x21ba('0x30')],qs['fields'](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x47')]));_0x19c367[_0x21ba('0x48')]=_0x19c367[_0x21ba('0x48')][_0x21ba('0x49')]?_0x19c367[_0x21ba('0x48')]:_0x2dccbf[_0x21ba('0x30')];if(!_0x1aca0c['query'][_0x21ba('0x4a')]('nolimit')){_0x19c367[_0x21ba('0x1c')]=qs['limit'](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x1c')]);_0x19c367[_0x21ba('0x1b')]=qs[_0x21ba('0x1b')](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x1b')]);}_0x19c367[_0x21ba('0x4b')]=qs[_0x21ba('0x4c')](_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x4c')]);_0x19c367[_0x21ba('0x4d')]=qs[_0x21ba('0x33')](_[_0x21ba('0x4e')](_0x1aca0c['query'],_0x2dccbf[_0x21ba('0x33')]),_0x33800c);if(_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x4f')]){_0x19c367[_0x21ba('0x4d')]=_[_0x21ba('0x50')](_0x19c367['where'],{'$or':_[_0x21ba('0x2a')](_0x33800c,function(_0x4789bd){if(_0x4789bd[_0x21ba('0x2e')]!==_0x21ba('0x51')){var _0x24ccf6={};_0x24ccf6[_0x4789bd[_0x21ba('0x27')]]={'$like':'%'+_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x4f')]+'%'};return _0x24ccf6;}})});}_0x19c367=_[_0x21ba('0x50')]({},_0x19c367,_0x1aca0c['options']);var _0x4a38b5={'where':_0x19c367[_0x21ba('0x4d')]};return db['CmHopper'][_0x21ba('0x52')](_0x4a38b5)[_0x21ba('0x53')](function(_0x1f6260){_0x2567f9[_0x21ba('0x52')]=_0x1f6260;if(_0x1aca0c[_0x21ba('0x31')][_0x21ba('0x54')]){_0x19c367['include']=[{'all':!![]}];}return db[_0x21ba('0x2b')][_0x21ba('0x55')](_0x19c367);})['then'](function(_0x270e0c){_0x2567f9['rows']=_0x270e0c;return _0x2567f9;})[_0x21ba('0x53')](respondWithFilteredResult(_0x38d430,_0x19c367))['catch'](handleError(_0x38d430,null));};exports['show']=function(_0x1e12ca,_0x20fd57){var _0x49ee31={'raw':!![],'where':{'id':_0x1e12ca[_0x21ba('0x56')]['id']}},_0x59cbb9={};_0x59cbb9[_0x21ba('0x30')]=_[_0x21ba('0x32')](db[_0x21ba('0x2b')]['rawAttributes']);_0x59cbb9['query']=_[_0x21ba('0x32')](_0x1e12ca[_0x21ba('0x31')]);_0x59cbb9[_0x21ba('0x33')]=_[_0x21ba('0x34')](_0x59cbb9[_0x21ba('0x30')],_0x59cbb9['query']);_0x49ee31[_0x21ba('0x48')]=_[_0x21ba('0x34')](_0x59cbb9[_0x21ba('0x30')],qs['fields'](_0x1e12ca['query']['fields']));_0x49ee31[_0x21ba('0x48')]=_0x49ee31[_0x21ba('0x48')][_0x21ba('0x49')]?_0x49ee31[_0x21ba('0x48')]:_0x59cbb9[_0x21ba('0x30')];if(_0x1e12ca['query'][_0x21ba('0x54')]){_0x49ee31[_0x21ba('0x57')]=[{'all':!![]}];}_0x49ee31=_[_0x21ba('0x50')]({},_0x49ee31,_0x1e12ca['options']);return db[_0x21ba('0x2b')][_0x21ba('0x58')](_0x49ee31)['then'](handleEntityNotFound(_0x20fd57,null))[_0x21ba('0x53')](respondWithResult(_0x20fd57,null))[_0x21ba('0x59')](handleError(_0x20fd57,null));};exports[_0x21ba('0x5a')]=function(_0x384765,_0x518ae7){return db[_0x21ba('0x2b')][_0x21ba('0x5a')](_0x384765[_0x21ba('0x5b')],{})[_0x21ba('0x53')](respondWithResult(_0x518ae7,0xc9))[_0x21ba('0x59')](handleError(_0x518ae7,null));};exports[_0x21ba('0x23')]=function(_0x196fcf,_0x2f149d){if(_0x196fcf[_0x21ba('0x5b')]['id']){delete _0x196fcf[_0x21ba('0x5b')]['id'];}return db[_0x21ba('0x2b')][_0x21ba('0x58')]({'where':{'id':_0x196fcf['params']['id']}})[_0x21ba('0x53')](handleEntityNotFound(_0x2f149d,null))['then'](saveUpdates(_0x196fcf[_0x21ba('0x5b')],null))['then'](respondWithResult(_0x2f149d,null))[_0x21ba('0x59')](handleError(_0x2f149d,null));};exports[_0x21ba('0x5c')]=function(_0x36ddbb,_0x30c6fc){return db[_0x21ba('0x2b')][_0x21ba('0x5c')]()[_0x21ba('0x53')](respondWithResult(_0x30c6fc,null))['catch'](handleError(_0x30c6fc,null));};exports['destroy']=function(_0x9449e9,_0x7e1de2){var _0x4022ed;return db[_0x21ba('0x2b')]['find']({'where':{'id':_0x9449e9['params']['id']}})[_0x21ba('0x53')](handleEntityNotFound(_0x7e1de2,null))[_0x21ba('0x53')](function(_0x1b23f0){if(_0x1b23f0){return _0x1b23f0['destroy']()[_0x21ba('0x53')](function(_0x2fe608){return _0x2fe608;});}})[_0x21ba('0x53')](function(_0x462b1d){_0x4022ed=_0x462b1d;if(_0x462b1d){if(_0x462b1d[_0x21ba('0x5d')]||_0x462b1d[_0x21ba('0x5e')]){return db[_0x462b1d[_0x21ba('0x5d')]?_0x21ba('0x5f'):_0x21ba('0x60')][_0x21ba('0x58')]({'where':{'id':_0x462b1d['VoiceQueueId']?_0x462b1d['VoiceQueueId']:_0x462b1d['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x21ba('0x53')](function(_0x52741b){var _0x556619={};if(_0x52741b){_[_0x21ba('0x50')](_0x556619,_[_0x21ba('0x61')](_0x4022ed[_0x21ba('0x62')],[_0x21ba('0x63'),_0x21ba('0x64'),'id']));_0x556619[_0x21ba('0x65')]=0x15;_0x556619['statedesc']='deleted';_0x556619['campaign']=_0x52741b[_0x21ba('0x27')];_0x556619[_0x21ba('0x66')]=_0x9449e9[_0x21ba('0x67')]['name'];_0x556619[_0x21ba('0x68')]=_0x9449e9[_0x21ba('0x67')]['id'];_0x556619[_0x21ba('0x69')]=!![];_0x556619['deletedat']=moment()[_0x21ba('0x6a')](_0x21ba('0x6b'));_0x556619[_0x21ba('0x6c')]=_0x4022ed[_0x21ba('0x6d')];_0x556619[_0x21ba('0x6e')]=_0x4022ed[_0x21ba('0x5d')]?'queue':_0x21ba('0x6f');return db[_0x21ba('0x70')][_0x21ba('0x58')]({'where':{'id':_0x556619[_0x21ba('0x71')]},'attributes':[_0x21ba('0x72'),'lastName']})[_0x21ba('0x53')](function(_0x5cf37c){if(!_[_0x21ba('0x73')](_0x7e1de2)&&!_[_0x21ba('0x73')](_0x5cf37c['firstName'])){_0x556619['calleridname']=_0x5cf37c[_0x21ba('0x72')];if(!_[_0x21ba('0x73')](_0x5cf37c['lastName'])){_0x556619['calleridname']+='\x20'+_0x5cf37c['lastName'];}}})[_0x21ba('0x74')](function(){return db[_0x21ba('0x75')][_0x21ba('0x5a')](_0x556619);});}})[_0x21ba('0x53')](function(){return _0x7e1de2['status'](0xcc)[_0x21ba('0x1a')]();})[_0x21ba('0x59')](handleError(_0x7e1de2,null));};exports[_0x21ba('0x76')]=function(_0x52aa36,_0x11e5bd,_0x14b9b4){var _0x4647ea=[];return db[_0x21ba('0x70')][_0x21ba('0x5c')]()['then'](function(_0x588140){_0x4647ea=_[_0x21ba('0x32')](_0x588140);return _0x52aa36['user'][_0x21ba('0x77')]({'where':{'type':_0x21ba('0x78'),'dialActive':!![],'dialMethod':_0x21ba('0x79')},'attributes':['id',_0x21ba('0x7a')],'raw':!![]});})[_0x21ba('0x53')](function(_0x4ce4d5){if(_0x4ce4d5&&_0x4ce4d5[_0x21ba('0x49')]){return db[_0x21ba('0x7b')][_0x21ba('0x7c')](function(_0x394ea9){var _0x33814e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x21ba('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x21ba('0x2a')](_0x4ce4d5,'id')},'$or':[{'UserId':null},{'UserId':_0x52aa36[_0x21ba('0x67')]['id']}]};var _0x3b1b1d=[];if(_0x52aa36[_0x21ba('0x5b')]['direction']&&_0x52aa36[_0x21ba('0x5b')]['direction']==='prev'){if(!_[_0x21ba('0x7d')](_0x52aa36[_0x21ba('0x5b')][_0x21ba('0x7e')])){_0x33814e['id']={'$in':_0x52aa36[_0x21ba('0x5b')][_0x21ba('0x7e')]};}_0x3b1b1d=[[_0x21ba('0x7f'),_0x21ba('0x80')],[_0x21ba('0x81'),_0x4ce4d5[0x0]['dialOrderByScheduledAt']===_0x21ba('0x80')?_0x21ba('0x82'):_0x21ba('0x80')],db[_0x21ba('0x7b')]['literal'](_0x21ba('0x83')),['id','DESC']];}else{if(!_[_0x21ba('0x7d')](_0x52aa36['body'][_0x21ba('0x7e')])){_0x33814e['id']={'$notIn':_0x52aa36[_0x21ba('0x5b')][_0x21ba('0x7e')]};}_0x3b1b1d=[['priority',_0x21ba('0x82')],[_0x21ba('0x81'),_0x4ce4d5[0x0][_0x21ba('0x7a')]],db[_0x21ba('0x7b')]['literal'](_0x21ba('0x84')),['id',_0x21ba('0x80')]];}return db[_0x21ba('0x2b')]['findOne']({'attributes':['id',_0x21ba('0x85')],'where':_0x33814e,'order':_0x3b1b1d,'transaction':_0x394ea9,'lock':_0x394ea9[_0x21ba('0x86')][_0x21ba('0x87')],'include':[{'model':db[_0x21ba('0x70')],'as':_0x21ba('0x88'),'attributes':_0x4647ea,'include':[{'model':db[_0x21ba('0x89')],'as':_0x21ba('0x8a'),'attributes':['id',_0x21ba('0x27')]}]},{'model':db[_0x21ba('0x8b')],'as':'List','attributes':['id',_0x21ba('0x27')]},{'model':db[_0x21ba('0x5f')],'as':_0x21ba('0x8c'),'attributes':['id',_0x21ba('0x27'),_0x21ba('0x8d')]}]})[_0x21ba('0x53')](function(_0x43f947){if(_0x43f947){return _0x43f947[_0x21ba('0x23')]({'UserId':_0x52aa36[_0x21ba('0x67')]['id']},{'transaction':_0x394ea9});}});});}})[_0x21ba('0x53')](handleEntityNotFound(_0x11e5bd,null))[_0x21ba('0x53')](respondWithResult(_0x11e5bd,null))[_0x21ba('0x59')](handleError(_0x11e5bd,null));};exports[_0x21ba('0x8e')]=function(_0x3031a1,_0x798f66,_0x289db8){return _0x3031a1[_0x21ba('0x67')][_0x21ba('0x77')]({'where':{'type':_0x21ba('0x78'),'dialActive':!![],'dialMethod':_0x21ba('0x79')},'attributes':['id'],'raw':!![]})['then'](function(_0x18f58f){if(_0x18f58f&&_0x18f58f[_0x21ba('0x49')]){return db[_0x21ba('0x2b')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x21ba('0x2a')](_0x18f58f,'id')},'$or':[{'UserId':null},{'UserId':_0x3031a1[_0x21ba('0x67')]['id']}]}});}return 0x0;})[_0x21ba('0x53')](function(_0x3fe7e2){if(!_['isNil'](_0x3fe7e2)&&_[_0x21ba('0x8f')](_0x3fe7e2)){return _0x798f66[_0x21ba('0x19')](0xc8)[_0x21ba('0x1f')]({'contacts':_0x3fe7e2});}else{logger[_0x21ba('0x25')](_0x21ba('0x90'),_0x21ba('0x8e'),0x194,'entity\x20not\x20found');_0x798f66['sendStatus'](0x194);}})[_0x21ba('0x59')](handleError(_0x798f66,null));}; \ No newline at end of file +var _0xde6f=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','model','filters','intersection','query','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','calleridnum','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','preview','sequelize','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','CmCompany','Company','CmList','List','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto'];(function(_0x840fbb,_0x4410b5){var _0x5f3229=function(_0x10e600){while(--_0x10e600){_0x840fbb['push'](_0x840fbb['shift']());}};_0x5f3229(++_0x4410b5);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfde6('0x0'));var zipdir=require(_0xfde6('0x1'));var jsonpatch=require(_0xfde6('0x2'));var rp=require('request-promise');var moment=require(_0xfde6('0x3'));var BPromise=require(_0xfde6('0x4'));var Mustache=require(_0xfde6('0x5'));var util=require(_0xfde6('0x6'));var path=require(_0xfde6('0x7'));var sox=require(_0xfde6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfde6('0x9'));var squel=require(_0xfde6('0xa'));var crypto=require(_0xfde6('0xb'));var jsforce=require(_0xfde6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfde6('0xd'));var querystring=require(_0xfde6('0xe'));var Papa=require(_0xfde6('0xf'));var Redis=require('ioredis');var authService=require(_0xfde6('0x10'));var qs=require(_0xfde6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfde6('0x12'))(_0xfde6('0x13'));var utils=require(_0xfde6('0x14'));var config=require(_0xfde6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfde6('0x16'))['db'];function respondWithStatusCode(_0x9a96cf,_0x3a3776){_0x3a3776=_0x3a3776||0xcc;return function(_0x1c5ade){if(_0x1c5ade){return _0x9a96cf[_0xfde6('0x17')](_0x3a3776);}return _0x9a96cf['status'](_0x3a3776)[_0xfde6('0x18')]();};}function respondWithResult(_0x18de07,_0x5d129c){_0x5d129c=_0x5d129c||0xc8;return function(_0x8237f4){if(_0x8237f4){return _0x18de07[_0xfde6('0x19')](_0x5d129c)[_0xfde6('0x1a')](_0x8237f4);}};}function respondWithFilteredResult(_0x506b96,_0x159254){return function(_0xcd2776){if(_0xcd2776){var _0x101ea8=_0xcd2776[_0xfde6('0x1b')],_0x17d5e6=_0x159254['offset'],_0x5204ae=_0x159254[_0xfde6('0x1c')]+_0x159254[_0xfde6('0x1d')],_0x4c1ea0;if(_0x5204ae>=_0x101ea8){_0x5204ae=_0x101ea8;_0x4c1ea0=0xc8;}else{_0x4c1ea0=0xce;}_0x506b96['status'](_0x4c1ea0);return _0x506b96[_0xfde6('0x1e')]('Content-Range',_0x17d5e6+'-'+_0x5204ae+'/'+_0x101ea8)[_0xfde6('0x1a')](_0xcd2776);}return null;};}function patchUpdates(_0x398d76){return function(_0x44756d){try{jsonpatch[_0xfde6('0x1f')](_0x44756d,_0x398d76,!![]);}catch(_0x1ec215){return BPromise[_0xfde6('0x20')](_0x1ec215);}return _0x44756d[_0xfde6('0x21')]();};}function saveUpdates(_0x1841d8,_0x1a4076){return function(_0x599c33){if(_0x599c33){return _0x599c33[_0xfde6('0x22')](_0x1841d8)[_0xfde6('0x23')](function(_0x58a222){return _0x58a222;});}return null;};}function removeEntity(_0x2577a1,_0x458cfc){return function(_0x4ff8e2){if(_0x4ff8e2){return _0x4ff8e2[_0xfde6('0x24')]()[_0xfde6('0x23')](function(){_0x2577a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c3c4d,_0xc18655){return function(_0x4bc2c2){if(!_0x4bc2c2){_0x2c3c4d[_0xfde6('0x17')](0x194);}return _0x4bc2c2;};}function handleError(_0x492219,_0x51ca17){_0x51ca17=_0x51ca17||0x1f4;return function(_0x2cac84){logger[_0xfde6('0x25')](_0x2cac84[_0xfde6('0x26')]);if(_0x2cac84[_0xfde6('0x27')]){delete _0x2cac84[_0xfde6('0x27')];}_0x492219[_0xfde6('0x19')](_0x51ca17)['send'](_0x2cac84);};}exports[_0xfde6('0x28')]=function(_0x262373,_0x5f2171){var _0x26b355={},_0x58457d={},_0x2e9b86={'count':0x0,'rows':[]};var _0x2eb564=_['map'](db[_0xfde6('0x29')][_0xfde6('0x2a')],function(_0x54e872){return{'name':_0x54e872[_0xfde6('0x2b')],'type':_0x54e872[_0xfde6('0x2c')]['key']};});_0x58457d[_0xfde6('0x2d')]=_['map'](_0x2eb564,_0xfde6('0x27'));_0x58457d['query']=_['keys'](_0x262373['query']);_0x58457d[_0xfde6('0x2e')]=_[_0xfde6('0x2f')](_0x58457d[_0xfde6('0x2d')],_0x58457d[_0xfde6('0x30')]);_0x58457d[_0xfde6('0x2e')]=_['concat'](_0x58457d['filters'],['$and',_0xfde6('0x31'),_0xfde6('0x32'),_0xfde6('0x33'),_0xfde6('0x34'),_0xfde6('0x35'),_0xfde6('0x36'),_0xfde6('0x37'),_0xfde6('0x38'),_0xfde6('0x39'),'$notBetween',_0xfde6('0x3a'),_0xfde6('0x3b'),_0xfde6('0x3c'),_0xfde6('0x3d'),'$iLike',_0xfde6('0x3e'),'$like',_0xfde6('0x3f'),_0xfde6('0x40'),_0xfde6('0x41'),_0xfde6('0x42')]);_0x26b355['attributes']=_[_0xfde6('0x2f')](_0x58457d['model'],qs[_0xfde6('0x43')](_0x262373[_0xfde6('0x30')]['fields']));_0x26b355[_0xfde6('0x44')]=_0x26b355[_0xfde6('0x44')][_0xfde6('0x45')]?_0x26b355[_0xfde6('0x44')]:_0x58457d['model'];if(!_0x262373[_0xfde6('0x30')][_0xfde6('0x46')](_0xfde6('0x47'))){_0x26b355[_0xfde6('0x1d')]=qs[_0xfde6('0x1d')](_0x262373[_0xfde6('0x30')][_0xfde6('0x1d')]);_0x26b355[_0xfde6('0x1c')]=qs[_0xfde6('0x1c')](_0x262373[_0xfde6('0x30')][_0xfde6('0x1c')]);}_0x26b355[_0xfde6('0x48')]=qs[_0xfde6('0x49')](_0x262373[_0xfde6('0x30')][_0xfde6('0x49')]);_0x26b355[_0xfde6('0x4a')]=qs[_0xfde6('0x2e')](_['pick'](_0x262373['query'],_0x58457d['filters']),_0x2eb564);if(_0x262373[_0xfde6('0x30')][_0xfde6('0x4b')]){_0x26b355['where']=_[_0xfde6('0x4c')](_0x26b355[_0xfde6('0x4a')],{'$or':_[_0xfde6('0x4d')](_0x2eb564,function(_0x25a567){if(_0x25a567[_0xfde6('0x2c')]!==_0xfde6('0x4e')){var _0x2b7a24={};_0x2b7a24[_0x25a567[_0xfde6('0x27')]]={'$like':'%'+_0x262373[_0xfde6('0x30')][_0xfde6('0x4b')]+'%'};return _0x2b7a24;}})});}_0x26b355=_[_0xfde6('0x4c')]({},_0x26b355,_0x262373[_0xfde6('0x4f')]);var _0x399213={'where':_0x26b355['where']};return db[_0xfde6('0x29')][_0xfde6('0x1b')](_0x399213)['then'](function(_0xdad23f){_0x2e9b86[_0xfde6('0x1b')]=_0xdad23f;if(_0x262373[_0xfde6('0x30')][_0xfde6('0x50')]){_0x26b355[_0xfde6('0x51')]=[{'all':!![]}];}return db[_0xfde6('0x29')][_0xfde6('0x52')](_0x26b355);})[_0xfde6('0x23')](function(_0x239761){_0x2e9b86[_0xfde6('0x53')]=_0x239761;return _0x2e9b86;})[_0xfde6('0x23')](respondWithFilteredResult(_0x5f2171,_0x26b355))[_0xfde6('0x54')](handleError(_0x5f2171,null));};exports[_0xfde6('0x55')]=function(_0x188797,_0x34ba90){var _0xff02c1={'raw':!![],'where':{'id':_0x188797[_0xfde6('0x56')]['id']}},_0x4f1c9f={};_0x4f1c9f[_0xfde6('0x2d')]=_[_0xfde6('0x57')](db[_0xfde6('0x29')][_0xfde6('0x2a')]);_0x4f1c9f['query']=_[_0xfde6('0x57')](_0x188797[_0xfde6('0x30')]);_0x4f1c9f[_0xfde6('0x2e')]=_['intersection'](_0x4f1c9f['model'],_0x4f1c9f[_0xfde6('0x30')]);_0xff02c1[_0xfde6('0x44')]=_[_0xfde6('0x2f')](_0x4f1c9f[_0xfde6('0x2d')],qs[_0xfde6('0x43')](_0x188797['query'][_0xfde6('0x43')]));_0xff02c1[_0xfde6('0x44')]=_0xff02c1[_0xfde6('0x44')][_0xfde6('0x45')]?_0xff02c1['attributes']:_0x4f1c9f[_0xfde6('0x2d')];if(_0x188797['query'][_0xfde6('0x50')]){_0xff02c1[_0xfde6('0x51')]=[{'all':!![]}];}_0xff02c1=_[_0xfde6('0x4c')]({},_0xff02c1,_0x188797[_0xfde6('0x4f')]);return db[_0xfde6('0x29')][_0xfde6('0x58')](_0xff02c1)[_0xfde6('0x23')](handleEntityNotFound(_0x34ba90,null))[_0xfde6('0x23')](respondWithResult(_0x34ba90,null))[_0xfde6('0x54')](handleError(_0x34ba90,null));};exports[_0xfde6('0x59')]=function(_0x555058,_0x1b39bc){return db[_0xfde6('0x29')]['create'](_0x555058[_0xfde6('0x5a')],{})[_0xfde6('0x23')](respondWithResult(_0x1b39bc,0xc9))['catch'](handleError(_0x1b39bc,null));};exports[_0xfde6('0x22')]=function(_0x340dec,_0x178ff5){if(_0x340dec[_0xfde6('0x5a')]['id']){delete _0x340dec[_0xfde6('0x5a')]['id'];}return db[_0xfde6('0x29')][_0xfde6('0x58')]({'where':{'id':_0x340dec[_0xfde6('0x56')]['id']}})[_0xfde6('0x23')](handleEntityNotFound(_0x178ff5,null))[_0xfde6('0x23')](saveUpdates(_0x340dec[_0xfde6('0x5a')],null))['then'](respondWithResult(_0x178ff5,null))['catch'](handleError(_0x178ff5,null));};exports[_0xfde6('0x5b')]=function(_0x2e027e,_0x196266){return db[_0xfde6('0x29')][_0xfde6('0x5b')]()[_0xfde6('0x23')](respondWithResult(_0x196266,null))[_0xfde6('0x54')](handleError(_0x196266,null));};exports[_0xfde6('0x24')]=function(_0x5d699b,_0x13ab70){var _0x281980;return db[_0xfde6('0x29')][_0xfde6('0x58')]({'where':{'id':_0x5d699b[_0xfde6('0x56')]['id']}})[_0xfde6('0x23')](handleEntityNotFound(_0x13ab70,null))[_0xfde6('0x23')](function(_0x1929f7){if(_0x1929f7){return _0x1929f7['destroy']()['then'](function(_0x523916){return _0x523916;});}})[_0xfde6('0x23')](function(_0x1b6964){_0x281980=_0x1b6964;if(_0x1b6964){if(_0x1b6964[_0xfde6('0x5c')]||_0x1b6964[_0xfde6('0x5d')]){return db[_0x1b6964[_0xfde6('0x5c')]?_0xfde6('0x5e'):'Campaign']['find']({'where':{'id':_0x1b6964[_0xfde6('0x5c')]?_0x1b6964['VoiceQueueId']:_0x1b6964['CampaignId']},'attributes':['id',_0xfde6('0x27')],'raw':!![]});}}})[_0xfde6('0x23')](function(_0x43587f){var _0x1de127={};if(_0x43587f){_[_0xfde6('0x4c')](_0x1de127,_[_0xfde6('0x5f')](_0x281980['dataValues'],['createdAt',_0xfde6('0x60'),'id']));_0x1de127['state']=0x15;_0x1de127[_0xfde6('0x61')]='deleted';_0x1de127[_0xfde6('0x62')]=_0x43587f[_0xfde6('0x27')];_0x1de127[_0xfde6('0x63')]=_0x5d699b[_0xfde6('0x64')][_0xfde6('0x27')];_0x1de127[_0xfde6('0x65')]=_0x5d699b[_0xfde6('0x64')]['id'];_0x1de127[_0xfde6('0x66')]=!![];_0x1de127[_0xfde6('0x67')]=moment()[_0xfde6('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x1de127[_0xfde6('0x69')]=_0x281980['phone'];_0x1de127[_0xfde6('0x6a')]=_0x281980[_0xfde6('0x5c')]?_0xfde6('0x6b'):_0xfde6('0x6c');return db['CmContact'][_0xfde6('0x58')]({'where':{'id':_0x1de127['ContactId']},'attributes':[_0xfde6('0x6d'),_0xfde6('0x6e')]})[_0xfde6('0x23')](function(_0x5aa2d6){if(!_[_0xfde6('0x6f')](_0x13ab70)&&!_[_0xfde6('0x6f')](_0x5aa2d6[_0xfde6('0x6d')])){_0x1de127[_0xfde6('0x70')]=_0x5aa2d6[_0xfde6('0x6d')];if(!_[_0xfde6('0x6f')](_0x5aa2d6[_0xfde6('0x6e')])){_0x1de127['calleridname']+='\x20'+_0x5aa2d6[_0xfde6('0x6e')];}}})[_0xfde6('0x71')](function(){return db[_0xfde6('0x72')][_0xfde6('0x59')](_0x1de127);});}})[_0xfde6('0x23')](function(){return _0x13ab70[_0xfde6('0x19')](0xcc)[_0xfde6('0x18')]();})[_0xfde6('0x54')](handleError(_0x13ab70,null));};exports[_0xfde6('0x73')]=function(_0x22565c,_0xfb2181,_0x45b9b1){var _0xa9c471=[];return db[_0xfde6('0x74')][_0xfde6('0x5b')]()['then'](function(_0x3b25f5){_0xa9c471=_['keys'](_0x3b25f5);return _0x22565c['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfde6('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x5d0c3f){if(_0x5d0c3f&&_0x5d0c3f[_0xfde6('0x45')]){return db[_0xfde6('0x76')]['transaction'](function(_0x6396de){var _0x3bc7de={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfde6('0x68')](_0xfde6('0x77'))},'VoiceQueueId':{'$in':_['map'](_0x5d0c3f,'id')},'$or':[{'UserId':null},{'UserId':_0x22565c[_0xfde6('0x64')]['id']}]};var _0x42453a=[];if(_0x22565c[_0xfde6('0x5a')][_0xfde6('0x78')]&&_0x22565c[_0xfde6('0x5a')][_0xfde6('0x78')]===_0xfde6('0x79')){if(!_[_0xfde6('0x7a')](_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')])){_0x3bc7de['id']={'$in':_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')]};}_0x42453a=[[_0xfde6('0x7c'),_0xfde6('0x7d')],['scheduledAt',_0x5d0c3f[0x0][_0xfde6('0x7e')]===_0xfde6('0x7d')?_0xfde6('0x7f'):'ASC'],db['sequelize'][_0xfde6('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xfde6('0x7f')]];}else{if(!_[_0xfde6('0x7a')](_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')])){_0x3bc7de['id']={'$notIn':_0x22565c[_0xfde6('0x5a')][_0xfde6('0x7b')]};}_0x42453a=[[_0xfde6('0x7c'),_0xfde6('0x7f')],[_0xfde6('0x81'),_0x5d0c3f[0x0][_0xfde6('0x7e')]],db[_0xfde6('0x76')][_0xfde6('0x80')](_0xfde6('0x82')),['id',_0xfde6('0x7d')]];}return db[_0xfde6('0x29')][_0xfde6('0x83')]({'attributes':['id','scheduledat'],'where':_0x3bc7de,'order':_0x42453a,'transaction':_0x6396de,'lock':_0x6396de[_0xfde6('0x84')][_0xfde6('0x85')],'include':[{'model':db[_0xfde6('0x74')],'as':'Contact','attributes':_0xa9c471,'include':[{'model':db[_0xfde6('0x86')],'as':_0xfde6('0x87'),'attributes':['id','name']}]},{'model':db[_0xfde6('0x88')],'as':_0xfde6('0x89'),'attributes':['id',_0xfde6('0x27')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xfde6('0x27'),_0xfde6('0x8a')]}]})['then'](function(_0x296098){if(_0x296098){return _0x296098[_0xfde6('0x22')]({'UserId':_0x22565c['user']['id']},{'transaction':_0x6396de});}});});}})['then'](handleEntityNotFound(_0xfb2181,null))['then'](respondWithResult(_0xfb2181,null))['catch'](handleError(_0xfb2181,null));};exports[_0xfde6('0x8b')]=function(_0x351950,_0x1e4d9a,_0x24e9bf){return _0x351950[_0xfde6('0x64')][_0xfde6('0x8c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x2f993d){if(_0x2f993d&&_0x2f993d[_0xfde6('0x45')]){return db[_0xfde6('0x29')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfde6('0x68')](_0xfde6('0x77'))},'VoiceQueueId':{'$in':_[_0xfde6('0x4d')](_0x2f993d,'id')},'$or':[{'UserId':null},{'UserId':_0x351950[_0xfde6('0x64')]['id']}]}});}return 0x0;})[_0xfde6('0x23')](function(_0x44ecb3){if(!_[_0xfde6('0x6f')](_0x44ecb3)&&_[_0xfde6('0x8d')](_0x44ecb3)){return _0x1e4d9a[_0xfde6('0x19')](0xc8)['json']({'contacts':_0x44ecb3});}else{logger[_0xfde6('0x25')](_0xfde6('0x8e'),'getOpenContacts',0x194,_0xfde6('0x8f'));_0x1e4d9a['sendStatus'](0x194);}})[_0xfde6('0x54')](handleError(_0x1e4d9a,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 531c699..6dd10a4 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 _0xfb02=['../../config/environment','./cmHopper.attributes','CmHopper','scheduledat','phone','priority','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x16e105,_0x11269e){var _0x162275=function(_0x3917bf){while(--_0x3917bf){_0x16e105['push'](_0x16e105['shift']());}};_0x162275(++_0x11269e);}(_0xfb02,0x1e6));var _0x2fb0=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xfb02[_0x154cb5];return _0x3f574f;};'use strict';var _=require(_0x2fb0('0x0'));var util=require('util');var logger=require(_0x2fb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2fb0('0x2'));var rp=require(_0x2fb0('0x3'));var fs=require('fs');var path=require(_0x2fb0('0x4'));var rimraf=require(_0x2fb0('0x5'));var config=require(_0x2fb0('0x6'));var attributes=require(_0x2fb0('0x7'));module['exports']=function(_0x2226e1,_0x531b79){return _0x2226e1['define'](_0x2fb0('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x2fb0('0x9'),'fields':[_0x2fb0('0x9')]},{'name':'phone','fields':[_0x2fb0('0xa')]},{'name':_0x2fb0('0xb'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a8=['cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x5bf416,_0x4df544){var _0x597006=function(_0x4a1854){while(--_0x4a1854){_0x5bf416['push'](_0x5bf416['shift']());}};_0x597006(++_0x4df544);}(_0xf9a8,0x1a8));var _0x8f9a=function(_0x24f156,_0xf7f7dc){_0x24f156=_0x24f156-0x0;var _0x9401db=_0xf9a8[_0x24f156];return _0x9401db;};'use strict';var _=require('lodash');var util=require(_0x8f9a('0x0'));var logger=require(_0x8f9a('0x1'))(_0x8f9a('0x2'));var moment=require(_0x8f9a('0x3'));var BPromise=require(_0x8f9a('0x4'));var rp=require(_0x8f9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f9a('0x6'));var config=require(_0x8f9a('0x7'));var attributes=require(_0x8f9a('0x8'));module[_0x8f9a('0x9')]=function(_0x555297,_0x5b5aef){return _0x555297[_0x8f9a('0xa')]('CmHopper',attributes,{'tableName':_0x8f9a('0xb'),'paranoid':![],'indexes':[{'name':_0x8f9a('0xc'),'fields':[_0x8f9a('0xc')]},{'name':_0x8f9a('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x8f9a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index bd332d3..4a1d415 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 _0xa419=['GetContactDialer','describe','sequelize','CmContact','Contact','keys','User','Agent','voicePause','length','includes','push','UserId','all','transaction','CmHopperFinal','destroy','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','order','LOCK','GetCmHopperPreview','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','GetCmHopper','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','CmHopper','find','stringify','catch','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper'];(function(_0x1df9c4,_0x31ed6d){var _0x54a9fe=function(_0x540de8){while(--_0x540de8){_0x1df9c4['push'](_0x1df9c4['shift']());}};_0x54a9fe(++_0x31ed6d);}(_0xa419,0xf0));var _0x9a41=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xa419[_0x602ca8];return _0x26e8ab;};'use strict';var _=require('lodash');var util=require(_0x9a41('0x0'));var moment=require(_0x9a41('0x1'));var BPromise=require(_0x9a41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a41('0x3'));var db=require(_0x9a41('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a41('0x5'))(_0x9a41('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a41('0x7'));var client=jayson[_0x9a41('0x8')][_0x9a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x485e14,_0x322cce,_0x188d3b){return new BPromise(function(_0x1a67dc,_0x22672d){return client[_0x9a41('0xa')](_0x485e14,_0x188d3b)[_0x9a41('0xb')](function(_0xb2e034){logger[_0x9a41('0xc')](_0x9a41('0xd'),_0x322cce,_0x9a41('0xe'));logger[_0x9a41('0xf')](_0x9a41('0x10'),_0x322cce,_0x9a41('0xe'),JSON['stringify'](_0xb2e034));if(_0xb2e034['error']){if(_0xb2e034[_0x9a41('0x11')][_0x9a41('0x12')]===0x1f4){logger[_0x9a41('0x11')]('CmHopper,\x20%s,\x20%s',_0x322cce,_0xb2e034[_0x9a41('0x11')][_0x9a41('0x13')]);return _0x22672d(_0xb2e034[_0x9a41('0x11')][_0x9a41('0x13')]);}logger[_0x9a41('0x11')](_0x9a41('0xd'),_0x322cce,_0xb2e034['error'][_0x9a41('0x13')]);return _0x1a67dc(_0xb2e034[_0x9a41('0x11')]['message']);}else{logger[_0x9a41('0xc')](_0x9a41('0xd'),_0x322cce,_0x9a41('0xe'));_0x1a67dc(_0xb2e034['result'][_0x9a41('0x13')]);}})['catch'](function(_0x4b7f29){logger[_0x9a41('0x11')](_0x9a41('0xd'),_0x322cce,_0x4b7f29);_0x22672d(_0x4b7f29);});});}exports[_0x9a41('0x14')]=function(_0x2994bb){var _0x2470ce=this;return new Promise(function(_0x216afe,_0x2ba003){return db['CmHopper']['findAll']({'raw':_0x2994bb[_0x9a41('0x15')]?_0x2994bb[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x2994bb[_0x9a41('0x15')]?_0x2994bb['options'][_0x9a41('0x17')]||null:null,'attributes':_0x2994bb[_0x9a41('0x15')]?_0x2994bb['options'][_0x9a41('0x18')]||null:null,'limit':_0x2994bb['options']?_0x2994bb[_0x9a41('0x15')][_0x9a41('0x19')]||null:null,'include':_0x2994bb[_0x9a41('0x15')]?_0x2994bb[_0x9a41('0x15')][_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x2994bb[_0x9a41('0x15')][_0x9a41('0x1a')],function(_0x1351f5){return{'model':db[_0x1351f5[_0x9a41('0x1c')]],'as':_0x1351f5['as'],'attributes':_0x1351f5[_0x9a41('0x18')],'include':_0x1351f5[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x1351f5[_0x9a41('0x1a')],function(_0x446b03){return{'model':db[_0x446b03[_0x9a41('0x1c')]],'as':_0x446b03['as'],'attributes':_0x446b03[_0x9a41('0x18')],'include':_0x446b03[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x446b03[_0x9a41('0x1a')],function(_0x3c9801){return{'model':db[_0x3c9801[_0x9a41('0x1c')]],'as':_0x3c9801['as'],'attributes':_0x3c9801[_0x9a41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x21d710){logger['info'](_0x9a41('0x14'),_0x2994bb);logger[_0x9a41('0xf')](_0x9a41('0x14'),_0x2994bb,JSON['stringify'](_0x21d710));_0x216afe(_0x21d710);})['catch'](function(_0x399658){logger[_0x9a41('0x11')](_0x9a41('0x14'),_0x399658[_0x9a41('0x13')],_0x2994bb);_0x2ba003(_0x2470ce[_0x9a41('0x11')](0x1f4,_0x399658[_0x9a41('0x13')]));});});};exports[_0x9a41('0x1d')]=function(_0x239c0b){var _0x56e0f3=this;return new Promise(function(_0x46f068,_0x1d16bb){return db[_0x9a41('0x1e')][_0x9a41('0x1f')]({'raw':_0x239c0b[_0x9a41('0x15')]?_0x239c0b[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x239c0b[_0x9a41('0x15')]?_0x239c0b[_0x9a41('0x15')]['where']||null:null,'attributes':_0x239c0b[_0x9a41('0x15')]?_0x239c0b['options'][_0x9a41('0x18')]||null:null,'include':_0x239c0b[_0x9a41('0x15')]?_0x239c0b[_0x9a41('0x15')][_0x9a41('0x1a')]?_['map'](_0x239c0b[_0x9a41('0x15')]['include'],function(_0x311008){return{'model':db[_0x311008[_0x9a41('0x1c')]],'as':_0x311008['as'],'attributes':_0x311008[_0x9a41('0x18')],'include':_0x311008[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x311008[_0x9a41('0x1a')],function(_0x256bc7){return{'model':db[_0x256bc7[_0x9a41('0x1c')]],'as':_0x256bc7['as'],'attributes':_0x256bc7[_0x9a41('0x18')],'include':_0x256bc7[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x256bc7[_0x9a41('0x1a')],function(_0x149f83){return{'model':db[_0x149f83[_0x9a41('0x1c')]],'as':_0x149f83['as'],'attributes':_0x149f83[_0x9a41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x35aded){logger[_0x9a41('0xc')]('ShowCmHopper',_0x239c0b);logger[_0x9a41('0xf')](_0x9a41('0x1d'),_0x239c0b,JSON[_0x9a41('0x20')](_0x35aded));_0x46f068(_0x35aded);})[_0x9a41('0x21')](function(_0x76f040){logger[_0x9a41('0x11')](_0x9a41('0x1d'),_0x76f040[_0x9a41('0x13')],_0x239c0b);_0x1d16bb(_0x56e0f3['error'](0x1f4,_0x76f040[_0x9a41('0x13')]));});});};exports['CreateCmHopper']=function(_0x2cb402){var _0x47381f=this;return new Promise(function(_0x4329e3,_0x16820e){return db[_0x9a41('0x1e')][_0x9a41('0x22')](_0x2cb402[_0x9a41('0x23')],{'raw':_0x2cb402[_0x9a41('0x15')]?_0x2cb402[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2c47cc){logger[_0x9a41('0xc')]('CreateCmHopper',_0x2cb402);logger['debug'](_0x9a41('0x24'),_0x2cb402,JSON['stringify'](_0x2c47cc));_0x4329e3(_0x2c47cc);})[_0x9a41('0x21')](function(_0x489c6b){logger[_0x9a41('0x11')](_0x9a41('0x24'),_0x489c6b['message'],_0x2cb402);_0x16820e(_0x47381f['error'](0x1f4,_0x489c6b[_0x9a41('0x13')]));});});};exports[_0x9a41('0x25')]=function(_0x566161){var _0x5147a0=this;return new Promise(function(_0x1b6674,_0x3b04c4){return db[_0x9a41('0x1e')][_0x9a41('0x26')](_0x566161['body'],{'raw':_0x566161['options']?_0x566161[_0x9a41('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x566161[_0x9a41('0x15')]?_0x566161[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':_0x566161['options']?_0x566161[_0x9a41('0x15')][_0x9a41('0x18')]||null:null,'limit':_0x566161[_0x9a41('0x15')]?_0x566161[_0x9a41('0x15')]['limit']||null:null})[_0x9a41('0xb')](function(_0x56d3c3){logger[_0x9a41('0xc')](_0x9a41('0x25'),_0x566161);logger['debug'](_0x9a41('0x25'),_0x566161,JSON['stringify'](_0x56d3c3));_0x1b6674(_0x56d3c3);})[_0x9a41('0x21')](function(_0x1622f1){logger[_0x9a41('0x11')](_0x9a41('0x25'),_0x1622f1[_0x9a41('0x13')],_0x566161);_0x3b04c4(_0x5147a0[_0x9a41('0x11')](0x1f4,_0x1622f1[_0x9a41('0x13')]));});});};exports['DestroyCmHopper']=function(_0x4a2669){var _0x20e78d=this;return new Promise(function(_0x590685,_0x16b85a){return db[_0x9a41('0x1e')]['destroy']({'where':_0x4a2669[_0x9a41('0x15')]?_0x4a2669['options'][_0x9a41('0x17')]||null:null})['then'](function(_0x31543a){logger[_0x9a41('0xc')](_0x9a41('0x27'),_0x4a2669);logger['debug'](_0x9a41('0x27'),_0x4a2669,JSON[_0x9a41('0x20')](_0x31543a));_0x590685(_0x31543a);})[_0x9a41('0x21')](function(_0x394cc4){logger[_0x9a41('0x11')](_0x9a41('0x27'),_0x394cc4[_0x9a41('0x13')],_0x4a2669);_0x16b85a(_0x20e78d[_0x9a41('0x11')](0x1f4,_0x394cc4['message']));});});};exports[_0x9a41('0x28')]=function(_0x3d7011){var _0x5ba5d5=this;return new Promise(function(_0x529279,_0x459d1e){return db['CmContact'][_0x9a41('0x29')]()[_0x9a41('0xb')](function(_0x5e44e6){return db[_0x9a41('0x2a')]['transaction'](function(_0x58697b){return db['CmHopper']['findAll']({'where':_0x3d7011['options']?_0x3d7011[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':_0x3d7011[_0x9a41('0x15')]?_0x3d7011[_0x9a41('0x15')]['attributes']||null:null,'limit':_0x3d7011[_0x9a41('0x15')]?_0x3d7011[_0x9a41('0x15')][_0x9a41('0x19')]||null:null,'order':_0x3d7011[_0x9a41('0x15')]?_0x3d7011[_0x9a41('0x15')]['order']||null:null,'transaction':_0x58697b,'lock':_0x58697b['LOCK']['UPDATE'],'include':[{'model':db[_0x9a41('0x2b')],'as':_0x9a41('0x2c'),'attributes':_[_0x9a41('0x2d')](_0x5e44e6)},{'model':db[_0x9a41('0x2e')],'as':_0x9a41('0x2f'),'attributes':['id','name',_0x9a41('0x30')]}]})[_0x9a41('0xb')](function(_0x5b0047){var _0xdcebd8=[];var _0x5f3263=[];for(var _0x95cafd=0x0;_0x95cafd<_0x5b0047[_0x9a41('0x31')];_0x95cafd+=0x1){if(!_0x5f3263[_0x9a41('0x32')](_0x5b0047[_0x95cafd]['UserId'])){_0x5f3263[_0x9a41('0x33')](_0x5b0047[_0x95cafd][_0x9a41('0x34')]);_0xdcebd8[_0x9a41('0x33')](_0x5b0047[_0x95cafd][_0x9a41('0x26')](_0x3d7011['body'],{'transaction':_0x58697b}));}}return BPromise[_0x9a41('0x35')](_0xdcebd8);});})['then'](function(_0xb9bb8b){logger[_0x9a41('0xc')]('GetContactDialer',_0x3d7011);logger['debug'](_0x9a41('0x28'),_0x3d7011,JSON[_0x9a41('0x20')](_0xb9bb8b));_0x529279(_0xb9bb8b);})[_0x9a41('0x21')](function(_0x208bba){logger[_0x9a41('0x11')](_0x9a41('0x28'),_0x208bba[_0x9a41('0x13')],_0x3d7011);_0x459d1e(_0x5ba5d5[_0x9a41('0x11')](0x1f4,_0x208bba['message']));});});});};exports['MoveContactManagedDialer']=function(_0xe6bc6b){var _0xa84278=this;return new Promise(function(_0x30e0e9,_0x29442f){return db[_0x9a41('0x2a')][_0x9a41('0x36')](function(_0x53aa67){return db[_0x9a41('0x37')][_0x9a41('0x22')](_0xe6bc6b[_0x9a41('0x23')],{'raw':_0xe6bc6b[_0x9a41('0x15')]?_0xe6bc6b[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'transaction':_0x53aa67})[_0x9a41('0xb')](function(){return db[_0x9a41('0x1e')][_0x9a41('0x38')]({'where':_0xe6bc6b['options']?_0xe6bc6b[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'transaction':_0x53aa67});});})[_0x9a41('0xb')](function(_0x4fc0ae){logger['info'](_0x9a41('0x39'),_0xe6bc6b);logger[_0x9a41('0xf')](_0x9a41('0x39'),_0xe6bc6b,JSON[_0x9a41('0x20')](_0x4fc0ae));_0x30e0e9(_0x4fc0ae);})[_0x9a41('0x21')](function(_0x1d4f1e){logger[_0x9a41('0x11')](_0x9a41('0x39'),_0x1d4f1e[_0x9a41('0x13')],_0xe6bc6b);_0x29442f(_0xa84278[_0x9a41('0x11')](0x1f4,_0x1d4f1e['message']));});});};exports[_0x9a41('0x3a')]=function(_0x1faada){var _0x3c011e=this;return new Promise(function(_0x3b0b57,_0x58d7da){return db[_0x9a41('0x1e')][_0x9a41('0x3b')]({'raw':_0x1faada[_0x9a41('0x15')]?_0x1faada[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x1faada[_0x9a41('0x15')]?_0x1faada[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':[[db['sequelize']['fn'](_0x9a41('0x3c'),db[_0x9a41('0x2a')]['fn']('IF',db['sequelize'][_0x9a41('0x3d')](_0x9a41('0x3e')+util[_0x9a41('0x3f')](_0x9a41('0x40'),moment()[_0x9a41('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x9a41('0x41')))),'contactsRescheduled']]})[_0x9a41('0xb')](function(_0x496474){logger[_0x9a41('0xc')]('CountReScheduled',_0x1faada);logger[_0x9a41('0xf')]('CountReScheduled',_0x1faada,JSON[_0x9a41('0x20')](_0x496474));_0x3b0b57(_0x496474);})[_0x9a41('0x21')](function(_0x1317dd){logger[_0x9a41('0x11')](_0x9a41('0x3a'),_0x1317dd[_0x9a41('0x13')],_0x1faada);_0x58d7da(_0x3c011e[_0x9a41('0x11')](0x1f4,_0x1317dd[_0x9a41('0x13')]));});});};exports[_0x9a41('0x42')]=function(_0x97ea29){var _0x48c4d3=this;return new Promise(function(_0xd5f45d,_0x1dabaf){return db[_0x9a41('0x2b')][_0x9a41('0x29')]()['then'](function(_0x390a42){return db[_0x9a41('0x2a')][_0x9a41('0x36')](function(_0x5d1b20){return db['CmHopper'][_0x9a41('0x3b')]({'where':_0x97ea29[_0x9a41('0x15')]?_0x97ea29[_0x9a41('0x15')]['where']||null:null,'attributes':_0x97ea29[_0x9a41('0x15')]?_0x97ea29[_0x9a41('0x15')][_0x9a41('0x18')]||null:null,'limit':0x1,'order':_0x97ea29[_0x9a41('0x15')]?_0x97ea29[_0x9a41('0x15')][_0x9a41('0x43')]||null:null,'group':db[_0x9a41('0x1e')]['UserId'],'transaction':_0x5d1b20,'lock':_0x5d1b20[_0x9a41('0x44')]['UPDATE'],'include':_0x97ea29['options']?_0x97ea29[_0x9a41('0x15')][_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x97ea29[_0x9a41('0x15')][_0x9a41('0x1a')],function(_0x8f9bcc){return{'model':db[_0x8f9bcc[_0x9a41('0x1c')]],'as':_0x8f9bcc['as'],'attributes':_0x8f9bcc['attributes'],'include':_0x8f9bcc[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x8f9bcc[_0x9a41('0x1a')],function(_0xe4156){return{'model':db[_0xe4156[_0x9a41('0x1c')]],'as':_0xe4156['as'],'attributes':_0xe4156[_0x9a41('0x18')],'include':_0xe4156[_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0xe4156['include'],function(_0x33bf77){return{'model':db[_0x33bf77[_0x9a41('0x1c')]],'as':_0x33bf77['as'],'attributes':_0x33bf77[_0x9a41('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x2a5c8a){var _0x350411=[];for(var _0x34ebb1=0x0;_0x34ebb1<_0x2a5c8a[_0x9a41('0x31')];_0x34ebb1+=0x1){_0x350411[_0x9a41('0x33')](_0x2a5c8a[_0x34ebb1][_0x9a41('0x26')](_0x97ea29[_0x9a41('0x23')],{'transaction':_0x5d1b20}));}return BPromise[_0x9a41('0x35')](_0x350411);});})[_0x9a41('0xb')](function(_0x5668f4){logger[_0x9a41('0xc')](_0x9a41('0x42'),_0x97ea29);logger[_0x9a41('0xf')](_0x9a41('0x42'),_0x97ea29,JSON[_0x9a41('0x20')](_0x5668f4));_0xd5f45d(_0x5668f4);})[_0x9a41('0x21')](function(_0x4af027){logger[_0x9a41('0x11')]('GetContactRecallMe',_0x4af027[_0x9a41('0x13')],_0x97ea29);_0x1dabaf(_0x48c4d3[_0x9a41('0x11')](0x1f4,_0x4af027[_0x9a41('0x13')]));});});});};exports[_0x9a41('0x45')]=function(_0x4c058f){var _0x139998=this;return new Promise(function(_0x225ed2,_0x35931f){db[_0x9a41('0x2b')][_0x9a41('0x29')]()[_0x9a41('0xb')](function(_0x474a93){return db[_0x9a41('0x1e')][_0x9a41('0x3b')]({'raw':_0x4c058f['options']?_0x4c058f[_0x9a41('0x15')][_0x9a41('0x16')]===undefined?!![]:![]:!![],'where':_0x4c058f[_0x9a41('0x15')]?_0x4c058f[_0x9a41('0x15')][_0x9a41('0x17')]||null:null,'attributes':_0x4c058f['options']?_0x4c058f[_0x9a41('0x15')][_0x9a41('0x18')]||null:null,'limit':_0x4c058f[_0x9a41('0x15')]?_0x4c058f[_0x9a41('0x15')]['limit']||null:null,'include':_0x4c058f[_0x9a41('0x15')]?_0x4c058f['options'][_0x9a41('0x1a')]?_[_0x9a41('0x1b')](_0x4c058f['options']['include'],function(_0x32dc82){return{'model':db[_0x32dc82[_0x9a41('0x1c')]],'as':_0x32dc82['as'],'attributes':_0x32dc82['as']===_0x9a41('0x2c')?_['keys'](_0x474a93):_0x32dc82[_0x9a41('0x18')],'include':_0x32dc82[_0x9a41('0x1a')]?_['map'](_0x32dc82[_0x9a41('0x1a')],function(_0x4a700c){return{'model':db[_0x4a700c[_0x9a41('0x1c')]],'as':_0x4a700c['as'],'attributes':_0x4a700c[_0x9a41('0x18')],'include':_0x4a700c['include']?_[_0x9a41('0x1b')](_0x4a700c[_0x9a41('0x1a')],function(_0x3e795c){return{'model':db[_0x3e795c[_0x9a41('0x1c')]],'as':_0x3e795c['as'],'attributes':_0x3e795c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a41('0xb')](function(_0x544142){logger[_0x9a41('0xc')]('GetCmHopper',_0x4c058f);logger[_0x9a41('0xf')](_0x9a41('0x14'),_0x4c058f,JSON[_0x9a41('0x20')](_0x544142));_0x225ed2(_0x544142);})['catch'](function(_0x135a72){logger[_0x9a41('0x11')](_0x9a41('0x14'),_0x135a72[_0x9a41('0x13')],_0x4c058f);_0x35931f(_0x139998[_0x9a41('0x11')](0x1f4,_0x135a72[_0x9a41('0x13')]));});});});}; \ No newline at end of file +var _0x3e96=['Contact','keys','User','voicePause','includes','push','UserId','all','GetContactDialer','MoveContactManagedDialer','transaction','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','CmContact','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','options','raw','where','attributes','limit','include','map','model','then','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','catch','update','UpdateCmHopper','destroy','DestroyCmHopper','describe','sequelize','order','LOCK','UPDATE'];(function(_0x137378,_0x1470ff){var _0x51d94c=function(_0x319734){while(--_0x319734){_0x137378['push'](_0x137378['shift']());}};_0x51d94c(++_0x1470ff);}(_0x3e96,0x12e));var _0x63e9=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x3e96[_0x1559a5];return _0x17a783;};'use strict';var _=require(_0x63e9('0x0'));var util=require(_0x63e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x63e9('0x2'));var fs=require('fs');var Redis=require(_0x63e9('0x3'));var db=require(_0x63e9('0x4'))['db'];var utils=require(_0x63e9('0x5'));var logger=require(_0x63e9('0x6'))(_0x63e9('0x7'));var config=require(_0x63e9('0x8'));var jayson=require(_0x63e9('0x9'));var client=jayson[_0x63e9('0xa')][_0x63e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e7f5,_0x3a5563,_0x238246){return new BPromise(function(_0x5a4a5e,_0x181957){return client['request'](_0x41e7f5,_0x238246)['then'](function(_0x422c4e){logger[_0x63e9('0xc')](_0x63e9('0xd'),_0x3a5563,_0x63e9('0xe'));logger[_0x63e9('0xf')](_0x63e9('0x10'),_0x3a5563,'request\x20sent',JSON[_0x63e9('0x11')](_0x422c4e));if(_0x422c4e[_0x63e9('0x12')]){if(_0x422c4e[_0x63e9('0x12')][_0x63e9('0x13')]===0x1f4){logger[_0x63e9('0x12')](_0x63e9('0xd'),_0x3a5563,_0x422c4e[_0x63e9('0x12')][_0x63e9('0x14')]);return _0x181957(_0x422c4e[_0x63e9('0x12')]['message']);}logger[_0x63e9('0x12')]('CmHopper,\x20%s,\x20%s',_0x3a5563,_0x422c4e['error'][_0x63e9('0x14')]);return _0x5a4a5e(_0x422c4e['error']['message']);}else{logger[_0x63e9('0xc')](_0x63e9('0xd'),_0x3a5563,_0x63e9('0xe'));_0x5a4a5e(_0x422c4e[_0x63e9('0x15')][_0x63e9('0x14')]);}})['catch'](function(_0x1f7abb){logger[_0x63e9('0x12')]('CmHopper,\x20%s,\x20%s',_0x3a5563,_0x1f7abb);_0x181957(_0x1f7abb);});});}exports[_0x63e9('0x16')]=function(_0x188d74){var _0x59e7ec=this;return new Promise(function(_0x55159e,_0x3d84d6){return db['CmHopper']['findAll']({'raw':_0x188d74['options']?_0x188d74[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x188d74[_0x63e9('0x17')]?_0x188d74[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x188d74['options']?_0x188d74[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':_0x188d74[_0x63e9('0x17')]?_0x188d74[_0x63e9('0x17')][_0x63e9('0x1b')]||null:null,'include':_0x188d74[_0x63e9('0x17')]?_0x188d74[_0x63e9('0x17')][_0x63e9('0x1c')]?_['map'](_0x188d74[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x21c294){return{'model':db[_0x21c294['model']],'as':_0x21c294['as'],'attributes':_0x21c294['attributes'],'include':_0x21c294[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x21c294[_0x63e9('0x1c')],function(_0x20d1e2){return{'model':db[_0x20d1e2[_0x63e9('0x1e')]],'as':_0x20d1e2['as'],'attributes':_0x20d1e2[_0x63e9('0x1a')],'include':_0x20d1e2[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x20d1e2[_0x63e9('0x1c')],function(_0x4673d4){return{'model':db[_0x4673d4['model']],'as':_0x4673d4['as'],'attributes':_0x4673d4[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x1f')](function(_0x57cb32){logger[_0x63e9('0xc')](_0x63e9('0x16'),_0x188d74);logger[_0x63e9('0xf')](_0x63e9('0x16'),_0x188d74,JSON[_0x63e9('0x11')](_0x57cb32));_0x55159e(_0x57cb32);})['catch'](function(_0x56846c){logger['error'](_0x63e9('0x16'),_0x56846c['message'],_0x188d74);_0x3d84d6(_0x59e7ec[_0x63e9('0x12')](0x1f4,_0x56846c[_0x63e9('0x14')]));});});};exports[_0x63e9('0x20')]=function(_0x3aca60){var _0x17b449=this;return new Promise(function(_0xfe5554,_0x11fb98){return db[_0x63e9('0x21')][_0x63e9('0x22')]({'raw':_0x3aca60[_0x63e9('0x17')]?_0x3aca60[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x3aca60['options']?_0x3aca60['options'][_0x63e9('0x19')]||null:null,'attributes':_0x3aca60[_0x63e9('0x17')]?_0x3aca60[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'include':_0x3aca60[_0x63e9('0x17')]?_0x3aca60[_0x63e9('0x17')][_0x63e9('0x1c')]?_['map'](_0x3aca60[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x135d74){return{'model':db[_0x135d74['model']],'as':_0x135d74['as'],'attributes':_0x135d74[_0x63e9('0x1a')],'include':_0x135d74[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x135d74[_0x63e9('0x1c')],function(_0x3f696b){return{'model':db[_0x3f696b[_0x63e9('0x1e')]],'as':_0x3f696b['as'],'attributes':_0x3f696b[_0x63e9('0x1a')],'include':_0x3f696b['include']?_[_0x63e9('0x1d')](_0x3f696b[_0x63e9('0x1c')],function(_0x56d937){return{'model':db[_0x56d937[_0x63e9('0x1e')]],'as':_0x56d937['as'],'attributes':_0x56d937[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x1f')](function(_0x588a06){logger[_0x63e9('0xc')](_0x63e9('0x20'),_0x3aca60);logger[_0x63e9('0xf')](_0x63e9('0x20'),_0x3aca60,JSON[_0x63e9('0x11')](_0x588a06));_0xfe5554(_0x588a06);})['catch'](function(_0x21dab7){logger[_0x63e9('0x12')]('ShowCmHopper',_0x21dab7['message'],_0x3aca60);_0x11fb98(_0x17b449['error'](0x1f4,_0x21dab7['message']));});});};exports[_0x63e9('0x23')]=function(_0x14ade2){var _0x33d83e=this;return new Promise(function(_0x49da29,_0xb2614b){return db['CmHopper'][_0x63e9('0x24')](_0x14ade2[_0x63e9('0x25')],{'raw':_0x14ade2[_0x63e9('0x17')]?_0x14ade2['options']['raw']===undefined?!![]:![]:!![]})[_0x63e9('0x1f')](function(_0xee6a0e){logger[_0x63e9('0xc')](_0x63e9('0x23'),_0x14ade2);logger[_0x63e9('0xf')](_0x63e9('0x23'),_0x14ade2,JSON[_0x63e9('0x11')](_0xee6a0e));_0x49da29(_0xee6a0e);})[_0x63e9('0x26')](function(_0x9b03e3){logger['error'](_0x63e9('0x23'),_0x9b03e3[_0x63e9('0x14')],_0x14ade2);_0xb2614b(_0x33d83e[_0x63e9('0x12')](0x1f4,_0x9b03e3[_0x63e9('0x14')]));});});};exports['UpdateCmHopper']=function(_0x578d12){var _0x2c2b55=this;return new Promise(function(_0x167826,_0x488ad7){return db[_0x63e9('0x21')][_0x63e9('0x27')](_0x578d12[_0x63e9('0x25')],{'raw':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':_0x578d12[_0x63e9('0x17')]?_0x578d12[_0x63e9('0x17')][_0x63e9('0x1b')]||null:null})[_0x63e9('0x1f')](function(_0x2af2ee){logger[_0x63e9('0xc')]('UpdateCmHopper',_0x578d12);logger[_0x63e9('0xf')]('UpdateCmHopper',_0x578d12,JSON['stringify'](_0x2af2ee));_0x167826(_0x2af2ee);})['catch'](function(_0xfd3f2){logger['error'](_0x63e9('0x28'),_0xfd3f2[_0x63e9('0x14')],_0x578d12);_0x488ad7(_0x2c2b55[_0x63e9('0x12')](0x1f4,_0xfd3f2[_0x63e9('0x14')]));});});};exports['DestroyCmHopper']=function(_0x57b598){var _0x3032e7=this;return new Promise(function(_0x5b6e70,_0x401228){return db[_0x63e9('0x21')][_0x63e9('0x29')]({'where':_0x57b598[_0x63e9('0x17')]?_0x57b598['options']['where']||null:null})[_0x63e9('0x1f')](function(_0x5c299a){logger['info'](_0x63e9('0x2a'),_0x57b598);logger[_0x63e9('0xf')](_0x63e9('0x2a'),_0x57b598,JSON[_0x63e9('0x11')](_0x5c299a));_0x5b6e70(_0x5c299a);})[_0x63e9('0x26')](function(_0x13f345){logger[_0x63e9('0x12')](_0x63e9('0x2a'),_0x13f345[_0x63e9('0x14')],_0x57b598);_0x401228(_0x3032e7['error'](0x1f4,_0x13f345[_0x63e9('0x14')]));});});};exports['GetContactDialer']=function(_0x2ff815){var _0x4c78dd=this;return new Promise(function(_0x4ed834,_0x26de03){return db['CmContact'][_0x63e9('0x2b')]()['then'](function(_0x3567c2){return db[_0x63e9('0x2c')]['transaction'](function(_0xe00706){return db[_0x63e9('0x21')]['findAll']({'where':_0x2ff815['options']?_0x2ff815[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x2ff815['options']?_0x2ff815['options'][_0x63e9('0x1a')]||null:null,'limit':_0x2ff815['options']?_0x2ff815['options'][_0x63e9('0x1b')]||null:null,'order':_0x2ff815['options']?_0x2ff815[_0x63e9('0x17')][_0x63e9('0x2d')]||null:null,'transaction':_0xe00706,'lock':_0xe00706[_0x63e9('0x2e')][_0x63e9('0x2f')],'include':[{'model':db['CmContact'],'as':_0x63e9('0x30'),'attributes':_[_0x63e9('0x31')](_0x3567c2)},{'model':db[_0x63e9('0x32')],'as':'Agent','attributes':['id','name',_0x63e9('0x33')]}]})[_0x63e9('0x1f')](function(_0x1464eb){var _0x24bc1d=[];var _0x36a74b=[];for(var _0x320c34=0x0;_0x320c34<_0x1464eb['length'];_0x320c34+=0x1){if(!_0x36a74b[_0x63e9('0x34')](_0x1464eb[_0x320c34]['UserId'])){_0x36a74b[_0x63e9('0x35')](_0x1464eb[_0x320c34][_0x63e9('0x36')]);_0x24bc1d['push'](_0x1464eb[_0x320c34][_0x63e9('0x27')](_0x2ff815[_0x63e9('0x25')],{'transaction':_0xe00706}));}}return BPromise[_0x63e9('0x37')](_0x24bc1d);});})[_0x63e9('0x1f')](function(_0x83e14d){logger[_0x63e9('0xc')](_0x63e9('0x38'),_0x2ff815);logger[_0x63e9('0xf')](_0x63e9('0x38'),_0x2ff815,JSON[_0x63e9('0x11')](_0x83e14d));_0x4ed834(_0x83e14d);})[_0x63e9('0x26')](function(_0x6bf8df){logger[_0x63e9('0x12')](_0x63e9('0x38'),_0x6bf8df[_0x63e9('0x14')],_0x2ff815);_0x26de03(_0x4c78dd[_0x63e9('0x12')](0x1f4,_0x6bf8df[_0x63e9('0x14')]));});});});};exports[_0x63e9('0x39')]=function(_0x294070){var _0x54b454=this;return new Promise(function(_0x2f98c9,_0x40867e){return db[_0x63e9('0x2c')][_0x63e9('0x3a')](function(_0x2b1a27){return db['CmHopperFinal'][_0x63e9('0x24')](_0x294070[_0x63e9('0x25')],{'raw':_0x294070[_0x63e9('0x17')]?_0x294070['options'][_0x63e9('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2b1a27})[_0x63e9('0x1f')](function(){return db[_0x63e9('0x21')][_0x63e9('0x29')]({'where':_0x294070['options']?_0x294070[_0x63e9('0x17')]['where']||null:null,'transaction':_0x2b1a27});});})[_0x63e9('0x1f')](function(_0x544fc3){logger['info'](_0x63e9('0x39'),_0x294070);logger[_0x63e9('0xf')](_0x63e9('0x39'),_0x294070,JSON[_0x63e9('0x11')](_0x544fc3));_0x2f98c9(_0x544fc3);})[_0x63e9('0x26')](function(_0x32f514){logger[_0x63e9('0x12')](_0x63e9('0x39'),_0x32f514['message'],_0x294070);_0x40867e(_0x54b454['error'](0x1f4,_0x32f514[_0x63e9('0x14')]));});});};exports[_0x63e9('0x3b')]=function(_0x51b6d4){var _0xc5d8df=this;return new Promise(function(_0x5edc4e,_0x27efae){return db[_0x63e9('0x21')][_0x63e9('0x3c')]({'raw':_0x51b6d4['options']?_0x51b6d4[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x51b6d4[_0x63e9('0x17')]?_0x51b6d4['options'][_0x63e9('0x19')]||null:null,'attributes':[[db[_0x63e9('0x2c')]['fn'](_0x63e9('0x3d'),db[_0x63e9('0x2c')]['fn']('IF',db['sequelize'][_0x63e9('0x3e')](_0x63e9('0x3f')+util[_0x63e9('0x40')](_0x63e9('0x41'),moment()[_0x63e9('0x40')](_0x63e9('0x42')))+'\x20,\x201,\x20null'))),_0x63e9('0x43')]]})[_0x63e9('0x1f')](function(_0x4dd2cd){logger[_0x63e9('0xc')](_0x63e9('0x3b'),_0x51b6d4);logger['debug'](_0x63e9('0x3b'),_0x51b6d4,JSON['stringify'](_0x4dd2cd));_0x5edc4e(_0x4dd2cd);})[_0x63e9('0x26')](function(_0x3e6fa3){logger[_0x63e9('0x12')](_0x63e9('0x3b'),_0x3e6fa3[_0x63e9('0x14')],_0x51b6d4);_0x27efae(_0xc5d8df[_0x63e9('0x12')](0x1f4,_0x3e6fa3[_0x63e9('0x14')]));});});};exports[_0x63e9('0x44')]=function(_0x234d24){var _0x42ce06=this;return new Promise(function(_0x1e6a68,_0x508945){return db[_0x63e9('0x45')][_0x63e9('0x2b')]()[_0x63e9('0x1f')](function(_0x4bfd11){return db['sequelize']['transaction'](function(_0x56a279){return db[_0x63e9('0x21')][_0x63e9('0x3c')]({'where':_0x234d24[_0x63e9('0x17')]?_0x234d24[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x234d24['options']?_0x234d24[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':0x1,'order':_0x234d24[_0x63e9('0x17')]?_0x234d24[_0x63e9('0x17')]['order']||null:null,'group':db['CmHopper'][_0x63e9('0x36')],'transaction':_0x56a279,'lock':_0x56a279[_0x63e9('0x2e')]['UPDATE'],'include':_0x234d24['options']?_0x234d24[_0x63e9('0x17')][_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x234d24[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x3cf149){return{'model':db[_0x3cf149[_0x63e9('0x1e')]],'as':_0x3cf149['as'],'attributes':_0x3cf149[_0x63e9('0x1a')],'include':_0x3cf149['include']?_['map'](_0x3cf149['include'],function(_0x2125c3){return{'model':db[_0x2125c3['model']],'as':_0x2125c3['as'],'attributes':_0x2125c3[_0x63e9('0x1a')],'include':_0x2125c3[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x2125c3[_0x63e9('0x1c')],function(_0x4b331f){return{'model':db[_0x4b331f[_0x63e9('0x1e')]],'as':_0x4b331f['as'],'attributes':_0x4b331f[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x1f')](function(_0x566ec9){var _0xb836fd=[];for(var _0x52d4da=0x0;_0x52d4da<_0x566ec9['length'];_0x52d4da+=0x1){_0xb836fd[_0x63e9('0x35')](_0x566ec9[_0x52d4da][_0x63e9('0x27')](_0x234d24[_0x63e9('0x25')],{'transaction':_0x56a279}));}return BPromise[_0x63e9('0x37')](_0xb836fd);});})[_0x63e9('0x1f')](function(_0x3d5875){logger[_0x63e9('0xc')](_0x63e9('0x44'),_0x234d24);logger['debug'](_0x63e9('0x44'),_0x234d24,JSON[_0x63e9('0x11')](_0x3d5875));_0x1e6a68(_0x3d5875);})['catch'](function(_0x501e39){logger['error'](_0x63e9('0x44'),_0x501e39[_0x63e9('0x14')],_0x234d24);_0x508945(_0x42ce06['error'](0x1f4,_0x501e39[_0x63e9('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x1a0cb2){var _0x1aa92e=this;return new Promise(function(_0x4fa4e7,_0x2c7add){db[_0x63e9('0x45')]['describe']()[_0x63e9('0x1f')](function(_0x5f3e7c){return db[_0x63e9('0x21')]['findAll']({'raw':_0x1a0cb2[_0x63e9('0x17')]?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x18')]===undefined?!![]:![]:!![],'where':_0x1a0cb2['options']?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x19')]||null:null,'attributes':_0x1a0cb2[_0x63e9('0x17')]?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x1a')]||null:null,'limit':_0x1a0cb2[_0x63e9('0x17')]?_0x1a0cb2['options'][_0x63e9('0x1b')]||null:null,'include':_0x1a0cb2['options']?_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x1a0cb2[_0x63e9('0x17')][_0x63e9('0x1c')],function(_0x54472b){return{'model':db[_0x54472b[_0x63e9('0x1e')]],'as':_0x54472b['as'],'attributes':_0x54472b['as']===_0x63e9('0x30')?_[_0x63e9('0x31')](_0x5f3e7c):_0x54472b[_0x63e9('0x1a')],'include':_0x54472b[_0x63e9('0x1c')]?_[_0x63e9('0x1d')](_0x54472b[_0x63e9('0x1c')],function(_0x16cd41){return{'model':db[_0x16cd41[_0x63e9('0x1e')]],'as':_0x16cd41['as'],'attributes':_0x16cd41[_0x63e9('0x1a')],'include':_0x16cd41['include']?_[_0x63e9('0x1d')](_0x16cd41['include'],function(_0x2f07a2){return{'model':db[_0x2f07a2[_0x63e9('0x1e')]],'as':_0x2f07a2['as'],'attributes':_0x2f07a2[_0x63e9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x430684){logger['info'](_0x63e9('0x16'),_0x1a0cb2);logger['debug']('GetCmHopper',_0x1a0cb2,JSON[_0x63e9('0x11')](_0x430684));_0x4fa4e7(_0x430684);})[_0x63e9('0x26')](function(_0x1f0c05){logger[_0x63e9('0x12')](_0x63e9('0x16'),_0x1f0c05['message'],_0x1a0cb2);_0x2c7add(_0x1aa92e[_0x63e9('0x12')](0x1f4,_0x1f0c05[_0x63e9('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9ca83ec..9144519 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 _0xd8d7=['create','/preview','getPreview','update','delete','exports','multer','util','path','connect-timeout','express','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','getOpenContacts','/:id','show','post'];(function(_0x19bf9c,_0xa5ef2){var _0x2fd6a6=function(_0x1662fc){while(--_0x1662fc){_0x19bf9c['push'](_0x19bf9c['shift']());}};_0x2fd6a6(++_0xa5ef2);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0xd8d7[_0x1a37e3];return _0x4db78a;};'use strict';var multer=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var path=require(_0x7d8d('0x2'));var timeout=require(_0x7d8d('0x3'));var express=require(_0x7d8d('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7d8d('0x5'));router['get']('/',auth[_0x7d8d('0x6')](),controller[_0x7d8d('0x7')]);router[_0x7d8d('0x8')](_0x7d8d('0x9'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0xa')]);router[_0x7d8d('0x8')]('/opencontacts',auth[_0x7d8d('0x6')](),controller[_0x7d8d('0xb')]);router[_0x7d8d('0x8')](_0x7d8d('0xc'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0xd')]);router[_0x7d8d('0xe')]('/',auth['isAuthenticated'](),controller[_0x7d8d('0xf')]);router[_0x7d8d('0xe')](_0x7d8d('0x10'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0x11')]);router['put'](_0x7d8d('0xc'),auth[_0x7d8d('0x6')](),controller[_0x7d8d('0x12')]);router[_0x7d8d('0x13')](_0x7d8d('0xc'),auth[_0x7d8d('0x6')](),controller['destroy']);module[_0x7d8d('0x14')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/opencontacts','/:id','post','/preview','getPreview'];(function(_0x40b3a5,_0x1dac63){var _0x573076=function(_0x28cb05){while(--_0x28cb05){_0x40b3a5['push'](_0x40b3a5['shift']());}};_0x573076(++_0x1dac63);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24c970,_0x1199ef){_0x24c970=_0x24c970-0x0;var _0x48f700=_0x5f2f[_0x24c970];return _0x48f700;};'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('./cmHopper.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['getOpenContacts']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5f2('0xe')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 3d125f9..75e4608 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 _0x3892=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x1b886d,_0x35ace0){var _0x318c4d=function(_0x220360){while(--_0x220360){_0x1b886d['push'](_0x1b886d['shift']());}};_0x318c4d(++_0x35ace0);}(_0x3892,0xde));var _0x2389=function(_0x4300b3,_0x38ee7f){_0x4300b3=_0x4300b3-0x0;var _0x8620ab=_0x3892[_0x4300b3];return _0x8620ab;};'use strict';var moment=require(_0x2389('0x0'));var Sequelize=require(_0x2389('0x1'));module[_0x2389('0x2')]={'CmHopperId':{'type':Sequelize[_0x2389('0x3')]},'phone':{'type':Sequelize[_0x2389('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2389('0x5')],'defaultValue':moment()[_0x2389('0x6')](_0x2389('0x7'))},'countbusyretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ea6=['exports','INTEGER','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x43a6e0,_0x1de407){var _0x4109f7=function(_0x176b86){while(--_0x176b86){_0x43a6e0['push'](_0x43a6e0['shift']());}};_0x4109f7(++_0x1de407);}(_0x9ea6,0x9b));var _0x69ea=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9ea6[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0x69ea('0x0'));var Sequelize=require('sequelize');module[_0x69ea('0x1')]={'CmHopperId':{'type':Sequelize[_0x69ea('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x69ea('0x3'))},'countbusyretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x69ea('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 484aed5..cc0e52a 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 _0x4672=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','then','destroy','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x4672,0x18a));var _0x2467=function(_0x52835d,_0x47b9b3){_0x52835d=_0x52835d-0x0;var _0x5724c0=_0x4672[_0x52835d];return _0x5724c0;};'use strict';var pdf=require(_0x2467('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2467('0x1'));var zipdir=require(_0x2467('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2467('0x3'));var moment=require('moment');var BPromise=require(_0x2467('0x4'));var Mustache=require(_0x2467('0x5'));var util=require(_0x2467('0x6'));var path=require(_0x2467('0x7'));var sox=require('sox');var csv=require(_0x2467('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2467('0x9'));var squel=require(_0x2467('0xa'));var crypto=require(_0x2467('0xb'));var jsforce=require(_0x2467('0xc'));var deskjs=require(_0x2467('0xd'));var toCsv=require(_0x2467('0x8'));var querystring=require(_0x2467('0xe'));var Papa=require(_0x2467('0xf'));var Redis=require(_0x2467('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2467('0x11'));var as=require(_0x2467('0x12'));var hardwareService=require(_0x2467('0x13'));var logger=require(_0x2467('0x14'))('api');var utils=require(_0x2467('0x15'));var config=require(_0x2467('0x16'));var licenseUtil=require(_0x2467('0x17'));var db=require(_0x2467('0x18'))['db'];function respondWithStatusCode(_0x348f51,_0x381f99){_0x381f99=_0x381f99||0xcc;return function(_0x5ac925){if(_0x5ac925){return _0x348f51[_0x2467('0x19')](_0x381f99);}return _0x348f51[_0x2467('0x1a')](_0x381f99)[_0x2467('0x1b')]();};}function respondWithResult(_0xa9966d,_0x37df20){_0x37df20=_0x37df20||0xc8;return function(_0x265d7e){if(_0x265d7e){return _0xa9966d[_0x2467('0x1a')](_0x37df20)['json'](_0x265d7e);}};}function respondWithFilteredResult(_0x520ad9,_0x4eab72){return function(_0x2cab68){if(_0x2cab68){var _0xe72566=_0x2cab68[_0x2467('0x1c')],_0x239ef0=_0x4eab72['offset'],_0x593994=_0x4eab72[_0x2467('0x1d')]+_0x4eab72[_0x2467('0x1e')],_0x34a9f4;if(_0x593994>=_0xe72566){_0x593994=_0xe72566;_0x34a9f4=0xc8;}else{_0x34a9f4=0xce;}_0x520ad9[_0x2467('0x1a')](_0x34a9f4);return _0x520ad9[_0x2467('0x1f')](_0x2467('0x20'),_0x239ef0+'-'+_0x593994+'/'+_0xe72566)[_0x2467('0x21')](_0x2cab68);}return null;};}function patchUpdates(_0x1081e5){return function(_0x5ecb91){try{jsonpatch['apply'](_0x5ecb91,_0x1081e5,!![]);}catch(_0x3f32a8){return BPromise['reject'](_0x3f32a8);}return _0x5ecb91[_0x2467('0x22')]();};}function saveUpdates(_0xa16c1a,_0x50e555){return function(_0x51633c){if(_0x51633c){return _0x51633c[_0x2467('0x23')](_0xa16c1a)[_0x2467('0x24')](function(_0x5a2acc){return _0x5a2acc;});}return null;};}function removeEntity(_0x1217e0,_0x1ed72b){return function(_0xb35e27){if(_0xb35e27){return _0xb35e27[_0x2467('0x25')]()['then'](function(){var _0x2ebd45=_0xb35e27['get']({'plain':!![]});var _0x5e5621=_0x2467('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e5621,'resourceId':_0x2ebd45['id']}})['then'](function(){return _0xb35e27;});})[_0x2467('0x24')](function(){_0x1217e0[_0x2467('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb8f34f,_0x1f3126){return function(_0x2cd7a6){if(!_0x2cd7a6){_0xb8f34f[_0x2467('0x19')](0x194);}return _0x2cd7a6;};}function handleError(_0x18f045,_0x10e3cb){_0x10e3cb=_0x10e3cb||0x1f4;return function(_0x4aeb8b){logger[_0x2467('0x27')](_0x4aeb8b[_0x2467('0x28')]);if(_0x4aeb8b[_0x2467('0x29')]){delete _0x4aeb8b[_0x2467('0x29')];}_0x18f045[_0x2467('0x1a')](_0x10e3cb)[_0x2467('0x2a')](_0x4aeb8b);};}exports[_0x2467('0x2b')]=function(_0x42bc8e,_0x4da106){var _0xa793b2={},_0x1de49c={},_0x1dffa0={'count':0x0,'rows':[]};var _0x146562=_[_0x2467('0x2c')](db[_0x2467('0x2d')][_0x2467('0x2e')],function(_0x4d7632){return{'name':_0x4d7632[_0x2467('0x2f')],'type':_0x4d7632['type']['key']};});_0x1de49c[_0x2467('0x30')]=_['map'](_0x146562,'name');_0x1de49c['query']=_[_0x2467('0x31')](_0x42bc8e[_0x2467('0x32')]);_0x1de49c[_0x2467('0x33')]=_[_0x2467('0x34')](_0x1de49c['model'],_0x1de49c[_0x2467('0x32')]);_0xa793b2[_0x2467('0x35')]=_[_0x2467('0x34')](_0x1de49c['model'],qs[_0x2467('0x36')](_0x42bc8e['query']['fields']));_0xa793b2[_0x2467('0x35')]=_0xa793b2[_0x2467('0x35')][_0x2467('0x37')]?_0xa793b2[_0x2467('0x35')]:_0x1de49c[_0x2467('0x30')];if(!_0x42bc8e['query']['hasOwnProperty']('nolimit')){_0xa793b2[_0x2467('0x1e')]=qs[_0x2467('0x1e')](_0x42bc8e[_0x2467('0x32')][_0x2467('0x1e')]);_0xa793b2[_0x2467('0x1d')]=qs[_0x2467('0x1d')](_0x42bc8e[_0x2467('0x32')][_0x2467('0x1d')]);}_0xa793b2[_0x2467('0x38')]=qs['sort'](_0x42bc8e[_0x2467('0x32')][_0x2467('0x39')]);_0xa793b2[_0x2467('0x3a')]=qs[_0x2467('0x33')](_[_0x2467('0x3b')](_0x42bc8e[_0x2467('0x32')],_0x1de49c['filters']),_0x146562);if(_0x42bc8e['query'][_0x2467('0x3c')]){_0xa793b2[_0x2467('0x3a')]=_[_0x2467('0x3d')](_0xa793b2[_0x2467('0x3a')],{'$or':_[_0x2467('0x2c')](_0x146562,function(_0x5458e9){if(_0x5458e9[_0x2467('0x3e')]!=='VIRTUAL'){var _0x4ca1e6={};_0x4ca1e6[_0x5458e9[_0x2467('0x29')]]={'$like':'%'+_0x42bc8e[_0x2467('0x32')][_0x2467('0x3c')]+'%'};return _0x4ca1e6;}})});}_0xa793b2=_[_0x2467('0x3d')]({},_0xa793b2,_0x42bc8e[_0x2467('0x3f')]);var _0xb48c02={'where':_0xa793b2[_0x2467('0x3a')]};return db[_0x2467('0x2d')][_0x2467('0x1c')](_0xb48c02)['then'](function(_0x277ceb){_0x1dffa0['count']=_0x277ceb;if(_0x42bc8e['query'][_0x2467('0x40')]){_0xa793b2[_0x2467('0x41')]=[{'all':!![]}];}return db[_0x2467('0x2d')]['findAll'](_0xa793b2);})['then'](function(_0x5f5cb3){_0x1dffa0[_0x2467('0x42')]=_0x5f5cb3;return _0x1dffa0;})['then'](respondWithFilteredResult(_0x4da106,_0xa793b2))[_0x2467('0x43')](handleError(_0x4da106,null));};exports[_0x2467('0x44')]=function(_0x2f8b67,_0x2f39c8){var _0xcf9f24={'raw':!![],'where':{'id':_0x2f8b67[_0x2467('0x45')]['id']}},_0x175412={};_0x175412[_0x2467('0x30')]=_['keys'](db[_0x2467('0x2d')]['rawAttributes']);_0x175412[_0x2467('0x32')]=_[_0x2467('0x31')](_0x2f8b67['query']);_0x175412[_0x2467('0x33')]=_[_0x2467('0x34')](_0x175412['model'],_0x175412[_0x2467('0x32')]);_0xcf9f24['attributes']=_[_0x2467('0x34')](_0x175412['model'],qs['fields'](_0x2f8b67[_0x2467('0x32')][_0x2467('0x36')]));_0xcf9f24[_0x2467('0x35')]=_0xcf9f24[_0x2467('0x35')][_0x2467('0x37')]?_0xcf9f24[_0x2467('0x35')]:_0x175412[_0x2467('0x30')];if(_0x2f8b67[_0x2467('0x32')][_0x2467('0x40')]){_0xcf9f24[_0x2467('0x41')]=[{'all':!![]}];}_0xcf9f24=_[_0x2467('0x3d')]({},_0xcf9f24,_0x2f8b67[_0x2467('0x3f')]);return db['CmHopperAdditionalPhone']['find'](_0xcf9f24)[_0x2467('0x24')](handleEntityNotFound(_0x2f39c8,null))[_0x2467('0x24')](respondWithResult(_0x2f39c8,null))[_0x2467('0x43')](handleError(_0x2f39c8,null));};exports[_0x2467('0x46')]=function(_0x411a40,_0x41c64e){return db[_0x2467('0x2d')][_0x2467('0x46')](_0x411a40['body'],{})[_0x2467('0x24')](function(_0x42ca44){var _0x554011=_0x411a40[_0x2467('0x47')]['get']({'plain':!![]});if(!_0x554011)throw new Error(_0x2467('0x48'));if(_0x554011[_0x2467('0x49')]===_0x2467('0x47')){var _0x43a437=_0x42ca44[_0x2467('0x4a')]({'plain':!![]});var _0x2a9ca6=_0x2467('0x26');return db[_0x2467('0x4b')][_0x2467('0x4c')]({'where':{'name':_0x2a9ca6,'userProfileId':_0x554011[_0x2467('0x4d')]},'raw':!![]})[_0x2467('0x24')](function(_0x5d938f){if(_0x5d938f&&_0x5d938f[_0x2467('0x4e')]===0x0){return db[_0x2467('0x4f')][_0x2467('0x46')]({'name':_0x43a437['name'],'resourceId':_0x43a437['id'],'type':_0x5d938f[_0x2467('0x29')],'sectionId':_0x5d938f['id']},{})['then'](function(){return _0x42ca44;});}else{return _0x42ca44;}})['catch'](function(_0x5d43ed){logger[_0x2467('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d43ed);throw _0x5d43ed;});}return _0x42ca44;})[_0x2467('0x24')](respondWithResult(_0x41c64e,0xc9))['catch'](handleError(_0x41c64e,null));};exports['update']=function(_0x40c119,_0x36e32b){if(_0x40c119['body']['id']){delete _0x40c119[_0x2467('0x50')]['id'];}return db[_0x2467('0x2d')][_0x2467('0x4c')]({'where':{'id':_0x40c119['params']['id']}})[_0x2467('0x24')](handleEntityNotFound(_0x36e32b,null))[_0x2467('0x24')](saveUpdates(_0x40c119[_0x2467('0x50')],null))[_0x2467('0x24')](respondWithResult(_0x36e32b,null))['catch'](handleError(_0x36e32b,null));};exports[_0x2467('0x25')]=function(_0x3e849d,_0xd95419){return db['CmHopperAdditionalPhone'][_0x2467('0x4c')]({'where':{'id':_0x3e849d[_0x2467('0x45')]['id']}})[_0x2467('0x24')](handleEntityNotFound(_0xd95419,null))[_0x2467('0x24')](removeEntity(_0xd95419,null))[_0x2467('0x43')](handleError(_0xd95419,null));}; \ No newline at end of file +var _0x5398=['../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5398,0xe2));var _0x8539=function(_0x3aaf82,_0x2982e4){_0x3aaf82=_0x3aaf82-0x0;var _0x2ee54f=_0x5398[_0x3aaf82];return _0x2ee54f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8539('0x0'));var rimraf=require(_0x8539('0x1'));var zipdir=require(_0x8539('0x2'));var jsonpatch=require(_0x8539('0x3'));var rp=require(_0x8539('0x4'));var moment=require(_0x8539('0x5'));var BPromise=require(_0x8539('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8539('0x7'));var sox=require(_0x8539('0x8'));var csv=require(_0x8539('0x9'));var ejs=require(_0x8539('0xa'));var fs=require('fs');var _=require(_0x8539('0xb'));var squel=require(_0x8539('0xc'));var crypto=require('crypto');var jsforce=require(_0x8539('0xd'));var deskjs=require(_0x8539('0xe'));var toCsv=require(_0x8539('0x9'));var querystring=require(_0x8539('0xf'));var Papa=require(_0x8539('0x10'));var Redis=require(_0x8539('0x11'));var authService=require(_0x8539('0x12'));var qs=require(_0x8539('0x13'));var as=require(_0x8539('0x14'));var hardwareService=require(_0x8539('0x15'));var logger=require('../../config/logger')(_0x8539('0x16'));var utils=require(_0x8539('0x17'));var config=require(_0x8539('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8539('0x19'))['db'];function respondWithStatusCode(_0x377b14,_0x4d841){_0x4d841=_0x4d841||0xcc;return function(_0x25462b){if(_0x25462b){return _0x377b14['sendStatus'](_0x4d841);}return _0x377b14['status'](_0x4d841)[_0x8539('0x1a')]();};}function respondWithResult(_0x19ec7e,_0x8d56c9){_0x8d56c9=_0x8d56c9||0xc8;return function(_0x216bce){if(_0x216bce){return _0x19ec7e[_0x8539('0x1b')](_0x8d56c9)['json'](_0x216bce);}};}function respondWithFilteredResult(_0x52b95b,_0x27e479){return function(_0x24aab1){if(_0x24aab1){var _0x334def=_0x24aab1[_0x8539('0x1c')],_0x1d30e2=_0x27e479['offset'],_0x159008=_0x27e479[_0x8539('0x1d')]+_0x27e479['limit'],_0x29bf43;if(_0x159008>=_0x334def){_0x159008=_0x334def;_0x29bf43=0xc8;}else{_0x29bf43=0xce;}_0x52b95b['status'](_0x29bf43);return _0x52b95b['set'](_0x8539('0x1e'),_0x1d30e2+'-'+_0x159008+'/'+_0x334def)[_0x8539('0x1f')](_0x24aab1);}return null;};}function patchUpdates(_0x7b65df){return function(_0x260a2c){try{jsonpatch[_0x8539('0x20')](_0x260a2c,_0x7b65df,!![]);}catch(_0x324850){return BPromise[_0x8539('0x21')](_0x324850);}return _0x260a2c[_0x8539('0x22')]();};}function saveUpdates(_0x1cce5a,_0x3360b1){return function(_0x528839){if(_0x528839){return _0x528839[_0x8539('0x23')](_0x1cce5a)['then'](function(_0x3b0e38){return _0x3b0e38;});}return null;};}function removeEntity(_0x56e1b7,_0x14befc){return function(_0x59a14e){if(_0x59a14e){return _0x59a14e[_0x8539('0x24')]()[_0x8539('0x25')](function(){var _0xa3cf26=_0x59a14e[_0x8539('0x26')]({'plain':!![]});var _0x28e1da=_0x8539('0x27');return db[_0x8539('0x28')]['destroy']({'where':{'type':_0x28e1da,'resourceId':_0xa3cf26['id']}})[_0x8539('0x25')](function(){return _0x59a14e;});})['then'](function(){_0x56e1b7['status'](0xcc)[_0x8539('0x1a')]();});}};}function handleEntityNotFound(_0x28792d,_0x2f52cc){return function(_0x20d902){if(!_0x20d902){_0x28792d['sendStatus'](0x194);}return _0x20d902;};}function handleError(_0x4f04e8,_0x600cb6){_0x600cb6=_0x600cb6||0x1f4;return function(_0x327fc9){logger['error'](_0x327fc9[_0x8539('0x29')]);if(_0x327fc9[_0x8539('0x2a')]){delete _0x327fc9[_0x8539('0x2a')];}_0x4f04e8[_0x8539('0x1b')](_0x600cb6)[_0x8539('0x2b')](_0x327fc9);};}exports[_0x8539('0x2c')]=function(_0x452700,_0x60346c){var _0x2a6fba={},_0xedb079={},_0x438a5b={'count':0x0,'rows':[]};var _0x1ae9b9=_[_0x8539('0x2d')](db[_0x8539('0x2e')]['rawAttributes'],function(_0x7aae36){return{'name':_0x7aae36[_0x8539('0x2f')],'type':_0x7aae36[_0x8539('0x30')]['key']};});_0xedb079[_0x8539('0x31')]=_[_0x8539('0x2d')](_0x1ae9b9,'name');_0xedb079[_0x8539('0x32')]=_['keys'](_0x452700[_0x8539('0x32')]);_0xedb079[_0x8539('0x33')]=_[_0x8539('0x34')](_0xedb079[_0x8539('0x31')],_0xedb079[_0x8539('0x32')]);_0x2a6fba[_0x8539('0x35')]=_[_0x8539('0x34')](_0xedb079[_0x8539('0x31')],qs[_0x8539('0x36')](_0x452700['query'][_0x8539('0x36')]));_0x2a6fba[_0x8539('0x35')]=_0x2a6fba[_0x8539('0x35')][_0x8539('0x37')]?_0x2a6fba[_0x8539('0x35')]:_0xedb079[_0x8539('0x31')];if(!_0x452700[_0x8539('0x32')][_0x8539('0x38')](_0x8539('0x39'))){_0x2a6fba[_0x8539('0x3a')]=qs['limit'](_0x452700[_0x8539('0x32')]['limit']);_0x2a6fba[_0x8539('0x1d')]=qs[_0x8539('0x1d')](_0x452700['query']['offset']);}_0x2a6fba[_0x8539('0x3b')]=qs[_0x8539('0x3c')](_0x452700[_0x8539('0x32')][_0x8539('0x3c')]);_0x2a6fba['where']=qs['filters'](_['pick'](_0x452700[_0x8539('0x32')],_0xedb079[_0x8539('0x33')]),_0x1ae9b9);if(_0x452700[_0x8539('0x32')][_0x8539('0x3d')]){_0x2a6fba[_0x8539('0x3e')]=_[_0x8539('0x3f')](_0x2a6fba[_0x8539('0x3e')],{'$or':_[_0x8539('0x2d')](_0x1ae9b9,function(_0x931bd7){if(_0x931bd7[_0x8539('0x30')]!==_0x8539('0x40')){var _0x1643c8={};_0x1643c8[_0x931bd7[_0x8539('0x2a')]]={'$like':'%'+_0x452700['query'][_0x8539('0x3d')]+'%'};return _0x1643c8;}})});}_0x2a6fba=_[_0x8539('0x3f')]({},_0x2a6fba,_0x452700[_0x8539('0x41')]);var _0x10232b={'where':_0x2a6fba[_0x8539('0x3e')]};return db[_0x8539('0x2e')][_0x8539('0x1c')](_0x10232b)[_0x8539('0x25')](function(_0x3214e8){_0x438a5b[_0x8539('0x1c')]=_0x3214e8;if(_0x452700[_0x8539('0x32')][_0x8539('0x42')]){_0x2a6fba['include']=[{'all':!![]}];}return db[_0x8539('0x2e')][_0x8539('0x43')](_0x2a6fba);})['then'](function(_0x534202){_0x438a5b[_0x8539('0x44')]=_0x534202;return _0x438a5b;})['then'](respondWithFilteredResult(_0x60346c,_0x2a6fba))['catch'](handleError(_0x60346c,null));};exports['show']=function(_0x3c9f47,_0x3a69cc){var _0x24a388={'raw':!![],'where':{'id':_0x3c9f47[_0x8539('0x45')]['id']}},_0x26145b={};_0x26145b['model']=_[_0x8539('0x46')](db['CmHopperAdditionalPhone'][_0x8539('0x47')]);_0x26145b[_0x8539('0x32')]=_[_0x8539('0x46')](_0x3c9f47[_0x8539('0x32')]);_0x26145b['filters']=_[_0x8539('0x34')](_0x26145b[_0x8539('0x31')],_0x26145b[_0x8539('0x32')]);_0x24a388[_0x8539('0x35')]=_[_0x8539('0x34')](_0x26145b[_0x8539('0x31')],qs[_0x8539('0x36')](_0x3c9f47['query']['fields']));_0x24a388[_0x8539('0x35')]=_0x24a388[_0x8539('0x35')][_0x8539('0x37')]?_0x24a388[_0x8539('0x35')]:_0x26145b[_0x8539('0x31')];if(_0x3c9f47['query'][_0x8539('0x42')]){_0x24a388['include']=[{'all':!![]}];}_0x24a388=_[_0x8539('0x3f')]({},_0x24a388,_0x3c9f47[_0x8539('0x41')]);return db[_0x8539('0x2e')]['find'](_0x24a388)[_0x8539('0x25')](handleEntityNotFound(_0x3a69cc,null))['then'](respondWithResult(_0x3a69cc,null))[_0x8539('0x48')](handleError(_0x3a69cc,null));};exports[_0x8539('0x49')]=function(_0x124524,_0xe3e794){return db[_0x8539('0x2e')][_0x8539('0x49')](_0x124524[_0x8539('0x4a')],{})[_0x8539('0x25')](function(_0x5a81be){var _0x2d11b8=_0x124524[_0x8539('0x4b')]['get']({'plain':!![]});if(!_0x2d11b8)throw new Error(_0x8539('0x4c'));if(_0x2d11b8[_0x8539('0x4d')]===_0x8539('0x4b')){var _0x3814de=_0x5a81be[_0x8539('0x26')]({'plain':!![]});var _0x559c9d=_0x8539('0x27');return db[_0x8539('0x4e')]['find']({'where':{'name':_0x559c9d,'userProfileId':_0x2d11b8[_0x8539('0x4f')]},'raw':!![]})[_0x8539('0x25')](function(_0x2f6cef){if(_0x2f6cef&&_0x2f6cef[_0x8539('0x50')]===0x0){return db[_0x8539('0x28')][_0x8539('0x49')]({'name':_0x3814de[_0x8539('0x2a')],'resourceId':_0x3814de['id'],'type':_0x2f6cef[_0x8539('0x2a')],'sectionId':_0x2f6cef['id']},{})[_0x8539('0x25')](function(){return _0x5a81be;});}else{return _0x5a81be;}})[_0x8539('0x48')](function(_0x2e266d){logger[_0x8539('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e266d);throw _0x2e266d;});}return _0x5a81be;})[_0x8539('0x25')](respondWithResult(_0xe3e794,0xc9))[_0x8539('0x48')](handleError(_0xe3e794,null));};exports[_0x8539('0x23')]=function(_0x47d2bc,_0x41ea0b){if(_0x47d2bc['body']['id']){delete _0x47d2bc['body']['id'];}return db[_0x8539('0x2e')][_0x8539('0x52')]({'where':{'id':_0x47d2bc[_0x8539('0x45')]['id']}})['then'](handleEntityNotFound(_0x41ea0b,null))[_0x8539('0x25')](saveUpdates(_0x47d2bc['body'],null))['then'](respondWithResult(_0x41ea0b,null))[_0x8539('0x48')](handleError(_0x41ea0b,null));};exports[_0x8539('0x24')]=function(_0x2310fe,_0x23acaf){return db[_0x8539('0x2e')]['find']({'where':{'id':_0x2310fe[_0x8539('0x45')]['id']}})[_0x8539('0x25')](handleEntityNotFound(_0x23acaf,null))[_0x8539('0x25')](removeEntity(_0x23acaf,null))['catch'](handleError(_0x23acaf,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4cf8daa..3644548 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 _0xe3dc=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x44678a,_0x46cb70){var _0x8a8bf8=function(_0x1dfdb6){while(--_0x1dfdb6){_0x44678a['push'](_0x44678a['shift']());}};_0x8a8bf8(++_0x46cb70);}(_0xe3dc,0x14c));var _0xce3d=function(_0x57a0a4,_0x5589c1){_0x57a0a4=_0x57a0a4-0x0;var _0x1b0ec5=_0xe3dc[_0x57a0a4];return _0x1b0ec5;};'use strict';var _=require(_0xce3d('0x0'));var util=require(_0xce3d('0x1'));var logger=require(_0xce3d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xce3d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce3d('0x4'));var config=require(_0xce3d('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xce3d('0x6')]=function(_0x8c7dd6,_0x15a8b7){return _0x8c7dd6[_0xce3d('0x7')](_0xce3d('0x8'),attributes,{'tableName':_0xce3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2624=['define','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperAdditionalPhone.attributes','exports'];(function(_0xf09650,_0x13afc6){var _0x438aa9=function(_0x429c74){while(--_0x429c74){_0xf09650['push'](_0xf09650['shift']());}};_0x438aa9(++_0x13afc6);}(_0x2624,0x1d0));var _0x4262=function(_0x114bd4,_0x4d6c1e){_0x114bd4=_0x114bd4-0x0;var _0x328766=_0x2624[_0x114bd4];return _0x328766;};'use strict';var _=require(_0x4262('0x0'));var util=require('util');var logger=require(_0x4262('0x1'))(_0x4262('0x2'));var moment=require(_0x4262('0x3'));var BPromise=require(_0x4262('0x4'));var rp=require(_0x4262('0x5'));var fs=require('fs');var path=require(_0x4262('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4262('0x7'));module[_0x4262('0x8')]=function(_0x391aec,_0x4516bd){return _0x391aec[_0x4262('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x4262('0xa'),'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 a71cf89..8d0f776 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 _0xeafd=['IncrementPreviewCounters','field','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countabandonedretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','countcongestionretry','createdAt','updatedAt','hopperToAdd','additionalToHop','transaction','update'];(function(_0x2f13c3,_0x427892){var _0x218c3a=function(_0x490033){while(--_0x490033){_0x2f13c3['push'](_0x2f13c3['shift']());}};_0x218c3a(++_0x427892);}(_0xeafd,0x76));var _0xdeaf=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xeafd[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0xdeaf('0x0'));var util=require(_0xdeaf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdeaf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeaf('0x3'));var logger=require(_0xdeaf('0x4'))(_0xdeaf('0x5'));var config=require(_0xdeaf('0x6'));var jayson=require(_0xdeaf('0x7'));var client=jayson[_0xdeaf('0x8')][_0xdeaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593a74,_0x46bab3,_0x426134){return new BPromise(function(_0x12e3c5,_0x438399){return client['request'](_0x593a74,_0x426134)[_0xdeaf('0xa')](function(_0x597e49){logger['info'](_0xdeaf('0xb'),_0x46bab3,'request\x20sent');logger[_0xdeaf('0xc')](_0xdeaf('0xd'),_0x46bab3,'request\x20sent',JSON[_0xdeaf('0xe')](_0x597e49));if(_0x597e49[_0xdeaf('0xf')]){if(_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x10')]===0x1f4){logger['error'](_0xdeaf('0xb'),_0x46bab3,_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x11')]);return _0x438399(_0x597e49[_0xdeaf('0xf')]['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x46bab3,_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x11')]);return _0x12e3c5(_0x597e49[_0xdeaf('0xf')][_0xdeaf('0x11')]);}else{logger[_0xdeaf('0x12')](_0xdeaf('0xb'),_0x46bab3,_0xdeaf('0x13'));_0x12e3c5(_0x597e49['result'][_0xdeaf('0x11')]);}})[_0xdeaf('0x14')](function(_0xa25837){logger['error'](_0xdeaf('0xb'),_0x46bab3,_0xa25837);_0x438399(_0xa25837);});});}exports[_0xdeaf('0x15')]=function(_0xcdfc78){var _0x2273d9=this;return new Promise(function(_0x5a31d0,_0x8b07fb){return db[_0xdeaf('0x16')][_0xdeaf('0x17')]({'raw':!![],'where':{'ContactId':_0xcdfc78[_0xdeaf('0x18')][_0xdeaf('0x19')],'ListId':_0xcdfc78[_0xdeaf('0x18')][_0xdeaf('0x1a')],'VoiceQueueId':_0xcdfc78[_0xdeaf('0x18')][_0xdeaf('0x1b')]===undefined?null:_0xcdfc78[_0xdeaf('0x18')]['VoiceQueueId'],'CampaignId':_0xcdfc78[_0xdeaf('0x18')]['CampaignId']===undefined?null:_0xcdfc78['body'][_0xdeaf('0x1c')]}})[_0xdeaf('0xa')](function(_0x4ec267){if(_0x4ec267!=null){return db[_0xdeaf('0x1d')][_0xdeaf('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4ec267['id'],'OrderBy':{'$gt':_0x4ec267['OrderBy']}},'order':[[_0xdeaf('0x1e'),'ASC']]})[_0xdeaf('0xa')](function(_0x3f810f){var _0x5a862a=0x0;if(_0x3f810f){if(_0x3f810f[_0xdeaf('0x1f')]+_0x3f810f['countcongestionretry']+_0x3f810f[_0xdeaf('0x20')]+_0x3f810f[_0xdeaf('0x21')]+_0x3f810f[_0xdeaf('0x22')]+_0x3f810f['countabandonedretry']+_0x3f810f[_0xdeaf('0x23')]+_0x3f810f[_0xdeaf('0x24')]<_0xcdfc78[_0xdeaf('0x25')][_0xdeaf('0x26')])_0x5a862a=0x1;_0x5a31d0({'additional':_0x5a862a});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4ec267['id']},'order':[['OrderBy',_0xdeaf('0x27')]]})[_0xdeaf('0xa')](function(_0x46b3ce){var _0x5f42dc=0x0;if(_0x46b3ce){if(_0x46b3ce['countbusyretry']+_0x46b3ce['countcongestionretry']+_0x46b3ce[_0xdeaf('0x20')]+_0x46b3ce[_0xdeaf('0x21')]+_0x46b3ce['countdropretry']+_0x46b3ce[_0xdeaf('0x28')]+_0x46b3ce[_0xdeaf('0x23')]+_0x46b3ce[_0xdeaf('0x24')]<_0xcdfc78[_0xdeaf('0x25')][_0xdeaf('0x26')])_0x5f42dc=0x1;_0x5a31d0({'additional':_0x5f42dc});}else{_0x5a31d0({'additional':0x0});}})[_0xdeaf('0x14')](function(_0x461de0){logger[_0xdeaf('0xf')](_0xdeaf('0x15'),_0x461de0['message'],_0xcdfc78);_0x8b07fb(_0x2273d9['error'](0x1f4,_0x461de0['message']));});}})[_0xdeaf('0x14')](function(_0x181a8d){logger['error'](_0xdeaf('0x15'),_0x181a8d[_0xdeaf('0x11')],_0xcdfc78);_0x8b07fb(_0x2273d9[_0xdeaf('0xf')](0x1f4,_0x181a8d[_0xdeaf('0x11')]));});}else _0x5a31d0({'additional':0x0});});});};exports[_0xdeaf('0x29')]=function(_0x2f7d3e){var _0xee06e5=this;return new Promise(function(_0xc468e,_0x230d97){return db['CmHopper'][_0xdeaf('0x17')]({'raw':!![],'where':{'ContactId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x19')],'ListId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1a')],'VoiceQueueId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1b')]===undefined?null:_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1b')],'CampaignId':_0x2f7d3e[_0xdeaf('0x18')][_0xdeaf('0x1c')]===undefined?null:_0x2f7d3e['body'][_0xdeaf('0x1c')]}})[_0xdeaf('0xa')](function(_0x3fbf09){if(_0x3fbf09!=null){return db['CmHopperAdditionalPhone'][_0xdeaf('0x17')]({'raw':!![],'where':{'CmHopperId':_0x3fbf09['id'],'OrderBy':{'$gt':_0x3fbf09[_0xdeaf('0x1e')]}},'order':[[_0xdeaf('0x1e'),_0xdeaf('0x27')]]})[_0xdeaf('0xa')](function(_0xa19bf3){if(_0xa19bf3)return activateAdditionalPhone(_0x3fbf09,_0x2f7d3e[_0xdeaf('0x18')],_0xa19bf3,_0x2f7d3e[_0xdeaf('0x2a')],_0x2f7d3e[_0xdeaf('0x2b')])['then'](function(_0x13926c){_0xc468e(_0x13926c);});else{return db[_0xdeaf('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3fbf09['id']},'order':[[_0xdeaf('0x1e'),'ASC']]})['then'](function(_0x54c778){if(_0x54c778)return activateAdditionalPhone(_0x3fbf09,_0x2f7d3e[_0xdeaf('0x18')],_0x54c778,_0x2f7d3e[_0xdeaf('0x2a')],_0x2f7d3e[_0xdeaf('0x2b')])[_0xdeaf('0xa')](function(_0x46e66a){_0xc468e(_0x46e66a);});else{_0xc468e({'id':_0x3fbf09['id'],'phone':''});}})[_0xdeaf('0x14')](function(_0x4aeff9){logger['error'](_0xdeaf('0x15'),_0x4aeff9[_0xdeaf('0x11')],_0x2f7d3e);_0x230d97(_0xee06e5['error'](0x1f4,_0x4aeff9['message']));});}})[_0xdeaf('0x14')](function(_0x505198){logger['error'](_0xdeaf('0x15'),_0x505198[_0xdeaf('0x11')],_0x2f7d3e);_0x230d97(_0xee06e5['error'](0x1f4,_0x505198[_0xdeaf('0x11')]));});}else _0xc468e(0x1);});});};function activateAdditionalPhone(_0x423849,_0x39209f,_0x59f80e,_0x15c45e,_0x20288e){return new Promise(function(_0x3276c9,_0x30266a){logger[_0xdeaf('0x12')](_0xdeaf('0x15'),_0x59f80e);var _0x37f36a;if(moment()>moment(_0x59f80e[_0xdeaf('0x2c')])){_0x37f36a=moment()[_0xdeaf('0x2d')](_0x20288e||0x3,_0xdeaf('0x2e'));}else{if(_0x59f80e[_0xdeaf('0x1e')]==0x0){_0x37f36a=moment(_0x59f80e[_0xdeaf('0x2c')]);}else{_0x37f36a=moment()[_0xdeaf('0x2d')](_0x20288e||0x3,'minutes');}}var _0x17de1c={'phone':_0x423849[_0xdeaf('0x2f')],'active':0x0,'OrderBy':_[_0xdeaf('0x30')](_0x423849['OrderBy'])?0x0:_0x423849['OrderBy'],'scheduledat':moment()[_0xdeaf('0x2d')](_0x15c45e||0x1,_0xdeaf('0x2e')),'countbusyretry':_0x39209f['countbusyretry'],'countcongestionretry':_0x39209f[_0xdeaf('0x31')],'countnoanswerretry':_0x39209f[_0xdeaf('0x20')],'countnosuchnumberretry':_0x39209f[_0xdeaf('0x21')],'countdropretry':_0x39209f[_0xdeaf('0x22')],'countabandonedretry':_0x39209f['countabandonedretry'],'countmachineretry':_0x39209f[_0xdeaf('0x23')],'countagentrejectretry':_0x39209f[_0xdeaf('0x24')],'createdAt':_0x39209f[_0xdeaf('0x32')],'updatedAt':_0x39209f['updatedAt']};var _0x45a89a={'CmHopperId':_0x423849['id'],'phone':_0x59f80e[_0xdeaf('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x59f80e[_0xdeaf('0x1e')])?0x0:_0x59f80e[_0xdeaf('0x1e')],'scheduledat':_0x37f36a,'countbusyretry':_0x59f80e['countbusyretry'],'countcongestionretry':_0x59f80e[_0xdeaf('0x31')],'countnoanswerretry':_0x59f80e['countnoanswerretry'],'countnosuchnumberretry':_0x39209f[_0xdeaf('0x21')],'countdropretry':_0x39209f[_0xdeaf('0x22')],'countabandonedretry':_0x39209f['countabandonedretry'],'countmachineretry':_0x39209f[_0xdeaf('0x23')],'countagentrejectretry':_0x39209f[_0xdeaf('0x24')],'createdAt':_0x59f80e[_0xdeaf('0x32')],'updatedAt':_0x59f80e[_0xdeaf('0x33')]};logger[_0xdeaf('0x12')](_0xdeaf('0x34'),_0x17de1c);logger[_0xdeaf('0x12')](_0xdeaf('0x35'),_0x45a89a);return db['sequelize'][_0xdeaf('0x36')](function(_0x561e60){return db[_0xdeaf('0x1d')][_0xdeaf('0x37')](_0x17de1c,{'where':{'id':_0x59f80e['id']}},{'transaction':_0x561e60})[_0xdeaf('0xa')](function(){return db[_0xdeaf('0x16')][_0xdeaf('0x37')](_0x45a89a,{'where':{'id':_0x423849['id']}},{'transaction':_0x561e60});});})[_0xdeaf('0xa')](function(_0x254b84){_0x3276c9({'id':_0x423849['id'],'phone':_0x59f80e[_0xdeaf('0x2f')]});})[_0xdeaf('0x14')](function(_0x424324){logger[_0xdeaf('0xf')](_0xdeaf('0x15'),_0x424324['message'],req);_0x30266a(_this[_0xdeaf('0xf')](0x1f4,_0x424324[_0xdeaf('0x11')]));});});}exports[_0xdeaf('0x38')]=function(_0x1b3f3c){var _0x1d6077=this;return new Promise(function(_0x1cba7d,_0x1ec348){return db[_0xdeaf('0x16')]['update'](_0x1b3f3c[_0xdeaf('0x18')][_0xdeaf('0x39')],{'where':{'id':_0x1b3f3c[_0xdeaf('0x18')]['id']}})['then'](function(_0x3dbbe8){_0x1cba7d(_0x3dbbe8);})[_0xdeaf('0x14')](function(_0x14ecf3){logger[_0xdeaf('0xf')](_0xdeaf('0x38'),_0x14ecf3['message'],_0x1b3f3c);_0x1ec348(_0x1d6077[_0xdeaf('0xf')](0x1f4,_0x14ecf3[_0xdeaf('0x11')]));});});}; \ No newline at end of file +var _0x6e03=['ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countagentrejectretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','add','minutes','scheduledat','phone','isNil','updatedAt','hopperToAdd','transaction','IncrementPreviewCounters','update','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6e03,0x17d));var _0x36e0=function(_0x29fc9b,_0x3e271b){_0x29fc9b=_0x29fc9b-0x0;var _0x893754=_0x6e03[_0x29fc9b];return _0x893754;};'use strict';var _=require(_0x36e0('0x0'));var util=require(_0x36e0('0x1'));var moment=require(_0x36e0('0x2'));var BPromise=require(_0x36e0('0x3'));var rs=require(_0x36e0('0x4'));var fs=require('fs');var Redis=require(_0x36e0('0x5'));var db=require(_0x36e0('0x6'))['db'];var utils=require(_0x36e0('0x7'));var logger=require(_0x36e0('0x8'))(_0x36e0('0x9'));var config=require(_0x36e0('0xa'));var jayson=require(_0x36e0('0xb'));var client=jayson[_0x36e0('0xc')][_0x36e0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23890e,_0x11b93b,_0x2f47c6){return new BPromise(function(_0x29909f,_0x5280d8){return client['request'](_0x23890e,_0x2f47c6)[_0x36e0('0xe')](function(_0x2e744b){logger[_0x36e0('0xf')](_0x36e0('0x10'),_0x11b93b,_0x36e0('0x11'));logger[_0x36e0('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x11b93b,'request\x20sent',JSON[_0x36e0('0x13')](_0x2e744b));if(_0x2e744b['error']){if(_0x2e744b[_0x36e0('0x14')]['code']===0x1f4){logger['error'](_0x36e0('0x10'),_0x11b93b,_0x2e744b[_0x36e0('0x14')]['message']);return _0x5280d8(_0x2e744b['error'][_0x36e0('0x15')]);}logger[_0x36e0('0x14')](_0x36e0('0x10'),_0x11b93b,_0x2e744b['error'][_0x36e0('0x15')]);return _0x29909f(_0x2e744b[_0x36e0('0x14')][_0x36e0('0x15')]);}else{logger[_0x36e0('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x11b93b,_0x36e0('0x11'));_0x29909f(_0x2e744b[_0x36e0('0x16')][_0x36e0('0x15')]);}})[_0x36e0('0x17')](function(_0x31fc9b){logger[_0x36e0('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x11b93b,_0x31fc9b);_0x5280d8(_0x31fc9b);});});}exports['VerifyAdditionalPhones']=function(_0x59302f){var _0xcfe4bf=this;return new Promise(function(_0x1b945f,_0x48f764){return db[_0x36e0('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1a')],'ListId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1b')],'VoiceQueueId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1c')]===undefined?null:_0x59302f[_0x36e0('0x19')][_0x36e0('0x1c')],'CampaignId':_0x59302f[_0x36e0('0x19')][_0x36e0('0x1d')]===undefined?null:_0x59302f[_0x36e0('0x19')][_0x36e0('0x1d')]}})['then'](function(_0x1fbaf0){if(_0x1fbaf0!=null){return db['CmHopperAdditionalPhone'][_0x36e0('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x1fbaf0['id'],'OrderBy':{'$gt':_0x1fbaf0[_0x36e0('0x1f')]}},'order':[[_0x36e0('0x1f'),_0x36e0('0x20')]]})['then'](function(_0x2dac97){var _0x295681=0x0;if(_0x2dac97){if(_0x2dac97[_0x36e0('0x21')]+_0x2dac97[_0x36e0('0x22')]+_0x2dac97['countnoanswerretry']+_0x2dac97[_0x36e0('0x23')]+_0x2dac97[_0x36e0('0x24')]+_0x2dac97[_0x36e0('0x25')]+_0x2dac97[_0x36e0('0x26')]+_0x2dac97['countagentrejectretry']<_0x59302f['entity'][_0x36e0('0x27')])_0x295681=0x1;_0x1b945f({'additional':_0x295681});}else{return db[_0x36e0('0x28')][_0x36e0('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x1fbaf0['id']},'order':[['OrderBy',_0x36e0('0x20')]]})[_0x36e0('0xe')](function(_0x223fb3){var _0xba74c9=0x0;if(_0x223fb3){if(_0x223fb3['countbusyretry']+_0x223fb3[_0x36e0('0x22')]+_0x223fb3[_0x36e0('0x29')]+_0x223fb3[_0x36e0('0x23')]+_0x223fb3[_0x36e0('0x24')]+_0x223fb3[_0x36e0('0x25')]+_0x223fb3['countmachineretry']+_0x223fb3[_0x36e0('0x2a')]<_0x59302f[_0x36e0('0x2b')][_0x36e0('0x27')])_0xba74c9=0x1;_0x1b945f({'additional':_0xba74c9});}else{_0x1b945f({'additional':0x0});}})[_0x36e0('0x17')](function(_0x2b6a50){logger[_0x36e0('0x14')]('VerifyAdditionalPhones',_0x2b6a50['message'],_0x59302f);_0x48f764(_0xcfe4bf[_0x36e0('0x14')](0x1f4,_0x2b6a50['message']));});}})[_0x36e0('0x17')](function(_0x30c673){logger[_0x36e0('0x14')](_0x36e0('0x2c'),_0x30c673[_0x36e0('0x15')],_0x59302f);_0x48f764(_0xcfe4bf[_0x36e0('0x14')](0x1f4,_0x30c673[_0x36e0('0x15')]));});}else _0x1b945f({'additional':0x0});});});};exports[_0x36e0('0x2d')]=function(_0x3b6838){var _0x9fb5d2=this;return new Promise(function(_0x3ad787,_0x23c416){return db['CmHopper'][_0x36e0('0x1e')]({'raw':!![],'where':{'ContactId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1a')],'ListId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1b')],'VoiceQueueId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1c')]===undefined?null:_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1c')],'CampaignId':_0x3b6838[_0x36e0('0x19')][_0x36e0('0x1d')]===undefined?null:_0x3b6838[_0x36e0('0x19')]['CampaignId']}})[_0x36e0('0xe')](function(_0x29b0d2){if(_0x29b0d2!=null){return db[_0x36e0('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x29b0d2['id'],'OrderBy':{'$gt':_0x29b0d2[_0x36e0('0x1f')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x28a8af){if(_0x28a8af)return activateAdditionalPhone(_0x29b0d2,_0x3b6838[_0x36e0('0x19')],_0x28a8af,_0x3b6838[_0x36e0('0x2e')],_0x3b6838[_0x36e0('0x2f')])[_0x36e0('0xe')](function(_0x515812){_0x3ad787(_0x515812);});else{return db[_0x36e0('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x29b0d2['id']},'order':[['OrderBy',_0x36e0('0x20')]]})[_0x36e0('0xe')](function(_0x477a03){if(_0x477a03)return activateAdditionalPhone(_0x29b0d2,_0x3b6838[_0x36e0('0x19')],_0x477a03,_0x3b6838[_0x36e0('0x2e')],_0x3b6838['waitTime'])['then'](function(_0x47d54d){_0x3ad787(_0x47d54d);});else{_0x3ad787({'id':_0x29b0d2['id'],'phone':''});}})[_0x36e0('0x17')](function(_0x112c48){logger['error'](_0x36e0('0x2c'),_0x112c48[_0x36e0('0x15')],_0x3b6838);_0x23c416(_0x9fb5d2[_0x36e0('0x14')](0x1f4,_0x112c48['message']));});}})[_0x36e0('0x17')](function(_0x42ed6c){logger[_0x36e0('0x14')]('VerifyAdditionalPhones',_0x42ed6c[_0x36e0('0x15')],_0x3b6838);_0x23c416(_0x9fb5d2[_0x36e0('0x14')](0x1f4,_0x42ed6c[_0x36e0('0x15')]));});}else _0x3ad787(0x1);});});};function activateAdditionalPhone(_0x243d93,_0x3715d8,_0x401bc4,_0x29590a,_0x1565cd){return new Promise(function(_0x18c032,_0x50d64c){logger[_0x36e0('0xf')](_0x36e0('0x2c'),_0x401bc4);var _0x11fef5;if(moment()>moment(_0x401bc4['scheduledat'])){_0x11fef5=moment()[_0x36e0('0x30')](_0x1565cd||0x3,_0x36e0('0x31'));}else{if(_0x401bc4['OrderBy']==0x0){_0x11fef5=moment(_0x401bc4[_0x36e0('0x32')]);}else{_0x11fef5=moment()[_0x36e0('0x30')](_0x1565cd||0x3,'minutes');}}var _0x5ba851={'phone':_0x243d93[_0x36e0('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x243d93[_0x36e0('0x1f')])?0x0:_0x243d93['OrderBy'],'scheduledat':moment()[_0x36e0('0x30')](_0x29590a||0x1,_0x36e0('0x31')),'countbusyretry':_0x3715d8[_0x36e0('0x21')],'countcongestionretry':_0x3715d8[_0x36e0('0x22')],'countnoanswerretry':_0x3715d8[_0x36e0('0x29')],'countnosuchnumberretry':_0x3715d8[_0x36e0('0x23')],'countdropretry':_0x3715d8[_0x36e0('0x24')],'countabandonedretry':_0x3715d8[_0x36e0('0x25')],'countmachineretry':_0x3715d8[_0x36e0('0x26')],'countagentrejectretry':_0x3715d8[_0x36e0('0x2a')],'createdAt':_0x3715d8['createdAt'],'updatedAt':_0x3715d8['updatedAt']};var _0x2ff033={'CmHopperId':_0x243d93['id'],'phone':_0x401bc4[_0x36e0('0x33')],'active':0x0,'OrderBy':_[_0x36e0('0x34')](_0x401bc4[_0x36e0('0x1f')])?0x0:_0x401bc4[_0x36e0('0x1f')],'scheduledat':_0x11fef5,'countbusyretry':_0x401bc4[_0x36e0('0x21')],'countcongestionretry':_0x401bc4[_0x36e0('0x22')],'countnoanswerretry':_0x401bc4[_0x36e0('0x29')],'countnosuchnumberretry':_0x3715d8['countnosuchnumberretry'],'countdropretry':_0x3715d8['countdropretry'],'countabandonedretry':_0x3715d8[_0x36e0('0x25')],'countmachineretry':_0x3715d8[_0x36e0('0x26')],'countagentrejectretry':_0x3715d8[_0x36e0('0x2a')],'createdAt':_0x401bc4['createdAt'],'updatedAt':_0x401bc4[_0x36e0('0x35')]};logger[_0x36e0('0xf')](_0x36e0('0x36'),_0x5ba851);logger['info']('additionalToHop',_0x2ff033);return db['sequelize'][_0x36e0('0x37')](function(_0x14d443){return db[_0x36e0('0x28')]['update'](_0x5ba851,{'where':{'id':_0x401bc4['id']}},{'transaction':_0x14d443})[_0x36e0('0xe')](function(){return db['CmHopper']['update'](_0x2ff033,{'where':{'id':_0x243d93['id']}},{'transaction':_0x14d443});});})[_0x36e0('0xe')](function(_0x5a97a7){_0x18c032({'id':_0x243d93['id'],'phone':_0x401bc4['phone']});})['catch'](function(_0x1cccdd){logger[_0x36e0('0x14')](_0x36e0('0x2c'),_0x1cccdd[_0x36e0('0x15')],req);_0x50d64c(_this[_0x36e0('0x14')](0x1f4,_0x1cccdd[_0x36e0('0x15')]));});});}exports[_0x36e0('0x38')]=function(_0x17ab5e){var _0x4cadb0=this;return new Promise(function(_0x4ed433,_0x3948fa){return db[_0x36e0('0x18')][_0x36e0('0x39')](_0x17ab5e[_0x36e0('0x19')][_0x36e0('0x3a')],{'where':{'id':_0x17ab5e[_0x36e0('0x19')]['id']}})['then'](function(_0x2ca5db){_0x4ed433(_0x2ca5db);})[_0x36e0('0x17')](function(_0x362f16){logger['error']('IncrementPreviewCounters',_0x362f16[_0x36e0('0x15')],_0x17ab5e);_0x3948fa(_0x4cadb0[_0x36e0('0x14')](0x1f4,_0x362f16[_0x36e0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6c52d87..a80805c 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 _0x5b5f=['get','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5b5f,0x1a7));var _0xf5b5=function(_0x36e8e4,_0x213a61){_0x36e8e4=_0x36e8e4-0x0;var _0x491ac7=_0x5b5f[_0x36e8e4];return _0x491ac7;};'use strict';var multer=require(_0xf5b5('0x0'));var util=require(_0xf5b5('0x1'));var path=require(_0xf5b5('0x2'));var timeout=require(_0xf5b5('0x3'));var express=require('express');var router=express[_0xf5b5('0x4')]();var auth=require(_0xf5b5('0x5'));var interaction=require(_0xf5b5('0x6'));var config=require(_0xf5b5('0x7'));var controller=require(_0xf5b5('0x8'));router[_0xf5b5('0x9')]('/',auth[_0xf5b5('0xa')](),controller['index']);router['get'](_0xf5b5('0xb'),auth[_0xf5b5('0xa')](),controller[_0xf5b5('0xc')]);router[_0xf5b5('0xd')]('/',auth[_0xf5b5('0xa')](),controller[_0xf5b5('0xe')]);router['put'](_0xf5b5('0xb'),auth[_0xf5b5('0xa')](),controller[_0xf5b5('0xf')]);router[_0xf5b5('0x10')](_0xf5b5('0xb'),auth[_0xf5b5('0xa')](),controller['destroy']);module[_0xf5b5('0x11')]=router; \ No newline at end of file +var _0xa9a7=['show','post','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xa9a7,0x197));var _0x7a9a=function(_0x4d20aa,_0x44c204){_0x4d20aa=_0x4d20aa-0x0;var _0x564372=_0xa9a7[_0x4d20aa];return _0x564372;};'use strict';var multer=require('multer');var util=require(_0x7a9a('0x0'));var path=require('path');var timeout=require(_0x7a9a('0x1'));var express=require('express');var router=express[_0x7a9a('0x2')]();var auth=require(_0x7a9a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7a9a('0x4'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x7a9a('0x5')]('/',auth['isAuthenticated'](),controller[_0x7a9a('0x6')]);router[_0x7a9a('0x5')](_0x7a9a('0x7'),auth[_0x7a9a('0x8')](),controller[_0x7a9a('0x9')]);router[_0x7a9a('0xa')]('/',auth[_0x7a9a('0x8')](),controller['create']);router[_0x7a9a('0xb')](_0x7a9a('0x7'),auth[_0x7a9a('0x8')](),controller[_0x7a9a('0xc')]);router[_0x7a9a('0xd')](_0x7a9a('0x7'),auth['isAuthenticated'](),controller[_0x7a9a('0xe')]);module[_0x7a9a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f23bf9e..3b92eff 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 _0xb633=['exports','STRING','INTEGER','contactListQueue'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xb633,0xb0));var _0x3b63=function(_0x16c4ef,_0x22724c){_0x16c4ef=_0x16c4ef-0x0;var _0x26a684=_0xb633[_0x16c4ef];return _0x26a684;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3b63('0x0')]={'phone':{'type':Sequelize[_0x3b63('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3b63('0x2')],'unique':_0x3b63('0x3')},'ListId':{'type':Sequelize[_0x3b63('0x2')],'unique':_0x3b63('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3b63('0x2')],'unique':_0x3b63('0x3')}}; \ No newline at end of file +var _0x6b62=['moment','exports','INTEGER','contactListQueue'];(function(_0xff662d,_0xe30c7a){var _0x63e4b0=function(_0x481f4f){while(--_0x481f4f){_0xff662d['push'](_0xff662d['shift']());}};_0x63e4b0(++_0xe30c7a);}(_0x6b62,0x1bc));var _0x26b6=function(_0x38ca61,_0x30345e){_0x38ca61=_0x38ca61-0x0;var _0xb0ba38=_0x6b62[_0x38ca61];return _0xb0ba38;};'use strict';var moment=require(_0x26b6('0x0'));var Sequelize=require('sequelize');module[_0x26b6('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x26b6('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x26b6('0x2')],'unique':_0x26b6('0x3')},'VoiceQueueId':{'type':Sequelize[_0x26b6('0x2')],'unique':_0x26b6('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 5a6db49..1987ba4 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 _0x4359=['VIRTUAL','findAll','rows','catch','show','params','includeAll','options','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','name','send','index','map','CmHopperBlack','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x3fdd21,_0x26aec6){var _0x4973df=function(_0x27eda9){while(--_0x27eda9){_0x3fdd21['push'](_0x3fdd21['shift']());}};_0x4973df(++_0x26aec6);}(_0x4359,0x15a));var _0x9435=function(_0x49fe3e,_0x2cca6b){_0x49fe3e=_0x49fe3e-0x0;var _0x4afb0f=_0x4359[_0x49fe3e];return _0x4afb0f;};'use strict';var pdf=require(_0x9435('0x0'));var emlformat=require(_0x9435('0x1'));var rimraf=require(_0x9435('0x2'));var zipdir=require(_0x9435('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9435('0x4'));var Mustache=require(_0x9435('0x5'));var util=require(_0x9435('0x6'));var path=require(_0x9435('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9435('0x8'));var squel=require(_0x9435('0x9'));var crypto=require(_0x9435('0xa'));var jsforce=require(_0x9435('0xb'));var deskjs=require(_0x9435('0xc'));var toCsv=require(_0x9435('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9435('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9435('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9435('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x9435('0x11'));var licenseUtil=require(_0x9435('0x12'));var db=require(_0x9435('0x13'))['db'];function respondWithStatusCode(_0x3822b3,_0x3e87d6){_0x3e87d6=_0x3e87d6||0xcc;return function(_0x3f796f){if(_0x3f796f){return _0x3822b3[_0x9435('0x14')](_0x3e87d6);}return _0x3822b3[_0x9435('0x15')](_0x3e87d6)[_0x9435('0x16')]();};}function respondWithResult(_0x55eb8b,_0x442e7a){_0x442e7a=_0x442e7a||0xc8;return function(_0x5ce1d6){if(_0x5ce1d6){return _0x55eb8b['status'](_0x442e7a)[_0x9435('0x17')](_0x5ce1d6);}};}function respondWithFilteredResult(_0x5ad43d,_0x3bc598){return function(_0x45fcbe){if(_0x45fcbe){var _0x36a660=_0x45fcbe[_0x9435('0x18')],_0x462d1e=_0x3bc598[_0x9435('0x19')],_0x5aa33c=_0x3bc598[_0x9435('0x19')]+_0x3bc598[_0x9435('0x1a')],_0x2383ed;if(_0x5aa33c>=_0x36a660){_0x5aa33c=_0x36a660;_0x2383ed=0xc8;}else{_0x2383ed=0xce;}_0x5ad43d[_0x9435('0x15')](_0x2383ed);return _0x5ad43d['set'](_0x9435('0x1b'),_0x462d1e+'-'+_0x5aa33c+'/'+_0x36a660)[_0x9435('0x17')](_0x45fcbe);}return null;};}function patchUpdates(_0x16f815){return function(_0x39d991){try{jsonpatch[_0x9435('0x1c')](_0x39d991,_0x16f815,!![]);}catch(_0x3d5fc8){return BPromise['reject'](_0x3d5fc8);}return _0x39d991[_0x9435('0x1d')]();};}function saveUpdates(_0x52f8e2,_0x1880e9){return function(_0x1eb501){if(_0x1eb501){return _0x1eb501[_0x9435('0x1e')](_0x52f8e2)[_0x9435('0x1f')](function(_0x2890cb){return _0x2890cb;});}return null;};}function removeEntity(_0x4fe21c,_0x333c23){return function(_0x55e0f5){if(_0x55e0f5){return _0x55e0f5[_0x9435('0x20')]()[_0x9435('0x1f')](function(){_0x4fe21c['status'](0xcc)[_0x9435('0x16')]();});}};}function handleEntityNotFound(_0x5d9120,_0x477e01){return function(_0x3e8cd4){if(!_0x3e8cd4){_0x5d9120[_0x9435('0x14')](0x194);}return _0x3e8cd4;};}function handleError(_0x2fde1c,_0x429d0e){_0x429d0e=_0x429d0e||0x1f4;return function(_0x320bb2){logger['error'](_0x320bb2['stack']);if(_0x320bb2[_0x9435('0x21')]){delete _0x320bb2[_0x9435('0x21')];}_0x2fde1c[_0x9435('0x15')](_0x429d0e)[_0x9435('0x22')](_0x320bb2);};}exports[_0x9435('0x23')]=function(_0x85bc1,_0x37096c){var _0x1557a4={},_0x1a3800={},_0x5cf603={'count':0x0,'rows':[]};var _0x151815=_[_0x9435('0x24')](db[_0x9435('0x25')][_0x9435('0x26')],function(_0x32d707){return{'name':_0x32d707['fieldName'],'type':_0x32d707[_0x9435('0x27')]['key']};});_0x1a3800['model']=_[_0x9435('0x24')](_0x151815,_0x9435('0x21'));_0x1a3800[_0x9435('0x28')]=_[_0x9435('0x29')](_0x85bc1[_0x9435('0x28')]);_0x1a3800[_0x9435('0x2a')]=_['intersection'](_0x1a3800[_0x9435('0x2b')],_0x1a3800['query']);_0x1557a4[_0x9435('0x2c')]=_[_0x9435('0x2d')](_0x1a3800['model'],qs['fields'](_0x85bc1[_0x9435('0x28')][_0x9435('0x2e')]));_0x1557a4[_0x9435('0x2c')]=_0x1557a4[_0x9435('0x2c')][_0x9435('0x2f')]?_0x1557a4[_0x9435('0x2c')]:_0x1a3800['model'];if(!_0x85bc1['query'][_0x9435('0x30')](_0x9435('0x31'))){_0x1557a4[_0x9435('0x1a')]=qs['limit'](_0x85bc1[_0x9435('0x28')][_0x9435('0x1a')]);_0x1557a4[_0x9435('0x19')]=qs[_0x9435('0x19')](_0x85bc1[_0x9435('0x28')][_0x9435('0x19')]);}_0x1557a4[_0x9435('0x32')]=qs[_0x9435('0x33')](_0x85bc1[_0x9435('0x28')][_0x9435('0x33')]);_0x1557a4['where']=qs['filters'](_[_0x9435('0x34')](_0x85bc1[_0x9435('0x28')],_0x1a3800[_0x9435('0x2a')]),_0x151815);if(_0x85bc1[_0x9435('0x28')][_0x9435('0x35')]){_0x1557a4[_0x9435('0x36')]=_[_0x9435('0x37')](_0x1557a4['where'],{'$or':_[_0x9435('0x24')](_0x151815,function(_0x49814f){if(_0x49814f[_0x9435('0x27')]!==_0x9435('0x38')){var _0x17297e={};_0x17297e[_0x49814f[_0x9435('0x21')]]={'$like':'%'+_0x85bc1[_0x9435('0x28')][_0x9435('0x35')]+'%'};return _0x17297e;}})});}_0x1557a4=_[_0x9435('0x37')]({},_0x1557a4,_0x85bc1['options']);var _0x5431a4={'where':_0x1557a4[_0x9435('0x36')]};return db[_0x9435('0x25')][_0x9435('0x18')](_0x5431a4)['then'](function(_0x3ad151){_0x5cf603[_0x9435('0x18')]=_0x3ad151;if(_0x85bc1[_0x9435('0x28')]['includeAll']){_0x1557a4['include']=[{'all':!![]}];}return db[_0x9435('0x25')][_0x9435('0x39')](_0x1557a4);})['then'](function(_0x291ecb){_0x5cf603[_0x9435('0x3a')]=_0x291ecb;return _0x5cf603;})[_0x9435('0x1f')](respondWithFilteredResult(_0x37096c,_0x1557a4))[_0x9435('0x3b')](handleError(_0x37096c,null));};exports[_0x9435('0x3c')]=function(_0x5d092c,_0x481da9){var _0x3ed6ac={'raw':!![],'where':{'id':_0x5d092c[_0x9435('0x3d')]['id']}},_0x1835d4={};_0x1835d4[_0x9435('0x2b')]=_[_0x9435('0x29')](db[_0x9435('0x25')]['rawAttributes']);_0x1835d4[_0x9435('0x28')]=_[_0x9435('0x29')](_0x5d092c['query']);_0x1835d4[_0x9435('0x2a')]=_[_0x9435('0x2d')](_0x1835d4[_0x9435('0x2b')],_0x1835d4[_0x9435('0x28')]);_0x3ed6ac['attributes']=_['intersection'](_0x1835d4[_0x9435('0x2b')],qs[_0x9435('0x2e')](_0x5d092c[_0x9435('0x28')][_0x9435('0x2e')]));_0x3ed6ac[_0x9435('0x2c')]=_0x3ed6ac[_0x9435('0x2c')][_0x9435('0x2f')]?_0x3ed6ac['attributes']:_0x1835d4['model'];if(_0x5d092c[_0x9435('0x28')][_0x9435('0x3e')]){_0x3ed6ac['include']=[{'all':!![]}];}_0x3ed6ac=_['merge']({},_0x3ed6ac,_0x5d092c[_0x9435('0x3f')]);return db[_0x9435('0x25')][_0x9435('0x40')](_0x3ed6ac)[_0x9435('0x1f')](handleEntityNotFound(_0x481da9,null))[_0x9435('0x1f')](respondWithResult(_0x481da9,null))['catch'](handleError(_0x481da9,null));};exports[_0x9435('0x1e')]=function(_0x2defe2,_0x5a2f00){if(_0x2defe2['body']['id']){delete _0x2defe2['body']['id'];}return db[_0x9435('0x25')][_0x9435('0x40')]({'where':{'id':_0x2defe2['params']['id']}})['then'](handleEntityNotFound(_0x5a2f00,null))[_0x9435('0x1f')](saveUpdates(_0x2defe2[_0x9435('0x41')],null))[_0x9435('0x1f')](respondWithResult(_0x5a2f00,null))['catch'](handleError(_0x5a2f00,null));};exports[_0x9435('0x20')]=function(_0x4a5799,_0x5ef923){return db[_0x9435('0x25')][_0x9435('0x40')]({'where':{'id':_0x4a5799[_0x9435('0x3d')]['id']}})[_0x9435('0x1f')](handleEntityNotFound(_0x5ef923,null))[_0x9435('0x1f')](removeEntity(_0x5ef923,null))[_0x9435('0x3b')](handleError(_0x5ef923,null));};exports[_0x9435('0x42')]=function(_0x5bb040,_0x3eb35f){return db[_0x9435('0x25')][_0x9435('0x42')]()[_0x9435('0x1f')](respondWithResult(_0x3eb35f,null))[_0x9435('0x3b')](handleError(_0x3eb35f,null));}; \ No newline at end of file +var _0xe156=['mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','set','Content-Range','reject','save','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','body','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x19478b,_0xda6e87){var _0x3004b3=function(_0x26c51a){while(--_0x26c51a){_0x19478b['push'](_0x19478b['shift']());}};_0x3004b3(++_0xda6e87);}(_0xe156,0xd8));var _0x6e15=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0xe156[_0xdefbc3];return _0x367798;};'use strict';var pdf=require(_0x6e15('0x0'));var emlformat=require(_0x6e15('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6e15('0x2'));var jsonpatch=require(_0x6e15('0x3'));var rp=require(_0x6e15('0x4'));var moment=require(_0x6e15('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e15('0x6'));var util=require(_0x6e15('0x7'));var path=require(_0x6e15('0x8'));var sox=require(_0x6e15('0x9'));var csv=require(_0x6e15('0xa'));var ejs=require(_0x6e15('0xb'));var fs=require('fs');var _=require(_0x6e15('0xc'));var squel=require(_0x6e15('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e15('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6e15('0xf'));var Papa=require(_0x6e15('0x10'));var Redis=require(_0x6e15('0x11'));var authService=require(_0x6e15('0x12'));var qs=require(_0x6e15('0x13'));var as=require(_0x6e15('0x14'));var hardwareService=require(_0x6e15('0x15'));var logger=require(_0x6e15('0x16'))(_0x6e15('0x17'));var utils=require(_0x6e15('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6e15('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e73f8,_0xdcef8a){_0xdcef8a=_0xdcef8a||0xcc;return function(_0x37b146){if(_0x37b146){return _0x1e73f8[_0x6e15('0x1a')](_0xdcef8a);}return _0x1e73f8[_0x6e15('0x1b')](_0xdcef8a)[_0x6e15('0x1c')]();};}function respondWithResult(_0x211ad2,_0x48dc8b){_0x48dc8b=_0x48dc8b||0xc8;return function(_0xbf7cb0){if(_0xbf7cb0){return _0x211ad2[_0x6e15('0x1b')](_0x48dc8b)[_0x6e15('0x1d')](_0xbf7cb0);}};}function respondWithFilteredResult(_0x39148f,_0x547f45){return function(_0x4cdb9d){if(_0x4cdb9d){var _0xf3548d=_0x4cdb9d['count'],_0x478128=_0x547f45['offset'],_0x55516f=_0x547f45['offset']+_0x547f45['limit'],_0x13493d;if(_0x55516f>=_0xf3548d){_0x55516f=_0xf3548d;_0x13493d=0xc8;}else{_0x13493d=0xce;}_0x39148f[_0x6e15('0x1b')](_0x13493d);return _0x39148f[_0x6e15('0x1e')](_0x6e15('0x1f'),_0x478128+'-'+_0x55516f+'/'+_0xf3548d)[_0x6e15('0x1d')](_0x4cdb9d);}return null;};}function patchUpdates(_0x562f5b){return function(_0x59ee7c){try{jsonpatch['apply'](_0x59ee7c,_0x562f5b,!![]);}catch(_0x292621){return BPromise[_0x6e15('0x20')](_0x292621);}return _0x59ee7c[_0x6e15('0x21')]();};}function saveUpdates(_0x58f926,_0x19c371){return function(_0x1899f0){if(_0x1899f0){return _0x1899f0['update'](_0x58f926)[_0x6e15('0x22')](function(_0x5a034e){return _0x5a034e;});}return null;};}function removeEntity(_0x25e16e,_0x3d2d84){return function(_0x462a75){if(_0x462a75){return _0x462a75['destroy']()[_0x6e15('0x22')](function(){_0x25e16e[_0x6e15('0x1b')](0xcc)[_0x6e15('0x1c')]();});}};}function handleEntityNotFound(_0x304370,_0x583323){return function(_0x5b74bb){if(!_0x5b74bb){_0x304370[_0x6e15('0x1a')](0x194);}return _0x5b74bb;};}function handleError(_0x305c8c,_0x2480de){_0x2480de=_0x2480de||0x1f4;return function(_0x38e84b){logger[_0x6e15('0x23')](_0x38e84b[_0x6e15('0x24')]);if(_0x38e84b[_0x6e15('0x25')]){delete _0x38e84b['name'];}_0x305c8c[_0x6e15('0x1b')](_0x2480de)[_0x6e15('0x26')](_0x38e84b);};}exports[_0x6e15('0x27')]=function(_0x3d3a18,_0xab75b7){var _0x49954f={},_0x360387={},_0x4795a3={'count':0x0,'rows':[]};var _0x1ce062=_[_0x6e15('0x28')](db[_0x6e15('0x29')][_0x6e15('0x2a')],function(_0xac3ca3){return{'name':_0xac3ca3[_0x6e15('0x2b')],'type':_0xac3ca3['type'][_0x6e15('0x2c')]};});_0x360387[_0x6e15('0x2d')]=_[_0x6e15('0x28')](_0x1ce062,_0x6e15('0x25'));_0x360387[_0x6e15('0x2e')]=_[_0x6e15('0x2f')](_0x3d3a18['query']);_0x360387[_0x6e15('0x30')]=_[_0x6e15('0x31')](_0x360387['model'],_0x360387[_0x6e15('0x2e')]);_0x49954f[_0x6e15('0x32')]=_[_0x6e15('0x31')](_0x360387['model'],qs[_0x6e15('0x33')](_0x3d3a18['query'][_0x6e15('0x33')]));_0x49954f[_0x6e15('0x32')]=_0x49954f[_0x6e15('0x32')][_0x6e15('0x34')]?_0x49954f['attributes']:_0x360387[_0x6e15('0x2d')];if(!_0x3d3a18['query']['hasOwnProperty'](_0x6e15('0x35'))){_0x49954f['limit']=qs[_0x6e15('0x36')](_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x36')]);_0x49954f[_0x6e15('0x37')]=qs['offset'](_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x37')]);}_0x49954f[_0x6e15('0x38')]=qs[_0x6e15('0x39')](_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x39')]);_0x49954f[_0x6e15('0x3a')]=qs[_0x6e15('0x30')](_[_0x6e15('0x3b')](_0x3d3a18[_0x6e15('0x2e')],_0x360387[_0x6e15('0x30')]),_0x1ce062);if(_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x3c')]){_0x49954f[_0x6e15('0x3a')]=_[_0x6e15('0x3d')](_0x49954f['where'],{'$or':_['map'](_0x1ce062,function(_0x1e4e50){if(_0x1e4e50['type']!=='VIRTUAL'){var _0x2b1c5a={};_0x2b1c5a[_0x1e4e50[_0x6e15('0x25')]]={'$like':'%'+_0x3d3a18[_0x6e15('0x2e')][_0x6e15('0x3c')]+'%'};return _0x2b1c5a;}})});}_0x49954f=_[_0x6e15('0x3d')]({},_0x49954f,_0x3d3a18[_0x6e15('0x3e')]);var _0x330a66={'where':_0x49954f[_0x6e15('0x3a')]};return db[_0x6e15('0x29')]['count'](_0x330a66)['then'](function(_0x29c898){_0x4795a3['count']=_0x29c898;if(_0x3d3a18['query']['includeAll']){_0x49954f[_0x6e15('0x3f')]=[{'all':!![]}];}return db[_0x6e15('0x29')][_0x6e15('0x40')](_0x49954f);})[_0x6e15('0x22')](function(_0x391cfa){_0x4795a3[_0x6e15('0x41')]=_0x391cfa;return _0x4795a3;})[_0x6e15('0x22')](respondWithFilteredResult(_0xab75b7,_0x49954f))[_0x6e15('0x42')](handleError(_0xab75b7,null));};exports[_0x6e15('0x43')]=function(_0x4001b0,_0x549375){var _0x510d8f={'raw':!![],'where':{'id':_0x4001b0[_0x6e15('0x44')]['id']}},_0x16549c={};_0x16549c[_0x6e15('0x2d')]=_['keys'](db[_0x6e15('0x29')][_0x6e15('0x2a')]);_0x16549c[_0x6e15('0x2e')]=_[_0x6e15('0x2f')](_0x4001b0[_0x6e15('0x2e')]);_0x16549c[_0x6e15('0x30')]=_['intersection'](_0x16549c['model'],_0x16549c[_0x6e15('0x2e')]);_0x510d8f[_0x6e15('0x32')]=_[_0x6e15('0x31')](_0x16549c[_0x6e15('0x2d')],qs[_0x6e15('0x33')](_0x4001b0[_0x6e15('0x2e')][_0x6e15('0x33')]));_0x510d8f[_0x6e15('0x32')]=_0x510d8f['attributes']['length']?_0x510d8f[_0x6e15('0x32')]:_0x16549c[_0x6e15('0x2d')];if(_0x4001b0[_0x6e15('0x2e')][_0x6e15('0x45')]){_0x510d8f['include']=[{'all':!![]}];}_0x510d8f=_['merge']({},_0x510d8f,_0x4001b0[_0x6e15('0x3e')]);return db['CmHopperBlack']['find'](_0x510d8f)[_0x6e15('0x22')](handleEntityNotFound(_0x549375,null))[_0x6e15('0x22')](respondWithResult(_0x549375,null))[_0x6e15('0x42')](handleError(_0x549375,null));};exports['update']=function(_0xffea4e,_0x90d417){if(_0xffea4e[_0x6e15('0x46')]['id']){delete _0xffea4e[_0x6e15('0x46')]['id'];}return db[_0x6e15('0x29')][_0x6e15('0x47')]({'where':{'id':_0xffea4e[_0x6e15('0x44')]['id']}})['then'](handleEntityNotFound(_0x90d417,null))['then'](saveUpdates(_0xffea4e[_0x6e15('0x46')],null))[_0x6e15('0x22')](respondWithResult(_0x90d417,null))[_0x6e15('0x42')](handleError(_0x90d417,null));};exports[_0x6e15('0x48')]=function(_0x4ccabe,_0x5cc04a){return db[_0x6e15('0x29')][_0x6e15('0x47')]({'where':{'id':_0x4ccabe[_0x6e15('0x44')]['id']}})[_0x6e15('0x22')](handleEntityNotFound(_0x5cc04a,null))[_0x6e15('0x22')](removeEntity(_0x5cc04a,null))[_0x6e15('0x42')](handleError(_0x5cc04a,null));};exports[_0x6e15('0x49')]=function(_0x396d6a,_0x229da9){return db['CmHopperBlack'][_0x6e15('0x49')]()['then'](respondWithResult(_0x229da9,null))['catch'](handleError(_0x229da9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e61ff99..5306d3b 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 _0x1867=['../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a39e1,_0x53a4f1){var _0xd29d7c=function(_0x2e6d34){while(--_0x2e6d34){_0x1a39e1['push'](_0x1a39e1['shift']());}};_0xd29d7c(++_0x53a4f1);}(_0x1867,0xe5));var _0x7186=function(_0x46e9f2,_0x554c12){_0x46e9f2=_0x46e9f2-0x0;var _0x505f9a=_0x1867[_0x46e9f2];return _0x505f9a;};'use strict';var _=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var logger=require(_0x7186('0x2'))(_0x7186('0x3'));var moment=require(_0x7186('0x4'));var BPromise=require(_0x7186('0x5'));var rp=require(_0x7186('0x6'));var fs=require('fs');var path=require(_0x7186('0x7'));var rimraf=require(_0x7186('0x8'));var config=require(_0x7186('0x9'));var attributes=require(_0x7186('0xa'));module[_0x7186('0xb')]=function(_0x12433,_0x31c55b){return _0x12433[_0x7186('0xc')]('CmHopperBlack',attributes,{'tableName':_0x7186('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x030a=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3d85ed,_0x2bc677){var _0xf2d579=function(_0x3f7dae){while(--_0x3f7dae){_0x3d85ed['push'](_0x3d85ed['shift']());}};_0xf2d579(++_0x2bc677);}(_0x030a,0x13d));var _0xa030=function(_0x10b4b8,_0x450fea){_0x10b4b8=_0x10b4b8-0x0;var _0x424293=_0x030a[_0x10b4b8];return _0x424293;};'use strict';var _=require('lodash');var util=require(_0xa030('0x0'));var logger=require(_0xa030('0x1'))(_0xa030('0x2'));var moment=require(_0xa030('0x3'));var BPromise=require(_0xa030('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa030('0x5'));var rimraf=require(_0xa030('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xff93be,_0x54fafa){return _0xff93be['define'](_0xa030('0x7'),attributes,{'tableName':_0xa030('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 051b7b3..a4c0228 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 _0xe61f=['limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes','include','model','map','then','stringify','UpdateCmHopperBlack','CmHopperBlack','body','raw'];(function(_0x194f6a,_0x2709ef){var _0x4b1ddd=function(_0x3f75e6){while(--_0x3f75e6){_0x194f6a['push'](_0x194f6a['shift']());}};_0x4b1ddd(++_0x2709ef);}(_0xe61f,0x114));var _0xfe61=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe61f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfe61('0x0'));var util=require(_0xfe61('0x1'));var moment=require(_0xfe61('0x2'));var BPromise=require(_0xfe61('0x3'));var rs=require(_0xfe61('0x4'));var fs=require('fs');var Redis=require(_0xfe61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe61('0x6'));var logger=require('../../config/logger')(_0xfe61('0x7'));var config=require(_0xfe61('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe61('0x9')][_0xfe61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0098,_0x47cace,_0x2222d6){return new BPromise(function(_0x16e0f3,_0x24553b){return client[_0xfe61('0xb')](_0x2a0098,_0x2222d6)['then'](function(_0x1f2c59){logger[_0xfe61('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x47cace,_0xfe61('0xd'));logger[_0xfe61('0xe')](_0xfe61('0xf'),_0x47cace,'request\x20sent',JSON['stringify'](_0x1f2c59));if(_0x1f2c59[_0xfe61('0x10')]){if(_0x1f2c59[_0xfe61('0x10')][_0xfe61('0x11')]===0x1f4){logger['error'](_0xfe61('0x12'),_0x47cace,_0x1f2c59['error'][_0xfe61('0x13')]);return _0x24553b(_0x1f2c59[_0xfe61('0x10')][_0xfe61('0x13')]);}logger['error'](_0xfe61('0x12'),_0x47cace,_0x1f2c59[_0xfe61('0x10')]['message']);return _0x16e0f3(_0x1f2c59[_0xfe61('0x10')][_0xfe61('0x13')]);}else{logger[_0xfe61('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x47cace,'request\x20sent');_0x16e0f3(_0x1f2c59[_0xfe61('0x14')]['message']);}})[_0xfe61('0x15')](function(_0x3b4608){logger[_0xfe61('0x10')](_0xfe61('0x12'),_0x47cace,_0x3b4608);_0x24553b(_0x3b4608);});});}exports[_0xfe61('0x16')]=function(_0x349a80){var _0x1c8add=this;return new Promise(function(_0x476928,_0x38c8a2){return db['CmHopperBlack'][_0xfe61('0x17')]({'raw':_0x349a80['options']?_0x349a80['options']['raw']===undefined?!![]:![]:!![],'where':_0x349a80['options']?_0x349a80[_0xfe61('0x18')][_0xfe61('0x19')]||null:null,'attributes':_0x349a80[_0xfe61('0x18')]?_0x349a80['options'][_0xfe61('0x1a')]||null:null,'limit':_0x349a80[_0xfe61('0x18')]?_0x349a80['options']['limit']||null:null,'include':_0x349a80[_0xfe61('0x18')]?_0x349a80[_0xfe61('0x18')][_0xfe61('0x1b')]?_['map'](_0x349a80[_0xfe61('0x18')][_0xfe61('0x1b')],function(_0x2062fe){return{'model':db[_0x2062fe['model']],'as':_0x2062fe['as'],'attributes':_0x2062fe[_0xfe61('0x1a')],'include':_0x2062fe[_0xfe61('0x1b')]?_['map'](_0x2062fe['include'],function(_0x3eaf81){return{'model':db[_0x3eaf81[_0xfe61('0x1c')]],'as':_0x3eaf81['as'],'attributes':_0x3eaf81[_0xfe61('0x1a')],'include':_0x3eaf81[_0xfe61('0x1b')]?_[_0xfe61('0x1d')](_0x3eaf81[_0xfe61('0x1b')],function(_0x5df015){return{'model':db[_0x5df015[_0xfe61('0x1c')]],'as':_0x5df015['as'],'attributes':_0x5df015[_0xfe61('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfe61('0x1e')](function(_0x15f6e5){logger[_0xfe61('0xc')](_0xfe61('0x16'),_0x349a80);logger[_0xfe61('0xe')]('GetCmHopperBlack',_0x349a80,JSON[_0xfe61('0x1f')](_0x15f6e5));_0x476928(_0x15f6e5);})[_0xfe61('0x15')](function(_0x3ece1a){logger[_0xfe61('0x10')](_0xfe61('0x16'),_0x3ece1a['message'],_0x349a80);_0x38c8a2(_0x1c8add['error'](0x1f4,_0x3ece1a[_0xfe61('0x13')]));});});};exports[_0xfe61('0x20')]=function(_0x2e9374){var _0x2f59fa=this;return new Promise(function(_0x143988,_0x5b870f){return db[_0xfe61('0x21')]['update'](_0x2e9374[_0xfe61('0x22')],{'raw':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x19')]||null:null,'attributes':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x1a')]||null:null,'limit':_0x2e9374[_0xfe61('0x18')]?_0x2e9374[_0xfe61('0x18')][_0xfe61('0x24')]||null:null})[_0xfe61('0x1e')](function(_0x20f4b9){logger[_0xfe61('0xc')](_0xfe61('0x20'),_0x2e9374);logger[_0xfe61('0xe')](_0xfe61('0x20'),_0x2e9374,JSON[_0xfe61('0x1f')](_0x20f4b9));_0x143988(_0x20f4b9);})[_0xfe61('0x15')](function(_0x523d2e){logger[_0xfe61('0x10')](_0xfe61('0x20'),_0x523d2e[_0xfe61('0x13')],_0x2e9374);_0x5b870f(_0x2f59fa['error'](0x1f4,_0x523d2e['message']));});});};exports[_0xfe61('0x25')]=function(_0x52a893){var _0x461427=this;return new Promise(function(_0x235629,_0x28ed47){return db[_0xfe61('0x21')][_0xfe61('0x26')]({'where':_0x52a893['options']?_0x52a893['options'][_0xfe61('0x19')]||null:null})[_0xfe61('0x1e')](function(_0x21e19d){logger['info']('DestroyCmHopperBlack',_0x52a893);logger[_0xfe61('0xe')]('DestroyCmHopperBlack',_0x52a893,JSON[_0xfe61('0x1f')](_0x21e19d));_0x235629(_0x21e19d);})['catch'](function(_0x3c7e18){logger[_0xfe61('0x10')](_0xfe61('0x25'),_0x3c7e18[_0xfe61('0x13')],_0x52a893);_0x28ed47(_0x461427['error'](0x1f4,_0x3c7e18[_0xfe61('0x13')]));});});}; \ No newline at end of file +var _0x728a=['GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','info','UpdateCmHopperBlack','body','DestroyCmHopperBlack','CmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopperBlack,\x20%s,\x20%s','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x728a,0xf4));var _0xa728=function(_0x472fa8,_0x546f50){_0x472fa8=_0x472fa8-0x0;var _0x57f2f8=_0x728a[_0x472fa8];return _0x57f2f8;};'use strict';var _=require('lodash');var util=require(_0xa728('0x0'));var moment=require('moment');var BPromise=require(_0xa728('0x1'));var rs=require(_0xa728('0x2'));var fs=require('fs');var Redis=require(_0xa728('0x3'));var db=require(_0xa728('0x4'))['db'];var utils=require(_0xa728('0x5'));var logger=require(_0xa728('0x6'))(_0xa728('0x7'));var config=require(_0xa728('0x8'));var jayson=require(_0xa728('0x9'));var client=jayson[_0xa728('0xa')][_0xa728('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283e16,_0x58f4fb,_0x477ec7){return new BPromise(function(_0x4e9bb4,_0x1d2b33){return client[_0xa728('0xc')](_0x283e16,_0x477ec7)[_0xa728('0xd')](function(_0x39c669){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x58f4fb,_0xa728('0xe'));logger[_0xa728('0xf')](_0xa728('0x10'),_0x58f4fb,_0xa728('0xe'),JSON[_0xa728('0x11')](_0x39c669));if(_0x39c669[_0xa728('0x12')]){if(_0x39c669[_0xa728('0x12')]['code']===0x1f4){logger[_0xa728('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x58f4fb,_0x39c669[_0xa728('0x12')][_0xa728('0x13')]);return _0x1d2b33(_0x39c669['error'][_0xa728('0x13')]);}logger['error'](_0xa728('0x14'),_0x58f4fb,_0x39c669[_0xa728('0x12')]['message']);return _0x4e9bb4(_0x39c669[_0xa728('0x12')]['message']);}else{logger['info'](_0xa728('0x14'),_0x58f4fb,_0xa728('0xe'));_0x4e9bb4(_0x39c669['result'][_0xa728('0x13')]);}})[_0xa728('0x15')](function(_0x278ca9){logger[_0xa728('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x58f4fb,_0x278ca9);_0x1d2b33(_0x278ca9);});});}exports[_0xa728('0x16')]=function(_0x3762ad){var _0xc8d141=this;return new Promise(function(_0xf758a1,_0x3e8b9c){return db['CmHopperBlack'][_0xa728('0x17')]({'raw':_0x3762ad[_0xa728('0x18')]?_0x3762ad[_0xa728('0x18')][_0xa728('0x19')]===undefined?!![]:![]:!![],'where':_0x3762ad[_0xa728('0x18')]?_0x3762ad[_0xa728('0x18')][_0xa728('0x1a')]||null:null,'attributes':_0x3762ad['options']?_0x3762ad[_0xa728('0x18')][_0xa728('0x1b')]||null:null,'limit':_0x3762ad[_0xa728('0x18')]?_0x3762ad['options'][_0xa728('0x1c')]||null:null,'include':_0x3762ad[_0xa728('0x18')]?_0x3762ad[_0xa728('0x18')][_0xa728('0x1d')]?_[_0xa728('0x1e')](_0x3762ad[_0xa728('0x18')][_0xa728('0x1d')],function(_0x4f977e){return{'model':db[_0x4f977e['model']],'as':_0x4f977e['as'],'attributes':_0x4f977e[_0xa728('0x1b')],'include':_0x4f977e['include']?_['map'](_0x4f977e[_0xa728('0x1d')],function(_0x5625d3){return{'model':db[_0x5625d3[_0xa728('0x1f')]],'as':_0x5625d3['as'],'attributes':_0x5625d3['attributes'],'include':_0x5625d3[_0xa728('0x1d')]?_[_0xa728('0x1e')](_0x5625d3['include'],function(_0x3dc5c6){return{'model':db[_0x3dc5c6[_0xa728('0x1f')]],'as':_0x3dc5c6['as'],'attributes':_0x3dc5c6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa728('0xd')](function(_0x14f7e5){logger[_0xa728('0x20')](_0xa728('0x16'),_0x3762ad);logger[_0xa728('0xf')](_0xa728('0x16'),_0x3762ad,JSON[_0xa728('0x11')](_0x14f7e5));_0xf758a1(_0x14f7e5);})[_0xa728('0x15')](function(_0x1fbc56){logger[_0xa728('0x12')]('GetCmHopperBlack',_0x1fbc56['message'],_0x3762ad);_0x3e8b9c(_0xc8d141[_0xa728('0x12')](0x1f4,_0x1fbc56[_0xa728('0x13')]));});});};exports[_0xa728('0x21')]=function(_0x2e286e){var _0x52b9cd=this;return new Promise(function(_0x553785,_0x404d0c){return db['CmHopperBlack']['update'](_0x2e286e[_0xa728('0x22')],{'raw':_0x2e286e[_0xa728('0x18')]?_0x2e286e[_0xa728('0x18')][_0xa728('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e286e[_0xa728('0x18')]?_0x2e286e[_0xa728('0x18')][_0xa728('0x1a')]||null:null,'attributes':_0x2e286e[_0xa728('0x18')]?_0x2e286e[_0xa728('0x18')][_0xa728('0x1b')]||null:null,'limit':_0x2e286e['options']?_0x2e286e[_0xa728('0x18')][_0xa728('0x1c')]||null:null})[_0xa728('0xd')](function(_0x35349e){logger['info'](_0xa728('0x21'),_0x2e286e);logger[_0xa728('0xf')](_0xa728('0x21'),_0x2e286e,JSON[_0xa728('0x11')](_0x35349e));_0x553785(_0x35349e);})[_0xa728('0x15')](function(_0x299660){logger[_0xa728('0x12')](_0xa728('0x21'),_0x299660[_0xa728('0x13')],_0x2e286e);_0x404d0c(_0x52b9cd['error'](0x1f4,_0x299660[_0xa728('0x13')]));});});};exports[_0xa728('0x23')]=function(_0x1112d2){var _0x187278=this;return new Promise(function(_0x48e584,_0x1d1320){return db[_0xa728('0x24')][_0xa728('0x25')]({'where':_0x1112d2[_0xa728('0x18')]?_0x1112d2['options'][_0xa728('0x1a')]||null:null})[_0xa728('0xd')](function(_0x4ed093){logger[_0xa728('0x20')](_0xa728('0x23'),_0x1112d2);logger[_0xa728('0xf')](_0xa728('0x23'),_0x1112d2,JSON[_0xa728('0x11')](_0x4ed093));_0x48e584(_0x4ed093);})[_0xa728('0x15')](function(_0x56f87a){logger[_0xa728('0x12')](_0xa728('0x23'),_0x56f87a[_0xa728('0x13')],_0x1112d2);_0x1d1320(_0x187278[_0xa728('0x12')](0x1f4,_0x56f87a[_0xa728('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4c24fb7..c5f0bbd 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 _0x7bae=['index','/describe','describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x5ef413,_0x3948a8){var _0x469ead=function(_0x95479e){while(--_0x95479e){_0x5ef413['push'](_0x5ef413['shift']());}};_0x469ead(++_0x3948a8);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7bae[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7ba('0x3'));var config=require(_0xe7ba('0x4'));var controller=require(_0xe7ba('0x5'));router[_0xe7ba('0x6')]('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x8')]);router[_0xe7ba('0x6')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xa')]);router[_0xe7ba('0x6')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xc')]);router['put'](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xd')]);router[_0xe7ba('0xe')](_0xe7ba('0xb'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xf')]);module[_0xe7ba('0x10')]=router; \ No newline at end of file +var _0x425d=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5e53ae,_0x24af4f){var _0x27a8a2=function(_0xa6a715){while(--_0xa6a715){_0x5e53ae['push'](_0x5e53ae['shift']());}};_0x27a8a2(++_0x24af4f);}(_0x425d,0x1e0));var _0xd425=function(_0xaa0cb9,_0x28081b){_0xaa0cb9=_0xaa0cb9-0x0;var _0x548207=_0x425d[_0xaa0cb9];return _0x548207;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./cmHopperBlack.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0xe')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);module[_0xd425('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8407835..a91c161 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 _0xe1ea=['followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','endtime','setDataValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe1ea,0x19c));var _0xae1e=function(_0x3ff2da,_0x109bc2){_0x3ff2da=_0x3ff2da-0x0;var _0x8c1dda=_0xe1ea[_0x3ff2da];return _0x8c1dda;};'use strict';var Sequelize=require(_0xae1e('0x0'));var moment=require(_0xae1e('0x1'));module[_0xae1e('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xae1e('0x3')]},'scheduledat':{'type':Sequelize[_0xae1e('0x4')]},'countbusyretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xae1e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xae1e('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xae1e('0x3')]},'calleridname':{'type':Sequelize[_0xae1e('0x3')]},'starttime':{'type':Sequelize[_0xae1e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xae1e('0x4')]},'droptime':{'type':Sequelize[_0xae1e('0x4')]},'endtime':{'type':Sequelize[_0xae1e('0x4')]},'ringtime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xae1e('0x3')]},'campaigntype':{'type':Sequelize[_0xae1e('0x3')]},'membername':{'type':Sequelize[_0xae1e('0x3')]},'reason':{'type':Sequelize[_0xae1e('0x3')]},'disposition':{'type':Sequelize[_0xae1e('0x3')]},'secondDisposition':{'type':Sequelize[_0xae1e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3f43ae){var _0x5ee332=this['getDataValue'](_0xae1e('0x6'));if(_0x5ee332&&_0x3f43ae){this[_0xae1e('0x7')](_0xae1e('0x8'),moment(_0x3f43ae)['diff'](moment(_0x5ee332),_0xae1e('0x9')));}return this[_0xae1e('0x7')](_0xae1e('0xa'),_0x3f43ae);}},'amd':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xae1e('0x4')]},'callback':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xae1e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xae1e('0x4')]},'deleted':{'type':Sequelize[_0xae1e('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xae1e('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xae1e('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe780=['moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe780,0x90));var _0x0e78=function(_0x2a8a57,_0x28403f){_0x2a8a57=_0x2a8a57-0x0;var _0x2db821=_0xe780[_0x2a8a57];return _0x2db821;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0e78('0x0'));module[_0x0e78('0x1')]={'state':{'type':Sequelize[_0x0e78('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0e78('0x3')]},'scheduledat':{'type':Sequelize[_0x0e78('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0e78('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0e78('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0e78('0x3')]},'calleridnum':{'type':Sequelize[_0x0e78('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0e78('0x4')]},'responsetime':{'type':Sequelize[_0x0e78('0x4')]},'answertime':{'type':Sequelize[_0x0e78('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0e78('0x3')]},'campaign':{'type':Sequelize[_0x0e78('0x3')]},'campaigntype':{'type':Sequelize[_0x0e78('0x3')]},'membername':{'type':Sequelize[_0x0e78('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0e78('0x3')]},'secondDisposition':{'type':Sequelize[_0x0e78('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0e78('0x3')]},'dispositionat':{'type':Sequelize[_0x0e78('0x4')],'set':function(_0x242e91){var _0x10e1f7=this[_0x0e78('0x5')](_0x0e78('0x6'));if(_0x10e1f7&&_0x242e91){this[_0x0e78('0x7')](_0x0e78('0x8'),moment(_0x242e91)['diff'](moment(_0x10e1f7),_0x0e78('0x9')));}return this[_0x0e78('0x7')](_0x0e78('0xa'),_0x242e91);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0e78('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0e78('0x4')]},'callback':{'type':Sequelize[_0x0e78('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0e78('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0e78('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0e78('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0e78('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e78('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 9d0d10f..0018c6f 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 _0xf109=['limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','then','rows','catch','params','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','moment','bluebird','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/utils','../../config/environment','../../config/license/util','status','end','offset','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x5cfc87,_0x3efea7){var _0x3c19f2=function(_0x2f06ec){while(--_0x2f06ec){_0x5cfc87['push'](_0x5cfc87['shift']());}};_0x3c19f2(++_0x3efea7);}(_0xf109,0xce));var _0x9f10=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xf109[_0x2b9b7f];return _0x4ed19a;};'use strict';var pdf=require(_0x9f10('0x0'));var emlformat=require(_0x9f10('0x1'));var rimraf=require(_0x9f10('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f10('0x3'));var BPromise=require(_0x9f10('0x4'));var Mustache=require(_0x9f10('0x5'));var util=require(_0x9f10('0x6'));var path=require(_0x9f10('0x7'));var sox=require(_0x9f10('0x8'));var csv=require(_0x9f10('0x9'));var ejs=require(_0x9f10('0xa'));var fs=require('fs');var _=require(_0x9f10('0xb'));var squel=require(_0x9f10('0xc'));var crypto=require(_0x9f10('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f10('0xe'));var toCsv=require(_0x9f10('0x9'));var querystring=require(_0x9f10('0xf'));var Papa=require(_0x9f10('0x10'));var Redis=require(_0x9f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f10('0x12'));var as=require(_0x9f10('0x13'));var hardwareService=require(_0x9f10('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f10('0x15'));var config=require(_0x9f10('0x16'));var licenseUtil=require(_0x9f10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x289164,_0x260606){_0x260606=_0x260606||0xcc;return function(_0x35c529){if(_0x35c529){return _0x289164['sendStatus'](_0x260606);}return _0x289164[_0x9f10('0x18')](_0x260606)[_0x9f10('0x19')]();};}function respondWithResult(_0x5be443,_0x40a48a){_0x40a48a=_0x40a48a||0xc8;return function(_0x236e28){if(_0x236e28){return _0x5be443['status'](_0x40a48a)['json'](_0x236e28);}};}function respondWithFilteredResult(_0x2b6c4c,_0x177918){return function(_0x549217){if(_0x549217){var _0x11154b=_0x549217['count'],_0x5ae255=_0x177918[_0x9f10('0x1a')],_0x14d3fe=_0x177918[_0x9f10('0x1a')]+_0x177918['limit'],_0x1f68d8;if(_0x14d3fe>=_0x11154b){_0x14d3fe=_0x11154b;_0x1f68d8=0xc8;}else{_0x1f68d8=0xce;}_0x2b6c4c[_0x9f10('0x18')](_0x1f68d8);return _0x2b6c4c['set'](_0x9f10('0x1b'),_0x5ae255+'-'+_0x14d3fe+'/'+_0x11154b)['json'](_0x549217);}return null;};}function patchUpdates(_0x2c5064){return function(_0x56fb44){try{jsonpatch['apply'](_0x56fb44,_0x2c5064,!![]);}catch(_0x3d216b){return BPromise[_0x9f10('0x1c')](_0x3d216b);}return _0x56fb44[_0x9f10('0x1d')]();};}function saveUpdates(_0x3a78be,_0xa810c){return function(_0x332575){if(_0x332575){return _0x332575[_0x9f10('0x1e')](_0x3a78be)['then'](function(_0x366044){return _0x366044;});}return null;};}function removeEntity(_0x58e6ba,_0x293990){return function(_0x36ace4){if(_0x36ace4){return _0x36ace4[_0x9f10('0x1f')]()['then'](function(){_0x58e6ba[_0x9f10('0x18')](0xcc)[_0x9f10('0x19')]();});}};}function handleEntityNotFound(_0x213567,_0x4d21c5){return function(_0x36821e){if(!_0x36821e){_0x213567[_0x9f10('0x20')](0x194);}return _0x36821e;};}function handleError(_0x44b99d,_0x4c531e){_0x4c531e=_0x4c531e||0x1f4;return function(_0x2ec07d){logger[_0x9f10('0x21')](_0x2ec07d[_0x9f10('0x22')]);if(_0x2ec07d[_0x9f10('0x23')]){delete _0x2ec07d['name'];}_0x44b99d['status'](_0x4c531e)['send'](_0x2ec07d);};}exports[_0x9f10('0x24')]=function(_0x4a0407,_0x314794){var _0x1de75a={},_0x45fffc={},_0x2ed95b={'count':0x0,'rows':[]};var _0x2e11b1=_['map'](db[_0x9f10('0x25')][_0x9f10('0x26')],function(_0x40f96b){return{'name':_0x40f96b[_0x9f10('0x27')],'type':_0x40f96b[_0x9f10('0x28')][_0x9f10('0x29')]};});_0x45fffc['model']=_[_0x9f10('0x2a')](_0x2e11b1,_0x9f10('0x23'));_0x45fffc[_0x9f10('0x2b')]=_[_0x9f10('0x2c')](_0x4a0407['query']);_0x45fffc[_0x9f10('0x2d')]=_[_0x9f10('0x2e')](_0x45fffc[_0x9f10('0x2f')],_0x45fffc['query']);_0x1de75a[_0x9f10('0x30')]=_['intersection'](_0x45fffc[_0x9f10('0x2f')],qs[_0x9f10('0x31')](_0x4a0407[_0x9f10('0x2b')]['fields']));_0x1de75a[_0x9f10('0x30')]=_0x1de75a[_0x9f10('0x30')][_0x9f10('0x32')]?_0x1de75a[_0x9f10('0x30')]:_0x45fffc[_0x9f10('0x2f')];if(!_0x4a0407['query'][_0x9f10('0x33')]('nolimit')){_0x1de75a[_0x9f10('0x34')]=qs[_0x9f10('0x34')](_0x4a0407[_0x9f10('0x2b')][_0x9f10('0x34')]);_0x1de75a[_0x9f10('0x1a')]=qs[_0x9f10('0x1a')](_0x4a0407['query'][_0x9f10('0x1a')]);}_0x1de75a[_0x9f10('0x35')]=qs[_0x9f10('0x36')](_0x4a0407['query'][_0x9f10('0x36')]);_0x1de75a[_0x9f10('0x37')]=qs['filters'](_[_0x9f10('0x38')](_0x4a0407['query'],_0x45fffc[_0x9f10('0x2d')]),_0x2e11b1);if(_0x4a0407[_0x9f10('0x2b')][_0x9f10('0x39')]){_0x1de75a[_0x9f10('0x37')]=_[_0x9f10('0x3a')](_0x1de75a[_0x9f10('0x37')],{'$or':_[_0x9f10('0x2a')](_0x2e11b1,function(_0x1db955){if(_0x1db955['type']!==_0x9f10('0x3b')){var _0x622030={};_0x622030[_0x1db955[_0x9f10('0x23')]]={'$like':'%'+_0x4a0407['query'][_0x9f10('0x39')]+'%'};return _0x622030;}})});}_0x1de75a=_[_0x9f10('0x3a')]({},_0x1de75a,_0x4a0407['options']);var _0x30b04b={'where':_0x1de75a[_0x9f10('0x37')]};return db[_0x9f10('0x25')]['count'](_0x30b04b)['then'](function(_0x2e4e2d){_0x2ed95b[_0x9f10('0x3c')]=_0x2e4e2d;if(_0x4a0407[_0x9f10('0x2b')][_0x9f10('0x3d')]){_0x1de75a[_0x9f10('0x3e')]=[{'all':!![]}];}return db[_0x9f10('0x25')][_0x9f10('0x3f')](_0x1de75a);})[_0x9f10('0x40')](function(_0x7fe320){_0x2ed95b[_0x9f10('0x41')]=_0x7fe320;return _0x2ed95b;})[_0x9f10('0x40')](respondWithFilteredResult(_0x314794,_0x1de75a))[_0x9f10('0x42')](handleError(_0x314794,null));};exports['show']=function(_0x5e3f06,_0x4bb805){var _0x24700a={'raw':!![],'where':{'id':_0x5e3f06[_0x9f10('0x43')]['id']}},_0x5c8c44={};_0x5c8c44[_0x9f10('0x2f')]=_[_0x9f10('0x2c')](db['CmHopperFinal'][_0x9f10('0x26')]);_0x5c8c44[_0x9f10('0x2b')]=_[_0x9f10('0x2c')](_0x5e3f06[_0x9f10('0x2b')]);_0x5c8c44[_0x9f10('0x2d')]=_['intersection'](_0x5c8c44['model'],_0x5c8c44['query']);_0x24700a[_0x9f10('0x30')]=_['intersection'](_0x5c8c44[_0x9f10('0x2f')],qs['fields'](_0x5e3f06[_0x9f10('0x2b')][_0x9f10('0x31')]));_0x24700a[_0x9f10('0x30')]=_0x24700a[_0x9f10('0x30')]['length']?_0x24700a[_0x9f10('0x30')]:_0x5c8c44[_0x9f10('0x2f')];if(_0x5e3f06['query'][_0x9f10('0x3d')]){_0x24700a[_0x9f10('0x3e')]=[{'all':!![]}];}_0x24700a=_[_0x9f10('0x3a')]({},_0x24700a,_0x5e3f06[_0x9f10('0x44')]);return db[_0x9f10('0x25')][_0x9f10('0x45')](_0x24700a)[_0x9f10('0x40')](handleEntityNotFound(_0x4bb805,null))[_0x9f10('0x40')](respondWithResult(_0x4bb805,null))[_0x9f10('0x42')](handleError(_0x4bb805,null));};exports[_0x9f10('0x46')]=function(_0x552588,_0x181eab){return db[_0x9f10('0x25')]['describe']()[_0x9f10('0x40')](respondWithResult(_0x181eab,null))[_0x9f10('0x42')](handleError(_0x181eab,null));};exports[_0x9f10('0x1e')]=function(_0x1807b3,_0x58b5b5){if(_0x1807b3[_0x9f10('0x47')][_0x9f10('0x48')]){delete _0x1807b3[_0x9f10('0x47')][_0x9f10('0x48')];}return db[_0x9f10('0x25')][_0x9f10('0x45')]({'where':{'uniqueid':_0x1807b3['params']['id']}})[_0x9f10('0x40')](handleEntityNotFound(_0x58b5b5,null))[_0x9f10('0x40')](saveUpdates(_0x1807b3[_0x9f10('0x47')],null))[_0x9f10('0x40')](respondWithResult(_0x58b5b5,null))[_0x9f10('0x42')](handleError(_0x58b5b5,null));};exports[_0x9f10('0x49')]=function(_0x52c069,_0x3ec147,_0x1bbf92){return db[_0x9f10('0x25')][_0x9f10('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x52c069[_0x9f10('0x43')]['id']},'attributes':[[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x9f10('0x4d')],[db['sequelize']['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x4e')))),'noAnswerContacts'],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x9f10('0x4f')],[db[_0x9f10('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x50')))),'congestionContacts'],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')](_0x9f10('0x51')))),_0x9f10('0x52')],[db['sequelize']['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')](_0x9f10('0x53')))),_0x9f10('0x54')],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db['sequelize']['fn']('IF',db[_0x9f10('0x4a')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9f10('0x55')],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x56')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x3ec147,null))[_0x9f10('0x40')](respondWithResult(_0x3ec147,null))[_0x9f10('0x42')](handleError(_0x3ec147,null));};exports[_0x9f10('0x57')]=function(_0x40f845,_0x2625ca,_0x2094c9){return db[_0x9f10('0x25')]['findAll']({'raw':![],'where':{'CampaignId':_0x40f845[_0x9f10('0x43')]['id']},'attributes':[[db[_0x9f10('0x4a')]['fn']('COUNT',db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')]['literal'](_0x9f10('0x58')))),_0x9f10('0x4d')],[db['sequelize']['fn'](_0x9f10('0x4b'),db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x4e')))),_0x9f10('0x59')],[db[_0x9f10('0x4a')]['fn']('COUNT',db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x9f10('0x4a')]['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x50')))),_0x9f10('0x5a')],[db['sequelize']['fn'](_0x9f10('0x4b'),db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9f10('0x52')],[db[_0x9f10('0x4a')]['fn']('COUNT',db[_0x9f10('0x4a')]['fn']('IF',db['sequelize'][_0x9f10('0x4c')](_0x9f10('0x53')))),_0x9f10('0x54')],[db['sequelize']['fn'](_0x9f10('0x4b'),db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x5b')))),'reCallContacts'],[db[_0x9f10('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9f10('0x4a')][_0x9f10('0x4c')](_0x9f10('0x56')))),'answeringMachine']]})[_0x9f10('0x40')](handleEntityNotFound(_0x2625ca,null))['then'](respondWithResult(_0x2625ca,null))['catch'](handleError(_0x2625ca,null));};exports[_0x9f10('0x5c')]=function(_0x551a5d,_0x4e7b27,_0x13a2cb){return db['VoiceQueue'][_0x9f10('0x45')]({'where':{'id':_0x551a5d[_0x9f10('0x43')]['id']}})[_0x9f10('0x40')](handleEntityNotFound(_0x4e7b27,null))['then'](function(_0x30b571){var _0x1cbcf3;if(_0x30b571){_0x1cbcf3=squel['insert']()[_0x9f10('0x5d')]('cm_hopper')['fromQuery']([_0x9f10('0x5e'),_0x9f10('0x5f'),_0x9f10('0x60'),_0x9f10('0x61'),_0x9f10('0x62'),_0x9f10('0x63'),_0x9f10('0x64')],squel['select']()[_0x9f10('0x65')](_0x9f10('0x66'),_0x9f10('0x5e'))[_0x9f10('0x65')](_0x9f10('0x67'),_0x9f10('0x5f'))[_0x9f10('0x65')](_0x9f10('0x68'),_0x9f10('0x60'))['field'](_0x9f10('0x69'),_0x9f10('0x61'))[_0x9f10('0x65')](_0x9f10('0x6a'),'VoiceQueueId')[_0x9f10('0x65')](_0x9f10('0x67'),_0x9f10('0x63'))[_0x9f10('0x65')]('NOW()','updatedAt')[_0x9f10('0x6b')](_0x9f10('0x6c'))[_0x9f10('0x37')](_0x9f10('0x6d'),_0x551a5d[_0x9f10('0x43')]['id'][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x6f'),_0x551a5d[_0x9f10('0x47')][_0x9f10('0x70')][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x71'))[_0x9f10('0x37')](_0x9f10('0x72'),squel['select']()[_0x9f10('0x65')](_0x9f10('0x5e'))['from'](_0x9f10('0x73'))[_0x9f10('0x37')](_0x9f10('0x6d'),_0x551a5d[_0x9f10('0x43')]['id']['toString']()))[_0x9f10('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9f10('0x74')]()[_0x9f10('0x65')](_0x9f10('0x75'))['from'](_0x9f10('0x6c'))[_0x9f10('0x37')](_0x9f10('0x6d'),_0x551a5d['params']['id'][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x76')))['group']('ContactId'))['toString']();return db['sequelize']['query'](_0x1cbcf3);}return[];})['then'](respondWithResult(_0x4e7b27,null))['catch'](handleError(_0x4e7b27,null));};exports[_0x9f10('0x77')]=function(_0x2571a6,_0x4dc5d5,_0xa0988b){return db[_0x9f10('0x78')][_0x9f10('0x45')]({'where':{'id':_0x2571a6[_0x9f10('0x43')]['id']}})[_0x9f10('0x40')](handleEntityNotFound(_0x4dc5d5,null))[_0x9f10('0x40')](function(_0x45ebcc){var _0x27a67c;if(_0x45ebcc){_0x27a67c=squel[_0x9f10('0x79')]()[_0x9f10('0x5d')]('cm_hopper')[_0x9f10('0x7a')]([_0x9f10('0x5e'),'scheduledAt',_0x9f10('0x60'),'ListId','CampaignId',_0x9f10('0x63'),_0x9f10('0x64')],squel['select']()[_0x9f10('0x65')](_0x9f10('0x66'),'phone')[_0x9f10('0x65')](_0x9f10('0x67'),_0x9f10('0x5f'))['field'](_0x9f10('0x68'),_0x9f10('0x60'))['field']('ANY_VALUE(ListId)',_0x9f10('0x61'))[_0x9f10('0x65')]('ANY_VALUE(CampaignId)',_0x9f10('0x7b'))[_0x9f10('0x65')]('NOW()','createdAt')[_0x9f10('0x65')](_0x9f10('0x67'),'updatedAt')['from'](_0x9f10('0x6c'))[_0x9f10('0x37')]('CampaignId\x20=\x20?',_0x2571a6[_0x9f10('0x43')]['id'][_0x9f10('0x6e')]())[_0x9f10('0x37')](_0x9f10('0x6f'),_0x2571a6[_0x9f10('0x47')]['state']['toString']())['where'](_0x9f10('0x71'))[_0x9f10('0x37')](_0x9f10('0x72'),squel['select']()[_0x9f10('0x65')]('phone')[_0x9f10('0x6b')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x2571a6[_0x9f10('0x43')]['id'][_0x9f10('0x6e')]()))[_0x9f10('0x37')](_0x9f10('0x72'),squel[_0x9f10('0x74')]()[_0x9f10('0x65')](_0x9f10('0x75'))[_0x9f10('0x6b')]('cm_hopper_final')[_0x9f10('0x37')](_0x9f10('0x7c'),_0x2571a6[_0x9f10('0x43')]['id']['toString']())[_0x9f10('0x37')](_0x9f10('0x76')))[_0x9f10('0x7d')](_0x9f10('0x60')))[_0x9f10('0x6e')]();return db['sequelize'][_0x9f10('0x2b')](_0x27a67c);}return[];})['then'](respondWithResult(_0x4dc5d5,null))[_0x9f10('0x42')](handleError(_0x4dc5d5,null));};exports[_0x9f10('0x7e')]=function(_0x559701,_0x25698c,_0x331330){return db[_0x9f10('0x7f')][_0x9f10('0x80')]({'where':{'VoiceQueueId':_0x559701['body'][_0x9f10('0x62')],'CampaignId':_0x559701['body'][_0x9f10('0x7b')],'ContactId':_0x559701[_0x9f10('0x47')]['ContactId']}})['then'](handleEntityNotFound(_0x25698c,null))[_0x9f10('0x40')](function(_0x52f70c){if(_0x52f70c){return _0x52f70c;}return null;})['then'](respondWithResult(_0x25698c,null))['catch'](handleError(_0x25698c,null));}; \ No newline at end of file +var _0xb43b=['includeAll','include','findAll','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','busyContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','CmHopperFinal'];(function(_0x32e54a,_0x59fc0d){var _0x109af4=function(_0x564be8){while(--_0x564be8){_0x32e54a['push'](_0x32e54a['shift']());}};_0x109af4(++_0x59fc0d);}(_0xb43b,0xbf));var _0xbb43=function(_0x276eaf,_0x541331){_0x276eaf=_0x276eaf-0x0;var _0x161262=_0xb43b[_0x276eaf];return _0x161262;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb43('0x1'));var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require(_0xbb43('0x5'));var BPromise=require(_0xbb43('0x6'));var Mustache=require(_0xbb43('0x7'));var util=require(_0xbb43('0x8'));var path=require(_0xbb43('0x9'));var sox=require(_0xbb43('0xa'));var csv=require(_0xbb43('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xb'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=_0x32425c[_0xbb43('0x1a')],_0x10c91b=_0x199726[_0xbb43('0x1b')],_0x3be44b=_0x199726[_0xbb43('0x1b')]+_0x199726[_0xbb43('0x1c')],_0x126f61;if(_0x3be44b>=_0x15182b){_0x3be44b=_0x15182b;_0x126f61=0xc8;}else{_0x126f61=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x126f61);return _0x4ac25c['set'](_0xbb43('0x1d'),_0x10c91b+'-'+_0x3be44b+'/'+_0x15182b)['json'](_0x32425c);}return null;};}function patchUpdates(_0x44fd04){return function(_0x5f4b4f){try{jsonpatch[_0xbb43('0x1e')](_0x5f4b4f,_0x44fd04,!![]);}catch(_0x27579a){return BPromise['reject'](_0x27579a);}return _0x5f4b4f[_0xbb43('0x1f')]();};}function saveUpdates(_0x6cdc26,_0x398ce5){return function(_0x6f34d6){if(_0x6f34d6){return _0x6f34d6[_0xbb43('0x20')](_0x6cdc26)[_0xbb43('0x21')](function(_0xee1084){return _0xee1084;});}return null;};}function removeEntity(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')]()[_0xbb43('0x21')](function(){_0x1e83cd[_0xbb43('0x17')](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0x500af4,_0x28b3e4){return function(_0x326864){if(!_0x326864){_0x500af4['sendStatus'](0x194);}return _0x326864;};}function handleError(_0x464b4a,_0x2b07d8){_0x2b07d8=_0x2b07d8||0x1f4;return function(_0x25279b){logger['error'](_0x25279b['stack']);if(_0x25279b[_0xbb43('0x23')]){delete _0x25279b[_0xbb43('0x23')];}_0x464b4a['status'](_0x2b07d8)['send'](_0x25279b);};}exports[_0xbb43('0x24')]=function(_0xb9fe3b,_0x268fb5){var _0x4bb859={},_0x27bb65={},_0x426cec={'count':0x0,'rows':[]};var _0x2dcc60=_[_0xbb43('0x25')](db['CmHopperFinal'][_0xbb43('0x26')],function(_0x170e7a){return{'name':_0x170e7a[_0xbb43('0x27')],'type':_0x170e7a[_0xbb43('0x28')][_0xbb43('0x29')]};});_0x27bb65[_0xbb43('0x2a')]=_[_0xbb43('0x25')](_0x2dcc60,'name');_0x27bb65[_0xbb43('0x2b')]=_[_0xbb43('0x2c')](_0xb9fe3b[_0xbb43('0x2b')]);_0x27bb65['filters']=_[_0xbb43('0x2d')](_0x27bb65[_0xbb43('0x2a')],_0x27bb65[_0xbb43('0x2b')]);_0x4bb859[_0xbb43('0x2e')]=_[_0xbb43('0x2d')](_0x27bb65[_0xbb43('0x2a')],qs[_0xbb43('0x2f')](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x2f')]));_0x4bb859['attributes']=_0x4bb859['attributes']['length']?_0x4bb859['attributes']:_0x27bb65[_0xbb43('0x2a')];if(!_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x30')](_0xbb43('0x31'))){_0x4bb859[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x1c')]);_0x4bb859['offset']=qs[_0xbb43('0x1b')](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x1b')]);}_0x4bb859[_0xbb43('0x32')]=qs['sort'](_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x33')]);_0x4bb859[_0xbb43('0x34')]=qs[_0xbb43('0x35')](_['pick'](_0xb9fe3b[_0xbb43('0x2b')],_0x27bb65['filters']),_0x2dcc60);if(_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x36')]){_0x4bb859[_0xbb43('0x34')]=_[_0xbb43('0x37')](_0x4bb859[_0xbb43('0x34')],{'$or':_[_0xbb43('0x25')](_0x2dcc60,function(_0x316ab1){if(_0x316ab1[_0xbb43('0x28')]!==_0xbb43('0x38')){var _0xa48590={};_0xa48590[_0x316ab1[_0xbb43('0x23')]]={'$like':'%'+_0xb9fe3b[_0xbb43('0x2b')]['filter']+'%'};return _0xa48590;}})});}_0x4bb859=_[_0xbb43('0x37')]({},_0x4bb859,_0xb9fe3b[_0xbb43('0x39')]);var _0x363e1a={'where':_0x4bb859[_0xbb43('0x34')]};return db[_0xbb43('0x3a')][_0xbb43('0x1a')](_0x363e1a)[_0xbb43('0x21')](function(_0x3d7d56){_0x426cec[_0xbb43('0x1a')]=_0x3d7d56;if(_0xb9fe3b[_0xbb43('0x2b')][_0xbb43('0x3b')]){_0x4bb859[_0xbb43('0x3c')]=[{'all':!![]}];}return db[_0xbb43('0x3a')][_0xbb43('0x3d')](_0x4bb859);})[_0xbb43('0x21')](function(_0x4a76a8){_0x426cec[_0xbb43('0x3e')]=_0x4a76a8;return _0x426cec;})[_0xbb43('0x21')](respondWithFilteredResult(_0x268fb5,_0x4bb859))[_0xbb43('0x3f')](handleError(_0x268fb5,null));};exports[_0xbb43('0x40')]=function(_0x60a465,_0x4b32c9){var _0x5e942e={'raw':!![],'where':{'id':_0x60a465[_0xbb43('0x41')]['id']}},_0x13e9f7={};_0x13e9f7['model']=_['keys'](db[_0xbb43('0x3a')][_0xbb43('0x26')]);_0x13e9f7[_0xbb43('0x2b')]=_[_0xbb43('0x2c')](_0x60a465[_0xbb43('0x2b')]);_0x13e9f7['filters']=_['intersection'](_0x13e9f7[_0xbb43('0x2a')],_0x13e9f7[_0xbb43('0x2b')]);_0x5e942e[_0xbb43('0x2e')]=_[_0xbb43('0x2d')](_0x13e9f7[_0xbb43('0x2a')],qs[_0xbb43('0x2f')](_0x60a465[_0xbb43('0x2b')][_0xbb43('0x2f')]));_0x5e942e[_0xbb43('0x2e')]=_0x5e942e[_0xbb43('0x2e')]['length']?_0x5e942e['attributes']:_0x13e9f7[_0xbb43('0x2a')];if(_0x60a465[_0xbb43('0x2b')]['includeAll']){_0x5e942e[_0xbb43('0x3c')]=[{'all':!![]}];}_0x5e942e=_[_0xbb43('0x37')]({},_0x5e942e,_0x60a465[_0xbb43('0x39')]);return db[_0xbb43('0x3a')][_0xbb43('0x42')](_0x5e942e)[_0xbb43('0x21')](handleEntityNotFound(_0x4b32c9,null))[_0xbb43('0x21')](respondWithResult(_0x4b32c9,null))['catch'](handleError(_0x4b32c9,null));};exports[_0xbb43('0x43')]=function(_0x229928,_0x5970cc){return db[_0xbb43('0x3a')][_0xbb43('0x43')]()['then'](respondWithResult(_0x5970cc,null))[_0xbb43('0x3f')](handleError(_0x5970cc,null));};exports[_0xbb43('0x20')]=function(_0xd1f32b,_0x15fab6){if(_0xd1f32b[_0xbb43('0x44')][_0xbb43('0x45')]){delete _0xd1f32b[_0xbb43('0x44')][_0xbb43('0x45')];}return db[_0xbb43('0x3a')][_0xbb43('0x42')]({'where':{'uniqueid':_0xd1f32b[_0xbb43('0x41')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x15fab6,null))['then'](saveUpdates(_0xd1f32b[_0xbb43('0x44')],null))[_0xbb43('0x21')](respondWithResult(_0x15fab6,null))[_0xbb43('0x3f')](handleError(_0x15fab6,null));};exports[_0xbb43('0x46')]=function(_0x4ab63b,_0x33d21b,_0x4998fb){return db[_0xbb43('0x3a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4ab63b[_0xbb43('0x41')]['id']},'attributes':[[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db['sequelize']['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4a')))),'noSuchContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db['sequelize']['fn']('IF',db[_0xbb43('0x47')]['literal'](_0xbb43('0x4b')))),_0xbb43('0x4c')],[db['sequelize']['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')]['literal'](_0xbb43('0x4d')))),'busyContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x4e')))),'congestionContacts'],[db['sequelize']['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db['sequelize']['literal'](_0xbb43('0x4f')))),'dropContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x50')))),'reCallContacts'],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x51')))),_0xbb43('0x52')]]})[_0xbb43('0x21')](handleEntityNotFound(_0x33d21b,null))['then'](respondWithResult(_0x33d21b,null))[_0xbb43('0x3f')](handleError(_0x33d21b,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3f3292,_0x213747,_0x512619){return db[_0xbb43('0x3a')][_0xbb43('0x3d')]({'raw':![],'where':{'CampaignId':_0x3f3292['params']['id']},'attributes':[[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4a')))),_0xbb43('0x53')],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x4b')))),'noAnswerContacts'],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4d')))),_0xbb43('0x54')],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x4e')))),'congestionContacts'],[db[_0xbb43('0x47')]['fn']('COUNT',db[_0xbb43('0x47')]['fn']('IF',db['sequelize'][_0xbb43('0x49')](_0xbb43('0x4f')))),_0xbb43('0x55')],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x56')))),_0xbb43('0x57')],[db['sequelize']['fn'](_0xbb43('0x48'),db['sequelize']['fn']('IF',db[_0xbb43('0x47')][_0xbb43('0x49')](_0xbb43('0x50')))),_0xbb43('0x58')],[db[_0xbb43('0x47')]['fn'](_0xbb43('0x48'),db[_0xbb43('0x47')]['fn']('IF',db[_0xbb43('0x47')]['literal'](_0xbb43('0x51')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x213747,null))[_0xbb43('0x21')](respondWithResult(_0x213747,null))['catch'](handleError(_0x213747,null));};exports[_0xbb43('0x59')]=function(_0x212dc9,_0x4eb58f,_0x221727){return db[_0xbb43('0x5a')]['find']({'where':{'id':_0x212dc9[_0xbb43('0x41')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x4eb58f,null))[_0xbb43('0x21')](function(_0x14678c){var _0x40ac8c;if(_0x14678c){_0x40ac8c=squel[_0xbb43('0x5b')]()[_0xbb43('0x5c')](_0xbb43('0x5d'))[_0xbb43('0x5e')]([_0xbb43('0x5f'),_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x63'),_0xbb43('0x64'),_0xbb43('0x65')],squel[_0xbb43('0x66')]()[_0xbb43('0x67')](_0xbb43('0x68'),_0xbb43('0x5f'))[_0xbb43('0x67')](_0xbb43('0x69'),_0xbb43('0x60'))[_0xbb43('0x67')](_0xbb43('0x6a'),_0xbb43('0x61'))[_0xbb43('0x67')](_0xbb43('0x6b'),_0xbb43('0x62'))[_0xbb43('0x67')]('ANY_VALUE(VoiceQueueId)',_0xbb43('0x63'))[_0xbb43('0x67')](_0xbb43('0x69'),_0xbb43('0x64'))[_0xbb43('0x67')](_0xbb43('0x69'),'updatedAt')[_0xbb43('0x6c')](_0xbb43('0x6d'))['where']('VoiceQueueId\x20=\x20?',_0x212dc9['params']['id'][_0xbb43('0x6e')]())[_0xbb43('0x34')](_0xbb43('0x6f'),_0x212dc9[_0xbb43('0x44')]['state']['toString']())[_0xbb43('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xbb43('0x34')](_0xbb43('0x70'),squel['select']()[_0xbb43('0x67')](_0xbb43('0x5f'))[_0xbb43('0x6c')]('cm_hopper')[_0xbb43('0x34')]('VoiceQueueId\x20=\x20?',_0x212dc9[_0xbb43('0x41')]['id'][_0xbb43('0x6e')]()))['where'](_0xbb43('0x70'),squel[_0xbb43('0x66')]()[_0xbb43('0x67')](_0xbb43('0x71'))[_0xbb43('0x6c')]('cm_hopper_final')['where'](_0xbb43('0x72'),_0x212dc9[_0xbb43('0x41')]['id'][_0xbb43('0x6e')]())[_0xbb43('0x34')](_0xbb43('0x73')))[_0xbb43('0x74')](_0xbb43('0x61')))[_0xbb43('0x6e')]();return db['sequelize'][_0xbb43('0x2b')](_0x40ac8c);}return[];})['then'](respondWithResult(_0x4eb58f,null))[_0xbb43('0x3f')](handleError(_0x4eb58f,null));};exports[_0xbb43('0x75')]=function(_0x4cee24,_0x371a7c,_0x1ba677){return db[_0xbb43('0x76')][_0xbb43('0x42')]({'where':{'id':_0x4cee24[_0xbb43('0x41')]['id']}})[_0xbb43('0x21')](handleEntityNotFound(_0x371a7c,null))['then'](function(_0x3d0182){var _0x2d18e7;if(_0x3d0182){_0x2d18e7=squel['insert']()[_0xbb43('0x5c')]('cm_hopper')[_0xbb43('0x5e')]([_0xbb43('0x5f'),_0xbb43('0x60'),_0xbb43('0x61'),_0xbb43('0x62'),_0xbb43('0x77'),_0xbb43('0x64'),_0xbb43('0x65')],squel[_0xbb43('0x66')]()[_0xbb43('0x67')](_0xbb43('0x68'),'phone')[_0xbb43('0x67')]('NOW()',_0xbb43('0x60'))[_0xbb43('0x67')](_0xbb43('0x6a'),_0xbb43('0x61'))[_0xbb43('0x67')]('ANY_VALUE(ListId)',_0xbb43('0x62'))[_0xbb43('0x67')](_0xbb43('0x78'),_0xbb43('0x77'))[_0xbb43('0x67')]('NOW()',_0xbb43('0x64'))['field'](_0xbb43('0x69'),_0xbb43('0x65'))[_0xbb43('0x6c')](_0xbb43('0x6d'))[_0xbb43('0x34')]('CampaignId\x20=\x20?',_0x4cee24[_0xbb43('0x41')]['id']['toString']())[_0xbb43('0x34')]('state\x20=\x20?',_0x4cee24[_0xbb43('0x44')]['state'][_0xbb43('0x6e')]())[_0xbb43('0x34')](_0xbb43('0x79'))['where'](_0xbb43('0x70'),squel['select']()[_0xbb43('0x67')](_0xbb43('0x5f'))['from'](_0xbb43('0x5d'))[_0xbb43('0x34')](_0xbb43('0x7a'),_0x4cee24[_0xbb43('0x41')]['id']['toString']()))[_0xbb43('0x34')](_0xbb43('0x70'),squel['select']()['field']('calleridnum')[_0xbb43('0x6c')]('cm_hopper_final')[_0xbb43('0x34')](_0xbb43('0x7a'),_0x4cee24[_0xbb43('0x41')]['id']['toString']())['where'](_0xbb43('0x73')))[_0xbb43('0x74')](_0xbb43('0x61')))[_0xbb43('0x6e')]();return db['sequelize'][_0xbb43('0x2b')](_0x2d18e7);}return[];})[_0xbb43('0x21')](respondWithResult(_0x371a7c,null))[_0xbb43('0x3f')](handleError(_0x371a7c,null));};exports['checkContactHopper']=function(_0x202f08,_0xc9623,_0x75999e){return db[_0xbb43('0x7b')][_0xbb43('0x7c')]({'where':{'VoiceQueueId':_0x202f08['body'][_0xbb43('0x63')],'CampaignId':_0x202f08['body'][_0xbb43('0x77')],'ContactId':_0x202f08[_0xbb43('0x44')][_0xbb43('0x61')]}})[_0xbb43('0x21')](handleEntityNotFound(_0xc9623,null))['then'](function(_0x3174ea){if(_0x3174ea){return _0x3174ea;}return null;})['then'](respondWithResult(_0xc9623,null))[_0xbb43('0x3f')](handleError(_0xc9623,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2b5fa49..36aa481 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 _0xdc27=['../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x8f689a,_0x3f0f65){var _0x2fce62=function(_0x12a766){while(--_0x12a766){_0x8f689a['push'](_0x8f689a['shift']());}};_0x2fce62(++_0x3f0f65);}(_0xdc27,0xcb));var _0x7dc2=function(_0x162c12,_0x5963a0){_0x162c12=_0x162c12-0x0;var _0x11b07c=_0xdc27[_0x162c12];return _0x11b07c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7dc2('0x0'))(_0x7dc2('0x1'));var moment=require('moment');var BPromise=require(_0x7dc2('0x2'));var rp=require(_0x7dc2('0x3'));var fs=require('fs');var path=require(_0x7dc2('0x4'));var rimraf=require('rimraf');var config=require(_0x7dc2('0x5'));var attributes=require(_0x7dc2('0x6'));module[_0x7dc2('0x7')]=function(_0x2ec329,_0x54aca8){return _0x2ec329[_0x7dc2('0x8')](_0x7dc2('0x9'),attributes,{'tableName':_0x7dc2('0xa'),'paranoid':![],'indexes':[{'name':_0x7dc2('0xb'),'fields':[_0x7dc2('0xb')]},{'name':_0x7dc2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6470=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','bluebird','request-promise'];(function(_0x494991,_0x2197ca){var _0x48c2c7=function(_0x29679e){while(--_0x29679e){_0x494991['push'](_0x494991['shift']());}};_0x48c2c7(++_0x2197ca);}(_0x6470,0x171));var _0x0647=function(_0x38474d,_0xdda220){_0x38474d=_0x38474d-0x0;var _0x3a5e8d=_0x6470[_0x38474d];return _0x3a5e8d;};'use strict';var _=require('lodash');var util=require(_0x0647('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0647('0x1'));var rp=require(_0x0647('0x2'));var fs=require('fs');var path=require(_0x0647('0x3'));var rimraf=require(_0x0647('0x4'));var config=require(_0x0647('0x5'));var attributes=require(_0x0647('0x6'));module['exports']=function(_0x20a21b,_0x175880){return _0x20a21b[_0x0647('0x7')](_0x0647('0x8'),attributes,{'tableName':_0x0647('0x9'),'paranoid':![],'indexes':[{'name':_0x0647('0xa'),'fields':[_0x0647('0xa')]},{'name':_0x0647('0xb'),'fields':[_0x0647('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 fcdc313..fde5f17 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 _0xd8f5=['CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xd8f5,0x6b));var _0x5d8f=function(_0x596f51,_0x300f6d){_0x596f51=_0x596f51-0x0;var _0x325124=_0xd8f5[_0x596f51];return _0x325124;};'use strict';var _=require(_0x5d8f('0x0'));var util=require(_0x5d8f('0x1'));var moment=require('moment');var BPromise=require(_0x5d8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d8f('0x3'))['db'];var utils=require(_0x5d8f('0x4'));var logger=require(_0x5d8f('0x5'))(_0x5d8f('0x6'));var config=require(_0x5d8f('0x7'));var jayson=require(_0x5d8f('0x8'));var client=jayson[_0x5d8f('0x9')][_0x5d8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ca14d,_0x163ded,_0xf04ded){return new BPromise(function(_0x5c6bc4,_0x54543b){return client[_0x5d8f('0xb')](_0x2ca14d,_0xf04ded)[_0x5d8f('0xc')](function(_0x3ba885){logger['info'](_0x5d8f('0xd'),_0x163ded,_0x5d8f('0xe'));logger[_0x5d8f('0xf')](_0x5d8f('0x10'),_0x163ded,_0x5d8f('0xe'),JSON[_0x5d8f('0x11')](_0x3ba885));if(_0x3ba885[_0x5d8f('0x12')]){if(_0x3ba885['error'][_0x5d8f('0x13')]===0x1f4){logger['error'](_0x5d8f('0xd'),_0x163ded,_0x3ba885[_0x5d8f('0x12')][_0x5d8f('0x14')]);return _0x54543b(_0x3ba885[_0x5d8f('0x12')][_0x5d8f('0x14')]);}logger[_0x5d8f('0x12')](_0x5d8f('0xd'),_0x163ded,_0x3ba885[_0x5d8f('0x12')]['message']);return _0x5c6bc4(_0x3ba885[_0x5d8f('0x12')][_0x5d8f('0x14')]);}else{logger[_0x5d8f('0x15')](_0x5d8f('0xd'),_0x163ded,_0x5d8f('0xe'));_0x5c6bc4(_0x3ba885[_0x5d8f('0x16')]['message']);}})[_0x5d8f('0x17')](function(_0x24ccb8){logger[_0x5d8f('0x12')](_0x5d8f('0xd'),_0x163ded,_0x24ccb8);_0x54543b(_0x24ccb8);});});}exports[_0x5d8f('0x18')]=function(_0x5710ff){var _0x114139=this;return new Promise(function(_0x4b1fa8,_0x52fe50){return db[_0x5d8f('0x19')][_0x5d8f('0x1a')](_0x5710ff[_0x5d8f('0x1b')],{'raw':_0x5710ff[_0x5d8f('0x1c')]?_0x5710ff[_0x5d8f('0x1c')][_0x5d8f('0x1d')]===undefined?!![]:![]:!![]})[_0x5d8f('0xc')](function(_0x27e7c3){logger[_0x5d8f('0x15')](_0x5d8f('0x18'),_0x5710ff);logger[_0x5d8f('0xf')](_0x5d8f('0x18'),_0x5710ff,JSON[_0x5d8f('0x11')](_0x27e7c3));_0x4b1fa8(_0x27e7c3);})[_0x5d8f('0x17')](function(_0x6c8971){logger[_0x5d8f('0x12')](_0x5d8f('0x18'),_0x6c8971[_0x5d8f('0x14')],_0x5710ff);_0x52fe50(_0x114139[_0x5d8f('0x12')](0x1f4,_0x6c8971[_0x5d8f('0x14')]));});});}; \ No newline at end of file +var _0x588a=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','util','moment','bluebird'];(function(_0x416c14,_0x8f64df){var _0x13a057=function(_0x4131b2){while(--_0x4131b2){_0x416c14['push'](_0x416c14['shift']());}};_0x13a057(++_0x8f64df);}(_0x588a,0x6d));var _0xa588=function(_0x160fb9,_0x41e921){_0x160fb9=_0x160fb9-0x0;var _0x21317b=_0x588a[_0x160fb9];return _0x21317b;};'use strict';var _=require('lodash');var util=require(_0xa588('0x0'));var moment=require(_0xa588('0x1'));var BPromise=require(_0xa588('0x2'));var rs=require(_0xa588('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa588('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa588('0x5'))(_0xa588('0x6'));var config=require(_0xa588('0x7'));var jayson=require(_0xa588('0x8'));var client=jayson[_0xa588('0x9')][_0xa588('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30fd19,_0x20a6a8,_0x355e15){return new BPromise(function(_0x37c5f7,_0x2719fb){return client[_0xa588('0xb')](_0x30fd19,_0x355e15)[_0xa588('0xc')](function(_0x290381){logger[_0xa588('0xd')](_0xa588('0xe'),_0x20a6a8,_0xa588('0xf'));logger[_0xa588('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x20a6a8,_0xa588('0xf'),JSON[_0xa588('0x11')](_0x290381));if(_0x290381[_0xa588('0x12')]){if(_0x290381[_0xa588('0x12')]['code']===0x1f4){logger[_0xa588('0x12')](_0xa588('0xe'),_0x20a6a8,_0x290381[_0xa588('0x12')][_0xa588('0x13')]);return _0x2719fb(_0x290381['error'][_0xa588('0x13')]);}logger[_0xa588('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x20a6a8,_0x290381[_0xa588('0x12')][_0xa588('0x13')]);return _0x37c5f7(_0x290381[_0xa588('0x12')][_0xa588('0x13')]);}else{logger[_0xa588('0xd')](_0xa588('0xe'),_0x20a6a8,_0xa588('0xf'));_0x37c5f7(_0x290381[_0xa588('0x14')][_0xa588('0x13')]);}})[_0xa588('0x15')](function(_0x4cbd4d){logger[_0xa588('0x12')](_0xa588('0xe'),_0x20a6a8,_0x4cbd4d);_0x2719fb(_0x4cbd4d);});});}exports['CreateCmHopperFinal']=function(_0x137932){var _0xcd622d=this;return new Promise(function(_0x2fa1e1,_0x35e833){return db[_0xa588('0x16')][_0xa588('0x17')](_0x137932[_0xa588('0x18')],{'raw':_0x137932[_0xa588('0x19')]?_0x137932[_0xa588('0x19')][_0xa588('0x1a')]===undefined?!![]:![]:!![]})[_0xa588('0xc')](function(_0x10a66f){logger['info'](_0xa588('0x1b'),_0x137932);logger['debug']('CreateCmHopperFinal',_0x137932,JSON[_0xa588('0x11')](_0x10a66f));_0x2fa1e1(_0x10a66f);})[_0xa588('0x15')](function(_0x2383bf){logger['error'](_0xa588('0x1b'),_0x2383bf[_0xa588('0x13')],_0x137932);_0x35e833(_0xcd622d[_0xa588('0x12')](0x1f4,_0x2383bf['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f0b92e2..4a289a3 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 _0xbc3a=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x521f32,_0x915745){var _0x32aaf1=function(_0x406305){while(--_0x406305){_0x521f32['push'](_0x521f32['shift']());}};_0x32aaf1(++_0x915745);}(_0xbc3a,0x82));var _0xabc3=function(_0x207477,_0x550083){_0x207477=_0x207477-0x0;var _0x221820=_0xbc3a[_0x207477];return _0x221820;};'use strict';var multer=require(_0xabc3('0x0'));var util=require(_0xabc3('0x1'));var path=require(_0xabc3('0x2'));var timeout=require(_0xabc3('0x3'));var express=require(_0xabc3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xabc3('0x5'));var config=require(_0xabc3('0x6'));var controller=require(_0xabc3('0x7'));router[_0xabc3('0x8')]('/',auth[_0xabc3('0x9')](),controller[_0xabc3('0xa')]);router[_0xabc3('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xabc3('0xb')]);router['get'](_0xabc3('0xc'),auth[_0xabc3('0x9')](),controller[_0xabc3('0xd')]);router[_0xabc3('0x8')](_0xabc3('0xe'),auth[_0xabc3('0x9')](),controller[_0xabc3('0xf')]);router[_0xabc3('0x8')](_0xabc3('0x10'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x11')]);router[_0xabc3('0x12')](_0xabc3('0x13'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x14')]);router[_0xabc3('0x12')](_0xabc3('0x15'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x16')]);router[_0xabc3('0x12')](_0xabc3('0x17'),auth[_0xabc3('0x9')](),controller['checkContactHopper']);router['put'](_0xabc3('0xc'),auth[_0xabc3('0x9')](),controller[_0xabc3('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc295=['../../components/interaction/service','./cmHopperFinal.controller','get','index','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x44a0e9,_0x959f63){var _0x3b8e8c=function(_0x11b3e1){while(--_0x11b3e1){_0x44a0e9['push'](_0x44a0e9['shift']());}};_0x3b8e8c(++_0x959f63);}(_0xc295,0x1b0));var _0x5c29=function(_0x8c59dd,_0x1083a5){_0x8c59dd=_0x8c59dd-0x0;var _0x4b0563=_0xc295[_0x8c59dd];return _0x4b0563;};'use strict';var multer=require('multer');var util=require(_0x5c29('0x0'));var path=require(_0x5c29('0x1'));var timeout=require(_0x5c29('0x2'));var express=require(_0x5c29('0x3'));var router=express['Router']();var auth=require(_0x5c29('0x4'));var interaction=require(_0x5c29('0x5'));var config=require('../../config/environment');var controller=require(_0x5c29('0x6'));router[_0x5c29('0x7')]('/',auth['isAuthenticated'](),controller[_0x5c29('0x8')]);router[_0x5c29('0x7')]('/describe',auth[_0x5c29('0x9')](),controller[_0x5c29('0xa')]);router[_0x5c29('0x7')](_0x5c29('0xb'),auth[_0x5c29('0x9')](),controller[_0x5c29('0xc')]);router[_0x5c29('0x7')](_0x5c29('0xd'),auth[_0x5c29('0x9')](),controller[_0x5c29('0xe')]);router[_0x5c29('0x7')](_0x5c29('0xf'),auth[_0x5c29('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x5c29('0x10')]('/voice/queue/moveContacts/:id',auth[_0x5c29('0x9')](),controller[_0x5c29('0x11')]);router[_0x5c29('0x10')](_0x5c29('0x12'),auth[_0x5c29('0x9')](),controller[_0x5c29('0x13')]);router[_0x5c29('0x10')](_0x5c29('0x14'),auth[_0x5c29('0x9')](),controller[_0x5c29('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x5c29('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f8e91ae..62af0ed 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 _0x42ce=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x44d343,_0x2f0a76){var _0x404732=function(_0xb67472){while(--_0xb67472){_0x44d343['push'](_0x44d343['shift']());}};_0x404732(++_0x2f0a76);}(_0x42ce,0x17c));var _0xe42c=function(_0x3ee5df,_0x583073){_0x3ee5df=_0x3ee5df-0x0;var _0x446d24=_0x42ce[_0x3ee5df];return _0x446d24;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xe42c('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xe42c('0x1')]},'scheduledat':{'type':Sequelize[_0xe42c('0x2')]},'countbusyretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe42c('0x1')]},'originatecalleridname':{'type':Sequelize[_0xe42c('0x1')]},'calleridnum':{'type':Sequelize[_0xe42c('0x1')]},'calleridname':{'type':Sequelize[_0xe42c('0x1')]},'starttime':{'type':Sequelize[_0xe42c('0x2')]},'responsetime':{'type':Sequelize[_0xe42c('0x2')]},'answertime':{'type':Sequelize[_0xe42c('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe42c('0x2')]},'ringtime':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe42c('0x1')]},'campaign':{'type':Sequelize[_0xe42c('0x1')]},'campaigntype':{'type':Sequelize[_0xe42c('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe42c('0x1')]},'amd':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe42c('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe42c('0x2')]},'recallme':{'type':Sequelize[_0xe42c('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe42c('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe42c('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8e06=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x129805,_0x5251b1){var _0x1d3ae9=function(_0x309dff){while(--_0x309dff){_0x129805['push'](_0x129805['shift']());}};_0x1d3ae9(++_0x5251b1);}(_0x8e06,0x119));var _0x68e0=function(_0x14ca07,_0x89c34){_0x14ca07=_0x14ca07-0x0;var _0x98dd0f=_0x8e06[_0x14ca07];return _0x98dd0f;};'use strict';var Sequelize=require(_0x68e0('0x0'));module['exports']={'state':{'type':Sequelize[_0x68e0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x68e0('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x68e0('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x68e0('0x2')]},'calleridnum':{'type':Sequelize[_0x68e0('0x2')]},'calleridname':{'type':Sequelize[_0x68e0('0x2')]},'starttime':{'type':Sequelize[_0x68e0('0x3')]},'responsetime':{'type':Sequelize[_0x68e0('0x3')]},'answertime':{'type':Sequelize[_0x68e0('0x3')]},'droptime':{'type':Sequelize[_0x68e0('0x3')]},'endtime':{'type':Sequelize[_0x68e0('0x3')]},'ringtime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x68e0('0x2')]},'campaign':{'type':Sequelize[_0x68e0('0x2')]},'campaigntype':{'type':Sequelize[_0x68e0('0x2')]},'membername':{'type':Sequelize[_0x68e0('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x68e0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x68e0('0x3')]},'edited':{'type':Sequelize[_0x68e0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x68e0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 97a9aed..7a5285f 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 _0x4771=['map','CmHopperHistory','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','where','merge','VIRTUAL','filter','options','include','findAll','catch','params','keys','length','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index'];(function(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0x4771,0xa1));var _0x1477=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4771[_0x344a3f];return _0x264712;};'use strict';var pdf=require(_0x1477('0x0'));var emlformat=require(_0x1477('0x1'));var rimraf=require(_0x1477('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1477('0x3'));var rp=require(_0x1477('0x4'));var moment=require(_0x1477('0x5'));var BPromise=require(_0x1477('0x6'));var Mustache=require(_0x1477('0x7'));var util=require(_0x1477('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1477('0x9'));var ejs=require(_0x1477('0xa'));var fs=require('fs');var _=require(_0x1477('0xb'));var squel=require('squel');var crypto=require(_0x1477('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1477('0xd'));var toCsv=require(_0x1477('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1477('0xe'));var authService=require(_0x1477('0xf'));var qs=require(_0x1477('0x10'));var as=require(_0x1477('0x11'));var hardwareService=require(_0x1477('0x12'));var logger=require('../../config/logger')(_0x1477('0x13'));var utils=require('../../config/utils');var config=require(_0x1477('0x14'));var licenseUtil=require(_0x1477('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x542c48,_0x17b5fb){_0x17b5fb=_0x17b5fb||0xcc;return function(_0x44aeab){if(_0x44aeab){return _0x542c48['sendStatus'](_0x17b5fb);}return _0x542c48[_0x1477('0x16')](_0x17b5fb)[_0x1477('0x17')]();};}function respondWithResult(_0x1f2b49,_0x34069a){_0x34069a=_0x34069a||0xc8;return function(_0x4c536d){if(_0x4c536d){return _0x1f2b49[_0x1477('0x16')](_0x34069a)[_0x1477('0x18')](_0x4c536d);}};}function respondWithFilteredResult(_0x194b17,_0x1444d4){return function(_0x2c104c){if(_0x2c104c){var _0x34ccd2=_0x2c104c[_0x1477('0x19')],_0x4fb662=_0x1444d4[_0x1477('0x1a')],_0x2a2dd8=_0x1444d4[_0x1477('0x1a')]+_0x1444d4[_0x1477('0x1b')],_0x23daca;if(_0x2a2dd8>=_0x34ccd2){_0x2a2dd8=_0x34ccd2;_0x23daca=0xc8;}else{_0x23daca=0xce;}_0x194b17['status'](_0x23daca);return _0x194b17['set'](_0x1477('0x1c'),_0x4fb662+'-'+_0x2a2dd8+'/'+_0x34ccd2)['json'](_0x2c104c);}return null;};}function patchUpdates(_0x180998){return function(_0x37c7de){try{jsonpatch[_0x1477('0x1d')](_0x37c7de,_0x180998,!![]);}catch(_0x1b4e91){return BPromise[_0x1477('0x1e')](_0x1b4e91);}return _0x37c7de[_0x1477('0x1f')]();};}function saveUpdates(_0x364c6b,_0x39d87){return function(_0x5e8618){if(_0x5e8618){return _0x5e8618[_0x1477('0x20')](_0x364c6b)[_0x1477('0x21')](function(_0x544b44){return _0x544b44;});}return null;};}function removeEntity(_0x468a15,_0x5a7df1){return function(_0x387cfe){if(_0x387cfe){return _0x387cfe[_0x1477('0x22')]()[_0x1477('0x21')](function(){_0x468a15[_0x1477('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x128151,_0x7332b9){return function(_0x11988c){if(!_0x11988c){_0x128151[_0x1477('0x23')](0x194);}return _0x11988c;};}function handleError(_0x181d9e,_0x1904eb){_0x1904eb=_0x1904eb||0x1f4;return function(_0x1a34ea){logger['error'](_0x1a34ea[_0x1477('0x24')]);if(_0x1a34ea['name']){delete _0x1a34ea[_0x1477('0x25')];}_0x181d9e[_0x1477('0x16')](_0x1904eb)[_0x1477('0x26')](_0x1a34ea);};}exports[_0x1477('0x27')]=function(_0x50d4b7,_0x1ad4f7){var _0xf6ba02={},_0x4a2772={},_0x250171={'count':0x0,'rows':[]};var _0x213a1e=_[_0x1477('0x28')](db[_0x1477('0x29')]['rawAttributes'],function(_0x5066cb){return{'name':_0x5066cb[_0x1477('0x2a')],'type':_0x5066cb[_0x1477('0x2b')]['key']};});_0x4a2772[_0x1477('0x2c')]=_[_0x1477('0x28')](_0x213a1e,_0x1477('0x25'));_0x4a2772['query']=_['keys'](_0x50d4b7[_0x1477('0x2d')]);_0x4a2772[_0x1477('0x2e')]=_[_0x1477('0x2f')](_0x4a2772['model'],_0x4a2772[_0x1477('0x2d')]);_0xf6ba02[_0x1477('0x30')]=_[_0x1477('0x2f')](_0x4a2772[_0x1477('0x2c')],qs[_0x1477('0x31')](_0x50d4b7['query'][_0x1477('0x31')]));_0xf6ba02['attributes']=_0xf6ba02[_0x1477('0x30')]['length']?_0xf6ba02[_0x1477('0x30')]:_0x4a2772[_0x1477('0x2c')];if(!_0x50d4b7[_0x1477('0x2d')][_0x1477('0x32')]('nolimit')){_0xf6ba02['limit']=qs[_0x1477('0x1b')](_0x50d4b7['query']['limit']);_0xf6ba02[_0x1477('0x1a')]=qs['offset'](_0x50d4b7[_0x1477('0x2d')][_0x1477('0x1a')]);}_0xf6ba02['order']=qs['sort'](_0x50d4b7[_0x1477('0x2d')]['sort']);_0xf6ba02[_0x1477('0x33')]=qs[_0x1477('0x2e')](_['pick'](_0x50d4b7[_0x1477('0x2d')],_0x4a2772[_0x1477('0x2e')]),_0x213a1e);if(_0x50d4b7[_0x1477('0x2d')]['filter']){_0xf6ba02['where']=_[_0x1477('0x34')](_0xf6ba02['where'],{'$or':_[_0x1477('0x28')](_0x213a1e,function(_0x129aa9){if(_0x129aa9[_0x1477('0x2b')]!==_0x1477('0x35')){var _0x3a7eac={};_0x3a7eac[_0x129aa9[_0x1477('0x25')]]={'$like':'%'+_0x50d4b7[_0x1477('0x2d')][_0x1477('0x36')]+'%'};return _0x3a7eac;}})});}_0xf6ba02=_[_0x1477('0x34')]({},_0xf6ba02,_0x50d4b7[_0x1477('0x37')]);var _0x253027={'where':_0xf6ba02[_0x1477('0x33')]};return db[_0x1477('0x29')][_0x1477('0x19')](_0x253027)[_0x1477('0x21')](function(_0x20593d){_0x250171['count']=_0x20593d;if(_0x50d4b7[_0x1477('0x2d')]['includeAll']){_0xf6ba02[_0x1477('0x38')]=[{'all':!![]}];}return db[_0x1477('0x29')][_0x1477('0x39')](_0xf6ba02);})[_0x1477('0x21')](function(_0x4bbf7d){_0x250171['rows']=_0x4bbf7d;return _0x250171;})[_0x1477('0x21')](respondWithFilteredResult(_0x1ad4f7,_0xf6ba02))[_0x1477('0x3a')](handleError(_0x1ad4f7,null));};exports['show']=function(_0x70022c,_0x4e4a6f){var _0x584096={'raw':!![],'where':{'id':_0x70022c[_0x1477('0x3b')]['id']}},_0x5c96f9={};_0x5c96f9[_0x1477('0x2c')]=_[_0x1477('0x3c')](db[_0x1477('0x29')]['rawAttributes']);_0x5c96f9['query']=_[_0x1477('0x3c')](_0x70022c['query']);_0x5c96f9['filters']=_[_0x1477('0x2f')](_0x5c96f9[_0x1477('0x2c')],_0x5c96f9[_0x1477('0x2d')]);_0x584096[_0x1477('0x30')]=_[_0x1477('0x2f')](_0x5c96f9[_0x1477('0x2c')],qs[_0x1477('0x31')](_0x70022c[_0x1477('0x2d')]['fields']));_0x584096[_0x1477('0x30')]=_0x584096['attributes'][_0x1477('0x3d')]?_0x584096[_0x1477('0x30')]:_0x5c96f9[_0x1477('0x2c')];if(_0x70022c['query']['includeAll']){_0x584096[_0x1477('0x38')]=[{'all':!![]}];}_0x584096=_[_0x1477('0x34')]({},_0x584096,_0x70022c['options']);return db[_0x1477('0x29')][_0x1477('0x3e')](_0x584096)[_0x1477('0x21')](handleEntityNotFound(_0x4e4a6f,null))[_0x1477('0x21')](respondWithResult(_0x4e4a6f,null))[_0x1477('0x3a')](handleError(_0x4e4a6f,null));};exports['create']=function(_0x22066e,_0x268e9b){return db['CmHopperHistory'][_0x1477('0x3f')](_0x22066e[_0x1477('0x40')],{})[_0x1477('0x21')](respondWithResult(_0x268e9b,0xc9))[_0x1477('0x3a')](handleError(_0x268e9b,null));};exports[_0x1477('0x41')]=function(_0x38fe37,_0x321174){return db[_0x1477('0x29')][_0x1477('0x41')]()['then'](respondWithResult(_0x321174,null))[_0x1477('0x3a')](handleError(_0x321174,null));};exports[_0x1477('0x20')]=function(_0x1ce972,_0x405cfe){if(_0x1ce972[_0x1477('0x40')]['uniqueid']){delete _0x1ce972['body'][_0x1477('0x42')];}return db[_0x1477('0x29')][_0x1477('0x3e')]({'where':{'uniqueid':_0x1ce972[_0x1477('0x3b')]['id']}})[_0x1477('0x21')](handleEntityNotFound(_0x405cfe,null))[_0x1477('0x21')](saveUpdates(_0x1ce972[_0x1477('0x40')],null))['then'](respondWithResult(_0x405cfe,null))[_0x1477('0x3a')](handleError(_0x405cfe,null));}; \ No newline at end of file +var _0xb847=['name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack'];(function(_0x10418d,_0x5a6967){var _0x20c6d3=function(_0x5b1b91){while(--_0x5b1b91){_0x10418d['push'](_0x10418d['shift']());}};_0x20c6d3(++_0x5a6967);}(_0xb847,0x105));var _0x7b84=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0xb847[_0x10e653];return _0x328dfd;};'use strict';var pdf=require(_0x7b84('0x0'));var emlformat=require(_0x7b84('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7b84('0x2'));var jsonpatch=require(_0x7b84('0x3'));var rp=require(_0x7b84('0x4'));var moment=require(_0x7b84('0x5'));var BPromise=require(_0x7b84('0x6'));var Mustache=require(_0x7b84('0x7'));var util=require(_0x7b84('0x8'));var path=require(_0x7b84('0x9'));var sox=require(_0x7b84('0xa'));var csv=require(_0x7b84('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b84('0xc'));var squel=require(_0x7b84('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b84('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b84('0xf'));var Papa=require(_0x7b84('0x10'));var Redis=require('ioredis');var authService=require(_0x7b84('0x11'));var qs=require(_0x7b84('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b84('0x13'));var logger=require(_0x7b84('0x14'))(_0x7b84('0x15'));var utils=require(_0x7b84('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b84('0x17'))['db'];function respondWithStatusCode(_0x39a0ba,_0x5c60dd){_0x5c60dd=_0x5c60dd||0xcc;return function(_0x395274){if(_0x395274){return _0x39a0ba[_0x7b84('0x18')](_0x5c60dd);}return _0x39a0ba[_0x7b84('0x19')](_0x5c60dd)[_0x7b84('0x1a')]();};}function respondWithResult(_0x310b8e,_0x5501d4){_0x5501d4=_0x5501d4||0xc8;return function(_0x3a4314){if(_0x3a4314){return _0x310b8e['status'](_0x5501d4)[_0x7b84('0x1b')](_0x3a4314);}};}function respondWithFilteredResult(_0xcc65c9,_0x2249db){return function(_0x1e89b8){if(_0x1e89b8){var _0x124738=_0x1e89b8[_0x7b84('0x1c')],_0x3f7bed=_0x2249db[_0x7b84('0x1d')],_0x3b2a0e=_0x2249db[_0x7b84('0x1d')]+_0x2249db[_0x7b84('0x1e')],_0x572e7a;if(_0x3b2a0e>=_0x124738){_0x3b2a0e=_0x124738;_0x572e7a=0xc8;}else{_0x572e7a=0xce;}_0xcc65c9[_0x7b84('0x19')](_0x572e7a);return _0xcc65c9[_0x7b84('0x1f')](_0x7b84('0x20'),_0x3f7bed+'-'+_0x3b2a0e+'/'+_0x124738)[_0x7b84('0x1b')](_0x1e89b8);}return null;};}function patchUpdates(_0x2df3a5){return function(_0x5705e5){try{jsonpatch['apply'](_0x5705e5,_0x2df3a5,!![]);}catch(_0x5a6bc6){return BPromise['reject'](_0x5a6bc6);}return _0x5705e5[_0x7b84('0x21')]();};}function saveUpdates(_0x58e104,_0x20b0e3){return function(_0x2c328f){if(_0x2c328f){return _0x2c328f[_0x7b84('0x22')](_0x58e104)[_0x7b84('0x23')](function(_0x1068ce){return _0x1068ce;});}return null;};}function removeEntity(_0x1caabe,_0x40849e){return function(_0x1debd1){if(_0x1debd1){return _0x1debd1[_0x7b84('0x24')]()['then'](function(){_0x1caabe['status'](0xcc)[_0x7b84('0x1a')]();});}};}function handleEntityNotFound(_0x4f972e,_0x34892f){return function(_0x332b13){if(!_0x332b13){_0x4f972e[_0x7b84('0x18')](0x194);}return _0x332b13;};}function handleError(_0x51ff12,_0x1a1196){_0x1a1196=_0x1a1196||0x1f4;return function(_0x587f94){logger[_0x7b84('0x25')](_0x587f94[_0x7b84('0x26')]);if(_0x587f94[_0x7b84('0x27')]){delete _0x587f94[_0x7b84('0x27')];}_0x51ff12[_0x7b84('0x19')](_0x1a1196)[_0x7b84('0x28')](_0x587f94);};}exports[_0x7b84('0x29')]=function(_0x131f2a,_0x4c800a){var _0x43e0b1={},_0x1a40fe={},_0x59e678={'count':0x0,'rows':[]};var _0x412cdd=_[_0x7b84('0x2a')](db[_0x7b84('0x2b')][_0x7b84('0x2c')],function(_0x3378f7){return{'name':_0x3378f7[_0x7b84('0x2d')],'type':_0x3378f7[_0x7b84('0x2e')][_0x7b84('0x2f')]};});_0x1a40fe[_0x7b84('0x30')]=_[_0x7b84('0x2a')](_0x412cdd,'name');_0x1a40fe[_0x7b84('0x31')]=_[_0x7b84('0x32')](_0x131f2a['query']);_0x1a40fe[_0x7b84('0x33')]=_[_0x7b84('0x34')](_0x1a40fe[_0x7b84('0x30')],_0x1a40fe[_0x7b84('0x31')]);_0x43e0b1['attributes']=_[_0x7b84('0x34')](_0x1a40fe[_0x7b84('0x30')],qs[_0x7b84('0x35')](_0x131f2a['query'][_0x7b84('0x35')]));_0x43e0b1[_0x7b84('0x36')]=_0x43e0b1[_0x7b84('0x36')]['length']?_0x43e0b1['attributes']:_0x1a40fe[_0x7b84('0x30')];if(!_0x131f2a[_0x7b84('0x31')][_0x7b84('0x37')](_0x7b84('0x38'))){_0x43e0b1[_0x7b84('0x1e')]=qs[_0x7b84('0x1e')](_0x131f2a[_0x7b84('0x31')]['limit']);_0x43e0b1[_0x7b84('0x1d')]=qs[_0x7b84('0x1d')](_0x131f2a[_0x7b84('0x31')][_0x7b84('0x1d')]);}_0x43e0b1[_0x7b84('0x39')]=qs[_0x7b84('0x3a')](_0x131f2a['query'][_0x7b84('0x3a')]);_0x43e0b1[_0x7b84('0x3b')]=qs[_0x7b84('0x33')](_['pick'](_0x131f2a[_0x7b84('0x31')],_0x1a40fe[_0x7b84('0x33')]),_0x412cdd);if(_0x131f2a[_0x7b84('0x31')][_0x7b84('0x3c')]){_0x43e0b1['where']=_[_0x7b84('0x3d')](_0x43e0b1[_0x7b84('0x3b')],{'$or':_[_0x7b84('0x2a')](_0x412cdd,function(_0x4447ce){if(_0x4447ce[_0x7b84('0x2e')]!==_0x7b84('0x3e')){var _0x444811={};_0x444811[_0x4447ce['name']]={'$like':'%'+_0x131f2a[_0x7b84('0x31')]['filter']+'%'};return _0x444811;}})});}_0x43e0b1=_[_0x7b84('0x3d')]({},_0x43e0b1,_0x131f2a[_0x7b84('0x3f')]);var _0x430498={'where':_0x43e0b1['where']};return db[_0x7b84('0x2b')][_0x7b84('0x1c')](_0x430498)[_0x7b84('0x23')](function(_0x36aa7b){_0x59e678['count']=_0x36aa7b;if(_0x131f2a[_0x7b84('0x31')][_0x7b84('0x40')]){_0x43e0b1[_0x7b84('0x41')]=[{'all':!![]}];}return db[_0x7b84('0x2b')][_0x7b84('0x42')](_0x43e0b1);})[_0x7b84('0x23')](function(_0x157c73){_0x59e678['rows']=_0x157c73;return _0x59e678;})[_0x7b84('0x23')](respondWithFilteredResult(_0x4c800a,_0x43e0b1))[_0x7b84('0x43')](handleError(_0x4c800a,null));};exports[_0x7b84('0x44')]=function(_0x59d14f,_0x567663){var _0x9da2f9={'raw':!![],'where':{'id':_0x59d14f[_0x7b84('0x45')]['id']}},_0x11b3b0={};_0x11b3b0[_0x7b84('0x30')]=_[_0x7b84('0x32')](db[_0x7b84('0x2b')]['rawAttributes']);_0x11b3b0[_0x7b84('0x31')]=_[_0x7b84('0x32')](_0x59d14f[_0x7b84('0x31')]);_0x11b3b0[_0x7b84('0x33')]=_[_0x7b84('0x34')](_0x11b3b0[_0x7b84('0x30')],_0x11b3b0[_0x7b84('0x31')]);_0x9da2f9[_0x7b84('0x36')]=_['intersection'](_0x11b3b0['model'],qs['fields'](_0x59d14f[_0x7b84('0x31')][_0x7b84('0x35')]));_0x9da2f9[_0x7b84('0x36')]=_0x9da2f9[_0x7b84('0x36')]['length']?_0x9da2f9[_0x7b84('0x36')]:_0x11b3b0[_0x7b84('0x30')];if(_0x59d14f['query']['includeAll']){_0x9da2f9[_0x7b84('0x41')]=[{'all':!![]}];}_0x9da2f9=_[_0x7b84('0x3d')]({},_0x9da2f9,_0x59d14f[_0x7b84('0x3f')]);return db[_0x7b84('0x2b')][_0x7b84('0x46')](_0x9da2f9)['then'](handleEntityNotFound(_0x567663,null))[_0x7b84('0x23')](respondWithResult(_0x567663,null))[_0x7b84('0x43')](handleError(_0x567663,null));};exports[_0x7b84('0x47')]=function(_0xad3d,_0x231c39){return db[_0x7b84('0x2b')][_0x7b84('0x47')](_0xad3d[_0x7b84('0x48')],{})[_0x7b84('0x23')](respondWithResult(_0x231c39,0xc9))[_0x7b84('0x43')](handleError(_0x231c39,null));};exports[_0x7b84('0x49')]=function(_0x34e8a3,_0x1f916c){return db['CmHopperHistory'][_0x7b84('0x49')]()[_0x7b84('0x23')](respondWithResult(_0x1f916c,null))[_0x7b84('0x43')](handleError(_0x1f916c,null));};exports[_0x7b84('0x22')]=function(_0x28f36c,_0x469826){if(_0x28f36c[_0x7b84('0x48')][_0x7b84('0x4a')]){delete _0x28f36c['body'][_0x7b84('0x4a')];}return db[_0x7b84('0x2b')][_0x7b84('0x46')]({'where':{'uniqueid':_0x28f36c[_0x7b84('0x45')]['id']}})[_0x7b84('0x23')](handleEntityNotFound(_0x469826,null))[_0x7b84('0x23')](saveUpdates(_0x28f36c['body'],null))[_0x7b84('0x23')](respondWithResult(_0x469826,null))[_0x7b84('0x43')](handleError(_0x469826,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a6701a6..1cacac4 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 _0x01ee=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x01ee,0x7e));var _0xe01e=function(_0x148c35,_0x9dc00a){_0x148c35=_0x148c35-0x0;var _0x50d613=_0x01ee[_0x148c35];return _0x50d613;};'use strict';var _=require(_0xe01e('0x0'));var util=require(_0xe01e('0x1'));var logger=require(_0xe01e('0x2'))(_0xe01e('0x3'));var moment=require(_0xe01e('0x4'));var BPromise=require(_0xe01e('0x5'));var rp=require(_0xe01e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe01e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe01e('0x8'));module['exports']=function(_0xf7efe5,_0x10dae3){return _0xf7efe5[_0xe01e('0x9')](_0xe01e('0xa'),attributes,{'tableName':_0xe01e('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xe01e('0xc')]},{'name':_0xe01e('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0893=['endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','define','CmHopperHistory'];(function(_0x5c8258,_0x5a0437){var _0x51a263=function(_0x38cadd){while(--_0x38cadd){_0x5c8258['push'](_0x5c8258['shift']());}};_0x51a263(++_0x5a0437);}(_0x0893,0x70));var _0x3089=function(_0x21a040,_0x4eca14){_0x21a040=_0x21a040-0x0;var _0x37bc95=_0x0893[_0x21a040];return _0x37bc95;};'use strict';var _=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var logger=require(_0x3089('0x2'))(_0x3089('0x3'));var moment=require(_0x3089('0x4'));var BPromise=require('bluebird');var rp=require(_0x3089('0x5'));var fs=require('fs');var path=require(_0x3089('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x271c08,_0x481951){return _0x271c08[_0x3089('0x7')](_0x3089('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x3089('0x9')]},{'name':_0x3089('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b7f9fd0..8caf9cd 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 _0x9706=['predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','where','sequelize','col'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9706,0xbc));var _0x6970=function(_0x356e13,_0x3e2b18){_0x356e13=_0x356e13-0x0;var _0x2c1dd6=_0x9706[_0x356e13];return _0x2c1dd6;};'use strict';var _=require(_0x6970('0x0'));var util=require(_0x6970('0x1'));var moment=require(_0x6970('0x2'));var BPromise=require(_0x6970('0x3'));var rs=require(_0x6970('0x4'));var fs=require('fs');var Redis=require(_0x6970('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6970('0x6'));var logger=require(_0x6970('0x7'))(_0x6970('0x8'));var config=require(_0x6970('0x9'));var jayson=require(_0x6970('0xa'));var client=jayson[_0x6970('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dfcfa,_0x2e6f52,_0x898a1b){return new BPromise(function(_0x59483e,_0x58d10f){return client['request'](_0x5dfcfa,_0x898a1b)[_0x6970('0xc')](function(_0x244704){logger[_0x6970('0xd')](_0x6970('0xe'),_0x2e6f52,_0x6970('0xf'));logger[_0x6970('0x10')](_0x6970('0x11'),_0x2e6f52,'request\x20sent',JSON['stringify'](_0x244704));if(_0x244704[_0x6970('0x12')]){if(_0x244704['error'][_0x6970('0x13')]===0x1f4){logger['error'](_0x6970('0xe'),_0x2e6f52,_0x244704['error'][_0x6970('0x14')]);return _0x58d10f(_0x244704[_0x6970('0x12')][_0x6970('0x14')]);}logger[_0x6970('0x12')](_0x6970('0xe'),_0x2e6f52,_0x244704[_0x6970('0x12')][_0x6970('0x14')]);return _0x59483e(_0x244704['error']['message']);}else{logger[_0x6970('0xd')](_0x6970('0xe'),_0x2e6f52,_0x6970('0xf'));_0x59483e(_0x244704[_0x6970('0x15')][_0x6970('0x14')]);}})[_0x6970('0x16')](function(_0x1b0404){logger[_0x6970('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2e6f52,_0x1b0404);_0x58d10f(_0x1b0404);});});}exports['CreateCmHopperHistory']=function(_0x3af95e){var _0x103cfa=this;return new Promise(function(_0x511684,_0x3d33b1){return db[_0x6970('0x17')][_0x6970('0x18')](_0x3af95e['body'],{'raw':_0x3af95e['options']?_0x3af95e[_0x6970('0x19')][_0x6970('0x1a')]===undefined?!![]:![]:!![]})[_0x6970('0xc')](function(_0x3b2b40){logger['info']('CreateCmHopperHistory',_0x3af95e);logger['debug'](_0x6970('0x1b'),_0x3af95e,JSON[_0x6970('0x1c')](_0x3b2b40));_0x511684(_0x3b2b40);})['catch'](function(_0x41c493){logger['error'](_0x6970('0x1b'),_0x41c493[_0x6970('0x14')],_0x3af95e);_0x3d33b1(_0x103cfa[_0x6970('0x12')](0x1f4,_0x41c493['message']));});});};exports[_0x6970('0x1d')]=function(_0x1c51ee){var _0x5082fe=this;return new Promise(function(_0x38d670,_0x3ac3a7){return db['CmHopperHistory'][_0x6970('0x1e')]({'raw':_0x1c51ee[_0x6970('0x19')]?_0x1c51ee[_0x6970('0x19')][_0x6970('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c51ee[_0x6970('0x19')]?_0x1c51ee[_0x6970('0x19')][_0x6970('0x1f')]||null:null,'attributes':[[db[_0x6970('0x20')]['fn']('COUNT',db[_0x6970('0x20')][_0x6970('0x21')]('id')),_0x6970('0x22')],[db['sequelize']['fn'](_0x6970('0x23'),db['sequelize']['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x25')))),_0x6970('0x26')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0x6970('0x27')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x28')))),_0x6970('0x29')],[db[_0x6970('0x20')]['fn'](_0x6970('0x2a'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x2b')))),_0x6970('0x2c')],[db[_0x6970('0x20')]['fn'](_0x6970('0x2a'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x2d')))),_0x6970('0x2e')]]})[_0x6970('0xc')](function(_0x15e1c4){logger[_0x6970('0xd')](_0x6970('0x1d'),_0x1c51ee);logger[_0x6970('0x10')](_0x6970('0x1d'),_0x1c51ee,JSON['stringify'](_0x15e1c4));_0x38d670(_0x15e1c4);})[_0x6970('0x16')](function(_0x338579){logger['error']('AvgHandleTime',_0x338579['message'],_0x1c51ee);_0x3ac3a7(_0x5082fe[_0x6970('0x12')](0x1f4,_0x338579[_0x6970('0x14')]));});});};exports[_0x6970('0x2f')]=function(_0x18b432){var _0x14932f=this;return new Promise(function(_0x32b8dc,_0x5a8902){return db['CmHopperHistory'][_0x6970('0x1e')]({'raw':_0x18b432[_0x6970('0x19')]?_0x18b432['options'][_0x6970('0x1a')]===undefined?!![]:![]:!![],'where':_0x18b432[_0x6970('0x19')]?_0x18b432[_0x6970('0x19')][_0x6970('0x1f')]||null:null,'attributes':[['campaign',_0x6970('0x30')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0x6970('0x31')],[db['sequelize']['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x6970('0x32')],[db[_0x6970('0x20')]['fn']('COUNT',db[_0x6970('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x6970('0x33')],[db[_0x6970('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x34')))),_0x6970('0x35')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db['sequelize'][_0x6970('0x24')](_0x6970('0x36')))),_0x6970('0x37')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db['sequelize']['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x38')))),_0x6970('0x39')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x3a')))),_0x6970('0x3b')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db['sequelize'][_0x6970('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),_0x6970('0x3c')],[db[_0x6970('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x6970('0x24')](_0x6970('0x3d')))),_0x6970('0x3e')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x3f')))),_0x6970('0x40')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')](_0x6970('0x41')))),'outboundRejectCallsDay'],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x42')))),_0x6970('0x43')],[db['sequelize']['fn']('COUNT',db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')][_0x6970('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x6970('0x44')],[db[_0x6970('0x20')]['fn']('COUNT',db[_0x6970('0x20')]['fn']('IF',db[_0x6970('0x20')]['literal'](_0x6970('0x45')))),_0x6970('0x46')]],'group':[_0x6970('0x47')]})[_0x6970('0xc')](function(_0x55c489){logger[_0x6970('0xd')](_0x6970('0x2f'),_0x18b432);logger[_0x6970('0x10')](_0x6970('0x2f'),_0x18b432,JSON[_0x6970('0x1c')](_0x55c489));_0x32b8dc(_0x55c489);})[_0x6970('0x16')](function(_0x491d08){logger[_0x6970('0x12')]('GetVoiceQueueHopperHistory',_0x491d08['message'],_0x18b432);_0x5a8902(_0x14932f[_0x6970('0x12')](0x1f4,_0x491d08[_0x6970('0x14')]));});});};exports[_0x6970('0x48')]=function(_0x24bdff){var _0x28d31e=this;return new Promise(function(_0xe53ea0,_0x17a98c){return db['CmHopperHistory'][_0x6970('0x1e')]({'raw':_0x24bdff[_0x6970('0x19')]?_0x24bdff[_0x6970('0x19')][_0x6970('0x1a')]===undefined?!![]:![]:!![],'where':_0x24bdff[_0x6970('0x19')]?_0x24bdff[_0x6970('0x19')][_0x6970('0x1f')]||null:null,'attributes':[[_0x6970('0x47'),_0x6970('0x30')],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db[_0x6970('0x20')][_0x6970('0x21')]('id')),'ivrTotalCallsDays'],[db[_0x6970('0x20')]['fn'](_0x6970('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x6970('0x24')](_0x6970('0x25')))),_0x6970('0x49')]],'group':[_0x6970('0x47')]})[_0x6970('0xc')](function(_0x3ab1fe){logger['info'](_0x6970('0x48'),_0x24bdff);logger['debug']('GetCampaignHopperHistory',_0x24bdff,JSON['stringify'](_0x3ab1fe));_0xe53ea0(_0x3ab1fe);})['catch'](function(_0x4bdc78){logger[_0x6970('0x12')](_0x6970('0x48'),_0x4bdc78[_0x6970('0x14')],_0x24bdff);_0x17a98c(_0x28d31e[_0x6970('0x12')](0x1f4,_0x4bdc78[_0x6970('0x14')]));});});}; \ No newline at end of file +var _0x3dbb=['outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','stringify','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','where','name','`state`\x20=\x200,\x201,\x20null'];(function(_0x2bea40,_0x15f611){var _0x25fb9c=function(_0x52b98a){while(--_0x52b98a){_0x2bea40['push'](_0x2bea40['shift']());}};_0x25fb9c(++_0x15f611);}(_0x3dbb,0x138));var _0xb3db=function(_0x308a9a,_0xd452bb){_0x308a9a=_0x308a9a-0x0;var _0xf317d1=_0x3dbb[_0x308a9a];return _0xf317d1;};'use strict';var _=require(_0xb3db('0x0'));var util=require(_0xb3db('0x1'));var moment=require(_0xb3db('0x2'));var BPromise=require(_0xb3db('0x3'));var rs=require(_0xb3db('0x4'));var fs=require('fs');var Redis=require(_0xb3db('0x5'));var db=require(_0xb3db('0x6'))['db'];var utils=require(_0xb3db('0x7'));var logger=require(_0xb3db('0x8'))(_0xb3db('0x9'));var config=require(_0xb3db('0xa'));var jayson=require(_0xb3db('0xb'));var client=jayson[_0xb3db('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539abc,_0x335b45,_0x2ebabc){return new BPromise(function(_0x16591f,_0x37079f){return client[_0xb3db('0xd')](_0x539abc,_0x2ebabc)[_0xb3db('0xe')](function(_0x5a1ab5){logger[_0xb3db('0xf')](_0xb3db('0x10'),_0x335b45,_0xb3db('0x11'));logger[_0xb3db('0x12')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x335b45,_0xb3db('0x11'),JSON['stringify'](_0x5a1ab5));if(_0x5a1ab5['error']){if(_0x5a1ab5[_0xb3db('0x13')]['code']===0x1f4){logger['error'](_0xb3db('0x10'),_0x335b45,_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);return _0x37079f(_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x335b45,_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);return _0x16591f(_0x5a1ab5[_0xb3db('0x13')][_0xb3db('0x14')]);}else{logger[_0xb3db('0xf')](_0xb3db('0x10'),_0x335b45,_0xb3db('0x11'));_0x16591f(_0x5a1ab5[_0xb3db('0x15')][_0xb3db('0x14')]);}})[_0xb3db('0x16')](function(_0x530e83){logger[_0xb3db('0x13')](_0xb3db('0x10'),_0x335b45,_0x530e83);_0x37079f(_0x530e83);});});}exports['CreateCmHopperHistory']=function(_0x3d2948){var _0x202c27=this;return new Promise(function(_0x591f6d,_0x38b5c6){return db[_0xb3db('0x17')][_0xb3db('0x18')](_0x3d2948[_0xb3db('0x19')],{'raw':_0x3d2948[_0xb3db('0x1a')]?_0x3d2948[_0xb3db('0x1a')][_0xb3db('0x1b')]===undefined?!![]:![]:!![]})[_0xb3db('0xe')](function(_0x5c18c4){logger[_0xb3db('0xf')]('CreateCmHopperHistory',_0x3d2948);logger[_0xb3db('0x12')](_0xb3db('0x1c'),_0x3d2948,JSON[_0xb3db('0x1d')](_0x5c18c4));_0x591f6d(_0x5c18c4);})['catch'](function(_0x19a36b){logger[_0xb3db('0x13')](_0xb3db('0x1c'),_0x19a36b['message'],_0x3d2948);_0x38b5c6(_0x202c27['error'](0x1f4,_0x19a36b[_0xb3db('0x14')]));});});};exports['AvgHandleTime']=function(_0x33b68b){var _0x3bdeca=this;return new Promise(function(_0x17bc00,_0x567771){return db['CmHopperHistory']['findAll']({'raw':_0x33b68b[_0xb3db('0x1a')]?_0x33b68b[_0xb3db('0x1a')][_0xb3db('0x1b')]===undefined?!![]:![]:!![],'where':_0x33b68b['options']?_0x33b68b[_0xb3db('0x1a')]['where']||null:null,'attributes':[[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')][_0xb3db('0x20')]('id')),_0xb3db('0x21')],[db[_0xb3db('0x1e')]['fn']('COUNT',db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')]['literal'](_0xb3db('0x22')))),_0xb3db('0x23')],[db[_0xb3db('0x1e')]['fn']('COUNT',db[_0xb3db('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xb3db('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xb3db('0x1e')]['fn']('AVG',db[_0xb3db('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb3db('0x27')],[db['sequelize']['fn'](_0xb3db('0x28'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x29')))),_0xb3db('0x2a')]]})[_0xb3db('0xe')](function(_0x2c1ebb){logger[_0xb3db('0xf')](_0xb3db('0x2b'),_0x33b68b);logger[_0xb3db('0x12')](_0xb3db('0x2b'),_0x33b68b,JSON[_0xb3db('0x1d')](_0x2c1ebb));_0x17bc00(_0x2c1ebb);})[_0xb3db('0x16')](function(_0x562b20){logger[_0xb3db('0x13')]('AvgHandleTime',_0x562b20[_0xb3db('0x14')],_0x33b68b);_0x567771(_0x3bdeca[_0xb3db('0x13')](0x1f4,_0x562b20[_0xb3db('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x26e01b){var _0x273093=this;return new Promise(function(_0x21b309,_0x15f5bb){return db[_0xb3db('0x17')][_0xb3db('0x2c')]({'raw':_0x26e01b['options']?_0x26e01b[_0xb3db('0x1a')][_0xb3db('0x1b')]===undefined?!![]:![]:!![],'where':_0x26e01b[_0xb3db('0x1a')]?_0x26e01b[_0xb3db('0x1a')][_0xb3db('0x2d')]||null:null,'attributes':[['campaign',_0xb3db('0x2e')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x2f')))),_0xb3db('0x30')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db['sequelize'][_0xb3db('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0xb3db('0x31')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x22')))),'outboundAnswerCallsDay'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db['sequelize'][_0xb3db('0x25')](_0xb3db('0x32')))),_0xb3db('0x33')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x34')))),_0xb3db('0x35')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db['sequelize'][_0xb3db('0x25')](_0xb3db('0x36')))),_0xb3db('0x37')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')]['literal'](_0xb3db('0x38')))),_0xb3db('0x39')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0xb3db('0x3a')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x3b')))),_0xb3db('0x3c')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x3d')))),_0xb3db('0x3e')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x3f')))),_0xb3db('0x40')],[db['sequelize']['fn'](_0xb3db('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xb3db('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')]['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x41')))),_0xb3db('0x42')]],'group':['campaign']})['then'](function(_0x1bb0c0){logger['info']('GetVoiceQueueHopperHistory',_0x26e01b);logger[_0xb3db('0x12')]('GetVoiceQueueHopperHistory',_0x26e01b,JSON[_0xb3db('0x1d')](_0x1bb0c0));_0x21b309(_0x1bb0c0);})[_0xb3db('0x16')](function(_0x4532d1){logger['error'](_0xb3db('0x43'),_0x4532d1[_0xb3db('0x14')],_0x26e01b);_0x15f5bb(_0x273093[_0xb3db('0x13')](0x1f4,_0x4532d1[_0xb3db('0x14')]));});});};exports[_0xb3db('0x44')]=function(_0x708e81){var _0x5ef49a=this;return new Promise(function(_0x1ff43b,_0x6e2e80){return db['CmHopperHistory']['findAll']({'raw':_0x708e81[_0xb3db('0x1a')]?_0x708e81['options'][_0xb3db('0x1b')]===undefined?!![]:![]:!![],'where':_0x708e81[_0xb3db('0x1a')]?_0x708e81[_0xb3db('0x1a')][_0xb3db('0x2d')]||null:null,'attributes':[[_0xb3db('0x45'),_0xb3db('0x2e')],[db[_0xb3db('0x1e')]['fn'](_0xb3db('0x1f'),db[_0xb3db('0x1e')][_0xb3db('0x20')]('id')),_0xb3db('0x46')],[db[_0xb3db('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb3db('0x1e')][_0xb3db('0x25')](_0xb3db('0x22')))),_0xb3db('0x47')]],'group':[_0xb3db('0x45')]})[_0xb3db('0xe')](function(_0x1c23f3){logger['info'](_0xb3db('0x44'),_0x708e81);logger['debug'](_0xb3db('0x44'),_0x708e81,JSON[_0xb3db('0x1d')](_0x1c23f3));_0x1ff43b(_0x1c23f3);})[_0xb3db('0x16')](function(_0x2c1d49){logger[_0xb3db('0x13')](_0xb3db('0x44'),_0x2c1d49[_0xb3db('0x14')],_0x708e81);_0x6e2e80(_0x5ef49a[_0xb3db('0x13')](0x1f4,_0x2c1d49[_0xb3db('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 45e2758..7385326 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 _0xc82c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','post','create','put','multer'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc82c,0x125));var _0xcc82=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc82c[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xcc82('0x0'));var util=require(_0xcc82('0x1'));var path=require('path');var timeout=require(_0xcc82('0x2'));var express=require(_0xcc82('0x3'));var router=express[_0xcc82('0x4')]();var auth=require(_0xcc82('0x5'));var interaction=require(_0xcc82('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xcc82('0x7')](),controller[_0xcc82('0x8')]);router['get']('/describe',auth[_0xcc82('0x7')](),controller['describe']);router[_0xcc82('0x9')](_0xcc82('0xa'),auth[_0xcc82('0x7')](),controller['show']);router[_0xcc82('0xb')]('/',auth[_0xcc82('0x7')](),controller[_0xcc82('0xc')]);router[_0xcc82('0xd')](_0xcc82('0xa'),auth[_0xcc82('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x1a44=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','update','exports','multer','path'];(function(_0xda1a47,_0x550df1){var _0x171910=function(_0x235caf){while(--_0x235caf){_0xda1a47['push'](_0xda1a47['shift']());}};_0x171910(++_0x550df1);}(_0x1a44,0xc4));var _0x41a4=function(_0x5540ff,_0x111b0b){_0x5540ff=_0x5540ff-0x0;var _0x3aaa8d=_0x1a44[_0x5540ff];return _0x3aaa8d;};'use strict';var multer=require(_0x41a4('0x0'));var util=require('util');var path=require(_0x41a4('0x1'));var timeout=require(_0x41a4('0x2'));var express=require(_0x41a4('0x3'));var router=express[_0x41a4('0x4')]();var auth=require(_0x41a4('0x5'));var interaction=require(_0x41a4('0x6'));var config=require(_0x41a4('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x41a4('0x8')]('/',auth[_0x41a4('0x9')](),controller[_0x41a4('0xa')]);router[_0x41a4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x41a4('0xb')]);router[_0x41a4('0x8')](_0x41a4('0xc'),auth[_0x41a4('0x9')](),controller[_0x41a4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x41a4('0xe')]);router[_0x41a4('0xf')](_0x41a4('0xc'),auth[_0x41a4('0x9')](),controller[_0x41a4('0x10')]);module[_0x41a4('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 6607ce8..d1c6172 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 _0x6f9d=['name','sequelize','exports','STRING'];(function(_0x24bd96,_0x260e8f){var _0x5bfdd7=function(_0x3dda59){while(--_0x3dda59){_0x24bd96['push'](_0x24bd96['shift']());}};_0x5bfdd7(++_0x260e8f);}(_0x6f9d,0x191));var _0xd6f9=function(_0xb96f50,_0xa21d9b){_0xb96f50=_0xb96f50-0x0;var _0x1caf5d=_0x6f9d[_0xb96f50];return _0x1caf5d;};'use strict';var Sequelize=require(_0xd6f9('0x0'));module[_0xd6f9('0x1')]={'name':{'type':Sequelize[_0xd6f9('0x2')],'unique':_0xd6f9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd6f9('0x2')]},'dialPrefix':{'type':Sequelize[_0xd6f9('0x2')]}}; \ No newline at end of file +var _0x6617=['STRING','sequelize'];(function(_0x1e618c,_0x4712a7){var _0x47299d=function(_0x2357e7){while(--_0x2357e7){_0x1e618c['push'](_0x1e618c['shift']());}};_0x47299d(++_0x4712a7);}(_0x6617,0x11d));var _0x7661=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x6617[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x7661('0x0'));module['exports']={'name':{'type':Sequelize[_0x7661('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7661('0x1')]},'dialPrefix':{'type':Sequelize[_0x7661('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 23436ea..1cc2e4e 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 _0x2cb4=['filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','findOne','order','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','pick','raw','getContactsCsv','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./cmList.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','then','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x5f51b2,_0x5ac502){var _0x7a4006=function(_0x5e93b0){while(--_0x5e93b0){_0x5f51b2['push'](_0x5f51b2['shift']());}};_0x7a4006(++_0x5ac502);}(_0x2cb4,0x176));var _0x42cb=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x2cb4[_0x58381c];return _0x1a7440;};'use strict';var pdf=require(_0x42cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42cb('0x1'));var zipdir=require(_0x42cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42cb('0x3'));var moment=require(_0x42cb('0x4'));var BPromise=require(_0x42cb('0x5'));var Mustache=require(_0x42cb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x42cb('0x7'));var csv=require(_0x42cb('0x8'));var ejs=require(_0x42cb('0x9'));var fs=require('fs');var _=require(_0x42cb('0xa'));var squel=require('squel');var crypto=require(_0x42cb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42cb('0x8'));var querystring=require(_0x42cb('0xc'));var Papa=require(_0x42cb('0xd'));var Redis=require(_0x42cb('0xe'));var authService=require(_0x42cb('0xf'));var qs=require(_0x42cb('0x10'));var as=require(_0x42cb('0x11'));var hardwareService=require(_0x42cb('0x12'));var logger=require(_0x42cb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x42cb('0x14'));var licenseUtil=require(_0x42cb('0x15'));var db=require(_0x42cb('0x16'))['db'];config['redis']=_[_0x42cb('0x17')](config[_0x42cb('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42cb('0x18')]));require(_0x42cb('0x19'))[_0x42cb('0x1a')](socket);function respondWithStatusCode(_0x1cdb92,_0x27ee11){_0x27ee11=_0x27ee11||0xcc;return function(_0x3e8a7a){if(_0x3e8a7a){return _0x1cdb92[_0x42cb('0x1b')](_0x27ee11);}return _0x1cdb92[_0x42cb('0x1c')](_0x27ee11)[_0x42cb('0x1d')]();};}function respondWithResult(_0x1bca76,_0x389945){_0x389945=_0x389945||0xc8;return function(_0x47b8e0){if(_0x47b8e0){return _0x1bca76[_0x42cb('0x1c')](_0x389945)['json'](_0x47b8e0);}};}function respondWithFilteredResult(_0x12f4bf,_0x4b927f){return function(_0x3ca4d4){if(_0x3ca4d4){var _0x3b4fb9=_0x3ca4d4[_0x42cb('0x1e')],_0x31c76e=_0x4b927f[_0x42cb('0x1f')],_0x1b208b=_0x4b927f['offset']+_0x4b927f[_0x42cb('0x20')],_0x192674;if(_0x1b208b>=_0x3b4fb9){_0x1b208b=_0x3b4fb9;_0x192674=0xc8;}else{_0x192674=0xce;}_0x12f4bf[_0x42cb('0x1c')](_0x192674);return _0x12f4bf['set'](_0x42cb('0x21'),_0x31c76e+'-'+_0x1b208b+'/'+_0x3b4fb9)[_0x42cb('0x22')](_0x3ca4d4);}return null;};}function patchUpdates(_0x1f06bc){return function(_0x3ae5cb){try{jsonpatch[_0x42cb('0x23')](_0x3ae5cb,_0x1f06bc,!![]);}catch(_0x4404cf){return BPromise[_0x42cb('0x24')](_0x4404cf);}return _0x3ae5cb[_0x42cb('0x25')]();};}function saveUpdates(_0x174f77,_0x10e048){return function(_0x102bcd){if(_0x102bcd){return _0x102bcd['update'](_0x174f77)['then'](function(_0x82a23c){return _0x82a23c;});}return null;};}function removeEntity(_0x3861c0,_0x5480f2){return function(_0x20e6b6){if(_0x20e6b6){return _0x20e6b6[_0x42cb('0x26')]()[_0x42cb('0x27')](function(){var _0x1b74ae=_0x20e6b6[_0x42cb('0x28')]({'plain':!![]});var _0x3cd942=_0x42cb('0x29');return db[_0x42cb('0x2a')][_0x42cb('0x26')]({'where':{'type':_0x3cd942,'resourceId':_0x1b74ae['id']}})[_0x42cb('0x27')](function(){return _0x20e6b6;});})[_0x42cb('0x27')](function(){_0x3861c0[_0x42cb('0x1c')](0xcc)[_0x42cb('0x1d')]();});}};}function handleEntityNotFound(_0x42c70e,_0x4520ad){return function(_0x268872){if(!_0x268872){_0x42c70e[_0x42cb('0x1b')](0x194);}return _0x268872;};}function handleError(_0x668460,_0xa92028){_0xa92028=_0xa92028||0x1f4;return function(_0x32038b){logger['error'](_0x32038b[_0x42cb('0x2b')]);if(_0x32038b[_0x42cb('0x2c')]){delete _0x32038b[_0x42cb('0x2c')];}_0x668460['status'](_0xa92028)[_0x42cb('0x2d')](_0x32038b);};}exports[_0x42cb('0x2e')]=function(_0x4798b0,_0x4e279e){var _0x203840={},_0x15bf67={},_0x1d20e7={'count':0x0,'rows':[]};var _0x3d57c8=_[_0x42cb('0x2f')](db[_0x42cb('0x30')][_0x42cb('0x31')],function(_0x1d3fe2){return{'name':_0x1d3fe2[_0x42cb('0x32')],'type':_0x1d3fe2[_0x42cb('0x33')][_0x42cb('0x34')]};});_0x15bf67[_0x42cb('0x35')]=_['map'](_0x3d57c8,_0x42cb('0x2c'));_0x15bf67[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x4798b0[_0x42cb('0x36')]);_0x15bf67['filters']=_[_0x42cb('0x38')](_0x15bf67[_0x42cb('0x35')],_0x15bf67['query']);_0x203840['attributes']=_[_0x42cb('0x38')](_0x15bf67[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x4798b0[_0x42cb('0x36')]['fields']));_0x203840[_0x42cb('0x3a')]=_0x203840[_0x42cb('0x3a')]['length']?_0x203840[_0x42cb('0x3a')]:_0x15bf67[_0x42cb('0x35')];if(!_0x4798b0[_0x42cb('0x36')][_0x42cb('0x3b')](_0x42cb('0x3c'))){_0x203840[_0x42cb('0x20')]=qs[_0x42cb('0x20')](_0x4798b0['query']['limit']);_0x203840[_0x42cb('0x1f')]=qs[_0x42cb('0x1f')](_0x4798b0[_0x42cb('0x36')][_0x42cb('0x1f')]);}_0x203840['order']=qs['sort'](_0x4798b0[_0x42cb('0x36')][_0x42cb('0x3d')]);_0x203840[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_['pick'](_0x4798b0['query'],_0x15bf67[_0x42cb('0x3f')]),_0x3d57c8);if(_0x4798b0[_0x42cb('0x36')][_0x42cb('0x40')]){_0x203840[_0x42cb('0x3e')]=_[_0x42cb('0x41')](_0x203840['where'],{'$or':_[_0x42cb('0x2f')](_0x3d57c8,function(_0x393869){if(_0x393869[_0x42cb('0x33')]!==_0x42cb('0x42')){var _0x2a14a2={};_0x2a14a2[_0x393869[_0x42cb('0x2c')]]={'$like':'%'+_0x4798b0['query'][_0x42cb('0x40')]+'%'};return _0x2a14a2;}})});}_0x203840=_[_0x42cb('0x41')]({},_0x203840,_0x4798b0[_0x42cb('0x43')]);var _0x2766dd={'where':_0x203840[_0x42cb('0x3e')]};return db[_0x42cb('0x30')][_0x42cb('0x1e')](_0x2766dd)['then'](function(_0x13cc66){_0x1d20e7['count']=_0x13cc66;if(_0x4798b0['query'][_0x42cb('0x44')]){_0x203840[_0x42cb('0x45')]=[{'all':!![]}];}return db['CmList'][_0x42cb('0x46')](_0x203840);})['then'](function(_0x6c8011){_0x1d20e7['rows']=_0x6c8011;return _0x1d20e7;})[_0x42cb('0x27')](respondWithFilteredResult(_0x4e279e,_0x203840))['catch'](handleError(_0x4e279e,null));};exports[_0x42cb('0x47')]=function(_0x564925,_0x27eeb4){var _0x3ddeb0={'raw':![],'where':{'id':_0x564925[_0x42cb('0x48')]['id']}},_0x2c7960={};_0x2c7960[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x30')][_0x42cb('0x31')]);_0x2c7960[_0x42cb('0x36')]=_['keys'](_0x564925['query']);_0x2c7960[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x2c7960['model'],_0x2c7960[_0x42cb('0x36')]);_0x3ddeb0[_0x42cb('0x3a')]=_[_0x42cb('0x38')](_0x2c7960['model'],qs['fields'](_0x564925['query'][_0x42cb('0x39')]));_0x3ddeb0['attributes']=_0x3ddeb0[_0x42cb('0x3a')][_0x42cb('0x49')]?_0x3ddeb0[_0x42cb('0x3a')]:_0x2c7960['model'];if(_0x564925[_0x42cb('0x36')][_0x42cb('0x44')]){_0x3ddeb0[_0x42cb('0x45')]=[{'all':!![]}];}_0x3ddeb0=_['merge']({},_0x3ddeb0,_0x564925[_0x42cb('0x43')]);return db[_0x42cb('0x30')][_0x42cb('0x4a')](_0x3ddeb0)[_0x42cb('0x27')](handleEntityNotFound(_0x27eeb4,null))[_0x42cb('0x27')](respondWithResult(_0x27eeb4,null))['catch'](handleError(_0x27eeb4,null));};exports['create']=function(_0x1388c1,_0xe747d6){return db[_0x42cb('0x30')][_0x42cb('0x4b')](_0x1388c1['body'],{})[_0x42cb('0x27')](function(_0x142f82){var _0x23d2ca=_0x1388c1[_0x42cb('0x4c')][_0x42cb('0x28')]({'plain':!![]});if(!_0x23d2ca)throw new Error(_0x42cb('0x4d'));if(_0x23d2ca[_0x42cb('0x4e')]===_0x42cb('0x4c')){var _0x2c3099=_0x142f82[_0x42cb('0x28')]({'plain':!![]});var _0x25a401=_0x42cb('0x29');return db['UserProfileSection'][_0x42cb('0x4a')]({'where':{'name':_0x25a401,'userProfileId':_0x23d2ca['userProfileId']},'raw':!![]})[_0x42cb('0x27')](function(_0xa3d8cb){if(_0xa3d8cb&&_0xa3d8cb[_0x42cb('0x4f')]===0x0){return db[_0x42cb('0x2a')][_0x42cb('0x4b')]({'name':_0x2c3099[_0x42cb('0x2c')],'resourceId':_0x2c3099['id'],'type':_0xa3d8cb[_0x42cb('0x2c')],'sectionId':_0xa3d8cb['id']},{})['then'](function(){return _0x142f82;});}else{return _0x142f82;}})[_0x42cb('0x50')](function(_0x441919){logger[_0x42cb('0x51')](_0x42cb('0x52'),_0x441919);throw _0x441919;});}return _0x142f82;})[_0x42cb('0x27')](respondWithResult(_0xe747d6,0xc9))['catch'](handleError(_0xe747d6,null));};exports[_0x42cb('0x53')]=function(_0x7ba440,_0x522cff){if(_0x7ba440[_0x42cb('0x54')]['id']){delete _0x7ba440[_0x42cb('0x54')]['id'];}return db[_0x42cb('0x30')]['find']({'where':{'id':_0x7ba440[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x522cff,null))[_0x42cb('0x27')](saveUpdates(_0x7ba440[_0x42cb('0x54')],null))['then'](respondWithResult(_0x522cff,null))[_0x42cb('0x50')](handleError(_0x522cff,null));};exports[_0x42cb('0x26')]=function(_0x29f893,_0x36a417){return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x29f893['params']['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x36a417,null))[_0x42cb('0x27')](removeEntity(_0x36a417,null))[_0x42cb('0x50')](handleError(_0x36a417,null));};exports[_0x42cb('0x55')]=function(_0x3ad3d3,_0xe1be1a){return db[_0x42cb('0x30')][_0x42cb('0x55')]()[_0x42cb('0x27')](respondWithResult(_0xe1be1a,null))[_0x42cb('0x50')](handleError(_0xe1be1a,null));};exports[_0x42cb('0x56')]=function(_0x55bb62,_0x5d4511,_0x3eaea4){if(_0x55bb62['body']['id']){delete _0x55bb62[_0x42cb('0x54')]['id'];}return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x55bb62[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x5d4511,null))[_0x42cb('0x27')](function(_0x2c43f9){if(_0x2c43f9){_0x55bb62['body'][_0x42cb('0x57')]=_0x2c43f9['id'];return db[_0x42cb('0x58')][_0x42cb('0x4b')](_0x55bb62['body']);}})[_0x42cb('0x27')](respondWithResult(_0x5d4511,null))[_0x42cb('0x50')](handleError(_0x5d4511,null));};exports['getDispositions']=function(_0x560ea4,_0x3f4ef2,_0x542be1){var _0x4be477={'raw':![],'where':{}};var _0x217774={};var _0x5e75c3={'count':0x0,'rows':[]};return db[_0x42cb('0x30')][_0x42cb('0x59')]({'where':{'id':_0x560ea4['params']['id']}})['then'](handleEntityNotFound(_0x3f4ef2,null))[_0x42cb('0x27')](function(_0x74496d){if(_0x74496d){_0x217774[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x58')]['rawAttributes']);_0x217774[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x560ea4[_0x42cb('0x36')]);_0x217774[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x217774['model'],_0x217774[_0x42cb('0x36')]);_0x4be477[_0x42cb('0x3a')]=_[_0x42cb('0x38')](_0x217774['model'],qs[_0x42cb('0x39')](_0x560ea4['query'][_0x42cb('0x39')]));_0x4be477['attributes']=_0x4be477[_0x42cb('0x3a')][_0x42cb('0x49')]?_0x4be477['attributes']:_0x217774[_0x42cb('0x35')];if(!_0x560ea4['query'][_0x42cb('0x3b')](_0x42cb('0x3c'))){_0x4be477[_0x42cb('0x20')]=qs[_0x42cb('0x20')](_0x560ea4[_0x42cb('0x36')][_0x42cb('0x20')]);_0x4be477['offset']=qs['offset'](_0x560ea4[_0x42cb('0x36')]['offset']);}_0x4be477[_0x42cb('0x5a')]=qs['sort'](_0x560ea4['query']['sort']);_0x4be477[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_['pick'](_0x560ea4[_0x42cb('0x36')],_0x217774[_0x42cb('0x3f')]));_0x4be477[_0x42cb('0x3e')][_0x42cb('0x57')]=_0x74496d['id'];if(_0x560ea4[_0x42cb('0x36')][_0x42cb('0x40')]){_0x4be477[_0x42cb('0x3e')]=_['merge'](_0x4be477[_0x42cb('0x3e')],{'$or':_[_0x42cb('0x2f')](_0x4be477[_0x42cb('0x3a')],function(_0x140eea){var _0x3a8945={};_0x3a8945[_0x140eea]={'$like':'%'+_0x560ea4[_0x42cb('0x36')][_0x42cb('0x40')]+'%'};return _0x3a8945;})});}_0x4be477=_[_0x42cb('0x41')]({},_0x4be477,_0x560ea4[_0x42cb('0x43')]);return db['Disposition'][_0x42cb('0x1e')]({'where':_0x4be477[_0x42cb('0x3e')]})[_0x42cb('0x27')](function(_0x5815e3){_0x5e75c3[_0x42cb('0x1e')]=_0x5815e3;if(_0x560ea4[_0x42cb('0x36')][_0x42cb('0x44')]){_0x4be477[_0x42cb('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x42cb('0x46')](_0x4be477);})[_0x42cb('0x27')](function(_0xf2df8c){_0x5e75c3[_0x42cb('0x5b')]=_0xf2df8c;return _0x5e75c3;});}})[_0x42cb('0x27')](respondWithFilteredResult(_0x3f4ef2,_0x4be477))[_0x42cb('0x50')](handleError(_0x3f4ef2,null));};exports[_0x42cb('0x5c')]=function(_0x36949f,_0x5b93b0,_0x403c44){return db['CmList'][_0x42cb('0x4a')]({'where':{'id':_0x36949f['params']['id']}})['then'](handleEntityNotFound(_0x5b93b0,null))[_0x42cb('0x27')](function(_0x3900aa){if(_0x3900aa){return _0x3900aa[_0x42cb('0x5c')](_0x36949f['query'][_0x42cb('0x5d')]);}})['then'](respondWithStatusCode(_0x5b93b0,null))[_0x42cb('0x50')](handleError(_0x5b93b0,null));};exports[_0x42cb('0x5e')]=function(_0x1cbf58,_0x1be2a4,_0x39123e){return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x1cbf58[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x1be2a4,null))[_0x42cb('0x27')](function(_0x1e7e62){if(_0x1e7e62){var _0x2d1522=[];var _0x43d35e={'success':[],'errors':[]};return db[_0x42cb('0x5f')][_0x42cb('0x55')]()[_0x42cb('0x27')](function(_0x171e46){if(_0x1cbf58[_0x42cb('0x54')]['tags']&&_[_0x42cb('0x60')](_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')])){if(_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]['length']){_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]=_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')][_0x42cb('0x62')](';')+';';}else{_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]=null;}}else{_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x61')]=null;}if(_0x1cbf58[_0x42cb('0x54')]&&_[_0x42cb('0x60')](_0x1cbf58['body'])){for(var _0x29386c=0x0;_0x29386c<_0x1cbf58[_0x42cb('0x54')][_0x42cb('0x49')];_0x29386c+=0x1){_0x1cbf58['body'][_0x29386c]['ListId']=_0x1cbf58[_0x42cb('0x48')]['id'];_0x2d1522[_0x42cb('0x63')](_0x1cbf58[_0x42cb('0x54')][_0x29386c]);}return BPromise[_0x42cb('0x64')](_0x2d1522,function(_0x4a50f8){return db[_0x42cb('0x5f')]['create'](_[_0x42cb('0x65')](_0x4a50f8,['ids','id'])||{},{'fields':_[_0x42cb('0x37')](_0x171e46),'raw':!![]})[_0x42cb('0x27')](function(_0x167a2a){_0x43d35e[_0x42cb('0x66')][_0x42cb('0x63')](_0x167a2a[_0x42cb('0x67')]);})[_0x42cb('0x50')](function(_0x4df71d){_0x43d35e[_0x42cb('0x68')][_0x42cb('0x63')]({'data':_0x4a50f8,'error':_0x4df71d[_0x42cb('0x69')]});});})[_0x42cb('0x27')](function(_0x284b09){return _0x43d35e;})[_0x42cb('0x50')](function(_0x722555){return _0x722555;});}else{_0x1be2a4[_0x42cb('0x1c')](0x190)[_0x42cb('0x22')]({'message':_0x42cb('0x6a')});}});}})[_0x42cb('0x27')](respondWithResult(_0x1be2a4,null))[_0x42cb('0x50')](handleError(_0x1be2a4,null));};exports[_0x42cb('0x6b')]=function(_0x309682,_0x5a01cb,_0x4c3a17){var _0x45a1e9;return db['CmList']['find']({'where':{'id':_0x309682[_0x42cb('0x48')]['id']},'include':[{'model':db[_0x42cb('0x6c')],'as':'CustomFields'}]})[_0x42cb('0x27')](handleEntityNotFound(_0x5a01cb,null))[_0x42cb('0x27')](function(_0x1de934){if(_0x1de934){_0x45a1e9=_0x1de934;return db[_0x42cb('0x5f')][_0x42cb('0x31')];}})[_0x42cb('0x27')](function(_0x1fd7ef){if(_0x1fd7ef){var _0x52212b={};var _0x1d713c={};_0x1d713c['model']=_[_0x42cb('0x6d')](_[_0x42cb('0x37')](_0x1fd7ef),_[_0x42cb('0x2f')](_0x45a1e9[_0x42cb('0x6e')],function(_0x2bebf1){return util['format'](_0x42cb('0x6f'),_0x2bebf1['id']);}));_0x1d713c[_0x42cb('0x36')]=_['keys'](_0x309682['query']);_0x1d713c['filters']=_[_0x42cb('0x38')](_0x1d713c['model'],_0x1d713c[_0x42cb('0x36')]);_0x52212b[_0x42cb('0x3a')]=_['intersection'](_0x1d713c[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x309682['query'][_0x42cb('0x39')]));_0x52212b[_0x42cb('0x3a')]=_0x52212b[_0x42cb('0x3a')][_0x42cb('0x49')]?_0x52212b[_0x42cb('0x3a')]:_0x1d713c[_0x42cb('0x35')];if(!_0x309682['query'][_0x42cb('0x3b')]('nolimit')){_0x52212b[_0x42cb('0x20')]=qs[_0x42cb('0x20')](_0x309682['query'][_0x42cb('0x20')]);_0x52212b[_0x42cb('0x1f')]=qs['offset'](_0x309682[_0x42cb('0x36')][_0x42cb('0x1f')]);}_0x52212b[_0x42cb('0x5a')]=qs[_0x42cb('0x3d')](_0x309682[_0x42cb('0x36')][_0x42cb('0x3d')]);_0x52212b[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_[_0x42cb('0x70')](_0x309682[_0x42cb('0x36')],_0x1d713c['filters']));_0x52212b[_0x42cb('0x71')]=!![];if(_0x309682[_0x42cb('0x36')][_0x42cb('0x40')]){_0x52212b[_0x42cb('0x3e')]=_['merge'](_0x52212b[_0x42cb('0x3e')],{'$or':_['map'](_0x52212b[_0x42cb('0x3a')],function(_0x58ec7e){var _0x2a413e={};_0x2a413e[_0x58ec7e]={'$like':'%'+_0x309682[_0x42cb('0x36')]['filter']+'%'};return _0x2a413e;})});}_0x52212b=_[_0x42cb('0x41')]({},_0x52212b,_0x309682[_0x42cb('0x43')]);return _0x45a1e9['getContacts'](_0x52212b);}})[_0x42cb('0x27')](respondWithResult(_0x5a01cb,null))[_0x42cb('0x50')](handleError(_0x5a01cb,null));};exports[_0x42cb('0x72')]=function(_0x3d5960,_0xe4ad46,_0x577594){var _0x42ffde;return db[_0x42cb('0x30')]['find']({'where':{'id':_0x3d5960[_0x42cb('0x48')]['id']},'include':[{'model':db[_0x42cb('0x6c')],'as':_0x42cb('0x6e')}]})[_0x42cb('0x27')](handleEntityNotFound(_0xe4ad46,null))[_0x42cb('0x27')](function(_0x2e9891){if(_0x2e9891){_0x42ffde=_0x2e9891;return db['CmContact'][_0x42cb('0x31')];}})['then'](function(_0x53590e){if(_0x53590e){var _0x55ae7c={};var _0x1e3a3d={};_0x1e3a3d['model']=_[_0x42cb('0x6d')](_['keys'](_0x53590e),_[_0x42cb('0x2f')](_0x42ffde[_0x42cb('0x6e')],function(_0x5f319f){return util['format']('cf_%d',_0x5f319f['id']);}));_0x1e3a3d[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x3d5960[_0x42cb('0x36')]);_0x1e3a3d[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x1e3a3d['model'],_0x1e3a3d['query']);_0x55ae7c['attributes']=_[_0x42cb('0x38')](_0x1e3a3d[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x3d5960['query'][_0x42cb('0x39')]));_0x55ae7c[_0x42cb('0x3a')]=_0x55ae7c['attributes'][_0x42cb('0x49')]?_0x55ae7c[_0x42cb('0x3a')]:_0x1e3a3d[_0x42cb('0x35')];if(!_0x3d5960[_0x42cb('0x36')][_0x42cb('0x3b')]('nolimit')){_0x55ae7c['limit']=qs['limit'](_0x3d5960[_0x42cb('0x36')][_0x42cb('0x20')]);_0x55ae7c['offset']=qs[_0x42cb('0x1f')](_0x3d5960[_0x42cb('0x36')][_0x42cb('0x1f')]);}_0x55ae7c['order']=qs[_0x42cb('0x3d')](_0x3d5960[_0x42cb('0x36')][_0x42cb('0x3d')]);_0x55ae7c[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_[_0x42cb('0x70')](_0x3d5960['query'],_0x1e3a3d['filters']));_0x55ae7c[_0x42cb('0x71')]=!![];if(_0x3d5960[_0x42cb('0x36')][_0x42cb('0x40')]){_0x55ae7c[_0x42cb('0x3e')]=_['merge'](_0x55ae7c['where'],{'$or':_[_0x42cb('0x2f')](_0x55ae7c['attributes'],function(_0x38cd86){var _0x9eb43b={};_0x9eb43b[_0x38cd86]={'$like':'%'+_0x3d5960[_0x42cb('0x36')]['filter']+'%'};return _0x9eb43b;})});}_0x55ae7c=_[_0x42cb('0x41')]({},_0x55ae7c,_0x3d5960[_0x42cb('0x43')]);return _0x42ffde['getContacts'](_0x55ae7c);}})['then'](function(_0x955c47){if(!_[_0x42cb('0x73')](_0x955c47)){var _0x3351f2=toCsv(_0x955c47);var _0x47b680=Date[_0x42cb('0x74')]();fs['writeFileSync'](util[_0x42cb('0x75')](_0x42cb('0x76'),_0x42ffde['id'],_0x47b680),_0x3351f2);_0xe4ad46[_0x42cb('0x77')](_0x42cb('0x78'),_0x42cb('0x79')+util['format'](_0x42cb('0x7a'),_0x42ffde['id'],_0x47b680));_0xe4ad46[_0x42cb('0x77')](_0x42cb('0x7b'),'text/csv');return _0xe4ad46[_0x42cb('0x7c')](util[_0x42cb('0x75')](_0x42cb('0x76'),_0x42ffde['id'],_0x47b680));}else{return _0xe4ad46[_0x42cb('0x1b')](0xcc);}})[_0x42cb('0x50')](handleError(_0xe4ad46,null));};exports[_0x42cb('0x7d')]=function(_0x11c6ae,_0x19a45b,_0x44d451){var _0x36ddc1;delete _0x11c6ae[_0x42cb('0x54')]['id'];return db[_0x42cb('0x30')]['findOne']({'where':{'id':_0x11c6ae[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x19a45b,null))[_0x42cb('0x27')](function(_0x209340){if(_0x209340){return db[_0x42cb('0x7e')][_0x42cb('0x7f')](function(_0x5677db){return db['CmCustomField'][_0x42cb('0x4b')](_0x11c6ae[_0x42cb('0x54')],{'transaction':_0x5677db})[_0x42cb('0x27')](function(_0x50f997){_0x36ddc1=_0x50f997;return _0x209340[_0x42cb('0x80')](_0x50f997,{'transaction':_0x5677db});})[_0x42cb('0x27')](function(){var _0x58bac0={'type':db[_0x42cb('0x81')][_0x42cb('0x82')],'transaction':_0x5677db};switch(_0x11c6ae[_0x42cb('0x54')][_0x42cb('0x33')]){case'text':_0x58bac0[_0x42cb('0x33')]=db[_0x42cb('0x81')][_0x42cb('0x82')];break;case'number':_0x58bac0[_0x42cb('0x33')]=db[_0x42cb('0x81')][_0x42cb('0x83')];break;case _0x42cb('0x84'):_0x58bac0[_0x42cb('0x33')]=db['Sequelize'][_0x42cb('0x85')];_0x58bac0[_0x42cb('0x86')]=![];break;default:}return db['sequelize'][_0x42cb('0x87')]['addColumn'](_0x42cb('0x88'),util[_0x42cb('0x75')]('cf_%s',_0x36ddc1['id']),_0x58bac0);})['then'](function(){return _0x36ddc1;});});}})[_0x42cb('0x27')](respondWithResult(_0x19a45b,null))[_0x42cb('0x50')](handleError(_0x19a45b,null));};exports[_0x42cb('0x89')]=function(_0x2a36f9,_0x1aa944,_0x3854e5){var _0xe15a39={};var _0x58e7c6={};var _0x39ab19;var _0x46d3af;return db[_0x42cb('0x30')][_0x42cb('0x59')]({'where':{'id':_0x2a36f9[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x1aa944,null))[_0x42cb('0x27')](function(_0x2527bb){if(_0x2527bb){_0x39ab19=_0x2527bb;_0x58e7c6[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x6c')][_0x42cb('0x31')]);_0x58e7c6['query']=_[_0x42cb('0x37')](_0x2a36f9[_0x42cb('0x36')]);_0x58e7c6[_0x42cb('0x3f')]=_[_0x42cb('0x38')](_0x58e7c6['model'],_0x58e7c6[_0x42cb('0x36')]);_0xe15a39[_0x42cb('0x3a')]=_[_0x42cb('0x38')](_0x58e7c6['model'],qs['fields'](_0x2a36f9[_0x42cb('0x36')][_0x42cb('0x39')]));_0xe15a39[_0x42cb('0x3a')]=_0xe15a39[_0x42cb('0x3a')][_0x42cb('0x49')]?_0xe15a39[_0x42cb('0x3a')]:_0x58e7c6[_0x42cb('0x35')];_0xe15a39[_0x42cb('0x5a')]=qs[_0x42cb('0x3d')](_0x2a36f9['query']['sort']);_0xe15a39['where']=qs['filters'](_[_0x42cb('0x70')](_0x2a36f9[_0x42cb('0x36')],_0x58e7c6[_0x42cb('0x3f')]));_0xe15a39[_0x42cb('0x3e')]=_[_0x42cb('0x41')](_0xe15a39['where'],{'$or':[{'ListId':_0x2527bb['id']},{'ListId':null}]});if(_0x2a36f9[_0x42cb('0x36')][_0x42cb('0x40')]){_0xe15a39['where']=_['merge'](_0xe15a39['where'],{'$or':_[_0x42cb('0x2f')](_0xe15a39[_0x42cb('0x3a')],function(_0x1502a6){var _0x2e6344={};_0x2e6344[_0x1502a6]={'$like':'%'+_0x2a36f9[_0x42cb('0x36')][_0x42cb('0x40')]+'%'};return _0x2e6344;})});}_0xe15a39=_[_0x42cb('0x41')]({},_0xe15a39,_0x2a36f9[_0x42cb('0x43')]);return db[_0x42cb('0x6c')]['findAndCountAll'](_0xe15a39);}})['then'](respondWithResult(_0x1aa944,null))[_0x42cb('0x50')](handleError(_0x1aa944,null));};exports[_0x42cb('0x8a')]=function(_0x1485b6,_0x5e86b8,_0x6532b6){return db['CmList'][_0x42cb('0x4a')]({'where':{'id':_0x1485b6[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x5e86b8,null))['then'](function(_0x3988a1){if(_0x3988a1){return _0x3988a1[_0x42cb('0x8a')](_0x1485b6[_0x42cb('0x54')][_0x42cb('0x5d')],_[_0x42cb('0x65')](_0x1485b6[_0x42cb('0x54')],['ids','id'])||{})[_0x42cb('0x8b')](function(_0x3f9c99){for(var _0x3c05c3=0x0;_0x3c05c3<_0x1485b6[_0x42cb('0x54')]['ids']['length'];_0x3c05c3+=0x1){socket[_0x42cb('0x8c')](_0x42cb('0x8d'),{'UserId':_0x1485b6['body'][_0x42cb('0x5d')][_0x3c05c3],'CmListId':_0x1485b6[_0x42cb('0x48')]['id']});}return _0x3f9c99;});}})[_0x42cb('0x27')](respondWithResult(_0x5e86b8,null))[_0x42cb('0x50')](handleError(_0x5e86b8,null));};exports[_0x42cb('0x8e')]=function(_0x466c5a,_0x5b6113,_0x29ec6b){return db[_0x42cb('0x30')][_0x42cb('0x4a')]({'where':{'id':_0x466c5a[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x5b6113,null))[_0x42cb('0x27')](function(_0x24bfe8){if(_0x24bfe8){return _0x24bfe8['removeAgents'](_0x466c5a[_0x42cb('0x36')]['ids'])['then'](function(){if(_[_0x42cb('0x60')](_0x466c5a[_0x42cb('0x36')][_0x42cb('0x5d')])){for(var _0x4e66a2=0x0;_0x4e66a2<_0x466c5a[_0x42cb('0x36')][_0x42cb('0x5d')][_0x42cb('0x49')];_0x4e66a2+=0x1){socket[_0x42cb('0x8c')](_0x42cb('0x8f'),{'UserId':Number(_0x466c5a['query']['ids'][_0x4e66a2]),'CmListId':Number(_0x466c5a[_0x42cb('0x48')]['id'])});}}else{socket[_0x42cb('0x8c')](_0x42cb('0x8f'),{'UserId':Number(_0x466c5a['query']['ids']),'CmListId':Number(_0x466c5a[_0x42cb('0x48')]['id'])});}});}})[_0x42cb('0x27')](respondWithStatusCode(_0x5b6113,null))[_0x42cb('0x50')](handleError(_0x5b6113,null));};exports[_0x42cb('0x90')]=function(_0x580daf,_0x10bd33,_0x5c79dc){var _0xb81b36={};var _0x9650a7={};var _0x1a687d;var _0x35f0de;return db[_0x42cb('0x30')][_0x42cb('0x59')]({'where':{'id':_0x580daf[_0x42cb('0x48')]['id']}})[_0x42cb('0x27')](handleEntityNotFound(_0x10bd33,null))[_0x42cb('0x27')](function(_0x4a05aa){if(_0x4a05aa){_0x1a687d=_0x4a05aa;_0x9650a7[_0x42cb('0x35')]=_[_0x42cb('0x37')](db[_0x42cb('0x91')][_0x42cb('0x31')]);_0x9650a7[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x580daf[_0x42cb('0x36')]);_0x9650a7['filters']=_[_0x42cb('0x38')](_0x9650a7[_0x42cb('0x35')],_0x9650a7['query']);_0xb81b36[_0x42cb('0x3a')]=_['intersection'](_0x9650a7[_0x42cb('0x35')],qs[_0x42cb('0x39')](_0x580daf[_0x42cb('0x36')][_0x42cb('0x39')]));_0xb81b36['attributes']=_0xb81b36['attributes'][_0x42cb('0x49')]?_0xb81b36[_0x42cb('0x3a')]:_0x9650a7[_0x42cb('0x35')];_0xb81b36[_0x42cb('0x5a')]=qs['sort'](_0x580daf[_0x42cb('0x36')]['sort']);_0xb81b36[_0x42cb('0x3e')]=qs[_0x42cb('0x3f')](_['pick'](_0x580daf['query'],_0x9650a7[_0x42cb('0x3f')]));if(_0x580daf[_0x42cb('0x36')][_0x42cb('0x40')]){_0xb81b36[_0x42cb('0x3e')]=_[_0x42cb('0x41')](_0xb81b36[_0x42cb('0x3e')],{'$or':_[_0x42cb('0x2f')](_0xb81b36[_0x42cb('0x3a')],function(_0x585a6e){var _0x115d5e={};_0x115d5e[_0x585a6e]={'$like':'%'+_0x580daf[_0x42cb('0x36')]['filter']+'%'};return _0x115d5e;})});}_0xb81b36=_[_0x42cb('0x41')]({},_0xb81b36,_0x580daf[_0x42cb('0x43')]);return _0x1a687d[_0x42cb('0x90')](_0xb81b36);}})[_0x42cb('0x27')](function(_0x5f4e4e){if(_0x5f4e4e){_0x35f0de=_0x5f4e4e[_0x42cb('0x49')];if(!_0x580daf[_0x42cb('0x36')][_0x42cb('0x3b')](_0x42cb('0x3c'))){_0xb81b36['limit']=qs[_0x42cb('0x20')](_0x580daf[_0x42cb('0x36')][_0x42cb('0x20')]);_0xb81b36['offset']=qs[_0x42cb('0x1f')](_0x580daf[_0x42cb('0x36')][_0x42cb('0x1f')]);}return _0x1a687d[_0x42cb('0x90')](_0xb81b36);}})[_0x42cb('0x27')](function(_0x5430d0){if(_0x5430d0){return _0x5430d0?{'count':_0x35f0de,'rows':_0x5430d0}:null;}})['then'](respondWithResult(_0x10bd33,null))[_0x42cb('0x50')](handleError(_0x10bd33,null));}; \ No newline at end of file +var _0xca15=['count','offset','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','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','describe','addDisposition','ListId','getDispositions','Disposition','limit','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','nolimit','getContactsCsv','raw','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','addCustomField','findOne','sequelize','Sequelize','text','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','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','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json'];(function(_0x39680a,_0x41bae7){var _0x4b9728=function(_0xab23c6){while(--_0xab23c6){_0x39680a['push'](_0x39680a['shift']());}};_0x4b9728(++_0x41bae7);}(_0xca15,0xfc));var _0x5ca1=function(_0x39541d,_0x228c9c){_0x39541d=_0x39541d-0x0;var _0x552696=_0xca15[_0x39541d];return _0x552696;};'use strict';var pdf=require(_0x5ca1('0x0'));var emlformat=require(_0x5ca1('0x1'));var rimraf=require(_0x5ca1('0x2'));var zipdir=require(_0x5ca1('0x3'));var jsonpatch=require(_0x5ca1('0x4'));var rp=require(_0x5ca1('0x5'));var moment=require(_0x5ca1('0x6'));var BPromise=require(_0x5ca1('0x7'));var Mustache=require(_0x5ca1('0x8'));var util=require(_0x5ca1('0x9'));var path=require(_0x5ca1('0xa'));var sox=require(_0x5ca1('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ca1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5ca1('0xd'));var toCsv=require(_0x5ca1('0xe'));var querystring=require(_0x5ca1('0xf'));var Papa=require(_0x5ca1('0x10'));var Redis=require(_0x5ca1('0x11'));var authService=require(_0x5ca1('0x12'));var qs=require(_0x5ca1('0x13'));var as=require(_0x5ca1('0x14'));var hardwareService=require(_0x5ca1('0x15'));var logger=require(_0x5ca1('0x16'))(_0x5ca1('0x17'));var utils=require(_0x5ca1('0x18'));var config=require(_0x5ca1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5ca1('0x1a')]=_[_0x5ca1('0x1b')](config[_0x5ca1('0x1a')],{'host':_0x5ca1('0x1c'),'port':0x18eb});var socket=require(_0x5ca1('0x1d'))(new Redis(config[_0x5ca1('0x1a')]));require(_0x5ca1('0x1e'))['register'](socket);function respondWithStatusCode(_0x489df0,_0xd441f2){_0xd441f2=_0xd441f2||0xcc;return function(_0x28595e){if(_0x28595e){return _0x489df0[_0x5ca1('0x1f')](_0xd441f2);}return _0x489df0[_0x5ca1('0x20')](_0xd441f2)['end']();};}function respondWithResult(_0x3ce37b,_0x27c4d1){_0x27c4d1=_0x27c4d1||0xc8;return function(_0x42d98f){if(_0x42d98f){return _0x3ce37b['status'](_0x27c4d1)[_0x5ca1('0x21')](_0x42d98f);}};}function respondWithFilteredResult(_0x34e5fc,_0xb4b692){return function(_0x234139){if(_0x234139){var _0x13b3b1=_0x234139[_0x5ca1('0x22')],_0x2617ca=_0xb4b692[_0x5ca1('0x23')],_0x2fbf92=_0xb4b692[_0x5ca1('0x23')]+_0xb4b692['limit'],_0x335311;if(_0x2fbf92>=_0x13b3b1){_0x2fbf92=_0x13b3b1;_0x335311=0xc8;}else{_0x335311=0xce;}_0x34e5fc[_0x5ca1('0x20')](_0x335311);return _0x34e5fc['set']('Content-Range',_0x2617ca+'-'+_0x2fbf92+'/'+_0x13b3b1)['json'](_0x234139);}return null;};}function patchUpdates(_0x3a7596){return function(_0x567811){try{jsonpatch[_0x5ca1('0x24')](_0x567811,_0x3a7596,!![]);}catch(_0x272365){return BPromise[_0x5ca1('0x25')](_0x272365);}return _0x567811[_0x5ca1('0x26')]();};}function saveUpdates(_0x11149b,_0x49ac8b){return function(_0x477fb4){if(_0x477fb4){return _0x477fb4[_0x5ca1('0x27')](_0x11149b)[_0x5ca1('0x28')](function(_0xaf9f0e){return _0xaf9f0e;});}return null;};}function removeEntity(_0x2e2690,_0x805ed2){return function(_0x51df69){if(_0x51df69){return _0x51df69[_0x5ca1('0x29')]()[_0x5ca1('0x28')](function(){var _0x1a7e17=_0x51df69[_0x5ca1('0x2a')]({'plain':!![]});var _0x36770f=_0x5ca1('0x2b');return db[_0x5ca1('0x2c')][_0x5ca1('0x29')]({'where':{'type':_0x36770f,'resourceId':_0x1a7e17['id']}})[_0x5ca1('0x28')](function(){return _0x51df69;});})['then'](function(){_0x2e2690[_0x5ca1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265c2c,_0x2dcf64){return function(_0x3d69dc){if(!_0x3d69dc){_0x265c2c['sendStatus'](0x194);}return _0x3d69dc;};}function handleError(_0x1e9e0a,_0x163d6e){_0x163d6e=_0x163d6e||0x1f4;return function(_0x51fa8c){logger[_0x5ca1('0x2d')](_0x51fa8c[_0x5ca1('0x2e')]);if(_0x51fa8c[_0x5ca1('0x2f')]){delete _0x51fa8c[_0x5ca1('0x2f')];}_0x1e9e0a[_0x5ca1('0x20')](_0x163d6e)[_0x5ca1('0x30')](_0x51fa8c);};}exports['index']=function(_0x472c64,_0x50bad4){var _0x5cd0d4={},_0xc628d1={},_0x58463c={'count':0x0,'rows':[]};var _0x392080=_[_0x5ca1('0x31')](db[_0x5ca1('0x32')][_0x5ca1('0x33')],function(_0x57fdc2){return{'name':_0x57fdc2[_0x5ca1('0x34')],'type':_0x57fdc2['type'][_0x5ca1('0x35')]};});_0xc628d1[_0x5ca1('0x36')]=_[_0x5ca1('0x31')](_0x392080,_0x5ca1('0x2f'));_0xc628d1['query']=_[_0x5ca1('0x37')](_0x472c64[_0x5ca1('0x38')]);_0xc628d1[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0xc628d1[_0x5ca1('0x36')],_0xc628d1[_0x5ca1('0x38')]);_0x5cd0d4[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0xc628d1[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x5cd0d4['attributes']=_0x5cd0d4[_0x5ca1('0x3b')]['length']?_0x5cd0d4[_0x5ca1('0x3b')]:_0xc628d1[_0x5ca1('0x36')];if(!_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x3d')]('nolimit')){_0x5cd0d4['limit']=qs['limit'](_0x472c64['query']['limit']);_0x5cd0d4['offset']=qs[_0x5ca1('0x23')](_0x472c64['query'][_0x5ca1('0x23')]);}_0x5cd0d4[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x5cd0d4[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x472c64[_0x5ca1('0x38')],_0xc628d1[_0x5ca1('0x39')]),_0x392080);if(_0x472c64[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x5cd0d4[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x5cd0d4['where'],{'$or':_[_0x5ca1('0x31')](_0x392080,function(_0x4440bc){if(_0x4440bc[_0x5ca1('0x44')]!==_0x5ca1('0x45')){var _0xfabfc0={};_0xfabfc0[_0x4440bc[_0x5ca1('0x2f')]]={'$like':'%'+_0x472c64['query'][_0x5ca1('0x42')]+'%'};return _0xfabfc0;}})});}_0x5cd0d4=_['merge']({},_0x5cd0d4,_0x472c64[_0x5ca1('0x46')]);var _0x3158e9={'where':_0x5cd0d4[_0x5ca1('0x40')]};return db[_0x5ca1('0x32')][_0x5ca1('0x22')](_0x3158e9)[_0x5ca1('0x28')](function(_0x16d804){_0x58463c[_0x5ca1('0x22')]=_0x16d804;if(_0x472c64['query'][_0x5ca1('0x47')]){_0x5cd0d4['include']=[{'all':!![]}];}return db[_0x5ca1('0x32')][_0x5ca1('0x48')](_0x5cd0d4);})['then'](function(_0x5390a4){_0x58463c[_0x5ca1('0x49')]=_0x5390a4;return _0x58463c;})['then'](respondWithFilteredResult(_0x50bad4,_0x5cd0d4))[_0x5ca1('0x4a')](handleError(_0x50bad4,null));};exports[_0x5ca1('0x4b')]=function(_0x116b57,_0x348ebd){var _0x271b9a={'raw':![],'where':{'id':_0x116b57[_0x5ca1('0x4c')]['id']}},_0x280af0={};_0x280af0[_0x5ca1('0x36')]=_[_0x5ca1('0x37')](db['CmList'][_0x5ca1('0x33')]);_0x280af0[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x116b57['query']);_0x280af0[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x280af0['model'],_0x280af0[_0x5ca1('0x38')]);_0x271b9a['attributes']=_[_0x5ca1('0x3a')](_0x280af0[_0x5ca1('0x36')],qs['fields'](_0x116b57[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x271b9a[_0x5ca1('0x3b')]=_0x271b9a[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x271b9a[_0x5ca1('0x3b')]:_0x280af0[_0x5ca1('0x36')];if(_0x116b57[_0x5ca1('0x38')][_0x5ca1('0x47')]){_0x271b9a[_0x5ca1('0x4e')]=[{'all':!![]}];}_0x271b9a=_[_0x5ca1('0x43')]({},_0x271b9a,_0x116b57[_0x5ca1('0x46')]);return db['CmList'][_0x5ca1('0x4f')](_0x271b9a)[_0x5ca1('0x28')](handleEntityNotFound(_0x348ebd,null))[_0x5ca1('0x28')](respondWithResult(_0x348ebd,null))[_0x5ca1('0x4a')](handleError(_0x348ebd,null));};exports[_0x5ca1('0x50')]=function(_0x300a0f,_0x78b519){return db[_0x5ca1('0x32')][_0x5ca1('0x50')](_0x300a0f[_0x5ca1('0x51')],{})[_0x5ca1('0x28')](function(_0x5dec2d){var _0x5c6a0b=_0x300a0f[_0x5ca1('0x52')][_0x5ca1('0x2a')]({'plain':!![]});if(!_0x5c6a0b)throw new Error(_0x5ca1('0x53'));if(_0x5c6a0b[_0x5ca1('0x54')]===_0x5ca1('0x52')){var _0x48c475=_0x5dec2d[_0x5ca1('0x2a')]({'plain':!![]});var _0x3d4830=_0x5ca1('0x2b');return db[_0x5ca1('0x55')][_0x5ca1('0x4f')]({'where':{'name':_0x3d4830,'userProfileId':_0x5c6a0b[_0x5ca1('0x56')]},'raw':!![]})[_0x5ca1('0x28')](function(_0x14ee73){if(_0x14ee73&&_0x14ee73[_0x5ca1('0x57')]===0x0){return db[_0x5ca1('0x2c')][_0x5ca1('0x50')]({'name':_0x48c475['name'],'resourceId':_0x48c475['id'],'type':_0x14ee73[_0x5ca1('0x2f')],'sectionId':_0x14ee73['id']},{})[_0x5ca1('0x28')](function(){return _0x5dec2d;});}else{return _0x5dec2d;}})[_0x5ca1('0x4a')](function(_0x4b9673){logger[_0x5ca1('0x2d')](_0x5ca1('0x58'),_0x4b9673);throw _0x4b9673;});}return _0x5dec2d;})[_0x5ca1('0x28')](respondWithResult(_0x78b519,0xc9))['catch'](handleError(_0x78b519,null));};exports['update']=function(_0x3040b8,_0x21a671){if(_0x3040b8[_0x5ca1('0x51')]['id']){delete _0x3040b8[_0x5ca1('0x51')]['id'];}return db['CmList'][_0x5ca1('0x4f')]({'where':{'id':_0x3040b8[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x21a671,null))['then'](saveUpdates(_0x3040b8['body'],null))['then'](respondWithResult(_0x21a671,null))[_0x5ca1('0x4a')](handleError(_0x21a671,null));};exports['destroy']=function(_0x24acd8,_0x23d72d){return db['CmList'][_0x5ca1('0x4f')]({'where':{'id':_0x24acd8[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x23d72d,null))['then'](removeEntity(_0x23d72d,null))[_0x5ca1('0x4a')](handleError(_0x23d72d,null));};exports[_0x5ca1('0x59')]=function(_0x640ba,_0x26a63e){return db[_0x5ca1('0x32')][_0x5ca1('0x59')]()[_0x5ca1('0x28')](respondWithResult(_0x26a63e,null))[_0x5ca1('0x4a')](handleError(_0x26a63e,null));};exports[_0x5ca1('0x5a')]=function(_0x306916,_0x4ca70e,_0x1d48e1){if(_0x306916[_0x5ca1('0x51')]['id']){delete _0x306916[_0x5ca1('0x51')]['id'];}return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x306916[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x4ca70e,null))['then'](function(_0xbf302e){if(_0xbf302e){_0x306916['body'][_0x5ca1('0x5b')]=_0xbf302e['id'];return db['Disposition'][_0x5ca1('0x50')](_0x306916[_0x5ca1('0x51')]);}})[_0x5ca1('0x28')](respondWithResult(_0x4ca70e,null))[_0x5ca1('0x4a')](handleError(_0x4ca70e,null));};exports[_0x5ca1('0x5c')]=function(_0x3882ab,_0x579707,_0x2b9561){var _0x50c83e={'raw':![],'where':{}};var _0x2ca16e={};var _0x49959e={'count':0x0,'rows':[]};return db[_0x5ca1('0x32')]['findOne']({'where':{'id':_0x3882ab[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x579707,null))[_0x5ca1('0x28')](function(_0x1b05d1){if(_0x1b05d1){_0x2ca16e[_0x5ca1('0x36')]=_[_0x5ca1('0x37')](db[_0x5ca1('0x5d')]['rawAttributes']);_0x2ca16e[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x3882ab[_0x5ca1('0x38')]);_0x2ca16e[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x2ca16e['model'],_0x2ca16e[_0x5ca1('0x38')]);_0x50c83e[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x2ca16e[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x50c83e[_0x5ca1('0x3b')]=_0x50c83e[_0x5ca1('0x3b')]['length']?_0x50c83e[_0x5ca1('0x3b')]:_0x2ca16e['model'];if(!_0x3882ab['query'][_0x5ca1('0x3d')]('nolimit')){_0x50c83e[_0x5ca1('0x5e')]=qs['limit'](_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x5e')]);_0x50c83e[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x3882ab['query'][_0x5ca1('0x23')]);}_0x50c83e[_0x5ca1('0x3e')]=qs['sort'](_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x50c83e[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x3882ab[_0x5ca1('0x38')],_0x2ca16e['filters']));_0x50c83e[_0x5ca1('0x40')][_0x5ca1('0x5b')]=_0x1b05d1['id'];if(_0x3882ab[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x50c83e[_0x5ca1('0x40')]=_['merge'](_0x50c83e[_0x5ca1('0x40')],{'$or':_[_0x5ca1('0x31')](_0x50c83e[_0x5ca1('0x3b')],function(_0x4392e9){var _0x20268f={};_0x20268f[_0x4392e9]={'$like':'%'+_0x3882ab['query'][_0x5ca1('0x42')]+'%'};return _0x20268f;})});}_0x50c83e=_['merge']({},_0x50c83e,_0x3882ab[_0x5ca1('0x46')]);return db[_0x5ca1('0x5d')]['count']({'where':_0x50c83e[_0x5ca1('0x40')]})['then'](function(_0x4b7512){_0x49959e['count']=_0x4b7512;if(_0x3882ab[_0x5ca1('0x38')]['includeAll']){_0x50c83e[_0x5ca1('0x4e')]=[{'all':!![]}];}return db[_0x5ca1('0x5d')][_0x5ca1('0x48')](_0x50c83e);})[_0x5ca1('0x28')](function(_0x24545b){_0x49959e['rows']=_0x24545b;return _0x49959e;});}})[_0x5ca1('0x28')](respondWithFilteredResult(_0x579707,_0x50c83e))[_0x5ca1('0x4a')](handleError(_0x579707,null));};exports[_0x5ca1('0x5f')]=function(_0xb9f431,_0x16f3bf,_0x23592d){return db['CmList']['find']({'where':{'id':_0xb9f431[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x16f3bf,null))['then'](function(_0x43e627){if(_0x43e627){return _0x43e627[_0x5ca1('0x5f')](_0xb9f431[_0x5ca1('0x38')][_0x5ca1('0x60')]);}})['then'](respondWithStatusCode(_0x16f3bf,null))[_0x5ca1('0x4a')](handleError(_0x16f3bf,null));};exports['addContacts']=function(_0x50ce81,_0x534c8a,_0x3de825){return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x50ce81[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x534c8a,null))[_0x5ca1('0x28')](function(_0x644a04){if(_0x644a04){var _0xa518c1=[];var _0x1ef28e={'success':[],'errors':[]};return db[_0x5ca1('0x61')]['describe']()['then'](function(_0x56170d){if(_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]&&_[_0x5ca1('0x63')](_0x50ce81[_0x5ca1('0x51')]['tags'])){if(_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')][_0x5ca1('0x4d')]){_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]=_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')][_0x5ca1('0x64')](';')+';';}else{_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]=null;}}else{_0x50ce81[_0x5ca1('0x51')][_0x5ca1('0x62')]=null;}if(_0x50ce81['body']&&_[_0x5ca1('0x63')](_0x50ce81[_0x5ca1('0x51')])){for(var _0x2696d8=0x0;_0x2696d8<_0x50ce81['body'][_0x5ca1('0x4d')];_0x2696d8+=0x1){_0x50ce81['body'][_0x2696d8]['ListId']=_0x50ce81[_0x5ca1('0x4c')]['id'];_0xa518c1[_0x5ca1('0x65')](_0x50ce81[_0x5ca1('0x51')][_0x2696d8]);}return BPromise[_0x5ca1('0x66')](_0xa518c1,function(_0x49112e){return db[_0x5ca1('0x61')]['create'](_[_0x5ca1('0x67')](_0x49112e,['ids','id'])||{},{'fields':_[_0x5ca1('0x37')](_0x56170d),'raw':!![]})[_0x5ca1('0x28')](function(_0x48393d){_0x1ef28e['success'][_0x5ca1('0x65')](_0x48393d['dataValues']);})['catch'](function(_0x5a98cc){_0x1ef28e[_0x5ca1('0x68')][_0x5ca1('0x65')]({'data':_0x49112e,'error':_0x5a98cc[_0x5ca1('0x69')]});});})[_0x5ca1('0x28')](function(_0x38b713){return _0x1ef28e;})[_0x5ca1('0x4a')](function(_0x1481a6){return _0x1481a6;});}else{_0x534c8a[_0x5ca1('0x20')](0x190)[_0x5ca1('0x21')]({'message':_0x5ca1('0x6a')});}});}})[_0x5ca1('0x28')](respondWithResult(_0x534c8a,null))[_0x5ca1('0x4a')](handleError(_0x534c8a,null));};exports[_0x5ca1('0x6b')]=function(_0x129c15,_0x4506f0,_0x1e7087){var _0x3d10e2;return db[_0x5ca1('0x32')]['find']({'where':{'id':_0x129c15['params']['id']},'include':[{'model':db[_0x5ca1('0x6c')],'as':_0x5ca1('0x6d')}]})[_0x5ca1('0x28')](handleEntityNotFound(_0x4506f0,null))[_0x5ca1('0x28')](function(_0x50294a){if(_0x50294a){_0x3d10e2=_0x50294a;return db[_0x5ca1('0x61')][_0x5ca1('0x33')];}})[_0x5ca1('0x28')](function(_0x214271){if(_0x214271){var _0x293617={};var _0x5d9a90={};_0x5d9a90[_0x5ca1('0x36')]=_[_0x5ca1('0x6e')](_[_0x5ca1('0x37')](_0x214271),_[_0x5ca1('0x31')](_0x3d10e2[_0x5ca1('0x6d')],function(_0x534809){return util['format'](_0x5ca1('0x6f'),_0x534809['id']);}));_0x5d9a90['query']=_[_0x5ca1('0x37')](_0x129c15[_0x5ca1('0x38')]);_0x5d9a90[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x5d9a90[_0x5ca1('0x36')],_0x5d9a90['query']);_0x293617[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x5d9a90[_0x5ca1('0x36')],qs['fields'](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x293617[_0x5ca1('0x3b')]=_0x293617[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x293617['attributes']:_0x5d9a90[_0x5ca1('0x36')];if(!_0x129c15[_0x5ca1('0x38')]['hasOwnProperty'](_0x5ca1('0x70'))){_0x293617[_0x5ca1('0x5e')]=qs[_0x5ca1('0x5e')](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x5e')]);_0x293617[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x23')]);}_0x293617[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x293617[_0x5ca1('0x40')]=qs['filters'](_[_0x5ca1('0x41')](_0x129c15['query'],_0x5d9a90[_0x5ca1('0x39')]));_0x293617['raw']=!![];if(_0x129c15[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x293617[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x293617['where'],{'$or':_[_0x5ca1('0x31')](_0x293617[_0x5ca1('0x3b')],function(_0x2349cc){var _0x2e9180={};_0x2e9180[_0x2349cc]={'$like':'%'+_0x129c15['query'][_0x5ca1('0x42')]+'%'};return _0x2e9180;})});}_0x293617=_[_0x5ca1('0x43')]({},_0x293617,_0x129c15[_0x5ca1('0x46')]);return _0x3d10e2['getContacts'](_0x293617);}})[_0x5ca1('0x28')](respondWithResult(_0x4506f0,null))['catch'](handleError(_0x4506f0,null));};exports[_0x5ca1('0x71')]=function(_0x5405e5,_0x56e616,_0x535a53){var _0x51affc;return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x5405e5[_0x5ca1('0x4c')]['id']},'include':[{'model':db[_0x5ca1('0x6c')],'as':_0x5ca1('0x6d')}]})[_0x5ca1('0x28')](handleEntityNotFound(_0x56e616,null))['then'](function(_0x2e1acd){if(_0x2e1acd){_0x51affc=_0x2e1acd;return db[_0x5ca1('0x61')][_0x5ca1('0x33')];}})[_0x5ca1('0x28')](function(_0x285afe){if(_0x285afe){var _0x42f05b={};var _0x5adf51={};_0x5adf51[_0x5ca1('0x36')]=_[_0x5ca1('0x6e')](_[_0x5ca1('0x37')](_0x285afe),_[_0x5ca1('0x31')](_0x51affc[_0x5ca1('0x6d')],function(_0x2966dc){return util['format'](_0x5ca1('0x6f'),_0x2966dc['id']);}));_0x5adf51[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x5405e5['query']);_0x5adf51['filters']=_[_0x5ca1('0x3a')](_0x5adf51['model'],_0x5adf51[_0x5ca1('0x38')]);_0x42f05b[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x5adf51[_0x5ca1('0x36')],qs['fields'](_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x3c')]));_0x42f05b['attributes']=_0x42f05b[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x42f05b[_0x5ca1('0x3b')]:_0x5adf51[_0x5ca1('0x36')];if(!_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x3d')]('nolimit')){_0x42f05b[_0x5ca1('0x5e')]=qs[_0x5ca1('0x5e')](_0x5405e5['query'][_0x5ca1('0x5e')]);_0x42f05b[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x5405e5[_0x5ca1('0x38')]['offset']);}_0x42f05b[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x3f')]);_0x42f05b[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x5405e5[_0x5ca1('0x38')],_0x5adf51[_0x5ca1('0x39')]));_0x42f05b[_0x5ca1('0x72')]=!![];if(_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x42f05b['where']=_[_0x5ca1('0x43')](_0x42f05b['where'],{'$or':_['map'](_0x42f05b['attributes'],function(_0x316661){var _0x328ffc={};_0x328ffc[_0x316661]={'$like':'%'+_0x5405e5[_0x5ca1('0x38')][_0x5ca1('0x42')]+'%'};return _0x328ffc;})});}_0x42f05b=_[_0x5ca1('0x43')]({},_0x42f05b,_0x5405e5[_0x5ca1('0x46')]);return _0x51affc[_0x5ca1('0x6b')](_0x42f05b);}})['then'](function(_0x54eb8b){if(!_['isEmpty'](_0x54eb8b)){var _0x5e1229=toCsv(_0x54eb8b);var _0x1fbfcf=Date[_0x5ca1('0x73')]();fs[_0x5ca1('0x74')](util['format'](_0x5ca1('0x75'),_0x51affc['id'],_0x1fbfcf),_0x5e1229);_0x56e616[_0x5ca1('0x76')](_0x5ca1('0x77'),'attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x51affc['id'],_0x1fbfcf));_0x56e616[_0x5ca1('0x76')](_0x5ca1('0x78'),_0x5ca1('0x79'));return _0x56e616['download'](util['format'](_0x5ca1('0x75'),_0x51affc['id'],_0x1fbfcf));}else{return _0x56e616[_0x5ca1('0x1f')](0xcc);}})[_0x5ca1('0x4a')](handleError(_0x56e616,null));};exports[_0x5ca1('0x7a')]=function(_0x2af88f,_0x5586c2,_0x2b9b4b){var _0x529333;delete _0x2af88f[_0x5ca1('0x51')]['id'];return db[_0x5ca1('0x32')][_0x5ca1('0x7b')]({'where':{'id':_0x2af88f[_0x5ca1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5586c2,null))[_0x5ca1('0x28')](function(_0x1a2b30){if(_0x1a2b30){return db[_0x5ca1('0x7c')]['transaction'](function(_0x2af364){return db[_0x5ca1('0x6c')][_0x5ca1('0x50')](_0x2af88f['body'],{'transaction':_0x2af364})['then'](function(_0x50bdf2){_0x529333=_0x50bdf2;return _0x1a2b30['addCustomFields'](_0x50bdf2,{'transaction':_0x2af364});})[_0x5ca1('0x28')](function(){var _0x158c47={'type':db[_0x5ca1('0x7d')]['TEXT'],'transaction':_0x2af364};switch(_0x2af88f[_0x5ca1('0x51')][_0x5ca1('0x44')]){case _0x5ca1('0x7e'):_0x158c47[_0x5ca1('0x44')]=db['Sequelize']['TEXT'];break;case'number':_0x158c47[_0x5ca1('0x44')]=db[_0x5ca1('0x7d')]['INTEGER'];break;case _0x5ca1('0x7f'):_0x158c47[_0x5ca1('0x44')]=db['Sequelize']['BOOLEAN'];_0x158c47[_0x5ca1('0x80')]=![];break;default:}return db[_0x5ca1('0x7c')][_0x5ca1('0x81')][_0x5ca1('0x82')](_0x5ca1('0x83'),util[_0x5ca1('0x84')](_0x5ca1('0x85'),_0x529333['id']),_0x158c47);})[_0x5ca1('0x28')](function(){return _0x529333;});});}})[_0x5ca1('0x28')](respondWithResult(_0x5586c2,null))[_0x5ca1('0x4a')](handleError(_0x5586c2,null));};exports[_0x5ca1('0x86')]=function(_0x25d9b9,_0x53079f,_0x4b1c7e){var _0x3a5cd4={};var _0x2e73d6={};var _0x24d597;var _0x5bea58;return db[_0x5ca1('0x32')]['findOne']({'where':{'id':_0x25d9b9[_0x5ca1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53079f,null))[_0x5ca1('0x28')](function(_0x4be11e){if(_0x4be11e){_0x24d597=_0x4be11e;_0x2e73d6[_0x5ca1('0x36')]=_['keys'](db[_0x5ca1('0x6c')][_0x5ca1('0x33')]);_0x2e73d6[_0x5ca1('0x38')]=_[_0x5ca1('0x37')](_0x25d9b9[_0x5ca1('0x38')]);_0x2e73d6[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x2e73d6[_0x5ca1('0x36')],_0x2e73d6['query']);_0x3a5cd4['attributes']=_['intersection'](_0x2e73d6[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x25d9b9['query']['fields']));_0x3a5cd4[_0x5ca1('0x3b')]=_0x3a5cd4[_0x5ca1('0x3b')][_0x5ca1('0x4d')]?_0x3a5cd4[_0x5ca1('0x3b')]:_0x2e73d6['model'];_0x3a5cd4['order']=qs[_0x5ca1('0x3f')](_0x25d9b9['query']['sort']);_0x3a5cd4[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_[_0x5ca1('0x41')](_0x25d9b9['query'],_0x2e73d6[_0x5ca1('0x39')]));_0x3a5cd4[_0x5ca1('0x40')]=_['merge'](_0x3a5cd4[_0x5ca1('0x40')],{'$or':[{'ListId':_0x4be11e['id']},{'ListId':null}]});if(_0x25d9b9[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x3a5cd4[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x3a5cd4[_0x5ca1('0x40')],{'$or':_[_0x5ca1('0x31')](_0x3a5cd4[_0x5ca1('0x3b')],function(_0x4c26e2){var _0x3fa8e2={};_0x3fa8e2[_0x4c26e2]={'$like':'%'+_0x25d9b9[_0x5ca1('0x38')][_0x5ca1('0x42')]+'%'};return _0x3fa8e2;})});}_0x3a5cd4=_['merge']({},_0x3a5cd4,_0x25d9b9[_0x5ca1('0x46')]);return db[_0x5ca1('0x6c')][_0x5ca1('0x87')](_0x3a5cd4);}})[_0x5ca1('0x28')](respondWithResult(_0x53079f,null))[_0x5ca1('0x4a')](handleError(_0x53079f,null));};exports[_0x5ca1('0x88')]=function(_0x4104a2,_0x3ac688,_0x447d19){return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x4104a2[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x3ac688,null))[_0x5ca1('0x28')](function(_0x327140){if(_0x327140){return _0x327140[_0x5ca1('0x88')](_0x4104a2[_0x5ca1('0x51')][_0x5ca1('0x60')],_['omit'](_0x4104a2[_0x5ca1('0x51')],[_0x5ca1('0x60'),'id'])||{})['spread'](function(_0x43b658){for(var _0xb6d35f=0x0;_0xb6d35f<_0x4104a2[_0x5ca1('0x51')][_0x5ca1('0x60')][_0x5ca1('0x4d')];_0xb6d35f+=0x1){socket[_0x5ca1('0x89')](_0x5ca1('0x8a'),{'UserId':_0x4104a2['body']['ids'][_0xb6d35f],'CmListId':_0x4104a2[_0x5ca1('0x4c')]['id']});}return _0x43b658;});}})[_0x5ca1('0x28')](respondWithResult(_0x3ac688,null))[_0x5ca1('0x4a')](handleError(_0x3ac688,null));};exports[_0x5ca1('0x8b')]=function(_0x27fe4a,_0x277661,_0x487f9c){return db[_0x5ca1('0x32')][_0x5ca1('0x4f')]({'where':{'id':_0x27fe4a[_0x5ca1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x277661,null))[_0x5ca1('0x28')](function(_0x219173){if(_0x219173){return _0x219173[_0x5ca1('0x8b')](_0x27fe4a[_0x5ca1('0x38')][_0x5ca1('0x60')])[_0x5ca1('0x28')](function(){if(_[_0x5ca1('0x63')](_0x27fe4a['query'][_0x5ca1('0x60')])){for(var _0x2df32d=0x0;_0x2df32d<_0x27fe4a[_0x5ca1('0x38')][_0x5ca1('0x60')][_0x5ca1('0x4d')];_0x2df32d+=0x1){socket[_0x5ca1('0x89')](_0x5ca1('0x8c'),{'UserId':Number(_0x27fe4a[_0x5ca1('0x38')][_0x5ca1('0x60')][_0x2df32d]),'CmListId':Number(_0x27fe4a[_0x5ca1('0x4c')]['id'])});}}else{socket[_0x5ca1('0x89')](_0x5ca1('0x8c'),{'UserId':Number(_0x27fe4a['query']['ids']),'CmListId':Number(_0x27fe4a[_0x5ca1('0x4c')]['id'])});}});}})[_0x5ca1('0x28')](respondWithStatusCode(_0x277661,null))[_0x5ca1('0x4a')](handleError(_0x277661,null));};exports[_0x5ca1('0x8d')]=function(_0x3bbcf9,_0x350448,_0x5d2204){var _0x50c643={};var _0x1704eb={};var _0x50f092;var _0x257cc0;return db[_0x5ca1('0x32')]['findOne']({'where':{'id':_0x3bbcf9[_0x5ca1('0x4c')]['id']}})[_0x5ca1('0x28')](handleEntityNotFound(_0x350448,null))[_0x5ca1('0x28')](function(_0x3406d6){if(_0x3406d6){_0x50f092=_0x3406d6;_0x1704eb['model']=_[_0x5ca1('0x37')](db[_0x5ca1('0x8e')][_0x5ca1('0x33')]);_0x1704eb['query']=_[_0x5ca1('0x37')](_0x3bbcf9['query']);_0x1704eb[_0x5ca1('0x39')]=_[_0x5ca1('0x3a')](_0x1704eb[_0x5ca1('0x36')],_0x1704eb[_0x5ca1('0x38')]);_0x50c643[_0x5ca1('0x3b')]=_[_0x5ca1('0x3a')](_0x1704eb[_0x5ca1('0x36')],qs[_0x5ca1('0x3c')](_0x3bbcf9[_0x5ca1('0x38')]['fields']));_0x50c643[_0x5ca1('0x3b')]=_0x50c643[_0x5ca1('0x3b')]['length']?_0x50c643[_0x5ca1('0x3b')]:_0x1704eb[_0x5ca1('0x36')];_0x50c643[_0x5ca1('0x3e')]=qs[_0x5ca1('0x3f')](_0x3bbcf9[_0x5ca1('0x38')]['sort']);_0x50c643[_0x5ca1('0x40')]=qs[_0x5ca1('0x39')](_['pick'](_0x3bbcf9[_0x5ca1('0x38')],_0x1704eb[_0x5ca1('0x39')]));if(_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x42')]){_0x50c643[_0x5ca1('0x40')]=_[_0x5ca1('0x43')](_0x50c643[_0x5ca1('0x40')],{'$or':_['map'](_0x50c643['attributes'],function(_0x49f7da){var _0x43f2e5={};_0x43f2e5[_0x49f7da]={'$like':'%'+_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x42')]+'%'};return _0x43f2e5;})});}_0x50c643=_[_0x5ca1('0x43')]({},_0x50c643,_0x3bbcf9['options']);return _0x50f092[_0x5ca1('0x8d')](_0x50c643);}})['then'](function(_0x3632bd){if(_0x3632bd){_0x257cc0=_0x3632bd['length'];if(!_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x3d')](_0x5ca1('0x70'))){_0x50c643[_0x5ca1('0x5e')]=qs[_0x5ca1('0x5e')](_0x3bbcf9[_0x5ca1('0x38')]['limit']);_0x50c643[_0x5ca1('0x23')]=qs[_0x5ca1('0x23')](_0x3bbcf9[_0x5ca1('0x38')][_0x5ca1('0x23')]);}return _0x50f092[_0x5ca1('0x8d')](_0x50c643);}})[_0x5ca1('0x28')](function(_0x2012ec){if(_0x2012ec){return _0x2012ec?{'count':_0x257cc0,'rows':_0x2012ec}:null;}})[_0x5ca1('0x28')](respondWithResult(_0x350448,null))['catch'](handleError(_0x350448,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e69388a..78f4844 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 _0x1d98=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x2408c3,_0x117956){var _0x1898d7=function(_0x3ba375){while(--_0x3ba375){_0x2408c3['push'](_0x2408c3['shift']());}};_0x1898d7(++_0x117956);}(_0x1d98,0x1aa));var _0x81d9=function(_0x5c7290,_0x56b55f){_0x5c7290=_0x5c7290-0x0;var _0x132e60=_0x1d98[_0x5c7290];return _0x132e60;};'use strict';var EventEmitter=require(_0x81d9('0x0'));var CmList=require(_0x81d9('0x1'))['db'][_0x81d9('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x81d9('0x3')](0x0);var events={'afterCreate':_0x81d9('0x4'),'afterUpdate':_0x81d9('0x5'),'afterDestroy':_0x81d9('0x6')};function emitEvent(_0x375a1d){return function(_0x15b03f,_0x4c39a1,_0x19d2f0){CmListEvents[_0x81d9('0x7')](_0x375a1d+':'+_0x15b03f['id'],_0x15b03f);CmListEvents[_0x81d9('0x7')](_0x375a1d,_0x15b03f);_0x19d2f0(null);};}for(var e in events){if(events[_0x81d9('0x8')](e)){var event=events[e];CmList[_0x81d9('0x9')](e,emitEvent(event));}}module[_0x81d9('0xa')]=CmListEvents; \ No newline at end of file +var _0x6ce9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners'];(function(_0x502a5e,_0x487f85){var _0x45e6c0=function(_0x1dd44f){while(--_0x1dd44f){_0x502a5e['push'](_0x502a5e['shift']());}};_0x45e6c0(++_0x487f85);}(_0x6ce9,0x9d));var _0x96ce=function(_0x27fbde,_0x3e5956){_0x27fbde=_0x27fbde-0x0;var _0x884c53=_0x6ce9[_0x27fbde];return _0x884c53;};'use strict';var EventEmitter=require(_0x96ce('0x0'));var CmList=require('../../mysqldb')['db'][_0x96ce('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x96ce('0x2')](0x0);var events={'afterCreate':_0x96ce('0x3'),'afterUpdate':_0x96ce('0x4'),'afterDestroy':_0x96ce('0x5')};function emitEvent(_0x27391e){return function(_0x1d34e1,_0x41d698,_0x451ba1){CmListEvents[_0x96ce('0x6')](_0x27391e+':'+_0x1d34e1['id'],_0x1d34e1);CmListEvents[_0x96ce('0x6')](_0x27391e,_0x1d34e1);_0x451ba1(null);};}for(var e in events){if(events[_0x96ce('0x7')](e)){var event=events[e];CmList[_0x96ce('0x8')](e,emitEvent(event));}}module[_0x96ce('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5a2ff34..ed791ea 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 _0x9b3e=['path','rimraf','../../config/environment','./cmList.attributes','define','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5798fe,_0x4a0598){var _0x1b6e9d=function(_0x377eeb){while(--_0x377eeb){_0x5798fe['push'](_0x5798fe['shift']());}};_0x1b6e9d(++_0x4a0598);}(_0x9b3e,0x96));var _0xe9b3=function(_0x430f98,_0x93424f){_0x430f98=_0x430f98-0x0;var _0x13ccf7=_0x9b3e[_0x430f98];return _0x13ccf7;};'use strict';var _=require(_0xe9b3('0x0'));var util=require(_0xe9b3('0x1'));var logger=require(_0xe9b3('0x2'))(_0xe9b3('0x3'));var moment=require('moment');var BPromise=require(_0xe9b3('0x4'));var rp=require(_0xe9b3('0x5'));var fs=require('fs');var path=require(_0xe9b3('0x6'));var rimraf=require(_0xe9b3('0x7'));var config=require(_0xe9b3('0x8'));var attributes=require(_0xe9b3('0x9'));module['exports']=function(_0x1120d0,_0x4c7699){return _0x1120d0[_0xe9b3('0xa')]('CmList',attributes,{'tableName':_0xe9b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf955=['./cmList.attributes','cm_lists','lodash','api','bluebird','rimraf'];(function(_0x1de234,_0x5394e5){var _0x3796a5=function(_0x24294e){while(--_0x24294e){_0x1de234['push'](_0x1de234['shift']());}};_0x3796a5(++_0x5394e5);}(_0xf955,0xec));var _0x5f95=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf955[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x5f95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f95('0x1'));var moment=require('moment');var BPromise=require(_0x5f95('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f95('0x3'));var config=require('../../config/environment');var attributes=require(_0x5f95('0x4'));module['exports']=function(_0x542139,_0x3bebe0){return _0x542139['define']('CmList',attributes,{'tableName':_0x5f95('0x5'),'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 e17bab3..6806cb5 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 _0xdcbc=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch'];(function(_0x22135e,_0x5eb9cd){var _0x4094a5=function(_0x95711d){while(--_0x95711d){_0x22135e['push'](_0x22135e['shift']());}};_0x4094a5(++_0x5eb9cd);}(_0xdcbc,0x16c));var _0xcdcb=function(_0x3ff45e,_0x52c556){_0x3ff45e=_0x3ff45e-0x0;var _0x4dd4dc=_0xdcbc[_0x3ff45e];return _0x4dd4dc;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var moment=require(_0xcdcb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcdcb('0x3'));var fs=require('fs');var Redis=require(_0xcdcb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdcb('0x5'));var logger=require(_0xcdcb('0x6'))('rpc');var config=require(_0xcdcb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcdcb('0x8')]['http']({'port':0x232a});config[_0xcdcb('0x9')]=_[_0xcdcb('0xa')](config[_0xcdcb('0x9')],{'host':_0xcdcb('0xb'),'port':0x18eb});var socket=require(_0xcdcb('0xc'))(new Redis(config[_0xcdcb('0x9')]));require(_0xcdcb('0xd'))[_0xcdcb('0xe')](socket);function respondWithRpcPromise(_0x58f232,_0x57d81d,_0x57e6d0){return new BPromise(function(_0x1accb6,_0x105844){return client[_0xcdcb('0xf')](_0x58f232,_0x57e6d0)[_0xcdcb('0x10')](function(_0x4f6bf0){logger[_0xcdcb('0x11')](_0xcdcb('0x12'),_0x57d81d,'request\x20sent');logger[_0xcdcb('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x57d81d,'request\x20sent',JSON[_0xcdcb('0x14')](_0x4f6bf0));if(_0x4f6bf0['error']){if(_0x4f6bf0[_0xcdcb('0x15')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x57d81d,_0x4f6bf0[_0xcdcb('0x15')]['message']);return _0x105844(_0x4f6bf0[_0xcdcb('0x15')][_0xcdcb('0x16')]);}logger[_0xcdcb('0x15')](_0xcdcb('0x12'),_0x57d81d,_0x4f6bf0['error'][_0xcdcb('0x16')]);return _0x1accb6(_0x4f6bf0['error'][_0xcdcb('0x16')]);}else{logger[_0xcdcb('0x11')](_0xcdcb('0x12'),_0x57d81d,_0xcdcb('0x17'));_0x1accb6(_0x4f6bf0[_0xcdcb('0x18')][_0xcdcb('0x16')]);}})[_0xcdcb('0x19')](function(_0x544ee3){logger['error'](_0xcdcb('0x12'),_0x57d81d,_0x544ee3);_0x105844(_0x544ee3);});});} \ No newline at end of file +var _0x5b26=['../../config/environment','client','redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x412afa,_0x4ca13b){var _0x2db180=function(_0x280f94){while(--_0x280f94){_0x412afa['push'](_0x412afa['shift']());}};_0x2db180(++_0x4ca13b);}(_0x5b26,0x1c6));var _0x65b2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5b26[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x65b2('0x0'));var BPromise=require(_0x65b2('0x1'));var rs=require(_0x65b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x65b2('0x3'));var logger=require(_0x65b2('0x4'))(_0x65b2('0x5'));var config=require(_0x65b2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65b2('0x7')]['http']({'port':0x232a});config[_0x65b2('0x8')]=_['defaults'](config['redis'],{'host':_0x65b2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65b2('0x8')]));require(_0x65b2('0xa'))[_0x65b2('0xb')](socket);function respondWithRpcPromise(_0x3a334c,_0x22fd41,_0x2a918b){return new BPromise(function(_0x1fa1f9,_0x218765){return client[_0x65b2('0xc')](_0x3a334c,_0x2a918b)[_0x65b2('0xd')](function(_0x483306){logger[_0x65b2('0xe')](_0x65b2('0xf'),_0x22fd41,_0x65b2('0x10'));logger[_0x65b2('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x22fd41,_0x65b2('0x10'),JSON['stringify'](_0x483306));if(_0x483306[_0x65b2('0x12')]){if(_0x483306['error'][_0x65b2('0x13')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x22fd41,_0x483306[_0x65b2('0x12')][_0x65b2('0x14')]);return _0x218765(_0x483306['error']['message']);}logger['error'](_0x65b2('0xf'),_0x22fd41,_0x483306[_0x65b2('0x12')][_0x65b2('0x14')]);return _0x1fa1f9(_0x483306[_0x65b2('0x12')][_0x65b2('0x14')]);}else{logger[_0x65b2('0xe')](_0x65b2('0xf'),_0x22fd41,'request\x20sent');_0x1fa1f9(_0x483306[_0x65b2('0x15')][_0x65b2('0x14')]);}})[_0x65b2('0x16')](function(_0x20fa8f){logger[_0x65b2('0x12')]('CmList,\x20%s,\x20%s',_0x22fd41,_0x20fa8f);_0x218765(_0x20fa8f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index bf6dc37..1b5ed41 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 _0x86b8=['save','remove','emit','removeListener','length','cmList:','./cmList.events'];(function(_0x145ac9,_0x49779f){var _0x287117=function(_0x315a6f){while(--_0x315a6f){_0x145ac9['push'](_0x145ac9['shift']());}};_0x287117(++_0x49779f);}(_0x86b8,0x15d));var _0x886b=function(_0x5ccf37,_0x44b55d){_0x5ccf37=_0x5ccf37-0x0;var _0x44bdd5=_0x86b8[_0x5ccf37];return _0x44bdd5;};'use strict';var CmListEvents=require(_0x886b('0x0'));var events=[_0x886b('0x1'),_0x886b('0x2'),'update'];function createListener(_0x105f5d,_0x5db7b6){return function(_0x3dcb96){_0x5db7b6[_0x886b('0x3')](_0x105f5d,_0x3dcb96);};}function removeListener(_0x4191fb,_0x4d3769){return function(){CmListEvents[_0x886b('0x4')](_0x4191fb,_0x4d3769);};}exports['register']=function(_0x5b5ff5){for(var _0x2c32bc=0x0,_0xd9d9ac=events[_0x886b('0x5')];_0x2c32bc<_0xd9d9ac;_0x2c32bc++){var _0x2f8957=events[_0x2c32bc];var _0xbc2d70=createListener(_0x886b('0x6')+_0x2f8957,_0x5b5ff5);CmListEvents['on'](_0x2f8957,_0xbc2d70);}}; \ No newline at end of file +var _0xafc4=['register','length','cmList:','./cmList.events','remove','emit'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xafc4,0x69));var _0x4afc=function(_0x47271f,_0x3b8d7e){_0x47271f=_0x47271f-0x0;var _0x3c1658=_0xafc4[_0x47271f];return _0x3c1658;};'use strict';var CmListEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){CmListEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);CmListEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2ef17fe..cf086db 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 8b1c3a0..b64cc30 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x17de04,_0x5ac311){var _0x32b3b1=function(_0x4934e0){while(--_0x4934e0){_0x17de04['push'](_0x17de04['shift']());}};_0x32b3b1(++_0x5ac311);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x39c094,_0x4beb7c){var _0x228723=function(_0x18c1ed){while(--_0x18c1ed){_0x39c094['push'](_0x39c094['shift']());}};_0x228723(++_0x4beb7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2b2975b..be33313 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 _0x60ae=['to-csv','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','name','send','body','Condition','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x60ae,0x9a));var _0xe60a=function(_0x545150,_0x2c2b6c){_0x545150=_0x545150-0x0;var _0xff7fd6=_0x60ae[_0x545150];return _0xff7fd6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe60a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe60a('0x1'));var jsonpatch=require(_0xe60a('0x2'));var rp=require(_0xe60a('0x3'));var moment=require('moment');var BPromise=require(_0xe60a('0x4'));var Mustache=require('mustache');var util=require(_0xe60a('0x5'));var path=require(_0xe60a('0x6'));var sox=require(_0xe60a('0x7'));var csv=require('to-csv');var ejs=require(_0xe60a('0x8'));var fs=require('fs');var _=require(_0xe60a('0x9'));var squel=require(_0xe60a('0xa'));var crypto=require(_0xe60a('0xb'));var jsforce=require(_0xe60a('0xc'));var deskjs=require(_0xe60a('0xd'));var toCsv=require(_0xe60a('0xe'));var querystring=require(_0xe60a('0xf'));var Papa=require(_0xe60a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe60a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe60a('0x12'));var utils=require(_0xe60a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe60a('0x14'));var db=require(_0xe60a('0x15'))['db'];function respondWithStatusCode(_0x40914f,_0x5cf96c){_0x5cf96c=_0x5cf96c||0xcc;return function(_0x4a40f6){if(_0x4a40f6){return _0x40914f['sendStatus'](_0x5cf96c);}return _0x40914f[_0xe60a('0x16')](_0x5cf96c)[_0xe60a('0x17')]();};}function respondWithResult(_0xa1a8c0,_0xfd2523){_0xfd2523=_0xfd2523||0xc8;return function(_0x15c052){if(_0x15c052){return _0xa1a8c0['status'](_0xfd2523)[_0xe60a('0x18')](_0x15c052);}};}function respondWithFilteredResult(_0x583d85,_0x5c8e74){return function(_0x2fcde5){if(_0x2fcde5){var _0x21656=_0x2fcde5[_0xe60a('0x19')],_0x535b69=_0x5c8e74[_0xe60a('0x1a')],_0x597673=_0x5c8e74['offset']+_0x5c8e74['limit'],_0x528d88;if(_0x597673>=_0x21656){_0x597673=_0x21656;_0x528d88=0xc8;}else{_0x528d88=0xce;}_0x583d85[_0xe60a('0x16')](_0x528d88);return _0x583d85[_0xe60a('0x1b')]('Content-Range',_0x535b69+'-'+_0x597673+'/'+_0x21656)[_0xe60a('0x18')](_0x2fcde5);}return null;};}function patchUpdates(_0x3cc4f2){return function(_0x384605){try{jsonpatch[_0xe60a('0x1c')](_0x384605,_0x3cc4f2,!![]);}catch(_0x33a644){return BPromise[_0xe60a('0x1d')](_0x33a644);}return _0x384605[_0xe60a('0x1e')]();};}function saveUpdates(_0x1729bc,_0x33e45d){return function(_0x1f8faf){if(_0x1f8faf){return _0x1f8faf[_0xe60a('0x1f')](_0x1729bc)[_0xe60a('0x20')](function(_0x2fe58a){return _0x2fe58a;});}return null;};}function removeEntity(_0x28867d,_0x1fd6ad){return function(_0x21714e){if(_0x21714e){return _0x21714e[_0xe60a('0x21')]()['then'](function(){_0x28867d[_0xe60a('0x16')](0xcc)[_0xe60a('0x17')]();});}};}function handleEntityNotFound(_0xccdaaa,_0x37eddb){return function(_0x1295a9){if(!_0x1295a9){_0xccdaaa[_0xe60a('0x22')](0x194);}return _0x1295a9;};}function handleError(_0x2cbd34,_0x1f12a8){_0x1f12a8=_0x1f12a8||0x1f4;return function(_0x539db6){logger['error'](_0x539db6['stack']);if(_0x539db6[_0xe60a('0x23')]){delete _0x539db6[_0xe60a('0x23')];}_0x2cbd34[_0xe60a('0x16')](_0x1f12a8)[_0xe60a('0x24')](_0x539db6);};}exports[_0xe60a('0x1f')]=function(_0x4ff1da,_0x27a031){if(_0x4ff1da[_0xe60a('0x25')]['id']){delete _0x4ff1da[_0xe60a('0x25')]['id'];}return db[_0xe60a('0x26')][_0xe60a('0x27')]({'where':{'id':_0x4ff1da[_0xe60a('0x28')]['id']}})[_0xe60a('0x20')](handleEntityNotFound(_0x27a031,null))['then'](saveUpdates(_0x4ff1da['body'],null))[_0xe60a('0x20')](respondWithResult(_0x27a031,null))[_0xe60a('0x29')](handleError(_0x27a031,null));};exports[_0xe60a('0x21')]=function(_0x4ecf73,_0x352561){return db[_0xe60a('0x26')][_0xe60a('0x27')]({'where':{'id':_0x4ecf73[_0xe60a('0x28')]['id']}})[_0xe60a('0x20')](handleEntityNotFound(_0x352561,null))['then'](removeEntity(_0x352561,null))['catch'](handleError(_0x352561,null));}; \ No newline at end of file +var _0x5eef=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','send','update','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0xd83d62,_0x30b3c6){var _0xec58f3=function(_0x130c22){while(--_0x130c22){_0xd83d62['push'](_0xd83d62['shift']());}};_0xec58f3(++_0x30b3c6);}(_0x5eef,0xaf));var _0xf5ee=function(_0x28fb61,_0xe93fb6){_0x28fb61=_0x28fb61-0x0;var _0x5478e9=_0x5eef[_0x28fb61];return _0x5478e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf5ee('0x0'));var rimraf=require(_0xf5ee('0x1'));var zipdir=require(_0xf5ee('0x2'));var jsonpatch=require(_0xf5ee('0x3'));var rp=require(_0xf5ee('0x4'));var moment=require(_0xf5ee('0x5'));var BPromise=require(_0xf5ee('0x6'));var Mustache=require('mustache');var util=require(_0xf5ee('0x7'));var path=require(_0xf5ee('0x8'));var sox=require(_0xf5ee('0x9'));var csv=require(_0xf5ee('0xa'));var ejs=require(_0xf5ee('0xb'));var fs=require('fs');var _=require(_0xf5ee('0xc'));var squel=require(_0xf5ee('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5ee('0xe'));var deskjs=require(_0xf5ee('0xf'));var toCsv=require(_0xf5ee('0xa'));var querystring=require(_0xf5ee('0x10'));var Papa=require('papaparse');var Redis=require(_0xf5ee('0x11'));var authService=require(_0xf5ee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5ee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5ee('0x14'))(_0xf5ee('0x15'));var utils=require('../../config/utils');var config=require(_0xf5ee('0x16'));var licenseUtil=require(_0xf5ee('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4115,_0x769afb){_0x769afb=_0x769afb||0xcc;return function(_0xc2cd14){if(_0xc2cd14){return _0x1e4115[_0xf5ee('0x18')](_0x769afb);}return _0x1e4115[_0xf5ee('0x19')](_0x769afb)[_0xf5ee('0x1a')]();};}function respondWithResult(_0xe9a13c,_0x4ed4d8){_0x4ed4d8=_0x4ed4d8||0xc8;return function(_0x331e1b){if(_0x331e1b){return _0xe9a13c[_0xf5ee('0x19')](_0x4ed4d8)['json'](_0x331e1b);}};}function respondWithFilteredResult(_0x35ed63,_0x317eaf){return function(_0x1bc50a){if(_0x1bc50a){var _0x29a440=_0x1bc50a[_0xf5ee('0x1b')],_0xf3ec8d=_0x317eaf['offset'],_0x45cc62=_0x317eaf[_0xf5ee('0x1c')]+_0x317eaf[_0xf5ee('0x1d')],_0x2b969a;if(_0x45cc62>=_0x29a440){_0x45cc62=_0x29a440;_0x2b969a=0xc8;}else{_0x2b969a=0xce;}_0x35ed63[_0xf5ee('0x19')](_0x2b969a);return _0x35ed63['set'](_0xf5ee('0x1e'),_0xf3ec8d+'-'+_0x45cc62+'/'+_0x29a440)[_0xf5ee('0x1f')](_0x1bc50a);}return null;};}function patchUpdates(_0x47f2bb){return function(_0x388705){try{jsonpatch[_0xf5ee('0x20')](_0x388705,_0x47f2bb,!![]);}catch(_0xc44522){return BPromise[_0xf5ee('0x21')](_0xc44522);}return _0x388705[_0xf5ee('0x22')]();};}function saveUpdates(_0x492582,_0x169fe6){return function(_0x4ca59d){if(_0x4ca59d){return _0x4ca59d['update'](_0x492582)[_0xf5ee('0x23')](function(_0x44474d){return _0x44474d;});}return null;};}function removeEntity(_0x56200c,_0x29d3ee){return function(_0x3e3ef6){if(_0x3e3ef6){return _0x3e3ef6[_0xf5ee('0x24')]()['then'](function(){_0x56200c[_0xf5ee('0x19')](0xcc)[_0xf5ee('0x1a')]();});}};}function handleEntityNotFound(_0x134f75,_0xf4cbf4){return function(_0x498d32){if(!_0x498d32){_0x134f75['sendStatus'](0x194);}return _0x498d32;};}function handleError(_0x4b3675,_0x1a60df){_0x1a60df=_0x1a60df||0x1f4;return function(_0x488423){logger[_0xf5ee('0x25')](_0x488423[_0xf5ee('0x26')]);if(_0x488423['name']){delete _0x488423['name'];}_0x4b3675[_0xf5ee('0x19')](_0x1a60df)[_0xf5ee('0x27')](_0x488423);};}exports[_0xf5ee('0x28')]=function(_0x1f3a31,_0x41a8f0){if(_0x1f3a31[_0xf5ee('0x29')]['id']){delete _0x1f3a31['body']['id'];}return db[_0xf5ee('0x2a')][_0xf5ee('0x2b')]({'where':{'id':_0x1f3a31['params']['id']}})[_0xf5ee('0x23')](handleEntityNotFound(_0x41a8f0,null))['then'](saveUpdates(_0x1f3a31[_0xf5ee('0x29')],null))['then'](respondWithResult(_0x41a8f0,null))['catch'](handleError(_0x41a8f0,null));};exports['destroy']=function(_0x1a07cf,_0xcca798){return db[_0xf5ee('0x2a')][_0xf5ee('0x2b')]({'where':{'id':_0x1a07cf[_0xf5ee('0x2c')]['id']}})['then'](handleEntityNotFound(_0xcca798,null))['then'](removeEntity(_0xcca798,null))[_0xf5ee('0x2d')](handleError(_0xcca798,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e04aa8d..148e554 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 _0x2570=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','Condition','tools_conditions','util'];(function(_0x37c5bd,_0x48b34b){var _0x1f9ad1=function(_0x283d34){while(--_0x283d34){_0x37c5bd['push'](_0x37c5bd['shift']());}};_0x1f9ad1(++_0x48b34b);}(_0x2570,0xaf));var _0x0257=function(_0x2b11c8,_0x20be4f){_0x2b11c8=_0x2b11c8-0x0;var _0x4c0768=_0x2570[_0x2b11c8];return _0x4c0768;};'use strict';var _=require('lodash');var util=require(_0x0257('0x0'));var logger=require(_0x0257('0x1'))(_0x0257('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0257('0x3'));var fs=require('fs');var path=require(_0x0257('0x4'));var rimraf=require(_0x0257('0x5'));var config=require(_0x0257('0x6'));var attributes=require('./condition.attributes');module[_0x0257('0x7')]=function(_0xc6338d,_0x3b60cc){return _0xc6338d[_0x0257('0x8')](_0x0257('0x9'),attributes,{'tableName':_0x0257('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e35=['request-promise','path','../../config/environment','exports','define','Condition','tools_conditions','util','api','moment','bluebird'];(function(_0x123a8a,_0x26dcc4){var _0x38aceb=function(_0x1e3c8b){while(--_0x1e3c8b){_0x123a8a['push'](_0x123a8a['shift']());}};_0x38aceb(++_0x26dcc4);}(_0x1e35,0x17d));var _0x51e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x51e3('0x0'));var logger=require('../../config/logger')(_0x51e3('0x1'));var moment=require(_0x51e3('0x2'));var BPromise=require(_0x51e3('0x3'));var rp=require(_0x51e3('0x4'));var fs=require('fs');var path=require(_0x51e3('0x5'));var rimraf=require('rimraf');var config=require(_0x51e3('0x6'));var attributes=require('./condition.attributes');module[_0x51e3('0x7')]=function(_0x476512,_0x1c2173){return _0x476512[_0x51e3('0x8')](_0x51e3('0x9'),attributes,{'tableName':_0x51e3('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 a8d55d3..bc6d4ff 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 _0x9ead=['error','message','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x958146,_0x4aea4c){var _0x6c93f7=function(_0x4096eb){while(--_0x4096eb){_0x958146['push'](_0x958146['shift']());}};_0x6c93f7(++_0x4aea4c);}(_0x9ead,0xfe));var _0xd9ea=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0x9ead[_0x5d1d6c];return _0x3f4b02;};'use strict';var _=require(_0xd9ea('0x0'));var util=require(_0xd9ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9ea('0x2'));var db=require(_0xd9ea('0x3'))['db'];var utils=require(_0xd9ea('0x4'));var logger=require(_0xd9ea('0x5'))(_0xd9ea('0x6'));var config=require(_0xd9ea('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x332028,_0x2af84f,_0x118ea1){return new BPromise(function(_0x12d434,_0x10fe2a){return client[_0xd9ea('0x9')](_0x332028,_0x118ea1)[_0xd9ea('0xa')](function(_0x5af358){logger[_0xd9ea('0xb')](_0xd9ea('0xc'),_0x2af84f,_0xd9ea('0xd'));logger[_0xd9ea('0xe')](_0xd9ea('0xf'),_0x2af84f,_0xd9ea('0xd'),JSON['stringify'](_0x5af358));if(_0x5af358[_0xd9ea('0x10')]){if(_0x5af358['error']['code']===0x1f4){logger[_0xd9ea('0x10')](_0xd9ea('0xc'),_0x2af84f,_0x5af358[_0xd9ea('0x10')]['message']);return _0x10fe2a(_0x5af358[_0xd9ea('0x10')]['message']);}logger[_0xd9ea('0x10')](_0xd9ea('0xc'),_0x2af84f,_0x5af358[_0xd9ea('0x10')][_0xd9ea('0x11')]);return _0x12d434(_0x5af358[_0xd9ea('0x10')][_0xd9ea('0x11')]);}else{logger['info'](_0xd9ea('0xc'),_0x2af84f,_0xd9ea('0xd'));_0x12d434(_0x5af358['result'][_0xd9ea('0x11')]);}})['catch'](function(_0x24124d){logger[_0xd9ea('0x10')](_0xd9ea('0xc'),_0x2af84f,_0x24124d);_0x10fe2a(_0x24124d);});});} \ No newline at end of file +var _0xb9ab=['request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0xb9ab,0x110));var _0xbb9a=function(_0x2a1adb,_0x433c94){_0x2a1adb=_0x2a1adb-0x0;var _0x28c238=_0xb9ab[_0x2a1adb];return _0x28c238;};'use strict';var _=require(_0xbb9a('0x0'));var util=require(_0xbb9a('0x1'));var moment=require(_0xbb9a('0x2'));var BPromise=require(_0xbb9a('0x3'));var rs=require(_0xbb9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb9a('0x5'))['db'];var utils=require(_0xbb9a('0x6'));var logger=require(_0xbb9a('0x7'))(_0xbb9a('0x8'));var config=require(_0xbb9a('0x9'));var jayson=require(_0xbb9a('0xa'));var client=jayson[_0xbb9a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec36e,_0x3edd0b,_0x44eee6){return new BPromise(function(_0x1c3909,_0x455824){return client[_0xbb9a('0xc')](_0x4ec36e,_0x44eee6)[_0xbb9a('0xd')](function(_0x1bbc85){logger[_0xbb9a('0xe')](_0xbb9a('0xf'),_0x3edd0b,_0xbb9a('0x10'));logger['debug'](_0xbb9a('0x11'),_0x3edd0b,_0xbb9a('0x10'),JSON[_0xbb9a('0x12')](_0x1bbc85));if(_0x1bbc85['error']){if(_0x1bbc85[_0xbb9a('0x13')][_0xbb9a('0x14')]===0x1f4){logger[_0xbb9a('0x13')]('Condition,\x20%s,\x20%s',_0x3edd0b,_0x1bbc85[_0xbb9a('0x13')][_0xbb9a('0x15')]);return _0x455824(_0x1bbc85['error'][_0xbb9a('0x15')]);}logger[_0xbb9a('0x13')](_0xbb9a('0xf'),_0x3edd0b,_0x1bbc85[_0xbb9a('0x13')]['message']);return _0x1c3909(_0x1bbc85['error']['message']);}else{logger[_0xbb9a('0xe')](_0xbb9a('0xf'),_0x3edd0b,'request\x20sent');_0x1c3909(_0x1bbc85[_0xbb9a('0x16')][_0xbb9a('0x15')]);}})[_0xbb9a('0x17')](function(_0x764db5){logger[_0xbb9a('0x13')](_0xbb9a('0xf'),_0x3edd0b,_0x764db5);_0x455824(_0x764db5);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 034bf61..a41b5c0 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 _0xa73a=['./condition.controller','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5116f5,_0x5b95d2){var _0x36da70=function(_0x1b6df8){while(--_0x1b6df8){_0x5116f5['push'](_0x5116f5['shift']());}};_0x36da70(++_0x5b95d2);}(_0xa73a,0x124));var _0xaa73=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0xa73a[_0x3fad5a];return _0x4ca713;};'use strict';var multer=require(_0xaa73('0x0'));var util=require(_0xaa73('0x1'));var path=require(_0xaa73('0x2'));var timeout=require(_0xaa73('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xaa73('0x4'));var interaction=require(_0xaa73('0x5'));var config=require(_0xaa73('0x6'));var controller=require(_0xaa73('0x7'));router['put'](_0xaa73('0x8'),auth[_0xaa73('0x9')](),controller[_0xaa73('0xa')]);router['delete']('/:id',auth[_0xaa73('0x9')](),controller[_0xaa73('0xb')]);module[_0xaa73('0xc')]=router; \ No newline at end of file +var _0xc481=['/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xc481,0x6a));var _0x1c48=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xc481[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0x1c48('0x0'));var util=require(_0x1c48('0x1'));var path=require('path');var timeout=require(_0x1c48('0x2'));var express=require(_0x1c48('0x3'));var router=express[_0x1c48('0x4')]();var auth=require(_0x1c48('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1c48('0x6'));router[_0x1c48('0x7')]('/:id',auth[_0x1c48('0x8')](),controller[_0x1c48('0x9')]);router[_0x1c48('0xa')](_0x1c48('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c48('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index e1bc7ad..7e12809 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 _0x87df=['exports','STRING','name','INTEGER','sequelize'];(function(_0x564a0d,_0x224acb){var _0x2a2f0f=function(_0x5d0b4d){while(--_0x5d0b4d){_0x564a0d['push'](_0x564a0d['shift']());}};_0x2a2f0f(++_0x224acb);}(_0x87df,0x167));var _0xf87d=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x87df[_0x3a7257];return _0x467d25;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')],'allowNull':![],'unique':_0xf87d('0x3')},'OrderBy':{'type':Sequelize[_0xf87d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf87d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xbd50=['STRING','INTEGER','sequelize','exports'];(function(_0x264aa9,_0xd540f1){var _0x40ef3d=function(_0x2fc355){while(--_0x2fc355){_0x264aa9['push'](_0x264aa9['shift']());}};_0x40ef3d(++_0xd540f1);}(_0xbd50,0x196));var _0x0bd5=function(_0x19e89d,_0x4793ce){_0x19e89d=_0x19e89d-0x0;var _0x48aeed=_0xbd50[_0x19e89d];return _0x48aeed;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x0bd5('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0bd5('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 3db9fe3..b4465e5 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 _0x9e69=['filter','merge','options','ContactItemType','include','findAll','rows','catch','show','keys','includeAll','find','create','role','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','status','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x9e69,0x150));var _0x99e6=function(_0x345be8,_0x17a84a){_0x345be8=_0x345be8-0x0;var _0x47cc18=_0x9e69[_0x345be8];return _0x47cc18;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x99e6('0x0'));var rimraf=require(_0x99e6('0x1'));var zipdir=require(_0x99e6('0x2'));var jsonpatch=require(_0x99e6('0x3'));var rp=require('request-promise');var moment=require(_0x99e6('0x4'));var BPromise=require(_0x99e6('0x5'));var Mustache=require('mustache');var util=require(_0x99e6('0x6'));var path=require(_0x99e6('0x7'));var sox=require(_0x99e6('0x8'));var csv=require('to-csv');var ejs=require(_0x99e6('0x9'));var fs=require('fs');var _=require(_0x99e6('0xa'));var squel=require(_0x99e6('0xb'));var crypto=require('crypto');var jsforce=require(_0x99e6('0xc'));var deskjs=require(_0x99e6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x99e6('0xe'));var Papa=require(_0x99e6('0xf'));var Redis=require('ioredis');var authService=require(_0x99e6('0x10'));var qs=require(_0x99e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99e6('0x12'))(_0x99e6('0x13'));var utils=require(_0x99e6('0x14'));var config=require(_0x99e6('0x15'));var licenseUtil=require(_0x99e6('0x16'));var db=require(_0x99e6('0x17'))['db'];function respondWithStatusCode(_0x51de85,_0x13a62b){_0x13a62b=_0x13a62b||0xcc;return function(_0x4033c5){if(_0x4033c5){return _0x51de85[_0x99e6('0x18')](_0x13a62b);}return _0x51de85['status'](_0x13a62b)[_0x99e6('0x19')]();};}function respondWithResult(_0x4061b2,_0x2cf6a4){_0x2cf6a4=_0x2cf6a4||0xc8;return function(_0x57111c){if(_0x57111c){return _0x4061b2['status'](_0x2cf6a4)['json'](_0x57111c);}};}function respondWithFilteredResult(_0x40fdb8,_0x4741c9){return function(_0x1d910a){if(_0x1d910a){var _0x5d5cd5=_0x1d910a[_0x99e6('0x1a')],_0x18fa86=_0x4741c9[_0x99e6('0x1b')],_0x38fcdd=_0x4741c9['offset']+_0x4741c9[_0x99e6('0x1c')],_0xebfd62;if(_0x38fcdd>=_0x5d5cd5){_0x38fcdd=_0x5d5cd5;_0xebfd62=0xc8;}else{_0xebfd62=0xce;}_0x40fdb8['status'](_0xebfd62);return _0x40fdb8[_0x99e6('0x1d')](_0x99e6('0x1e'),_0x18fa86+'-'+_0x38fcdd+'/'+_0x5d5cd5)['json'](_0x1d910a);}return null;};}function patchUpdates(_0x29dbea){return function(_0x3c4cc8){try{jsonpatch[_0x99e6('0x1f')](_0x3c4cc8,_0x29dbea,!![]);}catch(_0x2578f6){return BPromise[_0x99e6('0x20')](_0x2578f6);}return _0x3c4cc8[_0x99e6('0x21')]();};}function saveUpdates(_0x41a32b,_0x95a8e5){return function(_0x46f1d8){if(_0x46f1d8){return _0x46f1d8[_0x99e6('0x22')](_0x41a32b)['then'](function(_0x40590f){return _0x40590f;});}return null;};}function removeEntity(_0xef9c63,_0x16f05d){return function(_0x249872){if(_0x249872){return _0x249872[_0x99e6('0x23')]()[_0x99e6('0x24')](function(){var _0x2a308f=_0x249872[_0x99e6('0x25')]({'plain':!![]});var _0x2033af=_0x99e6('0x26');return db[_0x99e6('0x27')][_0x99e6('0x23')]({'where':{'type':_0x2033af,'resourceId':_0x2a308f['id']}})[_0x99e6('0x24')](function(){return _0x249872;});})[_0x99e6('0x24')](function(){_0xef9c63[_0x99e6('0x28')](0xcc)[_0x99e6('0x19')]();});}};}function handleEntityNotFound(_0x17bc07,_0x57815a){return function(_0x43038d){if(!_0x43038d){_0x17bc07['sendStatus'](0x194);}return _0x43038d;};}function handleError(_0x30b956,_0x2bcd72){_0x2bcd72=_0x2bcd72||0x1f4;return function(_0x35d4f2){logger['error'](_0x35d4f2[_0x99e6('0x29')]);if(_0x35d4f2['name']){delete _0x35d4f2[_0x99e6('0x2a')];}_0x30b956['status'](_0x2bcd72)[_0x99e6('0x2b')](_0x35d4f2);};}exports[_0x99e6('0x2c')]=function(_0x4b58c7,_0x4d6b19){var _0x2c9b92={},_0x350fa0={},_0x29740d={'count':0x0,'rows':[]};var _0x1f4c63=_[_0x99e6('0x2d')](db['ContactItemType'][_0x99e6('0x2e')],function(_0x4b204a){return{'name':_0x4b204a[_0x99e6('0x2f')],'type':_0x4b204a['type']['key']};});_0x350fa0[_0x99e6('0x30')]=_['map'](_0x1f4c63,'name');_0x350fa0[_0x99e6('0x31')]=_['keys'](_0x4b58c7[_0x99e6('0x31')]);_0x350fa0[_0x99e6('0x32')]=_[_0x99e6('0x33')](_0x350fa0['model'],_0x350fa0[_0x99e6('0x31')]);_0x2c9b92[_0x99e6('0x34')]=_[_0x99e6('0x33')](_0x350fa0[_0x99e6('0x30')],qs['fields'](_0x4b58c7[_0x99e6('0x31')][_0x99e6('0x35')]));_0x2c9b92[_0x99e6('0x34')]=_0x2c9b92[_0x99e6('0x34')][_0x99e6('0x36')]?_0x2c9b92[_0x99e6('0x34')]:_0x350fa0['model'];if(!_0x4b58c7[_0x99e6('0x31')]['hasOwnProperty']('nolimit')){_0x2c9b92['limit']=qs[_0x99e6('0x1c')](_0x4b58c7[_0x99e6('0x31')]['limit']);_0x2c9b92[_0x99e6('0x1b')]=qs[_0x99e6('0x1b')](_0x4b58c7[_0x99e6('0x31')][_0x99e6('0x1b')]);}_0x2c9b92[_0x99e6('0x37')]=qs[_0x99e6('0x38')](_0x4b58c7['query'][_0x99e6('0x38')]);_0x2c9b92[_0x99e6('0x39')]=qs[_0x99e6('0x32')](_[_0x99e6('0x3a')](_0x4b58c7['query'],_0x350fa0[_0x99e6('0x32')]),_0x1f4c63);if(_0x4b58c7[_0x99e6('0x31')][_0x99e6('0x3b')]){_0x2c9b92[_0x99e6('0x39')]=_[_0x99e6('0x3c')](_0x2c9b92[_0x99e6('0x39')],{'$or':_[_0x99e6('0x2d')](_0x1f4c63,function(_0x58332f){if(_0x58332f['type']!=='VIRTUAL'){var _0x20d7bd={};_0x20d7bd[_0x58332f[_0x99e6('0x2a')]]={'$like':'%'+_0x4b58c7['query'][_0x99e6('0x3b')]+'%'};return _0x20d7bd;}})});}_0x2c9b92=_[_0x99e6('0x3c')]({},_0x2c9b92,_0x4b58c7[_0x99e6('0x3d')]);var _0x6e0c1e={'where':_0x2c9b92[_0x99e6('0x39')]};return db[_0x99e6('0x3e')][_0x99e6('0x1a')](_0x6e0c1e)[_0x99e6('0x24')](function(_0x48a318){_0x29740d[_0x99e6('0x1a')]=_0x48a318;if(_0x4b58c7[_0x99e6('0x31')]['includeAll']){_0x2c9b92[_0x99e6('0x3f')]=[{'all':!![]}];}return db[_0x99e6('0x3e')][_0x99e6('0x40')](_0x2c9b92);})[_0x99e6('0x24')](function(_0x315e6b){_0x29740d[_0x99e6('0x41')]=_0x315e6b;return _0x29740d;})[_0x99e6('0x24')](respondWithFilteredResult(_0x4d6b19,_0x2c9b92))[_0x99e6('0x42')](handleError(_0x4d6b19,null));};exports[_0x99e6('0x43')]=function(_0x534f05,_0x562921){var _0x497e3d={'raw':!![],'where':{'id':_0x534f05['params']['id']}},_0x4abd00={};_0x4abd00[_0x99e6('0x30')]=_[_0x99e6('0x44')](db['ContactItemType'][_0x99e6('0x2e')]);_0x4abd00[_0x99e6('0x31')]=_[_0x99e6('0x44')](_0x534f05[_0x99e6('0x31')]);_0x4abd00[_0x99e6('0x32')]=_[_0x99e6('0x33')](_0x4abd00['model'],_0x4abd00[_0x99e6('0x31')]);_0x497e3d[_0x99e6('0x34')]=_[_0x99e6('0x33')](_0x4abd00[_0x99e6('0x30')],qs[_0x99e6('0x35')](_0x534f05[_0x99e6('0x31')][_0x99e6('0x35')]));_0x497e3d[_0x99e6('0x34')]=_0x497e3d[_0x99e6('0x34')][_0x99e6('0x36')]?_0x497e3d[_0x99e6('0x34')]:_0x4abd00[_0x99e6('0x30')];if(_0x534f05[_0x99e6('0x31')][_0x99e6('0x45')]){_0x497e3d['include']=[{'all':!![]}];}_0x497e3d=_['merge']({},_0x497e3d,_0x534f05['options']);return db['ContactItemType'][_0x99e6('0x46')](_0x497e3d)[_0x99e6('0x24')](handleEntityNotFound(_0x562921,null))[_0x99e6('0x24')](respondWithResult(_0x562921,null))[_0x99e6('0x42')](handleError(_0x562921,null));};exports[_0x99e6('0x47')]=function(_0x55e660,_0x558d09){return db[_0x99e6('0x3e')][_0x99e6('0x47')](_0x55e660['body'],{})['then'](function(_0x10a08e){var _0x437bf2=_0x55e660['user'][_0x99e6('0x25')]({'plain':!![]});if(!_0x437bf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x437bf2[_0x99e6('0x48')]===_0x99e6('0x49')){var _0x2160ea=_0x10a08e['get']({'plain':!![]});var _0x1835d9=_0x99e6('0x26');return db['UserProfileSection'][_0x99e6('0x46')]({'where':{'name':_0x1835d9,'userProfileId':_0x437bf2[_0x99e6('0x4a')]},'raw':!![]})[_0x99e6('0x24')](function(_0x49b7ab){if(_0x49b7ab&&_0x49b7ab['autoAssociation']===0x0){return db[_0x99e6('0x27')][_0x99e6('0x47')]({'name':_0x2160ea['name'],'resourceId':_0x2160ea['id'],'type':_0x49b7ab[_0x99e6('0x2a')],'sectionId':_0x49b7ab['id']},{})[_0x99e6('0x24')](function(){return _0x10a08e;});}else{return _0x10a08e;}})[_0x99e6('0x42')](function(_0x40de95){logger[_0x99e6('0x4b')](_0x99e6('0x4c'),_0x40de95);throw _0x40de95;});}return _0x10a08e;})[_0x99e6('0x24')](respondWithResult(_0x558d09,0xc9))['catch'](handleError(_0x558d09,null));};exports[_0x99e6('0x22')]=function(_0x896906,_0x561b1f){if(_0x896906[_0x99e6('0x4d')]['id']){delete _0x896906[_0x99e6('0x4d')]['id'];}return db['ContactItemType'][_0x99e6('0x46')]({'where':{'id':_0x896906[_0x99e6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x561b1f,null))[_0x99e6('0x24')](saveUpdates(_0x896906['body'],null))[_0x99e6('0x24')](respondWithResult(_0x561b1f,null))[_0x99e6('0x42')](handleError(_0x561b1f,null));};exports[_0x99e6('0x23')]=function(_0xf0cadd,_0x3dcdae){return db[_0x99e6('0x3e')][_0x99e6('0x46')]({'where':{'id':_0xf0cadd[_0x99e6('0x4e')]['id']}})[_0x99e6('0x24')](handleEntityNotFound(_0x3dcdae,null))[_0x99e6('0x24')](removeEntity(_0x3dcdae,null))[_0x99e6('0x42')](handleError(_0x3dcdae,null));}; \ No newline at end of file +var _0x2f2e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','name','send','index','ContactItemType','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f2e,0x146));var _0xe2f2=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0x2f2e[_0x512f81];return _0xa15099;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe2f2('0x0'));var rimraf=require(_0xe2f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2f2('0x2'));var rp=require('request-promise');var moment=require(_0xe2f2('0x3'));var BPromise=require(_0xe2f2('0x4'));var Mustache=require(_0xe2f2('0x5'));var util=require(_0xe2f2('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe2f2('0x7'));var fs=require('fs');var _=require(_0xe2f2('0x8'));var squel=require(_0xe2f2('0x9'));var crypto=require(_0xe2f2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe2f2('0xb'));var Papa=require('papaparse');var Redis=require(_0xe2f2('0xc'));var authService=require(_0xe2f2('0xd'));var qs=require(_0xe2f2('0xe'));var as=require(_0xe2f2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2f2('0x10'))(_0xe2f2('0x11'));var utils=require('../../config/utils');var config=require(_0xe2f2('0x12'));var licenseUtil=require(_0xe2f2('0x13'));var db=require(_0xe2f2('0x14'))['db'];function respondWithStatusCode(_0xec8ce1,_0x46a87e){_0x46a87e=_0x46a87e||0xcc;return function(_0x45c78b){if(_0x45c78b){return _0xec8ce1[_0xe2f2('0x15')](_0x46a87e);}return _0xec8ce1[_0xe2f2('0x16')](_0x46a87e)[_0xe2f2('0x17')]();};}function respondWithResult(_0x3392db,_0x5eb9ef){_0x5eb9ef=_0x5eb9ef||0xc8;return function(_0x3bfa74){if(_0x3bfa74){return _0x3392db[_0xe2f2('0x16')](_0x5eb9ef)[_0xe2f2('0x18')](_0x3bfa74);}};}function respondWithFilteredResult(_0x45cd29,_0x43e4e5){return function(_0x51f710){if(_0x51f710){var _0x5b7f1a=_0x51f710['count'],_0x10cc99=_0x43e4e5[_0xe2f2('0x19')],_0xb11b33=_0x43e4e5[_0xe2f2('0x19')]+_0x43e4e5[_0xe2f2('0x1a')],_0x37f965;if(_0xb11b33>=_0x5b7f1a){_0xb11b33=_0x5b7f1a;_0x37f965=0xc8;}else{_0x37f965=0xce;}_0x45cd29['status'](_0x37f965);return _0x45cd29[_0xe2f2('0x1b')](_0xe2f2('0x1c'),_0x10cc99+'-'+_0xb11b33+'/'+_0x5b7f1a)[_0xe2f2('0x18')](_0x51f710);}return null;};}function patchUpdates(_0x1c5c5a){return function(_0xf6ca03){try{jsonpatch[_0xe2f2('0x1d')](_0xf6ca03,_0x1c5c5a,!![]);}catch(_0x5d664a){return BPromise[_0xe2f2('0x1e')](_0x5d664a);}return _0xf6ca03[_0xe2f2('0x1f')]();};}function saveUpdates(_0x34a57c,_0x596dd9){return function(_0xedba85){if(_0xedba85){return _0xedba85[_0xe2f2('0x20')](_0x34a57c)[_0xe2f2('0x21')](function(_0x27ab02){return _0x27ab02;});}return null;};}function removeEntity(_0x4481b2,_0x3fac5d){return function(_0x1e9829){if(_0x1e9829){return _0x1e9829['destroy']()[_0xe2f2('0x21')](function(){var _0x3be5af=_0x1e9829[_0xe2f2('0x22')]({'plain':!![]});var _0x38c524=_0xe2f2('0x23');return db[_0xe2f2('0x24')][_0xe2f2('0x25')]({'where':{'type':_0x38c524,'resourceId':_0x3be5af['id']}})[_0xe2f2('0x21')](function(){return _0x1e9829;});})[_0xe2f2('0x21')](function(){_0x4481b2['status'](0xcc)[_0xe2f2('0x17')]();});}};}function handleEntityNotFound(_0x56ab92,_0xdf8ce8){return function(_0x3df2da){if(!_0x3df2da){_0x56ab92[_0xe2f2('0x15')](0x194);}return _0x3df2da;};}function handleError(_0x5595b2,_0xc53b25){_0xc53b25=_0xc53b25||0x1f4;return function(_0x58e1fd){logger[_0xe2f2('0x26')](_0x58e1fd['stack']);if(_0x58e1fd[_0xe2f2('0x27')]){delete _0x58e1fd[_0xe2f2('0x27')];}_0x5595b2[_0xe2f2('0x16')](_0xc53b25)[_0xe2f2('0x28')](_0x58e1fd);};}exports[_0xe2f2('0x29')]=function(_0x377e50,_0x542e69){var _0xc9e784={},_0x18c995={},_0x1b0450={'count':0x0,'rows':[]};var _0x4abae7=_['map'](db[_0xe2f2('0x2a')][_0xe2f2('0x2b')],function(_0x1ef6cf){return{'name':_0x1ef6cf[_0xe2f2('0x2c')],'type':_0x1ef6cf['type'][_0xe2f2('0x2d')]};});_0x18c995['model']=_[_0xe2f2('0x2e')](_0x4abae7,_0xe2f2('0x27'));_0x18c995[_0xe2f2('0x2f')]=_[_0xe2f2('0x30')](_0x377e50['query']);_0x18c995[_0xe2f2('0x31')]=_[_0xe2f2('0x32')](_0x18c995[_0xe2f2('0x33')],_0x18c995['query']);_0xc9e784['attributes']=_['intersection'](_0x18c995[_0xe2f2('0x33')],qs[_0xe2f2('0x34')](_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x34')]));_0xc9e784[_0xe2f2('0x35')]=_0xc9e784['attributes'][_0xe2f2('0x36')]?_0xc9e784['attributes']:_0x18c995[_0xe2f2('0x33')];if(!_0x377e50[_0xe2f2('0x2f')]['hasOwnProperty'](_0xe2f2('0x37'))){_0xc9e784[_0xe2f2('0x1a')]=qs[_0xe2f2('0x1a')](_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x1a')]);_0xc9e784[_0xe2f2('0x19')]=qs[_0xe2f2('0x19')](_0x377e50[_0xe2f2('0x2f')]['offset']);}_0xc9e784['order']=qs[_0xe2f2('0x38')](_0x377e50['query'][_0xe2f2('0x38')]);_0xc9e784[_0xe2f2('0x39')]=qs[_0xe2f2('0x31')](_['pick'](_0x377e50[_0xe2f2('0x2f')],_0x18c995['filters']),_0x4abae7);if(_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x3a')]){_0xc9e784[_0xe2f2('0x39')]=_[_0xe2f2('0x3b')](_0xc9e784[_0xe2f2('0x39')],{'$or':_[_0xe2f2('0x2e')](_0x4abae7,function(_0x51c5f1){if(_0x51c5f1[_0xe2f2('0x3c')]!==_0xe2f2('0x3d')){var _0xb39f02={};_0xb39f02[_0x51c5f1[_0xe2f2('0x27')]]={'$like':'%'+_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x3a')]+'%'};return _0xb39f02;}})});}_0xc9e784=_[_0xe2f2('0x3b')]({},_0xc9e784,_0x377e50[_0xe2f2('0x3e')]);var _0x577be0={'where':_0xc9e784['where']};return db[_0xe2f2('0x2a')]['count'](_0x577be0)[_0xe2f2('0x21')](function(_0x4ae957){_0x1b0450[_0xe2f2('0x3f')]=_0x4ae957;if(_0x377e50[_0xe2f2('0x2f')][_0xe2f2('0x40')]){_0xc9e784['include']=[{'all':!![]}];}return db[_0xe2f2('0x2a')][_0xe2f2('0x41')](_0xc9e784);})[_0xe2f2('0x21')](function(_0x260f2e){_0x1b0450[_0xe2f2('0x42')]=_0x260f2e;return _0x1b0450;})[_0xe2f2('0x21')](respondWithFilteredResult(_0x542e69,_0xc9e784))[_0xe2f2('0x43')](handleError(_0x542e69,null));};exports[_0xe2f2('0x44')]=function(_0x5a0ab7,_0x1ccd03){var _0x1a73b6={'raw':!![],'where':{'id':_0x5a0ab7[_0xe2f2('0x45')]['id']}},_0x510a6b={};_0x510a6b['model']=_['keys'](db[_0xe2f2('0x2a')][_0xe2f2('0x2b')]);_0x510a6b['query']=_[_0xe2f2('0x30')](_0x5a0ab7[_0xe2f2('0x2f')]);_0x510a6b[_0xe2f2('0x31')]=_[_0xe2f2('0x32')](_0x510a6b['model'],_0x510a6b[_0xe2f2('0x2f')]);_0x1a73b6[_0xe2f2('0x35')]=_[_0xe2f2('0x32')](_0x510a6b[_0xe2f2('0x33')],qs[_0xe2f2('0x34')](_0x5a0ab7['query']['fields']));_0x1a73b6[_0xe2f2('0x35')]=_0x1a73b6[_0xe2f2('0x35')][_0xe2f2('0x36')]?_0x1a73b6[_0xe2f2('0x35')]:_0x510a6b[_0xe2f2('0x33')];if(_0x5a0ab7[_0xe2f2('0x2f')][_0xe2f2('0x40')]){_0x1a73b6[_0xe2f2('0x46')]=[{'all':!![]}];}_0x1a73b6=_[_0xe2f2('0x3b')]({},_0x1a73b6,_0x5a0ab7[_0xe2f2('0x3e')]);return db[_0xe2f2('0x2a')]['find'](_0x1a73b6)[_0xe2f2('0x21')](handleEntityNotFound(_0x1ccd03,null))[_0xe2f2('0x21')](respondWithResult(_0x1ccd03,null))[_0xe2f2('0x43')](handleError(_0x1ccd03,null));};exports['create']=function(_0x42afaa,_0x4ea411){return db['ContactItemType']['create'](_0x42afaa[_0xe2f2('0x47')],{})[_0xe2f2('0x21')](function(_0x6c0195){var _0x34a7fa=_0x42afaa[_0xe2f2('0x48')][_0xe2f2('0x22')]({'plain':!![]});if(!_0x34a7fa)throw new Error(_0xe2f2('0x49'));if(_0x34a7fa[_0xe2f2('0x4a')]===_0xe2f2('0x48')){var _0x246c3c=_0x6c0195[_0xe2f2('0x22')]({'plain':!![]});var _0x1ac9e2=_0xe2f2('0x23');return db[_0xe2f2('0x4b')]['find']({'where':{'name':_0x1ac9e2,'userProfileId':_0x34a7fa[_0xe2f2('0x4c')]},'raw':!![]})[_0xe2f2('0x21')](function(_0x23e1ad){if(_0x23e1ad&&_0x23e1ad[_0xe2f2('0x4d')]===0x0){return db[_0xe2f2('0x24')][_0xe2f2('0x4e')]({'name':_0x246c3c['name'],'resourceId':_0x246c3c['id'],'type':_0x23e1ad[_0xe2f2('0x27')],'sectionId':_0x23e1ad['id']},{})[_0xe2f2('0x21')](function(){return _0x6c0195;});}else{return _0x6c0195;}})[_0xe2f2('0x43')](function(_0x25676f){logger['error'](_0xe2f2('0x4f'),_0x25676f);throw _0x25676f;});}return _0x6c0195;})[_0xe2f2('0x21')](respondWithResult(_0x4ea411,0xc9))[_0xe2f2('0x43')](handleError(_0x4ea411,null));};exports[_0xe2f2('0x20')]=function(_0x1d3e93,_0x13a94b){if(_0x1d3e93[_0xe2f2('0x47')]['id']){delete _0x1d3e93[_0xe2f2('0x47')]['id'];}return db[_0xe2f2('0x2a')][_0xe2f2('0x50')]({'where':{'id':_0x1d3e93[_0xe2f2('0x45')]['id']}})['then'](handleEntityNotFound(_0x13a94b,null))[_0xe2f2('0x21')](saveUpdates(_0x1d3e93['body'],null))[_0xe2f2('0x21')](respondWithResult(_0x13a94b,null))[_0xe2f2('0x43')](handleError(_0x13a94b,null));};exports[_0xe2f2('0x25')]=function(_0x5ccd2a,_0xb8394a){return db[_0xe2f2('0x2a')][_0xe2f2('0x50')]({'where':{'id':_0x5ccd2a[_0xe2f2('0x45')]['id']}})[_0xe2f2('0x21')](handleEntityNotFound(_0xb8394a,null))['then'](removeEntity(_0xb8394a,null))[_0xe2f2('0x43')](handleError(_0xb8394a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 86a58d5..1197ed0 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 _0x7f27=['rimraf','../../config/environment','exports','define','tools_contact_item_types','lodash','util','moment','path'];(function(_0x18329a,_0x5c7619){var _0x10e340=function(_0x1e78a8){while(--_0x1e78a8){_0x18329a['push'](_0x18329a['shift']());}};_0x10e340(++_0x5c7619);}(_0x7f27,0x12e));var _0x77f2=function(_0x11f771,_0xe39186){_0x11f771=_0x11f771-0x0;var _0x52edf0=_0x7f27[_0x11f771];return _0x52edf0;};'use strict';var _=require(_0x77f2('0x0'));var util=require(_0x77f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x77f2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77f2('0x3'));var rimraf=require(_0x77f2('0x4'));var config=require(_0x77f2('0x5'));var attributes=require('./contactItemType.attributes');module[_0x77f2('0x6')]=function(_0x5da5eb,_0x292221){return _0x5da5eb[_0x77f2('0x7')]('ContactItemType',attributes,{'tableName':_0x77f2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88b0=['define','ContactItemType','tools_contact_item_types','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0x88b0,0x1cb));var _0x088b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x88b0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x088b('0x0'));var util=require(_0x088b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x088b('0x2'));var BPromise=require(_0x088b('0x3'));var rp=require(_0x088b('0x4'));var fs=require('fs');var path=require(_0x088b('0x5'));var rimraf=require('rimraf');var config=require(_0x088b('0x6'));var attributes=require(_0x088b('0x7'));module[_0x088b('0x8')]=function(_0x5af8a4,_0x4a9986){return _0x5af8a4[_0x088b('0x9')](_0x088b('0xa'),attributes,{'tableName':_0x088b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index cbf35e4..55d0574 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 _0x0eec=['jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3a5c21,_0x3635f3){var _0x403652=function(_0x1a782c){while(--_0x1a782c){_0x3a5c21['push'](_0x3a5c21['shift']());}};_0x403652(++_0x3635f3);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc0ee('0x1'));var rs=require(_0xc0ee('0x2'));var fs=require('fs');var Redis=require(_0xc0ee('0x3'));var db=require(_0xc0ee('0x4'))['db'];var utils=require(_0xc0ee('0x5'));var logger=require(_0xc0ee('0x6'))(_0xc0ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0ee('0x8'));var client=jayson['client'][_0xc0ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39022a,_0x2d364d,_0x3aaca5){return new BPromise(function(_0x38b387,_0x1d9dca){return client[_0xc0ee('0xa')](_0x39022a,_0x3aaca5)['then'](function(_0x141f4a){logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));logger[_0xc0ee('0xe')](_0xc0ee('0xf'),_0x2d364d,_0xc0ee('0xd'),JSON['stringify'](_0x141f4a));if(_0x141f4a[_0xc0ee('0x10')]){if(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x11')]===0x1f4){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x1d9dca(_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x2d364d,_0x141f4a[_0xc0ee('0x10')][_0xc0ee('0x12')]);return _0x38b387(_0x141f4a[_0xc0ee('0x10')]['message']);}else{logger[_0xc0ee('0xb')](_0xc0ee('0xc'),_0x2d364d,_0xc0ee('0xd'));_0x38b387(_0x141f4a['result']['message']);}})[_0xc0ee('0x13')](function(_0x4dc6de){logger[_0xc0ee('0x10')](_0xc0ee('0xc'),_0x2d364d,_0x4dc6de);_0x1d9dca(_0x4dc6de);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3644b9,_0x5cd3a6){var _0x4d196d=function(_0x2bb4ef){while(--_0x2bb4ef){_0x3644b9['push'](_0x3644b9['shift']());}};_0x4d196d(++_0x5cd3a6);}(_0x99e9,0xb4));var _0x999e=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x99e9[_0x18776a];return _0x484e4a;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('ContactItemType,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index caad55c..fdc5c2e 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 _0x0d31=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show','post','put','update','destroy','exports','multer','util'];(function(_0x51a9c6,_0x571ec0){var _0x43e5fb=function(_0x20600b){while(--_0x20600b){_0x51a9c6['push'](_0x51a9c6['shift']());}};_0x43e5fb(++_0x571ec0);}(_0x0d31,0xdb));var _0x10d3=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x0d31[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x10d3('0x0'));var util=require(_0x10d3('0x1'));var path=require(_0x10d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x10d3('0x3')]();var auth=require(_0x10d3('0x4'));var interaction=require(_0x10d3('0x5'));var config=require(_0x10d3('0x6'));var controller=require(_0x10d3('0x7'));router['get']('/',auth[_0x10d3('0x8')](),controller['index']);router[_0x10d3('0x9')](_0x10d3('0xa'),auth[_0x10d3('0x8')](),controller[_0x10d3('0xb')]);router[_0x10d3('0xc')]('/',auth[_0x10d3('0x8')](),controller['create']);router[_0x10d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x10d3('0xe')]);router['delete'](_0x10d3('0xa'),auth[_0x10d3('0x8')](),controller[_0x10d3('0xf')]);module[_0x10d3('0x10')]=router; \ No newline at end of file +var _0x27d3=['../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x5ebd9d,_0x4eec29){var _0x75ced3=function(_0x817717){while(--_0x817717){_0x5ebd9d['push'](_0x5ebd9d['shift']());}};_0x75ced3(++_0x4eec29);}(_0x27d3,0x199));var _0x327d=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x27d3[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x327d('0x0'));var util=require(_0x327d('0x1'));var path=require(_0x327d('0x2'));var timeout=require(_0x327d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x327d('0x4'));var interaction=require(_0x327d('0x5'));var config=require(_0x327d('0x6'));var controller=require('./contactItemType.controller');router[_0x327d('0x7')]('/',auth['isAuthenticated'](),controller[_0x327d('0x8')]);router[_0x327d('0x7')](_0x327d('0x9'),auth['isAuthenticated'](),controller[_0x327d('0xa')]);router[_0x327d('0xb')]('/',auth[_0x327d('0xc')](),controller[_0x327d('0xd')]);router[_0x327d('0xe')](_0x327d('0x9'),auth[_0x327d('0xc')](),controller[_0x327d('0xf')]);router[_0x327d('0x10')]('/:id',auth[_0x327d('0xc')](),controller['destroy']);module[_0x327d('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 a7610bb..5bf2306 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 _0x2873=['STRING','name','sequelize','exports'];(function(_0x57b167,_0x2a7559){var _0x43ed78=function(_0x3c7afe){while(--_0x3c7afe){_0x57b167['push'](_0x57b167['shift']());}};_0x43ed78(++_0x2a7559);}(_0x2873,0x1f2));var _0x3287=function(_0x3930c0,_0x1755c3){_0x3930c0=_0x3930c0-0x0;var _0x19d6dc=_0x2873[_0x3930c0];return _0x19d6dc;};'use strict';var Sequelize=require(_0x3287('0x0'));module[_0x3287('0x1')]={'name':{'type':Sequelize[_0x3287('0x2')],'allowNull':![],'unique':_0x3287('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ff6=['exports','STRING','name'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x4ff6,0xd5));var _0x64ff=function(_0x568686,_0x16a88a){_0x568686=_0x568686-0x0;var _0x50a05b=_0x4ff6[_0x568686];return _0x50a05b;};'use strict';var Sequelize=require('sequelize');module[_0x64ff('0x0')]={'name':{'type':Sequelize[_0x64ff('0x1')],'allowNull':![],'unique':_0x64ff('0x2')},'description':{'type':Sequelize[_0x64ff('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 931ced3..65925e8 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 _0xff99=['to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','rawAttributes','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dashboard','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','findOne','getItems','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox'];(function(_0x54b41e,_0x52bae1){var _0x3ac113=function(_0x45177a){while(--_0x45177a){_0x54b41e['push'](_0x54b41e['shift']());}};_0x3ac113(++_0x52bae1);}(_0xff99,0x1e2));var _0x9ff9=function(_0x1616fc,_0x2faf46){_0x1616fc=_0x1616fc-0x0;var _0x2b1fc4=_0xff99[_0x1616fc];return _0x2b1fc4;};'use strict';var pdf=require(_0x9ff9('0x0'));var emlformat=require(_0x9ff9('0x1'));var rimraf=require(_0x9ff9('0x2'));var zipdir=require(_0x9ff9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ff9('0x4'));var moment=require(_0x9ff9('0x5'));var BPromise=require(_0x9ff9('0x6'));var Mustache=require('mustache');var util=require(_0x9ff9('0x7'));var path=require(_0x9ff9('0x8'));var sox=require(_0x9ff9('0x9'));var csv=require(_0x9ff9('0xa'));var ejs=require(_0x9ff9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ff9('0xc'));var crypto=require('crypto');var jsforce=require(_0x9ff9('0xd'));var deskjs=require(_0x9ff9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9ff9('0xf'));var authService=require(_0x9ff9('0x10'));var qs=require(_0x9ff9('0x11'));var as=require(_0x9ff9('0x12'));var hardwareService=require(_0x9ff9('0x13'));var logger=require(_0x9ff9('0x14'))(_0x9ff9('0x15'));var utils=require(_0x9ff9('0x16'));var config=require(_0x9ff9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ff9('0x18'))['db'];config[_0x9ff9('0x19')]=_[_0x9ff9('0x1a')](config['redis'],{'host':_0x9ff9('0x1b'),'port':0x18eb});var socket=require(_0x9ff9('0x1c'))(new Redis(config[_0x9ff9('0x19')]));require(_0x9ff9('0x1d'))[_0x9ff9('0x1e')](socket);function respondWithStatusCode(_0x239699,_0x80b0bd){_0x80b0bd=_0x80b0bd||0xcc;return function(_0xbcd34a){if(_0xbcd34a){return _0x239699[_0x9ff9('0x1f')](_0x80b0bd);}return _0x239699[_0x9ff9('0x20')](_0x80b0bd)[_0x9ff9('0x21')]();};}function respondWithResult(_0x39aaa2,_0x3eaefd){_0x3eaefd=_0x3eaefd||0xc8;return function(_0x1ad66e){if(_0x1ad66e){return _0x39aaa2[_0x9ff9('0x20')](_0x3eaefd)['json'](_0x1ad66e);}};}function respondWithFilteredResult(_0x444c7e,_0xbcf779){return function(_0x2c7cde){if(_0x2c7cde){var _0x4ce66f=_0x2c7cde[_0x9ff9('0x22')],_0x36bde1=_0xbcf779[_0x9ff9('0x23')],_0x4f4672=_0xbcf779[_0x9ff9('0x23')]+_0xbcf779[_0x9ff9('0x24')],_0x50d171;if(_0x4f4672>=_0x4ce66f){_0x4f4672=_0x4ce66f;_0x50d171=0xc8;}else{_0x50d171=0xce;}_0x444c7e[_0x9ff9('0x20')](_0x50d171);return _0x444c7e[_0x9ff9('0x25')](_0x9ff9('0x26'),_0x36bde1+'-'+_0x4f4672+'/'+_0x4ce66f)['json'](_0x2c7cde);}return null;};}function patchUpdates(_0x386dc3){return function(_0x431145){try{jsonpatch['apply'](_0x431145,_0x386dc3,!![]);}catch(_0x97945){return BPromise[_0x9ff9('0x27')](_0x97945);}return _0x431145[_0x9ff9('0x28')]();};}function saveUpdates(_0x52e856,_0x2a6872){return function(_0x5f369b){if(_0x5f369b){return _0x5f369b[_0x9ff9('0x29')](_0x52e856)[_0x9ff9('0x2a')](function(_0x428fac){return _0x428fac;});}return null;};}function removeEntity(_0x24377e,_0x536d2a){return function(_0xf41d7a){if(_0xf41d7a){return _0xf41d7a[_0x9ff9('0x2b')]()[_0x9ff9('0x2a')](function(){var _0x1f353c=_0xf41d7a[_0x9ff9('0x2c')]({'plain':!![]});var _0x1d9f72=_0x9ff9('0x2d');return db[_0x9ff9('0x2e')]['destroy']({'where':{'type':_0x1d9f72,'resourceId':_0x1f353c['id']}})['then'](function(){return _0xf41d7a;});})[_0x9ff9('0x2a')](function(){_0x24377e[_0x9ff9('0x20')](0xcc)[_0x9ff9('0x21')]();});}};}function handleEntityNotFound(_0x3157d6,_0x37466e){return function(_0x426a5c){if(!_0x426a5c){_0x3157d6['sendStatus'](0x194);}return _0x426a5c;};}function handleError(_0x56a347,_0x191190){_0x191190=_0x191190||0x1f4;return function(_0x449525){logger[_0x9ff9('0x2f')](_0x449525[_0x9ff9('0x30')]);if(_0x449525[_0x9ff9('0x31')]){delete _0x449525[_0x9ff9('0x31')];}_0x56a347['status'](_0x191190)[_0x9ff9('0x32')](_0x449525);};}exports[_0x9ff9('0x33')]=function(_0x3d8744,_0x18a201){var _0x2e10fd={},_0x320f3d={},_0x59feb5={'count':0x0,'rows':[]};var _0x2d849d=_[_0x9ff9('0x34')](db['Dashboard'][_0x9ff9('0x35')],function(_0x296b28){return{'name':_0x296b28['fieldName'],'type':_0x296b28['type']['key']};});_0x320f3d['model']=_['map'](_0x2d849d,_0x9ff9('0x31'));_0x320f3d[_0x9ff9('0x36')]=_['keys'](_0x3d8744['query']);_0x320f3d['filters']=_[_0x9ff9('0x37')](_0x320f3d[_0x9ff9('0x38')],_0x320f3d['query']);_0x2e10fd[_0x9ff9('0x39')]=_[_0x9ff9('0x37')](_0x320f3d[_0x9ff9('0x38')],qs[_0x9ff9('0x3a')](_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x3a')]));_0x2e10fd[_0x9ff9('0x39')]=_0x2e10fd[_0x9ff9('0x39')][_0x9ff9('0x3b')]?_0x2e10fd[_0x9ff9('0x39')]:_0x320f3d[_0x9ff9('0x38')];if(!_0x3d8744['query'][_0x9ff9('0x3c')](_0x9ff9('0x3d'))){_0x2e10fd['limit']=qs[_0x9ff9('0x24')](_0x3d8744['query'][_0x9ff9('0x24')]);_0x2e10fd[_0x9ff9('0x23')]=qs[_0x9ff9('0x23')](_0x3d8744['query'][_0x9ff9('0x23')]);}_0x2e10fd[_0x9ff9('0x3e')]=qs[_0x9ff9('0x3f')](_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x3f')]);_0x2e10fd[_0x9ff9('0x40')]=qs[_0x9ff9('0x41')](_[_0x9ff9('0x42')](_0x3d8744['query'],_0x320f3d['filters']),_0x2d849d);if(_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x43')]){_0x2e10fd['where']=_[_0x9ff9('0x44')](_0x2e10fd[_0x9ff9('0x40')],{'$or':_['map'](_0x2d849d,function(_0x2841de){if(_0x2841de['type']!==_0x9ff9('0x45')){var _0xb8fc00={};_0xb8fc00[_0x2841de[_0x9ff9('0x31')]]={'$like':'%'+_0x3d8744[_0x9ff9('0x36')][_0x9ff9('0x43')]+'%'};return _0xb8fc00;}})});}_0x2e10fd=_[_0x9ff9('0x44')]({},_0x2e10fd,_0x3d8744['options']);var _0x37c521={'where':_0x2e10fd[_0x9ff9('0x40')]};return db[_0x9ff9('0x46')][_0x9ff9('0x22')](_0x37c521)[_0x9ff9('0x2a')](function(_0x384d9f){_0x59feb5[_0x9ff9('0x22')]=_0x384d9f;if(_0x3d8744['query'][_0x9ff9('0x47')]){_0x2e10fd[_0x9ff9('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x9ff9('0x49')](_0x2e10fd);})['then'](function(_0x463e14){_0x59feb5[_0x9ff9('0x4a')]=_0x463e14;return _0x59feb5;})['then'](respondWithFilteredResult(_0x18a201,_0x2e10fd))[_0x9ff9('0x4b')](handleError(_0x18a201,null));};exports['show']=function(_0x5c9601,_0x3b80e5){var _0x192fd2={'raw':![],'where':{'id':_0x5c9601[_0x9ff9('0x4c')]['id']}},_0x22b46a={};_0x22b46a[_0x9ff9('0x38')]=_[_0x9ff9('0x4d')](db[_0x9ff9('0x46')][_0x9ff9('0x35')]);_0x22b46a[_0x9ff9('0x36')]=_[_0x9ff9('0x4d')](_0x5c9601[_0x9ff9('0x36')]);_0x22b46a[_0x9ff9('0x41')]=_[_0x9ff9('0x37')](_0x22b46a[_0x9ff9('0x38')],_0x22b46a[_0x9ff9('0x36')]);_0x192fd2[_0x9ff9('0x39')]=_[_0x9ff9('0x37')](_0x22b46a['model'],qs[_0x9ff9('0x3a')](_0x5c9601['query']['fields']));_0x192fd2[_0x9ff9('0x39')]=_0x192fd2[_0x9ff9('0x39')][_0x9ff9('0x3b')]?_0x192fd2['attributes']:_0x22b46a[_0x9ff9('0x38')];if(_0x5c9601[_0x9ff9('0x36')][_0x9ff9('0x47')]){_0x192fd2[_0x9ff9('0x48')]=[{'all':!![]}];}_0x192fd2=_['merge']({},_0x192fd2,_0x5c9601[_0x9ff9('0x4e')]);return db[_0x9ff9('0x46')][_0x9ff9('0x4f')](_0x192fd2)[_0x9ff9('0x2a')](handleEntityNotFound(_0x3b80e5,null))[_0x9ff9('0x2a')](respondWithResult(_0x3b80e5,null))['catch'](handleError(_0x3b80e5,null));};exports['create']=function(_0x3eeade,_0x5d0ad4){return db[_0x9ff9('0x46')][_0x9ff9('0x50')](_0x3eeade[_0x9ff9('0x51')],{})[_0x9ff9('0x2a')](function(_0x4e362b){var _0x5624b6=_0x3eeade['user'][_0x9ff9('0x2c')]({'plain':!![]});if(!_0x5624b6)throw new Error(_0x9ff9('0x52'));if(_0x5624b6[_0x9ff9('0x53')]===_0x9ff9('0x54')){var _0x2fa328=_0x4e362b[_0x9ff9('0x2c')]({'plain':!![]});var _0x1502ee=_0x9ff9('0x2d');return db[_0x9ff9('0x55')][_0x9ff9('0x4f')]({'where':{'name':_0x1502ee,'userProfileId':_0x5624b6[_0x9ff9('0x56')]},'raw':!![]})[_0x9ff9('0x2a')](function(_0x2bbaaf){if(_0x2bbaaf&&_0x2bbaaf['autoAssociation']===0x0){return db['UserProfileResource'][_0x9ff9('0x50')]({'name':_0x2fa328[_0x9ff9('0x31')],'resourceId':_0x2fa328['id'],'type':_0x2bbaaf[_0x9ff9('0x31')],'sectionId':_0x2bbaaf['id']},{})[_0x9ff9('0x2a')](function(){return _0x4e362b;});}else{return _0x4e362b;}})[_0x9ff9('0x4b')](function(_0x1b8cb0){logger['error'](_0x9ff9('0x57'),_0x1b8cb0);throw _0x1b8cb0;});}return _0x4e362b;})[_0x9ff9('0x2a')](respondWithResult(_0x5d0ad4,0xc9))[_0x9ff9('0x4b')](handleError(_0x5d0ad4,null));};exports[_0x9ff9('0x58')]=function(_0x527d0c,_0x2da287){var _0x828e14={'where':{'id':_0x527d0c[_0x9ff9('0x4c')]['id']}},_0x519445={};_0x519445['model']=_['keys'](db['Dashboard'][_0x9ff9('0x35')]);_0x828e14[_0x9ff9('0x39')]=_[_0x9ff9('0x37')](_0x519445['model'],qs[_0x9ff9('0x3a')](_0x527d0c['query'][_0x9ff9('0x3a')]));_0x828e14[_0x9ff9('0x39')]=_0x828e14['attributes'][_0x9ff9('0x3b')]?_0x828e14[_0x9ff9('0x39')]:_0x519445['model'];if(_0x527d0c[_0x9ff9('0x36')]['includeAll']){_0x828e14[_0x9ff9('0x48')]=[{'all':!![]}];}_0x828e14=_[_0x9ff9('0x44')]({},_0x828e14,_0x527d0c['options']);return db['Dashboard']['find'](_0x828e14)[_0x9ff9('0x2a')](handleEntityNotFound(_0x2da287,null))['then'](function(_0x477316){if(_0x477316){var _0x8fb40=_0x477316[_0x9ff9('0x2c')]({'plain':!![]});_0x8fb40=qs[_0x9ff9('0x59')](_0x8fb40,['id',_0x9ff9('0x5a'),_0x9ff9('0x5b')]);_0x527d0c['body']=_[_0x9ff9('0x59')](_0x527d0c[_0x9ff9('0x51')],['id',_0x9ff9('0x5a'),'updatedAt']);return db[_0x9ff9('0x46')][_0x9ff9('0x50')](_['merge'](_0x8fb40,_0x527d0c['body']),{'include':_0x527d0c[_0x9ff9('0x36')][_0x9ff9('0x47')]?[{'all':!![]}]:undefined})[_0x9ff9('0x2a')](function(_0xb42b1d){var _0x35572e=_0x527d0c[_0x9ff9('0x54')][_0x9ff9('0x2c')]({'plain':!![]});if(!_0x35572e)throw new Error(_0x9ff9('0x52'));if(_0x35572e[_0x9ff9('0x53')]===_0x9ff9('0x54')){var _0x5e9c70=_0xb42b1d['get']({'plain':!![]});var _0x4a88b9='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x4a88b9,'userProfileId':_0x35572e[_0x9ff9('0x56')]},'raw':!![]})['then'](function(_0x44b8fa){if(_0x44b8fa&&_0x44b8fa[_0x9ff9('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e9c70[_0x9ff9('0x31')],'resourceId':_0x5e9c70['id'],'type':_0x44b8fa[_0x9ff9('0x31')],'sectionId':_0x44b8fa['id']},{})[_0x9ff9('0x2a')](function(){return _0xb42b1d;});}else{return _0xb42b1d;}})[_0x9ff9('0x4b')](function(_0x47a842){logger['error'](_0x9ff9('0x57'),_0x47a842);throw _0x47a842;});}return _0xb42b1d;});}})[_0x9ff9('0x2a')](respondWithResult(_0x2da287,0xc9))[_0x9ff9('0x4b')](handleError(_0x2da287,null));};exports[_0x9ff9('0x29')]=function(_0x4d5a9c,_0x56bb6d){if(_0x4d5a9c[_0x9ff9('0x51')]['id']){delete _0x4d5a9c[_0x9ff9('0x51')]['id'];}return db[_0x9ff9('0x46')]['find']({'where':{'id':_0x4d5a9c['params']['id']}})[_0x9ff9('0x2a')](handleEntityNotFound(_0x56bb6d,null))['then'](saveUpdates(_0x4d5a9c[_0x9ff9('0x51')],null))['then'](respondWithResult(_0x56bb6d,null))['catch'](handleError(_0x56bb6d,null));};exports['destroy']=function(_0x153dae,_0x1117ef){return db[_0x9ff9('0x46')][_0x9ff9('0x4f')]({'where':{'id':_0x153dae['params']['id']}})['then'](handleEntityNotFound(_0x1117ef,null))[_0x9ff9('0x2a')](removeEntity(_0x1117ef,null))[_0x9ff9('0x4b')](handleError(_0x1117ef,null));};function widgetAttributes(_0x269d38){try{switch(_0x269d38[_0x9ff9('0x5d')]){case _0x9ff9('0x5e'):return[{'name':_0x9ff9('0x5f'),'value':_0x269d38[_0x9ff9('0x5f')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||_0x9ff9('0x62')}];case _0x9ff9('0x63'):return[{'name':_0x9ff9('0x64'),'value':_0x269d38[_0x9ff9('0x64')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38['attrs'][0x0][_0x9ff9('0x61')]:undefined)||''}];case _0x9ff9('0x65'):return[{'name':'attrHourFormat','value':_0x269d38['attrHourFormat']||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||_0x9ff9('0x66')},{'name':'attrTimezone','value':_0x269d38[_0x9ff9('0x67')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x1]?_0x269d38[_0x9ff9('0x60')][0x1]['value']:undefined)||'0.00'},{'name':_0x9ff9('0x68'),'value':_0x269d38[_0x9ff9('0x68')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x2]?_0x269d38[_0x9ff9('0x60')][0x2][_0x9ff9('0x61')]:undefined)||0xc}];case _0x9ff9('0x69'):return[{'name':_0x9ff9('0x6a'),'value':_0x269d38[_0x9ff9('0x6a')]||(_0x269d38['attrs']&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x269d38[_0x9ff9('0x6b')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x1]?_0x269d38[_0x9ff9('0x60')][0x1][_0x9ff9('0x61')]:undefined)||[]},{'name':_0x9ff9('0x68'),'value':_0x269d38[_0x9ff9('0x68')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x2]?_0x269d38['attrs'][0x2][_0x9ff9('0x61')]:undefined)||0x14}];case _0x9ff9('0x6c'):case _0x9ff9('0x6d'):return[{'name':_0x9ff9('0x6e'),'value':_0x269d38[_0x9ff9('0x6e')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||_0x9ff9('0x6f')},{'name':_0x9ff9('0x70'),'value':_0x269d38['attrSerie2']||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x1]?_0x269d38[_0x9ff9('0x60')][0x1][_0x9ff9('0x61')]:undefined)||null},{'name':_0x9ff9('0x71'),'value':_0x269d38[_0x9ff9('0x71')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x2]?_0x269d38[_0x9ff9('0x60')][0x2]['value']:undefined)||null},{'name':_0x9ff9('0x6b'),'value':_0x269d38[_0x9ff9('0x6b')]||(_0x269d38['attrs']&&_0x269d38[_0x9ff9('0x60')][0x3]?_0x269d38[_0x9ff9('0x60')][0x3][_0x9ff9('0x61')]:undefined)||[]}];case _0x9ff9('0x72'):return[{'name':'attrReport','type':_0x269d38[_0x9ff9('0x73')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x0]?_0x269d38['attrs'][0x0]['type']:undefined)||null,'value':_0x269d38[_0x9ff9('0x74')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38['attrs'][0x0]?_0x269d38[_0x9ff9('0x60')][0x0][_0x9ff9('0x61')]:undefined)||null},{'name':_0x9ff9('0x75'),'value':_0x269d38[_0x9ff9('0x75')]||(_0x269d38[_0x9ff9('0x60')]&&_0x269d38[_0x9ff9('0x60')][0x1]?_0x269d38[_0x9ff9('0x60')][0x1][_0x9ff9('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4a4b1c){logger['error'](_0x9ff9('0x76'),JSON['stringify'](_0x4a4b1c));return[];}}exports[_0x9ff9('0x77')]=function(_0x36a191,_0x338bb6,_0x57b669){if(_0x36a191[_0x9ff9('0x51')]['id']){delete _0x36a191[_0x9ff9('0x51')]['id'];}return db['Dashboard'][_0x9ff9('0x4f')]({'where':{'id':_0x36a191[_0x9ff9('0x4c')]['id']}})[_0x9ff9('0x2a')](handleEntityNotFound(_0x338bb6,null))[_0x9ff9('0x2a')](function(_0x1815c0){if(_0x1815c0){_0x36a191[_0x9ff9('0x51')]['DashboardId']=_0x1815c0['id'];_0x36a191['body'][_0x9ff9('0x60')]=widgetAttributes(_0x36a191[_0x9ff9('0x51')]);return db[_0x9ff9('0x78')][_0x9ff9('0x50')](_0x36a191['body']);}})[_0x9ff9('0x2a')](respondWithResult(_0x338bb6,null))[_0x9ff9('0x4b')](handleError(_0x338bb6,null));};exports['getItems']=function(_0x4ef934,_0xce2431,_0x20f4d2){var _0x55bc1f={};var _0x85a6d2={};var _0xd69893;var _0x24fba3;return db['Dashboard'][_0x9ff9('0x79')]({'where':{'id':_0x4ef934[_0x9ff9('0x4c')]['id']}})['then'](handleEntityNotFound(_0xce2431,null))[_0x9ff9('0x2a')](function(_0x1464c9){if(_0x1464c9){_0xd69893=_0x1464c9;_0x85a6d2['model']=_[_0x9ff9('0x4d')](db[_0x9ff9('0x78')]['rawAttributes']);_0x85a6d2['query']=_[_0x9ff9('0x4d')](_0x4ef934[_0x9ff9('0x36')]);_0x85a6d2[_0x9ff9('0x41')]=_[_0x9ff9('0x37')](_0x85a6d2[_0x9ff9('0x38')],_0x85a6d2[_0x9ff9('0x36')]);_0x55bc1f['attributes']=_[_0x9ff9('0x37')](_0x85a6d2[_0x9ff9('0x38')],qs[_0x9ff9('0x3a')](_0x4ef934['query'][_0x9ff9('0x3a')]));_0x55bc1f['attributes']=_0x55bc1f[_0x9ff9('0x39')][_0x9ff9('0x3b')]?_0x55bc1f[_0x9ff9('0x39')]:_0x85a6d2[_0x9ff9('0x38')];_0x55bc1f[_0x9ff9('0x3e')]=qs[_0x9ff9('0x3f')](_0x4ef934[_0x9ff9('0x36')][_0x9ff9('0x3f')]);_0x55bc1f[_0x9ff9('0x40')]=qs[_0x9ff9('0x41')](_[_0x9ff9('0x42')](_0x4ef934[_0x9ff9('0x36')],_0x85a6d2[_0x9ff9('0x41')]));if(_0x4ef934['query']['filter']){_0x55bc1f['where']=_[_0x9ff9('0x44')](_0x55bc1f[_0x9ff9('0x40')],{'$or':_[_0x9ff9('0x34')](_0x55bc1f[_0x9ff9('0x39')],function(_0x5d3c83){var _0x412d2f={};_0x412d2f[_0x5d3c83]={'$like':'%'+_0x4ef934['query']['filter']+'%'};return _0x412d2f;})});}_0x55bc1f=_[_0x9ff9('0x44')]({},_0x55bc1f,_0x4ef934['options']);return _0xd69893['getItems'](_0x55bc1f);}})['then'](function(_0x122b5b){if(_0x122b5b){_0x24fba3=_0x122b5b[_0x9ff9('0x3b')];if(!_0x4ef934[_0x9ff9('0x36')]['hasOwnProperty'](_0x9ff9('0x3d'))){_0x55bc1f[_0x9ff9('0x24')]=qs[_0x9ff9('0x24')](_0x4ef934[_0x9ff9('0x36')]['limit']);_0x55bc1f[_0x9ff9('0x23')]=qs[_0x9ff9('0x23')](_0x4ef934[_0x9ff9('0x36')][_0x9ff9('0x23')]);}return _0xd69893[_0x9ff9('0x7a')](_0x55bc1f);}})[_0x9ff9('0x2a')](function(_0xb93dfa){if(_0xb93dfa){return _0xb93dfa?{'count':_0x24fba3,'rows':_0xb93dfa}:null;}})[_0x9ff9('0x2a')](respondWithResult(_0xce2431,null))['catch'](handleError(_0xce2431,null));}; \ No newline at end of file +var _0x3acb=['keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','user','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','pick','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','query'];(function(_0x34191a,_0x12368d){var _0x377c39=function(_0x2c7db5){while(--_0x2c7db5){_0x34191a['push'](_0x34191a['shift']());}};_0x377c39(++_0x12368d);}(_0x3acb,0x126));var _0xb3ac=function(_0x511890,_0x100c2a){_0x511890=_0x511890-0x0;var _0x5dfc80=_0x3acb[_0x511890];return _0x5dfc80;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb3ac('0x0'));var moment=require(_0xb3ac('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb3ac('0x2'));var util=require(_0xb3ac('0x3'));var path=require(_0xb3ac('0x4'));var sox=require(_0xb3ac('0x5'));var csv=require(_0xb3ac('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3ac('0x7'));var squel=require('squel');var crypto=require(_0xb3ac('0x8'));var jsforce=require(_0xb3ac('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb3ac('0x6'));var querystring=require(_0xb3ac('0xa'));var Papa=require(_0xb3ac('0xb'));var Redis=require(_0xb3ac('0xc'));var authService=require(_0xb3ac('0xd'));var qs=require(_0xb3ac('0xe'));var as=require(_0xb3ac('0xf'));var hardwareService=require(_0xb3ac('0x10'));var logger=require(_0xb3ac('0x11'))(_0xb3ac('0x12'));var utils=require(_0xb3ac('0x13'));var config=require(_0xb3ac('0x14'));var licenseUtil=require(_0xb3ac('0x15'));var db=require(_0xb3ac('0x16'))['db'];config[_0xb3ac('0x17')]=_[_0xb3ac('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb3ac('0x19'))(new Redis(config[_0xb3ac('0x17')]));require('./dashboard.socket')[_0xb3ac('0x1a')](socket);function respondWithStatusCode(_0x2a099e,_0x3a0ab2){_0x3a0ab2=_0x3a0ab2||0xcc;return function(_0x535b15){if(_0x535b15){return _0x2a099e['sendStatus'](_0x3a0ab2);}return _0x2a099e[_0xb3ac('0x1b')](_0x3a0ab2)[_0xb3ac('0x1c')]();};}function respondWithResult(_0x50add0,_0x16be23){_0x16be23=_0x16be23||0xc8;return function(_0x3e32de){if(_0x3e32de){return _0x50add0[_0xb3ac('0x1b')](_0x16be23)[_0xb3ac('0x1d')](_0x3e32de);}};}function respondWithFilteredResult(_0x2a6b22,_0x5768cc){return function(_0x453f93){if(_0x453f93){var _0x50d425=_0x453f93[_0xb3ac('0x1e')],_0xc179bf=_0x5768cc['offset'],_0x22d0a1=_0x5768cc[_0xb3ac('0x1f')]+_0x5768cc[_0xb3ac('0x20')],_0x4d763c;if(_0x22d0a1>=_0x50d425){_0x22d0a1=_0x50d425;_0x4d763c=0xc8;}else{_0x4d763c=0xce;}_0x2a6b22[_0xb3ac('0x1b')](_0x4d763c);return _0x2a6b22[_0xb3ac('0x21')](_0xb3ac('0x22'),_0xc179bf+'-'+_0x22d0a1+'/'+_0x50d425)[_0xb3ac('0x1d')](_0x453f93);}return null;};}function patchUpdates(_0x4ef64a){return function(_0x23c3d3){try{jsonpatch[_0xb3ac('0x23')](_0x23c3d3,_0x4ef64a,!![]);}catch(_0x3fb97a){return BPromise['reject'](_0x3fb97a);}return _0x23c3d3[_0xb3ac('0x24')]();};}function saveUpdates(_0x80d568,_0x25f95d){return function(_0x3c23d6){if(_0x3c23d6){return _0x3c23d6[_0xb3ac('0x25')](_0x80d568)[_0xb3ac('0x26')](function(_0x20a036){return _0x20a036;});}return null;};}function removeEntity(_0xd9df91,_0x5e86fb){return function(_0x1ba373){if(_0x1ba373){return _0x1ba373[_0xb3ac('0x27')]()[_0xb3ac('0x26')](function(){var _0x5aea3c=_0x1ba373[_0xb3ac('0x28')]({'plain':!![]});var _0x1d0384='CustomDashboards';return db[_0xb3ac('0x29')][_0xb3ac('0x27')]({'where':{'type':_0x1d0384,'resourceId':_0x5aea3c['id']}})['then'](function(){return _0x1ba373;});})['then'](function(){_0xd9df91[_0xb3ac('0x1b')](0xcc)[_0xb3ac('0x1c')]();});}};}function handleEntityNotFound(_0x28222a,_0x3a4cab){return function(_0x407671){if(!_0x407671){_0x28222a[_0xb3ac('0x2a')](0x194);}return _0x407671;};}function handleError(_0x54c9e2,_0x564027){_0x564027=_0x564027||0x1f4;return function(_0xf49982){logger[_0xb3ac('0x2b')](_0xf49982[_0xb3ac('0x2c')]);if(_0xf49982[_0xb3ac('0x2d')]){delete _0xf49982[_0xb3ac('0x2d')];}_0x54c9e2['status'](_0x564027)['send'](_0xf49982);};}exports[_0xb3ac('0x2e')]=function(_0x1c34f2,_0x2574d9){var _0x3adc40={},_0x29f223={},_0x4666c5={'count':0x0,'rows':[]};var _0x551375=_[_0xb3ac('0x2f')](db[_0xb3ac('0x30')][_0xb3ac('0x31')],function(_0x1a2f73){return{'name':_0x1a2f73[_0xb3ac('0x32')],'type':_0x1a2f73[_0xb3ac('0x33')]['key']};});_0x29f223[_0xb3ac('0x34')]=_[_0xb3ac('0x2f')](_0x551375,_0xb3ac('0x2d'));_0x29f223[_0xb3ac('0x35')]=_[_0xb3ac('0x36')](_0x1c34f2['query']);_0x29f223[_0xb3ac('0x37')]=_[_0xb3ac('0x38')](_0x29f223[_0xb3ac('0x34')],_0x29f223[_0xb3ac('0x35')]);_0x3adc40[_0xb3ac('0x39')]=_[_0xb3ac('0x38')](_0x29f223[_0xb3ac('0x34')],qs['fields'](_0x1c34f2[_0xb3ac('0x35')]['fields']));_0x3adc40['attributes']=_0x3adc40[_0xb3ac('0x39')]['length']?_0x3adc40['attributes']:_0x29f223[_0xb3ac('0x34')];if(!_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x3a')](_0xb3ac('0x3b'))){_0x3adc40[_0xb3ac('0x20')]=qs[_0xb3ac('0x20')](_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x20')]);_0x3adc40[_0xb3ac('0x1f')]=qs['offset'](_0x1c34f2[_0xb3ac('0x35')]['offset']);}_0x3adc40[_0xb3ac('0x3c')]=qs[_0xb3ac('0x3d')](_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x3d')]);_0x3adc40[_0xb3ac('0x3e')]=qs[_0xb3ac('0x37')](_['pick'](_0x1c34f2[_0xb3ac('0x35')],_0x29f223['filters']),_0x551375);if(_0x1c34f2['query'][_0xb3ac('0x3f')]){_0x3adc40[_0xb3ac('0x3e')]=_[_0xb3ac('0x40')](_0x3adc40[_0xb3ac('0x3e')],{'$or':_[_0xb3ac('0x2f')](_0x551375,function(_0x564b2f){if(_0x564b2f[_0xb3ac('0x33')]!==_0xb3ac('0x41')){var _0x4629e8={};_0x4629e8[_0x564b2f[_0xb3ac('0x2d')]]={'$like':'%'+_0x1c34f2[_0xb3ac('0x35')]['filter']+'%'};return _0x4629e8;}})});}_0x3adc40=_[_0xb3ac('0x40')]({},_0x3adc40,_0x1c34f2[_0xb3ac('0x42')]);var _0x203527={'where':_0x3adc40['where']};return db['Dashboard']['count'](_0x203527)['then'](function(_0x1f283a){_0x4666c5[_0xb3ac('0x1e')]=_0x1f283a;if(_0x1c34f2[_0xb3ac('0x35')][_0xb3ac('0x43')]){_0x3adc40[_0xb3ac('0x44')]=[{'all':!![]}];}return db[_0xb3ac('0x30')][_0xb3ac('0x45')](_0x3adc40);})[_0xb3ac('0x26')](function(_0x1d16e5){_0x4666c5[_0xb3ac('0x46')]=_0x1d16e5;return _0x4666c5;})[_0xb3ac('0x26')](respondWithFilteredResult(_0x2574d9,_0x3adc40))['catch'](handleError(_0x2574d9,null));};exports[_0xb3ac('0x47')]=function(_0x430b11,_0x256c65){var _0x3d191a={'raw':![],'where':{'id':_0x430b11[_0xb3ac('0x48')]['id']}},_0x21cfd4={};_0x21cfd4[_0xb3ac('0x34')]=_[_0xb3ac('0x36')](db[_0xb3ac('0x30')][_0xb3ac('0x31')]);_0x21cfd4['query']=_[_0xb3ac('0x36')](_0x430b11['query']);_0x21cfd4[_0xb3ac('0x37')]=_[_0xb3ac('0x38')](_0x21cfd4[_0xb3ac('0x34')],_0x21cfd4[_0xb3ac('0x35')]);_0x3d191a[_0xb3ac('0x39')]=_[_0xb3ac('0x38')](_0x21cfd4[_0xb3ac('0x34')],qs['fields'](_0x430b11['query']['fields']));_0x3d191a['attributes']=_0x3d191a['attributes'][_0xb3ac('0x49')]?_0x3d191a[_0xb3ac('0x39')]:_0x21cfd4[_0xb3ac('0x34')];if(_0x430b11[_0xb3ac('0x35')][_0xb3ac('0x43')]){_0x3d191a[_0xb3ac('0x44')]=[{'all':!![]}];}_0x3d191a=_['merge']({},_0x3d191a,_0x430b11['options']);return db[_0xb3ac('0x30')][_0xb3ac('0x4a')](_0x3d191a)[_0xb3ac('0x26')](handleEntityNotFound(_0x256c65,null))[_0xb3ac('0x26')](respondWithResult(_0x256c65,null))[_0xb3ac('0x4b')](handleError(_0x256c65,null));};exports['create']=function(_0x386e52,_0x5ef450){return db[_0xb3ac('0x30')][_0xb3ac('0x4c')](_0x386e52['body'],{})[_0xb3ac('0x26')](function(_0x119a19){var _0x3b0b83=_0x386e52['user'][_0xb3ac('0x28')]({'plain':!![]});if(!_0x3b0b83)throw new Error(_0xb3ac('0x4d'));if(_0x3b0b83['role']==='user'){var _0x248452=_0x119a19[_0xb3ac('0x28')]({'plain':!![]});var _0x4d9cdd=_0xb3ac('0x4e');return db[_0xb3ac('0x4f')][_0xb3ac('0x4a')]({'where':{'name':_0x4d9cdd,'userProfileId':_0x3b0b83[_0xb3ac('0x50')]},'raw':!![]})[_0xb3ac('0x26')](function(_0x1d5282){if(_0x1d5282&&_0x1d5282[_0xb3ac('0x51')]===0x0){return db[_0xb3ac('0x29')][_0xb3ac('0x4c')]({'name':_0x248452[_0xb3ac('0x2d')],'resourceId':_0x248452['id'],'type':_0x1d5282[_0xb3ac('0x2d')],'sectionId':_0x1d5282['id']},{})['then'](function(){return _0x119a19;});}else{return _0x119a19;}})[_0xb3ac('0x4b')](function(_0x12c4c2){logger[_0xb3ac('0x2b')](_0xb3ac('0x52'),_0x12c4c2);throw _0x12c4c2;});}return _0x119a19;})[_0xb3ac('0x26')](respondWithResult(_0x5ef450,0xc9))[_0xb3ac('0x4b')](handleError(_0x5ef450,null));};exports['clone']=function(_0x261f58,_0x280bc7){var _0x3ebcdb={'where':{'id':_0x261f58['params']['id']}},_0x508244={};_0x508244[_0xb3ac('0x34')]=_['keys'](db['Dashboard']['rawAttributes']);_0x3ebcdb[_0xb3ac('0x39')]=_['intersection'](_0x508244[_0xb3ac('0x34')],qs['fields'](_0x261f58[_0xb3ac('0x35')]['fields']));_0x3ebcdb[_0xb3ac('0x39')]=_0x3ebcdb[_0xb3ac('0x39')][_0xb3ac('0x49')]?_0x3ebcdb[_0xb3ac('0x39')]:_0x508244[_0xb3ac('0x34')];if(_0x261f58[_0xb3ac('0x35')]['includeAll']){_0x3ebcdb[_0xb3ac('0x44')]=[{'all':!![]}];}_0x3ebcdb=_[_0xb3ac('0x40')]({},_0x3ebcdb,_0x261f58[_0xb3ac('0x42')]);return db[_0xb3ac('0x30')][_0xb3ac('0x4a')](_0x3ebcdb)[_0xb3ac('0x26')](handleEntityNotFound(_0x280bc7,null))[_0xb3ac('0x26')](function(_0x4bbe9b){if(_0x4bbe9b){var _0x2b8a9d=_0x4bbe9b[_0xb3ac('0x28')]({'plain':!![]});_0x2b8a9d=qs[_0xb3ac('0x53')](_0x2b8a9d,['id',_0xb3ac('0x54'),_0xb3ac('0x55')]);_0x261f58['body']=_[_0xb3ac('0x53')](_0x261f58['body'],['id',_0xb3ac('0x54'),_0xb3ac('0x55')]);return db[_0xb3ac('0x30')][_0xb3ac('0x4c')](_[_0xb3ac('0x40')](_0x2b8a9d,_0x261f58[_0xb3ac('0x56')]),{'include':_0x261f58[_0xb3ac('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4c871a){var _0x30c334=_0x261f58[_0xb3ac('0x57')][_0xb3ac('0x28')]({'plain':!![]});if(!_0x30c334)throw new Error(_0xb3ac('0x4d'));if(_0x30c334['role']===_0xb3ac('0x57')){var _0x51788a=_0x4c871a[_0xb3ac('0x28')]({'plain':!![]});var _0x15121a='CustomDashboards';return db[_0xb3ac('0x4f')][_0xb3ac('0x4a')]({'where':{'name':_0x15121a,'userProfileId':_0x30c334[_0xb3ac('0x50')]},'raw':!![]})[_0xb3ac('0x26')](function(_0x3fdc24){if(_0x3fdc24&&_0x3fdc24[_0xb3ac('0x51')]===0x0){return db['UserProfileResource'][_0xb3ac('0x4c')]({'name':_0x51788a['name'],'resourceId':_0x51788a['id'],'type':_0x3fdc24['name'],'sectionId':_0x3fdc24['id']},{})[_0xb3ac('0x26')](function(){return _0x4c871a;});}else{return _0x4c871a;}})['catch'](function(_0x297285){logger['error'](_0xb3ac('0x52'),_0x297285);throw _0x297285;});}return _0x4c871a;});}})['then'](respondWithResult(_0x280bc7,0xc9))[_0xb3ac('0x4b')](handleError(_0x280bc7,null));};exports[_0xb3ac('0x25')]=function(_0x9961de,_0x6d25c1){if(_0x9961de[_0xb3ac('0x56')]['id']){delete _0x9961de[_0xb3ac('0x56')]['id'];}return db['Dashboard'][_0xb3ac('0x4a')]({'where':{'id':_0x9961de[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x6d25c1,null))[_0xb3ac('0x26')](saveUpdates(_0x9961de['body'],null))[_0xb3ac('0x26')](respondWithResult(_0x6d25c1,null))['catch'](handleError(_0x6d25c1,null));};exports[_0xb3ac('0x27')]=function(_0x53eca9,_0x5a64f8){return db[_0xb3ac('0x30')][_0xb3ac('0x4a')]({'where':{'id':_0x53eca9[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x5a64f8,null))[_0xb3ac('0x26')](removeEntity(_0x5a64f8,null))[_0xb3ac('0x4b')](handleError(_0x5a64f8,null));};function widgetAttributes(_0x44e666){try{switch(_0x44e666['type']){case _0xb3ac('0x58'):return[{'name':_0xb3ac('0x59'),'value':_0x44e666[_0xb3ac('0x59')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0]['value']:undefined)||_0xb3ac('0x5b')}];case _0xb3ac('0x5c'):return[{'name':_0xb3ac('0x5d'),'value':_0x44e666['attrPath']||(_0x44e666['attrs']&&_0x44e666['attrs'][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0][_0xb3ac('0x5e')]:undefined)||''}];case _0xb3ac('0x5f'):return[{'name':'attrHourFormat','value':_0x44e666[_0xb3ac('0x60')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666['attrs'][0x0][_0xb3ac('0x5e')]:undefined)||_0xb3ac('0x61')},{'name':_0xb3ac('0x62'),'value':_0x44e666['attrTimezone']||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1]['value']:undefined)||_0xb3ac('0x63')},{'name':'attrFontSize','value':_0x44e666[_0xb3ac('0x64')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x2]?_0x44e666[_0xb3ac('0x5a')][0x2]['value']:undefined)||0xc}];case _0xb3ac('0x65'):return[{'name':'attrMetric','value':_0x44e666['attrMetric']||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0][_0xb3ac('0x5e')]:undefined)||_0xb3ac('0x66')},{'name':_0xb3ac('0x67'),'value':_0x44e666[_0xb3ac('0x67')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1][_0xb3ac('0x5e')]:undefined)||[]},{'name':_0xb3ac('0x64'),'value':_0x44e666[_0xb3ac('0x64')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x2]?_0x44e666['attrs'][0x2][_0xb3ac('0x5e')]:undefined)||0x14}];case _0xb3ac('0x68'):case _0xb3ac('0x69'):return[{'name':'attrSerie1','value':_0x44e666['attrSerie1']||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666['attrs'][0x0][_0xb3ac('0x5e')]:undefined)||_0xb3ac('0x66')},{'name':_0xb3ac('0x6a'),'value':_0x44e666[_0xb3ac('0x6a')]||(_0x44e666['attrs']&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1][_0xb3ac('0x5e')]:undefined)||null},{'name':_0xb3ac('0x6b'),'value':_0x44e666[_0xb3ac('0x6b')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x2]?_0x44e666[_0xb3ac('0x5a')][0x2][_0xb3ac('0x5e')]:undefined)||null},{'name':_0xb3ac('0x67'),'value':_0x44e666[_0xb3ac('0x67')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x3]?_0x44e666[_0xb3ac('0x5a')][0x3][_0xb3ac('0x5e')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x44e666['reportType']||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666['attrs'][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0]['type']:undefined)||null,'value':_0x44e666[_0xb3ac('0x6c')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x0]?_0x44e666[_0xb3ac('0x5a')][0x0][_0xb3ac('0x5e')]:undefined)||null},{'name':'attrRefresh','value':_0x44e666[_0xb3ac('0x6d')]||(_0x44e666[_0xb3ac('0x5a')]&&_0x44e666[_0xb3ac('0x5a')][0x1]?_0x44e666[_0xb3ac('0x5a')][0x1][_0xb3ac('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x30663a){logger['error']('widgetAttributes:\x20%s',JSON[_0xb3ac('0x6e')](_0x30663a));return[];}}exports[_0xb3ac('0x6f')]=function(_0x525427,_0x457f49,_0x10904a){if(_0x525427[_0xb3ac('0x56')]['id']){delete _0x525427[_0xb3ac('0x56')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x525427[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x457f49,null))[_0xb3ac('0x26')](function(_0x5c56f5){if(_0x5c56f5){_0x525427['body'][_0xb3ac('0x70')]=_0x5c56f5['id'];_0x525427[_0xb3ac('0x56')][_0xb3ac('0x5a')]=widgetAttributes(_0x525427[_0xb3ac('0x56')]);return db[_0xb3ac('0x71')]['create'](_0x525427[_0xb3ac('0x56')]);}})[_0xb3ac('0x26')](respondWithResult(_0x457f49,null))[_0xb3ac('0x4b')](handleError(_0x457f49,null));};exports[_0xb3ac('0x72')]=function(_0x4d39d8,_0x53ecdc,_0x3ff67f){var _0x3ce3c7={};var _0x52e0b0={};var _0x454b6e;var _0x2a9a5a;return db[_0xb3ac('0x30')]['findOne']({'where':{'id':_0x4d39d8[_0xb3ac('0x48')]['id']}})[_0xb3ac('0x26')](handleEntityNotFound(_0x53ecdc,null))[_0xb3ac('0x26')](function(_0x491f82){if(_0x491f82){_0x454b6e=_0x491f82;_0x52e0b0[_0xb3ac('0x34')]=_[_0xb3ac('0x36')](db[_0xb3ac('0x71')]['rawAttributes']);_0x52e0b0[_0xb3ac('0x35')]=_['keys'](_0x4d39d8[_0xb3ac('0x35')]);_0x52e0b0[_0xb3ac('0x37')]=_[_0xb3ac('0x38')](_0x52e0b0[_0xb3ac('0x34')],_0x52e0b0[_0xb3ac('0x35')]);_0x3ce3c7[_0xb3ac('0x39')]=_[_0xb3ac('0x38')](_0x52e0b0[_0xb3ac('0x34')],qs['fields'](_0x4d39d8[_0xb3ac('0x35')]['fields']));_0x3ce3c7[_0xb3ac('0x39')]=_0x3ce3c7[_0xb3ac('0x39')][_0xb3ac('0x49')]?_0x3ce3c7[_0xb3ac('0x39')]:_0x52e0b0[_0xb3ac('0x34')];_0x3ce3c7['order']=qs[_0xb3ac('0x3d')](_0x4d39d8[_0xb3ac('0x35')]['sort']);_0x3ce3c7[_0xb3ac('0x3e')]=qs['filters'](_[_0xb3ac('0x73')](_0x4d39d8['query'],_0x52e0b0[_0xb3ac('0x37')]));if(_0x4d39d8['query']['filter']){_0x3ce3c7[_0xb3ac('0x3e')]=_['merge'](_0x3ce3c7[_0xb3ac('0x3e')],{'$or':_['map'](_0x3ce3c7[_0xb3ac('0x39')],function(_0x369814){var _0x2c8e6f={};_0x2c8e6f[_0x369814]={'$like':'%'+_0x4d39d8[_0xb3ac('0x35')]['filter']+'%'};return _0x2c8e6f;})});}_0x3ce3c7=_[_0xb3ac('0x40')]({},_0x3ce3c7,_0x4d39d8[_0xb3ac('0x42')]);return _0x454b6e[_0xb3ac('0x72')](_0x3ce3c7);}})[_0xb3ac('0x26')](function(_0x12fd27){if(_0x12fd27){_0x2a9a5a=_0x12fd27[_0xb3ac('0x49')];if(!_0x4d39d8[_0xb3ac('0x35')][_0xb3ac('0x3a')](_0xb3ac('0x3b'))){_0x3ce3c7['limit']=qs[_0xb3ac('0x20')](_0x4d39d8[_0xb3ac('0x35')]['limit']);_0x3ce3c7['offset']=qs[_0xb3ac('0x1f')](_0x4d39d8[_0xb3ac('0x35')]['offset']);}return _0x454b6e[_0xb3ac('0x72')](_0x3ce3c7);}})['then'](function(_0x524c5a){if(_0x524c5a){return _0x524c5a?{'count':_0x2a9a5a,'rows':_0x524c5a}:null;}})[_0xb3ac('0x26')](respondWithResult(_0x53ecdc,null))[_0xb3ac('0x4b')](handleError(_0x53ecdc,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6e111ff..0497a23 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 _0x5a87=['Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x5a87,0x148));var _0x75a8=function(_0x51f2bf,_0x560324){_0x51f2bf=_0x51f2bf-0x0;var _0x1af141=_0x5a87[_0x51f2bf];return _0x1af141;};'use strict';var EventEmitter=require(_0x75a8('0x0'));var Dashboard=require(_0x75a8('0x1'))['db'][_0x75a8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x75a8('0x3')](0x0);var events={'afterCreate':_0x75a8('0x4'),'afterUpdate':_0x75a8('0x5'),'afterDestroy':_0x75a8('0x6')};function emitEvent(_0x384979){return function(_0x2b37ac,_0x2112e9,_0x2d5e2b){DashboardEvents[_0x75a8('0x7')](_0x384979+':'+_0x2b37ac['id'],_0x2b37ac);DashboardEvents[_0x75a8('0x7')](_0x384979,_0x2b37ac);_0x2d5e2b(null);};}for(var e in events){if(events[_0x75a8('0x8')](e)){var event=events[e];Dashboard[_0x75a8('0x9')](e,emitEvent(event));}}module[_0x75a8('0xa')]=DashboardEvents; \ No newline at end of file +var _0x93d2=['exports','events','setMaxListeners','update','remove','emit'];(function(_0x262f42,_0x4a6ca0){var _0x2b0712=function(_0x406fb8){while(--_0x406fb8){_0x262f42['push'](_0x262f42['shift']());}};_0x2b0712(++_0x4a6ca0);}(_0x93d2,0x151));var _0x293d=function(_0x57bd1c,_0x23fdcd){_0x57bd1c=_0x57bd1c-0x0;var _0x1be449=_0x93d2[_0x57bd1c];return _0x1be449;};'use strict';var EventEmitter=require(_0x293d('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x293d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x293d('0x2'),'afterDestroy':_0x293d('0x3')};function emitEvent(_0x8e3e3e){return function(_0x592373,_0x1b7fe3,_0x47d84e){DashboardEvents['emit'](_0x8e3e3e+':'+_0x592373['id'],_0x592373);DashboardEvents[_0x293d('0x4')](_0x8e3e3e,_0x592373);_0x47d84e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x293d('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8a5ada1..d4883cd 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 _0xe6fe=['bluebird','request-promise','path','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x4cbe85,_0xc8880d){var _0x129048=function(_0xb5994c){while(--_0xb5994c){_0x4cbe85['push'](_0x4cbe85['shift']());}};_0x129048(++_0xc8880d);}(_0xe6fe,0xdf));var _0xee6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe6fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee6f('0x0'));var util=require(_0xee6f('0x1'));var logger=require(_0xee6f('0x2'))(_0xee6f('0x3'));var moment=require(_0xee6f('0x4'));var BPromise=require(_0xee6f('0x5'));var rp=require(_0xee6f('0x6'));var fs=require('fs');var path=require(_0xee6f('0x7'));var rimraf=require('rimraf');var config=require(_0xee6f('0x8'));var attributes=require(_0xee6f('0x9'));module['exports']=function(_0x2601ed,_0x3d8739){return _0x2601ed['define'](_0xee6f('0xa'),attributes,{'tableName':_0xee6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe81a=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe81a,0x93));var _0xae81=function(_0x215797,_0x49d505){_0x215797=_0x215797-0x0;var _0x4a3697=_0xe81a[_0x215797];return _0x4a3697;};'use strict';var _=require('lodash');var util=require(_0xae81('0x0'));var logger=require(_0xae81('0x1'))(_0xae81('0x2'));var moment=require(_0xae81('0x3'));var BPromise=require(_0xae81('0x4'));var rp=require(_0xae81('0x5'));var fs=require('fs');var path=require(_0xae81('0x6'));var rimraf=require(_0xae81('0x7'));var config=require(_0xae81('0x8'));var attributes=require(_0xae81('0x9'));module[_0xae81('0xa')]=function(_0x3714ca,_0x1681c3){return _0x3714ca[_0xae81('0xb')](_0xae81('0xc'),attributes,{'tableName':_0xae81('0xd'),'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 c8eeee7..cfce50b 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 _0x6334=['client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4c8fd8,_0x21956a){var _0x9103f=function(_0x34473e){while(--_0x34473e){_0x4c8fd8['push'](_0x4c8fd8['shift']());}};_0x9103f(++_0x21956a);}(_0x6334,0x7f));var _0x4633=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0x6334[_0x23c3f4];return _0x82f0f1;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4633('0x3'));var db=require(_0x4633('0x4'))['db'];var utils=require(_0x4633('0x5'));var logger=require(_0x4633('0x6'))('rpc');var config=require(_0x4633('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4633('0x8')][_0x4633('0x9')]({'port':0x232a});config[_0x4633('0xa')]=_[_0x4633('0xb')](config[_0x4633('0xa')],{'host':_0x4633('0xc'),'port':0x18eb});var socket=require(_0x4633('0xd'))(new Redis(config[_0x4633('0xa')]));require(_0x4633('0xe'))[_0x4633('0xf')](socket);function respondWithRpcPromise(_0x1a21f1,_0x248173,_0xa153d9){return new BPromise(function(_0x142125,_0x189b54){return client[_0x4633('0x10')](_0x1a21f1,_0xa153d9)[_0x4633('0x11')](function(_0x4b65b9){logger[_0x4633('0x12')](_0x4633('0x13'),_0x248173,_0x4633('0x14'));logger[_0x4633('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x248173,'request\x20sent',JSON[_0x4633('0x16')](_0x4b65b9));if(_0x4b65b9[_0x4633('0x17')]){if(_0x4b65b9[_0x4633('0x17')][_0x4633('0x18')]===0x1f4){logger[_0x4633('0x17')](_0x4633('0x13'),_0x248173,_0x4b65b9[_0x4633('0x17')][_0x4633('0x19')]);return _0x189b54(_0x4b65b9[_0x4633('0x17')][_0x4633('0x19')]);}logger[_0x4633('0x17')]('Dashboard,\x20%s,\x20%s',_0x248173,_0x4b65b9[_0x4633('0x17')]['message']);return _0x142125(_0x4b65b9[_0x4633('0x17')][_0x4633('0x19')]);}else{logger[_0x4633('0x12')](_0x4633('0x13'),_0x248173,_0x4633('0x14'));_0x142125(_0x4b65b9[_0x4633('0x1a')][_0x4633('0x19')]);}})['catch'](function(_0x2d74f0){logger[_0x4633('0x17')](_0x4633('0x13'),_0x248173,_0x2d74f0);_0x189b54(_0x2d74f0);});});} \ No newline at end of file +var _0x0e22=['./dashboard.socket','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3720c0,_0x12ddce){var _0x1a44aa=function(_0x1a2f05){while(--_0x1a2f05){_0x3720c0['push'](_0x3720c0['shift']());}};_0x1a44aa(++_0x12ddce);}(_0x0e22,0x9d));var _0x20e2=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x0e22[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0x20e2('0x0'));var util=require(_0x20e2('0x1'));var moment=require(_0x20e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x20e2('0x3'));var fs=require('fs');var Redis=require(_0x20e2('0x4'));var db=require(_0x20e2('0x5'))['db'];var utils=require(_0x20e2('0x6'));var logger=require(_0x20e2('0x7'))(_0x20e2('0x8'));var config=require(_0x20e2('0x9'));var jayson=require(_0x20e2('0xa'));var client=jayson[_0x20e2('0xb')][_0x20e2('0xc')]({'port':0x232a});config[_0x20e2('0xd')]=_[_0x20e2('0xe')](config[_0x20e2('0xd')],{'host':_0x20e2('0xf'),'port':0x18eb});var socket=require(_0x20e2('0x10'))(new Redis(config[_0x20e2('0xd')]));require(_0x20e2('0x11'))['register'](socket);function respondWithRpcPromise(_0x38d141,_0x1c79f7,_0x1a770a){return new BPromise(function(_0x38a83b,_0x414992){return client[_0x20e2('0x12')](_0x38d141,_0x1a770a)[_0x20e2('0x13')](function(_0x63dfed){logger[_0x20e2('0x14')]('Dashboard,\x20%s,\x20%s',_0x1c79f7,_0x20e2('0x15'));logger[_0x20e2('0x16')](_0x20e2('0x17'),_0x1c79f7,_0x20e2('0x15'),JSON[_0x20e2('0x18')](_0x63dfed));if(_0x63dfed[_0x20e2('0x19')]){if(_0x63dfed[_0x20e2('0x19')]['code']===0x1f4){logger[_0x20e2('0x19')](_0x20e2('0x1a'),_0x1c79f7,_0x63dfed[_0x20e2('0x19')][_0x20e2('0x1b')]);return _0x414992(_0x63dfed[_0x20e2('0x19')]['message']);}logger[_0x20e2('0x19')](_0x20e2('0x1a'),_0x1c79f7,_0x63dfed['error']['message']);return _0x38a83b(_0x63dfed[_0x20e2('0x19')][_0x20e2('0x1b')]);}else{logger[_0x20e2('0x14')](_0x20e2('0x1a'),_0x1c79f7,'request\x20sent');_0x38a83b(_0x63dfed[_0x20e2('0x1c')][_0x20e2('0x1b')]);}})['catch'](function(_0x300e3c){logger['error'](_0x20e2('0x1a'),_0x1c79f7,_0x300e3c);_0x414992(_0x300e3c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 353190c..69dbd05 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 _0xa521=['./dashboard.events','remove','update','removeListener','register','dashboard:'];(function(_0x99f5e7,_0x3e6f9d){var _0x183688=function(_0x55e9ef){while(--_0x55e9ef){_0x99f5e7['push'](_0x99f5e7['shift']());}};_0x183688(++_0x3e6f9d);}(_0xa521,0x12c));var _0x1a52=function(_0x5aa22d,_0x16b722){_0x5aa22d=_0x5aa22d-0x0;var _0x3ad1ac=_0xa521[_0x5aa22d];return _0x3ad1ac;};'use strict';var DashboardEvents=require(_0x1a52('0x0'));var events=['save',_0x1a52('0x1'),_0x1a52('0x2')];function createListener(_0x27404d,_0x4a5e90){return function(_0x154f0c){_0x4a5e90['emit'](_0x27404d,_0x154f0c);};}function removeListener(_0x528468,_0x49153f){return function(){DashboardEvents[_0x1a52('0x3')](_0x528468,_0x49153f);};}exports[_0x1a52('0x4')]=function(_0x4bdbd3){for(var _0x1075eb=0x0,_0x3ced6e=events['length'];_0x1075eb<_0x3ced6e;_0x1075eb++){var _0x180688=events[_0x1075eb];var _0x461a60=createListener(_0x1a52('0x5')+_0x180688,_0x4bdbd3);DashboardEvents['on'](_0x180688,_0x461a60);}}; \ No newline at end of file +var _0x1df0=['register','length','dashboard:','save','remove','emit','removeListener'];(function(_0x4f225d,_0x343382){var _0x668c98=function(_0x197dcc){while(--_0x197dcc){_0x4f225d['push'](_0x4f225d['shift']());}};_0x668c98(++_0x343382);}(_0x1df0,0xff));var _0x01df=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x1df0[_0x278e3c];return _0x3e2d9b;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x01df('0x0'),_0x01df('0x1'),'update'];function createListener(_0x2cea75,_0x41457e){return function(_0x2bde56){_0x41457e[_0x01df('0x2')](_0x2cea75,_0x2bde56);};}function removeListener(_0x2f3e7e,_0x3ce13a){return function(){DashboardEvents[_0x01df('0x3')](_0x2f3e7e,_0x3ce13a);};}exports[_0x01df('0x4')]=function(_0x1a3073){for(var _0x27ac63=0x0,_0x4ff049=events[_0x01df('0x5')];_0x27ac63<_0x4ff049;_0x27ac63++){var _0x48b103=events[_0x27ac63];var _0x524b82=createListener(_0x01df('0x6')+_0x48b103,_0x1a3073);DashboardEvents['on'](_0x48b103,_0x524b82);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b06fb8a..84f8c9a 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 _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(_0x4522f3,_0x522a52){var _0x25a7ad=function(_0x4925ad){while(--_0x4925ad){_0x4522f3['push'](_0x4522f3['shift']());}};_0x25a7ad(++_0x522a52);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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 +var _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xcb91[_0x21bfab];return _0x4db318;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 56320c2..b851323 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 _0x9d69=['#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT','long','setDataValue','attrs','stringify','INTEGER'];(function(_0x151205,_0xb040ff){var _0x5075aa=function(_0x12c97a){while(--_0x12c97a){_0x151205['push'](_0x151205['shift']());}};_0x5075aa(++_0xb040ff);}(_0x9d69,0x19a));var _0x99d6=function(_0x478163,_0x117ec5){_0x478163=_0x478163-0x0;var _0x56c43c=_0x9d69[_0x478163];return _0x56c43c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x99d6('0x0'));var _=require(_0x99d6('0x1'));module[_0x99d6('0x2')]={'title':{'type':Sequelize[_0x99d6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x99d6('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x99d6('0x4')](_0x99d6('0x5')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x4eb8f9){return[];}},'set':function(_0x31e866){try{this[_0x99d6('0x6')](_0x99d6('0x7'),JSON[_0x99d6('0x8')](_0x31e866));}catch(_0xe36e6){this[_0x99d6('0x6')]('attrs',JSON[_0x99d6('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x99d6('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x99d6('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x99d6('0x9')]},'col':{'type':Sequelize[_0x99d6('0x9')]},'background':{'type':Sequelize[_0x99d6('0x3')],'allowNull':![],'defaultValue':_0x99d6('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x99d6('0x3')],'allowNull':![],'defaultValue':_0x99d6('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d62=['stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue'];(function(_0x10edc1,_0x445617){var _0x66f1a8=function(_0x5ef233){while(--_0x5ef233){_0x10edc1['push'](_0x10edc1['shift']());}};_0x66f1a8(++_0x445617);}(_0x8d62,0x122));var _0x28d6=function(_0x5f5d46,_0x146800){_0x5f5d46=_0x5f5d46-0x0;var _0x33d8d3=_0x8d62[_0x5f5d46];return _0x33d8d3;};'use strict';var Sequelize=require(_0x28d6('0x0'));var squel=require('squel');var _=require(_0x28d6('0x1'));module[_0x28d6('0x2')]={'title':{'type':Sequelize[_0x28d6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x28d6('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x28d6('0x4')]('long'),'get':function(){try{return JSON[_0x28d6('0x5')](this[_0x28d6('0x6')](_0x28d6('0x7')));}catch(_0x6fa307){return[];}},'set':function(_0x53dcf6){try{this[_0x28d6('0x8')](_0x28d6('0x7'),JSON[_0x28d6('0x9')](_0x53dcf6));}catch(_0x1016d8){this[_0x28d6('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x28d6('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x28d6('0xa')]},'col':{'type':Sequelize[_0x28d6('0xa')]},'background':{'type':Sequelize[_0x28d6('0x3')],'allowNull':![],'defaultValue':_0x28d6('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x28d6('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x28d6('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 2a9e665..8fecd40 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 _0x4482=['util','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status','json','offset','limit','set','apply','then','error','name','send','show','params','model','DashboardItem','keys','query','filters','intersection','attributes','fields','length','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x263418,_0x2555a9){var _0x2a66c4=function(_0x304fd2){while(--_0x304fd2){_0x263418['push'](_0x263418['shift']());}};_0x2a66c4(++_0x2555a9);}(_0x4482,0x198));var _0x2448=function(_0x386426,_0xa4983b){_0x386426=_0x386426-0x0;var _0x584ff0=_0x4482[_0x386426];return _0x584ff0;};'use strict';var pdf=require(_0x2448('0x0'));var emlformat=require(_0x2448('0x1'));var rimraf=require(_0x2448('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2448('0x3'));var rp=require(_0x2448('0x4'));var moment=require('moment');var BPromise=require(_0x2448('0x5'));var Mustache=require(_0x2448('0x6'));var util=require(_0x2448('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2448('0x8'));var ejs=require(_0x2448('0x9'));var fs=require('fs');var _=require(_0x2448('0xa'));var squel=require(_0x2448('0xb'));var crypto=require(_0x2448('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2448('0x8'));var querystring=require(_0x2448('0xd'));var Papa=require('papaparse');var Redis=require(_0x2448('0xe'));var authService=require(_0x2448('0xf'));var qs=require(_0x2448('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2448('0x11'));var logger=require(_0x2448('0x12'))(_0x2448('0x13'));var utils=require(_0x2448('0x14'));var config=require(_0x2448('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2448('0x16'))['db'];config['redis']=_['defaults'](config[_0x2448('0x17')],{'host':_0x2448('0x18'),'port':0x18eb});var socket=require(_0x2448('0x19'))(new Redis(config['redis']));require(_0x2448('0x1a'))['register'](socket);function respondWithStatusCode(_0x3cd47d,_0x402298){_0x402298=_0x402298||0xcc;return function(_0x4fdd6b){if(_0x4fdd6b){return _0x3cd47d[_0x2448('0x1b')](_0x402298);}return _0x3cd47d['status'](_0x402298)[_0x2448('0x1c')]();};}function respondWithResult(_0xdc1da4,_0x216a1c){_0x216a1c=_0x216a1c||0xc8;return function(_0x1c064a){if(_0x1c064a){return _0xdc1da4[_0x2448('0x1d')](_0x216a1c)[_0x2448('0x1e')](_0x1c064a);}};}function respondWithFilteredResult(_0x48c182,_0xbb2a77){return function(_0x1d9a5b){if(_0x1d9a5b){var _0x20b061=_0x1d9a5b['count'],_0x115caa=_0xbb2a77[_0x2448('0x1f')],_0x44c6b0=_0xbb2a77[_0x2448('0x1f')]+_0xbb2a77[_0x2448('0x20')],_0x25fd63;if(_0x44c6b0>=_0x20b061){_0x44c6b0=_0x20b061;_0x25fd63=0xc8;}else{_0x25fd63=0xce;}_0x48c182[_0x2448('0x1d')](_0x25fd63);return _0x48c182[_0x2448('0x21')]('Content-Range',_0x115caa+'-'+_0x44c6b0+'/'+_0x20b061)['json'](_0x1d9a5b);}return null;};}function patchUpdates(_0x407c58){return function(_0x25ce87){try{jsonpatch[_0x2448('0x22')](_0x25ce87,_0x407c58,!![]);}catch(_0x471920){return BPromise['reject'](_0x471920);}return _0x25ce87['save']();};}function saveUpdates(_0x16f7b2,_0x471c6a){return function(_0x5ea032){if(_0x5ea032){return _0x5ea032['update'](_0x16f7b2)[_0x2448('0x23')](function(_0x451771){return _0x451771;});}return null;};}function removeEntity(_0x427ebe,_0x44a384){return function(_0x27a05a){if(_0x27a05a){return _0x27a05a['destroy']()[_0x2448('0x23')](function(){_0x427ebe[_0x2448('0x1d')](0xcc)[_0x2448('0x1c')]();});}};}function handleEntityNotFound(_0x1ede7a,_0x4c282d){return function(_0x54de0e){if(!_0x54de0e){_0x1ede7a[_0x2448('0x1b')](0x194);}return _0x54de0e;};}function handleError(_0x53df4b,_0x1c76a9){_0x1c76a9=_0x1c76a9||0x1f4;return function(_0x1a3e95){logger[_0x2448('0x24')](_0x1a3e95['stack']);if(_0x1a3e95[_0x2448('0x25')]){delete _0x1a3e95['name'];}_0x53df4b[_0x2448('0x1d')](_0x1c76a9)[_0x2448('0x26')](_0x1a3e95);};}exports[_0x2448('0x27')]=function(_0x39a9ad,_0x3530c4){var _0x3192da={'raw':![],'where':{'id':_0x39a9ad[_0x2448('0x28')]['id']}},_0x586667={};_0x586667[_0x2448('0x29')]=_['keys'](db[_0x2448('0x2a')]['rawAttributes']);_0x586667['query']=_[_0x2448('0x2b')](_0x39a9ad[_0x2448('0x2c')]);_0x586667[_0x2448('0x2d')]=_[_0x2448('0x2e')](_0x586667['model'],_0x586667[_0x2448('0x2c')]);_0x3192da[_0x2448('0x2f')]=_[_0x2448('0x2e')](_0x586667[_0x2448('0x29')],qs[_0x2448('0x30')](_0x39a9ad[_0x2448('0x2c')][_0x2448('0x30')]));_0x3192da['attributes']=_0x3192da[_0x2448('0x2f')][_0x2448('0x31')]?_0x3192da[_0x2448('0x2f')]:_0x586667['model'];if(_0x39a9ad[_0x2448('0x2c')]['includeAll']){_0x3192da['include']=[{'all':!![]}];}_0x3192da=_[_0x2448('0x32')]({},_0x3192da,_0x39a9ad[_0x2448('0x33')]);return db['DashboardItem'][_0x2448('0x34')](_0x3192da)[_0x2448('0x23')](handleEntityNotFound(_0x3530c4,null))[_0x2448('0x23')](respondWithResult(_0x3530c4,null))[_0x2448('0x35')](handleError(_0x3530c4,null));};exports[_0x2448('0x36')]=function(_0x21e791,_0x256eea){return db['DashboardItem'][_0x2448('0x34')]({'where':{'id':_0x21e791[_0x2448('0x28')]['id']}})['then'](handleEntityNotFound(_0x256eea,null))['then'](removeEntity(_0x256eea,null))[_0x2448('0x35')](handleError(_0x256eea,null));};function widgetAttributes(_0x5dd935){try{switch(_0x5dd935[_0x2448('0x37')]){case _0x2448('0x38'):return[{'name':_0x2448('0x39'),'value':_0x5dd935[_0x2448('0x39')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935[_0x2448('0x3a')][0x0][_0x2448('0x3b')]:undefined)||_0x2448('0x3c')}];case _0x2448('0x3d'):return[{'name':_0x2448('0x3e'),'value':_0x5dd935[_0x2448('0x3e')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935[_0x2448('0x3a')][0x0][_0x2448('0x3b')]:undefined)||''}];case _0x2448('0x3f'):return[{'name':_0x2448('0x40'),'value':_0x5dd935[_0x2448('0x40')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935['attrs'][0x0]?_0x5dd935[_0x2448('0x3a')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5dd935[_0x2448('0x41')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935[_0x2448('0x3a')][0x1][_0x2448('0x3b')]:undefined)||_0x2448('0x42')},{'name':_0x2448('0x43'),'value':_0x5dd935['attrFontSize']||(_0x5dd935['attrs']&&_0x5dd935[_0x2448('0x3a')][0x2]?_0x5dd935['attrs'][0x2][_0x2448('0x3b')]:undefined)||0xc}];case _0x2448('0x44'):return[{'name':'attrMetric','value':_0x5dd935[_0x2448('0x45')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935['attrs'][0x0][_0x2448('0x3b')]:undefined)||_0x2448('0x46')},{'name':_0x2448('0x47'),'value':_0x5dd935['attrVoiceQueues']||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935['attrs'][0x1][_0x2448('0x3b')]:undefined)||[]},{'name':_0x2448('0x43'),'value':_0x5dd935[_0x2448('0x43')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x2]?_0x5dd935['attrs'][0x2][_0x2448('0x3b')]:undefined)||0x14}];case _0x2448('0x48'):case'pie-chart':return[{'name':'attrSerie1','value':_0x5dd935[_0x2448('0x49')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935['attrs'][0x0]?_0x5dd935['attrs'][0x0][_0x2448('0x3b')]:undefined)||'total'},{'name':_0x2448('0x4a'),'value':_0x5dd935['attrSerie2']||(_0x5dd935['attrs']&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935['attrs'][0x1]['value']:undefined)||null},{'name':_0x2448('0x4b'),'value':_0x5dd935[_0x2448('0x4b')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x2]?_0x5dd935[_0x2448('0x3a')][0x2][_0x2448('0x3b')]:undefined)||null},{'name':_0x2448('0x47'),'value':_0x5dd935['attrVoiceQueues']||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x3]?_0x5dd935[_0x2448('0x3a')][0x3][_0x2448('0x3b')]:undefined)||[]}];case _0x2448('0x4c'):return[{'name':_0x2448('0x4d'),'type':_0x5dd935['reportType']||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x0]?_0x5dd935[_0x2448('0x3a')][0x0]['type']:undefined)||null,'value':_0x5dd935[_0x2448('0x4d')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935['attrs'][0x0]?_0x5dd935[_0x2448('0x3a')][0x0][_0x2448('0x3b')]:undefined)||null},{'name':_0x2448('0x4e'),'value':_0x5dd935[_0x2448('0x4e')]||(_0x5dd935[_0x2448('0x3a')]&&_0x5dd935[_0x2448('0x3a')][0x1]?_0x5dd935[_0x2448('0x3a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x114a81){logger[_0x2448('0x24')]('widgetAttributes:\x20%s',JSON[_0x2448('0x4f')](_0x114a81));return[];}}exports[_0x2448('0x50')]=function(_0x235bcd,_0x266149){if(_0x235bcd['body']){_0x235bcd[_0x2448('0x51')][_0x2448('0x3a')]=widgetAttributes(_0x235bcd[_0x2448('0x51')]);}return db[_0x2448('0x2a')][_0x2448('0x50')](_0x235bcd['body'],{})[_0x2448('0x23')](respondWithResult(_0x266149,0xc9))[_0x2448('0x35')](handleError(_0x266149,null));};exports[_0x2448('0x52')]=function(_0x288580,_0xef349e){if(_0x288580[_0x2448('0x51')]['id']){delete _0x288580[_0x2448('0x51')]['id'];}_0x288580[_0x2448('0x51')]['attrs']=widgetAttributes(_0x288580[_0x2448('0x51')]);return db[_0x2448('0x2a')][_0x2448('0x34')]({'where':{'id':_0x288580[_0x2448('0x28')]['id']}})[_0x2448('0x23')](handleEntityNotFound(_0xef349e,null))[_0x2448('0x23')](saveUpdates(_0x288580['body'],null))[_0x2448('0x23')](respondWithResult(_0xef349e,null))[_0x2448('0x35')](handleError(_0xef349e,null));}; \ No newline at end of file +var _0x765e=['stringify','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','find','catch','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','web-report','reportType','attrReport','attrRefresh','error','widgetAttributes:\x20%s'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x765e,0xa9));var _0xe765=function(_0x53b8c2,_0x26bade){_0x53b8c2=_0x53b8c2-0x0;var _0x21113c=_0x765e[_0x53b8c2];return _0x21113c;};'use strict';var pdf=require(_0xe765('0x0'));var emlformat=require(_0xe765('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe765('0x2'));var rp=require(_0xe765('0x3'));var moment=require(_0xe765('0x4'));var BPromise=require(_0xe765('0x5'));var Mustache=require('mustache');var util=require(_0xe765('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe765('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe765('0x8'));var squel=require(_0xe765('0x9'));var crypto=require(_0xe765('0xa'));var jsforce=require(_0xe765('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe765('0x7'));var querystring=require(_0xe765('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe765('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe765('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xe765('0xf'));var config=require(_0xe765('0x10'));var licenseUtil=require(_0xe765('0x11'));var db=require(_0xe765('0x12'))['db'];config[_0xe765('0x13')]=_[_0xe765('0x14')](config[_0xe765('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xe765('0x15'))(new Redis(config[_0xe765('0x13')]));require(_0xe765('0x16'))[_0xe765('0x17')](socket);function respondWithStatusCode(_0x293640,_0x3c4d25){_0x3c4d25=_0x3c4d25||0xcc;return function(_0x4a0ad4){if(_0x4a0ad4){return _0x293640[_0xe765('0x18')](_0x3c4d25);}return _0x293640[_0xe765('0x19')](_0x3c4d25)[_0xe765('0x1a')]();};}function respondWithResult(_0x9f7ee7,_0xbe650c){_0xbe650c=_0xbe650c||0xc8;return function(_0x38e68f){if(_0x38e68f){return _0x9f7ee7['status'](_0xbe650c)[_0xe765('0x1b')](_0x38e68f);}};}function respondWithFilteredResult(_0x10b319,_0x5f593c){return function(_0x1223e3){if(_0x1223e3){var _0x34a67c=_0x1223e3[_0xe765('0x1c')],_0x5107f8=_0x5f593c[_0xe765('0x1d')],_0x4dde97=_0x5f593c[_0xe765('0x1d')]+_0x5f593c[_0xe765('0x1e')],_0x3d75b5;if(_0x4dde97>=_0x34a67c){_0x4dde97=_0x34a67c;_0x3d75b5=0xc8;}else{_0x3d75b5=0xce;}_0x10b319[_0xe765('0x19')](_0x3d75b5);return _0x10b319['set']('Content-Range',_0x5107f8+'-'+_0x4dde97+'/'+_0x34a67c)[_0xe765('0x1b')](_0x1223e3);}return null;};}function patchUpdates(_0x50c0a6){return function(_0x507dec){try{jsonpatch[_0xe765('0x1f')](_0x507dec,_0x50c0a6,!![]);}catch(_0x114bcb){return BPromise[_0xe765('0x20')](_0x114bcb);}return _0x507dec[_0xe765('0x21')]();};}function saveUpdates(_0xb0157,_0x407fa9){return function(_0x5cc7af){if(_0x5cc7af){return _0x5cc7af[_0xe765('0x22')](_0xb0157)[_0xe765('0x23')](function(_0x586a76){return _0x586a76;});}return null;};}function removeEntity(_0x4657ef,_0x39efe5){return function(_0x2de826){if(_0x2de826){return _0x2de826[_0xe765('0x24')]()[_0xe765('0x23')](function(){_0x4657ef['status'](0xcc)[_0xe765('0x1a')]();});}};}function handleEntityNotFound(_0x184917,_0x1d0968){return function(_0x2c7df8){if(!_0x2c7df8){_0x184917[_0xe765('0x18')](0x194);}return _0x2c7df8;};}function handleError(_0x2e9c9d,_0x3ec9af){_0x3ec9af=_0x3ec9af||0x1f4;return function(_0x155ab8){logger['error'](_0x155ab8[_0xe765('0x25')]);if(_0x155ab8[_0xe765('0x26')]){delete _0x155ab8['name'];}_0x2e9c9d[_0xe765('0x19')](_0x3ec9af)[_0xe765('0x27')](_0x155ab8);};}exports['show']=function(_0x36fe49,_0x3a551f){var _0x55637c={'raw':![],'where':{'id':_0x36fe49[_0xe765('0x28')]['id']}},_0x19b592={};_0x19b592[_0xe765('0x29')]=_[_0xe765('0x2a')](db[_0xe765('0x2b')][_0xe765('0x2c')]);_0x19b592[_0xe765('0x2d')]=_[_0xe765('0x2a')](_0x36fe49['query']);_0x19b592[_0xe765('0x2e')]=_[_0xe765('0x2f')](_0x19b592[_0xe765('0x29')],_0x19b592[_0xe765('0x2d')]);_0x55637c[_0xe765('0x30')]=_[_0xe765('0x2f')](_0x19b592[_0xe765('0x29')],qs[_0xe765('0x31')](_0x36fe49[_0xe765('0x2d')][_0xe765('0x31')]));_0x55637c[_0xe765('0x30')]=_0x55637c[_0xe765('0x30')][_0xe765('0x32')]?_0x55637c[_0xe765('0x30')]:_0x19b592[_0xe765('0x29')];if(_0x36fe49['query'][_0xe765('0x33')]){_0x55637c[_0xe765('0x34')]=[{'all':!![]}];}_0x55637c=_['merge']({},_0x55637c,_0x36fe49['options']);return db['DashboardItem'][_0xe765('0x35')](_0x55637c)[_0xe765('0x23')](handleEntityNotFound(_0x3a551f,null))[_0xe765('0x23')](respondWithResult(_0x3a551f,null))[_0xe765('0x36')](handleError(_0x3a551f,null));};exports['destroy']=function(_0x377703,_0x4fb424){return db[_0xe765('0x2b')]['find']({'where':{'id':_0x377703['params']['id']}})[_0xe765('0x23')](handleEntityNotFound(_0x4fb424,null))['then'](removeEntity(_0x4fb424,null))[_0xe765('0x36')](handleError(_0x4fb424,null));};function widgetAttributes(_0x379f2a){try{switch(_0x379f2a[_0xe765('0x37')]){case'iframe':return[{'name':_0xe765('0x38'),'value':_0x379f2a[_0xe765('0x38')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a['attrs'][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||'https://'}];case _0xe765('0x3b'):return[{'name':_0xe765('0x3c'),'value':_0x379f2a[_0xe765('0x3c')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||''}];case _0xe765('0x3d'):return[{'name':_0xe765('0x3e'),'value':_0x379f2a[_0xe765('0x3e')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||_0xe765('0x3f')},{'name':'attrTimezone','value':_0x379f2a[_0xe765('0x40')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a['attrs'][0x1][_0xe765('0x3a')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x379f2a[_0xe765('0x41')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a['attrs'][0x2]?_0x379f2a['attrs'][0x2][_0xe765('0x3a')]:undefined)||0xc}];case _0xe765('0x42'):return[{'name':_0xe765('0x43'),'value':_0x379f2a[_0xe765('0x43')]||(_0x379f2a['attrs']&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||'total'},{'name':_0xe765('0x44'),'value':_0x379f2a[_0xe765('0x44')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a['attrs'][0x1][_0xe765('0x3a')]:undefined)||[]},{'name':_0xe765('0x41'),'value':_0x379f2a[_0xe765('0x41')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x2]?_0x379f2a[_0xe765('0x39')][0x2][_0xe765('0x3a')]:undefined)||0x14}];case _0xe765('0x45'):case _0xe765('0x46'):return[{'name':_0xe765('0x47'),'value':_0x379f2a[_0xe765('0x47')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a['attrs'][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||_0xe765('0x48')},{'name':_0xe765('0x49'),'value':_0x379f2a[_0xe765('0x49')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a[_0xe765('0x39')][0x1][_0xe765('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x379f2a['attrSerie3']||(_0x379f2a['attrs']&&_0x379f2a[_0xe765('0x39')][0x2]?_0x379f2a[_0xe765('0x39')][0x2][_0xe765('0x3a')]:undefined)||null},{'name':_0xe765('0x44'),'value':_0x379f2a[_0xe765('0x44')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x3]?_0x379f2a['attrs'][0x3][_0xe765('0x3a')]:undefined)||[]}];case _0xe765('0x4a'):return[{'name':'attrReport','type':_0x379f2a[_0xe765('0x4b')]||(_0x379f2a[_0xe765('0x39')]&&_0x379f2a[_0xe765('0x39')][0x0]?_0x379f2a['attrs'][0x0]['type']:undefined)||null,'value':_0x379f2a[_0xe765('0x4c')]||(_0x379f2a['attrs']&&_0x379f2a['attrs'][0x0]?_0x379f2a[_0xe765('0x39')][0x0][_0xe765('0x3a')]:undefined)||null},{'name':_0xe765('0x4d'),'value':_0x379f2a['attrRefresh']||(_0x379f2a['attrs']&&_0x379f2a[_0xe765('0x39')][0x1]?_0x379f2a['attrs'][0x1][_0xe765('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x4ceb1e){logger[_0xe765('0x4e')](_0xe765('0x4f'),JSON[_0xe765('0x50')](_0x4ceb1e));return[];}}exports[_0xe765('0x51')]=function(_0x25c024,_0x56304c){if(_0x25c024[_0xe765('0x52')]){_0x25c024['body'][_0xe765('0x39')]=widgetAttributes(_0x25c024[_0xe765('0x52')]);}return db[_0xe765('0x2b')][_0xe765('0x51')](_0x25c024[_0xe765('0x52')],{})['then'](respondWithResult(_0x56304c,0xc9))[_0xe765('0x36')](handleError(_0x56304c,null));};exports[_0xe765('0x22')]=function(_0x3ad177,_0x3764ea){if(_0x3ad177[_0xe765('0x52')]['id']){delete _0x3ad177[_0xe765('0x52')]['id'];}_0x3ad177['body'][_0xe765('0x39')]=widgetAttributes(_0x3ad177[_0xe765('0x52')]);return db[_0xe765('0x2b')][_0xe765('0x35')]({'where':{'id':_0x3ad177[_0xe765('0x28')]['id']}})[_0xe765('0x23')](handleEntityNotFound(_0x3764ea,null))[_0xe765('0x23')](saveUpdates(_0x3ad177[_0xe765('0x52')],null))[_0xe765('0x23')](respondWithResult(_0x3764ea,null))[_0xe765('0x36')](handleError(_0x3764ea,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f18ad83..4d08cc1 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 _0xfdd7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfdd7,0x156));var _0x7fdd=function(_0x9ab334,_0x2035b4){_0x9ab334=_0x9ab334-0x0;var _0x274d57=_0xfdd7[_0x9ab334];return _0x274d57;};'use strict';var EventEmitter=require(_0x7fdd('0x0'));var DashboardItem=require(_0x7fdd('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7fdd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7fdd('0x3'),'afterDestroy':_0x7fdd('0x4')};function emitEvent(_0xb4288d){return function(_0x493c94,_0xd8388a,_0x46df9c){DashboardItemEvents['emit'](_0xb4288d+':'+_0x493c94['id'],_0x493c94);DashboardItemEvents[_0x7fdd('0x5')](_0xb4288d,_0x493c94);_0x46df9c(null);};}for(var e in events){if(events[_0x7fdd('0x6')](e)){var event=events[e];DashboardItem[_0x7fdd('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x6bdc=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x2c807f,_0x1fc04f){_0x2c807f=_0x2c807f-0x0;var _0x3bce9a=_0x6bdc[_0x2c807f];return _0x3bce9a;};'use strict';var EventEmitter=require(_0xc6bd('0x0'));var DashboardItem=require(_0xc6bd('0x1'))['db'][_0xc6bd('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc6bd('0x3')](0x0);var events={'afterCreate':_0xc6bd('0x4'),'afterUpdate':_0xc6bd('0x5'),'afterDestroy':_0xc6bd('0x6')};function emitEvent(_0x529c4b){return function(_0x1bb923,_0xd0f13,_0x580a26){DashboardItemEvents[_0xc6bd('0x7')](_0x529c4b+':'+_0x1bb923['id'],_0x1bb923);DashboardItemEvents[_0xc6bd('0x7')](_0x529c4b,_0x1bb923);_0x580a26(null);};}for(var e in events){if(events[_0xc6bd('0x8')](e)){var event=events[e];DashboardItem[_0xc6bd('0x9')](e,emitEvent(event));}}module[_0xc6bd('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e657dd9..6f47004 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 _0xe304=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','lodash'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xe304,0x8f));var _0x4e30=function(_0x48104b,_0xb93475){_0x48104b=_0x48104b-0x0;var _0x9de74d=_0xe304[_0x48104b];return _0x9de74d;};'use strict';var _=require(_0x4e30('0x0'));var util=require(_0x4e30('0x1'));var logger=require(_0x4e30('0x2'))(_0x4e30('0x3'));var moment=require('moment');var BPromise=require(_0x4e30('0x4'));var rp=require(_0x4e30('0x5'));var fs=require('fs');var path=require(_0x4e30('0x6'));var rimraf=require('rimraf');var config=require(_0x4e30('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x39f0c6,_0x5dc1aa){return _0x39f0c6[_0x4e30('0x8')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x246b=['../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5a7188,_0x2ec5ad){var _0x805ef=function(_0x2dfeba){while(--_0x2dfeba){_0x5a7188['push'](_0x5a7188['shift']());}};_0x805ef(++_0x2ec5ad);}(_0x246b,0x1d9));var _0xb246=function(_0xe7ae53,_0x15f327){_0xe7ae53=_0xe7ae53-0x0;var _0x586e51=_0x246b[_0xe7ae53];return _0x586e51;};'use strict';var _=require(_0xb246('0x0'));var util=require(_0xb246('0x1'));var logger=require(_0xb246('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb246('0x3'));var rp=require(_0xb246('0x4'));var fs=require('fs');var path=require(_0xb246('0x5'));var rimraf=require(_0xb246('0x6'));var config=require(_0xb246('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xb246('0x8')]=function(_0x288600,_0x4e5710){return _0x288600[_0xb246('0x9')](_0xb246('0xa'),attributes,{'tableName':_0xb246('0xb'),'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 17ffae6..ff55bae 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 _0xaf37=['register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket'];(function(_0x2c414e,_0x3367f9){var _0x24af0=function(_0x282162){while(--_0x282162){_0x2c414e['push'](_0x2c414e['shift']());}};_0x24af0(++_0x3367f9);}(_0xaf37,0xe5));var _0x7af3=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xaf37[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0x7af3('0x0'));var util=require(_0x7af3('0x1'));var moment=require(_0x7af3('0x2'));var BPromise=require(_0x7af3('0x3'));var rs=require(_0x7af3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7af3('0x5'))(_0x7af3('0x6'));var config=require(_0x7af3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7af3('0x8')][_0x7af3('0x9')]({'port':0x232a});config[_0x7af3('0xa')]=_[_0x7af3('0xb')](config[_0x7af3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7af3('0xc'))(new Redis(config[_0x7af3('0xa')]));require(_0x7af3('0xd'))[_0x7af3('0xe')](socket);function respondWithRpcPromise(_0x4b1f25,_0x3d24ac,_0x383f08){return new BPromise(function(_0x330f2b,_0x11a36){return client[_0x7af3('0xf')](_0x4b1f25,_0x383f08)[_0x7af3('0x10')](function(_0x55625a){logger[_0x7af3('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3d24ac,_0x7af3('0x12'));logger['debug'](_0x7af3('0x13'),_0x3d24ac,_0x7af3('0x12'),JSON[_0x7af3('0x14')](_0x55625a));if(_0x55625a[_0x7af3('0x15')]){if(_0x55625a['error'][_0x7af3('0x16')]===0x1f4){logger[_0x7af3('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3d24ac,_0x55625a[_0x7af3('0x15')]['message']);return _0x11a36(_0x55625a[_0x7af3('0x15')][_0x7af3('0x17')]);}logger[_0x7af3('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3d24ac,_0x55625a[_0x7af3('0x15')][_0x7af3('0x17')]);return _0x330f2b(_0x55625a[_0x7af3('0x15')]['message']);}else{logger[_0x7af3('0x11')](_0x7af3('0x18'),_0x3d24ac,'request\x20sent');_0x330f2b(_0x55625a[_0x7af3('0x19')][_0x7af3('0x17')]);}})[_0x7af3('0x1a')](function(_0x7dacdd){logger[_0x7af3('0x15')](_0x7af3('0x18'),_0x3d24ac,_0x7dacdd);_0x11a36(_0x7dacdd);});});} \ No newline at end of file +var _0x5370=['../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x56d2c3,_0x507ad0){var _0x4783d9=function(_0x5e9dc0){while(--_0x5e9dc0){_0x56d2c3['push'](_0x56d2c3['shift']());}};_0x4783d9(++_0x507ad0);}(_0x5370,0x1dd));var _0x0537=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5370[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0537('0x0'));var util=require(_0x0537('0x1'));var moment=require(_0x0537('0x2'));var BPromise=require(_0x0537('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0537('0x4'));var db=require(_0x0537('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0537('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0537('0x7'));var client=jayson[_0x0537('0x8')][_0x0537('0x9')]({'port':0x232a});config[_0x0537('0xa')]=_['defaults'](config[_0x0537('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0537('0xb'))(new Redis(config['redis']));require(_0x0537('0xc'))[_0x0537('0xd')](socket);function respondWithRpcPromise(_0x7b9b10,_0x4f2ac2,_0x3ff3df){return new BPromise(function(_0x403054,_0x1f7a03){return client[_0x0537('0xe')](_0x7b9b10,_0x3ff3df)[_0x0537('0xf')](function(_0xe1aeb2){logger[_0x0537('0x10')](_0x0537('0x11'),_0x4f2ac2,_0x0537('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4f2ac2,_0x0537('0x12'),JSON[_0x0537('0x13')](_0xe1aeb2));if(_0xe1aeb2['error']){if(_0xe1aeb2['error'][_0x0537('0x14')]===0x1f4){logger['error'](_0x0537('0x11'),_0x4f2ac2,_0xe1aeb2['error'][_0x0537('0x15')]);return _0x1f7a03(_0xe1aeb2[_0x0537('0x16')]['message']);}logger[_0x0537('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4f2ac2,_0xe1aeb2[_0x0537('0x16')][_0x0537('0x15')]);return _0x403054(_0xe1aeb2[_0x0537('0x16')][_0x0537('0x15')]);}else{logger[_0x0537('0x10')]('DashboardItem,\x20%s,\x20%s',_0x4f2ac2,'request\x20sent');_0x403054(_0xe1aeb2['result'][_0x0537('0x15')]);}})['catch'](function(_0x41fb62){logger[_0x0537('0x16')](_0x0537('0x11'),_0x4f2ac2,_0x41fb62);_0x1f7a03(_0x41fb62);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3425793..b5f32b5 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 _0xa50f=['update','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x13dff4,_0x3a25c8){var _0x5546d6=function(_0x3626f8){while(--_0x3626f8){_0x13dff4['push'](_0x13dff4['shift']());}};_0x5546d6(++_0x3a25c8);}(_0xa50f,0x1e0));var _0xfa50=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa50f[_0x27af45];return _0x18df21;};'use strict';var DashboardItemEvents=require(_0xfa50('0x0'));var events=[_0xfa50('0x1'),_0xfa50('0x2'),_0xfa50('0x3')];function createListener(_0x4c46ff,_0x54a76b){return function(_0x2e20e5){_0x54a76b['emit'](_0x4c46ff,_0x2e20e5);};}function removeListener(_0x2aebe3,_0x2e9ed5){return function(){DashboardItemEvents[_0xfa50('0x4')](_0x2aebe3,_0x2e9ed5);};}exports['register']=function(_0x20da93){for(var _0x3c7d35=0x0,_0x39604d=events[_0xfa50('0x5')];_0x3c7d35<_0x39604d;_0x3c7d35++){var _0x3179dc=events[_0x3c7d35];var _0x54eb34=createListener(_0xfa50('0x6')+_0x3179dc,_0x20da93);DashboardItemEvents['on'](_0x3179dc,_0x54eb34);}}; \ No newline at end of file +var _0xb228=['./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x12e5db,_0x134ebd){var _0x5153ec=function(_0x34f4cf){while(--_0x34f4cf){_0x12e5db['push'](_0x12e5db['shift']());}};_0x5153ec(++_0x134ebd);}(_0xb228,0x10a));var _0x8b22=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb228[_0x13d07a];return _0x5ee0ee;};'use strict';var DashboardItemEvents=require(_0x8b22('0x0'));var events=[_0x8b22('0x1'),_0x8b22('0x2'),_0x8b22('0x3')];function createListener(_0x4f7f37,_0x47a59c){return function(_0x214cc1){_0x47a59c[_0x8b22('0x4')](_0x4f7f37,_0x214cc1);};}function removeListener(_0x537934,_0x12ffcb){return function(){DashboardItemEvents[_0x8b22('0x5')](_0x537934,_0x12ffcb);};}exports[_0x8b22('0x6')]=function(_0x523ce1){for(var _0x1696bb=0x0,_0x5265ba=events['length'];_0x1696bb<_0x5265ba;_0x1696bb++){var _0x3fca4f=events[_0x1696bb];var _0x26ddf9=createListener('dashboardItem:'+_0x3fca4f,_0x523ce1);DashboardItemEvents['on'](_0x3fca4f,_0x26ddf9);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9b4b9d0..107bbb8 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 _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0x45805b,_0x1bbf1a){var _0x4c339a=function(_0x220b7d){while(--_0x220b7d){_0x45805b['push'](_0x45805b['shift']());}};_0x4c339a(++_0x1bbf1a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x283e44,_0x3eca6d){_0x283e44=_0x283e44-0x0;var _0x4e3f99=_0xdbf5[_0x283e44];return _0x4e3f99;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x1a5407,_0x83ae11){var _0x2427f5=function(_0x45b3b6){while(--_0x45b3b6){_0x1a5407['push'](_0x1a5407['shift']());}};_0x2427f5(++_0x83ae11);}(_0x687b,0x14a));var _0xb687=function(_0x4711fc,_0x31742c){_0x4711fc=_0x4711fc-0x0;var _0x4c1eaf=_0x687b[_0x4711fc];return _0x4c1eaf;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0xc')]('/',auth[_0xb687('0xa')](),controller['create']);router[_0xb687('0xd')](_0xb687('0x9'),auth['isAuthenticated'](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x9'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 32ca622..1da41e9 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 _0x4c42=['first','second','sequelize','exports','STRING','ENUM'];(function(_0x351ee2,_0x414437){var _0x519eef=function(_0x987f85){while(--_0x987f85){_0x351ee2['push'](_0x351ee2['shift']());}};_0x519eef(++_0x414437);}(_0x4c42,0x98));var _0x24c4=function(_0x39f8cc,_0x41329e){_0x39f8cc=_0x39f8cc-0x0;var _0x49fb94=_0x4c42[_0x39f8cc];return _0x49fb94;};'use strict';var Sequelize=require(_0x24c4('0x0'));module[_0x24c4('0x1')]={'name':{'type':Sequelize[_0x24c4('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x24c4('0x3')](_0x24c4('0x4'),_0x24c4('0x5'),'third'),'allowNull':![],'defaultValue':_0x24c4('0x4')},'description':{'type':Sequelize[_0x24c4('0x2')]}}; \ No newline at end of file +var _0xca2f=['exports','STRING','ENUM','third','first','sequelize'];(function(_0x8e4975,_0x528fe7){var _0x54f9ac=function(_0x1ea111){while(--_0x1ea111){_0x8e4975['push'](_0x8e4975['shift']());}};_0x54f9ac(++_0x528fe7);}(_0xca2f,0xe9));var _0xfca2=function(_0x2db6f4,_0x58be29){_0x2db6f4=_0x2db6f4-0x0;var _0x5bffb2=_0xca2f[_0x2db6f4];return _0x5bffb2;};'use strict';var Sequelize=require(_0xfca2('0x0'));module[_0xfca2('0x1')]={'name':{'type':Sequelize[_0xfca2('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xfca2('0x3')]('first','second',_0xfca2('0x4')),'allowNull':![],'defaultValue':_0xfca2('0x5')},'description':{'type':Sequelize[_0xfca2('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9dc9a7f..63c57ba 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 _0x428a=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','merge','VIRTUAL','where','includeAll','findAll','rows','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','map','Disposition','rawAttributes','fieldName','type','key','model'];(function(_0x211fdc,_0x45348b){var _0x52f0ab=function(_0xbfd99f){while(--_0xbfd99f){_0x211fdc['push'](_0x211fdc['shift']());}};_0x52f0ab(++_0x45348b);}(_0x428a,0x6a));var _0xa428=function(_0x351c58,_0x79fef6){_0x351c58=_0x351c58-0x0;var _0x386eac=_0x428a[_0x351c58];return _0x386eac;};'use strict';var pdf=require(_0xa428('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa428('0x1'));var zipdir=require(_0xa428('0x2'));var jsonpatch=require(_0xa428('0x3'));var rp=require('request-promise');var moment=require(_0xa428('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa428('0x5'));var util=require('util');var path=require(_0xa428('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa428('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa428('0x8'));var crypto=require(_0xa428('0x9'));var jsforce=require(_0xa428('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa428('0xb'));var querystring=require(_0xa428('0xc'));var Papa=require(_0xa428('0xd'));var Redis=require('ioredis');var authService=require(_0xa428('0xe'));var qs=require(_0xa428('0xf'));var as=require(_0xa428('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa428('0x11'));var utils=require('../../config/utils');var config=require(_0xa428('0x12'));var licenseUtil=require(_0xa428('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e5dab,_0x57eee7){_0x57eee7=_0x57eee7||0xcc;return function(_0x473275){if(_0x473275){return _0x3e5dab[_0xa428('0x14')](_0x57eee7);}return _0x3e5dab[_0xa428('0x15')](_0x57eee7)[_0xa428('0x16')]();};}function respondWithResult(_0xfa3b6a,_0x23f579){_0x23f579=_0x23f579||0xc8;return function(_0x1faecb){if(_0x1faecb){return _0xfa3b6a['status'](_0x23f579)[_0xa428('0x17')](_0x1faecb);}};}function respondWithFilteredResult(_0x24115a,_0x496b92){return function(_0x201a15){if(_0x201a15){var _0x4daf91=_0x201a15[_0xa428('0x18')],_0x5cf5cf=_0x496b92[_0xa428('0x19')],_0x26dd11=_0x496b92[_0xa428('0x19')]+_0x496b92['limit'],_0x335376;if(_0x26dd11>=_0x4daf91){_0x26dd11=_0x4daf91;_0x335376=0xc8;}else{_0x335376=0xce;}_0x24115a['status'](_0x335376);return _0x24115a[_0xa428('0x1a')](_0xa428('0x1b'),_0x5cf5cf+'-'+_0x26dd11+'/'+_0x4daf91)['json'](_0x201a15);}return null;};}function patchUpdates(_0x1dd44a){return function(_0x2aa74b){try{jsonpatch[_0xa428('0x1c')](_0x2aa74b,_0x1dd44a,!![]);}catch(_0x3396b7){return BPromise[_0xa428('0x1d')](_0x3396b7);}return _0x2aa74b[_0xa428('0x1e')]();};}function saveUpdates(_0x25e745,_0x25278e){return function(_0x26afaf){if(_0x26afaf){return _0x26afaf[_0xa428('0x1f')](_0x25e745)[_0xa428('0x20')](function(_0x54c168){return _0x54c168;});}return null;};}function removeEntity(_0x343b78,_0x3b26fe){return function(_0x1f641f){if(_0x1f641f){return _0x1f641f[_0xa428('0x21')]()[_0xa428('0x20')](function(){var _0xcb5fae=_0x1f641f['get']({'plain':!![]});var _0xfe8e4b=_0xa428('0x22');return db[_0xa428('0x23')][_0xa428('0x21')]({'where':{'type':_0xfe8e4b,'resourceId':_0xcb5fae['id']}})['then'](function(){return _0x1f641f;});})[_0xa428('0x20')](function(){_0x343b78['status'](0xcc)[_0xa428('0x16')]();});}};}function handleEntityNotFound(_0x1e14f4,_0x1e50d8){return function(_0x67ed3c){if(!_0x67ed3c){_0x1e14f4[_0xa428('0x14')](0x194);}return _0x67ed3c;};}function handleError(_0x5d5e31,_0x331ad1){_0x331ad1=_0x331ad1||0x1f4;return function(_0xcdfb20){logger[_0xa428('0x24')](_0xcdfb20[_0xa428('0x25')]);if(_0xcdfb20[_0xa428('0x26')]){delete _0xcdfb20['name'];}_0x5d5e31[_0xa428('0x15')](_0x331ad1)['send'](_0xcdfb20);};}exports['index']=function(_0x33752e,_0x2bffb6){var _0x242ebf={},_0x4bb8e2={},_0x20e3fd={'count':0x0,'rows':[]};var _0x5023e0=_[_0xa428('0x27')](db[_0xa428('0x28')][_0xa428('0x29')],function(_0x3fa5c0){return{'name':_0x3fa5c0[_0xa428('0x2a')],'type':_0x3fa5c0[_0xa428('0x2b')][_0xa428('0x2c')]};});_0x4bb8e2[_0xa428('0x2d')]=_[_0xa428('0x27')](_0x5023e0,_0xa428('0x26'));_0x4bb8e2[_0xa428('0x2e')]=_[_0xa428('0x2f')](_0x33752e['query']);_0x4bb8e2[_0xa428('0x30')]=_[_0xa428('0x31')](_0x4bb8e2[_0xa428('0x2d')],_0x4bb8e2[_0xa428('0x2e')]);_0x242ebf[_0xa428('0x32')]=_['intersection'](_0x4bb8e2[_0xa428('0x2d')],qs[_0xa428('0x33')](_0x33752e['query'][_0xa428('0x33')]));_0x242ebf[_0xa428('0x32')]=_0x242ebf[_0xa428('0x32')][_0xa428('0x34')]?_0x242ebf['attributes']:_0x4bb8e2[_0xa428('0x2d')];if(!_0x33752e['query']['hasOwnProperty'](_0xa428('0x35'))){_0x242ebf[_0xa428('0x36')]=qs[_0xa428('0x36')](_0x33752e[_0xa428('0x2e')][_0xa428('0x36')]);_0x242ebf['offset']=qs[_0xa428('0x19')](_0x33752e[_0xa428('0x2e')][_0xa428('0x19')]);}_0x242ebf['order']=qs['sort'](_0x33752e[_0xa428('0x2e')][_0xa428('0x37')]);_0x242ebf['where']=qs[_0xa428('0x30')](_[_0xa428('0x38')](_0x33752e[_0xa428('0x2e')],_0x4bb8e2['filters']),_0x5023e0);if(_0x33752e['query'][_0xa428('0x39')]){_0x242ebf['where']=_[_0xa428('0x3a')](_0x242ebf['where'],{'$or':_[_0xa428('0x27')](_0x5023e0,function(_0x49ab28){if(_0x49ab28[_0xa428('0x2b')]!==_0xa428('0x3b')){var _0xdd71f2={};_0xdd71f2[_0x49ab28[_0xa428('0x26')]]={'$like':'%'+_0x33752e[_0xa428('0x2e')][_0xa428('0x39')]+'%'};return _0xdd71f2;}})});}_0x242ebf=_[_0xa428('0x3a')]({},_0x242ebf,_0x33752e['options']);var _0x5f1339={'where':_0x242ebf[_0xa428('0x3c')]};return db[_0xa428('0x28')][_0xa428('0x18')](_0x5f1339)[_0xa428('0x20')](function(_0x11457b){_0x20e3fd[_0xa428('0x18')]=_0x11457b;if(_0x33752e[_0xa428('0x2e')][_0xa428('0x3d')]){_0x242ebf['include']=[{'all':!![]}];}return db[_0xa428('0x28')][_0xa428('0x3e')](_0x242ebf);})[_0xa428('0x20')](function(_0x5c50ee){_0x20e3fd[_0xa428('0x3f')]=_0x5c50ee;return _0x20e3fd;})[_0xa428('0x20')](respondWithFilteredResult(_0x2bffb6,_0x242ebf))[_0xa428('0x40')](handleError(_0x2bffb6,null));};exports[_0xa428('0x41')]=function(_0xb35add,_0x1f9953){var _0x2c5db0={'raw':!![],'where':{'id':_0xb35add['params']['id']}},_0x2e5fc0={};_0x2e5fc0[_0xa428('0x2d')]=_[_0xa428('0x2f')](db[_0xa428('0x28')][_0xa428('0x29')]);_0x2e5fc0['query']=_[_0xa428('0x2f')](_0xb35add[_0xa428('0x2e')]);_0x2e5fc0[_0xa428('0x30')]=_[_0xa428('0x31')](_0x2e5fc0[_0xa428('0x2d')],_0x2e5fc0[_0xa428('0x2e')]);_0x2c5db0[_0xa428('0x32')]=_[_0xa428('0x31')](_0x2e5fc0[_0xa428('0x2d')],qs[_0xa428('0x33')](_0xb35add[_0xa428('0x2e')][_0xa428('0x33')]));_0x2c5db0['attributes']=_0x2c5db0[_0xa428('0x32')]['length']?_0x2c5db0['attributes']:_0x2e5fc0[_0xa428('0x2d')];if(_0xb35add[_0xa428('0x2e')][_0xa428('0x3d')]){_0x2c5db0['include']=[{'all':!![]}];}_0x2c5db0=_[_0xa428('0x3a')]({},_0x2c5db0,_0xb35add['options']);return db[_0xa428('0x28')][_0xa428('0x42')](_0x2c5db0)[_0xa428('0x20')](handleEntityNotFound(_0x1f9953,null))['then'](respondWithResult(_0x1f9953,null))[_0xa428('0x40')](handleError(_0x1f9953,null));};exports[_0xa428('0x43')]=function(_0xbcaaf0,_0x3eb886){return db['Disposition']['create'](_0xbcaaf0[_0xa428('0x44')],{})['then'](function(_0x343ab1){var _0x42ae9a=_0xbcaaf0['user'][_0xa428('0x45')]({'plain':!![]});if(!_0x42ae9a)throw new Error(_0xa428('0x46'));if(_0x42ae9a[_0xa428('0x47')]===_0xa428('0x48')){var _0x279fb6=_0x343ab1[_0xa428('0x45')]({'plain':!![]});var _0x1280db=_0xa428('0x22');return db[_0xa428('0x49')][_0xa428('0x42')]({'where':{'name':_0x1280db,'userProfileId':_0x42ae9a[_0xa428('0x4a')]},'raw':!![]})[_0xa428('0x20')](function(_0x1679f3){if(_0x1679f3&&_0x1679f3['autoAssociation']===0x0){return db[_0xa428('0x23')][_0xa428('0x43')]({'name':_0x279fb6[_0xa428('0x26')],'resourceId':_0x279fb6['id'],'type':_0x1679f3[_0xa428('0x26')],'sectionId':_0x1679f3['id']},{})[_0xa428('0x20')](function(){return _0x343ab1;});}else{return _0x343ab1;}})[_0xa428('0x40')](function(_0x352e8a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x352e8a);throw _0x352e8a;});}return _0x343ab1;})[_0xa428('0x20')](respondWithResult(_0x3eb886,0xc9))[_0xa428('0x40')](handleError(_0x3eb886,null));};exports[_0xa428('0x1f')]=function(_0x432fcc,_0x164254){if(_0x432fcc[_0xa428('0x44')]['id']){delete _0x432fcc[_0xa428('0x44')]['id'];}return db[_0xa428('0x28')][_0xa428('0x42')]({'where':{'id':_0x432fcc[_0xa428('0x4b')]['id']}})['then'](handleEntityNotFound(_0x164254,null))[_0xa428('0x20')](saveUpdates(_0x432fcc[_0xa428('0x44')],null))[_0xa428('0x20')](respondWithResult(_0x164254,null))[_0xa428('0x40')](handleError(_0x164254,null));};exports['destroy']=function(_0x2123bf,_0x234204){return db[_0xa428('0x28')][_0xa428('0x42')]({'where':{'id':_0x2123bf['params']['id']}})[_0xa428('0x20')](handleEntityNotFound(_0x234204,null))[_0xa428('0x20')](removeEntity(_0x234204,null))['catch'](handleError(_0x234204,null));}; \ No newline at end of file +var _0xcb59=['json','apply','reject','destroy','then','get','Dispositions','UserProfileResource','end','error','name','send','index','map','Disposition','fieldName','type','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','model','rawAttributes','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','set'];(function(_0x24e8eb,_0x1a7f22){var _0x1ae3f4=function(_0x55e1e6){while(--_0x55e1e6){_0x24e8eb['push'](_0x24e8eb['shift']());}};_0x1ae3f4(++_0x1a7f22);}(_0xcb59,0xcd));var _0x9cb5=function(_0x32e08,_0x2570f8){_0x32e08=_0x32e08-0x0;var _0x58b9bb=_0xcb59[_0x32e08];return _0x58b9bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9cb5('0x0'));var rimraf=require(_0x9cb5('0x1'));var zipdir=require(_0x9cb5('0x2'));var jsonpatch=require(_0x9cb5('0x3'));var rp=require(_0x9cb5('0x4'));var moment=require(_0x9cb5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cb5('0x6'));var util=require(_0x9cb5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9cb5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cb5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9cb5('0xa'));var deskjs=require(_0x9cb5('0xb'));var toCsv=require(_0x9cb5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cb5('0xc'));var authService=require(_0x9cb5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9cb5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9cb5('0xf'));var config=require(_0x9cb5('0x10'));var licenseUtil=require(_0x9cb5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x328f5d,_0x1c4ac5){_0x1c4ac5=_0x1c4ac5||0xcc;return function(_0x306069){if(_0x306069){return _0x328f5d[_0x9cb5('0x12')](_0x1c4ac5);}return _0x328f5d['status'](_0x1c4ac5)['end']();};}function respondWithResult(_0x594161,_0x421ab0){_0x421ab0=_0x421ab0||0xc8;return function(_0x22e37b){if(_0x22e37b){return _0x594161[_0x9cb5('0x13')](_0x421ab0)['json'](_0x22e37b);}};}function respondWithFilteredResult(_0x13d056,_0x176a2b){return function(_0xdf7b34){if(_0xdf7b34){var _0x4ccd63=_0xdf7b34[_0x9cb5('0x14')],_0x4f8968=_0x176a2b[_0x9cb5('0x15')],_0x242b0e=_0x176a2b[_0x9cb5('0x15')]+_0x176a2b['limit'],_0x3d0efe;if(_0x242b0e>=_0x4ccd63){_0x242b0e=_0x4ccd63;_0x3d0efe=0xc8;}else{_0x3d0efe=0xce;}_0x13d056['status'](_0x3d0efe);return _0x13d056[_0x9cb5('0x16')]('Content-Range',_0x4f8968+'-'+_0x242b0e+'/'+_0x4ccd63)[_0x9cb5('0x17')](_0xdf7b34);}return null;};}function patchUpdates(_0x427bc1){return function(_0x5042ff){try{jsonpatch[_0x9cb5('0x18')](_0x5042ff,_0x427bc1,!![]);}catch(_0x1e3b56){return BPromise[_0x9cb5('0x19')](_0x1e3b56);}return _0x5042ff['save']();};}function saveUpdates(_0x300740,_0x223bb8){return function(_0x3d815c){if(_0x3d815c){return _0x3d815c['update'](_0x300740)['then'](function(_0x537fe9){return _0x537fe9;});}return null;};}function removeEntity(_0x4a01f5,_0x2bb25c){return function(_0x290175){if(_0x290175){return _0x290175[_0x9cb5('0x1a')]()[_0x9cb5('0x1b')](function(){var _0x512702=_0x290175[_0x9cb5('0x1c')]({'plain':!![]});var _0x218c5d=_0x9cb5('0x1d');return db[_0x9cb5('0x1e')]['destroy']({'where':{'type':_0x218c5d,'resourceId':_0x512702['id']}})['then'](function(){return _0x290175;});})[_0x9cb5('0x1b')](function(){_0x4a01f5[_0x9cb5('0x13')](0xcc)[_0x9cb5('0x1f')]();});}};}function handleEntityNotFound(_0x5b3724,_0x1488c8){return function(_0x29e916){if(!_0x29e916){_0x5b3724['sendStatus'](0x194);}return _0x29e916;};}function handleError(_0x3c3f06,_0x47c9b9){_0x47c9b9=_0x47c9b9||0x1f4;return function(_0x2ca614){logger[_0x9cb5('0x20')](_0x2ca614['stack']);if(_0x2ca614[_0x9cb5('0x21')]){delete _0x2ca614[_0x9cb5('0x21')];}_0x3c3f06['status'](_0x47c9b9)[_0x9cb5('0x22')](_0x2ca614);};}exports[_0x9cb5('0x23')]=function(_0x44f699,_0x319cb6){var _0x57ce1b={},_0x2aee83={},_0x5cb264={'count':0x0,'rows':[]};var _0x6df3de=_[_0x9cb5('0x24')](db[_0x9cb5('0x25')]['rawAttributes'],function(_0x13a4f0){return{'name':_0x13a4f0[_0x9cb5('0x26')],'type':_0x13a4f0[_0x9cb5('0x27')]['key']};});_0x2aee83['model']=_['map'](_0x6df3de,_0x9cb5('0x21'));_0x2aee83[_0x9cb5('0x28')]=_[_0x9cb5('0x29')](_0x44f699['query']);_0x2aee83[_0x9cb5('0x2a')]=_['intersection'](_0x2aee83['model'],_0x2aee83[_0x9cb5('0x28')]);_0x57ce1b[_0x9cb5('0x2b')]=_[_0x9cb5('0x2c')](_0x2aee83['model'],qs[_0x9cb5('0x2d')](_0x44f699['query']['fields']));_0x57ce1b[_0x9cb5('0x2b')]=_0x57ce1b[_0x9cb5('0x2b')][_0x9cb5('0x2e')]?_0x57ce1b[_0x9cb5('0x2b')]:_0x2aee83['model'];if(!_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x2f')](_0x9cb5('0x30'))){_0x57ce1b[_0x9cb5('0x31')]=qs[_0x9cb5('0x31')](_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x31')]);_0x57ce1b[_0x9cb5('0x15')]=qs[_0x9cb5('0x15')](_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x15')]);}_0x57ce1b[_0x9cb5('0x32')]=qs[_0x9cb5('0x33')](_0x44f699[_0x9cb5('0x28')]['sort']);_0x57ce1b['where']=qs[_0x9cb5('0x2a')](_[_0x9cb5('0x34')](_0x44f699[_0x9cb5('0x28')],_0x2aee83[_0x9cb5('0x2a')]),_0x6df3de);if(_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x35')]){_0x57ce1b[_0x9cb5('0x36')]=_[_0x9cb5('0x37')](_0x57ce1b[_0x9cb5('0x36')],{'$or':_[_0x9cb5('0x24')](_0x6df3de,function(_0x53a052){if(_0x53a052['type']!==_0x9cb5('0x38')){var _0x2ab11a={};_0x2ab11a[_0x53a052[_0x9cb5('0x21')]]={'$like':'%'+_0x44f699[_0x9cb5('0x28')][_0x9cb5('0x35')]+'%'};return _0x2ab11a;}})});}_0x57ce1b=_[_0x9cb5('0x37')]({},_0x57ce1b,_0x44f699[_0x9cb5('0x39')]);var _0x3d3645={'where':_0x57ce1b[_0x9cb5('0x36')]};return db[_0x9cb5('0x25')][_0x9cb5('0x14')](_0x3d3645)[_0x9cb5('0x1b')](function(_0x1d2150){_0x5cb264[_0x9cb5('0x14')]=_0x1d2150;if(_0x44f699['query'][_0x9cb5('0x3a')]){_0x57ce1b[_0x9cb5('0x3b')]=[{'all':!![]}];}return db['Disposition'][_0x9cb5('0x3c')](_0x57ce1b);})[_0x9cb5('0x1b')](function(_0xb4b3f7){_0x5cb264['rows']=_0xb4b3f7;return _0x5cb264;})[_0x9cb5('0x1b')](respondWithFilteredResult(_0x319cb6,_0x57ce1b))['catch'](handleError(_0x319cb6,null));};exports[_0x9cb5('0x3d')]=function(_0x525054,_0x237177){var _0x5aed21={'raw':!![],'where':{'id':_0x525054[_0x9cb5('0x3e')]['id']}},_0x4273e7={};_0x4273e7[_0x9cb5('0x3f')]=_['keys'](db[_0x9cb5('0x25')][_0x9cb5('0x40')]);_0x4273e7[_0x9cb5('0x28')]=_[_0x9cb5('0x29')](_0x525054[_0x9cb5('0x28')]);_0x4273e7['filters']=_[_0x9cb5('0x2c')](_0x4273e7['model'],_0x4273e7[_0x9cb5('0x28')]);_0x5aed21['attributes']=_[_0x9cb5('0x2c')](_0x4273e7[_0x9cb5('0x3f')],qs[_0x9cb5('0x2d')](_0x525054[_0x9cb5('0x28')][_0x9cb5('0x2d')]));_0x5aed21[_0x9cb5('0x2b')]=_0x5aed21[_0x9cb5('0x2b')][_0x9cb5('0x2e')]?_0x5aed21[_0x9cb5('0x2b')]:_0x4273e7['model'];if(_0x525054[_0x9cb5('0x28')][_0x9cb5('0x3a')]){_0x5aed21[_0x9cb5('0x3b')]=[{'all':!![]}];}_0x5aed21=_['merge']({},_0x5aed21,_0x525054[_0x9cb5('0x39')]);return db[_0x9cb5('0x25')][_0x9cb5('0x41')](_0x5aed21)[_0x9cb5('0x1b')](handleEntityNotFound(_0x237177,null))[_0x9cb5('0x1b')](respondWithResult(_0x237177,null))[_0x9cb5('0x42')](handleError(_0x237177,null));};exports['create']=function(_0x425338,_0x5f0bf1){return db['Disposition']['create'](_0x425338['body'],{})[_0x9cb5('0x1b')](function(_0x10352b){var _0x48ffce=_0x425338['user'][_0x9cb5('0x1c')]({'plain':!![]});if(!_0x48ffce)throw new Error(_0x9cb5('0x43'));if(_0x48ffce[_0x9cb5('0x44')]===_0x9cb5('0x45')){var _0x111f21=_0x10352b['get']({'plain':!![]});var _0x32ff10='Dispositions';return db[_0x9cb5('0x46')]['find']({'where':{'name':_0x32ff10,'userProfileId':_0x48ffce[_0x9cb5('0x47')]},'raw':!![]})[_0x9cb5('0x1b')](function(_0x4d8919){if(_0x4d8919&&_0x4d8919[_0x9cb5('0x48')]===0x0){return db[_0x9cb5('0x1e')]['create']({'name':_0x111f21[_0x9cb5('0x21')],'resourceId':_0x111f21['id'],'type':_0x4d8919[_0x9cb5('0x21')],'sectionId':_0x4d8919['id']},{})[_0x9cb5('0x1b')](function(){return _0x10352b;});}else{return _0x10352b;}})[_0x9cb5('0x42')](function(_0x213c43){logger['error'](_0x9cb5('0x49'),_0x213c43);throw _0x213c43;});}return _0x10352b;})[_0x9cb5('0x1b')](respondWithResult(_0x5f0bf1,0xc9))[_0x9cb5('0x42')](handleError(_0x5f0bf1,null));};exports[_0x9cb5('0x4a')]=function(_0x244f83,_0x783c80){if(_0x244f83[_0x9cb5('0x4b')]['id']){delete _0x244f83['body']['id'];}return db[_0x9cb5('0x25')]['find']({'where':{'id':_0x244f83[_0x9cb5('0x3e')]['id']}})[_0x9cb5('0x1b')](handleEntityNotFound(_0x783c80,null))[_0x9cb5('0x1b')](saveUpdates(_0x244f83[_0x9cb5('0x4b')],null))[_0x9cb5('0x1b')](respondWithResult(_0x783c80,null))['catch'](handleError(_0x783c80,null));};exports['destroy']=function(_0x33abf7,_0x1388bb){return db[_0x9cb5('0x25')][_0x9cb5('0x41')]({'where':{'id':_0x33abf7[_0x9cb5('0x3e')]['id']}})[_0x9cb5('0x1b')](handleEntityNotFound(_0x1388bb,null))[_0x9cb5('0x1b')](removeEntity(_0x1388bb,null))[_0x9cb5('0x42')](handleError(_0x1388bb,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 95b962f..d6ae6f6 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 _0x8403=['moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8403,0x1a5));var _0x3840=function(_0x19344e,_0x47f315){_0x19344e=_0x19344e-0x0;var _0x431f96=_0x8403[_0x19344e];return _0x431f96;};'use strict';var _=require(_0x3840('0x0'));var util=require(_0x3840('0x1'));var logger=require(_0x3840('0x2'))(_0x3840('0x3'));var moment=require(_0x3840('0x4'));var BPromise=require(_0x3840('0x5'));var rp=require(_0x3840('0x6'));var fs=require('fs');var path=require(_0x3840('0x7'));var rimraf=require(_0x3840('0x8'));var config=require('../../config/environment');var attributes=require(_0x3840('0x9'));module[_0x3840('0xa')]=function(_0x1cd658,_0x233be3){return _0x1cd658[_0x3840('0xb')](_0x3840('0xc'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3840('0xd'),_0x3840('0xe')]},{'unique':!![],'name':_0x3840('0xf'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x3840('0x10'),'fields':[_0x3840('0xd'),_0x3840('0x11')]},{'unique':!![],'name':_0x3840('0x12'),'fields':[_0x3840('0xd'),_0x3840('0x13')]},{'unique':!![],'name':_0x3840('0x14'),'fields':[_0x3840('0xd'),_0x3840('0x15')]},{'unique':!![],'name':_0x3840('0x16'),'fields':['name',_0x3840('0x17')]},{'unique':!![],'name':_0x3840('0x18'),'fields':[_0x3840('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bbebe,_0x2fb445){var _0x33c0ae=function(_0x3730d7){while(--_0x3730d7){_0x3bbebe['push'](_0x3bbebe['shift']());}};_0x33c0ae(++_0x2fb445);}(_0x4745,0x1e7));var _0x5474=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x4745[_0x32d457];return _0x338386;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('Disposition',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5474('0xe'),_0x5474('0xf')]},{'unique':!![],'name':'name_chat','fields':[_0x5474('0xe'),_0x5474('0x10')]},{'unique':!![],'name':_0x5474('0x11'),'fields':[_0x5474('0xe'),_0x5474('0x12')]},{'unique':!![],'name':_0x5474('0x13'),'fields':[_0x5474('0xe'),_0x5474('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x5474('0xe'),_0x5474('0x15')]},{'unique':!![],'name':_0x5474('0x16'),'fields':[_0x5474('0xe'),_0x5474('0x17')]},{'unique':!![],'name':_0x5474('0x18'),'fields':[_0x5474('0xe'),_0x5474('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f6972fe..7d77183 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 _0xff8d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','info','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','Disposition,\x20%s,\x20%s','message','result','catch'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xff8d,0x120));var _0xdff8=function(_0x2d58e4,_0x4622dd){_0x2d58e4=_0x2d58e4-0x0;var _0x3c7c10=_0xff8d[_0x2d58e4];return _0x3c7c10;};'use strict';var _=require(_0xdff8('0x0'));var util=require(_0xdff8('0x1'));var moment=require(_0xdff8('0x2'));var BPromise=require(_0xdff8('0x3'));var rs=require(_0xdff8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdff8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdff8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdff8('0x7'));var client=jayson['client'][_0xdff8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a74c6,_0x52f4ce,_0x52c4a8){return new BPromise(function(_0x3a543f,_0x943cc6){return client['request'](_0x5a74c6,_0x52c4a8)['then'](function(_0x2e0100){logger[_0xdff8('0x9')]('Disposition,\x20%s,\x20%s',_0x52f4ce,_0xdff8('0xa'));logger['debug'](_0xdff8('0xb'),_0x52f4ce,_0xdff8('0xa'),JSON[_0xdff8('0xc')](_0x2e0100));if(_0x2e0100['error']){if(_0x2e0100[_0xdff8('0xd')]['code']===0x1f4){logger[_0xdff8('0xd')](_0xdff8('0xe'),_0x52f4ce,_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);return _0x943cc6(_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);}logger[_0xdff8('0xd')](_0xdff8('0xe'),_0x52f4ce,_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);return _0x3a543f(_0x2e0100[_0xdff8('0xd')][_0xdff8('0xf')]);}else{logger[_0xdff8('0x9')](_0xdff8('0xe'),_0x52f4ce,'request\x20sent');_0x3a543f(_0x2e0100[_0xdff8('0x10')][_0xdff8('0xf')]);}})[_0xdff8('0x11')](function(_0x311b92){logger[_0xdff8('0xd')](_0xdff8('0xe'),_0x52f4ce,_0x311b92);_0x943cc6(_0x311b92);});});} \ No newline at end of file +var _0x952f=['request','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x39f510,_0x51e7ad){var _0x1213db=function(_0x31b551){while(--_0x31b551){_0x39f510['push'](_0x39f510['shift']());}};_0x1213db(++_0x51e7ad);}(_0x952f,0xde));var _0xf952=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x952f[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0xf952('0x0'));var util=require(_0xf952('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf952('0x2'));var fs=require('fs');var Redis=require(_0xf952('0x3'));var db=require(_0xf952('0x4'))['db'];var utils=require(_0xf952('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf952('0x6'));var client=jayson[_0xf952('0x7')][_0xf952('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x463c0a,_0x4da60c,_0x5713eb){return new BPromise(function(_0x36d472,_0x851fca){return client[_0xf952('0x9')](_0x463c0a,_0x5713eb)['then'](function(_0x34a227){logger[_0xf952('0xa')](_0xf952('0xb'),_0x4da60c,_0xf952('0xc'));logger[_0xf952('0xd')](_0xf952('0xe'),_0x4da60c,_0xf952('0xc'),JSON[_0xf952('0xf')](_0x34a227));if(_0x34a227[_0xf952('0x10')]){if(_0x34a227['error'][_0xf952('0x11')]===0x1f4){logger[_0xf952('0x10')](_0xf952('0xb'),_0x4da60c,_0x34a227[_0xf952('0x10')][_0xf952('0x12')]);return _0x851fca(_0x34a227['error'][_0xf952('0x12')]);}logger[_0xf952('0x10')](_0xf952('0xb'),_0x4da60c,_0x34a227[_0xf952('0x10')]['message']);return _0x36d472(_0x34a227[_0xf952('0x10')][_0xf952('0x12')]);}else{logger[_0xf952('0xa')]('Disposition,\x20%s,\x20%s',_0x4da60c,_0xf952('0xc'));_0x36d472(_0x34a227[_0xf952('0x13')][_0xf952('0x12')]);}})[_0xf952('0x14')](function(_0x31991a){logger['error'](_0xf952('0xb'),_0x4da60c,_0x31991a);_0x851fca(_0x31991a);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fa9cf76..976cc3e 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 _0x64de=['express','Router','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id','create','put','update','exports','multer','path','connect-timeout'];(function(_0x23d3e7,_0x139ae7){var _0x4c1019=function(_0x2c9d42){while(--_0x2c9d42){_0x23d3e7['push'](_0x23d3e7['shift']());}};_0x4c1019(++_0x139ae7);}(_0x64de,0x13f));var _0xe64d=function(_0x770dbe,_0x319534){_0x770dbe=_0x770dbe-0x0;var _0x402d8e=_0x64de[_0x770dbe];return _0x402d8e;};'use strict';var multer=require(_0xe64d('0x0'));var util=require('util');var path=require(_0xe64d('0x1'));var timeout=require(_0xe64d('0x2'));var express=require(_0xe64d('0x3'));var router=express[_0xe64d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe64d('0x5'));var config=require('../../config/environment');var controller=require(_0xe64d('0x6'));router[_0xe64d('0x7')]('/',auth[_0xe64d('0x8')](),controller['index']);router['get'](_0xe64d('0x9'),auth[_0xe64d('0x8')](),controller['show']);router['post']('/',auth[_0xe64d('0x8')](),controller[_0xe64d('0xa')]);router[_0xe64d('0xb')](_0xe64d('0x9'),auth[_0xe64d('0x8')](),controller[_0xe64d('0xc')]);router['delete']('/:id',auth[_0xe64d('0x8')](),controller['destroy']);module[_0xe64d('0xd')]=router; \ No newline at end of file +var _0xb2f1=['Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','exports','multer','connect-timeout','express'];(function(_0x37c13a,_0x17d2ed){var _0x512b50=function(_0xcce3e5){while(--_0xcce3e5){_0x37c13a['push'](_0x37c13a['shift']());}};_0x512b50(++_0x17d2ed);}(_0xb2f1,0x1ec));var _0x1b2f=function(_0x2cdae5,_0x4b50f6){_0x2cdae5=_0x2cdae5-0x0;var _0xeb17c4=_0xb2f1[_0x2cdae5];return _0xeb17c4;};'use strict';var multer=require(_0x1b2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b2f('0x1'));var express=require(_0x1b2f('0x2'));var router=express[_0x1b2f('0x3')]();var auth=require(_0x1b2f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1b2f('0x5'));var controller=require(_0x1b2f('0x6'));router[_0x1b2f('0x7')]('/',auth[_0x1b2f('0x8')](),controller[_0x1b2f('0x9')]);router[_0x1b2f('0x7')](_0x1b2f('0xa'),auth[_0x1b2f('0x8')](),controller[_0x1b2f('0xb')]);router[_0x1b2f('0xc')]('/',auth[_0x1b2f('0x8')](),controller[_0x1b2f('0xd')]);router['put'](_0x1b2f('0xa'),auth[_0x1b2f('0x8')](),controller['update']);router['delete'](_0x1b2f('0xa'),auth[_0x1b2f('0x8')](),controller['destroy']);module[_0x1b2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index ae55899..201c709 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 _0x8a7b=['INTEGER','SIP','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','mandatoryDisposition','exports','STRING','ENUM','yes','2400','4800','7200','9600','12000','14400','v17,v27,v29'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x8a7b,0x1d5));var _0xb8a7=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0x8a7b[_0x1d3e3f];return _0x3879fa;};'use strict';var Sequelize=require('sequelize');module[_0xb8a7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb8a7('0x1')]},'ecm':{'type':Sequelize[_0xb8a7('0x2')]('yes','no'),'defaultValue':_0xb8a7('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xb8a7('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xb8a7('0x2')](_0xb8a7('0x4'),_0xb8a7('0x5'),_0xb8a7('0x6'),_0xb8a7('0x7'),_0xb8a7('0x8'),_0xb8a7('0x9')),'defaultValue':_0xb8a7('0x5')},'maxrate':{'type':Sequelize[_0xb8a7('0x2')](_0xb8a7('0x4'),_0xb8a7('0x5'),'7200',_0xb8a7('0x7'),'12000',_0xb8a7('0x9')),'defaultValue':_0xb8a7('0x9')},'modem':{'type':Sequelize[_0xb8a7('0x1')],'defaultValue':_0xb8a7('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb8a7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb8a7('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xb8a7('0xc'),_0xb8a7('0xd'),_0xb8a7('0xe'),_0xb8a7('0xf')),'defaultValue':_0xb8a7('0xc')},'key':{'type':Sequelize[_0xb8a7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb8a7('0x10')],'defaultValue':function(){return _0xb8a7('0x11');}},'notificationSound':{'type':Sequelize[_0xb8a7('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb8a7('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb8a7('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8a7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8a7('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xb8a7('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb8a7('0x14'),'set':function(_0x13d918){if(!_0x13d918)this[_0xb8a7('0x15')](_0xb8a7('0x16'),null);this[_0xb8a7('0x15')](_0xb8a7('0x17'),_0x13d918);}}}; \ No newline at end of file +var _0x5c7f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','12000','14400','4800','ENUM','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x5c7f,0x130));var _0xf5c7=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x5c7f[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require(_0xf5c7('0x0'));module[_0xf5c7('0x1')]={'name':{'type':Sequelize[_0xf5c7('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5c7('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xf5c7('0x3'),'no'),'defaultValue':_0xf5c7('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xf5c7('0x4')},'localstationid':{'type':Sequelize[_0xf5c7('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xf5c7('0x5'),'4800',_0xf5c7('0x6'),_0xf5c7('0x7'),_0xf5c7('0x8'),_0xf5c7('0x9')),'defaultValue':_0xf5c7('0xa')},'maxrate':{'type':Sequelize[_0xf5c7('0xb')](_0xf5c7('0x5'),'4800','7200',_0xf5c7('0x7'),_0xf5c7('0x8'),'14400'),'defaultValue':_0xf5c7('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xf5c7('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf5c7('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf5c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf5c7('0xb')]('SIP',_0xf5c7('0xe'),_0xf5c7('0xf'),_0xf5c7('0x10')),'defaultValue':_0xf5c7('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf5c7('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf5c7('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5c7('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5c7('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xf5c7('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf5c7('0x15'),'set':function(_0x18fd72){if(!_0x18fd72)this[_0xf5c7('0x16')](_0xf5c7('0x17'),null);this[_0xf5c7('0x16')](_0xf5c7('0x18'),_0x18fd72);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 033748a..a4bec9a 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 _0x9dc3=['client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','FaxAccountId','getDispositions','findOne','nolimit','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','fullname','internal','Tag','Tags','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','localstationid','type','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','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','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','ListId','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x9dc3,0xa5));var _0x39dc=function(_0x4861a4,_0x15b586){_0x4861a4=_0x4861a4-0x0;var _0x3e4cb4=_0x9dc3[_0x4861a4];return _0x3e4cb4;};'use strict';var pdf=require(_0x39dc('0x0'));var emlformat=require(_0x39dc('0x1'));var rimraf=require(_0x39dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39dc('0x3'));var moment=require(_0x39dc('0x4'));var BPromise=require(_0x39dc('0x5'));var Mustache=require(_0x39dc('0x6'));var util=require(_0x39dc('0x7'));var path=require(_0x39dc('0x8'));var sox=require('sox');var csv=require(_0x39dc('0x9'));var ejs=require(_0x39dc('0xa'));var fs=require('fs');var _=require(_0x39dc('0xb'));var squel=require(_0x39dc('0xc'));var crypto=require(_0x39dc('0xd'));var jsforce=require(_0x39dc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39dc('0xf'));var Redis=require(_0x39dc('0x10'));var authService=require(_0x39dc('0x11'));var qs=require(_0x39dc('0x12'));var as=require(_0x39dc('0x13'));var hardwareService=require(_0x39dc('0x14'));var logger=require(_0x39dc('0x15'))(_0x39dc('0x16'));var utils=require('../../config/utils');var config=require(_0x39dc('0x17'));var licenseUtil=require(_0x39dc('0x18'));var db=require(_0x39dc('0x19'))['db'];config[_0x39dc('0x1a')]=_['defaults'](config[_0x39dc('0x1a')],{'host':_0x39dc('0x1b'),'port':0x18eb});var socket=require(_0x39dc('0x1c'))(new Redis(config['redis']));require(_0x39dc('0x1d'))[_0x39dc('0x1e')](socket);var jayson=require(_0x39dc('0x1f'));var client=jayson[_0x39dc('0x20')][_0x39dc('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x39dc('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x286350,_0x258601,_0xc60a99,_0xb6f64e){return new BPromise(function(_0x1ecb04,_0x14ede6){var _0x489b4d=_0xb6f64e||client;return _0x489b4d[_0x39dc('0x22')](_0x286350,_0xc60a99)[_0x39dc('0x23')](function(_0x5690a8){logger['info'](_0x39dc('0x24'),_0x258601,_0x39dc('0x25'));logger[_0x39dc('0x26')](_0x39dc('0x27'),_0x258601,'request\x20sent',JSON[_0x39dc('0x28')](_0x5690a8));if(_0x5690a8['error']){if(_0x5690a8['error'][_0x39dc('0x29')]===0x1f4){logger[_0x39dc('0x2a')](_0x39dc('0x24'),_0x258601,_0x5690a8[_0x39dc('0x2a')][_0x39dc('0x2b')]);return _0x14ede6(_0x5690a8[_0x39dc('0x2a')][_0x39dc('0x2b')]);}logger[_0x39dc('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x258601,_0x5690a8[_0x39dc('0x2a')]['message']);return _0x1ecb04(_0x5690a8[_0x39dc('0x2a')][_0x39dc('0x2b')]);}else{logger['info'](_0x39dc('0x24'),_0x258601,_0x39dc('0x25'));_0x1ecb04(_0x5690a8[_0x39dc('0x2c')][_0x39dc('0x2b')]);}})[_0x39dc('0x2d')](function(_0x421696){logger[_0x39dc('0x2a')](_0x39dc('0x24'),_0x258601,_0x421696);_0x14ede6(_0x421696);});});}function respondWithStatusCode(_0x59e351,_0x485e9f){_0x485e9f=_0x485e9f||0xcc;return function(_0x56fff2){if(_0x56fff2){return _0x59e351['sendStatus'](_0x485e9f);}return _0x59e351[_0x39dc('0x2e')](_0x485e9f)['end']();};}function respondWithResult(_0x4246c4,_0x1fb03b){_0x1fb03b=_0x1fb03b||0xc8;return function(_0x975413){if(_0x975413){return _0x4246c4[_0x39dc('0x2e')](_0x1fb03b)[_0x39dc('0x2f')](_0x975413);}};}function respondWithFilteredResult(_0x9ecec,_0x3d7c9c){return function(_0x880d29){if(_0x880d29){var _0x239eca=_0x880d29[_0x39dc('0x30')],_0x36405a=_0x3d7c9c['offset'],_0x4196d6=_0x3d7c9c[_0x39dc('0x31')]+_0x3d7c9c[_0x39dc('0x32')],_0x4eebe2;if(_0x4196d6>=_0x239eca){_0x4196d6=_0x239eca;_0x4eebe2=0xc8;}else{_0x4eebe2=0xce;}_0x9ecec[_0x39dc('0x2e')](_0x4eebe2);return _0x9ecec[_0x39dc('0x33')](_0x39dc('0x34'),_0x36405a+'-'+_0x4196d6+'/'+_0x239eca)[_0x39dc('0x2f')](_0x880d29);}return null;};}function patchUpdates(_0x5c8c04){return function(_0x24f1c6){try{jsonpatch[_0x39dc('0x35')](_0x24f1c6,_0x5c8c04,!![]);}catch(_0x346ebf){return BPromise[_0x39dc('0x36')](_0x346ebf);}return _0x24f1c6[_0x39dc('0x37')]();};}function saveUpdates(_0x1725e0,_0x2e8902){return function(_0x354483){if(_0x354483){return _0x354483[_0x39dc('0x38')](_0x1725e0)['then'](function(_0x3a190c){return _0x3a190c;});}return null;};}function removeEntity(_0x2eed35,_0x15493f){return function(_0x4f0aff){if(_0x4f0aff){return _0x4f0aff[_0x39dc('0x39')]()[_0x39dc('0x23')](function(){var _0x48d0e0=_0x4f0aff[_0x39dc('0x3a')]({'plain':!![]});var _0x3e193c=_0x39dc('0x3b');return db[_0x39dc('0x3c')][_0x39dc('0x39')]({'where':{'type':_0x3e193c,'resourceId':_0x48d0e0['id']}})['then'](function(){return _0x4f0aff;});})[_0x39dc('0x23')](function(){_0x2eed35['status'](0xcc)[_0x39dc('0x3d')]();});}};}function handleEntityNotFound(_0x19ff9f,_0x25ab4b){return function(_0x4ea552){if(!_0x4ea552){_0x19ff9f[_0x39dc('0x3e')](0x194);}return _0x4ea552;};}function handleError(_0x13adf3,_0x5a4614){_0x5a4614=_0x5a4614||0x1f4;return function(_0x3d5782){logger['error'](_0x3d5782[_0x39dc('0x3f')]);if(_0x3d5782[_0x39dc('0x40')]){delete _0x3d5782['name'];}_0x13adf3[_0x39dc('0x2e')](_0x5a4614)[_0x39dc('0x41')](_0x3d5782);};}exports[_0x39dc('0x42')]=function(_0x36e02c,_0x4cfe53){var _0x4b46f4={'include':[{'model':db['Pause'],'as':_0x39dc('0x43')}]},_0x2fa173={},_0xd2c966={'count':0x0,'rows':[]};var _0x570749=_['map'](db['FaxAccount'][_0x39dc('0x44')],function(_0x32d003){return{'name':_0x32d003[_0x39dc('0x45')],'type':_0x32d003['type'][_0x39dc('0x46')]};});_0x2fa173[_0x39dc('0x47')]=_[_0x39dc('0x48')](_0x570749,_0x39dc('0x40'));_0x2fa173[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x36e02c['query']);_0x2fa173['filters']=_[_0x39dc('0x4b')](_0x2fa173['model'],_0x2fa173['query']);_0x4b46f4['attributes']=_[_0x39dc('0x4b')](_0x2fa173[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x36e02c[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x4b46f4[_0x39dc('0x4d')]=_0x4b46f4[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x4b46f4[_0x39dc('0x4d')]:_0x2fa173[_0x39dc('0x47')];if(!_0x36e02c[_0x39dc('0x49')][_0x39dc('0x4f')]('nolimit')){_0x4b46f4[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x36e02c['query']['limit']);_0x4b46f4['offset']=qs[_0x39dc('0x31')](_0x36e02c['query']['offset']);}_0x4b46f4[_0x39dc('0x50')]=qs[_0x39dc('0x51')](_0x36e02c[_0x39dc('0x49')]['sort']);_0x4b46f4[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x36e02c['query'],_0x2fa173[_0x39dc('0x53')]),_0x570749);if(_0x36e02c[_0x39dc('0x49')][_0x39dc('0x55')]){_0x4b46f4[_0x39dc('0x52')]=_[_0x39dc('0x56')](_0x4b46f4['where'],{'$or':_[_0x39dc('0x48')](_0x570749,function(_0x1d0e6f){if(_0x1d0e6f['type']!==_0x39dc('0x57')){var _0x31e53b={};_0x31e53b[_0x1d0e6f[_0x39dc('0x40')]]={'$like':'%'+_0x36e02c[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x31e53b;}})});}_0x4b46f4=_['merge']({},_0x4b46f4,_0x36e02c['options']);var _0x34ce33={'where':_0x4b46f4[_0x39dc('0x52')]};return db[_0x39dc('0x58')][_0x39dc('0x30')](_0x34ce33)[_0x39dc('0x23')](function(_0x5a711f){_0xd2c966['count']=_0x5a711f;if(_0x36e02c[_0x39dc('0x49')][_0x39dc('0x59')]){_0x4b46f4[_0x39dc('0x5a')]=[{'all':!![]}];}return db[_0x39dc('0x58')][_0x39dc('0x5b')](_0x4b46f4);})[_0x39dc('0x23')](function(_0x3801a8){_0xd2c966[_0x39dc('0x5c')]=_0x3801a8;return _0xd2c966;})['then'](respondWithFilteredResult(_0x4cfe53,_0x4b46f4))[_0x39dc('0x2d')](handleError(_0x4cfe53,null));};exports[_0x39dc('0x5d')]=function(_0x527820,_0x7ca27f){var _0x25bb0f={'raw':![],'where':{'id':_0x527820[_0x39dc('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x39dc('0x43')}]},_0x2738fd={};_0x2738fd['model']=_['keys'](db[_0x39dc('0x58')]['rawAttributes']);_0x2738fd['query']=_['keys'](_0x527820[_0x39dc('0x49')]);_0x2738fd[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x2738fd[_0x39dc('0x47')],_0x2738fd[_0x39dc('0x49')]);_0x25bb0f[_0x39dc('0x4d')]=_['intersection'](_0x2738fd[_0x39dc('0x47')],qs['fields'](_0x527820[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x25bb0f[_0x39dc('0x4d')]=_0x25bb0f[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x25bb0f[_0x39dc('0x4d')]:_0x2738fd['model'];if(_0x527820[_0x39dc('0x49')][_0x39dc('0x59')]){_0x25bb0f[_0x39dc('0x5a')]=[{'all':!![]}];}_0x25bb0f=_[_0x39dc('0x56')]({},_0x25bb0f,_0x527820[_0x39dc('0x5f')]);return db[_0x39dc('0x58')]['find'](_0x25bb0f)[_0x39dc('0x23')](handleEntityNotFound(_0x7ca27f,null))['then'](respondWithResult(_0x7ca27f,null))['catch'](handleError(_0x7ca27f,null));};exports[_0x39dc('0x60')]=function(_0x2d8bb8,_0x18134d){return db['FaxAccount'][_0x39dc('0x60')](_0x2d8bb8[_0x39dc('0x61')],{})[_0x39dc('0x23')](function(_0x40bfcb){var _0x567c7b=_0x2d8bb8[_0x39dc('0x62')][_0x39dc('0x3a')]({'plain':!![]});if(!_0x567c7b)throw new Error(_0x39dc('0x63'));if(_0x567c7b[_0x39dc('0x64')]===_0x39dc('0x62')){var _0x545795=_0x40bfcb[_0x39dc('0x3a')]({'plain':!![]});var _0x5c1f68=_0x39dc('0x3b');return db[_0x39dc('0x65')][_0x39dc('0x66')]({'where':{'name':_0x5c1f68,'userProfileId':_0x567c7b[_0x39dc('0x67')]},'raw':!![]})['then'](function(_0x50385f){if(_0x50385f&&_0x50385f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x545795['name'],'resourceId':_0x545795['id'],'type':_0x50385f['name'],'sectionId':_0x50385f['id']},{})['then'](function(){return _0x40bfcb;});}else{return _0x40bfcb;}})['catch'](function(_0x254299){logger['error'](_0x39dc('0x68'),_0x254299);throw _0x254299;});}return _0x40bfcb;})[_0x39dc('0x23')](respondWithResult(_0x18134d,0xc9))[_0x39dc('0x2d')](handleError(_0x18134d,null));};exports['update']=function(_0x7c3c9d,_0x4f3167){if(_0x7c3c9d[_0x39dc('0x61')]['id']){delete _0x7c3c9d['body']['id'];}return db[_0x39dc('0x58')]['find']({'where':{'id':_0x7c3c9d['params']['id']},'include':[{'model':db[_0x39dc('0x69')],'as':_0x39dc('0x43')}]})[_0x39dc('0x23')](handleEntityNotFound(_0x4f3167,null))['then'](saveUpdates(_0x7c3c9d[_0x39dc('0x61')],null))['then'](respondWithResult(_0x4f3167,null))[_0x39dc('0x2d')](handleError(_0x4f3167,null));};exports[_0x39dc('0x39')]=function(_0x447f10,_0x223f59){return db['FaxAccount'][_0x39dc('0x66')]({'where':{'id':_0x447f10[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x223f59,null))[_0x39dc('0x23')](removeEntity(_0x223f59,null))[_0x39dc('0x2d')](handleError(_0x223f59,null));};exports['describe']=function(_0x1e6799,_0x47251f){return db[_0x39dc('0x58')][_0x39dc('0x6a')]()['then'](respondWithResult(_0x47251f,null))[_0x39dc('0x2d')](handleError(_0x47251f,null));};exports[_0x39dc('0x6b')]=function(_0x1bc85e,_0x3f79a4,_0x3da62d){if(_0x1bc85e[_0x39dc('0x61')]['id']){delete _0x1bc85e[_0x39dc('0x61')]['id'];}return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x1bc85e[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x3f79a4,null))[_0x39dc('0x23')](function(_0x5194d2){if(_0x5194d2){_0x1bc85e[_0x39dc('0x61')][_0x39dc('0x6c')]=_0x5194d2['id'];return db['Disposition'][_0x39dc('0x60')](_0x1bc85e[_0x39dc('0x61')]);}})[_0x39dc('0x23')](respondWithResult(_0x3f79a4,null))[_0x39dc('0x2d')](handleError(_0x3f79a4,null));};exports[_0x39dc('0x6d')]=function(_0x3656db,_0x5c6d7d,_0x1f22b0){var _0x4a430f={'raw':![],'where':{}};var _0x23c2ee={};var _0x1d75e3={'count':0x0,'rows':[]};return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x3656db['params']['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x5c6d7d,null))['then'](function(_0x46c08d){if(_0x46c08d){_0x23c2ee[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db['Disposition']['rawAttributes']);_0x23c2ee[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x3656db[_0x39dc('0x49')]);_0x23c2ee[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x23c2ee[_0x39dc('0x47')],_0x23c2ee[_0x39dc('0x49')]);_0x4a430f[_0x39dc('0x4d')]=_[_0x39dc('0x4b')](_0x23c2ee['model'],qs['fields'](_0x3656db[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x4a430f[_0x39dc('0x4d')]=_0x4a430f['attributes']['length']?_0x4a430f['attributes']:_0x23c2ee[_0x39dc('0x47')];if(!_0x3656db[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x4a430f[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x3656db['query'][_0x39dc('0x32')]);_0x4a430f[_0x39dc('0x31')]=qs['offset'](_0x3656db[_0x39dc('0x49')][_0x39dc('0x31')]);}_0x4a430f[_0x39dc('0x50')]=qs[_0x39dc('0x51')](_0x3656db[_0x39dc('0x49')][_0x39dc('0x51')]);_0x4a430f[_0x39dc('0x52')]=qs['filters'](_[_0x39dc('0x54')](_0x3656db[_0x39dc('0x49')],_0x23c2ee[_0x39dc('0x53')]));_0x4a430f['where'][_0x39dc('0x6c')]=_0x46c08d['id'];if(_0x3656db[_0x39dc('0x49')][_0x39dc('0x55')]){_0x4a430f[_0x39dc('0x52')]=_['merge'](_0x4a430f[_0x39dc('0x52')],{'$or':_['map'](_0x4a430f[_0x39dc('0x4d')],function(_0x18d0cf){var _0x81e46b={};_0x81e46b[_0x18d0cf]={'$like':'%'+_0x3656db[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x81e46b;})});}_0x4a430f=_['merge']({},_0x4a430f,_0x3656db[_0x39dc('0x5f')]);return db[_0x39dc('0x70')][_0x39dc('0x30')]({'where':_0x4a430f[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x4ac2a5){_0x1d75e3['count']=_0x4ac2a5;if(_0x3656db[_0x39dc('0x49')][_0x39dc('0x59')]){_0x4a430f[_0x39dc('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x39dc('0x5b')](_0x4a430f);})[_0x39dc('0x23')](function(_0x26842e){_0x1d75e3[_0x39dc('0x5c')]=_0x26842e;return _0x1d75e3;});}})['then'](respondWithFilteredResult(_0x5c6d7d,_0x4a430f))['catch'](handleError(_0x5c6d7d,null));};exports[_0x39dc('0x71')]=function(_0x54b384,_0x4ae05e,_0xe6ad5a){return db[_0x39dc('0x58')]['find']({'where':{'id':_0x54b384[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x4ae05e,null))[_0x39dc('0x23')](function(_0x1823e2){if(_0x1823e2){return _0x1823e2[_0x39dc('0x71')](_0x54b384[_0x39dc('0x49')][_0x39dc('0x72')]);}})[_0x39dc('0x23')](respondWithStatusCode(_0x4ae05e,null))['catch'](handleError(_0x4ae05e,null));};exports[_0x39dc('0x73')]=function(_0x3c2d93,_0x497973,_0x36d09e){if(_0x3c2d93['body']['id']){delete _0x3c2d93[_0x39dc('0x61')]['id'];}return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x3c2d93[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x497973,null))[_0x39dc('0x23')](function(_0x5c1f41){if(_0x5c1f41){_0x3c2d93['body'][_0x39dc('0x6c')]=_0x5c1f41['id'];return db['CannedAnswer'][_0x39dc('0x60')](_0x3c2d93[_0x39dc('0x61')]);}})[_0x39dc('0x23')](respondWithResult(_0x497973,null))[_0x39dc('0x2d')](handleError(_0x497973,null));};exports['getAnswers']=function(_0x3c92d6,_0x3f5b4d,_0x351d6f){var _0x8f2be3={'raw':![],'where':{}};var _0x4d0bad={};var _0x56ca4d={'count':0x0,'rows':[]};return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x3c92d6[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x3f5b4d,null))[_0x39dc('0x23')](function(_0xda6e2c){if(_0xda6e2c){_0x4d0bad[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db[_0x39dc('0x74')][_0x39dc('0x44')]);_0x4d0bad[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x3c92d6[_0x39dc('0x49')]);_0x4d0bad[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x4d0bad[_0x39dc('0x47')],_0x4d0bad[_0x39dc('0x49')]);_0x8f2be3['attributes']=_[_0x39dc('0x4b')](_0x4d0bad[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x3c92d6['query']['fields']));_0x8f2be3['attributes']=_0x8f2be3[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x8f2be3[_0x39dc('0x4d')]:_0x4d0bad[_0x39dc('0x47')];if(!_0x3c92d6[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x8f2be3[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x3c92d6['query'][_0x39dc('0x32')]);_0x8f2be3[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x3c92d6[_0x39dc('0x49')]['offset']);}_0x8f2be3[_0x39dc('0x50')]=qs['sort'](_0x3c92d6[_0x39dc('0x49')]['sort']);_0x8f2be3[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_['pick'](_0x3c92d6['query'],_0x4d0bad[_0x39dc('0x53')]));_0x8f2be3['where'][_0x39dc('0x6c')]=_0xda6e2c['id'];if(_0x3c92d6[_0x39dc('0x49')][_0x39dc('0x55')]){_0x8f2be3['where']=_['merge'](_0x8f2be3['where'],{'$or':_['map'](_0x8f2be3['attributes'],function(_0x5324c7){var _0x3f00a8={};_0x3f00a8[_0x5324c7]={'$like':'%'+_0x3c92d6['query']['filter']+'%'};return _0x3f00a8;})});}_0x8f2be3=_[_0x39dc('0x56')]({},_0x8f2be3,_0x3c92d6[_0x39dc('0x5f')]);return db[_0x39dc('0x74')]['count']({'where':_0x8f2be3[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x2cbe5a){_0x56ca4d[_0x39dc('0x30')]=_0x2cbe5a;if(_0x3c92d6['query'][_0x39dc('0x59')]){_0x8f2be3['include']=[{'all':!![]}];}return db[_0x39dc('0x74')]['findAll'](_0x8f2be3);})[_0x39dc('0x23')](function(_0x1d652b){_0x56ca4d[_0x39dc('0x5c')]=_0x1d652b;return _0x56ca4d;});}})[_0x39dc('0x23')](respondWithFilteredResult(_0x3f5b4d,_0x8f2be3))[_0x39dc('0x2d')](handleError(_0x3f5b4d,null));};exports[_0x39dc('0x75')]=function(_0x495749,_0x7d036a,_0x48eda8){return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x495749[_0x39dc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x7d036a,null))['then'](function(_0x3c3ad3){if(_0x3c3ad3){return _0x3c3ad3[_0x39dc('0x75')](_0x495749[_0x39dc('0x49')][_0x39dc('0x72')]);}})[_0x39dc('0x23')](respondWithStatusCode(_0x7d036a,null))[_0x39dc('0x2d')](handleError(_0x7d036a,null));};exports[_0x39dc('0x76')]=function(_0x498ad8,_0x484b16,_0x3a6d8f){return db['FaxInteraction'][_0x39dc('0x66')]({'where':{'id':_0x498ad8['params']['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x484b16,null))[_0x39dc('0x23')](function(_0x5d0fb1){if(_0x5d0fb1){return _0x5d0fb1['addInteraction'](_0x498ad8[_0x39dc('0x61')][_0x39dc('0x72')],_[_0x39dc('0x77')](_0x498ad8[_0x39dc('0x61')],[_0x39dc('0x72'),'id'])||{});}})[_0x39dc('0x23')](respondWithResult(_0x484b16,null))['catch'](handleError(_0x484b16,null));};exports[_0x39dc('0x78')]=function(_0xda06c3,_0x38171f,_0x299067){var _0x5b14df={'raw':![],'where':{}};var _0x1b56f6={};var _0x2d1776={'count':0x0,'rows':[]};return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0xda06c3['params']['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x38171f,null))[_0x39dc('0x23')](function(_0x5a059b){if(_0x5a059b){_0x1b56f6['model']=_[_0x39dc('0x4a')](db[_0x39dc('0x79')][_0x39dc('0x44')]);_0x1b56f6['query']=_[_0x39dc('0x4a')](_0xda06c3[_0x39dc('0x49')]);_0x1b56f6['filters']=_[_0x39dc('0x4b')](_0x1b56f6['model'],_0x1b56f6['query']);_0x5b14df[_0x39dc('0x4d')]=_[_0x39dc('0x4b')](_0x1b56f6[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0xda06c3[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x5b14df[_0x39dc('0x4d')]=_0x5b14df[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x5b14df[_0x39dc('0x4d')]:_0x1b56f6[_0x39dc('0x47')];if(!_0xda06c3[_0x39dc('0x49')][_0x39dc('0x4f')]('nolimit')){_0x5b14df[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0xda06c3['query'][_0x39dc('0x32')]);_0x5b14df[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0xda06c3['query']['offset']);}_0x5b14df[_0x39dc('0x50')]=qs['sort'](_0xda06c3[_0x39dc('0x49')]['sort']);_0x5b14df[_0x39dc('0x52')]=qs['filters'](_[_0x39dc('0x54')](_0xda06c3[_0x39dc('0x49')],_0x1b56f6[_0x39dc('0x53')]));_0x5b14df[_0x39dc('0x52')][_0x39dc('0x6c')]=_0x5a059b['id'];if(_0xda06c3[_0x39dc('0x49')][_0x39dc('0x55')]){_0x5b14df[_0x39dc('0x52')]=_[_0x39dc('0x56')](_0x5b14df['where'],{'$or':_[_0x39dc('0x48')](_0x5b14df[_0x39dc('0x4d')],function(_0x335321){var _0x45c67b={};_0x45c67b[_0x335321]={'$like':'%'+_0xda06c3[_0x39dc('0x49')]['filter']+'%'};return _0x45c67b;})});}_0x5b14df=_[_0x39dc('0x56')]({},_0x5b14df,_0xda06c3[_0x39dc('0x5f')]);return db[_0x39dc('0x79')]['count']({'where':_0x5b14df[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x88e949){_0x2d1776['count']=_0x88e949;if(_0xda06c3[_0x39dc('0x49')]['includeAll']){_0x5b14df[_0x39dc('0x5a')]=[{'model':db[_0x39dc('0x7a')],'as':'Contact','required':![]},{'model':db[_0x39dc('0x7b')],'as':'Owner','attributes':[_0x39dc('0x40'),_0x39dc('0x7c'),_0x39dc('0x7d')],'required':![]},{'model':db[_0x39dc('0x7e')],'as':_0x39dc('0x7f'),'attributes':['id',_0x39dc('0x40'),'color'],'where':_0xda06c3[_0x39dc('0x49')][_0x39dc('0x80')]?{'id':_0xda06c3[_0x39dc('0x49')][_0x39dc('0x80')]}:undefined,'required':_0xda06c3[_0x39dc('0x49')][_0x39dc('0x80')]?!![]:![]}];}return db[_0x39dc('0x79')]['findAll'](_0x5b14df);})['then'](function(_0x437284){_0x2d1776[_0x39dc('0x5c')]=_0x437284;return _0x2d1776;});}})[_0x39dc('0x23')](respondWithFilteredResult(_0x38171f,_0x5b14df))[_0x39dc('0x2d')](handleError(_0x38171f,null));};exports['addApplications']=function(_0x50d8e2,_0x160893,_0x23ace8){return db[_0x39dc('0x58')]['findOne']({'where':{'id':_0x50d8e2[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x160893,null))[_0x39dc('0x23')](function(_0x1926b8){if(_0x1926b8){return db[_0x39dc('0x81')][_0x39dc('0x82')](function(_0x11182f){return db[_0x39dc('0x83')][_0x39dc('0x39')]({'where':{'FaxAccountId':_0x50d8e2[_0x39dc('0x5e')]['id']},'transaction':_0x11182f})[_0x39dc('0x23')](function(_0x32e851){var _0x9880bf=_['map'](_0x50d8e2[_0x39dc('0x61')],function(_0x550dc8){_0x550dc8['FaxAccountId']=_0x50d8e2['params']['id'];return _0x550dc8;});return db['FaxApplication'][_0x39dc('0x84')](_0x9880bf,{'transaction':_0x11182f});});})['then'](function(){return db[_0x39dc('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x50d8e2[_0x39dc('0x5e')]['id']},'order':_0x39dc('0x85')});});}})[_0x39dc('0x23')](respondWithResult(_0x160893,null))[_0x39dc('0x2d')](handleError(_0x160893,null));};exports['getApplications']=function(_0x1a9d79,_0x9912b3,_0x1c95ad){var _0x265a8e={};var _0x107873={};var _0x56cb93;var _0x29eadd;return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x1a9d79[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x9912b3,null))[_0x39dc('0x23')](function(_0x1689ff){if(_0x1689ff){_0x56cb93=_0x1689ff;_0x107873[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db['FaxApplication'][_0x39dc('0x44')]);_0x107873[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x1a9d79[_0x39dc('0x49')]);_0x107873[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x107873[_0x39dc('0x47')],_0x107873['query']);_0x265a8e[_0x39dc('0x4d')]=_[_0x39dc('0x4b')](_0x107873[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x1a9d79['query'][_0x39dc('0x4c')]));_0x265a8e[_0x39dc('0x4d')]=_0x265a8e[_0x39dc('0x4d')][_0x39dc('0x4e')]?_0x265a8e[_0x39dc('0x4d')]:_0x107873['model'];_0x265a8e[_0x39dc('0x50')]=qs['sort'](_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x51')]);_0x265a8e[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x1a9d79[_0x39dc('0x49')],_0x107873['filters']));if(_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x55')]){_0x265a8e['where']=_[_0x39dc('0x56')](_0x265a8e['where'],{'$or':_[_0x39dc('0x48')](_0x265a8e[_0x39dc('0x4d')],function(_0x27faa9){var _0x2a8eae={};_0x2a8eae[_0x27faa9]={'$like':'%'+_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x2a8eae;})});}_0x265a8e=_[_0x39dc('0x56')]({},_0x265a8e,_0x1a9d79[_0x39dc('0x5f')]);return _0x56cb93[_0x39dc('0x86')](_0x265a8e);}})['then'](function(_0x5534cf){if(_0x5534cf){_0x29eadd=_0x5534cf['length'];if(!_0x1a9d79[_0x39dc('0x49')]['hasOwnProperty'](_0x39dc('0x6f'))){_0x265a8e[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x1a9d79[_0x39dc('0x49')][_0x39dc('0x32')]);_0x265a8e[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x1a9d79[_0x39dc('0x49')]['offset']);}return _0x56cb93['getApplications'](_0x265a8e);}})['then'](function(_0x527bd0){if(_0x527bd0){return _0x527bd0?{'count':_0x29eadd,'rows':_0x527bd0}:null;}})[_0x39dc('0x23')](respondWithResult(_0x9912b3,null))[_0x39dc('0x2d')](handleError(_0x9912b3,null));};function Extension(_0x3fa454,_0x280be2,_0x553123,_0x1a4075){this[_0x39dc('0x87')]=_0x39dc('0x88');this['exten']=_0x3fa454[_0x39dc('0x89')];this['app']=_0x1a4075;this[_0x39dc('0x8a')]='system';this[_0x39dc('0x8b')]=_0x39dc('0x8c');this[_0x39dc('0x6c')]=_0x3fa454['id'];this['priority']=_0x280be2;this[_0x39dc('0x8d')]=_0x553123;}function createExtensionsReciveFax(_0x13ecd1){var _0x1e5d0e=0x1;var _0x3c6b74=[];_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,'',_0x39dc('0x8f')));_0x1e5d0e+=0x1;_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,_0x39dc('0x90'),_0x39dc('0x91')));_0x1e5d0e+=0x1;for(var _0x1c069e in _0x13ecd1){if(_0x13ecd1[_0x39dc('0x4f')](_0x1c069e)&&(_0x1c069e===_0x39dc('0x92')||_0x1c069e===_0x39dc('0x89')||_0x1c069e===_0x39dc('0x93')||_0x1c069e===_0x39dc('0x94')||_0x1c069e===_0x39dc('0x95')||_0x1c069e==='maxrate'||_0x1c069e===_0x39dc('0x96')||_0x1c069e===_0x39dc('0x97')||_0x1c069e===_0x39dc('0x98'))){_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,_0x39dc('0x99')+_0x1c069e+')='+_0x13ecd1[_0x1c069e],_0x39dc('0x91')));_0x1e5d0e+=0x1;}}_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,'6',_0x39dc('0x9a')));_0x1e5d0e+=0x1;_0x3c6b74[_0x39dc('0x8e')](new Extension(_0x13ecd1,_0x1e5d0e,_0x39dc('0x9b'),_0x39dc('0x9c')));_0x1e5d0e=0x0;return _0x3c6b74;}exports['addAccountApplications']=function(_0x16f23d,_0x4d4255,_0xb70030){var _0x3bd83c;return db[_0x39dc('0x81')][_0x39dc('0x82')](function(_0x59affa){return db['FaxAccount'][_0x39dc('0x60')](_0x16f23d['body'],{'transaction':_0x59affa})[_0x39dc('0x23')](function(_0x5e00b6){_0x3bd83c=_0x5e00b6['get']({'plain':!![]});return db['VoiceExtension'][_0x39dc('0x84')](createExtensionsReciveFax(_0x3bd83c),{'transaction':_0x59affa});});})[_0x39dc('0x23')](function(){return _0x3bd83c;})[_0x39dc('0x23')](respondWithResult(_0x4d4255,null))[_0x39dc('0x2d')](handleError(_0x4d4255,null));};exports[_0x39dc('0x9d')]=function(_0x4fda46,_0x3e11ab,_0x47fd3a){var _0x431b88;return db[_0x39dc('0x81')]['transaction'](function(_0x3f7987){return db[_0x39dc('0x58')][_0x39dc('0x38')](_0x4fda46['body'],{'where':{'id':_0x4fda46[_0x39dc('0x61')]['id']},'transaction':_0x3f7987})[_0x39dc('0x23')](function(_0x1a699b){return db[_0x39dc('0x9e')][_0x39dc('0x39')]({'where':{'FaxAccountId':_0x4fda46[_0x39dc('0x61')]['id']},'transaction':_0x3f7987})[_0x39dc('0x23')](function(_0x124b12){return db[_0x39dc('0x9e')][_0x39dc('0x84')](createExtensionsReciveFax(_[_0x39dc('0x77')](_0x4fda46[_0x39dc('0x61')],[_0x39dc('0x9f'),_0x39dc('0x46'),_0x39dc('0xa0'),_0x39dc('0xa1'),_0x39dc('0xa2'),'ListId'])),{'transaction':_0x3f7987});});});})[_0x39dc('0x23')](function(){return db[_0x39dc('0x58')]['findById'](_0x4fda46[_0x39dc('0x61')]['id']);})[_0x39dc('0x23')](respondWithResult(_0x3e11ab,null))[_0x39dc('0x2d')](handleError(_0x3e11ab,null));};exports[_0x39dc('0xa3')]=function(_0x10e061,_0x3c2984,_0x2f4b5b){var _0x875611={'raw':!![],'where':{}};var _0x145784={};var _0xbb0c3={'count':0x0,'rows':[]};return db[_0x39dc('0x58')]['findOne']({'where':{'id':_0x10e061[_0x39dc('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3c2984,null))[_0x39dc('0x23')](function(_0x34c032){if(_0x34c032){_0x145784['model']=_['keys'](db[_0x39dc('0xa4')]['rawAttributes']);_0x145784[_0x39dc('0x49')]=_[_0x39dc('0x4a')](_0x10e061['query']);_0x145784[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x145784[_0x39dc('0x47')],_0x145784[_0x39dc('0x49')]);_0x875611[_0x39dc('0x4d')]=_['intersection'](_0x145784[_0x39dc('0x47')],qs[_0x39dc('0x4c')](_0x10e061['query'][_0x39dc('0x4c')]));_0x875611[_0x39dc('0x4d')]=_0x875611['attributes']['length']?_0x875611[_0x39dc('0x4d')]:_0x145784[_0x39dc('0x47')];if(!_0x10e061[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x875611[_0x39dc('0x32')]=qs[_0x39dc('0x32')](_0x10e061[_0x39dc('0x49')][_0x39dc('0x32')]);_0x875611['offset']=qs['offset'](_0x10e061[_0x39dc('0x49')][_0x39dc('0x31')]);}_0x875611['order']=qs[_0x39dc('0x51')](_0x10e061['query'][_0x39dc('0x51')]);_0x875611[_0x39dc('0x52')]=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x10e061[_0x39dc('0x49')],_0x145784[_0x39dc('0x53')]));_0x875611[_0x39dc('0x52')]['FaxAccountId']=_0x34c032['id'];if(_0x10e061[_0x39dc('0x49')][_0x39dc('0x55')]){_0x875611[_0x39dc('0x52')]=_['merge'](_0x875611[_0x39dc('0x52')],{'$or':_[_0x39dc('0x48')](_0x875611[_0x39dc('0x4d')],function(_0x3b2be9){var _0x23f5e2={};_0x23f5e2[_0x3b2be9]={'$like':'%'+_0x10e061[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x23f5e2;})});}if(_0x10e061[_0x39dc('0x49')]['$gte']){var _0x3b2453=_0x10e061[_0x39dc('0x49')][_0x39dc('0xa5')][_0x39dc('0xa6')](',');var _0x4671a1={};_0x4671a1[_0x3b2453[0x0]]={'$gte':moment(_0x3b2453[0x1])[_0x39dc('0xa7')](_0x39dc('0xa8'))};_0x875611[_0x39dc('0x52')]=_[_0x39dc('0x56')](_0x875611['where'],_0x4671a1);}_0x875611=_[_0x39dc('0x56')]({},_0x875611,_0x10e061[_0x39dc('0x5f')]);return db['FaxMessage'][_0x39dc('0x30')]({'where':_0x875611[_0x39dc('0x52')]})[_0x39dc('0x23')](function(_0x7ef9e8){_0xbb0c3[_0x39dc('0x30')]=_0x7ef9e8;if(_0x10e061['query'][_0x39dc('0x59')]){_0x875611[_0x39dc('0x5a')]=[{'all':!![]}];}return db[_0x39dc('0xa4')][_0x39dc('0x5b')](_0x875611);})[_0x39dc('0x23')](function(_0x2294cd){_0xbb0c3['rows']=_0x2294cd;return _0xbb0c3;});}})[_0x39dc('0x23')](respondWithFilteredResult(_0x3c2984,_0x875611))[_0x39dc('0x2d')](handleError(_0x3c2984,null));};exports['send']=function(_0x264bf7,_0x3af4f2,_0x262abc){var _0x5beb08,_0x5900e3={},_0x3dc7f8;if(_0x264bf7[_0x39dc('0x61')]['to']){_0x3dc7f8=_0x264bf7[_0x39dc('0x61')]['to'][0x0];}return db[_0x39dc('0x58')][_0x39dc('0x66')]({'where':{'id':_0x264bf7[_0x39dc('0x5e')]['id']},'include':[{'model':db[_0x39dc('0xa9')],'as':_0x39dc('0xaa'),'include':[{'model':db[_0x39dc('0x7a')],'as':_0x39dc('0xab'),'where':{'fax':_0x3dc7f8},'limit':0x1,'order':[[_0x39dc('0xa1'),_0x39dc('0xac')]]}]}]})[_0x39dc('0x23')](handleEntityNotFound(_0x3af4f2,null))['then'](function(_0x42fab9){_0x5beb08=_0x42fab9;if(_0x264bf7['body'][_0x39dc('0xad')]&&_0x264bf7['body'][_0x39dc('0xad')][_0x39dc('0x4e')]){for(var _0x4ebd07=0x0;_0x4ebd07<_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][_0x39dc('0x4e')];_0x4ebd07+=0x1){_0x264bf7['body']['attachments'][_0x4ebd07]={'filename':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][_0x4ebd07][_0x39dc('0x40')],'id':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][_0x4ebd07]['id'],'path':path['join'](config['root'],_0x39dc('0xae'),_0x264bf7[_0x39dc('0x61')]['attachments'][_0x4ebd07]['basename'])};}}return respondWithRpcPromise(_0x39dc('0xaf'),_0x39dc('0xaf'),{'FaxAccountId':_[_0x39dc('0xb0')](_0x264bf7['params']['id'])?undefined:_0x264bf7['params']['id'],'path':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0]['path'])?undefined:_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0x8')],'fax':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x61')]['to'][0x0])?undefined:_0x264bf7[_0x39dc('0x61')]['to'][0x0]},client9002);})[_0x39dc('0x23')](function(){if(_0x5beb08){if(_['isNil'](_0x264bf7[_0x39dc('0x61')][_0x39dc('0xb1')])){_0x264bf7[_0x39dc('0x61')][_0x39dc('0xb1')]=util[_0x39dc('0xa7')](_0x39dc('0xb2'),_0x5beb08[_0x39dc('0x40')],_0x5beb08['fax']);}if(_0x5beb08[_0x39dc('0xaa')]){if(_0x5beb08[_0x39dc('0xaa')][_0x39dc('0xab')]['length']){return _0x5beb08[_0x39dc('0xaa')][_0x39dc('0xab')][0x0];}else{return db[_0x39dc('0x7a')][_0x39dc('0x60')](_[_0x39dc('0xb3')](_0x264bf7[_0x39dc('0x61')],{'firstName':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'phone':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'fax':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'ListId':_0x5beb08[_0x39dc('0xb4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x189030){if(_0x189030){return db[_0x39dc('0x79')][_0x39dc('0x66')]({'where':{'ContactId':_0x189030['id'],'closed':![],'FaxAccountId':_0x5beb08['id']}})[_0x39dc('0x23')](function(_0x43fa0d){if(_0x43fa0d){return[_0x43fa0d,![]];}return db[_0x39dc('0x79')]['create']({'UserId':_0x264bf7[_0x39dc('0x62')]['id'],'ContactId':_0x189030['id'],'FaxAccountId':_0x5beb08['id'],'fax':_0x264bf7[_0x39dc('0x61')]['to'][0x0],'firstMsgDirection':_0x39dc('0xb5'),'Messages':[_[_0x39dc('0x56')](_0x264bf7['body'],{'read':![],'body':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0xb6')],'FaxAccountId':_0x5beb08['id'],'UserId':_0x264bf7[_0x39dc('0x62')]['id'],'ContactId':_0x189030['id'],'AttachmentId':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x39dc('0xb7')}]})[_0x39dc('0x23')](function(_0x1b45d3){return[_0x1b45d3,!![]];});});}else{throw new Error(_0x39dc('0xb8'));}})[_0x39dc('0xb9')](function(_0x3639b7,_0x755350){if(_0x755350){return _0x3639b7;}return db[_0x39dc('0xa4')]['create']({'direction':_0x39dc('0xb5'),'read':![],'body':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0xb6')],'FaxAccountId':_0x5beb08['id'],'FaxInteractionId':_0x3639b7['id'],'UserId':_0x264bf7[_0x39dc('0x62')]['id'],'ContactId':_0x3639b7[_0x39dc('0xba')],'AttachmentId':_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0]['id']})[_0x39dc('0x23')](function(_0x4825e5){_0x3639b7[_0x39dc('0xbb')][_0x39dc('0xb7')]=[];_0x3639b7['dataValues'][_0x39dc('0xb7')][_0x39dc('0x8e')](_0x4825e5[_0x39dc('0xbb')]);return _0x3639b7;});})[_0x39dc('0x23')](function(_0x46f42b){respondWithRpcPromise('SendFax',_0x39dc('0xbc'),{'FaxAccountId':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x5e')]['id'])?undefined:_0x264bf7[_0x39dc('0x5e')]['id'],'path':_[_0x39dc('0xb0')](_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0x8')])?undefined:_0x264bf7[_0x39dc('0x61')][_0x39dc('0xad')][0x0][_0x39dc('0x8')],'fax':_['isNil'](_0x264bf7[_0x39dc('0x61')]['to'][0x0])?undefined:_0x264bf7[_0x39dc('0x61')]['to'][0x0],'AttachmentId':_0x264bf7[_0x39dc('0x61')]['attachments'][0x0]['id']},client9002)[_0x39dc('0x23')](function(_0x1e8dcd){logger[_0x39dc('0xbd')](_0x39dc('0xbe'),_0x1e8dcd);})['catch'](function(_0x485d90){logger[_0x39dc('0xbd')](_0x39dc('0xbe'),_0x485d90);});return _0x46f42b;})[_0x39dc('0x23')](respondWithResult(_0x3af4f2,null))['catch'](handleError(_0x3af4f2,null));};exports['addAgents']=function(_0x571a94,_0x55a78b,_0x55625a){return db[_0x39dc('0x58')]['find']({'where':{'id':_0x571a94[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x55a78b,null))['then'](function(_0x1d4d32){if(_0x1d4d32){return _0x1d4d32['addAgents'](_0x571a94[_0x39dc('0x61')][_0x39dc('0x72')],_['omit'](_0x571a94[_0x39dc('0x61')],['ids','id'])||{})[_0x39dc('0xb9')](function(_0x137010){for(var _0x5c7ceb=0x0;_0x5c7ceb<_0x571a94[_0x39dc('0x61')][_0x39dc('0x72')]['length'];_0x5c7ceb+=0x1){socket[_0x39dc('0xbf')](_0x39dc('0xc0'),{'UserId':_0x571a94[_0x39dc('0x61')]['ids'][_0x5c7ceb],'FaxAccountId':_0x571a94['params']['id']});}return _0x137010;});}})[_0x39dc('0x23')](respondWithResult(_0x55a78b,null))[_0x39dc('0x2d')](handleError(_0x55a78b,null));};exports[_0x39dc('0xc1')]=function(_0x157152,_0xb5febf,_0x5b6556){return db[_0x39dc('0x58')]['find']({'where':{'id':_0x157152['params']['id']}})['then'](handleEntityNotFound(_0xb5febf,null))[_0x39dc('0x23')](function(_0x13660a){if(_0x13660a){return _0x13660a[_0x39dc('0xc1')](_0x157152[_0x39dc('0x49')][_0x39dc('0x72')])['then'](function(){if(_[_0x39dc('0xc2')](_0x157152['query'][_0x39dc('0x72')])){for(var _0x43bdb4=0x0;_0x43bdb4<_0x157152[_0x39dc('0x49')][_0x39dc('0x72')][_0x39dc('0x4e')];_0x43bdb4+=0x1){socket[_0x39dc('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x157152[_0x39dc('0x49')][_0x39dc('0x72')][_0x43bdb4]),'FaxAccountId':Number(_0x157152[_0x39dc('0x5e')]['id'])});}}else{socket[_0x39dc('0xbf')](_0x39dc('0xc3'),{'UserId':Number(_0x157152[_0x39dc('0x49')][_0x39dc('0x72')]),'FaxAccountId':Number(_0x157152['params']['id'])});}});}})[_0x39dc('0x23')](respondWithStatusCode(_0xb5febf,null))[_0x39dc('0x2d')](handleError(_0xb5febf,null));};exports[_0x39dc('0xc4')]=function(_0x5e77f2,_0x1ce56a,_0x497252){var _0x5d8ed7={};var _0x169205={};var _0xd9bac2;var _0x3517e9;return db[_0x39dc('0x58')][_0x39dc('0x6e')]({'where':{'id':_0x5e77f2[_0x39dc('0x5e')]['id']}})[_0x39dc('0x23')](handleEntityNotFound(_0x1ce56a,null))[_0x39dc('0x23')](function(_0x524a0c){if(_0x524a0c){_0xd9bac2=_0x524a0c;_0x169205[_0x39dc('0x47')]=_[_0x39dc('0x4a')](db[_0x39dc('0x7b')][_0x39dc('0x44')]);_0x169205['query']=_[_0x39dc('0x4a')](_0x5e77f2[_0x39dc('0x49')]);_0x169205[_0x39dc('0x53')]=_[_0x39dc('0x4b')](_0x169205[_0x39dc('0x47')],_0x169205[_0x39dc('0x49')]);_0x5d8ed7['attributes']=_['intersection'](_0x169205[_0x39dc('0x47')],qs['fields'](_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x4c')]));_0x5d8ed7[_0x39dc('0x4d')]=_0x5d8ed7[_0x39dc('0x4d')]['length']?_0x5d8ed7[_0x39dc('0x4d')]:_0x169205[_0x39dc('0x47')];_0x5d8ed7[_0x39dc('0x50')]=qs[_0x39dc('0x51')](_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x51')]);_0x5d8ed7['where']=qs[_0x39dc('0x53')](_[_0x39dc('0x54')](_0x5e77f2[_0x39dc('0x49')],_0x169205[_0x39dc('0x53')]));if(_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x55')]){_0x5d8ed7[_0x39dc('0x52')]=_['merge'](_0x5d8ed7[_0x39dc('0x52')],{'$or':_[_0x39dc('0x48')](_0x5d8ed7[_0x39dc('0x4d')],function(_0x3e8a24){var _0x3322b3={};_0x3322b3[_0x3e8a24]={'$like':'%'+_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x55')]+'%'};return _0x3322b3;})});}_0x5d8ed7=_['merge']({},_0x5d8ed7,_0x5e77f2['options']);return _0xd9bac2[_0x39dc('0xc4')](_0x5d8ed7);}})[_0x39dc('0x23')](function(_0x1e2162){if(_0x1e2162){_0x3517e9=_0x1e2162[_0x39dc('0x4e')];if(!_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x4f')](_0x39dc('0x6f'))){_0x5d8ed7[_0x39dc('0x32')]=qs['limit'](_0x5e77f2['query'][_0x39dc('0x32')]);_0x5d8ed7[_0x39dc('0x31')]=qs[_0x39dc('0x31')](_0x5e77f2[_0x39dc('0x49')][_0x39dc('0x31')]);}return _0xd9bac2[_0x39dc('0xc4')](_0x5d8ed7);}})[_0x39dc('0x23')](function(_0x47f784){if(_0x47f784){return _0x47f784?{'count':_0x3517e9,'rows':_0x47f784}:null;}})[_0x39dc('0x23')](respondWithResult(_0x1ce56a,null))[_0x39dc('0x2d')](handleError(_0x1ce56a,null));}; \ No newline at end of file +var _0x32c0=['key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','pick','where','filter','merge','options','FaxAccount','includeAll','include','findAll','rows','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','bulkCreate','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','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','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','attachments','join','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','type'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x32c0,0x1f3));var _0x032c=function(_0x4cd2fd,_0x3ee28a){_0x4cd2fd=_0x4cd2fd-0x0;var _0x4e2318=_0x32c0[_0x4cd2fd];return _0x4e2318;};'use strict';var pdf=require(_0x032c('0x0'));var emlformat=require(_0x032c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x032c('0x2'));var jsonpatch=require(_0x032c('0x3'));var rp=require('request-promise');var moment=require(_0x032c('0x4'));var BPromise=require(_0x032c('0x5'));var Mustache=require(_0x032c('0x6'));var util=require(_0x032c('0x7'));var path=require('path');var sox=require(_0x032c('0x8'));var csv=require(_0x032c('0x9'));var ejs=require(_0x032c('0xa'));var fs=require('fs');var _=require(_0x032c('0xb'));var squel=require('squel');var crypto=require(_0x032c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x032c('0xd'));var toCsv=require(_0x032c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x032c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x032c('0x10'));var logger=require(_0x032c('0x11'))(_0x032c('0x12'));var utils=require(_0x032c('0x13'));var config=require(_0x032c('0x14'));var licenseUtil=require(_0x032c('0x15'));var db=require('../../mysqldb')['db'];config[_0x032c('0x16')]=_[_0x032c('0x17')](config[_0x032c('0x16')],{'host':_0x032c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x032c('0x16')]));require(_0x032c('0x19'))[_0x032c('0x1a')](socket);var jayson=require(_0x032c('0x1b'));var client=jayson[_0x032c('0x1c')][_0x032c('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x032c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x15ddb8,_0x3ebda8,_0x3f6f4d,_0x3ccbd5){return new BPromise(function(_0x46cbd2,_0x49c770){var _0x1444bb=_0x3ccbd5||client;return _0x1444bb[_0x032c('0x1e')](_0x15ddb8,_0x3f6f4d)[_0x032c('0x1f')](function(_0x433ded){logger[_0x032c('0x20')](_0x032c('0x21'),_0x3ebda8,_0x032c('0x22'));logger[_0x032c('0x23')](_0x032c('0x24'),_0x3ebda8,_0x032c('0x22'),JSON[_0x032c('0x25')](_0x433ded));if(_0x433ded[_0x032c('0x26')]){if(_0x433ded[_0x032c('0x26')]['code']===0x1f4){logger[_0x032c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3ebda8,_0x433ded['error']['message']);return _0x49c770(_0x433ded['error'][_0x032c('0x27')]);}logger['error'](_0x032c('0x21'),_0x3ebda8,_0x433ded[_0x032c('0x26')][_0x032c('0x27')]);return _0x46cbd2(_0x433ded['error'][_0x032c('0x27')]);}else{logger[_0x032c('0x20')](_0x032c('0x21'),_0x3ebda8,_0x032c('0x22'));_0x46cbd2(_0x433ded[_0x032c('0x28')][_0x032c('0x27')]);}})[_0x032c('0x29')](function(_0x58894b){logger[_0x032c('0x26')](_0x032c('0x21'),_0x3ebda8,_0x58894b);_0x49c770(_0x58894b);});});}function respondWithStatusCode(_0x1d1cd5,_0x56d20d){_0x56d20d=_0x56d20d||0xcc;return function(_0x1350d1){if(_0x1350d1){return _0x1d1cd5[_0x032c('0x2a')](_0x56d20d);}return _0x1d1cd5[_0x032c('0x2b')](_0x56d20d)[_0x032c('0x2c')]();};}function respondWithResult(_0x58de77,_0x37a292){_0x37a292=_0x37a292||0xc8;return function(_0x7150c8){if(_0x7150c8){return _0x58de77[_0x032c('0x2b')](_0x37a292)[_0x032c('0x2d')](_0x7150c8);}};}function respondWithFilteredResult(_0x51d679,_0x119d8f){return function(_0x1de595){if(_0x1de595){var _0x5cdd90=_0x1de595[_0x032c('0x2e')],_0x659bbf=_0x119d8f['offset'],_0x306935=_0x119d8f['offset']+_0x119d8f[_0x032c('0x2f')],_0x4508ab;if(_0x306935>=_0x5cdd90){_0x306935=_0x5cdd90;_0x4508ab=0xc8;}else{_0x4508ab=0xce;}_0x51d679['status'](_0x4508ab);return _0x51d679[_0x032c('0x30')](_0x032c('0x31'),_0x659bbf+'-'+_0x306935+'/'+_0x5cdd90)['json'](_0x1de595);}return null;};}function patchUpdates(_0x3bdb1b){return function(_0x1e8993){try{jsonpatch[_0x032c('0x32')](_0x1e8993,_0x3bdb1b,!![]);}catch(_0x41a78c){return BPromise['reject'](_0x41a78c);}return _0x1e8993[_0x032c('0x33')]();};}function saveUpdates(_0x2b80b3,_0x5e46df){return function(_0x42d518){if(_0x42d518){return _0x42d518[_0x032c('0x34')](_0x2b80b3)[_0x032c('0x1f')](function(_0x420495){return _0x420495;});}return null;};}function removeEntity(_0xb5c919,_0x497a9e){return function(_0x41ca36){if(_0x41ca36){return _0x41ca36['destroy']()[_0x032c('0x1f')](function(){var _0x5aed99=_0x41ca36[_0x032c('0x35')]({'plain':!![]});var _0x1cba58=_0x032c('0x36');return db[_0x032c('0x37')][_0x032c('0x38')]({'where':{'type':_0x1cba58,'resourceId':_0x5aed99['id']}})[_0x032c('0x1f')](function(){return _0x41ca36;});})['then'](function(){_0xb5c919[_0x032c('0x2b')](0xcc)[_0x032c('0x2c')]();});}};}function handleEntityNotFound(_0x4e1aa3,_0x237089){return function(_0x33f8b0){if(!_0x33f8b0){_0x4e1aa3[_0x032c('0x2a')](0x194);}return _0x33f8b0;};}function handleError(_0x482889,_0x3a7fd3){_0x3a7fd3=_0x3a7fd3||0x1f4;return function(_0x1b62bb){logger[_0x032c('0x26')](_0x1b62bb[_0x032c('0x39')]);if(_0x1b62bb[_0x032c('0x3a')]){delete _0x1b62bb[_0x032c('0x3a')];}_0x482889[_0x032c('0x2b')](_0x3a7fd3)['send'](_0x1b62bb);};}exports[_0x032c('0x3b')]=function(_0x15fafc,_0x14174a){var _0x2858f8={'include':[{'model':db[_0x032c('0x3c')],'as':_0x032c('0x3d')}]},_0x36ca21={},_0xf27830={'count':0x0,'rows':[]};var _0x4bba77=_[_0x032c('0x3e')](db['FaxAccount'][_0x032c('0x3f')],function(_0x4e9d6a){return{'name':_0x4e9d6a['fieldName'],'type':_0x4e9d6a[_0x032c('0x40')][_0x032c('0x41')]};});_0x36ca21['model']=_['map'](_0x4bba77,_0x032c('0x3a'));_0x36ca21['query']=_['keys'](_0x15fafc[_0x032c('0x42')]);_0x36ca21[_0x032c('0x43')]=_[_0x032c('0x44')](_0x36ca21[_0x032c('0x45')],_0x36ca21[_0x032c('0x42')]);_0x2858f8[_0x032c('0x46')]=_['intersection'](_0x36ca21[_0x032c('0x45')],qs['fields'](_0x15fafc['query'][_0x032c('0x47')]));_0x2858f8[_0x032c('0x46')]=_0x2858f8[_0x032c('0x46')][_0x032c('0x48')]?_0x2858f8[_0x032c('0x46')]:_0x36ca21['model'];if(!_0x15fafc['query'][_0x032c('0x49')]('nolimit')){_0x2858f8[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x15fafc[_0x032c('0x42')][_0x032c('0x2f')]);_0x2858f8[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x15fafc[_0x032c('0x42')][_0x032c('0x4a')]);}_0x2858f8[_0x032c('0x4b')]=qs['sort'](_0x15fafc[_0x032c('0x42')]['sort']);_0x2858f8['where']=qs[_0x032c('0x43')](_[_0x032c('0x4c')](_0x15fafc[_0x032c('0x42')],_0x36ca21[_0x032c('0x43')]),_0x4bba77);if(_0x15fafc[_0x032c('0x42')]['filter']){_0x2858f8['where']=_['merge'](_0x2858f8[_0x032c('0x4d')],{'$or':_['map'](_0x4bba77,function(_0x52fa05){if(_0x52fa05[_0x032c('0x40')]!=='VIRTUAL'){var _0x33a7c9={};_0x33a7c9[_0x52fa05[_0x032c('0x3a')]]={'$like':'%'+_0x15fafc[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x33a7c9;}})});}_0x2858f8=_[_0x032c('0x4f')]({},_0x2858f8,_0x15fafc[_0x032c('0x50')]);var _0xb4e45={'where':_0x2858f8[_0x032c('0x4d')]};return db[_0x032c('0x51')]['count'](_0xb4e45)[_0x032c('0x1f')](function(_0x486383){_0xf27830[_0x032c('0x2e')]=_0x486383;if(_0x15fafc[_0x032c('0x42')][_0x032c('0x52')]){_0x2858f8[_0x032c('0x53')]=[{'all':!![]}];}return db[_0x032c('0x51')][_0x032c('0x54')](_0x2858f8);})[_0x032c('0x1f')](function(_0x110a5f){_0xf27830[_0x032c('0x55')]=_0x110a5f;return _0xf27830;})['then'](respondWithFilteredResult(_0x14174a,_0x2858f8))[_0x032c('0x29')](handleError(_0x14174a,null));};exports['show']=function(_0x13931a,_0x2f1032){var _0x4e8fd6={'raw':![],'where':{'id':_0x13931a[_0x032c('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x032c('0x3d')}]},_0x3fd7dc={};_0x3fd7dc[_0x032c('0x45')]=_[_0x032c('0x57')](db['FaxAccount'][_0x032c('0x3f')]);_0x3fd7dc[_0x032c('0x42')]=_[_0x032c('0x57')](_0x13931a[_0x032c('0x42')]);_0x3fd7dc[_0x032c('0x43')]=_[_0x032c('0x44')](_0x3fd7dc[_0x032c('0x45')],_0x3fd7dc[_0x032c('0x42')]);_0x4e8fd6[_0x032c('0x46')]=_[_0x032c('0x44')](_0x3fd7dc['model'],qs[_0x032c('0x47')](_0x13931a[_0x032c('0x42')][_0x032c('0x47')]));_0x4e8fd6[_0x032c('0x46')]=_0x4e8fd6[_0x032c('0x46')][_0x032c('0x48')]?_0x4e8fd6[_0x032c('0x46')]:_0x3fd7dc[_0x032c('0x45')];if(_0x13931a['query'][_0x032c('0x52')]){_0x4e8fd6[_0x032c('0x53')]=[{'all':!![]}];}_0x4e8fd6=_[_0x032c('0x4f')]({},_0x4e8fd6,_0x13931a[_0x032c('0x50')]);return db[_0x032c('0x51')]['find'](_0x4e8fd6)[_0x032c('0x1f')](handleEntityNotFound(_0x2f1032,null))[_0x032c('0x1f')](respondWithResult(_0x2f1032,null))[_0x032c('0x29')](handleError(_0x2f1032,null));};exports[_0x032c('0x58')]=function(_0x41312a,_0xf2e968){return db[_0x032c('0x51')][_0x032c('0x58')](_0x41312a[_0x032c('0x59')],{})[_0x032c('0x1f')](function(_0x3fe8c6){var _0x56ef3f=_0x41312a['user'][_0x032c('0x35')]({'plain':!![]});if(!_0x56ef3f)throw new Error(_0x032c('0x5a'));if(_0x56ef3f[_0x032c('0x5b')]===_0x032c('0x5c')){var _0x5bd5c5=_0x3fe8c6[_0x032c('0x35')]({'plain':!![]});var _0x361838=_0x032c('0x36');return db[_0x032c('0x5d')][_0x032c('0x5e')]({'where':{'name':_0x361838,'userProfileId':_0x56ef3f[_0x032c('0x5f')]},'raw':!![]})[_0x032c('0x1f')](function(_0x2b6a1e){if(_0x2b6a1e&&_0x2b6a1e[_0x032c('0x60')]===0x0){return db['UserProfileResource'][_0x032c('0x58')]({'name':_0x5bd5c5[_0x032c('0x3a')],'resourceId':_0x5bd5c5['id'],'type':_0x2b6a1e[_0x032c('0x3a')],'sectionId':_0x2b6a1e['id']},{})[_0x032c('0x1f')](function(){return _0x3fe8c6;});}else{return _0x3fe8c6;}})['catch'](function(_0xdeb7a4){logger[_0x032c('0x26')](_0x032c('0x61'),_0xdeb7a4);throw _0xdeb7a4;});}return _0x3fe8c6;})[_0x032c('0x1f')](respondWithResult(_0xf2e968,0xc9))[_0x032c('0x29')](handleError(_0xf2e968,null));};exports['update']=function(_0x190fdc,_0xd0d761){if(_0x190fdc[_0x032c('0x59')]['id']){delete _0x190fdc[_0x032c('0x59')]['id'];}return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x190fdc[_0x032c('0x56')]['id']},'include':[{'model':db[_0x032c('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xd0d761,null))[_0x032c('0x1f')](saveUpdates(_0x190fdc['body'],null))[_0x032c('0x1f')](respondWithResult(_0xd0d761,null))['catch'](handleError(_0xd0d761,null));};exports[_0x032c('0x38')]=function(_0x364882,_0x3b78db){return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x364882['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x3b78db,null))[_0x032c('0x1f')](removeEntity(_0x3b78db,null))['catch'](handleError(_0x3b78db,null));};exports[_0x032c('0x62')]=function(_0x32efea,_0x224249){return db['FaxAccount'][_0x032c('0x62')]()[_0x032c('0x1f')](respondWithResult(_0x224249,null))['catch'](handleError(_0x224249,null));};exports[_0x032c('0x63')]=function(_0x1915ed,_0x160100,_0x469ab7){if(_0x1915ed[_0x032c('0x59')]['id']){delete _0x1915ed[_0x032c('0x59')]['id'];}return db['FaxAccount'][_0x032c('0x5e')]({'where':{'id':_0x1915ed[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x160100,null))[_0x032c('0x1f')](function(_0x1b4594){if(_0x1b4594){_0x1915ed[_0x032c('0x59')][_0x032c('0x64')]=_0x1b4594['id'];return db[_0x032c('0x65')][_0x032c('0x58')](_0x1915ed['body']);}})[_0x032c('0x1f')](respondWithResult(_0x160100,null))[_0x032c('0x29')](handleError(_0x160100,null));};exports[_0x032c('0x66')]=function(_0x38cbed,_0x2f8b61,_0x1811a2){var _0x1a2cd5={'raw':![],'where':{}};var _0x40ba8f={};var _0x40c464={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x38cbed[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x2f8b61,null))[_0x032c('0x1f')](function(_0x20a67c){if(_0x20a67c){_0x40ba8f[_0x032c('0x45')]=_[_0x032c('0x57')](db[_0x032c('0x65')][_0x032c('0x3f')]);_0x40ba8f['query']=_['keys'](_0x38cbed['query']);_0x40ba8f[_0x032c('0x43')]=_['intersection'](_0x40ba8f[_0x032c('0x45')],_0x40ba8f[_0x032c('0x42')]);_0x1a2cd5[_0x032c('0x46')]=_['intersection'](_0x40ba8f[_0x032c('0x45')],qs[_0x032c('0x47')](_0x38cbed[_0x032c('0x42')][_0x032c('0x47')]));_0x1a2cd5[_0x032c('0x46')]=_0x1a2cd5[_0x032c('0x46')][_0x032c('0x48')]?_0x1a2cd5[_0x032c('0x46')]:_0x40ba8f['model'];if(!_0x38cbed[_0x032c('0x42')]['hasOwnProperty'](_0x032c('0x68'))){_0x1a2cd5[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x38cbed[_0x032c('0x42')][_0x032c('0x2f')]);_0x1a2cd5[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x38cbed['query']['offset']);}_0x1a2cd5[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x38cbed['query'][_0x032c('0x69')]);_0x1a2cd5[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x38cbed[_0x032c('0x42')],_0x40ba8f['filters']));_0x1a2cd5['where'][_0x032c('0x64')]=_0x20a67c['id'];if(_0x38cbed[_0x032c('0x42')][_0x032c('0x4e')]){_0x1a2cd5['where']=_['merge'](_0x1a2cd5['where'],{'$or':_['map'](_0x1a2cd5['attributes'],function(_0x313cd7){var _0x55dbe7={};_0x55dbe7[_0x313cd7]={'$like':'%'+_0x38cbed[_0x032c('0x42')]['filter']+'%'};return _0x55dbe7;})});}_0x1a2cd5=_[_0x032c('0x4f')]({},_0x1a2cd5,_0x38cbed[_0x032c('0x50')]);return db['Disposition']['count']({'where':_0x1a2cd5[_0x032c('0x4d')]})[_0x032c('0x1f')](function(_0x1d61d5){_0x40c464[_0x032c('0x2e')]=_0x1d61d5;if(_0x38cbed['query'][_0x032c('0x52')]){_0x1a2cd5[_0x032c('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x032c('0x54')](_0x1a2cd5);})[_0x032c('0x1f')](function(_0x2b4788){_0x40c464[_0x032c('0x55')]=_0x2b4788;return _0x40c464;});}})[_0x032c('0x1f')](respondWithFilteredResult(_0x2f8b61,_0x1a2cd5))[_0x032c('0x29')](handleError(_0x2f8b61,null));};exports[_0x032c('0x6a')]=function(_0x142ee9,_0x423db7,_0x2577b7){return db[_0x032c('0x51')]['find']({'where':{'id':_0x142ee9[_0x032c('0x56')]['id']}})['then'](handleEntityNotFound(_0x423db7,null))[_0x032c('0x1f')](function(_0x2c81c2){if(_0x2c81c2){return _0x2c81c2[_0x032c('0x6a')](_0x142ee9['query'][_0x032c('0x6b')]);}})['then'](respondWithStatusCode(_0x423db7,null))['catch'](handleError(_0x423db7,null));};exports[_0x032c('0x6c')]=function(_0x396b17,_0x30bf45,_0x3431a1){if(_0x396b17[_0x032c('0x59')]['id']){delete _0x396b17[_0x032c('0x59')]['id'];}return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x396b17['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x30bf45,null))[_0x032c('0x1f')](function(_0x39f680){if(_0x39f680){_0x396b17[_0x032c('0x59')]['FaxAccountId']=_0x39f680['id'];return db[_0x032c('0x6d')][_0x032c('0x58')](_0x396b17[_0x032c('0x59')]);}})[_0x032c('0x1f')](respondWithResult(_0x30bf45,null))[_0x032c('0x29')](handleError(_0x30bf45,null));};exports[_0x032c('0x6e')]=function(_0x3805a4,_0x4dbe01,_0x3a1b0a){var _0x1e15b6={'raw':![],'where':{}};var _0x13fc01={};var _0x29b122={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x3805a4[_0x032c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4dbe01,null))[_0x032c('0x1f')](function(_0xcef421){if(_0xcef421){_0x13fc01[_0x032c('0x45')]=_[_0x032c('0x57')](db[_0x032c('0x6d')]['rawAttributes']);_0x13fc01[_0x032c('0x42')]=_[_0x032c('0x57')](_0x3805a4['query']);_0x13fc01[_0x032c('0x43')]=_['intersection'](_0x13fc01['model'],_0x13fc01[_0x032c('0x42')]);_0x1e15b6['attributes']=_['intersection'](_0x13fc01[_0x032c('0x45')],qs[_0x032c('0x47')](_0x3805a4['query'][_0x032c('0x47')]));_0x1e15b6[_0x032c('0x46')]=_0x1e15b6[_0x032c('0x46')][_0x032c('0x48')]?_0x1e15b6['attributes']:_0x13fc01[_0x032c('0x45')];if(!_0x3805a4[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x1e15b6[_0x032c('0x2f')]=qs['limit'](_0x3805a4[_0x032c('0x42')]['limit']);_0x1e15b6['offset']=qs[_0x032c('0x4a')](_0x3805a4[_0x032c('0x42')][_0x032c('0x4a')]);}_0x1e15b6['order']=qs[_0x032c('0x69')](_0x3805a4[_0x032c('0x42')][_0x032c('0x69')]);_0x1e15b6[_0x032c('0x4d')]=qs[_0x032c('0x43')](_[_0x032c('0x4c')](_0x3805a4[_0x032c('0x42')],_0x13fc01[_0x032c('0x43')]));_0x1e15b6[_0x032c('0x4d')]['FaxAccountId']=_0xcef421['id'];if(_0x3805a4[_0x032c('0x42')][_0x032c('0x4e')]){_0x1e15b6[_0x032c('0x4d')]=_[_0x032c('0x4f')](_0x1e15b6[_0x032c('0x4d')],{'$or':_[_0x032c('0x3e')](_0x1e15b6[_0x032c('0x46')],function(_0x24ba71){var _0x4da382={};_0x4da382[_0x24ba71]={'$like':'%'+_0x3805a4[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x4da382;})});}_0x1e15b6=_[_0x032c('0x4f')]({},_0x1e15b6,_0x3805a4['options']);return db[_0x032c('0x6d')][_0x032c('0x2e')]({'where':_0x1e15b6[_0x032c('0x4d')]})['then'](function(_0x4347ba){_0x29b122[_0x032c('0x2e')]=_0x4347ba;if(_0x3805a4['query']['includeAll']){_0x1e15b6[_0x032c('0x53')]=[{'all':!![]}];}return db[_0x032c('0x6d')][_0x032c('0x54')](_0x1e15b6);})[_0x032c('0x1f')](function(_0x1391b9){_0x29b122[_0x032c('0x55')]=_0x1391b9;return _0x29b122;});}})[_0x032c('0x1f')](respondWithFilteredResult(_0x4dbe01,_0x1e15b6))['catch'](handleError(_0x4dbe01,null));};exports[_0x032c('0x6f')]=function(_0x58dc88,_0x59d8b7,_0x55c4ce){return db['FaxAccount']['find']({'where':{'id':_0x58dc88[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x59d8b7,null))[_0x032c('0x1f')](function(_0x3e81fb){if(_0x3e81fb){return _0x3e81fb[_0x032c('0x6f')](_0x58dc88[_0x032c('0x42')][_0x032c('0x6b')]);}})[_0x032c('0x1f')](respondWithStatusCode(_0x59d8b7,null))['catch'](handleError(_0x59d8b7,null));};exports[_0x032c('0x70')]=function(_0x259458,_0x564804,_0x510eca){return db['FaxInteraction']['find']({'where':{'id':_0x259458['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x564804,null))[_0x032c('0x1f')](function(_0x161ec4){if(_0x161ec4){return _0x161ec4[_0x032c('0x70')](_0x259458[_0x032c('0x59')][_0x032c('0x6b')],_['omit'](_0x259458[_0x032c('0x59')],['ids','id'])||{});}})[_0x032c('0x1f')](respondWithResult(_0x564804,null))[_0x032c('0x29')](handleError(_0x564804,null));};exports[_0x032c('0x71')]=function(_0x3cbaf7,_0x408db5,_0x325884){var _0x370a6e={'raw':![],'where':{}};var _0x59483f={};var _0x4f8bc9={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x3cbaf7['params']['id']}})['then'](handleEntityNotFound(_0x408db5,null))['then'](function(_0x31d301){if(_0x31d301){_0x59483f[_0x032c('0x45')]=_[_0x032c('0x57')](db[_0x032c('0x72')][_0x032c('0x3f')]);_0x59483f[_0x032c('0x42')]=_['keys'](_0x3cbaf7[_0x032c('0x42')]);_0x59483f[_0x032c('0x43')]=_[_0x032c('0x44')](_0x59483f[_0x032c('0x45')],_0x59483f[_0x032c('0x42')]);_0x370a6e[_0x032c('0x46')]=_['intersection'](_0x59483f[_0x032c('0x45')],qs[_0x032c('0x47')](_0x3cbaf7[_0x032c('0x42')][_0x032c('0x47')]));_0x370a6e[_0x032c('0x46')]=_0x370a6e[_0x032c('0x46')]['length']?_0x370a6e[_0x032c('0x46')]:_0x59483f['model'];if(!_0x3cbaf7[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x370a6e[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x3cbaf7[_0x032c('0x42')][_0x032c('0x2f')]);_0x370a6e[_0x032c('0x4a')]=qs['offset'](_0x3cbaf7[_0x032c('0x42')][_0x032c('0x4a')]);}_0x370a6e[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x3cbaf7[_0x032c('0x42')]['sort']);_0x370a6e[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x3cbaf7[_0x032c('0x42')],_0x59483f[_0x032c('0x43')]));_0x370a6e['where'][_0x032c('0x64')]=_0x31d301['id'];if(_0x3cbaf7[_0x032c('0x42')]['filter']){_0x370a6e[_0x032c('0x4d')]=_['merge'](_0x370a6e[_0x032c('0x4d')],{'$or':_[_0x032c('0x3e')](_0x370a6e['attributes'],function(_0x326ee8){var _0x477706={};_0x477706[_0x326ee8]={'$like':'%'+_0x3cbaf7[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x477706;})});}_0x370a6e=_[_0x032c('0x4f')]({},_0x370a6e,_0x3cbaf7[_0x032c('0x50')]);return db[_0x032c('0x72')][_0x032c('0x2e')]({'where':_0x370a6e[_0x032c('0x4d')]})[_0x032c('0x1f')](function(_0x4d64af){_0x4f8bc9[_0x032c('0x2e')]=_0x4d64af;if(_0x3cbaf7[_0x032c('0x42')][_0x032c('0x52')]){_0x370a6e[_0x032c('0x53')]=[{'model':db[_0x032c('0x73')],'as':_0x032c('0x74'),'required':![]},{'model':db[_0x032c('0x75')],'as':_0x032c('0x76'),'attributes':[_0x032c('0x3a'),_0x032c('0x77'),_0x032c('0x78')],'required':![]},{'model':db[_0x032c('0x79')],'as':_0x032c('0x7a'),'attributes':['id',_0x032c('0x3a'),_0x032c('0x7b')],'where':_0x3cbaf7[_0x032c('0x42')][_0x032c('0x7c')]?{'id':_0x3cbaf7[_0x032c('0x42')]['tag']}:undefined,'required':_0x3cbaf7[_0x032c('0x42')][_0x032c('0x7c')]?!![]:![]}];}return db[_0x032c('0x72')][_0x032c('0x54')](_0x370a6e);})['then'](function(_0x11e935){_0x4f8bc9[_0x032c('0x55')]=_0x11e935;return _0x4f8bc9;});}})[_0x032c('0x1f')](respondWithFilteredResult(_0x408db5,_0x370a6e))[_0x032c('0x29')](handleError(_0x408db5,null));};exports[_0x032c('0x7d')]=function(_0x50c242,_0xe78ab5,_0x2eec00){return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x50c242[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0xe78ab5,null))[_0x032c('0x1f')](function(_0x17216c){if(_0x17216c){return db[_0x032c('0x7e')][_0x032c('0x7f')](function(_0x430ee9){return db['FaxApplication'][_0x032c('0x38')]({'where':{'FaxAccountId':_0x50c242[_0x032c('0x56')]['id']},'transaction':_0x430ee9})[_0x032c('0x1f')](function(_0x666c53){var _0x5e43d4=_[_0x032c('0x3e')](_0x50c242[_0x032c('0x59')],function(_0x1ac57a){_0x1ac57a[_0x032c('0x64')]=_0x50c242[_0x032c('0x56')]['id'];return _0x1ac57a;});return db['FaxApplication'][_0x032c('0x80')](_0x5e43d4,{'transaction':_0x430ee9});});})[_0x032c('0x1f')](function(){return db[_0x032c('0x81')][_0x032c('0x82')]({'where':{'FaxAccountId':_0x50c242[_0x032c('0x56')]['id']},'order':_0x032c('0x83')});});}})['then'](respondWithResult(_0xe78ab5,null))[_0x032c('0x29')](handleError(_0xe78ab5,null));};exports[_0x032c('0x84')]=function(_0x33480e,_0x2e0b3d,_0x58fe5d){var _0x45d8ba={};var _0x38e22d={};var _0x5cc469;var _0x373154;return db['FaxAccount'][_0x032c('0x67')]({'where':{'id':_0x33480e[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x2e0b3d,null))[_0x032c('0x1f')](function(_0x430bc5){if(_0x430bc5){_0x5cc469=_0x430bc5;_0x38e22d[_0x032c('0x45')]=_['keys'](db[_0x032c('0x81')][_0x032c('0x3f')]);_0x38e22d[_0x032c('0x42')]=_['keys'](_0x33480e[_0x032c('0x42')]);_0x38e22d[_0x032c('0x43')]=_[_0x032c('0x44')](_0x38e22d['model'],_0x38e22d[_0x032c('0x42')]);_0x45d8ba[_0x032c('0x46')]=_[_0x032c('0x44')](_0x38e22d[_0x032c('0x45')],qs[_0x032c('0x47')](_0x33480e[_0x032c('0x42')][_0x032c('0x47')]));_0x45d8ba['attributes']=_0x45d8ba[_0x032c('0x46')]['length']?_0x45d8ba[_0x032c('0x46')]:_0x38e22d[_0x032c('0x45')];_0x45d8ba[_0x032c('0x4b')]=qs['sort'](_0x33480e[_0x032c('0x42')][_0x032c('0x69')]);_0x45d8ba[_0x032c('0x4d')]=qs[_0x032c('0x43')](_[_0x032c('0x4c')](_0x33480e[_0x032c('0x42')],_0x38e22d['filters']));if(_0x33480e[_0x032c('0x42')][_0x032c('0x4e')]){_0x45d8ba['where']=_[_0x032c('0x4f')](_0x45d8ba['where'],{'$or':_['map'](_0x45d8ba['attributes'],function(_0x5349e5){var _0x5eff1c={};_0x5eff1c[_0x5349e5]={'$like':'%'+_0x33480e[_0x032c('0x42')]['filter']+'%'};return _0x5eff1c;})});}_0x45d8ba=_[_0x032c('0x4f')]({},_0x45d8ba,_0x33480e[_0x032c('0x50')]);return _0x5cc469['getApplications'](_0x45d8ba);}})['then'](function(_0x1a89a9){if(_0x1a89a9){_0x373154=_0x1a89a9[_0x032c('0x48')];if(!_0x33480e[_0x032c('0x42')]['hasOwnProperty'](_0x032c('0x68'))){_0x45d8ba[_0x032c('0x2f')]=qs['limit'](_0x33480e[_0x032c('0x42')][_0x032c('0x2f')]);_0x45d8ba[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x33480e[_0x032c('0x42')]['offset']);}return _0x5cc469[_0x032c('0x84')](_0x45d8ba);}})['then'](function(_0x79d37b){if(_0x79d37b){return _0x79d37b?{'count':_0x373154,'rows':_0x79d37b}:null;}})[_0x032c('0x1f')](respondWithResult(_0x2e0b3d,null))['catch'](handleError(_0x2e0b3d,null));};function Extension(_0x35cb9d,_0x134058,_0xc51767,_0x3e96a4){this[_0x032c('0x85')]=_0x032c('0x86');this[_0x032c('0x87')]=_0x35cb9d['localstationid'];this[_0x032c('0x88')]=_0x3e96a4;this[_0x032c('0x40')]=_0x032c('0x89');this[_0x032c('0x8a')]=_0x032c('0x8b');this['FaxAccountId']=_0x35cb9d['id'];this[_0x032c('0x83')]=_0x134058;this[_0x032c('0x8c')]=_0xc51767;}function createExtensionsReciveFax(_0x435595){var _0x58dc86=0x1;var _0x56301c=[];_0x56301c['push'](new Extension(_0x435595,_0x58dc86,'',_0x032c('0x8d')));_0x58dc86+=0x1;_0x56301c[_0x032c('0x8e')](new Extension(_0x435595,_0x58dc86,_0x032c('0x8f'),'Set'));_0x58dc86+=0x1;for(var _0x10c934 in _0x435595){if(_0x435595[_0x032c('0x49')](_0x10c934)&&(_0x10c934===_0x032c('0x90')||_0x10c934==='localstationid'||_0x10c934===_0x032c('0x91')||_0x10c934===_0x032c('0x92')||_0x10c934===_0x032c('0x93')||_0x10c934==='maxrate'||_0x10c934==='minrate'||_0x10c934==='modem'||_0x10c934==='t38timeout')){_0x56301c['push'](new Extension(_0x435595,_0x58dc86,'FAXOPT('+_0x10c934+')='+_0x435595[_0x10c934],'Set'));_0x58dc86+=0x1;}}_0x56301c[_0x032c('0x8e')](new Extension(_0x435595,_0x58dc86,'6',_0x032c('0x94')));_0x58dc86+=0x1;_0x56301c['push'](new Extension(_0x435595,_0x58dc86,_0x032c('0x95'),'ReceiveFax'));_0x58dc86=0x0;return _0x56301c;}exports[_0x032c('0x96')]=function(_0x1e94d1,_0x4112f8,_0x1a4a9f){var _0x4e919e;return db[_0x032c('0x7e')][_0x032c('0x7f')](function(_0x5c6055){return db['FaxAccount']['create'](_0x1e94d1[_0x032c('0x59')],{'transaction':_0x5c6055})['then'](function(_0x2186a0){_0x4e919e=_0x2186a0[_0x032c('0x35')]({'plain':!![]});return db[_0x032c('0x97')][_0x032c('0x80')](createExtensionsReciveFax(_0x4e919e),{'transaction':_0x5c6055});});})[_0x032c('0x1f')](function(){return _0x4e919e;})[_0x032c('0x1f')](respondWithResult(_0x4112f8,null))[_0x032c('0x29')](handleError(_0x4112f8,null));};exports['updateAccountApplications']=function(_0x37de60,_0x1110d5,_0x44be66){var _0xb4b9fa;return db[_0x032c('0x7e')][_0x032c('0x7f')](function(_0x36d781){return db[_0x032c('0x51')]['update'](_0x37de60[_0x032c('0x59')],{'where':{'id':_0x37de60[_0x032c('0x59')]['id']},'transaction':_0x36d781})[_0x032c('0x1f')](function(_0x411a67){return db[_0x032c('0x97')][_0x032c('0x38')]({'where':{'FaxAccountId':_0x37de60[_0x032c('0x59')]['id']},'transaction':_0x36d781})[_0x032c('0x1f')](function(_0x3dd6ba){return db[_0x032c('0x97')][_0x032c('0x80')](createExtensionsReciveFax(_['omit'](_0x37de60['body'],['tech',_0x032c('0x41'),_0x032c('0x98'),_0x032c('0x99'),_0x032c('0x9a'),_0x032c('0x9b')])),{'transaction':_0x36d781});});});})[_0x032c('0x1f')](function(){return db[_0x032c('0x51')][_0x032c('0x9c')](_0x37de60['body']['id']);})[_0x032c('0x1f')](respondWithResult(_0x1110d5,null))[_0x032c('0x29')](handleError(_0x1110d5,null));};exports[_0x032c('0x9d')]=function(_0x24ae60,_0x91b2e0,_0x49fa10){var _0x3cf647={'raw':!![],'where':{}};var _0x329fa0={};var _0x3a7f48={'count':0x0,'rows':[]};return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x24ae60[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x91b2e0,null))[_0x032c('0x1f')](function(_0x50c07e){if(_0x50c07e){_0x329fa0['model']=_['keys'](db[_0x032c('0x9e')][_0x032c('0x3f')]);_0x329fa0[_0x032c('0x42')]=_[_0x032c('0x57')](_0x24ae60[_0x032c('0x42')]);_0x329fa0[_0x032c('0x43')]=_[_0x032c('0x44')](_0x329fa0[_0x032c('0x45')],_0x329fa0[_0x032c('0x42')]);_0x3cf647[_0x032c('0x46')]=_[_0x032c('0x44')](_0x329fa0[_0x032c('0x45')],qs[_0x032c('0x47')](_0x24ae60[_0x032c('0x42')][_0x032c('0x47')]));_0x3cf647[_0x032c('0x46')]=_0x3cf647['attributes'][_0x032c('0x48')]?_0x3cf647[_0x032c('0x46')]:_0x329fa0[_0x032c('0x45')];if(!_0x24ae60[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x3cf647[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x24ae60[_0x032c('0x42')]['limit']);_0x3cf647['offset']=qs['offset'](_0x24ae60['query'][_0x032c('0x4a')]);}_0x3cf647[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x24ae60[_0x032c('0x42')][_0x032c('0x69')]);_0x3cf647[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x24ae60['query'],_0x329fa0[_0x032c('0x43')]));_0x3cf647[_0x032c('0x4d')][_0x032c('0x64')]=_0x50c07e['id'];if(_0x24ae60[_0x032c('0x42')][_0x032c('0x4e')]){_0x3cf647[_0x032c('0x4d')]=_[_0x032c('0x4f')](_0x3cf647[_0x032c('0x4d')],{'$or':_[_0x032c('0x3e')](_0x3cf647[_0x032c('0x46')],function(_0x5ca8d5){var _0x3c688e={};_0x3c688e[_0x5ca8d5]={'$like':'%'+_0x24ae60[_0x032c('0x42')][_0x032c('0x4e')]+'%'};return _0x3c688e;})});}if(_0x24ae60['query'][_0x032c('0x9f')]){var _0x126265=_0x24ae60[_0x032c('0x42')]['$gte']['split'](',');var _0x39d3bf={};_0x39d3bf[_0x126265[0x0]]={'$gte':moment(_0x126265[0x1])['format'](_0x032c('0xa0'))};_0x3cf647['where']=_['merge'](_0x3cf647[_0x032c('0x4d')],_0x39d3bf);}_0x3cf647=_['merge']({},_0x3cf647,_0x24ae60[_0x032c('0x50')]);return db[_0x032c('0x9e')]['count']({'where':_0x3cf647[_0x032c('0x4d')]})['then'](function(_0x416842){_0x3a7f48[_0x032c('0x2e')]=_0x416842;if(_0x24ae60[_0x032c('0x42')][_0x032c('0x52')]){_0x3cf647[_0x032c('0x53')]=[{'all':!![]}];}return db[_0x032c('0x9e')][_0x032c('0x54')](_0x3cf647);})[_0x032c('0x1f')](function(_0x37c6eb){_0x3a7f48['rows']=_0x37c6eb;return _0x3a7f48;});}})['then'](respondWithFilteredResult(_0x91b2e0,_0x3cf647))['catch'](handleError(_0x91b2e0,null));};exports[_0x032c('0xa1')]=function(_0xfad870,_0x4c3949,_0x5b6307){var _0x33adef,_0x4b0fc0={},_0x2fa101;if(_0xfad870[_0x032c('0x59')]['to']){_0x2fa101=_0xfad870[_0x032c('0x59')]['to'][0x0];}return db['FaxAccount'][_0x032c('0x5e')]({'where':{'id':_0xfad870['params']['id']},'include':[{'model':db[_0x032c('0xa2')],'as':_0x032c('0xa3'),'include':[{'model':db[_0x032c('0x73')],'as':_0x032c('0xa4'),'where':{'fax':_0x2fa101},'limit':0x1,'order':[[_0x032c('0x99'),'DESC']]}]}]})[_0x032c('0x1f')](handleEntityNotFound(_0x4c3949,null))['then'](function(_0x40acfa){_0x33adef=_0x40acfa;if(_0xfad870[_0x032c('0x59')][_0x032c('0xa5')]&&_0xfad870['body']['attachments'][_0x032c('0x48')]){for(var _0x29aa28=0x0;_0x29aa28<_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][_0x032c('0x48')];_0x29aa28+=0x1){_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][_0x29aa28]={'filename':_0xfad870['body']['attachments'][_0x29aa28][_0x032c('0x3a')],'id':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][_0x29aa28]['id'],'path':path[_0x032c('0xa6')](config['root'],'server/files/attachments',_0xfad870[_0x032c('0x59')]['attachments'][_0x29aa28]['basename'])};}}return respondWithRpcPromise(_0x032c('0xa7'),_0x032c('0xa7'),{'FaxAccountId':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x56')]['id'])?undefined:_0xfad870[_0x032c('0x56')]['id'],'path':_['isNil'](_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xa9')])?undefined:_0xfad870[_0x032c('0x59')]['attachments'][0x0][_0x032c('0xa9')],'fax':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')]['to'][0x0])?undefined:_0xfad870[_0x032c('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x33adef){if(_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')][_0x032c('0xaa')])){_0xfad870[_0x032c('0x59')][_0x032c('0xaa')]=util['format'](_0x032c('0xab'),_0x33adef['name'],_0x33adef[_0x032c('0xac')]);}if(_0x33adef[_0x032c('0xa3')]){if(_0x33adef[_0x032c('0xa3')][_0x032c('0xa4')]['length']){return _0x33adef[_0x032c('0xa3')][_0x032c('0xa4')][0x0];}else{return db['CmContact']['create'](_[_0x032c('0x17')](_0xfad870['body'],{'firstName':_0xfad870[_0x032c('0x59')]['to'][0x0],'phone':_0xfad870[_0x032c('0x59')]['to'][0x0],'fax':_0xfad870[_0x032c('0x59')]['to'][0x0],'ListId':_0x33adef[_0x032c('0x9b')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x032c('0x1f')](function(_0x351100){if(_0x351100){return db[_0x032c('0x72')][_0x032c('0x5e')]({'where':{'ContactId':_0x351100['id'],'closed':![],'FaxAccountId':_0x33adef['id']}})[_0x032c('0x1f')](function(_0x911045){if(_0x911045){return[_0x911045,![]];}return db[_0x032c('0x72')][_0x032c('0x58')]({'UserId':_0xfad870[_0x032c('0x5c')]['id'],'ContactId':_0x351100['id'],'FaxAccountId':_0x33adef['id'],'fax':_0xfad870[_0x032c('0x59')]['to'][0x0],'firstMsgDirection':_0x032c('0xad'),'Messages':[_[_0x032c('0x4f')](_0xfad870[_0x032c('0x59')],{'read':![],'body':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xae')],'FaxAccountId':_0x33adef['id'],'UserId':_0xfad870[_0x032c('0x5c')]['id'],'ContactId':_0x351100['id'],'AttachmentId':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x032c('0x9e')],'as':_0x032c('0xaf')}]})[_0x032c('0x1f')](function(_0x3f3e0a){return[_0x3f3e0a,!![]];});});}else{throw new Error(_0x032c('0xb0'));}})[_0x032c('0xb1')](function(_0x438686,_0x3890a8){if(_0x3890a8){return _0x438686;}return db['FaxMessage'][_0x032c('0x58')]({'direction':_0x032c('0xad'),'read':![],'body':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xae')],'FaxAccountId':_0x33adef['id'],'FaxInteractionId':_0x438686['id'],'UserId':_0xfad870[_0x032c('0x5c')]['id'],'ContactId':_0x438686['ContactId'],'AttachmentId':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0]['id']})[_0x032c('0x1f')](function(_0x3a1c4a){_0x438686[_0x032c('0xb2')]['Messages']=[];_0x438686['dataValues']['Messages'][_0x032c('0x8e')](_0x3a1c4a[_0x032c('0xb2')]);return _0x438686;});})[_0x032c('0x1f')](function(_0x3d1809){respondWithRpcPromise(_0x032c('0xb3'),_0x032c('0xb3'),{'FaxAccountId':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x56')]['id'])?undefined:_0xfad870[_0x032c('0x56')]['id'],'path':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0][_0x032c('0xa9')])?undefined:_0xfad870[_0x032c('0x59')]['attachments'][0x0][_0x032c('0xa9')],'fax':_[_0x032c('0xa8')](_0xfad870[_0x032c('0x59')]['to'][0x0])?undefined:_0xfad870[_0x032c('0x59')]['to'][0x0],'AttachmentId':_0xfad870[_0x032c('0x59')][_0x032c('0xa5')][0x0]['id']},client9002)[_0x032c('0x1f')](function(_0x1a4607){logger['info'](_0x032c('0xb4'),_0x1a4607);})[_0x032c('0x29')](function(_0x55587c){logger[_0x032c('0x20')](_0x032c('0xb4'),_0x55587c);});return _0x3d1809;})[_0x032c('0x1f')](respondWithResult(_0x4c3949,null))[_0x032c('0x29')](handleError(_0x4c3949,null));};exports[_0x032c('0xb5')]=function(_0x152d4d,_0x182f2d,_0x1cc481){return db[_0x032c('0x51')][_0x032c('0x5e')]({'where':{'id':_0x152d4d[_0x032c('0x56')]['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x182f2d,null))[_0x032c('0x1f')](function(_0x135a8f){if(_0x135a8f){return _0x135a8f[_0x032c('0xb5')](_0x152d4d[_0x032c('0x59')][_0x032c('0x6b')],_['omit'](_0x152d4d[_0x032c('0x59')],['ids','id'])||{})['spread'](function(_0x2841f8){for(var _0x50a520=0x0;_0x50a520<_0x152d4d[_0x032c('0x59')]['ids']['length'];_0x50a520+=0x1){socket[_0x032c('0xb6')](_0x032c('0xb7'),{'UserId':_0x152d4d[_0x032c('0x59')][_0x032c('0x6b')][_0x50a520],'FaxAccountId':_0x152d4d[_0x032c('0x56')]['id']});}return _0x2841f8;});}})[_0x032c('0x1f')](respondWithResult(_0x182f2d,null))[_0x032c('0x29')](handleError(_0x182f2d,null));};exports[_0x032c('0xb8')]=function(_0x2a824a,_0x1e25ef,_0x326033){return db['FaxAccount'][_0x032c('0x5e')]({'where':{'id':_0x2a824a['params']['id']}})[_0x032c('0x1f')](handleEntityNotFound(_0x1e25ef,null))['then'](function(_0xdc27c4){if(_0xdc27c4){return _0xdc27c4[_0x032c('0xb8')](_0x2a824a[_0x032c('0x42')]['ids'])['then'](function(){if(_[_0x032c('0xb9')](_0x2a824a[_0x032c('0x42')][_0x032c('0x6b')])){for(var _0x247c4a=0x0;_0x247c4a<_0x2a824a[_0x032c('0x42')]['ids'][_0x032c('0x48')];_0x247c4a+=0x1){socket['emit'](_0x032c('0xba'),{'UserId':Number(_0x2a824a[_0x032c('0x42')][_0x032c('0x6b')][_0x247c4a]),'FaxAccountId':Number(_0x2a824a[_0x032c('0x56')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2a824a[_0x032c('0x42')][_0x032c('0x6b')]),'FaxAccountId':Number(_0x2a824a['params']['id'])});}});}})[_0x032c('0x1f')](respondWithStatusCode(_0x1e25ef,null))[_0x032c('0x29')](handleError(_0x1e25ef,null));};exports[_0x032c('0xbb')]=function(_0x413434,_0x3936f3,_0x162ff2){var _0x1dc95c={};var _0x5dac08={};var _0xd521e5;var _0x9e5fce;return db[_0x032c('0x51')][_0x032c('0x67')]({'where':{'id':_0x413434[_0x032c('0x56')]['id']}})['then'](handleEntityNotFound(_0x3936f3,null))[_0x032c('0x1f')](function(_0x485142){if(_0x485142){_0xd521e5=_0x485142;_0x5dac08['model']=_['keys'](db[_0x032c('0x75')][_0x032c('0x3f')]);_0x5dac08[_0x032c('0x42')]=_['keys'](_0x413434[_0x032c('0x42')]);_0x5dac08['filters']=_['intersection'](_0x5dac08['model'],_0x5dac08['query']);_0x1dc95c[_0x032c('0x46')]=_[_0x032c('0x44')](_0x5dac08[_0x032c('0x45')],qs[_0x032c('0x47')](_0x413434['query']['fields']));_0x1dc95c[_0x032c('0x46')]=_0x1dc95c[_0x032c('0x46')][_0x032c('0x48')]?_0x1dc95c[_0x032c('0x46')]:_0x5dac08['model'];_0x1dc95c[_0x032c('0x4b')]=qs[_0x032c('0x69')](_0x413434[_0x032c('0x42')]['sort']);_0x1dc95c[_0x032c('0x4d')]=qs['filters'](_[_0x032c('0x4c')](_0x413434[_0x032c('0x42')],_0x5dac08[_0x032c('0x43')]));if(_0x413434[_0x032c('0x42')][_0x032c('0x4e')]){_0x1dc95c[_0x032c('0x4d')]=_[_0x032c('0x4f')](_0x1dc95c['where'],{'$or':_[_0x032c('0x3e')](_0x1dc95c[_0x032c('0x46')],function(_0x5633c7){var _0x4e8283={};_0x4e8283[_0x5633c7]={'$like':'%'+_0x413434[_0x032c('0x42')]['filter']+'%'};return _0x4e8283;})});}_0x1dc95c=_[_0x032c('0x4f')]({},_0x1dc95c,_0x413434[_0x032c('0x50')]);return _0xd521e5[_0x032c('0xbb')](_0x1dc95c);}})['then'](function(_0x1cbddf){if(_0x1cbddf){_0x9e5fce=_0x1cbddf[_0x032c('0x48')];if(!_0x413434[_0x032c('0x42')][_0x032c('0x49')](_0x032c('0x68'))){_0x1dc95c[_0x032c('0x2f')]=qs[_0x032c('0x2f')](_0x413434['query'][_0x032c('0x2f')]);_0x1dc95c[_0x032c('0x4a')]=qs[_0x032c('0x4a')](_0x413434['query'][_0x032c('0x4a')]);}return _0xd521e5[_0x032c('0xbb')](_0x1dc95c);}})[_0x032c('0x1f')](function(_0x20fe7b){if(_0x20fe7b){return _0x20fe7b?{'count':_0x9e5fce,'rows':_0x20fe7b}:null;}})[_0x032c('0x1f')](respondWithResult(_0x3936f3,null))[_0x032c('0x29')](handleError(_0x3936f3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 96c1cc9..1c6997d 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 _0x339a=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','FaxAccount'];(function(_0x256347,_0x2acc02){var _0x39d71e=function(_0xb9f42c){while(--_0xb9f42c){_0x256347['push'](_0x256347['shift']());}};_0x39d71e(++_0x2acc02);}(_0x339a,0x151));var _0xa339=function(_0x42d5b6,_0xd75104){_0x42d5b6=_0x42d5b6-0x0;var _0x226b34=_0x339a[_0x42d5b6];return _0x226b34;};'use strict';var EventEmitter=require(_0xa339('0x0'));var FaxAccount=require(_0xa339('0x1'))['db'][_0xa339('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa339('0x3')](0x0);var events={'afterCreate':_0xa339('0x4'),'afterUpdate':_0xa339('0x5'),'afterDestroy':_0xa339('0x6')};function emitEvent(_0x44604a){return function(_0x2ed1c3,_0xe91e50,_0x4071ea){FaxAccountEvents[_0xa339('0x7')](_0x44604a+':'+_0x2ed1c3['id'],_0x2ed1c3);FaxAccountEvents['emit'](_0x44604a,_0x2ed1c3);_0x4071ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa339('0x8')](e,emitEvent(event));}}module[_0xa339('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x00e7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','FaxAccount'];(function(_0x59d86b,_0x46c0b1){var _0x45f578=function(_0x55581d){while(--_0x55581d){_0x59d86b['push'](_0x59d86b['shift']());}};_0x45f578(++_0x46c0b1);}(_0x00e7,0x1b7));var _0x700e=function(_0x37b0da,_0x42982f){_0x37b0da=_0x37b0da-0x0;var _0x18c5b6=_0x00e7[_0x37b0da];return _0x18c5b6;};'use strict';var EventEmitter=require(_0x700e('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x700e('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x700e('0x2')](0x0);var events={'afterCreate':_0x700e('0x3'),'afterUpdate':_0x700e('0x4'),'afterDestroy':_0x700e('0x5')};function emitEvent(_0x574dfe){return function(_0xe9db48,_0x6fd331,_0x2c840e){FaxAccountEvents['emit'](_0x574dfe+':'+_0xe9db48['id'],_0xe9db48);FaxAccountEvents[_0x700e('0x6')](_0x574dfe,_0xe9db48);_0x2c840e(null);};}for(var e in events){if(events[_0x700e('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x700e('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f21ed4a..83889d9 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 _0xb4c8=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x48a427,_0x686beb){var _0x41ff42=function(_0xe00a3a){while(--_0xe00a3a){_0x48a427['push'](_0x48a427['shift']());}};_0x41ff42(++_0x686beb);}(_0xb4c8,0x70));var _0x8b4c=function(_0x5f1d95,_0x5b0931){_0x5f1d95=_0x5f1d95-0x0;var _0xb75816=_0xb4c8[_0x5f1d95];return _0xb75816;};'use strict';var _=require(_0x8b4c('0x0'));var util=require(_0x8b4c('0x1'));var logger=require(_0x8b4c('0x2'))(_0x8b4c('0x3'));var moment=require(_0x8b4c('0x4'));var BPromise=require(_0x8b4c('0x5'));var rp=require(_0x8b4c('0x6'));var fs=require('fs');var path=require(_0x8b4c('0x7'));var rimraf=require(_0x8b4c('0x8'));var config=require(_0x8b4c('0x9'));var attributes=require(_0x8b4c('0xa'));module['exports']=function(_0x4b2423,_0x1db737){return _0x4b2423[_0x8b4c('0xb')]('FaxAccount',attributes,{'tableName':_0x8b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9d3=['fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf9d3,0x79));var _0x3f9d=function(_0x5ae8fc,_0x4ebbe4){_0x5ae8fc=_0x5ae8fc-0x0;var _0x55decd=_0xf9d3[_0x5ae8fc];return _0x55decd;};'use strict';var _=require(_0x3f9d('0x0'));var util=require('util');var logger=require(_0x3f9d('0x1'))('api');var moment=require(_0x3f9d('0x2'));var BPromise=require(_0x3f9d('0x3'));var rp=require(_0x3f9d('0x4'));var fs=require('fs');var path=require(_0x3f9d('0x5'));var rimraf=require(_0x3f9d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f9d('0x7'));module[_0x3f9d('0x8')]=function(_0x36b60c,_0x4e41de){return _0x36b60c[_0x3f9d('0x9')](_0x3f9d('0xa'),attributes,{'tableName':_0x3f9d('0xb'),'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 12d6e14..5ece0ca 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 _0xcd28=['find','CmList','List','Contacts','FaxApplication','Applications','get','account','applications','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','unshift','startRouting','Start','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','include','model','map','attributes','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','CompanyId','body','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'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xcd28,0x170));var _0x8cd2=function(_0x123189,_0x27c117){_0x123189=_0x123189-0x0;var _0x1f46d=_0xcd28[_0x123189];return _0x1f46d;};'use strict';var _=require(_0x8cd2('0x0'));var util=require('util');var moment=require(_0x8cd2('0x1'));var BPromise=require(_0x8cd2('0x2'));var rs=require(_0x8cd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cd2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8cd2('0x5'));var config=require('../../config/environment');var jayson=require(_0x8cd2('0x6'));var client=jayson['client']['http']({'port':0x232c});config[_0x8cd2('0x7')]=_[_0x8cd2('0x8')](config[_0x8cd2('0x7')],{'host':_0x8cd2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8cd2('0xa'))[_0x8cd2('0xb')](socket);function respondWithRpcPromise(_0x2240ed,_0xab6b1e,_0x23eaab){return new BPromise(function(_0x5bd456,_0x2cb674){return client[_0x8cd2('0xc')](_0x2240ed,_0x23eaab)[_0x8cd2('0xd')](function(_0x158923){logger[_0x8cd2('0xe')]('FaxAccount,\x20%s,\x20%s',_0xab6b1e,_0x8cd2('0xf'));logger[_0x8cd2('0x10')](_0x8cd2('0x11'),_0xab6b1e,_0x8cd2('0xf'),JSON[_0x8cd2('0x12')](_0x158923));if(_0x158923['error']){if(_0x158923['error'][_0x8cd2('0x13')]===0x1f4){logger[_0x8cd2('0x14')]('FaxAccount,\x20%s,\x20%s',_0xab6b1e,_0x158923[_0x8cd2('0x14')]['message']);return _0x2cb674(_0x158923[_0x8cd2('0x14')][_0x8cd2('0x15')]);}logger['error'](_0x8cd2('0x16'),_0xab6b1e,_0x158923[_0x8cd2('0x14')]['message']);return _0x5bd456(_0x158923['error']['message']);}else{logger[_0x8cd2('0xe')](_0x8cd2('0x16'),_0xab6b1e,_0x8cd2('0xf'));_0x5bd456(_0x158923[_0x8cd2('0x17')]['message']);}})[_0x8cd2('0x18')](function(_0x273686){logger[_0x8cd2('0x14')](_0x8cd2('0x16'),_0xab6b1e,_0x273686);_0x2cb674(_0x273686);});});}exports[_0x8cd2('0x19')]=function(_0x5d6e58){var _0x5b54bd=this;return new Promise(function(_0x4a2397,_0x510316){return db[_0x8cd2('0x1a')][_0x8cd2('0x1b')]({'raw':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58[_0x8cd2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58[_0x8cd2('0x1c')]['where']||null:null,'attributes':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58[_0x8cd2('0x1c')]['attributes']||null:null,'limit':_0x5d6e58[_0x8cd2('0x1c')]?_0x5d6e58['options']['limit']||null:null,'include':_0x5d6e58['options']?_0x5d6e58[_0x8cd2('0x1c')]['include']?_['map'](_0x5d6e58[_0x8cd2('0x1c')][_0x8cd2('0x1d')],function(_0x5aff3d){return{'model':db[_0x5aff3d[_0x8cd2('0x1e')]],'as':_0x5aff3d['as'],'attributes':_0x5aff3d['attributes'],'include':_0x5aff3d[_0x8cd2('0x1d')]?_[_0x8cd2('0x1f')](_0x5aff3d['include'],function(_0x49ef38){return{'model':db[_0x49ef38[_0x8cd2('0x1e')]],'as':_0x49ef38['as'],'attributes':_0x49ef38[_0x8cd2('0x20')],'include':_0x49ef38['include']?_[_0x8cd2('0x1f')](_0x49ef38[_0x8cd2('0x1d')],function(_0x3441ac){return{'model':db[_0x3441ac['model']],'as':_0x3441ac['as'],'attributes':_0x3441ac[_0x8cd2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8cd2('0xd')](function(_0x1d498a){logger['info']('GetFaxAccount',_0x5d6e58);logger['debug'](_0x8cd2('0x19'),_0x5d6e58,JSON['stringify'](_0x1d498a));_0x4a2397(_0x1d498a);})[_0x8cd2('0x18')](function(_0x349d84){logger['error'](_0x8cd2('0x19'),_0x349d84[_0x8cd2('0x15')],_0x5d6e58);_0x510316(_0x5b54bd[_0x8cd2('0x14')](0x1f4,_0x349d84[_0x8cd2('0x15')]));});});};exports[_0x8cd2('0x21')]=function(_0x56fe1f,_0x402912,_0x2bb7a9){var _0x2b5406=this;return new Promise(function(_0x506f1e,_0x35a1b3){var _0x2a51c5={'body':_0x56fe1f['body'],'channel':_0x8cd2('0x22')};var _0x2f2c4d=[];var _0x416380=[];var _0x4594cf={};return db[_0x8cd2('0x23')][_0x8cd2('0x24')]()[_0x8cd2('0xd')](function(_0x345eed){if(!_0x345eed){throw new db[(_0x8cd2('0x25'))][(_0x8cd2('0x26'))]('no\x20available\x20attributes');}_0x2f2c4d=_['difference'](_[_0x8cd2('0x27')](_0x345eed),[_0x8cd2('0x28'),_0x8cd2('0x29')]);_0x416380=_[_0x8cd2('0x2a')](_['keys'](_0x345eed),['createdAt',_0x8cd2('0x29'),_0x8cd2('0x2b'),'ListId']);if(_0x56fe1f[_0x8cd2('0x2c')]['id']){delete _0x56fe1f[_0x8cd2('0x2c')]['id'];}if(_[_0x8cd2('0x2d')](_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2e')])){throw new db[(_0x8cd2('0x25'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x56fe1f['body']['body'])||_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2c')]===''){throw new db[(_0x8cd2('0x25'))]['ValidationError'](_0x8cd2('0x2f'));}if(_[_0x8cd2('0x2d')](_0x56fe1f['body'][_0x8cd2('0x30')])){throw new db[(_0x8cd2('0x25'))][(_0x8cd2('0x26'))](_0x8cd2('0x31')+_0x416380);}if(!_[_0x8cd2('0x32')](_0x416380,_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x30')])){throw new db[(_0x8cd2('0x25'))][(_0x8cd2('0x26'))](_0x8cd2('0x33')+_0x416380);}_0x4594cf[_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x30')]]=_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2e')];})[_0x8cd2('0xd')](function(){return db[_0x8cd2('0x1a')][_0x8cd2('0x34')]({'where':{'id':_0x56fe1f['account']['id']},'include':[{'model':db[_0x8cd2('0x35')],'as':_0x8cd2('0x36'),'include':[{'model':db[_0x8cd2('0x23')],'as':_0x8cd2('0x37'),'where':_0x4594cf,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8cd2('0x38')],'as':_0x8cd2('0x39')}]});})['then'](function(_0x58c1bb){if(_0x58c1bb&&_0x58c1bb[_0x8cd2('0x36')]){var _0x4d2bea=_0x58c1bb[_0x8cd2('0x3a')]({'plain':!![]});_0x2a51c5[_0x8cd2('0x3b')]=_0x4d2bea;_0x2a51c5[_0x8cd2('0x3c')]=_0x4d2bea[_0x8cd2('0x39')];_0x2a51c5['list']=_0x4d2bea[_0x8cd2('0x36')];_0x2a51c5[_0x8cd2('0x3c')]=_['orderBy'](_0x2a51c5[_0x8cd2('0x3c')],[_0x8cd2('0x3d')],[_0x8cd2('0x3e')]);if(_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x39')]){delete _0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x39')];}if(_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x36')]&&_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x36')]['Contacts'][_0x8cd2('0x3f')]){return _0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x36')][_0x8cd2('0x37')][0x0];}var _0x4c1808=_[_0x8cd2('0x8')](_0x56fe1f[_0x8cd2('0x2c')],{'firstName':_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x2e')],'ListId':_0x4d2bea[_0x8cd2('0x40')]});_0x4c1808[_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x30')]]=_0x56fe1f['body'][_0x8cd2('0x2e')];return db[_0x8cd2('0x23')][_0x8cd2('0x41')](_0x4c1808,{'fields':_0x2f2c4d,'raw':!![]});}})[_0x8cd2('0xd')](function(_0x30e0f1){_0x2a51c5[_0x8cd2('0x42')]=_0x30e0f1;if(_0x30e0f1){var _0x3b2834={'ContactId':_0x30e0f1['id'],'FaxAccountId':_0x56fe1f['account']['id'],'fax':_0x30e0f1[_0x8cd2('0x22')]};return db[_0x8cd2('0x43')][_0x8cd2('0x34')]({'where':{'ContactId':_0x30e0f1['id'],'closed':![],'FaxAccountId':_0x56fe1f[_0x8cd2('0x3b')]['id']}})[_0x8cd2('0xd')](function(_0x3264eb){if(_0x3264eb){return[_0x3264eb,![]];}return db[_0x8cd2('0x43')][_0x8cd2('0x41')](_0x3b2834)['then'](function(_0x2bba01){return[_0x2bba01,!![]];});});}else{throw new Error(_0x8cd2('0x44'));}})['spread'](function(_0x1454fa,_0x4e7543){var _0x2e3e6f=_0x1454fa[_0x8cd2('0x3a')]({'plain':!![]});if(_0x4e7543){if(_0x2a51c5[_0x8cd2('0x3b')][_0x8cd2('0x45')]){_0x2a51c5[_0x8cd2('0x3c')][_0x8cd2('0x46')]({'id':0x0,'priority':_0x2a51c5[_0x8cd2('0x3c')]['length']+0x1,'app':_0x8cd2('0x47'),'appdata':_0x8cd2('0x48'),'interval':_0x8cd2('0x49')});}_0x2e3e6f[_0x8cd2('0x4a')]=!![];}else{_0x2e3e6f['created']=![];}_0x2a51c5[_0x8cd2('0x4b')]=_0x2e3e6f;return db[_0x8cd2('0x4c')][_0x8cd2('0x41')]({'body':_0x56fe1f[_0x8cd2('0x2c')]['body'],'FaxAccountId':_0x56fe1f['account']['id'],'FaxInteractionId':_0x1454fa['id'],'direction':'in','ContactId':_0x1454fa[_0x8cd2('0x4d')],'AttachmentId':_0x56fe1f[_0x8cd2('0x2c')][_0x8cd2('0x4e')]});})['then'](function(_0x127fff){_0x2a51c5[_0x8cd2('0x15')]=_0x127fff;if(_0x2a51c5[_0x8cd2('0x4b')]['UserId']){return db[_0x8cd2('0x4f')][_0x8cd2('0x34')]({'attributes':['id',_0x8cd2('0x50')],'where':{'id':_0x2a51c5['interaction']['UserId']}})[_0x8cd2('0xd')](function(_0x228120){if(_0x228120){_0x2a51c5[_0x8cd2('0x3c')][_0x8cd2('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x228120[_0x8cd2('0x50')]+','+(_0x2a51c5[_0x8cd2('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0x8cd2('0x49')});}return respondWithRpcPromise('Start',_0x8cd2('0x52'),_0x2a51c5);});}return respondWithRpcPromise(_0x8cd2('0x53'),_0x8cd2('0x52'),_0x2a51c5);})['then'](function(_0x2ecd31){_0x506f1e(_0x2ecd31);})[_0x8cd2('0x18')](function(_0x3bf267){_0x35a1b3(_0x2b5406[_0x8cd2('0x14')](0x1f4,_0x3bf267[_0x8cd2('0x15')]));});});}; \ No newline at end of file +var _0x86d8=['asc','create','contact','fax','FaxInteraction','find','Contact\x20not\x20found','spread','get','push','close','created','interaction','FaxMessage','ContactId','UserId','User','unshift','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','options','raw','limit','map','include','model','attributes','stringify','body','describe','Sequelize','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Contacts','FaxApplication','Applications','applications','list','orderBy','priority'];(function(_0x25561,_0x561c77){var _0x59a6c0=function(_0x614592){while(--_0x614592){_0x25561['push'](_0x25561['shift']());}};_0x59a6c0(++_0x561c77);}(_0x86d8,0xc9));var _0x886d=function(_0x599b00,_0x3ff97f){_0x599b00=_0x599b00-0x0;var _0x24d5e2=_0x86d8[_0x599b00];return _0x24d5e2;};'use strict';var _=require(_0x886d('0x0'));var util=require(_0x886d('0x1'));var moment=require(_0x886d('0x2'));var BPromise=require(_0x886d('0x3'));var rs=require(_0x886d('0x4'));var fs=require('fs');var Redis=require(_0x886d('0x5'));var db=require(_0x886d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x886d('0x7'));var config=require(_0x886d('0x8'));var jayson=require(_0x886d('0x9'));var client=jayson['client'][_0x886d('0xa')]({'port':0x232c});config[_0x886d('0xb')]=_[_0x886d('0xc')](config[_0x886d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x886d('0xd'))(new Redis(config[_0x886d('0xb')]));require(_0x886d('0xe'))[_0x886d('0xf')](socket);function respondWithRpcPromise(_0x3fd819,_0x4cec2e,_0x15427a){return new BPromise(function(_0x2c56eb,_0x5e89b1){return client[_0x886d('0x10')](_0x3fd819,_0x15427a)[_0x886d('0x11')](function(_0x4858c9){logger[_0x886d('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4cec2e,_0x886d('0x13'));logger[_0x886d('0x14')](_0x886d('0x15'),_0x4cec2e,_0x886d('0x13'),JSON['stringify'](_0x4858c9));if(_0x4858c9['error']){if(_0x4858c9[_0x886d('0x16')][_0x886d('0x17')]===0x1f4){logger[_0x886d('0x16')](_0x886d('0x18'),_0x4cec2e,_0x4858c9[_0x886d('0x16')][_0x886d('0x19')]);return _0x5e89b1(_0x4858c9['error'][_0x886d('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x4cec2e,_0x4858c9[_0x886d('0x16')]['message']);return _0x2c56eb(_0x4858c9[_0x886d('0x16')][_0x886d('0x19')]);}else{logger[_0x886d('0x12')](_0x886d('0x18'),_0x4cec2e,'request\x20sent');_0x2c56eb(_0x4858c9['result'][_0x886d('0x19')]);}})[_0x886d('0x1a')](function(_0x370031){logger[_0x886d('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4cec2e,_0x370031);_0x5e89b1(_0x370031);});});}exports[_0x886d('0x1b')]=function(_0x443d92){var _0x5b6437=this;return new Promise(function(_0x16688c,_0x439583){return db[_0x886d('0x1c')]['findAll']({'raw':_0x443d92[_0x886d('0x1d')]?_0x443d92[_0x886d('0x1d')][_0x886d('0x1e')]===undefined?!![]:![]:!![],'where':_0x443d92[_0x886d('0x1d')]?_0x443d92[_0x886d('0x1d')]['where']||null:null,'attributes':_0x443d92[_0x886d('0x1d')]?_0x443d92[_0x886d('0x1d')]['attributes']||null:null,'limit':_0x443d92[_0x886d('0x1d')]?_0x443d92['options'][_0x886d('0x1f')]||null:null,'include':_0x443d92[_0x886d('0x1d')]?_0x443d92['options']['include']?_[_0x886d('0x20')](_0x443d92[_0x886d('0x1d')][_0x886d('0x21')],function(_0x12519d){return{'model':db[_0x12519d[_0x886d('0x22')]],'as':_0x12519d['as'],'attributes':_0x12519d[_0x886d('0x23')],'include':_0x12519d[_0x886d('0x21')]?_[_0x886d('0x20')](_0x12519d[_0x886d('0x21')],function(_0x8422a2){return{'model':db[_0x8422a2[_0x886d('0x22')]],'as':_0x8422a2['as'],'attributes':_0x8422a2[_0x886d('0x23')],'include':_0x8422a2[_0x886d('0x21')]?_[_0x886d('0x20')](_0x8422a2[_0x886d('0x21')],function(_0x584476){return{'model':db[_0x584476[_0x886d('0x22')]],'as':_0x584476['as'],'attributes':_0x584476[_0x886d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x886d('0x11')](function(_0x561d30){logger['info'](_0x886d('0x1b'),_0x443d92);logger[_0x886d('0x14')](_0x886d('0x1b'),_0x443d92,JSON[_0x886d('0x24')](_0x561d30));_0x16688c(_0x561d30);})['catch'](function(_0x270433){logger['error'](_0x886d('0x1b'),_0x270433[_0x886d('0x19')],_0x443d92);_0x439583(_0x5b6437['error'](0x1f4,_0x270433[_0x886d('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x49e98f,_0x41cbd1,_0x550dd1){var _0x2a91b6=this;return new Promise(function(_0x3c2115,_0x52b38a){var _0x87660c={'body':_0x49e98f[_0x886d('0x25')],'channel':'fax'};var _0x9eab95=[];var _0x2c48a2=[];var _0x50c229={};return db['CmContact'][_0x886d('0x26')]()[_0x886d('0x11')](function(_0x490a7f){if(!_0x490a7f){throw new db[(_0x886d('0x27'))]['ValidationError'](_0x886d('0x28'));}_0x9eab95=_['difference'](_[_0x886d('0x29')](_0x490a7f),[_0x886d('0x2a'),'updatedAt']);_0x2c48a2=_[_0x886d('0x2b')](_[_0x886d('0x29')](_0x490a7f),[_0x886d('0x2a'),_0x886d('0x2c'),_0x886d('0x2d'),_0x886d('0x2e')]);if(_0x49e98f['body']['id']){delete _0x49e98f[_0x886d('0x25')]['id'];}if(_['isNil'](_0x49e98f[_0x886d('0x25')][_0x886d('0x2f')])){throw new db[(_0x886d('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x886d('0x30')](_0x49e98f[_0x886d('0x25')][_0x886d('0x25')])||_0x49e98f[_0x886d('0x25')][_0x886d('0x25')]===''){throw new db[(_0x886d('0x27'))]['ValidationError'](_0x886d('0x31'));}if(_['isNil'](_0x49e98f['body'][_0x886d('0x32')])){throw new db[(_0x886d('0x27'))][(_0x886d('0x33'))](_0x886d('0x34')+_0x2c48a2);}if(!_[_0x886d('0x35')](_0x2c48a2,_0x49e98f['body'][_0x886d('0x32')])){throw new db[(_0x886d('0x27'))][(_0x886d('0x33'))](_0x886d('0x36')+_0x2c48a2);}_0x50c229[_0x49e98f[_0x886d('0x25')]['mapKey']]=_0x49e98f[_0x886d('0x25')]['from'];})['then'](function(){return db[_0x886d('0x1c')]['find']({'where':{'id':_0x49e98f[_0x886d('0x37')]['id']},'include':[{'model':db[_0x886d('0x38')],'as':_0x886d('0x39'),'include':[{'model':db[_0x886d('0x3a')],'as':_0x886d('0x3b'),'where':_0x50c229,'limit':0x1,'order':[[_0x886d('0x2c'),'DESC']]}]},{'model':db[_0x886d('0x3c')],'as':_0x886d('0x3d')}]});})[_0x886d('0x11')](function(_0x5e9b26){if(_0x5e9b26&&_0x5e9b26[_0x886d('0x39')]){var _0x3d57eb=_0x5e9b26['get']({'plain':!![]});_0x87660c[_0x886d('0x37')]=_0x3d57eb;_0x87660c[_0x886d('0x3e')]=_0x3d57eb[_0x886d('0x3d')];_0x87660c[_0x886d('0x3f')]=_0x3d57eb['List'];_0x87660c[_0x886d('0x3e')]=_[_0x886d('0x40')](_0x87660c['applications'],[_0x886d('0x41')],[_0x886d('0x42')]);if(_0x87660c[_0x886d('0x37')]['Applications']){delete _0x87660c['account'][_0x886d('0x3d')];}if(_0x87660c['account'][_0x886d('0x39')]&&_0x87660c['account']['List'][_0x886d('0x3b')]['length']){return _0x87660c[_0x886d('0x37')][_0x886d('0x39')][_0x886d('0x3b')][0x0];}var _0x5c6e58=_[_0x886d('0xc')](_0x49e98f['body'],{'firstName':_0x49e98f[_0x886d('0x25')]['from'],'ListId':_0x3d57eb[_0x886d('0x2e')]});_0x5c6e58[_0x49e98f[_0x886d('0x25')]['mapKey']]=_0x49e98f[_0x886d('0x25')][_0x886d('0x2f')];return db[_0x886d('0x3a')][_0x886d('0x43')](_0x5c6e58,{'fields':_0x9eab95,'raw':!![]});}})['then'](function(_0x3de25c){_0x87660c[_0x886d('0x44')]=_0x3de25c;if(_0x3de25c){var _0x5c00c5={'ContactId':_0x3de25c['id'],'FaxAccountId':_0x49e98f[_0x886d('0x37')]['id'],'fax':_0x3de25c[_0x886d('0x45')]};return db[_0x886d('0x46')][_0x886d('0x47')]({'where':{'ContactId':_0x3de25c['id'],'closed':![],'FaxAccountId':_0x49e98f[_0x886d('0x37')]['id']}})[_0x886d('0x11')](function(_0x4c363e){if(_0x4c363e){return[_0x4c363e,![]];}return db[_0x886d('0x46')][_0x886d('0x43')](_0x5c00c5)['then'](function(_0x5b24ba){return[_0x5b24ba,!![]];});});}else{throw new Error(_0x886d('0x48'));}})[_0x886d('0x49')](function(_0xaba037,_0x3e8097){var _0x292b08=_0xaba037[_0x886d('0x4a')]({'plain':!![]});if(_0x3e8097){if(_0x87660c['account']['autoclose']){_0x87660c[_0x886d('0x3e')][_0x886d('0x4b')]({'id':0x0,'priority':_0x87660c[_0x886d('0x3e')]['length']+0x1,'app':_0x886d('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x292b08[_0x886d('0x4d')]=!![];}else{_0x292b08[_0x886d('0x4d')]=![];}_0x87660c[_0x886d('0x4e')]=_0x292b08;return db[_0x886d('0x4f')][_0x886d('0x43')]({'body':_0x49e98f['body'][_0x886d('0x25')],'FaxAccountId':_0x49e98f[_0x886d('0x37')]['id'],'FaxInteractionId':_0xaba037['id'],'direction':'in','ContactId':_0xaba037[_0x886d('0x50')],'AttachmentId':_0x49e98f[_0x886d('0x25')]['AttachmentId']});})['then'](function(_0x49b832){_0x87660c[_0x886d('0x19')]=_0x49b832;if(_0x87660c['interaction'][_0x886d('0x51')]){return db[_0x886d('0x52')][_0x886d('0x47')]({'attributes':['id','name'],'where':{'id':_0x87660c['interaction'][_0x886d('0x51')]}})[_0x886d('0x11')](function(_0x4004dd){if(_0x4004dd){_0x87660c[_0x886d('0x3e')][_0x886d('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4004dd[_0x886d('0x54')]+','+(_0x87660c['account'][_0x886d('0x55')]||0xa),'interval':_0x886d('0x56')});}return respondWithRpcPromise('Start',_0x886d('0x57'),_0x87660c);});}return respondWithRpcPromise(_0x886d('0x58'),'startRouting',_0x87660c);})[_0x886d('0x11')](function(_0x80875e){_0x3c2115(_0x80875e);})[_0x886d('0x1a')](function(_0x3e3bbe){_0x52b38a(_0x2a91b6[_0x886d('0x16')](0x1f4,_0x3e3bbe['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a4c0632..298dc29 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 _0x82c4=['removeListener','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x4bf2c1,_0x4a0c03){var _0x160d45=function(_0x25832c){while(--_0x25832c){_0x4bf2c1['push'](_0x4bf2c1['shift']());}};_0x160d45(++_0x4a0c03);}(_0x82c4,0x1ca));var _0x482c=function(_0x525cc6,_0x5a7e0e){_0x525cc6=_0x525cc6-0x0;var _0x2427d3=_0x82c4[_0x525cc6];return _0x2427d3;};'use strict';var FaxAccountEvents=require(_0x482c('0x0'));var events=[_0x482c('0x1'),_0x482c('0x2'),_0x482c('0x3')];function createListener(_0x18d056,_0x69706f){return function(_0x863ea9){_0x69706f['emit'](_0x18d056,_0x863ea9);};}function removeListener(_0x16b0f8,_0x5f4dee){return function(){FaxAccountEvents[_0x482c('0x4')](_0x16b0f8,_0x5f4dee);};}exports['register']=function(_0x477cf4){for(var _0x5d7c76=0x0,_0xfdb92=events[_0x482c('0x5')];_0x5d7c76<_0xfdb92;_0x5d7c76++){var _0x35cdab=events[_0x5d7c76];var _0x1c10f2=createListener(_0x482c('0x6')+_0x35cdab,_0x477cf4);FaxAccountEvents['on'](_0x35cdab,_0x1c10f2);}}; \ No newline at end of file +var _0x0adf=['emit','removeListener','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x1a5443,_0xefe890){var _0x2d48c6=function(_0x1519fd){while(--_0x1519fd){_0x1a5443['push'](_0x1a5443['shift']());}};_0x2d48c6(++_0xefe890);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x27eeca,_0x1219bf){_0x27eeca=_0x27eeca-0x0;var _0xfc09aa=_0x0adf[_0x27eeca];return _0xfc09aa;};'use strict';var FaxAccountEvents=require(_0xf0ad('0x0'));var events=[_0xf0ad('0x1'),_0xf0ad('0x2'),'update'];function createListener(_0x4a97fd,_0x10cf5b){return function(_0x5d1191){_0x10cf5b[_0xf0ad('0x3')](_0x4a97fd,_0x5d1191);};}function removeListener(_0x27d666,_0x459e70){return function(){FaxAccountEvents[_0xf0ad('0x4')](_0x27d666,_0x459e70);};}exports['register']=function(_0x3bbf85){for(var _0x53221f=0x0,_0x2eca0e=events[_0xf0ad('0x5')];_0x53221f<_0x2eca0e;_0x53221f++){var _0x170574=events[_0x53221f];var _0x41c99d=createListener(_0xf0ad('0x6')+_0x170574,_0x3bbf85);FaxAccountEvents['on'](_0x170574,_0x41c99d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 60b0430..7af2d85 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 _0x5896=['getInteractions','getApplications','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/applications','/addaccountapplications','/updateaccountapplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','../../components/auth/service','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions'];(function(_0x369d7c,_0xeb28ba){var _0x12f56d=function(_0x33ad8a){while(--_0x33ad8a){_0x369d7c['push'](_0x369d7c['shift']());}};_0x12f56d(++_0xeb28ba);}(_0x5896,0x13d));var _0x6589=function(_0x50c493,_0x583092){_0x50c493=_0x50c493-0x0;var _0x159e02=_0x5896[_0x50c493];return _0x159e02;};'use strict';var multer=require(_0x6589('0x0'));var util=require(_0x6589('0x1'));var path=require(_0x6589('0x2'));var timeout=require('connect-timeout');var express=require(_0x6589('0x3'));var router=express['Router']();var auth=require(_0x6589('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6589('0x5'));router[_0x6589('0x6')]('/',auth['isAuthenticated'](),controller[_0x6589('0x7')]);router['get'](_0x6589('0x8'),auth[_0x6589('0x9')](),controller[_0x6589('0xa')]);router[_0x6589('0x6')](_0x6589('0xb'),auth[_0x6589('0x9')](),controller['show']);router[_0x6589('0x6')](_0x6589('0xc'),auth['isAuthenticated'](),controller[_0x6589('0xd')]);router[_0x6589('0x6')](_0x6589('0xe'),auth[_0x6589('0x9')](),controller['getAnswers']);router['get'](_0x6589('0xf'),auth[_0x6589('0x9')](),controller[_0x6589('0x10')]);router[_0x6589('0x6')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6589('0x11')]);router[_0x6589('0x6')]('/:id/messages',auth[_0x6589('0x9')](),controller[_0x6589('0x12')]);router[_0x6589('0x6')](_0x6589('0x13'),auth['isAuthenticated'](),controller[_0x6589('0x14')]);router[_0x6589('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6589('0x15')](_0x6589('0xc'),auth['isAuthenticated'](),controller[_0x6589('0x16')]);router[_0x6589('0x15')](_0x6589('0xe'),auth[_0x6589('0x9')](),controller[_0x6589('0x17')]);router[_0x6589('0x15')](_0x6589('0xf'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x6589('0x15')](_0x6589('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6589('0x15')](_0x6589('0x19'),auth[_0x6589('0x9')](),controller['addAccountApplications']);router[_0x6589('0x15')](_0x6589('0x1a'),auth[_0x6589('0x9')](),controller['updateAccountApplications']);router[_0x6589('0x15')](_0x6589('0x1b'),auth[_0x6589('0x9')](),controller[_0x6589('0x1c')]);router[_0x6589('0x15')](_0x6589('0x13'),auth[_0x6589('0x9')](),controller[_0x6589('0x1d')]);router['put']('/:id',auth[_0x6589('0x9')](),controller[_0x6589('0x1e')]);router[_0x6589('0x1f')](_0x6589('0xb'),auth['isAuthenticated'](),controller[_0x6589('0x20')]);router[_0x6589('0x1f')](_0x6589('0xc'),auth[_0x6589('0x9')](),controller[_0x6589('0x21')]);router['delete']('/:id/canned_answers',auth[_0x6589('0x9')](),controller[_0x6589('0x22')]);router[_0x6589('0x1f')](_0x6589('0x13'),auth[_0x6589('0x9')](),controller[_0x6589('0x23')]);module[_0x6589('0x24')]=router; \ No newline at end of file +var _0x1d70=['removeDispositions','removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','put','delete'];(function(_0x5f72ad,_0x5eaae9){var _0x21d654=function(_0x383fa5){while(--_0x383fa5){_0x5f72ad['push'](_0x5f72ad['shift']());}};_0x21d654(++_0x5eaae9);}(_0x1d70,0x133));var _0x01d7=function(_0xc2c752,_0x445d30){_0xc2c752=_0xc2c752-0x0;var _0x14aadb=_0x1d70[_0xc2c752];return _0x14aadb;};'use strict';var multer=require(_0x01d7('0x0'));var util=require(_0x01d7('0x1'));var path=require('path');var timeout=require(_0x01d7('0x2'));var express=require('express');var router=express[_0x01d7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x01d7('0x4'));var config=require(_0x01d7('0x5'));var controller=require(_0x01d7('0x6'));router[_0x01d7('0x7')]('/',auth[_0x01d7('0x8')](),controller[_0x01d7('0x9')]);router[_0x01d7('0x7')]('/describe',auth[_0x01d7('0x8')](),controller['describe']);router[_0x01d7('0x7')](_0x01d7('0xa'),auth['isAuthenticated'](),controller[_0x01d7('0xb')]);router[_0x01d7('0x7')](_0x01d7('0xc'),auth[_0x01d7('0x8')](),controller[_0x01d7('0xd')]);router[_0x01d7('0x7')]('/:id/canned_answers',auth[_0x01d7('0x8')](),controller[_0x01d7('0xe')]);router[_0x01d7('0x7')](_0x01d7('0xf'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x10')]);router[_0x01d7('0x7')](_0x01d7('0x11'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x12')]);router['get'](_0x01d7('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0x01d7('0x7')](_0x01d7('0x14'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x15')]);router[_0x01d7('0x16')]('/',auth['isAuthenticated'](),controller[_0x01d7('0x17')]);router[_0x01d7('0x16')](_0x01d7('0xc'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x18')]);router[_0x01d7('0x16')](_0x01d7('0x19'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x1a')]);router['post'](_0x01d7('0xf'),auth['isAuthenticated'](),controller[_0x01d7('0x1b')]);router['post'](_0x01d7('0x11'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x1c')]);router[_0x01d7('0x16')](_0x01d7('0x1d'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x1e')]);router[_0x01d7('0x16')](_0x01d7('0x1f'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post'](_0x01d7('0x20'),auth['isAuthenticated'](),controller['send']);router['post'](_0x01d7('0x14'),auth[_0x01d7('0x8')](),controller['addAgents']);router[_0x01d7('0x21')](_0x01d7('0xa'),auth[_0x01d7('0x8')](),controller['update']);router[_0x01d7('0x22')](_0x01d7('0xa'),auth[_0x01d7('0x8')](),controller['destroy']);router[_0x01d7('0x22')](_0x01d7('0xc'),auth[_0x01d7('0x8')](),controller[_0x01d7('0x23')]);router[_0x01d7('0x22')](_0x01d7('0x19'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x01d7('0x22')]('/:id/users',auth[_0x01d7('0x8')](),controller[_0x01d7('0x24')]);module[_0x01d7('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5e021b9..7952f5f 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 _0x82d8=['INTEGER','TEXT','STRING','sequelize'];(function(_0x11739a,_0x10fb03){var _0x4f5c0e=function(_0x41c0be){while(--_0x41c0be){_0x11739a['push'](_0x11739a['shift']());}};_0x4f5c0e(++_0x10fb03);}(_0x82d8,0xff));var _0x882d=function(_0x18c8ee,_0xf8bd4c){_0x18c8ee=_0x18c8ee-0x0;var _0x4f8ad5=_0x82d8[_0x18c8ee];return _0x4f8ad5;};'use strict';var Sequelize=require(_0x882d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x882d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x882d('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x882d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xdca4=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0xdca4,0x138));var _0x4dca=function(_0x47086b,_0xbc0f2b){_0x47086b=_0x47086b-0x0;var _0x14086=_0xdca4[_0x47086b];return _0x14086;};'use strict';var Sequelize=require(_0x4dca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4dca('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4dca('0x2')},'appdata':{'type':Sequelize[_0x4dca('0x3')]()},'description':{'type':Sequelize[_0x4dca('0x4')]},'interval':{'type':Sequelize[_0x4dca('0x4')],'defaultValue':_0x4dca('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ed44ca7..363c2b4 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 _0x2b58=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','FaxApplication'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2b58,0x1e0));var _0x82b5=function(_0x385223,_0x1fe515){_0x385223=_0x385223-0x0;var _0x4eec94=_0x2b58[_0x385223];return _0x4eec94;};'use strict';var pdf=require(_0x82b5('0x0'));var emlformat=require(_0x82b5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x82b5('0x2'));var rp=require(_0x82b5('0x3'));var moment=require('moment');var BPromise=require(_0x82b5('0x4'));var Mustache=require(_0x82b5('0x5'));var util=require(_0x82b5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x82b5('0x7'));var ejs=require(_0x82b5('0x8'));var fs=require('fs');var _=require(_0x82b5('0x9'));var squel=require(_0x82b5('0xa'));var crypto=require(_0x82b5('0xb'));var jsforce=require(_0x82b5('0xc'));var deskjs=require(_0x82b5('0xd'));var toCsv=require(_0x82b5('0x7'));var querystring=require('querystring');var Papa=require(_0x82b5('0xe'));var Redis=require('ioredis');var authService=require(_0x82b5('0xf'));var qs=require(_0x82b5('0x10'));var as=require(_0x82b5('0x11'));var hardwareService=require(_0x82b5('0x12'));var logger=require(_0x82b5('0x13'))(_0x82b5('0x14'));var utils=require(_0x82b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x82b5('0x16'));var db=require(_0x82b5('0x17'))['db'];function respondWithStatusCode(_0x1a82df,_0x4d745f){_0x4d745f=_0x4d745f||0xcc;return function(_0x113e51){if(_0x113e51){return _0x1a82df['sendStatus'](_0x4d745f);}return _0x1a82df[_0x82b5('0x18')](_0x4d745f)[_0x82b5('0x19')]();};}function respondWithResult(_0x24f37e,_0x27d30a){_0x27d30a=_0x27d30a||0xc8;return function(_0x20c975){if(_0x20c975){return _0x24f37e['status'](_0x27d30a)[_0x82b5('0x1a')](_0x20c975);}};}function respondWithFilteredResult(_0x3518f9,_0x4f0505){return function(_0x11039f){if(_0x11039f){var _0x5a06eb=_0x11039f[_0x82b5('0x1b')],_0x1885f7=_0x4f0505[_0x82b5('0x1c')],_0x1aa928=_0x4f0505['offset']+_0x4f0505[_0x82b5('0x1d')],_0x3115cc;if(_0x1aa928>=_0x5a06eb){_0x1aa928=_0x5a06eb;_0x3115cc=0xc8;}else{_0x3115cc=0xce;}_0x3518f9[_0x82b5('0x18')](_0x3115cc);return _0x3518f9[_0x82b5('0x1e')](_0x82b5('0x1f'),_0x1885f7+'-'+_0x1aa928+'/'+_0x5a06eb)[_0x82b5('0x1a')](_0x11039f);}return null;};}function patchUpdates(_0x340528){return function(_0x370de2){try{jsonpatch[_0x82b5('0x20')](_0x370de2,_0x340528,!![]);}catch(_0x1f5a16){return BPromise[_0x82b5('0x21')](_0x1f5a16);}return _0x370de2['save']();};}function saveUpdates(_0x1e7db4,_0x238aa8){return function(_0x39ee23){if(_0x39ee23){return _0x39ee23[_0x82b5('0x22')](_0x1e7db4)['then'](function(_0xf1d566){return _0xf1d566;});}return null;};}function removeEntity(_0x4b44c9,_0x474a94){return function(_0xa4481c){if(_0xa4481c){return _0xa4481c[_0x82b5('0x23')]()[_0x82b5('0x24')](function(){_0x4b44c9[_0x82b5('0x18')](0xcc)[_0x82b5('0x19')]();});}};}function handleEntityNotFound(_0x532f32,_0x4254b8){return function(_0x39683f){if(!_0x39683f){_0x532f32[_0x82b5('0x25')](0x194);}return _0x39683f;};}function handleError(_0x4ab381,_0x1373ad){_0x1373ad=_0x1373ad||0x1f4;return function(_0x42f052){logger[_0x82b5('0x26')](_0x42f052[_0x82b5('0x27')]);if(_0x42f052[_0x82b5('0x28')]){delete _0x42f052[_0x82b5('0x28')];}_0x4ab381[_0x82b5('0x18')](_0x1373ad)[_0x82b5('0x29')](_0x42f052);};}exports[_0x82b5('0x2a')]=function(_0x331c5e,_0x1c7ad8){var _0x483fce={},_0x53ae9f={},_0xf3f6be={'count':0x0,'rows':[]};var _0x31dfe6=_[_0x82b5('0x2b')](db[_0x82b5('0x2c')][_0x82b5('0x2d')],function(_0x2744e6){return{'name':_0x2744e6[_0x82b5('0x2e')],'type':_0x2744e6[_0x82b5('0x2f')][_0x82b5('0x30')]};});_0x53ae9f[_0x82b5('0x31')]=_[_0x82b5('0x2b')](_0x31dfe6,_0x82b5('0x28'));_0x53ae9f['query']=_[_0x82b5('0x32')](_0x331c5e[_0x82b5('0x33')]);_0x53ae9f[_0x82b5('0x34')]=_[_0x82b5('0x35')](_0x53ae9f[_0x82b5('0x31')],_0x53ae9f[_0x82b5('0x33')]);_0x483fce[_0x82b5('0x36')]=_[_0x82b5('0x35')](_0x53ae9f[_0x82b5('0x31')],qs['fields'](_0x331c5e[_0x82b5('0x33')][_0x82b5('0x37')]));_0x483fce[_0x82b5('0x36')]=_0x483fce[_0x82b5('0x36')][_0x82b5('0x38')]?_0x483fce[_0x82b5('0x36')]:_0x53ae9f['model'];if(!_0x331c5e[_0x82b5('0x33')][_0x82b5('0x39')](_0x82b5('0x3a'))){_0x483fce[_0x82b5('0x1d')]=qs[_0x82b5('0x1d')](_0x331c5e[_0x82b5('0x33')][_0x82b5('0x1d')]);_0x483fce[_0x82b5('0x1c')]=qs[_0x82b5('0x1c')](_0x331c5e['query'][_0x82b5('0x1c')]);}_0x483fce[_0x82b5('0x3b')]=qs[_0x82b5('0x3c')](_0x331c5e[_0x82b5('0x33')]['sort']);_0x483fce[_0x82b5('0x3d')]=qs['filters'](_[_0x82b5('0x3e')](_0x331c5e[_0x82b5('0x33')],_0x53ae9f[_0x82b5('0x34')]),_0x31dfe6);if(_0x331c5e[_0x82b5('0x33')][_0x82b5('0x3f')]){_0x483fce[_0x82b5('0x3d')]=_[_0x82b5('0x40')](_0x483fce[_0x82b5('0x3d')],{'$or':_[_0x82b5('0x2b')](_0x31dfe6,function(_0x5ce6d3){if(_0x5ce6d3[_0x82b5('0x2f')]!==_0x82b5('0x41')){var _0x136d10={};_0x136d10[_0x5ce6d3[_0x82b5('0x28')]]={'$like':'%'+_0x331c5e[_0x82b5('0x33')]['filter']+'%'};return _0x136d10;}})});}_0x483fce=_['merge']({},_0x483fce,_0x331c5e[_0x82b5('0x42')]);var _0x50f9eb={'where':_0x483fce[_0x82b5('0x3d')]};return db[_0x82b5('0x2c')][_0x82b5('0x1b')](_0x50f9eb)[_0x82b5('0x24')](function(_0x21ccf8){_0xf3f6be[_0x82b5('0x1b')]=_0x21ccf8;if(_0x331c5e[_0x82b5('0x33')][_0x82b5('0x43')]){_0x483fce[_0x82b5('0x44')]=[{'all':!![]}];}return db[_0x82b5('0x2c')]['findAll'](_0x483fce);})[_0x82b5('0x24')](function(_0x2a1b41){_0xf3f6be[_0x82b5('0x45')]=_0x2a1b41;return _0xf3f6be;})[_0x82b5('0x24')](respondWithFilteredResult(_0x1c7ad8,_0x483fce))[_0x82b5('0x46')](handleError(_0x1c7ad8,null));};exports[_0x82b5('0x47')]=function(_0xc68376,_0xa5d39a){var _0x2c3f5f={'raw':!![],'where':{'id':_0xc68376['params']['id']}},_0xa3563b={};_0xa3563b[_0x82b5('0x31')]=_[_0x82b5('0x32')](db['FaxApplication'][_0x82b5('0x2d')]);_0xa3563b[_0x82b5('0x33')]=_[_0x82b5('0x32')](_0xc68376['query']);_0xa3563b[_0x82b5('0x34')]=_[_0x82b5('0x35')](_0xa3563b[_0x82b5('0x31')],_0xa3563b['query']);_0x2c3f5f[_0x82b5('0x36')]=_[_0x82b5('0x35')](_0xa3563b[_0x82b5('0x31')],qs[_0x82b5('0x37')](_0xc68376[_0x82b5('0x33')]['fields']));_0x2c3f5f['attributes']=_0x2c3f5f[_0x82b5('0x36')][_0x82b5('0x38')]?_0x2c3f5f['attributes']:_0xa3563b['model'];if(_0xc68376['query'][_0x82b5('0x43')]){_0x2c3f5f[_0x82b5('0x44')]=[{'all':!![]}];}_0x2c3f5f=_['merge']({},_0x2c3f5f,_0xc68376[_0x82b5('0x42')]);return db[_0x82b5('0x2c')]['find'](_0x2c3f5f)['then'](handleEntityNotFound(_0xa5d39a,null))[_0x82b5('0x24')](respondWithResult(_0xa5d39a,null))[_0x82b5('0x46')](handleError(_0xa5d39a,null));};exports['create']=function(_0x478972,_0x2cb936){return db['FaxApplication'][_0x82b5('0x48')](_0x478972['body'],{})['then'](respondWithResult(_0x2cb936,0xc9))[_0x82b5('0x46')](handleError(_0x2cb936,null));};exports[_0x82b5('0x22')]=function(_0x193826,_0x4fe787){if(_0x193826[_0x82b5('0x49')]['id']){delete _0x193826[_0x82b5('0x49')]['id'];}return db[_0x82b5('0x2c')]['find']({'where':{'id':_0x193826[_0x82b5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fe787,null))['then'](saveUpdates(_0x193826[_0x82b5('0x49')],null))[_0x82b5('0x24')](respondWithResult(_0x4fe787,null))[_0x82b5('0x46')](handleError(_0x4fe787,null));};exports[_0x82b5('0x23')]=function(_0x5a9280,_0x5c9c11){return db['FaxApplication']['find']({'where':{'id':_0x5a9280[_0x82b5('0x4a')]['id']}})[_0x82b5('0x24')](handleEntityNotFound(_0x5c9c11,null))[_0x82b5('0x24')](removeEntity(_0x5c9c11,null))[_0x82b5('0x46')](handleError(_0x5c9c11,null));}; \ No newline at end of file +var _0xe429=['include','find','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','map','FaxApplication','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','order','sort','where','VIRTUAL','filter','merge','options','then','includeAll','rows','catch','show'];(function(_0x46f7a4,_0x36078a){var _0x4dfc76=function(_0xdea9d0){while(--_0xdea9d0){_0x46f7a4['push'](_0x46f7a4['shift']());}};_0x4dfc76(++_0x36078a);}(_0xe429,0x120));var _0x9e42=function(_0x24e893,_0x130483){_0x24e893=_0x24e893-0x0;var _0x437e82=_0xe429[_0x24e893];return _0x437e82;};'use strict';var pdf=require(_0x9e42('0x0'));var emlformat=require(_0x9e42('0x1'));var rimraf=require(_0x9e42('0x2'));var zipdir=require(_0x9e42('0x3'));var jsonpatch=require(_0x9e42('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e42('0x5'));var Mustache=require(_0x9e42('0x6'));var util=require(_0x9e42('0x7'));var path=require(_0x9e42('0x8'));var sox=require(_0x9e42('0x9'));var csv=require(_0x9e42('0xa'));var ejs=require(_0x9e42('0xb'));var fs=require('fs');var _=require(_0x9e42('0xc'));var squel=require('squel');var crypto=require(_0x9e42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9e42('0xe'));var toCsv=require(_0x9e42('0xa'));var querystring=require(_0x9e42('0xf'));var Papa=require(_0x9e42('0x10'));var Redis=require(_0x9e42('0x11'));var authService=require(_0x9e42('0x12'));var qs=require(_0x9e42('0x13'));var as=require(_0x9e42('0x14'));var hardwareService=require(_0x9e42('0x15'));var logger=require('../../config/logger')(_0x9e42('0x16'));var utils=require(_0x9e42('0x17'));var config=require(_0x9e42('0x18'));var licenseUtil=require(_0x9e42('0x19'));var db=require(_0x9e42('0x1a'))['db'];function respondWithStatusCode(_0x31467e,_0x2f7ed1){_0x2f7ed1=_0x2f7ed1||0xcc;return function(_0x10a410){if(_0x10a410){return _0x31467e['sendStatus'](_0x2f7ed1);}return _0x31467e[_0x9e42('0x1b')](_0x2f7ed1)[_0x9e42('0x1c')]();};}function respondWithResult(_0x4ae5e2,_0x2890d8){_0x2890d8=_0x2890d8||0xc8;return function(_0x2e15c2){if(_0x2e15c2){return _0x4ae5e2[_0x9e42('0x1b')](_0x2890d8)[_0x9e42('0x1d')](_0x2e15c2);}};}function respondWithFilteredResult(_0x5b94fc,_0x47d37e){return function(_0x3adf89){if(_0x3adf89){var _0x356970=_0x3adf89[_0x9e42('0x1e')],_0x4f1159=_0x47d37e[_0x9e42('0x1f')],_0x343d67=_0x47d37e[_0x9e42('0x1f')]+_0x47d37e[_0x9e42('0x20')],_0x21a86f;if(_0x343d67>=_0x356970){_0x343d67=_0x356970;_0x21a86f=0xc8;}else{_0x21a86f=0xce;}_0x5b94fc[_0x9e42('0x1b')](_0x21a86f);return _0x5b94fc[_0x9e42('0x21')](_0x9e42('0x22'),_0x4f1159+'-'+_0x343d67+'/'+_0x356970)[_0x9e42('0x1d')](_0x3adf89);}return null;};}function patchUpdates(_0x3b10e8){return function(_0x503527){try{jsonpatch[_0x9e42('0x23')](_0x503527,_0x3b10e8,!![]);}catch(_0x37a3d9){return BPromise[_0x9e42('0x24')](_0x37a3d9);}return _0x503527[_0x9e42('0x25')]();};}function saveUpdates(_0x114351,_0x1187fa){return function(_0x38104b){if(_0x38104b){return _0x38104b['update'](_0x114351)['then'](function(_0x592c3f){return _0x592c3f;});}return null;};}function removeEntity(_0x286124,_0x3380c8){return function(_0x119dd8){if(_0x119dd8){return _0x119dd8[_0x9e42('0x26')]()['then'](function(){_0x286124[_0x9e42('0x1b')](0xcc)[_0x9e42('0x1c')]();});}};}function handleEntityNotFound(_0x3dc7d9,_0x21e1b3){return function(_0x673797){if(!_0x673797){_0x3dc7d9['sendStatus'](0x194);}return _0x673797;};}function handleError(_0x441b9c,_0xcbe8){_0xcbe8=_0xcbe8||0x1f4;return function(_0x49ff5a){logger[_0x9e42('0x27')](_0x49ff5a[_0x9e42('0x28')]);if(_0x49ff5a[_0x9e42('0x29')]){delete _0x49ff5a['name'];}_0x441b9c[_0x9e42('0x1b')](_0xcbe8)[_0x9e42('0x2a')](_0x49ff5a);};}exports['index']=function(_0x1810b5,_0x382354){var _0x29bf46={},_0x482747={},_0x1c2094={'count':0x0,'rows':[]};var _0x42c2d3=_[_0x9e42('0x2b')](db[_0x9e42('0x2c')]['rawAttributes'],function(_0x10e25e){return{'name':_0x10e25e[_0x9e42('0x2d')],'type':_0x10e25e[_0x9e42('0x2e')]['key']};});_0x482747[_0x9e42('0x2f')]=_[_0x9e42('0x2b')](_0x42c2d3,'name');_0x482747['query']=_[_0x9e42('0x30')](_0x1810b5['query']);_0x482747[_0x9e42('0x31')]=_['intersection'](_0x482747[_0x9e42('0x2f')],_0x482747[_0x9e42('0x32')]);_0x29bf46[_0x9e42('0x33')]=_[_0x9e42('0x34')](_0x482747[_0x9e42('0x2f')],qs[_0x9e42('0x35')](_0x1810b5[_0x9e42('0x32')][_0x9e42('0x35')]));_0x29bf46[_0x9e42('0x33')]=_0x29bf46[_0x9e42('0x33')][_0x9e42('0x36')]?_0x29bf46[_0x9e42('0x33')]:_0x482747[_0x9e42('0x2f')];if(!_0x1810b5[_0x9e42('0x32')]['hasOwnProperty']('nolimit')){_0x29bf46[_0x9e42('0x20')]=qs[_0x9e42('0x20')](_0x1810b5['query'][_0x9e42('0x20')]);_0x29bf46[_0x9e42('0x1f')]=qs[_0x9e42('0x1f')](_0x1810b5[_0x9e42('0x32')]['offset']);}_0x29bf46[_0x9e42('0x37')]=qs[_0x9e42('0x38')](_0x1810b5[_0x9e42('0x32')][_0x9e42('0x38')]);_0x29bf46[_0x9e42('0x39')]=qs['filters'](_['pick'](_0x1810b5[_0x9e42('0x32')],_0x482747['filters']),_0x42c2d3);if(_0x1810b5[_0x9e42('0x32')]['filter']){_0x29bf46[_0x9e42('0x39')]=_['merge'](_0x29bf46['where'],{'$or':_[_0x9e42('0x2b')](_0x42c2d3,function(_0x4145c8){if(_0x4145c8[_0x9e42('0x2e')]!==_0x9e42('0x3a')){var _0x1e3708={};_0x1e3708[_0x4145c8[_0x9e42('0x29')]]={'$like':'%'+_0x1810b5[_0x9e42('0x32')][_0x9e42('0x3b')]+'%'};return _0x1e3708;}})});}_0x29bf46=_[_0x9e42('0x3c')]({},_0x29bf46,_0x1810b5[_0x9e42('0x3d')]);var _0x5c5730={'where':_0x29bf46['where']};return db[_0x9e42('0x2c')][_0x9e42('0x1e')](_0x5c5730)[_0x9e42('0x3e')](function(_0x194cd1){_0x1c2094[_0x9e42('0x1e')]=_0x194cd1;if(_0x1810b5['query'][_0x9e42('0x3f')]){_0x29bf46['include']=[{'all':!![]}];}return db[_0x9e42('0x2c')]['findAll'](_0x29bf46);})['then'](function(_0x1d1209){_0x1c2094[_0x9e42('0x40')]=_0x1d1209;return _0x1c2094;})[_0x9e42('0x3e')](respondWithFilteredResult(_0x382354,_0x29bf46))[_0x9e42('0x41')](handleError(_0x382354,null));};exports[_0x9e42('0x42')]=function(_0x4ac3e0,_0x27efa4){var _0x350881={'raw':!![],'where':{'id':_0x4ac3e0['params']['id']}},_0xa76fac={};_0xa76fac['model']=_[_0x9e42('0x30')](db['FaxApplication']['rawAttributes']);_0xa76fac[_0x9e42('0x32')]=_[_0x9e42('0x30')](_0x4ac3e0[_0x9e42('0x32')]);_0xa76fac['filters']=_[_0x9e42('0x34')](_0xa76fac[_0x9e42('0x2f')],_0xa76fac[_0x9e42('0x32')]);_0x350881[_0x9e42('0x33')]=_[_0x9e42('0x34')](_0xa76fac[_0x9e42('0x2f')],qs[_0x9e42('0x35')](_0x4ac3e0[_0x9e42('0x32')]['fields']));_0x350881[_0x9e42('0x33')]=_0x350881[_0x9e42('0x33')][_0x9e42('0x36')]?_0x350881[_0x9e42('0x33')]:_0xa76fac[_0x9e42('0x2f')];if(_0x4ac3e0[_0x9e42('0x32')][_0x9e42('0x3f')]){_0x350881[_0x9e42('0x43')]=[{'all':!![]}];}_0x350881=_[_0x9e42('0x3c')]({},_0x350881,_0x4ac3e0[_0x9e42('0x3d')]);return db[_0x9e42('0x2c')][_0x9e42('0x44')](_0x350881)[_0x9e42('0x3e')](handleEntityNotFound(_0x27efa4,null))[_0x9e42('0x3e')](respondWithResult(_0x27efa4,null))[_0x9e42('0x41')](handleError(_0x27efa4,null));};exports['create']=function(_0x650086,_0x5799cc){return db['FaxApplication']['create'](_0x650086[_0x9e42('0x45')],{})[_0x9e42('0x3e')](respondWithResult(_0x5799cc,0xc9))[_0x9e42('0x41')](handleError(_0x5799cc,null));};exports['update']=function(_0x366e6d,_0x41fe85){if(_0x366e6d['body']['id']){delete _0x366e6d[_0x9e42('0x45')]['id'];}return db[_0x9e42('0x2c')][_0x9e42('0x44')]({'where':{'id':_0x366e6d[_0x9e42('0x46')]['id']}})[_0x9e42('0x3e')](handleEntityNotFound(_0x41fe85,null))[_0x9e42('0x3e')](saveUpdates(_0x366e6d['body'],null))[_0x9e42('0x3e')](respondWithResult(_0x41fe85,null))[_0x9e42('0x41')](handleError(_0x41fe85,null));};exports[_0x9e42('0x26')]=function(_0x2456bf,_0x1ef4b2){return db['FaxApplication'][_0x9e42('0x44')]({'where':{'id':_0x2456bf[_0x9e42('0x46')]['id']}})[_0x9e42('0x3e')](handleEntityNotFound(_0x1ef4b2,null))['then'](removeEntity(_0x1ef4b2,null))[_0x9e42('0x41')](handleError(_0x1ef4b2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 09d8d44..286b362 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 _0xd78d=['bluebird','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x28ce1a,_0x548bbf){var _0x4b1154=function(_0x381e96){while(--_0x381e96){_0x28ce1a['push'](_0x28ce1a['shift']());}};_0x4b1154(++_0x548bbf);}(_0xd78d,0x182));var _0xdd78=function(_0x175a4d,_0x155355){_0x175a4d=_0x175a4d-0x0;var _0x501590=_0xd78d[_0x175a4d];return _0x501590;};'use strict';var _=require(_0xdd78('0x0'));var util=require('util');var logger=require(_0xdd78('0x1'))(_0xdd78('0x2'));var moment=require(_0xdd78('0x3'));var BPromise=require(_0xdd78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdd78('0x5'));var attributes=require(_0xdd78('0x6'));module[_0xdd78('0x7')]=function(_0x53797e,_0x3e34de){return _0x53797e[_0xdd78('0x8')](_0xdd78('0x9'),attributes,{'tableName':_0xdd78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd78('0xb'),'collate':_0xdd78('0xc')});}; \ No newline at end of file +var _0xfcd0=['util','moment','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcd0,0x14f));var _0x0fcd=function(_0x64c32a,_0x15fbf3){_0x64c32a=_0x64c32a-0x0;var _0x3a8e14=_0xfcd0[_0x64c32a];return _0x3a8e14;};'use strict';var _=require(_0x0fcd('0x0'));var util=require(_0x0fcd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0fcd('0x2'));var BPromise=require('bluebird');var rp=require(_0x0fcd('0x3'));var fs=require('fs');var path=require(_0x0fcd('0x4'));var rimraf=require(_0x0fcd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0fcd('0x6'));module[_0x0fcd('0x7')]=function(_0x46defe,_0x10f9c3){return _0x46defe[_0x0fcd('0x8')](_0x0fcd('0x9'),attributes,{'tableName':_0x0fcd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0fcd('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1ddc9fc..51479bf 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 _0x9420=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','debug','moment'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x9420,0x1a3));var _0x0942=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x9420[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0942('0x0'));var BPromise=require(_0x0942('0x1'));var rs=require(_0x0942('0x2'));var fs=require('fs');var Redis=require(_0x0942('0x3'));var db=require(_0x0942('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0942('0x5'))(_0x0942('0x6'));var config=require(_0x0942('0x7'));var jayson=require(_0x0942('0x8'));var client=jayson['client'][_0x0942('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x165ecb,_0x5a86d1,_0x25f245){return new BPromise(function(_0x5351c6,_0x1b36af){return client[_0x0942('0xa')](_0x165ecb,_0x25f245)[_0x0942('0xb')](function(_0xfe6954){logger[_0x0942('0xc')](_0x0942('0xd'),_0x5a86d1,_0x0942('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5a86d1,'request\x20sent',JSON[_0x0942('0xf')](_0xfe6954));if(_0xfe6954[_0x0942('0x10')]){if(_0xfe6954[_0x0942('0x10')][_0x0942('0x11')]===0x1f4){logger[_0x0942('0x10')](_0x0942('0xd'),_0x5a86d1,_0xfe6954[_0x0942('0x10')][_0x0942('0x12')]);return _0x1b36af(_0xfe6954['error']['message']);}logger[_0x0942('0x10')](_0x0942('0xd'),_0x5a86d1,_0xfe6954[_0x0942('0x10')][_0x0942('0x12')]);return _0x5351c6(_0xfe6954[_0x0942('0x10')][_0x0942('0x12')]);}else{logger[_0x0942('0xc')]('FaxApplication,\x20%s,\x20%s',_0x5a86d1,'request\x20sent');_0x5351c6(_0xfe6954[_0x0942('0x13')]['message']);}})[_0x0942('0x14')](function(_0x4bbe97){logger[_0x0942('0x10')](_0x0942('0xd'),_0x5a86d1,_0x4bbe97);_0x1b36af(_0x4bbe97);});});}exports[_0x0942('0x15')]=function(_0x9ab287){var _0x25ff32=this;return new Promise(function(_0x5e7122,_0x40b93c){return db[_0x0942('0x16')][_0x0942('0x17')](_0x9ab287[_0x0942('0x18')],{'raw':_0x9ab287[_0x0942('0x19')]?_0x9ab287['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9ab287[_0x0942('0x19')]?_0x9ab287[_0x0942('0x19')][_0x0942('0x1a')]||null:null,'attributes':_0x9ab287[_0x0942('0x19')]?_0x9ab287[_0x0942('0x19')][_0x0942('0x1b')]||null:null,'limit':_0x9ab287[_0x0942('0x19')]?_0x9ab287[_0x0942('0x19')][_0x0942('0x1c')]||null:null})[_0x0942('0xb')](function(_0x52c14e){logger['info'](_0x0942('0x15'),_0x9ab287);logger[_0x0942('0x1d')]('UpdateFaxApplication',_0x9ab287,JSON[_0x0942('0xf')](_0x52c14e));_0x5e7122(_0x52c14e);})[_0x0942('0x14')](function(_0x47792d){logger['error'](_0x0942('0x15'),_0x47792d[_0x0942('0x12')],_0x9ab287);_0x40b93c(_0x25ff32[_0x0942('0x10')](0x1f4,_0x47792d[_0x0942('0x12')]));});});}; \ No newline at end of file +var _0x9a57=['FaxApplication','update','body','raw','options','where','attributes','limit','then','info','stringify','catch','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','UpdateFaxApplication'];(function(_0x5863fc,_0x22d109){var _0x2da08d=function(_0x196e01){while(--_0x196e01){_0x5863fc['push'](_0x5863fc['shift']());}};_0x2da08d(++_0x22d109);}(_0x9a57,0x1ec));var _0x79a5=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x9a57[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x79a5('0x0'));var util=require(_0x79a5('0x1'));var moment=require(_0x79a5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79a5('0x4'));var config=require(_0x79a5('0x5'));var jayson=require(_0x79a5('0x6'));var client=jayson[_0x79a5('0x7')][_0x79a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x259428,_0x1bce2f,_0x4913eb){return new BPromise(function(_0x5eb4f1,_0x11b2f4){return client[_0x79a5('0x9')](_0x259428,_0x4913eb)['then'](function(_0x3dd2ed){logger['info'](_0x79a5('0xa'),_0x1bce2f,'request\x20sent');logger[_0x79a5('0xb')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1bce2f,_0x79a5('0xc'),JSON['stringify'](_0x3dd2ed));if(_0x3dd2ed[_0x79a5('0xd')]){if(_0x3dd2ed['error'][_0x79a5('0xe')]===0x1f4){logger[_0x79a5('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1bce2f,_0x3dd2ed['error'][_0x79a5('0xf')]);return _0x11b2f4(_0x3dd2ed[_0x79a5('0xd')][_0x79a5('0xf')]);}logger[_0x79a5('0xd')](_0x79a5('0xa'),_0x1bce2f,_0x3dd2ed[_0x79a5('0xd')][_0x79a5('0xf')]);return _0x5eb4f1(_0x3dd2ed['error'][_0x79a5('0xf')]);}else{logger['info'](_0x79a5('0xa'),_0x1bce2f,_0x79a5('0xc'));_0x5eb4f1(_0x3dd2ed[_0x79a5('0x10')][_0x79a5('0xf')]);}})['catch'](function(_0x3818b9){logger[_0x79a5('0xd')](_0x79a5('0xa'),_0x1bce2f,_0x3818b9);_0x11b2f4(_0x3818b9);});});}exports[_0x79a5('0x11')]=function(_0x520e5b){var _0x26d642=this;return new Promise(function(_0x485147,_0x2950b6){return db[_0x79a5('0x12')][_0x79a5('0x13')](_0x520e5b[_0x79a5('0x14')],{'raw':_0x520e5b['options']?_0x520e5b['options'][_0x79a5('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520e5b[_0x79a5('0x16')]?_0x520e5b[_0x79a5('0x16')][_0x79a5('0x17')]||null:null,'attributes':_0x520e5b[_0x79a5('0x16')]?_0x520e5b[_0x79a5('0x16')][_0x79a5('0x18')]||null:null,'limit':_0x520e5b[_0x79a5('0x16')]?_0x520e5b['options'][_0x79a5('0x19')]||null:null})[_0x79a5('0x1a')](function(_0x297cf4){logger[_0x79a5('0x1b')](_0x79a5('0x11'),_0x520e5b);logger[_0x79a5('0xb')](_0x79a5('0x11'),_0x520e5b,JSON[_0x79a5('0x1c')](_0x297cf4));_0x485147(_0x297cf4);})[_0x79a5('0x1d')](function(_0x294770){logger[_0x79a5('0xd')]('UpdateFaxApplication',_0x294770[_0x79a5('0xf')],_0x520e5b);_0x2950b6(_0x26d642[_0x79a5('0xd')](0x1f4,_0x294770[_0x79a5('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8859886..4550120 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 _0xa630=['delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xa630,0xbe));var _0x0a63=function(_0x55ded6,_0x7eb99b){_0x55ded6=_0x55ded6-0x0;var _0x3c3348=_0xa630[_0x55ded6];return _0x3c3348;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var auth=require(_0x0a63('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a63('0x4'));var controller=require(_0x0a63('0x5'));router[_0x0a63('0x6')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0x8')]);router['get'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xa')]);router[_0x0a63('0xb')]('/',auth[_0x0a63('0x7')](),controller[_0x0a63('0xc')]);router['put'](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xd')]);router[_0x0a63('0xe')](_0x0a63('0x9'),auth[_0x0a63('0x7')](),controller[_0x0a63('0xf')]);module[_0x0a63('0x10')]=router; \ No newline at end of file +var _0x7c09=['update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0xf579b5,_0x34c1d9){_0xf579b5=_0xf579b5-0x0;var _0x1fac6d=_0x7c09[_0xf579b5];return _0x1fac6d;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var auth=require(_0x97c0('0x4'));var interaction=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var controller=require(_0x97c0('0x7'));router[_0x97c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97c0('0x9'),auth[_0x97c0('0xa')](),controller[_0x97c0('0xb')]);router[_0x97c0('0xc')]('/',auth[_0x97c0('0xa')](),controller['create']);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xe')]);router['delete']('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xf')]);module[_0x97c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7f8f333..6f2ad79 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 _0x55a5=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1d4be2,_0x12c7ec){var _0x3df399=function(_0x1e4e7d){while(--_0x1e4e7d){_0x1d4be2['push'](_0x1d4be2['shift']());}};_0x3df399(++_0x12c7ec);}(_0x55a5,0xf7));var _0x555a=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x55a5[_0x3d27a];return _0x314fd7;};'use strict';var Sequelize=require(_0x555a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x555a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x555a('0x2')]},'disposition':{'type':Sequelize[_0x555a('0x3')]},'secondDisposition':{'type':Sequelize[_0x555a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x555a('0x3')]},'note':{'type':Sequelize[_0x555a('0x3')]},'read1stAt':{'type':Sequelize[_0x555a('0x2')]},'fax':{'type':Sequelize[_0x555a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x555a('0x4')]('in',_0x555a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x555a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x555a('0x4')]('in',_0x555a('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbeff=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xbeff,0x8e));var _0xfbef=function(_0x128bb3,_0x2d2149){_0x128bb3=_0x128bb3-0x0;var _0x32558e=_0xbeff[_0x128bb3];return _0x32558e;};'use strict';var Sequelize=require('sequelize');module[_0xfbef('0x0')]={'closed':{'type':Sequelize[_0xfbef('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfbef('0x2')]},'disposition':{'type':Sequelize[_0xfbef('0x3')]},'secondDisposition':{'type':Sequelize[_0xfbef('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfbef('0x2')]},'fax':{'type':Sequelize[_0xfbef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfbef('0x4')]('in',_0xfbef('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfbef('0x4')]('in',_0xfbef('0x5')),'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 a0107ed..b743784 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 _0xee5b=['i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','rawAttributes','includeAll','options','FaxInteraction','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','faxInteractionTags:save','removeTags','download','unix','root','files','tmp','join','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','then','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','catch','index','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.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','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1a1052,_0x46d9af){_0x1a1052=_0x1a1052-0x0;var _0x31708a=_0xee5b[_0x1a1052];return _0x31708a;};'use strict';var pdf=require(_0xbee5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbee5('0x1'));var zipdir=require(_0xbee5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbee5('0x3'));var moment=require(_0xbee5('0x4'));var BPromise=require(_0xbee5('0x5'));var Mustache=require(_0xbee5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbee5('0x7'));var csv=require(_0xbee5('0x8'));var ejs=require(_0xbee5('0x9'));var fs=require('fs');var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];config[_0xbee5('0x17')]=_['defaults'](config[_0xbee5('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbee5('0x18'))(new Redis(config[_0xbee5('0x17')]));require(_0xbee5('0x19'))['register'](socket);function respondWithStatusCode(_0x5092f2,_0x3c6e56){_0x3c6e56=_0x3c6e56||0xcc;return function(_0x4cf5a8){if(_0x4cf5a8){return _0x5092f2[_0xbee5('0x1a')](_0x3c6e56);}return _0x5092f2['status'](_0x3c6e56)[_0xbee5('0x1b')]();};}function respondWithResult(_0x141878,_0xf676b1){_0xf676b1=_0xf676b1||0xc8;return function(_0x53b269){if(_0x53b269){return _0x141878[_0xbee5('0x1c')](_0xf676b1)[_0xbee5('0x1d')](_0x53b269);}};}function respondWithFilteredResult(_0x5a0ae5,_0x254dd3){return function(_0x538460){if(_0x538460){var _0x11b4a3=_0x538460[_0xbee5('0x1e')],_0x3c3f4e=_0x254dd3[_0xbee5('0x1f')],_0x35eb5c=_0x254dd3[_0xbee5('0x1f')]+_0x254dd3[_0xbee5('0x20')],_0xac51f5;if(_0x35eb5c>=_0x11b4a3){_0x35eb5c=_0x11b4a3;_0xac51f5=0xc8;}else{_0xac51f5=0xce;}_0x5a0ae5[_0xbee5('0x1c')](_0xac51f5);return _0x5a0ae5[_0xbee5('0x21')](_0xbee5('0x22'),_0x3c3f4e+'-'+_0x35eb5c+'/'+_0x11b4a3)[_0xbee5('0x1d')](_0x538460);}return null;};}function patchUpdates(_0x450824){return function(_0x47af8e){try{jsonpatch['apply'](_0x47af8e,_0x450824,!![]);}catch(_0x469a7a){return BPromise['reject'](_0x469a7a);}return _0x47af8e[_0xbee5('0x23')]();};}function saveUpdates(_0x117cb3,_0x3cee7f){return function(_0x2bfb0f){if(_0x2bfb0f){return _0x2bfb0f[_0xbee5('0x24')](_0x117cb3)[_0xbee5('0x25')](function(_0x359ccf){return _0x359ccf;});}return null;};}function removeEntity(_0x3cfa8d,_0xc79035){return function(_0x520c02){if(_0x520c02){return _0x520c02['destroy']()['then'](function(){_0x3cfa8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af3de,_0x18d7f4){return function(_0x3b84c8){if(!_0x3b84c8){_0x1af3de[_0xbee5('0x1a')](0x194);}return _0x3b84c8;};}function handleError(_0x169042,_0x20e7e8){_0x20e7e8=_0x20e7e8||0x1f4;return function(_0x3c8643){logger['error'](_0x3c8643[_0xbee5('0x26')]);if(_0x3c8643[_0xbee5('0x27')]){delete _0x3c8643[_0xbee5('0x27')];}_0x169042[_0xbee5('0x1c')](_0x20e7e8)[_0xbee5('0x28')](_0x3c8643);};}function getInteractionUsers(_0x5f0419,_0x21b993){return new BPromise(function(_0x15ffb1,_0xb7a077){try{if(_0x21b993[_0x5f0419['id']]){_0x5f0419[_0xbee5('0x29')]=_[_0xbee5('0x2a')](_0x21b993[_0x5f0419['id']],function(_0x26abe3){return{'id':_0x26abe3['id'],'fullname':_0x26abe3[_0xbee5('0x2b')]};});}}catch(_0x36e8bb){_0xb7a077(_0x36e8bb);}_0x15ffb1(_0x5f0419);});}function getInteractionTags(_0x2ccb91,_0x59c2e4){return new BPromise(function(_0x22df5f,_0x5b10a6){try{if(_0x2ccb91[_0xbee5('0x2c')]){_0x2ccb91['Tags']=[];_0x2ccb91[_0xbee5('0x2c')]['split'](',')[_0xbee5('0x2d')](function(_0x5c1109){_0x2ccb91[_0xbee5('0x2e')][_0xbee5('0x2f')](_0x59c2e4[_0x5c1109]);});}delete _0x2ccb91[_0xbee5('0x2c')];}catch(_0x751489){_0x5b10a6(_0x751489);}_0x22df5f(_0x2ccb91);});}function updateFaxInteraction(_0x502e55,_0xefbf7c,_0x17aa8d){return new BPromise(function(_0x477a03,_0x1c78cc){return getInteractionUsers(_0x502e55,_0x17aa8d)['then'](function(_0x24aed0){return getInteractionTags(_0x24aed0,_0xefbf7c);})[_0xbee5('0x25')](function(_0x23ce3f){_0x477a03(_0x23ce3f);})[_0xbee5('0x30')](function(_0x4c3428){_0x1c78cc(_0x4c3428);});});}exports[_0xbee5('0x31')]=function(_0xe61341,_0x3e854){var _0x33aaba={},_0x52ecf1={},_0x3c8a87={'count':0x0,'rows':[]};var _0x59cacb=_[_0xbee5('0x2a')](db['FaxInteraction']['rawAttributes'],function(_0x59bf49){return{'name':_0x59bf49[_0xbee5('0x32')],'type':_0x59bf49[_0xbee5('0x33')][_0xbee5('0x34')]};});_0x52ecf1[_0xbee5('0x35')]=_[_0xbee5('0x2a')](_0x59cacb,_0xbee5('0x27'));_0x52ecf1[_0xbee5('0x36')]=_[_0xbee5('0x37')](_0xe61341['query']);_0x52ecf1[_0xbee5('0x38')]=_['intersection'](_0x52ecf1[_0xbee5('0x35')],_0x52ecf1[_0xbee5('0x36')]);_0x33aaba[_0xbee5('0x39')]=_[_0xbee5('0x3a')](_0x52ecf1['model'],qs[_0xbee5('0x3b')](_0xe61341['query']['fields']));_0x33aaba[_0xbee5('0x39')]=_0x33aaba[_0xbee5('0x39')][_0xbee5('0x3c')]?_0x33aaba[_0xbee5('0x39')]:_0x52ecf1['model'];if(!_0xe61341[_0xbee5('0x36')][_0xbee5('0x3d')](_0xbee5('0x3e'))){_0x33aaba[_0xbee5('0x20')]=qs[_0xbee5('0x20')](_0xe61341[_0xbee5('0x36')][_0xbee5('0x20')]);_0x33aaba[_0xbee5('0x1f')]=qs[_0xbee5('0x1f')](_0xe61341[_0xbee5('0x36')]['offset']);}_0x33aaba[_0xbee5('0x3f')]=qs[_0xbee5('0x40')](_0xe61341['query'][_0xbee5('0x40')]);_0x33aaba[_0xbee5('0x41')]=qs[_0xbee5('0x38')](_[_0xbee5('0x42')](_0xe61341['query'],_0x52ecf1['filters']),_0x59cacb);var _0x4b4641=[];var _0x138a40=squel[_0xbee5('0x43')]()[_0xbee5('0x44')]('id')[_0xbee5('0x44')](_0xbee5('0x27'))[_0xbee5('0x44')](_0xbee5('0x45'))[_0xbee5('0x46')](_0xbee5('0x47'));var _0x5ee32c=squel['select']()[_0xbee5('0x44')]('u.id')[_0xbee5('0x44')](_0xbee5('0x48'))['field'](_0xbee5('0x49'))[_0xbee5('0x46')]('user_has_fax_interactions','ui')['left_join'](_0xbee5('0x4a'),'u',_0xbee5('0x4b'));var _0x496872=squel[_0xbee5('0x43')]()[_0xbee5('0x46')]('fax_interactions','i')[_0xbee5('0x4c')](_0xbee5('0x4d'),'c',_0xbee5('0x4e'))[_0xbee5('0x4c')](_0xbee5('0x4a'),'o',_0xbee5('0x4f'))[_0xbee5('0x4c')]('fax_accounts','a',_0xbee5('0x50'))[_0xbee5('0x4c')](_0xbee5('0x51'),'me',_0xbee5('0x52'))['left_join'](_0xbee5('0x53'),'it',_0xbee5('0x54'))[_0xbee5('0x4c')]('tools_tags','t',_0xbee5('0x55'));var _0xf637bf=squel['expr']();var _0x5a6cc2=[];var _0x54a570=squel[_0xbee5('0x56')]();var _0x501167;if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x57')]){_0x501167=as[_0xbee5('0x58')](_0xe61341[_0xbee5('0x36')][_0xbee5('0x57')]);var _0x296fc8=_0x501167['sqlOperator'];for(var _0x24274d=0x0;_0x24274d<_0x501167[_0xbee5('0x59')][_0xbee5('0x3c')];_0x24274d++){var _0x2479f6=_0x501167['conditions'][_0x24274d];var _0x98b160='i';var _0x594dcf=_[_0xbee5('0x5a')](_0x59cacb,[_0xbee5('0x27'),_0x2479f6[_0xbee5('0x44')]]);if(!_0x594dcf){switch(_0x2479f6[_0xbee5('0x44')]){case _0xbee5('0x5b'):if(_0x2479f6[_0xbee5('0x5c')]==0x1){_0x496872[_0xbee5('0x5d')]('`'+_0x2479f6[_0xbee5('0x44')]+_0xbee5('0x5e'));}else{_0x496872[_0xbee5('0x5d')]('`'+_0x2479f6[_0xbee5('0x44')]+_0xbee5('0x5f'));}break;case _0xbee5('0x60'):if(_0x2479f6[_0xbee5('0x61')]===_0xbee5('0x62')){if(_0x2479f6['value'][_0xbee5('0x63')]('\x20')[_0xbee5('0x3c')]>0x1){_0xf637bf[_0x296fc8](_0xbee5('0x64'),qs['getFullTextValue'](_0x2479f6[_0xbee5('0x5c')]),null);}else{var _0x1b753a='%'+_0x2479f6[_0xbee5('0x5c')]+'%';_0xf637bf[_0x296fc8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b753a,_0x1b753a,_0x1b753a);}}else{_0x594dcf=_[_0xbee5('0x5a')](_0x59cacb,['name',_0xbee5('0x65')]);_0x2479f6['field']=_0xbee5('0x65');_0x53cb9a=as[_0xbee5('0x66')](_0x98b160,_0x594dcf[_0xbee5('0x33')],_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a['text'],_0x53cb9a['value']['start'],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x1b')]);}break;case _0xbee5('0x67'):var _0x5b1a05=_0x2479f6[_0xbee5('0x5c')]['split'](',')[_0xbee5('0x2a')](function(_0x33fbb8){return Number(_0x33fbb8);});_0x5b1a05[_0xbee5('0x2d')](function(_0x5cc68d){_0x54a570['or'](_0xbee5('0x68'),'%,'+_0x5cc68d+',%');});_0x5a6cc2=_[_0xbee5('0x69')](_0x5a6cc2,_0x5b1a05);break;case _0xbee5('0x6a'):if(_0x2479f6[_0xbee5('0x61')]===_0xbee5('0x62')){_0xf637bf[_0x296fc8](_0xbee5('0x6b'),'%'+_0x2479f6[_0xbee5('0x5c')]+'%',null);}else{_0x594dcf=_[_0xbee5('0x5a')](_0x59cacb,[_0xbee5('0x27'),_0xbee5('0x6c')]);_0x2479f6[_0xbee5('0x44')]=_0xbee5('0x6c');_0x53cb9a=as[_0xbee5('0x66')](_0x98b160,_0x594dcf[_0xbee5('0x33')],_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a[_0xbee5('0x6d')],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x6e')],_0x53cb9a['value'][_0xbee5('0x1b')]);}break;case'body':_0x53cb9a=as['buildExpression']('me',null,_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a[_0xbee5('0x6d')],_0x53cb9a[_0xbee5('0x5c')]['start'],_0x53cb9a['value'][_0xbee5('0x1b')]);break;}}else{var _0x53cb9a=as[_0xbee5('0x66')](_0x98b160,_0x594dcf[_0xbee5('0x33')],_0x2479f6);_0xf637bf[_0x296fc8](_0x53cb9a['text'],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x6e')],_0x53cb9a[_0xbee5('0x5c')][_0xbee5('0x1b')]);}}}else{var _0x5107d3=_(_0xe61341[_0xbee5('0x36')])['keys']()[_0xbee5('0x2a')](function(_0x465ec8){return _['some'](_0x59cacb,[_0xbee5('0x27'),_0x465ec8])?_0x465ec8:undefined;})[_0xbee5('0x6f')]()['value']();if(!_[_0xbee5('0x70')](_0x5107d3)){_0x5107d3[_0xbee5('0x2d')](function(_0x4f431e){if(_0x4f431e===_0xbee5('0x71')){_0x496872['where'](_0xbee5('0x72'),[]['concat'](_0xe61341[_0xbee5('0x36')][_0x4f431e]));}else if(_0x4f431e==='createdAt'){var _0x541414=JSON[_0xbee5('0x73')](_0xe61341[_0xbee5('0x36')][_0x4f431e])[_0xbee5('0x74')];var _0x2f025c=JSON[_0xbee5('0x73')](_0xe61341[_0xbee5('0x36')][_0x4f431e])['$lte'];_0x496872[_0xbee5('0x41')](_0xbee5('0x75'),_0x541414,_0x2f025c);}else{if(_0xe61341[_0xbee5('0x36')][_0x4f431e]===_0xbee5('0x76')){_0x496872[_0xbee5('0x41')]('i.'+_0x4f431e+_0xbee5('0x77'));}else{_0x496872[_0xbee5('0x41')]('i.'+_0x4f431e+_0xbee5('0x78'),_0xe61341[_0xbee5('0x36')][_0x4f431e]);}}});}if(_0xe61341['query'][_0xbee5('0x79')]){if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x79')]==0x1){_0x496872[_0xbee5('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x496872[_0xbee5('0x5d')](_0xbee5('0x7a'));}}if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')]){_0x5a6cc2=_[_0xbee5('0x7c')](_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')])?_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')]:new Array(_0xe61341[_0xbee5('0x36')][_0xbee5('0x7b')]);_0x5a6cc2[_0xbee5('0x2d')](function(_0x4f9431){_0x54a570['or'](_0xbee5('0x68'),'%,'+_0x4f9431+',%');});}if(_0xe61341[_0xbee5('0x36')]['filter']){var _0x3612ee=_0xe61341['query'][_0xbee5('0x7d')][_0xbee5('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xbee5('0x7f')](_0x3612ee)){_0xf637bf['or']('i.id\x20LIKE\x20?',_0x3612ee+'%')['or']('i.fax\x20LIKE\x20?',_0x3612ee+'%');}_0xf637bf['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3612ee+'%');}}_0x496872['where'](_0xf637bf);_0x496872['group']('i.id');var _0x14d5e4={'type':db[_0xbee5('0x80')][_0xbee5('0x81')][_0xbee5('0x82')],'raw':!![]};var _0x2284ac=_0x496872[_0xbee5('0x83')]();_0x2284ac[_0xbee5('0x44')](_0xbee5('0x84'));_0x2284ac[_0xbee5('0x44')](_0xbee5('0x85'),_0xbee5('0x5b'));if(_0x33aaba[_0xbee5('0x3f')]){_0x33aaba['order'][_0xbee5('0x2d')](function(_0x3196f9){var _0x56cff5=_0x3196f9[0x0]==='contactName'?_0x3196f9[0x0]:'i.'+_0x3196f9[0x0];_0x496872[_0xbee5('0x3f')](_0x56cff5,_0x3196f9[0x1]===_0xbee5('0x86')?![]:!![]);});}if(!_[_0xbee5('0x70')](_0x5a6cc2)){_0x496872['having'](_0x54a570);_0x2284ac[_0xbee5('0x41')](_0xbee5('0x87'),_0x5a6cc2);}BPromise[_0xbee5('0x88')]()['then'](function(){if(!_0x501167){if(_0xe61341['query']['FaxAccountId']||_0xe61341[_0xbee5('0x36')][_0xbee5('0x89')])return;_0x2284ac[_0xbee5('0x41')](_0xbee5('0x8a'));_0x496872[_0xbee5('0x41')](_0xbee5('0x8a'));return;}if(_0xe61341[_0xbee5('0x8b')][_0xbee5('0x8c')]!=='agent')return;return _0xe61341['user'][_0xbee5('0x8d')]({'attributes':['id'],'raw':!![]})[_0xbee5('0x25')](function(_0x554fae){if(_['isEmpty'](_0x554fae)){_0x2284ac[_0xbee5('0x41')]('i.FaxAccountId\x20IS\x20NULL');_0x496872['where'](_0xbee5('0x8e'));}else{_0x2284ac['where'](_0xbee5('0x72'),_[_0xbee5('0x2a')](_0x554fae,'id'));_0x496872['where'](_0xbee5('0x72'),_[_0xbee5('0x2a')](_0x554fae,'id'));}});})[_0xbee5('0x25')](function(){if(_0xe61341[_0xbee5('0x8b')][_0xbee5('0x8c')]==='agent'&&!_0x501167&&!_0xe61341['query'][_0xbee5('0x71')])return[];return db['sequelize'][_0xbee5('0x36')](_0x2284ac['toString'](),_0x14d5e4);})[_0xbee5('0x25')](function(_0x387032){_0x3c8a87[_0xbee5('0x1e')]=_0x387032[_0xbee5('0x3c')];if(_0x3c8a87[_0xbee5('0x1e')]===0x0)return[];return db[_0xbee5('0x8f')][_0xbee5('0x36')](_0x138a40[_0xbee5('0x90')](),_0x14d5e4)[_0xbee5('0x25')](function(_0xcd0388){_0x4b4641=_[_0xbee5('0x91')](_0xcd0388,'id');_0x14d5e4=_[_0xbee5('0x92')](_0x14d5e4,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe61341[_0xbee5('0x36')][_0xbee5('0x3b')]){_0x33aaba[_0xbee5('0x39')][_0xbee5('0x2d')](function(_0x4ecf47){_0x496872[_0xbee5('0x44')]('i.'+_0x4ecf47);});}else{_0x496872[_0xbee5('0x44')](_0xbee5('0x85'),_0xbee5('0x5b'));_0x496872[_0xbee5('0x44')](_0xbee5('0x93'),_0xbee5('0x94'));_0x496872[_0xbee5('0x44')]('a.mandatoryDisposition',_0xbee5('0x95'));_0x496872[_0xbee5('0x44')](_0xbee5('0x96'),_0xbee5('0x97'));_0x496872[_0xbee5('0x44')](_0xbee5('0x98'));_0x496872[_0xbee5('0x44')](_0xbee5('0x99'),_0xbee5('0x9a'));_0x496872[_0xbee5('0x44')](_0xbee5('0x9b'),'Contact.lastName');_0x496872[_0xbee5('0x44')](_0xbee5('0x9c'),'Contact.email');_0x496872[_0xbee5('0x44')](_0xbee5('0x9d'),_0xbee5('0x9e'));_0x496872['field'](_0xbee5('0x9f'),_0xbee5('0xa0'));_0x496872[_0xbee5('0x44')](_0xbee5('0xa1'),_0xbee5('0xa2'));_0x496872[_0xbee5('0x44')](_0xbee5('0xa3'),_0xbee5('0xa4'));_0x496872[_0xbee5('0x44')](_0xbee5('0xa5'),_0xbee5('0xa6'));_0x496872[_0xbee5('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbee5('0x2c'));}if(_0x33aaba['limit'])_0x496872['limit'](_0x33aaba[_0xbee5('0x20')]);if(_0x33aaba[_0xbee5('0x1f')])_0x496872['offset'](_0x33aaba['offset']);return db[_0xbee5('0x8f')][_0xbee5('0x36')](_0x496872[_0xbee5('0x90')](),_0x14d5e4);})[_0xbee5('0x25')](function(_0x317712){_0x5ee32c[_0xbee5('0x41')](_0xbee5('0xa7'),_['map'](_0x317712,'id'));return db[_0xbee5('0x8f')][_0xbee5('0x36')](_0x5ee32c[_0xbee5('0x90')](),_0x14d5e4)[_0xbee5('0x25')](function(_0x595e0d){var _0x2b4752=_[_0xbee5('0xa8')](_0x595e0d,_0xbee5('0xa9'));var _0x4cade8=[];_0x317712['forEach'](function(_0x4b4c2f){_0x4cade8[_0xbee5('0x2f')](updateFaxInteraction(_0x4b4c2f,_0x4b4641,_0x2b4752));});return BPromise[_0xbee5('0xaa')](_0x4cade8);});});})[_0xbee5('0x25')](function(_0xbc2343){_0x3c8a87['rows']=_0xbc2343;return _0x3c8a87;})[_0xbee5('0x25')](respondWithFilteredResult(_0x3e854,_0x33aaba))[_0xbee5('0x30')](handleError(_0x3e854,null));};exports[_0xbee5('0xab')]=function(_0x4ec2fd,_0x7f76f6){var _0x51b28b={'raw':![],'where':{'id':_0x4ec2fd[_0xbee5('0xac')]['id']}},_0x41cae9={};_0x41cae9['model']=_['keys'](db['FaxInteraction'][_0xbee5('0xad')]);_0x41cae9['query']=_[_0xbee5('0x37')](_0x4ec2fd[_0xbee5('0x36')]);_0x41cae9['filters']=_['intersection'](_0x41cae9[_0xbee5('0x35')],_0x41cae9['query']);_0x51b28b[_0xbee5('0x39')]=_[_0xbee5('0x3a')](_0x41cae9[_0xbee5('0x35')],qs['fields'](_0x4ec2fd[_0xbee5('0x36')][_0xbee5('0x3b')]));_0x51b28b[_0xbee5('0x39')]=_0x51b28b[_0xbee5('0x39')][_0xbee5('0x3c')]?_0x51b28b[_0xbee5('0x39')]:_0x41cae9['model'];if(_0x4ec2fd['query'][_0xbee5('0xae')]){_0x51b28b['include']=[{'all':!![]}];}_0x51b28b=_['merge']({},_0x51b28b,_0x4ec2fd[_0xbee5('0xaf')]);return db[_0xbee5('0xb0')][_0xbee5('0x5a')](_0x51b28b)[_0xbee5('0x25')](handleEntityNotFound(_0x7f76f6,null))[_0xbee5('0x25')](respondWithResult(_0x7f76f6,null))[_0xbee5('0x30')](handleError(_0x7f76f6,null));};exports[_0xbee5('0xb1')]=function(_0x5cfd5e,_0x4ec289){return db['FaxInteraction']['create'](_0x5cfd5e[_0xbee5('0xb2')],{})[_0xbee5('0x25')](respondWithResult(_0x4ec289,0xc9))[_0xbee5('0x30')](handleError(_0x4ec289,null));};exports['update']=function(_0x18b240,_0x477fb4){if(_0x18b240[_0xbee5('0xb2')]['id']){delete _0x18b240['body']['id'];}return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0x18b240[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x477fb4,null))[_0xbee5('0x25')](saveUpdates(_0x18b240['body'],null))['then'](respondWithResult(_0x477fb4,null))['catch'](handleError(_0x477fb4,null));};exports['destroy']=function(_0xecfee1,_0xbc3978){return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0xecfee1[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0xbc3978,null))[_0xbee5('0x25')](removeEntity(_0xbc3978,null))[_0xbee5('0x30')](handleError(_0xbc3978,null));};exports[_0xbee5('0xb3')]=function(_0x2bc246,_0x233228){return db['FaxInteraction'][_0xbee5('0xb3')]()[_0xbee5('0x25')](respondWithResult(_0x233228,null))[_0xbee5('0x30')](handleError(_0x233228,null));};exports[_0xbee5('0xb4')]=function(_0xbae6f5,_0x40a6ce,_0x29ae4f){return db[_0xbee5('0xb5')][_0xbee5('0x5a')]({'where':{'id':_0xbae6f5[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x40a6ce,null))[_0xbee5('0x25')](function(_0x2b076b){if(_0x2b076b){return _0x2b076b[_0xbee5('0xb4')](_0xbae6f5[_0xbee5('0xb2')][_0xbee5('0xb6')],_[_0xbee5('0xb7')](_0xbae6f5['body'],[_0xbee5('0xb6'),'id'])||{});}})[_0xbee5('0x25')](respondWithResult(_0x40a6ce,null))[_0xbee5('0x30')](handleError(_0x40a6ce,null));};exports[_0xbee5('0xb8')]=function(_0x5f25c9,_0x1acb5b,_0xab45a2){var _0x4c1b42={'raw':![],'where':{}};var _0xd6f063={};var _0x13ad75={'count':0x0,'rows':[]};return db[_0xbee5('0xb0')][_0xbee5('0xb9')]({'where':{'id':_0x5f25c9['params']['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x1acb5b,null))['then'](function(_0x13661e){if(_0x13661e){_0xd6f063[_0xbee5('0x35')]=_['keys'](db[_0xbee5('0xb5')][_0xbee5('0xad')]);_0xd6f063[_0xbee5('0x36')]=_['keys'](_0x5f25c9[_0xbee5('0x36')]);_0xd6f063['filters']=_[_0xbee5('0x3a')](_0xd6f063[_0xbee5('0x35')],_0xd6f063[_0xbee5('0x36')]);_0x4c1b42['attributes']=_['intersection'](_0xd6f063[_0xbee5('0x35')],qs['fields'](_0x5f25c9[_0xbee5('0x36')]['fields']));_0x4c1b42[_0xbee5('0x39')]=_0x4c1b42[_0xbee5('0x39')][_0xbee5('0x3c')]?_0x4c1b42[_0xbee5('0x39')]:_0xd6f063[_0xbee5('0x35')];if(!_0x5f25c9['query'][_0xbee5('0x3d')](_0xbee5('0x3e'))){_0x4c1b42['limit']=qs['limit'](_0x5f25c9[_0xbee5('0x36')][_0xbee5('0x20')]);_0x4c1b42[_0xbee5('0x1f')]=qs['offset'](_0x5f25c9['query'][_0xbee5('0x1f')]);}_0x4c1b42['order']=qs[_0xbee5('0x40')](_0x5f25c9[_0xbee5('0x36')][_0xbee5('0x40')]);_0x4c1b42['where']=qs[_0xbee5('0x38')](_[_0xbee5('0x42')](_0x5f25c9[_0xbee5('0x36')],_0xd6f063['filters']));_0x4c1b42[_0xbee5('0x41')][_0xbee5('0xa9')]=_0x13661e['id'];if(_0x5f25c9['query']['filter']){_0x4c1b42['where']=_['merge'](_0x4c1b42[_0xbee5('0x41')],{'$or':_[_0xbee5('0x2a')](_0x4c1b42[_0xbee5('0x39')],function(_0x37deb0){var _0x3cb059={};_0x3cb059[_0x37deb0]={'$like':'%'+_0x5f25c9['query'][_0xbee5('0x7d')]+'%'};return _0x3cb059;})});}if(_0x5f25c9[_0xbee5('0x36')]['$gte']){var _0x368ede=_0x5f25c9[_0xbee5('0x36')]['$gte'][_0xbee5('0x63')](',');var _0x291a94={};_0x291a94[_0x368ede[0x0]]={'$gte':moment(_0x368ede[0x1])['format'](_0xbee5('0xba'))};_0x4c1b42[_0xbee5('0x41')]=_['merge'](_0x4c1b42[_0xbee5('0x41')],_0x291a94);}_0x4c1b42=_[_0xbee5('0x92')]({},_0x4c1b42,_0x5f25c9['options']);return db['FaxMessage'][_0xbee5('0x1e')]({'where':_0x4c1b42[_0xbee5('0x41')]})[_0xbee5('0x25')](function(_0xd61f78){_0x13ad75[_0xbee5('0x1e')]=_0xd61f78;if(_0x5f25c9['query'][_0xbee5('0xae')]){_0x4c1b42[_0xbee5('0xbb')]=[{'all':!![]}];}return db[_0xbee5('0xb5')][_0xbee5('0xbc')](_0x4c1b42);})[_0xbee5('0x25')](function(_0x2c64ed){_0x13ad75['rows']=_0x2c64ed;return _0x13ad75;});}})[_0xbee5('0x25')](respondWithFilteredResult(_0x1acb5b,_0x4c1b42))[_0xbee5('0x30')](handleError(_0x1acb5b,null));};exports[_0xbee5('0xbd')]=function(_0x33761d,_0x51d980,_0x214b20){return db[_0xbee5('0xb0')]['find']({'where':{'id':_0x33761d['params']['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x51d980,null))['then'](function(_0x5be1ca){if(_0x5be1ca){return _0x5be1ca[_0xbee5('0xbe')](_0x33761d['body'][_0xbee5('0xb6')],_[_0xbee5('0xb7')](_0x33761d[_0xbee5('0xb2')],[_0xbee5('0xb6'),'id'])||{})[_0xbee5('0xbf')](function(){return db[_0xbee5('0x67')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x33761d[_0xbee5('0xb2')][_0xbee5('0xb6')]}});})[_0xbee5('0x25')](function(_0x304444){socket['emit'](_0xbee5('0xc0'),{'id':Number(_0x33761d[_0xbee5('0xac')]['id']),'tags':_0x304444||[]});return{'id':Number(_0x33761d[_0xbee5('0xac')]['id']),'tags':_0x304444||[]};});}})[_0xbee5('0x25')](respondWithResult(_0x51d980,null))['catch'](handleError(_0x51d980,null));};exports[_0xbee5('0xc1')]=function(_0xfb815b,_0x39e261,_0x5e0e8a){return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0xfb815b[_0xbee5('0xac')]['id']}})[_0xbee5('0x25')](handleEntityNotFound(_0x39e261,null))[_0xbee5('0x25')](function(_0x187f08){if(_0x187f08){return _0x187f08[_0xbee5('0xc1')](_0xfb815b[_0xbee5('0x36')][_0xbee5('0xb6')]);}})['then'](respondWithStatusCode(_0x39e261,null))['catch'](handleError(_0x39e261,null));};exports[_0xbee5('0xc2')]=function(_0x4f7522,_0x5b3427){var _0x4e8450=moment()[_0xbee5('0xc3')]()[_0xbee5('0x90')]();var _0x15f65b=path['join'](config[_0xbee5('0xc4')],'server',_0xbee5('0xc5'),_0xbee5('0xc6'));var _0x492b1a=path[_0xbee5('0xc7')](config[_0xbee5('0xc4')],'server','files',_0xbee5('0xc8'));var _0x329131=path['join'](_0x15f65b,_0x4e8450);var _0x58ed4d=util[_0xbee5('0xc9')](_0xbee5('0xca'),_0x4f7522[_0xbee5('0xac')]['id'],_0x4e8450);var _0x4cb4be=path['join'](_0x15f65b,_0x58ed4d);var _0x2f306a=[];_0x2f306a[_0xbee5('0x2f')]({'model':db['Attachment'],'as':_0xbee5('0xcb'),'raw':!![]});var _0x4f2b78=[{'model':db['FaxMessage'],'as':_0xbee5('0xcc'),'attributes':['id','body',_0xbee5('0xcd')],'include':_0x2f306a}];return db[_0xbee5('0xb0')][_0xbee5('0x5a')]({'where':{'id':_0x4f7522['params']['id']},'include':_0x4f2b78})['then'](handleEntityNotFound(_0x5b3427,null))[_0xbee5('0x25')](function(_0x36a752){if(_0x36a752&&_0x36a752[_0xbee5('0xcc')]){var _0x112b11=_0x36a752[_0xbee5('0xce')]({'plain':!![]});fs[_0xbee5('0xcf')](_0x329131);for(var _0xded122=0x0;_0xded122<_0x112b11[_0xbee5('0xcc')][_0xbee5('0x3c')];_0xded122++){var _0x41a7c0=_0x112b11[_0xbee5('0xcc')][_0xded122][_0xbee5('0xcb')];if(_0x41a7c0){var _0x4c9c43=path[_0xbee5('0xc7')](_0x492b1a,_0x41a7c0[_0xbee5('0xd0')]);if(fs[_0xbee5('0xd1')](_0x4c9c43)){fs['createReadStream'](_0x4c9c43)['pipe'](fs[_0xbee5('0xd2')](path[_0xbee5('0xc7')](_0x329131,_0x41a7c0[_0xbee5('0xd0')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x4d0e6b,_0x186688){zipdir(_0x329131,{'saveTo':_0x4cb4be},function(_0x2616c3,_0x20dbd7){if(_0x2616c3)return _0x186688(_0x2616c3);return _0x4d0e6b(_0x20dbd7);});})[_0xbee5('0x25')](function(){return new BPromise(function(_0x242ff7,_0x487059){rimraf(_0x329131,function(_0x1fb664){if(_0x1fb664)_0x487059(_0x1fb664);return _0x242ff7();});});})['then'](function(){return _0x5b3427[_0xbee5('0xc2')](_0x4cb4be,_0x58ed4d,function(_0x4be85b){if(_0x4be85b){console[_0xbee5('0xd3')](_0xbee5('0xd4'),_0x4be85b);}else{fs[_0xbee5('0xd5')](_0x4cb4be);}});});});}else{return _0x5b3427['sendStatus'](0xc8);}})[_0xbee5('0x30')](handleError(_0x5b3427,null));}; \ No newline at end of file +var _0xbec5=['Tag','emit','removeTags','download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','pipe','basename','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','FaxInteraction','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','select','field','color','from','user_has_fax_interactions','left_join','users','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','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','keys','some','compact','isEmpty','FaxAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','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','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','groupBy','all','show','params','rawAttributes','includeAll','include','options','create','describe','ids','omit','getMessages','FaxMessage','sort','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread'];(function(_0xe0b487,_0x14eb09){var _0x250b7a=function(_0x1f0c14){while(--_0x1f0c14){_0xe0b487['push'](_0xe0b487['shift']());}};_0x250b7a(++_0x14eb09);}(_0xbec5,0xe5));var _0x5bec=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xbec5[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0x5bec('0x0'));var emlformat=require(_0x5bec('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bec('0x2'));var jsonpatch=require(_0x5bec('0x3'));var rp=require(_0x5bec('0x4'));var moment=require(_0x5bec('0x5'));var BPromise=require(_0x5bec('0x6'));var Mustache=require('mustache');var util=require(_0x5bec('0x7'));var path=require(_0x5bec('0x8'));var sox=require(_0x5bec('0x9'));var csv=require('to-csv');var ejs=require(_0x5bec('0xa'));var fs=require('fs');var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x10'));var querystring=require(_0x5bec('0x11'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x13'));var as=require(_0x5bec('0x14'));var hardwareService=require(_0x5bec('0x15'));var logger=require('../../config/logger')(_0x5bec('0x16'));var utils=require(_0x5bec('0x17'));var config=require(_0x5bec('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x19'))['db'];config[_0x5bec('0x1a')]=_['defaults'](config[_0x5bec('0x1a')],{'host':_0x5bec('0x1b'),'port':0x18eb});var socket=require(_0x5bec('0x1c'))(new Redis(config[_0x5bec('0x1a')]));require(_0x5bec('0x1d'))[_0x5bec('0x1e')](socket);function respondWithStatusCode(_0x24dcd6,_0x43fd2a){_0x43fd2a=_0x43fd2a||0xcc;return function(_0x259588){if(_0x259588){return _0x24dcd6[_0x5bec('0x1f')](_0x43fd2a);}return _0x24dcd6[_0x5bec('0x20')](_0x43fd2a)[_0x5bec('0x21')]();};}function respondWithResult(_0x11fb8e,_0x506639){_0x506639=_0x506639||0xc8;return function(_0x4ab821){if(_0x4ab821){return _0x11fb8e[_0x5bec('0x20')](_0x506639)[_0x5bec('0x22')](_0x4ab821);}};}function respondWithFilteredResult(_0x31ad9c,_0x1771e7){return function(_0x5cd7ae){if(_0x5cd7ae){var _0x5295f0=_0x5cd7ae[_0x5bec('0x23')],_0x3cd354=_0x1771e7[_0x5bec('0x24')],_0x6c0d35=_0x1771e7[_0x5bec('0x24')]+_0x1771e7[_0x5bec('0x25')],_0x4e0191;if(_0x6c0d35>=_0x5295f0){_0x6c0d35=_0x5295f0;_0x4e0191=0xc8;}else{_0x4e0191=0xce;}_0x31ad9c['status'](_0x4e0191);return _0x31ad9c[_0x5bec('0x26')]('Content-Range',_0x3cd354+'-'+_0x6c0d35+'/'+_0x5295f0)[_0x5bec('0x22')](_0x5cd7ae);}return null;};}function patchUpdates(_0x208d99){return function(_0x3e1896){try{jsonpatch[_0x5bec('0x27')](_0x3e1896,_0x208d99,!![]);}catch(_0xfed23){return BPromise['reject'](_0xfed23);}return _0x3e1896[_0x5bec('0x28')]();};}function saveUpdates(_0x4cfcb8,_0x2b2d26){return function(_0x3ddb88){if(_0x3ddb88){return _0x3ddb88['update'](_0x4cfcb8)[_0x5bec('0x29')](function(_0xbef70b){return _0xbef70b;});}return null;};}function removeEntity(_0x4e0ca2,_0x45afb7){return function(_0x218c13){if(_0x218c13){return _0x218c13[_0x5bec('0x2a')]()[_0x5bec('0x29')](function(){_0x4e0ca2[_0x5bec('0x20')](0xcc)[_0x5bec('0x21')]();});}};}function handleEntityNotFound(_0x2dc014,_0x4de66a){return function(_0x5b63ab){if(!_0x5b63ab){_0x2dc014['sendStatus'](0x194);}return _0x5b63ab;};}function handleError(_0x2961bd,_0x2cdd2f){_0x2cdd2f=_0x2cdd2f||0x1f4;return function(_0x338c25){logger['error'](_0x338c25[_0x5bec('0x2b')]);if(_0x338c25[_0x5bec('0x2c')]){delete _0x338c25['name'];}_0x2961bd[_0x5bec('0x20')](_0x2cdd2f)[_0x5bec('0x2d')](_0x338c25);};}function getInteractionUsers(_0x51dc1e,_0x5336b3){return new BPromise(function(_0x3575e7,_0x2a82d5){try{if(_0x5336b3[_0x51dc1e['id']]){_0x51dc1e[_0x5bec('0x2e')]=_[_0x5bec('0x2f')](_0x5336b3[_0x51dc1e['id']],function(_0x12862c){return{'id':_0x12862c['id'],'fullname':_0x12862c[_0x5bec('0x30')]};});}}catch(_0x5d6621){_0x2a82d5(_0x5d6621);}_0x3575e7(_0x51dc1e);});}function getInteractionTags(_0x2987ca,_0x59b5b6){return new BPromise(function(_0x45863b,_0xafbd94){try{if(_0x2987ca[_0x5bec('0x31')]){_0x2987ca[_0x5bec('0x32')]=[];_0x2987ca['TagIds'][_0x5bec('0x33')](',')[_0x5bec('0x34')](function(_0xfc7d41){_0x2987ca['Tags'][_0x5bec('0x35')](_0x59b5b6[_0xfc7d41]);});}delete _0x2987ca['TagIds'];}catch(_0x14cdbf){_0xafbd94(_0x14cdbf);}_0x45863b(_0x2987ca);});}function updateFaxInteraction(_0x207192,_0x29df14,_0x551ec0){return new BPromise(function(_0xdc831e,_0x420ad4){return getInteractionUsers(_0x207192,_0x551ec0)['then'](function(_0x34b441){return getInteractionTags(_0x34b441,_0x29df14);})[_0x5bec('0x29')](function(_0x24aa2f){_0xdc831e(_0x24aa2f);})[_0x5bec('0x36')](function(_0x1c85a){_0x420ad4(_0x1c85a);});});}exports['index']=function(_0x7ebd9c,_0x583b96){var _0x2d3793={},_0x384f04={},_0x182b86={'count':0x0,'rows':[]};var _0x7598ab=_[_0x5bec('0x2f')](db[_0x5bec('0x37')]['rawAttributes'],function(_0x1c6cc3){return{'name':_0x1c6cc3[_0x5bec('0x38')],'type':_0x1c6cc3[_0x5bec('0x39')]['key']};});_0x384f04[_0x5bec('0x3a')]=_[_0x5bec('0x2f')](_0x7598ab,'name');_0x384f04[_0x5bec('0x3b')]=_['keys'](_0x7ebd9c[_0x5bec('0x3b')]);_0x384f04[_0x5bec('0x3c')]=_[_0x5bec('0x3d')](_0x384f04['model'],_0x384f04[_0x5bec('0x3b')]);_0x2d3793[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x384f04[_0x5bec('0x3a')],qs[_0x5bec('0x3f')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x3f')]));_0x2d3793['attributes']=_0x2d3793[_0x5bec('0x3e')][_0x5bec('0x40')]?_0x2d3793[_0x5bec('0x3e')]:_0x384f04[_0x5bec('0x3a')];if(!_0x7ebd9c['query'][_0x5bec('0x41')](_0x5bec('0x42'))){_0x2d3793[_0x5bec('0x25')]=qs['limit'](_0x7ebd9c['query'][_0x5bec('0x25')]);_0x2d3793[_0x5bec('0x24')]=qs[_0x5bec('0x24')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x24')]);}_0x2d3793['order']=qs['sort'](_0x7ebd9c[_0x5bec('0x3b')]['sort']);_0x2d3793[_0x5bec('0x43')]=qs[_0x5bec('0x3c')](_[_0x5bec('0x44')](_0x7ebd9c['query'],_0x384f04[_0x5bec('0x3c')]),_0x7598ab);var _0x26a4a5=[];var _0x4fbbd4=squel[_0x5bec('0x45')]()[_0x5bec('0x46')]('id')[_0x5bec('0x46')](_0x5bec('0x2c'))[_0x5bec('0x46')](_0x5bec('0x47'))[_0x5bec('0x48')]('tools_tags');var _0x59e5d0=squel[_0x5bec('0x45')]()['field']('u.id')[_0x5bec('0x46')]('u.fullname')['field']('ui.FaxInteractionId')[_0x5bec('0x48')](_0x5bec('0x49'),'ui')[_0x5bec('0x4a')](_0x5bec('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x387ad9=squel[_0x5bec('0x45')]()[_0x5bec('0x48')](_0x5bec('0x4c'),'i')['left_join'](_0x5bec('0x4d'),'c',_0x5bec('0x4e'))[_0x5bec('0x4a')]('users','o',_0x5bec('0x4f'))['left_join'](_0x5bec('0x50'),'a',_0x5bec('0x51'))[_0x5bec('0x4a')](_0x5bec('0x52'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x5bec('0x4a')](_0x5bec('0x53'),'it',_0x5bec('0x54'))[_0x5bec('0x4a')](_0x5bec('0x55'),'t',_0x5bec('0x56'));var _0x807808=squel['expr']();var _0x2f9f17=[];var _0x35d8b7=squel['expr']();var _0x273e09;if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x57')]){_0x273e09=as[_0x5bec('0x58')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x57')]);var _0x3545a5=_0x273e09['sqlOperator'];for(var _0x101dcb=0x0;_0x101dcb<_0x273e09['conditions'][_0x5bec('0x40')];_0x101dcb++){var _0x208c7b=_0x273e09[_0x5bec('0x59')][_0x101dcb];var _0x2c75e0='i';var _0x158e8e=_[_0x5bec('0x5a')](_0x7598ab,[_0x5bec('0x2c'),_0x208c7b[_0x5bec('0x46')]]);if(!_0x158e8e){switch(_0x208c7b[_0x5bec('0x46')]){case _0x5bec('0x5b'):if(_0x208c7b['value']==0x1){_0x387ad9[_0x5bec('0x5c')]('`'+_0x208c7b['field']+'`\x20=\x200');}else{_0x387ad9[_0x5bec('0x5c')]('`'+_0x208c7b['field']+'`\x20>\x200');}break;case _0x5bec('0x5d'):if(_0x208c7b[_0x5bec('0x5e')]===_0x5bec('0x5f')){if(_0x208c7b['value'][_0x5bec('0x33')]('\x20')[_0x5bec('0x40')]>0x1){_0x807808[_0x3545a5](_0x5bec('0x60'),qs[_0x5bec('0x61')](_0x208c7b['value']),null);}else{var _0x456575='%'+_0x208c7b[_0x5bec('0x62')]+'%';_0x807808[_0x3545a5](_0x5bec('0x63'),_0x456575,_0x456575,_0x456575);}}else{_0x158e8e=_[_0x5bec('0x5a')](_0x7598ab,[_0x5bec('0x2c'),_0x5bec('0x64')]);_0x208c7b[_0x5bec('0x46')]='ContactId';_0x38deb0=as['buildExpression'](_0x2c75e0,_0x158e8e[_0x5bec('0x39')],_0x208c7b);_0x807808[_0x3545a5](_0x38deb0['text'],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x65')],_0x38deb0['value'][_0x5bec('0x21')]);}break;case'Tag':var _0x2e2423=_0x208c7b[_0x5bec('0x62')][_0x5bec('0x33')](',')[_0x5bec('0x2f')](function(_0x2fb334){return Number(_0x2fb334);});_0x2e2423[_0x5bec('0x34')](function(_0x2e4293){_0x35d8b7['or'](_0x5bec('0x66'),'%,'+_0x2e4293+',%');});_0x2f9f17=_[_0x5bec('0x67')](_0x2f9f17,_0x2e2423);break;case _0x5bec('0x68'):if(_0x208c7b[_0x5bec('0x5e')]===_0x5bec('0x5f')){_0x807808[_0x3545a5](_0x5bec('0x69'),'%'+_0x208c7b[_0x5bec('0x62')]+'%',null);}else{_0x158e8e=_['find'](_0x7598ab,[_0x5bec('0x2c'),_0x5bec('0x6a')]);_0x208c7b[_0x5bec('0x46')]='UserId';_0x38deb0=as[_0x5bec('0x6b')](_0x2c75e0,_0x158e8e[_0x5bec('0x39')],_0x208c7b);_0x807808[_0x3545a5](_0x38deb0[_0x5bec('0x6c')],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x65')],_0x38deb0['value'][_0x5bec('0x21')]);}break;case _0x5bec('0x6d'):_0x38deb0=as[_0x5bec('0x6b')]('me',null,_0x208c7b);_0x807808[_0x3545a5](_0x38deb0[_0x5bec('0x6c')],_0x38deb0['value'][_0x5bec('0x65')],_0x38deb0['value'][_0x5bec('0x21')]);break;}}else{var _0x38deb0=as[_0x5bec('0x6b')](_0x2c75e0,_0x158e8e[_0x5bec('0x39')],_0x208c7b);_0x807808[_0x3545a5](_0x38deb0['text'],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x65')],_0x38deb0[_0x5bec('0x62')][_0x5bec('0x21')]);}}}else{var _0xc3e3df=_(_0x7ebd9c[_0x5bec('0x3b')])[_0x5bec('0x6e')]()[_0x5bec('0x2f')](function(_0x407828){return _[_0x5bec('0x6f')](_0x7598ab,[_0x5bec('0x2c'),_0x407828])?_0x407828:undefined;})[_0x5bec('0x70')]()[_0x5bec('0x62')]();if(!_[_0x5bec('0x71')](_0xc3e3df)){_0xc3e3df[_0x5bec('0x34')](function(_0x490d4b){if(_0x490d4b===_0x5bec('0x72')){_0x387ad9[_0x5bec('0x43')]('i.FaxAccountId\x20IN\x20?',[][_0x5bec('0x73')](_0x7ebd9c['query'][_0x490d4b]));}else if(_0x490d4b===_0x5bec('0x74')){var _0x1061d3=JSON['parse'](_0x7ebd9c['query'][_0x490d4b])[_0x5bec('0x75')];var _0xcac51d=JSON[_0x5bec('0x76')](_0x7ebd9c[_0x5bec('0x3b')][_0x490d4b])[_0x5bec('0x77')];_0x387ad9['where'](_0x5bec('0x78'),_0x1061d3,_0xcac51d);}else{if(_0x7ebd9c[_0x5bec('0x3b')][_0x490d4b]==='null'){_0x387ad9[_0x5bec('0x43')]('i.'+_0x490d4b+_0x5bec('0x79'));}else{_0x387ad9[_0x5bec('0x43')]('i.'+_0x490d4b+_0x5bec('0x7a'),_0x7ebd9c['query'][_0x490d4b]);}}});}if(_0x7ebd9c[_0x5bec('0x3b')]['read']){if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7b')]==0x1){_0x387ad9[_0x5bec('0x5c')](_0x5bec('0x7c'));}else{_0x387ad9[_0x5bec('0x5c')](_0x5bec('0x7d'));}}if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7e')]){_0x2f9f17=_[_0x5bec('0x7f')](_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7e')])?_0x7ebd9c['query']['tag']:new Array(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x7e')]);_0x2f9f17[_0x5bec('0x34')](function(_0x41bf69){_0x35d8b7['or'](_0x5bec('0x66'),'%,'+_0x41bf69+',%');});}if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x80')]){var _0x52f358=_0x7ebd9c['query'][_0x5bec('0x80')][_0x5bec('0x81')]('\x5c','\x5c\x5c')[_0x5bec('0x81')](/'/g,'\x27\x27');if(qs[_0x5bec('0x82')](_0x52f358)){_0x807808['or'](_0x5bec('0x83'),_0x52f358+'%')['or'](_0x5bec('0x84'),_0x52f358+'%');}_0x807808['or'](_0x5bec('0x85'),_0x52f358+'%');}}_0x387ad9[_0x5bec('0x43')](_0x807808);_0x387ad9[_0x5bec('0x86')](_0x5bec('0x87'));var _0x10550a={'type':db[_0x5bec('0x88')][_0x5bec('0x89')][_0x5bec('0x8a')],'raw':!![]};var _0x282c3b=_0x387ad9[_0x5bec('0x8b')]();_0x282c3b[_0x5bec('0x46')](_0x5bec('0x87'));_0x282c3b[_0x5bec('0x46')](_0x5bec('0x8c'),'unreadMessages');if(_0x2d3793[_0x5bec('0x8d')]){_0x2d3793['order']['forEach'](function(_0x432441){var _0x5c2306=_0x432441[0x0]===_0x5bec('0x8e')?_0x432441[0x0]:'i.'+_0x432441[0x0];_0x387ad9['order'](_0x5c2306,_0x432441[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5bec('0x71')](_0x2f9f17)){_0x387ad9[_0x5bec('0x5c')](_0x35d8b7);_0x282c3b['where'](_0x5bec('0x8f'),_0x2f9f17);}BPromise[_0x5bec('0x90')]()[_0x5bec('0x29')](function(){if(!_0x273e09){if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x72')]||_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x91')])return;_0x282c3b[_0x5bec('0x43')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x387ad9['where'](_0x5bec('0x92'));return;}if(_0x7ebd9c[_0x5bec('0x93')][_0x5bec('0x94')]!==_0x5bec('0x95'))return;return _0x7ebd9c['user'][_0x5bec('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x44ceec){if(_[_0x5bec('0x71')](_0x44ceec)){_0x282c3b[_0x5bec('0x43')](_0x5bec('0x97'));_0x387ad9[_0x5bec('0x43')](_0x5bec('0x97'));}else{_0x282c3b[_0x5bec('0x43')](_0x5bec('0x98'),_['map'](_0x44ceec,'id'));_0x387ad9[_0x5bec('0x43')](_0x5bec('0x98'),_[_0x5bec('0x2f')](_0x44ceec,'id'));}});})[_0x5bec('0x29')](function(){if(_0x7ebd9c[_0x5bec('0x93')]['role']===_0x5bec('0x95')&&!_0x273e09&&!_0x7ebd9c[_0x5bec('0x3b')]['FaxAccountId'])return[];return db[_0x5bec('0x99')]['query'](_0x282c3b[_0x5bec('0x9a')](),_0x10550a);})[_0x5bec('0x29')](function(_0x4646a3){_0x182b86[_0x5bec('0x23')]=_0x4646a3[_0x5bec('0x40')];if(_0x182b86[_0x5bec('0x23')]===0x0)return[];return db[_0x5bec('0x99')][_0x5bec('0x3b')](_0x4fbbd4[_0x5bec('0x9a')](),_0x10550a)[_0x5bec('0x29')](function(_0x1c44f5){_0x26a4a5=_[_0x5bec('0x9b')](_0x1c44f5,'id');_0x10550a=_[_0x5bec('0x9c')](_0x10550a,{'model':db[_0x5bec('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7ebd9c[_0x5bec('0x3b')][_0x5bec('0x3f')]){_0x2d3793[_0x5bec('0x3e')][_0x5bec('0x34')](function(_0x4db497){_0x387ad9[_0x5bec('0x46')]('i.'+_0x4db497);});}else{_0x387ad9['field'](_0x5bec('0x8c'),_0x5bec('0x5b'));_0x387ad9['field']('a.key',_0x5bec('0x9d'));_0x387ad9['field'](_0x5bec('0x9e'),'Account.mandatoryDisposition');_0x387ad9[_0x5bec('0x46')](_0x5bec('0x9f'),'contactName');_0x387ad9[_0x5bec('0x46')]('i.*');_0x387ad9[_0x5bec('0x46')]('c.firstName',_0x5bec('0xa0'));_0x387ad9[_0x5bec('0x46')]('c.lastName',_0x5bec('0xa1'));_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa2'),_0x5bec('0xa3'));_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa4'),'Contact.phone');_0x387ad9[_0x5bec('0x46')]('c.mobile',_0x5bec('0xa5'));_0x387ad9['field']('c.fax',_0x5bec('0xa6'));_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa7'),'Owner.fullname');_0x387ad9[_0x5bec('0x46')](_0x5bec('0xa8'),_0x5bec('0xa9'));_0x387ad9[_0x5bec('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5bec('0x31'));}if(_0x2d3793[_0x5bec('0x25')])_0x387ad9[_0x5bec('0x25')](_0x2d3793[_0x5bec('0x25')]);if(_0x2d3793['offset'])_0x387ad9[_0x5bec('0x24')](_0x2d3793[_0x5bec('0x24')]);return db[_0x5bec('0x99')][_0x5bec('0x3b')](_0x387ad9[_0x5bec('0x9a')](),_0x10550a);})[_0x5bec('0x29')](function(_0x13fbfc){_0x59e5d0[_0x5bec('0x43')]('ui.FaxInteractionId\x20IN\x20?',_[_0x5bec('0x2f')](_0x13fbfc,'id'));return db[_0x5bec('0x99')][_0x5bec('0x3b')](_0x59e5d0[_0x5bec('0x9a')](),_0x10550a)[_0x5bec('0x29')](function(_0x48f844){var _0x8af8a2=_[_0x5bec('0xaa')](_0x48f844,'FaxInteractionId');var _0x18f07a=[];_0x13fbfc['forEach'](function(_0x1ed963){_0x18f07a[_0x5bec('0x35')](updateFaxInteraction(_0x1ed963,_0x26a4a5,_0x8af8a2));});return BPromise[_0x5bec('0xab')](_0x18f07a);});});})[_0x5bec('0x29')](function(_0x3cf417){_0x182b86['rows']=_0x3cf417;return _0x182b86;})[_0x5bec('0x29')](respondWithFilteredResult(_0x583b96,_0x2d3793))[_0x5bec('0x36')](handleError(_0x583b96,null));};exports[_0x5bec('0xac')]=function(_0x98b146,_0x652c3a){var _0x3287d6={'raw':![],'where':{'id':_0x98b146[_0x5bec('0xad')]['id']}},_0x377489={};_0x377489[_0x5bec('0x3a')]=_['keys'](db[_0x5bec('0x37')][_0x5bec('0xae')]);_0x377489[_0x5bec('0x3b')]=_['keys'](_0x98b146['query']);_0x377489[_0x5bec('0x3c')]=_[_0x5bec('0x3d')](_0x377489['model'],_0x377489[_0x5bec('0x3b')]);_0x3287d6['attributes']=_[_0x5bec('0x3d')](_0x377489['model'],qs[_0x5bec('0x3f')](_0x98b146['query'][_0x5bec('0x3f')]));_0x3287d6['attributes']=_0x3287d6[_0x5bec('0x3e')]['length']?_0x3287d6[_0x5bec('0x3e')]:_0x377489[_0x5bec('0x3a')];if(_0x98b146['query'][_0x5bec('0xaf')]){_0x3287d6[_0x5bec('0xb0')]=[{'all':!![]}];}_0x3287d6=_['merge']({},_0x3287d6,_0x98b146[_0x5bec('0xb1')]);return db[_0x5bec('0x37')][_0x5bec('0x5a')](_0x3287d6)[_0x5bec('0x29')](handleEntityNotFound(_0x652c3a,null))[_0x5bec('0x29')](respondWithResult(_0x652c3a,null))[_0x5bec('0x36')](handleError(_0x652c3a,null));};exports[_0x5bec('0xb2')]=function(_0x1c9f75,_0x1a6266){return db['FaxInteraction']['create'](_0x1c9f75['body'],{})['then'](respondWithResult(_0x1a6266,0xc9))[_0x5bec('0x36')](handleError(_0x1a6266,null));};exports['update']=function(_0x21e58e,_0x54632b){if(_0x21e58e[_0x5bec('0x6d')]['id']){delete _0x21e58e[_0x5bec('0x6d')]['id'];}return db[_0x5bec('0x37')]['find']({'where':{'id':_0x21e58e[_0x5bec('0xad')]['id']}})['then'](handleEntityNotFound(_0x54632b,null))[_0x5bec('0x29')](saveUpdates(_0x21e58e[_0x5bec('0x6d')],null))[_0x5bec('0x29')](respondWithResult(_0x54632b,null))[_0x5bec('0x36')](handleError(_0x54632b,null));};exports[_0x5bec('0x2a')]=function(_0x2ffee8,_0x18fec4){return db['FaxInteraction'][_0x5bec('0x5a')]({'where':{'id':_0x2ffee8[_0x5bec('0xad')]['id']}})[_0x5bec('0x29')](handleEntityNotFound(_0x18fec4,null))[_0x5bec('0x29')](removeEntity(_0x18fec4,null))['catch'](handleError(_0x18fec4,null));};exports[_0x5bec('0xb3')]=function(_0x91b3eb,_0x2015ec){return db[_0x5bec('0x37')][_0x5bec('0xb3')]()['then'](respondWithResult(_0x2015ec,null))['catch'](handleError(_0x2015ec,null));};exports['addMessage']=function(_0x56f13f,_0x5eb127,_0xd8e688){return db['FaxMessage'][_0x5bec('0x5a')]({'where':{'id':_0x56f13f[_0x5bec('0xad')]['id']}})['then'](handleEntityNotFound(_0x5eb127,null))[_0x5bec('0x29')](function(_0x30c84c){if(_0x30c84c){return _0x30c84c['addMessage'](_0x56f13f[_0x5bec('0x6d')][_0x5bec('0xb4')],_[_0x5bec('0xb5')](_0x56f13f[_0x5bec('0x6d')],[_0x5bec('0xb4'),'id'])||{});}})[_0x5bec('0x29')](respondWithResult(_0x5eb127,null))[_0x5bec('0x36')](handleError(_0x5eb127,null));};exports[_0x5bec('0xb6')]=function(_0x54e6d0,_0x18fb4b,_0x2e94c0){var _0x3ae6b5={'raw':![],'where':{}};var _0x2ddae7={};var _0x17708f={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x54e6d0[_0x5bec('0xad')]['id']}})[_0x5bec('0x29')](handleEntityNotFound(_0x18fb4b,null))[_0x5bec('0x29')](function(_0x9d4c85){if(_0x9d4c85){_0x2ddae7[_0x5bec('0x3a')]=_['keys'](db[_0x5bec('0xb7')][_0x5bec('0xae')]);_0x2ddae7['query']=_[_0x5bec('0x6e')](_0x54e6d0[_0x5bec('0x3b')]);_0x2ddae7['filters']=_[_0x5bec('0x3d')](_0x2ddae7[_0x5bec('0x3a')],_0x2ddae7[_0x5bec('0x3b')]);_0x3ae6b5[_0x5bec('0x3e')]=_[_0x5bec('0x3d')](_0x2ddae7['model'],qs['fields'](_0x54e6d0['query']['fields']));_0x3ae6b5[_0x5bec('0x3e')]=_0x3ae6b5[_0x5bec('0x3e')][_0x5bec('0x40')]?_0x3ae6b5[_0x5bec('0x3e')]:_0x2ddae7[_0x5bec('0x3a')];if(!_0x54e6d0[_0x5bec('0x3b')]['hasOwnProperty']('nolimit')){_0x3ae6b5[_0x5bec('0x25')]=qs[_0x5bec('0x25')](_0x54e6d0['query']['limit']);_0x3ae6b5[_0x5bec('0x24')]=qs[_0x5bec('0x24')](_0x54e6d0['query'][_0x5bec('0x24')]);}_0x3ae6b5[_0x5bec('0x8d')]=qs[_0x5bec('0xb8')](_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0xb8')]);_0x3ae6b5[_0x5bec('0x43')]=qs[_0x5bec('0x3c')](_['pick'](_0x54e6d0[_0x5bec('0x3b')],_0x2ddae7['filters']));_0x3ae6b5['where'][_0x5bec('0xb9')]=_0x9d4c85['id'];if(_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0x80')]){_0x3ae6b5['where']=_['merge'](_0x3ae6b5[_0x5bec('0x43')],{'$or':_[_0x5bec('0x2f')](_0x3ae6b5[_0x5bec('0x3e')],function(_0x41b927){var _0x1cfe3c={};_0x1cfe3c[_0x41b927]={'$like':'%'+_0x54e6d0['query'][_0x5bec('0x80')]+'%'};return _0x1cfe3c;})});}if(_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0x75')]){var _0x56553c=_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0x75')]['split'](',');var _0x11f03e={};_0x11f03e[_0x56553c[0x0]]={'$gte':moment(_0x56553c[0x1])[_0x5bec('0xba')](_0x5bec('0xbb'))};_0x3ae6b5[_0x5bec('0x43')]=_[_0x5bec('0x9c')](_0x3ae6b5[_0x5bec('0x43')],_0x11f03e);}_0x3ae6b5=_[_0x5bec('0x9c')]({},_0x3ae6b5,_0x54e6d0[_0x5bec('0xb1')]);return db[_0x5bec('0xb7')][_0x5bec('0x23')]({'where':_0x3ae6b5['where']})[_0x5bec('0x29')](function(_0x3420e6){_0x17708f[_0x5bec('0x23')]=_0x3420e6;if(_0x54e6d0[_0x5bec('0x3b')][_0x5bec('0xaf')]){_0x3ae6b5['include']=[{'all':!![]}];}return db[_0x5bec('0xb7')][_0x5bec('0xbc')](_0x3ae6b5);})['then'](function(_0x1a2622){_0x17708f[_0x5bec('0xbd')]=_0x1a2622;return _0x17708f;});}})['then'](respondWithFilteredResult(_0x18fb4b,_0x3ae6b5))[_0x5bec('0x36')](handleError(_0x18fb4b,null));};exports[_0x5bec('0xbe')]=function(_0x2b6322,_0x596033,_0x445db9){return db[_0x5bec('0x37')][_0x5bec('0x5a')]({'where':{'id':_0x2b6322[_0x5bec('0xad')]['id']}})['then'](handleEntityNotFound(_0x596033,null))[_0x5bec('0x29')](function(_0x1a66ee){if(_0x1a66ee){return _0x1a66ee[_0x5bec('0xbf')](_0x2b6322[_0x5bec('0x6d')]['ids'],_[_0x5bec('0xb5')](_0x2b6322[_0x5bec('0x6d')],[_0x5bec('0xb4'),'id'])||{})[_0x5bec('0xc0')](function(){return db[_0x5bec('0xc1')][_0x5bec('0xbc')]({'attributes':['id',_0x5bec('0x2c'),_0x5bec('0x47')],'where':{'id':_0x2b6322[_0x5bec('0x6d')][_0x5bec('0xb4')]}});})[_0x5bec('0x29')](function(_0x4521c4){socket[_0x5bec('0xc2')]('faxInteractionTags:save',{'id':Number(_0x2b6322['params']['id']),'tags':_0x4521c4||[]});return{'id':Number(_0x2b6322[_0x5bec('0xad')]['id']),'tags':_0x4521c4||[]};});}})['then'](respondWithResult(_0x596033,null))['catch'](handleError(_0x596033,null));};exports[_0x5bec('0xc3')]=function(_0x102716,_0x15cae6,_0x27dc52){return db[_0x5bec('0x37')][_0x5bec('0x5a')]({'where':{'id':_0x102716['params']['id']}})[_0x5bec('0x29')](handleEntityNotFound(_0x15cae6,null))['then'](function(_0x1d9c5a){if(_0x1d9c5a){return _0x1d9c5a[_0x5bec('0xc3')](_0x102716[_0x5bec('0x3b')]['ids']);}})[_0x5bec('0x29')](respondWithStatusCode(_0x15cae6,null))[_0x5bec('0x36')](handleError(_0x15cae6,null));};exports[_0x5bec('0xc4')]=function(_0x5ca863,_0x337623){var _0x42b0e7=moment()['unix']()[_0x5bec('0x9a')]();var _0x5ccad0=path[_0x5bec('0xc5')](config[_0x5bec('0xc6')],'server',_0x5bec('0xc7'),_0x5bec('0xc8'));var _0x16a7fb=path['join'](config[_0x5bec('0xc6')],_0x5bec('0xc9'),_0x5bec('0xc7'),_0x5bec('0xca'));var _0x35e278=path[_0x5bec('0xc5')](_0x5ccad0,_0x42b0e7);var _0xd5a1b5=util[_0x5bec('0xba')](_0x5bec('0xcb'),_0x5ca863[_0x5bec('0xad')]['id'],_0x42b0e7);var _0xd0a3d0=path['join'](_0x5ccad0,_0xd5a1b5);var _0x4ad61b=[];_0x4ad61b[_0x5bec('0x35')]({'model':db[_0x5bec('0xcc')],'as':'Attachment','raw':!![]});var _0x5e56b5=[{'model':db[_0x5bec('0xb7')],'as':_0x5bec('0xcd'),'attributes':['id',_0x5bec('0x6d'),_0x5bec('0x74')],'include':_0x4ad61b}];return db[_0x5bec('0x37')][_0x5bec('0x5a')]({'where':{'id':_0x5ca863[_0x5bec('0xad')]['id']},'include':_0x5e56b5})['then'](handleEntityNotFound(_0x337623,null))[_0x5bec('0x29')](function(_0x53fed7){if(_0x53fed7&&_0x53fed7[_0x5bec('0xcd')]){var _0x1f7a69=_0x53fed7[_0x5bec('0xce')]({'plain':!![]});fs[_0x5bec('0xcf')](_0x35e278);for(var _0xd008ba=0x0;_0xd008ba<_0x1f7a69[_0x5bec('0xcd')][_0x5bec('0x40')];_0xd008ba++){var _0x509a16=_0x1f7a69[_0x5bec('0xcd')][_0xd008ba]['Attachment'];if(_0x509a16){var _0x236cb8=path[_0x5bec('0xc5')](_0x16a7fb,_0x509a16['basename']);if(fs['existsSync'](_0x236cb8)){fs['createReadStream'](_0x236cb8)[_0x5bec('0xd0')](fs['createWriteStream'](path[_0x5bec('0xc5')](_0x35e278,_0x509a16[_0x5bec('0xd1')])));}}}return BPromise[_0x5bec('0x90')]()[_0x5bec('0x29')](function(){return new BPromise(function(_0x5e70f7,_0x664e77){zipdir(_0x35e278,{'saveTo':_0xd0a3d0},function(_0x1eafc5,_0x5f2f79){if(_0x1eafc5)return _0x664e77(_0x1eafc5);return _0x5e70f7(_0x5f2f79);});})[_0x5bec('0x29')](function(){return new BPromise(function(_0x3b7d81,_0x4a7481){rimraf(_0x35e278,function(_0x5aa675){if(_0x5aa675)_0x4a7481(_0x5aa675);return _0x3b7d81();});});})[_0x5bec('0x29')](function(){return _0x337623[_0x5bec('0xc4')](_0xd0a3d0,_0xd5a1b5,function(_0x43cbe3){if(_0x43cbe3){console['log'](_0x5bec('0xd2'),_0x43cbe3);}else{fs['unlinkSync'](_0xd0a3d0);}});});});}else{return _0x337623[_0x5bec('0x1f')](0xc8);}})['catch'](handleError(_0x337623,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 36f3494..bc7733d 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x2568ec,_0x46f182){var _0x4c67a4=function(_0x9bca75){while(--_0x9bca75){_0x2568ec['push'](_0x2568ec['shift']());}};_0x4c67a4(++_0x46f182);}(_0x1261,0x144));var _0x1126=function(_0x579121,_0x27e9e2){_0x579121=_0x579121-0x0;var _0x38a4ae=_0x1261[_0x579121];return _0x38a4ae;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index aaf991a..673581b 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 _0xa420=['lodash','util','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closedAt','format'];(function(_0x57e415,_0x119437){var _0x56bde6=function(_0x3c3332){while(--_0x3c3332){_0x57e415['push'](_0x57e415['shift']());}};_0x56bde6(++_0x119437);}(_0xa420,0x179));var _0x0a42=function(_0xb18ca6,_0x19758f){_0xb18ca6=_0xb18ca6-0x0;var _0x199631=_0xa420[_0xb18ca6];return _0x199631;};'use strict';var _=require(_0x0a42('0x0'));var util=require(_0x0a42('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a42('0x2'));var fs=require('fs');var path=require(_0x0a42('0x3'));var rimraf=require(_0x0a42('0x4'));var config=require(_0x0a42('0x5'));var attributes=require(_0x0a42('0x6'));module[_0x0a42('0x7')]=function(_0x52ed53,_0x471d48){return _0x52ed53[_0x0a42('0x8')](_0x0a42('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507ef8,_0x3a53fa,_0x24513c){if(_0x507ef8[_0x0a42('0xa')]('closed')){_0x507ef8[_0x0a42('0xb')]=moment()[_0x0a42('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x24513c(null,_0x507ef8);}}});}; \ No newline at end of file +var _0x48e6=['rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x48e6,0x170));var _0x648e=function(_0x1a5a53,_0x4fbf03){_0x1a5a53=_0x1a5a53-0x0;var _0x565c2d=_0x48e6[_0x1a5a53];return _0x565c2d;};'use strict';var _=require(_0x648e('0x0'));var util=require('util');var logger=require(_0x648e('0x1'))(_0x648e('0x2'));var moment=require(_0x648e('0x3'));var BPromise=require('bluebird');var rp=require(_0x648e('0x4'));var fs=require('fs');var path=require(_0x648e('0x5'));var rimraf=require(_0x648e('0x6'));var config=require(_0x648e('0x7'));var attributes=require(_0x648e('0x8'));module[_0x648e('0x9')]=function(_0x2c878f,_0x340bfa){return _0x2c878f['define'](_0x648e('0xa'),attributes,{'tableName':_0x648e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x243cf0,_0x1c91b2,_0x27f1a6){if(_0x243cf0[_0x648e('0xc')](_0x648e('0xd'))){_0x243cf0[_0x648e('0xe')]=moment()[_0x648e('0xf')](_0x648e('0x10'));}_0x27f1a6(null,_0x243cf0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7f4caa0..5a88548 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 _0x5fbc=['limit','UpdateFaxInteraction','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','FaxInteraction','body','options','raw','where','attributes'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x5fbc,0xc9));var _0xc5fb=function(_0x319ef2,_0x199166){_0x319ef2=_0x319ef2-0x0;var _0x39dbb3=_0x5fbc[_0x319ef2];return _0x39dbb3;};'use strict';var _=require(_0xc5fb('0x0'));var util=require(_0xc5fb('0x1'));var moment=require(_0xc5fb('0x2'));var BPromise=require(_0xc5fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5fb('0x4'))['db'];var utils=require(_0xc5fb('0x5'));var logger=require(_0xc5fb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc5fb('0x7'));var client=jayson[_0xc5fb('0x8')][_0xc5fb('0x9')]({'port':0x232a});config[_0xc5fb('0xa')]=_[_0xc5fb('0xb')](config[_0xc5fb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5fb('0xc'))(new Redis(config['redis']));require(_0xc5fb('0xd'))[_0xc5fb('0xe')](socket);function respondWithRpcPromise(_0x4b1bc6,_0x2b221f,_0x36aed8){return new BPromise(function(_0x42cc4d,_0x26b6f1){return client['request'](_0x4b1bc6,_0x36aed8)[_0xc5fb('0xf')](function(_0x4721fa){logger[_0xc5fb('0x10')](_0xc5fb('0x11'),_0x2b221f,'request\x20sent');logger[_0xc5fb('0x12')](_0xc5fb('0x13'),_0x2b221f,'request\x20sent',JSON[_0xc5fb('0x14')](_0x4721fa));if(_0x4721fa['error']){if(_0x4721fa[_0xc5fb('0x15')][_0xc5fb('0x16')]===0x1f4){logger['error'](_0xc5fb('0x11'),_0x2b221f,_0x4721fa[_0xc5fb('0x15')][_0xc5fb('0x17')]);return _0x26b6f1(_0x4721fa[_0xc5fb('0x15')]['message']);}logger[_0xc5fb('0x15')](_0xc5fb('0x11'),_0x2b221f,_0x4721fa['error'][_0xc5fb('0x17')]);return _0x42cc4d(_0x4721fa[_0xc5fb('0x15')][_0xc5fb('0x17')]);}else{logger['info'](_0xc5fb('0x11'),_0x2b221f,_0xc5fb('0x18'));_0x42cc4d(_0x4721fa[_0xc5fb('0x19')]['message']);}})[_0xc5fb('0x1a')](function(_0x253e67){logger[_0xc5fb('0x15')](_0xc5fb('0x11'),_0x2b221f,_0x253e67);_0x26b6f1(_0x253e67);});});}exports['UpdateFaxInteraction']=function(_0x463e9b){var _0x1e0b59=this;return new Promise(function(_0x221fe8,_0x423e3c){return db[_0xc5fb('0x1b')]['update'](_0x463e9b[_0xc5fb('0x1c')],{'raw':_0x463e9b[_0xc5fb('0x1d')]?_0x463e9b[_0xc5fb('0x1d')][_0xc5fb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463e9b['options']?_0x463e9b['options'][_0xc5fb('0x1f')]||null:null,'attributes':_0x463e9b[_0xc5fb('0x1d')]?_0x463e9b[_0xc5fb('0x1d')][_0xc5fb('0x20')]||null:null,'limit':_0x463e9b[_0xc5fb('0x1d')]?_0x463e9b[_0xc5fb('0x1d')][_0xc5fb('0x21')]||null:null})[_0xc5fb('0xf')](function(_0x1a9d58){logger[_0xc5fb('0x10')](_0xc5fb('0x22'),_0x463e9b);logger[_0xc5fb('0x12')](_0xc5fb('0x22'),_0x463e9b,JSON['stringify'](_0x1a9d58));_0x221fe8(_0x1a9d58);})[_0xc5fb('0x1a')](function(_0x4c654e){logger['error']('UpdateFaxInteraction',_0x4c654e[_0xc5fb('0x17')],_0x463e9b);_0x423e3c(_0x1e0b59[_0xc5fb('0x15')](0x1f4,_0x4c654e['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x206b9f){return new Promise(function(_0x1ec033,_0x5e2715){return db[_0xc5fb('0x1b')]['find']({'where':_0x206b9f[_0xc5fb('0x1d')]?_0x206b9f['options'][_0xc5fb('0x1f')]||null:null})[_0xc5fb('0xf')](function(_0x576b86){if(_0x576b86){return _0x576b86['addTags'](_0x206b9f[_0xc5fb('0x1c')][_0xc5fb('0x23')],_[_0xc5fb('0x24')](_0x206b9f[_0xc5fb('0x1c')],[_0xc5fb('0x23'),'id'])||{});}})[_0xc5fb('0x25')](function(_0x3f95a3){logger[_0xc5fb('0x10')](_0xc5fb('0x26'),_0x206b9f);logger[_0xc5fb('0x12')](_0xc5fb('0x26'),_0x206b9f,JSON[_0xc5fb('0x14')](_0x3f95a3));_0x1ec033(_0x3f95a3);})[_0xc5fb('0x1a')](function(_0x5035dc){logger['error'](_0xc5fb('0x26'),_0x5035dc[_0xc5fb('0x17')],_0x206b9f);_0x5e2715(_this[_0xc5fb('0x15')](0x1f4,_0x5035dc['message']));});});}; \ No newline at end of file +var _0x45fc=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','AddTagsToFaxInteraction','find'];(function(_0x11cd30,_0x58b742){var _0x1954c0=function(_0x14ea67){while(--_0x14ea67){_0x11cd30['push'](_0x11cd30['shift']());}};_0x1954c0(++_0x58b742);}(_0x45fc,0x1a8));var _0xc45f=function(_0x25e619,_0x35927b){_0x25e619=_0x25e619-0x0;var _0x32ada2=_0x45fc[_0x25e619];return _0x32ada2;};'use strict';var _=require(_0xc45f('0x0'));var util=require(_0xc45f('0x1'));var moment=require(_0xc45f('0x2'));var BPromise=require(_0xc45f('0x3'));var rs=require(_0xc45f('0x4'));var fs=require('fs');var Redis=require(_0xc45f('0x5'));var db=require(_0xc45f('0x6'))['db'];var utils=require(_0xc45f('0x7'));var logger=require(_0xc45f('0x8'))(_0xc45f('0x9'));var config=require(_0xc45f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc45f('0xb')][_0xc45f('0xc')]({'port':0x232a});config[_0xc45f('0xd')]=_[_0xc45f('0xe')](config[_0xc45f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc45f('0xf'))(new Redis(config[_0xc45f('0xd')]));require(_0xc45f('0x10'))[_0xc45f('0x11')](socket);function respondWithRpcPromise(_0x5450ca,_0x53f3e9,_0x363f31){return new BPromise(function(_0x2ca440,_0x5276f4){return client[_0xc45f('0x12')](_0x5450ca,_0x363f31)[_0xc45f('0x13')](function(_0x543683){logger[_0xc45f('0x14')](_0xc45f('0x15'),_0x53f3e9,_0xc45f('0x16'));logger[_0xc45f('0x17')](_0xc45f('0x18'),_0x53f3e9,_0xc45f('0x16'),JSON[_0xc45f('0x19')](_0x543683));if(_0x543683[_0xc45f('0x1a')]){if(_0x543683[_0xc45f('0x1a')][_0xc45f('0x1b')]===0x1f4){logger[_0xc45f('0x1a')](_0xc45f('0x15'),_0x53f3e9,_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);return _0x5276f4(_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);}logger[_0xc45f('0x1a')](_0xc45f('0x15'),_0x53f3e9,_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);return _0x2ca440(_0x543683[_0xc45f('0x1a')][_0xc45f('0x1c')]);}else{logger[_0xc45f('0x14')](_0xc45f('0x15'),_0x53f3e9,_0xc45f('0x16'));_0x2ca440(_0x543683[_0xc45f('0x1d')]['message']);}})[_0xc45f('0x1e')](function(_0x31f1d8){logger['error'](_0xc45f('0x15'),_0x53f3e9,_0x31f1d8);_0x5276f4(_0x31f1d8);});});}exports[_0xc45f('0x1f')]=function(_0x42d9d8){var _0x4137ff=this;return new Promise(function(_0x56f7d3,_0x2e873b){return db[_0xc45f('0x20')]['update'](_0x42d9d8[_0xc45f('0x21')],{'raw':_0x42d9d8['options']?_0x42d9d8[_0xc45f('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d9d8['options']?_0x42d9d8[_0xc45f('0x22')][_0xc45f('0x23')]||null:null,'attributes':_0x42d9d8[_0xc45f('0x22')]?_0x42d9d8['options']['attributes']||null:null,'limit':_0x42d9d8['options']?_0x42d9d8[_0xc45f('0x22')]['limit']||null:null})[_0xc45f('0x13')](function(_0x1c692f){logger[_0xc45f('0x14')](_0xc45f('0x1f'),_0x42d9d8);logger['debug'](_0xc45f('0x1f'),_0x42d9d8,JSON[_0xc45f('0x19')](_0x1c692f));_0x56f7d3(_0x1c692f);})[_0xc45f('0x1e')](function(_0x146630){logger[_0xc45f('0x1a')](_0xc45f('0x1f'),_0x146630[_0xc45f('0x1c')],_0x42d9d8);_0x2e873b(_0x4137ff['error'](0x1f4,_0x146630['message']));});});};exports[_0xc45f('0x24')]=function(_0xa3f8a0){return new Promise(function(_0x22f3a0,_0x10ce68){return db[_0xc45f('0x20')][_0xc45f('0x25')]({'where':_0xa3f8a0[_0xc45f('0x22')]?_0xa3f8a0[_0xc45f('0x22')][_0xc45f('0x23')]||null:null})[_0xc45f('0x13')](function(_0x113787){if(_0x113787){return _0x113787['addTags'](_0xa3f8a0['body'][_0xc45f('0x26')],_[_0xc45f('0x27')](_0xa3f8a0['body'],[_0xc45f('0x26'),'id'])||{});}})[_0xc45f('0x28')](function(_0x1f4f7c){logger[_0xc45f('0x14')]('AddTags',_0xa3f8a0);logger[_0xc45f('0x17')](_0xc45f('0x29'),_0xa3f8a0,JSON['stringify'](_0x1f4f7c));_0x22f3a0(_0x1f4f7c);})['catch'](function(_0xa9d976){logger['error'](_0xc45f('0x29'),_0xa9d976[_0xc45f('0x1c')],_0xa3f8a0);_0x10ce68(_this[_0xc45f('0x1a')](0x1f4,_0xa9d976[_0xc45f('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index a05c29a..f9e2b43 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 _0x375b=['update','emit','removeListener','register','length','save','remove'];(function(_0x5bbae4,_0x2a4a4e){var _0x338a50=function(_0x478845){while(--_0x478845){_0x5bbae4['push'](_0x5bbae4['shift']());}};_0x338a50(++_0x2a4a4e);}(_0x375b,0x124));var _0xb375=function(_0x135169,_0xd31f06){_0x135169=_0x135169-0x0;var _0x3f9034=_0x375b[_0x135169];return _0x3f9034;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xb375('0x0'),_0xb375('0x1'),_0xb375('0x2')];function createListener(_0x450619,_0x2c4307){return function(_0x4b97dd){_0x2c4307[_0xb375('0x3')](_0x450619,_0x4b97dd);};}function removeListener(_0x100f6a,_0x572514){return function(){FaxInteractionEvents[_0xb375('0x4')](_0x100f6a,_0x572514);};}exports[_0xb375('0x5')]=function(_0x3042e4){for(var _0x296a54=0x0,_0x28d898=events[_0xb375('0x6')];_0x296a54<_0x28d898;_0x296a54++){var _0x31cbf0=events[_0x296a54];var _0x18a945=createListener('faxInteraction:'+_0x31cbf0,_0x3042e4);FaxInteractionEvents['on'](_0x31cbf0,_0x18a945);}}; \ No newline at end of file +var _0x5b07=['length','faxInteraction:','./faxInteraction.events','save','update','removeListener','register'];(function(_0x27a5c1,_0x33b6de){var _0x458564=function(_0x1c5fc9){while(--_0x1c5fc9){_0x27a5c1['push'](_0x27a5c1['shift']());}};_0x458564(++_0x33b6de);}(_0x5b07,0x198));var _0x75b0=function(_0x3ef04c,_0x3df3cd){_0x3ef04c=_0x3ef04c-0x0;var _0x231aa9=_0x5b07[_0x3ef04c];return _0x231aa9;};'use strict';var FaxInteractionEvents=require(_0x75b0('0x0'));var events=[_0x75b0('0x1'),'remove',_0x75b0('0x2')];function createListener(_0x6e3504,_0x22fb20){return function(_0x28c4fb){_0x22fb20['emit'](_0x6e3504,_0x28c4fb);};}function removeListener(_0x275a60,_0x967da3){return function(){FaxInteractionEvents[_0x75b0('0x3')](_0x275a60,_0x967da3);};}exports[_0x75b0('0x4')]=function(_0x1c9ad7){for(var _0x2b24b9=0x0,_0x5e13be=events[_0x75b0('0x5')];_0x2b24b9<_0x5e13be;_0x2b24b9++){var _0x38c024=events[_0x2b24b9];var _0x321a88=createListener(_0x75b0('0x6')+_0x38c024,_0x1c9ad7);FaxInteractionEvents['on'](_0x38c024,_0x321a88);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b75fbdb..ed48665 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 _0x9ffd=['download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','update','fax','faxinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1c65c3,_0x3e2166){_0x1c65c3=_0x1c65c3-0x0;var _0xe4e4ae=_0x9ffd[_0x1c65c3];return _0xe4e4ae;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xd9ff('0x8')](_0xd9ff('0xf'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x10')]);router[_0xd9ff('0x11')]('/',auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x12')]);router[_0xd9ff('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x11')](_0xd9ff('0x14'),auth[_0xd9ff('0xb')](),interaction[_0xd9ff('0x15')]('fax',_0xd9ff('0x16')),controller[_0xd9ff('0x17')]);router['put'](_0xd9ff('0xd'),auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:update'),controller[_0xd9ff('0x18')]);router['delete'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),interaction[_0xd9ff('0x15')](_0xd9ff('0x19'),_0xd9ff('0x1a')),controller[_0xd9ff('0x1b')]);router[_0xd9ff('0x1c')](_0xd9ff('0x14'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x1d')]);module[_0xd9ff('0x1e')]=router; \ No newline at end of file +var _0xbdb7=['post','addMessage','tracked','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0xbdb7[_0x568496];return _0x26c5c1;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./faxInteraction.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0x9')](_0x7bdb('0xc'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0x9')](_0x7bdb('0xf'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0x11')](_0x7bdb('0xc'),auth['isAuthenticated'](),controller[_0x7bdb('0x12')]);router['post']('/:id/tags',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x7bdb('0x14')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x16')),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')]('/:id',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x19')),controller['destroy']);router[_0x7bdb('0x18')](_0x7bdb('0x1a'),auth['isAuthenticated'](),controller[_0x7bdb('0x1b')]);module[_0x7bdb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 00cb6fb..e36e018 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 _0x90f9=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x4b512e,_0xf538bd){var _0x4085d6=function(_0x29ad08){while(--_0x29ad08){_0x4b512e['push'](_0x4b512e['shift']());}};_0x4085d6(++_0xf538bd);}(_0x90f9,0xad));var _0x990f=function(_0x303d78,_0x8eeaea){_0x303d78=_0x303d78-0x0;var _0x5696b1=_0x90f9[_0x303d78];return _0x5696b1;};'use strict';var Sequelize=require('sequelize');module[_0x990f('0x0')]={'body':{'type':Sequelize[_0x990f('0x1')](_0x990f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x990f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x990f('0x4')]('in',_0x990f('0x5')),'defaultValue':_0x990f('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x990f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x990f('0x6')]}}; \ No newline at end of file +var _0x3b60=['out','TEXT','DATE','exports','medium','BOOLEAN','ENUM'];(function(_0x402c9d,_0x34f0d1){var _0x4a7679=function(_0x1802a0){while(--_0x1802a0){_0x402c9d['push'](_0x402c9d['shift']());}};_0x4a7679(++_0x34f0d1);}(_0x3b60,0x106));var _0x03b6=function(_0xac89c4,_0x567718){_0xac89c4=_0xac89c4-0x0;var _0xb02136=_0x3b60[_0xac89c4];return _0xb02136;};'use strict';var Sequelize=require('sequelize');module[_0x03b6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x03b6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x03b6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x03b6('0x3')]('in',_0x03b6('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x03b6('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x03b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6de62c5..3ac6833 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 _0xc356=['[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectmessage','create','ContactId','AttachmentId','SendFax','FaxAccountId','format','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','Attachment','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','end','status','offset','limit','set','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','findAll','catch','show','length','includeAll','find','body','params','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt'];(function(_0x780921,_0x7c3eef){var _0x1536c6=function(_0x5b2c11){while(--_0x5b2c11){_0x780921['push'](_0x780921['shift']());}};_0x1536c6(++_0x7c3eef);}(_0xc356,0x11f));var _0x6c35=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xc356[_0x4063a4];return _0x17908d;};'use strict';var pdf=require(_0x6c35('0x0'));var emlformat=require(_0x6c35('0x1'));var rimraf=require(_0x6c35('0x2'));var zipdir=require(_0x6c35('0x3'));var jsonpatch=require(_0x6c35('0x4'));var rp=require(_0x6c35('0x5'));var moment=require(_0x6c35('0x6'));var BPromise=require(_0x6c35('0x7'));var Mustache=require('mustache');var util=require(_0x6c35('0x8'));var path=require('path');var sox=require(_0x6c35('0x9'));var csv=require(_0x6c35('0xa'));var ejs=require(_0x6c35('0xb'));var fs=require('fs');var _=require(_0x6c35('0xc'));var squel=require(_0x6c35('0xd'));var crypto=require(_0x6c35('0xe'));var jsforce=require(_0x6c35('0xf'));var deskjs=require(_0x6c35('0x10'));var toCsv=require(_0x6c35('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c35('0x11'));var qs=require(_0x6c35('0x12'));var as=require(_0x6c35('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c35('0x14'))(_0x6c35('0x15'));var utils=require('../../config/utils');var config=require(_0x6c35('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6c35('0x17')](config['redis'],{'host':_0x6c35('0x18'),'port':0x18eb});var socket=require(_0x6c35('0x19'))(new Redis(config[_0x6c35('0x1a')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6c35('0x1b')][_0x6c35('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x6c35('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x29c7c5,_0x570efb,_0x10c390,_0x3ac5e6){return new BPromise(function(_0x7c402d,_0x122e76){var _0x4ec4f5=_0x3ac5e6||client;return _0x4ec4f5[_0x6c35('0x1d')](_0x29c7c5,_0x10c390)[_0x6c35('0x1e')](function(_0x45fc44){logger['info']('FaxMessage,\x20%s,\x20%s',_0x570efb,_0x6c35('0x1f'));logger[_0x6c35('0x20')](_0x6c35('0x21'),_0x570efb,_0x6c35('0x1f'),JSON['stringify'](_0x45fc44));if(_0x45fc44[_0x6c35('0x22')]){if(_0x45fc44[_0x6c35('0x22')][_0x6c35('0x23')]===0x1f4){logger[_0x6c35('0x22')](_0x6c35('0x24'),_0x570efb,_0x45fc44[_0x6c35('0x22')][_0x6c35('0x25')]);return _0x122e76(_0x45fc44[_0x6c35('0x22')][_0x6c35('0x25')]);}logger[_0x6c35('0x22')]('FaxMessage,\x20%s,\x20%s',_0x570efb,_0x45fc44['error'][_0x6c35('0x25')]);return _0x7c402d(_0x45fc44[_0x6c35('0x22')]['message']);}else{logger[_0x6c35('0x26')]('FaxMessage,\x20%s,\x20%s',_0x570efb,_0x6c35('0x1f'));_0x7c402d(_0x45fc44[_0x6c35('0x27')]['message']);}})['catch'](function(_0x3bf970){logger[_0x6c35('0x22')](_0x6c35('0x24'),_0x570efb,_0x3bf970);_0x122e76(_0x3bf970);});});}function respondWithStatusCode(_0x3a700c,_0x2ba9d0){_0x2ba9d0=_0x2ba9d0||0xcc;return function(_0x340e92){if(_0x340e92){return _0x3a700c['sendStatus'](_0x2ba9d0);}return _0x3a700c['status'](_0x2ba9d0)[_0x6c35('0x28')]();};}function respondWithResult(_0x3c8c5d,_0xaa2ef6){_0xaa2ef6=_0xaa2ef6||0xc8;return function(_0x4d8457){if(_0x4d8457){return _0x3c8c5d[_0x6c35('0x29')](_0xaa2ef6)['json'](_0x4d8457);}};}function respondWithFilteredResult(_0x49847b,_0xbe6ea2){return function(_0x489c8e){if(_0x489c8e){var _0x51e80c=_0x489c8e['count'],_0x3b1449=_0xbe6ea2['offset'],_0x43fdd5=_0xbe6ea2[_0x6c35('0x2a')]+_0xbe6ea2[_0x6c35('0x2b')],_0x16338c;if(_0x43fdd5>=_0x51e80c){_0x43fdd5=_0x51e80c;_0x16338c=0xc8;}else{_0x16338c=0xce;}_0x49847b[_0x6c35('0x29')](_0x16338c);return _0x49847b[_0x6c35('0x2c')]('Content-Range',_0x3b1449+'-'+_0x43fdd5+'/'+_0x51e80c)['json'](_0x489c8e);}return null;};}function patchUpdates(_0x2e5170){return function(_0xd8a6de){try{jsonpatch[_0x6c35('0x2d')](_0xd8a6de,_0x2e5170,!![]);}catch(_0xb960fd){return BPromise[_0x6c35('0x2e')](_0xb960fd);}return _0xd8a6de['save']();};}function saveUpdates(_0x5bc6e4,_0x21ee73){return function(_0x5ab6b9){if(_0x5ab6b9){return _0x5ab6b9[_0x6c35('0x2f')](_0x5bc6e4)[_0x6c35('0x1e')](function(_0x1321c7){return _0x1321c7;});}return null;};}function removeEntity(_0x21e779,_0x523622){return function(_0xfbb1ff){if(_0xfbb1ff){return _0xfbb1ff[_0x6c35('0x30')]()['then'](function(){_0x21e779[_0x6c35('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec6bb,_0x4f3615){return function(_0xfcd8ff){if(!_0xfcd8ff){_0x3ec6bb[_0x6c35('0x31')](0x194);}return _0xfcd8ff;};}function handleError(_0x235afb,_0x4a2e82){_0x4a2e82=_0x4a2e82||0x1f4;return function(_0x386df2){logger[_0x6c35('0x22')](_0x386df2[_0x6c35('0x32')]);if(_0x386df2[_0x6c35('0x33')]){delete _0x386df2[_0x6c35('0x33')];}_0x235afb[_0x6c35('0x29')](_0x4a2e82)[_0x6c35('0x34')](_0x386df2);};}exports[_0x6c35('0x35')]=function(_0x256ffc,_0x12a3a3){var _0x50f124={},_0x472512={},_0x43fa6b={'count':0x0,'rows':[]};var _0x568035=_[_0x6c35('0x36')](db[_0x6c35('0x37')]['rawAttributes'],function(_0x10034d){return{'name':_0x10034d[_0x6c35('0x38')],'type':_0x10034d[_0x6c35('0x39')]['key']};});_0x472512[_0x6c35('0x3a')]=_[_0x6c35('0x36')](_0x568035,_0x6c35('0x33'));_0x472512[_0x6c35('0x3b')]=_[_0x6c35('0x3c')](_0x256ffc['query']);_0x472512['filters']=_[_0x6c35('0x3d')](_0x472512[_0x6c35('0x3a')],_0x472512[_0x6c35('0x3b')]);_0x50f124[_0x6c35('0x3e')]=_['intersection'](_0x472512[_0x6c35('0x3a')],qs[_0x6c35('0x3f')](_0x256ffc['query'][_0x6c35('0x3f')]));_0x50f124[_0x6c35('0x3e')]=_0x50f124[_0x6c35('0x3e')]['length']?_0x50f124[_0x6c35('0x3e')]:_0x472512[_0x6c35('0x3a')];if(!_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x40')]('nolimit')){_0x50f124[_0x6c35('0x2b')]=qs['limit'](_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x2b')]);_0x50f124[_0x6c35('0x2a')]=qs[_0x6c35('0x2a')](_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x2a')]);}_0x50f124[_0x6c35('0x41')]=qs[_0x6c35('0x42')](_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x42')]);_0x50f124[_0x6c35('0x43')]=qs['filters'](_[_0x6c35('0x44')](_0x256ffc['query'],_0x472512[_0x6c35('0x45')]),_0x568035);if(_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x46')]){_0x50f124[_0x6c35('0x43')]=_[_0x6c35('0x47')](_0x50f124[_0x6c35('0x43')],{'$or':_[_0x6c35('0x36')](_0x568035,function(_0x171180){if(_0x171180[_0x6c35('0x39')]!==_0x6c35('0x48')){var _0x4f670c={};_0x4f670c[_0x171180['name']]={'$like':'%'+_0x256ffc[_0x6c35('0x3b')][_0x6c35('0x46')]+'%'};return _0x4f670c;}})});}_0x50f124=_['merge']({},_0x50f124,_0x256ffc[_0x6c35('0x49')]);var _0xb8021={'where':_0x50f124[_0x6c35('0x43')]};return db[_0x6c35('0x37')][_0x6c35('0x4a')](_0xb8021)[_0x6c35('0x1e')](function(_0x554975){_0x43fa6b[_0x6c35('0x4a')]=_0x554975;if(_0x256ffc[_0x6c35('0x3b')]['includeAll']){_0x50f124[_0x6c35('0x4b')]=[{'all':!![]}];}return db[_0x6c35('0x37')][_0x6c35('0x4c')](_0x50f124);})[_0x6c35('0x1e')](function(_0x366632){_0x43fa6b['rows']=_0x366632;return _0x43fa6b;})[_0x6c35('0x1e')](respondWithFilteredResult(_0x12a3a3,_0x50f124))[_0x6c35('0x4d')](handleError(_0x12a3a3,null));};exports[_0x6c35('0x4e')]=function(_0x432172,_0x3dbb4b){var _0xd2e0e0={'raw':!![],'where':{'id':_0x432172['params']['id']}},_0xdef08e={};_0xdef08e['model']=_[_0x6c35('0x3c')](db[_0x6c35('0x37')]['rawAttributes']);_0xdef08e[_0x6c35('0x3b')]=_[_0x6c35('0x3c')](_0x432172['query']);_0xdef08e[_0x6c35('0x45')]=_[_0x6c35('0x3d')](_0xdef08e[_0x6c35('0x3a')],_0xdef08e[_0x6c35('0x3b')]);_0xd2e0e0[_0x6c35('0x3e')]=_[_0x6c35('0x3d')](_0xdef08e['model'],qs['fields'](_0x432172[_0x6c35('0x3b')][_0x6c35('0x3f')]));_0xd2e0e0[_0x6c35('0x3e')]=_0xd2e0e0['attributes'][_0x6c35('0x4f')]?_0xd2e0e0['attributes']:_0xdef08e[_0x6c35('0x3a')];if(_0x432172[_0x6c35('0x3b')][_0x6c35('0x50')]){_0xd2e0e0[_0x6c35('0x4b')]=[{'all':!![]}];}_0xd2e0e0=_['merge']({},_0xd2e0e0,_0x432172[_0x6c35('0x49')]);return db[_0x6c35('0x37')][_0x6c35('0x51')](_0xd2e0e0)[_0x6c35('0x1e')](handleEntityNotFound(_0x3dbb4b,null))['then'](respondWithResult(_0x3dbb4b,null))[_0x6c35('0x4d')](handleError(_0x3dbb4b,null));};exports[_0x6c35('0x2f')]=function(_0x177b24,_0x1305bb){if(_0x177b24[_0x6c35('0x52')]['id']){delete _0x177b24[_0x6c35('0x52')]['id'];}return db['FaxMessage'][_0x6c35('0x51')]({'where':{'id':_0x177b24[_0x6c35('0x53')]['id']}})['then'](handleEntityNotFound(_0x1305bb,null))[_0x6c35('0x1e')](saveUpdates(_0x177b24['body'],null))[_0x6c35('0x1e')](respondWithResult(_0x1305bb,null))[_0x6c35('0x4d')](handleError(_0x1305bb,null));};exports[_0x6c35('0x30')]=function(_0x38d57c,_0x279693){return db[_0x6c35('0x37')]['find']({'where':{'id':_0x38d57c['params']['id']}})[_0x6c35('0x1e')](handleEntityNotFound(_0x279693,null))['then'](removeEntity(_0x279693,null))['catch'](handleError(_0x279693,null));};exports[_0x6c35('0x54')]=function(_0x4cf40c,_0x1e365c){return db[_0x6c35('0x37')][_0x6c35('0x54')]()[_0x6c35('0x1e')](respondWithResult(_0x1e365c,null))[_0x6c35('0x4d')](handleError(_0x1e365c,null));};var interaction_log=require(_0x6c35('0x14'))(_0x6c35('0x55'));exports[_0x6c35('0x56')]=function(_0x5a57fe,_0x303c18,_0xa7110a){var _0x4d47a1={'channel':_0x6c35('0x57')};if(_0x5a57fe[_0x6c35('0x52')]['id']){delete _0x5a57fe[_0x6c35('0x52')]['id'];}_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x58')]=!![];_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x59')]=moment()['format'](_0x6c35('0x5a'));_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x5b')]=_0x5a57fe['body'][_0x6c35('0x5b')]||_0x5a57fe[_0x6c35('0x5c')]['id'];return db[_0x6c35('0x37')][_0x6c35('0x51')]({'where':{'id':_0x5a57fe[_0x6c35('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x6c35('0x5d')],'as':_0x6c35('0x5e')}]})[_0x6c35('0x1e')](handleEntityNotFound(_0x303c18,null))[_0x6c35('0x1e')](saveUpdates(_0x5a57fe['body'],null))['then'](function(_0x2f219d){if(_0x2f219d){_0x4d47a1[_0x6c35('0x25')]=_0x2f219d[_0x6c35('0x5f')]({'plain':!![]});return db[_0x6c35('0x60')][_0x6c35('0x51')]({'where':{'id':_0x2f219d[_0x6c35('0x61')]}});}return null;})[_0x6c35('0x1e')](handleEntityNotFound(_0x303c18,null))['then'](function(_0x445bc2){if(_0x445bc2){return _0x445bc2[_0x6c35('0x2f')]({'UserId':_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x5b')],'read1stAt':_[_0x6c35('0x62')](_0x445bc2[_0x6c35('0x63')])?moment()['format'](_0x6c35('0x5a')):undefined});}return null;})[_0x6c35('0x1e')](function(_0x38d5a2){if(_0x38d5a2){_0x4d47a1['interaction']=_0x38d5a2[_0x6c35('0x5f')]({'plain':!![]});interaction_log[_0x6c35('0x26')](_0x6c35('0x64'),_0x5a57fe[_0x6c35('0x5c')]['id'],_0x5a57fe[_0x6c35('0x5c')][_0x6c35('0x33')],_0x5a57fe[_0x6c35('0x5c')]['role'],_0x4d47a1['interaction']['id'],_0x5a57fe['body']?JSON['stringify'](_0x5a57fe[_0x6c35('0x52')]):_0x6c35('0x65'));return respondWithRpcPromise(_0x6c35('0x66'),'acceptMessage',_0x4d47a1);}return null;})[_0x6c35('0x1e')](function(_0x26de90){if(_0x26de90){if(_0x5a57fe[_0x6c35('0x52')][_0x6c35('0x67')]){_0x4d47a1['message'][_0x6c35('0x68')]=util['format'](_0x6c35('0x69'),_0x5a57fe[_0x6c35('0x5c')]['name']);_0x4d47a1['message'][_0x6c35('0x6a')]=_0x4d47a1[_0x6c35('0x6a')];_0x4d47a1[_0x6c35('0x25')][_0x6c35('0x6b')]='accept';return respondWithRpcPromise(_0x6c35('0x6c'),_0x6c35('0x6c'),{'event':_0x6c35('0x6d'),'message':_0x4d47a1[_0x6c35('0x25')]},client9002)[_0x6c35('0x1e')](function(){return _0x4d47a1;});}return _0x4d47a1;}return null;})[_0x6c35('0x1e')](respondWithResult(_0x303c18,null))[_0x6c35('0x4d')](handleError(_0x303c18,null));};var interaction_log=require(_0x6c35('0x14'))(_0x6c35('0x55'));exports[_0x6c35('0x2e')]=function(_0x4c8847,_0x2658f6,_0x25bea8){var _0x3de82b={'agent':{},'channel':'fax'};if(_0x4c8847[_0x6c35('0x52')]['id']){delete _0x4c8847[_0x6c35('0x52')]['id'];}_0x4c8847[_0x6c35('0x52')][_0x6c35('0x5b')]=_0x4c8847['body'][_0x6c35('0x5b')]||_0x4c8847[_0x6c35('0x5c')]['id'];_0x3de82b[_0x6c35('0x6e')]['id']=_0x4c8847[_0x6c35('0x52')][_0x6c35('0x5b')];return db[_0x6c35('0x37')][_0x6c35('0x51')]({'where':{'id':_0x4c8847[_0x6c35('0x53')]['id'],'UserId':null}})[_0x6c35('0x1e')](handleEntityNotFound(_0x2658f6,null))[_0x6c35('0x1e')](function(_0x4c7706){if(_0x4c7706){_0x3de82b[_0x6c35('0x25')]=_0x4c7706['get']({'plain':!![]});return db[_0x6c35('0x60')][_0x6c35('0x51')]({'where':{'id':_0x4c7706[_0x6c35('0x61')]}});}return null;})[_0x6c35('0x1e')](handleEntityNotFound(_0x2658f6,null))[_0x6c35('0x1e')](function(_0x5691e8){if(_0x5691e8){_0x3de82b[_0x6c35('0x6f')]=_0x5691e8[_0x6c35('0x5f')]({'plain':!![]});interaction_log[_0x6c35('0x26')](_0x6c35('0x70'),_0x4c8847[_0x6c35('0x5c')]['id'],_0x4c8847[_0x6c35('0x5c')][_0x6c35('0x33')],_0x4c8847['user'][_0x6c35('0x71')],_0x3de82b['interaction']['id'],_0x4c8847[_0x6c35('0x52')]?JSON['stringify'](_0x4c8847[_0x6c35('0x52')]):_0x6c35('0x65'));return respondWithRpcPromise(_0x6c35('0x72'),'rejectMessage',_0x3de82b);}return null;})['then'](function(_0x30ba4e){if(_0x30ba4e){_0x30ba4e[_0x6c35('0x25')]['interface']=util['format'](_0x6c35('0x69'),_0x4c8847[_0x6c35('0x5c')]['name']);_0x30ba4e['message']['channel']=_0x3de82b[_0x6c35('0x6a')];_0x30ba4e[_0x6c35('0x25')][_0x6c35('0x6b')]=_0x6c35('0x2e');respondWithRpcPromise(_0x6c35('0x6c'),'EventManager',{'event':_0x6c35('0x73'),'message':_0x30ba4e[_0x6c35('0x25')]},client9002);return _0x3de82b;}return null;})[_0x6c35('0x1e')](respondWithResult(_0x2658f6,null))[_0x6c35('0x4d')](handleError(_0x2658f6,null));};exports[_0x6c35('0x74')]=function(_0x441828,_0x391a75){var _0x158364;return db[_0x6c35('0x37')][_0x6c35('0x74')](_0x441828[_0x6c35('0x52')],{})[_0x6c35('0x1e')](function(_0x57754c){_0x158364=_0x57754c;return db[_0x6c35('0x5d')]['findOne']({'where':{'id':_0x158364[_0x6c35('0x75')]}});})[_0x6c35('0x1e')](function(_0x4e9052){if(_[_0x6c35('0x62')](_0x4e9052)){return;}else{_0x158364[_0x6c35('0x57')]=_0x4e9052[_0x6c35('0x57')];return db['Attachment']['findOne']({'where':{'id':_0x158364[_0x6c35('0x76')]}});}})[_0x6c35('0x1e')](function(_0x45dad5){return respondWithRpcPromise(_0x6c35('0x77'),_0x6c35('0x77'),{'FaxAccountId':_[_0x6c35('0x62')](_0x441828[_0x6c35('0x52')])?undefined:_0x441828[_0x6c35('0x52')][_0x6c35('0x78')],'path':_[_0x6c35('0x62')](_0x45dad5)?undefined:util[_0x6c35('0x79')](_0x6c35('0x7a'),_0x45dad5[_0x6c35('0x7b')]),'fax':_[_0x6c35('0x62')](_0x158364[_0x6c35('0x57')])?undefined:_0x158364[_0x6c35('0x57')],'AttachmentId':_0x158364['AttachmentId']},client9002);})[_0x6c35('0x1e')](respondWithResult(_0x391a75,0xc9))['catch'](handleError(_0x391a75,null));};exports['download']=function(_0x1ebceb,_0x3b5975){var _0x1c2f56=path[_0x6c35('0x7c')](config[_0x6c35('0x7d')],_0x6c35('0x7e'),'files',_0x6c35('0x7f'));return db[_0x6c35('0x37')][_0x6c35('0x51')]({'where':{'id':_0x1ebceb[_0x6c35('0x53')]['id']},'include':[{'model':db[_0x6c35('0x80')],'as':_0x6c35('0x80')}]})['then'](handleEntityNotFound(_0x3b5975,null))['then'](function(_0x12d06b){if(_0x12d06b){return _0x3b5975['download'](path[_0x6c35('0x7c')](_0x1c2f56,_0x12d06b[_0x6c35('0x80')][_0x6c35('0x7b')]));}})[_0x6c35('0x4d')](handleError(_0x3b5975,null));}; \ No newline at end of file +var _0xfda2=['user','CmContact','Contact','get','FaxInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','null','RejectMessage','rejectMessage','event','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','isNil','basename','AttachmentId','download','join','root','server','files','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','json','count','limit','reject','destroy','sendStatus','stack','name','send','index','FaxMessage','model','map','query','intersection','fields','attributes','length','offset','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','update','body','fax-interactions','accept','fax','readAt','format','UserId'];(function(_0x53e4fd,_0xe40fa8){var _0x4df112=function(_0x31a4f5){while(--_0x31a4f5){_0x53e4fd['push'](_0x53e4fd['shift']());}};_0x4df112(++_0xe40fa8);}(_0xfda2,0x122));var _0x2fda=function(_0x47b1ff,_0x12f3c4){_0x47b1ff=_0x47b1ff-0x0;var _0x4505a8=_0xfda2[_0x47b1ff];return _0x4505a8;};'use strict';var pdf=require(_0x2fda('0x0'));var emlformat=require(_0x2fda('0x1'));var rimraf=require(_0x2fda('0x2'));var zipdir=require(_0x2fda('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fda('0x4'));var moment=require(_0x2fda('0x5'));var BPromise=require(_0x2fda('0x6'));var Mustache=require(_0x2fda('0x7'));var util=require(_0x2fda('0x8'));var path=require(_0x2fda('0x9'));var sox=require(_0x2fda('0xa'));var csv=require(_0x2fda('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2fda('0xc'));var squel=require('squel');var crypto=require(_0x2fda('0xd'));var jsforce=require(_0x2fda('0xe'));var deskjs=require(_0x2fda('0xf'));var toCsv=require(_0x2fda('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fda('0x11'));var as=require(_0x2fda('0x12'));var hardwareService=require(_0x2fda('0x13'));var logger=require(_0x2fda('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2fda('0x15'));var db=require(_0x2fda('0x16'))['db'];config[_0x2fda('0x17')]=_[_0x2fda('0x18')](config['redis'],{'host':_0x2fda('0x19'),'port':0x18eb});var socket=require(_0x2fda('0x1a'))(new Redis(config[_0x2fda('0x17')]));require(_0x2fda('0x1b'))[_0x2fda('0x1c')](socket);var jayson=require(_0x2fda('0x1d'));var client=jayson[_0x2fda('0x1e')][_0x2fda('0x1f')]({'port':0x232c});var client9002=jayson[_0x2fda('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x148cea,_0xecdfad,_0x15b474,_0x2e5eb7){return new BPromise(function(_0x3b1e9c,_0x3f3f2f){var _0x2073fb=_0x2e5eb7||client;return _0x2073fb['request'](_0x148cea,_0x15b474)[_0x2fda('0x20')](function(_0x33946c){logger[_0x2fda('0x21')](_0x2fda('0x22'),_0xecdfad,'request\x20sent');logger[_0x2fda('0x23')](_0x2fda('0x24'),_0xecdfad,_0x2fda('0x25'),JSON[_0x2fda('0x26')](_0x33946c));if(_0x33946c['error']){if(_0x33946c[_0x2fda('0x27')][_0x2fda('0x28')]===0x1f4){logger['error'](_0x2fda('0x22'),_0xecdfad,_0x33946c['error']['message']);return _0x3f3f2f(_0x33946c[_0x2fda('0x27')][_0x2fda('0x29')]);}logger[_0x2fda('0x27')](_0x2fda('0x22'),_0xecdfad,_0x33946c[_0x2fda('0x27')][_0x2fda('0x29')]);return _0x3b1e9c(_0x33946c['error']['message']);}else{logger['info'](_0x2fda('0x22'),_0xecdfad,_0x2fda('0x25'));_0x3b1e9c(_0x33946c['result'][_0x2fda('0x29')]);}})[_0x2fda('0x2a')](function(_0x374c83){logger[_0x2fda('0x27')](_0x2fda('0x22'),_0xecdfad,_0x374c83);_0x3f3f2f(_0x374c83);});});}function respondWithStatusCode(_0x1a7d76,_0x2cace4){_0x2cace4=_0x2cace4||0xcc;return function(_0x4b94e5){if(_0x4b94e5){return _0x1a7d76['sendStatus'](_0x2cace4);}return _0x1a7d76['status'](_0x2cace4)[_0x2fda('0x2b')]();};}function respondWithResult(_0x47a954,_0x4fc297){_0x4fc297=_0x4fc297||0xc8;return function(_0x35e246){if(_0x35e246){return _0x47a954[_0x2fda('0x2c')](_0x4fc297)[_0x2fda('0x2d')](_0x35e246);}};}function respondWithFilteredResult(_0x30611b,_0x1f5666){return function(_0x4c9770){if(_0x4c9770){var _0x4592dd=_0x4c9770[_0x2fda('0x2e')],_0x4098f8=_0x1f5666['offset'],_0xad31b2=_0x1f5666['offset']+_0x1f5666[_0x2fda('0x2f')],_0x5d5da;if(_0xad31b2>=_0x4592dd){_0xad31b2=_0x4592dd;_0x5d5da=0xc8;}else{_0x5d5da=0xce;}_0x30611b['status'](_0x5d5da);return _0x30611b['set']('Content-Range',_0x4098f8+'-'+_0xad31b2+'/'+_0x4592dd)[_0x2fda('0x2d')](_0x4c9770);}return null;};}function patchUpdates(_0x334f27){return function(_0x1f5f10){try{jsonpatch['apply'](_0x1f5f10,_0x334f27,!![]);}catch(_0x3260fc){return BPromise[_0x2fda('0x30')](_0x3260fc);}return _0x1f5f10['save']();};}function saveUpdates(_0x250e39,_0x4a1506){return function(_0x358549){if(_0x358549){return _0x358549['update'](_0x250e39)[_0x2fda('0x20')](function(_0x549da6){return _0x549da6;});}return null;};}function removeEntity(_0x2c5bc9,_0x28af91){return function(_0x169ed9){if(_0x169ed9){return _0x169ed9[_0x2fda('0x31')]()[_0x2fda('0x20')](function(){_0x2c5bc9[_0x2fda('0x2c')](0xcc)[_0x2fda('0x2b')]();});}};}function handleEntityNotFound(_0x145ab8,_0x550cad){return function(_0x18b7eb){if(!_0x18b7eb){_0x145ab8[_0x2fda('0x32')](0x194);}return _0x18b7eb;};}function handleError(_0xb9b8c5,_0x585b64){_0x585b64=_0x585b64||0x1f4;return function(_0x2866db){logger[_0x2fda('0x27')](_0x2866db[_0x2fda('0x33')]);if(_0x2866db[_0x2fda('0x34')]){delete _0x2866db[_0x2fda('0x34')];}_0xb9b8c5['status'](_0x585b64)[_0x2fda('0x35')](_0x2866db);};}exports[_0x2fda('0x36')]=function(_0x47faf8,_0x3d3199){var _0x36ed6a={},_0x49f789={},_0x58c750={'count':0x0,'rows':[]};var _0x5b5fd5=_['map'](db[_0x2fda('0x37')]['rawAttributes'],function(_0x187f2c){return{'name':_0x187f2c['fieldName'],'type':_0x187f2c['type']['key']};});_0x49f789[_0x2fda('0x38')]=_[_0x2fda('0x39')](_0x5b5fd5,_0x2fda('0x34'));_0x49f789['query']=_['keys'](_0x47faf8[_0x2fda('0x3a')]);_0x49f789['filters']=_[_0x2fda('0x3b')](_0x49f789[_0x2fda('0x38')],_0x49f789['query']);_0x36ed6a['attributes']=_[_0x2fda('0x3b')](_0x49f789['model'],qs['fields'](_0x47faf8['query'][_0x2fda('0x3c')]));_0x36ed6a[_0x2fda('0x3d')]=_0x36ed6a[_0x2fda('0x3d')][_0x2fda('0x3e')]?_0x36ed6a[_0x2fda('0x3d')]:_0x49f789['model'];if(!_0x47faf8[_0x2fda('0x3a')]['hasOwnProperty']('nolimit')){_0x36ed6a['limit']=qs[_0x2fda('0x2f')](_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x2f')]);_0x36ed6a['offset']=qs['offset'](_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x3f')]);}_0x36ed6a[_0x2fda('0x40')]=qs[_0x2fda('0x41')](_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x41')]);_0x36ed6a['where']=qs[_0x2fda('0x42')](_[_0x2fda('0x43')](_0x47faf8[_0x2fda('0x3a')],_0x49f789[_0x2fda('0x42')]),_0x5b5fd5);if(_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x44')]){_0x36ed6a[_0x2fda('0x45')]=_[_0x2fda('0x46')](_0x36ed6a[_0x2fda('0x45')],{'$or':_['map'](_0x5b5fd5,function(_0x45e99f){if(_0x45e99f[_0x2fda('0x47')]!==_0x2fda('0x48')){var _0x59f620={};_0x59f620[_0x45e99f[_0x2fda('0x34')]]={'$like':'%'+_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x44')]+'%'};return _0x59f620;}})});}_0x36ed6a=_[_0x2fda('0x46')]({},_0x36ed6a,_0x47faf8[_0x2fda('0x49')]);var _0x349c19={'where':_0x36ed6a[_0x2fda('0x45')]};return db[_0x2fda('0x37')][_0x2fda('0x2e')](_0x349c19)['then'](function(_0x34fdbd){_0x58c750[_0x2fda('0x2e')]=_0x34fdbd;if(_0x47faf8[_0x2fda('0x3a')][_0x2fda('0x4a')]){_0x36ed6a['include']=[{'all':!![]}];}return db[_0x2fda('0x37')][_0x2fda('0x4b')](_0x36ed6a);})[_0x2fda('0x20')](function(_0x1196b1){_0x58c750[_0x2fda('0x4c')]=_0x1196b1;return _0x58c750;})[_0x2fda('0x20')](respondWithFilteredResult(_0x3d3199,_0x36ed6a))[_0x2fda('0x2a')](handleError(_0x3d3199,null));};exports[_0x2fda('0x4d')]=function(_0x58c6e4,_0x383603){var _0x5a5fa6={'raw':!![],'where':{'id':_0x58c6e4[_0x2fda('0x4e')]['id']}},_0x33a6bc={};_0x33a6bc[_0x2fda('0x38')]=_['keys'](db[_0x2fda('0x37')][_0x2fda('0x4f')]);_0x33a6bc['query']=_[_0x2fda('0x50')](_0x58c6e4['query']);_0x33a6bc[_0x2fda('0x42')]=_[_0x2fda('0x3b')](_0x33a6bc[_0x2fda('0x38')],_0x33a6bc[_0x2fda('0x3a')]);_0x5a5fa6['attributes']=_[_0x2fda('0x3b')](_0x33a6bc['model'],qs['fields'](_0x58c6e4[_0x2fda('0x3a')][_0x2fda('0x3c')]));_0x5a5fa6['attributes']=_0x5a5fa6[_0x2fda('0x3d')][_0x2fda('0x3e')]?_0x5a5fa6[_0x2fda('0x3d')]:_0x33a6bc[_0x2fda('0x38')];if(_0x58c6e4[_0x2fda('0x3a')][_0x2fda('0x4a')]){_0x5a5fa6[_0x2fda('0x51')]=[{'all':!![]}];}_0x5a5fa6=_['merge']({},_0x5a5fa6,_0x58c6e4[_0x2fda('0x49')]);return db[_0x2fda('0x37')][_0x2fda('0x52')](_0x5a5fa6)['then'](handleEntityNotFound(_0x383603,null))['then'](respondWithResult(_0x383603,null))['catch'](handleError(_0x383603,null));};exports[_0x2fda('0x53')]=function(_0xa85e76,_0x4cca1e){if(_0xa85e76[_0x2fda('0x54')]['id']){delete _0xa85e76[_0x2fda('0x54')]['id'];}return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0xa85e76['params']['id']}})[_0x2fda('0x20')](handleEntityNotFound(_0x4cca1e,null))[_0x2fda('0x20')](saveUpdates(_0xa85e76[_0x2fda('0x54')],null))['then'](respondWithResult(_0x4cca1e,null))[_0x2fda('0x2a')](handleError(_0x4cca1e,null));};exports[_0x2fda('0x31')]=function(_0x4953f1,_0x312eca){return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0x4953f1[_0x2fda('0x4e')]['id']}})[_0x2fda('0x20')](handleEntityNotFound(_0x312eca,null))[_0x2fda('0x20')](removeEntity(_0x312eca,null))[_0x2fda('0x2a')](handleError(_0x312eca,null));};exports['describe']=function(_0x1346b9,_0x4113d5){return db[_0x2fda('0x37')]['describe']()['then'](respondWithResult(_0x4113d5,null))[_0x2fda('0x2a')](handleError(_0x4113d5,null));};var interaction_log=require('../../config/logger')(_0x2fda('0x55'));exports[_0x2fda('0x56')]=function(_0x212cef,_0x3a7b93,_0xd59bf5){var _0x506551={'channel':_0x2fda('0x57')};if(_0x212cef['body']['id']){delete _0x212cef[_0x2fda('0x54')]['id'];}_0x212cef[_0x2fda('0x54')]['read']=!![];_0x212cef[_0x2fda('0x54')][_0x2fda('0x58')]=moment()[_0x2fda('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x212cef[_0x2fda('0x54')][_0x2fda('0x5a')]=_0x212cef[_0x2fda('0x54')]['UserId']||_0x212cef[_0x2fda('0x5b')]['id'];return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0x212cef[_0x2fda('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0x2fda('0x5c')],'as':_0x2fda('0x5d')}]})[_0x2fda('0x20')](handleEntityNotFound(_0x3a7b93,null))[_0x2fda('0x20')](saveUpdates(_0x212cef[_0x2fda('0x54')],null))[_0x2fda('0x20')](function(_0xc2703d){if(_0xc2703d){_0x506551['message']=_0xc2703d[_0x2fda('0x5e')]({'plain':!![]});return db[_0x2fda('0x5f')]['find']({'where':{'id':_0xc2703d['FaxInteractionId']}});}return null;})[_0x2fda('0x20')](handleEntityNotFound(_0x3a7b93,null))[_0x2fda('0x20')](function(_0x51e546){if(_0x51e546){return _0x51e546['update']({'UserId':_0x212cef['body'][_0x2fda('0x5a')],'read1stAt':_['isNil'](_0x51e546[_0x2fda('0x60')])?moment()['format'](_0x2fda('0x61')):undefined});}return null;})[_0x2fda('0x20')](function(_0x2ec1ac){if(_0x2ec1ac){_0x506551[_0x2fda('0x62')]=_0x2ec1ac['get']({'plain':!![]});interaction_log['info'](_0x2fda('0x63'),_0x212cef[_0x2fda('0x5b')]['id'],_0x212cef['user'][_0x2fda('0x34')],_0x212cef[_0x2fda('0x5b')][_0x2fda('0x64')],_0x506551[_0x2fda('0x62')]['id'],_0x212cef[_0x2fda('0x54')]?JSON[_0x2fda('0x26')](_0x212cef[_0x2fda('0x54')]):'null');return respondWithRpcPromise(_0x2fda('0x65'),_0x2fda('0x66'),_0x506551);}return null;})[_0x2fda('0x20')](function(_0x1f6c4a){if(_0x1f6c4a){if(_0x212cef['body'][_0x2fda('0x67')]){_0x506551[_0x2fda('0x29')][_0x2fda('0x68')]=util[_0x2fda('0x59')](_0x2fda('0x69'),_0x212cef[_0x2fda('0x5b')]['name']);_0x506551['message']['channel']=_0x506551[_0x2fda('0x6a')];_0x506551[_0x2fda('0x29')]['event']=_0x2fda('0x56');return respondWithRpcPromise('EventManager',_0x2fda('0x6b'),{'event':_0x2fda('0x6c'),'message':_0x506551['message']},client9002)[_0x2fda('0x20')](function(){return _0x506551;});}return _0x506551;}return null;})[_0x2fda('0x20')](respondWithResult(_0x3a7b93,null))[_0x2fda('0x2a')](handleError(_0x3a7b93,null));};var interaction_log=require(_0x2fda('0x14'))(_0x2fda('0x55'));exports['reject']=function(_0x4cf796,_0x576c00,_0x1810de){var _0x490fe9={'agent':{},'channel':_0x2fda('0x57')};if(_0x4cf796[_0x2fda('0x54')]['id']){delete _0x4cf796[_0x2fda('0x54')]['id'];}_0x4cf796[_0x2fda('0x54')][_0x2fda('0x5a')]=_0x4cf796['body'][_0x2fda('0x5a')]||_0x4cf796[_0x2fda('0x5b')]['id'];_0x490fe9['agent']['id']=_0x4cf796[_0x2fda('0x54')][_0x2fda('0x5a')];return db[_0x2fda('0x37')][_0x2fda('0x52')]({'where':{'id':_0x4cf796['params']['id'],'UserId':null}})[_0x2fda('0x20')](handleEntityNotFound(_0x576c00,null))[_0x2fda('0x20')](function(_0x29578f){if(_0x29578f){_0x490fe9[_0x2fda('0x29')]=_0x29578f['get']({'plain':!![]});return db[_0x2fda('0x5f')][_0x2fda('0x52')]({'where':{'id':_0x29578f['FaxInteractionId']}});}return null;})[_0x2fda('0x20')](handleEntityNotFound(_0x576c00,null))[_0x2fda('0x20')](function(_0x3e73b8){if(_0x3e73b8){_0x490fe9[_0x2fda('0x62')]=_0x3e73b8[_0x2fda('0x5e')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4cf796['user']['id'],_0x4cf796[_0x2fda('0x5b')][_0x2fda('0x34')],_0x4cf796[_0x2fda('0x5b')][_0x2fda('0x64')],_0x490fe9[_0x2fda('0x62')]['id'],_0x4cf796[_0x2fda('0x54')]?JSON[_0x2fda('0x26')](_0x4cf796[_0x2fda('0x54')]):_0x2fda('0x6d'));return respondWithRpcPromise(_0x2fda('0x6e'),_0x2fda('0x6f'),_0x490fe9);}return null;})[_0x2fda('0x20')](function(_0x54c59e){if(_0x54c59e){_0x54c59e['message'][_0x2fda('0x68')]=util[_0x2fda('0x59')](_0x2fda('0x69'),_0x4cf796[_0x2fda('0x5b')][_0x2fda('0x34')]);_0x54c59e['message'][_0x2fda('0x6a')]=_0x490fe9['channel'];_0x54c59e[_0x2fda('0x29')][_0x2fda('0x70')]=_0x2fda('0x30');respondWithRpcPromise(_0x2fda('0x6b'),_0x2fda('0x6b'),{'event':'rejectmessage','message':_0x54c59e[_0x2fda('0x29')]},client9002);return _0x490fe9;}return null;})['then'](respondWithResult(_0x576c00,null))[_0x2fda('0x2a')](handleError(_0x576c00,null));};exports[_0x2fda('0x71')]=function(_0x403b26,_0x436576){var _0x9a59b;return db[_0x2fda('0x37')]['create'](_0x403b26[_0x2fda('0x54')],{})[_0x2fda('0x20')](function(_0x1f3bdf){_0x9a59b=_0x1f3bdf;return db['CmContact'][_0x2fda('0x72')]({'where':{'id':_0x9a59b[_0x2fda('0x73')]}});})['then'](function(_0x28e61f){if(_['isNil'](_0x28e61f)){return;}else{_0x9a59b[_0x2fda('0x57')]=_0x28e61f['fax'];return db[_0x2fda('0x74')][_0x2fda('0x72')]({'where':{'id':_0x9a59b['AttachmentId']}});}})[_0x2fda('0x20')](function(_0x2b4156){return respondWithRpcPromise(_0x2fda('0x75'),'SendFax',{'FaxAccountId':_['isNil'](_0x403b26[_0x2fda('0x54')])?undefined:_0x403b26['body'][_0x2fda('0x76')],'path':_[_0x2fda('0x77')](_0x2b4156)?undefined:util[_0x2fda('0x59')]('/var/opt/motion2/server/files/attachments/%s',_0x2b4156[_0x2fda('0x78')]),'fax':_[_0x2fda('0x77')](_0x9a59b[_0x2fda('0x57')])?undefined:_0x9a59b['fax'],'AttachmentId':_0x9a59b[_0x2fda('0x79')]},client9002);})[_0x2fda('0x20')](respondWithResult(_0x436576,0xc9))[_0x2fda('0x2a')](handleError(_0x436576,null));};exports[_0x2fda('0x7a')]=function(_0x320aaa,_0xf2e201){var _0x4b8874=path[_0x2fda('0x7b')](config[_0x2fda('0x7c')],_0x2fda('0x7d'),_0x2fda('0x7e'),'attachments');return db['FaxMessage'][_0x2fda('0x52')]({'where':{'id':_0x320aaa[_0x2fda('0x4e')]['id']},'include':[{'model':db[_0x2fda('0x74')],'as':_0x2fda('0x74')}]})[_0x2fda('0x20')](handleEntityNotFound(_0xf2e201,null))[_0x2fda('0x20')](function(_0x8af18){if(_0x8af18){return _0xf2e201['download'](path[_0x2fda('0x7b')](_0x4b8874,_0x8af18[_0x2fda('0x74')]['basename']));}})[_0x2fda('0x2a')](handleError(_0xf2e201,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 946f66c..cbaf617 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x2735d8,_0x7c3cf){var _0x2f3654=function(_0x3862b9){while(--_0x3862b9){_0x2735d8['push'](_0x2735d8['shift']());}};_0x2f3654(++_0x7c3cf);}(_0x008c,0x188));var _0xc008=function(_0x40b241,_0x2ce6cc){_0x40b241=_0x40b241-0x0;var _0x22b4b1=_0x008c[_0x40b241];return _0x22b4b1;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x6b4fe4,_0x4f2c29){_0x6b4fe4=_0x6b4fe4-0x0;var _0x46b758=_0xe14b[_0x6b4fe4];return _0x46b758;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b433ad0..e29d503 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 _0xa79f=['FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne'];(function(_0x599585,_0x1bc6bb){var _0x25d5ff=function(_0x3abc35){while(--_0x3abc35){_0x599585['push'](_0x599585['shift']());}};_0x25d5ff(++_0x1bc6bb);}(_0xa79f,0x77));var _0xfa79=function(_0x2205cc,_0x9f0d7d){_0x2205cc=_0x2205cc-0x0;var _0x29f7b4=_0xa79f[_0x2205cc];return _0x29f7b4;};'use strict';var _=require('lodash');var util=require(_0xfa79('0x0'));var logger=require(_0xfa79('0x1'))(_0xfa79('0x2'));var moment=require('moment');var BPromise=require(_0xfa79('0x3'));var rp=require(_0xfa79('0x4'));var fs=require('fs');var path=require(_0xfa79('0x5'));var rimraf=require('rimraf');var config=require(_0xfa79('0x6'));var attributes=require(_0xfa79('0x7'));module[_0xfa79('0x8')]=function(_0x3c8de9,_0x33b3e0){return _0x3c8de9['define'](_0xfa79('0x9'),attributes,{'tableName':_0xfa79('0xa'),'paranoid':![],'indexes':[{'name':_0xfa79('0xb'),'fields':['body'],'type':_0xfa79('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c1f78,_0x559b07,_0x2b64b7){var _0x1a5345=_0x3c8de9['models'];var _0x21e271=_0x4c1f78[_0xfa79('0xd')]({'plain':!![]});if(_0x21e271[_0xfa79('0xe')][_0xfa79('0xf')]()==='in'||_0x21e271[_0xfa79('0xe')][_0xfa79('0xf')]()===_0xfa79('0x10')&&!_0x21e271[_0xfa79('0x11')]&&!_[_0xfa79('0x12')](_0x21e271['UserId'])){_0x1a5345[_0xfa79('0x13')][_0xfa79('0x14')]({'where':{'id':_0x21e271[_0xfa79('0x15')]}})['then'](function(_0x25ffdd){if(_0x25ffdd){_0x25ffdd[_0xfa79('0x16')]({'lastMsgAt':_0x21e271[_0xfa79('0x17')],'lastMsgDirection':_0x21e271['direction'][_0xfa79('0xf')]()});}})[_0xfa79('0x18')](function(_0x7aedb){console[_0xfa79('0x19')](_0x7aedb);});}_0x2b64b7();}},'charset':_0xfa79('0x1a'),'collate':_0xfa79('0x1b')});}; \ No newline at end of file +var _0x6e77=['path','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird'];(function(_0x3177cc,_0xd023b2){var _0x1e9c8e=function(_0x2abb41){while(--_0x2abb41){_0x3177cc['push'](_0x3177cc['shift']());}};_0x1e9c8e(++_0xd023b2);}(_0x6e77,0x158));var _0x76e7=function(_0x51bc84,_0x519320){_0x51bc84=_0x51bc84-0x0;var _0x3a953e=_0x6e77[_0x51bc84];return _0x3a953e;};'use strict';var _=require('lodash');var util=require(_0x76e7('0x0'));var logger=require('../../config/logger')(_0x76e7('0x1'));var moment=require(_0x76e7('0x2'));var BPromise=require(_0x76e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e7('0x4'));var rimraf=require(_0x76e7('0x5'));var config=require(_0x76e7('0x6'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1c4f3d,_0x2c6516){return _0x1c4f3d[_0x76e7('0x7')](_0x76e7('0x8'),attributes,{'tableName':_0x76e7('0x9'),'paranoid':![],'indexes':[{'name':_0x76e7('0xa'),'fields':[_0x76e7('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x153380,_0x3fc60a,_0x362576){var _0x1212b6=_0x1c4f3d[_0x76e7('0xc')];var _0x45273b=_0x153380[_0x76e7('0xd')]({'plain':!![]});if(_0x45273b[_0x76e7('0xe')][_0x76e7('0xf')]()==='in'||_0x45273b['direction'][_0x76e7('0xf')]()==='out'&&!_0x45273b[_0x76e7('0x10')]&&!_[_0x76e7('0x11')](_0x45273b[_0x76e7('0x12')])){_0x1212b6[_0x76e7('0x13')][_0x76e7('0x14')]({'where':{'id':_0x45273b[_0x76e7('0x15')]}})[_0x76e7('0x16')](function(_0x26e02e){if(_0x26e02e){_0x26e02e[_0x76e7('0x17')]({'lastMsgAt':_0x45273b[_0x76e7('0x18')],'lastMsgDirection':_0x45273b[_0x76e7('0xe')]['toLowerCase']()});}})[_0x76e7('0x19')](function(_0x41073e){console[_0x76e7('0x1a')](_0x41073e);});}_0x362576();}},'charset':_0x76e7('0x1b'),'collate':_0x76e7('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2f136ef..2860cfc 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 _0xbf18=['update','where','attributes','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage'];(function(_0x57d6b2,_0x5c41aa){var _0x30fc38=function(_0x54ee89){while(--_0x54ee89){_0x57d6b2['push'](_0x57d6b2['shift']());}};_0x30fc38(++_0x5c41aa);}(_0xbf18,0x19b));var _0x8bf1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbf18[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8bf1('0x0'));var util=require(_0x8bf1('0x1'));var moment=require('moment');var BPromise=require(_0x8bf1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bf1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bf1('0x4'));var logger=require(_0x8bf1('0x5'))(_0x8bf1('0x6'));var config=require('../../config/environment');var jayson=require(_0x8bf1('0x7'));var client=jayson[_0x8bf1('0x8')][_0x8bf1('0x9')]({'port':0x232a});config['redis']=_[_0x8bf1('0xa')](config['redis'],{'host':_0x8bf1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bf1('0xc')]));require(_0x8bf1('0xd'))[_0x8bf1('0xe')](socket);function respondWithRpcPromise(_0x1b8c86,_0x166dd6,_0x285648){return new BPromise(function(_0x992e9b,_0x427dd2){return client['request'](_0x1b8c86,_0x285648)[_0x8bf1('0xf')](function(_0x4c8c62){logger['info'](_0x8bf1('0x10'),_0x166dd6,_0x8bf1('0x11'));logger[_0x8bf1('0x12')](_0x8bf1('0x13'),_0x166dd6,'request\x20sent',JSON[_0x8bf1('0x14')](_0x4c8c62));if(_0x4c8c62['error']){if(_0x4c8c62[_0x8bf1('0x15')][_0x8bf1('0x16')]===0x1f4){logger['error'](_0x8bf1('0x10'),_0x166dd6,_0x4c8c62[_0x8bf1('0x15')][_0x8bf1('0x17')]);return _0x427dd2(_0x4c8c62[_0x8bf1('0x15')][_0x8bf1('0x17')]);}logger[_0x8bf1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x166dd6,_0x4c8c62['error']['message']);return _0x992e9b(_0x4c8c62['error']['message']);}else{logger[_0x8bf1('0x18')]('FaxMessage,\x20%s,\x20%s',_0x166dd6,'request\x20sent');_0x992e9b(_0x4c8c62[_0x8bf1('0x19')][_0x8bf1('0x17')]);}})[_0x8bf1('0x1a')](function(_0x4ebe50){logger['error']('FaxMessage,\x20%s,\x20%s',_0x166dd6,_0x4ebe50);_0x427dd2(_0x4ebe50);});});}exports[_0x8bf1('0x1b')]=function(_0x135906){var _0x9a5160=this;return new Promise(function(_0x450e20,_0x2424c1){return db[_0x8bf1('0x1c')]['create'](_0x135906[_0x8bf1('0x1d')],{'raw':_0x135906[_0x8bf1('0x1e')]?_0x135906['options'][_0x8bf1('0x1f')]===undefined?!![]:![]:!![]})[_0x8bf1('0xf')](function(_0x56a86e){logger['info']('CreateFaxMessage',_0x135906);logger[_0x8bf1('0x12')](_0x8bf1('0x1b'),_0x135906,JSON['stringify'](_0x56a86e));_0x450e20(_0x56a86e);})[_0x8bf1('0x1a')](function(_0x32bc0d){logger[_0x8bf1('0x15')](_0x8bf1('0x1b'),_0x32bc0d[_0x8bf1('0x17')],_0x135906);_0x2424c1(_0x9a5160[_0x8bf1('0x15')](0x1f4,_0x32bc0d['message']));});});};exports[_0x8bf1('0x20')]=function(_0x4ed367){var _0x22a382=this;return new Promise(function(_0x2eba39,_0x37e31b){return db[_0x8bf1('0x1c')][_0x8bf1('0x21')](_0x4ed367[_0x8bf1('0x1d')],{'raw':_0x4ed367[_0x8bf1('0x1e')]?_0x4ed367[_0x8bf1('0x1e')][_0x8bf1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed367[_0x8bf1('0x1e')]?_0x4ed367[_0x8bf1('0x1e')][_0x8bf1('0x22')]||null:null,'attributes':_0x4ed367[_0x8bf1('0x1e')]?_0x4ed367['options'][_0x8bf1('0x23')]||null:null,'limit':_0x4ed367['options']?_0x4ed367[_0x8bf1('0x1e')][_0x8bf1('0x24')]||null:null})[_0x8bf1('0xf')](function(_0x49a65b){logger[_0x8bf1('0x18')]('UpdateFaxMessage',_0x4ed367);logger[_0x8bf1('0x12')](_0x8bf1('0x20'),_0x4ed367,JSON[_0x8bf1('0x14')](_0x49a65b));_0x2eba39(_0x49a65b);})['catch'](function(_0x4afa26){logger[_0x8bf1('0x15')]('UpdateFaxMessage',_0x4afa26[_0x8bf1('0x17')],_0x4ed367);_0x37e31b(_0x22a382[_0x8bf1('0x15')](0x1f4,_0x4afa26[_0x8bf1('0x17')]));});});}; \ No newline at end of file +var _0x7390=['update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','FaxMessage','create','options','CreateFaxMessage','UpdateFaxMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7390,0x1f1));var _0x0739=function(_0x52e0b5,_0x3481cb){_0x52e0b5=_0x52e0b5-0x0;var _0x3e0064=_0x7390[_0x52e0b5];return _0x3e0064;};'use strict';var _=require(_0x0739('0x0'));var util=require(_0x0739('0x1'));var moment=require(_0x0739('0x2'));var BPromise=require(_0x0739('0x3'));var rs=require(_0x0739('0x4'));var fs=require('fs');var Redis=require(_0x0739('0x5'));var db=require(_0x0739('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0739('0x7'))(_0x0739('0x8'));var config=require(_0x0739('0x9'));var jayson=require(_0x0739('0xa'));var client=jayson['client'][_0x0739('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0739('0xc')],{'host':_0x0739('0xd'),'port':0x18eb});var socket=require(_0x0739('0xe'))(new Redis(config['redis']));require(_0x0739('0xf'))[_0x0739('0x10')](socket);function respondWithRpcPromise(_0xe2a103,_0xeb9868,_0x3d7824){return new BPromise(function(_0x11f25a,_0x324a35){return client[_0x0739('0x11')](_0xe2a103,_0x3d7824)[_0x0739('0x12')](function(_0x283742){logger['info']('FaxMessage,\x20%s,\x20%s',_0xeb9868,'request\x20sent');logger[_0x0739('0x13')](_0x0739('0x14'),_0xeb9868,_0x0739('0x15'),JSON[_0x0739('0x16')](_0x283742));if(_0x283742['error']){if(_0x283742[_0x0739('0x17')][_0x0739('0x18')]===0x1f4){logger['error'](_0x0739('0x19'),_0xeb9868,_0x283742[_0x0739('0x17')][_0x0739('0x1a')]);return _0x324a35(_0x283742['error']['message']);}logger[_0x0739('0x17')](_0x0739('0x19'),_0xeb9868,_0x283742[_0x0739('0x17')][_0x0739('0x1a')]);return _0x11f25a(_0x283742[_0x0739('0x17')][_0x0739('0x1a')]);}else{logger[_0x0739('0x1b')]('FaxMessage,\x20%s,\x20%s',_0xeb9868,_0x0739('0x15'));_0x11f25a(_0x283742[_0x0739('0x1c')]['message']);}})[_0x0739('0x1d')](function(_0x2e2a3d){logger[_0x0739('0x17')](_0x0739('0x19'),_0xeb9868,_0x2e2a3d);_0x324a35(_0x2e2a3d);});});}exports['CreateFaxMessage']=function(_0xea4e43){var _0x2e8eb5=this;return new Promise(function(_0xbfccaa,_0xda8dde){return db[_0x0739('0x1e')][_0x0739('0x1f')](_0xea4e43['body'],{'raw':_0xea4e43[_0x0739('0x20')]?_0xea4e43[_0x0739('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x22d71e){logger[_0x0739('0x1b')](_0x0739('0x21'),_0xea4e43);logger[_0x0739('0x13')](_0x0739('0x21'),_0xea4e43,JSON[_0x0739('0x16')](_0x22d71e));_0xbfccaa(_0x22d71e);})[_0x0739('0x1d')](function(_0x334455){logger[_0x0739('0x17')](_0x0739('0x21'),_0x334455[_0x0739('0x1a')],_0xea4e43);_0xda8dde(_0x2e8eb5[_0x0739('0x17')](0x1f4,_0x334455['message']));});});};exports[_0x0739('0x22')]=function(_0x3d444c){var _0x334fdf=this;return new Promise(function(_0x4f1442,_0x3471b5){return db['FaxMessage'][_0x0739('0x23')](_0x3d444c['body'],{'raw':_0x3d444c[_0x0739('0x20')]?_0x3d444c[_0x0739('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d444c['options']?_0x3d444c['options'][_0x0739('0x24')]||null:null,'attributes':_0x3d444c[_0x0739('0x20')]?_0x3d444c[_0x0739('0x20')][_0x0739('0x25')]||null:null,'limit':_0x3d444c[_0x0739('0x20')]?_0x3d444c[_0x0739('0x20')]['limit']||null:null})[_0x0739('0x12')](function(_0x23c270){logger['info'](_0x0739('0x22'),_0x3d444c);logger[_0x0739('0x13')](_0x0739('0x22'),_0x3d444c,JSON[_0x0739('0x16')](_0x23c270));_0x4f1442(_0x23c270);})[_0x0739('0x1d')](function(_0x326567){logger[_0x0739('0x17')](_0x0739('0x22'),_0x326567[_0x0739('0x1a')],_0x3d444c);_0x3471b5(_0x334fdf[_0x0739('0x17')](0x1f4,_0x326567['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b9b8517..43c9ef9 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 c6a3e46..a79b2b9 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 _0x35fc=['tracked','create','put','update','accept','/:id/reject','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','download','post'];(function(_0x5cf245,_0x33976e){var _0x1178c7=function(_0x2183ff){while(--_0x2183ff){_0x5cf245['push'](_0x5cf245['shift']());}};_0x1178c7(++_0x33976e);}(_0x35fc,0x7f));var _0xc35f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x35fc[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xc35f('0x0'));var util=require(_0xc35f('0x1'));var path=require('path');var timeout=require(_0xc35f('0x2'));var express=require(_0xc35f('0x3'));var router=express[_0xc35f('0x4')]();var auth=require(_0xc35f('0x5'));var interaction=require(_0xc35f('0x6'));var config=require(_0xc35f('0x7'));var controller=require(_0xc35f('0x8'));router[_0xc35f('0x9')]('/',auth[_0xc35f('0xa')](),controller[_0xc35f('0xb')]);router[_0xc35f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc35f('0xc')]);router[_0xc35f('0x9')](_0xc35f('0xd'),auth[_0xc35f('0xa')](),controller[_0xc35f('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xc35f('0xf')]);router[_0xc35f('0x10')]('/',auth['isAuthenticated'](),interaction[_0xc35f('0x11')]('fax','faxmessage:create'),controller[_0xc35f('0x12')]);router[_0xc35f('0x13')](_0xc35f('0xd'),auth[_0xc35f('0xa')](),controller[_0xc35f('0x14')]);router[_0xc35f('0x13')]('/:id/accept',auth[_0xc35f('0xa')](),controller[_0xc35f('0x15')]);router[_0xc35f('0x13')](_0xc35f('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xc35f('0xd'),auth['isAuthenticated'](),controller[_0xc35f('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0aae=['./faxMessage.controller','get','isAuthenticated','index','/describe','show','/:id/download','download','tracked','fax','put','/:id','update','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x0aae,0x1dd));var _0xe0aa=function(_0x4a9900,_0x3e0400){_0x4a9900=_0x4a9900-0x0;var _0x2d7418=_0x0aae[_0x4a9900];return _0x2d7418;};'use strict';var multer=require(_0xe0aa('0x0'));var util=require(_0xe0aa('0x1'));var path=require(_0xe0aa('0x2'));var timeout=require(_0xe0aa('0x3'));var express=require(_0xe0aa('0x4'));var router=express[_0xe0aa('0x5')]();var auth=require(_0xe0aa('0x6'));var interaction=require(_0xe0aa('0x7'));var config=require(_0xe0aa('0x8'));var controller=require(_0xe0aa('0x9'));router[_0xe0aa('0xa')]('/',auth[_0xe0aa('0xb')](),controller[_0xe0aa('0xc')]);router['get'](_0xe0aa('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xe0aa('0xa')]('/:id',auth[_0xe0aa('0xb')](),controller[_0xe0aa('0xe')]);router[_0xe0aa('0xa')](_0xe0aa('0xf'),auth[_0xe0aa('0xb')](),controller[_0xe0aa('0x10')]);router['post']('/',auth[_0xe0aa('0xb')](),interaction[_0xe0aa('0x11')](_0xe0aa('0x12'),'faxmessage:create'),controller['create']);router[_0xe0aa('0x13')](_0xe0aa('0x14'),auth[_0xe0aa('0xb')](),controller[_0xe0aa('0x15')]);router[_0xe0aa('0x13')](_0xe0aa('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xe0aa('0x13')]('/:id/reject',auth[_0xe0aa('0xb')](),controller[_0xe0aa('0x17')]);router[_0xe0aa('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe0aa('0x19')]);module[_0xe0aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 94e58f6..51018a9 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 _0x3fc4=['sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x5a7ed9,_0x49b0e2){var _0x41b05=function(_0x3a8141){while(--_0x3a8141){_0x5a7ed9['push'](_0x5a7ed9['shift']());}};_0x41b05(++_0x49b0e2);}(_0x3fc4,0x1c2));var _0x43fc=function(_0x3f9dcd,_0x5323e4){_0x3f9dcd=_0x3f9dcd-0x0;var _0x4cfa61=_0x3fc4[_0x3f9dcd];return _0x4cfa61;};'use strict';var Sequelize=require(_0x43fc('0x0'));module[_0x43fc('0x1')]={'name':{'type':Sequelize[_0x43fc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x43fc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x43fc('0x4'),_0x43fc('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbada=['roundrobin','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x24ccb6,_0x20bcb2){var _0x492535=function(_0x2b1f7f){while(--_0x2b1f7f){_0x24ccb6['push'](_0x24ccb6['shift']());}};_0x492535(++_0x20bcb2);}(_0xbada,0x190));var _0xabad=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbada[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0xabad('0x0')]={'name':{'type':Sequelize[_0xabad('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xabad('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabad('0x3')](_0xabad('0x4'),_0xabad('0x5'),_0xabad('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xabad('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 401e741..b5787eb 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 _0xcd18=['agent','faxPause','updatedAt','format','createdAt','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','compact','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','FaxQueues','end','error','stack','name','send','FaxQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','sort','filter','merge','VIRTUAL','options','where','findAll','rows','catch','params','length','includeAll','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','pick','FaxQueueId','User','findAndCountAll','UserId'];(function(_0x466044,_0x50b7de){var _0xca6267=function(_0x5a4e5d){while(--_0x5a4e5d){_0x466044['push'](_0x466044['shift']());}};_0xca6267(++_0x50b7de);}(_0xcd18,0xb4));var _0x8cd1=function(_0x3396e8,_0x3048a3){_0x3396e8=_0x3396e8-0x0;var _0x296815=_0xcd18[_0x3396e8];return _0x296815;};'use strict';var pdf=require(_0x8cd1('0x0'));var emlformat=require(_0x8cd1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8cd1('0x2'));var jsonpatch=require(_0x8cd1('0x3'));var rp=require('request-promise');var moment=require(_0x8cd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cd1('0x5'));var util=require(_0x8cd1('0x6'));var path=require('path');var sox=require(_0x8cd1('0x7'));var csv=require(_0x8cd1('0x8'));var ejs=require(_0x8cd1('0x9'));var fs=require('fs');var _=require(_0x8cd1('0xa'));var squel=require(_0x8cd1('0xb'));var crypto=require(_0x8cd1('0xc'));var jsforce=require(_0x8cd1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8cd1('0x8'));var querystring=require(_0x8cd1('0xe'));var Papa=require(_0x8cd1('0xf'));var Redis=require(_0x8cd1('0x10'));var authService=require(_0x8cd1('0x11'));var qs=require(_0x8cd1('0x12'));var as=require(_0x8cd1('0x13'));var hardwareService=require(_0x8cd1('0x14'));var logger=require('../../config/logger')(_0x8cd1('0x15'));var utils=require(_0x8cd1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8cd1('0x17'));var db=require(_0x8cd1('0x18'))['db'];config['redis']=_[_0x8cd1('0x19')](config[_0x8cd1('0x1a')],{'host':_0x8cd1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cd1('0x1a')]));require(_0x8cd1('0x1c'))[_0x8cd1('0x1d')](socket);function respondWithStatusCode(_0x12736a,_0xa1a5a6){_0xa1a5a6=_0xa1a5a6||0xcc;return function(_0x75b1fd){if(_0x75b1fd){return _0x12736a[_0x8cd1('0x1e')](_0xa1a5a6);}return _0x12736a[_0x8cd1('0x1f')](_0xa1a5a6)['end']();};}function respondWithResult(_0x280f0a,_0x29292d){_0x29292d=_0x29292d||0xc8;return function(_0x23ff8d){if(_0x23ff8d){return _0x280f0a['status'](_0x29292d)[_0x8cd1('0x20')](_0x23ff8d);}};}function respondWithFilteredResult(_0x37f2be,_0x534426){return function(_0x2ceba1){if(_0x2ceba1){var _0x159b45=_0x2ceba1[_0x8cd1('0x21')],_0x21dcc4=_0x534426[_0x8cd1('0x22')],_0x5069ae=_0x534426['offset']+_0x534426[_0x8cd1('0x23')],_0x4147a2;if(_0x5069ae>=_0x159b45){_0x5069ae=_0x159b45;_0x4147a2=0xc8;}else{_0x4147a2=0xce;}_0x37f2be['status'](_0x4147a2);return _0x37f2be[_0x8cd1('0x24')](_0x8cd1('0x25'),_0x21dcc4+'-'+_0x5069ae+'/'+_0x159b45)['json'](_0x2ceba1);}return null;};}function patchUpdates(_0x11353b){return function(_0x2b8d70){try{jsonpatch[_0x8cd1('0x26')](_0x2b8d70,_0x11353b,!![]);}catch(_0x5aae20){return BPromise['reject'](_0x5aae20);}return _0x2b8d70[_0x8cd1('0x27')]();};}function saveUpdates(_0x1c68b4,_0x1506cb){return function(_0x5e861f){if(_0x5e861f){return _0x5e861f[_0x8cd1('0x28')](_0x1c68b4)[_0x8cd1('0x29')](function(_0xc9494e){return _0xc9494e;});}return null;};}function removeEntity(_0x5dddcd,_0x57c814){return function(_0x55fe48){if(_0x55fe48){return _0x55fe48[_0x8cd1('0x2a')]()[_0x8cd1('0x29')](function(){var _0x50a95e=_0x55fe48['get']({'plain':!![]});var _0x532457=_0x8cd1('0x2b');return db['UserProfileResource'][_0x8cd1('0x2a')]({'where':{'type':_0x532457,'resourceId':_0x50a95e['id']}})[_0x8cd1('0x29')](function(){return _0x55fe48;});})[_0x8cd1('0x29')](function(){_0x5dddcd['status'](0xcc)[_0x8cd1('0x2c')]();});}};}function handleEntityNotFound(_0x2fae55,_0x48babd){return function(_0x3b441c){if(!_0x3b441c){_0x2fae55[_0x8cd1('0x1e')](0x194);}return _0x3b441c;};}function handleError(_0x411ca2,_0x49b008){_0x49b008=_0x49b008||0x1f4;return function(_0x2f86d4){logger[_0x8cd1('0x2d')](_0x2f86d4[_0x8cd1('0x2e')]);if(_0x2f86d4[_0x8cd1('0x2f')]){delete _0x2f86d4[_0x8cd1('0x2f')];}_0x411ca2[_0x8cd1('0x1f')](_0x49b008)[_0x8cd1('0x30')](_0x2f86d4);};}exports['index']=function(_0x3dece5,_0x5ce70f){var _0x3734c6={},_0x121cec={},_0x1e6e24={'count':0x0,'rows':[]};var _0x17bacf=_['map'](db[_0x8cd1('0x31')][_0x8cd1('0x32')],function(_0x275d08){return{'name':_0x275d08[_0x8cd1('0x33')],'type':_0x275d08[_0x8cd1('0x34')]['key']};});_0x121cec[_0x8cd1('0x35')]=_[_0x8cd1('0x36')](_0x17bacf,_0x8cd1('0x2f'));_0x121cec[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x3dece5[_0x8cd1('0x37')]);_0x121cec[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x121cec[_0x8cd1('0x35')],_0x121cec[_0x8cd1('0x37')]);_0x3734c6[_0x8cd1('0x3b')]=_['intersection'](_0x121cec[_0x8cd1('0x35')],qs[_0x8cd1('0x3c')](_0x3dece5['query'][_0x8cd1('0x3c')]));_0x3734c6[_0x8cd1('0x3b')]=_0x3734c6[_0x8cd1('0x3b')]['length']?_0x3734c6[_0x8cd1('0x3b')]:_0x121cec['model'];if(!_0x3dece5[_0x8cd1('0x37')]['hasOwnProperty']('nolimit')){_0x3734c6[_0x8cd1('0x23')]=qs[_0x8cd1('0x23')](_0x3dece5['query'][_0x8cd1('0x23')]);_0x3734c6['offset']=qs[_0x8cd1('0x22')](_0x3dece5[_0x8cd1('0x37')][_0x8cd1('0x22')]);}_0x3734c6['order']=qs[_0x8cd1('0x3d')](_0x3dece5['query'][_0x8cd1('0x3d')]);_0x3734c6['where']=qs[_0x8cd1('0x39')](_['pick'](_0x3dece5['query'],_0x121cec[_0x8cd1('0x39')]),_0x17bacf);if(_0x3dece5['query'][_0x8cd1('0x3e')]){_0x3734c6['where']=_[_0x8cd1('0x3f')](_0x3734c6['where'],{'$or':_[_0x8cd1('0x36')](_0x17bacf,function(_0xb50181){if(_0xb50181[_0x8cd1('0x34')]!==_0x8cd1('0x40')){var _0x3ce544={};_0x3ce544[_0xb50181[_0x8cd1('0x2f')]]={'$like':'%'+_0x3dece5[_0x8cd1('0x37')][_0x8cd1('0x3e')]+'%'};return _0x3ce544;}})});}_0x3734c6=_[_0x8cd1('0x3f')]({},_0x3734c6,_0x3dece5[_0x8cd1('0x41')]);var _0x27e24c={'where':_0x3734c6[_0x8cd1('0x42')]};return db['FaxQueue'][_0x8cd1('0x21')](_0x27e24c)['then'](function(_0x2a77a6){_0x1e6e24['count']=_0x2a77a6;if(_0x3dece5[_0x8cd1('0x37')]['includeAll']){_0x3734c6['include']=[{'all':!![]}];}return db[_0x8cd1('0x31')][_0x8cd1('0x43')](_0x3734c6);})[_0x8cd1('0x29')](function(_0x51113){_0x1e6e24[_0x8cd1('0x44')]=_0x51113;return _0x1e6e24;})[_0x8cd1('0x29')](respondWithFilteredResult(_0x5ce70f,_0x3734c6))[_0x8cd1('0x45')](handleError(_0x5ce70f,null));};exports['show']=function(_0x2a8429,_0x7617a3){var _0x579c4c={'raw':!![],'where':{'id':_0x2a8429[_0x8cd1('0x46')]['id']}},_0x4f5af4={};_0x4f5af4[_0x8cd1('0x35')]=_['keys'](db['FaxQueue'][_0x8cd1('0x32')]);_0x4f5af4[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x2a8429['query']);_0x4f5af4[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x4f5af4[_0x8cd1('0x35')],_0x4f5af4[_0x8cd1('0x37')]);_0x579c4c[_0x8cd1('0x3b')]=_[_0x8cd1('0x3a')](_0x4f5af4['model'],qs[_0x8cd1('0x3c')](_0x2a8429['query'][_0x8cd1('0x3c')]));_0x579c4c[_0x8cd1('0x3b')]=_0x579c4c[_0x8cd1('0x3b')][_0x8cd1('0x47')]?_0x579c4c[_0x8cd1('0x3b')]:_0x4f5af4['model'];if(_0x2a8429[_0x8cd1('0x37')][_0x8cd1('0x48')]){_0x579c4c[_0x8cd1('0x49')]=[{'all':!![]}];}_0x579c4c=_[_0x8cd1('0x3f')]({},_0x579c4c,_0x2a8429[_0x8cd1('0x41')]);return db[_0x8cd1('0x31')][_0x8cd1('0x4a')](_0x579c4c)[_0x8cd1('0x29')](handleEntityNotFound(_0x7617a3,null))['then'](respondWithResult(_0x7617a3,null))[_0x8cd1('0x45')](handleError(_0x7617a3,null));};exports[_0x8cd1('0x4b')]=function(_0x47d2ca,_0x2e5363){return db['FaxQueue'][_0x8cd1('0x4b')](_0x47d2ca['body'],{})[_0x8cd1('0x29')](function(_0x43a449){var _0x2344fd=_0x47d2ca[_0x8cd1('0x4c')][_0x8cd1('0x4d')]({'plain':!![]});if(!_0x2344fd)throw new Error(_0x8cd1('0x4e'));if(_0x2344fd['role']==='user'){var _0x434345=_0x43a449[_0x8cd1('0x4d')]({'plain':!![]});var _0x3a7046=_0x8cd1('0x2b');return db[_0x8cd1('0x4f')]['find']({'where':{'name':_0x3a7046,'userProfileId':_0x2344fd[_0x8cd1('0x50')]},'raw':!![]})[_0x8cd1('0x29')](function(_0x313cf5){if(_0x313cf5&&_0x313cf5[_0x8cd1('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x434345[_0x8cd1('0x2f')],'resourceId':_0x434345['id'],'type':_0x313cf5[_0x8cd1('0x2f')],'sectionId':_0x313cf5['id']},{})['then'](function(){return _0x43a449;});}else{return _0x43a449;}})[_0x8cd1('0x45')](function(_0x56d09d){logger[_0x8cd1('0x2d')](_0x8cd1('0x52'),_0x56d09d);throw _0x56d09d;});}return _0x43a449;})['then'](respondWithResult(_0x2e5363,0xc9))[_0x8cd1('0x45')](handleError(_0x2e5363,null));};exports[_0x8cd1('0x28')]=function(_0x112ea1,_0x452dc6){if(_0x112ea1['body']['id']){delete _0x112ea1[_0x8cd1('0x53')]['id'];}return db['FaxQueue'][_0x8cd1('0x4a')]({'where':{'id':_0x112ea1[_0x8cd1('0x46')]['id']}})['then'](handleEntityNotFound(_0x452dc6,null))['then'](saveUpdates(_0x112ea1[_0x8cd1('0x53')],null))['then'](respondWithResult(_0x452dc6,null))[_0x8cd1('0x45')](handleError(_0x452dc6,null));};exports[_0x8cd1('0x2a')]=function(_0x4aedd0,_0x1bb460){return db[_0x8cd1('0x31')][_0x8cd1('0x4a')]({'where':{'id':_0x4aedd0[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x1bb460,null))['then'](removeEntity(_0x1bb460,null))[_0x8cd1('0x45')](handleError(_0x1bb460,null));};exports[_0x8cd1('0x54')]=function(_0x2d6f34,_0x8fd9f5){return db[_0x8cd1('0x31')]['describe']()['then'](respondWithResult(_0x8fd9f5,null))[_0x8cd1('0x45')](handleError(_0x8fd9f5,null));};exports[_0x8cd1('0x55')]=function(_0x364f98,_0x218bac,_0x32cc8e){var _0x20b6a3={'raw':!![],'where':{}},_0x3da29c={},_0x5835ef;return db['FaxQueue'][_0x8cd1('0x56')]({'where':{'id':_0x364f98[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x218bac,null))[_0x8cd1('0x29')](function(_0x356269){if(_0x356269){_0x5835ef=_0x356269[_0x8cd1('0x4d')]({'plain':!![]});_0x3da29c['model']=_[_0x8cd1('0x38')](db[_0x8cd1('0x57')][_0x8cd1('0x32')]);_0x3da29c[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x364f98['query']);_0x3da29c[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x3da29c['model'],_0x3da29c[_0x8cd1('0x37')]);_0x20b6a3['attributes']=_['intersection'](_0x3da29c['model'],qs['fields'](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x3c')]));_0x20b6a3['attributes']=_0x20b6a3[_0x8cd1('0x3b')][_0x8cd1('0x47')]?_0x20b6a3['attributes']:_0x3da29c[_0x8cd1('0x35')];if(!_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x58')](_0x8cd1('0x59'))){_0x20b6a3[_0x8cd1('0x23')]=qs[_0x8cd1('0x23')](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x23')]);_0x20b6a3['offset']=qs[_0x8cd1('0x22')](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x22')]);}_0x20b6a3[_0x8cd1('0x5a')]=qs[_0x8cd1('0x3d')](_0x364f98[_0x8cd1('0x37')][_0x8cd1('0x3d')]);_0x20b6a3[_0x8cd1('0x42')]=qs[_0x8cd1('0x39')](_[_0x8cd1('0x5b')](_0x364f98[_0x8cd1('0x37')],_0x3da29c[_0x8cd1('0x39')]));_0x20b6a3[_0x8cd1('0x42')][_0x8cd1('0x5c')]=_0x356269['id'];if(_0x364f98[_0x8cd1('0x37')]['filter']){_0x20b6a3['where']=_[_0x8cd1('0x3f')](_0x20b6a3[_0x8cd1('0x42')],{'$or':_[_0x8cd1('0x36')](_0x20b6a3[_0x8cd1('0x3b')],function(_0x525fb8){var _0x44db80={};_0x44db80[_0x525fb8]={'$like':'%'+_0x364f98['query'][_0x8cd1('0x3e')]+'%'};return _0x44db80;})});}_0x20b6a3=_[_0x8cd1('0x3f')]({},_0x20b6a3,_0x364f98['options']);return db[_0x8cd1('0x57')][_0x8cd1('0x43')](_0x20b6a3);}})[_0x8cd1('0x29')](function(_0x4f1624){if(_0x4f1624){return db[_0x8cd1('0x5d')][_0x8cd1('0x5e')]({'where':{'id':_[_0x8cd1('0x36')](_0x4f1624,_0x8cd1('0x5f')),'role':_0x8cd1('0x60')},'attributes':['id',_0x8cd1('0x2f'),_0x8cd1('0x61'),_0x8cd1('0x62'),'createdAt']});}})[_0x8cd1('0x29')](function(_0x58428b){if(_0x58428b){return{'count':_0x58428b[_0x8cd1('0x21')],'rows':_['map'](_0x58428b[_0x8cd1('0x44')],function(_0x56ff16){return{'membername':_0x56ff16[_0x8cd1('0x2f')],'UserId':_0x56ff16['id'],'queue_name':_0x5835ef['name'],'FaxQueueId':_0x5835ef['id'],'interface':util[_0x8cd1('0x63')]('%s/%s','SIP',_0x56ff16[_0x8cd1('0x2f')]),'penalty':0x0,'paused':_0x56ff16[_0x8cd1('0x61')],'createdAt':_0x56ff16[_0x8cd1('0x64')],'updatedAt':_0x56ff16[_0x8cd1('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8cd1('0x29')](respondWithFilteredResult(_0x218bac,_0x20b6a3))[_0x8cd1('0x45')](handleError(_0x218bac,null));};exports[_0x8cd1('0x65')]=function(_0x5c35dd,_0x12d6f4,_0x363b54){var _0x21bab7={};var _0x176074={};var _0x4cede2;var _0x386403;return db[_0x8cd1('0x31')]['findOne']({'where':{'id':_0x5c35dd['params']['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x12d6f4,null))[_0x8cd1('0x29')](function(_0x31888d){if(_0x31888d){_0x4cede2=_0x31888d;_0x176074['model']=_[_0x8cd1('0x38')](db[_0x8cd1('0x66')][_0x8cd1('0x32')]);_0x176074[_0x8cd1('0x37')]=_['keys'](_0x5c35dd[_0x8cd1('0x37')]);_0x176074[_0x8cd1('0x39')]=_['intersection'](_0x176074[_0x8cd1('0x35')],_0x176074[_0x8cd1('0x37')]);_0x21bab7['attributes']=_['intersection'](_0x176074[_0x8cd1('0x35')],qs[_0x8cd1('0x3c')](_0x5c35dd['query'][_0x8cd1('0x3c')]));_0x21bab7[_0x8cd1('0x3b')]=_0x21bab7[_0x8cd1('0x3b')]['length']?_0x21bab7['attributes']:_0x176074[_0x8cd1('0x35')];_0x21bab7[_0x8cd1('0x5a')]=qs[_0x8cd1('0x3d')](_0x5c35dd['query']['sort']);_0x21bab7[_0x8cd1('0x42')]=qs['filters'](_[_0x8cd1('0x5b')](_0x5c35dd[_0x8cd1('0x37')],_0x176074[_0x8cd1('0x39')]));if(_0x5c35dd[_0x8cd1('0x37')][_0x8cd1('0x3e')]){_0x21bab7['where']=_[_0x8cd1('0x3f')](_0x21bab7[_0x8cd1('0x42')],{'$or':_[_0x8cd1('0x36')](_0x21bab7[_0x8cd1('0x3b')],function(_0x4a0b6e){var _0x3cd7a1={};_0x3cd7a1[_0x4a0b6e]={'$like':'%'+_0x5c35dd[_0x8cd1('0x37')]['filter']+'%'};return _0x3cd7a1;})});}_0x21bab7=_[_0x8cd1('0x3f')]({},_0x21bab7,_0x5c35dd['options']);return _0x4cede2[_0x8cd1('0x65')](_0x21bab7);}})[_0x8cd1('0x29')](function(_0x13d3b1){if(_0x13d3b1){_0x386403=_0x13d3b1[_0x8cd1('0x47')];if(!_0x5c35dd[_0x8cd1('0x37')][_0x8cd1('0x58')]('nolimit')){_0x21bab7[_0x8cd1('0x23')]=qs[_0x8cd1('0x23')](_0x5c35dd['query'][_0x8cd1('0x23')]);_0x21bab7[_0x8cd1('0x22')]=qs[_0x8cd1('0x22')](_0x5c35dd[_0x8cd1('0x37')][_0x8cd1('0x22')]);}return _0x4cede2[_0x8cd1('0x65')](_0x21bab7);}})[_0x8cd1('0x29')](function(_0x55c354){if(_0x55c354){return _0x55c354?{'count':_0x386403,'rows':_0x55c354}:null;}})['then'](respondWithResult(_0x12d6f4,null))[_0x8cd1('0x45')](handleError(_0x12d6f4,null));};exports[_0x8cd1('0x67')]=function(_0x1e256e,_0x49be53,_0x52fb51){var _0x3b5310=_0x1e256e['body'][_0x8cd1('0x68')];return db[_0x8cd1('0x66')][_0x8cd1('0x43')]({'where':{'id':_0x3b5310},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x8cd1('0x69'),'voicePause',_0x8cd1('0x6a')],'raw':!![]}]})[_0x8cd1('0x29')](function(_0x39b0af){if(_0x39b0af){var _0x270a3f=_[_0x8cd1('0x6b')](_0x39b0af,function(_0x3d3018){var _0x2e4a48=_0x3d3018['get']({'plain':!![]});return _0x2e4a48[_0x8cd1('0x6c')];});return db[_0x8cd1('0x31')]['find']({'where':{'id':_0x1e256e[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](function(_0x1fef45){return db[_0x8cd1('0x6d')][_0x8cd1('0x6e')](function(_0x4ad61b){return _0x1fef45[_0x8cd1('0x67')](_0x3b5310,{'transaction':_0x4ad61b})[_0x8cd1('0x29')](function(){return BPromise['each'](_0x270a3f,function(_0x5b4fdd){return db[_0x8cd1('0x57')][_0x8cd1('0x6f')]({'where':{'UserId':_0x5b4fdd['id'],'FaxQueueId':_0x1e256e[_0x8cd1('0x46')]['id']},'transaction':_0x4ad61b});});})[_0x8cd1('0x29')](function(){_0x270a3f[_0x8cd1('0x70')](function(_0x4177dd){socket[_0x8cd1('0x71')](_0x8cd1('0x72'),{'UserId':_0x4177dd['id'],'FaxQueueId':_0x1fef45['id']});});});});});}})[_0x8cd1('0x29')](respondWithStatusCode(_0x49be53,null))['catch'](handleError(_0x49be53,null));};exports[_0x8cd1('0x73')]=function(_0x1d629e,_0x353c61,_0x497558){return db['Team'][_0x8cd1('0x43')]({'where':{'id':_0x1d629e[_0x8cd1('0x37')][_0x8cd1('0x68')]},'attributes':['id'],'include':[{'model':db[_0x8cd1('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x353c61,null))[_0x8cd1('0x29')](function(_0x12f284){var _0x36b51c=_[_0x8cd1('0x36')](_0x12f284,'id');var _0x2a7905=[];var _0x1c772f=[];var _0xedc148=squel[_0x8cd1('0x74')]();_0xedc148[_0x8cd1('0x75')](_0x8cd1('0x76'))['from'](_0x8cd1('0x77'),'tq')['join']('user_has_teams','ut',_0x8cd1('0x78'))[_0x8cd1('0x42')](_0x8cd1('0x79'),_0x1d629e[_0x8cd1('0x46')]['id']);for(var _0x5e0a46=0x0;_0x5e0a46<_0x12f284[_0x8cd1('0x47')];_0x5e0a46+=0x1){let _0x1545a3=_0x12f284[_0x5e0a46];for(var _0x1f0ddb=0x0;_0x1f0ddb<_0x1545a3['Agents'][_0x8cd1('0x47')];_0x1f0ddb+=0x1){let _0x242235=_0x1545a3['Agents'][_0x1f0ddb];var _0x2cacb1=_0xedc148[_0x8cd1('0x7a')]();_0x2cacb1[_0x8cd1('0x42')](_0x8cd1('0x7b'),_0x242235['id']);_0x1c772f[_0x8cd1('0x7c')](db[_0x8cd1('0x6d')][_0x8cd1('0x37')](_0x2cacb1[_0x8cd1('0x7d')](),{'type':db[_0x8cd1('0x6d')]['QueryTypes'][_0x8cd1('0x7e')]})['then'](function(_0x4e8f75){if(_0x4e8f75[_0x8cd1('0x47')]===0x1){return _0x242235['id'];}else{var _0x4710c9=_['every'](_[_0x8cd1('0x36')](_0x4e8f75,_0x8cd1('0x7f')),function(_0x562e22){return _[_0x8cd1('0x80')](_0x36b51c,_0x562e22);});if(_0x4710c9){return _0x242235['id'];}}}));}}return BPromise[_0x8cd1('0x81')](_0x1c772f)[_0x8cd1('0x29')](function(_0x52f2cf){_0x2a7905=_(_0x2a7905)['union'](_0x52f2cf)[_0x8cd1('0x82')]()['value']();return db['FaxQueue'][_0x8cd1('0x4a')]({'where':{'id':_0x1d629e[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](function(_0x350bbb){return db[_0x8cd1('0x6d')]['transaction'](function(_0x1afe33){return _0x350bbb[_0x8cd1('0x73')](_0x1d629e[_0x8cd1('0x37')][_0x8cd1('0x68')],{'transaction':_0x1afe33})[_0x8cd1('0x29')](function(){if(!_['isEmpty'](_0x2a7905)){return _0x350bbb[_0x8cd1('0x83')](_0x2a7905,{'transaction':_0x1afe33});}})[_0x8cd1('0x29')](function(){_0x2a7905[_0x8cd1('0x70')](function(_0x3b51a5){socket[_0x8cd1('0x71')](_0x8cd1('0x84'),{'UserId':_0x3b51a5,'FaxQueueId':_0x350bbb['id']});});});});});});})['then'](respondWithStatusCode(_0x353c61,null))[_0x8cd1('0x45')](handleError(_0x353c61,null));};exports[_0x8cd1('0x85')]=function(_0x54fbfa,_0x5eb5d4,_0x5d02ce){return db['FaxQueue'][_0x8cd1('0x4a')]({'where':{'id':_0x54fbfa['params']['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x5eb5d4,null))['then'](function(_0x2e7308){if(_0x2e7308){return _0x2e7308[_0x8cd1('0x85')](_0x54fbfa[_0x8cd1('0x53')][_0x8cd1('0x68')],_[_0x8cd1('0x86')](_0x54fbfa[_0x8cd1('0x53')],[_0x8cd1('0x68'),'id'])||{})[_0x8cd1('0x87')](function(_0x4b76a){for(var _0x4755bb=0x0;_0x4755bb<_0x54fbfa[_0x8cd1('0x53')]['ids'][_0x8cd1('0x47')];_0x4755bb+=0x1){socket[_0x8cd1('0x71')](_0x8cd1('0x72'),{'UserId':_0x54fbfa['body'][_0x8cd1('0x68')][_0x4755bb],'FaxQueueId':_0x54fbfa[_0x8cd1('0x46')]['id']});}return _0x4b76a;});}})['then'](respondWithResult(_0x5eb5d4,null))['catch'](handleError(_0x5eb5d4,null));};exports[_0x8cd1('0x83')]=function(_0x47e464,_0x51c350,_0x40366b){return db[_0x8cd1('0x31')][_0x8cd1('0x4a')]({'where':{'id':_0x47e464[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x51c350,null))[_0x8cd1('0x29')](function(_0x331170){if(_0x331170){return _0x331170[_0x8cd1('0x83')](_0x47e464[_0x8cd1('0x37')][_0x8cd1('0x68')])[_0x8cd1('0x29')](function(){if(_[_0x8cd1('0x88')](_0x47e464['query'][_0x8cd1('0x68')])){for(var _0x3057f7=0x0;_0x3057f7<_0x47e464[_0x8cd1('0x37')][_0x8cd1('0x68')]['length'];_0x3057f7+=0x1){socket[_0x8cd1('0x71')](_0x8cd1('0x84'),{'UserId':Number(_0x47e464['query'][_0x8cd1('0x68')][_0x3057f7]),'FaxQueueId':Number(_0x47e464[_0x8cd1('0x46')]['id'])});}}else{socket[_0x8cd1('0x71')](_0x8cd1('0x84'),{'UserId':Number(_0x47e464['query'][_0x8cd1('0x68')]),'FaxQueueId':Number(_0x47e464[_0x8cd1('0x46')]['id'])});}});}})[_0x8cd1('0x29')](respondWithStatusCode(_0x51c350,null))[_0x8cd1('0x45')](handleError(_0x51c350,null));};exports[_0x8cd1('0x89')]=function(_0x26e04b,_0x236e0b,_0x58c160){var _0x3e747e={};var _0x2aad5f={};var _0x229610;var _0x417b10;return db['FaxQueue']['findOne']({'where':{'id':_0x26e04b[_0x8cd1('0x46')]['id']}})[_0x8cd1('0x29')](handleEntityNotFound(_0x236e0b,null))['then'](function(_0x567cde){if(_0x567cde){_0x229610=_0x567cde;_0x2aad5f[_0x8cd1('0x35')]=_[_0x8cd1('0x38')](db[_0x8cd1('0x5d')]['rawAttributes']);_0x2aad5f[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x26e04b[_0x8cd1('0x37')]);_0x2aad5f[_0x8cd1('0x39')]=_[_0x8cd1('0x3a')](_0x2aad5f[_0x8cd1('0x35')],_0x2aad5f[_0x8cd1('0x37')]);_0x3e747e[_0x8cd1('0x3b')]=_[_0x8cd1('0x3a')](_0x2aad5f[_0x8cd1('0x35')],qs[_0x8cd1('0x3c')](_0x26e04b['query'][_0x8cd1('0x3c')]));_0x3e747e[_0x8cd1('0x3b')]=_0x3e747e['attributes']['length']?_0x3e747e[_0x8cd1('0x3b')]:_0x2aad5f[_0x8cd1('0x35')];_0x3e747e[_0x8cd1('0x5a')]=qs[_0x8cd1('0x3d')](_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x3d')]);_0x3e747e[_0x8cd1('0x42')]=qs[_0x8cd1('0x39')](_[_0x8cd1('0x5b')](_0x26e04b['query'],_0x2aad5f['filters']));if(_0x26e04b['query'][_0x8cd1('0x3e')]){_0x3e747e[_0x8cd1('0x42')]=_[_0x8cd1('0x3f')](_0x3e747e['where'],{'$or':_[_0x8cd1('0x36')](_0x3e747e[_0x8cd1('0x3b')],function(_0x1f5f3a){var _0x475a70={};_0x475a70[_0x1f5f3a]={'$like':'%'+_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x3e')]+'%'};return _0x475a70;})});}_0x3e747e=_[_0x8cd1('0x3f')]({},_0x3e747e,_0x26e04b[_0x8cd1('0x41')]);return _0x229610[_0x8cd1('0x89')](_0x3e747e);}})[_0x8cd1('0x29')](function(_0x36b889){if(_0x36b889){_0x417b10=_0x36b889[_0x8cd1('0x47')];if(!_0x26e04b['query'][_0x8cd1('0x58')]('nolimit')){_0x3e747e['limit']=qs[_0x8cd1('0x23')](_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x23')]);_0x3e747e[_0x8cd1('0x22')]=qs[_0x8cd1('0x22')](_0x26e04b[_0x8cd1('0x37')][_0x8cd1('0x22')]);}return _0x229610['getAgents'](_0x3e747e);}})[_0x8cd1('0x29')](function(_0x1ced03){if(_0x1ced03){return _0x1ced03?{'count':_0x417b10,'rows':_0x1ced03}:null;}})[_0x8cd1('0x29')](respondWithResult(_0x236e0b,null))[_0x8cd1('0x45')](handleError(_0x236e0b,null));}; \ No newline at end of file +var _0xeddd=['offset','limit','set','Content-Range','apply','update','then','destroy','get','FaxQueues','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','FaxQueue','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','rawAttributes','length','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','hasOwnProperty','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','tq.TeamId','team_has_fax_queues','join','user_has_teams','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count'];(function(_0x3c9def,_0x5384ea){var _0x591e39=function(_0x38a6ba){while(--_0x38a6ba){_0x3c9def['push'](_0x3c9def['shift']());}};_0x591e39(++_0x5384ea);}(_0xeddd,0x69));var _0xdedd=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xeddd[_0x3511d3];return _0x5d6321;};'use strict';var pdf=require(_0xdedd('0x0'));var emlformat=require(_0xdedd('0x1'));var rimraf=require(_0xdedd('0x2'));var zipdir=require(_0xdedd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdedd('0x4'));var moment=require('moment');var BPromise=require(_0xdedd('0x5'));var Mustache=require(_0xdedd('0x6'));var util=require('util');var path=require(_0xdedd('0x7'));var sox=require(_0xdedd('0x8'));var csv=require(_0xdedd('0x9'));var ejs=require(_0xdedd('0xa'));var fs=require('fs');var _=require(_0xdedd('0xb'));var squel=require(_0xdedd('0xc'));var crypto=require(_0xdedd('0xd'));var jsforce=require(_0xdedd('0xe'));var deskjs=require(_0xdedd('0xf'));var toCsv=require(_0xdedd('0x9'));var querystring=require(_0xdedd('0x10'));var Papa=require(_0xdedd('0x11'));var Redis=require('ioredis');var authService=require(_0xdedd('0x12'));var qs=require(_0xdedd('0x13'));var as=require(_0xdedd('0x14'));var hardwareService=require(_0xdedd('0x15'));var logger=require('../../config/logger')(_0xdedd('0x16'));var utils=require(_0xdedd('0x17'));var config=require(_0xdedd('0x18'));var licenseUtil=require(_0xdedd('0x19'));var db=require(_0xdedd('0x1a'))['db'];config[_0xdedd('0x1b')]=_[_0xdedd('0x1c')](config[_0xdedd('0x1b')],{'host':_0xdedd('0x1d'),'port':0x18eb});var socket=require(_0xdedd('0x1e'))(new Redis(config[_0xdedd('0x1b')]));require(_0xdedd('0x1f'))[_0xdedd('0x20')](socket);function respondWithStatusCode(_0x27b609,_0x477101){_0x477101=_0x477101||0xcc;return function(_0x298148){if(_0x298148){return _0x27b609[_0xdedd('0x21')](_0x477101);}return _0x27b609[_0xdedd('0x22')](_0x477101)[_0xdedd('0x23')]();};}function respondWithResult(_0x487a8a,_0x3cf7b6){_0x3cf7b6=_0x3cf7b6||0xc8;return function(_0x2beaec){if(_0x2beaec){return _0x487a8a['status'](_0x3cf7b6)[_0xdedd('0x24')](_0x2beaec);}};}function respondWithFilteredResult(_0x114694,_0x3c7ec9){return function(_0x4b16bb){if(_0x4b16bb){var _0x43611b=_0x4b16bb[_0xdedd('0x25')],_0x24e331=_0x3c7ec9['offset'],_0x4054b0=_0x3c7ec9[_0xdedd('0x26')]+_0x3c7ec9[_0xdedd('0x27')],_0x3bf0fc;if(_0x4054b0>=_0x43611b){_0x4054b0=_0x43611b;_0x3bf0fc=0xc8;}else{_0x3bf0fc=0xce;}_0x114694[_0xdedd('0x22')](_0x3bf0fc);return _0x114694[_0xdedd('0x28')](_0xdedd('0x29'),_0x24e331+'-'+_0x4054b0+'/'+_0x43611b)[_0xdedd('0x24')](_0x4b16bb);}return null;};}function patchUpdates(_0x20a655){return function(_0x187487){try{jsonpatch[_0xdedd('0x2a')](_0x187487,_0x20a655,!![]);}catch(_0x5b5855){return BPromise['reject'](_0x5b5855);}return _0x187487['save']();};}function saveUpdates(_0x53b2b2,_0x33b1a7){return function(_0x215e73){if(_0x215e73){return _0x215e73[_0xdedd('0x2b')](_0x53b2b2)[_0xdedd('0x2c')](function(_0x84639d){return _0x84639d;});}return null;};}function removeEntity(_0x4e0483,_0xce1515){return function(_0x2f5e4e){if(_0x2f5e4e){return _0x2f5e4e[_0xdedd('0x2d')]()[_0xdedd('0x2c')](function(){var _0x4e8396=_0x2f5e4e[_0xdedd('0x2e')]({'plain':!![]});var _0x39738a=_0xdedd('0x2f');return db[_0xdedd('0x30')][_0xdedd('0x2d')]({'where':{'type':_0x39738a,'resourceId':_0x4e8396['id']}})[_0xdedd('0x2c')](function(){return _0x2f5e4e;});})[_0xdedd('0x2c')](function(){_0x4e0483[_0xdedd('0x22')](0xcc)[_0xdedd('0x23')]();});}};}function handleEntityNotFound(_0x32d3eb,_0x269ded){return function(_0x10b7d3){if(!_0x10b7d3){_0x32d3eb[_0xdedd('0x21')](0x194);}return _0x10b7d3;};}function handleError(_0xa9b7ea,_0x6e4c22){_0x6e4c22=_0x6e4c22||0x1f4;return function(_0x59015a){logger['error'](_0x59015a['stack']);if(_0x59015a[_0xdedd('0x31')]){delete _0x59015a[_0xdedd('0x31')];}_0xa9b7ea[_0xdedd('0x22')](_0x6e4c22)[_0xdedd('0x32')](_0x59015a);};}exports[_0xdedd('0x33')]=function(_0x228594,_0x228307){var _0x1419b5={},_0x2ddda6={},_0x58fb39={'count':0x0,'rows':[]};var _0x68850e=_[_0xdedd('0x34')](db['FaxQueue']['rawAttributes'],function(_0x5eb164){return{'name':_0x5eb164[_0xdedd('0x35')],'type':_0x5eb164[_0xdedd('0x36')][_0xdedd('0x37')]};});_0x2ddda6[_0xdedd('0x38')]=_[_0xdedd('0x34')](_0x68850e,'name');_0x2ddda6[_0xdedd('0x39')]=_[_0xdedd('0x3a')](_0x228594[_0xdedd('0x39')]);_0x2ddda6[_0xdedd('0x3b')]=_[_0xdedd('0x3c')](_0x2ddda6[_0xdedd('0x38')],_0x2ddda6[_0xdedd('0x39')]);_0x1419b5['attributes']=_['intersection'](_0x2ddda6[_0xdedd('0x38')],qs['fields'](_0x228594[_0xdedd('0x39')][_0xdedd('0x3d')]));_0x1419b5[_0xdedd('0x3e')]=_0x1419b5[_0xdedd('0x3e')]['length']?_0x1419b5['attributes']:_0x2ddda6[_0xdedd('0x38')];if(!_0x228594['query']['hasOwnProperty'](_0xdedd('0x3f'))){_0x1419b5[_0xdedd('0x27')]=qs[_0xdedd('0x27')](_0x228594[_0xdedd('0x39')][_0xdedd('0x27')]);_0x1419b5[_0xdedd('0x26')]=qs[_0xdedd('0x26')](_0x228594['query'][_0xdedd('0x26')]);}_0x1419b5[_0xdedd('0x40')]=qs[_0xdedd('0x41')](_0x228594[_0xdedd('0x39')][_0xdedd('0x41')]);_0x1419b5['where']=qs[_0xdedd('0x3b')](_[_0xdedd('0x42')](_0x228594[_0xdedd('0x39')],_0x2ddda6[_0xdedd('0x3b')]),_0x68850e);if(_0x228594[_0xdedd('0x39')][_0xdedd('0x43')]){_0x1419b5[_0xdedd('0x44')]=_[_0xdedd('0x45')](_0x1419b5[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x68850e,function(_0x40eb06){if(_0x40eb06[_0xdedd('0x36')]!=='VIRTUAL'){var _0x20c30c={};_0x20c30c[_0x40eb06[_0xdedd('0x31')]]={'$like':'%'+_0x228594[_0xdedd('0x39')]['filter']+'%'};return _0x20c30c;}})});}_0x1419b5=_[_0xdedd('0x45')]({},_0x1419b5,_0x228594[_0xdedd('0x46')]);var _0x16de7d={'where':_0x1419b5[_0xdedd('0x44')]};return db[_0xdedd('0x47')]['count'](_0x16de7d)[_0xdedd('0x2c')](function(_0x5e75ec){_0x58fb39[_0xdedd('0x25')]=_0x5e75ec;if(_0x228594[_0xdedd('0x39')][_0xdedd('0x48')]){_0x1419b5[_0xdedd('0x49')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x1419b5);})[_0xdedd('0x2c')](function(_0x509de4){_0x58fb39[_0xdedd('0x4a')]=_0x509de4;return _0x58fb39;})[_0xdedd('0x2c')](respondWithFilteredResult(_0x228307,_0x1419b5))[_0xdedd('0x4b')](handleError(_0x228307,null));};exports[_0xdedd('0x4c')]=function(_0x192973,_0xcd0208){var _0x1a42a5={'raw':!![],'where':{'id':_0x192973['params']['id']}},_0x46336c={};_0x46336c[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db[_0xdedd('0x47')]['rawAttributes']);_0x46336c['query']=_[_0xdedd('0x3a')](_0x192973['query']);_0x46336c[_0xdedd('0x3b')]=_[_0xdedd('0x3c')](_0x46336c[_0xdedd('0x38')],_0x46336c[_0xdedd('0x39')]);_0x1a42a5[_0xdedd('0x3e')]=_[_0xdedd('0x3c')](_0x46336c[_0xdedd('0x38')],qs[_0xdedd('0x3d')](_0x192973[_0xdedd('0x39')][_0xdedd('0x3d')]));_0x1a42a5['attributes']=_0x1a42a5['attributes']['length']?_0x1a42a5[_0xdedd('0x3e')]:_0x46336c[_0xdedd('0x38')];if(_0x192973[_0xdedd('0x39')][_0xdedd('0x48')]){_0x1a42a5[_0xdedd('0x49')]=[{'all':!![]}];}_0x1a42a5=_[_0xdedd('0x45')]({},_0x1a42a5,_0x192973[_0xdedd('0x46')]);return db[_0xdedd('0x47')][_0xdedd('0x4d')](_0x1a42a5)[_0xdedd('0x2c')](handleEntityNotFound(_0xcd0208,null))[_0xdedd('0x2c')](respondWithResult(_0xcd0208,null))[_0xdedd('0x4b')](handleError(_0xcd0208,null));};exports['create']=function(_0x1d0ec6,_0x3a53a3){return db['FaxQueue'][_0xdedd('0x4e')](_0x1d0ec6[_0xdedd('0x4f')],{})[_0xdedd('0x2c')](function(_0x53541a){var _0x5dedcf=_0x1d0ec6[_0xdedd('0x50')][_0xdedd('0x2e')]({'plain':!![]});if(!_0x5dedcf)throw new Error(_0xdedd('0x51'));if(_0x5dedcf['role']===_0xdedd('0x50')){var _0x25dbd8=_0x53541a['get']({'plain':!![]});var _0x139445=_0xdedd('0x2f');return db[_0xdedd('0x52')][_0xdedd('0x4d')]({'where':{'name':_0x139445,'userProfileId':_0x5dedcf[_0xdedd('0x53')]},'raw':!![]})['then'](function(_0x3a0f5d){if(_0x3a0f5d&&_0x3a0f5d[_0xdedd('0x54')]===0x0){return db[_0xdedd('0x30')][_0xdedd('0x4e')]({'name':_0x25dbd8['name'],'resourceId':_0x25dbd8['id'],'type':_0x3a0f5d[_0xdedd('0x31')],'sectionId':_0x3a0f5d['id']},{})[_0xdedd('0x2c')](function(){return _0x53541a;});}else{return _0x53541a;}})['catch'](function(_0xe73e8b){logger[_0xdedd('0x55')](_0xdedd('0x56'),_0xe73e8b);throw _0xe73e8b;});}return _0x53541a;})[_0xdedd('0x2c')](respondWithResult(_0x3a53a3,0xc9))[_0xdedd('0x4b')](handleError(_0x3a53a3,null));};exports[_0xdedd('0x2b')]=function(_0x247bab,_0x264f3f){if(_0x247bab[_0xdedd('0x4f')]['id']){delete _0x247bab['body']['id'];}return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x247bab['params']['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x264f3f,null))[_0xdedd('0x2c')](saveUpdates(_0x247bab[_0xdedd('0x4f')],null))[_0xdedd('0x2c')](respondWithResult(_0x264f3f,null))[_0xdedd('0x4b')](handleError(_0x264f3f,null));};exports['destroy']=function(_0x5075db,_0x357289){return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x5075db[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x357289,null))[_0xdedd('0x2c')](removeEntity(_0x357289,null))['catch'](handleError(_0x357289,null));};exports['describe']=function(_0x3a96bf,_0x5ada74){return db[_0xdedd('0x47')][_0xdedd('0x58')]()[_0xdedd('0x2c')](respondWithResult(_0x5ada74,null))['catch'](handleError(_0x5ada74,null));};exports['getMembers']=function(_0x2b6b6d,_0x16ef8a,_0x59f6b5){var _0x2cb64f={'raw':!![],'where':{}},_0x14199c={},_0x15f095;return db[_0xdedd('0x47')][_0xdedd('0x59')]({'where':{'id':_0x2b6b6d[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x16ef8a,null))[_0xdedd('0x2c')](function(_0x52b1a2){if(_0x52b1a2){_0x15f095=_0x52b1a2[_0xdedd('0x2e')]({'plain':!![]});_0x14199c[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db[_0xdedd('0x5a')][_0xdedd('0x5b')]);_0x14199c['query']=_[_0xdedd('0x3a')](_0x2b6b6d[_0xdedd('0x39')]);_0x14199c['filters']=_[_0xdedd('0x3c')](_0x14199c[_0xdedd('0x38')],_0x14199c[_0xdedd('0x39')]);_0x2cb64f['attributes']=_[_0xdedd('0x3c')](_0x14199c[_0xdedd('0x38')],qs[_0xdedd('0x3d')](_0x2b6b6d[_0xdedd('0x39')]['fields']));_0x2cb64f[_0xdedd('0x3e')]=_0x2cb64f[_0xdedd('0x3e')][_0xdedd('0x5c')]?_0x2cb64f['attributes']:_0x14199c[_0xdedd('0x38')];if(!_0x2b6b6d[_0xdedd('0x39')]['hasOwnProperty']('nolimit')){_0x2cb64f[_0xdedd('0x27')]=qs['limit'](_0x2b6b6d[_0xdedd('0x39')][_0xdedd('0x27')]);_0x2cb64f[_0xdedd('0x26')]=qs[_0xdedd('0x26')](_0x2b6b6d[_0xdedd('0x39')][_0xdedd('0x26')]);}_0x2cb64f[_0xdedd('0x40')]=qs[_0xdedd('0x41')](_0x2b6b6d['query']['sort']);_0x2cb64f[_0xdedd('0x44')]=qs[_0xdedd('0x3b')](_[_0xdedd('0x42')](_0x2b6b6d[_0xdedd('0x39')],_0x14199c[_0xdedd('0x3b')]));_0x2cb64f['where'][_0xdedd('0x5d')]=_0x52b1a2['id'];if(_0x2b6b6d['query'][_0xdedd('0x43')]){_0x2cb64f[_0xdedd('0x44')]=_[_0xdedd('0x45')](_0x2cb64f[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x2cb64f[_0xdedd('0x3e')],function(_0x4da8cb){var _0x2a96de={};_0x2a96de[_0x4da8cb]={'$like':'%'+_0x2b6b6d[_0xdedd('0x39')]['filter']+'%'};return _0x2a96de;})});}_0x2cb64f=_[_0xdedd('0x45')]({},_0x2cb64f,_0x2b6b6d['options']);return db[_0xdedd('0x5a')][_0xdedd('0x5e')](_0x2cb64f);}})[_0xdedd('0x2c')](function(_0x3c80e4){if(_0x3c80e4){return db[_0xdedd('0x5f')][_0xdedd('0x60')]({'where':{'id':_[_0xdedd('0x34')](_0x3c80e4,_0xdedd('0x61')),'role':_0xdedd('0x62')},'attributes':['id',_0xdedd('0x31'),_0xdedd('0x63'),_0xdedd('0x64'),_0xdedd('0x65')]});}})[_0xdedd('0x2c')](function(_0x6e252e){if(_0x6e252e){return{'count':_0x6e252e['count'],'rows':_[_0xdedd('0x34')](_0x6e252e['rows'],function(_0x32baef){return{'membername':_0x32baef[_0xdedd('0x31')],'UserId':_0x32baef['id'],'queue_name':_0x15f095['name'],'FaxQueueId':_0x15f095['id'],'interface':util[_0xdedd('0x66')]('%s/%s',_0xdedd('0x67'),_0x32baef[_0xdedd('0x31')]),'penalty':0x0,'paused':_0x32baef[_0xdedd('0x63')],'createdAt':_0x32baef['createdAt'],'updatedAt':_0x32baef[_0xdedd('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdedd('0x2c')](respondWithFilteredResult(_0x16ef8a,_0x2cb64f))[_0xdedd('0x4b')](handleError(_0x16ef8a,null));};exports[_0xdedd('0x68')]=function(_0x31a94c,_0x312a32,_0x3044a2){var _0x1294b5={};var _0x5778b6={};var _0x4d748d;var _0x4882eb;return db['FaxQueue']['findOne']({'where':{'id':_0x31a94c[_0xdedd('0x57')]['id']}})['then'](handleEntityNotFound(_0x312a32,null))[_0xdedd('0x2c')](function(_0x2ca657){if(_0x2ca657){_0x4d748d=_0x2ca657;_0x5778b6[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db[_0xdedd('0x69')][_0xdedd('0x5b')]);_0x5778b6[_0xdedd('0x39')]=_[_0xdedd('0x3a')](_0x31a94c[_0xdedd('0x39')]);_0x5778b6[_0xdedd('0x3b')]=_[_0xdedd('0x3c')](_0x5778b6['model'],_0x5778b6[_0xdedd('0x39')]);_0x1294b5['attributes']=_[_0xdedd('0x3c')](_0x5778b6[_0xdedd('0x38')],qs['fields'](_0x31a94c[_0xdedd('0x39')][_0xdedd('0x3d')]));_0x1294b5[_0xdedd('0x3e')]=_0x1294b5[_0xdedd('0x3e')][_0xdedd('0x5c')]?_0x1294b5[_0xdedd('0x3e')]:_0x5778b6[_0xdedd('0x38')];_0x1294b5['order']=qs[_0xdedd('0x41')](_0x31a94c['query'][_0xdedd('0x41')]);_0x1294b5[_0xdedd('0x44')]=qs[_0xdedd('0x3b')](_[_0xdedd('0x42')](_0x31a94c[_0xdedd('0x39')],_0x5778b6[_0xdedd('0x3b')]));if(_0x31a94c['query'][_0xdedd('0x43')]){_0x1294b5[_0xdedd('0x44')]=_['merge'](_0x1294b5[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x1294b5[_0xdedd('0x3e')],function(_0x8733c4){var _0x2dd4e8={};_0x2dd4e8[_0x8733c4]={'$like':'%'+_0x31a94c[_0xdedd('0x39')][_0xdedd('0x43')]+'%'};return _0x2dd4e8;})});}_0x1294b5=_[_0xdedd('0x45')]({},_0x1294b5,_0x31a94c['options']);return _0x4d748d[_0xdedd('0x68')](_0x1294b5);}})[_0xdedd('0x2c')](function(_0x33f6ed){if(_0x33f6ed){_0x4882eb=_0x33f6ed[_0xdedd('0x5c')];if(!_0x31a94c[_0xdedd('0x39')][_0xdedd('0x6a')](_0xdedd('0x3f'))){_0x1294b5['limit']=qs[_0xdedd('0x27')](_0x31a94c[_0xdedd('0x39')][_0xdedd('0x27')]);_0x1294b5['offset']=qs['offset'](_0x31a94c[_0xdedd('0x39')][_0xdedd('0x26')]);}return _0x4d748d[_0xdedd('0x68')](_0x1294b5);}})['then'](function(_0x97246){if(_0x97246){return _0x97246?{'count':_0x4882eb,'rows':_0x97246}:null;}})[_0xdedd('0x2c')](respondWithResult(_0x312a32,null))[_0xdedd('0x4b')](handleError(_0x312a32,null));};exports['addTeams']=function(_0x22e961,_0x10e07f,_0x259221){var _0xc293b=_0x22e961['body'][_0xdedd('0x6b')];return db[_0xdedd('0x69')][_0xdedd('0x5e')]({'where':{'id':_0xc293b},'attributes':['id'],'include':[{'model':db[_0xdedd('0x5f')],'as':_0xdedd('0x6c'),'attributes':['id','name',_0xdedd('0x6d'),_0xdedd('0x6e'),'interface'],'raw':!![]}]})[_0xdedd('0x2c')](function(_0x54f2f4){if(_0x54f2f4){var _0x7013a6=_[_0xdedd('0x6f')](_0x54f2f4,function(_0x246c57){var _0x4da4ad=_0x246c57[_0xdedd('0x2e')]({'plain':!![]});return _0x4da4ad['Agents'];});return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x22e961['params']['id']}})[_0xdedd('0x2c')](function(_0x3ea47e){return db[_0xdedd('0x70')][_0xdedd('0x71')](function(_0x52e364){return _0x3ea47e['addTeams'](_0xc293b,{'transaction':_0x52e364})[_0xdedd('0x2c')](function(){return BPromise[_0xdedd('0x72')](_0x7013a6,function(_0x1e1c17){return db[_0xdedd('0x5a')][_0xdedd('0x73')]({'where':{'UserId':_0x1e1c17['id'],'FaxQueueId':_0x22e961[_0xdedd('0x57')]['id']},'transaction':_0x52e364});});})[_0xdedd('0x2c')](function(){_0x7013a6[_0xdedd('0x74')](function(_0x209e54){socket['emit'](_0xdedd('0x75'),{'UserId':_0x209e54['id'],'FaxQueueId':_0x3ea47e['id']});});});});});}})[_0xdedd('0x2c')](respondWithStatusCode(_0x10e07f,null))['catch'](handleError(_0x10e07f,null));};exports[_0xdedd('0x76')]=function(_0x3a403f,_0x18ec85,_0x573d10){return db[_0xdedd('0x69')][_0xdedd('0x5e')]({'where':{'id':_0x3a403f[_0xdedd('0x39')][_0xdedd('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdedd('0x2c')](handleEntityNotFound(_0x18ec85,null))[_0xdedd('0x2c')](function(_0x44355b){var _0x39da24=_['map'](_0x44355b,'id');var _0x3e38b9=[];var _0x5a527c=[];var _0x34bb88=squel[_0xdedd('0x77')]();_0x34bb88['field'](_0xdedd('0x78'))['from'](_0xdedd('0x79'),'tq')[_0xdedd('0x7a')](_0xdedd('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdedd('0x44')]('FaxQueueId\x20=\x20?',_0x3a403f[_0xdedd('0x57')]['id']);for(var _0x3b5bbb=0x0;_0x3b5bbb<_0x44355b[_0xdedd('0x5c')];_0x3b5bbb+=0x1){let _0x16e08e=_0x44355b[_0x3b5bbb];for(var _0x56f6fd=0x0;_0x56f6fd<_0x16e08e[_0xdedd('0x6c')][_0xdedd('0x5c')];_0x56f6fd+=0x1){let _0x1c1bff=_0x16e08e[_0xdedd('0x6c')][_0x56f6fd];var _0x1fd1ed=_0x34bb88[_0xdedd('0x7c')]();_0x1fd1ed['where']('ut.UserId\x20=\x20?',_0x1c1bff['id']);_0x5a527c[_0xdedd('0x7d')](db[_0xdedd('0x70')][_0xdedd('0x39')](_0x1fd1ed[_0xdedd('0x7e')](),{'type':db[_0xdedd('0x70')][_0xdedd('0x7f')]['SELECT']})[_0xdedd('0x2c')](function(_0x37d8d8){if(_0x37d8d8[_0xdedd('0x5c')]===0x1){return _0x1c1bff['id'];}else{var _0x149b47=_[_0xdedd('0x80')](_[_0xdedd('0x34')](_0x37d8d8,_0xdedd('0x81')),function(_0x442da6){return _[_0xdedd('0x82')](_0x39da24,_0x442da6);});if(_0x149b47){return _0x1c1bff['id'];}}}));}}return BPromise[_0xdedd('0x83')](_0x5a527c)[_0xdedd('0x2c')](function(_0x3fe50b){_0x3e38b9=_(_0x3e38b9)['union'](_0x3fe50b)[_0xdedd('0x84')]()[_0xdedd('0x85')]();return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x3a403f[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](function(_0x59ea70){return db[_0xdedd('0x70')][_0xdedd('0x71')](function(_0x156435){return _0x59ea70['removeTeams'](_0x3a403f['query']['ids'],{'transaction':_0x156435})[_0xdedd('0x2c')](function(){if(!_[_0xdedd('0x86')](_0x3e38b9)){return _0x59ea70[_0xdedd('0x87')](_0x3e38b9,{'transaction':_0x156435});}})[_0xdedd('0x2c')](function(){_0x3e38b9[_0xdedd('0x74')](function(_0x4b8d28){socket[_0xdedd('0x88')](_0xdedd('0x89'),{'UserId':_0x4b8d28,'FaxQueueId':_0x59ea70['id']});});});});});});})[_0xdedd('0x2c')](respondWithStatusCode(_0x18ec85,null))[_0xdedd('0x4b')](handleError(_0x18ec85,null));};exports[_0xdedd('0x8a')]=function(_0x29b24f,_0x33a697,_0x3213bc){return db[_0xdedd('0x47')][_0xdedd('0x4d')]({'where':{'id':_0x29b24f[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x33a697,null))[_0xdedd('0x2c')](function(_0x21c201){if(_0x21c201){return _0x21c201[_0xdedd('0x8a')](_0x29b24f[_0xdedd('0x4f')][_0xdedd('0x6b')],_[_0xdedd('0x8b')](_0x29b24f[_0xdedd('0x4f')],['ids','id'])||{})[_0xdedd('0x8c')](function(_0x4b4a02){for(var _0x1821bc=0x0;_0x1821bc<_0x29b24f[_0xdedd('0x4f')]['ids'][_0xdedd('0x5c')];_0x1821bc+=0x1){socket[_0xdedd('0x88')](_0xdedd('0x75'),{'UserId':_0x29b24f['body']['ids'][_0x1821bc],'FaxQueueId':_0x29b24f['params']['id']});}return _0x4b4a02;});}})[_0xdedd('0x2c')](respondWithResult(_0x33a697,null))['catch'](handleError(_0x33a697,null));};exports[_0xdedd('0x87')]=function(_0x118fdd,_0x4fc1f5,_0x5b6022){return db['FaxQueue'][_0xdedd('0x4d')]({'where':{'id':_0x118fdd[_0xdedd('0x57')]['id']}})[_0xdedd('0x2c')](handleEntityNotFound(_0x4fc1f5,null))[_0xdedd('0x2c')](function(_0x145992){if(_0x145992){return _0x145992[_0xdedd('0x87')](_0x118fdd['query'][_0xdedd('0x6b')])[_0xdedd('0x2c')](function(){if(_[_0xdedd('0x8d')](_0x118fdd[_0xdedd('0x39')][_0xdedd('0x6b')])){for(var _0x33f5cf=0x0;_0x33f5cf<_0x118fdd[_0xdedd('0x39')][_0xdedd('0x6b')][_0xdedd('0x5c')];_0x33f5cf+=0x1){socket[_0xdedd('0x88')]('userFaxQueue:remove',{'UserId':Number(_0x118fdd[_0xdedd('0x39')][_0xdedd('0x6b')][_0x33f5cf]),'FaxQueueId':Number(_0x118fdd[_0xdedd('0x57')]['id'])});}}else{socket[_0xdedd('0x88')](_0xdedd('0x89'),{'UserId':Number(_0x118fdd[_0xdedd('0x39')]['ids']),'FaxQueueId':Number(_0x118fdd['params']['id'])});}});}})[_0xdedd('0x2c')](respondWithStatusCode(_0x4fc1f5,null))[_0xdedd('0x4b')](handleError(_0x4fc1f5,null));};exports['getAgents']=function(_0xfa9fa9,_0x5e9430,_0x5b33c6){var _0x42da40={};var _0x4b4e20={};var _0xc3e88a;var _0x1c2823;return db[_0xdedd('0x47')][_0xdedd('0x59')]({'where':{'id':_0xfa9fa9[_0xdedd('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e9430,null))[_0xdedd('0x2c')](function(_0x3fc1ed){if(_0x3fc1ed){_0xc3e88a=_0x3fc1ed;_0x4b4e20[_0xdedd('0x38')]=_[_0xdedd('0x3a')](db['User'][_0xdedd('0x5b')]);_0x4b4e20[_0xdedd('0x39')]=_['keys'](_0xfa9fa9[_0xdedd('0x39')]);_0x4b4e20[_0xdedd('0x3b')]=_['intersection'](_0x4b4e20['model'],_0x4b4e20[_0xdedd('0x39')]);_0x42da40['attributes']=_[_0xdedd('0x3c')](_0x4b4e20['model'],qs[_0xdedd('0x3d')](_0xfa9fa9[_0xdedd('0x39')]['fields']));_0x42da40[_0xdedd('0x3e')]=_0x42da40[_0xdedd('0x3e')]['length']?_0x42da40[_0xdedd('0x3e')]:_0x4b4e20[_0xdedd('0x38')];_0x42da40[_0xdedd('0x40')]=qs[_0xdedd('0x41')](_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x41')]);_0x42da40[_0xdedd('0x44')]=qs['filters'](_['pick'](_0xfa9fa9[_0xdedd('0x39')],_0x4b4e20[_0xdedd('0x3b')]));if(_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x43')]){_0x42da40[_0xdedd('0x44')]=_['merge'](_0x42da40[_0xdedd('0x44')],{'$or':_[_0xdedd('0x34')](_0x42da40['attributes'],function(_0x3a808d){var _0xecd21d={};_0xecd21d[_0x3a808d]={'$like':'%'+_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x43')]+'%'};return _0xecd21d;})});}_0x42da40=_['merge']({},_0x42da40,_0xfa9fa9[_0xdedd('0x46')]);return _0xc3e88a[_0xdedd('0x8e')](_0x42da40);}})[_0xdedd('0x2c')](function(_0x638b08){if(_0x638b08){_0x1c2823=_0x638b08['length'];if(!_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x6a')](_0xdedd('0x3f'))){_0x42da40[_0xdedd('0x27')]=qs[_0xdedd('0x27')](_0xfa9fa9['query'][_0xdedd('0x27')]);_0x42da40[_0xdedd('0x26')]=qs[_0xdedd('0x26')](_0xfa9fa9[_0xdedd('0x39')][_0xdedd('0x26')]);}return _0xc3e88a[_0xdedd('0x8e')](_0x42da40);}})[_0xdedd('0x2c')](function(_0x58db5a){if(_0x58db5a){return _0x58db5a?{'count':_0x1c2823,'rows':_0x58db5a}:null;}})['then'](respondWithResult(_0x5e9430,null))['catch'](handleError(_0x5e9430,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index aae2af0..175254e 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 _0xda53=['exports','../../mysqldb','FaxQueue','update','hook'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xda53,0x114));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x3da5('0x0'))['db'][_0x3da5('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3da5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x43cc83){return function(_0x560f9d,_0x4a57f9,_0x3cb14f){FaxQueueEvents['emit'](_0x43cc83+':'+_0x560f9d['id'],_0x560f9d);FaxQueueEvents['emit'](_0x43cc83,_0x560f9d);_0x3cb14f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x3da5('0x3')](e,emitEvent(event));}}module[_0x3da5('0x4')]=FaxQueueEvents; \ No newline at end of file +var _0x0cbd=['exports','events','../../mysqldb','FaxQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x54d4b1,_0x51fceb){var _0x1e7cfe=function(_0x51216c){while(--_0x51216c){_0x54d4b1['push'](_0x54d4b1['shift']());}};_0x1e7cfe(++_0x51fceb);}(_0x0cbd,0x1af));var _0xd0cb=function(_0x241572,_0x3b7fe0){_0x241572=_0x241572-0x0;var _0x2e1273=_0x0cbd[_0x241572];return _0x2e1273;};'use strict';var EventEmitter=require(_0xd0cb('0x0'));var FaxQueue=require(_0xd0cb('0x1'))['db'][_0xd0cb('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd0cb('0x3'),'afterUpdate':_0xd0cb('0x4'),'afterDestroy':_0xd0cb('0x5')};function emitEvent(_0x46f552){return function(_0x42cf15,_0x576f9b,_0x2b1338){FaxQueueEvents[_0xd0cb('0x6')](_0x46f552+':'+_0x42cf15['id'],_0x42cf15);FaxQueueEvents['emit'](_0x46f552,_0x42cf15);_0x2b1338(null);};}for(var e in events){if(events[_0xd0cb('0x7')](e)){var event=events[e];FaxQueue[_0xd0cb('0x8')](e,emitEvent(event));}}module[_0xd0cb('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 78a720c..021fd3e 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 _0x7c6f=['request-promise','path','rimraf','exports','define','fax_queues','lodash','util','../../config/logger'];(function(_0x362689,_0x32f169){var _0x11f999=function(_0x2df9c8){while(--_0x2df9c8){_0x362689['push'](_0x362689['shift']());}};_0x11f999(++_0x32f169);}(_0x7c6f,0x141));var _0xf7c6=function(_0x76d1ca,_0x2577ad){_0x76d1ca=_0x76d1ca-0x0;var _0x5a056=_0x7c6f[_0x76d1ca];return _0x5a056;};'use strict';var _=require(_0xf7c6('0x0'));var util=require(_0xf7c6('0x1'));var logger=require(_0xf7c6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7c6('0x3'));var fs=require('fs');var path=require(_0xf7c6('0x4'));var rimraf=require(_0xf7c6('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xf7c6('0x6')]=function(_0x2c85ac,_0x1e015b){return _0x2c85ac[_0xf7c6('0x7')]('FaxQueue',attributes,{'tableName':_0xf7c6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x718a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','FaxQueue','lodash'];(function(_0x1011dd,_0xa51bac){var _0x57e2a8=function(_0x39c2e6){while(--_0x39c2e6){_0x1011dd['push'](_0x1011dd['shift']());}};_0x57e2a8(++_0xa51bac);}(_0x718a,0x149));var _0xa718=function(_0x47fbda,_0x3b52d2){_0x47fbda=_0x47fbda-0x0;var _0x5c1b36=_0x718a[_0x47fbda];return _0x5c1b36;};'use strict';var _=require(_0xa718('0x0'));var util=require('util');var logger=require(_0xa718('0x1'))(_0xa718('0x2'));var moment=require(_0xa718('0x3'));var BPromise=require(_0xa718('0x4'));var rp=require(_0xa718('0x5'));var fs=require('fs');var path=require(_0xa718('0x6'));var rimraf=require(_0xa718('0x7'));var config=require(_0xa718('0x8'));var attributes=require(_0xa718('0x9'));module['exports']=function(_0x53fb4a,_0x3ef119){return _0x53fb4a['define'](_0xa718('0xa'),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 1c85581..2f365ab 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 _0xc24f=['message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2d3627,_0x12bf50){var _0x42d073=function(_0x26d96a){while(--_0x26d96a){_0x2d3627['push'](_0x2d3627['shift']());}};_0x42d073(++_0x12bf50);}(_0xc24f,0x148));var _0xfc24=function(_0x2b581a,_0x1e8ed7){_0x2b581a=_0x2b581a-0x0;var _0xd46de1=_0xc24f[_0x2b581a];return _0xd46de1;};'use strict';var _=require(_0xfc24('0x0'));var util=require(_0xfc24('0x1'));var moment=require(_0xfc24('0x2'));var BPromise=require(_0xfc24('0x3'));var rs=require(_0xfc24('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc24('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfc24('0x6'));var jayson=require(_0xfc24('0x7'));var client=jayson[_0xfc24('0x8')][_0xfc24('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc24('0xa')]));require(_0xfc24('0xb'))[_0xfc24('0xc')](socket);function respondWithRpcPromise(_0xd50919,_0x32be92,_0x428949){return new BPromise(function(_0x49b20c,_0x3b6398){return client[_0xfc24('0xd')](_0xd50919,_0x428949)[_0xfc24('0xe')](function(_0x1186f1){logger[_0xfc24('0xf')](_0xfc24('0x10'),_0x32be92,_0xfc24('0x11'));logger[_0xfc24('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x32be92,_0xfc24('0x11'),JSON[_0xfc24('0x13')](_0x1186f1));if(_0x1186f1[_0xfc24('0x14')]){if(_0x1186f1['error'][_0xfc24('0x15')]===0x1f4){logger[_0xfc24('0x14')](_0xfc24('0x10'),_0x32be92,_0x1186f1[_0xfc24('0x14')]['message']);return _0x3b6398(_0x1186f1[_0xfc24('0x14')][_0xfc24('0x16')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x32be92,_0x1186f1['error'][_0xfc24('0x16')]);return _0x49b20c(_0x1186f1[_0xfc24('0x14')][_0xfc24('0x16')]);}else{logger[_0xfc24('0xf')]('FaxQueue,\x20%s,\x20%s',_0x32be92,_0xfc24('0x11'));_0x49b20c(_0x1186f1['result']['message']);}})[_0xfc24('0x17')](function(_0x43ba15){logger['error']('FaxQueue,\x20%s,\x20%s',_0x32be92,_0x43ba15);_0x3b6398(_0x43ba15);});});}exports[_0xfc24('0x18')]=function(_0x371963){var _0x4649f2=this;return new Promise(function(_0x133421,_0x59b599){return db[_0xfc24('0x19')]['findAll']({'raw':_0x371963[_0xfc24('0x1a')]?_0x371963[_0xfc24('0x1a')][_0xfc24('0x1b')]===undefined?!![]:![]:!![],'where':_0x371963['options']?_0x371963[_0xfc24('0x1a')][_0xfc24('0x1c')]||null:null,'attributes':_0x371963['options']?_0x371963['options'][_0xfc24('0x1d')]||null:null,'limit':_0x371963[_0xfc24('0x1a')]?_0x371963['options']['limit']||null:null,'include':_0x371963[_0xfc24('0x1a')]?_0x371963[_0xfc24('0x1a')][_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x371963[_0xfc24('0x1a')][_0xfc24('0x1e')],function(_0x4122e0){return{'model':db[_0x4122e0[_0xfc24('0x20')]],'as':_0x4122e0['as'],'attributes':_0x4122e0['attributes'],'include':_0x4122e0[_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x4122e0[_0xfc24('0x1e')],function(_0x129f91){return{'model':db[_0x129f91[_0xfc24('0x20')]],'as':_0x129f91['as'],'attributes':_0x129f91[_0xfc24('0x1d')],'include':_0x129f91[_0xfc24('0x1e')]?_['map'](_0x129f91[_0xfc24('0x1e')],function(_0x25a36e){return{'model':db[_0x25a36e[_0xfc24('0x20')]],'as':_0x25a36e['as'],'attributes':_0x25a36e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc24('0xe')](function(_0x34f513){logger[_0xfc24('0xf')](_0xfc24('0x18'),_0x371963);logger[_0xfc24('0x12')](_0xfc24('0x18'),_0x371963,JSON[_0xfc24('0x13')](_0x34f513));_0x133421(_0x34f513);})[_0xfc24('0x17')](function(_0x5856c7){logger[_0xfc24('0x14')](_0xfc24('0x18'),_0x5856c7[_0xfc24('0x16')],_0x371963);_0x59b599(_0x4649f2[_0xfc24('0x14')](0x1f4,_0x5856c7[_0xfc24('0x16')]));});});};exports[_0xfc24('0x21')]=function(_0x155fd7){var _0x134e1e=this;return new Promise(function(_0xec2f4b,_0x338764){return db[_0xfc24('0x19')][_0xfc24('0x22')]({'raw':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7[_0xfc24('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7[_0xfc24('0x1a')][_0xfc24('0x1c')]||null:null,'attributes':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7[_0xfc24('0x1a')][_0xfc24('0x1d')]||null:null,'include':_0x155fd7[_0xfc24('0x1a')]?_0x155fd7['options'][_0xfc24('0x1e')]?_['map'](_0x155fd7[_0xfc24('0x1a')][_0xfc24('0x1e')],function(_0x352c2f){return{'model':db[_0x352c2f[_0xfc24('0x20')]],'as':_0x352c2f['as'],'attributes':_0x352c2f[_0xfc24('0x1d')],'include':_0x352c2f[_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x352c2f[_0xfc24('0x1e')],function(_0x1d5dd1){return{'model':db[_0x1d5dd1[_0xfc24('0x20')]],'as':_0x1d5dd1['as'],'attributes':_0x1d5dd1[_0xfc24('0x1d')],'include':_0x1d5dd1[_0xfc24('0x1e')]?_[_0xfc24('0x1f')](_0x1d5dd1[_0xfc24('0x1e')],function(_0x26ea43){return{'model':db[_0x26ea43[_0xfc24('0x20')]],'as':_0x26ea43['as'],'attributes':_0x26ea43[_0xfc24('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d47f9){logger[_0xfc24('0xf')](_0xfc24('0x21'),_0x155fd7);logger[_0xfc24('0x12')](_0xfc24('0x21'),_0x155fd7,JSON[_0xfc24('0x13')](_0x4d47f9));_0xec2f4b(_0x4d47f9);})[_0xfc24('0x17')](function(_0x4cd721){logger[_0xfc24('0x14')](_0xfc24('0x21'),_0x4cd721['message'],_0x155fd7);_0x338764(_0x134e1e['error'](0x1f4,_0x4cd721[_0xfc24('0x16')]));});});}; \ No newline at end of file +var _0x139a=['map','model','then','GetFaxQueue','ShowFaxQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x139a,0x1b3));var _0xa139=function(_0x466a1e,_0x32729c){_0x466a1e=_0x466a1e-0x0;var _0x3f4654=_0x139a[_0x466a1e];return _0x3f4654;};'use strict';var _=require(_0xa139('0x0'));var util=require('util');var moment=require(_0xa139('0x1'));var BPromise=require('bluebird');var rs=require(_0xa139('0x2'));var fs=require('fs');var Redis=require(_0xa139('0x3'));var db=require(_0xa139('0x4'))['db'];var utils=require(_0xa139('0x5'));var logger=require('../../config/logger')(_0xa139('0x6'));var config=require(_0xa139('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa139('0x8')]['http']({'port':0x232a});config[_0xa139('0x9')]=_[_0xa139('0xa')](config[_0xa139('0x9')],{'host':_0xa139('0xb'),'port':0x18eb});var socket=require(_0xa139('0xc'))(new Redis(config[_0xa139('0x9')]));require(_0xa139('0xd'))[_0xa139('0xe')](socket);function respondWithRpcPromise(_0x181261,_0x50ea1d,_0x50fd89){return new BPromise(function(_0x53fdc,_0x47d20b){return client[_0xa139('0xf')](_0x181261,_0x50fd89)['then'](function(_0x520c96){logger[_0xa139('0x10')](_0xa139('0x11'),_0x50ea1d,_0xa139('0x12'));logger[_0xa139('0x13')](_0xa139('0x14'),_0x50ea1d,'request\x20sent',JSON[_0xa139('0x15')](_0x520c96));if(_0x520c96[_0xa139('0x16')]){if(_0x520c96[_0xa139('0x16')]['code']===0x1f4){logger[_0xa139('0x16')](_0xa139('0x11'),_0x50ea1d,_0x520c96[_0xa139('0x16')][_0xa139('0x17')]);return _0x47d20b(_0x520c96[_0xa139('0x16')][_0xa139('0x17')]);}logger['error'](_0xa139('0x11'),_0x50ea1d,_0x520c96[_0xa139('0x16')]['message']);return _0x53fdc(_0x520c96[_0xa139('0x16')]['message']);}else{logger['info'](_0xa139('0x11'),_0x50ea1d,'request\x20sent');_0x53fdc(_0x520c96[_0xa139('0x18')][_0xa139('0x17')]);}})[_0xa139('0x19')](function(_0x4ff489){logger['error']('FaxQueue,\x20%s,\x20%s',_0x50ea1d,_0x4ff489);_0x47d20b(_0x4ff489);});});}exports['GetFaxQueue']=function(_0x148a5b){var _0x50057f=this;return new Promise(function(_0x3cd57b,_0x165478){return db[_0xa139('0x1a')][_0xa139('0x1b')]({'raw':_0x148a5b[_0xa139('0x1c')]?_0x148a5b[_0xa139('0x1c')][_0xa139('0x1d')]===undefined?!![]:![]:!![],'where':_0x148a5b[_0xa139('0x1c')]?_0x148a5b[_0xa139('0x1c')][_0xa139('0x1e')]||null:null,'attributes':_0x148a5b[_0xa139('0x1c')]?_0x148a5b['options'][_0xa139('0x1f')]||null:null,'limit':_0x148a5b['options']?_0x148a5b[_0xa139('0x1c')]['limit']||null:null,'include':_0x148a5b[_0xa139('0x1c')]?_0x148a5b[_0xa139('0x1c')][_0xa139('0x20')]?_[_0xa139('0x21')](_0x148a5b[_0xa139('0x1c')][_0xa139('0x20')],function(_0x38cfe4){return{'model':db[_0x38cfe4[_0xa139('0x22')]],'as':_0x38cfe4['as'],'attributes':_0x38cfe4[_0xa139('0x1f')],'include':_0x38cfe4[_0xa139('0x20')]?_[_0xa139('0x21')](_0x38cfe4[_0xa139('0x20')],function(_0x3888e1){return{'model':db[_0x3888e1['model']],'as':_0x3888e1['as'],'attributes':_0x3888e1[_0xa139('0x1f')],'include':_0x3888e1[_0xa139('0x20')]?_['map'](_0x3888e1['include'],function(_0x221efe){return{'model':db[_0x221efe[_0xa139('0x22')]],'as':_0x221efe['as'],'attributes':_0x221efe[_0xa139('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa139('0x23')](function(_0x12a249){logger[_0xa139('0x10')](_0xa139('0x24'),_0x148a5b);logger[_0xa139('0x13')](_0xa139('0x24'),_0x148a5b,JSON[_0xa139('0x15')](_0x12a249));_0x3cd57b(_0x12a249);})['catch'](function(_0x1dbb34){logger[_0xa139('0x16')](_0xa139('0x24'),_0x1dbb34[_0xa139('0x17')],_0x148a5b);_0x165478(_0x50057f[_0xa139('0x16')](0x1f4,_0x1dbb34[_0xa139('0x17')]));});});};exports[_0xa139('0x25')]=function(_0x17f2e2){var _0x3d8ad0=this;return new Promise(function(_0x55829a,_0x8de622){return db['FaxQueue'][_0xa139('0x26')]({'raw':_0x17f2e2[_0xa139('0x1c')]?_0x17f2e2[_0xa139('0x1c')][_0xa139('0x1d')]===undefined?!![]:![]:!![],'where':_0x17f2e2[_0xa139('0x1c')]?_0x17f2e2[_0xa139('0x1c')][_0xa139('0x1e')]||null:null,'attributes':_0x17f2e2['options']?_0x17f2e2['options'][_0xa139('0x1f')]||null:null,'include':_0x17f2e2[_0xa139('0x1c')]?_0x17f2e2[_0xa139('0x1c')][_0xa139('0x20')]?_[_0xa139('0x21')](_0x17f2e2[_0xa139('0x1c')][_0xa139('0x20')],function(_0x1505ab){return{'model':db[_0x1505ab[_0xa139('0x22')]],'as':_0x1505ab['as'],'attributes':_0x1505ab[_0xa139('0x1f')],'include':_0x1505ab['include']?_[_0xa139('0x21')](_0x1505ab[_0xa139('0x20')],function(_0x5c397e){return{'model':db[_0x5c397e[_0xa139('0x22')]],'as':_0x5c397e['as'],'attributes':_0x5c397e[_0xa139('0x1f')],'include':_0x5c397e[_0xa139('0x20')]?_['map'](_0x5c397e[_0xa139('0x20')],function(_0x1855e0){return{'model':db[_0x1855e0['model']],'as':_0x1855e0['as'],'attributes':_0x1855e0[_0xa139('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa139('0x23')](function(_0x3082e4){logger[_0xa139('0x10')](_0xa139('0x25'),_0x17f2e2);logger[_0xa139('0x13')](_0xa139('0x25'),_0x17f2e2,JSON['stringify'](_0x3082e4));_0x55829a(_0x3082e4);})[_0xa139('0x19')](function(_0x3aee1){logger[_0xa139('0x16')](_0xa139('0x25'),_0x3aee1[_0xa139('0x17')],_0x17f2e2);_0x8de622(_0x3d8ad0[_0xa139('0x16')](0x1f4,_0x3aee1[_0xa139('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 297af1e..bde6101 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 _0xec53=['save','emit','removeListener','register','faxQueue:'];(function(_0x1f7662,_0x5cde47){var _0x1a8fd8=function(_0xf857ca){while(--_0xf857ca){_0x1f7662['push'](_0x1f7662['shift']());}};_0x1a8fd8(++_0x5cde47);}(_0xec53,0xaa));var _0x3ec5=function(_0x412ca4,_0x110b15){_0x412ca4=_0x412ca4-0x0;var _0x192e25=_0xec53[_0x412ca4];return _0x192e25;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x3ec5('0x0'),'remove','update'];function createListener(_0xdacda3,_0x2a7b89){return function(_0x35e4a1){_0x2a7b89[_0x3ec5('0x1')](_0xdacda3,_0x35e4a1);};}function removeListener(_0x3f4719,_0x476f96){return function(){FaxQueueEvents[_0x3ec5('0x2')](_0x3f4719,_0x476f96);};}exports[_0x3ec5('0x3')]=function(_0x1c9efa){for(var _0x35274a=0x0,_0x3a024c=events['length'];_0x35274a<_0x3a024c;_0x35274a++){var _0x4346ba=events[_0x35274a];var _0x110ed4=createListener(_0x3ec5('0x4')+_0x4346ba,_0x1c9efa);FaxQueueEvents['on'](_0x4346ba,_0x110ed4);}}; \ No newline at end of file +var _0xc1cf=['register','faxQueue:','save','removeListener'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc1cf,0x12e));var _0xfc1c=function(_0x36cce1,_0x5f1623){_0x36cce1=_0x36cce1-0x0;var _0x458308=_0xc1cf[_0x36cce1];return _0x458308;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xfc1c('0x0'),'remove','update'];function createListener(_0x1f0b4a,_0x98c287){return function(_0x48f988){_0x98c287['emit'](_0x1f0b4a,_0x48f988);};}function removeListener(_0x1c2466,_0x511453){return function(){FaxQueueEvents[_0xfc1c('0x1')](_0x1c2466,_0x511453);};}exports[_0xfc1c('0x2')]=function(_0x23b8e9){for(var _0x4a5a37=0x0,_0x2b8cd2=events['length'];_0x4a5a37<_0x2b8cd2;_0x4a5a37++){var _0x1f286f=events[_0x4a5a37];var _0x1a49d7=createListener(_0xfc1c('0x3')+_0x1f286f,_0x23b8e9);FaxQueueEvents['on'](_0x1f286f,_0x1a49d7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 105f5b9..85202d5 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xb10b,0x12a));var _0xbb10=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xb10b[_0x16bb4b];return _0x8aeb84;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x25c797,_0x3eef5d){var _0x1f1ed3=function(_0x35213c){while(--_0x35213c){_0x25c797['push'](_0x25c797['shift']());}};_0x1f1ed3(++_0x3eef5d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c9a857c..b1232ac 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 _0x93ed=['STRING','DATE','moment','sequelize','exports'];(function(_0x1e1082,_0x264907){var _0x10a267=function(_0x4055ff){while(--_0x4055ff){_0x1e1082['push'](_0x1e1082['shift']());}};_0x10a267(++_0x264907);}(_0x93ed,0x192));var _0xd93e=function(_0x4bdda0,_0x2dd23d){_0x4bdda0=_0x4bdda0-0x0;var _0x2d3f4e=_0x93ed[_0x4bdda0];return _0x2d3f4e;};'use strict';var moment=require(_0xd93e('0x0'));var Sequelize=require(_0xd93e('0x1'));module[_0xd93e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd93e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd93e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd93e('0x4')]},'reason':{'type':Sequelize[_0xd93e('0x3')]}}; \ No newline at end of file +var _0xcd80=['DATE','moment','sequelize','exports','STRING'];(function(_0x3841a5,_0x53a0f7){var _0x27747f=function(_0x46dba1){while(--_0x46dba1){_0x3841a5['push'](_0x3841a5['shift']());}};_0x27747f(++_0x53a0f7);}(_0xcd80,0x100));var _0x0cd8=function(_0x3dc55d,_0xd07e93){_0x3dc55d=_0x3dc55d-0x0;var _0x3aa7f3=_0xcd80[_0x3dc55d];return _0x3aa7f3;};'use strict';var moment=require(_0x0cd8('0x0'));var Sequelize=require(_0x0cd8('0x1'));module[_0x0cd8('0x2')]={'uniqueid':{'type':Sequelize[_0x0cd8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0cd8('0x3')]},'joinAt':{'type':Sequelize[_0x0cd8('0x4')]},'leaveAt':{'type':Sequelize[_0x0cd8('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0cd8('0x4')]},'reason':{'type':Sequelize[_0x0cd8('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b27e8e7..866efed 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 _0xcf91=['jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','FaxQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel'];(function(_0x350d24,_0x5d329f){var _0x3b9281=function(_0x3abc8e){while(--_0x3abc8e){_0x350d24['push'](_0x350d24['shift']());}};_0x3b9281(++_0x5d329f);}(_0xcf91,0x19f));var _0x1cf9=function(_0x443427,_0x518e89){_0x443427=_0x443427-0x0;var _0x57e334=_0xcf91[_0x443427];return _0x57e334;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1cf9('0x0'));var rimraf=require(_0x1cf9('0x1'));var zipdir=require(_0x1cf9('0x2'));var jsonpatch=require(_0x1cf9('0x3'));var rp=require('request-promise');var moment=require(_0x1cf9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1cf9('0x5'));var util=require(_0x1cf9('0x6'));var path=require(_0x1cf9('0x7'));var sox=require(_0x1cf9('0x8'));var csv=require(_0x1cf9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1cf9('0xa'));var crypto=require('crypto');var jsforce=require(_0x1cf9('0xb'));var deskjs=require(_0x1cf9('0xc'));var toCsv=require(_0x1cf9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cf9('0xd'));var authService=require(_0x1cf9('0xe'));var qs=require(_0x1cf9('0xf'));var as=require(_0x1cf9('0x10'));var hardwareService=require(_0x1cf9('0x11'));var logger=require('../../config/logger')(_0x1cf9('0x12'));var utils=require('../../config/utils');var config=require(_0x1cf9('0x13'));var licenseUtil=require(_0x1cf9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3610f6,_0x29de00){_0x29de00=_0x29de00||0xcc;return function(_0xde234b){if(_0xde234b){return _0x3610f6[_0x1cf9('0x15')](_0x29de00);}return _0x3610f6[_0x1cf9('0x16')](_0x29de00)[_0x1cf9('0x17')]();};}function respondWithResult(_0x19aeea,_0x195e12){_0x195e12=_0x195e12||0xc8;return function(_0x55a81f){if(_0x55a81f){return _0x19aeea[_0x1cf9('0x16')](_0x195e12)[_0x1cf9('0x18')](_0x55a81f);}};}function respondWithFilteredResult(_0x3fe355,_0x545e75){return function(_0x3b5408){if(_0x3b5408){var _0x1fbe58=_0x3b5408[_0x1cf9('0x19')],_0x2c9164=_0x545e75[_0x1cf9('0x1a')],_0x496393=_0x545e75[_0x1cf9('0x1a')]+_0x545e75[_0x1cf9('0x1b')],_0x43c6ee;if(_0x496393>=_0x1fbe58){_0x496393=_0x1fbe58;_0x43c6ee=0xc8;}else{_0x43c6ee=0xce;}_0x3fe355[_0x1cf9('0x16')](_0x43c6ee);return _0x3fe355[_0x1cf9('0x1c')](_0x1cf9('0x1d'),_0x2c9164+'-'+_0x496393+'/'+_0x1fbe58)[_0x1cf9('0x18')](_0x3b5408);}return null;};}function patchUpdates(_0x3fc0e6){return function(_0x1780e6){try{jsonpatch[_0x1cf9('0x1e')](_0x1780e6,_0x3fc0e6,!![]);}catch(_0x56b505){return BPromise[_0x1cf9('0x1f')](_0x56b505);}return _0x1780e6[_0x1cf9('0x20')]();};}function saveUpdates(_0x56f1c6,_0x939544){return function(_0x1b0da5){if(_0x1b0da5){return _0x1b0da5[_0x1cf9('0x21')](_0x56f1c6)['then'](function(_0x3da4e){return _0x3da4e;});}return null;};}function removeEntity(_0x2901af,_0x5314ca){return function(_0xf25c5f){if(_0xf25c5f){return _0xf25c5f[_0x1cf9('0x22')]()[_0x1cf9('0x23')](function(){_0x2901af[_0x1cf9('0x16')](0xcc)[_0x1cf9('0x17')]();});}};}function handleEntityNotFound(_0x5cd42c,_0x376765){return function(_0x158da9){if(!_0x158da9){_0x5cd42c['sendStatus'](0x194);}return _0x158da9;};}function handleError(_0x5d0b41,_0x1152fe){_0x1152fe=_0x1152fe||0x1f4;return function(_0x426cc1){logger[_0x1cf9('0x24')](_0x426cc1[_0x1cf9('0x25')]);if(_0x426cc1[_0x1cf9('0x26')]){delete _0x426cc1[_0x1cf9('0x26')];}_0x5d0b41[_0x1cf9('0x16')](_0x1152fe)[_0x1cf9('0x27')](_0x426cc1);};}exports['index']=function(_0x3d2a93,_0x3ff197){var _0x4b9cb2={},_0x807387={},_0x254656={'count':0x0,'rows':[]};var _0x36ab=_['map'](db['FaxQueueReport'][_0x1cf9('0x28')],function(_0x7da773){return{'name':_0x7da773['fieldName'],'type':_0x7da773[_0x1cf9('0x29')]['key']};});_0x807387[_0x1cf9('0x2a')]=_['map'](_0x36ab,'name');_0x807387[_0x1cf9('0x2b')]=_[_0x1cf9('0x2c')](_0x3d2a93[_0x1cf9('0x2b')]);_0x807387['filters']=_['intersection'](_0x807387[_0x1cf9('0x2a')],_0x807387[_0x1cf9('0x2b')]);_0x4b9cb2['attributes']=_[_0x1cf9('0x2d')](_0x807387[_0x1cf9('0x2a')],qs[_0x1cf9('0x2e')](_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x2e')]));_0x4b9cb2[_0x1cf9('0x2f')]=_0x4b9cb2[_0x1cf9('0x2f')][_0x1cf9('0x30')]?_0x4b9cb2[_0x1cf9('0x2f')]:_0x807387[_0x1cf9('0x2a')];if(!_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x31')](_0x1cf9('0x32'))){_0x4b9cb2[_0x1cf9('0x1b')]=qs['limit'](_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x1b')]);_0x4b9cb2[_0x1cf9('0x1a')]=qs[_0x1cf9('0x1a')](_0x3d2a93[_0x1cf9('0x2b')]['offset']);}_0x4b9cb2[_0x1cf9('0x33')]=qs[_0x1cf9('0x34')](_0x3d2a93['query'][_0x1cf9('0x34')]);_0x4b9cb2[_0x1cf9('0x35')]=qs[_0x1cf9('0x36')](_[_0x1cf9('0x37')](_0x3d2a93[_0x1cf9('0x2b')],_0x807387['filters']),_0x36ab);if(_0x3d2a93[_0x1cf9('0x2b')]['filter']){_0x4b9cb2['where']=_[_0x1cf9('0x38')](_0x4b9cb2['where'],{'$or':_['map'](_0x36ab,function(_0x28a6b9){if(_0x28a6b9['type']!==_0x1cf9('0x39')){var _0x2c89b3={};_0x2c89b3[_0x28a6b9[_0x1cf9('0x26')]]={'$like':'%'+_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x3a')]+'%'};return _0x2c89b3;}})});}_0x4b9cb2=_[_0x1cf9('0x38')]({},_0x4b9cb2,_0x3d2a93[_0x1cf9('0x3b')]);var _0x412f33={'where':_0x4b9cb2[_0x1cf9('0x35')]};return db[_0x1cf9('0x3c')][_0x1cf9('0x19')](_0x412f33)['then'](function(_0x4c60c6){_0x254656[_0x1cf9('0x19')]=_0x4c60c6;if(_0x3d2a93[_0x1cf9('0x2b')][_0x1cf9('0x3d')]){_0x4b9cb2[_0x1cf9('0x3e')]=[{'all':!![]}];}return db[_0x1cf9('0x3c')][_0x1cf9('0x3f')](_0x4b9cb2);})[_0x1cf9('0x23')](function(_0x1d6873){_0x254656[_0x1cf9('0x40')]=_0x1d6873;return _0x254656;})[_0x1cf9('0x23')](respondWithFilteredResult(_0x3ff197,_0x4b9cb2))[_0x1cf9('0x41')](handleError(_0x3ff197,null));};exports['show']=function(_0x510beb,_0x112794){var _0xd5c40f={'raw':!![],'where':{'id':_0x510beb[_0x1cf9('0x42')]['id']}},_0x5c69c2={};_0x5c69c2['model']=_[_0x1cf9('0x2c')](db[_0x1cf9('0x3c')][_0x1cf9('0x28')]);_0x5c69c2[_0x1cf9('0x2b')]=_[_0x1cf9('0x2c')](_0x510beb[_0x1cf9('0x2b')]);_0x5c69c2[_0x1cf9('0x36')]=_[_0x1cf9('0x2d')](_0x5c69c2[_0x1cf9('0x2a')],_0x5c69c2['query']);_0xd5c40f[_0x1cf9('0x2f')]=_[_0x1cf9('0x2d')](_0x5c69c2[_0x1cf9('0x2a')],qs[_0x1cf9('0x2e')](_0x510beb['query']['fields']));_0xd5c40f[_0x1cf9('0x2f')]=_0xd5c40f['attributes'][_0x1cf9('0x30')]?_0xd5c40f[_0x1cf9('0x2f')]:_0x5c69c2[_0x1cf9('0x2a')];if(_0x510beb[_0x1cf9('0x2b')]['includeAll']){_0xd5c40f[_0x1cf9('0x3e')]=[{'all':!![]}];}_0xd5c40f=_[_0x1cf9('0x38')]({},_0xd5c40f,_0x510beb[_0x1cf9('0x3b')]);return db[_0x1cf9('0x3c')][_0x1cf9('0x43')](_0xd5c40f)[_0x1cf9('0x23')](handleEntityNotFound(_0x112794,null))[_0x1cf9('0x23')](respondWithResult(_0x112794,null))[_0x1cf9('0x41')](handleError(_0x112794,null));};exports[_0x1cf9('0x44')]=function(_0x4c72ed,_0x2acd70){return db[_0x1cf9('0x3c')][_0x1cf9('0x44')](_0x4c72ed['body'],{})['then'](respondWithResult(_0x2acd70,0xc9))[_0x1cf9('0x41')](handleError(_0x2acd70,null));};exports[_0x1cf9('0x21')]=function(_0x48790b,_0x2bd733){if(_0x48790b['body']['id']){delete _0x48790b[_0x1cf9('0x45')]['id'];}return db[_0x1cf9('0x3c')][_0x1cf9('0x43')]({'where':{'id':_0x48790b[_0x1cf9('0x42')]['id']}})[_0x1cf9('0x23')](handleEntityNotFound(_0x2bd733,null))[_0x1cf9('0x23')](saveUpdates(_0x48790b[_0x1cf9('0x45')],null))[_0x1cf9('0x23')](respondWithResult(_0x2bd733,null))[_0x1cf9('0x41')](handleError(_0x2bd733,null));};exports[_0x1cf9('0x22')]=function(_0x368d8f,_0x395395){return db['FaxQueueReport']['find']({'where':{'id':_0x368d8f[_0x1cf9('0x42')]['id']}})['then'](handleEntityNotFound(_0x395395,null))['then'](removeEntity(_0x395395,null))[_0x1cf9('0x41')](handleError(_0x395395,null));};exports[_0x1cf9('0x46')]=function(_0xaa8776,_0x382434){return db['FaxQueueReport'][_0x1cf9('0x46')]()[_0x1cf9('0x23')](respondWithResult(_0x382434,null))['catch'](handleError(_0x382434,null));}; \ No newline at end of file +var _0xa373=['stack','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','name','options','count','include','rows','catch','params','includeAll','find','create','update','body','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','error'];(function(_0x59957c,_0x2d7873){var _0x2617fb=function(_0x45bfb6){while(--_0x45bfb6){_0x59957c['push'](_0x59957c['shift']());}};_0x2617fb(++_0x2d7873);}(_0xa373,0x145));var _0x3a37=function(_0x1824e6,_0x28c755){_0x1824e6=_0x1824e6-0x0;var _0xa21c7e=_0xa373[_0x1824e6];return _0xa21c7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3a37('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a37('0x1'));var rp=require('request-promise');var moment=require(_0x3a37('0x2'));var BPromise=require(_0x3a37('0x3'));var Mustache=require(_0x3a37('0x4'));var util=require(_0x3a37('0x5'));var path=require(_0x3a37('0x6'));var sox=require(_0x3a37('0x7'));var csv=require(_0x3a37('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a37('0x9'));var squel=require(_0x3a37('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3a37('0xb'));var toCsv=require(_0x3a37('0x8'));var querystring=require(_0x3a37('0xc'));var Papa=require(_0x3a37('0xd'));var Redis=require('ioredis');var authService=require(_0x3a37('0xe'));var qs=require(_0x3a37('0xf'));var as=require(_0x3a37('0x10'));var hardwareService=require(_0x3a37('0x11'));var logger=require(_0x3a37('0x12'))(_0x3a37('0x13'));var utils=require(_0x3a37('0x14'));var config=require(_0x3a37('0x15'));var licenseUtil=require(_0x3a37('0x16'));var db=require(_0x3a37('0x17'))['db'];function respondWithStatusCode(_0x2c76bc,_0x29cf29){_0x29cf29=_0x29cf29||0xcc;return function(_0x366d1f){if(_0x366d1f){return _0x2c76bc[_0x3a37('0x18')](_0x29cf29);}return _0x2c76bc[_0x3a37('0x19')](_0x29cf29)[_0x3a37('0x1a')]();};}function respondWithResult(_0x5c9af4,_0x32176f){_0x32176f=_0x32176f||0xc8;return function(_0x3f196e){if(_0x3f196e){return _0x5c9af4[_0x3a37('0x19')](_0x32176f)[_0x3a37('0x1b')](_0x3f196e);}};}function respondWithFilteredResult(_0x227ab3,_0x5aeb75){return function(_0x193005){if(_0x193005){var _0x59dd82=_0x193005['count'],_0x1be19b=_0x5aeb75['offset'],_0x49a813=_0x5aeb75[_0x3a37('0x1c')]+_0x5aeb75[_0x3a37('0x1d')],_0xa98b0e;if(_0x49a813>=_0x59dd82){_0x49a813=_0x59dd82;_0xa98b0e=0xc8;}else{_0xa98b0e=0xce;}_0x227ab3[_0x3a37('0x19')](_0xa98b0e);return _0x227ab3[_0x3a37('0x1e')](_0x3a37('0x1f'),_0x1be19b+'-'+_0x49a813+'/'+_0x59dd82)[_0x3a37('0x1b')](_0x193005);}return null;};}function patchUpdates(_0x2cd70b){return function(_0x119eda){try{jsonpatch[_0x3a37('0x20')](_0x119eda,_0x2cd70b,!![]);}catch(_0x45e142){return BPromise['reject'](_0x45e142);}return _0x119eda['save']();};}function saveUpdates(_0x214a24,_0x499a7a){return function(_0x118840){if(_0x118840){return _0x118840['update'](_0x214a24)[_0x3a37('0x21')](function(_0x19777b){return _0x19777b;});}return null;};}function removeEntity(_0x4c86f7,_0x44a3b4){return function(_0x42f034){if(_0x42f034){return _0x42f034['destroy']()['then'](function(){_0x4c86f7[_0x3a37('0x19')](0xcc)[_0x3a37('0x1a')]();});}};}function handleEntityNotFound(_0x43dd43,_0x344ee8){return function(_0x575eed){if(!_0x575eed){_0x43dd43[_0x3a37('0x18')](0x194);}return _0x575eed;};}function handleError(_0x2f1599,_0x30df5b){_0x30df5b=_0x30df5b||0x1f4;return function(_0x4d7e8f){logger[_0x3a37('0x22')](_0x4d7e8f[_0x3a37('0x23')]);if(_0x4d7e8f['name']){delete _0x4d7e8f['name'];}_0x2f1599['status'](_0x30df5b)[_0x3a37('0x24')](_0x4d7e8f);};}exports[_0x3a37('0x25')]=function(_0x5aa64c,_0x201395){var _0x1224da={},_0x43d0ab={},_0xa0c164={'count':0x0,'rows':[]};var _0x3e1c5c=_[_0x3a37('0x26')](db[_0x3a37('0x27')][_0x3a37('0x28')],function(_0x1bf1af){return{'name':_0x1bf1af[_0x3a37('0x29')],'type':_0x1bf1af['type']['key']};});_0x43d0ab[_0x3a37('0x2a')]=_[_0x3a37('0x26')](_0x3e1c5c,'name');_0x43d0ab[_0x3a37('0x2b')]=_[_0x3a37('0x2c')](_0x5aa64c[_0x3a37('0x2b')]);_0x43d0ab[_0x3a37('0x2d')]=_[_0x3a37('0x2e')](_0x43d0ab[_0x3a37('0x2a')],_0x43d0ab['query']);_0x1224da[_0x3a37('0x2f')]=_[_0x3a37('0x2e')](_0x43d0ab['model'],qs[_0x3a37('0x30')](_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x30')]));_0x1224da['attributes']=_0x1224da[_0x3a37('0x2f')][_0x3a37('0x31')]?_0x1224da[_0x3a37('0x2f')]:_0x43d0ab[_0x3a37('0x2a')];if(!_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x32')]('nolimit')){_0x1224da[_0x3a37('0x1d')]=qs[_0x3a37('0x1d')](_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x1d')]);_0x1224da[_0x3a37('0x1c')]=qs['offset'](_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x1c')]);}_0x1224da['order']=qs[_0x3a37('0x33')](_0x5aa64c['query']['sort']);_0x1224da[_0x3a37('0x34')]=qs[_0x3a37('0x2d')](_[_0x3a37('0x35')](_0x5aa64c['query'],_0x43d0ab['filters']),_0x3e1c5c);if(_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x36')]){_0x1224da['where']=_[_0x3a37('0x37')](_0x1224da[_0x3a37('0x34')],{'$or':_[_0x3a37('0x26')](_0x3e1c5c,function(_0x2cc186){if(_0x2cc186[_0x3a37('0x38')]!==_0x3a37('0x39')){var _0x502876={};_0x502876[_0x2cc186[_0x3a37('0x3a')]]={'$like':'%'+_0x5aa64c[_0x3a37('0x2b')][_0x3a37('0x36')]+'%'};return _0x502876;}})});}_0x1224da=_['merge']({},_0x1224da,_0x5aa64c[_0x3a37('0x3b')]);var _0x973be0={'where':_0x1224da[_0x3a37('0x34')]};return db['FaxQueueReport'][_0x3a37('0x3c')](_0x973be0)['then'](function(_0x52a0be){_0xa0c164[_0x3a37('0x3c')]=_0x52a0be;if(_0x5aa64c[_0x3a37('0x2b')]['includeAll']){_0x1224da[_0x3a37('0x3d')]=[{'all':!![]}];}return db[_0x3a37('0x27')]['findAll'](_0x1224da);})['then'](function(_0x20fc57){_0xa0c164[_0x3a37('0x3e')]=_0x20fc57;return _0xa0c164;})['then'](respondWithFilteredResult(_0x201395,_0x1224da))[_0x3a37('0x3f')](handleError(_0x201395,null));};exports['show']=function(_0x19ea94,_0x1547fa){var _0x48d4ba={'raw':!![],'where':{'id':_0x19ea94[_0x3a37('0x40')]['id']}},_0xefd5d8={};_0xefd5d8[_0x3a37('0x2a')]=_[_0x3a37('0x2c')](db[_0x3a37('0x27')][_0x3a37('0x28')]);_0xefd5d8[_0x3a37('0x2b')]=_[_0x3a37('0x2c')](_0x19ea94[_0x3a37('0x2b')]);_0xefd5d8[_0x3a37('0x2d')]=_[_0x3a37('0x2e')](_0xefd5d8[_0x3a37('0x2a')],_0xefd5d8[_0x3a37('0x2b')]);_0x48d4ba['attributes']=_[_0x3a37('0x2e')](_0xefd5d8['model'],qs[_0x3a37('0x30')](_0x19ea94[_0x3a37('0x2b')][_0x3a37('0x30')]));_0x48d4ba[_0x3a37('0x2f')]=_0x48d4ba[_0x3a37('0x2f')]['length']?_0x48d4ba[_0x3a37('0x2f')]:_0xefd5d8[_0x3a37('0x2a')];if(_0x19ea94['query'][_0x3a37('0x41')]){_0x48d4ba[_0x3a37('0x3d')]=[{'all':!![]}];}_0x48d4ba=_[_0x3a37('0x37')]({},_0x48d4ba,_0x19ea94['options']);return db[_0x3a37('0x27')][_0x3a37('0x42')](_0x48d4ba)['then'](handleEntityNotFound(_0x1547fa,null))[_0x3a37('0x21')](respondWithResult(_0x1547fa,null))[_0x3a37('0x3f')](handleError(_0x1547fa,null));};exports['create']=function(_0x26e5de,_0xa7021f){return db[_0x3a37('0x27')][_0x3a37('0x43')](_0x26e5de['body'],{})[_0x3a37('0x21')](respondWithResult(_0xa7021f,0xc9))[_0x3a37('0x3f')](handleError(_0xa7021f,null));};exports[_0x3a37('0x44')]=function(_0xf13a03,_0x468ef4){if(_0xf13a03['body']['id']){delete _0xf13a03[_0x3a37('0x45')]['id'];}return db[_0x3a37('0x27')][_0x3a37('0x42')]({'where':{'id':_0xf13a03[_0x3a37('0x40')]['id']}})[_0x3a37('0x21')](handleEntityNotFound(_0x468ef4,null))[_0x3a37('0x21')](saveUpdates(_0xf13a03[_0x3a37('0x45')],null))[_0x3a37('0x21')](respondWithResult(_0x468ef4,null))['catch'](handleError(_0x468ef4,null));};exports[_0x3a37('0x46')]=function(_0x4762bf,_0x5a1455){return db['FaxQueueReport'][_0x3a37('0x42')]({'where':{'id':_0x4762bf['params']['id']}})[_0x3a37('0x21')](handleEntityNotFound(_0x5a1455,null))['then'](removeEntity(_0x5a1455,null))['catch'](handleError(_0x5a1455,null));};exports[_0x3a37('0x47')]=function(_0x438a1c,_0xcf5b62){return db[_0x3a37('0x27')]['describe']()['then'](respondWithResult(_0xcf5b62,null))[_0x3a37('0x3f')](handleError(_0xcf5b62,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0ab431c..a8402f5 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 _0x3052=['FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','define'];(function(_0x5aaba8,_0x248b94){var _0x13f7e3=function(_0x2db2c5){while(--_0x2db2c5){_0x5aaba8['push'](_0x5aaba8['shift']());}};_0x13f7e3(++_0x248b94);}(_0x3052,0x1d1));var _0x2305=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3052[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x2305('0x0'));var util=require(_0x2305('0x1'));var logger=require(_0x2305('0x2'))(_0x2305('0x3'));var moment=require(_0x2305('0x4'));var BPromise=require(_0x2305('0x5'));var rp=require(_0x2305('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2305('0x7'));var config=require(_0x2305('0x8'));var attributes=require(_0x2305('0x9'));module['exports']=function(_0x56ff80,_0x129385){return _0x56ff80[_0x2305('0xa')](_0x2305('0xb'),attributes,{'tableName':_0x2305('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2305('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5f7=['exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./faxQueueReport.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc5f7,0xf4));var _0x7c5f=function(_0x11e7f3,_0x4e24d8){_0x11e7f3=_0x11e7f3-0x0;var _0x48e726=_0xc5f7[_0x11e7f3];return _0x48e726;};'use strict';var _=require(_0x7c5f('0x0'));var util=require(_0x7c5f('0x1'));var logger=require(_0x7c5f('0x2'))(_0x7c5f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c5f('0x4'));var rimraf=require(_0x7c5f('0x5'));var config=require(_0x7c5f('0x6'));var attributes=require(_0x7c5f('0x7'));module[_0x7c5f('0x8')]=function(_0x3b1fca,_0x4e5be5){return _0x3b1fca[_0x7c5f('0x9')]('FaxQueueReport',attributes,{'tableName':_0x7c5f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7c5f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index a5c63c1..007a3bc 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 _0x9729=['limit','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','raw'];(function(_0x5869f7,_0x557186){var _0x3937ec=function(_0x2bf8d9){while(--_0x2bf8d9){_0x5869f7['push'](_0x5869f7['shift']());}};_0x3937ec(++_0x557186);}(_0x9729,0x15d));var _0x9972=function(_0x31b3c7,_0x2c983c){_0x31b3c7=_0x31b3c7-0x0;var _0x3283f0=_0x9729[_0x31b3c7];return _0x3283f0;};'use strict';var _=require(_0x9972('0x0'));var util=require(_0x9972('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9972('0x2'));var db=require(_0x9972('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9972('0x4'))(_0x9972('0x5'));var config=require('../../config/environment');var jayson=require(_0x9972('0x6'));var client=jayson[_0x9972('0x7')][_0x9972('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x548e1b,_0x101268,_0x4ab487){return new BPromise(function(_0x580d62,_0x5765b5){return client[_0x9972('0x9')](_0x548e1b,_0x4ab487)[_0x9972('0xa')](function(_0x10311e){logger[_0x9972('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x101268,_0x9972('0xc'));logger[_0x9972('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x101268,_0x9972('0xc'),JSON[_0x9972('0xe')](_0x10311e));if(_0x10311e[_0x9972('0xf')]){if(_0x10311e[_0x9972('0xf')][_0x9972('0x10')]===0x1f4){logger[_0x9972('0xf')](_0x9972('0x11'),_0x101268,_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);return _0x5765b5(_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);}logger['error'](_0x9972('0x11'),_0x101268,_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);return _0x580d62(_0x10311e[_0x9972('0xf')][_0x9972('0x12')]);}else{logger[_0x9972('0xb')](_0x9972('0x11'),_0x101268,_0x9972('0xc'));_0x580d62(_0x10311e[_0x9972('0x13')][_0x9972('0x12')]);}})[_0x9972('0x14')](function(_0x56c425){logger[_0x9972('0xf')](_0x9972('0x11'),_0x101268,_0x56c425);_0x5765b5(_0x56c425);});});}exports[_0x9972('0x15')]=function(_0x1d024e){var _0x578254=this;return new Promise(function(_0x25f204,_0x51c231){return db[_0x9972('0x16')][_0x9972('0x17')](_0x1d024e[_0x9972('0x18')],{'raw':_0x1d024e[_0x9972('0x19')]?_0x1d024e[_0x9972('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9972('0xa')](function(_0x5d54a6){logger[_0x9972('0xb')]('CreateFaxQueueReport',_0x1d024e);logger['debug'](_0x9972('0x15'),_0x1d024e,JSON['stringify'](_0x5d54a6));_0x25f204(_0x5d54a6);})[_0x9972('0x14')](function(_0x304798){logger[_0x9972('0xf')]('CreateFaxQueueReport',_0x304798[_0x9972('0x12')],_0x1d024e);_0x51c231(_0x578254[_0x9972('0xf')](0x1f4,_0x304798[_0x9972('0x12')]));});});};exports[_0x9972('0x1a')]=function(_0x2e2d6c){var _0x4b9d9b=this;return new Promise(function(_0x447799,_0x4dcec2){return db['FaxQueueReport']['update'](_0x2e2d6c['body'],{'raw':_0x2e2d6c[_0x9972('0x19')]?_0x2e2d6c[_0x9972('0x19')][_0x9972('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2d6c['options']?_0x2e2d6c[_0x9972('0x19')]['where']||null:null,'attributes':_0x2e2d6c[_0x9972('0x19')]?_0x2e2d6c[_0x9972('0x19')]['attributes']||null:null,'limit':_0x2e2d6c[_0x9972('0x19')]?_0x2e2d6c['options'][_0x9972('0x1c')]||null:null})[_0x9972('0xa')](function(_0x2d9bad){logger[_0x9972('0xb')]('UpdateFaxQueueReport',_0x2e2d6c);logger[_0x9972('0xd')](_0x9972('0x1a'),_0x2e2d6c,JSON['stringify'](_0x2d9bad));_0x447799(_0x2d9bad);})[_0x9972('0x14')](function(_0x505240){logger['error']('UpdateFaxQueueReport',_0x505240[_0x9972('0x12')],_0x2e2d6c);_0x4dcec2(_0x4b9d9b[_0x9972('0xf')](0x1f4,_0x505240[_0x9972('0x12')]));});});}; \ No newline at end of file +var _0xe648=['stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0xe648,0xbb));var _0x8e64=function(_0x4b3363,_0x276279){_0x4b3363=_0x4b3363-0x0;var _0x466f6f=_0xe648[_0x4b3363];return _0x466f6f;};'use strict';var _=require(_0x8e64('0x0'));var util=require(_0x8e64('0x1'));var moment=require(_0x8e64('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e64('0x3'));var fs=require('fs');var Redis=require(_0x8e64('0x4'));var db=require(_0x8e64('0x5'))['db'];var utils=require(_0x8e64('0x6'));var logger=require(_0x8e64('0x7'))(_0x8e64('0x8'));var config=require(_0x8e64('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e64('0xa')][_0x8e64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5576ff,_0x5a3d86,_0x3e0379){return new BPromise(function(_0x5888c5,_0x19b7e0){return client[_0x8e64('0xc')](_0x5576ff,_0x3e0379)[_0x8e64('0xd')](function(_0x53ce6d){logger[_0x8e64('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x5a3d86,'request\x20sent');logger['debug'](_0x8e64('0xf'),_0x5a3d86,_0x8e64('0x10'),JSON[_0x8e64('0x11')](_0x53ce6d));if(_0x53ce6d[_0x8e64('0x12')]){if(_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x13')]===0x1f4){logger[_0x8e64('0x12')](_0x8e64('0x14'),_0x5a3d86,_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x15')]);return _0x19b7e0(_0x53ce6d['error']['message']);}logger['error'](_0x8e64('0x14'),_0x5a3d86,_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x15')]);return _0x5888c5(_0x53ce6d[_0x8e64('0x12')][_0x8e64('0x15')]);}else{logger['info'](_0x8e64('0x14'),_0x5a3d86,_0x8e64('0x10'));_0x5888c5(_0x53ce6d[_0x8e64('0x16')][_0x8e64('0x15')]);}})[_0x8e64('0x17')](function(_0x192a80){logger[_0x8e64('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x5a3d86,_0x192a80);_0x19b7e0(_0x192a80);});});}exports[_0x8e64('0x18')]=function(_0x5989fe){var _0x4979ce=this;return new Promise(function(_0x265cd4,_0x37424a){return db[_0x8e64('0x19')][_0x8e64('0x1a')](_0x5989fe[_0x8e64('0x1b')],{'raw':_0x5989fe[_0x8e64('0x1c')]?_0x5989fe['options'][_0x8e64('0x1d')]===undefined?!![]:![]:!![]})[_0x8e64('0xd')](function(_0x20b88){logger[_0x8e64('0xe')](_0x8e64('0x18'),_0x5989fe);logger['debug'](_0x8e64('0x18'),_0x5989fe,JSON['stringify'](_0x20b88));_0x265cd4(_0x20b88);})['catch'](function(_0x48d0e1){logger[_0x8e64('0x12')](_0x8e64('0x18'),_0x48d0e1[_0x8e64('0x15')],_0x5989fe);_0x37424a(_0x4979ce[_0x8e64('0x12')](0x1f4,_0x48d0e1[_0x8e64('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x27145c){var _0x1e9a64=this;return new Promise(function(_0x508392,_0x3e87ba){return db['FaxQueueReport'][_0x8e64('0x1e')](_0x27145c[_0x8e64('0x1b')],{'raw':_0x27145c[_0x8e64('0x1c')]?_0x27145c[_0x8e64('0x1c')][_0x8e64('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27145c[_0x8e64('0x1c')]?_0x27145c[_0x8e64('0x1c')][_0x8e64('0x1f')]||null:null,'attributes':_0x27145c[_0x8e64('0x1c')]?_0x27145c['options']['attributes']||null:null,'limit':_0x27145c[_0x8e64('0x1c')]?_0x27145c[_0x8e64('0x1c')][_0x8e64('0x20')]||null:null})[_0x8e64('0xd')](function(_0x4aabb9){logger[_0x8e64('0xe')]('UpdateFaxQueueReport',_0x27145c);logger['debug'](_0x8e64('0x21'),_0x27145c,JSON[_0x8e64('0x11')](_0x4aabb9));_0x508392(_0x4aabb9);})[_0x8e64('0x17')](function(_0x38d9a8){logger[_0x8e64('0x12')](_0x8e64('0x21'),_0x38d9a8['message'],_0x27145c);_0x3e87ba(_0x1e9a64[_0x8e64('0x12')](0x1f4,_0x38d9a8[_0x8e64('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a4108ef..24a96cd 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 _0xa7b9=['./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1fadad,_0x12b95e){var _0xc75692=function(_0x25031c){while(--_0x25031c){_0x1fadad['push'](_0x1fadad['shift']());}};_0xc75692(++_0x12b95e);}(_0xa7b9,0x139));var _0x9a7b=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0xa7b9[_0x562ec5];return _0x279c8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a7b('0x0'));var timeout=require(_0x9a7b('0x1'));var express=require(_0x9a7b('0x2'));var router=express[_0x9a7b('0x3')]();var auth=require(_0x9a7b('0x4'));var interaction=require(_0x9a7b('0x5'));var config=require(_0x9a7b('0x6'));var controller=require(_0x9a7b('0x7'));router[_0x9a7b('0x8')]('/',auth[_0x9a7b('0x9')](),controller[_0x9a7b('0xa')]);router[_0x9a7b('0x8')](_0x9a7b('0xb'),auth[_0x9a7b('0x9')](),controller['describe']);router[_0x9a7b('0x8')](_0x9a7b('0xc'),auth[_0x9a7b('0x9')](),controller[_0x9a7b('0xd')]);router[_0x9a7b('0xe')]('/',auth['isAuthenticated'](),controller[_0x9a7b('0xf')]);router[_0x9a7b('0x10')]('/:id',auth[_0x9a7b('0x9')](),controller[_0x9a7b('0x11')]);router[_0x9a7b('0x12')](_0x9a7b('0xc'),auth[_0x9a7b('0x9')](),controller[_0x9a7b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x59a7=['index','get','/:id','post','create','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x22584d,_0x210fea){var _0x215b7b=function(_0x5d655f){while(--_0x5d655f){_0x22584d['push'](_0x22584d['shift']());}};_0x215b7b(++_0x210fea);}(_0x59a7,0xcb));var _0x759a=function(_0x4c39a0,_0xdcf1dd){_0x4c39a0=_0x4c39a0-0x0;var _0x310903=_0x59a7[_0x4c39a0];return _0x310903;};'use strict';var multer=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var path=require(_0x759a('0x2'));var timeout=require('connect-timeout');var express=require(_0x759a('0x3'));var router=express['Router']();var auth=require(_0x759a('0x4'));var interaction=require(_0x759a('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x759a('0x6')](),controller[_0x759a('0x7')]);router[_0x759a('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x759a('0x8')](_0x759a('0x9'),auth[_0x759a('0x6')](),controller['show']);router[_0x759a('0xa')]('/',auth[_0x759a('0x6')](),controller[_0x759a('0xb')]);router['put'](_0x759a('0x9'),auth[_0x759a('0x6')](),controller['update']);router['delete'](_0x759a('0x9'),auth[_0x759a('0x6')](),controller[_0x759a('0xc')]);module[_0x759a('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f514e35..dfa83cd 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 _0xa0f2=['exports','ENUM','account','agent','queue','NOW','moment','sequelize'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa0f2,0x13e));var _0x2a0f=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xa0f2[_0x3f2a90];return _0xb46279;};'use strict';var moment=require(_0x2a0f('0x0'));var Sequelize=require(_0x2a0f('0x1'));module[_0x2a0f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2a0f('0x3')](_0x2a0f('0x4'),_0x2a0f('0x5'),'queue'),'allowNull':![],'defaultValue':_0x2a0f('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2a0f('0x7')]}}; \ No newline at end of file +var _0x5d8e=['moment','exports','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d8e,0x188));var _0xe5d8=function(_0x53cd0b,_0x175df1){_0x53cd0b=_0x53cd0b-0x0;var _0x5a6ed6=_0x5d8e[_0x53cd0b];return _0x5a6ed6;};'use strict';var moment=require(_0xe5d8('0x0'));var Sequelize=require('sequelize');module[_0xe5d8('0x1')]={'uniqueid':{'type':Sequelize[_0xe5d8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe5d8('0x3')]('account',_0xe5d8('0x4'),'queue'),'allowNull':![],'defaultValue':_0xe5d8('0x5')},'transferredAt':{'type':Sequelize[_0xe5d8('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xe5d8('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 37d3f2d..7464361 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 _0xc474=['FaxTransferReport','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','type','filter','options','include','rows','catch','intersection','length','includeAll','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','set','Content-Range','json','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map'];(function(_0x5afe0a,_0x59f4c0){var _0x3d3d3c=function(_0x3ff1ef){while(--_0x3ff1ef){_0x5afe0a['push'](_0x5afe0a['shift']());}};_0x3d3d3c(++_0x59f4c0);}(_0xc474,0xfc));var _0x4c47=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xc474[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x4c47('0x0'));var emlformat=require(_0x4c47('0x1'));var rimraf=require(_0x4c47('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c47('0x3'));var rp=require(_0x4c47('0x4'));var moment=require(_0x4c47('0x5'));var BPromise=require(_0x4c47('0x6'));var Mustache=require(_0x4c47('0x7'));var util=require(_0x4c47('0x8'));var path=require(_0x4c47('0x9'));var sox=require(_0x4c47('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require(_0x4c47('0xd'));var jsforce=require(_0x4c47('0xe'));var deskjs=require(_0x4c47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c47('0x10'));var Papa=require(_0x4c47('0x11'));var Redis=require('ioredis');var authService=require(_0x4c47('0x12'));var qs=require(_0x4c47('0x13'));var as=require(_0x4c47('0x14'));var hardwareService=require(_0x4c47('0x15'));var logger=require('../../config/logger')(_0x4c47('0x16'));var utils=require('../../config/utils');var config=require(_0x4c47('0x17'));var licenseUtil=require(_0x4c47('0x18'));var db=require(_0x4c47('0x19'))['db'];function respondWithStatusCode(_0x496e7b,_0x429553){_0x429553=_0x429553||0xcc;return function(_0x16a4fd){if(_0x16a4fd){return _0x496e7b['sendStatus'](_0x429553);}return _0x496e7b[_0x4c47('0x1a')](_0x429553)['end']();};}function respondWithResult(_0x3d1b6a,_0x121f9e){_0x121f9e=_0x121f9e||0xc8;return function(_0x25d4dc){if(_0x25d4dc){return _0x3d1b6a[_0x4c47('0x1a')](_0x121f9e)['json'](_0x25d4dc);}};}function respondWithFilteredResult(_0xb53c24,_0x78f26b){return function(_0x16c7a9){if(_0x16c7a9){var _0xd162cc=_0x16c7a9[_0x4c47('0x1b')],_0x533344=_0x78f26b[_0x4c47('0x1c')],_0x4833f1=_0x78f26b[_0x4c47('0x1c')]+_0x78f26b['limit'],_0x5afffc;if(_0x4833f1>=_0xd162cc){_0x4833f1=_0xd162cc;_0x5afffc=0xc8;}else{_0x5afffc=0xce;}_0xb53c24[_0x4c47('0x1a')](_0x5afffc);return _0xb53c24[_0x4c47('0x1d')](_0x4c47('0x1e'),_0x533344+'-'+_0x4833f1+'/'+_0xd162cc)[_0x4c47('0x1f')](_0x16c7a9);}return null;};}function patchUpdates(_0x4e8f78){return function(_0x4cc984){try{jsonpatch['apply'](_0x4cc984,_0x4e8f78,!![]);}catch(_0x1adfb1){return BPromise[_0x4c47('0x20')](_0x1adfb1);}return _0x4cc984[_0x4c47('0x21')]();};}function saveUpdates(_0x3b156f,_0x52de60){return function(_0x38530c){if(_0x38530c){return _0x38530c[_0x4c47('0x22')](_0x3b156f)[_0x4c47('0x23')](function(_0x213623){return _0x213623;});}return null;};}function removeEntity(_0x20950c,_0x40a984){return function(_0x4d56eb){if(_0x4d56eb){return _0x4d56eb['destroy']()['then'](function(){_0x20950c[_0x4c47('0x1a')](0xcc)[_0x4c47('0x24')]();});}};}function handleEntityNotFound(_0x4d110d,_0x3037a2){return function(_0x5aae26){if(!_0x5aae26){_0x4d110d[_0x4c47('0x25')](0x194);}return _0x5aae26;};}function handleError(_0x4c761f,_0x533533){_0x533533=_0x533533||0x1f4;return function(_0x592469){logger[_0x4c47('0x26')](_0x592469[_0x4c47('0x27')]);if(_0x592469[_0x4c47('0x28')]){delete _0x592469['name'];}_0x4c761f[_0x4c47('0x1a')](_0x533533)[_0x4c47('0x29')](_0x592469);};}exports[_0x4c47('0x2a')]=function(_0x4dd77d,_0x2121b2){var _0x3fda58={},_0x17d8e6={},_0x41b8d5={'count':0x0,'rows':[]};var _0x5d3a94=_[_0x4c47('0x2b')](db[_0x4c47('0x2c')]['rawAttributes'],function(_0x491638){return{'name':_0x491638[_0x4c47('0x2d')],'type':_0x491638['type']['key']};});_0x17d8e6[_0x4c47('0x2e')]=_[_0x4c47('0x2b')](_0x5d3a94,_0x4c47('0x28'));_0x17d8e6[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x4dd77d['query']);_0x17d8e6[_0x4c47('0x31')]=_['intersection'](_0x17d8e6[_0x4c47('0x2e')],_0x17d8e6[_0x4c47('0x2f')]);_0x3fda58[_0x4c47('0x32')]=_['intersection'](_0x17d8e6['model'],qs['fields'](_0x4dd77d['query'][_0x4c47('0x33')]));_0x3fda58[_0x4c47('0x32')]=_0x3fda58[_0x4c47('0x32')]['length']?_0x3fda58[_0x4c47('0x32')]:_0x17d8e6['model'];if(!_0x4dd77d[_0x4c47('0x2f')][_0x4c47('0x34')](_0x4c47('0x35'))){_0x3fda58[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x4dd77d[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x3fda58[_0x4c47('0x1c')]=qs['offset'](_0x4dd77d[_0x4c47('0x2f')][_0x4c47('0x1c')]);}_0x3fda58[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x4dd77d['query']['sort']);_0x3fda58['where']=qs[_0x4c47('0x31')](_[_0x4c47('0x39')](_0x4dd77d[_0x4c47('0x2f')],_0x17d8e6['filters']),_0x5d3a94);if(_0x4dd77d['query']['filter']){_0x3fda58['where']=_[_0x4c47('0x3a')](_0x3fda58[_0x4c47('0x3b')],{'$or':_[_0x4c47('0x2b')](_0x5d3a94,function(_0x217268){if(_0x217268[_0x4c47('0x3c')]!=='VIRTUAL'){var _0x2e195c={};_0x2e195c[_0x217268[_0x4c47('0x28')]]={'$like':'%'+_0x4dd77d['query'][_0x4c47('0x3d')]+'%'};return _0x2e195c;}})});}_0x3fda58=_[_0x4c47('0x3a')]({},_0x3fda58,_0x4dd77d[_0x4c47('0x3e')]);var _0x418098={'where':_0x3fda58[_0x4c47('0x3b')]};return db['FaxTransferReport'][_0x4c47('0x1b')](_0x418098)[_0x4c47('0x23')](function(_0x12f6d5){_0x41b8d5[_0x4c47('0x1b')]=_0x12f6d5;if(_0x4dd77d[_0x4c47('0x2f')]['includeAll']){_0x3fda58[_0x4c47('0x3f')]=[{'all':!![]}];}return db[_0x4c47('0x2c')]['findAll'](_0x3fda58);})[_0x4c47('0x23')](function(_0x5de12b){_0x41b8d5[_0x4c47('0x40')]=_0x5de12b;return _0x41b8d5;})[_0x4c47('0x23')](respondWithFilteredResult(_0x2121b2,_0x3fda58))[_0x4c47('0x41')](handleError(_0x2121b2,null));};exports['show']=function(_0x5c01fd,_0x164105){var _0x4b52f5={'raw':!![],'where':{'id':_0x5c01fd['params']['id']}},_0x1c1246={};_0x1c1246[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x2c')]['rawAttributes']);_0x1c1246[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x5c01fd[_0x4c47('0x2f')]);_0x1c1246[_0x4c47('0x31')]=_[_0x4c47('0x42')](_0x1c1246[_0x4c47('0x2e')],_0x1c1246[_0x4c47('0x2f')]);_0x4b52f5[_0x4c47('0x32')]=_[_0x4c47('0x42')](_0x1c1246[_0x4c47('0x2e')],qs['fields'](_0x5c01fd[_0x4c47('0x2f')][_0x4c47('0x33')]));_0x4b52f5['attributes']=_0x4b52f5['attributes'][_0x4c47('0x43')]?_0x4b52f5[_0x4c47('0x32')]:_0x1c1246['model'];if(_0x5c01fd[_0x4c47('0x2f')][_0x4c47('0x44')]){_0x4b52f5[_0x4c47('0x3f')]=[{'all':!![]}];}_0x4b52f5=_[_0x4c47('0x3a')]({},_0x4b52f5,_0x5c01fd[_0x4c47('0x3e')]);return db['FaxTransferReport']['find'](_0x4b52f5)[_0x4c47('0x23')](handleEntityNotFound(_0x164105,null))[_0x4c47('0x23')](respondWithResult(_0x164105,null))[_0x4c47('0x41')](handleError(_0x164105,null));};exports[_0x4c47('0x45')]=function(_0x3d4a60,_0x231eb6){return db[_0x4c47('0x2c')]['create'](_0x3d4a60[_0x4c47('0x46')],{})['then'](respondWithResult(_0x231eb6,0xc9))[_0x4c47('0x41')](handleError(_0x231eb6,null));};exports[_0x4c47('0x22')]=function(_0x40e35e,_0x4c7e19){if(_0x40e35e[_0x4c47('0x46')]['id']){delete _0x40e35e[_0x4c47('0x46')]['id'];}return db[_0x4c47('0x2c')]['find']({'where':{'id':_0x40e35e[_0x4c47('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c7e19,null))[_0x4c47('0x23')](saveUpdates(_0x40e35e['body'],null))[_0x4c47('0x23')](respondWithResult(_0x4c7e19,null))['catch'](handleError(_0x4c7e19,null));};exports[_0x4c47('0x48')]=function(_0x3c347d,_0x2d28dd){return db[_0x4c47('0x2c')]['find']({'where':{'id':_0x3c347d['params']['id']}})[_0x4c47('0x23')](handleEntityNotFound(_0x2d28dd,null))['then'](removeEntity(_0x2d28dd,null))[_0x4c47('0x41')](handleError(_0x2d28dd,null));};exports[_0x4c47('0x49')]=function(_0x163752,_0x54a394){return db[_0x4c47('0x2c')][_0x4c47('0x49')]()['then'](respondWithResult(_0x54a394,null))['catch'](handleError(_0x54a394,null));}; \ No newline at end of file +var _0x2087=['FaxTransferReport','includeAll','include','findAll','show','length','find','create','body','params','catch','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options'];(function(_0x188c2c,_0x1f95d9){var _0x3075c2=function(_0x10b7d0){while(--_0x10b7d0){_0x188c2c['push'](_0x188c2c['shift']());}};_0x3075c2(++_0x1f95d9);}(_0x2087,0xf3));var _0x7208=function(_0x3d32d6,_0x25c147){_0x3d32d6=_0x3d32d6-0x0;var _0x3db593=_0x2087[_0x3d32d6];return _0x3db593;};'use strict';var pdf=require(_0x7208('0x0'));var emlformat=require(_0x7208('0x1'));var rimraf=require(_0x7208('0x2'));var zipdir=require(_0x7208('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7208('0x4'));var moment=require(_0x7208('0x5'));var BPromise=require(_0x7208('0x6'));var Mustache=require(_0x7208('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7208('0x8'));var csv=require('to-csv');var ejs=require(_0x7208('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7208('0xa'));var crypto=require(_0x7208('0xb'));var jsforce=require(_0x7208('0xc'));var deskjs=require(_0x7208('0xd'));var toCsv=require(_0x7208('0xe'));var querystring=require(_0x7208('0xf'));var Papa=require(_0x7208('0x10'));var Redis=require('ioredis');var authService=require(_0x7208('0x11'));var qs=require(_0x7208('0x12'));var as=require(_0x7208('0x13'));var hardwareService=require(_0x7208('0x14'));var logger=require(_0x7208('0x15'))(_0x7208('0x16'));var utils=require('../../config/utils');var config=require(_0x7208('0x17'));var licenseUtil=require(_0x7208('0x18'));var db=require(_0x7208('0x19'))['db'];function respondWithStatusCode(_0x86a763,_0x207595){_0x207595=_0x207595||0xcc;return function(_0x22ee6c){if(_0x22ee6c){return _0x86a763['sendStatus'](_0x207595);}return _0x86a763[_0x7208('0x1a')](_0x207595)[_0x7208('0x1b')]();};}function respondWithResult(_0x234927,_0x26515b){_0x26515b=_0x26515b||0xc8;return function(_0xfe87de){if(_0xfe87de){return _0x234927[_0x7208('0x1a')](_0x26515b)[_0x7208('0x1c')](_0xfe87de);}};}function respondWithFilteredResult(_0x3254d1,_0x238ada){return function(_0x320a12){if(_0x320a12){var _0x340a10=_0x320a12[_0x7208('0x1d')],_0x4de869=_0x238ada['offset'],_0x4cd685=_0x238ada[_0x7208('0x1e')]+_0x238ada[_0x7208('0x1f')],_0x5a7b8d;if(_0x4cd685>=_0x340a10){_0x4cd685=_0x340a10;_0x5a7b8d=0xc8;}else{_0x5a7b8d=0xce;}_0x3254d1['status'](_0x5a7b8d);return _0x3254d1[_0x7208('0x20')](_0x7208('0x21'),_0x4de869+'-'+_0x4cd685+'/'+_0x340a10)[_0x7208('0x1c')](_0x320a12);}return null;};}function patchUpdates(_0x447835){return function(_0x1d0551){try{jsonpatch[_0x7208('0x22')](_0x1d0551,_0x447835,!![]);}catch(_0x15aade){return BPromise[_0x7208('0x23')](_0x15aade);}return _0x1d0551[_0x7208('0x24')]();};}function saveUpdates(_0x41cd3a,_0x3c17db){return function(_0x3124c9){if(_0x3124c9){return _0x3124c9[_0x7208('0x25')](_0x41cd3a)[_0x7208('0x26')](function(_0x2a7613){return _0x2a7613;});}return null;};}function removeEntity(_0x47da91,_0x52bce8){return function(_0x11bae6){if(_0x11bae6){return _0x11bae6[_0x7208('0x27')]()[_0x7208('0x26')](function(){_0x47da91['status'](0xcc)[_0x7208('0x1b')]();});}};}function handleEntityNotFound(_0x216167,_0x328128){return function(_0x88850c){if(!_0x88850c){_0x216167[_0x7208('0x28')](0x194);}return _0x88850c;};}function handleError(_0x245ee8,_0x35f60f){_0x35f60f=_0x35f60f||0x1f4;return function(_0x126dae){logger[_0x7208('0x29')](_0x126dae[_0x7208('0x2a')]);if(_0x126dae[_0x7208('0x2b')]){delete _0x126dae[_0x7208('0x2b')];}_0x245ee8[_0x7208('0x1a')](_0x35f60f)[_0x7208('0x2c')](_0x126dae);};}exports[_0x7208('0x2d')]=function(_0x3c15f6,_0x304f5c){var _0x16fc0f={},_0x1416a4={},_0x51bec2={'count':0x0,'rows':[]};var _0x1c8c3f=_['map'](db['FaxTransferReport'][_0x7208('0x2e')],function(_0x2cc481){return{'name':_0x2cc481['fieldName'],'type':_0x2cc481[_0x7208('0x2f')][_0x7208('0x30')]};});_0x1416a4[_0x7208('0x31')]=_[_0x7208('0x32')](_0x1c8c3f,_0x7208('0x2b'));_0x1416a4[_0x7208('0x33')]=_[_0x7208('0x34')](_0x3c15f6['query']);_0x1416a4[_0x7208('0x35')]=_[_0x7208('0x36')](_0x1416a4[_0x7208('0x31')],_0x1416a4['query']);_0x16fc0f['attributes']=_[_0x7208('0x36')](_0x1416a4[_0x7208('0x31')],qs[_0x7208('0x37')](_0x3c15f6[_0x7208('0x33')][_0x7208('0x37')]));_0x16fc0f[_0x7208('0x38')]=_0x16fc0f[_0x7208('0x38')]['length']?_0x16fc0f['attributes']:_0x1416a4['model'];if(!_0x3c15f6[_0x7208('0x33')][_0x7208('0x39')](_0x7208('0x3a'))){_0x16fc0f[_0x7208('0x1f')]=qs[_0x7208('0x1f')](_0x3c15f6[_0x7208('0x33')]['limit']);_0x16fc0f[_0x7208('0x1e')]=qs['offset'](_0x3c15f6['query'][_0x7208('0x1e')]);}_0x16fc0f['order']=qs[_0x7208('0x3b')](_0x3c15f6[_0x7208('0x33')][_0x7208('0x3b')]);_0x16fc0f['where']=qs[_0x7208('0x35')](_['pick'](_0x3c15f6[_0x7208('0x33')],_0x1416a4['filters']),_0x1c8c3f);if(_0x3c15f6[_0x7208('0x33')]['filter']){_0x16fc0f[_0x7208('0x3c')]=_[_0x7208('0x3d')](_0x16fc0f[_0x7208('0x3c')],{'$or':_[_0x7208('0x32')](_0x1c8c3f,function(_0x3f68af){if(_0x3f68af[_0x7208('0x2f')]!==_0x7208('0x3e')){var _0x5dc891={};_0x5dc891[_0x3f68af[_0x7208('0x2b')]]={'$like':'%'+_0x3c15f6[_0x7208('0x33')][_0x7208('0x3f')]+'%'};return _0x5dc891;}})});}_0x16fc0f=_['merge']({},_0x16fc0f,_0x3c15f6[_0x7208('0x40')]);var _0x9e59f7={'where':_0x16fc0f[_0x7208('0x3c')]};return db[_0x7208('0x41')]['count'](_0x9e59f7)[_0x7208('0x26')](function(_0x18b04b){_0x51bec2[_0x7208('0x1d')]=_0x18b04b;if(_0x3c15f6[_0x7208('0x33')][_0x7208('0x42')]){_0x16fc0f[_0x7208('0x43')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x7208('0x44')](_0x16fc0f);})['then'](function(_0x33983c){_0x51bec2['rows']=_0x33983c;return _0x51bec2;})[_0x7208('0x26')](respondWithFilteredResult(_0x304f5c,_0x16fc0f))['catch'](handleError(_0x304f5c,null));};exports[_0x7208('0x45')]=function(_0x4fcd86,_0x52efef){var _0x3e76ef={'raw':!![],'where':{'id':_0x4fcd86['params']['id']}},_0x313c24={};_0x313c24[_0x7208('0x31')]=_[_0x7208('0x34')](db[_0x7208('0x41')][_0x7208('0x2e')]);_0x313c24['query']=_['keys'](_0x4fcd86[_0x7208('0x33')]);_0x313c24['filters']=_[_0x7208('0x36')](_0x313c24[_0x7208('0x31')],_0x313c24[_0x7208('0x33')]);_0x3e76ef[_0x7208('0x38')]=_[_0x7208('0x36')](_0x313c24['model'],qs[_0x7208('0x37')](_0x4fcd86[_0x7208('0x33')][_0x7208('0x37')]));_0x3e76ef[_0x7208('0x38')]=_0x3e76ef[_0x7208('0x38')][_0x7208('0x46')]?_0x3e76ef['attributes']:_0x313c24[_0x7208('0x31')];if(_0x4fcd86['query'][_0x7208('0x42')]){_0x3e76ef['include']=[{'all':!![]}];}_0x3e76ef=_['merge']({},_0x3e76ef,_0x4fcd86['options']);return db[_0x7208('0x41')][_0x7208('0x47')](_0x3e76ef)[_0x7208('0x26')](handleEntityNotFound(_0x52efef,null))[_0x7208('0x26')](respondWithResult(_0x52efef,null))['catch'](handleError(_0x52efef,null));};exports[_0x7208('0x48')]=function(_0x6498a9,_0x1575b3){return db[_0x7208('0x41')][_0x7208('0x48')](_0x6498a9[_0x7208('0x49')],{})[_0x7208('0x26')](respondWithResult(_0x1575b3,0xc9))['catch'](handleError(_0x1575b3,null));};exports[_0x7208('0x25')]=function(_0x3d03a6,_0x38a75f){if(_0x3d03a6[_0x7208('0x49')]['id']){delete _0x3d03a6['body']['id'];}return db['FaxTransferReport'][_0x7208('0x47')]({'where':{'id':_0x3d03a6[_0x7208('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38a75f,null))[_0x7208('0x26')](saveUpdates(_0x3d03a6[_0x7208('0x49')],null))[_0x7208('0x26')](respondWithResult(_0x38a75f,null))[_0x7208('0x4b')](handleError(_0x38a75f,null));};exports[_0x7208('0x27')]=function(_0xb6844a,_0x2f454a){return db[_0x7208('0x41')]['find']({'where':{'id':_0xb6844a['params']['id']}})['then'](handleEntityNotFound(_0x2f454a,null))[_0x7208('0x26')](removeEntity(_0x2f454a,null))[_0x7208('0x4b')](handleError(_0x2f454a,null));};exports[_0x7208('0x4c')]=function(_0x39fc53,_0x1d4249){return db[_0x7208('0x41')][_0x7208('0x4c')]()['then'](respondWithResult(_0x1d4249,null))[_0x7208('0x4b')](handleError(_0x1d4249,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 134ccef..b3440b9 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 _0x8a69=['./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4d99d3,_0x27176b){var _0x29bed2=function(_0x25fd02){while(--_0x25fd02){_0x4d99d3['push'](_0x4d99d3['shift']());}};_0x29bed2(++_0x27176b);}(_0x8a69,0x144));var _0x98a6=function(_0x7dd75c,_0x355e07){_0x7dd75c=_0x7dd75c-0x0;var _0x629af1=_0x8a69[_0x7dd75c];return _0x629af1;};'use strict';var _=require(_0x98a6('0x0'));var util=require(_0x98a6('0x1'));var logger=require(_0x98a6('0x2'))(_0x98a6('0x3'));var moment=require('moment');var BPromise=require(_0x98a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98a6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98a6('0x6'));module[_0x98a6('0x7')]=function(_0x31db24,_0x44a39e){return _0x31db24[_0x98a6('0x8')](_0x98a6('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x98a6('0xa'),'fields':[_0x98a6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ff2=['api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x1807b3,_0x18cd2f){var _0x9dd87=function(_0x2605a0){while(--_0x2605a0){_0x1807b3['push'](_0x1807b3['shift']());}};_0x9dd87(++_0x18cd2f);}(_0x4ff2,0x177));var _0x24ff=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x4ff2[_0x4b1665];return _0x5850c0;};'use strict';var _=require(_0x24ff('0x0'));var util=require(_0x24ff('0x1'));var logger=require('../../config/logger')(_0x24ff('0x2'));var moment=require('moment');var BPromise=require(_0x24ff('0x3'));var rp=require(_0x24ff('0x4'));var fs=require('fs');var path=require(_0x24ff('0x5'));var rimraf=require(_0x24ff('0x6'));var config=require(_0x24ff('0x7'));var attributes=require(_0x24ff('0x8'));module['exports']=function(_0x526bd7,_0x43eede){return _0x526bd7[_0x24ff('0x9')](_0x24ff('0xa'),attributes,{'tableName':_0x24ff('0xb'),'paranoid':![],'indexes':[{'name':_0x24ff('0xc'),'fields':[_0x24ff('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 29790da..f1cc6d3 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 _0x9641=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x176017,_0x46629a){var _0x58d8c4=function(_0x2501cb){while(--_0x2501cb){_0x176017['push'](_0x176017['shift']());}};_0x58d8c4(++_0x46629a);}(_0x9641,0xfb));var _0x1964=function(_0x29e3e4,_0x370df9){_0x29e3e4=_0x29e3e4-0x0;var _0x4f98e7=_0x9641[_0x29e3e4];return _0x4f98e7;};'use strict';var _=require(_0x1964('0x0'));var util=require(_0x1964('0x1'));var moment=require(_0x1964('0x2'));var BPromise=require('bluebird');var rs=require(_0x1964('0x3'));var fs=require('fs');var Redis=require(_0x1964('0x4'));var db=require(_0x1964('0x5'))['db'];var utils=require(_0x1964('0x6'));var logger=require(_0x1964('0x7'))(_0x1964('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x215e36,_0x25a660,_0x1fd627){return new BPromise(function(_0x443f3b,_0xf5b2ab){return client[_0x1964('0xa')](_0x215e36,_0x1fd627)['then'](function(_0x32a345){logger[_0x1964('0xb')](_0x1964('0xc'),_0x25a660,_0x1964('0xd'));logger['debug'](_0x1964('0xe'),_0x25a660,'request\x20sent',JSON[_0x1964('0xf')](_0x32a345));if(_0x32a345[_0x1964('0x10')]){if(_0x32a345['error'][_0x1964('0x11')]===0x1f4){logger[_0x1964('0x10')](_0x1964('0xc'),_0x25a660,_0x32a345[_0x1964('0x10')]['message']);return _0xf5b2ab(_0x32a345[_0x1964('0x10')][_0x1964('0x12')]);}logger[_0x1964('0x10')](_0x1964('0xc'),_0x25a660,_0x32a345[_0x1964('0x10')][_0x1964('0x12')]);return _0x443f3b(_0x32a345[_0x1964('0x10')][_0x1964('0x12')]);}else{logger[_0x1964('0xb')](_0x1964('0xc'),_0x25a660,_0x1964('0xd'));_0x443f3b(_0x32a345[_0x1964('0x13')]['message']);}})[_0x1964('0x14')](function(_0x591d25){logger['error'](_0x1964('0xc'),_0x25a660,_0x591d25);_0xf5b2ab(_0x591d25);});});} \ No newline at end of file +var _0xeb0d=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xeb0d,0x1ac));var _0xdeb0=function(_0xfc3140,_0x136d1f){_0xfc3140=_0xfc3140-0x0;var _0x17c6a1=_0xeb0d[_0xfc3140];return _0x17c6a1;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rs=require(_0xdeb0('0x3'));var fs=require('fs');var Redis=require(_0xdeb0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x5'));var logger=require(_0xdeb0('0x6'))('rpc');var config=require(_0xdeb0('0x7'));var jayson=require(_0xdeb0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb10051,_0x484cf6,_0x129e75){return new BPromise(function(_0x5d9a2c,_0x3fbe6e){return client[_0xdeb0('0x9')](_0xb10051,_0x129e75)[_0xdeb0('0xa')](function(_0x1262ee){logger[_0xdeb0('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x484cf6,_0xdeb0('0xc'));logger[_0xdeb0('0xd')](_0xdeb0('0xe'),_0x484cf6,_0xdeb0('0xc'),JSON[_0xdeb0('0xf')](_0x1262ee));if(_0x1262ee[_0xdeb0('0x10')]){if(_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x11')]===0x1f4){logger[_0xdeb0('0x10')](_0xdeb0('0x12'),_0x484cf6,_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);return _0x3fbe6e(_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x10')](_0xdeb0('0x12'),_0x484cf6,_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);return _0x5d9a2c(_0x1262ee[_0xdeb0('0x10')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xb')](_0xdeb0('0x12'),_0x484cf6,_0xdeb0('0xc'));_0x5d9a2c(_0x1262ee[_0xdeb0('0x14')][_0xdeb0('0x13')]);}})[_0xdeb0('0x15')](function(_0x3e1b00){logger['error'](_0xdeb0('0x12'),_0x484cf6,_0x3e1b00);_0x3fbe6e(_0x3e1b00);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b211673..dcca4ce 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 _0x7554=['get','/:id','show','put','update','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','/describe','isAuthenticated','describe'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0x7554,0x17d));var _0x4755=function(_0x3bd288,_0x5c0ca0){_0x3bd288=_0x3bd288-0x0;var _0x49066a=_0x7554[_0x3bd288];return _0x49066a;};'use strict';var multer=require('multer');var util=require(_0x4755('0x0'));var path=require('path');var timeout=require(_0x4755('0x1'));var express=require(_0x4755('0x2'));var router=express['Router']();var auth=require(_0x4755('0x3'));var interaction=require(_0x4755('0x4'));var config=require(_0x4755('0x5'));var controller=require(_0x4755('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4755('0x7'),auth[_0x4755('0x8')](),controller[_0x4755('0x9')]);router[_0x4755('0xa')](_0x4755('0xb'),auth['isAuthenticated'](),controller[_0x4755('0xc')]);router['post']('/',auth[_0x4755('0x8')](),controller['create']);router[_0x4755('0xd')](_0x4755('0xb'),auth[_0x4755('0x8')](),controller[_0x4755('0xe')]);router['delete'](_0x4755('0xb'),auth[_0x4755('0x8')](),controller[_0x4755('0xf')]);module[_0x4755('0x10')]=router; \ No newline at end of file +var _0x3fe8=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x38badf,_0x4776b8){var _0x20f1f9=function(_0x55edda){while(--_0x55edda){_0x38badf['push'](_0x38badf['shift']());}};_0x20f1f9(++_0x4776b8);}(_0x3fe8,0xaf));var _0x83fe=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x3fe8[_0x4bfade];return _0x272465;};'use strict';var multer=require('multer');var util=require(_0x83fe('0x0'));var path=require(_0x83fe('0x1'));var timeout=require(_0x83fe('0x2'));var express=require('express');var router=express[_0x83fe('0x3')]();var auth=require(_0x83fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x83fe('0x5'));var controller=require(_0x83fe('0x6'));router[_0x83fe('0x7')]('/',auth[_0x83fe('0x8')](),controller[_0x83fe('0x9')]);router['get'](_0x83fe('0xa'),auth[_0x83fe('0x8')](),controller['describe']);router[_0x83fe('0x7')]('/:id',auth[_0x83fe('0x8')](),controller['show']);router[_0x83fe('0xb')]('/',auth[_0x83fe('0x8')](),controller[_0x83fe('0xc')]);router[_0x83fe('0xd')](_0x83fe('0xe'),auth['isAuthenticated'](),controller[_0x83fe('0xf')]);router['delete'](_0x83fe('0xe'),auth[_0x83fe('0x8')](),controller[_0x83fe('0x10')]);module[_0x83fe('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f508a76..67e32b5 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 _0xfb33=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x537cc0,_0x5ec69d){var _0x4c2091=function(_0x5e8469){while(--_0x5e8469){_0x537cc0['push'](_0x537cc0['shift']());}};_0x4c2091(++_0x5ec69d);}(_0xfb33,0x17f));var _0x3fb3=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xfb33[_0x4a8bad];return _0x30cf32;};'use strict';var multer=require(_0x3fb3('0x0'));var util=require(_0x3fb3('0x1'));var path=require('path');var timeout=require(_0x3fb3('0x2'));var express=require(_0x3fb3('0x3'));var router=express[_0x3fb3('0x4')]();var auth=require(_0x3fb3('0x5'));var interaction=require(_0x3fb3('0x6'));var config=require('../../config/environment');var controller=require(_0x3fb3('0x7'));router[_0x3fb3('0x8')]('/',auth[_0x3fb3('0x9')](),controller['index']);router[_0x3fb3('0x8')]('/:id',auth[_0x3fb3('0x9')](),controller[_0x3fb3('0xa')]);router['get']('/:id/configurations',auth[_0x3fb3('0x9')](),controller[_0x3fb3('0xb')]);router[_0x3fb3('0x8')](_0x3fb3('0xc'),auth[_0x3fb3('0x9')](),controller[_0x3fb3('0xd')]);router[_0x3fb3('0xe')]('/',auth['isAuthenticated'](),controller[_0x3fb3('0xf')]);router['post']('/:id/configurations',auth[_0x3fb3('0x9')](),controller['addConfiguration']);router[_0x3fb3('0x10')](_0x3fb3('0x11'),auth['isAuthenticated'](),controller[_0x3fb3('0x12')]);router['delete'](_0x3fb3('0x11'),auth['isAuthenticated'](),controller[_0x3fb3('0x13')]);module[_0x3fb3('0x14')]=router; \ No newline at end of file +var _0xd9bf=['addConfiguration','delete','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations'];(function(_0x36cba4,_0x53a452){var _0xcc6047=function(_0x20b2a5){while(--_0x20b2a5){_0x36cba4['push'](_0x36cba4['shift']());}};_0xcc6047(++_0x53a452);}(_0xd9bf,0x159));var _0xfd9b=function(_0x4c394e,_0x2892cb){_0x4c394e=_0x4c394e-0x0;var _0x1866ce=_0xd9bf[_0x4c394e];return _0x1866ce;};'use strict';var multer=require('multer');var util=require(_0xfd9b('0x0'));var path=require('path');var timeout=require(_0xfd9b('0x1'));var express=require(_0xfd9b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfd9b('0x3'));var config=require(_0xfd9b('0x4'));var controller=require(_0xfd9b('0x5'));router['get']('/',auth[_0xfd9b('0x6')](),controller[_0xfd9b('0x7')]);router[_0xfd9b('0x8')](_0xfd9b('0x9'),auth[_0xfd9b('0x6')](),controller[_0xfd9b('0xa')]);router[_0xfd9b('0x8')]('/:id/configurations',auth[_0xfd9b('0x6')](),controller[_0xfd9b('0xb')]);router['get'](_0xfd9b('0xc'),auth[_0xfd9b('0x6')](),controller[_0xfd9b('0xd')]);router[_0xfd9b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfd9b('0xe')](_0xfd9b('0xf'),auth['isAuthenticated'](),controller[_0xfd9b('0x10')]);router['put'](_0xfd9b('0x9'),auth[_0xfd9b('0x6')](),controller['update']);router[_0xfd9b('0x11')](_0xfd9b('0x9'),auth[_0xfd9b('0x6')](),controller['destroy']);module[_0xfd9b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5f09065..7a40030 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 _0x6c9c=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x3d58aa,_0x5f62b1){var _0x1bc158=function(_0x5398f3){while(--_0x5398f3){_0x3d58aa['push'](_0x3d58aa['shift']());}};_0x1bc158(++_0x5f62b1);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x5a0e28,_0xc4c8d5){_0x5a0e28=_0x5a0e28-0x0;var _0x3a67d9=_0x6c9c[_0x5a0e28];return _0x3a67d9;};'use strict';var Sequelize=require(_0xc6c9('0x0'));module[_0xc6c9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc6c9('0x2')]},'username':{'type':Sequelize[_0xc6c9('0x2')]},'remoteUri':{'type':Sequelize[_0xc6c9('0x2')]},'authType':{'type':Sequelize[_0xc6c9('0x3')]('basic'),'defaultValue':_0xc6c9('0x4')},'password':{'type':Sequelize[_0xc6c9('0x2')]},'consumerKey':{'type':Sequelize[_0xc6c9('0x2')]},'consumerSecret':{'type':Sequelize[_0xc6c9('0x2')]},'token':{'type':Sequelize[_0xc6c9('0x2')]},'tokenSecret':{'type':Sequelize[_0xc6c9('0x2')]},'serverUrl':{'type':Sequelize[_0xc6c9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc6c9('0x3')](_0xc6c9('0x5'),_0xc6c9('0x6')),'defaultValue':_0xc6c9('0x5')}}; \ No newline at end of file +var _0xccde=['newTab','sequelize','STRING','basic','ENUM','integrationTab'];(function(_0x4c03ea,_0x3465be){var _0x7a6922=function(_0xd50354){while(--_0xd50354){_0x4c03ea['push'](_0x4c03ea['shift']());}};_0x7a6922(++_0x3465be);}(_0xccde,0x1e1));var _0xeccd=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0xccde[_0x188a93];return _0x23b40d;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'name':{'type':Sequelize[_0xeccd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeccd('0x1')]},'remoteUri':{'type':Sequelize[_0xeccd('0x1')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xeccd('0x2')},'password':{'type':Sequelize[_0xeccd('0x1')]},'consumerKey':{'type':Sequelize[_0xeccd('0x1')]},'consumerSecret':{'type':Sequelize[_0xeccd('0x1')]},'token':{'type':Sequelize[_0xeccd('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xeccd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeccd('0x3')](_0xeccd('0x4'),_0xeccd('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index e8413bc..e1b67d1 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 _0x7863=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','show','params','includeAll','find','create','body','update','findOne','DeskConfiguration','pick','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','DeskField','Subjects','Descriptions','getFields','remoteUri','authType','password','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7863,0x1da));var _0x3786=function(_0xda127b,_0x3792b4){_0xda127b=_0xda127b-0x0;var _0x4f9ddb=_0x7863[_0xda127b];return _0x4f9ddb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3786('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3786('0x1'));var jsonpatch=require(_0x3786('0x2'));var rp=require('request-promise');var moment=require(_0x3786('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3786('0x4'));var util=require(_0x3786('0x5'));var path=require(_0x3786('0x6'));var sox=require(_0x3786('0x7'));var csv=require(_0x3786('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3786('0x9'));var crypto=require(_0x3786('0xa'));var jsforce=require(_0x3786('0xb'));var deskjs=require(_0x3786('0xc'));var toCsv=require(_0x3786('0x8'));var querystring=require(_0x3786('0xd'));var Papa=require(_0x3786('0xe'));var Redis=require(_0x3786('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3786('0x10'));var as=require(_0x3786('0x11'));var hardwareService=require(_0x3786('0x12'));var logger=require(_0x3786('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3786('0x14'));var licenseUtil=require(_0x3786('0x15'));var db=require(_0x3786('0x16'))['db'];var integrations=require(_0x3786('0x17'));var jayson=require(_0x3786('0x18'));var client=jayson['client'][_0x3786('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x597555,_0x136569,_0x4c9cf9,_0x9ab8f5){return new BPromise(function(_0x251d52,_0x2dc463){var _0x16bf36=_0x9ab8f5||client;return _0x16bf36['request'](_0x597555,_0x4c9cf9)[_0x3786('0x1a')](function(_0x2e104e){logger[_0x3786('0x1b')]('DeskAccount,\x20%s,\x20%s',_0x136569,_0x3786('0x1c'));logger[_0x3786('0x1d')](_0x3786('0x1e'),_0x136569,_0x3786('0x1c'),JSON['stringify'](_0x2e104e));if(_0x2e104e[_0x3786('0x1f')]){if(_0x2e104e['error'][_0x3786('0x20')]===0x1f4){logger['error'](_0x3786('0x21'),_0x136569,_0x2e104e[_0x3786('0x1f')][_0x3786('0x22')]);return _0x2dc463(_0x2e104e[_0x3786('0x1f')]['message']);}logger[_0x3786('0x1f')](_0x3786('0x21'),_0x136569,_0x2e104e['error'][_0x3786('0x22')]);return _0x251d52(_0x2e104e[_0x3786('0x1f')]['message']);}else{logger['info'](_0x3786('0x21'),_0x136569,'request\x20sent');_0x251d52(_0x2e104e[_0x3786('0x23')][_0x3786('0x22')]);}})[_0x3786('0x24')](function(_0x3d0a3c){logger[_0x3786('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x136569,_0x3d0a3c);_0x2dc463(_0x3d0a3c);});});}function respondWithStatusCode(_0x37d7c7,_0x5418b9){_0x5418b9=_0x5418b9||0xcc;return function(_0x4a0b04){if(_0x4a0b04){return _0x37d7c7[_0x3786('0x25')](_0x5418b9);}return _0x37d7c7['status'](_0x5418b9)[_0x3786('0x26')]();};}function respondWithResult(_0x5f2c90,_0x44b052){_0x44b052=_0x44b052||0xc8;return function(_0x551b37){if(_0x551b37){return _0x5f2c90[_0x3786('0x27')](_0x44b052)['json'](_0x551b37);}};}function respondWithFilteredResult(_0x7ce834,_0x33dc63){return function(_0xf6f498){if(_0xf6f498){var _0x434294=_0xf6f498[_0x3786('0x28')],_0x1f6185=_0x33dc63[_0x3786('0x29')],_0x226857=_0x33dc63[_0x3786('0x29')]+_0x33dc63[_0x3786('0x2a')],_0x2b13c2;if(_0x226857>=_0x434294){_0x226857=_0x434294;_0x2b13c2=0xc8;}else{_0x2b13c2=0xce;}_0x7ce834[_0x3786('0x27')](_0x2b13c2);return _0x7ce834[_0x3786('0x2b')](_0x3786('0x2c'),_0x1f6185+'-'+_0x226857+'/'+_0x434294)['json'](_0xf6f498);}return null;};}function patchUpdates(_0x4974cb){return function(_0x24264c){try{jsonpatch[_0x3786('0x2d')](_0x24264c,_0x4974cb,!![]);}catch(_0x304356){return BPromise[_0x3786('0x2e')](_0x304356);}return _0x24264c[_0x3786('0x2f')]();};}function saveUpdates(_0x26c9f0,_0x405fc1){return function(_0x418a97){if(_0x418a97){return _0x418a97['update'](_0x26c9f0)[_0x3786('0x1a')](function(_0x500a51){return _0x500a51;});}return null;};}function removeEntity(_0x45e842,_0x35e6ab){return function(_0x4aac87){if(_0x4aac87){return _0x4aac87[_0x3786('0x30')]()[_0x3786('0x1a')](function(){_0x45e842[_0x3786('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1673c1,_0x1513ef){return function(_0x23751f){if(!_0x23751f){_0x1673c1[_0x3786('0x25')](0x194);}return _0x23751f;};}function handleError(_0x316c79,_0x26a57d){_0x26a57d=_0x26a57d||0x1f4;return function(_0x3846f6){logger[_0x3786('0x1f')](_0x3846f6['stack']);if(_0x3846f6['name']){delete _0x3846f6[_0x3786('0x31')];}_0x316c79[_0x3786('0x27')](_0x26a57d)[_0x3786('0x32')](_0x3846f6);};}exports['index']=function(_0x3028f9,_0x39275f){var _0x2163f6={},_0xb81969={},_0x251093={'count':0x0,'rows':[]};var _0x421915=_[_0x3786('0x33')](db[_0x3786('0x34')][_0x3786('0x35')],function(_0x43f55e){return{'name':_0x43f55e[_0x3786('0x36')],'type':_0x43f55e[_0x3786('0x37')][_0x3786('0x38')]};});_0xb81969[_0x3786('0x39')]=_['map'](_0x421915,_0x3786('0x31'));_0xb81969[_0x3786('0x3a')]=_[_0x3786('0x3b')](_0x3028f9[_0x3786('0x3a')]);_0xb81969[_0x3786('0x3c')]=_[_0x3786('0x3d')](_0xb81969['model'],_0xb81969[_0x3786('0x3a')]);_0x2163f6[_0x3786('0x3e')]=_[_0x3786('0x3d')](_0xb81969['model'],qs[_0x3786('0x3f')](_0x3028f9[_0x3786('0x3a')]['fields']));_0x2163f6['attributes']=_0x2163f6['attributes'][_0x3786('0x40')]?_0x2163f6[_0x3786('0x3e')]:_0xb81969['model'];if(!_0x3028f9['query'][_0x3786('0x41')](_0x3786('0x42'))){_0x2163f6['limit']=qs['limit'](_0x3028f9[_0x3786('0x3a')][_0x3786('0x2a')]);_0x2163f6['offset']=qs[_0x3786('0x29')](_0x3028f9[_0x3786('0x3a')][_0x3786('0x29')]);}_0x2163f6[_0x3786('0x43')]=qs[_0x3786('0x44')](_0x3028f9[_0x3786('0x3a')][_0x3786('0x44')]);_0x2163f6[_0x3786('0x45')]=qs[_0x3786('0x3c')](_['pick'](_0x3028f9[_0x3786('0x3a')],_0xb81969[_0x3786('0x3c')]),_0x421915);if(_0x3028f9[_0x3786('0x3a')][_0x3786('0x46')]){_0x2163f6[_0x3786('0x45')]=_[_0x3786('0x47')](_0x2163f6[_0x3786('0x45')],{'$or':_[_0x3786('0x33')](_0x421915,function(_0x14dc00){if(_0x14dc00[_0x3786('0x37')]!==_0x3786('0x48')){var _0x3fe386={};_0x3fe386[_0x14dc00[_0x3786('0x31')]]={'$like':'%'+_0x3028f9['query']['filter']+'%'};return _0x3fe386;}})});}_0x2163f6=_[_0x3786('0x47')]({},_0x2163f6,_0x3028f9[_0x3786('0x49')]);var _0x61ade6={'where':_0x2163f6[_0x3786('0x45')]};return db[_0x3786('0x34')][_0x3786('0x28')](_0x61ade6)[_0x3786('0x1a')](function(_0x59f987){_0x251093[_0x3786('0x28')]=_0x59f987;if(_0x3028f9[_0x3786('0x3a')]['includeAll']){_0x2163f6[_0x3786('0x4a')]=[{'all':!![]}];}return db[_0x3786('0x34')]['findAll'](_0x2163f6);})[_0x3786('0x1a')](function(_0x20b9a8){_0x251093['rows']=_0x20b9a8;return _0x251093;})['then'](respondWithFilteredResult(_0x39275f,_0x2163f6))[_0x3786('0x24')](handleError(_0x39275f,null));};exports[_0x3786('0x4b')]=function(_0x167c25,_0xdde5ec){var _0x2fb6ea={'raw':![],'where':{'id':_0x167c25[_0x3786('0x4c')]['id']}},_0x5839de={};_0x5839de['model']=_[_0x3786('0x3b')](db[_0x3786('0x34')][_0x3786('0x35')]);_0x5839de[_0x3786('0x3a')]=_[_0x3786('0x3b')](_0x167c25[_0x3786('0x3a')]);_0x5839de['filters']=_[_0x3786('0x3d')](_0x5839de['model'],_0x5839de[_0x3786('0x3a')]);_0x2fb6ea['attributes']=_['intersection'](_0x5839de[_0x3786('0x39')],qs['fields'](_0x167c25[_0x3786('0x3a')]['fields']));_0x2fb6ea['attributes']=_0x2fb6ea[_0x3786('0x3e')][_0x3786('0x40')]?_0x2fb6ea[_0x3786('0x3e')]:_0x5839de[_0x3786('0x39')];if(_0x167c25[_0x3786('0x3a')][_0x3786('0x4d')]){_0x2fb6ea['include']=[{'all':!![]}];}_0x2fb6ea=_['merge']({},_0x2fb6ea,_0x167c25['options']);return db[_0x3786('0x34')][_0x3786('0x4e')](_0x2fb6ea)[_0x3786('0x1a')](handleEntityNotFound(_0xdde5ec,null))[_0x3786('0x1a')](respondWithResult(_0xdde5ec,null))[_0x3786('0x24')](handleError(_0xdde5ec,null));};exports[_0x3786('0x4f')]=function(_0x45c50a,_0x519a29){return db[_0x3786('0x34')][_0x3786('0x4f')](_0x45c50a[_0x3786('0x50')],{})[_0x3786('0x1a')](respondWithResult(_0x519a29,0xc9))[_0x3786('0x24')](handleError(_0x519a29,null));};exports[_0x3786('0x51')]=function(_0x2299aa,_0x5254eb){if(_0x2299aa[_0x3786('0x50')]['id']){delete _0x2299aa[_0x3786('0x50')]['id'];}return db[_0x3786('0x34')][_0x3786('0x4e')]({'where':{'id':_0x2299aa[_0x3786('0x4c')]['id']}})[_0x3786('0x1a')](handleEntityNotFound(_0x5254eb,null))[_0x3786('0x1a')](saveUpdates(_0x2299aa[_0x3786('0x50')],null))['then'](respondWithResult(_0x5254eb,null))[_0x3786('0x24')](handleError(_0x5254eb,null));};exports[_0x3786('0x30')]=function(_0x53e276,_0xfd77c2){return db[_0x3786('0x34')][_0x3786('0x4e')]({'where':{'id':_0x53e276[_0x3786('0x4c')]['id']}})['then'](handleEntityNotFound(_0xfd77c2,null))[_0x3786('0x1a')](removeEntity(_0xfd77c2,null))[_0x3786('0x24')](handleError(_0xfd77c2,null));};exports['getConfigurations']=function(_0x19d48d,_0x12bf23,_0x72e9d5){var _0x4a72a4={};var _0xd2abc8={};var _0x57b7ef;var _0x24624a;return db[_0x3786('0x34')][_0x3786('0x52')]({'where':{'id':_0x19d48d['params']['id']}})[_0x3786('0x1a')](handleEntityNotFound(_0x12bf23,null))['then'](function(_0xf27cfe){if(_0xf27cfe){_0x57b7ef=_0xf27cfe;_0xd2abc8[_0x3786('0x39')]=_[_0x3786('0x3b')](db[_0x3786('0x53')]['rawAttributes']);_0xd2abc8[_0x3786('0x3a')]=_[_0x3786('0x3b')](_0x19d48d[_0x3786('0x3a')]);_0xd2abc8[_0x3786('0x3c')]=_[_0x3786('0x3d')](_0xd2abc8[_0x3786('0x39')],_0xd2abc8[_0x3786('0x3a')]);_0x4a72a4[_0x3786('0x3e')]=_[_0x3786('0x3d')](_0xd2abc8[_0x3786('0x39')],qs['fields'](_0x19d48d[_0x3786('0x3a')][_0x3786('0x3f')]));_0x4a72a4['attributes']=_0x4a72a4[_0x3786('0x3e')][_0x3786('0x40')]?_0x4a72a4[_0x3786('0x3e')]:_0xd2abc8[_0x3786('0x39')];_0x4a72a4['order']=qs['sort'](_0x19d48d['query'][_0x3786('0x44')]);_0x4a72a4['where']=qs[_0x3786('0x3c')](_[_0x3786('0x54')](_0x19d48d[_0x3786('0x3a')],_0xd2abc8[_0x3786('0x3c')]));if(_0x19d48d['query']['filter']){_0x4a72a4[_0x3786('0x45')]=_['merge'](_0x4a72a4['where'],{'$or':_['map'](_0x4a72a4[_0x3786('0x3e')],function(_0x2eadb4){var _0x255cd6={};_0x255cd6[_0x2eadb4]={'$like':'%'+_0x19d48d[_0x3786('0x3a')][_0x3786('0x46')]+'%'};return _0x255cd6;})});}_0x4a72a4=_[_0x3786('0x47')]({},_0x4a72a4,_0x19d48d['options']);return _0x57b7ef[_0x3786('0x55')](_0x4a72a4);}})['then'](function(_0x362d89){if(_0x362d89){_0x24624a=_0x362d89[_0x3786('0x40')];if(!_0x19d48d['query'][_0x3786('0x41')]('nolimit')){_0x4a72a4[_0x3786('0x2a')]=qs[_0x3786('0x2a')](_0x19d48d[_0x3786('0x3a')][_0x3786('0x2a')]);_0x4a72a4['offset']=qs['offset'](_0x19d48d['query'][_0x3786('0x29')]);}return _0x57b7ef['getConfigurations'](_0x4a72a4);}})['then'](function(_0x4f4599){if(_0x4f4599){return _0x4f4599?{'count':_0x24624a,'rows':_0x4f4599}:null;}})['then'](respondWithResult(_0x12bf23,null))[_0x3786('0x24')](handleError(_0x12bf23,null));};exports[_0x3786('0x56')]=function(_0x5e2fd5,_0x3d45c9,_0xba9715){if(_0x5e2fd5['body']['id']){delete _0x5e2fd5[_0x3786('0x50')]['id'];}return db[_0x3786('0x34')][_0x3786('0x52')]({'where':{'id':_0x5e2fd5[_0x3786('0x4c')]['id']}})[_0x3786('0x1a')](handleEntityNotFound(_0x3d45c9,null))['then'](function(_0x1217e2){if(_0x1217e2){_0x5e2fd5[_0x3786('0x50')]['AccountId']=_0x1217e2['id'];_0x5e2fd5[_0x3786('0x50')]['Subjects']=integrations[_0x3786('0x57')](_0x5e2fd5[_0x3786('0x50')][_0x3786('0x58')],_0x5e2fd5['body'][_0x3786('0x37')]);_0x5e2fd5[_0x3786('0x50')]['Descriptions']=integrations[_0x3786('0x59')](_0x5e2fd5[_0x3786('0x50')][_0x3786('0x58')],_0x5e2fd5[_0x3786('0x50')]['type']);return db[_0x3786('0x53')]['create'](_0x5e2fd5[_0x3786('0x50')],{'include':[{'model':db[_0x3786('0x5a')],'as':_0x3786('0x5b')},{'model':db[_0x3786('0x5a')],'as':_0x3786('0x5c')}]});}return null;})[_0x3786('0x1a')](respondWithResult(_0x3d45c9,null))[_0x3786('0x24')](handleError(_0x3d45c9,null));};exports[_0x3786('0x5d')]=function(_0x10fcc4,_0x1f97bf,_0x2a6789){var _0x46ee91=[{'name':'priority','label':'priority','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 _0x1435b8='';return db[_0x3786('0x34')][_0x3786('0x52')]({'where':{'id':_0x10fcc4[_0x3786('0x4c')]['id']},'attributes':['id',_0x3786('0x5e'),_0x3786('0x5f'),'username',_0x3786('0x60'),'consumerKey','consumerSecret','token',_0x3786('0x61')]})['then'](handleEntityNotFound(_0x1f97bf,null))[_0x3786('0x1a')](function(_0x290a8e){if(_0x290a8e){_0x1435b8=_0x290a8e[_0x3786('0x5e')];var _0x25c60b=_0x1435b8[_0x3786('0x62')](-0x1);if(_0x25c60b==='/'){_0x1435b8=_0x1435b8[_0x3786('0x63')](0x0,_0x1435b8[_0x3786('0x64')](_0x25c60b));}var _0x1d7862={'method':_0x3786('0x65'),'uri':util[_0x3786('0x66')](_0x3786('0x67'),_0x1435b8),'headers':{'Content-Type':_0x3786('0x68'),'Accept':_0x3786('0x68')},'json':!![]};if(_0x290a8e['authType']===_0x3786('0x69')){_0x1d7862[_0x3786('0x6a')]['Authorization']=util[_0x3786('0x66')](_0x3786('0x6b'),new Buffer(util[_0x3786('0x66')](_0x3786('0x6c'),_0x290a8e[_0x3786('0x6d')],_0x290a8e[_0x3786('0x60')]))[_0x3786('0x6e')](_0x3786('0x6f')));}return rp(_0x1d7862)[_0x3786('0x1a')](function(_0x15fb61){return _0x46ee91[_0x3786('0x70')](_[_0x3786('0x33')](_0x15fb61[_0x3786('0x71')][_0x3786('0x72')],function(_0x407180){return{'id':_0x407180['name'],'name':_0x407180['name'],'type':_0x407180[_0x3786('0x37')],'active':_0x407180['active'],'label':_0x407180[_0x3786('0x73')],'custom':!![]};}));});}})['then'](function(_0x1421e2){return{'count':_0x1421e2[_0x3786('0x40')],'rows':_0x1421e2};})[_0x3786('0x1a')](respondWithResult(_0x1f97bf,null))['catch'](function(_0x131f5d){var _0x3d6608=_0x10fcc4[_0x3786('0x3a')][_0x3786('0x74')]?0x1f4:_0x131f5d[_0x3786('0x75')]||0x1f4;logger[_0x3786('0x1f')](_0x3786('0x76'),_0x3786('0x5d'),_0x3d6608,JSON[_0x3786('0x77')](_0x131f5d));delete _0x131f5d[_0x3786('0x31')];if(_0x3d6608===0x191){_0x3d6608=0x190;}_0x1f97bf[_0x3786('0x27')](_0x3d6608)[_0x3786('0x32')](_0x10fcc4[_0x3786('0x3a')][_0x3786('0x74')]?{'message':_0x3786('0x78'),'statusCode':_0x131f5d[_0x3786('0x75')]}:_0x131f5d);});}; \ No newline at end of file +var _0x4168=['keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','options','count','includeAll','findAll','rows','params','length','find','create','body','findOne','DeskConfiguration','order','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','consumerSecret','token','tokenSecret','remoteUri','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','username','password','toString','base64','concat','entries','active','label','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','set','Content-Range','apply','save','update','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0x4168,0xb0));var _0x8416=function(_0x4ea95f,_0x505ead){_0x4ea95f=_0x4ea95f-0x0;var _0x1addb1=_0x4168[_0x4ea95f];return _0x1addb1;};'use strict';var pdf=require(_0x8416('0x0'));var emlformat=require(_0x8416('0x1'));var rimraf=require(_0x8416('0x2'));var zipdir=require(_0x8416('0x3'));var jsonpatch=require(_0x8416('0x4'));var rp=require(_0x8416('0x5'));var moment=require(_0x8416('0x6'));var BPromise=require(_0x8416('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8416('0x8'));var sox=require(_0x8416('0x9'));var csv=require('to-csv');var ejs=require(_0x8416('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8416('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8416('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8416('0xd'));var authService=require(_0x8416('0xe'));var qs=require(_0x8416('0xf'));var as=require(_0x8416('0x10'));var hardwareService=require(_0x8416('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8416('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8416('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8416('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x8416('0x15')][_0x8416('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xa7f9b4,_0x4e9563,_0x49eb4e,_0x32da5f){return new BPromise(function(_0x4d35a2,_0x389093){var _0xf8ca7a=_0x32da5f||client;return _0xf8ca7a[_0x8416('0x17')](_0xa7f9b4,_0x49eb4e)[_0x8416('0x18')](function(_0x2b7cd3){logger[_0x8416('0x19')]('DeskAccount,\x20%s,\x20%s',_0x4e9563,_0x8416('0x1a'));logger[_0x8416('0x1b')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4e9563,_0x8416('0x1a'),JSON[_0x8416('0x1c')](_0x2b7cd3));if(_0x2b7cd3[_0x8416('0x1d')]){if(_0x2b7cd3[_0x8416('0x1d')][_0x8416('0x1e')]===0x1f4){logger[_0x8416('0x1d')](_0x8416('0x1f'),_0x4e9563,_0x2b7cd3['error'][_0x8416('0x20')]);return _0x389093(_0x2b7cd3[_0x8416('0x1d')][_0x8416('0x20')]);}logger[_0x8416('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x4e9563,_0x2b7cd3[_0x8416('0x1d')][_0x8416('0x20')]);return _0x4d35a2(_0x2b7cd3[_0x8416('0x1d')]['message']);}else{logger[_0x8416('0x19')](_0x8416('0x1f'),_0x4e9563,_0x8416('0x1a'));_0x4d35a2(_0x2b7cd3['result'][_0x8416('0x20')]);}})[_0x8416('0x21')](function(_0x2d565d){logger[_0x8416('0x1d')](_0x8416('0x1f'),_0x4e9563,_0x2d565d);_0x389093(_0x2d565d);});});}function respondWithStatusCode(_0x2aab53,_0x35af82){_0x35af82=_0x35af82||0xcc;return function(_0x83b23c){if(_0x83b23c){return _0x2aab53[_0x8416('0x22')](_0x35af82);}return _0x2aab53['status'](_0x35af82)[_0x8416('0x23')]();};}function respondWithResult(_0x15b7bd,_0x415a94){_0x415a94=_0x415a94||0xc8;return function(_0x29794d){if(_0x29794d){return _0x15b7bd[_0x8416('0x24')](_0x415a94)[_0x8416('0x25')](_0x29794d);}};}function respondWithFilteredResult(_0x52ec68,_0x40974f){return function(_0xdab763){if(_0xdab763){var _0x23fd8b=_0xdab763['count'],_0x25dd28=_0x40974f['offset'],_0x557a6c=_0x40974f['offset']+_0x40974f['limit'],_0x253b08;if(_0x557a6c>=_0x23fd8b){_0x557a6c=_0x23fd8b;_0x253b08=0xc8;}else{_0x253b08=0xce;}_0x52ec68[_0x8416('0x24')](_0x253b08);return _0x52ec68[_0x8416('0x26')](_0x8416('0x27'),_0x25dd28+'-'+_0x557a6c+'/'+_0x23fd8b)['json'](_0xdab763);}return null;};}function patchUpdates(_0x3bbde6){return function(_0x4ee305){try{jsonpatch[_0x8416('0x28')](_0x4ee305,_0x3bbde6,!![]);}catch(_0x4e4005){return BPromise['reject'](_0x4e4005);}return _0x4ee305[_0x8416('0x29')]();};}function saveUpdates(_0x55e657,_0x289dc8){return function(_0x5de4f7){if(_0x5de4f7){return _0x5de4f7[_0x8416('0x2a')](_0x55e657)[_0x8416('0x18')](function(_0x51eed9){return _0x51eed9;});}return null;};}function removeEntity(_0x55a5fe,_0xa9f0ef){return function(_0x532278){if(_0x532278){return _0x532278[_0x8416('0x2b')]()[_0x8416('0x18')](function(){_0x55a5fe[_0x8416('0x24')](0xcc)[_0x8416('0x23')]();});}};}function handleEntityNotFound(_0xa90969,_0x24445f){return function(_0x2bfc6a){if(!_0x2bfc6a){_0xa90969[_0x8416('0x22')](0x194);}return _0x2bfc6a;};}function handleError(_0x5ca601,_0x6619c6){_0x6619c6=_0x6619c6||0x1f4;return function(_0x147247){logger[_0x8416('0x1d')](_0x147247['stack']);if(_0x147247[_0x8416('0x2c')]){delete _0x147247[_0x8416('0x2c')];}_0x5ca601[_0x8416('0x24')](_0x6619c6)[_0x8416('0x2d')](_0x147247);};}exports[_0x8416('0x2e')]=function(_0x4ffa2f,_0x1d8b87){var _0x5a0f15={},_0x129d8a={},_0xdc513c={'count':0x0,'rows':[]};var _0x4f4170=_[_0x8416('0x2f')](db[_0x8416('0x30')][_0x8416('0x31')],function(_0x46ea79){return{'name':_0x46ea79[_0x8416('0x32')],'type':_0x46ea79[_0x8416('0x33')][_0x8416('0x34')]};});_0x129d8a['model']=_[_0x8416('0x2f')](_0x4f4170,_0x8416('0x2c'));_0x129d8a[_0x8416('0x35')]=_[_0x8416('0x36')](_0x4ffa2f[_0x8416('0x35')]);_0x129d8a[_0x8416('0x37')]=_[_0x8416('0x38')](_0x129d8a[_0x8416('0x39')],_0x129d8a[_0x8416('0x35')]);_0x5a0f15['attributes']=_['intersection'](_0x129d8a[_0x8416('0x39')],qs[_0x8416('0x3a')](_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3a')]));_0x5a0f15[_0x8416('0x3b')]=_0x5a0f15[_0x8416('0x3b')]['length']?_0x5a0f15[_0x8416('0x3b')]:_0x129d8a[_0x8416('0x39')];if(!_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3c')](_0x8416('0x3d'))){_0x5a0f15[_0x8416('0x3e')]=qs[_0x8416('0x3e')](_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3e')]);_0x5a0f15[_0x8416('0x3f')]=qs[_0x8416('0x3f')](_0x4ffa2f[_0x8416('0x35')][_0x8416('0x3f')]);}_0x5a0f15['order']=qs[_0x8416('0x40')](_0x4ffa2f['query'][_0x8416('0x40')]);_0x5a0f15[_0x8416('0x41')]=qs['filters'](_[_0x8416('0x42')](_0x4ffa2f['query'],_0x129d8a[_0x8416('0x37')]),_0x4f4170);if(_0x4ffa2f['query']['filter']){_0x5a0f15[_0x8416('0x41')]=_[_0x8416('0x43')](_0x5a0f15['where'],{'$or':_[_0x8416('0x2f')](_0x4f4170,function(_0x3e8e8c){if(_0x3e8e8c[_0x8416('0x33')]!=='VIRTUAL'){var _0x592e7d={};_0x592e7d[_0x3e8e8c[_0x8416('0x2c')]]={'$like':'%'+_0x4ffa2f[_0x8416('0x35')]['filter']+'%'};return _0x592e7d;}})});}_0x5a0f15=_[_0x8416('0x43')]({},_0x5a0f15,_0x4ffa2f[_0x8416('0x44')]);var _0x17d585={'where':_0x5a0f15[_0x8416('0x41')]};return db[_0x8416('0x30')][_0x8416('0x45')](_0x17d585)[_0x8416('0x18')](function(_0x2b0a7e){_0xdc513c[_0x8416('0x45')]=_0x2b0a7e;if(_0x4ffa2f[_0x8416('0x35')][_0x8416('0x46')]){_0x5a0f15['include']=[{'all':!![]}];}return db[_0x8416('0x30')][_0x8416('0x47')](_0x5a0f15);})[_0x8416('0x18')](function(_0x3196a2){_0xdc513c[_0x8416('0x48')]=_0x3196a2;return _0xdc513c;})[_0x8416('0x18')](respondWithFilteredResult(_0x1d8b87,_0x5a0f15))[_0x8416('0x21')](handleError(_0x1d8b87,null));};exports['show']=function(_0x501cde,_0x38c148){var _0x16ca3c={'raw':![],'where':{'id':_0x501cde[_0x8416('0x49')]['id']}},_0x2200cf={};_0x2200cf[_0x8416('0x39')]=_['keys'](db[_0x8416('0x30')]['rawAttributes']);_0x2200cf[_0x8416('0x35')]=_['keys'](_0x501cde[_0x8416('0x35')]);_0x2200cf[_0x8416('0x37')]=_[_0x8416('0x38')](_0x2200cf[_0x8416('0x39')],_0x2200cf['query']);_0x16ca3c[_0x8416('0x3b')]=_['intersection'](_0x2200cf[_0x8416('0x39')],qs[_0x8416('0x3a')](_0x501cde[_0x8416('0x35')][_0x8416('0x3a')]));_0x16ca3c[_0x8416('0x3b')]=_0x16ca3c[_0x8416('0x3b')][_0x8416('0x4a')]?_0x16ca3c[_0x8416('0x3b')]:_0x2200cf[_0x8416('0x39')];if(_0x501cde[_0x8416('0x35')][_0x8416('0x46')]){_0x16ca3c['include']=[{'all':!![]}];}_0x16ca3c=_[_0x8416('0x43')]({},_0x16ca3c,_0x501cde['options']);return db[_0x8416('0x30')][_0x8416('0x4b')](_0x16ca3c)[_0x8416('0x18')](handleEntityNotFound(_0x38c148,null))['then'](respondWithResult(_0x38c148,null))[_0x8416('0x21')](handleError(_0x38c148,null));};exports[_0x8416('0x4c')]=function(_0x2861fa,_0x41ca42){return db[_0x8416('0x30')][_0x8416('0x4c')](_0x2861fa[_0x8416('0x4d')],{})[_0x8416('0x18')](respondWithResult(_0x41ca42,0xc9))[_0x8416('0x21')](handleError(_0x41ca42,null));};exports[_0x8416('0x2a')]=function(_0x26d9f2,_0x1d9a02){if(_0x26d9f2['body']['id']){delete _0x26d9f2[_0x8416('0x4d')]['id'];}return db[_0x8416('0x30')][_0x8416('0x4b')]({'where':{'id':_0x26d9f2['params']['id']}})[_0x8416('0x18')](handleEntityNotFound(_0x1d9a02,null))[_0x8416('0x18')](saveUpdates(_0x26d9f2['body'],null))[_0x8416('0x18')](respondWithResult(_0x1d9a02,null))[_0x8416('0x21')](handleError(_0x1d9a02,null));};exports[_0x8416('0x2b')]=function(_0x5cb14a,_0x2ea87a){return db[_0x8416('0x30')]['find']({'where':{'id':_0x5cb14a[_0x8416('0x49')]['id']}})[_0x8416('0x18')](handleEntityNotFound(_0x2ea87a,null))[_0x8416('0x18')](removeEntity(_0x2ea87a,null))[_0x8416('0x21')](handleError(_0x2ea87a,null));};exports['getConfigurations']=function(_0x188240,_0x14ff1a,_0x38901e){var _0x5c9fa7={};var _0x384c25={};var _0x1eea45;var _0x978251;return db[_0x8416('0x30')][_0x8416('0x4e')]({'where':{'id':_0x188240[_0x8416('0x49')]['id']}})[_0x8416('0x18')](handleEntityNotFound(_0x14ff1a,null))['then'](function(_0x56b0ad){if(_0x56b0ad){_0x1eea45=_0x56b0ad;_0x384c25[_0x8416('0x39')]=_[_0x8416('0x36')](db[_0x8416('0x4f')][_0x8416('0x31')]);_0x384c25['query']=_[_0x8416('0x36')](_0x188240[_0x8416('0x35')]);_0x384c25[_0x8416('0x37')]=_[_0x8416('0x38')](_0x384c25[_0x8416('0x39')],_0x384c25[_0x8416('0x35')]);_0x5c9fa7[_0x8416('0x3b')]=_['intersection'](_0x384c25['model'],qs[_0x8416('0x3a')](_0x188240[_0x8416('0x35')][_0x8416('0x3a')]));_0x5c9fa7['attributes']=_0x5c9fa7[_0x8416('0x3b')][_0x8416('0x4a')]?_0x5c9fa7['attributes']:_0x384c25[_0x8416('0x39')];_0x5c9fa7[_0x8416('0x50')]=qs[_0x8416('0x40')](_0x188240['query'][_0x8416('0x40')]);_0x5c9fa7[_0x8416('0x41')]=qs[_0x8416('0x37')](_[_0x8416('0x42')](_0x188240['query'],_0x384c25[_0x8416('0x37')]));if(_0x188240[_0x8416('0x35')]['filter']){_0x5c9fa7['where']=_[_0x8416('0x43')](_0x5c9fa7['where'],{'$or':_['map'](_0x5c9fa7[_0x8416('0x3b')],function(_0x21d24c){var _0x563746={};_0x563746[_0x21d24c]={'$like':'%'+_0x188240[_0x8416('0x35')]['filter']+'%'};return _0x563746;})});}_0x5c9fa7=_[_0x8416('0x43')]({},_0x5c9fa7,_0x188240[_0x8416('0x44')]);return _0x1eea45[_0x8416('0x51')](_0x5c9fa7);}})[_0x8416('0x18')](function(_0x4ac7c6){if(_0x4ac7c6){_0x978251=_0x4ac7c6['length'];if(!_0x188240[_0x8416('0x35')][_0x8416('0x3c')](_0x8416('0x3d'))){_0x5c9fa7['limit']=qs[_0x8416('0x3e')](_0x188240[_0x8416('0x35')][_0x8416('0x3e')]);_0x5c9fa7[_0x8416('0x3f')]=qs['offset'](_0x188240['query']['offset']);}return _0x1eea45[_0x8416('0x51')](_0x5c9fa7);}})['then'](function(_0x4f8d67){if(_0x4f8d67){return _0x4f8d67?{'count':_0x978251,'rows':_0x4f8d67}:null;}})[_0x8416('0x18')](respondWithResult(_0x14ff1a,null))[_0x8416('0x21')](handleError(_0x14ff1a,null));};exports[_0x8416('0x52')]=function(_0x517423,_0x2dd703,_0x1e57c3){if(_0x517423[_0x8416('0x4d')]['id']){delete _0x517423[_0x8416('0x4d')]['id'];}return db[_0x8416('0x30')][_0x8416('0x4e')]({'where':{'id':_0x517423[_0x8416('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dd703,null))[_0x8416('0x18')](function(_0x2e0523){if(_0x2e0523){_0x517423[_0x8416('0x4d')][_0x8416('0x53')]=_0x2e0523['id'];_0x517423[_0x8416('0x4d')]['Subjects']=integrations[_0x8416('0x54')](_0x517423['body']['channel'],_0x517423[_0x8416('0x4d')][_0x8416('0x33')]);_0x517423['body'][_0x8416('0x55')]=integrations[_0x8416('0x56')](_0x517423['body'][_0x8416('0x57')],_0x517423[_0x8416('0x4d')]['type']);return db[_0x8416('0x4f')][_0x8416('0x4c')](_0x517423[_0x8416('0x4d')],{'include':[{'model':db[_0x8416('0x58')],'as':'Subjects'},{'model':db[_0x8416('0x58')],'as':_0x8416('0x55')}]});}return null;})['then'](respondWithResult(_0x2dd703,null))[_0x8416('0x21')](handleError(_0x2dd703,null));};exports[_0x8416('0x59')]=function(_0x5ac190,_0x5ec75f,_0x1a1aea){var _0x4eded8=[{'name':'priority','label':_0x8416('0x5a'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x46ea68='';return db[_0x8416('0x30')][_0x8416('0x4e')]({'where':{'id':_0x5ac190[_0x8416('0x49')]['id']},'attributes':['id','remoteUri','authType','username','password','consumerKey',_0x8416('0x5b'),_0x8416('0x5c'),_0x8416('0x5d')]})['then'](handleEntityNotFound(_0x5ec75f,null))[_0x8416('0x18')](function(_0x367126){if(_0x367126){_0x46ea68=_0x367126[_0x8416('0x5e')];var _0x588ee4=_0x46ea68['slice'](-0x1);if(_0x588ee4==='/'){_0x46ea68=_0x46ea68['substring'](0x0,_0x46ea68[_0x8416('0x5f')](_0x588ee4));}var _0x3f79b9={'method':_0x8416('0x60'),'uri':util[_0x8416('0x61')](_0x8416('0x62'),_0x46ea68),'headers':{'Content-Type':_0x8416('0x63'),'Accept':_0x8416('0x63')},'json':!![]};if(_0x367126[_0x8416('0x64')]===_0x8416('0x65')){_0x3f79b9[_0x8416('0x66')][_0x8416('0x67')]=util[_0x8416('0x61')]('Basic\x20%s',new Buffer(util[_0x8416('0x61')]('%s:%s',_0x367126[_0x8416('0x68')],_0x367126[_0x8416('0x69')]))[_0x8416('0x6a')](_0x8416('0x6b')));}return rp(_0x3f79b9)[_0x8416('0x18')](function(_0x42f902){return _0x4eded8[_0x8416('0x6c')](_[_0x8416('0x2f')](_0x42f902['_embedded'][_0x8416('0x6d')],function(_0x4f4039){return{'id':_0x4f4039[_0x8416('0x2c')],'name':_0x4f4039[_0x8416('0x2c')],'type':_0x4f4039['type'],'active':_0x4f4039[_0x8416('0x6e')],'label':_0x4f4039[_0x8416('0x6f')],'custom':!![]};}));});}})[_0x8416('0x18')](function(_0x210e5e){return{'count':_0x210e5e[_0x8416('0x4a')],'rows':_0x210e5e};})[_0x8416('0x18')](respondWithResult(_0x5ec75f,null))[_0x8416('0x21')](function(_0x862d95){var _0xe051e8=_0x5ac190[_0x8416('0x35')]['test']?0x1f4:_0x862d95[_0x8416('0x70')]||0x1f4;logger[_0x8416('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x8416('0x59'),_0xe051e8,JSON[_0x8416('0x1c')](_0x862d95));delete _0x862d95[_0x8416('0x2c')];if(_0xe051e8===0x191){_0xe051e8=0x190;}_0x5ec75f['status'](_0xe051e8)[_0x8416('0x2d')](_0x5ac190[_0x8416('0x35')][_0x8416('0x71')]?{'message':_0x8416('0x72'),'statusCode':_0x862d95[_0x8416('0x70')]}:_0x862d95);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e7e4870..c8ea3d2 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 _0x8126=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x7c3c27,_0x16c034){var _0x4a2c4b=function(_0x293b82){while(--_0x293b82){_0x7c3c27['push'](_0x7c3c27['shift']());}};_0x4a2c4b(++_0x16c034);}(_0x8126,0x14a));var _0x6812=function(_0x2b6d46,_0x11867e){_0x2b6d46=_0x2b6d46-0x0;var _0x555bdb=_0x8126[_0x2b6d46];return _0x555bdb;};'use strict';var _=require(_0x6812('0x0'));var util=require(_0x6812('0x1'));var logger=require(_0x6812('0x2'))(_0x6812('0x3'));var moment=require(_0x6812('0x4'));var BPromise=require(_0x6812('0x5'));var rp=require(_0x6812('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6812('0x7'));var config=require(_0x6812('0x8'));var attributes=require(_0x6812('0x9'));var integrations=require(_0x6812('0xa'));module[_0x6812('0xb')]=function(_0x2c96d2,_0x2722fc){return _0x2c96d2[_0x6812('0xc')](_0x6812('0xd'),attributes,{'tableName':_0x6812('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb96f=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5a7f66,_0x4c82b3){var _0x3e5205=function(_0x1a38a4){while(--_0x1a38a4){_0x5a7f66['push'](_0x5a7f66['shift']());}};_0x3e5205(++_0x4c82b3);}(_0xb96f,0xf0));var _0xfb96=function(_0x625357,_0x302e0c){_0x625357=_0x625357-0x0;var _0x229340=_0xb96f[_0x625357];return _0x229340;};'use strict';var _=require(_0xfb96('0x0'));var util=require(_0xfb96('0x1'));var logger=require(_0xfb96('0x2'))('api');var moment=require(_0xfb96('0x3'));var BPromise=require(_0xfb96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb96('0x5'));var rimraf=require('rimraf');var config=require(_0xfb96('0x6'));var attributes=require(_0xfb96('0x7'));var integrations=require(_0xfb96('0x8'));module[_0xfb96('0x9')]=function(_0xfece4d,_0x3e8938){return _0xfece4d['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 99bf170..64a4ffe 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 _0xd06d=['error','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','map','include','model','stringify','ShowDeskAccount','find','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xd06d,0x13b));var _0xdd06=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0xd06d[_0x528342];return _0x27dd91;};'use strict';var _=require(_0xdd06('0x0'));var util=require('util');var moment=require(_0xdd06('0x1'));var BPromise=require(_0xdd06('0x2'));var rs=require(_0xdd06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd06('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd06('0x5'));var jayson=require(_0xdd06('0x6'));var client=jayson[_0xdd06('0x7')][_0xdd06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ee680,_0x1b56cf,_0x594eb7){return new BPromise(function(_0x78ffc4,_0x384a3b){return client[_0xdd06('0x9')](_0x3ee680,_0x594eb7)[_0xdd06('0xa')](function(_0xc15cd6){logger[_0xdd06('0xb')]('DeskAccount,\x20%s,\x20%s',_0x1b56cf,_0xdd06('0xc'));logger[_0xdd06('0xd')](_0xdd06('0xe'),_0x1b56cf,_0xdd06('0xc'),JSON['stringify'](_0xc15cd6));if(_0xc15cd6['error']){if(_0xc15cd6['error']['code']===0x1f4){logger[_0xdd06('0xf')](_0xdd06('0x10'),_0x1b56cf,_0xc15cd6[_0xdd06('0xf')][_0xdd06('0x11')]);return _0x384a3b(_0xc15cd6[_0xdd06('0xf')][_0xdd06('0x11')]);}logger[_0xdd06('0xf')](_0xdd06('0x10'),_0x1b56cf,_0xc15cd6[_0xdd06('0xf')]['message']);return _0x78ffc4(_0xc15cd6[_0xdd06('0xf')][_0xdd06('0x11')]);}else{logger[_0xdd06('0xb')](_0xdd06('0x10'),_0x1b56cf,'request\x20sent');_0x78ffc4(_0xc15cd6[_0xdd06('0x12')][_0xdd06('0x11')]);}})['catch'](function(_0x5ad2a3){logger[_0xdd06('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1b56cf,_0x5ad2a3);_0x384a3b(_0x5ad2a3);});});}exports[_0xdd06('0x13')]=function(_0x50771b){var _0x1fdc41=this;return new Promise(function(_0x2cf0c6,_0x27d4b4){return db[_0xdd06('0x14')]['findAll']({'raw':_0x50771b['options']?_0x50771b[_0xdd06('0x15')][_0xdd06('0x16')]===undefined?!![]:![]:!![],'where':_0x50771b['options']?_0x50771b[_0xdd06('0x15')][_0xdd06('0x17')]||null:null,'attributes':_0x50771b[_0xdd06('0x15')]?_0x50771b['options'][_0xdd06('0x18')]||null:null,'limit':_0x50771b[_0xdd06('0x15')]?_0x50771b[_0xdd06('0x15')][_0xdd06('0x19')]||null:null,'include':_0x50771b[_0xdd06('0x15')]?_0x50771b['options']['include']?_[_0xdd06('0x1a')](_0x50771b[_0xdd06('0x15')][_0xdd06('0x1b')],function(_0x2f27a2){return{'model':db[_0x2f27a2[_0xdd06('0x1c')]],'as':_0x2f27a2['as'],'attributes':_0x2f27a2[_0xdd06('0x18')],'include':_0x2f27a2[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x2f27a2['include'],function(_0x1e91bf){return{'model':db[_0x1e91bf['model']],'as':_0x1e91bf['as'],'attributes':_0x1e91bf[_0xdd06('0x18')],'include':_0x1e91bf[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x1e91bf[_0xdd06('0x1b')],function(_0x14b7be){return{'model':db[_0x14b7be[_0xdd06('0x1c')]],'as':_0x14b7be['as'],'attributes':_0x14b7be[_0xdd06('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdd06('0xa')](function(_0x4aa702){logger[_0xdd06('0xb')](_0xdd06('0x13'),_0x50771b);logger[_0xdd06('0xd')](_0xdd06('0x13'),_0x50771b,JSON[_0xdd06('0x1d')](_0x4aa702));_0x2cf0c6(_0x4aa702);})['catch'](function(_0x52798c){logger['error'](_0xdd06('0x13'),_0x52798c['message'],_0x50771b);_0x27d4b4(_0x1fdc41[_0xdd06('0xf')](0x1f4,_0x52798c['message']));});});};exports[_0xdd06('0x1e')]=function(_0xae08e9){var _0x9f7a58=this;return new Promise(function(_0x340af4,_0x2f5baf){return db[_0xdd06('0x14')][_0xdd06('0x1f')]({'raw':_0xae08e9['options']?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x16')]===undefined?!![]:![]:!![],'where':_0xae08e9['options']?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x17')]||null:null,'attributes':_0xae08e9[_0xdd06('0x15')]?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x18')]||null:null,'include':_0xae08e9[_0xdd06('0x15')]?_0xae08e9[_0xdd06('0x15')][_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0xae08e9[_0xdd06('0x15')][_0xdd06('0x1b')],function(_0x2a559b){return{'model':db[_0x2a559b[_0xdd06('0x1c')]],'as':_0x2a559b['as'],'attributes':_0x2a559b[_0xdd06('0x18')],'include':_0x2a559b[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x2a559b[_0xdd06('0x1b')],function(_0x55aa6f){return{'model':db[_0x55aa6f[_0xdd06('0x1c')]],'as':_0x55aa6f['as'],'attributes':_0x55aa6f['attributes'],'include':_0x55aa6f[_0xdd06('0x1b')]?_[_0xdd06('0x1a')](_0x55aa6f[_0xdd06('0x1b')],function(_0x5b59cc){return{'model':db[_0x5b59cc[_0xdd06('0x1c')]],'as':_0x5b59cc['as'],'attributes':_0x5b59cc[_0xdd06('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdd06('0xa')](function(_0x215788){logger[_0xdd06('0xb')](_0xdd06('0x1e'),_0xae08e9);logger['debug']('ShowDeskAccount',_0xae08e9,JSON['stringify'](_0x215788));_0x340af4(_0x215788);})[_0xdd06('0x20')](function(_0x2ff511){logger[_0xdd06('0xf')]('ShowDeskAccount',_0x2ff511[_0xdd06('0x11')],_0xae08e9);_0x2f5baf(_0x9f7a58[_0xdd06('0xf')](0x1f4,_0x2ff511[_0xdd06('0x11')]));});});}; \ No newline at end of file +var _0xfc6d=['raw','attributes','limit','include','model','map','catch','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetDeskAccount','DeskAccount','options'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0xfc6d,0xee));var _0xdfc6=function(_0x5e9bfd,_0x235485){_0x5e9bfd=_0x5e9bfd-0x0;var _0x3b34d2=_0xfc6d[_0x5e9bfd];return _0x3b34d2;};'use strict';var _=require(_0xdfc6('0x0'));var util=require(_0xdfc6('0x1'));var moment=require(_0xdfc6('0x2'));var BPromise=require(_0xdfc6('0x3'));var rs=require(_0xdfc6('0x4'));var fs=require('fs');var Redis=require(_0xdfc6('0x5'));var db=require(_0xdfc6('0x6'))['db'];var utils=require(_0xdfc6('0x7'));var logger=require(_0xdfc6('0x8'))(_0xdfc6('0x9'));var config=require(_0xdfc6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdfc6('0xb')][_0xdfc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ec2,_0x2f0b41,_0x2cd9a1){return new BPromise(function(_0x574f80,_0x5e302e){return client[_0xdfc6('0xd')](_0x4a6ec2,_0x2cd9a1)[_0xdfc6('0xe')](function(_0x555500){logger[_0xdfc6('0xf')](_0xdfc6('0x10'),_0x2f0b41,'request\x20sent');logger[_0xdfc6('0x11')](_0xdfc6('0x12'),_0x2f0b41,'request\x20sent',JSON[_0xdfc6('0x13')](_0x555500));if(_0x555500[_0xdfc6('0x14')]){if(_0x555500['error'][_0xdfc6('0x15')]===0x1f4){logger[_0xdfc6('0x14')](_0xdfc6('0x10'),_0x2f0b41,_0x555500[_0xdfc6('0x14')][_0xdfc6('0x16')]);return _0x5e302e(_0x555500[_0xdfc6('0x14')][_0xdfc6('0x16')]);}logger[_0xdfc6('0x14')]('DeskAccount,\x20%s,\x20%s',_0x2f0b41,_0x555500[_0xdfc6('0x14')]['message']);return _0x574f80(_0x555500['error'][_0xdfc6('0x16')]);}else{logger[_0xdfc6('0xf')](_0xdfc6('0x10'),_0x2f0b41,_0xdfc6('0x17'));_0x574f80(_0x555500[_0xdfc6('0x18')][_0xdfc6('0x16')]);}})['catch'](function(_0x5e51ff){logger[_0xdfc6('0x14')](_0xdfc6('0x10'),_0x2f0b41,_0x5e51ff);_0x5e302e(_0x5e51ff);});});}exports[_0xdfc6('0x19')]=function(_0x395530){var _0x491750=this;return new Promise(function(_0x50fcb4,_0x423496){return db[_0xdfc6('0x1a')]['findAll']({'raw':_0x395530['options']?_0x395530[_0xdfc6('0x1b')][_0xdfc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x395530[_0xdfc6('0x1b')]?_0x395530[_0xdfc6('0x1b')]['where']||null:null,'attributes':_0x395530[_0xdfc6('0x1b')]?_0x395530[_0xdfc6('0x1b')][_0xdfc6('0x1d')]||null:null,'limit':_0x395530[_0xdfc6('0x1b')]?_0x395530['options'][_0xdfc6('0x1e')]||null:null,'include':_0x395530[_0xdfc6('0x1b')]?_0x395530['options'][_0xdfc6('0x1f')]?_['map'](_0x395530[_0xdfc6('0x1b')][_0xdfc6('0x1f')],function(_0x1f81b3){return{'model':db[_0x1f81b3[_0xdfc6('0x20')]],'as':_0x1f81b3['as'],'attributes':_0x1f81b3['attributes'],'include':_0x1f81b3[_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0x1f81b3[_0xdfc6('0x1f')],function(_0x4ece58){return{'model':db[_0x4ece58[_0xdfc6('0x20')]],'as':_0x4ece58['as'],'attributes':_0x4ece58[_0xdfc6('0x1d')],'include':_0x4ece58[_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0x4ece58[_0xdfc6('0x1f')],function(_0x4415d1){return{'model':db[_0x4415d1[_0xdfc6('0x20')]],'as':_0x4415d1['as'],'attributes':_0x4415d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfc6('0xe')](function(_0x342ba8){logger[_0xdfc6('0xf')](_0xdfc6('0x19'),_0x395530);logger['debug'](_0xdfc6('0x19'),_0x395530,JSON[_0xdfc6('0x13')](_0x342ba8));_0x50fcb4(_0x342ba8);})[_0xdfc6('0x22')](function(_0x21ff8b){logger[_0xdfc6('0x14')](_0xdfc6('0x19'),_0x21ff8b[_0xdfc6('0x16')],_0x395530);_0x423496(_0x491750['error'](0x1f4,_0x21ff8b[_0xdfc6('0x16')]));});});};exports[_0xdfc6('0x23')]=function(_0x4f9b00){var _0x63b73a=this;return new Promise(function(_0xeebf89,_0x3e4f8d){return db[_0xdfc6('0x1a')][_0xdfc6('0x24')]({'raw':_0x4f9b00[_0xdfc6('0x1b')]?_0x4f9b00[_0xdfc6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4f9b00[_0xdfc6('0x1b')]?_0x4f9b00[_0xdfc6('0x1b')][_0xdfc6('0x25')]||null:null,'attributes':_0x4f9b00['options']?_0x4f9b00[_0xdfc6('0x1b')]['attributes']||null:null,'include':_0x4f9b00[_0xdfc6('0x1b')]?_0x4f9b00[_0xdfc6('0x1b')][_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0x4f9b00[_0xdfc6('0x1b')][_0xdfc6('0x1f')],function(_0x27922c){return{'model':db[_0x27922c[_0xdfc6('0x20')]],'as':_0x27922c['as'],'attributes':_0x27922c[_0xdfc6('0x1d')],'include':_0x27922c[_0xdfc6('0x1f')]?_['map'](_0x27922c[_0xdfc6('0x1f')],function(_0xa0b95f){return{'model':db[_0xa0b95f[_0xdfc6('0x20')]],'as':_0xa0b95f['as'],'attributes':_0xa0b95f['attributes'],'include':_0xa0b95f[_0xdfc6('0x1f')]?_[_0xdfc6('0x21')](_0xa0b95f[_0xdfc6('0x1f')],function(_0x314f60){return{'model':db[_0x314f60[_0xdfc6('0x20')]],'as':_0x314f60['as'],'attributes':_0x314f60[_0xdfc6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdfc6('0xe')](function(_0x1c0954){logger[_0xdfc6('0xf')](_0xdfc6('0x23'),_0x4f9b00);logger[_0xdfc6('0x11')](_0xdfc6('0x23'),_0x4f9b00,JSON[_0xdfc6('0x13')](_0x1c0954));_0xeebf89(_0x1c0954);})['catch'](function(_0x594133){logger[_0xdfc6('0x14')](_0xdfc6('0x23'),_0x594133[_0xdfc6('0x16')],_0x4f9b00);_0x3e4f8d(_0x63b73a[_0xdfc6('0x14')](0x1f4,_0x594133[_0xdfc6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c56d290..53a1b8e 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 _0x9512=['setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post'];(function(_0x109db8,_0xf0e481){var _0x3448f7=function(_0x50938d){while(--_0x50938d){_0x109db8['push'](_0x109db8['shift']());}};_0x3448f7(++_0xf0e481);}(_0x9512,0x75));var _0x2951=function(_0x4de958,_0x5b760e){_0x4de958=_0x4de958-0x0;var _0x6c13ff=_0x9512[_0x4de958];return _0x6c13ff;};'use strict';var multer=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var path=require(_0x2951('0x2'));var timeout=require(_0x2951('0x3'));var express=require(_0x2951('0x4'));var router=express[_0x2951('0x5')]();var auth=require(_0x2951('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2951('0x7'));var controller=require(_0x2951('0x8'));router[_0x2951('0x9')]('/',auth[_0x2951('0xa')](),controller[_0x2951('0xb')]);router[_0x2951('0x9')](_0x2951('0xc'),auth['isAuthenticated'](),controller[_0x2951('0xd')]);router[_0x2951('0x9')](_0x2951('0xe'),auth[_0x2951('0xa')](),controller[_0x2951('0xf')]);router[_0x2951('0x9')]('/:id/subjects',auth[_0x2951('0xa')](),controller[_0x2951('0x10')]);router[_0x2951('0x9')](_0x2951('0x11'),auth['isAuthenticated'](),controller[_0x2951('0x12')]);router[_0x2951('0x9')](_0x2951('0x13'),auth[_0x2951('0xa')](),controller[_0x2951('0x14')]);router['post']('/',auth[_0x2951('0xa')](),controller[_0x2951('0x15')]);router[_0x2951('0x16')](_0x2951('0x13'),auth[_0x2951('0xa')](),controller[_0x2951('0x17')]);router[_0x2951('0x18')](_0x2951('0xc'),auth[_0x2951('0xa')](),controller[_0x2951('0x19')]);router[_0x2951('0x1a')](_0x2951('0xc'),auth[_0x2951('0xa')](),controller['destroy']);module[_0x2951('0x1b')]=router; \ No newline at end of file +var _0x8506=['/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x1df328,_0x32ddd1){var _0x41c8b0=function(_0x5b2e2d){while(--_0x5b2e2d){_0x1df328['push'](_0x1df328['shift']());}};_0x41c8b0(++_0x32ddd1);}(_0x8506,0xe8));var _0x6850=function(_0x2f5016,_0x46633b){_0x2f5016=_0x2f5016-0x0;var _0x246b40=_0x8506[_0x2f5016];return _0x246b40;};'use strict';var multer=require('multer');var util=require(_0x6850('0x0'));var path=require('path');var timeout=require(_0x6850('0x1'));var express=require('express');var router=express[_0x6850('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x6850('0x3'));var config=require(_0x6850('0x4'));var controller=require(_0x6850('0x5'));router['get']('/',auth[_0x6850('0x6')](),controller[_0x6850('0x7')]);router[_0x6850('0x8')](_0x6850('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6850('0xa'),auth[_0x6850('0x6')](),controller[_0x6850('0xb')]);router['get']('/:id/subjects',auth[_0x6850('0x6')](),controller[_0x6850('0xc')]);router[_0x6850('0x8')](_0x6850('0xd'),auth[_0x6850('0x6')](),controller['getDescriptions']);router[_0x6850('0x8')](_0x6850('0xe'),auth[_0x6850('0x6')](),controller[_0x6850('0xf')]);router[_0x6850('0x10')]('/',auth[_0x6850('0x6')](),controller['create']);router[_0x6850('0x10')](_0x6850('0xe'),auth[_0x6850('0x6')](),controller[_0x6850('0x11')]);router[_0x6850('0x12')](_0x6850('0x9'),auth['isAuthenticated'](),controller[_0x6850('0x13')]);router['delete'](_0x6850('0x9'),auth[_0x6850('0x6')](),controller[_0x6850('0x14')]);module[_0x6850('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 494e233..441f3c1 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 _0xa85d=['sequelize'];(function(_0x220efe,_0x25ac58){var _0x52c213=function(_0xead87e){while(--_0xead87e){_0x220efe['push'](_0x220efe['shift']());}};_0x52c213(++_0x25ac58);}(_0xa85d,0x1e1));var _0xda85=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xa85d[_0x519756];return _0x37047e;};'use strict';var Sequelize=require(_0xda85('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa68b=['exports','STRING','sequelize'];(function(_0x3d808a,_0xe871d0){var _0x4c10f9=function(_0x491930){while(--_0x491930){_0x3d808a['push'](_0x3d808a['shift']());}};_0x4c10f9(++_0xe871d0);}(_0xa68b,0x182));var _0xba68=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xa68b[_0x236d24];return _0x1574cf;};'use strict';var Sequelize=require(_0xba68('0x0'));module[_0xba68('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba68('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 860eda7..15ccba6 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 _0x2928=['getSubjects','getDescriptions','findOne','getTags','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','end','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getFields','DeskField','order','pick'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2928,0xc0));var _0x8292=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x2928[_0x381379];return _0x3e1063;};'use strict';var pdf=require(_0x8292('0x0'));var emlformat=require(_0x8292('0x1'));var rimraf=require(_0x8292('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8292('0x3'));var rp=require('request-promise');var moment=require(_0x8292('0x4'));var BPromise=require(_0x8292('0x5'));var Mustache=require(_0x8292('0x6'));var util=require(_0x8292('0x7'));var path=require(_0x8292('0x8'));var sox=require(_0x8292('0x9'));var csv=require(_0x8292('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8292('0xb'));var squel=require('squel');var crypto=require(_0x8292('0xc'));var jsforce=require(_0x8292('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8292('0xa'));var querystring=require(_0x8292('0xe'));var Papa=require('papaparse');var Redis=require(_0x8292('0xf'));var authService=require(_0x8292('0x10'));var qs=require(_0x8292('0x11'));var as=require(_0x8292('0x12'));var hardwareService=require(_0x8292('0x13'));var logger=require('../../config/logger')(_0x8292('0x14'));var utils=require(_0x8292('0x15'));var config=require(_0x8292('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8292('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1c6d88,_0x3fa99a,_0x1b8f2c,_0x301901){return new BPromise(function(_0x3a09af,_0x507212){var _0x448847=_0x301901||client;return _0x448847[_0x8292('0x18')](_0x1c6d88,_0x1b8f2c)[_0x8292('0x19')](function(_0x16cc82){logger[_0x8292('0x1a')](_0x8292('0x1b'),_0x3fa99a,_0x8292('0x1c'));logger[_0x8292('0x1d')](_0x8292('0x1e'),_0x3fa99a,'request\x20sent',JSON[_0x8292('0x1f')](_0x16cc82));if(_0x16cc82['error']){if(_0x16cc82[_0x8292('0x20')][_0x8292('0x21')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,_0x16cc82[_0x8292('0x20')][_0x8292('0x22')]);return _0x507212(_0x16cc82['error'][_0x8292('0x22')]);}logger[_0x8292('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,_0x16cc82[_0x8292('0x20')][_0x8292('0x22')]);return _0x3a09af(_0x16cc82[_0x8292('0x20')][_0x8292('0x22')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,'request\x20sent');_0x3a09af(_0x16cc82[_0x8292('0x23')][_0x8292('0x22')]);}})['catch'](function(_0x2d15e9){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3fa99a,_0x2d15e9);_0x507212(_0x2d15e9);});});}function respondWithStatusCode(_0x245a75,_0x3bd596){_0x3bd596=_0x3bd596||0xcc;return function(_0x2e7a85){if(_0x2e7a85){return _0x245a75[_0x8292('0x24')](_0x3bd596);}return _0x245a75['status'](_0x3bd596)['end']();};}function respondWithResult(_0x1a2b5b,_0x55e639){_0x55e639=_0x55e639||0xc8;return function(_0x13df76){if(_0x13df76){return _0x1a2b5b[_0x8292('0x25')](_0x55e639)[_0x8292('0x26')](_0x13df76);}};}function respondWithFilteredResult(_0x4d0e85,_0x5b0fbf){return function(_0x178d1a){if(_0x178d1a){var _0xc16c99=_0x178d1a[_0x8292('0x27')],_0x233c62=_0x5b0fbf[_0x8292('0x28')],_0x54e9fe=_0x5b0fbf[_0x8292('0x28')]+_0x5b0fbf['limit'],_0x59a892;if(_0x54e9fe>=_0xc16c99){_0x54e9fe=_0xc16c99;_0x59a892=0xc8;}else{_0x59a892=0xce;}_0x4d0e85[_0x8292('0x25')](_0x59a892);return _0x4d0e85[_0x8292('0x29')](_0x8292('0x2a'),_0x233c62+'-'+_0x54e9fe+'/'+_0xc16c99)[_0x8292('0x26')](_0x178d1a);}return null;};}function patchUpdates(_0x1cabf3){return function(_0x2812bc){try{jsonpatch[_0x8292('0x2b')](_0x2812bc,_0x1cabf3,!![]);}catch(_0x1d5306){return BPromise[_0x8292('0x2c')](_0x1d5306);}return _0x2812bc[_0x8292('0x2d')]();};}function saveUpdates(_0x49d4b2,_0x46ffb1){return function(_0x17ab60){if(_0x17ab60){return _0x17ab60['update'](_0x49d4b2)[_0x8292('0x19')](function(_0x1cb8d3){return _0x1cb8d3;});}return null;};}function removeEntity(_0x355ab1,_0x581585){return function(_0x3d5ca9){if(_0x3d5ca9){return _0x3d5ca9[_0x8292('0x2e')]()[_0x8292('0x19')](function(){_0x355ab1[_0x8292('0x25')](0xcc)[_0x8292('0x2f')]();});}};}function handleEntityNotFound(_0x1b3803,_0x360450){return function(_0x304cb1){if(!_0x304cb1){_0x1b3803[_0x8292('0x24')](0x194);}return _0x304cb1;};}function handleError(_0x3546c3,_0x2e53ec){_0x2e53ec=_0x2e53ec||0x1f4;return function(_0x5d5e40){logger[_0x8292('0x20')](_0x5d5e40['stack']);if(_0x5d5e40[_0x8292('0x30')]){delete _0x5d5e40[_0x8292('0x30')];}_0x3546c3[_0x8292('0x25')](_0x2e53ec)[_0x8292('0x31')](_0x5d5e40);};}exports['index']=function(_0x2e9cd6,_0x518bf0){var _0x3befda={},_0x338024={},_0xe0b67e={'count':0x0,'rows':[]};var _0x277547=_['map'](db[_0x8292('0x32')][_0x8292('0x33')],function(_0x21c1da){return{'name':_0x21c1da[_0x8292('0x34')],'type':_0x21c1da[_0x8292('0x35')][_0x8292('0x36')]};});_0x338024[_0x8292('0x37')]=_[_0x8292('0x38')](_0x277547,_0x8292('0x30'));_0x338024[_0x8292('0x39')]=_[_0x8292('0x3a')](_0x2e9cd6[_0x8292('0x39')]);_0x338024[_0x8292('0x3b')]=_['intersection'](_0x338024[_0x8292('0x37')],_0x338024[_0x8292('0x39')]);_0x3befda[_0x8292('0x3c')]=_[_0x8292('0x3d')](_0x338024[_0x8292('0x37')],qs[_0x8292('0x3e')](_0x2e9cd6[_0x8292('0x39')][_0x8292('0x3e')]));_0x3befda['attributes']=_0x3befda[_0x8292('0x3c')][_0x8292('0x3f')]?_0x3befda[_0x8292('0x3c')]:_0x338024[_0x8292('0x37')];if(!_0x2e9cd6[_0x8292('0x39')][_0x8292('0x40')](_0x8292('0x41'))){_0x3befda['limit']=qs[_0x8292('0x42')](_0x2e9cd6['query'][_0x8292('0x42')]);_0x3befda[_0x8292('0x28')]=qs[_0x8292('0x28')](_0x2e9cd6[_0x8292('0x39')][_0x8292('0x28')]);}_0x3befda['order']=qs['sort'](_0x2e9cd6['query'][_0x8292('0x43')]);_0x3befda[_0x8292('0x44')]=qs[_0x8292('0x3b')](_['pick'](_0x2e9cd6['query'],_0x338024['filters']),_0x277547);if(_0x2e9cd6[_0x8292('0x39')][_0x8292('0x45')]){_0x3befda[_0x8292('0x44')]=_[_0x8292('0x46')](_0x3befda[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x277547,function(_0x57f8da){if(_0x57f8da['type']!==_0x8292('0x47')){var _0x264c28={};_0x264c28[_0x57f8da['name']]={'$like':'%'+_0x2e9cd6['query']['filter']+'%'};return _0x264c28;}})});}_0x3befda=_[_0x8292('0x46')]({},_0x3befda,_0x2e9cd6['options']);var _0x38e8f3={'where':_0x3befda['where']};return db['DeskConfiguration'][_0x8292('0x27')](_0x38e8f3)[_0x8292('0x19')](function(_0x50fd06){_0xe0b67e[_0x8292('0x27')]=_0x50fd06;if(_0x2e9cd6[_0x8292('0x39')][_0x8292('0x48')]){_0x3befda[_0x8292('0x49')]=[{'all':!![]}];}return db[_0x8292('0x32')][_0x8292('0x4a')](_0x3befda);})['then'](function(_0x36a6d1){_0xe0b67e['rows']=_0x36a6d1;return _0xe0b67e;})[_0x8292('0x19')](respondWithFilteredResult(_0x518bf0,_0x3befda))[_0x8292('0x4b')](handleError(_0x518bf0,null));};exports[_0x8292('0x4c')]=function(_0x55041c,_0xc5f635){var _0x37167e={'raw':![],'where':{'id':_0x55041c[_0x8292('0x4d')]['id']}},_0xbd8b7d={};_0xbd8b7d[_0x8292('0x37')]=_['keys'](db[_0x8292('0x32')]['rawAttributes']);_0xbd8b7d[_0x8292('0x39')]=_[_0x8292('0x3a')](_0x55041c[_0x8292('0x39')]);_0xbd8b7d[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0xbd8b7d[_0x8292('0x37')],_0xbd8b7d['query']);_0x37167e[_0x8292('0x3c')]=_[_0x8292('0x3d')](_0xbd8b7d[_0x8292('0x37')],qs['fields'](_0x55041c[_0x8292('0x39')]['fields']));_0x37167e[_0x8292('0x3c')]=_0x37167e['attributes'][_0x8292('0x3f')]?_0x37167e[_0x8292('0x3c')]:_0xbd8b7d[_0x8292('0x37')];if(_0x55041c[_0x8292('0x39')][_0x8292('0x48')]){_0x37167e[_0x8292('0x49')]=[{'all':!![]}];}_0x37167e=_[_0x8292('0x46')]({},_0x37167e,_0x55041c[_0x8292('0x4e')]);return db['DeskConfiguration'][_0x8292('0x4f')](_0x37167e)[_0x8292('0x19')](handleEntityNotFound(_0xc5f635,null))[_0x8292('0x19')](respondWithResult(_0xc5f635,null))['catch'](handleError(_0xc5f635,null));};exports['create']=function(_0x4858b5,_0x13653f){return db['DeskConfiguration'][_0x8292('0x50')](_0x4858b5[_0x8292('0x51')],{})[_0x8292('0x19')](respondWithResult(_0x13653f,0xc9))[_0x8292('0x4b')](handleError(_0x13653f,null));};exports[_0x8292('0x52')]=function(_0x2dc111,_0x513877){if(_0x2dc111[_0x8292('0x51')]['id']){delete _0x2dc111[_0x8292('0x51')]['id'];}return db['DeskConfiguration'][_0x8292('0x4f')]({'where':{'id':_0x2dc111[_0x8292('0x4d')]['id']}})['then'](handleEntityNotFound(_0x513877,null))['then'](saveUpdates(_0x2dc111['body'],null))[_0x8292('0x19')](respondWithResult(_0x513877,null))[_0x8292('0x4b')](handleError(_0x513877,null));};exports['destroy']=function(_0x2ae781,_0x25b6d1){return db[_0x8292('0x32')][_0x8292('0x4f')]({'where':{'id':_0x2ae781[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x25b6d1,null))[_0x8292('0x19')](removeEntity(_0x25b6d1,null))[_0x8292('0x4b')](handleError(_0x25b6d1,null));};exports[_0x8292('0x53')]=function(_0x1db158,_0x7701e7,_0x2df0a6){var _0x529157={};var _0x4b32d5={};var _0x590185;var _0x3030ec;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1db158[_0x8292('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7701e7,null))['then'](function(_0x3158bc){if(_0x3158bc){_0x590185=_0x3158bc;_0x4b32d5['model']=_[_0x8292('0x3a')](db[_0x8292('0x54')][_0x8292('0x33')]);_0x4b32d5[_0x8292('0x39')]=_['keys'](_0x1db158['query']);_0x4b32d5[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0x4b32d5[_0x8292('0x37')],_0x4b32d5[_0x8292('0x39')]);_0x529157['attributes']=_[_0x8292('0x3d')](_0x4b32d5[_0x8292('0x37')],qs['fields'](_0x1db158[_0x8292('0x39')][_0x8292('0x3e')]));_0x529157[_0x8292('0x3c')]=_0x529157['attributes'][_0x8292('0x3f')]?_0x529157[_0x8292('0x3c')]:_0x4b32d5[_0x8292('0x37')];_0x529157[_0x8292('0x55')]=qs[_0x8292('0x43')](_0x1db158[_0x8292('0x39')][_0x8292('0x43')]);_0x529157[_0x8292('0x44')]=qs['filters'](_[_0x8292('0x56')](_0x1db158[_0x8292('0x39')],_0x4b32d5['filters']));if(_0x1db158[_0x8292('0x39')]['filter']){_0x529157[_0x8292('0x44')]=_[_0x8292('0x46')](_0x529157[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x529157[_0x8292('0x3c')],function(_0x2694b7){var _0x432d1e={};_0x432d1e[_0x2694b7]={'$like':'%'+_0x1db158['query'][_0x8292('0x45')]+'%'};return _0x432d1e;})});}_0x529157=_[_0x8292('0x46')]({},_0x529157,_0x1db158[_0x8292('0x4e')]);return _0x590185[_0x8292('0x53')](_0x529157);}})[_0x8292('0x19')](function(_0x2e1c42){if(_0x2e1c42){_0x3030ec=_0x2e1c42[_0x8292('0x3f')];if(!_0x1db158['query'][_0x8292('0x40')]('nolimit')){_0x529157['limit']=qs['limit'](_0x1db158[_0x8292('0x39')]['limit']);_0x529157['offset']=qs[_0x8292('0x28')](_0x1db158[_0x8292('0x39')][_0x8292('0x28')]);}return _0x590185[_0x8292('0x53')](_0x529157);}})['then'](function(_0x4ca64e){if(_0x4ca64e){return _0x4ca64e?{'count':_0x3030ec,'rows':_0x4ca64e}:null;}})[_0x8292('0x19')](respondWithResult(_0x7701e7,null))[_0x8292('0x4b')](handleError(_0x7701e7,null));};exports[_0x8292('0x57')]=function(_0x1664c3,_0x5a999c,_0x3a59e1){var _0x1eee9b={};var _0x310cd7={};var _0x311e78;var _0x288a4f;return db[_0x8292('0x32')]['findOne']({'where':{'id':_0x1664c3['params']['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x5a999c,null))[_0x8292('0x19')](function(_0x2b3176){if(_0x2b3176){_0x311e78=_0x2b3176;_0x310cd7['model']=_[_0x8292('0x3a')](db['DeskField']['rawAttributes']);_0x310cd7['query']=_['keys'](_0x1664c3['query']);_0x310cd7['filters']=_[_0x8292('0x3d')](_0x310cd7[_0x8292('0x37')],_0x310cd7[_0x8292('0x39')]);_0x1eee9b['attributes']=_[_0x8292('0x3d')](_0x310cd7[_0x8292('0x37')],qs['fields'](_0x1664c3[_0x8292('0x39')]['fields']));_0x1eee9b[_0x8292('0x3c')]=_0x1eee9b[_0x8292('0x3c')]['length']?_0x1eee9b[_0x8292('0x3c')]:_0x310cd7['model'];_0x1eee9b['order']=qs[_0x8292('0x43')](_0x1664c3[_0x8292('0x39')][_0x8292('0x43')]);_0x1eee9b[_0x8292('0x44')]=qs[_0x8292('0x3b')](_[_0x8292('0x56')](_0x1664c3[_0x8292('0x39')],_0x310cd7[_0x8292('0x3b')]));if(_0x1664c3[_0x8292('0x39')]['filter']){_0x1eee9b[_0x8292('0x44')]=_[_0x8292('0x46')](_0x1eee9b[_0x8292('0x44')],{'$or':_['map'](_0x1eee9b[_0x8292('0x3c')],function(_0x74e129){var _0x1f12c3={};_0x1f12c3[_0x74e129]={'$like':'%'+_0x1664c3[_0x8292('0x39')]['filter']+'%'};return _0x1f12c3;})});}_0x1eee9b=_[_0x8292('0x46')]({},_0x1eee9b,_0x1664c3[_0x8292('0x4e')]);return _0x311e78[_0x8292('0x57')](_0x1eee9b);}})[_0x8292('0x19')](function(_0x32347a){if(_0x32347a){_0x288a4f=_0x32347a[_0x8292('0x3f')];if(!_0x1664c3[_0x8292('0x39')][_0x8292('0x40')]('nolimit')){_0x1eee9b[_0x8292('0x42')]=qs[_0x8292('0x42')](_0x1664c3['query']['limit']);_0x1eee9b['offset']=qs['offset'](_0x1664c3[_0x8292('0x39')][_0x8292('0x28')]);}return _0x311e78[_0x8292('0x57')](_0x1eee9b);}})[_0x8292('0x19')](function(_0x403e55){if(_0x403e55){return _0x403e55?{'count':_0x288a4f,'rows':_0x403e55}:null;}})[_0x8292('0x19')](respondWithResult(_0x5a999c,null))[_0x8292('0x4b')](handleError(_0x5a999c,null));};exports[_0x8292('0x58')]=function(_0x93b5ed,_0x25c8c5,_0x42733f){var _0x30e457={};var _0x435f5c={};var _0x3dcf7a;var _0x58d393;return db[_0x8292('0x32')][_0x8292('0x59')]({'where':{'id':_0x93b5ed[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x25c8c5,null))[_0x8292('0x19')](function(_0x2aa5ce){if(_0x2aa5ce){_0x3dcf7a=_0x2aa5ce;_0x435f5c[_0x8292('0x37')]=_[_0x8292('0x3a')](db[_0x8292('0x54')]['rawAttributes']);_0x435f5c[_0x8292('0x39')]=_[_0x8292('0x3a')](_0x93b5ed[_0x8292('0x39')]);_0x435f5c[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0x435f5c[_0x8292('0x37')],_0x435f5c[_0x8292('0x39')]);_0x30e457['attributes']=_['intersection'](_0x435f5c['model'],qs['fields'](_0x93b5ed['query'][_0x8292('0x3e')]));_0x30e457[_0x8292('0x3c')]=_0x30e457['attributes']['length']?_0x30e457['attributes']:_0x435f5c['model'];_0x30e457['order']=qs[_0x8292('0x43')](_0x93b5ed['query'][_0x8292('0x43')]);_0x30e457['where']=qs[_0x8292('0x3b')](_[_0x8292('0x56')](_0x93b5ed[_0x8292('0x39')],_0x435f5c[_0x8292('0x3b')]));if(_0x93b5ed[_0x8292('0x39')][_0x8292('0x45')]){_0x30e457['where']=_['merge'](_0x30e457[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x30e457[_0x8292('0x3c')],function(_0x4cac2f){var _0x35871f={};_0x35871f[_0x4cac2f]={'$like':'%'+_0x93b5ed[_0x8292('0x39')][_0x8292('0x45')]+'%'};return _0x35871f;})});}_0x30e457=_[_0x8292('0x46')]({},_0x30e457,_0x93b5ed[_0x8292('0x4e')]);return _0x3dcf7a['getDescriptions'](_0x30e457);}})[_0x8292('0x19')](function(_0x211672){if(_0x211672){_0x58d393=_0x211672[_0x8292('0x3f')];if(!_0x93b5ed['query'][_0x8292('0x40')](_0x8292('0x41'))){_0x30e457[_0x8292('0x42')]=qs[_0x8292('0x42')](_0x93b5ed[_0x8292('0x39')]['limit']);_0x30e457[_0x8292('0x28')]=qs[_0x8292('0x28')](_0x93b5ed[_0x8292('0x39')][_0x8292('0x28')]);}return _0x3dcf7a[_0x8292('0x58')](_0x30e457);}})['then'](function(_0x1ff309){if(_0x1ff309){return _0x1ff309?{'count':_0x58d393,'rows':_0x1ff309}:null;}})[_0x8292('0x19')](respondWithResult(_0x25c8c5,null))[_0x8292('0x4b')](handleError(_0x25c8c5,null));};exports['getTags']=function(_0x343b89,_0x34f9d6,_0x7646ff){var _0x32ed13={};var _0x376151={};var _0x4d1f6d;var _0x4c7220;return db[_0x8292('0x32')][_0x8292('0x59')]({'where':{'id':_0x343b89[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x34f9d6,null))[_0x8292('0x19')](function(_0x2762b7){if(_0x2762b7){_0x4d1f6d=_0x2762b7;_0x376151[_0x8292('0x37')]=_[_0x8292('0x3a')](db['Tag'][_0x8292('0x33')]);_0x376151['query']=_['keys'](_0x343b89['query']);_0x376151[_0x8292('0x3b')]=_[_0x8292('0x3d')](_0x376151[_0x8292('0x37')],_0x376151[_0x8292('0x39')]);_0x32ed13[_0x8292('0x3c')]=_['intersection'](_0x376151[_0x8292('0x37')],qs['fields'](_0x343b89['query'][_0x8292('0x3e')]));_0x32ed13[_0x8292('0x3c')]=_0x32ed13[_0x8292('0x3c')][_0x8292('0x3f')]?_0x32ed13[_0x8292('0x3c')]:_0x376151['model'];_0x32ed13[_0x8292('0x55')]=qs['sort'](_0x343b89[_0x8292('0x39')][_0x8292('0x43')]);_0x32ed13['where']=qs[_0x8292('0x3b')](_['pick'](_0x343b89[_0x8292('0x39')],_0x376151[_0x8292('0x3b')]));if(_0x343b89['query'][_0x8292('0x45')]){_0x32ed13[_0x8292('0x44')]=_[_0x8292('0x46')](_0x32ed13[_0x8292('0x44')],{'$or':_[_0x8292('0x38')](_0x32ed13['attributes'],function(_0x351a7){var _0xfc4d95={};_0xfc4d95[_0x351a7]={'$like':'%'+_0x343b89[_0x8292('0x39')][_0x8292('0x45')]+'%'};return _0xfc4d95;})});}_0x32ed13=_[_0x8292('0x46')]({},_0x32ed13,_0x343b89[_0x8292('0x4e')]);return _0x4d1f6d['getTags'](_0x32ed13);}})[_0x8292('0x19')](function(_0x11b0ad){if(_0x11b0ad){_0x4c7220=_0x11b0ad[_0x8292('0x3f')];if(!_0x343b89[_0x8292('0x39')]['hasOwnProperty']('nolimit')){_0x32ed13['limit']=qs[_0x8292('0x42')](_0x343b89[_0x8292('0x39')]['limit']);_0x32ed13['offset']=qs[_0x8292('0x28')](_0x343b89[_0x8292('0x39')][_0x8292('0x28')]);}return _0x4d1f6d[_0x8292('0x5a')](_0x32ed13);}})['then'](function(_0x5308f5){if(_0x5308f5){return _0x5308f5?{'count':_0x4c7220,'rows':_0x5308f5}:null;}})['then'](respondWithResult(_0x34f9d6,null))[_0x8292('0x4b')](handleError(_0x34f9d6,null));};exports[_0x8292('0x5b')]=function(_0x5076a7,_0x45deb8,_0x3f7f9c){if(_0x5076a7[_0x8292('0x51')]['id']){delete _0x5076a7[_0x8292('0x51')]['id'];}return db['DeskConfiguration'][_0x8292('0x59')]({'where':{'id':_0x5076a7[_0x8292('0x4d')]['id']}})[_0x8292('0x19')](handleEntityNotFound(_0x45deb8,null))[_0x8292('0x19')](function(_0x29563c){if(_0x29563c){return _0x29563c[_0x8292('0x5b')](_0x5076a7['body'][_0x8292('0x5c')]||[]);}return null;})[_0x8292('0x19')](respondWithResult(_0x45deb8,null))[_0x8292('0x4b')](handleError(_0x45deb8,null));}; \ No newline at end of file +var _0x77d7=['getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','stack','name','map','DeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy'];(function(_0x11abf9,_0x1ff7e5){var _0x547878=function(_0x2ac98c){while(--_0x2ac98c){_0x11abf9['push'](_0x11abf9['shift']());}};_0x547878(++_0x1ff7e5);}(_0x77d7,0x1d0));var _0x777d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x77d7[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x777d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x777d('0x1'));var zipdir=require(_0x777d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x777d('0x3'));var moment=require('moment');var BPromise=require(_0x777d('0x4'));var Mustache=require('mustache');var util=require(_0x777d('0x5'));var path=require(_0x777d('0x6'));var sox=require(_0x777d('0x7'));var csv=require(_0x777d('0x8'));var ejs=require(_0x777d('0x9'));var fs=require('fs');var _=require(_0x777d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x777d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x777d('0x8'));var querystring=require(_0x777d('0xc'));var Papa=require(_0x777d('0xd'));var Redis=require('ioredis');var authService=require(_0x777d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x777d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x777d('0x10'))(_0x777d('0x11'));var utils=require(_0x777d('0x12'));var config=require(_0x777d('0x13'));var licenseUtil=require(_0x777d('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x777d('0x15'));var client=jayson[_0x777d('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4427f3,_0xbf9048,_0xf5dbad,_0x2a68b7){return new BPromise(function(_0x2c3567,_0x58721b){var _0x41c00a=_0x2a68b7||client;return _0x41c00a[_0x777d('0x17')](_0x4427f3,_0xf5dbad)[_0x777d('0x18')](function(_0x1d999e){logger['info'](_0x777d('0x19'),_0xbf9048,_0x777d('0x1a'));logger[_0x777d('0x1b')](_0x777d('0x1c'),_0xbf9048,'request\x20sent',JSON['stringify'](_0x1d999e));if(_0x1d999e[_0x777d('0x1d')]){if(_0x1d999e[_0x777d('0x1d')][_0x777d('0x1e')]===0x1f4){logger[_0x777d('0x1d')](_0x777d('0x19'),_0xbf9048,_0x1d999e[_0x777d('0x1d')]['message']);return _0x58721b(_0x1d999e[_0x777d('0x1d')][_0x777d('0x1f')]);}logger[_0x777d('0x1d')](_0x777d('0x19'),_0xbf9048,_0x1d999e[_0x777d('0x1d')]['message']);return _0x2c3567(_0x1d999e['error'][_0x777d('0x1f')]);}else{logger[_0x777d('0x20')](_0x777d('0x19'),_0xbf9048,'request\x20sent');_0x2c3567(_0x1d999e['result']['message']);}})[_0x777d('0x21')](function(_0x44b5ab){logger[_0x777d('0x1d')](_0x777d('0x19'),_0xbf9048,_0x44b5ab);_0x58721b(_0x44b5ab);});});}function respondWithStatusCode(_0x41289f,_0x173e18){_0x173e18=_0x173e18||0xcc;return function(_0x1f3e26){if(_0x1f3e26){return _0x41289f[_0x777d('0x22')](_0x173e18);}return _0x41289f[_0x777d('0x23')](_0x173e18)[_0x777d('0x24')]();};}function respondWithResult(_0x9cc436,_0x4a61cd){_0x4a61cd=_0x4a61cd||0xc8;return function(_0x4023bf){if(_0x4023bf){return _0x9cc436[_0x777d('0x23')](_0x4a61cd)[_0x777d('0x25')](_0x4023bf);}};}function respondWithFilteredResult(_0x350eb0,_0x3d12e9){return function(_0x3238df){if(_0x3238df){var _0x13b369=_0x3238df[_0x777d('0x26')],_0x24b5d2=_0x3d12e9['offset'],_0x4d140e=_0x3d12e9[_0x777d('0x27')]+_0x3d12e9['limit'],_0x5458ca;if(_0x4d140e>=_0x13b369){_0x4d140e=_0x13b369;_0x5458ca=0xc8;}else{_0x5458ca=0xce;}_0x350eb0[_0x777d('0x23')](_0x5458ca);return _0x350eb0[_0x777d('0x28')]('Content-Range',_0x24b5d2+'-'+_0x4d140e+'/'+_0x13b369)[_0x777d('0x25')](_0x3238df);}return null;};}function patchUpdates(_0x1e000f){return function(_0x25a1e5){try{jsonpatch[_0x777d('0x29')](_0x25a1e5,_0x1e000f,!![]);}catch(_0x2c60f0){return BPromise[_0x777d('0x2a')](_0x2c60f0);}return _0x25a1e5[_0x777d('0x2b')]();};}function saveUpdates(_0x407b32,_0x22d395){return function(_0x113719){if(_0x113719){return _0x113719[_0x777d('0x2c')](_0x407b32)[_0x777d('0x18')](function(_0x5a74aa){return _0x5a74aa;});}return null;};}function removeEntity(_0x324ad3,_0x5657a8){return function(_0x1c1185){if(_0x1c1185){return _0x1c1185['destroy']()['then'](function(){_0x324ad3[_0x777d('0x23')](0xcc)[_0x777d('0x24')]();});}};}function handleEntityNotFound(_0x31d012,_0x5e704f){return function(_0x43d5a0){if(!_0x43d5a0){_0x31d012[_0x777d('0x22')](0x194);}return _0x43d5a0;};}function handleError(_0x4e5b58,_0x587ae5){_0x587ae5=_0x587ae5||0x1f4;return function(_0x5d5d78){logger['error'](_0x5d5d78[_0x777d('0x2d')]);if(_0x5d5d78['name']){delete _0x5d5d78[_0x777d('0x2e')];}_0x4e5b58[_0x777d('0x23')](_0x587ae5)['send'](_0x5d5d78);};}exports['index']=function(_0x1d27c3,_0x95c32b){var _0x1c7895={},_0x164cf0={},_0x81c879={'count':0x0,'rows':[]};var _0x20acc1=_[_0x777d('0x2f')](db[_0x777d('0x30')]['rawAttributes'],function(_0x570fc0){return{'name':_0x570fc0[_0x777d('0x31')],'type':_0x570fc0[_0x777d('0x32')][_0x777d('0x33')]};});_0x164cf0[_0x777d('0x34')]=_['map'](_0x20acc1,_0x777d('0x2e'));_0x164cf0[_0x777d('0x35')]=_[_0x777d('0x36')](_0x1d27c3[_0x777d('0x35')]);_0x164cf0[_0x777d('0x37')]=_['intersection'](_0x164cf0['model'],_0x164cf0[_0x777d('0x35')]);_0x1c7895['attributes']=_[_0x777d('0x38')](_0x164cf0['model'],qs[_0x777d('0x39')](_0x1d27c3[_0x777d('0x35')][_0x777d('0x39')]));_0x1c7895['attributes']=_0x1c7895[_0x777d('0x3a')][_0x777d('0x3b')]?_0x1c7895[_0x777d('0x3a')]:_0x164cf0['model'];if(!_0x1d27c3[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x1c7895[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x1d27c3[_0x777d('0x35')][_0x777d('0x3e')]);_0x1c7895[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x1d27c3[_0x777d('0x35')][_0x777d('0x27')]);}_0x1c7895[_0x777d('0x3f')]=qs['sort'](_0x1d27c3['query'][_0x777d('0x40')]);_0x1c7895['where']=qs[_0x777d('0x37')](_[_0x777d('0x41')](_0x1d27c3['query'],_0x164cf0[_0x777d('0x37')]),_0x20acc1);if(_0x1d27c3[_0x777d('0x35')][_0x777d('0x42')]){_0x1c7895['where']=_[_0x777d('0x43')](_0x1c7895['where'],{'$or':_[_0x777d('0x2f')](_0x20acc1,function(_0x530528){if(_0x530528['type']!==_0x777d('0x44')){var _0x1a52c7={};_0x1a52c7[_0x530528[_0x777d('0x2e')]]={'$like':'%'+_0x1d27c3[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x1a52c7;}})});}_0x1c7895=_[_0x777d('0x43')]({},_0x1c7895,_0x1d27c3[_0x777d('0x45')]);var _0x5c8edb={'where':_0x1c7895[_0x777d('0x46')]};return db[_0x777d('0x30')][_0x777d('0x26')](_0x5c8edb)[_0x777d('0x18')](function(_0x20b919){_0x81c879[_0x777d('0x26')]=_0x20b919;if(_0x1d27c3['query'][_0x777d('0x47')]){_0x1c7895[_0x777d('0x48')]=[{'all':!![]}];}return db[_0x777d('0x30')][_0x777d('0x49')](_0x1c7895);})[_0x777d('0x18')](function(_0x304498){_0x81c879[_0x777d('0x4a')]=_0x304498;return _0x81c879;})['then'](respondWithFilteredResult(_0x95c32b,_0x1c7895))[_0x777d('0x21')](handleError(_0x95c32b,null));};exports[_0x777d('0x4b')]=function(_0x1dd2ba,_0x37d518){var _0xc0e8bc={'raw':![],'where':{'id':_0x1dd2ba[_0x777d('0x4c')]['id']}},_0x3f32d8={};_0x3f32d8[_0x777d('0x34')]=_['keys'](db[_0x777d('0x30')][_0x777d('0x4d')]);_0x3f32d8[_0x777d('0x35')]=_[_0x777d('0x36')](_0x1dd2ba[_0x777d('0x35')]);_0x3f32d8[_0x777d('0x37')]=_[_0x777d('0x38')](_0x3f32d8['model'],_0x3f32d8[_0x777d('0x35')]);_0xc0e8bc['attributes']=_[_0x777d('0x38')](_0x3f32d8[_0x777d('0x34')],qs[_0x777d('0x39')](_0x1dd2ba['query'][_0x777d('0x39')]));_0xc0e8bc['attributes']=_0xc0e8bc[_0x777d('0x3a')][_0x777d('0x3b')]?_0xc0e8bc['attributes']:_0x3f32d8[_0x777d('0x34')];if(_0x1dd2ba[_0x777d('0x35')]['includeAll']){_0xc0e8bc[_0x777d('0x48')]=[{'all':!![]}];}_0xc0e8bc=_[_0x777d('0x43')]({},_0xc0e8bc,_0x1dd2ba[_0x777d('0x45')]);return db[_0x777d('0x30')][_0x777d('0x4e')](_0xc0e8bc)[_0x777d('0x18')](handleEntityNotFound(_0x37d518,null))[_0x777d('0x18')](respondWithResult(_0x37d518,null))[_0x777d('0x21')](handleError(_0x37d518,null));};exports[_0x777d('0x4f')]=function(_0x18b94b,_0x2ca1c4){return db[_0x777d('0x30')][_0x777d('0x4f')](_0x18b94b[_0x777d('0x50')],{})[_0x777d('0x18')](respondWithResult(_0x2ca1c4,0xc9))[_0x777d('0x21')](handleError(_0x2ca1c4,null));};exports[_0x777d('0x2c')]=function(_0x5805c8,_0x514fdd){if(_0x5805c8['body']['id']){delete _0x5805c8[_0x777d('0x50')]['id'];}return db[_0x777d('0x30')][_0x777d('0x4e')]({'where':{'id':_0x5805c8[_0x777d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x514fdd,null))[_0x777d('0x18')](saveUpdates(_0x5805c8[_0x777d('0x50')],null))[_0x777d('0x18')](respondWithResult(_0x514fdd,null))[_0x777d('0x21')](handleError(_0x514fdd,null));};exports[_0x777d('0x51')]=function(_0x190457,_0x23386e){return db['DeskConfiguration'][_0x777d('0x4e')]({'where':{'id':_0x190457[_0x777d('0x4c')]['id']}})[_0x777d('0x18')](handleEntityNotFound(_0x23386e,null))[_0x777d('0x18')](removeEntity(_0x23386e,null))[_0x777d('0x21')](handleError(_0x23386e,null));};exports[_0x777d('0x52')]=function(_0x12ffc7,_0x427ed1,_0x1f0ed7){var _0x524a6d={};var _0x10ec97={};var _0x2683d1;var _0x35406e;return db[_0x777d('0x30')][_0x777d('0x53')]({'where':{'id':_0x12ffc7[_0x777d('0x4c')]['id']}})[_0x777d('0x18')](handleEntityNotFound(_0x427ed1,null))[_0x777d('0x18')](function(_0x1b8b9b){if(_0x1b8b9b){_0x2683d1=_0x1b8b9b;_0x10ec97[_0x777d('0x34')]=_[_0x777d('0x36')](db[_0x777d('0x54')][_0x777d('0x4d')]);_0x10ec97[_0x777d('0x35')]=_[_0x777d('0x36')](_0x12ffc7['query']);_0x10ec97['filters']=_[_0x777d('0x38')](_0x10ec97[_0x777d('0x34')],_0x10ec97[_0x777d('0x35')]);_0x524a6d[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x10ec97[_0x777d('0x34')],qs[_0x777d('0x39')](_0x12ffc7['query']['fields']));_0x524a6d['attributes']=_0x524a6d[_0x777d('0x3a')][_0x777d('0x3b')]?_0x524a6d[_0x777d('0x3a')]:_0x10ec97[_0x777d('0x34')];_0x524a6d[_0x777d('0x3f')]=qs['sort'](_0x12ffc7['query'][_0x777d('0x40')]);_0x524a6d['where']=qs['filters'](_[_0x777d('0x41')](_0x12ffc7[_0x777d('0x35')],_0x10ec97['filters']));if(_0x12ffc7[_0x777d('0x35')][_0x777d('0x42')]){_0x524a6d['where']=_[_0x777d('0x43')](_0x524a6d['where'],{'$or':_[_0x777d('0x2f')](_0x524a6d[_0x777d('0x3a')],function(_0x41b049){var _0xaa8036={};_0xaa8036[_0x41b049]={'$like':'%'+_0x12ffc7['query']['filter']+'%'};return _0xaa8036;})});}_0x524a6d=_[_0x777d('0x43')]({},_0x524a6d,_0x12ffc7[_0x777d('0x45')]);return _0x2683d1[_0x777d('0x52')](_0x524a6d);}})['then'](function(_0x3b26b0){if(_0x3b26b0){_0x35406e=_0x3b26b0[_0x777d('0x3b')];if(!_0x12ffc7[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x524a6d[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x12ffc7['query']['limit']);_0x524a6d[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x12ffc7['query']['offset']);}return _0x2683d1[_0x777d('0x52')](_0x524a6d);}})[_0x777d('0x18')](function(_0x536205){if(_0x536205){return _0x536205?{'count':_0x35406e,'rows':_0x536205}:null;}})[_0x777d('0x18')](respondWithResult(_0x427ed1,null))[_0x777d('0x21')](handleError(_0x427ed1,null));};exports[_0x777d('0x55')]=function(_0x68efbb,_0x23fec3,_0x366b82){var _0x5ad706={};var _0x2c4b80={};var _0x4b3e11;var _0x53a514;return db['DeskConfiguration'][_0x777d('0x53')]({'where':{'id':_0x68efbb['params']['id']}})['then'](handleEntityNotFound(_0x23fec3,null))[_0x777d('0x18')](function(_0x26c7bb){if(_0x26c7bb){_0x4b3e11=_0x26c7bb;_0x2c4b80[_0x777d('0x34')]=_[_0x777d('0x36')](db['DeskField']['rawAttributes']);_0x2c4b80[_0x777d('0x35')]=_['keys'](_0x68efbb['query']);_0x2c4b80['filters']=_[_0x777d('0x38')](_0x2c4b80[_0x777d('0x34')],_0x2c4b80[_0x777d('0x35')]);_0x5ad706[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x2c4b80['model'],qs[_0x777d('0x39')](_0x68efbb['query'][_0x777d('0x39')]));_0x5ad706[_0x777d('0x3a')]=_0x5ad706[_0x777d('0x3a')][_0x777d('0x3b')]?_0x5ad706[_0x777d('0x3a')]:_0x2c4b80[_0x777d('0x34')];_0x5ad706[_0x777d('0x3f')]=qs[_0x777d('0x40')](_0x68efbb[_0x777d('0x35')][_0x777d('0x40')]);_0x5ad706[_0x777d('0x46')]=qs['filters'](_[_0x777d('0x41')](_0x68efbb['query'],_0x2c4b80[_0x777d('0x37')]));if(_0x68efbb[_0x777d('0x35')][_0x777d('0x42')]){_0x5ad706[_0x777d('0x46')]=_[_0x777d('0x43')](_0x5ad706[_0x777d('0x46')],{'$or':_['map'](_0x5ad706['attributes'],function(_0x934749){var _0x154a71={};_0x154a71[_0x934749]={'$like':'%'+_0x68efbb[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x154a71;})});}_0x5ad706=_[_0x777d('0x43')]({},_0x5ad706,_0x68efbb[_0x777d('0x45')]);return _0x4b3e11['getSubjects'](_0x5ad706);}})[_0x777d('0x18')](function(_0xf14fc3){if(_0xf14fc3){_0x53a514=_0xf14fc3[_0x777d('0x3b')];if(!_0x68efbb[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x5ad706[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x68efbb[_0x777d('0x35')][_0x777d('0x3e')]);_0x5ad706[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x68efbb['query'][_0x777d('0x27')]);}return _0x4b3e11['getSubjects'](_0x5ad706);}})[_0x777d('0x18')](function(_0x39bccc){if(_0x39bccc){return _0x39bccc?{'count':_0x53a514,'rows':_0x39bccc}:null;}})['then'](respondWithResult(_0x23fec3,null))[_0x777d('0x21')](handleError(_0x23fec3,null));};exports[_0x777d('0x56')]=function(_0x22ca15,_0x1efb12,_0x13adfd){var _0x5dad29={};var _0x1dab92={};var _0x59a658;var _0xc919d1;return db['DeskConfiguration'][_0x777d('0x53')]({'where':{'id':_0x22ca15['params']['id']}})['then'](handleEntityNotFound(_0x1efb12,null))[_0x777d('0x18')](function(_0x1476bd){if(_0x1476bd){_0x59a658=_0x1476bd;_0x1dab92[_0x777d('0x34')]=_[_0x777d('0x36')](db[_0x777d('0x54')][_0x777d('0x4d')]);_0x1dab92[_0x777d('0x35')]=_[_0x777d('0x36')](_0x22ca15[_0x777d('0x35')]);_0x1dab92[_0x777d('0x37')]=_[_0x777d('0x38')](_0x1dab92[_0x777d('0x34')],_0x1dab92[_0x777d('0x35')]);_0x5dad29[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x1dab92[_0x777d('0x34')],qs[_0x777d('0x39')](_0x22ca15[_0x777d('0x35')][_0x777d('0x39')]));_0x5dad29[_0x777d('0x3a')]=_0x5dad29[_0x777d('0x3a')][_0x777d('0x3b')]?_0x5dad29[_0x777d('0x3a')]:_0x1dab92['model'];_0x5dad29[_0x777d('0x3f')]=qs[_0x777d('0x40')](_0x22ca15[_0x777d('0x35')]['sort']);_0x5dad29[_0x777d('0x46')]=qs[_0x777d('0x37')](_[_0x777d('0x41')](_0x22ca15[_0x777d('0x35')],_0x1dab92['filters']));if(_0x22ca15[_0x777d('0x35')][_0x777d('0x42')]){_0x5dad29[_0x777d('0x46')]=_[_0x777d('0x43')](_0x5dad29[_0x777d('0x46')],{'$or':_[_0x777d('0x2f')](_0x5dad29[_0x777d('0x3a')],function(_0x277236){var _0x492e7a={};_0x492e7a[_0x277236]={'$like':'%'+_0x22ca15[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x492e7a;})});}_0x5dad29=_[_0x777d('0x43')]({},_0x5dad29,_0x22ca15[_0x777d('0x45')]);return _0x59a658['getDescriptions'](_0x5dad29);}})[_0x777d('0x18')](function(_0x31298c){if(_0x31298c){_0xc919d1=_0x31298c[_0x777d('0x3b')];if(!_0x22ca15[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x5dad29[_0x777d('0x3e')]=qs[_0x777d('0x3e')](_0x22ca15[_0x777d('0x35')]['limit']);_0x5dad29[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x22ca15[_0x777d('0x35')][_0x777d('0x27')]);}return _0x59a658[_0x777d('0x56')](_0x5dad29);}})['then'](function(_0x500d79){if(_0x500d79){return _0x500d79?{'count':_0xc919d1,'rows':_0x500d79}:null;}})[_0x777d('0x18')](respondWithResult(_0x1efb12,null))['catch'](handleError(_0x1efb12,null));};exports['getTags']=function(_0x10ef6c,_0xe6d9bb,_0x166f21){var _0x30d6b1={};var _0x49c9f9={};var _0x91eea6;var _0x52ebd3;return db[_0x777d('0x30')]['findOne']({'where':{'id':_0x10ef6c[_0x777d('0x4c')]['id']}})[_0x777d('0x18')](handleEntityNotFound(_0xe6d9bb,null))[_0x777d('0x18')](function(_0x5e2373){if(_0x5e2373){_0x91eea6=_0x5e2373;_0x49c9f9[_0x777d('0x34')]=_[_0x777d('0x36')](db[_0x777d('0x57')][_0x777d('0x4d')]);_0x49c9f9[_0x777d('0x35')]=_['keys'](_0x10ef6c[_0x777d('0x35')]);_0x49c9f9['filters']=_[_0x777d('0x38')](_0x49c9f9[_0x777d('0x34')],_0x49c9f9[_0x777d('0x35')]);_0x30d6b1[_0x777d('0x3a')]=_[_0x777d('0x38')](_0x49c9f9[_0x777d('0x34')],qs[_0x777d('0x39')](_0x10ef6c['query']['fields']));_0x30d6b1[_0x777d('0x3a')]=_0x30d6b1['attributes']['length']?_0x30d6b1['attributes']:_0x49c9f9[_0x777d('0x34')];_0x30d6b1['order']=qs[_0x777d('0x40')](_0x10ef6c[_0x777d('0x35')]['sort']);_0x30d6b1[_0x777d('0x46')]=qs[_0x777d('0x37')](_[_0x777d('0x41')](_0x10ef6c[_0x777d('0x35')],_0x49c9f9['filters']));if(_0x10ef6c[_0x777d('0x35')][_0x777d('0x42')]){_0x30d6b1['where']=_['merge'](_0x30d6b1['where'],{'$or':_[_0x777d('0x2f')](_0x30d6b1[_0x777d('0x3a')],function(_0xfd34df){var _0x2bdfcc={};_0x2bdfcc[_0xfd34df]={'$like':'%'+_0x10ef6c[_0x777d('0x35')][_0x777d('0x42')]+'%'};return _0x2bdfcc;})});}_0x30d6b1=_['merge']({},_0x30d6b1,_0x10ef6c['options']);return _0x91eea6[_0x777d('0x58')](_0x30d6b1);}})[_0x777d('0x18')](function(_0x1019f9){if(_0x1019f9){_0x52ebd3=_0x1019f9[_0x777d('0x3b')];if(!_0x10ef6c[_0x777d('0x35')][_0x777d('0x3c')](_0x777d('0x3d'))){_0x30d6b1[_0x777d('0x3e')]=qs['limit'](_0x10ef6c[_0x777d('0x35')][_0x777d('0x3e')]);_0x30d6b1[_0x777d('0x27')]=qs[_0x777d('0x27')](_0x10ef6c[_0x777d('0x35')][_0x777d('0x27')]);}return _0x91eea6[_0x777d('0x58')](_0x30d6b1);}})[_0x777d('0x18')](function(_0xb9ee98){if(_0xb9ee98){return _0xb9ee98?{'count':_0x52ebd3,'rows':_0xb9ee98}:null;}})[_0x777d('0x18')](respondWithResult(_0xe6d9bb,null))[_0x777d('0x21')](handleError(_0xe6d9bb,null));};exports[_0x777d('0x59')]=function(_0x1c7dc3,_0x3584b8,_0x2262ca){if(_0x1c7dc3[_0x777d('0x50')]['id']){delete _0x1c7dc3[_0x777d('0x50')]['id'];}return db[_0x777d('0x30')][_0x777d('0x53')]({'where':{'id':_0x1c7dc3['params']['id']}})['then'](handleEntityNotFound(_0x3584b8,null))[_0x777d('0x18')](function(_0x253c1e){if(_0x253c1e){return _0x253c1e[_0x777d('0x59')](_0x1c7dc3['body'][_0x777d('0x5a')]||[]);}return null;})[_0x777d('0x18')](respondWithResult(_0x3584b8,null))['catch'](handleError(_0x3584b8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index bd6bb64..48ec9c8 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 _0xf54b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x566881,_0x4a2806){var _0x3b9b23=function(_0x53f7d3){while(--_0x53f7d3){_0x566881['push'](_0x566881['shift']());}};_0x3b9b23(++_0x4a2806);}(_0xf54b,0x69));var _0xbf54=function(_0x4072d0,_0x2c84bd){_0x4072d0=_0x4072d0-0x0;var _0x2fc971=_0xf54b[_0x4072d0];return _0x2fc971;};'use strict';var _=require(_0xbf54('0x0'));var util=require(_0xbf54('0x1'));var logger=require(_0xbf54('0x2'))(_0xbf54('0x3'));var moment=require(_0xbf54('0x4'));var BPromise=require(_0xbf54('0x5'));var rp=require(_0xbf54('0x6'));var fs=require('fs');var path=require(_0xbf54('0x7'));var rimraf=require(_0xbf54('0x8'));var config=require(_0xbf54('0x9'));var attributes=require(_0xbf54('0xa'));module[_0xbf54('0xb')]=function(_0x2ec5d2,_0x120176){return _0x2ec5d2[_0xbf54('0xc')](_0xbf54('0xd'),attributes,{'tableName':_0xbf54('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d24=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x1a1afe,_0x991cf5){var _0x34a9af=function(_0xd9d40e){while(--_0xd9d40e){_0x1a1afe['push'](_0x1a1afe['shift']());}};_0x34a9af(++_0x991cf5);}(_0x7d24,0x17a));var _0x47d2=function(_0x56d845,_0x167122){_0x56d845=_0x56d845-0x0;var _0x194ee3=_0x7d24[_0x56d845];return _0x194ee3;};'use strict';var _=require(_0x47d2('0x0'));var util=require(_0x47d2('0x1'));var logger=require(_0x47d2('0x2'))(_0x47d2('0x3'));var moment=require(_0x47d2('0x4'));var BPromise=require(_0x47d2('0x5'));var rp=require(_0x47d2('0x6'));var fs=require('fs');var path=require(_0x47d2('0x7'));var rimraf=require(_0x47d2('0x8'));var config=require(_0x47d2('0x9'));var attributes=require(_0x47d2('0xa'));module[_0x47d2('0xb')]=function(_0x1a4ca5,_0x79400f){return _0x1a4ca5[_0x47d2('0xc')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 50ffff4..239e6b9 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 _0x30fe=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x30fe,0x149));var _0xe30f=function(_0x34c36e,_0x115f1e){_0x34c36e=_0x34c36e-0x0;var _0x4dc416=_0x30fe[_0x34c36e];return _0x4dc416;};'use strict';var _=require('lodash');var util=require(_0xe30f('0x0'));var moment=require('moment');var BPromise=require(_0xe30f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe30f('0x2'));var db=require(_0xe30f('0x3'))['db'];var utils=require(_0xe30f('0x4'));var logger=require(_0xe30f('0x5'))(_0xe30f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe30f('0x7'));var client=jayson[_0xe30f('0x8')][_0xe30f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x346a51,_0x442a51,_0x3af889){return new BPromise(function(_0x2f94d2,_0x2243f2){return client[_0xe30f('0xa')](_0x346a51,_0x3af889)[_0xe30f('0xb')](function(_0x5ab6b8){logger[_0xe30f('0xc')](_0xe30f('0xd'),_0x442a51,'request\x20sent');logger[_0xe30f('0xe')](_0xe30f('0xf'),_0x442a51,_0xe30f('0x10'),JSON[_0xe30f('0x11')](_0x5ab6b8));if(_0x5ab6b8['error']){if(_0x5ab6b8[_0xe30f('0x12')][_0xe30f('0x13')]===0x1f4){logger[_0xe30f('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x442a51,_0x5ab6b8[_0xe30f('0x12')][_0xe30f('0x14')]);return _0x2243f2(_0x5ab6b8[_0xe30f('0x12')]['message']);}logger[_0xe30f('0x12')](_0xe30f('0xd'),_0x442a51,_0x5ab6b8[_0xe30f('0x12')][_0xe30f('0x14')]);return _0x2f94d2(_0x5ab6b8['error']['message']);}else{logger['info'](_0xe30f('0xd'),_0x442a51,_0xe30f('0x10'));_0x2f94d2(_0x5ab6b8[_0xe30f('0x15')][_0xe30f('0x14')]);}})['catch'](function(_0x1f19bf){logger['error'](_0xe30f('0xd'),_0x442a51,_0x1f19bf);_0x2243f2(_0x1f19bf);});});} \ No newline at end of file +var _0x7dc2=['jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x7a9452,_0xba8a16){var _0x3d5c38=function(_0x520303){while(--_0x520303){_0x7a9452['push'](_0x7a9452['shift']());}};_0x3d5c38(++_0xba8a16);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27dc('0x0'));var BPromise=require(_0x27dc('0x1'));var rs=require(_0x27dc('0x2'));var fs=require('fs');var Redis=require(_0x27dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27dc('0x4'));var logger=require(_0x27dc('0x5'))('rpc');var config=require(_0x27dc('0x6'));var jayson=require(_0x27dc('0x7'));var client=jayson['client'][_0x27dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e10,_0x95bbb6,_0x3b3eee){return new BPromise(function(_0x5181ab,_0x45aa07){return client[_0x27dc('0x9')](_0x4d2e10,_0x3b3eee)[_0x27dc('0xa')](function(_0x242997){logger['info'](_0x27dc('0xb'),_0x95bbb6,'request\x20sent');logger[_0x27dc('0xc')](_0x27dc('0xd'),_0x95bbb6,_0x27dc('0xe'),JSON['stringify'](_0x242997));if(_0x242997['error']){if(_0x242997[_0x27dc('0xf')][_0x27dc('0x10')]===0x1f4){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x242997['error'][_0x27dc('0x11')]);return _0x45aa07(_0x242997['error'][_0x27dc('0x11')]);}logger['error'](_0x27dc('0xb'),_0x95bbb6,_0x242997[_0x27dc('0xf')][_0x27dc('0x11')]);return _0x5181ab(_0x242997[_0x27dc('0xf')]['message']);}else{logger[_0x27dc('0x12')](_0x27dc('0xb'),_0x95bbb6,_0x27dc('0xe'));_0x5181ab(_0x242997[_0x27dc('0x13')][_0x27dc('0x11')]);}})['catch'](function(_0x3ff8f8){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x3ff8f8);_0x45aa07(_0x3ff8f8);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 139f83e..937ecab 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 _0xd020=['delete','destroy','exports','multer','util','Router','../../components/auth/service','./intDeskField.controller','isAuthenticated','get','/:id','post','put','update'];(function(_0x149ad4,_0x5d1f11){var _0x303371=function(_0x3bd7bd){while(--_0x3bd7bd){_0x149ad4['push'](_0x149ad4['shift']());}};_0x303371(++_0x5d1f11);}(_0xd020,0x1b5));var _0x0d02=function(_0x3e83f1,_0x1b09ae){_0x3e83f1=_0x3e83f1-0x0;var _0x28cd96=_0xd020[_0x3e83f1];return _0x28cd96;};'use strict';var multer=require(_0x0d02('0x0'));var util=require(_0x0d02('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d02('0x2')]();var auth=require(_0x0d02('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0d02('0x4'));router['get']('/',auth[_0x0d02('0x5')](),controller['index']);router[_0x0d02('0x6')](_0x0d02('0x7'),auth[_0x0d02('0x5')](),controller['show']);router[_0x0d02('0x8')]('/',auth[_0x0d02('0x5')](),controller['create']);router[_0x0d02('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0d02('0xa')]);router[_0x0d02('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x0d02('0xc')]);module[_0x0d02('0xd')]=router; \ No newline at end of file +var _0xd096=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x55ba72,_0x5ae964){var _0x51c228=function(_0x8295f){while(--_0x8295f){_0x55ba72['push'](_0x55ba72['shift']());}};_0x51c228(++_0x5ae964);}(_0xd096,0x84));var _0x6d09=function(_0x190906,_0x221642){_0x190906=_0x190906-0x0;var _0x338512=_0xd096[_0x190906];return _0x338512;};'use strict';var multer=require(_0x6d09('0x0'));var util=require(_0x6d09('0x1'));var path=require(_0x6d09('0x2'));var timeout=require(_0x6d09('0x3'));var express=require('express');var router=express[_0x6d09('0x4')]();var auth=require(_0x6d09('0x5'));var interaction=require(_0x6d09('0x6'));var config=require(_0x6d09('0x7'));var controller=require(_0x6d09('0x8'));router[_0x6d09('0x9')]('/',auth[_0x6d09('0xa')](),controller['index']);router[_0x6d09('0x9')](_0x6d09('0xb'),auth[_0x6d09('0xa')](),controller['show']);router[_0x6d09('0xc')]('/',auth[_0x6d09('0xa')](),controller[_0x6d09('0xd')]);router[_0x6d09('0xe')](_0x6d09('0xb'),auth['isAuthenticated'](),controller[_0x6d09('0xf')]);router[_0x6d09('0x10')]('/:id',auth[_0x6d09('0xa')](),controller[_0x6d09('0x11')]);module[_0x6d09('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index bee1967..62a6fcc 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 _0xe681=['customVariable','string','STRING','exports','ENUM','variable'];(function(_0x41fbe2,_0xfba88){var _0x3c79da=function(_0x4346e6){while(--_0x4346e6){_0x41fbe2['push'](_0x41fbe2['shift']());}};_0x3c79da(++_0xfba88);}(_0xe681,0x177));var _0x1e68=function(_0x1b33d1,_0x2965e2){_0x1b33d1=_0x1b33d1-0x0;var _0x368c8f=_0xe681[_0x1b33d1];return _0x368c8f;};'use strict';var Sequelize=require('sequelize');module[_0x1e68('0x0')]={'type':{'type':Sequelize[_0x1e68('0x1')]('string',_0x1e68('0x2'),_0x1e68('0x3'),'keyValue'),'defaultValue':_0x1e68('0x4')},'content':{'type':Sequelize[_0x1e68('0x5')]},'key':{'type':Sequelize[_0x1e68('0x5')]},'keyType':{'type':Sequelize[_0x1e68('0x1')]('string',_0x1e68('0x2'),_0x1e68('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1e68('0x5')]},'nameField':{'type':Sequelize[_0x1e68('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcc23=['string','STRING','customVariable','BOOLEAN','ENUM','variable','keyValue'];(function(_0x34afc6,_0x45ae89){var _0x520925=function(_0x2d862f){while(--_0x2d862f){_0x34afc6['push'](_0x34afc6['shift']());}};_0x520925(++_0x45ae89);}(_0xcc23,0x10e));var _0x3cc2=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xcc23[_0x45346d];return _0x5ce7ca;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3cc2('0x0')]('string',_0x3cc2('0x1'),'customVariable',_0x3cc2('0x2')),'defaultValue':_0x3cc2('0x3')},'content':{'type':Sequelize[_0x3cc2('0x4')]},'key':{'type':Sequelize[_0x3cc2('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3cc2('0x3'),_0x3cc2('0x1'),_0x3cc2('0x5'))},'keyContent':{'type':Sequelize[_0x3cc2('0x4')]},'idField':{'type':Sequelize[_0x3cc2('0x4')]},'nameField':{'type':Sequelize[_0x3cc2('0x4')]},'customField':{'type':Sequelize[_0x3cc2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8c960d8..7458e01 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 _0x4d68=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../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','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','DeskField','findAll','show','includeAll','options','catch','create','body','find','params'];(function(_0x686d1a,_0x2b0b9e){var _0xe79a5c=function(_0x58785d){while(--_0x58785d){_0x686d1a['push'](_0x686d1a['shift']());}};_0xe79a5c(++_0x2b0b9e);}(_0x4d68,0xd5));var _0x84d6=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x4d68[_0x4cc03b];return _0xf0358c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x84d6('0x0'));var rimraf=require(_0x84d6('0x1'));var zipdir=require(_0x84d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84d6('0x3'));var moment=require(_0x84d6('0x4'));var BPromise=require(_0x84d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84d6('0x6'));var sox=require(_0x84d6('0x7'));var csv=require('to-csv');var ejs=require(_0x84d6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x84d6('0x9'));var crypto=require(_0x84d6('0xa'));var jsforce=require(_0x84d6('0xb'));var deskjs=require(_0x84d6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x84d6('0xd'));var Redis=require(_0x84d6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x84d6('0xf'));var as=require(_0x84d6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84d6('0x11'))(_0x84d6('0x12'));var utils=require(_0x84d6('0x13'));var config=require(_0x84d6('0x14'));var licenseUtil=require(_0x84d6('0x15'));var db=require(_0x84d6('0x16'))['db'];function respondWithStatusCode(_0x4c1929,_0x8d867e){_0x8d867e=_0x8d867e||0xcc;return function(_0x2c4700){if(_0x2c4700){return _0x4c1929['sendStatus'](_0x8d867e);}return _0x4c1929[_0x84d6('0x17')](_0x8d867e)[_0x84d6('0x18')]();};}function respondWithResult(_0x16b115,_0x3e6d42){_0x3e6d42=_0x3e6d42||0xc8;return function(_0x332b44){if(_0x332b44){return _0x16b115[_0x84d6('0x17')](_0x3e6d42)[_0x84d6('0x19')](_0x332b44);}};}function respondWithFilteredResult(_0x388cb8,_0xc7b750){return function(_0x3f4101){if(_0x3f4101){var _0xff0f10=_0x3f4101[_0x84d6('0x1a')],_0x4abc0a=_0xc7b750[_0x84d6('0x1b')],_0xf9163c=_0xc7b750[_0x84d6('0x1b')]+_0xc7b750[_0x84d6('0x1c')],_0x3e6fe7;if(_0xf9163c>=_0xff0f10){_0xf9163c=_0xff0f10;_0x3e6fe7=0xc8;}else{_0x3e6fe7=0xce;}_0x388cb8[_0x84d6('0x17')](_0x3e6fe7);return _0x388cb8[_0x84d6('0x1d')](_0x84d6('0x1e'),_0x4abc0a+'-'+_0xf9163c+'/'+_0xff0f10)[_0x84d6('0x19')](_0x3f4101);}return null;};}function patchUpdates(_0x38c05b){return function(_0x4ad4b4){try{jsonpatch[_0x84d6('0x1f')](_0x4ad4b4,_0x38c05b,!![]);}catch(_0x47cc3f){return BPromise[_0x84d6('0x20')](_0x47cc3f);}return _0x4ad4b4[_0x84d6('0x21')]();};}function saveUpdates(_0x2d7061,_0x3e19c6){return function(_0x3fa1ae){if(_0x3fa1ae){return _0x3fa1ae[_0x84d6('0x22')](_0x2d7061)['then'](function(_0x4be303){return _0x4be303;});}return null;};}function removeEntity(_0xb8068c,_0x1d6f62){return function(_0x2c32a8){if(_0x2c32a8){return _0x2c32a8['destroy']()[_0x84d6('0x23')](function(){_0xb8068c['status'](0xcc)[_0x84d6('0x18')]();});}};}function handleEntityNotFound(_0x238cf6,_0x58cff6){return function(_0x21a102){if(!_0x21a102){_0x238cf6[_0x84d6('0x24')](0x194);}return _0x21a102;};}function handleError(_0x1a8307,_0x4fb647){_0x4fb647=_0x4fb647||0x1f4;return function(_0x8436c6){logger['error'](_0x8436c6[_0x84d6('0x25')]);if(_0x8436c6[_0x84d6('0x26')]){delete _0x8436c6[_0x84d6('0x26')];}_0x1a8307[_0x84d6('0x17')](_0x4fb647)[_0x84d6('0x27')](_0x8436c6);};}exports[_0x84d6('0x28')]=function(_0x142848,_0x37b5da){var _0x466cba={},_0x437ce5={},_0xd65b97={'count':0x0,'rows':[]};var _0x393fc9=_[_0x84d6('0x29')](db['DeskField'][_0x84d6('0x2a')],function(_0x16a17f){return{'name':_0x16a17f['fieldName'],'type':_0x16a17f[_0x84d6('0x2b')]['key']};});_0x437ce5[_0x84d6('0x2c')]=_[_0x84d6('0x29')](_0x393fc9,_0x84d6('0x26'));_0x437ce5[_0x84d6('0x2d')]=_[_0x84d6('0x2e')](_0x142848[_0x84d6('0x2d')]);_0x437ce5[_0x84d6('0x2f')]=_[_0x84d6('0x30')](_0x437ce5[_0x84d6('0x2c')],_0x437ce5['query']);_0x466cba['attributes']=_[_0x84d6('0x30')](_0x437ce5[_0x84d6('0x2c')],qs[_0x84d6('0x31')](_0x142848[_0x84d6('0x2d')][_0x84d6('0x31')]));_0x466cba[_0x84d6('0x32')]=_0x466cba[_0x84d6('0x32')][_0x84d6('0x33')]?_0x466cba[_0x84d6('0x32')]:_0x437ce5['model'];if(!_0x142848[_0x84d6('0x2d')][_0x84d6('0x34')](_0x84d6('0x35'))){_0x466cba['limit']=qs['limit'](_0x142848[_0x84d6('0x2d')][_0x84d6('0x1c')]);_0x466cba['offset']=qs[_0x84d6('0x1b')](_0x142848[_0x84d6('0x2d')][_0x84d6('0x1b')]);}_0x466cba[_0x84d6('0x36')]=qs[_0x84d6('0x37')](_0x142848[_0x84d6('0x2d')][_0x84d6('0x37')]);_0x466cba[_0x84d6('0x38')]=qs['filters'](_[_0x84d6('0x39')](_0x142848[_0x84d6('0x2d')],_0x437ce5['filters']),_0x393fc9);if(_0x142848[_0x84d6('0x2d')][_0x84d6('0x3a')]){_0x466cba[_0x84d6('0x38')]=_[_0x84d6('0x3b')](_0x466cba[_0x84d6('0x38')],{'$or':_[_0x84d6('0x29')](_0x393fc9,function(_0x1322da){if(_0x1322da[_0x84d6('0x2b')]!=='VIRTUAL'){var _0x20e0b0={};_0x20e0b0[_0x1322da[_0x84d6('0x26')]]={'$like':'%'+_0x142848[_0x84d6('0x2d')][_0x84d6('0x3a')]+'%'};return _0x20e0b0;}})});}_0x466cba=_[_0x84d6('0x3b')]({},_0x466cba,_0x142848['options']);var _0x1f874e={'where':_0x466cba[_0x84d6('0x38')]};return db['DeskField'][_0x84d6('0x1a')](_0x1f874e)['then'](function(_0x22de56){_0xd65b97['count']=_0x22de56;if(_0x142848[_0x84d6('0x2d')]['includeAll']){_0x466cba[_0x84d6('0x3c')]=[{'all':!![]}];}return db[_0x84d6('0x3d')][_0x84d6('0x3e')](_0x466cba);})[_0x84d6('0x23')](function(_0x12d3d9){_0xd65b97['rows']=_0x12d3d9;return _0xd65b97;})['then'](respondWithFilteredResult(_0x37b5da,_0x466cba))['catch'](handleError(_0x37b5da,null));};exports[_0x84d6('0x3f')]=function(_0xf4b628,_0x1c2562){var _0x5010ff={'raw':!![],'where':{'id':_0xf4b628['params']['id']}},_0x5ccacb={};_0x5ccacb['model']=_[_0x84d6('0x2e')](db['DeskField'][_0x84d6('0x2a')]);_0x5ccacb['query']=_[_0x84d6('0x2e')](_0xf4b628[_0x84d6('0x2d')]);_0x5ccacb['filters']=_['intersection'](_0x5ccacb['model'],_0x5ccacb['query']);_0x5010ff[_0x84d6('0x32')]=_[_0x84d6('0x30')](_0x5ccacb[_0x84d6('0x2c')],qs['fields'](_0xf4b628[_0x84d6('0x2d')][_0x84d6('0x31')]));_0x5010ff[_0x84d6('0x32')]=_0x5010ff[_0x84d6('0x32')][_0x84d6('0x33')]?_0x5010ff['attributes']:_0x5ccacb[_0x84d6('0x2c')];if(_0xf4b628[_0x84d6('0x2d')][_0x84d6('0x40')]){_0x5010ff[_0x84d6('0x3c')]=[{'all':!![]}];}_0x5010ff=_[_0x84d6('0x3b')]({},_0x5010ff,_0xf4b628[_0x84d6('0x41')]);return db[_0x84d6('0x3d')]['find'](_0x5010ff)['then'](handleEntityNotFound(_0x1c2562,null))[_0x84d6('0x23')](respondWithResult(_0x1c2562,null))[_0x84d6('0x42')](handleError(_0x1c2562,null));};exports[_0x84d6('0x43')]=function(_0x3b551e,_0xe2b062){return db['DeskField']['create'](_0x3b551e['body'],{})['then'](respondWithResult(_0xe2b062,0xc9))[_0x84d6('0x42')](handleError(_0xe2b062,null));};exports[_0x84d6('0x22')]=function(_0xdc83a5,_0x49ab20){if(_0xdc83a5['body']['id']){delete _0xdc83a5[_0x84d6('0x44')]['id'];}return db[_0x84d6('0x3d')][_0x84d6('0x45')]({'where':{'id':_0xdc83a5[_0x84d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x49ab20,null))[_0x84d6('0x23')](saveUpdates(_0xdc83a5['body'],null))[_0x84d6('0x23')](respondWithResult(_0x49ab20,null))[_0x84d6('0x42')](handleError(_0x49ab20,null));};exports['destroy']=function(_0x5c573b,_0x57c7d8){return db[_0x84d6('0x3d')][_0x84d6('0x45')]({'where':{'id':_0x5c573b[_0x84d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x57c7d8,null))[_0x84d6('0x23')](removeEntity(_0x57c7d8,null))[_0x84d6('0x42')](handleError(_0x57c7d8,null));}; \ No newline at end of file +var _0x09f5=['set','Content-Range','apply','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','map','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','update','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x56ee7e,_0x5264e7){var _0x41d6e6=function(_0x542daf){while(--_0x542daf){_0x56ee7e['push'](_0x56ee7e['shift']());}};_0x41d6e6(++_0x5264e7);}(_0x09f5,0x1ee));var _0x509f=function(_0x100528,_0x352759){_0x100528=_0x100528-0x0;var _0x2fb6a0=_0x09f5[_0x100528];return _0x2fb6a0;};'use strict';var pdf=require(_0x509f('0x0'));var emlformat=require(_0x509f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x509f('0x2'));var jsonpatch=require(_0x509f('0x3'));var rp=require(_0x509f('0x4'));var moment=require(_0x509f('0x5'));var BPromise=require(_0x509f('0x6'));var Mustache=require(_0x509f('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x509f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x509f('0x9'));var squel=require('squel');var crypto=require(_0x509f('0xa'));var jsforce=require(_0x509f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x509f('0x8'));var querystring=require(_0x509f('0xc'));var Papa=require(_0x509f('0xd'));var Redis=require(_0x509f('0xe'));var authService=require(_0x509f('0xf'));var qs=require(_0x509f('0x10'));var as=require(_0x509f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x509f('0x12'))(_0x509f('0x13'));var utils=require(_0x509f('0x14'));var config=require(_0x509f('0x15'));var licenseUtil=require(_0x509f('0x16'));var db=require(_0x509f('0x17'))['db'];function respondWithStatusCode(_0x5022a5,_0xebb969){_0xebb969=_0xebb969||0xcc;return function(_0x4feb11){if(_0x4feb11){return _0x5022a5[_0x509f('0x18')](_0xebb969);}return _0x5022a5[_0x509f('0x19')](_0xebb969)[_0x509f('0x1a')]();};}function respondWithResult(_0x21a7b4,_0x6980fe){_0x6980fe=_0x6980fe||0xc8;return function(_0x4fa0a6){if(_0x4fa0a6){return _0x21a7b4[_0x509f('0x19')](_0x6980fe)[_0x509f('0x1b')](_0x4fa0a6);}};}function respondWithFilteredResult(_0xbb9639,_0x47a498){return function(_0xeecddb){if(_0xeecddb){var _0x40253f=_0xeecddb[_0x509f('0x1c')],_0x2f33c4=_0x47a498[_0x509f('0x1d')],_0x1dc339=_0x47a498[_0x509f('0x1d')]+_0x47a498[_0x509f('0x1e')],_0x5adc2c;if(_0x1dc339>=_0x40253f){_0x1dc339=_0x40253f;_0x5adc2c=0xc8;}else{_0x5adc2c=0xce;}_0xbb9639[_0x509f('0x19')](_0x5adc2c);return _0xbb9639[_0x509f('0x1f')](_0x509f('0x20'),_0x2f33c4+'-'+_0x1dc339+'/'+_0x40253f)['json'](_0xeecddb);}return null;};}function patchUpdates(_0xca4ceb){return function(_0x2ea22d){try{jsonpatch[_0x509f('0x21')](_0x2ea22d,_0xca4ceb,!![]);}catch(_0x469ef6){return BPromise['reject'](_0x469ef6);}return _0x2ea22d['save']();};}function saveUpdates(_0x1928cc,_0x39b501){return function(_0x8f2332){if(_0x8f2332){return _0x8f2332['update'](_0x1928cc)[_0x509f('0x22')](function(_0x4eb301){return _0x4eb301;});}return null;};}function removeEntity(_0x4ca6e6,_0x4f78ba){return function(_0xad2e13){if(_0xad2e13){return _0xad2e13[_0x509f('0x23')]()['then'](function(){_0x4ca6e6['status'](0xcc)[_0x509f('0x1a')]();});}};}function handleEntityNotFound(_0x12f83d,_0x3f3a48){return function(_0x48140c){if(!_0x48140c){_0x12f83d[_0x509f('0x18')](0x194);}return _0x48140c;};}function handleError(_0x43ce37,_0x27dd6e){_0x27dd6e=_0x27dd6e||0x1f4;return function(_0x476d3e){logger[_0x509f('0x24')](_0x476d3e[_0x509f('0x25')]);if(_0x476d3e[_0x509f('0x26')]){delete _0x476d3e[_0x509f('0x26')];}_0x43ce37['status'](_0x27dd6e)[_0x509f('0x27')](_0x476d3e);};}exports[_0x509f('0x28')]=function(_0x2c89e4,_0x5deab7){var _0x3039cf={},_0x59a486={},_0x447ec5={'count':0x0,'rows':[]};var _0x97c439=_['map'](db[_0x509f('0x29')][_0x509f('0x2a')],function(_0x401e5d){return{'name':_0x401e5d[_0x509f('0x2b')],'type':_0x401e5d[_0x509f('0x2c')][_0x509f('0x2d')]};});_0x59a486['model']=_[_0x509f('0x2e')](_0x97c439,_0x509f('0x26'));_0x59a486[_0x509f('0x2f')]=_['keys'](_0x2c89e4[_0x509f('0x2f')]);_0x59a486['filters']=_['intersection'](_0x59a486[_0x509f('0x30')],_0x59a486['query']);_0x3039cf[_0x509f('0x31')]=_['intersection'](_0x59a486[_0x509f('0x30')],qs[_0x509f('0x32')](_0x2c89e4[_0x509f('0x2f')][_0x509f('0x32')]));_0x3039cf['attributes']=_0x3039cf[_0x509f('0x31')][_0x509f('0x33')]?_0x3039cf[_0x509f('0x31')]:_0x59a486[_0x509f('0x30')];if(!_0x2c89e4[_0x509f('0x2f')][_0x509f('0x34')](_0x509f('0x35'))){_0x3039cf[_0x509f('0x1e')]=qs[_0x509f('0x1e')](_0x2c89e4['query']['limit']);_0x3039cf[_0x509f('0x1d')]=qs[_0x509f('0x1d')](_0x2c89e4[_0x509f('0x2f')][_0x509f('0x1d')]);}_0x3039cf[_0x509f('0x36')]=qs[_0x509f('0x37')](_0x2c89e4[_0x509f('0x2f')][_0x509f('0x37')]);_0x3039cf[_0x509f('0x38')]=qs['filters'](_[_0x509f('0x39')](_0x2c89e4[_0x509f('0x2f')],_0x59a486[_0x509f('0x3a')]),_0x97c439);if(_0x2c89e4[_0x509f('0x2f')][_0x509f('0x3b')]){_0x3039cf['where']=_[_0x509f('0x3c')](_0x3039cf[_0x509f('0x38')],{'$or':_[_0x509f('0x2e')](_0x97c439,function(_0x4fe4fd){if(_0x4fe4fd[_0x509f('0x2c')]!==_0x509f('0x3d')){var _0x53a63f={};_0x53a63f[_0x4fe4fd[_0x509f('0x26')]]={'$like':'%'+_0x2c89e4['query'][_0x509f('0x3b')]+'%'};return _0x53a63f;}})});}_0x3039cf=_[_0x509f('0x3c')]({},_0x3039cf,_0x2c89e4[_0x509f('0x3e')]);var _0x2f350f={'where':_0x3039cf[_0x509f('0x38')]};return db[_0x509f('0x29')][_0x509f('0x1c')](_0x2f350f)[_0x509f('0x22')](function(_0x6f6a30){_0x447ec5[_0x509f('0x1c')]=_0x6f6a30;if(_0x2c89e4[_0x509f('0x2f')][_0x509f('0x3f')]){_0x3039cf[_0x509f('0x40')]=[{'all':!![]}];}return db[_0x509f('0x29')][_0x509f('0x41')](_0x3039cf);})['then'](function(_0x2a8d3e){_0x447ec5['rows']=_0x2a8d3e;return _0x447ec5;})['then'](respondWithFilteredResult(_0x5deab7,_0x3039cf))[_0x509f('0x42')](handleError(_0x5deab7,null));};exports[_0x509f('0x43')]=function(_0x190a0a,_0x41f8bd){var _0x15f3c9={'raw':!![],'where':{'id':_0x190a0a[_0x509f('0x44')]['id']}},_0x31fe0a={};_0x31fe0a[_0x509f('0x30')]=_[_0x509f('0x45')](db['DeskField'][_0x509f('0x2a')]);_0x31fe0a[_0x509f('0x2f')]=_[_0x509f('0x45')](_0x190a0a['query']);_0x31fe0a['filters']=_[_0x509f('0x46')](_0x31fe0a[_0x509f('0x30')],_0x31fe0a[_0x509f('0x2f')]);_0x15f3c9[_0x509f('0x31')]=_[_0x509f('0x46')](_0x31fe0a[_0x509f('0x30')],qs[_0x509f('0x32')](_0x190a0a['query'][_0x509f('0x32')]));_0x15f3c9['attributes']=_0x15f3c9['attributes'][_0x509f('0x33')]?_0x15f3c9[_0x509f('0x31')]:_0x31fe0a[_0x509f('0x30')];if(_0x190a0a['query'][_0x509f('0x3f')]){_0x15f3c9[_0x509f('0x40')]=[{'all':!![]}];}_0x15f3c9=_[_0x509f('0x3c')]({},_0x15f3c9,_0x190a0a['options']);return db['DeskField'][_0x509f('0x47')](_0x15f3c9)[_0x509f('0x22')](handleEntityNotFound(_0x41f8bd,null))['then'](respondWithResult(_0x41f8bd,null))[_0x509f('0x42')](handleError(_0x41f8bd,null));};exports[_0x509f('0x48')]=function(_0x23a686,_0x3bc81e){return db[_0x509f('0x29')]['create'](_0x23a686['body'],{})['then'](respondWithResult(_0x3bc81e,0xc9))[_0x509f('0x42')](handleError(_0x3bc81e,null));};exports[_0x509f('0x49')]=function(_0x46ebe6,_0x247a4d){if(_0x46ebe6[_0x509f('0x4a')]['id']){delete _0x46ebe6['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x46ebe6[_0x509f('0x44')]['id']}})['then'](handleEntityNotFound(_0x247a4d,null))['then'](saveUpdates(_0x46ebe6['body'],null))[_0x509f('0x22')](respondWithResult(_0x247a4d,null))[_0x509f('0x42')](handleError(_0x247a4d,null));};exports[_0x509f('0x23')]=function(_0x1d3248,_0x1151ce){return db['DeskField']['find']({'where':{'id':_0x1d3248[_0x509f('0x44')]['id']}})[_0x509f('0x22')](handleEntityNotFound(_0x1151ce,null))[_0x509f('0x22')](removeEntity(_0x1151ce,null))[_0x509f('0x42')](handleError(_0x1151ce,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 79c7c9a..2711178 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 _0xf905=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','idField','util','api','moment','bluebird','path'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xf905,0x14b));var _0x5f90=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xf905[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var util=require(_0x5f90('0x0'));var logger=require('../../config/logger')(_0x5f90('0x1'));var moment=require(_0x5f90('0x2'));var BPromise=require(_0x5f90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f90('0x4'));var rimraf=require(_0x5f90('0x5'));var config=require(_0x5f90('0x6'));var attributes=require(_0x5f90('0x7'));module[_0x5f90('0x8')]=function(_0x1345be,_0x909e63){return _0x1345be[_0x5f90('0x9')]('DeskField',attributes,{'tableName':_0x5f90('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x5f90('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb83c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb83c,0x10e));var _0xcb83=function(_0x8743ed,_0x1fab22){_0x8743ed=_0x8743ed-0x0;var _0x28c95f=_0xb83c[_0x8743ed];return _0x28c95f;};'use strict';var _=require(_0xcb83('0x0'));var util=require(_0xcb83('0x1'));var logger=require(_0xcb83('0x2'))(_0xcb83('0x3'));var moment=require(_0xcb83('0x4'));var BPromise=require(_0xcb83('0x5'));var rp=require(_0xcb83('0x6'));var fs=require('fs');var path=require(_0xcb83('0x7'));var rimraf=require(_0xcb83('0x8'));var config=require(_0xcb83('0x9'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x1019fd,_0x2b0695){return _0x1019fd[_0xcb83('0xa')](_0xcb83('0xb'),attributes,{'tableName':_0xcb83('0xc'),'paranoid':![],'indexes':[{'name':_0xcb83('0xd'),'fields':[_0xcb83('0xe'),_0xcb83('0xf')],'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 f7f18b3..c829475 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 _0x3642=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3262b1,_0x4da836){var _0x11c184=function(_0x543116){while(--_0x543116){_0x3262b1['push'](_0x3262b1['shift']());}};_0x11c184(++_0x4da836);}(_0x3642,0x1a4));var _0x2364=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x3642[_0x5c4585];return _0x21dede;};'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(_0x2364('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2364('0x6'))(_0x2364('0x7'));var config=require('../../config/environment');var jayson=require(_0x2364('0x8'));var client=jayson[_0x2364('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3632de,_0x5068bd,_0x3d258a){return new BPromise(function(_0x55e4d4,_0xad5a38){return client['request'](_0x3632de,_0x3d258a)[_0x2364('0xa')](function(_0x915194){logger['info']('DeskField,\x20%s,\x20%s',_0x5068bd,_0x2364('0xb'));logger[_0x2364('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x5068bd,'request\x20sent',JSON[_0x2364('0xd')](_0x915194));if(_0x915194[_0x2364('0xe')]){if(_0x915194[_0x2364('0xe')][_0x2364('0xf')]===0x1f4){logger[_0x2364('0xe')](_0x2364('0x10'),_0x5068bd,_0x915194[_0x2364('0xe')][_0x2364('0x11')]);return _0xad5a38(_0x915194[_0x2364('0xe')]['message']);}logger[_0x2364('0xe')](_0x2364('0x10'),_0x5068bd,_0x915194['error'][_0x2364('0x11')]);return _0x55e4d4(_0x915194[_0x2364('0xe')]['message']);}else{logger[_0x2364('0x12')]('DeskField,\x20%s,\x20%s',_0x5068bd,_0x2364('0xb'));_0x55e4d4(_0x915194[_0x2364('0x13')][_0x2364('0x11')]);}})[_0x2364('0x14')](function(_0x22e918){logger[_0x2364('0xe')](_0x2364('0x10'),_0x5068bd,_0x22e918);_0xad5a38(_0x22e918);});});} \ No newline at end of file +var _0xe320=['http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4da137,_0x42e65a){var _0x236468=function(_0x4320ea){while(--_0x4320ea){_0x4da137['push'](_0x4da137['shift']());}};_0x236468(++_0x42e65a);}(_0xe320,0x7a));var _0x0e32=function(_0x360189,_0x40a134){_0x360189=_0x360189-0x0;var _0x5c148b=_0xe320[_0x360189];return _0x5c148b;};'use strict';var _=require(_0x0e32('0x0'));var util=require(_0x0e32('0x1'));var moment=require(_0x0e32('0x2'));var BPromise=require(_0x0e32('0x3'));var rs=require(_0x0e32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e32('0x5'));var logger=require(_0x0e32('0x6'))(_0x0e32('0x7'));var config=require(_0x0e32('0x8'));var jayson=require(_0x0e32('0x9'));var client=jayson['client'][_0x0e32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffd464,_0x160ed8,_0x17ea58){return new BPromise(function(_0x3671bb,_0x111239){return client[_0x0e32('0xb')](_0xffd464,_0x17ea58)[_0x0e32('0xc')](function(_0x5d692a){logger[_0x0e32('0xd')](_0x0e32('0xe'),_0x160ed8,_0x0e32('0xf'));logger['debug'](_0x0e32('0x10'),_0x160ed8,'request\x20sent',JSON[_0x0e32('0x11')](_0x5d692a));if(_0x5d692a[_0x0e32('0x12')]){if(_0x5d692a[_0x0e32('0x12')][_0x0e32('0x13')]===0x1f4){logger[_0x0e32('0x12')](_0x0e32('0xe'),_0x160ed8,_0x5d692a['error'][_0x0e32('0x14')]);return _0x111239(_0x5d692a['error'][_0x0e32('0x14')]);}logger['error'](_0x0e32('0xe'),_0x160ed8,_0x5d692a['error'][_0x0e32('0x14')]);return _0x3671bb(_0x5d692a['error']['message']);}else{logger[_0x0e32('0xd')](_0x0e32('0xe'),_0x160ed8,'request\x20sent');_0x3671bb(_0x5d692a['result']['message']);}})[_0x0e32('0x15')](function(_0x29396c){logger[_0x0e32('0x12')](_0x0e32('0xe'),_0x160ed8,_0x29396c);_0x111239(_0x29396c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 64ae556..2d89c7b 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 _0x66fa=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','addConfiguration','update','multer'];(function(_0xb9d495,_0x3b0fb9){var _0x2cb8c7=function(_0x5493ca){while(--_0x5493ca){_0xb9d495['push'](_0xb9d495['shift']());}};_0x2cb8c7(++_0x3b0fb9);}(_0x66fa,0x117));var _0xa66f=function(_0x2f1f20,_0x1f0b1e){_0x2f1f20=_0x2f1f20-0x0;var _0x18e131=_0x66fa[_0x2f1f20];return _0x18e131;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa66f('0x9')]);router[_0xa66f('0xa')](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0xd')]);router['get'](_0xa66f('0xe'),auth['isAuthenticated'](),controller[_0xa66f('0xf')]);router['get'](_0xa66f('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xa66f('0xc')](),controller[_0xa66f('0x11')]);router['post'](_0xa66f('0xe'),auth['isAuthenticated'](),controller[_0xa66f('0x12')]);router['put'](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0x13')]);router['delete']('/:id',auth[_0xa66f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdb28=['getConfigurations','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','show','get','/:id/configurations'];(function(_0x5beea3,_0x3db119){var _0x330983=function(_0x3e4ea4){while(--_0x3e4ea4){_0x5beea3['push'](_0x5beea3['shift']());}};_0x330983(++_0x3db119);}(_0xdb28,0x106));var _0x8db2=function(_0x2f3022,_0x2c471e){_0x2f3022=_0x2f3022-0x0;var _0x44cc9f=_0xdb28[_0x2f3022];return _0x44cc9f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var auth=require(_0x8db2('0x5'));var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router['get']('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xa')]);router['get']('/:id',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')](_0x8db2('0xd'),auth[_0x8db2('0x9')](),controller[_0x8db2('0xe')]);router[_0x8db2('0xc')]('/:id/fields',auth[_0x8db2('0x9')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/',auth['isAuthenticated'](),controller[_0x8db2('0x11')]);router[_0x8db2('0x10')]('/:id/configurations',auth[_0x8db2('0x9')](),controller[_0x8db2('0x12')]);router[_0x8db2('0x13')](_0x8db2('0x14'),auth[_0x8db2('0x9')](),controller['update']);router['delete'](_0x8db2('0x14'),auth[_0x8db2('0x9')](),controller[_0x8db2('0x15')]);module[_0x8db2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1607e32..bafeb84 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 _0x412e=['STRING','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x412e,0xe1));var _0xe412=function(_0x5c2ad0,_0x46752e){_0x5c2ad0=_0x5c2ad0-0x0;var _0x3d0155=_0x412e[_0x5c2ad0];return _0x3d0155;};'use strict';var Sequelize=require('sequelize');module[_0xe412('0x0')]={'name':{'type':Sequelize[_0xe412('0x1')]},'username':{'type':Sequelize[_0xe412('0x1')]},'password':{'type':Sequelize[_0xe412('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xe412('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe412('0x1')]},'serverUrl':{'type':Sequelize[_0xe412('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe412('0x1')]}}; \ No newline at end of file +var _0xd733=['sequelize','STRING'];(function(_0x498500,_0x40f5f9){var _0x96d67d=function(_0x524e64){while(--_0x524e64){_0x498500['push'](_0x498500['shift']());}};_0x96d67d(++_0x40f5f9);}(_0xd733,0x1f2));var _0x3d73=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0xd733[_0x1c289a];return _0x28d68e;};'use strict';var Sequelize=require(_0x3d73('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d73('0x1')]},'username':{'type':Sequelize[_0x3d73('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3d73('0x1')]},'tenantId':{'type':Sequelize[_0x3d73('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3d73('0x1')]},'serverUrl':{'type':Sequelize[_0x3d73('0x1')],'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 78dbf3c..c109807 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 _0xe14b=['where','filter','merge','VIRTUAL','options','include','findAll','rows','show','filters','includeAll','find','create','body','params','getConfigurations','Dynamics365Configuration','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','tenantId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','includes','@odata.type','substring','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode','stack','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x3a86a7,_0x12ade0){var _0x19b1b6=function(_0x2af9d0){while(--_0x2af9d0){_0x3a86a7['push'](_0x3a86a7['shift']());}};_0x19b1b6(++_0x12ade0);}(_0xe14b,0x93));var _0xbe14=function(_0x59490f,_0x2af741){_0x59490f=_0x59490f-0x0;var _0x25e623=_0xe14b[_0x59490f];return _0x25e623;};'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'];var integrations=require(_0xbe14('0x16'));var jayson=require(_0xbe14('0x17'));var client=jayson[_0xbe14('0x18')][_0xbe14('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x16893f,_0xa2cf72,_0x1e4826,_0x33fd54){return new BPromise(function(_0x813399,_0x530538){var _0x55b3a7=_0x33fd54||client;return _0x55b3a7[_0xbe14('0x1a')](_0x16893f,_0x1e4826)[_0xbe14('0x1b')](function(_0xf4ac9){logger[_0xbe14('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0xa2cf72,_0xbe14('0x1d'));logger[_0xbe14('0x1e')](_0xbe14('0x1f'),_0xa2cf72,_0xbe14('0x1d'),JSON[_0xbe14('0x20')](_0xf4ac9));if(_0xf4ac9[_0xbe14('0x21')]){if(_0xf4ac9[_0xbe14('0x21')]['code']===0x1f4){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x530538(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}logger['error'](_0xbe14('0x22'),_0xa2cf72,_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);return _0x813399(_0xf4ac9[_0xbe14('0x21')][_0xbe14('0x23')]);}else{logger['info'](_0xbe14('0x22'),_0xa2cf72,'request\x20sent');_0x813399(_0xf4ac9[_0xbe14('0x24')]['message']);}})[_0xbe14('0x25')](function(_0x4a25fa){logger[_0xbe14('0x21')](_0xbe14('0x22'),_0xa2cf72,_0x4a25fa);_0x530538(_0x4a25fa);});});}function respondWithStatusCode(_0x505dbd,_0x2da350){_0x2da350=_0x2da350||0xcc;return function(_0x4d4190){if(_0x4d4190){return _0x505dbd[_0xbe14('0x26')](_0x2da350);}return _0x505dbd['status'](_0x2da350)[_0xbe14('0x27')]();};}function respondWithResult(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xc8;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x28')](_0x1ee9c1)[_0xbe14('0x29')](_0x39cc81);}};}function respondWithFilteredResult(_0x55d001,_0x1822e0){return function(_0x1ba46a){if(_0x1ba46a){var _0x391556=_0x1ba46a[_0xbe14('0x2a')],_0x169369=_0x1822e0['offset'],_0x5dd475=_0x1822e0[_0xbe14('0x2b')]+_0x1822e0[_0xbe14('0x2c')],_0x16f884;if(_0x5dd475>=_0x391556){_0x5dd475=_0x391556;_0x16f884=0xc8;}else{_0x16f884=0xce;}_0x55d001[_0xbe14('0x28')](_0x16f884);return _0x55d001[_0xbe14('0x2d')](_0xbe14('0x2e'),_0x169369+'-'+_0x5dd475+'/'+_0x391556)[_0xbe14('0x29')](_0x1ba46a);}return null;};}function patchUpdates(_0x31a664){return function(_0x2b05cb){try{jsonpatch[_0xbe14('0x2f')](_0x2b05cb,_0x31a664,!![]);}catch(_0x16a159){return BPromise[_0xbe14('0x30')](_0x16a159);}return _0x2b05cb[_0xbe14('0x31')]();};}function saveUpdates(_0x39dc0a,_0x10ae36){return function(_0x223f7a){if(_0x223f7a){return _0x223f7a[_0xbe14('0x32')](_0x39dc0a)[_0xbe14('0x1b')](function(_0x2ff48e){return _0x2ff48e;});}return null;};}function removeEntity(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x33')]()['then'](function(){_0x29e76a['status'](0xcc)[_0xbe14('0x27')]();});}};}function handleEntityNotFound(_0x4c1e7e,_0x243524){return function(_0x345b0){if(!_0x345b0){_0x4c1e7e['sendStatus'](0x194);}return _0x345b0;};}function handleError(_0x50cb09,_0x5798c7){_0x5798c7=_0x5798c7||0x1f4;return function(_0x412ad5){logger[_0xbe14('0x21')](_0x412ad5['stack']);if(_0x412ad5[_0xbe14('0x34')]){delete _0x412ad5[_0xbe14('0x34')];}_0x50cb09[_0xbe14('0x28')](_0x5798c7)[_0xbe14('0x35')](_0x412ad5);};}exports[_0xbe14('0x36')]=function(_0x5ef1e5,_0x591a36){var _0x15a997={},_0x52b24c={},_0x5dd7aa={'count':0x0,'rows':[]};var _0x5c5e9f=_[_0xbe14('0x37')](db[_0xbe14('0x38')][_0xbe14('0x39')],function(_0x3dbacb){return{'name':_0x3dbacb[_0xbe14('0x3a')],'type':_0x3dbacb[_0xbe14('0x3b')][_0xbe14('0x3c')]};});_0x52b24c[_0xbe14('0x3d')]=_[_0xbe14('0x37')](_0x5c5e9f,_0xbe14('0x34'));_0x52b24c[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x5ef1e5['query']);_0x52b24c['filters']=_[_0xbe14('0x40')](_0x52b24c[_0xbe14('0x3d')],_0x52b24c[_0xbe14('0x3e')]);_0x15a997['attributes']=_[_0xbe14('0x40')](_0x52b24c[_0xbe14('0x3d')],qs[_0xbe14('0x41')](_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x41')]));_0x15a997[_0xbe14('0x42')]=_0x15a997[_0xbe14('0x42')][_0xbe14('0x43')]?_0x15a997[_0xbe14('0x42')]:_0x52b24c['model'];if(!_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x44')](_0xbe14('0x45'))){_0x15a997[_0xbe14('0x2c')]=qs[_0xbe14('0x2c')](_0x5ef1e5[_0xbe14('0x3e')]['limit']);_0x15a997[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x2b')]);}_0x15a997['order']=qs['sort'](_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x46')]);_0x15a997[_0xbe14('0x47')]=qs['filters'](_['pick'](_0x5ef1e5[_0xbe14('0x3e')],_0x52b24c['filters']),_0x5c5e9f);if(_0x5ef1e5['query'][_0xbe14('0x48')]){_0x15a997[_0xbe14('0x47')]=_[_0xbe14('0x49')](_0x15a997['where'],{'$or':_['map'](_0x5c5e9f,function(_0x5aaa4f){if(_0x5aaa4f[_0xbe14('0x3b')]!==_0xbe14('0x4a')){var _0x1085d2={};_0x1085d2[_0x5aaa4f['name']]={'$like':'%'+_0x5ef1e5[_0xbe14('0x3e')][_0xbe14('0x48')]+'%'};return _0x1085d2;}})});}_0x15a997=_[_0xbe14('0x49')]({},_0x15a997,_0x5ef1e5[_0xbe14('0x4b')]);var _0x58351f={'where':_0x15a997['where']};return db[_0xbe14('0x38')][_0xbe14('0x2a')](_0x58351f)[_0xbe14('0x1b')](function(_0xb2b285){_0x5dd7aa[_0xbe14('0x2a')]=_0xb2b285;if(_0x5ef1e5['query']['includeAll']){_0x15a997[_0xbe14('0x4c')]=[{'all':!![]}];}return db[_0xbe14('0x38')][_0xbe14('0x4d')](_0x15a997);})[_0xbe14('0x1b')](function(_0x4e65d2){_0x5dd7aa[_0xbe14('0x4e')]=_0x4e65d2;return _0x5dd7aa;})[_0xbe14('0x1b')](respondWithFilteredResult(_0x591a36,_0x15a997))['catch'](handleError(_0x591a36,null));};exports[_0xbe14('0x4f')]=function(_0x2a35e5,_0x2d6ee8){var _0x36c20c={'raw':![],'where':{'id':_0x2a35e5['params']['id']}},_0x589dac={};_0x589dac[_0xbe14('0x3d')]=_[_0xbe14('0x3f')](db['Dynamics365Account']['rawAttributes']);_0x589dac[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x2a35e5[_0xbe14('0x3e')]);_0x589dac[_0xbe14('0x50')]=_[_0xbe14('0x40')](_0x589dac[_0xbe14('0x3d')],_0x589dac[_0xbe14('0x3e')]);_0x36c20c['attributes']=_[_0xbe14('0x40')](_0x589dac[_0xbe14('0x3d')],qs[_0xbe14('0x41')](_0x2a35e5[_0xbe14('0x3e')][_0xbe14('0x41')]));_0x36c20c['attributes']=_0x36c20c[_0xbe14('0x42')][_0xbe14('0x43')]?_0x36c20c[_0xbe14('0x42')]:_0x589dac[_0xbe14('0x3d')];if(_0x2a35e5[_0xbe14('0x3e')][_0xbe14('0x51')]){_0x36c20c['include']=[{'all':!![]}];}_0x36c20c=_['merge']({},_0x36c20c,_0x2a35e5[_0xbe14('0x4b')]);return db[_0xbe14('0x38')][_0xbe14('0x52')](_0x36c20c)['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x25')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x53')]=function(_0x50d78f,_0x339a86){return db[_0xbe14('0x38')]['create'](_0x50d78f[_0xbe14('0x54')],{})['then'](respondWithResult(_0x339a86,0xc9))[_0xbe14('0x25')](handleError(_0x339a86,null));};exports[_0xbe14('0x32')]=function(_0x12a9de,_0x550291){if(_0x12a9de[_0xbe14('0x54')]['id']){delete _0x12a9de[_0xbe14('0x54')]['id'];}return db['Dynamics365Account'][_0xbe14('0x52')]({'where':{'id':_0x12a9de[_0xbe14('0x55')]['id']}})[_0xbe14('0x1b')](handleEntityNotFound(_0x550291,null))[_0xbe14('0x1b')](saveUpdates(_0x12a9de[_0xbe14('0x54')],null))['then'](respondWithResult(_0x550291,null))[_0xbe14('0x25')](handleError(_0x550291,null));};exports[_0xbe14('0x33')]=function(_0x3b7846,_0x243b9e){return db[_0xbe14('0x38')][_0xbe14('0x52')]({'where':{'id':_0x3b7846[_0xbe14('0x55')]['id']}})['then'](handleEntityNotFound(_0x243b9e,null))[_0xbe14('0x1b')](removeEntity(_0x243b9e,null))[_0xbe14('0x25')](handleError(_0x243b9e,null));};exports[_0xbe14('0x56')]=function(_0x1201e2,_0x246ed5,_0x2ed3fb){var _0xd8f78f={};var _0x32df3c={};var _0x285b6e;var _0xc61103;return db[_0xbe14('0x38')]['findOne']({'where':{'id':_0x1201e2['params']['id']}})['then'](handleEntityNotFound(_0x246ed5,null))[_0xbe14('0x1b')](function(_0x1bfcbf){if(_0x1bfcbf){_0x285b6e=_0x1bfcbf;_0x32df3c[_0xbe14('0x3d')]=_[_0xbe14('0x3f')](db[_0xbe14('0x57')][_0xbe14('0x39')]);_0x32df3c[_0xbe14('0x3e')]=_[_0xbe14('0x3f')](_0x1201e2[_0xbe14('0x3e')]);_0x32df3c[_0xbe14('0x50')]=_[_0xbe14('0x40')](_0x32df3c[_0xbe14('0x3d')],_0x32df3c[_0xbe14('0x3e')]);_0xd8f78f[_0xbe14('0x42')]=_[_0xbe14('0x40')](_0x32df3c[_0xbe14('0x3d')],qs[_0xbe14('0x41')](_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x41')]));_0xd8f78f[_0xbe14('0x42')]=_0xd8f78f['attributes'][_0xbe14('0x43')]?_0xd8f78f[_0xbe14('0x42')]:_0x32df3c[_0xbe14('0x3d')];_0xd8f78f[_0xbe14('0x58')]=qs[_0xbe14('0x46')](_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x46')]);_0xd8f78f[_0xbe14('0x47')]=qs[_0xbe14('0x50')](_[_0xbe14('0x59')](_0x1201e2['query'],_0x32df3c[_0xbe14('0x50')]));if(_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x48')]){_0xd8f78f[_0xbe14('0x47')]=_[_0xbe14('0x49')](_0xd8f78f['where'],{'$or':_[_0xbe14('0x37')](_0xd8f78f[_0xbe14('0x42')],function(_0x3d186b){var _0xd4e1c7={};_0xd4e1c7[_0x3d186b]={'$like':'%'+_0x1201e2[_0xbe14('0x3e')]['filter']+'%'};return _0xd4e1c7;})});}_0xd8f78f=_[_0xbe14('0x49')]({},_0xd8f78f,_0x1201e2[_0xbe14('0x4b')]);return _0x285b6e[_0xbe14('0x56')](_0xd8f78f);}})[_0xbe14('0x1b')](function(_0xaebce8){if(_0xaebce8){_0xc61103=_0xaebce8[_0xbe14('0x43')];if(!_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x44')]('nolimit')){_0xd8f78f[_0xbe14('0x2c')]=qs[_0xbe14('0x2c')](_0x1201e2[_0xbe14('0x3e')][_0xbe14('0x2c')]);_0xd8f78f[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x1201e2[_0xbe14('0x3e')]['offset']);}return _0x285b6e['getConfigurations'](_0xd8f78f);}})[_0xbe14('0x1b')](function(_0x3c2b58){if(_0x3c2b58){return _0x3c2b58?{'count':_0xc61103,'rows':_0x3c2b58}:null;}})[_0xbe14('0x1b')](respondWithResult(_0x246ed5,null))[_0xbe14('0x25')](handleError(_0x246ed5,null));};exports[_0xbe14('0x5a')]=function(_0x28cade,_0x23a32f,_0x43511e){if(_0x28cade['body']['id']){delete _0x28cade['body']['id'];}return db[_0xbe14('0x38')][_0xbe14('0x5b')]({'where':{'id':_0x28cade[_0xbe14('0x55')]['id']}})['then'](handleEntityNotFound(_0x23a32f,null))[_0xbe14('0x1b')](function(_0x16bca1){if(_0x16bca1){_0x28cade[_0xbe14('0x54')][_0xbe14('0x5c')]=_0x16bca1['id'];_0x28cade[_0xbe14('0x54')][_0xbe14('0x5d')]=integrations[_0xbe14('0x5e')](_0x28cade['body'][_0xbe14('0x5f')],_0x28cade[_0xbe14('0x54')][_0xbe14('0x3b')]);_0x28cade[_0xbe14('0x54')][_0xbe14('0x60')]=integrations[_0xbe14('0x61')](_0x28cade[_0xbe14('0x54')]['channel'],_0x28cade[_0xbe14('0x54')][_0xbe14('0x3b')]);return db[_0xbe14('0x57')][_0xbe14('0x53')](_0x28cade[_0xbe14('0x54')],{'include':[{'model':db[_0xbe14('0x62')],'as':_0xbe14('0x5d')},{'model':db[_0xbe14('0x62')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1b')](respondWithResult(_0x23a32f,null))[_0xbe14('0x25')](handleError(_0x23a32f,null));};exports[_0xbe14('0x63')]=function(_0xb40587,_0x2e0155,_0x17576b){var _0x4d59ce=_0xb40587[_0xbe14('0x3e')][_0xbe14('0x64')];var _0x1edc66=_0x4d59ce===_0xbe14('0x65')?'Incident':_0xbe14('0x66');var _0x1578b6='';var _0x316542='';var _0x1e7770='';var _0x80b6ec='';var _0x3d54e4='';var _0x3b0828='';var _0x55e70f='';var _0x70ed08='';var _0x589197=[_0xbe14('0x67'),'description',_0xbe14('0x68'),_0xbe14('0x69'),_0xbe14('0x6a'),'subject',_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'phonecall_activity_parties'];var _0x41a896=[_0xbe14('0x6e'),_0xbe14('0x6f'),_0xbe14('0x70'),'billedserviceunits',_0xbe14('0x71'),_0xbe14('0x72'),_0xbe14('0x73'),_0xbe14('0x74'),_0xbe14('0x75'),_0xbe14('0x76'),_0xbe14('0x77'),'createdbyyominame',_0xbe14('0x78'),_0xbe14('0x79'),_0xbe14('0x7a'),'customeridname',_0xbe14('0x7b'),_0xbe14('0x7c'),_0xbe14('0x7d'),'entitlementidname',_0xbe14('0x7e'),_0xbe14('0x7f'),'escalatedon',_0xbe14('0x80'),'firstresponsebykpiidname',_0xbe14('0x81'),_0xbe14('0x82'),'influencescore','kbarticleidname',_0xbe14('0x83'),_0xbe14('0x84'),_0xbe14('0x85'),'modifiedbyexternalpartyyominame',_0xbe14('0x86'),_0xbe14('0x87'),_0xbe14('0x88'),_0xbe14('0x89'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xbe14('0x8a'),_0xbe14('0x8b'),_0xbe14('0x8c'),_0xbe14('0x8d'),_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'parentcaseidname',_0xbe14('0x91'),'primarycontactidyominame',_0xbe14('0x92'),_0xbe14('0x93'),_0xbe14('0x94'),_0xbe14('0x95'),'resolvebykpiidname',_0xbe14('0x96'),_0xbe14('0x97'),_0xbe14('0x98'),'sentimentvalue',_0xbe14('0x99'),_0xbe14('0x9a'),_0xbe14('0x9b'),_0xbe14('0x9c'),_0xbe14('0x9d'),_0xbe14('0x9e'),_0xbe14('0x9f'),_0xbe14('0xa0'),_0xbe14('0xa1'),_0xbe14('0xa2'),_0xbe14('0xa3'),_0xbe14('0xa4')];var _0x5af56=_0x589197[_0xbe14('0xa5')](_0x41a896);return db[_0xbe14('0x38')][_0xbe14('0x5b')]({'where':{'id':_0xb40587[_0xbe14('0x55')]['id']},'attributes':['id',_0xbe14('0xa6'),_0xbe14('0xa7'),_0xbe14('0xa8'),'tenantId',_0xbe14('0xa9'),'clientSecret']})[_0xbe14('0x1b')](handleEntityNotFound(_0x2e0155,null))[_0xbe14('0x1b')](function(_0x262bc0){if(_0x262bc0){_0x70ed08=_0x262bc0[_0xbe14('0xa8')];var _0x1d7b08=_0x70ed08['slice'](-0x1);if(_0x1d7b08==='/'){_0x70ed08=_0x70ed08['substring'](0x0,_0x70ed08[_0xbe14('0xaa')](_0x1d7b08));}_0x55e70f=util[_0xbe14('0xab')](_0xbe14('0xac'),_0x70ed08);var _0x42b849={'method':'POST','uri':_0xbe14('0xad')+_0x262bc0[_0xbe14('0xae')]+'/oauth2/token','form':{'client_id':_0x262bc0[_0xbe14('0xa9')],'resource':_0x70ed08,'username':_0x262bc0[_0xbe14('0xa6')],'password':_0x262bc0[_0xbe14('0xa7')],'grant_type':_0xbe14('0xa7'),'client_secret':_0x262bc0['clientSecret']},'json':!![]};return rp(_0x42b849);}})[_0xbe14('0x1b')](function(_0x562559){_0x3b0828=_0x562559['access_token'];var _0x2ea561={'method':_0xbe14('0xaf'),'uri':encodeURI(_0x55e70f+_0xbe14('0xb0')+_0x1edc66+'\x27'),'headers':{'Authorization':_0xbe14('0xb1')+_0x3b0828,'If-None-Match':null,'OData-Version':_0xbe14('0xb2')},'json':!![]};return rp(_0x2ea561);})['then'](function(_0x1547f5){var _0x1584f6=_0x1547f5['value'][0x0];var _0x4e35ed=_0x1584f6[_0xbe14('0xb3')];var _0x141806={'method':'GET','uri':_0x55e70f+_0xbe14('0xb4')+_0x4e35ed+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xbe14('0xb1')+_0x3b0828,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x141806);})[_0xbe14('0x1b')](function(_0x5d4431){_0x1578b6=_0x5d4431;_0x316542=_0x1578b6[_0xbe14('0xb5')];_0x316542=_['remove'](_0x316542,function(_0x20a085){return!_0x5af56[_0xbe14('0xb6')](_0x20a085['LogicalName']);});var _0x519ffc=[];var _0x143f18=[];_0x316542['forEach'](function(_0x5a8750){if(_0x5a8750[_0xbe14('0xb7')]){var _0x2ca7c9=_0x5a8750[_0xbe14('0xb7')][_0xbe14('0xb8')](_0x5a8750[_0xbe14('0xb7')][_0xbe14('0xaa')]('.')+0x1);if(_0x2ca7c9===_0xbe14('0xb9')){_0x519ffc['push'](getSelectList(_0x55e70f,_0x4d59ce,_0x143f18,_0x1578b6[_0xbe14('0xb3')],_0x5a8750[_0xbe14('0xb3')],_0x3b0828));}}});return Promise[_0xbe14('0xba')](_0x519ffc);})[_0xbe14('0x1b')](function(_0x59779a){_0x1e7770=_0x59779a[0x0];var _0x26372a=[];var _0x3c5097=[];_0x316542[_0xbe14('0xbb')](function(_0x501a53){if(!_[_0xbe14('0xbc')](_0x501a53[_0xbe14('0xb7')])){var _0x521a9f=_0x501a53[_0xbe14('0xb7')]['substring'](_0x501a53[_0xbe14('0xb7')][_0xbe14('0xaa')]('.')+0x1);if(_0x521a9f===_0xbe14('0xbd')){_0x26372a['push'](getBooleanList(_0x55e70f,_0x4d59ce,_0x3c5097,_0x1578b6[_0xbe14('0xb3')],_0x501a53['MetadataId'],_0x3b0828));}}});return Promise[_0xbe14('0xba')](_0x26372a);})['then'](function(_0x590953){_0x80b6ec=_0x590953[0x0];var _0x21f3ff=[];var _0x553f51=[];_0x316542[_0xbe14('0xbb')](function(_0x5c6784){if(_0x5c6784[_0xbe14('0xb7')]){var _0x20763b=_0x5c6784[_0xbe14('0xb7')][_0xbe14('0xb8')](_0x5c6784[_0xbe14('0xb7')][_0xbe14('0xaa')]('.')+0x1);if(_0x20763b===_0xbe14('0xbe')||_0x20763b===_0xbe14('0xbf')||_0x20763b===_0xbe14('0xc0')||_0x20763b===_0xbe14('0xc1')||_0x20763b===_0xbe14('0xc2')||_0x20763b===_0xbe14('0xc3')||_0x20763b===_0xbe14('0xc4')||_0x20763b==='EntityNameAttributeMetadata'||_0x20763b===_0xbe14('0xc5')||_0x20763b===_0xbe14('0xc6')){_0x21f3ff[_0xbe14('0xc7')](getInputList(_0x55e70f,_0x4d59ce,_0x20763b,_0x553f51,_0x1578b6[_0xbe14('0xb3')],_0x5c6784[_0xbe14('0xb3')],_0x3b0828));}}});return Promise['all'](_0x21f3ff);})['then'](function(_0x116282){_0x3d54e4=_0x116282[0x0];var _0x1a9cdc=_0x1e7770[_0xbe14('0xa5')](_0x80b6ec)[_0xbe14('0xa5')](_0x3d54e4);var _0x4942e3={'count':_0x1a9cdc[_0xbe14('0x43')],'rows':_0x1a9cdc};return _0x4942e3;})[_0xbe14('0x1b')](respondWithResult(_0x2e0155,null))[_0xbe14('0x25')](function(_0x1a3e87){var _0x26e7a7=_0xb40587[_0xbe14('0x3e')][_0xbe14('0xc8')]?0x1f4:_0x1a3e87[_0xbe14('0xc9')]||0x1f4;logger[_0xbe14('0x21')](_0x1a3e87[_0xbe14('0xca')]);delete _0x1a3e87[_0xbe14('0x34')];if(_0x26e7a7===0x191){_0x26e7a7=0x190;}_0x2e0155[_0xbe14('0x28')](_0x26e7a7)[_0xbe14('0x35')](_0xb40587[_0xbe14('0x3e')][_0xbe14('0xc8')]?{'message':_0xbe14('0xcb'),'statusCode':_0x1a3e87[_0xbe14('0xc9')]}:_0x1a3e87);});};function getSelectList(_0x1bdb8b,_0x317175,_0x151680,_0x499b5d,_0x245cdc,_0x3303a4){var _0x1ea574={'method':_0xbe14('0xaf'),'uri':_0x1bdb8b+_0xbe14('0xb4')+_0x499b5d+_0xbe14('0xcc')+_0x245cdc+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xbe14('0xb1')+_0x3303a4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ea574)[_0xbe14('0x1b')](function(_0x4babba){var _0x2408c6=[];var _0x59000b=_0x4babba[_0xbe14('0xcd')][_0xbe14('0xce')];_0x59000b[_0xbe14('0xbb')](function(_0x12498f){_0x2408c6[_0xbe14('0xc7')]({'name':_0x12498f[_0xbe14('0xcf')][_0xbe14('0xd0')][_0xbe14('0xcf')],'value':String(_0x12498f[_0xbe14('0xd1')])});});var _0x4f44ec={'id':_0x317175+'_'+_0x4babba[_0xbe14('0xd2')],'name':_0x4babba[_0xbe14('0xd3')][_0xbe14('0xd0')][_0xbe14('0xcf')],'custom':![],'options':_0x2408c6};_0x151680['push'](_0x4f44ec);return _0x151680;});}function getBooleanList(_0xe5a476,_0x4c3090,_0x2481fe,_0x4eb6c2,_0x25be60,_0x3e7588){var _0x24fa89={'method':'GET','uri':_0xe5a476+_0xbe14('0xb4')+_0x4eb6c2+')/Attributes('+_0x25be60+_0xbe14('0xd4'),'headers':{'Authorization':_0xbe14('0xb1')+_0x3e7588,'If-None-Match':null,'OData-Version':_0xbe14('0xb2')},'json':!![]};return rp(_0x24fa89)[_0xbe14('0x1b')](function(_0x1f7987){var _0x24d13d=[];_0x24d13d[_0xbe14('0xc7')]({'name':_0x1f7987[_0xbe14('0xcd')][_0xbe14('0xd5')]['Label'][_0xbe14('0xd0')]['Label'],'value':_0xbe14('0xd6')},{'name':_0x1f7987[_0xbe14('0xcd')][_0xbe14('0xd7')]['Label'][_0xbe14('0xd0')][_0xbe14('0xcf')],'value':_0xbe14('0xd8')});var _0xb6251a={'id':_0x4c3090+'_'+_0x1f7987[_0xbe14('0xd2')],'name':_0x1f7987['DisplayName']['UserLocalizedLabel'][_0xbe14('0xcf')],'custom':![],'options':_0x24d13d};_0x2481fe['push'](_0xb6251a);return _0x2481fe;});}function getInputList(_0x16b1c8,_0x36d6a6,_0x2dea3d,_0x374d51,_0x4e06b1,_0x33c7d5,_0x34af71){var _0x508c93={'method':_0xbe14('0xaf'),'uri':_0x16b1c8+_0xbe14('0xb4')+_0x4e06b1+_0xbe14('0xcc')+_0x33c7d5+_0xbe14('0xd9')+_0x2dea3d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xbe14('0xb1')+_0x34af71,'If-None-Match':null,'OData-Version':_0xbe14('0xb2')},'json':!![]};return rp(_0x508c93)[_0xbe14('0x1b')](function(_0x3374d8){var _0x3b7920={'id':_0x36d6a6+'_'+_0x3374d8[_0xbe14('0xd2')],'name':_0x3374d8[_0xbe14('0xd3')][_0xbe14('0xd0')]?_0x3374d8[_0xbe14('0xd3')][_0xbe14('0xd0')]['Label']:_0x3374d8[_0xbe14('0xd2')],'custom':![],'options':[]};_0x374d51[_0xbe14('0xc7')](_0x3b7920);return _0x374d51;});} \ No newline at end of file +var _0xfdbd=['substring','isNil','push','all','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','PhoneCall','title','description','customerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientId','clientSecret','remoteUri','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','Bearer\x20','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type'];(function(_0x551f89,_0x44dd9d){var _0x2b63c1=function(_0x2b0300){while(--_0x2b0300){_0x551f89['push'](_0x551f89['shift']());}};_0x2b63c1(++_0x44dd9d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x323c60,_0x219b72){_0x323c60=_0x323c60-0x0;var _0x103f23=_0xfdbd[_0x323c60];return _0x103f23;};'use strict';var pdf=require(_0xdfdb('0x0'));var emlformat=require(_0xdfdb('0x1'));var rimraf=require(_0xdfdb('0x2'));var zipdir=require(_0xdfdb('0x3'));var jsonpatch=require(_0xdfdb('0x4'));var rp=require(_0xdfdb('0x5'));var moment=require(_0xdfdb('0x6'));var BPromise=require(_0xdfdb('0x7'));var Mustache=require(_0xdfdb('0x8'));var util=require('util');var path=require(_0xdfdb('0x9'));var sox=require('sox');var csv=require(_0xdfdb('0xa'));var ejs=require(_0xdfdb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];var integrations=require(_0xdfdb('0x19'));var jayson=require(_0xdfdb('0x1a'));var client=jayson[_0xdfdb('0x1b')][_0xdfdb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf5d903,_0x16017d,_0x51162f,_0x48a66a){return new BPromise(function(_0x2c44dc,_0x4b1ff7){var _0x471ddc=_0x48a66a||client;return _0x471ddc[_0xdfdb('0x1d')](_0xf5d903,_0x51162f)[_0xdfdb('0x1e')](function(_0x40bc8a){logger[_0xdfdb('0x1f')](_0xdfdb('0x20'),_0x16017d,'request\x20sent');logger['debug'](_0xdfdb('0x21'),_0x16017d,_0xdfdb('0x22'),JSON[_0xdfdb('0x23')](_0x40bc8a));if(_0x40bc8a['error']){if(_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x25')]===0x1f4){logger[_0xdfdb('0x24')](_0xdfdb('0x20'),_0x16017d,_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x26')]);return _0x4b1ff7(_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x26')]);}logger['error'](_0xdfdb('0x20'),_0x16017d,_0x40bc8a[_0xdfdb('0x24')][_0xdfdb('0x26')]);return _0x2c44dc(_0x40bc8a['error'][_0xdfdb('0x26')]);}else{logger[_0xdfdb('0x1f')](_0xdfdb('0x20'),_0x16017d,'request\x20sent');_0x2c44dc(_0x40bc8a[_0xdfdb('0x27')][_0xdfdb('0x26')]);}})[_0xdfdb('0x28')](function(_0x489fd4){logger[_0xdfdb('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x16017d,_0x489fd4);_0x4b1ff7(_0x489fd4);});});}function respondWithStatusCode(_0x2db1c1,_0x145350){_0x145350=_0x145350||0xcc;return function(_0x1fa2f3){if(_0x1fa2f3){return _0x2db1c1[_0xdfdb('0x29')](_0x145350);}return _0x2db1c1['status'](_0x145350)[_0xdfdb('0x2a')]();};}function respondWithResult(_0x4363d8,_0x956843){_0x956843=_0x956843||0xc8;return function(_0x400663){if(_0x400663){return _0x4363d8[_0xdfdb('0x2b')](_0x956843)[_0xdfdb('0x2c')](_0x400663);}};}function respondWithFilteredResult(_0x57d24f,_0xec4d22){return function(_0x2d5fe2){if(_0x2d5fe2){var _0xdf3a5c=_0x2d5fe2[_0xdfdb('0x2d')],_0x4f8057=_0xec4d22[_0xdfdb('0x2e')],_0x466932=_0xec4d22[_0xdfdb('0x2e')]+_0xec4d22['limit'],_0x5df454;if(_0x466932>=_0xdf3a5c){_0x466932=_0xdf3a5c;_0x5df454=0xc8;}else{_0x5df454=0xce;}_0x57d24f['status'](_0x5df454);return _0x57d24f[_0xdfdb('0x2f')](_0xdfdb('0x30'),_0x4f8057+'-'+_0x466932+'/'+_0xdf3a5c)[_0xdfdb('0x2c')](_0x2d5fe2);}return null;};}function patchUpdates(_0x3a2ec3){return function(_0x371b69){try{jsonpatch[_0xdfdb('0x31')](_0x371b69,_0x3a2ec3,!![]);}catch(_0x5a9fc4){return BPromise[_0xdfdb('0x32')](_0x5a9fc4);}return _0x371b69[_0xdfdb('0x33')]();};}function saveUpdates(_0x36b555,_0x13ec6e){return function(_0x10f4f6){if(_0x10f4f6){return _0x10f4f6[_0xdfdb('0x34')](_0x36b555)[_0xdfdb('0x1e')](function(_0x1ce036){return _0x1ce036;});}return null;};}function removeEntity(_0x68398d,_0x1b7bce){return function(_0x379e6a){if(_0x379e6a){return _0x379e6a['destroy']()['then'](function(){_0x68398d[_0xdfdb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196dfa,_0x14e83e){return function(_0x3ba5f5){if(!_0x3ba5f5){_0x196dfa[_0xdfdb('0x29')](0x194);}return _0x3ba5f5;};}function handleError(_0x514232,_0x40cf5b){_0x40cf5b=_0x40cf5b||0x1f4;return function(_0x53cf40){logger[_0xdfdb('0x24')](_0x53cf40[_0xdfdb('0x35')]);if(_0x53cf40[_0xdfdb('0x36')]){delete _0x53cf40[_0xdfdb('0x36')];}_0x514232[_0xdfdb('0x2b')](_0x40cf5b)[_0xdfdb('0x37')](_0x53cf40);};}exports['index']=function(_0x34daa1,_0xd8528d){var _0x5beec7={},_0x1c1484={},_0x4377d6={'count':0x0,'rows':[]};var _0x45b7bb=_[_0xdfdb('0x38')](db[_0xdfdb('0x39')][_0xdfdb('0x3a')],function(_0x16d5b8){return{'name':_0x16d5b8[_0xdfdb('0x3b')],'type':_0x16d5b8[_0xdfdb('0x3c')][_0xdfdb('0x3d')]};});_0x1c1484[_0xdfdb('0x3e')]=_['map'](_0x45b7bb,_0xdfdb('0x36'));_0x1c1484[_0xdfdb('0x3f')]=_[_0xdfdb('0x40')](_0x34daa1[_0xdfdb('0x3f')]);_0x1c1484[_0xdfdb('0x41')]=_[_0xdfdb('0x42')](_0x1c1484[_0xdfdb('0x3e')],_0x1c1484[_0xdfdb('0x3f')]);_0x5beec7['attributes']=_['intersection'](_0x1c1484[_0xdfdb('0x3e')],qs[_0xdfdb('0x43')](_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x43')]));_0x5beec7[_0xdfdb('0x44')]=_0x5beec7[_0xdfdb('0x44')][_0xdfdb('0x45')]?_0x5beec7[_0xdfdb('0x44')]:_0x1c1484[_0xdfdb('0x3e')];if(!_0x34daa1['query'][_0xdfdb('0x46')](_0xdfdb('0x47'))){_0x5beec7[_0xdfdb('0x48')]=qs[_0xdfdb('0x48')](_0x34daa1[_0xdfdb('0x3f')]['limit']);_0x5beec7[_0xdfdb('0x2e')]=qs[_0xdfdb('0x2e')](_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x2e')]);}_0x5beec7[_0xdfdb('0x49')]=qs['sort'](_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x4a')]);_0x5beec7[_0xdfdb('0x4b')]=qs['filters'](_[_0xdfdb('0x4c')](_0x34daa1['query'],_0x1c1484[_0xdfdb('0x41')]),_0x45b7bb);if(_0x34daa1['query'][_0xdfdb('0x4d')]){_0x5beec7[_0xdfdb('0x4b')]=_['merge'](_0x5beec7[_0xdfdb('0x4b')],{'$or':_['map'](_0x45b7bb,function(_0xfea790){if(_0xfea790[_0xdfdb('0x3c')]!==_0xdfdb('0x4e')){var _0x2566f8={};_0x2566f8[_0xfea790[_0xdfdb('0x36')]]={'$like':'%'+_0x34daa1['query']['filter']+'%'};return _0x2566f8;}})});}_0x5beec7=_[_0xdfdb('0x4f')]({},_0x5beec7,_0x34daa1[_0xdfdb('0x50')]);var _0x4b70b3={'where':_0x5beec7[_0xdfdb('0x4b')]};return db['Dynamics365Account'][_0xdfdb('0x2d')](_0x4b70b3)[_0xdfdb('0x1e')](function(_0x8b1db1){_0x4377d6[_0xdfdb('0x2d')]=_0x8b1db1;if(_0x34daa1[_0xdfdb('0x3f')][_0xdfdb('0x51')]){_0x5beec7[_0xdfdb('0x52')]=[{'all':!![]}];}return db[_0xdfdb('0x39')][_0xdfdb('0x53')](_0x5beec7);})[_0xdfdb('0x1e')](function(_0x24f88a){_0x4377d6[_0xdfdb('0x54')]=_0x24f88a;return _0x4377d6;})[_0xdfdb('0x1e')](respondWithFilteredResult(_0xd8528d,_0x5beec7))[_0xdfdb('0x28')](handleError(_0xd8528d,null));};exports[_0xdfdb('0x55')]=function(_0x273477,_0x5ae070){var _0x4834a9={'raw':![],'where':{'id':_0x273477[_0xdfdb('0x56')]['id']}},_0x6b03a3={};_0x6b03a3[_0xdfdb('0x3e')]=_['keys'](db[_0xdfdb('0x39')][_0xdfdb('0x3a')]);_0x6b03a3[_0xdfdb('0x3f')]=_[_0xdfdb('0x40')](_0x273477['query']);_0x6b03a3[_0xdfdb('0x41')]=_[_0xdfdb('0x42')](_0x6b03a3['model'],_0x6b03a3[_0xdfdb('0x3f')]);_0x4834a9[_0xdfdb('0x44')]=_[_0xdfdb('0x42')](_0x6b03a3[_0xdfdb('0x3e')],qs[_0xdfdb('0x43')](_0x273477[_0xdfdb('0x3f')][_0xdfdb('0x43')]));_0x4834a9[_0xdfdb('0x44')]=_0x4834a9[_0xdfdb('0x44')]['length']?_0x4834a9[_0xdfdb('0x44')]:_0x6b03a3['model'];if(_0x273477[_0xdfdb('0x3f')][_0xdfdb('0x51')]){_0x4834a9[_0xdfdb('0x52')]=[{'all':!![]}];}_0x4834a9=_[_0xdfdb('0x4f')]({},_0x4834a9,_0x273477[_0xdfdb('0x50')]);return db[_0xdfdb('0x39')][_0xdfdb('0x57')](_0x4834a9)['then'](handleEntityNotFound(_0x5ae070,null))[_0xdfdb('0x1e')](respondWithResult(_0x5ae070,null))[_0xdfdb('0x28')](handleError(_0x5ae070,null));};exports[_0xdfdb('0x58')]=function(_0x8ea076,_0xd2b334){return db['Dynamics365Account'][_0xdfdb('0x58')](_0x8ea076['body'],{})[_0xdfdb('0x1e')](respondWithResult(_0xd2b334,0xc9))[_0xdfdb('0x28')](handleError(_0xd2b334,null));};exports[_0xdfdb('0x34')]=function(_0x6d7407,_0x3f10fe){if(_0x6d7407['body']['id']){delete _0x6d7407[_0xdfdb('0x59')]['id'];}return db[_0xdfdb('0x39')]['find']({'where':{'id':_0x6d7407[_0xdfdb('0x56')]['id']}})[_0xdfdb('0x1e')](handleEntityNotFound(_0x3f10fe,null))[_0xdfdb('0x1e')](saveUpdates(_0x6d7407['body'],null))[_0xdfdb('0x1e')](respondWithResult(_0x3f10fe,null))[_0xdfdb('0x28')](handleError(_0x3f10fe,null));};exports[_0xdfdb('0x5a')]=function(_0x1cce58,_0x421782){return db[_0xdfdb('0x39')]['find']({'where':{'id':_0x1cce58['params']['id']}})[_0xdfdb('0x1e')](handleEntityNotFound(_0x421782,null))['then'](removeEntity(_0x421782,null))['catch'](handleError(_0x421782,null));};exports['getConfigurations']=function(_0x2f86c9,_0x273afa,_0x1a9541){var _0x1b5f17={};var _0x8bd5c0={};var _0x17834e;var _0xa1d520;return db[_0xdfdb('0x39')][_0xdfdb('0x5b')]({'where':{'id':_0x2f86c9['params']['id']}})['then'](handleEntityNotFound(_0x273afa,null))[_0xdfdb('0x1e')](function(_0x4a9654){if(_0x4a9654){_0x17834e=_0x4a9654;_0x8bd5c0[_0xdfdb('0x3e')]=_[_0xdfdb('0x40')](db[_0xdfdb('0x5c')]['rawAttributes']);_0x8bd5c0[_0xdfdb('0x3f')]=_[_0xdfdb('0x40')](_0x2f86c9[_0xdfdb('0x3f')]);_0x8bd5c0[_0xdfdb('0x41')]=_[_0xdfdb('0x42')](_0x8bd5c0[_0xdfdb('0x3e')],_0x8bd5c0[_0xdfdb('0x3f')]);_0x1b5f17[_0xdfdb('0x44')]=_['intersection'](_0x8bd5c0[_0xdfdb('0x3e')],qs[_0xdfdb('0x43')](_0x2f86c9['query'][_0xdfdb('0x43')]));_0x1b5f17[_0xdfdb('0x44')]=_0x1b5f17[_0xdfdb('0x44')][_0xdfdb('0x45')]?_0x1b5f17['attributes']:_0x8bd5c0['model'];_0x1b5f17[_0xdfdb('0x49')]=qs[_0xdfdb('0x4a')](_0x2f86c9['query'][_0xdfdb('0x4a')]);_0x1b5f17[_0xdfdb('0x4b')]=qs[_0xdfdb('0x41')](_['pick'](_0x2f86c9['query'],_0x8bd5c0[_0xdfdb('0x41')]));if(_0x2f86c9[_0xdfdb('0x3f')]['filter']){_0x1b5f17['where']=_[_0xdfdb('0x4f')](_0x1b5f17['where'],{'$or':_['map'](_0x1b5f17[_0xdfdb('0x44')],function(_0x4a3002){var _0x5fbf48={};_0x5fbf48[_0x4a3002]={'$like':'%'+_0x2f86c9[_0xdfdb('0x3f')]['filter']+'%'};return _0x5fbf48;})});}_0x1b5f17=_['merge']({},_0x1b5f17,_0x2f86c9[_0xdfdb('0x50')]);return _0x17834e[_0xdfdb('0x5d')](_0x1b5f17);}})['then'](function(_0x28fdbf){if(_0x28fdbf){_0xa1d520=_0x28fdbf[_0xdfdb('0x45')];if(!_0x2f86c9[_0xdfdb('0x3f')][_0xdfdb('0x46')](_0xdfdb('0x47'))){_0x1b5f17['limit']=qs['limit'](_0x2f86c9[_0xdfdb('0x3f')][_0xdfdb('0x48')]);_0x1b5f17[_0xdfdb('0x2e')]=qs[_0xdfdb('0x2e')](_0x2f86c9[_0xdfdb('0x3f')][_0xdfdb('0x2e')]);}return _0x17834e['getConfigurations'](_0x1b5f17);}})[_0xdfdb('0x1e')](function(_0x3c3228){if(_0x3c3228){return _0x3c3228?{'count':_0xa1d520,'rows':_0x3c3228}:null;}})[_0xdfdb('0x1e')](respondWithResult(_0x273afa,null))[_0xdfdb('0x28')](handleError(_0x273afa,null));};exports[_0xdfdb('0x5e')]=function(_0x1bcfdd,_0x2037b1,_0x4cdcdc){if(_0x1bcfdd[_0xdfdb('0x59')]['id']){delete _0x1bcfdd[_0xdfdb('0x59')]['id'];}return db['Dynamics365Account'][_0xdfdb('0x5b')]({'where':{'id':_0x1bcfdd[_0xdfdb('0x56')]['id']}})[_0xdfdb('0x1e')](handleEntityNotFound(_0x2037b1,null))[_0xdfdb('0x1e')](function(_0x2c9405){if(_0x2c9405){_0x1bcfdd['body'][_0xdfdb('0x5f')]=_0x2c9405['id'];_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x60')]=integrations[_0xdfdb('0x61')](_0x1bcfdd['body'][_0xdfdb('0x62')],_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x3c')]);_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x63')]=integrations[_0xdfdb('0x64')](_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x62')],_0x1bcfdd[_0xdfdb('0x59')][_0xdfdb('0x3c')]);return db[_0xdfdb('0x5c')]['create'](_0x1bcfdd[_0xdfdb('0x59')],{'include':[{'model':db[_0xdfdb('0x65')],'as':'Subjects'},{'model':db[_0xdfdb('0x65')],'as':_0xdfdb('0x63')}]});}return null;})[_0xdfdb('0x1e')](respondWithResult(_0x2037b1,null))['catch'](handleError(_0x2037b1,null));};exports['getFields']=function(_0x4c4d3a,_0x9f2170,_0x465565){var _0x1c7964=_0x4c4d3a[_0xdfdb('0x3f')][_0xdfdb('0x66')];var _0x394536=_0x1c7964===_0xdfdb('0x67')?'Incident':_0xdfdb('0x68');var _0xcda070='';var _0x1d69fb='';var _0x2269e3='';var _0x5b6e35='';var _0x1c90e9='';var _0x37de3d='';var _0x5d3923='';var _0x2ced3d='';var _0x117cd7=[_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),'ownerid',_0xdfdb('0x6c'),'subject',_0xdfdb('0x6d'),_0xdfdb('0x6e'),_0xdfdb('0x6f'),_0xdfdb('0x70')];var _0x110097=['accountidname',_0xdfdb('0x71'),_0xdfdb('0x72'),'billedserviceunits','contactidname',_0xdfdb('0x73'),'contractdetailidname','contractidname',_0xdfdb('0x74'),_0xdfdb('0x75'),_0xdfdb('0x76'),_0xdfdb('0x77'),_0xdfdb('0x78'),_0xdfdb('0x79'),_0xdfdb('0x7a'),_0xdfdb('0x7b'),'customeridtype',_0xdfdb('0x7c'),'emailaddress',_0xdfdb('0x7d'),_0xdfdb('0x7e'),_0xdfdb('0x7f'),_0xdfdb('0x80'),_0xdfdb('0x81'),'firstresponsebykpiidname',_0xdfdb('0x82'),_0xdfdb('0x83'),_0xdfdb('0x84'),_0xdfdb('0x85'),_0xdfdb('0x86'),'masteridname','modifiedbyexternalpartyname',_0xdfdb('0x87'),_0xdfdb('0x88'),'modifiedbyyominame',_0xdfdb('0x89'),'modifiedonbehalfbyname',_0xdfdb('0x8a'),_0xdfdb('0x8b'),_0xdfdb('0x8c'),'numberofchildincidents',_0xdfdb('0x8d'),'overriddencreatedon','owneridname',_0xdfdb('0x8e'),'owneridyominame',_0xdfdb('0x8f'),_0xdfdb('0x90'),_0xdfdb('0x91'),_0xdfdb('0x92'),_0xdfdb('0x93'),_0xdfdb('0x94'),_0xdfdb('0x95'),_0xdfdb('0x96'),_0xdfdb('0x97'),_0xdfdb('0x98'),'responsiblecontactidyominame','sentimentvalue',_0xdfdb('0x99'),'slaname','socialprofileidname','statecode','statuscode',_0xdfdb('0x9a'),_0xdfdb('0x9b'),_0xdfdb('0x9c'),_0xdfdb('0x9d'),_0xdfdb('0x9e'),_0xdfdb('0x9f'),_0xdfdb('0xa0')];var _0x114373=_0x117cd7[_0xdfdb('0xa1')](_0x110097);return db[_0xdfdb('0x39')][_0xdfdb('0x5b')]({'where':{'id':_0x4c4d3a[_0xdfdb('0x56')]['id']},'attributes':['id',_0xdfdb('0xa2'),'password','remoteUri',_0xdfdb('0xa3'),_0xdfdb('0xa4'),_0xdfdb('0xa5')]})[_0xdfdb('0x1e')](handleEntityNotFound(_0x9f2170,null))[_0xdfdb('0x1e')](function(_0x18505c){if(_0x18505c){_0x2ced3d=_0x18505c[_0xdfdb('0xa6')];var _0x421578=_0x2ced3d[_0xdfdb('0xa7')](-0x1);if(_0x421578==='/'){_0x2ced3d=_0x2ced3d['substring'](0x0,_0x2ced3d[_0xdfdb('0xa8')](_0x421578));}_0x5d3923=util[_0xdfdb('0xa9')](_0xdfdb('0xaa'),_0x2ced3d);var _0x2cbe58={'method':_0xdfdb('0xab'),'uri':_0xdfdb('0xac')+_0x18505c['tenantId']+_0xdfdb('0xad'),'form':{'client_id':_0x18505c[_0xdfdb('0xa4')],'resource':_0x2ced3d,'username':_0x18505c[_0xdfdb('0xa2')],'password':_0x18505c[_0xdfdb('0xae')],'grant_type':_0xdfdb('0xae'),'client_secret':_0x18505c[_0xdfdb('0xa5')]},'json':!![]};return rp(_0x2cbe58);}})['then'](function(_0x2a3e79){_0x37de3d=_0x2a3e79[_0xdfdb('0xaf')];var _0x457257={'method':'GET','uri':encodeURI(_0x5d3923+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x394536+'\x27'),'headers':{'Authorization':_0xdfdb('0xb0')+_0x37de3d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x457257);})['then'](function(_0x276efc){var _0x27c72c=_0x276efc['value'][0x0];var _0x4bdb41=_0x27c72c[_0xdfdb('0xb1')];var _0x2f8d34={'method':_0xdfdb('0xb2'),'uri':_0x5d3923+_0xdfdb('0xb3')+_0x4bdb41+_0xdfdb('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x37de3d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f8d34);})[_0xdfdb('0x1e')](function(_0x576570){_0xcda070=_0x576570;_0x1d69fb=_0xcda070[_0xdfdb('0xb5')];_0x1d69fb=_[_0xdfdb('0xb6')](_0x1d69fb,function(_0x3c9465){return!_0x114373['includes'](_0x3c9465[_0xdfdb('0xb7')]);});var _0x38a439=[];var _0x3e0208=[];_0x1d69fb[_0xdfdb('0xb8')](function(_0x4c08d0){if(_0x4c08d0[_0xdfdb('0xb9')]){var _0xd00056=_0x4c08d0[_0xdfdb('0xb9')][_0xdfdb('0xba')](_0x4c08d0['@odata.type'][_0xdfdb('0xa8')]('.')+0x1);if(_0xd00056==='PicklistAttributeMetadata'){_0x38a439['push'](getSelectList(_0x5d3923,_0x1c7964,_0x3e0208,_0xcda070['MetadataId'],_0x4c08d0['MetadataId'],_0x37de3d));}}});return Promise['all'](_0x38a439);})[_0xdfdb('0x1e')](function(_0xe8ac6c){_0x2269e3=_0xe8ac6c[0x0];var _0x266246=[];var _0x17445a=[];_0x1d69fb[_0xdfdb('0xb8')](function(_0x1d5eca){if(!_[_0xdfdb('0xbb')](_0x1d5eca[_0xdfdb('0xb9')])){var _0x5cf997=_0x1d5eca[_0xdfdb('0xb9')][_0xdfdb('0xba')](_0x1d5eca[_0xdfdb('0xb9')][_0xdfdb('0xa8')]('.')+0x1);if(_0x5cf997==='BooleanAttributeMetadata'){_0x266246[_0xdfdb('0xbc')](getBooleanList(_0x5d3923,_0x1c7964,_0x17445a,_0xcda070[_0xdfdb('0xb1')],_0x1d5eca['MetadataId'],_0x37de3d));}}});return Promise[_0xdfdb('0xbd')](_0x266246);})[_0xdfdb('0x1e')](function(_0x330515){_0x5b6e35=_0x330515[0x0];var _0x31eed0=[];var _0x4c8f21=[];_0x1d69fb[_0xdfdb('0xb8')](function(_0x99ac1c){if(_0x99ac1c[_0xdfdb('0xb9')]){var _0x1028c3=_0x99ac1c[_0xdfdb('0xb9')]['substring'](_0x99ac1c['@odata.type'][_0xdfdb('0xa8')]('.')+0x1);if(_0x1028c3===_0xdfdb('0xbe')||_0x1028c3==='DoubleAttributeMetadata'||_0x1028c3===_0xdfdb('0xbf')||_0x1028c3==='IntegerAttributeMetadata'||_0x1028c3===_0xdfdb('0xc0')||_0x1028c3===_0xdfdb('0xc1')||_0x1028c3===_0xdfdb('0xc2')||_0x1028c3===_0xdfdb('0xc3')||_0x1028c3===_0xdfdb('0xc4')||_0x1028c3==='DecimalAttributeMetadata'){_0x31eed0[_0xdfdb('0xbc')](getInputList(_0x5d3923,_0x1c7964,_0x1028c3,_0x4c8f21,_0xcda070[_0xdfdb('0xb1')],_0x99ac1c[_0xdfdb('0xb1')],_0x37de3d));}}});return Promise[_0xdfdb('0xbd')](_0x31eed0);})[_0xdfdb('0x1e')](function(_0x3cff64){_0x1c90e9=_0x3cff64[0x0];var _0x26d6d8=_0x2269e3[_0xdfdb('0xa1')](_0x5b6e35)[_0xdfdb('0xa1')](_0x1c90e9);var _0x41e162={'count':_0x26d6d8[_0xdfdb('0x45')],'rows':_0x26d6d8};return _0x41e162;})[_0xdfdb('0x1e')](respondWithResult(_0x9f2170,null))[_0xdfdb('0x28')](function(_0x4e612a){var _0x3e98f9=_0x4c4d3a[_0xdfdb('0x3f')]['test']?0x1f4:_0x4e612a['statusCode']||0x1f4;logger[_0xdfdb('0x24')](_0x4e612a[_0xdfdb('0x35')]);delete _0x4e612a[_0xdfdb('0x36')];if(_0x3e98f9===0x191){_0x3e98f9=0x190;}_0x9f2170['status'](_0x3e98f9)[_0xdfdb('0x37')](_0x4c4d3a[_0xdfdb('0x3f')]['test']?{'message':_0xdfdb('0xc5'),'statusCode':_0x4e612a[_0xdfdb('0xc6')]}:_0x4e612a);});};function getSelectList(_0x582875,_0x55281f,_0x18645f,_0x361838,_0x149084,_0x1bd0d0){var _0x15627d={'method':_0xdfdb('0xb2'),'uri':_0x582875+_0xdfdb('0xb3')+_0x361838+')/Attributes('+_0x149084+_0xdfdb('0xc7')+_0xdfdb('0xc8'),'headers':{'Authorization':_0xdfdb('0xb0')+_0x1bd0d0,'If-None-Match':null,'OData-Version':_0xdfdb('0xc9')},'json':!![]};return rp(_0x15627d)['then'](function(_0x4e02ec){var _0x32b9e5=[];var _0x2b8e5e=_0x4e02ec[_0xdfdb('0xca')][_0xdfdb('0xcb')];_0x2b8e5e[_0xdfdb('0xb8')](function(_0xb9e711){_0x32b9e5[_0xdfdb('0xbc')]({'name':_0xb9e711['Label'][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'value':String(_0xb9e711[_0xdfdb('0xce')])});});var _0x4a7bf3={'id':_0x55281f+'_'+_0x4e02ec[_0xdfdb('0xb7')],'name':_0x4e02ec[_0xdfdb('0xcf')][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'custom':![],'options':_0x32b9e5};_0x18645f[_0xdfdb('0xbc')](_0x4a7bf3);return _0x18645f;});}function getBooleanList(_0x3267d1,_0xe05520,_0x5bd682,_0x5ea5c6,_0x270d69,_0x25ee4f){var _0x5eaba9={'method':'GET','uri':_0x3267d1+_0xdfdb('0xb3')+_0x5ea5c6+_0xdfdb('0xd0')+_0x270d69+_0xdfdb('0xd1'),'headers':{'Authorization':_0xdfdb('0xb0')+_0x25ee4f,'If-None-Match':null,'OData-Version':_0xdfdb('0xc9')},'json':!![]};return rp(_0x5eaba9)['then'](function(_0x144d59){var _0x34d985=[];_0x34d985[_0xdfdb('0xbc')]({'name':_0x144d59['OptionSet'][_0xdfdb('0xd2')][_0xdfdb('0xcd')][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'value':'true'},{'name':_0x144d59['OptionSet']['FalseOption']['Label'][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'value':_0xdfdb('0xd3')});var _0x31bc32={'id':_0xe05520+'_'+_0x144d59[_0xdfdb('0xb7')],'name':_0x144d59[_0xdfdb('0xcf')][_0xdfdb('0xcc')][_0xdfdb('0xcd')],'custom':![],'options':_0x34d985};_0x5bd682['push'](_0x31bc32);return _0x5bd682;});}function getInputList(_0x1a0be4,_0x321533,_0x1825f0,_0x1fbd45,_0x17d1b0,_0x6ffd30,_0x51ba54){var _0x5afc3f={'method':_0xdfdb('0xb2'),'uri':_0x1a0be4+_0xdfdb('0xb3')+_0x17d1b0+')/Attributes('+_0x6ffd30+_0xdfdb('0xd4')+_0x1825f0+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x51ba54,'If-None-Match':null,'OData-Version':_0xdfdb('0xc9')},'json':!![]};return rp(_0x5afc3f)[_0xdfdb('0x1e')](function(_0x4cb5d5){var _0x805066={'id':_0x321533+'_'+_0x4cb5d5['LogicalName'],'name':_0x4cb5d5[_0xdfdb('0xcf')]['UserLocalizedLabel']?_0x4cb5d5['DisplayName']['UserLocalizedLabel'][_0xdfdb('0xcd')]:_0x4cb5d5['LogicalName'],'custom':![],'options':[]};_0x1fbd45[_0xdfdb('0xbc')](_0x805066);return _0x1fbd45;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 73afac7..a02de82 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 _0x5856=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x5856,0x13a));var _0x6585=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0x5856[_0x1c208e];return _0x5104ff;};'use strict';var _=require('lodash');var util=require(_0x6585('0x0'));var logger=require(_0x6585('0x1'))(_0x6585('0x2'));var moment=require(_0x6585('0x3'));var BPromise=require(_0x6585('0x4'));var rp=require(_0x6585('0x5'));var fs=require('fs');var path=require(_0x6585('0x6'));var rimraf=require(_0x6585('0x7'));var config=require(_0x6585('0x8'));var attributes=require(_0x6585('0x9'));var integrations=require(_0x6585('0xa'));module[_0x6585('0xb')]=function(_0x3d850e,_0x59ed0f){return _0x3d850e[_0x6585('0xc')](_0x6585('0xd'),attributes,{'tableName':_0x6585('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b3c=['rimraf','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5be32a,_0xa32143){var _0x21e1bb=function(_0xbde840){while(--_0xbde840){_0x5be32a['push'](_0x5be32a['shift']());}};_0x21e1bb(++_0xa32143);}(_0x4b3c,0x9b));var _0xc4b3=function(_0x24b00f,_0x5cb40c){_0x24b00f=_0x24b00f-0x0;var _0x2d816d=_0x4b3c[_0x24b00f];return _0x2d816d;};'use strict';var _=require(_0xc4b3('0x0'));var util=require('util');var logger=require(_0xc4b3('0x1'))(_0xc4b3('0x2'));var moment=require(_0xc4b3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4b3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4b3('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xc4b3('0x6'));module[_0xc4b3('0x7')]=function(_0x840e2c,_0x5beecd){return _0x840e2c[_0xc4b3('0x8')](_0xc4b3('0x9'),attributes,{'tableName':'int_dynamics365_accounts','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 2fc0474..582f387 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 _0x3641=['where','attributes','include','map','model','find','raw','ShowDynamics365Account','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options'];(function(_0x5beaac,_0x2403e4){var _0x97371e=function(_0x4858f4){while(--_0x4858f4){_0x5beaac['push'](_0x5beaac['shift']());}};_0x97371e(++_0x2403e4);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1364('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1364('0x1'));var fs=require('fs');var Redis=require(_0x1364('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1364('0x3'));var logger=require(_0x1364('0x4'))(_0x1364('0x5'));var config=require('../../config/environment');var jayson=require(_0x1364('0x6'));var client=jayson['client'][_0x1364('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x278f40,_0x344ee7,_0x5ef8ba){return new BPromise(function(_0xb5d644,_0x153620){return client[_0x1364('0x8')](_0x278f40,_0x5ef8ba)[_0x1364('0x9')](function(_0x72d53a){logger[_0x1364('0xa')](_0x1364('0xb'),_0x344ee7,_0x1364('0xc'));logger[_0x1364('0xd')](_0x1364('0xe'),_0x344ee7,_0x1364('0xc'),JSON[_0x1364('0xf')](_0x72d53a));if(_0x72d53a['error']){if(_0x72d53a['error'][_0x1364('0x10')]===0x1f4){logger[_0x1364('0x11')](_0x1364('0xb'),_0x344ee7,_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);return _0x153620(_0x72d53a['error'][_0x1364('0x12')]);}logger[_0x1364('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x344ee7,_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);return _0xb5d644(_0x72d53a[_0x1364('0x11')][_0x1364('0x12')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x344ee7,_0x1364('0xc'));_0xb5d644(_0x72d53a[_0x1364('0x13')][_0x1364('0x12')]);}})[_0x1364('0x14')](function(_0x265be7){logger[_0x1364('0x11')](_0x1364('0xb'),_0x344ee7,_0x265be7);_0x153620(_0x265be7);});});}exports[_0x1364('0x15')]=function(_0x4e7b68){var _0x5f0f59=this;return new Promise(function(_0x9423d5,_0x5cf4cd){return db[_0x1364('0x16')][_0x1364('0x17')]({'raw':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')][_0x1364('0x19')]||null:null,'attributes':_0x4e7b68['options']?_0x4e7b68[_0x1364('0x18')][_0x1364('0x1a')]||null:null,'limit':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')]['limit']||null:null,'include':_0x4e7b68[_0x1364('0x18')]?_0x4e7b68[_0x1364('0x18')][_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x4e7b68[_0x1364('0x18')][_0x1364('0x1b')],function(_0x8bc79d){return{'model':db[_0x8bc79d[_0x1364('0x1d')]],'as':_0x8bc79d['as'],'attributes':_0x8bc79d[_0x1364('0x1a')],'include':_0x8bc79d[_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x8bc79d[_0x1364('0x1b')],function(_0x35f0e3){return{'model':db[_0x35f0e3[_0x1364('0x1d')]],'as':_0x35f0e3['as'],'attributes':_0x35f0e3[_0x1364('0x1a')],'include':_0x35f0e3[_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x35f0e3['include'],function(_0x117777){return{'model':db[_0x117777[_0x1364('0x1d')]],'as':_0x117777['as'],'attributes':_0x117777[_0x1364('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ae44c){logger[_0x1364('0xa')]('GetDynamics365Account',_0x4e7b68);logger[_0x1364('0xd')](_0x1364('0x15'),_0x4e7b68,JSON[_0x1364('0xf')](_0x5ae44c));_0x9423d5(_0x5ae44c);})[_0x1364('0x14')](function(_0x4f4438){logger[_0x1364('0x11')](_0x1364('0x15'),_0x4f4438[_0x1364('0x12')],_0x4e7b68);_0x5cf4cd(_0x5f0f59['error'](0x1f4,_0x4f4438[_0x1364('0x12')]));});});};exports['ShowDynamics365Account']=function(_0xf6fabe){var _0x32a611=this;return new Promise(function(_0x5a49a5,_0x4de9ea){return db[_0x1364('0x16')][_0x1364('0x1e')]({'raw':_0xf6fabe['options']?_0xf6fabe[_0x1364('0x18')][_0x1364('0x1f')]===undefined?!![]:![]:!![],'where':_0xf6fabe[_0x1364('0x18')]?_0xf6fabe[_0x1364('0x18')][_0x1364('0x19')]||null:null,'attributes':_0xf6fabe['options']?_0xf6fabe[_0x1364('0x18')][_0x1364('0x1a')]||null:null,'include':_0xf6fabe['options']?_0xf6fabe[_0x1364('0x18')][_0x1364('0x1b')]?_[_0x1364('0x1c')](_0xf6fabe[_0x1364('0x18')]['include'],function(_0x566954){return{'model':db[_0x566954[_0x1364('0x1d')]],'as':_0x566954['as'],'attributes':_0x566954[_0x1364('0x1a')],'include':_0x566954[_0x1364('0x1b')]?_[_0x1364('0x1c')](_0x566954[_0x1364('0x1b')],function(_0x53b347){return{'model':db[_0x53b347['model']],'as':_0x53b347['as'],'attributes':_0x53b347[_0x1364('0x1a')],'include':_0x53b347['include']?_[_0x1364('0x1c')](_0x53b347[_0x1364('0x1b')],function(_0x52cd96){return{'model':db[_0x52cd96[_0x1364('0x1d')]],'as':_0x52cd96['as'],'attributes':_0x52cd96[_0x1364('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1364('0x9')](function(_0x4e655b){logger[_0x1364('0xa')]('ShowDynamics365Account',_0xf6fabe);logger[_0x1364('0xd')](_0x1364('0x20'),_0xf6fabe,JSON[_0x1364('0xf')](_0x4e655b));_0x5a49a5(_0x4e655b);})['catch'](function(_0x5a96d7){logger[_0x1364('0x11')](_0x1364('0x20'),_0x5a96d7[_0x1364('0x12')],_0xf6fabe);_0x4de9ea(_0x32a611[_0x1364('0x11')](0x1f4,_0x5a96d7['message']));});});}; \ No newline at end of file +var _0xdded=['error','code','message','info','GetDynamics365Account','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x32fb31,_0x56f8c8){var _0x489262=function(_0x3dadf1){while(--_0x3dadf1){_0x32fb31['push'](_0x32fb31['shift']());}};_0x489262(++_0x56f8c8);}(_0xdded,0x17a));var _0xddde=function(_0x5ced85,_0x31f067){_0x5ced85=_0x5ced85-0x0;var _0x20fde0=_0xdded[_0x5ced85];return _0x20fde0;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var moment=require(_0xddde('0x2'));var BPromise=require(_0xddde('0x3'));var rs=require(_0xddde('0x4'));var fs=require('fs');var Redis=require(_0xddde('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xddde('0x6'));var logger=require(_0xddde('0x7'))(_0xddde('0x8'));var config=require(_0xddde('0x9'));var jayson=require(_0xddde('0xa'));var client=jayson[_0xddde('0xb')][_0xddde('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cea18,_0x516eb5,_0x18d8b8){return new BPromise(function(_0x3a5e8a,_0x5f1a34){return client[_0xddde('0xd')](_0x3cea18,_0x18d8b8)['then'](function(_0x48dd55){logger['info'](_0xddde('0xe'),_0x516eb5,'request\x20sent');logger[_0xddde('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x516eb5,_0xddde('0x10'),JSON[_0xddde('0x11')](_0x48dd55));if(_0x48dd55[_0xddde('0x12')]){if(_0x48dd55[_0xddde('0x12')][_0xddde('0x13')]===0x1f4){logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x48dd55[_0xddde('0x12')]['message']);return _0x5f1a34(_0x48dd55[_0xddde('0x12')][_0xddde('0x14')]);}logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x48dd55[_0xddde('0x12')][_0xddde('0x14')]);return _0x3a5e8a(_0x48dd55['error'][_0xddde('0x14')]);}else{logger[_0xddde('0x15')](_0xddde('0xe'),_0x516eb5,'request\x20sent');_0x3a5e8a(_0x48dd55['result'][_0xddde('0x14')]);}})['catch'](function(_0x30a9da){logger[_0xddde('0x12')](_0xddde('0xe'),_0x516eb5,_0x30a9da);_0x5f1a34(_0x30a9da);});});}exports[_0xddde('0x16')]=function(_0x2f0e58){var _0x55349b=this;return new Promise(function(_0x249f19,_0x129e3e){return db['Dynamics365Account'][_0xddde('0x17')]({'raw':_0x2f0e58[_0xddde('0x18')]?_0x2f0e58['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f0e58[_0xddde('0x18')]?_0x2f0e58['options'][_0xddde('0x19')]||null:null,'attributes':_0x2f0e58['options']?_0x2f0e58[_0xddde('0x18')][_0xddde('0x1a')]||null:null,'limit':_0x2f0e58['options']?_0x2f0e58['options'][_0xddde('0x1b')]||null:null,'include':_0x2f0e58[_0xddde('0x18')]?_0x2f0e58[_0xddde('0x18')][_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x2f0e58[_0xddde('0x18')][_0xddde('0x1c')],function(_0x56a33a){return{'model':db[_0x56a33a['model']],'as':_0x56a33a['as'],'attributes':_0x56a33a[_0xddde('0x1a')],'include':_0x56a33a[_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x56a33a[_0xddde('0x1c')],function(_0xdb57ef){return{'model':db[_0xdb57ef['model']],'as':_0xdb57ef['as'],'attributes':_0xdb57ef[_0xddde('0x1a')],'include':_0xdb57ef[_0xddde('0x1c')]?_['map'](_0xdb57ef['include'],function(_0xa60e85){return{'model':db[_0xa60e85[_0xddde('0x1e')]],'as':_0xa60e85['as'],'attributes':_0xa60e85['attributes']};}):[]};}):[]};}):[]:[]})[_0xddde('0x1f')](function(_0x45941e){logger['info'](_0xddde('0x16'),_0x2f0e58);logger[_0xddde('0xf')](_0xddde('0x16'),_0x2f0e58,JSON[_0xddde('0x11')](_0x45941e));_0x249f19(_0x45941e);})[_0xddde('0x20')](function(_0xb5d4b6){logger[_0xddde('0x12')](_0xddde('0x16'),_0xb5d4b6[_0xddde('0x14')],_0x2f0e58);_0x129e3e(_0x55349b[_0xddde('0x12')](0x1f4,_0xb5d4b6[_0xddde('0x14')]));});});};exports[_0xddde('0x21')]=function(_0xe3d006){var _0x718921=this;return new Promise(function(_0x5e04d6,_0x380acb){return db[_0xddde('0x22')][_0xddde('0x23')]({'raw':_0xe3d006[_0xddde('0x18')]?_0xe3d006[_0xddde('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xe3d006['options']?_0xe3d006[_0xddde('0x18')][_0xddde('0x19')]||null:null,'attributes':_0xe3d006[_0xddde('0x18')]?_0xe3d006['options']['attributes']||null:null,'include':_0xe3d006[_0xddde('0x18')]?_0xe3d006[_0xddde('0x18')][_0xddde('0x1c')]?_[_0xddde('0x1d')](_0xe3d006['options'][_0xddde('0x1c')],function(_0x5d64cb){return{'model':db[_0x5d64cb[_0xddde('0x1e')]],'as':_0x5d64cb['as'],'attributes':_0x5d64cb[_0xddde('0x1a')],'include':_0x5d64cb[_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x5d64cb[_0xddde('0x1c')],function(_0x2b2661){return{'model':db[_0x2b2661[_0xddde('0x1e')]],'as':_0x2b2661['as'],'attributes':_0x2b2661[_0xddde('0x1a')],'include':_0x2b2661[_0xddde('0x1c')]?_[_0xddde('0x1d')](_0x2b2661[_0xddde('0x1c')],function(_0x872116){return{'model':db[_0x872116['model']],'as':_0x872116['as'],'attributes':_0x872116[_0xddde('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xddde('0x1f')](function(_0x4c68ab){logger['info']('ShowDynamics365Account',_0xe3d006);logger[_0xddde('0xf')](_0xddde('0x21'),_0xe3d006,JSON[_0xddde('0x11')](_0x4c68ab));_0x5e04d6(_0x4c68ab);})[_0xddde('0x20')](function(_0x2825c6){logger[_0xddde('0x12')](_0xddde('0x21'),_0x2825c6['message'],_0xe3d006);_0x380acb(_0x718921['error'](0x1f4,_0x2825c6[_0xddde('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 96dd299..f32162e 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 _0x1727=['update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','getFields','get','/:id/subjects','getSubjects','getDescriptions','create','put','/:id'];(function(_0x561c69,_0x277e52){var _0x10351a=function(_0x2e5458){while(--_0x2e5458){_0x561c69['push'](_0x561c69['shift']());}};_0x10351a(++_0x277e52);}(_0x1727,0x17d));var _0x7172=function(_0x574b8a,_0x4ee093){_0x574b8a=_0x574b8a-0x0;var _0x47396b=_0x1727[_0x574b8a];return _0x47396b;};'use strict';var multer=require(_0x7172('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7172('0x1'));var express=require(_0x7172('0x2'));var router=express[_0x7172('0x3')]();var auth=require(_0x7172('0x4'));var interaction=require(_0x7172('0x5'));var config=require(_0x7172('0x6'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x7172('0x7')](),controller[_0x7172('0x8')]);router['get']('/:id',auth[_0x7172('0x7')](),controller[_0x7172('0x9')]);router['get']('/:id/fields',auth[_0x7172('0x7')](),controller[_0x7172('0xa')]);router[_0x7172('0xb')](_0x7172('0xc'),auth[_0x7172('0x7')](),controller[_0x7172('0xd')]);router[_0x7172('0xb')]('/:id/descriptions',auth[_0x7172('0x7')](),controller[_0x7172('0xe')]);router['post']('/',auth[_0x7172('0x7')](),controller[_0x7172('0xf')]);router[_0x7172('0x10')](_0x7172('0x11'),auth['isAuthenticated'](),controller[_0x7172('0x12')]);router['delete'](_0x7172('0x11'),auth['isAuthenticated'](),controller[_0x7172('0x13')]);module[_0x7172('0x14')]=router; \ No newline at end of file +var _0x042e=['create','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x499f5a,_0x29fa70){var _0xc40a38=function(_0x443c62){while(--_0x443c62){_0x499f5a['push'](_0x499f5a['shift']());}};_0xc40a38(++_0x29fa70);}(_0x042e,0xf8));var _0xe042=function(_0x4c866d,_0x404b6b){_0x4c866d=_0x4c866d-0x0;var _0x214982=_0x042e[_0x4c866d];return _0x214982;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe042('0x0'));var timeout=require('connect-timeout');var express=require(_0xe042('0x1'));var router=express[_0xe042('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe042('0x3'));var config=require('../../config/environment');var controller=require(_0xe042('0x4'));router[_0xe042('0x5')]('/',auth[_0xe042('0x6')](),controller[_0xe042('0x7')]);router['get'](_0xe042('0x8'),auth[_0xe042('0x6')](),controller[_0xe042('0x9')]);router[_0xe042('0x5')](_0xe042('0xa'),auth[_0xe042('0x6')](),controller[_0xe042('0xb')]);router[_0xe042('0x5')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xe042('0xc')]);router['get'](_0xe042('0xd'),auth[_0xe042('0x6')](),controller[_0xe042('0xe')]);router[_0xe042('0xf')]('/',auth[_0xe042('0x6')](),controller[_0xe042('0x10')]);router[_0xe042('0x11')]('/:id',auth[_0xe042('0x6')](),controller[_0xe042('0x12')]);router[_0xe042('0x13')]('/:id',auth[_0xe042('0x6')](),controller[_0xe042('0x14')]);module[_0xe042('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2f0b39d..723be9e 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 _0xebf6=['phonecall','sequelize','incident'];(function(_0x3b48e1,_0x3f6577){var _0x3080bc=function(_0x5ac696){while(--_0x5ac696){_0x3b48e1['push'](_0x3b48e1['shift']());}};_0x3080bc(++_0x3f6577);}(_0xebf6,0x184));var _0x6ebf=function(_0x2c11ec,_0x774faf){_0x2c11ec=_0x2c11ec-0x0;var _0x40a567=_0xebf6[_0x2c11ec];return _0x40a567;};'use strict';var Sequelize=require(_0x6ebf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x6ebf('0x1'),_0x6ebf('0x2')),'defaultValue':_0x6ebf('0x1')}}; \ No newline at end of file +var _0x9e34=['exports','STRING','ENUM','phonecall','sequelize'];(function(_0x2f0831,_0x198815){var _0x4388fe=function(_0x12671c){while(--_0x12671c){_0x2f0831['push'](_0x2f0831['shift']());}};_0x4388fe(++_0x198815);}(_0x9e34,0x12b));var _0x49e3=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9e34[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x49e3('0x0'));module[_0x49e3('0x1')]={'name':{'type':Sequelize[_0x49e3('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x49e3('0x3')]('incident',_0x49e3('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1ccf84f..963a523 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 _0x475d=['findOne','nolimit','getSubjects','getDescriptions','Dynamics365Field','html-pdf','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','create','body','find','getFields'];(function(_0x1ba08a,_0x1af78b){var _0x5c6ead=function(_0x5a2c8c){while(--_0x5a2c8c){_0x1ba08a['push'](_0x1ba08a['shift']());}};_0x5c6ead(++_0x1af78b);}(_0x475d,0x110));var _0xd475=function(_0x4973ff,_0x30abe4){_0x4973ff=_0x4973ff-0x0;var _0x4dd6b6=_0x475d[_0x4973ff];return _0x4dd6b6;};'use strict';var pdf=require(_0xd475('0x0'));var emlformat=require(_0xd475('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd475('0x2'));var moment=require('moment');var BPromise=require(_0xd475('0x3'));var Mustache=require(_0xd475('0x4'));var util=require('util');var path=require(_0xd475('0x5'));var sox=require(_0xd475('0x6'));var csv=require(_0xd475('0x7'));var ejs=require(_0xd475('0x8'));var fs=require('fs');var _=require(_0xd475('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd475('0xa'));var deskjs=require(_0xd475('0xb'));var toCsv=require(_0xd475('0x7'));var querystring=require(_0xd475('0xc'));var Papa=require(_0xd475('0xd'));var Redis=require(_0xd475('0xe'));var authService=require(_0xd475('0xf'));var qs=require(_0xd475('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd475('0x11'))(_0xd475('0x12'));var utils=require(_0xd475('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd475('0x14'));var db=require(_0xd475('0x15'))['db'];var jayson=require(_0xd475('0x16'));var client=jayson[_0xd475('0x17')][_0xd475('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3721c3,_0x271ad2,_0x248f95,_0xff2b34){return new BPromise(function(_0x2ccd76,_0x55a137){var _0x43a1f8=_0xff2b34||client;return _0x43a1f8[_0xd475('0x19')](_0x3721c3,_0x248f95)['then'](function(_0x20d980){logger[_0xd475('0x1a')](_0xd475('0x1b'),_0x271ad2,_0xd475('0x1c'));logger['debug'](_0xd475('0x1d'),_0x271ad2,_0xd475('0x1c'),JSON['stringify'](_0x20d980));if(_0x20d980[_0xd475('0x1e')]){if(_0x20d980[_0xd475('0x1e')][_0xd475('0x1f')]===0x1f4){logger[_0xd475('0x1e')](_0xd475('0x1b'),_0x271ad2,_0x20d980['error']['message']);return _0x55a137(_0x20d980[_0xd475('0x1e')][_0xd475('0x20')]);}logger[_0xd475('0x1e')](_0xd475('0x1b'),_0x271ad2,_0x20d980[_0xd475('0x1e')][_0xd475('0x20')]);return _0x2ccd76(_0x20d980[_0xd475('0x1e')][_0xd475('0x20')]);}else{logger[_0xd475('0x1a')](_0xd475('0x1b'),_0x271ad2,_0xd475('0x1c'));_0x2ccd76(_0x20d980[_0xd475('0x21')]['message']);}})[_0xd475('0x22')](function(_0xf61e99){logger[_0xd475('0x1e')](_0xd475('0x1b'),_0x271ad2,_0xf61e99);_0x55a137(_0xf61e99);});});}function respondWithStatusCode(_0x3d30c6,_0x5dac8e){_0x5dac8e=_0x5dac8e||0xcc;return function(_0x65f253){if(_0x65f253){return _0x3d30c6[_0xd475('0x23')](_0x5dac8e);}return _0x3d30c6[_0xd475('0x24')](_0x5dac8e)[_0xd475('0x25')]();};}function respondWithResult(_0x46ef18,_0xf8704c){_0xf8704c=_0xf8704c||0xc8;return function(_0xabe678){if(_0xabe678){return _0x46ef18[_0xd475('0x24')](_0xf8704c)['json'](_0xabe678);}};}function respondWithFilteredResult(_0x2c1e02,_0x2a586e){return function(_0x559a2a){if(_0x559a2a){var _0x492320=_0x559a2a['count'],_0x1dc9af=_0x2a586e[_0xd475('0x26')],_0x3df461=_0x2a586e[_0xd475('0x26')]+_0x2a586e[_0xd475('0x27')],_0x33840c;if(_0x3df461>=_0x492320){_0x3df461=_0x492320;_0x33840c=0xc8;}else{_0x33840c=0xce;}_0x2c1e02[_0xd475('0x24')](_0x33840c);return _0x2c1e02[_0xd475('0x28')]('Content-Range',_0x1dc9af+'-'+_0x3df461+'/'+_0x492320)['json'](_0x559a2a);}return null;};}function patchUpdates(_0x452eab){return function(_0x1bd858){try{jsonpatch[_0xd475('0x29')](_0x1bd858,_0x452eab,!![]);}catch(_0x148b16){return BPromise[_0xd475('0x2a')](_0x148b16);}return _0x1bd858[_0xd475('0x2b')]();};}function saveUpdates(_0x1d1eda,_0x3f8867){return function(_0x45943f){if(_0x45943f){return _0x45943f[_0xd475('0x2c')](_0x1d1eda)['then'](function(_0x4e3e61){return _0x4e3e61;});}return null;};}function removeEntity(_0x21d941,_0x46682b){return function(_0x2d3610){if(_0x2d3610){return _0x2d3610[_0xd475('0x2d')]()[_0xd475('0x2e')](function(){_0x21d941[_0xd475('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52a27c,_0x38bcde){return function(_0x40b533){if(!_0x40b533){_0x52a27c[_0xd475('0x23')](0x194);}return _0x40b533;};}function handleError(_0xbaed8,_0x1eb739){_0x1eb739=_0x1eb739||0x1f4;return function(_0x1047df){logger['error'](_0x1047df[_0xd475('0x2f')]);if(_0x1047df['name']){delete _0x1047df[_0xd475('0x30')];}_0xbaed8[_0xd475('0x24')](_0x1eb739)[_0xd475('0x31')](_0x1047df);};}exports[_0xd475('0x32')]=function(_0x1cc186,_0x3bdd5f){var _0x5febe5={},_0x34f8c4={},_0xb7036b={'count':0x0,'rows':[]};var _0x234be9=_[_0xd475('0x33')](db[_0xd475('0x34')][_0xd475('0x35')],function(_0x612fa5){return{'name':_0x612fa5['fieldName'],'type':_0x612fa5[_0xd475('0x36')][_0xd475('0x37')]};});_0x34f8c4[_0xd475('0x38')]=_['map'](_0x234be9,'name');_0x34f8c4['query']=_[_0xd475('0x39')](_0x1cc186[_0xd475('0x3a')]);_0x34f8c4[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x34f8c4[_0xd475('0x38')],_0x34f8c4[_0xd475('0x3a')]);_0x5febe5[_0xd475('0x3d')]=_[_0xd475('0x3c')](_0x34f8c4[_0xd475('0x38')],qs['fields'](_0x1cc186[_0xd475('0x3a')][_0xd475('0x3e')]));_0x5febe5[_0xd475('0x3d')]=_0x5febe5[_0xd475('0x3d')][_0xd475('0x3f')]?_0x5febe5[_0xd475('0x3d')]:_0x34f8c4['model'];if(!_0x1cc186[_0xd475('0x3a')][_0xd475('0x40')]('nolimit')){_0x5febe5[_0xd475('0x27')]=qs[_0xd475('0x27')](_0x1cc186[_0xd475('0x3a')][_0xd475('0x27')]);_0x5febe5['offset']=qs['offset'](_0x1cc186[_0xd475('0x3a')][_0xd475('0x26')]);}_0x5febe5[_0xd475('0x41')]=qs[_0xd475('0x42')](_0x1cc186[_0xd475('0x3a')][_0xd475('0x42')]);_0x5febe5[_0xd475('0x43')]=qs['filters'](_[_0xd475('0x44')](_0x1cc186[_0xd475('0x3a')],_0x34f8c4[_0xd475('0x3b')]),_0x234be9);if(_0x1cc186['query'][_0xd475('0x45')]){_0x5febe5['where']=_[_0xd475('0x46')](_0x5febe5[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x234be9,function(_0x32d72a){if(_0x32d72a[_0xd475('0x36')]!==_0xd475('0x47')){var _0x212496={};_0x212496[_0x32d72a['name']]={'$like':'%'+_0x1cc186[_0xd475('0x3a')]['filter']+'%'};return _0x212496;}})});}_0x5febe5=_[_0xd475('0x46')]({},_0x5febe5,_0x1cc186[_0xd475('0x48')]);var _0x53b89f={'where':_0x5febe5[_0xd475('0x43')]};return db['Dynamics365Configuration'][_0xd475('0x49')](_0x53b89f)[_0xd475('0x2e')](function(_0x4e1aa5){_0xb7036b[_0xd475('0x49')]=_0x4e1aa5;if(_0x1cc186['query'][_0xd475('0x4a')]){_0x5febe5[_0xd475('0x4b')]=[{'all':!![]}];}return db[_0xd475('0x34')][_0xd475('0x4c')](_0x5febe5);})['then'](function(_0x24858f){_0xb7036b[_0xd475('0x4d')]=_0x24858f;return _0xb7036b;})[_0xd475('0x2e')](respondWithFilteredResult(_0x3bdd5f,_0x5febe5))[_0xd475('0x22')](handleError(_0x3bdd5f,null));};exports[_0xd475('0x4e')]=function(_0x4614f5,_0x26c7e8){var _0x37f3f4={'raw':![],'where':{'id':_0x4614f5[_0xd475('0x4f')]['id']}},_0x3f1d86={};_0x3f1d86[_0xd475('0x38')]=_[_0xd475('0x39')](db[_0xd475('0x34')]['rawAttributes']);_0x3f1d86[_0xd475('0x3a')]=_[_0xd475('0x39')](_0x4614f5[_0xd475('0x3a')]);_0x3f1d86['filters']=_['intersection'](_0x3f1d86[_0xd475('0x38')],_0x3f1d86[_0xd475('0x3a')]);_0x37f3f4[_0xd475('0x3d')]=_['intersection'](_0x3f1d86['model'],qs[_0xd475('0x3e')](_0x4614f5[_0xd475('0x3a')][_0xd475('0x3e')]));_0x37f3f4['attributes']=_0x37f3f4[_0xd475('0x3d')][_0xd475('0x3f')]?_0x37f3f4[_0xd475('0x3d')]:_0x3f1d86[_0xd475('0x38')];if(_0x4614f5[_0xd475('0x3a')][_0xd475('0x4a')]){_0x37f3f4[_0xd475('0x4b')]=[{'all':!![]}];}_0x37f3f4=_[_0xd475('0x46')]({},_0x37f3f4,_0x4614f5['options']);return db[_0xd475('0x34')]['find'](_0x37f3f4)[_0xd475('0x2e')](handleEntityNotFound(_0x26c7e8,null))['then'](respondWithResult(_0x26c7e8,null))['catch'](handleError(_0x26c7e8,null));};exports['create']=function(_0x3d5bd5,_0x6989f9){return db[_0xd475('0x34')][_0xd475('0x50')](_0x3d5bd5[_0xd475('0x51')],{})[_0xd475('0x2e')](respondWithResult(_0x6989f9,0xc9))['catch'](handleError(_0x6989f9,null));};exports[_0xd475('0x2c')]=function(_0x1c8071,_0x4a95db){if(_0x1c8071['body']['id']){delete _0x1c8071[_0xd475('0x51')]['id'];}return db[_0xd475('0x34')][_0xd475('0x52')]({'where':{'id':_0x1c8071[_0xd475('0x4f')]['id']}})[_0xd475('0x2e')](handleEntityNotFound(_0x4a95db,null))[_0xd475('0x2e')](saveUpdates(_0x1c8071['body'],null))['then'](respondWithResult(_0x4a95db,null))[_0xd475('0x22')](handleError(_0x4a95db,null));};exports[_0xd475('0x2d')]=function(_0x511014,_0x5d403f){return db[_0xd475('0x34')]['find']({'where':{'id':_0x511014[_0xd475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d403f,null))[_0xd475('0x2e')](removeEntity(_0x5d403f,null))[_0xd475('0x22')](handleError(_0x5d403f,null));};exports[_0xd475('0x53')]=function(_0x40d72c,_0x39df07,_0xcca883){var _0x594b0b={};var _0x5def05={};var _0xf6fd79;var _0x139454;return db['Dynamics365Configuration'][_0xd475('0x54')]({'where':{'id':_0x40d72c[_0xd475('0x4f')]['id']}})[_0xd475('0x2e')](handleEntityNotFound(_0x39df07,null))[_0xd475('0x2e')](function(_0x532222){if(_0x532222){_0xf6fd79=_0x532222;_0x5def05[_0xd475('0x38')]=_[_0xd475('0x39')](db['Dynamics365Field'][_0xd475('0x35')]);_0x5def05[_0xd475('0x3a')]=_[_0xd475('0x39')](_0x40d72c[_0xd475('0x3a')]);_0x5def05[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x5def05[_0xd475('0x38')],_0x5def05[_0xd475('0x3a')]);_0x594b0b['attributes']=_[_0xd475('0x3c')](_0x5def05[_0xd475('0x38')],qs[_0xd475('0x3e')](_0x40d72c[_0xd475('0x3a')]['fields']));_0x594b0b[_0xd475('0x3d')]=_0x594b0b[_0xd475('0x3d')][_0xd475('0x3f')]?_0x594b0b[_0xd475('0x3d')]:_0x5def05[_0xd475('0x38')];_0x594b0b[_0xd475('0x41')]=qs['sort'](_0x40d72c[_0xd475('0x3a')][_0xd475('0x42')]);_0x594b0b[_0xd475('0x43')]=qs[_0xd475('0x3b')](_['pick'](_0x40d72c['query'],_0x5def05[_0xd475('0x3b')]));if(_0x40d72c[_0xd475('0x3a')][_0xd475('0x45')]){_0x594b0b['where']=_[_0xd475('0x46')](_0x594b0b[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x594b0b['attributes'],function(_0x359a05){var _0x4df1b6={};_0x4df1b6[_0x359a05]={'$like':'%'+_0x40d72c[_0xd475('0x3a')][_0xd475('0x45')]+'%'};return _0x4df1b6;})});}_0x594b0b=_[_0xd475('0x46')]({},_0x594b0b,_0x40d72c[_0xd475('0x48')]);return _0xf6fd79[_0xd475('0x53')](_0x594b0b);}})[_0xd475('0x2e')](function(_0x1b7b8e){if(_0x1b7b8e){_0x139454=_0x1b7b8e[_0xd475('0x3f')];if(!_0x40d72c[_0xd475('0x3a')][_0xd475('0x40')](_0xd475('0x55'))){_0x594b0b[_0xd475('0x27')]=qs[_0xd475('0x27')](_0x40d72c['query']['limit']);_0x594b0b[_0xd475('0x26')]=qs['offset'](_0x40d72c[_0xd475('0x3a')][_0xd475('0x26')]);}return _0xf6fd79['getFields'](_0x594b0b);}})[_0xd475('0x2e')](function(_0x10b769){if(_0x10b769){return _0x10b769?{'count':_0x139454,'rows':_0x10b769}:null;}})['then'](respondWithResult(_0x39df07,null))['catch'](handleError(_0x39df07,null));};exports[_0xd475('0x56')]=function(_0xe67aae,_0x5d9039,_0xee86ef){var _0x27981d={};var _0x1b4ef1={};var _0x36b84c;var _0x554e48;return db[_0xd475('0x34')][_0xd475('0x54')]({'where':{'id':_0xe67aae[_0xd475('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d9039,null))[_0xd475('0x2e')](function(_0x4ad8a9){if(_0x4ad8a9){_0x36b84c=_0x4ad8a9;_0x1b4ef1['model']=_[_0xd475('0x39')](db['Dynamics365Field'][_0xd475('0x35')]);_0x1b4ef1[_0xd475('0x3a')]=_['keys'](_0xe67aae[_0xd475('0x3a')]);_0x1b4ef1[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x1b4ef1[_0xd475('0x38')],_0x1b4ef1[_0xd475('0x3a')]);_0x27981d[_0xd475('0x3d')]=_[_0xd475('0x3c')](_0x1b4ef1[_0xd475('0x38')],qs['fields'](_0xe67aae[_0xd475('0x3a')][_0xd475('0x3e')]));_0x27981d[_0xd475('0x3d')]=_0x27981d['attributes'][_0xd475('0x3f')]?_0x27981d[_0xd475('0x3d')]:_0x1b4ef1[_0xd475('0x38')];_0x27981d['order']=qs[_0xd475('0x42')](_0xe67aae[_0xd475('0x3a')][_0xd475('0x42')]);_0x27981d[_0xd475('0x43')]=qs[_0xd475('0x3b')](_['pick'](_0xe67aae[_0xd475('0x3a')],_0x1b4ef1[_0xd475('0x3b')]));if(_0xe67aae[_0xd475('0x3a')][_0xd475('0x45')]){_0x27981d[_0xd475('0x43')]=_[_0xd475('0x46')](_0x27981d[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x27981d[_0xd475('0x3d')],function(_0x1d59dc){var _0x536f65={};_0x536f65[_0x1d59dc]={'$like':'%'+_0xe67aae['query'][_0xd475('0x45')]+'%'};return _0x536f65;})});}_0x27981d=_[_0xd475('0x46')]({},_0x27981d,_0xe67aae[_0xd475('0x48')]);return _0x36b84c[_0xd475('0x56')](_0x27981d);}})[_0xd475('0x2e')](function(_0x3f1dfc){if(_0x3f1dfc){_0x554e48=_0x3f1dfc['length'];if(!_0xe67aae[_0xd475('0x3a')]['hasOwnProperty'](_0xd475('0x55'))){_0x27981d[_0xd475('0x27')]=qs[_0xd475('0x27')](_0xe67aae[_0xd475('0x3a')][_0xd475('0x27')]);_0x27981d['offset']=qs[_0xd475('0x26')](_0xe67aae[_0xd475('0x3a')][_0xd475('0x26')]);}return _0x36b84c[_0xd475('0x56')](_0x27981d);}})[_0xd475('0x2e')](function(_0x58f0fe){if(_0x58f0fe){return _0x58f0fe?{'count':_0x554e48,'rows':_0x58f0fe}:null;}})[_0xd475('0x2e')](respondWithResult(_0x5d9039,null))[_0xd475('0x22')](handleError(_0x5d9039,null));};exports[_0xd475('0x57')]=function(_0x59f7c0,_0x55c344,_0x1a71de){var _0x1da49c={};var _0x486a1c={};var _0x3d318c;var _0x41ecab;return db['Dynamics365Configuration'][_0xd475('0x54')]({'where':{'id':_0x59f7c0['params']['id']}})[_0xd475('0x2e')](handleEntityNotFound(_0x55c344,null))[_0xd475('0x2e')](function(_0x3bb95c){if(_0x3bb95c){_0x3d318c=_0x3bb95c;_0x486a1c[_0xd475('0x38')]=_['keys'](db[_0xd475('0x58')][_0xd475('0x35')]);_0x486a1c[_0xd475('0x3a')]=_[_0xd475('0x39')](_0x59f7c0[_0xd475('0x3a')]);_0x486a1c[_0xd475('0x3b')]=_[_0xd475('0x3c')](_0x486a1c[_0xd475('0x38')],_0x486a1c[_0xd475('0x3a')]);_0x1da49c['attributes']=_['intersection'](_0x486a1c[_0xd475('0x38')],qs[_0xd475('0x3e')](_0x59f7c0[_0xd475('0x3a')]['fields']));_0x1da49c['attributes']=_0x1da49c[_0xd475('0x3d')][_0xd475('0x3f')]?_0x1da49c[_0xd475('0x3d')]:_0x486a1c['model'];_0x1da49c[_0xd475('0x41')]=qs['sort'](_0x59f7c0[_0xd475('0x3a')][_0xd475('0x42')]);_0x1da49c[_0xd475('0x43')]=qs[_0xd475('0x3b')](_[_0xd475('0x44')](_0x59f7c0[_0xd475('0x3a')],_0x486a1c['filters']));if(_0x59f7c0[_0xd475('0x3a')][_0xd475('0x45')]){_0x1da49c[_0xd475('0x43')]=_[_0xd475('0x46')](_0x1da49c[_0xd475('0x43')],{'$or':_[_0xd475('0x33')](_0x1da49c[_0xd475('0x3d')],function(_0x442fc3){var _0x5d12c5={};_0x5d12c5[_0x442fc3]={'$like':'%'+_0x59f7c0[_0xd475('0x3a')][_0xd475('0x45')]+'%'};return _0x5d12c5;})});}_0x1da49c=_['merge']({},_0x1da49c,_0x59f7c0[_0xd475('0x48')]);return _0x3d318c[_0xd475('0x57')](_0x1da49c);}})['then'](function(_0x2d2831){if(_0x2d2831){_0x41ecab=_0x2d2831[_0xd475('0x3f')];if(!_0x59f7c0['query']['hasOwnProperty']('nolimit')){_0x1da49c[_0xd475('0x27')]=qs[_0xd475('0x27')](_0x59f7c0['query'][_0xd475('0x27')]);_0x1da49c['offset']=qs['offset'](_0x59f7c0[_0xd475('0x3a')]['offset']);}return _0x3d318c[_0xd475('0x57')](_0x1da49c);}})['then'](function(_0x45549b){if(_0x45549b){return _0x45549b?{'count':_0x41ecab,'rows':_0x45549b}:null;}})['then'](respondWithResult(_0x55c344,null))[_0xd475('0x22')](handleError(_0x55c344,null));}; \ No newline at end of file +var _0xbd4b=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','then','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','intersection','find','create','body','update','destroy','getFields','findOne','Dynamics365Field','filters','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','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'];(function(_0x3802f7,_0x4bfacc){var _0x1606fa=function(_0x54e624){while(--_0x54e624){_0x3802f7['push'](_0x3802f7['shift']());}};_0x1606fa(++_0x4bfacc);}(_0xbd4b,0x153));var _0xbbd4=function(_0x1ea4eb,_0x226650){_0x1ea4eb=_0x1ea4eb-0x0;var _0x402045=_0xbd4b[_0x1ea4eb];return _0x402045;};'use strict';var pdf=require(_0xbbd4('0x0'));var emlformat=require(_0xbbd4('0x1'));var rimraf=require(_0xbbd4('0x2'));var zipdir=require(_0xbbd4('0x3'));var jsonpatch=require(_0xbbd4('0x4'));var rp=require(_0xbbd4('0x5'));var moment=require('moment');var BPromise=require(_0xbbd4('0x6'));var Mustache=require(_0xbbd4('0x7'));var util=require(_0xbbd4('0x8'));var path=require(_0xbbd4('0x9'));var sox=require(_0xbbd4('0xa'));var csv=require(_0xbbd4('0xb'));var ejs=require(_0xbbd4('0xc'));var fs=require('fs');var _=require(_0xbbd4('0xd'));var squel=require(_0xbbd4('0xe'));var crypto=require(_0xbbd4('0xf'));var jsforce=require(_0xbbd4('0x10'));var deskjs=require(_0xbbd4('0x11'));var toCsv=require(_0xbbd4('0xb'));var querystring=require(_0xbbd4('0x12'));var Papa=require(_0xbbd4('0x13'));var Redis=require(_0xbbd4('0x14'));var authService=require(_0xbbd4('0x15'));var qs=require(_0xbbd4('0x16'));var as=require(_0xbbd4('0x17'));var hardwareService=require(_0xbbd4('0x18'));var logger=require('../../config/logger')(_0xbbd4('0x19'));var utils=require(_0xbbd4('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xbbd4('0x1b'));var db=require(_0xbbd4('0x1c'))['db'];var jayson=require(_0xbbd4('0x1d'));var client=jayson[_0xbbd4('0x1e')][_0xbbd4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x552791,_0x1a6e5f,_0x15fc42,_0x43c610){return new BPromise(function(_0x29c64f,_0x2ae37e){var _0x1230c4=_0x43c610||client;return _0x1230c4[_0xbbd4('0x20')](_0x552791,_0x15fc42)['then'](function(_0x3bddbf){logger['info'](_0xbbd4('0x21'),_0x1a6e5f,_0xbbd4('0x22'));logger[_0xbbd4('0x23')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1a6e5f,'request\x20sent',JSON[_0xbbd4('0x24')](_0x3bddbf));if(_0x3bddbf['error']){if(_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x26')]===0x1f4){logger[_0xbbd4('0x25')](_0xbbd4('0x21'),_0x1a6e5f,_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x27')]);return _0x2ae37e(_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x27')]);}logger[_0xbbd4('0x25')](_0xbbd4('0x21'),_0x1a6e5f,_0x3bddbf[_0xbbd4('0x25')][_0xbbd4('0x27')]);return _0x29c64f(_0x3bddbf['error'][_0xbbd4('0x27')]);}else{logger[_0xbbd4('0x28')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a6e5f,_0xbbd4('0x22'));_0x29c64f(_0x3bddbf[_0xbbd4('0x29')][_0xbbd4('0x27')]);}})[_0xbbd4('0x2a')](function(_0x542781){logger[_0xbbd4('0x25')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a6e5f,_0x542781);_0x2ae37e(_0x542781);});});}function respondWithStatusCode(_0x29e093,_0x25fc97){_0x25fc97=_0x25fc97||0xcc;return function(_0xddf48b){if(_0xddf48b){return _0x29e093['sendStatus'](_0x25fc97);}return _0x29e093[_0xbbd4('0x2b')](_0x25fc97)[_0xbbd4('0x2c')]();};}function respondWithResult(_0x503b6a,_0x1b63ed){_0x1b63ed=_0x1b63ed||0xc8;return function(_0x430378){if(_0x430378){return _0x503b6a[_0xbbd4('0x2b')](_0x1b63ed)[_0xbbd4('0x2d')](_0x430378);}};}function respondWithFilteredResult(_0x8d4d5f,_0x224be7){return function(_0x266a21){if(_0x266a21){var _0x354a2e=_0x266a21[_0xbbd4('0x2e')],_0x1e7643=_0x224be7[_0xbbd4('0x2f')],_0x57ad8f=_0x224be7[_0xbbd4('0x2f')]+_0x224be7[_0xbbd4('0x30')],_0x487096;if(_0x57ad8f>=_0x354a2e){_0x57ad8f=_0x354a2e;_0x487096=0xc8;}else{_0x487096=0xce;}_0x8d4d5f[_0xbbd4('0x2b')](_0x487096);return _0x8d4d5f[_0xbbd4('0x31')](_0xbbd4('0x32'),_0x1e7643+'-'+_0x57ad8f+'/'+_0x354a2e)['json'](_0x266a21);}return null;};}function patchUpdates(_0x4e1929){return function(_0x496c56){try{jsonpatch['apply'](_0x496c56,_0x4e1929,!![]);}catch(_0x4d97ed){return BPromise[_0xbbd4('0x33')](_0x4d97ed);}return _0x496c56['save']();};}function saveUpdates(_0x45df57,_0x51ac65){return function(_0xa3e042){if(_0xa3e042){return _0xa3e042['update'](_0x45df57)['then'](function(_0x1e536d){return _0x1e536d;});}return null;};}function removeEntity(_0x236688,_0x2d3d09){return function(_0x1c47c6){if(_0x1c47c6){return _0x1c47c6['destroy']()[_0xbbd4('0x34')](function(){_0x236688[_0xbbd4('0x2b')](0xcc)[_0xbbd4('0x2c')]();});}};}function handleEntityNotFound(_0x1e5da4,_0x518882){return function(_0x2f269f){if(!_0x2f269f){_0x1e5da4['sendStatus'](0x194);}return _0x2f269f;};}function handleError(_0x167d87,_0x70bf1e){_0x70bf1e=_0x70bf1e||0x1f4;return function(_0x112b82){logger['error'](_0x112b82['stack']);if(_0x112b82[_0xbbd4('0x35')]){delete _0x112b82[_0xbbd4('0x35')];}_0x167d87[_0xbbd4('0x2b')](_0x70bf1e)[_0xbbd4('0x36')](_0x112b82);};}exports[_0xbbd4('0x37')]=function(_0x215b07,_0x31aeb0){var _0x48d4d0={},_0x5883ee={},_0x5ac78a={'count':0x0,'rows':[]};var _0x176936=_[_0xbbd4('0x38')](db[_0xbbd4('0x39')][_0xbbd4('0x3a')],function(_0x23405d){return{'name':_0x23405d['fieldName'],'type':_0x23405d[_0xbbd4('0x3b')][_0xbbd4('0x3c')]};});_0x5883ee[_0xbbd4('0x3d')]=_[_0xbbd4('0x38')](_0x176936,_0xbbd4('0x35'));_0x5883ee[_0xbbd4('0x3e')]=_['keys'](_0x215b07[_0xbbd4('0x3e')]);_0x5883ee['filters']=_['intersection'](_0x5883ee[_0xbbd4('0x3d')],_0x5883ee['query']);_0x48d4d0['attributes']=_['intersection'](_0x5883ee['model'],qs[_0xbbd4('0x3f')](_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x3f')]));_0x48d4d0[_0xbbd4('0x40')]=_0x48d4d0[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0x48d4d0[_0xbbd4('0x40')]:_0x5883ee[_0xbbd4('0x3d')];if(!_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x42')](_0xbbd4('0x43'))){_0x48d4d0[_0xbbd4('0x30')]=qs[_0xbbd4('0x30')](_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x30')]);_0x48d4d0[_0xbbd4('0x2f')]=qs[_0xbbd4('0x2f')](_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x2f')]);}_0x48d4d0[_0xbbd4('0x44')]=qs[_0xbbd4('0x45')](_0x215b07['query'][_0xbbd4('0x45')]);_0x48d4d0['where']=qs['filters'](_[_0xbbd4('0x46')](_0x215b07[_0xbbd4('0x3e')],_0x5883ee['filters']),_0x176936);if(_0x215b07['query'][_0xbbd4('0x47')]){_0x48d4d0[_0xbbd4('0x48')]=_['merge'](_0x48d4d0[_0xbbd4('0x48')],{'$or':_['map'](_0x176936,function(_0x3e0dd5){if(_0x3e0dd5[_0xbbd4('0x3b')]!==_0xbbd4('0x49')){var _0x1f0b0a={};_0x1f0b0a[_0x3e0dd5[_0xbbd4('0x35')]]={'$like':'%'+_0x215b07[_0xbbd4('0x3e')]['filter']+'%'};return _0x1f0b0a;}})});}_0x48d4d0=_[_0xbbd4('0x4a')]({},_0x48d4d0,_0x215b07[_0xbbd4('0x4b')]);var _0x488c36={'where':_0x48d4d0['where']};return db['Dynamics365Configuration'][_0xbbd4('0x2e')](_0x488c36)[_0xbbd4('0x34')](function(_0x6d45c3){_0x5ac78a[_0xbbd4('0x2e')]=_0x6d45c3;if(_0x215b07[_0xbbd4('0x3e')][_0xbbd4('0x4c')]){_0x48d4d0[_0xbbd4('0x4d')]=[{'all':!![]}];}return db[_0xbbd4('0x39')]['findAll'](_0x48d4d0);})[_0xbbd4('0x34')](function(_0xbbef11){_0x5ac78a['rows']=_0xbbef11;return _0x5ac78a;})[_0xbbd4('0x34')](respondWithFilteredResult(_0x31aeb0,_0x48d4d0))[_0xbbd4('0x2a')](handleError(_0x31aeb0,null));};exports[_0xbbd4('0x4e')]=function(_0x2a8cac,_0x95f9b1){var _0x18f50f={'raw':![],'where':{'id':_0x2a8cac[_0xbbd4('0x4f')]['id']}},_0x1e6254={};_0x1e6254[_0xbbd4('0x3d')]=_[_0xbbd4('0x50')](db['Dynamics365Configuration'][_0xbbd4('0x3a')]);_0x1e6254[_0xbbd4('0x3e')]=_[_0xbbd4('0x50')](_0x2a8cac[_0xbbd4('0x3e')]);_0x1e6254['filters']=_[_0xbbd4('0x51')](_0x1e6254[_0xbbd4('0x3d')],_0x1e6254[_0xbbd4('0x3e')]);_0x18f50f[_0xbbd4('0x40')]=_[_0xbbd4('0x51')](_0x1e6254['model'],qs[_0xbbd4('0x3f')](_0x2a8cac[_0xbbd4('0x3e')]['fields']));_0x18f50f[_0xbbd4('0x40')]=_0x18f50f[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0x18f50f[_0xbbd4('0x40')]:_0x1e6254['model'];if(_0x2a8cac['query'][_0xbbd4('0x4c')]){_0x18f50f[_0xbbd4('0x4d')]=[{'all':!![]}];}_0x18f50f=_[_0xbbd4('0x4a')]({},_0x18f50f,_0x2a8cac['options']);return db[_0xbbd4('0x39')][_0xbbd4('0x52')](_0x18f50f)[_0xbbd4('0x34')](handleEntityNotFound(_0x95f9b1,null))['then'](respondWithResult(_0x95f9b1,null))[_0xbbd4('0x2a')](handleError(_0x95f9b1,null));};exports[_0xbbd4('0x53')]=function(_0x493e91,_0x26834e){return db[_0xbbd4('0x39')][_0xbbd4('0x53')](_0x493e91[_0xbbd4('0x54')],{})[_0xbbd4('0x34')](respondWithResult(_0x26834e,0xc9))[_0xbbd4('0x2a')](handleError(_0x26834e,null));};exports[_0xbbd4('0x55')]=function(_0x23560d,_0x3c25f0){if(_0x23560d['body']['id']){delete _0x23560d[_0xbbd4('0x54')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x23560d[_0xbbd4('0x4f')]['id']}})[_0xbbd4('0x34')](handleEntityNotFound(_0x3c25f0,null))[_0xbbd4('0x34')](saveUpdates(_0x23560d['body'],null))[_0xbbd4('0x34')](respondWithResult(_0x3c25f0,null))[_0xbbd4('0x2a')](handleError(_0x3c25f0,null));};exports[_0xbbd4('0x56')]=function(_0x4beec7,_0x74e18a){return db[_0xbbd4('0x39')][_0xbbd4('0x52')]({'where':{'id':_0x4beec7['params']['id']}})[_0xbbd4('0x34')](handleEntityNotFound(_0x74e18a,null))['then'](removeEntity(_0x74e18a,null))[_0xbbd4('0x2a')](handleError(_0x74e18a,null));};exports[_0xbbd4('0x57')]=function(_0xb36c67,_0x198c08,_0x18a32f){var _0xbf4e5b={};var _0x1225dd={};var _0x5450a9;var _0x41f71e;return db[_0xbbd4('0x39')][_0xbbd4('0x58')]({'where':{'id':_0xb36c67[_0xbbd4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x198c08,null))['then'](function(_0x489797){if(_0x489797){_0x5450a9=_0x489797;_0x1225dd['model']=_['keys'](db[_0xbbd4('0x59')][_0xbbd4('0x3a')]);_0x1225dd['query']=_[_0xbbd4('0x50')](_0xb36c67[_0xbbd4('0x3e')]);_0x1225dd[_0xbbd4('0x5a')]=_[_0xbbd4('0x51')](_0x1225dd['model'],_0x1225dd[_0xbbd4('0x3e')]);_0xbf4e5b['attributes']=_[_0xbbd4('0x51')](_0x1225dd[_0xbbd4('0x3d')],qs[_0xbbd4('0x3f')](_0xb36c67['query'][_0xbbd4('0x3f')]));_0xbf4e5b['attributes']=_0xbf4e5b[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0xbf4e5b[_0xbbd4('0x40')]:_0x1225dd[_0xbbd4('0x3d')];_0xbf4e5b[_0xbbd4('0x44')]=qs['sort'](_0xb36c67['query']['sort']);_0xbf4e5b[_0xbbd4('0x48')]=qs[_0xbbd4('0x5a')](_[_0xbbd4('0x46')](_0xb36c67[_0xbbd4('0x3e')],_0x1225dd['filters']));if(_0xb36c67[_0xbbd4('0x3e')][_0xbbd4('0x47')]){_0xbf4e5b[_0xbbd4('0x48')]=_[_0xbbd4('0x4a')](_0xbf4e5b[_0xbbd4('0x48')],{'$or':_[_0xbbd4('0x38')](_0xbf4e5b[_0xbbd4('0x40')],function(_0x1ef733){var _0x6eb9f2={};_0x6eb9f2[_0x1ef733]={'$like':'%'+_0xb36c67[_0xbbd4('0x3e')][_0xbbd4('0x47')]+'%'};return _0x6eb9f2;})});}_0xbf4e5b=_['merge']({},_0xbf4e5b,_0xb36c67[_0xbbd4('0x4b')]);return _0x5450a9[_0xbbd4('0x57')](_0xbf4e5b);}})['then'](function(_0x56c882){if(_0x56c882){_0x41f71e=_0x56c882[_0xbbd4('0x41')];if(!_0xb36c67[_0xbbd4('0x3e')]['hasOwnProperty'](_0xbbd4('0x43'))){_0xbf4e5b[_0xbbd4('0x30')]=qs[_0xbbd4('0x30')](_0xb36c67[_0xbbd4('0x3e')][_0xbbd4('0x30')]);_0xbf4e5b[_0xbbd4('0x2f')]=qs[_0xbbd4('0x2f')](_0xb36c67['query'][_0xbbd4('0x2f')]);}return _0x5450a9['getFields'](_0xbf4e5b);}})[_0xbbd4('0x34')](function(_0x1f3b23){if(_0x1f3b23){return _0x1f3b23?{'count':_0x41f71e,'rows':_0x1f3b23}:null;}})[_0xbbd4('0x34')](respondWithResult(_0x198c08,null))[_0xbbd4('0x2a')](handleError(_0x198c08,null));};exports[_0xbbd4('0x5b')]=function(_0x431582,_0x27d3d5,_0x4581d4){var _0x3489cc={};var _0x143787={};var _0x309ab5;var _0x58fe70;return db[_0xbbd4('0x39')][_0xbbd4('0x58')]({'where':{'id':_0x431582['params']['id']}})['then'](handleEntityNotFound(_0x27d3d5,null))[_0xbbd4('0x34')](function(_0x13ead0){if(_0x13ead0){_0x309ab5=_0x13ead0;_0x143787['model']=_[_0xbbd4('0x50')](db[_0xbbd4('0x59')][_0xbbd4('0x3a')]);_0x143787[_0xbbd4('0x3e')]=_[_0xbbd4('0x50')](_0x431582[_0xbbd4('0x3e')]);_0x143787[_0xbbd4('0x5a')]=_[_0xbbd4('0x51')](_0x143787[_0xbbd4('0x3d')],_0x143787['query']);_0x3489cc[_0xbbd4('0x40')]=_[_0xbbd4('0x51')](_0x143787['model'],qs[_0xbbd4('0x3f')](_0x431582['query']['fields']));_0x3489cc[_0xbbd4('0x40')]=_0x3489cc[_0xbbd4('0x40')]['length']?_0x3489cc[_0xbbd4('0x40')]:_0x143787[_0xbbd4('0x3d')];_0x3489cc[_0xbbd4('0x44')]=qs[_0xbbd4('0x45')](_0x431582[_0xbbd4('0x3e')]['sort']);_0x3489cc[_0xbbd4('0x48')]=qs[_0xbbd4('0x5a')](_['pick'](_0x431582['query'],_0x143787[_0xbbd4('0x5a')]));if(_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x47')]){_0x3489cc[_0xbbd4('0x48')]=_[_0xbbd4('0x4a')](_0x3489cc[_0xbbd4('0x48')],{'$or':_[_0xbbd4('0x38')](_0x3489cc['attributes'],function(_0x14137f){var _0x91ac07={};_0x91ac07[_0x14137f]={'$like':'%'+_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x47')]+'%'};return _0x91ac07;})});}_0x3489cc=_[_0xbbd4('0x4a')]({},_0x3489cc,_0x431582['options']);return _0x309ab5[_0xbbd4('0x5b')](_0x3489cc);}})['then'](function(_0x280159){if(_0x280159){_0x58fe70=_0x280159[_0xbbd4('0x41')];if(!_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x42')](_0xbbd4('0x43'))){_0x3489cc['limit']=qs['limit'](_0x431582['query'][_0xbbd4('0x30')]);_0x3489cc[_0xbbd4('0x2f')]=qs['offset'](_0x431582[_0xbbd4('0x3e')][_0xbbd4('0x2f')]);}return _0x309ab5['getSubjects'](_0x3489cc);}})[_0xbbd4('0x34')](function(_0x5c9e24){if(_0x5c9e24){return _0x5c9e24?{'count':_0x58fe70,'rows':_0x5c9e24}:null;}})[_0xbbd4('0x34')](respondWithResult(_0x27d3d5,null))[_0xbbd4('0x2a')](handleError(_0x27d3d5,null));};exports[_0xbbd4('0x5c')]=function(_0x7a49cc,_0x4cc0c1,_0x4388a8){var _0x1bd4e2={};var _0x5cca0f={};var _0x47d4;var _0x247d8f;return db[_0xbbd4('0x39')][_0xbbd4('0x58')]({'where':{'id':_0x7a49cc[_0xbbd4('0x4f')]['id']}})[_0xbbd4('0x34')](handleEntityNotFound(_0x4cc0c1,null))[_0xbbd4('0x34')](function(_0x3aef2c){if(_0x3aef2c){_0x47d4=_0x3aef2c;_0x5cca0f[_0xbbd4('0x3d')]=_[_0xbbd4('0x50')](db['Dynamics365Field']['rawAttributes']);_0x5cca0f[_0xbbd4('0x3e')]=_[_0xbbd4('0x50')](_0x7a49cc['query']);_0x5cca0f[_0xbbd4('0x5a')]=_[_0xbbd4('0x51')](_0x5cca0f['model'],_0x5cca0f[_0xbbd4('0x3e')]);_0x1bd4e2[_0xbbd4('0x40')]=_[_0xbbd4('0x51')](_0x5cca0f['model'],qs[_0xbbd4('0x3f')](_0x7a49cc[_0xbbd4('0x3e')]['fields']));_0x1bd4e2['attributes']=_0x1bd4e2[_0xbbd4('0x40')][_0xbbd4('0x41')]?_0x1bd4e2[_0xbbd4('0x40')]:_0x5cca0f['model'];_0x1bd4e2[_0xbbd4('0x44')]=qs['sort'](_0x7a49cc[_0xbbd4('0x3e')]['sort']);_0x1bd4e2[_0xbbd4('0x48')]=qs[_0xbbd4('0x5a')](_['pick'](_0x7a49cc[_0xbbd4('0x3e')],_0x5cca0f[_0xbbd4('0x5a')]));if(_0x7a49cc[_0xbbd4('0x3e')][_0xbbd4('0x47')]){_0x1bd4e2[_0xbbd4('0x48')]=_[_0xbbd4('0x4a')](_0x1bd4e2[_0xbbd4('0x48')],{'$or':_['map'](_0x1bd4e2[_0xbbd4('0x40')],function(_0x329c4b){var _0xbf69db={};_0xbf69db[_0x329c4b]={'$like':'%'+_0x7a49cc[_0xbbd4('0x3e')]['filter']+'%'};return _0xbf69db;})});}_0x1bd4e2=_[_0xbbd4('0x4a')]({},_0x1bd4e2,_0x7a49cc['options']);return _0x47d4['getDescriptions'](_0x1bd4e2);}})['then'](function(_0x4fb860){if(_0x4fb860){_0x247d8f=_0x4fb860[_0xbbd4('0x41')];if(!_0x7a49cc[_0xbbd4('0x3e')][_0xbbd4('0x42')](_0xbbd4('0x43'))){_0x1bd4e2['limit']=qs[_0xbbd4('0x30')](_0x7a49cc['query'][_0xbbd4('0x30')]);_0x1bd4e2[_0xbbd4('0x2f')]=qs[_0xbbd4('0x2f')](_0x7a49cc[_0xbbd4('0x3e')][_0xbbd4('0x2f')]);}return _0x47d4[_0xbbd4('0x5c')](_0x1bd4e2);}})[_0xbbd4('0x34')](function(_0xb6bb3c){if(_0xb6bb3c){return _0xb6bb3c?{'count':_0x247d8f,'rows':_0xb6bb3c}:null;}})[_0xbbd4('0x34')](respondWithResult(_0x4cc0c1,null))[_0xbbd4('0x2a')](handleError(_0x4cc0c1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 7114695..ee915b4 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 _0xfecf=['./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1bbcf6,_0x12aa4e){var _0x227667=function(_0x2131bb){while(--_0x2131bb){_0x1bbcf6['push'](_0x1bbcf6['shift']());}};_0x227667(++_0x12aa4e);}(_0xfecf,0x87));var _0xffec=function(_0x3bb5ea,_0x2cba90){_0x3bb5ea=_0x3bb5ea-0x0;var _0x8a562f=_0xfecf[_0x3bb5ea];return _0x8a562f;};'use strict';var _=require(_0xffec('0x0'));var util=require(_0xffec('0x1'));var logger=require('../../config/logger')(_0xffec('0x2'));var moment=require('moment');var BPromise=require(_0xffec('0x3'));var rp=require(_0xffec('0x4'));var fs=require('fs');var path=require(_0xffec('0x5'));var rimraf=require(_0xffec('0x6'));var config=require(_0xffec('0x7'));var attributes=require(_0xffec('0x8'));module[_0xffec('0x9')]=function(_0xfe0311,_0x49eb04){return _0xfe0311['define']('Dynamics365Configuration',attributes,{'tableName':_0xffec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98f8=['define','Dynamics365Configuration','int_dynamics365_configurations','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d622d,_0x238f23){var _0xf75eb8=function(_0x1b01f7){while(--_0x1b01f7){_0x5d622d['push'](_0x5d622d['shift']());}};_0xf75eb8(++_0x238f23);}(_0x98f8,0xe4));var _0x898f=function(_0x5138f5,_0x1aa460){_0x5138f5=_0x5138f5-0x0;var _0x2cc6bd=_0x98f8[_0x5138f5];return _0x2cc6bd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x898f('0x0'));var moment=require(_0x898f('0x1'));var BPromise=require('bluebird');var rp=require(_0x898f('0x2'));var fs=require('fs');var path=require(_0x898f('0x3'));var rimraf=require(_0x898f('0x4'));var config=require(_0x898f('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x36880e,_0x33075d){return _0x36880e[_0x898f('0x6')](_0x898f('0x7'),attributes,{'tableName':_0x898f('0x8'),'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 c7b6964..22c4cef 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 _0xe89f=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x5e8104,_0x413aad){var _0x19ed7d=function(_0x126479){while(--_0x126479){_0x5e8104['push'](_0x5e8104['shift']());}};_0x19ed7d(++_0x413aad);}(_0xe89f,0x15a));var _0xfe89=function(_0x5ef0d2,_0x10ea16){_0x5ef0d2=_0x5ef0d2-0x0;var _0x33ca21=_0xe89f[_0x5ef0d2];return _0x33ca21;};'use strict';var _=require(_0xfe89('0x0'));var util=require(_0xfe89('0x1'));var moment=require(_0xfe89('0x2'));var BPromise=require(_0xfe89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe89('0x4'));var db=require(_0xfe89('0x5'))['db'];var utils=require(_0xfe89('0x6'));var logger=require(_0xfe89('0x7'))(_0xfe89('0x8'));var config=require(_0xfe89('0x9'));var jayson=require(_0xfe89('0xa'));var client=jayson[_0xfe89('0xb')][_0xfe89('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54ab69,_0x505194,_0x1c4f33){return new BPromise(function(_0x34a8f6,_0x4e5944){return client[_0xfe89('0xd')](_0x54ab69,_0x1c4f33)['then'](function(_0x148a4b){logger[_0xfe89('0xe')](_0xfe89('0xf'),_0x505194,'request\x20sent');logger['debug'](_0xfe89('0x10'),_0x505194,_0xfe89('0x11'),JSON[_0xfe89('0x12')](_0x148a4b));if(_0x148a4b[_0xfe89('0x13')]){if(_0x148a4b[_0xfe89('0x13')]['code']===0x1f4){logger[_0xfe89('0x13')](_0xfe89('0xf'),_0x505194,_0x148a4b[_0xfe89('0x13')][_0xfe89('0x14')]);return _0x4e5944(_0x148a4b[_0xfe89('0x13')][_0xfe89('0x14')]);}logger[_0xfe89('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x505194,_0x148a4b[_0xfe89('0x13')]['message']);return _0x34a8f6(_0x148a4b['error'][_0xfe89('0x14')]);}else{logger[_0xfe89('0xe')](_0xfe89('0xf'),_0x505194,_0xfe89('0x11'));_0x34a8f6(_0x148a4b[_0xfe89('0x15')][_0xfe89('0x14')]);}})[_0xfe89('0x16')](function(_0x4ecf9a){logger[_0xfe89('0x13')](_0xfe89('0xf'),_0x505194,_0x4ecf9a);_0x4e5944(_0x4ecf9a);});});} \ No newline at end of file +var _0x9e70=['error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x23d2d2,_0xc460e){var _0x4a665e=function(_0x3edb20){while(--_0x3edb20){_0x23d2d2['push'](_0x23d2d2['shift']());}};_0x4a665e(++_0xc460e);}(_0x9e70,0x121));var _0x09e7=function(_0x436a19,_0x4970a5){_0x436a19=_0x436a19-0x0;var _0x2c2252=_0x9e70[_0x436a19];return _0x2c2252;};'use strict';var _=require(_0x09e7('0x0'));var util=require('util');var moment=require(_0x09e7('0x1'));var BPromise=require(_0x09e7('0x2'));var rs=require(_0x09e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09e7('0x4'));var logger=require(_0x09e7('0x5'))('rpc');var config=require(_0x09e7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x09e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x561501,_0x1a8a84,_0x1665f0){return new BPromise(function(_0x11815b,_0x5eb576){return client[_0x09e7('0x8')](_0x561501,_0x1665f0)[_0x09e7('0x9')](function(_0x26e7e8){logger[_0x09e7('0xa')](_0x09e7('0xb'),_0x1a8a84,_0x09e7('0xc'));logger[_0x09e7('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1a8a84,_0x09e7('0xc'),JSON[_0x09e7('0xe')](_0x26e7e8));if(_0x26e7e8[_0x09e7('0xf')]){if(_0x26e7e8[_0x09e7('0xf')][_0x09e7('0x10')]===0x1f4){logger[_0x09e7('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1a8a84,_0x26e7e8[_0x09e7('0xf')][_0x09e7('0x11')]);return _0x5eb576(_0x26e7e8[_0x09e7('0xf')][_0x09e7('0x11')]);}logger['error'](_0x09e7('0xb'),_0x1a8a84,_0x26e7e8['error']['message']);return _0x11815b(_0x26e7e8[_0x09e7('0xf')]['message']);}else{logger[_0x09e7('0xa')](_0x09e7('0xb'),_0x1a8a84,_0x09e7('0xc'));_0x11815b(_0x26e7e8[_0x09e7('0x12')]['message']);}})['catch'](function(_0x2b40ed){logger['error'](_0x09e7('0xb'),_0x1a8a84,_0x2b40ed);_0x5eb576(_0x2b40ed);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4858f09..c1c1dc7 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 _0x0506=['exports','multer','util','path','../../components/interaction/service','./intDynamics365Field.controller','index','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x14d227,_0x5c0814){var _0x548f78=function(_0x3a3827){while(--_0x3a3827){_0x14d227['push'](_0x14d227['shift']());}};_0x548f78(++_0x5c0814);}(_0x0506,0x1d1));var _0x6050=function(_0x4fb277,_0x2cb27a){_0x4fb277=_0x4fb277-0x0;var _0xdfc99a=_0x0506[_0x4fb277];return _0xdfc99a;};'use strict';var multer=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var path=require(_0x6050('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6050('0x3'));var config=require('../../config/environment');var controller=require(_0x6050('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x6050('0x5')]);router[_0x6050('0x6')](_0x6050('0x7'),auth[_0x6050('0x8')](),controller[_0x6050('0x9')]);router[_0x6050('0xa')]('/',auth[_0x6050('0x8')](),controller[_0x6050('0xb')]);router['put'](_0x6050('0x7'),auth['isAuthenticated'](),controller[_0x6050('0xc')]);router[_0x6050('0xd')](_0x6050('0x7'),auth[_0x6050('0x8')](),controller[_0x6050('0xe')]);module[_0x6050('0xf')]=router; \ No newline at end of file +var _0x8ce3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2b561d,_0x41cd0e){var _0x3ddca4=function(_0xe18bb3){while(--_0xe18bb3){_0x2b561d['push'](_0x2b561d['shift']());}};_0x3ddca4(++_0x41cd0e);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3f0b15,_0xb88473){_0x3f0b15=_0x3f0b15-0x0;var _0x38f95f=_0x8ce3[_0x3f0b15];return _0x38f95f;};'use strict';var multer=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var path=require('path');var timeout=require(_0x38ce('0x2'));var express=require(_0x38ce('0x3'));var router=express[_0x38ce('0x4')]();var auth=require(_0x38ce('0x5'));var interaction=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var controller=require(_0x38ce('0x8'));router[_0x38ce('0x9')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xa')]);router[_0x38ce('0x9')]('/:id',auth[_0x38ce('0xb')](),controller[_0x38ce('0xc')]);router[_0x38ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x38ce('0xe')]);router['put'](_0x38ce('0xf'),auth['isAuthenticated'](),controller[_0x38ce('0x10')]);router[_0x38ce('0x11')](_0x38ce('0xf'),auth[_0x38ce('0xb')](),controller[_0x38ce('0x12')]);module[_0x38ce('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2ccbaed..7dcb5b0 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 _0xcbb3=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0xc42a73,_0x232b84){var _0x108cf9=function(_0x5ea709){while(--_0x5ea709){_0xc42a73['push'](_0xc42a73['shift']());}};_0x108cf9(++_0x232b84);}(_0xcbb3,0x66));var _0x3cbb=function(_0x55869f,_0xfd83b){_0x55869f=_0x55869f-0x0;var _0x165b2c=_0xcbb3[_0x55869f];return _0x165b2c;};'use strict';var Sequelize=require(_0x3cbb('0x0'));module[_0x3cbb('0x1')]={'type':{'type':Sequelize[_0x3cbb('0x2')](_0x3cbb('0x3'),_0x3cbb('0x4'),_0x3cbb('0x5'),_0x3cbb('0x6')),'defaultValue':_0x3cbb('0x3')},'content':{'type':Sequelize[_0x3cbb('0x7')]},'key':{'type':Sequelize[_0x3cbb('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3cbb('0x3'),_0x3cbb('0x4'),_0x3cbb('0x5'))},'keyContent':{'type':Sequelize[_0x3cbb('0x7')]},'idField':{'type':Sequelize[_0x3cbb('0x7')]},'nameField':{'type':Sequelize[_0x3cbb('0x7')]},'customField':{'type':Sequelize[_0x3cbb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2645=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x2be0ed,_0x291f60){var _0x330eb4=function(_0x2517dc){while(--_0x2517dc){_0x2be0ed['push'](_0x2be0ed['shift']());}};_0x330eb4(++_0x291f60);}(_0x2645,0x1c1));var _0x5264=function(_0x21b0a7,_0x52d936){_0x21b0a7=_0x21b0a7-0x0;var _0x416ce3=_0x2645[_0x21b0a7];return _0x416ce3;};'use strict';var Sequelize=require('sequelize');module[_0x5264('0x0')]={'type':{'type':Sequelize[_0x5264('0x1')](_0x5264('0x2'),_0x5264('0x3'),_0x5264('0x4'),_0x5264('0x5')),'defaultValue':_0x5264('0x2')},'content':{'type':Sequelize[_0x5264('0x6')]},'key':{'type':Sequelize[_0x5264('0x6')]},'keyType':{'type':Sequelize[_0x5264('0x1')]('string',_0x5264('0x3'),_0x5264('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5264('0x6')]},'customField':{'type':Sequelize[_0x5264('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5264('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7087ae7..1e483b7 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 _0xeee4=['pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x524899,_0x4a1b81){var _0x5e2554=function(_0x5cd91c){while(--_0x5cd91c){_0x524899['push'](_0x524899['shift']());}};_0x5e2554(++_0x4a1b81);}(_0xeee4,0xeb));var _0x4eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4eee('0x0'));var emlformat=require(_0x4eee('0x1'));var rimraf=require(_0x4eee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4eee('0x3'));var rp=require(_0x4eee('0x4'));var moment=require(_0x4eee('0x5'));var BPromise=require(_0x4eee('0x6'));var Mustache=require(_0x4eee('0x7'));var util=require(_0x4eee('0x8'));var path=require(_0x4eee('0x9'));var sox=require('sox');var csv=require(_0x4eee('0xa'));var ejs=require(_0x4eee('0xb'));var fs=require('fs');var _=require(_0x4eee('0xc'));var squel=require(_0x4eee('0xd'));var crypto=require(_0x4eee('0xe'));var jsforce=require(_0x4eee('0xf'));var deskjs=require(_0x4eee('0x10'));var toCsv=require(_0x4eee('0xa'));var querystring=require(_0x4eee('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4eee('0x12'));var qs=require(_0x4eee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4eee('0x14'));var logger=require(_0x4eee('0x15'))(_0x4eee('0x16'));var utils=require(_0x4eee('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4eee('0x18'))['db'];function respondWithStatusCode(_0x5ad215,_0x11d6ef){_0x11d6ef=_0x11d6ef||0xcc;return function(_0x3dd1c2){if(_0x3dd1c2){return _0x5ad215[_0x4eee('0x19')](_0x11d6ef);}return _0x5ad215[_0x4eee('0x1a')](_0x11d6ef)[_0x4eee('0x1b')]();};}function respondWithResult(_0x305467,_0x100762){_0x100762=_0x100762||0xc8;return function(_0x559b0d){if(_0x559b0d){return _0x305467[_0x4eee('0x1a')](_0x100762)[_0x4eee('0x1c')](_0x559b0d);}};}function respondWithFilteredResult(_0x34840d,_0x2d3a85){return function(_0x29aa3b){if(_0x29aa3b){var _0x41f48d=_0x29aa3b['count'],_0x2a580c=_0x2d3a85[_0x4eee('0x1d')],_0x5c9721=_0x2d3a85[_0x4eee('0x1d')]+_0x2d3a85[_0x4eee('0x1e')],_0x5948cc;if(_0x5c9721>=_0x41f48d){_0x5c9721=_0x41f48d;_0x5948cc=0xc8;}else{_0x5948cc=0xce;}_0x34840d[_0x4eee('0x1a')](_0x5948cc);return _0x34840d[_0x4eee('0x1f')](_0x4eee('0x20'),_0x2a580c+'-'+_0x5c9721+'/'+_0x41f48d)[_0x4eee('0x1c')](_0x29aa3b);}return null;};}function patchUpdates(_0x1bcb74){return function(_0x17c236){try{jsonpatch[_0x4eee('0x21')](_0x17c236,_0x1bcb74,!![]);}catch(_0xb0231){return BPromise['reject'](_0xb0231);}return _0x17c236['save']();};}function saveUpdates(_0x595c3a,_0x41d77c){return function(_0x118cf4){if(_0x118cf4){return _0x118cf4['update'](_0x595c3a)[_0x4eee('0x22')](function(_0x2a9603){return _0x2a9603;});}return null;};}function removeEntity(_0x14c057,_0x18573e){return function(_0x19f748){if(_0x19f748){return _0x19f748[_0x4eee('0x23')]()[_0x4eee('0x22')](function(){_0x14c057[_0x4eee('0x1a')](0xcc)[_0x4eee('0x1b')]();});}};}function handleEntityNotFound(_0x9cb624,_0x2da934){return function(_0x3de321){if(!_0x3de321){_0x9cb624[_0x4eee('0x19')](0x194);}return _0x3de321;};}function handleError(_0x228861,_0x4fb197){_0x4fb197=_0x4fb197||0x1f4;return function(_0x239204){logger[_0x4eee('0x24')](_0x239204[_0x4eee('0x25')]);if(_0x239204[_0x4eee('0x26')]){delete _0x239204[_0x4eee('0x26')];}_0x228861[_0x4eee('0x1a')](_0x4fb197)[_0x4eee('0x27')](_0x239204);};}exports[_0x4eee('0x28')]=function(_0x68c5d5,_0x5ba5cc){var _0x136b54={},_0xa59cee={},_0x38c63b={'count':0x0,'rows':[]};var _0x1bfbbd=_['map'](db[_0x4eee('0x29')][_0x4eee('0x2a')],function(_0x15387d){return{'name':_0x15387d[_0x4eee('0x2b')],'type':_0x15387d[_0x4eee('0x2c')]['key']};});_0xa59cee[_0x4eee('0x2d')]=_[_0x4eee('0x2e')](_0x1bfbbd,_0x4eee('0x26'));_0xa59cee[_0x4eee('0x2f')]=_['keys'](_0x68c5d5[_0x4eee('0x2f')]);_0xa59cee[_0x4eee('0x30')]=_[_0x4eee('0x31')](_0xa59cee[_0x4eee('0x2d')],_0xa59cee[_0x4eee('0x2f')]);_0x136b54[_0x4eee('0x32')]=_[_0x4eee('0x31')](_0xa59cee[_0x4eee('0x2d')],qs[_0x4eee('0x33')](_0x68c5d5['query'][_0x4eee('0x33')]));_0x136b54[_0x4eee('0x32')]=_0x136b54[_0x4eee('0x32')][_0x4eee('0x34')]?_0x136b54['attributes']:_0xa59cee['model'];if(!_0x68c5d5[_0x4eee('0x2f')]['hasOwnProperty'](_0x4eee('0x35'))){_0x136b54[_0x4eee('0x1e')]=qs['limit'](_0x68c5d5['query'][_0x4eee('0x1e')]);_0x136b54[_0x4eee('0x1d')]=qs['offset'](_0x68c5d5['query'][_0x4eee('0x1d')]);}_0x136b54[_0x4eee('0x36')]=qs[_0x4eee('0x37')](_0x68c5d5['query']['sort']);_0x136b54[_0x4eee('0x38')]=qs['filters'](_[_0x4eee('0x39')](_0x68c5d5[_0x4eee('0x2f')],_0xa59cee[_0x4eee('0x30')]),_0x1bfbbd);if(_0x68c5d5[_0x4eee('0x2f')][_0x4eee('0x3a')]){_0x136b54[_0x4eee('0x38')]=_[_0x4eee('0x3b')](_0x136b54[_0x4eee('0x38')],{'$or':_['map'](_0x1bfbbd,function(_0x560a5d){if(_0x560a5d['type']!=='VIRTUAL'){var _0x2cc752={};_0x2cc752[_0x560a5d[_0x4eee('0x26')]]={'$like':'%'+_0x68c5d5[_0x4eee('0x2f')]['filter']+'%'};return _0x2cc752;}})});}_0x136b54=_['merge']({},_0x136b54,_0x68c5d5[_0x4eee('0x3c')]);var _0x2d163a={'where':_0x136b54[_0x4eee('0x38')]};return db[_0x4eee('0x29')][_0x4eee('0x3d')](_0x2d163a)['then'](function(_0x2c2be9){_0x38c63b[_0x4eee('0x3d')]=_0x2c2be9;if(_0x68c5d5[_0x4eee('0x2f')][_0x4eee('0x3e')]){_0x136b54[_0x4eee('0x3f')]=[{'all':!![]}];}return db[_0x4eee('0x29')][_0x4eee('0x40')](_0x136b54);})[_0x4eee('0x22')](function(_0x437d2b){_0x38c63b[_0x4eee('0x41')]=_0x437d2b;return _0x38c63b;})['then'](respondWithFilteredResult(_0x5ba5cc,_0x136b54))[_0x4eee('0x42')](handleError(_0x5ba5cc,null));};exports[_0x4eee('0x43')]=function(_0x1a1cfc,_0x594c74){var _0x3a6328={'raw':!![],'where':{'id':_0x1a1cfc[_0x4eee('0x44')]['id']}},_0x26f9e6={};_0x26f9e6[_0x4eee('0x2d')]=_['keys'](db[_0x4eee('0x29')][_0x4eee('0x2a')]);_0x26f9e6[_0x4eee('0x2f')]=_[_0x4eee('0x45')](_0x1a1cfc['query']);_0x26f9e6[_0x4eee('0x30')]=_[_0x4eee('0x31')](_0x26f9e6['model'],_0x26f9e6[_0x4eee('0x2f')]);_0x3a6328['attributes']=_[_0x4eee('0x31')](_0x26f9e6[_0x4eee('0x2d')],qs[_0x4eee('0x33')](_0x1a1cfc[_0x4eee('0x2f')][_0x4eee('0x33')]));_0x3a6328[_0x4eee('0x32')]=_0x3a6328[_0x4eee('0x32')][_0x4eee('0x34')]?_0x3a6328[_0x4eee('0x32')]:_0x26f9e6[_0x4eee('0x2d')];if(_0x1a1cfc['query'][_0x4eee('0x3e')]){_0x3a6328[_0x4eee('0x3f')]=[{'all':!![]}];}_0x3a6328=_['merge']({},_0x3a6328,_0x1a1cfc[_0x4eee('0x3c')]);return db[_0x4eee('0x29')][_0x4eee('0x46')](_0x3a6328)[_0x4eee('0x22')](handleEntityNotFound(_0x594c74,null))[_0x4eee('0x22')](respondWithResult(_0x594c74,null))[_0x4eee('0x42')](handleError(_0x594c74,null));};exports['create']=function(_0xcdb09b,_0x386820){return db[_0x4eee('0x29')][_0x4eee('0x47')](_0xcdb09b['body'],{})[_0x4eee('0x22')](respondWithResult(_0x386820,0xc9))[_0x4eee('0x42')](handleError(_0x386820,null));};exports['update']=function(_0x4fc06b,_0x40f302){if(_0x4fc06b[_0x4eee('0x48')]['id']){delete _0x4fc06b['body']['id'];}return db[_0x4eee('0x29')][_0x4eee('0x46')]({'where':{'id':_0x4fc06b[_0x4eee('0x44')]['id']}})[_0x4eee('0x22')](handleEntityNotFound(_0x40f302,null))[_0x4eee('0x22')](saveUpdates(_0x4fc06b['body'],null))[_0x4eee('0x22')](respondWithResult(_0x40f302,null))[_0x4eee('0x42')](handleError(_0x40f302,null));};exports[_0x4eee('0x23')]=function(_0x5136d3,_0x12d292){return db['Dynamics365Field'][_0x4eee('0x46')]({'where':{'id':_0x5136d3[_0x4eee('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d292,null))[_0x4eee('0x22')](removeEntity(_0x12d292,null))[_0x4eee('0x42')](handleError(_0x12d292,null));}; \ No newline at end of file +var _0x1c8c=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','Dynamics365Field','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1c8c,0xea));var _0xc1c8=function(_0x517e05,_0x322ae3){_0x517e05=_0x517e05-0x0;var _0x1e37a7=_0x1c8c[_0x517e05];return _0x1e37a7;};'use strict';var pdf=require(_0xc1c8('0x0'));var emlformat=require(_0xc1c8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc1c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c8('0x3'));var moment=require('moment');var BPromise=require(_0xc1c8('0x4'));var Mustache=require(_0xc1c8('0x5'));var util=require(_0xc1c8('0x6'));var path=require(_0xc1c8('0x7'));var sox=require(_0xc1c8('0x8'));var csv=require(_0xc1c8('0x9'));var ejs=require(_0xc1c8('0xa'));var fs=require('fs');var _=require(_0xc1c8('0xb'));var squel=require(_0xc1c8('0xc'));var crypto=require(_0xc1c8('0xd'));var jsforce=require(_0xc1c8('0xe'));var deskjs=require(_0xc1c8('0xf'));var toCsv=require(_0xc1c8('0x9'));var querystring=require('querystring');var Papa=require(_0xc1c8('0x10'));var Redis=require(_0xc1c8('0x11'));var authService=require(_0xc1c8('0x12'));var qs=require(_0xc1c8('0x13'));var as=require(_0xc1c8('0x14'));var hardwareService=require(_0xc1c8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xc1c8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc1c8('0x17'))['db'];function respondWithStatusCode(_0x4e5b28,_0x588e80){_0x588e80=_0x588e80||0xcc;return function(_0x55b6bc){if(_0x55b6bc){return _0x4e5b28[_0xc1c8('0x18')](_0x588e80);}return _0x4e5b28[_0xc1c8('0x19')](_0x588e80)[_0xc1c8('0x1a')]();};}function respondWithResult(_0x588b47,_0x3d05a3){_0x3d05a3=_0x3d05a3||0xc8;return function(_0x583dfa){if(_0x583dfa){return _0x588b47['status'](_0x3d05a3)['json'](_0x583dfa);}};}function respondWithFilteredResult(_0x2d0e85,_0x42d24d){return function(_0x4fb08a){if(_0x4fb08a){var _0x12bb84=_0x4fb08a[_0xc1c8('0x1b')],_0x5c039d=_0x42d24d[_0xc1c8('0x1c')],_0x1ab407=_0x42d24d['offset']+_0x42d24d[_0xc1c8('0x1d')],_0x47707d;if(_0x1ab407>=_0x12bb84){_0x1ab407=_0x12bb84;_0x47707d=0xc8;}else{_0x47707d=0xce;}_0x2d0e85['status'](_0x47707d);return _0x2d0e85[_0xc1c8('0x1e')](_0xc1c8('0x1f'),_0x5c039d+'-'+_0x1ab407+'/'+_0x12bb84)['json'](_0x4fb08a);}return null;};}function patchUpdates(_0x5d5c85){return function(_0x30f7f2){try{jsonpatch['apply'](_0x30f7f2,_0x5d5c85,!![]);}catch(_0x51e146){return BPromise[_0xc1c8('0x20')](_0x51e146);}return _0x30f7f2['save']();};}function saveUpdates(_0x45b639,_0xbe9c15){return function(_0x85e9c8){if(_0x85e9c8){return _0x85e9c8[_0xc1c8('0x21')](_0x45b639)[_0xc1c8('0x22')](function(_0x66c395){return _0x66c395;});}return null;};}function removeEntity(_0x2773e9,_0x51347b){return function(_0x396ffa){if(_0x396ffa){return _0x396ffa[_0xc1c8('0x23')]()[_0xc1c8('0x22')](function(){_0x2773e9[_0xc1c8('0x19')](0xcc)[_0xc1c8('0x1a')]();});}};}function handleEntityNotFound(_0x532203,_0x6ef663){return function(_0x23239f){if(!_0x23239f){_0x532203[_0xc1c8('0x18')](0x194);}return _0x23239f;};}function handleError(_0x200e71,_0x284c46){_0x284c46=_0x284c46||0x1f4;return function(_0x52ac45){logger[_0xc1c8('0x24')](_0x52ac45[_0xc1c8('0x25')]);if(_0x52ac45[_0xc1c8('0x26')]){delete _0x52ac45[_0xc1c8('0x26')];}_0x200e71[_0xc1c8('0x19')](_0x284c46)[_0xc1c8('0x27')](_0x52ac45);};}exports['index']=function(_0x4b6062,_0x179796){var _0x40ea92={},_0x2e90bd={},_0xc8f137={'count':0x0,'rows':[]};var _0x120ee2=_[_0xc1c8('0x28')](db[_0xc1c8('0x29')]['rawAttributes'],function(_0x1f87e1){return{'name':_0x1f87e1[_0xc1c8('0x2a')],'type':_0x1f87e1['type'][_0xc1c8('0x2b')]};});_0x2e90bd[_0xc1c8('0x2c')]=_[_0xc1c8('0x28')](_0x120ee2,'name');_0x2e90bd[_0xc1c8('0x2d')]=_[_0xc1c8('0x2e')](_0x4b6062['query']);_0x2e90bd[_0xc1c8('0x2f')]=_[_0xc1c8('0x30')](_0x2e90bd[_0xc1c8('0x2c')],_0x2e90bd[_0xc1c8('0x2d')]);_0x40ea92[_0xc1c8('0x31')]=_['intersection'](_0x2e90bd[_0xc1c8('0x2c')],qs[_0xc1c8('0x32')](_0x4b6062[_0xc1c8('0x2d')][_0xc1c8('0x32')]));_0x40ea92['attributes']=_0x40ea92[_0xc1c8('0x31')][_0xc1c8('0x33')]?_0x40ea92[_0xc1c8('0x31')]:_0x2e90bd[_0xc1c8('0x2c')];if(!_0x4b6062['query'][_0xc1c8('0x34')](_0xc1c8('0x35'))){_0x40ea92[_0xc1c8('0x1d')]=qs[_0xc1c8('0x1d')](_0x4b6062[_0xc1c8('0x2d')][_0xc1c8('0x1d')]);_0x40ea92[_0xc1c8('0x1c')]=qs[_0xc1c8('0x1c')](_0x4b6062['query'][_0xc1c8('0x1c')]);}_0x40ea92[_0xc1c8('0x36')]=qs[_0xc1c8('0x37')](_0x4b6062[_0xc1c8('0x2d')]['sort']);_0x40ea92[_0xc1c8('0x38')]=qs[_0xc1c8('0x2f')](_['pick'](_0x4b6062[_0xc1c8('0x2d')],_0x2e90bd[_0xc1c8('0x2f')]),_0x120ee2);if(_0x4b6062[_0xc1c8('0x2d')]['filter']){_0x40ea92[_0xc1c8('0x38')]=_[_0xc1c8('0x39')](_0x40ea92[_0xc1c8('0x38')],{'$or':_['map'](_0x120ee2,function(_0x18b234){if(_0x18b234['type']!==_0xc1c8('0x3a')){var _0x5d8e3d={};_0x5d8e3d[_0x18b234[_0xc1c8('0x26')]]={'$like':'%'+_0x4b6062['query']['filter']+'%'};return _0x5d8e3d;}})});}_0x40ea92=_['merge']({},_0x40ea92,_0x4b6062[_0xc1c8('0x3b')]);var _0x1a6b7a={'where':_0x40ea92[_0xc1c8('0x38')]};return db[_0xc1c8('0x29')][_0xc1c8('0x1b')](_0x1a6b7a)[_0xc1c8('0x22')](function(_0x3005bf){_0xc8f137[_0xc1c8('0x1b')]=_0x3005bf;if(_0x4b6062[_0xc1c8('0x2d')]['includeAll']){_0x40ea92['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xc1c8('0x3c')](_0x40ea92);})[_0xc1c8('0x22')](function(_0x3a3b7a){_0xc8f137[_0xc1c8('0x3d')]=_0x3a3b7a;return _0xc8f137;})[_0xc1c8('0x22')](respondWithFilteredResult(_0x179796,_0x40ea92))['catch'](handleError(_0x179796,null));};exports[_0xc1c8('0x3e')]=function(_0x104495,_0x32a7ed){var _0x2ca279={'raw':!![],'where':{'id':_0x104495[_0xc1c8('0x3f')]['id']}},_0x2f7eeb={};_0x2f7eeb[_0xc1c8('0x2c')]=_['keys'](db['Dynamics365Field'][_0xc1c8('0x40')]);_0x2f7eeb['query']=_[_0xc1c8('0x2e')](_0x104495[_0xc1c8('0x2d')]);_0x2f7eeb[_0xc1c8('0x2f')]=_['intersection'](_0x2f7eeb[_0xc1c8('0x2c')],_0x2f7eeb[_0xc1c8('0x2d')]);_0x2ca279[_0xc1c8('0x31')]=_['intersection'](_0x2f7eeb[_0xc1c8('0x2c')],qs[_0xc1c8('0x32')](_0x104495['query']['fields']));_0x2ca279[_0xc1c8('0x31')]=_0x2ca279[_0xc1c8('0x31')][_0xc1c8('0x33')]?_0x2ca279['attributes']:_0x2f7eeb[_0xc1c8('0x2c')];if(_0x104495[_0xc1c8('0x2d')][_0xc1c8('0x41')]){_0x2ca279[_0xc1c8('0x42')]=[{'all':!![]}];}_0x2ca279=_['merge']({},_0x2ca279,_0x104495['options']);return db['Dynamics365Field'][_0xc1c8('0x43')](_0x2ca279)[_0xc1c8('0x22')](handleEntityNotFound(_0x32a7ed,null))[_0xc1c8('0x22')](respondWithResult(_0x32a7ed,null))[_0xc1c8('0x44')](handleError(_0x32a7ed,null));};exports['create']=function(_0x290db0,_0x4d62c7){return db['Dynamics365Field'][_0xc1c8('0x45')](_0x290db0['body'],{})[_0xc1c8('0x22')](respondWithResult(_0x4d62c7,0xc9))[_0xc1c8('0x44')](handleError(_0x4d62c7,null));};exports[_0xc1c8('0x21')]=function(_0x310e88,_0x3923c0){if(_0x310e88[_0xc1c8('0x46')]['id']){delete _0x310e88['body']['id'];}return db[_0xc1c8('0x29')][_0xc1c8('0x43')]({'where':{'id':_0x310e88[_0xc1c8('0x3f')]['id']}})[_0xc1c8('0x22')](handleEntityNotFound(_0x3923c0,null))[_0xc1c8('0x22')](saveUpdates(_0x310e88['body'],null))['then'](respondWithResult(_0x3923c0,null))['catch'](handleError(_0x3923c0,null));};exports[_0xc1c8('0x23')]=function(_0x2ffd8e,_0x4eed3e){return db[_0xc1c8('0x29')][_0xc1c8('0x43')]({'where':{'id':_0x2ffd8e[_0xc1c8('0x3f')]['id']}})[_0xc1c8('0x22')](handleEntityNotFound(_0x4eed3e,null))[_0xc1c8('0x22')](removeEntity(_0x4eed3e,null))[_0xc1c8('0x44')](handleError(_0x4eed3e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1fe6423..a36ce1f 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 _0x6213=['define','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','exports'];(function(_0x49496b,_0x5da8c0){var _0x96c516=function(_0x1ce6f4){while(--_0x1ce6f4){_0x49496b['push'](_0x49496b['shift']());}};_0x96c516(++_0x5da8c0);}(_0x6213,0xba));var _0x3621=function(_0x45cb11,_0x2c8ad2){_0x45cb11=_0x45cb11-0x0;var _0x11710a=_0x6213[_0x45cb11];return _0x11710a;};'use strict';var _=require(_0x3621('0x0'));var util=require(_0x3621('0x1'));var logger=require(_0x3621('0x2'))(_0x3621('0x3'));var moment=require(_0x3621('0x4'));var BPromise=require(_0x3621('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3621('0x6'));var rimraf=require(_0x3621('0x7'));var config=require('../../config/environment');var attributes=require(_0x3621('0x8'));module[_0x3621('0x9')]=function(_0x26645b,_0x2b2781){return _0x26645b[_0x3621('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x3621('0xb'),'fields':[_0x3621('0xc'),_0x3621('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb29d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x4dccbe,_0x5a8cb6){var _0x27d26a=function(_0x4a7a2e){while(--_0x4a7a2e){_0x4dccbe['push'](_0x4dccbe['shift']());}};_0x27d26a(++_0x5a8cb6);}(_0xb29d,0x1ef));var _0xdb29=function(_0x46d602,_0x379fe3){_0x46d602=_0x46d602-0x0;var _0x5bc563=_0xb29d[_0x46d602];return _0x5bc563;};'use strict';var _=require(_0xdb29('0x0'));var util=require(_0xdb29('0x1'));var logger=require('../../config/logger')(_0xdb29('0x2'));var moment=require('moment');var BPromise=require(_0xdb29('0x3'));var rp=require(_0xdb29('0x4'));var fs=require('fs');var path=require(_0xdb29('0x5'));var rimraf=require(_0xdb29('0x6'));var config=require(_0xdb29('0x7'));var attributes=require(_0xdb29('0x8'));module[_0xdb29('0x9')]=function(_0x48f773,_0x45ac66){return _0x48f773[_0xdb29('0xa')]('Dynamics365Field',attributes,{'tableName':_0xdb29('0xb'),'paranoid':![],'indexes':[{'name':_0xdb29('0xc'),'fields':[_0xdb29('0xd'),_0xdb29('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index d8d4478..fbca5a4 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 _0x9e69=['rpc','../../config/environment','jayson/promise','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9e69,0x150));var _0x99e6=function(_0x2625c8,_0x21e402){_0x2625c8=_0x2625c8-0x0;var _0x41139e=_0x9e69[_0x2625c8];return _0x41139e;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var moment=require(_0x99e6('0x1'));var BPromise=require(_0x99e6('0x2'));var rs=require(_0x99e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99e6('0x4'))['db'];var utils=require(_0x99e6('0x5'));var logger=require('../../config/logger')(_0x99e6('0x6'));var config=require(_0x99e6('0x7'));var jayson=require(_0x99e6('0x8'));var client=jayson['client'][_0x99e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cf241,_0x41635b,_0x58eb2d){return new BPromise(function(_0x3424c5,_0x305140){return client['request'](_0x3cf241,_0x58eb2d)[_0x99e6('0xa')](function(_0x133169){logger['info'](_0x99e6('0xb'),_0x41635b,_0x99e6('0xc'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x41635b,_0x99e6('0xc'),JSON[_0x99e6('0xd')](_0x133169));if(_0x133169[_0x99e6('0xe')]){if(_0x133169[_0x99e6('0xe')][_0x99e6('0xf')]===0x1f4){logger[_0x99e6('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x41635b,_0x133169[_0x99e6('0xe')][_0x99e6('0x10')]);return _0x305140(_0x133169[_0x99e6('0xe')]['message']);}logger[_0x99e6('0xe')](_0x99e6('0xb'),_0x41635b,_0x133169[_0x99e6('0xe')]['message']);return _0x3424c5(_0x133169['error']['message']);}else{logger[_0x99e6('0x11')](_0x99e6('0xb'),_0x41635b,_0x99e6('0xc'));_0x3424c5(_0x133169['result'][_0x99e6('0x10')]);}})[_0x99e6('0x12')](function(_0xebfd62){logger[_0x99e6('0xe')](_0x99e6('0xb'),_0x41635b,_0xebfd62);_0x305140(_0xebfd62);});});} \ No newline at end of file +var _0x39d2=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xadcfdc,_0x4bd341){var _0x119c5e=function(_0x38f458){while(--_0x38f458){_0xadcfdc['push'](_0xadcfdc['shift']());}};_0x119c5e(++_0x4bd341);}(_0x39d2,0xf5));var _0x239d=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x39d2[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var moment=require(_0x239d('0x1'));var BPromise=require(_0x239d('0x2'));var rs=require(_0x239d('0x3'));var fs=require('fs');var Redis=require(_0x239d('0x4'));var db=require(_0x239d('0x5'))['db'];var utils=require(_0x239d('0x6'));var logger=require(_0x239d('0x7'))(_0x239d('0x8'));var config=require(_0x239d('0x9'));var jayson=require(_0x239d('0xa'));var client=jayson[_0x239d('0xb')][_0x239d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f0947,_0x53d457,_0x262efe){return new BPromise(function(_0x2a6811,_0x3f9948){return client[_0x239d('0xd')](_0x1f0947,_0x262efe)[_0x239d('0xe')](function(_0x3d7f32){logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));logger[_0x239d('0x12')](_0x239d('0x13'),_0x53d457,_0x239d('0x11'),JSON[_0x239d('0x14')](_0x3d7f32));if(_0x3d7f32[_0x239d('0x15')]){if(_0x3d7f32[_0x239d('0x15')]['code']===0x1f4){logger['error'](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x3f9948(_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);}logger[_0x239d('0x15')](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x2a6811(_0x3d7f32['error'][_0x239d('0x16')]);}else{logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));_0x2a6811(_0x3d7f32[_0x239d('0x17')]['message']);}})['catch'](function(_0x141582){logger['error'](_0x239d('0x10'),_0x53d457,_0x141582);_0x3f9948(_0x141582);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 11212a3..96bd761 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 _0x442d=['index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x811ad,_0x1faa85){var _0x2a610d=function(_0x26e1cb){while(--_0x26e1cb){_0x811ad['push'](_0x811ad['shift']());}};_0x2a610d(++_0x1faa85);}(_0x442d,0xd6));var _0xd442=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x442d[_0x3fb030];return _0xd6899b;};'use strict';var multer=require(_0xd442('0x0'));var util=require(_0xd442('0x1'));var path=require('path');var timeout=require(_0xd442('0x2'));var express=require(_0xd442('0x3'));var router=express['Router']();var auth=require(_0xd442('0x4'));var interaction=require(_0xd442('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd442('0x6')]);router['get'](_0xd442('0x7'),auth[_0xd442('0x8')](),controller[_0xd442('0x9')]);router[_0xd442('0xa')](_0xd442('0xb'),auth[_0xd442('0x8')](),controller[_0xd442('0xc')]);router[_0xd442('0xa')](_0xd442('0xd'),auth[_0xd442('0x8')](),controller[_0xd442('0xe')]);router[_0xd442('0xf')]('/',auth[_0xd442('0x8')](),controller[_0xd442('0x10')]);router['post']('/:id/configurations',auth[_0xd442('0x8')](),controller[_0xd442('0x11')]);router['put'](_0xd442('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xd442('0x12')](_0xd442('0x7'),auth[_0xd442('0x8')](),controller[_0xd442('0x13')]);module['exports']=router; \ No newline at end of file +var _0x70e9=['create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e9,0xd7));var _0x970e=function(_0x11b010,_0x506ce7){_0x11b010=_0x11b010-0x0;var _0x3d80b0=_0x70e9[_0x11b010];return _0x3d80b0;};'use strict';var multer=require(_0x970e('0x0'));var util=require(_0x970e('0x1'));var path=require(_0x970e('0x2'));var timeout=require('connect-timeout');var express=require(_0x970e('0x3'));var router=express[_0x970e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x970e('0x5'));var config=require(_0x970e('0x6'));var controller=require(_0x970e('0x7'));router[_0x970e('0x8')]('/',auth[_0x970e('0x9')](),controller[_0x970e('0xa')]);router[_0x970e('0x8')]('/:id',auth[_0x970e('0x9')](),controller[_0x970e('0xb')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x970e('0xc')]);router[_0x970e('0x8')](_0x970e('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x970e('0xe')]('/',auth[_0x970e('0x9')](),controller[_0x970e('0xf')]);router[_0x970e('0xe')](_0x970e('0x10'),auth[_0x970e('0x9')](),controller[_0x970e('0x11')]);router['put'](_0x970e('0x12'),auth[_0x970e('0x9')](),controller[_0x970e('0x13')]);router[_0x970e('0x14')]('/:id',auth[_0x970e('0x9')](),controller[_0x970e('0x15')]);module[_0x970e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4a26a89..d4895c1 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 _0xea9c=['STRING','sequelize'];(function(_0x3bdefa,_0x2c38be){var _0x4ddf04=function(_0x341c17){while(--_0x341c17){_0x3bdefa['push'](_0x3bdefa['shift']());}};_0x4ddf04(++_0x2c38be);}(_0xea9c,0x117));var _0xcea9=function(_0x5cbe3d,_0x5bce46){_0x5cbe3d=_0x5cbe3d-0x0;var _0x554db8=_0xea9c[_0x5cbe3d];return _0x554db8;};'use strict';var Sequelize=require(_0xcea9('0x0'));module['exports']={'name':{'type':Sequelize[_0xcea9('0x1')]},'description':{'type':Sequelize[_0xcea9('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcea9('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xcea9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe251=['STRING','username','remoteUri'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xe251,0x1e6));var _0x1e25=function(_0x1e8f9e,_0x148061){_0x1e8f9e=_0x1e8f9e-0x0;var _0x2cec83=_0xe251[_0x1e8f9e];return _0x2cec83;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1e25('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x1e25('0x1')},'apiKey':{'type':Sequelize[_0x1e25('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1e25('0x2')},'serverUrl':{'type':Sequelize[_0x1e25('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 336bea3..9bc024a 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 _0x7761=['sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','findAll','rows','show','length','includeAll','include','find','create','body','getConfigurations','findOne','params','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','info','result','catch'];(function(_0x2fdafb,_0x2e19b7){var _0x3f0060=function(_0x4707f6){while(--_0x4707f6){_0x2fdafb['push'](_0x2fdafb['shift']());}};_0x3f0060(++_0x2e19b7);}(_0x7761,0x151));var _0x1776=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7761[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1776('0x0'));var emlformat=require(_0x1776('0x1'));var rimraf=require(_0x1776('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1776('0x3'));var BPromise=require(_0x1776('0x4'));var Mustache=require(_0x1776('0x5'));var util=require('util');var path=require(_0x1776('0x6'));var sox=require(_0x1776('0x7'));var csv=require(_0x1776('0x8'));var ejs=require(_0x1776('0x9'));var fs=require('fs');var _=require(_0x1776('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1776('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1776('0xc'));var Papa=require(_0x1776('0xd'));var Redis=require(_0x1776('0xe'));var authService=require(_0x1776('0xf'));var qs=require(_0x1776('0x10'));var as=require(_0x1776('0x11'));var hardwareService=require(_0x1776('0x12'));var logger=require('../../config/logger')(_0x1776('0x13'));var utils=require(_0x1776('0x14'));var config=require(_0x1776('0x15'));var licenseUtil=require(_0x1776('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1776('0x17'));var jayson=require(_0x1776('0x18'));var client=jayson[_0x1776('0x19')][_0x1776('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5e2730,_0x2357c0,_0xf1dbd1,_0x9a0486){return new BPromise(function(_0x426b6d,_0x5a2573){var _0x5366f6=_0x9a0486||client;return _0x5366f6[_0x1776('0x1b')](_0x5e2730,_0xf1dbd1)[_0x1776('0x1c')](function(_0xa4dfa8){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2357c0,_0x1776('0x1d'));logger[_0x1776('0x1e')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2357c0,_0x1776('0x1d'),JSON[_0x1776('0x1f')](_0xa4dfa8));if(_0xa4dfa8[_0x1776('0x20')]){if(_0xa4dfa8[_0x1776('0x20')]['code']===0x1f4){logger[_0x1776('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x2357c0,_0xa4dfa8[_0x1776('0x20')][_0x1776('0x21')]);return _0x5a2573(_0xa4dfa8[_0x1776('0x20')][_0x1776('0x21')]);}logger[_0x1776('0x20')](_0x1776('0x22'),_0x2357c0,_0xa4dfa8[_0x1776('0x20')][_0x1776('0x21')]);return _0x426b6d(_0xa4dfa8[_0x1776('0x20')]['message']);}else{logger[_0x1776('0x23')](_0x1776('0x22'),_0x2357c0,_0x1776('0x1d'));_0x426b6d(_0xa4dfa8[_0x1776('0x24')][_0x1776('0x21')]);}})[_0x1776('0x25')](function(_0x96198){logger['error'](_0x1776('0x22'),_0x2357c0,_0x96198);_0x5a2573(_0x96198);});});}function respondWithStatusCode(_0x3a22ec,_0xf947da){_0xf947da=_0xf947da||0xcc;return function(_0x29b488){if(_0x29b488){return _0x3a22ec[_0x1776('0x26')](_0xf947da);}return _0x3a22ec[_0x1776('0x27')](_0xf947da)[_0x1776('0x28')]();};}function respondWithResult(_0x5a5b5a,_0x1fb3a6){_0x1fb3a6=_0x1fb3a6||0xc8;return function(_0x98d4a8){if(_0x98d4a8){return _0x5a5b5a[_0x1776('0x27')](_0x1fb3a6)[_0x1776('0x29')](_0x98d4a8);}};}function respondWithFilteredResult(_0x1b7b8f,_0x477658){return function(_0x46e741){if(_0x46e741){var _0x2e1d8b=_0x46e741['count'],_0x5b53b8=_0x477658[_0x1776('0x2a')],_0xd668d8=_0x477658['offset']+_0x477658[_0x1776('0x2b')],_0x5d6fb1;if(_0xd668d8>=_0x2e1d8b){_0xd668d8=_0x2e1d8b;_0x5d6fb1=0xc8;}else{_0x5d6fb1=0xce;}_0x1b7b8f[_0x1776('0x27')](_0x5d6fb1);return _0x1b7b8f[_0x1776('0x2c')](_0x1776('0x2d'),_0x5b53b8+'-'+_0xd668d8+'/'+_0x2e1d8b)['json'](_0x46e741);}return null;};}function patchUpdates(_0x440905){return function(_0x549b34){try{jsonpatch['apply'](_0x549b34,_0x440905,!![]);}catch(_0x50ffe8){return BPromise[_0x1776('0x2e')](_0x50ffe8);}return _0x549b34[_0x1776('0x2f')]();};}function saveUpdates(_0x193093,_0x551283){return function(_0x355845){if(_0x355845){return _0x355845[_0x1776('0x30')](_0x193093)[_0x1776('0x1c')](function(_0x2489bd){return _0x2489bd;});}return null;};}function removeEntity(_0x1fa40e,_0x4a4f14){return function(_0x36bf31){if(_0x36bf31){return _0x36bf31[_0x1776('0x31')]()[_0x1776('0x1c')](function(){_0x1fa40e[_0x1776('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17c39e,_0x578cd0){return function(_0x35a970){if(!_0x35a970){_0x17c39e[_0x1776('0x26')](0x194);}return _0x35a970;};}function handleError(_0x5c0f61,_0xa0fc42){_0xa0fc42=_0xa0fc42||0x1f4;return function(_0x322545){logger['error'](_0x322545['stack']);if(_0x322545[_0x1776('0x32')]){delete _0x322545[_0x1776('0x32')];}_0x5c0f61[_0x1776('0x27')](_0xa0fc42)[_0x1776('0x33')](_0x322545);};}exports['index']=function(_0x3522b,_0x851400){var _0xc05e37={},_0x9328b1={},_0x3e9c67={'count':0x0,'rows':[]};var _0x56a0ab=_['map'](db[_0x1776('0x34')][_0x1776('0x35')],function(_0x1dd49d){return{'name':_0x1dd49d[_0x1776('0x36')],'type':_0x1dd49d[_0x1776('0x37')]['key']};});_0x9328b1[_0x1776('0x38')]=_[_0x1776('0x39')](_0x56a0ab,_0x1776('0x32'));_0x9328b1[_0x1776('0x3a')]=_[_0x1776('0x3b')](_0x3522b[_0x1776('0x3a')]);_0x9328b1[_0x1776('0x3c')]=_[_0x1776('0x3d')](_0x9328b1[_0x1776('0x38')],_0x9328b1[_0x1776('0x3a')]);_0xc05e37['attributes']=_[_0x1776('0x3d')](_0x9328b1[_0x1776('0x38')],qs[_0x1776('0x3e')](_0x3522b[_0x1776('0x3a')][_0x1776('0x3e')]));_0xc05e37[_0x1776('0x3f')]=_0xc05e37[_0x1776('0x3f')]['length']?_0xc05e37['attributes']:_0x9328b1[_0x1776('0x38')];if(!_0x3522b['query']['hasOwnProperty'](_0x1776('0x40'))){_0xc05e37[_0x1776('0x2b')]=qs[_0x1776('0x2b')](_0x3522b[_0x1776('0x3a')][_0x1776('0x2b')]);_0xc05e37['offset']=qs[_0x1776('0x2a')](_0x3522b[_0x1776('0x3a')][_0x1776('0x2a')]);}_0xc05e37[_0x1776('0x41')]=qs[_0x1776('0x42')](_0x3522b[_0x1776('0x3a')][_0x1776('0x42')]);_0xc05e37[_0x1776('0x43')]=qs[_0x1776('0x3c')](_[_0x1776('0x44')](_0x3522b['query'],_0x9328b1[_0x1776('0x3c')]),_0x56a0ab);if(_0x3522b[_0x1776('0x3a')]['filter']){_0xc05e37['where']=_[_0x1776('0x45')](_0xc05e37['where'],{'$or':_[_0x1776('0x39')](_0x56a0ab,function(_0x353e97){if(_0x353e97[_0x1776('0x37')]!==_0x1776('0x46')){var _0x21a441={};_0x21a441[_0x353e97[_0x1776('0x32')]]={'$like':'%'+_0x3522b[_0x1776('0x3a')][_0x1776('0x47')]+'%'};return _0x21a441;}})});}_0xc05e37=_[_0x1776('0x45')]({},_0xc05e37,_0x3522b[_0x1776('0x48')]);var _0x245958={'where':_0xc05e37['where']};return db[_0x1776('0x34')]['count'](_0x245958)[_0x1776('0x1c')](function(_0x289c3a){_0x3e9c67[_0x1776('0x49')]=_0x289c3a;if(_0x3522b[_0x1776('0x3a')]['includeAll']){_0xc05e37['include']=[{'all':!![]}];}return db[_0x1776('0x34')][_0x1776('0x4a')](_0xc05e37);})[_0x1776('0x1c')](function(_0x5b11d0){_0x3e9c67[_0x1776('0x4b')]=_0x5b11d0;return _0x3e9c67;})[_0x1776('0x1c')](respondWithFilteredResult(_0x851400,_0xc05e37))[_0x1776('0x25')](handleError(_0x851400,null));};exports[_0x1776('0x4c')]=function(_0x2bb41c,_0x545bdc){var _0x550f46={'raw':![],'where':{'id':_0x2bb41c['params']['id']}},_0x1d6f7c={};_0x1d6f7c[_0x1776('0x38')]=_[_0x1776('0x3b')](db[_0x1776('0x34')][_0x1776('0x35')]);_0x1d6f7c[_0x1776('0x3a')]=_[_0x1776('0x3b')](_0x2bb41c[_0x1776('0x3a')]);_0x1d6f7c[_0x1776('0x3c')]=_[_0x1776('0x3d')](_0x1d6f7c[_0x1776('0x38')],_0x1d6f7c[_0x1776('0x3a')]);_0x550f46[_0x1776('0x3f')]=_[_0x1776('0x3d')](_0x1d6f7c[_0x1776('0x38')],qs[_0x1776('0x3e')](_0x2bb41c['query'][_0x1776('0x3e')]));_0x550f46[_0x1776('0x3f')]=_0x550f46[_0x1776('0x3f')][_0x1776('0x4d')]?_0x550f46[_0x1776('0x3f')]:_0x1d6f7c['model'];if(_0x2bb41c[_0x1776('0x3a')][_0x1776('0x4e')]){_0x550f46[_0x1776('0x4f')]=[{'all':!![]}];}_0x550f46=_[_0x1776('0x45')]({},_0x550f46,_0x2bb41c['options']);return db[_0x1776('0x34')][_0x1776('0x50')](_0x550f46)['then'](handleEntityNotFound(_0x545bdc,null))['then'](respondWithResult(_0x545bdc,null))[_0x1776('0x25')](handleError(_0x545bdc,null));};exports[_0x1776('0x51')]=function(_0x1a4dcd,_0x1e03e1){return db['FreshdeskAccount'][_0x1776('0x51')](_0x1a4dcd[_0x1776('0x52')],{})[_0x1776('0x1c')](respondWithResult(_0x1e03e1,0xc9))['catch'](handleError(_0x1e03e1,null));};exports[_0x1776('0x30')]=function(_0x1fde04,_0x5f46c1){if(_0x1fde04['body']['id']){delete _0x1fde04['body']['id'];}return db[_0x1776('0x34')]['find']({'where':{'id':_0x1fde04['params']['id']}})['then'](handleEntityNotFound(_0x5f46c1,null))['then'](saveUpdates(_0x1fde04[_0x1776('0x52')],null))[_0x1776('0x1c')](respondWithResult(_0x5f46c1,null))['catch'](handleError(_0x5f46c1,null));};exports[_0x1776('0x31')]=function(_0xad3bac,_0x430ca3){return db[_0x1776('0x34')]['find']({'where':{'id':_0xad3bac['params']['id']}})[_0x1776('0x1c')](handleEntityNotFound(_0x430ca3,null))[_0x1776('0x1c')](removeEntity(_0x430ca3,null))['catch'](handleError(_0x430ca3,null));};exports[_0x1776('0x53')]=function(_0x266e99,_0x3559d1,_0x4a0867){var _0x34ee82={};var _0x341868={};var _0x5bdeee;var _0xe6914;return db['FreshdeskAccount'][_0x1776('0x54')]({'where':{'id':_0x266e99[_0x1776('0x55')]['id']}})[_0x1776('0x1c')](handleEntityNotFound(_0x3559d1,null))[_0x1776('0x1c')](function(_0x2bcd1c){if(_0x2bcd1c){_0x5bdeee=_0x2bcd1c;_0x341868[_0x1776('0x38')]=_[_0x1776('0x3b')](db['FreshdeskConfiguration'][_0x1776('0x35')]);_0x341868[_0x1776('0x3a')]=_[_0x1776('0x3b')](_0x266e99[_0x1776('0x3a')]);_0x341868[_0x1776('0x3c')]=_[_0x1776('0x3d')](_0x341868[_0x1776('0x38')],_0x341868[_0x1776('0x3a')]);_0x34ee82[_0x1776('0x3f')]=_[_0x1776('0x3d')](_0x341868['model'],qs[_0x1776('0x3e')](_0x266e99[_0x1776('0x3a')][_0x1776('0x3e')]));_0x34ee82[_0x1776('0x3f')]=_0x34ee82['attributes']['length']?_0x34ee82[_0x1776('0x3f')]:_0x341868[_0x1776('0x38')];_0x34ee82[_0x1776('0x41')]=qs[_0x1776('0x42')](_0x266e99[_0x1776('0x3a')][_0x1776('0x42')]);_0x34ee82[_0x1776('0x43')]=qs[_0x1776('0x3c')](_[_0x1776('0x44')](_0x266e99[_0x1776('0x3a')],_0x341868[_0x1776('0x3c')]));if(_0x266e99[_0x1776('0x3a')][_0x1776('0x47')]){_0x34ee82[_0x1776('0x43')]=_[_0x1776('0x45')](_0x34ee82[_0x1776('0x43')],{'$or':_[_0x1776('0x39')](_0x34ee82['attributes'],function(_0x48c615){var _0x3d3a0f={};_0x3d3a0f[_0x48c615]={'$like':'%'+_0x266e99[_0x1776('0x3a')]['filter']+'%'};return _0x3d3a0f;})});}_0x34ee82=_[_0x1776('0x45')]({},_0x34ee82,_0x266e99[_0x1776('0x48')]);return _0x5bdeee[_0x1776('0x53')](_0x34ee82);}})[_0x1776('0x1c')](function(_0x2caf72){if(_0x2caf72){_0xe6914=_0x2caf72[_0x1776('0x4d')];if(!_0x266e99[_0x1776('0x3a')][_0x1776('0x56')](_0x1776('0x40'))){_0x34ee82['limit']=qs[_0x1776('0x2b')](_0x266e99[_0x1776('0x3a')][_0x1776('0x2b')]);_0x34ee82[_0x1776('0x2a')]=qs[_0x1776('0x2a')](_0x266e99[_0x1776('0x3a')][_0x1776('0x2a')]);}return _0x5bdeee['getConfigurations'](_0x34ee82);}})['then'](function(_0x5e7a9b){if(_0x5e7a9b){return _0x5e7a9b?{'count':_0xe6914,'rows':_0x5e7a9b}:null;}})['then'](respondWithResult(_0x3559d1,null))['catch'](handleError(_0x3559d1,null));};exports[_0x1776('0x57')]=function(_0x188e58,_0x2842b2,_0x14f5c1){if(_0x188e58[_0x1776('0x52')]['id']){delete _0x188e58[_0x1776('0x52')]['id'];}return db[_0x1776('0x34')]['findOne']({'where':{'id':_0x188e58[_0x1776('0x55')]['id']}})[_0x1776('0x1c')](handleEntityNotFound(_0x2842b2,null))[_0x1776('0x1c')](function(_0xd559a1){if(_0xd559a1){_0x188e58[_0x1776('0x52')][_0x1776('0x58')]=_0xd559a1['id'];_0x188e58[_0x1776('0x52')][_0x1776('0x59')]=integrations[_0x1776('0x5a')](_0x188e58['body']['channel'],_0x188e58[_0x1776('0x52')]['type']);_0x188e58[_0x1776('0x52')]['Descriptions']=integrations[_0x1776('0x5b')](_0x188e58[_0x1776('0x52')][_0x1776('0x5c')],_0x188e58[_0x1776('0x52')]['type']);return db[_0x1776('0x5d')]['create'](_0x188e58['body'],{'include':[{'model':db[_0x1776('0x5e')],'as':_0x1776('0x59')},{'model':db[_0x1776('0x5e')],'as':'Descriptions'}]});}return null;})[_0x1776('0x1c')](respondWithResult(_0x2842b2,null))[_0x1776('0x25')](handleError(_0x2842b2,null));};exports[_0x1776('0x5f')]=function(_0x1cf64b,_0x15db49,_0xe616ff){var _0x1ffb41='';return db[_0x1776('0x34')]['findOne']({'where':{'id':_0x1cf64b[_0x1776('0x55')]['id']},'attributes':['id',_0x1776('0x60'),_0x1776('0x61')]})[_0x1776('0x1c')](handleEntityNotFound(_0x15db49,null))[_0x1776('0x1c')](function(_0x37bc51){if(_0x37bc51){_0x1ffb41=_0x37bc51[_0x1776('0x60')];var _0x194953=_0x1ffb41[_0x1776('0x62')](-0x1);if(_0x194953==='/'){_0x1ffb41=_0x1ffb41['substring'](0x0,_0x1ffb41[_0x1776('0x63')](_0x194953));}return rp({'method':_0x1776('0x64'),'uri':util[_0x1776('0x65')]('%s/%s',_0x1ffb41,_0x1776('0x66')),'headers':{'Authorization':util[_0x1776('0x65')](_0x1776('0x67'),new Buffer(util[_0x1776('0x65')]('%s:X',_0x37bc51[_0x1776('0x61')]))[_0x1776('0x68')](_0x1776('0x69')))},'json':!![]});}})[_0x1776('0x1c')](function(_0xe0955c){if(_0xe0955c){var _0x43f89b=[_0x1776('0x6a'),_0x1776('0x6b'),_0x1776('0x6c'),_0x1776('0x6d'),'status',_0x1776('0x6e'),_0x1776('0x6f'),_0x1776('0x70'),_0x1776('0x71'),_0x1776('0x6f'),_0x1776('0x72')];_['remove'](_0xe0955c,function(_0x3a16c8){return _0x43f89b[_0x1776('0x73')](_0x3a16c8[_0x1776('0x32')])||!_0x3a16c8[_0x1776('0x74')]&&_0x3a16c8['type']!==_0x1776('0x75')&&_0x3a16c8['type']!==_0x1776('0x76');});return{'count':_0xe0955c['length'],'rows':_[_0x1776('0x39')](_0xe0955c,function(_0x2d76fe){return{'id':_0x2d76fe[_0x1776('0x32')],'name':_0x2d76fe[_0x1776('0x77')],'custom':!_0x2d76fe[_0x1776('0x74')],'options':_0x2d76fe[_0x1776('0x78')]?_[_0x1776('0x39')](_0x2d76fe[_0x1776('0x78')],function(_0x222319){return{'name':_[_0x1776('0x79')](_0x222319),'value':_0x222319};}):[]};})};}})['then'](respondWithResult(_0x15db49,null))[_0x1776('0x25')](function(_0x2168ed){var _0xf8254f=_0x1cf64b[_0x1776('0x3a')]['test']?0x1f4:_0x2168ed[_0x1776('0x7a')]||0x1f4;logger[_0x1776('0x20')](_0x1776('0x7b'),_0x1776('0x5f'),_0xf8254f,JSON[_0x1776('0x1f')](_0x2168ed));delete _0x2168ed[_0x1776('0x32')];if(_0xf8254f===0x191){_0xf8254f=0x190;}_0x15db49['status'](_0xf8254f)[_0x1776('0x33')](_0x1cf64b['query'][_0x1776('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x2168ed[_0x1776('0x7a')]}:_0x2168ed);});}; \ No newline at end of file +var _0x415e=['base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString'];(function(_0x4c8c3f,_0xdbb5d5){var _0x480c40=function(_0x3a7ab3){while(--_0x3a7ab3){_0x4c8c3f['push'](_0x4c8c3f['shift']());}};_0x480c40(++_0xdbb5d5);}(_0x415e,0x115));var _0xe415=function(_0x5e66b0,_0x5bef62){_0x5e66b0=_0x5e66b0-0x0;var _0x9a3372=_0x415e[_0x5e66b0];return _0x9a3372;};'use strict';var pdf=require(_0xe415('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe415('0x1'));var zipdir=require(_0xe415('0x2'));var jsonpatch=require(_0xe415('0x3'));var rp=require(_0xe415('0x4'));var moment=require(_0xe415('0x5'));var BPromise=require(_0xe415('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe415('0x7'));var sox=require('sox');var csv=require(_0xe415('0x8'));var ejs=require(_0xe415('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe415('0xa'));var crypto=require(_0xe415('0xb'));var jsforce=require(_0xe415('0xc'));var deskjs=require(_0xe415('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe415('0xe'));var Papa=require(_0xe415('0xf'));var Redis=require(_0xe415('0x10'));var authService=require(_0xe415('0x11'));var qs=require(_0xe415('0x12'));var as=require(_0xe415('0x13'));var hardwareService=require(_0xe415('0x14'));var logger=require(_0xe415('0x15'))(_0xe415('0x16'));var utils=require(_0xe415('0x17'));var config=require(_0xe415('0x18'));var licenseUtil=require(_0xe415('0x19'));var db=require(_0xe415('0x1a'))['db'];var integrations=require(_0xe415('0x1b'));var jayson=require(_0xe415('0x1c'));var client=jayson[_0xe415('0x1d')][_0xe415('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x57b2f4,_0x1eb70f,_0x3906c2,_0x1a55e3){return new BPromise(function(_0x1afa54,_0x3de8e8){var _0x4b1a20=_0x1a55e3||client;return _0x4b1a20[_0xe415('0x1f')](_0x57b2f4,_0x3906c2)[_0xe415('0x20')](function(_0x3db63d){logger[_0xe415('0x21')](_0xe415('0x22'),_0x1eb70f,'request\x20sent');logger['debug'](_0xe415('0x23'),_0x1eb70f,_0xe415('0x24'),JSON[_0xe415('0x25')](_0x3db63d));if(_0x3db63d[_0xe415('0x26')]){if(_0x3db63d[_0xe415('0x26')][_0xe415('0x27')]===0x1f4){logger[_0xe415('0x26')](_0xe415('0x22'),_0x1eb70f,_0x3db63d[_0xe415('0x26')]['message']);return _0x3de8e8(_0x3db63d[_0xe415('0x26')][_0xe415('0x28')]);}logger[_0xe415('0x26')](_0xe415('0x22'),_0x1eb70f,_0x3db63d['error'][_0xe415('0x28')]);return _0x1afa54(_0x3db63d[_0xe415('0x26')][_0xe415('0x28')]);}else{logger[_0xe415('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x1eb70f,'request\x20sent');_0x1afa54(_0x3db63d[_0xe415('0x29')]['message']);}})['catch'](function(_0x28feaa){logger['error'](_0xe415('0x22'),_0x1eb70f,_0x28feaa);_0x3de8e8(_0x28feaa);});});}function respondWithStatusCode(_0x51620d,_0x58903a){_0x58903a=_0x58903a||0xcc;return function(_0x302283){if(_0x302283){return _0x51620d[_0xe415('0x2a')](_0x58903a);}return _0x51620d[_0xe415('0x2b')](_0x58903a)[_0xe415('0x2c')]();};}function respondWithResult(_0x3b92c5,_0x4b32e1){_0x4b32e1=_0x4b32e1||0xc8;return function(_0x36d5e2){if(_0x36d5e2){return _0x3b92c5[_0xe415('0x2b')](_0x4b32e1)['json'](_0x36d5e2);}};}function respondWithFilteredResult(_0x2c2b2c,_0x34bcda){return function(_0x53203e){if(_0x53203e){var _0xe143c3=_0x53203e['count'],_0x521a8d=_0x34bcda[_0xe415('0x2d')],_0x1cc77c=_0x34bcda['offset']+_0x34bcda[_0xe415('0x2e')],_0x13313b;if(_0x1cc77c>=_0xe143c3){_0x1cc77c=_0xe143c3;_0x13313b=0xc8;}else{_0x13313b=0xce;}_0x2c2b2c[_0xe415('0x2b')](_0x13313b);return _0x2c2b2c[_0xe415('0x2f')](_0xe415('0x30'),_0x521a8d+'-'+_0x1cc77c+'/'+_0xe143c3)[_0xe415('0x31')](_0x53203e);}return null;};}function patchUpdates(_0x39f94e){return function(_0x44bf17){try{jsonpatch[_0xe415('0x32')](_0x44bf17,_0x39f94e,!![]);}catch(_0x250848){return BPromise[_0xe415('0x33')](_0x250848);}return _0x44bf17[_0xe415('0x34')]();};}function saveUpdates(_0x3dabe9,_0x8e9b03){return function(_0x21caad){if(_0x21caad){return _0x21caad[_0xe415('0x35')](_0x3dabe9)['then'](function(_0xa61a41){return _0xa61a41;});}return null;};}function removeEntity(_0x4a0392,_0x3282ee){return function(_0x98713){if(_0x98713){return _0x98713[_0xe415('0x36')]()[_0xe415('0x20')](function(){_0x4a0392['status'](0xcc)[_0xe415('0x2c')]();});}};}function handleEntityNotFound(_0x23b931,_0x41fee4){return function(_0x50eebf){if(!_0x50eebf){_0x23b931[_0xe415('0x2a')](0x194);}return _0x50eebf;};}function handleError(_0x3fdadf,_0x1422f8){_0x1422f8=_0x1422f8||0x1f4;return function(_0x3ec0d9){logger[_0xe415('0x26')](_0x3ec0d9['stack']);if(_0x3ec0d9['name']){delete _0x3ec0d9[_0xe415('0x37')];}_0x3fdadf[_0xe415('0x2b')](_0x1422f8)[_0xe415('0x38')](_0x3ec0d9);};}exports[_0xe415('0x39')]=function(_0x220931,_0x49d654){var _0x1d8fb4={},_0x2c67bb={},_0x1ea72a={'count':0x0,'rows':[]};var _0x336b6b=_[_0xe415('0x3a')](db[_0xe415('0x3b')][_0xe415('0x3c')],function(_0x4cc48b){return{'name':_0x4cc48b[_0xe415('0x3d')],'type':_0x4cc48b['type'][_0xe415('0x3e')]};});_0x2c67bb['model']=_[_0xe415('0x3a')](_0x336b6b,_0xe415('0x37'));_0x2c67bb[_0xe415('0x3f')]=_[_0xe415('0x40')](_0x220931[_0xe415('0x3f')]);_0x2c67bb[_0xe415('0x41')]=_[_0xe415('0x42')](_0x2c67bb[_0xe415('0x43')],_0x2c67bb[_0xe415('0x3f')]);_0x1d8fb4[_0xe415('0x44')]=_[_0xe415('0x42')](_0x2c67bb[_0xe415('0x43')],qs[_0xe415('0x45')](_0x220931['query'][_0xe415('0x45')]));_0x1d8fb4[_0xe415('0x44')]=_0x1d8fb4[_0xe415('0x44')][_0xe415('0x46')]?_0x1d8fb4['attributes']:_0x2c67bb[_0xe415('0x43')];if(!_0x220931[_0xe415('0x3f')][_0xe415('0x47')](_0xe415('0x48'))){_0x1d8fb4[_0xe415('0x2e')]=qs[_0xe415('0x2e')](_0x220931[_0xe415('0x3f')][_0xe415('0x2e')]);_0x1d8fb4[_0xe415('0x2d')]=qs[_0xe415('0x2d')](_0x220931['query'][_0xe415('0x2d')]);}_0x1d8fb4[_0xe415('0x49')]=qs[_0xe415('0x4a')](_0x220931[_0xe415('0x3f')][_0xe415('0x4a')]);_0x1d8fb4[_0xe415('0x4b')]=qs[_0xe415('0x41')](_[_0xe415('0x4c')](_0x220931['query'],_0x2c67bb[_0xe415('0x41')]),_0x336b6b);if(_0x220931[_0xe415('0x3f')][_0xe415('0x4d')]){_0x1d8fb4[_0xe415('0x4b')]=_[_0xe415('0x4e')](_0x1d8fb4[_0xe415('0x4b')],{'$or':_[_0xe415('0x3a')](_0x336b6b,function(_0x4a714b){if(_0x4a714b[_0xe415('0x4f')]!==_0xe415('0x50')){var _0x4ae1bf={};_0x4ae1bf[_0x4a714b[_0xe415('0x37')]]={'$like':'%'+_0x220931[_0xe415('0x3f')][_0xe415('0x4d')]+'%'};return _0x4ae1bf;}})});}_0x1d8fb4=_[_0xe415('0x4e')]({},_0x1d8fb4,_0x220931[_0xe415('0x51')]);var _0x47d220={'where':_0x1d8fb4['where']};return db[_0xe415('0x3b')]['count'](_0x47d220)[_0xe415('0x20')](function(_0x30b2b5){_0x1ea72a['count']=_0x30b2b5;if(_0x220931['query'][_0xe415('0x52')]){_0x1d8fb4[_0xe415('0x53')]=[{'all':!![]}];}return db[_0xe415('0x3b')]['findAll'](_0x1d8fb4);})[_0xe415('0x20')](function(_0x12079e){_0x1ea72a[_0xe415('0x54')]=_0x12079e;return _0x1ea72a;})[_0xe415('0x20')](respondWithFilteredResult(_0x49d654,_0x1d8fb4))['catch'](handleError(_0x49d654,null));};exports['show']=function(_0x133b78,_0x38705b){var _0x29f8b6={'raw':![],'where':{'id':_0x133b78[_0xe415('0x55')]['id']}},_0x5ebae7={};_0x5ebae7[_0xe415('0x43')]=_['keys'](db[_0xe415('0x3b')]['rawAttributes']);_0x5ebae7[_0xe415('0x3f')]=_[_0xe415('0x40')](_0x133b78['query']);_0x5ebae7[_0xe415('0x41')]=_[_0xe415('0x42')](_0x5ebae7[_0xe415('0x43')],_0x5ebae7[_0xe415('0x3f')]);_0x29f8b6[_0xe415('0x44')]=_[_0xe415('0x42')](_0x5ebae7[_0xe415('0x43')],qs['fields'](_0x133b78['query'][_0xe415('0x45')]));_0x29f8b6['attributes']=_0x29f8b6[_0xe415('0x44')][_0xe415('0x46')]?_0x29f8b6[_0xe415('0x44')]:_0x5ebae7['model'];if(_0x133b78[_0xe415('0x3f')][_0xe415('0x52')]){_0x29f8b6[_0xe415('0x53')]=[{'all':!![]}];}_0x29f8b6=_[_0xe415('0x4e')]({},_0x29f8b6,_0x133b78[_0xe415('0x51')]);return db[_0xe415('0x3b')][_0xe415('0x56')](_0x29f8b6)[_0xe415('0x20')](handleEntityNotFound(_0x38705b,null))[_0xe415('0x20')](respondWithResult(_0x38705b,null))[_0xe415('0x57')](handleError(_0x38705b,null));};exports['create']=function(_0x213f56,_0x5d9437){return db[_0xe415('0x3b')][_0xe415('0x58')](_0x213f56['body'],{})[_0xe415('0x20')](respondWithResult(_0x5d9437,0xc9))[_0xe415('0x57')](handleError(_0x5d9437,null));};exports[_0xe415('0x35')]=function(_0x5e5fab,_0x25a65d){if(_0x5e5fab[_0xe415('0x59')]['id']){delete _0x5e5fab['body']['id'];}return db[_0xe415('0x3b')][_0xe415('0x56')]({'where':{'id':_0x5e5fab[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x25a65d,null))[_0xe415('0x20')](saveUpdates(_0x5e5fab[_0xe415('0x59')],null))[_0xe415('0x20')](respondWithResult(_0x25a65d,null))['catch'](handleError(_0x25a65d,null));};exports[_0xe415('0x36')]=function(_0x402f60,_0x566155){return db[_0xe415('0x3b')][_0xe415('0x56')]({'where':{'id':_0x402f60[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x566155,null))['then'](removeEntity(_0x566155,null))['catch'](handleError(_0x566155,null));};exports[_0xe415('0x5a')]=function(_0x4b4be5,_0x299d22,_0x42210b){var _0xcff076={};var _0x582c3a={};var _0x35b6d4;var _0x27811d;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x4b4be5[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x299d22,null))[_0xe415('0x20')](function(_0x874929){if(_0x874929){_0x35b6d4=_0x874929;_0x582c3a[_0xe415('0x43')]=_['keys'](db['FreshdeskConfiguration'][_0xe415('0x3c')]);_0x582c3a['query']=_['keys'](_0x4b4be5[_0xe415('0x3f')]);_0x582c3a[_0xe415('0x41')]=_[_0xe415('0x42')](_0x582c3a[_0xe415('0x43')],_0x582c3a[_0xe415('0x3f')]);_0xcff076[_0xe415('0x44')]=_[_0xe415('0x42')](_0x582c3a[_0xe415('0x43')],qs['fields'](_0x4b4be5[_0xe415('0x3f')]['fields']));_0xcff076['attributes']=_0xcff076[_0xe415('0x44')]['length']?_0xcff076[_0xe415('0x44')]:_0x582c3a[_0xe415('0x43')];_0xcff076[_0xe415('0x49')]=qs[_0xe415('0x4a')](_0x4b4be5[_0xe415('0x3f')][_0xe415('0x4a')]);_0xcff076['where']=qs['filters'](_[_0xe415('0x4c')](_0x4b4be5[_0xe415('0x3f')],_0x582c3a[_0xe415('0x41')]));if(_0x4b4be5[_0xe415('0x3f')][_0xe415('0x4d')]){_0xcff076['where']=_[_0xe415('0x4e')](_0xcff076['where'],{'$or':_[_0xe415('0x3a')](_0xcff076[_0xe415('0x44')],function(_0x918b85){var _0xbf5c2e={};_0xbf5c2e[_0x918b85]={'$like':'%'+_0x4b4be5['query']['filter']+'%'};return _0xbf5c2e;})});}_0xcff076=_['merge']({},_0xcff076,_0x4b4be5[_0xe415('0x51')]);return _0x35b6d4[_0xe415('0x5a')](_0xcff076);}})[_0xe415('0x20')](function(_0x46ea63){if(_0x46ea63){_0x27811d=_0x46ea63['length'];if(!_0x4b4be5[_0xe415('0x3f')][_0xe415('0x47')](_0xe415('0x48'))){_0xcff076[_0xe415('0x2e')]=qs['limit'](_0x4b4be5[_0xe415('0x3f')][_0xe415('0x2e')]);_0xcff076[_0xe415('0x2d')]=qs[_0xe415('0x2d')](_0x4b4be5['query'][_0xe415('0x2d')]);}return _0x35b6d4[_0xe415('0x5a')](_0xcff076);}})[_0xe415('0x20')](function(_0x24a9c3){if(_0x24a9c3){return _0x24a9c3?{'count':_0x27811d,'rows':_0x24a9c3}:null;}})['then'](respondWithResult(_0x299d22,null))[_0xe415('0x57')](handleError(_0x299d22,null));};exports[_0xe415('0x5b')]=function(_0x7d5b63,_0x41ed24,_0x56d681){if(_0x7d5b63[_0xe415('0x59')]['id']){delete _0x7d5b63['body']['id'];}return db['FreshdeskAccount'][_0xe415('0x5c')]({'where':{'id':_0x7d5b63[_0xe415('0x55')]['id']}})[_0xe415('0x20')](handleEntityNotFound(_0x41ed24,null))[_0xe415('0x20')](function(_0x4e9b60){if(_0x4e9b60){_0x7d5b63['body'][_0xe415('0x5d')]=_0x4e9b60['id'];_0x7d5b63[_0xe415('0x59')][_0xe415('0x5e')]=integrations['getSubjects'](_0x7d5b63[_0xe415('0x59')][_0xe415('0x5f')],_0x7d5b63[_0xe415('0x59')][_0xe415('0x4f')]);_0x7d5b63['body'][_0xe415('0x60')]=integrations[_0xe415('0x61')](_0x7d5b63[_0xe415('0x59')][_0xe415('0x5f')],_0x7d5b63['body']['type']);return db['FreshdeskConfiguration']['create'](_0x7d5b63[_0xe415('0x59')],{'include':[{'model':db['FreshdeskField'],'as':_0xe415('0x5e')},{'model':db[_0xe415('0x62')],'as':_0xe415('0x60')}]});}return null;})[_0xe415('0x20')](respondWithResult(_0x41ed24,null))[_0xe415('0x57')](handleError(_0x41ed24,null));};exports[_0xe415('0x63')]=function(_0x3a63b1,_0x284c29,_0x5c3150){var _0x3495f6='';return db[_0xe415('0x3b')][_0xe415('0x5c')]({'where':{'id':_0x3a63b1[_0xe415('0x55')]['id']},'attributes':['id',_0xe415('0x64'),_0xe415('0x65')]})[_0xe415('0x20')](handleEntityNotFound(_0x284c29,null))[_0xe415('0x20')](function(_0x2fe195){if(_0x2fe195){_0x3495f6=_0x2fe195['remoteUri'];var _0x12c79b=_0x3495f6[_0xe415('0x66')](-0x1);if(_0x12c79b==='/'){_0x3495f6=_0x3495f6['substring'](0x0,_0x3495f6[_0xe415('0x67')](_0x12c79b));}return rp({'method':_0xe415('0x68'),'uri':util[_0xe415('0x69')](_0xe415('0x6a'),_0x3495f6,_0xe415('0x6b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe415('0x69')](_0xe415('0x6c'),_0x2fe195['apiKey']))[_0xe415('0x6d')](_0xe415('0x6e')))},'json':!![]});}})[_0xe415('0x20')](function(_0xcee498){if(_0xcee498){var _0xe3b3f6=[_0xe415('0x6f'),_0xe415('0x70'),_0xe415('0x71'),_0xe415('0x72'),_0xe415('0x2b'),_0xe415('0x73'),_0xe415('0x74'),'source',_0xe415('0x75'),_0xe415('0x74'),_0xe415('0x76')];_[_0xe415('0x77')](_0xcee498,function(_0x192a39){return _0xe3b3f6['includes'](_0x192a39[_0xe415('0x37')])||!_0x192a39[_0xe415('0x78')]&&_0x192a39[_0xe415('0x4f')]!==_0xe415('0x79')&&_0x192a39[_0xe415('0x4f')]!=='custom_dropdown';});return{'count':_0xcee498[_0xe415('0x46')],'rows':_[_0xe415('0x3a')](_0xcee498,function(_0x38d746){return{'id':_0x38d746['name'],'name':_0x38d746[_0xe415('0x7a')],'custom':!_0x38d746[_0xe415('0x78')],'options':_0x38d746[_0xe415('0x7b')]?_[_0xe415('0x3a')](_0x38d746['choices'],function(_0x2d3aca){return{'name':_[_0xe415('0x7c')](_0x2d3aca),'value':_0x2d3aca};}):[]};})};}})[_0xe415('0x20')](respondWithResult(_0x284c29,null))[_0xe415('0x57')](function(_0x4d4a10){var _0x3b5ac2=_0x3a63b1[_0xe415('0x3f')]['test']?0x1f4:_0x4d4a10[_0xe415('0x7d')]||0x1f4;logger[_0xe415('0x26')](_0xe415('0x7e'),_0xe415('0x63'),_0x3b5ac2,JSON['stringify'](_0x4d4a10));delete _0x4d4a10[_0xe415('0x37')];if(_0x3b5ac2===0x191){_0x3b5ac2=0x190;}_0x284c29[_0xe415('0x2b')](_0x3b5ac2)[_0xe415('0x38')](_0x3a63b1['query'][_0xe415('0x7f')]?{'message':_0xe415('0x80'),'statusCode':_0x4d4a10[_0xe415('0x7d')]}:_0x4d4a10);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3f63ad7..77f1d6e 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 _0xd605=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x1eef48,_0x130aed){var _0xe29de8=function(_0x3a0bde){while(--_0x3a0bde){_0x1eef48['push'](_0x1eef48['shift']());}};_0xe29de8(++_0x130aed);}(_0xd605,0x1d7));var _0x5d60=function(_0x47bc5e,_0x47d59d){_0x47bc5e=_0x47bc5e-0x0;var _0x16f825=_0xd605[_0x47bc5e];return _0x16f825;};'use strict';var _=require(_0x5d60('0x0'));var util=require(_0x5d60('0x1'));var logger=require('../../config/logger')(_0x5d60('0x2'));var moment=require(_0x5d60('0x3'));var BPromise=require(_0x5d60('0x4'));var rp=require(_0x5d60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d60('0x6'));var config=require(_0x5d60('0x7'));var attributes=require(_0x5d60('0x8'));var integrations=require(_0x5d60('0x9'));module[_0x5d60('0xa')]=function(_0x2ba660,_0x542f09){return _0x2ba660[_0x5d60('0xb')](_0x5d60('0xc'),attributes,{'tableName':_0x5d60('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce1b=['../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_freshdesk_accounts','util'];(function(_0x3fc807,_0x46196e){var _0x2c8fd9=function(_0x371e67){while(--_0x371e67){_0x3fc807['push'](_0x3fc807['shift']());}};_0x2c8fd9(++_0x46196e);}(_0xce1b,0x149));var _0xbce1=function(_0x315ec1,_0x13d4ba){_0x315ec1=_0x315ec1-0x0;var _0xf6342d=_0xce1b[_0x315ec1];return _0xf6342d;};'use strict';var _=require('lodash');var util=require(_0xbce1('0x0'));var logger=require(_0xbce1('0x1'))(_0xbce1('0x2'));var moment=require(_0xbce1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbce1('0x4'));var rimraf=require(_0xbce1('0x5'));var config=require(_0xbce1('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xbce1('0x7'));module[_0xbce1('0x8')]=function(_0x404879,_0x40dc01){return _0x404879['define']('FreshdeskAccount',attributes,{'tableName':_0xbce1('0x9'),'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 5f89598..3a28ca7 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 _0xba00=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowFreshdeskAccount','find','lodash','bluebird'];(function(_0x497eea,_0x175ed0){var _0x344af4=function(_0x51b1ae){while(--_0x51b1ae){_0x497eea['push'](_0x497eea['shift']());}};_0x344af4(++_0x175ed0);}(_0xba00,0x15c));var _0x0ba0=function(_0x4399da,_0x50f86b){_0x4399da=_0x4399da-0x0;var _0x32dfa1=_0xba00[_0x4399da];return _0x32dfa1;};'use strict';var _=require(_0x0ba0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ba0('0x1'));var rs=require(_0x0ba0('0x2'));var fs=require('fs');var Redis=require(_0x0ba0('0x3'));var db=require(_0x0ba0('0x4'))['db'];var utils=require(_0x0ba0('0x5'));var logger=require(_0x0ba0('0x6'))('rpc');var config=require(_0x0ba0('0x7'));var jayson=require(_0x0ba0('0x8'));var client=jayson['client'][_0x0ba0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f8af3,_0x18de1d,_0x11f3e4){return new BPromise(function(_0xa9f857,_0x54b7d4){return client[_0x0ba0('0xa')](_0x1f8af3,_0x11f3e4)[_0x0ba0('0xb')](function(_0x551d9d){logger[_0x0ba0('0xc')](_0x0ba0('0xd'),_0x18de1d,'request\x20sent');logger[_0x0ba0('0xe')](_0x0ba0('0xf'),_0x18de1d,_0x0ba0('0x10'),JSON[_0x0ba0('0x11')](_0x551d9d));if(_0x551d9d['error']){if(_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x13')]===0x1f4){logger[_0x0ba0('0x12')](_0x0ba0('0xd'),_0x18de1d,_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x14')]);return _0x54b7d4(_0x551d9d[_0x0ba0('0x12')]['message']);}logger[_0x0ba0('0x12')](_0x0ba0('0xd'),_0x18de1d,_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x14')]);return _0xa9f857(_0x551d9d[_0x0ba0('0x12')][_0x0ba0('0x14')]);}else{logger[_0x0ba0('0xc')](_0x0ba0('0xd'),_0x18de1d,'request\x20sent');_0xa9f857(_0x551d9d[_0x0ba0('0x15')][_0x0ba0('0x14')]);}})[_0x0ba0('0x16')](function(_0x3f593a){logger['error'](_0x0ba0('0xd'),_0x18de1d,_0x3f593a);_0x54b7d4(_0x3f593a);});});}exports[_0x0ba0('0x17')]=function(_0x251f90){var _0x3b4ee0=this;return new Promise(function(_0x50d81c,_0x28ede5){return db['FreshdeskAccount'][_0x0ba0('0x18')]({'raw':_0x251f90['options']?_0x251f90[_0x0ba0('0x19')][_0x0ba0('0x1a')]===undefined?!![]:![]:!![],'where':_0x251f90[_0x0ba0('0x19')]?_0x251f90[_0x0ba0('0x19')][_0x0ba0('0x1b')]||null:null,'attributes':_0x251f90[_0x0ba0('0x19')]?_0x251f90[_0x0ba0('0x19')]['attributes']||null:null,'limit':_0x251f90[_0x0ba0('0x19')]?_0x251f90['options'][_0x0ba0('0x1c')]||null:null,'include':_0x251f90['options']?_0x251f90[_0x0ba0('0x19')][_0x0ba0('0x1d')]?_['map'](_0x251f90['options']['include'],function(_0x7463e3){return{'model':db[_0x7463e3[_0x0ba0('0x1e')]],'as':_0x7463e3['as'],'attributes':_0x7463e3['attributes'],'include':_0x7463e3[_0x0ba0('0x1d')]?_['map'](_0x7463e3[_0x0ba0('0x1d')],function(_0x3df913){return{'model':db[_0x3df913[_0x0ba0('0x1e')]],'as':_0x3df913['as'],'attributes':_0x3df913[_0x0ba0('0x1f')],'include':_0x3df913[_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x3df913[_0x0ba0('0x1d')],function(_0x52840d){return{'model':db[_0x52840d['model']],'as':_0x52840d['as'],'attributes':_0x52840d[_0x0ba0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0ba0('0xb')](function(_0x85bd05){logger[_0x0ba0('0xc')](_0x0ba0('0x17'),_0x251f90);logger[_0x0ba0('0xe')](_0x0ba0('0x17'),_0x251f90,JSON[_0x0ba0('0x11')](_0x85bd05));_0x50d81c(_0x85bd05);})[_0x0ba0('0x16')](function(_0x1e6af7){logger[_0x0ba0('0x12')](_0x0ba0('0x17'),_0x1e6af7[_0x0ba0('0x14')],_0x251f90);_0x28ede5(_0x3b4ee0['error'](0x1f4,_0x1e6af7[_0x0ba0('0x14')]));});});};exports[_0x0ba0('0x21')]=function(_0x40d1bd){var _0x29d385=this;return new Promise(function(_0x136954,_0x528dd5){return db['FreshdeskAccount'][_0x0ba0('0x22')]({'raw':_0x40d1bd[_0x0ba0('0x19')]?_0x40d1bd['options'][_0x0ba0('0x1a')]===undefined?!![]:![]:!![],'where':_0x40d1bd[_0x0ba0('0x19')]?_0x40d1bd[_0x0ba0('0x19')][_0x0ba0('0x1b')]||null:null,'attributes':_0x40d1bd['options']?_0x40d1bd['options'][_0x0ba0('0x1f')]||null:null,'include':_0x40d1bd[_0x0ba0('0x19')]?_0x40d1bd[_0x0ba0('0x19')][_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x40d1bd['options']['include'],function(_0x3a5cd0){return{'model':db[_0x3a5cd0['model']],'as':_0x3a5cd0['as'],'attributes':_0x3a5cd0[_0x0ba0('0x1f')],'include':_0x3a5cd0[_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x3a5cd0[_0x0ba0('0x1d')],function(_0x2d0e71){return{'model':db[_0x2d0e71[_0x0ba0('0x1e')]],'as':_0x2d0e71['as'],'attributes':_0x2d0e71['attributes'],'include':_0x2d0e71[_0x0ba0('0x1d')]?_[_0x0ba0('0x20')](_0x2d0e71[_0x0ba0('0x1d')],function(_0x11be89){return{'model':db[_0x11be89[_0x0ba0('0x1e')]],'as':_0x11be89['as'],'attributes':_0x11be89[_0x0ba0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0ba0('0xb')](function(_0x883ac5){logger[_0x0ba0('0xc')]('ShowFreshdeskAccount',_0x40d1bd);logger[_0x0ba0('0xe')](_0x0ba0('0x21'),_0x40d1bd,JSON[_0x0ba0('0x11')](_0x883ac5));_0x136954(_0x883ac5);})['catch'](function(_0x1518b4){logger[_0x0ba0('0x12')](_0x0ba0('0x21'),_0x1518b4[_0x0ba0('0x14')],_0x40d1bd);_0x528dd5(_0x29d385['error'](0x1f4,_0x1518b4[_0x0ba0('0x14')]));});});}; \ No newline at end of file +var _0xb249=['result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','info'];(function(_0x13cfa6,_0xb13f65){var _0x46f3a5=function(_0x47e198){while(--_0x47e198){_0x13cfa6['push'](_0x13cfa6['shift']());}};_0x46f3a5(++_0xb13f65);}(_0xb249,0x148));var _0x9b24=function(_0x5a3a24,_0x123c05){_0x5a3a24=_0x5a3a24-0x0;var _0x57a96f=_0xb249[_0x5a3a24];return _0x57a96f;};'use strict';var _=require(_0x9b24('0x0'));var util=require(_0x9b24('0x1'));var moment=require(_0x9b24('0x2'));var BPromise=require(_0x9b24('0x3'));var rs=require(_0x9b24('0x4'));var fs=require('fs');var Redis=require(_0x9b24('0x5'));var db=require(_0x9b24('0x6'))['db'];var utils=require(_0x9b24('0x7'));var logger=require(_0x9b24('0x8'))(_0x9b24('0x9'));var config=require(_0x9b24('0xa'));var jayson=require(_0x9b24('0xb'));var client=jayson[_0x9b24('0xc')][_0x9b24('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5aaeb5,_0x1d6fec,_0x5bdb53){return new BPromise(function(_0x48adfc,_0xc2c255){return client[_0x9b24('0xe')](_0x5aaeb5,_0x5bdb53)[_0x9b24('0xf')](function(_0x4383c4){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x1d6fec,_0x9b24('0x10'));logger['debug'](_0x9b24('0x11'),_0x1d6fec,_0x9b24('0x10'),JSON[_0x9b24('0x12')](_0x4383c4));if(_0x4383c4[_0x9b24('0x13')]){if(_0x4383c4[_0x9b24('0x13')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x1d6fec,_0x4383c4['error'][_0x9b24('0x14')]);return _0xc2c255(_0x4383c4['error'][_0x9b24('0x14')]);}logger['error'](_0x9b24('0x15'),_0x1d6fec,_0x4383c4[_0x9b24('0x13')][_0x9b24('0x14')]);return _0x48adfc(_0x4383c4[_0x9b24('0x13')][_0x9b24('0x14')]);}else{logger[_0x9b24('0x16')](_0x9b24('0x15'),_0x1d6fec,_0x9b24('0x10'));_0x48adfc(_0x4383c4[_0x9b24('0x17')][_0x9b24('0x14')]);}})[_0x9b24('0x18')](function(_0xbf4c65){logger[_0x9b24('0x13')](_0x9b24('0x15'),_0x1d6fec,_0xbf4c65);_0xc2c255(_0xbf4c65);});});}exports[_0x9b24('0x19')]=function(_0x41c702){var _0x4dbeb3=this;return new Promise(function(_0x292e22,_0x44d63b){return db[_0x9b24('0x1a')][_0x9b24('0x1b')]({'raw':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x1d')]===undefined?!![]:![]:!![],'where':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x1e')]||null:null,'attributes':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x1f')]||null:null,'limit':_0x41c702[_0x9b24('0x1c')]?_0x41c702[_0x9b24('0x1c')][_0x9b24('0x20')]||null:null,'include':_0x41c702[_0x9b24('0x1c')]?_0x41c702['options'][_0x9b24('0x21')]?_[_0x9b24('0x22')](_0x41c702[_0x9b24('0x1c')]['include'],function(_0x8293ac){return{'model':db[_0x8293ac[_0x9b24('0x23')]],'as':_0x8293ac['as'],'attributes':_0x8293ac[_0x9b24('0x1f')],'include':_0x8293ac[_0x9b24('0x21')]?_[_0x9b24('0x22')](_0x8293ac['include'],function(_0x59a0c7){return{'model':db[_0x59a0c7[_0x9b24('0x23')]],'as':_0x59a0c7['as'],'attributes':_0x59a0c7['attributes'],'include':_0x59a0c7[_0x9b24('0x21')]?_['map'](_0x59a0c7[_0x9b24('0x21')],function(_0x352691){return{'model':db[_0x352691[_0x9b24('0x23')]],'as':_0x352691['as'],'attributes':_0x352691[_0x9b24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9b24('0xf')](function(_0x2e53b8){logger[_0x9b24('0x16')](_0x9b24('0x19'),_0x41c702);logger[_0x9b24('0x24')](_0x9b24('0x19'),_0x41c702,JSON['stringify'](_0x2e53b8));_0x292e22(_0x2e53b8);})[_0x9b24('0x18')](function(_0x327901){logger[_0x9b24('0x13')](_0x9b24('0x19'),_0x327901[_0x9b24('0x14')],_0x41c702);_0x44d63b(_0x4dbeb3['error'](0x1f4,_0x327901[_0x9b24('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x6f57d6){var _0x37ad6a=this;return new Promise(function(_0x5e5bd0,_0x206e8b){return db[_0x9b24('0x1a')][_0x9b24('0x25')]({'raw':_0x6f57d6[_0x9b24('0x1c')]?_0x6f57d6[_0x9b24('0x1c')][_0x9b24('0x1d')]===undefined?!![]:![]:!![],'where':_0x6f57d6['options']?_0x6f57d6[_0x9b24('0x1c')]['where']||null:null,'attributes':_0x6f57d6[_0x9b24('0x1c')]?_0x6f57d6[_0x9b24('0x1c')][_0x9b24('0x1f')]||null:null,'include':_0x6f57d6[_0x9b24('0x1c')]?_0x6f57d6[_0x9b24('0x1c')]['include']?_[_0x9b24('0x22')](_0x6f57d6[_0x9b24('0x1c')][_0x9b24('0x21')],function(_0x314db1){return{'model':db[_0x314db1[_0x9b24('0x23')]],'as':_0x314db1['as'],'attributes':_0x314db1['attributes'],'include':_0x314db1[_0x9b24('0x21')]?_['map'](_0x314db1['include'],function(_0x44b5fd){return{'model':db[_0x44b5fd[_0x9b24('0x23')]],'as':_0x44b5fd['as'],'attributes':_0x44b5fd[_0x9b24('0x1f')],'include':_0x44b5fd[_0x9b24('0x21')]?_[_0x9b24('0x22')](_0x44b5fd[_0x9b24('0x21')],function(_0x45780a){return{'model':db[_0x45780a[_0x9b24('0x23')]],'as':_0x45780a['as'],'attributes':_0x45780a[_0x9b24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9b24('0xf')](function(_0x32fe7){logger['info']('ShowFreshdeskAccount',_0x6f57d6);logger[_0x9b24('0x24')](_0x9b24('0x26'),_0x6f57d6,JSON[_0x9b24('0x12')](_0x32fe7));_0x5e5bd0(_0x32fe7);})[_0x9b24('0x18')](function(_0x2ca30e){logger[_0x9b24('0x13')](_0x9b24('0x26'),_0x2ca30e['message'],_0x6f57d6);_0x206e8b(_0x37ad6a[_0x9b24('0x13')](0x1f4,_0x2ca30e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7760dc0..044deae 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 _0xb471=['getDescriptions','/:id/tags','post','setTags','put','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../config/environment','index','/:id','show','/:id/fields','isAuthenticated','getFields','get'];(function(_0x1cb9f8,_0xd964df){var _0x25cd75=function(_0x28a078){while(--_0x28a078){_0x1cb9f8['push'](_0x1cb9f8['shift']());}};_0x25cd75(++_0xd964df);}(_0xb471,0x1aa));var _0x1b47=function(_0x2d44bb,_0x4cfd30){_0x2d44bb=_0x2d44bb-0x0;var _0xc9861e=_0xb471[_0x2d44bb];return _0xc9861e;};'use strict';var multer=require('multer');var util=require(_0x1b47('0x0'));var path=require('path');var timeout=require(_0x1b47('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1b47('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1b47('0x3'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1b47('0x4')]);router['get'](_0x1b47('0x5'),auth['isAuthenticated'](),controller[_0x1b47('0x6')]);router['get'](_0x1b47('0x7'),auth[_0x1b47('0x8')](),controller[_0x1b47('0x9')]);router[_0x1b47('0xa')]('/:id/subjects',auth[_0x1b47('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x1b47('0x8')](),controller[_0x1b47('0xb')]);router['get'](_0x1b47('0xc'),auth[_0x1b47('0x8')](),controller['getTags']);router[_0x1b47('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1b47('0xd')](_0x1b47('0xc'),auth[_0x1b47('0x8')](),controller[_0x1b47('0xe')]);router[_0x1b47('0xf')](_0x1b47('0x5'),auth[_0x1b47('0x8')](),controller[_0x1b47('0x10')]);router[_0x1b47('0x11')](_0x1b47('0x5'),auth[_0x1b47('0x8')](),controller[_0x1b47('0x12')]);module['exports']=router; \ No newline at end of file +var _0x481a=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','setTags','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x481a,0x178));var _0xa481=function(_0x37d21b,_0x3edcdc){_0x37d21b=_0x37d21b-0x0;var _0x2c2362=_0x481a[_0x37d21b];return _0x2c2362;};'use strict';var multer=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var path=require('path');var timeout=require(_0xa481('0x2'));var express=require(_0xa481('0x3'));var router=express[_0xa481('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa481('0x5'));var config=require('../../config/environment');var controller=require(_0xa481('0x6'));router['get']('/',auth[_0xa481('0x7')](),controller[_0xa481('0x8')]);router[_0xa481('0x9')](_0xa481('0xa'),auth[_0xa481('0x7')](),controller[_0xa481('0xb')]);router[_0xa481('0x9')](_0xa481('0xc'),auth[_0xa481('0x7')](),controller[_0xa481('0xd')]);router[_0xa481('0x9')](_0xa481('0xe'),auth[_0xa481('0x7')](),controller[_0xa481('0xf')]);router['get']('/:id/descriptions',auth[_0xa481('0x7')](),controller[_0xa481('0x10')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0xa481('0x11')]);router[_0xa481('0x12')]('/',auth[_0xa481('0x7')](),controller[_0xa481('0x13')]);router[_0xa481('0x12')]('/:id/tags',auth[_0xa481('0x7')](),controller[_0xa481('0x14')]);router['put'](_0xa481('0xa'),auth[_0xa481('0x7')](),controller['update']);router[_0xa481('0x15')](_0xa481('0xa'),auth[_0xa481('0x7')](),controller[_0xa481('0x16')]);module[_0xa481('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 62a205d..6cd22f8 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 _0xc86e=['exports'];(function(_0x5f1439,_0x29c20e){var _0x394cfe=function(_0x4a5129){while(--_0x4a5129){_0x5f1439['push'](_0x5f1439['shift']());}};_0x394cfe(++_0x29c20e);}(_0xc86e,0x17a));var _0xec86=function(_0x4d9db0,_0x5b9b99){_0x4d9db0=_0x4d9db0-0x0;var _0x12296b=_0xc86e[_0x4d9db0];return _0x12296b;};'use strict';var Sequelize=require('sequelize');module[_0xec86('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8184=['sequelize','exports'];(function(_0x1ecd39,_0x2dd7ea){var _0x2030eb=function(_0x36675e){while(--_0x36675e){_0x1ecd39['push'](_0x1ecd39['shift']());}};_0x2030eb(++_0x2dd7ea);}(_0x8184,0xd0));var _0x4818=function(_0x5969c2,_0x9aabad){_0x5969c2=_0x5969c2-0x0;var _0x3e6065=_0x8184[_0x5969c2];return _0x3e6065;};'use strict';var Sequelize=require(_0x4818('0x0'));module[_0x4818('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 95dca43..1764cde 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 _0x5027=['limit','order','sort','where','pick','filter','merge','type','VIRTUAL','rows','show','length','include','options','create','body','update','params','getFields','FreshdeskField','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','nolimit'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x5027,0x1d3));var _0x7502=function(_0x2175b3,_0x4d7d8c){_0x2175b3=_0x2175b3-0x0;var _0x4cc295=_0x5027[_0x2175b3];return _0x4cc295;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7502('0x0'));var zipdir=require(_0x7502('0x1'));var jsonpatch=require(_0x7502('0x2'));var rp=require(_0x7502('0x3'));var moment=require(_0x7502('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7502('0x5'));var util=require(_0x7502('0x6'));var path=require('path');var sox=require(_0x7502('0x7'));var csv=require(_0x7502('0x8'));var ejs=require(_0x7502('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7502('0xa'));var crypto=require(_0x7502('0xb'));var jsforce=require(_0x7502('0xc'));var deskjs=require(_0x7502('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7502('0xe'));var Papa=require(_0x7502('0xf'));var Redis=require('ioredis');var authService=require(_0x7502('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7502('0x11'));var hardwareService=require(_0x7502('0x12'));var logger=require(_0x7502('0x13'))(_0x7502('0x14'));var utils=require('../../config/utils');var config=require(_0x7502('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x7502('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3b43,_0x13912c,_0x2093cb,_0x27c52d){return new BPromise(function(_0xa7431,_0x5dbe01){var _0x22867e=_0x27c52d||client;return _0x22867e['request'](_0x4c3b43,_0x2093cb)[_0x7502('0x17')](function(_0x125a30){logger[_0x7502('0x18')](_0x7502('0x19'),_0x13912c,'request\x20sent');logger['debug'](_0x7502('0x1a'),_0x13912c,'request\x20sent',JSON[_0x7502('0x1b')](_0x125a30));if(_0x125a30['error']){if(_0x125a30['error']['code']===0x1f4){logger['error'](_0x7502('0x19'),_0x13912c,_0x125a30[_0x7502('0x1c')][_0x7502('0x1d')]);return _0x5dbe01(_0x125a30['error'][_0x7502('0x1d')]);}logger['error'](_0x7502('0x19'),_0x13912c,_0x125a30[_0x7502('0x1c')][_0x7502('0x1d')]);return _0xa7431(_0x125a30[_0x7502('0x1c')]['message']);}else{logger[_0x7502('0x18')](_0x7502('0x19'),_0x13912c,_0x7502('0x1e'));_0xa7431(_0x125a30[_0x7502('0x1f')][_0x7502('0x1d')]);}})[_0x7502('0x20')](function(_0x27a3e3){logger[_0x7502('0x1c')](_0x7502('0x19'),_0x13912c,_0x27a3e3);_0x5dbe01(_0x27a3e3);});});}function respondWithStatusCode(_0x36c6f8,_0xe71794){_0xe71794=_0xe71794||0xcc;return function(_0xba2cb7){if(_0xba2cb7){return _0x36c6f8['sendStatus'](_0xe71794);}return _0x36c6f8[_0x7502('0x21')](_0xe71794)[_0x7502('0x22')]();};}function respondWithResult(_0x5ef45b,_0x496d45){_0x496d45=_0x496d45||0xc8;return function(_0x49688d){if(_0x49688d){return _0x5ef45b[_0x7502('0x21')](_0x496d45)[_0x7502('0x23')](_0x49688d);}};}function respondWithFilteredResult(_0x12d9a2,_0x4e8747){return function(_0x4e6ef7){if(_0x4e6ef7){var _0x40e1fc=_0x4e6ef7[_0x7502('0x24')],_0x42e667=_0x4e8747[_0x7502('0x25')],_0x369f7b=_0x4e8747[_0x7502('0x25')]+_0x4e8747['limit'],_0x405467;if(_0x369f7b>=_0x40e1fc){_0x369f7b=_0x40e1fc;_0x405467=0xc8;}else{_0x405467=0xce;}_0x12d9a2['status'](_0x405467);return _0x12d9a2[_0x7502('0x26')](_0x7502('0x27'),_0x42e667+'-'+_0x369f7b+'/'+_0x40e1fc)[_0x7502('0x23')](_0x4e6ef7);}return null;};}function patchUpdates(_0x2c9bd6){return function(_0x288617){try{jsonpatch[_0x7502('0x28')](_0x288617,_0x2c9bd6,!![]);}catch(_0x37102a){return BPromise[_0x7502('0x29')](_0x37102a);}return _0x288617[_0x7502('0x2a')]();};}function saveUpdates(_0x56cd0b,_0x4809c6){return function(_0x5e3fc8){if(_0x5e3fc8){return _0x5e3fc8['update'](_0x56cd0b)[_0x7502('0x17')](function(_0x30053b){return _0x30053b;});}return null;};}function removeEntity(_0x1726c0,_0x55c259){return function(_0x4ae6cc){if(_0x4ae6cc){return _0x4ae6cc[_0x7502('0x2b')]()[_0x7502('0x17')](function(){_0x1726c0['status'](0xcc)[_0x7502('0x22')]();});}};}function handleEntityNotFound(_0x152576,_0x5a476b){return function(_0x412afb){if(!_0x412afb){_0x152576[_0x7502('0x2c')](0x194);}return _0x412afb;};}function handleError(_0x51166b,_0x3d24c6){_0x3d24c6=_0x3d24c6||0x1f4;return function(_0x4c2995){logger[_0x7502('0x1c')](_0x4c2995[_0x7502('0x2d')]);if(_0x4c2995[_0x7502('0x2e')]){delete _0x4c2995[_0x7502('0x2e')];}_0x51166b['status'](_0x3d24c6)[_0x7502('0x2f')](_0x4c2995);};}exports[_0x7502('0x30')]=function(_0x1af296,_0x3d3b9e){var _0x593250={},_0x48aa46={},_0xe348a0={'count':0x0,'rows':[]};var _0x40eedf=_[_0x7502('0x31')](db[_0x7502('0x32')][_0x7502('0x33')],function(_0x5a7914){return{'name':_0x5a7914[_0x7502('0x34')],'type':_0x5a7914['type']['key']};});_0x48aa46['model']=_[_0x7502('0x31')](_0x40eedf,_0x7502('0x2e'));_0x48aa46[_0x7502('0x35')]=_[_0x7502('0x36')](_0x1af296['query']);_0x48aa46[_0x7502('0x37')]=_[_0x7502('0x38')](_0x48aa46[_0x7502('0x39')],_0x48aa46[_0x7502('0x35')]);_0x593250[_0x7502('0x3a')]=_['intersection'](_0x48aa46[_0x7502('0x39')],qs[_0x7502('0x3b')](_0x1af296['query']['fields']));_0x593250['attributes']=_0x593250[_0x7502('0x3a')]['length']?_0x593250[_0x7502('0x3a')]:_0x48aa46['model'];if(!_0x1af296['query']['hasOwnProperty'](_0x7502('0x3c'))){_0x593250[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x1af296[_0x7502('0x35')][_0x7502('0x3d')]);_0x593250['offset']=qs[_0x7502('0x25')](_0x1af296[_0x7502('0x35')][_0x7502('0x25')]);}_0x593250[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x1af296[_0x7502('0x35')][_0x7502('0x3f')]);_0x593250[_0x7502('0x40')]=qs[_0x7502('0x37')](_[_0x7502('0x41')](_0x1af296[_0x7502('0x35')],_0x48aa46[_0x7502('0x37')]),_0x40eedf);if(_0x1af296['query'][_0x7502('0x42')]){_0x593250[_0x7502('0x40')]=_[_0x7502('0x43')](_0x593250[_0x7502('0x40')],{'$or':_[_0x7502('0x31')](_0x40eedf,function(_0xbd8bed){if(_0xbd8bed[_0x7502('0x44')]!==_0x7502('0x45')){var _0x511412={};_0x511412[_0xbd8bed['name']]={'$like':'%'+_0x1af296[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x511412;}})});}_0x593250=_[_0x7502('0x43')]({},_0x593250,_0x1af296['options']);var _0x2c7d3f={'where':_0x593250[_0x7502('0x40')]};return db['FreshdeskConfiguration'][_0x7502('0x24')](_0x2c7d3f)['then'](function(_0x59679e){_0xe348a0[_0x7502('0x24')]=_0x59679e;if(_0x1af296[_0x7502('0x35')]['includeAll']){_0x593250['include']=[{'all':!![]}];}return db[_0x7502('0x32')]['findAll'](_0x593250);})[_0x7502('0x17')](function(_0x40520c){_0xe348a0[_0x7502('0x46')]=_0x40520c;return _0xe348a0;})[_0x7502('0x17')](respondWithFilteredResult(_0x3d3b9e,_0x593250))[_0x7502('0x20')](handleError(_0x3d3b9e,null));};exports[_0x7502('0x47')]=function(_0x2d2976,_0x239eae){var _0x2b244a={'raw':![],'where':{'id':_0x2d2976['params']['id']}},_0x1d0c5a={};_0x1d0c5a[_0x7502('0x39')]=_[_0x7502('0x36')](db[_0x7502('0x32')][_0x7502('0x33')]);_0x1d0c5a[_0x7502('0x35')]=_['keys'](_0x2d2976[_0x7502('0x35')]);_0x1d0c5a[_0x7502('0x37')]=_['intersection'](_0x1d0c5a[_0x7502('0x39')],_0x1d0c5a['query']);_0x2b244a['attributes']=_[_0x7502('0x38')](_0x1d0c5a[_0x7502('0x39')],qs[_0x7502('0x3b')](_0x2d2976['query']['fields']));_0x2b244a[_0x7502('0x3a')]=_0x2b244a[_0x7502('0x3a')][_0x7502('0x48')]?_0x2b244a[_0x7502('0x3a')]:_0x1d0c5a[_0x7502('0x39')];if(_0x2d2976[_0x7502('0x35')]['includeAll']){_0x2b244a[_0x7502('0x49')]=[{'all':!![]}];}_0x2b244a=_[_0x7502('0x43')]({},_0x2b244a,_0x2d2976[_0x7502('0x4a')]);return db[_0x7502('0x32')]['find'](_0x2b244a)[_0x7502('0x17')](handleEntityNotFound(_0x239eae,null))[_0x7502('0x17')](respondWithResult(_0x239eae,null))['catch'](handleError(_0x239eae,null));};exports[_0x7502('0x4b')]=function(_0x151c5b,_0x5ce7da){return db[_0x7502('0x32')][_0x7502('0x4b')](_0x151c5b[_0x7502('0x4c')],{})[_0x7502('0x17')](respondWithResult(_0x5ce7da,0xc9))['catch'](handleError(_0x5ce7da,null));};exports[_0x7502('0x4d')]=function(_0x1cfedc,_0xf13aa9){if(_0x1cfedc[_0x7502('0x4c')]['id']){delete _0x1cfedc['body']['id'];}return db[_0x7502('0x32')]['find']({'where':{'id':_0x1cfedc[_0x7502('0x4e')]['id']}})[_0x7502('0x17')](handleEntityNotFound(_0xf13aa9,null))['then'](saveUpdates(_0x1cfedc[_0x7502('0x4c')],null))[_0x7502('0x17')](respondWithResult(_0xf13aa9,null))[_0x7502('0x20')](handleError(_0xf13aa9,null));};exports[_0x7502('0x2b')]=function(_0x29b4e5,_0x3d32ed){return db[_0x7502('0x32')]['find']({'where':{'id':_0x29b4e5['params']['id']}})[_0x7502('0x17')](handleEntityNotFound(_0x3d32ed,null))[_0x7502('0x17')](removeEntity(_0x3d32ed,null))[_0x7502('0x20')](handleError(_0x3d32ed,null));};exports[_0x7502('0x4f')]=function(_0x39f0f4,_0x44eb2d,_0x23d28d){var _0xab9910={};var _0x2acff9={};var _0x2d7df0;var _0x36f159;return db[_0x7502('0x32')]['findOne']({'where':{'id':_0x39f0f4['params']['id']}})['then'](handleEntityNotFound(_0x44eb2d,null))['then'](function(_0x45ffac){if(_0x45ffac){_0x2d7df0=_0x45ffac;_0x2acff9['model']=_[_0x7502('0x36')](db[_0x7502('0x50')][_0x7502('0x33')]);_0x2acff9[_0x7502('0x35')]=_[_0x7502('0x36')](_0x39f0f4['query']);_0x2acff9[_0x7502('0x37')]=_['intersection'](_0x2acff9['model'],_0x2acff9[_0x7502('0x35')]);_0xab9910['attributes']=_[_0x7502('0x38')](_0x2acff9['model'],qs[_0x7502('0x3b')](_0x39f0f4[_0x7502('0x35')]['fields']));_0xab9910[_0x7502('0x3a')]=_0xab9910[_0x7502('0x3a')]['length']?_0xab9910[_0x7502('0x3a')]:_0x2acff9[_0x7502('0x39')];_0xab9910[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x39f0f4[_0x7502('0x35')][_0x7502('0x3f')]);_0xab9910['where']=qs[_0x7502('0x37')](_['pick'](_0x39f0f4['query'],_0x2acff9[_0x7502('0x37')]));if(_0x39f0f4['query'][_0x7502('0x42')]){_0xab9910['where']=_['merge'](_0xab9910[_0x7502('0x40')],{'$or':_[_0x7502('0x31')](_0xab9910[_0x7502('0x3a')],function(_0x80c5dc){var _0x57535d={};_0x57535d[_0x80c5dc]={'$like':'%'+_0x39f0f4[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x57535d;})});}_0xab9910=_[_0x7502('0x43')]({},_0xab9910,_0x39f0f4[_0x7502('0x4a')]);return _0x2d7df0['getFields'](_0xab9910);}})['then'](function(_0x30c227){if(_0x30c227){_0x36f159=_0x30c227['length'];if(!_0x39f0f4['query'][_0x7502('0x51')](_0x7502('0x3c'))){_0xab9910[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x39f0f4[_0x7502('0x35')][_0x7502('0x3d')]);_0xab9910[_0x7502('0x25')]=qs[_0x7502('0x25')](_0x39f0f4[_0x7502('0x35')][_0x7502('0x25')]);}return _0x2d7df0[_0x7502('0x4f')](_0xab9910);}})['then'](function(_0x13afa5){if(_0x13afa5){return _0x13afa5?{'count':_0x36f159,'rows':_0x13afa5}:null;}})['then'](respondWithResult(_0x44eb2d,null))[_0x7502('0x20')](handleError(_0x44eb2d,null));};exports['getSubjects']=function(_0x278f38,_0x4963cf,_0x2c0fe3){var _0x477ad8={};var _0x2b626e={};var _0x259139;var _0x189814;return db[_0x7502('0x32')][_0x7502('0x52')]({'where':{'id':_0x278f38[_0x7502('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4963cf,null))[_0x7502('0x17')](function(_0x261e14){if(_0x261e14){_0x259139=_0x261e14;_0x2b626e[_0x7502('0x39')]=_[_0x7502('0x36')](db[_0x7502('0x50')][_0x7502('0x33')]);_0x2b626e[_0x7502('0x35')]=_[_0x7502('0x36')](_0x278f38[_0x7502('0x35')]);_0x2b626e['filters']=_[_0x7502('0x38')](_0x2b626e[_0x7502('0x39')],_0x2b626e[_0x7502('0x35')]);_0x477ad8[_0x7502('0x3a')]=_[_0x7502('0x38')](_0x2b626e[_0x7502('0x39')],qs['fields'](_0x278f38[_0x7502('0x35')][_0x7502('0x3b')]));_0x477ad8[_0x7502('0x3a')]=_0x477ad8[_0x7502('0x3a')][_0x7502('0x48')]?_0x477ad8[_0x7502('0x3a')]:_0x2b626e[_0x7502('0x39')];_0x477ad8[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x278f38[_0x7502('0x35')][_0x7502('0x3f')]);_0x477ad8[_0x7502('0x40')]=qs[_0x7502('0x37')](_[_0x7502('0x41')](_0x278f38[_0x7502('0x35')],_0x2b626e['filters']));if(_0x278f38[_0x7502('0x35')][_0x7502('0x42')]){_0x477ad8[_0x7502('0x40')]=_[_0x7502('0x43')](_0x477ad8[_0x7502('0x40')],{'$or':_[_0x7502('0x31')](_0x477ad8[_0x7502('0x3a')],function(_0x4b63d2){var _0x3bceb8={};_0x3bceb8[_0x4b63d2]={'$like':'%'+_0x278f38[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x3bceb8;})});}_0x477ad8=_[_0x7502('0x43')]({},_0x477ad8,_0x278f38['options']);return _0x259139[_0x7502('0x53')](_0x477ad8);}})[_0x7502('0x17')](function(_0x495bae){if(_0x495bae){_0x189814=_0x495bae[_0x7502('0x48')];if(!_0x278f38[_0x7502('0x35')][_0x7502('0x51')]('nolimit')){_0x477ad8[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x278f38[_0x7502('0x35')][_0x7502('0x3d')]);_0x477ad8['offset']=qs['offset'](_0x278f38['query'][_0x7502('0x25')]);}return _0x259139['getSubjects'](_0x477ad8);}})[_0x7502('0x17')](function(_0x551a4f){if(_0x551a4f){return _0x551a4f?{'count':_0x189814,'rows':_0x551a4f}:null;}})[_0x7502('0x17')](respondWithResult(_0x4963cf,null))['catch'](handleError(_0x4963cf,null));};exports[_0x7502('0x54')]=function(_0x12ff91,_0x5f5bd5,_0x42accd){var _0x7ef3d5={};var _0x34e6e5={};var _0x286e7d;var _0x3d21be;return db['FreshdeskConfiguration'][_0x7502('0x52')]({'where':{'id':_0x12ff91['params']['id']}})[_0x7502('0x17')](handleEntityNotFound(_0x5f5bd5,null))[_0x7502('0x17')](function(_0x3da27b){if(_0x3da27b){_0x286e7d=_0x3da27b;_0x34e6e5[_0x7502('0x39')]=_[_0x7502('0x36')](db[_0x7502('0x50')]['rawAttributes']);_0x34e6e5[_0x7502('0x35')]=_['keys'](_0x12ff91[_0x7502('0x35')]);_0x34e6e5[_0x7502('0x37')]=_[_0x7502('0x38')](_0x34e6e5['model'],_0x34e6e5[_0x7502('0x35')]);_0x7ef3d5[_0x7502('0x3a')]=_[_0x7502('0x38')](_0x34e6e5['model'],qs[_0x7502('0x3b')](_0x12ff91[_0x7502('0x35')]['fields']));_0x7ef3d5[_0x7502('0x3a')]=_0x7ef3d5[_0x7502('0x3a')][_0x7502('0x48')]?_0x7ef3d5['attributes']:_0x34e6e5[_0x7502('0x39')];_0x7ef3d5[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x12ff91['query'][_0x7502('0x3f')]);_0x7ef3d5[_0x7502('0x40')]=qs[_0x7502('0x37')](_['pick'](_0x12ff91[_0x7502('0x35')],_0x34e6e5[_0x7502('0x37')]));if(_0x12ff91[_0x7502('0x35')][_0x7502('0x42')]){_0x7ef3d5[_0x7502('0x40')]=_[_0x7502('0x43')](_0x7ef3d5['where'],{'$or':_[_0x7502('0x31')](_0x7ef3d5['attributes'],function(_0x324ea3){var _0x3f5951={};_0x3f5951[_0x324ea3]={'$like':'%'+_0x12ff91['query'][_0x7502('0x42')]+'%'};return _0x3f5951;})});}_0x7ef3d5=_['merge']({},_0x7ef3d5,_0x12ff91[_0x7502('0x4a')]);return _0x286e7d[_0x7502('0x54')](_0x7ef3d5);}})[_0x7502('0x17')](function(_0x396563){if(_0x396563){_0x3d21be=_0x396563[_0x7502('0x48')];if(!_0x12ff91[_0x7502('0x35')][_0x7502('0x51')]('nolimit')){_0x7ef3d5[_0x7502('0x3d')]=qs[_0x7502('0x3d')](_0x12ff91['query'][_0x7502('0x3d')]);_0x7ef3d5[_0x7502('0x25')]=qs[_0x7502('0x25')](_0x12ff91[_0x7502('0x35')]['offset']);}return _0x286e7d[_0x7502('0x54')](_0x7ef3d5);}})['then'](function(_0x3db582){if(_0x3db582){return _0x3db582?{'count':_0x3d21be,'rows':_0x3db582}:null;}})[_0x7502('0x17')](respondWithResult(_0x5f5bd5,null))[_0x7502('0x20')](handleError(_0x5f5bd5,null));};exports['getTags']=function(_0x4a1fe9,_0x10589b,_0x313bac){var _0x5dcfc9={};var _0x5b47a3={};var _0x7dd29a;var _0x63a35;return db[_0x7502('0x32')][_0x7502('0x52')]({'where':{'id':_0x4a1fe9[_0x7502('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10589b,null))[_0x7502('0x17')](function(_0x16b2cb){if(_0x16b2cb){_0x7dd29a=_0x16b2cb;_0x5b47a3[_0x7502('0x39')]=_[_0x7502('0x36')](db['Tag']['rawAttributes']);_0x5b47a3['query']=_[_0x7502('0x36')](_0x4a1fe9[_0x7502('0x35')]);_0x5b47a3[_0x7502('0x37')]=_[_0x7502('0x38')](_0x5b47a3['model'],_0x5b47a3[_0x7502('0x35')]);_0x5dcfc9[_0x7502('0x3a')]=_['intersection'](_0x5b47a3[_0x7502('0x39')],qs[_0x7502('0x3b')](_0x4a1fe9[_0x7502('0x35')]['fields']));_0x5dcfc9['attributes']=_0x5dcfc9[_0x7502('0x3a')][_0x7502('0x48')]?_0x5dcfc9[_0x7502('0x3a')]:_0x5b47a3[_0x7502('0x39')];_0x5dcfc9[_0x7502('0x3e')]=qs[_0x7502('0x3f')](_0x4a1fe9[_0x7502('0x35')][_0x7502('0x3f')]);_0x5dcfc9[_0x7502('0x40')]=qs['filters'](_[_0x7502('0x41')](_0x4a1fe9[_0x7502('0x35')],_0x5b47a3[_0x7502('0x37')]));if(_0x4a1fe9[_0x7502('0x35')]['filter']){_0x5dcfc9[_0x7502('0x40')]=_[_0x7502('0x43')](_0x5dcfc9['where'],{'$or':_[_0x7502('0x31')](_0x5dcfc9[_0x7502('0x3a')],function(_0x51ef23){var _0x1bc625={};_0x1bc625[_0x51ef23]={'$like':'%'+_0x4a1fe9[_0x7502('0x35')][_0x7502('0x42')]+'%'};return _0x1bc625;})});}_0x5dcfc9=_[_0x7502('0x43')]({},_0x5dcfc9,_0x4a1fe9['options']);return _0x7dd29a[_0x7502('0x55')](_0x5dcfc9);}})[_0x7502('0x17')](function(_0x5b113d){if(_0x5b113d){_0x63a35=_0x5b113d[_0x7502('0x48')];if(!_0x4a1fe9[_0x7502('0x35')]['hasOwnProperty'](_0x7502('0x3c'))){_0x5dcfc9[_0x7502('0x3d')]=qs['limit'](_0x4a1fe9[_0x7502('0x35')][_0x7502('0x3d')]);_0x5dcfc9[_0x7502('0x25')]=qs['offset'](_0x4a1fe9[_0x7502('0x35')]['offset']);}return _0x7dd29a[_0x7502('0x55')](_0x5dcfc9);}})[_0x7502('0x17')](function(_0x1f391f){if(_0x1f391f){return _0x1f391f?{'count':_0x63a35,'rows':_0x1f391f}:null;}})[_0x7502('0x17')](respondWithResult(_0x10589b,null))[_0x7502('0x20')](handleError(_0x10589b,null));};exports['setTags']=function(_0x260d43,_0x84dc50,_0x49d471){if(_0x260d43['body']['id']){delete _0x260d43[_0x7502('0x4c')]['id'];}return db[_0x7502('0x32')][_0x7502('0x52')]({'where':{'id':_0x260d43['params']['id']}})[_0x7502('0x17')](handleEntityNotFound(_0x84dc50,null))[_0x7502('0x17')](function(_0x1c9697){if(_0x1c9697){return _0x1c9697[_0x7502('0x56')](_0x260d43[_0x7502('0x4c')][_0x7502('0x57')]||[]);}return null;})['then'](respondWithResult(_0x84dc50,null))[_0x7502('0x20')](handleError(_0x84dc50,null));}; \ No newline at end of file +var _0x1b4d=['pick','VIRTUAL','merge','options','includeAll','include','FreshdeskConfiguration','findAll','rows','find','create','body','params','getFields','FreshdeskField','order','getSubjects','findOne','filter','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x1b4d,0xdf));var _0xd1b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1b4d[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1b4('0x1'));var jsonpatch=require(_0xd1b4('0x2'));var rp=require(_0xd1b4('0x3'));var moment=require(_0xd1b4('0x4'));var BPromise=require(_0xd1b4('0x5'));var Mustache=require('mustache');var util=require(_0xd1b4('0x6'));var path=require(_0xd1b4('0x7'));var sox=require(_0xd1b4('0x8'));var csv=require(_0xd1b4('0x9'));var ejs=require(_0xd1b4('0xa'));var fs=require('fs');var _=require(_0xd1b4('0xb'));var squel=require(_0xd1b4('0xc'));var crypto=require(_0xd1b4('0xd'));var jsforce=require(_0xd1b4('0xe'));var deskjs=require(_0xd1b4('0xf'));var toCsv=require(_0xd1b4('0x9'));var querystring=require(_0xd1b4('0x10'));var Papa=require(_0xd1b4('0x11'));var Redis=require(_0xd1b4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd1b4('0x13'));var as=require(_0xd1b4('0x14'));var hardwareService=require(_0xd1b4('0x15'));var logger=require(_0xd1b4('0x16'))(_0xd1b4('0x17'));var utils=require('../../config/utils');var config=require(_0xd1b4('0x18'));var licenseUtil=require(_0xd1b4('0x19'));var db=require(_0xd1b4('0x1a'))['db'];var jayson=require(_0xd1b4('0x1b'));var client=jayson[_0xd1b4('0x1c')][_0xd1b4('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x163a55,_0x8a4e5b,_0xfed642,_0x24aaca){return new BPromise(function(_0x1ea61a,_0x5d7c85){var _0x4bb33d=_0x24aaca||client;return _0x4bb33d[_0xd1b4('0x1e')](_0x163a55,_0xfed642)[_0xd1b4('0x1f')](function(_0x32daf6){logger[_0xd1b4('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x8a4e5b,_0xd1b4('0x21'));logger[_0xd1b4('0x22')](_0xd1b4('0x23'),_0x8a4e5b,_0xd1b4('0x21'),JSON[_0xd1b4('0x24')](_0x32daf6));if(_0x32daf6[_0xd1b4('0x25')]){if(_0x32daf6[_0xd1b4('0x25')][_0xd1b4('0x26')]===0x1f4){logger['error'](_0xd1b4('0x27'),_0x8a4e5b,_0x32daf6['error']['message']);return _0x5d7c85(_0x32daf6[_0xd1b4('0x25')][_0xd1b4('0x28')]);}logger[_0xd1b4('0x25')](_0xd1b4('0x27'),_0x8a4e5b,_0x32daf6[_0xd1b4('0x25')]['message']);return _0x1ea61a(_0x32daf6[_0xd1b4('0x25')][_0xd1b4('0x28')]);}else{logger['info'](_0xd1b4('0x27'),_0x8a4e5b,_0xd1b4('0x21'));_0x1ea61a(_0x32daf6[_0xd1b4('0x29')][_0xd1b4('0x28')]);}})[_0xd1b4('0x2a')](function(_0x480fef){logger[_0xd1b4('0x25')](_0xd1b4('0x27'),_0x8a4e5b,_0x480fef);_0x5d7c85(_0x480fef);});});}function respondWithStatusCode(_0x3dab38,_0x52bd84){_0x52bd84=_0x52bd84||0xcc;return function(_0xa0df95){if(_0xa0df95){return _0x3dab38['sendStatus'](_0x52bd84);}return _0x3dab38['status'](_0x52bd84)[_0xd1b4('0x2b')]();};}function respondWithResult(_0x1e3424,_0x230850){_0x230850=_0x230850||0xc8;return function(_0x42a6e4){if(_0x42a6e4){return _0x1e3424[_0xd1b4('0x2c')](_0x230850)[_0xd1b4('0x2d')](_0x42a6e4);}};}function respondWithFilteredResult(_0x2b4cc5,_0x2a60f9){return function(_0x283d05){if(_0x283d05){var _0x1fe818=_0x283d05[_0xd1b4('0x2e')],_0x62b1f3=_0x2a60f9['offset'],_0xf5c23e=_0x2a60f9[_0xd1b4('0x2f')]+_0x2a60f9['limit'],_0x1e9f03;if(_0xf5c23e>=_0x1fe818){_0xf5c23e=_0x1fe818;_0x1e9f03=0xc8;}else{_0x1e9f03=0xce;}_0x2b4cc5[_0xd1b4('0x2c')](_0x1e9f03);return _0x2b4cc5[_0xd1b4('0x30')](_0xd1b4('0x31'),_0x62b1f3+'-'+_0xf5c23e+'/'+_0x1fe818)[_0xd1b4('0x2d')](_0x283d05);}return null;};}function patchUpdates(_0x1ef99c){return function(_0x206d1f){try{jsonpatch[_0xd1b4('0x32')](_0x206d1f,_0x1ef99c,!![]);}catch(_0x1f75f9){return BPromise[_0xd1b4('0x33')](_0x1f75f9);}return _0x206d1f[_0xd1b4('0x34')]();};}function saveUpdates(_0x2ee2d3,_0x1f1703){return function(_0x3eed5d){if(_0x3eed5d){return _0x3eed5d[_0xd1b4('0x35')](_0x2ee2d3)[_0xd1b4('0x1f')](function(_0x5d7295){return _0x5d7295;});}return null;};}function removeEntity(_0x488a6f,_0x23c876){return function(_0x175927){if(_0x175927){return _0x175927['destroy']()[_0xd1b4('0x1f')](function(){_0x488a6f['status'](0xcc)[_0xd1b4('0x2b')]();});}};}function handleEntityNotFound(_0x2e4a43,_0xaf567){return function(_0x495f44){if(!_0x495f44){_0x2e4a43[_0xd1b4('0x36')](0x194);}return _0x495f44;};}function handleError(_0x31e64e,_0x1555e4){_0x1555e4=_0x1555e4||0x1f4;return function(_0x5820b8){logger[_0xd1b4('0x25')](_0x5820b8[_0xd1b4('0x37')]);if(_0x5820b8[_0xd1b4('0x38')]){delete _0x5820b8[_0xd1b4('0x38')];}_0x31e64e[_0xd1b4('0x2c')](_0x1555e4)[_0xd1b4('0x39')](_0x5820b8);};}exports[_0xd1b4('0x3a')]=function(_0x3566bc,_0x6bb5c1){var _0x18020c={},_0xd762a7={},_0x592bd0={'count':0x0,'rows':[]};var _0x2fc26b=_[_0xd1b4('0x3b')](db['FreshdeskConfiguration'][_0xd1b4('0x3c')],function(_0x2538cf){return{'name':_0x2538cf[_0xd1b4('0x3d')],'type':_0x2538cf[_0xd1b4('0x3e')][_0xd1b4('0x3f')]};});_0xd762a7[_0xd1b4('0x40')]=_[_0xd1b4('0x3b')](_0x2fc26b,'name');_0xd762a7[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x3566bc['query']);_0xd762a7[_0xd1b4('0x43')]=_[_0xd1b4('0x44')](_0xd762a7[_0xd1b4('0x40')],_0xd762a7[_0xd1b4('0x41')]);_0x18020c[_0xd1b4('0x45')]=_[_0xd1b4('0x44')](_0xd762a7[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x18020c[_0xd1b4('0x45')]=_0x18020c[_0xd1b4('0x45')][_0xd1b4('0x47')]?_0x18020c['attributes']:_0xd762a7[_0xd1b4('0x40')];if(!_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x18020c['limit']=qs['limit'](_0x3566bc['query'][_0xd1b4('0x4a')]);_0x18020c[_0xd1b4('0x2f')]=qs['offset'](_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x2f')]);}_0x18020c['order']=qs[_0xd1b4('0x4b')](_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x4b')]);_0x18020c[_0xd1b4('0x4c')]=qs['filters'](_[_0xd1b4('0x4d')](_0x3566bc[_0xd1b4('0x41')],_0xd762a7[_0xd1b4('0x43')]),_0x2fc26b);if(_0x3566bc[_0xd1b4('0x41')]['filter']){_0x18020c[_0xd1b4('0x4c')]=_['merge'](_0x18020c['where'],{'$or':_[_0xd1b4('0x3b')](_0x2fc26b,function(_0x269b33){if(_0x269b33[_0xd1b4('0x3e')]!==_0xd1b4('0x4e')){var _0x592c62={};_0x592c62[_0x269b33[_0xd1b4('0x38')]]={'$like':'%'+_0x3566bc['query']['filter']+'%'};return _0x592c62;}})});}_0x18020c=_[_0xd1b4('0x4f')]({},_0x18020c,_0x3566bc[_0xd1b4('0x50')]);var _0x343e92={'where':_0x18020c[_0xd1b4('0x4c')]};return db['FreshdeskConfiguration'][_0xd1b4('0x2e')](_0x343e92)[_0xd1b4('0x1f')](function(_0x35fb77){_0x592bd0[_0xd1b4('0x2e')]=_0x35fb77;if(_0x3566bc[_0xd1b4('0x41')][_0xd1b4('0x51')]){_0x18020c[_0xd1b4('0x52')]=[{'all':!![]}];}return db[_0xd1b4('0x53')][_0xd1b4('0x54')](_0x18020c);})[_0xd1b4('0x1f')](function(_0x3e029c){_0x592bd0[_0xd1b4('0x55')]=_0x3e029c;return _0x592bd0;})['then'](respondWithFilteredResult(_0x6bb5c1,_0x18020c))[_0xd1b4('0x2a')](handleError(_0x6bb5c1,null));};exports['show']=function(_0x488329,_0x42ea8e){var _0x41225b={'raw':![],'where':{'id':_0x488329['params']['id']}},_0x3c5179={};_0x3c5179['model']=_[_0xd1b4('0x42')](db[_0xd1b4('0x53')]['rawAttributes']);_0x3c5179[_0xd1b4('0x41')]=_['keys'](_0x488329[_0xd1b4('0x41')]);_0x3c5179['filters']=_[_0xd1b4('0x44')](_0x3c5179[_0xd1b4('0x40')],_0x3c5179[_0xd1b4('0x41')]);_0x41225b['attributes']=_['intersection'](_0x3c5179[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x488329[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x41225b[_0xd1b4('0x45')]=_0x41225b['attributes']['length']?_0x41225b[_0xd1b4('0x45')]:_0x3c5179[_0xd1b4('0x40')];if(_0x488329[_0xd1b4('0x41')][_0xd1b4('0x51')]){_0x41225b[_0xd1b4('0x52')]=[{'all':!![]}];}_0x41225b=_['merge']({},_0x41225b,_0x488329[_0xd1b4('0x50')]);return db[_0xd1b4('0x53')][_0xd1b4('0x56')](_0x41225b)[_0xd1b4('0x1f')](handleEntityNotFound(_0x42ea8e,null))['then'](respondWithResult(_0x42ea8e,null))['catch'](handleError(_0x42ea8e,null));};exports[_0xd1b4('0x57')]=function(_0xfb929a,_0x5bc91d){return db[_0xd1b4('0x53')][_0xd1b4('0x57')](_0xfb929a['body'],{})[_0xd1b4('0x1f')](respondWithResult(_0x5bc91d,0xc9))[_0xd1b4('0x2a')](handleError(_0x5bc91d,null));};exports[_0xd1b4('0x35')]=function(_0x3a8ce1,_0x4538e0){if(_0x3a8ce1['body']['id']){delete _0x3a8ce1[_0xd1b4('0x58')]['id'];}return db[_0xd1b4('0x53')]['find']({'where':{'id':_0x3a8ce1[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x4538e0,null))['then'](saveUpdates(_0x3a8ce1['body'],null))['then'](respondWithResult(_0x4538e0,null))[_0xd1b4('0x2a')](handleError(_0x4538e0,null));};exports['destroy']=function(_0xd3f64,_0x51e2ad){return db[_0xd1b4('0x53')][_0xd1b4('0x56')]({'where':{'id':_0xd3f64[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x51e2ad,null))['then'](removeEntity(_0x51e2ad,null))['catch'](handleError(_0x51e2ad,null));};exports[_0xd1b4('0x5a')]=function(_0x235216,_0x2e1e5a,_0x13e016){var _0x33774e={};var _0x1d0c4f={};var _0x21b037;var _0x314360;return db[_0xd1b4('0x53')]['findOne']({'where':{'id':_0x235216[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x2e1e5a,null))[_0xd1b4('0x1f')](function(_0x5641f3){if(_0x5641f3){_0x21b037=_0x5641f3;_0x1d0c4f[_0xd1b4('0x40')]=_['keys'](db[_0xd1b4('0x5b')][_0xd1b4('0x3c')]);_0x1d0c4f[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x235216[_0xd1b4('0x41')]);_0x1d0c4f[_0xd1b4('0x43')]=_['intersection'](_0x1d0c4f[_0xd1b4('0x40')],_0x1d0c4f[_0xd1b4('0x41')]);_0x33774e[_0xd1b4('0x45')]=_[_0xd1b4('0x44')](_0x1d0c4f[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x235216[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x33774e[_0xd1b4('0x45')]=_0x33774e[_0xd1b4('0x45')][_0xd1b4('0x47')]?_0x33774e[_0xd1b4('0x45')]:_0x1d0c4f['model'];_0x33774e[_0xd1b4('0x5c')]=qs[_0xd1b4('0x4b')](_0x235216['query'][_0xd1b4('0x4b')]);_0x33774e[_0xd1b4('0x4c')]=qs['filters'](_[_0xd1b4('0x4d')](_0x235216[_0xd1b4('0x41')],_0x1d0c4f['filters']));if(_0x235216[_0xd1b4('0x41')]['filter']){_0x33774e['where']=_['merge'](_0x33774e[_0xd1b4('0x4c')],{'$or':_[_0xd1b4('0x3b')](_0x33774e[_0xd1b4('0x45')],function(_0x4509b8){var _0x3f002f={};_0x3f002f[_0x4509b8]={'$like':'%'+_0x235216[_0xd1b4('0x41')]['filter']+'%'};return _0x3f002f;})});}_0x33774e=_[_0xd1b4('0x4f')]({},_0x33774e,_0x235216[_0xd1b4('0x50')]);return _0x21b037[_0xd1b4('0x5a')](_0x33774e);}})[_0xd1b4('0x1f')](function(_0x324fa2){if(_0x324fa2){_0x314360=_0x324fa2[_0xd1b4('0x47')];if(!_0x235216[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x33774e[_0xd1b4('0x4a')]=qs[_0xd1b4('0x4a')](_0x235216[_0xd1b4('0x41')]['limit']);_0x33774e[_0xd1b4('0x2f')]=qs['offset'](_0x235216[_0xd1b4('0x41')][_0xd1b4('0x2f')]);}return _0x21b037[_0xd1b4('0x5a')](_0x33774e);}})[_0xd1b4('0x1f')](function(_0xf761c){if(_0xf761c){return _0xf761c?{'count':_0x314360,'rows':_0xf761c}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x2e1e5a,null))['catch'](handleError(_0x2e1e5a,null));};exports[_0xd1b4('0x5d')]=function(_0x29e763,_0x3f584c,_0x4f2f2a){var _0x1f67e={};var _0x175287={};var _0x7accee;var _0x57d532;return db[_0xd1b4('0x53')][_0xd1b4('0x5e')]({'where':{'id':_0x29e763[_0xd1b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f584c,null))[_0xd1b4('0x1f')](function(_0xc1025a){if(_0xc1025a){_0x7accee=_0xc1025a;_0x175287[_0xd1b4('0x40')]=_[_0xd1b4('0x42')](db[_0xd1b4('0x5b')]['rawAttributes']);_0x175287['query']=_['keys'](_0x29e763[_0xd1b4('0x41')]);_0x175287[_0xd1b4('0x43')]=_[_0xd1b4('0x44')](_0x175287[_0xd1b4('0x40')],_0x175287[_0xd1b4('0x41')]);_0x1f67e[_0xd1b4('0x45')]=_[_0xd1b4('0x44')](_0x175287[_0xd1b4('0x40')],qs[_0xd1b4('0x46')](_0x29e763[_0xd1b4('0x41')]['fields']));_0x1f67e['attributes']=_0x1f67e['attributes'][_0xd1b4('0x47')]?_0x1f67e[_0xd1b4('0x45')]:_0x175287[_0xd1b4('0x40')];_0x1f67e[_0xd1b4('0x5c')]=qs[_0xd1b4('0x4b')](_0x29e763['query']['sort']);_0x1f67e[_0xd1b4('0x4c')]=qs[_0xd1b4('0x43')](_[_0xd1b4('0x4d')](_0x29e763[_0xd1b4('0x41')],_0x175287[_0xd1b4('0x43')]));if(_0x29e763['query'][_0xd1b4('0x5f')]){_0x1f67e[_0xd1b4('0x4c')]=_[_0xd1b4('0x4f')](_0x1f67e[_0xd1b4('0x4c')],{'$or':_[_0xd1b4('0x3b')](_0x1f67e[_0xd1b4('0x45')],function(_0x12ef86){var _0x4f90f3={};_0x4f90f3[_0x12ef86]={'$like':'%'+_0x29e763[_0xd1b4('0x41')][_0xd1b4('0x5f')]+'%'};return _0x4f90f3;})});}_0x1f67e=_[_0xd1b4('0x4f')]({},_0x1f67e,_0x29e763[_0xd1b4('0x50')]);return _0x7accee[_0xd1b4('0x5d')](_0x1f67e);}})['then'](function(_0x5267df){if(_0x5267df){_0x57d532=_0x5267df[_0xd1b4('0x47')];if(!_0x29e763[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x1f67e[_0xd1b4('0x4a')]=qs['limit'](_0x29e763[_0xd1b4('0x41')][_0xd1b4('0x4a')]);_0x1f67e['offset']=qs[_0xd1b4('0x2f')](_0x29e763[_0xd1b4('0x41')]['offset']);}return _0x7accee[_0xd1b4('0x5d')](_0x1f67e);}})[_0xd1b4('0x1f')](function(_0x3cbdc9){if(_0x3cbdc9){return _0x3cbdc9?{'count':_0x57d532,'rows':_0x3cbdc9}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x3f584c,null))[_0xd1b4('0x2a')](handleError(_0x3f584c,null));};exports[_0xd1b4('0x60')]=function(_0x34594e,_0x7ba111,_0x1e52ce){var _0x12e699={};var _0x19b56d={};var _0x51cd57;var _0x27c92a;return db[_0xd1b4('0x53')][_0xd1b4('0x5e')]({'where':{'id':_0x34594e[_0xd1b4('0x59')]['id']}})['then'](handleEntityNotFound(_0x7ba111,null))['then'](function(_0x586003){if(_0x586003){_0x51cd57=_0x586003;_0x19b56d[_0xd1b4('0x40')]=_['keys'](db['FreshdeskField'][_0xd1b4('0x3c')]);_0x19b56d[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x34594e[_0xd1b4('0x41')]);_0x19b56d[_0xd1b4('0x43')]=_['intersection'](_0x19b56d['model'],_0x19b56d[_0xd1b4('0x41')]);_0x12e699[_0xd1b4('0x45')]=_['intersection'](_0x19b56d['model'],qs[_0xd1b4('0x46')](_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x46')]));_0x12e699[_0xd1b4('0x45')]=_0x12e699[_0xd1b4('0x45')]['length']?_0x12e699[_0xd1b4('0x45')]:_0x19b56d[_0xd1b4('0x40')];_0x12e699[_0xd1b4('0x5c')]=qs[_0xd1b4('0x4b')](_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x4b')]);_0x12e699['where']=qs[_0xd1b4('0x43')](_[_0xd1b4('0x4d')](_0x34594e[_0xd1b4('0x41')],_0x19b56d[_0xd1b4('0x43')]));if(_0x34594e['query'][_0xd1b4('0x5f')]){_0x12e699[_0xd1b4('0x4c')]=_[_0xd1b4('0x4f')](_0x12e699[_0xd1b4('0x4c')],{'$or':_[_0xd1b4('0x3b')](_0x12e699[_0xd1b4('0x45')],function(_0x3cafd3){var _0x250b11={};_0x250b11[_0x3cafd3]={'$like':'%'+_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x5f')]+'%'};return _0x250b11;})});}_0x12e699=_[_0xd1b4('0x4f')]({},_0x12e699,_0x34594e[_0xd1b4('0x50')]);return _0x51cd57[_0xd1b4('0x60')](_0x12e699);}})['then'](function(_0xd56887){if(_0xd56887){_0x27c92a=_0xd56887[_0xd1b4('0x47')];if(!_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x48')](_0xd1b4('0x49'))){_0x12e699[_0xd1b4('0x4a')]=qs[_0xd1b4('0x4a')](_0x34594e[_0xd1b4('0x41')][_0xd1b4('0x4a')]);_0x12e699['offset']=qs['offset'](_0x34594e[_0xd1b4('0x41')]['offset']);}return _0x51cd57[_0xd1b4('0x60')](_0x12e699);}})['then'](function(_0x165277){if(_0x165277){return _0x165277?{'count':_0x27c92a,'rows':_0x165277}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x7ba111,null))['catch'](handleError(_0x7ba111,null));};exports[_0xd1b4('0x61')]=function(_0x501afe,_0x1d705c,_0x474afb){var _0x59e5da={};var _0x1a379d={};var _0x4562c7;var _0x3a07fc;return db[_0xd1b4('0x53')][_0xd1b4('0x5e')]({'where':{'id':_0x501afe[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x1d705c,null))['then'](function(_0x519b48){if(_0x519b48){_0x4562c7=_0x519b48;_0x1a379d[_0xd1b4('0x40')]=_[_0xd1b4('0x42')](db[_0xd1b4('0x62')][_0xd1b4('0x3c')]);_0x1a379d[_0xd1b4('0x41')]=_[_0xd1b4('0x42')](_0x501afe['query']);_0x1a379d[_0xd1b4('0x43')]=_[_0xd1b4('0x44')](_0x1a379d[_0xd1b4('0x40')],_0x1a379d['query']);_0x59e5da['attributes']=_[_0xd1b4('0x44')](_0x1a379d[_0xd1b4('0x40')],qs['fields'](_0x501afe[_0xd1b4('0x41')]['fields']));_0x59e5da[_0xd1b4('0x45')]=_0x59e5da[_0xd1b4('0x45')][_0xd1b4('0x47')]?_0x59e5da['attributes']:_0x1a379d[_0xd1b4('0x40')];_0x59e5da[_0xd1b4('0x5c')]=qs['sort'](_0x501afe[_0xd1b4('0x41')]['sort']);_0x59e5da['where']=qs['filters'](_[_0xd1b4('0x4d')](_0x501afe['query'],_0x1a379d[_0xd1b4('0x43')]));if(_0x501afe[_0xd1b4('0x41')][_0xd1b4('0x5f')]){_0x59e5da['where']=_[_0xd1b4('0x4f')](_0x59e5da[_0xd1b4('0x4c')],{'$or':_['map'](_0x59e5da[_0xd1b4('0x45')],function(_0x1b1c94){var _0x50f91f={};_0x50f91f[_0x1b1c94]={'$like':'%'+_0x501afe[_0xd1b4('0x41')][_0xd1b4('0x5f')]+'%'};return _0x50f91f;})});}_0x59e5da=_[_0xd1b4('0x4f')]({},_0x59e5da,_0x501afe[_0xd1b4('0x50')]);return _0x4562c7['getTags'](_0x59e5da);}})[_0xd1b4('0x1f')](function(_0x34ee62){if(_0x34ee62){_0x3a07fc=_0x34ee62['length'];if(!_0x501afe[_0xd1b4('0x41')]['hasOwnProperty'](_0xd1b4('0x49'))){_0x59e5da['limit']=qs[_0xd1b4('0x4a')](_0x501afe[_0xd1b4('0x41')][_0xd1b4('0x4a')]);_0x59e5da[_0xd1b4('0x2f')]=qs['offset'](_0x501afe['query']['offset']);}return _0x4562c7[_0xd1b4('0x61')](_0x59e5da);}})[_0xd1b4('0x1f')](function(_0x16553c){if(_0x16553c){return _0x16553c?{'count':_0x3a07fc,'rows':_0x16553c}:null;}})[_0xd1b4('0x1f')](respondWithResult(_0x1d705c,null))['catch'](handleError(_0x1d705c,null));};exports[_0xd1b4('0x63')]=function(_0x898613,_0x380f9b,_0x768cfa){if(_0x898613['body']['id']){delete _0x898613[_0xd1b4('0x58')]['id'];}return db['FreshdeskConfiguration'][_0xd1b4('0x5e')]({'where':{'id':_0x898613[_0xd1b4('0x59')]['id']}})[_0xd1b4('0x1f')](handleEntityNotFound(_0x380f9b,null))['then'](function(_0x2f54c5){if(_0x2f54c5){return _0x2f54c5['setTags'](_0x898613['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x380f9b,null))[_0xd1b4('0x2a')](handleError(_0x380f9b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2745d75..4d60a22 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 _0xd438=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','int_freshdesk_configurations','lodash','util'];(function(_0x4f3492,_0x476c27){var _0x355bf4=function(_0x588d77){while(--_0x588d77){_0x4f3492['push'](_0x4f3492['shift']());}};_0x355bf4(++_0x476c27);}(_0xd438,0x174));var _0x8d43=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0xd438[_0x1e1965];return _0x1a2e96;};'use strict';var _=require(_0x8d43('0x0'));var util=require(_0x8d43('0x1'));var logger=require(_0x8d43('0x2'))('api');var moment=require(_0x8d43('0x3'));var BPromise=require(_0x8d43('0x4'));var rp=require(_0x8d43('0x5'));var fs=require('fs');var path=require(_0x8d43('0x6'));var rimraf=require(_0x8d43('0x7'));var config=require(_0x8d43('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x20c946,_0x5ad329){return _0x20c946[_0x8d43('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x8d43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6d0=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger'];(function(_0x53c9ee,_0x57b41a){var _0x466c12=function(_0x3f9eec){while(--_0x3f9eec){_0x53c9ee['push'](_0x53c9ee['shift']());}};_0x466c12(++_0x57b41a);}(_0xa6d0,0x18a));var _0x0a6d=function(_0x580785,_0x48200a){_0x580785=_0x580785-0x0;var _0xad9853=_0xa6d0[_0x580785];return _0xad9853;};'use strict';var _=require('lodash');var util=require(_0x0a6d('0x0'));var logger=require(_0x0a6d('0x1'))('api');var moment=require(_0x0a6d('0x2'));var BPromise=require(_0x0a6d('0x3'));var rp=require(_0x0a6d('0x4'));var fs=require('fs');var path=require(_0x0a6d('0x5'));var rimraf=require(_0x0a6d('0x6'));var config=require('../../config/environment');var attributes=require(_0x0a6d('0x7'));module[_0x0a6d('0x8')]=function(_0x328495,_0x37e13f){return _0x328495['define'](_0x0a6d('0x9'),attributes,{'tableName':_0x0a6d('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 db7f139..bdae738 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 _0xd337=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch'];(function(_0x133380,_0x5137b7){var _0x486823=function(_0xbc7be8){while(--_0xbc7be8){_0x133380['push'](_0x133380['shift']());}};_0x486823(++_0x5137b7);}(_0xd337,0x168));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d33('0x0'));var util=require('util');var moment=require(_0x7d33('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d33('0x2'));var db=require(_0x7d33('0x3'))['db'];var utils=require(_0x7d33('0x4'));var logger=require(_0x7d33('0x5'))(_0x7d33('0x6'));var config=require('../../config/environment');var jayson=require(_0x7d33('0x7'));var client=jayson[_0x7d33('0x8')][_0x7d33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b93c0,_0x31e4c1,_0x2bd5b9){return new BPromise(function(_0x5a3e7c,_0x107997){return client[_0x7d33('0xa')](_0x3b93c0,_0x2bd5b9)[_0x7d33('0xb')](function(_0x34c3c0){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x31e4c1,_0x7d33('0xc'));logger[_0x7d33('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x31e4c1,_0x7d33('0xc'),JSON[_0x7d33('0xe')](_0x34c3c0));if(_0x34c3c0['error']){if(_0x34c3c0[_0x7d33('0xf')]['code']===0x1f4){logger['error'](_0x7d33('0x10'),_0x31e4c1,_0x34c3c0['error'][_0x7d33('0x11')]);return _0x107997(_0x34c3c0[_0x7d33('0xf')][_0x7d33('0x11')]);}logger[_0x7d33('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x31e4c1,_0x34c3c0[_0x7d33('0xf')][_0x7d33('0x11')]);return _0x5a3e7c(_0x34c3c0[_0x7d33('0xf')]['message']);}else{logger[_0x7d33('0x12')](_0x7d33('0x10'),_0x31e4c1,_0x7d33('0xc'));_0x5a3e7c(_0x34c3c0['result'][_0x7d33('0x11')]);}})[_0x7d33('0x13')](function(_0x28bdba){logger[_0x7d33('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x31e4c1,_0x28bdba);_0x107997(_0x28bdba);});});} \ No newline at end of file +var _0x3c41=['client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x3c41,0x70));var _0x13c4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3c41[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x13c4('0x0'));var util=require(_0x13c4('0x1'));var moment=require(_0x13c4('0x2'));var BPromise=require(_0x13c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x13c4('0x5'))(_0x13c4('0x6'));var config=require(_0x13c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220545,_0x4454a2,_0x1b59d0){return new BPromise(function(_0x4b0905,_0x2d4642){return client[_0x13c4('0x9')](_0x220545,_0x1b59d0)[_0x13c4('0xa')](function(_0x53b488){logger['info'](_0x13c4('0xb'),_0x4454a2,_0x13c4('0xc'));logger['debug'](_0x13c4('0xd'),_0x4454a2,_0x13c4('0xc'),JSON[_0x13c4('0xe')](_0x53b488));if(_0x53b488[_0x13c4('0xf')]){if(_0x53b488[_0x13c4('0xf')]['code']===0x1f4){logger[_0x13c4('0xf')](_0x13c4('0xb'),_0x4454a2,_0x53b488['error'][_0x13c4('0x10')]);return _0x2d4642(_0x53b488['error'][_0x13c4('0x10')]);}logger[_0x13c4('0xf')](_0x13c4('0xb'),_0x4454a2,_0x53b488[_0x13c4('0xf')][_0x13c4('0x10')]);return _0x4b0905(_0x53b488[_0x13c4('0xf')]['message']);}else{logger[_0x13c4('0x11')](_0x13c4('0xb'),_0x4454a2,'request\x20sent');_0x4b0905(_0x53b488[_0x13c4('0x12')]['message']);}})[_0x13c4('0x13')](function(_0x51ca51){logger[_0x13c4('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4454a2,_0x51ca51);_0x2d4642(_0x51ca51);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a209b09..9fa7e7d 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x103605,_0x1f1415){var _0xeb2b20=function(_0x3ce8b0){while(--_0x3ce8b0){_0x103605['push'](_0x103605['shift']());}};_0xeb2b20(++_0x1f1415);}(_0x3e74,0x175));var _0x43e7=function(_0x5d7bf9,_0x9738dc){_0x5d7bf9=_0x5d7bf9-0x0;var _0x2f2994=_0x3e74[_0x5d7bf9];return _0x2f2994;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x370bb4,_0x1e46a2){var _0x2ca68b=function(_0x18823a){while(--_0x18823a){_0x370bb4['push'](_0x370bb4['shift']());}};_0x2ca68b(++_0x1e46a2);}(_0x008c,0x188));var _0xc008=function(_0x57ec1a,_0x2b7624){_0x57ec1a=_0x57ec1a-0x0;var _0x2159ad=_0x008c[_0x57ec1a];return _0x2159ad;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d3a7fb6..32c6c91 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 _0x9a19=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x9a19,0x114));var _0x99a1=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x9a19[_0x5ddaac];return _0x2a9c58;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'type':{'type':Sequelize[_0x99a1('0x2')]('string',_0x99a1('0x3'),_0x99a1('0x4'),_0x99a1('0x5')),'defaultValue':_0x99a1('0x6')},'content':{'type':Sequelize[_0x99a1('0x7')]},'key':{'type':Sequelize[_0x99a1('0x7')]},'keyType':{'type':Sequelize[_0x99a1('0x2')](_0x99a1('0x6'),_0x99a1('0x3'),_0x99a1('0x4'))},'keyContent':{'type':Sequelize[_0x99a1('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99a1('0x7')]}}; \ No newline at end of file +var _0xf131=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x4cdcb9,_0x39b0e8){var _0x2a5445=function(_0x4f10af){while(--_0x4f10af){_0x4cdcb9['push'](_0x4cdcb9['shift']());}};_0x2a5445(++_0x39b0e8);}(_0xf131,0x1a1));var _0x1f13=function(_0xfb5eb3,_0x40fb6b){_0xfb5eb3=_0xfb5eb3-0x0;var _0xa0add2=_0xf131[_0xfb5eb3];return _0xa0add2;};'use strict';var Sequelize=require(_0x1f13('0x0'));module[_0x1f13('0x1')]={'type':{'type':Sequelize[_0x1f13('0x2')](_0x1f13('0x3'),_0x1f13('0x4'),_0x1f13('0x5'),_0x1f13('0x6')),'defaultValue':_0x1f13('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1f13('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1f13('0x3'),_0x1f13('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x1f13('0x7')]},'idField':{'type':Sequelize[_0x1f13('0x7')]},'nameField':{'type':Sequelize[_0x1f13('0x7')]},'customField':{'type':Sequelize[_0x1f13('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f13('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a22aaef..021f174 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 _0x00a8=['rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','keys','includeAll','options','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','end','error','send','index','map','FreshdeskField'];(function(_0x76577e,_0x4f42e5){var _0x1b13c7=function(_0x269df4){while(--_0x269df4){_0x76577e['push'](_0x76577e['shift']());}};_0x1b13c7(++_0x4f42e5);}(_0x00a8,0xb3));var _0x800a=function(_0x1b637f,_0x29190b){_0x1b637f=_0x1b637f-0x0;var _0x3f4869=_0x00a8[_0x1b637f];return _0x3f4869;};'use strict';var pdf=require(_0x800a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x800a('0x1'));var zipdir=require(_0x800a('0x2'));var jsonpatch=require(_0x800a('0x3'));var rp=require('request-promise');var moment=require(_0x800a('0x4'));var BPromise=require(_0x800a('0x5'));var Mustache=require(_0x800a('0x6'));var util=require(_0x800a('0x7'));var path=require(_0x800a('0x8'));var sox=require(_0x800a('0x9'));var csv=require(_0x800a('0xa'));var ejs=require(_0x800a('0xb'));var fs=require('fs');var _=require(_0x800a('0xc'));var squel=require(_0x800a('0xd'));var crypto=require(_0x800a('0xe'));var jsforce=require(_0x800a('0xf'));var deskjs=require(_0x800a('0x10'));var toCsv=require(_0x800a('0xa'));var querystring=require(_0x800a('0x11'));var Papa=require(_0x800a('0x12'));var Redis=require(_0x800a('0x13'));var authService=require(_0x800a('0x14'));var qs=require(_0x800a('0x15'));var as=require(_0x800a('0x16'));var hardwareService=require(_0x800a('0x17'));var logger=require('../../config/logger')(_0x800a('0x18'));var utils=require(_0x800a('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x800a('0x1a'))['db'];function respondWithStatusCode(_0x23d9e1,_0x1a12f1){_0x1a12f1=_0x1a12f1||0xcc;return function(_0x25c791){if(_0x25c791){return _0x23d9e1[_0x800a('0x1b')](_0x1a12f1);}return _0x23d9e1[_0x800a('0x1c')](_0x1a12f1)['end']();};}function respondWithResult(_0x5eb3ae,_0x4b849c){_0x4b849c=_0x4b849c||0xc8;return function(_0x2566c5){if(_0x2566c5){return _0x5eb3ae[_0x800a('0x1c')](_0x4b849c)[_0x800a('0x1d')](_0x2566c5);}};}function respondWithFilteredResult(_0x3075b4,_0x1dfe5f){return function(_0x3a6041){if(_0x3a6041){var _0x2f1d23=_0x3a6041[_0x800a('0x1e')],_0x482b99=_0x1dfe5f[_0x800a('0x1f')],_0x24e97e=_0x1dfe5f['offset']+_0x1dfe5f[_0x800a('0x20')],_0xba1692;if(_0x24e97e>=_0x2f1d23){_0x24e97e=_0x2f1d23;_0xba1692=0xc8;}else{_0xba1692=0xce;}_0x3075b4[_0x800a('0x1c')](_0xba1692);return _0x3075b4[_0x800a('0x21')](_0x800a('0x22'),_0x482b99+'-'+_0x24e97e+'/'+_0x2f1d23)[_0x800a('0x1d')](_0x3a6041);}return null;};}function patchUpdates(_0x285be1){return function(_0x182a95){try{jsonpatch['apply'](_0x182a95,_0x285be1,!![]);}catch(_0x5e2a89){return BPromise[_0x800a('0x23')](_0x5e2a89);}return _0x182a95[_0x800a('0x24')]();};}function saveUpdates(_0x9f31b9,_0x2e52ba){return function(_0x3dd9d7){if(_0x3dd9d7){return _0x3dd9d7[_0x800a('0x25')](_0x9f31b9)['then'](function(_0x2afbb2){return _0x2afbb2;});}return null;};}function removeEntity(_0x3029ce,_0x5ea727){return function(_0x19f48c){if(_0x19f48c){return _0x19f48c[_0x800a('0x26')]()[_0x800a('0x27')](function(){_0x3029ce['status'](0xcc)[_0x800a('0x28')]();});}};}function handleEntityNotFound(_0x25b14e,_0x2c48fd){return function(_0x5b3434){if(!_0x5b3434){_0x25b14e[_0x800a('0x1b')](0x194);}return _0x5b3434;};}function handleError(_0x4a6342,_0x16944c){_0x16944c=_0x16944c||0x1f4;return function(_0x5e15b3){logger[_0x800a('0x29')](_0x5e15b3['stack']);if(_0x5e15b3['name']){delete _0x5e15b3['name'];}_0x4a6342[_0x800a('0x1c')](_0x16944c)[_0x800a('0x2a')](_0x5e15b3);};}exports[_0x800a('0x2b')]=function(_0x4a9c99,_0x4e7bb8){var _0x1e75de={},_0x55b569={},_0x1541cf={'count':0x0,'rows':[]};var _0x36a70e=_[_0x800a('0x2c')](db[_0x800a('0x2d')][_0x800a('0x2e')],function(_0x384cf9){return{'name':_0x384cf9[_0x800a('0x2f')],'type':_0x384cf9['type'][_0x800a('0x30')]};});_0x55b569[_0x800a('0x31')]=_['map'](_0x36a70e,_0x800a('0x32'));_0x55b569[_0x800a('0x33')]=_['keys'](_0x4a9c99[_0x800a('0x33')]);_0x55b569[_0x800a('0x34')]=_[_0x800a('0x35')](_0x55b569[_0x800a('0x31')],_0x55b569[_0x800a('0x33')]);_0x1e75de[_0x800a('0x36')]=_[_0x800a('0x35')](_0x55b569['model'],qs[_0x800a('0x37')](_0x4a9c99[_0x800a('0x33')][_0x800a('0x37')]));_0x1e75de['attributes']=_0x1e75de[_0x800a('0x36')][_0x800a('0x38')]?_0x1e75de[_0x800a('0x36')]:_0x55b569[_0x800a('0x31')];if(!_0x4a9c99[_0x800a('0x33')][_0x800a('0x39')](_0x800a('0x3a'))){_0x1e75de[_0x800a('0x20')]=qs[_0x800a('0x20')](_0x4a9c99[_0x800a('0x33')][_0x800a('0x20')]);_0x1e75de[_0x800a('0x1f')]=qs[_0x800a('0x1f')](_0x4a9c99['query'][_0x800a('0x1f')]);}_0x1e75de[_0x800a('0x3b')]=qs[_0x800a('0x3c')](_0x4a9c99['query']['sort']);_0x1e75de[_0x800a('0x3d')]=qs[_0x800a('0x34')](_[_0x800a('0x3e')](_0x4a9c99[_0x800a('0x33')],_0x55b569[_0x800a('0x34')]),_0x36a70e);if(_0x4a9c99[_0x800a('0x33')][_0x800a('0x3f')]){_0x1e75de[_0x800a('0x3d')]=_['merge'](_0x1e75de[_0x800a('0x3d')],{'$or':_['map'](_0x36a70e,function(_0x4eb119){if(_0x4eb119['type']!=='VIRTUAL'){var _0x5928d4={};_0x5928d4[_0x4eb119['name']]={'$like':'%'+_0x4a9c99[_0x800a('0x33')][_0x800a('0x3f')]+'%'};return _0x5928d4;}})});}_0x1e75de=_[_0x800a('0x40')]({},_0x1e75de,_0x4a9c99['options']);var _0x339fda={'where':_0x1e75de[_0x800a('0x3d')]};return db[_0x800a('0x2d')][_0x800a('0x1e')](_0x339fda)['then'](function(_0x2945c7){_0x1541cf[_0x800a('0x1e')]=_0x2945c7;if(_0x4a9c99[_0x800a('0x33')]['includeAll']){_0x1e75de[_0x800a('0x41')]=[{'all':!![]}];}return db[_0x800a('0x2d')]['findAll'](_0x1e75de);})[_0x800a('0x27')](function(_0x4fde12){_0x1541cf[_0x800a('0x42')]=_0x4fde12;return _0x1541cf;})[_0x800a('0x27')](respondWithFilteredResult(_0x4e7bb8,_0x1e75de))[_0x800a('0x43')](handleError(_0x4e7bb8,null));};exports[_0x800a('0x44')]=function(_0x42fa1f,_0x5795e9){var _0x2dc47c={'raw':!![],'where':{'id':_0x42fa1f['params']['id']}},_0x78b993={};_0x78b993['model']=_['keys'](db[_0x800a('0x2d')]['rawAttributes']);_0x78b993['query']=_[_0x800a('0x45')](_0x42fa1f[_0x800a('0x33')]);_0x78b993['filters']=_[_0x800a('0x35')](_0x78b993[_0x800a('0x31')],_0x78b993[_0x800a('0x33')]);_0x2dc47c['attributes']=_['intersection'](_0x78b993['model'],qs[_0x800a('0x37')](_0x42fa1f[_0x800a('0x33')]['fields']));_0x2dc47c['attributes']=_0x2dc47c[_0x800a('0x36')][_0x800a('0x38')]?_0x2dc47c[_0x800a('0x36')]:_0x78b993['model'];if(_0x42fa1f[_0x800a('0x33')][_0x800a('0x46')]){_0x2dc47c['include']=[{'all':!![]}];}_0x2dc47c=_[_0x800a('0x40')]({},_0x2dc47c,_0x42fa1f[_0x800a('0x47')]);return db[_0x800a('0x2d')]['find'](_0x2dc47c)[_0x800a('0x27')](handleEntityNotFound(_0x5795e9,null))['then'](respondWithResult(_0x5795e9,null))[_0x800a('0x43')](handleError(_0x5795e9,null));};exports['create']=function(_0x18fcee,_0x3aa9cc){return db[_0x800a('0x2d')]['create'](_0x18fcee['body'],{})[_0x800a('0x27')](respondWithResult(_0x3aa9cc,0xc9))[_0x800a('0x43')](handleError(_0x3aa9cc,null));};exports[_0x800a('0x25')]=function(_0x4edc11,_0x35a86f){if(_0x4edc11[_0x800a('0x48')]['id']){delete _0x4edc11['body']['id'];}return db['FreshdeskField'][_0x800a('0x49')]({'where':{'id':_0x4edc11[_0x800a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35a86f,null))[_0x800a('0x27')](saveUpdates(_0x4edc11[_0x800a('0x48')],null))[_0x800a('0x27')](respondWithResult(_0x35a86f,null))[_0x800a('0x43')](handleError(_0x35a86f,null));};exports[_0x800a('0x26')]=function(_0x1e3e03,_0x234ca6){return db[_0x800a('0x2d')][_0x800a('0x49')]({'where':{'id':_0x1e3e03[_0x800a('0x4a')]['id']}})[_0x800a('0x27')](handleEntityNotFound(_0x234ca6,null))[_0x800a('0x27')](removeEntity(_0x234ca6,null))['catch'](handleError(_0x234ca6,null));}; \ No newline at end of file +var _0xdcf2=['path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x24256d,_0x2b97c5){var _0x38fde8=function(_0x5c851e){while(--_0x5c851e){_0x24256d['push'](_0x24256d['shift']());}};_0x38fde8(++_0x2b97c5);}(_0xdcf2,0x115));var _0x2dcf=function(_0x41c7ee,_0x4a3022){_0x41c7ee=_0x41c7ee-0x0;var _0x1768a8=_0xdcf2[_0x41c7ee];return _0x1768a8;};'use strict';var pdf=require(_0x2dcf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2dcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2dcf('0x2'));var moment=require(_0x2dcf('0x3'));var BPromise=require(_0x2dcf('0x4'));var Mustache=require(_0x2dcf('0x5'));var util=require(_0x2dcf('0x6'));var path=require(_0x2dcf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2dcf('0x8'));var fs=require('fs');var _=require(_0x2dcf('0x9'));var squel=require(_0x2dcf('0xa'));var crypto=require('crypto');var jsforce=require(_0x2dcf('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dcf('0xc'));var Papa=require(_0x2dcf('0xd'));var Redis=require(_0x2dcf('0xe'));var authService=require(_0x2dcf('0xf'));var qs=require(_0x2dcf('0x10'));var as=require(_0x2dcf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2dcf('0x12'));var licenseUtil=require(_0x2dcf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ef07,_0x3f78b4){_0x3f78b4=_0x3f78b4||0xcc;return function(_0x157a7e){if(_0x157a7e){return _0x35ef07['sendStatus'](_0x3f78b4);}return _0x35ef07[_0x2dcf('0x14')](_0x3f78b4)[_0x2dcf('0x15')]();};}function respondWithResult(_0x13f03d,_0x447c01){_0x447c01=_0x447c01||0xc8;return function(_0x53833c){if(_0x53833c){return _0x13f03d['status'](_0x447c01)[_0x2dcf('0x16')](_0x53833c);}};}function respondWithFilteredResult(_0x36835b,_0x33a3c6){return function(_0xa01830){if(_0xa01830){var _0x527e41=_0xa01830[_0x2dcf('0x17')],_0x51b683=_0x33a3c6[_0x2dcf('0x18')],_0x5dac7f=_0x33a3c6[_0x2dcf('0x18')]+_0x33a3c6[_0x2dcf('0x19')],_0x4594dd;if(_0x5dac7f>=_0x527e41){_0x5dac7f=_0x527e41;_0x4594dd=0xc8;}else{_0x4594dd=0xce;}_0x36835b[_0x2dcf('0x14')](_0x4594dd);return _0x36835b[_0x2dcf('0x1a')](_0x2dcf('0x1b'),_0x51b683+'-'+_0x5dac7f+'/'+_0x527e41)[_0x2dcf('0x16')](_0xa01830);}return null;};}function patchUpdates(_0x4b55da){return function(_0x5c48c0){try{jsonpatch[_0x2dcf('0x1c')](_0x5c48c0,_0x4b55da,!![]);}catch(_0x1c1f58){return BPromise[_0x2dcf('0x1d')](_0x1c1f58);}return _0x5c48c0[_0x2dcf('0x1e')]();};}function saveUpdates(_0x2e5fa6,_0x266763){return function(_0x590f69){if(_0x590f69){return _0x590f69[_0x2dcf('0x1f')](_0x2e5fa6)[_0x2dcf('0x20')](function(_0x421cb1){return _0x421cb1;});}return null;};}function removeEntity(_0x40e1a0,_0x2acaa9){return function(_0x3d52d9){if(_0x3d52d9){return _0x3d52d9[_0x2dcf('0x21')]()[_0x2dcf('0x20')](function(){_0x40e1a0['status'](0xcc)[_0x2dcf('0x15')]();});}};}function handleEntityNotFound(_0x1f4ffd,_0x2c71c2){return function(_0x322e96){if(!_0x322e96){_0x1f4ffd[_0x2dcf('0x22')](0x194);}return _0x322e96;};}function handleError(_0x5d8024,_0x5f2cd3){_0x5f2cd3=_0x5f2cd3||0x1f4;return function(_0xa259dd){logger[_0x2dcf('0x23')](_0xa259dd[_0x2dcf('0x24')]);if(_0xa259dd['name']){delete _0xa259dd[_0x2dcf('0x25')];}_0x5d8024[_0x2dcf('0x14')](_0x5f2cd3)[_0x2dcf('0x26')](_0xa259dd);};}exports['index']=function(_0x265178,_0x151daa){var _0x3f1f8a={},_0x34c854={},_0x4153a8={'count':0x0,'rows':[]};var _0x2c29d1=_[_0x2dcf('0x27')](db[_0x2dcf('0x28')][_0x2dcf('0x29')],function(_0x3ae779){return{'name':_0x3ae779[_0x2dcf('0x2a')],'type':_0x3ae779[_0x2dcf('0x2b')][_0x2dcf('0x2c')]};});_0x34c854['model']=_[_0x2dcf('0x27')](_0x2c29d1,_0x2dcf('0x25'));_0x34c854['query']=_[_0x2dcf('0x2d')](_0x265178[_0x2dcf('0x2e')]);_0x34c854['filters']=_['intersection'](_0x34c854[_0x2dcf('0x2f')],_0x34c854[_0x2dcf('0x2e')]);_0x3f1f8a['attributes']=_[_0x2dcf('0x30')](_0x34c854[_0x2dcf('0x2f')],qs['fields'](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x31')]));_0x3f1f8a[_0x2dcf('0x32')]=_0x3f1f8a[_0x2dcf('0x32')][_0x2dcf('0x33')]?_0x3f1f8a[_0x2dcf('0x32')]:_0x34c854[_0x2dcf('0x2f')];if(!_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x34')](_0x2dcf('0x35'))){_0x3f1f8a[_0x2dcf('0x19')]=qs[_0x2dcf('0x19')](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x19')]);_0x3f1f8a[_0x2dcf('0x18')]=qs[_0x2dcf('0x18')](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x18')]);}_0x3f1f8a['order']=qs[_0x2dcf('0x36')](_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x36')]);_0x3f1f8a['where']=qs[_0x2dcf('0x37')](_[_0x2dcf('0x38')](_0x265178[_0x2dcf('0x2e')],_0x34c854[_0x2dcf('0x37')]),_0x2c29d1);if(_0x265178[_0x2dcf('0x2e')]['filter']){_0x3f1f8a['where']=_[_0x2dcf('0x39')](_0x3f1f8a[_0x2dcf('0x3a')],{'$or':_[_0x2dcf('0x27')](_0x2c29d1,function(_0x53354f){if(_0x53354f[_0x2dcf('0x2b')]!==_0x2dcf('0x3b')){var _0x50d6dd={};_0x50d6dd[_0x53354f['name']]={'$like':'%'+_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x3c')]+'%'};return _0x50d6dd;}})});}_0x3f1f8a=_['merge']({},_0x3f1f8a,_0x265178[_0x2dcf('0x3d')]);var _0x3e437c={'where':_0x3f1f8a['where']};return db[_0x2dcf('0x28')][_0x2dcf('0x17')](_0x3e437c)[_0x2dcf('0x20')](function(_0x11ac5d){_0x4153a8[_0x2dcf('0x17')]=_0x11ac5d;if(_0x265178[_0x2dcf('0x2e')][_0x2dcf('0x3e')]){_0x3f1f8a[_0x2dcf('0x3f')]=[{'all':!![]}];}return db[_0x2dcf('0x28')][_0x2dcf('0x40')](_0x3f1f8a);})[_0x2dcf('0x20')](function(_0x5e613b){_0x4153a8[_0x2dcf('0x41')]=_0x5e613b;return _0x4153a8;})['then'](respondWithFilteredResult(_0x151daa,_0x3f1f8a))[_0x2dcf('0x42')](handleError(_0x151daa,null));};exports['show']=function(_0x2cc589,_0x35e708){var _0x1fbd59={'raw':!![],'where':{'id':_0x2cc589[_0x2dcf('0x43')]['id']}},_0x31a62f={};_0x31a62f[_0x2dcf('0x2f')]=_[_0x2dcf('0x2d')](db[_0x2dcf('0x28')][_0x2dcf('0x29')]);_0x31a62f[_0x2dcf('0x2e')]=_[_0x2dcf('0x2d')](_0x2cc589[_0x2dcf('0x2e')]);_0x31a62f[_0x2dcf('0x37')]=_[_0x2dcf('0x30')](_0x31a62f[_0x2dcf('0x2f')],_0x31a62f[_0x2dcf('0x2e')]);_0x1fbd59[_0x2dcf('0x32')]=_[_0x2dcf('0x30')](_0x31a62f['model'],qs['fields'](_0x2cc589[_0x2dcf('0x2e')][_0x2dcf('0x31')]));_0x1fbd59[_0x2dcf('0x32')]=_0x1fbd59[_0x2dcf('0x32')][_0x2dcf('0x33')]?_0x1fbd59[_0x2dcf('0x32')]:_0x31a62f['model'];if(_0x2cc589['query']['includeAll']){_0x1fbd59[_0x2dcf('0x3f')]=[{'all':!![]}];}_0x1fbd59=_['merge']({},_0x1fbd59,_0x2cc589['options']);return db['FreshdeskField'][_0x2dcf('0x44')](_0x1fbd59)[_0x2dcf('0x20')](handleEntityNotFound(_0x35e708,null))[_0x2dcf('0x20')](respondWithResult(_0x35e708,null))['catch'](handleError(_0x35e708,null));};exports[_0x2dcf('0x45')]=function(_0x145374,_0x711daa){return db[_0x2dcf('0x28')][_0x2dcf('0x45')](_0x145374['body'],{})['then'](respondWithResult(_0x711daa,0xc9))[_0x2dcf('0x42')](handleError(_0x711daa,null));};exports[_0x2dcf('0x1f')]=function(_0x170265,_0x17a93b){if(_0x170265[_0x2dcf('0x46')]['id']){delete _0x170265[_0x2dcf('0x46')]['id'];}return db[_0x2dcf('0x28')]['find']({'where':{'id':_0x170265[_0x2dcf('0x43')]['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x17a93b,null))[_0x2dcf('0x20')](saveUpdates(_0x170265[_0x2dcf('0x46')],null))['then'](respondWithResult(_0x17a93b,null))['catch'](handleError(_0x17a93b,null));};exports[_0x2dcf('0x21')]=function(_0x33951f,_0x18da28){return db[_0x2dcf('0x28')]['find']({'where':{'id':_0x33951f[_0x2dcf('0x43')]['id']}})[_0x2dcf('0x20')](handleEntityNotFound(_0x18da28,null))[_0x2dcf('0x20')](removeEntity(_0x18da28,null))[_0x2dcf('0x42')](handleError(_0x18da28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5e4d143..ddfb5b7 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 _0xd31b=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x42cef3,_0x47db8a){var _0x2a2a85=function(_0x4d98d4){while(--_0x4d98d4){_0x42cef3['push'](_0x42cef3['shift']());}};_0x2a2a85(++_0x47db8a);}(_0xd31b,0x1dd));var _0xbd31=function(_0x54f859,_0x59d463){_0x54f859=_0x54f859-0x0;var _0x17a08b=_0xd31b[_0x54f859];return _0x17a08b;};'use strict';var _=require(_0xbd31('0x0'));var util=require(_0xbd31('0x1'));var logger=require(_0xbd31('0x2'))(_0xbd31('0x3'));var moment=require(_0xbd31('0x4'));var BPromise=require(_0xbd31('0x5'));var rp=require(_0xbd31('0x6'));var fs=require('fs');var path=require(_0xbd31('0x7'));var rimraf=require(_0xbd31('0x8'));var config=require('../../config/environment');var attributes=require(_0xbd31('0x9'));module['exports']=function(_0x1dc1f0,_0x3f99be){return _0x1dc1f0[_0xbd31('0xa')]('FreshdeskField',attributes,{'tableName':_0xbd31('0xb'),'paranoid':![],'indexes':[{'name':_0xbd31('0xc'),'fields':['idField',_0xbd31('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90bb=['freshdesk_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x3d71d3,_0x11caf1){var _0x30ec87=function(_0x308f30){while(--_0x308f30){_0x3d71d3['push'](_0x3d71d3['shift']());}};_0x30ec87(++_0x11caf1);}(_0x90bb,0xc4));var _0xb90b=function(_0x211fe4,_0x35479b){_0x211fe4=_0x211fe4-0x0;var _0xc6d980=_0x90bb[_0x211fe4];return _0xc6d980;};'use strict';var _=require(_0xb90b('0x0'));var util=require(_0xb90b('0x1'));var logger=require(_0xb90b('0x2'))(_0xb90b('0x3'));var moment=require(_0xb90b('0x4'));var BPromise=require(_0xb90b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb90b('0x6'));var rimraf=require(_0xb90b('0x7'));var config=require(_0xb90b('0x8'));var attributes=require(_0xb90b('0x9'));module[_0xb90b('0xa')]=function(_0x55dce9,_0x19a7a5){return _0x55dce9[_0xb90b('0xb')](_0xb90b('0xc'),attributes,{'tableName':_0xb90b('0xd'),'paranoid':![],'indexes':[{'name':_0xb90b('0xe'),'fields':['idField','FieldId'],'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 7076986..9ef37c2 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5f1992,_0x128523){var _0x1a2bc8=function(_0x42e8b5){while(--_0x42e8b5){_0x5f1992['push'](_0x5f1992['shift']());}};_0x1a2bc8(++_0x128523);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aba4f,_0x1afb63){_0x5aba4f=_0x5aba4f-0x0;var _0x10cf5c=_0xb10b[_0x5aba4f];return _0x10cf5c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _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(_0x3dd6ba,_0x2effd0){var _0x2cf761=function(_0x17d89c){while(--_0x17d89c){_0x3dd6ba['push'](_0x3dd6ba['shift']());}};_0x2cf761(++_0x2effd0);}(_0xb10b,0x12a));var _0xbb10=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0xb10b[_0x251d43];return _0x3d7759;};'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 ce389d6..9379732 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 _0xd90b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd90b,0x1ce));var _0xbd90=function(_0x580fe1,_0x49843f){_0x580fe1=_0x580fe1-0x0;var _0x285b16=_0xd90b[_0x580fe1];return _0x285b16;};'use strict';var multer=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var path=require(_0xbd90('0x2'));var timeout=require(_0xbd90('0x3'));var express=require(_0xbd90('0x4'));var router=express[_0xbd90('0x5')]();var auth=require(_0xbd90('0x6'));var interaction=require(_0xbd90('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xbd90('0x8')](),controller['index']);router[_0xbd90('0x9')]('/:id',auth[_0xbd90('0x8')](),controller['show']);router[_0xbd90('0x9')](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller[_0xbd90('0xb')]);router[_0xbd90('0x9')](_0xbd90('0xc'),auth['isAuthenticated'](),controller[_0xbd90('0xd')]);router[_0xbd90('0xe')]('/',auth['isAuthenticated'](),controller[_0xbd90('0xf')]);router['post'](_0xbd90('0xa'),auth[_0xbd90('0x8')](),controller['addConfiguration']);router[_0xbd90('0x10')](_0xbd90('0x11'),auth['isAuthenticated'](),controller[_0xbd90('0x12')]);router[_0xbd90('0x13')](_0xbd90('0x11'),auth[_0xbd90('0x8')](),controller[_0xbd90('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3aaa=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x47fd45,_0x40dd67){var _0x363313=function(_0xb92163){while(--_0xb92163){_0x47fd45['push'](_0x47fd45['shift']());}};_0x363313(++_0x40dd67);}(_0x3aaa,0x8d));var _0xa3aa=function(_0x4e773d,_0x22571a){_0x4e773d=_0x4e773d-0x0;var _0x42363c=_0x3aaa[_0x4e773d];return _0x42363c;};'use strict';var multer=require(_0xa3aa('0x0'));var util=require(_0xa3aa('0x1'));var path=require(_0xa3aa('0x2'));var timeout=require(_0xa3aa('0x3'));var express=require(_0xa3aa('0x4'));var router=express[_0xa3aa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa3aa('0x6'));var config=require(_0xa3aa('0x7'));var controller=require(_0xa3aa('0x8'));router[_0xa3aa('0x9')]('/',auth[_0xa3aa('0xa')](),controller[_0xa3aa('0xb')]);router[_0xa3aa('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa3aa('0x9')](_0xa3aa('0xc'),auth['isAuthenticated'](),controller[_0xa3aa('0xd')]);router['get'](_0xa3aa('0xe'),auth[_0xa3aa('0xa')](),controller[_0xa3aa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa3aa('0x10')]);router[_0xa3aa('0x11')](_0xa3aa('0xc'),auth[_0xa3aa('0xa')](),controller[_0xa3aa('0x12')]);router[_0xa3aa('0x13')](_0xa3aa('0x14'),auth[_0xa3aa('0xa')](),controller['update']);router[_0xa3aa('0x15')](_0xa3aa('0x14'),auth[_0xa3aa('0xa')](),controller[_0xa3aa('0x16')]);module[_0xa3aa('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 54f8abd..c220d80 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 _0x42cc=['exports','STRING','username','remoteUri','sequelize'];(function(_0x28240d,_0x419a72){var _0x52725f=function(_0x233aa0){while(--_0x233aa0){_0x28240d['push'](_0x28240d['shift']());}};_0x52725f(++_0x419a72);}(_0x42cc,0x194));var _0xc42c=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x42cc[_0x2431d6];return _0x4d0f9b;};'use strict';var Sequelize=require(_0xc42c('0x0'));module[_0xc42c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc42c('0x2')]},'username':{'type':Sequelize[_0xc42c('0x2')],'unique':_0xc42c('0x3')},'apiKey':{'type':Sequelize[_0xc42c('0x2')]},'remoteUri':{'type':Sequelize[_0xc42c('0x2')],'unique':_0xc42c('0x4')},'serverUrl':{'type':Sequelize[_0xc42c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5e7d=['exports','STRING','username','remoteUri','sequelize'];(function(_0x3fb150,_0x5e32ed){var _0x56f4a8=function(_0x57924c){while(--_0x57924c){_0x3fb150['push'](_0x3fb150['shift']());}};_0x56f4a8(++_0x5e32ed);}(_0x5e7d,0xb8));var _0xd5e7=function(_0x525847,_0x240458){_0x525847=_0x525847-0x0;var _0x4b8fb9=_0x5e7d[_0x525847];return _0x4b8fb9;};'use strict';var Sequelize=require(_0xd5e7('0x0'));module[_0xd5e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd5e7('0x2')],'unique':_0xd5e7('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd5e7('0x2')],'unique':_0xd5e7('0x4')},'serverUrl':{'type':Sequelize[_0xd5e7('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 2b96d81..c228f04 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 _0x13f6=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','status','json','count','offset','limit','reject','save','update','destroy','name','send','index','map','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','findAll','rows','show','params','length','find','body','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','FreshsalesField','username','remoteUri','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','getFields','test','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js'];(function(_0x1bad41,_0x76080f){var _0x101daa=function(_0x2e53b2){while(--_0x2e53b2){_0x1bad41['push'](_0x1bad41['shift']());}};_0x101daa(++_0x76080f);}(_0x13f6,0x124));var _0x613f=function(_0x1af91a,_0x308ab2){_0x1af91a=_0x1af91a-0x0;var _0x5c1fa6=_0x13f6[_0x1af91a];return _0x5c1fa6;};'use strict';var pdf=require(_0x613f('0x0'));var emlformat=require(_0x613f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x613f('0x2'));var rp=require(_0x613f('0x3'));var moment=require(_0x613f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613f('0x5'));var util=require(_0x613f('0x6'));var path=require(_0x613f('0x7'));var sox=require('sox');var csv=require(_0x613f('0x8'));var ejs=require(_0x613f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0x8'));var querystring=require(_0x613f('0xb'));var Papa=require(_0x613f('0xc'));var Redis=require('ioredis');var authService=require(_0x613f('0xd'));var qs=require(_0x613f('0xe'));var as=require(_0x613f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x10'))(_0x613f('0x11'));var utils=require(_0x613f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x13'));var db=require(_0x613f('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x613f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1ebab5,_0x3832d8,_0x375db1,_0x329fcf){return new BPromise(function(_0x4a6fc,_0x305894){var _0x291268=_0x329fcf||client;return _0x291268[_0x613f('0x16')](_0x1ebab5,_0x375db1)[_0x613f('0x17')](function(_0x548218){logger[_0x613f('0x18')]('FreshsalesAccount,\x20%s,\x20%s',_0x3832d8,'request\x20sent');logger[_0x613f('0x19')](_0x613f('0x1a'),_0x3832d8,'request\x20sent',JSON[_0x613f('0x1b')](_0x548218));if(_0x548218['error']){if(_0x548218[_0x613f('0x1c')][_0x613f('0x1d')]===0x1f4){logger[_0x613f('0x1c')](_0x613f('0x1e'),_0x3832d8,_0x548218[_0x613f('0x1c')][_0x613f('0x1f')]);return _0x305894(_0x548218['error']['message']);}logger[_0x613f('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x3832d8,_0x548218['error'][_0x613f('0x1f')]);return _0x4a6fc(_0x548218[_0x613f('0x1c')]['message']);}else{logger[_0x613f('0x18')](_0x613f('0x1e'),_0x3832d8,_0x613f('0x20'));_0x4a6fc(_0x548218['result']['message']);}})[_0x613f('0x21')](function(_0x309437){logger[_0x613f('0x1c')]('FreshsalesAccount,\x20%s,\x20%s',_0x3832d8,_0x309437);_0x305894(_0x309437);});});}function respondWithStatusCode(_0x41104e,_0x33e0c6){_0x33e0c6=_0x33e0c6||0xcc;return function(_0x30de90){if(_0x30de90){return _0x41104e[_0x613f('0x22')](_0x33e0c6);}return _0x41104e[_0x613f('0x23')](_0x33e0c6)['end']();};}function respondWithResult(_0x30fb15,_0x204185){_0x204185=_0x204185||0xc8;return function(_0x51bba1){if(_0x51bba1){return _0x30fb15[_0x613f('0x23')](_0x204185)[_0x613f('0x24')](_0x51bba1);}};}function respondWithFilteredResult(_0x32e747,_0x4a878d){return function(_0x53e32b){if(_0x53e32b){var _0x5a4a8b=_0x53e32b[_0x613f('0x25')],_0x379920=_0x4a878d['offset'],_0x594c28=_0x4a878d[_0x613f('0x26')]+_0x4a878d[_0x613f('0x27')],_0x412269;if(_0x594c28>=_0x5a4a8b){_0x594c28=_0x5a4a8b;_0x412269=0xc8;}else{_0x412269=0xce;}_0x32e747['status'](_0x412269);return _0x32e747['set']('Content-Range',_0x379920+'-'+_0x594c28+'/'+_0x5a4a8b)[_0x613f('0x24')](_0x53e32b);}return null;};}function patchUpdates(_0x7c1a94){return function(_0xcad8d6){try{jsonpatch['apply'](_0xcad8d6,_0x7c1a94,!![]);}catch(_0x23eda8){return BPromise[_0x613f('0x28')](_0x23eda8);}return _0xcad8d6[_0x613f('0x29')]();};}function saveUpdates(_0x19bb8f,_0x4f8500){return function(_0x31ccbd){if(_0x31ccbd){return _0x31ccbd[_0x613f('0x2a')](_0x19bb8f)[_0x613f('0x17')](function(_0x728f45){return _0x728f45;});}return null;};}function removeEntity(_0x10fa2b,_0x1664f1){return function(_0x5d7e9a){if(_0x5d7e9a){return _0x5d7e9a[_0x613f('0x2b')]()[_0x613f('0x17')](function(){_0x10fa2b[_0x613f('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a1d1,_0x4af0de){return function(_0x3df7bf){if(!_0x3df7bf){_0x21a1d1[_0x613f('0x22')](0x194);}return _0x3df7bf;};}function handleError(_0xc8976c,_0x28c06c){_0x28c06c=_0x28c06c||0x1f4;return function(_0x2bceaa){logger[_0x613f('0x1c')](_0x2bceaa['stack']);if(_0x2bceaa[_0x613f('0x2c')]){delete _0x2bceaa[_0x613f('0x2c')];}_0xc8976c[_0x613f('0x23')](_0x28c06c)[_0x613f('0x2d')](_0x2bceaa);};}exports[_0x613f('0x2e')]=function(_0x47a9f6,_0x59236e){var _0x4eea2c={},_0x3d79f0={},_0x72c804={'count':0x0,'rows':[]};var _0x22074f=_[_0x613f('0x2f')](db['FreshsalesAccount'][_0x613f('0x30')],function(_0xaedbbd){return{'name':_0xaedbbd['fieldName'],'type':_0xaedbbd[_0x613f('0x31')]['key']};});_0x3d79f0[_0x613f('0x32')]=_['map'](_0x22074f,_0x613f('0x2c'));_0x3d79f0['query']=_[_0x613f('0x33')](_0x47a9f6[_0x613f('0x34')]);_0x3d79f0[_0x613f('0x35')]=_['intersection'](_0x3d79f0[_0x613f('0x32')],_0x3d79f0[_0x613f('0x34')]);_0x4eea2c[_0x613f('0x36')]=_[_0x613f('0x37')](_0x3d79f0[_0x613f('0x32')],qs[_0x613f('0x38')](_0x47a9f6[_0x613f('0x34')][_0x613f('0x38')]));_0x4eea2c[_0x613f('0x36')]=_0x4eea2c[_0x613f('0x36')]['length']?_0x4eea2c[_0x613f('0x36')]:_0x3d79f0[_0x613f('0x32')];if(!_0x47a9f6[_0x613f('0x34')][_0x613f('0x39')](_0x613f('0x3a'))){_0x4eea2c[_0x613f('0x27')]=qs[_0x613f('0x27')](_0x47a9f6['query'][_0x613f('0x27')]);_0x4eea2c[_0x613f('0x26')]=qs[_0x613f('0x26')](_0x47a9f6[_0x613f('0x34')][_0x613f('0x26')]);}_0x4eea2c[_0x613f('0x3b')]=qs[_0x613f('0x3c')](_0x47a9f6['query'][_0x613f('0x3c')]);_0x4eea2c[_0x613f('0x3d')]=qs[_0x613f('0x35')](_[_0x613f('0x3e')](_0x47a9f6[_0x613f('0x34')],_0x3d79f0[_0x613f('0x35')]),_0x22074f);if(_0x47a9f6[_0x613f('0x34')][_0x613f('0x3f')]){_0x4eea2c[_0x613f('0x3d')]=_[_0x613f('0x40')](_0x4eea2c[_0x613f('0x3d')],{'$or':_[_0x613f('0x2f')](_0x22074f,function(_0xdd4918){if(_0xdd4918['type']!==_0x613f('0x41')){var _0x121c91={};_0x121c91[_0xdd4918[_0x613f('0x2c')]]={'$like':'%'+_0x47a9f6[_0x613f('0x34')]['filter']+'%'};return _0x121c91;}})});}_0x4eea2c=_[_0x613f('0x40')]({},_0x4eea2c,_0x47a9f6[_0x613f('0x42')]);var _0x38aa12={'where':_0x4eea2c[_0x613f('0x3d')]};return db[_0x613f('0x43')][_0x613f('0x25')](_0x38aa12)[_0x613f('0x17')](function(_0x132745){_0x72c804[_0x613f('0x25')]=_0x132745;if(_0x47a9f6[_0x613f('0x34')]['includeAll']){_0x4eea2c['include']=[{'all':!![]}];}return db[_0x613f('0x43')][_0x613f('0x44')](_0x4eea2c);})['then'](function(_0x2ffa3c){_0x72c804[_0x613f('0x45')]=_0x2ffa3c;return _0x72c804;})[_0x613f('0x17')](respondWithFilteredResult(_0x59236e,_0x4eea2c))[_0x613f('0x21')](handleError(_0x59236e,null));};exports[_0x613f('0x46')]=function(_0x1c0b07,_0x412dd4){var _0x3a7f95={'raw':![],'where':{'id':_0x1c0b07[_0x613f('0x47')]['id']}},_0x3d938e={};_0x3d938e[_0x613f('0x32')]=_[_0x613f('0x33')](db[_0x613f('0x43')][_0x613f('0x30')]);_0x3d938e[_0x613f('0x34')]=_[_0x613f('0x33')](_0x1c0b07[_0x613f('0x34')]);_0x3d938e[_0x613f('0x35')]=_['intersection'](_0x3d938e['model'],_0x3d938e[_0x613f('0x34')]);_0x3a7f95[_0x613f('0x36')]=_['intersection'](_0x3d938e['model'],qs[_0x613f('0x38')](_0x1c0b07['query']['fields']));_0x3a7f95[_0x613f('0x36')]=_0x3a7f95[_0x613f('0x36')][_0x613f('0x48')]?_0x3a7f95['attributes']:_0x3d938e[_0x613f('0x32')];if(_0x1c0b07[_0x613f('0x34')]['includeAll']){_0x3a7f95['include']=[{'all':!![]}];}_0x3a7f95=_[_0x613f('0x40')]({},_0x3a7f95,_0x1c0b07[_0x613f('0x42')]);return db[_0x613f('0x43')][_0x613f('0x49')](_0x3a7f95)[_0x613f('0x17')](handleEntityNotFound(_0x412dd4,null))[_0x613f('0x17')](respondWithResult(_0x412dd4,null))[_0x613f('0x21')](handleError(_0x412dd4,null));};exports['create']=function(_0x4c6096,_0x38d781){return db['FreshsalesAccount']['create'](_0x4c6096[_0x613f('0x4a')],{})[_0x613f('0x17')](respondWithResult(_0x38d781,0xc9))[_0x613f('0x21')](handleError(_0x38d781,null));};exports['update']=function(_0x27adac,_0x3ab684){if(_0x27adac[_0x613f('0x4a')]['id']){delete _0x27adac[_0x613f('0x4a')]['id'];}return db[_0x613f('0x43')][_0x613f('0x49')]({'where':{'id':_0x27adac[_0x613f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ab684,null))[_0x613f('0x17')](saveUpdates(_0x27adac['body'],null))[_0x613f('0x17')](respondWithResult(_0x3ab684,null))[_0x613f('0x21')](handleError(_0x3ab684,null));};exports[_0x613f('0x2b')]=function(_0x3d1f1a,_0x5f1b88){return db[_0x613f('0x43')][_0x613f('0x49')]({'where':{'id':_0x3d1f1a[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x5f1b88,null))[_0x613f('0x17')](removeEntity(_0x5f1b88,null))[_0x613f('0x21')](handleError(_0x5f1b88,null));};exports[_0x613f('0x4b')]=function(_0x43c238,_0x54ad8f,_0x4f316c){var _0x687e56={};var _0x4b6eb3={};var _0xcb1c9d;var _0x3c3cd7;return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0x43c238[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x54ad8f,null))[_0x613f('0x17')](function(_0x3cc31b){if(_0x3cc31b){_0xcb1c9d=_0x3cc31b;_0x4b6eb3[_0x613f('0x32')]=_[_0x613f('0x33')](db[_0x613f('0x4d')]['rawAttributes']);_0x4b6eb3[_0x613f('0x34')]=_[_0x613f('0x33')](_0x43c238[_0x613f('0x34')]);_0x4b6eb3[_0x613f('0x35')]=_['intersection'](_0x4b6eb3[_0x613f('0x32')],_0x4b6eb3[_0x613f('0x34')]);_0x687e56['attributes']=_['intersection'](_0x4b6eb3[_0x613f('0x32')],qs['fields'](_0x43c238['query']['fields']));_0x687e56[_0x613f('0x36')]=_0x687e56['attributes']['length']?_0x687e56['attributes']:_0x4b6eb3[_0x613f('0x32')];_0x687e56[_0x613f('0x3b')]=qs['sort'](_0x43c238[_0x613f('0x34')][_0x613f('0x3c')]);_0x687e56[_0x613f('0x3d')]=qs[_0x613f('0x35')](_['pick'](_0x43c238[_0x613f('0x34')],_0x4b6eb3[_0x613f('0x35')]));if(_0x43c238['query'][_0x613f('0x3f')]){_0x687e56[_0x613f('0x3d')]=_[_0x613f('0x40')](_0x687e56[_0x613f('0x3d')],{'$or':_[_0x613f('0x2f')](_0x687e56[_0x613f('0x36')],function(_0xbead7c){var _0x130f54={};_0x130f54[_0xbead7c]={'$like':'%'+_0x43c238[_0x613f('0x34')][_0x613f('0x3f')]+'%'};return _0x130f54;})});}_0x687e56=_[_0x613f('0x40')]({},_0x687e56,_0x43c238[_0x613f('0x42')]);return _0xcb1c9d['getConfigurations'](_0x687e56);}})[_0x613f('0x17')](function(_0x428aab){if(_0x428aab){_0x3c3cd7=_0x428aab[_0x613f('0x48')];if(!_0x43c238[_0x613f('0x34')][_0x613f('0x39')](_0x613f('0x3a'))){_0x687e56['limit']=qs[_0x613f('0x27')](_0x43c238[_0x613f('0x34')][_0x613f('0x27')]);_0x687e56[_0x613f('0x26')]=qs[_0x613f('0x26')](_0x43c238[_0x613f('0x34')]['offset']);}return _0xcb1c9d['getConfigurations'](_0x687e56);}})[_0x613f('0x17')](function(_0x25a550){if(_0x25a550){return _0x25a550?{'count':_0x3c3cd7,'rows':_0x25a550}:null;}})[_0x613f('0x17')](respondWithResult(_0x54ad8f,null))[_0x613f('0x21')](handleError(_0x54ad8f,null));};exports['addConfiguration']=function(_0x11d2f4,_0x29e5c8,_0x3d8777){if(_0x11d2f4[_0x613f('0x4a')]['id']){delete _0x11d2f4['body']['id'];}return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0x11d2f4[_0x613f('0x47')]['id']}})[_0x613f('0x17')](handleEntityNotFound(_0x29e5c8,null))[_0x613f('0x17')](function(_0x45e933){if(_0x45e933){_0x11d2f4[_0x613f('0x4a')][_0x613f('0x4e')]=_0x45e933['id'];_0x11d2f4['body'][_0x613f('0x4f')]=integrations[_0x613f('0x50')](_0x11d2f4[_0x613f('0x4a')][_0x613f('0x51')],_0x11d2f4[_0x613f('0x4a')][_0x613f('0x31')]);_0x11d2f4[_0x613f('0x4a')][_0x613f('0x52')]=integrations[_0x613f('0x53')](_0x11d2f4[_0x613f('0x4a')]['channel'],_0x11d2f4[_0x613f('0x4a')][_0x613f('0x31')]);return db[_0x613f('0x4d')][_0x613f('0x54')](_0x11d2f4[_0x613f('0x4a')],{'include':[{'model':db[_0x613f('0x55')],'as':_0x613f('0x4f')},{'model':db[_0x613f('0x55')],'as':_0x613f('0x52')}]});}return null;})[_0x613f('0x17')](respondWithResult(_0x29e5c8,null))[_0x613f('0x21')](handleError(_0x29e5c8,null));};exports['getFields']=function(_0xb36b52,_0x1739ac,_0x2bfb0a){var _0x907273='';var _0x205957='';return db[_0x613f('0x43')][_0x613f('0x4c')]({'where':{'id':_0xb36b52[_0x613f('0x47')]['id']},'attributes':['id',_0x613f('0x56'),_0x613f('0x57'),_0x613f('0x58')]})[_0x613f('0x17')](handleEntityNotFound(_0x1739ac,null))['then'](function(_0x30c62f){if(_0x30c62f){_0x205957=_0x30c62f[_0x613f('0x56')];_0x907273=_0x30c62f['remoteUri'];var _0xb4ad75=_0x30c62f['remoteUri'][_0x613f('0x59')](-0x1);if(_0xb4ad75==='/'){_0x907273=_0x907273['substring'](0x0,_0x907273['lastIndexOf'](_0xb4ad75));}return rp({'method':_0x613f('0x5a'),'uri':util[_0x613f('0x5b')](_0x613f('0x5c'),_0x907273,_0x613f('0x5d')),'headers':{'Authorization':_0x613f('0x5e')+_0x30c62f[_0x613f('0x58')]},'json':!![]});}})[_0x613f('0x17')](function(_0x5be071){if(_0x5be071){var _0x1f2179=_0x5be071[_0x613f('0x5f')];var _0x438bfd=![];var _0x2bc172=null;for(_0x2bc172=0x0;_0x2bc172<_0x1f2179[_0x613f('0x48')];_0x2bc172++){if(_0x1f2179[_0x2bc172]['email']===_0x205957){_0x438bfd=!![];}}if(_0x438bfd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x613f('0x60')});}}})[_0x613f('0x17')](respondWithResult(_0x1739ac,null))['catch'](function(_0x188be6){var _0x8073b2=_0xb36b52[_0x613f('0x34')]['test']?0x1f4:_0x188be6['statusCode']||0x1f4;logger['error'](_0x613f('0x61'),_0x613f('0x62'),_0x8073b2,JSON['stringify'](_0x188be6));delete _0x188be6[_0x613f('0x2c')];if(_0x8073b2===0x191){_0x8073b2=0x190;}_0x1739ac[_0x613f('0x23')](_0x8073b2)[_0x613f('0x2d')](_0xb36b52['query'][_0x613f('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x188be6[_0x613f('0x64')]}:_0x188be6);});}; \ No newline at end of file +var _0xb332=['users','email','Requested\x20Resource\x20not\x20Found','statusCode','test','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','length','options','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','nolimit','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','Token\x20token='];(function(_0x2c2acf,_0x107f43){var _0x582332=function(_0x3a130f){while(--_0x3a130f){_0x2c2acf['push'](_0x2c2acf['shift']());}};_0x582332(++_0x107f43);}(_0xb332,0xd9));var _0x2b33=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xb332[_0x25bca6];return _0x3f8d02;};'use strict';var pdf=require(_0x2b33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b33('0x1'));var zipdir=require(_0x2b33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b33('0x3'));var moment=require('moment');var BPromise=require(_0x2b33('0x4'));var Mustache=require('mustache');var util=require(_0x2b33('0x5'));var path=require('path');var sox=require(_0x2b33('0x6'));var csv=require(_0x2b33('0x7'));var ejs=require(_0x2b33('0x8'));var fs=require('fs');var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x7'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];var integrations=require(_0x2b33('0x17'));var jayson=require(_0x2b33('0x18'));var client=jayson['client'][_0x2b33('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xa44d45,_0x2d4faa,_0x4ef886,_0x173c75){return new BPromise(function(_0x4d39db,_0x3fcf4e){var _0x17292f=_0x173c75||client;return _0x17292f[_0x2b33('0x1a')](_0xa44d45,_0x4ef886)['then'](function(_0x52693f){logger[_0x2b33('0x1b')](_0x2b33('0x1c'),_0x2d4faa,_0x2b33('0x1d'));logger[_0x2b33('0x1e')](_0x2b33('0x1f'),_0x2d4faa,'request\x20sent',JSON['stringify'](_0x52693f));if(_0x52693f['error']){if(_0x52693f[_0x2b33('0x20')]['code']===0x1f4){logger['error'](_0x2b33('0x1c'),_0x2d4faa,_0x52693f[_0x2b33('0x20')][_0x2b33('0x21')]);return _0x3fcf4e(_0x52693f['error'][_0x2b33('0x21')]);}logger['error'](_0x2b33('0x1c'),_0x2d4faa,_0x52693f[_0x2b33('0x20')][_0x2b33('0x21')]);return _0x4d39db(_0x52693f[_0x2b33('0x20')][_0x2b33('0x21')]);}else{logger[_0x2b33('0x1b')](_0x2b33('0x1c'),_0x2d4faa,'request\x20sent');_0x4d39db(_0x52693f[_0x2b33('0x22')][_0x2b33('0x21')]);}})[_0x2b33('0x23')](function(_0x196f3a){logger[_0x2b33('0x20')](_0x2b33('0x1c'),_0x2d4faa,_0x196f3a);_0x3fcf4e(_0x196f3a);});});}function respondWithStatusCode(_0x27f1b8,_0x2605e6){_0x2605e6=_0x2605e6||0xcc;return function(_0x5e1cba){if(_0x5e1cba){return _0x27f1b8[_0x2b33('0x24')](_0x2605e6);}return _0x27f1b8[_0x2b33('0x25')](_0x2605e6)[_0x2b33('0x26')]();};}function respondWithResult(_0x32b835,_0x4df3d4){_0x4df3d4=_0x4df3d4||0xc8;return function(_0x2ec9db){if(_0x2ec9db){return _0x32b835['status'](_0x4df3d4)[_0x2b33('0x27')](_0x2ec9db);}};}function respondWithFilteredResult(_0x483cf4,_0x2e74d0){return function(_0x341e0e){if(_0x341e0e){var _0x5d8d05=_0x341e0e['count'],_0x195aa2=_0x2e74d0[_0x2b33('0x28')],_0x53c2ad=_0x2e74d0[_0x2b33('0x28')]+_0x2e74d0[_0x2b33('0x29')],_0x267969;if(_0x53c2ad>=_0x5d8d05){_0x53c2ad=_0x5d8d05;_0x267969=0xc8;}else{_0x267969=0xce;}_0x483cf4[_0x2b33('0x25')](_0x267969);return _0x483cf4[_0x2b33('0x2a')](_0x2b33('0x2b'),_0x195aa2+'-'+_0x53c2ad+'/'+_0x5d8d05)[_0x2b33('0x27')](_0x341e0e);}return null;};}function patchUpdates(_0x1fadc5){return function(_0x316188){try{jsonpatch[_0x2b33('0x2c')](_0x316188,_0x1fadc5,!![]);}catch(_0x4cf72f){return BPromise['reject'](_0x4cf72f);}return _0x316188[_0x2b33('0x2d')]();};}function saveUpdates(_0x2a081c,_0x3282bf){return function(_0x119e9b){if(_0x119e9b){return _0x119e9b[_0x2b33('0x2e')](_0x2a081c)['then'](function(_0x570765){return _0x570765;});}return null;};}function removeEntity(_0x311ddd,_0x3d2aaa){return function(_0x476965){if(_0x476965){return _0x476965[_0x2b33('0x2f')]()[_0x2b33('0x30')](function(){_0x311ddd[_0x2b33('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275df9,_0x4da2dd){return function(_0x370faf){if(!_0x370faf){_0x275df9[_0x2b33('0x24')](0x194);}return _0x370faf;};}function handleError(_0x38c020,_0x23ba3e){_0x23ba3e=_0x23ba3e||0x1f4;return function(_0x594d66){logger[_0x2b33('0x20')](_0x594d66[_0x2b33('0x31')]);if(_0x594d66[_0x2b33('0x32')]){delete _0x594d66[_0x2b33('0x32')];}_0x38c020[_0x2b33('0x25')](_0x23ba3e)[_0x2b33('0x33')](_0x594d66);};}exports[_0x2b33('0x34')]=function(_0xe415f4,_0x19e351){var _0xb06e25={},_0xa54962={},_0x565c14={'count':0x0,'rows':[]};var _0x52a229=_['map'](db[_0x2b33('0x35')][_0x2b33('0x36')],function(_0x359075){return{'name':_0x359075[_0x2b33('0x37')],'type':_0x359075[_0x2b33('0x38')]['key']};});_0xa54962['model']=_[_0x2b33('0x39')](_0x52a229,'name');_0xa54962[_0x2b33('0x3a')]=_[_0x2b33('0x3b')](_0xe415f4[_0x2b33('0x3a')]);_0xa54962[_0x2b33('0x3c')]=_[_0x2b33('0x3d')](_0xa54962[_0x2b33('0x3e')],_0xa54962[_0x2b33('0x3a')]);_0xb06e25[_0x2b33('0x3f')]=_[_0x2b33('0x3d')](_0xa54962[_0x2b33('0x3e')],qs['fields'](_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x40')]));_0xb06e25[_0x2b33('0x3f')]=_0xb06e25['attributes']['length']?_0xb06e25[_0x2b33('0x3f')]:_0xa54962['model'];if(!_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x41')]('nolimit')){_0xb06e25[_0x2b33('0x29')]=qs[_0x2b33('0x29')](_0xe415f4['query'][_0x2b33('0x29')]);_0xb06e25[_0x2b33('0x28')]=qs['offset'](_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x28')]);}_0xb06e25[_0x2b33('0x42')]=qs['sort'](_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x43')]);_0xb06e25[_0x2b33('0x44')]=qs[_0x2b33('0x3c')](_[_0x2b33('0x45')](_0xe415f4['query'],_0xa54962[_0x2b33('0x3c')]),_0x52a229);if(_0xe415f4[_0x2b33('0x3a')][_0x2b33('0x46')]){_0xb06e25['where']=_[_0x2b33('0x47')](_0xb06e25[_0x2b33('0x44')],{'$or':_[_0x2b33('0x39')](_0x52a229,function(_0xac1dad){if(_0xac1dad['type']!==_0x2b33('0x48')){var _0x416f3e={};_0x416f3e[_0xac1dad['name']]={'$like':'%'+_0xe415f4['query']['filter']+'%'};return _0x416f3e;}})});}_0xb06e25=_[_0x2b33('0x47')]({},_0xb06e25,_0xe415f4['options']);var _0x35df3c={'where':_0xb06e25[_0x2b33('0x44')]};return db[_0x2b33('0x35')][_0x2b33('0x49')](_0x35df3c)[_0x2b33('0x30')](function(_0xd68bbd){_0x565c14[_0x2b33('0x49')]=_0xd68bbd;if(_0xe415f4[_0x2b33('0x3a')]['includeAll']){_0xb06e25[_0x2b33('0x4a')]=[{'all':!![]}];}return db[_0x2b33('0x35')][_0x2b33('0x4b')](_0xb06e25);})[_0x2b33('0x30')](function(_0x41c3c1){_0x565c14[_0x2b33('0x4c')]=_0x41c3c1;return _0x565c14;})['then'](respondWithFilteredResult(_0x19e351,_0xb06e25))['catch'](handleError(_0x19e351,null));};exports['show']=function(_0x493123,_0x13a5d4){var _0x5cdf5d={'raw':![],'where':{'id':_0x493123['params']['id']}},_0x1c5019={};_0x1c5019['model']=_[_0x2b33('0x3b')](db[_0x2b33('0x35')][_0x2b33('0x36')]);_0x1c5019['query']=_[_0x2b33('0x3b')](_0x493123['query']);_0x1c5019[_0x2b33('0x3c')]=_[_0x2b33('0x3d')](_0x1c5019[_0x2b33('0x3e')],_0x1c5019[_0x2b33('0x3a')]);_0x5cdf5d[_0x2b33('0x3f')]=_[_0x2b33('0x3d')](_0x1c5019['model'],qs[_0x2b33('0x40')](_0x493123[_0x2b33('0x3a')][_0x2b33('0x40')]));_0x5cdf5d['attributes']=_0x5cdf5d[_0x2b33('0x3f')][_0x2b33('0x4d')]?_0x5cdf5d[_0x2b33('0x3f')]:_0x1c5019['model'];if(_0x493123[_0x2b33('0x3a')]['includeAll']){_0x5cdf5d['include']=[{'all':!![]}];}_0x5cdf5d=_[_0x2b33('0x47')]({},_0x5cdf5d,_0x493123[_0x2b33('0x4e')]);return db[_0x2b33('0x35')][_0x2b33('0x4f')](_0x5cdf5d)[_0x2b33('0x30')](handleEntityNotFound(_0x13a5d4,null))[_0x2b33('0x30')](respondWithResult(_0x13a5d4,null))[_0x2b33('0x23')](handleError(_0x13a5d4,null));};exports[_0x2b33('0x50')]=function(_0x486f74,_0x275e5e){return db[_0x2b33('0x35')]['create'](_0x486f74[_0x2b33('0x51')],{})[_0x2b33('0x30')](respondWithResult(_0x275e5e,0xc9))['catch'](handleError(_0x275e5e,null));};exports[_0x2b33('0x2e')]=function(_0x433584,_0x20f473){if(_0x433584[_0x2b33('0x51')]['id']){delete _0x433584['body']['id'];}return db[_0x2b33('0x35')][_0x2b33('0x4f')]({'where':{'id':_0x433584['params']['id']}})[_0x2b33('0x30')](handleEntityNotFound(_0x20f473,null))[_0x2b33('0x30')](saveUpdates(_0x433584[_0x2b33('0x51')],null))[_0x2b33('0x30')](respondWithResult(_0x20f473,null))[_0x2b33('0x23')](handleError(_0x20f473,null));};exports[_0x2b33('0x2f')]=function(_0x1bbb5f,_0x5609f6){return db['FreshsalesAccount'][_0x2b33('0x4f')]({'where':{'id':_0x1bbb5f[_0x2b33('0x52')]['id']}})['then'](handleEntityNotFound(_0x5609f6,null))[_0x2b33('0x30')](removeEntity(_0x5609f6,null))[_0x2b33('0x23')](handleError(_0x5609f6,null));};exports[_0x2b33('0x53')]=function(_0x4e3777,_0x185c3e,_0x134c48){var _0x59aca5={};var _0x1af9a3={};var _0x464ac8;var _0x3e503e;return db[_0x2b33('0x35')][_0x2b33('0x54')]({'where':{'id':_0x4e3777['params']['id']}})['then'](handleEntityNotFound(_0x185c3e,null))[_0x2b33('0x30')](function(_0x138d2f){if(_0x138d2f){_0x464ac8=_0x138d2f;_0x1af9a3[_0x2b33('0x3e')]=_[_0x2b33('0x3b')](db[_0x2b33('0x55')][_0x2b33('0x36')]);_0x1af9a3['query']=_[_0x2b33('0x3b')](_0x4e3777[_0x2b33('0x3a')]);_0x1af9a3[_0x2b33('0x3c')]=_[_0x2b33('0x3d')](_0x1af9a3[_0x2b33('0x3e')],_0x1af9a3[_0x2b33('0x3a')]);_0x59aca5['attributes']=_[_0x2b33('0x3d')](_0x1af9a3[_0x2b33('0x3e')],qs[_0x2b33('0x40')](_0x4e3777[_0x2b33('0x3a')][_0x2b33('0x40')]));_0x59aca5['attributes']=_0x59aca5[_0x2b33('0x3f')][_0x2b33('0x4d')]?_0x59aca5[_0x2b33('0x3f')]:_0x1af9a3[_0x2b33('0x3e')];_0x59aca5['order']=qs[_0x2b33('0x43')](_0x4e3777['query'][_0x2b33('0x43')]);_0x59aca5[_0x2b33('0x44')]=qs[_0x2b33('0x3c')](_[_0x2b33('0x45')](_0x4e3777[_0x2b33('0x3a')],_0x1af9a3[_0x2b33('0x3c')]));if(_0x4e3777[_0x2b33('0x3a')][_0x2b33('0x46')]){_0x59aca5['where']=_[_0x2b33('0x47')](_0x59aca5[_0x2b33('0x44')],{'$or':_[_0x2b33('0x39')](_0x59aca5[_0x2b33('0x3f')],function(_0x311c62){var _0x693c68={};_0x693c68[_0x311c62]={'$like':'%'+_0x4e3777[_0x2b33('0x3a')][_0x2b33('0x46')]+'%'};return _0x693c68;})});}_0x59aca5=_[_0x2b33('0x47')]({},_0x59aca5,_0x4e3777[_0x2b33('0x4e')]);return _0x464ac8[_0x2b33('0x53')](_0x59aca5);}})[_0x2b33('0x30')](function(_0x47acb1){if(_0x47acb1){_0x3e503e=_0x47acb1[_0x2b33('0x4d')];if(!_0x4e3777['query']['hasOwnProperty'](_0x2b33('0x56'))){_0x59aca5[_0x2b33('0x29')]=qs[_0x2b33('0x29')](_0x4e3777['query'][_0x2b33('0x29')]);_0x59aca5[_0x2b33('0x28')]=qs[_0x2b33('0x28')](_0x4e3777[_0x2b33('0x3a')]['offset']);}return _0x464ac8['getConfigurations'](_0x59aca5);}})['then'](function(_0x592fec){if(_0x592fec){return _0x592fec?{'count':_0x3e503e,'rows':_0x592fec}:null;}})['then'](respondWithResult(_0x185c3e,null))['catch'](handleError(_0x185c3e,null));};exports['addConfiguration']=function(_0x25ca35,_0x4338e2,_0x653187){if(_0x25ca35['body']['id']){delete _0x25ca35[_0x2b33('0x51')]['id'];}return db[_0x2b33('0x35')][_0x2b33('0x54')]({'where':{'id':_0x25ca35[_0x2b33('0x52')]['id']}})[_0x2b33('0x30')](handleEntityNotFound(_0x4338e2,null))[_0x2b33('0x30')](function(_0x5e60b4){if(_0x5e60b4){_0x25ca35['body']['AccountId']=_0x5e60b4['id'];_0x25ca35['body']['Subjects']=integrations['getSubjects'](_0x25ca35[_0x2b33('0x51')][_0x2b33('0x57')],_0x25ca35['body'][_0x2b33('0x38')]);_0x25ca35[_0x2b33('0x51')][_0x2b33('0x58')]=integrations[_0x2b33('0x59')](_0x25ca35[_0x2b33('0x51')][_0x2b33('0x57')],_0x25ca35[_0x2b33('0x51')]['type']);return db['FreshsalesConfiguration'][_0x2b33('0x50')](_0x25ca35[_0x2b33('0x51')],{'include':[{'model':db[_0x2b33('0x5a')],'as':_0x2b33('0x5b')},{'model':db[_0x2b33('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4338e2,null))['catch'](handleError(_0x4338e2,null));};exports[_0x2b33('0x5c')]=function(_0x18cc51,_0x2452e4,_0x5b2363){var _0x5b9df0='';var _0x31d155='';return db[_0x2b33('0x35')]['findOne']({'where':{'id':_0x18cc51[_0x2b33('0x52')]['id']},'attributes':['id',_0x2b33('0x5d'),_0x2b33('0x5e'),'apiKey']})[_0x2b33('0x30')](handleEntityNotFound(_0x2452e4,null))[_0x2b33('0x30')](function(_0x32c3c0){if(_0x32c3c0){_0x31d155=_0x32c3c0[_0x2b33('0x5d')];_0x5b9df0=_0x32c3c0['remoteUri'];var _0x3e0900=_0x32c3c0['remoteUri'][_0x2b33('0x5f')](-0x1);if(_0x3e0900==='/'){_0x5b9df0=_0x5b9df0[_0x2b33('0x60')](0x0,_0x5b9df0[_0x2b33('0x61')](_0x3e0900));}return rp({'method':_0x2b33('0x62'),'uri':util[_0x2b33('0x63')]('%s%s',_0x5b9df0,'/api/selector/owners'),'headers':{'Authorization':_0x2b33('0x64')+_0x32c3c0['apiKey']},'json':!![]});}})['then'](function(_0xf026d0){if(_0xf026d0){var _0x342b8f=_0xf026d0[_0x2b33('0x65')];var _0x36ef6f=![];var _0x1e681a=null;for(_0x1e681a=0x0;_0x1e681a<_0x342b8f[_0x2b33('0x4d')];_0x1e681a++){if(_0x342b8f[_0x1e681a][_0x2b33('0x66')]===_0x31d155){_0x36ef6f=!![];}}if(_0x36ef6f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2b33('0x67')});}}})['then'](respondWithResult(_0x2452e4,null))['catch'](function(_0x4fd85a){var _0x301464=_0x18cc51[_0x2b33('0x3a')]['test']?0x1f4:_0x4fd85a[_0x2b33('0x68')]||0x1f4;logger[_0x2b33('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x2b33('0x5c'),_0x301464,JSON['stringify'](_0x4fd85a));delete _0x4fd85a[_0x2b33('0x32')];if(_0x301464===0x191){_0x301464=0x190;}_0x2452e4[_0x2b33('0x25')](_0x301464)['send'](_0x18cc51[_0x2b33('0x3a')][_0x2b33('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x4fd85a[_0x2b33('0x68')]}:_0x4fd85a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c58826a..051d4a8 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 _0x0b95=['int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x5d06a6,_0x416bd5){var _0x283be1=function(_0xecc858){while(--_0xecc858){_0x5d06a6['push'](_0x5d06a6['shift']());}};_0x283be1(++_0x416bd5);}(_0x0b95,0x198));var _0x50b9=function(_0xf400dc,_0x55a516){_0xf400dc=_0xf400dc-0x0;var _0x21ab6a=_0x0b95[_0xf400dc];return _0x21ab6a;};'use strict';var _=require('lodash');var util=require(_0x50b9('0x0'));var logger=require(_0x50b9('0x1'))(_0x50b9('0x2'));var moment=require(_0x50b9('0x3'));var BPromise=require(_0x50b9('0x4'));var rp=require(_0x50b9('0x5'));var fs=require('fs');var path=require(_0x50b9('0x6'));var rimraf=require(_0x50b9('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x50b9('0x8')]=function(_0x19f3af,_0x892061){return _0x19f3af[_0x50b9('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x50b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x664b=['moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x471292,_0x22aa3d){var _0x1c7dbe=function(_0x478697){while(--_0x478697){_0x471292['push'](_0x471292['shift']());}};_0x1c7dbe(++_0x22aa3d);}(_0x664b,0xc0));var _0xb664=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x664b[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var logger=require(_0xb664('0x2'))(_0xb664('0x3'));var moment=require(_0xb664('0x4'));var BPromise=require(_0xb664('0x5'));var rp=require(_0xb664('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb664('0x7'));var config=require('../../config/environment');var attributes=require(_0xb664('0x8'));var integrations=require(_0xb664('0x9'));module[_0xb664('0xa')]=function(_0x55cff2,_0xacf606){return _0x55cff2[_0xb664('0xb')](_0xb664('0xc'),attributes,{'tableName':_0xb664('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 436314c..345b5f9 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 _0xac35=['raw','where','attributes','limit','include','model','debug','ShowFreshsalesAccount','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options'];(function(_0x512a56,_0x4aa4af){var _0x342a8e=function(_0x835dc9){while(--_0x835dc9){_0x512a56['push'](_0x512a56['shift']());}};_0x342a8e(++_0x4aa4af);}(_0xac35,0x141));var _0x5ac3=function(_0x5b4f60,_0x2158ac){_0x5b4f60=_0x5b4f60-0x0;var _0x4c967a=_0xac35[_0x5b4f60];return _0x4c967a;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});}exports[_0x5ac3('0x1a')]=function(_0x1c2566){var _0x200eca=this;return new Promise(function(_0x141128,_0x5aab00){return db[_0x5ac3('0x1b')][_0x5ac3('0x1c')]({'raw':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x1f')]||null:null,'attributes':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x20')]||null:null,'limit':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566['options'][_0x5ac3('0x21')]||null:null,'include':_0x1c2566[_0x5ac3('0x1d')]?_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x22')]?_['map'](_0x1c2566[_0x5ac3('0x1d')][_0x5ac3('0x22')],function(_0x2aa7c9){return{'model':db[_0x2aa7c9[_0x5ac3('0x23')]],'as':_0x2aa7c9['as'],'attributes':_0x2aa7c9['attributes'],'include':_0x2aa7c9[_0x5ac3('0x22')]?_['map'](_0x2aa7c9[_0x5ac3('0x22')],function(_0x481a72){return{'model':db[_0x481a72['model']],'as':_0x481a72['as'],'attributes':_0x481a72[_0x5ac3('0x20')],'include':_0x481a72[_0x5ac3('0x22')]?_['map'](_0x481a72[_0x5ac3('0x22')],function(_0x3912f6){return{'model':db[_0x3912f6[_0x5ac3('0x23')]],'as':_0x3912f6['as'],'attributes':_0x3912f6[_0x5ac3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x452519){logger[_0x5ac3('0x10')](_0x5ac3('0x1a'),_0x1c2566);logger[_0x5ac3('0x24')](_0x5ac3('0x1a'),_0x1c2566,JSON[_0x5ac3('0x13')](_0x452519));_0x141128(_0x452519);})[_0x5ac3('0x19')](function(_0x5a1486){logger[_0x5ac3('0x14')](_0x5ac3('0x1a'),_0x5a1486[_0x5ac3('0x16')],_0x1c2566);_0x5aab00(_0x200eca['error'](0x1f4,_0x5a1486[_0x5ac3('0x16')]));});});};exports[_0x5ac3('0x25')]=function(_0x28c96e){var _0x5df562=this;return new Promise(function(_0x194c52,_0x484012){return db[_0x5ac3('0x1b')]['find']({'raw':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e[_0x5ac3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x28c96e['options']?_0x28c96e['options'][_0x5ac3('0x1f')]||null:null,'attributes':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e['options'][_0x5ac3('0x20')]||null:null,'include':_0x28c96e[_0x5ac3('0x1d')]?_0x28c96e[_0x5ac3('0x1d')][_0x5ac3('0x22')]?_[_0x5ac3('0x26')](_0x28c96e[_0x5ac3('0x1d')]['include'],function(_0x4552ab){return{'model':db[_0x4552ab[_0x5ac3('0x23')]],'as':_0x4552ab['as'],'attributes':_0x4552ab[_0x5ac3('0x20')],'include':_0x4552ab[_0x5ac3('0x22')]?_['map'](_0x4552ab['include'],function(_0x3466ef){return{'model':db[_0x3466ef['model']],'as':_0x3466ef['as'],'attributes':_0x3466ef[_0x5ac3('0x20')],'include':_0x3466ef[_0x5ac3('0x22')]?_['map'](_0x3466ef[_0x5ac3('0x22')],function(_0x4e68ea){return{'model':db[_0x4e68ea[_0x5ac3('0x23')]],'as':_0x4e68ea['as'],'attributes':_0x4e68ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21271a){logger[_0x5ac3('0x10')](_0x5ac3('0x25'),_0x28c96e);logger[_0x5ac3('0x24')]('ShowFreshsalesAccount',_0x28c96e,JSON[_0x5ac3('0x13')](_0x21271a));_0x194c52(_0x21271a);})['catch'](function(_0xbefb42){logger[_0x5ac3('0x14')](_0x5ac3('0x25'),_0xbefb42[_0x5ac3('0x16')],_0x28c96e);_0x484012(_0x5df562[_0x5ac3('0x14')](0x1f4,_0xbefb42['message']));});});}; \ No newline at end of file +var _0x6209=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','limit','include','map','model','attributes','where','ShowFreshsalesAccount','catch','lodash','util'];(function(_0x3e7bb8,_0x11f26c){var _0x160bf4=function(_0xbc65a5){while(--_0xbc65a5){_0x3e7bb8['push'](_0x3e7bb8['shift']());}};_0x160bf4(++_0x11f26c);}(_0x6209,0x1e8));var _0x9620=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6209[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb4e,_0x339bdc,_0x488d59){return new BPromise(function(_0x4e9082,_0x11af3d){return client['request'](_0x2bdb4e,_0x488d59)[_0x9620('0xc')](function(_0x345acb){logger[_0x9620('0xd')](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));logger[_0x9620('0x10')](_0x9620('0x11'),_0x339bdc,'request\x20sent',JSON[_0x9620('0x12')](_0x345acb));if(_0x345acb['error']){if(_0x345acb[_0x9620('0x13')][_0x9620('0x14')]===0x1f4){logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);return _0x11af3d(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}logger[_0x9620('0x13')](_0x9620('0xe'),_0x339bdc,_0x345acb['error']['message']);return _0x4e9082(_0x345acb[_0x9620('0x13')][_0x9620('0x15')]);}else{logger['info'](_0x9620('0xe'),_0x339bdc,_0x9620('0xf'));_0x4e9082(_0x345acb[_0x9620('0x16')][_0x9620('0x15')]);}})['catch'](function(_0x2cb40e){logger[_0x9620('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x339bdc,_0x2cb40e);_0x11af3d(_0x2cb40e);});});}exports[_0x9620('0x17')]=function(_0x4b81ea){var _0x10a166=this;return new Promise(function(_0x16514e,_0x2c8975){return db[_0x9620('0x18')][_0x9620('0x19')]({'raw':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b81ea['options']?_0x4b81ea['options']['where']||null:null,'attributes':_0x4b81ea['options']?_0x4b81ea[_0x9620('0x1a')]['attributes']||null:null,'limit':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1b')]||null:null,'include':_0x4b81ea[_0x9620('0x1a')]?_0x4b81ea[_0x9620('0x1a')][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x4b81ea['options']['include'],function(_0x1d8665){return{'model':db[_0x1d8665[_0x9620('0x1e')]],'as':_0x1d8665['as'],'attributes':_0x1d8665['attributes'],'include':_0x1d8665[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x1d8665[_0x9620('0x1c')],function(_0x156298){return{'model':db[_0x156298[_0x9620('0x1e')]],'as':_0x156298['as'],'attributes':_0x156298[_0x9620('0x1f')],'include':_0x156298[_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x156298[_0x9620('0x1c')],function(_0x30c0cf){return{'model':db[_0x30c0cf[_0x9620('0x1e')]],'as':_0x30c0cf['as'],'attributes':_0x30c0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9620('0xc')](function(_0x3e40aa){logger[_0x9620('0xd')](_0x9620('0x17'),_0x4b81ea);logger['debug']('GetFreshsalesAccount',_0x4b81ea,JSON[_0x9620('0x12')](_0x3e40aa));_0x16514e(_0x3e40aa);})['catch'](function(_0xf2cb11){logger['error']('GetFreshsalesAccount',_0xf2cb11[_0x9620('0x15')],_0x4b81ea);_0x2c8975(_0x10a166[_0x9620('0x13')](0x1f4,_0xf2cb11[_0x9620('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x19ddaf){var _0x186b4f=this;return new Promise(function(_0x42bfe6,_0x4cc78e){return db[_0x9620('0x18')]['find']({'raw':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf[_0x9620('0x1a')][_0x9620('0x20')]||null:null,'attributes':_0x19ddaf[_0x9620('0x1a')]?_0x19ddaf['options']['attributes']||null:null,'include':_0x19ddaf['options']?_0x19ddaf['options'][_0x9620('0x1c')]?_[_0x9620('0x1d')](_0x19ddaf['options'][_0x9620('0x1c')],function(_0x3d80f9){return{'model':db[_0x3d80f9['model']],'as':_0x3d80f9['as'],'attributes':_0x3d80f9[_0x9620('0x1f')],'include':_0x3d80f9[_0x9620('0x1c')]?_['map'](_0x3d80f9[_0x9620('0x1c')],function(_0x360c64){return{'model':db[_0x360c64[_0x9620('0x1e')]],'as':_0x360c64['as'],'attributes':_0x360c64[_0x9620('0x1f')],'include':_0x360c64['include']?_[_0x9620('0x1d')](_0x360c64['include'],function(_0x908b02){return{'model':db[_0x908b02[_0x9620('0x1e')]],'as':_0x908b02['as'],'attributes':_0x908b02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b213f){logger[_0x9620('0xd')](_0x9620('0x21'),_0x19ddaf);logger[_0x9620('0x10')](_0x9620('0x21'),_0x19ddaf,JSON['stringify'](_0x2b213f));_0x42bfe6(_0x2b213f);})[_0x9620('0x22')](function(_0x2d87fa){logger[_0x9620('0x13')](_0x9620('0x21'),_0x2d87fa[_0x9620('0x15')],_0x19ddaf);_0x4cc78e(_0x186b4f['error'](0x1f4,_0x2d87fa[_0x9620('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8c53a29..fa4548d 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 _0x4f5f=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','/:id','destroy','exports','util','path','express','../../components/auth/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4f5f,0xec));var _0xf4f5=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4f5f[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require(_0xf4f5('0x0'));var path=require(_0xf4f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4f5('0x2'));var router=express['Router']();var auth=require(_0xf4f5('0x3'));var interaction=require(_0xf4f5('0x4'));var config=require(_0xf4f5('0x5'));var controller=require(_0xf4f5('0x6'));router[_0xf4f5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf4f5('0x7')]('/:id',auth[_0xf4f5('0x8')](),controller[_0xf4f5('0x9')]);router[_0xf4f5('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xf4f5('0xa')]);router[_0xf4f5('0x7')](_0xf4f5('0xb'),auth['isAuthenticated'](),controller[_0xf4f5('0xc')]);router[_0xf4f5('0x7')](_0xf4f5('0xd'),auth[_0xf4f5('0x8')](),controller[_0xf4f5('0xe')]);router['post']('/',auth[_0xf4f5('0x8')](),controller[_0xf4f5('0xf')]);router[_0xf4f5('0x10')](_0xf4f5('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf4f5('0x11'),auth[_0xf4f5('0x8')](),controller[_0xf4f5('0x12')]);module[_0xf4f5('0x13')]=router; \ No newline at end of file +var _0xdff4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getDescriptions','/:id/fields','post','create','/:id','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x515398,_0x21bf63){var _0x43a65a=function(_0x4ba9f5){while(--_0x4ba9f5){_0x515398['push'](_0x515398['shift']());}};_0x43a65a(++_0x21bf63);}(_0xdff4,0xe2));var _0x4dff=function(_0x18b27e,_0x45810b){_0x18b27e=_0x18b27e-0x0;var _0x558ea2=_0xdff4[_0x18b27e];return _0x558ea2;};'use strict';var multer=require(_0x4dff('0x0'));var util=require(_0x4dff('0x1'));var path=require(_0x4dff('0x2'));var timeout=require(_0x4dff('0x3'));var express=require('express');var router=express[_0x4dff('0x4')]();var auth=require(_0x4dff('0x5'));var interaction=require(_0x4dff('0x6'));var config=require(_0x4dff('0x7'));var controller=require(_0x4dff('0x8'));router[_0x4dff('0x9')]('/',auth[_0x4dff('0xa')](),controller[_0x4dff('0xb')]);router[_0x4dff('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4dff('0xc')]);router['get'](_0x4dff('0xd'),auth[_0x4dff('0xa')](),controller['getSubjects']);router[_0x4dff('0x9')]('/:id/descriptions',auth[_0x4dff('0xa')](),controller[_0x4dff('0xe')]);router[_0x4dff('0x9')](_0x4dff('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x4dff('0x10')]('/',auth[_0x4dff('0xa')](),controller[_0x4dff('0x11')]);router['put'](_0x4dff('0x12'),auth[_0x4dff('0xa')](),controller['update']);router[_0x4dff('0x13')](_0x4dff('0x12'),auth['isAuthenticated'](),controller[_0x4dff('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b1099f3..0ef55b5 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 _0x68c3=['STRING','sequelize','exports'];(function(_0xc5ebeb,_0x1cff69){var _0x1e90a9=function(_0x1050ed){while(--_0x1050ed){_0xc5ebeb['push'](_0xc5ebeb['shift']());}};_0x1e90a9(++_0x1cff69);}(_0x68c3,0x193));var _0x368c=function(_0x27dc75,_0x10560b){_0x27dc75=_0x27dc75-0x0;var _0x316106=_0x68c3[_0x27dc75];return _0x316106;};'use strict';var Sequelize=require(_0x368c('0x0'));module[_0x368c('0x1')]={'name':{'type':Sequelize[_0x368c('0x2')]},'description':{'type':Sequelize[_0x368c('0x2')]}}; \ No newline at end of file +var _0xc111=['STRING','exports'];(function(_0x5d939a,_0x3ee040){var _0x28eba4=function(_0x3a5072){while(--_0x3a5072){_0x5d939a['push'](_0x5d939a['shift']());}};_0x28eba4(++_0x3ee040);}(_0xc111,0x189));var _0x1c11=function(_0x202556,_0x37f5ea){_0x202556=_0x202556-0x0;var _0x18da49=_0xc111[_0x202556];return _0x18da49;};'use strict';var Sequelize=require('sequelize');module[_0x1c11('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c11('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e967b2d..f83b708 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 _0x4975=['limit','Content-Range','reject','save','then','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','show','params','includeAll','find','create','update','body','destroy','FreshsalesConfiguration','getSubjects','findOne','FreshsalesField','order','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json'];(function(_0x130a16,_0x454766){var _0x189496=function(_0x15792b){while(--_0x15792b){_0x130a16['push'](_0x130a16['shift']());}};_0x189496(++_0x454766);}(_0x4975,0x86));var _0x5497=function(_0x577f4c,_0x23788c){_0x577f4c=_0x577f4c-0x0;var _0x2cc3f1=_0x4975[_0x577f4c];return _0x2cc3f1;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x18'))['db'];var jayson=require(_0x5497('0x19'));var client=jayson[_0x5497('0x1a')][_0x5497('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x747dc7,_0x365144,_0x1f7169,_0xaca97d){return new BPromise(function(_0x363a5b,_0x1a4c74){var _0x55f590=_0xaca97d||client;return _0x55f590[_0x5497('0x1c')](_0x747dc7,_0x1f7169)['then'](function(_0x4237a9){logger[_0x5497('0x1d')](_0x5497('0x1e'),_0x365144,_0x5497('0x1f'));logger[_0x5497('0x20')](_0x5497('0x21'),_0x365144,_0x5497('0x1f'),JSON['stringify'](_0x4237a9));if(_0x4237a9['error']){if(_0x4237a9[_0x5497('0x22')][_0x5497('0x23')]===0x1f4){logger[_0x5497('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x1a4c74(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x363a5b(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}else{logger[_0x5497('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x5497('0x1f'));_0x363a5b(_0x4237a9['result'][_0x5497('0x24')]);}})[_0x5497('0x25')](function(_0x44265c){logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x44265c);_0x1a4c74(_0x44265c);});});}function respondWithStatusCode(_0x3b2fbc,_0x5018fa){_0x5018fa=_0x5018fa||0xcc;return function(_0x54043a){if(_0x54043a){return _0x3b2fbc[_0x5497('0x26')](_0x5018fa);}return _0x3b2fbc[_0x5497('0x27')](_0x5018fa)[_0x5497('0x28')]();};}function respondWithResult(_0x281155,_0x5223b5){_0x5223b5=_0x5223b5||0xc8;return function(_0x13b7a4){if(_0x13b7a4){return _0x281155['status'](_0x5223b5)[_0x5497('0x29')](_0x13b7a4);}};}function respondWithFilteredResult(_0x16a2b4,_0x429d36){return function(_0x34a1a5){if(_0x34a1a5){var _0x163a30=_0x34a1a5['count'],_0x31cd01=_0x429d36['offset'],_0x48b835=_0x429d36['offset']+_0x429d36[_0x5497('0x2a')],_0x4af5f4;if(_0x48b835>=_0x163a30){_0x48b835=_0x163a30;_0x4af5f4=0xc8;}else{_0x4af5f4=0xce;}_0x16a2b4['status'](_0x4af5f4);return _0x16a2b4['set'](_0x5497('0x2b'),_0x31cd01+'-'+_0x48b835+'/'+_0x163a30)[_0x5497('0x29')](_0x34a1a5);}return null;};}function patchUpdates(_0x1cf908){return function(_0x4c442a){try{jsonpatch['apply'](_0x4c442a,_0x1cf908,!![]);}catch(_0x58230b){return BPromise[_0x5497('0x2c')](_0x58230b);}return _0x4c442a[_0x5497('0x2d')]();};}function saveUpdates(_0xf4c117,_0x5b8f79){return function(_0x489f71){if(_0x489f71){return _0x489f71['update'](_0xf4c117)[_0x5497('0x2e')](function(_0x572460){return _0x572460;});}return null;};}function removeEntity(_0x438ee4,_0x258c2d){return function(_0x77c575){if(_0x77c575){return _0x77c575['destroy']()[_0x5497('0x2e')](function(){_0x438ee4[_0x5497('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce7cb2,_0xce2e81){return function(_0x331dfc){if(!_0x331dfc){_0xce7cb2['sendStatus'](0x194);}return _0x331dfc;};}function handleError(_0x3395f6,_0x2fe1f2){_0x2fe1f2=_0x2fe1f2||0x1f4;return function(_0x125d51){logger[_0x5497('0x22')](_0x125d51[_0x5497('0x2f')]);if(_0x125d51['name']){delete _0x125d51[_0x5497('0x30')];}_0x3395f6[_0x5497('0x27')](_0x2fe1f2)['send'](_0x125d51);};}exports[_0x5497('0x31')]=function(_0x44299b,_0xc7730){var _0x1b9cd8={},_0x1656c7={},_0x37011c={'count':0x0,'rows':[]};var _0x580e86=_[_0x5497('0x32')](db['FreshsalesConfiguration'][_0x5497('0x33')],function(_0x212199){return{'name':_0x212199[_0x5497('0x34')],'type':_0x212199['type']['key']};});_0x1656c7[_0x5497('0x35')]=_[_0x5497('0x32')](_0x580e86,_0x5497('0x30'));_0x1656c7[_0x5497('0x36')]=_[_0x5497('0x37')](_0x44299b[_0x5497('0x36')]);_0x1656c7['filters']=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],_0x1656c7[_0x5497('0x36')]);_0x1b9cd8[_0x5497('0x39')]=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x44299b[_0x5497('0x36')][_0x5497('0x3a')]));_0x1b9cd8['attributes']=_0x1b9cd8[_0x5497('0x39')][_0x5497('0x3b')]?_0x1b9cd8[_0x5497('0x39')]:_0x1656c7[_0x5497('0x35')];if(!_0x44299b[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1b9cd8['limit']=qs[_0x5497('0x2a')](_0x44299b[_0x5497('0x36')][_0x5497('0x2a')]);_0x1b9cd8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x44299b[_0x5497('0x36')][_0x5497('0x3e')]);}_0x1b9cd8['order']=qs[_0x5497('0x3f')](_0x44299b[_0x5497('0x36')][_0x5497('0x3f')]);_0x1b9cd8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x44299b[_0x5497('0x36')],_0x1656c7[_0x5497('0x41')]),_0x580e86);if(_0x44299b[_0x5497('0x36')][_0x5497('0x43')]){_0x1b9cd8['where']=_[_0x5497('0x44')](_0x1b9cd8['where'],{'$or':_[_0x5497('0x32')](_0x580e86,function(_0x9fc24){if(_0x9fc24[_0x5497('0x45')]!==_0x5497('0x46')){var _0x133746={};_0x133746[_0x9fc24['name']]={'$like':'%'+_0x44299b[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x133746;}})});}_0x1b9cd8=_['merge']({},_0x1b9cd8,_0x44299b[_0x5497('0x47')]);var _0x553279={'where':_0x1b9cd8[_0x5497('0x40')]};return db['FreshsalesConfiguration'][_0x5497('0x48')](_0x553279)[_0x5497('0x2e')](function(_0x2e8c6a){_0x37011c[_0x5497('0x48')]=_0x2e8c6a;if(_0x44299b[_0x5497('0x36')]['includeAll']){_0x1b9cd8['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1b9cd8);})[_0x5497('0x2e')](function(_0x43c430){_0x37011c[_0x5497('0x49')]=_0x43c430;return _0x37011c;})[_0x5497('0x2e')](respondWithFilteredResult(_0xc7730,_0x1b9cd8))[_0x5497('0x25')](handleError(_0xc7730,null));};exports[_0x5497('0x4a')]=function(_0xc78abe,_0x466287){var _0x2626bf={'raw':![],'where':{'id':_0xc78abe[_0x5497('0x4b')]['id']}},_0x57350a={};_0x57350a[_0x5497('0x35')]=_[_0x5497('0x37')](db['FreshsalesConfiguration'][_0x5497('0x33')]);_0x57350a['query']=_[_0x5497('0x37')](_0xc78abe[_0x5497('0x36')]);_0x57350a[_0x5497('0x41')]=_['intersection'](_0x57350a[_0x5497('0x35')],_0x57350a[_0x5497('0x36')]);_0x2626bf['attributes']=_[_0x5497('0x38')](_0x57350a['model'],qs[_0x5497('0x3a')](_0xc78abe['query'][_0x5497('0x3a')]));_0x2626bf[_0x5497('0x39')]=_0x2626bf[_0x5497('0x39')][_0x5497('0x3b')]?_0x2626bf[_0x5497('0x39')]:_0x57350a[_0x5497('0x35')];if(_0xc78abe[_0x5497('0x36')][_0x5497('0x4c')]){_0x2626bf['include']=[{'all':!![]}];}_0x2626bf=_[_0x5497('0x44')]({},_0x2626bf,_0xc78abe['options']);return db['FreshsalesConfiguration'][_0x5497('0x4d')](_0x2626bf)[_0x5497('0x2e')](handleEntityNotFound(_0x466287,null))['then'](respondWithResult(_0x466287,null))[_0x5497('0x25')](handleError(_0x466287,null));};exports[_0x5497('0x4e')]=function(_0x436a83,_0x3094c7){return db['FreshsalesConfiguration'][_0x5497('0x4e')](_0x436a83['body'],{})['then'](respondWithResult(_0x3094c7,0xc9))[_0x5497('0x25')](handleError(_0x3094c7,null));};exports[_0x5497('0x4f')]=function(_0x2f7ec8,_0x49c85a){if(_0x2f7ec8['body']['id']){delete _0x2f7ec8[_0x5497('0x50')]['id'];}return db['FreshsalesConfiguration'][_0x5497('0x4d')]({'where':{'id':_0x2f7ec8['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x49c85a,null))['then'](saveUpdates(_0x2f7ec8[_0x5497('0x50')],null))[_0x5497('0x2e')](respondWithResult(_0x49c85a,null))['catch'](handleError(_0x49c85a,null));};exports[_0x5497('0x51')]=function(_0x5dccfb,_0x506d69){return db[_0x5497('0x52')][_0x5497('0x4d')]({'where':{'id':_0x5dccfb['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x506d69,null))[_0x5497('0x2e')](removeEntity(_0x506d69,null))[_0x5497('0x25')](handleError(_0x506d69,null));};exports[_0x5497('0x53')]=function(_0x3fca40,_0x25c75e,_0x590be7){var _0x215ea8={};var _0x4916cd={};var _0x4e0d4c;var _0x480582;return db[_0x5497('0x52')][_0x5497('0x54')]({'where':{'id':_0x3fca40[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c75e,null))[_0x5497('0x2e')](function(_0x528fb4){if(_0x528fb4){_0x4e0d4c=_0x528fb4;_0x4916cd['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x4916cd[_0x5497('0x36')]=_[_0x5497('0x37')](_0x3fca40[_0x5497('0x36')]);_0x4916cd['filters']=_[_0x5497('0x38')](_0x4916cd[_0x5497('0x35')],_0x4916cd[_0x5497('0x36')]);_0x215ea8[_0x5497('0x39')]=_['intersection'](_0x4916cd[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x3fca40[_0x5497('0x36')][_0x5497('0x3a')]));_0x215ea8['attributes']=_0x215ea8[_0x5497('0x39')][_0x5497('0x3b')]?_0x215ea8[_0x5497('0x39')]:_0x4916cd['model'];_0x215ea8[_0x5497('0x56')]=qs['sort'](_0x3fca40['query']['sort']);_0x215ea8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x3fca40['query'],_0x4916cd[_0x5497('0x41')]));if(_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]){_0x215ea8[_0x5497('0x40')]=_['merge'](_0x215ea8[_0x5497('0x40')],{'$or':_[_0x5497('0x32')](_0x215ea8[_0x5497('0x39')],function(_0x49617c){var _0x164de1={};_0x164de1[_0x49617c]={'$like':'%'+_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x164de1;})});}_0x215ea8=_[_0x5497('0x44')]({},_0x215ea8,_0x3fca40[_0x5497('0x47')]);return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x4b4cfe){if(_0x4b4cfe){_0x480582=_0x4b4cfe[_0x5497('0x3b')];if(!_0x3fca40[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x215ea8['limit']=qs['limit'](_0x3fca40['query'][_0x5497('0x2a')]);_0x215ea8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x3fca40['query'][_0x5497('0x3e')]);}return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x464df3){if(_0x464df3){return _0x464df3?{'count':_0x480582,'rows':_0x464df3}:null;}})[_0x5497('0x2e')](respondWithResult(_0x25c75e,null))[_0x5497('0x25')](handleError(_0x25c75e,null));};exports[_0x5497('0x57')]=function(_0x23bd32,_0x21da3d,_0x940188){var _0x1fc6ad={};var _0x5a8b3a={};var _0x15d5a4;var _0x2940ec;return db[_0x5497('0x52')]['findOne']({'where':{'id':_0x23bd32[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21da3d,null))[_0x5497('0x2e')](function(_0x469e97){if(_0x469e97){_0x15d5a4=_0x469e97;_0x5a8b3a['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x5a8b3a[_0x5497('0x36')]=_['keys'](_0x23bd32[_0x5497('0x36')]);_0x5a8b3a[_0x5497('0x41')]=_[_0x5497('0x38')](_0x5a8b3a['model'],_0x5a8b3a[_0x5497('0x36')]);_0x1fc6ad[_0x5497('0x39')]=_['intersection'](_0x5a8b3a[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x23bd32[_0x5497('0x36')]['fields']));_0x1fc6ad['attributes']=_0x1fc6ad[_0x5497('0x39')][_0x5497('0x3b')]?_0x1fc6ad[_0x5497('0x39')]:_0x5a8b3a[_0x5497('0x35')];_0x1fc6ad[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x23bd32[_0x5497('0x36')]['sort']);_0x1fc6ad['where']=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x23bd32['query'],_0x5a8b3a[_0x5497('0x41')]));if(_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]){_0x1fc6ad['where']=_[_0x5497('0x44')](_0x1fc6ad[_0x5497('0x40')],{'$or':_['map'](_0x1fc6ad[_0x5497('0x39')],function(_0x16e2cf){var _0x9458d7={};_0x9458d7[_0x16e2cf]={'$like':'%'+_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x9458d7;})});}_0x1fc6ad=_['merge']({},_0x1fc6ad,_0x23bd32[_0x5497('0x47')]);return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x23e259){if(_0x23e259){_0x2940ec=_0x23e259[_0x5497('0x3b')];if(!_0x23bd32['query'][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1fc6ad[_0x5497('0x2a')]=qs[_0x5497('0x2a')](_0x23bd32['query'][_0x5497('0x2a')]);_0x1fc6ad[_0x5497('0x3e')]=qs['offset'](_0x23bd32[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x53b1b7){if(_0x53b1b7){return _0x53b1b7?{'count':_0x2940ec,'rows':_0x53b1b7}:null;}})['then'](respondWithResult(_0x21da3d,null))['catch'](handleError(_0x21da3d,null));};exports['getFields']=function(_0x594761,_0x2d5543,_0x2375cc){var _0x15d0da={};var _0x1f02d3={};var _0x41f347;var _0x4b7c43;return db['FreshsalesConfiguration'][_0x5497('0x54')]({'where':{'id':_0x594761[_0x5497('0x4b')]['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x2d5543,null))[_0x5497('0x2e')](function(_0x307dc5){if(_0x307dc5){_0x41f347=_0x307dc5;_0x1f02d3[_0x5497('0x35')]=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x1f02d3[_0x5497('0x36')]=_['keys'](_0x594761[_0x5497('0x36')]);_0x1f02d3[_0x5497('0x41')]=_[_0x5497('0x38')](_0x1f02d3[_0x5497('0x35')],_0x1f02d3[_0x5497('0x36')]);_0x15d0da[_0x5497('0x39')]=_['intersection'](_0x1f02d3[_0x5497('0x35')],qs['fields'](_0x594761[_0x5497('0x36')][_0x5497('0x3a')]));_0x15d0da[_0x5497('0x39')]=_0x15d0da['attributes']['length']?_0x15d0da[_0x5497('0x39')]:_0x1f02d3[_0x5497('0x35')];_0x15d0da[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x594761[_0x5497('0x36')][_0x5497('0x3f')]);_0x15d0da[_0x5497('0x40')]=qs[_0x5497('0x41')](_['pick'](_0x594761['query'],_0x1f02d3['filters']));if(_0x594761[_0x5497('0x36')][_0x5497('0x43')]){_0x15d0da[_0x5497('0x40')]=_[_0x5497('0x44')](_0x15d0da['where'],{'$or':_['map'](_0x15d0da[_0x5497('0x39')],function(_0xf38193){var _0x5dd9bc={};_0x5dd9bc[_0xf38193]={'$like':'%'+_0x594761[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x5dd9bc;})});}_0x15d0da=_[_0x5497('0x44')]({},_0x15d0da,_0x594761[_0x5497('0x47')]);return _0x41f347['getFields'](_0x15d0da);}})['then'](function(_0x55e597){if(_0x55e597){_0x4b7c43=_0x55e597['length'];if(!_0x594761['query'][_0x5497('0x3c')]('nolimit')){_0x15d0da[_0x5497('0x2a')]=qs['limit'](_0x594761[_0x5497('0x36')][_0x5497('0x2a')]);_0x15d0da[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x594761[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x41f347['getFields'](_0x15d0da);}})[_0x5497('0x2e')](function(_0x513479){if(_0x513479){return _0x513479?{'count':_0x4b7c43,'rows':_0x513479}:null;}})[_0x5497('0x2e')](respondWithResult(_0x2d5543,null))[_0x5497('0x25')](handleError(_0x2d5543,null));}; \ No newline at end of file +var _0x5fc3=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','client','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','catch','create','body','getSubjects','findOne','FreshsalesField','merge','getDescriptions','getFields','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto'];(function(_0x3609c9,_0x3104a5){var _0x5a1a2b=function(_0x58fe13){while(--_0x58fe13){_0x3609c9['push'](_0x3609c9['shift']());}};_0x5a1a2b(++_0x3104a5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x5fc3[_0x54ea7a];return _0x65a10d;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var licenseUtil=require(_0x35fc('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x35fc('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397738,_0x22055e,_0x2a6ad2,_0x29730f){return new BPromise(function(_0x38d9f2,_0x5cfe94){var _0x59507a=_0x29730f||client;return _0x59507a['request'](_0x397738,_0x2a6ad2)['then'](function(_0x398b67){logger[_0x35fc('0x19')](_0x35fc('0x1a'),_0x22055e,_0x35fc('0x1b'));logger[_0x35fc('0x1c')](_0x35fc('0x1d'),_0x22055e,'request\x20sent',JSON[_0x35fc('0x1e')](_0x398b67));if(_0x398b67[_0x35fc('0x1f')]){if(_0x398b67['error'][_0x35fc('0x20')]===0x1f4){logger[_0x35fc('0x1f')](_0x35fc('0x1a'),_0x22055e,_0x398b67['error'][_0x35fc('0x21')]);return _0x5cfe94(_0x398b67[_0x35fc('0x1f')][_0x35fc('0x21')]);}logger['error'](_0x35fc('0x1a'),_0x22055e,_0x398b67[_0x35fc('0x1f')][_0x35fc('0x21')]);return _0x38d9f2(_0x398b67[_0x35fc('0x1f')][_0x35fc('0x21')]);}else{logger[_0x35fc('0x19')](_0x35fc('0x1a'),_0x22055e,_0x35fc('0x1b'));_0x38d9f2(_0x398b67[_0x35fc('0x22')][_0x35fc('0x21')]);}})['catch'](function(_0x323aee){logger[_0x35fc('0x1f')](_0x35fc('0x1a'),_0x22055e,_0x323aee);_0x5cfe94(_0x323aee);});});}function respondWithStatusCode(_0x2d8183,_0x3b4743){_0x3b4743=_0x3b4743||0xcc;return function(_0x55e9e7){if(_0x55e9e7){return _0x2d8183[_0x35fc('0x23')](_0x3b4743);}return _0x2d8183[_0x35fc('0x24')](_0x3b4743)['end']();};}function respondWithResult(_0x265324,_0x5a93df){_0x5a93df=_0x5a93df||0xc8;return function(_0x3d4a98){if(_0x3d4a98){return _0x265324['status'](_0x5a93df)[_0x35fc('0x25')](_0x3d4a98);}};}function respondWithFilteredResult(_0x598d7a,_0x1bf180){return function(_0xdfab9f){if(_0xdfab9f){var _0x5cb986=_0xdfab9f[_0x35fc('0x26')],_0x519264=_0x1bf180[_0x35fc('0x27')],_0x47774c=_0x1bf180['offset']+_0x1bf180[_0x35fc('0x28')],_0x58edb6;if(_0x47774c>=_0x5cb986){_0x47774c=_0x5cb986;_0x58edb6=0xc8;}else{_0x58edb6=0xce;}_0x598d7a[_0x35fc('0x24')](_0x58edb6);return _0x598d7a[_0x35fc('0x29')](_0x35fc('0x2a'),_0x519264+'-'+_0x47774c+'/'+_0x5cb986)[_0x35fc('0x25')](_0xdfab9f);}return null;};}function patchUpdates(_0x134dfa){return function(_0x11ccdb){try{jsonpatch[_0x35fc('0x2b')](_0x11ccdb,_0x134dfa,!![]);}catch(_0x54aedc){return BPromise[_0x35fc('0x2c')](_0x54aedc);}return _0x11ccdb[_0x35fc('0x2d')]();};}function saveUpdates(_0x22af18,_0x52acc5){return function(_0xe79f52){if(_0xe79f52){return _0xe79f52[_0x35fc('0x2e')](_0x22af18)[_0x35fc('0x2f')](function(_0xe6e4ba){return _0xe6e4ba;});}return null;};}function removeEntity(_0xd8a4ca,_0x103181){return function(_0x222ddb){if(_0x222ddb){return _0x222ddb[_0x35fc('0x30')]()[_0x35fc('0x2f')](function(){_0xd8a4ca[_0x35fc('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0313,_0x114bc1){return function(_0x4af5fe){if(!_0x4af5fe){_0x5e0313[_0x35fc('0x23')](0x194);}return _0x4af5fe;};}function handleError(_0x39454e,_0x1c4b8b){_0x1c4b8b=_0x1c4b8b||0x1f4;return function(_0x227471){logger[_0x35fc('0x1f')](_0x227471[_0x35fc('0x31')]);if(_0x227471['name']){delete _0x227471[_0x35fc('0x32')];}_0x39454e[_0x35fc('0x24')](_0x1c4b8b)[_0x35fc('0x33')](_0x227471);};}exports[_0x35fc('0x34')]=function(_0x2bbd36,_0x2f823b){var _0x553597={},_0x2483be={},_0x38193d={'count':0x0,'rows':[]};var _0x1fecdf=_['map'](db[_0x35fc('0x35')]['rawAttributes'],function(_0x2ecb2e){return{'name':_0x2ecb2e[_0x35fc('0x36')],'type':_0x2ecb2e[_0x35fc('0x37')][_0x35fc('0x38')]};});_0x2483be['model']=_['map'](_0x1fecdf,'name');_0x2483be[_0x35fc('0x39')]=_['keys'](_0x2bbd36[_0x35fc('0x39')]);_0x2483be['filters']=_[_0x35fc('0x3a')](_0x2483be[_0x35fc('0x3b')],_0x2483be[_0x35fc('0x39')]);_0x553597[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x2483be[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x2bbd36['query'][_0x35fc('0x3d')]));_0x553597[_0x35fc('0x3c')]=_0x553597['attributes'][_0x35fc('0x3e')]?_0x553597[_0x35fc('0x3c')]:_0x2483be[_0x35fc('0x3b')];if(!_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x3f')](_0x35fc('0x40'))){_0x553597['limit']=qs[_0x35fc('0x28')](_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x28')]);_0x553597['offset']=qs[_0x35fc('0x27')](_0x2bbd36[_0x35fc('0x39')]['offset']);}_0x553597[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x42')]);_0x553597[_0x35fc('0x43')]=qs[_0x35fc('0x44')](_[_0x35fc('0x45')](_0x2bbd36[_0x35fc('0x39')],_0x2483be['filters']),_0x1fecdf);if(_0x2bbd36['query'][_0x35fc('0x46')]){_0x553597[_0x35fc('0x43')]=_['merge'](_0x553597['where'],{'$or':_['map'](_0x1fecdf,function(_0x79677d){if(_0x79677d[_0x35fc('0x37')]!=='VIRTUAL'){var _0x1f3605={};_0x1f3605[_0x79677d[_0x35fc('0x32')]]={'$like':'%'+_0x2bbd36[_0x35fc('0x39')][_0x35fc('0x46')]+'%'};return _0x1f3605;}})});}_0x553597=_['merge']({},_0x553597,_0x2bbd36['options']);var _0x5bf2f4={'where':_0x553597['where']};return db['FreshsalesConfiguration'][_0x35fc('0x26')](_0x5bf2f4)[_0x35fc('0x2f')](function(_0x4fc5bc){_0x38193d[_0x35fc('0x26')]=_0x4fc5bc;if(_0x2bbd36['query'][_0x35fc('0x47')]){_0x553597[_0x35fc('0x48')]=[{'all':!![]}];}return db[_0x35fc('0x35')][_0x35fc('0x49')](_0x553597);})[_0x35fc('0x2f')](function(_0x5d3d0f){_0x38193d[_0x35fc('0x4a')]=_0x5d3d0f;return _0x38193d;})[_0x35fc('0x2f')](respondWithFilteredResult(_0x2f823b,_0x553597))['catch'](handleError(_0x2f823b,null));};exports[_0x35fc('0x4b')]=function(_0x298b7b,_0x2a8a09){var _0x211746={'raw':![],'where':{'id':_0x298b7b[_0x35fc('0x4c')]['id']}},_0x5bc8c3={};_0x5bc8c3['model']=_['keys'](db[_0x35fc('0x35')][_0x35fc('0x4d')]);_0x5bc8c3[_0x35fc('0x39')]=_[_0x35fc('0x4e')](_0x298b7b[_0x35fc('0x39')]);_0x5bc8c3[_0x35fc('0x44')]=_[_0x35fc('0x3a')](_0x5bc8c3[_0x35fc('0x3b')],_0x5bc8c3['query']);_0x211746[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x5bc8c3[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x298b7b[_0x35fc('0x39')][_0x35fc('0x3d')]));_0x211746[_0x35fc('0x3c')]=_0x211746[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x211746[_0x35fc('0x3c')]:_0x5bc8c3[_0x35fc('0x3b')];if(_0x298b7b[_0x35fc('0x39')][_0x35fc('0x47')]){_0x211746[_0x35fc('0x48')]=[{'all':!![]}];}_0x211746=_['merge']({},_0x211746,_0x298b7b['options']);return db[_0x35fc('0x35')][_0x35fc('0x4f')](_0x211746)[_0x35fc('0x2f')](handleEntityNotFound(_0x2a8a09,null))[_0x35fc('0x2f')](respondWithResult(_0x2a8a09,null))[_0x35fc('0x50')](handleError(_0x2a8a09,null));};exports[_0x35fc('0x51')]=function(_0x4a4798,_0x4f024c){return db[_0x35fc('0x35')][_0x35fc('0x51')](_0x4a4798[_0x35fc('0x52')],{})[_0x35fc('0x2f')](respondWithResult(_0x4f024c,0xc9))['catch'](handleError(_0x4f024c,null));};exports[_0x35fc('0x2e')]=function(_0x13281f,_0x4965d2){if(_0x13281f[_0x35fc('0x52')]['id']){delete _0x13281f[_0x35fc('0x52')]['id'];}return db['FreshsalesConfiguration'][_0x35fc('0x4f')]({'where':{'id':_0x13281f[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x4965d2,null))[_0x35fc('0x2f')](saveUpdates(_0x13281f['body'],null))['then'](respondWithResult(_0x4965d2,null))['catch'](handleError(_0x4965d2,null));};exports[_0x35fc('0x30')]=function(_0x2ea8d6,_0x5ce231){return db[_0x35fc('0x35')][_0x35fc('0x4f')]({'where':{'id':_0x2ea8d6[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x5ce231,null))[_0x35fc('0x2f')](removeEntity(_0x5ce231,null))['catch'](handleError(_0x5ce231,null));};exports[_0x35fc('0x53')]=function(_0x757aa6,_0x39d470,_0x509e77){var _0x304dba={};var _0x1dbf5a={};var _0x47fb1a;var _0x35a676;return db[_0x35fc('0x35')][_0x35fc('0x54')]({'where':{'id':_0x757aa6[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x39d470,null))[_0x35fc('0x2f')](function(_0x8501d1){if(_0x8501d1){_0x47fb1a=_0x8501d1;_0x1dbf5a[_0x35fc('0x3b')]=_['keys'](db[_0x35fc('0x55')][_0x35fc('0x4d')]);_0x1dbf5a[_0x35fc('0x39')]=_['keys'](_0x757aa6[_0x35fc('0x39')]);_0x1dbf5a['filters']=_['intersection'](_0x1dbf5a['model'],_0x1dbf5a[_0x35fc('0x39')]);_0x304dba[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x1dbf5a[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x757aa6['query']['fields']));_0x304dba['attributes']=_0x304dba['attributes']['length']?_0x304dba[_0x35fc('0x3c')]:_0x1dbf5a[_0x35fc('0x3b')];_0x304dba[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x757aa6['query'][_0x35fc('0x42')]);_0x304dba[_0x35fc('0x43')]=qs[_0x35fc('0x44')](_[_0x35fc('0x45')](_0x757aa6[_0x35fc('0x39')],_0x1dbf5a[_0x35fc('0x44')]));if(_0x757aa6[_0x35fc('0x39')][_0x35fc('0x46')]){_0x304dba[_0x35fc('0x43')]=_['merge'](_0x304dba[_0x35fc('0x43')],{'$or':_['map'](_0x304dba[_0x35fc('0x3c')],function(_0x9029e3){var _0x2ac8e1={};_0x2ac8e1[_0x9029e3]={'$like':'%'+_0x757aa6[_0x35fc('0x39')]['filter']+'%'};return _0x2ac8e1;})});}_0x304dba=_[_0x35fc('0x56')]({},_0x304dba,_0x757aa6['options']);return _0x47fb1a['getSubjects'](_0x304dba);}})['then'](function(_0x10dd1a){if(_0x10dd1a){_0x35a676=_0x10dd1a['length'];if(!_0x757aa6[_0x35fc('0x39')]['hasOwnProperty'](_0x35fc('0x40'))){_0x304dba['limit']=qs[_0x35fc('0x28')](_0x757aa6[_0x35fc('0x39')][_0x35fc('0x28')]);_0x304dba[_0x35fc('0x27')]=qs['offset'](_0x757aa6[_0x35fc('0x39')][_0x35fc('0x27')]);}return _0x47fb1a[_0x35fc('0x53')](_0x304dba);}})['then'](function(_0x3aa7fa){if(_0x3aa7fa){return _0x3aa7fa?{'count':_0x35a676,'rows':_0x3aa7fa}:null;}})[_0x35fc('0x2f')](respondWithResult(_0x39d470,null))[_0x35fc('0x50')](handleError(_0x39d470,null));};exports[_0x35fc('0x57')]=function(_0x1e4e15,_0x2c4309,_0x2ee98b){var _0x4464d5={};var _0x5159a0={};var _0x28a44b;var _0x2008b3;return db[_0x35fc('0x35')]['findOne']({'where':{'id':_0x1e4e15[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x2c4309,null))['then'](function(_0x4d09d4){if(_0x4d09d4){_0x28a44b=_0x4d09d4;_0x5159a0[_0x35fc('0x3b')]=_['keys'](db[_0x35fc('0x55')][_0x35fc('0x4d')]);_0x5159a0[_0x35fc('0x39')]=_[_0x35fc('0x4e')](_0x1e4e15[_0x35fc('0x39')]);_0x5159a0[_0x35fc('0x44')]=_[_0x35fc('0x3a')](_0x5159a0[_0x35fc('0x3b')],_0x5159a0[_0x35fc('0x39')]);_0x4464d5[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x5159a0[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x3d')]));_0x4464d5[_0x35fc('0x3c')]=_0x4464d5[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x4464d5[_0x35fc('0x3c')]:_0x5159a0[_0x35fc('0x3b')];_0x4464d5['order']=qs[_0x35fc('0x42')](_0x1e4e15['query'][_0x35fc('0x42')]);_0x4464d5[_0x35fc('0x43')]=qs[_0x35fc('0x44')](_[_0x35fc('0x45')](_0x1e4e15[_0x35fc('0x39')],_0x5159a0[_0x35fc('0x44')]));if(_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x46')]){_0x4464d5[_0x35fc('0x43')]=_[_0x35fc('0x56')](_0x4464d5[_0x35fc('0x43')],{'$or':_['map'](_0x4464d5[_0x35fc('0x3c')],function(_0x4657de){var _0x2c1bd2={};_0x2c1bd2[_0x4657de]={'$like':'%'+_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x46')]+'%'};return _0x2c1bd2;})});}_0x4464d5=_[_0x35fc('0x56')]({},_0x4464d5,_0x1e4e15['options']);return _0x28a44b[_0x35fc('0x57')](_0x4464d5);}})[_0x35fc('0x2f')](function(_0x277514){if(_0x277514){_0x2008b3=_0x277514[_0x35fc('0x3e')];if(!_0x1e4e15[_0x35fc('0x39')][_0x35fc('0x3f')](_0x35fc('0x40'))){_0x4464d5[_0x35fc('0x28')]=qs[_0x35fc('0x28')](_0x1e4e15['query'][_0x35fc('0x28')]);_0x4464d5['offset']=qs[_0x35fc('0x27')](_0x1e4e15[_0x35fc('0x39')]['offset']);}return _0x28a44b[_0x35fc('0x57')](_0x4464d5);}})[_0x35fc('0x2f')](function(_0xcaa49){if(_0xcaa49){return _0xcaa49?{'count':_0x2008b3,'rows':_0xcaa49}:null;}})[_0x35fc('0x2f')](respondWithResult(_0x2c4309,null))[_0x35fc('0x50')](handleError(_0x2c4309,null));};exports[_0x35fc('0x58')]=function(_0x42f87e,_0x452c10,_0x25ee61){var _0x5806bf={};var _0x4c70e2={};var _0x4e7c7b;var _0x531117;return db[_0x35fc('0x35')][_0x35fc('0x54')]({'where':{'id':_0x42f87e[_0x35fc('0x4c')]['id']}})[_0x35fc('0x2f')](handleEntityNotFound(_0x452c10,null))[_0x35fc('0x2f')](function(_0x4f535a){if(_0x4f535a){_0x4e7c7b=_0x4f535a;_0x4c70e2[_0x35fc('0x3b')]=_[_0x35fc('0x4e')](db[_0x35fc('0x55')][_0x35fc('0x4d')]);_0x4c70e2['query']=_[_0x35fc('0x4e')](_0x42f87e[_0x35fc('0x39')]);_0x4c70e2[_0x35fc('0x44')]=_['intersection'](_0x4c70e2[_0x35fc('0x3b')],_0x4c70e2[_0x35fc('0x39')]);_0x5806bf[_0x35fc('0x3c')]=_[_0x35fc('0x3a')](_0x4c70e2[_0x35fc('0x3b')],qs[_0x35fc('0x3d')](_0x42f87e[_0x35fc('0x39')][_0x35fc('0x3d')]));_0x5806bf['attributes']=_0x5806bf[_0x35fc('0x3c')][_0x35fc('0x3e')]?_0x5806bf[_0x35fc('0x3c')]:_0x4c70e2[_0x35fc('0x3b')];_0x5806bf[_0x35fc('0x41')]=qs[_0x35fc('0x42')](_0x42f87e['query'][_0x35fc('0x42')]);_0x5806bf['where']=qs['filters'](_[_0x35fc('0x45')](_0x42f87e['query'],_0x4c70e2[_0x35fc('0x44')]));if(_0x42f87e[_0x35fc('0x39')][_0x35fc('0x46')]){_0x5806bf['where']=_[_0x35fc('0x56')](_0x5806bf[_0x35fc('0x43')],{'$or':_[_0x35fc('0x59')](_0x5806bf[_0x35fc('0x3c')],function(_0x21f7e6){var _0x5abdf9={};_0x5abdf9[_0x21f7e6]={'$like':'%'+_0x42f87e['query']['filter']+'%'};return _0x5abdf9;})});}_0x5806bf=_[_0x35fc('0x56')]({},_0x5806bf,_0x42f87e['options']);return _0x4e7c7b[_0x35fc('0x58')](_0x5806bf);}})[_0x35fc('0x2f')](function(_0x391321){if(_0x391321){_0x531117=_0x391321[_0x35fc('0x3e')];if(!_0x42f87e['query'][_0x35fc('0x3f')](_0x35fc('0x40'))){_0x5806bf[_0x35fc('0x28')]=qs['limit'](_0x42f87e[_0x35fc('0x39')][_0x35fc('0x28')]);_0x5806bf[_0x35fc('0x27')]=qs['offset'](_0x42f87e['query']['offset']);}return _0x4e7c7b[_0x35fc('0x58')](_0x5806bf);}})[_0x35fc('0x2f')](function(_0x163b04){if(_0x163b04){return _0x163b04?{'count':_0x531117,'rows':_0x163b04}:null;}})[_0x35fc('0x2f')](respondWithResult(_0x452c10,null))['catch'](handleError(_0x452c10,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 51b9a3b..b660412 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 _0x6dcd=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5aa81e,_0x5710f3){var _0x2fba99=function(_0x4c4996){while(--_0x4c4996){_0x5aa81e['push'](_0x5aa81e['shift']());}};_0x2fba99(++_0x5710f3);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x2b4886,_0x59020){_0x2b4886=_0x2b4886-0x0;var _0x2ddbcb=_0x6dcd[_0x2b4886];return _0x2ddbcb;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var logger=require('../../config/logger')(_0xd6dc('0x1'));var moment=require(_0xd6dc('0x2'));var BPromise=require(_0xd6dc('0x3'));var rp=require(_0xd6dc('0x4'));var fs=require('fs');var path=require(_0xd6dc('0x5'));var rimraf=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var attributes=require(_0xd6dc('0x8'));module[_0xd6dc('0x9')]=function(_0x18277f,_0x311f22){return _0x18277f[_0xd6dc('0xa')](_0xd6dc('0xb'),attributes,{'tableName':_0xd6dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff30=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5664ea,_0x4cb50b){var _0x23152c=function(_0x5625a9){while(--_0x5625a9){_0x5664ea['push'](_0x5664ea['shift']());}};_0x23152c(++_0x4cb50b);}(_0xff30,0x104));var _0x0ff3=function(_0x2f9247,_0x52d8ad){_0x2f9247=_0x2f9247-0x0;var _0x290822=_0xff30[_0x2f9247];return _0x290822;};'use strict';var _=require(_0x0ff3('0x0'));var util=require(_0x0ff3('0x1'));var logger=require(_0x0ff3('0x2'))(_0x0ff3('0x3'));var moment=require(_0x0ff3('0x4'));var BPromise=require(_0x0ff3('0x5'));var rp=require(_0x0ff3('0x6'));var fs=require('fs');var path=require(_0x0ff3('0x7'));var rimraf=require(_0x0ff3('0x8'));var config=require(_0x0ff3('0x9'));var attributes=require(_0x0ff3('0xa'));module[_0x0ff3('0xb')]=function(_0x32e864,_0x2696ba){return _0x32e864[_0x0ff3('0xc')](_0x0ff3('0xd'),attributes,{'tableName':_0x0ff3('0xe'),'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 46feb43..357777d 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 _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(_0x3a8473,_0x4bd870){var _0x36314a=function(_0x2fb6e0){while(--_0x2fb6e0){_0x3a8473['push'](_0x3a8473['shift']());}};_0x36314a(++_0x4bd870);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x189971,_0x1c6bd3){_0x189971=_0x189971-0x0;var _0xc5cd10=_0xf6e8[_0x189971];return _0xc5cd10;};'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 +var _0xf12a=['info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf12a,0x8e));var _0xaf12=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xf12a[_0x79ebc5];return _0x3813b6;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x581819,_0x38389d,_0x418c64){return new BPromise(function(_0x3b6626,_0xff1952){return client[_0xaf12('0xa')](_0x581819,_0x418c64)[_0xaf12('0xb')](function(_0x3d733d){logger[_0xaf12('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x38389d,_0xaf12('0xd'));logger['debug'](_0xaf12('0xe'),_0x38389d,'request\x20sent',JSON[_0xaf12('0xf')](_0x3d733d));if(_0x3d733d['error']){if(_0x3d733d['error'][_0xaf12('0x10')]===0x1f4){logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0xff1952(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}logger[_0xaf12('0x11')](_0xaf12('0x12'),_0x38389d,_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);return _0x3b6626(_0x3d733d[_0xaf12('0x11')][_0xaf12('0x13')]);}else{logger[_0xaf12('0xc')](_0xaf12('0x12'),_0x38389d,_0xaf12('0xd'));_0x3b6626(_0x3d733d[_0xaf12('0x14')]['message']);}})[_0xaf12('0x15')](function(_0x31a420){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x38389d,_0x31a420);_0xff1952(_0x31a420);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c503b13..c25aeda 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 _0x9a60=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x2a8ff1,_0x4615e5){var _0x3e588a=function(_0x3808f0){while(--_0x3808f0){_0x2a8ff1['push'](_0x2a8ff1['shift']());}};_0x3e588a(++_0x4615e5);}(_0x9a60,0x78));var _0x09a6=function(_0x3a9c1f,_0x3d5010){_0x3a9c1f=_0x3a9c1f-0x0;var _0x184d5d=_0x9a60[_0x3a9c1f];return _0x184d5d;};'use strict';var multer=require(_0x09a6('0x0'));var util=require(_0x09a6('0x1'));var path=require('path');var timeout=require(_0x09a6('0x2'));var express=require('express');var router=express[_0x09a6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09a6('0x4'));var config=require(_0x09a6('0x5'));var controller=require(_0x09a6('0x6'));router[_0x09a6('0x7')]('/',auth[_0x09a6('0x8')](),controller[_0x09a6('0x9')]);router[_0x09a6('0x7')](_0x09a6('0xa'),auth[_0x09a6('0x8')](),controller[_0x09a6('0xb')]);router[_0x09a6('0xc')]('/',auth[_0x09a6('0x8')](),controller[_0x09a6('0xd')]);router[_0x09a6('0xe')](_0x09a6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x09a6('0xf')](_0x09a6('0xa'),auth[_0x09a6('0x8')](),controller[_0x09a6('0x10')]);module[_0x09a6('0x11')]=router; \ No newline at end of file +var _0xacf2=['../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x4afc2c,_0x336a88){var _0x164084=function(_0x14b783){while(--_0x14b783){_0x4afc2c['push'](_0x4afc2c['shift']());}};_0x164084(++_0x336a88);}(_0xacf2,0x147));var _0x2acf=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0xacf2[_0x4322c6];return _0x4e7537;};'use strict';var multer=require(_0x2acf('0x0'));var util=require('util');var path=require(_0x2acf('0x1'));var timeout=require(_0x2acf('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2acf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2acf('0x4'));var controller=require(_0x2acf('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x2acf('0x6')]);router['get'](_0x2acf('0x7'),auth[_0x2acf('0x8')](),controller['show']);router[_0x2acf('0x9')]('/',auth[_0x2acf('0x8')](),controller[_0x2acf('0xa')]);router[_0x2acf('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2acf('0xc')]);router['delete'](_0x2acf('0x7'),auth[_0x2acf('0x8')](),controller[_0x2acf('0xd')]);module[_0x2acf('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index dabf04f..921349b 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 _0xbe27=['customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x294676,_0x393370){var _0x1ad993=function(_0x5500ab){while(--_0x5500ab){_0x294676['push'](_0x294676['shift']());}};_0x1ad993(++_0x393370);}(_0xbe27,0x12d));var _0x7be2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbe27[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x7be2('0x0')]={'type':{'type':Sequelize[_0x7be2('0x1')]('string',_0x7be2('0x2'),_0x7be2('0x3'),_0x7be2('0x4')),'defaultValue':_0x7be2('0x5')},'content':{'type':Sequelize[_0x7be2('0x6')]},'key':{'type':Sequelize[_0x7be2('0x6')]},'keyType':{'type':Sequelize[_0x7be2('0x1')]('string',_0x7be2('0x2'),_0x7be2('0x3'))},'keyContent':{'type':Sequelize[_0x7be2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7be2('0x6')]},'customField':{'type':Sequelize[_0x7be2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae4a=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x5e2a54,_0x424ad7){var _0x1c8b6b=function(_0x718a9b){while(--_0x718a9b){_0x5e2a54['push'](_0x5e2a54['shift']());}};_0x1c8b6b(++_0x424ad7);}(_0xae4a,0x68));var _0xaae4=function(_0xf2f354,_0xdc4fdb){_0xf2f354=_0xf2f354-0x0;var _0x4485b8=_0xae4a[_0xf2f354];return _0x4485b8;};'use strict';var Sequelize=require(_0xaae4('0x0'));module[_0xaae4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaae4('0x2'),_0xaae4('0x3'),'customVariable',_0xaae4('0x4')),'defaultValue':_0xaae4('0x2')},'content':{'type':Sequelize[_0xaae4('0x5')]},'key':{'type':Sequelize[_0xaae4('0x5')]},'keyType':{'type':Sequelize[_0xaae4('0x6')](_0xaae4('0x2'),_0xaae4('0x3'),_0xaae4('0x7'))},'keyContent':{'type':Sequelize[_0xaae4('0x5')]},'idField':{'type':Sequelize[_0xaae4('0x5')]},'nameField':{'type':Sequelize[_0xaae4('0x5')]},'customField':{'type':Sequelize[_0xaae4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaae4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c64a3f5..81555af 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 _0x6a49=['fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','error','name','index','FreshsalesField','rawAttributes','type','key','model','map','query','keys','intersection'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0x6a49,0x148));var _0x96a4=function(_0x2d5a5e,_0x35e9ab){_0x2d5a5e=_0x2d5a5e-0x0;var _0x3b0448=_0x6a49[_0x2d5a5e];return _0x3b0448;};'use strict';var pdf=require(_0x96a4('0x0'));var emlformat=require(_0x96a4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x96a4('0x2'));var jsonpatch=require(_0x96a4('0x3'));var rp=require(_0x96a4('0x4'));var moment=require(_0x96a4('0x5'));var BPromise=require(_0x96a4('0x6'));var Mustache=require(_0x96a4('0x7'));var util=require(_0x96a4('0x8'));var path=require(_0x96a4('0x9'));var sox=require('sox');var csv=require(_0x96a4('0xa'));var ejs=require(_0x96a4('0xb'));var fs=require('fs');var _=require(_0x96a4('0xc'));var squel=require(_0x96a4('0xd'));var crypto=require(_0x96a4('0xe'));var jsforce=require(_0x96a4('0xf'));var deskjs=require(_0x96a4('0x10'));var toCsv=require(_0x96a4('0xa'));var querystring=require(_0x96a4('0x11'));var Papa=require(_0x96a4('0x12'));var Redis=require(_0x96a4('0x13'));var authService=require(_0x96a4('0x14'));var qs=require(_0x96a4('0x15'));var as=require(_0x96a4('0x16'));var hardwareService=require(_0x96a4('0x17'));var logger=require(_0x96a4('0x18'))('api');var utils=require(_0x96a4('0x19'));var config=require(_0x96a4('0x1a'));var licenseUtil=require(_0x96a4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3888,_0x3364a1){_0x3364a1=_0x3364a1||0xcc;return function(_0x37ec43){if(_0x37ec43){return _0x4f3888['sendStatus'](_0x3364a1);}return _0x4f3888[_0x96a4('0x1c')](_0x3364a1)[_0x96a4('0x1d')]();};}function respondWithResult(_0x4377fb,_0x155966){_0x155966=_0x155966||0xc8;return function(_0x27e94e){if(_0x27e94e){return _0x4377fb['status'](_0x155966)['json'](_0x27e94e);}};}function respondWithFilteredResult(_0x13d6d1,_0x2ea173){return function(_0xa9210e){if(_0xa9210e){var _0x3f9c10=_0xa9210e[_0x96a4('0x1e')],_0xcbbc60=_0x2ea173[_0x96a4('0x1f')],_0x277696=_0x2ea173['offset']+_0x2ea173[_0x96a4('0x20')],_0x11e601;if(_0x277696>=_0x3f9c10){_0x277696=_0x3f9c10;_0x11e601=0xc8;}else{_0x11e601=0xce;}_0x13d6d1[_0x96a4('0x1c')](_0x11e601);return _0x13d6d1[_0x96a4('0x21')](_0x96a4('0x22'),_0xcbbc60+'-'+_0x277696+'/'+_0x3f9c10)[_0x96a4('0x23')](_0xa9210e);}return null;};}function patchUpdates(_0x393650){return function(_0x31a453){try{jsonpatch[_0x96a4('0x24')](_0x31a453,_0x393650,!![]);}catch(_0x1d2a0e){return BPromise[_0x96a4('0x25')](_0x1d2a0e);}return _0x31a453['save']();};}function saveUpdates(_0x2ac5a8,_0x1566fc){return function(_0x45e629){if(_0x45e629){return _0x45e629[_0x96a4('0x26')](_0x2ac5a8)[_0x96a4('0x27')](function(_0xfb8ffc){return _0xfb8ffc;});}return null;};}function removeEntity(_0x2651bd,_0x16cdf3){return function(_0x23d5c8){if(_0x23d5c8){return _0x23d5c8['destroy']()[_0x96a4('0x27')](function(){_0x2651bd[_0x96a4('0x1c')](0xcc)[_0x96a4('0x1d')]();});}};}function handleEntityNotFound(_0x295eaf,_0x3cf8b2){return function(_0x32dd6c){if(!_0x32dd6c){_0x295eaf['sendStatus'](0x194);}return _0x32dd6c;};}function handleError(_0x4063f9,_0xbda9d7){_0xbda9d7=_0xbda9d7||0x1f4;return function(_0x4f6d9a){logger[_0x96a4('0x28')](_0x4f6d9a['stack']);if(_0x4f6d9a[_0x96a4('0x29')]){delete _0x4f6d9a[_0x96a4('0x29')];}_0x4063f9[_0x96a4('0x1c')](_0xbda9d7)['send'](_0x4f6d9a);};}exports[_0x96a4('0x2a')]=function(_0x54fb25,_0x53ccfe){var _0x41fa1f={},_0x582843={},_0x2d15c1={'count':0x0,'rows':[]};var _0xab875b=_['map'](db[_0x96a4('0x2b')][_0x96a4('0x2c')],function(_0x402326){return{'name':_0x402326['fieldName'],'type':_0x402326[_0x96a4('0x2d')][_0x96a4('0x2e')]};});_0x582843[_0x96a4('0x2f')]=_[_0x96a4('0x30')](_0xab875b,'name');_0x582843[_0x96a4('0x31')]=_[_0x96a4('0x32')](_0x54fb25[_0x96a4('0x31')]);_0x582843['filters']=_['intersection'](_0x582843['model'],_0x582843[_0x96a4('0x31')]);_0x41fa1f['attributes']=_[_0x96a4('0x33')](_0x582843[_0x96a4('0x2f')],qs[_0x96a4('0x34')](_0x54fb25['query'][_0x96a4('0x34')]));_0x41fa1f[_0x96a4('0x35')]=_0x41fa1f[_0x96a4('0x35')]['length']?_0x41fa1f['attributes']:_0x582843['model'];if(!_0x54fb25[_0x96a4('0x31')][_0x96a4('0x36')](_0x96a4('0x37'))){_0x41fa1f['limit']=qs['limit'](_0x54fb25[_0x96a4('0x31')][_0x96a4('0x20')]);_0x41fa1f[_0x96a4('0x1f')]=qs[_0x96a4('0x1f')](_0x54fb25[_0x96a4('0x31')][_0x96a4('0x1f')]);}_0x41fa1f[_0x96a4('0x38')]=qs[_0x96a4('0x39')](_0x54fb25['query'][_0x96a4('0x39')]);_0x41fa1f['where']=qs[_0x96a4('0x3a')](_[_0x96a4('0x3b')](_0x54fb25[_0x96a4('0x31')],_0x582843[_0x96a4('0x3a')]),_0xab875b);if(_0x54fb25[_0x96a4('0x31')][_0x96a4('0x3c')]){_0x41fa1f[_0x96a4('0x3d')]=_[_0x96a4('0x3e')](_0x41fa1f['where'],{'$or':_[_0x96a4('0x30')](_0xab875b,function(_0x473258){if(_0x473258['type']!==_0x96a4('0x3f')){var _0x119974={};_0x119974[_0x473258[_0x96a4('0x29')]]={'$like':'%'+_0x54fb25[_0x96a4('0x31')][_0x96a4('0x3c')]+'%'};return _0x119974;}})});}_0x41fa1f=_[_0x96a4('0x3e')]({},_0x41fa1f,_0x54fb25[_0x96a4('0x40')]);var _0x450957={'where':_0x41fa1f[_0x96a4('0x3d')]};return db[_0x96a4('0x2b')][_0x96a4('0x1e')](_0x450957)[_0x96a4('0x27')](function(_0x33fb5d){_0x2d15c1['count']=_0x33fb5d;if(_0x54fb25['query']['includeAll']){_0x41fa1f[_0x96a4('0x41')]=[{'all':!![]}];}return db[_0x96a4('0x2b')][_0x96a4('0x42')](_0x41fa1f);})[_0x96a4('0x27')](function(_0x22c0d0){_0x2d15c1[_0x96a4('0x43')]=_0x22c0d0;return _0x2d15c1;})[_0x96a4('0x27')](respondWithFilteredResult(_0x53ccfe,_0x41fa1f))['catch'](handleError(_0x53ccfe,null));};exports[_0x96a4('0x44')]=function(_0x1f88d7,_0x271ef8){var _0x3b0aee={'raw':!![],'where':{'id':_0x1f88d7[_0x96a4('0x45')]['id']}},_0x59fe15={};_0x59fe15[_0x96a4('0x2f')]=_[_0x96a4('0x32')](db[_0x96a4('0x2b')][_0x96a4('0x2c')]);_0x59fe15[_0x96a4('0x31')]=_['keys'](_0x1f88d7['query']);_0x59fe15[_0x96a4('0x3a')]=_['intersection'](_0x59fe15[_0x96a4('0x2f')],_0x59fe15[_0x96a4('0x31')]);_0x3b0aee[_0x96a4('0x35')]=_[_0x96a4('0x33')](_0x59fe15['model'],qs[_0x96a4('0x34')](_0x1f88d7[_0x96a4('0x31')][_0x96a4('0x34')]));_0x3b0aee[_0x96a4('0x35')]=_0x3b0aee['attributes'][_0x96a4('0x46')]?_0x3b0aee['attributes']:_0x59fe15['model'];if(_0x1f88d7['query'][_0x96a4('0x47')]){_0x3b0aee['include']=[{'all':!![]}];}_0x3b0aee=_['merge']({},_0x3b0aee,_0x1f88d7['options']);return db[_0x96a4('0x2b')][_0x96a4('0x48')](_0x3b0aee)[_0x96a4('0x27')](handleEntityNotFound(_0x271ef8,null))['then'](respondWithResult(_0x271ef8,null))['catch'](handleError(_0x271ef8,null));};exports[_0x96a4('0x49')]=function(_0x11020b,_0x3ab30f){return db[_0x96a4('0x2b')][_0x96a4('0x49')](_0x11020b[_0x96a4('0x4a')],{})[_0x96a4('0x27')](respondWithResult(_0x3ab30f,0xc9))[_0x96a4('0x4b')](handleError(_0x3ab30f,null));};exports[_0x96a4('0x26')]=function(_0x37c846,_0x5c7ebf){if(_0x37c846['body']['id']){delete _0x37c846[_0x96a4('0x4a')]['id'];}return db[_0x96a4('0x2b')]['find']({'where':{'id':_0x37c846[_0x96a4('0x45')]['id']}})[_0x96a4('0x27')](handleEntityNotFound(_0x5c7ebf,null))['then'](saveUpdates(_0x37c846[_0x96a4('0x4a')],null))[_0x96a4('0x27')](respondWithResult(_0x5c7ebf,null))[_0x96a4('0x4b')](handleError(_0x5c7ebf,null));};exports['destroy']=function(_0x5b8628,_0x33c185){return db[_0x96a4('0x2b')]['find']({'where':{'id':_0x5b8628[_0x96a4('0x45')]['id']}})['then'](handleEntityNotFound(_0x33c185,null))[_0x96a4('0x27')](removeEntity(_0x33c185,null))[_0x96a4('0x4b')](handleError(_0x33c185,null));}; \ No newline at end of file +var _0xcb80=['count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','update','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x455835,_0x131dae){var _0x33c408=function(_0x27d806){while(--_0x27d806){_0x455835['push'](_0x455835['shift']());}};_0x33c408(++_0x131dae);}(_0xcb80,0xc3));var _0x0cb8=function(_0xccca7,_0x41b2ea){_0xccca7=_0xccca7-0x0;var _0x320bcc=_0xcb80[_0xccca7];return _0x320bcc;};'use strict';var pdf=require(_0x0cb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0cb8('0x1'));var zipdir=require(_0x0cb8('0x2'));var jsonpatch=require(_0x0cb8('0x3'));var rp=require(_0x0cb8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0cb8('0x5'));var util=require(_0x0cb8('0x6'));var path=require(_0x0cb8('0x7'));var sox=require(_0x0cb8('0x8'));var csv=require('to-csv');var ejs=require(_0x0cb8('0x9'));var fs=require('fs');var _=require(_0x0cb8('0xa'));var squel=require('squel');var crypto=require(_0x0cb8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0cb8('0xc'));var toCsv=require(_0x0cb8('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0cb8('0xe'));var authService=require(_0x0cb8('0xf'));var qs=require(_0x0cb8('0x10'));var as=require(_0x0cb8('0x11'));var hardwareService=require(_0x0cb8('0x12'));var logger=require(_0x0cb8('0x13'))(_0x0cb8('0x14'));var utils=require(_0x0cb8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0cb8('0x16'));var db=require(_0x0cb8('0x17'))['db'];function respondWithStatusCode(_0x41de9c,_0x58ac2f){_0x58ac2f=_0x58ac2f||0xcc;return function(_0x1f3e74){if(_0x1f3e74){return _0x41de9c[_0x0cb8('0x18')](_0x58ac2f);}return _0x41de9c['status'](_0x58ac2f)[_0x0cb8('0x19')]();};}function respondWithResult(_0x5698d6,_0x47884e){_0x47884e=_0x47884e||0xc8;return function(_0x18790b){if(_0x18790b){return _0x5698d6[_0x0cb8('0x1a')](_0x47884e)['json'](_0x18790b);}};}function respondWithFilteredResult(_0x37468d,_0x5cc545){return function(_0x53cb46){if(_0x53cb46){var _0x361204=_0x53cb46[_0x0cb8('0x1b')],_0x89433d=_0x5cc545[_0x0cb8('0x1c')],_0x52812e=_0x5cc545[_0x0cb8('0x1c')]+_0x5cc545[_0x0cb8('0x1d')],_0x51be98;if(_0x52812e>=_0x361204){_0x52812e=_0x361204;_0x51be98=0xc8;}else{_0x51be98=0xce;}_0x37468d[_0x0cb8('0x1a')](_0x51be98);return _0x37468d[_0x0cb8('0x1e')](_0x0cb8('0x1f'),_0x89433d+'-'+_0x52812e+'/'+_0x361204)[_0x0cb8('0x20')](_0x53cb46);}return null;};}function patchUpdates(_0x86c533){return function(_0x55adb5){try{jsonpatch[_0x0cb8('0x21')](_0x55adb5,_0x86c533,!![]);}catch(_0x44e0ad){return BPromise[_0x0cb8('0x22')](_0x44e0ad);}return _0x55adb5[_0x0cb8('0x23')]();};}function saveUpdates(_0xd8f3a8,_0x2e4604){return function(_0x182bb0){if(_0x182bb0){return _0x182bb0['update'](_0xd8f3a8)[_0x0cb8('0x24')](function(_0x15cbfe){return _0x15cbfe;});}return null;};}function removeEntity(_0x236a82,_0x52d4c7){return function(_0xc525fb){if(_0xc525fb){return _0xc525fb[_0x0cb8('0x25')]()[_0x0cb8('0x24')](function(){_0x236a82[_0x0cb8('0x1a')](0xcc)[_0x0cb8('0x19')]();});}};}function handleEntityNotFound(_0x36df8c,_0x430831){return function(_0xa3b498){if(!_0xa3b498){_0x36df8c['sendStatus'](0x194);}return _0xa3b498;};}function handleError(_0x1cbe9e,_0x5c8f76){_0x5c8f76=_0x5c8f76||0x1f4;return function(_0xc19780){logger['error'](_0xc19780[_0x0cb8('0x26')]);if(_0xc19780['name']){delete _0xc19780[_0x0cb8('0x27')];}_0x1cbe9e[_0x0cb8('0x1a')](_0x5c8f76)[_0x0cb8('0x28')](_0xc19780);};}exports[_0x0cb8('0x29')]=function(_0x348ac1,_0x43535d){var _0x27012d={},_0xd35f43={},_0x4ae0e9={'count':0x0,'rows':[]};var _0x1a9771=_[_0x0cb8('0x2a')](db[_0x0cb8('0x2b')][_0x0cb8('0x2c')],function(_0x50be18){return{'name':_0x50be18[_0x0cb8('0x2d')],'type':_0x50be18[_0x0cb8('0x2e')][_0x0cb8('0x2f')]};});_0xd35f43[_0x0cb8('0x30')]=_['map'](_0x1a9771,_0x0cb8('0x27'));_0xd35f43[_0x0cb8('0x31')]=_['keys'](_0x348ac1['query']);_0xd35f43['filters']=_['intersection'](_0xd35f43['model'],_0xd35f43[_0x0cb8('0x31')]);_0x27012d['attributes']=_[_0x0cb8('0x32')](_0xd35f43[_0x0cb8('0x30')],qs['fields'](_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x33')]));_0x27012d[_0x0cb8('0x34')]=_0x27012d[_0x0cb8('0x34')][_0x0cb8('0x35')]?_0x27012d[_0x0cb8('0x34')]:_0xd35f43[_0x0cb8('0x30')];if(!_0x348ac1['query']['hasOwnProperty']('nolimit')){_0x27012d[_0x0cb8('0x1d')]=qs[_0x0cb8('0x1d')](_0x348ac1['query'][_0x0cb8('0x1d')]);_0x27012d[_0x0cb8('0x1c')]=qs[_0x0cb8('0x1c')](_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x1c')]);}_0x27012d[_0x0cb8('0x36')]=qs[_0x0cb8('0x37')](_0x348ac1[_0x0cb8('0x31')]['sort']);_0x27012d[_0x0cb8('0x38')]=qs[_0x0cb8('0x39')](_[_0x0cb8('0x3a')](_0x348ac1['query'],_0xd35f43[_0x0cb8('0x39')]),_0x1a9771);if(_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x3b')]){_0x27012d[_0x0cb8('0x38')]=_['merge'](_0x27012d[_0x0cb8('0x38')],{'$or':_[_0x0cb8('0x2a')](_0x1a9771,function(_0x7e3e0){if(_0x7e3e0[_0x0cb8('0x2e')]!==_0x0cb8('0x3c')){var _0x5813eb={};_0x5813eb[_0x7e3e0[_0x0cb8('0x27')]]={'$like':'%'+_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x3b')]+'%'};return _0x5813eb;}})});}_0x27012d=_[_0x0cb8('0x3d')]({},_0x27012d,_0x348ac1[_0x0cb8('0x3e')]);var _0x4eea4a={'where':_0x27012d[_0x0cb8('0x38')]};return db[_0x0cb8('0x2b')][_0x0cb8('0x1b')](_0x4eea4a)[_0x0cb8('0x24')](function(_0x170e94){_0x4ae0e9[_0x0cb8('0x1b')]=_0x170e94;if(_0x348ac1[_0x0cb8('0x31')][_0x0cb8('0x3f')]){_0x27012d[_0x0cb8('0x40')]=[{'all':!![]}];}return db[_0x0cb8('0x2b')]['findAll'](_0x27012d);})['then'](function(_0x80937d){_0x4ae0e9[_0x0cb8('0x41')]=_0x80937d;return _0x4ae0e9;})[_0x0cb8('0x24')](respondWithFilteredResult(_0x43535d,_0x27012d))[_0x0cb8('0x42')](handleError(_0x43535d,null));};exports[_0x0cb8('0x43')]=function(_0x516308,_0x12bb37){var _0x17f619={'raw':!![],'where':{'id':_0x516308[_0x0cb8('0x44')]['id']}},_0x1c7014={};_0x1c7014[_0x0cb8('0x30')]=_[_0x0cb8('0x45')](db[_0x0cb8('0x2b')][_0x0cb8('0x2c')]);_0x1c7014[_0x0cb8('0x31')]=_['keys'](_0x516308['query']);_0x1c7014[_0x0cb8('0x39')]=_[_0x0cb8('0x32')](_0x1c7014[_0x0cb8('0x30')],_0x1c7014[_0x0cb8('0x31')]);_0x17f619[_0x0cb8('0x34')]=_[_0x0cb8('0x32')](_0x1c7014[_0x0cb8('0x30')],qs[_0x0cb8('0x33')](_0x516308[_0x0cb8('0x31')][_0x0cb8('0x33')]));_0x17f619[_0x0cb8('0x34')]=_0x17f619['attributes'][_0x0cb8('0x35')]?_0x17f619[_0x0cb8('0x34')]:_0x1c7014[_0x0cb8('0x30')];if(_0x516308[_0x0cb8('0x31')][_0x0cb8('0x3f')]){_0x17f619[_0x0cb8('0x40')]=[{'all':!![]}];}_0x17f619=_[_0x0cb8('0x3d')]({},_0x17f619,_0x516308[_0x0cb8('0x3e')]);return db[_0x0cb8('0x2b')]['find'](_0x17f619)[_0x0cb8('0x24')](handleEntityNotFound(_0x12bb37,null))[_0x0cb8('0x24')](respondWithResult(_0x12bb37,null))[_0x0cb8('0x42')](handleError(_0x12bb37,null));};exports[_0x0cb8('0x46')]=function(_0x2a3937,_0x462413){return db['FreshsalesField'][_0x0cb8('0x46')](_0x2a3937[_0x0cb8('0x47')],{})[_0x0cb8('0x24')](respondWithResult(_0x462413,0xc9))[_0x0cb8('0x42')](handleError(_0x462413,null));};exports[_0x0cb8('0x48')]=function(_0x4a1e90,_0x28fa24){if(_0x4a1e90['body']['id']){delete _0x4a1e90[_0x0cb8('0x47')]['id'];}return db[_0x0cb8('0x2b')][_0x0cb8('0x49')]({'where':{'id':_0x4a1e90[_0x0cb8('0x44')]['id']}})['then'](handleEntityNotFound(_0x28fa24,null))[_0x0cb8('0x24')](saveUpdates(_0x4a1e90['body'],null))[_0x0cb8('0x24')](respondWithResult(_0x28fa24,null))[_0x0cb8('0x42')](handleError(_0x28fa24,null));};exports[_0x0cb8('0x25')]=function(_0x269c7c,_0x1fd999){return db['FreshsalesField'][_0x0cb8('0x49')]({'where':{'id':_0x269c7c[_0x0cb8('0x44')]['id']}})[_0x0cb8('0x24')](handleEntityNotFound(_0x1fd999,null))[_0x0cb8('0x24')](removeEntity(_0x1fd999,null))['catch'](handleError(_0x1fd999,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d264b64..7f25155 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 _0x59ef=['api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','util'];(function(_0x577b1f,_0xe90720){var _0x5d6e61=function(_0x2753bf){while(--_0x2753bf){_0x577b1f['push'](_0x577b1f['shift']());}};_0x5d6e61(++_0xe90720);}(_0x59ef,0x12b));var _0xf59e=function(_0x3ac035,_0x40f232){_0x3ac035=_0x3ac035-0x0;var _0x4f9c43=_0x59ef[_0x3ac035];return _0x4f9c43;};'use strict';var _=require('lodash');var util=require(_0xf59e('0x0'));var logger=require('../../config/logger')(_0xf59e('0x1'));var moment=require(_0xf59e('0x2'));var BPromise=require(_0xf59e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf59e('0x4'));var rimraf=require('rimraf');var config=require(_0xf59e('0x5'));var attributes=require(_0xf59e('0x6'));module[_0xf59e('0x7')]=function(_0xe1fc12,_0x2dda75){return _0xe1fc12[_0xf59e('0x8')](_0xf59e('0x9'),attributes,{'tableName':_0xf59e('0xa'),'paranoid':![],'indexes':[{'name':_0xf59e('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x633c=['moment','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','api'];(function(_0x3e10d1,_0x186a52){var _0x5e3b74=function(_0x93e919){while(--_0x93e919){_0x3e10d1['push'](_0x3e10d1['shift']());}};_0x5e3b74(++_0x186a52);}(_0x633c,0x1c5));var _0xc633=function(_0x2eeb90,_0xd84a19){_0x2eeb90=_0x2eeb90-0x0;var _0x274e4f=_0x633c[_0x2eeb90];return _0x274e4f;};'use strict';var _=require(_0xc633('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc633('0x1'));var moment=require(_0xc633('0x2'));var BPromise=require('bluebird');var rp=require(_0xc633('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc633('0x4'));var config=require(_0xc633('0x5'));var attributes=require(_0xc633('0x6'));module[_0xc633('0x7')]=function(_0x22fc71,_0x230aea){return _0x22fc71[_0xc633('0x8')](_0xc633('0x9'),attributes,{'tableName':_0xc633('0xa'),'paranoid':![],'indexes':[{'name':_0xc633('0xb'),'fields':[_0xc633('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index f5a43a5..08622a8 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 _0x555e=['jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x555e,0x159));var _0xe555=function(_0x5b5cd3,_0x250f43){_0x5b5cd3=_0x5b5cd3-0x0;var _0x43e5c6=_0x555e[_0x5b5cd3];return _0x43e5c6;};'use strict';var _=require(_0xe555('0x0'));var util=require(_0xe555('0x1'));var moment=require(_0xe555('0x2'));var BPromise=require('bluebird');var rs=require(_0xe555('0x3'));var fs=require('fs');var Redis=require(_0xe555('0x4'));var db=require(_0xe555('0x5'))['db'];var utils=require(_0xe555('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe555('0x7'));var client=jayson[_0xe555('0x8')][_0xe555('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53a2cd,_0x516385,_0x29065f){return new BPromise(function(_0x5dd26d,_0x31a94b){return client[_0xe555('0xa')](_0x53a2cd,_0x29065f)[_0xe555('0xb')](function(_0x36bf99){logger[_0xe555('0xc')](_0xe555('0xd'),_0x516385,_0xe555('0xe'));logger['debug'](_0xe555('0xf'),_0x516385,_0xe555('0xe'),JSON[_0xe555('0x10')](_0x36bf99));if(_0x36bf99[_0xe555('0x11')]){if(_0x36bf99[_0xe555('0x11')][_0xe555('0x12')]===0x1f4){logger[_0xe555('0x11')](_0xe555('0xd'),_0x516385,_0x36bf99['error'][_0xe555('0x13')]);return _0x31a94b(_0x36bf99[_0xe555('0x11')][_0xe555('0x13')]);}logger[_0xe555('0x11')](_0xe555('0xd'),_0x516385,_0x36bf99['error'][_0xe555('0x13')]);return _0x5dd26d(_0x36bf99[_0xe555('0x11')][_0xe555('0x13')]);}else{logger[_0xe555('0xc')](_0xe555('0xd'),_0x516385,'request\x20sent');_0x5dd26d(_0x36bf99[_0xe555('0x14')][_0xe555('0x13')]);}})[_0xe555('0x15')](function(_0x142993){logger[_0xe555('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x516385,_0x142993);_0x31a94b(_0x142993);});});} \ No newline at end of file +var _0xca41=['request','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xca41,0x130));var _0x1ca4=function(_0x3e81b4,_0x342258){_0x3e81b4=_0x3e81b4-0x0;var _0x28db70=_0xca41[_0x3e81b4];return _0x28db70;};'use strict';var _=require(_0x1ca4('0x0'));var util=require('util');var moment=require(_0x1ca4('0x1'));var BPromise=require(_0x1ca4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ca4('0x3'));var db=require(_0x1ca4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ca4('0x5'))(_0x1ca4('0x6'));var config=require(_0x1ca4('0x7'));var jayson=require(_0x1ca4('0x8'));var client=jayson[_0x1ca4('0x9')][_0x1ca4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41612a,_0x262d26,_0x30c5b5){return new BPromise(function(_0x1ad8eb,_0x1eba37){return client[_0x1ca4('0xb')](_0x41612a,_0x30c5b5)['then'](function(_0x914858){logger[_0x1ca4('0xc')](_0x1ca4('0xd'),_0x262d26,'request\x20sent');logger['debug'](_0x1ca4('0xe'),_0x262d26,_0x1ca4('0xf'),JSON[_0x1ca4('0x10')](_0x914858));if(_0x914858[_0x1ca4('0x11')]){if(_0x914858[_0x1ca4('0x11')][_0x1ca4('0x12')]===0x1f4){logger[_0x1ca4('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x262d26,_0x914858[_0x1ca4('0x11')]['message']);return _0x1eba37(_0x914858[_0x1ca4('0x11')][_0x1ca4('0x13')]);}logger['error'](_0x1ca4('0xd'),_0x262d26,_0x914858[_0x1ca4('0x11')][_0x1ca4('0x13')]);return _0x1ad8eb(_0x914858[_0x1ca4('0x11')][_0x1ca4('0x13')]);}else{logger[_0x1ca4('0xc')](_0x1ca4('0xd'),_0x262d26,_0x1ca4('0xf'));_0x1ad8eb(_0x914858[_0x1ca4('0x14')][_0x1ca4('0x13')]);}})['catch'](function(_0x42d8cc){logger[_0x1ca4('0x11')](_0x1ca4('0xd'),_0x262d26,_0x42d8cc);_0x1eba37(_0x42d8cc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 44bdd20..32a4deb 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 _0xb027=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration'];(function(_0x7b9c9,_0x6018c2){var _0x2f4b80=function(_0xcaa816){while(--_0xcaa816){_0x7b9c9['push'](_0x7b9c9['shift']());}};_0x2f4b80(++_0x6018c2);}(_0xb027,0xbd));var _0x7b02=function(_0x2e1946,_0x491df7){_0x2e1946=_0x2e1946-0x0;var _0x51a593=_0xb027[_0x2e1946];return _0x51a593;};'use strict';var multer=require(_0x7b02('0x0'));var util=require(_0x7b02('0x1'));var path=require('path');var timeout=require(_0x7b02('0x2'));var express=require(_0x7b02('0x3'));var router=express[_0x7b02('0x4')]();var auth=require(_0x7b02('0x5'));var interaction=require(_0x7b02('0x6'));var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router[_0x7b02('0x7')]('/',auth[_0x7b02('0x8')](),controller[_0x7b02('0x9')]);router[_0x7b02('0x7')](_0x7b02('0xa'),auth[_0x7b02('0x8')](),controller[_0x7b02('0xb')]);router[_0x7b02('0x7')]('/:id/configurations',auth[_0x7b02('0x8')](),controller[_0x7b02('0xc')]);router[_0x7b02('0x7')](_0x7b02('0xd'),auth[_0x7b02('0x8')](),controller[_0x7b02('0xe')]);router[_0x7b02('0xf')]('/',auth[_0x7b02('0x8')](),controller['create']);router[_0x7b02('0xf')](_0x7b02('0x10'),auth['isAuthenticated'](),controller[_0x7b02('0x11')]);router[_0x7b02('0x12')](_0x7b02('0xa'),auth[_0x7b02('0x8')](),controller[_0x7b02('0x13')]);router[_0x7b02('0x14')](_0x7b02('0xa'),auth[_0x7b02('0x8')](),controller[_0x7b02('0x15')]);module[_0x7b02('0x16')]=router; \ No newline at end of file +var _0xae20=['/:id/configurations','getConfigurations','/:id/fields','create','post','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4fac37,_0x574258){var _0x40fe0f=function(_0x2514de){while(--_0x2514de){_0x4fac37['push'](_0x4fac37['shift']());}};_0x40fe0f(++_0x574258);}(_0xae20,0x12f));var _0x0ae2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xae20[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0ae2('0x0'));var util=require(_0x0ae2('0x1'));var path=require(_0x0ae2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0ae2('0x3'));var interaction=require(_0x0ae2('0x4'));var config=require(_0x0ae2('0x5'));var controller=require(_0x0ae2('0x6'));router[_0x0ae2('0x7')]('/',auth[_0x0ae2('0x8')](),controller[_0x0ae2('0x9')]);router[_0x0ae2('0x7')](_0x0ae2('0xa'),auth[_0x0ae2('0x8')](),controller[_0x0ae2('0xb')]);router['get'](_0x0ae2('0xc'),auth['isAuthenticated'](),controller[_0x0ae2('0xd')]);router[_0x0ae2('0x7')](_0x0ae2('0xe'),auth[_0x0ae2('0x8')](),controller['getFields']);router['post']('/',auth[_0x0ae2('0x8')](),controller[_0x0ae2('0xf')]);router[_0x0ae2('0x10')](_0x0ae2('0xc'),auth[_0x0ae2('0x8')](),controller['addConfiguration']);router['put'](_0x0ae2('0xa'),auth[_0x0ae2('0x8')](),controller[_0x0ae2('0x11')]);router[_0x0ae2('0x12')]('/:id',auth[_0x0ae2('0x8')](),controller[_0x0ae2('0x13')]);module[_0x0ae2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6b3f148..8cf755a 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 _0xbb42=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x5ebd38,_0x149546){var _0x38a769=function(_0x374bae){while(--_0x374bae){_0x5ebd38['push'](_0x5ebd38['shift']());}};_0x38a769(++_0x149546);}(_0xbb42,0x15c));var _0x2bb4=function(_0x13dbe9,_0x366fe0){_0x13dbe9=_0x13dbe9-0x0;var _0x5c528a=_0xbb42[_0x13dbe9];return _0x5c528a;};'use strict';var Sequelize=require(_0x2bb4('0x0'));module[_0x2bb4('0x1')]={'name':{'type':Sequelize[_0x2bb4('0x2')]},'description':{'type':Sequelize[_0x2bb4('0x2')]},'username':{'type':Sequelize[_0x2bb4('0x2')],'unique':_0x2bb4('0x3')},'remoteUri':{'type':Sequelize[_0x2bb4('0x2')]},'password':{'type':Sequelize[_0x2bb4('0x2')]},'clientId':{'type':Sequelize[_0x2bb4('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2bb4('0x2')]},'serverUrl':{'type':Sequelize[_0x2bb4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2bb4('0x4')](_0x2bb4('0x5'),_0x2bb4('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2acc=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x9d1180,_0x2f71fb){var _0x155274=function(_0x1867c1){while(--_0x1867c1){_0x9d1180['push'](_0x9d1180['shift']());}};_0x155274(++_0x2f71fb);}(_0x2acc,0x181));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc2ac('0x0'));module[_0xc2ac('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc2ac('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc2ac('0x3')},'remoteUri':{'type':Sequelize[_0xc2ac('0x2')]},'password':{'type':Sequelize[_0xc2ac('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xc2ac('0x2')]},'serverUrl':{'type':Sequelize[_0xc2ac('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc2ac('0x4')](_0xc2ac('0x5'),_0xc2ac('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3a70f47..d9458c4 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 _0x8aad=['pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','rawAttributes','options','find','create','body','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Type','Reason','SuppliedName','SuppliedCompany','custom','includes','label','picklistValues','value','boolean','true','False','statusCode','send','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SalesforceAccount','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1bc362,_0x5c561d){var _0x5c96ec=function(_0x370c46){while(--_0x370c46){_0x1bc362['push'](_0x1bc362['shift']());}};_0x5c96ec(++_0x5c561d);}(_0x8aad,0x146));var _0xd8aa=function(_0x17cfb3,_0x45a33a){_0x17cfb3=_0x17cfb3-0x0;var _0x5532a3=_0x8aad[_0x17cfb3];return _0x5532a3;};'use strict';var pdf=require(_0xd8aa('0x0'));var emlformat=require(_0xd8aa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd8aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8aa('0x3'));var moment=require(_0xd8aa('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd8aa('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd8aa('0x6'));var ejs=require(_0xd8aa('0x7'));var fs=require('fs');var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xc'));var authService=require(_0xd8aa('0xd'));var qs=require(_0xd8aa('0xe'));var as=require(_0xd8aa('0xf'));var hardwareService=require(_0xd8aa('0x10'));var logger=require('../../config/logger')(_0xd8aa('0x11'));var utils=require(_0xd8aa('0x12'));var config=require(_0xd8aa('0x13'));var licenseUtil=require(_0xd8aa('0x14'));var db=require(_0xd8aa('0x15'))['db'];var integrations=require(_0xd8aa('0x16'));var jayson=require(_0xd8aa('0x17'));var client=jayson[_0xd8aa('0x18')][_0xd8aa('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x364280,_0x5ea934,_0x5a8c79,_0x275eff){return new BPromise(function(_0x319ffe,_0x2bbd1e){var _0x47c131=_0x275eff||client;return _0x47c131[_0xd8aa('0x1a')](_0x364280,_0x5a8c79)[_0xd8aa('0x1b')](function(_0x39b5bc){logger[_0xd8aa('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x5ea934,_0xd8aa('0x1d'));logger[_0xd8aa('0x1e')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5ea934,_0xd8aa('0x1d'),JSON[_0xd8aa('0x1f')](_0x39b5bc));if(_0x39b5bc[_0xd8aa('0x20')]){if(_0x39b5bc[_0xd8aa('0x20')][_0xd8aa('0x21')]===0x1f4){logger['error'](_0xd8aa('0x22'),_0x5ea934,_0x39b5bc[_0xd8aa('0x20')][_0xd8aa('0x23')]);return _0x2bbd1e(_0x39b5bc[_0xd8aa('0x20')]['message']);}logger[_0xd8aa('0x20')](_0xd8aa('0x22'),_0x5ea934,_0x39b5bc[_0xd8aa('0x20')][_0xd8aa('0x23')]);return _0x319ffe(_0x39b5bc[_0xd8aa('0x20')]['message']);}else{logger[_0xd8aa('0x1c')](_0xd8aa('0x22'),_0x5ea934,_0xd8aa('0x1d'));_0x319ffe(_0x39b5bc['result'][_0xd8aa('0x23')]);}})[_0xd8aa('0x24')](function(_0x1d1f87){logger[_0xd8aa('0x20')](_0xd8aa('0x22'),_0x5ea934,_0x1d1f87);_0x2bbd1e(_0x1d1f87);});});}function respondWithStatusCode(_0x16758a,_0x1f64f8){_0x1f64f8=_0x1f64f8||0xcc;return function(_0x34d957){if(_0x34d957){return _0x16758a[_0xd8aa('0x25')](_0x1f64f8);}return _0x16758a[_0xd8aa('0x26')](_0x1f64f8)[_0xd8aa('0x27')]();};}function respondWithResult(_0x370d6f,_0x26cc66){_0x26cc66=_0x26cc66||0xc8;return function(_0x5f1027){if(_0x5f1027){return _0x370d6f[_0xd8aa('0x26')](_0x26cc66)[_0xd8aa('0x28')](_0x5f1027);}};}function respondWithFilteredResult(_0xd4d204,_0x1f6ab2){return function(_0x26cff3){if(_0x26cff3){var _0x3696fd=_0x26cff3[_0xd8aa('0x29')],_0x26ab06=_0x1f6ab2['offset'],_0x19edee=_0x1f6ab2[_0xd8aa('0x2a')]+_0x1f6ab2[_0xd8aa('0x2b')],_0x3bba1d;if(_0x19edee>=_0x3696fd){_0x19edee=_0x3696fd;_0x3bba1d=0xc8;}else{_0x3bba1d=0xce;}_0xd4d204[_0xd8aa('0x26')](_0x3bba1d);return _0xd4d204['set'](_0xd8aa('0x2c'),_0x26ab06+'-'+_0x19edee+'/'+_0x3696fd)['json'](_0x26cff3);}return null;};}function patchUpdates(_0x3052c6){return function(_0x441466){try{jsonpatch[_0xd8aa('0x2d')](_0x441466,_0x3052c6,!![]);}catch(_0x168a2e){return BPromise[_0xd8aa('0x2e')](_0x168a2e);}return _0x441466[_0xd8aa('0x2f')]();};}function saveUpdates(_0xd8d3b3,_0x3cbe8d){return function(_0x5e41e6){if(_0x5e41e6){return _0x5e41e6[_0xd8aa('0x30')](_0xd8d3b3)[_0xd8aa('0x1b')](function(_0x11071f){return _0x11071f;});}return null;};}function removeEntity(_0x2d615a,_0x1b475a){return function(_0x3b8476){if(_0x3b8476){return _0x3b8476[_0xd8aa('0x31')]()[_0xd8aa('0x1b')](function(){_0x2d615a['status'](0xcc)[_0xd8aa('0x27')]();});}};}function handleEntityNotFound(_0x172673,_0x47401e){return function(_0x511b4a){if(!_0x511b4a){_0x172673[_0xd8aa('0x25')](0x194);}return _0x511b4a;};}function handleError(_0x3c8941,_0x21f550){_0x21f550=_0x21f550||0x1f4;return function(_0x45c216){logger[_0xd8aa('0x20')](_0x45c216[_0xd8aa('0x32')]);if(_0x45c216[_0xd8aa('0x33')]){delete _0x45c216[_0xd8aa('0x33')];}_0x3c8941[_0xd8aa('0x26')](_0x21f550)['send'](_0x45c216);};}exports[_0xd8aa('0x34')]=function(_0xef25cb,_0x41cd24){var _0x221f41={},_0x3e23fd={},_0x1b1469={'count':0x0,'rows':[]};var _0xd0bc2b=_[_0xd8aa('0x35')](db[_0xd8aa('0x36')]['rawAttributes'],function(_0x1df47c){return{'name':_0x1df47c['fieldName'],'type':_0x1df47c[_0xd8aa('0x37')][_0xd8aa('0x38')]};});_0x3e23fd['model']=_[_0xd8aa('0x35')](_0xd0bc2b,_0xd8aa('0x33'));_0x3e23fd[_0xd8aa('0x39')]=_[_0xd8aa('0x3a')](_0xef25cb[_0xd8aa('0x39')]);_0x3e23fd['filters']=_['intersection'](_0x3e23fd[_0xd8aa('0x3b')],_0x3e23fd['query']);_0x221f41[_0xd8aa('0x3c')]=_[_0xd8aa('0x3d')](_0x3e23fd[_0xd8aa('0x3b')],qs[_0xd8aa('0x3e')](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x3e')]));_0x221f41[_0xd8aa('0x3c')]=_0x221f41[_0xd8aa('0x3c')][_0xd8aa('0x3f')]?_0x221f41[_0xd8aa('0x3c')]:_0x3e23fd[_0xd8aa('0x3b')];if(!_0xef25cb['query'][_0xd8aa('0x40')](_0xd8aa('0x41'))){_0x221f41[_0xd8aa('0x2b')]=qs['limit'](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x2b')]);_0x221f41[_0xd8aa('0x2a')]=qs[_0xd8aa('0x2a')](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x2a')]);}_0x221f41[_0xd8aa('0x42')]=qs[_0xd8aa('0x43')](_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x43')]);_0x221f41[_0xd8aa('0x44')]=qs[_0xd8aa('0x45')](_[_0xd8aa('0x46')](_0xef25cb[_0xd8aa('0x39')],_0x3e23fd[_0xd8aa('0x45')]),_0xd0bc2b);if(_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x47')]){_0x221f41[_0xd8aa('0x44')]=_['merge'](_0x221f41[_0xd8aa('0x44')],{'$or':_[_0xd8aa('0x35')](_0xd0bc2b,function(_0x146ebd){if(_0x146ebd[_0xd8aa('0x37')]!==_0xd8aa('0x48')){var _0xc30ce={};_0xc30ce[_0x146ebd['name']]={'$like':'%'+_0xef25cb[_0xd8aa('0x39')]['filter']+'%'};return _0xc30ce;}})});}_0x221f41=_[_0xd8aa('0x49')]({},_0x221f41,_0xef25cb['options']);var _0x59565f={'where':_0x221f41['where']};return db['SalesforceAccount'][_0xd8aa('0x29')](_0x59565f)[_0xd8aa('0x1b')](function(_0xa608f9){_0x1b1469[_0xd8aa('0x29')]=_0xa608f9;if(_0xef25cb[_0xd8aa('0x39')][_0xd8aa('0x4a')]){_0x221f41['include']=[{'all':!![]}];}return db[_0xd8aa('0x36')][_0xd8aa('0x4b')](_0x221f41);})[_0xd8aa('0x1b')](function(_0xf6728d){_0x1b1469[_0xd8aa('0x4c')]=_0xf6728d;return _0x1b1469;})['then'](respondWithFilteredResult(_0x41cd24,_0x221f41))['catch'](handleError(_0x41cd24,null));};exports['show']=function(_0x1fd1dc,_0x2a24ae){var _0x131012={'raw':![],'where':{'id':_0x1fd1dc[_0xd8aa('0x4d')]['id']}},_0x2ae10b={};_0x2ae10b[_0xd8aa('0x3b')]=_['keys'](db[_0xd8aa('0x36')][_0xd8aa('0x4e')]);_0x2ae10b['query']=_[_0xd8aa('0x3a')](_0x1fd1dc[_0xd8aa('0x39')]);_0x2ae10b[_0xd8aa('0x45')]=_['intersection'](_0x2ae10b[_0xd8aa('0x3b')],_0x2ae10b[_0xd8aa('0x39')]);_0x131012[_0xd8aa('0x3c')]=_[_0xd8aa('0x3d')](_0x2ae10b[_0xd8aa('0x3b')],qs[_0xd8aa('0x3e')](_0x1fd1dc['query']['fields']));_0x131012[_0xd8aa('0x3c')]=_0x131012[_0xd8aa('0x3c')][_0xd8aa('0x3f')]?_0x131012[_0xd8aa('0x3c')]:_0x2ae10b[_0xd8aa('0x3b')];if(_0x1fd1dc[_0xd8aa('0x39')][_0xd8aa('0x4a')]){_0x131012['include']=[{'all':!![]}];}_0x131012=_[_0xd8aa('0x49')]({},_0x131012,_0x1fd1dc[_0xd8aa('0x4f')]);return db['SalesforceAccount'][_0xd8aa('0x50')](_0x131012)['then'](handleEntityNotFound(_0x2a24ae,null))[_0xd8aa('0x1b')](respondWithResult(_0x2a24ae,null))[_0xd8aa('0x24')](handleError(_0x2a24ae,null));};exports[_0xd8aa('0x51')]=function(_0x5e2770,_0x5de908){return db['SalesforceAccount']['create'](_0x5e2770[_0xd8aa('0x52')],{})[_0xd8aa('0x1b')](respondWithResult(_0x5de908,0xc9))[_0xd8aa('0x24')](handleError(_0x5de908,null));};exports['update']=function(_0x4c44c2,_0x495a33){if(_0x4c44c2[_0xd8aa('0x52')]['id']){delete _0x4c44c2[_0xd8aa('0x52')]['id'];}return db[_0xd8aa('0x36')][_0xd8aa('0x50')]({'where':{'id':_0x4c44c2[_0xd8aa('0x4d')]['id']}})[_0xd8aa('0x1b')](handleEntityNotFound(_0x495a33,null))[_0xd8aa('0x1b')](saveUpdates(_0x4c44c2[_0xd8aa('0x52')],null))[_0xd8aa('0x1b')](respondWithResult(_0x495a33,null))[_0xd8aa('0x24')](handleError(_0x495a33,null));};exports[_0xd8aa('0x31')]=function(_0x24b935,_0x407b7d){return db['SalesforceAccount']['find']({'where':{'id':_0x24b935[_0xd8aa('0x4d')]['id']}})[_0xd8aa('0x1b')](handleEntityNotFound(_0x407b7d,null))[_0xd8aa('0x1b')](removeEntity(_0x407b7d,null))[_0xd8aa('0x24')](handleError(_0x407b7d,null));};exports['getConfigurations']=function(_0x120ccc,_0x34efde,_0x5875df){var _0x53564e={};var _0x2c5650={};var _0x38e1ec;var _0x157b97;return db[_0xd8aa('0x36')]['findOne']({'where':{'id':_0x120ccc['params']['id']}})[_0xd8aa('0x1b')](handleEntityNotFound(_0x34efde,null))['then'](function(_0x1a0fda){if(_0x1a0fda){_0x38e1ec=_0x1a0fda;_0x2c5650[_0xd8aa('0x3b')]=_[_0xd8aa('0x3a')](db[_0xd8aa('0x53')][_0xd8aa('0x4e')]);_0x2c5650[_0xd8aa('0x39')]=_['keys'](_0x120ccc[_0xd8aa('0x39')]);_0x2c5650[_0xd8aa('0x45')]=_[_0xd8aa('0x3d')](_0x2c5650[_0xd8aa('0x3b')],_0x2c5650[_0xd8aa('0x39')]);_0x53564e[_0xd8aa('0x3c')]=_[_0xd8aa('0x3d')](_0x2c5650[_0xd8aa('0x3b')],qs[_0xd8aa('0x3e')](_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x3e')]));_0x53564e[_0xd8aa('0x3c')]=_0x53564e[_0xd8aa('0x3c')][_0xd8aa('0x3f')]?_0x53564e[_0xd8aa('0x3c')]:_0x2c5650[_0xd8aa('0x3b')];_0x53564e[_0xd8aa('0x42')]=qs[_0xd8aa('0x43')](_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x43')]);_0x53564e[_0xd8aa('0x44')]=qs['filters'](_['pick'](_0x120ccc['query'],_0x2c5650[_0xd8aa('0x45')]));if(_0x120ccc['query'][_0xd8aa('0x47')]){_0x53564e[_0xd8aa('0x44')]=_[_0xd8aa('0x49')](_0x53564e[_0xd8aa('0x44')],{'$or':_[_0xd8aa('0x35')](_0x53564e[_0xd8aa('0x3c')],function(_0xdb3a5f){var _0x26bf3f={};_0x26bf3f[_0xdb3a5f]={'$like':'%'+_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x47')]+'%'};return _0x26bf3f;})});}_0x53564e=_[_0xd8aa('0x49')]({},_0x53564e,_0x120ccc['options']);return _0x38e1ec['getConfigurations'](_0x53564e);}})[_0xd8aa('0x1b')](function(_0x4fdba4){if(_0x4fdba4){_0x157b97=_0x4fdba4[_0xd8aa('0x3f')];if(!_0x120ccc['query']['hasOwnProperty'](_0xd8aa('0x41'))){_0x53564e[_0xd8aa('0x2b')]=qs[_0xd8aa('0x2b')](_0x120ccc[_0xd8aa('0x39')]['limit']);_0x53564e[_0xd8aa('0x2a')]=qs[_0xd8aa('0x2a')](_0x120ccc[_0xd8aa('0x39')][_0xd8aa('0x2a')]);}return _0x38e1ec[_0xd8aa('0x54')](_0x53564e);}})[_0xd8aa('0x1b')](function(_0x20865a){if(_0x20865a){return _0x20865a?{'count':_0x157b97,'rows':_0x20865a}:null;}})[_0xd8aa('0x1b')](respondWithResult(_0x34efde,null))[_0xd8aa('0x24')](handleError(_0x34efde,null));};exports[_0xd8aa('0x55')]=function(_0x552e85,_0x190fdf,_0x4102a3){if(_0x552e85[_0xd8aa('0x52')]['id']){delete _0x552e85['body']['id'];}return db['SalesforceAccount'][_0xd8aa('0x56')]({'where':{'id':_0x552e85[_0xd8aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x190fdf,null))[_0xd8aa('0x1b')](function(_0x36c155){if(_0x36c155){_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x57')]=_0x36c155['id'];_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x58')]=integrations[_0xd8aa('0x59')](_0x552e85['body'][_0xd8aa('0x5a')],_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x37')]);_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x5b')]=integrations[_0xd8aa('0x5c')](_0x552e85[_0xd8aa('0x52')][_0xd8aa('0x5a')],_0x552e85['body'][_0xd8aa('0x37')]);return db[_0xd8aa('0x53')][_0xd8aa('0x51')](_0x552e85['body'],{'include':[{'model':db[_0xd8aa('0x5d')],'as':_0xd8aa('0x58')},{'model':db[_0xd8aa('0x5d')],'as':_0xd8aa('0x5b')}]});}return null;})[_0xd8aa('0x1b')](respondWithResult(_0x190fdf,null))[_0xd8aa('0x24')](handleError(_0x190fdf,null));};exports[_0xd8aa('0x5e')]=function(_0x2c6083,_0x12f182,_0x2ea370){var _0x377a95;var _0x373194='';var _0x2bb705=_0xd8aa('0x5f');return db[_0xd8aa('0x36')][_0xd8aa('0x56')]({'where':{'id':_0x2c6083[_0xd8aa('0x4d')]['id']},'attributes':['id',_0xd8aa('0x60'),'clientId',_0xd8aa('0x61'),_0xd8aa('0x62'),_0xd8aa('0x63'),_0xd8aa('0x64')]})['then'](handleEntityNotFound(_0x12f182,null))[_0xd8aa('0x1b')](function(_0x160a59){if(_0x160a59){_0x373194=_0x160a59[_0xd8aa('0x60')];var _0x8ffb88=_0x373194['slice'](-0x1);if(_0x8ffb88==='/'){_0x373194=_0x373194[_0xd8aa('0x65')](0x0,_0x373194['lastIndexOf'](_0x8ffb88));}_0x377a95=new jsforce[(_0xd8aa('0x66'))]({'oauth2':{'loginUrl':_0x373194,'clientId':_0x160a59[_0xd8aa('0x67')],'clientSecret':_0x160a59[_0xd8aa('0x61')]}});return _0x377a95[_0xd8aa('0x68')](_0x160a59[_0xd8aa('0x62')],_0x160a59[_0xd8aa('0x63')][_0xd8aa('0x69')](_0x160a59['securityToken']));}})['then'](function(_0x2b2222){if(_0x2b2222){if(!_[_0xd8aa('0x6a')](_0x2c6083[_0xd8aa('0x39')]['ticketType'])){_0x2bb705=_0x2c6083[_0xd8aa('0x39')][_0xd8aa('0x6b')];}return _0x377a95[_0xd8aa('0x6c')](_0x2bb705)[_0xd8aa('0x6d')]();}})[_0xd8aa('0x1b')](function(_0x518588){var _0x5286ec=[_0xd8aa('0x6e'),'CallDurationInSeconds',_0xd8aa('0x6f'),_0xd8aa('0x70'),_0xd8aa('0x71'),_0xd8aa('0x72'),_0xd8aa('0x73'),_0xd8aa('0x74')];if(!_['isNil'](_0x2c6083[_0xd8aa('0x39')][_0xd8aa('0x6b')])&&_0x2c6083[_0xd8aa('0x39')]['ticketType']==='Case'){_0x5286ec=['Type','Origin',_0xd8aa('0x75'),_0xd8aa('0x73'),'Priority','IsEscalated',_0xd8aa('0x76'),_0xd8aa('0x77')];}if(_0x518588){_['remove'](_0x518588['fields'],function(_0x29d8de){return _0x29d8de[_0xd8aa('0x78')]===![]&&!_0x5286ec[_0xd8aa('0x79')](_0x29d8de['name']);});return{'count':_0x518588['fields'][_0xd8aa('0x3f')],'rows':_[_0xd8aa('0x35')](_0x518588[_0xd8aa('0x3e')],function(_0x205bf6){return{'id':_0x205bf6[_0xd8aa('0x33')],'name':_0x205bf6[_0xd8aa('0x7a')],'custom':_0x205bf6[_0xd8aa('0x78')],'options':_0x205bf6[_0xd8aa('0x7b')][_0xd8aa('0x3f')]>0x0?_[_0xd8aa('0x35')](_0x205bf6[_0xd8aa('0x7b')],function(_0x3497a3){return{'name':_0x3497a3[_0xd8aa('0x7a')],'value':_0x3497a3[_0xd8aa('0x7c')]};}):_0x205bf6[_0xd8aa('0x37')]==_0xd8aa('0x7d')?[{'name':'True','value':_0xd8aa('0x7e')},{'name':_0xd8aa('0x7f'),'value':'false'}]:[]};})};}})[_0xd8aa('0x1b')](respondWithResult(_0x12f182,null))[_0xd8aa('0x24')](function(_0x2c3239){var _0x141043=_0x2c6083[_0xd8aa('0x39')]['test']?0x1f4:_0x2c3239[_0xd8aa('0x80')]||0x1f4;logger[_0xd8aa('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0xd8aa('0x5e'),_0x141043,JSON[_0xd8aa('0x1f')](_0x2c3239));delete _0x2c3239['name'];if(_0x141043===0x191){_0x141043=0x190;}_0x12f182[_0xd8aa('0x26')](_0x141043)[_0xd8aa('0x81')](_0x2c6083[_0xd8aa('0x39')][_0xd8aa('0x82')]?{'message':_0xd8aa('0x83'),'statusCode':_0x2c3239[_0xd8aa('0x80')]}:_0x2c3239);});}; \ No newline at end of file +var _0x4fc2=['Case','Origin','Reason','SuppliedCompany','includes','label','custom','picklistValues','value','boolean','True','False','false','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','destroy','stack','name','send','SalesforceAccount','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','then','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','SalesforceConfiguration','length','pick','findOne','channel','Descriptions','SalesforceField','Subjects','remoteUri','clientId','clientSecret','username','password','securityToken','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','isNil'];(function(_0x56e22b,_0x4f79b0){var _0x3cf6d4=function(_0x7a687c){while(--_0x7a687c){_0x56e22b['push'](_0x56e22b['shift']());}};_0x3cf6d4(++_0x4f79b0);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a1ba8,_0x52a437){_0x1a1ba8=_0x1a1ba8-0x0;var _0x3c5118=_0x4fc2[_0x1a1ba8];return _0x3c5118;};'use strict';var pdf=require(_0x24fc('0x0'));var emlformat=require(_0x24fc('0x1'));var rimraf=require(_0x24fc('0x2'));var zipdir=require(_0x24fc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24fc('0x4'));var moment=require(_0x24fc('0x5'));var BPromise=require(_0x24fc('0x6'));var Mustache=require('mustache');var util=require(_0x24fc('0x7'));var path=require(_0x24fc('0x8'));var sox=require('sox');var csv=require(_0x24fc('0x9'));var ejs=require(_0x24fc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0x9'));var querystring=require(_0x24fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x10'));var authService=require(_0x24fc('0x11'));var qs=require(_0x24fc('0x12'));var as=require(_0x24fc('0x13'));var hardwareService=require(_0x24fc('0x14'));var logger=require(_0x24fc('0x15'))(_0x24fc('0x16'));var utils=require(_0x24fc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x18'));var db=require(_0x24fc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x24fc('0x1a'));var client=jayson[_0x24fc('0x1b')][_0x24fc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3bc30b,_0x30f19b,_0x326276,_0x537b5c){return new BPromise(function(_0x2a0971,_0x18c0a7){var _0x2ffed3=_0x537b5c||client;return _0x2ffed3[_0x24fc('0x1d')](_0x3bc30b,_0x326276)['then'](function(_0x2ac989){logger['info'](_0x24fc('0x1e'),_0x30f19b,_0x24fc('0x1f'));logger[_0x24fc('0x20')](_0x24fc('0x21'),_0x30f19b,_0x24fc('0x1f'),JSON['stringify'](_0x2ac989));if(_0x2ac989[_0x24fc('0x22')]){if(_0x2ac989[_0x24fc('0x22')][_0x24fc('0x23')]===0x1f4){logger[_0x24fc('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x30f19b,_0x2ac989[_0x24fc('0x22')][_0x24fc('0x24')]);return _0x18c0a7(_0x2ac989[_0x24fc('0x22')]['message']);}logger[_0x24fc('0x22')](_0x24fc('0x1e'),_0x30f19b,_0x2ac989[_0x24fc('0x22')][_0x24fc('0x24')]);return _0x2a0971(_0x2ac989['error'][_0x24fc('0x24')]);}else{logger['info'](_0x24fc('0x1e'),_0x30f19b,'request\x20sent');_0x2a0971(_0x2ac989[_0x24fc('0x25')][_0x24fc('0x24')]);}})[_0x24fc('0x26')](function(_0x595475){logger[_0x24fc('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x30f19b,_0x595475);_0x18c0a7(_0x595475);});});}function respondWithStatusCode(_0x35a9c7,_0x2bb93a){_0x2bb93a=_0x2bb93a||0xcc;return function(_0x36a9b4){if(_0x36a9b4){return _0x35a9c7[_0x24fc('0x27')](_0x2bb93a);}return _0x35a9c7[_0x24fc('0x28')](_0x2bb93a)[_0x24fc('0x29')]();};}function respondWithResult(_0x3f0875,_0x20192b){_0x20192b=_0x20192b||0xc8;return function(_0x168d98){if(_0x168d98){return _0x3f0875[_0x24fc('0x28')](_0x20192b)['json'](_0x168d98);}};}function respondWithFilteredResult(_0x11c913,_0x16f27f){return function(_0x3ee302){if(_0x3ee302){var _0x5bb4c8=_0x3ee302[_0x24fc('0x2a')],_0xf2f77d=_0x16f27f[_0x24fc('0x2b')],_0x3d1ec8=_0x16f27f[_0x24fc('0x2b')]+_0x16f27f['limit'],_0x35f9f9;if(_0x3d1ec8>=_0x5bb4c8){_0x3d1ec8=_0x5bb4c8;_0x35f9f9=0xc8;}else{_0x35f9f9=0xce;}_0x11c913[_0x24fc('0x28')](_0x35f9f9);return _0x11c913[_0x24fc('0x2c')](_0x24fc('0x2d'),_0xf2f77d+'-'+_0x3d1ec8+'/'+_0x5bb4c8)[_0x24fc('0x2e')](_0x3ee302);}return null;};}function patchUpdates(_0x9f7bbc){return function(_0x490aa5){try{jsonpatch['apply'](_0x490aa5,_0x9f7bbc,!![]);}catch(_0x4e6f73){return BPromise[_0x24fc('0x2f')](_0x4e6f73);}return _0x490aa5['save']();};}function saveUpdates(_0x3f2464,_0x3e6389){return function(_0xae4f22){if(_0xae4f22){return _0xae4f22[_0x24fc('0x30')](_0x3f2464)['then'](function(_0x66eec0){return _0x66eec0;});}return null;};}function removeEntity(_0x33f368,_0x523c1f){return function(_0xf46cd5){if(_0xf46cd5){return _0xf46cd5[_0x24fc('0x31')]()['then'](function(){_0x33f368['status'](0xcc)[_0x24fc('0x29')]();});}};}function handleEntityNotFound(_0x56eae7,_0x3c20a7){return function(_0x98e81b){if(!_0x98e81b){_0x56eae7['sendStatus'](0x194);}return _0x98e81b;};}function handleError(_0x2ae896,_0x33bbf2){_0x33bbf2=_0x33bbf2||0x1f4;return function(_0x3b2862){logger[_0x24fc('0x22')](_0x3b2862[_0x24fc('0x32')]);if(_0x3b2862[_0x24fc('0x33')]){delete _0x3b2862[_0x24fc('0x33')];}_0x2ae896[_0x24fc('0x28')](_0x33bbf2)[_0x24fc('0x34')](_0x3b2862);};}exports['index']=function(_0x320d2e,_0x4224f4){var _0x2fbe30={},_0x316aa2={},_0x242bd5={'count':0x0,'rows':[]};var _0x5781d2=_['map'](db[_0x24fc('0x35')]['rawAttributes'],function(_0x22ef18){return{'name':_0x22ef18[_0x24fc('0x36')],'type':_0x22ef18[_0x24fc('0x37')][_0x24fc('0x38')]};});_0x316aa2['model']=_[_0x24fc('0x39')](_0x5781d2,'name');_0x316aa2[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x320d2e[_0x24fc('0x3a')]);_0x316aa2[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x316aa2['model'],_0x316aa2[_0x24fc('0x3a')]);_0x2fbe30[_0x24fc('0x3e')]=_[_0x24fc('0x3d')](_0x316aa2[_0x24fc('0x3f')],qs['fields'](_0x320d2e[_0x24fc('0x3a')][_0x24fc('0x40')]));_0x2fbe30['attributes']=_0x2fbe30[_0x24fc('0x3e')]['length']?_0x2fbe30[_0x24fc('0x3e')]:_0x316aa2[_0x24fc('0x3f')];if(!_0x320d2e[_0x24fc('0x3a')][_0x24fc('0x41')](_0x24fc('0x42'))){_0x2fbe30[_0x24fc('0x43')]=qs[_0x24fc('0x43')](_0x320d2e[_0x24fc('0x3a')]['limit']);_0x2fbe30[_0x24fc('0x2b')]=qs[_0x24fc('0x2b')](_0x320d2e[_0x24fc('0x3a')]['offset']);}_0x2fbe30[_0x24fc('0x44')]=qs[_0x24fc('0x45')](_0x320d2e['query'][_0x24fc('0x45')]);_0x2fbe30[_0x24fc('0x46')]=qs[_0x24fc('0x3c')](_['pick'](_0x320d2e[_0x24fc('0x3a')],_0x316aa2[_0x24fc('0x3c')]),_0x5781d2);if(_0x320d2e['query'][_0x24fc('0x47')]){_0x2fbe30[_0x24fc('0x46')]=_[_0x24fc('0x48')](_0x2fbe30[_0x24fc('0x46')],{'$or':_['map'](_0x5781d2,function(_0x2eecaf){if(_0x2eecaf[_0x24fc('0x37')]!==_0x24fc('0x49')){var _0x7b38fa={};_0x7b38fa[_0x2eecaf[_0x24fc('0x33')]]={'$like':'%'+_0x320d2e['query'][_0x24fc('0x47')]+'%'};return _0x7b38fa;}})});}_0x2fbe30=_[_0x24fc('0x48')]({},_0x2fbe30,_0x320d2e[_0x24fc('0x4a')]);var _0x3c6ffb={'where':_0x2fbe30['where']};return db[_0x24fc('0x35')][_0x24fc('0x2a')](_0x3c6ffb)['then'](function(_0x5bbb6c){_0x242bd5[_0x24fc('0x2a')]=_0x5bbb6c;if(_0x320d2e['query']['includeAll']){_0x2fbe30[_0x24fc('0x4b')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x24fc('0x4c')](_0x2fbe30);})[_0x24fc('0x4d')](function(_0x5052c8){_0x242bd5['rows']=_0x5052c8;return _0x242bd5;})[_0x24fc('0x4d')](respondWithFilteredResult(_0x4224f4,_0x2fbe30))[_0x24fc('0x26')](handleError(_0x4224f4,null));};exports[_0x24fc('0x4e')]=function(_0x1ad8d6,_0x39873d){var _0x6c6754={'raw':![],'where':{'id':_0x1ad8d6[_0x24fc('0x4f')]['id']}},_0x166f6c={};_0x166f6c['model']=_['keys'](db[_0x24fc('0x35')][_0x24fc('0x50')]);_0x166f6c[_0x24fc('0x3a')]=_['keys'](_0x1ad8d6['query']);_0x166f6c[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x166f6c[_0x24fc('0x3f')],_0x166f6c[_0x24fc('0x3a')]);_0x6c6754[_0x24fc('0x3e')]=_[_0x24fc('0x3d')](_0x166f6c[_0x24fc('0x3f')],qs[_0x24fc('0x40')](_0x1ad8d6[_0x24fc('0x3a')][_0x24fc('0x40')]));_0x6c6754[_0x24fc('0x3e')]=_0x6c6754[_0x24fc('0x3e')]['length']?_0x6c6754[_0x24fc('0x3e')]:_0x166f6c[_0x24fc('0x3f')];if(_0x1ad8d6[_0x24fc('0x3a')][_0x24fc('0x51')]){_0x6c6754[_0x24fc('0x4b')]=[{'all':!![]}];}_0x6c6754=_['merge']({},_0x6c6754,_0x1ad8d6[_0x24fc('0x4a')]);return db['SalesforceAccount'][_0x24fc('0x52')](_0x6c6754)[_0x24fc('0x4d')](handleEntityNotFound(_0x39873d,null))[_0x24fc('0x4d')](respondWithResult(_0x39873d,null))[_0x24fc('0x26')](handleError(_0x39873d,null));};exports[_0x24fc('0x53')]=function(_0x3dd8e0,_0x4c9216){return db[_0x24fc('0x35')][_0x24fc('0x53')](_0x3dd8e0[_0x24fc('0x54')],{})[_0x24fc('0x4d')](respondWithResult(_0x4c9216,0xc9))[_0x24fc('0x26')](handleError(_0x4c9216,null));};exports[_0x24fc('0x30')]=function(_0x540b22,_0x36d500){if(_0x540b22[_0x24fc('0x54')]['id']){delete _0x540b22[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x35')][_0x24fc('0x52')]({'where':{'id':_0x540b22[_0x24fc('0x4f')]['id']}})[_0x24fc('0x4d')](handleEntityNotFound(_0x36d500,null))['then'](saveUpdates(_0x540b22[_0x24fc('0x54')],null))[_0x24fc('0x4d')](respondWithResult(_0x36d500,null))['catch'](handleError(_0x36d500,null));};exports[_0x24fc('0x31')]=function(_0x192aa8,_0x276f11){return db[_0x24fc('0x35')][_0x24fc('0x52')]({'where':{'id':_0x192aa8[_0x24fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x276f11,null))[_0x24fc('0x4d')](removeEntity(_0x276f11,null))['catch'](handleError(_0x276f11,null));};exports[_0x24fc('0x55')]=function(_0x8c9649,_0x50e5b0,_0x435442){var _0x5c1a92={};var _0x1c1f74={};var _0x595c47;var _0xdff811;return db[_0x24fc('0x35')]['findOne']({'where':{'id':_0x8c9649[_0x24fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x50e5b0,null))[_0x24fc('0x4d')](function(_0x16dc59){if(_0x16dc59){_0x595c47=_0x16dc59;_0x1c1f74['model']=_[_0x24fc('0x3b')](db[_0x24fc('0x56')][_0x24fc('0x50')]);_0x1c1f74[_0x24fc('0x3a')]=_[_0x24fc('0x3b')](_0x8c9649['query']);_0x1c1f74[_0x24fc('0x3c')]=_[_0x24fc('0x3d')](_0x1c1f74[_0x24fc('0x3f')],_0x1c1f74[_0x24fc('0x3a')]);_0x5c1a92[_0x24fc('0x3e')]=_['intersection'](_0x1c1f74['model'],qs[_0x24fc('0x40')](_0x8c9649[_0x24fc('0x3a')]['fields']));_0x5c1a92['attributes']=_0x5c1a92[_0x24fc('0x3e')][_0x24fc('0x57')]?_0x5c1a92[_0x24fc('0x3e')]:_0x1c1f74[_0x24fc('0x3f')];_0x5c1a92['order']=qs[_0x24fc('0x45')](_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x45')]);_0x5c1a92[_0x24fc('0x46')]=qs[_0x24fc('0x3c')](_[_0x24fc('0x58')](_0x8c9649[_0x24fc('0x3a')],_0x1c1f74[_0x24fc('0x3c')]));if(_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x47')]){_0x5c1a92[_0x24fc('0x46')]=_[_0x24fc('0x48')](_0x5c1a92[_0x24fc('0x46')],{'$or':_[_0x24fc('0x39')](_0x5c1a92[_0x24fc('0x3e')],function(_0x54ead5){var _0xd53778={};_0xd53778[_0x54ead5]={'$like':'%'+_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x47')]+'%'};return _0xd53778;})});}_0x5c1a92=_[_0x24fc('0x48')]({},_0x5c1a92,_0x8c9649[_0x24fc('0x4a')]);return _0x595c47[_0x24fc('0x55')](_0x5c1a92);}})[_0x24fc('0x4d')](function(_0x4659f9){if(_0x4659f9){_0xdff811=_0x4659f9['length'];if(!_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x41')](_0x24fc('0x42'))){_0x5c1a92[_0x24fc('0x43')]=qs['limit'](_0x8c9649[_0x24fc('0x3a')][_0x24fc('0x43')]);_0x5c1a92['offset']=qs['offset'](_0x8c9649['query'][_0x24fc('0x2b')]);}return _0x595c47[_0x24fc('0x55')](_0x5c1a92);}})[_0x24fc('0x4d')](function(_0x2c6a97){if(_0x2c6a97){return _0x2c6a97?{'count':_0xdff811,'rows':_0x2c6a97}:null;}})[_0x24fc('0x4d')](respondWithResult(_0x50e5b0,null))[_0x24fc('0x26')](handleError(_0x50e5b0,null));};exports['addConfiguration']=function(_0x11bafd,_0x15e8a3,_0x5a2c09){if(_0x11bafd['body']['id']){delete _0x11bafd[_0x24fc('0x54')]['id'];}return db[_0x24fc('0x35')][_0x24fc('0x59')]({'where':{'id':_0x11bafd['params']['id']}})[_0x24fc('0x4d')](handleEntityNotFound(_0x15e8a3,null))[_0x24fc('0x4d')](function(_0x33f04e){if(_0x33f04e){_0x11bafd['body']['AccountId']=_0x33f04e['id'];_0x11bafd['body']['Subjects']=integrations['getSubjects'](_0x11bafd[_0x24fc('0x54')][_0x24fc('0x5a')],_0x11bafd[_0x24fc('0x54')][_0x24fc('0x37')]);_0x11bafd['body'][_0x24fc('0x5b')]=integrations['getDescriptions'](_0x11bafd[_0x24fc('0x54')]['channel'],_0x11bafd[_0x24fc('0x54')][_0x24fc('0x37')]);return db[_0x24fc('0x56')][_0x24fc('0x53')](_0x11bafd[_0x24fc('0x54')],{'include':[{'model':db[_0x24fc('0x5c')],'as':_0x24fc('0x5d')},{'model':db['SalesforceField'],'as':_0x24fc('0x5b')}]});}return null;})[_0x24fc('0x4d')](respondWithResult(_0x15e8a3,null))[_0x24fc('0x26')](handleError(_0x15e8a3,null));};exports['getFields']=function(_0x5201e7,_0x13d4ba,_0x1d80db){var _0x4d4291;var _0x42b972='';var _0x1a2e6d='Task';return db[_0x24fc('0x35')][_0x24fc('0x59')]({'where':{'id':_0x5201e7['params']['id']},'attributes':['id',_0x24fc('0x5e'),_0x24fc('0x5f'),_0x24fc('0x60'),_0x24fc('0x61'),_0x24fc('0x62'),_0x24fc('0x63')]})['then'](handleEntityNotFound(_0x13d4ba,null))['then'](function(_0x35c3ae){if(_0x35c3ae){_0x42b972=_0x35c3ae['remoteUri'];var _0x29bd9f=_0x42b972['slice'](-0x1);if(_0x29bd9f==='/'){_0x42b972=_0x42b972['substring'](0x0,_0x42b972[_0x24fc('0x64')](_0x29bd9f));}_0x4d4291=new jsforce[(_0x24fc('0x65'))]({'oauth2':{'loginUrl':_0x42b972,'clientId':_0x35c3ae[_0x24fc('0x5f')],'clientSecret':_0x35c3ae[_0x24fc('0x60')]}});return _0x4d4291[_0x24fc('0x66')](_0x35c3ae[_0x24fc('0x61')],_0x35c3ae[_0x24fc('0x62')][_0x24fc('0x67')](_0x35c3ae['securityToken']));}})[_0x24fc('0x4d')](function(_0x83cdd1){if(_0x83cdd1){if(!_['isNil'](_0x5201e7['query'][_0x24fc('0x68')])){_0x1a2e6d=_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x68')];}return _0x4d4291[_0x24fc('0x69')](_0x1a2e6d)[_0x24fc('0x6a')]();}})['then'](function(_0x216781){var _0xcb7986=['CallDisposition',_0x24fc('0x6b'),_0x24fc('0x6c'),_0x24fc('0x6d'),'IsArchived',_0x24fc('0x6e'),_0x24fc('0x6f'),_0x24fc('0x70')];if(!_[_0x24fc('0x71')](_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x68')])&&_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x68')]===_0x24fc('0x72')){_0xcb7986=['Type',_0x24fc('0x73'),_0x24fc('0x74'),_0x24fc('0x6f'),'Priority','IsEscalated','SuppliedName',_0x24fc('0x75')];}if(_0x216781){_['remove'](_0x216781[_0x24fc('0x40')],function(_0x44132e){return _0x44132e['custom']===![]&&!_0xcb7986[_0x24fc('0x76')](_0x44132e['name']);});return{'count':_0x216781[_0x24fc('0x40')]['length'],'rows':_[_0x24fc('0x39')](_0x216781[_0x24fc('0x40')],function(_0x1ef6f3){return{'id':_0x1ef6f3[_0x24fc('0x33')],'name':_0x1ef6f3[_0x24fc('0x77')],'custom':_0x1ef6f3[_0x24fc('0x78')],'options':_0x1ef6f3['picklistValues'][_0x24fc('0x57')]>0x0?_[_0x24fc('0x39')](_0x1ef6f3[_0x24fc('0x79')],function(_0x462f38){return{'name':_0x462f38[_0x24fc('0x77')],'value':_0x462f38[_0x24fc('0x7a')]};}):_0x1ef6f3[_0x24fc('0x37')]==_0x24fc('0x7b')?[{'name':_0x24fc('0x7c'),'value':'true'},{'name':_0x24fc('0x7d'),'value':_0x24fc('0x7e')}]:[]};})};}})[_0x24fc('0x4d')](respondWithResult(_0x13d4ba,null))[_0x24fc('0x26')](function(_0x54dc67){var _0xf321e4=_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x7f')]?0x1f4:_0x54dc67['statusCode']||0x1f4;logger[_0x24fc('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xf321e4,JSON['stringify'](_0x54dc67));delete _0x54dc67[_0x24fc('0x33')];if(_0xf321e4===0x191){_0xf321e4=0x190;}_0x13d4ba['status'](_0xf321e4)[_0x24fc('0x34')](_0x5201e7[_0x24fc('0x3a')][_0x24fc('0x7f')]?{'message':_0x24fc('0x80'),'statusCode':_0x54dc67['statusCode']}:_0x54dc67);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 818c235..08a6f6b 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 _0xfe6b=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2af53e,_0x2222e5){var _0x4ed385=function(_0x4a393c){while(--_0x4a393c){_0x2af53e['push'](_0x2af53e['shift']());}};_0x4ed385(++_0x2222e5);}(_0xfe6b,0x10b));var _0xbfe6=function(_0x239a98,_0x288178){_0x239a98=_0x239a98-0x0;var _0x16d789=_0xfe6b[_0x239a98];return _0x16d789;};'use strict';var _=require(_0xbfe6('0x0'));var util=require(_0xbfe6('0x1'));var logger=require(_0xbfe6('0x2'))(_0xbfe6('0x3'));var moment=require('moment');var BPromise=require(_0xbfe6('0x4'));var rp=require(_0xbfe6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfe6('0x6'));var config=require(_0xbfe6('0x7'));var attributes=require(_0xbfe6('0x8'));var integrations=require(_0xbfe6('0x9'));module[_0xbfe6('0xa')]=function(_0x49382f,_0x5996c5){return _0x49382f[_0xbfe6('0xb')](_0xbfe6('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e87=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','lodash','../../config/logger','api','moment'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x6e87,0x6a));var _0x76e8=function(_0x119659,_0x30d2d2){_0x119659=_0x119659-0x0;var _0x209c38=_0x6e87[_0x119659];return _0x209c38;};'use strict';var _=require(_0x76e8('0x0'));var util=require('util');var logger=require(_0x76e8('0x1'))(_0x76e8('0x2'));var moment=require(_0x76e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e8('0x4'));var rimraf=require(_0x76e8('0x5'));var config=require(_0x76e8('0x6'));var attributes=require(_0x76e8('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x76e8('0x8')]=function(_0x701587,_0xc481e8){return _0x701587[_0x76e8('0x9')](_0x76e8('0xa'),attributes,{'tableName':'int_salesforce_accounts','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 f7237ad..63ea352 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 _0x984b=['catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','find','ShowSalesforceAccount','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x45b451,_0x37246a){var _0xaddb69=function(_0x161ce2){while(--_0x161ce2){_0x45b451['push'](_0x45b451['shift']());}};_0xaddb69(++_0x37246a);}(_0x984b,0xee));var _0xb984=function(_0x222197,_0x5f2e94){_0x222197=_0x222197-0x0;var _0x4baa2f=_0x984b[_0x222197];return _0x4baa2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetSalesforceAccount']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetSalesforceAccount',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});};exports['ShowSalesforceAccount']=function(_0x10b9ac){var _0x23ecf6=this;return new Promise(function(_0x58a98c,_0x320bef){return db[_0xb984('0x13')][_0xb984('0x1e')]({'raw':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options'][_0xb984('0x18')]||null:null,'include':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x10b9ac[_0xb984('0x15')]['include'],function(_0x54a293){return{'model':db[_0x54a293[_0xb984('0x1c')]],'as':_0x54a293['as'],'attributes':_0x54a293[_0xb984('0x18')],'include':_0x54a293[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x54a293[_0xb984('0x1a')],function(_0x55dc81){return{'model':db[_0x55dc81[_0xb984('0x1c')]],'as':_0x55dc81['as'],'attributes':_0x55dc81[_0xb984('0x18')],'include':_0x55dc81['include']?_['map'](_0x55dc81[_0xb984('0x1a')],function(_0x4a440d){return{'model':db[_0x4a440d[_0xb984('0x1c')]],'as':_0x4a440d['as'],'attributes':_0x4a440d[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349db9){logger['info'](_0xb984('0x1f'),_0x10b9ac);logger['debug'](_0xb984('0x1f'),_0x10b9ac,JSON['stringify'](_0x349db9));_0x58a98c(_0x349db9);})['catch'](function(_0xf6d925){logger[_0xb984('0xe')]('ShowSalesforceAccount',_0xf6d925[_0xb984('0x10')],_0x10b9ac);_0x320bef(_0x23ecf6[_0xb984('0xe')](0x1f4,_0xf6d925['message']));});});}; \ No newline at end of file +var _0x579c=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4d02bd,_0x4c2dc8){var _0x3e1707=function(_0x21b5e9){while(--_0x21b5e9){_0x4d02bd['push'](_0x4d02bd['shift']());}};_0x3e1707(++_0x4c2dc8);}(_0x579c,0xda));var _0xc579=function(_0x3a161f,_0x43c062){_0x3a161f=_0x3a161f-0x0;var _0x587201=_0x579c[_0x3a161f];return _0x587201;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});}exports[_0xc579('0x18')]=function(_0x33d341){var _0xbbbe3e=this;return new Promise(function(_0x3da8a1,_0xa41248){return db[_0xc579('0x19')]['findAll']({'raw':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1b')]||null:null,'attributes':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'limit':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['limit']||null:null,'include':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x33d341[_0xc579('0x1a')]['include'],function(_0x3634f2){return{'model':db[_0x3634f2[_0xc579('0x1f')]],'as':_0x3634f2['as'],'attributes':_0x3634f2[_0xc579('0x1c')],'include':_0x3634f2['include']?_[_0xc579('0x1e')](_0x3634f2['include'],function(_0x4610c2){return{'model':db[_0x4610c2[_0xc579('0x1f')]],'as':_0x4610c2['as'],'attributes':_0x4610c2[_0xc579('0x1c')],'include':_0x4610c2['include']?_[_0xc579('0x1e')](_0x4610c2['include'],function(_0x532b33){return{'model':db[_0x532b33['model']],'as':_0x532b33['as'],'attributes':_0x532b33[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0xfdbb73){logger[_0xc579('0xe')](_0xc579('0x18'),_0x33d341);logger[_0xc579('0x10')](_0xc579('0x18'),_0x33d341,JSON['stringify'](_0xfdbb73));_0x3da8a1(_0xfdbb73);})['catch'](function(_0x4a5f6){logger['error'](_0xc579('0x18'),_0x4a5f6[_0xc579('0x16')],_0x33d341);_0xa41248(_0xbbbe3e[_0xc579('0x14')](0x1f4,_0x4a5f6[_0xc579('0x16')]));});});};exports[_0xc579('0x20')]=function(_0x156bf5){var _0x45e6a3=this;return new Promise(function(_0x133d08,_0x49b48f){return db[_0xc579('0x19')][_0xc579('0x21')]({'raw':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x156bf5['options']?_0x156bf5[_0xc579('0x1a')]['where']||null:null,'attributes':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'include':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['include']?_[_0xc579('0x1e')](_0x156bf5['options'][_0xc579('0x1d')],function(_0x473000){return{'model':db[_0x473000['model']],'as':_0x473000['as'],'attributes':_0x473000[_0xc579('0x1c')],'include':_0x473000[_0xc579('0x1d')]?_['map'](_0x473000['include'],function(_0x37bce9){return{'model':db[_0x37bce9[_0xc579('0x1f')]],'as':_0x37bce9['as'],'attributes':_0x37bce9['attributes'],'include':_0x37bce9[_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x37bce9['include'],function(_0x32589a){return{'model':db[_0x32589a['model']],'as':_0x32589a['as'],'attributes':_0x32589a[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0x5c6f38){logger[_0xc579('0xe')](_0xc579('0x20'),_0x156bf5);logger[_0xc579('0x10')](_0xc579('0x20'),_0x156bf5,JSON[_0xc579('0x13')](_0x5c6f38));_0x133d08(_0x5c6f38);})[_0xc579('0x17')](function(_0x59ae89){logger[_0xc579('0x14')](_0xc579('0x20'),_0x59ae89['message'],_0x156bf5);_0x49b48f(_0x45e6a3[_0xc579('0x14')](0x1f4,_0x59ae89[_0xc579('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index bde122f..24f9845 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 _0xc517=['getDescriptions','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intSalesforceConfiguration.controller','/:id','show','get','/:id/fields','isAuthenticated','getFields','getSubjects'];(function(_0xfb50f1,_0x4fc983){var _0x205702=function(_0x15da82){while(--_0x15da82){_0xfb50f1['push'](_0xfb50f1['shift']());}};_0x205702(++_0x4fc983);}(_0xc517,0x6a));var _0x7c51=function(_0x14ed50,_0x5eef5c){_0x14ed50=_0x14ed50-0x0;var _0x359b66=_0xc517[_0x14ed50];return _0x359b66;};'use strict';var multer=require('multer');var util=require(_0x7c51('0x0'));var path=require(_0x7c51('0x1'));var timeout=require(_0x7c51('0x2'));var express=require(_0x7c51('0x3'));var router=express[_0x7c51('0x4')]();var auth=require(_0x7c51('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c51('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7c51('0x7'),auth['isAuthenticated'](),controller[_0x7c51('0x8')]);router[_0x7c51('0x9')](_0x7c51('0xa'),auth[_0x7c51('0xb')](),controller[_0x7c51('0xc')]);router['get']('/:id/subjects',auth[_0x7c51('0xb')](),controller[_0x7c51('0xd')]);router[_0x7c51('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x7c51('0xe')]);router[_0x7c51('0xf')]('/',auth[_0x7c51('0xb')](),controller['create']);router['put'](_0x7c51('0x7'),auth[_0x7c51('0xb')](),controller[_0x7c51('0x10')]);router[_0x7c51('0x11')](_0x7c51('0x7'),auth[_0x7c51('0xb')](),controller[_0x7c51('0x12')]);module[_0x7c51('0x13')]=router; \ No newline at end of file +var _0xce2a=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x313dc6,_0x1b0c7b){var _0x4fb745=function(_0x2c77a6){while(--_0x2c77a6){_0x313dc6['push'](_0x313dc6['shift']());}};_0x4fb745(++_0x1b0c7b);}(_0xce2a,0xd5));var _0xace2=function(_0xabebb3,_0x12813a){_0xabebb3=_0xabebb3-0x0;var _0x4cbd35=_0xce2a[_0xabebb3];return _0x4cbd35;};'use strict';var multer=require(_0xace2('0x0'));var util=require('util');var path=require(_0xace2('0x1'));var timeout=require(_0xace2('0x2'));var express=require(_0xace2('0x3'));var router=express[_0xace2('0x4')]();var auth=require(_0xace2('0x5'));var interaction=require(_0xace2('0x6'));var config=require('../../config/environment');var controller=require(_0xace2('0x7'));router[_0xace2('0x8')]('/',auth['isAuthenticated'](),controller[_0xace2('0x9')]);router[_0xace2('0x8')](_0xace2('0xa'),auth[_0xace2('0xb')](),controller['show']);router[_0xace2('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xace2('0x8')]('/:id/subjects',auth[_0xace2('0xb')](),controller[_0xace2('0xc')]);router[_0xace2('0x8')](_0xace2('0xd'),auth[_0xace2('0xb')](),controller[_0xace2('0xe')]);router[_0xace2('0xf')]('/',auth['isAuthenticated'](),controller[_0xace2('0x10')]);router[_0xace2('0x11')]('/:id',auth[_0xace2('0xb')](),controller[_0xace2('0x12')]);router['delete'](_0xace2('0xa'),auth[_0xace2('0xb')](),controller[_0xace2('0x13')]);module[_0xace2('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 1a2b678..0891122 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 _0x38a9=['ENUM','Task','Case','contact_lead','contact','lead','nothing','sequelize','exports','STRING'];(function(_0xc83ec8,_0x543ee2){var _0x263b12=function(_0x4c9670){while(--_0x4c9670){_0xc83ec8['push'](_0xc83ec8['shift']());}};_0x263b12(++_0x543ee2);}(_0x38a9,0x9d));var _0x938a=function(_0x565760,_0x3b3b22){_0x565760=_0x565760-0x0;var _0x1b0ec5=_0x38a9[_0x565760];return _0x1b0ec5;};'use strict';var Sequelize=require(_0x938a('0x0'));module[_0x938a('0x1')]={'name':{'type':Sequelize[_0x938a('0x2')]},'description':{'type':Sequelize[_0x938a('0x2')]},'ticketType':{'type':Sequelize[_0x938a('0x3')](_0x938a('0x4'),_0x938a('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x938a('0x3')](_0x938a('0x6'),_0x938a('0x7'),_0x938a('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x938a('0x3')](_0x938a('0x9'),_0x938a('0x7'),_0x938a('0x8')),'defaultValue':_0x938a('0x8')}}; \ No newline at end of file +var _0x3b03=['STRING','ENUM','Case','Task','contact_lead','contact','lead','nothing','exports'];(function(_0x2073ed,_0x4e8b08){var _0xf8a323=function(_0x5e4228){while(--_0x5e4228){_0x2073ed['push'](_0x2073ed['shift']());}};_0xf8a323(++_0x4e8b08);}(_0x3b03,0x11f));var _0x33b0=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x3b03[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require('sequelize');module[_0x33b0('0x0')]={'name':{'type':Sequelize[_0x33b0('0x1')]},'description':{'type':Sequelize[_0x33b0('0x1')]},'ticketType':{'type':Sequelize[_0x33b0('0x2')]('Task',_0x33b0('0x3')),'defaultValue':_0x33b0('0x4')},'moduleSearch':{'type':Sequelize[_0x33b0('0x2')](_0x33b0('0x5'),_0x33b0('0x6'),_0x33b0('0x7')),'defaultValue':_0x33b0('0x5')},'moduleCreate':{'type':Sequelize[_0x33b0('0x2')](_0x33b0('0x8'),_0x33b0('0x6'),_0x33b0('0x7')),'defaultValue':_0x33b0('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 58be418..8c52f44 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 _0xf2d0=['fast-json-patch','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','keys','intersection','includeAll','options','create','body','update','find','findOne','SalesforceField','order','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x13fe79,_0x29366c){var _0x3c58e9=function(_0x581323){while(--_0x581323){_0x13fe79['push'](_0x13fe79['shift']());}};_0x3c58e9(++_0x29366c);}(_0xf2d0,0x1d2));var _0x0f2d=function(_0x4e05f7,_0x4bc33b){_0x4e05f7=_0x4e05f7-0x0;var _0xc93f86=_0xf2d0[_0x4e05f7];return _0xc93f86;};'use strict';var pdf=require(_0x0f2d('0x0'));var emlformat=require(_0x0f2d('0x1'));var rimraf=require(_0x0f2d('0x2'));var zipdir=require(_0x0f2d('0x3'));var jsonpatch=require(_0x0f2d('0x4'));var rp=require('request-promise');var moment=require(_0x0f2d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f2d('0x6'));var util=require(_0x0f2d('0x7'));var path=require(_0x0f2d('0x8'));var sox=require(_0x0f2d('0x9'));var csv=require('to-csv');var ejs=require(_0x0f2d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0f2d('0xb'));var crypto=require(_0x0f2d('0xc'));var jsforce=require(_0x0f2d('0xd'));var deskjs=require(_0x0f2d('0xe'));var toCsv=require(_0x0f2d('0xf'));var querystring=require(_0x0f2d('0x10'));var Papa=require(_0x0f2d('0x11'));var Redis=require(_0x0f2d('0x12'));var authService=require(_0x0f2d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0f2d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f2d('0x15'))(_0x0f2d('0x16'));var utils=require(_0x0f2d('0x17'));var config=require(_0x0f2d('0x18'));var licenseUtil=require(_0x0f2d('0x19'));var db=require(_0x0f2d('0x1a'))['db'];var jayson=require(_0x0f2d('0x1b'));var client=jayson[_0x0f2d('0x1c')][_0x0f2d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x26b594,_0x5190f9,_0x34ddab,_0x2e3894){return new BPromise(function(_0x197697,_0x47a74a){var _0x230902=_0x2e3894||client;return _0x230902[_0x0f2d('0x1e')](_0x26b594,_0x34ddab)[_0x0f2d('0x1f')](function(_0x1cd6d6){logger[_0x0f2d('0x20')](_0x0f2d('0x21'),_0x5190f9,_0x0f2d('0x22'));logger[_0x0f2d('0x23')](_0x0f2d('0x24'),_0x5190f9,_0x0f2d('0x22'),JSON['stringify'](_0x1cd6d6));if(_0x1cd6d6[_0x0f2d('0x25')]){if(_0x1cd6d6['error'][_0x0f2d('0x26')]===0x1f4){logger[_0x0f2d('0x25')](_0x0f2d('0x21'),_0x5190f9,_0x1cd6d6[_0x0f2d('0x25')][_0x0f2d('0x27')]);return _0x47a74a(_0x1cd6d6[_0x0f2d('0x25')][_0x0f2d('0x27')]);}logger['error'](_0x0f2d('0x21'),_0x5190f9,_0x1cd6d6[_0x0f2d('0x25')][_0x0f2d('0x27')]);return _0x197697(_0x1cd6d6['error']['message']);}else{logger[_0x0f2d('0x20')](_0x0f2d('0x21'),_0x5190f9,_0x0f2d('0x22'));_0x197697(_0x1cd6d6[_0x0f2d('0x28')][_0x0f2d('0x27')]);}})[_0x0f2d('0x29')](function(_0x3c830e){logger[_0x0f2d('0x25')](_0x0f2d('0x21'),_0x5190f9,_0x3c830e);_0x47a74a(_0x3c830e);});});}function respondWithStatusCode(_0x3f4560,_0x38b3e7){_0x38b3e7=_0x38b3e7||0xcc;return function(_0x291d71){if(_0x291d71){return _0x3f4560[_0x0f2d('0x2a')](_0x38b3e7);}return _0x3f4560[_0x0f2d('0x2b')](_0x38b3e7)[_0x0f2d('0x2c')]();};}function respondWithResult(_0x3d56d1,_0x12f1ab){_0x12f1ab=_0x12f1ab||0xc8;return function(_0x55be64){if(_0x55be64){return _0x3d56d1[_0x0f2d('0x2b')](_0x12f1ab)[_0x0f2d('0x2d')](_0x55be64);}};}function respondWithFilteredResult(_0x21db8c,_0x48112c){return function(_0xc3a655){if(_0xc3a655){var _0x33decc=_0xc3a655['count'],_0x335d59=_0x48112c[_0x0f2d('0x2e')],_0x594e85=_0x48112c[_0x0f2d('0x2e')]+_0x48112c[_0x0f2d('0x2f')],_0x4579af;if(_0x594e85>=_0x33decc){_0x594e85=_0x33decc;_0x4579af=0xc8;}else{_0x4579af=0xce;}_0x21db8c[_0x0f2d('0x2b')](_0x4579af);return _0x21db8c[_0x0f2d('0x30')]('Content-Range',_0x335d59+'-'+_0x594e85+'/'+_0x33decc)[_0x0f2d('0x2d')](_0xc3a655);}return null;};}function patchUpdates(_0x2af199){return function(_0x2a0863){try{jsonpatch[_0x0f2d('0x31')](_0x2a0863,_0x2af199,!![]);}catch(_0x193828){return BPromise[_0x0f2d('0x32')](_0x193828);}return _0x2a0863['save']();};}function saveUpdates(_0xe6bba2,_0x238ccd){return function(_0x3b7ab7){if(_0x3b7ab7){return _0x3b7ab7['update'](_0xe6bba2)['then'](function(_0x306db6){return _0x306db6;});}return null;};}function removeEntity(_0x58c5ee,_0xc8c921){return function(_0x3db254){if(_0x3db254){return _0x3db254['destroy']()[_0x0f2d('0x1f')](function(){_0x58c5ee[_0x0f2d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216f57,_0x4391f4){return function(_0x3c1871){if(!_0x3c1871){_0x216f57['sendStatus'](0x194);}return _0x3c1871;};}function handleError(_0x1f1c47,_0x5a8fd1){_0x5a8fd1=_0x5a8fd1||0x1f4;return function(_0xffb214){logger[_0x0f2d('0x25')](_0xffb214['stack']);if(_0xffb214[_0x0f2d('0x33')]){delete _0xffb214[_0x0f2d('0x33')];}_0x1f1c47['status'](_0x5a8fd1)[_0x0f2d('0x34')](_0xffb214);};}exports[_0x0f2d('0x35')]=function(_0x46905b,_0x490d34){var _0x3160f1={},_0x3f9a8={},_0x3b29d9={'count':0x0,'rows':[]};var _0x12e980=_[_0x0f2d('0x36')](db[_0x0f2d('0x37')][_0x0f2d('0x38')],function(_0x4c6c9c){return{'name':_0x4c6c9c[_0x0f2d('0x39')],'type':_0x4c6c9c[_0x0f2d('0x3a')][_0x0f2d('0x3b')]};});_0x3f9a8[_0x0f2d('0x3c')]=_[_0x0f2d('0x36')](_0x12e980,_0x0f2d('0x33'));_0x3f9a8['query']=_['keys'](_0x46905b[_0x0f2d('0x3d')]);_0x3f9a8[_0x0f2d('0x3e')]=_['intersection'](_0x3f9a8[_0x0f2d('0x3c')],_0x3f9a8[_0x0f2d('0x3d')]);_0x3160f1[_0x0f2d('0x3f')]=_['intersection'](_0x3f9a8[_0x0f2d('0x3c')],qs[_0x0f2d('0x40')](_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x3160f1[_0x0f2d('0x3f')]=_0x3160f1[_0x0f2d('0x3f')][_0x0f2d('0x41')]?_0x3160f1['attributes']:_0x3f9a8[_0x0f2d('0x3c')];if(!_0x46905b[_0x0f2d('0x3d')]['hasOwnProperty']('nolimit')){_0x3160f1[_0x0f2d('0x2f')]=qs[_0x0f2d('0x2f')](_0x46905b[_0x0f2d('0x3d')]['limit']);_0x3160f1[_0x0f2d('0x2e')]=qs[_0x0f2d('0x2e')](_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x2e')]);}_0x3160f1['order']=qs[_0x0f2d('0x42')](_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x42')]);_0x3160f1[_0x0f2d('0x43')]=qs[_0x0f2d('0x3e')](_[_0x0f2d('0x44')](_0x46905b[_0x0f2d('0x3d')],_0x3f9a8['filters']),_0x12e980);if(_0x46905b['query'][_0x0f2d('0x45')]){_0x3160f1['where']=_[_0x0f2d('0x46')](_0x3160f1[_0x0f2d('0x43')],{'$or':_[_0x0f2d('0x36')](_0x12e980,function(_0x2db07e){if(_0x2db07e['type']!==_0x0f2d('0x47')){var _0x4a7e92={};_0x4a7e92[_0x2db07e[_0x0f2d('0x33')]]={'$like':'%'+_0x46905b[_0x0f2d('0x3d')][_0x0f2d('0x45')]+'%'};return _0x4a7e92;}})});}_0x3160f1=_[_0x0f2d('0x46')]({},_0x3160f1,_0x46905b['options']);var _0x3dbe24={'where':_0x3160f1[_0x0f2d('0x43')]};return db[_0x0f2d('0x37')][_0x0f2d('0x48')](_0x3dbe24)[_0x0f2d('0x1f')](function(_0x4fc138){_0x3b29d9[_0x0f2d('0x48')]=_0x4fc138;if(_0x46905b[_0x0f2d('0x3d')]['includeAll']){_0x3160f1[_0x0f2d('0x49')]=[{'all':!![]}];}return db[_0x0f2d('0x37')][_0x0f2d('0x4a')](_0x3160f1);})[_0x0f2d('0x1f')](function(_0x14575a){_0x3b29d9[_0x0f2d('0x4b')]=_0x14575a;return _0x3b29d9;})[_0x0f2d('0x1f')](respondWithFilteredResult(_0x490d34,_0x3160f1))[_0x0f2d('0x29')](handleError(_0x490d34,null));};exports[_0x0f2d('0x4c')]=function(_0x136792,_0x3f281c){var _0x57ced4={'raw':![],'where':{'id':_0x136792[_0x0f2d('0x4d')]['id']}},_0x8964d9={};_0x8964d9[_0x0f2d('0x3c')]=_[_0x0f2d('0x4e')](db[_0x0f2d('0x37')][_0x0f2d('0x38')]);_0x8964d9[_0x0f2d('0x3d')]=_['keys'](_0x136792[_0x0f2d('0x3d')]);_0x8964d9[_0x0f2d('0x3e')]=_[_0x0f2d('0x4f')](_0x8964d9[_0x0f2d('0x3c')],_0x8964d9[_0x0f2d('0x3d')]);_0x57ced4[_0x0f2d('0x3f')]=_['intersection'](_0x8964d9[_0x0f2d('0x3c')],qs[_0x0f2d('0x40')](_0x136792[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x57ced4[_0x0f2d('0x3f')]=_0x57ced4[_0x0f2d('0x3f')][_0x0f2d('0x41')]?_0x57ced4[_0x0f2d('0x3f')]:_0x8964d9['model'];if(_0x136792[_0x0f2d('0x3d')][_0x0f2d('0x50')]){_0x57ced4['include']=[{'all':!![]}];}_0x57ced4=_[_0x0f2d('0x46')]({},_0x57ced4,_0x136792[_0x0f2d('0x51')]);return db[_0x0f2d('0x37')]['find'](_0x57ced4)['then'](handleEntityNotFound(_0x3f281c,null))['then'](respondWithResult(_0x3f281c,null))[_0x0f2d('0x29')](handleError(_0x3f281c,null));};exports['create']=function(_0x3d5b7c,_0x490651){return db[_0x0f2d('0x37')][_0x0f2d('0x52')](_0x3d5b7c[_0x0f2d('0x53')],{})[_0x0f2d('0x1f')](respondWithResult(_0x490651,0xc9))[_0x0f2d('0x29')](handleError(_0x490651,null));};exports[_0x0f2d('0x54')]=function(_0x4cc1fa,_0x4ff777){if(_0x4cc1fa[_0x0f2d('0x53')]['id']){delete _0x4cc1fa[_0x0f2d('0x53')]['id'];}return db[_0x0f2d('0x37')]['find']({'where':{'id':_0x4cc1fa[_0x0f2d('0x4d')]['id']}})[_0x0f2d('0x1f')](handleEntityNotFound(_0x4ff777,null))[_0x0f2d('0x1f')](saveUpdates(_0x4cc1fa[_0x0f2d('0x53')],null))[_0x0f2d('0x1f')](respondWithResult(_0x4ff777,null))[_0x0f2d('0x29')](handleError(_0x4ff777,null));};exports['destroy']=function(_0x168403,_0x1e8b02){return db[_0x0f2d('0x37')][_0x0f2d('0x55')]({'where':{'id':_0x168403[_0x0f2d('0x4d')]['id']}})[_0x0f2d('0x1f')](handleEntityNotFound(_0x1e8b02,null))[_0x0f2d('0x1f')](removeEntity(_0x1e8b02,null))['catch'](handleError(_0x1e8b02,null));};exports['getFields']=function(_0x10ebf3,_0x1d7b43,_0x36a3de){var _0x5798c4={};var _0x215c14={};var _0xc90dad;var _0x5a2a26;return db[_0x0f2d('0x37')][_0x0f2d('0x56')]({'where':{'id':_0x10ebf3[_0x0f2d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d7b43,null))[_0x0f2d('0x1f')](function(_0x2b62b2){if(_0x2b62b2){_0xc90dad=_0x2b62b2;_0x215c14[_0x0f2d('0x3c')]=_['keys'](db[_0x0f2d('0x57')]['rawAttributes']);_0x215c14[_0x0f2d('0x3d')]=_[_0x0f2d('0x4e')](_0x10ebf3[_0x0f2d('0x3d')]);_0x215c14[_0x0f2d('0x3e')]=_['intersection'](_0x215c14[_0x0f2d('0x3c')],_0x215c14[_0x0f2d('0x3d')]);_0x5798c4[_0x0f2d('0x3f')]=_['intersection'](_0x215c14['model'],qs['fields'](_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x5798c4['attributes']=_0x5798c4['attributes'][_0x0f2d('0x41')]?_0x5798c4[_0x0f2d('0x3f')]:_0x215c14[_0x0f2d('0x3c')];_0x5798c4[_0x0f2d('0x58')]=qs[_0x0f2d('0x42')](_0x10ebf3[_0x0f2d('0x3d')]['sort']);_0x5798c4[_0x0f2d('0x43')]=qs[_0x0f2d('0x3e')](_[_0x0f2d('0x44')](_0x10ebf3[_0x0f2d('0x3d')],_0x215c14['filters']));if(_0x10ebf3[_0x0f2d('0x3d')]['filter']){_0x5798c4['where']=_[_0x0f2d('0x46')](_0x5798c4[_0x0f2d('0x43')],{'$or':_[_0x0f2d('0x36')](_0x5798c4[_0x0f2d('0x3f')],function(_0x35634d){var _0x5a3a4b={};_0x5a3a4b[_0x35634d]={'$like':'%'+_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x45')]+'%'};return _0x5a3a4b;})});}_0x5798c4=_[_0x0f2d('0x46')]({},_0x5798c4,_0x10ebf3[_0x0f2d('0x51')]);return _0xc90dad[_0x0f2d('0x59')](_0x5798c4);}})['then'](function(_0x159a8e){if(_0x159a8e){_0x5a2a26=_0x159a8e['length'];if(!_0x10ebf3['query'][_0x0f2d('0x5a')](_0x0f2d('0x5b'))){_0x5798c4[_0x0f2d('0x2f')]=qs[_0x0f2d('0x2f')](_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x2f')]);_0x5798c4['offset']=qs[_0x0f2d('0x2e')](_0x10ebf3[_0x0f2d('0x3d')][_0x0f2d('0x2e')]);}return _0xc90dad[_0x0f2d('0x59')](_0x5798c4);}})[_0x0f2d('0x1f')](function(_0x4d12a3){if(_0x4d12a3){return _0x4d12a3?{'count':_0x5a2a26,'rows':_0x4d12a3}:null;}})[_0x0f2d('0x1f')](respondWithResult(_0x1d7b43,null))[_0x0f2d('0x29')](handleError(_0x1d7b43,null));};exports[_0x0f2d('0x5c')]=function(_0x2e83d6,_0x1f857a,_0x8cda7e){var _0x4fbffb={};var _0x23b97e={};var _0x47b0e9;var _0x163ed3;return db[_0x0f2d('0x37')][_0x0f2d('0x56')]({'where':{'id':_0x2e83d6['params']['id']}})['then'](handleEntityNotFound(_0x1f857a,null))['then'](function(_0x1b749c){if(_0x1b749c){_0x47b0e9=_0x1b749c;_0x23b97e[_0x0f2d('0x3c')]=_[_0x0f2d('0x4e')](db[_0x0f2d('0x57')][_0x0f2d('0x38')]);_0x23b97e[_0x0f2d('0x3d')]=_[_0x0f2d('0x4e')](_0x2e83d6['query']);_0x23b97e[_0x0f2d('0x3e')]=_[_0x0f2d('0x4f')](_0x23b97e[_0x0f2d('0x3c')],_0x23b97e[_0x0f2d('0x3d')]);_0x4fbffb[_0x0f2d('0x3f')]=_['intersection'](_0x23b97e[_0x0f2d('0x3c')],qs[_0x0f2d('0x40')](_0x2e83d6[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x4fbffb['attributes']=_0x4fbffb[_0x0f2d('0x3f')][_0x0f2d('0x41')]?_0x4fbffb['attributes']:_0x23b97e['model'];_0x4fbffb[_0x0f2d('0x58')]=qs['sort'](_0x2e83d6[_0x0f2d('0x3d')][_0x0f2d('0x42')]);_0x4fbffb[_0x0f2d('0x43')]=qs[_0x0f2d('0x3e')](_[_0x0f2d('0x44')](_0x2e83d6['query'],_0x23b97e[_0x0f2d('0x3e')]));if(_0x2e83d6['query'][_0x0f2d('0x45')]){_0x4fbffb[_0x0f2d('0x43')]=_[_0x0f2d('0x46')](_0x4fbffb['where'],{'$or':_[_0x0f2d('0x36')](_0x4fbffb[_0x0f2d('0x3f')],function(_0x43bd3e){var _0x462283={};_0x462283[_0x43bd3e]={'$like':'%'+_0x2e83d6['query'][_0x0f2d('0x45')]+'%'};return _0x462283;})});}_0x4fbffb=_['merge']({},_0x4fbffb,_0x2e83d6['options']);return _0x47b0e9[_0x0f2d('0x5c')](_0x4fbffb);}})['then'](function(_0x27161a){if(_0x27161a){_0x163ed3=_0x27161a[_0x0f2d('0x41')];if(!_0x2e83d6['query'][_0x0f2d('0x5a')]('nolimit')){_0x4fbffb[_0x0f2d('0x2f')]=qs['limit'](_0x2e83d6['query'][_0x0f2d('0x2f')]);_0x4fbffb['offset']=qs[_0x0f2d('0x2e')](_0x2e83d6[_0x0f2d('0x3d')][_0x0f2d('0x2e')]);}return _0x47b0e9[_0x0f2d('0x5c')](_0x4fbffb);}})[_0x0f2d('0x1f')](function(_0xec80b){if(_0xec80b){return _0xec80b?{'count':_0x163ed3,'rows':_0xec80b}:null;}})[_0x0f2d('0x1f')](respondWithResult(_0x1f857a,null))[_0x0f2d('0x29')](handleError(_0x1f857a,null));};exports[_0x0f2d('0x5d')]=function(_0x471ef0,_0x187716,_0x659f17){var _0x307334={};var _0x59198c={};var _0x201210;var _0x3f91d8;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x471ef0[_0x0f2d('0x4d')]['id']}})[_0x0f2d('0x1f')](handleEntityNotFound(_0x187716,null))[_0x0f2d('0x1f')](function(_0x346074){if(_0x346074){_0x201210=_0x346074;_0x59198c[_0x0f2d('0x3c')]=_['keys'](db[_0x0f2d('0x57')]['rawAttributes']);_0x59198c[_0x0f2d('0x3d')]=_[_0x0f2d('0x4e')](_0x471ef0[_0x0f2d('0x3d')]);_0x59198c[_0x0f2d('0x3e')]=_[_0x0f2d('0x4f')](_0x59198c['model'],_0x59198c[_0x0f2d('0x3d')]);_0x307334['attributes']=_['intersection'](_0x59198c[_0x0f2d('0x3c')],qs['fields'](_0x471ef0[_0x0f2d('0x3d')][_0x0f2d('0x40')]));_0x307334[_0x0f2d('0x3f')]=_0x307334[_0x0f2d('0x3f')]['length']?_0x307334['attributes']:_0x59198c[_0x0f2d('0x3c')];_0x307334[_0x0f2d('0x58')]=qs[_0x0f2d('0x42')](_0x471ef0['query']['sort']);_0x307334[_0x0f2d('0x43')]=qs['filters'](_[_0x0f2d('0x44')](_0x471ef0[_0x0f2d('0x3d')],_0x59198c[_0x0f2d('0x3e')]));if(_0x471ef0['query'][_0x0f2d('0x45')]){_0x307334[_0x0f2d('0x43')]=_[_0x0f2d('0x46')](_0x307334[_0x0f2d('0x43')],{'$or':_[_0x0f2d('0x36')](_0x307334['attributes'],function(_0x1d9e2e){var _0x50b8d5={};_0x50b8d5[_0x1d9e2e]={'$like':'%'+_0x471ef0[_0x0f2d('0x3d')][_0x0f2d('0x45')]+'%'};return _0x50b8d5;})});}_0x307334=_[_0x0f2d('0x46')]({},_0x307334,_0x471ef0['options']);return _0x201210['getDescriptions'](_0x307334);}})[_0x0f2d('0x1f')](function(_0x4fdff3){if(_0x4fdff3){_0x3f91d8=_0x4fdff3[_0x0f2d('0x41')];if(!_0x471ef0[_0x0f2d('0x3d')][_0x0f2d('0x5a')]('nolimit')){_0x307334['limit']=qs['limit'](_0x471ef0[_0x0f2d('0x3d')]['limit']);_0x307334['offset']=qs['offset'](_0x471ef0['query'][_0x0f2d('0x2e')]);}return _0x201210['getDescriptions'](_0x307334);}})[_0x0f2d('0x1f')](function(_0x3c2ce5){if(_0x3c2ce5){return _0x3c2ce5?{'count':_0x3f91d8,'rows':_0x3c2ce5}:null;}})[_0x0f2d('0x1f')](respondWithResult(_0x187716,null))[_0x0f2d('0x29')](handleError(_0x187716,null));}; \ No newline at end of file +var _0x2a97=['crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','squel'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x2a97,0x165));var _0x72a9=function(_0x79d030,_0x3aa6dc){_0x79d030=_0x79d030-0x0;var _0x8b2bdd=_0x2a97[_0x79d030];return _0x8b2bdd;};'use strict';var pdf=require(_0x72a9('0x0'));var emlformat=require(_0x72a9('0x1'));var rimraf=require(_0x72a9('0x2'));var zipdir=require(_0x72a9('0x3'));var jsonpatch=require(_0x72a9('0x4'));var rp=require(_0x72a9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72a9('0x6'));var path=require(_0x72a9('0x7'));var sox=require(_0x72a9('0x8'));var csv=require('to-csv');var ejs=require(_0x72a9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72a9('0xa'));var crypto=require(_0x72a9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x72a9('0xc'));var toCsv=require(_0x72a9('0xd'));var querystring=require('querystring');var Papa=require(_0x72a9('0xe'));var Redis=require(_0x72a9('0xf'));var authService=require(_0x72a9('0x10'));var qs=require(_0x72a9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a9('0x12'));var logger=require('../../config/logger')(_0x72a9('0x13'));var utils=require(_0x72a9('0x14'));var config=require(_0x72a9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a9('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x72a9('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x137d2c,_0x46feb8,_0x2e120e,_0x24a363){return new BPromise(function(_0x16d7c1,_0x50ff86){var _0x1ded9e=_0x24a363||client;return _0x1ded9e[_0x72a9('0x18')](_0x137d2c,_0x2e120e)[_0x72a9('0x19')](function(_0x3f6446){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x46feb8,'request\x20sent');logger['debug'](_0x72a9('0x1a'),_0x46feb8,_0x72a9('0x1b'),JSON[_0x72a9('0x1c')](_0x3f6446));if(_0x3f6446[_0x72a9('0x1d')]){if(_0x3f6446[_0x72a9('0x1d')][_0x72a9('0x1e')]===0x1f4){logger[_0x72a9('0x1d')](_0x72a9('0x1f'),_0x46feb8,_0x3f6446['error'][_0x72a9('0x20')]);return _0x50ff86(_0x3f6446[_0x72a9('0x1d')][_0x72a9('0x20')]);}logger[_0x72a9('0x1d')](_0x72a9('0x1f'),_0x46feb8,_0x3f6446[_0x72a9('0x1d')][_0x72a9('0x20')]);return _0x16d7c1(_0x3f6446['error'][_0x72a9('0x20')]);}else{logger[_0x72a9('0x21')](_0x72a9('0x1f'),_0x46feb8,_0x72a9('0x1b'));_0x16d7c1(_0x3f6446[_0x72a9('0x22')][_0x72a9('0x20')]);}})['catch'](function(_0x3b8894){logger[_0x72a9('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x46feb8,_0x3b8894);_0x50ff86(_0x3b8894);});});}function respondWithStatusCode(_0x36afca,_0x4990fb){_0x4990fb=_0x4990fb||0xcc;return function(_0x16e192){if(_0x16e192){return _0x36afca[_0x72a9('0x23')](_0x4990fb);}return _0x36afca[_0x72a9('0x24')](_0x4990fb)[_0x72a9('0x25')]();};}function respondWithResult(_0x2c6ec,_0x437f4e){_0x437f4e=_0x437f4e||0xc8;return function(_0x489129){if(_0x489129){return _0x2c6ec[_0x72a9('0x24')](_0x437f4e)['json'](_0x489129);}};}function respondWithFilteredResult(_0x438857,_0x577d9a){return function(_0x2d4b3b){if(_0x2d4b3b){var _0x36e703=_0x2d4b3b[_0x72a9('0x26')],_0x5d0519=_0x577d9a['offset'],_0x262944=_0x577d9a[_0x72a9('0x27')]+_0x577d9a[_0x72a9('0x28')],_0x176fab;if(_0x262944>=_0x36e703){_0x262944=_0x36e703;_0x176fab=0xc8;}else{_0x176fab=0xce;}_0x438857[_0x72a9('0x24')](_0x176fab);return _0x438857[_0x72a9('0x29')](_0x72a9('0x2a'),_0x5d0519+'-'+_0x262944+'/'+_0x36e703)[_0x72a9('0x2b')](_0x2d4b3b);}return null;};}function patchUpdates(_0x32d1ea){return function(_0x321db3){try{jsonpatch[_0x72a9('0x2c')](_0x321db3,_0x32d1ea,!![]);}catch(_0x4b3b37){return BPromise[_0x72a9('0x2d')](_0x4b3b37);}return _0x321db3[_0x72a9('0x2e')]();};}function saveUpdates(_0x3ef085,_0x2129ee){return function(_0x35238e){if(_0x35238e){return _0x35238e[_0x72a9('0x2f')](_0x3ef085)[_0x72a9('0x19')](function(_0xe0d125){return _0xe0d125;});}return null;};}function removeEntity(_0x437217,_0x2121d3){return function(_0x4dbf0e){if(_0x4dbf0e){return _0x4dbf0e[_0x72a9('0x30')]()[_0x72a9('0x19')](function(){_0x437217[_0x72a9('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x924a95,_0xcfb80b){return function(_0x4bcdf6){if(!_0x4bcdf6){_0x924a95[_0x72a9('0x23')](0x194);}return _0x4bcdf6;};}function handleError(_0x52f6f9,_0x3556ed){_0x3556ed=_0x3556ed||0x1f4;return function(_0x3f72ea){logger[_0x72a9('0x1d')](_0x3f72ea[_0x72a9('0x31')]);if(_0x3f72ea[_0x72a9('0x32')]){delete _0x3f72ea[_0x72a9('0x32')];}_0x52f6f9['status'](_0x3556ed)[_0x72a9('0x33')](_0x3f72ea);};}exports[_0x72a9('0x34')]=function(_0x51449f,_0x11b2d0){var _0x523508={},_0x8cf841={},_0x57934e={'count':0x0,'rows':[]};var _0x56627e=_[_0x72a9('0x35')](db[_0x72a9('0x36')]['rawAttributes'],function(_0x2ff44c){return{'name':_0x2ff44c[_0x72a9('0x37')],'type':_0x2ff44c[_0x72a9('0x38')][_0x72a9('0x39')]};});_0x8cf841[_0x72a9('0x3a')]=_[_0x72a9('0x35')](_0x56627e,_0x72a9('0x32'));_0x8cf841[_0x72a9('0x3b')]=_[_0x72a9('0x3c')](_0x51449f[_0x72a9('0x3b')]);_0x8cf841[_0x72a9('0x3d')]=_[_0x72a9('0x3e')](_0x8cf841['model'],_0x8cf841['query']);_0x523508[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0x8cf841['model'],qs[_0x72a9('0x40')](_0x51449f['query'][_0x72a9('0x40')]));_0x523508[_0x72a9('0x3f')]=_0x523508[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x523508['attributes']:_0x8cf841[_0x72a9('0x3a')];if(!_0x51449f[_0x72a9('0x3b')][_0x72a9('0x42')](_0x72a9('0x43'))){_0x523508['limit']=qs[_0x72a9('0x28')](_0x51449f['query'][_0x72a9('0x28')]);_0x523508[_0x72a9('0x27')]=qs[_0x72a9('0x27')](_0x51449f[_0x72a9('0x3b')][_0x72a9('0x27')]);}_0x523508[_0x72a9('0x44')]=qs[_0x72a9('0x45')](_0x51449f[_0x72a9('0x3b')][_0x72a9('0x45')]);_0x523508[_0x72a9('0x46')]=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x51449f[_0x72a9('0x3b')],_0x8cf841[_0x72a9('0x3d')]),_0x56627e);if(_0x51449f[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x523508[_0x72a9('0x46')]=_[_0x72a9('0x49')](_0x523508[_0x72a9('0x46')],{'$or':_[_0x72a9('0x35')](_0x56627e,function(_0x10af27){if(_0x10af27['type']!==_0x72a9('0x4a')){var _0x2803b1={};_0x2803b1[_0x10af27['name']]={'$like':'%'+_0x51449f[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x2803b1;}})});}_0x523508=_[_0x72a9('0x49')]({},_0x523508,_0x51449f['options']);var _0x2e9800={'where':_0x523508[_0x72a9('0x46')]};return db['SalesforceConfiguration']['count'](_0x2e9800)['then'](function(_0x33e324){_0x57934e[_0x72a9('0x26')]=_0x33e324;if(_0x51449f['query'][_0x72a9('0x4b')]){_0x523508[_0x72a9('0x4c')]=[{'all':!![]}];}return db[_0x72a9('0x36')][_0x72a9('0x4d')](_0x523508);})['then'](function(_0x457c57){_0x57934e[_0x72a9('0x4e')]=_0x457c57;return _0x57934e;})[_0x72a9('0x19')](respondWithFilteredResult(_0x11b2d0,_0x523508))[_0x72a9('0x4f')](handleError(_0x11b2d0,null));};exports[_0x72a9('0x50')]=function(_0x4cb68f,_0x571ea1){var _0x75b3b={'raw':![],'where':{'id':_0x4cb68f[_0x72a9('0x51')]['id']}},_0xe071d4={};_0xe071d4[_0x72a9('0x3a')]=_[_0x72a9('0x3c')](db[_0x72a9('0x36')][_0x72a9('0x52')]);_0xe071d4[_0x72a9('0x3b')]=_['keys'](_0x4cb68f[_0x72a9('0x3b')]);_0xe071d4[_0x72a9('0x3d')]=_[_0x72a9('0x3e')](_0xe071d4[_0x72a9('0x3a')],_0xe071d4[_0x72a9('0x3b')]);_0x75b3b[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0xe071d4[_0x72a9('0x3a')],qs[_0x72a9('0x40')](_0x4cb68f[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x75b3b['attributes']=_0x75b3b[_0x72a9('0x3f')]['length']?_0x75b3b['attributes']:_0xe071d4['model'];if(_0x4cb68f[_0x72a9('0x3b')]['includeAll']){_0x75b3b[_0x72a9('0x4c')]=[{'all':!![]}];}_0x75b3b=_[_0x72a9('0x49')]({},_0x75b3b,_0x4cb68f[_0x72a9('0x53')]);return db[_0x72a9('0x36')][_0x72a9('0x54')](_0x75b3b)[_0x72a9('0x19')](handleEntityNotFound(_0x571ea1,null))['then'](respondWithResult(_0x571ea1,null))[_0x72a9('0x4f')](handleError(_0x571ea1,null));};exports['create']=function(_0x2d7b16,_0x549556){return db[_0x72a9('0x36')][_0x72a9('0x55')](_0x2d7b16[_0x72a9('0x56')],{})[_0x72a9('0x19')](respondWithResult(_0x549556,0xc9))['catch'](handleError(_0x549556,null));};exports['update']=function(_0x378d47,_0x12362c){if(_0x378d47[_0x72a9('0x56')]['id']){delete _0x378d47[_0x72a9('0x56')]['id'];}return db[_0x72a9('0x36')][_0x72a9('0x54')]({'where':{'id':_0x378d47[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x12362c,null))[_0x72a9('0x19')](saveUpdates(_0x378d47[_0x72a9('0x56')],null))['then'](respondWithResult(_0x12362c,null))['catch'](handleError(_0x12362c,null));};exports[_0x72a9('0x30')]=function(_0x9bb433,_0x3eb339){return db[_0x72a9('0x36')]['find']({'where':{'id':_0x9bb433[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x3eb339,null))[_0x72a9('0x19')](removeEntity(_0x3eb339,null))['catch'](handleError(_0x3eb339,null));};exports[_0x72a9('0x57')]=function(_0x2e519e,_0x55f60c,_0xe958a4){var _0x1b36ee={};var _0x503f0c={};var _0x24668a;var _0x5aaf1a;return db[_0x72a9('0x36')][_0x72a9('0x58')]({'where':{'id':_0x2e519e['params']['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x55f60c,null))['then'](function(_0x576f2f){if(_0x576f2f){_0x24668a=_0x576f2f;_0x503f0c[_0x72a9('0x3a')]=_['keys'](db[_0x72a9('0x59')]['rawAttributes']);_0x503f0c['query']=_[_0x72a9('0x3c')](_0x2e519e[_0x72a9('0x3b')]);_0x503f0c[_0x72a9('0x3d')]=_['intersection'](_0x503f0c[_0x72a9('0x3a')],_0x503f0c['query']);_0x1b36ee[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0x503f0c[_0x72a9('0x3a')],qs['fields'](_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x1b36ee['attributes']=_0x1b36ee[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x1b36ee['attributes']:_0x503f0c[_0x72a9('0x3a')];_0x1b36ee[_0x72a9('0x44')]=qs[_0x72a9('0x45')](_0x2e519e['query'][_0x72a9('0x45')]);_0x1b36ee[_0x72a9('0x46')]=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x2e519e[_0x72a9('0x3b')],_0x503f0c[_0x72a9('0x3d')]));if(_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x1b36ee[_0x72a9('0x46')]=_[_0x72a9('0x49')](_0x1b36ee['where'],{'$or':_['map'](_0x1b36ee['attributes'],function(_0x54ac2e){var _0x624287={};_0x624287[_0x54ac2e]={'$like':'%'+_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x624287;})});}_0x1b36ee=_[_0x72a9('0x49')]({},_0x1b36ee,_0x2e519e[_0x72a9('0x53')]);return _0x24668a[_0x72a9('0x57')](_0x1b36ee);}})[_0x72a9('0x19')](function(_0x4274a4){if(_0x4274a4){_0x5aaf1a=_0x4274a4[_0x72a9('0x41')];if(!_0x2e519e[_0x72a9('0x3b')]['hasOwnProperty'](_0x72a9('0x43'))){_0x1b36ee[_0x72a9('0x28')]=qs[_0x72a9('0x28')](_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x28')]);_0x1b36ee['offset']=qs['offset'](_0x2e519e[_0x72a9('0x3b')][_0x72a9('0x27')]);}return _0x24668a[_0x72a9('0x57')](_0x1b36ee);}})[_0x72a9('0x19')](function(_0xbe813){if(_0xbe813){return _0xbe813?{'count':_0x5aaf1a,'rows':_0xbe813}:null;}})[_0x72a9('0x19')](respondWithResult(_0x55f60c,null))[_0x72a9('0x4f')](handleError(_0x55f60c,null));};exports[_0x72a9('0x5a')]=function(_0x45d678,_0x2e4b70,_0x41fea1){var _0x24fc30={};var _0x5d2712={};var _0x144479;var _0x4108db;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x45d678[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x2e4b70,null))[_0x72a9('0x19')](function(_0x1470fa){if(_0x1470fa){_0x144479=_0x1470fa;_0x5d2712[_0x72a9('0x3a')]=_[_0x72a9('0x3c')](db['SalesforceField'][_0x72a9('0x52')]);_0x5d2712['query']=_[_0x72a9('0x3c')](_0x45d678[_0x72a9('0x3b')]);_0x5d2712['filters']=_['intersection'](_0x5d2712[_0x72a9('0x3a')],_0x5d2712[_0x72a9('0x3b')]);_0x24fc30[_0x72a9('0x3f')]=_['intersection'](_0x5d2712[_0x72a9('0x3a')],qs[_0x72a9('0x40')](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x24fc30[_0x72a9('0x3f')]=_0x24fc30[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x24fc30['attributes']:_0x5d2712['model'];_0x24fc30[_0x72a9('0x44')]=qs[_0x72a9('0x45')](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x45')]);_0x24fc30['where']=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x45d678[_0x72a9('0x3b')],_0x5d2712['filters']));if(_0x45d678[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x24fc30[_0x72a9('0x46')]=_[_0x72a9('0x49')](_0x24fc30[_0x72a9('0x46')],{'$or':_[_0x72a9('0x35')](_0x24fc30[_0x72a9('0x3f')],function(_0x1d71dd){var _0x4b3eaf={};_0x4b3eaf[_0x1d71dd]={'$like':'%'+_0x45d678[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x4b3eaf;})});}_0x24fc30=_[_0x72a9('0x49')]({},_0x24fc30,_0x45d678[_0x72a9('0x53')]);return _0x144479['getSubjects'](_0x24fc30);}})[_0x72a9('0x19')](function(_0x58fa47){if(_0x58fa47){_0x4108db=_0x58fa47[_0x72a9('0x41')];if(!_0x45d678[_0x72a9('0x3b')][_0x72a9('0x42')]('nolimit')){_0x24fc30[_0x72a9('0x28')]=qs[_0x72a9('0x28')](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x28')]);_0x24fc30[_0x72a9('0x27')]=qs['offset'](_0x45d678[_0x72a9('0x3b')][_0x72a9('0x27')]);}return _0x144479[_0x72a9('0x5a')](_0x24fc30);}})[_0x72a9('0x19')](function(_0x1e4d64){if(_0x1e4d64){return _0x1e4d64?{'count':_0x4108db,'rows':_0x1e4d64}:null;}})[_0x72a9('0x19')](respondWithResult(_0x2e4b70,null))['catch'](handleError(_0x2e4b70,null));};exports[_0x72a9('0x5b')]=function(_0x2343f3,_0x4b762f,_0x436fb8){var _0x89d15f={};var _0x626c89={};var _0x13d459;var _0x418b45;return db[_0x72a9('0x36')]['findOne']({'where':{'id':_0x2343f3[_0x72a9('0x51')]['id']}})[_0x72a9('0x19')](handleEntityNotFound(_0x4b762f,null))[_0x72a9('0x19')](function(_0x5bc904){if(_0x5bc904){_0x13d459=_0x5bc904;_0x626c89[_0x72a9('0x3a')]=_[_0x72a9('0x3c')](db['SalesforceField']['rawAttributes']);_0x626c89[_0x72a9('0x3b')]=_[_0x72a9('0x3c')](_0x2343f3[_0x72a9('0x3b')]);_0x626c89[_0x72a9('0x3d')]=_[_0x72a9('0x3e')](_0x626c89['model'],_0x626c89[_0x72a9('0x3b')]);_0x89d15f[_0x72a9('0x3f')]=_[_0x72a9('0x3e')](_0x626c89[_0x72a9('0x3a')],qs[_0x72a9('0x40')](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x40')]));_0x89d15f[_0x72a9('0x3f')]=_0x89d15f[_0x72a9('0x3f')][_0x72a9('0x41')]?_0x89d15f[_0x72a9('0x3f')]:_0x626c89[_0x72a9('0x3a')];_0x89d15f['order']=qs['sort'](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x45')]);_0x89d15f[_0x72a9('0x46')]=qs[_0x72a9('0x3d')](_[_0x72a9('0x47')](_0x2343f3[_0x72a9('0x3b')],_0x626c89[_0x72a9('0x3d')]));if(_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x48')]){_0x89d15f['where']=_[_0x72a9('0x49')](_0x89d15f[_0x72a9('0x46')],{'$or':_[_0x72a9('0x35')](_0x89d15f['attributes'],function(_0x69a44d){var _0x466a43={};_0x466a43[_0x69a44d]={'$like':'%'+_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x48')]+'%'};return _0x466a43;})});}_0x89d15f=_[_0x72a9('0x49')]({},_0x89d15f,_0x2343f3['options']);return _0x13d459[_0x72a9('0x5b')](_0x89d15f);}})[_0x72a9('0x19')](function(_0xf839f4){if(_0xf839f4){_0x418b45=_0xf839f4[_0x72a9('0x41')];if(!_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x42')]('nolimit')){_0x89d15f['limit']=qs[_0x72a9('0x28')](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x28')]);_0x89d15f['offset']=qs['offset'](_0x2343f3[_0x72a9('0x3b')][_0x72a9('0x27')]);}return _0x13d459[_0x72a9('0x5b')](_0x89d15f);}})[_0x72a9('0x19')](function(_0x26cae5){if(_0x26cae5){return _0x26cae5?{'count':_0x418b45,'rows':_0x26cae5}:null;}})[_0x72a9('0x19')](respondWithResult(_0x4b762f,null))['catch'](handleError(_0x4b762f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e3c57c1..105d0e3 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 _0x7baf=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x4c9783,_0x3e0a34){var _0x3b5f0e=function(_0x403b09){while(--_0x403b09){_0x4c9783['push'](_0x4c9783['shift']());}};_0x3b5f0e(++_0x3e0a34);}(_0x7baf,0xc5));var _0xf7ba=function(_0x3e7868,_0x31e277){_0x3e7868=_0x3e7868-0x0;var _0x12e82a=_0x7baf[_0x3e7868];return _0x12e82a;};'use strict';var _=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var logger=require(_0xf7ba('0x2'))(_0xf7ba('0x3'));var moment=require(_0xf7ba('0x4'));var BPromise=require(_0xf7ba('0x5'));var rp=require(_0xf7ba('0x6'));var fs=require('fs');var path=require(_0xf7ba('0x7'));var rimraf=require(_0xf7ba('0x8'));var config=require(_0xf7ba('0x9'));var attributes=require(_0xf7ba('0xa'));module['exports']=function(_0x69e793,_0x4f213b){return _0x69e793[_0xf7ba('0xb')](_0xf7ba('0xc'),attributes,{'tableName':_0xf7ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3073=['util','../../config/logger','api','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','SalesforceConfiguration'];(function(_0xcb537a,_0x15ca9b){var _0x5dcba0=function(_0x155cfb){while(--_0x155cfb){_0xcb537a['push'](_0xcb537a['shift']());}};_0x5dcba0(++_0x15ca9b);}(_0x3073,0x70));var _0x3307=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x3073[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require('lodash');var util=require(_0x3307('0x0'));var logger=require(_0x3307('0x1'))(_0x3307('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3307('0x3'));var fs=require('fs');var path=require(_0x3307('0x4'));var rimraf=require(_0x3307('0x5'));var config=require('../../config/environment');var attributes=require(_0x3307('0x6'));module['exports']=function(_0x2c195d,_0x2a7cd1){return _0x2c195d['define'](_0x3307('0x7'),attributes,{'tableName':'int_salesforce_configurations','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 09d4410..6e024cb 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 _0x3126=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xc2fdf4,_0x25222f){var _0x3443b7=function(_0x2f5fa5){while(--_0x2f5fa5){_0xc2fdf4['push'](_0xc2fdf4['shift']());}};_0x3443b7(++_0x25222f);}(_0x3126,0x151));var _0x6312=function(_0x1a551e,_0x5e178f){_0x1a551e=_0x1a551e-0x0;var _0x37380e=_0x3126[_0x1a551e];return _0x37380e;};'use strict';var _=require('lodash');var util=require(_0x6312('0x0'));var moment=require(_0x6312('0x1'));var BPromise=require(_0x6312('0x2'));var rs=require(_0x6312('0x3'));var fs=require('fs');var Redis=require(_0x6312('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6312('0x5'));var logger=require(_0x6312('0x6'))(_0x6312('0x7'));var config=require(_0x6312('0x8'));var jayson=require(_0x6312('0x9'));var client=jayson[_0x6312('0xa')][_0x6312('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100539,_0x3504c1,_0x2d2c60){return new BPromise(function(_0x3ad95d,_0x21326e){return client[_0x6312('0xc')](_0x100539,_0x2d2c60)[_0x6312('0xd')](function(_0x211e41){logger[_0x6312('0xe')](_0x6312('0xf'),_0x3504c1,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3504c1,_0x6312('0x10'),JSON[_0x6312('0x11')](_0x211e41));if(_0x211e41[_0x6312('0x12')]){if(_0x211e41[_0x6312('0x12')][_0x6312('0x13')]===0x1f4){logger[_0x6312('0x12')](_0x6312('0xf'),_0x3504c1,_0x211e41[_0x6312('0x12')][_0x6312('0x14')]);return _0x21326e(_0x211e41[_0x6312('0x12')][_0x6312('0x14')]);}logger[_0x6312('0x12')](_0x6312('0xf'),_0x3504c1,_0x211e41[_0x6312('0x12')]['message']);return _0x3ad95d(_0x211e41[_0x6312('0x12')][_0x6312('0x14')]);}else{logger[_0x6312('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3504c1,_0x6312('0x10'));_0x3ad95d(_0x211e41['result'][_0x6312('0x14')]);}})[_0x6312('0x15')](function(_0x3a8569){logger[_0x6312('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3504c1,_0x3a8569);_0x21326e(_0x3a8569);});});} \ No newline at end of file +var _0x1407=['../../config/logger','rpc','jayson/promise','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x18f52c,_0x1c84e6){var _0x506962=function(_0x25c7dc){while(--_0x25c7dc){_0x18f52c['push'](_0x18f52c['shift']());}};_0x506962(++_0x1c84e6);}(_0x1407,0x150));var _0x7140=function(_0x4ddea3,_0x2e161f){_0x4ddea3=_0x4ddea3-0x0;var _0x51ebb0=_0x1407[_0x4ddea3];return _0x51ebb0;};'use strict';var _=require(_0x7140('0x0'));var util=require(_0x7140('0x1'));var moment=require(_0x7140('0x2'));var BPromise=require(_0x7140('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7140('0x4'))(_0x7140('0x5'));var config=require('../../config/environment');var jayson=require(_0x7140('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25823f,_0x18e55f,_0x40ead6){return new BPromise(function(_0x157054,_0x29bf07){return client['request'](_0x25823f,_0x40ead6)[_0x7140('0x7')](function(_0x165a05){logger[_0x7140('0x8')](_0x7140('0x9'),_0x18e55f,_0x7140('0xa'));logger[_0x7140('0xb')](_0x7140('0xc'),_0x18e55f,'request\x20sent',JSON['stringify'](_0x165a05));if(_0x165a05[_0x7140('0xd')]){if(_0x165a05['error']['code']===0x1f4){logger[_0x7140('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18e55f,_0x165a05[_0x7140('0xd')][_0x7140('0xe')]);return _0x29bf07(_0x165a05['error'][_0x7140('0xe')]);}logger[_0x7140('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x18e55f,_0x165a05[_0x7140('0xd')][_0x7140('0xe')]);return _0x157054(_0x165a05['error']['message']);}else{logger[_0x7140('0x8')](_0x7140('0x9'),_0x18e55f,'request\x20sent');_0x157054(_0x165a05[_0x7140('0xf')][_0x7140('0xe')]);}})[_0x7140('0x10')](function(_0x1b2827){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x18e55f,_0x1b2827);_0x29bf07(_0x1b2827);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 10e4463..5d3d970 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 _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','multer'];(function(_0x13f0f9,_0x30f9c9){var _0x5b832c=function(_0x2d3f5e){while(--_0x2d3f5e){_0x13f0f9['push'](_0x13f0f9['shift']());}};_0x5b832c(++_0x30f9c9);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2a5a21,_0x43820b){_0x2a5a21=_0x2a5a21-0x0;var _0x2d99ca=_0xd8fb[_0x2a5a21];return _0x2d99ca;};'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 +var _0x7046=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7046,0x144));var _0x6704=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7046[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var auth=require(_0x6704('0x5'));var interaction=require(_0x6704('0x6'));var config=require('../../config/environment');var controller=require(_0x6704('0x7'));router[_0x6704('0x8')]('/',auth[_0x6704('0x9')](),controller[_0x6704('0xa')]);router[_0x6704('0x8')]('/:id',auth[_0x6704('0x9')](),controller['show']);router['post']('/',auth[_0x6704('0x9')](),controller['create']);router['put'](_0x6704('0xb'),auth[_0x6704('0x9')](),controller[_0x6704('0xc')]);router[_0x6704('0xd')](_0x6704('0xb'),auth[_0x6704('0x9')](),controller[_0x6704('0xe')]);module[_0x6704('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e9c2262..550c99a 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 _0x9bc2=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x1c1f3e,_0x665593){var _0x325903=function(_0x198216){while(--_0x198216){_0x1c1f3e['push'](_0x1c1f3e['shift']());}};_0x325903(++_0x665593);}(_0x9bc2,0x192));var _0x29bc=function(_0x46f00f,_0x3c9ac5){_0x46f00f=_0x46f00f-0x0;var _0x2fd887=_0x9bc2[_0x46f00f];return _0x2fd887;};'use strict';var Sequelize=require(_0x29bc('0x0'));module['exports']={'type':{'type':Sequelize[_0x29bc('0x1')](_0x29bc('0x2'),_0x29bc('0x3'),_0x29bc('0x4'),_0x29bc('0x5')),'defaultValue':_0x29bc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x29bc('0x6')]},'keyType':{'type':Sequelize[_0x29bc('0x1')](_0x29bc('0x2'),_0x29bc('0x3'),_0x29bc('0x4'))},'keyContent':{'type':Sequelize[_0x29bc('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x29bc('0x6')]}}; \ No newline at end of file +var _0x24a3=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x388a79,_0x7ba77c){var _0x2abb28=function(_0x41b511){while(--_0x41b511){_0x388a79['push'](_0x388a79['shift']());}};_0x2abb28(++_0x7ba77c);}(_0x24a3,0xf0));var _0x324a=function(_0x3f58d9,_0x3a770d){_0x3f58d9=_0x3f58d9-0x0;var _0x5d18bb=_0x24a3[_0x3f58d9];return _0x5d18bb;};'use strict';var Sequelize=require(_0x324a('0x0'));module[_0x324a('0x1')]={'type':{'type':Sequelize[_0x324a('0x2')](_0x324a('0x3'),'variable',_0x324a('0x4'),_0x324a('0x5')),'defaultValue':_0x324a('0x3')},'content':{'type':Sequelize[_0x324a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x324a('0x3'),_0x324a('0x7'),_0x324a('0x4'))},'keyContent':{'type':Sequelize[_0x324a('0x6')]},'idField':{'type':Sequelize[_0x324a('0x6')]},'variableName':{'type':Sequelize[_0x324a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 3630921..b9e1e13 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 _0xcbd4=['error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','then','catch','show','params','keys','include','options','create','body','update','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save'];(function(_0x3e2e0c,_0x7d1be4){var _0xb29e66=function(_0x132ac7){while(--_0x132ac7){_0x3e2e0c['push'](_0x3e2e0c['shift']());}};_0xb29e66(++_0x7d1be4);}(_0xcbd4,0xcc));var _0x4cbd=function(_0x3fea6a,_0x5bc1f4){_0x3fea6a=_0x3fea6a-0x0;var _0x54f75d=_0xcbd4[_0x3fea6a];return _0x54f75d;};'use strict';var pdf=require(_0x4cbd('0x0'));var emlformat=require(_0x4cbd('0x1'));var rimraf=require(_0x4cbd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4cbd('0x3'));var rp=require(_0x4cbd('0x4'));var moment=require(_0x4cbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4cbd('0x6'));var util=require(_0x4cbd('0x7'));var path=require(_0x4cbd('0x8'));var sox=require(_0x4cbd('0x9'));var csv=require(_0x4cbd('0xa'));var ejs=require(_0x4cbd('0xb'));var fs=require('fs');var _=require(_0x4cbd('0xc'));var squel=require(_0x4cbd('0xd'));var crypto=require(_0x4cbd('0xe'));var jsforce=require(_0x4cbd('0xf'));var deskjs=require(_0x4cbd('0x10'));var toCsv=require(_0x4cbd('0xa'));var querystring=require(_0x4cbd('0x11'));var Papa=require(_0x4cbd('0x12'));var Redis=require('ioredis');var authService=require(_0x4cbd('0x13'));var qs=require(_0x4cbd('0x14'));var as=require(_0x4cbd('0x15'));var hardwareService=require(_0x4cbd('0x16'));var logger=require('../../config/logger')(_0x4cbd('0x17'));var utils=require(_0x4cbd('0x18'));var config=require(_0x4cbd('0x19'));var licenseUtil=require(_0x4cbd('0x1a'));var db=require(_0x4cbd('0x1b'))['db'];function respondWithStatusCode(_0x2e129f,_0x31776d){_0x31776d=_0x31776d||0xcc;return function(_0x3467af){if(_0x3467af){return _0x2e129f[_0x4cbd('0x1c')](_0x31776d);}return _0x2e129f[_0x4cbd('0x1d')](_0x31776d)[_0x4cbd('0x1e')]();};}function respondWithResult(_0x86290b,_0x5b3146){_0x5b3146=_0x5b3146||0xc8;return function(_0x4fbc2d){if(_0x4fbc2d){return _0x86290b['status'](_0x5b3146)[_0x4cbd('0x1f')](_0x4fbc2d);}};}function respondWithFilteredResult(_0x2f0873,_0x1e6188){return function(_0x1cb03c){if(_0x1cb03c){var _0x5e0477=_0x1cb03c[_0x4cbd('0x20')],_0x1823f7=_0x1e6188[_0x4cbd('0x21')],_0x1dea70=_0x1e6188[_0x4cbd('0x21')]+_0x1e6188['limit'],_0x2ce67c;if(_0x1dea70>=_0x5e0477){_0x1dea70=_0x5e0477;_0x2ce67c=0xc8;}else{_0x2ce67c=0xce;}_0x2f0873[_0x4cbd('0x1d')](_0x2ce67c);return _0x2f0873[_0x4cbd('0x22')](_0x4cbd('0x23'),_0x1823f7+'-'+_0x1dea70+'/'+_0x5e0477)['json'](_0x1cb03c);}return null;};}function patchUpdates(_0x176c77){return function(_0x29f66d){try{jsonpatch[_0x4cbd('0x24')](_0x29f66d,_0x176c77,!![]);}catch(_0x1cb529){return BPromise[_0x4cbd('0x25')](_0x1cb529);}return _0x29f66d[_0x4cbd('0x26')]();};}function saveUpdates(_0x256800,_0x728e3f){return function(_0xc81e73){if(_0xc81e73){return _0xc81e73['update'](_0x256800)['then'](function(_0x26c011){return _0x26c011;});}return null;};}function removeEntity(_0x2ecee9,_0x59069f){return function(_0x2a54a3){if(_0x2a54a3){return _0x2a54a3['destroy']()['then'](function(){_0x2ecee9['status'](0xcc)[_0x4cbd('0x1e')]();});}};}function handleEntityNotFound(_0x45e9c2,_0x10db80){return function(_0x3252b6){if(!_0x3252b6){_0x45e9c2[_0x4cbd('0x1c')](0x194);}return _0x3252b6;};}function handleError(_0x548225,_0x111941){_0x111941=_0x111941||0x1f4;return function(_0x22487c){logger[_0x4cbd('0x27')](_0x22487c[_0x4cbd('0x28')]);if(_0x22487c[_0x4cbd('0x29')]){delete _0x22487c[_0x4cbd('0x29')];}_0x548225[_0x4cbd('0x1d')](_0x111941)[_0x4cbd('0x2a')](_0x22487c);};}exports[_0x4cbd('0x2b')]=function(_0x1ab8cf,_0x2fcaa1){var _0x2a9419={},_0x41ffcb={},_0x50375c={'count':0x0,'rows':[]};var _0xf19c44=_[_0x4cbd('0x2c')](db[_0x4cbd('0x2d')][_0x4cbd('0x2e')],function(_0x44a4be){return{'name':_0x44a4be[_0x4cbd('0x2f')],'type':_0x44a4be[_0x4cbd('0x30')][_0x4cbd('0x31')]};});_0x41ffcb[_0x4cbd('0x32')]=_['map'](_0xf19c44,'name');_0x41ffcb['query']=_['keys'](_0x1ab8cf[_0x4cbd('0x33')]);_0x41ffcb[_0x4cbd('0x34')]=_[_0x4cbd('0x35')](_0x41ffcb[_0x4cbd('0x32')],_0x41ffcb['query']);_0x2a9419[_0x4cbd('0x36')]=_[_0x4cbd('0x35')](_0x41ffcb[_0x4cbd('0x32')],qs[_0x4cbd('0x37')](_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x37')]));_0x2a9419['attributes']=_0x2a9419[_0x4cbd('0x36')][_0x4cbd('0x38')]?_0x2a9419[_0x4cbd('0x36')]:_0x41ffcb[_0x4cbd('0x32')];if(!_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x39')](_0x4cbd('0x3a'))){_0x2a9419[_0x4cbd('0x3b')]=qs['limit'](_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x3b')]);_0x2a9419[_0x4cbd('0x21')]=qs[_0x4cbd('0x21')](_0x1ab8cf['query'][_0x4cbd('0x21')]);}_0x2a9419[_0x4cbd('0x3c')]=qs[_0x4cbd('0x3d')](_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x3d')]);_0x2a9419[_0x4cbd('0x3e')]=qs[_0x4cbd('0x34')](_[_0x4cbd('0x3f')](_0x1ab8cf[_0x4cbd('0x33')],_0x41ffcb[_0x4cbd('0x34')]),_0xf19c44);if(_0x1ab8cf[_0x4cbd('0x33')]['filter']){_0x2a9419[_0x4cbd('0x3e')]=_[_0x4cbd('0x40')](_0x2a9419['where'],{'$or':_[_0x4cbd('0x2c')](_0xf19c44,function(_0x3c2dc3){if(_0x3c2dc3[_0x4cbd('0x30')]!==_0x4cbd('0x41')){var _0x48a6d4={};_0x48a6d4[_0x3c2dc3[_0x4cbd('0x29')]]={'$like':'%'+_0x1ab8cf[_0x4cbd('0x33')][_0x4cbd('0x42')]+'%'};return _0x48a6d4;}})});}_0x2a9419=_[_0x4cbd('0x40')]({},_0x2a9419,_0x1ab8cf['options']);var _0xe64f34={'where':_0x2a9419[_0x4cbd('0x3e')]};return db[_0x4cbd('0x2d')][_0x4cbd('0x20')](_0xe64f34)['then'](function(_0x313ccf){_0x50375c[_0x4cbd('0x20')]=_0x313ccf;if(_0x1ab8cf['query'][_0x4cbd('0x43')]){_0x2a9419['include']=[{'all':!![]}];}return db['SalesforceField'][_0x4cbd('0x44')](_0x2a9419);})[_0x4cbd('0x45')](function(_0x3da8c4){_0x50375c['rows']=_0x3da8c4;return _0x50375c;})[_0x4cbd('0x45')](respondWithFilteredResult(_0x2fcaa1,_0x2a9419))[_0x4cbd('0x46')](handleError(_0x2fcaa1,null));};exports[_0x4cbd('0x47')]=function(_0x264fac,_0x43dfc9){var _0x4bf599={'raw':!![],'where':{'id':_0x264fac[_0x4cbd('0x48')]['id']}},_0x507a4a={};_0x507a4a[_0x4cbd('0x32')]=_[_0x4cbd('0x49')](db[_0x4cbd('0x2d')]['rawAttributes']);_0x507a4a[_0x4cbd('0x33')]=_['keys'](_0x264fac[_0x4cbd('0x33')]);_0x507a4a[_0x4cbd('0x34')]=_[_0x4cbd('0x35')](_0x507a4a['model'],_0x507a4a['query']);_0x4bf599['attributes']=_[_0x4cbd('0x35')](_0x507a4a['model'],qs[_0x4cbd('0x37')](_0x264fac['query'][_0x4cbd('0x37')]));_0x4bf599['attributes']=_0x4bf599['attributes'][_0x4cbd('0x38')]?_0x4bf599[_0x4cbd('0x36')]:_0x507a4a[_0x4cbd('0x32')];if(_0x264fac[_0x4cbd('0x33')][_0x4cbd('0x43')]){_0x4bf599[_0x4cbd('0x4a')]=[{'all':!![]}];}_0x4bf599=_['merge']({},_0x4bf599,_0x264fac[_0x4cbd('0x4b')]);return db[_0x4cbd('0x2d')]['find'](_0x4bf599)[_0x4cbd('0x45')](handleEntityNotFound(_0x43dfc9,null))[_0x4cbd('0x45')](respondWithResult(_0x43dfc9,null))[_0x4cbd('0x46')](handleError(_0x43dfc9,null));};exports[_0x4cbd('0x4c')]=function(_0x4da652,_0xc20cb4){return db[_0x4cbd('0x2d')]['create'](_0x4da652[_0x4cbd('0x4d')],{})[_0x4cbd('0x45')](respondWithResult(_0xc20cb4,0xc9))[_0x4cbd('0x46')](handleError(_0xc20cb4,null));};exports[_0x4cbd('0x4e')]=function(_0x44e346,_0x47c7ec){if(_0x44e346[_0x4cbd('0x4d')]['id']){delete _0x44e346['body']['id'];}return db[_0x4cbd('0x2d')][_0x4cbd('0x4f')]({'where':{'id':_0x44e346[_0x4cbd('0x48')]['id']}})[_0x4cbd('0x45')](handleEntityNotFound(_0x47c7ec,null))[_0x4cbd('0x45')](saveUpdates(_0x44e346[_0x4cbd('0x4d')],null))[_0x4cbd('0x45')](respondWithResult(_0x47c7ec,null))[_0x4cbd('0x46')](handleError(_0x47c7ec,null));};exports[_0x4cbd('0x50')]=function(_0x55ab38,_0x1e5994){return db[_0x4cbd('0x2d')]['find']({'where':{'id':_0x55ab38[_0x4cbd('0x48')]['id']}})[_0x4cbd('0x45')](handleEntityNotFound(_0x1e5994,null))['then'](removeEntity(_0x1e5994,null))[_0x4cbd('0x46')](handleError(_0x1e5994,null));}; \ No newline at end of file +var _0x1f28=['update','then','destroy','sendStatus','error','name','send','index','map','SalesforceField','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','pick','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','count','offset','limit','set','Content-Range','save'];(function(_0xf0f95d,_0x3c8d2b){var _0x2443ab=function(_0xa4fb0b){while(--_0xa4fb0b){_0xf0f95d['push'](_0xf0f95d['shift']());}};_0x2443ab(++_0x3c8d2b);}(_0x1f28,0x1d5));var _0x81f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f28[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x81f2('0x0'));var emlformat=require(_0x81f2('0x1'));var rimraf=require(_0x81f2('0x2'));var zipdir=require(_0x81f2('0x3'));var jsonpatch=require(_0x81f2('0x4'));var rp=require(_0x81f2('0x5'));var moment=require(_0x81f2('0x6'));var BPromise=require(_0x81f2('0x7'));var Mustache=require(_0x81f2('0x8'));var util=require('util');var path=require(_0x81f2('0x9'));var sox=require(_0x81f2('0xa'));var csv=require(_0x81f2('0xb'));var ejs=require(_0x81f2('0xc'));var fs=require('fs');var _=require(_0x81f2('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81f2('0xe'));var deskjs=require(_0x81f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x81f2('0x10'));var Papa=require(_0x81f2('0x11'));var Redis=require(_0x81f2('0x12'));var authService=require(_0x81f2('0x13'));var qs=require(_0x81f2('0x14'));var as=require(_0x81f2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81f2('0x16'))(_0x81f2('0x17'));var utils=require(_0x81f2('0x18'));var config=require(_0x81f2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1031b4,_0x503f36){_0x503f36=_0x503f36||0xcc;return function(_0xf67e7f){if(_0xf67e7f){return _0x1031b4['sendStatus'](_0x503f36);}return _0x1031b4['status'](_0x503f36)[_0x81f2('0x1a')]();};}function respondWithResult(_0x3ffc56,_0x489c8a){_0x489c8a=_0x489c8a||0xc8;return function(_0x3aefb2){if(_0x3aefb2){return _0x3ffc56[_0x81f2('0x1b')](_0x489c8a)[_0x81f2('0x1c')](_0x3aefb2);}};}function respondWithFilteredResult(_0x5d7299,_0xc4caa8){return function(_0x538968){if(_0x538968){var _0x3525c0=_0x538968[_0x81f2('0x1d')],_0x393e2e=_0xc4caa8[_0x81f2('0x1e')],_0x398adf=_0xc4caa8[_0x81f2('0x1e')]+_0xc4caa8[_0x81f2('0x1f')],_0x23f353;if(_0x398adf>=_0x3525c0){_0x398adf=_0x3525c0;_0x23f353=0xc8;}else{_0x23f353=0xce;}_0x5d7299[_0x81f2('0x1b')](_0x23f353);return _0x5d7299[_0x81f2('0x20')](_0x81f2('0x21'),_0x393e2e+'-'+_0x398adf+'/'+_0x3525c0)[_0x81f2('0x1c')](_0x538968);}return null;};}function patchUpdates(_0x55afc1){return function(_0x442df3){try{jsonpatch['apply'](_0x442df3,_0x55afc1,!![]);}catch(_0x983290){return BPromise['reject'](_0x983290);}return _0x442df3[_0x81f2('0x22')]();};}function saveUpdates(_0x200e2f,_0x5acec3){return function(_0x17e09c){if(_0x17e09c){return _0x17e09c[_0x81f2('0x23')](_0x200e2f)[_0x81f2('0x24')](function(_0x28485e){return _0x28485e;});}return null;};}function removeEntity(_0x1755c5,_0x5c28c5){return function(_0x2bfd0d){if(_0x2bfd0d){return _0x2bfd0d[_0x81f2('0x25')]()[_0x81f2('0x24')](function(){_0x1755c5[_0x81f2('0x1b')](0xcc)[_0x81f2('0x1a')]();});}};}function handleEntityNotFound(_0x126c53,_0x35088b){return function(_0x387796){if(!_0x387796){_0x126c53[_0x81f2('0x26')](0x194);}return _0x387796;};}function handleError(_0x598baf,_0x3a0a7e){_0x3a0a7e=_0x3a0a7e||0x1f4;return function(_0xa34bb0){logger[_0x81f2('0x27')](_0xa34bb0['stack']);if(_0xa34bb0[_0x81f2('0x28')]){delete _0xa34bb0[_0x81f2('0x28')];}_0x598baf['status'](_0x3a0a7e)[_0x81f2('0x29')](_0xa34bb0);};}exports[_0x81f2('0x2a')]=function(_0x10b333,_0x5b57c0){var _0x234380={},_0x2009be={},_0x295842={'count':0x0,'rows':[]};var _0x22ae5c=_[_0x81f2('0x2b')](db[_0x81f2('0x2c')]['rawAttributes'],function(_0x556275){return{'name':_0x556275[_0x81f2('0x2d')],'type':_0x556275[_0x81f2('0x2e')][_0x81f2('0x2f')]};});_0x2009be['model']=_[_0x81f2('0x2b')](_0x22ae5c,_0x81f2('0x28'));_0x2009be['query']=_[_0x81f2('0x30')](_0x10b333['query']);_0x2009be[_0x81f2('0x31')]=_[_0x81f2('0x32')](_0x2009be[_0x81f2('0x33')],_0x2009be[_0x81f2('0x34')]);_0x234380[_0x81f2('0x35')]=_[_0x81f2('0x32')](_0x2009be[_0x81f2('0x33')],qs[_0x81f2('0x36')](_0x10b333['query'][_0x81f2('0x36')]));_0x234380['attributes']=_0x234380[_0x81f2('0x35')]['length']?_0x234380['attributes']:_0x2009be[_0x81f2('0x33')];if(!_0x10b333[_0x81f2('0x34')]['hasOwnProperty'](_0x81f2('0x37'))){_0x234380[_0x81f2('0x1f')]=qs['limit'](_0x10b333[_0x81f2('0x34')][_0x81f2('0x1f')]);_0x234380[_0x81f2('0x1e')]=qs['offset'](_0x10b333['query'][_0x81f2('0x1e')]);}_0x234380[_0x81f2('0x38')]=qs[_0x81f2('0x39')](_0x10b333[_0x81f2('0x34')][_0x81f2('0x39')]);_0x234380['where']=qs[_0x81f2('0x31')](_[_0x81f2('0x3a')](_0x10b333[_0x81f2('0x34')],_0x2009be[_0x81f2('0x31')]),_0x22ae5c);if(_0x10b333[_0x81f2('0x34')]['filter']){_0x234380[_0x81f2('0x3b')]=_['merge'](_0x234380[_0x81f2('0x3b')],{'$or':_[_0x81f2('0x2b')](_0x22ae5c,function(_0x35aa2c){if(_0x35aa2c[_0x81f2('0x2e')]!=='VIRTUAL'){var _0x50f5a2={};_0x50f5a2[_0x35aa2c[_0x81f2('0x28')]]={'$like':'%'+_0x10b333['query'][_0x81f2('0x3c')]+'%'};return _0x50f5a2;}})});}_0x234380=_[_0x81f2('0x3d')]({},_0x234380,_0x10b333[_0x81f2('0x3e')]);var _0x24e4f9={'where':_0x234380['where']};return db['SalesforceField']['count'](_0x24e4f9)[_0x81f2('0x24')](function(_0x4ee944){_0x295842[_0x81f2('0x1d')]=_0x4ee944;if(_0x10b333[_0x81f2('0x34')][_0x81f2('0x3f')]){_0x234380['include']=[{'all':!![]}];}return db['SalesforceField'][_0x81f2('0x40')](_0x234380);})[_0x81f2('0x24')](function(_0x330e33){_0x295842[_0x81f2('0x41')]=_0x330e33;return _0x295842;})['then'](respondWithFilteredResult(_0x5b57c0,_0x234380))[_0x81f2('0x42')](handleError(_0x5b57c0,null));};exports[_0x81f2('0x43')]=function(_0x8f7351,_0x8a6007){var _0x1f3176={'raw':!![],'where':{'id':_0x8f7351[_0x81f2('0x44')]['id']}},_0x145759={};_0x145759[_0x81f2('0x33')]=_[_0x81f2('0x30')](db[_0x81f2('0x2c')][_0x81f2('0x45')]);_0x145759[_0x81f2('0x34')]=_[_0x81f2('0x30')](_0x8f7351[_0x81f2('0x34')]);_0x145759[_0x81f2('0x31')]=_['intersection'](_0x145759['model'],_0x145759[_0x81f2('0x34')]);_0x1f3176[_0x81f2('0x35')]=_['intersection'](_0x145759['model'],qs[_0x81f2('0x36')](_0x8f7351[_0x81f2('0x34')][_0x81f2('0x36')]));_0x1f3176['attributes']=_0x1f3176[_0x81f2('0x35')]['length']?_0x1f3176[_0x81f2('0x35')]:_0x145759[_0x81f2('0x33')];if(_0x8f7351[_0x81f2('0x34')][_0x81f2('0x3f')]){_0x1f3176['include']=[{'all':!![]}];}_0x1f3176=_[_0x81f2('0x3d')]({},_0x1f3176,_0x8f7351[_0x81f2('0x3e')]);return db[_0x81f2('0x2c')][_0x81f2('0x46')](_0x1f3176)[_0x81f2('0x24')](handleEntityNotFound(_0x8a6007,null))[_0x81f2('0x24')](respondWithResult(_0x8a6007,null))[_0x81f2('0x42')](handleError(_0x8a6007,null));};exports['create']=function(_0x1af9a4,_0x1269a6){return db['SalesforceField']['create'](_0x1af9a4[_0x81f2('0x47')],{})['then'](respondWithResult(_0x1269a6,0xc9))['catch'](handleError(_0x1269a6,null));};exports[_0x81f2('0x23')]=function(_0x416755,_0x37b5db){if(_0x416755[_0x81f2('0x47')]['id']){delete _0x416755[_0x81f2('0x47')]['id'];}return db[_0x81f2('0x2c')][_0x81f2('0x46')]({'where':{'id':_0x416755[_0x81f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x37b5db,null))[_0x81f2('0x24')](saveUpdates(_0x416755[_0x81f2('0x47')],null))[_0x81f2('0x24')](respondWithResult(_0x37b5db,null))[_0x81f2('0x42')](handleError(_0x37b5db,null));};exports[_0x81f2('0x25')]=function(_0x1d5302,_0x47b015){return db[_0x81f2('0x2c')]['find']({'where':{'id':_0x1d5302[_0x81f2('0x44')]['id']}})[_0x81f2('0x24')](handleEntityNotFound(_0x47b015,null))[_0x81f2('0x24')](removeEntity(_0x47b015,null))[_0x81f2('0x42')](handleError(_0x47b015,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f8a27fb..6501822 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 _0xab5e=['moment','bluebird','request-promise','rimraf','../../config/environment','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0xab5e,0x183));var _0xeab5=function(_0x17ce8a,_0x392cbc){_0x17ce8a=_0x17ce8a-0x0;var _0x475c48=_0xab5e[_0x17ce8a];return _0x475c48;};'use strict';var _=require('lodash');var util=require(_0xeab5('0x0'));var logger=require(_0xeab5('0x1'))(_0xeab5('0x2'));var moment=require(_0xeab5('0x3'));var BPromise=require(_0xeab5('0x4'));var rp=require(_0xeab5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeab5('0x6'));var config=require(_0xeab5('0x7'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x3013fe,_0x5b1c2a){return _0x3013fe[_0xeab5('0x8')]('SalesforceField',attributes,{'tableName':_0xeab5('0x9'),'paranoid':![],'indexes':[{'name':_0xeab5('0xa'),'fields':[_0xeab5('0xb'),_0xeab5('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc57c=['./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc57c,0x9f));var _0xcc57=function(_0x36007e,_0x702816){_0x36007e=_0x36007e-0x0;var _0x397ed6=_0xc57c[_0x36007e];return _0x397ed6;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var logger=require(_0xcc57('0x1'))(_0xcc57('0x2'));var moment=require(_0xcc57('0x3'));var BPromise=require(_0xcc57('0x4'));var rp=require(_0xcc57('0x5'));var fs=require('fs');var path=require(_0xcc57('0x6'));var rimraf=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var attributes=require(_0xcc57('0x9'));module['exports']=function(_0x1d77dd,_0x243766){return _0x1d77dd['define'](_0xcc57('0xa'),attributes,{'tableName':_0xcc57('0xb'),'paranoid':![],'indexes':[{'name':_0xcc57('0xc'),'fields':['idField',_0xcc57('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 76e749e..f1d6245 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 _0xac4a=['SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac4a,0x13f));var _0xaac4=function(_0x45b93a,_0x485e4e){_0x45b93a=_0x45b93a-0x0;var _0x11b2d4=_0xac4a[_0x45b93a];return _0x11b2d4;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('SalesforceField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x48cc06,_0x513ec2){var _0x49991a=function(_0x44c99d){while(--_0x44c99d){_0x48cc06['push'](_0x48cc06['shift']());}};_0x49991a(++_0x513ec2);}(_0x4483,0x1a3));var _0x3448=function(_0x3956a2,_0x4a8d1c){_0x3956a2=_0x3956a2-0x0;var _0xae6aae=_0x4483[_0x3956a2];return _0xae6aae;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 80cc9af..c9566c5 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 _0x719a=['post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields'];(function(_0x51278e,_0x5aeacc){var _0x58d3fa=function(_0xafc4f7){while(--_0xafc4f7){_0x51278e['push'](_0x51278e['shift']());}};_0x58d3fa(++_0x5aeacc);}(_0x719a,0x16d));var _0xa719=function(_0xf074f6,_0x3b2d98){_0xf074f6=_0xf074f6-0x0;var _0x1fc7bc=_0x719a[_0xf074f6];return _0x1fc7bc;};'use strict';var multer=require(_0xa719('0x0'));var util=require(_0xa719('0x1'));var path=require(_0xa719('0x2'));var timeout=require(_0xa719('0x3'));var express=require(_0xa719('0x4'));var router=express[_0xa719('0x5')]();var auth=require(_0xa719('0x6'));var interaction=require(_0xa719('0x7'));var config=require('../../config/environment');var controller=require(_0xa719('0x8'));router[_0xa719('0x9')]('/',auth[_0xa719('0xa')](),controller[_0xa719('0xb')]);router[_0xa719('0x9')]('/:id',auth[_0xa719('0xa')](),controller[_0xa719('0xc')]);router[_0xa719('0x9')](_0xa719('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xa719('0x9')](_0xa719('0xe'),auth[_0xa719('0xa')](),controller['getFields']);router[_0xa719('0xf')]('/',auth[_0xa719('0xa')](),controller[_0xa719('0x10')]);router[_0xa719('0xf')](_0xa719('0xd'),auth[_0xa719('0xa')](),controller['addConfiguration']);router[_0xa719('0x11')](_0xa719('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa719('0x12'),auth[_0xa719('0xa')](),controller['destroy']);module[_0xa719('0x13')]=router; \ No newline at end of file +var _0xe4f9=['multer','connect-timeout','express','../../config/environment','./intServicenowAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x24b77b,_0x2c2091){var _0x5ae5c4=function(_0x545329){while(--_0x545329){_0x24b77b['push'](_0x24b77b['shift']());}};_0x5ae5c4(++_0x2c2091);}(_0xe4f9,0xa8));var _0x9e4f=function(_0x3f7af5,_0x59bdbb){_0x3f7af5=_0x3f7af5-0x0;var _0x5d9ae4=_0xe4f9[_0x3f7af5];return _0x5d9ae4;};'use strict';var multer=require(_0x9e4f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9e4f('0x1'));var express=require(_0x9e4f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9e4f('0x3'));var controller=require(_0x9e4f('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9e4f('0x5')]);router[_0x9e4f('0x6')](_0x9e4f('0x7'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0x9')]);router[_0x9e4f('0x6')](_0x9e4f('0xa'),auth[_0x9e4f('0x8')](),controller['getConfigurations']);router[_0x9e4f('0x6')](_0x9e4f('0xb'),auth['isAuthenticated'](),controller[_0x9e4f('0xc')]);router[_0x9e4f('0xd')]('/',auth[_0x9e4f('0x8')](),controller[_0x9e4f('0xe')]);router[_0x9e4f('0xd')](_0x9e4f('0xa'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0xf')]);router[_0x9e4f('0x10')](_0x9e4f('0x7'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0x11')]);router[_0x9e4f('0x12')](_0x9e4f('0x7'),auth[_0x9e4f('0x8')](),controller[_0x9e4f('0x13')]);module[_0x9e4f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 2e58d45..9518587 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 _0x425f=['exports','STRING','username','remoteUri','sequelize'];(function(_0x4df3c3,_0x2e96ca){var _0x3c3fbc=function(_0x1dcd1c){while(--_0x1dcd1c){_0x4df3c3['push'](_0x4df3c3['shift']());}};_0x3c3fbc(++_0x2e96ca);}(_0x425f,0xb3));var _0xf425=function(_0xe20738,_0x169fce){_0xe20738=_0xe20738-0x0;var _0x1e16da=_0x425f[_0xe20738];return _0x1e16da;};'use strict';var Sequelize=require(_0xf425('0x0'));module[_0xf425('0x1')]={'name':{'type':Sequelize[_0xf425('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf425('0x2')],'unique':_0xf425('0x3')},'password':{'type':Sequelize[_0xf425('0x2')]},'email':{'type':Sequelize[_0xf425('0x2')]},'remoteUri':{'type':Sequelize[_0xf425('0x2')],'unique':_0xf425('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9d33=['exports','STRING','username'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d33,0x105));var _0x39d3=function(_0x5b4fa0,_0x3a244d){_0x5b4fa0=_0x5b4fa0-0x0;var _0x383747=_0x9d33[_0x5b4fa0];return _0x383747;};'use strict';var Sequelize=require('sequelize');module[_0x39d3('0x0')]={'name':{'type':Sequelize[_0x39d3('0x1')]},'description':{'type':Sequelize[_0x39d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x39d3('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x39d3('0x1')]},'remoteUri':{'type':Sequelize[_0x39d3('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 32a26f3..fcfc033 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 _0x45d3=['email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','forEach','concat','stack','test','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','reject','destroy','end','name','send','index','map','ServicenowAccount','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','filter','merge','include','findAll','rows','show','params','length','includeAll','options','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','subcategory','close_code','incident_state','severity','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','knowledge','order','calendar_stc','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','activity_due','comments','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','location','username'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x45d3,0xda));var _0x345d=function(_0x3c3aba,_0x5a8871){_0x3c3aba=_0x3c3aba-0x0;var _0x4ea747=_0x45d3[_0x3c3aba];return _0x4ea747;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x345d('0x0'));var zipdir=require(_0x345d('0x1'));var jsonpatch=require(_0x345d('0x2'));var rp=require('request-promise');var moment=require(_0x345d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x345d('0x4'));var sox=require(_0x345d('0x5'));var csv=require(_0x345d('0x6'));var ejs=require(_0x345d('0x7'));var fs=require('fs');var _=require(_0x345d('0x8'));var squel=require(_0x345d('0x9'));var crypto=require(_0x345d('0xa'));var jsforce=require(_0x345d('0xb'));var deskjs=require(_0x345d('0xc'));var toCsv=require(_0x345d('0x6'));var querystring=require(_0x345d('0xd'));var Papa=require(_0x345d('0xe'));var Redis=require(_0x345d('0xf'));var authService=require(_0x345d('0x10'));var qs=require(_0x345d('0x11'));var as=require(_0x345d('0x12'));var hardwareService=require(_0x345d('0x13'));var logger=require(_0x345d('0x14'))('api');var utils=require(_0x345d('0x15'));var config=require(_0x345d('0x16'));var licenseUtil=require(_0x345d('0x17'));var db=require(_0x345d('0x18'))['db'];var integrations=require(_0x345d('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x345d('0x1a')][_0x345d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x13c0f6,_0x5ba589,_0x3785a5,_0x230e1b){return new BPromise(function(_0x59380f,_0xd38f2e){var _0x1327c2=_0x230e1b||client;return _0x1327c2[_0x345d('0x1c')](_0x13c0f6,_0x3785a5)[_0x345d('0x1d')](function(_0xf72a9f){logger[_0x345d('0x1e')](_0x345d('0x1f'),_0x5ba589,'request\x20sent');logger[_0x345d('0x20')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5ba589,_0x345d('0x21'),JSON['stringify'](_0xf72a9f));if(_0xf72a9f[_0x345d('0x22')]){if(_0xf72a9f[_0x345d('0x22')]['code']===0x1f4){logger[_0x345d('0x22')](_0x345d('0x1f'),_0x5ba589,_0xf72a9f[_0x345d('0x22')][_0x345d('0x23')]);return _0xd38f2e(_0xf72a9f['error']['message']);}logger[_0x345d('0x22')](_0x345d('0x1f'),_0x5ba589,_0xf72a9f[_0x345d('0x22')][_0x345d('0x23')]);return _0x59380f(_0xf72a9f[_0x345d('0x22')]['message']);}else{logger['info'](_0x345d('0x1f'),_0x5ba589,'request\x20sent');_0x59380f(_0xf72a9f[_0x345d('0x24')]['message']);}})[_0x345d('0x25')](function(_0x5d2423){logger[_0x345d('0x22')](_0x345d('0x1f'),_0x5ba589,_0x5d2423);_0xd38f2e(_0x5d2423);});});}function respondWithStatusCode(_0x3e89f5,_0x4e1b1b){_0x4e1b1b=_0x4e1b1b||0xcc;return function(_0x210a12){if(_0x210a12){return _0x3e89f5[_0x345d('0x26')](_0x4e1b1b);}return _0x3e89f5['status'](_0x4e1b1b)['end']();};}function respondWithResult(_0x504dbe,_0x550ab2){_0x550ab2=_0x550ab2||0xc8;return function(_0x5ecb23){if(_0x5ecb23){return _0x504dbe[_0x345d('0x27')](_0x550ab2)[_0x345d('0x28')](_0x5ecb23);}};}function respondWithFilteredResult(_0x1ab420,_0x3c1d83){return function(_0x451f58){if(_0x451f58){var _0x42f368=_0x451f58[_0x345d('0x29')],_0x6205ac=_0x3c1d83[_0x345d('0x2a')],_0x26744a=_0x3c1d83[_0x345d('0x2a')]+_0x3c1d83[_0x345d('0x2b')],_0x1be338;if(_0x26744a>=_0x42f368){_0x26744a=_0x42f368;_0x1be338=0xc8;}else{_0x1be338=0xce;}_0x1ab420[_0x345d('0x27')](_0x1be338);return _0x1ab420[_0x345d('0x2c')]('Content-Range',_0x6205ac+'-'+_0x26744a+'/'+_0x42f368)['json'](_0x451f58);}return null;};}function patchUpdates(_0xdc6f39){return function(_0x33a446){try{jsonpatch['apply'](_0x33a446,_0xdc6f39,!![]);}catch(_0x4c5165){return BPromise[_0x345d('0x2d')](_0x4c5165);}return _0x33a446['save']();};}function saveUpdates(_0x5399ef,_0x32462f){return function(_0x34dc58){if(_0x34dc58){return _0x34dc58['update'](_0x5399ef)[_0x345d('0x1d')](function(_0x13785c){return _0x13785c;});}return null;};}function removeEntity(_0x25511c,_0x54ddff){return function(_0x4ed715){if(_0x4ed715){return _0x4ed715[_0x345d('0x2e')]()[_0x345d('0x1d')](function(){_0x25511c[_0x345d('0x27')](0xcc)[_0x345d('0x2f')]();});}};}function handleEntityNotFound(_0x461e8e,_0x154d5a){return function(_0x22745d){if(!_0x22745d){_0x461e8e[_0x345d('0x26')](0x194);}return _0x22745d;};}function handleError(_0x318aca,_0x4000ac){_0x4000ac=_0x4000ac||0x1f4;return function(_0x41b45f){logger[_0x345d('0x22')](_0x41b45f['stack']);if(_0x41b45f[_0x345d('0x30')]){delete _0x41b45f[_0x345d('0x30')];}_0x318aca[_0x345d('0x27')](_0x4000ac)[_0x345d('0x31')](_0x41b45f);};}exports[_0x345d('0x32')]=function(_0x7ac697,_0x59eff2){var _0x21d9d4={},_0x4f8174={},_0xd7fc99={'count':0x0,'rows':[]};var _0x40f90a=_[_0x345d('0x33')](db[_0x345d('0x34')][_0x345d('0x35')],function(_0x206dad){return{'name':_0x206dad['fieldName'],'type':_0x206dad[_0x345d('0x36')]['key']};});_0x4f8174[_0x345d('0x37')]=_[_0x345d('0x33')](_0x40f90a,_0x345d('0x30'));_0x4f8174['query']=_[_0x345d('0x38')](_0x7ac697['query']);_0x4f8174[_0x345d('0x39')]=_[_0x345d('0x3a')](_0x4f8174['model'],_0x4f8174[_0x345d('0x3b')]);_0x21d9d4[_0x345d('0x3c')]=_[_0x345d('0x3a')](_0x4f8174[_0x345d('0x37')],qs[_0x345d('0x3d')](_0x7ac697[_0x345d('0x3b')][_0x345d('0x3d')]));_0x21d9d4['attributes']=_0x21d9d4[_0x345d('0x3c')]['length']?_0x21d9d4['attributes']:_0x4f8174[_0x345d('0x37')];if(!_0x7ac697[_0x345d('0x3b')]['hasOwnProperty'](_0x345d('0x3e'))){_0x21d9d4['limit']=qs[_0x345d('0x2b')](_0x7ac697[_0x345d('0x3b')][_0x345d('0x2b')]);_0x21d9d4[_0x345d('0x2a')]=qs[_0x345d('0x2a')](_0x7ac697[_0x345d('0x3b')][_0x345d('0x2a')]);}_0x21d9d4['order']=qs[_0x345d('0x3f')](_0x7ac697[_0x345d('0x3b')]['sort']);_0x21d9d4[_0x345d('0x40')]=qs[_0x345d('0x39')](_['pick'](_0x7ac697[_0x345d('0x3b')],_0x4f8174[_0x345d('0x39')]),_0x40f90a);if(_0x7ac697[_0x345d('0x3b')][_0x345d('0x41')]){_0x21d9d4[_0x345d('0x40')]=_[_0x345d('0x42')](_0x21d9d4[_0x345d('0x40')],{'$or':_[_0x345d('0x33')](_0x40f90a,function(_0x446188){if(_0x446188[_0x345d('0x36')]!=='VIRTUAL'){var _0x1a18de={};_0x1a18de[_0x446188[_0x345d('0x30')]]={'$like':'%'+_0x7ac697['query'][_0x345d('0x41')]+'%'};return _0x1a18de;}})});}_0x21d9d4=_[_0x345d('0x42')]({},_0x21d9d4,_0x7ac697['options']);var _0x6bedd0={'where':_0x21d9d4['where']};return db[_0x345d('0x34')]['count'](_0x6bedd0)[_0x345d('0x1d')](function(_0x11f44e){_0xd7fc99['count']=_0x11f44e;if(_0x7ac697[_0x345d('0x3b')]['includeAll']){_0x21d9d4[_0x345d('0x43')]=[{'all':!![]}];}return db[_0x345d('0x34')][_0x345d('0x44')](_0x21d9d4);})[_0x345d('0x1d')](function(_0xf4b3ee){_0xd7fc99[_0x345d('0x45')]=_0xf4b3ee;return _0xd7fc99;})[_0x345d('0x1d')](respondWithFilteredResult(_0x59eff2,_0x21d9d4))[_0x345d('0x25')](handleError(_0x59eff2,null));};exports[_0x345d('0x46')]=function(_0x2f54c5,_0x48da30){var _0x3aa47e={'raw':![],'where':{'id':_0x2f54c5[_0x345d('0x47')]['id']}},_0x7918bf={};_0x7918bf['model']=_[_0x345d('0x38')](db[_0x345d('0x34')][_0x345d('0x35')]);_0x7918bf[_0x345d('0x3b')]=_[_0x345d('0x38')](_0x2f54c5[_0x345d('0x3b')]);_0x7918bf['filters']=_['intersection'](_0x7918bf[_0x345d('0x37')],_0x7918bf[_0x345d('0x3b')]);_0x3aa47e[_0x345d('0x3c')]=_[_0x345d('0x3a')](_0x7918bf[_0x345d('0x37')],qs[_0x345d('0x3d')](_0x2f54c5['query'][_0x345d('0x3d')]));_0x3aa47e['attributes']=_0x3aa47e[_0x345d('0x3c')][_0x345d('0x48')]?_0x3aa47e[_0x345d('0x3c')]:_0x7918bf[_0x345d('0x37')];if(_0x2f54c5[_0x345d('0x3b')][_0x345d('0x49')]){_0x3aa47e[_0x345d('0x43')]=[{'all':!![]}];}_0x3aa47e=_[_0x345d('0x42')]({},_0x3aa47e,_0x2f54c5[_0x345d('0x4a')]);return db[_0x345d('0x34')][_0x345d('0x4b')](_0x3aa47e)['then'](handleEntityNotFound(_0x48da30,null))[_0x345d('0x1d')](respondWithResult(_0x48da30,null))[_0x345d('0x25')](handleError(_0x48da30,null));};exports[_0x345d('0x4c')]=function(_0x1d9357,_0x437611){return db[_0x345d('0x34')][_0x345d('0x4c')](_0x1d9357[_0x345d('0x4d')],{})[_0x345d('0x1d')](respondWithResult(_0x437611,0xc9))[_0x345d('0x25')](handleError(_0x437611,null));};exports[_0x345d('0x4e')]=function(_0x129969,_0x39eed0){if(_0x129969[_0x345d('0x4d')]['id']){delete _0x129969[_0x345d('0x4d')]['id'];}return db[_0x345d('0x34')][_0x345d('0x4b')]({'where':{'id':_0x129969[_0x345d('0x47')]['id']}})['then'](handleEntityNotFound(_0x39eed0,null))[_0x345d('0x1d')](saveUpdates(_0x129969[_0x345d('0x4d')],null))['then'](respondWithResult(_0x39eed0,null))[_0x345d('0x25')](handleError(_0x39eed0,null));};exports[_0x345d('0x2e')]=function(_0x13aa60,_0x3807cf){return db[_0x345d('0x34')][_0x345d('0x4b')]({'where':{'id':_0x13aa60[_0x345d('0x47')]['id']}})[_0x345d('0x1d')](handleEntityNotFound(_0x3807cf,null))[_0x345d('0x1d')](removeEntity(_0x3807cf,null))[_0x345d('0x25')](handleError(_0x3807cf,null));};exports[_0x345d('0x4f')]=function(_0x4157ba,_0x32af0f,_0x2b4bcb){var _0x21956a={};var _0x5b72d4={};var _0x4d2694;var _0x3a9342;return db[_0x345d('0x34')][_0x345d('0x50')]({'where':{'id':_0x4157ba[_0x345d('0x47')]['id']}})['then'](handleEntityNotFound(_0x32af0f,null))[_0x345d('0x1d')](function(_0x4c18e0){if(_0x4c18e0){_0x4d2694=_0x4c18e0;_0x5b72d4[_0x345d('0x37')]=_['keys'](db[_0x345d('0x51')][_0x345d('0x35')]);_0x5b72d4[_0x345d('0x3b')]=_['keys'](_0x4157ba[_0x345d('0x3b')]);_0x5b72d4[_0x345d('0x39')]=_[_0x345d('0x3a')](_0x5b72d4[_0x345d('0x37')],_0x5b72d4['query']);_0x21956a[_0x345d('0x3c')]=_[_0x345d('0x3a')](_0x5b72d4[_0x345d('0x37')],qs[_0x345d('0x3d')](_0x4157ba['query'][_0x345d('0x3d')]));_0x21956a[_0x345d('0x3c')]=_0x21956a['attributes'][_0x345d('0x48')]?_0x21956a[_0x345d('0x3c')]:_0x5b72d4[_0x345d('0x37')];_0x21956a['order']=qs[_0x345d('0x3f')](_0x4157ba['query'][_0x345d('0x3f')]);_0x21956a[_0x345d('0x40')]=qs[_0x345d('0x39')](_[_0x345d('0x52')](_0x4157ba['query'],_0x5b72d4[_0x345d('0x39')]));if(_0x4157ba['query'][_0x345d('0x41')]){_0x21956a[_0x345d('0x40')]=_[_0x345d('0x42')](_0x21956a[_0x345d('0x40')],{'$or':_['map'](_0x21956a[_0x345d('0x3c')],function(_0x58e4eb){var _0x333c65={};_0x333c65[_0x58e4eb]={'$like':'%'+_0x4157ba['query'][_0x345d('0x41')]+'%'};return _0x333c65;})});}_0x21956a=_[_0x345d('0x42')]({},_0x21956a,_0x4157ba[_0x345d('0x4a')]);return _0x4d2694[_0x345d('0x4f')](_0x21956a);}})[_0x345d('0x1d')](function(_0x3a3a8b){if(_0x3a3a8b){_0x3a9342=_0x3a3a8b['length'];if(!_0x4157ba[_0x345d('0x3b')][_0x345d('0x53')](_0x345d('0x3e'))){_0x21956a[_0x345d('0x2b')]=qs['limit'](_0x4157ba[_0x345d('0x3b')]['limit']);_0x21956a[_0x345d('0x2a')]=qs[_0x345d('0x2a')](_0x4157ba[_0x345d('0x3b')][_0x345d('0x2a')]);}return _0x4d2694['getConfigurations'](_0x21956a);}})[_0x345d('0x1d')](function(_0x6fc392){if(_0x6fc392){return _0x6fc392?{'count':_0x3a9342,'rows':_0x6fc392}:null;}})[_0x345d('0x1d')](respondWithResult(_0x32af0f,null))[_0x345d('0x25')](handleError(_0x32af0f,null));};exports['addConfiguration']=function(_0x38cbe8,_0x453c19,_0x3a4f97){if(_0x38cbe8['body']['id']){delete _0x38cbe8[_0x345d('0x4d')]['id'];}return db[_0x345d('0x34')]['findOne']({'where':{'id':_0x38cbe8[_0x345d('0x47')]['id']}})[_0x345d('0x1d')](handleEntityNotFound(_0x453c19,null))['then'](function(_0x46bc57){if(_0x46bc57){_0x38cbe8[_0x345d('0x4d')][_0x345d('0x54')]=_0x46bc57['id'];_0x38cbe8[_0x345d('0x4d')][_0x345d('0x55')]=integrations['getSubjects'](_0x38cbe8[_0x345d('0x4d')][_0x345d('0x56')],_0x38cbe8['body'][_0x345d('0x36')]);_0x38cbe8[_0x345d('0x4d')]['Descriptions']=integrations[_0x345d('0x57')](_0x38cbe8[_0x345d('0x4d')]['channel'],_0x38cbe8[_0x345d('0x4d')][_0x345d('0x36')]);return db['ServicenowConfiguration'][_0x345d('0x4c')](_0x38cbe8['body'],{'include':[{'model':db[_0x345d('0x58')],'as':_0x345d('0x55')},{'model':db[_0x345d('0x58')],'as':_0x345d('0x59')}]});}return null;})['then'](respondWithResult(_0x453c19,null))[_0x345d('0x25')](handleError(_0x453c19,null));};exports[_0x345d('0x5a')]=function(_0x284b11,_0xe67921,_0x161ac4){var _0x3cce70=['made_sla',_0x345d('0x5b'),'knowledge',_0x345d('0x5c'),_0x345d('0x5d'),'notify',_0x345d('0x5e'),_0x345d('0x5f'),'category'];var _0x370a4b=[_0x345d('0x60'),'made_sla',_0x345d('0x61'),_0x345d('0x62'),'upon_reject',_0x345d('0x63'),_0x345d('0x64'),'hold_reason',_0x345d('0x65'),_0x345d('0x66'),_0x345d('0x67'),_0x345d('0x68'),_0x345d('0x69'),'user_input','sys_created_on',_0x345d('0x6a'),_0x345d('0x6b'),_0x345d('0x6c'),_0x345d('0x6d'),_0x345d('0x6e'),_0x345d('0x6f'),'closed_at',_0x345d('0x70'),_0x345d('0x71'),_0x345d('0x72'),_0x345d('0x73'),'work_notes_list',_0x345d('0x74'),'priority',_0x345d('0x75'),'rfc','time_worked',_0x345d('0x76'),_0x345d('0x77'),_0x345d('0x78'),_0x345d('0x79'),_0x345d('0x7a'),_0x345d('0x7b'),_0x345d('0x7c'),'caller_id',_0x345d('0x7d'),_0x345d('0x5c'),_0x345d('0x7e'),_0x345d('0x7f'),'close_code',_0x345d('0x80'),_0x345d('0x81'),'work_start','assignment_group',_0x345d('0x82'),_0x345d('0x83'),_0x345d('0x84'),_0x345d('0x85'),'notify','sys_class_name',_0x345d('0x86'),_0x345d('0x87'),_0x345d('0x88'),_0x345d('0x89'),_0x345d('0x8a'),'contact_type',_0x345d('0x8b'),_0x345d('0x5e'),_0x345d('0x8c'),_0x345d('0x8d'),_0x345d('0x8e'),'reassignment_count',_0x345d('0x8f'),'assigned_to',_0x345d('0x5f'),_0x345d('0x90'),'sla_due',_0x345d('0x91'),_0x345d('0x92'),_0x345d('0x93'),'sys_mod_count','reopen_count',_0x345d('0x94'),_0x345d('0x95'),_0x345d('0x96'),_0x345d('0x97'),_0x345d('0x98'),'category'];var _0x2855a0='';var _0x20f30b='';var _0x3c72d2=[];var _0x171f68='';var _0x464023='';var _0x32d491=[];var _0x1c9454='';var _0x30e722='';var _0x1ba98a={};var _0x2d5158='';return db[_0x345d('0x34')][_0x345d('0x50')]({'where':{'id':_0x284b11[_0x345d('0x47')]['id']},'attributes':['id',_0x345d('0x99'),'password',_0x345d('0x9a'),_0x345d('0x9b'),_0x345d('0x9c')]})[_0x345d('0x1d')](handleEntityNotFound(_0xe67921,null))[_0x345d('0x1d')](function(_0x1accca){if(_0x1accca){_0x2d5158=_0x1accca[_0x345d('0x9b')];var _0x37e06d=_0x2d5158[_0x345d('0x9d')](-0x1);if(_0x37e06d==='/'){_0x2d5158=_0x2d5158[_0x345d('0x9e')](0x0,_0x2d5158[_0x345d('0x9f')](_0x37e06d));}_0x30e722=util['format'](_0x345d('0xa0'),_0x2d5158);_0x1c9454=util[_0x345d('0xa1')]('%s/api/now/table/',_0x2d5158);_0x1ba98a={'user':_0x1accca['username'],'pass':_0x1accca['password']};var _0x1299e8={'method':_0x345d('0xa2'),'uri':_0x30e722+_0x345d('0xa3'),'auth':_0x1ba98a,'json':!![]};return rp(_0x1299e8);}})[_0x345d('0x1d')](function(_0x30ad1e){if(_0x30ad1e[_0x345d('0x24')]['length']>0x0){_0x2855a0=_0x30ad1e[_0x345d('0x24')];}console[_0x345d('0xa4')](_0x345d('0xa5'),_0x2855a0);_0x32d491=[];_0x20f30b=Object[_0x345d('0xa6')]([],_0x2855a0);_[_0x345d('0xa7')](_0x20f30b,function(_0x28a952){return!_0x3cce70[_0x345d('0xa8')](_0x28a952[_0x345d('0x30')]);});_0x20f30b['forEach'](function(_0x266fcd){var _0x2e635d=createFieldObject(_0x1c9454,_0x1ba98a,_0x266fcd[_0x345d('0xa9')],_0x266fcd[_0x345d('0x30')],_0x266fcd[_0x345d('0xaa')],![]);_0x32d491[_0x345d('0xab')](_0x2e635d);});return Promise[_0x345d('0xac')](_0x32d491);})['then'](function(_0x20e269){_0x3c72d2=_0x20e269;_0x171f68=Object[_0x345d('0xa6')]([],_0x2855a0);console[_0x345d('0xa4')](_0x345d('0xad'),_0x2855a0);_[_0x345d('0xa7')](_0x171f68,function(_0x2c7444){return _0x370a4b['includes'](_0x2c7444[_0x345d('0x30')]);});console[_0x345d('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x171f68);_0x32d491=[];_0x171f68[_0x345d('0xae')](function(_0x3aefbd){var _0x466835=createFieldObject(_0x1c9454,_0x1ba98a,_0x3aefbd[_0x345d('0xa9')],_0x3aefbd['name'],_0x3aefbd[_0x345d('0xaa')],!![]);_0x32d491[_0x345d('0xab')](_0x466835);});return Promise[_0x345d('0xac')](_0x32d491);})[_0x345d('0x1d')](function(_0x46e4e0){_0x464023=_0x46e4e0;var _0x260759=_0x3c72d2[_0x345d('0xaf')](_0x464023);return{'count':_0x260759[_0x345d('0x48')],'rows':_0x260759};})[_0x345d('0x1d')](respondWithResult(_0xe67921,null))[_0x345d('0x25')](function(_0x42478b){console['log']('ServiceNow\x20error:\x20'+_0x42478b);var _0x194bf8=_0x284b11[_0x345d('0x3b')]['test']?0x1f4:_0x42478b['statusCode']||0x1f4;logger[_0x345d('0x22')](_0x42478b[_0x345d('0xb0')]);delete _0x42478b[_0x345d('0x30')];if(_0x194bf8===0x191){_0x194bf8=0x190;}_0xe67921['status'](_0x194bf8)['send'](_0x284b11[_0x345d('0x3b')][_0x345d('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x42478b[_0x345d('0xb2')]}:_0x42478b);});};function createFieldObject(_0x10c88a,_0x122af3,_0x829099,_0x3ada3a,_0x55173f,_0x186fc4){return new Promise(function(_0x2410bf,_0x536a17){var _0x14761e={'id':_0x3ada3a,'name':_0x55173f,'custom':_0x186fc4};if(_0x829099===_0x345d('0xb3')){_0x14761e['options']=[{'name':_0x345d('0xb4'),'value':'true'},{'name':_0x345d('0xb5'),'value':_0x345d('0xb6')}];_0x2410bf(_0x14761e);}else{var _0x3134cc={'method':_0x345d('0xa2'),'uri':_0x10c88a+_0x345d('0xb7')+_0x3ada3a,'auth':_0x122af3,'json':!![]};return rp(_0x3134cc)[_0x345d('0x1d')](function(_0x459210){var _0x488b1d=[];if(_0x459210[_0x345d('0x24')][_0x345d('0x48')]>0x0){_0x459210['result'][_0x345d('0xae')](function(_0x13f453){if(_0x13f453[_0x345d('0xb8')]==='false'){var _0x4272d1={'name':_0x13f453['label'],'value':_0x13f453[_0x345d('0xb9')]};_0x488b1d[_0x345d('0xab')](_0x4272d1);}});}_0x14761e[_0x345d('0x4a')]=_0x488b1d;if(_0x14761e[_0x345d('0x4a')][_0x345d('0x48')]>0x0){_0x2410bf(_0x14761e);}else{if(_0x186fc4==![]){_0x2410bf();}else{_0x2410bf(_0x14761e);}}});}});} \ No newline at end of file +var _0xd14e=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','body','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','active','business_service','sys_domain_path','time_worked','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','sys_class_name','closed_by','parent_incident','contact_type','urgency','problem_id','company','reassignment_count','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','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick'];(function(_0x21ec3e,_0x3508a7){var _0x862714=function(_0x5577b8){while(--_0x5577b8){_0x21ec3e['push'](_0x21ec3e['shift']());}};_0x862714(++_0x3508a7);}(_0xd14e,0x76));var _0xed14=function(_0x295163,_0x3bc57a){_0x295163=_0x295163-0x0;var _0x4d5c6e=_0xd14e[_0x295163];return _0x4d5c6e;};'use strict';var pdf=require(_0xed14('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed14('0x1'));var zipdir=require(_0xed14('0x2'));var jsonpatch=require(_0xed14('0x3'));var rp=require(_0xed14('0x4'));var moment=require(_0xed14('0x5'));var BPromise=require(_0xed14('0x6'));var Mustache=require('mustache');var util=require(_0xed14('0x7'));var path=require(_0xed14('0x8'));var sox=require(_0xed14('0x9'));var csv=require(_0xed14('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xed14('0xb'));var squel=require(_0xed14('0xc'));var crypto=require(_0xed14('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed14('0xe'));var Papa=require(_0xed14('0xf'));var Redis=require(_0xed14('0x10'));var authService=require(_0xed14('0x11'));var qs=require(_0xed14('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed14('0x13'));var logger=require('../../config/logger')(_0xed14('0x14'));var utils=require(_0xed14('0x15'));var config=require(_0xed14('0x16'));var licenseUtil=require(_0xed14('0x17'));var db=require(_0xed14('0x18'))['db'];var integrations=require(_0xed14('0x19'));var jayson=require(_0xed14('0x1a'));var client=jayson[_0xed14('0x1b')][_0xed14('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c0438,_0x4f3f64,_0x4d8f27,_0x1ce356){return new BPromise(function(_0x29badd,_0x48092f){var _0x14468e=_0x1ce356||client;return _0x14468e['request'](_0x2c0438,_0x4d8f27)[_0xed14('0x1d')](function(_0x3928ec){logger['info'](_0xed14('0x1e'),_0x4f3f64,_0xed14('0x1f'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4f3f64,'request\x20sent',JSON['stringify'](_0x3928ec));if(_0x3928ec[_0xed14('0x20')]){if(_0x3928ec[_0xed14('0x20')][_0xed14('0x21')]===0x1f4){logger['error'](_0xed14('0x1e'),_0x4f3f64,_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);return _0x48092f(_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);}logger[_0xed14('0x20')](_0xed14('0x1e'),_0x4f3f64,_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);return _0x29badd(_0x3928ec[_0xed14('0x20')][_0xed14('0x22')]);}else{logger[_0xed14('0x23')](_0xed14('0x1e'),_0x4f3f64,_0xed14('0x1f'));_0x29badd(_0x3928ec[_0xed14('0x24')][_0xed14('0x22')]);}})[_0xed14('0x25')](function(_0x173f4f){logger[_0xed14('0x20')](_0xed14('0x1e'),_0x4f3f64,_0x173f4f);_0x48092f(_0x173f4f);});});}function respondWithStatusCode(_0x23a733,_0xacf1d3){_0xacf1d3=_0xacf1d3||0xcc;return function(_0x2775b0){if(_0x2775b0){return _0x23a733[_0xed14('0x26')](_0xacf1d3);}return _0x23a733[_0xed14('0x27')](_0xacf1d3)[_0xed14('0x28')]();};}function respondWithResult(_0x5b728b,_0x5c2345){_0x5c2345=_0x5c2345||0xc8;return function(_0x57e181){if(_0x57e181){return _0x5b728b[_0xed14('0x27')](_0x5c2345)[_0xed14('0x29')](_0x57e181);}};}function respondWithFilteredResult(_0x1cec12,_0x1194b7){return function(_0x5a0086){if(_0x5a0086){var _0x2bcd0a=_0x5a0086[_0xed14('0x2a')],_0x30118c=_0x1194b7['offset'],_0x5631b2=_0x1194b7[_0xed14('0x2b')]+_0x1194b7[_0xed14('0x2c')],_0xdd8e52;if(_0x5631b2>=_0x2bcd0a){_0x5631b2=_0x2bcd0a;_0xdd8e52=0xc8;}else{_0xdd8e52=0xce;}_0x1cec12[_0xed14('0x27')](_0xdd8e52);return _0x1cec12[_0xed14('0x2d')](_0xed14('0x2e'),_0x30118c+'-'+_0x5631b2+'/'+_0x2bcd0a)[_0xed14('0x29')](_0x5a0086);}return null;};}function patchUpdates(_0x3e4b5a){return function(_0x253997){try{jsonpatch[_0xed14('0x2f')](_0x253997,_0x3e4b5a,!![]);}catch(_0x4adf28){return BPromise[_0xed14('0x30')](_0x4adf28);}return _0x253997[_0xed14('0x31')]();};}function saveUpdates(_0x339a32,_0x2426e0){return function(_0x138b08){if(_0x138b08){return _0x138b08[_0xed14('0x32')](_0x339a32)[_0xed14('0x1d')](function(_0x88b7da){return _0x88b7da;});}return null;};}function removeEntity(_0x20fbe5,_0x395a37){return function(_0x3ac06b){if(_0x3ac06b){return _0x3ac06b[_0xed14('0x33')]()[_0xed14('0x1d')](function(){_0x20fbe5[_0xed14('0x27')](0xcc)[_0xed14('0x28')]();});}};}function handleEntityNotFound(_0x307ee3,_0x240927){return function(_0x4a9206){if(!_0x4a9206){_0x307ee3[_0xed14('0x26')](0x194);}return _0x4a9206;};}function handleError(_0x3118b5,_0x196a5d){_0x196a5d=_0x196a5d||0x1f4;return function(_0x435671){logger[_0xed14('0x20')](_0x435671[_0xed14('0x34')]);if(_0x435671[_0xed14('0x35')]){delete _0x435671[_0xed14('0x35')];}_0x3118b5['status'](_0x196a5d)[_0xed14('0x36')](_0x435671);};}exports[_0xed14('0x37')]=function(_0x41a857,_0x7fe7c5){var _0x25ae36={},_0x26feeb={},_0x226abe={'count':0x0,'rows':[]};var _0x5478ea=_[_0xed14('0x38')](db[_0xed14('0x39')][_0xed14('0x3a')],function(_0x2b842d){return{'name':_0x2b842d[_0xed14('0x3b')],'type':_0x2b842d['type']['key']};});_0x26feeb[_0xed14('0x3c')]=_[_0xed14('0x38')](_0x5478ea,'name');_0x26feeb[_0xed14('0x3d')]=_['keys'](_0x41a857[_0xed14('0x3d')]);_0x26feeb[_0xed14('0x3e')]=_['intersection'](_0x26feeb[_0xed14('0x3c')],_0x26feeb[_0xed14('0x3d')]);_0x25ae36[_0xed14('0x3f')]=_[_0xed14('0x40')](_0x26feeb[_0xed14('0x3c')],qs[_0xed14('0x41')](_0x41a857[_0xed14('0x3d')][_0xed14('0x41')]));_0x25ae36[_0xed14('0x3f')]=_0x25ae36[_0xed14('0x3f')][_0xed14('0x42')]?_0x25ae36[_0xed14('0x3f')]:_0x26feeb[_0xed14('0x3c')];if(!_0x41a857[_0xed14('0x3d')]['hasOwnProperty'](_0xed14('0x43'))){_0x25ae36[_0xed14('0x2c')]=qs[_0xed14('0x2c')](_0x41a857[_0xed14('0x3d')][_0xed14('0x2c')]);_0x25ae36['offset']=qs[_0xed14('0x2b')](_0x41a857[_0xed14('0x3d')][_0xed14('0x2b')]);}_0x25ae36[_0xed14('0x44')]=qs[_0xed14('0x45')](_0x41a857['query'][_0xed14('0x45')]);_0x25ae36[_0xed14('0x46')]=qs['filters'](_[_0xed14('0x47')](_0x41a857[_0xed14('0x3d')],_0x26feeb['filters']),_0x5478ea);if(_0x41a857['query'][_0xed14('0x48')]){_0x25ae36[_0xed14('0x46')]=_[_0xed14('0x49')](_0x25ae36[_0xed14('0x46')],{'$or':_['map'](_0x5478ea,function(_0x509f98){if(_0x509f98[_0xed14('0x4a')]!==_0xed14('0x4b')){var _0x2b0623={};_0x2b0623[_0x509f98[_0xed14('0x35')]]={'$like':'%'+_0x41a857[_0xed14('0x3d')][_0xed14('0x48')]+'%'};return _0x2b0623;}})});}_0x25ae36=_['merge']({},_0x25ae36,_0x41a857[_0xed14('0x4c')]);var _0x5d7c1c={'where':_0x25ae36['where']};return db[_0xed14('0x39')]['count'](_0x5d7c1c)[_0xed14('0x1d')](function(_0xab9fcc){_0x226abe[_0xed14('0x2a')]=_0xab9fcc;if(_0x41a857[_0xed14('0x3d')][_0xed14('0x4d')]){_0x25ae36[_0xed14('0x4e')]=[{'all':!![]}];}return db[_0xed14('0x39')][_0xed14('0x4f')](_0x25ae36);})[_0xed14('0x1d')](function(_0x343603){_0x226abe[_0xed14('0x50')]=_0x343603;return _0x226abe;})[_0xed14('0x1d')](respondWithFilteredResult(_0x7fe7c5,_0x25ae36))[_0xed14('0x25')](handleError(_0x7fe7c5,null));};exports[_0xed14('0x51')]=function(_0xac91c2,_0x2bf94d){var _0x134217={'raw':![],'where':{'id':_0xac91c2[_0xed14('0x52')]['id']}},_0x56d994={};_0x56d994[_0xed14('0x3c')]=_[_0xed14('0x53')](db[_0xed14('0x39')][_0xed14('0x3a')]);_0x56d994['query']=_[_0xed14('0x53')](_0xac91c2[_0xed14('0x3d')]);_0x56d994[_0xed14('0x3e')]=_['intersection'](_0x56d994[_0xed14('0x3c')],_0x56d994['query']);_0x134217[_0xed14('0x3f')]=_[_0xed14('0x40')](_0x56d994[_0xed14('0x3c')],qs[_0xed14('0x41')](_0xac91c2[_0xed14('0x3d')]['fields']));_0x134217[_0xed14('0x3f')]=_0x134217[_0xed14('0x3f')][_0xed14('0x42')]?_0x134217['attributes']:_0x56d994[_0xed14('0x3c')];if(_0xac91c2['query']['includeAll']){_0x134217[_0xed14('0x4e')]=[{'all':!![]}];}_0x134217=_['merge']({},_0x134217,_0xac91c2[_0xed14('0x4c')]);return db[_0xed14('0x39')]['find'](_0x134217)['then'](handleEntityNotFound(_0x2bf94d,null))[_0xed14('0x1d')](respondWithResult(_0x2bf94d,null))[_0xed14('0x25')](handleError(_0x2bf94d,null));};exports['create']=function(_0x1da986,_0x163d09){return db[_0xed14('0x39')]['create'](_0x1da986[_0xed14('0x54')],{})[_0xed14('0x1d')](respondWithResult(_0x163d09,0xc9))[_0xed14('0x25')](handleError(_0x163d09,null));};exports[_0xed14('0x32')]=function(_0x160c6e,_0x354471){if(_0x160c6e[_0xed14('0x54')]['id']){delete _0x160c6e[_0xed14('0x54')]['id'];}return db['ServicenowAccount'][_0xed14('0x55')]({'where':{'id':_0x160c6e[_0xed14('0x52')]['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x354471,null))['then'](saveUpdates(_0x160c6e[_0xed14('0x54')],null))['then'](respondWithResult(_0x354471,null))[_0xed14('0x25')](handleError(_0x354471,null));};exports[_0xed14('0x33')]=function(_0x576566,_0x40d2a0){return db[_0xed14('0x39')][_0xed14('0x55')]({'where':{'id':_0x576566['params']['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x40d2a0,null))[_0xed14('0x1d')](removeEntity(_0x40d2a0,null))[_0xed14('0x25')](handleError(_0x40d2a0,null));};exports[_0xed14('0x56')]=function(_0x1dd1c1,_0x3d3b92,_0x4772d5){var _0x5ec60d={};var _0x421180={};var _0x1c4609;var _0x2423aa;return db[_0xed14('0x39')][_0xed14('0x57')]({'where':{'id':_0x1dd1c1[_0xed14('0x52')]['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x3d3b92,null))[_0xed14('0x1d')](function(_0x3c536b){if(_0x3c536b){_0x1c4609=_0x3c536b;_0x421180[_0xed14('0x3c')]=_[_0xed14('0x53')](db[_0xed14('0x58')][_0xed14('0x3a')]);_0x421180['query']=_['keys'](_0x1dd1c1[_0xed14('0x3d')]);_0x421180['filters']=_[_0xed14('0x40')](_0x421180[_0xed14('0x3c')],_0x421180[_0xed14('0x3d')]);_0x5ec60d['attributes']=_['intersection'](_0x421180[_0xed14('0x3c')],qs[_0xed14('0x41')](_0x1dd1c1['query']['fields']));_0x5ec60d[_0xed14('0x3f')]=_0x5ec60d[_0xed14('0x3f')][_0xed14('0x42')]?_0x5ec60d[_0xed14('0x3f')]:_0x421180['model'];_0x5ec60d[_0xed14('0x44')]=qs[_0xed14('0x45')](_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x45')]);_0x5ec60d['where']=qs[_0xed14('0x3e')](_[_0xed14('0x47')](_0x1dd1c1[_0xed14('0x3d')],_0x421180[_0xed14('0x3e')]));if(_0x1dd1c1['query'][_0xed14('0x48')]){_0x5ec60d[_0xed14('0x46')]=_[_0xed14('0x49')](_0x5ec60d['where'],{'$or':_[_0xed14('0x38')](_0x5ec60d[_0xed14('0x3f')],function(_0x3fc5a6){var _0x1b82ed={};_0x1b82ed[_0x3fc5a6]={'$like':'%'+_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x48')]+'%'};return _0x1b82ed;})});}_0x5ec60d=_[_0xed14('0x49')]({},_0x5ec60d,_0x1dd1c1[_0xed14('0x4c')]);return _0x1c4609[_0xed14('0x56')](_0x5ec60d);}})[_0xed14('0x1d')](function(_0x4db1b7){if(_0x4db1b7){_0x2423aa=_0x4db1b7[_0xed14('0x42')];if(!_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x59')](_0xed14('0x43'))){_0x5ec60d[_0xed14('0x2c')]=qs[_0xed14('0x2c')](_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x2c')]);_0x5ec60d[_0xed14('0x2b')]=qs[_0xed14('0x2b')](_0x1dd1c1[_0xed14('0x3d')][_0xed14('0x2b')]);}return _0x1c4609[_0xed14('0x56')](_0x5ec60d);}})[_0xed14('0x1d')](function(_0xbd890){if(_0xbd890){return _0xbd890?{'count':_0x2423aa,'rows':_0xbd890}:null;}})['then'](respondWithResult(_0x3d3b92,null))[_0xed14('0x25')](handleError(_0x3d3b92,null));};exports[_0xed14('0x5a')]=function(_0x34f231,_0x487dd9,_0x2ecaf5){if(_0x34f231[_0xed14('0x54')]['id']){delete _0x34f231[_0xed14('0x54')]['id'];}return db[_0xed14('0x39')][_0xed14('0x57')]({'where':{'id':_0x34f231['params']['id']}})[_0xed14('0x1d')](handleEntityNotFound(_0x487dd9,null))[_0xed14('0x1d')](function(_0x3a7646){if(_0x3a7646){_0x34f231['body'][_0xed14('0x5b')]=_0x3a7646['id'];_0x34f231[_0xed14('0x54')]['Subjects']=integrations['getSubjects'](_0x34f231[_0xed14('0x54')][_0xed14('0x5c')],_0x34f231[_0xed14('0x54')][_0xed14('0x4a')]);_0x34f231['body'][_0xed14('0x5d')]=integrations[_0xed14('0x5e')](_0x34f231[_0xed14('0x54')]['channel'],_0x34f231[_0xed14('0x54')]['type']);return db[_0xed14('0x58')]['create'](_0x34f231['body'],{'include':[{'model':db[_0xed14('0x5f')],'as':_0xed14('0x60')},{'model':db[_0xed14('0x5f')],'as':_0xed14('0x5d')}]});}return null;})[_0xed14('0x1d')](respondWithResult(_0x487dd9,null))[_0xed14('0x25')](handleError(_0x487dd9,null));};exports[_0xed14('0x61')]=function(_0x3baa99,_0x389880,_0x1642f5){var _0x215cd1=[_0xed14('0x62'),'hold_reason',_0xed14('0x63'),_0xed14('0x64'),_0xed14('0x65'),_0xed14('0x66'),_0xed14('0x67'),_0xed14('0x68'),_0xed14('0x69')];var _0x44ed8f=[_0xed14('0x6a'),'made_sla',_0xed14('0x6b'),'watch_list',_0xed14('0x6c'),_0xed14('0x6d'),_0xed14('0x6e'),_0xed14('0x6f'),'approval_history','number',_0xed14('0x70'),_0xed14('0x71'),_0xed14('0x72'),'user_input',_0xed14('0x73'),_0xed14('0x74'),_0xed14('0x75'),_0xed14('0x76'),_0xed14('0x63'),_0xed14('0x44'),'calendar_stc','closed_at',_0xed14('0x77'),_0xed14('0x78'),'impact',_0xed14('0x79'),'work_notes_list',_0xed14('0x7a'),'priority',_0xed14('0x7b'),'rfc',_0xed14('0x7c'),'expected_start','opened_at','business_duration','group_list','work_end',_0xed14('0x7d'),_0xed14('0x7e'),_0xed14('0x7f'),_0xed14('0x80'),'subcategory',_0xed14('0x81'),'short_description',_0xed14('0x65'),_0xed14('0x82'),_0xed14('0x83'),_0xed14('0x84'),_0xed14('0x85'),'business_stc',_0xed14('0x86'),_0xed14('0x87'),'calendar_duration',_0xed14('0x66'),_0xed14('0x88'),'close_notes',_0xed14('0x89'),'follow_up',_0xed14('0x8a'),'sys_id',_0xed14('0x8b'),'reopened_by','incident_state',_0xed14('0x8c'),_0xed14('0x8d'),_0xed14('0x8e'),_0xed14('0x8f'),'activity_due',_0xed14('0x90'),_0xed14('0x68'),_0xed14('0x91'),_0xed14('0x92'),_0xed14('0x93'),_0xed14('0x94'),_0xed14('0x95'),_0xed14('0x96'),_0xed14('0x97'),'sys_tags',_0xed14('0x98'),_0xed14('0x99'),'correlation_id',_0xed14('0x9a'),'category'];var _0x29da48='';var _0x474477='';var _0x351452=[];var _0x53ab48='';var _0x42b071='';var _0x471c04=[];var _0x4924d8='';var _0x3ab240='';var _0x147e53={};var _0x76f9b1='';return db['ServicenowAccount'][_0xed14('0x57')]({'where':{'id':_0x3baa99[_0xed14('0x52')]['id']},'attributes':['id',_0xed14('0x9b'),_0xed14('0x9c'),_0xed14('0x9d'),_0xed14('0x9e'),_0xed14('0x9f')]})[_0xed14('0x1d')](handleEntityNotFound(_0x389880,null))['then'](function(_0x27d30d){if(_0x27d30d){_0x76f9b1=_0x27d30d['remoteUri'];var _0x4f435c=_0x76f9b1['slice'](-0x1);if(_0x4f435c==='/'){_0x76f9b1=_0x76f9b1[_0xed14('0xa0')](0x0,_0x76f9b1[_0xed14('0xa1')](_0x4f435c));}_0x3ab240=util[_0xed14('0xa2')](_0xed14('0xa3'),_0x76f9b1);_0x4924d8=util[_0xed14('0xa2')](_0xed14('0xa4'),_0x76f9b1);_0x147e53={'user':_0x27d30d[_0xed14('0x9b')],'pass':_0x27d30d[_0xed14('0x9c')]};var _0x22c451={'method':_0xed14('0xa5'),'uri':_0x3ab240+_0xed14('0xa6'),'auth':_0x147e53,'json':!![]};return rp(_0x22c451);}})[_0xed14('0x1d')](function(_0x3e8edc){if(_0x3e8edc['result'][_0xed14('0x42')]>0x0){_0x29da48=_0x3e8edc['result'];}console[_0xed14('0xa7')](_0xed14('0xa8'),_0x29da48);_0x471c04=[];_0x474477=Object[_0xed14('0xa9')]([],_0x29da48);_['remove'](_0x474477,function(_0x5a8301){return!_0x215cd1[_0xed14('0xaa')](_0x5a8301['name']);});_0x474477[_0xed14('0xab')](function(_0x511f3c){var _0x1b94b4=createFieldObject(_0x4924d8,_0x147e53,_0x511f3c[_0xed14('0xac')],_0x511f3c[_0xed14('0x35')],_0x511f3c['label'],![]);_0x471c04[_0xed14('0xad')](_0x1b94b4);});return Promise[_0xed14('0xae')](_0x471c04);})[_0xed14('0x1d')](function(_0x40b5bd){_0x351452=_0x40b5bd;_0x53ab48=Object[_0xed14('0xa9')]([],_0x29da48);console[_0xed14('0xa7')](_0xed14('0xaf'),_0x29da48);_[_0xed14('0xb0')](_0x53ab48,function(_0x2b64eb){return _0x44ed8f['includes'](_0x2b64eb[_0xed14('0x35')]);});console['log'](_0xed14('0xb1'),_0x53ab48);_0x471c04=[];_0x53ab48[_0xed14('0xab')](function(_0x36fd91){var _0x50a6af=createFieldObject(_0x4924d8,_0x147e53,_0x36fd91[_0xed14('0xac')],_0x36fd91[_0xed14('0x35')],_0x36fd91[_0xed14('0xb2')],!![]);_0x471c04[_0xed14('0xad')](_0x50a6af);});return Promise['all'](_0x471c04);})['then'](function(_0x1b3c04){_0x42b071=_0x1b3c04;var _0x278a72=_0x351452[_0xed14('0xb3')](_0x42b071);return{'count':_0x278a72['length'],'rows':_0x278a72};})[_0xed14('0x1d')](respondWithResult(_0x389880,null))[_0xed14('0x25')](function(_0x37a388){console[_0xed14('0xa7')](_0xed14('0xb4')+_0x37a388);var _0x44e46d=_0x3baa99[_0xed14('0x3d')][_0xed14('0xb5')]?0x1f4:_0x37a388[_0xed14('0xb6')]||0x1f4;logger[_0xed14('0x20')](_0x37a388['stack']);delete _0x37a388[_0xed14('0x35')];if(_0x44e46d===0x191){_0x44e46d=0x190;}_0x389880[_0xed14('0x27')](_0x44e46d)[_0xed14('0x36')](_0x3baa99['query']['test']?{'message':_0xed14('0xb7'),'statusCode':_0x37a388[_0xed14('0xb6')]}:_0x37a388);});};function createFieldObject(_0x3d7717,_0x3ceb59,_0x4cfc62,_0x57d173,_0x22267c,_0x478498){return new Promise(function(_0xf260a2,_0x5cbca1){var _0x2dc7b9={'id':_0x57d173,'name':_0x22267c,'custom':_0x478498};if(_0x4cfc62===_0xed14('0xb8')){_0x2dc7b9[_0xed14('0x4c')]=[{'name':_0xed14('0xb9'),'value':_0xed14('0xba')},{'name':_0xed14('0xbb'),'value':_0xed14('0xbc')}];_0xf260a2(_0x2dc7b9);}else{var _0x35b3da={'method':'GET','uri':_0x3d7717+'sys_choice?sysparm_query=name=incident^element='+_0x57d173,'auth':_0x3ceb59,'json':!![]};return rp(_0x35b3da)['then'](function(_0x1bae07){var _0x5ef335=[];if(_0x1bae07[_0xed14('0x24')]['length']>0x0){_0x1bae07[_0xed14('0x24')][_0xed14('0xab')](function(_0x1b73ac){if(_0x1b73ac['inactive']===_0xed14('0xbc')){var _0x222ea0={'name':_0x1b73ac['label'],'value':_0x1b73ac[_0xed14('0xbd')]};_0x5ef335[_0xed14('0xad')](_0x222ea0);}});}_0x2dc7b9['options']=_0x5ef335;if(_0x2dc7b9[_0xed14('0x4c')][_0xed14('0x42')]>0x0){_0xf260a2(_0x2dc7b9);}else{if(_0x478498==![]){_0xf260a2();}else{_0xf260a2(_0x2dc7b9);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c733b42..f91c8eb 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 _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x52e719,_0x296682){var _0x84cff8=function(_0x1191f0){while(--_0x1191f0){_0x52e719['push'](_0x52e719['shift']());}};_0x84cff8(++_0x296682);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad3=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x28107d,_0x2ec8b3){var _0x2b1cbe=function(_0x5b06ad){while(--_0x5b06ad){_0x28107d['push'](_0x28107d['shift']());}};_0x2b1cbe(++_0x2ec8b3);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x5ad3[_0x141e03];return _0x2074e3;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));var integrations=require(_0x35ad('0xa'));module[_0x35ad('0xb')]=function(_0x36c606,_0x31cc6a){return _0x36c606['define'](_0x35ad('0xc'),attributes,{'tableName':_0x35ad('0xd'),'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 d8d8571..01a71c4 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 _0x445c=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','info','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x25e95a,_0x2efe4a){var _0x2b35e8=function(_0x1cd36a){while(--_0x1cd36a){_0x25e95a['push'](_0x25e95a['shift']());}};_0x2b35e8(++_0x2efe4a);}(_0x445c,0x151));var _0xc445=function(_0x25575b,_0x43c2c1){_0x25575b=_0x25575b-0x0;var _0x5ec627=_0x445c[_0x25575b];return _0x5ec627;};'use strict';var _=require(_0xc445('0x0'));var util=require(_0xc445('0x1'));var moment=require(_0xc445('0x2'));var BPromise=require('bluebird');var rs=require(_0xc445('0x3'));var fs=require('fs');var Redis=require(_0xc445('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc445('0x5'));var logger=require(_0xc445('0x6'))(_0xc445('0x7'));var config=require(_0xc445('0x8'));var jayson=require(_0xc445('0x9'));var client=jayson[_0xc445('0xa')][_0xc445('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x384998,_0x1cb1eb,_0x24e1c9){return new BPromise(function(_0x5a1bf7,_0x3ef6f4){return client[_0xc445('0xc')](_0x384998,_0x24e1c9)['then'](function(_0x83ea34){logger['info'](_0xc445('0xd'),_0x1cb1eb,_0xc445('0xe'));logger[_0xc445('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1cb1eb,_0xc445('0xe'),JSON[_0xc445('0x10')](_0x83ea34));if(_0x83ea34[_0xc445('0x11')]){if(_0x83ea34[_0xc445('0x11')][_0xc445('0x12')]===0x1f4){logger[_0xc445('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1cb1eb,_0x83ea34['error'][_0xc445('0x13')]);return _0x3ef6f4(_0x83ea34['error'][_0xc445('0x13')]);}logger[_0xc445('0x11')](_0xc445('0xd'),_0x1cb1eb,_0x83ea34[_0xc445('0x11')]['message']);return _0x5a1bf7(_0x83ea34[_0xc445('0x11')][_0xc445('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x1cb1eb,_0xc445('0xe'));_0x5a1bf7(_0x83ea34['result'][_0xc445('0x13')]);}})[_0xc445('0x14')](function(_0x1c4267){logger[_0xc445('0x11')](_0xc445('0xd'),_0x1cb1eb,_0x1c4267);_0x3ef6f4(_0x1c4267);});});}exports[_0xc445('0x15')]=function(_0x5d08bf){var _0x24cd57=this;return new Promise(function(_0x1e5d86,_0x207b13){return db[_0xc445('0x16')][_0xc445('0x17')]({'raw':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf[_0xc445('0x18')][_0xc445('0x19')]===undefined?!![]:![]:!![],'where':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf[_0xc445('0x18')][_0xc445('0x1a')]||null:null,'attributes':_0x5d08bf['options']?_0x5d08bf[_0xc445('0x18')][_0xc445('0x1b')]||null:null,'limit':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf['options'][_0xc445('0x1c')]||null:null,'include':_0x5d08bf[_0xc445('0x18')]?_0x5d08bf['options'][_0xc445('0x1d')]?_[_0xc445('0x1e')](_0x5d08bf['options'][_0xc445('0x1d')],function(_0x2f073f){return{'model':db[_0x2f073f[_0xc445('0x1f')]],'as':_0x2f073f['as'],'attributes':_0x2f073f[_0xc445('0x1b')],'include':_0x2f073f['include']?_[_0xc445('0x1e')](_0x2f073f[_0xc445('0x1d')],function(_0x20e031){return{'model':db[_0x20e031[_0xc445('0x1f')]],'as':_0x20e031['as'],'attributes':_0x20e031[_0xc445('0x1b')],'include':_0x20e031[_0xc445('0x1d')]?_[_0xc445('0x1e')](_0x20e031[_0xc445('0x1d')],function(_0x2546a8){return{'model':db[_0x2546a8[_0xc445('0x1f')]],'as':_0x2546a8['as'],'attributes':_0x2546a8[_0xc445('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc445('0x20')](function(_0xfecc05){logger[_0xc445('0x21')](_0xc445('0x15'),_0x5d08bf);logger['debug'](_0xc445('0x15'),_0x5d08bf,JSON[_0xc445('0x10')](_0xfecc05));_0x1e5d86(_0xfecc05);})[_0xc445('0x14')](function(_0x4f3a23){logger[_0xc445('0x11')]('GetServicenowAccount',_0x4f3a23[_0xc445('0x13')],_0x5d08bf);_0x207b13(_0x24cd57['error'](0x1f4,_0x4f3a23[_0xc445('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x1e0515){var _0x386f09=this;return new Promise(function(_0x251344,_0x5a7a34){return db['ServicenowAccount']['find']({'raw':_0x1e0515[_0xc445('0x18')]?_0x1e0515[_0xc445('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1e0515[_0xc445('0x18')]?_0x1e0515['options']['where']||null:null,'attributes':_0x1e0515['options']?_0x1e0515[_0xc445('0x18')][_0xc445('0x1b')]||null:null,'include':_0x1e0515[_0xc445('0x18')]?_0x1e0515[_0xc445('0x18')]['include']?_[_0xc445('0x1e')](_0x1e0515[_0xc445('0x18')][_0xc445('0x1d')],function(_0x543666){return{'model':db[_0x543666[_0xc445('0x1f')]],'as':_0x543666['as'],'attributes':_0x543666[_0xc445('0x1b')],'include':_0x543666['include']?_['map'](_0x543666['include'],function(_0x5e2edb){return{'model':db[_0x5e2edb[_0xc445('0x1f')]],'as':_0x5e2edb['as'],'attributes':_0x5e2edb['attributes'],'include':_0x5e2edb['include']?_[_0xc445('0x1e')](_0x5e2edb[_0xc445('0x1d')],function(_0x4b8d00){return{'model':db[_0x4b8d00['model']],'as':_0x4b8d00['as'],'attributes':_0x4b8d00[_0xc445('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc445('0x20')](function(_0x1680e9){logger[_0xc445('0x21')](_0xc445('0x22'),_0x1e0515);logger[_0xc445('0xf')](_0xc445('0x22'),_0x1e0515,JSON[_0xc445('0x10')](_0x1680e9));_0x251344(_0x1680e9);})['catch'](function(_0x41f9b2){logger['error'](_0xc445('0x22'),_0x41f9b2[_0xc445('0x13')],_0x1e0515);_0x5a7a34(_0x386f09['error'](0x1f4,_0x41f9b2['message']));});});}; \ No newline at end of file +var _0x8b64=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowServicenowAccount','debug'];(function(_0x34c4a5,_0x9ac284){var _0x1b8996=function(_0x426e60){while(--_0x426e60){_0x34c4a5['push'](_0x34c4a5['shift']());}};_0x1b8996(++_0x9ac284);}(_0x8b64,0xc6));var _0x48b6=function(_0x28318f,_0x5cd1a2){_0x28318f=_0x28318f-0x0;var _0x4cab17=_0x8b64[_0x28318f];return _0x4cab17;};'use strict';var _=require(_0x48b6('0x0'));var util=require(_0x48b6('0x1'));var moment=require(_0x48b6('0x2'));var BPromise=require('bluebird');var rs=require(_0x48b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x48b6('0x4'));var logger=require(_0x48b6('0x5'))(_0x48b6('0x6'));var config=require(_0x48b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x48b6('0x8')][_0x48b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x152e4e,_0x1f89a9,_0x24643d){return new BPromise(function(_0x290e9a,_0x36d99e){return client[_0x48b6('0xa')](_0x152e4e,_0x24643d)[_0x48b6('0xb')](function(_0x4d244b){logger[_0x48b6('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x1f89a9,'request\x20sent');logger['debug'](_0x48b6('0xd'),_0x1f89a9,'request\x20sent',JSON[_0x48b6('0xe')](_0x4d244b));if(_0x4d244b['error']){if(_0x4d244b[_0x48b6('0xf')]['code']===0x1f4){logger[_0x48b6('0xf')](_0x48b6('0x10'),_0x1f89a9,_0x4d244b[_0x48b6('0xf')]['message']);return _0x36d99e(_0x4d244b[_0x48b6('0xf')][_0x48b6('0x11')]);}logger[_0x48b6('0xf')](_0x48b6('0x10'),_0x1f89a9,_0x4d244b['error']['message']);return _0x290e9a(_0x4d244b[_0x48b6('0xf')]['message']);}else{logger[_0x48b6('0xc')](_0x48b6('0x10'),_0x1f89a9,'request\x20sent');_0x290e9a(_0x4d244b[_0x48b6('0x12')][_0x48b6('0x11')]);}})[_0x48b6('0x13')](function(_0x59a009){logger['error'](_0x48b6('0x10'),_0x1f89a9,_0x59a009);_0x36d99e(_0x59a009);});});}exports[_0x48b6('0x14')]=function(_0x45a171){var _0xb3cc57=this;return new Promise(function(_0x516a3f,_0x2ad831){return db['ServicenowAccount'][_0x48b6('0x15')]({'raw':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x17')]===undefined?!![]:![]:!![],'where':_0x45a171[_0x48b6('0x16')]?_0x45a171['options'][_0x48b6('0x18')]||null:null,'attributes':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x19')]||null:null,'limit':_0x45a171['options']?_0x45a171[_0x48b6('0x16')][_0x48b6('0x1a')]||null:null,'include':_0x45a171['options']?_0x45a171[_0x48b6('0x16')]['include']?_[_0x48b6('0x1b')](_0x45a171['options'][_0x48b6('0x1c')],function(_0x1f0d30){return{'model':db[_0x1f0d30['model']],'as':_0x1f0d30['as'],'attributes':_0x1f0d30['attributes'],'include':_0x1f0d30[_0x48b6('0x1c')]?_['map'](_0x1f0d30['include'],function(_0x6c70e4){return{'model':db[_0x6c70e4[_0x48b6('0x1d')]],'as':_0x6c70e4['as'],'attributes':_0x6c70e4[_0x48b6('0x19')],'include':_0x6c70e4['include']?_['map'](_0x6c70e4[_0x48b6('0x1c')],function(_0x29c9da){return{'model':db[_0x29c9da[_0x48b6('0x1d')]],'as':_0x29c9da['as'],'attributes':_0x29c9da['attributes']};}):[]};}):[]};}):[]:[]})[_0x48b6('0xb')](function(_0x35470e){logger['info']('GetServicenowAccount',_0x45a171);logger['debug'](_0x48b6('0x14'),_0x45a171,JSON[_0x48b6('0xe')](_0x35470e));_0x516a3f(_0x35470e);})[_0x48b6('0x13')](function(_0x131473){logger[_0x48b6('0xf')](_0x48b6('0x14'),_0x131473[_0x48b6('0x11')],_0x45a171);_0x2ad831(_0xb3cc57[_0x48b6('0xf')](0x1f4,_0x131473[_0x48b6('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x49b08c){var _0x19f001=this;return new Promise(function(_0x48cef3,_0x3fabae){return db['ServicenowAccount'][_0x48b6('0x1e')]({'raw':_0x49b08c['options']?_0x49b08c[_0x48b6('0x16')][_0x48b6('0x17')]===undefined?!![]:![]:!![],'where':_0x49b08c[_0x48b6('0x16')]?_0x49b08c[_0x48b6('0x16')]['where']||null:null,'attributes':_0x49b08c[_0x48b6('0x16')]?_0x49b08c['options'][_0x48b6('0x19')]||null:null,'include':_0x49b08c[_0x48b6('0x16')]?_0x49b08c[_0x48b6('0x16')]['include']?_['map'](_0x49b08c[_0x48b6('0x16')][_0x48b6('0x1c')],function(_0x530d46){return{'model':db[_0x530d46['model']],'as':_0x530d46['as'],'attributes':_0x530d46[_0x48b6('0x19')],'include':_0x530d46[_0x48b6('0x1c')]?_['map'](_0x530d46['include'],function(_0x10bad5){return{'model':db[_0x10bad5[_0x48b6('0x1d')]],'as':_0x10bad5['as'],'attributes':_0x10bad5[_0x48b6('0x19')],'include':_0x10bad5['include']?_[_0x48b6('0x1b')](_0x10bad5[_0x48b6('0x1c')],function(_0x581f23){return{'model':db[_0x581f23[_0x48b6('0x1d')]],'as':_0x581f23['as'],'attributes':_0x581f23[_0x48b6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x48b6('0xb')](function(_0x5c2395){logger[_0x48b6('0xc')](_0x48b6('0x1f'),_0x49b08c);logger[_0x48b6('0x20')](_0x48b6('0x1f'),_0x49b08c,JSON[_0x48b6('0xe')](_0x5c2395));_0x48cef3(_0x5c2395);})[_0x48b6('0x13')](function(_0x1dafc2){logger[_0x48b6('0xf')](_0x48b6('0x1f'),_0x1dafc2[_0x48b6('0x11')],_0x49b08c);_0x3fabae(_0x19f001[_0x48b6('0xf')](0x1f4,_0x1dafc2['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index dfbfc60..992bb6c 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 _0xe6fd=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6fd,0xdc));var _0xde6f=function(_0x5cb4d2,_0x3bb9f1){_0x5cb4d2=_0x5cb4d2-0x0;var _0x42dcd4=_0xe6fd[_0x5cb4d2];return _0x42dcd4;};'use strict';var multer=require(_0xde6f('0x0'));var util=require(_0xde6f('0x1'));var path=require(_0xde6f('0x2'));var timeout=require(_0xde6f('0x3'));var express=require(_0xde6f('0x4'));var router=express[_0xde6f('0x5')]();var auth=require(_0xde6f('0x6'));var interaction=require(_0xde6f('0x7'));var config=require(_0xde6f('0x8'));var controller=require(_0xde6f('0x9'));router[_0xde6f('0xa')]('/',auth[_0xde6f('0xb')](),controller[_0xde6f('0xc')]);router[_0xde6f('0xa')](_0xde6f('0xd'),auth[_0xde6f('0xb')](),controller[_0xde6f('0xe')]);router[_0xde6f('0xa')](_0xde6f('0xf'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x10')]);router['get']('/:id/subjects',auth[_0xde6f('0xb')](),controller[_0xde6f('0x11')]);router[_0xde6f('0xa')](_0xde6f('0x12'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x13')]);router[_0xde6f('0x14')]('/',auth[_0xde6f('0xb')](),controller[_0xde6f('0x15')]);router['put'](_0xde6f('0xd'),auth[_0xde6f('0xb')](),controller[_0xde6f('0x16')]);router[_0xde6f('0x17')](_0xde6f('0xd'),auth['isAuthenticated'](),controller[_0xde6f('0x18')]);module[_0xde6f('0x19')]=router; \ No newline at end of file +var _0xfec6=['getDescriptions','post','create','update','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions'];(function(_0x591672,_0x4427a9){var _0x17706e=function(_0x4c8c19){while(--_0x4c8c19){_0x591672['push'](_0x591672['shift']());}};_0x17706e(++_0x4427a9);}(_0xfec6,0x83));var _0x6fec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfec6[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x6fec('0x0'));var util=require(_0x6fec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x6fec('0x2'));var interaction=require(_0x6fec('0x3'));var config=require(_0x6fec('0x4'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x6fec('0x5')](),controller[_0x6fec('0x6')]);router[_0x6fec('0x7')](_0x6fec('0x8'),auth[_0x6fec('0x5')](),controller[_0x6fec('0x9')]);router[_0x6fec('0x7')](_0x6fec('0xa'),auth[_0x6fec('0x5')](),controller[_0x6fec('0xb')]);router[_0x6fec('0x7')]('/:id/subjects',auth[_0x6fec('0x5')](),controller['getSubjects']);router['get'](_0x6fec('0xc'),auth[_0x6fec('0x5')](),controller[_0x6fec('0xd')]);router[_0x6fec('0xe')]('/',auth['isAuthenticated'](),controller[_0x6fec('0xf')]);router['put'](_0x6fec('0x8'),auth[_0x6fec('0x5')](),controller[_0x6fec('0x10')]);router['delete'](_0x6fec('0x8'),auth[_0x6fec('0x5')](),controller['destroy']);module[_0x6fec('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9a5af65..03cabf0 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 _0xcb4f=['STRING','sequelize','exports'];(function(_0x4af197,_0x338d52){var _0x2f34ae=function(_0x34e11f){while(--_0x34e11f){_0x4af197['push'](_0x4af197['shift']());}};_0x2f34ae(++_0x338d52);}(_0xcb4f,0x19c));var _0xfcb4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xcb4f[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xfcb4('0x0'));module[_0xfcb4('0x1')]={'name':{'type':Sequelize[_0xfcb4('0x2')]},'description':{'type':Sequelize[_0xfcb4('0x2')]}}; \ No newline at end of file +var _0xeb06=['sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeb06,0x1c5));var _0x6eb0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeb06[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x6eb0('0x0'));module[_0x6eb0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 19294bf..29ab8d3 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 _0x149c=['rows','params','include','find','create','body','destroy','getFields','findOne','rawAttributes','order','getSubjects','ServicenowField','nolimit','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','end','stack','name','index','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x5de315,_0xea75a3){var _0x1040ea=function(_0x2aa0c3){while(--_0x2aa0c3){_0x5de315['push'](_0x5de315['shift']());}};_0x1040ea(++_0xea75a3);}(_0x149c,0xc7));var _0xc149=function(_0x5c919e,_0x5bbd2e){_0x5c919e=_0x5c919e-0x0;var _0x16128c=_0x149c[_0x5c919e];return _0x16128c;};'use strict';var pdf=require(_0xc149('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc149('0x1'));var zipdir=require(_0xc149('0x2'));var jsonpatch=require(_0xc149('0x3'));var rp=require(_0xc149('0x4'));var moment=require(_0xc149('0x5'));var BPromise=require(_0xc149('0x6'));var Mustache=require(_0xc149('0x7'));var util=require('util');var path=require(_0xc149('0x8'));var sox=require(_0xc149('0x9'));var csv=require(_0xc149('0xa'));var ejs=require(_0xc149('0xb'));var fs=require('fs');var _=require(_0xc149('0xc'));var squel=require(_0xc149('0xd'));var crypto=require(_0xc149('0xe'));var jsforce=require(_0xc149('0xf'));var deskjs=require(_0xc149('0x10'));var toCsv=require(_0xc149('0xa'));var querystring=require('querystring');var Papa=require(_0xc149('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc149('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc149('0x13'))(_0xc149('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc149('0x15'));var db=require(_0xc149('0x16'))['db'];var jayson=require(_0xc149('0x17'));var client=jayson[_0xc149('0x18')][_0xc149('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ba9c1,_0xadb42a,_0x2b4ae1,_0xe95098){return new BPromise(function(_0x3d7dc6,_0x29f347){var _0x55b476=_0xe95098||client;return _0x55b476[_0xc149('0x1a')](_0x4ba9c1,_0x2b4ae1)[_0xc149('0x1b')](function(_0x437d80){logger[_0xc149('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s',_0xadb42a,_0xc149('0x1d'));logger[_0xc149('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xadb42a,_0xc149('0x1d'),JSON[_0xc149('0x1f')](_0x437d80));if(_0x437d80[_0xc149('0x20')]){if(_0x437d80['error'][_0xc149('0x21')]===0x1f4){logger[_0xc149('0x20')](_0xc149('0x22'),_0xadb42a,_0x437d80[_0xc149('0x20')]['message']);return _0x29f347(_0x437d80[_0xc149('0x20')][_0xc149('0x23')]);}logger[_0xc149('0x20')](_0xc149('0x22'),_0xadb42a,_0x437d80['error'][_0xc149('0x23')]);return _0x3d7dc6(_0x437d80[_0xc149('0x20')]['message']);}else{logger['info'](_0xc149('0x22'),_0xadb42a,_0xc149('0x1d'));_0x3d7dc6(_0x437d80[_0xc149('0x24')][_0xc149('0x23')]);}})[_0xc149('0x25')](function(_0x1815f5){logger['error'](_0xc149('0x22'),_0xadb42a,_0x1815f5);_0x29f347(_0x1815f5);});});}function respondWithStatusCode(_0x464d29,_0x1e19c1){_0x1e19c1=_0x1e19c1||0xcc;return function(_0x3a0370){if(_0x3a0370){return _0x464d29[_0xc149('0x26')](_0x1e19c1);}return _0x464d29[_0xc149('0x27')](_0x1e19c1)['end']();};}function respondWithResult(_0x22cc78,_0xa27969){_0xa27969=_0xa27969||0xc8;return function(_0xdc443d){if(_0xdc443d){return _0x22cc78[_0xc149('0x27')](_0xa27969)[_0xc149('0x28')](_0xdc443d);}};}function respondWithFilteredResult(_0xa3519b,_0x45a1d2){return function(_0x2359ba){if(_0x2359ba){var _0x170140=_0x2359ba[_0xc149('0x29')],_0x413ca3=_0x45a1d2['offset'],_0x457b23=_0x45a1d2['offset']+_0x45a1d2[_0xc149('0x2a')],_0x5855f0;if(_0x457b23>=_0x170140){_0x457b23=_0x170140;_0x5855f0=0xc8;}else{_0x5855f0=0xce;}_0xa3519b[_0xc149('0x27')](_0x5855f0);return _0xa3519b[_0xc149('0x2b')](_0xc149('0x2c'),_0x413ca3+'-'+_0x457b23+'/'+_0x170140)[_0xc149('0x28')](_0x2359ba);}return null;};}function patchUpdates(_0x4f2713){return function(_0x3ec254){try{jsonpatch[_0xc149('0x2d')](_0x3ec254,_0x4f2713,!![]);}catch(_0x1380de){return BPromise[_0xc149('0x2e')](_0x1380de);}return _0x3ec254[_0xc149('0x2f')]();};}function saveUpdates(_0x5b022e,_0x2175f1){return function(_0x453d94){if(_0x453d94){return _0x453d94[_0xc149('0x30')](_0x5b022e)[_0xc149('0x1b')](function(_0x4c4225){return _0x4c4225;});}return null;};}function removeEntity(_0x5e8449,_0x2a7b80){return function(_0x5b2425){if(_0x5b2425){return _0x5b2425['destroy']()[_0xc149('0x1b')](function(){_0x5e8449[_0xc149('0x27')](0xcc)[_0xc149('0x31')]();});}};}function handleEntityNotFound(_0x2e6e90,_0x2d0103){return function(_0x9d6188){if(!_0x9d6188){_0x2e6e90[_0xc149('0x26')](0x194);}return _0x9d6188;};}function handleError(_0x4be4cf,_0x2b7717){_0x2b7717=_0x2b7717||0x1f4;return function(_0x364ba6){logger[_0xc149('0x20')](_0x364ba6[_0xc149('0x32')]);if(_0x364ba6[_0xc149('0x33')]){delete _0x364ba6[_0xc149('0x33')];}_0x4be4cf[_0xc149('0x27')](_0x2b7717)['send'](_0x364ba6);};}exports[_0xc149('0x34')]=function(_0x13cb06,_0x3204f1){var _0x1eeac7={},_0x17fe77={},_0x5c1cb4={'count':0x0,'rows':[]};var _0x476579=_[_0xc149('0x35')](db[_0xc149('0x36')]['rawAttributes'],function(_0x24c612){return{'name':_0x24c612[_0xc149('0x37')],'type':_0x24c612[_0xc149('0x38')][_0xc149('0x39')]};});_0x17fe77[_0xc149('0x3a')]=_[_0xc149('0x35')](_0x476579,_0xc149('0x33'));_0x17fe77[_0xc149('0x3b')]=_[_0xc149('0x3c')](_0x13cb06[_0xc149('0x3b')]);_0x17fe77[_0xc149('0x3d')]=_[_0xc149('0x3e')](_0x17fe77[_0xc149('0x3a')],_0x17fe77[_0xc149('0x3b')]);_0x1eeac7[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x17fe77[_0xc149('0x3a')],qs[_0xc149('0x40')](_0x13cb06[_0xc149('0x3b')][_0xc149('0x40')]));_0x1eeac7['attributes']=_0x1eeac7['attributes'][_0xc149('0x41')]?_0x1eeac7[_0xc149('0x3f')]:_0x17fe77[_0xc149('0x3a')];if(!_0x13cb06[_0xc149('0x3b')][_0xc149('0x42')]('nolimit')){_0x1eeac7['limit']=qs['limit'](_0x13cb06[_0xc149('0x3b')][_0xc149('0x2a')]);_0x1eeac7[_0xc149('0x43')]=qs[_0xc149('0x43')](_0x13cb06['query'][_0xc149('0x43')]);}_0x1eeac7['order']=qs['sort'](_0x13cb06[_0xc149('0x3b')][_0xc149('0x44')]);_0x1eeac7[_0xc149('0x45')]=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x13cb06[_0xc149('0x3b')],_0x17fe77['filters']),_0x476579);if(_0x13cb06[_0xc149('0x3b')][_0xc149('0x47')]){_0x1eeac7[_0xc149('0x45')]=_[_0xc149('0x48')](_0x1eeac7[_0xc149('0x45')],{'$or':_['map'](_0x476579,function(_0x1d2b29){if(_0x1d2b29['type']!==_0xc149('0x49')){var _0x3af542={};_0x3af542[_0x1d2b29['name']]={'$like':'%'+_0x13cb06[_0xc149('0x3b')][_0xc149('0x47')]+'%'};return _0x3af542;}})});}_0x1eeac7=_[_0xc149('0x48')]({},_0x1eeac7,_0x13cb06[_0xc149('0x4a')]);var _0x286f55={'where':_0x1eeac7[_0xc149('0x45')]};return db[_0xc149('0x36')][_0xc149('0x29')](_0x286f55)[_0xc149('0x1b')](function(_0x26fbcb){_0x5c1cb4[_0xc149('0x29')]=_0x26fbcb;if(_0x13cb06['query'][_0xc149('0x4b')]){_0x1eeac7['include']=[{'all':!![]}];}return db[_0xc149('0x36')][_0xc149('0x4c')](_0x1eeac7);})[_0xc149('0x1b')](function(_0x27a290){_0x5c1cb4[_0xc149('0x4d')]=_0x27a290;return _0x5c1cb4;})[_0xc149('0x1b')](respondWithFilteredResult(_0x3204f1,_0x1eeac7))[_0xc149('0x25')](handleError(_0x3204f1,null));};exports['show']=function(_0x197c1a,_0x694407){var _0x58b15f={'raw':![],'where':{'id':_0x197c1a[_0xc149('0x4e')]['id']}},_0x54cae1={};_0x54cae1[_0xc149('0x3a')]=_[_0xc149('0x3c')](db[_0xc149('0x36')]['rawAttributes']);_0x54cae1[_0xc149('0x3b')]=_[_0xc149('0x3c')](_0x197c1a[_0xc149('0x3b')]);_0x54cae1[_0xc149('0x3d')]=_[_0xc149('0x3e')](_0x54cae1[_0xc149('0x3a')],_0x54cae1['query']);_0x58b15f[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x54cae1[_0xc149('0x3a')],qs[_0xc149('0x40')](_0x197c1a['query'][_0xc149('0x40')]));_0x58b15f[_0xc149('0x3f')]=_0x58b15f[_0xc149('0x3f')][_0xc149('0x41')]?_0x58b15f[_0xc149('0x3f')]:_0x54cae1[_0xc149('0x3a')];if(_0x197c1a[_0xc149('0x3b')][_0xc149('0x4b')]){_0x58b15f[_0xc149('0x4f')]=[{'all':!![]}];}_0x58b15f=_['merge']({},_0x58b15f,_0x197c1a[_0xc149('0x4a')]);return db[_0xc149('0x36')][_0xc149('0x50')](_0x58b15f)['then'](handleEntityNotFound(_0x694407,null))[_0xc149('0x1b')](respondWithResult(_0x694407,null))[_0xc149('0x25')](handleError(_0x694407,null));};exports[_0xc149('0x51')]=function(_0x369396,_0x4d3334){return db[_0xc149('0x36')]['create'](_0x369396['body'],{})[_0xc149('0x1b')](respondWithResult(_0x4d3334,0xc9))['catch'](handleError(_0x4d3334,null));};exports[_0xc149('0x30')]=function(_0xcf804,_0x408e70){if(_0xcf804[_0xc149('0x52')]['id']){delete _0xcf804[_0xc149('0x52')]['id'];}return db['ServicenowConfiguration'][_0xc149('0x50')]({'where':{'id':_0xcf804[_0xc149('0x4e')]['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x408e70,null))[_0xc149('0x1b')](saveUpdates(_0xcf804['body'],null))[_0xc149('0x1b')](respondWithResult(_0x408e70,null))[_0xc149('0x25')](handleError(_0x408e70,null));};exports[_0xc149('0x53')]=function(_0x51a893,_0x35cbc7){return db['ServicenowConfiguration']['find']({'where':{'id':_0x51a893['params']['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x35cbc7,null))[_0xc149('0x1b')](removeEntity(_0x35cbc7,null))[_0xc149('0x25')](handleError(_0x35cbc7,null));};exports[_0xc149('0x54')]=function(_0x3d270e,_0x154836,_0x1f6b8f){var _0x3488a6={};var _0xb7ecf8={};var _0x54ff5f;var _0xdfd265;return db[_0xc149('0x36')][_0xc149('0x55')]({'where':{'id':_0x3d270e[_0xc149('0x4e')]['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x154836,null))[_0xc149('0x1b')](function(_0x2c0000){if(_0x2c0000){_0x54ff5f=_0x2c0000;_0xb7ecf8[_0xc149('0x3a')]=_[_0xc149('0x3c')](db['ServicenowField'][_0xc149('0x56')]);_0xb7ecf8[_0xc149('0x3b')]=_[_0xc149('0x3c')](_0x3d270e['query']);_0xb7ecf8['filters']=_['intersection'](_0xb7ecf8['model'],_0xb7ecf8[_0xc149('0x3b')]);_0x3488a6[_0xc149('0x3f')]=_['intersection'](_0xb7ecf8[_0xc149('0x3a')],qs[_0xc149('0x40')](_0x3d270e[_0xc149('0x3b')]['fields']));_0x3488a6[_0xc149('0x3f')]=_0x3488a6[_0xc149('0x3f')]['length']?_0x3488a6[_0xc149('0x3f')]:_0xb7ecf8[_0xc149('0x3a')];_0x3488a6[_0xc149('0x57')]=qs[_0xc149('0x44')](_0x3d270e[_0xc149('0x3b')][_0xc149('0x44')]);_0x3488a6['where']=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x3d270e['query'],_0xb7ecf8[_0xc149('0x3d')]));if(_0x3d270e['query']['filter']){_0x3488a6[_0xc149('0x45')]=_[_0xc149('0x48')](_0x3488a6[_0xc149('0x45')],{'$or':_['map'](_0x3488a6['attributes'],function(_0x58ba3d){var _0x268324={};_0x268324[_0x58ba3d]={'$like':'%'+_0x3d270e[_0xc149('0x3b')][_0xc149('0x47')]+'%'};return _0x268324;})});}_0x3488a6=_[_0xc149('0x48')]({},_0x3488a6,_0x3d270e[_0xc149('0x4a')]);return _0x54ff5f['getFields'](_0x3488a6);}})[_0xc149('0x1b')](function(_0xf2b0fe){if(_0xf2b0fe){_0xdfd265=_0xf2b0fe[_0xc149('0x41')];if(!_0x3d270e[_0xc149('0x3b')][_0xc149('0x42')]('nolimit')){_0x3488a6[_0xc149('0x2a')]=qs[_0xc149('0x2a')](_0x3d270e['query']['limit']);_0x3488a6[_0xc149('0x43')]=qs['offset'](_0x3d270e[_0xc149('0x3b')]['offset']);}return _0x54ff5f[_0xc149('0x54')](_0x3488a6);}})[_0xc149('0x1b')](function(_0x844959){if(_0x844959){return _0x844959?{'count':_0xdfd265,'rows':_0x844959}:null;}})[_0xc149('0x1b')](respondWithResult(_0x154836,null))['catch'](handleError(_0x154836,null));};exports[_0xc149('0x58')]=function(_0x2c0753,_0x97c1f5,_0x3dd359){var _0x4f0777={};var _0x42eede={};var _0x108b1a;var _0x23136d;return db[_0xc149('0x36')][_0xc149('0x55')]({'where':{'id':_0x2c0753[_0xc149('0x4e')]['id']}})[_0xc149('0x1b')](handleEntityNotFound(_0x97c1f5,null))[_0xc149('0x1b')](function(_0x3bd019){if(_0x3bd019){_0x108b1a=_0x3bd019;_0x42eede['model']=_[_0xc149('0x3c')](db[_0xc149('0x59')]['rawAttributes']);_0x42eede['query']=_[_0xc149('0x3c')](_0x2c0753[_0xc149('0x3b')]);_0x42eede[_0xc149('0x3d')]=_[_0xc149('0x3e')](_0x42eede[_0xc149('0x3a')],_0x42eede['query']);_0x4f0777[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x42eede['model'],qs['fields'](_0x2c0753[_0xc149('0x3b')][_0xc149('0x40')]));_0x4f0777['attributes']=_0x4f0777[_0xc149('0x3f')][_0xc149('0x41')]?_0x4f0777[_0xc149('0x3f')]:_0x42eede[_0xc149('0x3a')];_0x4f0777[_0xc149('0x57')]=qs[_0xc149('0x44')](_0x2c0753[_0xc149('0x3b')][_0xc149('0x44')]);_0x4f0777['where']=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x2c0753['query'],_0x42eede[_0xc149('0x3d')]));if(_0x2c0753[_0xc149('0x3b')][_0xc149('0x47')]){_0x4f0777[_0xc149('0x45')]=_['merge'](_0x4f0777['where'],{'$or':_[_0xc149('0x35')](_0x4f0777['attributes'],function(_0x5650a0){var _0x550e8f={};_0x550e8f[_0x5650a0]={'$like':'%'+_0x2c0753[_0xc149('0x3b')][_0xc149('0x47')]+'%'};return _0x550e8f;})});}_0x4f0777=_[_0xc149('0x48')]({},_0x4f0777,_0x2c0753[_0xc149('0x4a')]);return _0x108b1a[_0xc149('0x58')](_0x4f0777);}})[_0xc149('0x1b')](function(_0x3eae70){if(_0x3eae70){_0x23136d=_0x3eae70[_0xc149('0x41')];if(!_0x2c0753[_0xc149('0x3b')]['hasOwnProperty'](_0xc149('0x5a'))){_0x4f0777[_0xc149('0x2a')]=qs[_0xc149('0x2a')](_0x2c0753[_0xc149('0x3b')][_0xc149('0x2a')]);_0x4f0777['offset']=qs[_0xc149('0x43')](_0x2c0753['query']['offset']);}return _0x108b1a[_0xc149('0x58')](_0x4f0777);}})[_0xc149('0x1b')](function(_0x5f85a0){if(_0x5f85a0){return _0x5f85a0?{'count':_0x23136d,'rows':_0x5f85a0}:null;}})[_0xc149('0x1b')](respondWithResult(_0x97c1f5,null))[_0xc149('0x25')](handleError(_0x97c1f5,null));};exports['getDescriptions']=function(_0x5a881b,_0xfcf318,_0x1a6199){var _0x289a32={};var _0x4c3d63={};var _0x27f6a4;var _0x66388f;return db['ServicenowConfiguration'][_0xc149('0x55')]({'where':{'id':_0x5a881b[_0xc149('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfcf318,null))['then'](function(_0x22268a){if(_0x22268a){_0x27f6a4=_0x22268a;_0x4c3d63[_0xc149('0x3a')]=_[_0xc149('0x3c')](db[_0xc149('0x59')]['rawAttributes']);_0x4c3d63['query']=_[_0xc149('0x3c')](_0x5a881b[_0xc149('0x3b')]);_0x4c3d63[_0xc149('0x3d')]=_['intersection'](_0x4c3d63['model'],_0x4c3d63['query']);_0x289a32[_0xc149('0x3f')]=_[_0xc149('0x3e')](_0x4c3d63['model'],qs[_0xc149('0x40')](_0x5a881b[_0xc149('0x3b')][_0xc149('0x40')]));_0x289a32[_0xc149('0x3f')]=_0x289a32[_0xc149('0x3f')][_0xc149('0x41')]?_0x289a32[_0xc149('0x3f')]:_0x4c3d63[_0xc149('0x3a')];_0x289a32['order']=qs[_0xc149('0x44')](_0x5a881b[_0xc149('0x3b')]['sort']);_0x289a32[_0xc149('0x45')]=qs[_0xc149('0x3d')](_[_0xc149('0x46')](_0x5a881b[_0xc149('0x3b')],_0x4c3d63[_0xc149('0x3d')]));if(_0x5a881b[_0xc149('0x3b')][_0xc149('0x47')]){_0x289a32[_0xc149('0x45')]=_[_0xc149('0x48')](_0x289a32[_0xc149('0x45')],{'$or':_[_0xc149('0x35')](_0x289a32['attributes'],function(_0x225472){var _0x5969b0={};_0x5969b0[_0x225472]={'$like':'%'+_0x5a881b['query'][_0xc149('0x47')]+'%'};return _0x5969b0;})});}_0x289a32=_[_0xc149('0x48')]({},_0x289a32,_0x5a881b[_0xc149('0x4a')]);return _0x27f6a4[_0xc149('0x5b')](_0x289a32);}})[_0xc149('0x1b')](function(_0x338f33){if(_0x338f33){_0x66388f=_0x338f33[_0xc149('0x41')];if(!_0x5a881b[_0xc149('0x3b')][_0xc149('0x42')](_0xc149('0x5a'))){_0x289a32[_0xc149('0x2a')]=qs[_0xc149('0x2a')](_0x5a881b[_0xc149('0x3b')][_0xc149('0x2a')]);_0x289a32[_0xc149('0x43')]=qs[_0xc149('0x43')](_0x5a881b[_0xc149('0x3b')]['offset']);}return _0x27f6a4[_0xc149('0x5b')](_0x289a32);}})[_0xc149('0x1b')](function(_0xf1bb59){if(_0xf1bb59){return _0xf1bb59?{'count':_0x66388f,'rows':_0xf1bb59}:null;}})[_0xc149('0x1b')](respondWithResult(_0xfcf318,null))[_0xc149('0x25')](handleError(_0xfcf318,null));}; \ No newline at end of file +var _0x1b8a=['intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','model','include','find','create','body','params','findOne','pick','getFields','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','count','limit','set','apply','reject','save','update','then','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','attributes'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x1b8a,0x1e0));var _0xa1b8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b8a[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xa1b8('0x0'));var emlformat=require(_0xa1b8('0x1'));var rimraf=require(_0xa1b8('0x2'));var zipdir=require(_0xa1b8('0x3'));var jsonpatch=require(_0xa1b8('0x4'));var rp=require('request-promise');var moment=require(_0xa1b8('0x5'));var BPromise=require(_0xa1b8('0x6'));var Mustache=require(_0xa1b8('0x7'));var util=require('util');var path=require(_0xa1b8('0x8'));var sox=require('sox');var csv=require(_0xa1b8('0x9'));var ejs=require(_0xa1b8('0xa'));var fs=require('fs');var _=require(_0xa1b8('0xb'));var squel=require(_0xa1b8('0xc'));var crypto=require(_0xa1b8('0xd'));var jsforce=require(_0xa1b8('0xe'));var deskjs=require(_0xa1b8('0xf'));var toCsv=require(_0xa1b8('0x9'));var querystring=require('querystring');var Papa=require(_0xa1b8('0x10'));var Redis=require('ioredis');var authService=require(_0xa1b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa1b8('0x12'));var hardwareService=require(_0xa1b8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa1b8('0x14'));var config=require(_0xa1b8('0x15'));var licenseUtil=require(_0xa1b8('0x16'));var db=require(_0xa1b8('0x17'))['db'];var jayson=require(_0xa1b8('0x18'));var client=jayson[_0xa1b8('0x19')][_0xa1b8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1fc4b0,_0x3cd79b,_0x3da46f,_0x22785d){return new BPromise(function(_0x3f5db2,_0x45995f){var _0x4d5766=_0x22785d||client;return _0x4d5766['request'](_0x1fc4b0,_0x3da46f)['then'](function(_0x3b7467){logger[_0xa1b8('0x1b')](_0xa1b8('0x1c'),_0x3cd79b,_0xa1b8('0x1d'));logger[_0xa1b8('0x1e')](_0xa1b8('0x1f'),_0x3cd79b,_0xa1b8('0x1d'),JSON['stringify'](_0x3b7467));if(_0x3b7467[_0xa1b8('0x20')]){if(_0x3b7467['error']['code']===0x1f4){logger[_0xa1b8('0x20')](_0xa1b8('0x1c'),_0x3cd79b,_0x3b7467[_0xa1b8('0x20')][_0xa1b8('0x21')]);return _0x45995f(_0x3b7467[_0xa1b8('0x20')][_0xa1b8('0x21')]);}logger['error'](_0xa1b8('0x1c'),_0x3cd79b,_0x3b7467[_0xa1b8('0x20')]['message']);return _0x3f5db2(_0x3b7467[_0xa1b8('0x20')][_0xa1b8('0x21')]);}else{logger[_0xa1b8('0x1b')](_0xa1b8('0x1c'),_0x3cd79b,_0xa1b8('0x1d'));_0x3f5db2(_0x3b7467['result']['message']);}})['catch'](function(_0x29f133){logger[_0xa1b8('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3cd79b,_0x29f133);_0x45995f(_0x29f133);});});}function respondWithStatusCode(_0x395bce,_0x5b36cc){_0x5b36cc=_0x5b36cc||0xcc;return function(_0x3d9314){if(_0x3d9314){return _0x395bce[_0xa1b8('0x22')](_0x5b36cc);}return _0x395bce[_0xa1b8('0x23')](_0x5b36cc)[_0xa1b8('0x24')]();};}function respondWithResult(_0x3987ea,_0x49f5ed){_0x49f5ed=_0x49f5ed||0xc8;return function(_0x582436){if(_0x582436){return _0x3987ea[_0xa1b8('0x23')](_0x49f5ed)[_0xa1b8('0x25')](_0x582436);}};}function respondWithFilteredResult(_0x1da198,_0x5ec6fd){return function(_0x1b05d0){if(_0x1b05d0){var _0x432464=_0x1b05d0[_0xa1b8('0x26')],_0x2faadb=_0x5ec6fd['offset'],_0x116757=_0x5ec6fd['offset']+_0x5ec6fd[_0xa1b8('0x27')],_0xffb0c9;if(_0x116757>=_0x432464){_0x116757=_0x432464;_0xffb0c9=0xc8;}else{_0xffb0c9=0xce;}_0x1da198['status'](_0xffb0c9);return _0x1da198[_0xa1b8('0x28')]('Content-Range',_0x2faadb+'-'+_0x116757+'/'+_0x432464)['json'](_0x1b05d0);}return null;};}function patchUpdates(_0x332fd6){return function(_0x19db3b){try{jsonpatch[_0xa1b8('0x29')](_0x19db3b,_0x332fd6,!![]);}catch(_0x2b9f75){return BPromise[_0xa1b8('0x2a')](_0x2b9f75);}return _0x19db3b[_0xa1b8('0x2b')]();};}function saveUpdates(_0x5a46e5,_0xa460b4){return function(_0xd22794){if(_0xd22794){return _0xd22794[_0xa1b8('0x2c')](_0x5a46e5)[_0xa1b8('0x2d')](function(_0x1166f9){return _0x1166f9;});}return null;};}function removeEntity(_0x5f5547,_0x4e915e){return function(_0x4d1f18){if(_0x4d1f18){return _0x4d1f18[_0xa1b8('0x2e')]()[_0xa1b8('0x2d')](function(){_0x5f5547['status'](0xcc)[_0xa1b8('0x24')]();});}};}function handleEntityNotFound(_0x46488d,_0x59b720){return function(_0x51ab1e){if(!_0x51ab1e){_0x46488d[_0xa1b8('0x22')](0x194);}return _0x51ab1e;};}function handleError(_0x4ab231,_0x2c1116){_0x2c1116=_0x2c1116||0x1f4;return function(_0x430945){logger[_0xa1b8('0x20')](_0x430945[_0xa1b8('0x2f')]);if(_0x430945[_0xa1b8('0x30')]){delete _0x430945[_0xa1b8('0x30')];}_0x4ab231['status'](_0x2c1116)['send'](_0x430945);};}exports[_0xa1b8('0x31')]=function(_0x94165,_0x9d6571){var _0x1e1be5={},_0x68221={},_0xe0f037={'count':0x0,'rows':[]};var _0x2374a6=_[_0xa1b8('0x32')](db[_0xa1b8('0x33')][_0xa1b8('0x34')],function(_0x5cc9da){return{'name':_0x5cc9da[_0xa1b8('0x35')],'type':_0x5cc9da[_0xa1b8('0x36')][_0xa1b8('0x37')]};});_0x68221['model']=_['map'](_0x2374a6,_0xa1b8('0x30'));_0x68221[_0xa1b8('0x38')]=_[_0xa1b8('0x39')](_0x94165[_0xa1b8('0x38')]);_0x68221[_0xa1b8('0x3a')]=_['intersection'](_0x68221['model'],_0x68221[_0xa1b8('0x38')]);_0x1e1be5[_0xa1b8('0x3b')]=_[_0xa1b8('0x3c')](_0x68221['model'],qs[_0xa1b8('0x3d')](_0x94165[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x1e1be5[_0xa1b8('0x3b')]=_0x1e1be5['attributes'][_0xa1b8('0x3e')]?_0x1e1be5[_0xa1b8('0x3b')]:_0x68221['model'];if(!_0x94165[_0xa1b8('0x38')][_0xa1b8('0x3f')](_0xa1b8('0x40'))){_0x1e1be5[_0xa1b8('0x27')]=qs['limit'](_0x94165['query'][_0xa1b8('0x27')]);_0x1e1be5[_0xa1b8('0x41')]=qs[_0xa1b8('0x41')](_0x94165[_0xa1b8('0x38')]['offset']);}_0x1e1be5[_0xa1b8('0x42')]=qs['sort'](_0x94165['query'][_0xa1b8('0x43')]);_0x1e1be5[_0xa1b8('0x44')]=qs['filters'](_['pick'](_0x94165[_0xa1b8('0x38')],_0x68221[_0xa1b8('0x3a')]),_0x2374a6);if(_0x94165['query'][_0xa1b8('0x45')]){_0x1e1be5[_0xa1b8('0x44')]=_['merge'](_0x1e1be5[_0xa1b8('0x44')],{'$or':_[_0xa1b8('0x32')](_0x2374a6,function(_0x5e3fdb){if(_0x5e3fdb[_0xa1b8('0x36')]!==_0xa1b8('0x46')){var _0x41eeb9={};_0x41eeb9[_0x5e3fdb['name']]={'$like':'%'+_0x94165[_0xa1b8('0x38')][_0xa1b8('0x45')]+'%'};return _0x41eeb9;}})});}_0x1e1be5=_[_0xa1b8('0x47')]({},_0x1e1be5,_0x94165[_0xa1b8('0x48')]);var _0x4b2a34={'where':_0x1e1be5['where']};return db[_0xa1b8('0x33')][_0xa1b8('0x26')](_0x4b2a34)[_0xa1b8('0x2d')](function(_0x4b441e){_0xe0f037['count']=_0x4b441e;if(_0x94165[_0xa1b8('0x38')][_0xa1b8('0x49')]){_0x1e1be5['include']=[{'all':!![]}];}return db[_0xa1b8('0x33')][_0xa1b8('0x4a')](_0x1e1be5);})['then'](function(_0x2a845e){_0xe0f037[_0xa1b8('0x4b')]=_0x2a845e;return _0xe0f037;})[_0xa1b8('0x2d')](respondWithFilteredResult(_0x9d6571,_0x1e1be5))[_0xa1b8('0x4c')](handleError(_0x9d6571,null));};exports[_0xa1b8('0x4d')]=function(_0x29950a,_0x208c18){var _0x2590a6={'raw':![],'where':{'id':_0x29950a['params']['id']}},_0x4418c4={};_0x4418c4[_0xa1b8('0x4e')]=_['keys'](db[_0xa1b8('0x33')][_0xa1b8('0x34')]);_0x4418c4['query']=_[_0xa1b8('0x39')](_0x29950a[_0xa1b8('0x38')]);_0x4418c4[_0xa1b8('0x3a')]=_[_0xa1b8('0x3c')](_0x4418c4[_0xa1b8('0x4e')],_0x4418c4['query']);_0x2590a6[_0xa1b8('0x3b')]=_['intersection'](_0x4418c4[_0xa1b8('0x4e')],qs['fields'](_0x29950a[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x2590a6['attributes']=_0x2590a6[_0xa1b8('0x3b')][_0xa1b8('0x3e')]?_0x2590a6['attributes']:_0x4418c4['model'];if(_0x29950a[_0xa1b8('0x38')][_0xa1b8('0x49')]){_0x2590a6[_0xa1b8('0x4f')]=[{'all':!![]}];}_0x2590a6=_[_0xa1b8('0x47')]({},_0x2590a6,_0x29950a[_0xa1b8('0x48')]);return db[_0xa1b8('0x33')][_0xa1b8('0x50')](_0x2590a6)[_0xa1b8('0x2d')](handleEntityNotFound(_0x208c18,null))[_0xa1b8('0x2d')](respondWithResult(_0x208c18,null))['catch'](handleError(_0x208c18,null));};exports[_0xa1b8('0x51')]=function(_0x4f9a67,_0x2f88e0){return db['ServicenowConfiguration'][_0xa1b8('0x51')](_0x4f9a67[_0xa1b8('0x52')],{})[_0xa1b8('0x2d')](respondWithResult(_0x2f88e0,0xc9))[_0xa1b8('0x4c')](handleError(_0x2f88e0,null));};exports['update']=function(_0x49b31e,_0x47812c){if(_0x49b31e[_0xa1b8('0x52')]['id']){delete _0x49b31e[_0xa1b8('0x52')]['id'];}return db[_0xa1b8('0x33')]['find']({'where':{'id':_0x49b31e[_0xa1b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x47812c,null))[_0xa1b8('0x2d')](saveUpdates(_0x49b31e[_0xa1b8('0x52')],null))[_0xa1b8('0x2d')](respondWithResult(_0x47812c,null))['catch'](handleError(_0x47812c,null));};exports[_0xa1b8('0x2e')]=function(_0x538605,_0x3839de){return db[_0xa1b8('0x33')][_0xa1b8('0x50')]({'where':{'id':_0x538605[_0xa1b8('0x53')]['id']}})[_0xa1b8('0x2d')](handleEntityNotFound(_0x3839de,null))[_0xa1b8('0x2d')](removeEntity(_0x3839de,null))[_0xa1b8('0x4c')](handleError(_0x3839de,null));};exports['getFields']=function(_0x282ff4,_0x1e4326,_0x27f08a){var _0x2b08ab={};var _0x3f6ee0={};var _0x3ea37d;var _0x3052cc;return db[_0xa1b8('0x33')][_0xa1b8('0x54')]({'where':{'id':_0x282ff4[_0xa1b8('0x53')]['id']}})[_0xa1b8('0x2d')](handleEntityNotFound(_0x1e4326,null))[_0xa1b8('0x2d')](function(_0x1fb8f7){if(_0x1fb8f7){_0x3ea37d=_0x1fb8f7;_0x3f6ee0[_0xa1b8('0x4e')]=_[_0xa1b8('0x39')](db['ServicenowField'][_0xa1b8('0x34')]);_0x3f6ee0[_0xa1b8('0x38')]=_[_0xa1b8('0x39')](_0x282ff4[_0xa1b8('0x38')]);_0x3f6ee0[_0xa1b8('0x3a')]=_[_0xa1b8('0x3c')](_0x3f6ee0[_0xa1b8('0x4e')],_0x3f6ee0[_0xa1b8('0x38')]);_0x2b08ab['attributes']=_[_0xa1b8('0x3c')](_0x3f6ee0['model'],qs[_0xa1b8('0x3d')](_0x282ff4[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x2b08ab[_0xa1b8('0x3b')]=_0x2b08ab[_0xa1b8('0x3b')][_0xa1b8('0x3e')]?_0x2b08ab['attributes']:_0x3f6ee0[_0xa1b8('0x4e')];_0x2b08ab['order']=qs['sort'](_0x282ff4[_0xa1b8('0x38')][_0xa1b8('0x43')]);_0x2b08ab[_0xa1b8('0x44')]=qs['filters'](_[_0xa1b8('0x55')](_0x282ff4['query'],_0x3f6ee0[_0xa1b8('0x3a')]));if(_0x282ff4[_0xa1b8('0x38')]['filter']){_0x2b08ab[_0xa1b8('0x44')]=_[_0xa1b8('0x47')](_0x2b08ab['where'],{'$or':_[_0xa1b8('0x32')](_0x2b08ab['attributes'],function(_0xe5e76c){var _0x135e00={};_0x135e00[_0xe5e76c]={'$like':'%'+_0x282ff4[_0xa1b8('0x38')][_0xa1b8('0x45')]+'%'};return _0x135e00;})});}_0x2b08ab=_[_0xa1b8('0x47')]({},_0x2b08ab,_0x282ff4[_0xa1b8('0x48')]);return _0x3ea37d[_0xa1b8('0x56')](_0x2b08ab);}})['then'](function(_0x2fad0b){if(_0x2fad0b){_0x3052cc=_0x2fad0b[_0xa1b8('0x3e')];if(!_0x282ff4[_0xa1b8('0x38')]['hasOwnProperty'](_0xa1b8('0x40'))){_0x2b08ab['limit']=qs['limit'](_0x282ff4['query']['limit']);_0x2b08ab[_0xa1b8('0x41')]=qs[_0xa1b8('0x41')](_0x282ff4['query'][_0xa1b8('0x41')]);}return _0x3ea37d[_0xa1b8('0x56')](_0x2b08ab);}})[_0xa1b8('0x2d')](function(_0x2b3da2){if(_0x2b3da2){return _0x2b3da2?{'count':_0x3052cc,'rows':_0x2b3da2}:null;}})[_0xa1b8('0x2d')](respondWithResult(_0x1e4326,null))['catch'](handleError(_0x1e4326,null));};exports[_0xa1b8('0x57')]=function(_0x121a7c,_0x246722,_0x18dd8d){var _0x2f089c={};var _0x42c388={};var _0x1b9da7;var _0x5a95c3;return db[_0xa1b8('0x33')][_0xa1b8('0x54')]({'where':{'id':_0x121a7c[_0xa1b8('0x53')]['id']}})[_0xa1b8('0x2d')](handleEntityNotFound(_0x246722,null))[_0xa1b8('0x2d')](function(_0x1dc026){if(_0x1dc026){_0x1b9da7=_0x1dc026;_0x42c388['model']=_[_0xa1b8('0x39')](db['ServicenowField'][_0xa1b8('0x34')]);_0x42c388[_0xa1b8('0x38')]=_[_0xa1b8('0x39')](_0x121a7c[_0xa1b8('0x38')]);_0x42c388[_0xa1b8('0x3a')]=_['intersection'](_0x42c388[_0xa1b8('0x4e')],_0x42c388[_0xa1b8('0x38')]);_0x2f089c[_0xa1b8('0x3b')]=_[_0xa1b8('0x3c')](_0x42c388['model'],qs[_0xa1b8('0x3d')](_0x121a7c['query'][_0xa1b8('0x3d')]));_0x2f089c[_0xa1b8('0x3b')]=_0x2f089c['attributes'][_0xa1b8('0x3e')]?_0x2f089c[_0xa1b8('0x3b')]:_0x42c388[_0xa1b8('0x4e')];_0x2f089c[_0xa1b8('0x42')]=qs[_0xa1b8('0x43')](_0x121a7c[_0xa1b8('0x38')][_0xa1b8('0x43')]);_0x2f089c[_0xa1b8('0x44')]=qs[_0xa1b8('0x3a')](_[_0xa1b8('0x55')](_0x121a7c[_0xa1b8('0x38')],_0x42c388[_0xa1b8('0x3a')]));if(_0x121a7c['query']['filter']){_0x2f089c['where']=_[_0xa1b8('0x47')](_0x2f089c[_0xa1b8('0x44')],{'$or':_[_0xa1b8('0x32')](_0x2f089c[_0xa1b8('0x3b')],function(_0x5b2329){var _0x3ae645={};_0x3ae645[_0x5b2329]={'$like':'%'+_0x121a7c[_0xa1b8('0x38')]['filter']+'%'};return _0x3ae645;})});}_0x2f089c=_[_0xa1b8('0x47')]({},_0x2f089c,_0x121a7c['options']);return _0x1b9da7[_0xa1b8('0x57')](_0x2f089c);}})[_0xa1b8('0x2d')](function(_0x457f73){if(_0x457f73){_0x5a95c3=_0x457f73[_0xa1b8('0x3e')];if(!_0x121a7c['query'][_0xa1b8('0x3f')]('nolimit')){_0x2f089c['limit']=qs[_0xa1b8('0x27')](_0x121a7c[_0xa1b8('0x38')][_0xa1b8('0x27')]);_0x2f089c[_0xa1b8('0x41')]=qs['offset'](_0x121a7c[_0xa1b8('0x38')][_0xa1b8('0x41')]);}return _0x1b9da7[_0xa1b8('0x57')](_0x2f089c);}})[_0xa1b8('0x2d')](function(_0x6fae65){if(_0x6fae65){return _0x6fae65?{'count':_0x5a95c3,'rows':_0x6fae65}:null;}})[_0xa1b8('0x2d')](respondWithResult(_0x246722,null))[_0xa1b8('0x4c')](handleError(_0x246722,null));};exports['getDescriptions']=function(_0x5e8fa7,_0x38e579,_0xd5d459){var _0x408c16={};var _0x4d5379={};var _0x3c8fe0;var _0x43bfca;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x5e8fa7[_0xa1b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x38e579,null))[_0xa1b8('0x2d')](function(_0xd13cd3){if(_0xd13cd3){_0x3c8fe0=_0xd13cd3;_0x4d5379[_0xa1b8('0x4e')]=_[_0xa1b8('0x39')](db[_0xa1b8('0x58')]['rawAttributes']);_0x4d5379['query']=_[_0xa1b8('0x39')](_0x5e8fa7['query']);_0x4d5379[_0xa1b8('0x3a')]=_[_0xa1b8('0x3c')](_0x4d5379[_0xa1b8('0x4e')],_0x4d5379[_0xa1b8('0x38')]);_0x408c16[_0xa1b8('0x3b')]=_['intersection'](_0x4d5379[_0xa1b8('0x4e')],qs[_0xa1b8('0x3d')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x3d')]));_0x408c16[_0xa1b8('0x3b')]=_0x408c16[_0xa1b8('0x3b')]['length']?_0x408c16[_0xa1b8('0x3b')]:_0x4d5379[_0xa1b8('0x4e')];_0x408c16[_0xa1b8('0x42')]=qs[_0xa1b8('0x43')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x43')]);_0x408c16[_0xa1b8('0x44')]=qs['filters'](_[_0xa1b8('0x55')](_0x5e8fa7[_0xa1b8('0x38')],_0x4d5379[_0xa1b8('0x3a')]));if(_0x5e8fa7[_0xa1b8('0x38')]['filter']){_0x408c16['where']=_['merge'](_0x408c16[_0xa1b8('0x44')],{'$or':_[_0xa1b8('0x32')](_0x408c16[_0xa1b8('0x3b')],function(_0xd0c48c){var _0x3657fb={};_0x3657fb[_0xd0c48c]={'$like':'%'+_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x45')]+'%'};return _0x3657fb;})});}_0x408c16=_[_0xa1b8('0x47')]({},_0x408c16,_0x5e8fa7[_0xa1b8('0x48')]);return _0x3c8fe0[_0xa1b8('0x59')](_0x408c16);}})[_0xa1b8('0x2d')](function(_0x335da6){if(_0x335da6){_0x43bfca=_0x335da6[_0xa1b8('0x3e')];if(!_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x3f')](_0xa1b8('0x40'))){_0x408c16['limit']=qs[_0xa1b8('0x27')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x27')]);_0x408c16[_0xa1b8('0x41')]=qs[_0xa1b8('0x41')](_0x5e8fa7[_0xa1b8('0x38')][_0xa1b8('0x41')]);}return _0x3c8fe0[_0xa1b8('0x59')](_0x408c16);}})['then'](function(_0x3b6735){if(_0x3b6735){return _0x3b6735?{'count':_0x43bfca,'rows':_0x3b6735}:null;}})[_0xa1b8('0x2d')](respondWithResult(_0x38e579,null))[_0xa1b8('0x4c')](handleError(_0x38e579,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 37933d3..36ad74e 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 _0xa43e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x2e0a0c,_0x3fd647){var _0x3a20d7=function(_0x563222){while(--_0x563222){_0x2e0a0c['push'](_0x2e0a0c['shift']());}};_0x3a20d7(++_0x3fd647);}(_0xa43e,0x13f));var _0xea43=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa43e[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xea43('0x0'));var util=require(_0xea43('0x1'));var logger=require(_0xea43('0x2'))('api');var moment=require(_0xea43('0x3'));var BPromise=require(_0xea43('0x4'));var rp=require(_0xea43('0x5'));var fs=require('fs');var path=require(_0xea43('0x6'));var rimraf=require(_0xea43('0x7'));var config=require(_0xea43('0x8'));var attributes=require(_0xea43('0x9'));module[_0xea43('0xa')]=function(_0x222e43,_0x3cfea1){return _0x222e43[_0xea43('0xb')](_0xea43('0xc'),attributes,{'tableName':_0xea43('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba49=['api','moment','bluebird','rimraf','../../config/environment','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x1aaf72,_0x4f223a){var _0x3ecad0=function(_0x553981){while(--_0x553981){_0x1aaf72['push'](_0x1aaf72['shift']());}};_0x3ecad0(++_0x4f223a);}(_0xba49,0xad));var _0x9ba4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xba49[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x9ba4('0x0'));var util=require(_0x9ba4('0x1'));var logger=require(_0x9ba4('0x2'))(_0x9ba4('0x3'));var moment=require(_0x9ba4('0x4'));var BPromise=require(_0x9ba4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba4('0x6'));var config=require(_0x9ba4('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x9ba4('0x8')]=function(_0x3bd007,_0x4fe9a0){return _0x3bd007[_0x9ba4('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x9ba4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 75e466c..6164b90 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 _0x6f3c=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x123450,_0x491c01){var _0x23b29d=function(_0x2c23cb){while(--_0x2c23cb){_0x123450['push'](_0x123450['shift']());}};_0x23b29d(++_0x491c01);}(_0x6f3c,0x1d0));var _0xc6f3=function(_0xbbc8b3,_0x56c328){_0xbbc8b3=_0xbbc8b3-0x0;var _0x434d6c=_0x6f3c[_0xbbc8b3];return _0x434d6c;};'use strict';var _=require(_0xc6f3('0x0'));var util=require(_0xc6f3('0x1'));var moment=require(_0xc6f3('0x2'));var BPromise=require(_0xc6f3('0x3'));var rs=require(_0xc6f3('0x4'));var fs=require('fs');var Redis=require(_0xc6f3('0x5'));var db=require(_0xc6f3('0x6'))['db'];var utils=require(_0xc6f3('0x7'));var logger=require(_0xc6f3('0x8'))(_0xc6f3('0x9'));var config=require(_0xc6f3('0xa'));var jayson=require(_0xc6f3('0xb'));var client=jayson[_0xc6f3('0xc')][_0xc6f3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x48f51a,_0x45690d,_0x2d8f8f){return new BPromise(function(_0x3bd8d7,_0x12e449){return client[_0xc6f3('0xe')](_0x48f51a,_0x2d8f8f)[_0xc6f3('0xf')](function(_0x252dd8){logger[_0xc6f3('0x10')](_0xc6f3('0x11'),_0x45690d,_0xc6f3('0x12'));logger[_0xc6f3('0x13')](_0xc6f3('0x14'),_0x45690d,_0xc6f3('0x12'),JSON[_0xc6f3('0x15')](_0x252dd8));if(_0x252dd8[_0xc6f3('0x16')]){if(_0x252dd8[_0xc6f3('0x16')][_0xc6f3('0x17')]===0x1f4){logger[_0xc6f3('0x16')](_0xc6f3('0x11'),_0x45690d,_0x252dd8['error'][_0xc6f3('0x18')]);return _0x12e449(_0x252dd8['error'][_0xc6f3('0x18')]);}logger[_0xc6f3('0x16')](_0xc6f3('0x11'),_0x45690d,_0x252dd8[_0xc6f3('0x16')][_0xc6f3('0x18')]);return _0x3bd8d7(_0x252dd8[_0xc6f3('0x16')][_0xc6f3('0x18')]);}else{logger[_0xc6f3('0x10')](_0xc6f3('0x11'),_0x45690d,_0xc6f3('0x12'));_0x3bd8d7(_0x252dd8[_0xc6f3('0x19')][_0xc6f3('0x18')]);}})[_0xc6f3('0x1a')](function(_0x21e0de){logger[_0xc6f3('0x16')](_0xc6f3('0x11'),_0x45690d,_0x21e0de);_0x12e449(_0x21e0de);});});} \ No newline at end of file +var _0x4481=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4481,0x160));var _0x1448=function(_0x564308,_0x5bb087){_0x564308=_0x564308-0x0;var _0x3df3b1=_0x4481[_0x564308];return _0x3df3b1;};'use strict';var _=require(_0x1448('0x0'));var util=require(_0x1448('0x1'));var moment=require(_0x1448('0x2'));var BPromise=require(_0x1448('0x3'));var rs=require(_0x1448('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1448('0x5'))['db'];var utils=require(_0x1448('0x6'));var logger=require(_0x1448('0x7'))(_0x1448('0x8'));var config=require(_0x1448('0x9'));var jayson=require(_0x1448('0xa'));var client=jayson[_0x1448('0xb')][_0x1448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d5707,_0x7b640b,_0x24b1a9){return new BPromise(function(_0x4d6665,_0x59c372){return client['request'](_0x2d5707,_0x24b1a9)[_0x1448('0xd')](function(_0x5451ae){logger['info'](_0x1448('0xe'),_0x7b640b,_0x1448('0xf'));logger[_0x1448('0x10')](_0x1448('0x11'),_0x7b640b,'request\x20sent',JSON[_0x1448('0x12')](_0x5451ae));if(_0x5451ae[_0x1448('0x13')]){if(_0x5451ae['error']['code']===0x1f4){logger[_0x1448('0x13')](_0x1448('0xe'),_0x7b640b,_0x5451ae[_0x1448('0x13')][_0x1448('0x14')]);return _0x59c372(_0x5451ae[_0x1448('0x13')][_0x1448('0x14')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x7b640b,_0x5451ae['error']['message']);return _0x4d6665(_0x5451ae[_0x1448('0x13')][_0x1448('0x14')]);}else{logger[_0x1448('0x15')](_0x1448('0xe'),_0x7b640b,_0x1448('0xf'));_0x4d6665(_0x5451ae['result'][_0x1448('0x14')]);}})[_0x1448('0x16')](function(_0x19324){logger['error'](_0x1448('0xe'),_0x7b640b,_0x19324);_0x59c372(_0x19324);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 38034b3..645f345 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 _0xddf8=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5e39aa,_0x587537){var _0xbfa068=function(_0x48dbd4){while(--_0x48dbd4){_0x5e39aa['push'](_0x5e39aa['shift']());}};_0xbfa068(++_0x587537);}(_0xddf8,0xcb));var _0x8ddf=function(_0x3fc3bb,_0xb00c65){_0x3fc3bb=_0x3fc3bb-0x0;var _0xf21227=_0xddf8[_0x3fc3bb];return _0xf21227;};'use strict';var multer=require(_0x8ddf('0x0'));var util=require(_0x8ddf('0x1'));var path=require(_0x8ddf('0x2'));var timeout=require(_0x8ddf('0x3'));var express=require(_0x8ddf('0x4'));var router=express[_0x8ddf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ddf('0x6'));var config=require('../../config/environment');var controller=require(_0x8ddf('0x7'));router[_0x8ddf('0x8')]('/',auth[_0x8ddf('0x9')](),controller[_0x8ddf('0xa')]);router[_0x8ddf('0x8')](_0x8ddf('0xb'),auth[_0x8ddf('0x9')](),controller[_0x8ddf('0xc')]);router[_0x8ddf('0xd')]('/',auth[_0x8ddf('0x9')](),controller[_0x8ddf('0xe')]);router[_0x8ddf('0xf')](_0x8ddf('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8ddf('0x10')](_0x8ddf('0xb'),auth[_0x8ddf('0x9')](),controller[_0x8ddf('0x11')]);module[_0x8ddf('0x12')]=router; \ No newline at end of file +var _0x0ac6=['create','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x0ac6,0x16d));var _0x60ac=function(_0x3e078a,_0x115745){_0x3e078a=_0x3e078a-0x0;var _0x333e5c=_0x0ac6[_0x3e078a];return _0x333e5c;};'use strict';var multer=require(_0x60ac('0x0'));var util=require('util');var path=require(_0x60ac('0x1'));var timeout=require(_0x60ac('0x2'));var express=require(_0x60ac('0x3'));var router=express['Router']();var auth=require(_0x60ac('0x4'));var interaction=require(_0x60ac('0x5'));var config=require(_0x60ac('0x6'));var controller=require(_0x60ac('0x7'));router[_0x60ac('0x8')]('/',auth[_0x60ac('0x9')](),controller[_0x60ac('0xa')]);router[_0x60ac('0x8')](_0x60ac('0xb'),auth[_0x60ac('0x9')](),controller['show']);router[_0x60ac('0xc')]('/',auth[_0x60ac('0x9')](),controller[_0x60ac('0xd')]);router[_0x60ac('0xe')](_0x60ac('0xb'),auth[_0x60ac('0x9')](),controller[_0x60ac('0xf')]);router[_0x60ac('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x60ac('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9d8d5be..a0fc33b 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 _0xab2a=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','string','STRING'];(function(_0x3ed495,_0x5b06fd){var _0xdfd441=function(_0x2c31a6){while(--_0x2c31a6){_0x3ed495['push'](_0x3ed495['shift']());}};_0xdfd441(++_0x5b06fd);}(_0xab2a,0x1a1));var _0xaab2=function(_0x4f2e68,_0x205ecb){_0x4f2e68=_0x4f2e68-0x0;var _0x54e9e5=_0xab2a[_0x4f2e68];return _0x54e9e5;};'use strict';var Sequelize=require(_0xaab2('0x0'));module[_0xaab2('0x1')]={'type':{'type':Sequelize[_0xaab2('0x2')]('string',_0xaab2('0x3'),'customVariable',_0xaab2('0x4')),'defaultValue':_0xaab2('0x5')},'content':{'type':Sequelize[_0xaab2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaab2('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaab2('0x6')]},'nameField':{'type':Sequelize[_0xaab2('0x6')]},'customField':{'type':Sequelize[_0xaab2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaab2('0x6')]}}; \ No newline at end of file +var _0x6e2a=['variable','customVariable','keyValue','string','STRING','sequelize','ENUM'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6e2a,0x140));var _0xa6e2=function(_0x5dbc8d,_0x10d22f){_0x5dbc8d=_0x5dbc8d-0x0;var _0x2bc6c0=_0x6e2a[_0x5dbc8d];return _0x2bc6c0;};'use strict';var Sequelize=require(_0xa6e2('0x0'));module['exports']={'type':{'type':Sequelize[_0xa6e2('0x1')]('string',_0xa6e2('0x2'),_0xa6e2('0x3'),_0xa6e2('0x4')),'defaultValue':_0xa6e2('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa6e2('0x1')]('string','variable',_0xa6e2('0x3'))},'keyContent':{'type':Sequelize[_0xa6e2('0x6')]},'idField':{'type':Sequelize[_0xa6e2('0x6')]},'nameField':{'type':Sequelize[_0xa6e2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6e2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 76e68c2..943405a 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 _0x7510=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys'];(function(_0x5a6bfd,_0x3b89ff){var _0x264a3a=function(_0x5ec77a){while(--_0x5ec77a){_0x5a6bfd['push'](_0x5a6bfd['shift']());}};_0x264a3a(++_0x3b89ff);}(_0x7510,0xa9));var _0x0751=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7510[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0751('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0751('0x1'));var jsonpatch=require(_0x0751('0x2'));var rp=require(_0x0751('0x3'));var moment=require('moment');var BPromise=require(_0x0751('0x4'));var Mustache=require(_0x0751('0x5'));var util=require(_0x0751('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0751('0x7'));var squel=require('squel');var crypto=require(_0x0751('0x8'));var jsforce=require(_0x0751('0x9'));var deskjs=require(_0x0751('0xa'));var toCsv=require(_0x0751('0xb'));var querystring=require(_0x0751('0xc'));var Papa=require(_0x0751('0xd'));var Redis=require(_0x0751('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0751('0xf'));var as=require(_0x0751('0x10'));var hardwareService=require(_0x0751('0x11'));var logger=require(_0x0751('0x12'))(_0x0751('0x13'));var utils=require('../../config/utils');var config=require(_0x0751('0x14'));var licenseUtil=require(_0x0751('0x15'));var db=require(_0x0751('0x16'))['db'];function respondWithStatusCode(_0x16b239,_0x340a1d){_0x340a1d=_0x340a1d||0xcc;return function(_0x2bda65){if(_0x2bda65){return _0x16b239['sendStatus'](_0x340a1d);}return _0x16b239['status'](_0x340a1d)[_0x0751('0x17')]();};}function respondWithResult(_0x12110b,_0x1dc807){_0x1dc807=_0x1dc807||0xc8;return function(_0x2c32af){if(_0x2c32af){return _0x12110b[_0x0751('0x18')](_0x1dc807)[_0x0751('0x19')](_0x2c32af);}};}function respondWithFilteredResult(_0x4a3c0e,_0x459c8f){return function(_0x56c928){if(_0x56c928){var _0x1a3e87=_0x56c928[_0x0751('0x1a')],_0x6545db=_0x459c8f[_0x0751('0x1b')],_0xea2eec=_0x459c8f[_0x0751('0x1b')]+_0x459c8f[_0x0751('0x1c')],_0x1d4be0;if(_0xea2eec>=_0x1a3e87){_0xea2eec=_0x1a3e87;_0x1d4be0=0xc8;}else{_0x1d4be0=0xce;}_0x4a3c0e[_0x0751('0x18')](_0x1d4be0);return _0x4a3c0e['set'](_0x0751('0x1d'),_0x6545db+'-'+_0xea2eec+'/'+_0x1a3e87)[_0x0751('0x19')](_0x56c928);}return null;};}function patchUpdates(_0x305efd){return function(_0x311fcd){try{jsonpatch[_0x0751('0x1e')](_0x311fcd,_0x305efd,!![]);}catch(_0x2c2a6e){return BPromise['reject'](_0x2c2a6e);}return _0x311fcd['save']();};}function saveUpdates(_0x13500f,_0x153564){return function(_0x26ff5d){if(_0x26ff5d){return _0x26ff5d[_0x0751('0x1f')](_0x13500f)['then'](function(_0x2630cb){return _0x2630cb;});}return null;};}function removeEntity(_0x2e72a8,_0x2eacee){return function(_0x156417){if(_0x156417){return _0x156417[_0x0751('0x20')]()[_0x0751('0x21')](function(){_0x2e72a8[_0x0751('0x18')](0xcc)[_0x0751('0x17')]();});}};}function handleEntityNotFound(_0x34734a,_0x578172){return function(_0x20b1e3){if(!_0x20b1e3){_0x34734a[_0x0751('0x22')](0x194);}return _0x20b1e3;};}function handleError(_0x20b055,_0x5a237d){_0x5a237d=_0x5a237d||0x1f4;return function(_0xcba6a9){logger[_0x0751('0x23')](_0xcba6a9[_0x0751('0x24')]);if(_0xcba6a9[_0x0751('0x25')]){delete _0xcba6a9[_0x0751('0x25')];}_0x20b055[_0x0751('0x18')](_0x5a237d)[_0x0751('0x26')](_0xcba6a9);};}exports['index']=function(_0x165c59,_0x4bc374){var _0x507b41={},_0x2c5130={},_0x448d93={'count':0x0,'rows':[]};var _0x16171c=_[_0x0751('0x27')](db[_0x0751('0x28')][_0x0751('0x29')],function(_0x327415){return{'name':_0x327415[_0x0751('0x2a')],'type':_0x327415[_0x0751('0x2b')][_0x0751('0x2c')]};});_0x2c5130['model']=_[_0x0751('0x27')](_0x16171c,_0x0751('0x25'));_0x2c5130[_0x0751('0x2d')]=_[_0x0751('0x2e')](_0x165c59[_0x0751('0x2d')]);_0x2c5130[_0x0751('0x2f')]=_[_0x0751('0x30')](_0x2c5130[_0x0751('0x31')],_0x2c5130[_0x0751('0x2d')]);_0x507b41['attributes']=_[_0x0751('0x30')](_0x2c5130[_0x0751('0x31')],qs[_0x0751('0x32')](_0x165c59['query'][_0x0751('0x32')]));_0x507b41[_0x0751('0x33')]=_0x507b41['attributes'][_0x0751('0x34')]?_0x507b41[_0x0751('0x33')]:_0x2c5130[_0x0751('0x31')];if(!_0x165c59[_0x0751('0x2d')][_0x0751('0x35')](_0x0751('0x36'))){_0x507b41['limit']=qs[_0x0751('0x1c')](_0x165c59[_0x0751('0x2d')][_0x0751('0x1c')]);_0x507b41[_0x0751('0x1b')]=qs['offset'](_0x165c59[_0x0751('0x2d')][_0x0751('0x1b')]);}_0x507b41[_0x0751('0x37')]=qs['sort'](_0x165c59[_0x0751('0x2d')][_0x0751('0x38')]);_0x507b41['where']=qs[_0x0751('0x2f')](_[_0x0751('0x39')](_0x165c59[_0x0751('0x2d')],_0x2c5130[_0x0751('0x2f')]),_0x16171c);if(_0x165c59[_0x0751('0x2d')][_0x0751('0x3a')]){_0x507b41[_0x0751('0x3b')]=_['merge'](_0x507b41[_0x0751('0x3b')],{'$or':_[_0x0751('0x27')](_0x16171c,function(_0x41e4af){if(_0x41e4af['type']!=='VIRTUAL'){var _0x338a58={};_0x338a58[_0x41e4af[_0x0751('0x25')]]={'$like':'%'+_0x165c59[_0x0751('0x2d')][_0x0751('0x3a')]+'%'};return _0x338a58;}})});}_0x507b41=_[_0x0751('0x3c')]({},_0x507b41,_0x165c59[_0x0751('0x3d')]);var _0x3307df={'where':_0x507b41[_0x0751('0x3b')]};return db[_0x0751('0x28')][_0x0751('0x1a')](_0x3307df)['then'](function(_0x5dd702){_0x448d93[_0x0751('0x1a')]=_0x5dd702;if(_0x165c59[_0x0751('0x2d')][_0x0751('0x3e')]){_0x507b41[_0x0751('0x3f')]=[{'all':!![]}];}return db[_0x0751('0x28')][_0x0751('0x40')](_0x507b41);})[_0x0751('0x21')](function(_0x28731a){_0x448d93[_0x0751('0x41')]=_0x28731a;return _0x448d93;})['then'](respondWithFilteredResult(_0x4bc374,_0x507b41))[_0x0751('0x42')](handleError(_0x4bc374,null));};exports[_0x0751('0x43')]=function(_0x2717d2,_0x53524b){var _0xf123c3={'raw':!![],'where':{'id':_0x2717d2['params']['id']}},_0xcc89b1={};_0xcc89b1[_0x0751('0x31')]=_['keys'](db[_0x0751('0x28')][_0x0751('0x29')]);_0xcc89b1['query']=_['keys'](_0x2717d2[_0x0751('0x2d')]);_0xcc89b1[_0x0751('0x2f')]=_['intersection'](_0xcc89b1[_0x0751('0x31')],_0xcc89b1[_0x0751('0x2d')]);_0xf123c3['attributes']=_[_0x0751('0x30')](_0xcc89b1[_0x0751('0x31')],qs['fields'](_0x2717d2[_0x0751('0x2d')]['fields']));_0xf123c3[_0x0751('0x33')]=_0xf123c3[_0x0751('0x33')][_0x0751('0x34')]?_0xf123c3[_0x0751('0x33')]:_0xcc89b1[_0x0751('0x31')];if(_0x2717d2[_0x0751('0x2d')][_0x0751('0x3e')]){_0xf123c3[_0x0751('0x3f')]=[{'all':!![]}];}_0xf123c3=_[_0x0751('0x3c')]({},_0xf123c3,_0x2717d2[_0x0751('0x3d')]);return db[_0x0751('0x28')][_0x0751('0x44')](_0xf123c3)[_0x0751('0x21')](handleEntityNotFound(_0x53524b,null))[_0x0751('0x21')](respondWithResult(_0x53524b,null))[_0x0751('0x42')](handleError(_0x53524b,null));};exports[_0x0751('0x45')]=function(_0x1bf1fa,_0x4a0a53){return db[_0x0751('0x28')][_0x0751('0x45')](_0x1bf1fa[_0x0751('0x46')],{})['then'](respondWithResult(_0x4a0a53,0xc9))[_0x0751('0x42')](handleError(_0x4a0a53,null));};exports[_0x0751('0x1f')]=function(_0x414ac6,_0x1bebc2){if(_0x414ac6[_0x0751('0x46')]['id']){delete _0x414ac6[_0x0751('0x46')]['id'];}return db['ServicenowField'][_0x0751('0x44')]({'where':{'id':_0x414ac6[_0x0751('0x47')]['id']}})[_0x0751('0x21')](handleEntityNotFound(_0x1bebc2,null))[_0x0751('0x21')](saveUpdates(_0x414ac6[_0x0751('0x46')],null))[_0x0751('0x21')](respondWithResult(_0x1bebc2,null))[_0x0751('0x42')](handleError(_0x1bebc2,null));};exports[_0x0751('0x20')]=function(_0x1ab7d6,_0x3fbc19){return db[_0x0751('0x28')][_0x0751('0x44')]({'where':{'id':_0x1ab7d6[_0x0751('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fbc19,null))[_0x0751('0x21')](removeEntity(_0x3fbc19,null))[_0x0751('0x42')](handleError(_0x3fbc19,null));}; \ No newline at end of file +var _0x9bc7=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','fieldName','type','model','map','keys','filters','intersection','attributes','fields','query','length','nolimit','order','filter','where','merge','VIRTUAL','options','ServicenowField','include','rows','catch','params','rawAttributes','find','create','body','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9bc7[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x79bc('0x0'));var emlformat=require(_0x79bc('0x1'));var rimraf=require(_0x79bc('0x2'));var zipdir=require(_0x79bc('0x3'));var jsonpatch=require(_0x79bc('0x4'));var rp=require(_0x79bc('0x5'));var moment=require(_0x79bc('0x6'));var BPromise=require(_0x79bc('0x7'));var Mustache=require(_0x79bc('0x8'));var util=require(_0x79bc('0x9'));var path=require('path');var sox=require(_0x79bc('0xa'));var csv=require(_0x79bc('0xb'));var ejs=require(_0x79bc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x79bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x79bc('0xe'));var deskjs=require(_0x79bc('0xf'));var toCsv=require(_0x79bc('0xb'));var querystring=require(_0x79bc('0x10'));var Papa=require(_0x79bc('0x11'));var Redis=require('ioredis');var authService=require(_0x79bc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x79bc('0x13'));var hardwareService=require(_0x79bc('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x79bc('0x15'));var config=require(_0x79bc('0x16'));var licenseUtil=require(_0x79bc('0x17'));var db=require(_0x79bc('0x18'))['db'];function respondWithStatusCode(_0x174eff,_0x401de9){_0x401de9=_0x401de9||0xcc;return function(_0x29e987){if(_0x29e987){return _0x174eff[_0x79bc('0x19')](_0x401de9);}return _0x174eff['status'](_0x401de9)[_0x79bc('0x1a')]();};}function respondWithResult(_0x57530f,_0x404adf){_0x404adf=_0x404adf||0xc8;return function(_0x2ee065){if(_0x2ee065){return _0x57530f[_0x79bc('0x1b')](_0x404adf)[_0x79bc('0x1c')](_0x2ee065);}};}function respondWithFilteredResult(_0x564d68,_0x21cb53){return function(_0x3e4244){if(_0x3e4244){var _0x510906=_0x3e4244[_0x79bc('0x1d')],_0x1b3b2c=_0x21cb53['offset'],_0x561e9a=_0x21cb53[_0x79bc('0x1e')]+_0x21cb53[_0x79bc('0x1f')],_0x403ebe;if(_0x561e9a>=_0x510906){_0x561e9a=_0x510906;_0x403ebe=0xc8;}else{_0x403ebe=0xce;}_0x564d68[_0x79bc('0x1b')](_0x403ebe);return _0x564d68[_0x79bc('0x20')](_0x79bc('0x21'),_0x1b3b2c+'-'+_0x561e9a+'/'+_0x510906)['json'](_0x3e4244);}return null;};}function patchUpdates(_0x30e0fb){return function(_0x2f3b0c){try{jsonpatch[_0x79bc('0x22')](_0x2f3b0c,_0x30e0fb,!![]);}catch(_0x269d07){return BPromise['reject'](_0x269d07);}return _0x2f3b0c[_0x79bc('0x23')]();};}function saveUpdates(_0x52a423,_0x51282d){return function(_0xb7ab74){if(_0xb7ab74){return _0xb7ab74[_0x79bc('0x24')](_0x52a423)[_0x79bc('0x25')](function(_0x533720){return _0x533720;});}return null;};}function removeEntity(_0xc9c88a,_0x3cbe59){return function(_0x1a62fa){if(_0x1a62fa){return _0x1a62fa[_0x79bc('0x26')]()[_0x79bc('0x25')](function(){_0xc9c88a[_0x79bc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc690,_0x307147){return function(_0x36da6f){if(!_0x36da6f){_0x5bc690[_0x79bc('0x19')](0x194);}return _0x36da6f;};}function handleError(_0x3a2467,_0x27b266){_0x27b266=_0x27b266||0x1f4;return function(_0x121a28){logger[_0x79bc('0x27')](_0x121a28[_0x79bc('0x28')]);if(_0x121a28[_0x79bc('0x29')]){delete _0x121a28[_0x79bc('0x29')];}_0x3a2467[_0x79bc('0x1b')](_0x27b266)[_0x79bc('0x2a')](_0x121a28);};}exports['index']=function(_0x4b3eb9,_0x32a531){var _0x18f21e={},_0x5bee88={},_0x1d6141={'count':0x0,'rows':[]};var _0x2aa24d=_['map'](db['ServicenowField']['rawAttributes'],function(_0x143bb3){return{'name':_0x143bb3[_0x79bc('0x2b')],'type':_0x143bb3[_0x79bc('0x2c')]['key']};});_0x5bee88[_0x79bc('0x2d')]=_[_0x79bc('0x2e')](_0x2aa24d,'name');_0x5bee88['query']=_[_0x79bc('0x2f')](_0x4b3eb9['query']);_0x5bee88[_0x79bc('0x30')]=_[_0x79bc('0x31')](_0x5bee88[_0x79bc('0x2d')],_0x5bee88['query']);_0x18f21e[_0x79bc('0x32')]=_['intersection'](_0x5bee88[_0x79bc('0x2d')],qs[_0x79bc('0x33')](_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x33')]));_0x18f21e[_0x79bc('0x32')]=_0x18f21e['attributes'][_0x79bc('0x35')]?_0x18f21e[_0x79bc('0x32')]:_0x5bee88[_0x79bc('0x2d')];if(!_0x4b3eb9[_0x79bc('0x34')]['hasOwnProperty'](_0x79bc('0x36'))){_0x18f21e[_0x79bc('0x1f')]=qs['limit'](_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x1f')]);_0x18f21e[_0x79bc('0x1e')]=qs['offset'](_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x1e')]);}_0x18f21e[_0x79bc('0x37')]=qs['sort'](_0x4b3eb9[_0x79bc('0x34')]['sort']);_0x18f21e['where']=qs[_0x79bc('0x30')](_['pick'](_0x4b3eb9[_0x79bc('0x34')],_0x5bee88[_0x79bc('0x30')]),_0x2aa24d);if(_0x4b3eb9[_0x79bc('0x34')][_0x79bc('0x38')]){_0x18f21e[_0x79bc('0x39')]=_[_0x79bc('0x3a')](_0x18f21e['where'],{'$or':_['map'](_0x2aa24d,function(_0x1dafbb){if(_0x1dafbb[_0x79bc('0x2c')]!==_0x79bc('0x3b')){var _0x510aae={};_0x510aae[_0x1dafbb[_0x79bc('0x29')]]={'$like':'%'+_0x4b3eb9['query']['filter']+'%'};return _0x510aae;}})});}_0x18f21e=_[_0x79bc('0x3a')]({},_0x18f21e,_0x4b3eb9[_0x79bc('0x3c')]);var _0xbb2ede={'where':_0x18f21e[_0x79bc('0x39')]};return db[_0x79bc('0x3d')][_0x79bc('0x1d')](_0xbb2ede)[_0x79bc('0x25')](function(_0x2f1141){_0x1d6141[_0x79bc('0x1d')]=_0x2f1141;if(_0x4b3eb9[_0x79bc('0x34')]['includeAll']){_0x18f21e[_0x79bc('0x3e')]=[{'all':!![]}];}return db[_0x79bc('0x3d')]['findAll'](_0x18f21e);})[_0x79bc('0x25')](function(_0x2576ac){_0x1d6141[_0x79bc('0x3f')]=_0x2576ac;return _0x1d6141;})[_0x79bc('0x25')](respondWithFilteredResult(_0x32a531,_0x18f21e))[_0x79bc('0x40')](handleError(_0x32a531,null));};exports['show']=function(_0x3da2d9,_0x3ea23c){var _0x3d96a4={'raw':!![],'where':{'id':_0x3da2d9[_0x79bc('0x41')]['id']}},_0x3b9494={};_0x3b9494[_0x79bc('0x2d')]=_[_0x79bc('0x2f')](db[_0x79bc('0x3d')][_0x79bc('0x42')]);_0x3b9494[_0x79bc('0x34')]=_[_0x79bc('0x2f')](_0x3da2d9['query']);_0x3b9494[_0x79bc('0x30')]=_[_0x79bc('0x31')](_0x3b9494[_0x79bc('0x2d')],_0x3b9494[_0x79bc('0x34')]);_0x3d96a4[_0x79bc('0x32')]=_[_0x79bc('0x31')](_0x3b9494[_0x79bc('0x2d')],qs[_0x79bc('0x33')](_0x3da2d9[_0x79bc('0x34')][_0x79bc('0x33')]));_0x3d96a4[_0x79bc('0x32')]=_0x3d96a4[_0x79bc('0x32')]['length']?_0x3d96a4[_0x79bc('0x32')]:_0x3b9494[_0x79bc('0x2d')];if(_0x3da2d9[_0x79bc('0x34')]['includeAll']){_0x3d96a4['include']=[{'all':!![]}];}_0x3d96a4=_[_0x79bc('0x3a')]({},_0x3d96a4,_0x3da2d9[_0x79bc('0x3c')]);return db[_0x79bc('0x3d')][_0x79bc('0x43')](_0x3d96a4)['then'](handleEntityNotFound(_0x3ea23c,null))[_0x79bc('0x25')](respondWithResult(_0x3ea23c,null))[_0x79bc('0x40')](handleError(_0x3ea23c,null));};exports['create']=function(_0x560ccf,_0x984270){return db[_0x79bc('0x3d')][_0x79bc('0x44')](_0x560ccf[_0x79bc('0x45')],{})[_0x79bc('0x25')](respondWithResult(_0x984270,0xc9))[_0x79bc('0x40')](handleError(_0x984270,null));};exports['update']=function(_0x519be4,_0x1e86cd){if(_0x519be4[_0x79bc('0x45')]['id']){delete _0x519be4[_0x79bc('0x45')]['id'];}return db[_0x79bc('0x3d')]['find']({'where':{'id':_0x519be4[_0x79bc('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e86cd,null))[_0x79bc('0x25')](saveUpdates(_0x519be4[_0x79bc('0x45')],null))[_0x79bc('0x25')](respondWithResult(_0x1e86cd,null))['catch'](handleError(_0x1e86cd,null));};exports[_0x79bc('0x26')]=function(_0x43388d,_0x4c7d28){return db[_0x79bc('0x3d')][_0x79bc('0x43')]({'where':{'id':_0x43388d[_0x79bc('0x41')]['id']}})[_0x79bc('0x25')](handleEntityNotFound(_0x4c7d28,null))[_0x79bc('0x25')](removeEntity(_0x4c7d28,null))[_0x79bc('0x40')](handleError(_0x4c7d28,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 753a50f..5e429a8 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 _0xeb02=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','idField','lodash','util'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xeb02,0xe8));var _0x2eb0=function(_0x2ad9b3,_0x4b77a1){_0x2ad9b3=_0x2ad9b3-0x0;var _0x43fce5=_0xeb02[_0x2ad9b3];return _0x43fce5;};'use strict';var _=require(_0x2eb0('0x0'));var util=require(_0x2eb0('0x1'));var logger=require('../../config/logger')(_0x2eb0('0x2'));var moment=require(_0x2eb0('0x3'));var BPromise=require(_0x2eb0('0x4'));var rp=require(_0x2eb0('0x5'));var fs=require('fs');var path=require(_0x2eb0('0x6'));var rimraf=require(_0x2eb0('0x7'));var config=require(_0x2eb0('0x8'));var attributes=require(_0x2eb0('0x9'));module[_0x2eb0('0xa')]=function(_0x1638eb,_0x1dee70){return _0x1638eb['define'](_0x2eb0('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x2eb0('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45bb=['FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField'];(function(_0x3dda0f,_0x5b9902){var _0x1b0488=function(_0x267031){while(--_0x267031){_0x3dda0f['push'](_0x3dda0f['shift']());}};_0x1b0488(++_0x5b9902);}(_0x45bb,0xaa));var _0xb45b=function(_0x562396,_0x20689e){_0x562396=_0x562396-0x0;var _0xb7f76=_0x45bb[_0x562396];return _0xb7f76;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb45b('0x0'))(_0xb45b('0x1'));var moment=require(_0xb45b('0x2'));var BPromise=require(_0xb45b('0x3'));var rp=require(_0xb45b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb45b('0x5'));var config=require(_0xb45b('0x6'));var attributes=require(_0xb45b('0x7'));module[_0xb45b('0x8')]=function(_0x3cb979,_0x246b87){return _0x3cb979[_0xb45b('0x9')]('ServicenowField',attributes,{'tableName':_0xb45b('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xb45b('0xb'),_0xb45b('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 1d70cc6..e27311a 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 _0xce49=['ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xce49,0x192));var _0x9ce4=function(_0x1075ab,_0x29f957){_0x1075ab=_0x1075ab-0x0;var _0x5998aa=_0xce49[_0x1075ab];return _0x5998aa;};'use strict';var _=require(_0x9ce4('0x0'));var util=require(_0x9ce4('0x1'));var moment=require(_0x9ce4('0x2'));var BPromise=require(_0x9ce4('0x3'));var rs=require(_0x9ce4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ce4('0x5'))['db'];var utils=require(_0x9ce4('0x6'));var logger=require(_0x9ce4('0x7'))('rpc');var config=require(_0x9ce4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ce4('0x9')][_0x9ce4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc88221,_0x44ce85,_0x1fa11f){return new BPromise(function(_0x2386a5,_0x449c5b){return client[_0x9ce4('0xb')](_0xc88221,_0x1fa11f)['then'](function(_0x84f74){logger[_0x9ce4('0xc')](_0x9ce4('0xd'),_0x44ce85,_0x9ce4('0xe'));logger[_0x9ce4('0xf')](_0x9ce4('0x10'),_0x44ce85,'request\x20sent',JSON[_0x9ce4('0x11')](_0x84f74));if(_0x84f74[_0x9ce4('0x12')]){if(_0x84f74[_0x9ce4('0x12')]['code']===0x1f4){logger[_0x9ce4('0x12')](_0x9ce4('0xd'),_0x44ce85,_0x84f74[_0x9ce4('0x12')][_0x9ce4('0x13')]);return _0x449c5b(_0x84f74[_0x9ce4('0x12')]['message']);}logger[_0x9ce4('0x12')]('ServicenowField,\x20%s,\x20%s',_0x44ce85,_0x84f74[_0x9ce4('0x12')][_0x9ce4('0x13')]);return _0x2386a5(_0x84f74['error'][_0x9ce4('0x13')]);}else{logger['info'](_0x9ce4('0xd'),_0x44ce85,_0x9ce4('0xe'));_0x2386a5(_0x84f74[_0x9ce4('0x14')][_0x9ce4('0x13')]);}})[_0x9ce4('0x15')](function(_0x29ac41){logger[_0x9ce4('0x12')](_0x9ce4('0xd'),_0x44ce85,_0x29ac41);_0x449c5b(_0x29ac41);});});} \ No newline at end of file +var _0x5615=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x48d565,_0x3dad07){var _0x510c68=function(_0x1adef5){while(--_0x1adef5){_0x48d565['push'](_0x48d565['shift']());}};_0x510c68(++_0x3dad07);}(_0x5615,0x153));var _0x5561=function(_0x21347d,_0x36188c){_0x21347d=_0x21347d-0x0;var _0x836949=_0x5615[_0x21347d];return _0x836949;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5561('0x0'));var rs=require(_0x5561('0x1'));var fs=require('fs');var Redis=require(_0x5561('0x2'));var db=require(_0x5561('0x3'))['db'];var utils=require(_0x5561('0x4'));var logger=require(_0x5561('0x5'))(_0x5561('0x6'));var config=require(_0x5561('0x7'));var jayson=require(_0x5561('0x8'));var client=jayson[_0x5561('0x9')][_0x5561('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5352,_0x2b6ea7,_0x3152c1){return new BPromise(function(_0x560954,_0x57d755){return client[_0x5561('0xb')](_0x3a5352,_0x3152c1)['then'](function(_0x41ae3f){logger[_0x5561('0xc')](_0x5561('0xd'),_0x2b6ea7,'request\x20sent');logger[_0x5561('0xe')](_0x5561('0xf'),_0x2b6ea7,_0x5561('0x10'),JSON[_0x5561('0x11')](_0x41ae3f));if(_0x41ae3f[_0x5561('0x12')]){if(_0x41ae3f['error']['code']===0x1f4){logger[_0x5561('0x12')]('ServicenowField,\x20%s,\x20%s',_0x2b6ea7,_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);return _0x57d755(_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);}logger[_0x5561('0x12')](_0x5561('0xd'),_0x2b6ea7,_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);return _0x560954(_0x41ae3f[_0x5561('0x12')][_0x5561('0x13')]);}else{logger[_0x5561('0xc')]('ServicenowField,\x20%s,\x20%s',_0x2b6ea7,_0x5561('0x10'));_0x560954(_0x41ae3f[_0x5561('0x14')][_0x5561('0x13')]);}})[_0x5561('0x15')](function(_0xc140ef){logger[_0x5561('0x12')](_0x5561('0xd'),_0x2b6ea7,_0xc140ef);_0x57d755(_0xc140ef);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 040f6c7..9387b09 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 _0x60eb=['put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration'];(function(_0x40e4b8,_0x5995b0){var _0x8cadf7=function(_0x521a12){while(--_0x521a12){_0x40e4b8['push'](_0x40e4b8['shift']());}};_0x8cadf7(++_0x5995b0);}(_0x60eb,0x192));var _0xb60e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb60e('0x0'));var util=require('util');var path=require(_0xb60e('0x1'));var timeout=require(_0xb60e('0x2'));var express=require(_0xb60e('0x3'));var router=express[_0xb60e('0x4')]();var auth=require(_0xb60e('0x5'));var interaction=require(_0xb60e('0x6'));var config=require(_0xb60e('0x7'));var controller=require('./intSugarcrmAccount.controller');router[_0xb60e('0x8')]('/',auth[_0xb60e('0x9')](),controller[_0xb60e('0xa')]);router['get'](_0xb60e('0xb'),auth[_0xb60e('0x9')](),controller[_0xb60e('0xc')]);router['get'](_0xb60e('0xd'),auth[_0xb60e('0x9')](),controller[_0xb60e('0xe')]);router[_0xb60e('0x8')](_0xb60e('0xf'),auth[_0xb60e('0x9')](),controller[_0xb60e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xb60e('0x11')]);router[_0xb60e('0x12')](_0xb60e('0xb'),auth[_0xb60e('0x9')](),controller['update']);router['delete'](_0xb60e('0xb'),auth[_0xb60e('0x9')](),controller['destroy']);module[_0xb60e('0x13')]=router; \ No newline at end of file +var _0x117d=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x22af3e,_0x4b606b){var _0x48c847=function(_0x515665){while(--_0x515665){_0x22af3e['push'](_0x22af3e['shift']());}};_0x48c847(++_0x4b606b);}(_0x117d,0xac));var _0xd117=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0x117d[_0x54fbff];return _0x5cf619;};'use strict';var multer=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var path=require(_0xd117('0x2'));var timeout=require('connect-timeout');var express=require(_0xd117('0x3'));var router=express[_0xd117('0x4')]();var auth=require(_0xd117('0x5'));var interaction=require(_0xd117('0x6'));var config=require(_0xd117('0x7'));var controller=require('./intSugarcrmAccount.controller');router[_0xd117('0x8')]('/',auth[_0xd117('0x9')](),controller[_0xd117('0xa')]);router[_0xd117('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd117('0xb')]);router[_0xd117('0x8')](_0xd117('0xc'),auth[_0xd117('0x9')](),controller[_0xd117('0xd')]);router[_0xd117('0x8')](_0xd117('0xe'),auth[_0xd117('0x9')](),controller[_0xd117('0xf')]);router[_0xd117('0x10')]('/',auth[_0xd117('0x9')](),controller[_0xd117('0x11')]);router[_0xd117('0x10')]('/:id/configurations',auth[_0xd117('0x9')](),controller[_0xd117('0x12')]);router[_0xd117('0x13')](_0xd117('0x14'),auth[_0xd117('0x9')](),controller['update']);router['delete'](_0xd117('0x14'),auth['isAuthenticated'](),controller[_0xd117('0x15')]);module[_0xd117('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index fea214d..234460f 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 _0xd9b5=['sequelize','exports','STRING','remoteUri'];(function(_0x2a1d29,_0x524c2e){var _0x1ad8d3=function(_0x342dbf){while(--_0x342dbf){_0x2a1d29['push'](_0x2a1d29['shift']());}};_0x1ad8d3(++_0x524c2e);}(_0xd9b5,0x1b0));var _0x5d9b=function(_0x34af77,_0x5193f4){_0x34af77=_0x34af77-0x0;var _0x4f30e5=_0xd9b5[_0x34af77];return _0x4f30e5;};'use strict';var Sequelize=require(_0x5d9b('0x0'));module[_0x5d9b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d9b('0x2')]},'username':{'type':Sequelize[_0x5d9b('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5d9b('0x2')],'unique':_0x5d9b('0x3')},'serverUrl':{'type':Sequelize[_0x5d9b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8fd3=['remoteUri','STRING'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8fd3,0x1b3));var _0x38fd=function(_0x4505c3,_0x1f761f){_0x4505c3=_0x4505c3-0x0;var _0x5bc552=_0x8fd3[_0x4505c3];return _0x5bc552;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x38fd('0x0')]},'description':{'type':Sequelize[_0x38fd('0x0')]},'username':{'type':Sequelize[_0x38fd('0x0')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x38fd('0x0')],'unique':_0x38fd('0x1')},'serverUrl':{'type':Sequelize[_0x38fd('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index d711d6a..fc62b12 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 _0xe204=['merge','VIRTUAL','options','count','includeAll','include','SugarcrmAccount','findAll','rows','show','length','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','username','password','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','module_fields','includes','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x219b17,_0xe07746){var _0x2c479a=function(_0x5dda28){while(--_0x5dda28){_0x219b17['push'](_0x219b17['shift']());}};_0x2c479a(++_0xe07746);}(_0xe204,0xbb));var _0x4e20=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe204[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e20('0x0'));var rimraf=require(_0x4e20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e20('0x2'));var rp=require('request-promise');var moment=require(_0x4e20('0x3'));var BPromise=require(_0x4e20('0x4'));var Mustache=require(_0x4e20('0x5'));var util=require(_0x4e20('0x6'));var path=require(_0x4e20('0x7'));var sox=require('sox');var csv=require(_0x4e20('0x8'));var ejs=require(_0x4e20('0x9'));var fs=require('fs');var _=require(_0x4e20('0xa'));var squel=require(_0x4e20('0xb'));var crypto=require(_0x4e20('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4e20('0xd'));var toCsv=require(_0x4e20('0x8'));var querystring=require('querystring');var Papa=require(_0x4e20('0xe'));var Redis=require(_0x4e20('0xf'));var authService=require(_0x4e20('0x10'));var qs=require(_0x4e20('0x11'));var as=require(_0x4e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e20('0x13'))(_0x4e20('0x14'));var utils=require(_0x4e20('0x15'));var config=require(_0x4e20('0x16'));var licenseUtil=require(_0x4e20('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4e20('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e20('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x104d99,_0x33e0df,_0x34ca4a,_0x32590c){return new BPromise(function(_0x4a72cd,_0x1dc029){var _0x1fbe77=_0x32590c||client;return _0x1fbe77['request'](_0x104d99,_0x34ca4a)[_0x4e20('0x1a')](function(_0x20c025){logger[_0x4e20('0x1b')](_0x4e20('0x1c'),_0x33e0df,_0x4e20('0x1d'));logger['debug'](_0x4e20('0x1e'),_0x33e0df,_0x4e20('0x1d'),JSON[_0x4e20('0x1f')](_0x20c025));if(_0x20c025[_0x4e20('0x20')]){if(_0x20c025['error'][_0x4e20('0x21')]===0x1f4){logger['error'](_0x4e20('0x1c'),_0x33e0df,_0x20c025['error'][_0x4e20('0x22')]);return _0x1dc029(_0x20c025[_0x4e20('0x20')][_0x4e20('0x22')]);}logger['error'](_0x4e20('0x1c'),_0x33e0df,_0x20c025[_0x4e20('0x20')][_0x4e20('0x22')]);return _0x4a72cd(_0x20c025[_0x4e20('0x20')][_0x4e20('0x22')]);}else{logger[_0x4e20('0x1b')](_0x4e20('0x1c'),_0x33e0df,_0x4e20('0x1d'));_0x4a72cd(_0x20c025[_0x4e20('0x23')]['message']);}})[_0x4e20('0x24')](function(_0x1226b5){logger[_0x4e20('0x20')](_0x4e20('0x1c'),_0x33e0df,_0x1226b5);_0x1dc029(_0x1226b5);});});}function respondWithStatusCode(_0x42766b,_0x2898cb){_0x2898cb=_0x2898cb||0xcc;return function(_0x4a860a){if(_0x4a860a){return _0x42766b[_0x4e20('0x25')](_0x2898cb);}return _0x42766b[_0x4e20('0x26')](_0x2898cb)[_0x4e20('0x27')]();};}function respondWithResult(_0x15c725,_0xe25a8){_0xe25a8=_0xe25a8||0xc8;return function(_0x1b9c27){if(_0x1b9c27){return _0x15c725['status'](_0xe25a8)[_0x4e20('0x28')](_0x1b9c27);}};}function respondWithFilteredResult(_0xb274f6,_0x5cbc36){return function(_0x5336db){if(_0x5336db){var _0x539dc3=_0x5336db['count'],_0xe4a069=_0x5cbc36[_0x4e20('0x29')],_0x29ebb8=_0x5cbc36[_0x4e20('0x29')]+_0x5cbc36['limit'],_0x4dfb28;if(_0x29ebb8>=_0x539dc3){_0x29ebb8=_0x539dc3;_0x4dfb28=0xc8;}else{_0x4dfb28=0xce;}_0xb274f6[_0x4e20('0x26')](_0x4dfb28);return _0xb274f6[_0x4e20('0x2a')](_0x4e20('0x2b'),_0xe4a069+'-'+_0x29ebb8+'/'+_0x539dc3)[_0x4e20('0x28')](_0x5336db);}return null;};}function patchUpdates(_0x436758){return function(_0x497e17){try{jsonpatch['apply'](_0x497e17,_0x436758,!![]);}catch(_0x3c6560){return BPromise[_0x4e20('0x2c')](_0x3c6560);}return _0x497e17[_0x4e20('0x2d')]();};}function saveUpdates(_0x234a8e,_0x1a8fa2){return function(_0x307ff2){if(_0x307ff2){return _0x307ff2[_0x4e20('0x2e')](_0x234a8e)[_0x4e20('0x1a')](function(_0x2f8c37){return _0x2f8c37;});}return null;};}function removeEntity(_0x263079,_0x425f6d){return function(_0x39270f){if(_0x39270f){return _0x39270f[_0x4e20('0x2f')]()[_0x4e20('0x1a')](function(){_0x263079[_0x4e20('0x26')](0xcc)[_0x4e20('0x27')]();});}};}function handleEntityNotFound(_0x5e3f8d,_0x4dbf57){return function(_0x13ea77){if(!_0x13ea77){_0x5e3f8d[_0x4e20('0x25')](0x194);}return _0x13ea77;};}function handleError(_0x1eb7d2,_0x256ae9){_0x256ae9=_0x256ae9||0x1f4;return function(_0x9c2027){logger[_0x4e20('0x20')](_0x9c2027['stack']);if(_0x9c2027[_0x4e20('0x30')]){delete _0x9c2027[_0x4e20('0x30')];}_0x1eb7d2[_0x4e20('0x26')](_0x256ae9)[_0x4e20('0x31')](_0x9c2027);};}exports[_0x4e20('0x32')]=function(_0xdd86be,_0x2b67c0){var _0x48501b={},_0x17cc3b={},_0x4ed1be={'count':0x0,'rows':[]};var _0x254782=_[_0x4e20('0x33')](db['SugarcrmAccount'][_0x4e20('0x34')],function(_0xce533b){return{'name':_0xce533b[_0x4e20('0x35')],'type':_0xce533b[_0x4e20('0x36')][_0x4e20('0x37')]};});_0x17cc3b[_0x4e20('0x38')]=_[_0x4e20('0x33')](_0x254782,_0x4e20('0x30'));_0x17cc3b[_0x4e20('0x39')]=_[_0x4e20('0x3a')](_0xdd86be[_0x4e20('0x39')]);_0x17cc3b[_0x4e20('0x3b')]=_[_0x4e20('0x3c')](_0x17cc3b['model'],_0x17cc3b[_0x4e20('0x39')]);_0x48501b[_0x4e20('0x3d')]=_[_0x4e20('0x3c')](_0x17cc3b[_0x4e20('0x38')],qs[_0x4e20('0x3e')](_0xdd86be[_0x4e20('0x39')][_0x4e20('0x3e')]));_0x48501b[_0x4e20('0x3d')]=_0x48501b[_0x4e20('0x3d')]['length']?_0x48501b[_0x4e20('0x3d')]:_0x17cc3b['model'];if(!_0xdd86be[_0x4e20('0x39')][_0x4e20('0x3f')](_0x4e20('0x40'))){_0x48501b[_0x4e20('0x41')]=qs['limit'](_0xdd86be[_0x4e20('0x39')]['limit']);_0x48501b[_0x4e20('0x29')]=qs[_0x4e20('0x29')](_0xdd86be[_0x4e20('0x39')][_0x4e20('0x29')]);}_0x48501b[_0x4e20('0x42')]=qs[_0x4e20('0x43')](_0xdd86be[_0x4e20('0x39')][_0x4e20('0x43')]);_0x48501b[_0x4e20('0x44')]=qs['filters'](_[_0x4e20('0x45')](_0xdd86be['query'],_0x17cc3b['filters']),_0x254782);if(_0xdd86be[_0x4e20('0x39')][_0x4e20('0x46')]){_0x48501b[_0x4e20('0x44')]=_[_0x4e20('0x47')](_0x48501b['where'],{'$or':_[_0x4e20('0x33')](_0x254782,function(_0x3e8e17){if(_0x3e8e17['type']!==_0x4e20('0x48')){var _0x3c52eb={};_0x3c52eb[_0x3e8e17[_0x4e20('0x30')]]={'$like':'%'+_0xdd86be['query'][_0x4e20('0x46')]+'%'};return _0x3c52eb;}})});}_0x48501b=_['merge']({},_0x48501b,_0xdd86be[_0x4e20('0x49')]);var _0x106d1d={'where':_0x48501b[_0x4e20('0x44')]};return db['SugarcrmAccount'][_0x4e20('0x4a')](_0x106d1d)[_0x4e20('0x1a')](function(_0x11728f){_0x4ed1be[_0x4e20('0x4a')]=_0x11728f;if(_0xdd86be[_0x4e20('0x39')][_0x4e20('0x4b')]){_0x48501b[_0x4e20('0x4c')]=[{'all':!![]}];}return db[_0x4e20('0x4d')][_0x4e20('0x4e')](_0x48501b);})[_0x4e20('0x1a')](function(_0x24a781){_0x4ed1be[_0x4e20('0x4f')]=_0x24a781;return _0x4ed1be;})[_0x4e20('0x1a')](respondWithFilteredResult(_0x2b67c0,_0x48501b))[_0x4e20('0x24')](handleError(_0x2b67c0,null));};exports[_0x4e20('0x50')]=function(_0x449772,_0x16f9f5){var _0x3d16f0={'raw':![],'where':{'id':_0x449772['params']['id']}},_0x40353c={};_0x40353c[_0x4e20('0x38')]=_['keys'](db[_0x4e20('0x4d')][_0x4e20('0x34')]);_0x40353c[_0x4e20('0x39')]=_[_0x4e20('0x3a')](_0x449772[_0x4e20('0x39')]);_0x40353c['filters']=_[_0x4e20('0x3c')](_0x40353c['model'],_0x40353c[_0x4e20('0x39')]);_0x3d16f0[_0x4e20('0x3d')]=_[_0x4e20('0x3c')](_0x40353c[_0x4e20('0x38')],qs[_0x4e20('0x3e')](_0x449772['query'][_0x4e20('0x3e')]));_0x3d16f0[_0x4e20('0x3d')]=_0x3d16f0[_0x4e20('0x3d')][_0x4e20('0x51')]?_0x3d16f0[_0x4e20('0x3d')]:_0x40353c[_0x4e20('0x38')];if(_0x449772['query'][_0x4e20('0x4b')]){_0x3d16f0[_0x4e20('0x4c')]=[{'all':!![]}];}_0x3d16f0=_['merge']({},_0x3d16f0,_0x449772[_0x4e20('0x49')]);return db[_0x4e20('0x4d')]['find'](_0x3d16f0)[_0x4e20('0x1a')](handleEntityNotFound(_0x16f9f5,null))[_0x4e20('0x1a')](respondWithResult(_0x16f9f5,null))[_0x4e20('0x24')](handleError(_0x16f9f5,null));};exports[_0x4e20('0x52')]=function(_0x1ad727,_0xba8629){return db[_0x4e20('0x4d')][_0x4e20('0x52')](_0x1ad727[_0x4e20('0x53')],{})[_0x4e20('0x1a')](respondWithResult(_0xba8629,0xc9))[_0x4e20('0x24')](handleError(_0xba8629,null));};exports[_0x4e20('0x2e')]=function(_0x42e958,_0x1d9d64){if(_0x42e958[_0x4e20('0x53')]['id']){delete _0x42e958[_0x4e20('0x53')]['id'];}return db[_0x4e20('0x4d')][_0x4e20('0x54')]({'where':{'id':_0x42e958[_0x4e20('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d9d64,null))[_0x4e20('0x1a')](saveUpdates(_0x42e958[_0x4e20('0x53')],null))[_0x4e20('0x1a')](respondWithResult(_0x1d9d64,null))[_0x4e20('0x24')](handleError(_0x1d9d64,null));};exports[_0x4e20('0x2f')]=function(_0x256720,_0x4a2aa8){return db[_0x4e20('0x4d')][_0x4e20('0x54')]({'where':{'id':_0x256720[_0x4e20('0x55')]['id']}})[_0x4e20('0x1a')](handleEntityNotFound(_0x4a2aa8,null))[_0x4e20('0x1a')](removeEntity(_0x4a2aa8,null))['catch'](handleError(_0x4a2aa8,null));};exports[_0x4e20('0x56')]=function(_0x348deb,_0x10545b,_0x32f158){var _0x4d84b2={};var _0x59cb4b={};var _0x223b17;var _0x14dc26;return db[_0x4e20('0x4d')][_0x4e20('0x57')]({'where':{'id':_0x348deb[_0x4e20('0x55')]['id']}})[_0x4e20('0x1a')](handleEntityNotFound(_0x10545b,null))[_0x4e20('0x1a')](function(_0x167828){if(_0x167828){_0x223b17=_0x167828;_0x59cb4b[_0x4e20('0x38')]=_[_0x4e20('0x3a')](db[_0x4e20('0x58')][_0x4e20('0x34')]);_0x59cb4b[_0x4e20('0x39')]=_['keys'](_0x348deb[_0x4e20('0x39')]);_0x59cb4b['filters']=_[_0x4e20('0x3c')](_0x59cb4b[_0x4e20('0x38')],_0x59cb4b[_0x4e20('0x39')]);_0x4d84b2['attributes']=_[_0x4e20('0x3c')](_0x59cb4b[_0x4e20('0x38')],qs[_0x4e20('0x3e')](_0x348deb[_0x4e20('0x39')]['fields']));_0x4d84b2['attributes']=_0x4d84b2[_0x4e20('0x3d')][_0x4e20('0x51')]?_0x4d84b2[_0x4e20('0x3d')]:_0x59cb4b['model'];_0x4d84b2[_0x4e20('0x42')]=qs['sort'](_0x348deb[_0x4e20('0x39')][_0x4e20('0x43')]);_0x4d84b2[_0x4e20('0x44')]=qs[_0x4e20('0x3b')](_[_0x4e20('0x45')](_0x348deb[_0x4e20('0x39')],_0x59cb4b['filters']));if(_0x348deb[_0x4e20('0x39')][_0x4e20('0x46')]){_0x4d84b2[_0x4e20('0x44')]=_[_0x4e20('0x47')](_0x4d84b2[_0x4e20('0x44')],{'$or':_[_0x4e20('0x33')](_0x4d84b2[_0x4e20('0x3d')],function(_0x196ad7){var _0x130904={};_0x130904[_0x196ad7]={'$like':'%'+_0x348deb[_0x4e20('0x39')][_0x4e20('0x46')]+'%'};return _0x130904;})});}_0x4d84b2=_[_0x4e20('0x47')]({},_0x4d84b2,_0x348deb[_0x4e20('0x49')]);return _0x223b17[_0x4e20('0x56')](_0x4d84b2);}})['then'](function(_0x11d757){if(_0x11d757){_0x14dc26=_0x11d757[_0x4e20('0x51')];if(!_0x348deb[_0x4e20('0x39')][_0x4e20('0x3f')](_0x4e20('0x40'))){_0x4d84b2[_0x4e20('0x41')]=qs['limit'](_0x348deb['query'][_0x4e20('0x41')]);_0x4d84b2[_0x4e20('0x29')]=qs['offset'](_0x348deb[_0x4e20('0x39')]['offset']);}return _0x223b17[_0x4e20('0x56')](_0x4d84b2);}})[_0x4e20('0x1a')](function(_0x2bf3d3){if(_0x2bf3d3){return _0x2bf3d3?{'count':_0x14dc26,'rows':_0x2bf3d3}:null;}})['then'](respondWithResult(_0x10545b,null))[_0x4e20('0x24')](handleError(_0x10545b,null));};exports[_0x4e20('0x59')]=function(_0x7ce829,_0x4a67b7,_0x242c72){if(_0x7ce829[_0x4e20('0x53')]['id']){delete _0x7ce829['body']['id'];}return db[_0x4e20('0x4d')]['findOne']({'where':{'id':_0x7ce829['params']['id']}})[_0x4e20('0x1a')](handleEntityNotFound(_0x4a67b7,null))['then'](function(_0x36817e){if(_0x36817e){_0x7ce829[_0x4e20('0x53')]['AccountId']=_0x36817e['id'];_0x7ce829[_0x4e20('0x53')][_0x4e20('0x5a')]=integrations[_0x4e20('0x5b')](_0x7ce829[_0x4e20('0x53')]['channel'],_0x7ce829[_0x4e20('0x53')]['type']);_0x7ce829['body'][_0x4e20('0x5c')]=integrations['getDescriptions'](_0x7ce829[_0x4e20('0x53')][_0x4e20('0x5d')],_0x7ce829['body'][_0x4e20('0x36')]);return db['SugarcrmConfiguration'][_0x4e20('0x52')](_0x7ce829[_0x4e20('0x53')],{'include':[{'model':db['SugarcrmField'],'as':_0x4e20('0x5a')},{'model':db[_0x4e20('0x5e')],'as':_0x4e20('0x5c')}]});}return null;})[_0x4e20('0x1a')](respondWithResult(_0x4a67b7,null))[_0x4e20('0x24')](handleError(_0x4a67b7,null));};exports['getFields']=function(_0x1473de,_0xf74a5f,_0x5a88a0){var _0x2bcd7a='';var _0x55b8fb=['id','name','assigned_user_id',_0x4e20('0x5f'),_0x4e20('0x60'),_0x4e20('0x61'),_0x4e20('0x62'),_0x4e20('0x63'),'parent_id',_0x4e20('0x64'),_0x4e20('0x65'),_0x4e20('0x66')];return db[_0x4e20('0x4d')][_0x4e20('0x57')]({'where':{'id':_0x1473de[_0x4e20('0x55')]['id']},'attributes':['id','username','password','remoteUri']})['then'](handleEntityNotFound(_0xf74a5f,null))['then'](function(_0x40c278){if(_0x40c278){_0x2bcd7a=_0x40c278[_0x4e20('0x67')];var _0x46b4ee=_0x2bcd7a[_0x4e20('0x68')](-0x1);if(_0x46b4ee==='/'){_0x2bcd7a=_0x2bcd7a[_0x4e20('0x69')](0x0,_0x2bcd7a[_0x4e20('0x6a')](_0x46b4ee));}return rp({'method':_0x4e20('0x6b'),'uri':util[_0x4e20('0x6c')]('%s%s',_0x2bcd7a,_0x4e20('0x6d')),'json':!![],'form':{'method':_0x4e20('0x6e'),'input_type':_0x4e20('0x6f'),'response_type':_0x4e20('0x6f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x40c278[_0x4e20('0x70')],'password':_0x40c278[_0x4e20('0x71')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x4e20('0x1a')](function(_0x26940a){if(_0x26940a&&_0x26940a[_0x4e20('0x30')]!==_0x4e20('0x72')&&_0x26940a['name']!==_0x4e20('0x73')){return rp({'method':_0x4e20('0x6b'),'uri':util[_0x4e20('0x6c')](_0x4e20('0x74'),_0x2bcd7a,_0x4e20('0x6d')),'json':!![],'form':{'method':_0x4e20('0x75'),'input_type':_0x4e20('0x6f'),'response_type':_0x4e20('0x6f'),'rest_data':JSON['stringify']({'session':_0x26940a['id'],'module_name':_0x4e20('0x76')})}})[_0x4e20('0x1a')](function(_0x1f3aed){if(_0x1f3aed){var _0x35cb37=_['values'](_0x1f3aed[_0x4e20('0x77')]);_['remove'](_0x35cb37,function(_0x208b2a){return _0x55b8fb[_0x4e20('0x78')](_0x208b2a[_0x4e20('0x30')]);});return{'count':_0x35cb37[_0x4e20('0x51')],'rows':_[_0x4e20('0x33')](_0x35cb37,function(_0x496d33){return{'id':_0x496d33[_0x4e20('0x30')],'name':_0x496d33['label'],'custom':_[_0x4e20('0x79')](_0x496d33['name'],'_c')?!![]:![],'options':_0x496d33[_0x4e20('0x49')]?_['map'](_[_0x4e20('0x7a')](_0x496d33[_0x4e20('0x49')]),function(_0x124ef0){return{'name':_0x124ef0[_0x4e20('0x7b')],'value':_0x124ef0[_0x4e20('0x30')]};}):[]};})};}})[_0x4e20('0x1a')](respondWithResult(_0xf74a5f,null))['catch'](function(_0x1eba62){var _0x25c6b9=_0x1473de['query'][_0x4e20('0x7c')]?0x1f4:_0x1eba62[_0x4e20('0x7d')]||0x1f4;logger['error'](_0x4e20('0x7e'),_0x4e20('0x7f'),_0x25c6b9,JSON[_0x4e20('0x1f')](_0x1eba62));delete _0x1eba62[_0x4e20('0x30')];if(_0x25c6b9===0x191){_0x25c6b9=0x190;}_0xf74a5f[_0x4e20('0x26')](_0x25c6b9)[_0x4e20('0x31')](_0x1473de[_0x4e20('0x39')][_0x4e20('0x7c')]?{'message':_0x4e20('0x80'),'statusCode':_0x1eba62[_0x4e20('0x7d')]}:_0x1eba62);});}else{var _0x770d4d=0x1f4;_0xf74a5f[_0x4e20('0x26')](_0x770d4d)[_0x4e20('0x31')]({'message':_0x4e20('0x80'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0718=['destroy','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','SugarcrmConfiguration','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','then'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0718,0xd2));var _0x8071=function(_0xf9fa79,_0xcb6d65){_0xf9fa79=_0xf9fa79-0x0;var _0xb868a6=_0x0718[_0xf9fa79];return _0xb868a6;};'use strict';var pdf=require(_0x8071('0x0'));var emlformat=require(_0x8071('0x1'));var rimraf=require(_0x8071('0x2'));var zipdir=require(_0x8071('0x3'));var jsonpatch=require(_0x8071('0x4'));var rp=require('request-promise');var moment=require(_0x8071('0x5'));var BPromise=require(_0x8071('0x6'));var Mustache=require(_0x8071('0x7'));var util=require(_0x8071('0x8'));var path=require(_0x8071('0x9'));var sox=require(_0x8071('0xa'));var csv=require(_0x8071('0xb'));var ejs=require(_0x8071('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8071('0xd'));var deskjs=require(_0x8071('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8071('0xf'));var Redis=require(_0x8071('0x10'));var authService=require(_0x8071('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8071('0x12'));var logger=require(_0x8071('0x13'))(_0x8071('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8071('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8071('0x16'));var client=jayson[_0x8071('0x17')][_0x8071('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3cf79e,_0x3cbd9b,_0x54c043,_0x36edf2){return new BPromise(function(_0x4feac0,_0x3aca2d){var _0x539abc=_0x36edf2||client;return _0x539abc[_0x8071('0x19')](_0x3cf79e,_0x54c043)['then'](function(_0x324187){logger[_0x8071('0x1a')](_0x8071('0x1b'),_0x3cbd9b,_0x8071('0x1c'));logger[_0x8071('0x1d')](_0x8071('0x1e'),_0x3cbd9b,_0x8071('0x1c'),JSON[_0x8071('0x1f')](_0x324187));if(_0x324187[_0x8071('0x20')]){if(_0x324187[_0x8071('0x20')][_0x8071('0x21')]===0x1f4){logger[_0x8071('0x20')](_0x8071('0x1b'),_0x3cbd9b,_0x324187[_0x8071('0x20')]['message']);return _0x3aca2d(_0x324187[_0x8071('0x20')][_0x8071('0x22')]);}logger[_0x8071('0x20')](_0x8071('0x1b'),_0x3cbd9b,_0x324187[_0x8071('0x20')]['message']);return _0x4feac0(_0x324187[_0x8071('0x20')][_0x8071('0x22')]);}else{logger['info'](_0x8071('0x1b'),_0x3cbd9b,'request\x20sent');_0x4feac0(_0x324187['result'][_0x8071('0x22')]);}})['catch'](function(_0x4562ff){logger[_0x8071('0x20')](_0x8071('0x1b'),_0x3cbd9b,_0x4562ff);_0x3aca2d(_0x4562ff);});});}function respondWithStatusCode(_0x36e1b4,_0x159ea4){_0x159ea4=_0x159ea4||0xcc;return function(_0x700f4d){if(_0x700f4d){return _0x36e1b4[_0x8071('0x23')](_0x159ea4);}return _0x36e1b4['status'](_0x159ea4)[_0x8071('0x24')]();};}function respondWithResult(_0x4fa01c,_0x73d7b4){_0x73d7b4=_0x73d7b4||0xc8;return function(_0x7ef682){if(_0x7ef682){return _0x4fa01c['status'](_0x73d7b4)[_0x8071('0x25')](_0x7ef682);}};}function respondWithFilteredResult(_0x263994,_0x206664){return function(_0x5cdfef){if(_0x5cdfef){var _0x40dc50=_0x5cdfef[_0x8071('0x26')],_0x31b8ee=_0x206664[_0x8071('0x27')],_0x42f08d=_0x206664[_0x8071('0x27')]+_0x206664[_0x8071('0x28')],_0x82de0b;if(_0x42f08d>=_0x40dc50){_0x42f08d=_0x40dc50;_0x82de0b=0xc8;}else{_0x82de0b=0xce;}_0x263994[_0x8071('0x29')](_0x82de0b);return _0x263994[_0x8071('0x2a')](_0x8071('0x2b'),_0x31b8ee+'-'+_0x42f08d+'/'+_0x40dc50)[_0x8071('0x25')](_0x5cdfef);}return null;};}function patchUpdates(_0x22253f){return function(_0x4823c7){try{jsonpatch[_0x8071('0x2c')](_0x4823c7,_0x22253f,!![]);}catch(_0x5aed28){return BPromise['reject'](_0x5aed28);}return _0x4823c7['save']();};}function saveUpdates(_0x540144,_0x2fc659){return function(_0x5e77d6){if(_0x5e77d6){return _0x5e77d6['update'](_0x540144)[_0x8071('0x2d')](function(_0x41d252){return _0x41d252;});}return null;};}function removeEntity(_0xfe89c4,_0x31565d){return function(_0x37ba50){if(_0x37ba50){return _0x37ba50[_0x8071('0x2e')]()[_0x8071('0x2d')](function(){_0xfe89c4[_0x8071('0x29')](0xcc)[_0x8071('0x24')]();});}};}function handleEntityNotFound(_0x30be0e,_0x2808e0){return function(_0x131d9a){if(!_0x131d9a){_0x30be0e[_0x8071('0x23')](0x194);}return _0x131d9a;};}function handleError(_0x12d7eb,_0x348683){_0x348683=_0x348683||0x1f4;return function(_0xba5066){logger[_0x8071('0x20')](_0xba5066['stack']);if(_0xba5066[_0x8071('0x2f')]){delete _0xba5066[_0x8071('0x2f')];}_0x12d7eb[_0x8071('0x29')](_0x348683)[_0x8071('0x30')](_0xba5066);};}exports[_0x8071('0x31')]=function(_0x23c499,_0x2c6e6a){var _0x303bc3={},_0x17e06e={},_0xf8c933={'count':0x0,'rows':[]};var _0x2ca06f=_[_0x8071('0x32')](db[_0x8071('0x33')][_0x8071('0x34')],function(_0x1cab33){return{'name':_0x1cab33['fieldName'],'type':_0x1cab33[_0x8071('0x35')][_0x8071('0x36')]};});_0x17e06e[_0x8071('0x37')]=_[_0x8071('0x32')](_0x2ca06f,_0x8071('0x2f'));_0x17e06e['query']=_[_0x8071('0x38')](_0x23c499['query']);_0x17e06e[_0x8071('0x39')]=_['intersection'](_0x17e06e['model'],_0x17e06e['query']);_0x303bc3['attributes']=_[_0x8071('0x3a')](_0x17e06e[_0x8071('0x37')],qs['fields'](_0x23c499[_0x8071('0x3b')][_0x8071('0x3c')]));_0x303bc3[_0x8071('0x3d')]=_0x303bc3['attributes'][_0x8071('0x3e')]?_0x303bc3[_0x8071('0x3d')]:_0x17e06e[_0x8071('0x37')];if(!_0x23c499[_0x8071('0x3b')][_0x8071('0x3f')]('nolimit')){_0x303bc3[_0x8071('0x28')]=qs[_0x8071('0x28')](_0x23c499[_0x8071('0x3b')][_0x8071('0x28')]);_0x303bc3[_0x8071('0x27')]=qs[_0x8071('0x27')](_0x23c499[_0x8071('0x3b')][_0x8071('0x27')]);}_0x303bc3['order']=qs[_0x8071('0x40')](_0x23c499[_0x8071('0x3b')]['sort']);_0x303bc3['where']=qs[_0x8071('0x39')](_[_0x8071('0x41')](_0x23c499['query'],_0x17e06e['filters']),_0x2ca06f);if(_0x23c499[_0x8071('0x3b')][_0x8071('0x42')]){_0x303bc3['where']=_['merge'](_0x303bc3[_0x8071('0x43')],{'$or':_[_0x8071('0x32')](_0x2ca06f,function(_0x282de7){if(_0x282de7[_0x8071('0x35')]!==_0x8071('0x44')){var _0x447adc={};_0x447adc[_0x282de7['name']]={'$like':'%'+_0x23c499[_0x8071('0x3b')][_0x8071('0x42')]+'%'};return _0x447adc;}})});}_0x303bc3=_[_0x8071('0x45')]({},_0x303bc3,_0x23c499[_0x8071('0x46')]);var _0x219cf1={'where':_0x303bc3[_0x8071('0x43')]};return db['SugarcrmAccount'][_0x8071('0x26')](_0x219cf1)[_0x8071('0x2d')](function(_0x366f63){_0xf8c933['count']=_0x366f63;if(_0x23c499[_0x8071('0x3b')][_0x8071('0x47')]){_0x303bc3[_0x8071('0x48')]=[{'all':!![]}];}return db[_0x8071('0x33')][_0x8071('0x49')](_0x303bc3);})[_0x8071('0x2d')](function(_0xcc923b){_0xf8c933[_0x8071('0x4a')]=_0xcc923b;return _0xf8c933;})[_0x8071('0x2d')](respondWithFilteredResult(_0x2c6e6a,_0x303bc3))[_0x8071('0x4b')](handleError(_0x2c6e6a,null));};exports[_0x8071('0x4c')]=function(_0x46fbdc,_0x33f6be){var _0x539b7f={'raw':![],'where':{'id':_0x46fbdc[_0x8071('0x4d')]['id']}},_0x202788={};_0x202788[_0x8071('0x37')]=_[_0x8071('0x38')](db[_0x8071('0x33')]['rawAttributes']);_0x202788[_0x8071('0x3b')]=_[_0x8071('0x38')](_0x46fbdc[_0x8071('0x3b')]);_0x202788['filters']=_['intersection'](_0x202788['model'],_0x202788[_0x8071('0x3b')]);_0x539b7f[_0x8071('0x3d')]=_[_0x8071('0x3a')](_0x202788['model'],qs[_0x8071('0x3c')](_0x46fbdc[_0x8071('0x3b')][_0x8071('0x3c')]));_0x539b7f[_0x8071('0x3d')]=_0x539b7f[_0x8071('0x3d')][_0x8071('0x3e')]?_0x539b7f['attributes']:_0x202788['model'];if(_0x46fbdc[_0x8071('0x3b')]['includeAll']){_0x539b7f[_0x8071('0x48')]=[{'all':!![]}];}_0x539b7f=_['merge']({},_0x539b7f,_0x46fbdc['options']);return db[_0x8071('0x33')][_0x8071('0x4e')](_0x539b7f)[_0x8071('0x2d')](handleEntityNotFound(_0x33f6be,null))['then'](respondWithResult(_0x33f6be,null))[_0x8071('0x4b')](handleError(_0x33f6be,null));};exports[_0x8071('0x4f')]=function(_0x278cd0,_0x4398f5){return db[_0x8071('0x33')]['create'](_0x278cd0[_0x8071('0x50')],{})[_0x8071('0x2d')](respondWithResult(_0x4398f5,0xc9))[_0x8071('0x4b')](handleError(_0x4398f5,null));};exports[_0x8071('0x51')]=function(_0x40b260,_0x5a885c){if(_0x40b260['body']['id']){delete _0x40b260[_0x8071('0x50')]['id'];}return db[_0x8071('0x33')][_0x8071('0x4e')]({'where':{'id':_0x40b260[_0x8071('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a885c,null))[_0x8071('0x2d')](saveUpdates(_0x40b260[_0x8071('0x50')],null))[_0x8071('0x2d')](respondWithResult(_0x5a885c,null))[_0x8071('0x4b')](handleError(_0x5a885c,null));};exports['destroy']=function(_0x399344,_0x4067ed){return db[_0x8071('0x33')][_0x8071('0x4e')]({'where':{'id':_0x399344[_0x8071('0x4d')]['id']}})[_0x8071('0x2d')](handleEntityNotFound(_0x4067ed,null))[_0x8071('0x2d')](removeEntity(_0x4067ed,null))[_0x8071('0x4b')](handleError(_0x4067ed,null));};exports['getConfigurations']=function(_0x37e588,_0x3c3851,_0x5af669){var _0x36baf1={};var _0x40452e={};var _0x13ab2e;var _0x25fe0f;return db[_0x8071('0x33')]['findOne']({'where':{'id':_0x37e588[_0x8071('0x4d')]['id']}})[_0x8071('0x2d')](handleEntityNotFound(_0x3c3851,null))[_0x8071('0x2d')](function(_0x27dfc6){if(_0x27dfc6){_0x13ab2e=_0x27dfc6;_0x40452e[_0x8071('0x37')]=_['keys'](db[_0x8071('0x52')][_0x8071('0x34')]);_0x40452e[_0x8071('0x3b')]=_[_0x8071('0x38')](_0x37e588['query']);_0x40452e['filters']=_[_0x8071('0x3a')](_0x40452e['model'],_0x40452e[_0x8071('0x3b')]);_0x36baf1['attributes']=_['intersection'](_0x40452e['model'],qs[_0x8071('0x3c')](_0x37e588[_0x8071('0x3b')]['fields']));_0x36baf1[_0x8071('0x3d')]=_0x36baf1['attributes'][_0x8071('0x3e')]?_0x36baf1[_0x8071('0x3d')]:_0x40452e[_0x8071('0x37')];_0x36baf1['order']=qs[_0x8071('0x40')](_0x37e588[_0x8071('0x3b')]['sort']);_0x36baf1[_0x8071('0x43')]=qs['filters'](_['pick'](_0x37e588[_0x8071('0x3b')],_0x40452e['filters']));if(_0x37e588[_0x8071('0x3b')]['filter']){_0x36baf1[_0x8071('0x43')]=_[_0x8071('0x45')](_0x36baf1[_0x8071('0x43')],{'$or':_[_0x8071('0x32')](_0x36baf1[_0x8071('0x3d')],function(_0x4b3c40){var _0xf99efb={};_0xf99efb[_0x4b3c40]={'$like':'%'+_0x37e588[_0x8071('0x3b')][_0x8071('0x42')]+'%'};return _0xf99efb;})});}_0x36baf1=_[_0x8071('0x45')]({},_0x36baf1,_0x37e588['options']);return _0x13ab2e[_0x8071('0x53')](_0x36baf1);}})[_0x8071('0x2d')](function(_0x36faf1){if(_0x36faf1){_0x25fe0f=_0x36faf1['length'];if(!_0x37e588[_0x8071('0x3b')]['hasOwnProperty'](_0x8071('0x54'))){_0x36baf1[_0x8071('0x28')]=qs['limit'](_0x37e588['query']['limit']);_0x36baf1['offset']=qs[_0x8071('0x27')](_0x37e588['query'][_0x8071('0x27')]);}return _0x13ab2e[_0x8071('0x53')](_0x36baf1);}})[_0x8071('0x2d')](function(_0x37f80e){if(_0x37f80e){return _0x37f80e?{'count':_0x25fe0f,'rows':_0x37f80e}:null;}})[_0x8071('0x2d')](respondWithResult(_0x3c3851,null))[_0x8071('0x4b')](handleError(_0x3c3851,null));};exports[_0x8071('0x55')]=function(_0x21c663,_0x4a8fa7,_0x4e684e){if(_0x21c663['body']['id']){delete _0x21c663['body']['id'];}return db[_0x8071('0x33')][_0x8071('0x56')]({'where':{'id':_0x21c663[_0x8071('0x4d')]['id']}})[_0x8071('0x2d')](handleEntityNotFound(_0x4a8fa7,null))['then'](function(_0x45a784){if(_0x45a784){_0x21c663['body'][_0x8071('0x57')]=_0x45a784['id'];_0x21c663[_0x8071('0x50')][_0x8071('0x58')]=integrations[_0x8071('0x59')](_0x21c663[_0x8071('0x50')]['channel'],_0x21c663[_0x8071('0x50')][_0x8071('0x35')]);_0x21c663[_0x8071('0x50')][_0x8071('0x5a')]=integrations[_0x8071('0x5b')](_0x21c663[_0x8071('0x50')][_0x8071('0x5c')],_0x21c663['body'][_0x8071('0x35')]);return db[_0x8071('0x52')][_0x8071('0x4f')](_0x21c663[_0x8071('0x50')],{'include':[{'model':db[_0x8071('0x5d')],'as':_0x8071('0x58')},{'model':db[_0x8071('0x5d')],'as':'Descriptions'}]});}return null;})[_0x8071('0x2d')](respondWithResult(_0x4a8fa7,null))[_0x8071('0x4b')](handleError(_0x4a8fa7,null));};exports[_0x8071('0x5e')]=function(_0x1509e9,_0x34ba23,_0x3f1d04){var _0x4f16c8='';var _0x550e23=['id',_0x8071('0x2f'),'assigned_user_id','created_by',_0x8071('0x5f'),'date_start',_0x8071('0x60'),_0x8071('0x61'),_0x8071('0x62'),_0x8071('0x63'),_0x8071('0x64'),_0x8071('0x65')];return db[_0x8071('0x33')]['findOne']({'where':{'id':_0x1509e9['params']['id']},'attributes':['id',_0x8071('0x66'),_0x8071('0x67'),_0x8071('0x68')]})[_0x8071('0x2d')](handleEntityNotFound(_0x34ba23,null))[_0x8071('0x2d')](function(_0x341624){if(_0x341624){_0x4f16c8=_0x341624['remoteUri'];var _0x5b2d66=_0x4f16c8[_0x8071('0x69')](-0x1);if(_0x5b2d66==='/'){_0x4f16c8=_0x4f16c8[_0x8071('0x6a')](0x0,_0x4f16c8[_0x8071('0x6b')](_0x5b2d66));}return rp({'method':_0x8071('0x6c'),'uri':util[_0x8071('0x6d')](_0x8071('0x6e'),_0x4f16c8,_0x8071('0x6f')),'json':!![],'form':{'method':_0x8071('0x70'),'input_type':_0x8071('0x71'),'response_type':_0x8071('0x71'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x341624[_0x8071('0x66')],'password':_0x341624[_0x8071('0x67')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x8071('0x2d')](function(_0x12b310){if(_0x12b310&&_0x12b310[_0x8071('0x2f')]!==_0x8071('0x72')&&_0x12b310[_0x8071('0x2f')]!==_0x8071('0x73')){return rp({'method':_0x8071('0x6c'),'uri':util[_0x8071('0x6d')](_0x8071('0x6e'),_0x4f16c8,_0x8071('0x6f')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x8071('0x71'),'response_type':_0x8071('0x71'),'rest_data':JSON[_0x8071('0x1f')]({'session':_0x12b310['id'],'module_name':_0x8071('0x74')})}})[_0x8071('0x2d')](function(_0x5e3534){if(_0x5e3534){var _0xe6a2e7=_[_0x8071('0x75')](_0x5e3534[_0x8071('0x76')]);_[_0x8071('0x77')](_0xe6a2e7,function(_0x207d9a){return _0x550e23[_0x8071('0x78')](_0x207d9a[_0x8071('0x2f')]);});return{'count':_0xe6a2e7[_0x8071('0x3e')],'rows':_[_0x8071('0x32')](_0xe6a2e7,function(_0xfc3d79){return{'id':_0xfc3d79[_0x8071('0x2f')],'name':_0xfc3d79[_0x8071('0x79')],'custom':_[_0x8071('0x7a')](_0xfc3d79['name'],'_c')?!![]:![],'options':_0xfc3d79['options']?_[_0x8071('0x32')](_[_0x8071('0x75')](_0xfc3d79[_0x8071('0x46')]),function(_0x2854e0){return{'name':_0x2854e0[_0x8071('0x7b')],'value':_0x2854e0[_0x8071('0x2f')]};}):[]};})};}})[_0x8071('0x2d')](respondWithResult(_0x34ba23,null))[_0x8071('0x4b')](function(_0x2c4956){var _0x223507=_0x1509e9[_0x8071('0x3b')]['test']?0x1f4:_0x2c4956[_0x8071('0x7c')]||0x1f4;logger['error'](_0x8071('0x7d'),_0x8071('0x5e'),_0x223507,JSON[_0x8071('0x1f')](_0x2c4956));delete _0x2c4956[_0x8071('0x2f')];if(_0x223507===0x191){_0x223507=0x190;}_0x34ba23['status'](_0x223507)['send'](_0x1509e9[_0x8071('0x3b')][_0x8071('0x7e')]?{'message':_0x8071('0x7f'),'statusCode':_0x2c4956['statusCode']}:_0x2c4956);});}else{var _0x30a453=0x1f4;_0x34ba23['status'](_0x30a453)['send']({'message':_0x8071('0x7f'),'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 e35e7eb..e8eaec4 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 _0xf37f=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment'];(function(_0x1a8a35,_0x317f59){var _0x152aff=function(_0x583c3a){while(--_0x583c3a){_0x1a8a35['push'](_0x1a8a35['shift']());}};_0x152aff(++_0x317f59);}(_0xf37f,0x15a));var _0xff37=function(_0x348e46,_0x5187dc){_0x348e46=_0x348e46-0x0;var _0x58b74f=_0xf37f[_0x348e46];return _0x58b74f;};'use strict';var _=require(_0xff37('0x0'));var util=require(_0xff37('0x1'));var logger=require(_0xff37('0x2'))('api');var moment=require(_0xff37('0x3'));var BPromise=require(_0xff37('0x4'));var rp=require(_0xff37('0x5'));var fs=require('fs');var path=require(_0xff37('0x6'));var rimraf=require(_0xff37('0x7'));var config=require(_0xff37('0x8'));var attributes=require(_0xff37('0x9'));var integrations=require(_0xff37('0xa'));module[_0xff37('0xb')]=function(_0x1eff8b,_0x2a4372){return _0x1eff8b['define'](_0xff37('0xc'),attributes,{'tableName':_0xff37('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x046f=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x046f,0x1b4));var _0xf046=function(_0x41b0d5,_0x2f7baa){_0x41b0d5=_0x41b0d5-0x0;var _0xb9c58b=_0x046f[_0x41b0d5];return _0xb9c58b;};'use strict';var _=require(_0xf046('0x0'));var util=require(_0xf046('0x1'));var logger=require(_0xf046('0x2'))(_0xf046('0x3'));var moment=require(_0xf046('0x4'));var BPromise=require(_0xf046('0x5'));var rp=require(_0xf046('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf046('0x7'));var config=require(_0xf046('0x8'));var attributes=require(_0xf046('0x9'));var integrations=require(_0xf046('0xa'));module[_0xf046('0xb')]=function(_0xdafbd4,_0x310429){return _0xdafbd4[_0xf046('0xc')](_0xf046('0xd'),attributes,{'tableName':_0xf046('0xe'),'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 3b419aa..7d83fae 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 _0xe6e2=['model','ShowSugarcrmAccount','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xe6e2,0x1a7));var _0x2e6e=function(_0x32c7d4,_0x380bf0){_0x32c7d4=_0x32c7d4-0x0;var _0x489732=_0xe6e2[_0x32c7d4];return _0x489732;};'use strict';var _=require(_0x2e6e('0x0'));var util=require(_0x2e6e('0x1'));var moment=require(_0x2e6e('0x2'));var BPromise=require(_0x2e6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e6e('0x4'));var db=require(_0x2e6e('0x5'))['db'];var utils=require(_0x2e6e('0x6'));var logger=require(_0x2e6e('0x7'))(_0x2e6e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e6e('0x9')][_0x2e6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cbfe7,_0x18fe24,_0x59470a){return new BPromise(function(_0x4c1ead,_0x55bf99){return client[_0x2e6e('0xb')](_0x2cbfe7,_0x59470a)[_0x2e6e('0xc')](function(_0x3c21ae){logger[_0x2e6e('0xd')](_0x2e6e('0xe'),_0x18fe24,_0x2e6e('0xf'));logger[_0x2e6e('0x10')](_0x2e6e('0x11'),_0x18fe24,_0x2e6e('0xf'),JSON[_0x2e6e('0x12')](_0x3c21ae));if(_0x3c21ae[_0x2e6e('0x13')]){if(_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x14')]===0x1f4){logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x18fe24,_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x15')]);return _0x55bf99(_0x3c21ae['error']['message']);}logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x18fe24,_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x15')]);return _0x4c1ead(_0x3c21ae[_0x2e6e('0x13')][_0x2e6e('0x15')]);}else{logger['info'](_0x2e6e('0xe'),_0x18fe24,_0x2e6e('0xf'));_0x4c1ead(_0x3c21ae[_0x2e6e('0x16')]['message']);}})[_0x2e6e('0x17')](function(_0x227afe){logger[_0x2e6e('0x13')](_0x2e6e('0xe'),_0x18fe24,_0x227afe);_0x55bf99(_0x227afe);});});}exports[_0x2e6e('0x18')]=function(_0x5d3441){var _0x5bad0e=this;return new Promise(function(_0xb24bb5,_0x5b3c41){return db[_0x2e6e('0x19')][_0x2e6e('0x1a')]({'raw':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')][_0x2e6e('0x1c')]||null:null,'attributes':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')][_0x2e6e('0x1d')]||null:null,'limit':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441['options']['limit']||null:null,'include':_0x5d3441[_0x2e6e('0x1b')]?_0x5d3441[_0x2e6e('0x1b')][_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x5d3441[_0x2e6e('0x1b')]['include'],function(_0x473b4a){return{'model':db[_0x473b4a[_0x2e6e('0x20')]],'as':_0x473b4a['as'],'attributes':_0x473b4a[_0x2e6e('0x1d')],'include':_0x473b4a[_0x2e6e('0x1e')]?_['map'](_0x473b4a[_0x2e6e('0x1e')],function(_0x5d6690){return{'model':db[_0x5d6690[_0x2e6e('0x20')]],'as':_0x5d6690['as'],'attributes':_0x5d6690[_0x2e6e('0x1d')],'include':_0x5d6690[_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x5d6690[_0x2e6e('0x1e')],function(_0x4f1fe8){return{'model':db[_0x4f1fe8[_0x2e6e('0x20')]],'as':_0x4f1fe8['as'],'attributes':_0x4f1fe8[_0x2e6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2e6e('0xc')](function(_0x2e2b34){logger[_0x2e6e('0xd')](_0x2e6e('0x18'),_0x5d3441);logger[_0x2e6e('0x10')]('GetSugarcrmAccount',_0x5d3441,JSON[_0x2e6e('0x12')](_0x2e2b34));_0xb24bb5(_0x2e2b34);})[_0x2e6e('0x17')](function(_0x2b7ab6){logger['error'](_0x2e6e('0x18'),_0x2b7ab6[_0x2e6e('0x15')],_0x5d3441);_0x5b3c41(_0x5bad0e[_0x2e6e('0x13')](0x1f4,_0x2b7ab6[_0x2e6e('0x15')]));});});};exports[_0x2e6e('0x21')]=function(_0x4a4093){var _0x45510f=this;return new Promise(function(_0xa7868c,_0x3d5a1f){return db[_0x2e6e('0x19')]['find']({'raw':_0x4a4093[_0x2e6e('0x1b')]?_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x22')]===undefined?!![]:![]:!![],'where':_0x4a4093['options']?_0x4a4093['options'][_0x2e6e('0x1c')]||null:null,'attributes':_0x4a4093['options']?_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x1d')]||null:null,'include':_0x4a4093['options']?_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x4a4093[_0x2e6e('0x1b')][_0x2e6e('0x1e')],function(_0x156da6){return{'model':db[_0x156da6[_0x2e6e('0x20')]],'as':_0x156da6['as'],'attributes':_0x156da6[_0x2e6e('0x1d')],'include':_0x156da6[_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x156da6[_0x2e6e('0x1e')],function(_0x267615){return{'model':db[_0x267615[_0x2e6e('0x20')]],'as':_0x267615['as'],'attributes':_0x267615[_0x2e6e('0x1d')],'include':_0x267615[_0x2e6e('0x1e')]?_[_0x2e6e('0x1f')](_0x267615[_0x2e6e('0x1e')],function(_0x96fcb7){return{'model':db[_0x96fcb7[_0x2e6e('0x20')]],'as':_0x96fcb7['as'],'attributes':_0x96fcb7[_0x2e6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2e6e('0xc')](function(_0x5f38eb){logger[_0x2e6e('0xd')](_0x2e6e('0x21'),_0x4a4093);logger[_0x2e6e('0x10')](_0x2e6e('0x21'),_0x4a4093,JSON[_0x2e6e('0x12')](_0x5f38eb));_0xa7868c(_0x5f38eb);})[_0x2e6e('0x17')](function(_0x41557e){logger[_0x2e6e('0x13')](_0x2e6e('0x21'),_0x41557e[_0x2e6e('0x15')],_0x4a4093);_0x3d5a1f(_0x45510f[_0x2e6e('0x13')](0x1f4,_0x41557e[_0x2e6e('0x15')]));});});}; \ No newline at end of file +var _0x00f5=['attributes','catch','ShowSugarcrmAccount','find','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','options','where','limit','include','map','model'];(function(_0x2deb3e,_0xc298b7){var _0x491f81=function(_0x2abbcd){while(--_0x2abbcd){_0x2deb3e['push'](_0x2deb3e['shift']());}};_0x491f81(++_0xc298b7);}(_0x00f5,0x7d));var _0x500f=function(_0x25a33b,_0x15d1ff){_0x25a33b=_0x25a33b-0x0;var _0x15346c=_0x00f5[_0x25a33b];return _0x15346c;};'use strict';var _=require(_0x500f('0x0'));var util=require('util');var moment=require(_0x500f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x500f('0x2'));var db=require(_0x500f('0x3'))['db'];var utils=require(_0x500f('0x4'));var logger=require('../../config/logger')(_0x500f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x500f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a33b1,_0x37e7d3,_0xa5e112){return new BPromise(function(_0x5ac97c,_0x1a8a49){return client['request'](_0x8a33b1,_0xa5e112)[_0x500f('0x7')](function(_0xd14580){logger[_0x500f('0x8')](_0x500f('0x9'),_0x37e7d3,_0x500f('0xa'));logger[_0x500f('0xb')](_0x500f('0xc'),_0x37e7d3,'request\x20sent',JSON[_0x500f('0xd')](_0xd14580));if(_0xd14580[_0x500f('0xe')]){if(_0xd14580[_0x500f('0xe')][_0x500f('0xf')]===0x1f4){logger[_0x500f('0xe')](_0x500f('0x9'),_0x37e7d3,_0xd14580[_0x500f('0xe')]['message']);return _0x1a8a49(_0xd14580[_0x500f('0xe')][_0x500f('0x10')]);}logger[_0x500f('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x37e7d3,_0xd14580[_0x500f('0xe')][_0x500f('0x10')]);return _0x5ac97c(_0xd14580[_0x500f('0xe')][_0x500f('0x10')]);}else{logger[_0x500f('0x8')](_0x500f('0x9'),_0x37e7d3,_0x500f('0xa'));_0x5ac97c(_0xd14580[_0x500f('0x11')][_0x500f('0x10')]);}})['catch'](function(_0x39c877){logger[_0x500f('0xe')](_0x500f('0x9'),_0x37e7d3,_0x39c877);_0x1a8a49(_0x39c877);});});}exports[_0x500f('0x12')]=function(_0x1ff267){var _0x219eed=this;return new Promise(function(_0x2dd28b,_0x477e77){return db['SugarcrmAccount']['findAll']({'raw':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')][_0x500f('0x14')]||null:null,'attributes':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')]['attributes']||null:null,'limit':_0x1ff267[_0x500f('0x13')]?_0x1ff267[_0x500f('0x13')][_0x500f('0x15')]||null:null,'include':_0x1ff267[_0x500f('0x13')]?_0x1ff267['options'][_0x500f('0x16')]?_[_0x500f('0x17')](_0x1ff267[_0x500f('0x13')][_0x500f('0x16')],function(_0x3f4100){return{'model':db[_0x3f4100[_0x500f('0x18')]],'as':_0x3f4100['as'],'attributes':_0x3f4100['attributes'],'include':_0x3f4100['include']?_[_0x500f('0x17')](_0x3f4100[_0x500f('0x16')],function(_0x2a0183){return{'model':db[_0x2a0183[_0x500f('0x18')]],'as':_0x2a0183['as'],'attributes':_0x2a0183[_0x500f('0x19')],'include':_0x2a0183[_0x500f('0x16')]?_[_0x500f('0x17')](_0x2a0183[_0x500f('0x16')],function(_0x59964b){return{'model':db[_0x59964b['model']],'as':_0x59964b['as'],'attributes':_0x59964b[_0x500f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x7')](function(_0x145c12){logger[_0x500f('0x8')](_0x500f('0x12'),_0x1ff267);logger['debug']('GetSugarcrmAccount',_0x1ff267,JSON['stringify'](_0x145c12));_0x2dd28b(_0x145c12);})[_0x500f('0x1a')](function(_0x328610){logger[_0x500f('0xe')](_0x500f('0x12'),_0x328610[_0x500f('0x10')],_0x1ff267);_0x477e77(_0x219eed[_0x500f('0xe')](0x1f4,_0x328610[_0x500f('0x10')]));});});};exports[_0x500f('0x1b')]=function(_0x100cfd){var _0x12df27=this;return new Promise(function(_0x37b09f,_0x35e743){return db['SugarcrmAccount'][_0x500f('0x1c')]({'raw':_0x100cfd[_0x500f('0x13')]?_0x100cfd['options'][_0x500f('0x1d')]===undefined?!![]:![]:!![],'where':_0x100cfd[_0x500f('0x13')]?_0x100cfd[_0x500f('0x13')][_0x500f('0x14')]||null:null,'attributes':_0x100cfd['options']?_0x100cfd[_0x500f('0x13')][_0x500f('0x19')]||null:null,'include':_0x100cfd[_0x500f('0x13')]?_0x100cfd[_0x500f('0x13')][_0x500f('0x16')]?_[_0x500f('0x17')](_0x100cfd[_0x500f('0x13')][_0x500f('0x16')],function(_0x49eac0){return{'model':db[_0x49eac0[_0x500f('0x18')]],'as':_0x49eac0['as'],'attributes':_0x49eac0['attributes'],'include':_0x49eac0[_0x500f('0x16')]?_[_0x500f('0x17')](_0x49eac0[_0x500f('0x16')],function(_0x3e9e17){return{'model':db[_0x3e9e17[_0x500f('0x18')]],'as':_0x3e9e17['as'],'attributes':_0x3e9e17[_0x500f('0x19')],'include':_0x3e9e17[_0x500f('0x16')]?_[_0x500f('0x17')](_0x3e9e17[_0x500f('0x16')],function(_0x41b950){return{'model':db[_0x41b950[_0x500f('0x18')]],'as':_0x41b950['as'],'attributes':_0x41b950[_0x500f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x7')](function(_0x457662){logger[_0x500f('0x8')](_0x500f('0x1b'),_0x100cfd);logger[_0x500f('0xb')](_0x500f('0x1b'),_0x100cfd,JSON[_0x500f('0xd')](_0x457662));_0x37b09f(_0x457662);})[_0x500f('0x1a')](function(_0x1a757b){logger['error'](_0x500f('0x1b'),_0x1a757b[_0x500f('0x10')],_0x100cfd);_0x35e743(_0x12df27[_0x500f('0xe')](0x1f4,_0x1a757b[_0x500f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3ae1447..1cf0aa9 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 _0x1e16=['put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','getSubjects','getDescriptions','post','create'];(function(_0x154b19,_0x21e4cf){var _0x10f433=function(_0x44e746){while(--_0x44e746){_0x154b19['push'](_0x154b19['shift']());}};_0x10f433(++_0x21e4cf);}(_0x1e16,0x138));var _0x61e1=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x1e16[_0x199c03];return _0x11a7d4;};'use strict';var multer=require(_0x61e1('0x0'));var util=require(_0x61e1('0x1'));var path=require(_0x61e1('0x2'));var timeout=require(_0x61e1('0x3'));var express=require('express');var router=express[_0x61e1('0x4')]();var auth=require(_0x61e1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x61e1('0x6'));var controller=require(_0x61e1('0x7'));router[_0x61e1('0x8')]('/',auth['isAuthenticated'](),controller[_0x61e1('0x9')]);router[_0x61e1('0x8')](_0x61e1('0xa'),auth[_0x61e1('0xb')](),controller[_0x61e1('0xc')]);router[_0x61e1('0x8')]('/:id/fields',auth[_0x61e1('0xb')](),controller[_0x61e1('0xd')]);router[_0x61e1('0x8')]('/:id/subjects',auth[_0x61e1('0xb')](),controller[_0x61e1('0xe')]);router[_0x61e1('0x8')]('/:id/descriptions',auth[_0x61e1('0xb')](),controller[_0x61e1('0xf')]);router[_0x61e1('0x10')]('/',auth['isAuthenticated'](),controller[_0x61e1('0x11')]);router[_0x61e1('0x12')](_0x61e1('0xa'),auth[_0x61e1('0xb')](),controller[_0x61e1('0x13')]);router[_0x61e1('0x14')]('/:id',auth[_0x61e1('0xb')](),controller['destroy']);module[_0x61e1('0x15')]=router; \ No newline at end of file +var _0xa227=['exports','multer','path','express','get','index','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','update','delete','/:id','destroy'];(function(_0x3ae147,_0x4ca19b){var _0x235663=function(_0x1a9a99){while(--_0x1a9a99){_0x3ae147['push'](_0x3ae147['shift']());}};_0x235663(++_0x4ca19b);}(_0xa227,0xab));var _0x7a22=function(_0x9bb625,_0x6b2114){_0x9bb625=_0x9bb625-0x0;var _0x3b4b82=_0xa227[_0x9bb625];return _0x3b4b82;};'use strict';var multer=require(_0x7a22('0x0'));var util=require('util');var path=require(_0x7a22('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a22('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x7a22('0x3')]('/',auth['isAuthenticated'](),controller[_0x7a22('0x4')]);router[_0x7a22('0x3')]('/:id',auth[_0x7a22('0x5')](),controller['show']);router[_0x7a22('0x3')](_0x7a22('0x6'),auth[_0x7a22('0x5')](),controller[_0x7a22('0x7')]);router['get']('/:id/subjects',auth[_0x7a22('0x5')](),controller[_0x7a22('0x8')]);router[_0x7a22('0x3')](_0x7a22('0x9'),auth[_0x7a22('0x5')](),controller['getDescriptions']);router[_0x7a22('0xa')]('/',auth[_0x7a22('0x5')](),controller[_0x7a22('0xb')]);router['put']('/:id',auth[_0x7a22('0x5')](),controller[_0x7a22('0xc')]);router[_0x7a22('0xd')](_0x7a22('0xe'),auth[_0x7a22('0x5')](),controller[_0x7a22('0xf')]);module[_0x7a22('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4502bac..05ff0e5 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 _0xf156=['sequelize','STRING'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf156,0x1a0));var _0x6f15=function(_0x4fee65,_0x13e8ed){_0x4fee65=_0x4fee65-0x0;var _0x3ad648=_0xf156[_0x4fee65];return _0x3ad648;};'use strict';var Sequelize=require(_0x6f15('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f15('0x1')]},'description':{'type':Sequelize[_0x6f15('0x1')]}}; \ No newline at end of file +var _0x039b=['exports','STRING'];(function(_0x4f7fe0,_0x18201f){var _0x1e2851=function(_0x448ddc){while(--_0x448ddc){_0x4f7fe0['push'](_0x4f7fe0['shift']());}};_0x1e2851(++_0x18201f);}(_0x039b,0x1ba));var _0xb039=function(_0x41b44a,_0x41dbec){_0x41b44a=_0x41b44a-0x0;var _0x13fc4d=_0x039b[_0x41b44a];return _0x13fc4d;};'use strict';var Sequelize=require('sequelize');module[_0xb039('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb039('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index ba672df..d6b16fc 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 _0x1c7f=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','merge','find','body','params','getFields','SugarcrmField','findOne','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset'];(function(_0x6f24f9,_0x14049c){var _0x3d36d7=function(_0x4c54bd){while(--_0x4c54bd){_0x6f24f9['push'](_0x6f24f9['shift']());}};_0x3d36d7(++_0x14049c);}(_0x1c7f,0x8b));var _0xf1c7=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x1c7f[_0x8de54f];return _0x14cba4;};'use strict';var pdf=require(_0xf1c7('0x0'));var emlformat=require(_0xf1c7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1c7('0x2'));var rp=require(_0xf1c7('0x3'));var moment=require(_0xf1c7('0x4'));var BPromise=require(_0xf1c7('0x5'));var Mustache=require(_0xf1c7('0x6'));var util=require('util');var path=require(_0xf1c7('0x7'));var sox=require(_0xf1c7('0x8'));var csv=require('to-csv');var ejs=require(_0xf1c7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1c7('0xa'));var crypto=require(_0xf1c7('0xb'));var jsforce=require(_0xf1c7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf1c7('0xd'));var querystring=require(_0xf1c7('0xe'));var Papa=require(_0xf1c7('0xf'));var Redis=require('ioredis');var authService=require(_0xf1c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf1c7('0x11'));var hardwareService=require(_0xf1c7('0x12'));var logger=require(_0xf1c7('0x13'))(_0xf1c7('0x14'));var utils=require(_0xf1c7('0x15'));var config=require(_0xf1c7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf1c7('0x17'))['db'];var jayson=require(_0xf1c7('0x18'));var client=jayson[_0xf1c7('0x19')][_0xf1c7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xdc217d,_0x31749d,_0x19eae0,_0x1f3af6){return new BPromise(function(_0x48c487,_0x2a41ee){var _0x2122d2=_0x1f3af6||client;return _0x2122d2[_0xf1c7('0x1b')](_0xdc217d,_0x19eae0)['then'](function(_0x4a5ef4){logger[_0xf1c7('0x1c')](_0xf1c7('0x1d'),_0x31749d,_0xf1c7('0x1e'));logger[_0xf1c7('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x31749d,_0xf1c7('0x1e'),JSON[_0xf1c7('0x20')](_0x4a5ef4));if(_0x4a5ef4[_0xf1c7('0x21')]){if(_0x4a5ef4[_0xf1c7('0x21')][_0xf1c7('0x22')]===0x1f4){logger[_0xf1c7('0x21')](_0xf1c7('0x1d'),_0x31749d,_0x4a5ef4[_0xf1c7('0x21')][_0xf1c7('0x23')]);return _0x2a41ee(_0x4a5ef4[_0xf1c7('0x21')]['message']);}logger[_0xf1c7('0x21')](_0xf1c7('0x1d'),_0x31749d,_0x4a5ef4[_0xf1c7('0x21')]['message']);return _0x48c487(_0x4a5ef4[_0xf1c7('0x21')][_0xf1c7('0x23')]);}else{logger[_0xf1c7('0x1c')](_0xf1c7('0x1d'),_0x31749d,_0xf1c7('0x1e'));_0x48c487(_0x4a5ef4['result'][_0xf1c7('0x23')]);}})[_0xf1c7('0x24')](function(_0x577cad){logger[_0xf1c7('0x21')](_0xf1c7('0x1d'),_0x31749d,_0x577cad);_0x2a41ee(_0x577cad);});});}function respondWithStatusCode(_0xa0818c,_0x3481bb){_0x3481bb=_0x3481bb||0xcc;return function(_0x4413d0){if(_0x4413d0){return _0xa0818c[_0xf1c7('0x25')](_0x3481bb);}return _0xa0818c[_0xf1c7('0x26')](_0x3481bb)[_0xf1c7('0x27')]();};}function respondWithResult(_0x1bfda2,_0x52ff00){_0x52ff00=_0x52ff00||0xc8;return function(_0xe75314){if(_0xe75314){return _0x1bfda2[_0xf1c7('0x26')](_0x52ff00)[_0xf1c7('0x28')](_0xe75314);}};}function respondWithFilteredResult(_0x442fe0,_0x2134db){return function(_0x5a5c2f){if(_0x5a5c2f){var _0x46eebe=_0x5a5c2f[_0xf1c7('0x29')],_0x1ff048=_0x2134db[_0xf1c7('0x2a')],_0x32c9e0=_0x2134db['offset']+_0x2134db[_0xf1c7('0x2b')],_0xd3deb4;if(_0x32c9e0>=_0x46eebe){_0x32c9e0=_0x46eebe;_0xd3deb4=0xc8;}else{_0xd3deb4=0xce;}_0x442fe0['status'](_0xd3deb4);return _0x442fe0[_0xf1c7('0x2c')]('Content-Range',_0x1ff048+'-'+_0x32c9e0+'/'+_0x46eebe)[_0xf1c7('0x28')](_0x5a5c2f);}return null;};}function patchUpdates(_0x21ae09){return function(_0x47291e){try{jsonpatch[_0xf1c7('0x2d')](_0x47291e,_0x21ae09,!![]);}catch(_0x3c8aeb){return BPromise[_0xf1c7('0x2e')](_0x3c8aeb);}return _0x47291e[_0xf1c7('0x2f')]();};}function saveUpdates(_0x4e24e4,_0x441ce5){return function(_0x510bc8){if(_0x510bc8){return _0x510bc8[_0xf1c7('0x30')](_0x4e24e4)[_0xf1c7('0x31')](function(_0x3be37c){return _0x3be37c;});}return null;};}function removeEntity(_0x49dbe7,_0x3e6d85){return function(_0x441538){if(_0x441538){return _0x441538[_0xf1c7('0x32')]()[_0xf1c7('0x31')](function(){_0x49dbe7[_0xf1c7('0x26')](0xcc)[_0xf1c7('0x27')]();});}};}function handleEntityNotFound(_0x3884ff,_0x2a4b29){return function(_0x17d97b){if(!_0x17d97b){_0x3884ff[_0xf1c7('0x25')](0x194);}return _0x17d97b;};}function handleError(_0x32774e,_0x138706){_0x138706=_0x138706||0x1f4;return function(_0xe6b541){logger[_0xf1c7('0x21')](_0xe6b541[_0xf1c7('0x33')]);if(_0xe6b541[_0xf1c7('0x34')]){delete _0xe6b541[_0xf1c7('0x34')];}_0x32774e['status'](_0x138706)[_0xf1c7('0x35')](_0xe6b541);};}exports[_0xf1c7('0x36')]=function(_0x4762f8,_0x254ab4){var _0xab5782={},_0x38ad96={},_0x317589={'count':0x0,'rows':[]};var _0x29df9a=_[_0xf1c7('0x37')](db[_0xf1c7('0x38')][_0xf1c7('0x39')],function(_0x4d540e){return{'name':_0x4d540e[_0xf1c7('0x3a')],'type':_0x4d540e[_0xf1c7('0x3b')]['key']};});_0x38ad96[_0xf1c7('0x3c')]=_[_0xf1c7('0x37')](_0x29df9a,_0xf1c7('0x34'));_0x38ad96[_0xf1c7('0x3d')]=_[_0xf1c7('0x3e')](_0x4762f8[_0xf1c7('0x3d')]);_0x38ad96[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x38ad96[_0xf1c7('0x3c')],_0x38ad96[_0xf1c7('0x3d')]);_0xab5782[_0xf1c7('0x41')]=_[_0xf1c7('0x40')](_0x38ad96['model'],qs[_0xf1c7('0x42')](_0x4762f8[_0xf1c7('0x3d')][_0xf1c7('0x42')]));_0xab5782[_0xf1c7('0x41')]=_0xab5782[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0xab5782[_0xf1c7('0x41')]:_0x38ad96[_0xf1c7('0x3c')];if(!_0x4762f8['query'][_0xf1c7('0x44')](_0xf1c7('0x45'))){_0xab5782[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x4762f8['query'][_0xf1c7('0x2b')]);_0xab5782[_0xf1c7('0x2a')]=qs['offset'](_0x4762f8['query'][_0xf1c7('0x2a')]);}_0xab5782[_0xf1c7('0x46')]=qs[_0xf1c7('0x47')](_0x4762f8[_0xf1c7('0x3d')][_0xf1c7('0x47')]);_0xab5782[_0xf1c7('0x48')]=qs[_0xf1c7('0x3f')](_[_0xf1c7('0x49')](_0x4762f8[_0xf1c7('0x3d')],_0x38ad96[_0xf1c7('0x3f')]),_0x29df9a);if(_0x4762f8[_0xf1c7('0x3d')][_0xf1c7('0x4a')]){_0xab5782[_0xf1c7('0x48')]=_['merge'](_0xab5782[_0xf1c7('0x48')],{'$or':_[_0xf1c7('0x37')](_0x29df9a,function(_0x1ed95f){if(_0x1ed95f['type']!==_0xf1c7('0x4b')){var _0x3b42cf={};_0x3b42cf[_0x1ed95f['name']]={'$like':'%'+_0x4762f8['query']['filter']+'%'};return _0x3b42cf;}})});}_0xab5782=_['merge']({},_0xab5782,_0x4762f8[_0xf1c7('0x4c')]);var _0x4bf150={'where':_0xab5782[_0xf1c7('0x48')]};return db['SugarcrmConfiguration'][_0xf1c7('0x29')](_0x4bf150)[_0xf1c7('0x31')](function(_0x2c1613){_0x317589[_0xf1c7('0x29')]=_0x2c1613;if(_0x4762f8['query'][_0xf1c7('0x4d')]){_0xab5782[_0xf1c7('0x4e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xf1c7('0x4f')](_0xab5782);})[_0xf1c7('0x31')](function(_0x498e26){_0x317589[_0xf1c7('0x50')]=_0x498e26;return _0x317589;})[_0xf1c7('0x31')](respondWithFilteredResult(_0x254ab4,_0xab5782))[_0xf1c7('0x24')](handleError(_0x254ab4,null));};exports[_0xf1c7('0x51')]=function(_0x5815cb,_0xa71c28){var _0x32d763={'raw':![],'where':{'id':_0x5815cb['params']['id']}},_0x5dcfee={};_0x5dcfee[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db['SugarcrmConfiguration'][_0xf1c7('0x39')]);_0x5dcfee[_0xf1c7('0x3d')]=_['keys'](_0x5815cb[_0xf1c7('0x3d')]);_0x5dcfee[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x5dcfee[_0xf1c7('0x3c')],_0x5dcfee[_0xf1c7('0x3d')]);_0x32d763[_0xf1c7('0x41')]=_[_0xf1c7('0x40')](_0x5dcfee[_0xf1c7('0x3c')],qs[_0xf1c7('0x42')](_0x5815cb[_0xf1c7('0x3d')][_0xf1c7('0x42')]));_0x32d763['attributes']=_0x32d763[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x32d763['attributes']:_0x5dcfee['model'];if(_0x5815cb[_0xf1c7('0x3d')]['includeAll']){_0x32d763[_0xf1c7('0x4e')]=[{'all':!![]}];}_0x32d763=_[_0xf1c7('0x52')]({},_0x32d763,_0x5815cb[_0xf1c7('0x4c')]);return db['SugarcrmConfiguration'][_0xf1c7('0x53')](_0x32d763)[_0xf1c7('0x31')](handleEntityNotFound(_0xa71c28,null))[_0xf1c7('0x31')](respondWithResult(_0xa71c28,null))['catch'](handleError(_0xa71c28,null));};exports['create']=function(_0x10f046,_0x32191f){return db[_0xf1c7('0x38')]['create'](_0x10f046[_0xf1c7('0x54')],{})[_0xf1c7('0x31')](respondWithResult(_0x32191f,0xc9))[_0xf1c7('0x24')](handleError(_0x32191f,null));};exports[_0xf1c7('0x30')]=function(_0x2e7a2d,_0x3dbdd1){if(_0x2e7a2d[_0xf1c7('0x54')]['id']){delete _0x2e7a2d[_0xf1c7('0x54')]['id'];}return db['SugarcrmConfiguration'][_0xf1c7('0x53')]({'where':{'id':_0x2e7a2d[_0xf1c7('0x55')]['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x3dbdd1,null))['then'](saveUpdates(_0x2e7a2d[_0xf1c7('0x54')],null))[_0xf1c7('0x31')](respondWithResult(_0x3dbdd1,null))[_0xf1c7('0x24')](handleError(_0x3dbdd1,null));};exports[_0xf1c7('0x32')]=function(_0x737919,_0x391363){return db[_0xf1c7('0x38')][_0xf1c7('0x53')]({'where':{'id':_0x737919['params']['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x391363,null))[_0xf1c7('0x31')](removeEntity(_0x391363,null))['catch'](handleError(_0x391363,null));};exports[_0xf1c7('0x56')]=function(_0x2a2904,_0x576eda,_0x561ec0){var _0x4d4be6={};var _0x3cfc79={};var _0x1b5735;var _0x382943;return db[_0xf1c7('0x38')]['findOne']({'where':{'id':_0x2a2904[_0xf1c7('0x55')]['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x576eda,null))[_0xf1c7('0x31')](function(_0x37890c){if(_0x37890c){_0x1b5735=_0x37890c;_0x3cfc79[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db[_0xf1c7('0x57')][_0xf1c7('0x39')]);_0x3cfc79[_0xf1c7('0x3d')]=_[_0xf1c7('0x3e')](_0x2a2904[_0xf1c7('0x3d')]);_0x3cfc79[_0xf1c7('0x3f')]=_['intersection'](_0x3cfc79['model'],_0x3cfc79[_0xf1c7('0x3d')]);_0x4d4be6['attributes']=_['intersection'](_0x3cfc79[_0xf1c7('0x3c')],qs['fields'](_0x2a2904['query'][_0xf1c7('0x42')]));_0x4d4be6[_0xf1c7('0x41')]=_0x4d4be6[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x4d4be6['attributes']:_0x3cfc79[_0xf1c7('0x3c')];_0x4d4be6[_0xf1c7('0x46')]=qs['sort'](_0x2a2904['query']['sort']);_0x4d4be6[_0xf1c7('0x48')]=qs[_0xf1c7('0x3f')](_['pick'](_0x2a2904[_0xf1c7('0x3d')],_0x3cfc79[_0xf1c7('0x3f')]));if(_0x2a2904[_0xf1c7('0x3d')][_0xf1c7('0x4a')]){_0x4d4be6['where']=_[_0xf1c7('0x52')](_0x4d4be6[_0xf1c7('0x48')],{'$or':_[_0xf1c7('0x37')](_0x4d4be6[_0xf1c7('0x41')],function(_0xa4c7d8){var _0x3818cc={};_0x3818cc[_0xa4c7d8]={'$like':'%'+_0x2a2904[_0xf1c7('0x3d')][_0xf1c7('0x4a')]+'%'};return _0x3818cc;})});}_0x4d4be6=_[_0xf1c7('0x52')]({},_0x4d4be6,_0x2a2904[_0xf1c7('0x4c')]);return _0x1b5735[_0xf1c7('0x56')](_0x4d4be6);}})[_0xf1c7('0x31')](function(_0x52a9eb){if(_0x52a9eb){_0x382943=_0x52a9eb[_0xf1c7('0x43')];if(!_0x2a2904[_0xf1c7('0x3d')]['hasOwnProperty']('nolimit')){_0x4d4be6[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x2a2904['query']['limit']);_0x4d4be6[_0xf1c7('0x2a')]=qs['offset'](_0x2a2904[_0xf1c7('0x3d')][_0xf1c7('0x2a')]);}return _0x1b5735[_0xf1c7('0x56')](_0x4d4be6);}})['then'](function(_0x1b3e97){if(_0x1b3e97){return _0x1b3e97?{'count':_0x382943,'rows':_0x1b3e97}:null;}})[_0xf1c7('0x31')](respondWithResult(_0x576eda,null))[_0xf1c7('0x24')](handleError(_0x576eda,null));};exports['getSubjects']=function(_0x1efe59,_0x1e18d9,_0x3c2c44){var _0x386a9b={};var _0x33d7e9={};var _0x25f2f3;var _0x350e03;return db[_0xf1c7('0x38')][_0xf1c7('0x58')]({'where':{'id':_0x1efe59['params']['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x1e18d9,null))[_0xf1c7('0x31')](function(_0x112288){if(_0x112288){_0x25f2f3=_0x112288;_0x33d7e9[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db[_0xf1c7('0x57')][_0xf1c7('0x39')]);_0x33d7e9[_0xf1c7('0x3d')]=_['keys'](_0x1efe59[_0xf1c7('0x3d')]);_0x33d7e9[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x33d7e9[_0xf1c7('0x3c')],_0x33d7e9[_0xf1c7('0x3d')]);_0x386a9b['attributes']=_[_0xf1c7('0x40')](_0x33d7e9[_0xf1c7('0x3c')],qs['fields'](_0x1efe59[_0xf1c7('0x3d')]['fields']));_0x386a9b[_0xf1c7('0x41')]=_0x386a9b[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x386a9b[_0xf1c7('0x41')]:_0x33d7e9[_0xf1c7('0x3c')];_0x386a9b[_0xf1c7('0x46')]=qs[_0xf1c7('0x47')](_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x47')]);_0x386a9b[_0xf1c7('0x48')]=qs[_0xf1c7('0x3f')](_[_0xf1c7('0x49')](_0x1efe59['query'],_0x33d7e9[_0xf1c7('0x3f')]));if(_0x1efe59[_0xf1c7('0x3d')]['filter']){_0x386a9b['where']=_[_0xf1c7('0x52')](_0x386a9b[_0xf1c7('0x48')],{'$or':_['map'](_0x386a9b[_0xf1c7('0x41')],function(_0x57d5ae){var _0x49ef36={};_0x49ef36[_0x57d5ae]={'$like':'%'+_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x4a')]+'%'};return _0x49ef36;})});}_0x386a9b=_[_0xf1c7('0x52')]({},_0x386a9b,_0x1efe59[_0xf1c7('0x4c')]);return _0x25f2f3[_0xf1c7('0x59')](_0x386a9b);}})[_0xf1c7('0x31')](function(_0x55147c){if(_0x55147c){_0x350e03=_0x55147c[_0xf1c7('0x43')];if(!_0x1efe59['query'][_0xf1c7('0x44')](_0xf1c7('0x45'))){_0x386a9b[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x2b')]);_0x386a9b['offset']=qs['offset'](_0x1efe59[_0xf1c7('0x3d')][_0xf1c7('0x2a')]);}return _0x25f2f3[_0xf1c7('0x59')](_0x386a9b);}})[_0xf1c7('0x31')](function(_0x57fa79){if(_0x57fa79){return _0x57fa79?{'count':_0x350e03,'rows':_0x57fa79}:null;}})[_0xf1c7('0x31')](respondWithResult(_0x1e18d9,null))[_0xf1c7('0x24')](handleError(_0x1e18d9,null));};exports[_0xf1c7('0x5a')]=function(_0x41bf5,_0x4f87ea,_0x1ff950){var _0x436c0a={};var _0x36562c={};var _0x1a614a;var _0x2a8140;return db['SugarcrmConfiguration'][_0xf1c7('0x58')]({'where':{'id':_0x41bf5[_0xf1c7('0x55')]['id']}})[_0xf1c7('0x31')](handleEntityNotFound(_0x4f87ea,null))[_0xf1c7('0x31')](function(_0x1f8d16){if(_0x1f8d16){_0x1a614a=_0x1f8d16;_0x36562c[_0xf1c7('0x3c')]=_[_0xf1c7('0x3e')](db[_0xf1c7('0x57')][_0xf1c7('0x39')]);_0x36562c[_0xf1c7('0x3d')]=_[_0xf1c7('0x3e')](_0x41bf5[_0xf1c7('0x3d')]);_0x36562c[_0xf1c7('0x3f')]=_[_0xf1c7('0x40')](_0x36562c[_0xf1c7('0x3c')],_0x36562c[_0xf1c7('0x3d')]);_0x436c0a[_0xf1c7('0x41')]=_[_0xf1c7('0x40')](_0x36562c['model'],qs[_0xf1c7('0x42')](_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x42')]));_0x436c0a[_0xf1c7('0x41')]=_0x436c0a[_0xf1c7('0x41')][_0xf1c7('0x43')]?_0x436c0a[_0xf1c7('0x41')]:_0x36562c[_0xf1c7('0x3c')];_0x436c0a[_0xf1c7('0x46')]=qs[_0xf1c7('0x47')](_0x41bf5[_0xf1c7('0x3d')]['sort']);_0x436c0a[_0xf1c7('0x48')]=qs['filters'](_[_0xf1c7('0x49')](_0x41bf5[_0xf1c7('0x3d')],_0x36562c['filters']));if(_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x4a')]){_0x436c0a['where']=_['merge'](_0x436c0a[_0xf1c7('0x48')],{'$or':_[_0xf1c7('0x37')](_0x436c0a[_0xf1c7('0x41')],function(_0x560c5d){var _0x5bce46={};_0x5bce46[_0x560c5d]={'$like':'%'+_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x4a')]+'%'};return _0x5bce46;})});}_0x436c0a=_[_0xf1c7('0x52')]({},_0x436c0a,_0x41bf5['options']);return _0x1a614a[_0xf1c7('0x5a')](_0x436c0a);}})[_0xf1c7('0x31')](function(_0x174908){if(_0x174908){_0x2a8140=_0x174908[_0xf1c7('0x43')];if(!_0x41bf5[_0xf1c7('0x3d')]['hasOwnProperty'](_0xf1c7('0x45'))){_0x436c0a[_0xf1c7('0x2b')]=qs[_0xf1c7('0x2b')](_0x41bf5[_0xf1c7('0x3d')][_0xf1c7('0x2b')]);_0x436c0a[_0xf1c7('0x2a')]=qs[_0xf1c7('0x2a')](_0x41bf5['query'][_0xf1c7('0x2a')]);}return _0x1a614a['getDescriptions'](_0x436c0a);}})[_0xf1c7('0x31')](function(_0x39682a){if(_0x39682a){return _0x39682a?{'count':_0x2a8140,'rows':_0x39682a}:null;}})[_0xf1c7('0x31')](respondWithResult(_0x4f87ea,null))[_0xf1c7('0x24')](handleError(_0x4f87ea,null));}; \ No newline at end of file +var _0x7cbc=['params','include','create','body','update','find','findOne','SugarcrmField','getFields','getSubjects','order','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','rows'];(function(_0x569da2,_0x26aa52){var _0x211bcf=function(_0x1fa0c2){while(--_0x1fa0c2){_0x569da2['push'](_0x569da2['shift']());}};_0x211bcf(++_0x26aa52);}(_0x7cbc,0x171));var _0xc7cb=function(_0x3c12ed,_0x55bc55){_0x3c12ed=_0x3c12ed-0x0;var _0x43320e=_0x7cbc[_0x3c12ed];return _0x43320e;};'use strict';var pdf=require(_0xc7cb('0x0'));var emlformat=require(_0xc7cb('0x1'));var rimraf=require(_0xc7cb('0x2'));var zipdir=require(_0xc7cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7cb('0x4'));var moment=require('moment');var BPromise=require(_0xc7cb('0x5'));var Mustache=require(_0xc7cb('0x6'));var util=require('util');var path=require(_0xc7cb('0x7'));var sox=require(_0xc7cb('0x8'));var csv=require(_0xc7cb('0x9'));var ejs=require(_0xc7cb('0xa'));var fs=require('fs');var _=require(_0xc7cb('0xb'));var squel=require('squel');var crypto=require(_0xc7cb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc7cb('0xd'));var Papa=require(_0xc7cb('0xe'));var Redis=require(_0xc7cb('0xf'));var authService=require(_0xc7cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc7cb('0x11'));var hardwareService=require(_0xc7cb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc7cb('0x13'));var config=require(_0xc7cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc7cb('0x15'))['db'];var jayson=require(_0xc7cb('0x16'));var client=jayson[_0xc7cb('0x17')][_0xc7cb('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2e9266,_0x458887,_0x4e9ffd,_0x973f7d){return new BPromise(function(_0xe6aa78,_0x2c844f){var _0x3af4bb=_0x973f7d||client;return _0x3af4bb[_0xc7cb('0x19')](_0x2e9266,_0x4e9ffd)[_0xc7cb('0x1a')](function(_0x114153){logger[_0xc7cb('0x1b')](_0xc7cb('0x1c'),_0x458887,_0xc7cb('0x1d'));logger[_0xc7cb('0x1e')](_0xc7cb('0x1f'),_0x458887,_0xc7cb('0x1d'),JSON[_0xc7cb('0x20')](_0x114153));if(_0x114153[_0xc7cb('0x21')]){if(_0x114153[_0xc7cb('0x21')][_0xc7cb('0x22')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x458887,_0x114153[_0xc7cb('0x21')][_0xc7cb('0x23')]);return _0x2c844f(_0x114153[_0xc7cb('0x21')][_0xc7cb('0x23')]);}logger[_0xc7cb('0x21')](_0xc7cb('0x1c'),_0x458887,_0x114153['error'][_0xc7cb('0x23')]);return _0xe6aa78(_0x114153[_0xc7cb('0x21')][_0xc7cb('0x23')]);}else{logger[_0xc7cb('0x1b')](_0xc7cb('0x1c'),_0x458887,_0xc7cb('0x1d'));_0xe6aa78(_0x114153[_0xc7cb('0x24')]['message']);}})[_0xc7cb('0x25')](function(_0x59ed96){logger[_0xc7cb('0x21')](_0xc7cb('0x1c'),_0x458887,_0x59ed96);_0x2c844f(_0x59ed96);});});}function respondWithStatusCode(_0x3ef390,_0x4aaf48){_0x4aaf48=_0x4aaf48||0xcc;return function(_0x27e22c){if(_0x27e22c){return _0x3ef390[_0xc7cb('0x26')](_0x4aaf48);}return _0x3ef390['status'](_0x4aaf48)[_0xc7cb('0x27')]();};}function respondWithResult(_0x488f52,_0x354e1a){_0x354e1a=_0x354e1a||0xc8;return function(_0x541992){if(_0x541992){return _0x488f52[_0xc7cb('0x28')](_0x354e1a)[_0xc7cb('0x29')](_0x541992);}};}function respondWithFilteredResult(_0x308ac3,_0x5ab5bf){return function(_0x22a115){if(_0x22a115){var _0x1ee377=_0x22a115[_0xc7cb('0x2a')],_0x1f2297=_0x5ab5bf[_0xc7cb('0x2b')],_0x100084=_0x5ab5bf[_0xc7cb('0x2b')]+_0x5ab5bf['limit'],_0x5096e5;if(_0x100084>=_0x1ee377){_0x100084=_0x1ee377;_0x5096e5=0xc8;}else{_0x5096e5=0xce;}_0x308ac3[_0xc7cb('0x28')](_0x5096e5);return _0x308ac3[_0xc7cb('0x2c')]('Content-Range',_0x1f2297+'-'+_0x100084+'/'+_0x1ee377)[_0xc7cb('0x29')](_0x22a115);}return null;};}function patchUpdates(_0x36e6c5){return function(_0x1048bb){try{jsonpatch[_0xc7cb('0x2d')](_0x1048bb,_0x36e6c5,!![]);}catch(_0x293253){return BPromise['reject'](_0x293253);}return _0x1048bb['save']();};}function saveUpdates(_0x4df643,_0x46b3eb){return function(_0x2b7d4f){if(_0x2b7d4f){return _0x2b7d4f['update'](_0x4df643)[_0xc7cb('0x1a')](function(_0x55f3c3){return _0x55f3c3;});}return null;};}function removeEntity(_0x515de1,_0x748d85){return function(_0x387e23){if(_0x387e23){return _0x387e23[_0xc7cb('0x2e')]()[_0xc7cb('0x1a')](function(){_0x515de1[_0xc7cb('0x28')](0xcc)[_0xc7cb('0x27')]();});}};}function handleEntityNotFound(_0x548f3d,_0x1c32db){return function(_0x458d6c){if(!_0x458d6c){_0x548f3d[_0xc7cb('0x26')](0x194);}return _0x458d6c;};}function handleError(_0x4b6e49,_0x2b311){_0x2b311=_0x2b311||0x1f4;return function(_0x5866f0){logger[_0xc7cb('0x21')](_0x5866f0['stack']);if(_0x5866f0[_0xc7cb('0x2f')]){delete _0x5866f0[_0xc7cb('0x2f')];}_0x4b6e49[_0xc7cb('0x28')](_0x2b311)[_0xc7cb('0x30')](_0x5866f0);};}exports[_0xc7cb('0x31')]=function(_0x1a9ee3,_0x4dab19){var _0x4e430b={},_0x3e86d0={},_0x32015f={'count':0x0,'rows':[]};var _0x4c3929=_[_0xc7cb('0x32')](db['SugarcrmConfiguration'][_0xc7cb('0x33')],function(_0xe4cb48){return{'name':_0xe4cb48[_0xc7cb('0x34')],'type':_0xe4cb48[_0xc7cb('0x35')][_0xc7cb('0x36')]};});_0x3e86d0['model']=_[_0xc7cb('0x32')](_0x4c3929,_0xc7cb('0x2f'));_0x3e86d0[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x1a9ee3[_0xc7cb('0x37')]);_0x3e86d0[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0x3e86d0['model'],_0x3e86d0[_0xc7cb('0x37')]);_0x4e430b[_0xc7cb('0x3b')]=_[_0xc7cb('0x3a')](_0x3e86d0[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x3d')]));_0x4e430b[_0xc7cb('0x3b')]=_0x4e430b[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x4e430b['attributes']:_0x3e86d0[_0xc7cb('0x3c')];if(!_0x1a9ee3['query'][_0xc7cb('0x3f')](_0xc7cb('0x40'))){_0x4e430b['limit']=qs[_0xc7cb('0x41')](_0x1a9ee3[_0xc7cb('0x37')]['limit']);_0x4e430b['offset']=qs['offset'](_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x2b')]);}_0x4e430b['order']=qs[_0xc7cb('0x42')](_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x42')]);_0x4e430b[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_['pick'](_0x1a9ee3['query'],_0x3e86d0[_0xc7cb('0x39')]),_0x4c3929);if(_0x1a9ee3['query'][_0xc7cb('0x44')]){_0x4e430b[_0xc7cb('0x43')]=_[_0xc7cb('0x45')](_0x4e430b[_0xc7cb('0x43')],{'$or':_[_0xc7cb('0x32')](_0x4c3929,function(_0x29d4e5){if(_0x29d4e5[_0xc7cb('0x35')]!==_0xc7cb('0x46')){var _0xd3dd3e={};_0xd3dd3e[_0x29d4e5[_0xc7cb('0x2f')]]={'$like':'%'+_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x44')]+'%'};return _0xd3dd3e;}})});}_0x4e430b=_['merge']({},_0x4e430b,_0x1a9ee3[_0xc7cb('0x47')]);var _0x2a2c10={'where':_0x4e430b[_0xc7cb('0x43')]};return db[_0xc7cb('0x48')]['count'](_0x2a2c10)[_0xc7cb('0x1a')](function(_0x350450){_0x32015f['count']=_0x350450;if(_0x1a9ee3[_0xc7cb('0x37')][_0xc7cb('0x49')]){_0x4e430b['include']=[{'all':!![]}];}return db[_0xc7cb('0x48')][_0xc7cb('0x4a')](_0x4e430b);})[_0xc7cb('0x1a')](function(_0x6b3d60){_0x32015f[_0xc7cb('0x4b')]=_0x6b3d60;return _0x32015f;})[_0xc7cb('0x1a')](respondWithFilteredResult(_0x4dab19,_0x4e430b))[_0xc7cb('0x25')](handleError(_0x4dab19,null));};exports['show']=function(_0x24b36e,_0x4b88c2){var _0x197b44={'raw':![],'where':{'id':_0x24b36e[_0xc7cb('0x4c')]['id']}},_0x5bd024={};_0x5bd024[_0xc7cb('0x3c')]=_[_0xc7cb('0x38')](db[_0xc7cb('0x48')][_0xc7cb('0x33')]);_0x5bd024[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x24b36e['query']);_0x5bd024[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0x5bd024[_0xc7cb('0x3c')],_0x5bd024[_0xc7cb('0x37')]);_0x197b44[_0xc7cb('0x3b')]=_['intersection'](_0x5bd024[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0x24b36e[_0xc7cb('0x37')][_0xc7cb('0x3d')]));_0x197b44[_0xc7cb('0x3b')]=_0x197b44[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x197b44[_0xc7cb('0x3b')]:_0x5bd024[_0xc7cb('0x3c')];if(_0x24b36e[_0xc7cb('0x37')][_0xc7cb('0x49')]){_0x197b44[_0xc7cb('0x4d')]=[{'all':!![]}];}_0x197b44=_[_0xc7cb('0x45')]({},_0x197b44,_0x24b36e['options']);return db[_0xc7cb('0x48')]['find'](_0x197b44)[_0xc7cb('0x1a')](handleEntityNotFound(_0x4b88c2,null))[_0xc7cb('0x1a')](respondWithResult(_0x4b88c2,null))[_0xc7cb('0x25')](handleError(_0x4b88c2,null));};exports[_0xc7cb('0x4e')]=function(_0x5191af,_0x4b98de){return db[_0xc7cb('0x48')]['create'](_0x5191af[_0xc7cb('0x4f')],{})[_0xc7cb('0x1a')](respondWithResult(_0x4b98de,0xc9))['catch'](handleError(_0x4b98de,null));};exports[_0xc7cb('0x50')]=function(_0x46c7f6,_0x63e1c){if(_0x46c7f6[_0xc7cb('0x4f')]['id']){delete _0x46c7f6['body']['id'];}return db[_0xc7cb('0x48')][_0xc7cb('0x51')]({'where':{'id':_0x46c7f6[_0xc7cb('0x4c')]['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x63e1c,null))[_0xc7cb('0x1a')](saveUpdates(_0x46c7f6[_0xc7cb('0x4f')],null))[_0xc7cb('0x1a')](respondWithResult(_0x63e1c,null))[_0xc7cb('0x25')](handleError(_0x63e1c,null));};exports['destroy']=function(_0xd7a478,_0x49b3fe){return db[_0xc7cb('0x48')][_0xc7cb('0x51')]({'where':{'id':_0xd7a478[_0xc7cb('0x4c')]['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x49b3fe,null))[_0xc7cb('0x1a')](removeEntity(_0x49b3fe,null))[_0xc7cb('0x25')](handleError(_0x49b3fe,null));};exports['getFields']=function(_0xa2a021,_0x5c367c,_0x210888){var _0x323f7c={};var _0x5258ea={};var _0x444446;var _0x120832;return db[_0xc7cb('0x48')][_0xc7cb('0x52')]({'where':{'id':_0xa2a021[_0xc7cb('0x4c')]['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x5c367c,null))[_0xc7cb('0x1a')](function(_0xdb64a0){if(_0xdb64a0){_0x444446=_0xdb64a0;_0x5258ea[_0xc7cb('0x3c')]=_['keys'](db[_0xc7cb('0x53')][_0xc7cb('0x33')]);_0x5258ea[_0xc7cb('0x37')]=_['keys'](_0xa2a021[_0xc7cb('0x37')]);_0x5258ea[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0x5258ea['model'],_0x5258ea[_0xc7cb('0x37')]);_0x323f7c['attributes']=_[_0xc7cb('0x3a')](_0x5258ea[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0xa2a021[_0xc7cb('0x37')]['fields']));_0x323f7c[_0xc7cb('0x3b')]=_0x323f7c[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x323f7c['attributes']:_0x5258ea[_0xc7cb('0x3c')];_0x323f7c['order']=qs[_0xc7cb('0x42')](_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x42')]);_0x323f7c[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_['pick'](_0xa2a021[_0xc7cb('0x37')],_0x5258ea[_0xc7cb('0x39')]));if(_0xa2a021['query']['filter']){_0x323f7c[_0xc7cb('0x43')]=_[_0xc7cb('0x45')](_0x323f7c[_0xc7cb('0x43')],{'$or':_[_0xc7cb('0x32')](_0x323f7c[_0xc7cb('0x3b')],function(_0x2308ea){var _0xd97787={};_0xd97787[_0x2308ea]={'$like':'%'+_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x44')]+'%'};return _0xd97787;})});}_0x323f7c=_[_0xc7cb('0x45')]({},_0x323f7c,_0xa2a021['options']);return _0x444446[_0xc7cb('0x54')](_0x323f7c);}})[_0xc7cb('0x1a')](function(_0x382394){if(_0x382394){_0x120832=_0x382394[_0xc7cb('0x3e')];if(!_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x3f')](_0xc7cb('0x40'))){_0x323f7c['limit']=qs[_0xc7cb('0x41')](_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x41')]);_0x323f7c[_0xc7cb('0x2b')]=qs['offset'](_0xa2a021[_0xc7cb('0x37')][_0xc7cb('0x2b')]);}return _0x444446['getFields'](_0x323f7c);}})['then'](function(_0x3d82d0){if(_0x3d82d0){return _0x3d82d0?{'count':_0x120832,'rows':_0x3d82d0}:null;}})[_0xc7cb('0x1a')](respondWithResult(_0x5c367c,null))['catch'](handleError(_0x5c367c,null));};exports[_0xc7cb('0x55')]=function(_0x5c889c,_0xeef3c5,_0x235689){var _0x98e4d2={};var _0x581674={};var _0x3ef183;var _0x3d14e3;return db[_0xc7cb('0x48')][_0xc7cb('0x52')]({'where':{'id':_0x5c889c[_0xc7cb('0x4c')]['id']}})['then'](handleEntityNotFound(_0xeef3c5,null))[_0xc7cb('0x1a')](function(_0x306b97){if(_0x306b97){_0x3ef183=_0x306b97;_0x581674[_0xc7cb('0x3c')]=_[_0xc7cb('0x38')](db[_0xc7cb('0x53')]['rawAttributes']);_0x581674[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x5c889c[_0xc7cb('0x37')]);_0x581674[_0xc7cb('0x39')]=_['intersection'](_0x581674[_0xc7cb('0x3c')],_0x581674[_0xc7cb('0x37')]);_0x98e4d2[_0xc7cb('0x3b')]=_['intersection'](_0x581674[_0xc7cb('0x3c')],qs['fields'](_0x5c889c['query'][_0xc7cb('0x3d')]));_0x98e4d2[_0xc7cb('0x3b')]=_0x98e4d2[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x98e4d2['attributes']:_0x581674['model'];_0x98e4d2[_0xc7cb('0x56')]=qs[_0xc7cb('0x42')](_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x42')]);_0x98e4d2[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_[_0xc7cb('0x57')](_0x5c889c['query'],_0x581674[_0xc7cb('0x39')]));if(_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x44')]){_0x98e4d2[_0xc7cb('0x43')]=_['merge'](_0x98e4d2['where'],{'$or':_[_0xc7cb('0x32')](_0x98e4d2['attributes'],function(_0x2dbc73){var _0x4a45df={};_0x4a45df[_0x2dbc73]={'$like':'%'+_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x44')]+'%'};return _0x4a45df;})});}_0x98e4d2=_['merge']({},_0x98e4d2,_0x5c889c[_0xc7cb('0x47')]);return _0x3ef183[_0xc7cb('0x55')](_0x98e4d2);}})['then'](function(_0x3199b2){if(_0x3199b2){_0x3d14e3=_0x3199b2[_0xc7cb('0x3e')];if(!_0x5c889c[_0xc7cb('0x37')]['hasOwnProperty'](_0xc7cb('0x40'))){_0x98e4d2[_0xc7cb('0x41')]=qs[_0xc7cb('0x41')](_0x5c889c[_0xc7cb('0x37')][_0xc7cb('0x41')]);_0x98e4d2[_0xc7cb('0x2b')]=qs['offset'](_0x5c889c[_0xc7cb('0x37')]['offset']);}return _0x3ef183[_0xc7cb('0x55')](_0x98e4d2);}})[_0xc7cb('0x1a')](function(_0x41c53b){if(_0x41c53b){return _0x41c53b?{'count':_0x3d14e3,'rows':_0x41c53b}:null;}})['then'](respondWithResult(_0xeef3c5,null))[_0xc7cb('0x25')](handleError(_0xeef3c5,null));};exports[_0xc7cb('0x58')]=function(_0x1dff6d,_0x4f8d24,_0x3b8b4a){var _0x2069e6={};var _0xd31f19={};var _0x46c2b8;var _0x135f62;return db[_0xc7cb('0x48')][_0xc7cb('0x52')]({'where':{'id':_0x1dff6d['params']['id']}})[_0xc7cb('0x1a')](handleEntityNotFound(_0x4f8d24,null))[_0xc7cb('0x1a')](function(_0x242d2e){if(_0x242d2e){_0x46c2b8=_0x242d2e;_0xd31f19[_0xc7cb('0x3c')]=_[_0xc7cb('0x38')](db[_0xc7cb('0x53')][_0xc7cb('0x33')]);_0xd31f19[_0xc7cb('0x37')]=_[_0xc7cb('0x38')](_0x1dff6d['query']);_0xd31f19[_0xc7cb('0x39')]=_[_0xc7cb('0x3a')](_0xd31f19[_0xc7cb('0x3c')],_0xd31f19['query']);_0x2069e6[_0xc7cb('0x3b')]=_[_0xc7cb('0x3a')](_0xd31f19[_0xc7cb('0x3c')],qs[_0xc7cb('0x3d')](_0x1dff6d['query'][_0xc7cb('0x3d')]));_0x2069e6[_0xc7cb('0x3b')]=_0x2069e6[_0xc7cb('0x3b')][_0xc7cb('0x3e')]?_0x2069e6[_0xc7cb('0x3b')]:_0xd31f19[_0xc7cb('0x3c')];_0x2069e6[_0xc7cb('0x56')]=qs[_0xc7cb('0x42')](_0x1dff6d['query']['sort']);_0x2069e6[_0xc7cb('0x43')]=qs[_0xc7cb('0x39')](_[_0xc7cb('0x57')](_0x1dff6d[_0xc7cb('0x37')],_0xd31f19['filters']));if(_0x1dff6d[_0xc7cb('0x37')][_0xc7cb('0x44')]){_0x2069e6[_0xc7cb('0x43')]=_['merge'](_0x2069e6['where'],{'$or':_[_0xc7cb('0x32')](_0x2069e6[_0xc7cb('0x3b')],function(_0x575c11){var _0x27bc46={};_0x27bc46[_0x575c11]={'$like':'%'+_0x1dff6d['query']['filter']+'%'};return _0x27bc46;})});}_0x2069e6=_['merge']({},_0x2069e6,_0x1dff6d[_0xc7cb('0x47')]);return _0x46c2b8['getDescriptions'](_0x2069e6);}})['then'](function(_0x5ec0a2){if(_0x5ec0a2){_0x135f62=_0x5ec0a2[_0xc7cb('0x3e')];if(!_0x1dff6d['query'][_0xc7cb('0x3f')](_0xc7cb('0x40'))){_0x2069e6[_0xc7cb('0x41')]=qs[_0xc7cb('0x41')](_0x1dff6d[_0xc7cb('0x37')][_0xc7cb('0x41')]);_0x2069e6['offset']=qs[_0xc7cb('0x2b')](_0x1dff6d['query']['offset']);}return _0x46c2b8[_0xc7cb('0x58')](_0x2069e6);}})[_0xc7cb('0x1a')](function(_0x1caf72){if(_0x1caf72){return _0x1caf72?{'count':_0x135f62,'rows':_0x1caf72}:null;}})['then'](respondWithResult(_0x4f8d24,null))['catch'](handleError(_0x4f8d24,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5a8221f..2b46dd6 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 _0x4873=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x261999,_0x15f7e8){var _0x109e04=function(_0x4c8e93){while(--_0x4c8e93){_0x261999['push'](_0x261999['shift']());}};_0x109e04(++_0x15f7e8);}(_0x4873,0xe9));var _0x3487=function(_0x2148a8,_0x48fec1){_0x2148a8=_0x2148a8-0x0;var _0x2cea12=_0x4873[_0x2148a8];return _0x2cea12;};'use strict';var _=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3487('0x2'));var BPromise=require('bluebird');var rp=require(_0x3487('0x3'));var fs=require('fs');var path=require(_0x3487('0x4'));var rimraf=require('rimraf');var config=require(_0x3487('0x5'));var attributes=require(_0x3487('0x6'));module[_0x3487('0x7')]=function(_0x3deaa2,_0x2c6d0c){return _0x3deaa2[_0x3487('0x8')](_0x3487('0x9'),attributes,{'tableName':_0x3487('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52d1=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','api','moment'];(function(_0x337651,_0x2af690){var _0x20893c=function(_0x545dcd){while(--_0x545dcd){_0x337651['push'](_0x337651['shift']());}};_0x20893c(++_0x2af690);}(_0x52d1,0x17f));var _0x152d=function(_0x385a9e,_0x4069be){_0x385a9e=_0x385a9e-0x0;var _0x2b1168=_0x52d1[_0x385a9e];return _0x2b1168;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x152d('0x0'));var moment=require(_0x152d('0x1'));var BPromise=require(_0x152d('0x2'));var rp=require(_0x152d('0x3'));var fs=require('fs');var path=require(_0x152d('0x4'));var rimraf=require(_0x152d('0x5'));var config=require(_0x152d('0x6'));var attributes=require(_0x152d('0x7'));module[_0x152d('0x8')]=function(_0x3e2d35,_0xda68c2){return _0x3e2d35[_0x152d('0x9')](_0x152d('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 bb1818b..e0c6fa2 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 _0x7a9b=['message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b057d,_0x2ccd9e){var _0x1d3c44=function(_0x2cba63){while(--_0x2cba63){_0x4b057d['push'](_0x4b057d['shift']());}};_0x1d3c44(++_0x2ccd9e);}(_0x7a9b,0x15d));var _0xb7a9=function(_0x5cc51d,_0x1e2e33){_0x5cc51d=_0x5cc51d-0x0;var _0x3975d9=_0x7a9b[_0x5cc51d];return _0x3975d9;};'use strict';var _=require('lodash');var util=require(_0xb7a9('0x0'));var moment=require(_0xb7a9('0x1'));var BPromise=require(_0xb7a9('0x2'));var rs=require(_0xb7a9('0x3'));var fs=require('fs');var Redis=require(_0xb7a9('0x4'));var db=require(_0xb7a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7a9('0x6'))(_0xb7a9('0x7'));var config=require(_0xb7a9('0x8'));var jayson=require(_0xb7a9('0x9'));var client=jayson['client'][_0xb7a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x413206,_0x17506e,_0x1096cf){return new BPromise(function(_0xda2711,_0x5bf3e9){return client['request'](_0x413206,_0x1096cf)[_0xb7a9('0xb')](function(_0xdf722b){logger[_0xb7a9('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17506e,_0xb7a9('0xd'));logger[_0xb7a9('0xe')](_0xb7a9('0xf'),_0x17506e,_0xb7a9('0xd'),JSON[_0xb7a9('0x10')](_0xdf722b));if(_0xdf722b[_0xb7a9('0x11')]){if(_0xdf722b[_0xb7a9('0x11')][_0xb7a9('0x12')]===0x1f4){logger[_0xb7a9('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x17506e,_0xdf722b[_0xb7a9('0x11')]['message']);return _0x5bf3e9(_0xdf722b['error'][_0xb7a9('0x13')]);}logger[_0xb7a9('0x11')](_0xb7a9('0x14'),_0x17506e,_0xdf722b['error'][_0xb7a9('0x13')]);return _0xda2711(_0xdf722b[_0xb7a9('0x11')][_0xb7a9('0x13')]);}else{logger[_0xb7a9('0xc')](_0xb7a9('0x14'),_0x17506e,_0xb7a9('0xd'));_0xda2711(_0xdf722b[_0xb7a9('0x15')][_0xb7a9('0x13')]);}})[_0xb7a9('0x16')](function(_0x55d92a){logger[_0xb7a9('0x11')](_0xb7a9('0x14'),_0x17506e,_0x55d92a);_0x5bf3e9(_0x55d92a);});});} \ No newline at end of file +var _0xd4b0=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a9029,_0x35f9d8){var _0x5742fc=function(_0x3519e8){while(--_0x3519e8){_0x2a9029['push'](_0x2a9029['shift']());}};_0x5742fc(++_0x35f9d8);}(_0xd4b0,0x1d0));var _0x0d4b=function(_0x6ff837,_0x49d852){_0x6ff837=_0x6ff837-0x0;var _0x20e8ec=_0xd4b0[_0x6ff837];return _0x20e8ec;};'use strict';var _=require(_0x0d4b('0x0'));var util=require(_0x0d4b('0x1'));var moment=require(_0x0d4b('0x2'));var BPromise=require(_0x0d4b('0x3'));var rs=require(_0x0d4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d4b('0x5'))['db'];var utils=require(_0x0d4b('0x6'));var logger=require(_0x0d4b('0x7'))(_0x0d4b('0x8'));var config=require(_0x0d4b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0d4b('0xa')][_0x0d4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf788ed,_0x328b7c,_0x37c2a6){return new BPromise(function(_0x381373,_0x1a3de2){return client[_0x0d4b('0xc')](_0xf788ed,_0x37c2a6)['then'](function(_0x13e759){logger['info'](_0x0d4b('0xd'),_0x328b7c,_0x0d4b('0xe'));logger['debug'](_0x0d4b('0xf'),_0x328b7c,_0x0d4b('0xe'),JSON[_0x0d4b('0x10')](_0x13e759));if(_0x13e759[_0x0d4b('0x11')]){if(_0x13e759[_0x0d4b('0x11')][_0x0d4b('0x12')]===0x1f4){logger[_0x0d4b('0x11')](_0x0d4b('0xd'),_0x328b7c,_0x13e759[_0x0d4b('0x11')][_0x0d4b('0x13')]);return _0x1a3de2(_0x13e759['error'][_0x0d4b('0x13')]);}logger[_0x0d4b('0x11')](_0x0d4b('0xd'),_0x328b7c,_0x13e759[_0x0d4b('0x11')][_0x0d4b('0x13')]);return _0x381373(_0x13e759['error'][_0x0d4b('0x13')]);}else{logger[_0x0d4b('0x14')](_0x0d4b('0xd'),_0x328b7c,_0x0d4b('0xe'));_0x381373(_0x13e759[_0x0d4b('0x15')]['message']);}})[_0x0d4b('0x16')](function(_0x5abf93){logger[_0x0d4b('0x11')](_0x0d4b('0xd'),_0x328b7c,_0x5abf93);_0x1a3de2(_0x5abf93);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3b0565f..33a8bd2 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 _0xc056=['../../config/environment','./intSugarcrmField.controller','index','isAuthenticated','post','create','/:id','update','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc056,0x9f));var _0x6c05=function(_0x15262b,_0x966690){_0x15262b=_0x15262b-0x0;var _0x371a9a=_0xc056[_0x15262b];return _0x371a9a;};'use strict';var multer=require(_0x6c05('0x0'));var util=require(_0x6c05('0x1'));var path=require(_0x6c05('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c05('0x3'));var router=express[_0x6c05('0x4')]();var auth=require(_0x6c05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c05('0x6'));var controller=require(_0x6c05('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6c05('0x8')]);router['get']('/:id',auth[_0x6c05('0x9')](),controller['show']);router[_0x6c05('0xa')]('/',auth[_0x6c05('0x9')](),controller[_0x6c05('0xb')]);router['put'](_0x6c05('0xc'),auth[_0x6c05('0x9')](),controller[_0x6c05('0xd')]);router['delete']('/:id',auth[_0x6c05('0x9')](),controller[_0x6c05('0xe')]);module['exports']=router; \ No newline at end of file +var _0xece2=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xece2,0x13e));var _0x2ece=function(_0x3d8e8d,_0x329780){_0x3d8e8d=_0x3d8e8d-0x0;var _0x4eca1=_0xece2[_0x3d8e8d];return _0x4eca1;};'use strict';var multer=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var path=require(_0x2ece('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2ece('0x3'));var interaction=require(_0x2ece('0x4'));var config=require('../../config/environment');var controller=require(_0x2ece('0x5'));router[_0x2ece('0x6')]('/',auth[_0x2ece('0x7')](),controller[_0x2ece('0x8')]);router[_0x2ece('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2ece('0x9')]);router[_0x2ece('0xa')]('/',auth[_0x2ece('0x7')](),controller[_0x2ece('0xb')]);router[_0x2ece('0xc')](_0x2ece('0xd'),auth[_0x2ece('0x7')](),controller[_0x2ece('0xe')]);router[_0x2ece('0xf')]('/:id',auth[_0x2ece('0x7')](),controller[_0x2ece('0x10')]);module[_0x2ece('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a9db0de..835c1bf 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 _0x6c96=['ENUM','string','customVariable','keyValue','STRING','sequelize'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6c96,0x1c1));var _0x66c9=function(_0x8c1974,_0x3f445c){_0x8c1974=_0x8c1974-0x0;var _0x3068cf=_0x6c96[_0x8c1974];return _0x3068cf;};'use strict';var Sequelize=require(_0x66c9('0x0'));module['exports']={'type':{'type':Sequelize[_0x66c9('0x1')](_0x66c9('0x2'),'variable',_0x66c9('0x3'),_0x66c9('0x4')),'defaultValue':_0x66c9('0x2')},'content':{'type':Sequelize[_0x66c9('0x5')]},'key':{'type':Sequelize[_0x66c9('0x5')]},'keyType':{'type':Sequelize[_0x66c9('0x1')](_0x66c9('0x2'),'variable',_0x66c9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x66c9('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c9('0x5')]}}; \ No newline at end of file +var _0xcf95=['BOOLEAN','sequelize','exports','customVariable','keyValue','string','STRING','ENUM'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cf9('0x0'));module[_0x5cf9('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x5cf9('0x2'),_0x5cf9('0x3')),'defaultValue':_0x5cf9('0x4')},'content':{'type':Sequelize[_0x5cf9('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5cf9('0x6')](_0x5cf9('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x5cf9('0x5')]},'idField':{'type':Sequelize[_0x5cf9('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5cf9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cf9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 9428634..966c0b0 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 _0x3831=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','save','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','includeAll','include','catch','params','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0xf99358,_0x1955b6){var _0x3d568f=function(_0x4312c4){while(--_0x4312c4){_0xf99358['push'](_0xf99358['shift']());}};_0x3d568f(++_0x1955b6);}(_0x3831,0x14c));var _0x1383=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0x3831[_0x55e5b9];return _0x58d1e7;};'use strict';var pdf=require(_0x1383('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1383('0x1'));var zipdir=require(_0x1383('0x2'));var jsonpatch=require(_0x1383('0x3'));var rp=require(_0x1383('0x4'));var moment=require(_0x1383('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1383('0x6'));var util=require('util');var path=require(_0x1383('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1383('0x8'));var squel=require('squel');var crypto=require(_0x1383('0x9'));var jsforce=require(_0x1383('0xa'));var deskjs=require(_0x1383('0xb'));var toCsv=require(_0x1383('0xc'));var querystring=require(_0x1383('0xd'));var Papa=require(_0x1383('0xe'));var Redis=require(_0x1383('0xf'));var authService=require(_0x1383('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1383('0x11'));var hardwareService=require(_0x1383('0x12'));var logger=require(_0x1383('0x13'))(_0x1383('0x14'));var utils=require(_0x1383('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1383('0x16'));var db=require(_0x1383('0x17'))['db'];function respondWithStatusCode(_0x1d35fc,_0x48c107){_0x48c107=_0x48c107||0xcc;return function(_0x5e7f63){if(_0x5e7f63){return _0x1d35fc[_0x1383('0x18')](_0x48c107);}return _0x1d35fc[_0x1383('0x19')](_0x48c107)[_0x1383('0x1a')]();};}function respondWithResult(_0x1ba3d1,_0x1e02d7){_0x1e02d7=_0x1e02d7||0xc8;return function(_0x2c8931){if(_0x2c8931){return _0x1ba3d1[_0x1383('0x19')](_0x1e02d7)[_0x1383('0x1b')](_0x2c8931);}};}function respondWithFilteredResult(_0x5e9ed9,_0x7a50d0){return function(_0x1f46de){if(_0x1f46de){var _0x41d895=_0x1f46de[_0x1383('0x1c')],_0x1c6d7b=_0x7a50d0['offset'],_0x29fbd7=_0x7a50d0['offset']+_0x7a50d0[_0x1383('0x1d')],_0x388b94;if(_0x29fbd7>=_0x41d895){_0x29fbd7=_0x41d895;_0x388b94=0xc8;}else{_0x388b94=0xce;}_0x5e9ed9['status'](_0x388b94);return _0x5e9ed9[_0x1383('0x1e')]('Content-Range',_0x1c6d7b+'-'+_0x29fbd7+'/'+_0x41d895)['json'](_0x1f46de);}return null;};}function patchUpdates(_0x4d854f){return function(_0x1c8fe7){try{jsonpatch['apply'](_0x1c8fe7,_0x4d854f,!![]);}catch(_0x2aa3b6){return BPromise['reject'](_0x2aa3b6);}return _0x1c8fe7[_0x1383('0x1f')]();};}function saveUpdates(_0x1e6d5e,_0xca314){return function(_0x39884b){if(_0x39884b){return _0x39884b[_0x1383('0x20')](_0x1e6d5e)[_0x1383('0x21')](function(_0x315e42){return _0x315e42;});}return null;};}function removeEntity(_0x10ed33,_0x2afbd2){return function(_0x505093){if(_0x505093){return _0x505093[_0x1383('0x22')]()[_0x1383('0x21')](function(){_0x10ed33[_0x1383('0x19')](0xcc)[_0x1383('0x1a')]();});}};}function handleEntityNotFound(_0x186524,_0x2a9502){return function(_0x38f1d6){if(!_0x38f1d6){_0x186524['sendStatus'](0x194);}return _0x38f1d6;};}function handleError(_0x5c4658,_0x1d24b7){_0x1d24b7=_0x1d24b7||0x1f4;return function(_0x160497){logger[_0x1383('0x23')](_0x160497[_0x1383('0x24')]);if(_0x160497[_0x1383('0x25')]){delete _0x160497['name'];}_0x5c4658['status'](_0x1d24b7)['send'](_0x160497);};}exports[_0x1383('0x26')]=function(_0x128628,_0x30877f){var _0x263aea={},_0x5866a1={},_0x1f7688={'count':0x0,'rows':[]};var _0x4ac2d4=_[_0x1383('0x27')](db[_0x1383('0x28')][_0x1383('0x29')],function(_0x23e541){return{'name':_0x23e541[_0x1383('0x2a')],'type':_0x23e541[_0x1383('0x2b')][_0x1383('0x2c')]};});_0x5866a1[_0x1383('0x2d')]=_[_0x1383('0x27')](_0x4ac2d4,_0x1383('0x25'));_0x5866a1[_0x1383('0x2e')]=_[_0x1383('0x2f')](_0x128628[_0x1383('0x2e')]);_0x5866a1[_0x1383('0x30')]=_['intersection'](_0x5866a1[_0x1383('0x2d')],_0x5866a1[_0x1383('0x2e')]);_0x263aea[_0x1383('0x31')]=_[_0x1383('0x32')](_0x5866a1[_0x1383('0x2d')],qs[_0x1383('0x33')](_0x128628['query'][_0x1383('0x33')]));_0x263aea[_0x1383('0x31')]=_0x263aea[_0x1383('0x31')][_0x1383('0x34')]?_0x263aea[_0x1383('0x31')]:_0x5866a1[_0x1383('0x2d')];if(!_0x128628['query'][_0x1383('0x35')]('nolimit')){_0x263aea['limit']=qs[_0x1383('0x1d')](_0x128628[_0x1383('0x2e')][_0x1383('0x1d')]);_0x263aea['offset']=qs['offset'](_0x128628['query'][_0x1383('0x36')]);}_0x263aea[_0x1383('0x37')]=qs[_0x1383('0x38')](_0x128628['query']['sort']);_0x263aea[_0x1383('0x39')]=qs[_0x1383('0x30')](_[_0x1383('0x3a')](_0x128628[_0x1383('0x2e')],_0x5866a1['filters']),_0x4ac2d4);if(_0x128628['query'][_0x1383('0x3b')]){_0x263aea[_0x1383('0x39')]=_[_0x1383('0x3c')](_0x263aea[_0x1383('0x39')],{'$or':_[_0x1383('0x27')](_0x4ac2d4,function(_0x872e9b){if(_0x872e9b[_0x1383('0x2b')]!=='VIRTUAL'){var _0x3d5d03={};_0x3d5d03[_0x872e9b['name']]={'$like':'%'+_0x128628[_0x1383('0x2e')][_0x1383('0x3b')]+'%'};return _0x3d5d03;}})});}_0x263aea=_[_0x1383('0x3c')]({},_0x263aea,_0x128628['options']);var _0x277689={'where':_0x263aea['where']};return db['SugarcrmField'][_0x1383('0x1c')](_0x277689)[_0x1383('0x21')](function(_0x20bab4){_0x1f7688['count']=_0x20bab4;if(_0x128628[_0x1383('0x2e')][_0x1383('0x3d')]){_0x263aea[_0x1383('0x3e')]=[{'all':!![]}];}return db[_0x1383('0x28')]['findAll'](_0x263aea);})[_0x1383('0x21')](function(_0x4c465e){_0x1f7688['rows']=_0x4c465e;return _0x1f7688;})[_0x1383('0x21')](respondWithFilteredResult(_0x30877f,_0x263aea))[_0x1383('0x3f')](handleError(_0x30877f,null));};exports['show']=function(_0x4b4c0d,_0x5ca90f){var _0x42f579={'raw':!![],'where':{'id':_0x4b4c0d[_0x1383('0x40')]['id']}},_0x477d87={};_0x477d87[_0x1383('0x2d')]=_[_0x1383('0x2f')](db[_0x1383('0x28')][_0x1383('0x29')]);_0x477d87[_0x1383('0x2e')]=_[_0x1383('0x2f')](_0x4b4c0d['query']);_0x477d87[_0x1383('0x30')]=_[_0x1383('0x32')](_0x477d87[_0x1383('0x2d')],_0x477d87['query']);_0x42f579[_0x1383('0x31')]=_['intersection'](_0x477d87[_0x1383('0x2d')],qs[_0x1383('0x33')](_0x4b4c0d[_0x1383('0x2e')][_0x1383('0x33')]));_0x42f579[_0x1383('0x31')]=_0x42f579[_0x1383('0x31')][_0x1383('0x34')]?_0x42f579[_0x1383('0x31')]:_0x477d87[_0x1383('0x2d')];if(_0x4b4c0d['query']['includeAll']){_0x42f579['include']=[{'all':!![]}];}_0x42f579=_[_0x1383('0x3c')]({},_0x42f579,_0x4b4c0d[_0x1383('0x41')]);return db[_0x1383('0x28')][_0x1383('0x42')](_0x42f579)[_0x1383('0x21')](handleEntityNotFound(_0x5ca90f,null))[_0x1383('0x21')](respondWithResult(_0x5ca90f,null))['catch'](handleError(_0x5ca90f,null));};exports[_0x1383('0x43')]=function(_0x1d460c,_0x406f39){return db['SugarcrmField'][_0x1383('0x43')](_0x1d460c[_0x1383('0x44')],{})[_0x1383('0x21')](respondWithResult(_0x406f39,0xc9))[_0x1383('0x3f')](handleError(_0x406f39,null));};exports[_0x1383('0x20')]=function(_0x5918a1,_0x330853){if(_0x5918a1['body']['id']){delete _0x5918a1[_0x1383('0x44')]['id'];}return db[_0x1383('0x28')]['find']({'where':{'id':_0x5918a1[_0x1383('0x40')]['id']}})[_0x1383('0x21')](handleEntityNotFound(_0x330853,null))[_0x1383('0x21')](saveUpdates(_0x5918a1[_0x1383('0x44')],null))[_0x1383('0x21')](respondWithResult(_0x330853,null))[_0x1383('0x3f')](handleError(_0x330853,null));};exports[_0x1383('0x22')]=function(_0x472e99,_0x2cc900){return db[_0x1383('0x28')]['find']({'where':{'id':_0x472e99[_0x1383('0x40')]['id']}})[_0x1383('0x21')](handleEntityNotFound(_0x2cc900,null))[_0x1383('0x21')](removeEntity(_0x2cc900,null))[_0x1383('0x3f')](handleError(_0x2cc900,null));}; \ No newline at end of file +var _0x2d17=['destroy','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x2d17,0x17e));var _0x72d1=function(_0x2a7bd1,_0x364224){_0x2a7bd1=_0x2a7bd1-0x0;var _0x2a2fb8=_0x2d17[_0x2a7bd1];return _0x2a2fb8;};'use strict';var pdf=require(_0x72d1('0x0'));var emlformat=require(_0x72d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72d1('0x2'));var jsonpatch=require(_0x72d1('0x3'));var rp=require('request-promise');var moment=require(_0x72d1('0x4'));var BPromise=require(_0x72d1('0x5'));var Mustache=require('mustache');var util=require(_0x72d1('0x6'));var path=require('path');var sox=require(_0x72d1('0x7'));var csv=require('to-csv');var ejs=require(_0x72d1('0x8'));var fs=require('fs');var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=_0x23a238[_0x72d1('0x1d')],_0x491af4=_0x21c85e[_0x72d1('0x1e')],_0x46fa3d=_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')],_0x5262b0;if(_0x46fa3d>=_0x8d458){_0x46fa3d=_0x8d458;_0x5262b0=0xc8;}else{_0x5262b0=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x5262b0);return _0x3f190f[_0x72d1('0x20')]('Content-Range',_0x491af4+'-'+_0x46fa3d+'/'+_0x8d458)['json'](_0x23a238);}return null;};}function patchUpdates(_0x313d7b){return function(_0x10d464){try{jsonpatch[_0x72d1('0x21')](_0x10d464,_0x313d7b,!![]);}catch(_0x1865c1){return BPromise[_0x72d1('0x22')](_0x1865c1);}return _0x10d464[_0x72d1('0x23')]();};}function saveUpdates(_0x1e2411,_0x5c7982){return function(_0x1c695c){if(_0x1c695c){return _0x1c695c['update'](_0x1e2411)['then'](function(_0x5b85cc){return _0x5b85cc;});}return null;};}function removeEntity(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['destroy']()[_0x72d1('0x24')](function(){_0x585243[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x1431ee,_0x26fa35){return function(_0x4e6acd){if(!_0x4e6acd){_0x1431ee['sendStatus'](0x194);}return _0x4e6acd;};}function handleError(_0x188eca,_0x36bc65){_0x36bc65=_0x36bc65||0x1f4;return function(_0x2f661){logger[_0x72d1('0x25')](_0x2f661[_0x72d1('0x26')]);if(_0x2f661[_0x72d1('0x27')]){delete _0x2f661[_0x72d1('0x27')];}_0x188eca['status'](_0x36bc65)['send'](_0x2f661);};}exports[_0x72d1('0x28')]=function(_0x482cb8,_0x18ca85){var _0x3454fc={},_0x2c113d={},_0x4da489={'count':0x0,'rows':[]};var _0x1c4b21=_['map'](db[_0x72d1('0x29')][_0x72d1('0x2a')],function(_0x32588f){return{'name':_0x32588f[_0x72d1('0x2b')],'type':_0x32588f['type'][_0x72d1('0x2c')]};});_0x2c113d['model']=_[_0x72d1('0x2d')](_0x1c4b21,_0x72d1('0x27'));_0x2c113d['query']=_[_0x72d1('0x2e')](_0x482cb8[_0x72d1('0x2f')]);_0x2c113d[_0x72d1('0x30')]=_[_0x72d1('0x31')](_0x2c113d[_0x72d1('0x32')],_0x2c113d['query']);_0x3454fc[_0x72d1('0x33')]=_[_0x72d1('0x31')](_0x2c113d[_0x72d1('0x32')],qs['fields'](_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x34')]));_0x3454fc['attributes']=_0x3454fc[_0x72d1('0x33')][_0x72d1('0x35')]?_0x3454fc[_0x72d1('0x33')]:_0x2c113d['model'];if(!_0x482cb8[_0x72d1('0x2f')]['hasOwnProperty'](_0x72d1('0x36'))){_0x3454fc[_0x72d1('0x1f')]=qs[_0x72d1('0x1f')](_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x1f')]);_0x3454fc[_0x72d1('0x1e')]=qs[_0x72d1('0x1e')](_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x1e')]);}_0x3454fc[_0x72d1('0x37')]=qs[_0x72d1('0x38')](_0x482cb8['query'][_0x72d1('0x38')]);_0x3454fc[_0x72d1('0x39')]=qs[_0x72d1('0x30')](_[_0x72d1('0x3a')](_0x482cb8['query'],_0x2c113d[_0x72d1('0x30')]),_0x1c4b21);if(_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x3b')]){_0x3454fc['where']=_[_0x72d1('0x3c')](_0x3454fc[_0x72d1('0x39')],{'$or':_[_0x72d1('0x2d')](_0x1c4b21,function(_0x5b897f){if(_0x5b897f[_0x72d1('0x3d')]!==_0x72d1('0x3e')){var _0x34f159={};_0x34f159[_0x5b897f['name']]={'$like':'%'+_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x3b')]+'%'};return _0x34f159;}})});}_0x3454fc=_[_0x72d1('0x3c')]({},_0x3454fc,_0x482cb8[_0x72d1('0x3f')]);var _0x44c4f5={'where':_0x3454fc[_0x72d1('0x39')]};return db[_0x72d1('0x29')]['count'](_0x44c4f5)[_0x72d1('0x24')](function(_0x3ae4b5){_0x4da489[_0x72d1('0x1d')]=_0x3ae4b5;if(_0x482cb8[_0x72d1('0x2f')][_0x72d1('0x40')]){_0x3454fc[_0x72d1('0x41')]=[{'all':!![]}];}return db[_0x72d1('0x29')][_0x72d1('0x42')](_0x3454fc);})['then'](function(_0x44d5b2){_0x4da489[_0x72d1('0x43')]=_0x44d5b2;return _0x4da489;})[_0x72d1('0x24')](respondWithFilteredResult(_0x18ca85,_0x3454fc))[_0x72d1('0x44')](handleError(_0x18ca85,null));};exports[_0x72d1('0x45')]=function(_0x88b9b9,_0xb911fa){var _0x3620df={'raw':!![],'where':{'id':_0x88b9b9['params']['id']}},_0x5620f0={};_0x5620f0[_0x72d1('0x32')]=_[_0x72d1('0x2e')](db[_0x72d1('0x29')][_0x72d1('0x2a')]);_0x5620f0['query']=_[_0x72d1('0x2e')](_0x88b9b9[_0x72d1('0x2f')]);_0x5620f0['filters']=_[_0x72d1('0x31')](_0x5620f0['model'],_0x5620f0[_0x72d1('0x2f')]);_0x3620df[_0x72d1('0x33')]=_['intersection'](_0x5620f0[_0x72d1('0x32')],qs['fields'](_0x88b9b9['query']['fields']));_0x3620df[_0x72d1('0x33')]=_0x3620df['attributes'][_0x72d1('0x35')]?_0x3620df[_0x72d1('0x33')]:_0x5620f0[_0x72d1('0x32')];if(_0x88b9b9['query']['includeAll']){_0x3620df[_0x72d1('0x41')]=[{'all':!![]}];}_0x3620df=_['merge']({},_0x3620df,_0x88b9b9['options']);return db[_0x72d1('0x29')][_0x72d1('0x46')](_0x3620df)[_0x72d1('0x24')](handleEntityNotFound(_0xb911fa,null))['then'](respondWithResult(_0xb911fa,null))['catch'](handleError(_0xb911fa,null));};exports['create']=function(_0x5f39f1,_0x9b7951){return db[_0x72d1('0x29')][_0x72d1('0x47')](_0x5f39f1[_0x72d1('0x48')],{})[_0x72d1('0x24')](respondWithResult(_0x9b7951,0xc9))[_0x72d1('0x44')](handleError(_0x9b7951,null));};exports[_0x72d1('0x49')]=function(_0x5924c,_0x1e2c11){if(_0x5924c['body']['id']){delete _0x5924c[_0x72d1('0x48')]['id'];}return db[_0x72d1('0x29')][_0x72d1('0x46')]({'where':{'id':_0x5924c['params']['id']}})[_0x72d1('0x24')](handleEntityNotFound(_0x1e2c11,null))[_0x72d1('0x24')](saveUpdates(_0x5924c[_0x72d1('0x48')],null))['then'](respondWithResult(_0x1e2c11,null))[_0x72d1('0x44')](handleError(_0x1e2c11,null));};exports[_0x72d1('0x4a')]=function(_0x343da3,_0x1bf626){return db['SugarcrmField']['find']({'where':{'id':_0x343da3[_0x72d1('0x4b')]['id']}})[_0x72d1('0x24')](handleEntityNotFound(_0x1bf626,null))[_0x72d1('0x24')](removeEntity(_0x1bf626,null))['catch'](handleError(_0x1bf626,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d9b5d09..c6792af 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 _0xd625=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x44814d,_0xf4663a){var _0x5d7695=function(_0x355c6e){while(--_0x355c6e){_0x44814d['push'](_0x44814d['shift']());}};_0x5d7695(++_0xf4663a);}(_0xd625,0xff));var _0x5d62=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xd625[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x5d62('0x0'));var util=require(_0x5d62('0x1'));var logger=require(_0x5d62('0x2'))(_0x5d62('0x3'));var moment=require('moment');var BPromise=require(_0x5d62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d62('0x5'));var rimraf=require(_0x5d62('0x6'));var config=require(_0x5d62('0x7'));var attributes=require(_0x5d62('0x8'));module['exports']=function(_0x1a925e,_0x113e30){return _0x1a925e[_0x5d62('0x9')](_0x5d62('0xa'),attributes,{'tableName':_0x5d62('0xb'),'paranoid':![],'indexes':[{'name':_0x5d62('0xc'),'fields':[_0x5d62('0xd'),_0x5d62('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1450=['path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise'];(function(_0x2808d0,_0x221a9f){var _0x3aef7c=function(_0x331dc1){while(--_0x331dc1){_0x2808d0['push'](_0x2808d0['shift']());}};_0x3aef7c(++_0x221a9f);}(_0x1450,0x1ea));var _0x0145=function(_0x3985b8,_0x26271c){_0x3985b8=_0x3985b8-0x0;var _0x42f0ff=_0x1450[_0x3985b8];return _0x42f0ff;};'use strict';var _=require(_0x0145('0x0'));var util=require(_0x0145('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0145('0x2'));var BPromise=require(_0x0145('0x3'));var rp=require(_0x0145('0x4'));var fs=require('fs');var path=require(_0x0145('0x5'));var rimraf=require(_0x0145('0x6'));var config=require(_0x0145('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x0145('0x8')]=function(_0x2b1056,_0x3c23b9){return _0x2b1056[_0x0145('0x9')](_0x0145('0xa'),attributes,{'tableName':_0x0145('0xb'),'paranoid':![],'indexes':[{'name':_0x0145('0xc'),'fields':[_0x0145('0xd'),_0x0145('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index b731ca2..59edc98 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 _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(_0x52bc53,_0x29d09d){var _0x36d12b=function(_0x1cd325){while(--_0x1cd325){_0x52bc53['push'](_0x52bc53['shift']());}};_0x36d12b(++_0x29d09d);}(_0x14a0,0x8e));var _0x014a=function(_0x4dbe44,_0x3b786e){_0x4dbe44=_0x4dbe44-0x0;var _0x4eaa3b=_0x14a0[_0x4dbe44];return _0x4eaa3b;};'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 +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(_0x5b85ee,_0x131418){var _0x4cd016=function(_0x4de21c){while(--_0x4de21c){_0x5b85ee['push'](_0x5b85ee['shift']());}};_0x4cd016(++_0x131418);}(_0x5eb8,0xb0));var _0x85eb=function(_0x32c9b9,_0x21a0cf){_0x32c9b9=_0x32c9b9-0x0;var _0x239eab=_0x5eb8[_0x32c9b9];return _0x239eab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f4b8549..4877dda 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 _0xb444=['index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x26a7f3,_0x4763c5){var _0x24d8dd=function(_0x5a4c54){while(--_0x5a4c54){_0x26a7f3['push'](_0x26a7f3['shift']());}};_0x24d8dd(++_0x4763c5);}(_0xb444,0x16c));var _0x4b44=function(_0x6ab212,_0xba159c){_0x6ab212=_0x6ab212-0x0;var _0x3002ed=_0xb444[_0x6ab212];return _0x3002ed;};'use strict';var multer=require(_0x4b44('0x0'));var util=require(_0x4b44('0x1'));var path=require('path');var timeout=require(_0x4b44('0x2'));var express=require(_0x4b44('0x3'));var router=express[_0x4b44('0x4')]();var auth=require(_0x4b44('0x5'));var interaction=require(_0x4b44('0x6'));var config=require(_0x4b44('0x7'));var controller=require(_0x4b44('0x8'));router[_0x4b44('0x9')]('/',auth[_0x4b44('0xa')](),controller[_0x4b44('0xb')]);router[_0x4b44('0x9')](_0x4b44('0xc'),auth[_0x4b44('0xa')](),controller[_0x4b44('0xd')]);router[_0x4b44('0x9')](_0x4b44('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4b44('0x9')](_0x4b44('0xf'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x10')]);router[_0x4b44('0x11')]('/',auth[_0x4b44('0xa')](),controller[_0x4b44('0x12')]);router[_0x4b44('0x11')](_0x4b44('0xe'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x13')]);router[_0x4b44('0x14')](_0x4b44('0xc'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x15')]);router[_0x4b44('0x16')](_0x4b44('0xc'),auth[_0x4b44('0xa')](),controller[_0x4b44('0x17')]);module[_0x4b44('0x18')]=router; \ No newline at end of file +var _0xb4d0=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x5f27f5,_0x3874d2){var _0x13aa51=function(_0x3770b4){while(--_0x3770b4){_0x5f27f5['push'](_0x5f27f5['shift']());}};_0x13aa51(++_0x3874d2);}(_0xb4d0,0x1ac));var _0x0b4d=function(_0x38d8e2,_0x48603c){_0x38d8e2=_0x38d8e2-0x0;var _0x5afbee=_0xb4d0[_0x38d8e2];return _0x5afbee;};'use strict';var multer=require(_0x0b4d('0x0'));var util=require(_0x0b4d('0x1'));var path=require('path');var timeout=require(_0x0b4d('0x2'));var express=require(_0x0b4d('0x3'));var router=express[_0x0b4d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b4d('0x5'));var config=require(_0x0b4d('0x6'));var controller=require(_0x0b4d('0x7'));router[_0x0b4d('0x8')]('/',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xa')]);router[_0x0b4d('0x8')](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller[_0x0b4d('0xc')]);router['get'](_0x0b4d('0xd'),auth['isAuthenticated'](),controller[_0x0b4d('0xe')]);router[_0x0b4d('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0b4d('0xf')]);router[_0x0b4d('0x10')]('/',auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x11')]);router[_0x0b4d('0x10')](_0x0b4d('0xd'),auth['isAuthenticated'](),controller[_0x0b4d('0x12')]);router[_0x0b4d('0x13')](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller[_0x0b4d('0x14')]);router['delete'](_0x0b4d('0xb'),auth[_0x0b4d('0x9')](),controller['destroy']);module[_0x0b4d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5b9a396..e62708d 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 _0x2087=['exports','STRING','HelpDesk','sequelize'];(function(_0xc375f5,_0x1e1a0f){var _0x481727=function(_0x5aa7c5){while(--_0x5aa7c5){_0xc375f5['push'](_0xc375f5['shift']());}};_0x481727(++_0x1e1a0f);}(_0x2087,0xf3));var _0x7208=function(_0x2838e7,_0x58d4fb){_0x2838e7=_0x2838e7-0x0;var _0x53b163=_0x2087[_0x2838e7];return _0x53b163;};'use strict';var Sequelize=require(_0x7208('0x0'));module[_0x7208('0x1')]={'name':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7208('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7208('0x2')],'allowNull':![],'defaultValue':_0x7208('0x3')},'remoteUri':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xbf3e=['exports','STRING'];(function(_0x4a971c,_0x15f668){var _0x3884ba=function(_0xe6be64){while(--_0xe6be64){_0x4a971c['push'](_0x4a971c['shift']());}};_0x3884ba(++_0x15f668);}(_0xbf3e,0xee));var _0xebf3=function(_0x85e12c,_0x2a9e25){_0x85e12c=_0x85e12c-0x0;var _0x368e66=_0xbf3e[_0x85e12c];return _0x368e66;};'use strict';var Sequelize=require('sequelize');module[_0xebf3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xebf3('0x1')]},'username':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xebf3('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6a93730..1e3b1f2 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 _0x9116=['describe','sessionName','reference','owner','includes','editable','false','cf_','picklist','picklistValues','label','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','set','Content-Range','json','apply','reject','destroy','end','sendStatus','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','create','update','body','getConfigurations','findOne','VtigerConfiguration','order','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success'];(function(_0x1afa29,_0x7118bc){var _0x5e68bf=function(_0x400927){while(--_0x400927){_0x1afa29['push'](_0x1afa29['shift']());}};_0x5e68bf(++_0x7118bc);}(_0x9116,0x111));var _0x6911=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x9116[_0x51fe5f];return _0x4abce9;};'use strict';var pdf=require(_0x6911('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6911('0x1'));var zipdir=require(_0x6911('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6911('0x3'));var moment=require('moment');var BPromise=require(_0x6911('0x4'));var Mustache=require('mustache');var util=require(_0x6911('0x5'));var path=require(_0x6911('0x6'));var sox=require(_0x6911('0x7'));var csv=require(_0x6911('0x8'));var ejs=require(_0x6911('0x9'));var fs=require('fs');var _=require(_0x6911('0xa'));var squel=require(_0x6911('0xb'));var crypto=require(_0x6911('0xc'));var jsforce=require(_0x6911('0xd'));var deskjs=require(_0x6911('0xe'));var toCsv=require(_0x6911('0x8'));var querystring=require(_0x6911('0xf'));var Papa=require(_0x6911('0x10'));var Redis=require(_0x6911('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6911('0x12'));var as=require(_0x6911('0x13'));var hardwareService=require(_0x6911('0x14'));var logger=require(_0x6911('0x15'))(_0x6911('0x16'));var utils=require(_0x6911('0x17'));var config=require(_0x6911('0x18'));var licenseUtil=require(_0x6911('0x19'));var db=require(_0x6911('0x1a'))['db'];var integrations=require(_0x6911('0x1b'));var jayson=require(_0x6911('0x1c'));var client=jayson[_0x6911('0x1d')][_0x6911('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x59d4f8,_0x14ac12,_0x2e7ca3,_0xb69e26){return new BPromise(function(_0x44a440,_0x112e2f){var _0x2782e9=_0xb69e26||client;return _0x2782e9[_0x6911('0x1f')](_0x59d4f8,_0x2e7ca3)[_0x6911('0x20')](function(_0x54a0e7){logger[_0x6911('0x21')](_0x6911('0x22'),_0x14ac12,_0x6911('0x23'));logger['debug'](_0x6911('0x24'),_0x14ac12,_0x6911('0x23'),JSON[_0x6911('0x25')](_0x54a0e7));if(_0x54a0e7[_0x6911('0x26')]){if(_0x54a0e7[_0x6911('0x26')][_0x6911('0x27')]===0x1f4){logger['error'](_0x6911('0x22'),_0x14ac12,_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);return _0x112e2f(_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);}logger[_0x6911('0x26')](_0x6911('0x22'),_0x14ac12,_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);return _0x44a440(_0x54a0e7[_0x6911('0x26')][_0x6911('0x28')]);}else{logger[_0x6911('0x21')](_0x6911('0x22'),_0x14ac12,_0x6911('0x23'));_0x44a440(_0x54a0e7[_0x6911('0x29')][_0x6911('0x28')]);}})[_0x6911('0x2a')](function(_0x579f43){logger[_0x6911('0x26')](_0x6911('0x22'),_0x14ac12,_0x579f43);_0x112e2f(_0x579f43);});});}function respondWithStatusCode(_0x5a76de,_0x46c4fc){_0x46c4fc=_0x46c4fc||0xcc;return function(_0x4db68a){if(_0x4db68a){return _0x5a76de['sendStatus'](_0x46c4fc);}return _0x5a76de['status'](_0x46c4fc)['end']();};}function respondWithResult(_0x50f721,_0x45852f){_0x45852f=_0x45852f||0xc8;return function(_0xd037b7){if(_0xd037b7){return _0x50f721[_0x6911('0x2b')](_0x45852f)['json'](_0xd037b7);}};}function respondWithFilteredResult(_0x661c53,_0x437640){return function(_0x57e2d6){if(_0x57e2d6){var _0x155ad4=_0x57e2d6['count'],_0x5a0112=_0x437640['offset'],_0x3f06bd=_0x437640[_0x6911('0x2c')]+_0x437640[_0x6911('0x2d')],_0x20c81a;if(_0x3f06bd>=_0x155ad4){_0x3f06bd=_0x155ad4;_0x20c81a=0xc8;}else{_0x20c81a=0xce;}_0x661c53['status'](_0x20c81a);return _0x661c53[_0x6911('0x2e')](_0x6911('0x2f'),_0x5a0112+'-'+_0x3f06bd+'/'+_0x155ad4)[_0x6911('0x30')](_0x57e2d6);}return null;};}function patchUpdates(_0x478d3f){return function(_0x29d85d){try{jsonpatch[_0x6911('0x31')](_0x29d85d,_0x478d3f,!![]);}catch(_0x597adb){return BPromise[_0x6911('0x32')](_0x597adb);}return _0x29d85d['save']();};}function saveUpdates(_0x47a13c,_0x3c18ff){return function(_0x33505b){if(_0x33505b){return _0x33505b['update'](_0x47a13c)[_0x6911('0x20')](function(_0x1f96cc){return _0x1f96cc;});}return null;};}function removeEntity(_0x1c2a15,_0x117465){return function(_0xc6216d){if(_0xc6216d){return _0xc6216d[_0x6911('0x33')]()[_0x6911('0x20')](function(){_0x1c2a15['status'](0xcc)[_0x6911('0x34')]();});}};}function handleEntityNotFound(_0x38be07,_0x4224e7){return function(_0x11981d){if(!_0x11981d){_0x38be07[_0x6911('0x35')](0x194);}return _0x11981d;};}function handleError(_0x100616,_0x196b3e){_0x196b3e=_0x196b3e||0x1f4;return function(_0x34bc3e){logger[_0x6911('0x26')](_0x34bc3e[_0x6911('0x36')]);if(_0x34bc3e[_0x6911('0x37')]){delete _0x34bc3e[_0x6911('0x37')];}_0x100616[_0x6911('0x2b')](_0x196b3e)[_0x6911('0x38')](_0x34bc3e);};}exports['index']=function(_0x2d27e2,_0x27c3d2){var _0x56a5a6={},_0x215ad2={},_0x2f6953={'count':0x0,'rows':[]};var _0x1355be=_[_0x6911('0x39')](db[_0x6911('0x3a')][_0x6911('0x3b')],function(_0x1f2c2e){return{'name':_0x1f2c2e[_0x6911('0x3c')],'type':_0x1f2c2e[_0x6911('0x3d')]['key']};});_0x215ad2[_0x6911('0x3e')]=_[_0x6911('0x39')](_0x1355be,_0x6911('0x37'));_0x215ad2[_0x6911('0x3f')]=_[_0x6911('0x40')](_0x2d27e2[_0x6911('0x3f')]);_0x215ad2[_0x6911('0x41')]=_[_0x6911('0x42')](_0x215ad2[_0x6911('0x3e')],_0x215ad2['query']);_0x56a5a6['attributes']=_[_0x6911('0x42')](_0x215ad2[_0x6911('0x3e')],qs[_0x6911('0x43')](_0x2d27e2[_0x6911('0x3f')]['fields']));_0x56a5a6[_0x6911('0x44')]=_0x56a5a6[_0x6911('0x44')][_0x6911('0x45')]?_0x56a5a6[_0x6911('0x44')]:_0x215ad2[_0x6911('0x3e')];if(!_0x2d27e2[_0x6911('0x3f')][_0x6911('0x46')]('nolimit')){_0x56a5a6[_0x6911('0x2d')]=qs[_0x6911('0x2d')](_0x2d27e2['query'][_0x6911('0x2d')]);_0x56a5a6[_0x6911('0x2c')]=qs['offset'](_0x2d27e2[_0x6911('0x3f')]['offset']);}_0x56a5a6['order']=qs['sort'](_0x2d27e2[_0x6911('0x3f')][_0x6911('0x47')]);_0x56a5a6['where']=qs[_0x6911('0x41')](_[_0x6911('0x48')](_0x2d27e2['query'],_0x215ad2[_0x6911('0x41')]),_0x1355be);if(_0x2d27e2[_0x6911('0x3f')][_0x6911('0x49')]){_0x56a5a6[_0x6911('0x4a')]=_['merge'](_0x56a5a6[_0x6911('0x4a')],{'$or':_[_0x6911('0x39')](_0x1355be,function(_0x20be29){if(_0x20be29['type']!==_0x6911('0x4b')){var _0x3285fa={};_0x3285fa[_0x20be29[_0x6911('0x37')]]={'$like':'%'+_0x2d27e2[_0x6911('0x3f')][_0x6911('0x49')]+'%'};return _0x3285fa;}})});}_0x56a5a6=_['merge']({},_0x56a5a6,_0x2d27e2[_0x6911('0x4c')]);var _0x3bbc4b={'where':_0x56a5a6['where']};return db[_0x6911('0x3a')]['count'](_0x3bbc4b)[_0x6911('0x20')](function(_0x4617b6){_0x2f6953['count']=_0x4617b6;if(_0x2d27e2[_0x6911('0x3f')][_0x6911('0x4d')]){_0x56a5a6[_0x6911('0x4e')]=[{'all':!![]}];}return db[_0x6911('0x3a')]['findAll'](_0x56a5a6);})[_0x6911('0x20')](function(_0x5bcfe6){_0x2f6953[_0x6911('0x4f')]=_0x5bcfe6;return _0x2f6953;})['then'](respondWithFilteredResult(_0x27c3d2,_0x56a5a6))[_0x6911('0x2a')](handleError(_0x27c3d2,null));};exports[_0x6911('0x50')]=function(_0x139f60,_0x54a3c7){var _0x4b3b4b={'raw':![],'where':{'id':_0x139f60[_0x6911('0x51')]['id']}},_0x2e72f8={};_0x2e72f8['model']=_[_0x6911('0x40')](db[_0x6911('0x3a')][_0x6911('0x3b')]);_0x2e72f8[_0x6911('0x3f')]=_[_0x6911('0x40')](_0x139f60['query']);_0x2e72f8[_0x6911('0x41')]=_[_0x6911('0x42')](_0x2e72f8['model'],_0x2e72f8['query']);_0x4b3b4b[_0x6911('0x44')]=_['intersection'](_0x2e72f8[_0x6911('0x3e')],qs[_0x6911('0x43')](_0x139f60[_0x6911('0x3f')][_0x6911('0x43')]));_0x4b3b4b[_0x6911('0x44')]=_0x4b3b4b[_0x6911('0x44')][_0x6911('0x45')]?_0x4b3b4b['attributes']:_0x2e72f8[_0x6911('0x3e')];if(_0x139f60[_0x6911('0x3f')][_0x6911('0x4d')]){_0x4b3b4b[_0x6911('0x4e')]=[{'all':!![]}];}_0x4b3b4b=_[_0x6911('0x52')]({},_0x4b3b4b,_0x139f60[_0x6911('0x4c')]);return db[_0x6911('0x3a')][_0x6911('0x53')](_0x4b3b4b)[_0x6911('0x20')](handleEntityNotFound(_0x54a3c7,null))[_0x6911('0x20')](respondWithResult(_0x54a3c7,null))[_0x6911('0x2a')](handleError(_0x54a3c7,null));};exports[_0x6911('0x54')]=function(_0x25dab9,_0x4e55fb){return db[_0x6911('0x3a')][_0x6911('0x54')](_0x25dab9['body'],{})[_0x6911('0x20')](respondWithResult(_0x4e55fb,0xc9))[_0x6911('0x2a')](handleError(_0x4e55fb,null));};exports[_0x6911('0x55')]=function(_0x274e88,_0x54e98c){if(_0x274e88['body']['id']){delete _0x274e88[_0x6911('0x56')]['id'];}return db[_0x6911('0x3a')]['find']({'where':{'id':_0x274e88[_0x6911('0x51')]['id']}})[_0x6911('0x20')](handleEntityNotFound(_0x54e98c,null))['then'](saveUpdates(_0x274e88[_0x6911('0x56')],null))['then'](respondWithResult(_0x54e98c,null))[_0x6911('0x2a')](handleError(_0x54e98c,null));};exports[_0x6911('0x33')]=function(_0x3111e0,_0x12d710){return db['VtigerAccount'][_0x6911('0x53')]({'where':{'id':_0x3111e0[_0x6911('0x51')]['id']}})[_0x6911('0x20')](handleEntityNotFound(_0x12d710,null))[_0x6911('0x20')](removeEntity(_0x12d710,null))['catch'](handleError(_0x12d710,null));};exports[_0x6911('0x57')]=function(_0x20e2b4,_0x4b63e0,_0x44a2fe){var _0x467c44={};var _0x4fd25d={};var _0x2ae7ab;var _0x2af460;return db['VtigerAccount'][_0x6911('0x58')]({'where':{'id':_0x20e2b4[_0x6911('0x51')]['id']}})[_0x6911('0x20')](handleEntityNotFound(_0x4b63e0,null))['then'](function(_0x5b39c1){if(_0x5b39c1){_0x2ae7ab=_0x5b39c1;_0x4fd25d['model']=_[_0x6911('0x40')](db[_0x6911('0x59')][_0x6911('0x3b')]);_0x4fd25d[_0x6911('0x3f')]=_['keys'](_0x20e2b4[_0x6911('0x3f')]);_0x4fd25d['filters']=_[_0x6911('0x42')](_0x4fd25d[_0x6911('0x3e')],_0x4fd25d['query']);_0x467c44[_0x6911('0x44')]=_[_0x6911('0x42')](_0x4fd25d['model'],qs[_0x6911('0x43')](_0x20e2b4[_0x6911('0x3f')][_0x6911('0x43')]));_0x467c44[_0x6911('0x44')]=_0x467c44[_0x6911('0x44')][_0x6911('0x45')]?_0x467c44[_0x6911('0x44')]:_0x4fd25d[_0x6911('0x3e')];_0x467c44[_0x6911('0x5a')]=qs[_0x6911('0x47')](_0x20e2b4[_0x6911('0x3f')][_0x6911('0x47')]);_0x467c44[_0x6911('0x4a')]=qs[_0x6911('0x41')](_['pick'](_0x20e2b4[_0x6911('0x3f')],_0x4fd25d[_0x6911('0x41')]));if(_0x20e2b4[_0x6911('0x3f')][_0x6911('0x49')]){_0x467c44['where']=_[_0x6911('0x52')](_0x467c44['where'],{'$or':_[_0x6911('0x39')](_0x467c44[_0x6911('0x44')],function(_0x3bb708){var _0x18e519={};_0x18e519[_0x3bb708]={'$like':'%'+_0x20e2b4[_0x6911('0x3f')][_0x6911('0x49')]+'%'};return _0x18e519;})});}_0x467c44=_[_0x6911('0x52')]({},_0x467c44,_0x20e2b4['options']);return _0x2ae7ab[_0x6911('0x57')](_0x467c44);}})[_0x6911('0x20')](function(_0x235ae8){if(_0x235ae8){_0x2af460=_0x235ae8['length'];if(!_0x20e2b4[_0x6911('0x3f')][_0x6911('0x46')]('nolimit')){_0x467c44[_0x6911('0x2d')]=qs[_0x6911('0x2d')](_0x20e2b4['query'][_0x6911('0x2d')]);_0x467c44['offset']=qs[_0x6911('0x2c')](_0x20e2b4[_0x6911('0x3f')][_0x6911('0x2c')]);}return _0x2ae7ab['getConfigurations'](_0x467c44);}})['then'](function(_0x3ea917){if(_0x3ea917){return _0x3ea917?{'count':_0x2af460,'rows':_0x3ea917}:null;}})['then'](respondWithResult(_0x4b63e0,null))['catch'](handleError(_0x4b63e0,null));};exports['addConfiguration']=function(_0x443e05,_0x1981a,_0x20be06){if(_0x443e05[_0x6911('0x56')]['id']){delete _0x443e05[_0x6911('0x56')]['id'];}return db[_0x6911('0x3a')][_0x6911('0x58')]({'where':{'id':_0x443e05['params']['id']}})['then'](handleEntityNotFound(_0x1981a,null))[_0x6911('0x20')](function(_0x30d8d4){if(_0x30d8d4){_0x443e05[_0x6911('0x56')][_0x6911('0x5b')]=_0x30d8d4['id'];_0x443e05[_0x6911('0x56')][_0x6911('0x5c')]=integrations[_0x6911('0x5d')](_0x443e05[_0x6911('0x56')]['channel'],_0x443e05[_0x6911('0x56')][_0x6911('0x3d')]);_0x443e05[_0x6911('0x56')][_0x6911('0x5e')]=integrations[_0x6911('0x5f')](_0x443e05['body']['channel'],_0x443e05['body']['type']);return db['VtigerConfiguration'][_0x6911('0x54')](_0x443e05[_0x6911('0x56')],{'include':[{'model':db[_0x6911('0x60')],'as':_0x6911('0x5c')},{'model':db[_0x6911('0x60')],'as':'Descriptions'}]});}return null;})[_0x6911('0x20')](respondWithResult(_0x1981a,null))['catch'](handleError(_0x1981a,null));};var md5=require('md5');exports[_0x6911('0x61')]=function(_0x4e44c5,_0x473709,_0x38db24){var _0x3b214d=null;var _0x53cd59=null;var _0x219fed=null;var _0x19e5e0=null;var _0x18fa98='';return db[_0x6911('0x3a')]['findOne']({'where':{'id':_0x4e44c5[_0x6911('0x51')]['id']},'attributes':['id',_0x6911('0x37'),_0x6911('0x62'),_0x6911('0x63'),'moduleName',_0x6911('0x64'),_0x6911('0x65'),_0x6911('0x66')]})[_0x6911('0x20')](handleEntityNotFound(_0x473709,null))['then'](function(_0x33827c){if(_0x33827c){_0x3b214d=_0x33827c['username'];_0x53cd59=_0x33827c['accessKey'];_0x219fed=_0x33827c[_0x6911('0x67')];_0x18fa98=_0x33827c[_0x6911('0x64')];var _0x46e4cb=_0x18fa98[_0x6911('0x68')](-0x1);if(_0x46e4cb==='/'){_0x18fa98=_0x18fa98['substring'](0x0,_0x18fa98[_0x6911('0x69')](_0x46e4cb));}_0x19e5e0=util[_0x6911('0x6a')](_0x6911('0x6b'),_0x18fa98);var _0x4f89ce={'method':_0x6911('0x6c'),'uri':_0x19e5e0,'qs':{'operation':_0x6911('0x6d'),'username':_0x33827c['username']},'json':!![]};return rp(_0x4f89ce);}})[_0x6911('0x20')](function(_0x9984bf){if(_0x9984bf['success']){var _0x33b20b={'method':_0x6911('0x6e'),'uri':_0x19e5e0,'form':{'operation':_0x6911('0x6f'),'username':_0x3b214d,'accessKey':md5(_0x9984bf[_0x6911('0x29')][_0x6911('0x70')]+_0x53cd59)},'json':!![]};return rp(_0x33b20b);}})[_0x6911('0x20')](function(_0xa19023){if(_0xa19023[_0x6911('0x71')]){var _0x1499ac={'method':_0x6911('0x6c'),'uri':_0x19e5e0,'qs':{'operation':_0x6911('0x72'),'username':_0x3b214d,'sessionName':_0xa19023['result'][_0x6911('0x73')],'elementType':_0x219fed},'json':!![]};return rp(_0x1499ac);}})[_0x6911('0x20')](function(_0x5db353){if(_0x5db353['success']){var _0x3e035a=['autogenerated',_0x6911('0x74'),_0x6911('0x75')];_['remove'](_0x5db353[_0x6911('0x29')][_0x6911('0x43')],function(_0x3bc174){return _0x3e035a[_0x6911('0x76')](_0x3bc174[_0x6911('0x3d')][_0x6911('0x37')]);});_['remove'](_0x5db353['result']['fields'],function(_0x26ca8a){return _0x26ca8a[_0x6911('0x77')]===_0x6911('0x78');});return{'count':_0x5db353[_0x6911('0x29')][_0x6911('0x43')]['length'],'rows':_[_0x6911('0x39')](_0x5db353[_0x6911('0x29')][_0x6911('0x43')],function(_0xb60d61){return{'id':_0xb60d61['name'],'name':_0xb60d61['label'],'custom':_['startsWith'](_0xb60d61[_0x6911('0x37')],_0x6911('0x79'))?!![]:![],'options':_0xb60d61[_0x6911('0x3d')][_0x6911('0x37')]===_0x6911('0x7a')&&_0xb60d61['type'][_0x6911('0x7b')]['length']>0x0?_['map'](_0xb60d61[_0x6911('0x3d')][_0x6911('0x7b')],function(_0x357712){return{'name':_0x357712[_0x6911('0x7c')],'value':_0x357712['value']};}):[]};})};}})[_0x6911('0x20')](respondWithResult(_0x473709,null))[_0x6911('0x2a')](function(_0x3aeae2){console['log'](_0x6911('0x7d')+_0x3aeae2);var _0x580e50=_0x4e44c5[_0x6911('0x3f')][_0x6911('0x7e')]?0x1f4:_0x3aeae2['statusCode']||0x1f4;logger[_0x6911('0x26')](_0x6911('0x7f'),_0x6911('0x61'),_0x580e50,JSON[_0x6911('0x25')](_0x3aeae2));delete _0x3aeae2['name'];if(_0x580e50===0x191){_0x580e50=0x190;}_0x473709['status'](_0x580e50)[_0x6911('0x38')](_0x4e44c5[_0x6911('0x3f')][_0x6911('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x3aeae2[_0x6911('0x80')]}:_0x3aeae2);});}; \ No newline at end of file +var _0x5665=['sendStatus','status','json','count','offset','limit','set','reject','save','update','destroy','end','stack','name','map','VtigerAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','include','catch','show','fields','find','create','body','params','getConfigurations','findOne','keys','VtigerConfiguration','merge','hasOwnProperty','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','getchallenge','POST','login','token','describe','sessionName','success','autogenerated','reference','owner','includes','remove','editable','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x5f7578,_0x18fcdb){var _0x3b9f1c=function(_0xfc9b9a){while(--_0xfc9b9a){_0x5f7578['push'](_0x5f7578['shift']());}};_0x3b9f1c(++_0x18fcdb);}(_0x5665,0xd8));var _0x5566=function(_0x4a3669,_0xdd5280){_0x4a3669=_0x4a3669-0x0;var _0x41b7bb=_0x5665[_0x4a3669];return _0x41b7bb;};'use strict';var pdf=require(_0x5566('0x0'));var emlformat=require(_0x5566('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5566('0x2'));var jsonpatch=require(_0x5566('0x3'));var rp=require(_0x5566('0x4'));var moment=require(_0x5566('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5566('0x6'));var util=require('util');var path=require(_0x5566('0x7'));var sox=require('sox');var csv=require(_0x5566('0x8'));var ejs=require(_0x5566('0x9'));var fs=require('fs');var _=require(_0x5566('0xa'));var squel=require(_0x5566('0xb'));var crypto=require('crypto');var jsforce=require(_0x5566('0xc'));var deskjs=require(_0x5566('0xd'));var toCsv=require(_0x5566('0x8'));var querystring=require(_0x5566('0xe'));var Papa=require(_0x5566('0xf'));var Redis=require(_0x5566('0x10'));var authService=require(_0x5566('0x11'));var qs=require(_0x5566('0x12'));var as=require(_0x5566('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5566('0x14'))(_0x5566('0x15'));var utils=require(_0x5566('0x16'));var config=require(_0x5566('0x17'));var licenseUtil=require(_0x5566('0x18'));var db=require(_0x5566('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5566('0x1a'));var client=jayson[_0x5566('0x1b')][_0x5566('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x327aab,_0x308790,_0x4ec931,_0x4555e6){return new BPromise(function(_0x1d0ce5,_0x423036){var _0x1463eb=_0x4555e6||client;return _0x1463eb[_0x5566('0x1d')](_0x327aab,_0x4ec931)[_0x5566('0x1e')](function(_0x31f869){logger[_0x5566('0x1f')](_0x5566('0x20'),_0x308790,_0x5566('0x21'));logger['debug'](_0x5566('0x22'),_0x308790,_0x5566('0x21'),JSON['stringify'](_0x31f869));if(_0x31f869[_0x5566('0x23')]){if(_0x31f869[_0x5566('0x23')]['code']===0x1f4){logger['error'](_0x5566('0x20'),_0x308790,_0x31f869['error'][_0x5566('0x24')]);return _0x423036(_0x31f869[_0x5566('0x23')][_0x5566('0x24')]);}logger['error'](_0x5566('0x20'),_0x308790,_0x31f869[_0x5566('0x23')]['message']);return _0x1d0ce5(_0x31f869[_0x5566('0x23')][_0x5566('0x24')]);}else{logger[_0x5566('0x1f')](_0x5566('0x20'),_0x308790,'request\x20sent');_0x1d0ce5(_0x31f869[_0x5566('0x25')][_0x5566('0x24')]);}})['catch'](function(_0x1b55b9){logger[_0x5566('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x308790,_0x1b55b9);_0x423036(_0x1b55b9);});});}function respondWithStatusCode(_0x316b9e,_0x5fe900){_0x5fe900=_0x5fe900||0xcc;return function(_0x666f2e){if(_0x666f2e){return _0x316b9e[_0x5566('0x26')](_0x5fe900);}return _0x316b9e[_0x5566('0x27')](_0x5fe900)['end']();};}function respondWithResult(_0x20c167,_0x48314e){_0x48314e=_0x48314e||0xc8;return function(_0x320889){if(_0x320889){return _0x20c167[_0x5566('0x27')](_0x48314e)[_0x5566('0x28')](_0x320889);}};}function respondWithFilteredResult(_0x441b3b,_0x3eae11){return function(_0x332890){if(_0x332890){var _0x1c8523=_0x332890[_0x5566('0x29')],_0x55a93f=_0x3eae11[_0x5566('0x2a')],_0x8f1c22=_0x3eae11['offset']+_0x3eae11[_0x5566('0x2b')],_0x1f7877;if(_0x8f1c22>=_0x1c8523){_0x8f1c22=_0x1c8523;_0x1f7877=0xc8;}else{_0x1f7877=0xce;}_0x441b3b[_0x5566('0x27')](_0x1f7877);return _0x441b3b[_0x5566('0x2c')]('Content-Range',_0x55a93f+'-'+_0x8f1c22+'/'+_0x1c8523)[_0x5566('0x28')](_0x332890);}return null;};}function patchUpdates(_0x2583ef){return function(_0x625fd7){try{jsonpatch['apply'](_0x625fd7,_0x2583ef,!![]);}catch(_0x5de71a){return BPromise[_0x5566('0x2d')](_0x5de71a);}return _0x625fd7[_0x5566('0x2e')]();};}function saveUpdates(_0x50332d,_0x407a08){return function(_0x2edda4){if(_0x2edda4){return _0x2edda4[_0x5566('0x2f')](_0x50332d)['then'](function(_0x419595){return _0x419595;});}return null;};}function removeEntity(_0x1c4d9d,_0x2bc574){return function(_0x11d6ba){if(_0x11d6ba){return _0x11d6ba[_0x5566('0x30')]()[_0x5566('0x1e')](function(){_0x1c4d9d['status'](0xcc)[_0x5566('0x31')]();});}};}function handleEntityNotFound(_0x33ef6d,_0x1004ab){return function(_0x509e7f){if(!_0x509e7f){_0x33ef6d[_0x5566('0x26')](0x194);}return _0x509e7f;};}function handleError(_0x303ffb,_0x324bd0){_0x324bd0=_0x324bd0||0x1f4;return function(_0x3d3d59){logger['error'](_0x3d3d59[_0x5566('0x32')]);if(_0x3d3d59[_0x5566('0x33')]){delete _0x3d3d59[_0x5566('0x33')];}_0x303ffb[_0x5566('0x27')](_0x324bd0)['send'](_0x3d3d59);};}exports['index']=function(_0x46e78c,_0x4ece26){var _0x466f98={},_0xaed5b2={},_0x5e62cc={'count':0x0,'rows':[]};var _0x4afe41=_[_0x5566('0x34')](db[_0x5566('0x35')][_0x5566('0x36')],function(_0x52edc6){return{'name':_0x52edc6[_0x5566('0x37')],'type':_0x52edc6['type'][_0x5566('0x38')]};});_0xaed5b2['model']=_[_0x5566('0x34')](_0x4afe41,'name');_0xaed5b2[_0x5566('0x39')]=_['keys'](_0x46e78c['query']);_0xaed5b2[_0x5566('0x3a')]=_[_0x5566('0x3b')](_0xaed5b2[_0x5566('0x3c')],_0xaed5b2[_0x5566('0x39')]);_0x466f98[_0x5566('0x3d')]=_[_0x5566('0x3b')](_0xaed5b2[_0x5566('0x3c')],qs['fields'](_0x46e78c[_0x5566('0x39')]['fields']));_0x466f98[_0x5566('0x3d')]=_0x466f98[_0x5566('0x3d')][_0x5566('0x3e')]?_0x466f98[_0x5566('0x3d')]:_0xaed5b2[_0x5566('0x3c')];if(!_0x46e78c['query']['hasOwnProperty'](_0x5566('0x3f'))){_0x466f98[_0x5566('0x2b')]=qs['limit'](_0x46e78c[_0x5566('0x39')]['limit']);_0x466f98[_0x5566('0x2a')]=qs[_0x5566('0x2a')](_0x46e78c[_0x5566('0x39')][_0x5566('0x2a')]);}_0x466f98[_0x5566('0x40')]=qs[_0x5566('0x41')](_0x46e78c[_0x5566('0x39')][_0x5566('0x41')]);_0x466f98[_0x5566('0x42')]=qs[_0x5566('0x3a')](_[_0x5566('0x43')](_0x46e78c['query'],_0xaed5b2[_0x5566('0x3a')]),_0x4afe41);if(_0x46e78c[_0x5566('0x39')]['filter']){_0x466f98[_0x5566('0x42')]=_['merge'](_0x466f98['where'],{'$or':_[_0x5566('0x34')](_0x4afe41,function(_0x22b6c1){if(_0x22b6c1[_0x5566('0x44')]!==_0x5566('0x45')){var _0x1a79f6={};_0x1a79f6[_0x22b6c1[_0x5566('0x33')]]={'$like':'%'+_0x46e78c['query'][_0x5566('0x46')]+'%'};return _0x1a79f6;}})});}_0x466f98=_['merge']({},_0x466f98,_0x46e78c[_0x5566('0x47')]);var _0x1e3847={'where':_0x466f98[_0x5566('0x42')]};return db[_0x5566('0x35')][_0x5566('0x29')](_0x1e3847)[_0x5566('0x1e')](function(_0x423ecd){_0x5e62cc[_0x5566('0x29')]=_0x423ecd;if(_0x46e78c['query']['includeAll']){_0x466f98[_0x5566('0x48')]=[{'all':!![]}];}return db[_0x5566('0x35')]['findAll'](_0x466f98);})[_0x5566('0x1e')](function(_0x4bac01){_0x5e62cc['rows']=_0x4bac01;return _0x5e62cc;})[_0x5566('0x1e')](respondWithFilteredResult(_0x4ece26,_0x466f98))[_0x5566('0x49')](handleError(_0x4ece26,null));};exports[_0x5566('0x4a')]=function(_0x206d61,_0x33ada8){var _0x6579e0={'raw':![],'where':{'id':_0x206d61['params']['id']}},_0x8f189c={};_0x8f189c[_0x5566('0x3c')]=_['keys'](db[_0x5566('0x35')][_0x5566('0x36')]);_0x8f189c[_0x5566('0x39')]=_['keys'](_0x206d61['query']);_0x8f189c[_0x5566('0x3a')]=_['intersection'](_0x8f189c['model'],_0x8f189c['query']);_0x6579e0['attributes']=_[_0x5566('0x3b')](_0x8f189c['model'],qs[_0x5566('0x4b')](_0x206d61[_0x5566('0x39')][_0x5566('0x4b')]));_0x6579e0['attributes']=_0x6579e0[_0x5566('0x3d')][_0x5566('0x3e')]?_0x6579e0[_0x5566('0x3d')]:_0x8f189c['model'];if(_0x206d61[_0x5566('0x39')]['includeAll']){_0x6579e0['include']=[{'all':!![]}];}_0x6579e0=_['merge']({},_0x6579e0,_0x206d61[_0x5566('0x47')]);return db['VtigerAccount'][_0x5566('0x4c')](_0x6579e0)['then'](handleEntityNotFound(_0x33ada8,null))[_0x5566('0x1e')](respondWithResult(_0x33ada8,null))[_0x5566('0x49')](handleError(_0x33ada8,null));};exports[_0x5566('0x4d')]=function(_0x18fc67,_0x5bb950){return db['VtigerAccount']['create'](_0x18fc67[_0x5566('0x4e')],{})['then'](respondWithResult(_0x5bb950,0xc9))[_0x5566('0x49')](handleError(_0x5bb950,null));};exports[_0x5566('0x2f')]=function(_0x58b6ea,_0x4fede7){if(_0x58b6ea[_0x5566('0x4e')]['id']){delete _0x58b6ea[_0x5566('0x4e')]['id'];}return db[_0x5566('0x35')]['find']({'where':{'id':_0x58b6ea['params']['id']}})[_0x5566('0x1e')](handleEntityNotFound(_0x4fede7,null))[_0x5566('0x1e')](saveUpdates(_0x58b6ea[_0x5566('0x4e')],null))[_0x5566('0x1e')](respondWithResult(_0x4fede7,null))[_0x5566('0x49')](handleError(_0x4fede7,null));};exports[_0x5566('0x30')]=function(_0x54f8ad,_0x3fd4f5){return db[_0x5566('0x35')][_0x5566('0x4c')]({'where':{'id':_0x54f8ad[_0x5566('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fd4f5,null))[_0x5566('0x1e')](removeEntity(_0x3fd4f5,null))[_0x5566('0x49')](handleError(_0x3fd4f5,null));};exports[_0x5566('0x50')]=function(_0x2821ba,_0x8ce6ea,_0x5a4965){var _0x4e0a02={};var _0x368bd9={};var _0x3976fc;var _0x4c797f;return db[_0x5566('0x35')][_0x5566('0x51')]({'where':{'id':_0x2821ba['params']['id']}})[_0x5566('0x1e')](handleEntityNotFound(_0x8ce6ea,null))[_0x5566('0x1e')](function(_0x4c3bab){if(_0x4c3bab){_0x3976fc=_0x4c3bab;_0x368bd9[_0x5566('0x3c')]=_[_0x5566('0x52')](db[_0x5566('0x53')]['rawAttributes']);_0x368bd9[_0x5566('0x39')]=_[_0x5566('0x52')](_0x2821ba[_0x5566('0x39')]);_0x368bd9[_0x5566('0x3a')]=_['intersection'](_0x368bd9[_0x5566('0x3c')],_0x368bd9[_0x5566('0x39')]);_0x4e0a02[_0x5566('0x3d')]=_['intersection'](_0x368bd9[_0x5566('0x3c')],qs[_0x5566('0x4b')](_0x2821ba['query'][_0x5566('0x4b')]));_0x4e0a02['attributes']=_0x4e0a02[_0x5566('0x3d')][_0x5566('0x3e')]?_0x4e0a02[_0x5566('0x3d')]:_0x368bd9[_0x5566('0x3c')];_0x4e0a02[_0x5566('0x40')]=qs[_0x5566('0x41')](_0x2821ba[_0x5566('0x39')]['sort']);_0x4e0a02[_0x5566('0x42')]=qs[_0x5566('0x3a')](_[_0x5566('0x43')](_0x2821ba[_0x5566('0x39')],_0x368bd9[_0x5566('0x3a')]));if(_0x2821ba[_0x5566('0x39')][_0x5566('0x46')]){_0x4e0a02[_0x5566('0x42')]=_[_0x5566('0x54')](_0x4e0a02[_0x5566('0x42')],{'$or':_[_0x5566('0x34')](_0x4e0a02[_0x5566('0x3d')],function(_0x1cc4c1){var _0x313781={};_0x313781[_0x1cc4c1]={'$like':'%'+_0x2821ba['query']['filter']+'%'};return _0x313781;})});}_0x4e0a02=_[_0x5566('0x54')]({},_0x4e0a02,_0x2821ba['options']);return _0x3976fc[_0x5566('0x50')](_0x4e0a02);}})[_0x5566('0x1e')](function(_0x29c09a){if(_0x29c09a){_0x4c797f=_0x29c09a['length'];if(!_0x2821ba[_0x5566('0x39')][_0x5566('0x55')]('nolimit')){_0x4e0a02[_0x5566('0x2b')]=qs['limit'](_0x2821ba['query']['limit']);_0x4e0a02[_0x5566('0x2a')]=qs['offset'](_0x2821ba['query'][_0x5566('0x2a')]);}return _0x3976fc[_0x5566('0x50')](_0x4e0a02);}})[_0x5566('0x1e')](function(_0x111be7){if(_0x111be7){return _0x111be7?{'count':_0x4c797f,'rows':_0x111be7}:null;}})['then'](respondWithResult(_0x8ce6ea,null))[_0x5566('0x49')](handleError(_0x8ce6ea,null));};exports['addConfiguration']=function(_0x286d89,_0xc54694,_0x3e4cfd){if(_0x286d89[_0x5566('0x4e')]['id']){delete _0x286d89[_0x5566('0x4e')]['id'];}return db[_0x5566('0x35')]['findOne']({'where':{'id':_0x286d89['params']['id']}})['then'](handleEntityNotFound(_0xc54694,null))['then'](function(_0x3d796b){if(_0x3d796b){_0x286d89['body']['AccountId']=_0x3d796b['id'];_0x286d89[_0x5566('0x4e')]['Subjects']=integrations[_0x5566('0x56')](_0x286d89[_0x5566('0x4e')][_0x5566('0x57')],_0x286d89['body'][_0x5566('0x44')]);_0x286d89['body'][_0x5566('0x58')]=integrations[_0x5566('0x59')](_0x286d89[_0x5566('0x4e')][_0x5566('0x57')],_0x286d89[_0x5566('0x4e')][_0x5566('0x44')]);return db[_0x5566('0x53')][_0x5566('0x4d')](_0x286d89[_0x5566('0x4e')],{'include':[{'model':db[_0x5566('0x5a')],'as':_0x5566('0x5b')},{'model':db[_0x5566('0x5a')],'as':_0x5566('0x58')}]});}return null;})[_0x5566('0x1e')](respondWithResult(_0xc54694,null))[_0x5566('0x49')](handleError(_0xc54694,null));};var md5=require(_0x5566('0x5c'));exports[_0x5566('0x5d')]=function(_0x110325,_0x563205,_0x5866fd){var _0x25d14a=null;var _0x27fead=null;var _0x41453f=null;var _0x516207=null;var _0x437d10='';return db[_0x5566('0x35')]['findOne']({'where':{'id':_0x110325[_0x5566('0x4f')]['id']},'attributes':['id',_0x5566('0x33'),_0x5566('0x5e'),'description',_0x5566('0x5f'),_0x5566('0x60'),_0x5566('0x61'),_0x5566('0x62')]})[_0x5566('0x1e')](handleEntityNotFound(_0x563205,null))[_0x5566('0x1e')](function(_0x1340bc){if(_0x1340bc){_0x25d14a=_0x1340bc[_0x5566('0x5e')];_0x27fead=_0x1340bc['accessKey'];_0x41453f=_0x1340bc[_0x5566('0x5f')];_0x437d10=_0x1340bc['remoteUri'];var _0x5f194d=_0x437d10[_0x5566('0x63')](-0x1);if(_0x5f194d==='/'){_0x437d10=_0x437d10[_0x5566('0x64')](0x0,_0x437d10['lastIndexOf'](_0x5f194d));}_0x516207=util['format']('%s/webservice.php',_0x437d10);var _0x431508={'method':_0x5566('0x65'),'uri':_0x516207,'qs':{'operation':_0x5566('0x66'),'username':_0x1340bc[_0x5566('0x5e')]},'json':!![]};return rp(_0x431508);}})[_0x5566('0x1e')](function(_0x3c6ef5){if(_0x3c6ef5['success']){var _0x8f2f60={'method':_0x5566('0x67'),'uri':_0x516207,'form':{'operation':_0x5566('0x68'),'username':_0x25d14a,'accessKey':md5(_0x3c6ef5[_0x5566('0x25')][_0x5566('0x69')]+_0x27fead)},'json':!![]};return rp(_0x8f2f60);}})['then'](function(_0x129621){if(_0x129621['success']){var _0x4a3889={'method':'GET','uri':_0x516207,'qs':{'operation':_0x5566('0x6a'),'username':_0x25d14a,'sessionName':_0x129621[_0x5566('0x25')][_0x5566('0x6b')],'elementType':_0x41453f},'json':!![]};return rp(_0x4a3889);}})['then'](function(_0x38efc4){if(_0x38efc4[_0x5566('0x6c')]){var _0x5e1c4f=[_0x5566('0x6d'),_0x5566('0x6e'),_0x5566('0x6f')];_['remove'](_0x38efc4[_0x5566('0x25')][_0x5566('0x4b')],function(_0x3b2c6c){return _0x5e1c4f[_0x5566('0x70')](_0x3b2c6c[_0x5566('0x44')]['name']);});_[_0x5566('0x71')](_0x38efc4[_0x5566('0x25')]['fields'],function(_0x351c44){return _0x351c44[_0x5566('0x72')]==='false';});return{'count':_0x38efc4[_0x5566('0x25')][_0x5566('0x4b')][_0x5566('0x3e')],'rows':_[_0x5566('0x34')](_0x38efc4['result'][_0x5566('0x4b')],function(_0x1447ba){return{'id':_0x1447ba['name'],'name':_0x1447ba[_0x5566('0x73')],'custom':_[_0x5566('0x74')](_0x1447ba['name'],'cf_')?!![]:![],'options':_0x1447ba[_0x5566('0x44')][_0x5566('0x33')]==='picklist'&&_0x1447ba['type'][_0x5566('0x75')]['length']>0x0?_[_0x5566('0x34')](_0x1447ba['type'][_0x5566('0x75')],function(_0x24b0f9){return{'name':_0x24b0f9['label'],'value':_0x24b0f9[_0x5566('0x76')]};}):[]};})};}})[_0x5566('0x1e')](respondWithResult(_0x563205,null))['catch'](function(_0x37c30a){console[_0x5566('0x77')](_0x5566('0x78')+_0x37c30a);var _0x5a99af=_0x110325['query'][_0x5566('0x79')]?0x1f4:_0x37c30a[_0x5566('0x7a')]||0x1f4;logger[_0x5566('0x23')](_0x5566('0x7b'),'getFields',_0x5a99af,JSON[_0x5566('0x7c')](_0x37c30a));delete _0x37c30a[_0x5566('0x33')];if(_0x5a99af===0x191){_0x5a99af=0x190;}_0x563205[_0x5566('0x27')](_0x5a99af)[_0x5566('0x7d')](_0x110325[_0x5566('0x39')]['test']?{'message':_0x5566('0x7e'),'statusCode':_0x37c30a[_0x5566('0x7a')]}:_0x37c30a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3d93031..e58104d 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 _0x5408=['../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./intVtigerAccount.attributes'];(function(_0x5d5d04,_0x47315c){var _0x2d959f=function(_0x4e95e7){while(--_0x4e95e7){_0x5d5d04['push'](_0x5d5d04['shift']());}};_0x2d959f(++_0x47315c);}(_0x5408,0x121));var _0x8540=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x5408[_0x5d860f];return _0x236490;};'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(_0x8540('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8540('0x6'));var config=require('../../config/environment');var attributes=require(_0x8540('0x7'));var integrations=require(_0x8540('0x8'));module['exports']=function(_0x3a86a8,_0x2a959e){return _0x3a86a8['define'](_0x8540('0x9'),attributes,{'tableName':_0x8540('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3626=['request-promise','path','rimraf','../../components/integrations/configuration','exports','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x454cbd,_0x436d19){var _0x45b4bf=function(_0x52241d){while(--_0x52241d){_0x454cbd['push'](_0x454cbd['shift']());}};_0x45b4bf(++_0x436d19);}(_0x3626,0x1c9));var _0x6362=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3626[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6362('0x0'));var util=require(_0x6362('0x1'));var logger=require(_0x6362('0x2'))('api');var moment=require(_0x6362('0x3'));var BPromise=require(_0x6362('0x4'));var rp=require(_0x6362('0x5'));var fs=require('fs');var path=require(_0x6362('0x6'));var rimraf=require(_0x6362('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x6362('0x8'));module[_0x6362('0x9')]=function(_0xfcc2f2,_0x509b5f){return _0xfcc2f2['define']('VtigerAccount',attributes,{'tableName':_0x6362('0xa'),'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 8056ab7..67bc449 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 _0x48b7=['options','raw','where','attributes','map','include','model','GetVtigerAccount','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VtigerAccount','findAll'];(function(_0x385a39,_0x21a109){var _0x3823b8=function(_0x3d4c1c){while(--_0x3d4c1c){_0x385a39['push'](_0x385a39['shift']());}};_0x3823b8(++_0x21a109);}(_0x48b7,0x12b));var _0x748b=function(_0x3b5623,_0x23d48a){_0x3b5623=_0x3b5623-0x0;var _0x460e69=_0x48b7[_0x3b5623];return _0x460e69;};'use strict';var _=require(_0x748b('0x0'));var util=require(_0x748b('0x1'));var moment=require(_0x748b('0x2'));var BPromise=require(_0x748b('0x3'));var rs=require(_0x748b('0x4'));var fs=require('fs');var Redis=require(_0x748b('0x5'));var db=require(_0x748b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x748b('0x7'))(_0x748b('0x8'));var config=require(_0x748b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x748b('0xa')][_0x748b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x453f35,_0x232044,_0xd14c40){return new BPromise(function(_0x194b99,_0xdca2e8){return client[_0x748b('0xc')](_0x453f35,_0xd14c40)[_0x748b('0xd')](function(_0x2caaa8){logger['info'](_0x748b('0xe'),_0x232044,'request\x20sent');logger[_0x748b('0xf')](_0x748b('0x10'),_0x232044,_0x748b('0x11'),JSON['stringify'](_0x2caaa8));if(_0x2caaa8[_0x748b('0x12')]){if(_0x2caaa8[_0x748b('0x12')][_0x748b('0x13')]===0x1f4){logger[_0x748b('0x12')](_0x748b('0xe'),_0x232044,_0x2caaa8[_0x748b('0x12')]['message']);return _0xdca2e8(_0x2caaa8['error'][_0x748b('0x14')]);}logger['error'](_0x748b('0xe'),_0x232044,_0x2caaa8[_0x748b('0x12')][_0x748b('0x14')]);return _0x194b99(_0x2caaa8[_0x748b('0x12')][_0x748b('0x14')]);}else{logger['info'](_0x748b('0xe'),_0x232044,'request\x20sent');_0x194b99(_0x2caaa8[_0x748b('0x15')][_0x748b('0x14')]);}})[_0x748b('0x16')](function(_0x9ec2dd){logger[_0x748b('0x12')](_0x748b('0xe'),_0x232044,_0x9ec2dd);_0xdca2e8(_0x9ec2dd);});});}exports['GetVtigerAccount']=function(_0x260b98){var _0x18010f=this;return new Promise(function(_0x3b5a21,_0x3f48cc){return db[_0x748b('0x17')][_0x748b('0x18')]({'raw':_0x260b98[_0x748b('0x19')]?_0x260b98['options'][_0x748b('0x1a')]===undefined?!![]:![]:!![],'where':_0x260b98[_0x748b('0x19')]?_0x260b98['options'][_0x748b('0x1b')]||null:null,'attributes':_0x260b98[_0x748b('0x19')]?_0x260b98[_0x748b('0x19')][_0x748b('0x1c')]||null:null,'limit':_0x260b98['options']?_0x260b98[_0x748b('0x19')]['limit']||null:null,'include':_0x260b98[_0x748b('0x19')]?_0x260b98[_0x748b('0x19')]['include']?_[_0x748b('0x1d')](_0x260b98['options'][_0x748b('0x1e')],function(_0x227399){return{'model':db[_0x227399[_0x748b('0x1f')]],'as':_0x227399['as'],'attributes':_0x227399[_0x748b('0x1c')],'include':_0x227399[_0x748b('0x1e')]?_[_0x748b('0x1d')](_0x227399[_0x748b('0x1e')],function(_0x35d5cb){return{'model':db[_0x35d5cb['model']],'as':_0x35d5cb['as'],'attributes':_0x35d5cb['attributes'],'include':_0x35d5cb[_0x748b('0x1e')]?_[_0x748b('0x1d')](_0x35d5cb[_0x748b('0x1e')],function(_0x2b731c){return{'model':db[_0x2b731c[_0x748b('0x1f')]],'as':_0x2b731c['as'],'attributes':_0x2b731c['attributes']};}):[]};}):[]};}):[]:[]})[_0x748b('0xd')](function(_0x48bdcc){logger['info'](_0x748b('0x20'),_0x260b98);logger[_0x748b('0xf')]('GetVtigerAccount',_0x260b98,JSON[_0x748b('0x21')](_0x48bdcc));_0x3b5a21(_0x48bdcc);})[_0x748b('0x16')](function(_0x3ebd67){logger['error'](_0x748b('0x20'),_0x3ebd67[_0x748b('0x14')],_0x260b98);_0x3f48cc(_0x18010f['error'](0x1f4,_0x3ebd67[_0x748b('0x14')]));});});};exports[_0x748b('0x22')]=function(_0x427b40){var _0x197be4=this;return new Promise(function(_0x34d06d,_0x13b8ff){return db[_0x748b('0x17')][_0x748b('0x23')]({'raw':_0x427b40[_0x748b('0x19')]?_0x427b40['options'][_0x748b('0x1a')]===undefined?!![]:![]:!![],'where':_0x427b40['options']?_0x427b40[_0x748b('0x19')][_0x748b('0x1b')]||null:null,'attributes':_0x427b40[_0x748b('0x19')]?_0x427b40[_0x748b('0x19')][_0x748b('0x1c')]||null:null,'include':_0x427b40[_0x748b('0x19')]?_0x427b40[_0x748b('0x19')][_0x748b('0x1e')]?_['map'](_0x427b40[_0x748b('0x19')][_0x748b('0x1e')],function(_0x2eb96e){return{'model':db[_0x2eb96e['model']],'as':_0x2eb96e['as'],'attributes':_0x2eb96e[_0x748b('0x1c')],'include':_0x2eb96e[_0x748b('0x1e')]?_['map'](_0x2eb96e[_0x748b('0x1e')],function(_0x573b09){return{'model':db[_0x573b09[_0x748b('0x1f')]],'as':_0x573b09['as'],'attributes':_0x573b09[_0x748b('0x1c')],'include':_0x573b09[_0x748b('0x1e')]?_[_0x748b('0x1d')](_0x573b09['include'],function(_0x373900){return{'model':db[_0x373900['model']],'as':_0x373900['as'],'attributes':_0x373900[_0x748b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x748b('0xd')](function(_0x2d459b){logger['info']('ShowVtigerAccount',_0x427b40);logger['debug']('ShowVtigerAccount',_0x427b40,JSON[_0x748b('0x21')](_0x2d459b));_0x34d06d(_0x2d459b);})[_0x748b('0x16')](function(_0x25d371){logger[_0x748b('0x12')](_0x748b('0x22'),_0x25d371[_0x748b('0x14')],_0x427b40);_0x13b8ff(_0x197be4[_0x748b('0x12')](0x1f4,_0x25d371[_0x748b('0x14')]));});});}; \ No newline at end of file +var _0xf787=['find','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','VtigerAccount'];(function(_0x4df17c,_0x2d2b61){var _0x4e79b5=function(_0x2134a5){while(--_0x2134a5){_0x4df17c['push'](_0x4df17c['shift']());}};_0x4e79b5(++_0x2d2b61);}(_0xf787,0x134));var _0x7f78=function(_0x564208,_0xc63d5a){_0x564208=_0x564208-0x0;var _0x4e379d=_0xf787[_0x564208];return _0x4e379d;};'use strict';var _=require(_0x7f78('0x0'));var util=require(_0x7f78('0x1'));var moment=require('moment');var BPromise=require(_0x7f78('0x2'));var rs=require(_0x7f78('0x3'));var fs=require('fs');var Redis=require(_0x7f78('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f78('0x5'));var logger=require(_0x7f78('0x6'))(_0x7f78('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7f78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50f988,_0x483e5b,_0x1295d2){return new BPromise(function(_0x40000b,_0x5bd400){return client[_0x7f78('0x9')](_0x50f988,_0x1295d2)['then'](function(_0x205a9f){logger[_0x7f78('0xa')](_0x7f78('0xb'),_0x483e5b,_0x7f78('0xc'));logger[_0x7f78('0xd')](_0x7f78('0xe'),_0x483e5b,_0x7f78('0xc'),JSON['stringify'](_0x205a9f));if(_0x205a9f['error']){if(_0x205a9f[_0x7f78('0xf')][_0x7f78('0x10')]===0x1f4){logger[_0x7f78('0xf')](_0x7f78('0xb'),_0x483e5b,_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);return _0x5bd400(_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);}logger[_0x7f78('0xf')](_0x7f78('0xb'),_0x483e5b,_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);return _0x40000b(_0x205a9f[_0x7f78('0xf')][_0x7f78('0x11')]);}else{logger[_0x7f78('0xa')](_0x7f78('0xb'),_0x483e5b,_0x7f78('0xc'));_0x40000b(_0x205a9f[_0x7f78('0x12')]['message']);}})[_0x7f78('0x13')](function(_0x26deaf){logger[_0x7f78('0xf')](_0x7f78('0xb'),_0x483e5b,_0x26deaf);_0x5bd400(_0x26deaf);});});}exports[_0x7f78('0x14')]=function(_0x223bc1){var _0x3f6ea5=this;return new Promise(function(_0x3f9edd,_0x9d9d8d){return db['VtigerAccount']['findAll']({'raw':_0x223bc1[_0x7f78('0x15')]?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x16')]===undefined?!![]:![]:!![],'where':_0x223bc1['options']?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x17')]||null:null,'attributes':_0x223bc1[_0x7f78('0x15')]?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x18')]||null:null,'limit':_0x223bc1[_0x7f78('0x15')]?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x19')]||null:null,'include':_0x223bc1['options']?_0x223bc1[_0x7f78('0x15')][_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x223bc1[_0x7f78('0x15')][_0x7f78('0x1a')],function(_0x1d4c56){return{'model':db[_0x1d4c56[_0x7f78('0x1c')]],'as':_0x1d4c56['as'],'attributes':_0x1d4c56[_0x7f78('0x18')],'include':_0x1d4c56[_0x7f78('0x1a')]?_['map'](_0x1d4c56['include'],function(_0x4d7a8e){return{'model':db[_0x4d7a8e[_0x7f78('0x1c')]],'as':_0x4d7a8e['as'],'attributes':_0x4d7a8e['attributes'],'include':_0x4d7a8e[_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x4d7a8e[_0x7f78('0x1a')],function(_0x922a1b){return{'model':db[_0x922a1b[_0x7f78('0x1c')]],'as':_0x922a1b['as'],'attributes':_0x922a1b[_0x7f78('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f78('0x1d')](function(_0x1981e1){logger[_0x7f78('0xa')](_0x7f78('0x14'),_0x223bc1);logger['debug']('GetVtigerAccount',_0x223bc1,JSON['stringify'](_0x1981e1));_0x3f9edd(_0x1981e1);})[_0x7f78('0x13')](function(_0x45f82e){logger[_0x7f78('0xf')]('GetVtigerAccount',_0x45f82e[_0x7f78('0x11')],_0x223bc1);_0x9d9d8d(_0x3f6ea5['error'](0x1f4,_0x45f82e[_0x7f78('0x11')]));});});};exports[_0x7f78('0x1e')]=function(_0x2f05cf){var _0x23a71e=this;return new Promise(function(_0x162070,_0x59ded4){return db[_0x7f78('0x1f')][_0x7f78('0x20')]({'raw':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf[_0x7f78('0x15')][_0x7f78('0x16')]===undefined?!![]:![]:!![],'where':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf[_0x7f78('0x15')][_0x7f78('0x17')]||null:null,'attributes':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf['options'][_0x7f78('0x18')]||null:null,'include':_0x2f05cf[_0x7f78('0x15')]?_0x2f05cf[_0x7f78('0x15')][_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x2f05cf[_0x7f78('0x15')]['include'],function(_0xe59a1e){return{'model':db[_0xe59a1e[_0x7f78('0x1c')]],'as':_0xe59a1e['as'],'attributes':_0xe59a1e['attributes'],'include':_0xe59a1e['include']?_[_0x7f78('0x1b')](_0xe59a1e[_0x7f78('0x1a')],function(_0x4a3837){return{'model':db[_0x4a3837[_0x7f78('0x1c')]],'as':_0x4a3837['as'],'attributes':_0x4a3837[_0x7f78('0x18')],'include':_0x4a3837[_0x7f78('0x1a')]?_[_0x7f78('0x1b')](_0x4a3837[_0x7f78('0x1a')],function(_0x3278d0){return{'model':db[_0x3278d0['model']],'as':_0x3278d0['as'],'attributes':_0x3278d0[_0x7f78('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7f78('0x1d')](function(_0x6dbc39){logger[_0x7f78('0xa')](_0x7f78('0x1e'),_0x2f05cf);logger[_0x7f78('0xd')]('ShowVtigerAccount',_0x2f05cf,JSON[_0x7f78('0x21')](_0x6dbc39));_0x162070(_0x6dbc39);})[_0x7f78('0x13')](function(_0x4d99d5){logger[_0x7f78('0xf')](_0x7f78('0x1e'),_0x4d99d5[_0x7f78('0x11')],_0x2f05cf);_0x59ded4(_0x23a71e[_0x7f78('0xf')](0x1f4,_0x4d99d5[_0x7f78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d30027c..9409d02 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 _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(_0x22b3e5,_0x47d66b){var _0x5e9502=function(_0x2a4226){while(--_0x2a4226){_0x22b3e5['push'](_0x22b3e5['shift']());}};_0x5e9502(++_0x47d66b);}(_0xb10b,0x12a));var _0xbb10=function(_0x310832,_0xe72c7e){_0x310832=_0x310832-0x0;var _0x103f74=_0xb10b[_0x310832];return _0x103f74;};'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 +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x527016,_0xa80812){var _0x5210bc=function(_0x3f1289){while(--_0x3f1289){_0x527016['push'](_0x527016['shift']());}};_0x5210bc(++_0xa80812);}(_0x5f2f,0x73));var _0xf5f2=function(_0x440d2a,_0x23070a){_0x440d2a=_0x440d2a-0x0;var _0x2bbe8c=_0x5f2f[_0x440d2a];return _0x2bbe8c;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 742de00..71491d9 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 _0x328d=['STRING'];(function(_0x309385,_0x3ab38f){var _0x45b0f5=function(_0x4fa7e0){while(--_0x4fa7e0){_0x309385['push'](_0x309385['shift']());}};_0x45b0f5(++_0x3ab38f);}(_0x328d,0x16c));var _0xd328=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x328d[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd328('0x0')]}}; \ No newline at end of file +var _0x036a=['sequelize','exports','STRING'];(function(_0x1de0b9,_0xc6f046){var _0x18edae=function(_0x2d3ad1){while(--_0x2d3ad1){_0x1de0b9['push'](_0x1de0b9['shift']());}};_0x18edae(++_0xc6f046);}(_0x036a,0x17d));var _0xa036=function(_0x12118a,_0x111eae){_0x12118a=_0x12118a-0x0;var _0x36d11e=_0x036a[_0x12118a];return _0x36d11e;};'use strict';var Sequelize=require(_0xa036('0x0'));module[_0xa036('0x1')]={'name':{'type':Sequelize[_0xa036('0x2')]},'description':{'type':Sequelize[_0xa036('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6f7f5c1..2022491 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 _0x7cfe=['key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','create','update','body','find','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','pick','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','VtigerConfiguration','rawAttributes','fieldName','type'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7cfe,0xd9));var _0xe7cf=function(_0x36747f,_0xa43a1){_0x36747f=_0x36747f-0x0;var _0x430aea=_0x7cfe[_0x36747f];return _0x430aea;};'use strict';var pdf=require(_0xe7cf('0x0'));var emlformat=require(_0xe7cf('0x1'));var rimraf=require(_0xe7cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7cf('0x3'));var rp=require(_0xe7cf('0x4'));var moment=require('moment');var BPromise=require(_0xe7cf('0x5'));var Mustache=require('mustache');var util=require(_0xe7cf('0x6'));var path=require('path');var sox=require(_0xe7cf('0x7'));var csv=require(_0xe7cf('0x8'));var ejs=require(_0xe7cf('0x9'));var fs=require('fs');var _=require(_0xe7cf('0xa'));var squel=require(_0xe7cf('0xb'));var crypto=require(_0xe7cf('0xc'));var jsforce=require(_0xe7cf('0xd'));var deskjs=require(_0xe7cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7cf('0x10'));var authService=require(_0xe7cf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe7cf('0x12'));var hardwareService=require(_0xe7cf('0x13'));var logger=require('../../config/logger')(_0xe7cf('0x14'));var utils=require(_0xe7cf('0x15'));var config=require(_0xe7cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7cf('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xe7cf('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2769e6,_0x431a5e,_0x122439,_0x58735f){return new BPromise(function(_0x386dcb,_0x58b1f5){var _0x3fb3f1=_0x58735f||client;return _0x3fb3f1[_0xe7cf('0x19')](_0x2769e6,_0x122439)['then'](function(_0x280824){logger[_0xe7cf('0x1a')](_0xe7cf('0x1b'),_0x431a5e,_0xe7cf('0x1c'));logger['debug'](_0xe7cf('0x1d'),_0x431a5e,_0xe7cf('0x1c'),JSON[_0xe7cf('0x1e')](_0x280824));if(_0x280824['error']){if(_0x280824['error']['code']===0x1f4){logger[_0xe7cf('0x1f')](_0xe7cf('0x1b'),_0x431a5e,_0x280824[_0xe7cf('0x1f')][_0xe7cf('0x20')]);return _0x58b1f5(_0x280824[_0xe7cf('0x1f')]['message']);}logger[_0xe7cf('0x1f')](_0xe7cf('0x1b'),_0x431a5e,_0x280824[_0xe7cf('0x1f')]['message']);return _0x386dcb(_0x280824[_0xe7cf('0x1f')][_0xe7cf('0x20')]);}else{logger['info'](_0xe7cf('0x1b'),_0x431a5e,_0xe7cf('0x1c'));_0x386dcb(_0x280824[_0xe7cf('0x21')][_0xe7cf('0x20')]);}})['catch'](function(_0xde3105){logger[_0xe7cf('0x1f')](_0xe7cf('0x1b'),_0x431a5e,_0xde3105);_0x58b1f5(_0xde3105);});});}function respondWithStatusCode(_0x18ff6a,_0x3d4dd1){_0x3d4dd1=_0x3d4dd1||0xcc;return function(_0x5e0a98){if(_0x5e0a98){return _0x18ff6a[_0xe7cf('0x22')](_0x3d4dd1);}return _0x18ff6a['status'](_0x3d4dd1)[_0xe7cf('0x23')]();};}function respondWithResult(_0x380cfd,_0x2d3825){_0x2d3825=_0x2d3825||0xc8;return function(_0x3d670e){if(_0x3d670e){return _0x380cfd['status'](_0x2d3825)[_0xe7cf('0x24')](_0x3d670e);}};}function respondWithFilteredResult(_0x36c577,_0x241d99){return function(_0x4b7ecd){if(_0x4b7ecd){var _0x38cd7c=_0x4b7ecd['count'],_0x538f17=_0x241d99[_0xe7cf('0x25')],_0x115a12=_0x241d99['offset']+_0x241d99[_0xe7cf('0x26')],_0x17a1ca;if(_0x115a12>=_0x38cd7c){_0x115a12=_0x38cd7c;_0x17a1ca=0xc8;}else{_0x17a1ca=0xce;}_0x36c577[_0xe7cf('0x27')](_0x17a1ca);return _0x36c577[_0xe7cf('0x28')](_0xe7cf('0x29'),_0x538f17+'-'+_0x115a12+'/'+_0x38cd7c)[_0xe7cf('0x24')](_0x4b7ecd);}return null;};}function patchUpdates(_0x3ede17){return function(_0x3f58f2){try{jsonpatch[_0xe7cf('0x2a')](_0x3f58f2,_0x3ede17,!![]);}catch(_0x4b0f5f){return BPromise[_0xe7cf('0x2b')](_0x4b0f5f);}return _0x3f58f2[_0xe7cf('0x2c')]();};}function saveUpdates(_0x1d2e1a,_0x2dae52){return function(_0x409081){if(_0x409081){return _0x409081['update'](_0x1d2e1a)[_0xe7cf('0x2d')](function(_0x571e75){return _0x571e75;});}return null;};}function removeEntity(_0x2a8926,_0x21a6ec){return function(_0x53555a){if(_0x53555a){return _0x53555a[_0xe7cf('0x2e')]()[_0xe7cf('0x2d')](function(){_0x2a8926[_0xe7cf('0x27')](0xcc)[_0xe7cf('0x23')]();});}};}function handleEntityNotFound(_0x141e83,_0x26b5e4){return function(_0x4aedfe){if(!_0x4aedfe){_0x141e83[_0xe7cf('0x22')](0x194);}return _0x4aedfe;};}function handleError(_0x49231c,_0x1c4e7b){_0x1c4e7b=_0x1c4e7b||0x1f4;return function(_0x2a62df){logger[_0xe7cf('0x1f')](_0x2a62df[_0xe7cf('0x2f')]);if(_0x2a62df[_0xe7cf('0x30')]){delete _0x2a62df[_0xe7cf('0x30')];}_0x49231c['status'](_0x1c4e7b)['send'](_0x2a62df);};}exports['index']=function(_0x5388bc,_0x46ad5e){var _0x153dcd={},_0x152038={},_0x22cdf1={'count':0x0,'rows':[]};var _0x41ca73=_['map'](db[_0xe7cf('0x31')][_0xe7cf('0x32')],function(_0x2c6a3d){return{'name':_0x2c6a3d[_0xe7cf('0x33')],'type':_0x2c6a3d[_0xe7cf('0x34')][_0xe7cf('0x35')]};});_0x152038[_0xe7cf('0x36')]=_[_0xe7cf('0x37')](_0x41ca73,_0xe7cf('0x30'));_0x152038[_0xe7cf('0x38')]=_[_0xe7cf('0x39')](_0x5388bc[_0xe7cf('0x38')]);_0x152038[_0xe7cf('0x3a')]=_[_0xe7cf('0x3b')](_0x152038[_0xe7cf('0x36')],_0x152038[_0xe7cf('0x38')]);_0x153dcd[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x152038[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0x5388bc['query'][_0xe7cf('0x3d')]));_0x153dcd[_0xe7cf('0x3c')]=_0x153dcd[_0xe7cf('0x3c')]['length']?_0x153dcd[_0xe7cf('0x3c')]:_0x152038[_0xe7cf('0x36')];if(!_0x5388bc['query']['hasOwnProperty'](_0xe7cf('0x3e'))){_0x153dcd[_0xe7cf('0x26')]=qs[_0xe7cf('0x26')](_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x153dcd['offset']=qs[_0xe7cf('0x25')](_0x5388bc[_0xe7cf('0x38')]['offset']);}_0x153dcd[_0xe7cf('0x3f')]=qs[_0xe7cf('0x40')](_0x5388bc[_0xe7cf('0x38')]['sort']);_0x153dcd[_0xe7cf('0x41')]=qs[_0xe7cf('0x3a')](_['pick'](_0x5388bc['query'],_0x152038['filters']),_0x41ca73);if(_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x42')]){_0x153dcd['where']=_[_0xe7cf('0x43')](_0x153dcd['where'],{'$or':_[_0xe7cf('0x37')](_0x41ca73,function(_0x2a9094){if(_0x2a9094[_0xe7cf('0x34')]!==_0xe7cf('0x44')){var _0x298a16={};_0x298a16[_0x2a9094[_0xe7cf('0x30')]]={'$like':'%'+_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x42')]+'%'};return _0x298a16;}})});}_0x153dcd=_['merge']({},_0x153dcd,_0x5388bc[_0xe7cf('0x45')]);var _0x3960e={'where':_0x153dcd[_0xe7cf('0x41')]};return db[_0xe7cf('0x31')][_0xe7cf('0x46')](_0x3960e)[_0xe7cf('0x2d')](function(_0x447350){_0x22cdf1['count']=_0x447350;if(_0x5388bc[_0xe7cf('0x38')][_0xe7cf('0x47')]){_0x153dcd[_0xe7cf('0x48')]=[{'all':!![]}];}return db[_0xe7cf('0x31')][_0xe7cf('0x49')](_0x153dcd);})['then'](function(_0x1b647b){_0x22cdf1[_0xe7cf('0x4a')]=_0x1b647b;return _0x22cdf1;})[_0xe7cf('0x2d')](respondWithFilteredResult(_0x46ad5e,_0x153dcd))[_0xe7cf('0x4b')](handleError(_0x46ad5e,null));};exports[_0xe7cf('0x4c')]=function(_0xee34a6,_0x33ab1d){var _0x1aae03={'raw':![],'where':{'id':_0xee34a6[_0xe7cf('0x4d')]['id']}},_0x43b45c={};_0x43b45c[_0xe7cf('0x36')]=_[_0xe7cf('0x39')](db[_0xe7cf('0x31')][_0xe7cf('0x32')]);_0x43b45c[_0xe7cf('0x38')]=_['keys'](_0xee34a6['query']);_0x43b45c['filters']=_[_0xe7cf('0x3b')](_0x43b45c['model'],_0x43b45c[_0xe7cf('0x38')]);_0x1aae03[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x43b45c[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0xee34a6[_0xe7cf('0x38')][_0xe7cf('0x3d')]));_0x1aae03[_0xe7cf('0x3c')]=_0x1aae03[_0xe7cf('0x3c')][_0xe7cf('0x4e')]?_0x1aae03[_0xe7cf('0x3c')]:_0x43b45c['model'];if(_0xee34a6[_0xe7cf('0x38')]['includeAll']){_0x1aae03[_0xe7cf('0x48')]=[{'all':!![]}];}_0x1aae03=_[_0xe7cf('0x43')]({},_0x1aae03,_0xee34a6[_0xe7cf('0x45')]);return db[_0xe7cf('0x31')]['find'](_0x1aae03)[_0xe7cf('0x2d')](handleEntityNotFound(_0x33ab1d,null))[_0xe7cf('0x2d')](respondWithResult(_0x33ab1d,null))['catch'](handleError(_0x33ab1d,null));};exports[_0xe7cf('0x4f')]=function(_0x3689aa,_0x557e2a){return db[_0xe7cf('0x31')][_0xe7cf('0x4f')](_0x3689aa['body'],{})[_0xe7cf('0x2d')](respondWithResult(_0x557e2a,0xc9))['catch'](handleError(_0x557e2a,null));};exports[_0xe7cf('0x50')]=function(_0x57c37d,_0x2136fe){if(_0x57c37d[_0xe7cf('0x51')]['id']){delete _0x57c37d[_0xe7cf('0x51')]['id'];}return db['VtigerConfiguration'][_0xe7cf('0x52')]({'where':{'id':_0x57c37d[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x2136fe,null))[_0xe7cf('0x2d')](saveUpdates(_0x57c37d[_0xe7cf('0x51')],null))[_0xe7cf('0x2d')](respondWithResult(_0x2136fe,null))['catch'](handleError(_0x2136fe,null));};exports[_0xe7cf('0x2e')]=function(_0x277574,_0x3962a9){return db[_0xe7cf('0x31')][_0xe7cf('0x52')]({'where':{'id':_0x277574[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x3962a9,null))[_0xe7cf('0x2d')](removeEntity(_0x3962a9,null))[_0xe7cf('0x4b')](handleError(_0x3962a9,null));};exports[_0xe7cf('0x53')]=function(_0x2e9668,_0x5276e4,_0x447bbd){var _0x303e3b={};var _0x81672d={};var _0x489dbb;var _0x1dc748;return db[_0xe7cf('0x31')][_0xe7cf('0x54')]({'where':{'id':_0x2e9668[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x5276e4,null))[_0xe7cf('0x2d')](function(_0x387090){if(_0x387090){_0x489dbb=_0x387090;_0x81672d[_0xe7cf('0x36')]=_['keys'](db[_0xe7cf('0x55')][_0xe7cf('0x32')]);_0x81672d['query']=_[_0xe7cf('0x39')](_0x2e9668['query']);_0x81672d[_0xe7cf('0x3a')]=_[_0xe7cf('0x3b')](_0x81672d[_0xe7cf('0x36')],_0x81672d[_0xe7cf('0x38')]);_0x303e3b[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x81672d[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0x2e9668['query'][_0xe7cf('0x3d')]));_0x303e3b[_0xe7cf('0x3c')]=_0x303e3b[_0xe7cf('0x3c')][_0xe7cf('0x4e')]?_0x303e3b[_0xe7cf('0x3c')]:_0x81672d[_0xe7cf('0x36')];_0x303e3b[_0xe7cf('0x3f')]=qs[_0xe7cf('0x40')](_0x2e9668[_0xe7cf('0x38')][_0xe7cf('0x40')]);_0x303e3b['where']=qs[_0xe7cf('0x3a')](_['pick'](_0x2e9668[_0xe7cf('0x38')],_0x81672d[_0xe7cf('0x3a')]));if(_0x2e9668['query'][_0xe7cf('0x42')]){_0x303e3b[_0xe7cf('0x41')]=_[_0xe7cf('0x43')](_0x303e3b['where'],{'$or':_['map'](_0x303e3b[_0xe7cf('0x3c')],function(_0x38a152){var _0x492d3b={};_0x492d3b[_0x38a152]={'$like':'%'+_0x2e9668['query'][_0xe7cf('0x42')]+'%'};return _0x492d3b;})});}_0x303e3b=_['merge']({},_0x303e3b,_0x2e9668['options']);return _0x489dbb['getFields'](_0x303e3b);}})[_0xe7cf('0x2d')](function(_0x218180){if(_0x218180){_0x1dc748=_0x218180[_0xe7cf('0x4e')];if(!_0x2e9668[_0xe7cf('0x38')][_0xe7cf('0x56')]('nolimit')){_0x303e3b[_0xe7cf('0x26')]=qs['limit'](_0x2e9668[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x303e3b['offset']=qs[_0xe7cf('0x25')](_0x2e9668[_0xe7cf('0x38')]['offset']);}return _0x489dbb[_0xe7cf('0x53')](_0x303e3b);}})['then'](function(_0x129408){if(_0x129408){return _0x129408?{'count':_0x1dc748,'rows':_0x129408}:null;}})[_0xe7cf('0x2d')](respondWithResult(_0x5276e4,null))[_0xe7cf('0x4b')](handleError(_0x5276e4,null));};exports[_0xe7cf('0x57')]=function(_0x176315,_0x9f0f8f,_0x4fd3b5){var _0x4978df={};var _0x586fe7={};var _0x2ae7c2;var _0xc8754a;return db[_0xe7cf('0x31')][_0xe7cf('0x54')]({'where':{'id':_0x176315[_0xe7cf('0x4d')]['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x9f0f8f,null))[_0xe7cf('0x2d')](function(_0x4178d6){if(_0x4178d6){_0x2ae7c2=_0x4178d6;_0x586fe7['model']=_[_0xe7cf('0x39')](db[_0xe7cf('0x55')]['rawAttributes']);_0x586fe7[_0xe7cf('0x38')]=_['keys'](_0x176315[_0xe7cf('0x38')]);_0x586fe7[_0xe7cf('0x3a')]=_[_0xe7cf('0x3b')](_0x586fe7[_0xe7cf('0x36')],_0x586fe7[_0xe7cf('0x38')]);_0x4978df[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x586fe7[_0xe7cf('0x36')],qs['fields'](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x3d')]));_0x4978df['attributes']=_0x4978df[_0xe7cf('0x3c')][_0xe7cf('0x4e')]?_0x4978df['attributes']:_0x586fe7[_0xe7cf('0x36')];_0x4978df[_0xe7cf('0x3f')]=qs[_0xe7cf('0x40')](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x40')]);_0x4978df[_0xe7cf('0x41')]=qs['filters'](_[_0xe7cf('0x58')](_0x176315[_0xe7cf('0x38')],_0x586fe7[_0xe7cf('0x3a')]));if(_0x176315[_0xe7cf('0x38')][_0xe7cf('0x42')]){_0x4978df['where']=_[_0xe7cf('0x43')](_0x4978df[_0xe7cf('0x41')],{'$or':_['map'](_0x4978df['attributes'],function(_0x3717e8){var _0x345025={};_0x345025[_0x3717e8]={'$like':'%'+_0x176315['query']['filter']+'%'};return _0x345025;})});}_0x4978df=_[_0xe7cf('0x43')]({},_0x4978df,_0x176315[_0xe7cf('0x45')]);return _0x2ae7c2[_0xe7cf('0x57')](_0x4978df);}})[_0xe7cf('0x2d')](function(_0x285246){if(_0x285246){_0xc8754a=_0x285246[_0xe7cf('0x4e')];if(!_0x176315[_0xe7cf('0x38')]['hasOwnProperty'](_0xe7cf('0x3e'))){_0x4978df[_0xe7cf('0x26')]=qs['limit'](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x4978df[_0xe7cf('0x25')]=qs[_0xe7cf('0x25')](_0x176315[_0xe7cf('0x38')][_0xe7cf('0x25')]);}return _0x2ae7c2[_0xe7cf('0x57')](_0x4978df);}})[_0xe7cf('0x2d')](function(_0x3d12b0){if(_0x3d12b0){return _0x3d12b0?{'count':_0xc8754a,'rows':_0x3d12b0}:null;}})['then'](respondWithResult(_0x9f0f8f,null))[_0xe7cf('0x4b')](handleError(_0x9f0f8f,null));};exports['getDescriptions']=function(_0x31cdf6,_0x1440fe,_0x163022){var _0x380948={};var _0x39d572={};var _0x64bda3;var _0x3a19d2;return db['VtigerConfiguration'][_0xe7cf('0x54')]({'where':{'id':_0x31cdf6['params']['id']}})[_0xe7cf('0x2d')](handleEntityNotFound(_0x1440fe,null))[_0xe7cf('0x2d')](function(_0x4020cb){if(_0x4020cb){_0x64bda3=_0x4020cb;_0x39d572['model']=_[_0xe7cf('0x39')](db[_0xe7cf('0x55')][_0xe7cf('0x32')]);_0x39d572[_0xe7cf('0x38')]=_[_0xe7cf('0x39')](_0x31cdf6[_0xe7cf('0x38')]);_0x39d572['filters']=_[_0xe7cf('0x3b')](_0x39d572[_0xe7cf('0x36')],_0x39d572['query']);_0x380948[_0xe7cf('0x3c')]=_[_0xe7cf('0x3b')](_0x39d572[_0xe7cf('0x36')],qs[_0xe7cf('0x3d')](_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x3d')]));_0x380948[_0xe7cf('0x3c')]=_0x380948['attributes'][_0xe7cf('0x4e')]?_0x380948[_0xe7cf('0x3c')]:_0x39d572['model'];_0x380948['order']=qs[_0xe7cf('0x40')](_0x31cdf6['query'][_0xe7cf('0x40')]);_0x380948[_0xe7cf('0x41')]=qs[_0xe7cf('0x3a')](_[_0xe7cf('0x58')](_0x31cdf6[_0xe7cf('0x38')],_0x39d572[_0xe7cf('0x3a')]));if(_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x42')]){_0x380948[_0xe7cf('0x41')]=_[_0xe7cf('0x43')](_0x380948[_0xe7cf('0x41')],{'$or':_[_0xe7cf('0x37')](_0x380948[_0xe7cf('0x3c')],function(_0x1b3bf4){var _0x469b44={};_0x469b44[_0x1b3bf4]={'$like':'%'+_0x31cdf6[_0xe7cf('0x38')]['filter']+'%'};return _0x469b44;})});}_0x380948=_['merge']({},_0x380948,_0x31cdf6[_0xe7cf('0x45')]);return _0x64bda3[_0xe7cf('0x59')](_0x380948);}})[_0xe7cf('0x2d')](function(_0x371edf){if(_0x371edf){_0x3a19d2=_0x371edf[_0xe7cf('0x4e')];if(!_0x31cdf6['query'][_0xe7cf('0x56')]('nolimit')){_0x380948[_0xe7cf('0x26')]=qs[_0xe7cf('0x26')](_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x26')]);_0x380948[_0xe7cf('0x25')]=qs['offset'](_0x31cdf6[_0xe7cf('0x38')][_0xe7cf('0x25')]);}return _0x64bda3[_0xe7cf('0x59')](_0x380948);}})[_0xe7cf('0x2d')](function(_0xcdacb8){if(_0xcdacb8){return _0xcdacb8?{'count':_0x3a19d2,'rows':_0xcdacb8}:null;}})[_0xe7cf('0x2d')](respondWithResult(_0x1440fe,null))[_0xe7cf('0x4b')](handleError(_0x1440fe,null));}; \ No newline at end of file +var _0x1dc2=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','VtigerConfiguration','includeAll','include','rows','params','keys','find','create','body','getFields','findOne','pick','hasOwnProperty','getSubjects','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x2346c7,_0x35bbcc){var _0x20a6e4=function(_0x4476cf){while(--_0x4476cf){_0x2346c7['push'](_0x2346c7['shift']());}};_0x20a6e4(++_0x35bbcc);}(_0x1dc2,0xb0));var _0x21dc=function(_0x46ed0f,_0xab0142){_0x46ed0f=_0x46ed0f-0x0;var _0x4fcd95=_0x1dc2[_0x46ed0f];return _0x4fcd95;};'use strict';var pdf=require(_0x21dc('0x0'));var emlformat=require(_0x21dc('0x1'));var rimraf=require(_0x21dc('0x2'));var zipdir=require(_0x21dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21dc('0x4'));var moment=require(_0x21dc('0x5'));var BPromise=require(_0x21dc('0x6'));var Mustache=require(_0x21dc('0x7'));var util=require(_0x21dc('0x8'));var path=require(_0x21dc('0x9'));var sox=require(_0x21dc('0xa'));var csv=require(_0x21dc('0xb'));var ejs=require(_0x21dc('0xc'));var fs=require('fs');var _=require(_0x21dc('0xd'));var squel=require('squel');var crypto=require(_0x21dc('0xe'));var jsforce=require(_0x21dc('0xf'));var deskjs=require(_0x21dc('0x10'));var toCsv=require(_0x21dc('0xb'));var querystring=require(_0x21dc('0x11'));var Papa=require(_0x21dc('0x12'));var Redis=require(_0x21dc('0x13'));var authService=require(_0x21dc('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x21dc('0x15'));var hardwareService=require(_0x21dc('0x16'));var logger=require(_0x21dc('0x17'))(_0x21dc('0x18'));var utils=require(_0x21dc('0x19'));var config=require(_0x21dc('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x21dc('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x21dc('0x1c')][_0x21dc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4e7e25,_0xf43d7f,_0x21ab65,_0x26b1b2){return new BPromise(function(_0x24574c,_0x15ff38){var _0x5c26d3=_0x26b1b2||client;return _0x5c26d3[_0x21dc('0x1e')](_0x4e7e25,_0x21ab65)[_0x21dc('0x1f')](function(_0x32d7c1){logger[_0x21dc('0x20')](_0x21dc('0x21'),_0xf43d7f,_0x21dc('0x22'));logger[_0x21dc('0x23')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xf43d7f,_0x21dc('0x22'),JSON[_0x21dc('0x24')](_0x32d7c1));if(_0x32d7c1[_0x21dc('0x25')]){if(_0x32d7c1[_0x21dc('0x25')]['code']===0x1f4){logger[_0x21dc('0x25')](_0x21dc('0x21'),_0xf43d7f,_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);return _0x15ff38(_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);}logger[_0x21dc('0x25')](_0x21dc('0x21'),_0xf43d7f,_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);return _0x24574c(_0x32d7c1[_0x21dc('0x25')][_0x21dc('0x26')]);}else{logger[_0x21dc('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0xf43d7f,_0x21dc('0x22'));_0x24574c(_0x32d7c1['result'][_0x21dc('0x26')]);}})[_0x21dc('0x27')](function(_0x1868cf){logger[_0x21dc('0x25')]('VtigerConfiguration,\x20%s,\x20%s',_0xf43d7f,_0x1868cf);_0x15ff38(_0x1868cf);});});}function respondWithStatusCode(_0x4b41bc,_0x42126d){_0x42126d=_0x42126d||0xcc;return function(_0x8350f4){if(_0x8350f4){return _0x4b41bc['sendStatus'](_0x42126d);}return _0x4b41bc[_0x21dc('0x28')](_0x42126d)['end']();};}function respondWithResult(_0x49cdb1,_0x44b656){_0x44b656=_0x44b656||0xc8;return function(_0x211d87){if(_0x211d87){return _0x49cdb1[_0x21dc('0x28')](_0x44b656)[_0x21dc('0x29')](_0x211d87);}};}function respondWithFilteredResult(_0x45075f,_0x474ee0){return function(_0x2b0cb2){if(_0x2b0cb2){var _0x22f676=_0x2b0cb2[_0x21dc('0x2a')],_0x552239=_0x474ee0[_0x21dc('0x2b')],_0x17e98c=_0x474ee0[_0x21dc('0x2b')]+_0x474ee0[_0x21dc('0x2c')],_0x3ed251;if(_0x17e98c>=_0x22f676){_0x17e98c=_0x22f676;_0x3ed251=0xc8;}else{_0x3ed251=0xce;}_0x45075f[_0x21dc('0x28')](_0x3ed251);return _0x45075f[_0x21dc('0x2d')](_0x21dc('0x2e'),_0x552239+'-'+_0x17e98c+'/'+_0x22f676)[_0x21dc('0x29')](_0x2b0cb2);}return null;};}function patchUpdates(_0x490678){return function(_0x96e227){try{jsonpatch[_0x21dc('0x2f')](_0x96e227,_0x490678,!![]);}catch(_0x3ce0d5){return BPromise[_0x21dc('0x30')](_0x3ce0d5);}return _0x96e227[_0x21dc('0x31')]();};}function saveUpdates(_0x33652d,_0x4c21e6){return function(_0x43f74){if(_0x43f74){return _0x43f74[_0x21dc('0x32')](_0x33652d)[_0x21dc('0x1f')](function(_0x199d68){return _0x199d68;});}return null;};}function removeEntity(_0x119af3,_0x4d12d1){return function(_0x5b379f){if(_0x5b379f){return _0x5b379f[_0x21dc('0x33')]()['then'](function(){_0x119af3[_0x21dc('0x28')](0xcc)[_0x21dc('0x34')]();});}};}function handleEntityNotFound(_0x34aaf5,_0x52c1e9){return function(_0x18dd8c){if(!_0x18dd8c){_0x34aaf5['sendStatus'](0x194);}return _0x18dd8c;};}function handleError(_0x16b1b8,_0x201ecd){_0x201ecd=_0x201ecd||0x1f4;return function(_0x60fc6){logger[_0x21dc('0x25')](_0x60fc6[_0x21dc('0x35')]);if(_0x60fc6[_0x21dc('0x36')]){delete _0x60fc6[_0x21dc('0x36')];}_0x16b1b8[_0x21dc('0x28')](_0x201ecd)[_0x21dc('0x37')](_0x60fc6);};}exports[_0x21dc('0x38')]=function(_0x1fcc8b,_0x5388a0){var _0x16259f={},_0x490986={},_0x2ddbca={'count':0x0,'rows':[]};var _0x139ad6=_[_0x21dc('0x39')](db['VtigerConfiguration'][_0x21dc('0x3a')],function(_0x1f1bb2){return{'name':_0x1f1bb2[_0x21dc('0x3b')],'type':_0x1f1bb2['type']['key']};});_0x490986[_0x21dc('0x3c')]=_[_0x21dc('0x39')](_0x139ad6,_0x21dc('0x36'));_0x490986['query']=_['keys'](_0x1fcc8b[_0x21dc('0x3d')]);_0x490986[_0x21dc('0x3e')]=_[_0x21dc('0x3f')](_0x490986['model'],_0x490986['query']);_0x16259f['attributes']=_['intersection'](_0x490986[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x40')]));_0x16259f['attributes']=_0x16259f[_0x21dc('0x41')][_0x21dc('0x42')]?_0x16259f['attributes']:_0x490986[_0x21dc('0x3c')];if(!_0x1fcc8b[_0x21dc('0x3d')]['hasOwnProperty'](_0x21dc('0x43'))){_0x16259f[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x2c')]);_0x16259f['offset']=qs[_0x21dc('0x2b')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x2b')]);}_0x16259f[_0x21dc('0x44')]=qs[_0x21dc('0x45')](_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x45')]);_0x16259f['where']=qs[_0x21dc('0x3e')](_['pick'](_0x1fcc8b[_0x21dc('0x3d')],_0x490986[_0x21dc('0x3e')]),_0x139ad6);if(_0x1fcc8b[_0x21dc('0x3d')]['filter']){_0x16259f[_0x21dc('0x46')]=_[_0x21dc('0x47')](_0x16259f[_0x21dc('0x46')],{'$or':_[_0x21dc('0x39')](_0x139ad6,function(_0x35f077){if(_0x35f077[_0x21dc('0x48')]!==_0x21dc('0x49')){var _0x1cc951={};_0x1cc951[_0x35f077[_0x21dc('0x36')]]={'$like':'%'+_0x1fcc8b['query'][_0x21dc('0x4a')]+'%'};return _0x1cc951;}})});}_0x16259f=_[_0x21dc('0x47')]({},_0x16259f,_0x1fcc8b[_0x21dc('0x4b')]);var _0x102754={'where':_0x16259f[_0x21dc('0x46')]};return db[_0x21dc('0x4c')]['count'](_0x102754)[_0x21dc('0x1f')](function(_0x49add3){_0x2ddbca[_0x21dc('0x2a')]=_0x49add3;if(_0x1fcc8b[_0x21dc('0x3d')][_0x21dc('0x4d')]){_0x16259f[_0x21dc('0x4e')]=[{'all':!![]}];}return db[_0x21dc('0x4c')]['findAll'](_0x16259f);})[_0x21dc('0x1f')](function(_0x5f59c){_0x2ddbca[_0x21dc('0x4f')]=_0x5f59c;return _0x2ddbca;})[_0x21dc('0x1f')](respondWithFilteredResult(_0x5388a0,_0x16259f))['catch'](handleError(_0x5388a0,null));};exports['show']=function(_0x22a846,_0x2dd0f7){var _0x24c50={'raw':![],'where':{'id':_0x22a846[_0x21dc('0x50')]['id']}},_0x36f3f5={};_0x36f3f5[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db[_0x21dc('0x4c')][_0x21dc('0x3a')]);_0x36f3f5[_0x21dc('0x3d')]=_[_0x21dc('0x51')](_0x22a846[_0x21dc('0x3d')]);_0x36f3f5[_0x21dc('0x3e')]=_[_0x21dc('0x3f')](_0x36f3f5[_0x21dc('0x3c')],_0x36f3f5[_0x21dc('0x3d')]);_0x24c50[_0x21dc('0x41')]=_[_0x21dc('0x3f')](_0x36f3f5[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0x22a846['query'][_0x21dc('0x40')]));_0x24c50[_0x21dc('0x41')]=_0x24c50[_0x21dc('0x41')][_0x21dc('0x42')]?_0x24c50[_0x21dc('0x41')]:_0x36f3f5[_0x21dc('0x3c')];if(_0x22a846[_0x21dc('0x3d')][_0x21dc('0x4d')]){_0x24c50[_0x21dc('0x4e')]=[{'all':!![]}];}_0x24c50=_[_0x21dc('0x47')]({},_0x24c50,_0x22a846['options']);return db[_0x21dc('0x4c')][_0x21dc('0x52')](_0x24c50)[_0x21dc('0x1f')](handleEntityNotFound(_0x2dd0f7,null))[_0x21dc('0x1f')](respondWithResult(_0x2dd0f7,null))['catch'](handleError(_0x2dd0f7,null));};exports[_0x21dc('0x53')]=function(_0x8c393,_0x5495d1){return db[_0x21dc('0x4c')]['create'](_0x8c393[_0x21dc('0x54')],{})['then'](respondWithResult(_0x5495d1,0xc9))['catch'](handleError(_0x5495d1,null));};exports['update']=function(_0x1219c6,_0x5127c8){if(_0x1219c6[_0x21dc('0x54')]['id']){delete _0x1219c6[_0x21dc('0x54')]['id'];}return db[_0x21dc('0x4c')][_0x21dc('0x52')]({'where':{'id':_0x1219c6[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x5127c8,null))[_0x21dc('0x1f')](saveUpdates(_0x1219c6['body'],null))[_0x21dc('0x1f')](respondWithResult(_0x5127c8,null))['catch'](handleError(_0x5127c8,null));};exports[_0x21dc('0x33')]=function(_0x2550e8,_0x5b581f){return db['VtigerConfiguration'][_0x21dc('0x52')]({'where':{'id':_0x2550e8[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x5b581f,null))[_0x21dc('0x1f')](removeEntity(_0x5b581f,null))[_0x21dc('0x27')](handleError(_0x5b581f,null));};exports[_0x21dc('0x55')]=function(_0xc81fdf,_0x4b8c63,_0x464315){var _0x393bfc={};var _0x39e24e={};var _0x4480cf;var _0x3d34f8;return db['VtigerConfiguration'][_0x21dc('0x56')]({'where':{'id':_0xc81fdf[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x4b8c63,null))['then'](function(_0x4cba21){if(_0x4cba21){_0x4480cf=_0x4cba21;_0x39e24e[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db['VtigerField'][_0x21dc('0x3a')]);_0x39e24e[_0x21dc('0x3d')]=_[_0x21dc('0x51')](_0xc81fdf[_0x21dc('0x3d')]);_0x39e24e[_0x21dc('0x3e')]=_[_0x21dc('0x3f')](_0x39e24e[_0x21dc('0x3c')],_0x39e24e[_0x21dc('0x3d')]);_0x393bfc[_0x21dc('0x41')]=_[_0x21dc('0x3f')](_0x39e24e[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0xc81fdf['query'][_0x21dc('0x40')]));_0x393bfc[_0x21dc('0x41')]=_0x393bfc[_0x21dc('0x41')][_0x21dc('0x42')]?_0x393bfc[_0x21dc('0x41')]:_0x39e24e[_0x21dc('0x3c')];_0x393bfc[_0x21dc('0x44')]=qs[_0x21dc('0x45')](_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x45')]);_0x393bfc[_0x21dc('0x46')]=qs[_0x21dc('0x3e')](_[_0x21dc('0x57')](_0xc81fdf[_0x21dc('0x3d')],_0x39e24e[_0x21dc('0x3e')]));if(_0xc81fdf['query']['filter']){_0x393bfc[_0x21dc('0x46')]=_['merge'](_0x393bfc[_0x21dc('0x46')],{'$or':_['map'](_0x393bfc[_0x21dc('0x41')],function(_0x22bed8){var _0x88ac4c={};_0x88ac4c[_0x22bed8]={'$like':'%'+_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x4a')]+'%'};return _0x88ac4c;})});}_0x393bfc=_[_0x21dc('0x47')]({},_0x393bfc,_0xc81fdf[_0x21dc('0x4b')]);return _0x4480cf['getFields'](_0x393bfc);}})['then'](function(_0x31f935){if(_0x31f935){_0x3d34f8=_0x31f935[_0x21dc('0x42')];if(!_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x58')]('nolimit')){_0x393bfc[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x2c')]);_0x393bfc[_0x21dc('0x2b')]=qs[_0x21dc('0x2b')](_0xc81fdf[_0x21dc('0x3d')][_0x21dc('0x2b')]);}return _0x4480cf[_0x21dc('0x55')](_0x393bfc);}})[_0x21dc('0x1f')](function(_0x24b785){if(_0x24b785){return _0x24b785?{'count':_0x3d34f8,'rows':_0x24b785}:null;}})['then'](respondWithResult(_0x4b8c63,null))[_0x21dc('0x27')](handleError(_0x4b8c63,null));};exports[_0x21dc('0x59')]=function(_0x37de58,_0x531734,_0x4ae123){var _0x14c5f0={};var _0x19084a={};var _0x4dc4c1;var _0x627480;return db['VtigerConfiguration'][_0x21dc('0x56')]({'where':{'id':_0x37de58[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x531734,null))[_0x21dc('0x1f')](function(_0x5f39bd){if(_0x5f39bd){_0x4dc4c1=_0x5f39bd;_0x19084a[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db[_0x21dc('0x5a')][_0x21dc('0x3a')]);_0x19084a['query']=_[_0x21dc('0x51')](_0x37de58[_0x21dc('0x3d')]);_0x19084a[_0x21dc('0x3e')]=_['intersection'](_0x19084a['model'],_0x19084a[_0x21dc('0x3d')]);_0x14c5f0[_0x21dc('0x41')]=_[_0x21dc('0x3f')](_0x19084a[_0x21dc('0x3c')],qs['fields'](_0x37de58[_0x21dc('0x3d')]['fields']));_0x14c5f0['attributes']=_0x14c5f0[_0x21dc('0x41')]['length']?_0x14c5f0[_0x21dc('0x41')]:_0x19084a[_0x21dc('0x3c')];_0x14c5f0[_0x21dc('0x44')]=qs['sort'](_0x37de58['query'][_0x21dc('0x45')]);_0x14c5f0['where']=qs[_0x21dc('0x3e')](_[_0x21dc('0x57')](_0x37de58[_0x21dc('0x3d')],_0x19084a['filters']));if(_0x37de58[_0x21dc('0x3d')][_0x21dc('0x4a')]){_0x14c5f0[_0x21dc('0x46')]=_[_0x21dc('0x47')](_0x14c5f0[_0x21dc('0x46')],{'$or':_[_0x21dc('0x39')](_0x14c5f0['attributes'],function(_0x201d57){var _0x31700f={};_0x31700f[_0x201d57]={'$like':'%'+_0x37de58['query'][_0x21dc('0x4a')]+'%'};return _0x31700f;})});}_0x14c5f0=_[_0x21dc('0x47')]({},_0x14c5f0,_0x37de58['options']);return _0x4dc4c1[_0x21dc('0x59')](_0x14c5f0);}})[_0x21dc('0x1f')](function(_0x5329dd){if(_0x5329dd){_0x627480=_0x5329dd[_0x21dc('0x42')];if(!_0x37de58[_0x21dc('0x3d')][_0x21dc('0x58')](_0x21dc('0x43'))){_0x14c5f0[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0x37de58[_0x21dc('0x3d')][_0x21dc('0x2c')]);_0x14c5f0[_0x21dc('0x2b')]=qs['offset'](_0x37de58[_0x21dc('0x3d')]['offset']);}return _0x4dc4c1[_0x21dc('0x59')](_0x14c5f0);}})['then'](function(_0x26edbb){if(_0x26edbb){return _0x26edbb?{'count':_0x627480,'rows':_0x26edbb}:null;}})[_0x21dc('0x1f')](respondWithResult(_0x531734,null))[_0x21dc('0x27')](handleError(_0x531734,null));};exports[_0x21dc('0x5b')]=function(_0x2e9113,_0x1e51f1,_0x139fad){var _0x1a903c={};var _0x41c59d={};var _0x2f200a;var _0x18ae64;return db[_0x21dc('0x4c')][_0x21dc('0x56')]({'where':{'id':_0x2e9113[_0x21dc('0x50')]['id']}})[_0x21dc('0x1f')](handleEntityNotFound(_0x1e51f1,null))['then'](function(_0x4189f9){if(_0x4189f9){_0x2f200a=_0x4189f9;_0x41c59d[_0x21dc('0x3c')]=_[_0x21dc('0x51')](db[_0x21dc('0x5a')][_0x21dc('0x3a')]);_0x41c59d[_0x21dc('0x3d')]=_[_0x21dc('0x51')](_0x2e9113[_0x21dc('0x3d')]);_0x41c59d['filters']=_[_0x21dc('0x3f')](_0x41c59d[_0x21dc('0x3c')],_0x41c59d[_0x21dc('0x3d')]);_0x1a903c['attributes']=_[_0x21dc('0x3f')](_0x41c59d[_0x21dc('0x3c')],qs[_0x21dc('0x40')](_0x2e9113[_0x21dc('0x3d')][_0x21dc('0x40')]));_0x1a903c[_0x21dc('0x41')]=_0x1a903c[_0x21dc('0x41')]['length']?_0x1a903c['attributes']:_0x41c59d[_0x21dc('0x3c')];_0x1a903c['order']=qs[_0x21dc('0x45')](_0x2e9113[_0x21dc('0x3d')][_0x21dc('0x45')]);_0x1a903c['where']=qs[_0x21dc('0x3e')](_[_0x21dc('0x57')](_0x2e9113['query'],_0x41c59d[_0x21dc('0x3e')]));if(_0x2e9113[_0x21dc('0x3d')][_0x21dc('0x4a')]){_0x1a903c['where']=_[_0x21dc('0x47')](_0x1a903c[_0x21dc('0x46')],{'$or':_[_0x21dc('0x39')](_0x1a903c[_0x21dc('0x41')],function(_0x26d096){var _0x30c697={};_0x30c697[_0x26d096]={'$like':'%'+_0x2e9113['query'][_0x21dc('0x4a')]+'%'};return _0x30c697;})});}_0x1a903c=_[_0x21dc('0x47')]({},_0x1a903c,_0x2e9113[_0x21dc('0x4b')]);return _0x2f200a[_0x21dc('0x5b')](_0x1a903c);}})[_0x21dc('0x1f')](function(_0x4cf66b){if(_0x4cf66b){_0x18ae64=_0x4cf66b['length'];if(!_0x2e9113['query'][_0x21dc('0x58')]('nolimit')){_0x1a903c[_0x21dc('0x2c')]=qs[_0x21dc('0x2c')](_0x2e9113[_0x21dc('0x3d')]['limit']);_0x1a903c[_0x21dc('0x2b')]=qs[_0x21dc('0x2b')](_0x2e9113['query']['offset']);}return _0x2f200a['getDescriptions'](_0x1a903c);}})[_0x21dc('0x1f')](function(_0x20474a){if(_0x20474a){return _0x20474a?{'count':_0x18ae64,'rows':_0x20474a}:null;}})[_0x21dc('0x1f')](respondWithResult(_0x1e51f1,null))[_0x21dc('0x27')](handleError(_0x1e51f1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6d48ef7..7d432c6 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 _0x65af=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x4bc9ac,_0x3157eb){var _0x3d3bb2=function(_0x29dedf){while(--_0x29dedf){_0x4bc9ac['push'](_0x4bc9ac['shift']());}};_0x3d3bb2(++_0x3157eb);}(_0x65af,0x1e2));var _0xf65a=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x65af[_0x29db36];return _0x234e87;};'use strict';var _=require(_0xf65a('0x0'));var util=require(_0xf65a('0x1'));var logger=require(_0xf65a('0x2'))(_0xf65a('0x3'));var moment=require(_0xf65a('0x4'));var BPromise=require(_0xf65a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf65a('0x6'));var attributes=require(_0xf65a('0x7'));module[_0xf65a('0x8')]=function(_0x84359d,_0x1163f5){return _0x84359d[_0xf65a('0x9')](_0xf65a('0xa'),attributes,{'tableName':_0xf65a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x307a=['exports','define','VtigerConfiguration','int_vtiger_configurations','util','api','moment','rimraf','./intVtigerConfiguration.attributes'];(function(_0x3f4b71,_0x57a093){var _0x24ecde=function(_0x5dde6f){while(--_0x5dde6f){_0x3f4b71['push'](_0x3f4b71['shift']());}};_0x24ecde(++_0x57a093);}(_0x307a,0xb8));var _0xa307=function(_0x40d5d8,_0x4dc52f){_0x40d5d8=_0x40d5d8-0x0;var _0x1c24de=_0x307a[_0x40d5d8];return _0x1c24de;};'use strict';var _=require('lodash');var util=require(_0xa307('0x0'));var logger=require('../../config/logger')(_0xa307('0x1'));var moment=require(_0xa307('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa307('0x3'));var config=require('../../config/environment');var attributes=require(_0xa307('0x4'));module[_0xa307('0x5')]=function(_0x29fd40,_0x4361f2){return _0x29fd40[_0xa307('0x6')](_0xa307('0x7'),attributes,{'tableName':_0xa307('0x8'),'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 d7e2b07..8ad2029 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 _0xd179=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd179,0x18d));var _0x9d17=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xd179[_0x3a0c4f];return _0x247049;};'use strict';var _=require(_0x9d17('0x0'));var util=require(_0x9d17('0x1'));var moment=require(_0x9d17('0x2'));var BPromise=require(_0x9d17('0x3'));var rs=require(_0x9d17('0x4'));var fs=require('fs');var Redis=require(_0x9d17('0x5'));var db=require(_0x9d17('0x6'))['db'];var utils=require(_0x9d17('0x7'));var logger=require(_0x9d17('0x8'))(_0x9d17('0x9'));var config=require(_0x9d17('0xa'));var jayson=require(_0x9d17('0xb'));var client=jayson[_0x9d17('0xc')][_0x9d17('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40f149,_0x3d1ada,_0x4a3ac7){return new BPromise(function(_0x2bc3e3,_0x212530){return client[_0x9d17('0xe')](_0x40f149,_0x4a3ac7)[_0x9d17('0xf')](function(_0x2aa85a){logger[_0x9d17('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x3d1ada,_0x9d17('0x11'));logger[_0x9d17('0x12')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3d1ada,'request\x20sent',JSON[_0x9d17('0x13')](_0x2aa85a));if(_0x2aa85a[_0x9d17('0x14')]){if(_0x2aa85a[_0x9d17('0x14')][_0x9d17('0x15')]===0x1f4){logger[_0x9d17('0x14')](_0x9d17('0x16'),_0x3d1ada,_0x2aa85a['error'][_0x9d17('0x17')]);return _0x212530(_0x2aa85a['error'][_0x9d17('0x17')]);}logger[_0x9d17('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x3d1ada,_0x2aa85a[_0x9d17('0x14')][_0x9d17('0x17')]);return _0x2bc3e3(_0x2aa85a[_0x9d17('0x14')][_0x9d17('0x17')]);}else{logger[_0x9d17('0x10')](_0x9d17('0x16'),_0x3d1ada,_0x9d17('0x11'));_0x2bc3e3(_0x2aa85a['result'][_0x9d17('0x17')]);}})[_0x9d17('0x18')](function(_0x1b2e11){logger[_0x9d17('0x14')](_0x9d17('0x16'),_0x3d1ada,_0x1b2e11);_0x212530(_0x1b2e11);});});} \ No newline at end of file +var _0x2ed5=['../../config/utils','rpc','../../config/environment','jayson/promise','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x216235,_0xc47fca){var _0x55efad=function(_0x3eb5cf){while(--_0x3eb5cf){_0x216235['push'](_0x216235['shift']());}};_0x55efad(++_0xc47fca);}(_0x2ed5,0x109));var _0x52ed=function(_0x5ba35a,_0x5e5113){_0x5ba35a=_0x5ba35a-0x0;var _0x5900dc=_0x2ed5[_0x5ba35a];return _0x5900dc;};'use strict';var _=require(_0x52ed('0x0'));var util=require(_0x52ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52ed('0x2'));var fs=require('fs');var Redis=require(_0x52ed('0x3'));var db=require(_0x52ed('0x4'))['db'];var utils=require(_0x52ed('0x5'));var logger=require('../../config/logger')(_0x52ed('0x6'));var config=require(_0x52ed('0x7'));var jayson=require(_0x52ed('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2659c2,_0x4208b3,_0x14f8fb){return new BPromise(function(_0x2e80ca,_0x1a43c1){return client[_0x52ed('0x9')](_0x2659c2,_0x14f8fb)['then'](function(_0x1a8a5e){logger['info'](_0x52ed('0xa'),_0x4208b3,_0x52ed('0xb'));logger['debug'](_0x52ed('0xc'),_0x4208b3,_0x52ed('0xb'),JSON['stringify'](_0x1a8a5e));if(_0x1a8a5e['error']){if(_0x1a8a5e[_0x52ed('0xd')]['code']===0x1f4){logger[_0x52ed('0xd')](_0x52ed('0xa'),_0x4208b3,_0x1a8a5e['error']['message']);return _0x1a43c1(_0x1a8a5e[_0x52ed('0xd')][_0x52ed('0xe')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4208b3,_0x1a8a5e[_0x52ed('0xd')]['message']);return _0x2e80ca(_0x1a8a5e['error'][_0x52ed('0xe')]);}else{logger[_0x52ed('0xf')](_0x52ed('0xa'),_0x4208b3,_0x52ed('0xb'));_0x2e80ca(_0x1a8a5e[_0x52ed('0x10')][_0x52ed('0xe')]);}})[_0x52ed('0x11')](function(_0x4a2dff){logger['error'](_0x52ed('0xa'),_0x4208b3,_0x4a2dff);_0x1a43c1(_0x4a2dff);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index fad53c5..df4319b 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 _0x0835=['post','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','show'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x0835,0x135));var _0x5083=function(_0x24d849,_0x463371){_0x24d849=_0x24d849-0x0;var _0x18dc81=_0x0835[_0x24d849];return _0x18dc81;};'use strict';var multer=require(_0x5083('0x0'));var util=require(_0x5083('0x1'));var path=require(_0x5083('0x2'));var timeout=require(_0x5083('0x3'));var express=require(_0x5083('0x4'));var router=express[_0x5083('0x5')]();var auth=require(_0x5083('0x6'));var interaction=require(_0x5083('0x7'));var config=require(_0x5083('0x8'));var controller=require(_0x5083('0x9'));router['get']('/',auth[_0x5083('0xa')](),controller[_0x5083('0xb')]);router[_0x5083('0xc')]('/:id',auth[_0x5083('0xa')](),controller[_0x5083('0xd')]);router[_0x5083('0xe')]('/',auth[_0x5083('0xa')](),controller[_0x5083('0xf')]);router['put'](_0x5083('0x10'),auth['isAuthenticated'](),controller[_0x5083('0x11')]);router[_0x5083('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1d90=['isAuthenticated','/:id','post','put','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get'];(function(_0x22da40,_0x161ae2){var _0x4f062f=function(_0x39a577){while(--_0x39a577){_0x22da40['push'](_0x22da40['shift']());}};_0x4f062f(++_0x161ae2);}(_0x1d90,0x13e));var _0x01d9=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x1d90[_0x4dae00];return _0x16bf42;};'use strict';var multer=require(_0x01d9('0x0'));var util=require('util');var path=require(_0x01d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x01d9('0x2'));var router=express['Router']();var auth=require(_0x01d9('0x3'));var interaction=require(_0x01d9('0x4'));var config=require('../../config/environment');var controller=require(_0x01d9('0x5'));router[_0x01d9('0x6')]('/',auth[_0x01d9('0x7')](),controller['index']);router[_0x01d9('0x6')](_0x01d9('0x8'),auth[_0x01d9('0x7')](),controller['show']);router[_0x01d9('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01d9('0xa')](_0x01d9('0x8'),auth[_0x01d9('0x7')](),controller['update']);router[_0x01d9('0xb')](_0x01d9('0x8'),auth[_0x01d9('0x7')](),controller['destroy']);module[_0x01d9('0xc')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f10ada4..3edf8a5 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 _0x0d4d=['ENUM','string','variable','customVariable','STRING','sequelize','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d4d,0x132));var _0xd0d4=function(_0x5c4a85,_0x15525e){_0x5c4a85=_0x5c4a85-0x0;var _0x3b7dc5=_0x0d4d[_0x5c4a85];return _0x3b7dc5;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'type':{'type':Sequelize[_0xd0d4('0x2')](_0xd0d4('0x3'),_0xd0d4('0x4'),_0xd0d4('0x5'),'keyValue'),'defaultValue':_0xd0d4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd0d4('0x6')]},'keyType':{'type':Sequelize[_0xd0d4('0x2')]('string',_0xd0d4('0x4'),_0xd0d4('0x5'))},'keyContent':{'type':Sequelize[_0xd0d4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd0d4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd0d4('0x6')]}}; \ No newline at end of file +var _0x795a=['STRING','BOOLEAN','exports','ENUM','variable','keyValue','string','customVariable'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x795a,0xa2));var _0xa795=function(_0xbd911d,_0x186344){_0xbd911d=_0xbd911d-0x0;var _0x397b52=_0x795a[_0xbd911d];return _0x397b52;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'type':{'type':Sequelize[_0xa795('0x1')]('string',_0xa795('0x2'),'customVariable',_0xa795('0x3')),'defaultValue':_0xa795('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa795('0x1')](_0xa795('0x4'),_0xa795('0x2'),_0xa795('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa795('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa795('0x7')],'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 0becd9f..98da479 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 _0x687b=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','rawAttributes','length','create','body','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerField','type','key'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x687b,0x14a));var _0xb687=function(_0x5b19ae,_0x2fef9e){_0x5b19ae=_0x5b19ae-0x0;var _0x367f6a=_0x687b[_0x5b19ae];return _0x367f6a;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=_0x141375['count'],_0x2c7a18=_0x30622f[_0xb687('0x1f')],_0x25124a=_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x20')],_0x19bb29;if(_0x25124a>=_0x263085){_0x25124a=_0x263085;_0x19bb29=0xc8;}else{_0x19bb29=0xce;}_0x3ab914['status'](_0x19bb29);return _0x3ab914['set'](_0xb687('0x21'),_0x2c7a18+'-'+_0x25124a+'/'+_0x263085)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x19ee14){return function(_0x4b593b){try{jsonpatch[_0xb687('0x22')](_0x4b593b,_0x19ee14,!![]);}catch(_0x481f1d){return BPromise[_0xb687('0x23')](_0x481f1d);}return _0x4b593b[_0xb687('0x24')]();};}function saveUpdates(_0x170dc0,_0x44bd0b){return function(_0x49d5a1){if(_0x49d5a1){return _0x49d5a1[_0xb687('0x25')](_0x170dc0)['then'](function(_0x335541){return _0x335541;});}return null;};}function removeEntity(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x26')]()[_0xb687('0x27')](function(){_0x90e892[_0xb687('0x1d')](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0xbf6c58,_0x38866c){return function(_0xf48ba4){if(!_0xf48ba4){_0xbf6c58[_0xb687('0x1c')](0x194);}return _0xf48ba4;};}function handleError(_0x57cd51,_0xf45db0){_0xf45db0=_0xf45db0||0x1f4;return function(_0x129347){logger[_0xb687('0x29')](_0x129347[_0xb687('0x2a')]);if(_0x129347[_0xb687('0x2b')]){delete _0x129347[_0xb687('0x2b')];}_0x57cd51[_0xb687('0x1d')](_0xf45db0)[_0xb687('0x2c')](_0x129347);};}exports[_0xb687('0x2d')]=function(_0x2e6185,_0x4a61ec){var _0x3712cf={},_0x192966={},_0x392721={'count':0x0,'rows':[]};var _0x265a4b=_[_0xb687('0x2e')](db[_0xb687('0x2f')]['rawAttributes'],function(_0x28b69a){return{'name':_0x28b69a['fieldName'],'type':_0x28b69a[_0xb687('0x30')][_0xb687('0x31')]};});_0x192966[_0xb687('0x32')]=_[_0xb687('0x2e')](_0x265a4b,_0xb687('0x2b'));_0x192966[_0xb687('0x33')]=_[_0xb687('0x34')](_0x2e6185['query']);_0x192966[_0xb687('0x35')]=_[_0xb687('0x36')](_0x192966[_0xb687('0x32')],_0x192966[_0xb687('0x33')]);_0x3712cf[_0xb687('0x37')]=_[_0xb687('0x36')](_0x192966[_0xb687('0x32')],qs[_0xb687('0x38')](_0x2e6185[_0xb687('0x33')][_0xb687('0x38')]));_0x3712cf[_0xb687('0x37')]=_0x3712cf['attributes']['length']?_0x3712cf[_0xb687('0x37')]:_0x192966[_0xb687('0x32')];if(!_0x2e6185[_0xb687('0x33')][_0xb687('0x39')]('nolimit')){_0x3712cf['limit']=qs[_0xb687('0x20')](_0x2e6185[_0xb687('0x33')]['limit']);_0x3712cf[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e6185['query'][_0xb687('0x1f')]);}_0x3712cf['order']=qs[_0xb687('0x3a')](_0x2e6185[_0xb687('0x33')][_0xb687('0x3a')]);_0x3712cf[_0xb687('0x3b')]=qs[_0xb687('0x35')](_[_0xb687('0x3c')](_0x2e6185['query'],_0x192966[_0xb687('0x35')]),_0x265a4b);if(_0x2e6185[_0xb687('0x33')][_0xb687('0x3d')]){_0x3712cf[_0xb687('0x3b')]=_['merge'](_0x3712cf[_0xb687('0x3b')],{'$or':_[_0xb687('0x2e')](_0x265a4b,function(_0x1f1c88){if(_0x1f1c88[_0xb687('0x30')]!==_0xb687('0x3e')){var _0x58c214={};_0x58c214[_0x1f1c88[_0xb687('0x2b')]]={'$like':'%'+_0x2e6185[_0xb687('0x33')][_0xb687('0x3d')]+'%'};return _0x58c214;}})});}_0x3712cf=_[_0xb687('0x3f')]({},_0x3712cf,_0x2e6185[_0xb687('0x40')]);var _0x29cf09={'where':_0x3712cf['where']};return db['VtigerField'][_0xb687('0x41')](_0x29cf09)['then'](function(_0x1f919f){_0x392721[_0xb687('0x41')]=_0x1f919f;if(_0x2e6185['query'][_0xb687('0x42')]){_0x3712cf[_0xb687('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0xb687('0x44')](_0x3712cf);})[_0xb687('0x27')](function(_0x127b25){_0x392721['rows']=_0x127b25;return _0x392721;})[_0xb687('0x27')](respondWithFilteredResult(_0x4a61ec,_0x3712cf))[_0xb687('0x45')](handleError(_0x4a61ec,null));};exports[_0xb687('0x46')]=function(_0x75102a,_0x140388){var _0x1375f7={'raw':!![],'where':{'id':_0x75102a['params']['id']}},_0x21b9ef={};_0x21b9ef[_0xb687('0x32')]=_['keys'](db['VtigerField'][_0xb687('0x47')]);_0x21b9ef[_0xb687('0x33')]=_['keys'](_0x75102a[_0xb687('0x33')]);_0x21b9ef['filters']=_[_0xb687('0x36')](_0x21b9ef[_0xb687('0x32')],_0x21b9ef['query']);_0x1375f7[_0xb687('0x37')]=_[_0xb687('0x36')](_0x21b9ef['model'],qs[_0xb687('0x38')](_0x75102a[_0xb687('0x33')][_0xb687('0x38')]));_0x1375f7[_0xb687('0x37')]=_0x1375f7[_0xb687('0x37')][_0xb687('0x48')]?_0x1375f7[_0xb687('0x37')]:_0x21b9ef[_0xb687('0x32')];if(_0x75102a[_0xb687('0x33')][_0xb687('0x42')]){_0x1375f7[_0xb687('0x43')]=[{'all':!![]}];}_0x1375f7=_[_0xb687('0x3f')]({},_0x1375f7,_0x75102a['options']);return db[_0xb687('0x2f')]['find'](_0x1375f7)[_0xb687('0x27')](handleEntityNotFound(_0x140388,null))[_0xb687('0x27')](respondWithResult(_0x140388,null))[_0xb687('0x45')](handleError(_0x140388,null));};exports[_0xb687('0x49')]=function(_0x113b76,_0x3ff178){return db['VtigerField']['create'](_0x113b76[_0xb687('0x4a')],{})[_0xb687('0x27')](respondWithResult(_0x3ff178,0xc9))[_0xb687('0x45')](handleError(_0x3ff178,null));};exports[_0xb687('0x25')]=function(_0x4f5736,_0x3b5f2d){if(_0x4f5736[_0xb687('0x4a')]['id']){delete _0x4f5736[_0xb687('0x4a')]['id'];}return db[_0xb687('0x2f')]['find']({'where':{'id':_0x4f5736[_0xb687('0x4b')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x3b5f2d,null))[_0xb687('0x27')](saveUpdates(_0x4f5736[_0xb687('0x4a')],null))['then'](respondWithResult(_0x3b5f2d,null))['catch'](handleError(_0x3b5f2d,null));};exports[_0xb687('0x26')]=function(_0x170b26,_0x42b61a){return db['VtigerField']['find']({'where':{'id':_0x170b26[_0xb687('0x4b')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x42b61a,null))[_0xb687('0x27')](removeEntity(_0x42b61a,null))[_0xb687('0x45')](handleError(_0x42b61a,null));}; \ No newline at end of file +var _0x7278=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1bbc16,_0x3f3430){var _0xc3f106=function(_0x5383bd){while(--_0x5383bd){_0x1bbc16['push'](_0x1bbc16['shift']());}};_0xc3f106(++_0x3f3430);}(_0x7278,0x161));var _0x8727=function(_0x2c31bf,_0x3b33b6){_0x2c31bf=_0x2c31bf-0x0;var _0x505147=_0x7278[_0x2c31bf];return _0x505147;};'use strict';var pdf=require(_0x8727('0x0'));var emlformat=require(_0x8727('0x1'));var rimraf=require(_0x8727('0x2'));var zipdir=require(_0x8727('0x3'));var jsonpatch=require(_0x8727('0x4'));var rp=require('request-promise');var moment=require(_0x8727('0x5'));var BPromise=require(_0x8727('0x6'));var Mustache=require(_0x8727('0x7'));var util=require(_0x8727('0x8'));var path=require(_0x8727('0x9'));var sox=require(_0x8727('0xa'));var csv=require(_0x8727('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];function respondWithStatusCode(_0x176389,_0x518e56){_0x518e56=_0x518e56||0xcc;return function(_0x22d03d){if(_0x22d03d){return _0x176389[_0x8727('0x1b')](_0x518e56);}return _0x176389['status'](_0x518e56)[_0x8727('0x1c')]();};}function respondWithResult(_0x3aa1b,_0x47c29d){_0x47c29d=_0x47c29d||0xc8;return function(_0x2185e5){if(_0x2185e5){return _0x3aa1b[_0x8727('0x1d')](_0x47c29d)[_0x8727('0x1e')](_0x2185e5);}};}function respondWithFilteredResult(_0x3865e9,_0x1916f7){return function(_0x11c828){if(_0x11c828){var _0x88857c=_0x11c828[_0x8727('0x1f')],_0x4842a0=_0x1916f7[_0x8727('0x20')],_0x17baba=_0x1916f7[_0x8727('0x20')]+_0x1916f7[_0x8727('0x21')],_0x1f9538;if(_0x17baba>=_0x88857c){_0x17baba=_0x88857c;_0x1f9538=0xc8;}else{_0x1f9538=0xce;}_0x3865e9['status'](_0x1f9538);return _0x3865e9['set'](_0x8727('0x22'),_0x4842a0+'-'+_0x17baba+'/'+_0x88857c)['json'](_0x11c828);}return null;};}function patchUpdates(_0x28b10f){return function(_0xfd266f){try{jsonpatch[_0x8727('0x23')](_0xfd266f,_0x28b10f,!![]);}catch(_0x22e6c9){return BPromise[_0x8727('0x24')](_0x22e6c9);}return _0xfd266f['save']();};}function saveUpdates(_0x6e552f,_0x286856){return function(_0x8cde82){if(_0x8cde82){return _0x8cde82[_0x8727('0x25')](_0x6e552f)[_0x8727('0x26')](function(_0x3140e8){return _0x3140e8;});}return null;};}function removeEntity(_0x46d43e,_0x441cc0){return function(_0x117f58){if(_0x117f58){return _0x117f58[_0x8727('0x27')]()[_0x8727('0x26')](function(){_0x46d43e[_0x8727('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464a32,_0x3d3592){return function(_0x4c468d){if(!_0x4c468d){_0x464a32['sendStatus'](0x194);}return _0x4c468d;};}function handleError(_0x3df7f2,_0x318684){_0x318684=_0x318684||0x1f4;return function(_0x15e8bf){logger['error'](_0x15e8bf[_0x8727('0x28')]);if(_0x15e8bf[_0x8727('0x29')]){delete _0x15e8bf[_0x8727('0x29')];}_0x3df7f2[_0x8727('0x1d')](_0x318684)[_0x8727('0x2a')](_0x15e8bf);};}exports[_0x8727('0x2b')]=function(_0x262f36,_0xd92f77){var _0x5d03f2={},_0x243f15={},_0x307055={'count':0x0,'rows':[]};var _0x54034d=_[_0x8727('0x2c')](db[_0x8727('0x2d')][_0x8727('0x2e')],function(_0x228ca9){return{'name':_0x228ca9[_0x8727('0x2f')],'type':_0x228ca9[_0x8727('0x30')]['key']};});_0x243f15[_0x8727('0x31')]=_['map'](_0x54034d,_0x8727('0x29'));_0x243f15['query']=_[_0x8727('0x32')](_0x262f36[_0x8727('0x33')]);_0x243f15[_0x8727('0x34')]=_[_0x8727('0x35')](_0x243f15[_0x8727('0x31')],_0x243f15[_0x8727('0x33')]);_0x5d03f2[_0x8727('0x36')]=_['intersection'](_0x243f15[_0x8727('0x31')],qs[_0x8727('0x37')](_0x262f36[_0x8727('0x33')][_0x8727('0x37')]));_0x5d03f2[_0x8727('0x36')]=_0x5d03f2[_0x8727('0x36')][_0x8727('0x38')]?_0x5d03f2[_0x8727('0x36')]:_0x243f15[_0x8727('0x31')];if(!_0x262f36[_0x8727('0x33')][_0x8727('0x39')](_0x8727('0x3a'))){_0x5d03f2['limit']=qs['limit'](_0x262f36[_0x8727('0x33')][_0x8727('0x21')]);_0x5d03f2[_0x8727('0x20')]=qs[_0x8727('0x20')](_0x262f36['query'][_0x8727('0x20')]);}_0x5d03f2[_0x8727('0x3b')]=qs[_0x8727('0x3c')](_0x262f36[_0x8727('0x33')][_0x8727('0x3c')]);_0x5d03f2['where']=qs[_0x8727('0x34')](_[_0x8727('0x3d')](_0x262f36[_0x8727('0x33')],_0x243f15[_0x8727('0x34')]),_0x54034d);if(_0x262f36[_0x8727('0x33')][_0x8727('0x3e')]){_0x5d03f2[_0x8727('0x3f')]=_[_0x8727('0x40')](_0x5d03f2[_0x8727('0x3f')],{'$or':_[_0x8727('0x2c')](_0x54034d,function(_0x396f12){if(_0x396f12[_0x8727('0x30')]!=='VIRTUAL'){var _0x51c66d={};_0x51c66d[_0x396f12[_0x8727('0x29')]]={'$like':'%'+_0x262f36[_0x8727('0x33')][_0x8727('0x3e')]+'%'};return _0x51c66d;}})});}_0x5d03f2=_[_0x8727('0x40')]({},_0x5d03f2,_0x262f36[_0x8727('0x41')]);var _0x308035={'where':_0x5d03f2[_0x8727('0x3f')]};return db[_0x8727('0x2d')][_0x8727('0x1f')](_0x308035)[_0x8727('0x26')](function(_0x1f719e){_0x307055[_0x8727('0x1f')]=_0x1f719e;if(_0x262f36[_0x8727('0x33')]['includeAll']){_0x5d03f2[_0x8727('0x42')]=[{'all':!![]}];}return db[_0x8727('0x2d')][_0x8727('0x43')](_0x5d03f2);})['then'](function(_0x2a506f){_0x307055[_0x8727('0x44')]=_0x2a506f;return _0x307055;})[_0x8727('0x26')](respondWithFilteredResult(_0xd92f77,_0x5d03f2))[_0x8727('0x45')](handleError(_0xd92f77,null));};exports['show']=function(_0x3a2683,_0x37e87c){var _0x1b90e3={'raw':!![],'where':{'id':_0x3a2683[_0x8727('0x46')]['id']}},_0x191fe7={};_0x191fe7[_0x8727('0x31')]=_[_0x8727('0x32')](db[_0x8727('0x2d')][_0x8727('0x2e')]);_0x191fe7[_0x8727('0x33')]=_['keys'](_0x3a2683[_0x8727('0x33')]);_0x191fe7[_0x8727('0x34')]=_[_0x8727('0x35')](_0x191fe7[_0x8727('0x31')],_0x191fe7[_0x8727('0x33')]);_0x1b90e3['attributes']=_[_0x8727('0x35')](_0x191fe7[_0x8727('0x31')],qs[_0x8727('0x37')](_0x3a2683['query'][_0x8727('0x37')]));_0x1b90e3[_0x8727('0x36')]=_0x1b90e3[_0x8727('0x36')][_0x8727('0x38')]?_0x1b90e3[_0x8727('0x36')]:_0x191fe7[_0x8727('0x31')];if(_0x3a2683['query'][_0x8727('0x47')]){_0x1b90e3[_0x8727('0x42')]=[{'all':!![]}];}_0x1b90e3=_[_0x8727('0x40')]({},_0x1b90e3,_0x3a2683['options']);return db[_0x8727('0x2d')][_0x8727('0x48')](_0x1b90e3)[_0x8727('0x26')](handleEntityNotFound(_0x37e87c,null))[_0x8727('0x26')](respondWithResult(_0x37e87c,null))[_0x8727('0x45')](handleError(_0x37e87c,null));};exports[_0x8727('0x49')]=function(_0x39e342,_0x5c875a){return db[_0x8727('0x2d')][_0x8727('0x49')](_0x39e342[_0x8727('0x4a')],{})[_0x8727('0x26')](respondWithResult(_0x5c875a,0xc9))[_0x8727('0x45')](handleError(_0x5c875a,null));};exports[_0x8727('0x25')]=function(_0x34fe5b,_0x5b4388){if(_0x34fe5b[_0x8727('0x4a')]['id']){delete _0x34fe5b[_0x8727('0x4a')]['id'];}return db[_0x8727('0x2d')]['find']({'where':{'id':_0x34fe5b[_0x8727('0x46')]['id']}})[_0x8727('0x26')](handleEntityNotFound(_0x5b4388,null))[_0x8727('0x26')](saveUpdates(_0x34fe5b[_0x8727('0x4a')],null))[_0x8727('0x26')](respondWithResult(_0x5b4388,null))[_0x8727('0x45')](handleError(_0x5b4388,null));};exports[_0x8727('0x27')]=function(_0x53f6c2,_0x23c2e8){return db['VtigerField'][_0x8727('0x48')]({'where':{'id':_0x53f6c2[_0x8727('0x46')]['id']}})['then'](handleEntityNotFound(_0x23c2e8,null))[_0x8727('0x26')](removeEntity(_0x23c2e8,null))[_0x8727('0x45')](handleError(_0x23c2e8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c3a7f18..9ec7453 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x563bd8,_0x202f13){var _0x1e7a7d=function(_0x5f04d3){while(--_0x5f04d3){_0x563bd8['push'](_0x563bd8['shift']());}};_0x1e7a7d(++_0x202f13);}(_0x7a54,0x106));var _0x47a5=function(_0x4983ae,_0x1cdc50){_0x4983ae=_0x4983ae-0x0;var _0x1d3fc8=_0x7a54[_0x4983ae];return _0x1d3fc8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xec2967,_0x21e203){var _0x201a6f=function(_0x12a6de){while(--_0x12a6de){_0xec2967['push'](_0xec2967['shift']());}};_0x201a6f(++_0x21e203);}(_0x7a54,0x106));var _0x47a5=function(_0x10e1a7,_0x2b86b0){_0x10e1a7=_0x10e1a7-0x0;var _0x27e10d=_0x7a54[_0x10e1a7];return _0x27e10d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index fa7202d..5e9eb84 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 _0x151b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x45d1a6,_0xeb5de6){var _0x11827c=function(_0x14be55){while(--_0x14be55){_0x45d1a6['push'](_0x45d1a6['shift']());}};_0x11827c(++_0xeb5de6);}(_0x151b,0x153));var _0xb151=function(_0x3c2bf2,_0x3db107){_0x3c2bf2=_0x3c2bf2-0x0;var _0x394f58=_0x151b[_0x3c2bf2];return _0x394f58;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb151('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb151('0x2'));var db=require(_0xb151('0x3'))['db'];var utils=require(_0xb151('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb151('0x5'));var jayson=require(_0xb151('0x6'));var client=jayson['client'][_0xb151('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ba994,_0xd89657,_0x352713){return new BPromise(function(_0x46fdb0,_0x484caf){return client['request'](_0x4ba994,_0x352713)[_0xb151('0x8')](function(_0x20f1b2){logger['info']('VtigerField,\x20%s,\x20%s',_0xd89657,_0xb151('0x9'));logger[_0xb151('0xa')](_0xb151('0xb'),_0xd89657,_0xb151('0x9'),JSON[_0xb151('0xc')](_0x20f1b2));if(_0x20f1b2[_0xb151('0xd')]){if(_0x20f1b2[_0xb151('0xd')][_0xb151('0xe')]===0x1f4){logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2['error'][_0xb151('0x10')]);return _0x484caf(_0x20f1b2['error'][_0xb151('0x10')]);}logger[_0xb151('0xd')](_0xb151('0xf'),_0xd89657,_0x20f1b2[_0xb151('0xd')]['message']);return _0x46fdb0(_0x20f1b2[_0xb151('0xd')][_0xb151('0x10')]);}else{logger[_0xb151('0x11')]('VtigerField,\x20%s,\x20%s',_0xd89657,'request\x20sent');_0x46fdb0(_0x20f1b2[_0xb151('0x12')]['message']);}})[_0xb151('0x13')](function(_0x4ca435){logger[_0xb151('0xd')]('VtigerField,\x20%s,\x20%s',_0xd89657,_0x4ca435);_0x484caf(_0x4ca435);});});} \ No newline at end of file +var _0x215d=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x215d,0x187));var _0xd215=function(_0x42b829,_0xb15243){_0x42b829=_0x42b829-0x0;var _0x32759d=_0x215d[_0x42b829];return _0x32759d;};'use strict';var _=require(_0xd215('0x0'));var util=require('util');var moment=require(_0xd215('0x1'));var BPromise=require(_0xd215('0x2'));var rs=require(_0xd215('0x3'));var fs=require('fs');var Redis=require(_0xd215('0x4'));var db=require(_0xd215('0x5'))['db'];var utils=require(_0xd215('0x6'));var logger=require('../../config/logger')(_0xd215('0x7'));var config=require('../../config/environment');var jayson=require(_0xd215('0x8'));var client=jayson[_0xd215('0x9')][_0xd215('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6d12,_0xc5d7fe,_0x4e2c85){return new BPromise(function(_0x1ab6c8,_0x28885f){return client[_0xd215('0xb')](_0x5a6d12,_0x4e2c85)['then'](function(_0x184b3f){logger[_0xd215('0xc')](_0xd215('0xd'),_0xc5d7fe,_0xd215('0xe'));logger[_0xd215('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0xc5d7fe,_0xd215('0xe'),JSON[_0xd215('0x10')](_0x184b3f));if(_0x184b3f[_0xd215('0x11')]){if(_0x184b3f['error'][_0xd215('0x12')]===0x1f4){logger[_0xd215('0x11')](_0xd215('0xd'),_0xc5d7fe,_0x184b3f[_0xd215('0x11')][_0xd215('0x13')]);return _0x28885f(_0x184b3f['error'][_0xd215('0x13')]);}logger[_0xd215('0x11')](_0xd215('0xd'),_0xc5d7fe,_0x184b3f[_0xd215('0x11')][_0xd215('0x13')]);return _0x1ab6c8(_0x184b3f[_0xd215('0x11')][_0xd215('0x13')]);}else{logger[_0xd215('0xc')]('VtigerField,\x20%s,\x20%s',_0xc5d7fe,_0xd215('0xe'));_0x1ab6c8(_0x184b3f[_0xd215('0x14')][_0xd215('0x13')]);}})[_0xd215('0x15')](function(_0x6587f1){logger[_0xd215('0x11')](_0xd215('0xd'),_0xc5d7fe,_0x6587f1);_0x28885f(_0x6587f1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1e26cce..a945e98 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 _0x1978=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id'];(function(_0x515534,_0x5a08e6){var _0x3e4e10=function(_0x31b74){while(--_0x31b74){_0x515534['push'](_0x515534['shift']());}};_0x3e4e10(++_0x5a08e6);}(_0x1978,0x174));var _0x8197=function(_0x4cee27,_0x232dea){_0x4cee27=_0x4cee27-0x0;var _0x125a1b=_0x1978[_0x4cee27];return _0x125a1b;};'use strict';var multer=require('multer');var util=require(_0x8197('0x0'));var path=require(_0x8197('0x1'));var timeout=require(_0x8197('0x2'));var express=require(_0x8197('0x3'));var router=express[_0x8197('0x4')]();var auth=require(_0x8197('0x5'));var interaction=require(_0x8197('0x6'));var config=require(_0x8197('0x7'));var controller=require(_0x8197('0x8'));router[_0x8197('0x9')]('/',auth['isAuthenticated'](),controller[_0x8197('0xa')]);router[_0x8197('0x9')](_0x8197('0xb'),auth[_0x8197('0xc')](),controller[_0x8197('0xd')]);router[_0x8197('0x9')](_0x8197('0xe'),auth[_0x8197('0xc')](),controller[_0x8197('0xf')]);router[_0x8197('0x9')](_0x8197('0x10'),auth[_0x8197('0xc')](),controller[_0x8197('0x11')]);router[_0x8197('0x12')]('/',auth[_0x8197('0xc')](),controller['create']);router[_0x8197('0x12')](_0x8197('0xe'),auth[_0x8197('0xc')](),controller[_0x8197('0x13')]);router[_0x8197('0x14')](_0x8197('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8197('0x15')](_0x8197('0xb'),auth[_0x8197('0xc')](),controller[_0x8197('0x16')]);module[_0x8197('0x17')]=router; \ No newline at end of file +var _0x8bf7=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','update','delete','destroy'];(function(_0x357342,_0x2d2e1b){var _0x43e89e=function(_0x5c06e9){while(--_0x5c06e9){_0x357342['push'](_0x357342['shift']());}};_0x43e89e(++_0x2d2e1b);}(_0x8bf7,0x139));var _0x78bf=function(_0x20ac5f,_0x2a961a){_0x20ac5f=_0x20ac5f-0x0;var _0x4c91e1=_0x8bf7[_0x20ac5f];return _0x4c91e1;};'use strict';var multer=require(_0x78bf('0x0'));var util=require(_0x78bf('0x1'));var path=require(_0x78bf('0x2'));var timeout=require('connect-timeout');var express=require(_0x78bf('0x3'));var router=express[_0x78bf('0x4')]();var auth=require(_0x78bf('0x5'));var interaction=require(_0x78bf('0x6'));var config=require(_0x78bf('0x7'));var controller=require(_0x78bf('0x8'));router[_0x78bf('0x9')]('/',auth[_0x78bf('0xa')](),controller[_0x78bf('0xb')]);router[_0x78bf('0x9')](_0x78bf('0xc'),auth[_0x78bf('0xa')](),controller[_0x78bf('0xd')]);router[_0x78bf('0x9')](_0x78bf('0xe'),auth[_0x78bf('0xa')](),controller[_0x78bf('0xf')]);router[_0x78bf('0x9')](_0x78bf('0x10'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x78bf('0xa')](),controller[_0x78bf('0x11')]);router[_0x78bf('0x12')](_0x78bf('0xe'),auth[_0x78bf('0xa')](),controller['addConfiguration']);router[_0x78bf('0x13')]('/:id',auth[_0x78bf('0xa')](),controller[_0x78bf('0x14')]);router[_0x78bf('0x15')](_0x78bf('0xc'),auth[_0x78bf('0xa')](),controller[_0x78bf('0x16')]);module[_0x78bf('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 1ad3f74..bf0da4a 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 _0x3c1a=['ENUM','password','token','integrationTab','sequelize','exports','STRING','remoteUri'];(function(_0xbbc57,_0x3eed41){var _0x1fd5c4=function(_0x3a6d30){while(--_0x3a6d30){_0xbbc57['push'](_0xbbc57['shift']());}};_0x1fd5c4(++_0x3eed41);}(_0x3c1a,0x13c));var _0xa3c1=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x3c1a[_0x2ff739];return _0x12dc13;};'use strict';var Sequelize=require(_0xa3c1('0x0'));module[_0xa3c1('0x1')]={'name':{'type':Sequelize[_0xa3c1('0x2')]},'description':{'type':Sequelize[_0xa3c1('0x2')]},'username':{'type':Sequelize[_0xa3c1('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa3c1('0x2')]},'token':{'type':Sequelize[_0xa3c1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa3c1('0x3')},'authType':{'type':Sequelize[_0xa3c1('0x4')](_0xa3c1('0x5'),_0xa3c1('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa3c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa3c1('0x4')](_0xa3c1('0x7'),'newTab'),'defaultValue':_0xa3c1('0x7')}}; \ No newline at end of file +var _0x42d1=['token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x5dcd66,_0x2bb299){var _0x3d45d0=function(_0x1509b5){while(--_0x1509b5){_0x5dcd66['push'](_0x5dcd66['shift']());}};_0x3d45d0(++_0x2bb299);}(_0x42d1,0xd2));var _0x142d=function(_0x157527,_0x41f908){_0x157527=_0x157527-0x0;var _0x2d56a1=_0x42d1[_0x157527];return _0x2d56a1;};'use strict';var Sequelize=require(_0x142d('0x0'));module['exports']={'name':{'type':Sequelize[_0x142d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x142d('0x1')],'unique':_0x142d('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x142d('0x1')],'unique':_0x142d('0x3')},'authType':{'type':Sequelize[_0x142d('0x4')](_0x142d('0x5'),_0x142d('0x6')),'defaultValue':_0x142d('0x5')},'serverUrl':{'type':Sequelize[_0x142d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x142d('0x7'),_0x142d('0x8')),'defaultValue':_0x142d('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d27054b..fb90ff0 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 _0x566f=['getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','slice','substring','lastIndexOf','GET','format','ticket_fields','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','json','reject','save','destroy','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','options','include','rows','show','params','keys','includeAll','find','create','body','update','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions'];(function(_0x47edd1,_0x48a6c1){var _0x440a11=function(_0x46ce0){while(--_0x46ce0){_0x47edd1['push'](_0x47edd1['shift']());}};_0x440a11(++_0x48a6c1);}(_0x566f,0x124));var _0xf566=function(_0x372d9b,_0x475a22){_0x372d9b=_0x372d9b-0x0;var _0x553f17=_0x566f[_0x372d9b];return _0x553f17;};'use strict';var pdf=require(_0xf566('0x0'));var emlformat=require(_0xf566('0x1'));var rimraf=require(_0xf566('0x2'));var zipdir=require(_0xf566('0x3'));var jsonpatch=require(_0xf566('0x4'));var rp=require(_0xf566('0x5'));var moment=require(_0xf566('0x6'));var BPromise=require(_0xf566('0x7'));var Mustache=require('mustache');var util=require(_0xf566('0x8'));var path=require(_0xf566('0x9'));var sox=require(_0xf566('0xa'));var csv=require(_0xf566('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf566('0xc'));var squel=require(_0xf566('0xd'));var crypto=require(_0xf566('0xe'));var jsforce=require(_0xf566('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf566('0xb'));var querystring=require('querystring');var Papa=require(_0xf566('0x10'));var Redis=require(_0xf566('0x11'));var authService=require(_0xf566('0x12'));var qs=require(_0xf566('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf566('0x14'));var logger=require(_0xf566('0x15'))(_0xf566('0x16'));var utils=require(_0xf566('0x17'));var config=require(_0xf566('0x18'));var licenseUtil=require(_0xf566('0x19'));var db=require(_0xf566('0x1a'))['db'];var integrations=require(_0xf566('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0xf566('0x1c')][_0xf566('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1ed8ab,_0x2a1b61,_0x5acc16,_0x3ed87f){return new BPromise(function(_0x591484,_0x58a073){var _0x1bce97=_0x3ed87f||client;return _0x1bce97[_0xf566('0x1e')](_0x1ed8ab,_0x5acc16)['then'](function(_0xc3f761){logger[_0xf566('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x2a1b61,_0xf566('0x20'));logger['debug'](_0xf566('0x21'),_0x2a1b61,'request\x20sent',JSON[_0xf566('0x22')](_0xc3f761));if(_0xc3f761[_0xf566('0x23')]){if(_0xc3f761['error'][_0xf566('0x24')]===0x1f4){logger[_0xf566('0x23')](_0xf566('0x25'),_0x2a1b61,_0xc3f761[_0xf566('0x23')]['message']);return _0x58a073(_0xc3f761[_0xf566('0x23')][_0xf566('0x26')]);}logger[_0xf566('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2a1b61,_0xc3f761[_0xf566('0x23')][_0xf566('0x26')]);return _0x591484(_0xc3f761[_0xf566('0x23')][_0xf566('0x26')]);}else{logger[_0xf566('0x1f')](_0xf566('0x25'),_0x2a1b61,_0xf566('0x20'));_0x591484(_0xc3f761[_0xf566('0x27')][_0xf566('0x26')]);}})[_0xf566('0x28')](function(_0x139484){logger['error'](_0xf566('0x25'),_0x2a1b61,_0x139484);_0x58a073(_0x139484);});});}function respondWithStatusCode(_0x3ae555,_0x54a2c8){_0x54a2c8=_0x54a2c8||0xcc;return function(_0x11a476){if(_0x11a476){return _0x3ae555[_0xf566('0x29')](_0x54a2c8);}return _0x3ae555[_0xf566('0x2a')](_0x54a2c8)[_0xf566('0x2b')]();};}function respondWithResult(_0x100ad3,_0x11e997){_0x11e997=_0x11e997||0xc8;return function(_0x2da964){if(_0x2da964){return _0x100ad3['status'](_0x11e997)['json'](_0x2da964);}};}function respondWithFilteredResult(_0xde2d8c,_0x368fa0){return function(_0x43d842){if(_0x43d842){var _0x232c9d=_0x43d842[_0xf566('0x2c')],_0x27bbb2=_0x368fa0[_0xf566('0x2d')],_0x1ae085=_0x368fa0[_0xf566('0x2d')]+_0x368fa0['limit'],_0x4f61ea;if(_0x1ae085>=_0x232c9d){_0x1ae085=_0x232c9d;_0x4f61ea=0xc8;}else{_0x4f61ea=0xce;}_0xde2d8c[_0xf566('0x2a')](_0x4f61ea);return _0xde2d8c[_0xf566('0x2e')]('Content-Range',_0x27bbb2+'-'+_0x1ae085+'/'+_0x232c9d)[_0xf566('0x2f')](_0x43d842);}return null;};}function patchUpdates(_0x3d7a02){return function(_0x75e8ab){try{jsonpatch['apply'](_0x75e8ab,_0x3d7a02,!![]);}catch(_0x44fbcc){return BPromise[_0xf566('0x30')](_0x44fbcc);}return _0x75e8ab[_0xf566('0x31')]();};}function saveUpdates(_0x5a5001,_0x3f885d){return function(_0x41a7ab){if(_0x41a7ab){return _0x41a7ab['update'](_0x5a5001)['then'](function(_0xb9d293){return _0xb9d293;});}return null;};}function removeEntity(_0x23d328,_0x2043f2){return function(_0x2a1026){if(_0x2a1026){return _0x2a1026[_0xf566('0x32')]()[_0xf566('0x33')](function(){_0x23d328[_0xf566('0x2a')](0xcc)[_0xf566('0x2b')]();});}};}function handleEntityNotFound(_0x2d7de5,_0x3e1af1){return function(_0x4cf6ea){if(!_0x4cf6ea){_0x2d7de5[_0xf566('0x29')](0x194);}return _0x4cf6ea;};}function handleError(_0x4b53dc,_0xb2e6c3){_0xb2e6c3=_0xb2e6c3||0x1f4;return function(_0x2751ff){logger[_0xf566('0x23')](_0x2751ff[_0xf566('0x34')]);if(_0x2751ff[_0xf566('0x35')]){delete _0x2751ff[_0xf566('0x35')];}_0x4b53dc[_0xf566('0x2a')](_0xb2e6c3)[_0xf566('0x36')](_0x2751ff);};}exports[_0xf566('0x37')]=function(_0x3f93c2,_0x385fd1){var _0x7984e2={},_0xa27799={},_0x44424b={'count':0x0,'rows':[]};var _0x3d77e5=_[_0xf566('0x38')](db[_0xf566('0x39')][_0xf566('0x3a')],function(_0x134bf4){return{'name':_0x134bf4[_0xf566('0x3b')],'type':_0x134bf4[_0xf566('0x3c')][_0xf566('0x3d')]};});_0xa27799[_0xf566('0x3e')]=_['map'](_0x3d77e5,_0xf566('0x35'));_0xa27799['query']=_['keys'](_0x3f93c2['query']);_0xa27799[_0xf566('0x3f')]=_['intersection'](_0xa27799['model'],_0xa27799[_0xf566('0x40')]);_0x7984e2['attributes']=_[_0xf566('0x41')](_0xa27799['model'],qs[_0xf566('0x42')](_0x3f93c2['query']['fields']));_0x7984e2[_0xf566('0x43')]=_0x7984e2[_0xf566('0x43')][_0xf566('0x44')]?_0x7984e2['attributes']:_0xa27799[_0xf566('0x3e')];if(!_0x3f93c2['query']['hasOwnProperty'](_0xf566('0x45'))){_0x7984e2[_0xf566('0x46')]=qs['limit'](_0x3f93c2[_0xf566('0x40')][_0xf566('0x46')]);_0x7984e2[_0xf566('0x2d')]=qs[_0xf566('0x2d')](_0x3f93c2[_0xf566('0x40')]['offset']);}_0x7984e2['order']=qs[_0xf566('0x47')](_0x3f93c2[_0xf566('0x40')][_0xf566('0x47')]);_0x7984e2[_0xf566('0x48')]=qs['filters'](_[_0xf566('0x49')](_0x3f93c2[_0xf566('0x40')],_0xa27799[_0xf566('0x3f')]),_0x3d77e5);if(_0x3f93c2[_0xf566('0x40')][_0xf566('0x4a')]){_0x7984e2[_0xf566('0x48')]=_['merge'](_0x7984e2[_0xf566('0x48')],{'$or':_[_0xf566('0x38')](_0x3d77e5,function(_0x56bf78){if(_0x56bf78['type']!=='VIRTUAL'){var _0x302e44={};_0x302e44[_0x56bf78[_0xf566('0x35')]]={'$like':'%'+_0x3f93c2[_0xf566('0x40')][_0xf566('0x4a')]+'%'};return _0x302e44;}})});}_0x7984e2=_[_0xf566('0x4b')]({},_0x7984e2,_0x3f93c2[_0xf566('0x4c')]);var _0x560ad4={'where':_0x7984e2[_0xf566('0x48')]};return db['ZendeskAccount'][_0xf566('0x2c')](_0x560ad4)['then'](function(_0x2f31e9){_0x44424b[_0xf566('0x2c')]=_0x2f31e9;if(_0x3f93c2[_0xf566('0x40')]['includeAll']){_0x7984e2[_0xf566('0x4d')]=[{'all':!![]}];}return db[_0xf566('0x39')]['findAll'](_0x7984e2);})[_0xf566('0x33')](function(_0x767343){_0x44424b[_0xf566('0x4e')]=_0x767343;return _0x44424b;})['then'](respondWithFilteredResult(_0x385fd1,_0x7984e2))['catch'](handleError(_0x385fd1,null));};exports[_0xf566('0x4f')]=function(_0x5ca9ab,_0x1af0cb){var _0x4dc6b4={'raw':![],'where':{'id':_0x5ca9ab[_0xf566('0x50')]['id']}},_0xe8c055={};_0xe8c055['model']=_[_0xf566('0x51')](db['ZendeskAccount'][_0xf566('0x3a')]);_0xe8c055[_0xf566('0x40')]=_[_0xf566('0x51')](_0x5ca9ab[_0xf566('0x40')]);_0xe8c055['filters']=_[_0xf566('0x41')](_0xe8c055[_0xf566('0x3e')],_0xe8c055[_0xf566('0x40')]);_0x4dc6b4[_0xf566('0x43')]=_['intersection'](_0xe8c055[_0xf566('0x3e')],qs[_0xf566('0x42')](_0x5ca9ab[_0xf566('0x40')]['fields']));_0x4dc6b4[_0xf566('0x43')]=_0x4dc6b4[_0xf566('0x43')][_0xf566('0x44')]?_0x4dc6b4[_0xf566('0x43')]:_0xe8c055['model'];if(_0x5ca9ab[_0xf566('0x40')][_0xf566('0x52')]){_0x4dc6b4['include']=[{'all':!![]}];}_0x4dc6b4=_[_0xf566('0x4b')]({},_0x4dc6b4,_0x5ca9ab[_0xf566('0x4c')]);return db['ZendeskAccount'][_0xf566('0x53')](_0x4dc6b4)['then'](handleEntityNotFound(_0x1af0cb,null))[_0xf566('0x33')](respondWithResult(_0x1af0cb,null))[_0xf566('0x28')](handleError(_0x1af0cb,null));};exports[_0xf566('0x54')]=function(_0x1a9708,_0x45aaf8){return db[_0xf566('0x39')][_0xf566('0x54')](_0x1a9708[_0xf566('0x55')],{})[_0xf566('0x33')](respondWithResult(_0x45aaf8,0xc9))['catch'](handleError(_0x45aaf8,null));};exports[_0xf566('0x56')]=function(_0x4d077f,_0x345530){if(_0x4d077f[_0xf566('0x55')]['id']){delete _0x4d077f[_0xf566('0x55')]['id'];}return db[_0xf566('0x39')][_0xf566('0x53')]({'where':{'id':_0x4d077f['params']['id']}})['then'](handleEntityNotFound(_0x345530,null))[_0xf566('0x33')](saveUpdates(_0x4d077f['body'],null))['then'](respondWithResult(_0x345530,null))[_0xf566('0x28')](handleError(_0x345530,null));};exports[_0xf566('0x32')]=function(_0x1a5895,_0x52bb1d){return db[_0xf566('0x39')][_0xf566('0x53')]({'where':{'id':_0x1a5895[_0xf566('0x50')]['id']}})['then'](handleEntityNotFound(_0x52bb1d,null))[_0xf566('0x33')](removeEntity(_0x52bb1d,null))['catch'](handleError(_0x52bb1d,null));};exports[_0xf566('0x57')]=function(_0x243354,_0x206a1c,_0x323838){var _0x4a57a9={};var _0x288473={};var _0x240847;var _0x3b8445;return db['ZendeskAccount'][_0xf566('0x58')]({'where':{'id':_0x243354[_0xf566('0x50')]['id']}})[_0xf566('0x33')](handleEntityNotFound(_0x206a1c,null))[_0xf566('0x33')](function(_0x577619){if(_0x577619){_0x240847=_0x577619;_0x288473[_0xf566('0x3e')]=_[_0xf566('0x51')](db['ZendeskConfiguration']['rawAttributes']);_0x288473[_0xf566('0x40')]=_[_0xf566('0x51')](_0x243354['query']);_0x288473['filters']=_[_0xf566('0x41')](_0x288473[_0xf566('0x3e')],_0x288473[_0xf566('0x40')]);_0x4a57a9[_0xf566('0x43')]=_[_0xf566('0x41')](_0x288473['model'],qs[_0xf566('0x42')](_0x243354[_0xf566('0x40')][_0xf566('0x42')]));_0x4a57a9[_0xf566('0x43')]=_0x4a57a9[_0xf566('0x43')][_0xf566('0x44')]?_0x4a57a9['attributes']:_0x288473[_0xf566('0x3e')];_0x4a57a9[_0xf566('0x59')]=qs[_0xf566('0x47')](_0x243354[_0xf566('0x40')][_0xf566('0x47')]);_0x4a57a9[_0xf566('0x48')]=qs['filters'](_[_0xf566('0x49')](_0x243354['query'],_0x288473[_0xf566('0x3f')]));if(_0x243354[_0xf566('0x40')][_0xf566('0x4a')]){_0x4a57a9[_0xf566('0x48')]=_[_0xf566('0x4b')](_0x4a57a9[_0xf566('0x48')],{'$or':_[_0xf566('0x38')](_0x4a57a9[_0xf566('0x43')],function(_0x3d1901){var _0x38bee6={};_0x38bee6[_0x3d1901]={'$like':'%'+_0x243354[_0xf566('0x40')][_0xf566('0x4a')]+'%'};return _0x38bee6;})});}_0x4a57a9=_[_0xf566('0x4b')]({},_0x4a57a9,_0x243354[_0xf566('0x4c')]);return _0x240847['getConfigurations'](_0x4a57a9);}})[_0xf566('0x33')](function(_0x47b4be){if(_0x47b4be){_0x3b8445=_0x47b4be[_0xf566('0x44')];if(!_0x243354[_0xf566('0x40')]['hasOwnProperty'](_0xf566('0x45'))){_0x4a57a9[_0xf566('0x46')]=qs[_0xf566('0x46')](_0x243354[_0xf566('0x40')][_0xf566('0x46')]);_0x4a57a9[_0xf566('0x2d')]=qs[_0xf566('0x2d')](_0x243354[_0xf566('0x40')][_0xf566('0x2d')]);}return _0x240847['getConfigurations'](_0x4a57a9);}})[_0xf566('0x33')](function(_0x3f1e6a){if(_0x3f1e6a){return _0x3f1e6a?{'count':_0x3b8445,'rows':_0x3f1e6a}:null;}})[_0xf566('0x33')](respondWithResult(_0x206a1c,null))[_0xf566('0x28')](handleError(_0x206a1c,null));};exports[_0xf566('0x5a')]=function(_0x11e25c,_0x334f00,_0xe4cd72){if(_0x11e25c['body']['id']){delete _0x11e25c[_0xf566('0x55')]['id'];}return db[_0xf566('0x39')][_0xf566('0x58')]({'where':{'id':_0x11e25c[_0xf566('0x50')]['id']}})[_0xf566('0x33')](handleEntityNotFound(_0x334f00,null))[_0xf566('0x33')](function(_0x329151){if(_0x329151){_0x11e25c[_0xf566('0x55')][_0xf566('0x5b')]=_0x329151['id'];_0x11e25c[_0xf566('0x55')][_0xf566('0x5c')]=integrations[_0xf566('0x5d')](_0x11e25c[_0xf566('0x55')]['channel'],_0x11e25c[_0xf566('0x55')]['type']);_0x11e25c[_0xf566('0x55')][_0xf566('0x5e')]=integrations[_0xf566('0x5f')](_0x11e25c[_0xf566('0x55')]['channel'],_0x11e25c[_0xf566('0x55')][_0xf566('0x3c')]);return db[_0xf566('0x60')][_0xf566('0x54')](_0x11e25c[_0xf566('0x55')],{'include':[{'model':db[_0xf566('0x61')],'as':'Subjects'},{'model':db[_0xf566('0x61')],'as':_0xf566('0x5e')}]});}return null;})['then'](respondWithResult(_0x334f00,null))['catch'](handleError(_0x334f00,null));};exports[_0xf566('0x62')]=function(_0x2d4dea,_0x560328,_0x130c95){var _0x2019ff='';return db[_0xf566('0x39')][_0xf566('0x58')]({'where':{'id':_0x2d4dea[_0xf566('0x50')]['id']},'attributes':['id',_0xf566('0x63'),'password',_0xf566('0x64'),'authType','remoteUri']})[_0xf566('0x33')](handleEntityNotFound(_0x560328,null))['then'](function(_0x377bab){if(_0x377bab){_0x2019ff=_0x377bab['remoteUri'];var _0x73797a=_0x2019ff[_0xf566('0x65')](-0x1);if(_0x73797a==='/'){_0x2019ff=_0x2019ff[_0xf566('0x66')](0x0,_0x2019ff[_0xf566('0x67')](_0x73797a));}var _0x5c5854={'method':_0xf566('0x68'),'uri':util[_0xf566('0x69')]('%s/%s',_0x2019ff,_0xf566('0x6a')),'json':!![]};switch(_0x377bab[_0xf566('0x6b')]){case _0xf566('0x6c'):_0x5c5854[_0xf566('0x6d')]={'Authorization':util[_0xf566('0x69')](_0xf566('0x6e'),new Buffer(util[_0xf566('0x69')](_0xf566('0x6f'),_0x377bab[_0xf566('0x63')],_0x377bab['password']))[_0xf566('0x70')](_0xf566('0x71')))};break;case _0xf566('0x64'):_0x5c5854['headers']={'Authorization':util['format'](_0xf566('0x6e'),new Buffer(util[_0xf566('0x69')]('%s/token:%s',_0x377bab['username'],_0x377bab[_0xf566('0x64')]))[_0xf566('0x70')]('base64'))};break;default:throw new db[(_0xf566('0x72'))]['ValidationError'](_0xf566('0x73'));}return rp(_0x5c5854);}})[_0xf566('0x33')](function(_0x322d00){if(_0x322d00){var _0x4314c9=[_0xf566('0x74'),_0xf566('0x75'),_0xf566('0x76'),_0xf566('0x77')];_[_0xf566('0x78')](_0x322d00['ticket_fields'],function(_0x57a4d1){return _0x4314c9[_0xf566('0x79')](_0x57a4d1[_0xf566('0x3c')]);});return{'count':_0x322d00[_0xf566('0x6a')][_0xf566('0x44')],'rows':_[_0xf566('0x38')](_0x322d00['ticket_fields'],function(_0x52e943){return{'id':_0x52e943['id'],'name':_0x52e943[_0xf566('0x7a')]>0x7?_0x52e943[_0xf566('0x7b')]:_0x52e943[_0xf566('0x3c')],'custom':_0x52e943[_0xf566('0x7a')]>0x7?!![]:![],'options':_0x52e943[_0xf566('0x7c')]?_0x52e943[_0xf566('0x7c')]:_0x52e943[_0xf566('0x7d')]?_0x52e943['custom_field_options']:[]};})};}})[_0xf566('0x33')](respondWithResult(_0x560328,null))[_0xf566('0x28')](function(_0x237d3c){var _0x38aa5b=_0x2d4dea['query'][_0xf566('0x7e')]?0x1f4:_0x237d3c[_0xf566('0x7f')]||0x1f4;logger[_0xf566('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xf566('0x62'),_0x38aa5b,JSON['stringify'](_0x237d3c));delete _0x237d3c[_0xf566('0x35')];if(_0x38aa5b===0x191){_0x38aa5b=0x190;}_0x560328[_0xf566('0x2a')](_0x38aa5b)['send'](_0x2d4dea['query'][_0xf566('0x7e')]?{'message':_0xf566('0x80'),'statusCode':_0x237d3c[_0xf566('0x7f')]}:_0x237d3c);});}; \ No newline at end of file +var _0xd110=['end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','ZendeskAccount','include','options','find','create','body','params','findOne','ZendeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus'];(function(_0x4b3230,_0x1afbb1){var _0x3dde7e=function(_0x251f50){while(--_0x251f50){_0x4b3230['push'](_0x4b3230['shift']());}};_0x3dde7e(++_0x1afbb1);}(_0xd110,0x1e8));var _0x0d11=function(_0x3deeba,_0x5d0e86){_0x3deeba=_0x3deeba-0x0;var _0x252849=_0xd110[_0x3deeba];return _0x252849;};'use strict';var pdf=require(_0x0d11('0x0'));var emlformat=require(_0x0d11('0x1'));var rimraf=require(_0x0d11('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d11('0x3'));var rp=require(_0x0d11('0x4'));var moment=require(_0x0d11('0x5'));var BPromise=require(_0x0d11('0x6'));var Mustache=require(_0x0d11('0x7'));var util=require(_0x0d11('0x8'));var path=require(_0x0d11('0x9'));var sox=require(_0x0d11('0xa'));var csv=require('to-csv');var ejs=require(_0x0d11('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0d11('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d11('0xd'));var toCsv=require(_0x0d11('0xe'));var querystring=require(_0x0d11('0xf'));var Papa=require('papaparse');var Redis=require(_0x0d11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0d11('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d11('0x12'));var logger=require(_0x0d11('0x13'))(_0x0d11('0x14'));var utils=require(_0x0d11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0d11('0x16'));var db=require(_0x0d11('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0d11('0x18'));var client=jayson[_0x0d11('0x19')][_0x0d11('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x53e0c1,_0x45414a,_0x157483,_0x5bea18){return new BPromise(function(_0x119ce7,_0x3c88e6){var _0x266f0f=_0x5bea18||client;return _0x266f0f[_0x0d11('0x1b')](_0x53e0c1,_0x157483)[_0x0d11('0x1c')](function(_0x5b85a7){logger['info'](_0x0d11('0x1d'),_0x45414a,'request\x20sent');logger[_0x0d11('0x1e')](_0x0d11('0x1f'),_0x45414a,'request\x20sent',JSON[_0x0d11('0x20')](_0x5b85a7));if(_0x5b85a7['error']){if(_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x22')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x45414a,_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x23')]);return _0x3c88e6(_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x23')]);}logger[_0x0d11('0x21')](_0x0d11('0x1d'),_0x45414a,_0x5b85a7['error'][_0x0d11('0x23')]);return _0x119ce7(_0x5b85a7[_0x0d11('0x21')][_0x0d11('0x23')]);}else{logger[_0x0d11('0x24')](_0x0d11('0x1d'),_0x45414a,'request\x20sent');_0x119ce7(_0x5b85a7[_0x0d11('0x25')]['message']);}})[_0x0d11('0x26')](function(_0x424255){logger[_0x0d11('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x45414a,_0x424255);_0x3c88e6(_0x424255);});});}function respondWithStatusCode(_0x304f7f,_0xc4c278){_0xc4c278=_0xc4c278||0xcc;return function(_0x4a6839){if(_0x4a6839){return _0x304f7f[_0x0d11('0x27')](_0xc4c278);}return _0x304f7f['status'](_0xc4c278)[_0x0d11('0x28')]();};}function respondWithResult(_0x510bf5,_0x52cb79){_0x52cb79=_0x52cb79||0xc8;return function(_0x1dba11){if(_0x1dba11){return _0x510bf5[_0x0d11('0x29')](_0x52cb79)[_0x0d11('0x2a')](_0x1dba11);}};}function respondWithFilteredResult(_0x2138a0,_0x7be5a3){return function(_0x4cd228){if(_0x4cd228){var _0x21fac5=_0x4cd228[_0x0d11('0x2b')],_0x5c1de3=_0x7be5a3[_0x0d11('0x2c')],_0x25e7fc=_0x7be5a3[_0x0d11('0x2c')]+_0x7be5a3[_0x0d11('0x2d')],_0x5ab7d4;if(_0x25e7fc>=_0x21fac5){_0x25e7fc=_0x21fac5;_0x5ab7d4=0xc8;}else{_0x5ab7d4=0xce;}_0x2138a0[_0x0d11('0x29')](_0x5ab7d4);return _0x2138a0[_0x0d11('0x2e')](_0x0d11('0x2f'),_0x5c1de3+'-'+_0x25e7fc+'/'+_0x21fac5)[_0x0d11('0x2a')](_0x4cd228);}return null;};}function patchUpdates(_0x25abc5){return function(_0x249a7e){try{jsonpatch[_0x0d11('0x30')](_0x249a7e,_0x25abc5,!![]);}catch(_0x26cca8){return BPromise['reject'](_0x26cca8);}return _0x249a7e[_0x0d11('0x31')]();};}function saveUpdates(_0x2b9c83,_0x59b125){return function(_0x44bdf1){if(_0x44bdf1){return _0x44bdf1[_0x0d11('0x32')](_0x2b9c83)[_0x0d11('0x1c')](function(_0x3873ce){return _0x3873ce;});}return null;};}function removeEntity(_0x41ba77,_0x3e3c16){return function(_0x288967){if(_0x288967){return _0x288967[_0x0d11('0x33')]()[_0x0d11('0x1c')](function(){_0x41ba77[_0x0d11('0x29')](0xcc)[_0x0d11('0x28')]();});}};}function handleEntityNotFound(_0x5af801,_0x874c63){return function(_0xfd259c){if(!_0xfd259c){_0x5af801[_0x0d11('0x27')](0x194);}return _0xfd259c;};}function handleError(_0x174bf0,_0x33ad5d){_0x33ad5d=_0x33ad5d||0x1f4;return function(_0x147df5){logger[_0x0d11('0x21')](_0x147df5[_0x0d11('0x34')]);if(_0x147df5[_0x0d11('0x35')]){delete _0x147df5[_0x0d11('0x35')];}_0x174bf0[_0x0d11('0x29')](_0x33ad5d)['send'](_0x147df5);};}exports['index']=function(_0x31ac3d,_0x18c268){var _0x219e80={},_0x1ab49a={},_0x49e90b={'count':0x0,'rows':[]};var _0x360e92=_[_0x0d11('0x36')](db['ZendeskAccount'][_0x0d11('0x37')],function(_0x15e36a){return{'name':_0x15e36a[_0x0d11('0x38')],'type':_0x15e36a[_0x0d11('0x39')][_0x0d11('0x3a')]};});_0x1ab49a[_0x0d11('0x3b')]=_[_0x0d11('0x36')](_0x360e92,_0x0d11('0x35'));_0x1ab49a[_0x0d11('0x3c')]=_[_0x0d11('0x3d')](_0x31ac3d[_0x0d11('0x3c')]);_0x1ab49a[_0x0d11('0x3e')]=_[_0x0d11('0x3f')](_0x1ab49a[_0x0d11('0x3b')],_0x1ab49a[_0x0d11('0x3c')]);_0x219e80['attributes']=_[_0x0d11('0x3f')](_0x1ab49a['model'],qs[_0x0d11('0x40')](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x40')]));_0x219e80[_0x0d11('0x41')]=_0x219e80['attributes'][_0x0d11('0x42')]?_0x219e80[_0x0d11('0x41')]:_0x1ab49a[_0x0d11('0x3b')];if(!_0x31ac3d[_0x0d11('0x3c')]['hasOwnProperty'](_0x0d11('0x43'))){_0x219e80['limit']=qs[_0x0d11('0x2d')](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x2d')]);_0x219e80[_0x0d11('0x2c')]=qs['offset'](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x2c')]);}_0x219e80[_0x0d11('0x44')]=qs['sort'](_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x45')]);_0x219e80[_0x0d11('0x46')]=qs[_0x0d11('0x3e')](_[_0x0d11('0x47')](_0x31ac3d[_0x0d11('0x3c')],_0x1ab49a['filters']),_0x360e92);if(_0x31ac3d[_0x0d11('0x3c')][_0x0d11('0x48')]){_0x219e80[_0x0d11('0x46')]=_[_0x0d11('0x49')](_0x219e80[_0x0d11('0x46')],{'$or':_[_0x0d11('0x36')](_0x360e92,function(_0x12d9b6){if(_0x12d9b6[_0x0d11('0x39')]!==_0x0d11('0x4a')){var _0x32a03e={};_0x32a03e[_0x12d9b6[_0x0d11('0x35')]]={'$like':'%'+_0x31ac3d['query'][_0x0d11('0x48')]+'%'};return _0x32a03e;}})});}_0x219e80=_['merge']({},_0x219e80,_0x31ac3d['options']);var _0x35d77e={'where':_0x219e80['where']};return db['ZendeskAccount'][_0x0d11('0x2b')](_0x35d77e)[_0x0d11('0x1c')](function(_0x1c41f9){_0x49e90b[_0x0d11('0x2b')]=_0x1c41f9;if(_0x31ac3d['query'][_0x0d11('0x4b')]){_0x219e80['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x0d11('0x4c')](_0x219e80);})[_0x0d11('0x1c')](function(_0x26a8c5){_0x49e90b[_0x0d11('0x4d')]=_0x26a8c5;return _0x49e90b;})[_0x0d11('0x1c')](respondWithFilteredResult(_0x18c268,_0x219e80))['catch'](handleError(_0x18c268,null));};exports[_0x0d11('0x4e')]=function(_0x43e69d,_0x4aa73a){var _0x5befcb={'raw':![],'where':{'id':_0x43e69d['params']['id']}},_0x50f941={};_0x50f941[_0x0d11('0x3b')]=_[_0x0d11('0x3d')](db[_0x0d11('0x4f')]['rawAttributes']);_0x50f941['query']=_[_0x0d11('0x3d')](_0x43e69d[_0x0d11('0x3c')]);_0x50f941[_0x0d11('0x3e')]=_[_0x0d11('0x3f')](_0x50f941[_0x0d11('0x3b')],_0x50f941['query']);_0x5befcb[_0x0d11('0x41')]=_[_0x0d11('0x3f')](_0x50f941[_0x0d11('0x3b')],qs[_0x0d11('0x40')](_0x43e69d[_0x0d11('0x3c')][_0x0d11('0x40')]));_0x5befcb[_0x0d11('0x41')]=_0x5befcb[_0x0d11('0x41')][_0x0d11('0x42')]?_0x5befcb[_0x0d11('0x41')]:_0x50f941[_0x0d11('0x3b')];if(_0x43e69d[_0x0d11('0x3c')][_0x0d11('0x4b')]){_0x5befcb[_0x0d11('0x50')]=[{'all':!![]}];}_0x5befcb=_[_0x0d11('0x49')]({},_0x5befcb,_0x43e69d[_0x0d11('0x51')]);return db[_0x0d11('0x4f')][_0x0d11('0x52')](_0x5befcb)[_0x0d11('0x1c')](handleEntityNotFound(_0x4aa73a,null))[_0x0d11('0x1c')](respondWithResult(_0x4aa73a,null))['catch'](handleError(_0x4aa73a,null));};exports[_0x0d11('0x53')]=function(_0x58b457,_0x183fb5){return db['ZendeskAccount']['create'](_0x58b457[_0x0d11('0x54')],{})[_0x0d11('0x1c')](respondWithResult(_0x183fb5,0xc9))[_0x0d11('0x26')](handleError(_0x183fb5,null));};exports[_0x0d11('0x32')]=function(_0x2c1556,_0x1e5510){if(_0x2c1556[_0x0d11('0x54')]['id']){delete _0x2c1556[_0x0d11('0x54')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x2c1556['params']['id']}})[_0x0d11('0x1c')](handleEntityNotFound(_0x1e5510,null))[_0x0d11('0x1c')](saveUpdates(_0x2c1556[_0x0d11('0x54')],null))[_0x0d11('0x1c')](respondWithResult(_0x1e5510,null))[_0x0d11('0x26')](handleError(_0x1e5510,null));};exports[_0x0d11('0x33')]=function(_0x33cd8a,_0x56feb2){return db[_0x0d11('0x4f')][_0x0d11('0x52')]({'where':{'id':_0x33cd8a[_0x0d11('0x55')]['id']}})['then'](handleEntityNotFound(_0x56feb2,null))['then'](removeEntity(_0x56feb2,null))[_0x0d11('0x26')](handleError(_0x56feb2,null));};exports['getConfigurations']=function(_0x3cdc8b,_0x115024,_0x36e80d){var _0x1a245d={};var _0xce2e39={};var _0xe580e0;var _0xec39e3;return db[_0x0d11('0x4f')][_0x0d11('0x56')]({'where':{'id':_0x3cdc8b[_0x0d11('0x55')]['id']}})[_0x0d11('0x1c')](handleEntityNotFound(_0x115024,null))[_0x0d11('0x1c')](function(_0x546b98){if(_0x546b98){_0xe580e0=_0x546b98;_0xce2e39[_0x0d11('0x3b')]=_[_0x0d11('0x3d')](db[_0x0d11('0x57')][_0x0d11('0x37')]);_0xce2e39[_0x0d11('0x3c')]=_[_0x0d11('0x3d')](_0x3cdc8b[_0x0d11('0x3c')]);_0xce2e39[_0x0d11('0x3e')]=_[_0x0d11('0x3f')](_0xce2e39[_0x0d11('0x3b')],_0xce2e39[_0x0d11('0x3c')]);_0x1a245d[_0x0d11('0x41')]=_[_0x0d11('0x3f')](_0xce2e39[_0x0d11('0x3b')],qs['fields'](_0x3cdc8b[_0x0d11('0x3c')]['fields']));_0x1a245d[_0x0d11('0x41')]=_0x1a245d[_0x0d11('0x41')][_0x0d11('0x42')]?_0x1a245d[_0x0d11('0x41')]:_0xce2e39[_0x0d11('0x3b')];_0x1a245d['order']=qs[_0x0d11('0x45')](_0x3cdc8b[_0x0d11('0x3c')][_0x0d11('0x45')]);_0x1a245d[_0x0d11('0x46')]=qs[_0x0d11('0x3e')](_[_0x0d11('0x47')](_0x3cdc8b[_0x0d11('0x3c')],_0xce2e39[_0x0d11('0x3e')]));if(_0x3cdc8b[_0x0d11('0x3c')]['filter']){_0x1a245d[_0x0d11('0x46')]=_[_0x0d11('0x49')](_0x1a245d[_0x0d11('0x46')],{'$or':_[_0x0d11('0x36')](_0x1a245d[_0x0d11('0x41')],function(_0x1d2493){var _0x204a1c={};_0x204a1c[_0x1d2493]={'$like':'%'+_0x3cdc8b[_0x0d11('0x3c')][_0x0d11('0x48')]+'%'};return _0x204a1c;})});}_0x1a245d=_[_0x0d11('0x49')]({},_0x1a245d,_0x3cdc8b[_0x0d11('0x51')]);return _0xe580e0[_0x0d11('0x58')](_0x1a245d);}})[_0x0d11('0x1c')](function(_0x312e5a){if(_0x312e5a){_0xec39e3=_0x312e5a[_0x0d11('0x42')];if(!_0x3cdc8b['query'][_0x0d11('0x59')](_0x0d11('0x43'))){_0x1a245d[_0x0d11('0x2d')]=qs['limit'](_0x3cdc8b['query']['limit']);_0x1a245d[_0x0d11('0x2c')]=qs[_0x0d11('0x2c')](_0x3cdc8b['query'][_0x0d11('0x2c')]);}return _0xe580e0['getConfigurations'](_0x1a245d);}})[_0x0d11('0x1c')](function(_0x3db791){if(_0x3db791){return _0x3db791?{'count':_0xec39e3,'rows':_0x3db791}:null;}})[_0x0d11('0x1c')](respondWithResult(_0x115024,null))[_0x0d11('0x26')](handleError(_0x115024,null));};exports[_0x0d11('0x5a')]=function(_0x42b607,_0x2c1405,_0xae4f5e){if(_0x42b607[_0x0d11('0x54')]['id']){delete _0x42b607[_0x0d11('0x54')]['id'];}return db[_0x0d11('0x4f')][_0x0d11('0x56')]({'where':{'id':_0x42b607[_0x0d11('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c1405,null))[_0x0d11('0x1c')](function(_0x80bf7f){if(_0x80bf7f){_0x42b607[_0x0d11('0x54')][_0x0d11('0x5b')]=_0x80bf7f['id'];_0x42b607[_0x0d11('0x54')][_0x0d11('0x5c')]=integrations[_0x0d11('0x5d')](_0x42b607['body'][_0x0d11('0x5e')],_0x42b607[_0x0d11('0x54')][_0x0d11('0x39')]);_0x42b607[_0x0d11('0x54')][_0x0d11('0x5f')]=integrations['getDescriptions'](_0x42b607[_0x0d11('0x54')]['channel'],_0x42b607[_0x0d11('0x54')][_0x0d11('0x39')]);return db['ZendeskConfiguration'][_0x0d11('0x53')](_0x42b607[_0x0d11('0x54')],{'include':[{'model':db[_0x0d11('0x60')],'as':_0x0d11('0x5c')},{'model':db[_0x0d11('0x60')],'as':_0x0d11('0x5f')}]});}return null;})['then'](respondWithResult(_0x2c1405,null))[_0x0d11('0x26')](handleError(_0x2c1405,null));};exports[_0x0d11('0x61')]=function(_0x2b0208,_0x919193,_0x4cb584){var _0x472429='';return db[_0x0d11('0x4f')][_0x0d11('0x56')]({'where':{'id':_0x2b0208[_0x0d11('0x55')]['id']},'attributes':['id',_0x0d11('0x62'),_0x0d11('0x63'),_0x0d11('0x64'),_0x0d11('0x65'),_0x0d11('0x66')]})[_0x0d11('0x1c')](handleEntityNotFound(_0x919193,null))[_0x0d11('0x1c')](function(_0xc1c5fc){if(_0xc1c5fc){_0x472429=_0xc1c5fc[_0x0d11('0x66')];var _0x365604=_0x472429[_0x0d11('0x67')](-0x1);if(_0x365604==='/'){_0x472429=_0x472429[_0x0d11('0x68')](0x0,_0x472429[_0x0d11('0x69')](_0x365604));}var _0x29c416={'method':_0x0d11('0x6a'),'uri':util['format'](_0x0d11('0x6b'),_0x472429,_0x0d11('0x6c')),'json':!![]};switch(_0xc1c5fc[_0x0d11('0x65')]){case _0x0d11('0x63'):_0x29c416[_0x0d11('0x6d')]={'Authorization':util['format'](_0x0d11('0x6e'),new Buffer(util[_0x0d11('0x6f')](_0x0d11('0x70'),_0xc1c5fc[_0x0d11('0x62')],_0xc1c5fc[_0x0d11('0x63')]))['toString'](_0x0d11('0x71')))};break;case _0x0d11('0x64'):_0x29c416[_0x0d11('0x6d')]={'Authorization':util[_0x0d11('0x6f')](_0x0d11('0x6e'),new Buffer(util['format'](_0x0d11('0x72'),_0xc1c5fc['username'],_0xc1c5fc[_0x0d11('0x64')]))[_0x0d11('0x73')](_0x0d11('0x71')))};break;default:throw new db['Sequelize'][(_0x0d11('0x74'))](_0x0d11('0x75'));}return rp(_0x29c416);}})[_0x0d11('0x1c')](function(_0x297d47){if(_0x297d47){var _0x56c1e0=[_0x0d11('0x76'),_0x0d11('0x77'),_0x0d11('0x78'),_0x0d11('0x79')];_[_0x0d11('0x7a')](_0x297d47[_0x0d11('0x6c')],function(_0x228e77){return _0x56c1e0[_0x0d11('0x7b')](_0x228e77[_0x0d11('0x39')]);});return{'count':_0x297d47[_0x0d11('0x6c')][_0x0d11('0x42')],'rows':_[_0x0d11('0x36')](_0x297d47[_0x0d11('0x6c')],function(_0x3e0c83){return{'id':_0x3e0c83['id'],'name':_0x3e0c83['position']>0x7?_0x3e0c83[_0x0d11('0x7c')]:_0x3e0c83[_0x0d11('0x39')],'custom':_0x3e0c83[_0x0d11('0x7d')]>0x7?!![]:![],'options':_0x3e0c83[_0x0d11('0x7e')]?_0x3e0c83[_0x0d11('0x7e')]:_0x3e0c83['custom_field_options']?_0x3e0c83[_0x0d11('0x7f')]:[]};})};}})[_0x0d11('0x1c')](respondWithResult(_0x919193,null))[_0x0d11('0x26')](function(_0xa42355){var _0x3f8903=_0x2b0208[_0x0d11('0x3c')][_0x0d11('0x80')]?0x1f4:_0xa42355['statusCode']||0x1f4;logger[_0x0d11('0x21')](_0x0d11('0x81'),_0x0d11('0x61'),_0x3f8903,JSON[_0x0d11('0x20')](_0xa42355));delete _0xa42355['name'];if(_0x3f8903===0x191){_0x3f8903=0x190;}_0x919193[_0x0d11('0x29')](_0x3f8903)[_0x0d11('0x82')](_0x2b0208['query'][_0x0d11('0x80')]?{'message':_0x0d11('0x83'),'statusCode':_0xa42355['statusCode']}:_0xa42355);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8943535..1c7ade9 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 _0xb3d4=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x21e253,_0x5f0f1c){var _0x2eea90=function(_0x3d705c){while(--_0x3d705c){_0x21e253['push'](_0x21e253['shift']());}};_0x2eea90(++_0x5f0f1c);}(_0xb3d4,0x1a4));var _0x4b3d=function(_0x4ddd02,_0x3c4b2f){_0x4ddd02=_0x4ddd02-0x0;var _0x1fcada=_0xb3d4[_0x4ddd02];return _0x1fcada;};'use strict';var _=require(_0x4b3d('0x0'));var util=require(_0x4b3d('0x1'));var logger=require(_0x4b3d('0x2'))(_0x4b3d('0x3'));var moment=require(_0x4b3d('0x4'));var BPromise=require(_0x4b3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b3d('0x6'));var rimraf=require(_0x4b3d('0x7'));var config=require(_0x4b3d('0x8'));var attributes=require(_0x4b3d('0x9'));var integrations=require(_0x4b3d('0xa'));module[_0x4b3d('0xb')]=function(_0x43baab,_0x25b979){return _0x43baab[_0x4b3d('0xc')](_0x4b3d('0xd'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49f0=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5ef3c1,_0x25d5b8){var _0x496f2d=function(_0x41f383){while(--_0x41f383){_0x5ef3c1['push'](_0x5ef3c1['shift']());}};_0x496f2d(++_0x25d5b8);}(_0x49f0,0xf2));var _0x049f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x49f0[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x049f('0x0'));var util=require(_0x049f('0x1'));var logger=require(_0x049f('0x2'))(_0x049f('0x3'));var moment=require(_0x049f('0x4'));var BPromise=require(_0x049f('0x5'));var rp=require(_0x049f('0x6'));var fs=require('fs');var path=require(_0x049f('0x7'));var rimraf=require(_0x049f('0x8'));var config=require(_0x049f('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x049f('0xa')]=function(_0x229d29,_0x1db1f0){return _0x229d29[_0x049f('0xb')](_0x049f('0xc'),attributes,{'tableName':_0x049f('0xd'),'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 4edf02d..06300ef 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xcb91[_0x1b64dd];return _0xeb464c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xb9081d,_0x450ac5){var _0x291b10=function(_0x5e2926){while(--_0x5e2926){_0xb9081d['push'](_0xb9081d['shift']());}};_0x291b10(++_0x450ac5);}(_0x757a,0xde));var _0xa757=function(_0x152396,_0x470a8b){_0x152396=_0x152396-0x0;var _0x238f4d=_0x757a[_0x152396];return _0x238f4d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c94f005..7fd68c9 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 _0x8b6c=['index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8b6c,0xd0));var _0xc8b6=function(_0xe55e34,_0x216414){_0xe55e34=_0xe55e34-0x0;var _0x3323a4=_0x8b6c[_0xe55e34];return _0x3323a4;};'use strict';var multer=require(_0xc8b6('0x0'));var util=require(_0xc8b6('0x1'));var path=require('path');var timeout=require(_0xc8b6('0x2'));var express=require(_0xc8b6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc8b6('0x4'));var config=require(_0xc8b6('0x5'));var controller=require(_0xc8b6('0x6'));router[_0xc8b6('0x7')]('/',auth['isAuthenticated'](),controller[_0xc8b6('0x8')]);router[_0xc8b6('0x7')](_0xc8b6('0x9'),auth['isAuthenticated'](),controller[_0xc8b6('0xa')]);router[_0xc8b6('0x7')](_0xc8b6('0xb'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0xd')]);router[_0xc8b6('0x7')](_0xc8b6('0xe'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0xf')]);router[_0xc8b6('0x7')]('/:id/descriptions',auth[_0xc8b6('0xc')](),controller['getDescriptions']);router[_0xc8b6('0x7')](_0xc8b6('0x10'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x11')]);router['post']('/',auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x12')]);router[_0xc8b6('0x13')](_0xc8b6('0x10'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x14')]);router['put']('/:id',auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x15')]);router['delete'](_0xc8b6('0x9'),auth[_0xc8b6('0xc')](),controller[_0xc8b6('0x16')]);module[_0xc8b6('0x17')]=router; \ No newline at end of file +var _0x3668=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create'];(function(_0x30c225,_0x10f56c){var _0x57d446=function(_0x3d452f){while(--_0x3d452f){_0x30c225['push'](_0x30c225['shift']());}};_0x57d446(++_0x10f56c);}(_0x3668,0x1a0));var _0x8366=function(_0x5d45c5,_0x489231){_0x5d45c5=_0x5d45c5-0x0;var _0x571892=_0x3668[_0x5d45c5];return _0x571892;};'use strict';var multer=require(_0x8366('0x0'));var util=require(_0x8366('0x1'));var path=require('path');var timeout=require(_0x8366('0x2'));var express=require(_0x8366('0x3'));var router=express[_0x8366('0x4')]();var auth=require(_0x8366('0x5'));var interaction=require(_0x8366('0x6'));var config=require(_0x8366('0x7'));var controller=require(_0x8366('0x8'));router[_0x8366('0x9')]('/',auth[_0x8366('0xa')](),controller[_0x8366('0xb')]);router[_0x8366('0x9')](_0x8366('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8366('0x9')](_0x8366('0xd'),auth[_0x8366('0xa')](),controller['getFields']);router[_0x8366('0x9')](_0x8366('0xe'),auth[_0x8366('0xa')](),controller[_0x8366('0xf')]);router['get'](_0x8366('0x10'),auth[_0x8366('0xa')](),controller[_0x8366('0x11')]);router['get'](_0x8366('0x12'),auth[_0x8366('0xa')](),controller['getTags']);router[_0x8366('0x13')]('/',auth[_0x8366('0xa')](),controller[_0x8366('0x14')]);router[_0x8366('0x13')](_0x8366('0x12'),auth[_0x8366('0xa')](),controller['setTags']);router['put'](_0x8366('0xc'),auth[_0x8366('0xa')](),controller['update']);router['delete'](_0x8366('0xc'),auth[_0x8366('0xa')](),controller[_0x8366('0x15')]);module[_0x8366('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 806941d..d099f97 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 _0x81d4=['sequelize','exports','STRING'];(function(_0x35535b,_0x484936){var _0x2bc934=function(_0x1b659c){while(--_0x1b659c){_0x35535b['push'](_0x35535b['shift']());}};_0x2bc934(++_0x484936);}(_0x81d4,0x180));var _0x481d=function(_0x1a2f86,_0x119ddf){_0x1a2f86=_0x1a2f86-0x0;var _0x35dcae=_0x81d4[_0x1a2f86];return _0x35dcae;};'use strict';var Sequelize=require(_0x481d('0x0'));module[_0x481d('0x1')]={'name':{'type':Sequelize[_0x481d('0x2')]},'description':{'type':Sequelize[_0x481d('0x2')]}}; \ No newline at end of file +var _0x34ea=['sequelize'];(function(_0x3ac4a2,_0x2d0c1f){var _0x2640a8=function(_0x4b539a){while(--_0x4b539a){_0x3ac4a2['push'](_0x3ac4a2['shift']());}};_0x2640a8(++_0x2d0c1f);}(_0x34ea,0xb5));var _0xa34e=function(_0x12f68d,_0x42e9c9){_0x12f68d=_0x12f68d-0x0;var _0xb983cc=_0x34ea[_0x12f68d];return _0xb983cc;};'use strict';var Sequelize=require(_0xa34e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index cad0ba2..47051d5 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 _0x30a7=['merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','order','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','end','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL'];(function(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0x30a7,0x1dd));var _0x730a=function(_0x61cadb,_0x365632){_0x61cadb=_0x61cadb-0x0;var _0x55ef4e=_0x30a7[_0x61cadb];return _0x55ef4e;};'use strict';var pdf=require(_0x730a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x730a('0x1'));var jsonpatch=require(_0x730a('0x2'));var rp=require('request-promise');var moment=require(_0x730a('0x3'));var BPromise=require(_0x730a('0x4'));var Mustache=require(_0x730a('0x5'));var util=require('util');var path=require(_0x730a('0x6'));var sox=require('sox');var csv=require(_0x730a('0x7'));var ejs=require(_0x730a('0x8'));var fs=require('fs');var _=require(_0x730a('0x9'));var squel=require(_0x730a('0xa'));var crypto=require(_0x730a('0xb'));var jsforce=require(_0x730a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x730a('0xd'));var authService=require(_0x730a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x730a('0xf'));var hardwareService=require(_0x730a('0x10'));var logger=require(_0x730a('0x11'))('api');var utils=require(_0x730a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x730a('0x13'));var client=jayson[_0x730a('0x14')][_0x730a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x26edeb,_0x376340,_0x3f5761,_0x1f3aed){return new BPromise(function(_0x254900,_0x3124bd){var _0x39e7b8=_0x1f3aed||client;return _0x39e7b8[_0x730a('0x16')](_0x26edeb,_0x3f5761)[_0x730a('0x17')](function(_0x4d4378){logger['info'](_0x730a('0x18'),_0x376340,_0x730a('0x19'));logger[_0x730a('0x1a')](_0x730a('0x1b'),_0x376340,'request\x20sent',JSON['stringify'](_0x4d4378));if(_0x4d4378[_0x730a('0x1c')]){if(_0x4d4378[_0x730a('0x1c')][_0x730a('0x1d')]===0x1f4){logger['error'](_0x730a('0x18'),_0x376340,_0x4d4378['error']['message']);return _0x3124bd(_0x4d4378[_0x730a('0x1c')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x376340,_0x4d4378['error']['message']);return _0x254900(_0x4d4378[_0x730a('0x1c')][_0x730a('0x1e')]);}else{logger[_0x730a('0x1f')](_0x730a('0x18'),_0x376340,_0x730a('0x19'));_0x254900(_0x4d4378[_0x730a('0x20')][_0x730a('0x1e')]);}})['catch'](function(_0x279df9){logger[_0x730a('0x1c')](_0x730a('0x18'),_0x376340,_0x279df9);_0x3124bd(_0x279df9);});});}function respondWithStatusCode(_0x20775a,_0x31c491){_0x31c491=_0x31c491||0xcc;return function(_0x1ed965){if(_0x1ed965){return _0x20775a[_0x730a('0x21')](_0x31c491);}return _0x20775a[_0x730a('0x22')](_0x31c491)['end']();};}function respondWithResult(_0x5518e4,_0x169e12){_0x169e12=_0x169e12||0xc8;return function(_0x14ef41){if(_0x14ef41){return _0x5518e4[_0x730a('0x22')](_0x169e12)[_0x730a('0x23')](_0x14ef41);}};}function respondWithFilteredResult(_0x40bb7f,_0x34a56c){return function(_0x31be29){if(_0x31be29){var _0x98a28c=_0x31be29[_0x730a('0x24')],_0x1864cb=_0x34a56c[_0x730a('0x25')],_0x136958=_0x34a56c['offset']+_0x34a56c[_0x730a('0x26')],_0xc925f4;if(_0x136958>=_0x98a28c){_0x136958=_0x98a28c;_0xc925f4=0xc8;}else{_0xc925f4=0xce;}_0x40bb7f[_0x730a('0x22')](_0xc925f4);return _0x40bb7f[_0x730a('0x27')](_0x730a('0x28'),_0x1864cb+'-'+_0x136958+'/'+_0x98a28c)['json'](_0x31be29);}return null;};}function patchUpdates(_0x592625){return function(_0x5c6b6e){try{jsonpatch['apply'](_0x5c6b6e,_0x592625,!![]);}catch(_0x416f9f){return BPromise['reject'](_0x416f9f);}return _0x5c6b6e[_0x730a('0x29')]();};}function saveUpdates(_0x447364,_0x2d7a62){return function(_0x4d7f97){if(_0x4d7f97){return _0x4d7f97[_0x730a('0x2a')](_0x447364)[_0x730a('0x17')](function(_0x2c5d18){return _0x2c5d18;});}return null;};}function removeEntity(_0x5d3ec2,_0x1a82ce){return function(_0x51b980){if(_0x51b980){return _0x51b980[_0x730a('0x2b')]()[_0x730a('0x17')](function(){_0x5d3ec2[_0x730a('0x22')](0xcc)[_0x730a('0x2c')]();});}};}function handleEntityNotFound(_0x139a5a,_0x551458){return function(_0x22f3f3){if(!_0x22f3f3){_0x139a5a[_0x730a('0x21')](0x194);}return _0x22f3f3;};}function handleError(_0x1b0d2b,_0x36c425){_0x36c425=_0x36c425||0x1f4;return function(_0x16bd07){logger['error'](_0x16bd07[_0x730a('0x2d')]);if(_0x16bd07[_0x730a('0x2e')]){delete _0x16bd07[_0x730a('0x2e')];}_0x1b0d2b[_0x730a('0x22')](_0x36c425)[_0x730a('0x2f')](_0x16bd07);};}exports[_0x730a('0x30')]=function(_0xd24a78,_0x2ac578){var _0x1b25d8={},_0x166eca={},_0x3b33cb={'count':0x0,'rows':[]};var _0x2bb230=_[_0x730a('0x31')](db[_0x730a('0x32')][_0x730a('0x33')],function(_0x57faf2){return{'name':_0x57faf2[_0x730a('0x34')],'type':_0x57faf2[_0x730a('0x35')][_0x730a('0x36')]};});_0x166eca[_0x730a('0x37')]=_['map'](_0x2bb230,_0x730a('0x2e'));_0x166eca[_0x730a('0x38')]=_[_0x730a('0x39')](_0xd24a78[_0x730a('0x38')]);_0x166eca['filters']=_[_0x730a('0x3a')](_0x166eca[_0x730a('0x37')],_0x166eca[_0x730a('0x38')]);_0x1b25d8[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x166eca['model'],qs['fields'](_0xd24a78[_0x730a('0x38')][_0x730a('0x3c')]));_0x1b25d8[_0x730a('0x3b')]=_0x1b25d8[_0x730a('0x3b')][_0x730a('0x3d')]?_0x1b25d8['attributes']:_0x166eca[_0x730a('0x37')];if(!_0xd24a78[_0x730a('0x38')][_0x730a('0x3e')](_0x730a('0x3f'))){_0x1b25d8[_0x730a('0x26')]=qs[_0x730a('0x26')](_0xd24a78['query'][_0x730a('0x26')]);_0x1b25d8[_0x730a('0x25')]=qs[_0x730a('0x25')](_0xd24a78['query'][_0x730a('0x25')]);}_0x1b25d8['order']=qs['sort'](_0xd24a78[_0x730a('0x38')][_0x730a('0x40')]);_0x1b25d8[_0x730a('0x41')]=qs[_0x730a('0x42')](_['pick'](_0xd24a78[_0x730a('0x38')],_0x166eca[_0x730a('0x42')]),_0x2bb230);if(_0xd24a78[_0x730a('0x38')][_0x730a('0x43')]){_0x1b25d8[_0x730a('0x41')]=_['merge'](_0x1b25d8[_0x730a('0x41')],{'$or':_[_0x730a('0x31')](_0x2bb230,function(_0x2de619){if(_0x2de619[_0x730a('0x35')]!==_0x730a('0x44')){var _0x313e47={};_0x313e47[_0x2de619[_0x730a('0x2e')]]={'$like':'%'+_0xd24a78[_0x730a('0x38')][_0x730a('0x43')]+'%'};return _0x313e47;}})});}_0x1b25d8=_[_0x730a('0x45')]({},_0x1b25d8,_0xd24a78[_0x730a('0x46')]);var _0x2fd84f={'where':_0x1b25d8[_0x730a('0x41')]};return db['ZendeskConfiguration'][_0x730a('0x24')](_0x2fd84f)[_0x730a('0x17')](function(_0x4bb3ff){_0x3b33cb['count']=_0x4bb3ff;if(_0xd24a78[_0x730a('0x38')][_0x730a('0x47')]){_0x1b25d8[_0x730a('0x48')]=[{'all':!![]}];}return db[_0x730a('0x32')][_0x730a('0x49')](_0x1b25d8);})[_0x730a('0x17')](function(_0x2d7105){_0x3b33cb[_0x730a('0x4a')]=_0x2d7105;return _0x3b33cb;})['then'](respondWithFilteredResult(_0x2ac578,_0x1b25d8))[_0x730a('0x4b')](handleError(_0x2ac578,null));};exports['show']=function(_0x44316b,_0xa59fcc){var _0x24cf5c={'raw':![],'where':{'id':_0x44316b[_0x730a('0x4c')]['id']}},_0x20f6e0={};_0x20f6e0[_0x730a('0x37')]=_[_0x730a('0x39')](db['ZendeskConfiguration'][_0x730a('0x33')]);_0x20f6e0[_0x730a('0x38')]=_['keys'](_0x44316b[_0x730a('0x38')]);_0x20f6e0[_0x730a('0x42')]=_[_0x730a('0x3a')](_0x20f6e0[_0x730a('0x37')],_0x20f6e0[_0x730a('0x38')]);_0x24cf5c[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x20f6e0[_0x730a('0x37')],qs[_0x730a('0x3c')](_0x44316b['query'][_0x730a('0x3c')]));_0x24cf5c[_0x730a('0x3b')]=_0x24cf5c[_0x730a('0x3b')][_0x730a('0x3d')]?_0x24cf5c[_0x730a('0x3b')]:_0x20f6e0['model'];if(_0x44316b['query'][_0x730a('0x47')]){_0x24cf5c[_0x730a('0x48')]=[{'all':!![]}];}_0x24cf5c=_[_0x730a('0x45')]({},_0x24cf5c,_0x44316b[_0x730a('0x46')]);return db['ZendeskConfiguration'][_0x730a('0x4d')](_0x24cf5c)[_0x730a('0x17')](handleEntityNotFound(_0xa59fcc,null))[_0x730a('0x17')](respondWithResult(_0xa59fcc,null))['catch'](handleError(_0xa59fcc,null));};exports[_0x730a('0x4e')]=function(_0x24c336,_0x35008b){return db[_0x730a('0x32')]['create'](_0x24c336[_0x730a('0x4f')],{})[_0x730a('0x17')](respondWithResult(_0x35008b,0xc9))[_0x730a('0x4b')](handleError(_0x35008b,null));};exports['update']=function(_0x3e41c8,_0x3670e9){if(_0x3e41c8[_0x730a('0x4f')]['id']){delete _0x3e41c8[_0x730a('0x4f')]['id'];}return db['ZendeskConfiguration'][_0x730a('0x4d')]({'where':{'id':_0x3e41c8[_0x730a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3670e9,null))[_0x730a('0x17')](saveUpdates(_0x3e41c8[_0x730a('0x4f')],null))[_0x730a('0x17')](respondWithResult(_0x3670e9,null))[_0x730a('0x4b')](handleError(_0x3670e9,null));};exports[_0x730a('0x2b')]=function(_0x2b8a82,_0x2a55c5){return db[_0x730a('0x32')][_0x730a('0x4d')]({'where':{'id':_0x2b8a82['params']['id']}})['then'](handleEntityNotFound(_0x2a55c5,null))[_0x730a('0x17')](removeEntity(_0x2a55c5,null))['catch'](handleError(_0x2a55c5,null));};exports[_0x730a('0x50')]=function(_0x3fca8e,_0x4b4dbf,_0x3aa1d4){var _0x424b96={};var _0x1d9351={};var _0x173853;var _0x2ae236;return db['ZendeskConfiguration'][_0x730a('0x51')]({'where':{'id':_0x3fca8e['params']['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x4b4dbf,null))[_0x730a('0x17')](function(_0x54de2a){if(_0x54de2a){_0x173853=_0x54de2a;_0x1d9351['model']=_[_0x730a('0x39')](db[_0x730a('0x52')][_0x730a('0x33')]);_0x1d9351['query']=_[_0x730a('0x39')](_0x3fca8e[_0x730a('0x38')]);_0x1d9351[_0x730a('0x42')]=_['intersection'](_0x1d9351[_0x730a('0x37')],_0x1d9351[_0x730a('0x38')]);_0x424b96[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x1d9351[_0x730a('0x37')],qs['fields'](_0x3fca8e[_0x730a('0x38')]['fields']));_0x424b96['attributes']=_0x424b96[_0x730a('0x3b')][_0x730a('0x3d')]?_0x424b96[_0x730a('0x3b')]:_0x1d9351[_0x730a('0x37')];_0x424b96[_0x730a('0x53')]=qs[_0x730a('0x40')](_0x3fca8e[_0x730a('0x38')][_0x730a('0x40')]);_0x424b96[_0x730a('0x41')]=qs[_0x730a('0x42')](_[_0x730a('0x54')](_0x3fca8e[_0x730a('0x38')],_0x1d9351[_0x730a('0x42')]));if(_0x3fca8e[_0x730a('0x38')][_0x730a('0x43')]){_0x424b96[_0x730a('0x41')]=_['merge'](_0x424b96['where'],{'$or':_[_0x730a('0x31')](_0x424b96['attributes'],function(_0x1d1b79){var _0xfd8309={};_0xfd8309[_0x1d1b79]={'$like':'%'+_0x3fca8e['query'][_0x730a('0x43')]+'%'};return _0xfd8309;})});}_0x424b96=_[_0x730a('0x45')]({},_0x424b96,_0x3fca8e[_0x730a('0x46')]);return _0x173853[_0x730a('0x50')](_0x424b96);}})[_0x730a('0x17')](function(_0xcbff48){if(_0xcbff48){_0x2ae236=_0xcbff48[_0x730a('0x3d')];if(!_0x3fca8e[_0x730a('0x38')][_0x730a('0x3e')](_0x730a('0x3f'))){_0x424b96[_0x730a('0x26')]=qs['limit'](_0x3fca8e[_0x730a('0x38')]['limit']);_0x424b96['offset']=qs[_0x730a('0x25')](_0x3fca8e[_0x730a('0x38')][_0x730a('0x25')]);}return _0x173853[_0x730a('0x50')](_0x424b96);}})[_0x730a('0x17')](function(_0xc9b077){if(_0xc9b077){return _0xc9b077?{'count':_0x2ae236,'rows':_0xc9b077}:null;}})[_0x730a('0x17')](respondWithResult(_0x4b4dbf,null))[_0x730a('0x4b')](handleError(_0x4b4dbf,null));};exports['getSubjects']=function(_0x376d18,_0x5dcf3a,_0x43a9d6){var _0x1ef247={};var _0xc8131f={};var _0x3ef78a;var _0x570e0e;return db[_0x730a('0x32')][_0x730a('0x51')]({'where':{'id':_0x376d18[_0x730a('0x4c')]['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x5dcf3a,null))[_0x730a('0x17')](function(_0xab77){if(_0xab77){_0x3ef78a=_0xab77;_0xc8131f[_0x730a('0x37')]=_[_0x730a('0x39')](db[_0x730a('0x52')][_0x730a('0x33')]);_0xc8131f[_0x730a('0x38')]=_['keys'](_0x376d18[_0x730a('0x38')]);_0xc8131f[_0x730a('0x42')]=_[_0x730a('0x3a')](_0xc8131f[_0x730a('0x37')],_0xc8131f[_0x730a('0x38')]);_0x1ef247['attributes']=_[_0x730a('0x3a')](_0xc8131f[_0x730a('0x37')],qs['fields'](_0x376d18['query'][_0x730a('0x3c')]));_0x1ef247[_0x730a('0x3b')]=_0x1ef247[_0x730a('0x3b')][_0x730a('0x3d')]?_0x1ef247[_0x730a('0x3b')]:_0xc8131f[_0x730a('0x37')];_0x1ef247[_0x730a('0x53')]=qs[_0x730a('0x40')](_0x376d18['query'][_0x730a('0x40')]);_0x1ef247['where']=qs[_0x730a('0x42')](_['pick'](_0x376d18[_0x730a('0x38')],_0xc8131f[_0x730a('0x42')]));if(_0x376d18[_0x730a('0x38')][_0x730a('0x43')]){_0x1ef247[_0x730a('0x41')]=_['merge'](_0x1ef247[_0x730a('0x41')],{'$or':_[_0x730a('0x31')](_0x1ef247['attributes'],function(_0x5c1c75){var _0x593ab5={};_0x593ab5[_0x5c1c75]={'$like':'%'+_0x376d18[_0x730a('0x38')][_0x730a('0x43')]+'%'};return _0x593ab5;})});}_0x1ef247=_[_0x730a('0x45')]({},_0x1ef247,_0x376d18['options']);return _0x3ef78a[_0x730a('0x55')](_0x1ef247);}})[_0x730a('0x17')](function(_0x200dfe){if(_0x200dfe){_0x570e0e=_0x200dfe['length'];if(!_0x376d18[_0x730a('0x38')][_0x730a('0x3e')]('nolimit')){_0x1ef247[_0x730a('0x26')]=qs[_0x730a('0x26')](_0x376d18[_0x730a('0x38')][_0x730a('0x26')]);_0x1ef247[_0x730a('0x25')]=qs[_0x730a('0x25')](_0x376d18[_0x730a('0x38')][_0x730a('0x25')]);}return _0x3ef78a['getSubjects'](_0x1ef247);}})[_0x730a('0x17')](function(_0x2b9a56){if(_0x2b9a56){return _0x2b9a56?{'count':_0x570e0e,'rows':_0x2b9a56}:null;}})['then'](respondWithResult(_0x5dcf3a,null))['catch'](handleError(_0x5dcf3a,null));};exports[_0x730a('0x56')]=function(_0x19f976,_0x286ad4,_0x112531){var _0x197b2f={};var _0x249dcc={};var _0x34d76a;var _0x339eaf;return db[_0x730a('0x32')]['findOne']({'where':{'id':_0x19f976[_0x730a('0x4c')]['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x286ad4,null))[_0x730a('0x17')](function(_0x1cade7){if(_0x1cade7){_0x34d76a=_0x1cade7;_0x249dcc['model']=_[_0x730a('0x39')](db['ZendeskField'][_0x730a('0x33')]);_0x249dcc[_0x730a('0x38')]=_['keys'](_0x19f976[_0x730a('0x38')]);_0x249dcc[_0x730a('0x42')]=_['intersection'](_0x249dcc[_0x730a('0x37')],_0x249dcc['query']);_0x197b2f[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x249dcc[_0x730a('0x37')],qs[_0x730a('0x3c')](_0x19f976[_0x730a('0x38')]['fields']));_0x197b2f[_0x730a('0x3b')]=_0x197b2f[_0x730a('0x3b')][_0x730a('0x3d')]?_0x197b2f['attributes']:_0x249dcc[_0x730a('0x37')];_0x197b2f[_0x730a('0x53')]=qs['sort'](_0x19f976[_0x730a('0x38')][_0x730a('0x40')]);_0x197b2f[_0x730a('0x41')]=qs['filters'](_[_0x730a('0x54')](_0x19f976[_0x730a('0x38')],_0x249dcc[_0x730a('0x42')]));if(_0x19f976[_0x730a('0x38')][_0x730a('0x43')]){_0x197b2f[_0x730a('0x41')]=_[_0x730a('0x45')](_0x197b2f['where'],{'$or':_[_0x730a('0x31')](_0x197b2f[_0x730a('0x3b')],function(_0x1e8dbe){var _0x24a3df={};_0x24a3df[_0x1e8dbe]={'$like':'%'+_0x19f976['query'][_0x730a('0x43')]+'%'};return _0x24a3df;})});}_0x197b2f=_[_0x730a('0x45')]({},_0x197b2f,_0x19f976[_0x730a('0x46')]);return _0x34d76a[_0x730a('0x56')](_0x197b2f);}})[_0x730a('0x17')](function(_0x4e6fd1){if(_0x4e6fd1){_0x339eaf=_0x4e6fd1[_0x730a('0x3d')];if(!_0x19f976[_0x730a('0x38')][_0x730a('0x3e')](_0x730a('0x3f'))){_0x197b2f[_0x730a('0x26')]=qs['limit'](_0x19f976[_0x730a('0x38')][_0x730a('0x26')]);_0x197b2f[_0x730a('0x25')]=qs['offset'](_0x19f976[_0x730a('0x38')][_0x730a('0x25')]);}return _0x34d76a[_0x730a('0x56')](_0x197b2f);}})[_0x730a('0x17')](function(_0x57a439){if(_0x57a439){return _0x57a439?{'count':_0x339eaf,'rows':_0x57a439}:null;}})['then'](respondWithResult(_0x286ad4,null))[_0x730a('0x4b')](handleError(_0x286ad4,null));};exports['getTags']=function(_0x3f27a4,_0x3d74e9,_0x206ff4){var _0x34e90a={};var _0x57edba={};var _0x48981e;var _0x45a642;return db[_0x730a('0x32')][_0x730a('0x51')]({'where':{'id':_0x3f27a4['params']['id']}})['then'](handleEntityNotFound(_0x3d74e9,null))[_0x730a('0x17')](function(_0x257337){if(_0x257337){_0x48981e=_0x257337;_0x57edba['model']=_['keys'](db[_0x730a('0x57')][_0x730a('0x33')]);_0x57edba[_0x730a('0x38')]=_['keys'](_0x3f27a4[_0x730a('0x38')]);_0x57edba[_0x730a('0x42')]=_[_0x730a('0x3a')](_0x57edba[_0x730a('0x37')],_0x57edba[_0x730a('0x38')]);_0x34e90a[_0x730a('0x3b')]=_[_0x730a('0x3a')](_0x57edba[_0x730a('0x37')],qs[_0x730a('0x3c')](_0x3f27a4[_0x730a('0x38')][_0x730a('0x3c')]));_0x34e90a[_0x730a('0x3b')]=_0x34e90a['attributes']['length']?_0x34e90a[_0x730a('0x3b')]:_0x57edba[_0x730a('0x37')];_0x34e90a[_0x730a('0x53')]=qs[_0x730a('0x40')](_0x3f27a4[_0x730a('0x38')][_0x730a('0x40')]);_0x34e90a[_0x730a('0x41')]=qs[_0x730a('0x42')](_['pick'](_0x3f27a4[_0x730a('0x38')],_0x57edba['filters']));if(_0x3f27a4[_0x730a('0x38')][_0x730a('0x43')]){_0x34e90a[_0x730a('0x41')]=_[_0x730a('0x45')](_0x34e90a[_0x730a('0x41')],{'$or':_[_0x730a('0x31')](_0x34e90a[_0x730a('0x3b')],function(_0x4620d0){var _0x5f09d8={};_0x5f09d8[_0x4620d0]={'$like':'%'+_0x3f27a4['query'][_0x730a('0x43')]+'%'};return _0x5f09d8;})});}_0x34e90a=_['merge']({},_0x34e90a,_0x3f27a4[_0x730a('0x46')]);return _0x48981e[_0x730a('0x58')](_0x34e90a);}})[_0x730a('0x17')](function(_0x499ac8){if(_0x499ac8){_0x45a642=_0x499ac8[_0x730a('0x3d')];if(!_0x3f27a4[_0x730a('0x38')][_0x730a('0x3e')]('nolimit')){_0x34e90a['limit']=qs['limit'](_0x3f27a4[_0x730a('0x38')][_0x730a('0x26')]);_0x34e90a['offset']=qs[_0x730a('0x25')](_0x3f27a4[_0x730a('0x38')][_0x730a('0x25')]);}return _0x48981e[_0x730a('0x58')](_0x34e90a);}})[_0x730a('0x17')](function(_0x178dbb){if(_0x178dbb){return _0x178dbb?{'count':_0x45a642,'rows':_0x178dbb}:null;}})[_0x730a('0x17')](respondWithResult(_0x3d74e9,null))[_0x730a('0x4b')](handleError(_0x3d74e9,null));};exports[_0x730a('0x59')]=function(_0x5b0ebc,_0x9a2cb4,_0xc56625){if(_0x5b0ebc[_0x730a('0x4f')]['id']){delete _0x5b0ebc[_0x730a('0x4f')]['id'];}return db[_0x730a('0x32')][_0x730a('0x51')]({'where':{'id':_0x5b0ebc['params']['id']}})[_0x730a('0x17')](handleEntityNotFound(_0x9a2cb4,null))[_0x730a('0x17')](function(_0xb44381){if(_0xb44381){return _0xb44381[_0x730a('0x59')](_0x5b0ebc[_0x730a('0x4f')][_0x730a('0x5a')]||[]);}return null;})[_0x730a('0x17')](respondWithResult(_0x9a2cb4,null))['catch'](handleError(_0x9a2cb4,null));}; \ No newline at end of file +var _0xff4e=['api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','apply','save','update','destroy','sendStatus','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','body','getFields','ZendeskField','order','pick','getSubjects','findOne','nolimit','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x515562,_0x25f1ec){var _0x196305=function(_0x1da7c1){while(--_0x1da7c1){_0x515562['push'](_0x515562['shift']());}};_0x196305(++_0x25f1ec);}(_0xff4e,0x102));var _0xeff4=function(_0x3d3a25,_0x3496d8){_0x3d3a25=_0x3d3a25-0x0;var _0x13aa47=_0xff4e[_0x3d3a25];return _0x13aa47;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeff4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeff4('0x1'));var jsonpatch=require(_0xeff4('0x2'));var rp=require(_0xeff4('0x3'));var moment=require(_0xeff4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeff4('0x5'));var util=require(_0xeff4('0x6'));var path=require('path');var sox=require(_0xeff4('0x7'));var csv=require('to-csv');var ejs=require(_0xeff4('0x8'));var fs=require('fs');var _=require(_0xeff4('0x9'));var squel=require(_0xeff4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeff4('0xb'));var toCsv=require(_0xeff4('0xc'));var querystring=require(_0xeff4('0xd'));var Papa=require(_0xeff4('0xe'));var Redis=require('ioredis');var authService=require(_0xeff4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeff4('0x10'));var hardwareService=require(_0xeff4('0x11'));var logger=require('../../config/logger')(_0xeff4('0x12'));var utils=require(_0xeff4('0x13'));var config=require(_0xeff4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xeff4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xeff4('0x16')][_0xeff4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x38647f,_0x1a489d,_0x304437,_0x2e25b4){return new BPromise(function(_0x548da9,_0x2ff117){var _0x372f2e=_0x2e25b4||client;return _0x372f2e[_0xeff4('0x18')](_0x38647f,_0x304437)[_0xeff4('0x19')](function(_0x3a2aae){logger[_0xeff4('0x1a')](_0xeff4('0x1b'),_0x1a489d,'request\x20sent');logger[_0xeff4('0x1c')](_0xeff4('0x1d'),_0x1a489d,_0xeff4('0x1e'),JSON[_0xeff4('0x1f')](_0x3a2aae));if(_0x3a2aae[_0xeff4('0x20')]){if(_0x3a2aae[_0xeff4('0x20')][_0xeff4('0x21')]===0x1f4){logger[_0xeff4('0x20')](_0xeff4('0x1b'),_0x1a489d,_0x3a2aae['error']['message']);return _0x2ff117(_0x3a2aae[_0xeff4('0x20')]['message']);}logger[_0xeff4('0x20')](_0xeff4('0x1b'),_0x1a489d,_0x3a2aae['error'][_0xeff4('0x22')]);return _0x548da9(_0x3a2aae[_0xeff4('0x20')]['message']);}else{logger[_0xeff4('0x1a')](_0xeff4('0x1b'),_0x1a489d,_0xeff4('0x1e'));_0x548da9(_0x3a2aae[_0xeff4('0x23')][_0xeff4('0x22')]);}})[_0xeff4('0x24')](function(_0x63a54c){logger[_0xeff4('0x20')](_0xeff4('0x1b'),_0x1a489d,_0x63a54c);_0x2ff117(_0x63a54c);});});}function respondWithStatusCode(_0x56344b,_0xe2f0c8){_0xe2f0c8=_0xe2f0c8||0xcc;return function(_0x5218f9){if(_0x5218f9){return _0x56344b['sendStatus'](_0xe2f0c8);}return _0x56344b[_0xeff4('0x25')](_0xe2f0c8)[_0xeff4('0x26')]();};}function respondWithResult(_0x97cf59,_0x488b10){_0x488b10=_0x488b10||0xc8;return function(_0x379981){if(_0x379981){return _0x97cf59['status'](_0x488b10)[_0xeff4('0x27')](_0x379981);}};}function respondWithFilteredResult(_0x52e696,_0x26839d){return function(_0x4947d4){if(_0x4947d4){var _0x4b60eb=_0x4947d4[_0xeff4('0x28')],_0x54dac9=_0x26839d[_0xeff4('0x29')],_0xd20478=_0x26839d[_0xeff4('0x29')]+_0x26839d[_0xeff4('0x2a')],_0x48bce6;if(_0xd20478>=_0x4b60eb){_0xd20478=_0x4b60eb;_0x48bce6=0xc8;}else{_0x48bce6=0xce;}_0x52e696['status'](_0x48bce6);return _0x52e696[_0xeff4('0x2b')]('Content-Range',_0x54dac9+'-'+_0xd20478+'/'+_0x4b60eb)[_0xeff4('0x27')](_0x4947d4);}return null;};}function patchUpdates(_0x51d05f){return function(_0x26b28a){try{jsonpatch[_0xeff4('0x2c')](_0x26b28a,_0x51d05f,!![]);}catch(_0x1d02bc){return BPromise['reject'](_0x1d02bc);}return _0x26b28a[_0xeff4('0x2d')]();};}function saveUpdates(_0x38242e,_0x4e64ac){return function(_0x4cf48e){if(_0x4cf48e){return _0x4cf48e[_0xeff4('0x2e')](_0x38242e)[_0xeff4('0x19')](function(_0x412e15){return _0x412e15;});}return null;};}function removeEntity(_0xa38e16,_0x1d5839){return function(_0x1be6c9){if(_0x1be6c9){return _0x1be6c9[_0xeff4('0x2f')]()[_0xeff4('0x19')](function(){_0xa38e16[_0xeff4('0x25')](0xcc)[_0xeff4('0x26')]();});}};}function handleEntityNotFound(_0x478645,_0x2e59ab){return function(_0x57566c){if(!_0x57566c){_0x478645[_0xeff4('0x30')](0x194);}return _0x57566c;};}function handleError(_0x1d0512,_0x1134a9){_0x1134a9=_0x1134a9||0x1f4;return function(_0x10c16b){logger[_0xeff4('0x20')](_0x10c16b[_0xeff4('0x31')]);if(_0x10c16b[_0xeff4('0x32')]){delete _0x10c16b[_0xeff4('0x32')];}_0x1d0512[_0xeff4('0x25')](_0x1134a9)['send'](_0x10c16b);};}exports[_0xeff4('0x33')]=function(_0x6616cd,_0x3df6c5){var _0x440780={},_0x411716={},_0xb3bba7={'count':0x0,'rows':[]};var _0x50172e=_[_0xeff4('0x34')](db[_0xeff4('0x35')][_0xeff4('0x36')],function(_0x1b33c8){return{'name':_0x1b33c8[_0xeff4('0x37')],'type':_0x1b33c8[_0xeff4('0x38')][_0xeff4('0x39')]};});_0x411716[_0xeff4('0x3a')]=_['map'](_0x50172e,_0xeff4('0x32'));_0x411716[_0xeff4('0x3b')]=_['keys'](_0x6616cd[_0xeff4('0x3b')]);_0x411716[_0xeff4('0x3c')]=_[_0xeff4('0x3d')](_0x411716['model'],_0x411716[_0xeff4('0x3b')]);_0x440780[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x411716[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x440780[_0xeff4('0x3e')]=_0x440780['attributes'][_0xeff4('0x40')]?_0x440780['attributes']:_0x411716[_0xeff4('0x3a')];if(!_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x41')]('nolimit')){_0x440780[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x2a')]);_0x440780[_0xeff4('0x29')]=qs[_0xeff4('0x29')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x29')]);}_0x440780['order']=qs[_0xeff4('0x42')](_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x42')]);_0x440780[_0xeff4('0x43')]=qs['filters'](_['pick'](_0x6616cd[_0xeff4('0x3b')],_0x411716[_0xeff4('0x3c')]),_0x50172e);if(_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x44')]){_0x440780[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0x440780[_0xeff4('0x43')],{'$or':_['map'](_0x50172e,function(_0x4afa47){if(_0x4afa47[_0xeff4('0x38')]!==_0xeff4('0x46')){var _0x2112d7={};_0x2112d7[_0x4afa47[_0xeff4('0x32')]]={'$like':'%'+_0x6616cd[_0xeff4('0x3b')][_0xeff4('0x44')]+'%'};return _0x2112d7;}})});}_0x440780=_[_0xeff4('0x45')]({},_0x440780,_0x6616cd[_0xeff4('0x47')]);var _0x348f9d={'where':_0x440780['where']};return db['ZendeskConfiguration'][_0xeff4('0x28')](_0x348f9d)[_0xeff4('0x19')](function(_0x4ba1f0){_0xb3bba7[_0xeff4('0x28')]=_0x4ba1f0;if(_0x6616cd['query'][_0xeff4('0x48')]){_0x440780[_0xeff4('0x49')]=[{'all':!![]}];}return db[_0xeff4('0x35')]['findAll'](_0x440780);})[_0xeff4('0x19')](function(_0x1b549f){_0xb3bba7[_0xeff4('0x4a')]=_0x1b549f;return _0xb3bba7;})['then'](respondWithFilteredResult(_0x3df6c5,_0x440780))['catch'](handleError(_0x3df6c5,null));};exports[_0xeff4('0x4b')]=function(_0x20b595,_0x31c486){var _0x274d09={'raw':![],'where':{'id':_0x20b595[_0xeff4('0x4c')]['id']}},_0x211aaa={};_0x211aaa[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db[_0xeff4('0x35')][_0xeff4('0x36')]);_0x211aaa[_0xeff4('0x3b')]=_['keys'](_0x20b595[_0xeff4('0x3b')]);_0x211aaa['filters']=_[_0xeff4('0x3d')](_0x211aaa['model'],_0x211aaa[_0xeff4('0x3b')]);_0x274d09[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x211aaa[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x20b595[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x274d09[_0xeff4('0x3e')]=_0x274d09['attributes'][_0xeff4('0x40')]?_0x274d09['attributes']:_0x211aaa['model'];if(_0x20b595[_0xeff4('0x3b')]['includeAll']){_0x274d09[_0xeff4('0x49')]=[{'all':!![]}];}_0x274d09=_[_0xeff4('0x45')]({},_0x274d09,_0x20b595[_0xeff4('0x47')]);return db[_0xeff4('0x35')][_0xeff4('0x4e')](_0x274d09)[_0xeff4('0x19')](handleEntityNotFound(_0x31c486,null))[_0xeff4('0x19')](respondWithResult(_0x31c486,null))[_0xeff4('0x24')](handleError(_0x31c486,null));};exports[_0xeff4('0x4f')]=function(_0x5f0668,_0x6ed8b9){return db[_0xeff4('0x35')][_0xeff4('0x4f')](_0x5f0668[_0xeff4('0x50')],{})[_0xeff4('0x19')](respondWithResult(_0x6ed8b9,0xc9))[_0xeff4('0x24')](handleError(_0x6ed8b9,null));};exports[_0xeff4('0x2e')]=function(_0x15a832,_0x5e8809){if(_0x15a832[_0xeff4('0x50')]['id']){delete _0x15a832[_0xeff4('0x50')]['id'];}return db[_0xeff4('0x35')]['find']({'where':{'id':_0x15a832[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x5e8809,null))[_0xeff4('0x19')](saveUpdates(_0x15a832[_0xeff4('0x50')],null))['then'](respondWithResult(_0x5e8809,null))[_0xeff4('0x24')](handleError(_0x5e8809,null));};exports['destroy']=function(_0x28e4a8,_0x5d0e20){return db[_0xeff4('0x35')]['find']({'where':{'id':_0x28e4a8[_0xeff4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d0e20,null))[_0xeff4('0x19')](removeEntity(_0x5d0e20,null))[_0xeff4('0x24')](handleError(_0x5d0e20,null));};exports[_0xeff4('0x51')]=function(_0x35b3d5,_0x289cc4,_0x20b144){var _0xda99b1={};var _0x6383a1={};var _0x1f0224;var _0x22378e;return db[_0xeff4('0x35')]['findOne']({'where':{'id':_0x35b3d5['params']['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x289cc4,null))[_0xeff4('0x19')](function(_0x5b4326){if(_0x5b4326){_0x1f0224=_0x5b4326;_0x6383a1[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db[_0xeff4('0x52')][_0xeff4('0x36')]);_0x6383a1[_0xeff4('0x3b')]=_['keys'](_0x35b3d5[_0xeff4('0x3b')]);_0x6383a1[_0xeff4('0x3c')]=_[_0xeff4('0x3d')](_0x6383a1[_0xeff4('0x3a')],_0x6383a1['query']);_0xda99b1['attributes']=_[_0xeff4('0x3d')](_0x6383a1[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x35b3d5['query']['fields']));_0xda99b1[_0xeff4('0x3e')]=_0xda99b1[_0xeff4('0x3e')][_0xeff4('0x40')]?_0xda99b1[_0xeff4('0x3e')]:_0x6383a1[_0xeff4('0x3a')];_0xda99b1[_0xeff4('0x53')]=qs[_0xeff4('0x42')](_0x35b3d5[_0xeff4('0x3b')]['sort']);_0xda99b1[_0xeff4('0x43')]=qs[_0xeff4('0x3c')](_[_0xeff4('0x54')](_0x35b3d5[_0xeff4('0x3b')],_0x6383a1['filters']));if(_0x35b3d5['query'][_0xeff4('0x44')]){_0xda99b1[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0xda99b1[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0xda99b1[_0xeff4('0x3e')],function(_0x1a4a3f){var _0x22fc40={};_0x22fc40[_0x1a4a3f]={'$like':'%'+_0x35b3d5['query'][_0xeff4('0x44')]+'%'};return _0x22fc40;})});}_0xda99b1=_[_0xeff4('0x45')]({},_0xda99b1,_0x35b3d5[_0xeff4('0x47')]);return _0x1f0224[_0xeff4('0x51')](_0xda99b1);}})['then'](function(_0x3e60f8){if(_0x3e60f8){_0x22378e=_0x3e60f8[_0xeff4('0x40')];if(!_0x35b3d5['query'][_0xeff4('0x41')]('nolimit')){_0xda99b1['limit']=qs['limit'](_0x35b3d5['query'][_0xeff4('0x2a')]);_0xda99b1['offset']=qs[_0xeff4('0x29')](_0x35b3d5[_0xeff4('0x3b')][_0xeff4('0x29')]);}return _0x1f0224[_0xeff4('0x51')](_0xda99b1);}})[_0xeff4('0x19')](function(_0x1314f8){if(_0x1314f8){return _0x1314f8?{'count':_0x22378e,'rows':_0x1314f8}:null;}})['then'](respondWithResult(_0x289cc4,null))['catch'](handleError(_0x289cc4,null));};exports[_0xeff4('0x55')]=function(_0x4737f6,_0x37f2a0,_0x3cedd0){var _0x16abe5={};var _0x4f841a={};var _0x5c7e71;var _0x4a1823;return db[_0xeff4('0x35')][_0xeff4('0x56')]({'where':{'id':_0x4737f6[_0xeff4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37f2a0,null))['then'](function(_0x3212a2){if(_0x3212a2){_0x5c7e71=_0x3212a2;_0x4f841a['model']=_[_0xeff4('0x4d')](db[_0xeff4('0x52')][_0xeff4('0x36')]);_0x4f841a[_0xeff4('0x3b')]=_[_0xeff4('0x4d')](_0x4737f6['query']);_0x4f841a['filters']=_[_0xeff4('0x3d')](_0x4f841a[_0xeff4('0x3a')],_0x4f841a[_0xeff4('0x3b')]);_0x16abe5[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x4f841a['model'],qs[_0xeff4('0x3f')](_0x4737f6[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x16abe5['attributes']=_0x16abe5[_0xeff4('0x3e')][_0xeff4('0x40')]?_0x16abe5[_0xeff4('0x3e')]:_0x4f841a[_0xeff4('0x3a')];_0x16abe5[_0xeff4('0x53')]=qs[_0xeff4('0x42')](_0x4737f6[_0xeff4('0x3b')]['sort']);_0x16abe5[_0xeff4('0x43')]=qs[_0xeff4('0x3c')](_[_0xeff4('0x54')](_0x4737f6[_0xeff4('0x3b')],_0x4f841a[_0xeff4('0x3c')]));if(_0x4737f6[_0xeff4('0x3b')]['filter']){_0x16abe5[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0x16abe5[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0x16abe5[_0xeff4('0x3e')],function(_0x420ca7){var _0x11140e={};_0x11140e[_0x420ca7]={'$like':'%'+_0x4737f6['query']['filter']+'%'};return _0x11140e;})});}_0x16abe5=_[_0xeff4('0x45')]({},_0x16abe5,_0x4737f6[_0xeff4('0x47')]);return _0x5c7e71[_0xeff4('0x55')](_0x16abe5);}})['then'](function(_0x4ce3c9){if(_0x4ce3c9){_0x4a1823=_0x4ce3c9[_0xeff4('0x40')];if(!_0x4737f6[_0xeff4('0x3b')][_0xeff4('0x41')](_0xeff4('0x57'))){_0x16abe5[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x4737f6['query'][_0xeff4('0x2a')]);_0x16abe5['offset']=qs[_0xeff4('0x29')](_0x4737f6['query']['offset']);}return _0x5c7e71[_0xeff4('0x55')](_0x16abe5);}})[_0xeff4('0x19')](function(_0x46d8bd){if(_0x46d8bd){return _0x46d8bd?{'count':_0x4a1823,'rows':_0x46d8bd}:null;}})[_0xeff4('0x19')](respondWithResult(_0x37f2a0,null))[_0xeff4('0x24')](handleError(_0x37f2a0,null));};exports[_0xeff4('0x58')]=function(_0x3c5c1e,_0x4fee37,_0x125cfe){var _0x54559b={};var _0x552e6e={};var _0x3a3c31;var _0x1b7d2c;return db[_0xeff4('0x35')][_0xeff4('0x56')]({'where':{'id':_0x3c5c1e[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x4fee37,null))[_0xeff4('0x19')](function(_0x2fc9e6){if(_0x2fc9e6){_0x3a3c31=_0x2fc9e6;_0x552e6e[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db[_0xeff4('0x52')][_0xeff4('0x36')]);_0x552e6e[_0xeff4('0x3b')]=_[_0xeff4('0x4d')](_0x3c5c1e[_0xeff4('0x3b')]);_0x552e6e['filters']=_[_0xeff4('0x3d')](_0x552e6e[_0xeff4('0x3a')],_0x552e6e['query']);_0x54559b[_0xeff4('0x3e')]=_['intersection'](_0x552e6e[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x3c5c1e[_0xeff4('0x3b')]['fields']));_0x54559b[_0xeff4('0x3e')]=_0x54559b[_0xeff4('0x3e')][_0xeff4('0x40')]?_0x54559b[_0xeff4('0x3e')]:_0x552e6e['model'];_0x54559b[_0xeff4('0x53')]=qs['sort'](_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x42')]);_0x54559b['where']=qs[_0xeff4('0x3c')](_[_0xeff4('0x54')](_0x3c5c1e[_0xeff4('0x3b')],_0x552e6e[_0xeff4('0x3c')]));if(_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x44')]){_0x54559b[_0xeff4('0x43')]=_['merge'](_0x54559b[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0x54559b[_0xeff4('0x3e')],function(_0x32b30d){var _0x4531cf={};_0x4531cf[_0x32b30d]={'$like':'%'+_0x3c5c1e[_0xeff4('0x3b')]['filter']+'%'};return _0x4531cf;})});}_0x54559b=_[_0xeff4('0x45')]({},_0x54559b,_0x3c5c1e[_0xeff4('0x47')]);return _0x3a3c31[_0xeff4('0x58')](_0x54559b);}})['then'](function(_0x1d5f45){if(_0x1d5f45){_0x1b7d2c=_0x1d5f45[_0xeff4('0x40')];if(!_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x41')](_0xeff4('0x57'))){_0x54559b[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x2a')]);_0x54559b[_0xeff4('0x29')]=qs[_0xeff4('0x29')](_0x3c5c1e[_0xeff4('0x3b')][_0xeff4('0x29')]);}return _0x3a3c31[_0xeff4('0x58')](_0x54559b);}})[_0xeff4('0x19')](function(_0x3bb1f6){if(_0x3bb1f6){return _0x3bb1f6?{'count':_0x1b7d2c,'rows':_0x3bb1f6}:null;}})['then'](respondWithResult(_0x4fee37,null))[_0xeff4('0x24')](handleError(_0x4fee37,null));};exports[_0xeff4('0x59')]=function(_0x14e05b,_0x1d0f0e,_0x40b996){var _0x1df03e={};var _0x1da333={};var _0x441834;var _0x3f3f1d;return db[_0xeff4('0x35')][_0xeff4('0x56')]({'where':{'id':_0x14e05b[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x1d0f0e,null))[_0xeff4('0x19')](function(_0x41610c){if(_0x41610c){_0x441834=_0x41610c;_0x1da333[_0xeff4('0x3a')]=_[_0xeff4('0x4d')](db['Tag']['rawAttributes']);_0x1da333['query']=_[_0xeff4('0x4d')](_0x14e05b[_0xeff4('0x3b')]);_0x1da333[_0xeff4('0x3c')]=_[_0xeff4('0x3d')](_0x1da333[_0xeff4('0x3a')],_0x1da333[_0xeff4('0x3b')]);_0x1df03e[_0xeff4('0x3e')]=_[_0xeff4('0x3d')](_0x1da333[_0xeff4('0x3a')],qs[_0xeff4('0x3f')](_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x3f')]));_0x1df03e['attributes']=_0x1df03e['attributes'][_0xeff4('0x40')]?_0x1df03e[_0xeff4('0x3e')]:_0x1da333['model'];_0x1df03e[_0xeff4('0x53')]=qs[_0xeff4('0x42')](_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x42')]);_0x1df03e[_0xeff4('0x43')]=qs['filters'](_['pick'](_0x14e05b[_0xeff4('0x3b')],_0x1da333[_0xeff4('0x3c')]));if(_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x44')]){_0x1df03e[_0xeff4('0x43')]=_[_0xeff4('0x45')](_0x1df03e[_0xeff4('0x43')],{'$or':_[_0xeff4('0x34')](_0x1df03e[_0xeff4('0x3e')],function(_0x122af5){var _0x46e82a={};_0x46e82a[_0x122af5]={'$like':'%'+_0x14e05b['query'][_0xeff4('0x44')]+'%'};return _0x46e82a;})});}_0x1df03e=_[_0xeff4('0x45')]({},_0x1df03e,_0x14e05b[_0xeff4('0x47')]);return _0x441834['getTags'](_0x1df03e);}})['then'](function(_0x4278a9){if(_0x4278a9){_0x3f3f1d=_0x4278a9[_0xeff4('0x40')];if(!_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x41')](_0xeff4('0x57'))){_0x1df03e[_0xeff4('0x2a')]=qs[_0xeff4('0x2a')](_0x14e05b[_0xeff4('0x3b')][_0xeff4('0x2a')]);_0x1df03e['offset']=qs[_0xeff4('0x29')](_0x14e05b['query'][_0xeff4('0x29')]);}return _0x441834['getTags'](_0x1df03e);}})['then'](function(_0x232f30){if(_0x232f30){return _0x232f30?{'count':_0x3f3f1d,'rows':_0x232f30}:null;}})[_0xeff4('0x19')](respondWithResult(_0x1d0f0e,null))[_0xeff4('0x24')](handleError(_0x1d0f0e,null));};exports[_0xeff4('0x5a')]=function(_0x34ba8d,_0x56b2b0,_0x30df0a){if(_0x34ba8d[_0xeff4('0x50')]['id']){delete _0x34ba8d[_0xeff4('0x50')]['id'];}return db['ZendeskConfiguration'][_0xeff4('0x56')]({'where':{'id':_0x34ba8d[_0xeff4('0x4c')]['id']}})[_0xeff4('0x19')](handleEntityNotFound(_0x56b2b0,null))[_0xeff4('0x19')](function(_0x2360fe){if(_0x2360fe){return _0x2360fe[_0xeff4('0x5a')](_0x34ba8d[_0xeff4('0x50')][_0xeff4('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x56b2b0,null))[_0xeff4('0x24')](handleError(_0x56b2b0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8503cf5..6589abf 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 _0xcf8f=['rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','path'];(function(_0x4bcbc2,_0x46cbff){var _0xe5b888=function(_0xd3a99d){while(--_0xd3a99d){_0x4bcbc2['push'](_0x4bcbc2['shift']());}};_0xe5b888(++_0x46cbff);}(_0xcf8f,0xa5));var _0xfcf8=function(_0x4738dd,_0x2538fb){_0x4738dd=_0x4738dd-0x0;var _0x442194=_0xcf8f[_0x4738dd];return _0x442194;};'use strict';var _=require(_0xfcf8('0x0'));var util=require(_0xfcf8('0x1'));var logger=require(_0xfcf8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfcf8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf8('0x4'));var rimraf=require(_0xfcf8('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcf8('0x6'));module[_0xfcf8('0x7')]=function(_0x188cfb,_0x301f7a){return _0x188cfb[_0xfcf8('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xfcf8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c3=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash'];(function(_0x570ae4,_0x2e34d9){var _0x3d920c=function(_0x5d52cf){while(--_0x5d52cf){_0x570ae4['push'](_0x570ae4['shift']());}};_0x3d920c(++_0x2e34d9);}(_0xc1c3,0xe3));var _0x3c1c=function(_0xf50fb9,_0x1a0fc9){_0xf50fb9=_0xf50fb9-0x0;var _0x2d287e=_0xc1c3[_0xf50fb9];return _0x2d287e;};'use strict';var _=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var logger=require(_0x3c1c('0x2'))(_0x3c1c('0x3'));var moment=require(_0x3c1c('0x4'));var BPromise=require(_0x3c1c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c1c('0x6'));var config=require(_0x3c1c('0x7'));var attributes=require(_0x3c1c('0x8'));module[_0x3c1c('0x9')]=function(_0x559287,_0x62e098){return _0x559287[_0x3c1c('0xa')](_0x3c1c('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 79c9e4a..c4645c0 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 _0x8e44=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e44,0x111));var _0x48e4=function(_0x2bda7e,_0x2b6d2f){_0x2bda7e=_0x2bda7e-0x0;var _0x10a523=_0x8e44[_0x2bda7e];return _0x10a523;};'use strict';var _=require(_0x48e4('0x0'));var util=require('util');var moment=require(_0x48e4('0x1'));var BPromise=require('bluebird');var rs=require(_0x48e4('0x2'));var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48e4('0x4'))(_0x48e4('0x5'));var config=require(_0x48e4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x48e4('0x7')][_0x48e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40cbb7,_0x44a4f2,_0x22abe1){return new BPromise(function(_0x58638e,_0xefdc62){return client[_0x48e4('0x9')](_0x40cbb7,_0x22abe1)[_0x48e4('0xa')](function(_0x567a6c){logger[_0x48e4('0xb')](_0x48e4('0xc'),_0x44a4f2,_0x48e4('0xd'));logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x44a4f2,_0x48e4('0xd'),JSON[_0x48e4('0x10')](_0x567a6c));if(_0x567a6c['error']){if(_0x567a6c[_0x48e4('0x11')]['code']===0x1f4){logger['error'](_0x48e4('0xc'),_0x44a4f2,_0x567a6c['error'][_0x48e4('0x12')]);return _0xefdc62(_0x567a6c[_0x48e4('0x11')][_0x48e4('0x12')]);}logger[_0x48e4('0x11')](_0x48e4('0xc'),_0x44a4f2,_0x567a6c[_0x48e4('0x11')]['message']);return _0x58638e(_0x567a6c[_0x48e4('0x11')][_0x48e4('0x12')]);}else{logger[_0x48e4('0xb')](_0x48e4('0xc'),_0x44a4f2,_0x48e4('0xd'));_0x58638e(_0x567a6c[_0x48e4('0x13')][_0x48e4('0x12')]);}})['catch'](function(_0x24934c){logger[_0x48e4('0x11')](_0x48e4('0xc'),_0x44a4f2,_0x24934c);_0xefdc62(_0x24934c);});});} \ No newline at end of file +var _0x8156=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8156,0x7c));var _0x6815=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8156[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6815('0x0'));var util=require('util');var moment=require(_0x6815('0x1'));var BPromise=require(_0x6815('0x2'));var rs=require(_0x6815('0x3'));var fs=require('fs');var Redis=require(_0x6815('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6815('0x5'));var logger=require(_0x6815('0x6'))(_0x6815('0x7'));var config=require(_0x6815('0x8'));var jayson=require(_0x6815('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xccf76,_0x4021b6,_0x466ba2){return new BPromise(function(_0xaaa308,_0x5c3d9b){return client[_0x6815('0xa')](_0xccf76,_0x466ba2)[_0x6815('0xb')](function(_0x14da6d){logger['info'](_0x6815('0xc'),_0x4021b6,_0x6815('0xd'));logger[_0x6815('0xe')](_0x6815('0xf'),_0x4021b6,_0x6815('0xd'),JSON['stringify'](_0x14da6d));if(_0x14da6d[_0x6815('0x10')]){if(_0x14da6d[_0x6815('0x10')][_0x6815('0x11')]===0x1f4){logger['error'](_0x6815('0xc'),_0x4021b6,_0x14da6d[_0x6815('0x10')][_0x6815('0x12')]);return _0x5c3d9b(_0x14da6d[_0x6815('0x10')][_0x6815('0x12')]);}logger[_0x6815('0x10')](_0x6815('0xc'),_0x4021b6,_0x14da6d[_0x6815('0x10')]['message']);return _0xaaa308(_0x14da6d[_0x6815('0x10')]['message']);}else{logger[_0x6815('0x13')](_0x6815('0xc'),_0x4021b6,_0x6815('0xd'));_0xaaa308(_0x14da6d[_0x6815('0x14')][_0x6815('0x12')]);}})['catch'](function(_0x3fcd8d){logger[_0x6815('0x10')](_0x6815('0xc'),_0x4021b6,_0x3fcd8d);_0x5c3d9b(_0x3fcd8d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index b28dd97..17d8ae1 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 _0xe539=['post','create','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2ee5c,_0x210778){var _0x312a5b=function(_0x1e1399){while(--_0x1e1399){_0x2ee5c['push'](_0x2ee5c['shift']());}};_0x312a5b(++_0x210778);}(_0xe539,0x164));var _0x9e53=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xe539[_0x593564];return _0x211a89;};'use strict';var multer=require(_0x9e53('0x0'));var util=require('util');var path=require(_0x9e53('0x1'));var timeout=require(_0x9e53('0x2'));var express=require(_0x9e53('0x3'));var router=express[_0x9e53('0x4')]();var auth=require(_0x9e53('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e53('0x6'));router[_0x9e53('0x7')]('/',auth[_0x9e53('0x8')](),controller[_0x9e53('0x9')]);router[_0x9e53('0x7')](_0x9e53('0xa'),auth[_0x9e53('0x8')](),controller[_0x9e53('0xb')]);router[_0x9e53('0xc')]('/',auth[_0x9e53('0x8')](),controller[_0x9e53('0xd')]);router['put']('/:id',auth[_0x9e53('0x8')](),controller['update']);router[_0x9e53('0xe')](_0x9e53('0xa'),auth[_0x9e53('0x8')](),controller[_0x9e53('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbb94=['exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbb94,0xde));var _0x4bb9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbb94[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4bb9('0x0'));var timeout=require('connect-timeout');var express=require(_0x4bb9('0x1'));var router=express[_0x4bb9('0x2')]();var auth=require(_0x4bb9('0x3'));var interaction=require(_0x4bb9('0x4'));var config=require(_0x4bb9('0x5'));var controller=require(_0x4bb9('0x6'));router[_0x4bb9('0x7')]('/',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0x9')]);router['get'](_0x4bb9('0xa'),auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xb')]);router['post']('/',auth[_0x4bb9('0x8')](),controller[_0x4bb9('0xc')]);router['put'](_0x4bb9('0xa'),auth['isAuthenticated'](),controller[_0x4bb9('0xd')]);router[_0x4bb9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4bb9('0xf')]);module[_0x4bb9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4aaac48..152ff2a 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 _0xdf70=['ENUM','variable','customVariable','string','STRING','BOOLEAN','sequelize','exports'];(function(_0xed6ed0,_0x28e1ad){var _0x20a428=function(_0x5b2603){while(--_0x5b2603){_0xed6ed0['push'](_0xed6ed0['shift']());}};_0x20a428(++_0x28e1ad);}(_0xdf70,0x86));var _0x0df7=function(_0x4d6ffd,_0x3f5780){_0x4d6ffd=_0x4d6ffd-0x0;var _0x406b81=_0xdf70[_0x4d6ffd];return _0x406b81;};'use strict';var Sequelize=require(_0x0df7('0x0'));module[_0x0df7('0x1')]={'type':{'type':Sequelize[_0x0df7('0x2')]('string',_0x0df7('0x3'),_0x0df7('0x4'),'keyValue'),'defaultValue':_0x0df7('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0df7('0x6')]},'keyType':{'type':Sequelize[_0x0df7('0x2')]('string',_0x0df7('0x3'),_0x0df7('0x4'))},'keyContent':{'type':Sequelize[_0x0df7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0df7('0x6')]},'customField':{'type':Sequelize[_0x0df7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0df7('0x6')]}}; \ No newline at end of file +var _0xe233=['variable','customVariable','BOOLEAN','sequelize','string','keyValue','STRING','ENUM'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xe233,0x15b));var _0x3e23=function(_0x3c0232,_0x4ad683){_0x3c0232=_0x3c0232-0x0;var _0x48aecf=_0xe233[_0x3c0232];return _0x48aecf;};'use strict';var Sequelize=require(_0x3e23('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3e23('0x1'),'variable','customVariable',_0x3e23('0x2')),'defaultValue':_0x3e23('0x1')},'content':{'type':Sequelize[_0x3e23('0x3')]},'key':{'type':Sequelize[_0x3e23('0x3')]},'keyType':{'type':Sequelize[_0x3e23('0x4')]('string',_0x3e23('0x5'),_0x3e23('0x6'))},'keyContent':{'type':Sequelize[_0x3e23('0x3')]},'idField':{'type':Sequelize[_0x3e23('0x3')]},'nameField':{'type':Sequelize[_0x3e23('0x3')]},'customField':{'type':Sequelize[_0x3e23('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e23('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 53013f2..892989e 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 _0x2542=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','error','stack','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x535c71,_0x267beb){var _0x2729dd=function(_0x38f4ae){while(--_0x38f4ae){_0x535c71['push'](_0x535c71['shift']());}};_0x2729dd(++_0x267beb);}(_0x2542,0x169));var _0x2254=function(_0x139c39,_0xc46751){_0x139c39=_0x139c39-0x0;var _0xdb9b55=_0x2542[_0x139c39];return _0xdb9b55;};'use strict';var pdf=require(_0x2254('0x0'));var emlformat=require(_0x2254('0x1'));var rimraf=require(_0x2254('0x2'));var zipdir=require(_0x2254('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2254('0x4'));var moment=require('moment');var BPromise=require(_0x2254('0x5'));var Mustache=require(_0x2254('0x6'));var util=require(_0x2254('0x7'));var path=require(_0x2254('0x8'));var sox=require(_0x2254('0x9'));var csv=require('to-csv');var ejs=require(_0x2254('0xa'));var fs=require('fs');var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x10'));var querystring=require(_0x2254('0x11'));var Papa=require(_0x2254('0x12'));var Redis=require(_0x2254('0x13'));var authService=require(_0x2254('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x15'));var hardwareService=require(_0x2254('0x16'));var logger=require(_0x2254('0x17'))(_0x2254('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x19'));var db=require(_0x2254('0x1a'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1b')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1c')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1d')](_0x504749)[_0x2254('0x1e')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=_0xbc5548[_0x2254('0x1f')],_0x18baf4=_0x26285a[_0x2254('0x20')],_0x57247a=_0x26285a[_0x2254('0x20')]+_0x26285a[_0x2254('0x21')],_0x327d6d;if(_0x57247a>=_0x50f137){_0x57247a=_0x50f137;_0x327d6d=0xc8;}else{_0x327d6d=0xce;}_0x145272[_0x2254('0x1d')](_0x327d6d);return _0x145272['set']('Content-Range',_0x18baf4+'-'+_0x57247a+'/'+_0x50f137)['json'](_0xbc5548);}return null;};}function patchUpdates(_0xb05559){return function(_0x3a79f8){try{jsonpatch[_0x2254('0x22')](_0x3a79f8,_0xb05559,!![]);}catch(_0x1f1163){return BPromise[_0x2254('0x23')](_0x1f1163);}return _0x3a79f8[_0x2254('0x24')]();};}function saveUpdates(_0x487f72,_0x28381e){return function(_0x16148d){if(_0x16148d){return _0x16148d[_0x2254('0x25')](_0x487f72)['then'](function(_0x52fedc){return _0x52fedc;});}return null;};}function removeEntity(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x26')]()['then'](function(){_0x5bd982['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x540020,_0x5e5edb){return function(_0x4f797d){if(!_0x4f797d){_0x540020[_0x2254('0x1b')](0x194);}return _0x4f797d;};}function handleError(_0x9d6ccf,_0x2f3037){_0x2f3037=_0x2f3037||0x1f4;return function(_0x265467){logger[_0x2254('0x27')](_0x265467[_0x2254('0x28')]);if(_0x265467['name']){delete _0x265467['name'];}_0x9d6ccf[_0x2254('0x1d')](_0x2f3037)['send'](_0x265467);};}exports[_0x2254('0x29')]=function(_0x141dc5,_0x31a543){var _0x3aa0bd={},_0x19043b={},_0x482688={'count':0x0,'rows':[]};var _0x1a8a0d=_[_0x2254('0x2a')](db[_0x2254('0x2b')][_0x2254('0x2c')],function(_0x13366a){return{'name':_0x13366a[_0x2254('0x2d')],'type':_0x13366a[_0x2254('0x2e')][_0x2254('0x2f')]};});_0x19043b[_0x2254('0x30')]=_[_0x2254('0x2a')](_0x1a8a0d,_0x2254('0x31'));_0x19043b[_0x2254('0x32')]=_[_0x2254('0x33')](_0x141dc5[_0x2254('0x32')]);_0x19043b[_0x2254('0x34')]=_[_0x2254('0x35')](_0x19043b[_0x2254('0x30')],_0x19043b[_0x2254('0x32')]);_0x3aa0bd[_0x2254('0x36')]=_['intersection'](_0x19043b[_0x2254('0x30')],qs[_0x2254('0x37')](_0x141dc5[_0x2254('0x32')][_0x2254('0x37')]));_0x3aa0bd[_0x2254('0x36')]=_0x3aa0bd[_0x2254('0x36')][_0x2254('0x38')]?_0x3aa0bd[_0x2254('0x36')]:_0x19043b[_0x2254('0x30')];if(!_0x141dc5['query'][_0x2254('0x39')](_0x2254('0x3a'))){_0x3aa0bd['limit']=qs[_0x2254('0x21')](_0x141dc5[_0x2254('0x32')][_0x2254('0x21')]);_0x3aa0bd[_0x2254('0x20')]=qs['offset'](_0x141dc5['query'][_0x2254('0x20')]);}_0x3aa0bd['order']=qs[_0x2254('0x3b')](_0x141dc5[_0x2254('0x32')][_0x2254('0x3b')]);_0x3aa0bd[_0x2254('0x3c')]=qs[_0x2254('0x34')](_[_0x2254('0x3d')](_0x141dc5[_0x2254('0x32')],_0x19043b['filters']),_0x1a8a0d);if(_0x141dc5[_0x2254('0x32')][_0x2254('0x3e')]){_0x3aa0bd[_0x2254('0x3c')]=_[_0x2254('0x3f')](_0x3aa0bd[_0x2254('0x3c')],{'$or':_[_0x2254('0x2a')](_0x1a8a0d,function(_0x3e7ccb){if(_0x3e7ccb[_0x2254('0x2e')]!==_0x2254('0x40')){var _0x34543d={};_0x34543d[_0x3e7ccb['name']]={'$like':'%'+_0x141dc5[_0x2254('0x32')][_0x2254('0x3e')]+'%'};return _0x34543d;}})});}_0x3aa0bd=_[_0x2254('0x3f')]({},_0x3aa0bd,_0x141dc5[_0x2254('0x41')]);var _0x4c7cc3={'where':_0x3aa0bd[_0x2254('0x3c')]};return db[_0x2254('0x2b')][_0x2254('0x1f')](_0x4c7cc3)[_0x2254('0x42')](function(_0x216199){_0x482688[_0x2254('0x1f')]=_0x216199;if(_0x141dc5[_0x2254('0x32')][_0x2254('0x43')]){_0x3aa0bd['include']=[{'all':!![]}];}return db[_0x2254('0x2b')]['findAll'](_0x3aa0bd);})[_0x2254('0x42')](function(_0x19b580){_0x482688[_0x2254('0x44')]=_0x19b580;return _0x482688;})[_0x2254('0x42')](respondWithFilteredResult(_0x31a543,_0x3aa0bd))[_0x2254('0x45')](handleError(_0x31a543,null));};exports[_0x2254('0x46')]=function(_0x1c9a27,_0x568ec9){var _0x3025ee={'raw':!![],'where':{'id':_0x1c9a27[_0x2254('0x47')]['id']}},_0x2f1ff9={};_0x2f1ff9[_0x2254('0x30')]=_[_0x2254('0x33')](db['ZendeskField'][_0x2254('0x2c')]);_0x2f1ff9[_0x2254('0x32')]=_[_0x2254('0x33')](_0x1c9a27[_0x2254('0x32')]);_0x2f1ff9[_0x2254('0x34')]=_['intersection'](_0x2f1ff9[_0x2254('0x30')],_0x2f1ff9['query']);_0x3025ee[_0x2254('0x36')]=_[_0x2254('0x35')](_0x2f1ff9[_0x2254('0x30')],qs[_0x2254('0x37')](_0x1c9a27[_0x2254('0x32')][_0x2254('0x37')]));_0x3025ee[_0x2254('0x36')]=_0x3025ee[_0x2254('0x36')][_0x2254('0x38')]?_0x3025ee[_0x2254('0x36')]:_0x2f1ff9[_0x2254('0x30')];if(_0x1c9a27[_0x2254('0x32')][_0x2254('0x43')]){_0x3025ee['include']=[{'all':!![]}];}_0x3025ee=_[_0x2254('0x3f')]({},_0x3025ee,_0x1c9a27[_0x2254('0x41')]);return db[_0x2254('0x2b')]['find'](_0x3025ee)[_0x2254('0x42')](handleEntityNotFound(_0x568ec9,null))[_0x2254('0x42')](respondWithResult(_0x568ec9,null))[_0x2254('0x45')](handleError(_0x568ec9,null));};exports[_0x2254('0x48')]=function(_0x2e6603,_0x470241){return db[_0x2254('0x2b')][_0x2254('0x48')](_0x2e6603[_0x2254('0x49')],{})['then'](respondWithResult(_0x470241,0xc9))[_0x2254('0x45')](handleError(_0x470241,null));};exports[_0x2254('0x25')]=function(_0x2c3055,_0x32515f){if(_0x2c3055[_0x2254('0x49')]['id']){delete _0x2c3055[_0x2254('0x49')]['id'];}return db[_0x2254('0x2b')][_0x2254('0x4a')]({'where':{'id':_0x2c3055[_0x2254('0x47')]['id']}})[_0x2254('0x42')](handleEntityNotFound(_0x32515f,null))['then'](saveUpdates(_0x2c3055[_0x2254('0x49')],null))[_0x2254('0x42')](respondWithResult(_0x32515f,null))['catch'](handleError(_0x32515f,null));};exports[_0x2254('0x26')]=function(_0x143bd2,_0x12e2ff){return db[_0x2254('0x2b')]['find']({'where':{'id':_0x143bd2[_0x2254('0x47')]['id']}})[_0x2254('0x42')](handleEntityNotFound(_0x12e2ff,null))['then'](removeEntity(_0x12e2ff,null))[_0x2254('0x45')](handleError(_0x12e2ff,null));}; \ No newline at end of file +var _0x524e=['rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','ZendeskField','count','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x2cffb9,_0x523e9f){var _0x597d66=function(_0x47dab7){while(--_0x47dab7){_0x2cffb9['push'](_0x2cffb9['shift']());}};_0x597d66(++_0x523e9f);}(_0x524e,0x15e));var _0xe524=function(_0x2a89d7,_0x4a10cc){_0x2a89d7=_0x2a89d7-0x0;var _0x4a3078=_0x524e[_0x2a89d7];return _0x4a3078;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1d')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1e')](_0x4b0f51)[_0xe524('0x1f')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x20')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=_0x569660['count'],_0x109795=_0x48165e['offset'],_0x538754=_0x48165e['offset']+_0x48165e[_0xe524('0x21')],_0x29a031;if(_0x538754>=_0x488fce){_0x538754=_0x488fce;_0x29a031=0xc8;}else{_0x29a031=0xce;}_0x1b0af6['status'](_0x29a031);return _0x1b0af6[_0xe524('0x22')](_0xe524('0x23'),_0x109795+'-'+_0x538754+'/'+_0x488fce)[_0xe524('0x20')](_0x569660);}return null;};}function patchUpdates(_0x209d0b){return function(_0x5d7b17){try{jsonpatch[_0xe524('0x24')](_0x5d7b17,_0x209d0b,!![]);}catch(_0x3ccb3f){return BPromise['reject'](_0x3ccb3f);}return _0x5d7b17[_0xe524('0x25')]();};}function saveUpdates(_0x309f85,_0x43a4f9){return function(_0x1dcc0f){if(_0x1dcc0f){return _0x1dcc0f[_0xe524('0x26')](_0x309f85)[_0xe524('0x27')](function(_0xbf059b){return _0xbf059b;});}return null;};}function removeEntity(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x28')]()['then'](function(){_0x375219['status'](0xcc)[_0xe524('0x1f')]();});}};}function handleEntityNotFound(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(!_0x85fc51){_0x23df5e['sendStatus'](0x194);}return _0x85fc51;};}function handleError(_0x158f07,_0x4a03bc){_0x4a03bc=_0x4a03bc||0x1f4;return function(_0x17e245){logger[_0xe524('0x29')](_0x17e245[_0xe524('0x2a')]);if(_0x17e245[_0xe524('0x2b')]){delete _0x17e245[_0xe524('0x2b')];}_0x158f07[_0xe524('0x1e')](_0x4a03bc)[_0xe524('0x2c')](_0x17e245);};}exports['index']=function(_0x58a896,_0x283f18){var _0x45abad={},_0x476572={},_0x109a96={'count':0x0,'rows':[]};var _0x359c8b=_['map'](db['ZendeskField'][_0xe524('0x2d')],function(_0x25e7a7){return{'name':_0x25e7a7[_0xe524('0x2e')],'type':_0x25e7a7[_0xe524('0x2f')][_0xe524('0x30')]};});_0x476572['model']=_[_0xe524('0x31')](_0x359c8b,_0xe524('0x2b'));_0x476572['query']=_['keys'](_0x58a896[_0xe524('0x32')]);_0x476572[_0xe524('0x33')]=_['intersection'](_0x476572[_0xe524('0x34')],_0x476572['query']);_0x45abad[_0xe524('0x35')]=_['intersection'](_0x476572[_0xe524('0x34')],qs[_0xe524('0x36')](_0x58a896[_0xe524('0x32')]['fields']));_0x45abad[_0xe524('0x35')]=_0x45abad['attributes'][_0xe524('0x37')]?_0x45abad[_0xe524('0x35')]:_0x476572[_0xe524('0x34')];if(!_0x58a896['query'][_0xe524('0x38')](_0xe524('0x39'))){_0x45abad['limit']=qs[_0xe524('0x21')](_0x58a896[_0xe524('0x32')][_0xe524('0x21')]);_0x45abad[_0xe524('0x3a')]=qs['offset'](_0x58a896[_0xe524('0x32')][_0xe524('0x3a')]);}_0x45abad[_0xe524('0x3b')]=qs[_0xe524('0x3c')](_0x58a896[_0xe524('0x32')][_0xe524('0x3c')]);_0x45abad[_0xe524('0x3d')]=qs[_0xe524('0x33')](_['pick'](_0x58a896[_0xe524('0x32')],_0x476572['filters']),_0x359c8b);if(_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]){_0x45abad['where']=_[_0xe524('0x3f')](_0x45abad['where'],{'$or':_[_0xe524('0x31')](_0x359c8b,function(_0x41af26){if(_0x41af26[_0xe524('0x2f')]!==_0xe524('0x40')){var _0x82a87b={};_0x82a87b[_0x41af26[_0xe524('0x2b')]]={'$like':'%'+_0x58a896[_0xe524('0x32')][_0xe524('0x3e')]+'%'};return _0x82a87b;}})});}_0x45abad=_['merge']({},_0x45abad,_0x58a896[_0xe524('0x41')]);var _0x940c05={'where':_0x45abad[_0xe524('0x3d')]};return db[_0xe524('0x42')][_0xe524('0x43')](_0x940c05)[_0xe524('0x27')](function(_0x1d9648){_0x109a96[_0xe524('0x43')]=_0x1d9648;if(_0x58a896['query'][_0xe524('0x44')]){_0x45abad[_0xe524('0x45')]=[{'all':!![]}];}return db[_0xe524('0x42')]['findAll'](_0x45abad);})[_0xe524('0x27')](function(_0x5213ed){_0x109a96[_0xe524('0x46')]=_0x5213ed;return _0x109a96;})[_0xe524('0x27')](respondWithFilteredResult(_0x283f18,_0x45abad))[_0xe524('0x47')](handleError(_0x283f18,null));};exports[_0xe524('0x48')]=function(_0x27a9e5,_0x4746cd){var _0xbeb2a9={'raw':!![],'where':{'id':_0x27a9e5[_0xe524('0x49')]['id']}},_0x52cd0e={};_0x52cd0e[_0xe524('0x34')]=_[_0xe524('0x4a')](db[_0xe524('0x42')][_0xe524('0x2d')]);_0x52cd0e[_0xe524('0x32')]=_['keys'](_0x27a9e5[_0xe524('0x32')]);_0x52cd0e[_0xe524('0x33')]=_[_0xe524('0x4b')](_0x52cd0e['model'],_0x52cd0e[_0xe524('0x32')]);_0xbeb2a9['attributes']=_['intersection'](_0x52cd0e[_0xe524('0x34')],qs[_0xe524('0x36')](_0x27a9e5['query'][_0xe524('0x36')]));_0xbeb2a9[_0xe524('0x35')]=_0xbeb2a9[_0xe524('0x35')][_0xe524('0x37')]?_0xbeb2a9['attributes']:_0x52cd0e['model'];if(_0x27a9e5[_0xe524('0x32')][_0xe524('0x44')]){_0xbeb2a9['include']=[{'all':!![]}];}_0xbeb2a9=_[_0xe524('0x3f')]({},_0xbeb2a9,_0x27a9e5['options']);return db[_0xe524('0x42')][_0xe524('0x4c')](_0xbeb2a9)[_0xe524('0x27')](handleEntityNotFound(_0x4746cd,null))[_0xe524('0x27')](respondWithResult(_0x4746cd,null))[_0xe524('0x47')](handleError(_0x4746cd,null));};exports[_0xe524('0x4d')]=function(_0x305503,_0x22fb42){return db[_0xe524('0x42')][_0xe524('0x4d')](_0x305503[_0xe524('0x4e')],{})[_0xe524('0x27')](respondWithResult(_0x22fb42,0xc9))[_0xe524('0x47')](handleError(_0x22fb42,null));};exports[_0xe524('0x26')]=function(_0x37d44d,_0x4dff40){if(_0x37d44d[_0xe524('0x4e')]['id']){delete _0x37d44d['body']['id'];}return db['ZendeskField'][_0xe524('0x4c')]({'where':{'id':_0x37d44d['params']['id']}})[_0xe524('0x27')](handleEntityNotFound(_0x4dff40,null))[_0xe524('0x27')](saveUpdates(_0x37d44d['body'],null))[_0xe524('0x27')](respondWithResult(_0x4dff40,null))['catch'](handleError(_0x4dff40,null));};exports['destroy']=function(_0x2fa574,_0x1e5687){return db[_0xe524('0x42')]['find']({'where':{'id':_0x2fa574['params']['id']}})['then'](handleEntityNotFound(_0x1e5687,null))['then'](removeEntity(_0x1e5687,null))['catch'](handleError(_0x1e5687,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a6bd8cb..7d74934 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 _0x12c9=['ZendeskField','int_zendesk_fields','idField','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x197aee,_0x55f0eb){var _0x453a1b=function(_0x533c39){while(--_0x533c39){_0x197aee['push'](_0x197aee['shift']());}};_0x453a1b(++_0x55f0eb);}(_0x12c9,0x9f));var _0x912c=function(_0x1eb8c1,_0x39ac08){_0x1eb8c1=_0x1eb8c1-0x0;var _0xabbaa2=_0x12c9[_0x1eb8c1];return _0xabbaa2;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var logger=require(_0x912c('0x1'))('api');var moment=require(_0x912c('0x2'));var BPromise=require('bluebird');var rp=require(_0x912c('0x3'));var fs=require('fs');var path=require(_0x912c('0x4'));var rimraf=require(_0x912c('0x5'));var config=require(_0x912c('0x6'));var attributes=require(_0x912c('0x7'));module[_0x912c('0x8')]=function(_0x572179,_0x5daa7d){return _0x572179[_0x912c('0x9')](_0x912c('0xa'),attributes,{'tableName':_0x912c('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x912c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b6c=['rimraf','../../config/environment','exports','define','int_zendesk_fields','FieldId','lodash','util','api','moment','bluebird','path'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b6('0x0'));var util=require(_0xc4b6('0x1'));var logger=require('../../config/logger')(_0xc4b6('0x2'));var moment=require(_0xc4b6('0x3'));var BPromise=require(_0xc4b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4b6('0x5'));var rimraf=require(_0xc4b6('0x6'));var config=require(_0xc4b6('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xc4b6('0x8')]=function(_0x1d5e09,_0x21f368){return _0x1d5e09[_0xc4b6('0x9')]('ZendeskField',attributes,{'tableName':_0xc4b6('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xc4b6('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 55870d3..da0f653 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 _0x8e71=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','message','ZendeskField,\x20%s,\x20%s','catch','lodash'];(function(_0x223e07,_0x49ee45){var _0x4633a5=function(_0x404c07){while(--_0x404c07){_0x223e07['push'](_0x223e07['shift']());}};_0x4633a5(++_0x49ee45);}(_0x8e71,0x1a3));var _0x18e7=function(_0x28d31d,_0x57a4e6){_0x28d31d=_0x28d31d-0x0;var _0x2df7c1=_0x8e71[_0x28d31d];return _0x2df7c1;};'use strict';var _=require(_0x18e7('0x0'));var util=require(_0x18e7('0x1'));var moment=require('moment');var BPromise=require(_0x18e7('0x2'));var rs=require(_0x18e7('0x3'));var fs=require('fs');var Redis=require(_0x18e7('0x4'));var db=require(_0x18e7('0x5'))['db'];var utils=require(_0x18e7('0x6'));var logger=require(_0x18e7('0x7'))(_0x18e7('0x8'));var config=require(_0x18e7('0x9'));var jayson=require(_0x18e7('0xa'));var client=jayson[_0x18e7('0xb')][_0x18e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e8516,_0x9275d1,_0x178be4){return new BPromise(function(_0x7b2fc9,_0x545697){return client['request'](_0x3e8516,_0x178be4)[_0x18e7('0xd')](function(_0x53a5f5){logger['info']('ZendeskField,\x20%s,\x20%s',_0x9275d1,_0x18e7('0xe'));logger[_0x18e7('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x9275d1,'request\x20sent',JSON['stringify'](_0x53a5f5));if(_0x53a5f5[_0x18e7('0x10')]){if(_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x9275d1,_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x12')]);return _0x545697(_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x12')]);}logger[_0x18e7('0x10')](_0x18e7('0x13'),_0x9275d1,_0x53a5f5[_0x18e7('0x10')][_0x18e7('0x12')]);return _0x7b2fc9(_0x53a5f5['error']['message']);}else{logger['info'](_0x18e7('0x13'),_0x9275d1,_0x18e7('0xe'));_0x7b2fc9(_0x53a5f5['result'][_0x18e7('0x12')]);}})[_0x18e7('0x14')](function(_0x53200b){logger[_0x18e7('0x10')](_0x18e7('0x13'),_0x9275d1,_0x53200b);_0x545697(_0x53200b);});});} \ No newline at end of file +var _0x0a2c=['request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s'];(function(_0x5295a9,_0x2881d6){var _0x455975=function(_0x478fca){while(--_0x478fca){_0x5295a9['push'](_0x5295a9['shift']());}};_0x455975(++_0x2881d6);}(_0x0a2c,0x1ea));var _0xc0a2=function(_0x2210b9,_0x3dcd57){_0x2210b9=_0x2210b9-0x0;var _0x4081fe=_0x0a2c[_0x2210b9];return _0x4081fe;};'use strict';var _=require(_0xc0a2('0x0'));var util=require(_0xc0a2('0x1'));var moment=require('moment');var BPromise=require(_0xc0a2('0x2'));var rs=require(_0xc0a2('0x3'));var fs=require('fs');var Redis=require(_0xc0a2('0x4'));var db=require(_0xc0a2('0x5'))['db'];var utils=require(_0xc0a2('0x6'));var logger=require('../../config/logger')(_0xc0a2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc0a2('0x8'));var client=jayson[_0xc0a2('0x9')][_0xc0a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219afb,_0x49f24a,_0x3b7f9f){return new BPromise(function(_0x536b8d,_0x3fe55c){return client[_0xc0a2('0xb')](_0x219afb,_0x3b7f9f)['then'](function(_0x5f26c2){logger[_0xc0a2('0xc')](_0xc0a2('0xd'),_0x49f24a,_0xc0a2('0xe'));logger['debug'](_0xc0a2('0xf'),_0x49f24a,'request\x20sent',JSON[_0xc0a2('0x10')](_0x5f26c2));if(_0x5f26c2[_0xc0a2('0x11')]){if(_0x5f26c2['error'][_0xc0a2('0x12')]===0x1f4){logger[_0xc0a2('0x11')](_0xc0a2('0xd'),_0x49f24a,_0x5f26c2[_0xc0a2('0x11')][_0xc0a2('0x13')]);return _0x3fe55c(_0x5f26c2[_0xc0a2('0x11')]['message']);}logger[_0xc0a2('0x11')](_0xc0a2('0xd'),_0x49f24a,_0x5f26c2['error'][_0xc0a2('0x13')]);return _0x536b8d(_0x5f26c2[_0xc0a2('0x11')][_0xc0a2('0x13')]);}else{logger[_0xc0a2('0xc')]('ZendeskField,\x20%s,\x20%s',_0x49f24a,'request\x20sent');_0x536b8d(_0x5f26c2['result']['message']);}})[_0xc0a2('0x14')](function(_0x277647){logger[_0xc0a2('0x11')]('ZendeskField,\x20%s,\x20%s',_0x49f24a,_0x277647);_0x3fe55c(_0x277647);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f047bdb..f77b996 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(_0x794b29,_0xc016b1){var _0x18005b=function(_0x20887e){while(--_0x20887e){_0x794b29['push'](_0x794b29['shift']());}};_0x18005b(++_0xc016b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x4fc675,_0x184e51){var _0x11d333=function(_0x3fce63){while(--_0x3fce63){_0x4fc675['push'](_0x4fc675['shift']());}};_0x11d333(++_0x184e51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 ff6e9f7..eb824fd 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 _0x653a=['STRING','sequelize','exports'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0x653a,0x133));var _0xa653=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x653a[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0xa653('0x0'));module[_0xa653('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa653('0x2')]},'host':{'type':Sequelize[_0xa653('0x2')]},'zone':{'type':Sequelize[_0xa653('0x2')]},'clientId':{'type':Sequelize[_0xa653('0x2')]},'clientSecret':{'type':Sequelize[_0xa653('0x2')]},'serverUrl':{'type':Sequelize[_0xa653('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa653('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2938=['STRING','exports'];(function(_0x17365a,_0x5d3831){var _0x14db7d=function(_0x2f5905){while(--_0x2f5905){_0x17365a['push'](_0x17365a['shift']());}};_0x14db7d(++_0x5d3831);}(_0x2938,0x101));var _0x8293=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2938[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x8293('0x0')]={'name':{'type':Sequelize[_0x8293('0x1')]},'description':{'type':Sequelize[_0x8293('0x1')]},'host':{'type':Sequelize[_0x8293('0x1')]},'zone':{'type':Sequelize[_0x8293('0x1')]},'clientId':{'type':Sequelize[_0x8293('0x1')]},'clientSecret':{'type':Sequelize[_0x8293('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x8293('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 4e05955..264eb84 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 _0x75dd=['https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','name','send','map','type','key','model','query','keys','intersection','attributes','fields','length','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','ZohoAccount','rows','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x75dd,0x1c9));var _0xd75d=function(_0x1e6e07,_0x372e98){_0x1e6e07=_0x1e6e07-0x0;var _0x4b3b9d=_0x75dd[_0x1e6e07];return _0x4b3b9d;};'use strict';var pdf=require(_0xd75d('0x0'));var emlformat=require(_0xd75d('0x1'));var rimraf=require(_0xd75d('0x2'));var zipdir=require(_0xd75d('0x3'));var jsonpatch=require(_0xd75d('0x4'));var rp=require(_0xd75d('0x5'));var moment=require('moment');var BPromise=require(_0xd75d('0x6'));var Mustache=require(_0xd75d('0x7'));var util=require(_0xd75d('0x8'));var path=require(_0xd75d('0x9'));var sox=require(_0xd75d('0xa'));var csv=require(_0xd75d('0xb'));var ejs=require(_0xd75d('0xc'));var fs=require('fs');var _=require(_0xd75d('0xd'));var squel=require('squel');var crypto=require(_0xd75d('0xe'));var jsforce=require(_0xd75d('0xf'));var deskjs=require(_0xd75d('0x10'));var toCsv=require(_0xd75d('0xb'));var querystring=require('querystring');var Papa=require(_0xd75d('0x11'));var Redis=require(_0xd75d('0x12'));var authService=require(_0xd75d('0x13'));var qs=require(_0xd75d('0x14'));var as=require(_0xd75d('0x15'));var hardwareService=require(_0xd75d('0x16'));var logger=require(_0xd75d('0x17'))(_0xd75d('0x18'));var utils=require('../../config/utils');var config=require(_0xd75d('0x19'));var licenseUtil=require(_0xd75d('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd75d('0x1b'));var jayson=require(_0xd75d('0x1c'));var client=jayson['client'][_0xd75d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x44164,_0x4aa031,_0x5d9e8c,_0x1af9dd){return new BPromise(function(_0x3082bc,_0x3f5d9a){var _0x49bcf8=_0x1af9dd||client;return _0x49bcf8[_0xd75d('0x1e')](_0x44164,_0x5d9e8c)['then'](function(_0x54bf05){logger['info'](_0xd75d('0x1f'),_0x4aa031,_0xd75d('0x20'));logger[_0xd75d('0x21')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4aa031,_0xd75d('0x20'),JSON[_0xd75d('0x22')](_0x54bf05));if(_0x54bf05[_0xd75d('0x23')]){if(_0x54bf05['error'][_0xd75d('0x24')]===0x1f4){logger['error'](_0xd75d('0x1f'),_0x4aa031,_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);return _0x3f5d9a(_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);}logger[_0xd75d('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x4aa031,_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);return _0x3082bc(_0x54bf05[_0xd75d('0x23')][_0xd75d('0x25')]);}else{logger[_0xd75d('0x26')](_0xd75d('0x1f'),_0x4aa031,_0xd75d('0x20'));_0x3082bc(_0x54bf05[_0xd75d('0x27')][_0xd75d('0x25')]);}})[_0xd75d('0x28')](function(_0x5d740d){logger[_0xd75d('0x23')](_0xd75d('0x1f'),_0x4aa031,_0x5d740d);_0x3f5d9a(_0x5d740d);});});}function respondWithStatusCode(_0x96e5b4,_0x138be8){_0x138be8=_0x138be8||0xcc;return function(_0x4ea4cd){if(_0x4ea4cd){return _0x96e5b4['sendStatus'](_0x138be8);}return _0x96e5b4[_0xd75d('0x29')](_0x138be8)[_0xd75d('0x2a')]();};}function respondWithResult(_0x3db450,_0x5c0f97){_0x5c0f97=_0x5c0f97||0xc8;return function(_0x165acb){if(_0x165acb){return _0x3db450[_0xd75d('0x29')](_0x5c0f97)[_0xd75d('0x2b')](_0x165acb);}};}function respondWithFilteredResult(_0x148992,_0x1945b5){return function(_0x3e425b){if(_0x3e425b){var _0x43ab02=_0x3e425b[_0xd75d('0x2c')],_0x59387f=_0x1945b5['offset'],_0xd1c0ae=_0x1945b5['offset']+_0x1945b5[_0xd75d('0x2d')],_0x544caf;if(_0xd1c0ae>=_0x43ab02){_0xd1c0ae=_0x43ab02;_0x544caf=0xc8;}else{_0x544caf=0xce;}_0x148992['status'](_0x544caf);return _0x148992['set'](_0xd75d('0x2e'),_0x59387f+'-'+_0xd1c0ae+'/'+_0x43ab02)[_0xd75d('0x2b')](_0x3e425b);}return null;};}function patchUpdates(_0x72920a){return function(_0x500e8f){try{jsonpatch[_0xd75d('0x2f')](_0x500e8f,_0x72920a,!![]);}catch(_0x11eac3){return BPromise[_0xd75d('0x30')](_0x11eac3);}return _0x500e8f[_0xd75d('0x31')]();};}function saveUpdates(_0x57654b,_0x30efc4){return function(_0x36608e){if(_0x36608e){return _0x36608e[_0xd75d('0x32')](_0x57654b)['then'](function(_0x42bbec){return _0x42bbec;});}return null;};}function removeEntity(_0x5bf955,_0x2456dc){return function(_0x1c7a5f){if(_0x1c7a5f){return _0x1c7a5f[_0xd75d('0x33')]()[_0xd75d('0x34')](function(){_0x5bf955[_0xd75d('0x29')](0xcc)[_0xd75d('0x2a')]();});}};}function handleEntityNotFound(_0x259fea,_0x11baa2){return function(_0x57e0a1){if(!_0x57e0a1){_0x259fea[_0xd75d('0x35')](0x194);}return _0x57e0a1;};}function handleError(_0x2a980,_0x3c9d9c){_0x3c9d9c=_0x3c9d9c||0x1f4;return function(_0x249d83){logger[_0xd75d('0x23')](_0x249d83['stack']);if(_0x249d83[_0xd75d('0x36')]){delete _0x249d83[_0xd75d('0x36')];}_0x2a980[_0xd75d('0x29')](_0x3c9d9c)[_0xd75d('0x37')](_0x249d83);};}exports['index']=function(_0x98985a,_0x45e66b){var _0x20ab46={},_0x21bc4b={},_0x5192e7={'count':0x0,'rows':[]};var _0x3e5312=_[_0xd75d('0x38')](db['ZohoAccount']['rawAttributes'],function(_0x12b9c7){return{'name':_0x12b9c7['fieldName'],'type':_0x12b9c7[_0xd75d('0x39')][_0xd75d('0x3a')]};});_0x21bc4b[_0xd75d('0x3b')]=_[_0xd75d('0x38')](_0x3e5312,_0xd75d('0x36'));_0x21bc4b[_0xd75d('0x3c')]=_[_0xd75d('0x3d')](_0x98985a[_0xd75d('0x3c')]);_0x21bc4b['filters']=_[_0xd75d('0x3e')](_0x21bc4b[_0xd75d('0x3b')],_0x21bc4b['query']);_0x20ab46[_0xd75d('0x3f')]=_[_0xd75d('0x3e')](_0x21bc4b[_0xd75d('0x3b')],qs[_0xd75d('0x40')](_0x98985a['query'][_0xd75d('0x40')]));_0x20ab46[_0xd75d('0x3f')]=_0x20ab46[_0xd75d('0x3f')][_0xd75d('0x41')]?_0x20ab46[_0xd75d('0x3f')]:_0x21bc4b[_0xd75d('0x3b')];if(!_0x98985a['query']['hasOwnProperty']('nolimit')){_0x20ab46[_0xd75d('0x2d')]=qs[_0xd75d('0x2d')](_0x98985a['query'][_0xd75d('0x2d')]);_0x20ab46[_0xd75d('0x42')]=qs[_0xd75d('0x42')](_0x98985a['query'][_0xd75d('0x42')]);}_0x20ab46[_0xd75d('0x43')]=qs[_0xd75d('0x44')](_0x98985a[_0xd75d('0x3c')][_0xd75d('0x44')]);_0x20ab46[_0xd75d('0x45')]=qs['filters'](_[_0xd75d('0x46')](_0x98985a[_0xd75d('0x3c')],_0x21bc4b[_0xd75d('0x47')]),_0x3e5312);if(_0x98985a['query'][_0xd75d('0x48')]){_0x20ab46['where']=_[_0xd75d('0x49')](_0x20ab46[_0xd75d('0x45')],{'$or':_['map'](_0x3e5312,function(_0x10e89c){if(_0x10e89c[_0xd75d('0x39')]!==_0xd75d('0x4a')){var _0x5f0b54={};_0x5f0b54[_0x10e89c[_0xd75d('0x36')]]={'$like':'%'+_0x98985a[_0xd75d('0x3c')][_0xd75d('0x48')]+'%'};return _0x5f0b54;}})});}_0x20ab46=_[_0xd75d('0x49')]({},_0x20ab46,_0x98985a['options']);var _0x2e9b36={'where':_0x20ab46['where']};return db['ZohoAccount'][_0xd75d('0x2c')](_0x2e9b36)[_0xd75d('0x34')](function(_0x191ff8){_0x5192e7['count']=_0x191ff8;if(_0x98985a['query'][_0xd75d('0x4b')]){_0x20ab46[_0xd75d('0x4c')]=[{'all':!![]}];}return db[_0xd75d('0x4d')]['findAll'](_0x20ab46);})['then'](function(_0x1364bd){_0x5192e7[_0xd75d('0x4e')]=_0x1364bd;return _0x5192e7;})[_0xd75d('0x34')](respondWithFilteredResult(_0x45e66b,_0x20ab46))[_0xd75d('0x28')](handleError(_0x45e66b,null));};exports[_0xd75d('0x4f')]=function(_0x67fad0,_0x26e565){var _0x43bb10={'raw':![],'where':{'id':_0x67fad0[_0xd75d('0x50')]['id']}},_0x42d1b1={};_0x42d1b1['model']=_[_0xd75d('0x3d')](db[_0xd75d('0x4d')][_0xd75d('0x51')]);_0x42d1b1['query']=_[_0xd75d('0x3d')](_0x67fad0[_0xd75d('0x3c')]);_0x42d1b1['filters']=_[_0xd75d('0x3e')](_0x42d1b1[_0xd75d('0x3b')],_0x42d1b1[_0xd75d('0x3c')]);_0x43bb10['attributes']=_[_0xd75d('0x3e')](_0x42d1b1[_0xd75d('0x3b')],qs[_0xd75d('0x40')](_0x67fad0[_0xd75d('0x3c')][_0xd75d('0x40')]));_0x43bb10[_0xd75d('0x3f')]=_0x43bb10[_0xd75d('0x3f')][_0xd75d('0x41')]?_0x43bb10[_0xd75d('0x3f')]:_0x42d1b1[_0xd75d('0x3b')];if(_0x67fad0['query'][_0xd75d('0x4b')]){_0x43bb10[_0xd75d('0x4c')]=[{'all':!![]}];}_0x43bb10=_[_0xd75d('0x49')]({},_0x43bb10,_0x67fad0[_0xd75d('0x52')]);return db[_0xd75d('0x4d')][_0xd75d('0x53')](_0x43bb10)[_0xd75d('0x34')](handleEntityNotFound(_0x26e565,null))[_0xd75d('0x34')](respondWithResult(_0x26e565,null))[_0xd75d('0x28')](handleError(_0x26e565,null));};exports['create']=function(_0x1295d2,_0x255460){return db[_0xd75d('0x4d')][_0xd75d('0x54')](_0x1295d2['body'],{})['then'](respondWithResult(_0x255460,0xc9))['catch'](handleError(_0x255460,null));};exports[_0xd75d('0x32')]=function(_0x41bbfc,_0x44ad90){if(_0x41bbfc[_0xd75d('0x55')]['id']){delete _0x41bbfc[_0xd75d('0x55')]['id'];}return db[_0xd75d('0x4d')]['find']({'where':{'id':_0x41bbfc[_0xd75d('0x50')]['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0x44ad90,null))[_0xd75d('0x34')](saveUpdates(_0x41bbfc[_0xd75d('0x55')],null))[_0xd75d('0x34')](respondWithResult(_0x44ad90,null))['catch'](handleError(_0x44ad90,null));};exports['destroy']=function(_0x1625e1,_0xec2fe5){return db[_0xd75d('0x4d')]['find']({'where':{'id':_0x1625e1['params']['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0xec2fe5,null))[_0xd75d('0x34')](removeEntity(_0xec2fe5,null))[_0xd75d('0x28')](handleError(_0xec2fe5,null));};exports[_0xd75d('0x56')]=function(_0x320db9,_0xea064f,_0x4681ec){var _0x35a034={};var _0x4c6c5d={};var _0x31e65f;var _0x36f7df;return db[_0xd75d('0x4d')][_0xd75d('0x57')]({'where':{'id':_0x320db9['params']['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0xea064f,null))[_0xd75d('0x34')](function(_0x308bfd){if(_0x308bfd){_0x31e65f=_0x308bfd;_0x4c6c5d[_0xd75d('0x3b')]=_[_0xd75d('0x3d')](db[_0xd75d('0x58')]['rawAttributes']);_0x4c6c5d[_0xd75d('0x3c')]=_[_0xd75d('0x3d')](_0x320db9[_0xd75d('0x3c')]);_0x4c6c5d['filters']=_[_0xd75d('0x3e')](_0x4c6c5d[_0xd75d('0x3b')],_0x4c6c5d[_0xd75d('0x3c')]);_0x35a034[_0xd75d('0x3f')]=_[_0xd75d('0x3e')](_0x4c6c5d[_0xd75d('0x3b')],qs[_0xd75d('0x40')](_0x320db9[_0xd75d('0x3c')][_0xd75d('0x40')]));_0x35a034[_0xd75d('0x3f')]=_0x35a034[_0xd75d('0x3f')][_0xd75d('0x41')]?_0x35a034[_0xd75d('0x3f')]:_0x4c6c5d[_0xd75d('0x3b')];_0x35a034[_0xd75d('0x43')]=qs[_0xd75d('0x44')](_0x320db9[_0xd75d('0x3c')][_0xd75d('0x44')]);_0x35a034['where']=qs[_0xd75d('0x47')](_[_0xd75d('0x46')](_0x320db9['query'],_0x4c6c5d[_0xd75d('0x47')]));if(_0x320db9[_0xd75d('0x3c')]['filter']){_0x35a034[_0xd75d('0x45')]=_['merge'](_0x35a034['where'],{'$or':_[_0xd75d('0x38')](_0x35a034['attributes'],function(_0x364f96){var _0x5c1062={};_0x5c1062[_0x364f96]={'$like':'%'+_0x320db9[_0xd75d('0x3c')][_0xd75d('0x48')]+'%'};return _0x5c1062;})});}_0x35a034=_[_0xd75d('0x49')]({},_0x35a034,_0x320db9[_0xd75d('0x52')]);return _0x31e65f[_0xd75d('0x56')](_0x35a034);}})[_0xd75d('0x34')](function(_0x50e68c){if(_0x50e68c){_0x36f7df=_0x50e68c[_0xd75d('0x41')];if(!_0x320db9[_0xd75d('0x3c')][_0xd75d('0x59')]('nolimit')){_0x35a034[_0xd75d('0x2d')]=qs['limit'](_0x320db9[_0xd75d('0x3c')][_0xd75d('0x2d')]);_0x35a034[_0xd75d('0x42')]=qs['offset'](_0x320db9['query'][_0xd75d('0x42')]);}return _0x31e65f[_0xd75d('0x56')](_0x35a034);}})[_0xd75d('0x34')](function(_0x5db064){if(_0x5db064){return _0x5db064?{'count':_0x36f7df,'rows':_0x5db064}:null;}})[_0xd75d('0x34')](respondWithResult(_0xea064f,null))['catch'](handleError(_0xea064f,null));};exports['addConfiguration']=function(_0x5cda35,_0x2261cf,_0x12c540){if(_0x5cda35[_0xd75d('0x55')]['id']){delete _0x5cda35[_0xd75d('0x55')]['id'];}return db[_0xd75d('0x4d')][_0xd75d('0x57')]({'where':{'id':_0x5cda35[_0xd75d('0x50')]['id']}})[_0xd75d('0x34')](handleEntityNotFound(_0x2261cf,null))[_0xd75d('0x34')](function(_0x5eecbe){if(_0x5eecbe){_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5a')]=_0x5eecbe['id'];_0x5cda35['body'][_0xd75d('0x5b')]=integrations[_0xd75d('0x5c')](_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5d')],_0x5cda35[_0xd75d('0x55')]['type']);_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5e')]=integrations['getDescriptions'](_0x5cda35[_0xd75d('0x55')][_0xd75d('0x5d')],_0x5cda35[_0xd75d('0x55')]['type']);return db[_0xd75d('0x58')][_0xd75d('0x54')](_0x5cda35['body'],{'include':[{'model':db['ZohoField'],'as':_0xd75d('0x5b')},{'model':db['ZohoField'],'as':_0xd75d('0x5e')}]});}return null;})[_0xd75d('0x34')](respondWithResult(_0x2261cf,null))['catch'](handleError(_0x2261cf,null));};function getAccessToken(_0x5b8db8){return new Promise(function(_0x4cae32,_0x21dd42){var _0x2ff75d;switch(_0x5b8db8[_0xd75d('0x5f')]){case'US':_0x2ff75d=_0xd75d('0x60');break;case'AU':_0x2ff75d=_0xd75d('0x61');break;case'EU':_0x2ff75d=_0xd75d('0x62');break;case'IN':_0x2ff75d=_0xd75d('0x63');break;case'CN':_0x2ff75d=_0xd75d('0x64');break;default:_0x2ff75d=_0xd75d('0x62');break;}var _0x1cc2c1={'method':_0xd75d('0x65'),'uri':_0x2ff75d+'/oauth/v2/token','qs':{'refresh_token':_0x5b8db8[_0xd75d('0x66')],'client_id':_0x5b8db8['clientId'],'client_secret':_0x5b8db8[_0xd75d('0x67')],'grant_type':_0xd75d('0x68')},'json':!![]};return rp(_0x1cc2c1)[_0xd75d('0x34')](function(_0x42878f){if(_0x42878f[_0xd75d('0x69')]){_0x4cae32(_0x42878f[_0xd75d('0x69')]);}else{_0x21dd42(_0xd75d('0x6a'));}})[_0xd75d('0x28')](function(_0x5b6d74){_0x21dd42(_0x5b6d74);});});}exports[_0xd75d('0x6b')]=function(_0x2fbd66,_0xbfcce8,_0x240557){var _0x5a82ac,_0x59cda6,_0x1d43ab,_0x1fb212,_0x1dd0e5;return db[_0xd75d('0x4d')]['findOne']({'where':{'id':_0x2fbd66['params']['id']},'attributes':['id',_0xd75d('0x6c'),_0xd75d('0x5f'),_0xd75d('0x6d'),_0xd75d('0x67'),_0xd75d('0x6e'),_0xd75d('0x24'),_0xd75d('0x66')]})[_0xd75d('0x34')](handleEntityNotFound(_0xbfcce8,null))[_0xd75d('0x34')](function(_0x522b2c){_0x1dd0e5=_0x522b2c;_0x5a82ac=_0x1dd0e5[_0xd75d('0x6c')];_0x59cda6=_0x5a82ac===_0xd75d('0x6f')?'eu':_0xd75d('0x70');_0x1d43ab=_0x1dd0e5[_0xd75d('0x6e')];var _0x14ba60=_0x1d43ab[_0xd75d('0x71')](-0x1);if(_0x14ba60==='/'||_0x14ba60==='\x5c'||_0x14ba60===':'){_0x1d43ab=_0x1d43ab[_0xd75d('0x72')](0x0,_0x1d43ab['lastIndexOf'](_0x14ba60));}if(!_0x1dd0e5[_0xd75d('0x66')]){throw new Error(_0xd75d('0x73'));}return getAccessToken(_0x1dd0e5);})[_0xd75d('0x34')](function(_0x18c91d){if(_0x18c91d){return rp({'method':_0xd75d('0x74'),'uri':util[_0xd75d('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x59cda6),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd75d('0x76')+_0x18c91d},'json':!![]});}})[_0xd75d('0x34')](function(_0x535a54){if(_0x535a54){if(_0x535a54[_0xd75d('0x77')]&&_0x535a54[_0xd75d('0x77')][_0xd75d('0x23')]){throw new Error(_0x535a54['response'][_0xd75d('0x23')][_0xd75d('0x25')]);}var _0x16db1d=[];var _0x3d860e=[];var _0x28fb45=[_0xd75d('0x78'),_0xd75d('0x79'),_0xd75d('0x7a'),'WhoId',_0xd75d('0x7b'),_0xd75d('0x7c'),_0xd75d('0x7d'),_0xd75d('0x7e')];_0x3d860e=_[_0xd75d('0x7f')](_0x535a54[_0xd75d('0x40')],function(_0x5cc7e8){return _0x28fb45[_0xd75d('0x80')](_0x5cc7e8[_0xd75d('0x81')]);});for(var _0x5d1726=0x0;_0x5d1726<_0x3d860e[_0xd75d('0x41')];_0x5d1726++){if(_0x3d860e[_0x5d1726]['system_mandatory']===![]){_0x16db1d[_0xd75d('0x82')]({'id':_0x3d860e[_0x5d1726]['id'],'name':_0x3d860e[_0x5d1726]['display_label'],'custom':_0x3d860e[_0x5d1726][_0xd75d('0x83')],'options':_0x3d860e[_0x5d1726][_0xd75d('0x84')]===_0xd75d('0x85')&&_0x3d860e[_0x5d1726][_0xd75d('0x86')][_0xd75d('0x41')]>-0x1?_[_0xd75d('0x38')](_0x3d860e[_0x5d1726][_0xd75d('0x86')],function(_0x41795a){return{'name':_0x41795a,'value':_0x41795a};}):[]});}}return{'count':_0x16db1d[_0xd75d('0x41')],'rows':_0x16db1d};}else{return{'count':0x0,'rows':[]};}})[_0xd75d('0x34')](respondWithResult(_0xbfcce8,null))[_0xd75d('0x28')](function(_0x2c4323){var _0x742e92=_0x2fbd66[_0xd75d('0x3c')]['test']?0x1f4:_0x2c4323[_0xd75d('0x87')]||0x1f4;logger[_0xd75d('0x23')](_0xd75d('0x88'),'getFields',_0x742e92,JSON[_0xd75d('0x22')](_0x2c4323));delete _0x2c4323[_0xd75d('0x36')];if(_0x742e92===0x191){_0x742e92=0x190;}_0xbfcce8[_0xd75d('0x29')](_0x742e92)['send'](_0x2fbd66[_0xd75d('0x3c')][_0xd75d('0x89')]?{'message':_0xd75d('0x8a'),'statusCode':_0x2c4323[_0xd75d('0x87')]}:_0x2c4323);});}; \ No newline at end of file +var _0x7177=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','Content-Range','apply','destroy','end','name','send','index','map','ZohoAccount','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','params','include','merge','find','create','body','update','getConfigurations','findOne','length','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','zoho.eu','com','serverUrl','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','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','stringify','test','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x560b33,_0x54a69c){var _0x15c35e=function(_0x58d087){while(--_0x58d087){_0x560b33['push'](_0x560b33['shift']());}};_0x15c35e(++_0x54a69c);}(_0x7177,0x101));var _0x7717=function(_0x5eb6e6,_0x17f551){_0x5eb6e6=_0x5eb6e6-0x0;var _0x35c38b=_0x7177[_0x5eb6e6];return _0x35c38b;};'use strict';var pdf=require(_0x7717('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7717('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7717('0x2'));var rp=require(_0x7717('0x3'));var moment=require('moment');var BPromise=require(_0x7717('0x4'));var Mustache=require(_0x7717('0x5'));var util=require('util');var path=require(_0x7717('0x6'));var sox=require(_0x7717('0x7'));var csv=require(_0x7717('0x8'));var ejs=require(_0x7717('0x9'));var fs=require('fs');var _=require(_0x7717('0xa'));var squel=require(_0x7717('0xb'));var crypto=require(_0x7717('0xc'));var jsforce=require(_0x7717('0xd'));var deskjs=require(_0x7717('0xe'));var toCsv=require(_0x7717('0x8'));var querystring=require(_0x7717('0xf'));var Papa=require('papaparse');var Redis=require(_0x7717('0x10'));var authService=require(_0x7717('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7717('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7717('0x13'))(_0x7717('0x14'));var utils=require(_0x7717('0x15'));var config=require(_0x7717('0x16'));var licenseUtil=require(_0x7717('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7717('0x18'));var jayson=require(_0x7717('0x19'));var client=jayson[_0x7717('0x1a')][_0x7717('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x196ed2,_0x439e10,_0x3490f9,_0x55c30b){return new BPromise(function(_0xcb6d5c,_0x2cbe7b){var _0x445bfd=_0x55c30b||client;return _0x445bfd[_0x7717('0x1c')](_0x196ed2,_0x3490f9)[_0x7717('0x1d')](function(_0x782bd0){logger[_0x7717('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x439e10,'request\x20sent');logger[_0x7717('0x1f')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x439e10,_0x7717('0x20'),JSON['stringify'](_0x782bd0));if(_0x782bd0[_0x7717('0x21')]){if(_0x782bd0[_0x7717('0x21')][_0x7717('0x22')]===0x1f4){logger['error'](_0x7717('0x23'),_0x439e10,_0x782bd0[_0x7717('0x21')][_0x7717('0x24')]);return _0x2cbe7b(_0x782bd0[_0x7717('0x21')][_0x7717('0x24')]);}logger['error'](_0x7717('0x23'),_0x439e10,_0x782bd0[_0x7717('0x21')][_0x7717('0x24')]);return _0xcb6d5c(_0x782bd0[_0x7717('0x21')]['message']);}else{logger[_0x7717('0x1e')](_0x7717('0x23'),_0x439e10,_0x7717('0x20'));_0xcb6d5c(_0x782bd0['result'][_0x7717('0x24')]);}})[_0x7717('0x25')](function(_0x73eda0){logger['error'](_0x7717('0x23'),_0x439e10,_0x73eda0);_0x2cbe7b(_0x73eda0);});});}function respondWithStatusCode(_0x11f0bc,_0x2e9001){_0x2e9001=_0x2e9001||0xcc;return function(_0x32ee21){if(_0x32ee21){return _0x11f0bc[_0x7717('0x26')](_0x2e9001);}return _0x11f0bc[_0x7717('0x27')](_0x2e9001)['end']();};}function respondWithResult(_0x33e592,_0x584fa6){_0x584fa6=_0x584fa6||0xc8;return function(_0x431d91){if(_0x431d91){return _0x33e592[_0x7717('0x27')](_0x584fa6)[_0x7717('0x28')](_0x431d91);}};}function respondWithFilteredResult(_0x1ec800,_0xa4428b){return function(_0x2f3de2){if(_0x2f3de2){var _0x7fa7a7=_0x2f3de2[_0x7717('0x29')],_0x59e312=_0xa4428b[_0x7717('0x2a')],_0x7eab8=_0xa4428b['offset']+_0xa4428b['limit'],_0x117309;if(_0x7eab8>=_0x7fa7a7){_0x7eab8=_0x7fa7a7;_0x117309=0xc8;}else{_0x117309=0xce;}_0x1ec800['status'](_0x117309);return _0x1ec800['set'](_0x7717('0x2b'),_0x59e312+'-'+_0x7eab8+'/'+_0x7fa7a7)['json'](_0x2f3de2);}return null;};}function patchUpdates(_0x2090eb){return function(_0x29330e){try{jsonpatch[_0x7717('0x2c')](_0x29330e,_0x2090eb,!![]);}catch(_0x20e1cb){return BPromise['reject'](_0x20e1cb);}return _0x29330e['save']();};}function saveUpdates(_0x5b1ee3,_0x103f08){return function(_0x4c1f6a){if(_0x4c1f6a){return _0x4c1f6a['update'](_0x5b1ee3)['then'](function(_0x18bf7a){return _0x18bf7a;});}return null;};}function removeEntity(_0x2bf307,_0x110c82){return function(_0x4b667d){if(_0x4b667d){return _0x4b667d[_0x7717('0x2d')]()[_0x7717('0x1d')](function(){_0x2bf307['status'](0xcc)[_0x7717('0x2e')]();});}};}function handleEntityNotFound(_0x5d631b,_0xb28550){return function(_0x47b7ec){if(!_0x47b7ec){_0x5d631b['sendStatus'](0x194);}return _0x47b7ec;};}function handleError(_0x320e02,_0x144a9b){_0x144a9b=_0x144a9b||0x1f4;return function(_0x5040df){logger[_0x7717('0x21')](_0x5040df['stack']);if(_0x5040df[_0x7717('0x2f')]){delete _0x5040df[_0x7717('0x2f')];}_0x320e02['status'](_0x144a9b)[_0x7717('0x30')](_0x5040df);};}exports[_0x7717('0x31')]=function(_0x59e70a,_0x4368a8){var _0x59a7c6={},_0x2d6bb2={},_0xafe32d={'count':0x0,'rows':[]};var _0x3f9e48=_[_0x7717('0x32')](db[_0x7717('0x33')][_0x7717('0x34')],function(_0x2f6b15){return{'name':_0x2f6b15['fieldName'],'type':_0x2f6b15['type'][_0x7717('0x35')]};});_0x2d6bb2['model']=_[_0x7717('0x32')](_0x3f9e48,'name');_0x2d6bb2[_0x7717('0x36')]=_[_0x7717('0x37')](_0x59e70a[_0x7717('0x36')]);_0x2d6bb2[_0x7717('0x38')]=_[_0x7717('0x39')](_0x2d6bb2['model'],_0x2d6bb2[_0x7717('0x36')]);_0x59a7c6[_0x7717('0x3a')]=_[_0x7717('0x39')](_0x2d6bb2[_0x7717('0x3b')],qs[_0x7717('0x3c')](_0x59e70a[_0x7717('0x36')][_0x7717('0x3c')]));_0x59a7c6[_0x7717('0x3a')]=_0x59a7c6[_0x7717('0x3a')]['length']?_0x59a7c6[_0x7717('0x3a')]:_0x2d6bb2['model'];if(!_0x59e70a[_0x7717('0x36')][_0x7717('0x3d')](_0x7717('0x3e'))){_0x59a7c6[_0x7717('0x3f')]=qs[_0x7717('0x3f')](_0x59e70a[_0x7717('0x36')][_0x7717('0x3f')]);_0x59a7c6[_0x7717('0x2a')]=qs[_0x7717('0x2a')](_0x59e70a['query'][_0x7717('0x2a')]);}_0x59a7c6[_0x7717('0x40')]=qs['sort'](_0x59e70a[_0x7717('0x36')][_0x7717('0x41')]);_0x59a7c6[_0x7717('0x42')]=qs['filters'](_[_0x7717('0x43')](_0x59e70a[_0x7717('0x36')],_0x2d6bb2[_0x7717('0x38')]),_0x3f9e48);if(_0x59e70a[_0x7717('0x36')][_0x7717('0x44')]){_0x59a7c6[_0x7717('0x42')]=_['merge'](_0x59a7c6[_0x7717('0x42')],{'$or':_[_0x7717('0x32')](_0x3f9e48,function(_0x32f6a1){if(_0x32f6a1['type']!==_0x7717('0x45')){var _0x5ad751={};_0x5ad751[_0x32f6a1[_0x7717('0x2f')]]={'$like':'%'+_0x59e70a[_0x7717('0x36')][_0x7717('0x44')]+'%'};return _0x5ad751;}})});}_0x59a7c6=_['merge']({},_0x59a7c6,_0x59e70a[_0x7717('0x46')]);var _0x444a25={'where':_0x59a7c6['where']};return db[_0x7717('0x33')][_0x7717('0x29')](_0x444a25)[_0x7717('0x1d')](function(_0x2f9c8a){_0xafe32d[_0x7717('0x29')]=_0x2f9c8a;if(_0x59e70a[_0x7717('0x36')][_0x7717('0x47')]){_0x59a7c6['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x7717('0x48')](_0x59a7c6);})[_0x7717('0x1d')](function(_0x1db3ad){_0xafe32d[_0x7717('0x49')]=_0x1db3ad;return _0xafe32d;})[_0x7717('0x1d')](respondWithFilteredResult(_0x4368a8,_0x59a7c6))[_0x7717('0x25')](handleError(_0x4368a8,null));};exports['show']=function(_0xcd57ab,_0x2385ad){var _0xbe83c4={'raw':![],'where':{'id':_0xcd57ab[_0x7717('0x4a')]['id']}},_0x54f197={};_0x54f197[_0x7717('0x3b')]=_[_0x7717('0x37')](db[_0x7717('0x33')][_0x7717('0x34')]);_0x54f197['query']=_[_0x7717('0x37')](_0xcd57ab['query']);_0x54f197[_0x7717('0x38')]=_[_0x7717('0x39')](_0x54f197['model'],_0x54f197['query']);_0xbe83c4[_0x7717('0x3a')]=_['intersection'](_0x54f197['model'],qs[_0x7717('0x3c')](_0xcd57ab[_0x7717('0x36')][_0x7717('0x3c')]));_0xbe83c4['attributes']=_0xbe83c4[_0x7717('0x3a')]['length']?_0xbe83c4['attributes']:_0x54f197[_0x7717('0x3b')];if(_0xcd57ab[_0x7717('0x36')][_0x7717('0x47')]){_0xbe83c4[_0x7717('0x4b')]=[{'all':!![]}];}_0xbe83c4=_[_0x7717('0x4c')]({},_0xbe83c4,_0xcd57ab['options']);return db[_0x7717('0x33')][_0x7717('0x4d')](_0xbe83c4)['then'](handleEntityNotFound(_0x2385ad,null))[_0x7717('0x1d')](respondWithResult(_0x2385ad,null))[_0x7717('0x25')](handleError(_0x2385ad,null));};exports[_0x7717('0x4e')]=function(_0x378929,_0x2e1bb3){return db[_0x7717('0x33')]['create'](_0x378929[_0x7717('0x4f')],{})[_0x7717('0x1d')](respondWithResult(_0x2e1bb3,0xc9))[_0x7717('0x25')](handleError(_0x2e1bb3,null));};exports[_0x7717('0x50')]=function(_0x5015be,_0x12c57a){if(_0x5015be['body']['id']){delete _0x5015be[_0x7717('0x4f')]['id'];}return db['ZohoAccount'][_0x7717('0x4d')]({'where':{'id':_0x5015be['params']['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x12c57a,null))[_0x7717('0x1d')](saveUpdates(_0x5015be[_0x7717('0x4f')],null))['then'](respondWithResult(_0x12c57a,null))[_0x7717('0x25')](handleError(_0x12c57a,null));};exports['destroy']=function(_0x4ff30d,_0x28a5e6){return db[_0x7717('0x33')]['find']({'where':{'id':_0x4ff30d['params']['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x28a5e6,null))[_0x7717('0x1d')](removeEntity(_0x28a5e6,null))[_0x7717('0x25')](handleError(_0x28a5e6,null));};exports[_0x7717('0x51')]=function(_0x5e9992,_0x1053aa,_0x38e365){var _0x1d3477={};var _0x1e146={};var _0x192469;var _0x307f7e;return db[_0x7717('0x33')][_0x7717('0x52')]({'where':{'id':_0x5e9992[_0x7717('0x4a')]['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x1053aa,null))[_0x7717('0x1d')](function(_0x939d4a){if(_0x939d4a){_0x192469=_0x939d4a;_0x1e146[_0x7717('0x3b')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x1e146[_0x7717('0x36')]=_[_0x7717('0x37')](_0x5e9992[_0x7717('0x36')]);_0x1e146[_0x7717('0x38')]=_[_0x7717('0x39')](_0x1e146[_0x7717('0x3b')],_0x1e146[_0x7717('0x36')]);_0x1d3477[_0x7717('0x3a')]=_[_0x7717('0x39')](_0x1e146[_0x7717('0x3b')],qs['fields'](_0x5e9992[_0x7717('0x36')]['fields']));_0x1d3477[_0x7717('0x3a')]=_0x1d3477[_0x7717('0x3a')][_0x7717('0x53')]?_0x1d3477['attributes']:_0x1e146[_0x7717('0x3b')];_0x1d3477[_0x7717('0x40')]=qs[_0x7717('0x41')](_0x5e9992['query']['sort']);_0x1d3477[_0x7717('0x42')]=qs['filters'](_[_0x7717('0x43')](_0x5e9992[_0x7717('0x36')],_0x1e146[_0x7717('0x38')]));if(_0x5e9992['query']['filter']){_0x1d3477[_0x7717('0x42')]=_[_0x7717('0x4c')](_0x1d3477[_0x7717('0x42')],{'$or':_[_0x7717('0x32')](_0x1d3477[_0x7717('0x3a')],function(_0x126ca4){var _0x410c4e={};_0x410c4e[_0x126ca4]={'$like':'%'+_0x5e9992[_0x7717('0x36')][_0x7717('0x44')]+'%'};return _0x410c4e;})});}_0x1d3477=_['merge']({},_0x1d3477,_0x5e9992[_0x7717('0x46')]);return _0x192469['getConfigurations'](_0x1d3477);}})['then'](function(_0x476fb8){if(_0x476fb8){_0x307f7e=_0x476fb8[_0x7717('0x53')];if(!_0x5e9992[_0x7717('0x36')][_0x7717('0x3d')](_0x7717('0x3e'))){_0x1d3477[_0x7717('0x3f')]=qs['limit'](_0x5e9992[_0x7717('0x36')][_0x7717('0x3f')]);_0x1d3477[_0x7717('0x2a')]=qs[_0x7717('0x2a')](_0x5e9992['query'][_0x7717('0x2a')]);}return _0x192469[_0x7717('0x51')](_0x1d3477);}})[_0x7717('0x1d')](function(_0x1f4d73){if(_0x1f4d73){return _0x1f4d73?{'count':_0x307f7e,'rows':_0x1f4d73}:null;}})[_0x7717('0x1d')](respondWithResult(_0x1053aa,null))[_0x7717('0x25')](handleError(_0x1053aa,null));};exports[_0x7717('0x54')]=function(_0x18acb8,_0x22c6ed,_0x5c2ca4){if(_0x18acb8[_0x7717('0x4f')]['id']){delete _0x18acb8[_0x7717('0x4f')]['id'];}return db[_0x7717('0x33')][_0x7717('0x52')]({'where':{'id':_0x18acb8['params']['id']}})[_0x7717('0x1d')](handleEntityNotFound(_0x22c6ed,null))[_0x7717('0x1d')](function(_0x8185af){if(_0x8185af){_0x18acb8[_0x7717('0x4f')]['AccountId']=_0x8185af['id'];_0x18acb8[_0x7717('0x4f')][_0x7717('0x55')]=integrations['getSubjects'](_0x18acb8[_0x7717('0x4f')][_0x7717('0x56')],_0x18acb8[_0x7717('0x4f')][_0x7717('0x57')]);_0x18acb8['body'][_0x7717('0x58')]=integrations[_0x7717('0x59')](_0x18acb8[_0x7717('0x4f')][_0x7717('0x56')],_0x18acb8['body'][_0x7717('0x57')]);return db['ZohoConfiguration'][_0x7717('0x4e')](_0x18acb8[_0x7717('0x4f')],{'include':[{'model':db[_0x7717('0x5a')],'as':_0x7717('0x55')},{'model':db[_0x7717('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x22c6ed,null))[_0x7717('0x25')](handleError(_0x22c6ed,null));};function getAccessToken(_0x4066e0){return new Promise(function(_0x4914d4,_0x3f221d){var _0x1475ee;switch(_0x4066e0[_0x7717('0x5b')]){case'US':_0x1475ee='https://accounts.zoho.com';break;case'AU':_0x1475ee=_0x7717('0x5c');break;case'EU':_0x1475ee=_0x7717('0x5d');break;case'IN':_0x1475ee='https://accounts.zoho.in';break;case'CN':_0x1475ee=_0x7717('0x5e');break;default:_0x1475ee=_0x7717('0x5d');break;}var _0x1f5dae={'method':_0x7717('0x5f'),'uri':_0x1475ee+_0x7717('0x60'),'qs':{'refresh_token':_0x4066e0[_0x7717('0x61')],'client_id':_0x4066e0['clientId'],'client_secret':_0x4066e0[_0x7717('0x62')],'grant_type':_0x7717('0x63')},'json':!![]};return rp(_0x1f5dae)[_0x7717('0x1d')](function(_0xe3cf9a){if(_0xe3cf9a[_0x7717('0x64')]){_0x4914d4(_0xe3cf9a[_0x7717('0x64')]);}else{_0x3f221d(_0x7717('0x65'));}})[_0x7717('0x25')](function(_0x3d7edb){_0x3f221d(_0x3d7edb);});});}exports['getFields']=function(_0x820e20,_0x300aa7,_0x585587){var _0x13eb0e,_0x1938f0,_0x51a6d1,_0x1a1652,_0x390128;return db[_0x7717('0x33')][_0x7717('0x52')]({'where':{'id':_0x820e20[_0x7717('0x4a')]['id']},'attributes':['id',_0x7717('0x66'),_0x7717('0x5b'),_0x7717('0x67'),'clientSecret','serverUrl','code',_0x7717('0x61')]})[_0x7717('0x1d')](handleEntityNotFound(_0x300aa7,null))['then'](function(_0x50cb15){_0x390128=_0x50cb15;_0x13eb0e=_0x390128[_0x7717('0x66')];_0x1938f0=_0x13eb0e===_0x7717('0x68')?'eu':_0x7717('0x69');_0x51a6d1=_0x390128[_0x7717('0x6a')];var _0x31f2de=_0x51a6d1['slice'](-0x1);if(_0x31f2de==='/'||_0x31f2de==='\x5c'||_0x31f2de===':'){_0x51a6d1=_0x51a6d1['substring'](0x0,_0x51a6d1[_0x7717('0x6b')](_0x31f2de));}if(!_0x390128[_0x7717('0x61')]){throw new Error(_0x7717('0x6c'));}return getAccessToken(_0x390128);})['then'](function(_0x22990d){if(_0x22990d){return rp({'method':_0x7717('0x6d'),'uri':util[_0x7717('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1938f0),'qs':{'module':_0x7717('0x6f')},'headers':{'Authorization':_0x7717('0x70')+_0x22990d},'json':!![]});}})[_0x7717('0x1d')](function(_0xb95373){if(_0xb95373){if(_0xb95373[_0x7717('0x71')]&&_0xb95373[_0x7717('0x71')][_0x7717('0x21')]){throw new Error(_0xb95373[_0x7717('0x71')][_0x7717('0x21')][_0x7717('0x24')]);}var _0x583911=[];var _0x75f62f=[];var _0x4c022b=['Owner',_0x7717('0x72'),_0x7717('0x73'),'WhoId',_0x7717('0x74'),_0x7717('0x75'),'Call_Start_Time',_0x7717('0x76')];_0x75f62f=_[_0x7717('0x77')](_0xb95373[_0x7717('0x3c')],function(_0x101352){return _0x4c022b[_0x7717('0x78')](_0x101352[_0x7717('0x79')]);});for(var _0x156515=0x0;_0x156515<_0x75f62f[_0x7717('0x53')];_0x156515++){if(_0x75f62f[_0x156515][_0x7717('0x7a')]===![]){_0x583911[_0x7717('0x7b')]({'id':_0x75f62f[_0x156515]['id'],'name':_0x75f62f[_0x156515][_0x7717('0x7c')],'custom':_0x75f62f[_0x156515][_0x7717('0x7d')],'options':_0x75f62f[_0x156515][_0x7717('0x7e')]===_0x7717('0x7f')&&_0x75f62f[_0x156515][_0x7717('0x80')][_0x7717('0x53')]>-0x1?_[_0x7717('0x32')](_0x75f62f[_0x156515][_0x7717('0x80')],function(_0x3bb931){return{'name':_0x3bb931,'value':_0x3bb931};}):[]});}}return{'count':_0x583911['length'],'rows':_0x583911};}else{return{'count':0x0,'rows':[]};}})[_0x7717('0x1d')](respondWithResult(_0x300aa7,null))['catch'](function(_0x479ed6){var _0x5421a9=_0x820e20[_0x7717('0x36')]['test']?0x1f4:_0x479ed6[_0x7717('0x81')]||0x1f4;logger[_0x7717('0x21')](_0x7717('0x82'),'getFields',_0x5421a9,JSON[_0x7717('0x83')](_0x479ed6));delete _0x479ed6[_0x7717('0x2f')];if(_0x5421a9===0x191){_0x5421a9=0x190;}_0x300aa7[_0x7717('0x27')](_0x5421a9)[_0x7717('0x30')](_0x820e20['query'][_0x7717('0x84')]?{'message':_0x7717('0x85'),'statusCode':_0x479ed6['statusCode']}:_0x479ed6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ffe5ee1..2af22a2 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 _0x5482=['../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','code','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','lastIndexOf','https://accounts.zoho.in','POST','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes'];(function(_0x2f0a0e,_0x53c4cf){var _0x579a2=function(_0x47c786){while(--_0x47c786){_0x2f0a0e['push'](_0x2f0a0e['shift']());}};_0x579a2(++_0x53c4cf);}(_0x5482,0x14e));var _0x2548=function(_0x53a382,_0x21cfcf){_0x53a382=_0x53a382-0x0;var _0x150aca=_0x5482[_0x53a382];return _0x150aca;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var logger=require(_0x2548('0x2'))(_0x2548('0x3'));var moment=require(_0x2548('0x4'));var BPromise=require(_0x2548('0x5'));var rp=require(_0x2548('0x6'));var fs=require('fs');var path=require(_0x2548('0x7'));var rimraf=require(_0x2548('0x8'));var config=require('../../config/environment');var attributes=require(_0x2548('0x9'));var integrations=require(_0x2548('0xa'));module[_0x2548('0xb')]=function(_0x56cf1a,_0x5e6aef){return _0x56cf1a['define'](_0x2548('0xc'),attributes,{'tableName':_0x2548('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a4f69,_0x4c517d,_0xb86ff7){if(_0x4a4f69[_0x2548('0xe')](_0x2548('0xf'))||_0x4a4f69[_0x2548('0xe')](_0x2548('0x10'))||_0x4a4f69[_0x2548('0xe')](_0x2548('0x11'))||_0x4a4f69[_0x2548('0xe')]('clientSecret')||_0x4a4f69[_0x2548('0xe')](_0x2548('0x12'))||_0x4a4f69[_0x2548('0xe')]('host')){var _0x2a4802,_0x55481a;_0x2a4802=_0x4a4f69[_0x2548('0x10')];var _0x394556=_0x2a4802[_0x2548('0x13')](-0x1);if(_0x394556==='/'||_0x394556==='\x5c'||_0x394556===':'){_0x2a4802=_0x2a4802['substring'](0x0,_0x2a4802['lastIndexOf'](_0x394556));}switch(_0x4a4f69[_0x2548('0xf')]){case'US':_0x55481a=_0x2548('0x14');break;case'AU':_0x55481a=_0x2548('0x15');break;case'IN':_0x55481a='https://accounts.zoho.in';break;case'CN':_0x55481a=_0x2548('0x16');break;default:_0x55481a=_0x2548('0x17');break;}var _0x4e22ba={'method':'POST','uri':_0x55481a+_0x2548('0x18'),'form':{'grant_type':_0x2548('0x19'),'client_id':_0x4a4f69['clientId'],'client_secret':_0x4a4f69[_0x2548('0x1a')],'redirect_uri':_0x4a4f69[_0x2548('0x10')],'code':_0x4a4f69[_0x2548('0x12')]},'headers':{'Content-Type':_0x2548('0x1b')}};return rp(_0x4e22ba)[_0x2548('0x1c')](function(_0xf33ee0){var _0x494407=JSON['parse'](_0xf33ee0);if(_0x494407[_0x2548('0x1d')]){_0x4a4f69[_0x2548('0x1e')]=_0x494407[_0x2548('0x1d')];logger[_0x2548('0x1f')](util[_0x2548('0x20')](_0x2548('0x21'),_0x4a4f69[_0x2548('0x22')],_0x4a4f69['id']));}else{logger[_0x2548('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4a4f69[_0x2548('0x22')],_0x4a4f69['id']),util[_0x2548('0x24')](_0x494407,{'showHidden':![],'depth':null}));}return _0xb86ff7(null,_0x4c517d);})[_0x2548('0x25')](function(_0x28c873){logger[_0x2548('0x23')](util[_0x2548('0x20')](_0x2548('0x26'),_0x4a4f69[_0x2548('0x22')],_0x4a4f69['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xb86ff7(_0x28c873);});}else{return _0xb86ff7(null,_0x4c517d);}},'beforeUpdate':function(_0xf078b,_0x564a15,_0x506541){if(_0xf078b[_0x2548('0xe')](_0x2548('0xf'))||_0xf078b[_0x2548('0xe')]('serverUrl')||_0xf078b[_0x2548('0xe')](_0x2548('0x11'))||_0xf078b[_0x2548('0xe')](_0x2548('0x1a'))||_0xf078b[_0x2548('0xe')]('code')||_0xf078b['changed']('host')){var _0x31f710,_0x277fa3;_0x31f710=_0xf078b[_0x2548('0x10')];var _0x9e9385=_0x31f710['slice'](-0x1);if(_0x9e9385==='/'||_0x9e9385==='\x5c'||_0x9e9385===':'){_0x31f710=_0x31f710[_0x2548('0x27')](0x0,_0x31f710[_0x2548('0x28')](_0x9e9385));}switch(_0xf078b['zone']){case'US':_0x277fa3=_0x2548('0x14');break;case'AU':_0x277fa3='https://accounts.zoho.com.au';break;case'IN':_0x277fa3=_0x2548('0x29');break;case'CN':_0x277fa3=_0x2548('0x16');break;default:_0x277fa3=_0x2548('0x17');break;}var _0x29d35f={'method':_0x2548('0x2a'),'uri':_0x277fa3+'/oauth/v2/token','form':{'grant_type':_0x2548('0x19'),'client_id':_0xf078b['clientId'],'client_secret':_0xf078b['clientSecret'],'redirect_uri':_0xf078b[_0x2548('0x10')],'code':_0xf078b[_0x2548('0x12')]},'headers':{'Content-Type':_0x2548('0x1b')}};return rp(_0x29d35f)[_0x2548('0x1c')](function(_0x459180){var _0x3c14ce=JSON['parse'](_0x459180);if(_0x3c14ce[_0x2548('0x1d')]){_0xf078b['refreshToken']=_0x3c14ce[_0x2548('0x1d')];logger[_0x2548('0x1f')](util[_0x2548('0x20')](_0x2548('0x21'),_0xf078b[_0x2548('0x22')],_0xf078b['id']));}else{logger[_0x2548('0x23')](util['format'](_0x2548('0x26'),_0xf078b[_0x2548('0x22')],_0xf078b['id']),util[_0x2548('0x24')](_0x3c14ce,{'showHidden':![],'depth':null}));}return _0x506541(null,_0x564a15);})['catch'](function(_0x5b5f44){logger[_0x2548('0x23')](util['format'](_0x2548('0x26'),_0xf078b[_0x2548('0x22')],_0xf078b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x506541(_0x5b5f44);});}else{return _0x506541(null,_0x564a15);}}}});}; \ No newline at end of file +var _0xab3c=['https://accounts.zoho.com.au','POST','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','code','host','slice','lastIndexOf','https://accounts.zoho.com'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab3c,0x94));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcab3('0x0'));var logger=require(_0xcab3('0x1'))(_0xcab3('0x2'));var moment=require(_0xcab3('0x3'));var BPromise=require(_0xcab3('0x4'));var rp=require(_0xcab3('0x5'));var fs=require('fs');var path=require(_0xcab3('0x6'));var rimraf=require(_0xcab3('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xcab3('0x8'));module[_0xcab3('0x9')]=function(_0x461765,_0x5358b1){return _0x461765['define']('ZohoAccount',attributes,{'tableName':_0xcab3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x556426,_0x3d62e5,_0x38ade4){if(_0x556426[_0xcab3('0xb')](_0xcab3('0xc'))||_0x556426[_0xcab3('0xb')](_0xcab3('0xd'))||_0x556426[_0xcab3('0xb')](_0xcab3('0xe'))||_0x556426[_0xcab3('0xb')]('clientSecret')||_0x556426[_0xcab3('0xb')](_0xcab3('0xf'))||_0x556426[_0xcab3('0xb')](_0xcab3('0x10'))){var _0x2bd963,_0x16dc97;_0x2bd963=_0x556426[_0xcab3('0xd')];var _0x39df48=_0x2bd963[_0xcab3('0x11')](-0x1);if(_0x39df48==='/'||_0x39df48==='\x5c'||_0x39df48===':'){_0x2bd963=_0x2bd963['substring'](0x0,_0x2bd963[_0xcab3('0x12')](_0x39df48));}switch(_0x556426['zone']){case'US':_0x16dc97=_0xcab3('0x13');break;case'AU':_0x16dc97=_0xcab3('0x14');break;case'IN':_0x16dc97='https://accounts.zoho.in';break;case'CN':_0x16dc97='https://accounts.zoho.com.cn';break;default:_0x16dc97='https://accounts.zoho.eu';break;}var _0x16efac={'method':_0xcab3('0x15'),'uri':_0x16dc97+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x556426['clientId'],'client_secret':_0x556426[_0xcab3('0x16')],'redirect_uri':_0x556426[_0xcab3('0xd')],'code':_0x556426[_0xcab3('0xf')]},'headers':{'Content-Type':_0xcab3('0x17')}};return rp(_0x16efac)[_0xcab3('0x18')](function(_0x229b10){var _0x1468d9=JSON[_0xcab3('0x19')](_0x229b10);if(_0x1468d9[_0xcab3('0x1a')]){_0x556426[_0xcab3('0x1b')]=_0x1468d9['refresh_token'];logger[_0xcab3('0x1c')](util[_0xcab3('0x1d')](_0xcab3('0x1e'),_0x556426[_0xcab3('0x1f')],_0x556426['id']));}else{logger[_0xcab3('0x20')](util['format'](_0xcab3('0x21'),_0x556426[_0xcab3('0x1f')],_0x556426['id']),util[_0xcab3('0x22')](_0x1468d9,{'showHidden':![],'depth':null}));}return _0x38ade4(null,_0x3d62e5);})['catch'](function(_0x38aea9){logger[_0xcab3('0x20')](util[_0xcab3('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x556426[_0xcab3('0x1f')],_0x556426['id']),util[_0xcab3('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x38ade4(_0x38aea9);});}else{return _0x38ade4(null,_0x3d62e5);}},'beforeUpdate':function(_0x40341d,_0x85ebaf,_0x5e824e){if(_0x40341d['changed'](_0xcab3('0xc'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0xd'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0xe'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0x16'))||_0x40341d[_0xcab3('0xb')](_0xcab3('0xf'))||_0x40341d['changed'](_0xcab3('0x10'))){var _0x92b70b,_0x7ced90;_0x92b70b=_0x40341d[_0xcab3('0xd')];var _0x42c8db=_0x92b70b[_0xcab3('0x11')](-0x1);if(_0x42c8db==='/'||_0x42c8db==='\x5c'||_0x42c8db===':'){_0x92b70b=_0x92b70b[_0xcab3('0x23')](0x0,_0x92b70b['lastIndexOf'](_0x42c8db));}switch(_0x40341d[_0xcab3('0xc')]){case'US':_0x7ced90=_0xcab3('0x13');break;case'AU':_0x7ced90='https://accounts.zoho.com.au';break;case'IN':_0x7ced90=_0xcab3('0x24');break;case'CN':_0x7ced90=_0xcab3('0x25');break;default:_0x7ced90=_0xcab3('0x26');break;}var _0x2ca996={'method':_0xcab3('0x15'),'uri':_0x7ced90+_0xcab3('0x27'),'form':{'grant_type':_0xcab3('0x28'),'client_id':_0x40341d[_0xcab3('0xe')],'client_secret':_0x40341d[_0xcab3('0x16')],'redirect_uri':_0x40341d[_0xcab3('0xd')],'code':_0x40341d[_0xcab3('0xf')]},'headers':{'Content-Type':_0xcab3('0x17')}};return rp(_0x2ca996)[_0xcab3('0x18')](function(_0x2c2e62){var _0x482e81=JSON[_0xcab3('0x19')](_0x2c2e62);if(_0x482e81[_0xcab3('0x1a')]){_0x40341d[_0xcab3('0x1b')]=_0x482e81[_0xcab3('0x1a')];logger[_0xcab3('0x1c')](util[_0xcab3('0x1d')](_0xcab3('0x1e'),_0x40341d[_0xcab3('0x1f')],_0x40341d['id']));}else{logger[_0xcab3('0x20')](util[_0xcab3('0x1d')](_0xcab3('0x21'),_0x40341d[_0xcab3('0x1f')],_0x40341d['id']),util[_0xcab3('0x22')](_0x482e81,{'showHidden':![],'depth':null}));}return _0x5e824e(null,_0x85ebaf);})[_0xcab3('0x29')](function(_0x5cc97e){logger[_0xcab3('0x20')](util[_0xcab3('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x40341d['name'],_0x40341d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5e824e(_0x5cc97e);});}else{return _0x5e824e(null,_0x85ebaf);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 09e85bd..ff0489d 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 _0x3fb4=['findAll','raw','options','where','attributes','include','map','model','then','ShowZohoAccount','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount'];(function(_0x1b94a2,_0x450ca7){var _0x5acbc8=function(_0x2164e6){while(--_0x2164e6){_0x1b94a2['push'](_0x1b94a2['shift']());}};_0x5acbc8(++_0x450ca7);}(_0x3fb4,0x97));var _0x43fb=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3fb4[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x43fb('0x0'));var util=require(_0x43fb('0x1'));var moment=require(_0x43fb('0x2'));var BPromise=require('bluebird');var rs=require(_0x43fb('0x3'));var fs=require('fs');var Redis=require(_0x43fb('0x4'));var db=require(_0x43fb('0x5'))['db'];var utils=require(_0x43fb('0x6'));var logger=require(_0x43fb('0x7'))(_0x43fb('0x8'));var config=require(_0x43fb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x43fb('0xa')][_0x43fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43b24a,_0x4a2be4,_0x45cf38){return new BPromise(function(_0x43944e,_0x13b970){return client[_0x43fb('0xc')](_0x43b24a,_0x45cf38)['then'](function(_0x1c2252){logger[_0x43fb('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x43fb('0xe'));logger[_0x43fb('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4a2be4,_0x43fb('0xe'),JSON['stringify'](_0x1c2252));if(_0x1c2252[_0x43fb('0x10')]){if(_0x1c2252[_0x43fb('0x10')][_0x43fb('0x11')]===0x1f4){logger[_0x43fb('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x1c2252[_0x43fb('0x10')][_0x43fb('0x12')]);return _0x13b970(_0x1c2252[_0x43fb('0x10')][_0x43fb('0x12')]);}logger[_0x43fb('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x1c2252['error'][_0x43fb('0x12')]);return _0x43944e(_0x1c2252['error'][_0x43fb('0x12')]);}else{logger['info'](_0x43fb('0x13'),_0x4a2be4,_0x43fb('0xe'));_0x43944e(_0x1c2252[_0x43fb('0x14')]['message']);}})[_0x43fb('0x15')](function(_0x38c9dc){logger[_0x43fb('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x4a2be4,_0x38c9dc);_0x13b970(_0x38c9dc);});});}exports[_0x43fb('0x16')]=function(_0x5d0e69){var _0x155749=this;return new Promise(function(_0x445ace,_0xf1f181){return db[_0x43fb('0x17')][_0x43fb('0x18')]({'raw':_0x5d0e69['options']?_0x5d0e69['options'][_0x43fb('0x19')]===undefined?!![]:![]:!![],'where':_0x5d0e69[_0x43fb('0x1a')]?_0x5d0e69[_0x43fb('0x1a')][_0x43fb('0x1b')]||null:null,'attributes':_0x5d0e69[_0x43fb('0x1a')]?_0x5d0e69[_0x43fb('0x1a')][_0x43fb('0x1c')]||null:null,'limit':_0x5d0e69[_0x43fb('0x1a')]?_0x5d0e69[_0x43fb('0x1a')]['limit']||null:null,'include':_0x5d0e69['options']?_0x5d0e69[_0x43fb('0x1a')][_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x5d0e69['options'][_0x43fb('0x1d')],function(_0x14e08d){return{'model':db[_0x14e08d[_0x43fb('0x1f')]],'as':_0x14e08d['as'],'attributes':_0x14e08d[_0x43fb('0x1c')],'include':_0x14e08d[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x14e08d[_0x43fb('0x1d')],function(_0x304806){return{'model':db[_0x304806[_0x43fb('0x1f')]],'as':_0x304806['as'],'attributes':_0x304806[_0x43fb('0x1c')],'include':_0x304806[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x304806['include'],function(_0x425c5b){return{'model':db[_0x425c5b[_0x43fb('0x1f')]],'as':_0x425c5b['as'],'attributes':_0x425c5b[_0x43fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x43fb('0x20')](function(_0x33f538){logger[_0x43fb('0xd')](_0x43fb('0x16'),_0x5d0e69);logger[_0x43fb('0xf')](_0x43fb('0x16'),_0x5d0e69,JSON['stringify'](_0x33f538));_0x445ace(_0x33f538);})[_0x43fb('0x15')](function(_0xc09976){logger['error'](_0x43fb('0x16'),_0xc09976[_0x43fb('0x12')],_0x5d0e69);_0xf1f181(_0x155749[_0x43fb('0x10')](0x1f4,_0xc09976[_0x43fb('0x12')]));});});};exports['ShowZohoAccount']=function(_0x40c8df){var _0x3ee814=this;return new Promise(function(_0x3d91fd,_0x4ba030){return db[_0x43fb('0x17')]['find']({'raw':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df['options']['raw']===undefined?!![]:![]:!![],'where':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df[_0x43fb('0x1a')][_0x43fb('0x1b')]||null:null,'attributes':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df[_0x43fb('0x1a')]['attributes']||null:null,'include':_0x40c8df[_0x43fb('0x1a')]?_0x40c8df['options'][_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x40c8df[_0x43fb('0x1a')][_0x43fb('0x1d')],function(_0x3b4f14){return{'model':db[_0x3b4f14[_0x43fb('0x1f')]],'as':_0x3b4f14['as'],'attributes':_0x3b4f14[_0x43fb('0x1c')],'include':_0x3b4f14[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x3b4f14[_0x43fb('0x1d')],function(_0x2bc728){return{'model':db[_0x2bc728['model']],'as':_0x2bc728['as'],'attributes':_0x2bc728['attributes'],'include':_0x2bc728[_0x43fb('0x1d')]?_[_0x43fb('0x1e')](_0x2bc728['include'],function(_0x3979f1){return{'model':db[_0x3979f1[_0x43fb('0x1f')]],'as':_0x3979f1['as'],'attributes':_0x3979f1[_0x43fb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x227bed){logger[_0x43fb('0xd')](_0x43fb('0x21'),_0x40c8df);logger[_0x43fb('0xf')](_0x43fb('0x21'),_0x40c8df,JSON[_0x43fb('0x22')](_0x227bed));_0x3d91fd(_0x227bed);})['catch'](function(_0x44313a){logger[_0x43fb('0x10')]('ShowZohoAccount',_0x44313a[_0x43fb('0x12')],_0x40c8df);_0x4ba030(_0x3ee814[_0x43fb('0x10')](0x1f4,_0x44313a[_0x43fb('0x12')]));});});}; \ No newline at end of file +var _0x7b66=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','options','raw','limit','include','attributes','map','model','debug','ShowZohoAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x16644e,_0x1fb3b3){var _0x3f39d0=function(_0x3f6f5e){while(--_0x3f6f5e){_0x16644e['push'](_0x16644e['shift']());}};_0x3f39d0(++_0x1fb3b3);}(_0x7b66,0xe8));var _0x67b6=function(_0x474e1a,_0x52e117){_0x474e1a=_0x474e1a-0x0;var _0x4bb52b=_0x7b66[_0x474e1a];return _0x4bb52b;};'use strict';var _=require(_0x67b6('0x0'));var util=require('util');var moment=require(_0x67b6('0x1'));var BPromise=require(_0x67b6('0x2'));var rs=require(_0x67b6('0x3'));var fs=require('fs');var Redis=require(_0x67b6('0x4'));var db=require(_0x67b6('0x5'))['db'];var utils=require(_0x67b6('0x6'));var logger=require('../../config/logger')(_0x67b6('0x7'));var config=require('../../config/environment');var jayson=require(_0x67b6('0x8'));var client=jayson[_0x67b6('0x9')][_0x67b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24a3cf,_0x52218c,_0x24e6c0){return new BPromise(function(_0x930507,_0x432fe5){return client[_0x67b6('0xb')](_0x24a3cf,_0x24e6c0)[_0x67b6('0xc')](function(_0x878231){logger[_0x67b6('0xd')](_0x67b6('0xe'),_0x52218c,_0x67b6('0xf'));logger['debug'](_0x67b6('0x10'),_0x52218c,'request\x20sent',JSON[_0x67b6('0x11')](_0x878231));if(_0x878231[_0x67b6('0x12')]){if(_0x878231[_0x67b6('0x12')]['code']===0x1f4){logger[_0x67b6('0x12')](_0x67b6('0xe'),_0x52218c,_0x878231[_0x67b6('0x12')][_0x67b6('0x13')]);return _0x432fe5(_0x878231[_0x67b6('0x12')][_0x67b6('0x13')]);}logger[_0x67b6('0x12')](_0x67b6('0xe'),_0x52218c,_0x878231['error'][_0x67b6('0x13')]);return _0x930507(_0x878231['error'][_0x67b6('0x13')]);}else{logger['info'](_0x67b6('0xe'),_0x52218c,_0x67b6('0xf'));_0x930507(_0x878231[_0x67b6('0x14')]['message']);}})[_0x67b6('0x15')](function(_0x1082f1){logger[_0x67b6('0x12')](_0x67b6('0xe'),_0x52218c,_0x1082f1);_0x432fe5(_0x1082f1);});});}exports[_0x67b6('0x16')]=function(_0x2f4512){var _0x581507=this;return new Promise(function(_0x48164c,_0x3efcf6){return db['ZohoAccount']['findAll']({'raw':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')][_0x67b6('0x18')]===undefined?!![]:![]:!![],'where':_0x2f4512['options']?_0x2f4512[_0x67b6('0x17')]['where']||null:null,'attributes':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')]['attributes']||null:null,'limit':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')][_0x67b6('0x19')]||null:null,'include':_0x2f4512[_0x67b6('0x17')]?_0x2f4512[_0x67b6('0x17')]['include']?_['map'](_0x2f4512[_0x67b6('0x17')][_0x67b6('0x1a')],function(_0x27c229){return{'model':db[_0x27c229['model']],'as':_0x27c229['as'],'attributes':_0x27c229[_0x67b6('0x1b')],'include':_0x27c229[_0x67b6('0x1a')]?_[_0x67b6('0x1c')](_0x27c229['include'],function(_0xf1f776){return{'model':db[_0xf1f776[_0x67b6('0x1d')]],'as':_0xf1f776['as'],'attributes':_0xf1f776[_0x67b6('0x1b')],'include':_0xf1f776['include']?_[_0x67b6('0x1c')](_0xf1f776[_0x67b6('0x1a')],function(_0x28d28b){return{'model':db[_0x28d28b[_0x67b6('0x1d')]],'as':_0x28d28b['as'],'attributes':_0x28d28b['attributes']};}):[]};}):[]};}):[]:[]})[_0x67b6('0xc')](function(_0x2fbd1d){logger[_0x67b6('0xd')](_0x67b6('0x16'),_0x2f4512);logger[_0x67b6('0x1e')]('GetZohoAccount',_0x2f4512,JSON[_0x67b6('0x11')](_0x2fbd1d));_0x48164c(_0x2fbd1d);})[_0x67b6('0x15')](function(_0x12e96b){logger[_0x67b6('0x12')]('GetZohoAccount',_0x12e96b[_0x67b6('0x13')],_0x2f4512);_0x3efcf6(_0x581507[_0x67b6('0x12')](0x1f4,_0x12e96b[_0x67b6('0x13')]));});});};exports[_0x67b6('0x1f')]=function(_0x197f75){var _0xf1adcd=this;return new Promise(function(_0x28671a,_0x3b0e64){return db['ZohoAccount'][_0x67b6('0x20')]({'raw':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')][_0x67b6('0x21')]||null:null,'attributes':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')][_0x67b6('0x1b')]||null:null,'include':_0x197f75[_0x67b6('0x17')]?_0x197f75[_0x67b6('0x17')]['include']?_[_0x67b6('0x1c')](_0x197f75['options']['include'],function(_0x362c11){return{'model':db[_0x362c11[_0x67b6('0x1d')]],'as':_0x362c11['as'],'attributes':_0x362c11[_0x67b6('0x1b')],'include':_0x362c11[_0x67b6('0x1a')]?_[_0x67b6('0x1c')](_0x362c11['include'],function(_0x394581){return{'model':db[_0x394581[_0x67b6('0x1d')]],'as':_0x394581['as'],'attributes':_0x394581[_0x67b6('0x1b')],'include':_0x394581['include']?_[_0x67b6('0x1c')](_0x394581[_0x67b6('0x1a')],function(_0x2c7aa5){return{'model':db[_0x2c7aa5[_0x67b6('0x1d')]],'as':_0x2c7aa5['as'],'attributes':_0x2c7aa5[_0x67b6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x67b6('0xc')](function(_0x37e38b){logger['info'](_0x67b6('0x1f'),_0x197f75);logger['debug'](_0x67b6('0x1f'),_0x197f75,JSON[_0x67b6('0x11')](_0x37e38b));_0x28671a(_0x37e38b);})[_0x67b6('0x15')](function(_0xffc4c6){logger[_0x67b6('0x12')](_0x67b6('0x1f'),_0xffc4c6[_0x67b6('0x13')],_0x197f75);_0x3b0e64(_0xf1adcd[_0x67b6('0x12')](0x1f4,_0xffc4c6[_0x67b6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 15727ef..d5c657a 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 _0x9d62=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports'];(function(_0x521aef,_0x1dccbd){var _0x170172=function(_0x41eadc){while(--_0x41eadc){_0x521aef['push'](_0x521aef['shift']());}};_0x170172(++_0x1dccbd);}(_0x9d62,0xaf));var _0x29d6=function(_0x47432a,_0x31c4ed){_0x47432a=_0x47432a-0x0;var _0x21cd01=_0x9d62[_0x47432a];return _0x21cd01;};'use strict';var multer=require(_0x29d6('0x0'));var util=require(_0x29d6('0x1'));var path=require(_0x29d6('0x2'));var timeout=require(_0x29d6('0x3'));var express=require(_0x29d6('0x4'));var router=express['Router']();var auth=require(_0x29d6('0x5'));var interaction=require(_0x29d6('0x6'));var config=require(_0x29d6('0x7'));var controller=require(_0x29d6('0x8'));router[_0x29d6('0x9')]('/',auth['isAuthenticated'](),controller[_0x29d6('0xa')]);router[_0x29d6('0x9')](_0x29d6('0xb'),auth[_0x29d6('0xc')](),controller[_0x29d6('0xd')]);router[_0x29d6('0x9')]('/:id/fields',auth[_0x29d6('0xc')](),controller[_0x29d6('0xe')]);router[_0x29d6('0x9')](_0x29d6('0xf'),auth[_0x29d6('0xc')](),controller[_0x29d6('0x10')]);router[_0x29d6('0x9')](_0x29d6('0x11'),auth['isAuthenticated'](),controller[_0x29d6('0x12')]);router[_0x29d6('0x13')]('/',auth[_0x29d6('0xc')](),controller[_0x29d6('0x14')]);router[_0x29d6('0x15')](_0x29d6('0xb'),auth[_0x29d6('0xc')](),controller['update']);router[_0x29d6('0x16')]('/:id',auth[_0x29d6('0xc')](),controller[_0x29d6('0x17')]);module[_0x29d6('0x18')]=router; \ No newline at end of file +var _0x92d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x1c5b9e,_0x46d588){var _0x30dcf3=function(_0x1096da){while(--_0x1096da){_0x1c5b9e['push'](_0x1c5b9e['shift']());}};_0x30dcf3(++_0x46d588);}(_0x92d7,0x17b));var _0x792d=function(_0x31e57f,_0x2a70ce){_0x31e57f=_0x31e57f-0x0;var _0x44fb7c=_0x92d7[_0x31e57f];return _0x44fb7c;};'use strict';var multer=require(_0x792d('0x0'));var util=require('util');var path=require(_0x792d('0x1'));var timeout=require(_0x792d('0x2'));var express=require(_0x792d('0x3'));var router=express[_0x792d('0x4')]();var auth=require(_0x792d('0x5'));var interaction=require(_0x792d('0x6'));var config=require(_0x792d('0x7'));var controller=require(_0x792d('0x8'));router[_0x792d('0x9')]('/',auth[_0x792d('0xa')](),controller['index']);router[_0x792d('0x9')](_0x792d('0xb'),auth[_0x792d('0xa')](),controller[_0x792d('0xc')]);router['get'](_0x792d('0xd'),auth[_0x792d('0xa')](),controller[_0x792d('0xe')]);router[_0x792d('0x9')](_0x792d('0xf'),auth[_0x792d('0xa')](),controller[_0x792d('0x10')]);router['get'](_0x792d('0x11'),auth['isAuthenticated'](),controller[_0x792d('0x12')]);router[_0x792d('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x792d('0x14')](_0x792d('0xb'),auth[_0x792d('0xa')](),controller['update']);router[_0x792d('0x15')](_0x792d('0xb'),auth[_0x792d('0xa')](),controller[_0x792d('0x16')]);module[_0x792d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7174693..cdd1802 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 _0x2b31=['STRING','lead','contact','contact_lead','sequelize','exports'];(function(_0x14f681,_0xa0808e){var _0x1d4cb2=function(_0x66e474){while(--_0x66e474){_0x14f681['push'](_0x14f681['shift']());}};_0x1d4cb2(++_0xa0808e);}(_0x2b31,0xa0));var _0x12b3=function(_0x4e150b,_0x2bb913){_0x4e150b=_0x4e150b-0x0;var _0x433ace=_0x2b31[_0x4e150b];return _0x433ace;};'use strict';var Sequelize=require(_0x12b3('0x0'));module[_0x12b3('0x1')]={'name':{'type':Sequelize[_0x12b3('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x12b3('0x3'),_0x12b3('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x12b3('0x5'),_0x12b3('0x4'),'lead'),'defaultValue':_0x12b3('0x5')},'description':{'type':Sequelize[_0x12b3('0x2')]}}; \ No newline at end of file +var _0x2312=['ENUM','lead','contact_lead','contact','STRING','sequelize'];(function(_0x4291ae,_0x32c6b4){var _0x8e8364=function(_0x45171d){while(--_0x45171d){_0x4291ae['push'](_0x4291ae['shift']());}};_0x8e8364(++_0x32c6b4);}(_0x2312,0x1af));var _0x2231=function(_0x990698,_0x3d54aa){_0x990698=_0x990698-0x0;var _0x52e882=_0x2312[_0x990698];return _0x52e882;};'use strict';var Sequelize=require(_0x2231('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x2231('0x1')](_0x2231('0x2'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x2231('0x3'),_0x2231('0x4'),_0x2231('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x2231('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2d82c39..06b7a58 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(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 d078d6e..e530645 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 _0x0b98=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','bluebird'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x0b98,0x1f4));var _0x80b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b98[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x80b9('0x0'));var util=require(_0x80b9('0x1'));var logger=require('../../config/logger')(_0x80b9('0x2'));var moment=require('moment');var BPromise=require(_0x80b9('0x3'));var rp=require(_0x80b9('0x4'));var fs=require('fs');var path=require(_0x80b9('0x5'));var rimraf=require(_0x80b9('0x6'));var config=require(_0x80b9('0x7'));var attributes=require(_0x80b9('0x8'));module['exports']=function(_0x3aa1e2,_0x48e543){return _0x3aa1e2[_0x80b9('0x9')](_0x80b9('0xa'),attributes,{'tableName':_0x80b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7964=['request-promise','exports','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0x7964,0x14c));var _0x4796=function(_0x5ee684,_0x470889){_0x5ee684=_0x5ee684-0x0;var _0x9916ba=_0x7964[_0x5ee684];return _0x9916ba;};'use strict';var _=require(_0x4796('0x0'));var util=require('util');var logger=require(_0x4796('0x1'))('api');var moment=require(_0x4796('0x2'));var BPromise=require(_0x4796('0x3'));var rp=require(_0x4796('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x4796('0x5')]=function(_0x17bc55,_0x3bf0ce){return _0x17bc55['define'](_0x4796('0x6'),attributes,{'tableName':_0x4796('0x7'),'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 0cd192f..6a9fee5 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 _0xeb75=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','ZohoConfiguration,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x267120,_0x4aee8f){var _0x3d4afa=function(_0x49d4ef){while(--_0x49d4ef){_0x267120['push'](_0x267120['shift']());}};_0x3d4afa(++_0x4aee8f);}(_0xeb75,0x16d));var _0x5eb7=function(_0x1d3a31,_0xc57aec){_0x1d3a31=_0x1d3a31-0x0;var _0x8a808e=_0xeb75[_0x1d3a31];return _0x8a808e;};'use strict';var _=require('lodash');var util=require(_0x5eb7('0x0'));var moment=require(_0x5eb7('0x1'));var BPromise=require(_0x5eb7('0x2'));var rs=require(_0x5eb7('0x3'));var fs=require('fs');var Redis=require(_0x5eb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5eb7('0x5'));var logger=require('../../config/logger')(_0x5eb7('0x6'));var config=require(_0x5eb7('0x7'));var jayson=require(_0x5eb7('0x8'));var client=jayson[_0x5eb7('0x9')][_0x5eb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cb72,_0x48e4ac,_0x55a18a){return new BPromise(function(_0x1c1640,_0x12e9bc){return client[_0x5eb7('0xb')](_0x42cb72,_0x55a18a)['then'](function(_0x3318ab){logger[_0x5eb7('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x48e4ac,_0x5eb7('0xd'));logger[_0x5eb7('0xe')](_0x5eb7('0xf'),_0x48e4ac,_0x5eb7('0xd'),JSON[_0x5eb7('0x10')](_0x3318ab));if(_0x3318ab['error']){if(_0x3318ab['error']['code']===0x1f4){logger['error'](_0x5eb7('0x11'),_0x48e4ac,_0x3318ab[_0x5eb7('0x12')][_0x5eb7('0x13')]);return _0x12e9bc(_0x3318ab[_0x5eb7('0x12')]['message']);}logger[_0x5eb7('0x12')](_0x5eb7('0x11'),_0x48e4ac,_0x3318ab['error'][_0x5eb7('0x13')]);return _0x1c1640(_0x3318ab[_0x5eb7('0x12')]['message']);}else{logger[_0x5eb7('0xc')](_0x5eb7('0x11'),_0x48e4ac,_0x5eb7('0xd'));_0x1c1640(_0x3318ab[_0x5eb7('0x14')]['message']);}})['catch'](function(_0x3b2255){logger[_0x5eb7('0x12')](_0x5eb7('0x11'),_0x48e4ac,_0x3b2255);_0x12e9bc(_0x3b2255);});});} \ No newline at end of file +var _0xd3c0=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x21c7d8,_0x32acc5){var _0x277d59=function(_0x1f5ca9){while(--_0x1f5ca9){_0x21c7d8['push'](_0x21c7d8['shift']());}};_0x277d59(++_0x32acc5);}(_0xd3c0,0xb0));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d3c('0x0'));var util=require('util');var moment=require(_0x0d3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d3c('0x2'));var fs=require('fs');var Redis=require(_0x0d3c('0x3'));var db=require(_0x0d3c('0x4'))['db'];var utils=require(_0x0d3c('0x5'));var logger=require('../../config/logger')(_0x0d3c('0x6'));var config=require(_0x0d3c('0x7'));var jayson=require(_0x0d3c('0x8'));var client=jayson[_0x0d3c('0x9')][_0x0d3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x124dbf,_0x237d80,_0x3e938e){return new BPromise(function(_0x5e84db,_0x1dda9d){return client['request'](_0x124dbf,_0x3e938e)[_0x0d3c('0xb')](function(_0x2ed6c5){logger[_0x0d3c('0xc')](_0x0d3c('0xd'),_0x237d80,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x237d80,_0x0d3c('0xe'),JSON[_0x0d3c('0xf')](_0x2ed6c5));if(_0x2ed6c5[_0x0d3c('0x10')]){if(_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x11')]===0x1f4){logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);return _0x1dda9d(_0x2ed6c5['error'][_0x0d3c('0x12')]);}logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);return _0x5e84db(_0x2ed6c5[_0x0d3c('0x10')][_0x0d3c('0x12')]);}else{logger[_0x0d3c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x237d80,'request\x20sent');_0x5e84db(_0x2ed6c5['result'][_0x0d3c('0x12')]);}})[_0x0d3c('0x13')](function(_0x43891e){logger[_0x0d3c('0x10')](_0x0d3c('0xd'),_0x237d80,_0x43891e);_0x1dda9d(_0x43891e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0675914..db971eb 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 _0xe2cf=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x2b53b7,_0x2136f4){var _0x4c8a3e=function(_0x545407){while(--_0x545407){_0x2b53b7['push'](_0x2b53b7['shift']());}};_0x4c8a3e(++_0x2136f4);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x55fd40,_0x225b77){_0x55fd40=_0x55fd40-0x0;var _0x7979f1=_0xe2cf[_0x55fd40];return _0x7979f1;};'use strict';var multer=require('multer');var util=require(_0xfe2c('0x0'));var path=require('path');var timeout=require(_0xfe2c('0x1'));var express=require('express');var router=express[_0xfe2c('0x2')]();var auth=require(_0xfe2c('0x3'));var interaction=require(_0xfe2c('0x4'));var config=require(_0xfe2c('0x5'));var controller=require('./intZohoField.controller');router[_0xfe2c('0x6')]('/',auth[_0xfe2c('0x7')](),controller['index']);router['get'](_0xfe2c('0x8'),auth[_0xfe2c('0x7')](),controller['show']);router['post']('/',auth[_0xfe2c('0x7')](),controller[_0xfe2c('0x9')]);router[_0xfe2c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfe2c('0xb')]);router[_0xfe2c('0xc')]('/:id',auth[_0xfe2c('0x7')](),controller[_0xfe2c('0xd')]);module[_0xfe2c('0xe')]=router; \ No newline at end of file +var _0x896e=['isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x449bb1,_0x1a28eb){var _0x1cb230=function(_0x58234e){while(--_0x58234e){_0x449bb1['push'](_0x449bb1['shift']());}};_0x1cb230(++_0x1a28eb);}(_0x896e,0x1e9));var _0xe896=function(_0x5485f8,_0xf8ab61){_0x5485f8=_0x5485f8-0x0;var _0x15852d=_0x896e[_0x5485f8];return _0x15852d;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var auth=require(_0xe896('0x6'));var interaction=require(_0xe896('0x7'));var config=require(_0xe896('0x8'));var controller=require(_0xe896('0x9'));router[_0xe896('0xa')]('/',auth[_0xe896('0xb')](),controller['index']);router[_0xe896('0xa')](_0xe896('0xc'),auth[_0xe896('0xb')](),controller[_0xe896('0xd')]);router[_0xe896('0xe')]('/',auth['isAuthenticated'](),controller[_0xe896('0xf')]);router[_0xe896('0x10')](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x11')]);router['delete'](_0xe896('0xc'),auth['isAuthenticated'](),controller[_0xe896('0x12')]);module[_0xe896('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2e76f79..57d2725 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 _0xdbbe=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0xdbbe,0x148));var _0xedbb=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xdbbe[_0x8dc04d];return _0x2f5f28;};'use strict';var Sequelize=require('sequelize');module[_0xedbb('0x0')]={'type':{'type':Sequelize[_0xedbb('0x1')](_0xedbb('0x2'),_0xedbb('0x3'),_0xedbb('0x4'),_0xedbb('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xedbb('0x6')]},'key':{'type':Sequelize[_0xedbb('0x6')]},'keyType':{'type':Sequelize[_0xedbb('0x1')](_0xedbb('0x2'),_0xedbb('0x3'),_0xedbb('0x4'))},'keyContent':{'type':Sequelize[_0xedbb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedbb('0x6')]},'customField':{'type':Sequelize[_0xedbb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6d2=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x4b7ae6,_0x39b213){var _0x59e767=function(_0x36664d){while(--_0x36664d){_0x4b7ae6['push'](_0x4b7ae6['shift']());}};_0x59e767(++_0x39b213);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x17faec,_0x4503dd){_0x17faec=_0x17faec-0x0;var _0x1280da=_0xd6d2[_0x17faec];return _0x1280da;};'use strict';var Sequelize=require(_0x2d6d('0x0'));module[_0x2d6d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2d6d('0x2'),_0x2d6d('0x3'),'customVariable',_0x2d6d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2d6d('0x5')]},'key':{'type':Sequelize[_0x2d6d('0x5')]},'keyType':{'type':Sequelize[_0x2d6d('0x6')]('string',_0x2d6d('0x3'),_0x2d6d('0x7'))},'keyContent':{'type':Sequelize[_0x2d6d('0x5')]},'idField':{'type':Sequelize[_0x2d6d('0x5')]},'nameField':{'type':Sequelize[_0x2d6d('0x5')]},'customField':{'type':Sequelize[_0x2d6d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d6d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4419395..6359a2f 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 _0xdeca=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','ZohoField','rawAttributes','type','key','model','name','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x26c7c8,_0x1bbfff){var _0x47ffa9=function(_0x568d94){while(--_0x568d94){_0x26c7c8['push'](_0x26c7c8['shift']());}};_0x47ffa9(++_0x1bbfff);}(_0xdeca,0x164));var _0xadec=function(_0x6f9c8d,_0x24544a){_0x6f9c8d=_0x6f9c8d-0x0;var _0x2773e0=_0xdeca[_0x6f9c8d];return _0x2773e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xadec('0x0'));var rimraf=require(_0xadec('0x1'));var zipdir=require(_0xadec('0x2'));var jsonpatch=require(_0xadec('0x3'));var rp=require(_0xadec('0x4'));var moment=require(_0xadec('0x5'));var BPromise=require(_0xadec('0x6'));var Mustache=require(_0xadec('0x7'));var util=require(_0xadec('0x8'));var path=require(_0xadec('0x9'));var sox=require(_0xadec('0xa'));var csv=require(_0xadec('0xb'));var ejs=require(_0xadec('0xc'));var fs=require('fs');var _=require(_0xadec('0xd'));var squel=require(_0xadec('0xe'));var crypto=require('crypto');var jsforce=require(_0xadec('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xadec('0xb'));var querystring=require(_0xadec('0x10'));var Papa=require(_0xadec('0x11'));var Redis=require(_0xadec('0x12'));var authService=require(_0xadec('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xadec('0x14'))(_0xadec('0x15'));var utils=require(_0xadec('0x16'));var config=require(_0xadec('0x17'));var licenseUtil=require(_0xadec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d42c5,_0x819418){_0x819418=_0x819418||0xcc;return function(_0x11f13a){if(_0x11f13a){return _0x5d42c5[_0xadec('0x19')](_0x819418);}return _0x5d42c5[_0xadec('0x1a')](_0x819418)[_0xadec('0x1b')]();};}function respondWithResult(_0x28c2ec,_0x14200c){_0x14200c=_0x14200c||0xc8;return function(_0xce0215){if(_0xce0215){return _0x28c2ec['status'](_0x14200c)[_0xadec('0x1c')](_0xce0215);}};}function respondWithFilteredResult(_0x50a961,_0x157f43){return function(_0xb8435d){if(_0xb8435d){var _0x45029b=_0xb8435d[_0xadec('0x1d')],_0x51c8a3=_0x157f43[_0xadec('0x1e')],_0x5d782b=_0x157f43[_0xadec('0x1e')]+_0x157f43['limit'],_0x1c6dd7;if(_0x5d782b>=_0x45029b){_0x5d782b=_0x45029b;_0x1c6dd7=0xc8;}else{_0x1c6dd7=0xce;}_0x50a961[_0xadec('0x1a')](_0x1c6dd7);return _0x50a961[_0xadec('0x1f')](_0xadec('0x20'),_0x51c8a3+'-'+_0x5d782b+'/'+_0x45029b)[_0xadec('0x1c')](_0xb8435d);}return null;};}function patchUpdates(_0x3b40d5){return function(_0x242056){try{jsonpatch[_0xadec('0x21')](_0x242056,_0x3b40d5,!![]);}catch(_0x3f64c3){return BPromise[_0xadec('0x22')](_0x3f64c3);}return _0x242056[_0xadec('0x23')]();};}function saveUpdates(_0xd4a2b0,_0x81846e){return function(_0x8f88b1){if(_0x8f88b1){return _0x8f88b1[_0xadec('0x24')](_0xd4a2b0)[_0xadec('0x25')](function(_0x75a3f1){return _0x75a3f1;});}return null;};}function removeEntity(_0x54fc91,_0x1e5fc8){return function(_0x59837d){if(_0x59837d){return _0x59837d[_0xadec('0x26')]()[_0xadec('0x25')](function(){_0x54fc91['status'](0xcc)[_0xadec('0x1b')]();});}};}function handleEntityNotFound(_0x5d44d2,_0x2821b7){return function(_0xc63851){if(!_0xc63851){_0x5d44d2['sendStatus'](0x194);}return _0xc63851;};}function handleError(_0x42133c,_0x181197){_0x181197=_0x181197||0x1f4;return function(_0x2a8ee9){logger[_0xadec('0x27')](_0x2a8ee9[_0xadec('0x28')]);if(_0x2a8ee9['name']){delete _0x2a8ee9['name'];}_0x42133c[_0xadec('0x1a')](_0x181197)[_0xadec('0x29')](_0x2a8ee9);};}exports['index']=function(_0xa9e15e,_0x5dd3bb){var _0x7a5063={},_0x2faf1e={},_0x268fad={'count':0x0,'rows':[]};var _0xda4d0a=_[_0xadec('0x2a')](db[_0xadec('0x2b')][_0xadec('0x2c')],function(_0x5c9a3c){return{'name':_0x5c9a3c['fieldName'],'type':_0x5c9a3c[_0xadec('0x2d')][_0xadec('0x2e')]};});_0x2faf1e[_0xadec('0x2f')]=_[_0xadec('0x2a')](_0xda4d0a,_0xadec('0x30'));_0x2faf1e[_0xadec('0x31')]=_['keys'](_0xa9e15e[_0xadec('0x31')]);_0x2faf1e['filters']=_[_0xadec('0x32')](_0x2faf1e['model'],_0x2faf1e['query']);_0x7a5063[_0xadec('0x33')]=_[_0xadec('0x32')](_0x2faf1e[_0xadec('0x2f')],qs['fields'](_0xa9e15e[_0xadec('0x31')]['fields']));_0x7a5063[_0xadec('0x33')]=_0x7a5063[_0xadec('0x33')][_0xadec('0x34')]?_0x7a5063['attributes']:_0x2faf1e[_0xadec('0x2f')];if(!_0xa9e15e['query'][_0xadec('0x35')](_0xadec('0x36'))){_0x7a5063[_0xadec('0x37')]=qs['limit'](_0xa9e15e[_0xadec('0x31')][_0xadec('0x37')]);_0x7a5063[_0xadec('0x1e')]=qs[_0xadec('0x1e')](_0xa9e15e[_0xadec('0x31')][_0xadec('0x1e')]);}_0x7a5063[_0xadec('0x38')]=qs[_0xadec('0x39')](_0xa9e15e['query']['sort']);_0x7a5063[_0xadec('0x3a')]=qs['filters'](_[_0xadec('0x3b')](_0xa9e15e[_0xadec('0x31')],_0x2faf1e[_0xadec('0x3c')]),_0xda4d0a);if(_0xa9e15e[_0xadec('0x31')]['filter']){_0x7a5063[_0xadec('0x3a')]=_[_0xadec('0x3d')](_0x7a5063[_0xadec('0x3a')],{'$or':_[_0xadec('0x2a')](_0xda4d0a,function(_0x286910){if(_0x286910[_0xadec('0x2d')]!==_0xadec('0x3e')){var _0x146e9c={};_0x146e9c[_0x286910[_0xadec('0x30')]]={'$like':'%'+_0xa9e15e[_0xadec('0x31')][_0xadec('0x3f')]+'%'};return _0x146e9c;}})});}_0x7a5063=_[_0xadec('0x3d')]({},_0x7a5063,_0xa9e15e[_0xadec('0x40')]);var _0x261896={'where':_0x7a5063['where']};return db['ZohoField'][_0xadec('0x1d')](_0x261896)[_0xadec('0x25')](function(_0x31063b){_0x268fad[_0xadec('0x1d')]=_0x31063b;if(_0xa9e15e[_0xadec('0x31')][_0xadec('0x41')]){_0x7a5063[_0xadec('0x42')]=[{'all':!![]}];}return db[_0xadec('0x2b')][_0xadec('0x43')](_0x7a5063);})['then'](function(_0x4cfc84){_0x268fad[_0xadec('0x44')]=_0x4cfc84;return _0x268fad;})[_0xadec('0x25')](respondWithFilteredResult(_0x5dd3bb,_0x7a5063))[_0xadec('0x45')](handleError(_0x5dd3bb,null));};exports[_0xadec('0x46')]=function(_0x3cc2c0,_0x4e9ba6){var _0x3e0e36={'raw':!![],'where':{'id':_0x3cc2c0[_0xadec('0x47')]['id']}},_0x4e16dc={};_0x4e16dc[_0xadec('0x2f')]=_[_0xadec('0x48')](db[_0xadec('0x2b')][_0xadec('0x2c')]);_0x4e16dc['query']=_[_0xadec('0x48')](_0x3cc2c0['query']);_0x4e16dc['filters']=_['intersection'](_0x4e16dc[_0xadec('0x2f')],_0x4e16dc[_0xadec('0x31')]);_0x3e0e36[_0xadec('0x33')]=_[_0xadec('0x32')](_0x4e16dc['model'],qs[_0xadec('0x49')](_0x3cc2c0[_0xadec('0x31')][_0xadec('0x49')]));_0x3e0e36[_0xadec('0x33')]=_0x3e0e36[_0xadec('0x33')]['length']?_0x3e0e36[_0xadec('0x33')]:_0x4e16dc[_0xadec('0x2f')];if(_0x3cc2c0[_0xadec('0x31')]['includeAll']){_0x3e0e36[_0xadec('0x42')]=[{'all':!![]}];}_0x3e0e36=_[_0xadec('0x3d')]({},_0x3e0e36,_0x3cc2c0[_0xadec('0x40')]);return db[_0xadec('0x2b')][_0xadec('0x4a')](_0x3e0e36)['then'](handleEntityNotFound(_0x4e9ba6,null))['then'](respondWithResult(_0x4e9ba6,null))[_0xadec('0x45')](handleError(_0x4e9ba6,null));};exports[_0xadec('0x4b')]=function(_0x523ee3,_0x22c2be){return db['ZohoField'][_0xadec('0x4b')](_0x523ee3['body'],{})[_0xadec('0x25')](respondWithResult(_0x22c2be,0xc9))[_0xadec('0x45')](handleError(_0x22c2be,null));};exports[_0xadec('0x24')]=function(_0x552fee,_0x199314){if(_0x552fee[_0xadec('0x4c')]['id']){delete _0x552fee[_0xadec('0x4c')]['id'];}return db[_0xadec('0x2b')][_0xadec('0x4a')]({'where':{'id':_0x552fee[_0xadec('0x47')]['id']}})[_0xadec('0x25')](handleEntityNotFound(_0x199314,null))['then'](saveUpdates(_0x552fee[_0xadec('0x4c')],null))[_0xadec('0x25')](respondWithResult(_0x199314,null))[_0xadec('0x45')](handleError(_0x199314,null));};exports[_0xadec('0x26')]=function(_0x252d59,_0x3714a1){return db[_0xadec('0x2b')][_0xadec('0x4a')]({'where':{'id':_0x252d59[_0xadec('0x47')]['id']}})[_0xadec('0x25')](handleEntityNotFound(_0x3714a1,null))[_0xadec('0x25')](removeEntity(_0x3714a1,null))[_0xadec('0x45')](handleError(_0x3714a1,null));}; \ No newline at end of file +var _0x73f3=['hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','destroy','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x73f3,0x1eb));var _0x373f=function(_0x3267e7,_0x3398e5){_0x3267e7=_0x3267e7-0x0;var _0x16b65e=_0x73f3[_0x3267e7];return _0x16b65e;};'use strict';var pdf=require(_0x373f('0x0'));var emlformat=require(_0x373f('0x1'));var rimraf=require(_0x373f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x373f('0x3'));var rp=require(_0x373f('0x4'));var moment=require(_0x373f('0x5'));var BPromise=require(_0x373f('0x6'));var Mustache=require(_0x373f('0x7'));var util=require(_0x373f('0x8'));var path=require('path');var sox=require(_0x373f('0x9'));var csv=require(_0x373f('0xa'));var ejs=require(_0x373f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x373f('0xc'));var crypto=require(_0x373f('0xd'));var jsforce=require(_0x373f('0xe'));var deskjs=require(_0x373f('0xf'));var toCsv=require(_0x373f('0xa'));var querystring=require(_0x373f('0x10'));var Papa=require(_0x373f('0x11'));var Redis=require(_0x373f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x373f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x373f('0x14'));var utils=require(_0x373f('0x15'));var config=require(_0x373f('0x16'));var licenseUtil=require(_0x373f('0x17'));var db=require(_0x373f('0x18'))['db'];function respondWithStatusCode(_0x4205af,_0x4b5490){_0x4b5490=_0x4b5490||0xcc;return function(_0x571c4b){if(_0x571c4b){return _0x4205af[_0x373f('0x19')](_0x4b5490);}return _0x4205af['status'](_0x4b5490)[_0x373f('0x1a')]();};}function respondWithResult(_0x7103ff,_0xfbed91){_0xfbed91=_0xfbed91||0xc8;return function(_0x46d6d2){if(_0x46d6d2){return _0x7103ff[_0x373f('0x1b')](_0xfbed91)[_0x373f('0x1c')](_0x46d6d2);}};}function respondWithFilteredResult(_0x476787,_0xb635d7){return function(_0x5301d7){if(_0x5301d7){var _0x3472d0=_0x5301d7['count'],_0x3a587c=_0xb635d7['offset'],_0x42adf2=_0xb635d7['offset']+_0xb635d7[_0x373f('0x1d')],_0x16e4b8;if(_0x42adf2>=_0x3472d0){_0x42adf2=_0x3472d0;_0x16e4b8=0xc8;}else{_0x16e4b8=0xce;}_0x476787['status'](_0x16e4b8);return _0x476787['set'](_0x373f('0x1e'),_0x3a587c+'-'+_0x42adf2+'/'+_0x3472d0)[_0x373f('0x1c')](_0x5301d7);}return null;};}function patchUpdates(_0x31c9b0){return function(_0x18cb6f){try{jsonpatch[_0x373f('0x1f')](_0x18cb6f,_0x31c9b0,!![]);}catch(_0x3ef911){return BPromise[_0x373f('0x20')](_0x3ef911);}return _0x18cb6f[_0x373f('0x21')]();};}function saveUpdates(_0x3f7b8b,_0x425c66){return function(_0x37402a){if(_0x37402a){return _0x37402a[_0x373f('0x22')](_0x3f7b8b)[_0x373f('0x23')](function(_0x3e0df9){return _0x3e0df9;});}return null;};}function removeEntity(_0xe7a6fc,_0x359fb3){return function(_0xc90f23){if(_0xc90f23){return _0xc90f23['destroy']()[_0x373f('0x23')](function(){_0xe7a6fc[_0x373f('0x1b')](0xcc)[_0x373f('0x1a')]();});}};}function handleEntityNotFound(_0x564953,_0x2c5e5c){return function(_0x384e7e){if(!_0x384e7e){_0x564953[_0x373f('0x19')](0x194);}return _0x384e7e;};}function handleError(_0x495a8d,_0x12aca5){_0x12aca5=_0x12aca5||0x1f4;return function(_0x38b140){logger[_0x373f('0x24')](_0x38b140[_0x373f('0x25')]);if(_0x38b140[_0x373f('0x26')]){delete _0x38b140['name'];}_0x495a8d[_0x373f('0x1b')](_0x12aca5)[_0x373f('0x27')](_0x38b140);};}exports[_0x373f('0x28')]=function(_0xd9ab67,_0x235403){var _0x29933={},_0x5dd9c8={},_0x2f9cc1={'count':0x0,'rows':[]};var _0x9b708e=_[_0x373f('0x29')](db[_0x373f('0x2a')][_0x373f('0x2b')],function(_0x4c20fd){return{'name':_0x4c20fd[_0x373f('0x2c')],'type':_0x4c20fd[_0x373f('0x2d')][_0x373f('0x2e')]};});_0x5dd9c8['model']=_[_0x373f('0x29')](_0x9b708e,_0x373f('0x26'));_0x5dd9c8[_0x373f('0x2f')]=_[_0x373f('0x30')](_0xd9ab67['query']);_0x5dd9c8[_0x373f('0x31')]=_[_0x373f('0x32')](_0x5dd9c8['model'],_0x5dd9c8[_0x373f('0x2f')]);_0x29933['attributes']=_[_0x373f('0x32')](_0x5dd9c8[_0x373f('0x33')],qs[_0x373f('0x34')](_0xd9ab67[_0x373f('0x2f')]['fields']));_0x29933[_0x373f('0x35')]=_0x29933['attributes'][_0x373f('0x36')]?_0x29933[_0x373f('0x35')]:_0x5dd9c8[_0x373f('0x33')];if(!_0xd9ab67[_0x373f('0x2f')][_0x373f('0x37')](_0x373f('0x38'))){_0x29933[_0x373f('0x1d')]=qs[_0x373f('0x1d')](_0xd9ab67['query'][_0x373f('0x1d')]);_0x29933[_0x373f('0x39')]=qs[_0x373f('0x39')](_0xd9ab67['query'][_0x373f('0x39')]);}_0x29933[_0x373f('0x3a')]=qs[_0x373f('0x3b')](_0xd9ab67[_0x373f('0x2f')]['sort']);_0x29933[_0x373f('0x3c')]=qs[_0x373f('0x31')](_[_0x373f('0x3d')](_0xd9ab67[_0x373f('0x2f')],_0x5dd9c8['filters']),_0x9b708e);if(_0xd9ab67['query'][_0x373f('0x3e')]){_0x29933[_0x373f('0x3c')]=_[_0x373f('0x3f')](_0x29933[_0x373f('0x3c')],{'$or':_['map'](_0x9b708e,function(_0x58ae38){if(_0x58ae38[_0x373f('0x2d')]!==_0x373f('0x40')){var _0x114ad={};_0x114ad[_0x58ae38['name']]={'$like':'%'+_0xd9ab67['query'][_0x373f('0x3e')]+'%'};return _0x114ad;}})});}_0x29933=_[_0x373f('0x3f')]({},_0x29933,_0xd9ab67['options']);var _0x1dad06={'where':_0x29933[_0x373f('0x3c')]};return db[_0x373f('0x2a')]['count'](_0x1dad06)[_0x373f('0x23')](function(_0x3c5418){_0x2f9cc1[_0x373f('0x41')]=_0x3c5418;if(_0xd9ab67[_0x373f('0x2f')][_0x373f('0x42')]){_0x29933[_0x373f('0x43')]=[{'all':!![]}];}return db[_0x373f('0x2a')][_0x373f('0x44')](_0x29933);})[_0x373f('0x23')](function(_0x2e2724){_0x2f9cc1[_0x373f('0x45')]=_0x2e2724;return _0x2f9cc1;})[_0x373f('0x23')](respondWithFilteredResult(_0x235403,_0x29933))[_0x373f('0x46')](handleError(_0x235403,null));};exports[_0x373f('0x47')]=function(_0x874689,_0x29d56e){var _0x23c358={'raw':!![],'where':{'id':_0x874689['params']['id']}},_0x44bc97={};_0x44bc97['model']=_[_0x373f('0x30')](db[_0x373f('0x2a')][_0x373f('0x2b')]);_0x44bc97[_0x373f('0x2f')]=_[_0x373f('0x30')](_0x874689[_0x373f('0x2f')]);_0x44bc97[_0x373f('0x31')]=_['intersection'](_0x44bc97[_0x373f('0x33')],_0x44bc97['query']);_0x23c358[_0x373f('0x35')]=_[_0x373f('0x32')](_0x44bc97[_0x373f('0x33')],qs[_0x373f('0x34')](_0x874689[_0x373f('0x2f')]['fields']));_0x23c358['attributes']=_0x23c358[_0x373f('0x35')]['length']?_0x23c358[_0x373f('0x35')]:_0x44bc97[_0x373f('0x33')];if(_0x874689['query'][_0x373f('0x42')]){_0x23c358[_0x373f('0x43')]=[{'all':!![]}];}_0x23c358=_[_0x373f('0x3f')]({},_0x23c358,_0x874689[_0x373f('0x48')]);return db[_0x373f('0x2a')][_0x373f('0x49')](_0x23c358)[_0x373f('0x23')](handleEntityNotFound(_0x29d56e,null))[_0x373f('0x23')](respondWithResult(_0x29d56e,null))[_0x373f('0x46')](handleError(_0x29d56e,null));};exports['create']=function(_0x435ce1,_0xdbeef2){return db[_0x373f('0x2a')][_0x373f('0x4a')](_0x435ce1[_0x373f('0x4b')],{})[_0x373f('0x23')](respondWithResult(_0xdbeef2,0xc9))[_0x373f('0x46')](handleError(_0xdbeef2,null));};exports[_0x373f('0x22')]=function(_0xdc9809,_0xb45af1){if(_0xdc9809[_0x373f('0x4b')]['id']){delete _0xdc9809['body']['id'];}return db[_0x373f('0x2a')][_0x373f('0x49')]({'where':{'id':_0xdc9809['params']['id']}})[_0x373f('0x23')](handleEntityNotFound(_0xb45af1,null))['then'](saveUpdates(_0xdc9809[_0x373f('0x4b')],null))[_0x373f('0x23')](respondWithResult(_0xb45af1,null))['catch'](handleError(_0xb45af1,null));};exports[_0x373f('0x4c')]=function(_0x57aee2,_0x53dc09){return db[_0x373f('0x2a')][_0x373f('0x49')]({'where':{'id':_0x57aee2[_0x373f('0x4d')]['id']}})[_0x373f('0x23')](handleEntityNotFound(_0x53dc09,null))[_0x373f('0x23')](removeEntity(_0x53dc09,null))[_0x373f('0x46')](handleError(_0x53dc09,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d7e829f..0f3e8f5 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 _0x0444=['path','rimraf','../../config/environment','./intZohoField.attributes','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x213c63,_0x420de6){var _0x300bfb=function(_0x5d0b2e){while(--_0x5d0b2e){_0x213c63['push'](_0x213c63['shift']());}};_0x300bfb(++_0x420de6);}(_0x0444,0xe1));var _0x4044=function(_0x4c112e,_0x4276cd){_0x4c112e=_0x4c112e-0x0;var _0x4e8d90=_0x0444[_0x4c112e];return _0x4e8d90;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4044('0x0'))(_0x4044('0x1'));var moment=require(_0x4044('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4044('0x3'));var rimraf=require(_0x4044('0x4'));var config=require(_0x4044('0x5'));var attributes=require(_0x4044('0x6'));module['exports']=function(_0x4b3e36,_0x2f0ed8){return _0x4b3e36['define'](_0x4044('0x7'),attributes,{'tableName':_0x4044('0x8'),'paranoid':![],'indexes':[{'name':_0x4044('0x9'),'fields':[_0x4044('0xa'),_0x4044('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95fe=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields'];(function(_0x30f0ac,_0x5c4ee1){var _0x3132c5=function(_0x6d621e){while(--_0x6d621e){_0x30f0ac['push'](_0x30f0ac['shift']());}};_0x3132c5(++_0x5c4ee1);}(_0x95fe,0x7f));var _0xe95f=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x95fe[_0x2932cf];return _0x1711dd;};'use strict';var _=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var logger=require(_0xe95f('0x2'))(_0xe95f('0x3'));var moment=require(_0xe95f('0x4'));var BPromise=require(_0xe95f('0x5'));var rp=require(_0xe95f('0x6'));var fs=require('fs');var path=require(_0xe95f('0x7'));var rimraf=require(_0xe95f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe95f('0x9'));module[_0xe95f('0xa')]=function(_0x2a2ef1,_0x410ca7){return _0x2a2ef1['define'](_0xe95f('0xb'),attributes,{'tableName':_0xe95f('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xe95f('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 c645895..dc5f2de 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 _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x405dc0,_0x5f2898){var _0x1ed46d=function(_0x5efad7){while(--_0x5efad7){_0x405dc0['push'](_0x405dc0['shift']());}};_0x1ed46d(++_0x5f2898);}(_0x9a19,0x114));var _0x99a1=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x9a19[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('ZohoField,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file +var _0xa630=['client','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x383450,_0xefcb3b){var _0x49aa15=function(_0xb308b8){while(--_0xb308b8){_0x383450['push'](_0x383450['shift']());}};_0x49aa15(++_0xefcb3b);}(_0xa630,0xbe));var _0x0a63=function(_0x490541,_0x5e23a8){_0x490541=_0x490541-0x0;var _0x42e33c=_0xa630[_0x490541];return _0x42e33c;};'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/integration/index.js b/server/api/integration/index.js index 71502d4..b25ba37 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 _0xc244=['multer','path','express','../../components/auth/service','../../config/environment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xc244,0x118));var _0x4c24=function(_0x1e68d6,_0x498fbd){_0x1e68d6=_0x1e68d6-0x0;var _0x7379fa=_0xc244[_0x1e68d6];return _0x7379fa;};'use strict';var multer=require(_0x4c24('0x0'));var util=require('util');var path=require(_0x4c24('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c24('0x2'));var router=express['Router']();var auth=require(_0x4c24('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4c24('0x4'));module['exports']=router; \ No newline at end of file +var _0x1566=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0xe6e7fe,_0x2ca13d){var _0xb70453=function(_0x1db6cf){while(--_0x1db6cf){_0xe6e7fe['push'](_0xe6e7fe['shift']());}};_0xb70453(++_0x2ca13d);}(_0x1566,0x1a1));var _0x6156=function(_0x2baa5d,_0x42a1cb){_0x2baa5d=_0x2baa5d-0x0;var _0x88bf18=_0x1566[_0x2baa5d];return _0x88bf18;};'use strict';var multer=require(_0x6156('0x0'));var util=require(_0x6156('0x1'));var path=require(_0x6156('0x2'));var timeout=require(_0x6156('0x3'));var express=require(_0x6156('0x4'));var router=express['Router']();var auth=require(_0x6156('0x5'));var interaction=require(_0x6156('0x6'));var config=require(_0x6156('0x7'));module[_0x6156('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 f4ce87f..fc5d31a 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 _0x455e=['INTEGER','BOOLEAN','state','sequelize','STRING','app.js'];(function(_0x57bc41,_0x270339){var _0x3ebc9b=function(_0x383299){while(--_0x383299){_0x57bc41['push'](_0x57bc41['shift']());}};_0x3ebc9b(++_0x270339);}(_0x455e,0xab));var _0xe455=function(_0x25dd3b,_0x27e043){_0x25dd3b=_0x25dd3b-0x0;var _0x3084aa=_0x455e[_0x25dd3b];return _0x3084aa;};'use strict';var Sequelize=require(_0xe455('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe455('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xe455('0x2')},'filename':{'type':Sequelize[_0xe455('0x1')]},'path':{'type':Sequelize[_0xe455('0x1')]},'type':{'type':Sequelize[_0xe455('0x1')]},'size':{'type':Sequelize[_0xe455('0x3')]},'active':{'type':Sequelize[_0xe455('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xe455('0x1')]},'logo':{'type':Sequelize[_0xe455('0x1')]},'state':{'type':Sequelize[_0xe455('0x1')],'unique':_0xe455('0x5')},'description':{'type':Sequelize[_0xe455('0x1')]},'title':{'type':Sequelize[_0xe455('0x1')]},'remoteUri':{'type':Sequelize[_0xe455('0x1')]},'link':{'type':Sequelize[_0xe455('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc11c=['state','sequelize','STRING','BOOLEAN'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0xc11c,0x85));var _0xcc11=function(_0x3c3cfb,_0x3744e4){_0x3c3cfb=_0x3c3cfb-0x0;var _0x3fe9dd=_0xc11c[_0x3c3cfb];return _0x3fe9dd;};'use strict';var Sequelize=require(_0xcc11('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc11('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xcc11('0x1')]},'path':{'type':Sequelize[_0xcc11('0x1')]},'type':{'type':Sequelize[_0xcc11('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xcc11('0x2')],'defaultValue':![]},'author':{'type':Sequelize[_0xcc11('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xcc11('0x3')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xcc11('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 221ecca..cdc2504 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 _0x8d08=['mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','Content-Range','json','reject','update','then','end','error','stack','name','send','map','Integration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x44ace6,_0x448496){var _0x1b5359=function(_0x149c04){while(--_0x149c04){_0x44ace6['push'](_0x44ace6['shift']());}};_0x1b5359(++_0x448496);}(_0x8d08,0x118));var _0x88d0=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x8d08[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require(_0x88d0('0x0'));var emlformat=require(_0x88d0('0x1'));var rimraf=require(_0x88d0('0x2'));var zipdir=require(_0x88d0('0x3'));var jsonpatch=require(_0x88d0('0x4'));var rp=require(_0x88d0('0x5'));var moment=require(_0x88d0('0x6'));var BPromise=require(_0x88d0('0x7'));var Mustache=require(_0x88d0('0x8'));var util=require(_0x88d0('0x9'));var path=require(_0x88d0('0xa'));var sox=require(_0x88d0('0xb'));var csv=require('to-csv');var ejs=require(_0x88d0('0xc'));var fs=require('fs');var _=require(_0x88d0('0xd'));var squel=require('squel');var crypto=require(_0x88d0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x88d0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88d0('0x10'));var Papa=require(_0x88d0('0x11'));var Redis=require(_0x88d0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x88d0('0x13'));var as=require(_0x88d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88d0('0x15'))('api');var utils=require(_0x88d0('0x16'));var config=require(_0x88d0('0x17'));var licenseUtil=require(_0x88d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5de471,_0x5da161){_0x5da161=_0x5da161||0xcc;return function(_0x2854a5){if(_0x2854a5){return _0x5de471[_0x88d0('0x19')](_0x5da161);}return _0x5de471[_0x88d0('0x1a')](_0x5da161)['end']();};}function respondWithResult(_0x47a572,_0x57b18e){_0x57b18e=_0x57b18e||0xc8;return function(_0x461ae6){if(_0x461ae6){return _0x47a572[_0x88d0('0x1a')](_0x57b18e)['json'](_0x461ae6);}};}function respondWithFilteredResult(_0x2bba74,_0x189ea6){return function(_0x2b3ebd){if(_0x2b3ebd){var _0x37083a=_0x2b3ebd[_0x88d0('0x1b')],_0x5f10b4=_0x189ea6[_0x88d0('0x1c')],_0x36d3e2=_0x189ea6['offset']+_0x189ea6[_0x88d0('0x1d')],_0x371744;if(_0x36d3e2>=_0x37083a){_0x36d3e2=_0x37083a;_0x371744=0xc8;}else{_0x371744=0xce;}_0x2bba74[_0x88d0('0x1a')](_0x371744);return _0x2bba74['set'](_0x88d0('0x1e'),_0x5f10b4+'-'+_0x36d3e2+'/'+_0x37083a)[_0x88d0('0x1f')](_0x2b3ebd);}return null;};}function patchUpdates(_0x47bd00){return function(_0x1212a7){try{jsonpatch['apply'](_0x1212a7,_0x47bd00,!![]);}catch(_0x1b7acc){return BPromise[_0x88d0('0x20')](_0x1b7acc);}return _0x1212a7['save']();};}function saveUpdates(_0x463d67,_0x46aabb){return function(_0x251865){if(_0x251865){return _0x251865[_0x88d0('0x21')](_0x463d67)['then'](function(_0x6e5d5f){return _0x6e5d5f;});}return null;};}function removeEntity(_0xbeb2f9,_0x40155e){return function(_0x4e8b5a){if(_0x4e8b5a){return _0x4e8b5a['destroy']()[_0x88d0('0x22')](function(){_0xbeb2f9[_0x88d0('0x1a')](0xcc)[_0x88d0('0x23')]();});}};}function handleEntityNotFound(_0x3bd137,_0x2d2aac){return function(_0x24af46){if(!_0x24af46){_0x3bd137[_0x88d0('0x19')](0x194);}return _0x24af46;};}function handleError(_0x16cd98,_0x47481f){_0x47481f=_0x47481f||0x1f4;return function(_0x481a86){logger[_0x88d0('0x24')](_0x481a86[_0x88d0('0x25')]);if(_0x481a86[_0x88d0('0x26')]){delete _0x481a86[_0x88d0('0x26')];}_0x16cd98[_0x88d0('0x1a')](_0x47481f)[_0x88d0('0x27')](_0x481a86);};}exports['index']=function(_0x517d50,_0x16685c){var _0x10f155={},_0x2a5acb={},_0x2dcbeb={'count':0x0,'rows':[]};var _0x2d5690=_[_0x88d0('0x28')](db[_0x88d0('0x29')]['rawAttributes'],function(_0x28f306){return{'name':_0x28f306[_0x88d0('0x2a')],'type':_0x28f306[_0x88d0('0x2b')][_0x88d0('0x2c')]};});_0x2a5acb[_0x88d0('0x2d')]=_[_0x88d0('0x28')](_0x2d5690,_0x88d0('0x26'));_0x2a5acb[_0x88d0('0x2e')]=_[_0x88d0('0x2f')](_0x517d50[_0x88d0('0x2e')]);_0x2a5acb[_0x88d0('0x30')]=_[_0x88d0('0x31')](_0x2a5acb[_0x88d0('0x2d')],_0x2a5acb[_0x88d0('0x2e')]);_0x10f155['attributes']=_[_0x88d0('0x31')](_0x2a5acb[_0x88d0('0x2d')],qs[_0x88d0('0x32')](_0x517d50[_0x88d0('0x2e')][_0x88d0('0x32')]));_0x10f155[_0x88d0('0x33')]=_0x10f155[_0x88d0('0x33')][_0x88d0('0x34')]?_0x10f155[_0x88d0('0x33')]:_0x2a5acb['model'];if(!_0x517d50[_0x88d0('0x2e')][_0x88d0('0x35')](_0x88d0('0x36'))){_0x10f155[_0x88d0('0x1d')]=qs[_0x88d0('0x1d')](_0x517d50['query'][_0x88d0('0x1d')]);_0x10f155[_0x88d0('0x1c')]=qs[_0x88d0('0x1c')](_0x517d50[_0x88d0('0x2e')][_0x88d0('0x1c')]);}_0x10f155[_0x88d0('0x37')]=qs[_0x88d0('0x38')](_0x517d50[_0x88d0('0x2e')][_0x88d0('0x38')]);_0x10f155[_0x88d0('0x39')]=qs[_0x88d0('0x30')](_[_0x88d0('0x3a')](_0x517d50[_0x88d0('0x2e')],_0x2a5acb[_0x88d0('0x30')]),_0x2d5690);if(_0x517d50['query'][_0x88d0('0x3b')]){_0x10f155['where']=_[_0x88d0('0x3c')](_0x10f155['where'],{'$or':_[_0x88d0('0x28')](_0x2d5690,function(_0x353344){if(_0x353344[_0x88d0('0x2b')]!=='VIRTUAL'){var _0x343376={};_0x343376[_0x353344[_0x88d0('0x26')]]={'$like':'%'+_0x517d50[_0x88d0('0x2e')][_0x88d0('0x3b')]+'%'};return _0x343376;}})});}_0x10f155=_[_0x88d0('0x3c')]({},_0x10f155,_0x517d50['options']);var _0x3f7d74={'where':_0x10f155[_0x88d0('0x39')]};return db[_0x88d0('0x29')][_0x88d0('0x1b')](_0x3f7d74)[_0x88d0('0x22')](function(_0x5af9e4){_0x2dcbeb['count']=_0x5af9e4;if(_0x517d50[_0x88d0('0x2e')]['includeAll']){_0x10f155[_0x88d0('0x3d')]=[{'all':!![]}];}return db['Integration'][_0x88d0('0x3e')](_0x10f155);})['then'](function(_0x4492ea){_0x2dcbeb[_0x88d0('0x3f')]=_0x4492ea;return _0x2dcbeb;})[_0x88d0('0x22')](respondWithFilteredResult(_0x16685c,_0x10f155))['catch'](handleError(_0x16685c,null));};exports[_0x88d0('0x40')]=function(_0x2c3364,_0xa7bccb){var _0x355096={'raw':![],'where':{'id':_0x2c3364['params']['id']}},_0x414ca3={};_0x414ca3[_0x88d0('0x2d')]=_[_0x88d0('0x2f')](db[_0x88d0('0x29')][_0x88d0('0x41')]);_0x414ca3[_0x88d0('0x2e')]=_[_0x88d0('0x2f')](_0x2c3364[_0x88d0('0x2e')]);_0x414ca3[_0x88d0('0x30')]=_[_0x88d0('0x31')](_0x414ca3[_0x88d0('0x2d')],_0x414ca3[_0x88d0('0x2e')]);_0x355096['attributes']=_[_0x88d0('0x31')](_0x414ca3['model'],qs[_0x88d0('0x32')](_0x2c3364['query'][_0x88d0('0x32')]));_0x355096[_0x88d0('0x33')]=_0x355096['attributes'][_0x88d0('0x34')]?_0x355096['attributes']:_0x414ca3[_0x88d0('0x2d')];if(_0x2c3364['query'][_0x88d0('0x42')]){_0x355096[_0x88d0('0x3d')]=[{'all':!![]}];}_0x355096=_['merge']({},_0x355096,_0x2c3364[_0x88d0('0x43')]);return db[_0x88d0('0x29')]['find'](_0x355096)[_0x88d0('0x22')](handleEntityNotFound(_0xa7bccb,null))['then'](respondWithResult(_0xa7bccb,null))[_0x88d0('0x44')](handleError(_0xa7bccb,null));};exports['create']=function(_0x148ad8,_0x4666de){return db[_0x88d0('0x29')]['create'](_0x148ad8['body'],{})[_0x88d0('0x22')](respondWithResult(_0x4666de,0xc9))[_0x88d0('0x44')](handleError(_0x4666de,null));};exports[_0x88d0('0x21')]=function(_0x2f8956,_0x566ecc){if(_0x2f8956['body']['id']){delete _0x2f8956[_0x88d0('0x45')]['id'];}return db[_0x88d0('0x29')][_0x88d0('0x46')]({'where':{'id':_0x2f8956[_0x88d0('0x47')]['id']}})[_0x88d0('0x22')](handleEntityNotFound(_0x566ecc,null))[_0x88d0('0x22')](saveUpdates(_0x2f8956['body'],null))['then'](respondWithResult(_0x566ecc,null))[_0x88d0('0x44')](handleError(_0x566ecc,null));};exports['destroy']=function(_0x132923,_0xd9bd98){return db[_0x88d0('0x29')]['find']({'where':{'id':_0x132923[_0x88d0('0x47')]['id']}})[_0x88d0('0x22')](handleEntityNotFound(_0xd9bd98,null))[_0x88d0('0x22')](removeEntity(_0xd9bd98,null))[_0x88d0('0x44')](handleError(_0xd9bd98,null));}; \ No newline at end of file +var _0x1264=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters'];(function(_0x4eab4d,_0x1fbd49){var _0x3bffce=function(_0x1e4c66){while(--_0x1e4c66){_0x4eab4d['push'](_0x4eab4d['shift']());}};_0x3bffce(++_0x1fbd49);}(_0x1264,0x1af));var _0x4126=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x1264[_0x4d2993];return _0x427374;};'use strict';var pdf=require(_0x4126('0x0'));var emlformat=require(_0x4126('0x1'));var rimraf=require(_0x4126('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4126('0x3'));var moment=require(_0x4126('0x4'));var BPromise=require(_0x4126('0x5'));var Mustache=require(_0x4126('0x6'));var util=require(_0x4126('0x7'));var path=require(_0x4126('0x8'));var sox=require(_0x4126('0x9'));var csv=require(_0x4126('0xa'));var ejs=require(_0x4126('0xb'));var fs=require('fs');var _=require(_0x4126('0xc'));var squel=require(_0x4126('0xd'));var crypto=require(_0x4126('0xe'));var jsforce=require(_0x4126('0xf'));var deskjs=require(_0x4126('0x10'));var toCsv=require(_0x4126('0xa'));var querystring=require(_0x4126('0x11'));var Papa=require(_0x4126('0x12'));var Redis=require(_0x4126('0x13'));var authService=require(_0x4126('0x14'));var qs=require(_0x4126('0x15'));var as=require(_0x4126('0x16'));var hardwareService=require(_0x4126('0x17'));var logger=require('../../config/logger')(_0x4126('0x18'));var utils=require(_0x4126('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4126('0x1a'));var db=require(_0x4126('0x1b'))['db'];function respondWithStatusCode(_0x19fc1a,_0x37979d){_0x37979d=_0x37979d||0xcc;return function(_0x41fba8){if(_0x41fba8){return _0x19fc1a[_0x4126('0x1c')](_0x37979d);}return _0x19fc1a[_0x4126('0x1d')](_0x37979d)[_0x4126('0x1e')]();};}function respondWithResult(_0x4dc462,_0x50e750){_0x50e750=_0x50e750||0xc8;return function(_0x214cc7){if(_0x214cc7){return _0x4dc462[_0x4126('0x1d')](_0x50e750)['json'](_0x214cc7);}};}function respondWithFilteredResult(_0x4915cd,_0x5e37ed){return function(_0x52d751){if(_0x52d751){var _0x4980eb=_0x52d751[_0x4126('0x1f')],_0x62de4a=_0x5e37ed[_0x4126('0x20')],_0x1235f1=_0x5e37ed[_0x4126('0x20')]+_0x5e37ed[_0x4126('0x21')],_0x3ab245;if(_0x1235f1>=_0x4980eb){_0x1235f1=_0x4980eb;_0x3ab245=0xc8;}else{_0x3ab245=0xce;}_0x4915cd[_0x4126('0x1d')](_0x3ab245);return _0x4915cd[_0x4126('0x22')](_0x4126('0x23'),_0x62de4a+'-'+_0x1235f1+'/'+_0x4980eb)[_0x4126('0x24')](_0x52d751);}return null;};}function patchUpdates(_0x3c0158){return function(_0x8f17bc){try{jsonpatch[_0x4126('0x25')](_0x8f17bc,_0x3c0158,!![]);}catch(_0x5c9bcd){return BPromise[_0x4126('0x26')](_0x5c9bcd);}return _0x8f17bc[_0x4126('0x27')]();};}function saveUpdates(_0x5b2c7c,_0x230e68){return function(_0x328504){if(_0x328504){return _0x328504[_0x4126('0x28')](_0x5b2c7c)['then'](function(_0x559bd2){return _0x559bd2;});}return null;};}function removeEntity(_0x52446e,_0x30193b){return function(_0x2ebe24){if(_0x2ebe24){return _0x2ebe24[_0x4126('0x29')]()[_0x4126('0x2a')](function(){_0x52446e[_0x4126('0x1d')](0xcc)[_0x4126('0x1e')]();});}};}function handleEntityNotFound(_0x1885d2,_0x4d129b){return function(_0x136172){if(!_0x136172){_0x1885d2[_0x4126('0x1c')](0x194);}return _0x136172;};}function handleError(_0x31ec0b,_0x4d289b){_0x4d289b=_0x4d289b||0x1f4;return function(_0x29b07d){logger[_0x4126('0x2b')](_0x29b07d[_0x4126('0x2c')]);if(_0x29b07d[_0x4126('0x2d')]){delete _0x29b07d[_0x4126('0x2d')];}_0x31ec0b[_0x4126('0x1d')](_0x4d289b)[_0x4126('0x2e')](_0x29b07d);};}exports['index']=function(_0x54ec11,_0xff72f4){var _0x4b719f={},_0x1696eb={},_0x28173c={'count':0x0,'rows':[]};var _0x252549=_[_0x4126('0x2f')](db['Integration']['rawAttributes'],function(_0x2b72a6){return{'name':_0x2b72a6[_0x4126('0x30')],'type':_0x2b72a6[_0x4126('0x31')][_0x4126('0x32')]};});_0x1696eb[_0x4126('0x33')]=_[_0x4126('0x2f')](_0x252549,_0x4126('0x2d'));_0x1696eb[_0x4126('0x34')]=_[_0x4126('0x35')](_0x54ec11[_0x4126('0x34')]);_0x1696eb[_0x4126('0x36')]=_['intersection'](_0x1696eb['model'],_0x1696eb['query']);_0x4b719f['attributes']=_[_0x4126('0x37')](_0x1696eb[_0x4126('0x33')],qs[_0x4126('0x38')](_0x54ec11[_0x4126('0x34')][_0x4126('0x38')]));_0x4b719f[_0x4126('0x39')]=_0x4b719f[_0x4126('0x39')][_0x4126('0x3a')]?_0x4b719f[_0x4126('0x39')]:_0x1696eb[_0x4126('0x33')];if(!_0x54ec11[_0x4126('0x34')][_0x4126('0x3b')](_0x4126('0x3c'))){_0x4b719f['limit']=qs['limit'](_0x54ec11[_0x4126('0x34')]['limit']);_0x4b719f['offset']=qs[_0x4126('0x20')](_0x54ec11[_0x4126('0x34')][_0x4126('0x20')]);}_0x4b719f[_0x4126('0x3d')]=qs[_0x4126('0x3e')](_0x54ec11[_0x4126('0x34')][_0x4126('0x3e')]);_0x4b719f[_0x4126('0x3f')]=qs[_0x4126('0x36')](_[_0x4126('0x40')](_0x54ec11[_0x4126('0x34')],_0x1696eb[_0x4126('0x36')]),_0x252549);if(_0x54ec11[_0x4126('0x34')][_0x4126('0x41')]){_0x4b719f[_0x4126('0x3f')]=_[_0x4126('0x42')](_0x4b719f[_0x4126('0x3f')],{'$or':_[_0x4126('0x2f')](_0x252549,function(_0x49e89d){if(_0x49e89d[_0x4126('0x31')]!==_0x4126('0x43')){var _0x4c0131={};_0x4c0131[_0x49e89d['name']]={'$like':'%'+_0x54ec11[_0x4126('0x34')][_0x4126('0x41')]+'%'};return _0x4c0131;}})});}_0x4b719f=_[_0x4126('0x42')]({},_0x4b719f,_0x54ec11[_0x4126('0x44')]);var _0x217427={'where':_0x4b719f[_0x4126('0x3f')]};return db[_0x4126('0x45')][_0x4126('0x1f')](_0x217427)[_0x4126('0x2a')](function(_0x7fe64a){_0x28173c['count']=_0x7fe64a;if(_0x54ec11[_0x4126('0x34')][_0x4126('0x46')]){_0x4b719f[_0x4126('0x47')]=[{'all':!![]}];}return db[_0x4126('0x45')][_0x4126('0x48')](_0x4b719f);})[_0x4126('0x2a')](function(_0x550650){_0x28173c[_0x4126('0x49')]=_0x550650;return _0x28173c;})[_0x4126('0x2a')](respondWithFilteredResult(_0xff72f4,_0x4b719f))[_0x4126('0x4a')](handleError(_0xff72f4,null));};exports[_0x4126('0x4b')]=function(_0x3893a9,_0xbd69ae){var _0x5c570e={'raw':![],'where':{'id':_0x3893a9[_0x4126('0x4c')]['id']}},_0x4679e1={};_0x4679e1[_0x4126('0x33')]=_[_0x4126('0x35')](db[_0x4126('0x45')][_0x4126('0x4d')]);_0x4679e1[_0x4126('0x34')]=_[_0x4126('0x35')](_0x3893a9['query']);_0x4679e1[_0x4126('0x36')]=_[_0x4126('0x37')](_0x4679e1[_0x4126('0x33')],_0x4679e1[_0x4126('0x34')]);_0x5c570e[_0x4126('0x39')]=_[_0x4126('0x37')](_0x4679e1['model'],qs['fields'](_0x3893a9[_0x4126('0x34')]['fields']));_0x5c570e[_0x4126('0x39')]=_0x5c570e[_0x4126('0x39')][_0x4126('0x3a')]?_0x5c570e[_0x4126('0x39')]:_0x4679e1[_0x4126('0x33')];if(_0x3893a9['query']['includeAll']){_0x5c570e[_0x4126('0x47')]=[{'all':!![]}];}_0x5c570e=_[_0x4126('0x42')]({},_0x5c570e,_0x3893a9[_0x4126('0x44')]);return db[_0x4126('0x45')]['find'](_0x5c570e)[_0x4126('0x2a')](handleEntityNotFound(_0xbd69ae,null))['then'](respondWithResult(_0xbd69ae,null))[_0x4126('0x4a')](handleError(_0xbd69ae,null));};exports[_0x4126('0x4e')]=function(_0x5ae6f7,_0x562d4b){return db[_0x4126('0x45')][_0x4126('0x4e')](_0x5ae6f7[_0x4126('0x4f')],{})[_0x4126('0x2a')](respondWithResult(_0x562d4b,0xc9))['catch'](handleError(_0x562d4b,null));};exports[_0x4126('0x28')]=function(_0x81e7d4,_0x23ff3f){if(_0x81e7d4[_0x4126('0x4f')]['id']){delete _0x81e7d4[_0x4126('0x4f')]['id'];}return db[_0x4126('0x45')][_0x4126('0x50')]({'where':{'id':_0x81e7d4[_0x4126('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ff3f,null))[_0x4126('0x2a')](saveUpdates(_0x81e7d4['body'],null))[_0x4126('0x2a')](respondWithResult(_0x23ff3f,null))[_0x4126('0x4a')](handleError(_0x23ff3f,null));};exports[_0x4126('0x29')]=function(_0x15c9fd,_0x5da3cf){return db[_0x4126('0x45')][_0x4126('0x50')]({'where':{'id':_0x15c9fd[_0x4126('0x4c')]['id']}})[_0x4126('0x2a')](handleEntityNotFound(_0x5da3cf,null))[_0x4126('0x2a')](removeEntity(_0x5da3cf,null))[_0x4126('0x4a')](handleError(_0x5da3cf,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 354d095..d273a2d 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 _0xcea6=['util','../../config/logger','api','moment','request-promise','rimraf','./integration.attributes','exports','define','Integration','lodash'];(function(_0x7a8365,_0x563ade){var _0x55359f=function(_0x344dc2){while(--_0x344dc2){_0x7a8365['push'](_0x7a8365['shift']());}};_0x55359f(++_0x563ade);}(_0xcea6,0x1b7));var _0x6cea=function(_0x21a854,_0x24257e){_0x21a854=_0x21a854-0x0;var _0x67b4c0=_0xcea6[_0x21a854];return _0x67b4c0;};'use strict';var _=require(_0x6cea('0x0'));var util=require(_0x6cea('0x1'));var logger=require(_0x6cea('0x2'))(_0x6cea('0x3'));var moment=require(_0x6cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cea('0x6'));var config=require('../../config/environment');var attributes=require(_0x6cea('0x7'));module[_0x6cea('0x8')]=function(_0xc0c2b5,_0x429228){return _0xc0c2b5[_0x6cea('0x9')](_0x6cea('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcda6=['exports','define','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x4bee17,_0x530e95){var _0x2d95b7=function(_0x529254){while(--_0x529254){_0x4bee17['push'](_0x4bee17['shift']());}};_0x2d95b7(++_0x530e95);}(_0xcda6,0x66));var _0x6cda=function(_0x374ad5,_0x2f28a2){_0x374ad5=_0x374ad5-0x0;var _0x55c401=_0xcda6[_0x374ad5];return _0x55c401;};'use strict';var _=require(_0x6cda('0x0'));var util=require('util');var logger=require(_0x6cda('0x1'))(_0x6cda('0x2'));var moment=require('moment');var BPromise=require(_0x6cda('0x3'));var rp=require(_0x6cda('0x4'));var fs=require('fs');var path=require(_0x6cda('0x5'));var rimraf=require('rimraf');var config=require(_0x6cda('0x6'));var attributes=require(_0x6cda('0x7'));module[_0x6cda('0x8')]=function(_0x20e142,_0x25d56f){return _0x20e142[_0x6cda('0x9')]('Integration',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 3c47d9f..e7145cc 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 _0x79c6=['error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x79c6,0x81));var _0x679c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x79c6[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x679c('0x0'));var util=require('util');var moment=require(_0x679c('0x1'));var BPromise=require(_0x679c('0x2'));var rs=require(_0x679c('0x3'));var fs=require('fs');var Redis=require(_0x679c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x679c('0x5'))(_0x679c('0x6'));var config=require(_0x679c('0x7'));var jayson=require(_0x679c('0x8'));var client=jayson[_0x679c('0x9')][_0x679c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43655d,_0x481173,_0x57b604){return new BPromise(function(_0x2898c2,_0x1f2ec3){return client[_0x679c('0xb')](_0x43655d,_0x57b604)[_0x679c('0xc')](function(_0xac3b1a){logger[_0x679c('0xd')](_0x679c('0xe'),_0x481173,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x481173,_0x679c('0xf'),JSON[_0x679c('0x10')](_0xac3b1a));if(_0xac3b1a['error']){if(_0xac3b1a['error'][_0x679c('0x11')]===0x1f4){logger[_0x679c('0x12')](_0x679c('0xe'),_0x481173,_0xac3b1a['error'][_0x679c('0x13')]);return _0x1f2ec3(_0xac3b1a[_0x679c('0x12')]['message']);}logger[_0x679c('0x12')]('Integration,\x20%s,\x20%s',_0x481173,_0xac3b1a['error'][_0x679c('0x13')]);return _0x2898c2(_0xac3b1a[_0x679c('0x12')][_0x679c('0x13')]);}else{logger[_0x679c('0xd')](_0x679c('0xe'),_0x481173,_0x679c('0xf'));_0x2898c2(_0xac3b1a['result'][_0x679c('0x13')]);}})[_0x679c('0x14')](function(_0x18117f){logger[_0x679c('0x12')](_0x679c('0xe'),_0x481173,_0x18117f);_0x1f2ec3(_0x18117f);});});} \ No newline at end of file +var _0x4eea=['jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4deeb3,_0x33fce2){var _0xe851=function(_0x52aed7){while(--_0x52aed7){_0x4deeb3['push'](_0x4deeb3['shift']());}};_0xe851(++_0x33fce2);}(_0x4eea,0x149));var _0xa4ee=function(_0x5447ec,_0x3d44cb){_0x5447ec=_0x5447ec-0x0;var _0x3fab94=_0x4eea[_0x5447ec];return _0x3fab94;};'use strict';var _=require('lodash');var util=require(_0xa4ee('0x0'));var moment=require(_0xa4ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xa4ee('0x2'));var fs=require('fs');var Redis=require(_0xa4ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4ee('0x4'));var logger=require(_0xa4ee('0x5'))('rpc');var config=require(_0xa4ee('0x6'));var jayson=require(_0xa4ee('0x7'));var client=jayson[_0xa4ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57708a,_0x571944,_0x24be23){return new BPromise(function(_0x1fb3c4,_0x5e1f4e){return client[_0xa4ee('0x9')](_0x57708a,_0x24be23)[_0xa4ee('0xa')](function(_0x410f6c){logger[_0xa4ee('0xb')](_0xa4ee('0xc'),_0x571944,_0xa4ee('0xd'));logger[_0xa4ee('0xe')](_0xa4ee('0xf'),_0x571944,'request\x20sent',JSON[_0xa4ee('0x10')](_0x410f6c));if(_0x410f6c[_0xa4ee('0x11')]){if(_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x12')]===0x1f4){logger[_0xa4ee('0x11')]('Integration,\x20%s,\x20%s',_0x571944,_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x13')]);return _0x5e1f4e(_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x13')]);}logger[_0xa4ee('0x11')](_0xa4ee('0xc'),_0x571944,_0x410f6c[_0xa4ee('0x11')]['message']);return _0x1fb3c4(_0x410f6c[_0xa4ee('0x11')][_0xa4ee('0x13')]);}else{logger['info']('Integration,\x20%s,\x20%s',_0x571944,'request\x20sent');_0x1fb3c4(_0x410f6c[_0xa4ee('0x14')][_0xa4ee('0x13')]);}})['catch'](function(_0x5a9d88){logger[_0xa4ee('0x11')](_0xa4ee('0xc'),_0x571944,_0x5a9d88);_0x5e1f4e(_0x5a9d88);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 08189ff..b919cc7 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 _0x0fd7=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x5378bb,_0xdbe6c2){var _0x32dc23=function(_0x4af2ab){while(--_0x4af2ab){_0x5378bb['push'](_0x5378bb['shift']());}};_0x32dc23(++_0xdbe6c2);}(_0x0fd7,0x9f));var _0x70fd=function(_0x5ab47a,_0x185cae){_0x5ab47a=_0x5ab47a-0x0;var _0x5cb084=_0x0fd7[_0x5ab47a];return _0x5cb084;};'use strict';var multer=require(_0x70fd('0x0'));var util=require(_0x70fd('0x1'));var path=require('path');var timeout=require(_0x70fd('0x2'));var express=require(_0x70fd('0x3'));var router=express[_0x70fd('0x4')]();var auth=require(_0x70fd('0x5'));var interaction=require(_0x70fd('0x6'));var config=require('../../config/environment');var controller=require(_0x70fd('0x7'));router[_0x70fd('0x8')]('/',auth[_0x70fd('0x9')](),controller['index']);router[_0x70fd('0x8')]('/describe',auth[_0x70fd('0x9')](),controller[_0x70fd('0xa')]);router[_0x70fd('0x8')](_0x70fd('0xb'),auth[_0x70fd('0x9')](),controller[_0x70fd('0xc')]);router['post']('/',auth[_0x70fd('0x9')](),controller[_0x70fd('0xd')]);router[_0x70fd('0xe')](_0x70fd('0xb'),auth['isAuthenticated'](),controller[_0x70fd('0xf')]);router[_0x70fd('0x10')](_0x70fd('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x70fd('0x11')]=router; \ No newline at end of file +var _0xe5fc=['path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5c1930,_0x1b15e7){var _0x163a34=function(_0x52b4b5){while(--_0x52b4b5){_0x5c1930['push'](_0x5c1930['shift']());}};_0x163a34(++_0x1b15e7);}(_0xe5fc,0x109));var _0xce5f=function(_0x1297b8,_0x4e4608){_0x1297b8=_0x1297b8-0x0;var _0x23e3a8=_0xe5fc[_0x1297b8];return _0x23e3a8;};'use strict';var multer=require(_0xce5f('0x0'));var util=require('util');var path=require(_0xce5f('0x1'));var timeout=require(_0xce5f('0x2'));var express=require(_0xce5f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xce5f('0x4'));var controller=require('./integrationReport.controller');router[_0xce5f('0x5')]('/',auth[_0xce5f('0x6')](),controller[_0xce5f('0x7')]);router[_0xce5f('0x5')](_0xce5f('0x8'),auth[_0xce5f('0x6')](),controller[_0xce5f('0x9')]);router[_0xce5f('0x5')]('/:id',auth[_0xce5f('0x6')](),controller[_0xce5f('0xa')]);router[_0xce5f('0xb')]('/',auth[_0xce5f('0x6')](),controller[_0xce5f('0xc')]);router[_0xce5f('0xd')](_0xce5f('0xe'),auth['isAuthenticated'](),controller[_0xce5f('0xf')]);router[_0xce5f('0x10')](_0xce5f('0xe'),auth[_0xce5f('0x6')](),controller[_0xce5f('0x11')]);module[_0xce5f('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c0546f2..f3a7afb 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 _0x2a7a=['TEXT','ENUM','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3e4ae3,_0x4ef92c){var _0x3f4916=function(_0x16c841){while(--_0x16c841){_0x3e4ae3['push'](_0x3e4ae3['shift']());}};_0x3f4916(++_0x4ef92c);}(_0x2a7a,0x19b));var _0xa2a7=function(_0x33bcd9,_0x9663b6){_0x33bcd9=_0x33bcd9-0x0;var _0x30fa78=_0x2a7a[_0x33bcd9];return _0x30fa78;};'use strict';var Sequelize=require('sequelize');module[_0xa2a7('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xa2a7('0x1')]},'exitStatus':{'type':Sequelize[_0xa2a7('0x1')]},'ticketId':{'type':Sequelize[_0xa2a7('0x1')]},'integrationId':{'type':Sequelize[_0xa2a7('0x2')]},'contacts':{'type':Sequelize[_0xa2a7('0x1')]},'uniqueid':{'type':Sequelize[_0xa2a7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa2a7('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa2a7('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa2a7('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa2a7('0x2')]},'agentcomplete':{'type':Sequelize[_0xa2a7('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa2a7('0x3')]},'talktime':{'type':Sequelize[_0xa2a7('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa2a7('0x2')]},'reason':{'type':Sequelize[_0xa2a7('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xa2a7('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa2a7('0x3')]},'agentdump':{'type':Sequelize[_0xa2a7('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa2a7('0x1')]},'channelstate':{'type':Sequelize[_0xa2a7('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa2a7('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa2a7('0x1')]},'connectedlinename':{'type':Sequelize[_0xa2a7('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa2a7('0x1')]},'context':{'type':Sequelize[_0xa2a7('0x1')]},'exten':{'type':Sequelize[_0xa2a7('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa2a7('0x1')]},'destchannelstate':{'type':Sequelize[_0xa2a7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa2a7('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa2a7('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa2a7('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa2a7('0x1')]},'destlanguage':{'type':Sequelize[_0xa2a7('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa2a7('0x1')]},'destexten':{'type':Sequelize[_0xa2a7('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xa2a7('0x1')]},'messageId':{'type':Sequelize[_0xa2a7('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xa2a7('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa2a7('0x1')]},'cc':{'type':Sequelize[_0xa2a7('0x1')]},'attachment':{'type':Sequelize[_0xa2a7('0x5')]},'html':{'type':Sequelize[_0xa2a7('0x5')]},'text':{'type':Sequelize[_0xa2a7('0x5')]},'status':{'type':Sequelize[_0xa2a7('0x6')]('SENT','SENDING','RECEIVED',_0xa2a7('0x7'))},'url':{'type':Sequelize[_0xa2a7('0x1')]},'app':{'type':Sequelize[_0xa2a7('0x1')]},'appdata':{'type':Sequelize[_0xa2a7('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xde42=['ENUM','SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x3e626f,_0x2a5998){var _0x5351c6=function(_0x14afb4){while(--_0x14afb4){_0x3e626f['push'](_0x3e626f['shift']());}};_0x5351c6(++_0x2a5998);}(_0xde42,0x1d9));var _0x2de4=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xde42[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require(_0x2de4('0x0'));module[_0x2de4('0x1')]={'integration':{'type':Sequelize[_0x2de4('0x2')]},'eventChannel':{'type':Sequelize[_0x2de4('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2de4('0x2')]},'integrationId':{'type':Sequelize[_0x2de4('0x3')]},'contacts':{'type':Sequelize[_0x2de4('0x2')]},'uniqueid':{'type':Sequelize[_0x2de4('0x2')]},'calleridnum':{'type':Sequelize[_0x2de4('0x2')]},'calleridname':{'type':Sequelize[_0x2de4('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2de4('0x2')]},'membername':{'type':Sequelize[_0x2de4('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2de4('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2de4('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x2de4('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2de4('0x4')]},'talktime':{'type':Sequelize[_0x2de4('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2de4('0x3')]},'reason':{'type':Sequelize[_0x2de4('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x2de4('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2de4('0x4')]},'agentdump':{'type':Sequelize[_0x2de4('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x2de4('0x2')]},'channel':{'type':Sequelize[_0x2de4('0x2')]},'channelstate':{'type':Sequelize[_0x2de4('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2de4('0x2')]},'language':{'type':Sequelize[_0x2de4('0x2')]},'accountcode':{'type':Sequelize[_0x2de4('0x2')]},'context':{'type':Sequelize[_0x2de4('0x2')]},'exten':{'type':Sequelize[_0x2de4('0x2')]},'priority':{'type':Sequelize[_0x2de4('0x2')]},'destchannel':{'type':Sequelize[_0x2de4('0x2')]},'destchannelstate':{'type':Sequelize[_0x2de4('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2de4('0x2')]},'destcalleridname':{'type':Sequelize[_0x2de4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2de4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2de4('0x2')]},'destlanguage':{'type':Sequelize[_0x2de4('0x2')]},'destaccountcode':{'type':Sequelize[_0x2de4('0x2')]},'destcontext':{'type':Sequelize[_0x2de4('0x2')]},'destexten':{'type':Sequelize[_0x2de4('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2de4('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2de4('0x2')]},'subject':{'type':Sequelize[_0x2de4('0x2')]},'from':{'type':Sequelize[_0x2de4('0x2')]},'to':{'type':Sequelize[_0x2de4('0x2')]},'cc':{'type':Sequelize[_0x2de4('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x2de4('0x6')]},'text':{'type':Sequelize[_0x2de4('0x6')]},'status':{'type':Sequelize[_0x2de4('0x7')](_0x2de4('0x8'),_0x2de4('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x2de4('0x2')]},'app':{'type':Sequelize[_0x2de4('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e5e39ae..3b28427 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 _0x9e59=['params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','length','find','update','body'];(function(_0x177716,_0x7a2831){var _0x3363e1=function(_0x271e96){while(--_0x271e96){_0x177716['push'](_0x177716['shift']());}};_0x3363e1(++_0x7a2831);}(_0x9e59,0x160));var _0x99e5=function(_0x77df59,_0x37549c){_0x77df59=_0x77df59-0x0;var _0x4f5059=_0x9e59[_0x77df59];return _0x4f5059;};'use strict';var pdf=require(_0x99e5('0x0'));var emlformat=require(_0x99e5('0x1'));var rimraf=require(_0x99e5('0x2'));var zipdir=require(_0x99e5('0x3'));var jsonpatch=require(_0x99e5('0x4'));var rp=require(_0x99e5('0x5'));var moment=require(_0x99e5('0x6'));var BPromise=require(_0x99e5('0x7'));var Mustache=require(_0x99e5('0x8'));var util=require('util');var path=require(_0x99e5('0x9'));var sox=require('sox');var csv=require(_0x99e5('0xa'));var ejs=require(_0x99e5('0xb'));var fs=require('fs');var _=require(_0x99e5('0xc'));var squel=require('squel');var crypto=require(_0x99e5('0xd'));var jsforce=require(_0x99e5('0xe'));var deskjs=require(_0x99e5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x99e5('0x10'));var Redis=require(_0x99e5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x99e5('0x12'));var as=require(_0x99e5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99e5('0x14'));var utils=require(_0x99e5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x99e5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x664948,_0x556b7f){_0x556b7f=_0x556b7f||0xcc;return function(_0x1def62){if(_0x1def62){return _0x664948[_0x99e5('0x17')](_0x556b7f);}return _0x664948['status'](_0x556b7f)[_0x99e5('0x18')]();};}function respondWithResult(_0x52982d,_0x191dc4){_0x191dc4=_0x191dc4||0xc8;return function(_0xfc1789){if(_0xfc1789){return _0x52982d[_0x99e5('0x19')](_0x191dc4)[_0x99e5('0x1a')](_0xfc1789);}};}function respondWithFilteredResult(_0x132e71,_0x5b6f30){return function(_0x4e9da9){if(_0x4e9da9){var _0xa70e16=_0x4e9da9[_0x99e5('0x1b')],_0x2b201d=_0x5b6f30[_0x99e5('0x1c')],_0x2468ec=_0x5b6f30['offset']+_0x5b6f30[_0x99e5('0x1d')],_0x398980;if(_0x2468ec>=_0xa70e16){_0x2468ec=_0xa70e16;_0x398980=0xc8;}else{_0x398980=0xce;}_0x132e71[_0x99e5('0x19')](_0x398980);return _0x132e71[_0x99e5('0x1e')](_0x99e5('0x1f'),_0x2b201d+'-'+_0x2468ec+'/'+_0xa70e16)[_0x99e5('0x1a')](_0x4e9da9);}return null;};}function patchUpdates(_0x329cfe){return function(_0xea4e92){try{jsonpatch['apply'](_0xea4e92,_0x329cfe,!![]);}catch(_0xd2e26d){return BPromise[_0x99e5('0x20')](_0xd2e26d);}return _0xea4e92[_0x99e5('0x21')]();};}function saveUpdates(_0x350217,_0x34aebf){return function(_0x4d79bd){if(_0x4d79bd){return _0x4d79bd['update'](_0x350217)[_0x99e5('0x22')](function(_0x9584a3){return _0x9584a3;});}return null;};}function removeEntity(_0x37a67a,_0x3f79fb){return function(_0x1de112){if(_0x1de112){return _0x1de112['destroy']()[_0x99e5('0x22')](function(){_0x37a67a['status'](0xcc)[_0x99e5('0x18')]();});}};}function handleEntityNotFound(_0x4ef078,_0x48dda7){return function(_0x22f40b){if(!_0x22f40b){_0x4ef078[_0x99e5('0x17')](0x194);}return _0x22f40b;};}function handleError(_0x814f24,_0x58a76e){_0x58a76e=_0x58a76e||0x1f4;return function(_0x514d74){logger['error'](_0x514d74[_0x99e5('0x23')]);if(_0x514d74[_0x99e5('0x24')]){delete _0x514d74['name'];}_0x814f24[_0x99e5('0x19')](_0x58a76e)['send'](_0x514d74);};}exports['index']=function(_0x35f529,_0x56af44){var _0x4a3a08={},_0x219e0d={},_0x4bed45={'count':0x0,'rows':[]};var _0x102b5b=_[_0x99e5('0x25')](db['IntegrationReport'][_0x99e5('0x26')],function(_0x1101d5){return{'name':_0x1101d5[_0x99e5('0x27')],'type':_0x1101d5['type'][_0x99e5('0x28')]};});_0x219e0d[_0x99e5('0x29')]=_[_0x99e5('0x25')](_0x102b5b,_0x99e5('0x24'));_0x219e0d[_0x99e5('0x2a')]=_[_0x99e5('0x2b')](_0x35f529[_0x99e5('0x2a')]);_0x219e0d[_0x99e5('0x2c')]=_[_0x99e5('0x2d')](_0x219e0d[_0x99e5('0x29')],_0x219e0d['query']);_0x4a3a08[_0x99e5('0x2e')]=_['intersection'](_0x219e0d[_0x99e5('0x29')],qs[_0x99e5('0x2f')](_0x35f529[_0x99e5('0x2a')]['fields']));_0x4a3a08[_0x99e5('0x2e')]=_0x4a3a08[_0x99e5('0x2e')]['length']?_0x4a3a08[_0x99e5('0x2e')]:_0x219e0d[_0x99e5('0x29')];if(!_0x35f529['query']['hasOwnProperty'](_0x99e5('0x30'))){_0x4a3a08['limit']=qs['limit'](_0x35f529['query']['limit']);_0x4a3a08['offset']=qs[_0x99e5('0x1c')](_0x35f529[_0x99e5('0x2a')]['offset']);}_0x4a3a08[_0x99e5('0x31')]=qs[_0x99e5('0x32')](_0x35f529['query'][_0x99e5('0x32')]);_0x4a3a08['where']=qs[_0x99e5('0x2c')](_['pick'](_0x35f529['query'],_0x219e0d[_0x99e5('0x2c')]),_0x102b5b);if(_0x35f529['query']['filter']){_0x4a3a08[_0x99e5('0x33')]=_['merge'](_0x4a3a08[_0x99e5('0x33')],{'$or':_[_0x99e5('0x25')](_0x102b5b,function(_0x1c7b19){if(_0x1c7b19[_0x99e5('0x34')]!==_0x99e5('0x35')){var _0x50f9b2={};_0x50f9b2[_0x1c7b19[_0x99e5('0x24')]]={'$like':'%'+_0x35f529[_0x99e5('0x2a')][_0x99e5('0x36')]+'%'};return _0x50f9b2;}})});}_0x4a3a08=_[_0x99e5('0x37')]({},_0x4a3a08,_0x35f529[_0x99e5('0x38')]);var _0x169197={'where':_0x4a3a08['where']};return db[_0x99e5('0x39')][_0x99e5('0x1b')](_0x169197)[_0x99e5('0x22')](function(_0x4ce657){_0x4bed45[_0x99e5('0x1b')]=_0x4ce657;if(_0x35f529[_0x99e5('0x2a')][_0x99e5('0x3a')]){_0x4a3a08[_0x99e5('0x3b')]=[{'all':!![]}];}return db[_0x99e5('0x39')][_0x99e5('0x3c')](_0x4a3a08);})['then'](function(_0x50cb3d){_0x4bed45[_0x99e5('0x3d')]=_0x50cb3d;return _0x4bed45;})[_0x99e5('0x22')](respondWithFilteredResult(_0x56af44,_0x4a3a08))[_0x99e5('0x3e')](handleError(_0x56af44,null));};exports[_0x99e5('0x3f')]=function(_0x3c43f5,_0x29098c){var _0x347584={'raw':![],'where':{'id':_0x3c43f5['params']['id']}},_0x3653af={};_0x3653af[_0x99e5('0x29')]=_[_0x99e5('0x2b')](db['IntegrationReport'][_0x99e5('0x26')]);_0x3653af[_0x99e5('0x2a')]=_[_0x99e5('0x2b')](_0x3c43f5['query']);_0x3653af[_0x99e5('0x2c')]=_[_0x99e5('0x2d')](_0x3653af['model'],_0x3653af[_0x99e5('0x2a')]);_0x347584[_0x99e5('0x2e')]=_[_0x99e5('0x2d')](_0x3653af[_0x99e5('0x29')],qs[_0x99e5('0x2f')](_0x3c43f5['query']['fields']));_0x347584[_0x99e5('0x2e')]=_0x347584['attributes'][_0x99e5('0x40')]?_0x347584['attributes']:_0x3653af[_0x99e5('0x29')];if(_0x3c43f5[_0x99e5('0x2a')][_0x99e5('0x3a')]){_0x347584[_0x99e5('0x3b')]=[{'all':!![]}];}_0x347584=_[_0x99e5('0x37')]({},_0x347584,_0x3c43f5[_0x99e5('0x38')]);return db['IntegrationReport'][_0x99e5('0x41')](_0x347584)[_0x99e5('0x22')](handleEntityNotFound(_0x29098c,null))[_0x99e5('0x22')](respondWithResult(_0x29098c,null))[_0x99e5('0x3e')](handleError(_0x29098c,null));};exports['create']=function(_0x54ed7c,_0x2e1be1){return db[_0x99e5('0x39')]['create'](_0x54ed7c['body'],{})[_0x99e5('0x22')](respondWithResult(_0x2e1be1,0xc9))[_0x99e5('0x3e')](handleError(_0x2e1be1,null));};exports[_0x99e5('0x42')]=function(_0x424566,_0x2ebf76){if(_0x424566[_0x99e5('0x43')]['id']){delete _0x424566[_0x99e5('0x43')]['id'];}return db['IntegrationReport'][_0x99e5('0x41')]({'where':{'id':_0x424566[_0x99e5('0x44')]['id']}})[_0x99e5('0x22')](handleEntityNotFound(_0x2ebf76,null))[_0x99e5('0x22')](saveUpdates(_0x424566[_0x99e5('0x43')],null))[_0x99e5('0x22')](respondWithResult(_0x2ebf76,null))[_0x99e5('0x3e')](handleError(_0x2ebf76,null));};exports['destroy']=function(_0x32defa,_0x5ad679){return db[_0x99e5('0x39')][_0x99e5('0x41')]({'where':{'id':_0x32defa[_0x99e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ad679,null))[_0x99e5('0x22')](removeEntity(_0x5ad679,null))[_0x99e5('0x3e')](handleError(_0x5ad679,null));};exports[_0x99e5('0x45')]=function(_0x1a4ca3,_0x48b0c7){return db[_0x99e5('0x39')][_0x99e5('0x45')]()[_0x99e5('0x22')](respondWithResult(_0x48b0c7,null))[_0x99e5('0x3e')](handleError(_0x48b0c7,null));}; \ No newline at end of file +var _0x0fab=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','keys','includeAll','find','catch','create','params','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x4dbb63,_0x2b5569){var _0x344d75=function(_0xd5fb97){while(--_0xd5fb97){_0x4dbb63['push'](_0x4dbb63['shift']());}};_0x344d75(++_0x2b5569);}(_0x0fab,0x1ce));var _0xb0fa=function(_0x1b91b1,_0x200f8f){_0x1b91b1=_0x1b91b1-0x0;var _0x553aac=_0x0fab[_0x1b91b1];return _0x553aac;};'use strict';var pdf=require(_0xb0fa('0x0'));var emlformat=require(_0xb0fa('0x1'));var rimraf=require(_0xb0fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0fa('0x3'));var rp=require(_0xb0fa('0x4'));var moment=require('moment');var BPromise=require(_0xb0fa('0x5'));var Mustache=require(_0xb0fa('0x6'));var util=require(_0xb0fa('0x7'));var path=require(_0xb0fa('0x8'));var sox=require(_0xb0fa('0x9'));var csv=require(_0xb0fa('0xa'));var ejs=require(_0xb0fa('0xb'));var fs=require('fs');var _=require(_0xb0fa('0xc'));var squel=require(_0xb0fa('0xd'));var crypto=require(_0xb0fa('0xe'));var jsforce=require(_0xb0fa('0xf'));var deskjs=require(_0xb0fa('0x10'));var toCsv=require(_0xb0fa('0xa'));var querystring=require('querystring');var Papa=require(_0xb0fa('0x11'));var Redis=require(_0xb0fa('0x12'));var authService=require(_0xb0fa('0x13'));var qs=require(_0xb0fa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0fa('0x15'));var logger=require(_0xb0fa('0x16'))(_0xb0fa('0x17'));var utils=require('../../config/utils');var config=require(_0xb0fa('0x18'));var licenseUtil=require(_0xb0fa('0x19'));var db=require(_0xb0fa('0x1a'))['db'];function respondWithStatusCode(_0x1fb5f0,_0x4dd2a0){_0x4dd2a0=_0x4dd2a0||0xcc;return function(_0x1f331e){if(_0x1f331e){return _0x1fb5f0[_0xb0fa('0x1b')](_0x4dd2a0);}return _0x1fb5f0[_0xb0fa('0x1c')](_0x4dd2a0)[_0xb0fa('0x1d')]();};}function respondWithResult(_0x2d8db6,_0x28c690){_0x28c690=_0x28c690||0xc8;return function(_0xc80615){if(_0xc80615){return _0x2d8db6[_0xb0fa('0x1c')](_0x28c690)[_0xb0fa('0x1e')](_0xc80615);}};}function respondWithFilteredResult(_0x18964a,_0x44de55){return function(_0x54f071){if(_0x54f071){var _0x1228ca=_0x54f071['count'],_0x33a99e=_0x44de55[_0xb0fa('0x1f')],_0x53cb71=_0x44de55[_0xb0fa('0x1f')]+_0x44de55['limit'],_0x461308;if(_0x53cb71>=_0x1228ca){_0x53cb71=_0x1228ca;_0x461308=0xc8;}else{_0x461308=0xce;}_0x18964a[_0xb0fa('0x1c')](_0x461308);return _0x18964a[_0xb0fa('0x20')]('Content-Range',_0x33a99e+'-'+_0x53cb71+'/'+_0x1228ca)['json'](_0x54f071);}return null;};}function patchUpdates(_0x32d539){return function(_0x44b6d5){try{jsonpatch[_0xb0fa('0x21')](_0x44b6d5,_0x32d539,!![]);}catch(_0x28cf9f){return BPromise[_0xb0fa('0x22')](_0x28cf9f);}return _0x44b6d5[_0xb0fa('0x23')]();};}function saveUpdates(_0x5bc4f6,_0x5e42db){return function(_0x3dfd4f){if(_0x3dfd4f){return _0x3dfd4f['update'](_0x5bc4f6)[_0xb0fa('0x24')](function(_0xb666f3){return _0xb666f3;});}return null;};}function removeEntity(_0x29986a,_0x4f4eb1){return function(_0x2c47ad){if(_0x2c47ad){return _0x2c47ad[_0xb0fa('0x25')]()['then'](function(){_0x29986a[_0xb0fa('0x1c')](0xcc)[_0xb0fa('0x1d')]();});}};}function handleEntityNotFound(_0x3c76ff,_0x23265a){return function(_0x553177){if(!_0x553177){_0x3c76ff[_0xb0fa('0x1b')](0x194);}return _0x553177;};}function handleError(_0x4fb054,_0x3fbd64){_0x3fbd64=_0x3fbd64||0x1f4;return function(_0x2f0a33){logger[_0xb0fa('0x26')](_0x2f0a33[_0xb0fa('0x27')]);if(_0x2f0a33[_0xb0fa('0x28')]){delete _0x2f0a33['name'];}_0x4fb054[_0xb0fa('0x1c')](_0x3fbd64)[_0xb0fa('0x29')](_0x2f0a33);};}exports[_0xb0fa('0x2a')]=function(_0x40348d,_0x40ef2f){var _0x3d7b88={},_0x47b705={},_0x5b9010={'count':0x0,'rows':[]};var _0x9fc412=_[_0xb0fa('0x2b')](db[_0xb0fa('0x2c')][_0xb0fa('0x2d')],function(_0x1fb2ec){return{'name':_0x1fb2ec[_0xb0fa('0x2e')],'type':_0x1fb2ec[_0xb0fa('0x2f')][_0xb0fa('0x30')]};});_0x47b705[_0xb0fa('0x31')]=_['map'](_0x9fc412,'name');_0x47b705['query']=_['keys'](_0x40348d[_0xb0fa('0x32')]);_0x47b705[_0xb0fa('0x33')]=_[_0xb0fa('0x34')](_0x47b705[_0xb0fa('0x31')],_0x47b705[_0xb0fa('0x32')]);_0x3d7b88[_0xb0fa('0x35')]=_['intersection'](_0x47b705[_0xb0fa('0x31')],qs[_0xb0fa('0x36')](_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x36')]));_0x3d7b88[_0xb0fa('0x35')]=_0x3d7b88[_0xb0fa('0x35')][_0xb0fa('0x37')]?_0x3d7b88[_0xb0fa('0x35')]:_0x47b705['model'];if(!_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x38')](_0xb0fa('0x39'))){_0x3d7b88['limit']=qs[_0xb0fa('0x3a')](_0x40348d[_0xb0fa('0x32')]['limit']);_0x3d7b88['offset']=qs['offset'](_0x40348d[_0xb0fa('0x32')]['offset']);}_0x3d7b88[_0xb0fa('0x3b')]=qs[_0xb0fa('0x3c')](_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x3c')]);_0x3d7b88[_0xb0fa('0x3d')]=qs['filters'](_[_0xb0fa('0x3e')](_0x40348d[_0xb0fa('0x32')],_0x47b705[_0xb0fa('0x33')]),_0x9fc412);if(_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x3f')]){_0x3d7b88[_0xb0fa('0x3d')]=_[_0xb0fa('0x40')](_0x3d7b88[_0xb0fa('0x3d')],{'$or':_[_0xb0fa('0x2b')](_0x9fc412,function(_0x2ca434){if(_0x2ca434[_0xb0fa('0x2f')]!==_0xb0fa('0x41')){var _0x53dde1={};_0x53dde1[_0x2ca434['name']]={'$like':'%'+_0x40348d[_0xb0fa('0x32')][_0xb0fa('0x3f')]+'%'};return _0x53dde1;}})});}_0x3d7b88=_[_0xb0fa('0x40')]({},_0x3d7b88,_0x40348d[_0xb0fa('0x42')]);var _0x40faa7={'where':_0x3d7b88[_0xb0fa('0x3d')]};return db[_0xb0fa('0x2c')][_0xb0fa('0x43')](_0x40faa7)[_0xb0fa('0x24')](function(_0x5f0da8){_0x5b9010['count']=_0x5f0da8;if(_0x40348d[_0xb0fa('0x32')]['includeAll']){_0x3d7b88[_0xb0fa('0x44')]=[{'all':!![]}];}return db[_0xb0fa('0x2c')][_0xb0fa('0x45')](_0x3d7b88);})[_0xb0fa('0x24')](function(_0x57f446){_0x5b9010[_0xb0fa('0x46')]=_0x57f446;return _0x5b9010;})[_0xb0fa('0x24')](respondWithFilteredResult(_0x40ef2f,_0x3d7b88))['catch'](handleError(_0x40ef2f,null));};exports[_0xb0fa('0x47')]=function(_0x1f7d54,_0x1b9ff9){var _0x19e72d={'raw':![],'where':{'id':_0x1f7d54['params']['id']}},_0x283494={};_0x283494['model']=_['keys'](db['IntegrationReport'][_0xb0fa('0x2d')]);_0x283494[_0xb0fa('0x32')]=_[_0xb0fa('0x48')](_0x1f7d54[_0xb0fa('0x32')]);_0x283494[_0xb0fa('0x33')]=_[_0xb0fa('0x34')](_0x283494[_0xb0fa('0x31')],_0x283494['query']);_0x19e72d['attributes']=_[_0xb0fa('0x34')](_0x283494['model'],qs['fields'](_0x1f7d54[_0xb0fa('0x32')][_0xb0fa('0x36')]));_0x19e72d[_0xb0fa('0x35')]=_0x19e72d[_0xb0fa('0x35')][_0xb0fa('0x37')]?_0x19e72d[_0xb0fa('0x35')]:_0x283494[_0xb0fa('0x31')];if(_0x1f7d54[_0xb0fa('0x32')][_0xb0fa('0x49')]){_0x19e72d['include']=[{'all':!![]}];}_0x19e72d=_[_0xb0fa('0x40')]({},_0x19e72d,_0x1f7d54[_0xb0fa('0x42')]);return db['IntegrationReport'][_0xb0fa('0x4a')](_0x19e72d)[_0xb0fa('0x24')](handleEntityNotFound(_0x1b9ff9,null))[_0xb0fa('0x24')](respondWithResult(_0x1b9ff9,null))[_0xb0fa('0x4b')](handleError(_0x1b9ff9,null));};exports[_0xb0fa('0x4c')]=function(_0x5f4de2,_0x3ef8fe){return db[_0xb0fa('0x2c')][_0xb0fa('0x4c')](_0x5f4de2['body'],{})[_0xb0fa('0x24')](respondWithResult(_0x3ef8fe,0xc9))['catch'](handleError(_0x3ef8fe,null));};exports['update']=function(_0x5ddb74,_0x435ad0){if(_0x5ddb74['body']['id']){delete _0x5ddb74['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x5ddb74[_0xb0fa('0x4d')]['id']}})[_0xb0fa('0x24')](handleEntityNotFound(_0x435ad0,null))[_0xb0fa('0x24')](saveUpdates(_0x5ddb74[_0xb0fa('0x4e')],null))[_0xb0fa('0x24')](respondWithResult(_0x435ad0,null))[_0xb0fa('0x4b')](handleError(_0x435ad0,null));};exports[_0xb0fa('0x25')]=function(_0x4fa364,_0x2457de){return db['IntegrationReport'][_0xb0fa('0x4a')]({'where':{'id':_0x4fa364[_0xb0fa('0x4d')]['id']}})[_0xb0fa('0x24')](handleEntityNotFound(_0x2457de,null))[_0xb0fa('0x24')](removeEntity(_0x2457de,null))[_0xb0fa('0x4b')](handleError(_0x2457de,null));};exports[_0xb0fa('0x4f')]=function(_0x3c2f2d,_0x52d436){return db[_0xb0fa('0x2c')]['describe']()[_0xb0fa('0x24')](respondWithResult(_0x52d436,null))[_0xb0fa('0x4b')](handleError(_0x52d436,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3a74423..e86739a 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 _0x85ce=['IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x85ce,0x120));var _0xe85c=function(_0x403593,_0x4eb3b1){_0x403593=_0x403593-0x0;var _0x4e9657=_0x85ce[_0x403593];return _0x4e9657;};'use strict';var _=require('lodash');var util=require(_0xe85c('0x0'));var logger=require(_0xe85c('0x1'))(_0xe85c('0x2'));var moment=require(_0xe85c('0x3'));var BPromise=require(_0xe85c('0x4'));var rp=require(_0xe85c('0x5'));var fs=require('fs');var path=require(_0xe85c('0x6'));var rimraf=require(_0xe85c('0x7'));var config=require(_0xe85c('0x8'));var attributes=require(_0xe85c('0x9'));module[_0xe85c('0xa')]=function(_0x1c476e,_0x4a8526){return _0x1c476e['define'](_0xe85c('0xb'),attributes,{'tableName':_0xe85c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e03=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash'];(function(_0x129ddf,_0x573f73){var _0x518dc3=function(_0x58cbbf){while(--_0x58cbbf){_0x129ddf['push'](_0x129ddf['shift']());}};_0x518dc3(++_0x573f73);}(_0x3e03,0x6b));var _0x33e0=function(_0x35e06d,_0xad434c){_0x35e06d=_0x35e06d-0x0;var _0x1b7a39=_0x3e03[_0x35e06d];return _0x1b7a39;};'use strict';var _=require(_0x33e0('0x0'));var util=require(_0x33e0('0x1'));var logger=require(_0x33e0('0x2'))(_0x33e0('0x3'));var moment=require(_0x33e0('0x4'));var BPromise=require('bluebird');var rp=require(_0x33e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33e0('0x6'));var config=require(_0x33e0('0x7'));var attributes=require(_0x33e0('0x8'));module[_0x33e0('0x9')]=function(_0x164d16,_0x12ca60){return _0x164d16['define'](_0x33e0('0xa'),attributes,{'tableName':_0x33e0('0xb'),'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 9ba56ce..343a4fa 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 _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x40a344,_0x2c4a47){var _0x47c2f1=function(_0x9fa169){while(--_0x9fa169){_0x40a344['push'](_0x40a344['shift']());}};_0x47c2f1(++_0x2c4a47);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xb7e7[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac4a,0x13f));var _0xaac4=function(_0x4fb7e6,_0xe6d30c){_0x4fb7e6=_0x4fb7e6-0x0;var _0x19baae=_0xac4a[_0x4fb7e6];return _0x19baae;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2d13a6e..85e3943 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x533d5d,_0x400122){var _0x5518a1=function(_0x3d1117){while(--_0x3d1117){_0x533d5d['push'](_0x533d5d['shift']());}};_0x5518a1(++_0x400122);}(_0x3e74,0x175));var _0x43e7=function(_0x548c68,_0xff94a){_0x548c68=_0x548c68-0x0;var _0x249c4f=_0x3e74[_0x548c68];return _0x249c4f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x1fa4ca,_0xf56e82){var _0x4eca14=function(_0x3408d8){while(--_0x3408d8){_0x1fa4ca['push'](_0x1fa4ca['shift']());}};_0x4eca14(++_0xf56e82);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b6fa6,_0x39c76f){_0x2b6fa6=_0x2b6fa6-0x0;var _0x4e9ab8=_0xedd9[_0x2b6fa6];return _0x4e9ab8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 51254ea..cc99e23 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 _0x5346=['sequelize','STRING'];(function(_0x5ae761,_0x9afc7c){var _0x42add3=function(_0x5e0fa8){while(--_0x5e0fa8){_0x5ae761['push'](_0x5ae761['shift']());}};_0x42add3(++_0x9afc7c);}(_0x5346,0x1ce));var _0x6534=function(_0x29e899,_0x466a4c){_0x29e899=_0x29e899-0x0;var _0x40b248=_0x5346[_0x29e899];return _0x40b248;};'use strict';var Sequelize=require(_0x6534('0x0'));module['exports']={'name':{'type':Sequelize[_0x6534('0x1')]},'description':{'type':Sequelize[_0x6534('0x1')]},'interval':{'type':Sequelize[_0x6534('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x167e=['sequelize','STRING'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x167e,0x1ae));var _0xe167=function(_0x353acf,_0x5a0fa6){_0x353acf=_0x353acf-0x0;var _0x2dee9c=_0x167e[_0x353acf];return _0x2dee9c;};'use strict';var Sequelize=require(_0xe167('0x0'));module['exports']={'name':{'type':Sequelize[_0xe167('0x1')]},'description':{'type':Sequelize[_0xe167('0x1')]},'interval':{'type':Sequelize[_0xe167('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 ac74eab..c69a5cc 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 _0xab4c=['count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','Interval','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','sort','hasOwnProperty','addIntervals','sequelize','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab4c,0x1dc));var _0xcab4=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xab4c[_0x34c063];return _0x2c63a3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcab4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcab4('0x1'));var jsonpatch=require(_0xcab4('0x2'));var rp=require(_0xcab4('0x3'));var moment=require(_0xcab4('0x4'));var BPromise=require(_0xcab4('0x5'));var Mustache=require(_0xcab4('0x6'));var util=require(_0xcab4('0x7'));var path=require(_0xcab4('0x8'));var sox=require('sox');var csv=require(_0xcab4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcab4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcab4('0xb'));var deskjs=require(_0xcab4('0xc'));var toCsv=require(_0xcab4('0x9'));var querystring=require(_0xcab4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcab4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcab4('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xcab4('0x10'));var config=require(_0xcab4('0x11'));var licenseUtil=require(_0xcab4('0x12'));var db=require('../../mysqldb')['db'];var extensions=require(_0xcab4('0x13'));function respondWithStatusCode(_0x205f6d,_0x4368f2){_0x4368f2=_0x4368f2||0xcc;return function(_0x2f71d7){if(_0x2f71d7){return _0x205f6d[_0xcab4('0x14')](_0x4368f2);}return _0x205f6d[_0xcab4('0x15')](_0x4368f2)['end']();};}function respondWithResult(_0x2c1f69,_0x1db04d){_0x1db04d=_0x1db04d||0xc8;return function(_0x11774d){if(_0x11774d){return _0x2c1f69['status'](_0x1db04d)['json'](_0x11774d);}};}function respondWithFilteredResult(_0x30f9d6,_0x5248ea){return function(_0x57c59d){if(_0x57c59d){var _0x2afe95=_0x57c59d[_0xcab4('0x16')],_0x1ad1e1=_0x5248ea[_0xcab4('0x17')],_0x521a41=_0x5248ea['offset']+_0x5248ea[_0xcab4('0x18')],_0x6ff023;if(_0x521a41>=_0x2afe95){_0x521a41=_0x2afe95;_0x6ff023=0xc8;}else{_0x6ff023=0xce;}_0x30f9d6[_0xcab4('0x15')](_0x6ff023);return _0x30f9d6[_0xcab4('0x19')](_0xcab4('0x1a'),_0x1ad1e1+'-'+_0x521a41+'/'+_0x2afe95)[_0xcab4('0x1b')](_0x57c59d);}return null;};}function patchUpdates(_0x1726e1){return function(_0x3c483e){try{jsonpatch['apply'](_0x3c483e,_0x1726e1,!![]);}catch(_0x2c478e){return BPromise[_0xcab4('0x1c')](_0x2c478e);}return _0x3c483e[_0xcab4('0x1d')]();};}function saveUpdates(_0x159d48,_0x10d08f){return function(_0x54f8a6){if(_0x54f8a6){return _0x54f8a6[_0xcab4('0x1e')](_0x159d48)[_0xcab4('0x1f')](function(_0x84a8c3){return _0x84a8c3;});}return null;};}function removeEntity(_0x381557,_0xaa9c6f){return function(_0x1b9c15){if(_0x1b9c15){return _0x1b9c15[_0xcab4('0x20')]()[_0xcab4('0x1f')](function(){var _0x2070df=_0x1b9c15[_0xcab4('0x21')]({'plain':!![]});var _0x2a358a=_0xcab4('0x22');return db[_0xcab4('0x23')][_0xcab4('0x20')]({'where':{'type':_0x2a358a,'resourceId':_0x2070df['id']}})['then'](function(){return _0x1b9c15;});})[_0xcab4('0x1f')](function(){_0x381557[_0xcab4('0x15')](0xcc)[_0xcab4('0x24')]();});}};}function handleEntityNotFound(_0x53945a,_0x2fc924){return function(_0x349a17){if(!_0x349a17){_0x53945a[_0xcab4('0x14')](0x194);}return _0x349a17;};}function handleError(_0x1394c1,_0xb8ce72){_0xb8ce72=_0xb8ce72||0x1f4;return function(_0x4bb3ce){logger[_0xcab4('0x25')](_0x4bb3ce[_0xcab4('0x26')]);if(_0x4bb3ce[_0xcab4('0x27')]){delete _0x4bb3ce[_0xcab4('0x27')];}_0x1394c1[_0xcab4('0x15')](_0xb8ce72)[_0xcab4('0x28')](_0x4bb3ce);};}exports['index']=function(_0x5a6187,_0x4bb051){var _0x43f8b3={},_0xcc80d5={},_0x148564={'count':0x0,'rows':[]};var _0x1b5a2e=_['map'](db[_0xcab4('0x29')][_0xcab4('0x2a')],function(_0xe7f6ab){return{'name':_0xe7f6ab[_0xcab4('0x2b')],'type':_0xe7f6ab[_0xcab4('0x2c')][_0xcab4('0x2d')]};});_0xcc80d5[_0xcab4('0x2e')]=_[_0xcab4('0x2f')](_0x1b5a2e,'name');_0xcc80d5['query']=_[_0xcab4('0x30')](_0x5a6187['query']);_0xcc80d5[_0xcab4('0x31')]=_[_0xcab4('0x32')](_0xcc80d5[_0xcab4('0x2e')],_0xcc80d5[_0xcab4('0x33')]);_0x43f8b3[_0xcab4('0x34')]=_[_0xcab4('0x32')](_0xcc80d5['model'],qs[_0xcab4('0x35')](_0x5a6187[_0xcab4('0x33')][_0xcab4('0x35')]));_0x43f8b3[_0xcab4('0x34')]=_0x43f8b3[_0xcab4('0x34')][_0xcab4('0x36')]?_0x43f8b3[_0xcab4('0x34')]:_0xcc80d5[_0xcab4('0x2e')];if(!_0x5a6187[_0xcab4('0x33')]['hasOwnProperty'](_0xcab4('0x37'))){_0x43f8b3[_0xcab4('0x18')]=qs[_0xcab4('0x18')](_0x5a6187[_0xcab4('0x33')][_0xcab4('0x18')]);_0x43f8b3['offset']=qs[_0xcab4('0x17')](_0x5a6187['query'][_0xcab4('0x17')]);}_0x43f8b3['order']=qs['sort'](_0x5a6187[_0xcab4('0x33')]['sort']);_0x43f8b3[_0xcab4('0x38')]=qs[_0xcab4('0x31')](_[_0xcab4('0x39')](_0x5a6187[_0xcab4('0x33')],_0xcc80d5[_0xcab4('0x31')]),_0x1b5a2e);if(_0x5a6187[_0xcab4('0x33')]['filter']){_0x43f8b3[_0xcab4('0x38')]=_[_0xcab4('0x3a')](_0x43f8b3[_0xcab4('0x38')],{'$or':_[_0xcab4('0x2f')](_0x1b5a2e,function(_0x252c15){if(_0x252c15[_0xcab4('0x2c')]!==_0xcab4('0x3b')){var _0x5b30f7={};_0x5b30f7[_0x252c15['name']]={'$like':'%'+_0x5a6187[_0xcab4('0x33')][_0xcab4('0x3c')]+'%'};return _0x5b30f7;}})});}_0x43f8b3=_[_0xcab4('0x3a')]({},_0x43f8b3,_0x5a6187['options']);var _0x45379a={'where':_0x43f8b3[_0xcab4('0x38')]};return db[_0xcab4('0x29')]['count'](_0x45379a)['then'](function(_0xfa63b7){_0x148564['count']=_0xfa63b7;if(_0x5a6187[_0xcab4('0x33')][_0xcab4('0x3d')]){_0x43f8b3[_0xcab4('0x3e')]=[{'all':!![]}];}return db[_0xcab4('0x29')][_0xcab4('0x3f')](_0x43f8b3);})[_0xcab4('0x1f')](function(_0x58eb5a){_0x148564['rows']=_0x58eb5a;return _0x148564;})[_0xcab4('0x1f')](respondWithFilteredResult(_0x4bb051,_0x43f8b3))[_0xcab4('0x40')](handleError(_0x4bb051,null));};exports['show']=function(_0x426234,_0x2bb43d){var _0x2c56cc={'raw':!![],'where':{'id':_0x426234[_0xcab4('0x41')]['id']}},_0x3890b9={};_0x3890b9['model']=_[_0xcab4('0x30')](db[_0xcab4('0x29')]['rawAttributes']);_0x3890b9['query']=_[_0xcab4('0x30')](_0x426234[_0xcab4('0x33')]);_0x3890b9[_0xcab4('0x31')]=_['intersection'](_0x3890b9['model'],_0x3890b9[_0xcab4('0x33')]);_0x2c56cc[_0xcab4('0x34')]=_[_0xcab4('0x32')](_0x3890b9[_0xcab4('0x2e')],qs[_0xcab4('0x35')](_0x426234[_0xcab4('0x33')][_0xcab4('0x35')]));_0x2c56cc['attributes']=_0x2c56cc[_0xcab4('0x34')][_0xcab4('0x36')]?_0x2c56cc['attributes']:_0x3890b9[_0xcab4('0x2e')];if(_0x426234['query'][_0xcab4('0x3d')]){_0x2c56cc[_0xcab4('0x3e')]=[{'all':!![]}];}_0x2c56cc=_[_0xcab4('0x3a')]({},_0x2c56cc,_0x426234[_0xcab4('0x42')]);return db[_0xcab4('0x29')][_0xcab4('0x43')](_0x2c56cc)[_0xcab4('0x1f')](handleEntityNotFound(_0x2bb43d,null))[_0xcab4('0x1f')](respondWithResult(_0x2bb43d,null))[_0xcab4('0x40')](handleError(_0x2bb43d,null));};exports[_0xcab4('0x44')]=function(_0x4b4bb2,_0x346ba4){return db[_0xcab4('0x29')]['create'](_0x4b4bb2[_0xcab4('0x45')],{})[_0xcab4('0x1f')](function(_0x392252){var _0x5b0767=_0x4b4bb2[_0xcab4('0x46')][_0xcab4('0x21')]({'plain':!![]});if(!_0x5b0767)throw new Error(_0xcab4('0x47'));if(_0x5b0767[_0xcab4('0x48')]===_0xcab4('0x46')){var _0xeace8a=_0x392252[_0xcab4('0x21')]({'plain':!![]});var _0x13fea0=_0xcab4('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x13fea0,'userProfileId':_0x5b0767['userProfileId']},'raw':!![]})['then'](function(_0x552410){if(_0x552410&&_0x552410[_0xcab4('0x49')]===0x0){return db[_0xcab4('0x23')][_0xcab4('0x44')]({'name':_0xeace8a[_0xcab4('0x27')],'resourceId':_0xeace8a['id'],'type':_0x552410[_0xcab4('0x27')],'sectionId':_0x552410['id']},{})['then'](function(){return _0x392252;});}else{return _0x392252;}})[_0xcab4('0x40')](function(_0x286a5b){logger[_0xcab4('0x25')](_0xcab4('0x4a'),_0x286a5b);throw _0x286a5b;});}return _0x392252;})[_0xcab4('0x1f')](respondWithResult(_0x346ba4,0xc9))[_0xcab4('0x40')](handleError(_0x346ba4,null));};exports[_0xcab4('0x1e')]=function(_0x4a33f0,_0xb360){if(_0x4a33f0['body']['id']){delete _0x4a33f0[_0xcab4('0x45')]['id'];}return db['Interval']['find']({'where':{'id':_0x4a33f0[_0xcab4('0x41')]['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0xb360,null))[_0xcab4('0x1f')](saveUpdates(_0x4a33f0[_0xcab4('0x45')],null))[_0xcab4('0x1f')](respondWithResult(_0xb360,null))[_0xcab4('0x40')](handleError(_0xb360,null));};exports[_0xcab4('0x20')]=function(_0x44428a,_0x2390b4){return db[_0xcab4('0x29')][_0xcab4('0x43')]({'where':{'id':_0x44428a[_0xcab4('0x41')]['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0x2390b4,null))[_0xcab4('0x1f')](removeEntity(_0x2390b4,null))[_0xcab4('0x40')](handleError(_0x2390b4,null));};exports['addInterval']=function(_0x27cc9a,_0x1a679f,_0x5c0222){if(_0x27cc9a[_0xcab4('0x45')]['id']){delete _0x27cc9a[_0xcab4('0x45')]['id'];}return db['Interval']['find']({'where':{'id':_0x27cc9a[_0xcab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a679f,null))[_0xcab4('0x1f')](function(_0x5136dc){if(_0x5136dc){_0x27cc9a[_0xcab4('0x45')][_0xcab4('0x4b')]=_0x5136dc['id'];return db[_0xcab4('0x29')][_0xcab4('0x44')](_0x27cc9a['body']);}})[_0xcab4('0x1f')](respondWithResult(_0x1a679f,null))[_0xcab4('0x40')](handleError(_0x1a679f,null));};exports[_0xcab4('0x4c')]=function(_0x30112e,_0x238a8a,_0x3f2362){var _0x490161={};var _0x3fca2a={};var _0x6ef9a1;var _0x29becf;return db[_0xcab4('0x29')][_0xcab4('0x4d')]({'where':{'id':_0x30112e['params']['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0x238a8a,null))['then'](function(_0x147168){if(_0x147168){_0x6ef9a1=_0x147168;_0x3fca2a['model']=_[_0xcab4('0x30')](db[_0xcab4('0x29')][_0xcab4('0x2a')]);_0x3fca2a['query']=_[_0xcab4('0x30')](_0x30112e['query']);_0x3fca2a[_0xcab4('0x31')]=_['intersection'](_0x3fca2a[_0xcab4('0x2e')],_0x3fca2a[_0xcab4('0x33')]);_0x490161[_0xcab4('0x34')]=_[_0xcab4('0x32')](_0x3fca2a[_0xcab4('0x2e')],qs[_0xcab4('0x35')](_0x30112e[_0xcab4('0x33')]['fields']));_0x490161['attributes']=_0x490161[_0xcab4('0x34')][_0xcab4('0x36')]?_0x490161[_0xcab4('0x34')]:_0x3fca2a[_0xcab4('0x2e')];_0x490161['order']=qs['sort'](_0x30112e[_0xcab4('0x33')][_0xcab4('0x4e')]);_0x490161[_0xcab4('0x38')]=qs['filters'](_[_0xcab4('0x39')](_0x30112e['query'],_0x3fca2a[_0xcab4('0x31')]));if(_0x30112e[_0xcab4('0x33')]['filter']){_0x490161[_0xcab4('0x38')]=_[_0xcab4('0x3a')](_0x490161[_0xcab4('0x38')],{'$or':_['map'](_0x490161[_0xcab4('0x34')],function(_0x32fd4e){var _0x59ee64={};_0x59ee64[_0x32fd4e]={'$like':'%'+_0x30112e[_0xcab4('0x33')][_0xcab4('0x3c')]+'%'};return _0x59ee64;})});}_0x490161=_[_0xcab4('0x3a')]({},_0x490161,_0x30112e['options']);return _0x6ef9a1[_0xcab4('0x4c')](_0x490161);}})[_0xcab4('0x1f')](function(_0x26f13d){if(_0x26f13d){_0x29becf=_0x26f13d[_0xcab4('0x36')];if(!_0x30112e[_0xcab4('0x33')][_0xcab4('0x4f')](_0xcab4('0x37'))){_0x490161[_0xcab4('0x18')]=qs['limit'](_0x30112e[_0xcab4('0x33')]['limit']);_0x490161['offset']=qs[_0xcab4('0x17')](_0x30112e[_0xcab4('0x33')][_0xcab4('0x17')]);}return _0x6ef9a1[_0xcab4('0x4c')](_0x490161);}})[_0xcab4('0x1f')](function(_0x44a4f6){if(_0x44a4f6){return _0x44a4f6?{'count':_0x29becf,'rows':_0x44a4f6}:null;}})[_0xcab4('0x1f')](respondWithResult(_0x238a8a,null))['catch'](handleError(_0x238a8a,null));};exports[_0xcab4('0x50')]=function(_0x2d5106,_0x203eec,_0x4e7553){return db[_0xcab4('0x29')][_0xcab4('0x4d')]({'where':{'id':_0x2d5106[_0xcab4('0x41')]['id']}})[_0xcab4('0x1f')](handleEntityNotFound(_0x203eec,null))[_0xcab4('0x1f')](function(_0x4f3eab){if(_0x4f3eab){return db[_0xcab4('0x51')][_0xcab4('0x52')](function(_0x5b0900){return db[_0xcab4('0x29')][_0xcab4('0x20')]({'where':{'IntervalId':_0x2d5106[_0xcab4('0x41')]['id']},'transaction':_0x5b0900})[_0xcab4('0x1f')](function(_0x2199e9){var _0x42d0f0=_[_0xcab4('0x2f')](_0x2d5106['body'],function(_0x5c5b71){delete _0x5c5b71['id'];_0x5c5b71[_0xcab4('0x4b')]=_0x2d5106[_0xcab4('0x41')]['id'];return _0x5c5b71;});return db[_0xcab4('0x29')]['bulkCreate'](_0x42d0f0,{'transaction':_0x5b0900});});})['then'](function(){return db[_0xcab4('0x29')][_0xcab4('0x3f')]({'where':{'IntervalId':_0x2d5106[_0xcab4('0x41')]['id']}});});}})['then'](respondWithResult(_0x203eec,null))['catch'](handleError(_0x203eec,null));}; \ No newline at end of file +var _0x2014=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','catch','update','destroy','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x2014,0xa9));var _0x4201=function(_0x27a257,_0x58cadf){_0x27a257=_0x27a257-0x0;var _0x506050=_0x2014[_0x27a257];return _0x506050;};'use strict';var pdf=require(_0x4201('0x0'));var emlformat=require(_0x4201('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4201('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4201('0x3'));var moment=require(_0x4201('0x4'));var BPromise=require(_0x4201('0x5'));var Mustache=require(_0x4201('0x6'));var util=require(_0x4201('0x7'));var path=require('path');var sox=require(_0x4201('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4201('0x9'));var squel=require('squel');var crypto=require(_0x4201('0xa'));var jsforce=require(_0x4201('0xb'));var deskjs=require(_0x4201('0xc'));var toCsv=require(_0x4201('0xd'));var querystring=require(_0x4201('0xe'));var Papa=require(_0x4201('0xf'));var Redis=require(_0x4201('0x10'));var authService=require(_0x4201('0x11'));var qs=require(_0x4201('0x12'));var as=require(_0x4201('0x13'));var hardwareService=require(_0x4201('0x14'));var logger=require(_0x4201('0x15'))(_0x4201('0x16'));var utils=require(_0x4201('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4201('0x18'))['db'];var extensions=require(_0x4201('0x19'));function respondWithStatusCode(_0x324d76,_0x1082d8){_0x1082d8=_0x1082d8||0xcc;return function(_0x223221){if(_0x223221){return _0x324d76['sendStatus'](_0x1082d8);}return _0x324d76[_0x4201('0x1a')](_0x1082d8)[_0x4201('0x1b')]();};}function respondWithResult(_0x496a74,_0x38b25e){_0x38b25e=_0x38b25e||0xc8;return function(_0x4a797e){if(_0x4a797e){return _0x496a74[_0x4201('0x1a')](_0x38b25e)[_0x4201('0x1c')](_0x4a797e);}};}function respondWithFilteredResult(_0x59386e,_0x1b61e3){return function(_0x1fe9a2){if(_0x1fe9a2){var _0x61bc08=_0x1fe9a2[_0x4201('0x1d')],_0x38aac1=_0x1b61e3['offset'],_0x4a705f=_0x1b61e3[_0x4201('0x1e')]+_0x1b61e3[_0x4201('0x1f')],_0x32253f;if(_0x4a705f>=_0x61bc08){_0x4a705f=_0x61bc08;_0x32253f=0xc8;}else{_0x32253f=0xce;}_0x59386e['status'](_0x32253f);return _0x59386e[_0x4201('0x20')](_0x4201('0x21'),_0x38aac1+'-'+_0x4a705f+'/'+_0x61bc08)[_0x4201('0x1c')](_0x1fe9a2);}return null;};}function patchUpdates(_0x52d65a){return function(_0x102298){try{jsonpatch[_0x4201('0x22')](_0x102298,_0x52d65a,!![]);}catch(_0x3ef6f0){return BPromise[_0x4201('0x23')](_0x3ef6f0);}return _0x102298[_0x4201('0x24')]();};}function saveUpdates(_0x2ec575,_0x692674){return function(_0x35d2b7){if(_0x35d2b7){return _0x35d2b7['update'](_0x2ec575)[_0x4201('0x25')](function(_0x579454){return _0x579454;});}return null;};}function removeEntity(_0x27c744,_0x1c4ce1){return function(_0x28e49d){if(_0x28e49d){return _0x28e49d['destroy']()[_0x4201('0x25')](function(){var _0x3e48de=_0x28e49d[_0x4201('0x26')]({'plain':!![]});var _0x55173d=_0x4201('0x27');return db[_0x4201('0x28')]['destroy']({'where':{'type':_0x55173d,'resourceId':_0x3e48de['id']}})[_0x4201('0x25')](function(){return _0x28e49d;});})[_0x4201('0x25')](function(){_0x27c744['status'](0xcc)[_0x4201('0x1b')]();});}};}function handleEntityNotFound(_0xcaf66d,_0x50e1c3){return function(_0x48fa61){if(!_0x48fa61){_0xcaf66d[_0x4201('0x29')](0x194);}return _0x48fa61;};}function handleError(_0x33fe00,_0x570bb0){_0x570bb0=_0x570bb0||0x1f4;return function(_0x3a3a27){logger[_0x4201('0x2a')](_0x3a3a27[_0x4201('0x2b')]);if(_0x3a3a27[_0x4201('0x2c')]){delete _0x3a3a27[_0x4201('0x2c')];}_0x33fe00['status'](_0x570bb0)[_0x4201('0x2d')](_0x3a3a27);};}exports['index']=function(_0x398cd1,_0x8061d5){var _0x5eb623={},_0x281221={},_0xace779={'count':0x0,'rows':[]};var _0x18ec27=_[_0x4201('0x2e')](db['Interval'][_0x4201('0x2f')],function(_0x43c456){return{'name':_0x43c456[_0x4201('0x30')],'type':_0x43c456[_0x4201('0x31')][_0x4201('0x32')]};});_0x281221['model']=_[_0x4201('0x2e')](_0x18ec27,_0x4201('0x2c'));_0x281221[_0x4201('0x33')]=_[_0x4201('0x34')](_0x398cd1[_0x4201('0x33')]);_0x281221[_0x4201('0x35')]=_[_0x4201('0x36')](_0x281221[_0x4201('0x37')],_0x281221[_0x4201('0x33')]);_0x5eb623['attributes']=_[_0x4201('0x36')](_0x281221['model'],qs[_0x4201('0x38')](_0x398cd1[_0x4201('0x33')][_0x4201('0x38')]));_0x5eb623[_0x4201('0x39')]=_0x5eb623[_0x4201('0x39')][_0x4201('0x3a')]?_0x5eb623[_0x4201('0x39')]:_0x281221[_0x4201('0x37')];if(!_0x398cd1[_0x4201('0x33')][_0x4201('0x3b')](_0x4201('0x3c'))){_0x5eb623['limit']=qs[_0x4201('0x1f')](_0x398cd1['query'][_0x4201('0x1f')]);_0x5eb623['offset']=qs['offset'](_0x398cd1[_0x4201('0x33')][_0x4201('0x1e')]);}_0x5eb623[_0x4201('0x3d')]=qs[_0x4201('0x3e')](_0x398cd1[_0x4201('0x33')][_0x4201('0x3e')]);_0x5eb623[_0x4201('0x3f')]=qs[_0x4201('0x35')](_[_0x4201('0x40')](_0x398cd1['query'],_0x281221[_0x4201('0x35')]),_0x18ec27);if(_0x398cd1[_0x4201('0x33')][_0x4201('0x41')]){_0x5eb623['where']=_[_0x4201('0x42')](_0x5eb623[_0x4201('0x3f')],{'$or':_[_0x4201('0x2e')](_0x18ec27,function(_0x1b6478){if(_0x1b6478[_0x4201('0x31')]!=='VIRTUAL'){var _0x43066b={};_0x43066b[_0x1b6478[_0x4201('0x2c')]]={'$like':'%'+_0x398cd1[_0x4201('0x33')][_0x4201('0x41')]+'%'};return _0x43066b;}})});}_0x5eb623=_[_0x4201('0x42')]({},_0x5eb623,_0x398cd1[_0x4201('0x43')]);var _0x2ef9bc={'where':_0x5eb623[_0x4201('0x3f')]};return db[_0x4201('0x44')][_0x4201('0x1d')](_0x2ef9bc)[_0x4201('0x25')](function(_0x455224){_0xace779['count']=_0x455224;if(_0x398cd1[_0x4201('0x33')][_0x4201('0x45')]){_0x5eb623[_0x4201('0x46')]=[{'all':!![]}];}return db['Interval'][_0x4201('0x47')](_0x5eb623);})[_0x4201('0x25')](function(_0xfa3a98){_0xace779[_0x4201('0x48')]=_0xfa3a98;return _0xace779;})['then'](respondWithFilteredResult(_0x8061d5,_0x5eb623))['catch'](handleError(_0x8061d5,null));};exports[_0x4201('0x49')]=function(_0x17a299,_0x54f5a5){var _0xa60ff4={'raw':!![],'where':{'id':_0x17a299[_0x4201('0x4a')]['id']}},_0x513368={};_0x513368[_0x4201('0x37')]=_[_0x4201('0x34')](db[_0x4201('0x44')][_0x4201('0x2f')]);_0x513368[_0x4201('0x33')]=_[_0x4201('0x34')](_0x17a299[_0x4201('0x33')]);_0x513368[_0x4201('0x35')]=_[_0x4201('0x36')](_0x513368[_0x4201('0x37')],_0x513368['query']);_0xa60ff4[_0x4201('0x39')]=_[_0x4201('0x36')](_0x513368['model'],qs[_0x4201('0x38')](_0x17a299['query']['fields']));_0xa60ff4[_0x4201('0x39')]=_0xa60ff4[_0x4201('0x39')][_0x4201('0x3a')]?_0xa60ff4[_0x4201('0x39')]:_0x513368[_0x4201('0x37')];if(_0x17a299[_0x4201('0x33')]['includeAll']){_0xa60ff4['include']=[{'all':!![]}];}_0xa60ff4=_[_0x4201('0x42')]({},_0xa60ff4,_0x17a299[_0x4201('0x43')]);return db[_0x4201('0x44')]['find'](_0xa60ff4)[_0x4201('0x25')](handleEntityNotFound(_0x54f5a5,null))[_0x4201('0x25')](respondWithResult(_0x54f5a5,null))['catch'](handleError(_0x54f5a5,null));};exports['create']=function(_0x1cd29e,_0x1d1dce){return db[_0x4201('0x44')][_0x4201('0x4b')](_0x1cd29e[_0x4201('0x4c')],{})[_0x4201('0x25')](function(_0x93a46f){var _0x19bb85=_0x1cd29e[_0x4201('0x4d')][_0x4201('0x26')]({'plain':!![]});if(!_0x19bb85)throw new Error(_0x4201('0x4e'));if(_0x19bb85[_0x4201('0x4f')]===_0x4201('0x4d')){var _0x2e7cd4=_0x93a46f[_0x4201('0x26')]({'plain':!![]});var _0x4d6c83=_0x4201('0x27');return db[_0x4201('0x50')][_0x4201('0x51')]({'where':{'name':_0x4d6c83,'userProfileId':_0x19bb85[_0x4201('0x52')]},'raw':!![]})['then'](function(_0x3b928a){if(_0x3b928a&&_0x3b928a['autoAssociation']===0x0){return db[_0x4201('0x28')][_0x4201('0x4b')]({'name':_0x2e7cd4[_0x4201('0x2c')],'resourceId':_0x2e7cd4['id'],'type':_0x3b928a[_0x4201('0x2c')],'sectionId':_0x3b928a['id']},{})['then'](function(){return _0x93a46f;});}else{return _0x93a46f;}})['catch'](function(_0x4b60c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b60c0);throw _0x4b60c0;});}return _0x93a46f;})[_0x4201('0x25')](respondWithResult(_0x1d1dce,0xc9))[_0x4201('0x53')](handleError(_0x1d1dce,null));};exports[_0x4201('0x54')]=function(_0x76e6cf,_0x4bf244){if(_0x76e6cf[_0x4201('0x4c')]['id']){delete _0x76e6cf[_0x4201('0x4c')]['id'];}return db[_0x4201('0x44')][_0x4201('0x51')]({'where':{'id':_0x76e6cf['params']['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x4bf244,null))[_0x4201('0x25')](saveUpdates(_0x76e6cf[_0x4201('0x4c')],null))['then'](respondWithResult(_0x4bf244,null))[_0x4201('0x53')](handleError(_0x4bf244,null));};exports[_0x4201('0x55')]=function(_0x43a8a7,_0x2461c9){return db[_0x4201('0x44')]['find']({'where':{'id':_0x43a8a7['params']['id']}})['then'](handleEntityNotFound(_0x2461c9,null))[_0x4201('0x25')](removeEntity(_0x2461c9,null))[_0x4201('0x53')](handleError(_0x2461c9,null));};exports[_0x4201('0x56')]=function(_0x3d12de,_0x5b3da5,_0x439172){if(_0x3d12de[_0x4201('0x4c')]['id']){delete _0x3d12de[_0x4201('0x4c')]['id'];}return db[_0x4201('0x44')][_0x4201('0x51')]({'where':{'id':_0x3d12de[_0x4201('0x4a')]['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x5b3da5,null))['then'](function(_0x4e957c){if(_0x4e957c){_0x3d12de[_0x4201('0x4c')][_0x4201('0x57')]=_0x4e957c['id'];return db[_0x4201('0x44')][_0x4201('0x4b')](_0x3d12de['body']);}})[_0x4201('0x25')](respondWithResult(_0x5b3da5,null))[_0x4201('0x53')](handleError(_0x5b3da5,null));};exports[_0x4201('0x58')]=function(_0x42cb4f,_0x1e6bfe,_0x273486){var _0x1294a2={};var _0x27747f={};var _0x3f4e5b;var _0x14e68a;return db['Interval']['findOne']({'where':{'id':_0x42cb4f['params']['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x1e6bfe,null))['then'](function(_0xda4694){if(_0xda4694){_0x3f4e5b=_0xda4694;_0x27747f[_0x4201('0x37')]=_[_0x4201('0x34')](db[_0x4201('0x44')][_0x4201('0x2f')]);_0x27747f[_0x4201('0x33')]=_[_0x4201('0x34')](_0x42cb4f[_0x4201('0x33')]);_0x27747f['filters']=_['intersection'](_0x27747f[_0x4201('0x37')],_0x27747f[_0x4201('0x33')]);_0x1294a2['attributes']=_['intersection'](_0x27747f[_0x4201('0x37')],qs[_0x4201('0x38')](_0x42cb4f[_0x4201('0x33')][_0x4201('0x38')]));_0x1294a2['attributes']=_0x1294a2['attributes'][_0x4201('0x3a')]?_0x1294a2['attributes']:_0x27747f[_0x4201('0x37')];_0x1294a2[_0x4201('0x3d')]=qs[_0x4201('0x3e')](_0x42cb4f[_0x4201('0x33')]['sort']);_0x1294a2['where']=qs[_0x4201('0x35')](_[_0x4201('0x40')](_0x42cb4f[_0x4201('0x33')],_0x27747f[_0x4201('0x35')]));if(_0x42cb4f[_0x4201('0x33')]['filter']){_0x1294a2[_0x4201('0x3f')]=_['merge'](_0x1294a2['where'],{'$or':_[_0x4201('0x2e')](_0x1294a2['attributes'],function(_0x598868){var _0x84e941={};_0x84e941[_0x598868]={'$like':'%'+_0x42cb4f['query'][_0x4201('0x41')]+'%'};return _0x84e941;})});}_0x1294a2=_[_0x4201('0x42')]({},_0x1294a2,_0x42cb4f[_0x4201('0x43')]);return _0x3f4e5b[_0x4201('0x58')](_0x1294a2);}})['then'](function(_0x36f5e6){if(_0x36f5e6){_0x14e68a=_0x36f5e6[_0x4201('0x3a')];if(!_0x42cb4f[_0x4201('0x33')]['hasOwnProperty'](_0x4201('0x3c'))){_0x1294a2[_0x4201('0x1f')]=qs['limit'](_0x42cb4f[_0x4201('0x33')][_0x4201('0x1f')]);_0x1294a2[_0x4201('0x1e')]=qs['offset'](_0x42cb4f[_0x4201('0x33')]['offset']);}return _0x3f4e5b['getIntervals'](_0x1294a2);}})[_0x4201('0x25')](function(_0xcb9fcd){if(_0xcb9fcd){return _0xcb9fcd?{'count':_0x14e68a,'rows':_0xcb9fcd}:null;}})[_0x4201('0x25')](respondWithResult(_0x1e6bfe,null))[_0x4201('0x53')](handleError(_0x1e6bfe,null));};exports[_0x4201('0x59')]=function(_0x2a08d8,_0x416a39,_0xbbac56){return db[_0x4201('0x44')][_0x4201('0x5a')]({'where':{'id':_0x2a08d8[_0x4201('0x4a')]['id']}})[_0x4201('0x25')](handleEntityNotFound(_0x416a39,null))[_0x4201('0x25')](function(_0x5c7f7a){if(_0x5c7f7a){return db[_0x4201('0x5b')][_0x4201('0x5c')](function(_0x4a96a5){return db[_0x4201('0x44')][_0x4201('0x55')]({'where':{'IntervalId':_0x2a08d8[_0x4201('0x4a')]['id']},'transaction':_0x4a96a5})[_0x4201('0x25')](function(_0x377cbd){var _0x5f4f71=_[_0x4201('0x2e')](_0x2a08d8[_0x4201('0x4c')],function(_0x4a9afd){delete _0x4a9afd['id'];_0x4a9afd[_0x4201('0x57')]=_0x2a08d8[_0x4201('0x4a')]['id'];return _0x4a9afd;});return db[_0x4201('0x44')][_0x4201('0x5d')](_0x5f4f71,{'transaction':_0x4a96a5});});})[_0x4201('0x25')](function(){return db[_0x4201('0x44')]['findAll']({'where':{'IntervalId':_0x2a08d8[_0x4201('0x4a')]['id']}});});}})[_0x4201('0x25')](respondWithResult(_0x416a39,null))[_0x4201('0x53')](handleError(_0x416a39,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 32c9685..130c2f8 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 _0x57f8=['define','Interval','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x2166a3,_0x237c50){var _0x260035=function(_0x2dbfa2){while(--_0x2dbfa2){_0x2166a3['push'](_0x2166a3['shift']());}};_0x260035(++_0x237c50);}(_0x57f8,0x198));var _0x857f=function(_0x2ff38f,_0xefceba){_0x2ff38f=_0x2ff38f-0x0;var _0x19a75f=_0x57f8[_0x2ff38f];return _0x19a75f;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var moment=require(_0x857f('0x3'));var BPromise=require(_0x857f('0x4'));var rp=require(_0x857f('0x5'));var fs=require('fs');var path=require(_0x857f('0x6'));var rimraf=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var attributes=require(_0x857f('0x9'));var extensions=require(_0x857f('0xa'));module[_0x857f('0xb')]=function(_0x5d22e4,_0x8380e8){return _0x5d22e4[_0x857f('0xc')](_0x857f('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f6a66,_0x135855){extensions[_0x857f('0xe')](_0x5d22e4,_0x5f6a66);},'afterBulkCreate':function(_0x4f2b09,_0x1e306e,_0x2ef315){_0x2ef315();extensions[_0x857f('0xe')](_0x5d22e4,_0x4f2b09[0x0]);},'afterUpdate':function(_0x5cc993,_0xefee53){extensions[_0x857f('0xe')](_0x5d22e4,_0x5cc993);},'afterDestroy':function(_0x2cba0d,_0x11adfd){extensions[_0x857f('0xe')](_0x5d22e4,_0x2cba0d);}}});}; \ No newline at end of file +var _0x6484=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x6484,0x64));var _0x4648=function(_0xbbcdf6,_0x4ee2d8){_0xbbcdf6=_0xbbcdf6-0x0;var _0x1abc46=_0x6484[_0xbbcdf6];return _0x1abc46;};'use strict';var _=require(_0x4648('0x0'));var util=require(_0x4648('0x1'));var logger=require(_0x4648('0x2'))(_0x4648('0x3'));var moment=require(_0x4648('0x4'));var BPromise=require(_0x4648('0x5'));var rp=require(_0x4648('0x6'));var fs=require('fs');var path=require(_0x4648('0x7'));var rimraf=require(_0x4648('0x8'));var config=require(_0x4648('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0x4648('0xa'));module[_0x4648('0xb')]=function(_0x5f385a,_0x37efab){return _0x5f385a[_0x4648('0xc')](_0x4648('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdd8612,_0x1d110e){extensions[_0x4648('0xe')](_0x5f385a,_0xdd8612);},'afterBulkCreate':function(_0x5ea0e2,_0x3e2d17,_0x551778){_0x551778();extensions[_0x4648('0xe')](_0x5f385a,_0x5ea0e2[0x0]);},'afterUpdate':function(_0x1442ef,_0x1ce292){extensions[_0x4648('0xe')](_0x5f385a,_0x1442ef);},'afterDestroy':function(_0x44c800,_0x139a17){extensions[_0x4648('0xe')](_0x5f385a,_0x44c800);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5cbe29a..a0f730f 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 _0x8f77=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Interval','findAll','options','raw','limit','include','model','attributes','GetInterval','ShowInterval','where','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x12724a,_0x53a8c2){var _0x4f6d98=function(_0x3e3959){while(--_0x3e3959){_0x12724a['push'](_0x12724a['shift']());}};_0x4f6d98(++_0x53a8c2);}(_0x8f77,0x1d9));var _0x78f7=function(_0x3677ff,_0x31537d){_0x3677ff=_0x3677ff-0x0;var _0xdc338b=_0x8f77[_0x3677ff];return _0xdc338b;};'use strict';var _=require(_0x78f7('0x0'));var util=require(_0x78f7('0x1'));var moment=require(_0x78f7('0x2'));var BPromise=require(_0x78f7('0x3'));var rs=require(_0x78f7('0x4'));var fs=require('fs');var Redis=require(_0x78f7('0x5'));var db=require(_0x78f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78f7('0x7'))(_0x78f7('0x8'));var config=require(_0x78f7('0x9'));var jayson=require(_0x78f7('0xa'));var client=jayson[_0x78f7('0xb')][_0x78f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3daa3b,_0x2a4350,_0x486dc2){return new BPromise(function(_0x3d16db,_0x42cdff){return client[_0x78f7('0xd')](_0x3daa3b,_0x486dc2)[_0x78f7('0xe')](function(_0x1cddbf){logger[_0x78f7('0xf')](_0x78f7('0x10'),_0x2a4350,'request\x20sent');logger[_0x78f7('0x11')](_0x78f7('0x12'),_0x2a4350,'request\x20sent',JSON[_0x78f7('0x13')](_0x1cddbf));if(_0x1cddbf[_0x78f7('0x14')]){if(_0x1cddbf['error'][_0x78f7('0x15')]===0x1f4){logger[_0x78f7('0x14')](_0x78f7('0x10'),_0x2a4350,_0x1cddbf['error'][_0x78f7('0x16')]);return _0x42cdff(_0x1cddbf[_0x78f7('0x14')][_0x78f7('0x16')]);}logger[_0x78f7('0x14')]('Interval,\x20%s,\x20%s',_0x2a4350,_0x1cddbf[_0x78f7('0x14')][_0x78f7('0x16')]);return _0x3d16db(_0x1cddbf['error']['message']);}else{logger[_0x78f7('0xf')](_0x78f7('0x10'),_0x2a4350,'request\x20sent');_0x3d16db(_0x1cddbf[_0x78f7('0x17')][_0x78f7('0x16')]);}})[_0x78f7('0x18')](function(_0x2393d4){logger[_0x78f7('0x14')](_0x78f7('0x10'),_0x2a4350,_0x2393d4);_0x42cdff(_0x2393d4);});});}exports['GetInterval']=function(_0x234088){var _0x5a8a8d=this;return new Promise(function(_0x1c7190,_0x5fb40a){return db[_0x78f7('0x19')][_0x78f7('0x1a')]({'raw':_0x234088['options']?_0x234088[_0x78f7('0x1b')][_0x78f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x234088[_0x78f7('0x1b')]?_0x234088['options']['where']||null:null,'attributes':_0x234088[_0x78f7('0x1b')]?_0x234088[_0x78f7('0x1b')]['attributes']||null:null,'limit':_0x234088[_0x78f7('0x1b')]?_0x234088[_0x78f7('0x1b')][_0x78f7('0x1d')]||null:null,'include':_0x234088[_0x78f7('0x1b')]?_0x234088[_0x78f7('0x1b')][_0x78f7('0x1e')]?_['map'](_0x234088[_0x78f7('0x1b')][_0x78f7('0x1e')],function(_0x3816ed){return{'model':db[_0x3816ed[_0x78f7('0x1f')]],'as':_0x3816ed['as'],'attributes':_0x3816ed[_0x78f7('0x20')],'include':_0x3816ed[_0x78f7('0x1e')]?_['map'](_0x3816ed['include'],function(_0x411855){return{'model':db[_0x411855[_0x78f7('0x1f')]],'as':_0x411855['as'],'attributes':_0x411855[_0x78f7('0x20')],'include':_0x411855[_0x78f7('0x1e')]?_['map'](_0x411855[_0x78f7('0x1e')],function(_0x492b3d){return{'model':db[_0x492b3d[_0x78f7('0x1f')]],'as':_0x492b3d['as'],'attributes':_0x492b3d[_0x78f7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf241d0){logger['info'](_0x78f7('0x21'),_0x234088);logger['debug'](_0x78f7('0x21'),_0x234088,JSON[_0x78f7('0x13')](_0xf241d0));_0x1c7190(_0xf241d0);})[_0x78f7('0x18')](function(_0x1f649e){logger[_0x78f7('0x14')]('GetInterval',_0x1f649e[_0x78f7('0x16')],_0x234088);_0x5fb40a(_0x5a8a8d[_0x78f7('0x14')](0x1f4,_0x1f649e['message']));});});};exports[_0x78f7('0x22')]=function(_0x139c64){var _0x47f44e=this;return new Promise(function(_0xd54115,_0x16e1f6){return db[_0x78f7('0x19')]['find']({'raw':_0x139c64[_0x78f7('0x1b')]?_0x139c64['options']['raw']===undefined?!![]:![]:!![],'where':_0x139c64[_0x78f7('0x1b')]?_0x139c64[_0x78f7('0x1b')][_0x78f7('0x23')]||null:null,'attributes':_0x139c64[_0x78f7('0x1b')]?_0x139c64[_0x78f7('0x1b')]['attributes']||null:null,'include':_0x139c64[_0x78f7('0x1b')]?_0x139c64[_0x78f7('0x1b')]['include']?_[_0x78f7('0x24')](_0x139c64[_0x78f7('0x1b')][_0x78f7('0x1e')],function(_0x3e83ca){return{'model':db[_0x3e83ca['model']],'as':_0x3e83ca['as'],'attributes':_0x3e83ca[_0x78f7('0x20')],'include':_0x3e83ca[_0x78f7('0x1e')]?_[_0x78f7('0x24')](_0x3e83ca[_0x78f7('0x1e')],function(_0x2ba254){return{'model':db[_0x2ba254[_0x78f7('0x1f')]],'as':_0x2ba254['as'],'attributes':_0x2ba254[_0x78f7('0x20')],'include':_0x2ba254['include']?_['map'](_0x2ba254['include'],function(_0x3d1362){return{'model':db[_0x3d1362[_0x78f7('0x1f')]],'as':_0x3d1362['as'],'attributes':_0x3d1362[_0x78f7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x78f7('0xe')](function(_0x4472cd){logger[_0x78f7('0xf')](_0x78f7('0x22'),_0x139c64);logger[_0x78f7('0x11')](_0x78f7('0x22'),_0x139c64,JSON[_0x78f7('0x13')](_0x4472cd));_0xd54115(_0x4472cd);})[_0x78f7('0x18')](function(_0x2b3e9c){logger[_0x78f7('0x14')]('ShowInterval',_0x2b3e9c[_0x78f7('0x16')],_0x139c64);_0x16e1f6(_0x47f44e[_0x78f7('0x14')](0x1f4,_0x2b3e9c[_0x78f7('0x16')]));});});}; \ No newline at end of file +var _0x405d=['message','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetInterval','debug','stringify','ShowInterval','Interval','find','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error'];(function(_0x298819,_0x4ba67d){var _0x526ef7=function(_0x4a15f1){while(--_0x4a15f1){_0x298819['push'](_0x298819['shift']());}};_0x526ef7(++_0x4ba67d);}(_0x405d,0xdd));var _0xd405=function(_0x1d044d,_0x1037e8){_0x1d044d=_0x1d044d-0x0;var _0x197e02=_0x405d[_0x1d044d];return _0x197e02;};'use strict';var _=require(_0xd405('0x0'));var util=require('util');var moment=require(_0xd405('0x1'));var BPromise=require(_0xd405('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd405('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd405('0x4'));var logger=require(_0xd405('0x5'))(_0xd405('0x6'));var config=require(_0xd405('0x7'));var jayson=require(_0xd405('0x8'));var client=jayson['client'][_0xd405('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x579380,_0x2375ff,_0x29601c){return new BPromise(function(_0x360314,_0x50b0dc){return client[_0xd405('0xa')](_0x579380,_0x29601c)[_0xd405('0xb')](function(_0x502707){logger[_0xd405('0xc')](_0xd405('0xd'),_0x2375ff,_0xd405('0xe'));logger['debug'](_0xd405('0xf'),_0x2375ff,_0xd405('0xe'),JSON['stringify'](_0x502707));if(_0x502707[_0xd405('0x10')]){if(_0x502707[_0xd405('0x10')]['code']===0x1f4){logger[_0xd405('0x10')]('Interval,\x20%s,\x20%s',_0x2375ff,_0x502707[_0xd405('0x10')][_0xd405('0x11')]);return _0x50b0dc(_0x502707[_0xd405('0x10')][_0xd405('0x11')]);}logger[_0xd405('0x10')](_0xd405('0xd'),_0x2375ff,_0x502707[_0xd405('0x10')][_0xd405('0x11')]);return _0x360314(_0x502707[_0xd405('0x10')][_0xd405('0x11')]);}else{logger[_0xd405('0xc')](_0xd405('0xd'),_0x2375ff,_0xd405('0xe'));_0x360314(_0x502707['result'][_0xd405('0x11')]);}})[_0xd405('0x12')](function(_0x37ae3e){logger[_0xd405('0x10')]('Interval,\x20%s,\x20%s',_0x2375ff,_0x37ae3e);_0x50b0dc(_0x37ae3e);});});}exports['GetInterval']=function(_0x29938c){var _0x51f160=this;return new Promise(function(_0x4d30d7,_0x21fdea){return db['Interval'][_0xd405('0x13')]({'raw':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x15')]===undefined?!![]:![]:!![],'where':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x16')]||null:null,'attributes':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')]['attributes']||null:null,'limit':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x17')]||null:null,'include':_0x29938c[_0xd405('0x14')]?_0x29938c[_0xd405('0x14')][_0xd405('0x18')]?_[_0xd405('0x19')](_0x29938c[_0xd405('0x14')][_0xd405('0x18')],function(_0x2cd001){return{'model':db[_0x2cd001[_0xd405('0x1a')]],'as':_0x2cd001['as'],'attributes':_0x2cd001[_0xd405('0x1b')],'include':_0x2cd001[_0xd405('0x18')]?_[_0xd405('0x19')](_0x2cd001['include'],function(_0x1161d0){return{'model':db[_0x1161d0[_0xd405('0x1a')]],'as':_0x1161d0['as'],'attributes':_0x1161d0[_0xd405('0x1b')],'include':_0x1161d0[_0xd405('0x18')]?_['map'](_0x1161d0[_0xd405('0x18')],function(_0x4b6ccc){return{'model':db[_0x4b6ccc['model']],'as':_0x4b6ccc['as'],'attributes':_0x4b6ccc[_0xd405('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd405('0xb')](function(_0x359d0e){logger[_0xd405('0xc')](_0xd405('0x1c'),_0x29938c);logger[_0xd405('0x1d')](_0xd405('0x1c'),_0x29938c,JSON[_0xd405('0x1e')](_0x359d0e));_0x4d30d7(_0x359d0e);})['catch'](function(_0x241b03){logger['error']('GetInterval',_0x241b03[_0xd405('0x11')],_0x29938c);_0x21fdea(_0x51f160[_0xd405('0x10')](0x1f4,_0x241b03[_0xd405('0x11')]));});});};exports[_0xd405('0x1f')]=function(_0x41421e){var _0x5e776c=this;return new Promise(function(_0x7fe0e9,_0x2d5a16){return db[_0xd405('0x20')][_0xd405('0x21')]({'raw':_0x41421e[_0xd405('0x14')]?_0x41421e[_0xd405('0x14')][_0xd405('0x15')]===undefined?!![]:![]:!![],'where':_0x41421e['options']?_0x41421e[_0xd405('0x14')][_0xd405('0x16')]||null:null,'attributes':_0x41421e[_0xd405('0x14')]?_0x41421e[_0xd405('0x14')]['attributes']||null:null,'include':_0x41421e[_0xd405('0x14')]?_0x41421e[_0xd405('0x14')][_0xd405('0x18')]?_[_0xd405('0x19')](_0x41421e[_0xd405('0x14')]['include'],function(_0x39e885){return{'model':db[_0x39e885[_0xd405('0x1a')]],'as':_0x39e885['as'],'attributes':_0x39e885[_0xd405('0x1b')],'include':_0x39e885[_0xd405('0x18')]?_[_0xd405('0x19')](_0x39e885[_0xd405('0x18')],function(_0x41e548){return{'model':db[_0x41e548[_0xd405('0x1a')]],'as':_0x41e548['as'],'attributes':_0x41e548[_0xd405('0x1b')],'include':_0x41e548[_0xd405('0x18')]?_[_0xd405('0x19')](_0x41e548[_0xd405('0x18')],function(_0x286278){return{'model':db[_0x286278[_0xd405('0x1a')]],'as':_0x286278['as'],'attributes':_0x286278[_0xd405('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd405('0xb')](function(_0x5c92c4){logger[_0xd405('0xc')](_0xd405('0x1f'),_0x41421e);logger[_0xd405('0x1d')]('ShowInterval',_0x41421e,JSON[_0xd405('0x1e')](_0x5c92c4));_0x7fe0e9(_0x5c92c4);})[_0xd405('0x12')](function(_0x2d18a1){logger['error']('ShowInterval',_0x2d18a1['message'],_0x41421e);_0x2d5a16(_0x5e776c['error'](0x1f4,_0x2d18a1['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index c09d506..9f80898 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 _0xec6e=['express','Router','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x32da0d,_0x40ed00){var _0x31f978=function(_0x46e075){while(--_0x46e075){_0x32da0d['push'](_0x32da0d['shift']());}};_0x31f978(++_0x40ed00);}(_0xec6e,0x10a));var _0xeec6=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xec6e[_0x5d5bcb];return _0x4ea5eb;};'use strict';var express=require(_0xeec6('0x0'));var router=express[_0xeec6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xeec6('0x2'));router[_0xeec6('0x3')]('/',auth[_0xeec6('0x4')](),controller[_0xeec6('0x5')]);module[_0xeec6('0x6')]=router; \ No newline at end of file +var _0x437c=['isAuthenticated','express','Router','../../components/auth/service','./jira.controller'];(function(_0x2b25d5,_0x4ed28e){var _0x29df08=function(_0x1437ad){while(--_0x1437ad){_0x2b25d5['push'](_0x2b25d5['shift']());}};_0x29df08(++_0x4ed28e);}(_0x437c,0xd8));var _0xc437=function(_0xc31154,_0x293e74){_0xc31154=_0xc31154-0x0;var _0x484de2=_0x437c[_0xc31154];return _0x484de2;};'use strict';var express=require(_0xc437('0x0'));var router=express[_0xc437('0x1')]();var auth=require(_0xc437('0x2'));var controller=require(_0xc437('0x3'));router['post']('/',auth[_0xc437('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3b4051e..8a18059 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 _0xa7ec=['socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','connection','remoteAddress'];(function(_0xe127a9,_0x14731c){var _0x400f3b=function(_0x278877){while(--_0x278877){_0xe127a9['push'](_0xe127a9['shift']());}};_0x400f3b(++_0x14731c);}(_0xa7ec,0xe8));var _0xca7e=function(_0x599f5e,_0x36af9d){_0x599f5e=_0x599f5e-0x0;var _0xe80ca8=_0xa7ec[_0x599f5e];return _0xe80ca8;};'use strict';var BPromise=require(_0xca7e('0x0'));var https=require(_0xca7e('0x1'));var logger=require(_0xca7e('0x2'))(_0xca7e('0x3'));var USERNAME=_0xca7e('0x4');var PASSWORD=_0xca7e('0x5');function openIssue(_0x4ec073,_0x166d6f){var _0x222ea2={'fields':{'project':{'key':_0x4ec073[_0xca7e('0x6')]||_0xca7e('0x7')},'summary':(_0x4ec073['summary']||_0xca7e('0x8'))+_0xca7e('0x9')+_0x4ec073['ip'],'description':_0x4ec073['description']||JSON['stringify'](_0x4ec073),'issuetype':{'name':_0x4ec073[_0xca7e('0xa')]||_0xca7e('0xb')}}};_0x222ea2[_0xca7e('0xc')][_0xca7e('0xd')]=_0x4ec073[_0xca7e('0xe')];_0x222ea2[_0xca7e('0xc')]['customfield_11501']=_0x4ec073[_0xca7e('0xf')];_0x222ea2[_0xca7e('0xc')][_0xca7e('0x10')]=_0x4ec073[_0xca7e('0x11')];_0x222ea2[_0xca7e('0xc')]['customfield_11503']=_0x4ec073[_0xca7e('0x12')];_0x222ea2[_0xca7e('0xc')][_0xca7e('0x13')]=_0x4ec073['reason'];_0x222ea2[_0xca7e('0xc')][_0xca7e('0x14')]=_0x4ec073['ip'];var _0x412604={'host':_0xca7e('0x15'),'port':0x1bb,'path':_0xca7e('0x16'),'method':_0xca7e('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xca7e('0x18'),'Authorization':_0xca7e('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xca7e('0x1a')](_0xca7e('0x1b'))}};var _0x41e32f=JSON[_0xca7e('0x1c')](_0x222ea2);var _0x5d6d1c=https[_0xca7e('0x1d')](_0x412604,function(_0x1adb07){_0x1adb07[_0xca7e('0x1e')](_0xca7e('0x1f'));var _0x5354e7='';_0x1adb07['on']('data',function(_0x1bf939){_0x5354e7+=_0x1bf939;});_0x1adb07['on'](_0xca7e('0x20'),function(){if(_0x166d6f){return _0x166d6f[_0xca7e('0x21')](_0x1adb07[_0xca7e('0x22')])['json'](JSON[_0xca7e('0x23')](_0x5354e7));}});});_0x5d6d1c['on']('error',function(_0x2304e5){if(_0x166d6f){return _0x166d6f[_0xca7e('0x21')](0x1f4)[_0xca7e('0x24')]({'errors':[{'message':_0xca7e('0x25'),'type':_0xca7e('0x26')}]});}});_0x5d6d1c[_0xca7e('0x27')](_0x41e32f);_0x5d6d1c[_0xca7e('0x20')]();}exports[_0xca7e('0x28')]=openIssue;exports[_0xca7e('0x29')]=function(_0x420f6f,_0x4afbcc){_0x420f6f['body']['ip']=_0x420f6f['headers']['x-forwarded-for']||_0x420f6f[_0xca7e('0x2a')][_0xca7e('0x2b')]||_0x420f6f[_0xca7e('0x2c')]['remoteAddress']||_0x420f6f['connection']['socket'][_0xca7e('0x2b')];return openIssue(_0x420f6f[_0xca7e('0x2d')],_0x4afbcc);}; \ No newline at end of file +var _0xf565=['customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields'];(function(_0x46757,_0x455333){var _0x35dee6=function(_0x487c1d){while(--_0x487c1d){_0x46757['push'](_0x46757['shift']());}};_0x35dee6(++_0x455333);}(_0xf565,0x189));var _0x5f56=function(_0x456f07,_0x3db21d){_0x456f07=_0x456f07-0x0;var _0x6dab3f=_0xf565[_0x456f07];return _0x6dab3f;};'use strict';var BPromise=require(_0x5f56('0x0'));var https=require(_0x5f56('0x1'));var logger=require(_0x5f56('0x2'))('api');var USERNAME='support';var PASSWORD=_0x5f56('0x3');function openIssue(_0x48b0a3,_0x516815){var _0x1deee7={'fields':{'project':{'key':_0x48b0a3[_0x5f56('0x4')]||'MOTGUI'},'summary':(_0x48b0a3[_0x5f56('0x5')]||_0x5f56('0x6'))+_0x5f56('0x7')+_0x48b0a3['ip'],'description':_0x48b0a3[_0x5f56('0x8')]||JSON[_0x5f56('0x9')](_0x48b0a3),'issuetype':{'name':_0x48b0a3['issuetype']||_0x5f56('0xa')}}};_0x1deee7[_0x5f56('0xb')][_0x5f56('0xc')]=_0x48b0a3[_0x5f56('0xd')];_0x1deee7['fields'][_0x5f56('0xe')]=_0x48b0a3['oldToken'];_0x1deee7[_0x5f56('0xb')][_0x5f56('0xf')]=_0x48b0a3[_0x5f56('0x10')];_0x1deee7['fields'][_0x5f56('0x11')]=_0x48b0a3[_0x5f56('0x12')];_0x1deee7[_0x5f56('0xb')][_0x5f56('0x13')]=_0x48b0a3['reason'];_0x1deee7[_0x5f56('0xb')]['customfield_10102']=_0x48b0a3['ip'];var _0x4564a2={'host':_0x5f56('0x14'),'port':0x1bb,'path':_0x5f56('0x15'),'method':_0x5f56('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x5f56('0x17'),'Authorization':_0x5f56('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x5f56('0x19')](_0x5f56('0x1a'))}};var _0x3bd3d7=JSON['stringify'](_0x1deee7);var _0x3f86e8=https[_0x5f56('0x1b')](_0x4564a2,function(_0x2fb6ab){_0x2fb6ab[_0x5f56('0x1c')]('utf8');var _0x296582='';_0x2fb6ab['on'](_0x5f56('0x1d'),function(_0x2b6ec9){_0x296582+=_0x2b6ec9;});_0x2fb6ab['on'](_0x5f56('0x1e'),function(){if(_0x516815){return _0x516815[_0x5f56('0x1f')](_0x2fb6ab[_0x5f56('0x20')])[_0x5f56('0x21')](JSON['parse'](_0x296582));}});});_0x3f86e8['on'](_0x5f56('0x22'),function(_0x57c02d){if(_0x516815){return _0x516815[_0x5f56('0x1f')](0x1f4)[_0x5f56('0x21')]({'errors':[{'message':_0x5f56('0x23'),'type':_0x5f56('0x24')}]});}});_0x3f86e8[_0x5f56('0x25')](_0x3bd3d7);_0x3f86e8[_0x5f56('0x1e')]();}exports[_0x5f56('0x26')]=openIssue;exports['send']=function(_0x5b081e,_0x2825a9){_0x5b081e[_0x5f56('0x27')]['ip']=_0x5b081e[_0x5f56('0x28')][_0x5f56('0x29')]||_0x5b081e[_0x5f56('0x2a')][_0x5f56('0x2b')]||_0x5b081e[_0x5f56('0x2c')][_0x5f56('0x2b')]||_0x5b081e[_0x5f56('0x2a')]['socket'][_0x5f56('0x2b')];return openIssue(_0x5b081e[_0x5f56('0x27')],_0x2825a9);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 075d73e..c7d0a68 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 _0xec7a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','multer'];(function(_0xadaff,_0x4c676e){var _0x2b69d0=function(_0x520179){while(--_0x520179){_0xadaff['push'](_0xadaff['shift']());}};_0x2b69d0(++_0x4c676e);}(_0xec7a,0x7d));var _0xaec7=function(_0x2b12f7,_0x4033ac){_0x2b12f7=_0x2b12f7-0x0;var _0x8cb277=_0xec7a[_0x2b12f7];return _0x8cb277;};'use strict';var multer=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var path=require(_0xaec7('0x2'));var timeout=require(_0xaec7('0x3'));var express=require(_0xaec7('0x4'));var router=express[_0xaec7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xaec7('0x6'));var config=require(_0xaec7('0x7'));var controller=require(_0xaec7('0x8'));router[_0xaec7('0x9')]('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0xb')]);router[_0xaec7('0x9')](_0xaec7('0xc'),auth[_0xaec7('0xa')](),controller[_0xaec7('0xd')]);router['get']('/:id',auth[_0xaec7('0xa')](),controller['show']);router[_0xaec7('0xe')]('/',auth[_0xaec7('0xa')](),controller[_0xaec7('0xf')]);router[_0xaec7('0x10')](_0xaec7('0x11'),auth['isAuthenticated'](),controller[_0xaec7('0x12')]);router[_0xaec7('0x13')](_0xaec7('0x11'),auth[_0xaec7('0xa')](),controller[_0xaec7('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf28d=['update','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','put'];(function(_0x184a63,_0x47d607){var _0x269a2f=function(_0x475578){while(--_0x475578){_0x184a63['push'](_0x184a63['shift']());}};_0x269a2f(++_0x47d607);}(_0xf28d,0xd2));var _0xdf28=function(_0x239c07,_0x135a6f){_0x239c07=_0x239c07-0x0;var _0x3e1d6c=_0xf28d[_0x239c07];return _0x3e1d6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf28('0x0'));var timeout=require('connect-timeout');var express=require(_0xdf28('0x1'));var router=express[_0xdf28('0x2')]();var auth=require(_0xdf28('0x3'));var interaction=require(_0xdf28('0x4'));var config=require(_0xdf28('0x5'));var controller=require(_0xdf28('0x6'));router[_0xdf28('0x7')]('/',auth[_0xdf28('0x8')](),controller[_0xdf28('0x9')]);router[_0xdf28('0x7')]('/describe',auth[_0xdf28('0x8')](),controller[_0xdf28('0xa')]);router[_0xdf28('0x7')](_0xdf28('0xb'),auth[_0xdf28('0x8')](),controller[_0xdf28('0xc')]);router['post']('/',auth[_0xdf28('0x8')](),controller['create']);router[_0xdf28('0xd')](_0xdf28('0xb'),auth['isAuthenticated'](),controller[_0xdf28('0xe')]);router['delete'](_0xdf28('0xb'),auth['isAuthenticated'](),controller[_0xdf28('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e1ee33c..2263535 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 _0x8b2b=['exports','STRING','TEXT','long','sequelize'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x8b2b,0xb8));var _0xb8b2=function(_0x1ee28c,_0x496146){_0x1ee28c=_0x1ee28c-0x0;var _0x146073=_0x8b2b[_0x1ee28c];return _0x146073;};'use strict';var Sequelize=require(_0xb8b2('0x0'));module[_0xb8b2('0x1')]={'question':{'type':Sequelize[_0xb8b2('0x2')]},'answer':{'type':Sequelize[_0xb8b2('0x3')](_0xb8b2('0x4'))},'membername':{'type':Sequelize[_0xb8b2('0x2')]},'projectname':{'type':Sequelize[_0xb8b2('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb8b2('0x2')]},'calleridname':{'type':Sequelize[_0xb8b2('0x2')]},'calleridnum':{'type':Sequelize[_0xb8b2('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbeb8=['STRING','long','sequelize','exports'];(function(_0x25fe2d,_0x4ab2c2){var _0x5c3217=function(_0x40c89a){while(--_0x40c89a){_0x25fe2d['push'](_0x25fe2d['shift']());}};_0x5c3217(++_0x4ab2c2);}(_0xbeb8,0xe2));var _0x8beb=function(_0x3af40a,_0x44d266){_0x3af40a=_0x3af40a-0x0;var _0x3d6f6a=_0xbeb8[_0x3af40a];return _0x3d6f6a;};'use strict';var Sequelize=require(_0x8beb('0x0'));module[_0x8beb('0x1')]={'question':{'type':Sequelize[_0x8beb('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x8beb('0x3'))},'membername':{'type':Sequelize[_0x8beb('0x2')]},'projectname':{'type':Sequelize[_0x8beb('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x8beb('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index b38b48b..1541238 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 _0x6763=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x351afa,_0x2ff8b0){var _0x4b979f=function(_0x41d55e){while(--_0x41d55e){_0x351afa['push'](_0x351afa['shift']());}};_0x4b979f(++_0x2ff8b0);}(_0x6763,0x1ba));var _0x3676=function(_0x3763da,_0x58158b){_0x3763da=_0x3763da-0x0;var _0x5d192f=_0x6763[_0x3763da];return _0x5d192f;};'use strict';var pdf=require(_0x3676('0x0'));var emlformat=require(_0x3676('0x1'));var rimraf=require(_0x3676('0x2'));var zipdir=require(_0x3676('0x3'));var jsonpatch=require(_0x3676('0x4'));var rp=require(_0x3676('0x5'));var moment=require('moment');var BPromise=require(_0x3676('0x6'));var Mustache=require(_0x3676('0x7'));var util=require(_0x3676('0x8'));var path=require('path');var sox=require(_0x3676('0x9'));var csv=require(_0x3676('0xa'));var ejs=require(_0x3676('0xb'));var fs=require('fs');var _=require(_0x3676('0xc'));var squel=require(_0x3676('0xd'));var crypto=require(_0x3676('0xe'));var jsforce=require(_0x3676('0xf'));var deskjs=require(_0x3676('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3676('0x11'));var Papa=require(_0x3676('0x12'));var Redis=require(_0x3676('0x13'));var authService=require(_0x3676('0x14'));var qs=require(_0x3676('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3676('0x16'));var logger=require(_0x3676('0x17'))(_0x3676('0x18'));var utils=require(_0x3676('0x19'));var config=require(_0x3676('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3676('0x1b'))['db'];function respondWithStatusCode(_0x315814,_0x14f51e){_0x14f51e=_0x14f51e||0xcc;return function(_0xf61671){if(_0xf61671){return _0x315814[_0x3676('0x1c')](_0x14f51e);}return _0x315814[_0x3676('0x1d')](_0x14f51e)[_0x3676('0x1e')]();};}function respondWithResult(_0x105f09,_0x90ab49){_0x90ab49=_0x90ab49||0xc8;return function(_0x4a3308){if(_0x4a3308){return _0x105f09[_0x3676('0x1d')](_0x90ab49)[_0x3676('0x1f')](_0x4a3308);}};}function respondWithFilteredResult(_0x2f799f,_0x185109){return function(_0x5c337a){if(_0x5c337a){var _0x4d3101=_0x5c337a[_0x3676('0x20')],_0x5ecfbd=_0x185109[_0x3676('0x21')],_0x2b756d=_0x185109[_0x3676('0x21')]+_0x185109['limit'],_0x342173;if(_0x2b756d>=_0x4d3101){_0x2b756d=_0x4d3101;_0x342173=0xc8;}else{_0x342173=0xce;}_0x2f799f[_0x3676('0x1d')](_0x342173);return _0x2f799f[_0x3676('0x22')](_0x3676('0x23'),_0x5ecfbd+'-'+_0x2b756d+'/'+_0x4d3101)['json'](_0x5c337a);}return null;};}function patchUpdates(_0x5a3486){return function(_0x26fb9b){try{jsonpatch[_0x3676('0x24')](_0x26fb9b,_0x5a3486,!![]);}catch(_0x27eedc){return BPromise[_0x3676('0x25')](_0x27eedc);}return _0x26fb9b['save']();};}function saveUpdates(_0x408b34,_0x390f39){return function(_0x182be3){if(_0x182be3){return _0x182be3['update'](_0x408b34)['then'](function(_0x1b130a){return _0x1b130a;});}return null;};}function removeEntity(_0x3d0c17,_0x3ce652){return function(_0x255c9f){if(_0x255c9f){return _0x255c9f[_0x3676('0x26')]()[_0x3676('0x27')](function(){_0x3d0c17[_0x3676('0x1d')](0xcc)[_0x3676('0x1e')]();});}};}function handleEntityNotFound(_0x3fadb5,_0x288c94){return function(_0x588dec){if(!_0x588dec){_0x3fadb5[_0x3676('0x1c')](0x194);}return _0x588dec;};}function handleError(_0x249130,_0x10e3bc){_0x10e3bc=_0x10e3bc||0x1f4;return function(_0x27b356){logger[_0x3676('0x28')](_0x27b356[_0x3676('0x29')]);if(_0x27b356[_0x3676('0x2a')]){delete _0x27b356[_0x3676('0x2a')];}_0x249130[_0x3676('0x1d')](_0x10e3bc)['send'](_0x27b356);};}exports[_0x3676('0x2b')]=function(_0x243fcd,_0x10ac19){var _0x413733={},_0x18a73a={},_0x1460d8={'count':0x0,'rows':[]};var _0x5cd430=_[_0x3676('0x2c')](db[_0x3676('0x2d')][_0x3676('0x2e')],function(_0x55d166){return{'name':_0x55d166[_0x3676('0x2f')],'type':_0x55d166[_0x3676('0x30')][_0x3676('0x31')]};});_0x18a73a[_0x3676('0x32')]=_['map'](_0x5cd430,_0x3676('0x2a'));_0x18a73a[_0x3676('0x33')]=_[_0x3676('0x34')](_0x243fcd[_0x3676('0x33')]);_0x18a73a[_0x3676('0x35')]=_[_0x3676('0x36')](_0x18a73a[_0x3676('0x32')],_0x18a73a[_0x3676('0x33')]);_0x413733[_0x3676('0x37')]=_[_0x3676('0x36')](_0x18a73a[_0x3676('0x32')],qs[_0x3676('0x38')](_0x243fcd[_0x3676('0x33')]['fields']));_0x413733[_0x3676('0x37')]=_0x413733['attributes']['length']?_0x413733[_0x3676('0x37')]:_0x18a73a[_0x3676('0x32')];if(!_0x243fcd[_0x3676('0x33')][_0x3676('0x39')](_0x3676('0x3a'))){_0x413733[_0x3676('0x3b')]=qs[_0x3676('0x3b')](_0x243fcd[_0x3676('0x33')][_0x3676('0x3b')]);_0x413733[_0x3676('0x21')]=qs[_0x3676('0x21')](_0x243fcd[_0x3676('0x33')][_0x3676('0x21')]);}_0x413733['order']=qs[_0x3676('0x3c')](_0x243fcd[_0x3676('0x33')][_0x3676('0x3c')]);_0x413733['where']=qs[_0x3676('0x35')](_['pick'](_0x243fcd[_0x3676('0x33')],_0x18a73a[_0x3676('0x35')]),_0x5cd430);if(_0x243fcd[_0x3676('0x33')][_0x3676('0x3d')]){_0x413733[_0x3676('0x3e')]=_[_0x3676('0x3f')](_0x413733['where'],{'$or':_[_0x3676('0x2c')](_0x5cd430,function(_0x45bb8d){if(_0x45bb8d['type']!==_0x3676('0x40')){var _0xa0733={};_0xa0733[_0x45bb8d[_0x3676('0x2a')]]={'$like':'%'+_0x243fcd[_0x3676('0x33')][_0x3676('0x3d')]+'%'};return _0xa0733;}})});}_0x413733=_[_0x3676('0x3f')]({},_0x413733,_0x243fcd[_0x3676('0x41')]);var _0x381c4e={'where':_0x413733[_0x3676('0x3e')]};return db[_0x3676('0x2d')][_0x3676('0x20')](_0x381c4e)[_0x3676('0x27')](function(_0x5aced4){_0x1460d8[_0x3676('0x20')]=_0x5aced4;if(_0x243fcd[_0x3676('0x33')]['includeAll']){_0x413733[_0x3676('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3676('0x43')](_0x413733);})[_0x3676('0x27')](function(_0x201038){_0x1460d8[_0x3676('0x44')]=_0x201038;return _0x1460d8;})[_0x3676('0x27')](respondWithFilteredResult(_0x10ac19,_0x413733))[_0x3676('0x45')](handleError(_0x10ac19,null));};exports[_0x3676('0x46')]=function(_0x2b4b19,_0x323bcb){var _0x385990={'raw':!![],'where':{'id':_0x2b4b19[_0x3676('0x47')]['id']}},_0x310d50={};_0x310d50['model']=_[_0x3676('0x34')](db[_0x3676('0x2d')]['rawAttributes']);_0x310d50[_0x3676('0x33')]=_[_0x3676('0x34')](_0x2b4b19['query']);_0x310d50[_0x3676('0x35')]=_[_0x3676('0x36')](_0x310d50[_0x3676('0x32')],_0x310d50['query']);_0x385990[_0x3676('0x37')]=_['intersection'](_0x310d50['model'],qs['fields'](_0x2b4b19[_0x3676('0x33')]['fields']));_0x385990[_0x3676('0x37')]=_0x385990['attributes'][_0x3676('0x48')]?_0x385990[_0x3676('0x37')]:_0x310d50[_0x3676('0x32')];if(_0x2b4b19[_0x3676('0x33')][_0x3676('0x49')]){_0x385990[_0x3676('0x42')]=[{'all':!![]}];}_0x385990=_['merge']({},_0x385990,_0x2b4b19[_0x3676('0x41')]);return db[_0x3676('0x2d')][_0x3676('0x4a')](_0x385990)['then'](handleEntityNotFound(_0x323bcb,null))[_0x3676('0x27')](respondWithResult(_0x323bcb,null))[_0x3676('0x45')](handleError(_0x323bcb,null));};exports[_0x3676('0x4b')]=function(_0x187f89,_0x55e908){return db[_0x3676('0x2d')][_0x3676('0x4b')](_0x187f89[_0x3676('0x4c')],{})[_0x3676('0x27')](respondWithResult(_0x55e908,0xc9))[_0x3676('0x45')](handleError(_0x55e908,null));};exports['update']=function(_0x50297c,_0x33c85d){if(_0x50297c[_0x3676('0x4c')]['id']){delete _0x50297c[_0x3676('0x4c')]['id'];}return db[_0x3676('0x2d')]['find']({'where':{'id':_0x50297c['params']['id']}})[_0x3676('0x27')](handleEntityNotFound(_0x33c85d,null))[_0x3676('0x27')](saveUpdates(_0x50297c['body'],null))['then'](respondWithResult(_0x33c85d,null))[_0x3676('0x45')](handleError(_0x33c85d,null));};exports[_0x3676('0x26')]=function(_0x5ab154,_0x30d265){return db[_0x3676('0x2d')][_0x3676('0x4a')]({'where':{'id':_0x5ab154[_0x3676('0x47')]['id']}})[_0x3676('0x27')](handleEntityNotFound(_0x30d265,null))[_0x3676('0x27')](removeEntity(_0x30d265,null))[_0x3676('0x45')](handleError(_0x30d265,null));};exports[_0x3676('0x4d')]=function(_0x1ab9ac,_0x2f8044){return db[_0x3676('0x2d')]['describe']()['then'](respondWithResult(_0x2f8044,null))[_0x3676('0x45')](handleError(_0x2f8044,null));}; \ No newline at end of file +var _0x15c6=['offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','JscriptyAnswerReport','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x517586,_0xc97d01){var _0x4d7494=function(_0x1383d8){while(--_0x1383d8){_0x517586['push'](_0x517586['shift']());}};_0x4d7494(++_0xc97d01);}(_0x15c6,0xbb));var _0x615c=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x15c6[_0x57d13b];return _0x467696;};'use strict';var pdf=require(_0x615c('0x0'));var emlformat=require(_0x615c('0x1'));var rimraf=require(_0x615c('0x2'));var zipdir=require(_0x615c('0x3'));var jsonpatch=require(_0x615c('0x4'));var rp=require(_0x615c('0x5'));var moment=require(_0x615c('0x6'));var BPromise=require(_0x615c('0x7'));var Mustache=require(_0x615c('0x8'));var util=require(_0x615c('0x9'));var path=require('path');var sox=require(_0x615c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x615c('0xb'));var squel=require('squel');var crypto=require(_0x615c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x615c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x615c('0xe'));var authService=require(_0x615c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x615c('0x10'));var logger=require('../../config/logger')(_0x615c('0x11'));var utils=require(_0x615c('0x12'));var config=require(_0x615c('0x13'));var licenseUtil=require(_0x615c('0x14'));var db=require(_0x615c('0x15'))['db'];function respondWithStatusCode(_0x40a7fb,_0x12b4df){_0x12b4df=_0x12b4df||0xcc;return function(_0x4501f6){if(_0x4501f6){return _0x40a7fb[_0x615c('0x16')](_0x12b4df);}return _0x40a7fb[_0x615c('0x17')](_0x12b4df)[_0x615c('0x18')]();};}function respondWithResult(_0x14eea3,_0x15520b){_0x15520b=_0x15520b||0xc8;return function(_0x27e3b9){if(_0x27e3b9){return _0x14eea3[_0x615c('0x17')](_0x15520b)[_0x615c('0x19')](_0x27e3b9);}};}function respondWithFilteredResult(_0x4cbe9c,_0x149b72){return function(_0x5a2dee){if(_0x5a2dee){var _0x17b480=_0x5a2dee['count'],_0x302426=_0x149b72['offset'],_0xa68c31=_0x149b72[_0x615c('0x1a')]+_0x149b72['limit'],_0x5694d1;if(_0xa68c31>=_0x17b480){_0xa68c31=_0x17b480;_0x5694d1=0xc8;}else{_0x5694d1=0xce;}_0x4cbe9c[_0x615c('0x17')](_0x5694d1);return _0x4cbe9c['set'](_0x615c('0x1b'),_0x302426+'-'+_0xa68c31+'/'+_0x17b480)[_0x615c('0x19')](_0x5a2dee);}return null;};}function patchUpdates(_0x39f61c){return function(_0x202ad0){try{jsonpatch[_0x615c('0x1c')](_0x202ad0,_0x39f61c,!![]);}catch(_0x4f823f){return BPromise[_0x615c('0x1d')](_0x4f823f);}return _0x202ad0[_0x615c('0x1e')]();};}function saveUpdates(_0x49d0e9,_0x206032){return function(_0x4242c7){if(_0x4242c7){return _0x4242c7['update'](_0x49d0e9)['then'](function(_0x413e9b){return _0x413e9b;});}return null;};}function removeEntity(_0x79bc53,_0x43e54b){return function(_0x5fe8c2){if(_0x5fe8c2){return _0x5fe8c2[_0x615c('0x1f')]()[_0x615c('0x20')](function(){_0x79bc53['status'](0xcc)[_0x615c('0x18')]();});}};}function handleEntityNotFound(_0x5587e0,_0xa7f160){return function(_0xb6d424){if(!_0xb6d424){_0x5587e0[_0x615c('0x16')](0x194);}return _0xb6d424;};}function handleError(_0x267193,_0x3ef7ca){_0x3ef7ca=_0x3ef7ca||0x1f4;return function(_0x46267b){logger[_0x615c('0x21')](_0x46267b['stack']);if(_0x46267b[_0x615c('0x22')]){delete _0x46267b[_0x615c('0x22')];}_0x267193[_0x615c('0x17')](_0x3ef7ca)[_0x615c('0x23')](_0x46267b);};}exports[_0x615c('0x24')]=function(_0x3eb483,_0x49f6d0){var _0x1d4906={},_0x919b43={},_0x96087d={'count':0x0,'rows':[]};var _0x38b232=_[_0x615c('0x25')](db[_0x615c('0x26')]['rawAttributes'],function(_0xc1151b){return{'name':_0xc1151b['fieldName'],'type':_0xc1151b[_0x615c('0x27')]['key']};});_0x919b43[_0x615c('0x28')]=_['map'](_0x38b232,_0x615c('0x22'));_0x919b43['query']=_['keys'](_0x3eb483[_0x615c('0x29')]);_0x919b43[_0x615c('0x2a')]=_['intersection'](_0x919b43['model'],_0x919b43[_0x615c('0x29')]);_0x1d4906[_0x615c('0x2b')]=_[_0x615c('0x2c')](_0x919b43[_0x615c('0x28')],qs[_0x615c('0x2d')](_0x3eb483[_0x615c('0x29')][_0x615c('0x2d')]));_0x1d4906[_0x615c('0x2b')]=_0x1d4906['attributes'][_0x615c('0x2e')]?_0x1d4906[_0x615c('0x2b')]:_0x919b43[_0x615c('0x28')];if(!_0x3eb483[_0x615c('0x29')][_0x615c('0x2f')]('nolimit')){_0x1d4906['limit']=qs[_0x615c('0x30')](_0x3eb483[_0x615c('0x29')][_0x615c('0x30')]);_0x1d4906[_0x615c('0x1a')]=qs[_0x615c('0x1a')](_0x3eb483[_0x615c('0x29')][_0x615c('0x1a')]);}_0x1d4906[_0x615c('0x31')]=qs['sort'](_0x3eb483[_0x615c('0x29')][_0x615c('0x32')]);_0x1d4906[_0x615c('0x33')]=qs['filters'](_[_0x615c('0x34')](_0x3eb483[_0x615c('0x29')],_0x919b43['filters']),_0x38b232);if(_0x3eb483[_0x615c('0x29')][_0x615c('0x35')]){_0x1d4906[_0x615c('0x33')]=_[_0x615c('0x36')](_0x1d4906[_0x615c('0x33')],{'$or':_[_0x615c('0x25')](_0x38b232,function(_0x3c99f3){if(_0x3c99f3[_0x615c('0x27')]!=='VIRTUAL'){var _0x34623a={};_0x34623a[_0x3c99f3[_0x615c('0x22')]]={'$like':'%'+_0x3eb483[_0x615c('0x29')]['filter']+'%'};return _0x34623a;}})});}_0x1d4906=_[_0x615c('0x36')]({},_0x1d4906,_0x3eb483[_0x615c('0x37')]);var _0x478f5c={'where':_0x1d4906[_0x615c('0x33')]};return db[_0x615c('0x26')][_0x615c('0x38')](_0x478f5c)[_0x615c('0x20')](function(_0x290ff9){_0x96087d[_0x615c('0x38')]=_0x290ff9;if(_0x3eb483['query'][_0x615c('0x39')]){_0x1d4906[_0x615c('0x3a')]=[{'all':!![]}];}return db[_0x615c('0x26')][_0x615c('0x3b')](_0x1d4906);})['then'](function(_0x99f6b4){_0x96087d[_0x615c('0x3c')]=_0x99f6b4;return _0x96087d;})[_0x615c('0x20')](respondWithFilteredResult(_0x49f6d0,_0x1d4906))[_0x615c('0x3d')](handleError(_0x49f6d0,null));};exports[_0x615c('0x3e')]=function(_0x2241a9,_0x5e3c8f){var _0x426d91={'raw':!![],'where':{'id':_0x2241a9['params']['id']}},_0x49a063={};_0x49a063[_0x615c('0x28')]=_[_0x615c('0x3f')](db['JscriptyAnswerReport'][_0x615c('0x40')]);_0x49a063[_0x615c('0x29')]=_[_0x615c('0x3f')](_0x2241a9[_0x615c('0x29')]);_0x49a063[_0x615c('0x2a')]=_[_0x615c('0x2c')](_0x49a063[_0x615c('0x28')],_0x49a063['query']);_0x426d91[_0x615c('0x2b')]=_[_0x615c('0x2c')](_0x49a063[_0x615c('0x28')],qs[_0x615c('0x2d')](_0x2241a9[_0x615c('0x29')][_0x615c('0x2d')]));_0x426d91['attributes']=_0x426d91[_0x615c('0x2b')][_0x615c('0x2e')]?_0x426d91['attributes']:_0x49a063[_0x615c('0x28')];if(_0x2241a9[_0x615c('0x29')][_0x615c('0x39')]){_0x426d91[_0x615c('0x3a')]=[{'all':!![]}];}_0x426d91=_[_0x615c('0x36')]({},_0x426d91,_0x2241a9[_0x615c('0x37')]);return db['JscriptyAnswerReport'][_0x615c('0x41')](_0x426d91)[_0x615c('0x20')](handleEntityNotFound(_0x5e3c8f,null))[_0x615c('0x20')](respondWithResult(_0x5e3c8f,null))[_0x615c('0x3d')](handleError(_0x5e3c8f,null));};exports[_0x615c('0x42')]=function(_0x47ee77,_0x4e85fe){return db[_0x615c('0x26')][_0x615c('0x42')](_0x47ee77[_0x615c('0x43')],{})[_0x615c('0x20')](respondWithResult(_0x4e85fe,0xc9))[_0x615c('0x3d')](handleError(_0x4e85fe,null));};exports[_0x615c('0x44')]=function(_0x5523a8,_0x326e79){if(_0x5523a8[_0x615c('0x43')]['id']){delete _0x5523a8[_0x615c('0x43')]['id'];}return db['JscriptyAnswerReport'][_0x615c('0x41')]({'where':{'id':_0x5523a8[_0x615c('0x45')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x326e79,null))[_0x615c('0x20')](saveUpdates(_0x5523a8[_0x615c('0x43')],null))[_0x615c('0x20')](respondWithResult(_0x326e79,null))[_0x615c('0x3d')](handleError(_0x326e79,null));};exports[_0x615c('0x1f')]=function(_0x4bc115,_0x1f0f03){return db[_0x615c('0x26')][_0x615c('0x41')]({'where':{'id':_0x4bc115['params']['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x1f0f03,null))[_0x615c('0x20')](removeEntity(_0x1f0f03,null))['catch'](handleError(_0x1f0f03,null));};exports[_0x615c('0x46')]=function(_0x168fd5,_0x5e2184){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x5e2184,null))[_0x615c('0x3d')](handleError(_0x5e2184,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9705808..fa68006 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 _0xed81=['../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','moment','bluebird','path'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0xed81,0x163));var _0x1ed8=function(_0x38fadc,_0x5c1a9c){_0x38fadc=_0x38fadc-0x0;var _0x3c0c69=_0xed81[_0x38fadc];return _0x3c0c69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1ed8('0x0'))(_0x1ed8('0x1'));var moment=require(_0x1ed8('0x2'));var BPromise=require(_0x1ed8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ed8('0x4'));var rimraf=require('rimraf');var config=require(_0x1ed8('0x5'));var attributes=require(_0x1ed8('0x6'));module['exports']=function(_0x26a0ef,_0x55f536){return _0x26a0ef['define'](_0x1ed8('0x7'),attributes,{'tableName':_0x1ed8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab3=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x3a5e46,_0x4e3a77){var _0x2bbf34=function(_0x4e4d38){while(--_0x4e4d38){_0x3a5e46['push'](_0x3a5e46['shift']());}};_0x2bbf34(++_0x4e3a77);}(_0x1ab3,0x147));var _0x31ab=function(_0x27a591,_0x5258c4){_0x27a591=_0x27a591-0x0;var _0x20f1c6=_0x1ab3[_0x27a591];return _0x20f1c6;};'use strict';var _=require(_0x31ab('0x0'));var util=require(_0x31ab('0x1'));var logger=require(_0x31ab('0x2'))(_0x31ab('0x3'));var moment=require('moment');var BPromise=require(_0x31ab('0x4'));var rp=require(_0x31ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31ab('0x6'));var config=require(_0x31ab('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x31ab('0x8')]=function(_0xc5bc9b,_0x51fb90){return _0xc5bc9b[_0x31ab('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0x31ab('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 4ef8755..d4e7a56 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 _0xd41d=['result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x549a24,_0x35bca6){var _0x2a67c3=function(_0x108a24){while(--_0x108a24){_0x549a24['push'](_0x549a24['shift']());}};_0x2a67c3(++_0x35bca6);}(_0xd41d,0x12c));var _0xdd41=function(_0x53a13b,_0x316d7a){_0x53a13b=_0x53a13b-0x0;var _0x552340=_0xd41d[_0x53a13b];return _0x552340;};'use strict';var _=require('lodash');var util=require(_0xdd41('0x0'));var moment=require(_0xdd41('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd41('0x2'));var fs=require('fs');var Redis=require(_0xdd41('0x3'));var db=require(_0xdd41('0x4'))['db'];var utils=require(_0xdd41('0x5'));var logger=require(_0xdd41('0x6'))(_0xdd41('0x7'));var config=require(_0xdd41('0x8'));var jayson=require(_0xdd41('0x9'));var client=jayson[_0xdd41('0xa')][_0xdd41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x259521,_0x21afb9,_0x48f3e8){return new BPromise(function(_0x30b164,_0x133dca){return client[_0xdd41('0xc')](_0x259521,_0x48f3e8)[_0xdd41('0xd')](function(_0xecd1e9){logger['info'](_0xdd41('0xe'),_0x21afb9,_0xdd41('0xf'));logger[_0xdd41('0x10')](_0xdd41('0x11'),_0x21afb9,_0xdd41('0xf'),JSON[_0xdd41('0x12')](_0xecd1e9));if(_0xecd1e9[_0xdd41('0x13')]){if(_0xecd1e9[_0xdd41('0x13')][_0xdd41('0x14')]===0x1f4){logger[_0xdd41('0x13')](_0xdd41('0xe'),_0x21afb9,_0xecd1e9[_0xdd41('0x13')]['message']);return _0x133dca(_0xecd1e9['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x21afb9,_0xecd1e9[_0xdd41('0x13')][_0xdd41('0x15')]);return _0x30b164(_0xecd1e9[_0xdd41('0x13')][_0xdd41('0x15')]);}else{logger['info'](_0xdd41('0xe'),_0x21afb9,_0xdd41('0xf'));_0x30b164(_0xecd1e9[_0xdd41('0x16')][_0xdd41('0x15')]);}})['catch'](function(_0x5c8692){logger['error'](_0xdd41('0xe'),_0x21afb9,_0x5c8692);_0x133dca(_0x5c8692);});});} \ No newline at end of file +var _0xb19d=['stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x29d38c,_0x434e6c){var _0x1c585b=function(_0x20e264){while(--_0x20e264){_0x29d38c['push'](_0x29d38c['shift']());}};_0x1c585b(++_0x434e6c);}(_0xb19d,0x18d));var _0xdb19=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0xb19d[_0x2d982d];return _0x4f36b0;};'use strict';var _=require(_0xdb19('0x0'));var util=require(_0xdb19('0x1'));var moment=require('moment');var BPromise=require(_0xdb19('0x2'));var rs=require(_0xdb19('0x3'));var fs=require('fs');var Redis=require(_0xdb19('0x4'));var db=require(_0xdb19('0x5'))['db'];var utils=require(_0xdb19('0x6'));var logger=require(_0xdb19('0x7'))(_0xdb19('0x8'));var config=require(_0xdb19('0x9'));var jayson=require(_0xdb19('0xa'));var client=jayson['client'][_0xdb19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a987c,_0x437e58,_0x3e48d6){return new BPromise(function(_0xbbf44e,_0x46b31b){return client['request'](_0x4a987c,_0x3e48d6)[_0xdb19('0xc')](function(_0x45f60a){logger['info'](_0xdb19('0xd'),_0x437e58,_0xdb19('0xe'));logger[_0xdb19('0xf')](_0xdb19('0x10'),_0x437e58,'request\x20sent',JSON[_0xdb19('0x11')](_0x45f60a));if(_0x45f60a[_0xdb19('0x12')]){if(_0x45f60a[_0xdb19('0x12')]['code']===0x1f4){logger[_0xdb19('0x12')](_0xdb19('0xd'),_0x437e58,_0x45f60a['error'][_0xdb19('0x13')]);return _0x46b31b(_0x45f60a[_0xdb19('0x12')][_0xdb19('0x13')]);}logger[_0xdb19('0x12')](_0xdb19('0xd'),_0x437e58,_0x45f60a['error']['message']);return _0xbbf44e(_0x45f60a['error']['message']);}else{logger[_0xdb19('0x14')](_0xdb19('0xd'),_0x437e58,'request\x20sent');_0xbbf44e(_0x45f60a[_0xdb19('0x15')][_0xdb19('0x13')]);}})[_0xdb19('0x16')](function(_0x38e0ec){logger[_0xdb19('0x12')](_0xdb19('0xd'),_0x437e58,_0x38e0ec);_0x46b31b(_0x38e0ec);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 199de20..2c288c8 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 _0xc9ab=['show','/:id/sessions','/:id/summary','post','/:id/clone','clone','put','delete','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xc9ab,0x125));var _0xbc9a=function(_0x487c79,_0x146ce5){_0x487c79=_0x487c79-0x0;var _0x31929b=_0xc9ab[_0x487c79];return _0x31929b;};'use strict';var multer=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var path=require(_0xbc9a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbc9a('0x3'));var interaction=require(_0xbc9a('0x4'));var config=require(_0xbc9a('0x5'));var controller=require(_0xbc9a('0x6'));router[_0xbc9a('0x7')]('/',auth[_0xbc9a('0x8')](),controller[_0xbc9a('0x9')]);router[_0xbc9a('0x7')](_0xbc9a('0xa'),auth[_0xbc9a('0x8')](),controller[_0xbc9a('0xb')]);router[_0xbc9a('0x7')](_0xbc9a('0xc'),auth[_0xbc9a('0x8')](),controller['getSessions']);router['get']('/:id/answers',auth[_0xbc9a('0x8')](),controller['getAnswers']);router[_0xbc9a('0x7')](_0xbc9a('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router[_0xbc9a('0xe')]('/',auth[_0xbc9a('0x8')](),controller['create']);router[_0xbc9a('0xe')](_0xbc9a('0xf'),auth[_0xbc9a('0x8')](),controller[_0xbc9a('0x10')]);router[_0xbc9a('0x11')](_0xbc9a('0xa'),auth[_0xbc9a('0x8')](),controller['update']);router[_0xbc9a('0x12')](_0xbc9a('0xa'),auth[_0xbc9a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0355=['Router','../../components/interaction/service','isAuthenticated','show','get','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4f47ac,_0x5b7fad){var _0x4edbce=function(_0x1d20d7){while(--_0x1d20d7){_0x4f47ac['push'](_0x4f47ac['shift']());}};_0x4edbce(++_0x5b7fad);}(_0x0355,0xca));var _0x5035=function(_0x196320,_0x3f9ac2){_0x196320=_0x196320-0x0;var _0xa975ad=_0x0355[_0x196320];return _0xa975ad;};'use strict';var multer=require(_0x5035('0x0'));var util=require(_0x5035('0x1'));var path=require(_0x5035('0x2'));var timeout=require(_0x5035('0x3'));var express=require(_0x5035('0x4'));var router=express[_0x5035('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5035('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x5035('0x7')](),controller['index']);router['get']('/:id',auth[_0x5035('0x7')](),controller[_0x5035('0x8')]);router[_0x5035('0x9')]('/:id/sessions',auth[_0x5035('0x7')](),controller[_0x5035('0xa')]);router['get'](_0x5035('0xb'),auth[_0x5035('0x7')](),controller[_0x5035('0xc')]);router[_0x5035('0x9')](_0x5035('0xd'),auth[_0x5035('0x7')](),timeout(_0x5035('0xe')),controller['getSummary']);router[_0x5035('0xf')]('/',auth[_0x5035('0x7')](),controller[_0x5035('0x10')]);router[_0x5035('0xf')](_0x5035('0x11'),auth[_0x5035('0x7')](),controller[_0x5035('0x12')]);router[_0x5035('0x13')]('/:id',auth[_0x5035('0x7')](),controller['update']);router['delete'](_0x5035('0x14'),auth[_0x5035('0x7')](),controller[_0x5035('0x15')]);module[_0x5035('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 59edf24..1fc1a94 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 _0xd7ff=['sequelize','STRING','name','isObjectLike','stringify','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd7ff,0x1b0));var _0xfd7f=function(_0x3cb788,_0x414fc8){_0x3cb788=_0x3cb788-0x0;var _0x391a9d=_0xd7ff[_0x3cb788];return _0x391a9d;};'use strict';var Sequelize=require(_0xfd7f('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xfd7f('0x1')],'unique':_0xfd7f('0x2')},'description':{'type':Sequelize[_0xfd7f('0x1')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x1f7929){if(_[_0xfd7f('0x3')](_0x1f7929)){this['setDataValue']('formData',JSON[_0xfd7f('0x4')](_0x1f7929));}else if(_['isString'](_0x1f7929)){this[_0xfd7f('0x5')](_0xfd7f('0x6'),_0x1f7929);}else{this[_0xfd7f('0x5')](_0xfd7f('0x6'),util[_0xfd7f('0x7')](_0xfd7f('0x8'),this[_0xfd7f('0x9')](_0xfd7f('0x2'))||'',this[_0xfd7f('0x9')](_0xfd7f('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfd7f('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x588d=['util','exports','STRING','name','TEXT','long','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x3b3a6c,_0x1ff238){var _0x57ae86=function(_0x66a502){while(--_0x66a502){_0x3b3a6c['push'](_0x3b3a6c['shift']());}};_0x57ae86(++_0x1ff238);}(_0x588d,0xca));var _0xd588=function(_0x228b0d,_0x21723b){_0x228b0d=_0x228b0d-0x0;var _0x1dd11c=_0x588d[_0x228b0d];return _0x1dd11c;};'use strict';var Sequelize=require(_0xd588('0x0'));var _=require(_0xd588('0x1'));var util=require(_0xd588('0x2'));module[_0xd588('0x3')]={'name':{'type':Sequelize[_0xd588('0x4')],'unique':_0xd588('0x5')},'description':{'type':Sequelize[_0xd588('0x4')]},'formData':{'type':Sequelize[_0xd588('0x6')](_0xd588('0x7')),'set':function(_0x400042){if(_['isObjectLike'](_0x400042)){this[_0xd588('0x8')]('formData',JSON[_0xd588('0x9')](_0x400042));}else if(_[_0xd588('0xa')](_0x400042)){this[_0xd588('0x8')](_0xd588('0xb'),_0x400042);}else{this[_0xd588('0x8')](_0xd588('0xb'),util[_0xd588('0xc')](_0xd588('0xd'),this[_0xd588('0xe')](_0xd588('0x5'))||'',this['getDataValue'](_0xd588('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd588('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd588('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1c0658b..f0dd95d 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 _0x7425=['keys','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','updatedAt','createdAt','role','UserProfileSection','autoAssociation','UserProfileResource','destroy','getSessions','findOne','JscriptySessionReport','getAnswers','pick','JscriptyAnswerReport','findAll','number','fromCharCode','apply','indexOf','toString','getSummary','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','reject','then','Projects','error','name','index','JscriptyProject','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','rows','show','params'];(function(_0xb2cce7,_0x15a327){var _0x4d396a=function(_0x42e3f1){while(--_0x42e3f1){_0xb2cce7['push'](_0xb2cce7['shift']());}};_0x4d396a(++_0x15a327);}(_0x7425,0x10b));var _0x5742=function(_0x4df74a,_0x5cd66e){_0x4df74a=_0x4df74a-0x0;var _0x30909b=_0x7425[_0x4df74a];return _0x30909b;};'use strict';var pdf=require(_0x5742('0x0'));var emlformat=require(_0x5742('0x1'));var rimraf=require(_0x5742('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5742('0x3'));var rp=require(_0x5742('0x4'));var moment=require('moment');var BPromise=require(_0x5742('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5742('0x6'));var sox=require(_0x5742('0x7'));var csv=require(_0x5742('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5742('0x9'));var squel=require(_0x5742('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5742('0xb'));var toCsv=require(_0x5742('0x8'));var querystring=require(_0x5742('0xc'));var Papa=require(_0x5742('0xd'));var Redis=require(_0x5742('0xe'));var authService=require(_0x5742('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5742('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5742('0x11'));var utils=require(_0x5742('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5742('0x13'))['db'];function respondWithStatusCode(_0x1902b4,_0x41f5ae){_0x41f5ae=_0x41f5ae||0xcc;return function(_0x3b8659){if(_0x3b8659){return _0x1902b4[_0x5742('0x14')](_0x41f5ae);}return _0x1902b4['status'](_0x41f5ae)[_0x5742('0x15')]();};}function respondWithResult(_0x58fb3f,_0x4fb2b9){_0x4fb2b9=_0x4fb2b9||0xc8;return function(_0x470f7b){if(_0x470f7b){return _0x58fb3f[_0x5742('0x16')](_0x4fb2b9)['json'](_0x470f7b);}};}function respondWithFilteredResult(_0x364961,_0x45c91a){return function(_0x4169a8){if(_0x4169a8){var _0x324c65=_0x4169a8[_0x5742('0x17')],_0x47fec2=_0x45c91a[_0x5742('0x18')],_0x4ae50b=_0x45c91a[_0x5742('0x18')]+_0x45c91a[_0x5742('0x19')],_0x35d084;if(_0x4ae50b>=_0x324c65){_0x4ae50b=_0x324c65;_0x35d084=0xc8;}else{_0x35d084=0xce;}_0x364961[_0x5742('0x16')](_0x35d084);return _0x364961[_0x5742('0x1a')](_0x5742('0x1b'),_0x47fec2+'-'+_0x4ae50b+'/'+_0x324c65)['json'](_0x4169a8);}return null;};}function patchUpdates(_0x1e9386){return function(_0xe5ba1b){try{jsonpatch['apply'](_0xe5ba1b,_0x1e9386,!![]);}catch(_0x6da2f6){return BPromise[_0x5742('0x1c')](_0x6da2f6);}return _0xe5ba1b['save']();};}function saveUpdates(_0x3d8f04,_0xd59498){return function(_0x2f6021){if(_0x2f6021){return _0x2f6021['update'](_0x3d8f04)[_0x5742('0x1d')](function(_0x1ba65d){return _0x1ba65d;});}return null;};}function removeEntity(_0xc2eb45,_0x426016){return function(_0x12987a){if(_0x12987a){return _0x12987a['destroy']()[_0x5742('0x1d')](function(){var _0xb14e5b=_0x12987a['get']({'plain':!![]});var _0x30f0dc=_0x5742('0x1e');return db['UserProfileResource']['destroy']({'where':{'type':_0x30f0dc,'resourceId':_0xb14e5b['id']}})['then'](function(){return _0x12987a;});})['then'](function(){_0xc2eb45['status'](0xcc)[_0x5742('0x15')]();});}};}function handleEntityNotFound(_0x1a77c3,_0x45624f){return function(_0x2706db){if(!_0x2706db){_0x1a77c3[_0x5742('0x14')](0x194);}return _0x2706db;};}function handleError(_0x6166f0,_0x28a693){_0x28a693=_0x28a693||0x1f4;return function(_0x2f4242){logger[_0x5742('0x1f')](_0x2f4242['stack']);if(_0x2f4242[_0x5742('0x20')]){delete _0x2f4242[_0x5742('0x20')];}_0x6166f0[_0x5742('0x16')](_0x28a693)['send'](_0x2f4242);};}exports[_0x5742('0x21')]=function(_0x345128,_0x515c56){var _0x1f0628={},_0x3eff6e={},_0x253c06={'count':0x0,'rows':[]};var _0x5a591a=_['map'](db[_0x5742('0x22')][_0x5742('0x23')],function(_0x22f8c1){return{'name':_0x22f8c1[_0x5742('0x24')],'type':_0x22f8c1['type'][_0x5742('0x25')]};});_0x3eff6e[_0x5742('0x26')]=_[_0x5742('0x27')](_0x5a591a,_0x5742('0x20'));_0x3eff6e[_0x5742('0x28')]=_['keys'](_0x345128['query']);_0x3eff6e[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x3eff6e[_0x5742('0x26')],_0x3eff6e[_0x5742('0x28')]);_0x1f0628[_0x5742('0x2b')]=_[_0x5742('0x2a')](_0x3eff6e['model'],qs[_0x5742('0x2c')](_0x345128[_0x5742('0x28')][_0x5742('0x2c')]));_0x1f0628[_0x5742('0x2b')]=_0x1f0628[_0x5742('0x2b')]['length']?_0x1f0628[_0x5742('0x2b')]:_0x3eff6e[_0x5742('0x26')];if(!_0x345128[_0x5742('0x28')][_0x5742('0x2d')](_0x5742('0x2e'))){_0x1f0628[_0x5742('0x19')]=qs[_0x5742('0x19')](_0x345128[_0x5742('0x28')][_0x5742('0x19')]);_0x1f0628['offset']=qs['offset'](_0x345128[_0x5742('0x28')]['offset']);}_0x1f0628[_0x5742('0x2f')]=qs[_0x5742('0x30')](_0x345128[_0x5742('0x28')]['sort']);_0x1f0628[_0x5742('0x31')]=qs[_0x5742('0x29')](_['pick'](_0x345128[_0x5742('0x28')],_0x3eff6e[_0x5742('0x29')]),_0x5a591a);if(_0x345128[_0x5742('0x28')][_0x5742('0x32')]){_0x1f0628[_0x5742('0x31')]=_['merge'](_0x1f0628[_0x5742('0x31')],{'$or':_['map'](_0x5a591a,function(_0x590aeb){if(_0x590aeb['type']!=='VIRTUAL'){var _0x5ac1f0={};_0x5ac1f0[_0x590aeb[_0x5742('0x20')]]={'$like':'%'+_0x345128[_0x5742('0x28')][_0x5742('0x32')]+'%'};return _0x5ac1f0;}})});}_0x1f0628=_[_0x5742('0x33')]({},_0x1f0628,_0x345128[_0x5742('0x34')]);var _0x497779={'where':_0x1f0628[_0x5742('0x31')]};return db[_0x5742('0x22')][_0x5742('0x17')](_0x497779)[_0x5742('0x1d')](function(_0xd23b73){_0x253c06['count']=_0xd23b73;if(_0x345128[_0x5742('0x28')][_0x5742('0x35')]){_0x1f0628['include']=[{'all':!![]}];}return db[_0x5742('0x22')]['findAll'](_0x1f0628);})[_0x5742('0x1d')](function(_0x580eb3){_0x253c06[_0x5742('0x36')]=_0x580eb3;return _0x253c06;})['then'](respondWithFilteredResult(_0x515c56,_0x1f0628))['catch'](handleError(_0x515c56,null));};exports[_0x5742('0x37')]=function(_0x232b72,_0x150a43){var _0xaa3316={'raw':![],'where':{'id':_0x232b72[_0x5742('0x38')]['id']}},_0x17872b={};_0x17872b[_0x5742('0x26')]=_[_0x5742('0x39')](db[_0x5742('0x22')]['rawAttributes']);_0x17872b[_0x5742('0x28')]=_['keys'](_0x232b72[_0x5742('0x28')]);_0x17872b[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x17872b['model'],_0x17872b[_0x5742('0x28')]);_0xaa3316['attributes']=_[_0x5742('0x2a')](_0x17872b[_0x5742('0x26')],qs[_0x5742('0x2c')](_0x232b72['query']['fields']));_0xaa3316[_0x5742('0x2b')]=_0xaa3316['attributes']['length']?_0xaa3316[_0x5742('0x2b')]:_0x17872b[_0x5742('0x26')];if(_0x232b72[_0x5742('0x28')][_0x5742('0x35')]){_0xaa3316[_0x5742('0x3a')]=[{'all':!![]}];}_0xaa3316=_['merge']({},_0xaa3316,_0x232b72[_0x5742('0x34')]);return db[_0x5742('0x22')][_0x5742('0x3b')](_0xaa3316)[_0x5742('0x1d')](handleEntityNotFound(_0x150a43,null))[_0x5742('0x1d')](respondWithResult(_0x150a43,null))[_0x5742('0x3c')](handleError(_0x150a43,null));};exports[_0x5742('0x3d')]=function(_0x3802c6,_0x557bc9){return db[_0x5742('0x22')][_0x5742('0x3d')](_0x3802c6[_0x5742('0x3e')],{})[_0x5742('0x1d')](function(_0x4f36cf){var _0x501102=_0x3802c6['user'][_0x5742('0x3f')]({'plain':!![]});if(!_0x501102)throw new Error(_0x5742('0x40'));if(_0x501102['role']===_0x5742('0x41')){var _0x2a2274=_0x4f36cf['get']({'plain':!![]});var _0x40319c=_0x5742('0x1e');return db['UserProfileSection'][_0x5742('0x3b')]({'where':{'name':_0x40319c,'userProfileId':_0x501102['userProfileId']},'raw':!![]})[_0x5742('0x1d')](function(_0x2ea989){if(_0x2ea989&&_0x2ea989['autoAssociation']===0x0){return db['UserProfileResource'][_0x5742('0x3d')]({'name':_0x2a2274['name'],'resourceId':_0x2a2274['id'],'type':_0x2ea989[_0x5742('0x20')],'sectionId':_0x2ea989['id']},{})[_0x5742('0x1d')](function(){return _0x4f36cf;});}else{return _0x4f36cf;}})[_0x5742('0x3c')](function(_0x2e6f6d){logger['error'](_0x5742('0x42'),_0x2e6f6d);throw _0x2e6f6d;});}return _0x4f36cf;})[_0x5742('0x1d')](respondWithResult(_0x557bc9,0xc9))[_0x5742('0x3c')](handleError(_0x557bc9,null));};exports[_0x5742('0x43')]=function(_0x3e44e5,_0x53562a){var _0x473680={'where':{'id':_0x3e44e5[_0x5742('0x38')]['id']}},_0x1f9102={};_0x1f9102['model']=_[_0x5742('0x39')](db['JscriptyProject'][_0x5742('0x23')]);_0x473680[_0x5742('0x2b')]=_[_0x5742('0x2a')](_0x1f9102[_0x5742('0x26')],qs['fields'](_0x3e44e5[_0x5742('0x28')]['fields']));_0x473680[_0x5742('0x2b')]=_0x473680['attributes'][_0x5742('0x44')]?_0x473680[_0x5742('0x2b')]:_0x1f9102[_0x5742('0x26')];if(_0x3e44e5[_0x5742('0x28')][_0x5742('0x35')]){_0x473680[_0x5742('0x3a')]=[{'all':!![]}];}_0x473680=_[_0x5742('0x33')]({},_0x473680,_0x3e44e5[_0x5742('0x34')]);return db[_0x5742('0x22')][_0x5742('0x3b')](_0x473680)[_0x5742('0x1d')](handleEntityNotFound(_0x53562a,null))[_0x5742('0x1d')](function(_0x46809c){if(_0x46809c){var _0xa749a2=_0x46809c[_0x5742('0x3f')]({'plain':!![]});_0xa749a2=qs[_0x5742('0x45')](_0xa749a2,['id','createdAt',_0x5742('0x46')]);_0x3e44e5['body']=_[_0x5742('0x45')](_0x3e44e5[_0x5742('0x3e')],['id',_0x5742('0x47'),'updatedAt']);return db['JscriptyProject'][_0x5742('0x3d')](_['merge'](_0xa749a2,_0x3e44e5[_0x5742('0x3e')]),{'include':_0x3e44e5[_0x5742('0x28')][_0x5742('0x35')]?[{'all':!![]}]:undefined})[_0x5742('0x1d')](function(_0x5be315){var _0x2cf7ec=_0x3e44e5[_0x5742('0x41')][_0x5742('0x3f')]({'plain':!![]});if(!_0x2cf7ec)throw new Error(_0x5742('0x40'));if(_0x2cf7ec[_0x5742('0x48')]===_0x5742('0x41')){var _0x5493db=_0x5be315[_0x5742('0x3f')]({'plain':!![]});var _0x16f078=_0x5742('0x1e');return db[_0x5742('0x49')][_0x5742('0x3b')]({'where':{'name':_0x16f078,'userProfileId':_0x2cf7ec['userProfileId']},'raw':!![]})[_0x5742('0x1d')](function(_0x1a956f){if(_0x1a956f&&_0x1a956f[_0x5742('0x4a')]===0x0){return db[_0x5742('0x4b')][_0x5742('0x3d')]({'name':_0x5493db['name'],'resourceId':_0x5493db['id'],'type':_0x1a956f['name'],'sectionId':_0x1a956f['id']},{})[_0x5742('0x1d')](function(){return _0x5be315;});}else{return _0x5be315;}})[_0x5742('0x3c')](function(_0xad54b){logger[_0x5742('0x1f')](_0x5742('0x42'),_0xad54b);throw _0xad54b;});}return _0x5be315;});}})[_0x5742('0x1d')](respondWithResult(_0x53562a,0xc9))[_0x5742('0x3c')](handleError(_0x53562a,null));};exports['update']=function(_0x1d1032,_0x340e40){if(_0x1d1032[_0x5742('0x3e')]['id']){delete _0x1d1032[_0x5742('0x3e')]['id'];}return db['JscriptyProject'][_0x5742('0x3b')]({'where':{'id':_0x1d1032['params']['id']}})[_0x5742('0x1d')](handleEntityNotFound(_0x340e40,null))[_0x5742('0x1d')](saveUpdates(_0x1d1032['body'],null))['then'](respondWithResult(_0x340e40,null))[_0x5742('0x3c')](handleError(_0x340e40,null));};exports[_0x5742('0x4c')]=function(_0x3d4692,_0x39cc4a){return db[_0x5742('0x22')]['find']({'where':{'id':_0x3d4692['params']['id']}})['then'](handleEntityNotFound(_0x39cc4a,null))[_0x5742('0x1d')](removeEntity(_0x39cc4a,null))['catch'](handleError(_0x39cc4a,null));};exports[_0x5742('0x4d')]=function(_0x421550,_0x1fe9bb,_0x4fb2e8){var _0x4e02de={'raw':!![],'where':{}};var _0x2acd9e={};var _0x4f93b7={'count':0x0,'rows':[]};return db[_0x5742('0x22')][_0x5742('0x4e')]({'where':{'id':_0x421550[_0x5742('0x38')]['id']}})[_0x5742('0x1d')](handleEntityNotFound(_0x1fe9bb,null))[_0x5742('0x1d')](function(_0xd7e7f1){if(_0xd7e7f1){_0x2acd9e['model']=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x2acd9e[_0x5742('0x28')]=_[_0x5742('0x39')](_0x421550[_0x5742('0x28')]);_0x2acd9e[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x2acd9e[_0x5742('0x26')],_0x2acd9e[_0x5742('0x28')]);_0x4e02de[_0x5742('0x2b')]=_[_0x5742('0x2a')](_0x2acd9e['model'],qs[_0x5742('0x2c')](_0x421550[_0x5742('0x28')][_0x5742('0x2c')]));_0x4e02de[_0x5742('0x2b')]=_0x4e02de[_0x5742('0x2b')][_0x5742('0x44')]?_0x4e02de[_0x5742('0x2b')]:_0x2acd9e[_0x5742('0x26')];if(!_0x421550[_0x5742('0x28')][_0x5742('0x2d')](_0x5742('0x2e'))){_0x4e02de[_0x5742('0x19')]=qs[_0x5742('0x19')](_0x421550[_0x5742('0x28')][_0x5742('0x19')]);_0x4e02de['offset']=qs[_0x5742('0x18')](_0x421550[_0x5742('0x28')][_0x5742('0x18')]);}_0x4e02de[_0x5742('0x2f')]=qs[_0x5742('0x30')](_0x421550[_0x5742('0x28')][_0x5742('0x30')]);_0x4e02de[_0x5742('0x31')]=qs[_0x5742('0x29')](_['pick'](_0x421550[_0x5742('0x28')],_0x2acd9e['filters']));_0x4e02de[_0x5742('0x31')]['ProjectId']=_0xd7e7f1['id'];if(_0x421550['query'][_0x5742('0x32')]){_0x4e02de[_0x5742('0x31')]=_[_0x5742('0x33')](_0x4e02de[_0x5742('0x31')],{'$or':_[_0x5742('0x27')](_0x4e02de[_0x5742('0x2b')],function(_0x51f578){var _0x5afba5={};_0x5afba5[_0x51f578]={'$like':'%'+_0x421550[_0x5742('0x28')][_0x5742('0x32')]+'%'};return _0x5afba5;})});}_0x4e02de=_[_0x5742('0x33')]({},_0x4e02de,_0x421550['options']);return db[_0x5742('0x4f')][_0x5742('0x17')]({'where':_0x4e02de['where']})[_0x5742('0x1d')](function(_0x487763){_0x4f93b7['count']=_0x487763;if(_0x421550[_0x5742('0x28')][_0x5742('0x35')]){_0x4e02de[_0x5742('0x3a')]=[{'all':!![]}];}return db[_0x5742('0x4f')]['findAll'](_0x4e02de);})[_0x5742('0x1d')](function(_0x4d4d87){_0x4f93b7[_0x5742('0x36')]=_0x4d4d87;return _0x4f93b7;});}})['then'](respondWithFilteredResult(_0x1fe9bb,_0x4e02de))[_0x5742('0x3c')](handleError(_0x1fe9bb,null));};exports[_0x5742('0x50')]=function(_0xd034a4,_0x55e57c,_0xddd8f1){var _0x4b6eb2={'raw':!![],'where':{}};var _0x5d8407={};var _0x430956={'count':0x0,'rows':[]};return db[_0x5742('0x22')][_0x5742('0x4e')]({'where':{'id':_0xd034a4[_0x5742('0x38')]['id']}})[_0x5742('0x1d')](handleEntityNotFound(_0x55e57c,null))[_0x5742('0x1d')](function(_0x3f0c11){if(_0x3f0c11){_0x5d8407['model']=_[_0x5742('0x39')](db['JscriptyAnswerReport'][_0x5742('0x23')]);_0x5d8407[_0x5742('0x28')]=_[_0x5742('0x39')](_0xd034a4[_0x5742('0x28')]);_0x5d8407[_0x5742('0x29')]=_[_0x5742('0x2a')](_0x5d8407[_0x5742('0x26')],_0x5d8407[_0x5742('0x28')]);_0x4b6eb2['attributes']=_['intersection'](_0x5d8407[_0x5742('0x26')],qs[_0x5742('0x2c')](_0xd034a4[_0x5742('0x28')][_0x5742('0x2c')]));_0x4b6eb2[_0x5742('0x2b')]=_0x4b6eb2[_0x5742('0x2b')][_0x5742('0x44')]?_0x4b6eb2[_0x5742('0x2b')]:_0x5d8407['model'];if(!_0xd034a4[_0x5742('0x28')][_0x5742('0x2d')](_0x5742('0x2e'))){_0x4b6eb2[_0x5742('0x19')]=qs[_0x5742('0x19')](_0xd034a4[_0x5742('0x28')][_0x5742('0x19')]);_0x4b6eb2['offset']=qs['offset'](_0xd034a4[_0x5742('0x28')][_0x5742('0x18')]);}_0x4b6eb2[_0x5742('0x2f')]=qs[_0x5742('0x30')](_0xd034a4[_0x5742('0x28')][_0x5742('0x30')]);_0x4b6eb2[_0x5742('0x31')]=qs[_0x5742('0x29')](_[_0x5742('0x51')](_0xd034a4[_0x5742('0x28')],_0x5d8407['filters']));_0x4b6eb2[_0x5742('0x31')]['ProjectId']=_0x3f0c11['id'];if(_0xd034a4[_0x5742('0x28')][_0x5742('0x32')]){_0x4b6eb2['where']=_['merge'](_0x4b6eb2[_0x5742('0x31')],{'$or':_[_0x5742('0x27')](_0x4b6eb2[_0x5742('0x2b')],function(_0x4b06af){var _0x27cc5d={};_0x27cc5d[_0x4b06af]={'$like':'%'+_0xd034a4[_0x5742('0x28')]['filter']+'%'};return _0x27cc5d;})});}_0x4b6eb2=_[_0x5742('0x33')]({},_0x4b6eb2,_0xd034a4['options']);return db[_0x5742('0x52')][_0x5742('0x17')]({'where':_0x4b6eb2[_0x5742('0x31')]})[_0x5742('0x1d')](function(_0x206c12){_0x430956[_0x5742('0x17')]=_0x206c12;if(_0xd034a4[_0x5742('0x28')][_0x5742('0x35')]){_0x4b6eb2[_0x5742('0x3a')]=[{'all':!![]}];}return db[_0x5742('0x52')][_0x5742('0x53')](_0x4b6eb2);})[_0x5742('0x1d')](function(_0x36e072){_0x430956[_0x5742('0x36')]=_0x36e072;return _0x430956;});}})[_0x5742('0x1d')](respondWithFilteredResult(_0x55e57c,_0x4b6eb2))[_0x5742('0x3c')](handleError(_0x55e57c,null));};function char(_0x510504){return _0x5742('0x54')===typeof _0x510504?String[_0x5742('0x55')][_0x5742('0x56')](null,arguments):_0x510504;}function needsEncapsulation(_0x2ca362){return!!_0x2ca362&&(_0x2ca362['toString']()['indexOf'](char(0xd))>=0x0||_0x2ca362['toString']()[_0x5742('0x57')](char(0xa))>=0x0||_0x2ca362[_0x5742('0x58')]()[_0x5742('0x57')](char(0x2c))>=0x0||_0x2ca362[_0x5742('0x58')]()[_0x5742('0x57')](char(0x22))>=0x0);}function encapsulate(_0x10ba4d){var _0xce20b3=char(0x22),_0x3f58a0='\x5c'+char(0x22),_0x440939=_0x10ba4d[_0x5742('0x58')]()['replace'](new RegExp(_0xce20b3,'g'),_0x3f58a0);return _0xce20b3+_0x440939+_0xce20b3;}exports[_0x5742('0x59')]=function(_0x4a3b3a,_0x3a5f1d,_0x3ba2d0){var _0x1cdfe9,_0x46af58;var _0xe2cd5f={'where':{'ProjectId':_0x4a3b3a['params']['id']}};if(_0x4a3b3a[_0x5742('0x28')]['startTime']){_0xe2cd5f[_0x5742('0x31')][_0x5742('0x5a')]=JSON[_0x5742('0x5b')](_0x4a3b3a[_0x5742('0x28')]['startTime']);}return db[_0x5742('0x4f')][_0x5742('0x53')](_0xe2cd5f)[_0x5742('0x1d')](handleEntityNotFound(_0x3a5f1d,null))[_0x5742('0x1d')](function(_0x3c9690){if(_0x3c9690){_0x1cdfe9=_0x3c9690;return db[_0x5742('0x5c')][_0x5742('0x53')]({'where':{'SessionId':{'$in':_['map'](_0x1cdfe9,'id')},'ProjectId':_0x4a3b3a[_0x5742('0x38')]['id']},'order':_0x5742('0x5d')});}})[_0x5742('0x1d')](handleEntityNotFound(_0x3a5f1d,null))[_0x5742('0x1d')](function(_0x2ed6be){if(_0x2ed6be){_0x46af58=_0x2ed6be;var _0x22f928={};for(var _0x1e6724=0x0,_0x489456=_0x46af58[_0x5742('0x44')];_0x1e6724<_0x489456;_0x1e6724++){if(!_0x22f928[_0x5742('0x2d')](_0x46af58[_0x1e6724][_0x5742('0x5e')])){_0x22f928[_0x46af58[_0x1e6724]['questionId']]=needsEncapsulation(_0x46af58[_0x1e6724][_0x5742('0x5f')])?encapsulate(_0x46af58[_0x1e6724][_0x5742('0x5f')]):_0x46af58[_0x1e6724]['question'];}}var _0x2b4979=[],_0x577cda={};for(var _0xf4eedb=0x0,_0x38af80=_0x1cdfe9[_0x5742('0x44')];_0xf4eedb<_0x38af80;_0xf4eedb++){_0x577cda={'ProjectId':_0x4a3b3a[_0x5742('0x38')]['id'],'SessionId':_0x1cdfe9[_0xf4eedb]['id'],'StartTime':moment(_0x1cdfe9[_0xf4eedb][_0x5742('0x5a')])[_0x5742('0x60')](_0x5742('0x61'))};for(var _0x3ae190=0x0,_0x47366e=_0x46af58[_0x5742('0x44')];_0x3ae190<_0x47366e;_0x3ae190++){if(_0x46af58[_0x3ae190][_0x5742('0x62')]==_0x1cdfe9[_0xf4eedb]['id']&&_0x22f928[_0x5742('0x2d')](_0x46af58[_0x3ae190]['questionId'])){_0x577cda[_0x22f928[_0x46af58[_0x3ae190]['questionId']]]=_0x46af58[_0x3ae190][_0x5742('0x63')];}}for(var _0x2f95de in _0x22f928){if(!_0x577cda[_0x5742('0x2d')](_0x22f928[_0x2f95de])){_0x577cda[_0x22f928[_0x2f95de]]=null;}}_0x2b4979[_0x5742('0x64')](_0x577cda);}return _0x2b4979;}})['then'](function(_0x459893){if(!_[_0x5742('0x65')](_0x459893)){var _0x1ee878=toCsv(_0x459893);var _0x78678e=Date[_0x5742('0x66')]();fs[_0x5742('0x67')](util[_0x5742('0x60')](_0x5742('0x68'),_0x4a3b3a[_0x5742('0x38')]['id'],_0x78678e),_0x1ee878);_0x3a5f1d[_0x5742('0x69')](_0x5742('0x6a'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x4a3b3a[_0x5742('0x38')]['id'],_0x78678e));_0x3a5f1d[_0x5742('0x69')]('Content-type',_0x5742('0x6b'));return _0x3a5f1d['download'](util[_0x5742('0x60')](_0x5742('0x68'),_0x4a3b3a[_0x5742('0x38')]['id'],_0x78678e));}else{return _0x3a5f1d['sendStatus'](0xcc);}})[_0x5742('0x3c')](handleError(_0x3a5f1d,null));}; \ No newline at end of file +var _0xdcec=['question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','UserProfileResource','error','name','index','JscriptyProject','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','clone','get','omit','updatedAt','role','Projects','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','ProjectId','nolimit','JscriptyAnswerReport','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId'];(function(_0x313125,_0x5126c5){var _0x586825=function(_0x383685){while(--_0x383685){_0x313125['push'](_0x313125['shift']());}};_0x586825(++_0x5126c5);}(_0xdcec,0x87));var _0xcdce=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xdcec[_0x2f4c1c];return _0x25e0f2;};'use strict';var pdf=require(_0xcdce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcdce('0x1'));var zipdir=require(_0xcdce('0x2'));var jsonpatch=require(_0xcdce('0x3'));var rp=require(_0xcdce('0x4'));var moment=require(_0xcdce('0x5'));var BPromise=require(_0xcdce('0x6'));var Mustache=require(_0xcdce('0x7'));var util=require(_0xcdce('0x8'));var path=require(_0xcdce('0x9'));var sox=require(_0xcdce('0xa'));var csv=require('to-csv');var ejs=require(_0xcdce('0xb'));var fs=require('fs');var _=require(_0xcdce('0xc'));var squel=require('squel');var crypto=require(_0xcdce('0xd'));var jsforce=require(_0xcdce('0xe'));var deskjs=require(_0xcdce('0xf'));var toCsv=require(_0xcdce('0x10'));var querystring=require(_0xcdce('0x11'));var Papa=require('papaparse');var Redis=require(_0xcdce('0x12'));var authService=require(_0xcdce('0x13'));var qs=require(_0xcdce('0x14'));var as=require(_0xcdce('0x15'));var hardwareService=require(_0xcdce('0x16'));var logger=require(_0xcdce('0x17'))(_0xcdce('0x18'));var utils=require(_0xcdce('0x19'));var config=require(_0xcdce('0x1a'));var licenseUtil=require(_0xcdce('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559ee7,_0xda6e42){_0xda6e42=_0xda6e42||0xcc;return function(_0x18adb1){if(_0x18adb1){return _0x559ee7[_0xcdce('0x1c')](_0xda6e42);}return _0x559ee7[_0xcdce('0x1d')](_0xda6e42)['end']();};}function respondWithResult(_0x20f68b,_0x2c5cbf){_0x2c5cbf=_0x2c5cbf||0xc8;return function(_0x590cd0){if(_0x590cd0){return _0x20f68b[_0xcdce('0x1d')](_0x2c5cbf)['json'](_0x590cd0);}};}function respondWithFilteredResult(_0x4f0dd6,_0x52504c){return function(_0x39bfb9){if(_0x39bfb9){var _0x28faf5=_0x39bfb9[_0xcdce('0x1e')],_0x13f5de=_0x52504c[_0xcdce('0x1f')],_0x1e9a88=_0x52504c[_0xcdce('0x1f')]+_0x52504c[_0xcdce('0x20')],_0x3888b9;if(_0x1e9a88>=_0x28faf5){_0x1e9a88=_0x28faf5;_0x3888b9=0xc8;}else{_0x3888b9=0xce;}_0x4f0dd6[_0xcdce('0x1d')](_0x3888b9);return _0x4f0dd6[_0xcdce('0x21')](_0xcdce('0x22'),_0x13f5de+'-'+_0x1e9a88+'/'+_0x28faf5)[_0xcdce('0x23')](_0x39bfb9);}return null;};}function patchUpdates(_0x5f59bc){return function(_0x58e373){try{jsonpatch['apply'](_0x58e373,_0x5f59bc,!![]);}catch(_0x439458){return BPromise[_0xcdce('0x24')](_0x439458);}return _0x58e373[_0xcdce('0x25')]();};}function saveUpdates(_0x5f4377,_0x4d095f){return function(_0x1775ef){if(_0x1775ef){return _0x1775ef['update'](_0x5f4377)[_0xcdce('0x26')](function(_0x57753e){return _0x57753e;});}return null;};}function removeEntity(_0x3c5af8,_0x39e2bd){return function(_0xa75014){if(_0xa75014){return _0xa75014[_0xcdce('0x27')]()[_0xcdce('0x26')](function(){var _0x38842d=_0xa75014['get']({'plain':!![]});var _0x2a6103='Projects';return db[_0xcdce('0x28')][_0xcdce('0x27')]({'where':{'type':_0x2a6103,'resourceId':_0x38842d['id']}})[_0xcdce('0x26')](function(){return _0xa75014;});})[_0xcdce('0x26')](function(){_0x3c5af8[_0xcdce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cdcf0,_0x29b490){return function(_0x7d003f){if(!_0x7d003f){_0x4cdcf0['sendStatus'](0x194);}return _0x7d003f;};}function handleError(_0x5b2220,_0x31f14d){_0x31f14d=_0x31f14d||0x1f4;return function(_0x3b4f99){logger[_0xcdce('0x29')](_0x3b4f99['stack']);if(_0x3b4f99[_0xcdce('0x2a')]){delete _0x3b4f99[_0xcdce('0x2a')];}_0x5b2220[_0xcdce('0x1d')](_0x31f14d)['send'](_0x3b4f99);};}exports[_0xcdce('0x2b')]=function(_0x291dff,_0x2db6d3){var _0x126642={},_0x329172={},_0x5d7589={'count':0x0,'rows':[]};var _0x29c7d3=_['map'](db[_0xcdce('0x2c')][_0xcdce('0x2d')],function(_0x3a1375){return{'name':_0x3a1375[_0xcdce('0x2e')],'type':_0x3a1375['type'][_0xcdce('0x2f')]};});_0x329172[_0xcdce('0x30')]=_[_0xcdce('0x31')](_0x29c7d3,_0xcdce('0x2a'));_0x329172['query']=_[_0xcdce('0x32')](_0x291dff[_0xcdce('0x33')]);_0x329172[_0xcdce('0x34')]=_[_0xcdce('0x35')](_0x329172[_0xcdce('0x30')],_0x329172[_0xcdce('0x33')]);_0x126642[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x329172[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x291dff[_0xcdce('0x33')][_0xcdce('0x37')]));_0x126642[_0xcdce('0x36')]=_0x126642[_0xcdce('0x36')]['length']?_0x126642[_0xcdce('0x36')]:_0x329172['model'];if(!_0x291dff[_0xcdce('0x33')][_0xcdce('0x38')]('nolimit')){_0x126642[_0xcdce('0x20')]=qs[_0xcdce('0x20')](_0x291dff[_0xcdce('0x33')][_0xcdce('0x20')]);_0x126642[_0xcdce('0x1f')]=qs[_0xcdce('0x1f')](_0x291dff[_0xcdce('0x33')]['offset']);}_0x126642[_0xcdce('0x39')]=qs['sort'](_0x291dff[_0xcdce('0x33')][_0xcdce('0x3a')]);_0x126642[_0xcdce('0x3b')]=qs['filters'](_[_0xcdce('0x3c')](_0x291dff[_0xcdce('0x33')],_0x329172[_0xcdce('0x34')]),_0x29c7d3);if(_0x291dff['query'][_0xcdce('0x3d')]){_0x126642['where']=_['merge'](_0x126642[_0xcdce('0x3b')],{'$or':_[_0xcdce('0x31')](_0x29c7d3,function(_0x52c49c){if(_0x52c49c[_0xcdce('0x3e')]!==_0xcdce('0x3f')){var _0x165cdb={};_0x165cdb[_0x52c49c[_0xcdce('0x2a')]]={'$like':'%'+_0x291dff['query'][_0xcdce('0x3d')]+'%'};return _0x165cdb;}})});}_0x126642=_[_0xcdce('0x40')]({},_0x126642,_0x291dff[_0xcdce('0x41')]);var _0x48b72c={'where':_0x126642[_0xcdce('0x3b')]};return db[_0xcdce('0x2c')][_0xcdce('0x1e')](_0x48b72c)[_0xcdce('0x26')](function(_0x45068a){_0x5d7589[_0xcdce('0x1e')]=_0x45068a;if(_0x291dff[_0xcdce('0x33')]['includeAll']){_0x126642[_0xcdce('0x42')]=[{'all':!![]}];}return db[_0xcdce('0x2c')][_0xcdce('0x43')](_0x126642);})['then'](function(_0x36e4f1){_0x5d7589[_0xcdce('0x44')]=_0x36e4f1;return _0x5d7589;})[_0xcdce('0x26')](respondWithFilteredResult(_0x2db6d3,_0x126642))[_0xcdce('0x45')](handleError(_0x2db6d3,null));};exports[_0xcdce('0x46')]=function(_0x59b618,_0x3bbd09){var _0x421aee={'raw':![],'where':{'id':_0x59b618[_0xcdce('0x47')]['id']}},_0x3f20bb={};_0x3f20bb['model']=_[_0xcdce('0x32')](db[_0xcdce('0x2c')][_0xcdce('0x2d')]);_0x3f20bb[_0xcdce('0x33')]=_[_0xcdce('0x32')](_0x59b618[_0xcdce('0x33')]);_0x3f20bb['filters']=_['intersection'](_0x3f20bb[_0xcdce('0x30')],_0x3f20bb['query']);_0x421aee[_0xcdce('0x36')]=_['intersection'](_0x3f20bb[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x59b618[_0xcdce('0x33')][_0xcdce('0x37')]));_0x421aee[_0xcdce('0x36')]=_0x421aee[_0xcdce('0x36')][_0xcdce('0x48')]?_0x421aee[_0xcdce('0x36')]:_0x3f20bb[_0xcdce('0x30')];if(_0x59b618['query'][_0xcdce('0x49')]){_0x421aee[_0xcdce('0x42')]=[{'all':!![]}];}_0x421aee=_[_0xcdce('0x40')]({},_0x421aee,_0x59b618[_0xcdce('0x41')]);return db[_0xcdce('0x2c')][_0xcdce('0x4a')](_0x421aee)[_0xcdce('0x26')](handleEntityNotFound(_0x3bbd09,null))[_0xcdce('0x26')](respondWithResult(_0x3bbd09,null))['catch'](handleError(_0x3bbd09,null));};exports[_0xcdce('0x4b')]=function(_0x3d07dc,_0x3a418e){return db[_0xcdce('0x2c')][_0xcdce('0x4b')](_0x3d07dc[_0xcdce('0x4c')],{})[_0xcdce('0x26')](function(_0x2574ea){var _0x56550f=_0x3d07dc[_0xcdce('0x4d')]['get']({'plain':!![]});if(!_0x56550f)throw new Error(_0xcdce('0x4e'));if(_0x56550f['role']===_0xcdce('0x4d')){var _0x18e6c8=_0x2574ea['get']({'plain':!![]});var _0x539308='Projects';return db[_0xcdce('0x4f')]['find']({'where':{'name':_0x539308,'userProfileId':_0x56550f[_0xcdce('0x50')]},'raw':!![]})['then'](function(_0x226377){if(_0x226377&&_0x226377['autoAssociation']===0x0){return db[_0xcdce('0x28')][_0xcdce('0x4b')]({'name':_0x18e6c8[_0xcdce('0x2a')],'resourceId':_0x18e6c8['id'],'type':_0x226377[_0xcdce('0x2a')],'sectionId':_0x226377['id']},{})[_0xcdce('0x26')](function(){return _0x2574ea;});}else{return _0x2574ea;}})['catch'](function(_0x5ca243){logger[_0xcdce('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ca243);throw _0x5ca243;});}return _0x2574ea;})[_0xcdce('0x26')](respondWithResult(_0x3a418e,0xc9))[_0xcdce('0x45')](handleError(_0x3a418e,null));};exports[_0xcdce('0x51')]=function(_0x36cda8,_0x3f630e){var _0x5e2bf4={'where':{'id':_0x36cda8[_0xcdce('0x47')]['id']}},_0x3a5924={};_0x3a5924['model']=_[_0xcdce('0x32')](db[_0xcdce('0x2c')][_0xcdce('0x2d')]);_0x5e2bf4[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x3a5924[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x36cda8[_0xcdce('0x33')]['fields']));_0x5e2bf4[_0xcdce('0x36')]=_0x5e2bf4[_0xcdce('0x36')][_0xcdce('0x48')]?_0x5e2bf4[_0xcdce('0x36')]:_0x3a5924['model'];if(_0x36cda8[_0xcdce('0x33')][_0xcdce('0x49')]){_0x5e2bf4['include']=[{'all':!![]}];}_0x5e2bf4=_[_0xcdce('0x40')]({},_0x5e2bf4,_0x36cda8[_0xcdce('0x41')]);return db[_0xcdce('0x2c')][_0xcdce('0x4a')](_0x5e2bf4)[_0xcdce('0x26')](handleEntityNotFound(_0x3f630e,null))['then'](function(_0x2cf89a){if(_0x2cf89a){var _0x2a9a78=_0x2cf89a[_0xcdce('0x52')]({'plain':!![]});_0x2a9a78=qs[_0xcdce('0x53')](_0x2a9a78,['id','createdAt','updatedAt']);_0x36cda8[_0xcdce('0x4c')]=_[_0xcdce('0x53')](_0x36cda8[_0xcdce('0x4c')],['id','createdAt',_0xcdce('0x54')]);return db['JscriptyProject'][_0xcdce('0x4b')](_[_0xcdce('0x40')](_0x2a9a78,_0x36cda8[_0xcdce('0x4c')]),{'include':_0x36cda8[_0xcdce('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xcdce('0x26')](function(_0x241f33){var _0x3f8932=_0x36cda8[_0xcdce('0x4d')][_0xcdce('0x52')]({'plain':!![]});if(!_0x3f8932)throw new Error(_0xcdce('0x4e'));if(_0x3f8932[_0xcdce('0x55')]===_0xcdce('0x4d')){var _0x6fd841=_0x241f33[_0xcdce('0x52')]({'plain':!![]});var _0x262dfa=_0xcdce('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x262dfa,'userProfileId':_0x3f8932[_0xcdce('0x50')]},'raw':!![]})[_0xcdce('0x26')](function(_0x13ff48){if(_0x13ff48&&_0x13ff48[_0xcdce('0x57')]===0x0){return db[_0xcdce('0x28')]['create']({'name':_0x6fd841[_0xcdce('0x2a')],'resourceId':_0x6fd841['id'],'type':_0x13ff48[_0xcdce('0x2a')],'sectionId':_0x13ff48['id']},{})[_0xcdce('0x26')](function(){return _0x241f33;});}else{return _0x241f33;}})['catch'](function(_0x454ed2){logger[_0xcdce('0x29')](_0xcdce('0x58'),_0x454ed2);throw _0x454ed2;});}return _0x241f33;});}})['then'](respondWithResult(_0x3f630e,0xc9))[_0xcdce('0x45')](handleError(_0x3f630e,null));};exports[_0xcdce('0x59')]=function(_0x26c8c7,_0x24bbd8){if(_0x26c8c7['body']['id']){delete _0x26c8c7['body']['id'];}return db[_0xcdce('0x2c')][_0xcdce('0x4a')]({'where':{'id':_0x26c8c7[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x24bbd8,null))[_0xcdce('0x26')](saveUpdates(_0x26c8c7['body'],null))[_0xcdce('0x26')](respondWithResult(_0x24bbd8,null))[_0xcdce('0x45')](handleError(_0x24bbd8,null));};exports[_0xcdce('0x27')]=function(_0x52eda2,_0x55535a){return db['JscriptyProject']['find']({'where':{'id':_0x52eda2[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x55535a,null))['then'](removeEntity(_0x55535a,null))[_0xcdce('0x45')](handleError(_0x55535a,null));};exports[_0xcdce('0x5a')]=function(_0x22442a,_0x3ec7af,_0x2e9c46){var _0x26e086={'raw':!![],'where':{}};var _0x117e60={};var _0x3e6fdc={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xcdce('0x5b')]({'where':{'id':_0x22442a[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x3ec7af,null))[_0xcdce('0x26')](function(_0x238fb2){if(_0x238fb2){_0x117e60[_0xcdce('0x30')]=_[_0xcdce('0x32')](db[_0xcdce('0x5c')][_0xcdce('0x2d')]);_0x117e60[_0xcdce('0x33')]=_[_0xcdce('0x32')](_0x22442a[_0xcdce('0x33')]);_0x117e60['filters']=_['intersection'](_0x117e60[_0xcdce('0x30')],_0x117e60['query']);_0x26e086[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x117e60[_0xcdce('0x30')],qs[_0xcdce('0x37')](_0x22442a[_0xcdce('0x33')][_0xcdce('0x37')]));_0x26e086[_0xcdce('0x36')]=_0x26e086[_0xcdce('0x36')][_0xcdce('0x48')]?_0x26e086['attributes']:_0x117e60[_0xcdce('0x30')];if(!_0x22442a[_0xcdce('0x33')][_0xcdce('0x38')]('nolimit')){_0x26e086[_0xcdce('0x20')]=qs[_0xcdce('0x20')](_0x22442a[_0xcdce('0x33')]['limit']);_0x26e086[_0xcdce('0x1f')]=qs[_0xcdce('0x1f')](_0x22442a['query'][_0xcdce('0x1f')]);}_0x26e086[_0xcdce('0x39')]=qs[_0xcdce('0x3a')](_0x22442a[_0xcdce('0x33')][_0xcdce('0x3a')]);_0x26e086[_0xcdce('0x3b')]=qs['filters'](_[_0xcdce('0x3c')](_0x22442a[_0xcdce('0x33')],_0x117e60[_0xcdce('0x34')]));_0x26e086[_0xcdce('0x3b')][_0xcdce('0x5d')]=_0x238fb2['id'];if(_0x22442a['query'][_0xcdce('0x3d')]){_0x26e086[_0xcdce('0x3b')]=_[_0xcdce('0x40')](_0x26e086['where'],{'$or':_[_0xcdce('0x31')](_0x26e086[_0xcdce('0x36')],function(_0x1fb64d){var _0x3f5c72={};_0x3f5c72[_0x1fb64d]={'$like':'%'+_0x22442a[_0xcdce('0x33')][_0xcdce('0x3d')]+'%'};return _0x3f5c72;})});}_0x26e086=_['merge']({},_0x26e086,_0x22442a[_0xcdce('0x41')]);return db[_0xcdce('0x5c')]['count']({'where':_0x26e086[_0xcdce('0x3b')]})[_0xcdce('0x26')](function(_0x566f8b){_0x3e6fdc[_0xcdce('0x1e')]=_0x566f8b;if(_0x22442a[_0xcdce('0x33')]['includeAll']){_0x26e086['include']=[{'all':!![]}];}return db[_0xcdce('0x5c')][_0xcdce('0x43')](_0x26e086);})[_0xcdce('0x26')](function(_0x3a1484){_0x3e6fdc['rows']=_0x3a1484;return _0x3e6fdc;});}})[_0xcdce('0x26')](respondWithFilteredResult(_0x3ec7af,_0x26e086))[_0xcdce('0x45')](handleError(_0x3ec7af,null));};exports['getAnswers']=function(_0x3d96b1,_0x1cc476,_0x23d1b6){var _0x25b92a={'raw':!![],'where':{}};var _0x57475b={};var _0x4350d9={'count':0x0,'rows':[]};return db[_0xcdce('0x2c')][_0xcdce('0x5b')]({'where':{'id':_0x3d96b1[_0xcdce('0x47')]['id']}})[_0xcdce('0x26')](handleEntityNotFound(_0x1cc476,null))[_0xcdce('0x26')](function(_0x238d2f){if(_0x238d2f){_0x57475b[_0xcdce('0x30')]=_[_0xcdce('0x32')](db['JscriptyAnswerReport']['rawAttributes']);_0x57475b[_0xcdce('0x33')]=_[_0xcdce('0x32')](_0x3d96b1['query']);_0x57475b[_0xcdce('0x34')]=_[_0xcdce('0x35')](_0x57475b[_0xcdce('0x30')],_0x57475b['query']);_0x25b92a[_0xcdce('0x36')]=_[_0xcdce('0x35')](_0x57475b[_0xcdce('0x30')],qs['fields'](_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x37')]));_0x25b92a['attributes']=_0x25b92a[_0xcdce('0x36')]['length']?_0x25b92a[_0xcdce('0x36')]:_0x57475b[_0xcdce('0x30')];if(!_0x3d96b1[_0xcdce('0x33')]['hasOwnProperty'](_0xcdce('0x5e'))){_0x25b92a[_0xcdce('0x20')]=qs['limit'](_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x20')]);_0x25b92a[_0xcdce('0x1f')]=qs['offset'](_0x3d96b1['query'][_0xcdce('0x1f')]);}_0x25b92a[_0xcdce('0x39')]=qs['sort'](_0x3d96b1['query']['sort']);_0x25b92a[_0xcdce('0x3b')]=qs[_0xcdce('0x34')](_[_0xcdce('0x3c')](_0x3d96b1[_0xcdce('0x33')],_0x57475b[_0xcdce('0x34')]));_0x25b92a[_0xcdce('0x3b')][_0xcdce('0x5d')]=_0x238d2f['id'];if(_0x3d96b1[_0xcdce('0x33')]['filter']){_0x25b92a['where']=_['merge'](_0x25b92a[_0xcdce('0x3b')],{'$or':_[_0xcdce('0x31')](_0x25b92a[_0xcdce('0x36')],function(_0x598b76){var _0x1f983f={};_0x1f983f[_0x598b76]={'$like':'%'+_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x3d')]+'%'};return _0x1f983f;})});}_0x25b92a=_['merge']({},_0x25b92a,_0x3d96b1[_0xcdce('0x41')]);return db[_0xcdce('0x5f')][_0xcdce('0x1e')]({'where':_0x25b92a[_0xcdce('0x3b')]})[_0xcdce('0x26')](function(_0x3bdb3e){_0x4350d9[_0xcdce('0x1e')]=_0x3bdb3e;if(_0x3d96b1[_0xcdce('0x33')][_0xcdce('0x49')]){_0x25b92a[_0xcdce('0x42')]=[{'all':!![]}];}return db[_0xcdce('0x5f')][_0xcdce('0x43')](_0x25b92a);})[_0xcdce('0x26')](function(_0x13a9c4){_0x4350d9[_0xcdce('0x44')]=_0x13a9c4;return _0x4350d9;});}})[_0xcdce('0x26')](respondWithFilteredResult(_0x1cc476,_0x25b92a))[_0xcdce('0x45')](handleError(_0x1cc476,null));};function char(_0x1f69c2){return _0xcdce('0x60')===typeof _0x1f69c2?String['fromCharCode'][_0xcdce('0x61')](null,arguments):_0x1f69c2;}function needsEncapsulation(_0x31c356){return!!_0x31c356&&(_0x31c356[_0xcdce('0x62')]()['indexOf'](char(0xd))>=0x0||_0x31c356[_0xcdce('0x62')]()[_0xcdce('0x63')](char(0xa))>=0x0||_0x31c356[_0xcdce('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x31c356[_0xcdce('0x62')]()[_0xcdce('0x63')](char(0x22))>=0x0);}function encapsulate(_0x30f137){var _0x3920f2=char(0x22),_0x3f58d5='\x5c'+char(0x22),_0xabe520=_0x30f137[_0xcdce('0x62')]()[_0xcdce('0x64')](new RegExp(_0x3920f2,'g'),_0x3f58d5);return _0x3920f2+_0xabe520+_0x3920f2;}exports[_0xcdce('0x65')]=function(_0x1849e6,_0x2a1ab5,_0xd24a36){var _0x13b9b8,_0x4edc94;var _0x52d945={'where':{'ProjectId':_0x1849e6[_0xcdce('0x47')]['id']}};if(_0x1849e6[_0xcdce('0x33')][_0xcdce('0x66')]){_0x52d945[_0xcdce('0x3b')][_0xcdce('0x67')]=JSON[_0xcdce('0x68')](_0x1849e6[_0xcdce('0x33')][_0xcdce('0x66')]);}return db[_0xcdce('0x5c')][_0xcdce('0x43')](_0x52d945)['then'](handleEntityNotFound(_0x2a1ab5,null))[_0xcdce('0x26')](function(_0x145937){if(_0x145937){_0x13b9b8=_0x145937;return db[_0xcdce('0x69')][_0xcdce('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x13b9b8,'id')},'ProjectId':_0x1849e6['params']['id']},'order':'-createdAt'});}})[_0xcdce('0x26')](handleEntityNotFound(_0x2a1ab5,null))[_0xcdce('0x26')](function(_0x1608c4){if(_0x1608c4){_0x4edc94=_0x1608c4;var _0x2b6883={};for(var _0x20f1aa=0x0,_0x532562=_0x4edc94[_0xcdce('0x48')];_0x20f1aa<_0x532562;_0x20f1aa++){if(!_0x2b6883['hasOwnProperty'](_0x4edc94[_0x20f1aa][_0xcdce('0x6a')])){_0x2b6883[_0x4edc94[_0x20f1aa][_0xcdce('0x6a')]]=needsEncapsulation(_0x4edc94[_0x20f1aa][_0xcdce('0x6b')])?encapsulate(_0x4edc94[_0x20f1aa][_0xcdce('0x6b')]):_0x4edc94[_0x20f1aa]['question'];}}var _0x595a12=[],_0x5363d4={};for(var _0x34f066=0x0,_0x16514d=_0x13b9b8[_0xcdce('0x48')];_0x34f066<_0x16514d;_0x34f066++){_0x5363d4={'ProjectId':_0x1849e6['params']['id'],'SessionId':_0x13b9b8[_0x34f066]['id'],'StartTime':moment(_0x13b9b8[_0x34f066]['starttime'])['format'](_0xcdce('0x6c'))};for(var _0x370d2a=0x0,_0x580943=_0x4edc94[_0xcdce('0x48')];_0x370d2a<_0x580943;_0x370d2a++){if(_0x4edc94[_0x370d2a]['SessionId']==_0x13b9b8[_0x34f066]['id']&&_0x2b6883[_0xcdce('0x38')](_0x4edc94[_0x370d2a][_0xcdce('0x6a')])){_0x5363d4[_0x2b6883[_0x4edc94[_0x370d2a][_0xcdce('0x6a')]]]=_0x4edc94[_0x370d2a][_0xcdce('0x6d')];}}for(var _0x11bd1c in _0x2b6883){if(!_0x5363d4[_0xcdce('0x38')](_0x2b6883[_0x11bd1c])){_0x5363d4[_0x2b6883[_0x11bd1c]]=null;}}_0x595a12[_0xcdce('0x6e')](_0x5363d4);}return _0x595a12;}})[_0xcdce('0x26')](function(_0x251b91){if(!_[_0xcdce('0x6f')](_0x251b91)){var _0x196a95=toCsv(_0x251b91);var _0x580ba1=Date[_0xcdce('0x70')]();fs['writeFileSync'](util[_0xcdce('0x71')](_0xcdce('0x72'),_0x1849e6[_0xcdce('0x47')]['id'],_0x580ba1),_0x196a95);_0x2a1ab5[_0xcdce('0x73')](_0xcdce('0x74'),_0xcdce('0x75')+util[_0xcdce('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x1849e6[_0xcdce('0x47')]['id'],_0x580ba1));_0x2a1ab5['setHeader'](_0xcdce('0x76'),_0xcdce('0x77'));return _0x2a1ab5[_0xcdce('0x78')](util['format'](_0xcdce('0x72'),_0x1849e6[_0xcdce('0x47')]['id'],_0x580ba1));}else{return _0x2a1ab5[_0xcdce('0x1c')](0xcc);}})[_0xcdce('0x45')](handleError(_0x2a1ab5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e8dfdfc..67ec68b 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 _0x96b0=['../../config/logger','api','moment','bluebird','path','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects'];(function(_0x3ad890,_0x46f06d){var _0x9bfbff=function(_0x5cdfef){while(--_0x5cdfef){_0x3ad890['push'](_0x3ad890['shift']());}};_0x9bfbff(++_0x46f06d);}(_0x96b0,0x10e));var _0x096b=function(_0x152808,_0x3f18a0){_0x152808=_0x152808-0x0;var _0x9c4d1c=_0x96b0[_0x152808];return _0x9c4d1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x096b('0x0'))(_0x096b('0x1'));var moment=require(_0x096b('0x2'));var BPromise=require(_0x096b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x096b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x096b('0x5'));module[_0x096b('0x6')]=function(_0x467bda,_0x339784){return _0x467bda['define'](_0x096b('0x7'),attributes,{'tableName':_0x096b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3c=['exports','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x5a58db,_0x2d7f41){var _0x42dd9a=function(_0x52d814){while(--_0x52d814){_0x5a58db['push'](_0x5a58db['shift']());}};_0x42dd9a(++_0x2d7f41);}(_0x8e3c,0x18d));var _0xc8e3=function(_0xf71d98,_0x51e619){_0xf71d98=_0xf71d98-0x0;var _0x3fec71=_0x8e3c[_0xf71d98];return _0x3fec71;};'use strict';var _=require(_0xc8e3('0x0'));var util=require(_0xc8e3('0x1'));var logger=require(_0xc8e3('0x2'))(_0xc8e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc8e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8e3('0x5'));var config=require(_0xc8e3('0x6'));var attributes=require(_0xc8e3('0x7'));module[_0xc8e3('0x8')]=function(_0x5bbdf9,_0x6a92c1){return _0x5bbdf9['define']('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 69a1dea..4bd732e 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 _0x93d0=['stringify','error','JscriptyProject,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x93d0,0x130));var _0x093d=function(_0x39a223,_0x3831e1){_0x39a223=_0x39a223-0x0;var _0x43456b=_0x93d0[_0x39a223];return _0x43456b;};'use strict';var _=require(_0x093d('0x0'));var util=require(_0x093d('0x1'));var moment=require(_0x093d('0x2'));var BPromise=require('bluebird');var rs=require(_0x093d('0x3'));var fs=require('fs');var Redis=require(_0x093d('0x4'));var db=require(_0x093d('0x5'))['db'];var utils=require(_0x093d('0x6'));var logger=require(_0x093d('0x7'))(_0x093d('0x8'));var config=require(_0x093d('0x9'));var jayson=require(_0x093d('0xa'));var client=jayson['client'][_0x093d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3142a2,_0x448db4,_0x33ffc9){return new BPromise(function(_0x26684c,_0x4da4ed){return client['request'](_0x3142a2,_0x33ffc9)[_0x093d('0xc')](function(_0x4e6430){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x448db4,_0x093d('0xd'));logger[_0x093d('0xe')](_0x093d('0xf'),_0x448db4,'request\x20sent',JSON[_0x093d('0x10')](_0x4e6430));if(_0x4e6430[_0x093d('0x11')]){if(_0x4e6430[_0x093d('0x11')]['code']===0x1f4){logger[_0x093d('0x11')](_0x093d('0x12'),_0x448db4,_0x4e6430['error'][_0x093d('0x13')]);return _0x4da4ed(_0x4e6430[_0x093d('0x11')][_0x093d('0x13')]);}logger['error'](_0x093d('0x12'),_0x448db4,_0x4e6430[_0x093d('0x11')][_0x093d('0x13')]);return _0x26684c(_0x4e6430[_0x093d('0x11')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x448db4,_0x093d('0xd'));_0x26684c(_0x4e6430['result'][_0x093d('0x13')]);}})['catch'](function(_0x271d2e){logger[_0x093d('0x11')](_0x093d('0x12'),_0x448db4,_0x271d2e);_0x4da4ed(_0x271d2e);});});} \ No newline at end of file +var _0x4583=['error','code','JscriptyProject,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x16b992,_0x43d74c){var _0x385c78=function(_0x5c904){while(--_0x5c904){_0x16b992['push'](_0x16b992['shift']());}};_0x385c78(++_0x43d74c);}(_0x4583,0xfc));var _0x3458=function(_0x3c1ed2,_0x1fd108){_0x3c1ed2=_0x3c1ed2-0x0;var _0x56926c=_0x4583[_0x3c1ed2];return _0x56926c;};'use strict';var _=require('lodash');var util=require(_0x3458('0x0'));var moment=require('moment');var BPromise=require(_0x3458('0x1'));var rs=require(_0x3458('0x2'));var fs=require('fs');var Redis=require(_0x3458('0x3'));var db=require(_0x3458('0x4'))['db'];var utils=require(_0x3458('0x5'));var logger=require(_0x3458('0x6'))('rpc');var config=require(_0x3458('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29efbf,_0x503a1f,_0x3cd243){return new BPromise(function(_0x38c225,_0x5dd445){return client['request'](_0x29efbf,_0x3cd243)[_0x3458('0x8')](function(_0x30b221){logger[_0x3458('0x9')]('JscriptyProject,\x20%s,\x20%s',_0x503a1f,_0x3458('0xa'));logger[_0x3458('0xb')](_0x3458('0xc'),_0x503a1f,_0x3458('0xa'),JSON[_0x3458('0xd')](_0x30b221));if(_0x30b221['error']){if(_0x30b221[_0x3458('0xe')][_0x3458('0xf')]===0x1f4){logger['error'](_0x3458('0x10'),_0x503a1f,_0x30b221[_0x3458('0xe')][_0x3458('0x11')]);return _0x5dd445(_0x30b221[_0x3458('0xe')]['message']);}logger[_0x3458('0xe')](_0x3458('0x10'),_0x503a1f,_0x30b221[_0x3458('0xe')][_0x3458('0x11')]);return _0x38c225(_0x30b221[_0x3458('0xe')]['message']);}else{logger[_0x3458('0x9')]('JscriptyProject,\x20%s,\x20%s',_0x503a1f,_0x3458('0xa'));_0x38c225(_0x30b221[_0x3458('0x12')][_0x3458('0x11')]);}})['catch'](function(_0x2dadff){logger[_0x3458('0xe')](_0x3458('0x10'),_0x503a1f,_0x2dadff);_0x5dd445(_0x2dadff);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 653c7b7..68e991e 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 _0xe857=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x578f98,_0x405fda){var _0x2d73af=function(_0x5f5c11){while(--_0x5f5c11){_0x578f98['push'](_0x578f98['shift']());}};_0x2d73af(++_0x405fda);}(_0xe857,0xaf));var _0x7e85=function(_0x583c27,_0x45d731){_0x583c27=_0x583c27-0x0;var _0x4c878c=_0xe857[_0x583c27];return _0x4c878c;};'use strict';var multer=require(_0x7e85('0x0'));var util=require(_0x7e85('0x1'));var path=require(_0x7e85('0x2'));var timeout=require(_0x7e85('0x3'));var express=require(_0x7e85('0x4'));var router=express[_0x7e85('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e85('0x6'));var config=require(_0x7e85('0x7'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x7e85('0x8')](),controller[_0x7e85('0x9')]);router['get'](_0x7e85('0xa'),auth[_0x7e85('0x8')](),controller[_0x7e85('0xb')]);router['get']('/:id',auth[_0x7e85('0x8')](),controller[_0x7e85('0xc')]);router[_0x7e85('0xd')]('/',auth[_0x7e85('0x8')](),controller[_0x7e85('0xe')]);router[_0x7e85('0xf')](_0x7e85('0x10'),auth['isAuthenticated'](),controller[_0x7e85('0x11')]);router[_0x7e85('0x12')]('/:id',auth[_0x7e85('0x8')](),controller[_0x7e85('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3947=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','update','delete','multer','path'];(function(_0x612e38,_0x5437ba){var _0x47f912=function(_0x2829be){while(--_0x2829be){_0x612e38['push'](_0x612e38['shift']());}};_0x47f912(++_0x5437ba);}(_0x3947,0xb2));var _0x7394=function(_0x1e8b1b,_0x2acd26){_0x1e8b1b=_0x1e8b1b-0x0;var _0x395ee4=_0x3947[_0x1e8b1b];return _0x395ee4;};'use strict';var multer=require(_0x7394('0x0'));var util=require('util');var path=require(_0x7394('0x1'));var timeout=require(_0x7394('0x2'));var express=require(_0x7394('0x3'));var router=express[_0x7394('0x4')]();var auth=require(_0x7394('0x5'));var interaction=require(_0x7394('0x6'));var config=require(_0x7394('0x7'));var controller=require(_0x7394('0x8'));router[_0x7394('0x9')]('/',auth['isAuthenticated'](),controller[_0x7394('0xa')]);router[_0x7394('0x9')](_0x7394('0xb'),auth[_0x7394('0xc')](),controller['describe']);router[_0x7394('0x9')](_0x7394('0xd'),auth['isAuthenticated'](),controller[_0x7394('0xe')]);router['post']('/',auth[_0x7394('0xc')](),controller[_0x7394('0xf')]);router['put'](_0x7394('0xd'),auth[_0x7394('0xc')](),controller[_0x7394('0x10')]);router[_0x7394('0x11')](_0x7394('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index fcd688b..9868f45 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 _0xc07b=['long','sequelize','exports','STRING'];(function(_0x39a094,_0x4e59ee){var _0xeb9e6c=function(_0x503400){while(--_0x503400){_0x39a094['push'](_0x39a094['shift']());}};_0xeb9e6c(++_0x4e59ee);}(_0xc07b,0x9d));var _0xbc07=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xc07b[_0x307bf6];return _0x2878fc;};'use strict';var Sequelize=require(_0xbc07('0x0'));module[_0xbc07('0x1')]={'question':{'type':Sequelize[_0xbc07('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xbc07('0x3'))},'membername':{'type':Sequelize[_0xbc07('0x2')]},'projectname':{'type':Sequelize[_0xbc07('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbc07('0x2')]},'calleridnum':{'type':Sequelize[_0xbc07('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0d68=['long','sequelize','STRING','TEXT'];(function(_0x13af46,_0x50a3c3){var _0x168201=function(_0x5be290){while(--_0x5be290){_0x13af46['push'](_0x13af46['shift']());}};_0x168201(++_0x50a3c3);}(_0x0d68,0x17d));var _0x80d6=function(_0x22235f,_0x5bfe79){_0x22235f=_0x22235f-0x0;var _0x51f451=_0x0d68[_0x22235f];return _0x51f451;};'use strict';var Sequelize=require(_0x80d6('0x0'));module['exports']={'question':{'type':Sequelize[_0x80d6('0x1')]},'answer':{'type':Sequelize[_0x80d6('0x2')](_0x80d6('0x3'))},'membername':{'type':Sequelize[_0x80d6('0x1')]},'projectname':{'type':Sequelize[_0x80d6('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x80d6('0x1')]},'calleridnum':{'type':Sequelize[_0x80d6('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index d1267b3..cb98fd0 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 _0xbcf3=['params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body'];(function(_0x46eaea,_0x2c8f2f){var _0x5f348b=function(_0x3aabf5){while(--_0x3aabf5){_0x46eaea['push'](_0x46eaea['shift']());}};_0x5f348b(++_0x2c8f2f);}(_0xbcf3,0xe0));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x3bcf('0x0'));var emlformat=require(_0x3bcf('0x1'));var rimraf=require(_0x3bcf('0x2'));var zipdir=require(_0x3bcf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3bcf('0x4'));var moment=require(_0x3bcf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3bcf('0x6'));var path=require(_0x3bcf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bcf('0x8'));var fs=require('fs');var _=require(_0x3bcf('0x9'));var squel=require(_0x3bcf('0xa'));var crypto=require(_0x3bcf('0xb'));var jsforce=require(_0x3bcf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3bcf('0xd'));var querystring=require(_0x3bcf('0xe'));var Papa=require(_0x3bcf('0xf'));var Redis=require('ioredis');var authService=require(_0x3bcf('0x10'));var qs=require(_0x3bcf('0x11'));var as=require(_0x3bcf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bcf('0x13'))(_0x3bcf('0x14'));var utils=require(_0x3bcf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3bcf('0x16'));var db=require(_0x3bcf('0x17'))['db'];function respondWithStatusCode(_0x12ac96,_0x32f078){_0x32f078=_0x32f078||0xcc;return function(_0x4d0a81){if(_0x4d0a81){return _0x12ac96[_0x3bcf('0x18')](_0x32f078);}return _0x12ac96['status'](_0x32f078)[_0x3bcf('0x19')]();};}function respondWithResult(_0x25fd2b,_0x3774a8){_0x3774a8=_0x3774a8||0xc8;return function(_0x290600){if(_0x290600){return _0x25fd2b['status'](_0x3774a8)[_0x3bcf('0x1a')](_0x290600);}};}function respondWithFilteredResult(_0x487599,_0x4a9be3){return function(_0x577b5b){if(_0x577b5b){var _0x4c4000=_0x577b5b[_0x3bcf('0x1b')],_0x359e3d=_0x4a9be3[_0x3bcf('0x1c')],_0x3408b9=_0x4a9be3['offset']+_0x4a9be3[_0x3bcf('0x1d')],_0x3ef719;if(_0x3408b9>=_0x4c4000){_0x3408b9=_0x4c4000;_0x3ef719=0xc8;}else{_0x3ef719=0xce;}_0x487599[_0x3bcf('0x1e')](_0x3ef719);return _0x487599[_0x3bcf('0x1f')]('Content-Range',_0x359e3d+'-'+_0x3408b9+'/'+_0x4c4000)['json'](_0x577b5b);}return null;};}function patchUpdates(_0x26c93a){return function(_0x1f15b0){try{jsonpatch[_0x3bcf('0x20')](_0x1f15b0,_0x26c93a,!![]);}catch(_0x51e044){return BPromise[_0x3bcf('0x21')](_0x51e044);}return _0x1f15b0['save']();};}function saveUpdates(_0x33c156,_0x5125b0){return function(_0xcc389d){if(_0xcc389d){return _0xcc389d[_0x3bcf('0x22')](_0x33c156)['then'](function(_0x3eb1fa){return _0x3eb1fa;});}return null;};}function removeEntity(_0x569def,_0x1dc4b0){return function(_0x580a66){if(_0x580a66){return _0x580a66[_0x3bcf('0x23')]()[_0x3bcf('0x24')](function(){_0x569def[_0x3bcf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509c01,_0x51ba8b){return function(_0x2c3744){if(!_0x2c3744){_0x509c01[_0x3bcf('0x18')](0x194);}return _0x2c3744;};}function handleError(_0x312c98,_0x1dbb15){_0x1dbb15=_0x1dbb15||0x1f4;return function(_0x2ec76f){logger[_0x3bcf('0x25')](_0x2ec76f[_0x3bcf('0x26')]);if(_0x2ec76f[_0x3bcf('0x27')]){delete _0x2ec76f[_0x3bcf('0x27')];}_0x312c98[_0x3bcf('0x1e')](_0x1dbb15)[_0x3bcf('0x28')](_0x2ec76f);};}exports[_0x3bcf('0x29')]=function(_0x4dce40,_0x51d1a6){var _0x26aa08={},_0x3f98aa={},_0xfd5fe9={'count':0x0,'rows':[]};var _0x3645db=_[_0x3bcf('0x2a')](db[_0x3bcf('0x2b')][_0x3bcf('0x2c')],function(_0x3b9437){return{'name':_0x3b9437[_0x3bcf('0x2d')],'type':_0x3b9437[_0x3bcf('0x2e')]['key']};});_0x3f98aa[_0x3bcf('0x2f')]=_['map'](_0x3645db,_0x3bcf('0x27'));_0x3f98aa[_0x3bcf('0x30')]=_[_0x3bcf('0x31')](_0x4dce40['query']);_0x3f98aa[_0x3bcf('0x32')]=_[_0x3bcf('0x33')](_0x3f98aa[_0x3bcf('0x2f')],_0x3f98aa[_0x3bcf('0x30')]);_0x26aa08[_0x3bcf('0x34')]=_[_0x3bcf('0x33')](_0x3f98aa[_0x3bcf('0x2f')],qs['fields'](_0x4dce40[_0x3bcf('0x30')]['fields']));_0x26aa08[_0x3bcf('0x34')]=_0x26aa08[_0x3bcf('0x34')][_0x3bcf('0x35')]?_0x26aa08[_0x3bcf('0x34')]:_0x3f98aa[_0x3bcf('0x2f')];if(!_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x36')]('nolimit')){_0x26aa08[_0x3bcf('0x1d')]=qs[_0x3bcf('0x1d')](_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x1d')]);_0x26aa08[_0x3bcf('0x1c')]=qs['offset'](_0x4dce40['query'][_0x3bcf('0x1c')]);}_0x26aa08[_0x3bcf('0x37')]=qs['sort'](_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x38')]);_0x26aa08[_0x3bcf('0x39')]=qs[_0x3bcf('0x32')](_[_0x3bcf('0x3a')](_0x4dce40[_0x3bcf('0x30')],_0x3f98aa[_0x3bcf('0x32')]),_0x3645db);if(_0x4dce40['query'][_0x3bcf('0x3b')]){_0x26aa08[_0x3bcf('0x39')]=_[_0x3bcf('0x3c')](_0x26aa08[_0x3bcf('0x39')],{'$or':_[_0x3bcf('0x2a')](_0x3645db,function(_0x2f9013){if(_0x2f9013['type']!==_0x3bcf('0x3d')){var _0x2348e6={};_0x2348e6[_0x2f9013[_0x3bcf('0x27')]]={'$like':'%'+_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x3b')]+'%'};return _0x2348e6;}})});}_0x26aa08=_[_0x3bcf('0x3c')]({},_0x26aa08,_0x4dce40[_0x3bcf('0x3e')]);var _0x1cc157={'where':_0x26aa08[_0x3bcf('0x39')]};return db[_0x3bcf('0x2b')]['count'](_0x1cc157)[_0x3bcf('0x24')](function(_0x544bc6){_0xfd5fe9[_0x3bcf('0x1b')]=_0x544bc6;if(_0x4dce40[_0x3bcf('0x30')][_0x3bcf('0x3f')]){_0x26aa08[_0x3bcf('0x40')]=[{'all':!![]}];}return db[_0x3bcf('0x2b')]['findAll'](_0x26aa08);})['then'](function(_0x3c767a){_0xfd5fe9[_0x3bcf('0x41')]=_0x3c767a;return _0xfd5fe9;})[_0x3bcf('0x24')](respondWithFilteredResult(_0x51d1a6,_0x26aa08))[_0x3bcf('0x42')](handleError(_0x51d1a6,null));};exports[_0x3bcf('0x43')]=function(_0x2ab247,_0x21b075){var _0x2b0927={'raw':!![],'where':{'id':_0x2ab247['params']['id']}},_0x1dc641={};_0x1dc641['model']=_[_0x3bcf('0x31')](db[_0x3bcf('0x2b')][_0x3bcf('0x2c')]);_0x1dc641[_0x3bcf('0x30')]=_['keys'](_0x2ab247[_0x3bcf('0x30')]);_0x1dc641[_0x3bcf('0x32')]=_[_0x3bcf('0x33')](_0x1dc641['model'],_0x1dc641[_0x3bcf('0x30')]);_0x2b0927['attributes']=_[_0x3bcf('0x33')](_0x1dc641[_0x3bcf('0x2f')],qs[_0x3bcf('0x44')](_0x2ab247['query'][_0x3bcf('0x44')]));_0x2b0927['attributes']=_0x2b0927['attributes']['length']?_0x2b0927[_0x3bcf('0x34')]:_0x1dc641[_0x3bcf('0x2f')];if(_0x2ab247[_0x3bcf('0x30')]['includeAll']){_0x2b0927[_0x3bcf('0x40')]=[{'all':!![]}];}_0x2b0927=_['merge']({},_0x2b0927,_0x2ab247[_0x3bcf('0x3e')]);return db[_0x3bcf('0x2b')][_0x3bcf('0x45')](_0x2b0927)['then'](handleEntityNotFound(_0x21b075,null))[_0x3bcf('0x24')](respondWithResult(_0x21b075,null))[_0x3bcf('0x42')](handleError(_0x21b075,null));};exports[_0x3bcf('0x46')]=function(_0x2897de,_0x11da39){return db[_0x3bcf('0x2b')][_0x3bcf('0x46')](_0x2897de[_0x3bcf('0x47')],{})[_0x3bcf('0x24')](respondWithResult(_0x11da39,0xc9))[_0x3bcf('0x42')](handleError(_0x11da39,null));};exports[_0x3bcf('0x22')]=function(_0x374cf8,_0x300dc3){if(_0x374cf8['body']['id']){delete _0x374cf8['body']['id'];}return db[_0x3bcf('0x2b')]['find']({'where':{'id':_0x374cf8['params']['id']}})[_0x3bcf('0x24')](handleEntityNotFound(_0x300dc3,null))[_0x3bcf('0x24')](saveUpdates(_0x374cf8[_0x3bcf('0x47')],null))[_0x3bcf('0x24')](respondWithResult(_0x300dc3,null))[_0x3bcf('0x42')](handleError(_0x300dc3,null));};exports[_0x3bcf('0x23')]=function(_0x2b67d4,_0x121e3c){return db[_0x3bcf('0x2b')][_0x3bcf('0x45')]({'where':{'id':_0x2b67d4[_0x3bcf('0x48')]['id']}})['then'](handleEntityNotFound(_0x121e3c,null))['then'](removeEntity(_0x121e3c,null))[_0x3bcf('0x42')](handleError(_0x121e3c,null));};exports['describe']=function(_0x212b9d,_0x7fd264){return db[_0x3bcf('0x2b')][_0x3bcf('0x49')]()[_0x3bcf('0x24')](respondWithResult(_0x7fd264,null))[_0x3bcf('0x42')](handleError(_0x7fd264,null));}; \ No newline at end of file +var _0xe9e1=['filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','type','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','key','model','query','keys'];(function(_0x452e83,_0x52e169){var _0x65b907=function(_0x1e75b7){while(--_0x1e75b7){_0x452e83['push'](_0x452e83['shift']());}};_0x65b907(++_0x52e169);}(_0xe9e1,0x196));var _0x1e9e=function(_0x570b4d,_0x1208a4){_0x570b4d=_0x570b4d-0x0;var _0x10a67b=_0xe9e1[_0x570b4d];return _0x10a67b;};'use strict';var pdf=require(_0x1e9e('0x0'));var emlformat=require(_0x1e9e('0x1'));var rimraf=require(_0x1e9e('0x2'));var zipdir=require(_0x1e9e('0x3'));var jsonpatch=require(_0x1e9e('0x4'));var rp=require(_0x1e9e('0x5'));var moment=require(_0x1e9e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1e9e('0x7'));var util=require(_0x1e9e('0x8'));var path=require(_0x1e9e('0x9'));var sox=require(_0x1e9e('0xa'));var csv=require(_0x1e9e('0xb'));var ejs=require(_0x1e9e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e9e('0xd'));var crypto=require(_0x1e9e('0xe'));var jsforce=require(_0x1e9e('0xf'));var deskjs=require(_0x1e9e('0x10'));var toCsv=require(_0x1e9e('0xb'));var querystring=require('querystring');var Papa=require(_0x1e9e('0x11'));var Redis=require(_0x1e9e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1e9e('0x13'));var as=require(_0x1e9e('0x14'));var hardwareService=require(_0x1e9e('0x15'));var logger=require(_0x1e9e('0x16'))(_0x1e9e('0x17'));var utils=require(_0x1e9e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1e9e('0x19'));var db=require(_0x1e9e('0x1a'))['db'];function respondWithStatusCode(_0x106f06,_0x21fcd3){_0x21fcd3=_0x21fcd3||0xcc;return function(_0x3d1c4e){if(_0x3d1c4e){return _0x106f06['sendStatus'](_0x21fcd3);}return _0x106f06[_0x1e9e('0x1b')](_0x21fcd3)[_0x1e9e('0x1c')]();};}function respondWithResult(_0x28f8e4,_0x54ab52){_0x54ab52=_0x54ab52||0xc8;return function(_0x423099){if(_0x423099){return _0x28f8e4['status'](_0x54ab52)[_0x1e9e('0x1d')](_0x423099);}};}function respondWithFilteredResult(_0xbecc2f,_0x2fa075){return function(_0x49bf9f){if(_0x49bf9f){var _0x49fb82=_0x49bf9f[_0x1e9e('0x1e')],_0x3e715e=_0x2fa075[_0x1e9e('0x1f')],_0x476f78=_0x2fa075[_0x1e9e('0x1f')]+_0x2fa075[_0x1e9e('0x20')],_0x790530;if(_0x476f78>=_0x49fb82){_0x476f78=_0x49fb82;_0x790530=0xc8;}else{_0x790530=0xce;}_0xbecc2f[_0x1e9e('0x1b')](_0x790530);return _0xbecc2f[_0x1e9e('0x21')](_0x1e9e('0x22'),_0x3e715e+'-'+_0x476f78+'/'+_0x49fb82)['json'](_0x49bf9f);}return null;};}function patchUpdates(_0x4c078d){return function(_0x35e7e1){try{jsonpatch[_0x1e9e('0x23')](_0x35e7e1,_0x4c078d,!![]);}catch(_0x5522af){return BPromise['reject'](_0x5522af);}return _0x35e7e1[_0x1e9e('0x24')]();};}function saveUpdates(_0x5e5991,_0x5f98a){return function(_0x436882){if(_0x436882){return _0x436882[_0x1e9e('0x25')](_0x5e5991)[_0x1e9e('0x26')](function(_0x5c84f9){return _0x5c84f9;});}return null;};}function removeEntity(_0x17fbc0,_0x443bb2){return function(_0x4a62b0){if(_0x4a62b0){return _0x4a62b0['destroy']()[_0x1e9e('0x26')](function(){_0x17fbc0[_0x1e9e('0x1b')](0xcc)[_0x1e9e('0x1c')]();});}};}function handleEntityNotFound(_0x2f59b0,_0x1df133){return function(_0x14f3b6){if(!_0x14f3b6){_0x2f59b0[_0x1e9e('0x27')](0x194);}return _0x14f3b6;};}function handleError(_0x2e2c69,_0x53660d){_0x53660d=_0x53660d||0x1f4;return function(_0x24bcae){logger[_0x1e9e('0x28')](_0x24bcae[_0x1e9e('0x29')]);if(_0x24bcae[_0x1e9e('0x2a')]){delete _0x24bcae[_0x1e9e('0x2a')];}_0x2e2c69[_0x1e9e('0x1b')](_0x53660d)['send'](_0x24bcae);};}exports[_0x1e9e('0x2b')]=function(_0x1dd822,_0x3fd8b5){var _0x33f492={},_0x3c0590={},_0x4616c7={'count':0x0,'rows':[]};var _0x29093f=_[_0x1e9e('0x2c')](db['JscriptyQuestionReport'][_0x1e9e('0x2d')],function(_0x31dcd8){return{'name':_0x31dcd8['fieldName'],'type':_0x31dcd8['type'][_0x1e9e('0x2e')]};});_0x3c0590[_0x1e9e('0x2f')]=_[_0x1e9e('0x2c')](_0x29093f,_0x1e9e('0x2a'));_0x3c0590[_0x1e9e('0x30')]=_[_0x1e9e('0x31')](_0x1dd822['query']);_0x3c0590[_0x1e9e('0x32')]=_[_0x1e9e('0x33')](_0x3c0590[_0x1e9e('0x2f')],_0x3c0590[_0x1e9e('0x30')]);_0x33f492[_0x1e9e('0x34')]=_[_0x1e9e('0x33')](_0x3c0590[_0x1e9e('0x2f')],qs[_0x1e9e('0x35')](_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x35')]));_0x33f492[_0x1e9e('0x34')]=_0x33f492['attributes']['length']?_0x33f492[_0x1e9e('0x34')]:_0x3c0590[_0x1e9e('0x2f')];if(!_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x36')]('nolimit')){_0x33f492[_0x1e9e('0x20')]=qs['limit'](_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x20')]);_0x33f492[_0x1e9e('0x1f')]=qs[_0x1e9e('0x1f')](_0x1dd822['query'][_0x1e9e('0x1f')]);}_0x33f492['order']=qs[_0x1e9e('0x37')](_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x37')]);_0x33f492['where']=qs['filters'](_[_0x1e9e('0x38')](_0x1dd822['query'],_0x3c0590[_0x1e9e('0x32')]),_0x29093f);if(_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x39')]){_0x33f492[_0x1e9e('0x3a')]=_[_0x1e9e('0x3b')](_0x33f492[_0x1e9e('0x3a')],{'$or':_[_0x1e9e('0x2c')](_0x29093f,function(_0x1c7293){if(_0x1c7293[_0x1e9e('0x3c')]!=='VIRTUAL'){var _0x5d8482={};_0x5d8482[_0x1c7293[_0x1e9e('0x2a')]]={'$like':'%'+_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x39')]+'%'};return _0x5d8482;}})});}_0x33f492=_[_0x1e9e('0x3b')]({},_0x33f492,_0x1dd822[_0x1e9e('0x3d')]);var _0xfe7e73={'where':_0x33f492[_0x1e9e('0x3a')]};return db[_0x1e9e('0x3e')][_0x1e9e('0x1e')](_0xfe7e73)[_0x1e9e('0x26')](function(_0x4653f8){_0x4616c7[_0x1e9e('0x1e')]=_0x4653f8;if(_0x1dd822[_0x1e9e('0x30')][_0x1e9e('0x3f')]){_0x33f492[_0x1e9e('0x40')]=[{'all':!![]}];}return db[_0x1e9e('0x3e')][_0x1e9e('0x41')](_0x33f492);})[_0x1e9e('0x26')](function(_0x18da0f){_0x4616c7[_0x1e9e('0x42')]=_0x18da0f;return _0x4616c7;})['then'](respondWithFilteredResult(_0x3fd8b5,_0x33f492))[_0x1e9e('0x43')](handleError(_0x3fd8b5,null));};exports[_0x1e9e('0x44')]=function(_0x4c2433,_0x493a1f){var _0x2d6516={'raw':!![],'where':{'id':_0x4c2433[_0x1e9e('0x45')]['id']}},_0x127cb7={};_0x127cb7['model']=_[_0x1e9e('0x31')](db[_0x1e9e('0x3e')][_0x1e9e('0x2d')]);_0x127cb7[_0x1e9e('0x30')]=_[_0x1e9e('0x31')](_0x4c2433[_0x1e9e('0x30')]);_0x127cb7['filters']=_[_0x1e9e('0x33')](_0x127cb7[_0x1e9e('0x2f')],_0x127cb7[_0x1e9e('0x30')]);_0x2d6516[_0x1e9e('0x34')]=_[_0x1e9e('0x33')](_0x127cb7[_0x1e9e('0x2f')],qs[_0x1e9e('0x35')](_0x4c2433[_0x1e9e('0x30')][_0x1e9e('0x35')]));_0x2d6516['attributes']=_0x2d6516[_0x1e9e('0x34')][_0x1e9e('0x46')]?_0x2d6516['attributes']:_0x127cb7[_0x1e9e('0x2f')];if(_0x4c2433[_0x1e9e('0x30')]['includeAll']){_0x2d6516[_0x1e9e('0x40')]=[{'all':!![]}];}_0x2d6516=_[_0x1e9e('0x3b')]({},_0x2d6516,_0x4c2433[_0x1e9e('0x3d')]);return db[_0x1e9e('0x3e')][_0x1e9e('0x47')](_0x2d6516)[_0x1e9e('0x26')](handleEntityNotFound(_0x493a1f,null))[_0x1e9e('0x26')](respondWithResult(_0x493a1f,null))[_0x1e9e('0x43')](handleError(_0x493a1f,null));};exports[_0x1e9e('0x48')]=function(_0x360db6,_0x5d2707){return db[_0x1e9e('0x3e')][_0x1e9e('0x48')](_0x360db6[_0x1e9e('0x49')],{})[_0x1e9e('0x26')](respondWithResult(_0x5d2707,0xc9))[_0x1e9e('0x43')](handleError(_0x5d2707,null));};exports[_0x1e9e('0x25')]=function(_0x1268b0,_0x434229){if(_0x1268b0[_0x1e9e('0x49')]['id']){delete _0x1268b0['body']['id'];}return db['JscriptyQuestionReport'][_0x1e9e('0x47')]({'where':{'id':_0x1268b0['params']['id']}})[_0x1e9e('0x26')](handleEntityNotFound(_0x434229,null))['then'](saveUpdates(_0x1268b0['body'],null))[_0x1e9e('0x26')](respondWithResult(_0x434229,null))[_0x1e9e('0x43')](handleError(_0x434229,null));};exports[_0x1e9e('0x4a')]=function(_0x3b090b,_0xff21a){return db[_0x1e9e('0x3e')]['find']({'where':{'id':_0x3b090b[_0x1e9e('0x45')]['id']}})[_0x1e9e('0x26')](handleEntityNotFound(_0xff21a,null))[_0x1e9e('0x26')](removeEntity(_0xff21a,null))[_0x1e9e('0x43')](handleError(_0xff21a,null));};exports[_0x1e9e('0x4b')]=function(_0x5775f1,_0x5698d7){return db[_0x1e9e('0x3e')][_0x1e9e('0x4b')]()[_0x1e9e('0x26')](respondWithResult(_0x5698d7,null))['catch'](handleError(_0x5698d7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9574824..1c9f6da 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 _0x796e=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions'];(function(_0x26db4d,_0x40b97b){var _0x7e04ed=function(_0x3ebe11){while(--_0x3ebe11){_0x26db4d['push'](_0x26db4d['shift']());}};_0x7e04ed(++_0x40b97b);}(_0x796e,0x1ad));var _0xe796=function(_0x314e3a,_0x458b52){_0x314e3a=_0x314e3a-0x0;var _0x1fb0cb=_0x796e[_0x314e3a];return _0x1fb0cb;};'use strict';var _=require(_0xe796('0x0'));var util=require('util');var logger=require(_0xe796('0x1'))(_0xe796('0x2'));var moment=require(_0xe796('0x3'));var BPromise=require(_0xe796('0x4'));var rp=require(_0xe796('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe796('0x6'));var attributes=require(_0xe796('0x7'));module[_0xe796('0x8')]=function(_0x489f4a,_0x263bea){return _0x489f4a[_0xe796('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0xe796('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb380=['report_jscripty_questions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x1d0b20,_0x15898a){var _0x563b0d=function(_0x51ccde){while(--_0x51ccde){_0x1d0b20['push'](_0x1d0b20['shift']());}};_0x563b0d(++_0x15898a);}(_0xb380,0x153));var _0x0b38=function(_0x4b8b94,_0x577c07){_0x4b8b94=_0x4b8b94-0x0;var _0x28dce7=_0xb380[_0x4b8b94];return _0x28dce7;};'use strict';var _=require(_0x0b38('0x0'));var util=require(_0x0b38('0x1'));var logger=require(_0x0b38('0x2'))('api');var moment=require(_0x0b38('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b38('0x4'));var fs=require('fs');var path=require(_0x0b38('0x5'));var rimraf=require(_0x0b38('0x6'));var config=require(_0x0b38('0x7'));var attributes=require(_0x0b38('0x8'));module[_0x0b38('0x9')]=function(_0x3d713f,_0x33cd85){return _0x3d713f[_0x0b38('0xa')](_0x0b38('0xb'),attributes,{'tableName':_0x0b38('0xc'),'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 17e0766..08c9fce 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 _0x97d6=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3aade2,_0x5cab6f){var _0x1fee1f=function(_0x3be6a2){while(--_0x3be6a2){_0x3aade2['push'](_0x3aade2['shift']());}};_0x1fee1f(++_0x5cab6f);}(_0x97d6,0xdd));var _0x697d=function(_0x473582,_0x139c3c){_0x473582=_0x473582-0x0;var _0x48feb7=_0x97d6[_0x473582];return _0x48feb7;};'use strict';var _=require(_0x697d('0x0'));var util=require(_0x697d('0x1'));var moment=require(_0x697d('0x2'));var BPromise=require(_0x697d('0x3'));var rs=require(_0x697d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x697d('0x5'))['db'];var utils=require(_0x697d('0x6'));var logger=require('../../config/logger')(_0x697d('0x7'));var config=require(_0x697d('0x8'));var jayson=require(_0x697d('0x9'));var client=jayson[_0x697d('0xa')][_0x697d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1af84c,_0x2f0f9f,_0x3ff57c){return new BPromise(function(_0x1be3f4,_0x4e3aa9){return client['request'](_0x1af84c,_0x3ff57c)['then'](function(_0xb9796c){logger[_0x697d('0xc')](_0x697d('0xd'),_0x2f0f9f,_0x697d('0xe'));logger[_0x697d('0xf')](_0x697d('0x10'),_0x2f0f9f,_0x697d('0xe'),JSON[_0x697d('0x11')](_0xb9796c));if(_0xb9796c[_0x697d('0x12')]){if(_0xb9796c[_0x697d('0x12')]['code']===0x1f4){logger[_0x697d('0x12')](_0x697d('0xd'),_0x2f0f9f,_0xb9796c[_0x697d('0x12')]['message']);return _0x4e3aa9(_0xb9796c[_0x697d('0x12')][_0x697d('0x13')]);}logger[_0x697d('0x12')](_0x697d('0xd'),_0x2f0f9f,_0xb9796c['error'][_0x697d('0x13')]);return _0x1be3f4(_0xb9796c[_0x697d('0x12')]['message']);}else{logger[_0x697d('0xc')](_0x697d('0xd'),_0x2f0f9f,_0x697d('0xe'));_0x1be3f4(_0xb9796c[_0x697d('0x14')][_0x697d('0x13')]);}})[_0x697d('0x15')](function(_0x2f4dec){logger[_0x697d('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2f0f9f,_0x2f4dec);_0x4e3aa9(_0x2f4dec);});});} \ No newline at end of file +var _0x1b05=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x41ee3d,_0x147f4b){var _0x1818e1=function(_0x1fafe4){while(--_0x1fafe4){_0x41ee3d['push'](_0x41ee3d['shift']());}};_0x1818e1(++_0x147f4b);}(_0x1b05,0x1be));var _0x51b0=function(_0x4d1948,_0x81134b){_0x4d1948=_0x4d1948-0x0;var _0x1bb073=_0x1b05[_0x4d1948];return _0x1bb073;};'use strict';var _=require(_0x51b0('0x0'));var util=require(_0x51b0('0x1'));var moment=require('moment');var BPromise=require(_0x51b0('0x2'));var rs=require(_0x51b0('0x3'));var fs=require('fs');var Redis=require(_0x51b0('0x4'));var db=require(_0x51b0('0x5'))['db'];var utils=require(_0x51b0('0x6'));var logger=require(_0x51b0('0x7'))(_0x51b0('0x8'));var config=require(_0x51b0('0x9'));var jayson=require(_0x51b0('0xa'));var client=jayson[_0x51b0('0xb')][_0x51b0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a0f70,_0x5640dd,_0x1c3319){return new BPromise(function(_0x4ce070,_0x23bbf8){return client['request'](_0x2a0f70,_0x1c3319)[_0x51b0('0xd')](function(_0x3f781a){logger[_0x51b0('0xe')](_0x51b0('0xf'),_0x5640dd,_0x51b0('0x10'));logger['debug'](_0x51b0('0x11'),_0x5640dd,_0x51b0('0x10'),JSON['stringify'](_0x3f781a));if(_0x3f781a['error']){if(_0x3f781a[_0x51b0('0x12')][_0x51b0('0x13')]===0x1f4){logger[_0x51b0('0x12')](_0x51b0('0xf'),_0x5640dd,_0x3f781a[_0x51b0('0x12')]['message']);return _0x23bbf8(_0x3f781a[_0x51b0('0x12')][_0x51b0('0x14')]);}logger[_0x51b0('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5640dd,_0x3f781a[_0x51b0('0x12')]['message']);return _0x4ce070(_0x3f781a[_0x51b0('0x12')][_0x51b0('0x14')]);}else{logger[_0x51b0('0xe')](_0x51b0('0xf'),_0x5640dd,'request\x20sent');_0x4ce070(_0x3f781a[_0x51b0('0x15')][_0x51b0('0x14')]);}})[_0x51b0('0x16')](function(_0x5db9b2){logger[_0x51b0('0x12')](_0x51b0('0xf'),_0x5640dd,_0x5db9b2);_0x23bbf8(_0x5db9b2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ff6e697..bade980 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 _0x202c=['express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x1d7908,_0x25bdc0){var _0x27d8db=function(_0x58944a){while(--_0x58944a){_0x1d7908['push'](_0x1d7908['shift']());}};_0x27d8db(++_0x25bdc0);}(_0x202c,0x178));var _0xc202=function(_0x1788ed,_0xacf360){_0x1788ed=_0x1788ed-0x0;var _0x1c5c8b=_0x202c[_0x1788ed];return _0x1c5c8b;};'use strict';var multer=require(_0xc202('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc202('0x1'));var express=require(_0xc202('0x2'));var router=express[_0xc202('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc202('0x4'));var config=require(_0xc202('0x5'));var controller=require(_0xc202('0x6'));router[_0xc202('0x7')]('/',auth['isAuthenticated'](),controller[_0xc202('0x8')]);router[_0xc202('0x7')]('/describe',auth[_0xc202('0x9')](),controller['describe']);router[_0xc202('0x7')](_0xc202('0xa'),auth[_0xc202('0x9')](),controller[_0xc202('0xb')]);router[_0xc202('0x7')](_0xc202('0xc'),auth[_0xc202('0x9')](),controller[_0xc202('0xd')]);router[_0xc202('0xe')]('/',auth[_0xc202('0x9')](),controller[_0xc202('0xf')]);router[_0xc202('0x10')](_0xc202('0xa'),auth['isAuthenticated'](),controller[_0xc202('0x11')]);router[_0xc202('0x12')](_0xc202('0xa'),auth[_0xc202('0x9')](),controller[_0xc202('0x13')]);module[_0xc202('0x14')]=router; \ No newline at end of file +var _0xafdd=['isAuthenticated','index','/describe','/:id','/:id/questions','getQuestions','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0xafdd,0x19a));var _0xdafd=function(_0x1c152b,_0x532dfb){_0x1c152b=_0x1c152b-0x0;var _0x1038ec=_0xafdd[_0x1c152b];return _0x1038ec;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var auth=require(_0xdafd('0x6'));var interaction=require(_0xdafd('0x7'));var config=require('../../config/environment');var controller=require(_0xdafd('0x8'));router[_0xdafd('0x9')]('/',auth[_0xdafd('0xa')](),controller[_0xdafd('0xb')]);router[_0xdafd('0x9')](_0xdafd('0xc'),auth[_0xdafd('0xa')](),controller['describe']);router[_0xdafd('0x9')](_0xdafd('0xd'),auth[_0xdafd('0xa')](),controller['show']);router[_0xdafd('0x9')](_0xdafd('0xe'),auth[_0xdafd('0xa')](),controller[_0xdafd('0xf')]);router['post']('/',auth[_0xdafd('0xa')](),controller[_0xdafd('0x10')]);router[_0xdafd('0x11')](_0xdafd('0xd'),auth[_0xdafd('0xa')](),controller[_0xdafd('0x12')]);router['delete'](_0xdafd('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdafd('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f7d3011..a3ac42e 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 _0x4d33=['BOOLEAN','moment','sequelize','exports','DATE','endtime','format','STRING'];(function(_0x1111b6,_0x406ede){var _0x2b4945=function(_0x31ec4f){while(--_0x31ec4f){_0x1111b6['push'](_0x1111b6['shift']());}};_0x2b4945(++_0x406ede);}(_0x4d33,0x161));var _0x34d3=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x4d33[_0x1faaa1];return _0x994ec;};'use strict';var moment=require(_0x34d3('0x0'));var Sequelize=require(_0x34d3('0x1'));module[_0x34d3('0x2')]={'starttime':{'type':Sequelize[_0x34d3('0x3')],'set':function(_0x498683){this['setDataValue']('starttime',_0x498683);this['setDataValue'](_0x34d3('0x4'),moment()[_0x34d3('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x34d3('0x6')]},'projectname':{'type':Sequelize[_0x34d3('0x6')]},'queue':{'type':Sequelize[_0x34d3('0x6')]},'uniqueid':{'type':Sequelize[_0x34d3('0x6')]},'calleridname':{'type':Sequelize[_0x34d3('0x6')]},'calleridnum':{'type':Sequelize[_0x34d3('0x6')]},'completed':{'type':Sequelize[_0x34d3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xd973=['sequelize','exports','DATE','starttime','setDataValue','endtime','STRING','BOOLEAN','moment'];(function(_0x5dbf50,_0x393b72){var _0x48bea7=function(_0x8d357e){while(--_0x8d357e){_0x5dbf50['push'](_0x5dbf50['shift']());}};_0x48bea7(++_0x393b72);}(_0xd973,0x179));var _0x3d97=function(_0x57f2e9,_0x2a30ae){_0x57f2e9=_0x57f2e9-0x0;var _0x38860b=_0xd973[_0x57f2e9];return _0x38860b;};'use strict';var moment=require(_0x3d97('0x0'));var Sequelize=require(_0x3d97('0x1'));module[_0x3d97('0x2')]={'starttime':{'type':Sequelize[_0x3d97('0x3')],'set':function(_0xc99f82){this['setDataValue'](_0x3d97('0x4'),_0xc99f82);this[_0x3d97('0x5')](_0x3d97('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x3d97('0x7')]},'projectname':{'type':Sequelize[_0x3d97('0x7')]},'queue':{'type':Sequelize[_0x3d97('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3d97('0x7')]},'calleridnum':{'type':Sequelize[_0x3d97('0x7')]},'completed':{'type':Sequelize[_0x3d97('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6c821e2..1c61466 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 _0x9c44=['create','body','describe','getQuestions','findOne','JscriptyQuestionReport','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','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find'];(function(_0x1ddea6,_0x56b73b){var _0x52cb98=function(_0x994c83){while(--_0x994c83){_0x1ddea6['push'](_0x1ddea6['shift']());}};_0x52cb98(++_0x56b73b);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x15')](_0x7df3a9)[_0x49c4('0x16')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x15')](_0x2decee)[_0x49c4('0x17')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=_0x3acd06['count'],_0x13a2db=_0x58d177[_0x49c4('0x18')],_0x81e831=_0x58d177[_0x49c4('0x18')]+_0x58d177['limit'],_0x2abc78;if(_0x81e831>=_0x141003){_0x81e831=_0x141003;_0x2abc78=0xc8;}else{_0x2abc78=0xce;}_0x3de397['status'](_0x2abc78);return _0x3de397[_0x49c4('0x19')](_0x49c4('0x1a'),_0x13a2db+'-'+_0x81e831+'/'+_0x141003)[_0x49c4('0x17')](_0x3acd06);}return null;};}function patchUpdates(_0x59f29b){return function(_0x24856d){try{jsonpatch['apply'](_0x24856d,_0x59f29b,!![]);}catch(_0x2cbd50){return BPromise[_0x49c4('0x1b')](_0x2cbd50);}return _0x24856d[_0x49c4('0x1c')]();};}function saveUpdates(_0x291526,_0x382040){return function(_0x41078c){if(_0x41078c){return _0x41078c[_0x49c4('0x1d')](_0x291526)[_0x49c4('0x1e')](function(_0x2197d2){return _0x2197d2;});}return null;};}function removeEntity(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x1f')]()['then'](function(){_0x578447['status'](0xcc)[_0x49c4('0x16')]();});}};}function handleEntityNotFound(_0x15581b,_0x26c640){return function(_0xd335e4){if(!_0xd335e4){_0x15581b['sendStatus'](0x194);}return _0xd335e4;};}function handleError(_0x5850f2,_0x180276){_0x180276=_0x180276||0x1f4;return function(_0x9cb797){logger['error'](_0x9cb797[_0x49c4('0x20')]);if(_0x9cb797[_0x49c4('0x21')]){delete _0x9cb797[_0x49c4('0x21')];}_0x5850f2[_0x49c4('0x15')](_0x180276)['send'](_0x9cb797);};}exports['index']=function(_0x449960,_0x53c199){var _0x3800b7={},_0x3852b2={},_0x3f1708={'count':0x0,'rows':[]};var _0x372a47=_['map'](db[_0x49c4('0x22')][_0x49c4('0x23')],function(_0x46e04d){return{'name':_0x46e04d[_0x49c4('0x24')],'type':_0x46e04d[_0x49c4('0x25')][_0x49c4('0x26')]};});_0x3852b2[_0x49c4('0x27')]=_[_0x49c4('0x28')](_0x372a47,_0x49c4('0x21'));_0x3852b2[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x449960['query']);_0x3852b2['filters']=_['intersection'](_0x3852b2[_0x49c4('0x27')],_0x3852b2[_0x49c4('0x29')]);_0x3800b7[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x3852b2[_0x49c4('0x27')],qs['fields'](_0x449960[_0x49c4('0x29')][_0x49c4('0x2d')]));_0x3800b7[_0x49c4('0x2b')]=_0x3800b7[_0x49c4('0x2b')]['length']?_0x3800b7['attributes']:_0x3852b2[_0x49c4('0x27')];if(!_0x449960[_0x49c4('0x29')][_0x49c4('0x2e')](_0x49c4('0x2f'))){_0x3800b7[_0x49c4('0x30')]=qs['limit'](_0x449960[_0x49c4('0x29')][_0x49c4('0x30')]);_0x3800b7[_0x49c4('0x18')]=qs['offset'](_0x449960['query'][_0x49c4('0x18')]);}_0x3800b7[_0x49c4('0x31')]=qs[_0x49c4('0x32')](_0x449960[_0x49c4('0x29')][_0x49c4('0x32')]);_0x3800b7[_0x49c4('0x33')]=qs[_0x49c4('0x34')](_[_0x49c4('0x35')](_0x449960[_0x49c4('0x29')],_0x3852b2['filters']),_0x372a47);if(_0x449960[_0x49c4('0x29')]['filter']){_0x3800b7[_0x49c4('0x33')]=_[_0x49c4('0x36')](_0x3800b7[_0x49c4('0x33')],{'$or':_[_0x49c4('0x28')](_0x372a47,function(_0x4ed4f8){if(_0x4ed4f8[_0x49c4('0x25')]!==_0x49c4('0x37')){var _0x1c910a={};_0x1c910a[_0x4ed4f8['name']]={'$like':'%'+_0x449960[_0x49c4('0x29')][_0x49c4('0x38')]+'%'};return _0x1c910a;}})});}_0x3800b7=_[_0x49c4('0x36')]({},_0x3800b7,_0x449960[_0x49c4('0x39')]);var _0x1ba7a0={'where':_0x3800b7[_0x49c4('0x33')]};return db[_0x49c4('0x22')][_0x49c4('0x3a')](_0x1ba7a0)[_0x49c4('0x1e')](function(_0x2f1105){_0x3f1708[_0x49c4('0x3a')]=_0x2f1105;if(_0x449960['query'][_0x49c4('0x3b')]){_0x3800b7[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x22')][_0x49c4('0x3d')](_0x3800b7);})[_0x49c4('0x1e')](function(_0x29dd5d){_0x3f1708[_0x49c4('0x3e')]=_0x29dd5d;return _0x3f1708;})[_0x49c4('0x1e')](respondWithFilteredResult(_0x53c199,_0x3800b7))[_0x49c4('0x3f')](handleError(_0x53c199,null));};exports[_0x49c4('0x40')]=function(_0x2dffb4,_0xa3d59e){var _0x326142={'raw':!![],'where':{'id':_0x2dffb4[_0x49c4('0x41')]['id']}},_0x4e38bc={};_0x4e38bc['model']=_[_0x49c4('0x2a')](db[_0x49c4('0x22')][_0x49c4('0x23')]);_0x4e38bc[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x2dffb4[_0x49c4('0x29')]);_0x4e38bc['filters']=_['intersection'](_0x4e38bc[_0x49c4('0x27')],_0x4e38bc[_0x49c4('0x29')]);_0x326142[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4e38bc['model'],qs[_0x49c4('0x2d')](_0x2dffb4[_0x49c4('0x29')][_0x49c4('0x2d')]));_0x326142[_0x49c4('0x2b')]=_0x326142[_0x49c4('0x2b')][_0x49c4('0x42')]?_0x326142[_0x49c4('0x2b')]:_0x4e38bc[_0x49c4('0x27')];if(_0x2dffb4[_0x49c4('0x29')]['includeAll']){_0x326142[_0x49c4('0x3c')]=[{'all':!![]}];}_0x326142=_['merge']({},_0x326142,_0x2dffb4[_0x49c4('0x39')]);return db[_0x49c4('0x22')][_0x49c4('0x43')](_0x326142)[_0x49c4('0x1e')](handleEntityNotFound(_0xa3d59e,null))[_0x49c4('0x1e')](respondWithResult(_0xa3d59e,null))['catch'](handleError(_0xa3d59e,null));};exports[_0x49c4('0x44')]=function(_0x15b674,_0x384862){return db[_0x49c4('0x22')][_0x49c4('0x44')](_0x15b674[_0x49c4('0x45')],{})[_0x49c4('0x1e')](respondWithResult(_0x384862,0xc9))['catch'](handleError(_0x384862,null));};exports[_0x49c4('0x1d')]=function(_0x5cfff9,_0x3f7379){if(_0x5cfff9[_0x49c4('0x45')]['id']){delete _0x5cfff9[_0x49c4('0x45')]['id'];}return db[_0x49c4('0x22')][_0x49c4('0x43')]({'where':{'id':_0x5cfff9[_0x49c4('0x41')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x3f7379,null))['then'](saveUpdates(_0x5cfff9[_0x49c4('0x45')],null))[_0x49c4('0x1e')](respondWithResult(_0x3f7379,null))['catch'](handleError(_0x3f7379,null));};exports[_0x49c4('0x1f')]=function(_0xaece5f,_0xfbe179){return db[_0x49c4('0x22')]['find']({'where':{'id':_0xaece5f['params']['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0xfbe179,null))['then'](removeEntity(_0xfbe179,null))[_0x49c4('0x3f')](handleError(_0xfbe179,null));};exports[_0x49c4('0x46')]=function(_0x3811b2,_0x23d500){return db[_0x49c4('0x22')][_0x49c4('0x46')]()[_0x49c4('0x1e')](respondWithResult(_0x23d500,null))['catch'](handleError(_0x23d500,null));};exports[_0x49c4('0x47')]=function(_0x1550ce,_0x3936d3,_0x3d944c){var _0x17ef75={'raw':!![],'where':{}};var _0x2644c0={};var _0x156748={'count':0x0,'rows':[]};return db[_0x49c4('0x22')][_0x49c4('0x48')]({'where':{'id':_0x1550ce[_0x49c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x3936d3,null))['then'](function(_0x3fd647){if(_0x3fd647){_0x2644c0[_0x49c4('0x27')]=_['keys'](db['JscriptyQuestionReport'][_0x49c4('0x23')]);_0x2644c0['query']=_['keys'](_0x1550ce[_0x49c4('0x29')]);_0x2644c0[_0x49c4('0x34')]=_[_0x49c4('0x2c')](_0x2644c0[_0x49c4('0x27')],_0x2644c0[_0x49c4('0x29')]);_0x17ef75[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x2644c0['model'],qs[_0x49c4('0x2d')](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x2d')]));_0x17ef75[_0x49c4('0x2b')]=_0x17ef75[_0x49c4('0x2b')][_0x49c4('0x42')]?_0x17ef75['attributes']:_0x2644c0['model'];if(!_0x1550ce[_0x49c4('0x29')][_0x49c4('0x2e')](_0x49c4('0x2f'))){_0x17ef75[_0x49c4('0x30')]=qs[_0x49c4('0x30')](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x30')]);_0x17ef75['offset']=qs[_0x49c4('0x18')](_0x1550ce[_0x49c4('0x29')]['offset']);}_0x17ef75[_0x49c4('0x31')]=qs['sort'](_0x1550ce[_0x49c4('0x29')][_0x49c4('0x32')]);_0x17ef75[_0x49c4('0x33')]=qs[_0x49c4('0x34')](_[_0x49c4('0x35')](_0x1550ce[_0x49c4('0x29')],_0x2644c0[_0x49c4('0x34')]));_0x17ef75[_0x49c4('0x33')]['SessionId']=_0x3fd647['id'];if(_0x1550ce[_0x49c4('0x29')][_0x49c4('0x38')]){_0x17ef75['where']=_[_0x49c4('0x36')](_0x17ef75[_0x49c4('0x33')],{'$or':_['map'](_0x17ef75[_0x49c4('0x2b')],function(_0x42e0e6){var _0x4f50bf={};_0x4f50bf[_0x42e0e6]={'$like':'%'+_0x1550ce['query']['filter']+'%'};return _0x4f50bf;})});}_0x17ef75=_['merge']({},_0x17ef75,_0x1550ce[_0x49c4('0x39')]);return db['JscriptyQuestionReport'][_0x49c4('0x3a')]({'where':_0x17ef75[_0x49c4('0x33')]})['then'](function(_0x679134){_0x156748[_0x49c4('0x3a')]=_0x679134;if(_0x1550ce['query'][_0x49c4('0x3b')]){_0x17ef75[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x49')][_0x49c4('0x3d')](_0x17ef75);})['then'](function(_0x431921){_0x156748[_0x49c4('0x3e')]=_0x431921;return _0x156748;});}})[_0x49c4('0x1e')](respondWithFilteredResult(_0x3936d3,_0x17ef75))[_0x49c4('0x3f')](handleError(_0x3936d3,null));}; \ No newline at end of file +var _0xb7e7=['limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','JscriptySessionReport','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','filter','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x2d59bc,_0x48025f){var _0x2879f8=function(_0x4de2a8){while(--_0x4de2a8){_0x2d59bc['push'](_0x2d59bc['shift']());}};_0x2879f8(++_0x48025f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=_0x5703fd[_0x7b7e('0x1d')],_0xc7f087=_0x3d2fb2[_0x7b7e('0x1e')],_0x36444d=_0x3d2fb2[_0x7b7e('0x1e')]+_0x3d2fb2[_0x7b7e('0x1f')],_0x27f999;if(_0x36444d>=_0x51baf6){_0x36444d=_0x51baf6;_0x27f999=0xc8;}else{_0x27f999=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x27f999);return _0x457ec5[_0x7b7e('0x20')](_0x7b7e('0x21'),_0xc7f087+'-'+_0x36444d+'/'+_0x51baf6)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x14f4fe){return function(_0x448980){try{jsonpatch[_0x7b7e('0x22')](_0x448980,_0x14f4fe,!![]);}catch(_0x9776c3){return BPromise[_0x7b7e('0x23')](_0x9776c3);}return _0x448980[_0x7b7e('0x24')]();};}function saveUpdates(_0x49eddb,_0x69262b){return function(_0x43db4f){if(_0x43db4f){return _0x43db4f[_0x7b7e('0x25')](_0x49eddb)['then'](function(_0x313122){return _0x313122;});}return null;};}function removeEntity(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x26')]()[_0x7b7e('0x27')](function(){_0xbf0cb3[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x53bbb3,_0x5d6215){return function(_0x4a836a){if(!_0x4a836a){_0x53bbb3[_0x7b7e('0x19')](0x194);}return _0x4a836a;};}function handleError(_0x22598e,_0x23bfa3){_0x23bfa3=_0x23bfa3||0x1f4;return function(_0x483c6f){logger['error'](_0x483c6f['stack']);if(_0x483c6f[_0x7b7e('0x28')]){delete _0x483c6f[_0x7b7e('0x28')];}_0x22598e[_0x7b7e('0x1b')](_0x23bfa3)[_0x7b7e('0x29')](_0x483c6f);};}exports[_0x7b7e('0x2a')]=function(_0x48fad1,_0x6a1e71){var _0x21a15={},_0x4c46b8={},_0x57b9da={'count':0x0,'rows':[]};var _0x4e5de7=_[_0x7b7e('0x2b')](db[_0x7b7e('0x2c')]['rawAttributes'],function(_0x3db8c4){return{'name':_0x3db8c4['fieldName'],'type':_0x3db8c4[_0x7b7e('0x2d')][_0x7b7e('0x2e')]};});_0x4c46b8[_0x7b7e('0x2f')]=_['map'](_0x4e5de7,_0x7b7e('0x28'));_0x4c46b8[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x48fad1[_0x7b7e('0x30')]);_0x4c46b8[_0x7b7e('0x32')]=_['intersection'](_0x4c46b8[_0x7b7e('0x2f')],_0x4c46b8['query']);_0x21a15[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x4c46b8[_0x7b7e('0x2f')],qs[_0x7b7e('0x35')](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x35')]));_0x21a15[_0x7b7e('0x33')]=_0x21a15['attributes']['length']?_0x21a15[_0x7b7e('0x33')]:_0x4c46b8[_0x7b7e('0x2f')];if(!_0x48fad1['query'][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x21a15[_0x7b7e('0x1f')]=qs['limit'](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x21a15[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x1e')]);}_0x21a15[_0x7b7e('0x38')]=qs[_0x7b7e('0x39')](_0x48fad1[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0x21a15[_0x7b7e('0x3a')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3b')](_0x48fad1[_0x7b7e('0x30')],_0x4c46b8[_0x7b7e('0x32')]),_0x4e5de7);if(_0x48fad1[_0x7b7e('0x30')]['filter']){_0x21a15[_0x7b7e('0x3a')]=_[_0x7b7e('0x3c')](_0x21a15[_0x7b7e('0x3a')],{'$or':_[_0x7b7e('0x2b')](_0x4e5de7,function(_0x36abfc){if(_0x36abfc[_0x7b7e('0x2d')]!==_0x7b7e('0x3d')){var _0x1e6280={};_0x1e6280[_0x36abfc[_0x7b7e('0x28')]]={'$like':'%'+_0x48fad1[_0x7b7e('0x30')]['filter']+'%'};return _0x1e6280;}})});}_0x21a15=_[_0x7b7e('0x3c')]({},_0x21a15,_0x48fad1[_0x7b7e('0x3e')]);var _0x213a8c={'where':_0x21a15[_0x7b7e('0x3a')]};return db['JscriptySessionReport'][_0x7b7e('0x1d')](_0x213a8c)[_0x7b7e('0x27')](function(_0x3d5280){_0x57b9da['count']=_0x3d5280;if(_0x48fad1['query'][_0x7b7e('0x3f')]){_0x21a15['include']=[{'all':!![]}];}return db[_0x7b7e('0x2c')][_0x7b7e('0x40')](_0x21a15);})['then'](function(_0xa5daaa){_0x57b9da[_0x7b7e('0x41')]=_0xa5daaa;return _0x57b9da;})[_0x7b7e('0x27')](respondWithFilteredResult(_0x6a1e71,_0x21a15))[_0x7b7e('0x42')](handleError(_0x6a1e71,null));};exports[_0x7b7e('0x43')]=function(_0x435de5,_0xc888e4){var _0x1d9bb9={'raw':!![],'where':{'id':_0x435de5['params']['id']}},_0x157871={};_0x157871['model']=_[_0x7b7e('0x31')](db['JscriptySessionReport'][_0x7b7e('0x44')]);_0x157871['query']=_['keys'](_0x435de5[_0x7b7e('0x30')]);_0x157871['filters']=_[_0x7b7e('0x34')](_0x157871['model'],_0x157871[_0x7b7e('0x30')]);_0x1d9bb9[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x157871[_0x7b7e('0x2f')],qs['fields'](_0x435de5[_0x7b7e('0x30')][_0x7b7e('0x35')]));_0x1d9bb9[_0x7b7e('0x33')]=_0x1d9bb9[_0x7b7e('0x33')][_0x7b7e('0x45')]?_0x1d9bb9[_0x7b7e('0x33')]:_0x157871['model'];if(_0x435de5['query']['includeAll']){_0x1d9bb9[_0x7b7e('0x46')]=[{'all':!![]}];}_0x1d9bb9=_[_0x7b7e('0x3c')]({},_0x1d9bb9,_0x435de5[_0x7b7e('0x3e')]);return db[_0x7b7e('0x2c')][_0x7b7e('0x47')](_0x1d9bb9)[_0x7b7e('0x27')](handleEntityNotFound(_0xc888e4,null))['then'](respondWithResult(_0xc888e4,null))[_0x7b7e('0x42')](handleError(_0xc888e4,null));};exports[_0x7b7e('0x48')]=function(_0x5a0832,_0x5efcb8){return db[_0x7b7e('0x2c')][_0x7b7e('0x48')](_0x5a0832[_0x7b7e('0x49')],{})[_0x7b7e('0x27')](respondWithResult(_0x5efcb8,0xc9))[_0x7b7e('0x42')](handleError(_0x5efcb8,null));};exports[_0x7b7e('0x25')]=function(_0x590154,_0x2673eb){if(_0x590154['body']['id']){delete _0x590154[_0x7b7e('0x49')]['id'];}return db[_0x7b7e('0x2c')][_0x7b7e('0x47')]({'where':{'id':_0x590154[_0x7b7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2673eb,null))[_0x7b7e('0x27')](saveUpdates(_0x590154[_0x7b7e('0x49')],null))[_0x7b7e('0x27')](respondWithResult(_0x2673eb,null))[_0x7b7e('0x42')](handleError(_0x2673eb,null));};exports[_0x7b7e('0x26')]=function(_0x5cce7c,_0x14001c){return db[_0x7b7e('0x2c')][_0x7b7e('0x47')]({'where':{'id':_0x5cce7c[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x27')](handleEntityNotFound(_0x14001c,null))['then'](removeEntity(_0x14001c,null))[_0x7b7e('0x42')](handleError(_0x14001c,null));};exports[_0x7b7e('0x4b')]=function(_0x46d4ee,_0x3280fa){return db[_0x7b7e('0x2c')][_0x7b7e('0x4b')]()[_0x7b7e('0x27')](respondWithResult(_0x3280fa,null))['catch'](handleError(_0x3280fa,null));};exports[_0x7b7e('0x4c')]=function(_0x5d7c89,_0x16730c,_0x766a54){var _0x570303={'raw':!![],'where':{}};var _0x36f1be={};var _0x44e3a0={'count':0x0,'rows':[]};return db[_0x7b7e('0x2c')][_0x7b7e('0x4d')]({'where':{'id':_0x5d7c89[_0x7b7e('0x4a')]['id']}})[_0x7b7e('0x27')](handleEntityNotFound(_0x16730c,null))[_0x7b7e('0x27')](function(_0x5f15ce){if(_0x5f15ce){_0x36f1be[_0x7b7e('0x2f')]=_[_0x7b7e('0x31')](db[_0x7b7e('0x4e')][_0x7b7e('0x44')]);_0x36f1be['query']=_['keys'](_0x5d7c89['query']);_0x36f1be[_0x7b7e('0x32')]=_[_0x7b7e('0x34')](_0x36f1be[_0x7b7e('0x2f')],_0x36f1be['query']);_0x570303['attributes']=_[_0x7b7e('0x34')](_0x36f1be[_0x7b7e('0x2f')],qs['fields'](_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x35')]));_0x570303[_0x7b7e('0x33')]=_0x570303['attributes'][_0x7b7e('0x45')]?_0x570303[_0x7b7e('0x33')]:_0x36f1be['model'];if(!_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x36')](_0x7b7e('0x37'))){_0x570303[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x1f')]);_0x570303[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d7c89['query'][_0x7b7e('0x1e')]);}_0x570303[_0x7b7e('0x38')]=qs['sort'](_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x39')]);_0x570303[_0x7b7e('0x3a')]=qs['filters'](_[_0x7b7e('0x3b')](_0x5d7c89['query'],_0x36f1be[_0x7b7e('0x32')]));_0x570303[_0x7b7e('0x3a')]['SessionId']=_0x5f15ce['id'];if(_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x4f')]){_0x570303['where']=_[_0x7b7e('0x3c')](_0x570303[_0x7b7e('0x3a')],{'$or':_[_0x7b7e('0x2b')](_0x570303[_0x7b7e('0x33')],function(_0x5eb32c){var _0x101896={};_0x101896[_0x5eb32c]={'$like':'%'+_0x5d7c89[_0x7b7e('0x30')][_0x7b7e('0x4f')]+'%'};return _0x101896;})});}_0x570303=_[_0x7b7e('0x3c')]({},_0x570303,_0x5d7c89[_0x7b7e('0x3e')]);return db[_0x7b7e('0x4e')][_0x7b7e('0x1d')]({'where':_0x570303[_0x7b7e('0x3a')]})[_0x7b7e('0x27')](function(_0x13c676){_0x44e3a0['count']=_0x13c676;if(_0x5d7c89[_0x7b7e('0x30')]['includeAll']){_0x570303['include']=[{'all':!![]}];}return db[_0x7b7e('0x4e')][_0x7b7e('0x40')](_0x570303);})[_0x7b7e('0x27')](function(_0x3dfd33){_0x44e3a0['rows']=_0x3dfd33;return _0x44e3a0;});}})[_0x7b7e('0x27')](respondWithFilteredResult(_0x16730c,_0x570303))[_0x7b7e('0x42')](handleError(_0x16730c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6d8d7ff..a5425e8 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 _0xe070=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions'];(function(_0x46f140,_0x365170){var _0x281a87=function(_0xe5e40e){while(--_0xe5e40e){_0x46f140['push'](_0x46f140['shift']());}};_0x281a87(++_0x365170);}(_0xe070,0x108));var _0x0e07=function(_0x36c55d,_0x1c8efa){_0x36c55d=_0x36c55d-0x0;var _0xa16625=_0xe070[_0x36c55d];return _0xa16625;};'use strict';var _=require(_0x0e07('0x0'));var util=require(_0x0e07('0x1'));var logger=require(_0x0e07('0x2'))(_0x0e07('0x3'));var moment=require(_0x0e07('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e07('0x6'));var config=require(_0x0e07('0x7'));var attributes=require(_0x0e07('0x8'));module['exports']=function(_0x5d767e,_0x419c16){return _0x5d767e[_0x0e07('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x0e07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4612=['util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x5dbb3e,_0x4b494d){var _0x138d23=function(_0x414fb4){while(--_0x414fb4){_0x5dbb3e['push'](_0x5dbb3e['shift']());}};_0x138d23(++_0x4b494d);}(_0x4612,0xe6));var _0x2461=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4612[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2461('0x0'));var util=require(_0x2461('0x1'));var logger=require('../../config/logger')(_0x2461('0x2'));var moment=require(_0x2461('0x3'));var BPromise=require(_0x2461('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2461('0x5'));var rimraf=require(_0x2461('0x6'));var config=require('../../config/environment');var attributes=require(_0x2461('0x7'));module['exports']=function(_0x573126,_0x20cc6d){return _0x573126[_0x2461('0x8')](_0x2461('0x9'),attributes,{'tableName':_0x2461('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 0b11adb..285b68e 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 _0xb74d=['request\x20sent','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb74d,0x16e));var _0xdb74=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xb74d[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xdb74('0x0'));var util=require('util');var moment=require(_0xdb74('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb74('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb74('0x3'))['db'];var utils=require(_0xdb74('0x4'));var logger=require(_0xdb74('0x5'))('rpc');var config=require(_0xdb74('0x6'));var jayson=require(_0xdb74('0x7'));var client=jayson[_0xdb74('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5183ae,_0xfc6f47,_0x4bf15e){return new BPromise(function(_0x3e44b7,_0x2655f3){return client['request'](_0x5183ae,_0x4bf15e)[_0xdb74('0x9')](function(_0x5370df){logger[_0xdb74('0xa')](_0xdb74('0xb'),_0xfc6f47,'request\x20sent');logger[_0xdb74('0xc')](_0xdb74('0xd'),_0xfc6f47,_0xdb74('0xe'),JSON['stringify'](_0x5370df));if(_0x5370df['error']){if(_0x5370df[_0xdb74('0xf')][_0xdb74('0x10')]===0x1f4){logger[_0xdb74('0xf')](_0xdb74('0xb'),_0xfc6f47,_0x5370df[_0xdb74('0xf')][_0xdb74('0x11')]);return _0x2655f3(_0x5370df[_0xdb74('0xf')][_0xdb74('0x11')]);}logger[_0xdb74('0xf')](_0xdb74('0xb'),_0xfc6f47,_0x5370df[_0xdb74('0xf')][_0xdb74('0x11')]);return _0x3e44b7(_0x5370df[_0xdb74('0xf')]['message']);}else{logger[_0xdb74('0xa')](_0xdb74('0xb'),_0xfc6f47,_0xdb74('0xe'));_0x3e44b7(_0x5370df[_0xdb74('0x12')]['message']);}})['catch'](function(_0xc9548c){logger[_0xdb74('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0xfc6f47,_0xc9548c);_0x2655f3(_0xc9548c);});});} \ No newline at end of file +var _0x4c6b=['http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1c63a4,_0x250c56){var _0x1185f5=function(_0x4a39f1){while(--_0x4a39f1){_0x1c63a4['push'](_0x1c63a4['shift']());}};_0x1185f5(++_0x250c56);}(_0x4c6b,0xe4));var _0xb4c6=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x4c6b[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xb4c6('0x0'));var util=require(_0xb4c6('0x1'));var moment=require(_0xb4c6('0x2'));var BPromise=require(_0xb4c6('0x3'));var rs=require(_0xb4c6('0x4'));var fs=require('fs');var Redis=require(_0xb4c6('0x5'));var db=require(_0xb4c6('0x6'))['db'];var utils=require(_0xb4c6('0x7'));var logger=require(_0xb4c6('0x8'))('rpc');var config=require(_0xb4c6('0x9'));var jayson=require(_0xb4c6('0xa'));var client=jayson[_0xb4c6('0xb')][_0xb4c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31b3f3,_0x19a7e2,_0x56a8bf){return new BPromise(function(_0x3b64ba,_0x5a9952){return client[_0xb4c6('0xd')](_0x31b3f3,_0x56a8bf)[_0xb4c6('0xe')](function(_0xd9ce5f){logger[_0xb4c6('0xf')](_0xb4c6('0x10'),_0x19a7e2,_0xb4c6('0x11'));logger[_0xb4c6('0x12')](_0xb4c6('0x13'),_0x19a7e2,_0xb4c6('0x11'),JSON[_0xb4c6('0x14')](_0xd9ce5f));if(_0xd9ce5f[_0xb4c6('0x15')]){if(_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x16')]===0x1f4){logger[_0xb4c6('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x19a7e2,_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x17')]);return _0x5a9952(_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x17')]);}logger[_0xb4c6('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x19a7e2,_0xd9ce5f[_0xb4c6('0x15')]['message']);return _0x3b64ba(_0xd9ce5f[_0xb4c6('0x15')][_0xb4c6('0x17')]);}else{logger['info'](_0xb4c6('0x10'),_0x19a7e2,_0xb4c6('0x11'));_0x3b64ba(_0xd9ce5f['result'][_0xb4c6('0x17')]);}})['catch'](function(_0x643bc){logger[_0xb4c6('0x15')](_0xb4c6('0x10'),_0x19a7e2,_0x643bc);_0x5a9952(_0x643bc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5b14fe9..d5afa44 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 _0x27ec=['connect-timeout','Router','../../components/auth/service','../../config/environment','get','put','isAuthenticated','update','exports','multer','util','path'];(function(_0xbd7b9b,_0x2a63d0){var _0x118910=function(_0xe2a59b){while(--_0xe2a59b){_0xbd7b9b['push'](_0xbd7b9b['shift']());}};_0x118910(++_0x2a63d0);}(_0x27ec,0x69));var _0xc27e=function(_0x5ffa2f,_0x1ba01c){_0x5ffa2f=_0x5ffa2f-0x0;var _0x3d7cd0=_0x27ec[_0x5ffa2f];return _0x3d7cd0;};'use strict';var multer=require(_0xc27e('0x0'));var util=require(_0xc27e('0x1'));var path=require(_0xc27e('0x2'));var timeout=require(_0xc27e('0x3'));var express=require('express');var router=express[_0xc27e('0x4')]();var auth=require(_0xc27e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc27e('0x6'));var controller=require('./license.controller');router[_0xc27e('0x7')]('/',controller['index']);router[_0xc27e('0x8')]('/:id',auth[_0xc27e('0x9')](),controller[_0xc27e('0xa')]);module[_0xc27e('0xb')]=router; \ No newline at end of file +var _0x931f=['get','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x444389,_0x3f91ea){var _0x29a308=function(_0x50b058){while(--_0x50b058){_0x444389['push'](_0x444389['shift']());}};_0x29a308(++_0x3f91ea);}(_0x931f,0x18d));var _0xf931=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x931f[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var path=require('path');var timeout=require(_0xf931('0x2'));var express=require(_0xf931('0x3'));var router=express[_0xf931('0x4')]();var auth=require(_0xf931('0x5'));var interaction=require(_0xf931('0x6'));var config=require(_0xf931('0x7'));var controller=require(_0xf931('0x8'));router[_0xf931('0x9')]('/',controller['index']);router[_0xf931('0xa')]('/:id',auth[_0xf931('0xb')](),controller[_0xf931('0xc')]);module[_0xf931('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d568122..663bbfc 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 _0x31f0=['TEXT','STRING','INTEGER','sequelize'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x31f0,0xb7));var _0x031f=function(_0x3ec68d,_0x223592){_0x3ec68d=_0x3ec68d-0x0;var _0x32105a=_0x31f0[_0x3ec68d];return _0x32105a;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'license':{'type':Sequelize[_0x031f('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x031f('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x031f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','INTEGER'];(function(_0x182baf,_0x1375fb){var _0x4d10f1=function(_0x1e0dde){while(--_0x1e0dde){_0x182baf['push'](_0x182baf['shift']());}};_0x4d10f1(++_0x1375fb);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1421fd,_0x22f5a1){_0x1421fd=_0x1421fd-0x0;var _0x14a7d4=_0xdbf5[_0x1421fd];return _0x14a7d4;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ed86c7b..3aa88b3 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 _0xdb2a=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','query','filters','attributes','intersection','fields','merge','options','update','body','License','params','get','demo','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xdb2a,0x16f));var _0xadb2=function(_0x10490a,_0x53a83d){_0x10490a=_0x10490a-0x0;var _0x3a3ce7=_0xdb2a[_0x10490a];return _0x3a3ce7;};'use strict';var pdf=require(_0xadb2('0x0'));var emlformat=require(_0xadb2('0x1'));var rimraf=require(_0xadb2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadb2('0x3'));var moment=require(_0xadb2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xadb2('0x5'));var util=require('util');var path=require(_0xadb2('0x6'));var sox=require(_0xadb2('0x7'));var csv=require(_0xadb2('0x8'));var ejs=require(_0xadb2('0x9'));var fs=require('fs');var _=require(_0xadb2('0xa'));var squel=require('squel');var crypto=require(_0xadb2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xadb2('0xc'));var toCsv=require(_0xadb2('0x8'));var querystring=require(_0xadb2('0xd'));var Papa=require('papaparse');var Redis=require(_0xadb2('0xe'));var authService=require(_0xadb2('0xf'));var qs=require(_0xadb2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadb2('0x11'));var logger=require('../../config/logger')(_0xadb2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xadb2('0x13'));var db=require(_0xadb2('0x14'))['db'];function respondWithStatusCode(_0x13cf18,_0x6fbe0e){_0x6fbe0e=_0x6fbe0e||0xcc;return function(_0x4a2641){if(_0x4a2641){return _0x13cf18[_0xadb2('0x15')](_0x6fbe0e);}return _0x13cf18[_0xadb2('0x16')](_0x6fbe0e)[_0xadb2('0x17')]();};}function respondWithResult(_0x3d746e,_0x157e51){_0x157e51=_0x157e51||0xc8;return function(_0x40a41e){if(_0x40a41e){return _0x3d746e[_0xadb2('0x16')](_0x157e51)[_0xadb2('0x18')](_0x40a41e);}};}function respondWithFilteredResult(_0x22c30c,_0x52152f){return function(_0x380538){if(_0x380538){var _0x189bf8=_0x380538[_0xadb2('0x19')],_0x5a8a53=_0x52152f[_0xadb2('0x1a')],_0x31ddf1=_0x52152f[_0xadb2('0x1a')]+_0x52152f['limit'],_0x5b9662;if(_0x31ddf1>=_0x189bf8){_0x31ddf1=_0x189bf8;_0x5b9662=0xc8;}else{_0x5b9662=0xce;}_0x22c30c[_0xadb2('0x16')](_0x5b9662);return _0x22c30c[_0xadb2('0x1b')](_0xadb2('0x1c'),_0x5a8a53+'-'+_0x31ddf1+'/'+_0x189bf8)['json'](_0x380538);}return null;};}function patchUpdates(_0x972036){return function(_0x1e3c88){try{jsonpatch[_0xadb2('0x1d')](_0x1e3c88,_0x972036,!![]);}catch(_0x1eeefb){return BPromise[_0xadb2('0x1e')](_0x1eeefb);}return _0x1e3c88[_0xadb2('0x1f')]();};}function saveUpdates(_0xca90c4,_0x2fe01f){return function(_0x263014){if(_0x263014){return _0x263014['update'](_0xca90c4)[_0xadb2('0x20')](function(_0x3ab97e){return _0x3ab97e;});}return null;};}function removeEntity(_0x5ca203,_0x2f7d58){return function(_0x3591d0){if(_0x3591d0){return _0x3591d0[_0xadb2('0x21')]()['then'](function(){_0x5ca203[_0xadb2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6011,_0x33be36){return function(_0x408f3d){if(!_0x408f3d){_0x2f6011[_0xadb2('0x15')](0x194);}return _0x408f3d;};}function handleError(_0x24eb18,_0x1f1575){_0x1f1575=_0x1f1575||0x1f4;return function(_0x20dd83){logger[_0xadb2('0x22')](_0x20dd83[_0xadb2('0x23')]);if(_0x20dd83[_0xadb2('0x24')]){delete _0x20dd83['name'];}_0x24eb18['status'](_0x1f1575)[_0xadb2('0x25')](_0x20dd83);};}var utilLicense=require(_0xadb2('0x13'));exports[_0xadb2('0x26')]=function(_0x37b178,_0x421f05){var _0xec066a={'raw':!![],'where':{'id':0x1}},_0x39819f={};_0x39819f[_0xadb2('0x27')]=_[_0xadb2('0x28')](db['License']['rawAttributes']);_0x39819f[_0xadb2('0x29')]=_['keys'](_0x37b178['query']);_0x39819f[_0xadb2('0x2a')]=_['intersection'](_0x39819f['model'],_0x39819f[_0xadb2('0x29')]);_0xec066a[_0xadb2('0x2b')]=_[_0xadb2('0x2c')](_0x39819f[_0xadb2('0x27')],qs[_0xadb2('0x2d')](_0x37b178[_0xadb2('0x29')][_0xadb2('0x2d')]));_0xec066a[_0xadb2('0x2b')]=_0xec066a[_0xadb2('0x2b')]['length']?_0xec066a[_0xadb2('0x2b')]:_0x39819f[_0xadb2('0x27')];_0xec066a=_[_0xadb2('0x2e')]({},_0xec066a,_0x37b178[_0xadb2('0x2f')]);return utilLicense['getLicense'](_0xec066a)[_0xadb2('0x20')](respondWithResult(_0x421f05,null))['catch'](handleError(_0x421f05,null));};exports[_0xadb2('0x30')]=function(_0x2d8cf3,_0xaa3a0a){if(_0x2d8cf3[_0xadb2('0x31')]['id']){delete _0x2d8cf3[_0xadb2('0x31')]['id'];}return db[_0xadb2('0x32')]['find']({'where':{'id':_0x2d8cf3[_0xadb2('0x33')]['id']}})[_0xadb2('0x20')](handleEntityNotFound(_0xaa3a0a,null))[_0xadb2('0x20')](function(_0x411dcd){var _0x448676=_0x411dcd[_0xadb2('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0x448676,_0x2d8cf3['body']['key']);})['then'](function(_0x468be3){if(!_0x468be3[_0xadb2('0x35')]){return saveUpdates(_0x2d8cf3[_0xadb2('0x31')],null);}return _0x468be3;})['then'](respondWithResult(_0xaa3a0a,null))['catch'](handleError(_0xaa3a0a,null));}; \ No newline at end of file +var _0x4a9c=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','../../config/license/util','model','keys','query','intersection','attributes','fields','options','getLicense','catch','update','body','License','find','checkLicense','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x5df760,_0x1fa2d6){_0x5df760=_0x5df760-0x0;var _0x3b9406=_0x4a9c[_0x5df760];return _0x3b9406;};'use strict';var pdf=require(_0xc4a9('0x0'));var emlformat=require(_0xc4a9('0x1'));var rimraf=require(_0xc4a9('0x2'));var zipdir=require(_0xc4a9('0x3'));var jsonpatch=require(_0xc4a9('0x4'));var rp=require(_0xc4a9('0x5'));var moment=require('moment');var BPromise=require(_0xc4a9('0x6'));var Mustache=require(_0xc4a9('0x7'));var util=require(_0xc4a9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc4a9('0x9'));var ejs=require(_0xc4a9('0xa'));var fs=require('fs');var _=require(_0xc4a9('0xb'));var squel=require(_0xc4a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xc4a9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc4a9('0xe'));var Papa=require(_0xc4a9('0xf'));var Redis=require(_0xc4a9('0x10'));var authService=require(_0xc4a9('0x11'));var qs=require(_0xc4a9('0x12'));var as=require(_0xc4a9('0x13'));var hardwareService=require(_0xc4a9('0x14'));var logger=require(_0xc4a9('0x15'))(_0xc4a9('0x16'));var utils=require(_0xc4a9('0x17'));var config=require(_0xc4a9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4a9('0x19'))['db'];function respondWithStatusCode(_0x3ac5f1,_0x30e778){_0x30e778=_0x30e778||0xcc;return function(_0x508d89){if(_0x508d89){return _0x3ac5f1[_0xc4a9('0x1a')](_0x30e778);}return _0x3ac5f1[_0xc4a9('0x1b')](_0x30e778)['end']();};}function respondWithResult(_0x57262c,_0x805c71){_0x805c71=_0x805c71||0xc8;return function(_0x573459){if(_0x573459){return _0x57262c[_0xc4a9('0x1b')](_0x805c71)[_0xc4a9('0x1c')](_0x573459);}};}function respondWithFilteredResult(_0x3a955e,_0x2a48e6){return function(_0x5b16d3){if(_0x5b16d3){var _0x51d842=_0x5b16d3['count'],_0xaaecf0=_0x2a48e6[_0xc4a9('0x1d')],_0x585f41=_0x2a48e6[_0xc4a9('0x1d')]+_0x2a48e6['limit'],_0x5e83dc;if(_0x585f41>=_0x51d842){_0x585f41=_0x51d842;_0x5e83dc=0xc8;}else{_0x5e83dc=0xce;}_0x3a955e[_0xc4a9('0x1b')](_0x5e83dc);return _0x3a955e['set'](_0xc4a9('0x1e'),_0xaaecf0+'-'+_0x585f41+'/'+_0x51d842)[_0xc4a9('0x1c')](_0x5b16d3);}return null;};}function patchUpdates(_0x3c0327){return function(_0x4eec0e){try{jsonpatch[_0xc4a9('0x1f')](_0x4eec0e,_0x3c0327,!![]);}catch(_0x21698c){return BPromise[_0xc4a9('0x20')](_0x21698c);}return _0x4eec0e[_0xc4a9('0x21')]();};}function saveUpdates(_0xedb6f0,_0x5707f6){return function(_0x17d723){if(_0x17d723){return _0x17d723['update'](_0xedb6f0)[_0xc4a9('0x22')](function(_0x1e2840){return _0x1e2840;});}return null;};}function removeEntity(_0x1ff265,_0x2dadf1){return function(_0x56dc6b){if(_0x56dc6b){return _0x56dc6b[_0xc4a9('0x23')]()[_0xc4a9('0x22')](function(){_0x1ff265['status'](0xcc)[_0xc4a9('0x24')]();});}};}function handleEntityNotFound(_0x29cbc6,_0x5f017a){return function(_0x127e17){if(!_0x127e17){_0x29cbc6[_0xc4a9('0x1a')](0x194);}return _0x127e17;};}function handleError(_0x4b7c94,_0x56a436){_0x56a436=_0x56a436||0x1f4;return function(_0x10f05f){logger[_0xc4a9('0x25')](_0x10f05f[_0xc4a9('0x26')]);if(_0x10f05f[_0xc4a9('0x27')]){delete _0x10f05f[_0xc4a9('0x27')];}_0x4b7c94[_0xc4a9('0x1b')](_0x56a436)[_0xc4a9('0x28')](_0x10f05f);};}var utilLicense=require(_0xc4a9('0x29'));exports['index']=function(_0x56cd22,_0x2fc199){var _0xa31b6f={'raw':!![],'where':{'id':0x1}},_0x48bb2c={};_0x48bb2c[_0xc4a9('0x2a')]=_[_0xc4a9('0x2b')](db['License']['rawAttributes']);_0x48bb2c[_0xc4a9('0x2c')]=_[_0xc4a9('0x2b')](_0x56cd22[_0xc4a9('0x2c')]);_0x48bb2c['filters']=_[_0xc4a9('0x2d')](_0x48bb2c[_0xc4a9('0x2a')],_0x48bb2c['query']);_0xa31b6f[_0xc4a9('0x2e')]=_[_0xc4a9('0x2d')](_0x48bb2c[_0xc4a9('0x2a')],qs[_0xc4a9('0x2f')](_0x56cd22['query']['fields']));_0xa31b6f[_0xc4a9('0x2e')]=_0xa31b6f['attributes']['length']?_0xa31b6f[_0xc4a9('0x2e')]:_0x48bb2c[_0xc4a9('0x2a')];_0xa31b6f=_['merge']({},_0xa31b6f,_0x56cd22[_0xc4a9('0x30')]);return utilLicense[_0xc4a9('0x31')](_0xa31b6f)['then'](respondWithResult(_0x2fc199,null))[_0xc4a9('0x32')](handleError(_0x2fc199,null));};exports[_0xc4a9('0x33')]=function(_0x1e96e7,_0x3152a5){if(_0x1e96e7[_0xc4a9('0x34')]['id']){delete _0x1e96e7['body']['id'];}return db[_0xc4a9('0x35')][_0xc4a9('0x36')]({'where':{'id':_0x1e96e7['params']['id']}})['then'](handleEntityNotFound(_0x3152a5,null))[_0xc4a9('0x22')](function(_0x48e8bd){var _0x119996=_0x48e8bd['get']({'plain':!![]});return utilLicense[_0xc4a9('0x37')](_0x119996,_0x1e96e7['body']['key']);})[_0xc4a9('0x22')](function(_0x8ec037){if(!_0x8ec037[_0xc4a9('0x38')]){return saveUpdates(_0x1e96e7[_0xc4a9('0x34')],null);}return _0x8ec037;})[_0xc4a9('0x22')](respondWithResult(_0x3152a5,null))[_0xc4a9('0x32')](handleError(_0x3152a5,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ccfe3e8..088a10b 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 _0x6a8e=['moment','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','util','api'];(function(_0x156854,_0x1a7e34){var _0x10c4fb=function(_0x56e121){while(--_0x56e121){_0x156854['push'](_0x156854['shift']());}};_0x10c4fb(++_0x1a7e34);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x39414d,_0x26b932){_0x39414d=_0x39414d-0x0;var _0x5e2c82=_0x6a8e[_0x39414d];return _0x5e2c82;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb8e=['../../config/logger','moment','request-promise','../../config/environment','./license.attributes','define','License','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb8e,0xd6));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefb8('0x0'));var util=require(_0xefb8('0x1'));var logger=require(_0xefb8('0x2'))('api');var moment=require(_0xefb8('0x3'));var BPromise=require('bluebird');var rp=require(_0xefb8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xefb8('0x5'));var attributes=require(_0xefb8('0x6'));module['exports']=function(_0x69e33a,_0x2f053d){return _0x69e33a[_0xefb8('0x7')](_0xefb8('0x8'),attributes,{'tableName':'license','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 d9f4f88..fdb911f 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 _0x115a=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x115a,0x91));var _0xa115=function(_0x31c93b,_0x37c4af){_0x31c93b=_0x31c93b-0x0;var _0x20018e=_0x115a[_0x31c93b];return _0x20018e;};'use strict';var _=require(_0xa115('0x0'));var util=require(_0xa115('0x1'));var moment=require(_0xa115('0x2'));var BPromise=require(_0xa115('0x3'));var rs=require(_0xa115('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa115('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa115('0x6'))(_0xa115('0x7'));var config=require(_0xa115('0x8'));var jayson=require(_0xa115('0x9'));var client=jayson[_0xa115('0xa')][_0xa115('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567cb3,_0x2499eb,_0x149d01){return new BPromise(function(_0x291bec,_0x2a7527){return client[_0xa115('0xc')](_0x567cb3,_0x149d01)[_0xa115('0xd')](function(_0xd6f607){logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));logger[_0xa115('0x11')]('License,\x20%s,\x20%s,\x20%s',_0x2499eb,_0xa115('0x10'),JSON[_0xa115('0x12')](_0xd6f607));if(_0xd6f607[_0xa115('0x13')]){if(_0xd6f607[_0xa115('0x13')]['code']===0x1f4){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x2a7527(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}logger[_0xa115('0x13')]('License,\x20%s,\x20%s',_0x2499eb,_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);return _0x291bec(_0xd6f607[_0xa115('0x13')][_0xa115('0x14')]);}else{logger[_0xa115('0xe')](_0xa115('0xf'),_0x2499eb,_0xa115('0x10'));_0x291bec(_0xd6f607[_0xa115('0x15')][_0xa115('0x14')]);}})[_0xa115('0x16')](function(_0x30c06b){logger[_0xa115('0x13')](_0xa115('0xf'),_0x2499eb,_0x30c06b);_0x2a7527(_0x30c06b);});});} \ No newline at end of file +var _0xd52d=['jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1408ec,_0x5adec8){var _0x5f40c9=function(_0x4444fd){while(--_0x4444fd){_0x1408ec['push'](_0x1408ec['shift']());}};_0x5f40c9(++_0x5adec8);}(_0xd52d,0x1c7));var _0xdd52=function(_0x1a9e06,_0x3086ce){_0x1a9e06=_0x1a9e06-0x0;var _0xe772b0=_0xd52d[_0x1a9e06];return _0xe772b0;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9c17611..b57df6a 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 _0xcedf=['post','/:id/dispositions','addDisposition','addAnswer','/:id/out_servers','addSmtp','addInteraction','addApplications','send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./mailAccount.controller','isAuthenticated','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents'];(function(_0x262a19,_0x534cf7){var _0x2fcdc0=function(_0x4901ce){while(--_0x4901ce){_0x262a19['push'](_0x262a19['shift']());}};_0x2fcdc0(++_0x534cf7);}(_0xcedf,0x1b6));var _0xfced=function(_0x342a32,_0x8aeac1){_0x342a32=_0x342a32-0x0;var _0x4f52fd=_0xcedf[_0x342a32];return _0x4f52fd;};'use strict';var multer=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var path=require(_0xfced('0x2'));var timeout=require(_0xfced('0x3'));var express=require('express');var router=express[_0xfced('0x4')]();var auth=require(_0xfced('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfced('0x6'));router['get']('/',auth[_0xfced('0x7')](),controller['index']);router[_0xfced('0x8')]('/describe',auth[_0xfced('0x7')](),controller['describe']);router['get'](_0xfced('0x9'),auth[_0xfced('0x7')](),controller[_0xfced('0xa')]);router[_0xfced('0x8')]('/:id/dispositions',auth[_0xfced('0x7')](),controller[_0xfced('0xb')]);router[_0xfced('0x8')](_0xfced('0xc'),auth[_0xfced('0x7')](),controller[_0xfced('0xd')]);router[_0xfced('0x8')](_0xfced('0xe'),auth[_0xfced('0x7')](),controller['getImap']);router[_0xfced('0x8')]('/:id/out_servers',auth[_0xfced('0x7')](),controller[_0xfced('0xf')]);router[_0xfced('0x8')](_0xfced('0x10'),auth['isAuthenticated'](),controller[_0xfced('0x11')]);router[_0xfced('0x8')](_0xfced('0x12'),auth[_0xfced('0x7')](),controller[_0xfced('0x13')]);router[_0xfced('0x8')](_0xfced('0x14'),auth[_0xfced('0x7')](),controller['getMessages']);router[_0xfced('0x8')]('/:id/verify',auth[_0xfced('0x7')](),controller[_0xfced('0x15')]);router[_0xfced('0x8')](_0xfced('0x16'),auth[_0xfced('0x7')](),controller[_0xfced('0x17')]);router[_0xfced('0x18')](_0xfced('0x19'),auth[_0xfced('0x7')](),controller[_0xfced('0x1a')]);router['post'](_0xfced('0xc'),auth[_0xfced('0x7')](),controller[_0xfced('0x1b')]);router[_0xfced('0x18')]('/',auth[_0xfced('0x7')](),controller['create']);router['post'](_0xfced('0xe'),auth[_0xfced('0x7')](),controller['addImap']);router[_0xfced('0x18')](_0xfced('0x1c'),auth[_0xfced('0x7')](),controller[_0xfced('0x1d')]);router[_0xfced('0x18')](_0xfced('0x10'),auth['isAuthenticated'](),controller[_0xfced('0x1e')]);router[_0xfced('0x18')](_0xfced('0x12'),auth[_0xfced('0x7')](),controller[_0xfced('0x1f')]);router['post']('/:id/send',auth[_0xfced('0x7')](),controller[_0xfced('0x20')]);router[_0xfced('0x18')](_0xfced('0x16'),auth['isAuthenticated'](),controller[_0xfced('0x21')]);router['put']('/:id',auth[_0xfced('0x7')](),controller[_0xfced('0x22')]);router['delete'](_0xfced('0x19'),auth['isAuthenticated'](),controller[_0xfced('0x23')]);router[_0xfced('0x24')](_0xfced('0xc'),auth[_0xfced('0x7')](),controller['removeAnswers']);router[_0xfced('0x24')](_0xfced('0xe'),auth[_0xfced('0x7')](),controller[_0xfced('0x25')]);router['delete'](_0xfced('0x1c'),auth[_0xfced('0x7')](),controller[_0xfced('0x26')]);router['delete'](_0xfced('0x9'),auth[_0xfced('0x7')](),controller[_0xfced('0x27')]);router[_0xfced('0x24')](_0xfced('0x16'),auth[_0xfced('0x7')](),controller[_0xfced('0x28')]);module[_0xfced('0x29')]=router; \ No newline at end of file +var _0xa5aa=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x37ea26,_0xd036c1){var _0xb93595=function(_0x248b47){while(--_0x248b47){_0x37ea26['push'](_0x37ea26['shift']());}};_0xb93595(++_0xd036c1);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0xb3b44e,_0x1503cf){_0xb3b44e=_0xb3b44e-0x0;var _0x44f43c=_0xa5aa[_0xb3b44e];return _0x44f43c;};'use strict';var multer=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var path=require('path');var timeout=require(_0xaa5a('0x2'));var express=require(_0xaa5a('0x3'));var router=express[_0xaa5a('0x4')]();var auth=require(_0xaa5a('0x5'));var interaction=require(_0xaa5a('0x6'));var config=require(_0xaa5a('0x7'));var controller=require('./mailAccount.controller');router[_0xaa5a('0x8')]('/',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xa')]);router['get']('/describe',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xb')]);router['get'](_0xaa5a('0xc'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xd')]);router['get'](_0xaa5a('0xe'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0xf')]);router[_0xaa5a('0x8')](_0xaa5a('0x10'),auth[_0xaa5a('0x9')](),controller['getAnswers']);router[_0xaa5a('0x8')](_0xaa5a('0x11'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x12')]);router[_0xaa5a('0x8')](_0xaa5a('0x13'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x14')]);router[_0xaa5a('0x8')](_0xaa5a('0x15'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x16')]);router['get'](_0xaa5a('0x17'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x18')]);router['get'](_0xaa5a('0x19'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x1a')]);router[_0xaa5a('0x8')](_0xaa5a('0x1b'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x1c')]);router[_0xaa5a('0x8')](_0xaa5a('0x1d'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x1e')]);router[_0xaa5a('0x1f')](_0xaa5a('0xe'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x20')]);router[_0xaa5a('0x1f')](_0xaa5a('0x10'),auth['isAuthenticated'](),controller[_0xaa5a('0x21')]);router[_0xaa5a('0x1f')]('/',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x22')]);router['post'](_0xaa5a('0x11'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x23')]);router[_0xaa5a('0x1f')](_0xaa5a('0x13'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x24')]);router[_0xaa5a('0x1f')](_0xaa5a('0x15'),auth['isAuthenticated'](),controller[_0xaa5a('0x25')]);router['post'](_0xaa5a('0x17'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x26')]);router[_0xaa5a('0x1f')](_0xaa5a('0x27'),auth['isAuthenticated'](),controller[_0xaa5a('0x28')]);router[_0xaa5a('0x1f')]('/:id/users',auth[_0xaa5a('0x9')](),controller['addAgents']);router[_0xaa5a('0x29')](_0xaa5a('0xc'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2a')]);router[_0xaa5a('0x2b')](_0xaa5a('0xe'),auth['isAuthenticated'](),controller[_0xaa5a('0x2c')]);router[_0xaa5a('0x2b')]('/:id/canned_answers',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2d')]);router['delete'](_0xaa5a('0x11'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2e')]);router[_0xaa5a('0x2b')](_0xaa5a('0x13'),auth[_0xaa5a('0x9')](),controller['removeSmtp']);router[_0xaa5a('0x2b')](_0xaa5a('0xc'),auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x2f')]);router['delete']('/:id/users',auth[_0xaa5a('0x9')](),controller[_0xaa5a('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a79759c..938544b 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 _0xb06c=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x5aba09,_0x5b2c04){var _0x42e5bd=function(_0x4d8a30){while(--_0x4d8a30){_0x5aba09['push'](_0x5aba09['shift']());}};_0x42e5bd(++_0x5b2c04);}(_0xb06c,0x12d));var _0xcb06=function(_0x6e43e5,_0x109a2a){_0x6e43e5=_0x6e43e5-0x0;var _0x53fff5=_0xb06c[_0x6e43e5];return _0x53fff5;};'use strict';var Sequelize=require(_0xcb06('0x0'));module['exports']={'description':{'type':Sequelize[_0xcb06('0x1')]},'name':{'type':Sequelize[_0xcb06('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcb06('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xcb06('0x2')]},'markAsUnread':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcb06('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xcb06('0x4')](0x2)[_0xcb06('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcb06('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb06('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcb06('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xcb06('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5af730){if(!_0x5af730)this[_0xcb06('0x8')](_0xcb06('0x9'),null);this['setDataValue'](_0xcb06('0xa'),_0x5af730);}}}; \ No newline at end of file +var _0xfb9a=['BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x40b6db,_0x2a1fbb){var _0x3eaa81=function(_0x203e91){while(--_0x203e91){_0x40b6db['push'](_0x40b6db['shift']());}};_0x3eaa81(++_0x2a1fbb);}(_0xfb9a,0xc6));var _0xafb9=function(_0x31b907,_0x52f3db){_0x31b907=_0x31b907-0x0;var _0x3c66fb=_0xfb9a[_0x31b907];return _0x3c66fb;};'use strict';var Sequelize=require(_0xafb9('0x0'));module['exports']={'description':{'type':Sequelize[_0xafb9('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xafb9('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xafb9('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xafb9('0x3')]},'markAsUnread':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xafb9('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xafb9('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xafb9('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xafb9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xafb9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xafb9('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xafb9('0x5'),'set':function(_0x2f2a92){if(!_0x2f2a92)this[_0xafb9('0x6')]('mandatoryDispositionPauseId',null);this[_0xafb9('0x6')](_0xafb9('0x7'),_0x2f2a92);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index be21c70..879db86 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 _0xa105=['mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','localhost','socket.io-emitter','redis','./mailAccount.socket','register','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','MailAccount','fieldName','type','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','MailServerOut','Pause','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','removeDispositions','addAnswer','find','CannedAnswer','getAnswers','length','removeAnswers','ids','key','email','isNil','active','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','List','Contacts','updatedAt','DESC','%s\x20<%s>','attachments','join','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','secure','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xa105,0xc1));var _0x5a10=function(_0x15bc50,_0x4becd6){_0x15bc50=_0x15bc50-0x0;var _0x55575b=_0xa105[_0x15bc50];return _0x55575b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5a10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a10('0x1'));var jsonpatch=require(_0x5a10('0x2'));var rp=require(_0x5a10('0x3'));var moment=require(_0x5a10('0x4'));var BPromise=require(_0x5a10('0x5'));var Mustache=require(_0x5a10('0x6'));var util=require('util');var path=require(_0x5a10('0x7'));var sox=require(_0x5a10('0x8'));var csv=require(_0x5a10('0x9'));var ejs=require(_0x5a10('0xa'));var fs=require('fs');var _=require(_0x5a10('0xb'));var squel=require(_0x5a10('0xc'));var crypto=require(_0x5a10('0xd'));var jsforce=require(_0x5a10('0xe'));var deskjs=require(_0x5a10('0xf'));var toCsv=require(_0x5a10('0x9'));var querystring=require('querystring');var Papa=require(_0x5a10('0x10'));var Redis=require(_0x5a10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5a10('0x12'));var as=require(_0x5a10('0x13'));var hardwareService=require(_0x5a10('0x14'));var logger=require(_0x5a10('0x15'))(_0x5a10('0x16'));var utils=require(_0x5a10('0x17'));var config=require(_0x5a10('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5a10('0x19'),'port':0x18eb});var socket=require(_0x5a10('0x1a'))(new Redis(config[_0x5a10('0x1b')]));require(_0x5a10('0x1c'))[_0x5a10('0x1d')](socket);var jayson=require(_0x5a10('0x1e'));var client=jayson[_0x5a10('0x1f')][_0x5a10('0x20')]({'port':0x232b});function respondWithRpcPromise(_0xf0bc4e,_0x15459a,_0x490dd2,_0x20f60c){return new BPromise(function(_0x45c4d9,_0x6659e8){var _0x28b4b0=_0x20f60c||client;return _0x28b4b0[_0x5a10('0x21')](_0xf0bc4e,_0x490dd2)['then'](function(_0x265bf5){logger['info'](_0x5a10('0x22'),_0x15459a,_0x5a10('0x23'));logger[_0x5a10('0x24')](_0x5a10('0x25'),_0x15459a,_0x5a10('0x23'),JSON[_0x5a10('0x26')](_0x265bf5));if(_0x265bf5[_0x5a10('0x27')]){if(_0x265bf5[_0x5a10('0x27')]['code']===0x1f4){logger[_0x5a10('0x27')](_0x5a10('0x22'),_0x15459a,_0x265bf5[_0x5a10('0x27')]['message']);return _0x6659e8(_0x265bf5[_0x5a10('0x27')]['message']);}logger[_0x5a10('0x27')](_0x5a10('0x22'),_0x15459a,_0x265bf5[_0x5a10('0x27')][_0x5a10('0x28')]);return _0x45c4d9(_0x265bf5['error'][_0x5a10('0x28')]);}else{logger[_0x5a10('0x29')](_0x5a10('0x22'),_0x15459a,_0x5a10('0x23'));_0x45c4d9(_0x265bf5[_0x5a10('0x2a')][_0x5a10('0x28')]);}})[_0x5a10('0x2b')](function(_0x1cf1f6){logger[_0x5a10('0x27')](_0x5a10('0x22'),_0x15459a,_0x1cf1f6);_0x6659e8(_0x1cf1f6);});});}function respondWithStatusCode(_0xc18fa3,_0x143575){_0x143575=_0x143575||0xcc;return function(_0x1d70a2){if(_0x1d70a2){return _0xc18fa3['sendStatus'](_0x143575);}return _0xc18fa3[_0x5a10('0x2c')](_0x143575)[_0x5a10('0x2d')]();};}function respondWithResult(_0x9b5e85,_0x280d38){_0x280d38=_0x280d38||0xc8;return function(_0x54addd){if(_0x54addd){return _0x9b5e85[_0x5a10('0x2c')](_0x280d38)['json'](_0x54addd);}};}function respondWithFilteredResult(_0x4ac239,_0x54a837){return function(_0x555afd){if(_0x555afd){var _0x2f6b1e=_0x555afd[_0x5a10('0x2e')],_0x40559e=_0x54a837[_0x5a10('0x2f')],_0x44699b=_0x54a837[_0x5a10('0x2f')]+_0x54a837[_0x5a10('0x30')],_0x2b8dd5;if(_0x44699b>=_0x2f6b1e){_0x44699b=_0x2f6b1e;_0x2b8dd5=0xc8;}else{_0x2b8dd5=0xce;}_0x4ac239[_0x5a10('0x2c')](_0x2b8dd5);return _0x4ac239['set'](_0x5a10('0x31'),_0x40559e+'-'+_0x44699b+'/'+_0x2f6b1e)[_0x5a10('0x32')](_0x555afd);}return null;};}function patchUpdates(_0x17096c){return function(_0x405715){try{jsonpatch[_0x5a10('0x33')](_0x405715,_0x17096c,!![]);}catch(_0x130694){return BPromise[_0x5a10('0x34')](_0x130694);}return _0x405715[_0x5a10('0x35')]();};}function saveUpdates(_0x5cd036,_0x580b6c){return function(_0x3f78c4){if(_0x3f78c4){return _0x3f78c4[_0x5a10('0x36')](_0x5cd036)[_0x5a10('0x37')](function(_0x5ecb4e){return _0x5ecb4e;});}return null;};}function removeEntity(_0x173cde,_0x18db56){return function(_0x6ec09b){if(_0x6ec09b){return _0x6ec09b['destroy']()[_0x5a10('0x37')](function(){var _0x513d5b=_0x6ec09b[_0x5a10('0x38')]({'plain':!![]});var _0x2d9e7b='MailAccounts';return db[_0x5a10('0x39')][_0x5a10('0x3a')]({'where':{'type':_0x2d9e7b,'resourceId':_0x513d5b['id']}})['then'](function(){return _0x6ec09b;});})[_0x5a10('0x37')](function(){_0x173cde[_0x5a10('0x2c')](0xcc)[_0x5a10('0x2d')]();});}};}function handleEntityNotFound(_0x37233b,_0x3a9776){return function(_0x42d731){if(!_0x42d731){_0x37233b['sendStatus'](0x194);}return _0x42d731;};}function handleError(_0x36b55a,_0x4e980a){_0x4e980a=_0x4e980a||0x1f4;return function(_0xb3ce59){logger['error'](_0xb3ce59[_0x5a10('0x3b')]);if(_0xb3ce59[_0x5a10('0x3c')]){delete _0xb3ce59[_0x5a10('0x3c')];}_0x36b55a['status'](_0x4e980a)['send'](_0xb3ce59);};}exports[_0x5a10('0x3d')]=function(_0xeb57d2,_0xd2a655){var _0xd33e4e={'include':[{'model':db[_0x5a10('0x3e')],'as':_0x5a10('0x3f')},{'model':db['MailServerOut'],'as':_0x5a10('0x40')},{'model':db['Pause'],'as':_0x5a10('0x41')}]},_0x4d82db={},_0xf5e82b={'count':0x0,'rows':[]};var _0x510f83=_['map'](db[_0x5a10('0x42')]['rawAttributes'],function(_0x561057){return{'name':_0x561057[_0x5a10('0x43')],'type':_0x561057[_0x5a10('0x44')]['key']};});_0x4d82db['model']=_[_0x5a10('0x45')](_0x510f83,_0x5a10('0x3c'));_0x4d82db[_0x5a10('0x46')]=_[_0x5a10('0x47')](_0xeb57d2[_0x5a10('0x46')]);_0x4d82db['filters']=_[_0x5a10('0x48')](_0x4d82db[_0x5a10('0x49')],_0x4d82db['query']);_0xd33e4e['attributes']=_[_0x5a10('0x48')](_0x4d82db[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x4a')]));_0xd33e4e[_0x5a10('0x4b')]=_0xd33e4e[_0x5a10('0x4b')]['length']?_0xd33e4e[_0x5a10('0x4b')]:_0x4d82db[_0x5a10('0x49')];if(!_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0xd33e4e[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x30')]);_0xd33e4e[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0xeb57d2['query'][_0x5a10('0x2f')]);}_0xd33e4e[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x4f')]);_0xd33e4e[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0xeb57d2[_0x5a10('0x46')],_0x4d82db[_0x5a10('0x51')]),_0x510f83);if(_0xeb57d2['query']['filter']){_0xd33e4e[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0xd33e4e[_0x5a10('0x50')],{'$or':_[_0x5a10('0x45')](_0x510f83,function(_0x102f17){if(_0x102f17[_0x5a10('0x44')]!==_0x5a10('0x54')){var _0x39903f={};_0x39903f[_0x102f17[_0x5a10('0x3c')]]={'$like':'%'+_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x39903f;}})});}_0xd33e4e=_[_0x5a10('0x53')]({},_0xd33e4e,_0xeb57d2[_0x5a10('0x56')]);var _0xee710a={'where':_0xd33e4e[_0x5a10('0x50')]};return db['MailAccount'][_0x5a10('0x2e')](_0xee710a)[_0x5a10('0x37')](function(_0x3dd9f2){_0xf5e82b[_0x5a10('0x2e')]=_0x3dd9f2;if(_0xeb57d2[_0x5a10('0x46')][_0x5a10('0x57')]){_0xd33e4e[_0x5a10('0x58')]=[{'all':!![]}];}return db[_0x5a10('0x42')][_0x5a10('0x59')](_0xd33e4e);})[_0x5a10('0x37')](function(_0x3c5c9f){_0xf5e82b[_0x5a10('0x5a')]=_0x3c5c9f;return _0xf5e82b;})['then'](respondWithFilteredResult(_0xd2a655,_0xd33e4e))[_0x5a10('0x2b')](handleError(_0xd2a655,null));};exports[_0x5a10('0x5b')]=function(_0x132290,_0x4730ef){var _0x47bc33={'raw':![],'where':{'id':_0x132290[_0x5a10('0x5c')]['id']},'include':[{'model':db[_0x5a10('0x3e')],'as':_0x5a10('0x3f')},{'model':db[_0x5a10('0x5d')],'as':'Smtp'},{'model':db[_0x5a10('0x5e')],'as':'mandatoryDispositionPause'}]},_0x535fbe={};_0x535fbe[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0x42')]['rawAttributes']);_0x535fbe['query']=_[_0x5a10('0x47')](_0x132290['query']);_0x535fbe[_0x5a10('0x51')]=_[_0x5a10('0x48')](_0x535fbe[_0x5a10('0x49')],_0x535fbe[_0x5a10('0x46')]);_0x47bc33[_0x5a10('0x4b')]=_['intersection'](_0x535fbe[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0x132290[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x47bc33['attributes']=_0x47bc33[_0x5a10('0x4b')]['length']?_0x47bc33[_0x5a10('0x4b')]:_0x535fbe[_0x5a10('0x49')];if(_0x132290['query'][_0x5a10('0x57')]){_0x47bc33['include']=[{'all':!![]}];}_0x47bc33=_['merge']({},_0x47bc33,_0x132290[_0x5a10('0x56')]);return db[_0x5a10('0x42')]['find'](_0x47bc33)[_0x5a10('0x37')](handleEntityNotFound(_0x4730ef,null))[_0x5a10('0x37')](respondWithResult(_0x4730ef,null))[_0x5a10('0x2b')](handleError(_0x4730ef,null));};exports[_0x5a10('0x36')]=function(_0x35a79d,_0x315b7f){if(_0x35a79d[_0x5a10('0x5f')]['id']){delete _0x35a79d[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')]['find']({'where':{'id':_0x35a79d['params']['id']},'include':[{'model':db[_0x5a10('0x3e')],'as':'Imap'},{'model':db[_0x5a10('0x5d')],'as':'Smtp'},{'model':db['Pause'],'as':_0x5a10('0x41')}]})[_0x5a10('0x37')](handleEntityNotFound(_0x315b7f,null))[_0x5a10('0x37')](saveUpdates(_0x35a79d[_0x5a10('0x5f')],null))['then'](function(_0x1e0d4a){if(_0x1e0d4a&&_0x35a79d['body'][_0x5a10('0x3f')]){return db[_0x5a10('0x3e')]['update'](_0x35a79d[_0x5a10('0x5f')][_0x5a10('0x3f')],{'where':{'MailAccountId':_0x1e0d4a['id']}})[_0x5a10('0x37')](function(){return _0x1e0d4a;});}return _0x1e0d4a;})['then'](function(_0x316ba6){if(_0x316ba6&&_0x35a79d[_0x5a10('0x5f')][_0x5a10('0x40')]){return db[_0x5a10('0x5d')][_0x5a10('0x36')](_0x35a79d[_0x5a10('0x5f')][_0x5a10('0x40')],{'where':{'MailAccountId':_0x316ba6['id']}})['then'](function(){return _0x316ba6;});}return _0x316ba6;})['then'](respondWithResult(_0x315b7f,null))[_0x5a10('0x2b')](handleError(_0x315b7f,null));};exports[_0x5a10('0x60')]=function(_0x24c94b,_0x56e286){return db[_0x5a10('0x42')][_0x5a10('0x60')]()[_0x5a10('0x37')](respondWithResult(_0x56e286,null))[_0x5a10('0x2b')](handleError(_0x56e286,null));};exports[_0x5a10('0x61')]=function(_0x2bbddb,_0x53c715,_0x24a316){if(_0x2bbddb['body']['id']){delete _0x2bbddb[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')]['find']({'where':{'id':_0x2bbddb[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x53c715,null))[_0x5a10('0x37')](function(_0x597c24){if(_0x597c24){_0x2bbddb['body'][_0x5a10('0x62')]=_0x597c24['id'];return db[_0x5a10('0x63')][_0x5a10('0x64')](_0x2bbddb[_0x5a10('0x5f')]);}})['then'](respondWithResult(_0x53c715,null))[_0x5a10('0x2b')](handleError(_0x53c715,null));};exports[_0x5a10('0x65')]=function(_0x3cfce3,_0x5c8f3e,_0x59c617){var _0x373247={'raw':![],'where':{}};var _0x341352={};var _0x21579a={'count':0x0,'rows':[]};return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x3cfce3['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x5c8f3e,null))[_0x5a10('0x37')](function(_0x48a964){if(_0x48a964){_0x341352[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0x63')][_0x5a10('0x67')]);_0x341352[_0x5a10('0x46')]=_[_0x5a10('0x47')](_0x3cfce3[_0x5a10('0x46')]);_0x341352[_0x5a10('0x51')]=_['intersection'](_0x341352['model'],_0x341352[_0x5a10('0x46')]);_0x373247[_0x5a10('0x4b')]=_['intersection'](_0x341352[_0x5a10('0x49')],qs['fields'](_0x3cfce3[_0x5a10('0x46')]['fields']));_0x373247[_0x5a10('0x4b')]=_0x373247[_0x5a10('0x4b')]['length']?_0x373247[_0x5a10('0x4b')]:_0x341352[_0x5a10('0x49')];if(!_0x3cfce3['query'][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0x373247['limit']=qs['limit'](_0x3cfce3[_0x5a10('0x46')][_0x5a10('0x30')]);_0x373247[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x3cfce3[_0x5a10('0x46')]['offset']);}_0x373247[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x3cfce3[_0x5a10('0x46')]['sort']);_0x373247[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x3cfce3[_0x5a10('0x46')],_0x341352[_0x5a10('0x51')]));_0x373247[_0x5a10('0x50')][_0x5a10('0x62')]=_0x48a964['id'];if(_0x3cfce3[_0x5a10('0x46')][_0x5a10('0x55')]){_0x373247['where']=_[_0x5a10('0x53')](_0x373247[_0x5a10('0x50')],{'$or':_['map'](_0x373247['attributes'],function(_0x180679){var _0x173aa5={};_0x173aa5[_0x180679]={'$like':'%'+_0x3cfce3[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x173aa5;})});}_0x373247=_[_0x5a10('0x53')]({},_0x373247,_0x3cfce3[_0x5a10('0x56')]);return db[_0x5a10('0x63')][_0x5a10('0x2e')]({'where':_0x373247[_0x5a10('0x50')]})[_0x5a10('0x37')](function(_0x3c96e4){_0x21579a[_0x5a10('0x2e')]=_0x3c96e4;if(_0x3cfce3['query'][_0x5a10('0x57')]){_0x373247[_0x5a10('0x58')]=[{'all':!![]}];}return db[_0x5a10('0x63')]['findAll'](_0x373247);})[_0x5a10('0x37')](function(_0x300dac){_0x21579a['rows']=_0x300dac;return _0x21579a;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x5c8f3e,_0x373247))['catch'](handleError(_0x5c8f3e,null));};exports[_0x5a10('0x68')]=function(_0x448cca,_0xc84012,_0x29953b){return db[_0x5a10('0x42')]['find']({'where':{'id':_0x448cca[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0xc84012,null))[_0x5a10('0x37')](function(_0x2a0f54){if(_0x2a0f54){return _0x2a0f54['removeDispositions'](_0x448cca[_0x5a10('0x46')]['ids']);}})['then'](respondWithStatusCode(_0xc84012,null))[_0x5a10('0x2b')](handleError(_0xc84012,null));};exports[_0x5a10('0x69')]=function(_0xd5c66f,_0x1ba4ba,_0x4869d1){if(_0xd5c66f[_0x5a10('0x5f')]['id']){delete _0xd5c66f[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0xd5c66f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x1ba4ba,null))[_0x5a10('0x37')](function(_0x17efcb){if(_0x17efcb){_0xd5c66f[_0x5a10('0x5f')][_0x5a10('0x62')]=_0x17efcb['id'];return db[_0x5a10('0x6b')][_0x5a10('0x64')](_0xd5c66f[_0x5a10('0x5f')]);}})[_0x5a10('0x37')](respondWithResult(_0x1ba4ba,null))[_0x5a10('0x2b')](handleError(_0x1ba4ba,null));};exports[_0x5a10('0x6c')]=function(_0x34db3f,_0x56d0eb,_0x56d7c0){var _0xfb5207={'raw':![],'where':{}};var _0x2c9997={};var _0x429f91={'count':0x0,'rows':[]};return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x34db3f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x56d0eb,null))[_0x5a10('0x37')](function(_0xa61c07){if(_0xa61c07){_0x2c9997[_0x5a10('0x49')]=_[_0x5a10('0x47')](db['CannedAnswer'][_0x5a10('0x67')]);_0x2c9997['query']=_[_0x5a10('0x47')](_0x34db3f[_0x5a10('0x46')]);_0x2c9997[_0x5a10('0x51')]=_[_0x5a10('0x48')](_0x2c9997['model'],_0x2c9997[_0x5a10('0x46')]);_0xfb5207[_0x5a10('0x4b')]=_['intersection'](_0x2c9997[_0x5a10('0x49')],qs['fields'](_0x34db3f[_0x5a10('0x46')][_0x5a10('0x4a')]));_0xfb5207['attributes']=_0xfb5207[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0xfb5207[_0x5a10('0x4b')]:_0x2c9997[_0x5a10('0x49')];if(!_0x34db3f['query'][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0xfb5207[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x34db3f[_0x5a10('0x46')]['limit']);_0xfb5207[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x34db3f[_0x5a10('0x46')][_0x5a10('0x2f')]);}_0xfb5207[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x34db3f[_0x5a10('0x46')][_0x5a10('0x4f')]);_0xfb5207[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x34db3f[_0x5a10('0x46')],_0x2c9997[_0x5a10('0x51')]));_0xfb5207['where']['MailAccountId']=_0xa61c07['id'];if(_0x34db3f[_0x5a10('0x46')]['filter']){_0xfb5207[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0xfb5207['where'],{'$or':_['map'](_0xfb5207[_0x5a10('0x4b')],function(_0x4eaf50){var _0x598196={};_0x598196[_0x4eaf50]={'$like':'%'+_0x34db3f['query'][_0x5a10('0x55')]+'%'};return _0x598196;})});}_0xfb5207=_['merge']({},_0xfb5207,_0x34db3f[_0x5a10('0x56')]);return db[_0x5a10('0x6b')][_0x5a10('0x2e')]({'where':_0xfb5207[_0x5a10('0x50')]})[_0x5a10('0x37')](function(_0x3efc1c){_0x429f91[_0x5a10('0x2e')]=_0x3efc1c;if(_0x34db3f[_0x5a10('0x46')][_0x5a10('0x57')]){_0xfb5207[_0x5a10('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x5a10('0x59')](_0xfb5207);})[_0x5a10('0x37')](function(_0x2c05b1){_0x429f91[_0x5a10('0x5a')]=_0x2c05b1;return _0x429f91;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x56d0eb,_0xfb5207))[_0x5a10('0x2b')](handleError(_0x56d0eb,null));};exports['removeAnswers']=function(_0x3ea06e,_0x341bac,_0x36e7be){return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x3ea06e[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x341bac,null))[_0x5a10('0x37')](function(_0x30530e){if(_0x30530e){return _0x30530e[_0x5a10('0x6e')](_0x3ea06e[_0x5a10('0x46')][_0x5a10('0x6f')]);}})['then'](respondWithStatusCode(_0x341bac,null))[_0x5a10('0x2b')](handleError(_0x341bac,null));};exports['create']=function(_0x591dc5,_0x29016f){var _0x3fa226={'name':_0x591dc5['body'][_0x5a10('0x3c')],'key':_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x70')],'email':_0x591dc5['body'][_0x5a10('0x71')],'ListId':_0x591dc5[_0x5a10('0x5f')]['ListId'],'active':!_[_0x5a10('0x72')](_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x73')])?_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x73')]:!![],'description':_0x591dc5[_0x5a10('0x5f')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x591dc5['body']['cservice'])){if(_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x74')]){_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x75')]=_0x3fa226[_0x5a10('0x40')]['user']=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x76')];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x77')]=_0x3fa226[_0x5a10('0x40')][_0x5a10('0x78')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x79')];}else{_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7a')]=_0x3fa226['Smtp'][_0x5a10('0x7a')]=![];}_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7b')]=_0x591dc5['body'][_0x5a10('0x3f')][_0x5a10('0x7b')];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7c')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x3f')][_0x5a10('0x7c')];_0x3fa226[_0x5a10('0x40')][_0x5a10('0x7b')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x40')]['host'];_0x3fa226[_0x5a10('0x40')][_0x5a10('0x7c')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x40')]['port'];}else{_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x7d')]=_0x3fa226['Smtp'][_0x5a10('0x7d')]=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x7e')];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x75')]=_0x3fa226[_0x5a10('0x40')]['user']=_0x591dc5['body']['cuser'];_0x3fa226[_0x5a10('0x3f')][_0x5a10('0x77')]=_0x3fa226[_0x5a10('0x40')]['pass']=_0x591dc5[_0x5a10('0x5f')][_0x5a10('0x79')];}return db[_0x5a10('0x42')][_0x5a10('0x64')](_0x3fa226,{'include':[{'model':db[_0x5a10('0x5d')],'as':_0x5a10('0x40')},{'model':db[_0x5a10('0x3e')],'as':_0x5a10('0x3f')}]})['then'](function(_0x3644c3){var _0x582fe4=_0x591dc5[_0x5a10('0x75')]['get']({'plain':!![]});if(!_0x582fe4)throw new Error(_0x5a10('0x7f'));if(_0x582fe4[_0x5a10('0x80')]===_0x5a10('0x75')){var _0x457918=_0x3644c3[_0x5a10('0x38')]({'plain':!![]});return db[_0x5a10('0x81')][_0x5a10('0x6a')]({'where':{'name':_0x5a10('0x82'),'userProfileId':_0x582fe4[_0x5a10('0x83')]},'raw':!![]})[_0x5a10('0x37')](function(_0x4a4cdd){if(_0x4a4cdd&&_0x4a4cdd[_0x5a10('0x84')]===0x0){return db[_0x5a10('0x39')][_0x5a10('0x64')]({'name':_0x457918[_0x5a10('0x3c')],'resourceId':_0x457918['id'],'type':_0x4a4cdd[_0x5a10('0x3c')],'sectionId':_0x4a4cdd['id']},{})[_0x5a10('0x37')](function(){return _0x3644c3;});}else{return _0x3644c3;}})['catch'](function(_0x36e2f5){logger[_0x5a10('0x27')](_0x5a10('0x85'),_0x36e2f5);throw _0x36e2f5;});}return _0x3644c3;})['then'](respondWithResult(_0x29016f,0xc9))[_0x5a10('0x2b')](handleError(_0x29016f,null));};exports[_0x5a10('0x86')]=function(_0x649cfb,_0x1c2051,_0x1238b9){return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x649cfb[_0x5a10('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1c2051,null))['then'](function(_0x4b7fb4){if(_0x4b7fb4){return _0x4b7fb4[_0x5a10('0x86')]();}return null;})[_0x5a10('0x37')](respondWithResult(_0x1c2051,null))[_0x5a10('0x2b')](handleError(_0x1c2051,null));};exports['addImap']=function(_0x21bf97,_0x2ca4ef,_0x3995f7){if(_0x21bf97[_0x5a10('0x5f')]['id']){delete _0x21bf97[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x21bf97[_0x5a10('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2ca4ef,null))[_0x5a10('0x37')](function(_0x19a7bc){if(_0x19a7bc){_0x21bf97[_0x5a10('0x5f')][_0x5a10('0x62')]=_0x19a7bc['id'];return db[_0x5a10('0x3e')]['create'](_0x21bf97[_0x5a10('0x5f')]);}})['then'](respondWithResult(_0x2ca4ef,null))[_0x5a10('0x2b')](handleError(_0x2ca4ef,null));};exports[_0x5a10('0x87')]=function(_0x1c7005,_0x1bc3de,_0x2b84f2){return db['MailAccount'][_0x5a10('0x66')]({'where':{'id':_0x1c7005['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x1bc3de,null))['then'](function(_0x2fd5c9){if(_0x2fd5c9){return _0x2fd5c9[_0x5a10('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x1bc3de,null))[_0x5a10('0x2b')](handleError(_0x1bc3de,null));};exports[_0x5a10('0x89')]=function(_0x4b0661,_0x41fd3c,_0x160ccb){return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x4b0661[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x41fd3c,null))[_0x5a10('0x37')](function(_0x341de6){if(_0x341de6){return _0x341de6[_0x5a10('0x89')]();}return null;})[_0x5a10('0x37')](respondWithResult(_0x41fd3c,null))[_0x5a10('0x2b')](handleError(_0x41fd3c,null));};exports['addSmtp']=function(_0x20c3ec,_0x6175ac,_0x69a9f2){if(_0x20c3ec[_0x5a10('0x5f')]['id']){delete _0x20c3ec[_0x5a10('0x5f')]['id'];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x20c3ec[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x6175ac,null))[_0x5a10('0x37')](function(_0x37124c){if(_0x37124c){_0x20c3ec['body'][_0x5a10('0x62')]=_0x37124c['id'];return db[_0x5a10('0x5d')][_0x5a10('0x64')](_0x20c3ec[_0x5a10('0x5f')]);}})[_0x5a10('0x37')](respondWithResult(_0x6175ac,null))[_0x5a10('0x2b')](handleError(_0x6175ac,null));};exports[_0x5a10('0x8a')]=function(_0x3502b6,_0x524a36,_0x4d6349){return db['MailAccount']['findOne']({'where':{'id':_0x3502b6['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x524a36,null))['then'](function(_0x24ddb5){if(_0x24ddb5){return _0x24ddb5[_0x5a10('0x8b')](null);}return null;})[_0x5a10('0x37')](respondWithStatusCode(_0x524a36,null))[_0x5a10('0x2b')](handleError(_0x524a36,null));};exports[_0x5a10('0x8c')]=function(_0x53a9c7,_0x50f052,_0x449cb8){return db[_0x5a10('0x8d')][_0x5a10('0x6a')]({'where':{'id':_0x53a9c7[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x50f052,null))[_0x5a10('0x37')](function(_0x5d117b){if(_0x5d117b){return _0x5d117b[_0x5a10('0x8c')](_0x53a9c7[_0x5a10('0x5f')]['ids'],_['omit'](_0x53a9c7[_0x5a10('0x5f')],[_0x5a10('0x6f'),'id'])||{});}})[_0x5a10('0x37')](respondWithResult(_0x50f052,null))[_0x5a10('0x2b')](handleError(_0x50f052,null));};exports[_0x5a10('0x8e')]=function(_0x5f34ab,_0x454ad2,_0x183953){var _0x183e40={'raw':![],'where':{}};var _0x38974d={};var _0x1fc0f9={'count':0x0,'rows':[]};return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x5f34ab[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x454ad2,null))['then'](function(_0x4bd802){if(_0x4bd802){_0x38974d[_0x5a10('0x49')]=_[_0x5a10('0x47')](db['MailInteraction']['rawAttributes']);_0x38974d['query']=_[_0x5a10('0x47')](_0x5f34ab[_0x5a10('0x46')]);_0x38974d[_0x5a10('0x51')]=_[_0x5a10('0x48')](_0x38974d[_0x5a10('0x49')],_0x38974d[_0x5a10('0x46')]);_0x183e40[_0x5a10('0x4b')]=_[_0x5a10('0x48')](_0x38974d['model'],qs[_0x5a10('0x4a')](_0x5f34ab[_0x5a10('0x46')]['fields']));_0x183e40[_0x5a10('0x4b')]=_0x183e40[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0x183e40[_0x5a10('0x4b')]:_0x38974d[_0x5a10('0x49')];if(!_0x5f34ab['query']['hasOwnProperty'](_0x5a10('0x4d'))){_0x183e40[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x5f34ab[_0x5a10('0x46')]['limit']);_0x183e40[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x2f')]);}_0x183e40[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x5f34ab['query'][_0x5a10('0x4f')]);_0x183e40[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x5f34ab[_0x5a10('0x46')],_0x38974d['filters']));_0x183e40[_0x5a10('0x50')][_0x5a10('0x62')]=_0x4bd802['id'];if(_0x5f34ab[_0x5a10('0x46')]['filter']){_0x183e40['where']=_['merge'](_0x183e40[_0x5a10('0x50')],{'$or':_[_0x5a10('0x45')](_0x183e40[_0x5a10('0x4b')],function(_0x3bad10){var _0x359653={};_0x359653[_0x3bad10]={'$like':'%'+_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x359653;})});}_0x183e40=_[_0x5a10('0x53')]({},_0x183e40,_0x5f34ab[_0x5a10('0x56')]);return db[_0x5a10('0x8d')][_0x5a10('0x2e')]({'where':_0x183e40[_0x5a10('0x50')]})['then'](function(_0x55252c){_0x1fc0f9['count']=_0x55252c;if(_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x57')]){_0x183e40['include']=[{'model':db[_0x5a10('0x8f')],'as':_0x5a10('0x90'),'required':![]},{'model':db[_0x5a10('0x91')],'as':_0x5a10('0x92'),'attributes':[_0x5a10('0x3c'),_0x5a10('0x93'),_0x5a10('0x94')],'required':![]},{'model':db[_0x5a10('0x95')],'as':'Tags','attributes':['id',_0x5a10('0x3c'),_0x5a10('0x96')],'where':_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x97')]?{'id':_0x5f34ab[_0x5a10('0x46')][_0x5a10('0x97')]}:undefined,'required':_0x5f34ab[_0x5a10('0x46')]['tag']?!![]:![]}];}return db[_0x5a10('0x8d')][_0x5a10('0x59')](_0x183e40);})[_0x5a10('0x37')](function(_0x31cfe2){_0x1fc0f9[_0x5a10('0x5a')]=_0x31cfe2;return _0x1fc0f9;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x454ad2,_0x183e40))['catch'](handleError(_0x454ad2,null));};exports[_0x5a10('0x98')]=function(_0x193f3f,_0x51ad55,_0x3ee1be){return db['MailAccount'][_0x5a10('0x66')]({'where':{'id':_0x193f3f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x51ad55,null))[_0x5a10('0x37')](function(_0x1ca00f){if(_0x1ca00f){return db[_0x5a10('0x99')][_0x5a10('0x9a')](function(_0x4f8bac){return db[_0x5a10('0x9b')][_0x5a10('0x3a')]({'where':{'MailAccountId':_0x193f3f[_0x5a10('0x5c')]['id']},'transaction':_0x4f8bac})['then'](function(_0x23dc65){var _0x586abd=_[_0x5a10('0x45')](_0x193f3f[_0x5a10('0x5f')],function(_0x32f023){_0x32f023['MailAccountId']=_0x193f3f[_0x5a10('0x5c')]['id'];return _0x32f023;});return db[_0x5a10('0x9b')][_0x5a10('0x9c')](_0x586abd,{'transaction':_0x4f8bac});});})['then'](function(){return db[_0x5a10('0x9b')]['findAndCountAll']({'where':{'MailAccountId':_0x193f3f['params']['id']},'order':_0x5a10('0x9d')});});}})[_0x5a10('0x37')](respondWithResult(_0x51ad55,null))[_0x5a10('0x2b')](handleError(_0x51ad55,null));};exports['getApplications']=function(_0x583ae7,_0x34d70b,_0xc01a0a){var _0x27e6b2={};var _0x146411={};var _0x5ab1ba;var _0x1e1685;return db[_0x5a10('0x42')]['findOne']({'where':{'id':_0x583ae7['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x34d70b,null))[_0x5a10('0x37')](function(_0x48b4b4){if(_0x48b4b4){_0x5ab1ba=_0x48b4b4;_0x146411['model']=_[_0x5a10('0x47')](db['MailApplication'][_0x5a10('0x67')]);_0x146411[_0x5a10('0x46')]=_[_0x5a10('0x47')](_0x583ae7['query']);_0x146411['filters']=_[_0x5a10('0x48')](_0x146411['model'],_0x146411[_0x5a10('0x46')]);_0x27e6b2[_0x5a10('0x4b')]=_[_0x5a10('0x48')](_0x146411['model'],qs['fields'](_0x583ae7[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x27e6b2[_0x5a10('0x4b')]=_0x27e6b2['attributes'][_0x5a10('0x6d')]?_0x27e6b2[_0x5a10('0x4b')]:_0x146411[_0x5a10('0x49')];_0x27e6b2[_0x5a10('0x4e')]=qs['sort'](_0x583ae7[_0x5a10('0x46')]['sort']);_0x27e6b2[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x583ae7[_0x5a10('0x46')],_0x146411[_0x5a10('0x51')]));if(_0x583ae7[_0x5a10('0x46')][_0x5a10('0x55')]){_0x27e6b2[_0x5a10('0x50')]=_['merge'](_0x27e6b2[_0x5a10('0x50')],{'$or':_[_0x5a10('0x45')](_0x27e6b2[_0x5a10('0x4b')],function(_0xdb80bd){var _0x3843a2={};_0x3843a2[_0xdb80bd]={'$like':'%'+_0x583ae7[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x3843a2;})});}_0x27e6b2=_[_0x5a10('0x53')]({},_0x27e6b2,_0x583ae7['options']);return _0x5ab1ba[_0x5a10('0x9e')](_0x27e6b2);}})['then'](function(_0x55a3ca){if(_0x55a3ca){_0x1e1685=_0x55a3ca['length'];if(!_0x583ae7['query']['hasOwnProperty'](_0x5a10('0x4d'))){_0x27e6b2['limit']=qs[_0x5a10('0x30')](_0x583ae7[_0x5a10('0x46')][_0x5a10('0x30')]);_0x27e6b2[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x583ae7[_0x5a10('0x46')][_0x5a10('0x2f')]);}return _0x5ab1ba['getApplications'](_0x27e6b2);}})['then'](function(_0x58bff0){if(_0x58bff0){return _0x58bff0?{'count':_0x1e1685,'rows':_0x58bff0}:null;}})['then'](respondWithResult(_0x34d70b,null))[_0x5a10('0x2b')](handleError(_0x34d70b,null));};exports[_0x5a10('0x9f')]=function(_0x154bd1,_0x9e499,_0x5463b7){var _0x843181={'raw':!![],'where':{}};var _0x29b42b={};var _0x38acd9={'count':0x0,'rows':[]};return db['MailAccount'][_0x5a10('0x66')]({'where':{'id':_0x154bd1['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x9e499,null))[_0x5a10('0x37')](function(_0xbc9a1b){if(_0xbc9a1b){_0x29b42b[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0xa0')]['rawAttributes']);_0x29b42b[_0x5a10('0x46')]=_['keys'](_0x154bd1['query']);_0x29b42b['filters']=_[_0x5a10('0x48')](_0x29b42b[_0x5a10('0x49')],_0x29b42b[_0x5a10('0x46')]);_0x843181['attributes']=_[_0x5a10('0x48')](_0x29b42b[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0x154bd1[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x843181['attributes']=_0x843181[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0x843181[_0x5a10('0x4b')]:_0x29b42b[_0x5a10('0x49')];if(!_0x154bd1[_0x5a10('0x46')][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0x843181[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x154bd1[_0x5a10('0x46')][_0x5a10('0x30')]);_0x843181[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x154bd1[_0x5a10('0x46')][_0x5a10('0x2f')]);}_0x843181['order']=qs['sort'](_0x154bd1[_0x5a10('0x46')]['sort']);_0x843181[_0x5a10('0x50')]=qs['filters'](_[_0x5a10('0x52')](_0x154bd1[_0x5a10('0x46')],_0x29b42b[_0x5a10('0x51')]));_0x843181[_0x5a10('0x50')][_0x5a10('0x62')]=_0xbc9a1b['id'];if(_0x154bd1[_0x5a10('0x46')][_0x5a10('0x55')]){_0x843181[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0x843181[_0x5a10('0x50')],{'$or':_['map'](_0x843181['attributes'],function(_0x504543){var _0x54b4c0={};_0x54b4c0[_0x504543]={'$like':'%'+_0x154bd1['query'][_0x5a10('0x55')]+'%'};return _0x54b4c0;})});}if(_0x154bd1['query'][_0x5a10('0xa1')]){var _0xec8f70=_0x154bd1[_0x5a10('0x46')][_0x5a10('0xa1')][_0x5a10('0xa2')](',');var _0x19cbe3={};_0x19cbe3[_0xec8f70[0x0]]={'$gte':moment(_0xec8f70[0x1])[_0x5a10('0xa3')](_0x5a10('0xa4'))};_0x843181[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0x843181[_0x5a10('0x50')],_0x19cbe3);}_0x843181=_['merge']({},_0x843181,_0x154bd1[_0x5a10('0x56')]);return db[_0x5a10('0xa0')][_0x5a10('0x2e')]({'where':_0x843181[_0x5a10('0x50')]})[_0x5a10('0x37')](function(_0x59b371){_0x38acd9[_0x5a10('0x2e')]=_0x59b371;if(_0x154bd1['query'][_0x5a10('0x57')]){_0x843181[_0x5a10('0x58')]=[{'all':!![]}];}return db[_0x5a10('0xa0')][_0x5a10('0x59')](_0x843181);})[_0x5a10('0x37')](function(_0x46249e){_0x38acd9['rows']=_0x46249e;return _0x38acd9;});}})[_0x5a10('0x37')](respondWithFilteredResult(_0x9e499,_0x843181))[_0x5a10('0x2b')](handleError(_0x9e499,null));};exports[_0x5a10('0xa5')]=function(_0x23ce59,_0x5bc8ae,_0x4fa9d4){var _0x169392,_0xc0ccf9={},_0x52e0e0;if(_0x23ce59[_0x5a10('0x5f')]['to']){_0x52e0e0=_0x23ce59[_0x5a10('0x5f')]['to'][_0x5a10('0xa2')](',')[0x0];}return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x23ce59[_0x5a10('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x5a10('0xa6'),'include':[{'model':db[_0x5a10('0x8f')],'as':_0x5a10('0xa7'),'where':{'email':_0x52e0e0},'limit':0x1,'order':[[_0x5a10('0xa8'),_0x5a10('0xa9')]]}]},{'model':db[_0x5a10('0x5d')],'as':_0x5a10('0x40'),'raw':!![]}]})[_0x5a10('0x37')](handleEntityNotFound(_0x5bc8ae,null))[_0x5a10('0x37')](function(_0x22e7be){if(_0x22e7be){_0x169392=_0x22e7be;if(_0x22e7be['Smtp']){if(_[_0x5a10('0x72')](_0x23ce59['body']['from'])){_0x23ce59[_0x5a10('0x5f')]['from']=util[_0x5a10('0xa3')](_0x5a10('0xaa'),_0x22e7be['name'],_0x22e7be[_0x5a10('0x71')]||_0x22e7be['Smtp'][_0x5a10('0x75')]);}if(_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')]&&_0x23ce59[_0x5a10('0x5f')]['attachments'][_0x5a10('0x6d')]){for(var _0x507fc9=0x0;_0x507fc9<_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')][_0x5a10('0x6d')];_0x507fc9+=0x1){_0x23ce59['body'][_0x5a10('0xab')][_0x507fc9]={'filename':_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')][_0x507fc9]['name'],'path':path[_0x5a10('0xac')](config['root'],_0x5a10('0xad'),_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xab')][_0x507fc9][_0x5a10('0xae')])};}}var _0x241fc4={'tls':{'rejectUnauthorized':![]}};if(_[_0x5a10('0x72')](_0x22e7be[_0x5a10('0x40')][_0x5a10('0x7d')])){if(_0x22e7be['Smtp']['authentication']){_0x241fc4['auth']={'user':_0x22e7be[_0x5a10('0x40')][_0x5a10('0x75')],'pass':_0x22e7be[_0x5a10('0x40')][_0x5a10('0x78')]};}_0x241fc4[_0x5a10('0x7b')]=_0x22e7be[_0x5a10('0x40')]['host'];_0x241fc4[_0x5a10('0x7c')]=_0x22e7be['Smtp']['port'];_0x241fc4['secure']=_0x22e7be[_0x5a10('0x40')]['secure'];}else{_0x241fc4[_0x5a10('0x7d')]=_0x22e7be['Smtp'][_0x5a10('0x7d')];_0x241fc4[_0x5a10('0xaf')]={'user':_0x22e7be[_0x5a10('0x40')][_0x5a10('0x75')],'pass':_0x22e7be['Smtp'][_0x5a10('0x78')]};}return respondWithRpcPromise(_0x5a10('0xb0'),_0x5a10('0xb1'),{'account':_0x241fc4,'message':_0x23ce59[_0x5a10('0x5f')]});}else{throw new Error(_0x5a10('0xb2'));}}})['then'](function(_0x322caa){if(_0x322caa){_0xc0ccf9=_0x322caa;if(_0x169392['List']){if(_0x169392[_0x5a10('0xa6')][_0x5a10('0xa7')][_0x5a10('0x6d')]){return _0x169392[_0x5a10('0xa6')]['Contacts'][0x0];}else{return db[_0x5a10('0x8f')][_0x5a10('0x64')](_[_0x5a10('0xb3')](_0x23ce59[_0x5a10('0x5f')],{'firstName':_0x23ce59[_0x5a10('0x5f')]['to'],'email':_0x23ce59[_0x5a10('0x5f')]['to'],'phone':_0x23ce59[_0x5a10('0x5f')]['to'],'ListId':_0x169392[_0x5a10('0xb4')]}));}}else{throw new Error(_0x5a10('0xb2'));}}})[_0x5a10('0x37')](function(_0x135254){if(_0x135254){var _0x356e4a={'UserId':_0x23ce59[_0x5a10('0x75')]['id'],'ContactId':_0x135254['id'],'MailAccountId':_0x169392['id'],'inReplyTo':_0xc0ccf9[_0x5a10('0xb5')],'to':_0x23ce59['body']['from'],'cc':_0x23ce59['body']['cc'],'subject':_0x23ce59['body'][_0x5a10('0xb6')],'attach':_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xb7')],'firstMsgDirection':_0x5a10('0xb8'),'lastMsgAt':moment()['format'](_0x5a10('0xa4')),'lastMsgDirection':_0x5a10('0xb8'),'lastMsgBody':_0x23ce59[_0x5a10('0x5f')][_0x5a10('0x5f')],'Messages':[_[_0x5a10('0x53')](_0x23ce59[_0x5a10('0x5f')],{'messageId':_0xc0ccf9['messageId'],'sentAt':moment()[_0x5a10('0xa3')](_0x5a10('0xa4')),'read':!![],'MailAccountId':_0x169392['id'],'UserId':_0x23ce59[_0x5a10('0x75')]['id'],'ContactId':_0x135254['id']})]};if(_0x23ce59[_0x5a10('0x5f')][_0x5a10('0xb9')]){_0x356e4a=_['merge'](_0x356e4a,_0x23ce59['body'][_0x5a10('0xb9')]);}return db['MailInteraction'][_0x5a10('0x64')](_0x356e4a,{'include':[{'model':db[_0x5a10('0xa0')],'as':_0x5a10('0xba')}]});}})[_0x5a10('0x37')](respondWithResult(_0x5bc8ae,null))[_0x5a10('0x2b')](handleError(_0x5bc8ae,null));};exports[_0x5a10('0xbb')]=function(_0x564a99,_0x587f2f,_0x31d9b4){return db['MailAccount'][_0x5a10('0x6a')]({'where':{'id':_0x564a99[_0x5a10('0x5c')]['id']},'include':[{'model':db[_0x5a10('0x5d')],'as':_0x5a10('0x40'),'raw':!![]}]})[_0x5a10('0x37')](handleEntityNotFound(_0x587f2f,null))[_0x5a10('0x37')](function(_0x14496f){if(_0x14496f&&_0x14496f[_0x5a10('0x40')]){var _0xa2f278={'id':_0x14496f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14496f[_0x5a10('0x40')][_0x5a10('0x7d')]){_0xa2f278[_0x5a10('0x7d')]=_0x14496f[_0x5a10('0x40')][_0x5a10('0x7d')];}else{_0xa2f278[_0x5a10('0x7b')]=_0x14496f[_0x5a10('0x40')][_0x5a10('0x7b')];_0xa2f278['port']=_0x14496f[_0x5a10('0x40')][_0x5a10('0x7c')];_0xa2f278['secure']=_0x14496f[_0x5a10('0x40')][_0x5a10('0xbc')];}if(_0x14496f[_0x5a10('0x40')][_0x5a10('0x7a')]){_0xa2f278[_0x5a10('0xaf')]={'user':_0x14496f[_0x5a10('0x40')][_0x5a10('0x75')],'pass':_0x14496f[_0x5a10('0x40')][_0x5a10('0x78')]};}return respondWithRpcPromise(_0x5a10('0xbd'),_0x5a10('0xbb'),{'account':_0xa2f278});}})['then'](respondWithResult(_0x587f2f,null))[_0x5a10('0x2b')](handleError(_0x587f2f,null));};exports['destroy']=function(_0x3f836f,_0x50da26){return db['MailAccount'][_0x5a10('0x6a')]({'where':{'id':_0x3f836f[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x50da26,null))[_0x5a10('0x37')](function(_0x32d692){if(_0x32d692&&_0x32d692[_0x5a10('0x7d')]){throw new db[(_0x5a10('0xbe'))][(_0x5a10('0xbf'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x32d692;})[_0x5a10('0x37')](removeEntity(_0x50da26,null))[_0x5a10('0x2b')](handleError(_0x50da26,null));};exports[_0x5a10('0xc0')]=function(_0x373917,_0x38b0af,_0x313e76){return db[_0x5a10('0x42')][_0x5a10('0x6a')]({'where':{'id':_0x373917['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x38b0af,null))[_0x5a10('0x37')](function(_0x1bc850){if(_0x1bc850){return _0x1bc850[_0x5a10('0xc0')](_0x373917[_0x5a10('0x5f')][_0x5a10('0x6f')],_['omit'](_0x373917['body'],[_0x5a10('0x6f'),'id'])||{})[_0x5a10('0xc1')](function(_0xf9ce35){for(var _0x20cdf5=0x0;_0x20cdf5<_0x373917[_0x5a10('0x5f')][_0x5a10('0x6f')][_0x5a10('0x6d')];_0x20cdf5+=0x1){socket[_0x5a10('0xc2')](_0x5a10('0xc3'),{'UserId':_0x373917['body']['ids'][_0x20cdf5],'MailAccountId':_0x373917[_0x5a10('0x5c')]['id']});}return _0xf9ce35;});}})['then'](respondWithResult(_0x38b0af,null))[_0x5a10('0x2b')](handleError(_0x38b0af,null));};exports['removeAgents']=function(_0x21d534,_0x319f82,_0x5c7435){return db[_0x5a10('0x42')]['find']({'where':{'id':_0x21d534['params']['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x319f82,null))[_0x5a10('0x37')](function(_0x1770e7){if(_0x1770e7){return _0x1770e7['removeAgents'](_0x21d534[_0x5a10('0x46')][_0x5a10('0x6f')])[_0x5a10('0x37')](function(){if(_[_0x5a10('0xc4')](_0x21d534[_0x5a10('0x46')][_0x5a10('0x6f')])){for(var _0x209b50=0x0;_0x209b50<_0x21d534['query']['ids'][_0x5a10('0x6d')];_0x209b50+=0x1){socket[_0x5a10('0xc2')](_0x5a10('0xc5'),{'UserId':Number(_0x21d534['query'][_0x5a10('0x6f')][_0x209b50]),'MailAccountId':Number(_0x21d534[_0x5a10('0x5c')]['id'])});}}else{socket[_0x5a10('0xc2')](_0x5a10('0xc5'),{'UserId':Number(_0x21d534[_0x5a10('0x46')][_0x5a10('0x6f')]),'MailAccountId':Number(_0x21d534[_0x5a10('0x5c')]['id'])});}});}})[_0x5a10('0x37')](respondWithStatusCode(_0x319f82,null))[_0x5a10('0x2b')](handleError(_0x319f82,null));};exports['getAgents']=function(_0x57b8df,_0x2bbddc,_0x552d06){var _0x1f3beb={};var _0x536fa0={};var _0x480d73;var _0xd31b18;return db[_0x5a10('0x42')][_0x5a10('0x66')]({'where':{'id':_0x57b8df[_0x5a10('0x5c')]['id']}})[_0x5a10('0x37')](handleEntityNotFound(_0x2bbddc,null))[_0x5a10('0x37')](function(_0x3035ce){if(_0x3035ce){_0x480d73=_0x3035ce;_0x536fa0[_0x5a10('0x49')]=_[_0x5a10('0x47')](db[_0x5a10('0x91')][_0x5a10('0x67')]);_0x536fa0['query']=_[_0x5a10('0x47')](_0x57b8df[_0x5a10('0x46')]);_0x536fa0[_0x5a10('0x51')]=_['intersection'](_0x536fa0[_0x5a10('0x49')],_0x536fa0[_0x5a10('0x46')]);_0x1f3beb[_0x5a10('0x4b')]=_[_0x5a10('0x48')](_0x536fa0[_0x5a10('0x49')],qs[_0x5a10('0x4a')](_0x57b8df[_0x5a10('0x46')][_0x5a10('0x4a')]));_0x1f3beb[_0x5a10('0x4b')]=_0x1f3beb[_0x5a10('0x4b')][_0x5a10('0x6d')]?_0x1f3beb[_0x5a10('0x4b')]:_0x536fa0[_0x5a10('0x49')];_0x1f3beb[_0x5a10('0x4e')]=qs[_0x5a10('0x4f')](_0x57b8df['query']['sort']);_0x1f3beb[_0x5a10('0x50')]=qs[_0x5a10('0x51')](_[_0x5a10('0x52')](_0x57b8df[_0x5a10('0x46')],_0x536fa0[_0x5a10('0x51')]));if(_0x57b8df[_0x5a10('0x46')][_0x5a10('0x55')]){_0x1f3beb[_0x5a10('0x50')]=_[_0x5a10('0x53')](_0x1f3beb['where'],{'$or':_[_0x5a10('0x45')](_0x1f3beb[_0x5a10('0x4b')],function(_0x2411a4){var _0x598716={};_0x598716[_0x2411a4]={'$like':'%'+_0x57b8df[_0x5a10('0x46')][_0x5a10('0x55')]+'%'};return _0x598716;})});}_0x1f3beb=_[_0x5a10('0x53')]({},_0x1f3beb,_0x57b8df['options']);return _0x480d73[_0x5a10('0xc6')](_0x1f3beb);}})[_0x5a10('0x37')](function(_0x589da2){if(_0x589da2){_0xd31b18=_0x589da2['length'];if(!_0x57b8df['query'][_0x5a10('0x4c')](_0x5a10('0x4d'))){_0x1f3beb[_0x5a10('0x30')]=qs[_0x5a10('0x30')](_0x57b8df[_0x5a10('0x46')][_0x5a10('0x30')]);_0x1f3beb[_0x5a10('0x2f')]=qs[_0x5a10('0x2f')](_0x57b8df[_0x5a10('0x46')][_0x5a10('0x2f')]);}return _0x480d73[_0x5a10('0xc6')](_0x1f3beb);}})[_0x5a10('0x37')](function(_0x3ef9b3){if(_0x3ef9b3){return _0x3ef9b3?{'count':_0xd31b18,'rows':_0x3ef9b3}:null;}})[_0x5a10('0x37')](respondWithResult(_0x2bbddc,null))[_0x5a10('0x2b')](handleError(_0x2bbddc,null));}; \ No newline at end of file +var _0x6a43=['MailApplication','bulkCreate','getApplications','MailMessage','split','format','send','List','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','secure','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','removeAgents','isArray','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','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','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','apply','reject','save','update','destroy','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','Imap','Smtp','Pause','map','MailAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','params','MailServerOut','mandatoryDispositionPause','rawAttributes','includeAll','merge','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','length','count','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','authentication','host','port','service','password','pass','cpassword','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','color','tag','addApplications','transaction'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x6a43,0xde));var _0x36a4=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x6a43[_0x487b0c];return _0x1adbdc;};'use strict';var pdf=require(_0x36a4('0x0'));var emlformat=require(_0x36a4('0x1'));var rimraf=require(_0x36a4('0x2'));var zipdir=require(_0x36a4('0x3'));var jsonpatch=require(_0x36a4('0x4'));var rp=require(_0x36a4('0x5'));var moment=require(_0x36a4('0x6'));var BPromise=require(_0x36a4('0x7'));var Mustache=require(_0x36a4('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x36a4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x36a4('0xa'));var jsforce=require(_0x36a4('0xb'));var deskjs=require(_0x36a4('0xc'));var toCsv=require(_0x36a4('0x9'));var querystring=require(_0x36a4('0xd'));var Papa=require(_0x36a4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x36a4('0xf'));var as=require(_0x36a4('0x10'));var hardwareService=require(_0x36a4('0x11'));var logger=require(_0x36a4('0x12'))(_0x36a4('0x13'));var utils=require(_0x36a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x36a4('0x15'));var db=require(_0x36a4('0x16'))['db'];config[_0x36a4('0x17')]=_[_0x36a4('0x18')](config[_0x36a4('0x17')],{'host':_0x36a4('0x19'),'port':0x18eb});var socket=require(_0x36a4('0x1a'))(new Redis(config[_0x36a4('0x17')]));require(_0x36a4('0x1b'))[_0x36a4('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x36a4('0x1d')][_0x36a4('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x26b9c6,_0x325cb6,_0x3865f2,_0x33cdd9){return new BPromise(function(_0x528a1a,_0x1ac50b){var _0x5b6347=_0x33cdd9||client;return _0x5b6347[_0x36a4('0x1f')](_0x26b9c6,_0x3865f2)[_0x36a4('0x20')](function(_0x56622d){logger[_0x36a4('0x21')](_0x36a4('0x22'),_0x325cb6,_0x36a4('0x23'));logger[_0x36a4('0x24')](_0x36a4('0x25'),_0x325cb6,'request\x20sent',JSON['stringify'](_0x56622d));if(_0x56622d[_0x36a4('0x26')]){if(_0x56622d[_0x36a4('0x26')][_0x36a4('0x27')]===0x1f4){logger[_0x36a4('0x26')](_0x36a4('0x22'),_0x325cb6,_0x56622d[_0x36a4('0x26')][_0x36a4('0x28')]);return _0x1ac50b(_0x56622d[_0x36a4('0x26')]['message']);}logger['error'](_0x36a4('0x22'),_0x325cb6,_0x56622d['error']['message']);return _0x528a1a(_0x56622d[_0x36a4('0x26')][_0x36a4('0x28')]);}else{logger['info'](_0x36a4('0x22'),_0x325cb6,_0x36a4('0x23'));_0x528a1a(_0x56622d[_0x36a4('0x29')][_0x36a4('0x28')]);}})[_0x36a4('0x2a')](function(_0x3f200d){logger[_0x36a4('0x26')](_0x36a4('0x22'),_0x325cb6,_0x3f200d);_0x1ac50b(_0x3f200d);});});}function respondWithStatusCode(_0x43262d,_0xd43c78){_0xd43c78=_0xd43c78||0xcc;return function(_0x5819d6){if(_0x5819d6){return _0x43262d[_0x36a4('0x2b')](_0xd43c78);}return _0x43262d['status'](_0xd43c78)[_0x36a4('0x2c')]();};}function respondWithResult(_0x4614d2,_0x2cdd75){_0x2cdd75=_0x2cdd75||0xc8;return function(_0x2fb3f9){if(_0x2fb3f9){return _0x4614d2[_0x36a4('0x2d')](_0x2cdd75)[_0x36a4('0x2e')](_0x2fb3f9);}};}function respondWithFilteredResult(_0x41433e,_0x5d6661){return function(_0x3e6148){if(_0x3e6148){var _0x568c1c=_0x3e6148['count'],_0xe0e5d5=_0x5d6661[_0x36a4('0x2f')],_0x265d98=_0x5d6661[_0x36a4('0x2f')]+_0x5d6661[_0x36a4('0x30')],_0x10e98e;if(_0x265d98>=_0x568c1c){_0x265d98=_0x568c1c;_0x10e98e=0xc8;}else{_0x10e98e=0xce;}_0x41433e[_0x36a4('0x2d')](_0x10e98e);return _0x41433e['set']('Content-Range',_0xe0e5d5+'-'+_0x265d98+'/'+_0x568c1c)[_0x36a4('0x2e')](_0x3e6148);}return null;};}function patchUpdates(_0x546944){return function(_0x2cf1fd){try{jsonpatch[_0x36a4('0x31')](_0x2cf1fd,_0x546944,!![]);}catch(_0xe432eb){return BPromise[_0x36a4('0x32')](_0xe432eb);}return _0x2cf1fd[_0x36a4('0x33')]();};}function saveUpdates(_0x2ef25e,_0x44681e){return function(_0x11ddc2){if(_0x11ddc2){return _0x11ddc2[_0x36a4('0x34')](_0x2ef25e)[_0x36a4('0x20')](function(_0xccbf44){return _0xccbf44;});}return null;};}function removeEntity(_0x34635d,_0x5ad72a){return function(_0x2bd5fb){if(_0x2bd5fb){return _0x2bd5fb[_0x36a4('0x35')]()[_0x36a4('0x20')](function(){var _0x228381=_0x2bd5fb['get']({'plain':!![]});var _0xba83a2=_0x36a4('0x36');return db[_0x36a4('0x37')][_0x36a4('0x35')]({'where':{'type':_0xba83a2,'resourceId':_0x228381['id']}})[_0x36a4('0x20')](function(){return _0x2bd5fb;});})[_0x36a4('0x20')](function(){_0x34635d[_0x36a4('0x2d')](0xcc)[_0x36a4('0x2c')]();});}};}function handleEntityNotFound(_0x2ee1d7,_0x34e306){return function(_0x3a8994){if(!_0x3a8994){_0x2ee1d7[_0x36a4('0x2b')](0x194);}return _0x3a8994;};}function handleError(_0x23bb3c,_0x28f8db){_0x28f8db=_0x28f8db||0x1f4;return function(_0x51f03c){logger['error'](_0x51f03c[_0x36a4('0x38')]);if(_0x51f03c[_0x36a4('0x39')]){delete _0x51f03c[_0x36a4('0x39')];}_0x23bb3c[_0x36a4('0x2d')](_0x28f8db)['send'](_0x51f03c);};}exports[_0x36a4('0x3a')]=function(_0x47c8e2,_0x5bd9e0){var _0x426915={'include':[{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')},{'model':db['MailServerOut'],'as':_0x36a4('0x3d')},{'model':db[_0x36a4('0x3e')],'as':'mandatoryDispositionPause'}]},_0x26d019={},_0x568a04={'count':0x0,'rows':[]};var _0x34b1db=_[_0x36a4('0x3f')](db[_0x36a4('0x40')]['rawAttributes'],function(_0x53e5d0){return{'name':_0x53e5d0[_0x36a4('0x41')],'type':_0x53e5d0['type'][_0x36a4('0x42')]};});_0x26d019[_0x36a4('0x43')]=_[_0x36a4('0x3f')](_0x34b1db,_0x36a4('0x39'));_0x26d019[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x47c8e2[_0x36a4('0x44')]);_0x26d019[_0x36a4('0x46')]=_['intersection'](_0x26d019[_0x36a4('0x43')],_0x26d019[_0x36a4('0x44')]);_0x426915[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x26d019[_0x36a4('0x43')],qs[_0x36a4('0x49')](_0x47c8e2[_0x36a4('0x44')]['fields']));_0x426915[_0x36a4('0x47')]=_0x426915[_0x36a4('0x47')]['length']?_0x426915[_0x36a4('0x47')]:_0x26d019['model'];if(!_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x426915['limit']=qs[_0x36a4('0x30')](_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x30')]);_0x426915[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x2f')]);}_0x426915[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x47c8e2['query'][_0x36a4('0x4d')]);_0x426915[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x47c8e2[_0x36a4('0x44')],_0x26d019[_0x36a4('0x46')]),_0x34b1db);if(_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x50')]){_0x426915['where']=_['merge'](_0x426915[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x34b1db,function(_0x27fb97){if(_0x27fb97['type']!=='VIRTUAL'){var _0x3dd42f={};_0x3dd42f[_0x27fb97[_0x36a4('0x39')]]={'$like':'%'+_0x47c8e2[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x3dd42f;}})});}_0x426915=_['merge']({},_0x426915,_0x47c8e2[_0x36a4('0x51')]);var _0x41376e={'where':_0x426915['where']};return db[_0x36a4('0x40')]['count'](_0x41376e)[_0x36a4('0x20')](function(_0x1804e0){_0x568a04['count']=_0x1804e0;if(_0x47c8e2[_0x36a4('0x44')]['includeAll']){_0x426915[_0x36a4('0x52')]=[{'all':!![]}];}return db[_0x36a4('0x40')][_0x36a4('0x53')](_0x426915);})[_0x36a4('0x20')](function(_0x4764e9){_0x568a04['rows']=_0x4764e9;return _0x568a04;})[_0x36a4('0x20')](respondWithFilteredResult(_0x5bd9e0,_0x426915))['catch'](handleError(_0x5bd9e0,null));};exports['show']=function(_0x23bdf9,_0x224280){var _0x3fddf2={'raw':![],'where':{'id':_0x23bdf9[_0x36a4('0x54')]['id']},'include':[{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')},{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d')},{'model':db[_0x36a4('0x3e')],'as':_0x36a4('0x56')}]},_0x5a2975={};_0x5a2975[_0x36a4('0x43')]=_[_0x36a4('0x45')](db['MailAccount'][_0x36a4('0x57')]);_0x5a2975['query']=_[_0x36a4('0x45')](_0x23bdf9[_0x36a4('0x44')]);_0x5a2975[_0x36a4('0x46')]=_[_0x36a4('0x48')](_0x5a2975['model'],_0x5a2975[_0x36a4('0x44')]);_0x3fddf2[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x5a2975[_0x36a4('0x43')],qs['fields'](_0x23bdf9[_0x36a4('0x44')][_0x36a4('0x49')]));_0x3fddf2[_0x36a4('0x47')]=_0x3fddf2[_0x36a4('0x47')]['length']?_0x3fddf2[_0x36a4('0x47')]:_0x5a2975[_0x36a4('0x43')];if(_0x23bdf9[_0x36a4('0x44')][_0x36a4('0x58')]){_0x3fddf2[_0x36a4('0x52')]=[{'all':!![]}];}_0x3fddf2=_[_0x36a4('0x59')]({},_0x3fddf2,_0x23bdf9['options']);return db[_0x36a4('0x40')][_0x36a4('0x5a')](_0x3fddf2)[_0x36a4('0x20')](handleEntityNotFound(_0x224280,null))['then'](respondWithResult(_0x224280,null))['catch'](handleError(_0x224280,null));};exports[_0x36a4('0x34')]=function(_0x2f62cb,_0xe986ba){if(_0x2f62cb[_0x36a4('0x5b')]['id']){delete _0x2f62cb[_0x36a4('0x5b')]['id'];}return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x2f62cb[_0x36a4('0x54')]['id']},'include':[{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')},{'model':db[_0x36a4('0x55')],'as':'Smtp'},{'model':db[_0x36a4('0x3e')],'as':_0x36a4('0x56')}]})[_0x36a4('0x20')](handleEntityNotFound(_0xe986ba,null))[_0x36a4('0x20')](saveUpdates(_0x2f62cb[_0x36a4('0x5b')],null))['then'](function(_0x196f9d){if(_0x196f9d&&_0x2f62cb[_0x36a4('0x5b')][_0x36a4('0x3c')]){return db['MailServerIn'][_0x36a4('0x34')](_0x2f62cb[_0x36a4('0x5b')][_0x36a4('0x3c')],{'where':{'MailAccountId':_0x196f9d['id']}})['then'](function(){return _0x196f9d;});}return _0x196f9d;})[_0x36a4('0x20')](function(_0x366351){if(_0x366351&&_0x2f62cb[_0x36a4('0x5b')]['Smtp']){return db[_0x36a4('0x55')][_0x36a4('0x34')](_0x2f62cb['body']['Smtp'],{'where':{'MailAccountId':_0x366351['id']}})[_0x36a4('0x20')](function(){return _0x366351;});}return _0x366351;})[_0x36a4('0x20')](respondWithResult(_0xe986ba,null))[_0x36a4('0x2a')](handleError(_0xe986ba,null));};exports[_0x36a4('0x5c')]=function(_0x349f02,_0x168e1f){return db[_0x36a4('0x40')][_0x36a4('0x5c')]()[_0x36a4('0x20')](respondWithResult(_0x168e1f,null))[_0x36a4('0x2a')](handleError(_0x168e1f,null));};exports[_0x36a4('0x5d')]=function(_0x75fa09,_0x42a0a0,_0x4707b3){if(_0x75fa09[_0x36a4('0x5b')]['id']){delete _0x75fa09[_0x36a4('0x5b')]['id'];}return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x75fa09[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x42a0a0,null))[_0x36a4('0x20')](function(_0x5179a1){if(_0x5179a1){_0x75fa09[_0x36a4('0x5b')][_0x36a4('0x5e')]=_0x5179a1['id'];return db[_0x36a4('0x5f')][_0x36a4('0x60')](_0x75fa09[_0x36a4('0x5b')]);}})[_0x36a4('0x20')](respondWithResult(_0x42a0a0,null))[_0x36a4('0x2a')](handleError(_0x42a0a0,null));};exports[_0x36a4('0x61')]=function(_0x2157b0,_0x151679,_0x19c530){var _0x11aaeb={'raw':![],'where':{}};var _0x442678={};var _0x3d85eb={'count':0x0,'rows':[]};return db['MailAccount'][_0x36a4('0x62')]({'where':{'id':_0x2157b0[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x151679,null))[_0x36a4('0x20')](function(_0x4a72f5){if(_0x4a72f5){_0x442678[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x5f')][_0x36a4('0x57')]);_0x442678[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x2157b0[_0x36a4('0x44')]);_0x442678['filters']=_[_0x36a4('0x48')](_0x442678[_0x36a4('0x43')],_0x442678['query']);_0x11aaeb[_0x36a4('0x47')]=_['intersection'](_0x442678[_0x36a4('0x43')],qs['fields'](_0x2157b0[_0x36a4('0x44')][_0x36a4('0x49')]));_0x11aaeb[_0x36a4('0x47')]=_0x11aaeb[_0x36a4('0x47')][_0x36a4('0x63')]?_0x11aaeb['attributes']:_0x442678[_0x36a4('0x43')];if(!_0x2157b0['query']['hasOwnProperty'](_0x36a4('0x4b'))){_0x11aaeb[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x2157b0[_0x36a4('0x44')]['limit']);_0x11aaeb[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x2157b0[_0x36a4('0x44')]['offset']);}_0x11aaeb[_0x36a4('0x4c')]=qs['sort'](_0x2157b0[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x11aaeb[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x2157b0[_0x36a4('0x44')],_0x442678[_0x36a4('0x46')]));_0x11aaeb[_0x36a4('0x4e')][_0x36a4('0x5e')]=_0x4a72f5['id'];if(_0x2157b0[_0x36a4('0x44')][_0x36a4('0x50')]){_0x11aaeb[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x11aaeb['where'],{'$or':_[_0x36a4('0x3f')](_0x11aaeb[_0x36a4('0x47')],function(_0x5dd882){var _0x1138a2={};_0x1138a2[_0x5dd882]={'$like':'%'+_0x2157b0['query'][_0x36a4('0x50')]+'%'};return _0x1138a2;})});}_0x11aaeb=_['merge']({},_0x11aaeb,_0x2157b0[_0x36a4('0x51')]);return db[_0x36a4('0x5f')][_0x36a4('0x64')]({'where':_0x11aaeb[_0x36a4('0x4e')]})['then'](function(_0x272da0){_0x3d85eb[_0x36a4('0x64')]=_0x272da0;if(_0x2157b0[_0x36a4('0x44')][_0x36a4('0x58')]){_0x11aaeb[_0x36a4('0x52')]=[{'all':!![]}];}return db[_0x36a4('0x5f')][_0x36a4('0x53')](_0x11aaeb);})[_0x36a4('0x20')](function(_0x41c50e){_0x3d85eb[_0x36a4('0x65')]=_0x41c50e;return _0x3d85eb;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x151679,_0x11aaeb))['catch'](handleError(_0x151679,null));};exports[_0x36a4('0x66')]=function(_0x2c646b,_0x399a58,_0x2413c6){return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x2c646b[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x399a58,null))[_0x36a4('0x20')](function(_0x792859){if(_0x792859){return _0x792859[_0x36a4('0x66')](_0x2c646b[_0x36a4('0x44')][_0x36a4('0x67')]);}})[_0x36a4('0x20')](respondWithStatusCode(_0x399a58,null))[_0x36a4('0x2a')](handleError(_0x399a58,null));};exports[_0x36a4('0x68')]=function(_0x2984a3,_0x2fef6e,_0x3b2d0a){if(_0x2984a3[_0x36a4('0x5b')]['id']){delete _0x2984a3['body']['id'];}return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x2984a3['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x2fef6e,null))[_0x36a4('0x20')](function(_0x333288){if(_0x333288){_0x2984a3[_0x36a4('0x5b')]['MailAccountId']=_0x333288['id'];return db[_0x36a4('0x69')][_0x36a4('0x60')](_0x2984a3[_0x36a4('0x5b')]);}})[_0x36a4('0x20')](respondWithResult(_0x2fef6e,null))[_0x36a4('0x2a')](handleError(_0x2fef6e,null));};exports[_0x36a4('0x6a')]=function(_0x2318d5,_0x1aa879,_0x473b12){var _0x2a9c96={'raw':![],'where':{}};var _0xcf1d8c={};var _0x129267={'count':0x0,'rows':[]};return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x2318d5[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x1aa879,null))[_0x36a4('0x20')](function(_0x5954ac){if(_0x5954ac){_0xcf1d8c[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x69')]['rawAttributes']);_0xcf1d8c[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x2318d5[_0x36a4('0x44')]);_0xcf1d8c['filters']=_[_0x36a4('0x48')](_0xcf1d8c[_0x36a4('0x43')],_0xcf1d8c[_0x36a4('0x44')]);_0x2a9c96[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0xcf1d8c['model'],qs[_0x36a4('0x49')](_0x2318d5[_0x36a4('0x44')][_0x36a4('0x49')]));_0x2a9c96[_0x36a4('0x47')]=_0x2a9c96['attributes'][_0x36a4('0x63')]?_0x2a9c96[_0x36a4('0x47')]:_0xcf1d8c[_0x36a4('0x43')];if(!_0x2318d5['query'][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x2a9c96[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x2318d5[_0x36a4('0x44')]['limit']);_0x2a9c96[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x2318d5[_0x36a4('0x44')][_0x36a4('0x2f')]);}_0x2a9c96[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x2318d5[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x2a9c96[_0x36a4('0x4e')]=qs['filters'](_[_0x36a4('0x4f')](_0x2318d5['query'],_0xcf1d8c[_0x36a4('0x46')]));_0x2a9c96[_0x36a4('0x4e')]['MailAccountId']=_0x5954ac['id'];if(_0x2318d5['query']['filter']){_0x2a9c96[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x2a9c96[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x2a9c96['attributes'],function(_0xfd7faa){var _0x42b97c={};_0x42b97c[_0xfd7faa]={'$like':'%'+_0x2318d5[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x42b97c;})});}_0x2a9c96=_['merge']({},_0x2a9c96,_0x2318d5[_0x36a4('0x51')]);return db[_0x36a4('0x69')][_0x36a4('0x64')]({'where':_0x2a9c96[_0x36a4('0x4e')]})[_0x36a4('0x20')](function(_0x518c16){_0x129267['count']=_0x518c16;if(_0x2318d5[_0x36a4('0x44')][_0x36a4('0x58')]){_0x2a9c96[_0x36a4('0x52')]=[{'all':!![]}];}return db[_0x36a4('0x69')][_0x36a4('0x53')](_0x2a9c96);})[_0x36a4('0x20')](function(_0xbcf9b2){_0x129267[_0x36a4('0x65')]=_0xbcf9b2;return _0x129267;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x1aa879,_0x2a9c96))['catch'](handleError(_0x1aa879,null));};exports[_0x36a4('0x6b')]=function(_0x11e6bc,_0x1208da,_0xb529f2){return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x11e6bc[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x1208da,null))[_0x36a4('0x20')](function(_0x8a669f){if(_0x8a669f){return _0x8a669f[_0x36a4('0x6b')](_0x11e6bc['query'][_0x36a4('0x67')]);}})[_0x36a4('0x20')](respondWithStatusCode(_0x1208da,null))[_0x36a4('0x2a')](handleError(_0x1208da,null));};exports[_0x36a4('0x60')]=function(_0x4bb59c,_0xe196d1){var _0x20c187={'name':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x39')],'key':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x42')],'email':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x6c')],'ListId':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x6d')],'active':!_[_0x36a4('0x6e')](_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x6f')])?_0x4bb59c['body'][_0x36a4('0x6f')]:!![],'description':_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x36a4('0x6e')](_0x4bb59c['body'][_0x36a4('0x71')])){if(_0x4bb59c[_0x36a4('0x5b')]['cauthentication']){_0x20c187[_0x36a4('0x3c')][_0x36a4('0x72')]=_0x20c187[_0x36a4('0x3d')][_0x36a4('0x72')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x73')];_0x20c187[_0x36a4('0x3c')]['password']=_0x20c187['Smtp']['pass']=_0x4bb59c[_0x36a4('0x5b')]['cpassword'];}else{_0x20c187[_0x36a4('0x3c')][_0x36a4('0x74')]=_0x20c187[_0x36a4('0x3d')]['authentication']=![];}_0x20c187['Imap']['host']=_0x4bb59c['body']['Imap'][_0x36a4('0x75')];_0x20c187[_0x36a4('0x3c')]['port']=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x3c')]['port'];_0x20c187[_0x36a4('0x3d')][_0x36a4('0x75')]=_0x4bb59c['body']['Smtp'][_0x36a4('0x75')];_0x20c187[_0x36a4('0x3d')][_0x36a4('0x76')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x3d')][_0x36a4('0x76')];}else{_0x20c187[_0x36a4('0x3c')]['service']=_0x20c187[_0x36a4('0x3d')][_0x36a4('0x77')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x71')];_0x20c187[_0x36a4('0x3c')][_0x36a4('0x72')]=_0x20c187[_0x36a4('0x3d')]['user']=_0x4bb59c['body'][_0x36a4('0x73')];_0x20c187['Imap'][_0x36a4('0x78')]=_0x20c187['Smtp'][_0x36a4('0x79')]=_0x4bb59c[_0x36a4('0x5b')][_0x36a4('0x7a')];}return db[_0x36a4('0x40')][_0x36a4('0x60')](_0x20c187,{'include':[{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d')},{'model':db[_0x36a4('0x3b')],'as':_0x36a4('0x3c')}]})[_0x36a4('0x20')](function(_0x1bdbbb){var _0x1d5a09=_0x4bb59c[_0x36a4('0x72')][_0x36a4('0x7b')]({'plain':!![]});if(!_0x1d5a09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d5a09[_0x36a4('0x7c')]==='user'){var _0x483035=_0x1bdbbb[_0x36a4('0x7b')]({'plain':!![]});return db[_0x36a4('0x7d')][_0x36a4('0x5a')]({'where':{'name':_0x36a4('0x36'),'userProfileId':_0x1d5a09[_0x36a4('0x7e')]},'raw':!![]})[_0x36a4('0x20')](function(_0x22a7c3){if(_0x22a7c3&&_0x22a7c3[_0x36a4('0x7f')]===0x0){return db[_0x36a4('0x37')][_0x36a4('0x60')]({'name':_0x483035[_0x36a4('0x39')],'resourceId':_0x483035['id'],'type':_0x22a7c3[_0x36a4('0x39')],'sectionId':_0x22a7c3['id']},{})[_0x36a4('0x20')](function(){return _0x1bdbbb;});}else{return _0x1bdbbb;}})[_0x36a4('0x2a')](function(_0x1d6ae5){logger[_0x36a4('0x26')](_0x36a4('0x80'),_0x1d6ae5);throw _0x1d6ae5;});}return _0x1bdbbb;})[_0x36a4('0x20')](respondWithResult(_0xe196d1,0xc9))[_0x36a4('0x2a')](handleError(_0xe196d1,null));};exports[_0x36a4('0x81')]=function(_0x167eec,_0x25490c,_0x5b9cb2){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0x167eec[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x25490c,null))[_0x36a4('0x20')](function(_0x54a5b7){if(_0x54a5b7){return _0x54a5b7[_0x36a4('0x81')]();}return null;})[_0x36a4('0x20')](respondWithResult(_0x25490c,null))[_0x36a4('0x2a')](handleError(_0x25490c,null));};exports[_0x36a4('0x82')]=function(_0x222171,_0x1a427e,_0x42b132){if(_0x222171[_0x36a4('0x5b')]['id']){delete _0x222171['body']['id'];}return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x222171[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a427e,null))[_0x36a4('0x20')](function(_0x2b27e7){if(_0x2b27e7){_0x222171[_0x36a4('0x5b')]['MailAccountId']=_0x2b27e7['id'];return db['MailServerIn'][_0x36a4('0x60')](_0x222171[_0x36a4('0x5b')]);}})[_0x36a4('0x20')](respondWithResult(_0x1a427e,null))[_0x36a4('0x2a')](handleError(_0x1a427e,null));};exports[_0x36a4('0x83')]=function(_0xff3eca,_0xa6e8ee,_0x2e4835){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0xff3eca[_0x36a4('0x54')]['id']}})['then'](handleEntityNotFound(_0xa6e8ee,null))['then'](function(_0x259a56){if(_0x259a56){return _0x259a56[_0x36a4('0x84')](null);}return null;})['then'](respondWithStatusCode(_0xa6e8ee,null))[_0x36a4('0x2a')](handleError(_0xa6e8ee,null));};exports[_0x36a4('0x85')]=function(_0x339f93,_0x552b47,_0x2eed54){return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x339f93[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x552b47,null))[_0x36a4('0x20')](function(_0x1aed39){if(_0x1aed39){return _0x1aed39[_0x36a4('0x85')]();}return null;})['then'](respondWithResult(_0x552b47,null))['catch'](handleError(_0x552b47,null));};exports['addSmtp']=function(_0xe702e2,_0x2bb8d6,_0xc2c4e8){if(_0xe702e2[_0x36a4('0x5b')]['id']){delete _0xe702e2[_0x36a4('0x5b')]['id'];}return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0xe702e2['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x2bb8d6,null))['then'](function(_0x3e57f9){if(_0x3e57f9){_0xe702e2[_0x36a4('0x5b')][_0x36a4('0x5e')]=_0x3e57f9['id'];return db[_0x36a4('0x55')][_0x36a4('0x60')](_0xe702e2['body']);}})['then'](respondWithResult(_0x2bb8d6,null))[_0x36a4('0x2a')](handleError(_0x2bb8d6,null));};exports[_0x36a4('0x86')]=function(_0x4b1a3d,_0x302a82,_0x2e7876){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0x4b1a3d['params']['id']}})['then'](handleEntityNotFound(_0x302a82,null))[_0x36a4('0x20')](function(_0x4c69fa){if(_0x4c69fa){return _0x4c69fa[_0x36a4('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x302a82,null))[_0x36a4('0x2a')](handleError(_0x302a82,null));};exports[_0x36a4('0x88')]=function(_0x571d6d,_0x2d4c10,_0x1f156c){return db[_0x36a4('0x89')][_0x36a4('0x5a')]({'where':{'id':_0x571d6d[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x2d4c10,null))[_0x36a4('0x20')](function(_0x306aae){if(_0x306aae){return _0x306aae['addInteraction'](_0x571d6d[_0x36a4('0x5b')][_0x36a4('0x67')],_['omit'](_0x571d6d[_0x36a4('0x5b')],[_0x36a4('0x67'),'id'])||{});}})[_0x36a4('0x20')](respondWithResult(_0x2d4c10,null))[_0x36a4('0x2a')](handleError(_0x2d4c10,null));};exports[_0x36a4('0x8a')]=function(_0x5d860d,_0x10ed8f,_0x2527d6){var _0x593a72={'raw':![],'where':{}};var _0x20c70f={};var _0x4cf8ed={'count':0x0,'rows':[]};return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x5d860d['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x10ed8f,null))[_0x36a4('0x20')](function(_0x124e21){if(_0x124e21){_0x20c70f[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x89')]['rawAttributes']);_0x20c70f[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x5d860d[_0x36a4('0x44')]);_0x20c70f[_0x36a4('0x46')]=_[_0x36a4('0x48')](_0x20c70f[_0x36a4('0x43')],_0x20c70f['query']);_0x593a72[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x20c70f[_0x36a4('0x43')],qs[_0x36a4('0x49')](_0x5d860d['query'][_0x36a4('0x49')]));_0x593a72[_0x36a4('0x47')]=_0x593a72[_0x36a4('0x47')][_0x36a4('0x63')]?_0x593a72['attributes']:_0x20c70f[_0x36a4('0x43')];if(!_0x5d860d[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x593a72[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x5d860d['query'][_0x36a4('0x30')]);_0x593a72[_0x36a4('0x2f')]=qs[_0x36a4('0x2f')](_0x5d860d[_0x36a4('0x44')]['offset']);}_0x593a72[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x5d860d['query'][_0x36a4('0x4d')]);_0x593a72[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x5d860d[_0x36a4('0x44')],_0x20c70f[_0x36a4('0x46')]));_0x593a72[_0x36a4('0x4e')][_0x36a4('0x5e')]=_0x124e21['id'];if(_0x5d860d[_0x36a4('0x44')][_0x36a4('0x50')]){_0x593a72[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x593a72[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x593a72[_0x36a4('0x47')],function(_0x482b55){var _0x1b90e4={};_0x1b90e4[_0x482b55]={'$like':'%'+_0x5d860d['query'][_0x36a4('0x50')]+'%'};return _0x1b90e4;})});}_0x593a72=_['merge']({},_0x593a72,_0x5d860d[_0x36a4('0x51')]);return db['MailInteraction'][_0x36a4('0x64')]({'where':_0x593a72['where']})['then'](function(_0x221802){_0x4cf8ed[_0x36a4('0x64')]=_0x221802;if(_0x5d860d[_0x36a4('0x44')]['includeAll']){_0x593a72[_0x36a4('0x52')]=[{'model':db[_0x36a4('0x8b')],'as':_0x36a4('0x8c'),'required':![]},{'model':db[_0x36a4('0x8d')],'as':_0x36a4('0x8e'),'attributes':['name',_0x36a4('0x8f'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x36a4('0x39'),_0x36a4('0x90')],'where':_0x5d860d[_0x36a4('0x44')][_0x36a4('0x91')]?{'id':_0x5d860d[_0x36a4('0x44')][_0x36a4('0x91')]}:undefined,'required':_0x5d860d[_0x36a4('0x44')]['tag']?!![]:![]}];}return db[_0x36a4('0x89')][_0x36a4('0x53')](_0x593a72);})[_0x36a4('0x20')](function(_0x4c7527){_0x4cf8ed[_0x36a4('0x65')]=_0x4c7527;return _0x4cf8ed;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x10ed8f,_0x593a72))[_0x36a4('0x2a')](handleError(_0x10ed8f,null));};exports[_0x36a4('0x92')]=function(_0x28381d,_0x4de2a7,_0x25ac33){return db[_0x36a4('0x40')][_0x36a4('0x62')]({'where':{'id':_0x28381d[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x4de2a7,null))['then'](function(_0x4f6c50){if(_0x4f6c50){return db['sequelize'][_0x36a4('0x93')](function(_0x5ce6c0){return db[_0x36a4('0x94')]['destroy']({'where':{'MailAccountId':_0x28381d[_0x36a4('0x54')]['id']},'transaction':_0x5ce6c0})[_0x36a4('0x20')](function(_0x26d0d4){var _0x4e9d66=_['map'](_0x28381d[_0x36a4('0x5b')],function(_0xba0db0){_0xba0db0[_0x36a4('0x5e')]=_0x28381d[_0x36a4('0x54')]['id'];return _0xba0db0;});return db[_0x36a4('0x94')][_0x36a4('0x95')](_0x4e9d66,{'transaction':_0x5ce6c0});});})[_0x36a4('0x20')](function(){return db[_0x36a4('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x28381d[_0x36a4('0x54')]['id']},'order':'priority'});});}})[_0x36a4('0x20')](respondWithResult(_0x4de2a7,null))[_0x36a4('0x2a')](handleError(_0x4de2a7,null));};exports[_0x36a4('0x96')]=function(_0xfc82ed,_0x523b60,_0x283798){var _0x2875d3={};var _0x676a0d={};var _0x1050ee;var _0x2ba5e8;return db['MailAccount']['findOne']({'where':{'id':_0xfc82ed[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x523b60,null))[_0x36a4('0x20')](function(_0x81dbf){if(_0x81dbf){_0x1050ee=_0x81dbf;_0x676a0d[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x94')][_0x36a4('0x57')]);_0x676a0d[_0x36a4('0x44')]=_['keys'](_0xfc82ed['query']);_0x676a0d[_0x36a4('0x46')]=_['intersection'](_0x676a0d['model'],_0x676a0d['query']);_0x2875d3[_0x36a4('0x47')]=_[_0x36a4('0x48')](_0x676a0d[_0x36a4('0x43')],qs['fields'](_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x49')]));_0x2875d3[_0x36a4('0x47')]=_0x2875d3[_0x36a4('0x47')][_0x36a4('0x63')]?_0x2875d3[_0x36a4('0x47')]:_0x676a0d['model'];_0x2875d3[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0xfc82ed[_0x36a4('0x44')]['sort']);_0x2875d3[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0xfc82ed[_0x36a4('0x44')],_0x676a0d[_0x36a4('0x46')]));if(_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x50')]){_0x2875d3[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x2875d3[_0x36a4('0x4e')],{'$or':_[_0x36a4('0x3f')](_0x2875d3[_0x36a4('0x47')],function(_0x22ee75){var _0x236cd5={};_0x236cd5[_0x22ee75]={'$like':'%'+_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x236cd5;})});}_0x2875d3=_[_0x36a4('0x59')]({},_0x2875d3,_0xfc82ed[_0x36a4('0x51')]);return _0x1050ee[_0x36a4('0x96')](_0x2875d3);}})[_0x36a4('0x20')](function(_0x443e04){if(_0x443e04){_0x2ba5e8=_0x443e04[_0x36a4('0x63')];if(!_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x2875d3[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0xfc82ed['query'][_0x36a4('0x30')]);_0x2875d3[_0x36a4('0x2f')]=qs['offset'](_0xfc82ed[_0x36a4('0x44')][_0x36a4('0x2f')]);}return _0x1050ee['getApplications'](_0x2875d3);}})[_0x36a4('0x20')](function(_0x178e64){if(_0x178e64){return _0x178e64?{'count':_0x2ba5e8,'rows':_0x178e64}:null;}})['then'](respondWithResult(_0x523b60,null))['catch'](handleError(_0x523b60,null));};exports['getMessages']=function(_0x4a256d,_0x5a2c79,_0xaaed69){var _0x5b0d94={'raw':!![],'where':{}};var _0x2c46e5={};var _0x2fd8e1={'count':0x0,'rows':[]};return db[_0x36a4('0x40')]['findOne']({'where':{'id':_0x4a256d['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x5a2c79,null))[_0x36a4('0x20')](function(_0x4f6feb){if(_0x4f6feb){_0x2c46e5['model']=_[_0x36a4('0x45')](db[_0x36a4('0x97')][_0x36a4('0x57')]);_0x2c46e5[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x4a256d[_0x36a4('0x44')]);_0x2c46e5['filters']=_[_0x36a4('0x48')](_0x2c46e5[_0x36a4('0x43')],_0x2c46e5['query']);_0x5b0d94[_0x36a4('0x47')]=_['intersection'](_0x2c46e5[_0x36a4('0x43')],qs['fields'](_0x4a256d['query']['fields']));_0x5b0d94['attributes']=_0x5b0d94[_0x36a4('0x47')]['length']?_0x5b0d94[_0x36a4('0x47')]:_0x2c46e5[_0x36a4('0x43')];if(!_0x4a256d[_0x36a4('0x44')][_0x36a4('0x4a')]('nolimit')){_0x5b0d94[_0x36a4('0x30')]=qs['limit'](_0x4a256d[_0x36a4('0x44')][_0x36a4('0x30')]);_0x5b0d94[_0x36a4('0x2f')]=qs['offset'](_0x4a256d[_0x36a4('0x44')]['offset']);}_0x5b0d94[_0x36a4('0x4c')]=qs[_0x36a4('0x4d')](_0x4a256d[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x5b0d94['where']=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x4a256d[_0x36a4('0x44')],_0x2c46e5[_0x36a4('0x46')]));_0x5b0d94[_0x36a4('0x4e')][_0x36a4('0x5e')]=_0x4f6feb['id'];if(_0x4a256d['query']['filter']){_0x5b0d94['where']=_['merge'](_0x5b0d94[_0x36a4('0x4e')],{'$or':_['map'](_0x5b0d94['attributes'],function(_0x50c88a){var _0x34a9b0={};_0x34a9b0[_0x50c88a]={'$like':'%'+_0x4a256d[_0x36a4('0x44')][_0x36a4('0x50')]+'%'};return _0x34a9b0;})});}if(_0x4a256d[_0x36a4('0x44')]['$gte']){var _0x381254=_0x4a256d[_0x36a4('0x44')]['$gte'][_0x36a4('0x98')](',');var _0x5d0109={};_0x5d0109[_0x381254[0x0]]={'$gte':moment(_0x381254[0x1])[_0x36a4('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b0d94[_0x36a4('0x4e')]=_['merge'](_0x5b0d94[_0x36a4('0x4e')],_0x5d0109);}_0x5b0d94=_[_0x36a4('0x59')]({},_0x5b0d94,_0x4a256d[_0x36a4('0x51')]);return db[_0x36a4('0x97')][_0x36a4('0x64')]({'where':_0x5b0d94[_0x36a4('0x4e')]})[_0x36a4('0x20')](function(_0x5eae3b){_0x2fd8e1[_0x36a4('0x64')]=_0x5eae3b;if(_0x4a256d['query']['includeAll']){_0x5b0d94[_0x36a4('0x52')]=[{'all':!![]}];}return db['MailMessage'][_0x36a4('0x53')](_0x5b0d94);})[_0x36a4('0x20')](function(_0x27dc88){_0x2fd8e1[_0x36a4('0x65')]=_0x27dc88;return _0x2fd8e1;});}})[_0x36a4('0x20')](respondWithFilteredResult(_0x5a2c79,_0x5b0d94))[_0x36a4('0x2a')](handleError(_0x5a2c79,null));};exports[_0x36a4('0x9a')]=function(_0x52cf43,_0x38dd08,_0x3a5294){var _0xda1425,_0x2c7232={},_0x18d732;if(_0x52cf43[_0x36a4('0x5b')]['to']){_0x18d732=_0x52cf43[_0x36a4('0x5b')]['to'][_0x36a4('0x98')](',')[0x0];}return db[_0x36a4('0x40')]['find']({'where':{'id':_0x52cf43[_0x36a4('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x36a4('0x9b'),'include':[{'model':db[_0x36a4('0x8b')],'as':_0x36a4('0x9c'),'where':{'email':_0x18d732},'limit':0x1,'order':[['updatedAt',_0x36a4('0x9d')]]}]},{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d'),'raw':!![]}]})[_0x36a4('0x20')](handleEntityNotFound(_0x38dd08,null))[_0x36a4('0x20')](function(_0x26d4c3){if(_0x26d4c3){_0xda1425=_0x26d4c3;if(_0x26d4c3[_0x36a4('0x3d')]){if(_[_0x36a4('0x6e')](_0x52cf43[_0x36a4('0x5b')][_0x36a4('0x9e')])){_0x52cf43['body'][_0x36a4('0x9e')]=util[_0x36a4('0x99')](_0x36a4('0x9f'),_0x26d4c3[_0x36a4('0x39')],_0x26d4c3[_0x36a4('0x6c')]||_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x72')]);}if(_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')]&&_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')]['length']){for(var _0xe59de3=0x0;_0xe59de3<_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')][_0x36a4('0x63')];_0xe59de3+=0x1){_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')][_0xe59de3]={'filename':_0x52cf43['body'][_0x36a4('0xa0')][_0xe59de3][_0x36a4('0x39')],'path':path[_0x36a4('0xa1')](config[_0x36a4('0xa2')],_0x36a4('0xa3'),_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa0')][_0xe59de3][_0x36a4('0xa4')])};}}var _0x113057={'tls':{'rejectUnauthorized':![]}};if(_[_0x36a4('0x6e')](_0x26d4c3['Smtp'][_0x36a4('0x77')])){if(_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x74')]){_0x113057[_0x36a4('0xa5')]={'user':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x72')],'pass':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x79')]};}_0x113057['host']=_0x26d4c3[_0x36a4('0x3d')]['host'];_0x113057['port']=_0x26d4c3['Smtp'][_0x36a4('0x76')];_0x113057['secure']=_0x26d4c3[_0x36a4('0x3d')]['secure'];}else{_0x113057[_0x36a4('0x77')]=_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x77')];_0x113057[_0x36a4('0xa5')]={'user':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x72')],'pass':_0x26d4c3[_0x36a4('0x3d')][_0x36a4('0x79')]};}return respondWithRpcPromise('SendMail',_0x36a4('0xa6'),{'account':_0x113057,'message':_0x52cf43['body']});}else{throw new Error(_0x36a4('0xa7'));}}})[_0x36a4('0x20')](function(_0x53a66f){if(_0x53a66f){_0x2c7232=_0x53a66f;if(_0xda1425[_0x36a4('0x9b')]){if(_0xda1425['List']['Contacts'][_0x36a4('0x63')]){return _0xda1425[_0x36a4('0x9b')][_0x36a4('0x9c')][0x0];}else{return db[_0x36a4('0x8b')][_0x36a4('0x60')](_['defaults'](_0x52cf43[_0x36a4('0x5b')],{'firstName':_0x52cf43['body']['to'],'email':_0x52cf43[_0x36a4('0x5b')]['to'],'phone':_0x52cf43['body']['to'],'ListId':_0xda1425[_0x36a4('0x6d')]}));}}else{throw new Error(_0x36a4('0xa7'));}}})['then'](function(_0x353930){if(_0x353930){var _0x188da5={'UserId':_0x52cf43[_0x36a4('0x72')]['id'],'ContactId':_0x353930['id'],'MailAccountId':_0xda1425['id'],'inReplyTo':_0x2c7232[_0x36a4('0xa8')],'to':_0x52cf43['body'][_0x36a4('0x9e')],'cc':_0x52cf43[_0x36a4('0x5b')]['cc'],'subject':_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xa9')],'attach':_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xaa')],'firstMsgDirection':_0x36a4('0xab'),'lastMsgAt':moment()[_0x36a4('0x99')](_0x36a4('0xac')),'lastMsgDirection':_0x36a4('0xab'),'lastMsgBody':_0x52cf43['body'][_0x36a4('0x5b')],'Messages':[_[_0x36a4('0x59')](_0x52cf43[_0x36a4('0x5b')],{'messageId':_0x2c7232['messageId'],'sentAt':moment()[_0x36a4('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xda1425['id'],'UserId':_0x52cf43[_0x36a4('0x72')]['id'],'ContactId':_0x353930['id']})]};if(_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xad')]){_0x188da5=_[_0x36a4('0x59')](_0x188da5,_0x52cf43[_0x36a4('0x5b')][_0x36a4('0xad')]);}return db[_0x36a4('0x89')][_0x36a4('0x60')](_0x188da5,{'include':[{'model':db[_0x36a4('0x97')],'as':_0x36a4('0xae')}]});}})['then'](respondWithResult(_0x38dd08,null))[_0x36a4('0x2a')](handleError(_0x38dd08,null));};exports['verifySmtp']=function(_0x568e62,_0x363b37,_0x22bda6){return db[_0x36a4('0x40')][_0x36a4('0x5a')]({'where':{'id':_0x568e62['params']['id']},'include':[{'model':db[_0x36a4('0x55')],'as':_0x36a4('0x3d'),'raw':!![]}]})[_0x36a4('0x20')](handleEntityNotFound(_0x363b37,null))[_0x36a4('0x20')](function(_0xd5244){if(_0xd5244&&_0xd5244['Smtp']){var _0x9aff9d={'id':_0xd5244['id'],'tls':{'rejectUnauthorized':![]}};if(_0xd5244[_0x36a4('0x3d')][_0x36a4('0x77')]){_0x9aff9d['service']=_0xd5244['Smtp'][_0x36a4('0x77')];}else{_0x9aff9d[_0x36a4('0x75')]=_0xd5244[_0x36a4('0x3d')][_0x36a4('0x75')];_0x9aff9d['port']=_0xd5244[_0x36a4('0x3d')][_0x36a4('0x76')];_0x9aff9d[_0x36a4('0xaf')]=_0xd5244['Smtp']['secure'];}if(_0xd5244['Smtp'][_0x36a4('0x74')]){_0x9aff9d[_0x36a4('0xa5')]={'user':_0xd5244['Smtp'][_0x36a4('0x72')],'pass':_0xd5244[_0x36a4('0x3d')][_0x36a4('0x79')]};}return respondWithRpcPromise(_0x36a4('0xb0'),_0x36a4('0xb1'),{'account':_0x9aff9d});}})[_0x36a4('0x20')](respondWithResult(_0x363b37,null))[_0x36a4('0x2a')](handleError(_0x363b37,null));};exports[_0x36a4('0x35')]=function(_0x40c139,_0x41bad7){return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x40c139[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x41bad7,null))[_0x36a4('0x20')](function(_0x413f93){if(_0x413f93&&_0x413f93[_0x36a4('0x77')]){throw new db['Sequelize'][(_0x36a4('0xb2'))](_0x36a4('0xb3'));}return _0x413f93;})[_0x36a4('0x20')](removeEntity(_0x41bad7,null))['catch'](handleError(_0x41bad7,null));};exports['addAgents']=function(_0x4f22c5,_0x3cd54a,_0x4fabf6){return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x4f22c5['params']['id']}})['then'](handleEntityNotFound(_0x3cd54a,null))[_0x36a4('0x20')](function(_0x32b315){if(_0x32b315){return _0x32b315['addAgents'](_0x4f22c5[_0x36a4('0x5b')][_0x36a4('0x67')],_['omit'](_0x4f22c5[_0x36a4('0x5b')],[_0x36a4('0x67'),'id'])||{})[_0x36a4('0xb4')](function(_0x5068c8){for(var _0x45ac7b=0x0;_0x45ac7b<_0x4f22c5[_0x36a4('0x5b')]['ids']['length'];_0x45ac7b+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x4f22c5[_0x36a4('0x5b')]['ids'][_0x45ac7b],'MailAccountId':_0x4f22c5['params']['id']});}return _0x5068c8;});}})[_0x36a4('0x20')](respondWithResult(_0x3cd54a,null))[_0x36a4('0x2a')](handleError(_0x3cd54a,null));};exports[_0x36a4('0xb5')]=function(_0x33ff96,_0x3389a2,_0x2d8442){return db['MailAccount'][_0x36a4('0x5a')]({'where':{'id':_0x33ff96[_0x36a4('0x54')]['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x3389a2,null))[_0x36a4('0x20')](function(_0x83d8e3){if(_0x83d8e3){return _0x83d8e3[_0x36a4('0xb5')](_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')])['then'](function(){if(_[_0x36a4('0xb6')](_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')])){for(var _0x459f97=0x0;_0x459f97<_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')][_0x36a4('0x63')];_0x459f97+=0x1){socket[_0x36a4('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')][_0x459f97]),'MailAccountId':Number(_0x33ff96[_0x36a4('0x54')]['id'])});}}else{socket[_0x36a4('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x33ff96[_0x36a4('0x44')][_0x36a4('0x67')]),'MailAccountId':Number(_0x33ff96['params']['id'])});}});}})[_0x36a4('0x20')](respondWithStatusCode(_0x3389a2,null))[_0x36a4('0x2a')](handleError(_0x3389a2,null));};exports[_0x36a4('0xb8')]=function(_0x496759,_0x7d8d12,_0x2ea8cc){var _0x270d88={};var _0x52fc2a={};var _0xcdaa8f;var _0xb05df0;return db['MailAccount']['findOne']({'where':{'id':_0x496759['params']['id']}})[_0x36a4('0x20')](handleEntityNotFound(_0x7d8d12,null))[_0x36a4('0x20')](function(_0x344bf2){if(_0x344bf2){_0xcdaa8f=_0x344bf2;_0x52fc2a[_0x36a4('0x43')]=_[_0x36a4('0x45')](db[_0x36a4('0x8d')][_0x36a4('0x57')]);_0x52fc2a[_0x36a4('0x44')]=_[_0x36a4('0x45')](_0x496759['query']);_0x52fc2a[_0x36a4('0x46')]=_[_0x36a4('0x48')](_0x52fc2a['model'],_0x52fc2a[_0x36a4('0x44')]);_0x270d88['attributes']=_[_0x36a4('0x48')](_0x52fc2a[_0x36a4('0x43')],qs['fields'](_0x496759[_0x36a4('0x44')][_0x36a4('0x49')]));_0x270d88[_0x36a4('0x47')]=_0x270d88[_0x36a4('0x47')][_0x36a4('0x63')]?_0x270d88[_0x36a4('0x47')]:_0x52fc2a[_0x36a4('0x43')];_0x270d88[_0x36a4('0x4c')]=qs['sort'](_0x496759[_0x36a4('0x44')][_0x36a4('0x4d')]);_0x270d88[_0x36a4('0x4e')]=qs[_0x36a4('0x46')](_[_0x36a4('0x4f')](_0x496759['query'],_0x52fc2a['filters']));if(_0x496759['query'][_0x36a4('0x50')]){_0x270d88[_0x36a4('0x4e')]=_[_0x36a4('0x59')](_0x270d88['where'],{'$or':_['map'](_0x270d88[_0x36a4('0x47')],function(_0x4545df){var _0x299518={};_0x299518[_0x4545df]={'$like':'%'+_0x496759[_0x36a4('0x44')]['filter']+'%'};return _0x299518;})});}_0x270d88=_[_0x36a4('0x59')]({},_0x270d88,_0x496759['options']);return _0xcdaa8f['getAgents'](_0x270d88);}})[_0x36a4('0x20')](function(_0x525340){if(_0x525340){_0xb05df0=_0x525340[_0x36a4('0x63')];if(!_0x496759[_0x36a4('0x44')][_0x36a4('0x4a')](_0x36a4('0x4b'))){_0x270d88[_0x36a4('0x30')]=qs[_0x36a4('0x30')](_0x496759['query'][_0x36a4('0x30')]);_0x270d88['offset']=qs[_0x36a4('0x2f')](_0x496759[_0x36a4('0x44')]['offset']);}return _0xcdaa8f[_0x36a4('0xb8')](_0x270d88);}})['then'](function(_0x51e282){if(_0x51e282){return _0x51e282?{'count':_0xb05df0,'rows':_0x51e282}:null;}})['then'](respondWithResult(_0x7d8d12,null))[_0x36a4('0x2a')](handleError(_0x7d8d12,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e4e3f12..e643f33 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 _0xe3c1=['MailAccount','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x539f96,_0x4b5d54){var _0x4f977f=function(_0x6a1b3f){while(--_0x6a1b3f){_0x539f96['push'](_0x539f96['shift']());}};_0x4f977f(++_0x4b5d54);}(_0xe3c1,0xbf));var _0x1e3c=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xe3c1[_0x277721];return _0x286051;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x1e3c('0x0'))['db'][_0x1e3c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e3c('0x2'),'afterUpdate':_0x1e3c('0x3'),'afterDestroy':_0x1e3c('0x4')};function emitEvent(_0x620092){return function(_0x339784,_0x755df5,_0x22d2ba){MailAccountEvents[_0x1e3c('0x5')](_0x620092+':'+_0x339784['id'],_0x339784);MailAccountEvents['emit'](_0x620092,_0x339784);_0x22d2ba(null);};}for(var e in events){if(events[_0x1e3c('0x6')](e)){var event=events[e];MailAccount[_0x1e3c('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xaa97=['events','MailAccount','setMaxListeners','save','update','remove','emit','exports'];(function(_0xbe19f7,_0x4243cc){var _0x1a7e66=function(_0x1515dd){while(--_0x1515dd){_0xbe19f7['push'](_0xbe19f7['shift']());}};_0x1a7e66(++_0x4243cc);}(_0xaa97,0x130));var _0x7aa9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xaa97[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x7aa9('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x7aa9('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7aa9('0x2')](0x0);var events={'afterCreate':_0x7aa9('0x3'),'afterUpdate':_0x7aa9('0x4'),'afterDestroy':_0x7aa9('0x5')};function emitEvent(_0x5980fd){return function(_0x642f89,_0x2dc893,_0x4a0618){MailAccountEvents[_0x7aa9('0x6')](_0x5980fd+':'+_0x642f89['id'],_0x642f89);MailAccountEvents[_0x7aa9('0x6')](_0x5980fd,_0x642f89);_0x4a0618(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7aa9('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e54281b..690f1ef 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 _0x5308=['bluebird','request-promise','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','util','../../config/logger','api','moment'];(function(_0x65ca71,_0x126845){var _0x5cb16e=function(_0xe1143b){while(--_0xe1143b){_0x65ca71['push'](_0x65ca71['shift']());}};_0x5cb16e(++_0x126845);}(_0x5308,0x11c));var _0x8530=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x5308[_0x533e4e];return _0x1f14bb;};'use strict';var _=require('lodash');var util=require(_0x8530('0x0'));var logger=require(_0x8530('0x1'))(_0x8530('0x2'));var moment=require(_0x8530('0x3'));var BPromise=require(_0x8530('0x4'));var rp=require(_0x8530('0x5'));var fs=require('fs');var path=require(_0x8530('0x6'));var rimraf=require(_0x8530('0x7'));var config=require('../../config/environment');var attributes=require(_0x8530('0x8'));module[_0x8530('0x9')]=function(_0x3b6887,_0x1a2db3){return _0x3b6887[_0x8530('0xa')](_0x8530('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc863=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','mail_accounts','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc863,0x1ea));var _0x3c86=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xc863[_0x47e549];return _0x251374;};'use strict';var _=require(_0x3c86('0x0'));var util=require(_0x3c86('0x1'));var logger=require(_0x3c86('0x2'))('api');var moment=require(_0x3c86('0x3'));var BPromise=require(_0x3c86('0x4'));var rp=require(_0x3c86('0x5'));var fs=require('fs');var path=require(_0x3c86('0x6'));var rimraf=require(_0x3c86('0x7'));var config=require(_0x3c86('0x8'));var attributes=require('./mailAccount.attributes');module[_0x3c86('0x9')]=function(_0x4f861e,_0x2ba3c8){return _0x4f861e[_0x3c86('0xa')]('MailAccount',attributes,{'tableName':_0x3c86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index fb184bd..c6e4da1 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 _0xf958=['subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','get','created','MailMessage','attachments','originTo','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','then','stringify','catch','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','List','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','defaults','create','contact','messageId','generate'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xf958,0xe6));var _0x8f95=function(_0x3284d4,_0x2108c2){_0x3284d4=_0x3284d4-0x0;var _0x1639fa=_0xf958[_0x3284d4];return _0x1639fa;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232c});config[_0x8f95('0x9')]=_['defaults'](config[_0x8f95('0x9')],{'host':_0x8f95('0xa'),'port':0x18eb});var socket=require(_0x8f95('0xb'))(new Redis(config[_0x8f95('0x9')]));require(_0x8f95('0xc'))['register'](socket);function respondWithRpcPromise(_0x378eb1,_0x604646,_0x56d8e2){return new BPromise(function(_0x382f2c,_0x4e97bd){return client[_0x8f95('0xd')](_0x378eb1,_0x56d8e2)['then'](function(_0x4192df){logger[_0x8f95('0xe')](_0x8f95('0xf'),_0x604646,'request\x20sent');logger[_0x8f95('0x10')](_0x8f95('0x11'),_0x604646,_0x8f95('0x12'),JSON['stringify'](_0x4192df));if(_0x4192df[_0x8f95('0x13')]){if(_0x4192df[_0x8f95('0x13')][_0x8f95('0x14')]===0x1f4){logger[_0x8f95('0x13')](_0x8f95('0xf'),_0x604646,_0x4192df[_0x8f95('0x13')][_0x8f95('0x15')]);return _0x4e97bd(_0x4192df['error']['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x604646,_0x4192df['error'][_0x8f95('0x15')]);return _0x382f2c(_0x4192df[_0x8f95('0x13')][_0x8f95('0x15')]);}else{logger[_0x8f95('0xe')]('MailAccount,\x20%s,\x20%s',_0x604646,'request\x20sent');_0x382f2c(_0x4192df[_0x8f95('0x16')][_0x8f95('0x15')]);}})['catch'](function(_0x445db0){logger[_0x8f95('0x13')](_0x8f95('0xf'),_0x604646,_0x445db0);_0x4e97bd(_0x445db0);});});}exports[_0x8f95('0x17')]=function(_0x4f2f60){var _0x258003=this;return new Promise(function(_0x30e0c5,_0x2b90bf){return db[_0x8f95('0x18')]['findAll']({'raw':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f2f60[_0x8f95('0x19')]?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1b')]||null:null,'attributes':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1c')]||null:null,'limit':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1d')]||null:null,'include':_0x4f2f60['options']?_0x4f2f60[_0x8f95('0x19')][_0x8f95('0x1e')]?_[_0x8f95('0x1f')](_0x4f2f60[_0x8f95('0x19')]['include'],function(_0x2ef192){return{'model':db[_0x2ef192['model']],'as':_0x2ef192['as'],'attributes':_0x2ef192['attributes'],'include':_0x2ef192[_0x8f95('0x1e')]?_['map'](_0x2ef192[_0x8f95('0x1e')],function(_0x5ccb23){return{'model':db[_0x5ccb23['model']],'as':_0x5ccb23['as'],'attributes':_0x5ccb23[_0x8f95('0x1c')],'include':_0x5ccb23['include']?_[_0x8f95('0x1f')](_0x5ccb23['include'],function(_0x43c843){return{'model':db[_0x43c843[_0x8f95('0x20')]],'as':_0x43c843['as'],'attributes':_0x43c843[_0x8f95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f95('0x21')](function(_0x467956){logger[_0x8f95('0xe')](_0x8f95('0x17'),_0x4f2f60);logger[_0x8f95('0x10')](_0x8f95('0x17'),_0x4f2f60,JSON[_0x8f95('0x22')](_0x467956));_0x30e0c5(_0x467956);})[_0x8f95('0x23')](function(_0x5e11c4){logger[_0x8f95('0x13')](_0x8f95('0x17'),_0x5e11c4['message'],_0x4f2f60);_0x2b90bf(_0x258003['error'](0x1f4,_0x5e11c4['message']));});});};exports[_0x8f95('0x24')]=function(_0x5b55b2){var _0x214975=this;return new Promise(function(_0x576160,_0x5841d1){return db[_0x8f95('0x18')][_0x8f95('0x25')]({'raw':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2[_0x8f95('0x19')][_0x8f95('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2[_0x8f95('0x19')][_0x8f95('0x1b')]||null:null,'attributes':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2[_0x8f95('0x19')]['attributes']||null:null,'include':_0x5b55b2[_0x8f95('0x19')]?_0x5b55b2['options'][_0x8f95('0x1e')]?_[_0x8f95('0x1f')](_0x5b55b2[_0x8f95('0x19')][_0x8f95('0x1e')],function(_0x502689){return{'model':db[_0x502689[_0x8f95('0x20')]],'as':_0x502689['as'],'attributes':_0x502689[_0x8f95('0x1c')],'include':_0x502689[_0x8f95('0x1e')]?_['map'](_0x502689['include'],function(_0x45f4e9){return{'model':db[_0x45f4e9[_0x8f95('0x20')]],'as':_0x45f4e9['as'],'attributes':_0x45f4e9['attributes'],'include':_0x45f4e9[_0x8f95('0x1e')]?_[_0x8f95('0x1f')](_0x45f4e9[_0x8f95('0x1e')],function(_0x21391f){return{'model':db[_0x21391f[_0x8f95('0x20')]],'as':_0x21391f['as'],'attributes':_0x21391f[_0x8f95('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f95('0x21')](function(_0x20da0b){logger[_0x8f95('0xe')](_0x8f95('0x24'),_0x5b55b2);logger[_0x8f95('0x10')](_0x8f95('0x24'),_0x5b55b2,JSON[_0x8f95('0x22')](_0x20da0b));_0x576160(_0x20da0b);})[_0x8f95('0x23')](function(_0x48efca){logger[_0x8f95('0x13')](_0x8f95('0x24'),_0x48efca[_0x8f95('0x15')],_0x5b55b2);_0x5841d1(_0x214975[_0x8f95('0x13')](0x1f4,_0x48efca[_0x8f95('0x15')]));});});};exports[_0x8f95('0x26')]=function(_0x220e47){var _0x2fc45f=this;return new Promise(function(_0x109840,_0x2ee915){var _0xd7bfec={'body':_0x220e47[_0x8f95('0x27')],'channel':_0x8f95('0x28')};var _0x2265bf=_['difference'](_[_0x8f95('0x29')](db[_0x8f95('0x2a')][_0x8f95('0x2b')]),[_0x8f95('0x2c'),_0x8f95('0x2d'),_0x8f95('0x2e'),_0x8f95('0x2f')]);var _0x423329=![];if(_0x220e47['body']['id']){delete _0x220e47[_0x8f95('0x27')]['id'];}if(_[_0x8f95('0x30')](_0x220e47[_0x8f95('0x27')][_0x8f95('0x31')])){return _0x2ee915(_0x2fc45f[_0x8f95('0x13')](0x1f4,_0x8f95('0x32')));}if(_['isNil'](_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')])||_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')]===''){return _0x2ee915(_0x2fc45f['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')])){return _0x2ee915(_0x2fc45f['error'](0x1f4,_0x8f95('0x34')+_0x2265bf));}if(!_['includes'](_0x2265bf,_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')])){return _0x2ee915(_0x2fc45f['error'](0x1f4,_0x8f95('0x35')+_0x2265bf));}var _0xd051e9={};_0xd051e9[_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')]]=_0x220e47[_0x8f95('0x27')][_0x8f95('0x31')];return db[_0x8f95('0x18')][_0x8f95('0x25')]({'where':{'id':_0x220e47[_0x8f95('0x36')]['id']},'include':[{'model':db[_0x8f95('0x37')],'as':'List','include':[{'model':db[_0x8f95('0x2a')],'as':_0x8f95('0x38'),'where':_0xd051e9,'limit':0x1,'order':[[_0x8f95('0x2d'),_0x8f95('0x39')]]}]},{'model':db[_0x8f95('0x3a')],'as':_0x8f95('0x3b')},{'model':db[_0x8f95('0x3c')],'as':_0x8f95('0x3d')}]})[_0x8f95('0x21')](function(_0x2627e7){if(_0x2627e7&&_0x2627e7[_0x8f95('0x3e')]){var _0x704c2a=_0x2627e7['get']({'plain':!![]});_0xd7bfec[_0x8f95('0x36')]=_[_0x8f95('0x3f')](_0x704c2a,[_0x8f95('0x3b'),_0x8f95('0x3e')]);_0xd7bfec[_0x8f95('0x40')]=_0x704c2a[_0x8f95('0x3b')];_0xd7bfec[_0x8f95('0x41')]=_0x704c2a['List'];_0xd7bfec[_0x8f95('0x40')]=_[_0x8f95('0x42')](_0xd7bfec[_0x8f95('0x40')],[_0x8f95('0x43')],[_0x8f95('0x44')]);if(_0xd7bfec['account']&&_0xd7bfec[_0x8f95('0x36')][_0x8f95('0x45')]){_0xd7bfec[_0x8f95('0x40')][_0x8f95('0x46')]({'id':0x0,'priority':_0xd7bfec['applications'][_0x8f95('0x47')]+0x1,'app':_0x8f95('0x48'),'appdata':_0x8f95('0x45'),'interval':_0x8f95('0x49')});}if(_0xd7bfec['account'][_0x8f95('0x3b')]){delete _0xd7bfec[_0x8f95('0x36')][_0x8f95('0x3b')];}if(_0xd7bfec[_0x8f95('0x36')][_0x8f95('0x3e')]){delete _0xd7bfec[_0x8f95('0x36')][_0x8f95('0x3e')];}if(_0x704c2a[_0x8f95('0x3e')][_0x8f95('0x38')][_0x8f95('0x47')]){return _0x704c2a[_0x8f95('0x3e')]['Contacts'][0x0];}var _0x4aaa74=_[_0x8f95('0x4a')](_0x220e47[_0x8f95('0x27')],{'firstName':_0x220e47['body'][_0x8f95('0x31')],'ListId':_0x704c2a['ListId']});_0x4aaa74[_0x220e47[_0x8f95('0x27')][_0x8f95('0x33')]]=_0x220e47['body']['from'];return db[_0x8f95('0x2a')][_0x8f95('0x4b')](_0x4aaa74);}else{throw new Error('List\x20not\x20found');}})[_0x8f95('0x21')](function(_0x56fe61){_0xd7bfec[_0x8f95('0x4c')]=_0x56fe61;if(_0x56fe61){if(!_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x4d')]){_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x4d')]=rs[_0x8f95('0x4e')]()+'\x20'+_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['from'];}var _0x2015a1={'ContactId':_0x56fe61['id'],'MailAccountId':_0x220e47[_0x8f95('0x36')]['id'],'inReplyTo':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['messageId'],'to':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x31')],'cc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['cc'],'subject':_0x220e47['body'][_0x8f95('0x15')][_0x8f95('0x4f')],'attach':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x50')],'lastMsgAt':moment()[_0x8f95('0x51')](_0x8f95('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')]};return db['MailInteraction'][_0x8f95('0x25')]({'where':{'closed':![],'MailAccountId':_0x220e47[_0x8f95('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8f95('0x53'),'attributes':['messageId'],'where':{'messageId':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x54')]}}]})[_0x8f95('0x21')](function(_0x28029){if(_0x28029){return[_0x28029,![]];}return db['MailInteraction'][_0x8f95('0x4b')](_0x2015a1)['then'](function(_0x133ce0){return[_0x133ce0,!![]];});});}else{throw new Error(_0x8f95('0x55'));}})[_0x8f95('0x56')](function(_0x26f41,_0xd7f2ee){if(_0x26f41){_0x423329=_0xd7f2ee;if(!_0xd7f2ee){return _0x26f41[_0x8f95('0x57')]({'inReplyTo':_0x220e47['body'][_0x8f95('0x15')][_0x8f95('0x4d')],'to':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x31')],'cc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['cc'],'subject':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x4f')],'attach':_0x26f41[_0x8f95('0x50')]?_0x26f41[_0x8f95('0x50')]:_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x50')],'substatus':null,'substatusAt':moment()[_0x8f95('0x51')](_0x8f95('0x52')),'lastMsgAt':moment()[_0x8f95('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')]});}else{return _0x26f41;}}})[_0x8f95('0x21')](function(_0x3f9b43){_0xd7bfec[_0x8f95('0x58')]=_0x3f9b43[_0x8f95('0x59')]({'plain':!![]});_0xd7bfec[_0x8f95('0x58')][_0x8f95('0x5a')]=_0x423329;return db[_0x8f95('0x5b')][_0x8f95('0x4b')]({'body':_0x220e47[_0x8f95('0x27')][_0x8f95('0x27')],'MailAccountId':_0x220e47[_0x8f95('0x36')]['id'],'MailInteractionId':_0x3f9b43['id'],'direction':'in','ContactId':_0xd7bfec[_0x8f95('0x4c')]['id'],'messageId':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x4d')],'from':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x31')],'to':_0x220e47['body'][_0x8f95('0x15')]['to'],'cc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['cc'],'subject':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x4f')],'attach':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x50')],'Attachments':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')][_0x8f95('0x5c')],'originTo':_0x220e47[_0x8f95('0x27')]['message'][_0x8f95('0x5d')],'originCc':_0x220e47[_0x8f95('0x27')][_0x8f95('0x15')]['originCc'],'bcc':_0x220e47['body'][_0x8f95('0x15')]['bcc']},{'include':[{'model':db['Attachment'],'as':_0x8f95('0x5e')}]});})[_0x8f95('0x21')](function(_0x323072){_0xd7bfec[_0x8f95('0x15')]=_0x323072;if(_0xd7bfec[_0x8f95('0x58')][_0x8f95('0x5f')]){return db[_0x8f95('0x60')][_0x8f95('0x25')]({'attributes':['id',_0x8f95('0x61')],'where':{'id':_0xd7bfec[_0x8f95('0x58')][_0x8f95('0x5f')]}})[_0x8f95('0x21')](function(_0x3f0684){if(_0x3f0684){_0xd7bfec[_0x8f95('0x40')][_0x8f95('0x62')]({'id':0x0,'priority':0x0,'app':_0x8f95('0x63'),'appdata':_0x3f0684[_0x8f95('0x61')]+','+(_0xd7bfec[_0x8f95('0x36')][_0x8f95('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8f95('0x65'),'startRouting',_0xd7bfec);});}return respondWithRpcPromise(_0x8f95('0x65'),_0x8f95('0x66'),_0xd7bfec);})[_0x8f95('0x21')](function(_0x47e5ab){_0x109840(_0x47e5ab);})[_0x8f95('0x23')](function(_0x3f31e4){_0x2ee915(_0x2fc45f['error'](0x1f4,_0x3f31e4[_0x8f95('0x15')]));});});}; \ No newline at end of file +var _0xde9d=['close','*,*,*,*','create','List\x20not\x20found','contact','messageId','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','attributes','model','then','debug','find','ShowMailAccount','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','MailApplication','MailServerOut','get','omit','Applications','applications','list','orderBy','asc','autoclose','push','length'];(function(_0x12d4d3,_0x6b42e6){var _0x32fdca=function(_0x437223){while(--_0x437223){_0x12d4d3['push'](_0x12d4d3['shift']());}};_0x32fdca(++_0x6b42e6);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var moment=require(_0xdde9('0x2'));var BPromise=require(_0xdde9('0x3'));var rs=require(_0xdde9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdde9('0x5'))['db'];var utils=require(_0xdde9('0x6'));var logger=require(_0xdde9('0x7'))('rpc');var config=require(_0xdde9('0x8'));var jayson=require(_0xdde9('0x9'));var client=jayson[_0xdde9('0xa')]['http']({'port':0x232c});config[_0xdde9('0xb')]=_[_0xdde9('0xc')](config[_0xdde9('0xb')],{'host':_0xdde9('0xd'),'port':0x18eb});var socket=require(_0xdde9('0xe'))(new Redis(config['redis']));require(_0xdde9('0xf'))['register'](socket);function respondWithRpcPromise(_0x494899,_0x259849,_0x29c882){return new BPromise(function(_0x2b7e77,_0x4ebfe3){return client[_0xdde9('0x10')](_0x494899,_0x29c882)['then'](function(_0x478bec){logger[_0xdde9('0x11')](_0xdde9('0x12'),_0x259849,_0xdde9('0x13'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x259849,_0xdde9('0x13'),JSON[_0xdde9('0x14')](_0x478bec));if(_0x478bec['error']){if(_0x478bec['error'][_0xdde9('0x15')]===0x1f4){logger[_0xdde9('0x16')]('MailAccount,\x20%s,\x20%s',_0x259849,_0x478bec[_0xdde9('0x16')][_0xdde9('0x17')]);return _0x4ebfe3(_0x478bec[_0xdde9('0x16')]['message']);}logger[_0xdde9('0x16')]('MailAccount,\x20%s,\x20%s',_0x259849,_0x478bec['error'][_0xdde9('0x17')]);return _0x2b7e77(_0x478bec['error']['message']);}else{logger['info'](_0xdde9('0x12'),_0x259849,_0xdde9('0x13'));_0x2b7e77(_0x478bec[_0xdde9('0x18')][_0xdde9('0x17')]);}})[_0xdde9('0x19')](function(_0xcaf743){logger[_0xdde9('0x16')](_0xdde9('0x12'),_0x259849,_0xcaf743);_0x4ebfe3(_0xcaf743);});});}exports[_0xdde9('0x1a')]=function(_0x5ef451){var _0x5219c7=this;return new Promise(function(_0x71a5bf,_0x26204d){return db[_0xdde9('0x1b')][_0xdde9('0x1c')]({'raw':_0x5ef451[_0xdde9('0x1d')]?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ef451['options']?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x1f')]||null:null,'attributes':_0x5ef451[_0xdde9('0x1d')]?_0x5ef451['options']['attributes']||null:null,'limit':_0x5ef451[_0xdde9('0x1d')]?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x20')]||null:null,'include':_0x5ef451['options']?_0x5ef451[_0xdde9('0x1d')][_0xdde9('0x21')]?_[_0xdde9('0x22')](_0x5ef451[_0xdde9('0x1d')]['include'],function(_0x5e5ffd){return{'model':db[_0x5e5ffd['model']],'as':_0x5e5ffd['as'],'attributes':_0x5e5ffd[_0xdde9('0x23')],'include':_0x5e5ffd['include']?_[_0xdde9('0x22')](_0x5e5ffd[_0xdde9('0x21')],function(_0x4ea896){return{'model':db[_0x4ea896['model']],'as':_0x4ea896['as'],'attributes':_0x4ea896[_0xdde9('0x23')],'include':_0x4ea896[_0xdde9('0x21')]?_[_0xdde9('0x22')](_0x4ea896['include'],function(_0x4461db){return{'model':db[_0x4461db[_0xdde9('0x24')]],'as':_0x4461db['as'],'attributes':_0x4461db[_0xdde9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdde9('0x25')](function(_0x306575){logger[_0xdde9('0x11')](_0xdde9('0x1a'),_0x5ef451);logger[_0xdde9('0x26')](_0xdde9('0x1a'),_0x5ef451,JSON['stringify'](_0x306575));_0x71a5bf(_0x306575);})[_0xdde9('0x19')](function(_0x4a631c){logger[_0xdde9('0x16')](_0xdde9('0x1a'),_0x4a631c[_0xdde9('0x17')],_0x5ef451);_0x26204d(_0x5219c7['error'](0x1f4,_0x4a631c['message']));});});};exports['ShowMailAccount']=function(_0xbe4b9c){var _0xb369a8=this;return new Promise(function(_0x35af5b,_0x1b252e){return db[_0xdde9('0x1b')][_0xdde9('0x27')]({'raw':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')][_0xdde9('0x1f')]||null:null,'attributes':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')][_0xdde9('0x23')]||null:null,'include':_0xbe4b9c[_0xdde9('0x1d')]?_0xbe4b9c[_0xdde9('0x1d')]['include']?_[_0xdde9('0x22')](_0xbe4b9c[_0xdde9('0x1d')][_0xdde9('0x21')],function(_0x1c32cf){return{'model':db[_0x1c32cf[_0xdde9('0x24')]],'as':_0x1c32cf['as'],'attributes':_0x1c32cf[_0xdde9('0x23')],'include':_0x1c32cf['include']?_[_0xdde9('0x22')](_0x1c32cf[_0xdde9('0x21')],function(_0xa9ca1a){return{'model':db[_0xa9ca1a[_0xdde9('0x24')]],'as':_0xa9ca1a['as'],'attributes':_0xa9ca1a[_0xdde9('0x23')],'include':_0xa9ca1a[_0xdde9('0x21')]?_['map'](_0xa9ca1a['include'],function(_0x234d88){return{'model':db[_0x234d88[_0xdde9('0x24')]],'as':_0x234d88['as'],'attributes':_0x234d88[_0xdde9('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdde9('0x25')](function(_0x1aa10e){logger[_0xdde9('0x11')](_0xdde9('0x28'),_0xbe4b9c);logger['debug'](_0xdde9('0x28'),_0xbe4b9c,JSON['stringify'](_0x1aa10e));_0x35af5b(_0x1aa10e);})['catch'](function(_0x33e742){logger['error'](_0xdde9('0x28'),_0x33e742['message'],_0xbe4b9c);_0x1b252e(_0xb369a8['error'](0x1f4,_0x33e742[_0xdde9('0x17')]));});});};exports['NotifyMailAccount']=function(_0x1bc20a){var _0x5038ac=this;return new Promise(function(_0x369565,_0x5ae971){var _0x3b1d55={'body':_0x1bc20a['body'],'channel':_0xdde9('0x29')};var _0x541570=_[_0xdde9('0x2a')](_[_0xdde9('0x2b')](db[_0xdde9('0x2c')]['rawAttributes']),[_0xdde9('0x2d'),_0xdde9('0x2e'),_0xdde9('0x2f'),_0xdde9('0x30')]);var _0x1d5762=![];if(_0x1bc20a[_0xdde9('0x31')]['id']){delete _0x1bc20a[_0xdde9('0x31')]['id'];}if(_[_0xdde9('0x32')](_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x33')])){return _0x5ae971(_0x5038ac['error'](0x1f4,_0xdde9('0x34')));}if(_[_0xdde9('0x32')](_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x31')])||_0x1bc20a['body'][_0xdde9('0x31')]===''){return _0x5ae971(_0x5038ac['error'](0x1f4,_0xdde9('0x35')));}if(_['isNil'](_0x1bc20a[_0xdde9('0x31')]['mapKey'])){return _0x5ae971(_0x5038ac['error'](0x1f4,_0xdde9('0x36')+_0x541570));}if(!_[_0xdde9('0x37')](_0x541570,_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x38')])){return _0x5ae971(_0x5038ac[_0xdde9('0x16')](0x1f4,_0xdde9('0x39')+_0x541570));}var _0x4f5431={};_0x4f5431[_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x38')]]=_0x1bc20a['body']['from'];return db[_0xdde9('0x1b')][_0xdde9('0x27')]({'where':{'id':_0x1bc20a[_0xdde9('0x3a')]['id']},'include':[{'model':db[_0xdde9('0x3b')],'as':_0xdde9('0x3c'),'include':[{'model':db['CmContact'],'as':_0xdde9('0x3d'),'where':_0x4f5431,'limit':0x1,'order':[[_0xdde9('0x2e'),'DESC']]}]},{'model':db[_0xdde9('0x3e')],'as':'Applications'},{'model':db[_0xdde9('0x3f')],'as':'Smtp'}]})[_0xdde9('0x25')](function(_0x509fc2){if(_0x509fc2&&_0x509fc2[_0xdde9('0x3c')]){var _0x4dd10a=_0x509fc2[_0xdde9('0x40')]({'plain':!![]});_0x3b1d55[_0xdde9('0x3a')]=_[_0xdde9('0x41')](_0x4dd10a,[_0xdde9('0x42'),_0xdde9('0x3c')]);_0x3b1d55[_0xdde9('0x43')]=_0x4dd10a[_0xdde9('0x42')];_0x3b1d55[_0xdde9('0x44')]=_0x4dd10a['List'];_0x3b1d55['applications']=_[_0xdde9('0x45')](_0x3b1d55[_0xdde9('0x43')],['priority'],[_0xdde9('0x46')]);if(_0x3b1d55['account']&&_0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x47')]){_0x3b1d55[_0xdde9('0x43')][_0xdde9('0x48')]({'id':0x0,'priority':_0x3b1d55[_0xdde9('0x43')][_0xdde9('0x49')]+0x1,'app':_0xdde9('0x4a'),'appdata':_0xdde9('0x47'),'interval':_0xdde9('0x4b')});}if(_0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x42')]){delete _0x3b1d55['account'][_0xdde9('0x42')];}if(_0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x3c')]){delete _0x3b1d55[_0xdde9('0x3a')][_0xdde9('0x3c')];}if(_0x4dd10a[_0xdde9('0x3c')][_0xdde9('0x3d')]['length']){return _0x4dd10a[_0xdde9('0x3c')][_0xdde9('0x3d')][0x0];}var _0x3d9995=_[_0xdde9('0xc')](_0x1bc20a[_0xdde9('0x31')],{'firstName':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x33')],'ListId':_0x4dd10a[_0xdde9('0x30')]});_0x3d9995[_0x1bc20a['body'][_0xdde9('0x38')]]=_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x33')];return db['CmContact'][_0xdde9('0x4c')](_0x3d9995);}else{throw new Error(_0xdde9('0x4d'));}})['then'](function(_0x567478){_0x3b1d55[_0xdde9('0x4e')]=_0x567478;if(_0x567478){if(!_0x1bc20a['body'][_0xdde9('0x17')]['messageId']){_0x1bc20a[_0xdde9('0x31')]['message']['messageId']=rs['generate']()+'\x20'+_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['from'];}var _0x5d2a30={'ContactId':_0x567478['id'],'MailAccountId':_0x1bc20a[_0xdde9('0x3a')]['id'],'inReplyTo':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x4f')],'to':_0x1bc20a[_0xdde9('0x31')]['message'][_0xdde9('0x33')],'cc':_0x1bc20a[_0xdde9('0x31')]['message']['cc'],'subject':_0x1bc20a['body']['message'][_0xdde9('0x50')],'attach':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x51')],'lastMsgAt':moment()[_0xdde9('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x31')]};return db[_0xdde9('0x53')][_0xdde9('0x27')]({'where':{'closed':![],'MailAccountId':_0x1bc20a[_0xdde9('0x3a')]['id']},'include':[{'model':db[_0xdde9('0x54')],'as':_0xdde9('0x55'),'attributes':[_0xdde9('0x4f')],'where':{'messageId':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x56')]}}]})[_0xdde9('0x25')](function(_0x302763){if(_0x302763){return[_0x302763,![]];}return db[_0xdde9('0x53')][_0xdde9('0x4c')](_0x5d2a30)[_0xdde9('0x25')](function(_0x4fbd85){return[_0x4fbd85,!![]];});});}else{throw new Error(_0xdde9('0x57'));}})[_0xdde9('0x58')](function(_0x56c154,_0x41e127){if(_0x56c154){_0x1d5762=_0x41e127;if(!_0x41e127){return _0x56c154[_0xdde9('0x59')]({'inReplyTo':_0x1bc20a['body']['message'][_0xdde9('0x4f')],'to':_0x1bc20a['body'][_0xdde9('0x17')][_0xdde9('0x33')],'cc':_0x1bc20a['body'][_0xdde9('0x17')]['cc'],'subject':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['subject'],'attach':_0x56c154['attach']?_0x56c154[_0xdde9('0x51')]:_0x1bc20a['body']['message'][_0xdde9('0x51')],'substatus':null,'substatusAt':moment()[_0xdde9('0x52')](_0xdde9('0x5a')),'lastMsgAt':moment()[_0xdde9('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x31')]});}else{return _0x56c154;}}})[_0xdde9('0x25')](function(_0x1c1aef){_0x3b1d55['interaction']=_0x1c1aef[_0xdde9('0x40')]({'plain':!![]});_0x3b1d55[_0xdde9('0x5b')]['created']=_0x1d5762;return db[_0xdde9('0x54')][_0xdde9('0x4c')]({'body':_0x1bc20a[_0xdde9('0x31')]['body'],'MailAccountId':_0x1bc20a['account']['id'],'MailInteractionId':_0x1c1aef['id'],'direction':'in','ContactId':_0x3b1d55[_0xdde9('0x4e')]['id'],'messageId':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x4f')],'from':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['from'],'to':_0x1bc20a[_0xdde9('0x31')]['message']['to'],'cc':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')]['cc'],'subject':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x50')],'attach':_0x1bc20a['body'][_0xdde9('0x17')]['attach'],'Attachments':_0x1bc20a['body']['message'][_0xdde9('0x5c')],'originTo':_0x1bc20a['body'][_0xdde9('0x17')][_0xdde9('0x5d')],'originCc':_0x1bc20a[_0xdde9('0x31')]['message'][_0xdde9('0x5e')],'bcc':_0x1bc20a[_0xdde9('0x31')][_0xdde9('0x17')][_0xdde9('0x5f')]},{'include':[{'model':db[_0xdde9('0x60')],'as':_0xdde9('0x61')}]});})[_0xdde9('0x25')](function(_0x1a0e9a){_0x3b1d55[_0xdde9('0x17')]=_0x1a0e9a;if(_0x3b1d55[_0xdde9('0x5b')][_0xdde9('0x62')]){return db['User'][_0xdde9('0x27')]({'attributes':['id',_0xdde9('0x63')],'where':{'id':_0x3b1d55['interaction'][_0xdde9('0x62')]}})[_0xdde9('0x25')](function(_0x322edd){if(_0x322edd){_0x3b1d55['applications'][_0xdde9('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x322edd[_0xdde9('0x63')]+','+(_0x3b1d55['account'][_0xdde9('0x65')]||0xa),'interval':_0xdde9('0x4b')});}return respondWithRpcPromise(_0xdde9('0x66'),_0xdde9('0x67'),_0x3b1d55);});}return respondWithRpcPromise(_0xdde9('0x66'),_0xdde9('0x67'),_0x3b1d55);})[_0xdde9('0x25')](function(_0x5388e5){_0x369565(_0x5388e5);})['catch'](function(_0x14dfe2){_0x5ae971(_0x5038ac['error'](0x1f4,_0x14dfe2[_0xdde9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 3016363..f682de5 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 _0xed1f=['removeListener','register','length','./mailAccount.events','save'];(function(_0x246834,_0x26557c){var _0x64c78d=function(_0x432845){while(--_0x432845){_0x246834['push'](_0x246834['shift']());}};_0x64c78d(++_0x26557c);}(_0xed1f,0x170));var _0xfed1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xed1f[_0x178e48];return _0x440d7e;};'use strict';var MailAccountEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),'remove','update'];function createListener(_0x2c9577,_0x5c56c8){return function(_0x36764e){_0x5c56c8['emit'](_0x2c9577,_0x36764e);};}function removeListener(_0x444ba8,_0x423af3){return function(){MailAccountEvents[_0xfed1('0x2')](_0x444ba8,_0x423af3);};}exports[_0xfed1('0x3')]=function(_0x465671){for(var _0x1f2391=0x0,_0x471095=events[_0xfed1('0x4')];_0x1f2391<_0x471095;_0x1f2391++){var _0x4e7fe7=events[_0x1f2391];var _0x37565a=createListener('mailAccount:'+_0x4e7fe7,_0x465671);MailAccountEvents['on'](_0x4e7fe7,_0x37565a);}}; \ No newline at end of file +var _0x0170=['mailAccount:','./mailAccount.events','save','update','removeListener','register','length'];(function(_0x24a03e,_0x69f19d){var _0x13f38f=function(_0x183407){while(--_0x183407){_0x24a03e['push'](_0x24a03e['shift']());}};_0x13f38f(++_0x69f19d);}(_0x0170,0x1d6));var _0x0017=function(_0x5b7181,_0x498246){_0x5b7181=_0x5b7181-0x0;var _0x37d9ea=_0x0170[_0x5b7181];return _0x37d9ea;};'use strict';var MailAccountEvents=require(_0x0017('0x0'));var events=[_0x0017('0x1'),'remove',_0x0017('0x2')];function createListener(_0x2f0da5,_0x215a99){return function(_0xe275a5){_0x215a99['emit'](_0x2f0da5,_0xe275a5);};}function removeListener(_0x20a045,_0x255938){return function(){MailAccountEvents[_0x0017('0x3')](_0x20a045,_0x255938);};}exports[_0x0017('0x4')]=function(_0x2eaf66){for(var _0x321f6e=0x0,_0x52402=events[_0x0017('0x5')];_0x321f6e<_0x52402;_0x321f6e++){var _0xea0574=events[_0x321f6e];var _0x121f63=createListener(_0x0017('0x6')+_0xea0574,_0x2eaf66);MailAccountEvents['on'](_0xea0574,_0x121f63);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fe6a0c2..e486f8f 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 _0xb688=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','util'];(function(_0x3a53b3,_0x18da88){var _0x4664fd=function(_0x121357){while(--_0x121357){_0x3a53b3['push'](_0x3a53b3['shift']());}};_0x4664fd(++_0x18da88);}(_0xb688,0xcf));var _0x8b68=function(_0x36e3bd,_0x201c77){_0x36e3bd=_0x36e3bd-0x0;var _0xdc68e=_0xb688[_0x36e3bd];return _0xdc68e;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')](_0x8b68('0x9'),auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['put'](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xc')]);router[_0x8b68('0xd')](_0x8b68('0x9'),auth[_0x8b68('0xb')](),controller[_0x8b68('0xe')]);module[_0x8b68('0xf')]=router; \ No newline at end of file +var _0xab40=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','put','/:id','update','destroy','exports','multer','util','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xab40,0xcd));var _0x0ab4=function(_0x5b9e85,_0x364d0d){_0x5b9e85=_0x5b9e85-0x0;var _0xaf7e93=_0xab40[_0x5b9e85];return _0xaf7e93;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var auth=require(_0x0ab4('0x3'));var interaction=require(_0x0ab4('0x4'));var config=require(_0x0ab4('0x5'));var controller=require(_0x0ab4('0x6'));router['get']('/:id',auth[_0x0ab4('0x7')](),controller['show']);router[_0x0ab4('0x8')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ab4('0xb')]);module[_0x0ab4('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 71b393b..3098581 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 _0xe6db=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4e93f4,_0x1c9b68){var _0x1f3031=function(_0x42cccc){while(--_0x42cccc){_0x4e93f4['push'](_0x4e93f4['shift']());}};_0x1f3031(++_0x1c9b68);}(_0xe6db,0xc6));var _0xbe6d=function(_0x5791d8,_0x820e85){_0x5791d8=_0x5791d8-0x0;var _0xdc0bd7=_0xe6db[_0x5791d8];return _0xdc0bd7;};'use strict';var Sequelize=require('sequelize');module[_0xbe6d('0x0')]={'priority':{'type':Sequelize[_0xbe6d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbe6d('0x2')],'allowNull':![],'defaultValue':_0xbe6d('0x3')},'appdata':{'type':Sequelize[_0xbe6d('0x4')]()},'description':{'type':Sequelize[_0xbe6d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbe6d('0x5')}}; \ No newline at end of file +var _0x398d=['TEXT','*,*,*,*','exports','STRING'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x398d,0xb6));var _0xd398=function(_0x1d1797,_0x29fd69){_0x1d1797=_0x1d1797-0x0;var _0x307670=_0x398d[_0x1d1797];return _0x307670;};'use strict';var Sequelize=require('sequelize');module[_0xd398('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd398('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd398('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd398('0x1')],'defaultValue':_0xd398('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index dcaafeb..9ff07f3 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 _0x5431=['MailApplication','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','catch','update','body','find','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','show','model'];(function(_0x5fd04,_0x5d6fff){var _0x48c27b=function(_0x3fd78b){while(--_0x3fd78b){_0x5fd04['push'](_0x5fd04['shift']());}};_0x48c27b(++_0x5d6fff);}(_0x5431,0x13c));var _0x1543=function(_0x1eb0ab,_0x2628df){_0x1eb0ab=_0x1eb0ab-0x0;var _0x4c99b8=_0x5431[_0x1eb0ab];return _0x4c99b8;};'use strict';var pdf=require(_0x1543('0x0'));var emlformat=require(_0x1543('0x1'));var rimraf=require(_0x1543('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1543('0x3'));var rp=require(_0x1543('0x4'));var moment=require(_0x1543('0x5'));var BPromise=require(_0x1543('0x6'));var Mustache=require(_0x1543('0x7'));var util=require(_0x1543('0x8'));var path=require(_0x1543('0x9'));var sox=require(_0x1543('0xa'));var csv=require(_0x1543('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1543('0xc'));var squel=require(_0x1543('0xd'));var crypto=require('crypto');var jsforce=require(_0x1543('0xe'));var deskjs=require(_0x1543('0xf'));var toCsv=require(_0x1543('0xb'));var querystring=require(_0x1543('0x10'));var Papa=require(_0x1543('0x11'));var Redis=require('ioredis');var authService=require(_0x1543('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1543('0x13'));var hardwareService=require(_0x1543('0x14'));var logger=require(_0x1543('0x15'))(_0x1543('0x16'));var utils=require(_0x1543('0x17'));var config=require(_0x1543('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1543('0x19'))['db'];function respondWithStatusCode(_0xd54dee,_0x2a7433){_0x2a7433=_0x2a7433||0xcc;return function(_0xc97d0d){if(_0xc97d0d){return _0xd54dee[_0x1543('0x1a')](_0x2a7433);}return _0xd54dee[_0x1543('0x1b')](_0x2a7433)[_0x1543('0x1c')]();};}function respondWithResult(_0x108adc,_0x1e4ad9){_0x1e4ad9=_0x1e4ad9||0xc8;return function(_0x2e56dd){if(_0x2e56dd){return _0x108adc[_0x1543('0x1b')](_0x1e4ad9)[_0x1543('0x1d')](_0x2e56dd);}};}function respondWithFilteredResult(_0x4733a2,_0x2382e){return function(_0x62e9b9){if(_0x62e9b9){var _0x1c430b=_0x62e9b9[_0x1543('0x1e')],_0x161e9c=_0x2382e[_0x1543('0x1f')],_0x2880a6=_0x2382e[_0x1543('0x1f')]+_0x2382e[_0x1543('0x20')],_0x55d9cb;if(_0x2880a6>=_0x1c430b){_0x2880a6=_0x1c430b;_0x55d9cb=0xc8;}else{_0x55d9cb=0xce;}_0x4733a2[_0x1543('0x1b')](_0x55d9cb);return _0x4733a2[_0x1543('0x21')](_0x1543('0x22'),_0x161e9c+'-'+_0x2880a6+'/'+_0x1c430b)[_0x1543('0x1d')](_0x62e9b9);}return null;};}function patchUpdates(_0x2bdb46){return function(_0x4b1870){try{jsonpatch['apply'](_0x4b1870,_0x2bdb46,!![]);}catch(_0x196c95){return BPromise[_0x1543('0x23')](_0x196c95);}return _0x4b1870[_0x1543('0x24')]();};}function saveUpdates(_0x1e8b04,_0x103f5b){return function(_0xaa50aa){if(_0xaa50aa){return _0xaa50aa['update'](_0x1e8b04)[_0x1543('0x25')](function(_0x28f9ac){return _0x28f9ac;});}return null;};}function removeEntity(_0x4a24ee,_0x54ddf9){return function(_0x2efc6f){if(_0x2efc6f){return _0x2efc6f[_0x1543('0x26')]()[_0x1543('0x25')](function(){_0x4a24ee[_0x1543('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed8f8,_0x2e10f2){return function(_0x1ac596){if(!_0x1ac596){_0x5ed8f8[_0x1543('0x1a')](0x194);}return _0x1ac596;};}function handleError(_0x2da404,_0x471ec4){_0x471ec4=_0x471ec4||0x1f4;return function(_0x18a76b){logger['error'](_0x18a76b[_0x1543('0x27')]);if(_0x18a76b[_0x1543('0x28')]){delete _0x18a76b['name'];}_0x2da404[_0x1543('0x1b')](_0x471ec4)[_0x1543('0x29')](_0x18a76b);};}exports[_0x1543('0x2a')]=function(_0x56805c,_0x54ce5e){var _0x1068aa={'raw':!![],'where':{'id':_0x56805c['params']['id']}},_0x240021={};_0x240021[_0x1543('0x2b')]=_['keys'](db[_0x1543('0x2c')]['rawAttributes']);_0x240021[_0x1543('0x2d')]=_[_0x1543('0x2e')](_0x56805c[_0x1543('0x2d')]);_0x240021[_0x1543('0x2f')]=_[_0x1543('0x30')](_0x240021[_0x1543('0x2b')],_0x240021[_0x1543('0x2d')]);_0x1068aa[_0x1543('0x31')]=_[_0x1543('0x30')](_0x240021[_0x1543('0x2b')],qs[_0x1543('0x32')](_0x56805c[_0x1543('0x2d')][_0x1543('0x32')]));_0x1068aa[_0x1543('0x31')]=_0x1068aa[_0x1543('0x31')][_0x1543('0x33')]?_0x1068aa[_0x1543('0x31')]:_0x240021[_0x1543('0x2b')];if(_0x56805c[_0x1543('0x2d')][_0x1543('0x34')]){_0x1068aa[_0x1543('0x35')]=[{'all':!![]}];}_0x1068aa=_['merge']({},_0x1068aa,_0x56805c[_0x1543('0x36')]);return db[_0x1543('0x2c')]['find'](_0x1068aa)[_0x1543('0x25')](handleEntityNotFound(_0x54ce5e,null))[_0x1543('0x25')](respondWithResult(_0x54ce5e,null))[_0x1543('0x37')](handleError(_0x54ce5e,null));};exports[_0x1543('0x38')]=function(_0x33be30,_0x64751b){if(_0x33be30[_0x1543('0x39')]['id']){delete _0x33be30[_0x1543('0x39')]['id'];}return db[_0x1543('0x2c')][_0x1543('0x3a')]({'where':{'id':_0x33be30[_0x1543('0x3b')]['id']}})[_0x1543('0x25')](handleEntityNotFound(_0x64751b,null))['then'](saveUpdates(_0x33be30[_0x1543('0x39')],null))[_0x1543('0x25')](respondWithResult(_0x64751b,null))[_0x1543('0x37')](handleError(_0x64751b,null));};exports[_0x1543('0x26')]=function(_0x470251,_0x41952b){return db[_0x1543('0x2c')][_0x1543('0x3a')]({'where':{'id':_0x470251['params']['id']}})[_0x1543('0x25')](handleEntityNotFound(_0x41952b,null))[_0x1543('0x25')](removeEntity(_0x41952b,null))[_0x1543('0x37')](handleError(_0x41952b,null));}; \ No newline at end of file +var _0x55b7=['attributes','fields','length','includeAll','include','merge','options','catch','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model'];(function(_0x158448,_0x2a3253){var _0x1717a9=function(_0x56652d){while(--_0x56652d){_0x158448['push'](_0x158448['shift']());}};_0x1717a9(++_0x2a3253);}(_0x55b7,0x7e));var _0x755b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x55b7[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x755b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x755b('0x1'));var zipdir=require(_0x755b('0x2'));var jsonpatch=require(_0x755b('0x3'));var rp=require('request-promise');var moment=require(_0x755b('0x4'));var BPromise=require(_0x755b('0x5'));var Mustache=require(_0x755b('0x6'));var util=require(_0x755b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x755b('0x8'));var fs=require('fs');var _=require(_0x755b('0x9'));var squel=require(_0x755b('0xa'));var crypto=require(_0x755b('0xb'));var jsforce=require(_0x755b('0xc'));var deskjs=require(_0x755b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x755b('0xe'));var Papa=require(_0x755b('0xf'));var Redis=require(_0x755b('0x10'));var authService=require(_0x755b('0x11'));var qs=require(_0x755b('0x12'));var as=require(_0x755b('0x13'));var hardwareService=require(_0x755b('0x14'));var logger=require('../../config/logger')(_0x755b('0x15'));var utils=require(_0x755b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x755b('0x17'))['db'];function respondWithStatusCode(_0xe858eb,_0x251800){_0x251800=_0x251800||0xcc;return function(_0x372623){if(_0x372623){return _0xe858eb[_0x755b('0x18')](_0x251800);}return _0xe858eb[_0x755b('0x19')](_0x251800)[_0x755b('0x1a')]();};}function respondWithResult(_0x44257b,_0x32f1db){_0x32f1db=_0x32f1db||0xc8;return function(_0x473072){if(_0x473072){return _0x44257b['status'](_0x32f1db)[_0x755b('0x1b')](_0x473072);}};}function respondWithFilteredResult(_0x5cb22b,_0x3846e3){return function(_0x2a3026){if(_0x2a3026){var _0x4e481d=_0x2a3026[_0x755b('0x1c')],_0x1b3dec=_0x3846e3[_0x755b('0x1d')],_0x1170df=_0x3846e3[_0x755b('0x1d')]+_0x3846e3['limit'],_0x372b7a;if(_0x1170df>=_0x4e481d){_0x1170df=_0x4e481d;_0x372b7a=0xc8;}else{_0x372b7a=0xce;}_0x5cb22b['status'](_0x372b7a);return _0x5cb22b[_0x755b('0x1e')](_0x755b('0x1f'),_0x1b3dec+'-'+_0x1170df+'/'+_0x4e481d)['json'](_0x2a3026);}return null;};}function patchUpdates(_0x538f9e){return function(_0x4091de){try{jsonpatch[_0x755b('0x20')](_0x4091de,_0x538f9e,!![]);}catch(_0xa51c4){return BPromise[_0x755b('0x21')](_0xa51c4);}return _0x4091de['save']();};}function saveUpdates(_0x2d8c91,_0x5af029){return function(_0x4d326f){if(_0x4d326f){return _0x4d326f[_0x755b('0x22')](_0x2d8c91)[_0x755b('0x23')](function(_0x2409f0){return _0x2409f0;});}return null;};}function removeEntity(_0x4aafed,_0x3a2d17){return function(_0x38ee41){if(_0x38ee41){return _0x38ee41['destroy']()[_0x755b('0x23')](function(){_0x4aafed['status'](0xcc)[_0x755b('0x1a')]();});}};}function handleEntityNotFound(_0x28a3d8,_0x3029f5){return function(_0x9c3e54){if(!_0x9c3e54){_0x28a3d8[_0x755b('0x18')](0x194);}return _0x9c3e54;};}function handleError(_0x399683,_0x4e3db8){_0x4e3db8=_0x4e3db8||0x1f4;return function(_0x7b175f){logger[_0x755b('0x24')](_0x7b175f[_0x755b('0x25')]);if(_0x7b175f[_0x755b('0x26')]){delete _0x7b175f['name'];}_0x399683[_0x755b('0x19')](_0x4e3db8)[_0x755b('0x27')](_0x7b175f);};}exports['show']=function(_0x32c0ee,_0x507c1f){var _0x1eb8a5={'raw':!![],'where':{'id':_0x32c0ee[_0x755b('0x28')]['id']}},_0x5b058b={};_0x5b058b['model']=_[_0x755b('0x29')](db[_0x755b('0x2a')][_0x755b('0x2b')]);_0x5b058b[_0x755b('0x2c')]=_[_0x755b('0x29')](_0x32c0ee[_0x755b('0x2c')]);_0x5b058b[_0x755b('0x2d')]=_[_0x755b('0x2e')](_0x5b058b[_0x755b('0x2f')],_0x5b058b[_0x755b('0x2c')]);_0x1eb8a5[_0x755b('0x30')]=_[_0x755b('0x2e')](_0x5b058b[_0x755b('0x2f')],qs[_0x755b('0x31')](_0x32c0ee[_0x755b('0x2c')]['fields']));_0x1eb8a5[_0x755b('0x30')]=_0x1eb8a5[_0x755b('0x30')][_0x755b('0x32')]?_0x1eb8a5[_0x755b('0x30')]:_0x5b058b[_0x755b('0x2f')];if(_0x32c0ee[_0x755b('0x2c')][_0x755b('0x33')]){_0x1eb8a5[_0x755b('0x34')]=[{'all':!![]}];}_0x1eb8a5=_[_0x755b('0x35')]({},_0x1eb8a5,_0x32c0ee[_0x755b('0x36')]);return db[_0x755b('0x2a')]['find'](_0x1eb8a5)[_0x755b('0x23')](handleEntityNotFound(_0x507c1f,null))[_0x755b('0x23')](respondWithResult(_0x507c1f,null))[_0x755b('0x37')](handleError(_0x507c1f,null));};exports[_0x755b('0x22')]=function(_0xeed4ec,_0x38701f){if(_0xeed4ec['body']['id']){delete _0xeed4ec[_0x755b('0x38')]['id'];}return db[_0x755b('0x2a')][_0x755b('0x39')]({'where':{'id':_0xeed4ec[_0x755b('0x28')]['id']}})['then'](handleEntityNotFound(_0x38701f,null))[_0x755b('0x23')](saveUpdates(_0xeed4ec[_0x755b('0x38')],null))[_0x755b('0x23')](respondWithResult(_0x38701f,null))[_0x755b('0x37')](handleError(_0x38701f,null));};exports['destroy']=function(_0x13bcd7,_0x478c0f){return db[_0x755b('0x2a')]['find']({'where':{'id':_0x13bcd7[_0x755b('0x28')]['id']}})[_0x755b('0x23')](handleEntityNotFound(_0x478c0f,null))['then'](removeEntity(_0x478c0f,null))['catch'](handleError(_0x478c0f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index d20c206..ca24b54 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 _0xd48e=['../../config/environment','exports','MailApplication','mail_applications','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2db04a,_0x95de4a){var _0x36ee26=function(_0x331426){while(--_0x331426){_0x2db04a['push'](_0x2db04a['shift']());}};_0x36ee26(++_0x95de4a);}(_0xd48e,0x93));var _0xed48=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xd48e[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var logger=require(_0xed48('0x1'))(_0xed48('0x2'));var moment=require(_0xed48('0x3'));var BPromise=require(_0xed48('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed48('0x5'));var rimraf=require(_0xed48('0x6'));var config=require(_0xed48('0x7'));var attributes=require('./mailApplication.attributes');module[_0xed48('0x8')]=function(_0x2c937c,_0x400239){return _0x2c937c['define'](_0xed48('0x9'),attributes,{'tableName':_0xed48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6faf=['moment','bluebird','request-promise','rimraf','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0xd42ae9,_0x562ea2){var _0x581cff=function(_0x54ec26){while(--_0x54ec26){_0xd42ae9['push'](_0xd42ae9['shift']());}};_0x581cff(++_0x562ea2);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6fa('0x7'));module['exports']=function(_0xe883dd,_0x3c91fc){return _0xe883dd[_0xf6fa('0x8')](_0xf6fa('0x9'),attributes,{'tableName':_0xf6fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf6fa('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9431483..3588661 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 _0x75e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','stringify','lodash','util','randomstring'];(function(_0x1e753b,_0x209149){var _0x13d34e=function(_0x338150){while(--_0x338150){_0x1e753b['push'](_0x1e753b['shift']());}};_0x13d34e(++_0x209149);}(_0x75e9,0x15d));var _0x975e=function(_0x49decb,_0x8a2bf5){_0x49decb=_0x49decb-0x0;var _0x4161e0=_0x75e9[_0x49decb];return _0x4161e0;};'use strict';var _=require(_0x975e('0x0'));var util=require(_0x975e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x975e('0x2'));var fs=require('fs');var Redis=require(_0x975e('0x3'));var db=require(_0x975e('0x4'))['db'];var utils=require(_0x975e('0x5'));var logger=require(_0x975e('0x6'))(_0x975e('0x7'));var config=require(_0x975e('0x8'));var jayson=require(_0x975e('0x9'));var client=jayson[_0x975e('0xa')][_0x975e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf85cd5,_0x502ff1,_0x17f8f4){return new BPromise(function(_0x2891d2,_0x1768ad){return client[_0x975e('0xc')](_0xf85cd5,_0x17f8f4)[_0x975e('0xd')](function(_0x31d544){logger[_0x975e('0xe')](_0x975e('0xf'),_0x502ff1,_0x975e('0x10'));logger[_0x975e('0x11')](_0x975e('0x12'),_0x502ff1,'request\x20sent',JSON['stringify'](_0x31d544));if(_0x31d544[_0x975e('0x13')]){if(_0x31d544[_0x975e('0x13')][_0x975e('0x14')]===0x1f4){logger['error'](_0x975e('0xf'),_0x502ff1,_0x31d544[_0x975e('0x13')][_0x975e('0x15')]);return _0x1768ad(_0x31d544[_0x975e('0x13')][_0x975e('0x15')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x502ff1,_0x31d544[_0x975e('0x13')]['message']);return _0x2891d2(_0x31d544[_0x975e('0x13')][_0x975e('0x15')]);}else{logger['info'](_0x975e('0xf'),_0x502ff1,_0x975e('0x10'));_0x2891d2(_0x31d544[_0x975e('0x16')][_0x975e('0x15')]);}})['catch'](function(_0x1d49cc){logger['error'](_0x975e('0xf'),_0x502ff1,_0x1d49cc);_0x1768ad(_0x1d49cc);});});}exports[_0x975e('0x17')]=function(_0xf2ba8){var _0x58914=this;return new Promise(function(_0x68d6e7,_0x314002){return db[_0x975e('0x18')][_0x975e('0x19')](_0xf2ba8[_0x975e('0x1a')],{'raw':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8[_0x975e('0x1b')][_0x975e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8[_0x975e('0x1b')][_0x975e('0x1d')]||null:null,'attributes':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8['options'][_0x975e('0x1e')]||null:null,'limit':_0xf2ba8[_0x975e('0x1b')]?_0xf2ba8[_0x975e('0x1b')]['limit']||null:null})['then'](function(_0x1f337c){logger[_0x975e('0xe')](_0x975e('0x17'),_0xf2ba8);logger['debug']('UpdateMailApplication',_0xf2ba8,JSON[_0x975e('0x1f')](_0x1f337c));_0x68d6e7(_0x1f337c);})['catch'](function(_0x35b555){logger[_0x975e('0x13')](_0x975e('0x17'),_0x35b555['message'],_0xf2ba8);_0x314002(_0x58914[_0x975e('0x13')](0x1f4,_0x35b555['message']));});});}; \ No newline at end of file +var _0x9b51=['update','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication'];(function(_0x142cdb,_0x4fd7e6){var _0x5be46a=function(_0x2a9c40){while(--_0x2a9c40){_0x142cdb['push'](_0x142cdb['shift']());}};_0x5be46a(++_0x4fd7e6);}(_0x9b51,0xc6));var _0x19b5=function(_0x32a2c9,_0x27c01c){_0x32a2c9=_0x32a2c9-0x0;var _0x10d835=_0x9b51[_0x32a2c9];return _0x10d835;};'use strict';var _=require(_0x19b5('0x0'));var util=require(_0x19b5('0x1'));var moment=require('moment');var BPromise=require(_0x19b5('0x2'));var rs=require(_0x19b5('0x3'));var fs=require('fs');var Redis=require(_0x19b5('0x4'));var db=require(_0x19b5('0x5'))['db'];var utils=require(_0x19b5('0x6'));var logger=require(_0x19b5('0x7'))(_0x19b5('0x8'));var config=require(_0x19b5('0x9'));var jayson=require(_0x19b5('0xa'));var client=jayson['client'][_0x19b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x309f15,_0x1a8376,_0x2eac5b){return new BPromise(function(_0x3bd84f,_0x2b93c9){return client[_0x19b5('0xc')](_0x309f15,_0x2eac5b)[_0x19b5('0xd')](function(_0x41aad0){logger['info'](_0x19b5('0xe'),_0x1a8376,_0x19b5('0xf'));logger[_0x19b5('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1a8376,_0x19b5('0xf'),JSON[_0x19b5('0x11')](_0x41aad0));if(_0x41aad0[_0x19b5('0x12')]){if(_0x41aad0[_0x19b5('0x12')][_0x19b5('0x13')]===0x1f4){logger[_0x19b5('0x12')](_0x19b5('0xe'),_0x1a8376,_0x41aad0[_0x19b5('0x12')]['message']);return _0x2b93c9(_0x41aad0[_0x19b5('0x12')][_0x19b5('0x14')]);}logger[_0x19b5('0x12')](_0x19b5('0xe'),_0x1a8376,_0x41aad0['error'][_0x19b5('0x14')]);return _0x3bd84f(_0x41aad0[_0x19b5('0x12')]['message']);}else{logger[_0x19b5('0x15')]('MailApplication,\x20%s,\x20%s',_0x1a8376,_0x19b5('0xf'));_0x3bd84f(_0x41aad0[_0x19b5('0x16')][_0x19b5('0x14')]);}})[_0x19b5('0x17')](function(_0x23492f){logger['error'](_0x19b5('0xe'),_0x1a8376,_0x23492f);_0x2b93c9(_0x23492f);});});}exports[_0x19b5('0x18')]=function(_0x1f8741){var _0x2cc9c5=this;return new Promise(function(_0x450190,_0x1d6798){return db[_0x19b5('0x19')][_0x19b5('0x1a')](_0x1f8741['body'],{'raw':_0x1f8741[_0x19b5('0x1b')]?_0x1f8741['options'][_0x19b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f8741[_0x19b5('0x1b')]?_0x1f8741['options'][_0x19b5('0x1d')]||null:null,'attributes':_0x1f8741[_0x19b5('0x1b')]?_0x1f8741[_0x19b5('0x1b')][_0x19b5('0x1e')]||null:null,'limit':_0x1f8741['options']?_0x1f8741[_0x19b5('0x1b')][_0x19b5('0x1f')]||null:null})[_0x19b5('0xd')](function(_0x28e93c){logger[_0x19b5('0x15')](_0x19b5('0x18'),_0x1f8741);logger[_0x19b5('0x10')]('UpdateMailApplication',_0x1f8741,JSON[_0x19b5('0x11')](_0x28e93c));_0x450190(_0x28e93c);})[_0x19b5('0x17')](function(_0x34e257){logger[_0x19b5('0x12')](_0x19b5('0x18'),_0x34e257['message'],_0x1f8741);_0x1d6798(_0x2cc9c5['error'](0x1f4,_0x34e257['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 98908cc..27afd0f 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 _0xa276=['index','get','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mail','addTags','put','/:id','update','delete','destroy','/:id/tags','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated'];(function(_0x1fe4c7,_0x42edec){var _0x2137db=function(_0x4d32a8){while(--_0x4d32a8){_0x1fe4c7['push'](_0x1fe4c7['shift']());}};_0x2137db(++_0x42edec);}(_0xa276,0x9a));var _0x6a27=function(_0x48aa68,_0x59952d){_0x48aa68=_0x48aa68-0x0;var _0x33fd78=_0xa276[_0x48aa68];return _0x33fd78;};'use strict';var multer=require('multer');var util=require(_0x6a27('0x0'));var path=require(_0x6a27('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a27('0x2'));var router=express[_0x6a27('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a27('0x4'));var config=require(_0x6a27('0x5'));var controller=require(_0x6a27('0x6'));router['get']('/',auth[_0x6a27('0x7')](),controller[_0x6a27('0x8')]);router[_0x6a27('0x9')]('/describe',auth[_0x6a27('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6a27('0xa')]);router[_0x6a27('0x9')](_0x6a27('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0x6a27('0x9')](_0x6a27('0xc'),auth[_0x6a27('0x7')](),controller[_0x6a27('0xd')]);router[_0x6a27('0xe')]('/',auth[_0x6a27('0x7')](),controller[_0x6a27('0xf')]);router[_0x6a27('0xe')](_0x6a27('0xb'),auth['isAuthenticated'](),controller[_0x6a27('0x10')]);router['post']('/:id/tags',auth[_0x6a27('0x7')](),interaction[_0x6a27('0x11')](_0x6a27('0x12'),'mailinteraction:addtags'),controller[_0x6a27('0x13')]);router[_0x6a27('0x14')](_0x6a27('0x15'),auth[_0x6a27('0x7')](),interaction[_0x6a27('0x11')]('mail','mailinteraction:update'),controller[_0x6a27('0x16')]);router[_0x6a27('0x17')](_0x6a27('0x15'),auth[_0x6a27('0x7')](),interaction[_0x6a27('0x11')](_0x6a27('0x12'),'mailinteraction:destroy'),controller[_0x6a27('0x18')]);router[_0x6a27('0x17')](_0x6a27('0x19'),auth[_0x6a27('0x7')](),controller['removeTags']);module[_0x6a27('0x1a')]=router; \ No newline at end of file +var _0x0f9f=['../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','download','post','create','/:id/messages','/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x359a94,_0xc6279f){var _0x28e9fe=function(_0x20dc1d){while(--_0x20dc1d){_0x359a94['push'](_0x359a94['shift']());}};_0x28e9fe(++_0xc6279f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0x0f9f[_0x7e3f06];return _0x12b8ff;};'use strict';var multer=require('multer');var util=require(_0xf0f9('0x0'));var path=require(_0xf0f9('0x1'));var timeout=require(_0xf0f9('0x2'));var express=require('express');var router=express[_0xf0f9('0x3')]();var auth=require(_0xf0f9('0x4'));var interaction=require(_0xf0f9('0x5'));var config=require(_0xf0f9('0x6'));var controller=require(_0xf0f9('0x7'));router[_0xf0f9('0x8')]('/',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xa')]);router[_0xf0f9('0x8')](_0xf0f9('0xb'),auth['isAuthenticated'](),controller[_0xf0f9('0xc')]);router[_0xf0f9('0x8')]('/:id',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0x8')]('/:id/messages',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0xe')]);router[_0xf0f9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xf0f9('0xf')]);router[_0xf0f9('0x10')]('/',auth[_0xf0f9('0x9')](),controller[_0xf0f9('0x11')]);router[_0xf0f9('0x10')](_0xf0f9('0x12'),auth[_0xf0f9('0x9')](),controller['addMessage']);router[_0xf0f9('0x10')](_0xf0f9('0x13'),auth[_0xf0f9('0x9')](),interaction[_0xf0f9('0x14')](_0xf0f9('0x15'),'mailinteraction:addtags'),controller[_0xf0f9('0x16')]);router[_0xf0f9('0x17')](_0xf0f9('0x18'),auth[_0xf0f9('0x9')](),interaction[_0xf0f9('0x14')](_0xf0f9('0x15'),_0xf0f9('0x19')),controller[_0xf0f9('0x1a')]);router[_0xf0f9('0x1b')](_0xf0f9('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0xf0f9('0x15'),_0xf0f9('0x1c')),controller['destroy']);router[_0xf0f9('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xf0f9('0x1d')]);module[_0xf0f9('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 73a8300..62837cb 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 _0x70cb=['BOOLEAN','DATE','ENUM','out','long','sequelize','iconv','exports','STRING','TEXT'];(function(_0x584c47,_0x690ace){var _0x8a24a6=function(_0x249369){while(--_0x249369){_0x584c47['push'](_0x584c47['shift']());}};_0x8a24a6(++_0x690ace);}(_0x70cb,0xaf));var _0xb70c=function(_0x311bed,_0x49f61e){_0x311bed=_0x311bed-0x0;var _0x12c58f=_0x70cb[_0x311bed];return _0x12c58f;};'use strict';var Sequelize=require(_0xb70c('0x0'));var iconv=require(_0xb70c('0x1'));module[_0xb70c('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb70c('0x3')]},'secondDisposition':{'type':Sequelize[_0xb70c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb70c('0x3')]},'note':{'type':Sequelize[_0xb70c('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xb70c('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xb70c('0x4')]()},'attach':{'type':Sequelize[_0xb70c('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb70c('0x6')]},'substatus':{'type':Sequelize[_0xb70c('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xb70c('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xb70c('0x7')]('in',_0xb70c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb70c('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb70c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb70c('0x4')](_0xb70c('0x9'))},'lastMsgText':{'type':Sequelize[_0xb70c('0x4')](_0xb70c('0x9'))}}; \ No newline at end of file +var _0x8c32=['TEXT','BOOLEAN','out','ENUM','long','sequelize','iconv','exports','DATE','STRING'];(function(_0xd4f3b,_0x248a75){var _0x6860d8=function(_0x5ca3ba){while(--_0x5ca3ba){_0xd4f3b['push'](_0xd4f3b['shift']());}};_0x6860d8(++_0x248a75);}(_0x8c32,0x1e5));var _0x28c3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8c32[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x28c3('0x0'));var iconv=require(_0x28c3('0x1'));module[_0x28c3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28c3('0x3')]},'disposition':{'type':Sequelize[_0x28c3('0x4')]},'secondDisposition':{'type':Sequelize[_0x28c3('0x4')]},'thirdDisposition':{'type':Sequelize[_0x28c3('0x4')]},'note':{'type':Sequelize[_0x28c3('0x4')]},'inReplyTo':{'type':Sequelize[_0x28c3('0x4')](0x1fe)},'to':{'type':Sequelize[_0x28c3('0x4')]},'cc':{'type':Sequelize[_0x28c3('0x5')]('long')},'subject':{'type':Sequelize[_0x28c3('0x5')]()},'attach':{'type':Sequelize[_0x28c3('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x28c3('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x28c3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x28c3('0x8')]('in',_0x28c3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x28c3('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x28c3('0x5')](_0x28c3('0x9'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 17d21cc..ce86147 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 _0xc4f2=['set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailInteraction','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','nolimit','offset','order','sort','where','pick','field','color','tools_tags','select','u.id','ui.MailInteractionId','from','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','toString','count','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.closedAt','i.attach','i.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','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','filters','includeAll','include','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','log','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','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailInteraction.socket','sendStatus','status','end','limit'];(function(_0x6d2728,_0x42317e){var _0x78b013=function(_0x3a03eb){while(--_0x3a03eb){_0x6d2728['push'](_0x6d2728['shift']());}};_0x78b013(++_0x42317e);}(_0xc4f2,0xd8));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2c4f('0x0'));var emlformat=require(_0x2c4f('0x1'));var rimraf=require(_0x2c4f('0x2'));var zipdir=require(_0x2c4f('0x3'));var jsonpatch=require(_0x2c4f('0x4'));var rp=require(_0x2c4f('0x5'));var moment=require(_0x2c4f('0x6'));var BPromise=require(_0x2c4f('0x7'));var Mustache=require(_0x2c4f('0x8'));var util=require(_0x2c4f('0x9'));var path=require(_0x2c4f('0xa'));var sox=require(_0x2c4f('0xb'));var csv=require(_0x2c4f('0xc'));var ejs=require(_0x2c4f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c4f('0xe'));var crypto=require(_0x2c4f('0xf'));var jsforce=require(_0x2c4f('0x10'));var deskjs=require(_0x2c4f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2c4f('0x12'));var Papa=require(_0x2c4f('0x13'));var htmlToText=require(_0x2c4f('0x14'));var Redis=require(_0x2c4f('0x15'));var authService=require(_0x2c4f('0x16'));var qs=require(_0x2c4f('0x17'));var as=require(_0x2c4f('0x18'));var hardwareService=require(_0x2c4f('0x19'));var logger=require(_0x2c4f('0x1a'))('api');var utils=require(_0x2c4f('0x1b'));var config=require(_0x2c4f('0x1c'));var licenseUtil=require(_0x2c4f('0x1d'));var db=require(_0x2c4f('0x1e'))['db'];config['redis']=_['defaults'](config[_0x2c4f('0x1f')],{'host':_0x2c4f('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2c4f('0x21'))['register'](socket);function respondWithStatusCode(_0x518c19,_0x4ec06f){_0x4ec06f=_0x4ec06f||0xcc;return function(_0x333482){if(_0x333482){return _0x518c19[_0x2c4f('0x22')](_0x4ec06f);}return _0x518c19[_0x2c4f('0x23')](_0x4ec06f)[_0x2c4f('0x24')]();};}function respondWithResult(_0x706d25,_0x2a5e04){_0x2a5e04=_0x2a5e04||0xc8;return function(_0x7bb3b3){if(_0x7bb3b3){return _0x706d25[_0x2c4f('0x23')](_0x2a5e04)['json'](_0x7bb3b3);}};}function respondWithFilteredResult(_0x3ca3ed,_0x4cfd7b){return function(_0x522bdb){if(_0x522bdb){var _0x1d129c=_0x522bdb['count'],_0x3688c9=_0x4cfd7b['offset'],_0x3d7a4a=_0x4cfd7b['offset']+_0x4cfd7b[_0x2c4f('0x25')],_0xce1f3e;if(_0x3d7a4a>=_0x1d129c){_0x3d7a4a=_0x1d129c;_0xce1f3e=0xc8;}else{_0xce1f3e=0xce;}_0x3ca3ed['status'](_0xce1f3e);return _0x3ca3ed[_0x2c4f('0x26')](_0x2c4f('0x27'),_0x3688c9+'-'+_0x3d7a4a+'/'+_0x1d129c)[_0x2c4f('0x28')](_0x522bdb);}return null;};}function patchUpdates(_0xb1c501){return function(_0x12fdfa){try{jsonpatch[_0x2c4f('0x29')](_0x12fdfa,_0xb1c501,!![]);}catch(_0x451335){return BPromise[_0x2c4f('0x2a')](_0x451335);}return _0x12fdfa['save']();};}function saveUpdates(_0x34a8c5,_0x187f1e){return function(_0x5add59){if(_0x5add59){return _0x5add59[_0x2c4f('0x2b')](_0x34a8c5)[_0x2c4f('0x2c')](function(_0x221dc5){return _0x221dc5;});}return null;};}function removeEntity(_0x3e8486,_0x13057c){return function(_0x13647a){if(_0x13647a){return _0x13647a[_0x2c4f('0x2d')]()['then'](function(){_0x3e8486['status'](0xcc)[_0x2c4f('0x24')]();});}};}function handleEntityNotFound(_0x4ca0d9,_0x113d4e){return function(_0x15f2d2){if(!_0x15f2d2){_0x4ca0d9[_0x2c4f('0x22')](0x194);}return _0x15f2d2;};}function handleError(_0x5c3e23,_0x535024){_0x535024=_0x535024||0x1f4;return function(_0x2e521c){logger[_0x2c4f('0x2e')](_0x2e521c['stack']);if(_0x2e521c['name']){delete _0x2e521c[_0x2c4f('0x2f')];}_0x5c3e23['status'](_0x535024)[_0x2c4f('0x30')](_0x2e521c);};}function getInteractionUsers(_0x3e94b8,_0x4c2d79){return new BPromise(function(_0x36d838,_0x1d8a85){try{if(_0x4c2d79[_0x3e94b8['id']]){_0x3e94b8[_0x2c4f('0x31')]=_[_0x2c4f('0x32')](_0x4c2d79[_0x3e94b8['id']],function(_0xbfee6f){return{'id':_0xbfee6f['id'],'fullname':_0xbfee6f[_0x2c4f('0x33')]};});}}catch(_0x35437f){_0x1d8a85(_0x35437f);}_0x36d838(_0x3e94b8);});}function getInteractionTags(_0x170014,_0x4637a5){return new BPromise(function(_0x39ebd8,_0x2837d6){try{if(_0x170014['TagIds']){_0x170014['Tags']=[];_0x170014[_0x2c4f('0x34')]['split'](',')[_0x2c4f('0x35')](function(_0x2b6d1f){_0x170014[_0x2c4f('0x36')][_0x2c4f('0x37')](_0x4637a5[_0x2b6d1f]);});}delete _0x170014[_0x2c4f('0x34')];}catch(_0x42faa4){_0x2837d6(_0x42faa4);}_0x39ebd8(_0x170014);});}function getLastMessageText(_0x3fabea){return new BPromise(function(_0x463b66,_0x34d9cc){return db[_0x2c4f('0x38')]['findOne']({'where':{'id':_0x3fabea['id']},'attributes':[_0x2c4f('0x39'),'lastMsgText'],'raw':!![]})[_0x2c4f('0x2c')](function(_0x32d75a){if(!_0x32d75a[_0x2c4f('0x3a')]){_0x3fabea[_0x2c4f('0x3a')]=_[_0x2c4f('0x3b')](htmlToText[_0x2c4f('0x3c')](_0x32d75a[_0x2c4f('0x39')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3fabea[_0x2c4f('0x3a')]=_0x32d75a[_0x2c4f('0x3a')];}_0x463b66(_0x3fabea);})[_0x2c4f('0x3d')](function(_0x1e606b){_0x34d9cc(_0x1e606b);});});}function updateMailInteraction(_0x5f5345,_0xdf6519,_0x3c2efd,_0x173746){return new BPromise(function(_0x333d0f,_0x4ced62){return getInteractionUsers(_0x5f5345,_0x3c2efd)[_0x2c4f('0x2c')](function(_0x5c9b3e){return getInteractionTags(_0x5c9b3e,_0xdf6519);})[_0x2c4f('0x2c')](function(_0x28f95){if(_0x173746){_0x333d0f(getLastMessageText(_0x28f95));}else{_0x333d0f(_0x28f95);}})[_0x2c4f('0x3d')](function(_0x31e9e5){_0x4ced62(_0x31e9e5);});});}exports[_0x2c4f('0x3e')]=function(_0x14f401,_0x287b09){var _0x36963d={},_0x230d54={},_0x26962c={'count':0x0,'rows':[]};var _0x5b7a8f=_[_0x2c4f('0x32')](db[_0x2c4f('0x38')][_0x2c4f('0x3f')],function(_0x282dd1){return{'name':_0x282dd1['fieldName'],'type':_0x282dd1[_0x2c4f('0x40')][_0x2c4f('0x41')]};});_0x230d54['model']=_[_0x2c4f('0x32')](_0x5b7a8f,'name');_0x230d54[_0x2c4f('0x42')]=_[_0x2c4f('0x43')](_0x14f401[_0x2c4f('0x42')]);_0x230d54['filters']=_[_0x2c4f('0x44')](_0x230d54[_0x2c4f('0x45')],_0x230d54[_0x2c4f('0x42')]);_0x36963d[_0x2c4f('0x46')]=_[_0x2c4f('0x44')](_0x230d54['model'],qs[_0x2c4f('0x47')](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x47')]));_0x36963d[_0x2c4f('0x46')]=_0x36963d[_0x2c4f('0x46')]['length']?_0x36963d[_0x2c4f('0x46')]:_0x230d54['model'];if(!_0x14f401['query']['hasOwnProperty'](_0x2c4f('0x48'))){_0x36963d[_0x2c4f('0x25')]=qs[_0x2c4f('0x25')](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x25')]);_0x36963d[_0x2c4f('0x49')]=qs[_0x2c4f('0x49')](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x49')]);}_0x36963d[_0x2c4f('0x4a')]=qs['sort'](_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x4b')]);_0x36963d[_0x2c4f('0x4c')]=qs['filters'](_[_0x2c4f('0x4d')](_0x14f401[_0x2c4f('0x42')],_0x230d54['filters']),_0x5b7a8f);var _0x59cfc0=[];var _0xc4b466=squel['select']()[_0x2c4f('0x4e')]('id')[_0x2c4f('0x4e')]('name')[_0x2c4f('0x4e')](_0x2c4f('0x4f'))['from'](_0x2c4f('0x50'));var _0x8d070e=squel[_0x2c4f('0x51')]()['field'](_0x2c4f('0x52'))[_0x2c4f('0x4e')]('u.fullname')['field'](_0x2c4f('0x53'))[_0x2c4f('0x54')](_0x2c4f('0x55'),'ui')['left_join'](_0x2c4f('0x56'),'u',_0x2c4f('0x57'));var _0x2bf7b3=squel['select']()[_0x2c4f('0x54')](_0x2c4f('0x58'),'i')[_0x2c4f('0x59')](_0x2c4f('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x2c4f('0x56'),'o',_0x2c4f('0x5b'))[_0x2c4f('0x59')](_0x2c4f('0x5c'),'a','a.id\x20=\x20i.MailAccountId')[_0x2c4f('0x59')](_0x2c4f('0x5d'),'me',_0x2c4f('0x5e'))[_0x2c4f('0x59')]('mail_interaction_has_tags','it',_0x2c4f('0x5f'))[_0x2c4f('0x59')](_0x2c4f('0x50'),'t',_0x2c4f('0x60'));var _0x1652c2=squel['expr']();var _0x4388c5=[];var _0x3b76dd=squel[_0x2c4f('0x61')]();var _0x5916b8;if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x62')]){_0x5916b8=as['parseSearch'](_0x14f401[_0x2c4f('0x42')]['search']);var _0x27d7f9=_0x5916b8[_0x2c4f('0x63')];for(var _0x22f142=0x0;_0x22f142<_0x5916b8[_0x2c4f('0x64')]['length'];_0x22f142++){var _0x25416b=_0x5916b8[_0x2c4f('0x64')][_0x22f142];var _0x75c44a='i';var _0x391b11=_[_0x2c4f('0x65')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x25416b['field']]);if(!_0x391b11){switch(_0x25416b[_0x2c4f('0x4e')]){case _0x2c4f('0x66'):if(_0x25416b[_0x2c4f('0x67')]==0x1){_0x2bf7b3[_0x2c4f('0x68')]('`'+_0x25416b[_0x2c4f('0x4e')]+_0x2c4f('0x69'));}else{_0x2bf7b3[_0x2c4f('0x68')]('`'+_0x25416b[_0x2c4f('0x4e')]+_0x2c4f('0x6a'));}break;case _0x2c4f('0x6b'):if(_0x25416b[_0x2c4f('0x6c')]===_0x2c4f('0x6d')){if(_0x25416b[_0x2c4f('0x67')][_0x2c4f('0x6e')]('\x20')[_0x2c4f('0x6f')]>0x1){_0x1652c2[_0x27d7f9](_0x2c4f('0x70'),qs['getFullTextValue'](_0x25416b[_0x2c4f('0x67')]),null);}else{var _0x1f2bd7='%'+_0x25416b['value']+'%';_0x1652c2[_0x27d7f9](_0x2c4f('0x71'),_0x1f2bd7,_0x1f2bd7,_0x1f2bd7);}}else{_0x391b11=_[_0x2c4f('0x65')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x2c4f('0x72')]);_0x25416b[_0x2c4f('0x4e')]=_0x2c4f('0x72');_0x4682ee=as['buildExpression'](_0x75c44a,_0x391b11[_0x2c4f('0x40')],_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee[_0x2c4f('0x73')],_0x4682ee['value'][_0x2c4f('0x74')],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x24')]);}break;case'Tag':var _0x362ec8=_0x25416b[_0x2c4f('0x67')][_0x2c4f('0x6e')](',')['map'](function(_0x33e689){return Number(_0x33e689);});_0x362ec8['forEach'](function(_0x44beaf){_0x3b76dd['or'](_0x2c4f('0x75'),'%,'+_0x44beaf+',%');});_0x4388c5=_[_0x2c4f('0x76')](_0x4388c5,_0x362ec8);break;case _0x2c4f('0x77'):if(_0x25416b[_0x2c4f('0x6c')]==='$substring'){_0x1652c2[_0x27d7f9](_0x2c4f('0x78'),'%'+_0x25416b['value']+'%',null);}else{_0x391b11=_[_0x2c4f('0x65')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x2c4f('0x79')]);_0x25416b[_0x2c4f('0x4e')]=_0x2c4f('0x79');_0x4682ee=as[_0x2c4f('0x7a')](_0x75c44a,_0x391b11['type'],_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee[_0x2c4f('0x73')],_0x4682ee['value']['start'],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x24')]);}break;case'plainBody':_0x4682ee=as[_0x2c4f('0x7a')]('me',null,_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee['text'],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x74')],_0x4682ee['value'][_0x2c4f('0x24')]);break;}}else{var _0x4682ee=as[_0x2c4f('0x7a')](_0x75c44a,_0x391b11[_0x2c4f('0x40')],_0x25416b);_0x1652c2[_0x27d7f9](_0x4682ee[_0x2c4f('0x73')],_0x4682ee[_0x2c4f('0x67')][_0x2c4f('0x74')],_0x4682ee['value']['end']);}}}else{var _0x4ac23e=_(_0x14f401[_0x2c4f('0x42')])['keys']()[_0x2c4f('0x32')](function(_0x5670d8){return _[_0x2c4f('0x7b')](_0x5b7a8f,[_0x2c4f('0x2f'),_0x5670d8])?_0x5670d8:undefined;})[_0x2c4f('0x7c')]()['value']();if(!_[_0x2c4f('0x7d')](_0x4ac23e)){_0x4ac23e[_0x2c4f('0x35')](function(_0x512257){if(_0x512257==='MailAccountId'){_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x7e'),[]['concat'](_0x14f401['query'][_0x512257]));}else if(_0x512257===_0x2c4f('0x7f')){var _0x2b2eb5=JSON['parse'](_0x14f401[_0x2c4f('0x42')][_0x512257])[_0x2c4f('0x80')];var _0x3b7b77=JSON['parse'](_0x14f401[_0x2c4f('0x42')][_0x512257])[_0x2c4f('0x81')];_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x82'),_0x2b2eb5,_0x3b7b77);}else{if(_0x14f401[_0x2c4f('0x42')][_0x512257]===_0x2c4f('0x83')){_0x2bf7b3[_0x2c4f('0x4c')]('i.'+_0x512257+_0x2c4f('0x84'));}else{_0x2bf7b3['where']('i.'+_0x512257+_0x2c4f('0x85'),_0x14f401[_0x2c4f('0x42')][_0x512257]);}}});}if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x86')]){if(_0x14f401['query'][_0x2c4f('0x86')]==0x1){_0x2bf7b3[_0x2c4f('0x68')](_0x2c4f('0x87'));}else{_0x2bf7b3['having'](_0x2c4f('0x88'));}}if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x89')]){_0x4388c5=_['isArray'](_0x14f401['query'][_0x2c4f('0x89')])?_0x14f401['query']['tag']:new Array(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x89')]);_0x4388c5[_0x2c4f('0x35')](function(_0x5a82ea){_0x3b76dd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5a82ea+',%');});}if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x8a')]){var _0x10eb35=_0x14f401['query'][_0x2c4f('0x8a')][_0x2c4f('0x8b')]('\x5c','\x5c\x5c')[_0x2c4f('0x8b')](/'/g,'\x27\x27');if(qs[_0x2c4f('0x8c')](_0x10eb35)){_0x1652c2['or'](_0x2c4f('0x8d'),_0x10eb35+'%');}else if(qs[_0x2c4f('0x8e')](_0x10eb35)){_0x1652c2['or'](_0x2c4f('0x8f'),_0x10eb35+'%');}else{_0x1652c2['or'](_0x2c4f('0x90'),qs[_0x2c4f('0x91')](_0x10eb35))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2c4f('0x91')](_0x10eb35));}}}_0x2bf7b3[_0x2c4f('0x4c')](_0x1652c2);_0x2bf7b3[_0x2c4f('0x92')]('i.id');var _0x41605a={'type':db[_0x2c4f('0x93')][_0x2c4f('0x94')]['SELECT'],'raw':!![]};var _0x323cb7=_0x2bf7b3[_0x2c4f('0x95')]();_0x323cb7['field'](_0x2c4f('0x96'));_0x323cb7[_0x2c4f('0x4e')](_0x2c4f('0x97'),'unreadMessages');if(_0x36963d[_0x2c4f('0x4a')]){_0x36963d['order'][_0x2c4f('0x35')](function(_0x114cc3){var _0x51e17e=_0x114cc3[0x0]===_0x2c4f('0x98')?_0x114cc3[0x0]:'i.'+_0x114cc3[0x0];_0x2bf7b3[_0x2c4f('0x4a')](_0x51e17e,_0x114cc3[0x1]===_0x2c4f('0x99')?![]:!![]);});}if(!_[_0x2c4f('0x7d')](_0x4388c5)){_0x2bf7b3[_0x2c4f('0x68')](_0x3b76dd);_0x323cb7[_0x2c4f('0x4c')](_0x2c4f('0x9a'),_0x4388c5);}BPromise['resolve']()[_0x2c4f('0x2c')](function(){if(!_0x5916b8){if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x9b')]||_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x9c')])return;_0x323cb7[_0x2c4f('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x9d'));return;}if(_0x14f401[_0x2c4f('0x9e')]['role']!==_0x2c4f('0x9f'))return;return _0x14f401[_0x2c4f('0x9e')][_0x2c4f('0xa0')]({'attributes':['id'],'raw':!![]})[_0x2c4f('0x2c')](function(_0x344b92){if(_[_0x2c4f('0x7d')](_0x344b92)){_0x323cb7['where']('i.MailAccountId\x20IS\x20NULL');_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0xa1'));}else{_0x323cb7[_0x2c4f('0x4c')]('i.MailAccountId\x20IN\x20?',_['map'](_0x344b92,'id'));_0x2bf7b3[_0x2c4f('0x4c')](_0x2c4f('0x7e'),_[_0x2c4f('0x32')](_0x344b92,'id'));}});})[_0x2c4f('0x2c')](function(){if(_0x14f401[_0x2c4f('0x9e')][_0x2c4f('0xa2')]==='agent'&&!_0x5916b8&&!_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x9b')])return[];return db['sequelize']['query'](_0x323cb7[_0x2c4f('0xa3')](),_0x41605a);})[_0x2c4f('0x2c')](function(_0xc38434){_0x26962c[_0x2c4f('0xa4')]=_0xc38434[_0x2c4f('0x6f')];if(_0x26962c[_0x2c4f('0xa4')]===0x0)return[];return db[_0x2c4f('0xa5')][_0x2c4f('0x42')](_0xc4b466[_0x2c4f('0xa3')](),_0x41605a)[_0x2c4f('0x2c')](function(_0x45ac26){_0x59cfc0=_['keyBy'](_0x45ac26,'id');_0x41605a=_[_0x2c4f('0xa6')](_0x41605a,{'model':db[_0x2c4f('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14f401[_0x2c4f('0x42')][_0x2c4f('0x47')]){_0x36963d[_0x2c4f('0x46')][_0x2c4f('0x35')](function(_0x22681c){_0x2bf7b3[_0x2c4f('0x4e')]('i.'+_0x22681c);});}else{_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0x97'),_0x2c4f('0x66'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xa7'),_0x2c4f('0xa8'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xa9'),'Account.mandatoryDisposition');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xaa'),'contactName');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0x96'));_0x2bf7b3['field'](_0x2c4f('0xab'));_0x2bf7b3[_0x2c4f('0x4e')]('i.updatedAt');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xac'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xad'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xae'));_0x2bf7b3['field'](_0x2c4f('0xaf'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb0'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb1'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb2'));_0x2bf7b3['field'](_0x2c4f('0xb3'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb4'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb5'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb6'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb7'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb8'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xb9'));_0x2bf7b3['field'](_0x2c4f('0xba'),_0x2c4f('0xbb'));_0x2bf7b3['field'](_0x2c4f('0xbc'),_0x2c4f('0xbd'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xbe'),'Contact.email');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xbf'),_0x2c4f('0xc0'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc1'),_0x2c4f('0xc2'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc3'),_0x2c4f('0xc4'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc5'),'Owner.fullname');_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc6'),_0x2c4f('0xc7'));_0x2bf7b3[_0x2c4f('0x4e')](_0x2c4f('0xc8'),_0x2c4f('0x34'));}if(_0x36963d[_0x2c4f('0x25')])_0x2bf7b3['limit'](_0x36963d[_0x2c4f('0x25')]);if(_0x36963d[_0x2c4f('0x49')])_0x2bf7b3[_0x2c4f('0x49')](_0x36963d['offset']);return db[_0x2c4f('0xa5')][_0x2c4f('0x42')](_0x2bf7b3['toString'](),_0x41605a);})[_0x2c4f('0x2c')](function(_0x405226){_0x8d070e[_0x2c4f('0x4c')](_0x2c4f('0xc9'),_[_0x2c4f('0x32')](_0x405226,'id'));return db['sequelize']['query'](_0x8d070e[_0x2c4f('0xa3')](),_0x41605a)['then'](function(_0xd1fb92){var _0x2ee5c6=_['groupBy'](_0xd1fb92,_0x2c4f('0xca'));var _0x30d082=[];return db[_0x2c4f('0xcb')]['findOne']({'attributes':[_0x2c4f('0xcc')],'raw':!![]})['then'](function(_0x21e82c){var _0x1e9725=_0x21e82c['enableEmailPreview'];_0x405226[_0x2c4f('0x35')](function(_0x54269a){_0x30d082['push'](updateMailInteraction(_0x54269a,_0x59cfc0,_0x2ee5c6,_0x1e9725));});return BPromise[_0x2c4f('0xcd')](_0x30d082);});});});})['then'](function(_0x489a8d){_0x26962c[_0x2c4f('0xce')]=_0x489a8d;return _0x26962c;})[_0x2c4f('0x2c')](respondWithFilteredResult(_0x287b09,_0x36963d))[_0x2c4f('0x3d')](handleError(_0x287b09,null));};exports[_0x2c4f('0xcf')]=function(_0x4906c9,_0x36cfa1){var _0x2e1bc2={'raw':![],'where':{'id':_0x4906c9[_0x2c4f('0xd0')]['id']}},_0x18fb9b={};_0x18fb9b[_0x2c4f('0x45')]=_[_0x2c4f('0x43')](db[_0x2c4f('0x38')]['rawAttributes']);_0x18fb9b[_0x2c4f('0x42')]=_[_0x2c4f('0x43')](_0x4906c9['query']);_0x18fb9b[_0x2c4f('0xd1')]=_[_0x2c4f('0x44')](_0x18fb9b[_0x2c4f('0x45')],_0x18fb9b[_0x2c4f('0x42')]);_0x2e1bc2[_0x2c4f('0x46')]=_[_0x2c4f('0x44')](_0x18fb9b[_0x2c4f('0x45')],qs[_0x2c4f('0x47')](_0x4906c9[_0x2c4f('0x42')][_0x2c4f('0x47')]));_0x2e1bc2['attributes']=_0x2e1bc2[_0x2c4f('0x46')][_0x2c4f('0x6f')]?_0x2e1bc2[_0x2c4f('0x46')]:_0x18fb9b[_0x2c4f('0x45')];if(_0x4906c9[_0x2c4f('0x42')][_0x2c4f('0xd2')]){_0x2e1bc2[_0x2c4f('0xd3')]=[{'all':!![]}];}_0x2e1bc2=_[_0x2c4f('0xa6')]({},_0x2e1bc2,_0x4906c9['options']);return db[_0x2c4f('0x38')]['find'](_0x2e1bc2)[_0x2c4f('0x2c')](handleEntityNotFound(_0x36cfa1,null))[_0x2c4f('0x2c')](respondWithResult(_0x36cfa1,null))[_0x2c4f('0x3d')](handleError(_0x36cfa1,null));};exports[_0x2c4f('0xd4')]=function(_0x361e71,_0x3f3683){return db['MailInteraction']['create'](_0x361e71[_0x2c4f('0xd5')],{})['then'](respondWithResult(_0x3f3683,0xc9))[_0x2c4f('0x3d')](handleError(_0x3f3683,null));};exports[_0x2c4f('0x2b')]=function(_0xc13243,_0x405929){if(_0xc13243[_0x2c4f('0xd5')]['id']){delete _0xc13243[_0x2c4f('0xd5')]['id'];}return db[_0x2c4f('0x38')]['find']({'where':{'id':_0xc13243['params']['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x405929,null))[_0x2c4f('0x2c')](saveUpdates(_0xc13243[_0x2c4f('0xd5')],null))['then'](respondWithResult(_0x405929,null))[_0x2c4f('0x3d')](handleError(_0x405929,null));};exports[_0x2c4f('0x2d')]=function(_0x5d0a07,_0x159c59){return db[_0x2c4f('0x38')][_0x2c4f('0x65')]({'where':{'id':_0x5d0a07[_0x2c4f('0xd0')]['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x159c59,null))['then'](removeEntity(_0x159c59,null))['catch'](handleError(_0x159c59,null));};exports[_0x2c4f('0xd6')]=function(_0xb3c109,_0x56740d){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x56740d,null))[_0x2c4f('0x3d')](handleError(_0x56740d,null));};exports[_0x2c4f('0xd7')]=function(_0x50cba3,_0x12c8c6,_0xd8ad31){return db[_0x2c4f('0xd8')][_0x2c4f('0x65')]({'where':{'id':_0x50cba3[_0x2c4f('0xd0')]['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x12c8c6,null))[_0x2c4f('0x2c')](function(_0x1372c3){if(_0x1372c3){return _0x1372c3[_0x2c4f('0xd7')](_0x50cba3[_0x2c4f('0xd5')][_0x2c4f('0xd9')],_[_0x2c4f('0xda')](_0x50cba3[_0x2c4f('0xd5')],[_0x2c4f('0xd9'),'id'])||{});}})[_0x2c4f('0x2c')](respondWithResult(_0x12c8c6,null))[_0x2c4f('0x3d')](handleError(_0x12c8c6,null));};exports[_0x2c4f('0xdb')]=function(_0x26c6a5,_0x19cae5,_0x5463fe){var _0x486804={'raw':![],'where':{}};var _0x2af0d={};var _0x6c58a5={'count':0x0,'rows':[]};return db[_0x2c4f('0x38')]['findOne']({'where':{'id':_0x26c6a5['params']['id']}})['then'](handleEntityNotFound(_0x19cae5,null))['then'](function(_0x1a8dd8){if(_0x1a8dd8){_0x2af0d['model']=_[_0x2c4f('0x43')](db[_0x2c4f('0xd8')][_0x2c4f('0x3f')]);_0x2af0d[_0x2c4f('0x42')]=_[_0x2c4f('0x43')](_0x26c6a5['query']);_0x2af0d['filters']=_['intersection'](_0x2af0d['model'],_0x2af0d[_0x2c4f('0x42')]);_0x486804['attributes']=_[_0x2c4f('0x44')](_0x2af0d[_0x2c4f('0x45')],qs['fields'](_0x26c6a5['query'][_0x2c4f('0x47')]));_0x486804[_0x2c4f('0x46')]=_0x486804[_0x2c4f('0x46')]['length']?_0x486804['attributes']:_0x2af0d[_0x2c4f('0x45')];if(!_0x26c6a5['query']['hasOwnProperty'](_0x2c4f('0x48'))){_0x486804['limit']=qs[_0x2c4f('0x25')](_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x25')]);_0x486804['offset']=qs[_0x2c4f('0x49')](_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x49')]);}_0x486804['order']=qs['sort'](_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x4b')]);_0x486804['where']=qs['filters'](_['pick'](_0x26c6a5[_0x2c4f('0x42')],_0x2af0d[_0x2c4f('0xd1')]));_0x486804[_0x2c4f('0x4c')][_0x2c4f('0xca')]=_0x1a8dd8['id'];if(_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x8a')]){_0x486804[_0x2c4f('0x4c')]=_[_0x2c4f('0xa6')](_0x486804[_0x2c4f('0x4c')],{'$or':_['map'](_0x486804[_0x2c4f('0x46')],function(_0x1e0eff){var _0x86ccf0={};_0x86ccf0[_0x1e0eff]={'$like':'%'+_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x8a')]+'%'};return _0x86ccf0;})});}if(_0x26c6a5['query'][_0x2c4f('0x80')]){var _0x346ef3=_0x26c6a5[_0x2c4f('0x42')][_0x2c4f('0x80')]['split'](',');var _0xe702fd={};_0xe702fd[_0x346ef3[0x0]]={'$gte':moment(_0x346ef3[0x1])[_0x2c4f('0xdc')](_0x2c4f('0xdd'))};_0x486804[_0x2c4f('0x4c')]=_[_0x2c4f('0xa6')](_0x486804['where'],_0xe702fd);}_0x486804=_['merge']({},_0x486804,_0x26c6a5['options']);return db[_0x2c4f('0xd8')][_0x2c4f('0xa4')]({'where':_0x486804[_0x2c4f('0x4c')]})['then'](function(_0x47bf30){_0x6c58a5[_0x2c4f('0xa4')]=_0x47bf30;if(_0x26c6a5['query'][_0x2c4f('0xd2')]){_0x486804[_0x2c4f('0xd3')]=[{'all':!![]}];}return db[_0x2c4f('0xd8')][_0x2c4f('0xde')](_0x486804);})[_0x2c4f('0x2c')](function(_0x5dec13){_0x6c58a5[_0x2c4f('0xce')]=_0x5dec13;return _0x6c58a5;});}})[_0x2c4f('0x2c')](respondWithFilteredResult(_0x19cae5,_0x486804))[_0x2c4f('0x3d')](handleError(_0x19cae5,null));};exports[_0x2c4f('0xdf')]=function(_0xa64b7f,_0x4540c7,_0x25f641){return db[_0x2c4f('0x38')][_0x2c4f('0x65')]({'where':{'id':_0xa64b7f['params']['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x4540c7,null))['then'](function(_0x26b1bd){if(_0x26b1bd){return _0x26b1bd[_0x2c4f('0xe0')](_0xa64b7f[_0x2c4f('0xd5')][_0x2c4f('0xd9')],_['omit'](_0xa64b7f[_0x2c4f('0xd5')],[_0x2c4f('0xd9'),'id'])||{})[_0x2c4f('0xe1')](function(){return db[_0x2c4f('0xe2')]['findAll']({'attributes':['id',_0x2c4f('0x2f'),_0x2c4f('0x4f')],'where':{'id':_0xa64b7f[_0x2c4f('0xd5')][_0x2c4f('0xd9')]}});})[_0x2c4f('0x2c')](function(_0x1fed75){socket[_0x2c4f('0xe3')](_0x2c4f('0xe4'),{'id':Number(_0xa64b7f['params']['id']),'tags':_0x1fed75||[]});return{'id':Number(_0xa64b7f[_0x2c4f('0xd0')]['id']),'tags':_0x1fed75||[]};});}})[_0x2c4f('0x2c')](respondWithResult(_0x4540c7,null))[_0x2c4f('0x3d')](handleError(_0x4540c7,null));};exports['removeTags']=function(_0x58c743,_0x1b6264,_0x3adf87){return db['MailInteraction'][_0x2c4f('0x65')]({'where':{'id':_0x58c743['params']['id']}})[_0x2c4f('0x2c')](handleEntityNotFound(_0x1b6264,null))[_0x2c4f('0x2c')](function(_0x28caf6){if(_0x28caf6){return _0x28caf6[_0x2c4f('0xe5')](_0x58c743[_0x2c4f('0x42')][_0x2c4f('0xd9')]);}})[_0x2c4f('0x2c')](respondWithStatusCode(_0x1b6264,null))[_0x2c4f('0x3d')](handleError(_0x1b6264,null));};exports[_0x2c4f('0xe6')]=function(_0x39b0dc,_0x1252e4){var _0x34840a=moment()[_0x2c4f('0xe7')]()[_0x2c4f('0xa3')]();var _0x1de6b4=path[_0x2c4f('0xe8')](config[_0x2c4f('0xe9')],'server',_0x2c4f('0xea'),'tmp');var _0x479b7e=path['join'](config[_0x2c4f('0xe9')],'server',_0x2c4f('0xea'),'attachments');var _0x44cb1f=path[_0x2c4f('0xe8')](_0x1de6b4,_0x34840a);var _0x5c07c3=util[_0x2c4f('0xdc')](_0x2c4f('0xeb'),_0x39b0dc['params']['id'],_0x34840a);var _0x236fe8=path[_0x2c4f('0xe8')](_0x1de6b4,_0x5c07c3);var _0x36e49c=[];if(_0x39b0dc[_0x2c4f('0x42')]['attachments']){_0x36e49c['push']({'model':db[_0x2c4f('0xec')],'as':_0x2c4f('0xed'),'raw':!![]});}var _0x14aa1f=[{'model':db[_0x2c4f('0xd8')],'as':_0x2c4f('0xee'),'attributes':['id',_0x2c4f('0xd5'),'from','to','cc','bcc',_0x2c4f('0xef'),_0x2c4f('0x7f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x36e49c}];return db[_0x2c4f('0x38')]['find']({'where':{'id':_0x39b0dc['params']['id']},'include':_0x14aa1f})[_0x2c4f('0x2c')](handleEntityNotFound(_0x1252e4,null))['then'](function(_0x544b39){if(_0x544b39&&_0x544b39['Messages']){var _0x486b2e=_0x544b39[_0x2c4f('0xf0')]({'plain':!![]});fs['mkdirSync'](_0x44cb1f);return BPromise[_0x2c4f('0xf1')](_0x486b2e[_0x2c4f('0xee')],function(_0x13f780,_0x5a41e3){var _0x33b710={'from':_0x13f780[_0x2c4f('0x54')],'to':_0x13f780['to'],'subject':_0x13f780[_0x2c4f('0xef')],'html':_0x13f780['body'],'headers':{'Date':moment(_0x13f780['createdAt'])[_0x2c4f('0xdc')](_0x2c4f('0xf2'))},'attachments':[]};if(_0x13f780['cc']){_0x33b710[_0x2c4f('0xf3')]['Cc']=_0x13f780['cc'];}if(_0x13f780[_0x2c4f('0xf4')]){_0x33b710[_0x2c4f('0xf3')][_0x2c4f('0xf5')]=_0x13f780[_0x2c4f('0xf4')];}return new BPromise(function(_0x252c37,_0x3f6477){if(_0x13f780[_0x2c4f('0xed')]){for(var _0x6a6046=0x0;_0x6a6046<_0x13f780[_0x2c4f('0xed')]['length'];_0x6a6046++){var _0x596c6d=_0x13f780[_0x2c4f('0xed')][_0x6a6046];var _0x5c6cae=path[_0x2c4f('0xe8')](_0x479b7e,_0x596c6d[_0x2c4f('0xf6')]);if(fs[_0x2c4f('0xf7')](_0x5c6cae)){_0x33b710['attachments'][_0x2c4f('0x37')]({'name':_0x596c6d[_0x2c4f('0x2f')],'contentType':_0x596c6d['type'],'data':fs[_0x2c4f('0xf8')](_0x5c6cae)});}}}emlformat[_0x2c4f('0xf9')](_0x33b710,function(_0x5350cf,_0x1fa8af){if(_0x5350cf)return _0x3f6477(_0x5350cf);fs[_0x2c4f('0xfa')](path[_0x2c4f('0xe8')](_0x44cb1f,util[_0x2c4f('0xdc')]('message%d.eml',_0x5a41e3)),_0x1fa8af);return _0x252c37(_0x1fa8af);});});})[_0x2c4f('0x2c')](function(){return new BPromise(function(_0x496475,_0x3230fd){zipdir(_0x44cb1f,{'saveTo':_0x236fe8},function(_0x5b983e,_0x41b352){if(_0x5b983e)return _0x3230fd(_0x5b983e);return _0x496475(_0x41b352);});})[_0x2c4f('0x2c')](function(){return new BPromise(function(_0x1fe463,_0x180463){rimraf(_0x44cb1f,function(_0x2d3184){if(_0x2d3184)_0x180463(_0x2d3184);return _0x1fe463();});});})[_0x2c4f('0x2c')](function(){return _0x1252e4[_0x2c4f('0xe6')](_0x236fe8,_0x5c07c3,function(_0x344a4a){if(_0x344a4a){console[_0x2c4f('0xfb')](_0x2c4f('0xfc'),_0x344a4a);}else{fs[_0x2c4f('0xfd')](_0x236fe8);}});});});}else{return _0x1252e4[_0x2c4f('0x22')](0xc8);}})[_0x2c4f('0x3d')](handleError(_0x1252e4,null));}; \ No newline at end of file +var _0x9454=['cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','UserId','plainBody','some','compact','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','MailInteraction','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.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','includeAll','include','options','body','params','describe','MailMessage','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','root','server','files','tmp','join','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','attachments','readFileSync','build','message%d.eml','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./mailInteraction.socket','register','end','status','json','count','offset','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','findOne','lastMsgBody','lastMsgText','trimStart','catch','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','left_join'];(function(_0x578c60,_0x1cd4f6){var _0x1524a6=function(_0x348ae3){while(--_0x348ae3){_0x578c60['push'](_0x578c60['shift']());}};_0x1524a6(++_0x1cd4f6);}(_0x9454,0x8d));var _0x4945=function(_0x19be82,_0x376f70){_0x19be82=_0x19be82-0x0;var _0x115d09=_0x9454[_0x19be82];return _0x115d09;};'use strict';var pdf=require(_0x4945('0x0'));var emlformat=require(_0x4945('0x1'));var rimraf=require(_0x4945('0x2'));var zipdir=require(_0x4945('0x3'));var jsonpatch=require(_0x4945('0x4'));var rp=require(_0x4945('0x5'));var moment=require(_0x4945('0x6'));var BPromise=require(_0x4945('0x7'));var Mustache=require(_0x4945('0x8'));var util=require('util');var path=require(_0x4945('0x9'));var sox=require(_0x4945('0xa'));var csv=require(_0x4945('0xb'));var ejs=require(_0x4945('0xc'));var fs=require('fs');var _=require(_0x4945('0xd'));var squel=require(_0x4945('0xe'));var crypto=require('crypto');var jsforce=require(_0x4945('0xf'));var deskjs=require(_0x4945('0x10'));var toCsv=require(_0x4945('0xb'));var querystring=require('querystring');var Papa=require(_0x4945('0x11'));var htmlToText=require(_0x4945('0x12'));var Redis=require(_0x4945('0x13'));var authService=require(_0x4945('0x14'));var qs=require(_0x4945('0x15'));var as=require(_0x4945('0x16'));var hardwareService=require(_0x4945('0x17'));var logger=require(_0x4945('0x18'))(_0x4945('0x19'));var utils=require('../../config/utils');var config=require(_0x4945('0x1a'));var licenseUtil=require(_0x4945('0x1b'));var db=require(_0x4945('0x1c'))['db'];config['redis']=_[_0x4945('0x1d')](config['redis'],{'host':_0x4945('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4945('0x1f')]));require(_0x4945('0x20'))[_0x4945('0x21')](socket);function respondWithStatusCode(_0x39ce27,_0x43ea59){_0x43ea59=_0x43ea59||0xcc;return function(_0x606b32){if(_0x606b32){return _0x39ce27['sendStatus'](_0x43ea59);}return _0x39ce27['status'](_0x43ea59)[_0x4945('0x22')]();};}function respondWithResult(_0x14a7f2,_0xa164cd){_0xa164cd=_0xa164cd||0xc8;return function(_0x336ef8){if(_0x336ef8){return _0x14a7f2[_0x4945('0x23')](_0xa164cd)[_0x4945('0x24')](_0x336ef8);}};}function respondWithFilteredResult(_0x27ef9b,_0x5579b0){return function(_0x26712a){if(_0x26712a){var _0x649a43=_0x26712a[_0x4945('0x25')],_0x9c1f27=_0x5579b0[_0x4945('0x26')],_0x223683=_0x5579b0['offset']+_0x5579b0['limit'],_0x59f05b;if(_0x223683>=_0x649a43){_0x223683=_0x649a43;_0x59f05b=0xc8;}else{_0x59f05b=0xce;}_0x27ef9b[_0x4945('0x23')](_0x59f05b);return _0x27ef9b[_0x4945('0x27')]('Content-Range',_0x9c1f27+'-'+_0x223683+'/'+_0x649a43)[_0x4945('0x24')](_0x26712a);}return null;};}function patchUpdates(_0x2284ae){return function(_0x3d3e2e){try{jsonpatch[_0x4945('0x28')](_0x3d3e2e,_0x2284ae,!![]);}catch(_0x333c2e){return BPromise['reject'](_0x333c2e);}return _0x3d3e2e[_0x4945('0x29')]();};}function saveUpdates(_0x1365d3,_0x12c602){return function(_0x491a30){if(_0x491a30){return _0x491a30[_0x4945('0x2a')](_0x1365d3)['then'](function(_0x9fdede){return _0x9fdede;});}return null;};}function removeEntity(_0x3e9f15,_0x227447){return function(_0x4f2b85){if(_0x4f2b85){return _0x4f2b85[_0x4945('0x2b')]()[_0x4945('0x2c')](function(){_0x3e9f15[_0x4945('0x23')](0xcc)[_0x4945('0x22')]();});}};}function handleEntityNotFound(_0x3e7146,_0xff0380){return function(_0x4369bd){if(!_0x4369bd){_0x3e7146[_0x4945('0x2d')](0x194);}return _0x4369bd;};}function handleError(_0x3c16a8,_0x22b7c9){_0x22b7c9=_0x22b7c9||0x1f4;return function(_0x5f0c3f){logger[_0x4945('0x2e')](_0x5f0c3f[_0x4945('0x2f')]);if(_0x5f0c3f['name']){delete _0x5f0c3f[_0x4945('0x30')];}_0x3c16a8[_0x4945('0x23')](_0x22b7c9)[_0x4945('0x31')](_0x5f0c3f);};}function getInteractionUsers(_0x1721df,_0x5763b5){return new BPromise(function(_0x3b41a4,_0x343f20){try{if(_0x5763b5[_0x1721df['id']]){_0x1721df[_0x4945('0x32')]=_[_0x4945('0x33')](_0x5763b5[_0x1721df['id']],function(_0x5bed5b){return{'id':_0x5bed5b['id'],'fullname':_0x5bed5b[_0x4945('0x34')]};});}}catch(_0x45994c){_0x343f20(_0x45994c);}_0x3b41a4(_0x1721df);});}function getInteractionTags(_0x26b95a,_0x5909bf){return new BPromise(function(_0x1ea943,_0x1fca2d){try{if(_0x26b95a[_0x4945('0x35')]){_0x26b95a[_0x4945('0x36')]=[];_0x26b95a['TagIds'][_0x4945('0x37')](',')[_0x4945('0x38')](function(_0x42fbf6){_0x26b95a['Tags'][_0x4945('0x39')](_0x5909bf[_0x42fbf6]);});}delete _0x26b95a[_0x4945('0x35')];}catch(_0x7d9f5c){_0x1fca2d(_0x7d9f5c);}_0x1ea943(_0x26b95a);});}function getLastMessageText(_0x37596b){return new BPromise(function(_0x136460,_0x3c85f6){return db['MailInteraction'][_0x4945('0x3a')]({'where':{'id':_0x37596b['id']},'attributes':[_0x4945('0x3b'),_0x4945('0x3c')],'raw':!![]})[_0x4945('0x2c')](function(_0x490b48){if(!_0x490b48[_0x4945('0x3c')]){_0x37596b[_0x4945('0x3c')]=_[_0x4945('0x3d')](htmlToText['fromString'](_0x490b48[_0x4945('0x3b')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x37596b[_0x4945('0x3c')]=_0x490b48[_0x4945('0x3c')];}_0x136460(_0x37596b);})[_0x4945('0x3e')](function(_0x3b80d0){_0x3c85f6(_0x3b80d0);});});}function updateMailInteraction(_0xc067,_0x3d9e6e,_0x436b14,_0xfcb4a5){return new BPromise(function(_0x5d88c9,_0x1c458c){return getInteractionUsers(_0xc067,_0x436b14)['then'](function(_0x13d9ed){return getInteractionTags(_0x13d9ed,_0x3d9e6e);})['then'](function(_0x1bf41f){if(_0xfcb4a5){_0x5d88c9(getLastMessageText(_0x1bf41f));}else{_0x5d88c9(_0x1bf41f);}})[_0x4945('0x3e')](function(_0x21a631){_0x1c458c(_0x21a631);});});}exports['index']=function(_0x1f9de9,_0x37a251){var _0x103f21={},_0x1bc7ed={},_0x4b0571={'count':0x0,'rows':[]};var _0x97f7ae=_[_0x4945('0x33')](db['MailInteraction'][_0x4945('0x3f')],function(_0x1eb6e9){return{'name':_0x1eb6e9[_0x4945('0x40')],'type':_0x1eb6e9[_0x4945('0x41')][_0x4945('0x42')]};});_0x1bc7ed[_0x4945('0x43')]=_[_0x4945('0x33')](_0x97f7ae,'name');_0x1bc7ed['query']=_[_0x4945('0x44')](_0x1f9de9[_0x4945('0x45')]);_0x1bc7ed[_0x4945('0x46')]=_[_0x4945('0x47')](_0x1bc7ed[_0x4945('0x43')],_0x1bc7ed[_0x4945('0x45')]);_0x103f21['attributes']=_['intersection'](_0x1bc7ed[_0x4945('0x43')],qs[_0x4945('0x48')](_0x1f9de9[_0x4945('0x45')][_0x4945('0x48')]));_0x103f21['attributes']=_0x103f21[_0x4945('0x49')][_0x4945('0x4a')]?_0x103f21[_0x4945('0x49')]:_0x1bc7ed['model'];if(!_0x1f9de9[_0x4945('0x45')][_0x4945('0x4b')](_0x4945('0x4c'))){_0x103f21['limit']=qs[_0x4945('0x4d')](_0x1f9de9['query']['limit']);_0x103f21[_0x4945('0x26')]=qs['offset'](_0x1f9de9['query'][_0x4945('0x26')]);}_0x103f21[_0x4945('0x4e')]=qs[_0x4945('0x4f')](_0x1f9de9[_0x4945('0x45')][_0x4945('0x4f')]);_0x103f21['where']=qs[_0x4945('0x46')](_[_0x4945('0x50')](_0x1f9de9['query'],_0x1bc7ed[_0x4945('0x46')]),_0x97f7ae);var _0xefc4fc=[];var _0x14d463=squel[_0x4945('0x51')]()['field']('id')[_0x4945('0x52')](_0x4945('0x30'))[_0x4945('0x52')](_0x4945('0x53'))[_0x4945('0x54')](_0x4945('0x55'));var _0x5c8031=squel['select']()[_0x4945('0x52')]('u.id')[_0x4945('0x52')](_0x4945('0x56'))[_0x4945('0x52')](_0x4945('0x57'))[_0x4945('0x54')](_0x4945('0x58'),'ui')['left_join'](_0x4945('0x59'),'u',_0x4945('0x5a'));var _0x4bcd7a=squel[_0x4945('0x51')]()[_0x4945('0x54')]('mail_interactions','i')[_0x4945('0x5b')](_0x4945('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4945('0x5b')]('users','o',_0x4945('0x5d'))['left_join'](_0x4945('0x5e'),'a',_0x4945('0x5f'))[_0x4945('0x5b')](_0x4945('0x60'),'me','me.MailInteractionId\x20=\x20i.id')[_0x4945('0x5b')](_0x4945('0x61'),'it',_0x4945('0x62'))[_0x4945('0x5b')](_0x4945('0x55'),'t',_0x4945('0x63'));var _0x3d8795=squel[_0x4945('0x64')]();var _0x449ab4=[];var _0x23b78e=squel[_0x4945('0x64')]();var _0x2d9a80;if(_0x1f9de9['query'][_0x4945('0x65')]){_0x2d9a80=as['parseSearch'](_0x1f9de9[_0x4945('0x45')][_0x4945('0x65')]);var _0x431a95=_0x2d9a80['sqlOperator'];for(var _0x5c8bd1=0x0;_0x5c8bd1<_0x2d9a80['conditions'][_0x4945('0x4a')];_0x5c8bd1++){var _0x334eb0=_0x2d9a80[_0x4945('0x66')][_0x5c8bd1];var _0xa6ed98='i';var _0x377001=_['find'](_0x97f7ae,[_0x4945('0x30'),_0x334eb0[_0x4945('0x52')]]);if(!_0x377001){switch(_0x334eb0[_0x4945('0x52')]){case'unreadMessages':if(_0x334eb0[_0x4945('0x67')]==0x1){_0x4bcd7a[_0x4945('0x68')]('`'+_0x334eb0['field']+_0x4945('0x69'));}else{_0x4bcd7a[_0x4945('0x68')]('`'+_0x334eb0[_0x4945('0x52')]+_0x4945('0x6a'));}break;case _0x4945('0x6b'):if(_0x334eb0[_0x4945('0x6c')]===_0x4945('0x6d')){if(_0x334eb0[_0x4945('0x67')]['split']('\x20')['length']>0x1){_0x3d8795[_0x431a95](_0x4945('0x6e'),qs['getFullTextValue'](_0x334eb0[_0x4945('0x67')]),null);}else{var _0x1eefc4='%'+_0x334eb0['value']+'%';_0x3d8795[_0x431a95](_0x4945('0x6f'),_0x1eefc4,_0x1eefc4,_0x1eefc4);}}else{_0x377001=_[_0x4945('0x70')](_0x97f7ae,['name',_0x4945('0x71')]);_0x334eb0['field']='ContactId';_0xcbf6c7=as[_0x4945('0x72')](_0xa6ed98,_0x377001[_0x4945('0x41')],_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7[_0x4945('0x73')],_0xcbf6c7['value'][_0x4945('0x74')],_0xcbf6c7[_0x4945('0x67')]['end']);}break;case _0x4945('0x75'):var _0x2ff526=_0x334eb0[_0x4945('0x67')][_0x4945('0x37')](',')['map'](function(_0x317880){return Number(_0x317880);});_0x2ff526['forEach'](function(_0x517f10){_0x23b78e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x517f10+',%');});_0x449ab4=_[_0x4945('0x76')](_0x449ab4,_0x2ff526);break;case'User':if(_0x334eb0[_0x4945('0x6c')]==='$substring'){_0x3d8795[_0x431a95]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x334eb0[_0x4945('0x67')]+'%',null);}else{_0x377001=_[_0x4945('0x70')](_0x97f7ae,[_0x4945('0x30'),_0x4945('0x77')]);_0x334eb0[_0x4945('0x52')]=_0x4945('0x77');_0xcbf6c7=as[_0x4945('0x72')](_0xa6ed98,_0x377001[_0x4945('0x41')],_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7['text'],_0xcbf6c7[_0x4945('0x67')][_0x4945('0x74')],_0xcbf6c7[_0x4945('0x67')][_0x4945('0x22')]);}break;case _0x4945('0x78'):_0xcbf6c7=as[_0x4945('0x72')]('me',null,_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7[_0x4945('0x73')],_0xcbf6c7[_0x4945('0x67')][_0x4945('0x74')],_0xcbf6c7[_0x4945('0x67')]['end']);break;}}else{var _0xcbf6c7=as[_0x4945('0x72')](_0xa6ed98,_0x377001[_0x4945('0x41')],_0x334eb0);_0x3d8795[_0x431a95](_0xcbf6c7[_0x4945('0x73')],_0xcbf6c7['value']['start'],_0xcbf6c7['value']['end']);}}}else{var _0x3827dd=_(_0x1f9de9['query'])['keys']()[_0x4945('0x33')](function(_0x1da91b){return _[_0x4945('0x79')](_0x97f7ae,[_0x4945('0x30'),_0x1da91b])?_0x1da91b:undefined;})[_0x4945('0x7a')]()['value']();if(!_['isEmpty'](_0x3827dd)){_0x3827dd[_0x4945('0x38')](function(_0x2cae80){if(_0x2cae80===_0x4945('0x7b')){_0x4bcd7a[_0x4945('0x7c')](_0x4945('0x7d'),[][_0x4945('0x7e')](_0x1f9de9[_0x4945('0x45')][_0x2cae80]));}else if(_0x2cae80===_0x4945('0x7f')){var _0x2f7480=JSON[_0x4945('0x80')](_0x1f9de9[_0x4945('0x45')][_0x2cae80])[_0x4945('0x81')];var _0x4103d1=JSON[_0x4945('0x80')](_0x1f9de9[_0x4945('0x45')][_0x2cae80])[_0x4945('0x82')];_0x4bcd7a[_0x4945('0x7c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f7480,_0x4103d1);}else{if(_0x1f9de9[_0x4945('0x45')][_0x2cae80]==='null'){_0x4bcd7a[_0x4945('0x7c')]('i.'+_0x2cae80+_0x4945('0x83'));}else{_0x4bcd7a[_0x4945('0x7c')]('i.'+_0x2cae80+'\x20=\x20?',_0x1f9de9[_0x4945('0x45')][_0x2cae80]);}}});}if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x84')]){if(_0x1f9de9['query'][_0x4945('0x84')]==0x1){_0x4bcd7a['having']('`unreadMessages`\x20=\x200');}else{_0x4bcd7a[_0x4945('0x68')](_0x4945('0x85'));}}if(_0x1f9de9['query'][_0x4945('0x86')]){_0x449ab4=_['isArray'](_0x1f9de9[_0x4945('0x45')][_0x4945('0x86')])?_0x1f9de9[_0x4945('0x45')][_0x4945('0x86')]:new Array(_0x1f9de9[_0x4945('0x45')][_0x4945('0x86')]);_0x449ab4[_0x4945('0x38')](function(_0xc97e21){_0x23b78e['or'](_0x4945('0x87'),'%,'+_0xc97e21+',%');});}if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x88')]){var _0x2767bb=_0x1f9de9['query'][_0x4945('0x88')]['replace']('\x5c','\x5c\x5c')[_0x4945('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2767bb)){_0x3d8795['or'](_0x4945('0x8a'),_0x2767bb+'%');}else if(qs['isEmail'](_0x2767bb)){_0x3d8795['or'](_0x4945('0x8b'),_0x2767bb+'%');}else{_0x3d8795['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4945('0x8c')](_0x2767bb))['or'](_0x4945('0x8d'),qs['getFullTextValue'](_0x2767bb));}}}_0x4bcd7a[_0x4945('0x7c')](_0x3d8795);_0x4bcd7a[_0x4945('0x8e')](_0x4945('0x8f'));var _0x214cd4={'type':db[_0x4945('0x90')]['QueryTypes'][_0x4945('0x91')],'raw':!![]};var _0x27802c=_0x4bcd7a['clone']();_0x27802c[_0x4945('0x52')]('i.id');_0x27802c[_0x4945('0x52')](_0x4945('0x92'),_0x4945('0x93'));if(_0x103f21[_0x4945('0x4e')]){_0x103f21[_0x4945('0x4e')][_0x4945('0x38')](function(_0x48af62){var _0x57f298=_0x48af62[0x0]===_0x4945('0x94')?_0x48af62[0x0]:'i.'+_0x48af62[0x0];_0x4bcd7a['order'](_0x57f298,_0x48af62[0x1]===_0x4945('0x95')?![]:!![]);});}if(!_[_0x4945('0x96')](_0x449ab4)){_0x4bcd7a[_0x4945('0x68')](_0x23b78e);_0x27802c[_0x4945('0x7c')](_0x4945('0x97'),_0x449ab4);}BPromise['resolve']()[_0x4945('0x2c')](function(){if(!_0x2d9a80){if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x7b')]||_0x1f9de9['query'][_0x4945('0x98')])return;_0x27802c[_0x4945('0x7c')](_0x4945('0x99'));_0x4bcd7a[_0x4945('0x7c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1f9de9[_0x4945('0x9a')][_0x4945('0x9b')]!==_0x4945('0x9c'))return;return _0x1f9de9[_0x4945('0x9a')][_0x4945('0x9d')]({'attributes':['id'],'raw':!![]})[_0x4945('0x2c')](function(_0x17fd00){if(_[_0x4945('0x96')](_0x17fd00)){_0x27802c['where'](_0x4945('0x9e'));_0x4bcd7a['where'](_0x4945('0x9e'));}else{_0x27802c[_0x4945('0x7c')](_0x4945('0x7d'),_['map'](_0x17fd00,'id'));_0x4bcd7a[_0x4945('0x7c')]('i.MailAccountId\x20IN\x20?',_[_0x4945('0x33')](_0x17fd00,'id'));}});})['then'](function(){if(_0x1f9de9[_0x4945('0x9a')]['role']===_0x4945('0x9c')&&!_0x2d9a80&&!_0x1f9de9[_0x4945('0x45')][_0x4945('0x7b')])return[];return db[_0x4945('0x9f')][_0x4945('0x45')](_0x27802c['toString'](),_0x214cd4);})[_0x4945('0x2c')](function(_0x51afc1){_0x4b0571['count']=_0x51afc1[_0x4945('0x4a')];if(_0x4b0571[_0x4945('0x25')]===0x0)return[];return db[_0x4945('0x9f')][_0x4945('0x45')](_0x14d463[_0x4945('0xa0')](),_0x214cd4)[_0x4945('0x2c')](function(_0x1c6940){_0xefc4fc=_[_0x4945('0xa1')](_0x1c6940,'id');_0x214cd4=_[_0x4945('0xa2')](_0x214cd4,{'model':db[_0x4945('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f9de9[_0x4945('0x45')][_0x4945('0x48')]){_0x103f21['attributes'][_0x4945('0x38')](function(_0xd9109c){_0x4bcd7a[_0x4945('0x52')]('i.'+_0xd9109c);});}else{_0x4bcd7a[_0x4945('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4945('0x93'));_0x4bcd7a[_0x4945('0x52')]('a.key','Account.key');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa4'),_0x4945('0xa5'));_0x4bcd7a['field'](_0x4945('0xa6'),'contactName');_0x4bcd7a[_0x4945('0x52')]('i.id');_0x4bcd7a[_0x4945('0x52')]('i.createdAt');_0x4bcd7a['field']('i.updatedAt');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa7'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa8'));_0x4bcd7a['field']('i.attach');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xa9'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xaa'));_0x4bcd7a['field']('i.subject');_0x4bcd7a['field'](_0x4945('0xab'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xac'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xad'));_0x4bcd7a[_0x4945('0x52')]('i.substatus');_0x4bcd7a['field']('i.to');_0x4bcd7a['field'](_0x4945('0xae'));_0x4bcd7a[_0x4945('0x52')]('i.MailAccountId');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xaf'));_0x4bcd7a['field']('c.firstName',_0x4945('0xb0'));_0x4bcd7a['field'](_0x4945('0xb1'),_0x4945('0xb2'));_0x4bcd7a['field']('c.email',_0x4945('0xb3'));_0x4bcd7a['field']('c.phone',_0x4945('0xb4'));_0x4bcd7a['field'](_0x4945('0xb5'),'Contact.mobile');_0x4bcd7a[_0x4945('0x52')]('c.fax',_0x4945('0xb6'));_0x4bcd7a[_0x4945('0x52')]('o.fullname',_0x4945('0xb7'));_0x4bcd7a[_0x4945('0x52')](_0x4945('0xb8'),'Owner.internal');_0x4bcd7a[_0x4945('0x52')](_0x4945('0xb9'),'TagIds');}if(_0x103f21[_0x4945('0x4d')])_0x4bcd7a[_0x4945('0x4d')](_0x103f21[_0x4945('0x4d')]);if(_0x103f21['offset'])_0x4bcd7a[_0x4945('0x26')](_0x103f21[_0x4945('0x26')]);return db[_0x4945('0x9f')][_0x4945('0x45')](_0x4bcd7a[_0x4945('0xa0')](),_0x214cd4);})[_0x4945('0x2c')](function(_0x406faa){_0x5c8031[_0x4945('0x7c')](_0x4945('0xba'),_['map'](_0x406faa,'id'));return db[_0x4945('0x9f')][_0x4945('0x45')](_0x5c8031['toString'](),_0x214cd4)[_0x4945('0x2c')](function(_0x9b637a){var _0x3f74e2=_['groupBy'](_0x9b637a,_0x4945('0xbb'));var _0x1d50d2=[];return db[_0x4945('0xbc')][_0x4945('0x3a')]({'attributes':[_0x4945('0xbd')],'raw':!![]})[_0x4945('0x2c')](function(_0xa48c72){var _0x8d8cb1=_0xa48c72[_0x4945('0xbd')];_0x406faa[_0x4945('0x38')](function(_0x1ef7a1){_0x1d50d2[_0x4945('0x39')](updateMailInteraction(_0x1ef7a1,_0xefc4fc,_0x3f74e2,_0x8d8cb1));});return BPromise[_0x4945('0xbe')](_0x1d50d2);});});});})[_0x4945('0x2c')](function(_0x44ac4e){_0x4b0571[_0x4945('0xbf')]=_0x44ac4e;return _0x4b0571;})[_0x4945('0x2c')](respondWithFilteredResult(_0x37a251,_0x103f21))[_0x4945('0x3e')](handleError(_0x37a251,null));};exports['show']=function(_0x7deae9,_0x2b9efd){var _0x41b1a2={'raw':![],'where':{'id':_0x7deae9['params']['id']}},_0x466397={};_0x466397[_0x4945('0x43')]=_[_0x4945('0x44')](db[_0x4945('0xa3')][_0x4945('0x3f')]);_0x466397[_0x4945('0x45')]=_[_0x4945('0x44')](_0x7deae9['query']);_0x466397['filters']=_['intersection'](_0x466397['model'],_0x466397[_0x4945('0x45')]);_0x41b1a2[_0x4945('0x49')]=_[_0x4945('0x47')](_0x466397[_0x4945('0x43')],qs[_0x4945('0x48')](_0x7deae9[_0x4945('0x45')][_0x4945('0x48')]));_0x41b1a2[_0x4945('0x49')]=_0x41b1a2['attributes']['length']?_0x41b1a2[_0x4945('0x49')]:_0x466397[_0x4945('0x43')];if(_0x7deae9['query'][_0x4945('0xc0')]){_0x41b1a2[_0x4945('0xc1')]=[{'all':!![]}];}_0x41b1a2=_[_0x4945('0xa2')]({},_0x41b1a2,_0x7deae9[_0x4945('0xc2')]);return db[_0x4945('0xa3')]['find'](_0x41b1a2)[_0x4945('0x2c')](handleEntityNotFound(_0x2b9efd,null))[_0x4945('0x2c')](respondWithResult(_0x2b9efd,null))[_0x4945('0x3e')](handleError(_0x2b9efd,null));};exports['create']=function(_0xb77ff4,_0x529988){return db[_0x4945('0xa3')]['create'](_0xb77ff4['body'],{})['then'](respondWithResult(_0x529988,0xc9))[_0x4945('0x3e')](handleError(_0x529988,null));};exports['update']=function(_0x340bd0,_0x2cbf09){if(_0x340bd0[_0x4945('0xc3')]['id']){delete _0x340bd0[_0x4945('0xc3')]['id'];}return db[_0x4945('0xa3')]['find']({'where':{'id':_0x340bd0[_0x4945('0xc4')]['id']}})[_0x4945('0x2c')](handleEntityNotFound(_0x2cbf09,null))['then'](saveUpdates(_0x340bd0[_0x4945('0xc3')],null))[_0x4945('0x2c')](respondWithResult(_0x2cbf09,null))[_0x4945('0x3e')](handleError(_0x2cbf09,null));};exports[_0x4945('0x2b')]=function(_0x1641ef,_0x3f30bc){return db['MailInteraction']['find']({'where':{'id':_0x1641ef['params']['id']}})['then'](handleEntityNotFound(_0x3f30bc,null))[_0x4945('0x2c')](removeEntity(_0x3f30bc,null))['catch'](handleError(_0x3f30bc,null));};exports[_0x4945('0xc5')]=function(_0x8a59ff,_0x2cd271){return db[_0x4945('0xa3')][_0x4945('0xc5')]()[_0x4945('0x2c')](respondWithResult(_0x2cd271,null))[_0x4945('0x3e')](handleError(_0x2cd271,null));};exports['addMessage']=function(_0x5d76ea,_0x4896aa,_0x55c25a){return db[_0x4945('0xc6')][_0x4945('0x70')]({'where':{'id':_0x5d76ea[_0x4945('0xc4')]['id']}})['then'](handleEntityNotFound(_0x4896aa,null))[_0x4945('0x2c')](function(_0x1ce59f){if(_0x1ce59f){return _0x1ce59f[_0x4945('0xc7')](_0x5d76ea[_0x4945('0xc3')]['ids'],_['omit'](_0x5d76ea[_0x4945('0xc3')],[_0x4945('0xc8'),'id'])||{});}})[_0x4945('0x2c')](respondWithResult(_0x4896aa,null))[_0x4945('0x3e')](handleError(_0x4896aa,null));};exports[_0x4945('0xc9')]=function(_0x3e0b6d,_0xd18389,_0x492f5b){var _0x16210b={'raw':![],'where':{}};var _0x252309={};var _0x2a632c={'count':0x0,'rows':[]};return db[_0x4945('0xa3')][_0x4945('0x3a')]({'where':{'id':_0x3e0b6d[_0x4945('0xc4')]['id']}})['then'](handleEntityNotFound(_0xd18389,null))['then'](function(_0x420af4){if(_0x420af4){_0x252309[_0x4945('0x43')]=_['keys'](db[_0x4945('0xc6')][_0x4945('0x3f')]);_0x252309[_0x4945('0x45')]=_[_0x4945('0x44')](_0x3e0b6d['query']);_0x252309[_0x4945('0x46')]=_[_0x4945('0x47')](_0x252309[_0x4945('0x43')],_0x252309['query']);_0x16210b[_0x4945('0x49')]=_['intersection'](_0x252309['model'],qs[_0x4945('0x48')](_0x3e0b6d[_0x4945('0x45')][_0x4945('0x48')]));_0x16210b['attributes']=_0x16210b[_0x4945('0x49')][_0x4945('0x4a')]?_0x16210b[_0x4945('0x49')]:_0x252309['model'];if(!_0x3e0b6d[_0x4945('0x45')]['hasOwnProperty'](_0x4945('0x4c'))){_0x16210b['limit']=qs['limit'](_0x3e0b6d[_0x4945('0x45')]['limit']);_0x16210b[_0x4945('0x26')]=qs[_0x4945('0x26')](_0x3e0b6d[_0x4945('0x45')][_0x4945('0x26')]);}_0x16210b['order']=qs[_0x4945('0x4f')](_0x3e0b6d['query'][_0x4945('0x4f')]);_0x16210b[_0x4945('0x7c')]=qs[_0x4945('0x46')](_[_0x4945('0x50')](_0x3e0b6d[_0x4945('0x45')],_0x252309['filters']));_0x16210b[_0x4945('0x7c')]['MailInteractionId']=_0x420af4['id'];if(_0x3e0b6d[_0x4945('0x45')][_0x4945('0x88')]){_0x16210b[_0x4945('0x7c')]=_[_0x4945('0xa2')](_0x16210b['where'],{'$or':_[_0x4945('0x33')](_0x16210b['attributes'],function(_0x2108ba){var _0x32aa63={};_0x32aa63[_0x2108ba]={'$like':'%'+_0x3e0b6d[_0x4945('0x45')][_0x4945('0x88')]+'%'};return _0x32aa63;})});}if(_0x3e0b6d['query'][_0x4945('0x81')]){var _0x3b90db=_0x3e0b6d['query']['$gte'][_0x4945('0x37')](',');var _0x15451f={};_0x15451f[_0x3b90db[0x0]]={'$gte':moment(_0x3b90db[0x1])['format'](_0x4945('0xca'))};_0x16210b[_0x4945('0x7c')]=_['merge'](_0x16210b[_0x4945('0x7c')],_0x15451f);}_0x16210b=_[_0x4945('0xa2')]({},_0x16210b,_0x3e0b6d[_0x4945('0xc2')]);return db[_0x4945('0xc6')][_0x4945('0x25')]({'where':_0x16210b[_0x4945('0x7c')]})[_0x4945('0x2c')](function(_0x29b32a){_0x2a632c[_0x4945('0x25')]=_0x29b32a;if(_0x3e0b6d['query'][_0x4945('0xc0')]){_0x16210b[_0x4945('0xc1')]=[{'all':!![]}];}return db[_0x4945('0xc6')]['findAll'](_0x16210b);})[_0x4945('0x2c')](function(_0xf51250){_0x2a632c[_0x4945('0xbf')]=_0xf51250;return _0x2a632c;});}})['then'](respondWithFilteredResult(_0xd18389,_0x16210b))['catch'](handleError(_0xd18389,null));};exports[_0x4945('0xcb')]=function(_0x2d1be9,_0x4ba85c,_0x3d9e6a){return db['MailInteraction']['find']({'where':{'id':_0x2d1be9[_0x4945('0xc4')]['id']}})[_0x4945('0x2c')](handleEntityNotFound(_0x4ba85c,null))[_0x4945('0x2c')](function(_0x337eb1){if(_0x337eb1){return _0x337eb1[_0x4945('0xcc')](_0x2d1be9[_0x4945('0xc3')][_0x4945('0xc8')],_[_0x4945('0xcd')](_0x2d1be9[_0x4945('0xc3')],[_0x4945('0xc8'),'id'])||{})[_0x4945('0xce')](function(){return db[_0x4945('0x75')]['findAll']({'attributes':['id',_0x4945('0x30'),_0x4945('0x53')],'where':{'id':_0x2d1be9['body'][_0x4945('0xc8')]}});})[_0x4945('0x2c')](function(_0x17eaba){socket[_0x4945('0xcf')](_0x4945('0xd0'),{'id':Number(_0x2d1be9['params']['id']),'tags':_0x17eaba||[]});return{'id':Number(_0x2d1be9[_0x4945('0xc4')]['id']),'tags':_0x17eaba||[]};});}})['then'](respondWithResult(_0x4ba85c,null))['catch'](handleError(_0x4ba85c,null));};exports[_0x4945('0xd1')]=function(_0x2da6d5,_0x5213d8,_0x514178){return db[_0x4945('0xa3')][_0x4945('0x70')]({'where':{'id':_0x2da6d5[_0x4945('0xc4')]['id']}})[_0x4945('0x2c')](handleEntityNotFound(_0x5213d8,null))[_0x4945('0x2c')](function(_0x2d32f7){if(_0x2d32f7){return _0x2d32f7[_0x4945('0xd1')](_0x2da6d5['query'][_0x4945('0xc8')]);}})[_0x4945('0x2c')](respondWithStatusCode(_0x5213d8,null))[_0x4945('0x3e')](handleError(_0x5213d8,null));};exports[_0x4945('0xd2')]=function(_0x3516d3,_0x477224){var _0x56ccc5=moment()['unix']()[_0x4945('0xa0')]();var _0x1d9116=path['join'](config[_0x4945('0xd3')],_0x4945('0xd4'),_0x4945('0xd5'),_0x4945('0xd6'));var _0xf38402=path[_0x4945('0xd7')](config[_0x4945('0xd3')],_0x4945('0xd4'),_0x4945('0xd5'),'attachments');var _0x10af40=path[_0x4945('0xd7')](_0x1d9116,_0x56ccc5);var _0x435455=util[_0x4945('0xd8')](_0x4945('0xd9'),_0x3516d3[_0x4945('0xc4')]['id'],_0x56ccc5);var _0x1a512d=path[_0x4945('0xd7')](_0x1d9116,_0x435455);var _0x3c2c03=[];if(_0x3516d3[_0x4945('0x45')]['attachments']){_0x3c2c03[_0x4945('0x39')]({'model':db[_0x4945('0xda')],'as':_0x4945('0xdb'),'raw':!![]});}var _0x4cb272=[{'model':db[_0x4945('0xc6')],'as':_0x4945('0xdc'),'attributes':['id',_0x4945('0xc3'),_0x4945('0x54'),'to','cc',_0x4945('0xdd'),_0x4945('0xde'),_0x4945('0x7f')],'where':{'secret':![]},'order':qs[_0x4945('0x4f')]('id'),'include':_0x3c2c03}];return db[_0x4945('0xa3')]['find']({'where':{'id':_0x3516d3['params']['id']},'include':_0x4cb272})[_0x4945('0x2c')](handleEntityNotFound(_0x477224,null))[_0x4945('0x2c')](function(_0xcda305){if(_0xcda305&&_0xcda305['Messages']){var _0x39b9c5=_0xcda305[_0x4945('0xdf')]({'plain':!![]});fs[_0x4945('0xe0')](_0x10af40);return BPromise['each'](_0x39b9c5[_0x4945('0xdc')],function(_0x45cc52,_0x121308){var _0xb916cb={'from':_0x45cc52[_0x4945('0x54')],'to':_0x45cc52['to'],'subject':_0x45cc52[_0x4945('0xde')],'html':_0x45cc52[_0x4945('0xc3')],'headers':{'Date':moment(_0x45cc52[_0x4945('0x7f')])[_0x4945('0xd8')](_0x4945('0xe1'))},'attachments':[]};if(_0x45cc52['cc']){_0xb916cb['headers']['Cc']=_0x45cc52['cc'];}if(_0x45cc52['bcc']){_0xb916cb['headers'][_0x4945('0xe2')]=_0x45cc52[_0x4945('0xdd')];}return new BPromise(function(_0x3e75a1,_0x76abe1){if(_0x45cc52[_0x4945('0xdb')]){for(var _0x1b9bcd=0x0;_0x1b9bcd<_0x45cc52[_0x4945('0xdb')][_0x4945('0x4a')];_0x1b9bcd++){var _0x29820b=_0x45cc52[_0x4945('0xdb')][_0x1b9bcd];var _0x58b668=path[_0x4945('0xd7')](_0xf38402,_0x29820b['basename']);if(fs['existsSync'](_0x58b668)){_0xb916cb[_0x4945('0xe3')][_0x4945('0x39')]({'name':_0x29820b[_0x4945('0x30')],'contentType':_0x29820b[_0x4945('0x41')],'data':fs[_0x4945('0xe4')](_0x58b668)});}}}emlformat[_0x4945('0xe5')](_0xb916cb,function(_0x6b40e4,_0x4d13e0){if(_0x6b40e4)return _0x76abe1(_0x6b40e4);fs['writeFileSync'](path['join'](_0x10af40,util[_0x4945('0xd8')](_0x4945('0xe6'),_0x121308)),_0x4d13e0);return _0x3e75a1(_0x4d13e0);});});})[_0x4945('0x2c')](function(){return new BPromise(function(_0x46a86a,_0x534253){zipdir(_0x10af40,{'saveTo':_0x1a512d},function(_0x343305,_0x52a453){if(_0x343305)return _0x534253(_0x343305);return _0x46a86a(_0x52a453);});})['then'](function(){return new BPromise(function(_0x33c30e,_0x1d6301){rimraf(_0x10af40,function(_0x171361){if(_0x171361)_0x1d6301(_0x171361);return _0x33c30e();});});})[_0x4945('0x2c')](function(){return _0x477224[_0x4945('0xd2')](_0x1a512d,_0x435455,function(_0x238310){if(_0x238310){console[_0x4945('0xe7')]('err',_0x238310);}else{fs[_0x4945('0xe8')](_0x1a512d);}});});});}else{return _0x477224[_0x4945('0x2d')](0xc8);}})['catch'](handleError(_0x477224,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 512cae6..65a34c6 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 _0xf8b0=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then'];(function(_0x5dd6d8,_0xe461ae){var _0x271126=function(_0x1536f8){while(--_0x1536f8){_0x5dd6d8['push'](_0x5dd6d8['shift']());}};_0x271126(++_0xe461ae);}(_0xf8b0,0x147));var _0x0f8b=function(_0x34f884,_0x138a7a){_0x34f884=_0x34f884-0x0;var _0x2305fa=_0xf8b0[_0x34f884];return _0x2305fa;};'use strict';var EventEmitter=require(_0x0f8b('0x0'));var MailInteraction=require(_0x0f8b('0x1'))['db'][_0x0f8b('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x0f8b('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0f8b('0x4')](0x0);var events={'afterCreate':_0x0f8b('0x5'),'afterUpdate':_0x0f8b('0x6'),'afterDestroy':_0x0f8b('0x7')};function emitEvent(_0x23fd14){return function(_0x3185e4,_0x31dc01,_0x24c662){_0x3185e4['getUsers']({'attributes':['id'],'raw':!![]})[_0x0f8b('0x8')](function(_0xbfc4f4){_0x3185e4[_0x0f8b('0x9')](_0x0f8b('0xa'),_0xbfc4f4[_0x0f8b('0xb')](function(_0x396a9c){return{'id':_0x396a9c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3185e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0f8b('0x8')](function(_0x24fd06){_0x3185e4[_0x0f8b('0x9')](_0x0f8b('0xc'),_0x24fd06['length']);MailInteractionEvents[_0x0f8b('0xd')](_0x23fd14+':'+_0x3185e4['id'],_0x3185e4);MailInteractionEvents['emit'](_0x23fd14,_0x3185e4);_0x24c662(null);})[_0x0f8b('0xe')](_0x24c662(null));};}for(var e in events){if(events[_0x0f8b('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x98e3=['update','remove','then','setDataValue','Users','map','findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x4ea44b,_0x546b89){var _0x418cc9=function(_0x1eb1e5){while(--_0x1eb1e5){_0x4ea44b['push'](_0x4ea44b['shift']());}};_0x418cc9(++_0x546b89);}(_0x98e3,0xb3));var _0x398e=function(_0x32390a,_0x430c8c){_0x32390a=_0x32390a-0x0;var _0x525768=_0x98e3[_0x32390a];return _0x525768;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x398e('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x398e('0x1')](0x0);var events={'afterCreate':_0x398e('0x2'),'afterUpdate':_0x398e('0x3'),'afterDestroy':_0x398e('0x4')};function emitEvent(_0x465d98){return function(_0x39adea,_0x5b3d48,_0x460a5e){_0x39adea['getUsers']({'attributes':['id'],'raw':!![]})[_0x398e('0x5')](function(_0x494bc0){_0x39adea[_0x398e('0x6')](_0x398e('0x7'),_0x494bc0[_0x398e('0x8')](function(_0x36eb21){return{'id':_0x36eb21['id']};}));return MailMessage[_0x398e('0x9')]({'where':{'MailInteractionId':_0x39adea['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1a3cde){_0x39adea[_0x398e('0x6')]('unreadMessages',_0x1a3cde['length']);MailInteractionEvents[_0x398e('0xa')](_0x465d98+':'+_0x39adea['id'],_0x39adea);MailInteractionEvents[_0x398e('0xa')](_0x465d98,_0x39adea);_0x460a5e(null);})['catch'](_0x460a5e(null));};}for(var e in events){if(events[_0x398e('0xb')](e)){var event=events[e];MailInteraction[_0x398e('0xc')](e,emitEvent(event));}}module[_0x398e('0xd')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c55c51d..f0ec3cf 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 _0xa74d=['update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage'];(function(_0x1002af,_0x41aa4a){var _0x215467=function(_0x28d36c){while(--_0x28d36c){_0x1002af['push'](_0x1002af['shift']());}};_0x215467(++_0x41aa4a);}(_0xa74d,0x1cf));var _0xda74=function(_0x14b3fa,_0x2112ab){_0x14b3fa=_0x14b3fa-0x0;var _0x21319d=_0xa74d[_0x14b3fa];return _0x21319d;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var logger=require(_0xda74('0x1'))(_0xda74('0x2'));var moment=require(_0xda74('0x3'));var BPromise=require(_0xda74('0x4'));var rp=require(_0xda74('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda74('0x6'));var config=require(_0xda74('0x7'));var attributes=require(_0xda74('0x8'));module[_0xda74('0x9')]=function(_0x12cd04,_0x718eb6){return _0x12cd04[_0xda74('0xa')](_0xda74('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xda74('0xc'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ffb6a,_0x411790,_0x4f7fab){if(_0x1ffb6a[_0xda74('0xd')]){_0x1ffb6a[_0xda74('0xe')]=moment()[_0xda74('0xf')](_0xda74('0x10'));}if(_0x1ffb6a[_0xda74('0x11')]){_0x1ffb6a[_0xda74('0x12')]=moment()[_0xda74('0xf')](_0xda74('0x10'));}_0x4f7fab(null,_0x411790);},'beforeUpdate':function(_0x512a38,_0x27ee0f,_0x406f23){if(_0x512a38[_0xda74('0x13')]('substatus')){_0x512a38[_0xda74('0xe')]=_0x512a38[_0xda74('0xd')]?moment()[_0xda74('0xf')](_0xda74('0x10')):null;}if(_0x512a38[_0xda74('0x13')](_0xda74('0x11'))){_0x512a38[_0xda74('0x12')]=moment()['format'](_0xda74('0x10'));_0x512a38[_0xda74('0xd')]=null;_0x512a38[_0xda74('0xe')]=null;}_0x406f23(null,_0x512a38);},'afterUpdate':function(_0x150e9a,_0x3a16d6,_0x4d5946){var _0x1535d3=_0x12cd04[_0xda74('0x14')];var _0x1cef55=_0x150e9a[_0xda74('0x15')]({'plain':!![]});if(_0x1cef55[_0xda74('0x11')]){return _0x1535d3[_0xda74('0x16')][_0xda74('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x1cef55['id']}})['then'](function(){_0x4d5946();})[_0xda74('0x18')](function(_0x164d4c){_0x4d5946(_0x164d4c);});}else{_0x4d5946();}}},'charset':_0xda74('0x19'),'collate':_0xda74('0x1a')});}; \ No newline at end of file +var _0x95b9=['models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95b9,0x10c));var _0x995b=function(_0x4e1596,_0x2ddba7){_0x4e1596=_0x4e1596-0x0;var _0x1016aa=_0x95b9[_0x4e1596];return _0x1016aa;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var logger=require('../../config/logger')(_0x995b('0x2'));var moment=require('moment');var BPromise=require(_0x995b('0x3'));var rp=require(_0x995b('0x4'));var fs=require('fs');var path=require(_0x995b('0x5'));var rimraf=require(_0x995b('0x6'));var config=require(_0x995b('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x995b('0x8')]=function(_0x402c63,_0x473daf){return _0x402c63[_0x995b('0x9')](_0x995b('0xa'),attributes,{'tableName':_0x995b('0xb'),'paranoid':![],'indexes':[{'name':_0x995b('0xc'),'fields':[_0x995b('0xd'),'to'],'type':_0x995b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x140822,_0x6893b0,_0x2a38eb){if(_0x140822[_0x995b('0xf')]){_0x140822[_0x995b('0x10')]=moment()['format'](_0x995b('0x11'));}if(_0x140822[_0x995b('0x12')]){_0x140822[_0x995b('0x13')]=moment()[_0x995b('0x14')](_0x995b('0x11'));}_0x2a38eb(null,_0x6893b0);},'beforeUpdate':function(_0x482922,_0x23ba85,_0x50beda){if(_0x482922[_0x995b('0x15')](_0x995b('0xf'))){_0x482922[_0x995b('0x10')]=_0x482922[_0x995b('0xf')]?moment()[_0x995b('0x14')](_0x995b('0x11')):null;}if(_0x482922[_0x995b('0x15')](_0x995b('0x12'))){_0x482922[_0x995b('0x13')]=moment()[_0x995b('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x482922[_0x995b('0xf')]=null;_0x482922['substatusAt']=null;}_0x50beda(null,_0x482922);},'afterUpdate':function(_0x24549e,_0x2cd604,_0x4f1195){var _0x5a5e70=_0x402c63[_0x995b('0x16')];var _0x5d6c0f=_0x24549e[_0x995b('0x17')]({'plain':!![]});if(_0x5d6c0f[_0x995b('0x12')]){return _0x5a5e70[_0x995b('0x18')][_0x995b('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5d6c0f['id']}})[_0x995b('0x1a')](function(){_0x4f1195();})['catch'](function(_0x3b54de){_0x4f1195(_0x3b54de);});}else{_0x4f1195();}}},'charset':_0x995b('0x1b'),'collate':_0x995b('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 034c230..9dada29 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 _0x18e0=['spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','MailInteraction','addTags','ids','omit'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x18e0,0xa2));var _0x018e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x18e0[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x018e('0x0'));var moment=require('moment');var BPromise=require(_0x018e('0x1'));var rs=require(_0x018e('0x2'));var fs=require('fs');var Redis=require(_0x018e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x018e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x018e('0x5'));var jayson=require(_0x018e('0x6'));var client=jayson[_0x018e('0x7')]['http']({'port':0x232a});config['redis']=_[_0x018e('0x8')](config[_0x018e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x018e('0xa'))(new Redis(config[_0x018e('0x9')]));require(_0x018e('0xb'))[_0x018e('0xc')](socket);function respondWithRpcPromise(_0x20c76c,_0x53344a,_0x4e205a){return new BPromise(function(_0x301f3c,_0x4cb30b){return client['request'](_0x20c76c,_0x4e205a)['then'](function(_0xa44f64){logger[_0x018e('0xd')](_0x018e('0xe'),_0x53344a,_0x018e('0xf'));logger[_0x018e('0x10')](_0x018e('0x11'),_0x53344a,_0x018e('0xf'),JSON[_0x018e('0x12')](_0xa44f64));if(_0xa44f64[_0x018e('0x13')]){if(_0xa44f64['error'][_0x018e('0x14')]===0x1f4){logger[_0x018e('0x13')](_0x018e('0xe'),_0x53344a,_0xa44f64[_0x018e('0x13')][_0x018e('0x15')]);return _0x4cb30b(_0xa44f64['error'][_0x018e('0x15')]);}logger[_0x018e('0x13')](_0x018e('0xe'),_0x53344a,_0xa44f64[_0x018e('0x13')]['message']);return _0x301f3c(_0xa44f64[_0x018e('0x13')][_0x018e('0x15')]);}else{logger['info'](_0x018e('0xe'),_0x53344a,_0x018e('0xf'));_0x301f3c(_0xa44f64[_0x018e('0x16')][_0x018e('0x15')]);}})[_0x018e('0x17')](function(_0x53b3e8){logger[_0x018e('0x13')](_0x018e('0xe'),_0x53344a,_0x53b3e8);_0x4cb30b(_0x53b3e8);});});}exports[_0x018e('0x18')]=function(_0x1caaa1){var _0x45a5bb=this;return new Promise(function(_0x3c3027,_0x15c3fa){return db['MailInteraction'][_0x018e('0x19')](_0x1caaa1[_0x018e('0x1a')],{'raw':_0x1caaa1[_0x018e('0x1b')]?_0x1caaa1[_0x018e('0x1b')][_0x018e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1caaa1['options']?_0x1caaa1['options'][_0x018e('0x1d')]||null:null,'attributes':_0x1caaa1[_0x018e('0x1b')]?_0x1caaa1[_0x018e('0x1b')][_0x018e('0x1e')]||null:null,'limit':_0x1caaa1[_0x018e('0x1b')]?_0x1caaa1[_0x018e('0x1b')][_0x018e('0x1f')]||null:null})[_0x018e('0x20')](function(_0x3e3b35){logger[_0x018e('0xd')](_0x018e('0x18'),_0x1caaa1);logger[_0x018e('0x10')]('UpdateMailInteraction',_0x1caaa1,JSON[_0x018e('0x12')](_0x3e3b35));_0x3c3027(_0x3e3b35);})[_0x018e('0x17')](function(_0x176822){logger[_0x018e('0x13')](_0x018e('0x18'),_0x176822[_0x018e('0x15')],_0x1caaa1);_0x15c3fa(_0x45a5bb[_0x018e('0x13')](0x1f4,_0x176822[_0x018e('0x15')]));});});};exports[_0x018e('0x21')]=function(_0x3287e8){return new Promise(function(_0x55e64b,_0x29455a){return db[_0x018e('0x22')]['find']({'where':_0x3287e8[_0x018e('0x1b')]?_0x3287e8[_0x018e('0x1b')][_0x018e('0x1d')]||null:null})[_0x018e('0x20')](function(_0x13929e){if(_0x13929e){return _0x13929e[_0x018e('0x23')](_0x3287e8['body'][_0x018e('0x24')],_[_0x018e('0x25')](_0x3287e8['body'],[_0x018e('0x24'),'id'])||{});}})[_0x018e('0x26')](function(_0x58a1e){logger[_0x018e('0xd')](_0x018e('0x27'),_0x3287e8);logger['debug'](_0x018e('0x27'),_0x3287e8,JSON[_0x018e('0x12')](_0x58a1e));_0x55e64b(_0x58a1e);})[_0x018e('0x17')](function(_0x502763){logger[_0x018e('0x13')]('AddTags',_0x502763[_0x018e('0x15')],_0x3287e8);_0x29455a(_this[_0x018e('0x13')](0x1f4,_0x502763['message']));});});}; \ No newline at end of file +var _0x688a=['find','addTags','ids','AddTags','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailInteraction,\x20%s,\x20%s','result','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','stringify','catch','AddTagsToMailInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x688a,0x124));var _0xa688=function(_0x2e4d09,_0x3ea1e1){_0x2e4d09=_0x2e4d09-0x0;var _0xf0c6a2=_0x688a[_0x2e4d09];return _0xf0c6a2;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var moment=require(_0xa688('0x2'));var BPromise=require('bluebird');var rs=require(_0xa688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa688('0x4'))['db'];var utils=require(_0xa688('0x5'));var logger=require('../../config/logger')(_0xa688('0x6'));var config=require(_0xa688('0x7'));var jayson=require(_0xa688('0x8'));var client=jayson[_0xa688('0x9')][_0xa688('0xa')]({'port':0x232a});config[_0xa688('0xb')]=_['defaults'](config['redis'],{'host':_0xa688('0xc'),'port':0x18eb});var socket=require(_0xa688('0xd'))(new Redis(config[_0xa688('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x42b94e,_0x5ce966,_0x4bf4ee){return new BPromise(function(_0x442638,_0x74b76){return client[_0xa688('0xe')](_0x42b94e,_0x4bf4ee)[_0xa688('0xf')](function(_0x43852b){logger[_0xa688('0x10')]('MailInteraction,\x20%s,\x20%s',_0x5ce966,'request\x20sent');logger['debug'](_0xa688('0x11'),_0x5ce966,_0xa688('0x12'),JSON['stringify'](_0x43852b));if(_0x43852b[_0xa688('0x13')]){if(_0x43852b['error'][_0xa688('0x14')]===0x1f4){logger[_0xa688('0x13')]('MailInteraction,\x20%s,\x20%s',_0x5ce966,_0x43852b['error'][_0xa688('0x15')]);return _0x74b76(_0x43852b['error'][_0xa688('0x15')]);}logger['error'](_0xa688('0x16'),_0x5ce966,_0x43852b[_0xa688('0x13')][_0xa688('0x15')]);return _0x442638(_0x43852b[_0xa688('0x13')][_0xa688('0x15')]);}else{logger[_0xa688('0x10')]('MailInteraction,\x20%s,\x20%s',_0x5ce966,'request\x20sent');_0x442638(_0x43852b[_0xa688('0x17')][_0xa688('0x15')]);}})['catch'](function(_0x5af18b){logger[_0xa688('0x13')](_0xa688('0x16'),_0x5ce966,_0x5af18b);_0x74b76(_0x5af18b);});});}exports['UpdateMailInteraction']=function(_0x37e9af){var _0x598168=this;return new Promise(function(_0x5c6925,_0x152cfe){return db[_0xa688('0x18')][_0xa688('0x19')](_0x37e9af[_0xa688('0x1a')],{'raw':_0x37e9af[_0xa688('0x1b')]?_0x37e9af[_0xa688('0x1b')][_0xa688('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37e9af[_0xa688('0x1b')]?_0x37e9af[_0xa688('0x1b')][_0xa688('0x1d')]||null:null,'attributes':_0x37e9af[_0xa688('0x1b')]?_0x37e9af[_0xa688('0x1b')][_0xa688('0x1e')]||null:null,'limit':_0x37e9af[_0xa688('0x1b')]?_0x37e9af['options'][_0xa688('0x1f')]||null:null})[_0xa688('0xf')](function(_0x4fa15e){logger[_0xa688('0x10')](_0xa688('0x20'),_0x37e9af);logger['debug'](_0xa688('0x20'),_0x37e9af,JSON[_0xa688('0x21')](_0x4fa15e));_0x5c6925(_0x4fa15e);})[_0xa688('0x22')](function(_0x25d1fa){logger[_0xa688('0x13')](_0xa688('0x20'),_0x25d1fa[_0xa688('0x15')],_0x37e9af);_0x152cfe(_0x598168[_0xa688('0x13')](0x1f4,_0x25d1fa[_0xa688('0x15')]));});});};exports[_0xa688('0x23')]=function(_0x3ab038){return new Promise(function(_0x161741,_0x3c7245){return db[_0xa688('0x18')][_0xa688('0x24')]({'where':_0x3ab038['options']?_0x3ab038[_0xa688('0x1b')][_0xa688('0x1d')]||null:null})[_0xa688('0xf')](function(_0x1f9d59){if(_0x1f9d59){return _0x1f9d59[_0xa688('0x25')](_0x3ab038[_0xa688('0x1a')]['ids'],_['omit'](_0x3ab038['body'],[_0xa688('0x26'),'id'])||{});}})['spread'](function(_0x5d8753){logger[_0xa688('0x10')](_0xa688('0x27'),_0x3ab038);logger[_0xa688('0x28')](_0xa688('0x27'),_0x3ab038,JSON[_0xa688('0x21')](_0x5d8753));_0x161741(_0x5d8753);})[_0xa688('0x22')](function(_0x55c564){logger['error']('AddTags',_0x55c564['message'],_0x3ab038);_0x3c7245(_this[_0xa688('0x13')](0x1f4,_0x55c564[_0xa688('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index fc84cf4..b69a53e 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 _0x425d=['register','mailInteraction:','save','remove','update'];(function(_0x21409c,_0x32c3c5){var _0x29f5d2=function(_0x33ceda){while(--_0x33ceda){_0x21409c['push'](_0x21409c['shift']());}};_0x29f5d2(++_0x32c3c5);}(_0x425d,0x1ba));var _0xd425=function(_0x148073,_0x37dbaa){_0x148073=_0x148073-0x0;var _0x30ba58=_0x425d[_0x148073];return _0x30ba58;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xd425('0x0'),_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x522b1e,_0x43830c){return function(_0x12cdbb){_0x43830c['emit'](_0x522b1e,_0x12cdbb);};}function removeListener(_0x15c138,_0x58b944){return function(){MailInteractionEvents['removeListener'](_0x15c138,_0x58b944);};}exports[_0xd425('0x3')]=function(_0x452211){for(var _0x2be5a2=0x0,_0x18cf33=events['length'];_0x2be5a2<_0x18cf33;_0x2be5a2++){var _0x4d1068=events[_0x2be5a2];var _0x4a6d0f=createListener(_0xd425('0x4')+_0x4d1068,_0x452211);MailInteractionEvents['on'](_0x4d1068,_0x4a6d0f);}}; \ No newline at end of file +var _0x1916=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x25da9f,_0x47d72c){var _0x447588=function(_0x212fa5){while(--_0x212fa5){_0x25da9f['push'](_0x25da9f['shift']());}};_0x447588(++_0x47d72c);}(_0x1916,0x1d5));var _0x6191=function(_0x3c42f7,_0x25c980){_0x3c42f7=_0x3c42f7-0x0;var _0x35ac7f=_0x1916[_0x3c42f7];return _0x35ac7f;};'use strict';var MailInteractionEvents=require(_0x6191('0x0'));var events=[_0x6191('0x1'),_0x6191('0x2'),_0x6191('0x3')];function createListener(_0x25f952,_0x2a86d0){return function(_0x4e5831){_0x2a86d0[_0x6191('0x4')](_0x25f952,_0x4e5831);};}function removeListener(_0x36c592,_0x891c21){return function(){MailInteractionEvents[_0x6191('0x5')](_0x36c592,_0x891c21);};}exports[_0x6191('0x6')]=function(_0x1228e9){for(var _0x5148de=0x0,_0x5a7599=events[_0x6191('0x7')];_0x5148de<_0x5a7599;_0x5148de++){var _0xe5d68f=events[_0x5148de];var _0x350cf4=createListener(_0x6191('0x8')+_0xe5d68f,_0x1228e9);MailInteractionEvents['on'](_0xe5d68f,_0x350cf4);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 31b1d2e..f4e3452 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 _0x7217=['mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x44ec84,_0xc7f25a){var _0x223928=function(_0x1c3846){while(--_0x1c3846){_0x44ec84['push'](_0x44ec84['shift']());}};_0x223928(++_0xc7f25a);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0x7')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller['download']);router[_0x7721('0xf')]('/',auth[_0x7721('0x8')](),interaction[_0x7721('0x10')](_0x7721('0x11'),_0x7721('0x12')),controller[_0x7721('0x13')]);router[_0x7721('0x14')](_0x7721('0xc'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x14')]('/:id/accept',auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);router[_0x7721('0x14')](_0x7721('0x17'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router[_0x7721('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7721('0x1a')]=router; \ No newline at end of file +var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x98a8,0x12c));var _0x898a=function(_0x3d6886,_0x895066){_0x3d6886=_0x3d6886-0x0;var _0x2e07cf=_0x98a8[_0x3d6886];return _0x2e07cf;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 66db058..96a7bb7 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 _0x3f35=['exports','TEXT','long','medium','ENUM','out','STRING','INTEGER','BOOLEAN','DATE','sequelize','lodash'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x3f35[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x53f3('0x0'));var _=require(_0x53f3('0x1'));module[_0x53f3('0x2')]={'body':{'type':Sequelize[_0x53f3('0x3')](_0x53f3('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x53f3('0x3')](_0x53f3('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x53f3('0x6')]('in','out'),'defaultValue':_0x53f3('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x53f3('0x8')]},'to':{'type':Sequelize[_0x53f3('0x3')](_0x53f3('0x4'))},'cc':{'type':Sequelize[_0x53f3('0x3')]('long')},'bcc':{'type':Sequelize[_0x53f3('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x53f3('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x53f3('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x53f3('0xb')]},'originTo':{'type':Sequelize[_0x53f3('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0x53f3('0x4'))}}; \ No newline at end of file +var _0x7cdc=['STRING','INTEGER','BOOLEAN','DATE','lodash','exports','long','TEXT','medium','ENUM','out'];(function(_0x39c281,_0x28dc4d){var _0x41bd06=function(_0x209f94){while(--_0x209f94){_0x39c281['push'](_0x39c281['shift']());}};_0x41bd06(++_0x28dc4d);}(_0x7cdc,0x190));var _0xc7cd=function(_0x507c46,_0x2589a4){_0x507c46=_0x507c46-0x0;var _0x53ac33=_0x7cdc[_0x507c46];return _0x53ac33;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc7cd('0x0'));module[_0xc7cd('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc7cd('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc7cd('0x5')]('in',_0xc7cd('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc7cd('0x7')](0x1fe)},'from':{'type':Sequelize[_0xc7cd('0x7')]},'to':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x2'))},'cc':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x2'))},'bcc':{'type':Sequelize[_0xc7cd('0x3')]('long')},'subject':{'type':Sequelize[_0xc7cd('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xc7cd('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc7cd('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc7cd('0xa')]},'originTo':{'type':Sequelize[_0xc7cd('0x3')]('long')},'originCc':{'type':Sequelize[_0xc7cd('0x3')](_0xc7cd('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5470641..2fbc0f2 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 _0x9de8=['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','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','count','offset','save','update','destroy','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','MailServerOut','isNil','Smtp','service','host','port','secure','authentication','user','pass','attachments','join','root','basename','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','unix','toString','server','tmp','message-%s.eml','from','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','request-promise'];(function(_0x230951,_0x4dad52){var _0xeb26b1=function(_0x25776c){while(--_0x25776c){_0x230951['push'](_0x230951['shift']());}};_0xeb26b1(++_0x4dad52);}(_0x9de8,0xa1));var _0x89de=function(_0x2b324c,_0x4499a2){_0x2b324c=_0x2b324c-0x0;var _0x369271=_0x9de8[_0x2b324c];return _0x369271;};'use strict';var pdf=require(_0x89de('0x0'));var emlformat=require(_0x89de('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x89de('0x3'));var util=require(_0x89de('0x4'));var path=require(_0x89de('0x5'));var sox=require(_0x89de('0x6'));var csv=require(_0x89de('0x7'));var ejs=require(_0x89de('0x8'));var fs=require('fs');var _=require(_0x89de('0x9'));var squel=require(_0x89de('0xa'));var crypto=require(_0x89de('0xb'));var jsforce=require(_0x89de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x89de('0x7'));var querystring=require('querystring');var Papa=require(_0x89de('0xd'));var Redis=require(_0x89de('0xe'));var authService=require(_0x89de('0xf'));var qs=require(_0x89de('0x10'));var as=require(_0x89de('0x11'));var hardwareService=require(_0x89de('0x12'));var logger=require(_0x89de('0x13'))(_0x89de('0x14'));var utils=require(_0x89de('0x15'));var config=require(_0x89de('0x16'));var licenseUtil=require(_0x89de('0x17'));var db=require(_0x89de('0x18'))['db'];config['redis']=_[_0x89de('0x19')](config[_0x89de('0x1a')],{'host':_0x89de('0x1b'),'port':0x18eb});var socket=require(_0x89de('0x1c'))(new Redis(config[_0x89de('0x1a')]));require(_0x89de('0x1d'))[_0x89de('0x1e')](socket);var jayson=require(_0x89de('0x1f'));var client=jayson[_0x89de('0x20')][_0x89de('0x21')]({'port':0x232c});var client9003=jayson[_0x89de('0x20')][_0x89de('0x21')]({'port':0x232b});var client9002=jayson[_0x89de('0x20')][_0x89de('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xda00d6,_0x167a1f,_0x271df4,_0x54e331){return new BPromise(function(_0x5eb1f2,_0x3342e8){var _0x1c1d35=_0x54e331||client;return _0x1c1d35['request'](_0xda00d6,_0x271df4)[_0x89de('0x22')](function(_0x1d11bf){logger[_0x89de('0x23')](_0x89de('0x24'),_0x167a1f,_0x89de('0x25'));logger[_0x89de('0x26')](_0x89de('0x27'),_0x167a1f,_0x89de('0x25'),JSON['stringify'](_0x1d11bf));if(_0x1d11bf[_0x89de('0x28')]){if(_0x1d11bf['error'][_0x89de('0x29')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x167a1f,_0x1d11bf[_0x89de('0x28')]['message']);return _0x3342e8(_0x1d11bf[_0x89de('0x28')][_0x89de('0x2a')]);}logger['error'](_0x89de('0x24'),_0x167a1f,_0x1d11bf[_0x89de('0x28')][_0x89de('0x2a')]);return _0x5eb1f2(_0x1d11bf[_0x89de('0x28')]['message']);}else{logger[_0x89de('0x23')](_0x89de('0x24'),_0x167a1f,_0x89de('0x25'));_0x5eb1f2(_0x1d11bf[_0x89de('0x2b')][_0x89de('0x2a')]);}})['catch'](function(_0x4265e2){logger['error'](_0x89de('0x24'),_0x167a1f,_0x4265e2);_0x3342e8(_0x4265e2);});});}function respondWithStatusCode(_0x1e56f4,_0xc42625){_0xc42625=_0xc42625||0xcc;return function(_0x416274){if(_0x416274){return _0x1e56f4['sendStatus'](_0xc42625);}return _0x1e56f4[_0x89de('0x2c')](_0xc42625)[_0x89de('0x2d')]();};}function respondWithResult(_0xe43a03,_0x210aa3){_0x210aa3=_0x210aa3||0xc8;return function(_0x4a199b){if(_0x4a199b){return _0xe43a03[_0x89de('0x2c')](_0x210aa3)[_0x89de('0x2e')](_0x4a199b);}};}function respondWithFilteredResult(_0x363a99,_0x142351){return function(_0x2fa105){if(_0x2fa105){var _0xaae94d=_0x2fa105[_0x89de('0x2f')],_0x42c710=_0x142351[_0x89de('0x30')],_0x4649e1=_0x142351['offset']+_0x142351['limit'],_0x3da64f;if(_0x4649e1>=_0xaae94d){_0x4649e1=_0xaae94d;_0x3da64f=0xc8;}else{_0x3da64f=0xce;}_0x363a99[_0x89de('0x2c')](_0x3da64f);return _0x363a99['set']('Content-Range',_0x42c710+'-'+_0x4649e1+'/'+_0xaae94d)[_0x89de('0x2e')](_0x2fa105);}return null;};}function patchUpdates(_0x4bdd69){return function(_0x1a67b7){try{jsonpatch['apply'](_0x1a67b7,_0x4bdd69,!![]);}catch(_0x3bad44){return BPromise['reject'](_0x3bad44);}return _0x1a67b7[_0x89de('0x31')]();};}function saveUpdates(_0x4a2a9e,_0x2e13a3){return function(_0x29b08f){if(_0x29b08f){return _0x29b08f[_0x89de('0x32')](_0x4a2a9e)[_0x89de('0x22')](function(_0x116731){return _0x116731;});}return null;};}function removeEntity(_0x1dc77c,_0x206764){return function(_0x3fa913){if(_0x3fa913){return _0x3fa913[_0x89de('0x33')]()[_0x89de('0x22')](function(){_0x1dc77c[_0x89de('0x2c')](0xcc)[_0x89de('0x2d')]();});}};}function handleEntityNotFound(_0x591627,_0x2e95a4){return function(_0x491369){if(!_0x491369){_0x591627['sendStatus'](0x194);}return _0x491369;};}function handleError(_0x4749cb,_0x5b5d75){_0x5b5d75=_0x5b5d75||0x1f4;return function(_0x397da5){logger['error'](_0x397da5['stack']);if(_0x397da5[_0x89de('0x34')]){delete _0x397da5[_0x89de('0x34')];}_0x4749cb[_0x89de('0x2c')](_0x5b5d75)[_0x89de('0x35')](_0x397da5);};}exports[_0x89de('0x36')]=function(_0x3daccf,_0x3a06ec){var _0x1c9880={},_0x23fab2={},_0x1ac49a={'count':0x0,'rows':[]};var _0x2be503=_[_0x89de('0x37')](db[_0x89de('0x38')][_0x89de('0x39')],function(_0x5df17b){return{'name':_0x5df17b[_0x89de('0x3a')],'type':_0x5df17b[_0x89de('0x3b')]['key']};});_0x23fab2[_0x89de('0x3c')]=_['map'](_0x2be503,_0x89de('0x34'));_0x23fab2[_0x89de('0x3d')]=_[_0x89de('0x3e')](_0x3daccf[_0x89de('0x3d')]);_0x23fab2[_0x89de('0x3f')]=_[_0x89de('0x40')](_0x23fab2['model'],_0x23fab2['query']);_0x1c9880['attributes']=_[_0x89de('0x40')](_0x23fab2['model'],qs[_0x89de('0x41')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x41')]));_0x1c9880[_0x89de('0x42')]=_0x1c9880[_0x89de('0x42')]['length']?_0x1c9880['attributes']:_0x23fab2[_0x89de('0x3c')];if(!_0x3daccf['query'][_0x89de('0x43')](_0x89de('0x44'))){_0x1c9880[_0x89de('0x45')]=qs[_0x89de('0x45')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x45')]);_0x1c9880[_0x89de('0x30')]=qs[_0x89de('0x30')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x30')]);}_0x1c9880[_0x89de('0x46')]=qs[_0x89de('0x47')](_0x3daccf[_0x89de('0x3d')][_0x89de('0x47')]);_0x1c9880['where']=qs[_0x89de('0x3f')](_[_0x89de('0x48')](_0x3daccf[_0x89de('0x3d')],_0x23fab2['filters']),_0x2be503);if(_0x3daccf[_0x89de('0x3d')][_0x89de('0x49')]){_0x1c9880[_0x89de('0x4a')]=_['merge'](_0x1c9880[_0x89de('0x4a')],{'$or':_[_0x89de('0x37')](_0x2be503,function(_0x1a8a47){if(_0x1a8a47[_0x89de('0x3b')]!=='VIRTUAL'){var _0x11556b={};_0x11556b[_0x1a8a47['name']]={'$like':'%'+_0x3daccf['query'][_0x89de('0x49')]+'%'};return _0x11556b;}})});}_0x1c9880=_[_0x89de('0x4b')]({},_0x1c9880,_0x3daccf[_0x89de('0x4c')]);var _0x27b5ff={'where':_0x1c9880[_0x89de('0x4a')]};return db['MailMessage'][_0x89de('0x2f')](_0x27b5ff)['then'](function(_0x7aae2a){_0x1ac49a[_0x89de('0x2f')]=_0x7aae2a;if(_0x3daccf[_0x89de('0x3d')][_0x89de('0x4d')]){_0x1c9880[_0x89de('0x4e')]=[{'all':!![]}];}return db[_0x89de('0x38')][_0x89de('0x4f')](_0x1c9880);})[_0x89de('0x22')](function(_0x2d24c0){_0x1ac49a[_0x89de('0x50')]=_0x2d24c0;return _0x1ac49a;})['then'](respondWithFilteredResult(_0x3a06ec,_0x1c9880))[_0x89de('0x51')](handleError(_0x3a06ec,null));};exports[_0x89de('0x52')]=function(_0xe3aae9,_0x52c15b){var _0x5056bf={'raw':!![],'where':{'id':_0xe3aae9[_0x89de('0x53')]['id']}},_0x241ebd={};_0x241ebd[_0x89de('0x3c')]=_[_0x89de('0x3e')](db[_0x89de('0x38')][_0x89de('0x39')]);_0x241ebd[_0x89de('0x3d')]=_[_0x89de('0x3e')](_0xe3aae9[_0x89de('0x3d')]);_0x241ebd['filters']=_[_0x89de('0x40')](_0x241ebd['model'],_0x241ebd[_0x89de('0x3d')]);_0x5056bf[_0x89de('0x42')]=_[_0x89de('0x40')](_0x241ebd['model'],qs[_0x89de('0x41')](_0xe3aae9[_0x89de('0x3d')][_0x89de('0x41')]));_0x5056bf[_0x89de('0x42')]=_0x5056bf[_0x89de('0x42')][_0x89de('0x54')]?_0x5056bf['attributes']:_0x241ebd[_0x89de('0x3c')];if(_0xe3aae9[_0x89de('0x3d')][_0x89de('0x4d')]){_0x5056bf[_0x89de('0x4e')]=[{'all':!![]}];}_0x5056bf=_[_0x89de('0x4b')]({},_0x5056bf,_0xe3aae9[_0x89de('0x4c')]);return db['MailMessage']['find'](_0x5056bf)[_0x89de('0x22')](handleEntityNotFound(_0x52c15b,null))[_0x89de('0x22')](respondWithResult(_0x52c15b,null))[_0x89de('0x51')](handleError(_0x52c15b,null));};exports['update']=function(_0x21be33,_0xf5e031){if(_0x21be33[_0x89de('0x55')]['id']){delete _0x21be33['body']['id'];}return db[_0x89de('0x38')][_0x89de('0x56')]({'where':{'id':_0x21be33[_0x89de('0x53')]['id']}})[_0x89de('0x22')](handleEntityNotFound(_0xf5e031,null))[_0x89de('0x22')](saveUpdates(_0x21be33['body'],null))['then'](respondWithResult(_0xf5e031,null))[_0x89de('0x51')](handleError(_0xf5e031,null));};exports['destroy']=function(_0x1a8292,_0x419fbe){return db[_0x89de('0x38')]['find']({'where':{'id':_0x1a8292[_0x89de('0x53')]['id']}})['then'](handleEntityNotFound(_0x419fbe,null))[_0x89de('0x22')](removeEntity(_0x419fbe,null))[_0x89de('0x51')](handleError(_0x419fbe,null));};exports['describe']=function(_0x44f4f8,_0x3b96ff){return db['MailMessage'][_0x89de('0x57')]()[_0x89de('0x22')](respondWithResult(_0x3b96ff,null))[_0x89de('0x51')](handleError(_0x3b96ff,null));};exports[_0x89de('0x58')]=function(_0x58fe36,_0x3d6b01){return db[_0x89de('0x38')]['create'](_0x58fe36['body'])[_0x89de('0x22')](function(_0x22dce1){if(_0x22dce1){if(_0x22dce1[_0x89de('0x59')]===_0x89de('0x5a')&&!_0x22dce1['secret']){var _0x3dcf5e,_0x2ef792,_0x571dee;if(_0x58fe36[_0x89de('0x55')]['to']){_0x2ef792=_0x58fe36['body']['to'][_0x89de('0x5b')](',')[0x0];}return db[_0x89de('0x5c')][_0x89de('0x5d')]({'where':{'id':_0x22dce1[_0x89de('0x5e')]},'include':[{'model':db[_0x89de('0x5f')],'as':_0x89de('0x60'),'include':[{'model':db['CmContact'],'as':_0x89de('0x61'),'where':{'email':_0x2ef792},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x89de('0x62')],'as':'Smtp','raw':!![]}]})[_0x89de('0x22')](function(_0x3cd8d5){_0x3dcf5e=_0x3cd8d5;if(_0x3dcf5e&&_0x3dcf5e['Smtp']){var _0x1582a3={'tls':{'rejectUnauthorized':![]}};if(_[_0x89de('0x63')](_0x3dcf5e[_0x89de('0x64')][_0x89de('0x65')])){_0x1582a3[_0x89de('0x66')]=_0x3dcf5e[_0x89de('0x64')][_0x89de('0x66')];_0x1582a3[_0x89de('0x67')]=_0x3dcf5e[_0x89de('0x64')][_0x89de('0x67')];_0x1582a3[_0x89de('0x68')]=_0x3dcf5e[_0x89de('0x64')]['secure'];if(_0x3dcf5e[_0x89de('0x64')][_0x89de('0x69')]){_0x1582a3['auth']={'user':_0x3dcf5e[_0x89de('0x64')][_0x89de('0x6a')],'pass':_0x3dcf5e[_0x89de('0x64')][_0x89de('0x6b')]};}}else{_0x1582a3[_0x89de('0x65')]=_0x3dcf5e['Smtp'][_0x89de('0x65')];_0x1582a3['auth']={'user':_0x3dcf5e['Smtp']['user'],'pass':_0x3dcf5e[_0x89de('0x64')][_0x89de('0x6b')]};_0x1582a3[_0x89de('0x68')]=_0x3dcf5e[_0x89de('0x64')]['secure'];}if(_0x58fe36['body']['attachments']&&_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x89de('0x54')]){for(var _0x163bcf=0x0;_0x163bcf<_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x89de('0x54')];_0x163bcf+=0x1){_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x163bcf]={'filename':_0x58fe36[_0x89de('0x55')][_0x89de('0x6c')][_0x163bcf]['name'],'path':path[_0x89de('0x6d')](config[_0x89de('0x6e')],'server/files/attachments',_0x58fe36['body'][_0x89de('0x6c')][_0x163bcf][_0x89de('0x6f')])};}}_0x571dee={'account':_0x1582a3,'message':_0x58fe36['body']};return;}})[_0x89de('0x22')](function(){if(_0x3dcf5e['List']){if(_0x3dcf5e[_0x89de('0x60')][_0x89de('0x61')][_0x89de('0x54')]){return _0x3dcf5e['List'][_0x89de('0x61')][0x0];}else{return db['CmContact'][_0x89de('0x58')](_['defaults'](_0x58fe36[_0x89de('0x55')],{'firstName':_0x58fe36['body']['to'],'email':_0x58fe36[_0x89de('0x55')]['to'],'phone':_0x58fe36[_0x89de('0x55')]['to'],'ListId':_0x3dcf5e[_0x89de('0x70')]}));}}else{throw new Error(_0x89de('0x71'));}})[_0x89de('0x22')](function(){if(_0x571dee){return respondWithRpcPromise('SendMail',_0x89de('0x72'),_0x571dee,client9003)[_0x89de('0x22')](function(_0x4f2491){return _0x22dce1['update']({'read':!![],'messageId':_0x4f2491[_0x89de('0x73')],'sentAt':moment()[_0x89de('0x74')](_0x89de('0x75'))});})[_0x89de('0x51')](function(_0x31246c){logger[_0x89de('0x28')]('%s',JSON[_0x89de('0x76')](_0x31246c));return _0x22dce1;});}return _0x22dce1;});}return _0x22dce1;}})[_0x89de('0x22')](respondWithResult(_0x3d6b01,0xc9))[_0x89de('0x51')](handleError(_0x3d6b01,null));};var interaction_log=require(_0x89de('0x13'))(_0x89de('0x77'));exports['accept']=function(_0x29afd7,_0x5f4009,_0x2e65c8){var _0x479a79={'channel':'mail'};if(_0x29afd7[_0x89de('0x55')]['id']){delete _0x29afd7[_0x89de('0x55')]['id'];}_0x29afd7[_0x89de('0x55')]['read']=!![];_0x29afd7[_0x89de('0x55')][_0x89de('0x78')]=moment()[_0x89de('0x74')](_0x89de('0x75'));_0x29afd7[_0x89de('0x55')][_0x89de('0x79')]=_0x29afd7[_0x89de('0x55')][_0x89de('0x79')]||_0x29afd7[_0x89de('0x6a')]['id'];return db[_0x89de('0x38')]['find']({'where':{'id':_0x29afd7[_0x89de('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x89de('0x7a')}]})[_0x89de('0x22')](handleEntityNotFound(_0x5f4009,null))[_0x89de('0x22')](saveUpdates(_0x29afd7[_0x89de('0x55')],null))[_0x89de('0x22')](function(_0x4f9995){if(_0x4f9995){_0x479a79[_0x89de('0x2a')]=_0x4f9995[_0x89de('0x7b')]({'plain':!![]});return db[_0x89de('0x7c')][_0x89de('0x56')]({'where':{'id':_0x4f9995[_0x89de('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x5f4009,null))[_0x89de('0x22')](function(_0x33600a){if(_0x33600a){return _0x33600a[_0x89de('0x32')]({'UserId':_0x29afd7[_0x89de('0x55')][_0x89de('0x79')],'read1stAt':_['isNil'](_0x33600a[_0x89de('0x7e')])?moment()['format'](_0x89de('0x75')):undefined});}return null;})['then'](function(_0x56519e){if(_0x56519e){_0x479a79[_0x89de('0x7f')]=_0x56519e[_0x89de('0x7b')]({'plain':!![]});interaction_log[_0x89de('0x23')](_0x89de('0x80'),_0x29afd7[_0x89de('0x6a')]['id'],_0x29afd7[_0x89de('0x6a')][_0x89de('0x34')],_0x29afd7['user'][_0x89de('0x81')],_0x479a79[_0x89de('0x7f')]['id'],_0x29afd7['body']?JSON[_0x89de('0x76')](_0x29afd7[_0x89de('0x55')]):'null');return respondWithRpcPromise(_0x89de('0x82'),_0x89de('0x83'),_0x479a79);}return null;})[_0x89de('0x22')](function(_0x546da7){if(_0x546da7){if(_0x29afd7['body'][_0x89de('0x84')]){_0x479a79[_0x89de('0x2a')][_0x89de('0x85')]=util[_0x89de('0x74')]('SIP/%s',_0x29afd7[_0x89de('0x6a')][_0x89de('0x34')]);_0x479a79['message'][_0x89de('0x86')]=_0x479a79[_0x89de('0x86')];_0x479a79[_0x89de('0x2a')][_0x89de('0x87')]=_0x89de('0x88');return respondWithRpcPromise(_0x89de('0x89'),_0x89de('0x89'),{'event':'acceptmessage','message':_0x479a79['message']},client9002)['then'](function(){return _0x479a79;});}return _0x479a79;}return null;})[_0x89de('0x22')](respondWithResult(_0x5f4009,null))[_0x89de('0x51')](handleError(_0x5f4009,null));};var interaction_log=require('../../config/logger')(_0x89de('0x77'));exports[_0x89de('0x8a')]=function(_0x58db93,_0x5d333b,_0x56dfa0){var _0x504db6={'agent':{},'channel':_0x89de('0x8b')};if(_0x58db93[_0x89de('0x55')]['id']){delete _0x58db93[_0x89de('0x55')]['id'];}_0x58db93[_0x89de('0x55')][_0x89de('0x79')]=_0x58db93[_0x89de('0x55')]['UserId']||_0x58db93['user']['id'];_0x504db6['agent']['id']=_0x58db93[_0x89de('0x55')][_0x89de('0x79')];return db['MailMessage'][_0x89de('0x56')]({'where':{'id':_0x58db93[_0x89de('0x53')]['id'],'UserId':null}})[_0x89de('0x22')](handleEntityNotFound(_0x5d333b,null))[_0x89de('0x22')](function(_0x4c4752){if(_0x4c4752){_0x504db6[_0x89de('0x2a')]=_0x4c4752['get']({'plain':!![]});return db[_0x89de('0x7c')][_0x89de('0x56')]({'where':{'id':_0x4c4752['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5d333b,null))[_0x89de('0x22')](function(_0x9cd5a6){if(_0x9cd5a6){_0x504db6[_0x89de('0x7f')]=_0x9cd5a6[_0x89de('0x7b')]({'plain':!![]});interaction_log[_0x89de('0x23')](_0x89de('0x8c'),_0x58db93[_0x89de('0x6a')]['id'],_0x58db93['user'][_0x89de('0x34')],_0x58db93[_0x89de('0x6a')][_0x89de('0x81')],_0x504db6['interaction']['id'],_0x58db93[_0x89de('0x55')]?JSON[_0x89de('0x76')](_0x58db93[_0x89de('0x55')]):'null');return respondWithRpcPromise('RejectMessage',_0x89de('0x8d'),_0x504db6);}return null;})['then'](function(_0x58109a){if(_0x58109a){_0x58109a['message'][_0x89de('0x85')]=util[_0x89de('0x74')]('SIP/%s',_0x58db93['user'][_0x89de('0x34')]);_0x58109a[_0x89de('0x2a')]['channel']=_0x504db6[_0x89de('0x86')];_0x58109a['message'][_0x89de('0x87')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x89de('0x8e'),'message':_0x58109a[_0x89de('0x2a')]},client9002);return _0x504db6;}return null;})[_0x89de('0x22')](respondWithResult(_0x5d333b,null))[_0x89de('0x51')](handleError(_0x5d333b,null));};exports['download']=function(_0x14be56,_0x3c24d5){var _0x2fa8e0=moment()[_0x89de('0x8f')]()[_0x89de('0x90')]();var _0x43369e=path[_0x89de('0x6d')](config[_0x89de('0x6e')],_0x89de('0x91'),'files',_0x89de('0x92'));var _0x1e9c4b=path['join'](config[_0x89de('0x6e')],_0x89de('0x91'),'files',_0x89de('0x6c'));var _0x39ea94=util[_0x89de('0x74')](_0x89de('0x93'),_0x2fa8e0);return db['MailMessage'][_0x89de('0x56')]({'where':{'id':_0x14be56[_0x89de('0x53')]['id']},'attributes':['id','body',_0x89de('0x94'),'to','cc','bcc','subject',_0x89de('0x95')],'include':_0x14be56['query'][_0x89de('0x6c')]?[{'model':db[_0x89de('0x96')],'as':_0x89de('0x97')}]:undefined})[_0x89de('0x22')](handleEntityNotFound(_0x3c24d5,null))[_0x89de('0x22')](function(_0x6dd3a8){if(_0x6dd3a8){var _0x2a65e8=_0x6dd3a8;var _0x30e49e={'from':_0x2a65e8[_0x89de('0x94')],'to':_0x2a65e8['to'],'subject':_0x2a65e8['subject'],'html':_0x2a65e8[_0x89de('0x55')],'headers':{'Date':moment(_0x2a65e8[_0x89de('0x95')])[_0x89de('0x74')](_0x89de('0x98'))},'attachments':[]};if(_0x6dd3a8['cc']){_0x30e49e[_0x89de('0x99')]['Cc']=_0x6dd3a8['cc'];}if(_0x6dd3a8[_0x89de('0x9a')]){_0x30e49e[_0x89de('0x99')][_0x89de('0x9b')]=_0x6dd3a8[_0x89de('0x9a')];}return new BPromise(function(_0x249687,_0x4c1c66){if(_0x6dd3a8[_0x89de('0x97')]){for(var _0x5f17c4=0x0;_0x5f17c4<_0x6dd3a8[_0x89de('0x97')][_0x89de('0x54')];_0x5f17c4++){var _0x1259aa=_0x6dd3a8[_0x89de('0x97')][_0x5f17c4];var _0x3bdbb0=path[_0x89de('0x6d')](_0x1e9c4b,_0x1259aa[_0x89de('0x6f')]);if(fs[_0x89de('0x9c')](_0x3bdbb0)){_0x30e49e[_0x89de('0x6c')][_0x89de('0x9d')]({'name':_0x1259aa[_0x89de('0x34')],'contentType':_0x1259aa[_0x89de('0x3b')],'data':fs[_0x89de('0x9e')](_0x3bdbb0)});}}}emlformat['build'](_0x30e49e,function(_0xd3c115,_0x5cf29b){if(_0xd3c115)return _0x4c1c66(_0xd3c115);fs[_0x89de('0x9f')](path[_0x89de('0x6d')](_0x43369e,_0x39ea94),_0x5cf29b);return _0x249687(_0x5cf29b);});});}})[_0x89de('0x22')](function(_0x1e5e82){if(_0x1e5e82){return _0x3c24d5[_0x89de('0xa0')](path[_0x89de('0x6d')](_0x43369e,_0x39ea94),_0x39ea94,function(_0xcd30ce){if(_0xcd30ce){console[_0x89de('0xa1')](_0x89de('0xa2'),_0xcd30ce);}else{fs[_0x89de('0xa3')](path[_0x89de('0x6d')](_0x43369e,_0x39ea94));}});}})['catch'](handleError(_0x3c24d5,null));}; \ No newline at end of file +var _0xa734=['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','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','pass','attachments','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','root','server','files','tmp','join','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket'];(function(_0x502feb,_0x48ce4a){var _0x1b995d=function(_0x1e1ddb){while(--_0x1e1ddb){_0x502feb['push'](_0x502feb['shift']());}};_0x1b995d(++_0x48ce4a);}(_0xa734,0x1ee));var _0x4a73=function(_0x40eb74,_0x3d9d63){_0x40eb74=_0x40eb74-0x0;var _0x58fe14=_0xa734[_0x40eb74];return _0x58fe14;};'use strict';var pdf=require(_0x4a73('0x0'));var emlformat=require(_0x4a73('0x1'));var rimraf=require(_0x4a73('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a73('0x3'));var rp=require('request-promise');var moment=require(_0x4a73('0x4'));var BPromise=require(_0x4a73('0x5'));var Mustache=require(_0x4a73('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4a73('0x7'));var csv=require('to-csv');var ejs=require(_0x4a73('0x8'));var fs=require('fs');var _=require(_0x4a73('0x9'));var squel=require('squel');var crypto=require(_0x4a73('0xa'));var jsforce=require(_0x4a73('0xb'));var deskjs=require(_0x4a73('0xc'));var toCsv=require(_0x4a73('0xd'));var querystring=require(_0x4a73('0xe'));var Papa=require(_0x4a73('0xf'));var Redis=require('ioredis');var authService=require(_0x4a73('0x10'));var qs=require(_0x4a73('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a73('0x12'));var logger=require(_0x4a73('0x13'))('api');var utils=require(_0x4a73('0x14'));var config=require(_0x4a73('0x15'));var licenseUtil=require(_0x4a73('0x16'));var db=require(_0x4a73('0x17'))['db'];config[_0x4a73('0x18')]=_['defaults'](config[_0x4a73('0x18')],{'host':_0x4a73('0x19'),'port':0x18eb});var socket=require(_0x4a73('0x1a'))(new Redis(config[_0x4a73('0x18')]));require(_0x4a73('0x1b'))[_0x4a73('0x1c')](socket);var jayson=require(_0x4a73('0x1d'));var client=jayson[_0x4a73('0x1e')][_0x4a73('0x1f')]({'port':0x232c});var client9003=jayson[_0x4a73('0x1e')][_0x4a73('0x1f')]({'port':0x232b});var client9002=jayson['client'][_0x4a73('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5dade6,_0x6a9919,_0x5e1683,_0x1095ee){return new BPromise(function(_0xe97885,_0x48ec04){var _0x5e8893=_0x1095ee||client;return _0x5e8893[_0x4a73('0x20')](_0x5dade6,_0x5e1683)[_0x4a73('0x21')](function(_0x2cfea1){logger[_0x4a73('0x22')](_0x4a73('0x23'),_0x6a9919,_0x4a73('0x24'));logger[_0x4a73('0x25')](_0x4a73('0x26'),_0x6a9919,_0x4a73('0x24'),JSON[_0x4a73('0x27')](_0x2cfea1));if(_0x2cfea1[_0x4a73('0x28')]){if(_0x2cfea1[_0x4a73('0x28')]['code']===0x1f4){logger['error'](_0x4a73('0x23'),_0x6a9919,_0x2cfea1[_0x4a73('0x28')][_0x4a73('0x29')]);return _0x48ec04(_0x2cfea1[_0x4a73('0x28')][_0x4a73('0x29')]);}logger[_0x4a73('0x28')](_0x4a73('0x23'),_0x6a9919,_0x2cfea1[_0x4a73('0x28')][_0x4a73('0x29')]);return _0xe97885(_0x2cfea1[_0x4a73('0x28')]['message']);}else{logger['info'](_0x4a73('0x23'),_0x6a9919,_0x4a73('0x24'));_0xe97885(_0x2cfea1[_0x4a73('0x2a')][_0x4a73('0x29')]);}})[_0x4a73('0x2b')](function(_0x149a9b){logger[_0x4a73('0x28')](_0x4a73('0x23'),_0x6a9919,_0x149a9b);_0x48ec04(_0x149a9b);});});}function respondWithStatusCode(_0x47ce64,_0xfa34b7){_0xfa34b7=_0xfa34b7||0xcc;return function(_0x5c0b25){if(_0x5c0b25){return _0x47ce64['sendStatus'](_0xfa34b7);}return _0x47ce64[_0x4a73('0x2c')](_0xfa34b7)[_0x4a73('0x2d')]();};}function respondWithResult(_0x4ce815,_0x5bb375){_0x5bb375=_0x5bb375||0xc8;return function(_0x146456){if(_0x146456){return _0x4ce815[_0x4a73('0x2c')](_0x5bb375)[_0x4a73('0x2e')](_0x146456);}};}function respondWithFilteredResult(_0x5a5533,_0x1a032f){return function(_0x1252b9){if(_0x1252b9){var _0x19b5d7=_0x1252b9[_0x4a73('0x2f')],_0x31da0b=_0x1a032f[_0x4a73('0x30')],_0x4b6a02=_0x1a032f[_0x4a73('0x30')]+_0x1a032f[_0x4a73('0x31')],_0x477f30;if(_0x4b6a02>=_0x19b5d7){_0x4b6a02=_0x19b5d7;_0x477f30=0xc8;}else{_0x477f30=0xce;}_0x5a5533[_0x4a73('0x2c')](_0x477f30);return _0x5a5533[_0x4a73('0x32')](_0x4a73('0x33'),_0x31da0b+'-'+_0x4b6a02+'/'+_0x19b5d7)[_0x4a73('0x2e')](_0x1252b9);}return null;};}function patchUpdates(_0xe30ab0){return function(_0x10e2d1){try{jsonpatch[_0x4a73('0x34')](_0x10e2d1,_0xe30ab0,!![]);}catch(_0x5616f4){return BPromise[_0x4a73('0x35')](_0x5616f4);}return _0x10e2d1[_0x4a73('0x36')]();};}function saveUpdates(_0x20221f,_0xf940c2){return function(_0x40b1f3){if(_0x40b1f3){return _0x40b1f3[_0x4a73('0x37')](_0x20221f)['then'](function(_0x17778d){return _0x17778d;});}return null;};}function removeEntity(_0x334c17,_0x2d9eaf){return function(_0x3f3af9){if(_0x3f3af9){return _0x3f3af9[_0x4a73('0x38')]()[_0x4a73('0x21')](function(){_0x334c17[_0x4a73('0x2c')](0xcc)[_0x4a73('0x2d')]();});}};}function handleEntityNotFound(_0x2b11bb,_0x184dbf){return function(_0x491621){if(!_0x491621){_0x2b11bb['sendStatus'](0x194);}return _0x491621;};}function handleError(_0xd4902e,_0x58c54d){_0x58c54d=_0x58c54d||0x1f4;return function(_0x326b64){logger[_0x4a73('0x28')](_0x326b64['stack']);if(_0x326b64[_0x4a73('0x39')]){delete _0x326b64[_0x4a73('0x39')];}_0xd4902e[_0x4a73('0x2c')](_0x58c54d)['send'](_0x326b64);};}exports[_0x4a73('0x3a')]=function(_0x4b645d,_0x28182e){var _0x1512bd={},_0x5b8dd6={},_0x1d7d6f={'count':0x0,'rows':[]};var _0x2fdb11=_[_0x4a73('0x3b')](db['MailMessage'][_0x4a73('0x3c')],function(_0xb1f435){return{'name':_0xb1f435[_0x4a73('0x3d')],'type':_0xb1f435[_0x4a73('0x3e')][_0x4a73('0x3f')]};});_0x5b8dd6[_0x4a73('0x40')]=_[_0x4a73('0x3b')](_0x2fdb11,'name');_0x5b8dd6['query']=_[_0x4a73('0x41')](_0x4b645d[_0x4a73('0x42')]);_0x5b8dd6[_0x4a73('0x43')]=_[_0x4a73('0x44')](_0x5b8dd6[_0x4a73('0x40')],_0x5b8dd6[_0x4a73('0x42')]);_0x1512bd['attributes']=_[_0x4a73('0x44')](_0x5b8dd6[_0x4a73('0x40')],qs[_0x4a73('0x45')](_0x4b645d[_0x4a73('0x42')][_0x4a73('0x45')]));_0x1512bd[_0x4a73('0x46')]=_0x1512bd[_0x4a73('0x46')][_0x4a73('0x47')]?_0x1512bd[_0x4a73('0x46')]:_0x5b8dd6[_0x4a73('0x40')];if(!_0x4b645d[_0x4a73('0x42')][_0x4a73('0x48')](_0x4a73('0x49'))){_0x1512bd[_0x4a73('0x31')]=qs[_0x4a73('0x31')](_0x4b645d[_0x4a73('0x42')][_0x4a73('0x31')]);_0x1512bd['offset']=qs[_0x4a73('0x30')](_0x4b645d['query']['offset']);}_0x1512bd[_0x4a73('0x4a')]=qs[_0x4a73('0x4b')](_0x4b645d[_0x4a73('0x42')]['sort']);_0x1512bd[_0x4a73('0x4c')]=qs['filters'](_[_0x4a73('0x4d')](_0x4b645d[_0x4a73('0x42')],_0x5b8dd6['filters']),_0x2fdb11);if(_0x4b645d['query'][_0x4a73('0x4e')]){_0x1512bd[_0x4a73('0x4c')]=_[_0x4a73('0x4f')](_0x1512bd[_0x4a73('0x4c')],{'$or':_[_0x4a73('0x3b')](_0x2fdb11,function(_0x33e498){if(_0x33e498[_0x4a73('0x3e')]!==_0x4a73('0x50')){var _0x5760e7={};_0x5760e7[_0x33e498['name']]={'$like':'%'+_0x4b645d[_0x4a73('0x42')]['filter']+'%'};return _0x5760e7;}})});}_0x1512bd=_[_0x4a73('0x4f')]({},_0x1512bd,_0x4b645d[_0x4a73('0x51')]);var _0x3ea35f={'where':_0x1512bd[_0x4a73('0x4c')]};return db[_0x4a73('0x52')][_0x4a73('0x2f')](_0x3ea35f)[_0x4a73('0x21')](function(_0x1db27a){_0x1d7d6f[_0x4a73('0x2f')]=_0x1db27a;if(_0x4b645d[_0x4a73('0x42')][_0x4a73('0x53')]){_0x1512bd[_0x4a73('0x54')]=[{'all':!![]}];}return db[_0x4a73('0x52')][_0x4a73('0x55')](_0x1512bd);})[_0x4a73('0x21')](function(_0x2159bc){_0x1d7d6f['rows']=_0x2159bc;return _0x1d7d6f;})[_0x4a73('0x21')](respondWithFilteredResult(_0x28182e,_0x1512bd))[_0x4a73('0x2b')](handleError(_0x28182e,null));};exports[_0x4a73('0x56')]=function(_0x2ec7d1,_0x5f0e4f){var _0xe6a0c6={'raw':!![],'where':{'id':_0x2ec7d1[_0x4a73('0x57')]['id']}},_0xdb28eb={};_0xdb28eb[_0x4a73('0x40')]=_[_0x4a73('0x41')](db[_0x4a73('0x52')][_0x4a73('0x3c')]);_0xdb28eb[_0x4a73('0x42')]=_[_0x4a73('0x41')](_0x2ec7d1[_0x4a73('0x42')]);_0xdb28eb[_0x4a73('0x43')]=_[_0x4a73('0x44')](_0xdb28eb[_0x4a73('0x40')],_0xdb28eb[_0x4a73('0x42')]);_0xe6a0c6[_0x4a73('0x46')]=_[_0x4a73('0x44')](_0xdb28eb[_0x4a73('0x40')],qs['fields'](_0x2ec7d1[_0x4a73('0x42')][_0x4a73('0x45')]));_0xe6a0c6[_0x4a73('0x46')]=_0xe6a0c6[_0x4a73('0x46')]['length']?_0xe6a0c6[_0x4a73('0x46')]:_0xdb28eb[_0x4a73('0x40')];if(_0x2ec7d1[_0x4a73('0x42')]['includeAll']){_0xe6a0c6['include']=[{'all':!![]}];}_0xe6a0c6=_[_0x4a73('0x4f')]({},_0xe6a0c6,_0x2ec7d1[_0x4a73('0x51')]);return db[_0x4a73('0x52')][_0x4a73('0x58')](_0xe6a0c6)[_0x4a73('0x21')](handleEntityNotFound(_0x5f0e4f,null))[_0x4a73('0x21')](respondWithResult(_0x5f0e4f,null))[_0x4a73('0x2b')](handleError(_0x5f0e4f,null));};exports[_0x4a73('0x37')]=function(_0x151274,_0x1e66ff){if(_0x151274[_0x4a73('0x59')]['id']){delete _0x151274['body']['id'];}return db[_0x4a73('0x52')]['find']({'where':{'id':_0x151274[_0x4a73('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e66ff,null))[_0x4a73('0x21')](saveUpdates(_0x151274[_0x4a73('0x59')],null))[_0x4a73('0x21')](respondWithResult(_0x1e66ff,null))[_0x4a73('0x2b')](handleError(_0x1e66ff,null));};exports[_0x4a73('0x38')]=function(_0x1912f4,_0x4de782){return db[_0x4a73('0x52')][_0x4a73('0x58')]({'where':{'id':_0x1912f4['params']['id']}})[_0x4a73('0x21')](handleEntityNotFound(_0x4de782,null))[_0x4a73('0x21')](removeEntity(_0x4de782,null))[_0x4a73('0x2b')](handleError(_0x4de782,null));};exports[_0x4a73('0x5a')]=function(_0x1a70fe,_0x3014dc){return db[_0x4a73('0x52')][_0x4a73('0x5a')]()['then'](respondWithResult(_0x3014dc,null))[_0x4a73('0x2b')](handleError(_0x3014dc,null));};exports[_0x4a73('0x5b')]=function(_0x436df2,_0x302711){return db[_0x4a73('0x52')]['create'](_0x436df2[_0x4a73('0x59')])[_0x4a73('0x21')](function(_0xc03783){if(_0xc03783){if(_0xc03783[_0x4a73('0x5c')]===_0x4a73('0x5d')&&!_0xc03783[_0x4a73('0x5e')]){var _0xe7f5ce,_0x405fd3,_0x2bc32e;if(_0x436df2['body']['to']){_0x405fd3=_0x436df2['body']['to'][_0x4a73('0x5f')](',')[0x0];}return db[_0x4a73('0x60')]['findOne']({'where':{'id':_0xc03783[_0x4a73('0x61')]},'include':[{'model':db[_0x4a73('0x62')],'as':'List','include':[{'model':db[_0x4a73('0x63')],'as':_0x4a73('0x64'),'where':{'email':_0x405fd3},'limit':0x1,'order':[['updatedAt',_0x4a73('0x65')]]}]},{'model':db[_0x4a73('0x66')],'as':_0x4a73('0x67'),'raw':!![]}]})[_0x4a73('0x21')](function(_0x36c105){_0xe7f5ce=_0x36c105;if(_0xe7f5ce&&_0xe7f5ce[_0x4a73('0x67')]){var _0x56089d={'tls':{'rejectUnauthorized':![]}};if(_[_0x4a73('0x68')](_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x69')])){_0x56089d[_0x4a73('0x6a')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6a')];_0x56089d[_0x4a73('0x6b')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6b')];_0x56089d[_0x4a73('0x6c')]=_0xe7f5ce[_0x4a73('0x67')]['secure'];if(_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6d')]){_0x56089d['auth']={'user':_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6e')],'pass':_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6f')]};}}else{_0x56089d[_0x4a73('0x69')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x69')];_0x56089d['auth']={'user':_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6e')],'pass':_0xe7f5ce['Smtp']['pass']};_0x56089d[_0x4a73('0x6c')]=_0xe7f5ce[_0x4a73('0x67')][_0x4a73('0x6c')];}if(_0x436df2[_0x4a73('0x59')][_0x4a73('0x70')]&&_0x436df2['body'][_0x4a73('0x70')][_0x4a73('0x47')]){for(var _0x2ea599=0x0;_0x2ea599<_0x436df2[_0x4a73('0x59')]['attachments'][_0x4a73('0x47')];_0x2ea599+=0x1){_0x436df2[_0x4a73('0x59')]['attachments'][_0x2ea599]={'filename':_0x436df2[_0x4a73('0x59')][_0x4a73('0x70')][_0x2ea599][_0x4a73('0x39')],'path':path['join'](config['root'],_0x4a73('0x71'),_0x436df2[_0x4a73('0x59')][_0x4a73('0x70')][_0x2ea599][_0x4a73('0x72')])};}}_0x2bc32e={'account':_0x56089d,'message':_0x436df2['body']};return;}})[_0x4a73('0x21')](function(){if(_0xe7f5ce[_0x4a73('0x73')]){if(_0xe7f5ce[_0x4a73('0x73')][_0x4a73('0x64')]['length']){return _0xe7f5ce['List'][_0x4a73('0x64')][0x0];}else{return db[_0x4a73('0x63')][_0x4a73('0x5b')](_['defaults'](_0x436df2['body'],{'firstName':_0x436df2[_0x4a73('0x59')]['to'],'email':_0x436df2[_0x4a73('0x59')]['to'],'phone':_0x436df2['body']['to'],'ListId':_0xe7f5ce[_0x4a73('0x74')]}));}}else{throw new Error(_0x4a73('0x75'));}})[_0x4a73('0x21')](function(){if(_0x2bc32e){return respondWithRpcPromise(_0x4a73('0x76'),_0x4a73('0x77'),_0x2bc32e,client9003)[_0x4a73('0x21')](function(_0x1a7416){return _0xc03783[_0x4a73('0x37')]({'read':!![],'messageId':_0x1a7416[_0x4a73('0x78')],'sentAt':moment()[_0x4a73('0x79')](_0x4a73('0x7a'))});})[_0x4a73('0x2b')](function(_0x45a179){logger[_0x4a73('0x28')]('%s',JSON[_0x4a73('0x27')](_0x45a179));return _0xc03783;});}return _0xc03783;});}return _0xc03783;}})[_0x4a73('0x21')](respondWithResult(_0x302711,0xc9))['catch'](handleError(_0x302711,null));};var interaction_log=require('../../config/logger')(_0x4a73('0x7b'));exports[_0x4a73('0x7c')]=function(_0x324103,_0x1bb2f1,_0xc61ba8){var _0x50a6c0={'channel':'mail'};if(_0x324103[_0x4a73('0x59')]['id']){delete _0x324103['body']['id'];}_0x324103[_0x4a73('0x59')][_0x4a73('0x7d')]=!![];_0x324103['body'][_0x4a73('0x7e')]=moment()[_0x4a73('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x324103['body'][_0x4a73('0x7f')]=_0x324103[_0x4a73('0x59')][_0x4a73('0x7f')]||_0x324103[_0x4a73('0x6e')]['id'];return db[_0x4a73('0x52')][_0x4a73('0x58')]({'where':{'id':_0x324103[_0x4a73('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4a73('0x80')}]})[_0x4a73('0x21')](handleEntityNotFound(_0x1bb2f1,null))[_0x4a73('0x21')](saveUpdates(_0x324103['body'],null))[_0x4a73('0x21')](function(_0x10b66b){if(_0x10b66b){_0x50a6c0[_0x4a73('0x29')]=_0x10b66b[_0x4a73('0x81')]({'plain':!![]});return db[_0x4a73('0x82')][_0x4a73('0x58')]({'where':{'id':_0x10b66b[_0x4a73('0x83')]}});}return null;})[_0x4a73('0x21')](handleEntityNotFound(_0x1bb2f1,null))[_0x4a73('0x21')](function(_0x52e68e){if(_0x52e68e){return _0x52e68e[_0x4a73('0x37')]({'UserId':_0x324103[_0x4a73('0x59')][_0x4a73('0x7f')],'read1stAt':_[_0x4a73('0x68')](_0x52e68e['read1stAt'])?moment()[_0x4a73('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x371438){if(_0x371438){_0x50a6c0[_0x4a73('0x84')]=_0x371438[_0x4a73('0x81')]({'plain':!![]});interaction_log[_0x4a73('0x22')](_0x4a73('0x85'),_0x324103[_0x4a73('0x6e')]['id'],_0x324103[_0x4a73('0x6e')]['name'],_0x324103['user'][_0x4a73('0x86')],_0x50a6c0[_0x4a73('0x84')]['id'],_0x324103['body']?JSON[_0x4a73('0x27')](_0x324103['body']):_0x4a73('0x87'));return respondWithRpcPromise(_0x4a73('0x88'),'acceptMessage',_0x50a6c0);}return null;})['then'](function(_0x5f43fc){if(_0x5f43fc){if(_0x324103[_0x4a73('0x59')]['manual']){_0x50a6c0['message'][_0x4a73('0x89')]=util['format'](_0x4a73('0x8a'),_0x324103[_0x4a73('0x6e')][_0x4a73('0x39')]);_0x50a6c0['message'][_0x4a73('0x8b')]=_0x50a6c0[_0x4a73('0x8b')];_0x50a6c0[_0x4a73('0x29')][_0x4a73('0x8c')]=_0x4a73('0x7c');return respondWithRpcPromise('EventManager',_0x4a73('0x8d'),{'event':_0x4a73('0x8e'),'message':_0x50a6c0[_0x4a73('0x29')]},client9002)['then'](function(){return _0x50a6c0;});}return _0x50a6c0;}return null;})[_0x4a73('0x21')](respondWithResult(_0x1bb2f1,null))[_0x4a73('0x2b')](handleError(_0x1bb2f1,null));};var interaction_log=require(_0x4a73('0x13'))(_0x4a73('0x7b'));exports['reject']=function(_0x1e6846,_0x468bcb,_0x42e181){var _0xdbb169={'agent':{},'channel':_0x4a73('0x8f')};if(_0x1e6846[_0x4a73('0x59')]['id']){delete _0x1e6846[_0x4a73('0x59')]['id'];}_0x1e6846['body'][_0x4a73('0x7f')]=_0x1e6846[_0x4a73('0x59')]['UserId']||_0x1e6846[_0x4a73('0x6e')]['id'];_0xdbb169[_0x4a73('0x90')]['id']=_0x1e6846[_0x4a73('0x59')][_0x4a73('0x7f')];return db[_0x4a73('0x52')]['find']({'where':{'id':_0x1e6846['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x468bcb,null))['then'](function(_0x2f3e06){if(_0x2f3e06){_0xdbb169[_0x4a73('0x29')]=_0x2f3e06[_0x4a73('0x81')]({'plain':!![]});return db[_0x4a73('0x82')][_0x4a73('0x58')]({'where':{'id':_0x2f3e06[_0x4a73('0x83')]}});}return null;})[_0x4a73('0x21')](handleEntityNotFound(_0x468bcb,null))['then'](function(_0x3bb82f){if(_0x3bb82f){_0xdbb169[_0x4a73('0x84')]=_0x3bb82f[_0x4a73('0x81')]({'plain':!![]});interaction_log[_0x4a73('0x22')](_0x4a73('0x91'),_0x1e6846['user']['id'],_0x1e6846[_0x4a73('0x6e')][_0x4a73('0x39')],_0x1e6846[_0x4a73('0x6e')][_0x4a73('0x86')],_0xdbb169[_0x4a73('0x84')]['id'],_0x1e6846[_0x4a73('0x59')]?JSON[_0x4a73('0x27')](_0x1e6846['body']):_0x4a73('0x87'));return respondWithRpcPromise(_0x4a73('0x92'),_0x4a73('0x93'),_0xdbb169);}return null;})['then'](function(_0x261f09){if(_0x261f09){_0x261f09[_0x4a73('0x29')][_0x4a73('0x89')]=util[_0x4a73('0x79')](_0x4a73('0x8a'),_0x1e6846[_0x4a73('0x6e')][_0x4a73('0x39')]);_0x261f09[_0x4a73('0x29')]['channel']=_0xdbb169['channel'];_0x261f09[_0x4a73('0x29')][_0x4a73('0x8c')]='reject';respondWithRpcPromise('EventManager',_0x4a73('0x8d'),{'event':_0x4a73('0x94'),'message':_0x261f09[_0x4a73('0x29')]},client9002);return _0xdbb169;}return null;})['then'](respondWithResult(_0x468bcb,null))[_0x4a73('0x2b')](handleError(_0x468bcb,null));};exports[_0x4a73('0x95')]=function(_0x4b2955,_0x32c4cf){var _0x51708c=moment()[_0x4a73('0x96')]()[_0x4a73('0x97')]();var _0x585dd3=path['join'](config[_0x4a73('0x98')],_0x4a73('0x99'),_0x4a73('0x9a'),_0x4a73('0x9b'));var _0x70d597=path[_0x4a73('0x9c')](config['root'],_0x4a73('0x99'),_0x4a73('0x9a'),_0x4a73('0x70'));var _0x14c272=util[_0x4a73('0x79')](_0x4a73('0x9d'),_0x51708c);return db[_0x4a73('0x52')]['find']({'where':{'id':_0x4b2955[_0x4a73('0x57')]['id']},'attributes':['id','body','from','to','cc',_0x4a73('0x9e'),_0x4a73('0x9f'),_0x4a73('0xa0')],'include':_0x4b2955[_0x4a73('0x42')][_0x4a73('0x70')]?[{'model':db[_0x4a73('0xa1')],'as':'Attachments'}]:undefined})[_0x4a73('0x21')](handleEntityNotFound(_0x32c4cf,null))[_0x4a73('0x21')](function(_0x247974){if(_0x247974){var _0x36b78a=_0x247974;var _0x3a4d98={'from':_0x36b78a[_0x4a73('0xa2')],'to':_0x36b78a['to'],'subject':_0x36b78a[_0x4a73('0x9f')],'html':_0x36b78a[_0x4a73('0x59')],'headers':{'Date':moment(_0x36b78a[_0x4a73('0xa0')])[_0x4a73('0x79')](_0x4a73('0xa3'))},'attachments':[]};if(_0x247974['cc']){_0x3a4d98[_0x4a73('0xa4')]['Cc']=_0x247974['cc'];}if(_0x247974[_0x4a73('0x9e')]){_0x3a4d98[_0x4a73('0xa4')][_0x4a73('0xa5')]=_0x247974[_0x4a73('0x9e')];}return new BPromise(function(_0x727ec4,_0x30e628){if(_0x247974[_0x4a73('0xa6')]){for(var _0x148840=0x0;_0x148840<_0x247974['Attachments'][_0x4a73('0x47')];_0x148840++){var _0x419651=_0x247974[_0x4a73('0xa6')][_0x148840];var _0x5ddce4=path[_0x4a73('0x9c')](_0x70d597,_0x419651['basename']);if(fs[_0x4a73('0xa7')](_0x5ddce4)){_0x3a4d98['attachments'][_0x4a73('0xa8')]({'name':_0x419651[_0x4a73('0x39')],'contentType':_0x419651['type'],'data':fs[_0x4a73('0xa9')](_0x5ddce4)});}}}emlformat[_0x4a73('0xaa')](_0x3a4d98,function(_0x1a634d,_0x3d1110){if(_0x1a634d)return _0x30e628(_0x1a634d);fs['writeFileSync'](path[_0x4a73('0x9c')](_0x585dd3,_0x14c272),_0x3d1110);return _0x727ec4(_0x3d1110);});});}})[_0x4a73('0x21')](function(_0x3f6270){if(_0x3f6270){return _0x32c4cf[_0x4a73('0x95')](path[_0x4a73('0x9c')](_0x585dd3,_0x14c272),_0x14c272,function(_0x400e1e){if(_0x400e1e){console[_0x4a73('0xab')](_0x4a73('0xac'),_0x400e1e);}else{fs[_0x4a73('0xad')](path[_0x4a73('0x9c')](_0x585dd3,_0x14c272));}});}})[_0x4a73('0x2b')](handleError(_0x32c4cf,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 90e3728..d947d9e 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 _0x65a9=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1c69f0,_0x1b1385){var _0x437044=function(_0x4da23d){while(--_0x4da23d){_0x1c69f0['push'](_0x1c69f0['shift']());}};_0x437044(++_0x1b1385);}(_0x65a9,0x1b5));var _0x965a=function(_0x315aca,_0x2e0efc){_0x315aca=_0x315aca-0x0;var _0x5ab262=_0x65a9[_0x315aca];return _0x5ab262;};'use strict';var EventEmitter=require(_0x965a('0x0'));var MailMessage=require(_0x965a('0x1'))['db'][_0x965a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x965a('0x3')](0x0);var events={'afterCreate':_0x965a('0x4'),'afterUpdate':_0x965a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5c33bc){return function(_0x42a00d,_0x5f1c09,_0x2a239f){MailMessageEvents[_0x965a('0x6')](_0x5c33bc+':'+_0x42a00d['id'],_0x42a00d);MailMessageEvents[_0x965a('0x6')](_0x5c33bc,_0x42a00d);_0x2a239f(null);};}for(var e in events){if(events[_0x965a('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x965a('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x8e46=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x15790f,_0x3dd5a8){var _0x30f02d=function(_0x172114){while(--_0x172114){_0x15790f['push'](_0x15790f['shift']());}};_0x30f02d(++_0x3dd5a8);}(_0x8e46,0x1eb));var _0x68e4=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x8e46[_0x2f2360];return _0x1cc8d3;};'use strict';var EventEmitter=require(_0x68e4('0x0'));var MailMessage=require(_0x68e4('0x1'))['db'][_0x68e4('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x68e4('0x3')](0x0);var events={'afterCreate':_0x68e4('0x4'),'afterUpdate':'update','afterDestroy':_0x68e4('0x5')};function emitEvent(_0xfe149){return function(_0x57aa10,_0x3c7b19,_0x1063ff){MailMessageEvents[_0x68e4('0x6')](_0xfe149+':'+_0x57aa10['id'],_0x57aa10);MailMessageEvents[_0x68e4('0x6')](_0xfe149,_0x57aa10);_0x1063ff(null);};}for(var e in events){if(events[_0x68e4('0x7')](e)){var event=events[e];MailMessage[_0x68e4('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 99c0551..00d074f 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 _0x90c6=['../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','findOne','MailInteractionId','then','update','catch','error','utf8mb4','lodash'];(function(_0x2e767e,_0x591c30){var _0x539d6c=function(_0x1122fc){while(--_0x1122fc){_0x2e767e['push'](_0x2e767e['shift']());}};_0x539d6c(++_0x591c30);}(_0x90c6,0xa9));var _0x690c=function(_0x51777b,_0x5ec89b){_0x51777b=_0x51777b-0x0;var _0x4b0e5d=_0x90c6[_0x51777b];return _0x4b0e5d;};'use strict';var _=require(_0x690c('0x0'));var util=require('util');var logger=require(_0x690c('0x1'))(_0x690c('0x2'));var moment=require(_0x690c('0x3'));var BPromise=require(_0x690c('0x4'));var rp=require(_0x690c('0x5'));var htmlToText=require(_0x690c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x690c('0x7'));var config=require(_0x690c('0x8'));var attributes=require(_0x690c('0x9'));module[_0x690c('0xa')]=function(_0x2ae017,_0x458f71){return _0x2ae017[_0x690c('0xb')](_0x690c('0xc'),attributes,{'tableName':_0x690c('0xd'),'paranoid':![],'indexes':[{'name':_0x690c('0xe'),'fields':[_0x690c('0xe')]},{'name':_0x690c('0xf'),'fields':[_0x690c('0x10'),_0x690c('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38b342,_0x492ab5,_0xcea4b3){if(_0x38b342[_0x690c('0x12')]){_0x38b342[_0x690c('0x10')]=htmlToText[_0x690c('0x13')](_0x38b342[_0x690c('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xcea4b3(null,_0x492ab5);},'afterCreate':function(_0xd30c35,_0x37be43,_0x20f346){var _0x426ee3=_0x2ae017[_0x690c('0x14')];var _0x2d6e83=_0xd30c35[_0x690c('0x15')]({'plain':!![]});if(_0x2d6e83[_0x690c('0x16')][_0x690c('0x17')]()==='in'||_0x2d6e83[_0x690c('0x16')][_0x690c('0x17')]()===_0x690c('0x18')&&!_0x2d6e83[_0x690c('0x19')]&&!_[_0x690c('0x1a')](_0x2d6e83['UserId'])){_0x426ee3['MailInteraction'][_0x690c('0x1b')]({'where':{'id':_0x2d6e83[_0x690c('0x1c')]}})[_0x690c('0x1d')](function(_0x2857c8){if(_0x2857c8){_0x2857c8[_0x690c('0x1e')]({'lastMsgAt':_0x2d6e83['createdAt'],'lastMsgDirection':_0x2d6e83[_0x690c('0x16')]['toLowerCase'](),'lastMsgBody':_0x2d6e83['body']});}})[_0x690c('0x1f')](function(_0x75d674){console[_0x690c('0x20')](_0x75d674);});}_0x20f346();}},'charset':_0x690c('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6972=['error','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','MailInteraction','findOne','then','createdAt','catch'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0x6972,0xbc));var _0x2697=function(_0x3ebee6,_0xd74793){_0x3ebee6=_0x3ebee6-0x0;var _0x32fc02=_0x6972[_0x3ebee6];return _0x32fc02;};'use strict';var _=require(_0x2697('0x0'));var util=require('util');var logger=require(_0x2697('0x1'))('api');var moment=require(_0x2697('0x2'));var BPromise=require(_0x2697('0x3'));var rp=require('request-promise');var htmlToText=require(_0x2697('0x4'));var fs=require('fs');var path=require(_0x2697('0x5'));var rimraf=require(_0x2697('0x6'));var config=require('../../config/environment');var attributes=require(_0x2697('0x7'));module[_0x2697('0x8')]=function(_0x569188,_0x35bd1b){return _0x569188[_0x2697('0x9')](_0x2697('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x2697('0xb'),'fields':['messageId']},{'name':_0x2697('0xc'),'fields':[_0x2697('0xd'),_0x2697('0xe')],'type':_0x2697('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e96ba,_0x2cd945,_0x25dec3){if(_0x2e96ba['body']){_0x2e96ba[_0x2697('0xd')]=htmlToText[_0x2697('0x10')](_0x2e96ba[_0x2697('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x25dec3(null,_0x2cd945);},'afterCreate':function(_0x90e601,_0x1531b5,_0x1ad6b5){var _0x5e8e25=_0x569188[_0x2697('0x12')];var _0x43eaee=_0x90e601[_0x2697('0x13')]({'plain':!![]});if(_0x43eaee[_0x2697('0x14')][_0x2697('0x15')]()==='in'||_0x43eaee[_0x2697('0x14')][_0x2697('0x15')]()===_0x2697('0x16')&&!_0x43eaee[_0x2697('0x17')]&&!_['isNil'](_0x43eaee['UserId'])){_0x5e8e25[_0x2697('0x18')][_0x2697('0x19')]({'where':{'id':_0x43eaee['MailInteractionId']}})[_0x2697('0x1a')](function(_0x2beca4){if(_0x2beca4){_0x2beca4['update']({'lastMsgAt':_0x43eaee[_0x2697('0x1b')],'lastMsgDirection':_0x43eaee[_0x2697('0x14')][_0x2697('0x15')](),'lastMsgBody':_0x43eaee['body']});}})[_0x2697('0x1c')](function(_0x46fc4a){console[_0x2697('0x1d')](_0x46fc4a);});}_0x1ad6b5();}},'charset':'utf8mb4','collate':_0x2697('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c0a8611..d1692c5 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 _0xe306=['socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailMessage','create','body','options','raw','then','CreateMailMessage','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost'];(function(_0x3e2c1e,_0x1e8d40){var _0x1c6666=function(_0x190b73){while(--_0x190b73){_0x3e2c1e['push'](_0x3e2c1e['shift']());}};_0x1c6666(++_0x1e8d40);}(_0xe306,0x180));var _0x6e30=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xe306[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x6e30('0x0'));var util=require(_0x6e30('0x1'));var moment=require(_0x6e30('0x2'));var BPromise=require(_0x6e30('0x3'));var rs=require(_0x6e30('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e30('0x5'));var logger=require(_0x6e30('0x6'))('rpc');var config=require(_0x6e30('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e30('0x8')]({'port':0x232a});config[_0x6e30('0x9')]=_[_0x6e30('0xa')](config['redis'],{'host':_0x6e30('0xb'),'port':0x18eb});var socket=require(_0x6e30('0xc'))(new Redis(config[_0x6e30('0x9')]));require(_0x6e30('0xd'))[_0x6e30('0xe')](socket);function respondWithRpcPromise(_0x3719fb,_0x3bf9fd,_0x1cefa6){return new BPromise(function(_0x3b5d39,_0x10c5e4){return client[_0x6e30('0xf')](_0x3719fb,_0x1cefa6)['then'](function(_0x1d2f72){logger[_0x6e30('0x10')](_0x6e30('0x11'),_0x3bf9fd,_0x6e30('0x12'));logger['debug'](_0x6e30('0x13'),_0x3bf9fd,'request\x20sent',JSON[_0x6e30('0x14')](_0x1d2f72));if(_0x1d2f72[_0x6e30('0x15')]){if(_0x1d2f72[_0x6e30('0x15')][_0x6e30('0x16')]===0x1f4){logger['error'](_0x6e30('0x11'),_0x3bf9fd,_0x1d2f72[_0x6e30('0x15')][_0x6e30('0x17')]);return _0x10c5e4(_0x1d2f72[_0x6e30('0x15')][_0x6e30('0x17')]);}logger[_0x6e30('0x15')](_0x6e30('0x11'),_0x3bf9fd,_0x1d2f72['error'][_0x6e30('0x17')]);return _0x3b5d39(_0x1d2f72['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x3bf9fd,_0x6e30('0x12'));_0x3b5d39(_0x1d2f72['result'][_0x6e30('0x17')]);}})[_0x6e30('0x18')](function(_0x311242){logger[_0x6e30('0x15')]('MailMessage,\x20%s,\x20%s',_0x3bf9fd,_0x311242);_0x10c5e4(_0x311242);});});}exports['CreateMailMessage']=function(_0x522766){var _0x246d94=this;return new Promise(function(_0x53bc7a,_0x56838e){return db[_0x6e30('0x19')][_0x6e30('0x1a')](_0x522766[_0x6e30('0x1b')],{'raw':_0x522766[_0x6e30('0x1c')]?_0x522766[_0x6e30('0x1c')][_0x6e30('0x1d')]===undefined?!![]:![]:!![]})[_0x6e30('0x1e')](function(_0x44cfb0){logger[_0x6e30('0x10')](_0x6e30('0x1f'),_0x522766);logger[_0x6e30('0x20')]('CreateMailMessage',_0x522766,JSON[_0x6e30('0x14')](_0x44cfb0));_0x53bc7a(_0x44cfb0);})[_0x6e30('0x18')](function(_0x223aff){logger[_0x6e30('0x15')]('CreateMailMessage',_0x223aff[_0x6e30('0x17')],_0x522766);_0x56838e(_0x246d94[_0x6e30('0x15')](0x1f4,_0x223aff[_0x6e30('0x17')]));});});}; \ No newline at end of file +var _0x1c42=['result','catch','CreateMailMessage','MailMessage','create','options','raw','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x3d20d8,_0x3d873b){var _0x24d71d=function(_0x4b879c){while(--_0x4b879c){_0x3d20d8['push'](_0x3d20d8['shift']());}};_0x24d71d(++_0x3d873b);}(_0x1c42,0x13a));var _0x21c4=function(_0x4a7561,_0x40e232){_0x4a7561=_0x4a7561-0x0;var _0x30c313=_0x1c42[_0x4a7561];return _0x30c313;};'use strict';var _=require('lodash');var util=require(_0x21c4('0x0'));var moment=require(_0x21c4('0x1'));var BPromise=require(_0x21c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21c4('0x3'));var db=require(_0x21c4('0x4'))['db'];var utils=require(_0x21c4('0x5'));var logger=require(_0x21c4('0x6'))(_0x21c4('0x7'));var config=require(_0x21c4('0x8'));var jayson=require(_0x21c4('0x9'));var client=jayson[_0x21c4('0xa')]['http']({'port':0x232a});config[_0x21c4('0xb')]=_[_0x21c4('0xc')](config['redis'],{'host':_0x21c4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21c4('0xb')]));require(_0x21c4('0xe'))[_0x21c4('0xf')](socket);function respondWithRpcPromise(_0xe89bd0,_0x135282,_0x2367f1){return new BPromise(function(_0x315c30,_0x3d147a){return client[_0x21c4('0x10')](_0xe89bd0,_0x2367f1)['then'](function(_0xa58fa5){logger['info'](_0x21c4('0x11'),_0x135282,'request\x20sent');logger[_0x21c4('0x12')](_0x21c4('0x13'),_0x135282,_0x21c4('0x14'),JSON[_0x21c4('0x15')](_0xa58fa5));if(_0xa58fa5[_0x21c4('0x16')]){if(_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x17')]===0x1f4){logger[_0x21c4('0x16')](_0x21c4('0x11'),_0x135282,_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);return _0x3d147a(_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x135282,_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);return _0x315c30(_0xa58fa5[_0x21c4('0x16')][_0x21c4('0x18')]);}else{logger[_0x21c4('0x19')](_0x21c4('0x11'),_0x135282,_0x21c4('0x14'));_0x315c30(_0xa58fa5[_0x21c4('0x1a')][_0x21c4('0x18')]);}})[_0x21c4('0x1b')](function(_0x373e83){logger[_0x21c4('0x16')](_0x21c4('0x11'),_0x135282,_0x373e83);_0x3d147a(_0x373e83);});});}exports[_0x21c4('0x1c')]=function(_0x2d0bf4){var _0x3d6c5c=this;return new Promise(function(_0x529c7c,_0x4ad6ed){return db[_0x21c4('0x1d')][_0x21c4('0x1e')](_0x2d0bf4['body'],{'raw':_0x2d0bf4[_0x21c4('0x1f')]?_0x2d0bf4['options'][_0x21c4('0x20')]===undefined?!![]:![]:!![]})[_0x21c4('0x21')](function(_0x42091a){logger[_0x21c4('0x19')](_0x21c4('0x1c'),_0x2d0bf4);logger[_0x21c4('0x12')](_0x21c4('0x1c'),_0x2d0bf4,JSON[_0x21c4('0x15')](_0x42091a));_0x529c7c(_0x42091a);})[_0x21c4('0x1b')](function(_0x58c25f){logger['error'](_0x21c4('0x1c'),_0x58c25f['message'],_0x2d0bf4);_0x4ad6ed(_0x3d6c5c[_0x21c4('0x16')](0x1f4,_0x58c25f[_0x21c4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d7648f7..b47aeb5 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 _0x9874=['update','removeListener','register','length','mailMessage:','save'];(function(_0x491c3b,_0x48c956){var _0x3bdc02=function(_0x5c48de){while(--_0x5c48de){_0x491c3b['push'](_0x491c3b['shift']());}};_0x3bdc02(++_0x48c956);}(_0x9874,0x155));var _0x4987=function(_0x3dd8d3,_0x951169){_0x3dd8d3=_0x3dd8d3-0x0;var _0x37e8c6=_0x9874[_0x3dd8d3];return _0x37e8c6;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4987('0x0'),'remove',_0x4987('0x1')];function createListener(_0x10c0b8,_0x47eeb6){return function(_0x2210a6){_0x47eeb6['emit'](_0x10c0b8,_0x2210a6);};}function removeListener(_0x5c96d5,_0x1dd022){return function(){MailMessageEvents[_0x4987('0x2')](_0x5c96d5,_0x1dd022);};}exports[_0x4987('0x3')]=function(_0xf40c75){for(var _0x26f6b3=0x0,_0x55525f=events[_0x4987('0x4')];_0x26f6b3<_0x55525f;_0x26f6b3++){var _0x37f49b=events[_0x26f6b3];var _0x50f62a=createListener(_0x4987('0x5')+_0x37f49b,_0xf40c75);MailMessageEvents['on'](_0x37f49b,_0x50f62a);}}; \ No newline at end of file +var _0x749e=['length','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x28f86a,_0x5614c2){var _0x200ab8=function(_0x5dce6d){while(--_0x5dce6d){_0x28f86a['push'](_0x28f86a['shift']());}};_0x200ab8(++_0x5614c2);}(_0x749e,0x171));var _0xe749=function(_0x457f2e,_0x431c2a){_0x457f2e=_0x457f2e-0x0;var _0x2d0b8b=_0x749e[_0x457f2e];return _0x2d0b8b;};'use strict';var MailMessageEvents=require(_0xe749('0x0'));var events=[_0xe749('0x1'),_0xe749('0x2'),_0xe749('0x3')];function createListener(_0x2f7f96,_0x4c7a69){return function(_0xc1babb){_0x4c7a69[_0xe749('0x4')](_0x2f7f96,_0xc1babb);};}function removeListener(_0x1988cb,_0x13500d){return function(){MailMessageEvents[_0xe749('0x5')](_0x1988cb,_0x13500d);};}exports[_0xe749('0x6')]=function(_0x17879f){for(var _0x380a33=0x0,_0x10c39f=events[_0xe749('0x7')];_0x380a33<_0x10c39f;_0x380a33++){var _0x38e370=events[_0x380a33];var _0xf28c5f=createListener('mailMessage:'+_0x38e370,_0x17879f);MailMessageEvents['on'](_0x38e370,_0xf28c5f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9f905f7..8ec8ae0 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 _0x3437=['/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put'];(function(_0x3412ab,_0x5a2b22){var _0x37ad1d=function(_0x46ef9b){while(--_0x46ef9b){_0x3412ab['push'](_0x3412ab['shift']());}};_0x37ad1d(++_0x5a2b22);}(_0x3437,0x10a));var _0x7343=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3437[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x7343('0x0'));var util=require(_0x7343('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7343('0x2')]();var auth=require(_0x7343('0x3'));var interaction=require(_0x7343('0x4'));var config=require('../../config/environment');var controller=require(_0x7343('0x5'));router[_0x7343('0x6')]('/',auth[_0x7343('0x7')](),controller['index']);router[_0x7343('0x6')](_0x7343('0x8'),auth[_0x7343('0x7')](),controller[_0x7343('0x9')]);router[_0x7343('0x6')]('/:id',auth[_0x7343('0x7')](),controller['show']);router['get']('/:id/members',auth[_0x7343('0x7')](),controller[_0x7343('0xa')]);router[_0x7343('0x6')](_0x7343('0xb'),auth['isAuthenticated'](),controller[_0x7343('0xc')]);router[_0x7343('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x7343('0xd')]);router[_0x7343('0xe')]('/',auth[_0x7343('0x7')](),controller[_0x7343('0xf')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x7343('0x10')]);router['post'](_0x7343('0x11'),auth[_0x7343('0x7')](),controller[_0x7343('0x12')]);router[_0x7343('0x13')](_0x7343('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x7343('0x15')](_0x7343('0x14'),auth[_0x7343('0x7')](),controller[_0x7343('0x16')]);router[_0x7343('0x15')](_0x7343('0xb'),auth[_0x7343('0x7')](),controller[_0x7343('0x17')]);router[_0x7343('0x15')]('/:id/users',auth[_0x7343('0x7')](),controller[_0x7343('0x18')]);module[_0x7343('0x19')]=router; \ No newline at end of file +var _0x00a0=['removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','delete','destroy'];(function(_0x561001,_0x3ad884){var _0x55c45e=function(_0x2e97f2){while(--_0x2e97f2){_0x561001['push'](_0x561001['shift']());}};_0x55c45e(++_0x3ad884);}(_0x00a0,0x7b));var _0x000a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x00a0[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x000a('0x0'));var util=require(_0x000a('0x1'));var path=require(_0x000a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x000a('0x3')]();var auth=require(_0x000a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x000a('0x5'));var controller=require(_0x000a('0x6'));router[_0x000a('0x7')]('/',auth[_0x000a('0x8')](),controller[_0x000a('0x9')]);router[_0x000a('0x7')](_0x000a('0xa'),auth[_0x000a('0x8')](),controller[_0x000a('0xb')]);router[_0x000a('0x7')](_0x000a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x000a('0x7')](_0x000a('0xd'),auth[_0x000a('0x8')](),controller[_0x000a('0xe')]);router[_0x000a('0x7')]('/:id/teams',auth[_0x000a('0x8')](),controller['getTeams']);router[_0x000a('0x7')](_0x000a('0xf'),auth['isAuthenticated'](),controller[_0x000a('0x10')]);router[_0x000a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x000a('0x11')](_0x000a('0x12'),auth[_0x000a('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x000a('0x8')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x000a('0x13')](_0x000a('0xc'),auth[_0x000a('0x8')](),controller[_0x000a('0x14')]);router[_0x000a('0x13')](_0x000a('0x12'),auth[_0x000a('0x8')](),controller[_0x000a('0x15')]);router[_0x000a('0x13')](_0x000a('0xf'),auth[_0x000a('0x8')](),controller[_0x000a('0x16')]);module[_0x000a('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b46818d..470f71d 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 _0x2d03=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x1d96b1,_0x1062e9){var _0x12ddc6=function(_0x3cefff){while(--_0x3cefff){_0x1d96b1['push'](_0x1d96b1['shift']());}};_0x12ddc6(++_0x1062e9);}(_0x2d03,0x1e7));var _0x32d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x32d0('0x0')]={'name':{'type':Sequelize[_0x32d0('0x1')],'unique':_0x32d0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x32d0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x32d0('0x4')](_0x32d0('0x5'),_0x32d0('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x78e7=['rrmemory','beepall','roundrobin','exports','STRING','ENUM'];(function(_0x17c2a4,_0xfd9bab){var _0x58f01c=function(_0x375968){while(--_0x375968){_0x17c2a4['push'](_0x17c2a4['shift']());}};_0x58f01c(++_0xfd9bab);}(_0x78e7,0x17d));var _0x778e=function(_0x438b8e,_0x453d8b){_0x438b8e=_0x438b8e-0x0;var _0x52b3f8=_0x78e7[_0x438b8e];return _0x52b3f8;};'use strict';var Sequelize=require('sequelize');module[_0x778e('0x0')]={'name':{'type':Sequelize[_0x778e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x778e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x778e('0x2')](_0x778e('0x3'),_0x778e('0x4'),_0x778e('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 2e72d87..bf27644 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 _0xd506=['QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','addAgents','spread','isArray','userMailQueue:remove','getAgents','html-pdf','mustache','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/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','filter','options','include','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd506,0x197));var _0x6d50=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xd506[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require(_0x6d50('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6d50('0x1'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6d50('0x2'));var ejs=require(_0x6d50('0x3'));var fs=require('fs');var _=require(_0x6d50('0x4'));var squel=require('squel');var crypto=require(_0x6d50('0x5'));var jsforce=require(_0x6d50('0x6'));var deskjs=require(_0x6d50('0x7'));var toCsv=require('to-csv');var querystring=require(_0x6d50('0x8'));var Papa=require('papaparse');var Redis=require(_0x6d50('0x9'));var authService=require(_0x6d50('0xa'));var qs=require(_0x6d50('0xb'));var as=require(_0x6d50('0xc'));var hardwareService=require(_0x6d50('0xd'));var logger=require(_0x6d50('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d50('0xf'));var db=require(_0x6d50('0x10'))['db'];config[_0x6d50('0x11')]=_[_0x6d50('0x12')](config['redis'],{'host':_0x6d50('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d50('0x11')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4da1c4,_0x3ea2e4){_0x3ea2e4=_0x3ea2e4||0xcc;return function(_0x5875d4){if(_0x5875d4){return _0x4da1c4[_0x6d50('0x14')](_0x3ea2e4);}return _0x4da1c4[_0x6d50('0x15')](_0x3ea2e4)['end']();};}function respondWithResult(_0x599f10,_0xcb07fd){_0xcb07fd=_0xcb07fd||0xc8;return function(_0x2ee296){if(_0x2ee296){return _0x599f10[_0x6d50('0x15')](_0xcb07fd)['json'](_0x2ee296);}};}function respondWithFilteredResult(_0x2ee037,_0x1ac038){return function(_0x466d5f){if(_0x466d5f){var _0x3e7898=_0x466d5f[_0x6d50('0x16')],_0x46e254=_0x1ac038[_0x6d50('0x17')],_0x5938d5=_0x1ac038['offset']+_0x1ac038[_0x6d50('0x18')],_0x4cca66;if(_0x5938d5>=_0x3e7898){_0x5938d5=_0x3e7898;_0x4cca66=0xc8;}else{_0x4cca66=0xce;}_0x2ee037['status'](_0x4cca66);return _0x2ee037[_0x6d50('0x19')](_0x6d50('0x1a'),_0x46e254+'-'+_0x5938d5+'/'+_0x3e7898)[_0x6d50('0x1b')](_0x466d5f);}return null;};}function patchUpdates(_0x578533){return function(_0x4fbe30){try{jsonpatch['apply'](_0x4fbe30,_0x578533,!![]);}catch(_0x305d1b){return BPromise[_0x6d50('0x1c')](_0x305d1b);}return _0x4fbe30['save']();};}function saveUpdates(_0x48d452,_0x5a06d9){return function(_0x4efc34){if(_0x4efc34){return _0x4efc34[_0x6d50('0x1d')](_0x48d452)[_0x6d50('0x1e')](function(_0x2095e3){return _0x2095e3;});}return null;};}function removeEntity(_0x35b711,_0x34d25e){return function(_0xd8e384){if(_0xd8e384){return _0xd8e384[_0x6d50('0x1f')]()['then'](function(){var _0x1ee589=_0xd8e384[_0x6d50('0x20')]({'plain':!![]});var _0x54d67e=_0x6d50('0x21');return db[_0x6d50('0x22')]['destroy']({'where':{'type':_0x54d67e,'resourceId':_0x1ee589['id']}})['then'](function(){return _0xd8e384;});})[_0x6d50('0x1e')](function(){_0x35b711[_0x6d50('0x15')](0xcc)[_0x6d50('0x23')]();});}};}function handleEntityNotFound(_0x520b57,_0x56a8e4){return function(_0x11b530){if(!_0x11b530){_0x520b57[_0x6d50('0x14')](0x194);}return _0x11b530;};}function handleError(_0x315be1,_0x1d1e73){_0x1d1e73=_0x1d1e73||0x1f4;return function(_0x377334){logger[_0x6d50('0x24')](_0x377334[_0x6d50('0x25')]);if(_0x377334[_0x6d50('0x26')]){delete _0x377334['name'];}_0x315be1[_0x6d50('0x15')](_0x1d1e73)[_0x6d50('0x27')](_0x377334);};}exports[_0x6d50('0x28')]=function(_0x5745a9,_0x123216){var _0x2d6db1={},_0x1ae5c7={},_0x2f8415={'count':0x0,'rows':[]};var _0x27b9e5=_[_0x6d50('0x29')](db[_0x6d50('0x2a')][_0x6d50('0x2b')],function(_0xe2a654){return{'name':_0xe2a654[_0x6d50('0x2c')],'type':_0xe2a654['type'][_0x6d50('0x2d')]};});_0x1ae5c7[_0x6d50('0x2e')]=_[_0x6d50('0x29')](_0x27b9e5,_0x6d50('0x26'));_0x1ae5c7[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x5745a9['query']);_0x1ae5c7[_0x6d50('0x31')]=_[_0x6d50('0x32')](_0x1ae5c7[_0x6d50('0x2e')],_0x1ae5c7[_0x6d50('0x2f')]);_0x2d6db1[_0x6d50('0x33')]=_['intersection'](_0x1ae5c7['model'],qs[_0x6d50('0x34')](_0x5745a9[_0x6d50('0x2f')]['fields']));_0x2d6db1[_0x6d50('0x33')]=_0x2d6db1[_0x6d50('0x33')][_0x6d50('0x35')]?_0x2d6db1[_0x6d50('0x33')]:_0x1ae5c7[_0x6d50('0x2e')];if(!_0x5745a9[_0x6d50('0x2f')]['hasOwnProperty']('nolimit')){_0x2d6db1[_0x6d50('0x18')]=qs[_0x6d50('0x18')](_0x5745a9[_0x6d50('0x2f')][_0x6d50('0x18')]);_0x2d6db1[_0x6d50('0x17')]=qs['offset'](_0x5745a9[_0x6d50('0x2f')]['offset']);}_0x2d6db1['order']=qs['sort'](_0x5745a9[_0x6d50('0x2f')][_0x6d50('0x36')]);_0x2d6db1[_0x6d50('0x37')]=qs['filters'](_['pick'](_0x5745a9[_0x6d50('0x2f')],_0x1ae5c7[_0x6d50('0x31')]),_0x27b9e5);if(_0x5745a9[_0x6d50('0x2f')]['filter']){_0x2d6db1[_0x6d50('0x37')]=_[_0x6d50('0x38')](_0x2d6db1[_0x6d50('0x37')],{'$or':_[_0x6d50('0x29')](_0x27b9e5,function(_0x105660){if(_0x105660['type']!=='VIRTUAL'){var _0xcf1496={};_0xcf1496[_0x105660[_0x6d50('0x26')]]={'$like':'%'+_0x5745a9[_0x6d50('0x2f')][_0x6d50('0x39')]+'%'};return _0xcf1496;}})});}_0x2d6db1=_[_0x6d50('0x38')]({},_0x2d6db1,_0x5745a9[_0x6d50('0x3a')]);var _0x3a5a0e={'where':_0x2d6db1[_0x6d50('0x37')]};return db[_0x6d50('0x2a')][_0x6d50('0x16')](_0x3a5a0e)[_0x6d50('0x1e')](function(_0x5905e6){_0x2f8415[_0x6d50('0x16')]=_0x5905e6;if(_0x5745a9[_0x6d50('0x2f')]['includeAll']){_0x2d6db1[_0x6d50('0x3b')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x2d6db1);})[_0x6d50('0x1e')](function(_0x50b493){_0x2f8415[_0x6d50('0x3c')]=_0x50b493;return _0x2f8415;})[_0x6d50('0x1e')](respondWithFilteredResult(_0x123216,_0x2d6db1))['catch'](handleError(_0x123216,null));};exports[_0x6d50('0x3d')]=function(_0x36edcf,_0x5345b9){var _0x5da7ac={'raw':!![],'where':{'id':_0x36edcf[_0x6d50('0x3e')]['id']}},_0x4afb7c={};_0x4afb7c[_0x6d50('0x2e')]=_[_0x6d50('0x30')](db['MailQueue'][_0x6d50('0x2b')]);_0x4afb7c[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x36edcf[_0x6d50('0x2f')]);_0x4afb7c[_0x6d50('0x31')]=_['intersection'](_0x4afb7c[_0x6d50('0x2e')],_0x4afb7c[_0x6d50('0x2f')]);_0x5da7ac[_0x6d50('0x33')]=_[_0x6d50('0x32')](_0x4afb7c['model'],qs['fields'](_0x36edcf[_0x6d50('0x2f')][_0x6d50('0x34')]));_0x5da7ac['attributes']=_0x5da7ac['attributes']['length']?_0x5da7ac['attributes']:_0x4afb7c[_0x6d50('0x2e')];if(_0x36edcf[_0x6d50('0x2f')][_0x6d50('0x3f')]){_0x5da7ac['include']=[{'all':!![]}];}_0x5da7ac=_[_0x6d50('0x38')]({},_0x5da7ac,_0x36edcf[_0x6d50('0x3a')]);return db[_0x6d50('0x2a')]['find'](_0x5da7ac)[_0x6d50('0x1e')](handleEntityNotFound(_0x5345b9,null))[_0x6d50('0x1e')](respondWithResult(_0x5345b9,null))[_0x6d50('0x40')](handleError(_0x5345b9,null));};exports['create']=function(_0x5e731a,_0x3ad350){return db[_0x6d50('0x2a')][_0x6d50('0x41')](_0x5e731a[_0x6d50('0x42')],{})[_0x6d50('0x1e')](function(_0x41921d){var _0xeabb2a=_0x5e731a[_0x6d50('0x43')][_0x6d50('0x20')]({'plain':!![]});if(!_0xeabb2a)throw new Error(_0x6d50('0x44'));if(_0xeabb2a['role']===_0x6d50('0x43')){var _0x1e4b16=_0x41921d[_0x6d50('0x20')]({'plain':!![]});var _0x434878=_0x6d50('0x21');return db[_0x6d50('0x45')]['find']({'where':{'name':_0x434878,'userProfileId':_0xeabb2a[_0x6d50('0x46')]},'raw':!![]})[_0x6d50('0x1e')](function(_0x428950){if(_0x428950&&_0x428950['autoAssociation']===0x0){return db['UserProfileResource'][_0x6d50('0x41')]({'name':_0x1e4b16[_0x6d50('0x26')],'resourceId':_0x1e4b16['id'],'type':_0x428950[_0x6d50('0x26')],'sectionId':_0x428950['id']},{})[_0x6d50('0x1e')](function(){return _0x41921d;});}else{return _0x41921d;}})[_0x6d50('0x40')](function(_0xe0a104){logger['error'](_0x6d50('0x47'),_0xe0a104);throw _0xe0a104;});}return _0x41921d;})[_0x6d50('0x1e')](respondWithResult(_0x3ad350,0xc9))[_0x6d50('0x40')](handleError(_0x3ad350,null));};exports[_0x6d50('0x1d')]=function(_0x4da8a0,_0x17dbf9){if(_0x4da8a0[_0x6d50('0x42')]['id']){delete _0x4da8a0[_0x6d50('0x42')]['id'];}return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x4da8a0[_0x6d50('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17dbf9,null))['then'](saveUpdates(_0x4da8a0[_0x6d50('0x42')],null))[_0x6d50('0x1e')](respondWithResult(_0x17dbf9,null))[_0x6d50('0x40')](handleError(_0x17dbf9,null));};exports['destroy']=function(_0x249437,_0x124abe){return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x249437['params']['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0x124abe,null))['then'](removeEntity(_0x124abe,null))['catch'](handleError(_0x124abe,null));};exports[_0x6d50('0x49')]=function(_0xa18425,_0x4f5bfa){return db[_0x6d50('0x2a')]['describe']()[_0x6d50('0x1e')](respondWithResult(_0x4f5bfa,null))['catch'](handleError(_0x4f5bfa,null));};exports['getMembers']=function(_0x2da6b0,_0x133c2e,_0x310f41){var _0x5d3807={'raw':!![],'where':{}},_0x23cc58={},_0x4e3bd9;return db['MailQueue'][_0x6d50('0x4a')]({'where':{'id':_0x2da6b0[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0x133c2e,null))[_0x6d50('0x1e')](function(_0x367a7c){if(_0x367a7c){_0x4e3bd9=_0x367a7c[_0x6d50('0x20')]({'plain':!![]});_0x23cc58['model']=_[_0x6d50('0x30')](db[_0x6d50('0x4b')][_0x6d50('0x2b')]);_0x23cc58[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x2da6b0[_0x6d50('0x2f')]);_0x23cc58[_0x6d50('0x31')]=_[_0x6d50('0x32')](_0x23cc58[_0x6d50('0x2e')],_0x23cc58[_0x6d50('0x2f')]);_0x5d3807[_0x6d50('0x33')]=_[_0x6d50('0x32')](_0x23cc58[_0x6d50('0x2e')],qs['fields'](_0x2da6b0['query'][_0x6d50('0x34')]));_0x5d3807[_0x6d50('0x33')]=_0x5d3807[_0x6d50('0x33')][_0x6d50('0x35')]?_0x5d3807['attributes']:_0x23cc58[_0x6d50('0x2e')];if(!_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x4c')](_0x6d50('0x4d'))){_0x5d3807[_0x6d50('0x18')]=qs[_0x6d50('0x18')](_0x2da6b0[_0x6d50('0x2f')]['limit']);_0x5d3807['offset']=qs[_0x6d50('0x17')](_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x17')]);}_0x5d3807[_0x6d50('0x4e')]=qs[_0x6d50('0x36')](_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x36')]);_0x5d3807[_0x6d50('0x37')]=qs['filters'](_[_0x6d50('0x4f')](_0x2da6b0['query'],_0x23cc58[_0x6d50('0x31')]));_0x5d3807[_0x6d50('0x37')][_0x6d50('0x50')]=_0x367a7c['id'];if(_0x2da6b0[_0x6d50('0x2f')][_0x6d50('0x39')]){_0x5d3807['where']=_[_0x6d50('0x38')](_0x5d3807[_0x6d50('0x37')],{'$or':_['map'](_0x5d3807[_0x6d50('0x33')],function(_0x1723a5){var _0x36253e={};_0x36253e[_0x1723a5]={'$like':'%'+_0x2da6b0[_0x6d50('0x2f')]['filter']+'%'};return _0x36253e;})});}_0x5d3807=_[_0x6d50('0x38')]({},_0x5d3807,_0x2da6b0['options']);return db['UserMailQueue']['findAll'](_0x5d3807);}})[_0x6d50('0x1e')](function(_0x207fec){if(_0x207fec){return db[_0x6d50('0x51')][_0x6d50('0x52')]({'where':{'id':_[_0x6d50('0x29')](_0x207fec,_0x6d50('0x53')),'role':_0x6d50('0x54')},'attributes':['id',_0x6d50('0x26'),_0x6d50('0x55'),_0x6d50('0x56'),'createdAt']});}})[_0x6d50('0x1e')](function(_0x54a0fc){if(_0x54a0fc){return{'count':_0x54a0fc[_0x6d50('0x16')],'rows':_[_0x6d50('0x29')](_0x54a0fc[_0x6d50('0x3c')],function(_0x4b8cd0){return{'membername':_0x4b8cd0[_0x6d50('0x26')],'UserId':_0x4b8cd0['id'],'queue_name':_0x4e3bd9[_0x6d50('0x26')],'MailQueueId':_0x4e3bd9['id'],'interface':util['format'](_0x6d50('0x57'),_0x6d50('0x58'),_0x4b8cd0[_0x6d50('0x26')]),'penalty':0x0,'paused':_0x4b8cd0[_0x6d50('0x55')],'createdAt':_0x4b8cd0['createdAt'],'updatedAt':_0x4b8cd0[_0x6d50('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x133c2e,_0x5d3807))['catch'](handleError(_0x133c2e,null));};exports['getTeams']=function(_0x10a6d6,_0xf43a08,_0x31b418){var _0x28243e={};var _0x481019={};var _0x4c05c7;var _0x38d408;return db[_0x6d50('0x2a')][_0x6d50('0x4a')]({'where':{'id':_0x10a6d6[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0xf43a08,null))[_0x6d50('0x1e')](function(_0xe79209){if(_0xe79209){_0x4c05c7=_0xe79209;_0x481019[_0x6d50('0x2e')]=_[_0x6d50('0x30')](db[_0x6d50('0x59')][_0x6d50('0x2b')]);_0x481019[_0x6d50('0x2f')]=_[_0x6d50('0x30')](_0x10a6d6[_0x6d50('0x2f')]);_0x481019['filters']=_[_0x6d50('0x32')](_0x481019[_0x6d50('0x2e')],_0x481019[_0x6d50('0x2f')]);_0x28243e[_0x6d50('0x33')]=_['intersection'](_0x481019[_0x6d50('0x2e')],qs['fields'](_0x10a6d6[_0x6d50('0x2f')]['fields']));_0x28243e['attributes']=_0x28243e[_0x6d50('0x33')][_0x6d50('0x35')]?_0x28243e['attributes']:_0x481019[_0x6d50('0x2e')];_0x28243e['order']=qs[_0x6d50('0x36')](_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x36')]);_0x28243e[_0x6d50('0x37')]=qs[_0x6d50('0x31')](_[_0x6d50('0x4f')](_0x10a6d6[_0x6d50('0x2f')],_0x481019[_0x6d50('0x31')]));if(_0x10a6d6[_0x6d50('0x2f')]['filter']){_0x28243e[_0x6d50('0x37')]=_[_0x6d50('0x38')](_0x28243e[_0x6d50('0x37')],{'$or':_[_0x6d50('0x29')](_0x28243e['attributes'],function(_0x92d101){var _0x3a0674={};_0x3a0674[_0x92d101]={'$like':'%'+_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x39')]+'%'};return _0x3a0674;})});}_0x28243e=_[_0x6d50('0x38')]({},_0x28243e,_0x10a6d6[_0x6d50('0x3a')]);return _0x4c05c7[_0x6d50('0x5a')](_0x28243e);}})[_0x6d50('0x1e')](function(_0x24faf6){if(_0x24faf6){_0x38d408=_0x24faf6[_0x6d50('0x35')];if(!_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x4c')](_0x6d50('0x4d'))){_0x28243e[_0x6d50('0x18')]=qs[_0x6d50('0x18')](_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x18')]);_0x28243e[_0x6d50('0x17')]=qs['offset'](_0x10a6d6[_0x6d50('0x2f')][_0x6d50('0x17')]);}return _0x4c05c7[_0x6d50('0x5a')](_0x28243e);}})[_0x6d50('0x1e')](function(_0x5426cb){if(_0x5426cb){return _0x5426cb?{'count':_0x38d408,'rows':_0x5426cb}:null;}})[_0x6d50('0x1e')](respondWithResult(_0xf43a08,null))[_0x6d50('0x40')](handleError(_0xf43a08,null));};exports[_0x6d50('0x5b')]=function(_0x349b2c,_0x1bb5d8,_0x298e62){var _0x47df3e=_0x349b2c[_0x6d50('0x42')][_0x6d50('0x5c')];return db[_0x6d50('0x59')]['findAll']({'where':{'id':_0x47df3e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x6d50('0x26'),_0x6d50('0x5d'),_0x6d50('0x5e'),_0x6d50('0x5f')],'raw':!![]}]})[_0x6d50('0x1e')](function(_0x2225fc){if(_0x2225fc){var _0x15b5ba=_[_0x6d50('0x60')](_0x2225fc,function(_0x370b8c){var _0x2df18d=_0x370b8c[_0x6d50('0x20')]({'plain':!![]});return _0x2df18d[_0x6d50('0x61')];});return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x349b2c[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](function(_0x43e738){return db[_0x6d50('0x62')][_0x6d50('0x63')](function(_0x41684b){return _0x43e738[_0x6d50('0x5b')](_0x47df3e,{'transaction':_0x41684b})['then'](function(){return BPromise[_0x6d50('0x64')](_0x15b5ba,function(_0xbf0e9e){return db['UserMailQueue'][_0x6d50('0x65')]({'where':{'UserId':_0xbf0e9e['id'],'MailQueueId':_0x349b2c[_0x6d50('0x3e')]['id']},'transaction':_0x41684b});});})[_0x6d50('0x1e')](function(){_0x15b5ba[_0x6d50('0x66')](function(_0x560e7a){socket[_0x6d50('0x67')](_0x6d50('0x68'),{'UserId':_0x560e7a['id'],'MailQueueId':_0x43e738['id']});});});});});}})[_0x6d50('0x1e')](respondWithStatusCode(_0x1bb5d8,null))[_0x6d50('0x40')](handleError(_0x1bb5d8,null));};exports[_0x6d50('0x69')]=function(_0x423c1d,_0x249525,_0x302a82){return db[_0x6d50('0x59')][_0x6d50('0x6a')]({'where':{'id':_0x423c1d[_0x6d50('0x2f')][_0x6d50('0x5c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6d50('0x61'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x249525,null))[_0x6d50('0x1e')](function(_0x195b63){var _0x30433e=_[_0x6d50('0x29')](_0x195b63,'id');var _0x2240f0=[];var _0x2a061e=[];var _0x59b14d=squel[_0x6d50('0x6b')]();_0x59b14d[_0x6d50('0x6c')](_0x6d50('0x6d'))[_0x6d50('0x6e')]('team_has_mail_queues','tq')['join'](_0x6d50('0x6f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6d50('0x37')](_0x6d50('0x70'),_0x423c1d[_0x6d50('0x3e')]['id']);for(var _0x40987b=0x0;_0x40987b<_0x195b63['length'];_0x40987b+=0x1){let _0x461dff=_0x195b63[_0x40987b];for(var _0x1ca5f1=0x0;_0x1ca5f1<_0x461dff[_0x6d50('0x61')]['length'];_0x1ca5f1+=0x1){let _0x56156a=_0x461dff[_0x6d50('0x61')][_0x1ca5f1];var _0x4514bc=_0x59b14d[_0x6d50('0x71')]();_0x4514bc[_0x6d50('0x37')](_0x6d50('0x72'),_0x56156a['id']);_0x2a061e[_0x6d50('0x73')](db[_0x6d50('0x62')][_0x6d50('0x2f')](_0x4514bc[_0x6d50('0x74')](),{'type':db[_0x6d50('0x62')][_0x6d50('0x75')][_0x6d50('0x76')]})[_0x6d50('0x1e')](function(_0x112f66){if(_0x112f66[_0x6d50('0x35')]===0x1){return _0x56156a['id'];}else{var _0x411cb4=_[_0x6d50('0x77')](_['map'](_0x112f66,'TeamId'),function(_0x5bafd7){return _[_0x6d50('0x78')](_0x30433e,_0x5bafd7);});if(_0x411cb4){return _0x56156a['id'];}}}));}}return BPromise[_0x6d50('0x79')](_0x2a061e)[_0x6d50('0x1e')](function(_0x3a8057){_0x2240f0=_(_0x2240f0)[_0x6d50('0x7a')](_0x3a8057)[_0x6d50('0x7b')]()[_0x6d50('0x7c')]();return db[_0x6d50('0x2a')]['find']({'where':{'id':_0x423c1d[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](function(_0x1e117e){return db['sequelize'][_0x6d50('0x63')](function(_0x1fda4c){return _0x1e117e[_0x6d50('0x69')](_0x423c1d[_0x6d50('0x2f')]['ids'],{'transaction':_0x1fda4c})[_0x6d50('0x1e')](function(){if(!_['isEmpty'](_0x2240f0)){return _0x1e117e[_0x6d50('0x7d')](_0x2240f0,{'transaction':_0x1fda4c});}})['then'](function(){_0x2240f0['forEach'](function(_0x427b7d){socket[_0x6d50('0x67')]('userMailQueue:remove',{'UserId':_0x427b7d,'MailQueueId':_0x1e117e['id']});});});});});});})[_0x6d50('0x1e')](respondWithStatusCode(_0x249525,null))[_0x6d50('0x40')](handleError(_0x249525,null));};exports[_0x6d50('0x7e')]=function(_0x5ea1b6,_0x43feb9,_0x3d6d31){return db[_0x6d50('0x2a')][_0x6d50('0x48')]({'where':{'id':_0x5ea1b6[_0x6d50('0x3e')]['id']}})[_0x6d50('0x1e')](handleEntityNotFound(_0x43feb9,null))['then'](function(_0x5105f1){if(_0x5105f1){return _0x5105f1['addAgents'](_0x5ea1b6['body'][_0x6d50('0x5c')],_['omit'](_0x5ea1b6[_0x6d50('0x42')],[_0x6d50('0x5c'),'id'])||{})[_0x6d50('0x7f')](function(_0x591a10){for(var _0x4760bb=0x0;_0x4760bb<_0x5ea1b6[_0x6d50('0x42')][_0x6d50('0x5c')]['length'];_0x4760bb+=0x1){socket[_0x6d50('0x67')]('userMailQueue:save',{'UserId':_0x5ea1b6['body'][_0x6d50('0x5c')][_0x4760bb],'MailQueueId':_0x5ea1b6[_0x6d50('0x3e')]['id']});}return _0x591a10;});}})[_0x6d50('0x1e')](respondWithResult(_0x43feb9,null))[_0x6d50('0x40')](handleError(_0x43feb9,null));};exports[_0x6d50('0x7d')]=function(_0x3721e4,_0x3b535a,_0x52c076){return db['MailQueue'][_0x6d50('0x48')]({'where':{'id':_0x3721e4[_0x6d50('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b535a,null))['then'](function(_0x5e0066){if(_0x5e0066){return _0x5e0066['removeAgents'](_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')])['then'](function(){if(_[_0x6d50('0x80')](_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')])){for(var _0x364b56=0x0;_0x364b56<_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')]['length'];_0x364b56+=0x1){socket[_0x6d50('0x67')]('userMailQueue:remove',{'UserId':Number(_0x3721e4[_0x6d50('0x2f')][_0x6d50('0x5c')][_0x364b56]),'MailQueueId':Number(_0x3721e4[_0x6d50('0x3e')]['id'])});}}else{socket[_0x6d50('0x67')](_0x6d50('0x81'),{'UserId':Number(_0x3721e4['query']['ids']),'MailQueueId':Number(_0x3721e4[_0x6d50('0x3e')]['id'])});}});}})[_0x6d50('0x1e')](respondWithStatusCode(_0x3b535a,null))['catch'](handleError(_0x3b535a,null));};exports[_0x6d50('0x82')]=function(_0x3e63e3,_0x243022,_0x528bf1){var _0x436a4c={};var _0x18a015={};var _0x38427b;var _0x1b0ac7;return db[_0x6d50('0x2a')][_0x6d50('0x4a')]({'where':{'id':_0x3e63e3['params']['id']}})['then'](handleEntityNotFound(_0x243022,null))[_0x6d50('0x1e')](function(_0x58e3aa){if(_0x58e3aa){_0x38427b=_0x58e3aa;_0x18a015['model']=_[_0x6d50('0x30')](db[_0x6d50('0x51')][_0x6d50('0x2b')]);_0x18a015[_0x6d50('0x2f')]=_['keys'](_0x3e63e3[_0x6d50('0x2f')]);_0x18a015[_0x6d50('0x31')]=_[_0x6d50('0x32')](_0x18a015[_0x6d50('0x2e')],_0x18a015[_0x6d50('0x2f')]);_0x436a4c['attributes']=_[_0x6d50('0x32')](_0x18a015[_0x6d50('0x2e')],qs[_0x6d50('0x34')](_0x3e63e3[_0x6d50('0x2f')]['fields']));_0x436a4c[_0x6d50('0x33')]=_0x436a4c[_0x6d50('0x33')][_0x6d50('0x35')]?_0x436a4c[_0x6d50('0x33')]:_0x18a015[_0x6d50('0x2e')];_0x436a4c[_0x6d50('0x4e')]=qs['sort'](_0x3e63e3['query'][_0x6d50('0x36')]);_0x436a4c[_0x6d50('0x37')]=qs[_0x6d50('0x31')](_[_0x6d50('0x4f')](_0x3e63e3['query'],_0x18a015['filters']));if(_0x3e63e3[_0x6d50('0x2f')][_0x6d50('0x39')]){_0x436a4c[_0x6d50('0x37')]=_[_0x6d50('0x38')](_0x436a4c['where'],{'$or':_[_0x6d50('0x29')](_0x436a4c[_0x6d50('0x33')],function(_0x2d65a4){var _0xe9fe7b={};_0xe9fe7b[_0x2d65a4]={'$like':'%'+_0x3e63e3[_0x6d50('0x2f')][_0x6d50('0x39')]+'%'};return _0xe9fe7b;})});}_0x436a4c=_[_0x6d50('0x38')]({},_0x436a4c,_0x3e63e3['options']);return _0x38427b['getAgents'](_0x436a4c);}})[_0x6d50('0x1e')](function(_0x4b33c5){if(_0x4b33c5){_0x1b0ac7=_0x4b33c5[_0x6d50('0x35')];if(!_0x3e63e3[_0x6d50('0x2f')][_0x6d50('0x4c')](_0x6d50('0x4d'))){_0x436a4c[_0x6d50('0x18')]=qs['limit'](_0x3e63e3['query'][_0x6d50('0x18')]);_0x436a4c['offset']=qs[_0x6d50('0x17')](_0x3e63e3['query'][_0x6d50('0x17')]);}return _0x38427b['getAgents'](_0x436a4c);}})[_0x6d50('0x1e')](function(_0x5bd198){if(_0x5bd198){return _0x5bd198?{'count':_0x1b0ac7,'rows':_0x5bd198}:null;}})['then'](respondWithResult(_0x243022,null))[_0x6d50('0x40')](handleError(_0x243022,null));}; \ No newline at end of file +var _0x4a1d=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','findAll','UserId','agent','mailPause','SIP','createdAt','updatedAt','getTeams','Team','pick','ids','User','voicePause','interface','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','select','field','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeTeams','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x33d427,_0x47c8c2){var _0x383dbd=function(_0x578493){while(--_0x578493){_0x33d427['push'](_0x33d427['shift']());}};_0x383dbd(++_0x47c8c2);}(_0x4a1d,0x77));var _0xd4a1=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4a1d[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0xd4a1('0x0'));var emlformat=require(_0xd4a1('0x1'));var rimraf=require(_0xd4a1('0x2'));var zipdir=require(_0xd4a1('0x3'));var jsonpatch=require(_0xd4a1('0x4'));var rp=require('request-promise');var moment=require(_0xd4a1('0x5'));var BPromise=require(_0xd4a1('0x6'));var Mustache=require(_0xd4a1('0x7'));var util=require(_0xd4a1('0x8'));var path=require(_0xd4a1('0x9'));var sox=require(_0xd4a1('0xa'));var csv=require(_0xd4a1('0xb'));var ejs=require(_0xd4a1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd4a1('0xd'));var crypto=require(_0xd4a1('0xe'));var jsforce=require(_0xd4a1('0xf'));var deskjs=require(_0xd4a1('0x10'));var toCsv=require(_0xd4a1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4a1('0x11'));var authService=require(_0xd4a1('0x12'));var qs=require(_0xd4a1('0x13'));var as=require(_0xd4a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a1('0x15'))(_0xd4a1('0x16'));var utils=require(_0xd4a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd4a1('0x18'));var db=require(_0xd4a1('0x19'))['db'];config[_0xd4a1('0x1a')]=_[_0xd4a1('0x1b')](config['redis'],{'host':_0xd4a1('0x1c'),'port':0x18eb});var socket=require(_0xd4a1('0x1d'))(new Redis(config[_0xd4a1('0x1a')]));require('./mailQueue.socket')[_0xd4a1('0x1e')](socket);function respondWithStatusCode(_0xafabbe,_0x23807c){_0x23807c=_0x23807c||0xcc;return function(_0x40138e){if(_0x40138e){return _0xafabbe['sendStatus'](_0x23807c);}return _0xafabbe['status'](_0x23807c)[_0xd4a1('0x1f')]();};}function respondWithResult(_0x41f682,_0x207d33){_0x207d33=_0x207d33||0xc8;return function(_0x21d0c7){if(_0x21d0c7){return _0x41f682[_0xd4a1('0x20')](_0x207d33)['json'](_0x21d0c7);}};}function respondWithFilteredResult(_0x3f1f8b,_0x20530d){return function(_0x13a6e6){if(_0x13a6e6){var _0xe73553=_0x13a6e6[_0xd4a1('0x21')],_0x1276e2=_0x20530d[_0xd4a1('0x22')],_0x51e932=_0x20530d['offset']+_0x20530d[_0xd4a1('0x23')],_0x1cc48d;if(_0x51e932>=_0xe73553){_0x51e932=_0xe73553;_0x1cc48d=0xc8;}else{_0x1cc48d=0xce;}_0x3f1f8b[_0xd4a1('0x20')](_0x1cc48d);return _0x3f1f8b[_0xd4a1('0x24')](_0xd4a1('0x25'),_0x1276e2+'-'+_0x51e932+'/'+_0xe73553)[_0xd4a1('0x26')](_0x13a6e6);}return null;};}function patchUpdates(_0x180e1f){return function(_0x2be7af){try{jsonpatch[_0xd4a1('0x27')](_0x2be7af,_0x180e1f,!![]);}catch(_0x4fdc36){return BPromise[_0xd4a1('0x28')](_0x4fdc36);}return _0x2be7af[_0xd4a1('0x29')]();};}function saveUpdates(_0x4b1876,_0x31b853){return function(_0x52ef5e){if(_0x52ef5e){return _0x52ef5e[_0xd4a1('0x2a')](_0x4b1876)[_0xd4a1('0x2b')](function(_0xb5e1d4){return _0xb5e1d4;});}return null;};}function removeEntity(_0x4ec590,_0x560ee1){return function(_0x197d08){if(_0x197d08){return _0x197d08[_0xd4a1('0x2c')]()['then'](function(){var _0x58bb02=_0x197d08[_0xd4a1('0x2d')]({'plain':!![]});var _0x105aa1=_0xd4a1('0x2e');return db[_0xd4a1('0x2f')][_0xd4a1('0x2c')]({'where':{'type':_0x105aa1,'resourceId':_0x58bb02['id']}})[_0xd4a1('0x2b')](function(){return _0x197d08;});})[_0xd4a1('0x2b')](function(){_0x4ec590[_0xd4a1('0x20')](0xcc)[_0xd4a1('0x1f')]();});}};}function handleEntityNotFound(_0x366d63,_0x2b5789){return function(_0xa5351e){if(!_0xa5351e){_0x366d63['sendStatus'](0x194);}return _0xa5351e;};}function handleError(_0x4eeed8,_0x4df499){_0x4df499=_0x4df499||0x1f4;return function(_0x8973c4){logger['error'](_0x8973c4[_0xd4a1('0x30')]);if(_0x8973c4[_0xd4a1('0x31')]){delete _0x8973c4[_0xd4a1('0x31')];}_0x4eeed8['status'](_0x4df499)[_0xd4a1('0x32')](_0x8973c4);};}exports[_0xd4a1('0x33')]=function(_0x5dd895,_0x51419d){var _0x386fa={},_0x115ae7={},_0x3042ac={'count':0x0,'rows':[]};var _0x162a20=_[_0xd4a1('0x34')](db[_0xd4a1('0x35')][_0xd4a1('0x36')],function(_0x5ae0ed){return{'name':_0x5ae0ed[_0xd4a1('0x37')],'type':_0x5ae0ed['type'][_0xd4a1('0x38')]};});_0x115ae7[_0xd4a1('0x39')]=_['map'](_0x162a20,_0xd4a1('0x31'));_0x115ae7[_0xd4a1('0x3a')]=_['keys'](_0x5dd895[_0xd4a1('0x3a')]);_0x115ae7[_0xd4a1('0x3b')]=_['intersection'](_0x115ae7[_0xd4a1('0x39')],_0x115ae7['query']);_0x386fa[_0xd4a1('0x3c')]=_[_0xd4a1('0x3d')](_0x115ae7[_0xd4a1('0x39')],qs[_0xd4a1('0x3e')](_0x5dd895[_0xd4a1('0x3a')]['fields']));_0x386fa[_0xd4a1('0x3c')]=_0x386fa[_0xd4a1('0x3c')][_0xd4a1('0x3f')]?_0x386fa['attributes']:_0x115ae7[_0xd4a1('0x39')];if(!_0x5dd895[_0xd4a1('0x3a')]['hasOwnProperty']('nolimit')){_0x386fa['limit']=qs[_0xd4a1('0x23')](_0x5dd895['query']['limit']);_0x386fa[_0xd4a1('0x22')]=qs[_0xd4a1('0x22')](_0x5dd895['query']['offset']);}_0x386fa[_0xd4a1('0x40')]=qs[_0xd4a1('0x41')](_0x5dd895['query'][_0xd4a1('0x41')]);_0x386fa['where']=qs[_0xd4a1('0x3b')](_['pick'](_0x5dd895[_0xd4a1('0x3a')],_0x115ae7['filters']),_0x162a20);if(_0x5dd895[_0xd4a1('0x3a')][_0xd4a1('0x42')]){_0x386fa[_0xd4a1('0x43')]=_[_0xd4a1('0x44')](_0x386fa['where'],{'$or':_['map'](_0x162a20,function(_0x833339){if(_0x833339[_0xd4a1('0x45')]!==_0xd4a1('0x46')){var _0x26a0c8={};_0x26a0c8[_0x833339['name']]={'$like':'%'+_0x5dd895['query']['filter']+'%'};return _0x26a0c8;}})});}_0x386fa=_[_0xd4a1('0x44')]({},_0x386fa,_0x5dd895[_0xd4a1('0x47')]);var _0x1c4c0b={'where':_0x386fa[_0xd4a1('0x43')]};return db[_0xd4a1('0x35')][_0xd4a1('0x21')](_0x1c4c0b)[_0xd4a1('0x2b')](function(_0x536688){_0x3042ac['count']=_0x536688;if(_0x5dd895[_0xd4a1('0x3a')][_0xd4a1('0x48')]){_0x386fa[_0xd4a1('0x49')]=[{'all':!![]}];}return db[_0xd4a1('0x35')]['findAll'](_0x386fa);})[_0xd4a1('0x2b')](function(_0x3719ba){_0x3042ac[_0xd4a1('0x4a')]=_0x3719ba;return _0x3042ac;})[_0xd4a1('0x2b')](respondWithFilteredResult(_0x51419d,_0x386fa))['catch'](handleError(_0x51419d,null));};exports[_0xd4a1('0x4b')]=function(_0x391f2f,_0xa01c5f){var _0x5c9436={'raw':!![],'where':{'id':_0x391f2f[_0xd4a1('0x4c')]['id']}},_0x74ab01={};_0x74ab01['model']=_[_0xd4a1('0x4d')](db['MailQueue'][_0xd4a1('0x36')]);_0x74ab01[_0xd4a1('0x3a')]=_[_0xd4a1('0x4d')](_0x391f2f[_0xd4a1('0x3a')]);_0x74ab01['filters']=_[_0xd4a1('0x3d')](_0x74ab01[_0xd4a1('0x39')],_0x74ab01[_0xd4a1('0x3a')]);_0x5c9436[_0xd4a1('0x3c')]=_['intersection'](_0x74ab01[_0xd4a1('0x39')],qs[_0xd4a1('0x3e')](_0x391f2f[_0xd4a1('0x3a')][_0xd4a1('0x3e')]));_0x5c9436[_0xd4a1('0x3c')]=_0x5c9436[_0xd4a1('0x3c')]['length']?_0x5c9436[_0xd4a1('0x3c')]:_0x74ab01[_0xd4a1('0x39')];if(_0x391f2f[_0xd4a1('0x3a')][_0xd4a1('0x48')]){_0x5c9436[_0xd4a1('0x49')]=[{'all':!![]}];}_0x5c9436=_[_0xd4a1('0x44')]({},_0x5c9436,_0x391f2f[_0xd4a1('0x47')]);return db[_0xd4a1('0x35')][_0xd4a1('0x4e')](_0x5c9436)[_0xd4a1('0x2b')](handleEntityNotFound(_0xa01c5f,null))[_0xd4a1('0x2b')](respondWithResult(_0xa01c5f,null))['catch'](handleError(_0xa01c5f,null));};exports[_0xd4a1('0x4f')]=function(_0xaabac9,_0x26e29d){return db[_0xd4a1('0x35')][_0xd4a1('0x4f')](_0xaabac9[_0xd4a1('0x50')],{})[_0xd4a1('0x2b')](function(_0x1c1153){var _0x97c330=_0xaabac9[_0xd4a1('0x51')][_0xd4a1('0x2d')]({'plain':!![]});if(!_0x97c330)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x97c330[_0xd4a1('0x52')]===_0xd4a1('0x51')){var _0x3c3aa7=_0x1c1153['get']({'plain':!![]});var _0x342bcb='MailQueues';return db[_0xd4a1('0x53')][_0xd4a1('0x4e')]({'where':{'name':_0x342bcb,'userProfileId':_0x97c330[_0xd4a1('0x54')]},'raw':!![]})[_0xd4a1('0x2b')](function(_0xa671f5){if(_0xa671f5&&_0xa671f5[_0xd4a1('0x55')]===0x0){return db[_0xd4a1('0x2f')][_0xd4a1('0x4f')]({'name':_0x3c3aa7[_0xd4a1('0x31')],'resourceId':_0x3c3aa7['id'],'type':_0xa671f5[_0xd4a1('0x31')],'sectionId':_0xa671f5['id']},{})[_0xd4a1('0x2b')](function(){return _0x1c1153;});}else{return _0x1c1153;}})[_0xd4a1('0x56')](function(_0x3cd228){logger[_0xd4a1('0x57')](_0xd4a1('0x58'),_0x3cd228);throw _0x3cd228;});}return _0x1c1153;})['then'](respondWithResult(_0x26e29d,0xc9))['catch'](handleError(_0x26e29d,null));};exports['update']=function(_0x205749,_0x1f853b){if(_0x205749[_0xd4a1('0x50')]['id']){delete _0x205749['body']['id'];}return db[_0xd4a1('0x35')]['find']({'where':{'id':_0x205749[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x1f853b,null))['then'](saveUpdates(_0x205749['body'],null))[_0xd4a1('0x2b')](respondWithResult(_0x1f853b,null))['catch'](handleError(_0x1f853b,null));};exports[_0xd4a1('0x2c')]=function(_0x1d2eb6,_0x274976){return db['MailQueue'][_0xd4a1('0x4e')]({'where':{'id':_0x1d2eb6[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x274976,null))[_0xd4a1('0x2b')](removeEntity(_0x274976,null))['catch'](handleError(_0x274976,null));};exports['describe']=function(_0x4d370b,_0x52fac6){return db[_0xd4a1('0x35')][_0xd4a1('0x59')]()[_0xd4a1('0x2b')](respondWithResult(_0x52fac6,null))[_0xd4a1('0x56')](handleError(_0x52fac6,null));};exports[_0xd4a1('0x5a')]=function(_0x4770f9,_0x435ed3,_0x3ea756){var _0x19d799={'raw':!![],'where':{}},_0x188225={},_0x42fb90;return db['MailQueue'][_0xd4a1('0x5b')]({'where':{'id':_0x4770f9['params']['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x435ed3,null))[_0xd4a1('0x2b')](function(_0x2b449a){if(_0x2b449a){_0x42fb90=_0x2b449a['get']({'plain':!![]});_0x188225['model']=_[_0xd4a1('0x4d')](db[_0xd4a1('0x5c')][_0xd4a1('0x36')]);_0x188225['query']=_[_0xd4a1('0x4d')](_0x4770f9[_0xd4a1('0x3a')]);_0x188225[_0xd4a1('0x3b')]=_[_0xd4a1('0x3d')](_0x188225[_0xd4a1('0x39')],_0x188225['query']);_0x19d799['attributes']=_[_0xd4a1('0x3d')](_0x188225[_0xd4a1('0x39')],qs[_0xd4a1('0x3e')](_0x4770f9['query'][_0xd4a1('0x3e')]));_0x19d799[_0xd4a1('0x3c')]=_0x19d799[_0xd4a1('0x3c')]['length']?_0x19d799[_0xd4a1('0x3c')]:_0x188225[_0xd4a1('0x39')];if(!_0x4770f9['query'][_0xd4a1('0x5d')](_0xd4a1('0x5e'))){_0x19d799['limit']=qs[_0xd4a1('0x23')](_0x4770f9[_0xd4a1('0x3a')][_0xd4a1('0x23')]);_0x19d799[_0xd4a1('0x22')]=qs['offset'](_0x4770f9[_0xd4a1('0x3a')]['offset']);}_0x19d799['order']=qs[_0xd4a1('0x41')](_0x4770f9[_0xd4a1('0x3a')]['sort']);_0x19d799['where']=qs['filters'](_['pick'](_0x4770f9[_0xd4a1('0x3a')],_0x188225[_0xd4a1('0x3b')]));_0x19d799['where'][_0xd4a1('0x5f')]=_0x2b449a['id'];if(_0x4770f9['query'][_0xd4a1('0x42')]){_0x19d799['where']=_[_0xd4a1('0x44')](_0x19d799[_0xd4a1('0x43')],{'$or':_[_0xd4a1('0x34')](_0x19d799[_0xd4a1('0x3c')],function(_0x2aad0d){var _0x1a1e18={};_0x1a1e18[_0x2aad0d]={'$like':'%'+_0x4770f9[_0xd4a1('0x3a')]['filter']+'%'};return _0x1a1e18;})});}_0x19d799=_['merge']({},_0x19d799,_0x4770f9[_0xd4a1('0x47')]);return db[_0xd4a1('0x5c')][_0xd4a1('0x60')](_0x19d799);}})[_0xd4a1('0x2b')](function(_0x44ed24){if(_0x44ed24){return db['User']['findAndCountAll']({'where':{'id':_[_0xd4a1('0x34')](_0x44ed24,_0xd4a1('0x61')),'role':_0xd4a1('0x62')},'attributes':['id',_0xd4a1('0x31'),_0xd4a1('0x63'),'updatedAt','createdAt']});}})[_0xd4a1('0x2b')](function(_0x130b37){if(_0x130b37){return{'count':_0x130b37[_0xd4a1('0x21')],'rows':_[_0xd4a1('0x34')](_0x130b37[_0xd4a1('0x4a')],function(_0x17a690){return{'membername':_0x17a690[_0xd4a1('0x31')],'UserId':_0x17a690['id'],'queue_name':_0x42fb90[_0xd4a1('0x31')],'MailQueueId':_0x42fb90['id'],'interface':util['format']('%s/%s',_0xd4a1('0x64'),_0x17a690[_0xd4a1('0x31')]),'penalty':0x0,'paused':_0x17a690[_0xd4a1('0x63')],'createdAt':_0x17a690[_0xd4a1('0x65')],'updatedAt':_0x17a690[_0xd4a1('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd4a1('0x2b')](respondWithFilteredResult(_0x435ed3,_0x19d799))[_0xd4a1('0x56')](handleError(_0x435ed3,null));};exports[_0xd4a1('0x67')]=function(_0x3e46d5,_0x11baef,_0x44424d){var _0x41a384={};var _0xfd506d={};var _0x2b97c0;var _0x1510d5;return db[_0xd4a1('0x35')]['findOne']({'where':{'id':_0x3e46d5[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x11baef,null))[_0xd4a1('0x2b')](function(_0x494f51){if(_0x494f51){_0x2b97c0=_0x494f51;_0xfd506d[_0xd4a1('0x39')]=_[_0xd4a1('0x4d')](db[_0xd4a1('0x68')]['rawAttributes']);_0xfd506d[_0xd4a1('0x3a')]=_[_0xd4a1('0x4d')](_0x3e46d5[_0xd4a1('0x3a')]);_0xfd506d[_0xd4a1('0x3b')]=_[_0xd4a1('0x3d')](_0xfd506d[_0xd4a1('0x39')],_0xfd506d['query']);_0x41a384[_0xd4a1('0x3c')]=_[_0xd4a1('0x3d')](_0xfd506d['model'],qs[_0xd4a1('0x3e')](_0x3e46d5[_0xd4a1('0x3a')]['fields']));_0x41a384[_0xd4a1('0x3c')]=_0x41a384['attributes'][_0xd4a1('0x3f')]?_0x41a384[_0xd4a1('0x3c')]:_0xfd506d[_0xd4a1('0x39')];_0x41a384[_0xd4a1('0x40')]=qs[_0xd4a1('0x41')](_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x41')]);_0x41a384[_0xd4a1('0x43')]=qs['filters'](_[_0xd4a1('0x69')](_0x3e46d5[_0xd4a1('0x3a')],_0xfd506d[_0xd4a1('0x3b')]));if(_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x42')]){_0x41a384['where']=_[_0xd4a1('0x44')](_0x41a384[_0xd4a1('0x43')],{'$or':_[_0xd4a1('0x34')](_0x41a384[_0xd4a1('0x3c')],function(_0x2a1b99){var _0x20ee60={};_0x20ee60[_0x2a1b99]={'$like':'%'+_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x42')]+'%'};return _0x20ee60;})});}_0x41a384=_['merge']({},_0x41a384,_0x3e46d5[_0xd4a1('0x47')]);return _0x2b97c0[_0xd4a1('0x67')](_0x41a384);}})[_0xd4a1('0x2b')](function(_0x2ac4e){if(_0x2ac4e){_0x1510d5=_0x2ac4e[_0xd4a1('0x3f')];if(!_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x5d')](_0xd4a1('0x5e'))){_0x41a384['limit']=qs['limit'](_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x23')]);_0x41a384[_0xd4a1('0x22')]=qs[_0xd4a1('0x22')](_0x3e46d5[_0xd4a1('0x3a')][_0xd4a1('0x22')]);}return _0x2b97c0[_0xd4a1('0x67')](_0x41a384);}})[_0xd4a1('0x2b')](function(_0xcfa125){if(_0xcfa125){return _0xcfa125?{'count':_0x1510d5,'rows':_0xcfa125}:null;}})['then'](respondWithResult(_0x11baef,null))['catch'](handleError(_0x11baef,null));};exports['addTeams']=function(_0x197039,_0x29ce3b,_0x412c64){var _0x145190=_0x197039[_0xd4a1('0x50')][_0xd4a1('0x6a')];return db[_0xd4a1('0x68')][_0xd4a1('0x60')]({'where':{'id':_0x145190},'attributes':['id'],'include':[{'model':db[_0xd4a1('0x6b')],'as':'Agents','attributes':['id',_0xd4a1('0x31'),'online',_0xd4a1('0x6c'),_0xd4a1('0x6d')],'raw':!![]}]})['then'](function(_0x492d0d){if(_0x492d0d){var _0x18fe18=_['flatMap'](_0x492d0d,function(_0x5d8089){var _0x293ea1=_0x5d8089['get']({'plain':!![]});return _0x293ea1[_0xd4a1('0x6e')];});return db['MailQueue'][_0xd4a1('0x4e')]({'where':{'id':_0x197039['params']['id']}})[_0xd4a1('0x2b')](function(_0xe134b1){return db[_0xd4a1('0x6f')][_0xd4a1('0x70')](function(_0xb9186d){return _0xe134b1[_0xd4a1('0x71')](_0x145190,{'transaction':_0xb9186d})[_0xd4a1('0x2b')](function(){return BPromise['each'](_0x18fe18,function(_0x39d0fb){return db[_0xd4a1('0x5c')][_0xd4a1('0x72')]({'where':{'UserId':_0x39d0fb['id'],'MailQueueId':_0x197039['params']['id']},'transaction':_0xb9186d});});})[_0xd4a1('0x2b')](function(){_0x18fe18[_0xd4a1('0x73')](function(_0x172500){socket[_0xd4a1('0x74')]('userMailQueue:save',{'UserId':_0x172500['id'],'MailQueueId':_0xe134b1['id']});});});});});}})['then'](respondWithStatusCode(_0x29ce3b,null))[_0xd4a1('0x56')](handleError(_0x29ce3b,null));};exports['removeTeams']=function(_0x543b5a,_0x1d939c,_0x16a2bd){return db[_0xd4a1('0x68')][_0xd4a1('0x60')]({'where':{'id':_0x543b5a['query'][_0xd4a1('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d939c,null))['then'](function(_0x16d9d9){var _0x35316b=_[_0xd4a1('0x34')](_0x16d9d9,'id');var _0x108bae=[];var _0x296dd3=[];var _0x2a6266=squel[_0xd4a1('0x75')]();_0x2a6266[_0xd4a1('0x76')]('tq.TeamId')['from'](_0xd4a1('0x77'),'tq')[_0xd4a1('0x78')]('user_has_teams','ut',_0xd4a1('0x79'))[_0xd4a1('0x43')](_0xd4a1('0x7a'),_0x543b5a[_0xd4a1('0x4c')]['id']);for(var _0xee1965=0x0;_0xee1965<_0x16d9d9[_0xd4a1('0x3f')];_0xee1965+=0x1){let _0x915900=_0x16d9d9[_0xee1965];for(var _0x18b476=0x0;_0x18b476<_0x915900[_0xd4a1('0x6e')]['length'];_0x18b476+=0x1){let _0x4f42ad=_0x915900[_0xd4a1('0x6e')][_0x18b476];var _0x36215a=_0x2a6266['clone']();_0x36215a[_0xd4a1('0x43')](_0xd4a1('0x7b'),_0x4f42ad['id']);_0x296dd3[_0xd4a1('0x7c')](db['sequelize'][_0xd4a1('0x3a')](_0x36215a[_0xd4a1('0x7d')](),{'type':db[_0xd4a1('0x6f')][_0xd4a1('0x7e')][_0xd4a1('0x7f')]})[_0xd4a1('0x2b')](function(_0x3523e6){if(_0x3523e6[_0xd4a1('0x3f')]===0x1){return _0x4f42ad['id'];}else{var _0x50d008=_[_0xd4a1('0x80')](_[_0xd4a1('0x34')](_0x3523e6,_0xd4a1('0x81')),function(_0x37bd15){return _['includes'](_0x35316b,_0x37bd15);});if(_0x50d008){return _0x4f42ad['id'];}}}));}}return BPromise[_0xd4a1('0x82')](_0x296dd3)[_0xd4a1('0x2b')](function(_0x5ec752){_0x108bae=_(_0x108bae)['union'](_0x5ec752)[_0xd4a1('0x83')]()['value']();return db[_0xd4a1('0x35')]['find']({'where':{'id':_0x543b5a['params']['id']}})[_0xd4a1('0x2b')](function(_0x5bfc37){return db[_0xd4a1('0x6f')]['transaction'](function(_0x332dfd){return _0x5bfc37[_0xd4a1('0x84')](_0x543b5a['query'][_0xd4a1('0x6a')],{'transaction':_0x332dfd})[_0xd4a1('0x2b')](function(){if(!_['isEmpty'](_0x108bae)){return _0x5bfc37['removeAgents'](_0x108bae,{'transaction':_0x332dfd});}})['then'](function(){_0x108bae[_0xd4a1('0x73')](function(_0x357c0b){socket['emit']('userMailQueue:remove',{'UserId':_0x357c0b,'MailQueueId':_0x5bfc37['id']});});});});});});})[_0xd4a1('0x2b')](respondWithStatusCode(_0x1d939c,null))[_0xd4a1('0x56')](handleError(_0x1d939c,null));};exports[_0xd4a1('0x85')]=function(_0x5ca36a,_0x4d68c7,_0x3d7115){return db['MailQueue'][_0xd4a1('0x4e')]({'where':{'id':_0x5ca36a[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x4d68c7,null))[_0xd4a1('0x2b')](function(_0x4ae73f){if(_0x4ae73f){return _0x4ae73f[_0xd4a1('0x85')](_0x5ca36a[_0xd4a1('0x50')][_0xd4a1('0x6a')],_[_0xd4a1('0x86')](_0x5ca36a[_0xd4a1('0x50')],[_0xd4a1('0x6a'),'id'])||{})[_0xd4a1('0x87')](function(_0x457a2a){for(var _0x4bb0cf=0x0;_0x4bb0cf<_0x5ca36a[_0xd4a1('0x50')][_0xd4a1('0x6a')][_0xd4a1('0x3f')];_0x4bb0cf+=0x1){socket[_0xd4a1('0x74')]('userMailQueue:save',{'UserId':_0x5ca36a['body']['ids'][_0x4bb0cf],'MailQueueId':_0x5ca36a[_0xd4a1('0x4c')]['id']});}return _0x457a2a;});}})['then'](respondWithResult(_0x4d68c7,null))[_0xd4a1('0x56')](handleError(_0x4d68c7,null));};exports['removeAgents']=function(_0x1d27b0,_0x2d5e7e,_0x1f762d){return db[_0xd4a1('0x35')][_0xd4a1('0x4e')]({'where':{'id':_0x1d27b0[_0xd4a1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d5e7e,null))[_0xd4a1('0x2b')](function(_0x183c4e){if(_0x183c4e){return _0x183c4e[_0xd4a1('0x88')](_0x1d27b0[_0xd4a1('0x3a')][_0xd4a1('0x6a')])[_0xd4a1('0x2b')](function(){if(_[_0xd4a1('0x89')](_0x1d27b0[_0xd4a1('0x3a')][_0xd4a1('0x6a')])){for(var _0x416db4=0x0;_0x416db4<_0x1d27b0[_0xd4a1('0x3a')][_0xd4a1('0x6a')][_0xd4a1('0x3f')];_0x416db4+=0x1){socket[_0xd4a1('0x74')](_0xd4a1('0x8a'),{'UserId':Number(_0x1d27b0[_0xd4a1('0x3a')]['ids'][_0x416db4]),'MailQueueId':Number(_0x1d27b0['params']['id'])});}}else{socket[_0xd4a1('0x74')](_0xd4a1('0x8a'),{'UserId':Number(_0x1d27b0[_0xd4a1('0x3a')]['ids']),'MailQueueId':Number(_0x1d27b0['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2d5e7e,null))[_0xd4a1('0x56')](handleError(_0x2d5e7e,null));};exports[_0xd4a1('0x8b')]=function(_0x44e6bd,_0x1c6ffd,_0x30acca){var _0x6f63c2={};var _0x122199={};var _0x434cf6;var _0x4fa17b;return db[_0xd4a1('0x35')][_0xd4a1('0x5b')]({'where':{'id':_0x44e6bd[_0xd4a1('0x4c')]['id']}})[_0xd4a1('0x2b')](handleEntityNotFound(_0x1c6ffd,null))[_0xd4a1('0x2b')](function(_0x4b3fa1){if(_0x4b3fa1){_0x434cf6=_0x4b3fa1;_0x122199['model']=_[_0xd4a1('0x4d')](db['User'][_0xd4a1('0x36')]);_0x122199[_0xd4a1('0x3a')]=_[_0xd4a1('0x4d')](_0x44e6bd[_0xd4a1('0x3a')]);_0x122199['filters']=_[_0xd4a1('0x3d')](_0x122199['model'],_0x122199[_0xd4a1('0x3a')]);_0x6f63c2[_0xd4a1('0x3c')]=_[_0xd4a1('0x3d')](_0x122199[_0xd4a1('0x39')],qs['fields'](_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x3e')]));_0x6f63c2[_0xd4a1('0x3c')]=_0x6f63c2[_0xd4a1('0x3c')]['length']?_0x6f63c2[_0xd4a1('0x3c')]:_0x122199[_0xd4a1('0x39')];_0x6f63c2[_0xd4a1('0x40')]=qs['sort'](_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x41')]);_0x6f63c2['where']=qs[_0xd4a1('0x3b')](_[_0xd4a1('0x69')](_0x44e6bd[_0xd4a1('0x3a')],_0x122199[_0xd4a1('0x3b')]));if(_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x42')]){_0x6f63c2[_0xd4a1('0x43')]=_[_0xd4a1('0x44')](_0x6f63c2[_0xd4a1('0x43')],{'$or':_['map'](_0x6f63c2['attributes'],function(_0x8e544a){var _0x77fe52={};_0x77fe52[_0x8e544a]={'$like':'%'+_0x44e6bd['query'][_0xd4a1('0x42')]+'%'};return _0x77fe52;})});}_0x6f63c2=_[_0xd4a1('0x44')]({},_0x6f63c2,_0x44e6bd[_0xd4a1('0x47')]);return _0x434cf6['getAgents'](_0x6f63c2);}})[_0xd4a1('0x2b')](function(_0x3d3067){if(_0x3d3067){_0x4fa17b=_0x3d3067[_0xd4a1('0x3f')];if(!_0x44e6bd[_0xd4a1('0x3a')]['hasOwnProperty'](_0xd4a1('0x5e'))){_0x6f63c2[_0xd4a1('0x23')]=qs[_0xd4a1('0x23')](_0x44e6bd[_0xd4a1('0x3a')][_0xd4a1('0x23')]);_0x6f63c2[_0xd4a1('0x22')]=qs[_0xd4a1('0x22')](_0x44e6bd[_0xd4a1('0x3a')]['offset']);}return _0x434cf6[_0xd4a1('0x8b')](_0x6f63c2);}})[_0xd4a1('0x2b')](function(_0x48aee5){if(_0x48aee5){return _0x48aee5?{'count':_0x4fa17b,'rows':_0x48aee5}:null;}})['then'](respondWithResult(_0x1c6ffd,null))[_0xd4a1('0x56')](handleError(_0x1c6ffd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b24feca..54cc950 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 _0xdb57=['setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x1e67e0,_0x43cc4b){var _0x108b34=function(_0x5cc50e){while(--_0x5cc50e){_0x1e67e0['push'](_0x1e67e0['shift']());}};_0x108b34(++_0x43cc4b);}(_0xdb57,0x11d));var _0x7db5=function(_0x56753a,_0x269d41){_0x56753a=_0x56753a-0x0;var _0x7bc06d=_0xdb57[_0x56753a];return _0x7bc06d;};'use strict';var EventEmitter=require(_0x7db5('0x0'));var MailQueue=require(_0x7db5('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7db5('0x2')](0x0);var events={'afterCreate':_0x7db5('0x3'),'afterUpdate':_0x7db5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33dde8){return function(_0x26b752,_0x459186,_0x1ea8dc){MailQueueEvents[_0x7db5('0x5')](_0x33dde8+':'+_0x26b752['id'],_0x26b752);MailQueueEvents[_0x7db5('0x5')](_0x33dde8,_0x26b752);_0x1ea8dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x7db5('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x8791=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5d8c39,_0x388d1d){var _0x1cfe93=function(_0x1bc650){while(--_0x1bc650){_0x5d8c39['push'](_0x5d8c39['shift']());}};_0x1cfe93(++_0x388d1d);}(_0x8791,0xdd));var _0x1879=function(_0x19c105,_0x16b945){_0x19c105=_0x19c105-0x0;var _0x5206bf=_0x8791[_0x19c105];return _0x5206bf;};'use strict';var EventEmitter=require(_0x1879('0x0'));var MailQueue=require(_0x1879('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1879('0x2')](0x0);var events={'afterCreate':_0x1879('0x3'),'afterUpdate':_0x1879('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bf31f){return function(_0x284fc5,_0x2ea75d,_0x4a8655){MailQueueEvents[_0x1879('0x5')](_0x4bf31f+':'+_0x284fc5['id'],_0x284fc5);MailQueueEvents[_0x1879('0x5')](_0x4bf31f,_0x284fc5);_0x4a8655(null);};}for(var e in events){if(events[_0x1879('0x6')](e)){var event=events[e];MailQueue[_0x1879('0x7')](e,emitEvent(event));}}module[_0x1879('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 b4444bc..4dc9235 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 _0xd987=['lodash','util','api','moment','bluebird','request-promise','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x528314,_0x4d6ed7){var _0x23d2d0=function(_0x3712a5){while(--_0x3712a5){_0x528314['push'](_0x528314['shift']());}};_0x23d2d0(++_0x4d6ed7);}(_0xd987,0x186));var _0x7d98=function(_0x2c4960,_0x44d821){_0x2c4960=_0x2c4960-0x0;var _0x2d08ab=_0xd987[_0x2c4960];return _0x2d08ab;};'use strict';var _=require(_0x7d98('0x0'));var util=require(_0x7d98('0x1'));var logger=require('../../config/logger')(_0x7d98('0x2'));var moment=require(_0x7d98('0x3'));var BPromise=require(_0x7d98('0x4'));var rp=require(_0x7d98('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d98('0x6'));module[_0x7d98('0x7')]=function(_0x4c0e50,_0x14a267){return _0x4c0e50[_0x7d98('0x8')](_0x7d98('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb979=['moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','define','util','../../config/logger','api'];(function(_0x37ffcd,_0x267c81){var _0x228cca=function(_0x4db723){while(--_0x4db723){_0x37ffcd['push'](_0x37ffcd['shift']());}};_0x228cca(++_0x267c81);}(_0xb979,0x1bf));var _0x9b97=function(_0x519b57,_0x5cfe04){_0x519b57=_0x519b57-0x0;var _0x27b8d0=_0xb979[_0x519b57];return _0x27b8d0;};'use strict';var _=require('lodash');var util=require(_0x9b97('0x0'));var logger=require(_0x9b97('0x1'))(_0x9b97('0x2'));var moment=require(_0x9b97('0x3'));var BPromise=require(_0x9b97('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b97('0x5'));var rimraf=require(_0x9b97('0x6'));var config=require(_0x9b97('0x7'));var attributes=require(_0x9b97('0x8'));module['exports']=function(_0x1e12d8,_0x588e1f){return _0x1e12d8[_0x9b97('0x9')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index fd7b55a..513f74c 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 _0xbee5=['catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','map','model','ShowMailQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message'];(function(_0x38bdff,_0x4633e4){var _0x4ce52e=function(_0x2b35c1){while(--_0x2b35c1){_0x38bdff['push'](_0x38bdff['shift']());}};_0x4ce52e(++_0x4633e4);}(_0xbee5,0x110));var _0x5bee=function(_0x4735f9,_0x243a06){_0x4735f9=_0x4735f9-0x0;var _0x6f14d9=_0xbee5[_0x4735f9];return _0x6f14d9;};'use strict';var _=require(_0x5bee('0x0'));var util=require(_0x5bee('0x1'));var moment=require(_0x5bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x5bee('0x3'));var fs=require('fs');var Redis=require(_0x5bee('0x4'));var db=require(_0x5bee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bee('0x6'))('rpc');var config=require(_0x5bee('0x7'));var jayson=require(_0x5bee('0x8'));var client=jayson[_0x5bee('0x9')]['http']({'port':0x232a});config[_0x5bee('0xa')]=_[_0x5bee('0xb')](config[_0x5bee('0xa')],{'host':_0x5bee('0xc'),'port':0x18eb});var socket=require(_0x5bee('0xd'))(new Redis(config[_0x5bee('0xa')]));require(_0x5bee('0xe'))['register'](socket);function respondWithRpcPromise(_0x39ac3d,_0x161942,_0x44d6cb){return new BPromise(function(_0x127319,_0x17d164){return client['request'](_0x39ac3d,_0x44d6cb)[_0x5bee('0xf')](function(_0x438c45){logger[_0x5bee('0x10')]('MailQueue,\x20%s,\x20%s',_0x161942,_0x5bee('0x11'));logger[_0x5bee('0x12')](_0x5bee('0x13'),_0x161942,_0x5bee('0x11'),JSON[_0x5bee('0x14')](_0x438c45));if(_0x438c45[_0x5bee('0x15')]){if(_0x438c45[_0x5bee('0x15')]['code']===0x1f4){logger[_0x5bee('0x15')](_0x5bee('0x16'),_0x161942,_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);return _0x17d164(_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);}logger[_0x5bee('0x15')]('MailQueue,\x20%s,\x20%s',_0x161942,_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);return _0x127319(_0x438c45[_0x5bee('0x15')][_0x5bee('0x17')]);}else{logger[_0x5bee('0x10')](_0x5bee('0x16'),_0x161942,_0x5bee('0x11'));_0x127319(_0x438c45['result'][_0x5bee('0x17')]);}})[_0x5bee('0x18')](function(_0x18490f){logger[_0x5bee('0x15')](_0x5bee('0x16'),_0x161942,_0x18490f);_0x17d164(_0x18490f);});});}exports[_0x5bee('0x19')]=function(_0xd53d8e){var _0xaad4a7=this;return new Promise(function(_0x375e56,_0x3f00ae){return db[_0x5bee('0x1a')][_0x5bee('0x1b')]({'raw':_0xd53d8e['options']?_0xd53d8e[_0x5bee('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd53d8e[_0x5bee('0x1c')]?_0xd53d8e['options']['where']||null:null,'attributes':_0xd53d8e['options']?_0xd53d8e[_0x5bee('0x1c')][_0x5bee('0x1d')]||null:null,'limit':_0xd53d8e[_0x5bee('0x1c')]?_0xd53d8e['options'][_0x5bee('0x1e')]||null:null,'include':_0xd53d8e[_0x5bee('0x1c')]?_0xd53d8e['options'][_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0xd53d8e['options'][_0x5bee('0x1f')],function(_0x2abadc){return{'model':db[_0x2abadc[_0x5bee('0x21')]],'as':_0x2abadc['as'],'attributes':_0x2abadc[_0x5bee('0x1d')],'include':_0x2abadc[_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0x2abadc[_0x5bee('0x1f')],function(_0x102219){return{'model':db[_0x102219[_0x5bee('0x21')]],'as':_0x102219['as'],'attributes':_0x102219[_0x5bee('0x1d')],'include':_0x102219[_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0x102219['include'],function(_0x47cf06){return{'model':db[_0x47cf06[_0x5bee('0x21')]],'as':_0x47cf06['as'],'attributes':_0x47cf06[_0x5bee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5bee('0xf')](function(_0xe91c65){logger['info'](_0x5bee('0x19'),_0xd53d8e);logger[_0x5bee('0x12')](_0x5bee('0x19'),_0xd53d8e,JSON[_0x5bee('0x14')](_0xe91c65));_0x375e56(_0xe91c65);})[_0x5bee('0x18')](function(_0x22a63d){logger['error'](_0x5bee('0x19'),_0x22a63d[_0x5bee('0x17')],_0xd53d8e);_0x3f00ae(_0xaad4a7[_0x5bee('0x15')](0x1f4,_0x22a63d[_0x5bee('0x17')]));});});};exports[_0x5bee('0x22')]=function(_0x1bf360){var _0x305e8c=this;return new Promise(function(_0x441ed7,_0x193230){return db[_0x5bee('0x1a')][_0x5bee('0x23')]({'raw':_0x1bf360['options']?_0x1bf360[_0x5bee('0x1c')][_0x5bee('0x24')]===undefined?!![]:![]:!![],'where':_0x1bf360[_0x5bee('0x1c')]?_0x1bf360[_0x5bee('0x1c')]['where']||null:null,'attributes':_0x1bf360[_0x5bee('0x1c')]?_0x1bf360[_0x5bee('0x1c')]['attributes']||null:null,'include':_0x1bf360[_0x5bee('0x1c')]?_0x1bf360[_0x5bee('0x1c')][_0x5bee('0x1f')]?_['map'](_0x1bf360['options']['include'],function(_0x455cd6){return{'model':db[_0x455cd6[_0x5bee('0x21')]],'as':_0x455cd6['as'],'attributes':_0x455cd6[_0x5bee('0x1d')],'include':_0x455cd6[_0x5bee('0x1f')]?_[_0x5bee('0x20')](_0x455cd6['include'],function(_0x3e0940){return{'model':db[_0x3e0940[_0x5bee('0x21')]],'as':_0x3e0940['as'],'attributes':_0x3e0940['attributes'],'include':_0x3e0940['include']?_[_0x5bee('0x20')](_0x3e0940[_0x5bee('0x1f')],function(_0x31cbbe){return{'model':db[_0x31cbbe[_0x5bee('0x21')]],'as':_0x31cbbe['as'],'attributes':_0x31cbbe[_0x5bee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5bee('0xf')](function(_0x370e04){logger['info']('ShowMailQueue',_0x1bf360);logger[_0x5bee('0x12')](_0x5bee('0x22'),_0x1bf360,JSON[_0x5bee('0x14')](_0x370e04));_0x441ed7(_0x370e04);})['catch'](function(_0x19f85f){logger['error'](_0x5bee('0x22'),_0x19f85f[_0x5bee('0x17')],_0x1bf360);_0x193230(_0x305e8c['error'](0x1f4,_0x19f85f['message']));});});}; \ No newline at end of file +var _0xbcd0=['then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x22babc,_0x434b80){var _0x3641ef=function(_0x45f351){while(--_0x45f351){_0x22babc['push'](_0x22babc['shift']());}};_0x3641ef(++_0x434b80);}(_0xbcd0,0xb8));var _0x0bcd=function(_0x37e2b0,_0x5ba5dd){_0x37e2b0=_0x37e2b0-0x0;var _0xe03021=_0xbcd0[_0x37e2b0];return _0xe03021;};'use strict';var _=require(_0x0bcd('0x0'));var util=require(_0x0bcd('0x1'));var moment=require(_0x0bcd('0x2'));var BPromise=require(_0x0bcd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bcd('0x4'));var db=require(_0x0bcd('0x5'))['db'];var utils=require(_0x0bcd('0x6'));var logger=require(_0x0bcd('0x7'))(_0x0bcd('0x8'));var config=require(_0x0bcd('0x9'));var jayson=require(_0x0bcd('0xa'));var client=jayson['client'][_0x0bcd('0xb')]({'port':0x232a});config[_0x0bcd('0xc')]=_['defaults'](config[_0x0bcd('0xc')],{'host':_0x0bcd('0xd'),'port':0x18eb});var socket=require(_0x0bcd('0xe'))(new Redis(config['redis']));require(_0x0bcd('0xf'))['register'](socket);function respondWithRpcPromise(_0x571fce,_0x4fd427,_0x14090f){return new BPromise(function(_0x2fb1f2,_0x1222e1){return client['request'](_0x571fce,_0x14090f)[_0x0bcd('0x10')](function(_0x32f4e8){logger[_0x0bcd('0x11')](_0x0bcd('0x12'),_0x4fd427,_0x0bcd('0x13'));logger[_0x0bcd('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4fd427,_0x0bcd('0x13'),JSON[_0x0bcd('0x15')](_0x32f4e8));if(_0x32f4e8[_0x0bcd('0x16')]){if(_0x32f4e8[_0x0bcd('0x16')][_0x0bcd('0x17')]===0x1f4){logger[_0x0bcd('0x16')](_0x0bcd('0x12'),_0x4fd427,_0x32f4e8[_0x0bcd('0x16')][_0x0bcd('0x18')]);return _0x1222e1(_0x32f4e8[_0x0bcd('0x16')][_0x0bcd('0x18')]);}logger[_0x0bcd('0x16')](_0x0bcd('0x12'),_0x4fd427,_0x32f4e8[_0x0bcd('0x16')]['message']);return _0x2fb1f2(_0x32f4e8['error']['message']);}else{logger[_0x0bcd('0x11')](_0x0bcd('0x12'),_0x4fd427,_0x0bcd('0x13'));_0x2fb1f2(_0x32f4e8[_0x0bcd('0x19')][_0x0bcd('0x18')]);}})[_0x0bcd('0x1a')](function(_0x52785e){logger[_0x0bcd('0x16')](_0x0bcd('0x12'),_0x4fd427,_0x52785e);_0x1222e1(_0x52785e);});});}exports[_0x0bcd('0x1b')]=function(_0x562a35){var _0xf8b76f=this;return new Promise(function(_0x1f886d,_0x2b18bb){return db[_0x0bcd('0x1c')][_0x0bcd('0x1d')]({'raw':_0x562a35[_0x0bcd('0x1e')]?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x1f')]===undefined?!![]:![]:!![],'where':_0x562a35[_0x0bcd('0x1e')]?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x20')]||null:null,'attributes':_0x562a35['options']?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x21')]||null:null,'limit':_0x562a35[_0x0bcd('0x1e')]?_0x562a35['options'][_0x0bcd('0x22')]||null:null,'include':_0x562a35['options']?_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x562a35[_0x0bcd('0x1e')][_0x0bcd('0x23')],function(_0x16065b){return{'model':db[_0x16065b['model']],'as':_0x16065b['as'],'attributes':_0x16065b['attributes'],'include':_0x16065b[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x16065b[_0x0bcd('0x23')],function(_0x1d994f){return{'model':db[_0x1d994f['model']],'as':_0x1d994f['as'],'attributes':_0x1d994f[_0x0bcd('0x21')],'include':_0x1d994f[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x1d994f[_0x0bcd('0x23')],function(_0x67c8c2){return{'model':db[_0x67c8c2[_0x0bcd('0x25')]],'as':_0x67c8c2['as'],'attributes':_0x67c8c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x0bcd('0x10')](function(_0x15e33c){logger['info'](_0x0bcd('0x1b'),_0x562a35);logger[_0x0bcd('0x14')](_0x0bcd('0x1b'),_0x562a35,JSON[_0x0bcd('0x15')](_0x15e33c));_0x1f886d(_0x15e33c);})[_0x0bcd('0x1a')](function(_0x4f7a96){logger['error']('GetMailQueue',_0x4f7a96['message'],_0x562a35);_0x2b18bb(_0xf8b76f[_0x0bcd('0x16')](0x1f4,_0x4f7a96[_0x0bcd('0x18')]));});});};exports[_0x0bcd('0x26')]=function(_0x136463){var _0x206607=this;return new Promise(function(_0x3e5697,_0x4aacec){return db[_0x0bcd('0x1c')][_0x0bcd('0x27')]({'raw':_0x136463[_0x0bcd('0x1e')]?_0x136463['options']['raw']===undefined?!![]:![]:!![],'where':_0x136463['options']?_0x136463['options'][_0x0bcd('0x20')]||null:null,'attributes':_0x136463[_0x0bcd('0x1e')]?_0x136463[_0x0bcd('0x1e')][_0x0bcd('0x21')]||null:null,'include':_0x136463[_0x0bcd('0x1e')]?_0x136463[_0x0bcd('0x1e')][_0x0bcd('0x23')]?_['map'](_0x136463[_0x0bcd('0x1e')][_0x0bcd('0x23')],function(_0x551b37){return{'model':db[_0x551b37[_0x0bcd('0x25')]],'as':_0x551b37['as'],'attributes':_0x551b37[_0x0bcd('0x21')],'include':_0x551b37[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x551b37['include'],function(_0x22e505){return{'model':db[_0x22e505[_0x0bcd('0x25')]],'as':_0x22e505['as'],'attributes':_0x22e505[_0x0bcd('0x21')],'include':_0x22e505[_0x0bcd('0x23')]?_[_0x0bcd('0x24')](_0x22e505[_0x0bcd('0x23')],function(_0x36e240){return{'model':db[_0x36e240['model']],'as':_0x36e240['as'],'attributes':_0x36e240[_0x0bcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0bcd('0x10')](function(_0x377a74){logger[_0x0bcd('0x11')](_0x0bcd('0x26'),_0x136463);logger[_0x0bcd('0x14')](_0x0bcd('0x26'),_0x136463,JSON[_0x0bcd('0x15')](_0x377a74));_0x3e5697(_0x377a74);})[_0x0bcd('0x1a')](function(_0x49e826){logger[_0x0bcd('0x16')](_0x0bcd('0x26'),_0x49e826[_0x0bcd('0x18')],_0x136463);_0x4aacec(_0x206607[_0x0bcd('0x16')](0x1f4,_0x49e826[_0x0bcd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c10c1d8..912b520 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 _0x5c57=['removeListener','register','mailQueue:','./mailQueue.events','save','update'];(function(_0x61e5ab,_0x37dbf7){var _0x48aff9=function(_0x4945f5){while(--_0x4945f5){_0x61e5ab['push'](_0x61e5ab['shift']());}};_0x48aff9(++_0x37dbf7);}(_0x5c57,0x189));var _0x75c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c57[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x75c5('0x0'));var events=[_0x75c5('0x1'),'remove',_0x75c5('0x2')];function createListener(_0xbe61a8,_0x374f25){return function(_0x3ccb8a){_0x374f25['emit'](_0xbe61a8,_0x3ccb8a);};}function removeListener(_0x437c31,_0x4cfa17){return function(){MailQueueEvents[_0x75c5('0x3')](_0x437c31,_0x4cfa17);};}exports[_0x75c5('0x4')]=function(_0x62c98a){for(var _0xb8b2e4=0x0,_0x4e566a=events['length'];_0xb8b2e4<_0x4e566a;_0xb8b2e4++){var _0x2f4de9=events[_0xb8b2e4];var _0x2a969f=createListener(_0x75c5('0x5')+_0x2f4de9,_0x62c98a);MailQueueEvents['on'](_0x2f4de9,_0x2a969f);}}; \ No newline at end of file +var _0xcb7b=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcb7b,0x116));var _0xbcb7=function(_0x59b3aa,_0x5b6618){_0x59b3aa=_0x59b3aa-0x0;var _0x436513=_0xcb7b[_0x59b3aa];return _0x436513;};'use strict';var MailQueueEvents=require(_0xbcb7('0x0'));var events=[_0xbcb7('0x1'),_0xbcb7('0x2'),_0xbcb7('0x3')];function createListener(_0x2eb006,_0x3c21bd){return function(_0x3e632c){_0x3c21bd[_0xbcb7('0x4')](_0x2eb006,_0x3e632c);};}function removeListener(_0x411d06,_0x3bcebc){return function(){MailQueueEvents[_0xbcb7('0x5')](_0x411d06,_0x3bcebc);};}exports[_0xbcb7('0x6')]=function(_0x46862c){for(var _0xce333d=0x0,_0x291d5e=events[_0xbcb7('0x7')];_0xce333d<_0x291d5e;_0xce333d++){var _0x4d08b5=events[_0xce333d];var _0xb4758d=createListener(_0xbcb7('0x8')+_0x4d08b5,_0x46862c);MailQueueEvents['on'](_0x4d08b5,_0xb4758d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 642ba74..39b1d8a 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 _0x74c6=['destroy','exports','util','path','express','Router','../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','isAuthenticated','/:id','create','update'];(function(_0x2955ed,_0x244239){var _0x1e5b07=function(_0x5e6b29){while(--_0x5e6b29){_0x2955ed['push'](_0x2955ed['shift']());}};_0x1e5b07(++_0x244239);}(_0x74c6,0xb6));var _0x674c=function(_0x1d37b5,_0x17e279){_0x1d37b5=_0x1d37b5-0x0;var _0x1c289c=_0x74c6[_0x1d37b5];return _0x1c289c;};'use strict';var multer=require('multer');var util=require(_0x674c('0x0'));var path=require(_0x674c('0x1'));var timeout=require('connect-timeout');var express=require(_0x674c('0x2'));var router=express[_0x674c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x674c('0x4'));var config=require('../../config/environment');var controller=require(_0x674c('0x5'));router[_0x674c('0x6')]('/',auth['isAuthenticated'](),controller[_0x674c('0x7')]);router[_0x674c('0x6')](_0x674c('0x8'),auth[_0x674c('0x9')](),controller['describe']);router['get'](_0x674c('0xa'),auth[_0x674c('0x9')](),controller['show']);router['post']('/',auth[_0x674c('0x9')](),controller[_0x674c('0xb')]);router['put'](_0x674c('0xa'),auth[_0x674c('0x9')](),controller[_0x674c('0xc')]);router['delete'](_0x674c('0xa'),auth[_0x674c('0x9')](),controller[_0x674c('0xd')]);module[_0x674c('0xe')]=router; \ No newline at end of file +var _0x77b2=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','show','post','put','/:id','update','delete','destroy','multer','path'];(function(_0x42e89c,_0x4522cb){var _0x5b9e3f=function(_0x488aa4){while(--_0x488aa4){_0x42e89c['push'](_0x42e89c['shift']());}};_0x5b9e3f(++_0x4522cb);}(_0x77b2,0x1d9));var _0x277b=function(_0x2687e5,_0x5d297f){_0x2687e5=_0x2687e5-0x0;var _0x2e7d32=_0x77b2[_0x2687e5];return _0x2e7d32;};'use strict';var multer=require(_0x277b('0x0'));var util=require('util');var path=require(_0x277b('0x1'));var timeout=require('connect-timeout');var express=require(_0x277b('0x2'));var router=express[_0x277b('0x3')]();var auth=require(_0x277b('0x4'));var interaction=require(_0x277b('0x5'));var config=require(_0x277b('0x6'));var controller=require(_0x277b('0x7'));router['get']('/',auth[_0x277b('0x8')](),controller[_0x277b('0x9')]);router[_0x277b('0xa')]('/describe',auth[_0x277b('0x8')](),controller[_0x277b('0xb')]);router[_0x277b('0xa')]('/:id',auth[_0x277b('0x8')](),controller[_0x277b('0xc')]);router[_0x277b('0xd')]('/',auth[_0x277b('0x8')](),controller['create']);router[_0x277b('0xe')](_0x277b('0xf'),auth['isAuthenticated'](),controller[_0x277b('0x10')]);router[_0x277b('0x11')](_0x277b('0xf'),auth[_0x277b('0x8')](),controller[_0x277b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a735d8d..e699953 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 _0xf02d=['STRING','DATE','moment','sequelize','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf02d,0xc5));var _0xdf02=function(_0x423269,_0x355384){_0x423269=_0x423269-0x0;var _0x490e2b=_0xf02d[_0x423269];return _0x490e2b;};'use strict';var moment=require(_0xdf02('0x0'));var Sequelize=require(_0xdf02('0x1'));module[_0xdf02('0x2')]={'uniqueid':{'type':Sequelize[_0xdf02('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdf02('0x3')]},'joinAt':{'type':Sequelize[_0xdf02('0x4')]},'leaveAt':{'type':Sequelize[_0xdf02('0x4')]},'acceptAt':{'type':Sequelize[_0xdf02('0x4')]},'exitAt':{'type':Sequelize[_0xdf02('0x4')]},'reason':{'type':Sequelize[_0xdf02('0x3')]}}; \ No newline at end of file +var _0x6f9d=['exports','STRING','DATE','sequelize'];(function(_0x4ac4d4,_0x5d7418){var _0x272afb=function(_0x14dda6){while(--_0x14dda6){_0x4ac4d4['push'](_0x4ac4d4['shift']());}};_0x272afb(++_0x5d7418);}(_0x6f9d,0x1d3));var _0xd6f9=function(_0x22153b,_0x4528ec){_0x22153b=_0x22153b-0x0;var _0x217dae=_0x6f9d[_0x22153b];return _0x217dae;};'use strict';var moment=require('moment');var Sequelize=require(_0xd6f9('0x0'));module[_0xd6f9('0x1')]={'uniqueid':{'type':Sequelize[_0xd6f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd6f9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd6f9('0x3')]},'acceptAt':{'type':Sequelize[_0xd6f9('0x3')]},'exitAt':{'type':Sequelize[_0xd6f9('0x3')]},'reason':{'type':Sequelize[_0xd6f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c52ec10..905f6d6 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 _0x70b9=['show','intersection','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','MailQueueReport','count','includeAll','include','findAll','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x70b9,0x17a));var _0x970b=function(_0x1af10c,_0x54e3c3){_0x1af10c=_0x1af10c-0x0;var _0x46267c=_0x70b9[_0x1af10c];return _0x46267c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x970b('0x0'));var zipdir=require(_0x970b('0x1'));var jsonpatch=require(_0x970b('0x2'));var rp=require(_0x970b('0x3'));var moment=require(_0x970b('0x4'));var BPromise=require(_0x970b('0x5'));var Mustache=require(_0x970b('0x6'));var util=require(_0x970b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x970b('0x8'));var ejs=require(_0x970b('0x9'));var fs=require('fs');var _=require(_0x970b('0xa'));var squel=require('squel');var crypto=require(_0x970b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x970b('0xc'));var toCsv=require(_0x970b('0x8'));var querystring=require(_0x970b('0xd'));var Papa=require(_0x970b('0xe'));var Redis=require(_0x970b('0xf'));var authService=require(_0x970b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x970b('0x11'));var hardwareService=require(_0x970b('0x12'));var logger=require(_0x970b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x970b('0x14'));var licenseUtil=require(_0x970b('0x15'));var db=require(_0x970b('0x16'))['db'];function respondWithStatusCode(_0x2cce16,_0x1beb28){_0x1beb28=_0x1beb28||0xcc;return function(_0x2032fb){if(_0x2032fb){return _0x2cce16[_0x970b('0x17')](_0x1beb28);}return _0x2cce16[_0x970b('0x18')](_0x1beb28)['end']();};}function respondWithResult(_0x4056e8,_0x184ca8){_0x184ca8=_0x184ca8||0xc8;return function(_0x471bb5){if(_0x471bb5){return _0x4056e8[_0x970b('0x18')](_0x184ca8)[_0x970b('0x19')](_0x471bb5);}};}function respondWithFilteredResult(_0x1584dc,_0x443fca){return function(_0x4acced){if(_0x4acced){var _0x99ee4b=_0x4acced['count'],_0x397b89=_0x443fca[_0x970b('0x1a')],_0x41d361=_0x443fca['offset']+_0x443fca[_0x970b('0x1b')],_0x42d64c;if(_0x41d361>=_0x99ee4b){_0x41d361=_0x99ee4b;_0x42d64c=0xc8;}else{_0x42d64c=0xce;}_0x1584dc[_0x970b('0x18')](_0x42d64c);return _0x1584dc[_0x970b('0x1c')](_0x970b('0x1d'),_0x397b89+'-'+_0x41d361+'/'+_0x99ee4b)[_0x970b('0x19')](_0x4acced);}return null;};}function patchUpdates(_0x53f095){return function(_0x1daeb3){try{jsonpatch['apply'](_0x1daeb3,_0x53f095,!![]);}catch(_0x438181){return BPromise[_0x970b('0x1e')](_0x438181);}return _0x1daeb3[_0x970b('0x1f')]();};}function saveUpdates(_0x3397d1,_0x2baaec){return function(_0x2b89f8){if(_0x2b89f8){return _0x2b89f8[_0x970b('0x20')](_0x3397d1)[_0x970b('0x21')](function(_0x16bd3b){return _0x16bd3b;});}return null;};}function removeEntity(_0x255124,_0xd227a0){return function(_0x1415dd){if(_0x1415dd){return _0x1415dd['destroy']()[_0x970b('0x21')](function(){_0x255124['status'](0xcc)[_0x970b('0x22')]();});}};}function handleEntityNotFound(_0x1b285b,_0x228bb3){return function(_0x5a102e){if(!_0x5a102e){_0x1b285b[_0x970b('0x17')](0x194);}return _0x5a102e;};}function handleError(_0x13f51f,_0x57492d){_0x57492d=_0x57492d||0x1f4;return function(_0x29cc43){logger[_0x970b('0x23')](_0x29cc43[_0x970b('0x24')]);if(_0x29cc43['name']){delete _0x29cc43[_0x970b('0x25')];}_0x13f51f[_0x970b('0x18')](_0x57492d)['send'](_0x29cc43);};}exports[_0x970b('0x26')]=function(_0x4d8bf7,_0x1cc0de){var _0x1cb077={},_0x3f26d1={},_0x47033d={'count':0x0,'rows':[]};var _0x31313a=_[_0x970b('0x27')](db['MailQueueReport'][_0x970b('0x28')],function(_0x5794a9){return{'name':_0x5794a9[_0x970b('0x29')],'type':_0x5794a9[_0x970b('0x2a')][_0x970b('0x2b')]};});_0x3f26d1[_0x970b('0x2c')]=_[_0x970b('0x27')](_0x31313a,_0x970b('0x25'));_0x3f26d1['query']=_[_0x970b('0x2d')](_0x4d8bf7['query']);_0x3f26d1[_0x970b('0x2e')]=_['intersection'](_0x3f26d1[_0x970b('0x2c')],_0x3f26d1[_0x970b('0x2f')]);_0x1cb077['attributes']=_['intersection'](_0x3f26d1['model'],qs[_0x970b('0x30')](_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x30')]));_0x1cb077[_0x970b('0x31')]=_0x1cb077[_0x970b('0x31')][_0x970b('0x32')]?_0x1cb077[_0x970b('0x31')]:_0x3f26d1[_0x970b('0x2c')];if(!_0x4d8bf7['query'][_0x970b('0x33')](_0x970b('0x34'))){_0x1cb077[_0x970b('0x1b')]=qs[_0x970b('0x1b')](_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x1b')]);_0x1cb077[_0x970b('0x1a')]=qs[_0x970b('0x1a')](_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x1a')]);}_0x1cb077[_0x970b('0x35')]=qs[_0x970b('0x36')](_0x4d8bf7['query'][_0x970b('0x36')]);_0x1cb077[_0x970b('0x37')]=qs['filters'](_['pick'](_0x4d8bf7[_0x970b('0x2f')],_0x3f26d1[_0x970b('0x2e')]),_0x31313a);if(_0x4d8bf7['query']['filter']){_0x1cb077['where']=_['merge'](_0x1cb077[_0x970b('0x37')],{'$or':_[_0x970b('0x27')](_0x31313a,function(_0x4fdcc0){if(_0x4fdcc0[_0x970b('0x2a')]!==_0x970b('0x38')){var _0x3536f6={};_0x3536f6[_0x4fdcc0[_0x970b('0x25')]]={'$like':'%'+_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x39')]+'%'};return _0x3536f6;}})});}_0x1cb077=_[_0x970b('0x3a')]({},_0x1cb077,_0x4d8bf7[_0x970b('0x3b')]);var _0x5ebbda={'where':_0x1cb077[_0x970b('0x37')]};return db[_0x970b('0x3c')][_0x970b('0x3d')](_0x5ebbda)['then'](function(_0x515499){_0x47033d[_0x970b('0x3d')]=_0x515499;if(_0x4d8bf7[_0x970b('0x2f')][_0x970b('0x3e')]){_0x1cb077[_0x970b('0x3f')]=[{'all':!![]}];}return db['MailQueueReport'][_0x970b('0x40')](_0x1cb077);})[_0x970b('0x21')](function(_0x19a8de){_0x47033d['rows']=_0x19a8de;return _0x47033d;})[_0x970b('0x21')](respondWithFilteredResult(_0x1cc0de,_0x1cb077))[_0x970b('0x41')](handleError(_0x1cc0de,null));};exports[_0x970b('0x42')]=function(_0x1ae6cb,_0x4719c8){var _0x266893={'raw':!![],'where':{'id':_0x1ae6cb['params']['id']}},_0x56af04={};_0x56af04[_0x970b('0x2c')]=_['keys'](db[_0x970b('0x3c')]['rawAttributes']);_0x56af04['query']=_[_0x970b('0x2d')](_0x1ae6cb['query']);_0x56af04['filters']=_[_0x970b('0x43')](_0x56af04[_0x970b('0x2c')],_0x56af04[_0x970b('0x2f')]);_0x266893[_0x970b('0x31')]=_['intersection'](_0x56af04[_0x970b('0x2c')],qs[_0x970b('0x30')](_0x1ae6cb['query'][_0x970b('0x30')]));_0x266893[_0x970b('0x31')]=_0x266893['attributes'][_0x970b('0x32')]?_0x266893['attributes']:_0x56af04[_0x970b('0x2c')];if(_0x1ae6cb[_0x970b('0x2f')][_0x970b('0x3e')]){_0x266893[_0x970b('0x3f')]=[{'all':!![]}];}_0x266893=_[_0x970b('0x3a')]({},_0x266893,_0x1ae6cb['options']);return db[_0x970b('0x3c')][_0x970b('0x44')](_0x266893)['then'](handleEntityNotFound(_0x4719c8,null))[_0x970b('0x21')](respondWithResult(_0x4719c8,null))[_0x970b('0x41')](handleError(_0x4719c8,null));};exports[_0x970b('0x45')]=function(_0x13c7fb,_0x2ecf8d){return db[_0x970b('0x3c')][_0x970b('0x45')](_0x13c7fb[_0x970b('0x46')],{})[_0x970b('0x21')](respondWithResult(_0x2ecf8d,0xc9))[_0x970b('0x41')](handleError(_0x2ecf8d,null));};exports[_0x970b('0x20')]=function(_0x13a0c3,_0x1a7f8a){if(_0x13a0c3[_0x970b('0x46')]['id']){delete _0x13a0c3['body']['id'];}return db[_0x970b('0x3c')][_0x970b('0x44')]({'where':{'id':_0x13a0c3[_0x970b('0x47')]['id']}})[_0x970b('0x21')](handleEntityNotFound(_0x1a7f8a,null))[_0x970b('0x21')](saveUpdates(_0x13a0c3[_0x970b('0x46')],null))[_0x970b('0x21')](respondWithResult(_0x1a7f8a,null))[_0x970b('0x41')](handleError(_0x1a7f8a,null));};exports[_0x970b('0x48')]=function(_0x2c7aa4,_0x4c6830){return db['MailQueueReport'][_0x970b('0x44')]({'where':{'id':_0x2c7aa4[_0x970b('0x47')]['id']}})[_0x970b('0x21')](handleEntityNotFound(_0x4c6830,null))['then'](removeEntity(_0x4c6830,null))[_0x970b('0x41')](handleError(_0x4c6830,null));};exports[_0x970b('0x49')]=function(_0x481de1,_0x2b0519){return db['MailQueueReport'][_0x970b('0x49')]()['then'](respondWithResult(_0x2b0519,null))['catch'](handleError(_0x2b0519,null));}; \ No newline at end of file +var _0x62e4=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','MailQueueReport','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel'];(function(_0x1f7fbf,_0x49e8c9){var _0x172e37=function(_0x39262b){while(--_0x39262b){_0x1f7fbf['push'](_0x1f7fbf['shift']());}};_0x172e37(++_0x49e8c9);}(_0x62e4,0x174));var _0x462e=function(_0x2e2c49,_0x57a847){_0x2e2c49=_0x2e2c49-0x0;var _0xaaa7ea=_0x62e4[_0x2e2c49];return _0xaaa7ea;};'use strict';var pdf=require(_0x462e('0x0'));var emlformat=require(_0x462e('0x1'));var rimraf=require(_0x462e('0x2'));var zipdir=require(_0x462e('0x3'));var jsonpatch=require(_0x462e('0x4'));var rp=require(_0x462e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x462e('0x6'));var util=require(_0x462e('0x7'));var path=require(_0x462e('0x8'));var sox=require('sox');var csv=require(_0x462e('0x9'));var ejs=require(_0x462e('0xa'));var fs=require('fs');var _=require(_0x462e('0xb'));var squel=require(_0x462e('0xc'));var crypto=require(_0x462e('0xd'));var jsforce=require(_0x462e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x462e('0x9'));var querystring=require(_0x462e('0xf'));var Papa=require(_0x462e('0x10'));var Redis=require(_0x462e('0x11'));var authService=require(_0x462e('0x12'));var qs=require(_0x462e('0x13'));var as=require(_0x462e('0x14'));var hardwareService=require(_0x462e('0x15'));var logger=require(_0x462e('0x16'))(_0x462e('0x17'));var utils=require(_0x462e('0x18'));var config=require(_0x462e('0x19'));var licenseUtil=require(_0x462e('0x1a'));var db=require(_0x462e('0x1b'))['db'];function respondWithStatusCode(_0x363833,_0x3d45fe){_0x3d45fe=_0x3d45fe||0xcc;return function(_0x212be8){if(_0x212be8){return _0x363833['sendStatus'](_0x3d45fe);}return _0x363833['status'](_0x3d45fe)['end']();};}function respondWithResult(_0x1ad17b,_0x5f3a06){_0x5f3a06=_0x5f3a06||0xc8;return function(_0x18374b){if(_0x18374b){return _0x1ad17b['status'](_0x5f3a06)['json'](_0x18374b);}};}function respondWithFilteredResult(_0x483261,_0x51e3f8){return function(_0x1e9b8f){if(_0x1e9b8f){var _0x1aa8cf=_0x1e9b8f['count'],_0x444b10=_0x51e3f8[_0x462e('0x1c')],_0x2948f0=_0x51e3f8[_0x462e('0x1c')]+_0x51e3f8[_0x462e('0x1d')],_0x1302b7;if(_0x2948f0>=_0x1aa8cf){_0x2948f0=_0x1aa8cf;_0x1302b7=0xc8;}else{_0x1302b7=0xce;}_0x483261[_0x462e('0x1e')](_0x1302b7);return _0x483261['set'](_0x462e('0x1f'),_0x444b10+'-'+_0x2948f0+'/'+_0x1aa8cf)['json'](_0x1e9b8f);}return null;};}function patchUpdates(_0x1589ce){return function(_0x195f02){try{jsonpatch[_0x462e('0x20')](_0x195f02,_0x1589ce,!![]);}catch(_0x4f5fbf){return BPromise[_0x462e('0x21')](_0x4f5fbf);}return _0x195f02[_0x462e('0x22')]();};}function saveUpdates(_0x45ed7b,_0x4f2f0a){return function(_0x1c6da8){if(_0x1c6da8){return _0x1c6da8[_0x462e('0x23')](_0x45ed7b)[_0x462e('0x24')](function(_0x41471c){return _0x41471c;});}return null;};}function removeEntity(_0x23ffa5,_0x4544cb){return function(_0x1861a4){if(_0x1861a4){return _0x1861a4[_0x462e('0x25')]()[_0x462e('0x24')](function(){_0x23ffa5['status'](0xcc)[_0x462e('0x26')]();});}};}function handleEntityNotFound(_0x3231a3,_0x413676){return function(_0x5b4d6f){if(!_0x5b4d6f){_0x3231a3[_0x462e('0x27')](0x194);}return _0x5b4d6f;};}function handleError(_0x29492a,_0xce85a9){_0xce85a9=_0xce85a9||0x1f4;return function(_0x2c5c14){logger[_0x462e('0x28')](_0x2c5c14['stack']);if(_0x2c5c14[_0x462e('0x29')]){delete _0x2c5c14['name'];}_0x29492a['status'](_0xce85a9)[_0x462e('0x2a')](_0x2c5c14);};}exports['index']=function(_0x4f270c,_0xec9bae){var _0x1f0fe3={},_0xcc5e4d={},_0x3541a9={'count':0x0,'rows':[]};var _0x2e1e58=_[_0x462e('0x2b')](db[_0x462e('0x2c')]['rawAttributes'],function(_0x45319c){return{'name':_0x45319c[_0x462e('0x2d')],'type':_0x45319c['type'][_0x462e('0x2e')]};});_0xcc5e4d['model']=_[_0x462e('0x2b')](_0x2e1e58,_0x462e('0x29'));_0xcc5e4d[_0x462e('0x2f')]=_['keys'](_0x4f270c[_0x462e('0x2f')]);_0xcc5e4d[_0x462e('0x30')]=_['intersection'](_0xcc5e4d[_0x462e('0x31')],_0xcc5e4d[_0x462e('0x2f')]);_0x1f0fe3[_0x462e('0x32')]=_[_0x462e('0x33')](_0xcc5e4d['model'],qs[_0x462e('0x34')](_0x4f270c[_0x462e('0x2f')][_0x462e('0x34')]));_0x1f0fe3[_0x462e('0x32')]=_0x1f0fe3[_0x462e('0x32')][_0x462e('0x35')]?_0x1f0fe3[_0x462e('0x32')]:_0xcc5e4d['model'];if(!_0x4f270c[_0x462e('0x2f')][_0x462e('0x36')]('nolimit')){_0x1f0fe3[_0x462e('0x1d')]=qs[_0x462e('0x1d')](_0x4f270c[_0x462e('0x2f')][_0x462e('0x1d')]);_0x1f0fe3[_0x462e('0x1c')]=qs[_0x462e('0x1c')](_0x4f270c['query']['offset']);}_0x1f0fe3[_0x462e('0x37')]=qs[_0x462e('0x38')](_0x4f270c[_0x462e('0x2f')][_0x462e('0x38')]);_0x1f0fe3[_0x462e('0x39')]=qs[_0x462e('0x30')](_[_0x462e('0x3a')](_0x4f270c[_0x462e('0x2f')],_0xcc5e4d[_0x462e('0x30')]),_0x2e1e58);if(_0x4f270c[_0x462e('0x2f')][_0x462e('0x3b')]){_0x1f0fe3['where']=_[_0x462e('0x3c')](_0x1f0fe3[_0x462e('0x39')],{'$or':_['map'](_0x2e1e58,function(_0x44690c){if(_0x44690c['type']!==_0x462e('0x3d')){var _0xc3bc3f={};_0xc3bc3f[_0x44690c[_0x462e('0x29')]]={'$like':'%'+_0x4f270c[_0x462e('0x2f')][_0x462e('0x3b')]+'%'};return _0xc3bc3f;}})});}_0x1f0fe3=_[_0x462e('0x3c')]({},_0x1f0fe3,_0x4f270c[_0x462e('0x3e')]);var _0x19e9d8={'where':_0x1f0fe3[_0x462e('0x39')]};return db[_0x462e('0x2c')][_0x462e('0x3f')](_0x19e9d8)[_0x462e('0x24')](function(_0x4ef960){_0x3541a9['count']=_0x4ef960;if(_0x4f270c[_0x462e('0x2f')][_0x462e('0x40')]){_0x1f0fe3[_0x462e('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x462e('0x42')](_0x1f0fe3);})[_0x462e('0x24')](function(_0x2e97ca){_0x3541a9[_0x462e('0x43')]=_0x2e97ca;return _0x3541a9;})['then'](respondWithFilteredResult(_0xec9bae,_0x1f0fe3))[_0x462e('0x44')](handleError(_0xec9bae,null));};exports[_0x462e('0x45')]=function(_0x2090ce,_0x70dfb7){var _0x2a7db2={'raw':!![],'where':{'id':_0x2090ce['params']['id']}},_0x5272f9={};_0x5272f9['model']=_[_0x462e('0x46')](db['MailQueueReport'][_0x462e('0x47')]);_0x5272f9[_0x462e('0x2f')]=_[_0x462e('0x46')](_0x2090ce[_0x462e('0x2f')]);_0x5272f9[_0x462e('0x30')]=_[_0x462e('0x33')](_0x5272f9[_0x462e('0x31')],_0x5272f9[_0x462e('0x2f')]);_0x2a7db2[_0x462e('0x32')]=_[_0x462e('0x33')](_0x5272f9[_0x462e('0x31')],qs[_0x462e('0x34')](_0x2090ce[_0x462e('0x2f')][_0x462e('0x34')]));_0x2a7db2['attributes']=_0x2a7db2[_0x462e('0x32')][_0x462e('0x35')]?_0x2a7db2[_0x462e('0x32')]:_0x5272f9['model'];if(_0x2090ce[_0x462e('0x2f')][_0x462e('0x40')]){_0x2a7db2['include']=[{'all':!![]}];}_0x2a7db2=_[_0x462e('0x3c')]({},_0x2a7db2,_0x2090ce['options']);return db['MailQueueReport']['find'](_0x2a7db2)['then'](handleEntityNotFound(_0x70dfb7,null))['then'](respondWithResult(_0x70dfb7,null))[_0x462e('0x44')](handleError(_0x70dfb7,null));};exports[_0x462e('0x48')]=function(_0x368659,_0x579dcd){return db[_0x462e('0x2c')]['create'](_0x368659[_0x462e('0x49')],{})[_0x462e('0x24')](respondWithResult(_0x579dcd,0xc9))[_0x462e('0x44')](handleError(_0x579dcd,null));};exports[_0x462e('0x23')]=function(_0x57b0f6,_0xcd891c){if(_0x57b0f6['body']['id']){delete _0x57b0f6[_0x462e('0x49')]['id'];}return db[_0x462e('0x2c')]['find']({'where':{'id':_0x57b0f6['params']['id']}})[_0x462e('0x24')](handleEntityNotFound(_0xcd891c,null))[_0x462e('0x24')](saveUpdates(_0x57b0f6[_0x462e('0x49')],null))[_0x462e('0x24')](respondWithResult(_0xcd891c,null))[_0x462e('0x44')](handleError(_0xcd891c,null));};exports['destroy']=function(_0x51abb9,_0x11c0fd){return db[_0x462e('0x2c')][_0x462e('0x4a')]({'where':{'id':_0x51abb9[_0x462e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11c0fd,null))[_0x462e('0x24')](removeEntity(_0x11c0fd,null))[_0x462e('0x44')](handleError(_0x11c0fd,null));};exports['describe']=function(_0x3f4744,_0x30716e){return db[_0x462e('0x2c')][_0x462e('0x4c')]()[_0x462e('0x24')](respondWithResult(_0x30716e,null))[_0x462e('0x44')](handleError(_0x30716e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b3b05bb..248afab 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 _0x3b18=['util','api','moment','bluebird','request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x4e2af7,_0x4d5fce){var _0x47a578=function(_0x159f07){while(--_0x159f07){_0x4e2af7['push'](_0x4e2af7['shift']());}};_0x47a578(++_0x4d5fce);}(_0x3b18,0xe4));var _0x83b1=function(_0x419a45,_0x34b2b1){_0x419a45=_0x419a45-0x0;var _0x13d057=_0x3b18[_0x419a45];return _0x13d057;};'use strict';var _=require('lodash');var util=require(_0x83b1('0x0'));var logger=require('../../config/logger')(_0x83b1('0x1'));var moment=require(_0x83b1('0x2'));var BPromise=require(_0x83b1('0x3'));var rp=require(_0x83b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x83b1('0x5'));var attributes=require(_0x83b1('0x6'));module[_0x83b1('0x7')]=function(_0x12ca97,_0x51ec0d){return _0x12ca97[_0x83b1('0x8')](_0x83b1('0x9'),attributes,{'tableName':_0x83b1('0xa'),'paranoid':![],'indexes':[{'name':_0x83b1('0xb'),'fields':[_0x83b1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96dc=['util','api','moment','bluebird','path','rimraf','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96dc,0x134));var _0xc96d=function(_0x3b6fca,_0x38a543){_0x3b6fca=_0x3b6fca-0x0;var _0x54667e=_0x96dc[_0x3b6fca];return _0x54667e;};'use strict';var _=require('lodash');var util=require(_0xc96d('0x0'));var logger=require('../../config/logger')(_0xc96d('0x1'));var moment=require(_0xc96d('0x2'));var BPromise=require(_0xc96d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc96d('0x4'));var rimraf=require(_0xc96d('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xc96d('0x6')]=function(_0x5b8f61,_0xb047bc){return _0x5b8f61[_0xc96d('0x7')](_0xc96d('0x8'),attributes,{'tableName':_0xc96d('0x9'),'paranoid':![],'indexes':[{'name':_0xc96d('0xa'),'fields':[_0xc96d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index cf8c907..a38e8f2 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 _0xe5a0=['MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateMailQueueReport','MailQueueReport','create','options','raw','stringify','catch','update','body','where','attributes','limit','UpdateMailQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5a0,0xee));var _0x0e5a=function(_0x62bb34,_0x2aeffd){_0x62bb34=_0x62bb34-0x0;var _0x6f986a=_0xe5a0[_0x62bb34];return _0x6f986a;};'use strict';var _=require(_0x0e5a('0x0'));var util=require('util');var moment=require(_0x0e5a('0x1'));var BPromise=require(_0x0e5a('0x2'));var rs=require(_0x0e5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e5a('0x4'))['db'];var utils=require(_0x0e5a('0x5'));var logger=require(_0x0e5a('0x6'))(_0x0e5a('0x7'));var config=require(_0x0e5a('0x8'));var jayson=require(_0x0e5a('0x9'));var client=jayson[_0x0e5a('0xa')][_0x0e5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dd580,_0x49f190,_0x2fe6aa){return new BPromise(function(_0xf7304c,_0x48073a){return client[_0x0e5a('0xc')](_0x5dd580,_0x2fe6aa)[_0x0e5a('0xd')](function(_0x1c4b6f){logger['info'](_0x0e5a('0xe'),_0x49f190,_0x0e5a('0xf'));logger[_0x0e5a('0x10')](_0x0e5a('0x11'),_0x49f190,_0x0e5a('0xf'),JSON['stringify'](_0x1c4b6f));if(_0x1c4b6f['error']){if(_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x13')]===0x1f4){logger[_0x0e5a('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x49f190,_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);return _0x48073a(_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);}logger[_0x0e5a('0x12')](_0x0e5a('0xe'),_0x49f190,_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);return _0xf7304c(_0x1c4b6f[_0x0e5a('0x12')][_0x0e5a('0x14')]);}else{logger[_0x0e5a('0x15')](_0x0e5a('0xe'),_0x49f190,_0x0e5a('0xf'));_0xf7304c(_0x1c4b6f[_0x0e5a('0x16')][_0x0e5a('0x14')]);}})['catch'](function(_0x5df670){logger[_0x0e5a('0x12')](_0x0e5a('0xe'),_0x49f190,_0x5df670);_0x48073a(_0x5df670);});});}exports[_0x0e5a('0x17')]=function(_0x16b399){var _0x303e89=this;return new Promise(function(_0xce3431,_0x5f4cb4){return db[_0x0e5a('0x18')][_0x0e5a('0x19')](_0x16b399['body'],{'raw':_0x16b399['options']?_0x16b399[_0x0e5a('0x1a')][_0x0e5a('0x1b')]===undefined?!![]:![]:!![]})[_0x0e5a('0xd')](function(_0x8f1899){logger[_0x0e5a('0x15')]('CreateMailQueueReport',_0x16b399);logger['debug'](_0x0e5a('0x17'),_0x16b399,JSON[_0x0e5a('0x1c')](_0x8f1899));_0xce3431(_0x8f1899);})[_0x0e5a('0x1d')](function(_0x108a8c){logger[_0x0e5a('0x12')]('CreateMailQueueReport',_0x108a8c['message'],_0x16b399);_0x5f4cb4(_0x303e89[_0x0e5a('0x12')](0x1f4,_0x108a8c[_0x0e5a('0x14')]));});});};exports['UpdateMailQueueReport']=function(_0x58eef5){var _0x4932df=this;return new Promise(function(_0x870747,_0x2dfe27){return db[_0x0e5a('0x18')][_0x0e5a('0x1e')](_0x58eef5[_0x0e5a('0x1f')],{'raw':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5[_0x0e5a('0x1a')][_0x0e5a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5[_0x0e5a('0x1a')][_0x0e5a('0x20')]||null:null,'attributes':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5[_0x0e5a('0x1a')][_0x0e5a('0x21')]||null:null,'limit':_0x58eef5[_0x0e5a('0x1a')]?_0x58eef5['options'][_0x0e5a('0x22')]||null:null})[_0x0e5a('0xd')](function(_0x51a0f8){logger[_0x0e5a('0x15')](_0x0e5a('0x23'),_0x58eef5);logger[_0x0e5a('0x10')]('UpdateMailQueueReport',_0x58eef5,JSON['stringify'](_0x51a0f8));_0x870747(_0x51a0f8);})[_0x0e5a('0x1d')](function(_0x325f24){logger[_0x0e5a('0x12')](_0x0e5a('0x23'),_0x325f24[_0x0e5a('0x14')],_0x58eef5);_0x2dfe27(_0x4932df[_0x0e5a('0x12')](0x1f4,_0x325f24[_0x0e5a('0x14')]));});});}; \ No newline at end of file +var _0x4668=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes','limit','debug'];(function(_0x283f1b,_0x51fb64){var _0x3bc1d1=function(_0x4258b3){while(--_0x4258b3){_0x283f1b['push'](_0x283f1b['shift']());}};_0x3bc1d1(++_0x51fb64);}(_0x4668,0x1cf));var _0x8466=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4668[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8466('0x0'));var moment=require(_0x8466('0x1'));var BPromise=require(_0x8466('0x2'));var rs=require(_0x8466('0x3'));var fs=require('fs');var Redis=require(_0x8466('0x4'));var db=require(_0x8466('0x5'))['db'];var utils=require(_0x8466('0x6'));var logger=require(_0x8466('0x7'))(_0x8466('0x8'));var config=require(_0x8466('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5892,_0x15b6c3,_0x1dfcba){return new BPromise(function(_0x4be5d7,_0x1468ea){return client[_0x8466('0xa')](_0xe5892,_0x1dfcba)[_0x8466('0xb')](function(_0x5cbc64){logger[_0x8466('0xc')](_0x8466('0xd'),_0x15b6c3,_0x8466('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x15b6c3,'request\x20sent',JSON[_0x8466('0xf')](_0x5cbc64));if(_0x5cbc64[_0x8466('0x10')]){if(_0x5cbc64[_0x8466('0x10')][_0x8466('0x11')]===0x1f4){logger[_0x8466('0x10')](_0x8466('0xd'),_0x15b6c3,_0x5cbc64['error'][_0x8466('0x12')]);return _0x1468ea(_0x5cbc64[_0x8466('0x10')][_0x8466('0x12')]);}logger[_0x8466('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x15b6c3,_0x5cbc64[_0x8466('0x10')][_0x8466('0x12')]);return _0x4be5d7(_0x5cbc64[_0x8466('0x10')]['message']);}else{logger['info'](_0x8466('0xd'),_0x15b6c3,_0x8466('0xe'));_0x4be5d7(_0x5cbc64[_0x8466('0x13')][_0x8466('0x12')]);}})['catch'](function(_0x2729ad){logger[_0x8466('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x15b6c3,_0x2729ad);_0x1468ea(_0x2729ad);});});}exports[_0x8466('0x14')]=function(_0x3dd88c){var _0x438b32=this;return new Promise(function(_0x2e54c4,_0x44ffb9){return db[_0x8466('0x15')][_0x8466('0x16')](_0x3dd88c[_0x8466('0x17')],{'raw':_0x3dd88c['options']?_0x3dd88c[_0x8466('0x18')][_0x8466('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3468f7){logger['info'](_0x8466('0x14'),_0x3dd88c);logger['debug']('CreateMailQueueReport',_0x3dd88c,JSON[_0x8466('0xf')](_0x3468f7));_0x2e54c4(_0x3468f7);})['catch'](function(_0x79b9dd){logger['error'](_0x8466('0x14'),_0x79b9dd[_0x8466('0x12')],_0x3dd88c);_0x44ffb9(_0x438b32['error'](0x1f4,_0x79b9dd[_0x8466('0x12')]));});});};exports[_0x8466('0x1a')]=function(_0x40a2c2){var _0x19a403=this;return new Promise(function(_0x3009ee,_0x4fdc12){return db[_0x8466('0x15')][_0x8466('0x1b')](_0x40a2c2[_0x8466('0x17')],{'raw':_0x40a2c2[_0x8466('0x18')]?_0x40a2c2['options'][_0x8466('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a2c2[_0x8466('0x18')]?_0x40a2c2[_0x8466('0x18')][_0x8466('0x1c')]||null:null,'attributes':_0x40a2c2[_0x8466('0x18')]?_0x40a2c2[_0x8466('0x18')][_0x8466('0x1d')]||null:null,'limit':_0x40a2c2['options']?_0x40a2c2['options'][_0x8466('0x1e')]||null:null})[_0x8466('0xb')](function(_0x5115bc){logger['info'](_0x8466('0x1a'),_0x40a2c2);logger[_0x8466('0x1f')]('UpdateMailQueueReport',_0x40a2c2,JSON[_0x8466('0xf')](_0x5115bc));_0x3009ee(_0x5115bc);})[_0x8466('0x20')](function(_0x50950d){logger[_0x8466('0x10')](_0x8466('0x1a'),_0x50950d[_0x8466('0x12')],_0x40a2c2);_0x4fdc12(_0x19a403['error'](0x1f4,_0x50950d[_0x8466('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2176abe..5bb77dd 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 _0xc2aa=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util'];(function(_0x297ec5,_0x860cf4){var _0x367d44=function(_0x1d96b3){while(--_0x1d96b3){_0x297ec5['push'](_0x297ec5['shift']());}};_0x367d44(++_0x860cf4);}(_0xc2aa,0x1b8));var _0xac2a=function(_0x3a9b30,_0x35e205){_0x3a9b30=_0x3a9b30-0x0;var _0x3c3cb2=_0xc2aa[_0x3a9b30];return _0x3c3cb2;};'use strict';var multer=require('multer');var util=require(_0xac2a('0x0'));var path=require(_0xac2a('0x1'));var timeout=require(_0xac2a('0x2'));var express=require('express');var router=express[_0xac2a('0x3')]();var auth=require(_0xac2a('0x4'));var interaction=require(_0xac2a('0x5'));var config=require(_0xac2a('0x6'));module['exports']=router; \ No newline at end of file +var _0x9365=['path','express','Router','../../components/auth/service','../../config/environment','util'];(function(_0x229ad7,_0x296078){var _0x39e032=function(_0x308384){while(--_0x308384){_0x229ad7['push'](_0x229ad7['shift']());}};_0x39e032(++_0x296078);}(_0x9365,0xe9));var _0x5936=function(_0x3fc7a5,_0x1d8a92){_0x3fc7a5=_0x3fc7a5-0x0;var _0xce911e=_0x9365[_0x3fc7a5];return _0xce911e;};'use strict';var multer=require('multer');var util=require(_0x5936('0x0'));var path=require(_0x5936('0x1'));var timeout=require('connect-timeout');var express=require(_0x5936('0x2'));var router=express[_0x5936('0x3')]();var auth=require(_0x5936('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5936('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5860e29..fadf589 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 _0x5af8=['INTEGER','exports','STRING','BOOLEAN'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x5af8,0x161));var _0x85af=function(_0x5ed980,_0x1da661){_0x5ed980=_0x5ed980-0x0;var _0x13611c=_0x5af8[_0x5ed980];return _0x13611c;};'use strict';var Sequelize=require('sequelize');module[_0x85af('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x85af('0x1')]},'authentication':{'type':Sequelize[_0x85af('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x85af('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x85af('0x1')]},'port':{'type':Sequelize[_0x85af('0x3')]},'tls':{'type':Sequelize[_0x85af('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x85af('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x85af('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x49cb=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x49cb,0x134));var _0xb49c=function(_0x10afec,_0x5ee21b){_0x10afec=_0x10afec-0x0;var _0x3424f8=_0x49cb[_0x10afec];return _0x3424f8;};'use strict';var Sequelize=require(_0xb49c('0x0'));module[_0xb49c('0x1')]={'description':{'type':Sequelize[_0xb49c('0x2')]},'host':{'type':Sequelize[_0xb49c('0x2')]},'authentication':{'type':Sequelize[_0xb49c('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb49c('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb49c('0x2')]},'port':{'type':Sequelize[_0xb49c('0x4')]},'tls':{'type':Sequelize[_0xb49c('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb49c('0x2')],'defaultValue':_0xb49c('0x5')},'connTimeout':{'type':Sequelize[_0xb49c('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb49c('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb49c('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0c3d2e0..00f0c4f 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 _0x2b65=['api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x556870,_0x28a240){var _0x282064=function(_0x2dc84d){while(--_0x2dc84d){_0x556870['push'](_0x556870['shift']());}};_0x282064(++_0x28a240);}(_0x2b65,0x131));var _0x52b6=function(_0x2fb866,_0x59bc0c){_0x2fb866=_0x2fb866-0x0;var _0x5d310f=_0x2b65[_0x2fb866];return _0x5d310f;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49db=['util','../../config/logger','api','moment','request-promise','path','rimraf','./mailServerIn.attributes','define','MailServerIn','lodash'];(function(_0x366279,_0x209a2b){var _0x3d11b1=function(_0x2541ae){while(--_0x2541ae){_0x366279['push'](_0x366279['shift']());}};_0x3d11b1(++_0x209a2b);}(_0x49db,0xc5));var _0xb49d=function(_0x5b3e28,_0x2ad693){_0x5b3e28=_0x5b3e28-0x0;var _0x21a6f4=_0x49db[_0x5b3e28];return _0x21a6f4;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var logger=require(_0xb49d('0x2'))(_0xb49d('0x3'));var moment=require(_0xb49d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb49d('0x5'));var fs=require('fs');var path=require(_0xb49d('0x6'));var rimraf=require(_0xb49d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb49d('0x8'));module['exports']=function(_0x4c6887,_0x144a9a){return _0x4c6887[_0xb49d('0x9')](_0xb49d('0xa'),attributes,{'tableName':'mail_servers_in','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 ced8e95..18cca19 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 _0xaaf1=['client','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','findAll','options','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x452141,_0x4b485f){var _0x9e6014=function(_0x25c3a8){while(--_0x25c3a8){_0x452141['push'](_0x452141['shift']());}};_0x9e6014(++_0x4b485f);}(_0xaaf1,0x80));var _0x1aaf=function(_0x334743,_0x1f9260){_0x334743=_0x334743-0x0;var _0xc3ed62=_0xaaf1[_0x334743];return _0xc3ed62;};'use strict';var _=require(_0x1aaf('0x0'));var util=require(_0x1aaf('0x1'));var moment=require(_0x1aaf('0x2'));var BPromise=require(_0x1aaf('0x3'));var rs=require(_0x1aaf('0x4'));var fs=require('fs');var Redis=require(_0x1aaf('0x5'));var db=require(_0x1aaf('0x6'))['db'];var utils=require(_0x1aaf('0x7'));var logger=require(_0x1aaf('0x8'))(_0x1aaf('0x9'));var config=require(_0x1aaf('0xa'));var jayson=require(_0x1aaf('0xb'));var client=jayson[_0x1aaf('0xc')][_0x1aaf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a5170,_0x285639,_0x2391bc){return new BPromise(function(_0x43459a,_0x194617){return client[_0x1aaf('0xe')](_0x3a5170,_0x2391bc)['then'](function(_0x240aa2){logger[_0x1aaf('0xf')]('MailServerIn,\x20%s,\x20%s',_0x285639,_0x1aaf('0x10'));logger[_0x1aaf('0x11')](_0x1aaf('0x12'),_0x285639,_0x1aaf('0x10'),JSON[_0x1aaf('0x13')](_0x240aa2));if(_0x240aa2[_0x1aaf('0x14')]){if(_0x240aa2[_0x1aaf('0x14')][_0x1aaf('0x15')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x285639,_0x240aa2['error']['message']);return _0x194617(_0x240aa2['error']['message']);}logger[_0x1aaf('0x14')](_0x1aaf('0x16'),_0x285639,_0x240aa2[_0x1aaf('0x14')][_0x1aaf('0x17')]);return _0x43459a(_0x240aa2[_0x1aaf('0x14')][_0x1aaf('0x17')]);}else{logger[_0x1aaf('0xf')](_0x1aaf('0x16'),_0x285639,_0x1aaf('0x10'));_0x43459a(_0x240aa2[_0x1aaf('0x18')][_0x1aaf('0x17')]);}})[_0x1aaf('0x19')](function(_0x13d05e){logger[_0x1aaf('0x14')](_0x1aaf('0x16'),_0x285639,_0x13d05e);_0x194617(_0x13d05e);});});}exports[_0x1aaf('0x1a')]=function(_0x259e6b){var _0xf96a90=this;return new Promise(function(_0x27f94d,_0x13606d){return db['MailServerIn'][_0x1aaf('0x1b')]({'raw':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')][_0x1aaf('0x1d')]||null:null,'attributes':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')][_0x1aaf('0x1e')]||null:null,'limit':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b['options']['limit']||null:null,'include':_0x259e6b[_0x1aaf('0x1c')]?_0x259e6b[_0x1aaf('0x1c')][_0x1aaf('0x1f')]?_[_0x1aaf('0x20')](_0x259e6b['options'][_0x1aaf('0x1f')],function(_0x40df80){return{'model':db[_0x40df80[_0x1aaf('0x21')]],'as':_0x40df80['as'],'attributes':_0x40df80['attributes'],'include':_0x40df80['include']?_['map'](_0x40df80['include'],function(_0x1d6c5b){return{'model':db[_0x1d6c5b['model']],'as':_0x1d6c5b['as'],'attributes':_0x1d6c5b['attributes'],'include':_0x1d6c5b[_0x1aaf('0x1f')]?_['map'](_0x1d6c5b['include'],function(_0x1d1021){return{'model':db[_0x1d1021[_0x1aaf('0x21')]],'as':_0x1d1021['as'],'attributes':_0x1d1021['attributes']};}):[]};}):[]};}):[]:[]})[_0x1aaf('0x22')](function(_0x2ce1f2){logger[_0x1aaf('0xf')](_0x1aaf('0x1a'),_0x259e6b);logger[_0x1aaf('0x11')](_0x1aaf('0x1a'),_0x259e6b,JSON[_0x1aaf('0x13')](_0x2ce1f2));_0x27f94d(_0x2ce1f2);})[_0x1aaf('0x19')](function(_0x39a85a){logger[_0x1aaf('0x14')](_0x1aaf('0x1a'),_0x39a85a[_0x1aaf('0x17')],_0x259e6b);_0x13606d(_0xf96a90[_0x1aaf('0x14')](0x1f4,_0x39a85a[_0x1aaf('0x17')]));});});}; \ No newline at end of file +var _0x51af=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','map','include','model','catch','util','moment','bluebird'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0x51af,0x133));var _0xf51a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x51af[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require(_0xf51a('0x0'));var moment=require(_0xf51a('0x1'));var BPromise=require(_0xf51a('0x2'));var rs=require(_0xf51a('0x3'));var fs=require('fs');var Redis=require(_0xf51a('0x4'));var db=require(_0xf51a('0x5'))['db'];var utils=require(_0xf51a('0x6'));var logger=require(_0xf51a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf51a('0x8'));var client=jayson[_0xf51a('0x9')][_0xf51a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe649,_0x149eaa,_0x3f61ad){return new BPromise(function(_0xafead3,_0x29e1e1){return client['request'](_0x4fe649,_0x3f61ad)['then'](function(_0x2aa883){logger[_0xf51a('0xb')](_0xf51a('0xc'),_0x149eaa,'request\x20sent');logger[_0xf51a('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x149eaa,_0xf51a('0xe'),JSON[_0xf51a('0xf')](_0x2aa883));if(_0x2aa883[_0xf51a('0x10')]){if(_0x2aa883['error'][_0xf51a('0x11')]===0x1f4){logger[_0xf51a('0x10')](_0xf51a('0xc'),_0x149eaa,_0x2aa883['error'][_0xf51a('0x12')]);return _0x29e1e1(_0x2aa883[_0xf51a('0x10')][_0xf51a('0x12')]);}logger[_0xf51a('0x10')]('MailServerIn,\x20%s,\x20%s',_0x149eaa,_0x2aa883[_0xf51a('0x10')][_0xf51a('0x12')]);return _0xafead3(_0x2aa883[_0xf51a('0x10')][_0xf51a('0x12')]);}else{logger[_0xf51a('0xb')](_0xf51a('0xc'),_0x149eaa,_0xf51a('0xe'));_0xafead3(_0x2aa883[_0xf51a('0x13')][_0xf51a('0x12')]);}})['catch'](function(_0x2ab9e0){logger['error']('MailServerIn,\x20%s,\x20%s',_0x149eaa,_0x2ab9e0);_0x29e1e1(_0x2ab9e0);});});}exports[_0xf51a('0x14')]=function(_0x372bc2){var _0x1166d7=this;return new Promise(function(_0x3af50b,_0x2dde8d){return db[_0xf51a('0x15')][_0xf51a('0x16')]({'raw':_0x372bc2[_0xf51a('0x17')]?_0x372bc2['options'][_0xf51a('0x18')]===undefined?!![]:![]:!![],'where':_0x372bc2[_0xf51a('0x17')]?_0x372bc2[_0xf51a('0x17')]['where']||null:null,'attributes':_0x372bc2[_0xf51a('0x17')]?_0x372bc2[_0xf51a('0x17')][_0xf51a('0x19')]||null:null,'limit':_0x372bc2['options']?_0x372bc2['options'][_0xf51a('0x1a')]||null:null,'include':_0x372bc2[_0xf51a('0x17')]?_0x372bc2[_0xf51a('0x17')]['include']?_[_0xf51a('0x1b')](_0x372bc2[_0xf51a('0x17')][_0xf51a('0x1c')],function(_0x5a47d7){return{'model':db[_0x5a47d7[_0xf51a('0x1d')]],'as':_0x5a47d7['as'],'attributes':_0x5a47d7[_0xf51a('0x19')],'include':_0x5a47d7[_0xf51a('0x1c')]?_[_0xf51a('0x1b')](_0x5a47d7[_0xf51a('0x1c')],function(_0x2d5b90){return{'model':db[_0x2d5b90[_0xf51a('0x1d')]],'as':_0x2d5b90['as'],'attributes':_0x2d5b90[_0xf51a('0x19')],'include':_0x2d5b90[_0xf51a('0x1c')]?_['map'](_0x2d5b90[_0xf51a('0x1c')],function(_0xa36ad1){return{'model':db[_0xa36ad1[_0xf51a('0x1d')]],'as':_0xa36ad1['as'],'attributes':_0xa36ad1[_0xf51a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x199718){logger[_0xf51a('0xb')](_0xf51a('0x14'),_0x372bc2);logger[_0xf51a('0xd')](_0xf51a('0x14'),_0x372bc2,JSON[_0xf51a('0xf')](_0x199718));_0x3af50b(_0x199718);})[_0xf51a('0x1e')](function(_0x6ce607){logger[_0xf51a('0x10')](_0xf51a('0x14'),_0x6ce607[_0xf51a('0x12')],_0x372bc2);_0x2dde8d(_0x1166d7[_0xf51a('0x10')](0x1f4,_0x6ce607[_0xf51a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4f20502..3710f86 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 _0xe641=['../../config/environment','./mailServerOut.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3c715d,_0x1c2554){var _0x441f7d=function(_0x2b6a0f){while(--_0x2b6a0f){_0x3c715d['push'](_0x3c715d['shift']());}};_0x441f7d(++_0x1c2554);}(_0xe641,0xfd));var _0x1e64=function(_0x23a47b,_0x4964c8){_0x23a47b=_0x23a47b-0x0;var _0x296856=_0xe641[_0x23a47b];return _0x296856;};'use strict';var multer=require(_0x1e64('0x0'));var util=require(_0x1e64('0x1'));var path=require('path');var timeout=require(_0x1e64('0x2'));var express=require(_0x1e64('0x3'));var router=express[_0x1e64('0x4')]();var auth=require(_0x1e64('0x5'));var interaction=require(_0x1e64('0x6'));var config=require(_0x1e64('0x7'));var controller=require(_0x1e64('0x8'));router[_0x1e64('0x9')]('/',auth[_0x1e64('0xa')](),controller['index']);router['get']('/:id',auth[_0x1e64('0xa')](),controller[_0x1e64('0xb')]);router[_0x1e64('0xc')]('/',auth[_0x1e64('0xa')](),controller[_0x1e64('0xd')]);router[_0x1e64('0xe')]('/:id',auth[_0x1e64('0xa')](),controller[_0x1e64('0xf')]);router[_0x1e64('0x10')](_0x1e64('0x11'),auth[_0x1e64('0xa')](),controller[_0x1e64('0x12')]);module[_0x1e64('0x13')]=router; \ No newline at end of file +var _0x34af=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34af,0xd3));var _0xf34a=function(_0x2243ad,_0x4c1f9d){_0x2243ad=_0x2243ad-0x0;var _0x11826a=_0x34af[_0x2243ad];return _0x11826a;};'use strict';var multer=require(_0xf34a('0x0'));var util=require(_0xf34a('0x1'));var path=require(_0xf34a('0x2'));var timeout=require(_0xf34a('0x3'));var express=require(_0xf34a('0x4'));var router=express['Router']();var auth=require(_0xf34a('0x5'));var interaction=require(_0xf34a('0x6'));var config=require(_0xf34a('0x7'));var controller=require('./mailServerOut.controller');router[_0xf34a('0x8')]('/',auth[_0xf34a('0x9')](),controller[_0xf34a('0xa')]);router[_0xf34a('0x8')](_0xf34a('0xb'),auth[_0xf34a('0x9')](),controller[_0xf34a('0xc')]);router['post']('/',auth[_0xf34a('0x9')](),controller[_0xf34a('0xd')]);router[_0xf34a('0xe')](_0xf34a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf34a('0xf')](_0xf34a('0xb'),auth['isAuthenticated'](),controller[_0xf34a('0x10')]);module[_0xf34a('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 906f2b7..cdd1480 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 _0x4fb4=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x4a78e8,_0x5fcb80){var _0x162881=function(_0x2cf79c){while(--_0x2cf79c){_0x4a78e8['push'](_0x4a78e8['shift']());}};_0x162881(++_0x5fcb80);}(_0x4fb4,0x190));var _0x44fb=function(_0x30e4d3,_0x5e937a){_0x30e4d3=_0x30e4d3-0x0;var _0x4e6a0c=_0x4fb4[_0x30e4d3];return _0x4e6a0c;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'description':{'type':Sequelize[_0x44fb('0x1')]},'host':{'type':Sequelize[_0x44fb('0x1')]},'user':{'type':Sequelize[_0x44fb('0x1')]},'pass':{'type':Sequelize[_0x44fb('0x1')]},'port':{'type':Sequelize[_0x44fb('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x44fb('0x1')]},'authentication':{'type':Sequelize[_0x44fb('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x75dd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x75dd,0x1c9));var _0xd75d=function(_0x4fd2b8,_0x5232d9){_0x4fd2b8=_0x4fd2b8-0x0;var _0x205fcf=_0x75dd[_0x4fd2b8];return _0x205fcf;};'use strict';var Sequelize=require(_0xd75d('0x0'));module[_0xd75d('0x1')]={'description':{'type':Sequelize[_0xd75d('0x2')]},'host':{'type':Sequelize[_0xd75d('0x2')]},'user':{'type':Sequelize[_0xd75d('0x2')]},'pass':{'type':Sequelize[_0xd75d('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xd75d('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd75d('0x2')]},'authentication':{'type':Sequelize[_0xd75d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 2a72919..2a41916 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 _0x5535=['hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5535,0x1ca));var _0x5553=function(_0x4dccfe,_0x361902){_0x4dccfe=_0x4dccfe-0x0;var _0x159065=_0x5535[_0x4dccfe];return _0x159065;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5553('0x0'));var rimraf=require(_0x5553('0x1'));var zipdir=require(_0x5553('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5553('0x3'));var moment=require(_0x5553('0x4'));var BPromise=require(_0x5553('0x5'));var Mustache=require(_0x5553('0x6'));var util=require(_0x5553('0x7'));var path=require(_0x5553('0x8'));var sox=require(_0x5553('0x9'));var csv=require(_0x5553('0xa'));var ejs=require(_0x5553('0xb'));var fs=require('fs');var _=require(_0x5553('0xc'));var squel=require(_0x5553('0xd'));var crypto=require(_0x5553('0xe'));var jsforce=require(_0x5553('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5553('0x10'));var Papa=require(_0x5553('0x11'));var Redis=require('ioredis');var authService=require(_0x5553('0x12'));var qs=require(_0x5553('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5553('0x14'));var logger=require('../../config/logger')(_0x5553('0x15'));var utils=require(_0x5553('0x16'));var config=require(_0x5553('0x17'));var licenseUtil=require(_0x5553('0x18'));var db=require(_0x5553('0x19'))['db'];function respondWithStatusCode(_0xfddbb3,_0x3ab6b8){_0x3ab6b8=_0x3ab6b8||0xcc;return function(_0x525a97){if(_0x525a97){return _0xfddbb3['sendStatus'](_0x3ab6b8);}return _0xfddbb3[_0x5553('0x1a')](_0x3ab6b8)['end']();};}function respondWithResult(_0x19e6f2,_0x2b1d54){_0x2b1d54=_0x2b1d54||0xc8;return function(_0x5e63a4){if(_0x5e63a4){return _0x19e6f2[_0x5553('0x1a')](_0x2b1d54)['json'](_0x5e63a4);}};}function respondWithFilteredResult(_0x9e5bd3,_0x50f3d3){return function(_0x4c1bf5){if(_0x4c1bf5){var _0x69a1c3=_0x4c1bf5[_0x5553('0x1b')],_0x590488=_0x50f3d3[_0x5553('0x1c')],_0x10a228=_0x50f3d3[_0x5553('0x1c')]+_0x50f3d3['limit'],_0x42732f;if(_0x10a228>=_0x69a1c3){_0x10a228=_0x69a1c3;_0x42732f=0xc8;}else{_0x42732f=0xce;}_0x9e5bd3[_0x5553('0x1a')](_0x42732f);return _0x9e5bd3['set'](_0x5553('0x1d'),_0x590488+'-'+_0x10a228+'/'+_0x69a1c3)['json'](_0x4c1bf5);}return null;};}function patchUpdates(_0x5ad219){return function(_0x3689f4){try{jsonpatch[_0x5553('0x1e')](_0x3689f4,_0x5ad219,!![]);}catch(_0x1375e9){return BPromise[_0x5553('0x1f')](_0x1375e9);}return _0x3689f4[_0x5553('0x20')]();};}function saveUpdates(_0x5a8037,_0x449b51){return function(_0x25e09c){if(_0x25e09c){return _0x25e09c[_0x5553('0x21')](_0x5a8037)[_0x5553('0x22')](function(_0x498450){return _0x498450;});}return null;};}function removeEntity(_0x1e6a86,_0x470c2f){return function(_0x499fc3){if(_0x499fc3){return _0x499fc3[_0x5553('0x23')]()['then'](function(){_0x1e6a86[_0x5553('0x1a')](0xcc)[_0x5553('0x24')]();});}};}function handleEntityNotFound(_0x54fab8,_0x1fe824){return function(_0x372222){if(!_0x372222){_0x54fab8[_0x5553('0x25')](0x194);}return _0x372222;};}function handleError(_0x4149ee,_0x1d1e78){_0x1d1e78=_0x1d1e78||0x1f4;return function(_0x14cd71){logger[_0x5553('0x26')](_0x14cd71['stack']);if(_0x14cd71[_0x5553('0x27')]){delete _0x14cd71[_0x5553('0x27')];}_0x4149ee['status'](_0x1d1e78)['send'](_0x14cd71);};}exports[_0x5553('0x28')]=function(_0x4e9a88,_0x460719){var _0x249d98={},_0x4232ee={},_0x1a7af7={'count':0x0,'rows':[]};var _0x184719=_[_0x5553('0x29')](db['MailServerOut'][_0x5553('0x2a')],function(_0x3184a3){return{'name':_0x3184a3['fieldName'],'type':_0x3184a3[_0x5553('0x2b')][_0x5553('0x2c')]};});_0x4232ee[_0x5553('0x2d')]=_[_0x5553('0x29')](_0x184719,_0x5553('0x27'));_0x4232ee[_0x5553('0x2e')]=_[_0x5553('0x2f')](_0x4e9a88['query']);_0x4232ee[_0x5553('0x30')]=_[_0x5553('0x31')](_0x4232ee[_0x5553('0x2d')],_0x4232ee[_0x5553('0x2e')]);_0x249d98['attributes']=_['intersection'](_0x4232ee['model'],qs[_0x5553('0x32')](_0x4e9a88[_0x5553('0x2e')][_0x5553('0x32')]));_0x249d98['attributes']=_0x249d98[_0x5553('0x33')][_0x5553('0x34')]?_0x249d98['attributes']:_0x4232ee[_0x5553('0x2d')];if(!_0x4e9a88['query'][_0x5553('0x35')](_0x5553('0x36'))){_0x249d98[_0x5553('0x37')]=qs[_0x5553('0x37')](_0x4e9a88['query'][_0x5553('0x37')]);_0x249d98['offset']=qs[_0x5553('0x1c')](_0x4e9a88[_0x5553('0x2e')]['offset']);}_0x249d98['order']=qs[_0x5553('0x38')](_0x4e9a88['query'][_0x5553('0x38')]);_0x249d98[_0x5553('0x39')]=qs[_0x5553('0x30')](_[_0x5553('0x3a')](_0x4e9a88[_0x5553('0x2e')],_0x4232ee[_0x5553('0x30')]),_0x184719);if(_0x4e9a88[_0x5553('0x2e')][_0x5553('0x3b')]){_0x249d98[_0x5553('0x39')]=_[_0x5553('0x3c')](_0x249d98['where'],{'$or':_[_0x5553('0x29')](_0x184719,function(_0x47ccc6){if(_0x47ccc6[_0x5553('0x2b')]!=='VIRTUAL'){var _0x496374={};_0x496374[_0x47ccc6[_0x5553('0x27')]]={'$like':'%'+_0x4e9a88[_0x5553('0x2e')]['filter']+'%'};return _0x496374;}})});}_0x249d98=_[_0x5553('0x3c')]({},_0x249d98,_0x4e9a88[_0x5553('0x3d')]);var _0x8d9323={'where':_0x249d98['where']};return db[_0x5553('0x3e')][_0x5553('0x1b')](_0x8d9323)['then'](function(_0x1595e8){_0x1a7af7[_0x5553('0x1b')]=_0x1595e8;if(_0x4e9a88[_0x5553('0x2e')][_0x5553('0x3f')]){_0x249d98[_0x5553('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x5553('0x41')](_0x249d98);})['then'](function(_0x4a2bf8){_0x1a7af7[_0x5553('0x42')]=_0x4a2bf8;return _0x1a7af7;})[_0x5553('0x22')](respondWithFilteredResult(_0x460719,_0x249d98))[_0x5553('0x43')](handleError(_0x460719,null));};exports[_0x5553('0x44')]=function(_0x3e344b,_0x486afe){var _0x3165a0={'raw':!![],'where':{'id':_0x3e344b[_0x5553('0x45')]['id']}},_0x56c9fd={};_0x56c9fd['model']=_[_0x5553('0x2f')](db['MailServerOut'][_0x5553('0x2a')]);_0x56c9fd['query']=_[_0x5553('0x2f')](_0x3e344b[_0x5553('0x2e')]);_0x56c9fd[_0x5553('0x30')]=_[_0x5553('0x31')](_0x56c9fd[_0x5553('0x2d')],_0x56c9fd[_0x5553('0x2e')]);_0x3165a0[_0x5553('0x33')]=_[_0x5553('0x31')](_0x56c9fd[_0x5553('0x2d')],qs['fields'](_0x3e344b[_0x5553('0x2e')][_0x5553('0x32')]));_0x3165a0['attributes']=_0x3165a0[_0x5553('0x33')][_0x5553('0x34')]?_0x3165a0[_0x5553('0x33')]:_0x56c9fd[_0x5553('0x2d')];if(_0x3e344b[_0x5553('0x2e')][_0x5553('0x3f')]){_0x3165a0[_0x5553('0x40')]=[{'all':!![]}];}_0x3165a0=_[_0x5553('0x3c')]({},_0x3165a0,_0x3e344b[_0x5553('0x3d')]);return db[_0x5553('0x3e')][_0x5553('0x46')](_0x3165a0)[_0x5553('0x22')](handleEntityNotFound(_0x486afe,null))[_0x5553('0x22')](respondWithResult(_0x486afe,null))[_0x5553('0x43')](handleError(_0x486afe,null));};exports[_0x5553('0x47')]=function(_0x155c9a,_0x293f4a){return db['MailServerOut'][_0x5553('0x47')](_0x155c9a['body'],{})[_0x5553('0x22')](respondWithResult(_0x293f4a,0xc9))[_0x5553('0x43')](handleError(_0x293f4a,null));};exports[_0x5553('0x21')]=function(_0x5a39a3,_0xcca01){if(_0x5a39a3[_0x5553('0x48')]['id']){delete _0x5a39a3[_0x5553('0x48')]['id'];}return db[_0x5553('0x3e')][_0x5553('0x46')]({'where':{'id':_0x5a39a3[_0x5553('0x45')]['id']}})[_0x5553('0x22')](handleEntityNotFound(_0xcca01,null))[_0x5553('0x22')](saveUpdates(_0x5a39a3[_0x5553('0x48')],null))['then'](respondWithResult(_0xcca01,null))[_0x5553('0x43')](handleError(_0xcca01,null));};exports[_0x5553('0x23')]=function(_0x484390,_0x832804){return db['MailServerOut'][_0x5553('0x46')]({'where':{'id':_0x484390['params']['id']}})[_0x5553('0x22')](handleEntityNotFound(_0x832804,null))[_0x5553('0x22')](removeEntity(_0x832804,null))[_0x5553('0x43')](handleError(_0x832804,null));}; \ No newline at end of file +var _0x59d2=['name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','update','then','destroy','error'];(function(_0x31ee55,_0x5a187d){var _0x5560e8=function(_0xebe3a6){while(--_0xebe3a6){_0x31ee55['push'](_0x31ee55['shift']());}};_0x5560e8(++_0x5a187d);}(_0x59d2,0x6c));var _0x259d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x59d2[_0x55e08b];return _0xd1a7ff;};'use strict';var pdf=require(_0x259d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x259d('0x1'));var zipdir=require(_0x259d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x259d('0x3'));var moment=require(_0x259d('0x4'));var BPromise=require(_0x259d('0x5'));var Mustache=require(_0x259d('0x6'));var util=require(_0x259d('0x7'));var path=require(_0x259d('0x8'));var sox=require(_0x259d('0x9'));var csv=require('to-csv');var ejs=require(_0x259d('0xa'));var fs=require('fs');var _=require(_0x259d('0xb'));var squel=require(_0x259d('0xc'));var crypto=require(_0x259d('0xd'));var jsforce=require(_0x259d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x259d('0xf'));var querystring=require(_0x259d('0x10'));var Papa=require(_0x259d('0x11'));var Redis=require(_0x259d('0x12'));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(_0x259d('0x13'))(_0x259d('0x14'));var utils=require(_0x259d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x259d('0x16'));var db=require(_0x259d('0x17'))['db'];function respondWithStatusCode(_0x2ac1b9,_0x5229e5){_0x5229e5=_0x5229e5||0xcc;return function(_0x44f4d8){if(_0x44f4d8){return _0x2ac1b9[_0x259d('0x18')](_0x5229e5);}return _0x2ac1b9[_0x259d('0x19')](_0x5229e5)[_0x259d('0x1a')]();};}function respondWithResult(_0x50339f,_0x1e76a7){_0x1e76a7=_0x1e76a7||0xc8;return function(_0xb2df80){if(_0xb2df80){return _0x50339f[_0x259d('0x19')](_0x1e76a7)[_0x259d('0x1b')](_0xb2df80);}};}function respondWithFilteredResult(_0x162a08,_0x25a6de){return function(_0x356533){if(_0x356533){var _0x478960=_0x356533['count'],_0x5b2059=_0x25a6de['offset'],_0xb73a04=_0x25a6de['offset']+_0x25a6de[_0x259d('0x1c')],_0x834e69;if(_0xb73a04>=_0x478960){_0xb73a04=_0x478960;_0x834e69=0xc8;}else{_0x834e69=0xce;}_0x162a08[_0x259d('0x19')](_0x834e69);return _0x162a08[_0x259d('0x1d')](_0x259d('0x1e'),_0x5b2059+'-'+_0xb73a04+'/'+_0x478960)[_0x259d('0x1b')](_0x356533);}return null;};}function patchUpdates(_0x57e6eb){return function(_0x5d6f0a){try{jsonpatch[_0x259d('0x1f')](_0x5d6f0a,_0x57e6eb,!![]);}catch(_0x1091bc){return BPromise['reject'](_0x1091bc);}return _0x5d6f0a['save']();};}function saveUpdates(_0xf42181,_0x23200b){return function(_0xfcb3f4){if(_0xfcb3f4){return _0xfcb3f4[_0x259d('0x20')](_0xf42181)[_0x259d('0x21')](function(_0x13f24d){return _0x13f24d;});}return null;};}function removeEntity(_0x50461f,_0x308086){return function(_0x5acf6c){if(_0x5acf6c){return _0x5acf6c[_0x259d('0x22')]()[_0x259d('0x21')](function(){_0x50461f[_0x259d('0x19')](0xcc)[_0x259d('0x1a')]();});}};}function handleEntityNotFound(_0x1f0894,_0x41d25c){return function(_0x342184){if(!_0x342184){_0x1f0894[_0x259d('0x18')](0x194);}return _0x342184;};}function handleError(_0xba183c,_0x5d6b6f){_0x5d6b6f=_0x5d6b6f||0x1f4;return function(_0x5207a3){logger[_0x259d('0x23')](_0x5207a3['stack']);if(_0x5207a3[_0x259d('0x24')]){delete _0x5207a3[_0x259d('0x24')];}_0xba183c['status'](_0x5d6b6f)[_0x259d('0x25')](_0x5207a3);};}exports[_0x259d('0x26')]=function(_0x40e905,_0x3a3170){var _0x276ca5={},_0x44d3ce={},_0x2c766f={'count':0x0,'rows':[]};var _0x328a66=_[_0x259d('0x27')](db[_0x259d('0x28')][_0x259d('0x29')],function(_0xea940f){return{'name':_0xea940f[_0x259d('0x2a')],'type':_0xea940f[_0x259d('0x2b')][_0x259d('0x2c')]};});_0x44d3ce[_0x259d('0x2d')]=_[_0x259d('0x27')](_0x328a66,_0x259d('0x24'));_0x44d3ce[_0x259d('0x2e')]=_['keys'](_0x40e905[_0x259d('0x2e')]);_0x44d3ce[_0x259d('0x2f')]=_['intersection'](_0x44d3ce['model'],_0x44d3ce[_0x259d('0x2e')]);_0x276ca5[_0x259d('0x30')]=_[_0x259d('0x31')](_0x44d3ce[_0x259d('0x2d')],qs['fields'](_0x40e905[_0x259d('0x2e')][_0x259d('0x32')]));_0x276ca5[_0x259d('0x30')]=_0x276ca5[_0x259d('0x30')][_0x259d('0x33')]?_0x276ca5[_0x259d('0x30')]:_0x44d3ce['model'];if(!_0x40e905[_0x259d('0x2e')]['hasOwnProperty'](_0x259d('0x34'))){_0x276ca5[_0x259d('0x1c')]=qs[_0x259d('0x1c')](_0x40e905['query']['limit']);_0x276ca5['offset']=qs[_0x259d('0x35')](_0x40e905[_0x259d('0x2e')][_0x259d('0x35')]);}_0x276ca5[_0x259d('0x36')]=qs[_0x259d('0x37')](_0x40e905[_0x259d('0x2e')]['sort']);_0x276ca5[_0x259d('0x38')]=qs['filters'](_['pick'](_0x40e905[_0x259d('0x2e')],_0x44d3ce[_0x259d('0x2f')]),_0x328a66);if(_0x40e905[_0x259d('0x2e')][_0x259d('0x39')]){_0x276ca5[_0x259d('0x38')]=_[_0x259d('0x3a')](_0x276ca5['where'],{'$or':_[_0x259d('0x27')](_0x328a66,function(_0x5e9dfc){if(_0x5e9dfc[_0x259d('0x2b')]!==_0x259d('0x3b')){var _0x105fdc={};_0x105fdc[_0x5e9dfc['name']]={'$like':'%'+_0x40e905['query'][_0x259d('0x39')]+'%'};return _0x105fdc;}})});}_0x276ca5=_[_0x259d('0x3a')]({},_0x276ca5,_0x40e905[_0x259d('0x3c')]);var _0xa04045={'where':_0x276ca5['where']};return db['MailServerOut'][_0x259d('0x3d')](_0xa04045)[_0x259d('0x21')](function(_0x5d0a63){_0x2c766f[_0x259d('0x3d')]=_0x5d0a63;if(_0x40e905['query'][_0x259d('0x3e')]){_0x276ca5[_0x259d('0x3f')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x276ca5);})['then'](function(_0x67fe7b){_0x2c766f[_0x259d('0x40')]=_0x67fe7b;return _0x2c766f;})['then'](respondWithFilteredResult(_0x3a3170,_0x276ca5))[_0x259d('0x41')](handleError(_0x3a3170,null));};exports[_0x259d('0x42')]=function(_0xf75729,_0x1fd256){var _0x3fc596={'raw':!![],'where':{'id':_0xf75729[_0x259d('0x43')]['id']}},_0x168791={};_0x168791[_0x259d('0x2d')]=_[_0x259d('0x44')](db[_0x259d('0x28')][_0x259d('0x29')]);_0x168791['query']=_['keys'](_0xf75729['query']);_0x168791[_0x259d('0x2f')]=_['intersection'](_0x168791[_0x259d('0x2d')],_0x168791['query']);_0x3fc596[_0x259d('0x30')]=_[_0x259d('0x31')](_0x168791[_0x259d('0x2d')],qs[_0x259d('0x32')](_0xf75729[_0x259d('0x2e')][_0x259d('0x32')]));_0x3fc596[_0x259d('0x30')]=_0x3fc596[_0x259d('0x30')][_0x259d('0x33')]?_0x3fc596['attributes']:_0x168791[_0x259d('0x2d')];if(_0xf75729[_0x259d('0x2e')][_0x259d('0x3e')]){_0x3fc596[_0x259d('0x3f')]=[{'all':!![]}];}_0x3fc596=_[_0x259d('0x3a')]({},_0x3fc596,_0xf75729[_0x259d('0x3c')]);return db['MailServerOut']['find'](_0x3fc596)[_0x259d('0x21')](handleEntityNotFound(_0x1fd256,null))[_0x259d('0x21')](respondWithResult(_0x1fd256,null))['catch'](handleError(_0x1fd256,null));};exports['create']=function(_0xfba7a9,_0x17cf32){return db[_0x259d('0x28')][_0x259d('0x45')](_0xfba7a9[_0x259d('0x46')],{})[_0x259d('0x21')](respondWithResult(_0x17cf32,0xc9))[_0x259d('0x41')](handleError(_0x17cf32,null));};exports[_0x259d('0x20')]=function(_0xb5958c,_0x4dd4c0){if(_0xb5958c[_0x259d('0x46')]['id']){delete _0xb5958c[_0x259d('0x46')]['id'];}return db[_0x259d('0x28')][_0x259d('0x47')]({'where':{'id':_0xb5958c[_0x259d('0x43')]['id']}})[_0x259d('0x21')](handleEntityNotFound(_0x4dd4c0,null))[_0x259d('0x21')](saveUpdates(_0xb5958c[_0x259d('0x46')],null))[_0x259d('0x21')](respondWithResult(_0x4dd4c0,null))['catch'](handleError(_0x4dd4c0,null));};exports[_0x259d('0x22')]=function(_0x3b22e4,_0x5299ca){return db[_0x259d('0x28')]['find']({'where':{'id':_0x3b22e4[_0x259d('0x43')]['id']}})[_0x259d('0x21')](handleEntityNotFound(_0x5299ca,null))[_0x259d('0x21')](removeEntity(_0x5299ca,null))[_0x259d('0x41')](handleError(_0x5299ca,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index bab6695..8842a21 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 _0xe14b=['bluebird','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0x594ce7,_0x4f7dac){var _0x10d802=function(_0x4cf24a){while(--_0x4cf24a){_0x594ce7['push'](_0x594ce7['shift']());}};_0x10d802(++_0x4f7dac);}(_0xe14b,0x93));var _0xbe14=function(_0x1b24fa,_0x436522){_0x1b24fa=_0x1b24fa-0x0;var _0x2852bd=_0xe14b[_0x1b24fa];return _0x2852bd;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x42f1e7,_0x3a1279){var _0x460d91=function(_0x3e9820){while(--_0x3e9820){_0x42f1e7['push'](_0x42f1e7['shift']());}};_0x460d91(++_0x3a1279);}(_0x2675,0x75));var _0x5267=function(_0x35eaee,_0x24a4a1){_0x35eaee=_0x35eaee-0x0;var _0x4fb39c=_0x2675[_0x35eaee];return _0x4fb39c;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'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 a3b9f61..ab1a6f3 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 _0xb79e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','MailServerOut,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x40de64,_0x1472d4){var _0x491fdc=function(_0x3ee721){while(--_0x3ee721){_0x40de64['push'](_0x40de64['shift']());}};_0x491fdc(++_0x1472d4);}(_0xb79e,0xb7));var _0xeb79=function(_0x1d99b8,_0x154ea9){_0x1d99b8=_0x1d99b8-0x0;var _0xbb06d0=_0xb79e[_0x1d99b8];return _0xbb06d0;};'use strict';var _=require(_0xeb79('0x0'));var util=require(_0xeb79('0x1'));var moment=require(_0xeb79('0x2'));var BPromise=require(_0xeb79('0x3'));var rs=require(_0xeb79('0x4'));var fs=require('fs');var Redis=require(_0xeb79('0x5'));var db=require(_0xeb79('0x6'))['db'];var utils=require(_0xeb79('0x7'));var logger=require(_0xeb79('0x8'))(_0xeb79('0x9'));var config=require('../../config/environment');var jayson=require(_0xeb79('0xa'));var client=jayson[_0xeb79('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcee2f3,_0x4a455e,_0x585cfc){return new BPromise(function(_0x2b5eea,_0x2d1a6f){return client[_0xeb79('0xc')](_0xcee2f3,_0x585cfc)['then'](function(_0x4b85d5){logger['info']('MailServerOut,\x20%s,\x20%s',_0x4a455e,'request\x20sent');logger['debug'](_0xeb79('0xd'),_0x4a455e,_0xeb79('0xe'),JSON['stringify'](_0x4b85d5));if(_0x4b85d5['error']){if(_0x4b85d5['error'][_0xeb79('0xf')]===0x1f4){logger[_0xeb79('0x10')]('MailServerOut,\x20%s,\x20%s',_0x4a455e,_0x4b85d5[_0xeb79('0x10')][_0xeb79('0x11')]);return _0x2d1a6f(_0x4b85d5[_0xeb79('0x10')][_0xeb79('0x11')]);}logger['error'](_0xeb79('0x12'),_0x4a455e,_0x4b85d5['error']['message']);return _0x2b5eea(_0x4b85d5['error'][_0xeb79('0x11')]);}else{logger[_0xeb79('0x13')](_0xeb79('0x12'),_0x4a455e,_0xeb79('0xe'));_0x2b5eea(_0x4b85d5['result'][_0xeb79('0x11')]);}})[_0xeb79('0x14')](function(_0x213e5f){logger['error'](_0xeb79('0x12'),_0x4a455e,_0x213e5f);_0x2d1a6f(_0x213e5f);});});} \ No newline at end of file +var _0x1139=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x1139,0x7f));var _0x9113=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1139[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x9113('0x0'));var util=require('util');var moment=require(_0x9113('0x1'));var BPromise=require(_0x9113('0x2'));var rs=require(_0x9113('0x3'));var fs=require('fs');var Redis=require(_0x9113('0x4'));var db=require(_0x9113('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9113('0x6'))(_0x9113('0x7'));var config=require(_0x9113('0x8'));var jayson=require(_0x9113('0x9'));var client=jayson[_0x9113('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cf591,_0x5d0968,_0x56271f){return new BPromise(function(_0x2bdbe8,_0x450519){return client[_0x9113('0xb')](_0x1cf591,_0x56271f)[_0x9113('0xc')](function(_0x4f319c){logger['info'](_0x9113('0xd'),_0x5d0968,_0x9113('0xe'));logger['debug'](_0x9113('0xf'),_0x5d0968,_0x9113('0xe'),JSON['stringify'](_0x4f319c));if(_0x4f319c[_0x9113('0x10')]){if(_0x4f319c['error']['code']===0x1f4){logger[_0x9113('0x10')]('MailServerOut,\x20%s,\x20%s',_0x5d0968,_0x4f319c['error'][_0x9113('0x11')]);return _0x450519(_0x4f319c[_0x9113('0x10')]['message']);}logger[_0x9113('0x10')](_0x9113('0xd'),_0x5d0968,_0x4f319c[_0x9113('0x10')][_0x9113('0x11')]);return _0x2bdbe8(_0x4f319c['error'][_0x9113('0x11')]);}else{logger[_0x9113('0x12')](_0x9113('0xd'),_0x5d0968,_0x9113('0xe'));_0x2bdbe8(_0x4f319c[_0x9113('0x13')]['message']);}})[_0x9113('0x14')](function(_0xda4ef1){logger['error']('MailServerOut,\x20%s,\x20%s',_0x5d0968,_0xda4ef1);_0x450519(_0xda4ef1);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 48296cf..63ace3b 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 _0x1c86=['destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','show','post','create','put','update','/:id'];(function(_0x2b6a8f,_0x294599){var _0x2d2036=function(_0x1ea077){while(--_0x1ea077){_0x2b6a8f['push'](_0x2b6a8f['shift']());}};_0x2d2036(++_0x294599);}(_0x1c86,0xe6));var _0x61c8=function(_0x4622fb,_0x272252){_0x4622fb=_0x4622fb-0x0;var _0x33629d=_0x1c86[_0x4622fb];return _0x33629d;};'use strict';var multer=require('multer');var util=require(_0x61c8('0x0'));var path=require(_0x61c8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x61c8('0x2')]();var auth=require(_0x61c8('0x3'));var interaction=require(_0x61c8('0x4'));var config=require(_0x61c8('0x5'));var controller=require(_0x61c8('0x6'));router[_0x61c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x61c8('0x8')]);router['get']('/describe',auth[_0x61c8('0x9')](),controller[_0x61c8('0xa')]);router['get']('/:id',auth[_0x61c8('0x9')](),controller[_0x61c8('0xb')]);router[_0x61c8('0xc')]('/',auth[_0x61c8('0x9')](),controller[_0x61c8('0xd')]);router[_0x61c8('0xe')]('/:id',auth[_0x61c8('0x9')](),controller[_0x61c8('0xf')]);router['delete'](_0x61c8('0x10'),auth[_0x61c8('0x9')](),controller[_0x61c8('0x11')]);module[_0x61c8('0x12')]=router; \ No newline at end of file +var _0x251a=['express','../../config/environment','./mailSubstatus.controller','get','describe','/:id','isAuthenticated','create','put','delete','exports','multer','path'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x251a,0x80));var _0xa251=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x251a[_0x4f5108];return _0x2d56ca;};'use strict';var multer=require(_0xa251('0x0'));var util=require('util');var path=require(_0xa251('0x1'));var timeout=require('connect-timeout');var express=require(_0xa251('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa251('0x3'));var controller=require(_0xa251('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa251('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xa251('0x6')]);router['get'](_0xa251('0x7'),auth[_0xa251('0x8')](),controller['show']);router['post']('/',auth[_0xa251('0x8')](),controller[_0xa251('0x9')]);router[_0xa251('0xa')](_0xa251('0x7'),auth[_0xa251('0x8')](),controller['update']);router[_0xa251('0xb')](_0xa251('0x7'),auth[_0xa251('0x8')](),controller['destroy']);module[_0xa251('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index ffd7493..f259d2a 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 _0x187d=['sequelize','STRING','name'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0x187d,0x93));var _0xd187=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x187d[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'name':{'type':Sequelize[_0xd187('0x1')],'unique':_0xd187('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd187('0x1')]}}; \ No newline at end of file +var _0x9b0d=['exports','STRING','name'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x31c4ec,_0x2d4889){_0x31c4ec=_0x31c4ec-0x0;var _0x2a1953=_0x9b0d[_0x31c4ec];return _0x2a1953;};'use strict';var Sequelize=require('sequelize');module[_0xd9b0('0x0')]={'name':{'type':Sequelize[_0xd9b0('0x1')],'unique':_0xd9b0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd9b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index e21e4c4..aa2b0bc 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 _0x49ca=['create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','show','params','rawAttributes','find','catch'];(function(_0x288c5a,_0x2ca88a){var _0x1a66e3=function(_0x3c9a57){while(--_0x3c9a57){_0x288c5a['push'](_0x288c5a['shift']());}};_0x1a66e3(++_0x2ca88a);}(_0x49ca,0x1dd));var _0xa49c=function(_0xacd3d5,_0x531902){_0xacd3d5=_0xacd3d5-0x0;var _0x4589df=_0x49ca[_0xacd3d5];return _0x4589df;};'use strict';var pdf=require(_0xa49c('0x0'));var emlformat=require(_0xa49c('0x1'));var rimraf=require(_0xa49c('0x2'));var zipdir=require(_0xa49c('0x3'));var jsonpatch=require(_0xa49c('0x4'));var rp=require(_0xa49c('0x5'));var moment=require('moment');var BPromise=require(_0xa49c('0x6'));var Mustache=require(_0xa49c('0x7'));var util=require(_0xa49c('0x8'));var path=require(_0xa49c('0x9'));var sox=require(_0xa49c('0xa'));var csv=require(_0xa49c('0xb'));var ejs=require(_0xa49c('0xc'));var fs=require('fs');var _=require(_0xa49c('0xd'));var squel=require(_0xa49c('0xe'));var crypto=require(_0xa49c('0xf'));var jsforce=require(_0xa49c('0x10'));var deskjs=require(_0xa49c('0x11'));var toCsv=require(_0xa49c('0xb'));var querystring=require(_0xa49c('0x12'));var Papa=require(_0xa49c('0x13'));var Redis=require('ioredis');var authService=require(_0xa49c('0x14'));var qs=require(_0xa49c('0x15'));var as=require(_0xa49c('0x16'));var hardwareService=require(_0xa49c('0x17'));var logger=require(_0xa49c('0x18'))(_0xa49c('0x19'));var utils=require(_0xa49c('0x1a'));var config=require(_0xa49c('0x1b'));var licenseUtil=require(_0xa49c('0x1c'));var db=require(_0xa49c('0x1d'))['db'];function respondWithStatusCode(_0x3af660,_0x1ce0c1){_0x1ce0c1=_0x1ce0c1||0xcc;return function(_0x5ad0fa){if(_0x5ad0fa){return _0x3af660[_0xa49c('0x1e')](_0x1ce0c1);}return _0x3af660[_0xa49c('0x1f')](_0x1ce0c1)['end']();};}function respondWithResult(_0x57242d,_0xb47fb7){_0xb47fb7=_0xb47fb7||0xc8;return function(_0x56d5f4){if(_0x56d5f4){return _0x57242d[_0xa49c('0x1f')](_0xb47fb7)[_0xa49c('0x20')](_0x56d5f4);}};}function respondWithFilteredResult(_0x36d872,_0x3371d3){return function(_0x5e7bc0){if(_0x5e7bc0){var _0x15b486=_0x5e7bc0[_0xa49c('0x21')],_0x2b562d=_0x3371d3['offset'],_0x4a8af5=_0x3371d3[_0xa49c('0x22')]+_0x3371d3['limit'],_0x508bd3;if(_0x4a8af5>=_0x15b486){_0x4a8af5=_0x15b486;_0x508bd3=0xc8;}else{_0x508bd3=0xce;}_0x36d872[_0xa49c('0x1f')](_0x508bd3);return _0x36d872[_0xa49c('0x23')](_0xa49c('0x24'),_0x2b562d+'-'+_0x4a8af5+'/'+_0x15b486)[_0xa49c('0x20')](_0x5e7bc0);}return null;};}function patchUpdates(_0x100660){return function(_0x4b9a55){try{jsonpatch[_0xa49c('0x25')](_0x4b9a55,_0x100660,!![]);}catch(_0x24bdde){return BPromise[_0xa49c('0x26')](_0x24bdde);}return _0x4b9a55[_0xa49c('0x27')]();};}function saveUpdates(_0x20d29f,_0x60ca0){return function(_0x510bf6){if(_0x510bf6){return _0x510bf6[_0xa49c('0x28')](_0x20d29f)[_0xa49c('0x29')](function(_0x56cc16){return _0x56cc16;});}return null;};}function removeEntity(_0x1cd4c1,_0x1aa165){return function(_0x18cccf){if(_0x18cccf){return _0x18cccf[_0xa49c('0x2a')]()['then'](function(){_0x1cd4c1[_0xa49c('0x1f')](0xcc)[_0xa49c('0x2b')]();});}};}function handleEntityNotFound(_0x165063,_0x43e33f){return function(_0x5501e6){if(!_0x5501e6){_0x165063[_0xa49c('0x1e')](0x194);}return _0x5501e6;};}function handleError(_0x562d29,_0x36958e){_0x36958e=_0x36958e||0x1f4;return function(_0x15ae7f){logger[_0xa49c('0x2c')](_0x15ae7f['stack']);if(_0x15ae7f[_0xa49c('0x2d')]){delete _0x15ae7f[_0xa49c('0x2d')];}_0x562d29['status'](_0x36958e)[_0xa49c('0x2e')](_0x15ae7f);};}exports['index']=function(_0x4f32ec,_0xcddd6e){var _0x25897b={},_0x67171f={},_0x3ae65f={'count':0x0,'rows':[]};var _0x3bb131=_[_0xa49c('0x2f')](db['MailSubstatus']['rawAttributes'],function(_0x1ba68e){return{'name':_0x1ba68e['fieldName'],'type':_0x1ba68e[_0xa49c('0x30')][_0xa49c('0x31')]};});_0x67171f[_0xa49c('0x32')]=_[_0xa49c('0x2f')](_0x3bb131,_0xa49c('0x2d'));_0x67171f[_0xa49c('0x33')]=_[_0xa49c('0x34')](_0x4f32ec[_0xa49c('0x33')]);_0x67171f[_0xa49c('0x35')]=_[_0xa49c('0x36')](_0x67171f[_0xa49c('0x32')],_0x67171f[_0xa49c('0x33')]);_0x25897b['attributes']=_['intersection'](_0x67171f[_0xa49c('0x32')],qs[_0xa49c('0x37')](_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x37')]));_0x25897b[_0xa49c('0x38')]=_0x25897b[_0xa49c('0x38')][_0xa49c('0x39')]?_0x25897b[_0xa49c('0x38')]:_0x67171f[_0xa49c('0x32')];if(!_0x4f32ec[_0xa49c('0x33')]['hasOwnProperty'](_0xa49c('0x3a'))){_0x25897b[_0xa49c('0x3b')]=qs[_0xa49c('0x3b')](_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x3b')]);_0x25897b[_0xa49c('0x22')]=qs[_0xa49c('0x22')](_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x22')]);}_0x25897b[_0xa49c('0x3c')]=qs[_0xa49c('0x3d')](_0x4f32ec['query'][_0xa49c('0x3d')]);_0x25897b['where']=qs['filters'](_['pick'](_0x4f32ec['query'],_0x67171f['filters']),_0x3bb131);if(_0x4f32ec[_0xa49c('0x33')][_0xa49c('0x3e')]){_0x25897b[_0xa49c('0x3f')]=_[_0xa49c('0x40')](_0x25897b[_0xa49c('0x3f')],{'$or':_['map'](_0x3bb131,function(_0xc9551){if(_0xc9551[_0xa49c('0x30')]!==_0xa49c('0x41')){var _0x571f39={};_0x571f39[_0xc9551[_0xa49c('0x2d')]]={'$like':'%'+_0x4f32ec['query'][_0xa49c('0x3e')]+'%'};return _0x571f39;}})});}_0x25897b=_[_0xa49c('0x40')]({},_0x25897b,_0x4f32ec[_0xa49c('0x42')]);var _0x1092cd={'where':_0x25897b[_0xa49c('0x3f')]};return db[_0xa49c('0x43')]['count'](_0x1092cd)[_0xa49c('0x29')](function(_0x21923c){_0x3ae65f[_0xa49c('0x21')]=_0x21923c;if(_0x4f32ec['query'][_0xa49c('0x44')]){_0x25897b[_0xa49c('0x45')]=[{'all':!![]}];}return db['MailSubstatus'][_0xa49c('0x46')](_0x25897b);})[_0xa49c('0x29')](function(_0x55a63b){_0x3ae65f['rows']=_0x55a63b;return _0x3ae65f;})[_0xa49c('0x29')](respondWithFilteredResult(_0xcddd6e,_0x25897b))['catch'](handleError(_0xcddd6e,null));};exports[_0xa49c('0x47')]=function(_0x278a94,_0x3e4d68){var _0x39ac12={'raw':!![],'where':{'id':_0x278a94[_0xa49c('0x48')]['id']}},_0x4ac377={};_0x4ac377[_0xa49c('0x32')]=_[_0xa49c('0x34')](db[_0xa49c('0x43')][_0xa49c('0x49')]);_0x4ac377[_0xa49c('0x33')]=_[_0xa49c('0x34')](_0x278a94['query']);_0x4ac377[_0xa49c('0x35')]=_[_0xa49c('0x36')](_0x4ac377[_0xa49c('0x32')],_0x4ac377[_0xa49c('0x33')]);_0x39ac12['attributes']=_[_0xa49c('0x36')](_0x4ac377['model'],qs[_0xa49c('0x37')](_0x278a94['query'][_0xa49c('0x37')]));_0x39ac12[_0xa49c('0x38')]=_0x39ac12[_0xa49c('0x38')][_0xa49c('0x39')]?_0x39ac12[_0xa49c('0x38')]:_0x4ac377[_0xa49c('0x32')];if(_0x278a94[_0xa49c('0x33')]['includeAll']){_0x39ac12[_0xa49c('0x45')]=[{'all':!![]}];}_0x39ac12=_['merge']({},_0x39ac12,_0x278a94[_0xa49c('0x42')]);return db[_0xa49c('0x43')][_0xa49c('0x4a')](_0x39ac12)['then'](handleEntityNotFound(_0x3e4d68,null))['then'](respondWithResult(_0x3e4d68,null))[_0xa49c('0x4b')](handleError(_0x3e4d68,null));};exports[_0xa49c('0x4c')]=function(_0x234bf8,_0x136f93){return db['MailSubstatus'][_0xa49c('0x4c')](_0x234bf8[_0xa49c('0x4d')],{})[_0xa49c('0x29')](respondWithResult(_0x136f93,0xc9))[_0xa49c('0x4b')](handleError(_0x136f93,null));};exports[_0xa49c('0x28')]=function(_0x4403ac,_0x2c312f){if(_0x4403ac['body']['id']){delete _0x4403ac['body']['id'];}return db[_0xa49c('0x43')][_0xa49c('0x4a')]({'where':{'id':_0x4403ac[_0xa49c('0x48')]['id']}})[_0xa49c('0x29')](handleEntityNotFound(_0x2c312f,null))['then'](saveUpdates(_0x4403ac[_0xa49c('0x4d')],null))[_0xa49c('0x29')](respondWithResult(_0x2c312f,null))['catch'](handleError(_0x2c312f,null));};exports[_0xa49c('0x2a')]=function(_0x1b1c1d,_0x20f883){return db['MailSubstatus'][_0xa49c('0x4a')]({'where':{'id':_0x1b1c1d[_0xa49c('0x48')]['id']}})['then'](handleEntityNotFound(_0x20f883,null))[_0xa49c('0x29')](removeEntity(_0x20f883,null))[_0xa49c('0x4b')](handleError(_0x20f883,null));};exports[_0xa49c('0x4e')]=function(_0x5e2417,_0x5642cc){return db[_0xa49c('0x43')][_0xa49c('0x4e')]()[_0xa49c('0x29')](respondWithResult(_0x5642cc,null))[_0xa49c('0x4b')](handleError(_0x5642cc,null));}; \ No newline at end of file +var _0x2fde=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','MailSubstatus','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format'];(function(_0x3840b2,_0x3c46b5){var _0x257d05=function(_0x4d786b){while(--_0x4d786b){_0x3840b2['push'](_0x3840b2['shift']());}};_0x257d05(++_0x3c46b5);}(_0x2fde,0xd9));var _0xe2fd=function(_0x2e5b47,_0x40f777){_0x2e5b47=_0x2e5b47-0x0;var _0x561630=_0x2fde[_0x2e5b47];return _0x561630;};'use strict';var pdf=require(_0xe2fd('0x0'));var emlformat=require(_0xe2fd('0x1'));var rimraf=require(_0xe2fd('0x2'));var zipdir=require(_0xe2fd('0x3'));var jsonpatch=require(_0xe2fd('0x4'));var rp=require(_0xe2fd('0x5'));var moment=require(_0xe2fd('0x6'));var BPromise=require(_0xe2fd('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe2fd('0x8'));var sox=require(_0xe2fd('0x9'));var csv=require(_0xe2fd('0xa'));var ejs=require(_0xe2fd('0xb'));var fs=require('fs');var _=require(_0xe2fd('0xc'));var squel=require(_0xe2fd('0xd'));var crypto=require(_0xe2fd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe2fd('0xf'));var toCsv=require(_0xe2fd('0xa'));var querystring=require(_0xe2fd('0x10'));var Papa=require(_0xe2fd('0x11'));var Redis=require(_0xe2fd('0x12'));var authService=require(_0xe2fd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe2fd('0x14'));var hardwareService=require(_0xe2fd('0x15'));var logger=require(_0xe2fd('0x16'))(_0xe2fd('0x17'));var utils=require(_0xe2fd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe2fd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbfa06b,_0x56f045){_0x56f045=_0x56f045||0xcc;return function(_0x1fcb94){if(_0x1fcb94){return _0xbfa06b[_0xe2fd('0x1a')](_0x56f045);}return _0xbfa06b['status'](_0x56f045)[_0xe2fd('0x1b')]();};}function respondWithResult(_0x5067a5,_0x5b37c6){_0x5b37c6=_0x5b37c6||0xc8;return function(_0x413342){if(_0x413342){return _0x5067a5[_0xe2fd('0x1c')](_0x5b37c6)[_0xe2fd('0x1d')](_0x413342);}};}function respondWithFilteredResult(_0x433563,_0xae792){return function(_0x111570){if(_0x111570){var _0x2b5dd9=_0x111570[_0xe2fd('0x1e')],_0x5ace2c=_0xae792[_0xe2fd('0x1f')],_0x44fdf4=_0xae792[_0xe2fd('0x1f')]+_0xae792[_0xe2fd('0x20')],_0x3bc36c;if(_0x44fdf4>=_0x2b5dd9){_0x44fdf4=_0x2b5dd9;_0x3bc36c=0xc8;}else{_0x3bc36c=0xce;}_0x433563[_0xe2fd('0x1c')](_0x3bc36c);return _0x433563[_0xe2fd('0x21')](_0xe2fd('0x22'),_0x5ace2c+'-'+_0x44fdf4+'/'+_0x2b5dd9)[_0xe2fd('0x1d')](_0x111570);}return null;};}function patchUpdates(_0x52a86a){return function(_0x16dcf6){try{jsonpatch[_0xe2fd('0x23')](_0x16dcf6,_0x52a86a,!![]);}catch(_0x1fab09){return BPromise[_0xe2fd('0x24')](_0x1fab09);}return _0x16dcf6['save']();};}function saveUpdates(_0x4d5059,_0x5aaa7a){return function(_0x15735c){if(_0x15735c){return _0x15735c[_0xe2fd('0x25')](_0x4d5059)['then'](function(_0x24f8ce){return _0x24f8ce;});}return null;};}function removeEntity(_0x1fb678,_0x37c412){return function(_0x5f21d3){if(_0x5f21d3){return _0x5f21d3[_0xe2fd('0x26')]()[_0xe2fd('0x27')](function(){_0x1fb678['status'](0xcc)[_0xe2fd('0x1b')]();});}};}function handleEntityNotFound(_0x275500,_0x12d3a2){return function(_0xd794ec){if(!_0xd794ec){_0x275500[_0xe2fd('0x1a')](0x194);}return _0xd794ec;};}function handleError(_0x1d6c49,_0xde4b58){_0xde4b58=_0xde4b58||0x1f4;return function(_0x6b4e5a){logger[_0xe2fd('0x28')](_0x6b4e5a['stack']);if(_0x6b4e5a['name']){delete _0x6b4e5a[_0xe2fd('0x29')];}_0x1d6c49[_0xe2fd('0x1c')](_0xde4b58)[_0xe2fd('0x2a')](_0x6b4e5a);};}exports['index']=function(_0x10a5de,_0x1d1a15){var _0xfcce35={},_0xd7a97d={},_0x3b0532={'count':0x0,'rows':[]};var _0x424ed0=_[_0xe2fd('0x2b')](db[_0xe2fd('0x2c')]['rawAttributes'],function(_0x5bc032){return{'name':_0x5bc032['fieldName'],'type':_0x5bc032[_0xe2fd('0x2d')][_0xe2fd('0x2e')]};});_0xd7a97d[_0xe2fd('0x2f')]=_[_0xe2fd('0x2b')](_0x424ed0,'name');_0xd7a97d[_0xe2fd('0x30')]=_[_0xe2fd('0x31')](_0x10a5de['query']);_0xd7a97d[_0xe2fd('0x32')]=_[_0xe2fd('0x33')](_0xd7a97d[_0xe2fd('0x2f')],_0xd7a97d[_0xe2fd('0x30')]);_0xfcce35[_0xe2fd('0x34')]=_['intersection'](_0xd7a97d[_0xe2fd('0x2f')],qs[_0xe2fd('0x35')](_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x35')]));_0xfcce35[_0xe2fd('0x34')]=_0xfcce35[_0xe2fd('0x34')][_0xe2fd('0x36')]?_0xfcce35['attributes']:_0xd7a97d['model'];if(!_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x37')]('nolimit')){_0xfcce35[_0xe2fd('0x20')]=qs['limit'](_0x10a5de[_0xe2fd('0x30')]['limit']);_0xfcce35[_0xe2fd('0x1f')]=qs['offset'](_0x10a5de[_0xe2fd('0x30')]['offset']);}_0xfcce35[_0xe2fd('0x38')]=qs[_0xe2fd('0x39')](_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x39')]);_0xfcce35[_0xe2fd('0x3a')]=qs[_0xe2fd('0x32')](_[_0xe2fd('0x3b')](_0x10a5de[_0xe2fd('0x30')],_0xd7a97d['filters']),_0x424ed0);if(_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x3c')]){_0xfcce35[_0xe2fd('0x3a')]=_['merge'](_0xfcce35[_0xe2fd('0x3a')],{'$or':_[_0xe2fd('0x2b')](_0x424ed0,function(_0x374917){if(_0x374917[_0xe2fd('0x2d')]!=='VIRTUAL'){var _0x34178d={};_0x34178d[_0x374917[_0xe2fd('0x29')]]={'$like':'%'+_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x3c')]+'%'};return _0x34178d;}})});}_0xfcce35=_[_0xe2fd('0x3d')]({},_0xfcce35,_0x10a5de[_0xe2fd('0x3e')]);var _0x12586f={'where':_0xfcce35[_0xe2fd('0x3a')]};return db['MailSubstatus'][_0xe2fd('0x1e')](_0x12586f)[_0xe2fd('0x27')](function(_0x2fe668){_0x3b0532[_0xe2fd('0x1e')]=_0x2fe668;if(_0x10a5de[_0xe2fd('0x30')][_0xe2fd('0x3f')]){_0xfcce35[_0xe2fd('0x40')]=[{'all':!![]}];}return db[_0xe2fd('0x2c')][_0xe2fd('0x41')](_0xfcce35);})[_0xe2fd('0x27')](function(_0x53d08d){_0x3b0532['rows']=_0x53d08d;return _0x3b0532;})[_0xe2fd('0x27')](respondWithFilteredResult(_0x1d1a15,_0xfcce35))[_0xe2fd('0x42')](handleError(_0x1d1a15,null));};exports[_0xe2fd('0x43')]=function(_0x341a43,_0x1e064){var _0x2bcd78={'raw':!![],'where':{'id':_0x341a43[_0xe2fd('0x44')]['id']}},_0x287ce2={};_0x287ce2[_0xe2fd('0x2f')]=_[_0xe2fd('0x31')](db[_0xe2fd('0x2c')]['rawAttributes']);_0x287ce2['query']=_[_0xe2fd('0x31')](_0x341a43[_0xe2fd('0x30')]);_0x287ce2[_0xe2fd('0x32')]=_[_0xe2fd('0x33')](_0x287ce2['model'],_0x287ce2[_0xe2fd('0x30')]);_0x2bcd78['attributes']=_[_0xe2fd('0x33')](_0x287ce2[_0xe2fd('0x2f')],qs[_0xe2fd('0x35')](_0x341a43[_0xe2fd('0x30')][_0xe2fd('0x35')]));_0x2bcd78['attributes']=_0x2bcd78[_0xe2fd('0x34')]['length']?_0x2bcd78['attributes']:_0x287ce2[_0xe2fd('0x2f')];if(_0x341a43[_0xe2fd('0x30')][_0xe2fd('0x3f')]){_0x2bcd78['include']=[{'all':!![]}];}_0x2bcd78=_['merge']({},_0x2bcd78,_0x341a43[_0xe2fd('0x3e')]);return db[_0xe2fd('0x2c')][_0xe2fd('0x45')](_0x2bcd78)['then'](handleEntityNotFound(_0x1e064,null))['then'](respondWithResult(_0x1e064,null))[_0xe2fd('0x42')](handleError(_0x1e064,null));};exports[_0xe2fd('0x46')]=function(_0xbc9158,_0x27a0f4){return db[_0xe2fd('0x2c')]['create'](_0xbc9158['body'],{})[_0xe2fd('0x27')](respondWithResult(_0x27a0f4,0xc9))[_0xe2fd('0x42')](handleError(_0x27a0f4,null));};exports[_0xe2fd('0x25')]=function(_0x205087,_0x5a25c9){if(_0x205087['body']['id']){delete _0x205087[_0xe2fd('0x47')]['id'];}return db[_0xe2fd('0x2c')][_0xe2fd('0x45')]({'where':{'id':_0x205087['params']['id']}})[_0xe2fd('0x27')](handleEntityNotFound(_0x5a25c9,null))[_0xe2fd('0x27')](saveUpdates(_0x205087[_0xe2fd('0x47')],null))[_0xe2fd('0x27')](respondWithResult(_0x5a25c9,null))[_0xe2fd('0x42')](handleError(_0x5a25c9,null));};exports[_0xe2fd('0x26')]=function(_0x46ea20,_0x52c392){return db['MailSubstatus'][_0xe2fd('0x45')]({'where':{'id':_0x46ea20[_0xe2fd('0x44')]['id']}})[_0xe2fd('0x27')](handleEntityNotFound(_0x52c392,null))[_0xe2fd('0x27')](removeEntity(_0x52c392,null))[_0xe2fd('0x42')](handleError(_0x52c392,null));};exports['describe']=function(_0x571566,_0x4df2a7){return db['MailSubstatus'][_0xe2fd('0x48')]()[_0xe2fd('0x27')](respondWithResult(_0x4df2a7,null))[_0xe2fd('0x42')](handleError(_0x4df2a7,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 0560784..58259a3 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 _0xc2a2=['./mailSubstatus.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x7be910,_0x2b381b){var _0x496ddf=function(_0x3ac518){while(--_0x3ac518){_0x7be910['push'](_0x7be910['shift']());}};_0x496ddf(++_0x2b381b);}(_0xc2a2,0x84));var _0x2c2a=function(_0x2abbdf,_0x4cb409){_0x2abbdf=_0x2abbdf-0x0;var _0x12f4bc=_0xc2a2[_0x2abbdf];return _0x12f4bc;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6931=['moment','bluebird','request-promise','path','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api'];(function(_0x49fbe8,_0x14452c){var _0xd3637d=function(_0x55e48f){while(--_0x55e48f){_0x49fbe8['push'](_0x49fbe8['shift']());}};_0xd3637d(++_0x14452c);}(_0x6931,0x1a9));var _0x1693=function(_0x7e74b6,_0x5d8d7e){_0x7e74b6=_0x7e74b6-0x0;var _0x4fbaf3=_0x6931[_0x7e74b6];return _0x4fbaf3;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require(_0x1693('0x2'))(_0x1693('0x3'));var moment=require(_0x1693('0x4'));var BPromise=require(_0x1693('0x5'));var rp=require(_0x1693('0x6'));var fs=require('fs');var path=require(_0x1693('0x7'));var rimraf=require('rimraf');var config=require(_0x1693('0x8'));var attributes=require(_0x1693('0x9'));module[_0x1693('0xa')]=function(_0x455646,_0x379d6c){return _0x455646['define'](_0x1693('0xb'),attributes,{'tableName':_0x1693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 79962d6..5a7f59c 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 _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x1be1,0x192));var _0x11be=function(_0x5b2c8b,_0x283c0f){_0x5b2c8b=_0x5b2c8b-0x0;var _0x184438=_0x1be1[_0x5b2c8b];return _0x184438;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41052b,_0x136924){var _0x31bed0=function(_0x2d07fa){while(--_0x2d07fa){_0x41052b['push'](_0x41052b['shift']());}};_0x31bed0(++_0x136924);}(_0xe706,0xa3));var _0x6e70=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe706[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ffefa69..a02f3ad 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 _0x13f3=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x13f3,0x155));var _0x313f=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x13f3[_0x160248];return _0x4e589d;};'use strict';var multer=require(_0x313f('0x0'));var util=require(_0x313f('0x1'));var path=require('path');var timeout=require(_0x313f('0x2'));var express=require(_0x313f('0x3'));var router=express[_0x313f('0x4')]();var auth=require(_0x313f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x313f('0x6'));var controller=require('./mailTransferReport.controller');router[_0x313f('0x7')]('/',auth[_0x313f('0x8')](),controller[_0x313f('0x9')]);router[_0x313f('0x7')](_0x313f('0xa'),auth[_0x313f('0x8')](),controller[_0x313f('0xb')]);router['get'](_0x313f('0xc'),auth[_0x313f('0x8')](),controller[_0x313f('0xd')]);router['post']('/',auth[_0x313f('0x8')](),controller[_0x313f('0xe')]);router[_0x313f('0xf')](_0x313f('0xc'),auth[_0x313f('0x8')](),controller[_0x313f('0x10')]);router[_0x313f('0x11')]('/:id',auth[_0x313f('0x8')](),controller['destroy']);module[_0x313f('0x12')]=router; \ No newline at end of file +var _0x3048=['/describe','describe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3048,0x1d0));var _0x8304=function(_0x213502,_0x22ede6){_0x213502=_0x213502-0x0;var _0x40abef=_0x3048[_0x213502];return _0x40abef;};'use strict';var multer=require(_0x8304('0x0'));var util=require(_0x8304('0x1'));var path=require(_0x8304('0x2'));var timeout=require(_0x8304('0x3'));var express=require(_0x8304('0x4'));var router=express[_0x8304('0x5')]();var auth=require(_0x8304('0x6'));var interaction=require(_0x8304('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x8304('0x8')]('/',auth[_0x8304('0x9')](),controller[_0x8304('0xa')]);router[_0x8304('0x8')](_0x8304('0xb'),auth[_0x8304('0x9')](),controller[_0x8304('0xc')]);router[_0x8304('0x8')]('/:id',auth[_0x8304('0x9')](),controller['show']);router['post']('/',auth[_0x8304('0x9')](),controller['create']);router[_0x8304('0xd')](_0x8304('0xe'),auth[_0x8304('0x9')](),controller[_0x8304('0xf')]);router[_0x8304('0x10')](_0x8304('0xe'),auth[_0x8304('0x9')](),controller[_0x8304('0x11')]);module[_0x8304('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a0bde3f..882c840 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 _0x75f7=['account','agent','queue','NOW','moment'];(function(_0xf1a8c3,_0x3a475a){var _0x573384=function(_0x2f5dd0){while(--_0x2f5dd0){_0xf1a8c3['push'](_0xf1a8c3['shift']());}};_0x573384(++_0x3a475a);}(_0x75f7,0xc7));var _0x775f=function(_0x4d2806,_0x4449c1){_0x4d2806=_0x4d2806-0x0;var _0x587a38=_0x75f7[_0x4d2806];return _0x587a38;};'use strict';var moment=require(_0x775f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x775f('0x1'),_0x775f('0x2'),_0x775f('0x3')),'allowNull':![],'defaultValue':_0x775f('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x775f('0x4')]}}; \ No newline at end of file +var _0xffbc=['NOW','moment','exports','ENUM','queue','DATE'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xffbc,0xc7));var _0xcffb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xffbc[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xcffb('0x0'));var Sequelize=require('sequelize');module[_0xcffb('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcffb('0x2')]('account','agent',_0xcffb('0x3')),'allowNull':![],'defaultValue':_0xcffb('0x3')},'transferredAt':{'type':Sequelize[_0xcffb('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xcffb('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 64adb7f..b08b2f6 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 _0x059b=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir'];(function(_0x51ad04,_0x45989b){var _0x43204a=function(_0x8951c1){while(--_0x8951c1){_0x51ad04['push'](_0x51ad04['shift']());}};_0x43204a(++_0x45989b);}(_0x059b,0xde));var _0xb059=function(_0x5f2fb0,_0x42644d){_0x5f2fb0=_0x5f2fb0-0x0;var _0x5798b4=_0x059b[_0x5f2fb0];return _0x5798b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb059('0x0'));var rimraf=require(_0xb059('0x1'));var zipdir=require(_0xb059('0x2'));var jsonpatch=require(_0xb059('0x3'));var rp=require(_0xb059('0x4'));var moment=require(_0xb059('0x5'));var BPromise=require(_0xb059('0x6'));var Mustache=require(_0xb059('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb059('0x8'));var csv=require('to-csv');var ejs=require(_0xb059('0x9'));var fs=require('fs');var _=require(_0xb059('0xa'));var squel=require(_0xb059('0xb'));var crypto=require('crypto');var jsforce=require(_0xb059('0xc'));var deskjs=require(_0xb059('0xd'));var toCsv=require(_0xb059('0xe'));var querystring=require(_0xb059('0xf'));var Papa=require(_0xb059('0x10'));var Redis=require('ioredis');var authService=require(_0xb059('0x11'));var qs=require(_0xb059('0x12'));var as=require(_0xb059('0x13'));var hardwareService=require(_0xb059('0x14'));var logger=require('../../config/logger')(_0xb059('0x15'));var utils=require(_0xb059('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb059('0x17'));var db=require(_0xb059('0x18'))['db'];function respondWithStatusCode(_0x5eb69d,_0x43420a){_0x43420a=_0x43420a||0xcc;return function(_0x1fb936){if(_0x1fb936){return _0x5eb69d[_0xb059('0x19')](_0x43420a);}return _0x5eb69d[_0xb059('0x1a')](_0x43420a)[_0xb059('0x1b')]();};}function respondWithResult(_0x57f18d,_0x2637b2){_0x2637b2=_0x2637b2||0xc8;return function(_0x5e1df4){if(_0x5e1df4){return _0x57f18d[_0xb059('0x1a')](_0x2637b2)['json'](_0x5e1df4);}};}function respondWithFilteredResult(_0x4ae0f0,_0x4a18a5){return function(_0x41263d){if(_0x41263d){var _0x5a1342=_0x41263d['count'],_0x22a9b0=_0x4a18a5['offset'],_0x2ca82a=_0x4a18a5[_0xb059('0x1c')]+_0x4a18a5['limit'],_0x423f68;if(_0x2ca82a>=_0x5a1342){_0x2ca82a=_0x5a1342;_0x423f68=0xc8;}else{_0x423f68=0xce;}_0x4ae0f0[_0xb059('0x1a')](_0x423f68);return _0x4ae0f0[_0xb059('0x1d')]('Content-Range',_0x22a9b0+'-'+_0x2ca82a+'/'+_0x5a1342)[_0xb059('0x1e')](_0x41263d);}return null;};}function patchUpdates(_0x45bff){return function(_0x45e2e9){try{jsonpatch[_0xb059('0x1f')](_0x45e2e9,_0x45bff,!![]);}catch(_0x62bfa2){return BPromise[_0xb059('0x20')](_0x62bfa2);}return _0x45e2e9[_0xb059('0x21')]();};}function saveUpdates(_0x5493a5,_0x2f46b1){return function(_0x4a0345){if(_0x4a0345){return _0x4a0345[_0xb059('0x22')](_0x5493a5)[_0xb059('0x23')](function(_0x48cf54){return _0x48cf54;});}return null;};}function removeEntity(_0x1ab032,_0xc150dc){return function(_0x40261c){if(_0x40261c){return _0x40261c[_0xb059('0x24')]()[_0xb059('0x23')](function(){_0x1ab032['status'](0xcc)[_0xb059('0x1b')]();});}};}function handleEntityNotFound(_0x5d5123,_0x235318){return function(_0x54fd0a){if(!_0x54fd0a){_0x5d5123[_0xb059('0x19')](0x194);}return _0x54fd0a;};}function handleError(_0x2c9b2e,_0x4bcd75){_0x4bcd75=_0x4bcd75||0x1f4;return function(_0xe64e29){logger[_0xb059('0x25')](_0xe64e29['stack']);if(_0xe64e29[_0xb059('0x26')]){delete _0xe64e29[_0xb059('0x26')];}_0x2c9b2e[_0xb059('0x1a')](_0x4bcd75)['send'](_0xe64e29);};}exports[_0xb059('0x27')]=function(_0x104987,_0x943f26){var _0x39c765={},_0x3c81e2={},_0x486038={'count':0x0,'rows':[]};var _0x5eb740=_[_0xb059('0x28')](db[_0xb059('0x29')][_0xb059('0x2a')],function(_0x322dbf){return{'name':_0x322dbf[_0xb059('0x2b')],'type':_0x322dbf[_0xb059('0x2c')][_0xb059('0x2d')]};});_0x3c81e2[_0xb059('0x2e')]=_[_0xb059('0x28')](_0x5eb740,_0xb059('0x26'));_0x3c81e2[_0xb059('0x2f')]=_['keys'](_0x104987[_0xb059('0x2f')]);_0x3c81e2['filters']=_[_0xb059('0x30')](_0x3c81e2[_0xb059('0x2e')],_0x3c81e2[_0xb059('0x2f')]);_0x39c765['attributes']=_[_0xb059('0x30')](_0x3c81e2[_0xb059('0x2e')],qs['fields'](_0x104987[_0xb059('0x2f')][_0xb059('0x31')]));_0x39c765['attributes']=_0x39c765[_0xb059('0x32')][_0xb059('0x33')]?_0x39c765['attributes']:_0x3c81e2[_0xb059('0x2e')];if(!_0x104987[_0xb059('0x2f')][_0xb059('0x34')]('nolimit')){_0x39c765[_0xb059('0x35')]=qs[_0xb059('0x35')](_0x104987[_0xb059('0x2f')][_0xb059('0x35')]);_0x39c765[_0xb059('0x1c')]=qs[_0xb059('0x1c')](_0x104987[_0xb059('0x2f')][_0xb059('0x1c')]);}_0x39c765[_0xb059('0x36')]=qs['sort'](_0x104987[_0xb059('0x2f')][_0xb059('0x37')]);_0x39c765['where']=qs[_0xb059('0x38')](_[_0xb059('0x39')](_0x104987[_0xb059('0x2f')],_0x3c81e2[_0xb059('0x38')]),_0x5eb740);if(_0x104987['query'][_0xb059('0x3a')]){_0x39c765['where']=_[_0xb059('0x3b')](_0x39c765[_0xb059('0x3c')],{'$or':_[_0xb059('0x28')](_0x5eb740,function(_0x1318a6){if(_0x1318a6[_0xb059('0x2c')]!==_0xb059('0x3d')){var _0x444ab6={};_0x444ab6[_0x1318a6['name']]={'$like':'%'+_0x104987[_0xb059('0x2f')][_0xb059('0x3a')]+'%'};return _0x444ab6;}})});}_0x39c765=_[_0xb059('0x3b')]({},_0x39c765,_0x104987[_0xb059('0x3e')]);var _0x4358db={'where':_0x39c765[_0xb059('0x3c')]};return db['MailTransferReport']['count'](_0x4358db)[_0xb059('0x23')](function(_0x18a403){_0x486038[_0xb059('0x3f')]=_0x18a403;if(_0x104987['query']['includeAll']){_0x39c765[_0xb059('0x40')]=[{'all':!![]}];}return db[_0xb059('0x29')][_0xb059('0x41')](_0x39c765);})['then'](function(_0x91047a){_0x486038[_0xb059('0x42')]=_0x91047a;return _0x486038;})[_0xb059('0x23')](respondWithFilteredResult(_0x943f26,_0x39c765))[_0xb059('0x43')](handleError(_0x943f26,null));};exports[_0xb059('0x44')]=function(_0x43bd34,_0x3fcb06){var _0x4cea27={'raw':!![],'where':{'id':_0x43bd34['params']['id']}},_0x17f011={};_0x17f011[_0xb059('0x2e')]=_[_0xb059('0x45')](db[_0xb059('0x29')][_0xb059('0x2a')]);_0x17f011[_0xb059('0x2f')]=_[_0xb059('0x45')](_0x43bd34[_0xb059('0x2f')]);_0x17f011['filters']=_[_0xb059('0x30')](_0x17f011[_0xb059('0x2e')],_0x17f011[_0xb059('0x2f')]);_0x4cea27[_0xb059('0x32')]=_[_0xb059('0x30')](_0x17f011[_0xb059('0x2e')],qs[_0xb059('0x31')](_0x43bd34[_0xb059('0x2f')]['fields']));_0x4cea27[_0xb059('0x32')]=_0x4cea27[_0xb059('0x32')]['length']?_0x4cea27[_0xb059('0x32')]:_0x17f011[_0xb059('0x2e')];if(_0x43bd34[_0xb059('0x2f')]['includeAll']){_0x4cea27[_0xb059('0x40')]=[{'all':!![]}];}_0x4cea27=_[_0xb059('0x3b')]({},_0x4cea27,_0x43bd34[_0xb059('0x3e')]);return db[_0xb059('0x29')][_0xb059('0x46')](_0x4cea27)['then'](handleEntityNotFound(_0x3fcb06,null))['then'](respondWithResult(_0x3fcb06,null))[_0xb059('0x43')](handleError(_0x3fcb06,null));};exports[_0xb059('0x47')]=function(_0x22b1fb,_0x29fe69){return db[_0xb059('0x29')][_0xb059('0x47')](_0x22b1fb[_0xb059('0x48')],{})[_0xb059('0x23')](respondWithResult(_0x29fe69,0xc9))[_0xb059('0x43')](handleError(_0x29fe69,null));};exports[_0xb059('0x22')]=function(_0x488a10,_0x459c4f){if(_0x488a10['body']['id']){delete _0x488a10[_0xb059('0x48')]['id'];}return db[_0xb059('0x29')]['find']({'where':{'id':_0x488a10[_0xb059('0x49')]['id']}})[_0xb059('0x23')](handleEntityNotFound(_0x459c4f,null))[_0xb059('0x23')](saveUpdates(_0x488a10[_0xb059('0x48')],null))[_0xb059('0x23')](respondWithResult(_0x459c4f,null))[_0xb059('0x43')](handleError(_0x459c4f,null));};exports[_0xb059('0x24')]=function(_0x3d81ba,_0x1b613b){return db[_0xb059('0x29')][_0xb059('0x46')]({'where':{'id':_0x3d81ba['params']['id']}})['then'](handleEntityNotFound(_0x1b613b,null))[_0xb059('0x23')](removeEntity(_0x1b613b,null))['catch'](handleError(_0x1b613b,null));};exports[_0xb059('0x4a')]=function(_0x2829fe,_0x1a0028){return db[_0xb059('0x29')][_0xb059('0x4a')]()[_0xb059('0x23')](respondWithResult(_0x1a0028,null))[_0xb059('0x43')](handleError(_0x1a0028,null));}; \ No newline at end of file +var _0x758a=['offset','limit','set','Content-Range','reject','save','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','count','then','includeAll','rows','show','params','keys','fields','include','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x758a,0x1d1));var _0xa758=function(_0xed6929,_0x5842e4){_0xed6929=_0xed6929-0x0;var _0x5412a9=_0x758a[_0xed6929];return _0x5412a9;};'use strict';var pdf=require(_0xa758('0x0'));var emlformat=require(_0xa758('0x1'));var rimraf=require(_0xa758('0x2'));var zipdir=require(_0xa758('0x3'));var jsonpatch=require(_0xa758('0x4'));var rp=require(_0xa758('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa758('0x6'));var path=require('path');var sox=require(_0xa758('0x7'));var csv=require(_0xa758('0x8'));var ejs=require(_0xa758('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa758('0xa'));var jsforce=require(_0xa758('0xb'));var deskjs=require(_0xa758('0xc'));var toCsv=require(_0xa758('0x8'));var querystring=require(_0xa758('0xd'));var Papa=require(_0xa758('0xe'));var Redis=require('ioredis');var authService=require(_0xa758('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa758('0x10'));var logger=require(_0xa758('0x11'))('api');var utils=require(_0xa758('0x12'));var config=require(_0xa758('0x13'));var licenseUtil=require(_0xa758('0x14'));var db=require(_0xa758('0x15'))['db'];function respondWithStatusCode(_0x3a2a7f,_0x190ed7){_0x190ed7=_0x190ed7||0xcc;return function(_0x1a78c6){if(_0x1a78c6){return _0x3a2a7f['sendStatus'](_0x190ed7);}return _0x3a2a7f['status'](_0x190ed7)[_0xa758('0x16')]();};}function respondWithResult(_0x5b5e8d,_0x5cd902){_0x5cd902=_0x5cd902||0xc8;return function(_0x465ced){if(_0x465ced){return _0x5b5e8d[_0xa758('0x17')](_0x5cd902)[_0xa758('0x18')](_0x465ced);}};}function respondWithFilteredResult(_0x4ce12f,_0x5d837f){return function(_0x6383d4){if(_0x6383d4){var _0x5dad5a=_0x6383d4['count'],_0x2a37c4=_0x5d837f[_0xa758('0x19')],_0x50cfba=_0x5d837f[_0xa758('0x19')]+_0x5d837f[_0xa758('0x1a')],_0x1da460;if(_0x50cfba>=_0x5dad5a){_0x50cfba=_0x5dad5a;_0x1da460=0xc8;}else{_0x1da460=0xce;}_0x4ce12f[_0xa758('0x17')](_0x1da460);return _0x4ce12f[_0xa758('0x1b')](_0xa758('0x1c'),_0x2a37c4+'-'+_0x50cfba+'/'+_0x5dad5a)[_0xa758('0x18')](_0x6383d4);}return null;};}function patchUpdates(_0x584a36){return function(_0x220f28){try{jsonpatch['apply'](_0x220f28,_0x584a36,!![]);}catch(_0x21a823){return BPromise[_0xa758('0x1d')](_0x21a823);}return _0x220f28[_0xa758('0x1e')]();};}function saveUpdates(_0x36819c,_0x5ab473){return function(_0x225eb5){if(_0x225eb5){return _0x225eb5['update'](_0x36819c)['then'](function(_0x8f311){return _0x8f311;});}return null;};}function removeEntity(_0x1096b0,_0x11830f){return function(_0x49bcae){if(_0x49bcae){return _0x49bcae[_0xa758('0x1f')]()['then'](function(){_0x1096b0[_0xa758('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3445e8,_0x49b993){return function(_0x3cf203){if(!_0x3cf203){_0x3445e8['sendStatus'](0x194);}return _0x3cf203;};}function handleError(_0x1ef4ad,_0x4c4b71){_0x4c4b71=_0x4c4b71||0x1f4;return function(_0x1c7651){logger[_0xa758('0x20')](_0x1c7651[_0xa758('0x21')]);if(_0x1c7651[_0xa758('0x22')]){delete _0x1c7651[_0xa758('0x22')];}_0x1ef4ad[_0xa758('0x17')](_0x4c4b71)[_0xa758('0x23')](_0x1c7651);};}exports[_0xa758('0x24')]=function(_0x5eda50,_0x56f3e9){var _0x4bcb3d={},_0x5df5d6={},_0x30b254={'count':0x0,'rows':[]};var _0x36ae70=_['map'](db[_0xa758('0x25')][_0xa758('0x26')],function(_0x32f5ac){return{'name':_0x32f5ac[_0xa758('0x27')],'type':_0x32f5ac[_0xa758('0x28')][_0xa758('0x29')]};});_0x5df5d6[_0xa758('0x2a')]=_[_0xa758('0x2b')](_0x36ae70,_0xa758('0x22'));_0x5df5d6[_0xa758('0x2c')]=_['keys'](_0x5eda50[_0xa758('0x2c')]);_0x5df5d6[_0xa758('0x2d')]=_[_0xa758('0x2e')](_0x5df5d6[_0xa758('0x2a')],_0x5df5d6[_0xa758('0x2c')]);_0x4bcb3d['attributes']=_[_0xa758('0x2e')](_0x5df5d6[_0xa758('0x2a')],qs['fields'](_0x5eda50['query']['fields']));_0x4bcb3d[_0xa758('0x2f')]=_0x4bcb3d['attributes'][_0xa758('0x30')]?_0x4bcb3d[_0xa758('0x2f')]:_0x5df5d6['model'];if(!_0x5eda50[_0xa758('0x2c')]['hasOwnProperty'](_0xa758('0x31'))){_0x4bcb3d[_0xa758('0x1a')]=qs[_0xa758('0x1a')](_0x5eda50['query'][_0xa758('0x1a')]);_0x4bcb3d[_0xa758('0x19')]=qs[_0xa758('0x19')](_0x5eda50[_0xa758('0x2c')][_0xa758('0x19')]);}_0x4bcb3d[_0xa758('0x32')]=qs[_0xa758('0x33')](_0x5eda50[_0xa758('0x2c')][_0xa758('0x33')]);_0x4bcb3d[_0xa758('0x34')]=qs[_0xa758('0x2d')](_['pick'](_0x5eda50['query'],_0x5df5d6['filters']),_0x36ae70);if(_0x5eda50[_0xa758('0x2c')][_0xa758('0x35')]){_0x4bcb3d['where']=_[_0xa758('0x36')](_0x4bcb3d[_0xa758('0x34')],{'$or':_[_0xa758('0x2b')](_0x36ae70,function(_0x104cae){if(_0x104cae['type']!=='VIRTUAL'){var _0x2a1db5={};_0x2a1db5[_0x104cae['name']]={'$like':'%'+_0x5eda50[_0xa758('0x2c')][_0xa758('0x35')]+'%'};return _0x2a1db5;}})});}_0x4bcb3d=_[_0xa758('0x36')]({},_0x4bcb3d,_0x5eda50['options']);var _0x27ed04={'where':_0x4bcb3d[_0xa758('0x34')]};return db[_0xa758('0x25')][_0xa758('0x37')](_0x27ed04)[_0xa758('0x38')](function(_0x16e747){_0x30b254[_0xa758('0x37')]=_0x16e747;if(_0x5eda50[_0xa758('0x2c')][_0xa758('0x39')]){_0x4bcb3d['include']=[{'all':!![]}];}return db[_0xa758('0x25')]['findAll'](_0x4bcb3d);})[_0xa758('0x38')](function(_0xc7f2e6){_0x30b254[_0xa758('0x3a')]=_0xc7f2e6;return _0x30b254;})[_0xa758('0x38')](respondWithFilteredResult(_0x56f3e9,_0x4bcb3d))['catch'](handleError(_0x56f3e9,null));};exports[_0xa758('0x3b')]=function(_0x31d1c8,_0x3351a0){var _0x346083={'raw':!![],'where':{'id':_0x31d1c8[_0xa758('0x3c')]['id']}},_0xbf9d12={};_0xbf9d12[_0xa758('0x2a')]=_[_0xa758('0x3d')](db[_0xa758('0x25')][_0xa758('0x26')]);_0xbf9d12[_0xa758('0x2c')]=_[_0xa758('0x3d')](_0x31d1c8[_0xa758('0x2c')]);_0xbf9d12[_0xa758('0x2d')]=_['intersection'](_0xbf9d12[_0xa758('0x2a')],_0xbf9d12[_0xa758('0x2c')]);_0x346083[_0xa758('0x2f')]=_[_0xa758('0x2e')](_0xbf9d12[_0xa758('0x2a')],qs[_0xa758('0x3e')](_0x31d1c8[_0xa758('0x2c')][_0xa758('0x3e')]));_0x346083[_0xa758('0x2f')]=_0x346083['attributes']['length']?_0x346083[_0xa758('0x2f')]:_0xbf9d12[_0xa758('0x2a')];if(_0x31d1c8[_0xa758('0x2c')][_0xa758('0x39')]){_0x346083[_0xa758('0x3f')]=[{'all':!![]}];}_0x346083=_['merge']({},_0x346083,_0x31d1c8[_0xa758('0x40')]);return db[_0xa758('0x25')][_0xa758('0x41')](_0x346083)[_0xa758('0x38')](handleEntityNotFound(_0x3351a0,null))[_0xa758('0x38')](respondWithResult(_0x3351a0,null))['catch'](handleError(_0x3351a0,null));};exports[_0xa758('0x42')]=function(_0x3687be,_0x5086fe){return db[_0xa758('0x25')]['create'](_0x3687be[_0xa758('0x43')],{})[_0xa758('0x38')](respondWithResult(_0x5086fe,0xc9))[_0xa758('0x44')](handleError(_0x5086fe,null));};exports['update']=function(_0x2725c2,_0x464a11){if(_0x2725c2[_0xa758('0x43')]['id']){delete _0x2725c2[_0xa758('0x43')]['id'];}return db[_0xa758('0x25')]['find']({'where':{'id':_0x2725c2[_0xa758('0x3c')]['id']}})[_0xa758('0x38')](handleEntityNotFound(_0x464a11,null))['then'](saveUpdates(_0x2725c2[_0xa758('0x43')],null))[_0xa758('0x38')](respondWithResult(_0x464a11,null))[_0xa758('0x44')](handleError(_0x464a11,null));};exports[_0xa758('0x1f')]=function(_0x23c062,_0x5408da){return db[_0xa758('0x25')][_0xa758('0x41')]({'where':{'id':_0x23c062['params']['id']}})['then'](handleEntityNotFound(_0x5408da,null))[_0xa758('0x38')](removeEntity(_0x5408da,null))[_0xa758('0x44')](handleError(_0x5408da,null));};exports['describe']=function(_0xa288a4,_0x5307d6){return db[_0xa758('0x25')][_0xa758('0x45')]()[_0xa758('0x38')](respondWithResult(_0x5307d6,null))[_0xa758('0x44')](handleError(_0x5307d6,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 89fc93b..426ec4c 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 _0xc844=['report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','rimraf','exports','define','MailTransferReport'];(function(_0x4e0d2c,_0x11df2a){var _0x221088=function(_0x2e5b5a){while(--_0x2e5b5a){_0x4e0d2c['push'](_0x4e0d2c['shift']());}};_0x221088(++_0x11df2a);}(_0xc844,0x1d0));var _0x4c84=function(_0x3672da,_0x2084de){_0x3672da=_0x3672da-0x0;var _0x4a951a=_0xc844[_0x3672da];return _0x4a951a;};'use strict';var _=require(_0x4c84('0x0'));var util=require('util');var logger=require(_0x4c84('0x1'))(_0x4c84('0x2'));var moment=require(_0x4c84('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c84('0x5'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x4c84('0x6')]=function(_0x238bf8,_0x4bbdc6){return _0x238bf8[_0x4c84('0x7')](_0x4c84('0x8'),attributes,{'tableName':_0x4c84('0x9'),'paranoid':![],'indexes':[{'name':_0x4c84('0xa'),'fields':[_0x4c84('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x93f7=['uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','define','report_mail_transfer'];(function(_0x5f4560,_0xbdb550){var _0x1b6536=function(_0x38c605){while(--_0x38c605){_0x5f4560['push'](_0x5f4560['shift']());}};_0x1b6536(++_0xbdb550);}(_0x93f7,0x79));var _0x793f=function(_0x8f5647,_0x9806bf){_0x8f5647=_0x8f5647-0x0;var _0x5750dc=_0x93f7[_0x8f5647];return _0x5750dc;};'use strict';var _=require('lodash');var util=require(_0x793f('0x0'));var logger=require('../../config/logger')(_0x793f('0x1'));var moment=require(_0x793f('0x2'));var BPromise=require(_0x793f('0x3'));var rp=require(_0x793f('0x4'));var fs=require('fs');var path=require(_0x793f('0x5'));var rimraf=require(_0x793f('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xcb5035,_0x4f377b){return _0xcb5035[_0x793f('0x7')]('MailTransferReport',attributes,{'tableName':_0x793f('0x8'),'paranoid':![],'indexes':[{'name':_0x793f('0x9'),'fields':[_0x793f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b670fa0..5e84947 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 _0xd4d5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xd4d5,0xad));var _0x5d4d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4d5[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x5d4d('0x0'));var moment=require('moment');var BPromise=require(_0x5d4d('0x1'));var rs=require(_0x5d4d('0x2'));var fs=require('fs');var Redis=require(_0x5d4d('0x3'));var db=require(_0x5d4d('0x4'))['db'];var utils=require(_0x5d4d('0x5'));var logger=require('../../config/logger')(_0x5d4d('0x6'));var config=require(_0x5d4d('0x7'));var jayson=require(_0x5d4d('0x8'));var client=jayson['client'][_0x5d4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521b48,_0x410599,_0x3affcf){return new BPromise(function(_0x3b630f,_0x38a9be){return client['request'](_0x521b48,_0x3affcf)[_0x5d4d('0xa')](function(_0x15fe39){logger['info'](_0x5d4d('0xb'),_0x410599,_0x5d4d('0xc'));logger[_0x5d4d('0xd')](_0x5d4d('0xe'),_0x410599,_0x5d4d('0xc'),JSON[_0x5d4d('0xf')](_0x15fe39));if(_0x15fe39[_0x5d4d('0x10')]){if(_0x15fe39[_0x5d4d('0x10')][_0x5d4d('0x11')]===0x1f4){logger[_0x5d4d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x410599,_0x15fe39[_0x5d4d('0x10')]['message']);return _0x38a9be(_0x15fe39['error']['message']);}logger[_0x5d4d('0x10')](_0x5d4d('0xb'),_0x410599,_0x15fe39[_0x5d4d('0x10')][_0x5d4d('0x12')]);return _0x3b630f(_0x15fe39['error'][_0x5d4d('0x12')]);}else{logger['info'](_0x5d4d('0xb'),_0x410599,_0x5d4d('0xc'));_0x3b630f(_0x15fe39[_0x5d4d('0x13')]['message']);}})[_0x5d4d('0x14')](function(_0x4e157f){logger[_0x5d4d('0x10')](_0x5d4d('0xb'),_0x410599,_0x4e157f);_0x38a9be(_0x4e157f);});});} \ No newline at end of file +var _0x3698=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x328e04,_0x16ec5d){var _0x5f026d=function(_0x1af2a0){while(--_0x1af2a0){_0x328e04['push'](_0x328e04['shift']());}};_0x5f026d(++_0x16ec5d);}(_0x3698,0x141));var _0x8369=function(_0x43b88c,_0x46fb04){_0x43b88c=_0x43b88c-0x0;var _0x407299=_0x3698[_0x43b88c];return _0x407299;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8369('0x0'));var BPromise=require(_0x8369('0x1'));var rs=require(_0x8369('0x2'));var fs=require('fs');var Redis=require(_0x8369('0x3'));var db=require(_0x8369('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8369('0x5'));var config=require('../../config/environment');var jayson=require(_0x8369('0x6'));var client=jayson[_0x8369('0x7')][_0x8369('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b52f2,_0x2cfd74,_0x5c8f6c){return new BPromise(function(_0x146a12,_0x172da3){return client[_0x8369('0x9')](_0x4b52f2,_0x5c8f6c)[_0x8369('0xa')](function(_0x51a6cf){logger[_0x8369('0xb')](_0x8369('0xc'),_0x2cfd74,_0x8369('0xd'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x2cfd74,_0x8369('0xd'),JSON[_0x8369('0xe')](_0x51a6cf));if(_0x51a6cf[_0x8369('0xf')]){if(_0x51a6cf[_0x8369('0xf')][_0x8369('0x10')]===0x1f4){logger[_0x8369('0xf')](_0x8369('0xc'),_0x2cfd74,_0x51a6cf['error']['message']);return _0x172da3(_0x51a6cf[_0x8369('0xf')][_0x8369('0x11')]);}logger[_0x8369('0xf')](_0x8369('0xc'),_0x2cfd74,_0x51a6cf['error']['message']);return _0x146a12(_0x51a6cf[_0x8369('0xf')][_0x8369('0x11')]);}else{logger[_0x8369('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x2cfd74,_0x8369('0xd'));_0x146a12(_0x51a6cf[_0x8369('0x12')][_0x8369('0x11')]);}})[_0x8369('0x13')](function(_0x3096be){logger[_0x8369('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x2cfd74,_0x3096be);_0x172da3(_0x3096be);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dc49e6a..8348204 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 _0x17e0=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x2d72be,_0x560ce4){var _0x53421d=function(_0x1affc2){while(--_0x1affc2){_0x2d72be['push'](_0x2d72be['shift']());}};_0x53421d(++_0x560ce4);}(_0x17e0,0x1f1));var _0x017e=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x17e0[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require(_0x017e('0x0'));var path=require(_0x017e('0x1'));var timeout=require(_0x017e('0x2'));var express=require(_0x017e('0x3'));var router=express[_0x017e('0x4')]();var auth=require(_0x017e('0x5'));var interaction=require(_0x017e('0x6'));var config=require(_0x017e('0x7'));var controller=require(_0x017e('0x8'));router[_0x017e('0x9')]('/',auth[_0x017e('0xa')](),controller[_0x017e('0xb')]);router[_0x017e('0x9')](_0x017e('0xc'),auth[_0x017e('0xa')](),controller[_0x017e('0xd')]);router['get'](_0x017e('0xe'),auth[_0x017e('0xa')](),controller[_0x017e('0xf')]);router[_0x017e('0x10')]('/',auth[_0x017e('0xa')](),controller[_0x017e('0x11')]);router[_0x017e('0x12')](_0x017e('0xe'),auth[_0x017e('0xa')](),controller[_0x017e('0x13')]);router[_0x017e('0x14')](_0x017e('0xe'),auth[_0x017e('0xa')](),controller[_0x017e('0x15')]);module[_0x017e('0x16')]=router; \ No newline at end of file +var _0x2af3=['connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','describe','get','show','post','create','put','update','delete','/:id','destroy','exports','multer','path'];(function(_0x4e24cc,_0x7a1b4f){var _0x1f2ef6=function(_0x11ae68){while(--_0x11ae68){_0x4e24cc['push'](_0x4e24cc['shift']());}};_0x1f2ef6(++_0x7a1b4f);}(_0x2af3,0xbc));var _0x32af=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0x2af3[_0xfcfc24];return _0x58f773;};'use strict';var multer=require(_0x32af('0x0'));var util=require('util');var path=require(_0x32af('0x1'));var timeout=require(_0x32af('0x2'));var express=require(_0x32af('0x3'));var router=express[_0x32af('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x32af('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router['get']('/',auth[_0x32af('0x6')](),controller[_0x32af('0x7')]);router['get']('/describe',auth[_0x32af('0x6')](),controller[_0x32af('0x8')]);router[_0x32af('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x32af('0xa')]);router[_0x32af('0xb')]('/',auth[_0x32af('0x6')](),controller[_0x32af('0xc')]);router[_0x32af('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x32af('0xe')]);router[_0x32af('0xf')](_0x32af('0x10'),auth[_0x32af('0x6')](),controller[_0x32af('0x11')]);module[_0x32af('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 ac52bc8..80809f1 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 _0x276b=['talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue','duration','talk:[start]','talk:[dial\x20string]'];(function(_0x4a277b,_0x3c7a5b){var _0x30d050=function(_0x100613){while(--_0x100613){_0x4a277b['push'](_0x4a277b['shift']());}};_0x30d050(++_0x3c7a5b);}(_0x276b,0x6a));var _0xb276=function(_0x5f42f9,_0x2fddb4){_0x5f42f9=_0x5f42f9-0x0;var _0x5aefc5=_0x276b[_0x5f42f9];return _0x5aefc5;};'use strict';var Sequelize=require(_0xb276('0x0'));var moment=require(_0xb276('0x1'));module['exports']={'channel':{'type':Sequelize[_0xb276('0x2')]},'membername':{'type':Sequelize[_0xb276('0x2')]},'interface':{'type':Sequelize[_0xb276('0x2')]},'type':{'type':Sequelize[_0xb276('0x2')],'defaultValue':_0xb276('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb276('0x4')]},'enterAt':{'type':Sequelize[_0xb276('0x5')]},'exitAt':{'type':Sequelize[_0xb276('0x5')],'set':function(_0x5954ef){var _0x5d2f7b=moment(_0x5954ef);var _0x3a645a=moment(this[_0xb276('0x6')](_0xb276('0x7')));var _0x389904=_0x5d2f7b['diff'](_0x3a645a,_0xb276('0x8'));this['setDataValue'](_0xb276('0x9'),_0x5954ef);this[_0xb276('0xa')](_0xb276('0xb'),_0x389904||null);}},'data1':{'type':Sequelize[_0xb276('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb276('0x2')],'comment':_0xb276('0xc')},'data3':{'type':Sequelize[_0xb276('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xb276('0x2')],'comment':_0xb276('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0xb276('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb276('0x2')]}}; \ No newline at end of file +var _0x19cd=['duration','talk:[start]','talk:[queue]','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x368952,_0x5f44ad){var _0x40e355=function(_0x547dfc){while(--_0x547dfc){_0x368952['push'](_0x368952['shift']());}};_0x40e355(++_0x5f44ad);}(_0x19cd,0x189));var _0xd19c=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x19cd[_0x3207aa];return _0x51758f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xd19c('0x0')]},'membername':{'type':Sequelize[_0xd19c('0x0')]},'interface':{'type':Sequelize[_0xd19c('0x0')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xd19c('0x1'),'comment':_0xd19c('0x2')},'duration':{'type':Sequelize[_0xd19c('0x3')]},'enterAt':{'type':Sequelize[_0xd19c('0x4')]},'exitAt':{'type':Sequelize[_0xd19c('0x4')],'set':function(_0x582fd5){var _0x2f0702=moment(_0x582fd5);var _0x2b8614=moment(this['getDataValue'](_0xd19c('0x5')));var _0x2e7476=_0x2f0702[_0xd19c('0x6')](_0x2b8614,_0xd19c('0x7'));this[_0xd19c('0x8')](_0xd19c('0x9'),_0x582fd5);this[_0xd19c('0x8')](_0xd19c('0xa'),_0x2e7476||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xd19c('0xb')},'data3':{'type':Sequelize[_0xd19c('0x0')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xd19c('0x0')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xd19c('0xc')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xd19c('0x3')]},'uniqueid':{'type':Sequelize[_0xd19c('0x0')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 207090c..8d10a6e 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 _0x079d=['find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','pick','filter','merge','type','VIRTUAL','MemberReport','includeAll','include','findAll','catch','show','params','options'];(function(_0x34cbb3,_0x377ea0){var _0x46d8f5=function(_0x2c9584){while(--_0x2c9584){_0x34cbb3['push'](_0x34cbb3['shift']());}};_0x46d8f5(++_0x377ea0);}(_0x079d,0xdc));var _0xd079=function(_0x262500,_0x2d0777){_0x262500=_0x262500-0x0;var _0x2abb47=_0x079d[_0x262500];return _0x2abb47;};'use strict';var pdf=require(_0xd079('0x0'));var emlformat=require(_0xd079('0x1'));var rimraf=require(_0xd079('0x2'));var zipdir=require(_0xd079('0x3'));var jsonpatch=require(_0xd079('0x4'));var rp=require(_0xd079('0x5'));var moment=require(_0xd079('0x6'));var BPromise=require(_0xd079('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd079('0x8'));var sox=require('sox');var csv=require(_0xd079('0x9'));var ejs=require(_0xd079('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd079('0xb'));var jsforce=require(_0xd079('0xc'));var deskjs=require(_0xd079('0xd'));var toCsv=require(_0xd079('0x9'));var querystring=require(_0xd079('0xe'));var Papa=require(_0xd079('0xf'));var Redis=require(_0xd079('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd079('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd079('0x12'));var logger=require(_0xd079('0x13'))(_0xd079('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd079('0x15'));var db=require(_0xd079('0x16'))['db'];function respondWithStatusCode(_0x2847d0,_0x4a64be){_0x4a64be=_0x4a64be||0xcc;return function(_0x115a4b){if(_0x115a4b){return _0x2847d0['sendStatus'](_0x4a64be);}return _0x2847d0['status'](_0x4a64be)['end']();};}function respondWithResult(_0x1df399,_0x7d9e37){_0x7d9e37=_0x7d9e37||0xc8;return function(_0x3be511){if(_0x3be511){return _0x1df399[_0xd079('0x17')](_0x7d9e37)[_0xd079('0x18')](_0x3be511);}};}function respondWithFilteredResult(_0x5bc50b,_0x5ecfc9){return function(_0x5f1d61){if(_0x5f1d61){var _0x132d0f=_0x5f1d61[_0xd079('0x19')],_0x429d36=_0x5ecfc9[_0xd079('0x1a')],_0x2785bf=_0x5ecfc9[_0xd079('0x1a')]+_0x5ecfc9['limit'],_0x4afbf2;if(_0x2785bf>=_0x132d0f){_0x2785bf=_0x132d0f;_0x4afbf2=0xc8;}else{_0x4afbf2=0xce;}_0x5bc50b[_0xd079('0x17')](_0x4afbf2);return _0x5bc50b[_0xd079('0x1b')](_0xd079('0x1c'),_0x429d36+'-'+_0x2785bf+'/'+_0x132d0f)['json'](_0x5f1d61);}return null;};}function patchUpdates(_0x2a3e29){return function(_0x31eb7c){try{jsonpatch[_0xd079('0x1d')](_0x31eb7c,_0x2a3e29,!![]);}catch(_0x1cf954){return BPromise[_0xd079('0x1e')](_0x1cf954);}return _0x31eb7c[_0xd079('0x1f')]();};}function saveUpdates(_0x3307cb,_0x2d123e){return function(_0x289025){if(_0x289025){return _0x289025[_0xd079('0x20')](_0x3307cb)[_0xd079('0x21')](function(_0x1fede2){return _0x1fede2;});}return null;};}function removeEntity(_0x1e931c,_0x41a7c3){return function(_0x3b6ccf){if(_0x3b6ccf){return _0x3b6ccf[_0xd079('0x22')]()[_0xd079('0x21')](function(){_0x1e931c[_0xd079('0x17')](0xcc)[_0xd079('0x23')]();});}};}function handleEntityNotFound(_0xc3701e,_0x4f4dcf){return function(_0x3aba95){if(!_0x3aba95){_0xc3701e[_0xd079('0x24')](0x194);}return _0x3aba95;};}function handleError(_0x3495e0,_0x3db644){_0x3db644=_0x3db644||0x1f4;return function(_0x5291b9){logger[_0xd079('0x25')](_0x5291b9['stack']);if(_0x5291b9[_0xd079('0x26')]){delete _0x5291b9[_0xd079('0x26')];}_0x3495e0[_0xd079('0x17')](_0x3db644)[_0xd079('0x27')](_0x5291b9);};}exports['index']=function(_0x1d7b69,_0x129e05){var _0x58d88f={},_0x2d7040={},_0x36df51={'count':0x0,'rows':[]};var _0x17c43c=_[_0xd079('0x28')](db['MemberReport'][_0xd079('0x29')],function(_0x2d7882){return{'name':_0x2d7882['fieldName'],'type':_0x2d7882['type'][_0xd079('0x2a')]};});_0x2d7040[_0xd079('0x2b')]=_[_0xd079('0x28')](_0x17c43c,_0xd079('0x26'));_0x2d7040['query']=_[_0xd079('0x2c')](_0x1d7b69[_0xd079('0x2d')]);_0x2d7040[_0xd079('0x2e')]=_[_0xd079('0x2f')](_0x2d7040['model'],_0x2d7040[_0xd079('0x2d')]);_0x58d88f[_0xd079('0x30')]=_['intersection'](_0x2d7040['model'],qs[_0xd079('0x31')](_0x1d7b69[_0xd079('0x2d')][_0xd079('0x31')]));_0x58d88f[_0xd079('0x30')]=_0x58d88f[_0xd079('0x30')][_0xd079('0x32')]?_0x58d88f['attributes']:_0x2d7040[_0xd079('0x2b')];if(!_0x1d7b69[_0xd079('0x2d')][_0xd079('0x33')]('nolimit')){_0x58d88f[_0xd079('0x34')]=qs[_0xd079('0x34')](_0x1d7b69[_0xd079('0x2d')]['limit']);_0x58d88f['offset']=qs[_0xd079('0x1a')](_0x1d7b69[_0xd079('0x2d')][_0xd079('0x1a')]);}_0x58d88f[_0xd079('0x35')]=qs['sort'](_0x1d7b69[_0xd079('0x2d')]['sort']);_0x58d88f[_0xd079('0x36')]=qs[_0xd079('0x2e')](_[_0xd079('0x37')](_0x1d7b69[_0xd079('0x2d')],_0x2d7040[_0xd079('0x2e')]),_0x17c43c);if(_0x1d7b69['query'][_0xd079('0x38')]){_0x58d88f[_0xd079('0x36')]=_[_0xd079('0x39')](_0x58d88f['where'],{'$or':_[_0xd079('0x28')](_0x17c43c,function(_0xc72acd){if(_0xc72acd[_0xd079('0x3a')]!==_0xd079('0x3b')){var _0x3b59e3={};_0x3b59e3[_0xc72acd[_0xd079('0x26')]]={'$like':'%'+_0x1d7b69[_0xd079('0x2d')]['filter']+'%'};return _0x3b59e3;}})});}_0x58d88f=_['merge']({},_0x58d88f,_0x1d7b69['options']);var _0xe92715={'where':_0x58d88f[_0xd079('0x36')]};return db[_0xd079('0x3c')][_0xd079('0x19')](_0xe92715)[_0xd079('0x21')](function(_0x347020){_0x36df51[_0xd079('0x19')]=_0x347020;if(_0x1d7b69[_0xd079('0x2d')][_0xd079('0x3d')]){_0x58d88f[_0xd079('0x3e')]=[{'all':!![]}];}return db[_0xd079('0x3c')][_0xd079('0x3f')](_0x58d88f);})[_0xd079('0x21')](function(_0x1d7356){_0x36df51['rows']=_0x1d7356;return _0x36df51;})[_0xd079('0x21')](respondWithFilteredResult(_0x129e05,_0x58d88f))[_0xd079('0x40')](handleError(_0x129e05,null));};exports[_0xd079('0x41')]=function(_0x5020ab,_0x1ce19e){var _0x141213={'raw':!![],'where':{'id':_0x5020ab[_0xd079('0x42')]['id']}},_0x2bcece={};_0x2bcece[_0xd079('0x2b')]=_[_0xd079('0x2c')](db['MemberReport'][_0xd079('0x29')]);_0x2bcece[_0xd079('0x2d')]=_['keys'](_0x5020ab[_0xd079('0x2d')]);_0x2bcece['filters']=_['intersection'](_0x2bcece[_0xd079('0x2b')],_0x2bcece['query']);_0x141213[_0xd079('0x30')]=_[_0xd079('0x2f')](_0x2bcece[_0xd079('0x2b')],qs[_0xd079('0x31')](_0x5020ab[_0xd079('0x2d')]['fields']));_0x141213[_0xd079('0x30')]=_0x141213['attributes'][_0xd079('0x32')]?_0x141213['attributes']:_0x2bcece[_0xd079('0x2b')];if(_0x5020ab[_0xd079('0x2d')]['includeAll']){_0x141213[_0xd079('0x3e')]=[{'all':!![]}];}_0x141213=_[_0xd079('0x39')]({},_0x141213,_0x5020ab[_0xd079('0x43')]);return db[_0xd079('0x3c')][_0xd079('0x44')](_0x141213)[_0xd079('0x21')](handleEntityNotFound(_0x1ce19e,null))[_0xd079('0x21')](respondWithResult(_0x1ce19e,null))[_0xd079('0x40')](handleError(_0x1ce19e,null));};exports[_0xd079('0x45')]=function(_0x4fdfe9,_0x977cee){return db[_0xd079('0x3c')][_0xd079('0x45')](_0x4fdfe9[_0xd079('0x46')],{})['then'](respondWithResult(_0x977cee,0xc9))[_0xd079('0x40')](handleError(_0x977cee,null));};exports[_0xd079('0x20')]=function(_0x26ac49,_0x2e2a2f){if(_0x26ac49['body']['id']){delete _0x26ac49['body']['id'];}return db[_0xd079('0x3c')][_0xd079('0x44')]({'where':{'id':_0x26ac49['params']['id']}})[_0xd079('0x21')](handleEntityNotFound(_0x2e2a2f,null))[_0xd079('0x21')](saveUpdates(_0x26ac49[_0xd079('0x46')],null))[_0xd079('0x21')](respondWithResult(_0x2e2a2f,null))[_0xd079('0x40')](handleError(_0x2e2a2f,null));};exports[_0xd079('0x22')]=function(_0x280568,_0x28054e){return db['MemberReport'][_0xd079('0x44')]({'where':{'id':_0x280568[_0xd079('0x42')]['id']}})[_0xd079('0x21')](handleEntityNotFound(_0x28054e,null))['then'](removeEntity(_0x28054e,null))[_0xd079('0x40')](handleError(_0x28054e,null));};exports[_0xd079('0x47')]=function(_0x179a1f,_0xbb3623){return db[_0xd079('0x3c')][_0xd079('0x47')]()['then'](respondWithResult(_0xbb3623,null))[_0xd079('0x40')](handleError(_0xbb3623,null));}; \ No newline at end of file +var _0x8f17=['order','sort','where','merge','VIRTUAL','filter','options','MemberReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x3ba5cf,_0x59b092){var _0x1359d8=function(_0x50c1c8){while(--_0x50c1c8){_0x3ba5cf['push'](_0x3ba5cf['shift']());}};_0x1359d8(++_0x59b092);}(_0x8f17,0xfb));var _0x78f1=function(_0x35245d,_0x193583){_0x35245d=_0x35245d-0x0;var _0x184a83=_0x8f17[_0x35245d];return _0x184a83;};'use strict';var pdf=require(_0x78f1('0x0'));var emlformat=require(_0x78f1('0x1'));var rimraf=require(_0x78f1('0x2'));var zipdir=require(_0x78f1('0x3'));var jsonpatch=require(_0x78f1('0x4'));var rp=require('request-promise');var moment=require(_0x78f1('0x5'));var BPromise=require(_0x78f1('0x6'));var Mustache=require(_0x78f1('0x7'));var util=require(_0x78f1('0x8'));var path=require(_0x78f1('0x9'));var sox=require(_0x78f1('0xa'));var csv=require(_0x78f1('0xb'));var ejs=require(_0x78f1('0xc'));var fs=require('fs');var _=require(_0x78f1('0xd'));var squel=require('squel');var crypto=require(_0x78f1('0xe'));var jsforce=require(_0x78f1('0xf'));var deskjs=require(_0x78f1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x78f1('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78f1('0x12'));var qs=require(_0x78f1('0x13'));var as=require(_0x78f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78f1('0x15'))(_0x78f1('0x16'));var utils=require(_0x78f1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x78f1('0x18'));var db=require(_0x78f1('0x19'))['db'];function respondWithStatusCode(_0x591f22,_0x31330f){_0x31330f=_0x31330f||0xcc;return function(_0x1bdda6){if(_0x1bdda6){return _0x591f22['sendStatus'](_0x31330f);}return _0x591f22[_0x78f1('0x1a')](_0x31330f)[_0x78f1('0x1b')]();};}function respondWithResult(_0x6bb77a,_0x574120){_0x574120=_0x574120||0xc8;return function(_0x59b733){if(_0x59b733){return _0x6bb77a[_0x78f1('0x1a')](_0x574120)[_0x78f1('0x1c')](_0x59b733);}};}function respondWithFilteredResult(_0x49b3c0,_0x52b858){return function(_0x8fcd09){if(_0x8fcd09){var _0x4ba13b=_0x8fcd09[_0x78f1('0x1d')],_0x3807e9=_0x52b858['offset'],_0x5108b6=_0x52b858[_0x78f1('0x1e')]+_0x52b858['limit'],_0x59f315;if(_0x5108b6>=_0x4ba13b){_0x5108b6=_0x4ba13b;_0x59f315=0xc8;}else{_0x59f315=0xce;}_0x49b3c0[_0x78f1('0x1a')](_0x59f315);return _0x49b3c0[_0x78f1('0x1f')](_0x78f1('0x20'),_0x3807e9+'-'+_0x5108b6+'/'+_0x4ba13b)[_0x78f1('0x1c')](_0x8fcd09);}return null;};}function patchUpdates(_0x315771){return function(_0x273a26){try{jsonpatch[_0x78f1('0x21')](_0x273a26,_0x315771,!![]);}catch(_0x2f790b){return BPromise[_0x78f1('0x22')](_0x2f790b);}return _0x273a26[_0x78f1('0x23')]();};}function saveUpdates(_0x2d5693,_0x588ddd){return function(_0x8e8db6){if(_0x8e8db6){return _0x8e8db6[_0x78f1('0x24')](_0x2d5693)[_0x78f1('0x25')](function(_0x1b57b5){return _0x1b57b5;});}return null;};}function removeEntity(_0x831230,_0x379ffc){return function(_0x253368){if(_0x253368){return _0x253368[_0x78f1('0x26')]()[_0x78f1('0x25')](function(){_0x831230[_0x78f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x67ec00,_0x3c3bff){return function(_0x11b785){if(!_0x11b785){_0x67ec00[_0x78f1('0x27')](0x194);}return _0x11b785;};}function handleError(_0x2ca787,_0x3e6437){_0x3e6437=_0x3e6437||0x1f4;return function(_0x392127){logger[_0x78f1('0x28')](_0x392127[_0x78f1('0x29')]);if(_0x392127[_0x78f1('0x2a')]){delete _0x392127[_0x78f1('0x2a')];}_0x2ca787['status'](_0x3e6437)['send'](_0x392127);};}exports['index']=function(_0x2bf94f,_0x56f4ea){var _0x3a8d1e={},_0x368de1={},_0x306063={'count':0x0,'rows':[]};var _0x44ad8c=_[_0x78f1('0x2b')](db['MemberReport']['rawAttributes'],function(_0x59efcd){return{'name':_0x59efcd[_0x78f1('0x2c')],'type':_0x59efcd[_0x78f1('0x2d')]['key']};});_0x368de1[_0x78f1('0x2e')]=_['map'](_0x44ad8c,_0x78f1('0x2a'));_0x368de1[_0x78f1('0x2f')]=_[_0x78f1('0x30')](_0x2bf94f[_0x78f1('0x2f')]);_0x368de1[_0x78f1('0x31')]=_[_0x78f1('0x32')](_0x368de1[_0x78f1('0x2e')],_0x368de1[_0x78f1('0x2f')]);_0x3a8d1e['attributes']=_['intersection'](_0x368de1[_0x78f1('0x2e')],qs[_0x78f1('0x33')](_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x33')]));_0x3a8d1e[_0x78f1('0x34')]=_0x3a8d1e[_0x78f1('0x34')][_0x78f1('0x35')]?_0x3a8d1e[_0x78f1('0x34')]:_0x368de1[_0x78f1('0x2e')];if(!_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x36')](_0x78f1('0x37'))){_0x3a8d1e[_0x78f1('0x38')]=qs[_0x78f1('0x38')](_0x2bf94f[_0x78f1('0x2f')]['limit']);_0x3a8d1e[_0x78f1('0x1e')]=qs['offset'](_0x2bf94f[_0x78f1('0x2f')]['offset']);}_0x3a8d1e[_0x78f1('0x39')]=qs[_0x78f1('0x3a')](_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x3a')]);_0x3a8d1e[_0x78f1('0x3b')]=qs[_0x78f1('0x31')](_['pick'](_0x2bf94f['query'],_0x368de1[_0x78f1('0x31')]),_0x44ad8c);if(_0x2bf94f[_0x78f1('0x2f')]['filter']){_0x3a8d1e['where']=_[_0x78f1('0x3c')](_0x3a8d1e[_0x78f1('0x3b')],{'$or':_['map'](_0x44ad8c,function(_0xe804d4){if(_0xe804d4[_0x78f1('0x2d')]!==_0x78f1('0x3d')){var _0x2c413f={};_0x2c413f[_0xe804d4[_0x78f1('0x2a')]]={'$like':'%'+_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x3e')]+'%'};return _0x2c413f;}})});}_0x3a8d1e=_[_0x78f1('0x3c')]({},_0x3a8d1e,_0x2bf94f[_0x78f1('0x3f')]);var _0x19d6af={'where':_0x3a8d1e['where']};return db[_0x78f1('0x40')][_0x78f1('0x1d')](_0x19d6af)[_0x78f1('0x25')](function(_0x535553){_0x306063[_0x78f1('0x1d')]=_0x535553;if(_0x2bf94f[_0x78f1('0x2f')][_0x78f1('0x41')]){_0x3a8d1e[_0x78f1('0x42')]=[{'all':!![]}];}return db[_0x78f1('0x40')][_0x78f1('0x43')](_0x3a8d1e);})['then'](function(_0x2f7313){_0x306063[_0x78f1('0x44')]=_0x2f7313;return _0x306063;})[_0x78f1('0x25')](respondWithFilteredResult(_0x56f4ea,_0x3a8d1e))['catch'](handleError(_0x56f4ea,null));};exports[_0x78f1('0x45')]=function(_0x503c72,_0x29708d){var _0x54aaed={'raw':!![],'where':{'id':_0x503c72[_0x78f1('0x46')]['id']}},_0x4f2c47={};_0x4f2c47['model']=_[_0x78f1('0x30')](db[_0x78f1('0x40')][_0x78f1('0x47')]);_0x4f2c47[_0x78f1('0x2f')]=_['keys'](_0x503c72[_0x78f1('0x2f')]);_0x4f2c47['filters']=_[_0x78f1('0x32')](_0x4f2c47[_0x78f1('0x2e')],_0x4f2c47['query']);_0x54aaed[_0x78f1('0x34')]=_[_0x78f1('0x32')](_0x4f2c47[_0x78f1('0x2e')],qs[_0x78f1('0x33')](_0x503c72[_0x78f1('0x2f')][_0x78f1('0x33')]));_0x54aaed[_0x78f1('0x34')]=_0x54aaed[_0x78f1('0x34')]['length']?_0x54aaed['attributes']:_0x4f2c47[_0x78f1('0x2e')];if(_0x503c72[_0x78f1('0x2f')][_0x78f1('0x41')]){_0x54aaed[_0x78f1('0x42')]=[{'all':!![]}];}_0x54aaed=_[_0x78f1('0x3c')]({},_0x54aaed,_0x503c72[_0x78f1('0x3f')]);return db[_0x78f1('0x40')][_0x78f1('0x48')](_0x54aaed)[_0x78f1('0x25')](handleEntityNotFound(_0x29708d,null))['then'](respondWithResult(_0x29708d,null))[_0x78f1('0x49')](handleError(_0x29708d,null));};exports[_0x78f1('0x4a')]=function(_0x4b91c0,_0x960b3d){return db['MemberReport']['create'](_0x4b91c0['body'],{})[_0x78f1('0x25')](respondWithResult(_0x960b3d,0xc9))[_0x78f1('0x49')](handleError(_0x960b3d,null));};exports['update']=function(_0x50a589,_0x4d6e7b){if(_0x50a589[_0x78f1('0x4b')]['id']){delete _0x50a589[_0x78f1('0x4b')]['id'];}return db['MemberReport'][_0x78f1('0x48')]({'where':{'id':_0x50a589[_0x78f1('0x46')]['id']}})[_0x78f1('0x25')](handleEntityNotFound(_0x4d6e7b,null))[_0x78f1('0x25')](saveUpdates(_0x50a589[_0x78f1('0x4b')],null))['then'](respondWithResult(_0x4d6e7b,null))[_0x78f1('0x49')](handleError(_0x4d6e7b,null));};exports[_0x78f1('0x26')]=function(_0x586c2c,_0x36972b){return db['MemberReport'][_0x78f1('0x48')]({'where':{'id':_0x586c2c[_0x78f1('0x46')]['id']}})[_0x78f1('0x25')](handleEntityNotFound(_0x36972b,null))[_0x78f1('0x25')](removeEntity(_0x36972b,null))[_0x78f1('0x49')](handleError(_0x36972b,null));};exports[_0x78f1('0x4c')]=function(_0x191de1,_0x387549){return db[_0x78f1('0x40')]['describe']()[_0x78f1('0x25')](respondWithResult(_0x387549,null))[_0x78f1('0x49')](handleError(_0x387549,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 231ce03..1d7edb7 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 _0x96fc=['rimraf','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','request-promise'];(function(_0xa1f542,_0x4e58f5){var _0x13a361=function(_0x4169b3){while(--_0x4169b3){_0xa1f542['push'](_0xa1f542['shift']());}};_0x13a361(++_0x4e58f5);}(_0x96fc,0x1f3));var _0xc96f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x96fc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc96f('0x0'));var util=require('util');var logger=require(_0xc96f('0x1'))(_0xc96f('0x2'));var moment=require(_0xc96f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc96f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc96f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc96f('0x6'));module['exports']=function(_0xf39de1,_0x32e43f){return _0xf39de1['define'](_0xc96f('0x7'),attributes,{'tableName':_0xc96f('0x8'),'paranoid':![],'indexes':[{'name':_0xc96f('0x9'),'fields':[_0xc96f('0xa'),_0xc96f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d69=['request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird'];(function(_0x38eaa6,_0x169ebb){var _0x2201ac=function(_0x27ddbb){while(--_0x27ddbb){_0x38eaa6['push'](_0x38eaa6['shift']());}};_0x2201ac(++_0x169ebb);}(_0x1d69,0x154));var _0x91d6=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x1d69[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x91d6('0x0'));var util=require(_0x91d6('0x1'));var logger=require(_0x91d6('0x2'))('api');var moment=require(_0x91d6('0x3'));var BPromise=require(_0x91d6('0x4'));var rp=require(_0x91d6('0x5'));var fs=require('fs');var path=require(_0x91d6('0x6'));var rimraf=require('rimraf');var config=require(_0x91d6('0x7'));var attributes=require(_0x91d6('0x8'));module[_0x91d6('0x9')]=function(_0x1fcfa2,_0x2796d1){return _0x1fcfa2[_0x91d6('0xa')]('MemberReport',attributes,{'tableName':_0x91d6('0xb'),'paranoid':![],'indexes':[{'name':_0x91d6('0xc'),'fields':[_0x91d6('0xd'),_0x91d6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f0f97c0..70acadc 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 _0xddec=['MemberReport,\x20%s,\x20%s,\x20%s','stringify','MemberReport,\x20%s,\x20%s','error','message','result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','model','map','debug','catch','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5c64bc,_0x2cc502){var _0x5b0023=function(_0x44590c){while(--_0x44590c){_0x5c64bc['push'](_0x5c64bc['shift']());}};_0x5b0023(++_0x2cc502);}(_0xddec,0x100));var _0xcdde=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xddec[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xcdde('0x0'));var util=require(_0xcdde('0x1'));var moment=require(_0xcdde('0x2'));var BPromise=require(_0xcdde('0x3'));var rs=require(_0xcdde('0x4'));var fs=require('fs');var Redis=require(_0xcdde('0x5'));var db=require(_0xcdde('0x6'))['db'];var utils=require(_0xcdde('0x7'));var logger=require(_0xcdde('0x8'))(_0xcdde('0x9'));var config=require('../../config/environment');var jayson=require(_0xcdde('0xa'));var client=jayson[_0xcdde('0xb')][_0xcdde('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36177a,_0x4dc155,_0xf5dd5d){return new BPromise(function(_0x3f0160,_0xd137c1){return client[_0xcdde('0xd')](_0x36177a,_0xf5dd5d)[_0xcdde('0xe')](function(_0xe1af21){logger[_0xcdde('0xf')]('MemberReport,\x20%s,\x20%s',_0x4dc155,_0xcdde('0x10'));logger['debug'](_0xcdde('0x11'),_0x4dc155,_0xcdde('0x10'),JSON[_0xcdde('0x12')](_0xe1af21));if(_0xe1af21['error']){if(_0xe1af21['error']['code']===0x1f4){logger['error'](_0xcdde('0x13'),_0x4dc155,_0xe1af21[_0xcdde('0x14')][_0xcdde('0x15')]);return _0xd137c1(_0xe1af21[_0xcdde('0x14')]['message']);}logger[_0xcdde('0x14')](_0xcdde('0x13'),_0x4dc155,_0xe1af21[_0xcdde('0x14')]['message']);return _0x3f0160(_0xe1af21[_0xcdde('0x14')][_0xcdde('0x15')]);}else{logger[_0xcdde('0xf')](_0xcdde('0x13'),_0x4dc155,'request\x20sent');_0x3f0160(_0xe1af21[_0xcdde('0x16')]['message']);}})['catch'](function(_0x5e8325){logger['error'](_0xcdde('0x13'),_0x4dc155,_0x5e8325);_0xd137c1(_0x5e8325);});});}exports[_0xcdde('0x17')]=function(_0x1e289d){var _0x1a765b=this;return new Promise(function(_0x45c1ad,_0x41f806){return db[_0xcdde('0x18')]['findAll']({'raw':_0x1e289d['options']?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1b')]||null:null,'attributes':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1c')]||null:null,'limit':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1d')]||null:null,'include':_0x1e289d[_0xcdde('0x19')]?_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1e')]?_['map'](_0x1e289d[_0xcdde('0x19')][_0xcdde('0x1e')],function(_0x56ec78){return{'model':db[_0x56ec78[_0xcdde('0x1f')]],'as':_0x56ec78['as'],'attributes':_0x56ec78['attributes'],'include':_0x56ec78[_0xcdde('0x1e')]?_[_0xcdde('0x20')](_0x56ec78['include'],function(_0x2be428){return{'model':db[_0x2be428[_0xcdde('0x1f')]],'as':_0x2be428['as'],'attributes':_0x2be428[_0xcdde('0x1c')],'include':_0x2be428[_0xcdde('0x1e')]?_[_0xcdde('0x20')](_0x2be428[_0xcdde('0x1e')],function(_0x24cdc1){return{'model':db[_0x24cdc1[_0xcdde('0x1f')]],'as':_0x24cdc1['as'],'attributes':_0x24cdc1[_0xcdde('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5718b4){logger[_0xcdde('0xf')](_0xcdde('0x17'),_0x1e289d);logger[_0xcdde('0x21')](_0xcdde('0x17'),_0x1e289d,JSON[_0xcdde('0x12')](_0x5718b4));_0x45c1ad(_0x5718b4);})[_0xcdde('0x22')](function(_0x2d293c){logger[_0xcdde('0x14')](_0xcdde('0x17'),_0x2d293c[_0xcdde('0x15')],_0x1e289d);_0x41f806(_0x1a765b['error'](0x1f4,_0x2d293c['message']));});});};exports[_0xcdde('0x23')]=function(_0x256570){var _0x59bdbc=this;return new Promise(function(_0x4a0efc,_0x5638ea){return db['MemberReport'][_0xcdde('0x24')](_0x256570[_0xcdde('0x25')],{'raw':_0x256570[_0xcdde('0x19')]?_0x256570[_0xcdde('0x19')][_0xcdde('0x1a')]===undefined?!![]:![]:!![]})[_0xcdde('0xe')](function(_0x13e7bc){logger['info'](_0xcdde('0x23'),_0x256570);logger[_0xcdde('0x21')]('CreateMemberReport',_0x256570,JSON[_0xcdde('0x12')](_0x13e7bc));_0x4a0efc(_0x13e7bc);})[_0xcdde('0x22')](function(_0x434dd1){logger[_0xcdde('0x14')](_0xcdde('0x23'),_0x434dd1[_0xcdde('0x15')],_0x256570);_0x5638ea(_0x59bdbc[_0xcdde('0x14')](0x1f4,_0x434dd1['message']));});});};exports[_0xcdde('0x26')]=function(_0x35d841){var _0xbd967e=this;return new Promise(function(_0x4a3fe4,_0x1703b4){return db[_0xcdde('0x18')]['update'](_0x35d841[_0xcdde('0x25')],{'raw':_0x35d841[_0xcdde('0x19')]?_0x35d841['options'][_0xcdde('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35d841['options']?_0x35d841[_0xcdde('0x19')][_0xcdde('0x1b')]||null:null,'attributes':_0x35d841['options']?_0x35d841['options'][_0xcdde('0x1c')]||null:null,'limit':_0x35d841[_0xcdde('0x19')]?_0x35d841[_0xcdde('0x19')][_0xcdde('0x1d')]||null:null})[_0xcdde('0xe')](function(_0x2e1e6d){logger['info']('UpdateMemberReport',_0x35d841);logger['debug']('UpdateMemberReport',_0x35d841,JSON[_0xcdde('0x12')](_0x2e1e6d));_0x4a3fe4(_0x2e1e6d);})['catch'](function(_0x139d69){logger[_0xcdde('0x14')](_0xcdde('0x26'),_0x139d69[_0xcdde('0x15')],_0x35d841);_0x1703b4(_0xbd967e[_0xcdde('0x14')](0x1f4,_0x139d69[_0xcdde('0x15')]));});});}; \ No newline at end of file +var _0xe808=['model','CreateMemberReport','create','where','UpdateMemberReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','attributes','limit','include','map'];(function(_0xe5da34,_0x1b0c8e){var _0x215d81=function(_0x43d164){while(--_0x43d164){_0xe5da34['push'](_0xe5da34['shift']());}};_0x215d81(++_0x1b0c8e);}(_0xe808,0x108));var _0x8e80=function(_0x507967,_0x57f126){_0x507967=_0x507967-0x0;var _0x1285a9=_0xe808[_0x507967];return _0x1285a9;};'use strict';var _=require(_0x8e80('0x0'));var util=require('util');var moment=require(_0x8e80('0x1'));var BPromise=require(_0x8e80('0x2'));var rs=require(_0x8e80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e80('0x4'))['db'];var utils=require(_0x8e80('0x5'));var logger=require(_0x8e80('0x6'))(_0x8e80('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e80('0x8'));var client=jayson[_0x8e80('0x9')][_0x8e80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aaadd,_0x18e8dd,_0x2ea8b6){return new BPromise(function(_0x5da673,_0x2d1084){return client[_0x8e80('0xb')](_0x4aaadd,_0x2ea8b6)[_0x8e80('0xc')](function(_0x2fc728){logger[_0x8e80('0xd')](_0x8e80('0xe'),_0x18e8dd,_0x8e80('0xf'));logger[_0x8e80('0x10')](_0x8e80('0x11'),_0x18e8dd,'request\x20sent',JSON[_0x8e80('0x12')](_0x2fc728));if(_0x2fc728['error']){if(_0x2fc728[_0x8e80('0x13')][_0x8e80('0x14')]===0x1f4){logger['error'](_0x8e80('0xe'),_0x18e8dd,_0x2fc728[_0x8e80('0x13')][_0x8e80('0x15')]);return _0x2d1084(_0x2fc728[_0x8e80('0x13')][_0x8e80('0x15')]);}logger['error'](_0x8e80('0xe'),_0x18e8dd,_0x2fc728[_0x8e80('0x13')]['message']);return _0x5da673(_0x2fc728['error'][_0x8e80('0x15')]);}else{logger['info'](_0x8e80('0xe'),_0x18e8dd,'request\x20sent');_0x5da673(_0x2fc728[_0x8e80('0x16')][_0x8e80('0x15')]);}})[_0x8e80('0x17')](function(_0x3513e8){logger['error']('MemberReport,\x20%s,\x20%s',_0x18e8dd,_0x3513e8);_0x2d1084(_0x3513e8);});});}exports[_0x8e80('0x18')]=function(_0x170c35){var _0x47f273=this;return new Promise(function(_0x59a352,_0x534183){return db[_0x8e80('0x19')]['findAll']({'raw':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1b')]===undefined?!![]:![]:!![],'where':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')]['where']||null:null,'attributes':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1c')]||null:null,'limit':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1d')]||null:null,'include':_0x170c35[_0x8e80('0x1a')]?_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1e')]?_[_0x8e80('0x1f')](_0x170c35[_0x8e80('0x1a')][_0x8e80('0x1e')],function(_0x3227c8){return{'model':db[_0x3227c8[_0x8e80('0x20')]],'as':_0x3227c8['as'],'attributes':_0x3227c8[_0x8e80('0x1c')],'include':_0x3227c8[_0x8e80('0x1e')]?_['map'](_0x3227c8[_0x8e80('0x1e')],function(_0x1dd6c2){return{'model':db[_0x1dd6c2[_0x8e80('0x20')]],'as':_0x1dd6c2['as'],'attributes':_0x1dd6c2[_0x8e80('0x1c')],'include':_0x1dd6c2[_0x8e80('0x1e')]?_[_0x8e80('0x1f')](_0x1dd6c2[_0x8e80('0x1e')],function(_0x45072f){return{'model':db[_0x45072f['model']],'as':_0x45072f['as'],'attributes':_0x45072f[_0x8e80('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8e80('0xc')](function(_0x3c80e5){logger[_0x8e80('0xd')](_0x8e80('0x18'),_0x170c35);logger['debug'](_0x8e80('0x18'),_0x170c35,JSON[_0x8e80('0x12')](_0x3c80e5));_0x59a352(_0x3c80e5);})[_0x8e80('0x17')](function(_0x2e1509){logger[_0x8e80('0x13')](_0x8e80('0x18'),_0x2e1509[_0x8e80('0x15')],_0x170c35);_0x534183(_0x47f273[_0x8e80('0x13')](0x1f4,_0x2e1509['message']));});});};exports[_0x8e80('0x21')]=function(_0x5e23e0){var _0x1aef34=this;return new Promise(function(_0x4075bc,_0x31fa86){return db[_0x8e80('0x19')][_0x8e80('0x22')](_0x5e23e0['body'],{'raw':_0x5e23e0[_0x8e80('0x1a')]?_0x5e23e0[_0x8e80('0x1a')][_0x8e80('0x1b')]===undefined?!![]:![]:!![]})[_0x8e80('0xc')](function(_0x180c0e){logger['info'](_0x8e80('0x21'),_0x5e23e0);logger[_0x8e80('0x10')](_0x8e80('0x21'),_0x5e23e0,JSON[_0x8e80('0x12')](_0x180c0e));_0x4075bc(_0x180c0e);})[_0x8e80('0x17')](function(_0x3dcb45){logger[_0x8e80('0x13')](_0x8e80('0x21'),_0x3dcb45[_0x8e80('0x15')],_0x5e23e0);_0x31fa86(_0x1aef34['error'](0x1f4,_0x3dcb45['message']));});});};exports['UpdateMemberReport']=function(_0x40d774){var _0x207a11=this;return new Promise(function(_0x3f9a9c,_0x5acb51){return db[_0x8e80('0x19')]['update'](_0x40d774['body'],{'raw':_0x40d774['options']?_0x40d774[_0x8e80('0x1a')][_0x8e80('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d774['options']?_0x40d774['options'][_0x8e80('0x23')]||null:null,'attributes':_0x40d774[_0x8e80('0x1a')]?_0x40d774[_0x8e80('0x1a')][_0x8e80('0x1c')]||null:null,'limit':_0x40d774[_0x8e80('0x1a')]?_0x40d774[_0x8e80('0x1a')]['limit']||null:null})[_0x8e80('0xc')](function(_0x31c87c){logger[_0x8e80('0xd')](_0x8e80('0x24'),_0x40d774);logger['debug'](_0x8e80('0x24'),_0x40d774,JSON[_0x8e80('0x12')](_0x31c87c));_0x3f9a9c(_0x31c87c);})[_0x8e80('0x17')](function(_0x33bb8e){logger['error'](_0x8e80('0x24'),_0x33bb8e[_0x8e80('0x15')],_0x40d774);_0x5acb51(_0x207a11[_0x8e80('0x13')](0x1f4,_0x33bb8e[_0x8e80('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 8c7da7f..2fa6247 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 _0x57f8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x93b7ce,_0x26be04){var _0x57053b=function(_0x492e41){while(--_0x492e41){_0x93b7ce['push'](_0x93b7ce['shift']());}};_0x57053b(++_0x26be04);}(_0x57f8,0x198));var _0x857f=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0x57f8[_0x397bfb];return _0x16c9b9;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var auth=require(_0x857f('0x5'));var interaction=require(_0x857f('0x6'));var config=require(_0x857f('0x7'));var controller=require(_0x857f('0x8'));router[_0x857f('0x9')]('/',controller[_0x857f('0xa')]);module[_0x857f('0xb')]=router; \ No newline at end of file +var _0xb7e7=['./migration.controller','get','multer','path','express','../../components/auth/service','../../config/environment'];(function(_0x2cd38a,_0x23833a){var _0x3ea56c=function(_0x29d391){while(--_0x29d391){_0x2cd38a['push'](_0x2cd38a['shift']());}};_0x3ea56c(++_0x23833a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'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')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index dfdee40..4a8450e 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 _0xca5a=['sequelize'];(function(_0x292498,_0x255ef3){var _0x455029=function(_0x110e95){while(--_0x110e95){_0x292498['push'](_0x292498['shift']());}};_0x455029(++_0x255ef3);}(_0xca5a,0xd0));var _0xaca5=function(_0x1b3672,_0xf0a37f){_0x1b3672=_0x1b3672-0x0;var _0x18a82e=_0xca5a[_0x1b3672];return _0x18a82e;};'use strict';var Sequelize=require(_0xaca5('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xdafb=['exports','STRING','version'];(function(_0x172012,_0x2cdb3d){var _0x1e529a=function(_0x5e0e35){while(--_0x5e0e35){_0x172012['push'](_0x172012['shift']());}};_0x1e529a(++_0x2cdb3d);}(_0xdafb,0x192));var _0xbdaf=function(_0xa965d5,_0x4b0610){_0xa965d5=_0xa965d5-0x0;var _0x8ce43c=_0xdafb[_0xa965d5];return _0x8ce43c;};'use strict';var Sequelize=require('sequelize');module[_0xbdaf('0x0')]={'version':{'type':Sequelize[_0xbdaf('0x1')],'unique':_0xbdaf('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 3ebad4a..5e5fb0f 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 _0x0380=['apply','reject','save','update','then','destroy','error','stack','name','send','map','Migration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x465316,_0x30b1be){var _0x474e8a=function(_0x4e1544){while(--_0x4e1544){_0x465316['push'](_0x465316['shift']());}};_0x474e8a(++_0x30b1be);}(_0x0380,0x140));var _0x0038=function(_0x1cbcc2,_0x4bcd4a){_0x1cbcc2=_0x1cbcc2-0x0;var _0xce27e7=_0x0380[_0x1cbcc2];return _0xce27e7;};'use strict';var pdf=require(_0x0038('0x0'));var emlformat=require(_0x0038('0x1'));var rimraf=require(_0x0038('0x2'));var zipdir=require(_0x0038('0x3'));var jsonpatch=require(_0x0038('0x4'));var rp=require(_0x0038('0x5'));var moment=require(_0x0038('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0038('0x7'));var util=require(_0x0038('0x8'));var path=require(_0x0038('0x9'));var sox=require(_0x0038('0xa'));var csv=require(_0x0038('0xb'));var ejs=require(_0x0038('0xc'));var fs=require('fs');var _=require(_0x0038('0xd'));var squel=require(_0x0038('0xe'));var crypto=require(_0x0038('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0038('0xb'));var querystring=require(_0x0038('0x10'));var Papa=require('papaparse');var Redis=require(_0x0038('0x11'));var authService=require(_0x0038('0x12'));var qs=require(_0x0038('0x13'));var as=require(_0x0038('0x14'));var hardwareService=require(_0x0038('0x15'));var logger=require(_0x0038('0x16'))('api');var utils=require(_0x0038('0x17'));var config=require(_0x0038('0x18'));var licenseUtil=require(_0x0038('0x19'));var db=require(_0x0038('0x1a'))['db'];function respondWithStatusCode(_0x50b0f6,_0x3d1fbf){_0x3d1fbf=_0x3d1fbf||0xcc;return function(_0x4ff0c5){if(_0x4ff0c5){return _0x50b0f6[_0x0038('0x1b')](_0x3d1fbf);}return _0x50b0f6[_0x0038('0x1c')](_0x3d1fbf)[_0x0038('0x1d')]();};}function respondWithResult(_0x1dc761,_0x587dc5){_0x587dc5=_0x587dc5||0xc8;return function(_0x2eb3cb){if(_0x2eb3cb){return _0x1dc761[_0x0038('0x1c')](_0x587dc5)[_0x0038('0x1e')](_0x2eb3cb);}};}function respondWithFilteredResult(_0x1cb2ab,_0x3f7e8c){return function(_0x51bc88){if(_0x51bc88){var _0x55d3f9=_0x51bc88[_0x0038('0x1f')],_0x23674d=_0x3f7e8c[_0x0038('0x20')],_0x4526f6=_0x3f7e8c[_0x0038('0x20')]+_0x3f7e8c['limit'],_0x19cd8e;if(_0x4526f6>=_0x55d3f9){_0x4526f6=_0x55d3f9;_0x19cd8e=0xc8;}else{_0x19cd8e=0xce;}_0x1cb2ab[_0x0038('0x1c')](_0x19cd8e);return _0x1cb2ab[_0x0038('0x21')](_0x0038('0x22'),_0x23674d+'-'+_0x4526f6+'/'+_0x55d3f9)[_0x0038('0x1e')](_0x51bc88);}return null;};}function patchUpdates(_0x20d900){return function(_0xa8f9a9){try{jsonpatch[_0x0038('0x23')](_0xa8f9a9,_0x20d900,!![]);}catch(_0x2b8d09){return BPromise[_0x0038('0x24')](_0x2b8d09);}return _0xa8f9a9[_0x0038('0x25')]();};}function saveUpdates(_0x34f576,_0x2785ed){return function(_0x39f98f){if(_0x39f98f){return _0x39f98f[_0x0038('0x26')](_0x34f576)[_0x0038('0x27')](function(_0x9f645a){return _0x9f645a;});}return null;};}function removeEntity(_0x3b02e7,_0x318b22){return function(_0x95747e){if(_0x95747e){return _0x95747e[_0x0038('0x28')]()['then'](function(){_0x3b02e7[_0x0038('0x1c')](0xcc)[_0x0038('0x1d')]();});}};}function handleEntityNotFound(_0x562b37,_0x53120e){return function(_0x2f6576){if(!_0x2f6576){_0x562b37['sendStatus'](0x194);}return _0x2f6576;};}function handleError(_0x13f19a,_0x184876){_0x184876=_0x184876||0x1f4;return function(_0x442adc){logger[_0x0038('0x29')](_0x442adc[_0x0038('0x2a')]);if(_0x442adc[_0x0038('0x2b')]){delete _0x442adc[_0x0038('0x2b')];}_0x13f19a[_0x0038('0x1c')](_0x184876)[_0x0038('0x2c')](_0x442adc);};}exports['index']=function(_0x5f6f4b,_0x59d986){var _0x32f702={},_0x47a134={},_0x28eac1={'count':0x0,'rows':[]};var _0x1553b1=_[_0x0038('0x2d')](db[_0x0038('0x2e')][_0x0038('0x2f')],function(_0x30a9fa){return{'name':_0x30a9fa[_0x0038('0x30')],'type':_0x30a9fa['type'][_0x0038('0x31')]};});_0x47a134['model']=_['map'](_0x1553b1,_0x0038('0x2b'));_0x47a134[_0x0038('0x32')]=_[_0x0038('0x33')](_0x5f6f4b[_0x0038('0x32')]);_0x47a134[_0x0038('0x34')]=_[_0x0038('0x35')](_0x47a134[_0x0038('0x36')],_0x47a134['query']);_0x32f702['attributes']=_[_0x0038('0x35')](_0x47a134[_0x0038('0x36')],qs[_0x0038('0x37')](_0x5f6f4b['query'][_0x0038('0x37')]));_0x32f702[_0x0038('0x38')]=_0x32f702[_0x0038('0x38')][_0x0038('0x39')]?_0x32f702[_0x0038('0x38')]:_0x47a134[_0x0038('0x36')];if(!_0x5f6f4b[_0x0038('0x32')][_0x0038('0x3a')]('nolimit')){_0x32f702[_0x0038('0x3b')]=qs[_0x0038('0x3b')](_0x5f6f4b[_0x0038('0x32')]['limit']);_0x32f702[_0x0038('0x20')]=qs[_0x0038('0x20')](_0x5f6f4b[_0x0038('0x32')][_0x0038('0x20')]);}_0x32f702[_0x0038('0x3c')]=qs[_0x0038('0x3d')](_0x5f6f4b[_0x0038('0x32')][_0x0038('0x3d')]);_0x32f702[_0x0038('0x3e')]=qs[_0x0038('0x34')](_[_0x0038('0x3f')](_0x5f6f4b[_0x0038('0x32')],_0x47a134['filters']),_0x1553b1);if(_0x5f6f4b['query'][_0x0038('0x40')]){_0x32f702[_0x0038('0x3e')]=_[_0x0038('0x41')](_0x32f702[_0x0038('0x3e')],{'$or':_[_0x0038('0x2d')](_0x1553b1,function(_0x236b6c){if(_0x236b6c[_0x0038('0x42')]!==_0x0038('0x43')){var _0x5805ff={};_0x5805ff[_0x236b6c[_0x0038('0x2b')]]={'$like':'%'+_0x5f6f4b[_0x0038('0x32')]['filter']+'%'};return _0x5805ff;}})});}_0x32f702=_['merge']({},_0x32f702,_0x5f6f4b[_0x0038('0x44')]);var _0x12d659={'where':_0x32f702[_0x0038('0x3e')]};return db[_0x0038('0x2e')][_0x0038('0x1f')](_0x12d659)[_0x0038('0x27')](function(_0x23dd01){_0x28eac1[_0x0038('0x1f')]=_0x23dd01;if(_0x5f6f4b['query']['includeAll']){_0x32f702['include']=[{'all':!![]}];}return db[_0x0038('0x2e')][_0x0038('0x45')](_0x32f702);})[_0x0038('0x27')](function(_0x225c75){_0x28eac1['rows']=_0x225c75;return _0x28eac1;})['then'](respondWithFilteredResult(_0x59d986,_0x32f702))[_0x0038('0x46')](handleError(_0x59d986,null));}; \ No newline at end of file +var _0xfe0d=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','Migration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e17a5,_0x17bd81){var _0x16ab9c=function(_0x44bdcb){while(--_0x44bdcb){_0x4e17a5['push'](_0x4e17a5['shift']());}};_0x16ab9c(++_0x17bd81);}(_0xfe0d,0xee));var _0xdfe0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfe0d[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xdfe0('0x0'));var emlformat=require(_0xdfe0('0x1'));var rimraf=require(_0xdfe0('0x2'));var zipdir=require(_0xdfe0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfe0('0x4'));var moment=require('moment');var BPromise=require(_0xdfe0('0x5'));var Mustache=require(_0xdfe0('0x6'));var util=require('util');var path=require(_0xdfe0('0x7'));var sox=require(_0xdfe0('0x8'));var csv=require(_0xdfe0('0x9'));var ejs=require(_0xdfe0('0xa'));var fs=require('fs');var _=require(_0xdfe0('0xb'));var squel=require(_0xdfe0('0xc'));var crypto=require(_0xdfe0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdfe0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdfe0('0xf'));var Redis=require('ioredis');var authService=require(_0xdfe0('0x10'));var qs=require(_0xdfe0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfe0('0x12'));var logger=require(_0xdfe0('0x13'))('api');var utils=require(_0xdfe0('0x14'));var config=require(_0xdfe0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4efaa9,_0x413670){_0x413670=_0x413670||0xcc;return function(_0x28a7c4){if(_0x28a7c4){return _0x4efaa9[_0xdfe0('0x16')](_0x413670);}return _0x4efaa9[_0xdfe0('0x17')](_0x413670)[_0xdfe0('0x18')]();};}function respondWithResult(_0x4ba274,_0x377993){_0x377993=_0x377993||0xc8;return function(_0xddc8ea){if(_0xddc8ea){return _0x4ba274['status'](_0x377993)[_0xdfe0('0x19')](_0xddc8ea);}};}function respondWithFilteredResult(_0x5a586f,_0x18e782){return function(_0x37d1d5){if(_0x37d1d5){var _0x36efac=_0x37d1d5[_0xdfe0('0x1a')],_0x2e21d6=_0x18e782['offset'],_0x4e3d7a=_0x18e782[_0xdfe0('0x1b')]+_0x18e782[_0xdfe0('0x1c')],_0x38ef16;if(_0x4e3d7a>=_0x36efac){_0x4e3d7a=_0x36efac;_0x38ef16=0xc8;}else{_0x38ef16=0xce;}_0x5a586f['status'](_0x38ef16);return _0x5a586f[_0xdfe0('0x1d')](_0xdfe0('0x1e'),_0x2e21d6+'-'+_0x4e3d7a+'/'+_0x36efac)[_0xdfe0('0x19')](_0x37d1d5);}return null;};}function patchUpdates(_0x432fd3){return function(_0x53a24f){try{jsonpatch[_0xdfe0('0x1f')](_0x53a24f,_0x432fd3,!![]);}catch(_0x23d9f8){return BPromise[_0xdfe0('0x20')](_0x23d9f8);}return _0x53a24f[_0xdfe0('0x21')]();};}function saveUpdates(_0x2e1493,_0x5dc5ae){return function(_0x4a7ecc){if(_0x4a7ecc){return _0x4a7ecc[_0xdfe0('0x22')](_0x2e1493)[_0xdfe0('0x23')](function(_0x30c71e){return _0x30c71e;});}return null;};}function removeEntity(_0x1f4211,_0x2b3c53){return function(_0x27db43){if(_0x27db43){return _0x27db43[_0xdfe0('0x24')]()[_0xdfe0('0x23')](function(){_0x1f4211[_0xdfe0('0x17')](0xcc)[_0xdfe0('0x18')]();});}};}function handleEntityNotFound(_0x4ee07b,_0x27b37a){return function(_0x5a3fe5){if(!_0x5a3fe5){_0x4ee07b[_0xdfe0('0x16')](0x194);}return _0x5a3fe5;};}function handleError(_0x3968f5,_0x257ab2){_0x257ab2=_0x257ab2||0x1f4;return function(_0x18be87){logger['error'](_0x18be87[_0xdfe0('0x25')]);if(_0x18be87['name']){delete _0x18be87['name'];}_0x3968f5['status'](_0x257ab2)[_0xdfe0('0x26')](_0x18be87);};}exports[_0xdfe0('0x27')]=function(_0x30fdfc,_0x56e24e){var _0x120883={},_0x5004d8={},_0x3cd868={'count':0x0,'rows':[]};var _0x54b792=_[_0xdfe0('0x28')](db[_0xdfe0('0x29')][_0xdfe0('0x2a')],function(_0x1493c3){return{'name':_0x1493c3[_0xdfe0('0x2b')],'type':_0x1493c3[_0xdfe0('0x2c')][_0xdfe0('0x2d')]};});_0x5004d8[_0xdfe0('0x2e')]=_[_0xdfe0('0x28')](_0x54b792,_0xdfe0('0x2f'));_0x5004d8[_0xdfe0('0x30')]=_[_0xdfe0('0x31')](_0x30fdfc[_0xdfe0('0x30')]);_0x5004d8[_0xdfe0('0x32')]=_[_0xdfe0('0x33')](_0x5004d8[_0xdfe0('0x2e')],_0x5004d8[_0xdfe0('0x30')]);_0x120883['attributes']=_[_0xdfe0('0x33')](_0x5004d8['model'],qs[_0xdfe0('0x34')](_0x30fdfc[_0xdfe0('0x30')]['fields']));_0x120883[_0xdfe0('0x35')]=_0x120883[_0xdfe0('0x35')]['length']?_0x120883['attributes']:_0x5004d8[_0xdfe0('0x2e')];if(!_0x30fdfc[_0xdfe0('0x30')][_0xdfe0('0x36')](_0xdfe0('0x37'))){_0x120883[_0xdfe0('0x1c')]=qs[_0xdfe0('0x1c')](_0x30fdfc['query'][_0xdfe0('0x1c')]);_0x120883['offset']=qs['offset'](_0x30fdfc['query'][_0xdfe0('0x1b')]);}_0x120883[_0xdfe0('0x38')]=qs[_0xdfe0('0x39')](_0x30fdfc[_0xdfe0('0x30')]['sort']);_0x120883[_0xdfe0('0x3a')]=qs[_0xdfe0('0x32')](_['pick'](_0x30fdfc[_0xdfe0('0x30')],_0x5004d8[_0xdfe0('0x32')]),_0x54b792);if(_0x30fdfc[_0xdfe0('0x30')][_0xdfe0('0x3b')]){_0x120883[_0xdfe0('0x3a')]=_[_0xdfe0('0x3c')](_0x120883[_0xdfe0('0x3a')],{'$or':_['map'](_0x54b792,function(_0x5ac8d2){if(_0x5ac8d2['type']!=='VIRTUAL'){var _0x524a4e={};_0x524a4e[_0x5ac8d2['name']]={'$like':'%'+_0x30fdfc[_0xdfe0('0x30')]['filter']+'%'};return _0x524a4e;}})});}_0x120883=_['merge']({},_0x120883,_0x30fdfc[_0xdfe0('0x3d')]);var _0x5459b9={'where':_0x120883[_0xdfe0('0x3a')]};return db[_0xdfe0('0x29')][_0xdfe0('0x1a')](_0x5459b9)['then'](function(_0x2fd2ab){_0x3cd868['count']=_0x2fd2ab;if(_0x30fdfc['query']['includeAll']){_0x120883[_0xdfe0('0x3e')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x120883);})['then'](function(_0x35fd34){_0x3cd868[_0xdfe0('0x3f')]=_0x35fd34;return _0x3cd868;})[_0xdfe0('0x23')](respondWithFilteredResult(_0x56e24e,_0x120883))['catch'](handleError(_0x56e24e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 49a7502..a2d1fd4 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 _0x5dd4=['request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','moment'];(function(_0x4f1b16,_0x324ae0){var _0x212558=function(_0x49ca49){while(--_0x49ca49){_0x4f1b16['push'](_0x4f1b16['shift']());}};_0x212558(++_0x324ae0);}(_0x5dd4,0x1ca));var _0x45dd=function(_0x5538a5,_0x3c6937){_0x5538a5=_0x5538a5-0x0;var _0x176b65=_0x5dd4[_0x5538a5];return _0x176b65;};'use strict';var _=require(_0x45dd('0x0'));var util=require(_0x45dd('0x1'));var logger=require(_0x45dd('0x2'))('api');var moment=require(_0x45dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x45dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45dd('0x5'));var config=require(_0x45dd('0x6'));var attributes=require(_0x45dd('0x7'));module[_0x45dd('0x8')]=function(_0x96d662,_0x4e5c98){return _0x96d662[_0x45dd('0x9')]('Migration',attributes,{'tableName':_0x45dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41ee=['rimraf','../../config/environment','./migration.attributes','define','migrations','lodash','util','api','bluebird','request-promise'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x41ee,0x9b));var _0xe41e=function(_0x5676d3,_0x582062){_0x5676d3=_0x5676d3-0x0;var _0x573736=_0x41ee[_0x5676d3];return _0x573736;};'use strict';var _=require(_0xe41e('0x0'));var util=require(_0xe41e('0x1'));var logger=require('../../config/logger')(_0xe41e('0x2'));var moment=require('moment');var BPromise=require(_0xe41e('0x3'));var rp=require(_0xe41e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe41e('0x5'));var config=require(_0xe41e('0x6'));var attributes=require(_0xe41e('0x7'));module['exports']=function(_0x2a8e08,_0x29e885){return _0x2a8e08[_0xe41e('0x8')]('Migration',attributes,{'tableName':_0xe41e('0x9'),'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 c12df11..dea874b 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 _0x05ed=['../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2e811c,_0xd53821){var _0xc0c312=function(_0x4ab63c){while(--_0x4ab63c){_0x2e811c['push'](_0x2e811c['shift']());}};_0xc0c312(++_0xd53821);}(_0x05ed,0x14b));var _0xd05e=function(_0x5488cc,_0x57b187){_0x5488cc=_0x5488cc-0x0;var _0xa8962e=_0x05ed[_0x5488cc];return _0xa8962e;};'use strict';var _=require(_0xd05e('0x0'));var util=require('util');var moment=require(_0xd05e('0x1'));var BPromise=require(_0xd05e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd05e('0x3'));var db=require(_0xd05e('0x4'))['db'];var utils=require(_0xd05e('0x5'));var logger=require(_0xd05e('0x6'))(_0xd05e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd05e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32c075,_0x173350,_0x5ee5df){return new BPromise(function(_0x5b6ccc,_0x7bd4b2){return client[_0xd05e('0x9')](_0x32c075,_0x5ee5df)[_0xd05e('0xa')](function(_0x5f056e){logger[_0xd05e('0xb')](_0xd05e('0xc'),_0x173350,'request\x20sent');logger[_0xd05e('0xd')](_0xd05e('0xe'),_0x173350,_0xd05e('0xf'),JSON['stringify'](_0x5f056e));if(_0x5f056e[_0xd05e('0x10')]){if(_0x5f056e[_0xd05e('0x10')][_0xd05e('0x11')]===0x1f4){logger[_0xd05e('0x10')](_0xd05e('0xc'),_0x173350,_0x5f056e[_0xd05e('0x10')]['message']);return _0x7bd4b2(_0x5f056e[_0xd05e('0x10')]['message']);}logger[_0xd05e('0x10')]('Migration,\x20%s,\x20%s',_0x173350,_0x5f056e['error']['message']);return _0x5b6ccc(_0x5f056e[_0xd05e('0x10')][_0xd05e('0x12')]);}else{logger[_0xd05e('0xb')](_0xd05e('0xc'),_0x173350,'request\x20sent');_0x5b6ccc(_0x5f056e[_0xd05e('0x13')][_0xd05e('0x12')]);}})[_0xd05e('0x14')](function(_0x4f0004){logger[_0xd05e('0x10')](_0xd05e('0xc'),_0x173350,_0x4f0004);_0x7bd4b2(_0x4f0004);});});} \ No newline at end of file +var _0xce3e=['info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x685608,_0x3348df){var _0x33b726=function(_0x2e54bd){while(--_0x2e54bd){_0x685608['push'](_0x685608['shift']());}};_0x33b726(++_0x3348df);}(_0xce3e,0x12e));var _0xece3=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xce3e[_0x2085f3];return _0x384e3c;};'use strict';var _=require(_0xece3('0x0'));var util=require('util');var moment=require(_0xece3('0x1'));var BPromise=require(_0xece3('0x2'));var rs=require(_0xece3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xece3('0x4'))['db'];var utils=require(_0xece3('0x5'));var logger=require(_0xece3('0x6'))(_0xece3('0x7'));var config=require('../../config/environment');var jayson=require(_0xece3('0x8'));var client=jayson[_0xece3('0x9')][_0xece3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6dea,_0x36adab,_0x452584){return new BPromise(function(_0x16be0f,_0x2e2e62){return client[_0xece3('0xb')](_0x3a6dea,_0x452584)[_0xece3('0xc')](function(_0x25f5e2){logger['info'](_0xece3('0xd'),_0x36adab,_0xece3('0xe'));logger[_0xece3('0xf')](_0xece3('0x10'),_0x36adab,'request\x20sent',JSON[_0xece3('0x11')](_0x25f5e2));if(_0x25f5e2['error']){if(_0x25f5e2[_0xece3('0x12')]['code']===0x1f4){logger[_0xece3('0x12')]('Migration,\x20%s,\x20%s',_0x36adab,_0x25f5e2[_0xece3('0x12')]['message']);return _0x2e2e62(_0x25f5e2['error'][_0xece3('0x13')]);}logger[_0xece3('0x12')](_0xece3('0xd'),_0x36adab,_0x25f5e2[_0xece3('0x12')][_0xece3('0x13')]);return _0x16be0f(_0x25f5e2[_0xece3('0x12')][_0xece3('0x13')]);}else{logger[_0xece3('0x14')](_0xece3('0xd'),_0x36adab,_0xece3('0xe'));_0x16be0f(_0x25f5e2[_0xece3('0x15')][_0xece3('0x13')]);}})[_0xece3('0x16')](function(_0x1cb8fa){logger[_0xece3('0x12')]('Migration,\x20%s,\x20%s',_0x36adab,_0x1cb8fa);_0x2e2e62(_0x1cb8fa);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8a01eb1..41efaa1 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 _0x3336=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1aa75c,_0x184345){var _0x55f3d9=function(_0x574232){while(--_0x574232){_0x1aa75c['push'](_0x1aa75c['shift']());}};_0x55f3d9(++_0x184345);}(_0x3336,0x106));var _0x6333=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x3336[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x6333('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6333('0x1'));var express=require(_0x6333('0x2'));var router=express[_0x6333('0x3')]();var auth=require(_0x6333('0x4'));var interaction=require(_0x6333('0x5'));var config=require(_0x6333('0x6'));var controller=require('./network.controller');router[_0x6333('0x7')]('/',auth[_0x6333('0x8')](),controller[_0x6333('0x9')]);router[_0x6333('0x7')](_0x6333('0xa'),auth[_0x6333('0x8')](),controller[_0x6333('0xb')]);router[_0x6333('0xc')]('/',auth[_0x6333('0x8')](),controller['create']);router[_0x6333('0xd')](_0x6333('0xa'),auth[_0x6333('0x8')](),controller[_0x6333('0xe')]);router[_0x6333('0xf')](_0x6333('0xa'),auth[_0x6333('0x8')](),controller[_0x6333('0x10')]);module[_0x6333('0x11')]=router; \ No newline at end of file +var _0xb032=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x24eb7e,_0x1ffb7e){var _0x104dd8=function(_0x30abdb){while(--_0x30abdb){_0x24eb7e['push'](_0x24eb7e['shift']());}};_0x104dd8(++_0x1ffb7e);}(_0xb032,0x84));var _0x2b03=function(_0x4d9242,_0x385b6e){_0x4d9242=_0x4d9242-0x0;var _0x59301e=_0xb032[_0x4d9242];return _0x59301e;};'use strict';var multer=require(_0x2b03('0x0'));var util=require('util');var path=require(_0x2b03('0x1'));var timeout=require(_0x2b03('0x2'));var express=require(_0x2b03('0x3'));var router=express[_0x2b03('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b03('0x5'));var config=require(_0x2b03('0x6'));var controller=require(_0x2b03('0x7'));router[_0x2b03('0x8')]('/',auth[_0x2b03('0x9')](),controller[_0x2b03('0xa')]);router['get'](_0x2b03('0xb'),auth[_0x2b03('0x9')](),controller[_0x2b03('0xc')]);router[_0x2b03('0xd')]('/',auth['isAuthenticated'](),controller[_0x2b03('0xe')]);router[_0x2b03('0xf')](_0x2b03('0xb'),auth['isAuthenticated'](),controller[_0x2b03('0x10')]);router[_0x2b03('0x11')](_0x2b03('0xb'),auth[_0x2b03('0x9')](),controller[_0x2b03('0x12')]);module[_0x2b03('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index bfcc291..d56a575 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(_0xcfd944,_0xfc8222){var _0x8b6354=function(_0xcf80a2){while(--_0xcf80a2){_0xcfd944['push'](_0xcfd944['shift']());}};_0x8b6354(++_0xfc8222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x240aaf,_0x3be9a2){var _0x38a9b1=function(_0x2a5059){while(--_0x2a5059){_0x240aaf['push'](_0x240aaf['shift']());}};_0x38a9b1(++_0x3be9a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 e571b95..aa20820 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 _0x34b6=['server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','STUN','server/files/templates/turn_multiple.ejs','destroy','/etc/asterisk/stun_xcally.conf','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','sequelize','transaction','body','toUpperCase','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','create','res_stun_monitor.so','TURN','join','writeFileSync','/etc/asterisk/turn_xcally.conf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b6,0xda));var _0x634b=function(_0x74fe1a,_0xc8b539){_0x74fe1a=_0x74fe1a-0x0;var _0x20c71f=_0x34b6[_0x74fe1a];return _0x20c71f;};'use strict';var pdf=require(_0x634b('0x0'));var emlformat=require(_0x634b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x634b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x634b('0x3'));var moment=require(_0x634b('0x4'));var BPromise=require(_0x634b('0x5'));var Mustache=require('mustache');var util=require(_0x634b('0x6'));var path=require(_0x634b('0x7'));var sox=require(_0x634b('0x8'));var csv=require('to-csv');var ejs=require(_0x634b('0x9'));var fs=require('fs');var _=require(_0x634b('0xa'));var squel=require(_0x634b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x634b('0xc'));var toCsv=require(_0x634b('0xd'));var querystring=require(_0x634b('0xe'));var Papa=require(_0x634b('0xf'));var Redis=require(_0x634b('0x10'));var authService=require(_0x634b('0x11'));var qs=require(_0x634b('0x12'));var as=require(_0x634b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x634b('0x14'))(_0x634b('0x15'));var utils=require('../../config/utils');var config=require(_0x634b('0x16'));var licenseUtil=require(_0x634b('0x17'));var db=require(_0x634b('0x18'))['db'];var jayson=require(_0x634b('0x19'));var client=jayson[_0x634b('0x1a')][_0x634b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x309224,_0x3bf367,_0x5096c2,_0x5be1e4){return new BPromise(function(_0x273398,_0x4990d0){var _0x582df8=_0x5be1e4||client;return _0x582df8[_0x634b('0x1c')](_0x309224,_0x5096c2)[_0x634b('0x1d')](function(_0x2cc761){logger['info'](_0x634b('0x1e'),_0x3bf367,_0x634b('0x1f'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x3bf367,'request\x20sent',JSON['stringify'](_0x2cc761));if(_0x2cc761[_0x634b('0x20')]){if(_0x2cc761[_0x634b('0x20')][_0x634b('0x21')]===0x1f4){logger[_0x634b('0x20')](_0x634b('0x1e'),_0x3bf367,_0x2cc761['error']['message']);return _0x4990d0(_0x2cc761[_0x634b('0x20')][_0x634b('0x22')]);}logger['error'](_0x634b('0x1e'),_0x3bf367,_0x2cc761[_0x634b('0x20')][_0x634b('0x22')]);return _0x273398(_0x2cc761['error'][_0x634b('0x22')]);}else{logger[_0x634b('0x23')](_0x634b('0x1e'),_0x3bf367,_0x634b('0x1f'));_0x273398(_0x2cc761['result'][_0x634b('0x22')]);}})['catch'](function(_0x5d570a){logger[_0x634b('0x20')](_0x634b('0x1e'),_0x3bf367,_0x5d570a);_0x4990d0(_0x5d570a);});});}function respondWithStatusCode(_0xc63666,_0xcdf7e9){_0xcdf7e9=_0xcdf7e9||0xcc;return function(_0x24d8fb){if(_0x24d8fb){return _0xc63666[_0x634b('0x24')](_0xcdf7e9);}return _0xc63666[_0x634b('0x25')](_0xcdf7e9)[_0x634b('0x26')]();};}function respondWithResult(_0xcef5dc,_0x348e34){_0x348e34=_0x348e34||0xc8;return function(_0xd36aef){if(_0xd36aef){return _0xcef5dc[_0x634b('0x25')](_0x348e34)[_0x634b('0x27')](_0xd36aef);}};}function respondWithFilteredResult(_0x57e531,_0x170413){return function(_0x4cf49d){if(_0x4cf49d){var _0x40976e=_0x4cf49d[_0x634b('0x28')],_0x151411=_0x170413[_0x634b('0x29')],_0x240ac1=_0x170413[_0x634b('0x29')]+_0x170413[_0x634b('0x2a')],_0x25356d;if(_0x240ac1>=_0x40976e){_0x240ac1=_0x40976e;_0x25356d=0xc8;}else{_0x25356d=0xce;}_0x57e531[_0x634b('0x25')](_0x25356d);return _0x57e531[_0x634b('0x2b')](_0x634b('0x2c'),_0x151411+'-'+_0x240ac1+'/'+_0x40976e)[_0x634b('0x27')](_0x4cf49d);}return null;};}function patchUpdates(_0xf13cf1){return function(_0x4503a6){try{jsonpatch['apply'](_0x4503a6,_0xf13cf1,!![]);}catch(_0x2a348a){return BPromise[_0x634b('0x2d')](_0x2a348a);}return _0x4503a6[_0x634b('0x2e')]();};}function saveUpdates(_0x49bcdf,_0x302b12){return function(_0x1d838c){if(_0x1d838c){return _0x1d838c[_0x634b('0x2f')](_0x49bcdf)[_0x634b('0x1d')](function(_0x23ae4c){return _0x23ae4c;});}return null;};}function removeEntity(_0x39dfa9,_0x3009e4){return function(_0x2b255a){if(_0x2b255a){return _0x2b255a['destroy']()[_0x634b('0x1d')](function(){_0x39dfa9[_0x634b('0x25')](0xcc)[_0x634b('0x26')]();});}};}function handleEntityNotFound(_0x2b6a80,_0x1ce131){return function(_0x5081e6){if(!_0x5081e6){_0x2b6a80[_0x634b('0x24')](0x194);}return _0x5081e6;};}function handleError(_0x2826cd,_0x306d33){_0x306d33=_0x306d33||0x1f4;return function(_0x576fff){logger[_0x634b('0x20')](_0x576fff[_0x634b('0x30')]);if(_0x576fff['name']){delete _0x576fff[_0x634b('0x31')];}_0x2826cd[_0x634b('0x25')](_0x306d33)[_0x634b('0x32')](_0x576fff);};}exports['index']=function(_0x57aa3b,_0x3719f9){var _0x51bc22={},_0x54f7f1={},_0x254af1={'count':0x0,'rows':[]};var _0x5983ce=_[_0x634b('0x33')](db[_0x634b('0x34')][_0x634b('0x35')],function(_0x3dc83a){return{'name':_0x3dc83a[_0x634b('0x36')],'type':_0x3dc83a[_0x634b('0x37')][_0x634b('0x38')]};});_0x54f7f1[_0x634b('0x39')]=_['map'](_0x5983ce,'name');_0x54f7f1['query']=_[_0x634b('0x3a')](_0x57aa3b[_0x634b('0x3b')]);_0x54f7f1['filters']=_[_0x634b('0x3c')](_0x54f7f1[_0x634b('0x39')],_0x54f7f1[_0x634b('0x3b')]);_0x51bc22[_0x634b('0x3d')]=_[_0x634b('0x3c')](_0x54f7f1[_0x634b('0x39')],qs[_0x634b('0x3e')](_0x57aa3b[_0x634b('0x3b')][_0x634b('0x3e')]));_0x51bc22[_0x634b('0x3d')]=_0x51bc22[_0x634b('0x3d')]['length']?_0x51bc22[_0x634b('0x3d')]:_0x54f7f1[_0x634b('0x39')];if(!_0x57aa3b[_0x634b('0x3b')][_0x634b('0x3f')]('nolimit')){_0x51bc22[_0x634b('0x2a')]=qs[_0x634b('0x2a')](_0x57aa3b[_0x634b('0x3b')][_0x634b('0x2a')]);_0x51bc22[_0x634b('0x29')]=qs[_0x634b('0x29')](_0x57aa3b[_0x634b('0x3b')]['offset']);}_0x51bc22['order']=qs[_0x634b('0x40')](_0x57aa3b[_0x634b('0x3b')][_0x634b('0x40')]);_0x51bc22[_0x634b('0x41')]=qs[_0x634b('0x42')](_[_0x634b('0x43')](_0x57aa3b[_0x634b('0x3b')],_0x54f7f1[_0x634b('0x42')]),_0x5983ce);if(_0x57aa3b[_0x634b('0x3b')][_0x634b('0x44')]){_0x51bc22[_0x634b('0x41')]=_[_0x634b('0x45')](_0x51bc22[_0x634b('0x41')],{'$or':_['map'](_0x5983ce,function(_0x47f34d){if(_0x47f34d['type']!=='VIRTUAL'){var _0x6ce954={};_0x6ce954[_0x47f34d['name']]={'$like':'%'+_0x57aa3b[_0x634b('0x3b')][_0x634b('0x44')]+'%'};return _0x6ce954;}})});}_0x51bc22=_[_0x634b('0x45')]({},_0x51bc22,_0x57aa3b[_0x634b('0x46')]);var _0x22a67b={'where':_0x51bc22[_0x634b('0x41')]};return db[_0x634b('0x34')]['count'](_0x22a67b)[_0x634b('0x1d')](function(_0xbd7092){_0x254af1[_0x634b('0x28')]=_0xbd7092;if(_0x57aa3b[_0x634b('0x3b')][_0x634b('0x47')]){_0x51bc22[_0x634b('0x48')]=[{'all':!![]}];}return db[_0x634b('0x34')][_0x634b('0x49')](_0x51bc22);})['then'](function(_0x179bed){_0x254af1[_0x634b('0x4a')]=_0x179bed;return _0x254af1;})[_0x634b('0x1d')](respondWithFilteredResult(_0x3719f9,_0x51bc22))[_0x634b('0x4b')](handleError(_0x3719f9,null));};exports[_0x634b('0x4c')]=function(_0x4d7be4,_0x31b968){var _0x34b08f={'raw':!![],'where':{'id':_0x4d7be4[_0x634b('0x4d')]['id']}},_0x204dd1={};_0x204dd1[_0x634b('0x39')]=_['keys'](db[_0x634b('0x34')][_0x634b('0x35')]);_0x204dd1[_0x634b('0x3b')]=_[_0x634b('0x3a')](_0x4d7be4[_0x634b('0x3b')]);_0x204dd1[_0x634b('0x42')]=_[_0x634b('0x3c')](_0x204dd1[_0x634b('0x39')],_0x204dd1[_0x634b('0x3b')]);_0x34b08f[_0x634b('0x3d')]=_[_0x634b('0x3c')](_0x204dd1[_0x634b('0x39')],qs[_0x634b('0x3e')](_0x4d7be4['query'][_0x634b('0x3e')]));_0x34b08f[_0x634b('0x3d')]=_0x34b08f[_0x634b('0x3d')]['length']?_0x34b08f[_0x634b('0x3d')]:_0x204dd1['model'];if(_0x4d7be4[_0x634b('0x3b')]['includeAll']){_0x34b08f[_0x634b('0x48')]=[{'all':!![]}];}_0x34b08f=_['merge']({},_0x34b08f,_0x4d7be4['options']);return db[_0x634b('0x34')]['find'](_0x34b08f)[_0x634b('0x1d')](handleEntityNotFound(_0x31b968,null))[_0x634b('0x1d')](respondWithResult(_0x31b968,null))[_0x634b('0x4b')](handleError(_0x31b968,null));};exports['create']=function(_0xcd2020,_0x1b0cb3,_0x127735){var _0x4b7a10;return db[_0x634b('0x4e')][_0x634b('0x4f')](function(_0x1b39e1){return db['Network']['create'](_0xcd2020[_0x634b('0x50')],{'raw':!![]})[_0x634b('0x1d')](function(_0x586b58){_0x4b7a10=_0x586b58;return db[_0x634b('0x34')][_0x634b('0x49')]({'where':{'type':_0xcd2020['body'][_0x634b('0x37')]},'raw':!![]});})[_0x634b('0x1d')](function(_0x47fed6){if(_0x4b7a10[_0x634b('0x37')][_0x634b('0x51')]()=='STUN'){var _0xf661dc=fs[_0x634b('0x52')](path['join'](config[_0x634b('0x53')],_0x634b('0x54')),_0x634b('0x55'));var _0x2d7b0f=ejs[_0x634b('0x56')](_0xf661dc,{'networks':_0x47fed6||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2d7b0f);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x58'),{'module':_0x634b('0x59')});}else if(_0x4b7a10[_0x634b('0x37')][_0x634b('0x51')]()==_0x634b('0x5a')){var _0x500ce6=fs[_0x634b('0x52')](path[_0x634b('0x5b')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x634b('0x55'));var _0xbc6005=ejs['render'](_0x500ce6,{'networks':_0x47fed6||[]});fs[_0x634b('0x5c')](_0x634b('0x5d'),_0xbc6005);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x58'),{'module':'res_stun_monitor.so'});}else{var _0x5081f9=fs['readFileSync'](path[_0x634b('0x5b')](config['root'],_0x634b('0x5e')),'utf8');var _0x50a606=ejs[_0x634b('0x56')](_0x5081f9,{'networks':_0x47fed6||[]});fs[_0x634b('0x5c')](util[_0x634b('0x5f')](_0x634b('0x60'),_0xcd2020[_0x634b('0x50')][_0x634b('0x37')][_0x634b('0x61')]()),_0x50a606);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x58'),{'module':_0x634b('0x62')});}return null;})[_0x634b('0x1d')](function(){return _0x4b7a10;});})[_0x634b('0x1d')](respondWithResult(_0x1b0cb3,0xc9))[_0x634b('0x4b')](handleError(_0x1b0cb3,null));};exports[_0x634b('0x2f')]=function(_0x47c598,_0x757dff,_0x18d26f){var _0x55e436;return db[_0x634b('0x4e')][_0x634b('0x4f')](function(_0x2cc33c){return db[_0x634b('0x34')][_0x634b('0x63')]({'where':{'id':_0x47c598[_0x634b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x757dff,null))[_0x634b('0x1d')](saveUpdates(_0x47c598['body'],null))['then'](function(_0x16d1d9){if(_0x16d1d9){_0x55e436=_0x16d1d9;return db['Network'][_0x634b('0x49')]({'where':{'type':_0x55e436['type']},'raw':!![]});}return null;})[_0x634b('0x1d')](function(_0x5d2b79){if(_0x55e436['type'][_0x634b('0x51')]()==_0x634b('0x64')){var _0x3a6b8b=fs['readFileSync'](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x54')),_0x634b('0x55'));var _0x232dda=ejs[_0x634b('0x56')](_0x3a6b8b,{'networks':_0x5d2b79||[]});fs[_0x634b('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x232dda);return respondWithRpcPromise(_0x634b('0x57'),'update',{'module':'res_stun_monitor.so'});}else if(_0x55e436[_0x634b('0x37')][_0x634b('0x51')]()==_0x634b('0x5a')){var _0xaef17f=fs[_0x634b('0x52')](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x65')),_0x634b('0x55'));var _0x262b17=ejs['render'](_0xaef17f,{'networks':_0x5d2b79||[]});fs[_0x634b('0x5c')](_0x634b('0x5d'),_0x262b17);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x2f'),{'module':_0x634b('0x59')});}else{var _0x423fb1=fs['readFileSync'](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x5e')),_0x634b('0x55'));var _0x2c09c7=ejs[_0x634b('0x56')](_0x423fb1,{'networks':_0x5d2b79||[]});fs[_0x634b('0x5c')](util[_0x634b('0x5f')](_0x634b('0x60'),_0x47c598[_0x634b('0x50')][_0x634b('0x37')]['toLowerCase']()),_0x2c09c7);return respondWithRpcPromise(_0x634b('0x57'),'update',{'module':_0x634b('0x62')});}return null;})[_0x634b('0x1d')](function(_0x137c1a){if(_0x137c1a){return _0x55e436;}return null;});})[_0x634b('0x1d')](respondWithResult(_0x757dff,null))[_0x634b('0x4b')](handleError(_0x757dff,null));};exports[_0x634b('0x66')]=function(_0x18830c,_0x2e9ecd,_0x3817df){var _0x19cd1f;return db[_0x634b('0x34')]['find']({'where':{'id':_0x18830c[_0x634b('0x4d')]['id']}})[_0x634b('0x1d')](function(_0x576d93){_0x19cd1f=_0x576d93;return _0x576d93;})[_0x634b('0x1d')](handleEntityNotFound(_0x2e9ecd,null))[_0x634b('0x1d')](removeEntity(_0x2e9ecd,null))[_0x634b('0x1d')](function(){if(_0x19cd1f){return db[_0x634b('0x34')][_0x634b('0x49')]({'where':{'type':_0x19cd1f[_0x634b('0x37')]},'raw':!![]});}})[_0x634b('0x1d')](function(_0x290eca){if(_0x19cd1f['type'][_0x634b('0x51')]()==_0x634b('0x64')){var _0x1de040=fs[_0x634b('0x52')](path[_0x634b('0x5b')](config[_0x634b('0x53')],_0x634b('0x54')),'utf8');var _0x346d11=ejs[_0x634b('0x56')](_0x1de040,{'networks':_0x290eca||[]});fs[_0x634b('0x5c')](_0x634b('0x67'),_0x346d11);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x66'),{'module':_0x634b('0x59')});}else if(_0x19cd1f['type']['toUpperCase']()==_0x634b('0x5a')){var _0x436005=fs[_0x634b('0x52')](path['join'](config[_0x634b('0x53')],'server/files/templates/turn_multiple.ejs'),_0x634b('0x55'));var _0x21d418=ejs[_0x634b('0x56')](_0x436005,{'networks':_0x290eca||[]});fs[_0x634b('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x21d418);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x66'),{'module':_0x634b('0x59')});}else{var _0x3260be=fs[_0x634b('0x52')](path['join'](config['root'],_0x634b('0x5e')),_0x634b('0x55'));var _0x5a2c44=ejs['render'](_0x3260be,{'networks':_0x290eca||[]});fs[_0x634b('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x18830c[_0x634b('0x50')]['type'][_0x634b('0x61')]()),_0x5a2c44);return respondWithRpcPromise(_0x634b('0x57'),_0x634b('0x66'),{'module':_0x634b('0x62')});}return null;})['catch'](handleError(_0x2e9ecd,null));}; \ No newline at end of file +var _0x2add=['render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','join','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','update','TURN','/etc/asterisk/turn_xcally.conf','destroy','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','then','stack','name','index','map','Network','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','find','create','sequelize','body','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8'];(function(_0x43d209,_0x586174){var _0x224032=function(_0x44cd3f){while(--_0x44cd3f){_0x43d209['push'](_0x43d209['shift']());}};_0x224032(++_0x586174);}(_0x2add,0x7b));var _0xd2ad=function(_0x314b91,_0x488aea){_0x314b91=_0x314b91-0x0;var _0x2cd89e=_0x2add[_0x314b91];return _0x2cd89e;};'use strict';var pdf=require(_0xd2ad('0x0'));var emlformat=require(_0xd2ad('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd2ad('0x2'));var rp=require(_0xd2ad('0x3'));var moment=require(_0xd2ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2ad('0x5'));var util=require('util');var path=require(_0xd2ad('0x6'));var sox=require(_0xd2ad('0x7'));var csv=require('to-csv');var ejs=require(_0xd2ad('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd2ad('0x9'));var crypto=require(_0xd2ad('0xa'));var jsforce=require(_0xd2ad('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd2ad('0xc'));var querystring=require(_0xd2ad('0xd'));var Papa=require(_0xd2ad('0xe'));var Redis=require('ioredis');var authService=require(_0xd2ad('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2ad('0x10'))(_0xd2ad('0x11'));var utils=require(_0xd2ad('0x12'));var config=require(_0xd2ad('0x13'));var licenseUtil=require(_0xd2ad('0x14'));var db=require(_0xd2ad('0x15'))['db'];var jayson=require(_0xd2ad('0x16'));var client=jayson[_0xd2ad('0x17')][_0xd2ad('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1107d7,_0x59c387,_0x25ea4a,_0x40bddf){return new BPromise(function(_0x5f0c55,_0x6f5746){var _0x440497=_0x40bddf||client;return _0x440497['request'](_0x1107d7,_0x25ea4a)['then'](function(_0x391de7){logger[_0xd2ad('0x19')](_0xd2ad('0x1a'),_0x59c387,'request\x20sent');logger[_0xd2ad('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x59c387,_0xd2ad('0x1c'),JSON[_0xd2ad('0x1d')](_0x391de7));if(_0x391de7['error']){if(_0x391de7[_0xd2ad('0x1e')][_0xd2ad('0x1f')]===0x1f4){logger[_0xd2ad('0x1e')](_0xd2ad('0x1a'),_0x59c387,_0x391de7['error'][_0xd2ad('0x20')]);return _0x6f5746(_0x391de7[_0xd2ad('0x1e')][_0xd2ad('0x20')]);}logger[_0xd2ad('0x1e')](_0xd2ad('0x1a'),_0x59c387,_0x391de7[_0xd2ad('0x1e')]['message']);return _0x5f0c55(_0x391de7[_0xd2ad('0x1e')]['message']);}else{logger['info'](_0xd2ad('0x1a'),_0x59c387,'request\x20sent');_0x5f0c55(_0x391de7[_0xd2ad('0x21')]['message']);}})[_0xd2ad('0x22')](function(_0x4d28d8){logger[_0xd2ad('0x1e')](_0xd2ad('0x1a'),_0x59c387,_0x4d28d8);_0x6f5746(_0x4d28d8);});});}function respondWithStatusCode(_0x2dd29e,_0xdb3709){_0xdb3709=_0xdb3709||0xcc;return function(_0x55f681){if(_0x55f681){return _0x2dd29e[_0xd2ad('0x23')](_0xdb3709);}return _0x2dd29e[_0xd2ad('0x24')](_0xdb3709)[_0xd2ad('0x25')]();};}function respondWithResult(_0x5bcc1b,_0x1ca6b1){_0x1ca6b1=_0x1ca6b1||0xc8;return function(_0x7033d4){if(_0x7033d4){return _0x5bcc1b['status'](_0x1ca6b1)[_0xd2ad('0x26')](_0x7033d4);}};}function respondWithFilteredResult(_0x474115,_0x3c0505){return function(_0x58ce60){if(_0x58ce60){var _0x428177=_0x58ce60[_0xd2ad('0x27')],_0x2d4515=_0x3c0505[_0xd2ad('0x28')],_0x11dbc8=_0x3c0505[_0xd2ad('0x28')]+_0x3c0505[_0xd2ad('0x29')],_0x40c6c2;if(_0x11dbc8>=_0x428177){_0x11dbc8=_0x428177;_0x40c6c2=0xc8;}else{_0x40c6c2=0xce;}_0x474115[_0xd2ad('0x24')](_0x40c6c2);return _0x474115[_0xd2ad('0x2a')](_0xd2ad('0x2b'),_0x2d4515+'-'+_0x11dbc8+'/'+_0x428177)['json'](_0x58ce60);}return null;};}function patchUpdates(_0x310196){return function(_0x2f59bb){try{jsonpatch[_0xd2ad('0x2c')](_0x2f59bb,_0x310196,!![]);}catch(_0xd691d7){return BPromise['reject'](_0xd691d7);}return _0x2f59bb['save']();};}function saveUpdates(_0x349f28,_0x1e21f6){return function(_0x2db8d8){if(_0x2db8d8){return _0x2db8d8['update'](_0x349f28)[_0xd2ad('0x2d')](function(_0x3c1e66){return _0x3c1e66;});}return null;};}function removeEntity(_0x447022,_0x5ccf07){return function(_0x37c8c5){if(_0x37c8c5){return _0x37c8c5['destroy']()[_0xd2ad('0x2d')](function(){_0x447022[_0xd2ad('0x24')](0xcc)[_0xd2ad('0x25')]();});}};}function handleEntityNotFound(_0x456a80,_0xe0e472){return function(_0x24beff){if(!_0x24beff){_0x456a80['sendStatus'](0x194);}return _0x24beff;};}function handleError(_0xa60174,_0x54b04f){_0x54b04f=_0x54b04f||0x1f4;return function(_0x43d543){logger['error'](_0x43d543[_0xd2ad('0x2e')]);if(_0x43d543[_0xd2ad('0x2f')]){delete _0x43d543['name'];}_0xa60174[_0xd2ad('0x24')](_0x54b04f)['send'](_0x43d543);};}exports[_0xd2ad('0x30')]=function(_0x30d44d,_0x10b81b){var _0x4a09fa={},_0x2f25f6={},_0x46157b={'count':0x0,'rows':[]};var _0xa9b7be=_[_0xd2ad('0x31')](db[_0xd2ad('0x32')][_0xd2ad('0x33')],function(_0x1f46b1){return{'name':_0x1f46b1[_0xd2ad('0x34')],'type':_0x1f46b1['type'][_0xd2ad('0x35')]};});_0x2f25f6[_0xd2ad('0x36')]=_[_0xd2ad('0x31')](_0xa9b7be,_0xd2ad('0x2f'));_0x2f25f6[_0xd2ad('0x37')]=_['keys'](_0x30d44d['query']);_0x2f25f6[_0xd2ad('0x38')]=_[_0xd2ad('0x39')](_0x2f25f6[_0xd2ad('0x36')],_0x2f25f6[_0xd2ad('0x37')]);_0x4a09fa[_0xd2ad('0x3a')]=_[_0xd2ad('0x39')](_0x2f25f6[_0xd2ad('0x36')],qs[_0xd2ad('0x3b')](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x3b')]));_0x4a09fa[_0xd2ad('0x3a')]=_0x4a09fa[_0xd2ad('0x3a')][_0xd2ad('0x3c')]?_0x4a09fa[_0xd2ad('0x3a')]:_0x2f25f6['model'];if(!_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x3d')](_0xd2ad('0x3e'))){_0x4a09fa['limit']=qs['limit'](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x29')]);_0x4a09fa['offset']=qs[_0xd2ad('0x28')](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x28')]);}_0x4a09fa[_0xd2ad('0x3f')]=qs[_0xd2ad('0x40')](_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x40')]);_0x4a09fa[_0xd2ad('0x41')]=qs[_0xd2ad('0x38')](_[_0xd2ad('0x42')](_0x30d44d[_0xd2ad('0x37')],_0x2f25f6[_0xd2ad('0x38')]),_0xa9b7be);if(_0x30d44d[_0xd2ad('0x37')][_0xd2ad('0x43')]){_0x4a09fa['where']=_[_0xd2ad('0x44')](_0x4a09fa[_0xd2ad('0x41')],{'$or':_[_0xd2ad('0x31')](_0xa9b7be,function(_0x10fa74){if(_0x10fa74[_0xd2ad('0x45')]!==_0xd2ad('0x46')){var _0x511769={};_0x511769[_0x10fa74[_0xd2ad('0x2f')]]={'$like':'%'+_0x30d44d['query']['filter']+'%'};return _0x511769;}})});}_0x4a09fa=_[_0xd2ad('0x44')]({},_0x4a09fa,_0x30d44d[_0xd2ad('0x47')]);var _0xa5d4ff={'where':_0x4a09fa[_0xd2ad('0x41')]};return db['Network'][_0xd2ad('0x27')](_0xa5d4ff)[_0xd2ad('0x2d')](function(_0x564ce7){_0x46157b[_0xd2ad('0x27')]=_0x564ce7;if(_0x30d44d[_0xd2ad('0x37')]['includeAll']){_0x4a09fa[_0xd2ad('0x48')]=[{'all':!![]}];}return db[_0xd2ad('0x32')][_0xd2ad('0x49')](_0x4a09fa);})['then'](function(_0x39f186){_0x46157b[_0xd2ad('0x4a')]=_0x39f186;return _0x46157b;})['then'](respondWithFilteredResult(_0x10b81b,_0x4a09fa))[_0xd2ad('0x22')](handleError(_0x10b81b,null));};exports[_0xd2ad('0x4b')]=function(_0x404a8f,_0x132446){var _0x4e0fe1={'raw':!![],'where':{'id':_0x404a8f[_0xd2ad('0x4c')]['id']}},_0x2133b2={};_0x2133b2[_0xd2ad('0x36')]=_[_0xd2ad('0x4d')](db[_0xd2ad('0x32')][_0xd2ad('0x33')]);_0x2133b2[_0xd2ad('0x37')]=_[_0xd2ad('0x4d')](_0x404a8f[_0xd2ad('0x37')]);_0x2133b2[_0xd2ad('0x38')]=_[_0xd2ad('0x39')](_0x2133b2[_0xd2ad('0x36')],_0x2133b2[_0xd2ad('0x37')]);_0x4e0fe1['attributes']=_['intersection'](_0x2133b2['model'],qs[_0xd2ad('0x3b')](_0x404a8f[_0xd2ad('0x37')][_0xd2ad('0x3b')]));_0x4e0fe1['attributes']=_0x4e0fe1['attributes']['length']?_0x4e0fe1[_0xd2ad('0x3a')]:_0x2133b2[_0xd2ad('0x36')];if(_0x404a8f[_0xd2ad('0x37')]['includeAll']){_0x4e0fe1[_0xd2ad('0x48')]=[{'all':!![]}];}_0x4e0fe1=_[_0xd2ad('0x44')]({},_0x4e0fe1,_0x404a8f[_0xd2ad('0x47')]);return db[_0xd2ad('0x32')][_0xd2ad('0x4e')](_0x4e0fe1)[_0xd2ad('0x2d')](handleEntityNotFound(_0x132446,null))[_0xd2ad('0x2d')](respondWithResult(_0x132446,null))[_0xd2ad('0x22')](handleError(_0x132446,null));};exports[_0xd2ad('0x4f')]=function(_0x3ec595,_0xa8ff46,_0x573ea5){var _0x290734;return db[_0xd2ad('0x50')]['transaction'](function(_0x49eac7){return db['Network'][_0xd2ad('0x4f')](_0x3ec595[_0xd2ad('0x51')],{'raw':!![]})[_0xd2ad('0x2d')](function(_0x398157){_0x290734=_0x398157;return db[_0xd2ad('0x32')][_0xd2ad('0x49')]({'where':{'type':_0x3ec595['body'][_0xd2ad('0x45')]},'raw':!![]});})[_0xd2ad('0x2d')](function(_0x3fb601){if(_0x290734[_0xd2ad('0x45')]['toUpperCase']()==_0xd2ad('0x52')){var _0x402e40=fs[_0xd2ad('0x53')](path['join'](config[_0xd2ad('0x54')],_0xd2ad('0x55')),_0xd2ad('0x56'));var _0x211849=ejs[_0xd2ad('0x57')](_0x402e40,{'networks':_0x3fb601||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x59'),_0x211849);return respondWithRpcPromise(_0xd2ad('0x5a'),'create',{'module':_0xd2ad('0x5b')});}else if(_0x290734['type'][_0xd2ad('0x5c')]()=='TURN'){var _0x2ce1d4=fs['readFileSync'](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],_0xd2ad('0x5e')),'utf8');var _0x2e4630=ejs[_0xd2ad('0x57')](_0x2ce1d4,{'networks':_0x3fb601||[]});fs[_0xd2ad('0x58')]('/etc/asterisk/turn_xcally.conf',_0x2e4630);return respondWithRpcPromise('Reload',_0xd2ad('0x4f'),{'module':_0xd2ad('0x5b')});}else{var _0x50bf51=fs[_0xd2ad('0x53')](path['join'](config[_0xd2ad('0x54')],_0xd2ad('0x5f')),'utf8');var _0x1f0b90=ejs['render'](_0x50bf51,{'networks':_0x3fb601||[]});fs[_0xd2ad('0x58')](util[_0xd2ad('0x60')](_0xd2ad('0x61'),_0x3ec595['body']['type'][_0xd2ad('0x62')]()),_0x1f0b90);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x4f'),{'module':_0xd2ad('0x63')});}return null;})[_0xd2ad('0x2d')](function(){return _0x290734;});})[_0xd2ad('0x2d')](respondWithResult(_0xa8ff46,0xc9))[_0xd2ad('0x22')](handleError(_0xa8ff46,null));};exports['update']=function(_0x30da57,_0x4e2179,_0x29f96a){var _0x3dc097;return db['sequelize'][_0xd2ad('0x64')](function(_0x120236){return db[_0xd2ad('0x32')][_0xd2ad('0x4e')]({'where':{'id':_0x30da57[_0xd2ad('0x4c')]['id']}})[_0xd2ad('0x2d')](handleEntityNotFound(_0x4e2179,null))[_0xd2ad('0x2d')](saveUpdates(_0x30da57['body'],null))[_0xd2ad('0x2d')](function(_0x4d21fb){if(_0x4d21fb){_0x3dc097=_0x4d21fb;return db[_0xd2ad('0x32')][_0xd2ad('0x49')]({'where':{'type':_0x3dc097['type']},'raw':!![]});}return null;})['then'](function(_0x43ac36){if(_0x3dc097[_0xd2ad('0x45')][_0xd2ad('0x5c')]()==_0xd2ad('0x52')){var _0x3a4236=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],'server/files/templates/stun_multiple.ejs'),_0xd2ad('0x56'));var _0x2db589=ejs[_0xd2ad('0x57')](_0x3a4236,{'networks':_0x43ac36||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x59'),_0x2db589);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x65'),{'module':'res_stun_monitor.so'});}else if(_0x3dc097['type'][_0xd2ad('0x5c')]()==_0xd2ad('0x66')){var _0x2d229c=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],_0xd2ad('0x5e')),_0xd2ad('0x56'));var _0x2ad46a=ejs['render'](_0x2d229c,{'networks':_0x43ac36||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x67'),_0x2ad46a);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x65'),{'module':_0xd2ad('0x5b')});}else{var _0x1756de=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config['root'],_0xd2ad('0x5f')),'utf8');var _0x718540=ejs[_0xd2ad('0x57')](_0x1756de,{'networks':_0x43ac36||[]});fs[_0xd2ad('0x58')](util[_0xd2ad('0x60')](_0xd2ad('0x61'),_0x30da57[_0xd2ad('0x51')][_0xd2ad('0x45')]['toLowerCase']()),_0x718540);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x65'),{'module':_0xd2ad('0x63')});}return null;})[_0xd2ad('0x2d')](function(_0x4dc8bd){if(_0x4dc8bd){return _0x3dc097;}return null;});})[_0xd2ad('0x2d')](respondWithResult(_0x4e2179,null))[_0xd2ad('0x22')](handleError(_0x4e2179,null));};exports[_0xd2ad('0x68')]=function(_0x1e27ae,_0x207f51,_0xdd1fe3){var _0x2ea5d0;return db['Network'][_0xd2ad('0x4e')]({'where':{'id':_0x1e27ae[_0xd2ad('0x4c')]['id']}})[_0xd2ad('0x2d')](function(_0x1e2a3c){_0x2ea5d0=_0x1e2a3c;return _0x1e2a3c;})['then'](handleEntityNotFound(_0x207f51,null))['then'](removeEntity(_0x207f51,null))[_0xd2ad('0x2d')](function(){if(_0x2ea5d0){return db[_0xd2ad('0x32')]['findAll']({'where':{'type':_0x2ea5d0[_0xd2ad('0x45')]},'raw':!![]});}})[_0xd2ad('0x2d')](function(_0xbbbc2f){if(_0x2ea5d0['type'][_0xd2ad('0x5c')]()==_0xd2ad('0x52')){var _0x16172c=fs['readFileSync'](path[_0xd2ad('0x5d')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xd2ad('0x56'));var _0x30ecd0=ejs[_0xd2ad('0x57')](_0x16172c,{'networks':_0xbbbc2f||[]});fs[_0xd2ad('0x58')](_0xd2ad('0x59'),_0x30ecd0);return respondWithRpcPromise(_0xd2ad('0x5a'),_0xd2ad('0x68'),{'module':_0xd2ad('0x5b')});}else if(_0x2ea5d0['type']['toUpperCase']()==_0xd2ad('0x66')){var _0x494d8a=fs[_0xd2ad('0x53')](path[_0xd2ad('0x5d')](config[_0xd2ad('0x54')],_0xd2ad('0x5e')),_0xd2ad('0x56'));var _0x9e69d3=ejs[_0xd2ad('0x57')](_0x494d8a,{'networks':_0xbbbc2f||[]});fs['writeFileSync'](_0xd2ad('0x67'),_0x9e69d3);return respondWithRpcPromise(_0xd2ad('0x5a'),'destroy',{'module':_0xd2ad('0x5b')});}else{var _0x44facc=fs['readFileSync'](path['join'](config['root'],_0xd2ad('0x5f')),_0xd2ad('0x56'));var _0x1c70cc=ejs[_0xd2ad('0x57')](_0x44facc,{'networks':_0xbbbc2f||[]});fs[_0xd2ad('0x58')](util[_0xd2ad('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0x1e27ae[_0xd2ad('0x51')][_0xd2ad('0x45')][_0xd2ad('0x62')]()),_0x1c70cc);return respondWithRpcPromise(_0xd2ad('0x5a'),'destroy',{'module':_0xd2ad('0x63')});}return null;})['catch'](handleError(_0x207f51,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 70ac3ea..5ce3e6e 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 _0xc234=['define','Network','network','lodash','util','../../config/logger','api','bluebird','request-promise','path','./network.attributes'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xc234,0x18f));var _0x4c23=function(_0x417b62,_0x2fd510){_0x417b62=_0x417b62-0x0;var _0x8d5a54=_0xc234[_0x417b62];return _0x8d5a54;};'use strict';var _=require(_0x4c23('0x0'));var util=require(_0x4c23('0x1'));var logger=require(_0x4c23('0x2'))(_0x4c23('0x3'));var moment=require('moment');var BPromise=require(_0x4c23('0x4'));var rp=require(_0x4c23('0x5'));var fs=require('fs');var path=require(_0x4c23('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c23('0x7'));module['exports']=function(_0x3d81cd,_0x1cac0e){return _0x3d81cd[_0x4c23('0x8')](_0x4c23('0x9'),attributes,{'tableName':_0x4c23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc46e=['exports','define','Network','network','lodash','util','api','request-promise','path','rimraf','./network.attributes'];(function(_0x50b072,_0x52b175){var _0x257025=function(_0x5ae4c4){while(--_0x5ae4c4){_0x50b072['push'](_0x50b072['shift']());}};_0x257025(++_0x52b175);}(_0xc46e,0x88));var _0xec46=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0xc46e[_0x40ebff];return _0x40122a;};'use strict';var _=require(_0xec46('0x0'));var util=require(_0xec46('0x1'));var logger=require('../../config/logger')(_0xec46('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec46('0x3'));var fs=require('fs');var path=require(_0xec46('0x4'));var rimraf=require(_0xec46('0x5'));var config=require('../../config/environment');var attributes=require(_0xec46('0x6'));module[_0xec46('0x7')]=function(_0x34b10a,_0xf00cd9){return _0x34b10a[_0xec46('0x8')](_0xec46('0x9'),attributes,{'tableName':_0xec46('0xa'),'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 85a2900..1401d38 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 _0xcce1=['info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xcce1,0xfb));var _0x1cce=function(_0x110bb7,_0x56c479){_0x110bb7=_0x110bb7-0x0;var _0x1e6ac2=_0xcce1[_0x110bb7];return _0x1e6ac2;};'use strict';var _=require(_0x1cce('0x0'));var util=require(_0x1cce('0x1'));var moment=require(_0x1cce('0x2'));var BPromise=require(_0x1cce('0x3'));var rs=require(_0x1cce('0x4'));var fs=require('fs');var Redis=require(_0x1cce('0x5'));var db=require(_0x1cce('0x6'))['db'];var utils=require(_0x1cce('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1cce('0x8'));var jayson=require(_0x1cce('0x9'));var client=jayson[_0x1cce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc2a4ea,_0x3f8c86,_0x4aee6c){return new BPromise(function(_0x166676,_0xf9be8f){return client[_0x1cce('0xb')](_0xc2a4ea,_0x4aee6c)[_0x1cce('0xc')](function(_0x5bbab7){logger[_0x1cce('0xd')](_0x1cce('0xe'),_0x3f8c86,_0x1cce('0xf'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x3f8c86,_0x1cce('0xf'),JSON[_0x1cce('0x10')](_0x5bbab7));if(_0x5bbab7[_0x1cce('0x11')]){if(_0x5bbab7['error'][_0x1cce('0x12')]===0x1f4){logger[_0x1cce('0x11')](_0x1cce('0xe'),_0x3f8c86,_0x5bbab7[_0x1cce('0x11')]['message']);return _0xf9be8f(_0x5bbab7[_0x1cce('0x11')][_0x1cce('0x13')]);}logger[_0x1cce('0x11')](_0x1cce('0xe'),_0x3f8c86,_0x5bbab7[_0x1cce('0x11')][_0x1cce('0x13')]);return _0x166676(_0x5bbab7[_0x1cce('0x11')][_0x1cce('0x13')]);}else{logger['info'](_0x1cce('0xe'),_0x3f8c86,_0x1cce('0xf'));_0x166676(_0x5bbab7[_0x1cce('0x14')][_0x1cce('0x13')]);}})[_0x1cce('0x15')](function(_0x31f805){logger['error'](_0x1cce('0xe'),_0x3f8c86,_0x31f805);_0xf9be8f(_0x31f805);});});} \ No newline at end of file +var _0x6af9=['jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1c6ca1,_0x298553){var _0x5ebcc2=function(_0x27bc18){while(--_0x27bc18){_0x1c6ca1['push'](_0x1c6ca1['shift']());}};_0x5ebcc2(++_0x298553);}(_0x6af9,0x12c));var _0x96af=function(_0x1c146f,_0x1184a2){_0x1c146f=_0x1c146f-0x0;var _0x15f322=_0x6af9[_0x1c146f];return _0x15f322;};'use strict';var _=require('lodash');var util=require(_0x96af('0x0'));var moment=require('moment');var BPromise=require(_0x96af('0x1'));var rs=require(_0x96af('0x2'));var fs=require('fs');var Redis=require(_0x96af('0x3'));var db=require(_0x96af('0x4'))['db'];var utils=require(_0x96af('0x5'));var logger=require('../../config/logger')(_0x96af('0x6'));var config=require(_0x96af('0x7'));var jayson=require(_0x96af('0x8'));var client=jayson[_0x96af('0x9')][_0x96af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c973f,_0x4f0ff7,_0x50e51b){return new BPromise(function(_0x2a8356,_0x2da6f0){return client[_0x96af('0xb')](_0x4c973f,_0x50e51b)['then'](function(_0x53d672){logger['info'](_0x96af('0xc'),_0x4f0ff7,_0x96af('0xd'));logger['debug'](_0x96af('0xe'),_0x4f0ff7,'request\x20sent',JSON[_0x96af('0xf')](_0x53d672));if(_0x53d672['error']){if(_0x53d672[_0x96af('0x10')][_0x96af('0x11')]===0x1f4){logger[_0x96af('0x10')](_0x96af('0xc'),_0x4f0ff7,_0x53d672[_0x96af('0x10')][_0x96af('0x12')]);return _0x2da6f0(_0x53d672[_0x96af('0x10')][_0x96af('0x12')]);}logger[_0x96af('0x10')](_0x96af('0xc'),_0x4f0ff7,_0x53d672[_0x96af('0x10')][_0x96af('0x12')]);return _0x2a8356(_0x53d672[_0x96af('0x10')]['message']);}else{logger[_0x96af('0x13')](_0x96af('0xc'),_0x4f0ff7,_0x96af('0xd'));_0x2a8356(_0x53d672[_0x96af('0x14')]['message']);}})[_0x96af('0x15')](function(_0x14e256){logger[_0x96af('0x10')](_0x96af('0xc'),_0x4f0ff7,_0x14e256);_0x2da6f0(_0x14e256);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 19592eb..8a17733 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 _0x2f2d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','isAuthenticated','sendNotification','exports','multer','util','path'];(function(_0x14e001,_0x569bf){var _0x2c09da=function(_0x2efab1){while(--_0x2efab1){_0x14e001['push'](_0x14e001['shift']());}};_0x2c09da(++_0x569bf);}(_0x2f2d,0x176));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd2f2('0x0'));var util=require(_0xd2f2('0x1'));var path=require(_0xd2f2('0x2'));var timeout=require(_0xd2f2('0x3'));var express=require(_0xd2f2('0x4'));var router=express[_0xd2f2('0x5')]();var auth=require(_0xd2f2('0x6'));var interaction=require(_0xd2f2('0x7'));var config=require(_0xd2f2('0x8'));var controller=require(_0xd2f2('0x9'));router['post']('/',auth[_0xd2f2('0xa')](),controller[_0xd2f2('0xb')]);module[_0xd2f2('0xc')]=router; \ No newline at end of file +var _0x93f4=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','util'];(function(_0x5a5c54,_0x2f00ca){var _0x694bd=function(_0x4ac52){while(--_0x4ac52){_0x5a5c54['push'](_0x5a5c54['shift']());}};_0x694bd(++_0x2f00ca);}(_0x93f4,0x81));var _0x493f=function(_0x47804c,_0x3e5804){_0x47804c=_0x47804c-0x0;var _0x3d0b01=_0x93f4[_0x47804c];return _0x3d0b01;};'use strict';var multer=require('multer');var util=require(_0x493f('0x0'));var path=require(_0x493f('0x1'));var timeout=require(_0x493f('0x2'));var express=require(_0x493f('0x3'));var router=express['Router']();var auth=require(_0x493f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x493f('0x5'));var controller=require(_0x493f('0x6'));router[_0x493f('0x7')]('/',auth[_0x493f('0x8')](),controller[_0x493f('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 4a472e8..6b6a80d 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 _0x81a3=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x81a3,0x149));var _0x381a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x81a3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x381a('0x0'));module[_0x381a('0x1')]={'body':{'type':Sequelize[_0x381a('0x2')]},'senderName':{'type':Sequelize[_0x381a('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x381a('0x3')]},'beep':{'type':Sequelize[_0x381a('0x4')]}}; \ No newline at end of file +var _0x5ff9=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x27bc63,_0x203fed){var _0x55a732=function(_0x133f5e){while(--_0x133f5e){_0x27bc63['push'](_0x27bc63['shift']());}};_0x55a732(++_0x203fed);}(_0x5ff9,0x177));var _0x95ff=function(_0x41ce1a,_0x2b3825){_0x41ce1a=_0x41ce1a-0x0;var _0x4a24ff=_0x5ff9[_0x41ce1a];return _0x4a24ff;};'use strict';var Sequelize=require(_0x95ff('0x0'));module[_0x95ff('0x1')]={'body':{'type':Sequelize[_0x95ff('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x95ff('0x3')]},'beep':{'type':Sequelize[_0x95ff('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index b427b17..0f37408 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 _0xda3f=['voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','create','forEach','recipient','emit','notification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','model','User','ids','queue','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendNotification','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x1b3343,_0x85a7dc){var _0x3151d5=function(_0x549c71){while(--_0x549c71){_0x1b3343['push'](_0x1b3343['shift']());}};_0x3151d5(++_0x85a7dc);}(_0xda3f,0xec));var _0xfda3=function(_0x23f1e4,_0x2bf381){_0x23f1e4=_0x23f1e4-0x0;var _0x11907f=_0xda3f[_0x23f1e4];return _0x11907f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfda3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfda3('0x3'));var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x6'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];config['redis']=_[_0xfda3('0x17')](config['redis'],{'host':_0xfda3('0x18'),'port':0x18eb});var socket=require(_0xfda3('0x19'))(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x227d72,_0x477fc0){_0x477fc0=_0x477fc0||0xcc;return function(_0x5ea793){if(_0x5ea793){return _0x227d72['sendStatus'](_0x477fc0);}return _0x227d72['status'](_0x477fc0)[_0xfda3('0x1a')]();};}function respondWithResult(_0x474707,_0x249dc6){_0x249dc6=_0x249dc6||0xc8;return function(_0x3d8bcd){if(_0x3d8bcd){return _0x474707[_0xfda3('0x1b')](_0x249dc6)[_0xfda3('0x1c')](_0x3d8bcd);}};}function respondWithFilteredResult(_0x2aadcb,_0x93c8ef){return function(_0x4680bf){if(_0x4680bf){var _0xc62ae6=_0x4680bf[_0xfda3('0x1d')],_0x54a7c6=_0x93c8ef[_0xfda3('0x1e')],_0x15ddb9=_0x93c8ef['offset']+_0x93c8ef[_0xfda3('0x1f')],_0x1bbdda;if(_0x15ddb9>=_0xc62ae6){_0x15ddb9=_0xc62ae6;_0x1bbdda=0xc8;}else{_0x1bbdda=0xce;}_0x2aadcb[_0xfda3('0x1b')](_0x1bbdda);return _0x2aadcb[_0xfda3('0x20')]('Content-Range',_0x54a7c6+'-'+_0x15ddb9+'/'+_0xc62ae6)['json'](_0x4680bf);}return null;};}function patchUpdates(_0xa0449d){return function(_0x38d428){try{jsonpatch[_0xfda3('0x21')](_0x38d428,_0xa0449d,!![]);}catch(_0x545320){return BPromise[_0xfda3('0x22')](_0x545320);}return _0x38d428[_0xfda3('0x23')]();};}function saveUpdates(_0x1e15a8,_0x2c0ae9){return function(_0xfb4ee9){if(_0xfb4ee9){return _0xfb4ee9[_0xfda3('0x24')](_0x1e15a8)[_0xfda3('0x25')](function(_0xc6fb9a){return _0xc6fb9a;});}return null;};}function removeEntity(_0x16eaa6,_0x5499f5){return function(_0x82341b){if(_0x82341b){return _0x82341b[_0xfda3('0x26')]()[_0xfda3('0x25')](function(){_0x16eaa6['status'](0xcc)[_0xfda3('0x1a')]();});}};}function handleEntityNotFound(_0x39e246,_0x172cfb){return function(_0x38946d){if(!_0x38946d){_0x39e246[_0xfda3('0x27')](0x194);}return _0x38946d;};}function handleError(_0xad9f7b,_0x514d2a){_0x514d2a=_0x514d2a||0x1f4;return function(_0x3c6d7d){logger[_0xfda3('0x28')](_0x3c6d7d[_0xfda3('0x29')]);if(_0x3c6d7d[_0xfda3('0x2a')]){delete _0x3c6d7d[_0xfda3('0x2a')];}_0xad9f7b['status'](_0x514d2a)[_0xfda3('0x2b')](_0x3c6d7d);};}exports[_0xfda3('0x2c')]=function(_0x301509,_0x474992,_0xe21ec6){if(!_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')]('text')&&!_0x301509['body'][_0xfda3('0x2e')]('TemplateId')){throw new db['Sequelize'][(_0xfda3('0x2f'))](_0xfda3('0x30'));}else{if(_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')](_0xfda3('0x31'))&&!_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')](_0xfda3('0x32'))){throw new db[(_0xfda3('0x33'))]['ValidationError'](_0xfda3('0x34'));}if(!_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')](_0xfda3('0x35'))){throw new db[(_0xfda3('0x33'))][(_0xfda3('0x2f'))](_0xfda3('0x36'));}else{try{var _0x210763=JSON[_0xfda3('0x37')](_0x301509['body']['recipients']);}catch(_0x30e63e){logger[_0xfda3('0x28')](_0x30e63e);throw new db['Sequelize'][(_0xfda3('0x2f'))](_0xfda3('0x38'));}var _0x28ca96=['chatqueue',_0xfda3('0x39'),_0xfda3('0x3a'),_0xfda3('0x3b'),_0xfda3('0x3c'),_0xfda3('0x3d'),'whatsappqueue',_0xfda3('0x3e'),_0xfda3('0x3f')];if(_[_0xfda3('0x40')](_0x210763,function(_0x56bed2){return!_[_0xfda3('0x41')](_0x28ca96,_0x56bed2['model'][_0xfda3('0x42')]());})){throw new db[(_0xfda3('0x33'))][(_0xfda3('0x2f'))](_0xfda3('0x43'));}}}var _0x21c5cc={};_0x21c5cc[_0xfda3('0x44')]=_0x301509[_0xfda3('0x2d')][_0xfda3('0x2e')]('senderName')?_0x301509[_0xfda3('0x2d')][_0xfda3('0x44')]:_0x301509[_0xfda3('0x3f')][_0xfda3('0x45')];_0x21c5cc['recipientsDescription']=_[_0xfda3('0x46')](_0x301509[_0xfda3('0x2d')][_0xfda3('0x47')])?null:_0x301509['body']['recipientsDescription'];_0x21c5cc[_0xfda3('0x48')]=_0x301509[_0xfda3('0x2d')][_0xfda3('0x48')]||![];_0x21c5cc[_0xfda3('0x49')]=_0x301509[_0xfda3('0x3f')]['id'];return getContent(_0x301509[_0xfda3('0x2d')])[_0xfda3('0x25')](function(_0x278708){_0x21c5cc[_0xfda3('0x2d')]=_0x278708;return getRecipients(_0x210763);})[_0xfda3('0x25')](function(_0x4d3b1c){_0x21c5cc[_0xfda3('0x4a')]=_[_0xfda3('0x4b')](_0x4d3b1c)['join'](',');return db[_0xfda3('0x4c')]['transaction'](function(_0x51a314){return db['Notification'][_0xfda3('0x4d')](_0x21c5cc,{'raw':!![],'transaction':_0x51a314})[_0xfda3('0x25')](function(_0x260977){var _0x209918={'sender':_0x21c5cc['senderName'],'description':_0x21c5cc[_0xfda3('0x47')],'content':_0x21c5cc[_0xfda3('0x2d')],'beep':_0x21c5cc[_0xfda3('0x48')]};_0x4d3b1c[_0xfda3('0x4e')](function(_0x564ccd){_0x209918[_0xfda3('0x4f')]=_0x564ccd;socket[_0xfda3('0x50')](_0xfda3('0x51'),_0x209918);});return _0x260977;});});})['then'](respondWithResult(_0x474992,0xc9))['catch'](handleError(_0x474992,null));};function getContent(_0x1849fe){return new BPromise(function(_0xb3a539,_0x1eea02){if(_0x1849fe[_0xfda3('0x52')]){_0xb3a539(_0x1849fe[_0xfda3('0x52')]);return;}return db[_0xfda3('0x53')][_0xfda3('0x54')]({'attributes':[_0xfda3('0x55')],'where':{'id':_0x1849fe[_0xfda3('0x31')]},'raw':!![]})[_0xfda3('0x25')](function(_0x1749f7){if(!_0x1749f7)throw new db[(_0xfda3('0x33'))][(_0xfda3('0x2f'))](_0xfda3('0x56'));var _0x57013b=Mustache['render'](_0x1749f7[_0xfda3('0x55')],_0x1849fe[_0xfda3('0x32')]);_0xb3a539(_0x57013b);})[_0xfda3('0x57')](function(_0x270b9a){_0x1eea02(_0x270b9a);});});}function getRecipients(_0x597e5a){return new BPromise(function(_0x60a89d,_0x192133){var _0x125f5a=[];var _0x1372ee=[];_0x597e5a[_0xfda3('0x4e')](function(_0x5131da){var _0x257839=_[_0xfda3('0x58')](_0x5131da[_0xfda3('0x59')][_0xfda3('0x42')]());if(_0x257839===_0xfda3('0x5a')){_0x125f5a=_['union'](_0x125f5a,_0x5131da[_0xfda3('0x5b')]);}else{if(_[_0xfda3('0x41')](_0x257839,_0xfda3('0x5c')))_0x257839=_0x257839['replace'](_0xfda3('0x5c'),_0xfda3('0x5d'));_0x5131da[_0xfda3('0x5b')]['forEach'](function(_0x30c01c){_0x1372ee[_0xfda3('0x5e')](getAgents(_0x257839,_0x30c01c));});}});return BPromise[_0xfda3('0x5f')](_0x1372ee)[_0xfda3('0x25')](function(_0x1ab4a8){_0x125f5a=_['union'](_0x125f5a,_[_0xfda3('0x60')](_0x1ab4a8));_0x60a89d(_0x125f5a);})['catch'](function(_0x17fe20){_0x192133(_0x17fe20);});});}function getAgents(_0x587eef,_0x1b5e89){return new BPromise(function(_0x6447,_0x322b66){return db[_0x587eef][_0xfda3('0x54')]({'where':{'id':_0x1b5e89}})['then'](function(_0x244c24){return _0x244c24[_0xfda3('0x61')]({'attributes':['id'],'raw':!![]})[_0xfda3('0x25')](function(_0x372f15){var _0x18425a=_[_0xfda3('0x62')](_0x372f15,'id');_0x6447(_0x18425a);});})[_0xfda3('0x57')](function(_0x54fba2){_0x322b66(_0x54fba2);});});} \ No newline at end of file +var _0x189f=['recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','some','includes','model','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','queue','Queue','ids','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','error','stack','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view'];(function(_0x211db0,_0x4356c8){var _0x805e20=function(_0x1503b9){while(--_0x1503b9){_0x211db0['push'](_0x211db0['shift']());}};_0x805e20(++_0x4356c8);}(_0x189f,0x145));var _0xf189=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x189f[_0x4d79bc];return _0x4b4760;};'use strict';var pdf=require(_0xf189('0x0'));var emlformat=require(_0xf189('0x1'));var rimraf=require(_0xf189('0x2'));var zipdir=require(_0xf189('0x3'));var jsonpatch=require(_0xf189('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf189('0x5'));var util=require(_0xf189('0x6'));var path=require(_0xf189('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf189('0x8'));var fs=require('fs');var _=require(_0xf189('0x9'));var squel=require(_0xf189('0xa'));var crypto=require(_0xf189('0xb'));var jsforce=require(_0xf189('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf189('0xd'));var Papa=require(_0xf189('0xe'));var Redis=require('ioredis');var authService=require(_0xf189('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf189('0x10'));var hardwareService=require(_0xf189('0x11'));var logger=require(_0xf189('0x12'))(_0xf189('0x13'));var utils=require('../../config/utils');var config=require(_0xf189('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf189('0x15')]=_['defaults'](config[_0xf189('0x15')],{'host':_0xf189('0x16'),'port':0x18eb});var socket=require(_0xf189('0x17'))(new Redis(config['redis']));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x1634f2,_0x30bda1){_0x30bda1=_0x30bda1||0xcc;return function(_0x1e05d3){if(_0x1e05d3){return _0x1634f2[_0xf189('0x18')](_0x30bda1);}return _0x1634f2[_0xf189('0x19')](_0x30bda1)[_0xf189('0x1a')]();};}function respondWithResult(_0x5b7889,_0x40f6b0){_0x40f6b0=_0x40f6b0||0xc8;return function(_0x5e458c){if(_0x5e458c){return _0x5b7889[_0xf189('0x19')](_0x40f6b0)[_0xf189('0x1b')](_0x5e458c);}};}function respondWithFilteredResult(_0x568e4a,_0x5c5c55){return function(_0x543678){if(_0x543678){var _0x1b1e31=_0x543678[_0xf189('0x1c')],_0x2ec131=_0x5c5c55[_0xf189('0x1d')],_0x4912a6=_0x5c5c55[_0xf189('0x1d')]+_0x5c5c55[_0xf189('0x1e')],_0x52f4b8;if(_0x4912a6>=_0x1b1e31){_0x4912a6=_0x1b1e31;_0x52f4b8=0xc8;}else{_0x52f4b8=0xce;}_0x568e4a['status'](_0x52f4b8);return _0x568e4a[_0xf189('0x1f')]('Content-Range',_0x2ec131+'-'+_0x4912a6+'/'+_0x1b1e31)[_0xf189('0x1b')](_0x543678);}return null;};}function patchUpdates(_0x24c868){return function(_0x15ccd8){try{jsonpatch['apply'](_0x15ccd8,_0x24c868,!![]);}catch(_0x479085){return BPromise[_0xf189('0x20')](_0x479085);}return _0x15ccd8['save']();};}function saveUpdates(_0x507d4c,_0x1980da){return function(_0x21c240){if(_0x21c240){return _0x21c240[_0xf189('0x21')](_0x507d4c)[_0xf189('0x22')](function(_0xc28f41){return _0xc28f41;});}return null;};}function removeEntity(_0x17ee9c,_0x844a6){return function(_0xe70b39){if(_0xe70b39){return _0xe70b39['destroy']()['then'](function(){_0x17ee9c[_0xf189('0x19')](0xcc)[_0xf189('0x1a')]();});}};}function handleEntityNotFound(_0x3b6d81,_0x59730f){return function(_0x340697){if(!_0x340697){_0x3b6d81['sendStatus'](0x194);}return _0x340697;};}function handleError(_0x48eb70,_0x171e79){_0x171e79=_0x171e79||0x1f4;return function(_0x277546){logger[_0xf189('0x23')](_0x277546[_0xf189('0x24')]);if(_0x277546['name']){delete _0x277546['name'];}_0x48eb70[_0xf189('0x19')](_0x171e79)[_0xf189('0x25')](_0x277546);};}exports[_0xf189('0x26')]=function(_0x183af1,_0x31678e,_0x51a9b1){if(!_0x183af1['body'][_0xf189('0x27')](_0xf189('0x28'))&&!_0x183af1[_0xf189('0x29')]['hasOwnProperty'](_0xf189('0x2a'))){throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))](_0xf189('0x2d'));}else{if(_0x183af1[_0xf189('0x29')][_0xf189('0x27')](_0xf189('0x2a'))&&!_0x183af1[_0xf189('0x29')]['hasOwnProperty'](_0xf189('0x2e'))){throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x183af1['body'][_0xf189('0x27')](_0xf189('0x2f'))){throw new db[(_0xf189('0x2b'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5d8c08=JSON['parse'](_0x183af1[_0xf189('0x29')]['recipients']);}catch(_0x8de851){logger[_0xf189('0x23')](_0x8de851);throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))](_0xf189('0x30'));}var _0x1f0bf4=[_0xf189('0x31'),_0xf189('0x32'),_0xf189('0x33'),_0xf189('0x34'),_0xf189('0x35'),_0xf189('0x36'),'whatsappqueue',_0xf189('0x37'),'user'];if(_[_0xf189('0x38')](_0x5d8c08,function(_0x4f4440){return!_[_0xf189('0x39')](_0x1f0bf4,_0x4f4440[_0xf189('0x3a')]['toLowerCase']());})){throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xb2f2e={};_0xb2f2e[_0xf189('0x3b')]=_0x183af1[_0xf189('0x29')][_0xf189('0x27')]('senderName')?_0x183af1['body']['senderName']:_0x183af1[_0xf189('0x3c')][_0xf189('0x3d')];_0xb2f2e[_0xf189('0x3e')]=_[_0xf189('0x3f')](_0x183af1[_0xf189('0x29')][_0xf189('0x3e')])?null:_0x183af1[_0xf189('0x29')][_0xf189('0x3e')];_0xb2f2e[_0xf189('0x40')]=_0x183af1['body'][_0xf189('0x40')]||![];_0xb2f2e[_0xf189('0x41')]=_0x183af1[_0xf189('0x3c')]['id'];return getContent(_0x183af1['body'])['then'](function(_0x27dd45){_0xb2f2e['body']=_0x27dd45;return getRecipients(_0x5d8c08);})[_0xf189('0x22')](function(_0x337753){_0xb2f2e[_0xf189('0x42')]=_[_0xf189('0x43')](_0x337753)[_0xf189('0x44')](',');return db[_0xf189('0x45')][_0xf189('0x46')](function(_0x33ec76){return db['Notification'][_0xf189('0x47')](_0xb2f2e,{'raw':!![],'transaction':_0x33ec76})[_0xf189('0x22')](function(_0x165bdf){var _0x122bbd={'sender':_0xb2f2e[_0xf189('0x3b')],'description':_0xb2f2e['recipientsDescription'],'content':_0xb2f2e[_0xf189('0x29')],'beep':_0xb2f2e[_0xf189('0x40')]};_0x337753[_0xf189('0x48')](function(_0x36797f){_0x122bbd[_0xf189('0x49')]=_0x36797f;socket[_0xf189('0x4a')](_0xf189('0x4b'),_0x122bbd);});return _0x165bdf;});});})[_0xf189('0x22')](respondWithResult(_0x31678e,0xc9))[_0xf189('0x4c')](handleError(_0x31678e,null));};function getContent(_0x54d5e1){return new BPromise(function(_0x1af6fd,_0x1a4ed3){if(_0x54d5e1[_0xf189('0x28')]){_0x1af6fd(_0x54d5e1['text']);return;}return db[_0xf189('0x4d')][_0xf189('0x4e')]({'attributes':[_0xf189('0x4f')],'where':{'id':_0x54d5e1[_0xf189('0x2a')]},'raw':!![]})[_0xf189('0x22')](function(_0x5ecf24){if(!_0x5ecf24)throw new db[(_0xf189('0x2b'))][(_0xf189('0x2c'))](_0xf189('0x50'));var _0x278d27=Mustache[_0xf189('0x51')](_0x5ecf24['html'],_0x54d5e1[_0xf189('0x2e')]);_0x1af6fd(_0x278d27);})[_0xf189('0x4c')](function(_0x346beb){_0x1a4ed3(_0x346beb);});});}function getRecipients(_0x253442){return new BPromise(function(_0x5e650f,_0xf66512){var _0x3e7288=[];var _0x44f87e=[];_0x253442[_0xf189('0x48')](function(_0x14d488){var _0x3274f2=_[_0xf189('0x52')](_0x14d488[_0xf189('0x3a')][_0xf189('0x53')]());if(_0x3274f2===_0xf189('0x54')){_0x3e7288=_['union'](_0x3e7288,_0x14d488['ids']);}else{if(_[_0xf189('0x39')](_0x3274f2,_0xf189('0x55')))_0x3274f2=_0x3274f2['replace'](_0xf189('0x55'),_0xf189('0x56'));_0x14d488[_0xf189('0x57')][_0xf189('0x48')](function(_0x409056){_0x44f87e['push'](getAgents(_0x3274f2,_0x409056));});}});return BPromise[_0xf189('0x58')](_0x44f87e)['then'](function(_0x37bfa7){_0x3e7288=_[_0xf189('0x59')](_0x3e7288,_[_0xf189('0x5a')](_0x37bfa7));_0x5e650f(_0x3e7288);})[_0xf189('0x4c')](function(_0x425a5f){_0xf66512(_0x425a5f);});});}function getAgents(_0x135c2f,_0x107c19){return new BPromise(function(_0x3f5a91,_0x58088c){return db[_0x135c2f][_0xf189('0x4e')]({'where':{'id':_0x107c19}})['then'](function(_0x39ec65){return _0x39ec65[_0xf189('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb586e){var _0x10fefb=_[_0xf189('0x5c')](_0xb586e,'id');_0x3f5a91(_0x10fefb);});})[_0xf189('0x4c')](function(_0x584061){_0x58088c(_0x584061);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index b066449..f87b314 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 _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x4091d4,_0x25b9c7){var _0x139e34=function(_0x5d87ce){while(--_0x5d87ce){_0x4091d4['push'](_0x4091d4['shift']());}};_0x139e34(++_0x25b9c7);}(_0x757a,0xde));var _0xa757=function(_0x29c582,_0x556774){_0x29c582=_0x29c582-0x0;var _0x506fad=_0x757a[_0x29c582];return _0x506fad;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x4f960a,_0x1cba55){var _0x46207c=function(_0x114c72){while(--_0x114c72){_0x4f960a['push'](_0x4f960a['shift']());}};_0x46207c(++_0x1cba55);}(_0x757a,0xde));var _0xa757=function(_0xaf11be,_0x4d8732){_0xaf11be=_0xaf11be-0x0;var _0x2a38cb=_0x757a[_0xaf11be];return _0x2a38cb;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 9fa238d..4b26484 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 _0x35c5=['bluebird','request-promise','path','rimraf','./notification.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x290316,_0x2445ed){var _0x22c75d=function(_0x45a7ac){while(--_0x45a7ac){_0x290316['push'](_0x290316['shift']());}};_0x22c75d(++_0x2445ed);}(_0x35c5,0x141));var _0x535c=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x35c5[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x535c('0x0'));var util=require('util');var logger=require(_0x535c('0x1'))(_0x535c('0x2'));var moment=require(_0x535c('0x3'));var BPromise=require(_0x535c('0x4'));var rp=require(_0x535c('0x5'));var fs=require('fs');var path=require(_0x535c('0x6'));var rimraf=require(_0x535c('0x7'));var config=require('../../config/environment');var attributes=require(_0x535c('0x8'));module[_0x535c('0x9')]=function(_0x25e42f,_0x6fef75){return _0x25e42f[_0x535c('0xa')]('Notification',attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x535c('0xb'),'collate':_0x535c('0xc')});}; \ No newline at end of file +var _0xc693=['exports','define','notifications','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./notification.attributes'];(function(_0x302535,_0x421ee0){var _0x4e329e=function(_0x1c23f4){while(--_0x1c23f4){_0x302535['push'](_0x302535['shift']());}};_0x4e329e(++_0x421ee0);}(_0xc693,0x16b));var _0x3c69=function(_0x1d4ffd,_0x36b5ca){_0x1d4ffd=_0x1d4ffd-0x0;var _0xe2e772=_0xc693[_0x1d4ffd];return _0xe2e772;};'use strict';var _=require('lodash');var util=require(_0x3c69('0x0'));var logger=require(_0x3c69('0x1'))(_0x3c69('0x2'));var moment=require(_0x3c69('0x3'));var BPromise=require(_0x3c69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c69('0x5'));var rimraf=require(_0x3c69('0x6'));var config=require(_0x3c69('0x7'));var attributes=require(_0x3c69('0x8'));module[_0x3c69('0x9')]=function(_0x5f580a,_0x21c3ca){return _0x5f580a[_0x3c69('0xa')]('Notification',attributes,{'tableName':_0x3c69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 2e48716..88eccfb 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 _0x0aa3=['defaults','redis','localhost','socket.io-emitter','register','then','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x0aa3,0x103));var _0x30aa=function(_0x98011a,_0x1a7b4d){_0x98011a=_0x98011a-0x0;var _0x39f9ed=_0x0aa3[_0x98011a];return _0x39f9ed;};'use strict';var _=require(_0x30aa('0x0'));var util=require(_0x30aa('0x1'));var moment=require(_0x30aa('0x2'));var BPromise=require(_0x30aa('0x3'));var rs=require(_0x30aa('0x4'));var fs=require('fs');var Redis=require(_0x30aa('0x5'));var db=require(_0x30aa('0x6'))['db'];var utils=require(_0x30aa('0x7'));var logger=require(_0x30aa('0x8'))('rpc');var config=require(_0x30aa('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30aa('0xa')]({'port':0x232a});config['redis']=_[_0x30aa('0xb')](config[_0x30aa('0xc')],{'host':_0x30aa('0xd'),'port':0x18eb});var socket=require(_0x30aa('0xe'))(new Redis(config[_0x30aa('0xc')]));require('./notification.socket')[_0x30aa('0xf')](socket);function respondWithRpcPromise(_0x484fd1,_0x7e7e1e,_0x2684e2){return new BPromise(function(_0x1105bb,_0x177f6b){return client['request'](_0x484fd1,_0x2684e2)[_0x30aa('0x10')](function(_0x2b983a){logger['info'](_0x30aa('0x11'),_0x7e7e1e,'request\x20sent');logger[_0x30aa('0x12')](_0x30aa('0x13'),_0x7e7e1e,_0x30aa('0x14'),JSON[_0x30aa('0x15')](_0x2b983a));if(_0x2b983a['error']){if(_0x2b983a[_0x30aa('0x16')][_0x30aa('0x17')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x7e7e1e,_0x2b983a['error']['message']);return _0x177f6b(_0x2b983a[_0x30aa('0x16')][_0x30aa('0x18')]);}logger[_0x30aa('0x16')]('Notification,\x20%s,\x20%s',_0x7e7e1e,_0x2b983a[_0x30aa('0x16')]['message']);return _0x1105bb(_0x2b983a[_0x30aa('0x16')]['message']);}else{logger['info'](_0x30aa('0x11'),_0x7e7e1e,'request\x20sent');_0x1105bb(_0x2b983a[_0x30aa('0x19')]['message']);}})[_0x30aa('0x1a')](function(_0x18cdaa){logger[_0x30aa('0x16')]('Notification,\x20%s,\x20%s',_0x7e7e1e,_0x18cdaa);_0x177f6b(_0x18cdaa);});});} \ No newline at end of file +var _0x53e0=['then','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','localhost','redis','register','request'];(function(_0x5e1649,_0x2f9027){var _0x4b0d66=function(_0x55fbdc){while(--_0x55fbdc){_0x5e1649['push'](_0x5e1649['shift']());}};_0x4b0d66(++_0x2f9027);}(_0x53e0,0x1b4));var _0x053e=function(_0x4f2530,_0x5c0bb5){_0x4f2530=_0x4f2530-0x0;var _0x4a9e71=_0x53e0[_0x4f2530];return _0x4a9e71;};'use strict';var _=require(_0x053e('0x0'));var util=require('util');var moment=require(_0x053e('0x1'));var BPromise=require(_0x053e('0x2'));var rs=require(_0x053e('0x3'));var fs=require('fs');var Redis=require(_0x053e('0x4'));var db=require(_0x053e('0x5'))['db'];var utils=require(_0x053e('0x6'));var logger=require('../../config/logger')(_0x053e('0x7'));var config=require(_0x053e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x053e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x053e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x053e('0xb')]));require('./notification.socket')[_0x053e('0xc')](socket);function respondWithRpcPromise(_0xad9b0a,_0x37c2a4,_0x116ecb){return new BPromise(function(_0xff9f0a,_0x1e8132){return client[_0x053e('0xd')](_0xad9b0a,_0x116ecb)[_0x053e('0xe')](function(_0xc8c712){logger['info'](_0x053e('0xf'),_0x37c2a4,_0x053e('0x10'));logger[_0x053e('0x11')](_0x053e('0x12'),_0x37c2a4,'request\x20sent',JSON[_0x053e('0x13')](_0xc8c712));if(_0xc8c712['error']){if(_0xc8c712['error'][_0x053e('0x14')]===0x1f4){logger[_0x053e('0x15')]('Notification,\x20%s,\x20%s',_0x37c2a4,_0xc8c712[_0x053e('0x15')][_0x053e('0x16')]);return _0x1e8132(_0xc8c712['error'][_0x053e('0x16')]);}logger[_0x053e('0x15')](_0x053e('0xf'),_0x37c2a4,_0xc8c712['error'][_0x053e('0x16')]);return _0xff9f0a(_0xc8c712[_0x053e('0x15')][_0x053e('0x16')]);}else{logger[_0x053e('0x17')]('Notification,\x20%s,\x20%s',_0x37c2a4,_0x053e('0x10'));_0xff9f0a(_0xc8c712['result']['message']);}})[_0x053e('0x18')](function(_0x2814be){logger['error'](_0x053e('0xf'),_0x37c2a4,_0x2814be);_0x1e8132(_0x2814be);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index fabf1a7..482195d 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 _0x992f=['emit','notification:','./notification.events','save','remove','update'];(function(_0x32f59b,_0x3f3d17){var _0x44e713=function(_0x59a35e){while(--_0x59a35e){_0x32f59b['push'](_0x32f59b['shift']());}};_0x44e713(++_0x3f3d17);}(_0x992f,0x1b8));var _0xf992=function(_0x583823,_0x1f2c50){_0x583823=_0x583823-0x0;var _0x2b1844=_0x992f[_0x583823];return _0x2b1844;};'use strict';var NotificationEvents=require(_0xf992('0x0'));var events=[_0xf992('0x1'),_0xf992('0x2'),_0xf992('0x3')];function createListener(_0x1bff61,_0x3aef7d){return function(_0x3e47d5){_0x3aef7d[_0xf992('0x4')](_0x1bff61,_0x3e47d5);};}function removeListener(_0x3ae6c2,_0x5d34eb){return function(){NotificationEvents['removeListener'](_0x3ae6c2,_0x5d34eb);};}exports['register']=function(_0x3036c1){for(var _0x2e53de=0x0,_0x21ff0e=events['length'];_0x2e53de<_0x21ff0e;_0x2e53de++){var _0xd2361c=events[_0x2e53de];var _0x212233=createListener(_0xf992('0x5')+_0xd2361c,_0x3036c1);NotificationEvents['on'](_0xd2361c,_0x212233);}}; \ No newline at end of file +var _0xed90=['register','notification:','./notification.events','save','remove','update','emit'];(function(_0x2d5302,_0x32d845){var _0xf4eaa3=function(_0x5792c0){while(--_0x5792c0){_0x2d5302['push'](_0x2d5302['shift']());}};_0xf4eaa3(++_0x32d845);}(_0xed90,0xcd));var _0x0ed9=function(_0x4906e0,_0x13e4f8){_0x4906e0=_0x4906e0-0x0;var _0x5a3a62=_0xed90[_0x4906e0];return _0x5a3a62;};'use strict';var NotificationEvents=require(_0x0ed9('0x0'));var events=[_0x0ed9('0x1'),_0x0ed9('0x2'),_0x0ed9('0x3')];function createListener(_0x5629fc,_0x6f281){return function(_0x317a9e){_0x6f281[_0x0ed9('0x4')](_0x5629fc,_0x317a9e);};}function removeListener(_0x2e2e8e,_0x1a9679){return function(){NotificationEvents['removeListener'](_0x2e2e8e,_0x1a9679);};}exports[_0x0ed9('0x5')]=function(_0x28f3b3){for(var _0xf19373=0x0,_0x39e367=events['length'];_0xf19373<_0x39e367;_0xf19373++){var _0x380f1d=events[_0xf19373];var _0x4beb02=createListener(_0x0ed9('0x6')+_0x380f1d,_0x28f3b3);NotificationEvents['on'](_0x380f1d,_0x4beb02);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 738d490..444b426 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 _0x6f94=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x5c3093,_0x3e7acb){var _0x1fa178=function(_0x4dadfa){while(--_0x4dadfa){_0x5c3093['push'](_0x5c3093['shift']());}};_0x1fa178(++_0x3e7acb);}(_0x6f94,0x198));var _0x46f9=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6f94[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require('multer');var util=require(_0x46f9('0x0'));var path=require(_0x46f9('0x1'));var timeout=require(_0x46f9('0x2'));var express=require(_0x46f9('0x3'));var router=express['Router']();var auth=require(_0x46f9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x46f9('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x46f9('0x6')](),controller[_0x46f9('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x46f9('0x8')]);router[_0x46f9('0x9')](_0x46f9('0xa'),auth[_0x46f9('0x6')](),controller['show']);router['get'](_0x46f9('0xb'),auth[_0x46f9('0x6')](),controller[_0x46f9('0xc')]);router[_0x46f9('0x9')](_0x46f9('0xd'),auth[_0x46f9('0x6')](),controller[_0x46f9('0xe')]);router[_0x46f9('0x9')]('/:id/applications',auth[_0x46f9('0x6')](),controller[_0x46f9('0xf')]);router['get'](_0x46f9('0x10'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x11')]);router[_0x46f9('0x9')](_0x46f9('0x12'),auth['isAuthenticated'](),controller[_0x46f9('0x13')]);router['post']('/',auth[_0x46f9('0x6')](),controller[_0x46f9('0x14')]);router[_0x46f9('0x15')]('/:id/dispositions',auth[_0x46f9('0x6')](),controller[_0x46f9('0x16')]);router[_0x46f9('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x46f9('0x17')]);router[_0x46f9('0x15')](_0x46f9('0x18'),controller[_0x46f9('0x19')]);router[_0x46f9('0x15')](_0x46f9('0x1a'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x1b')]);router[_0x46f9('0x15')]('/:id/users',auth[_0x46f9('0x6')](),controller[_0x46f9('0x1c')]);router[_0x46f9('0x15')]('/:id/send',auth[_0x46f9('0x6')](),controller[_0x46f9('0x1d')]);router[_0x46f9('0x1e')](_0x46f9('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x46f9('0xa'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x1f')]);router[_0x46f9('0x20')](_0x46f9('0xb'),auth['isAuthenticated'](),controller[_0x46f9('0x21')]);router[_0x46f9('0x20')](_0x46f9('0xd'),auth[_0x46f9('0x6')](),controller[_0x46f9('0x22')]);router[_0x46f9('0x20')](_0x46f9('0x12'),auth['isAuthenticated'](),controller[_0x46f9('0x23')]);module[_0x46f9('0x24')]=router; \ No newline at end of file +var _0x6512=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','show','getDispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','notify','addApplications','/:id/send','send','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x2d6eff,_0x2f9934){var _0x4d1250=function(_0x5f1562){while(--_0x5f1562){_0x2d6eff['push'](_0x2d6eff['shift']());}};_0x4d1250(++_0x2f9934);}(_0x6512,0x141));var _0x2651=function(_0x5ab273,_0x46a0d7){_0x5ab273=_0x5ab273-0x0;var _0x4095c3=_0x6512[_0x5ab273];return _0x4095c3;};'use strict';var multer=require(_0x2651('0x0'));var util=require(_0x2651('0x1'));var path=require(_0x2651('0x2'));var timeout=require(_0x2651('0x3'));var express=require(_0x2651('0x4'));var router=express['Router']();var auth=require(_0x2651('0x5'));var interaction=require(_0x2651('0x6'));var config=require('../../config/environment');var controller=require(_0x2651('0x7'));router[_0x2651('0x8')]('/',auth['isAuthenticated'](),controller[_0x2651('0x9')]);router[_0x2651('0x8')](_0x2651('0xa'),auth[_0x2651('0xb')](),controller[_0x2651('0xc')]);router[_0x2651('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2651('0xd')]);router['get']('/:id/dispositions',auth[_0x2651('0xb')](),controller[_0x2651('0xe')]);router['get']('/:id/canned_answers',auth[_0x2651('0xb')](),controller['getAnswers']);router[_0x2651('0x8')](_0x2651('0xf'),auth['isAuthenticated'](),controller[_0x2651('0x10')]);router[_0x2651('0x8')](_0x2651('0x11'),auth[_0x2651('0xb')](),controller[_0x2651('0x12')]);router[_0x2651('0x8')](_0x2651('0x13'),auth[_0x2651('0xb')](),controller['getAgents']);router[_0x2651('0x14')]('/',auth['isAuthenticated'](),controller[_0x2651('0x15')]);router[_0x2651('0x14')](_0x2651('0x16'),auth[_0x2651('0xb')](),controller[_0x2651('0x17')]);router[_0x2651('0x14')](_0x2651('0x18'),auth['isAuthenticated'](),controller[_0x2651('0x19')]);router[_0x2651('0x14')]('/:id/notify',controller[_0x2651('0x1a')]);router['post'](_0x2651('0xf'),auth[_0x2651('0xb')](),controller[_0x2651('0x1b')]);router['post'](_0x2651('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0x2651('0x14')](_0x2651('0x1c'),auth[_0x2651('0xb')](),controller[_0x2651('0x1d')]);router['put'](_0x2651('0x1e'),auth['isAuthenticated'](),controller['update']);router[_0x2651('0x1f')](_0x2651('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0x2651('0x1f')](_0x2651('0x16'),auth[_0x2651('0xb')](),controller[_0x2651('0x20')]);router['delete'](_0x2651('0x18'),auth[_0x2651('0xb')](),controller[_0x2651('0x21')]);router[_0x2651('0x1f')]('/:id/users',auth[_0x2651('0xb')](),controller[_0x2651('0x22')]);module[_0x2651('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 61876fc..ef5ad87 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 _0x6c9e=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','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'];(function(_0x204fee,_0x5605a4){var _0x36a7ce=function(_0x4eb5b4){while(--_0x4eb5b4){_0x204fee['push'](_0x204fee['shift']());}};_0x36a7ce(++_0x5605a4);}(_0x6c9e,0xd6));var _0xe6c9=function(_0x331f62,_0x5a2bc2){_0x331f62=_0x331f62-0x0;var _0x5872a5=_0x6c9e[_0x331f62];return _0x5872a5;};'use strict';var Sequelize=require(_0xe6c9('0x0'));var rs=require(_0xe6c9('0x1'));module[_0xe6c9('0x2')]={'name':{'type':Sequelize[_0xe6c9('0x3')],'unique':_0xe6c9('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe6c9('0x3')]},'token':{'type':Sequelize[_0xe6c9('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe6c9('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe6c9('0x5')],'defaultValue':function(){return _0xe6c9('0x6');}},'notificationSound':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe6c9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe6c9('0x3')]},'queueTransfer':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe6c9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe6c9('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe6c9('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe6c9('0x7')],'defaultValue':![],'comment':_0xe6c9('0xa'),'set':function(_0x5512aa){if(!_0x5512aa)this[_0xe6c9('0xb')](_0xe6c9('0xc'),null);this[_0xe6c9('0xb')](_0xe6c9('0xd'),_0x5512aa);}}}; \ No newline at end of file +var _0x9823=['STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x5f47a2,_0x4bc6c2){var _0x16e874=function(_0x504b05){while(--_0x504b05){_0x5f47a2['push'](_0x5f47a2['shift']());}};_0x16e874(++_0x4bc6c2);}(_0x9823,0x8c));var _0x3982=function(_0x520a3f,_0x57eba7){_0x520a3f=_0x520a3f-0x0;var _0x189b9e=_0x9823[_0x520a3f];return _0x189b9e;};'use strict';var Sequelize=require(_0x3982('0x0'));var rs=require(_0x3982('0x1'));module[_0x3982('0x2')]={'name':{'type':Sequelize[_0x3982('0x3')],'unique':_0x3982('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x3982('0x3')]},'token':{'type':Sequelize[_0x3982('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3982('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3982('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3982('0x5')],'defaultValue':function(){return _0x3982('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3982('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3982('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3982('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3982('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3982('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3982('0x9'),'set':function(_0xbdb813){if(!_0xbdb813)this[_0x3982('0xa')](_0x3982('0xb'),null);this[_0x3982('0xa')](_0x3982('0xc'),_0xbdb813);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a7e0af9..ac61c87 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 _0x46ed=['../../config/environment','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','order','sort','filters','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','Contacts','defaults','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','ListId','out','Messages','spread','dataValues','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'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x46ed,0x168));var _0xd46e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46ed[_0x36ed48];return _0x51c63a;};'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'];config['redis']=_['defaults'](config[_0xd46e('0x1a')],{'host':_0xd46e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd46e('0x1c'))[_0xd46e('0x1d')](socket);var jayson=require(_0xd46e('0x1e'));var client=jayson[_0xd46e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xd46e('0x1f')][_0xd46e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x417402,_0x3d72ce,_0x36a317,_0x47fa8f){return new BPromise(function(_0x1d50a5,_0x305ff1){var _0x3583a5=_0x47fa8f||client;return _0x3583a5['request'](_0x417402,_0x36a317)['then'](function(_0x2e8f6d){logger[_0xd46e('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d72ce,'request\x20sent');logger[_0xd46e('0x22')](_0xd46e('0x23'),_0x3d72ce,_0xd46e('0x24'),JSON[_0xd46e('0x25')](_0x2e8f6d));if(_0x2e8f6d[_0xd46e('0x26')]){if(_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x27')]===0x1f4){logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);return _0x305ff1(_0x2e8f6d['error'][_0xd46e('0x29')]);}logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);return _0x1d50a5(_0x2e8f6d[_0xd46e('0x26')][_0xd46e('0x29')]);}else{logger[_0xd46e('0x21')](_0xd46e('0x28'),_0x3d72ce,'request\x20sent');_0x1d50a5(_0x2e8f6d[_0xd46e('0x2a')]['message']);}})['catch'](function(_0x371054){logger[_0xd46e('0x26')](_0xd46e('0x28'),_0x3d72ce,_0x371054);_0x305ff1(_0x371054);});});}function respondWithStatusCode(_0x42afc7,_0x247b9f){_0x247b9f=_0x247b9f||0xcc;return function(_0x180851){if(_0x180851){return _0x42afc7[_0xd46e('0x2b')](_0x247b9f);}return _0x42afc7['status'](_0x247b9f)[_0xd46e('0x2c')]();};}function respondWithResult(_0x3c301a,_0xddbce9){_0xddbce9=_0xddbce9||0xc8;return function(_0x17db79){if(_0x17db79){return _0x3c301a[_0xd46e('0x2d')](_0xddbce9)[_0xd46e('0x2e')](_0x17db79);}};}function respondWithFilteredResult(_0x58aeef,_0x465d54){return function(_0x3a1ced){if(_0x3a1ced){var _0x2d1afe=_0x3a1ced[_0xd46e('0x2f')],_0xa716ce=_0x465d54[_0xd46e('0x30')],_0x106edc=_0x465d54[_0xd46e('0x30')]+_0x465d54[_0xd46e('0x31')],_0x423ea3;if(_0x106edc>=_0x2d1afe){_0x106edc=_0x2d1afe;_0x423ea3=0xc8;}else{_0x423ea3=0xce;}_0x58aeef[_0xd46e('0x2d')](_0x423ea3);return _0x58aeef[_0xd46e('0x32')](_0xd46e('0x33'),_0xa716ce+'-'+_0x106edc+'/'+_0x2d1afe)['json'](_0x3a1ced);}return null;};}function patchUpdates(_0x1248ce){return function(_0x1fc7f0){try{jsonpatch[_0xd46e('0x34')](_0x1fc7f0,_0x1248ce,!![]);}catch(_0x3f01a7){return BPromise['reject'](_0x3f01a7);}return _0x1fc7f0[_0xd46e('0x35')]();};}function saveUpdates(_0x3e2eca,_0x5ab9df){return function(_0x4e7246){if(_0x4e7246){return _0x4e7246[_0xd46e('0x36')](_0x3e2eca)['then'](function(_0x306458){return _0x306458;});}return null;};}function removeEntity(_0x1c15c9,_0x1016e2){return function(_0x4b5e50){if(_0x4b5e50){return _0x4b5e50['destroy']()[_0xd46e('0x37')](function(){var _0x19e116=_0x4b5e50[_0xd46e('0x38')]({'plain':!![]});var _0x1072d6=_0xd46e('0x39');return db[_0xd46e('0x3a')][_0xd46e('0x3b')]({'where':{'type':_0x1072d6,'resourceId':_0x19e116['id']}})[_0xd46e('0x37')](function(){return _0x4b5e50;});})['then'](function(){_0x1c15c9[_0xd46e('0x2d')](0xcc)[_0xd46e('0x2c')]();});}};}function handleEntityNotFound(_0x15e35c,_0x83aec1){return function(_0x1fa66c){if(!_0x1fa66c){_0x15e35c[_0xd46e('0x2b')](0x194);}return _0x1fa66c;};}function handleError(_0x42ddde,_0x5158e6){_0x5158e6=_0x5158e6||0x1f4;return function(_0x163dd0){logger[_0xd46e('0x26')](_0x163dd0['stack']);if(_0x163dd0[_0xd46e('0x3c')]){delete _0x163dd0[_0xd46e('0x3c')];}_0x42ddde[_0xd46e('0x2d')](_0x5158e6)[_0xd46e('0x3d')](_0x163dd0);};}exports['index']=function(_0x3ab607,_0x3ecf34){var _0x217fab={'include':[{'model':db[_0xd46e('0x3e')],'as':_0xd46e('0x3f')}]},_0x42dbaf={},_0xefe5f4={'count':0x0,'rows':[]};var _0x411318=_['map'](db[_0xd46e('0x40')][_0xd46e('0x41')],function(_0xc83ea1){return{'name':_0xc83ea1[_0xd46e('0x42')],'type':_0xc83ea1[_0xd46e('0x43')]['key']};});_0x42dbaf[_0xd46e('0x44')]=_['map'](_0x411318,'name');_0x42dbaf['query']=_['keys'](_0x3ab607[_0xd46e('0x45')]);_0x42dbaf['filters']=_[_0xd46e('0x46')](_0x42dbaf[_0xd46e('0x44')],_0x42dbaf['query']);_0x217fab[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0x42dbaf[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x3ab607[_0xd46e('0x45')][_0xd46e('0x48')]));_0x217fab[_0xd46e('0x47')]=_0x217fab[_0xd46e('0x47')][_0xd46e('0x49')]?_0x217fab[_0xd46e('0x47')]:_0x42dbaf[_0xd46e('0x44')];if(!_0x3ab607['query']['hasOwnProperty']('nolimit')){_0x217fab[_0xd46e('0x31')]=qs['limit'](_0x3ab607[_0xd46e('0x45')][_0xd46e('0x31')]);_0x217fab[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x3ab607[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x217fab[_0xd46e('0x4a')]=qs[_0xd46e('0x4b')](_0x3ab607['query'][_0xd46e('0x4b')]);_0x217fab['where']=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x3ab607[_0xd46e('0x45')],_0x42dbaf[_0xd46e('0x4c')]),_0x411318);if(_0x3ab607[_0xd46e('0x45')]['filter']){_0x217fab[_0xd46e('0x4e')]=_[_0xd46e('0x4f')](_0x217fab[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x411318,function(_0x2f1278){if(_0x2f1278['type']!==_0xd46e('0x51')){var _0x369001={};_0x369001[_0x2f1278[_0xd46e('0x3c')]]={'$like':'%'+_0x3ab607[_0xd46e('0x45')][_0xd46e('0x52')]+'%'};return _0x369001;}})});}_0x217fab=_['merge']({},_0x217fab,_0x3ab607[_0xd46e('0x53')]);var _0x3ea9e6={'where':_0x217fab[_0xd46e('0x4e')]};return db[_0xd46e('0x40')][_0xd46e('0x2f')](_0x3ea9e6)[_0xd46e('0x37')](function(_0x433204){_0xefe5f4[_0xd46e('0x2f')]=_0x433204;if(_0x3ab607['query'][_0xd46e('0x54')]){_0x217fab[_0xd46e('0x55')]=[{'all':!![]}];}return db[_0xd46e('0x40')][_0xd46e('0x56')](_0x217fab);})[_0xd46e('0x37')](function(_0x4e84c8){_0xefe5f4['rows']=_0x4e84c8;return _0xefe5f4;})[_0xd46e('0x37')](respondWithFilteredResult(_0x3ecf34,_0x217fab))[_0xd46e('0x57')](handleError(_0x3ecf34,null));};exports[_0xd46e('0x58')]=function(_0x5ca18b,_0x479711){var _0x2ab5d8={'raw':![],'where':{'id':_0x5ca18b['params']['id']},'include':[{'model':db[_0xd46e('0x3e')],'as':_0xd46e('0x3f')}]},_0x9d8638={};_0x9d8638[_0xd46e('0x44')]=_[_0xd46e('0x59')](db[_0xd46e('0x40')][_0xd46e('0x41')]);_0x9d8638[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x5ca18b['query']);_0x9d8638[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0x9d8638[_0xd46e('0x44')],_0x9d8638[_0xd46e('0x45')]);_0x2ab5d8['attributes']=_['intersection'](_0x9d8638[_0xd46e('0x44')],qs['fields'](_0x5ca18b[_0xd46e('0x45')][_0xd46e('0x48')]));_0x2ab5d8[_0xd46e('0x47')]=_0x2ab5d8[_0xd46e('0x47')][_0xd46e('0x49')]?_0x2ab5d8[_0xd46e('0x47')]:_0x9d8638['model'];if(_0x5ca18b[_0xd46e('0x45')][_0xd46e('0x54')]){_0x2ab5d8[_0xd46e('0x55')]=[{'all':!![]}];}_0x2ab5d8=_['merge']({},_0x2ab5d8,_0x5ca18b[_0xd46e('0x53')]);return db[_0xd46e('0x40')][_0xd46e('0x5a')](_0x2ab5d8)[_0xd46e('0x37')](handleEntityNotFound(_0x479711,null))[_0xd46e('0x37')](respondWithResult(_0x479711,null))[_0xd46e('0x57')](handleError(_0x479711,null));};exports[_0xd46e('0x5b')]=function(_0x381256,_0x3508f4){return db[_0xd46e('0x40')][_0xd46e('0x5b')](_0x381256[_0xd46e('0x5c')],{})[_0xd46e('0x37')](function(_0x402df2){var _0x47a86c=_0x381256[_0xd46e('0x5d')][_0xd46e('0x38')]({'plain':!![]});if(!_0x47a86c)throw new Error(_0xd46e('0x5e'));if(_0x47a86c[_0xd46e('0x5f')]==='user'){var _0x636f15=_0x402df2[_0xd46e('0x38')]({'plain':!![]});var _0xaf9641=_0xd46e('0x39');return db['UserProfileSection'][_0xd46e('0x5a')]({'where':{'name':_0xaf9641,'userProfileId':_0x47a86c[_0xd46e('0x60')]},'raw':!![]})['then'](function(_0x5a5832){if(_0x5a5832&&_0x5a5832[_0xd46e('0x61')]===0x0){return db[_0xd46e('0x3a')][_0xd46e('0x5b')]({'name':_0x636f15['name'],'resourceId':_0x636f15['id'],'type':_0x5a5832['name'],'sectionId':_0x5a5832['id']},{})[_0xd46e('0x37')](function(){return _0x402df2;});}else{return _0x402df2;}})[_0xd46e('0x57')](function(_0x1f310d){logger[_0xd46e('0x26')](_0xd46e('0x62'),_0x1f310d);throw _0x1f310d;});}return _0x402df2;})[_0xd46e('0x37')](respondWithResult(_0x3508f4,0xc9))[_0xd46e('0x57')](handleError(_0x3508f4,null));};exports[_0xd46e('0x36')]=function(_0x27bdfd,_0x2a172c){if(_0x27bdfd[_0xd46e('0x5c')]['id']){delete _0x27bdfd[_0xd46e('0x5c')]['id'];}return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x27bdfd[_0xd46e('0x63')]['id']},'include':[{'model':db[_0xd46e('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xd46e('0x37')](handleEntityNotFound(_0x2a172c,null))[_0xd46e('0x37')](saveUpdates(_0x27bdfd[_0xd46e('0x5c')],null))['then'](respondWithResult(_0x2a172c,null))[_0xd46e('0x57')](handleError(_0x2a172c,null));};exports[_0xd46e('0x3b')]=function(_0x4dec29,_0x37ce99){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x4dec29['params']['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x37ce99,null))[_0xd46e('0x37')](removeEntity(_0x37ce99,null))[_0xd46e('0x57')](handleError(_0x37ce99,null));};exports['describe']=function(_0xe5f8cd,_0x516e7d){return db[_0xd46e('0x40')][_0xd46e('0x64')]()[_0xd46e('0x37')](respondWithResult(_0x516e7d,null))['catch'](handleError(_0x516e7d,null));};exports[_0xd46e('0x65')]=function(_0x3edadc,_0x27a3eb,_0xbce76f){if(_0x3edadc[_0xd46e('0x5c')]['id']){delete _0x3edadc[_0xd46e('0x5c')]['id'];}return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x3edadc[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x27a3eb,null))[_0xd46e('0x37')](function(_0x1f5323){if(_0x1f5323){_0x3edadc[_0xd46e('0x5c')][_0xd46e('0x66')]=_0x1f5323['id'];return db['Disposition']['create'](_0x3edadc[_0xd46e('0x5c')]);}})[_0xd46e('0x37')](respondWithResult(_0x27a3eb,null))[_0xd46e('0x57')](handleError(_0x27a3eb,null));};exports[_0xd46e('0x67')]=function(_0x249938,_0x4e368a,_0x1ed069){var _0x9ea442={'raw':![],'where':{}};var _0xfb4073={};var _0x7fa262={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd46e('0x68')]({'where':{'id':_0x249938[_0xd46e('0x63')]['id']}})['then'](handleEntityNotFound(_0x4e368a,null))[_0xd46e('0x37')](function(_0x3e0df4){if(_0x3e0df4){_0xfb4073['model']=_[_0xd46e('0x59')](db[_0xd46e('0x69')]['rawAttributes']);_0xfb4073[_0xd46e('0x45')]=_['keys'](_0x249938[_0xd46e('0x45')]);_0xfb4073[_0xd46e('0x4c')]=_['intersection'](_0xfb4073['model'],_0xfb4073[_0xd46e('0x45')]);_0x9ea442[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0xfb4073[_0xd46e('0x44')],qs['fields'](_0x249938[_0xd46e('0x45')][_0xd46e('0x48')]));_0x9ea442['attributes']=_0x9ea442[_0xd46e('0x47')][_0xd46e('0x49')]?_0x9ea442[_0xd46e('0x47')]:_0xfb4073[_0xd46e('0x44')];if(!_0x249938[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x9ea442[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x249938['query'][_0xd46e('0x31')]);_0x9ea442[_0xd46e('0x30')]=qs['offset'](_0x249938[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x9ea442[_0xd46e('0x4a')]=qs[_0xd46e('0x4b')](_0x249938[_0xd46e('0x45')][_0xd46e('0x4b')]);_0x9ea442['where']=qs['filters'](_[_0xd46e('0x4d')](_0x249938[_0xd46e('0x45')],_0xfb4073['filters']));_0x9ea442['where']['OpenchannelAccountId']=_0x3e0df4['id'];if(_0x249938[_0xd46e('0x45')][_0xd46e('0x52')]){_0x9ea442[_0xd46e('0x4e')]=_['merge'](_0x9ea442[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x9ea442[_0xd46e('0x47')],function(_0x5186c9){var _0x4c60c0={};_0x4c60c0[_0x5186c9]={'$like':'%'+_0x249938['query']['filter']+'%'};return _0x4c60c0;})});}_0x9ea442=_[_0xd46e('0x4f')]({},_0x9ea442,_0x249938['options']);return db[_0xd46e('0x69')]['count']({'where':_0x9ea442['where']})[_0xd46e('0x37')](function(_0x4550a7){_0x7fa262[_0xd46e('0x2f')]=_0x4550a7;if(_0x249938[_0xd46e('0x45')][_0xd46e('0x54')]){_0x9ea442[_0xd46e('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x9ea442);})[_0xd46e('0x37')](function(_0x383919){_0x7fa262[_0xd46e('0x6c')]=_0x383919;return _0x7fa262;});}})[_0xd46e('0x37')](respondWithFilteredResult(_0x4e368a,_0x9ea442))['catch'](handleError(_0x4e368a,null));};exports[_0xd46e('0x6d')]=function(_0xeccb76,_0x4ca21f,_0x1309b5){return db['OpenchannelAccount'][_0xd46e('0x5a')]({'where':{'id':_0xeccb76[_0xd46e('0x63')]['id']}})['then'](handleEntityNotFound(_0x4ca21f,null))['then'](function(_0x1161f8){if(_0x1161f8){return _0x1161f8[_0xd46e('0x6d')](_0xeccb76[_0xd46e('0x45')]['ids']);}})[_0xd46e('0x37')](respondWithStatusCode(_0x4ca21f,null))[_0xd46e('0x57')](handleError(_0x4ca21f,null));};exports[_0xd46e('0x6e')]=function(_0x36edb9,_0x2da882,_0x88460a){if(_0x36edb9[_0xd46e('0x5c')]['id']){delete _0x36edb9[_0xd46e('0x5c')]['id'];}return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x36edb9[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x2da882,null))[_0xd46e('0x37')](function(_0x1b2a6d){if(_0x1b2a6d){_0x36edb9[_0xd46e('0x5c')][_0xd46e('0x66')]=_0x1b2a6d['id'];return db[_0xd46e('0x6f')][_0xd46e('0x5b')](_0x36edb9['body']);}})[_0xd46e('0x37')](respondWithResult(_0x2da882,null))['catch'](handleError(_0x2da882,null));};exports[_0xd46e('0x70')]=function(_0x22d712,_0x515ae1,_0x36fa80){var _0x21b837={'raw':![],'where':{}};var _0xf22c0c={};var _0x20730a={'count':0x0,'rows':[]};return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x22d712[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x515ae1,null))[_0xd46e('0x37')](function(_0x3fa34d){if(_0x3fa34d){_0xf22c0c[_0xd46e('0x44')]=_['keys'](db['CannedAnswer'][_0xd46e('0x41')]);_0xf22c0c[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x22d712[_0xd46e('0x45')]);_0xf22c0c[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0xf22c0c['model'],_0xf22c0c[_0xd46e('0x45')]);_0x21b837[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0xf22c0c[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x22d712[_0xd46e('0x45')]['fields']));_0x21b837[_0xd46e('0x47')]=_0x21b837[_0xd46e('0x47')]['length']?_0x21b837[_0xd46e('0x47')]:_0xf22c0c[_0xd46e('0x44')];if(!_0x22d712[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x21b837[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x22d712[_0xd46e('0x45')][_0xd46e('0x31')]);_0x21b837[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x22d712[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x21b837[_0xd46e('0x4a')]=qs['sort'](_0x22d712['query'][_0xd46e('0x4b')]);_0x21b837[_0xd46e('0x4e')]=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x22d712[_0xd46e('0x45')],_0xf22c0c[_0xd46e('0x4c')]));_0x21b837['where'][_0xd46e('0x66')]=_0x3fa34d['id'];if(_0x22d712[_0xd46e('0x45')][_0xd46e('0x52')]){_0x21b837[_0xd46e('0x4e')]=_['merge'](_0x21b837[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x21b837['attributes'],function(_0xdf967c){var _0x4b3371={};_0x4b3371[_0xdf967c]={'$like':'%'+_0x22d712['query'][_0xd46e('0x52')]+'%'};return _0x4b3371;})});}_0x21b837=_[_0xd46e('0x4f')]({},_0x21b837,_0x22d712[_0xd46e('0x53')]);return db[_0xd46e('0x6f')]['count']({'where':_0x21b837['where']})[_0xd46e('0x37')](function(_0x5e59b7){_0x20730a[_0xd46e('0x2f')]=_0x5e59b7;if(_0x22d712['query']['includeAll']){_0x21b837[_0xd46e('0x55')]=[{'all':!![]}];}return db[_0xd46e('0x6f')]['findAll'](_0x21b837);})['then'](function(_0xd15f89){_0x20730a[_0xd46e('0x6c')]=_0xd15f89;return _0x20730a;});}})[_0xd46e('0x37')](respondWithFilteredResult(_0x515ae1,_0x21b837))[_0xd46e('0x57')](handleError(_0x515ae1,null));};exports['removeAnswers']=function(_0x27faad,_0x2d9cc0,_0x57252b){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x27faad[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x2d9cc0,null))[_0xd46e('0x37')](function(_0x2c4a1d){if(_0x2c4a1d){return _0x2c4a1d['removeAnswers'](_0x27faad[_0xd46e('0x45')][_0xd46e('0x71')]);}})['then'](respondWithStatusCode(_0x2d9cc0,null))['catch'](handleError(_0x2d9cc0,null));};exports[_0xd46e('0x72')]=function(_0x1810fd,_0x5212d6,_0x5e637d){var _0x18c939={'body':_0x1810fd[_0xd46e('0x5c')],'channel':'openchannel'};var _0x38ce73=[];var _0x3f37e6=[];var _0x19e218={};var _0x3c9521=![];return db[_0xd46e('0x73')][_0xd46e('0x64')]()['then'](function(_0xb80fbf){if(!_0xb80fbf){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x76'));}_0x38ce73=_[_0xd46e('0x77')](_[_0xd46e('0x59')](_0xb80fbf),[_0xd46e('0x78'),_0xd46e('0x79')]);_0x3f37e6=_[_0xd46e('0x77')](_[_0xd46e('0x59')](_0xb80fbf),[_0xd46e('0x78'),'updatedAt',_0xd46e('0x7a'),'ListId']);if(_0x1810fd['body']['id']){delete _0x1810fd[_0xd46e('0x5c')]['id'];}if(_[_0xd46e('0x7b')](_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7c')])){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x7d'));}if(_[_0xd46e('0x7b')](_0x1810fd['body'][_0xd46e('0x5c')])||_0x1810fd['body'][_0xd46e('0x5c')]===''){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x7e'));}if(_[_0xd46e('0x7b')](_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7f')])){throw new db[(_0xd46e('0x74'))]['ValidationError'](_0xd46e('0x80')+_0x3f37e6);}if(!_[_0xd46e('0x81')](_0x3f37e6,_0x1810fd[_0xd46e('0x5c')]['mapKey'])){throw new db[(_0xd46e('0x74'))][(_0xd46e('0x75'))](_0xd46e('0x82')+_0x3f37e6);}_0x19e218[_0x1810fd['body'][_0xd46e('0x7f')]]=_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7c')];})[_0xd46e('0x37')](function(){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x1810fd['params']['id']},'include':[{'model':db['CmList'],'as':_0xd46e('0x83'),'include':[{'model':db[_0xd46e('0x73')],'as':'Contacts','where':_0x19e218,'limit':0x1,'order':[[_0xd46e('0x79'),_0xd46e('0x84')]]}]},{'model':db[_0xd46e('0x85')],'as':_0xd46e('0x86')}]});})[_0xd46e('0x37')](handleEntityNotFound(_0x5212d6,null))[_0xd46e('0x37')](function(_0x4bb76b){if(_0x4bb76b&&_0x4bb76b['List']){_0x18c939[_0xd46e('0x87')]=_0x4bb76b;_0x18c939['applications']=_0x4bb76b[_0xd46e('0x86')];_0x18c939[_0xd46e('0x88')]=_0x4bb76b['List'];_0x18c939[_0xd46e('0x89')]=_[_0xd46e('0x8a')](_0x18c939[_0xd46e('0x89')],[_0xd46e('0x8b')],[_0xd46e('0x8c')]);if(_0x18c939['account'][_0xd46e('0x86')]){delete _0x18c939[_0xd46e('0x87')][_0xd46e('0x86')];}if(_0x18c939[_0xd46e('0x87')][_0xd46e('0x83')]&&_0x18c939[_0xd46e('0x87')][_0xd46e('0x83')][_0xd46e('0x8d')][_0xd46e('0x49')]){return _0x18c939[_0xd46e('0x87')][_0xd46e('0x83')][_0xd46e('0x8d')][0x0];}var _0x3b9664=_[_0xd46e('0x8e')](_0x1810fd['body'],{'firstName':_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7c')],'ListId':_0x4bb76b['ListId']});_0x3b9664[_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x7f')]]=_0x1810fd[_0xd46e('0x5c')]['from'];return db[_0xd46e('0x73')][_0xd46e('0x5b')](_0x3b9664,{'fields':_0x38ce73,'raw':!![]});}})[_0xd46e('0x37')](handleEntityNotFound(_0x5212d6,null))[_0xd46e('0x37')](function(_0x5031cf){_0x18c939[_0xd46e('0x8f')]=_0x5031cf;if(_0x5031cf){var _0x16aaf9={'ContactId':_0x5031cf['id'],'OpenchannelAccountId':_0x1810fd[_0xd46e('0x63')]['id'],'from':(_0x5031cf['firstName']||'')+'\x20'+(_0x5031cf['lastName']||'')};var _0x30efe6={'OpenchannelAccountId':_0x1810fd[_0xd46e('0x63')]['id'],'closed':![]};if(_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x90')]){_0x30efe6[_0xd46e('0x90')]=_0x1810fd[_0xd46e('0x5c')]['threadId'];return db[_0xd46e('0x91')]['find']({'where':_0x30efe6})[_0xd46e('0x37')](function(_0x49c2ba){if(_0x49c2ba){return[_0x49c2ba,![]];}_0x16aaf9[_0xd46e('0x90')]=_0x1810fd['body']['threadId'];_0x16aaf9[_0xd46e('0x92')]=_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x92')];return db[_0xd46e('0x91')][_0xd46e('0x5b')](_0x16aaf9)[_0xd46e('0x37')](function(_0x417068){return[_0x417068,!![]];});});}else{_0x30efe6['threadId']=null;}_0x30efe6[_0xd46e('0x93')]=_0x5031cf['id'];return db[_0xd46e('0x91')][_0xd46e('0x5a')]({'where':_0x30efe6})[_0xd46e('0x37')](function(_0x333f7c){if(_0x333f7c){return[_0x333f7c,![]];}return db['OpenchannelInteraction'][_0xd46e('0x5b')](_0x16aaf9)[_0xd46e('0x37')](function(_0x1d08bb){return[_0x1d08bb,!![]];});});}})['spread'](function(_0x187581,_0x8c6ed1){if(_0x187581){_0x3c9521=_0x8c6ed1;if(!_0x8c6ed1){var _0x5eed72={'from':(_0x18c939['contact']['firstName']||'')+'\x20'+(_0x18c939[_0xd46e('0x8f')][_0xd46e('0x94')]||'')};if(_0x1810fd['body'][_0xd46e('0x90')]&&_0x1810fd[_0xd46e('0x5c')]['messageId']&&_0x1810fd['body'][_0xd46e('0x90')]!=_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x95')]){_0x5eed72[_0xd46e('0x90')]=_0x1810fd['body']['messageId'];}return _0x187581[_0xd46e('0x36')](_0x5eed72);}else{return _0x187581;}}})[_0xd46e('0x37')](function(_0x363f1d){_0x18c939[_0xd46e('0x96')]=_0x363f1d[_0xd46e('0x38')]({'plain':!![]});_0x18c939[_0xd46e('0x96')][_0xd46e('0x97')]=_0x3c9521;if(_0x18c939['interaction'][_0xd46e('0x97')]){if(_0x18c939[_0xd46e('0x87')]['autoclose']){_0x18c939[_0xd46e('0x89')][_0xd46e('0x98')]({'id':0x0,'priority':_0x18c939[_0xd46e('0x89')][_0xd46e('0x49')]+0x1,'app':_0xd46e('0x99'),'appdata':_0xd46e('0x9a'),'interval':_0xd46e('0x9b')});}}return db[_0xd46e('0x9c')]['create']({'body':_0x1810fd[_0xd46e('0x5c')][_0xd46e('0x5c')],'OpenchannelAccountId':_0x1810fd[_0xd46e('0x63')]['id'],'OpenchannelInteractionId':_0x363f1d['id'],'direction':'in','ContactId':_0x18c939[_0xd46e('0x8f')]['id'],'AttachmentId':_0x1810fd[_0xd46e('0x5c')]['AttachmentId']});})[_0xd46e('0x37')](function(_0x40151d){_0x18c939[_0xd46e('0x29')]=_0x40151d;if(_0x18c939[_0xd46e('0x96')][_0xd46e('0x9d')]){return db[_0xd46e('0x9e')][_0xd46e('0x5a')]({'attributes':['id',_0xd46e('0x3c')],'where':{'id':_0x18c939[_0xd46e('0x96')]['UserId']}})[_0xd46e('0x37')](function(_0x1dbb04){if(_0x1dbb04){_0x18c939[_0xd46e('0x89')][_0xd46e('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1dbb04['name']+','+(_0x18c939[_0xd46e('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0xd46e('0x9b')});_0x18c939[_0xd46e('0xa0')]=![];}return respondWithRpcPromise(_0xd46e('0xa1'),_0xd46e('0xa2'),_0x18c939);});}return respondWithRpcPromise('Start',_0xd46e('0xa2'),_0x18c939);})[_0xd46e('0x37')](function(_0xa20e92){respondWithRpcPromise(_0xd46e('0xa3'),_0xd46e('0xa3'),{'event':_0xd46e('0x72'),'message':_0xa20e92},client9002);return _0xa20e92;})[_0xd46e('0x37')](respondWithResult(_0x5212d6,null))[_0xd46e('0x57')](handleError(_0x5212d6,null));};exports[_0xd46e('0xa4')]=function(_0x4e1665,_0x52106d,_0x595040){return db['OpenchannelAccount'][_0xd46e('0x68')]({'where':{'id':_0x4e1665[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x52106d,null))['then'](function(_0x341946){if(_0x341946){return db[_0xd46e('0xa5')][_0xd46e('0xa6')](function(_0x48f49d){return db['OpenchannelApplication'][_0xd46e('0x3b')]({'where':{'OpenchannelAccountId':_0x4e1665[_0xd46e('0x63')]['id']},'transaction':_0x48f49d})[_0xd46e('0x37')](function(_0x2fbfd7){var _0xf68c7f=_['map'](_0x4e1665[_0xd46e('0x5c')],function(_0x3d0915){_0x3d0915[_0xd46e('0x66')]=_0x4e1665[_0xd46e('0x63')]['id'];return _0x3d0915;});return db[_0xd46e('0x85')]['bulkCreate'](_0xf68c7f,{'transaction':_0x48f49d});});})[_0xd46e('0x37')](function(){return db[_0xd46e('0x85')][_0xd46e('0xa7')]({'where':{'OpenchannelAccountId':_0x4e1665[_0xd46e('0x63')]['id']},'order':'priority'});});}})[_0xd46e('0x37')](respondWithResult(_0x52106d,null))[_0xd46e('0x57')](handleError(_0x52106d,null));};exports[_0xd46e('0xa8')]=function(_0x813a81,_0x464169,_0xdd713c){var _0x1144ba={};var _0x2ab895={};var _0x25fa78;var _0x2410c5;return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x813a81[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x464169,null))['then'](function(_0x5ca720){if(_0x5ca720){_0x25fa78=_0x5ca720;_0x2ab895['model']=_[_0xd46e('0x59')](db['OpenchannelApplication'][_0xd46e('0x41')]);_0x2ab895[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x813a81[_0xd46e('0x45')]);_0x2ab895[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0x2ab895[_0xd46e('0x44')],_0x2ab895[_0xd46e('0x45')]);_0x1144ba['attributes']=_[_0xd46e('0x46')](_0x2ab895[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x813a81['query']['fields']));_0x1144ba[_0xd46e('0x47')]=_0x1144ba[_0xd46e('0x47')][_0xd46e('0x49')]?_0x1144ba[_0xd46e('0x47')]:_0x2ab895[_0xd46e('0x44')];_0x1144ba[_0xd46e('0x4a')]=qs['sort'](_0x813a81[_0xd46e('0x45')][_0xd46e('0x4b')]);_0x1144ba[_0xd46e('0x4e')]=qs['filters'](_[_0xd46e('0x4d')](_0x813a81[_0xd46e('0x45')],_0x2ab895['filters']));if(_0x813a81[_0xd46e('0x45')]['filter']){_0x1144ba[_0xd46e('0x4e')]=_[_0xd46e('0x4f')](_0x1144ba[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x1144ba[_0xd46e('0x47')],function(_0xed0763){var _0x53baf2={};_0x53baf2[_0xed0763]={'$like':'%'+_0x813a81['query']['filter']+'%'};return _0x53baf2;})});}_0x1144ba=_[_0xd46e('0x4f')]({},_0x1144ba,_0x813a81[_0xd46e('0x53')]);return _0x25fa78[_0xd46e('0xa8')](_0x1144ba);}})[_0xd46e('0x37')](function(_0x47c610){if(_0x47c610){_0x2410c5=_0x47c610[_0xd46e('0x49')];if(!_0x813a81[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x1144ba[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x813a81[_0xd46e('0x45')][_0xd46e('0x31')]);_0x1144ba[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x813a81['query'][_0xd46e('0x30')]);}return _0x25fa78[_0xd46e('0xa8')](_0x1144ba);}})[_0xd46e('0x37')](function(_0x5e653e){if(_0x5e653e){return _0x5e653e?{'count':_0x2410c5,'rows':_0x5e653e}:null;}})[_0xd46e('0x37')](respondWithResult(_0x464169,null))[_0xd46e('0x57')](handleError(_0x464169,null));};exports[_0xd46e('0xa9')]=function(_0x22046d,_0x399cb9,_0xb72e54){var _0x5ecc44={'raw':![],'where':{}};var _0x47d186={};var _0xeb90f6={'count':0x0,'rows':[]};return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x22046d[_0xd46e('0x63')]['id']}})['then'](handleEntityNotFound(_0x399cb9,null))[_0xd46e('0x37')](function(_0xe30f8e){if(_0xe30f8e){_0x47d186[_0xd46e('0x44')]=_[_0xd46e('0x59')](db[_0xd46e('0x91')][_0xd46e('0x41')]);_0x47d186[_0xd46e('0x45')]=_['keys'](_0x22046d['query']);_0x47d186['filters']=_[_0xd46e('0x46')](_0x47d186['model'],_0x47d186['query']);_0x5ecc44[_0xd46e('0x47')]=_[_0xd46e('0x46')](_0x47d186['model'],qs[_0xd46e('0x48')](_0x22046d[_0xd46e('0x45')]['fields']));_0x5ecc44[_0xd46e('0x47')]=_0x5ecc44['attributes'][_0xd46e('0x49')]?_0x5ecc44[_0xd46e('0x47')]:_0x47d186[_0xd46e('0x44')];if(!_0x22046d['query'][_0xd46e('0x6a')]('nolimit')){_0x5ecc44[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x22046d[_0xd46e('0x45')][_0xd46e('0x31')]);_0x5ecc44[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x22046d[_0xd46e('0x45')][_0xd46e('0x30')]);}_0x5ecc44['order']=qs['sort'](_0x22046d['query'][_0xd46e('0x4b')]);_0x5ecc44['where']=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x22046d[_0xd46e('0x45')],_0x47d186[_0xd46e('0x4c')]));_0x5ecc44[_0xd46e('0x4e')][_0xd46e('0x66')]=_0xe30f8e['id'];if(_0x22046d[_0xd46e('0x45')][_0xd46e('0x52')]){_0x5ecc44[_0xd46e('0x4e')]=_['merge'](_0x5ecc44[_0xd46e('0x4e')],{'$or':_[_0xd46e('0x50')](_0x5ecc44[_0xd46e('0x47')],function(_0x29a2dd){var _0x1767c1={};_0x1767c1[_0x29a2dd]={'$like':'%'+_0x22046d[_0xd46e('0x45')][_0xd46e('0x52')]+'%'};return _0x1767c1;})});}_0x5ecc44=_['merge']({},_0x5ecc44,_0x22046d[_0xd46e('0x53')]);return db[_0xd46e('0x91')][_0xd46e('0x2f')]({'where':_0x5ecc44[_0xd46e('0x4e')]})[_0xd46e('0x37')](function(_0x3a0161){_0xeb90f6['count']=_0x3a0161;if(_0x22046d[_0xd46e('0x45')]['includeAll']){_0x5ecc44[_0xd46e('0x55')]=[{'model':db[_0xd46e('0x73')],'as':_0xd46e('0xaa'),'required':![]},{'model':db[_0xd46e('0x9e')],'as':_0xd46e('0xab'),'attributes':[_0xd46e('0x3c'),_0xd46e('0xac'),_0xd46e('0xad')],'required':![]},{'model':db[_0xd46e('0xae')],'as':_0xd46e('0xaf'),'attributes':['id',_0xd46e('0x3c'),_0xd46e('0xb0')],'where':_0x22046d[_0xd46e('0x45')]['tag']?{'id':_0x22046d['query'][_0xd46e('0xb1')]}:undefined,'required':_0x22046d['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xd46e('0x56')](_0x5ecc44);})[_0xd46e('0x37')](function(_0x208a22){_0xeb90f6[_0xd46e('0x6c')]=_0x208a22;return _0xeb90f6;});}})[_0xd46e('0x37')](respondWithFilteredResult(_0x399cb9,_0x5ecc44))[_0xd46e('0x57')](handleError(_0x399cb9,null));};exports[_0xd46e('0xb2')]=function(_0x3e81c4,_0x31333c,_0x8126f0){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0x3e81c4['params']['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x31333c,null))[_0xd46e('0x37')](function(_0x5d5f72){if(_0x5d5f72){return _0x5d5f72['addAgents'](_0x3e81c4[_0xd46e('0x5c')]['ids'],_[_0xd46e('0xb3')](_0x3e81c4[_0xd46e('0x5c')],['ids','id'])||{})['spread'](function(_0x8215a1){for(var _0x5b8f22=0x0;_0x5b8f22<_0x3e81c4[_0xd46e('0x5c')]['ids'][_0xd46e('0x49')];_0x5b8f22+=0x1){socket[_0xd46e('0xb4')](_0xd46e('0xb5'),{'UserId':_0x3e81c4[_0xd46e('0x5c')][_0xd46e('0x71')][_0x5b8f22],'OpenchannelAccountId':_0x3e81c4[_0xd46e('0x63')]['id']});}return _0x8215a1;});}})[_0xd46e('0x37')](respondWithResult(_0x31333c,null))[_0xd46e('0x57')](handleError(_0x31333c,null));};exports[_0xd46e('0xb6')]=function(_0x195643,_0x404403,_0x456544){return db[_0xd46e('0x40')]['find']({'where':{'id':_0x195643[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x404403,null))[_0xd46e('0x37')](function(_0x3bad91){if(_0x3bad91){return _0x3bad91['removeAgents'](_0x195643[_0xd46e('0x45')][_0xd46e('0x71')])[_0xd46e('0x37')](function(){if(_[_0xd46e('0xb7')](_0x195643[_0xd46e('0x45')]['ids'])){for(var _0xab708c=0x0;_0xab708c<_0x195643[_0xd46e('0x45')][_0xd46e('0x71')][_0xd46e('0x49')];_0xab708c+=0x1){socket[_0xd46e('0xb4')](_0xd46e('0xb8'),{'UserId':Number(_0x195643[_0xd46e('0x45')][_0xd46e('0x71')][_0xab708c]),'OpenchannelAccountId':Number(_0x195643['params']['id'])});}}else{socket[_0xd46e('0xb4')](_0xd46e('0xb8'),{'UserId':Number(_0x195643[_0xd46e('0x45')][_0xd46e('0x71')]),'OpenchannelAccountId':Number(_0x195643[_0xd46e('0x63')]['id'])});}});}})[_0xd46e('0x37')](respondWithStatusCode(_0x404403,null))['catch'](handleError(_0x404403,null));};exports[_0xd46e('0xb9')]=function(_0x1de6b7,_0x19005e,_0x18bb82){var _0x567b21={};var _0x9c9f75={};var _0x10106b;var _0x1c7faa;return db[_0xd46e('0x40')][_0xd46e('0x68')]({'where':{'id':_0x1de6b7[_0xd46e('0x63')]['id']}})[_0xd46e('0x37')](handleEntityNotFound(_0x19005e,null))[_0xd46e('0x37')](function(_0x174514){if(_0x174514){_0x10106b=_0x174514;_0x9c9f75['model']=_[_0xd46e('0x59')](db[_0xd46e('0x9e')][_0xd46e('0x41')]);_0x9c9f75[_0xd46e('0x45')]=_[_0xd46e('0x59')](_0x1de6b7[_0xd46e('0x45')]);_0x9c9f75[_0xd46e('0x4c')]=_[_0xd46e('0x46')](_0x9c9f75[_0xd46e('0x44')],_0x9c9f75[_0xd46e('0x45')]);_0x567b21['attributes']=_[_0xd46e('0x46')](_0x9c9f75[_0xd46e('0x44')],qs[_0xd46e('0x48')](_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x48')]));_0x567b21[_0xd46e('0x47')]=_0x567b21[_0xd46e('0x47')][_0xd46e('0x49')]?_0x567b21['attributes']:_0x9c9f75['model'];_0x567b21[_0xd46e('0x4a')]=qs[_0xd46e('0x4b')](_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x4b')]);_0x567b21[_0xd46e('0x4e')]=qs[_0xd46e('0x4c')](_[_0xd46e('0x4d')](_0x1de6b7[_0xd46e('0x45')],_0x9c9f75[_0xd46e('0x4c')]));if(_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x52')]){_0x567b21['where']=_[_0xd46e('0x4f')](_0x567b21['where'],{'$or':_[_0xd46e('0x50')](_0x567b21[_0xd46e('0x47')],function(_0x1caa70){var _0x3f015f={};_0x3f015f[_0x1caa70]={'$like':'%'+_0x1de6b7['query'][_0xd46e('0x52')]+'%'};return _0x3f015f;})});}_0x567b21=_[_0xd46e('0x4f')]({},_0x567b21,_0x1de6b7[_0xd46e('0x53')]);return _0x10106b[_0xd46e('0xb9')](_0x567b21);}})[_0xd46e('0x37')](function(_0x1076b2){if(_0x1076b2){_0x1c7faa=_0x1076b2[_0xd46e('0x49')];if(!_0x1de6b7[_0xd46e('0x45')][_0xd46e('0x6a')](_0xd46e('0x6b'))){_0x567b21[_0xd46e('0x31')]=qs[_0xd46e('0x31')](_0x1de6b7['query'][_0xd46e('0x31')]);_0x567b21[_0xd46e('0x30')]=qs[_0xd46e('0x30')](_0x1de6b7['query'][_0xd46e('0x30')]);}return _0x10106b[_0xd46e('0xb9')](_0x567b21);}})[_0xd46e('0x37')](function(_0x3778df){if(_0x3778df){return _0x3778df?{'count':_0x1c7faa,'rows':_0x3778df}:null;}})[_0xd46e('0x37')](respondWithResult(_0x19005e,null))['catch'](handleError(_0x19005e,null));};exports['send']=function(_0x2587ff,_0x320747,_0x7c7b62){var _0x59b38b,_0x1c681b,_0x3d37f4;if(_[_0xd46e('0x7b')](_0x2587ff[_0xd46e('0x5c')]['body'])||_0x2587ff[_0xd46e('0x5c')]['body']===''){throw new db['Sequelize'][(_0xd46e('0x75'))](_0xd46e('0x7e'));}if(_['isNil'](_0x2587ff[_0xd46e('0x5c')]['to'])){}_0x59b38b=_0x2587ff[_0xd46e('0x5c')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2587ff['params']['id']}})['then'](handleEntityNotFound(_0x320747,null))[_0xd46e('0x37')](function(_0xf12bb){if(_0xf12bb){return db[_0xd46e('0x40')][_0xd46e('0x5a')]({'where':{'id':_0xf12bb['id']},'include':[{'model':db[_0xd46e('0xba')],'as':_0xd46e('0x83'),'include':[{'model':db['CmContact'],'as':_0xd46e('0x8d'),'where':{[_0xf12bb[_0xd46e('0x7f')]]:_0x59b38b},'limit':0x1,'order':[[_0xd46e('0x79'),_0xd46e('0x84')]]}]}]})[_0xd46e('0x37')](handleEntityNotFound(_0x320747,null))['then'](function(_0x1f74cf){if(_0x1f74cf&&_0x1f74cf[_0xd46e('0x83')]){_0x1c681b=_0x1f74cf[_0xd46e('0x38')]({'plain':!![]});if(_0x1c681b['List']&&_0x1c681b[_0xd46e('0x83')][_0xd46e('0x8d')][_0xd46e('0x49')]){return _0x1c681b[_0xd46e('0x83')]['Contacts'][0x0];}return db[_0xd46e('0x73')][_0xd46e('0x5b')](_['defaults'](_0x2587ff[_0xd46e('0x5c')],{'firstName':_0x59b38b,[_0x1f74cf[_0xd46e('0x7f')]]:_0x59b38b,'phone':_0x59b38b,'ListId':_0x1c681b[_0xd46e('0xbb')]}));}})[_0xd46e('0x37')](handleEntityNotFound(_0x320747,null))[_0xd46e('0x37')](function(_0x459a76){if(_0x459a76){_0x3d37f4=_0x459a76;return db[_0xd46e('0x91')][_0xd46e('0x5a')]({'where':{'ContactId':_0x3d37f4['id'],'closed':![],'OpenchannelAccountId':_0x1c681b['id']}})[_0xd46e('0x37')](function(_0x14cf23){if(_0x14cf23){return[_0x14cf23,![]];}return db[_0xd46e('0x91')][_0xd46e('0x5b')]({'UserId':_0x2587ff[_0xd46e('0x5d')]['id'],'ContactId':_0x3d37f4['id'],'OpenchannelAccountId':_0x1c681b['id'],'lastMsgDirection':_0xd46e('0xbc'),'Messages':[_['merge'](_0x2587ff[_0xd46e('0x5c')],{'read':![],'body':_0x2587ff[_0xd46e('0x5c')][_0xd46e('0x5c')],'OpenchannelAccountId':_0x1c681b['id'],'UserId':_0x2587ff[_0xd46e('0x5d')]['id'],'ContactId':_0x3d37f4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xd46e('0xbd')}]})['then'](function(_0x3a0407){return[_0x3a0407,!![]];});});}})[_0xd46e('0xbe')](function(_0x127583,_0x50b8d4){if(_0x50b8d4){return _0x127583;}return db['OpenchannelMessage'][_0xd46e('0x5b')](_[_0xd46e('0x4f')](_0x2587ff[_0xd46e('0x5c')],{'read':![],'body':_0x2587ff['body']['body'],'OpenchannelAccountId':_0x1c681b['id'],'OpenchannelInteractionId':_0x127583['id'],'UserId':_0x2587ff['user']['id'],'ContactId':_0x3d37f4['id']}))['then'](function(_0x4ab8fd){_0x127583[_0xd46e('0xbf')][_0xd46e('0xbd')]=[];_0x127583[_0xd46e('0xbf')][_0xd46e('0xbd')][_0xd46e('0x98')](_0x4ab8fd[_0xd46e('0xbf')]);return _0x127583;});});}})[_0xd46e('0x37')](respondWithResult(_0x320747,null))[_0xd46e('0x57')](handleError(_0x320747,null));}; \ No newline at end of file +var _0x5fd1=['OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','get','OpenchannelAccounts','end','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelAccount','includeAll','findAll','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','Pause','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','isNil','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','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','findOne','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xfd3348,_0x3f3a32){var _0x2a7f1c=function(_0x3ee050){while(--_0x3ee050){_0xfd3348['push'](_0xfd3348['shift']());}};_0x2a7f1c(++_0x3f3a32);}(_0x5fd1,0x155));var _0x15fd=function(_0x250706,_0x144711){_0x250706=_0x250706-0x0;var _0x4af020=_0x5fd1[_0x250706];return _0x4af020;};'use strict';var pdf=require(_0x15fd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15fd('0x1'));var zipdir=require(_0x15fd('0x2'));var jsonpatch=require(_0x15fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x15fd('0x4'));var Mustache=require(_0x15fd('0x5'));var util=require(_0x15fd('0x6'));var path=require('path');var sox=require(_0x15fd('0x7'));var csv=require(_0x15fd('0x8'));var ejs=require(_0x15fd('0x9'));var fs=require('fs');var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x8'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];config[_0x15fd('0x16')]=_[_0x15fd('0x17')](config[_0x15fd('0x16')],{'host':_0x15fd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x15fd('0x19')](socket);var jayson=require(_0x15fd('0x1a'));var client=jayson[_0x15fd('0x1b')][_0x15fd('0x1c')]({'port':0x232c});var client9002=jayson[_0x15fd('0x1b')][_0x15fd('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c5375,_0x44a63a,_0x5aae13,_0x4c7080){return new BPromise(function(_0x25f139,_0x5ca5a2){var _0x7afe9c=_0x4c7080||client;return _0x7afe9c['request'](_0x2c5375,_0x5aae13)[_0x15fd('0x1d')](function(_0x318f47){logger[_0x15fd('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x44a63a,_0x15fd('0x1f'));logger[_0x15fd('0x20')](_0x15fd('0x21'),_0x44a63a,_0x15fd('0x1f'),JSON[_0x15fd('0x22')](_0x318f47));if(_0x318f47[_0x15fd('0x23')]){if(_0x318f47[_0x15fd('0x23')][_0x15fd('0x24')]===0x1f4){logger[_0x15fd('0x23')](_0x15fd('0x25'),_0x44a63a,_0x318f47[_0x15fd('0x23')]['message']);return _0x5ca5a2(_0x318f47['error'][_0x15fd('0x26')]);}logger[_0x15fd('0x23')](_0x15fd('0x25'),_0x44a63a,_0x318f47[_0x15fd('0x23')][_0x15fd('0x26')]);return _0x25f139(_0x318f47[_0x15fd('0x23')][_0x15fd('0x26')]);}else{logger['info'](_0x15fd('0x25'),_0x44a63a,_0x15fd('0x1f'));_0x25f139(_0x318f47[_0x15fd('0x27')]['message']);}})[_0x15fd('0x28')](function(_0x49062f){logger[_0x15fd('0x23')](_0x15fd('0x25'),_0x44a63a,_0x49062f);_0x5ca5a2(_0x49062f);});});}function respondWithStatusCode(_0x21601d,_0x4c9708){_0x4c9708=_0x4c9708||0xcc;return function(_0x16b87c){if(_0x16b87c){return _0x21601d[_0x15fd('0x29')](_0x4c9708);}return _0x21601d[_0x15fd('0x2a')](_0x4c9708)['end']();};}function respondWithResult(_0x44e8c8,_0x544685){_0x544685=_0x544685||0xc8;return function(_0x3d33cd){if(_0x3d33cd){return _0x44e8c8[_0x15fd('0x2a')](_0x544685)[_0x15fd('0x2b')](_0x3d33cd);}};}function respondWithFilteredResult(_0x27d2c4,_0x233ed3){return function(_0x6c213b){if(_0x6c213b){var _0x218034=_0x6c213b[_0x15fd('0x2c')],_0xe650a3=_0x233ed3['offset'],_0x4590a1=_0x233ed3[_0x15fd('0x2d')]+_0x233ed3[_0x15fd('0x2e')],_0x160226;if(_0x4590a1>=_0x218034){_0x4590a1=_0x218034;_0x160226=0xc8;}else{_0x160226=0xce;}_0x27d2c4['status'](_0x160226);return _0x27d2c4[_0x15fd('0x2f')](_0x15fd('0x30'),_0xe650a3+'-'+_0x4590a1+'/'+_0x218034)['json'](_0x6c213b);}return null;};}function patchUpdates(_0x42ff00){return function(_0x197d15){try{jsonpatch['apply'](_0x197d15,_0x42ff00,!![]);}catch(_0x104fbd){return BPromise[_0x15fd('0x31')](_0x104fbd);}return _0x197d15[_0x15fd('0x32')]();};}function saveUpdates(_0x476828,_0x42edc3){return function(_0x1a36d6){if(_0x1a36d6){return _0x1a36d6['update'](_0x476828)[_0x15fd('0x1d')](function(_0x7ac52b){return _0x7ac52b;});}return null;};}function removeEntity(_0x4228ea,_0x1c3d5e){return function(_0x594b8c){if(_0x594b8c){return _0x594b8c[_0x15fd('0x33')]()[_0x15fd('0x1d')](function(){var _0x11b3a1=_0x594b8c[_0x15fd('0x34')]({'plain':!![]});var _0x43b711=_0x15fd('0x35');return db['UserProfileResource'][_0x15fd('0x33')]({'where':{'type':_0x43b711,'resourceId':_0x11b3a1['id']}})[_0x15fd('0x1d')](function(){return _0x594b8c;});})['then'](function(){_0x4228ea[_0x15fd('0x2a')](0xcc)[_0x15fd('0x36')]();});}};}function handleEntityNotFound(_0xaa9244,_0x5cb227){return function(_0x25d34e){if(!_0x25d34e){_0xaa9244[_0x15fd('0x29')](0x194);}return _0x25d34e;};}function handleError(_0x1732bc,_0xbe50e7){_0xbe50e7=_0xbe50e7||0x1f4;return function(_0x163380){logger[_0x15fd('0x23')](_0x163380['stack']);if(_0x163380['name']){delete _0x163380['name'];}_0x1732bc[_0x15fd('0x2a')](_0xbe50e7)[_0x15fd('0x37')](_0x163380);};}exports[_0x15fd('0x38')]=function(_0x4e608d,_0x533585){var _0x72dd02={'include':[{'model':db['Pause'],'as':_0x15fd('0x39')}]},_0x5962f5={},_0x4f1c84={'count':0x0,'rows':[]};var _0x10702c=_[_0x15fd('0x3a')](db['OpenchannelAccount'][_0x15fd('0x3b')],function(_0x3a10e2){return{'name':_0x3a10e2[_0x15fd('0x3c')],'type':_0x3a10e2['type'][_0x15fd('0x3d')]};});_0x5962f5[_0x15fd('0x3e')]=_[_0x15fd('0x3a')](_0x10702c,_0x15fd('0x3f'));_0x5962f5[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x4e608d[_0x15fd('0x40')]);_0x5962f5[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x5962f5['model'],_0x5962f5[_0x15fd('0x40')]);_0x72dd02[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x5962f5[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x4e608d[_0x15fd('0x40')][_0x15fd('0x45')]));_0x72dd02[_0x15fd('0x44')]=_0x72dd02[_0x15fd('0x44')][_0x15fd('0x46')]?_0x72dd02[_0x15fd('0x44')]:_0x5962f5[_0x15fd('0x3e')];if(!_0x4e608d[_0x15fd('0x40')][_0x15fd('0x47')](_0x15fd('0x48'))){_0x72dd02['limit']=qs[_0x15fd('0x2e')](_0x4e608d[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x72dd02[_0x15fd('0x2d')]=qs[_0x15fd('0x2d')](_0x4e608d[_0x15fd('0x40')][_0x15fd('0x2d')]);}_0x72dd02[_0x15fd('0x49')]=qs['sort'](_0x4e608d['query'][_0x15fd('0x4a')]);_0x72dd02['where']=qs[_0x15fd('0x42')](_[_0x15fd('0x4b')](_0x4e608d['query'],_0x5962f5[_0x15fd('0x42')]),_0x10702c);if(_0x4e608d[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x72dd02[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0x72dd02[_0x15fd('0x4d')],{'$or':_['map'](_0x10702c,function(_0x2444f9){if(_0x2444f9[_0x15fd('0x4f')]!==_0x15fd('0x50')){var _0xde0faa={};_0xde0faa[_0x2444f9[_0x15fd('0x3f')]]={'$like':'%'+_0x4e608d[_0x15fd('0x40')][_0x15fd('0x4c')]+'%'};return _0xde0faa;}})});}_0x72dd02=_[_0x15fd('0x4e')]({},_0x72dd02,_0x4e608d[_0x15fd('0x51')]);var _0x1d3beb={'where':_0x72dd02[_0x15fd('0x4d')]};return db[_0x15fd('0x52')]['count'](_0x1d3beb)[_0x15fd('0x1d')](function(_0x5019ad){_0x4f1c84[_0x15fd('0x2c')]=_0x5019ad;if(_0x4e608d[_0x15fd('0x40')][_0x15fd('0x53')]){_0x72dd02['include']=[{'all':!![]}];}return db[_0x15fd('0x52')][_0x15fd('0x54')](_0x72dd02);})[_0x15fd('0x1d')](function(_0x155102){_0x4f1c84['rows']=_0x155102;return _0x4f1c84;})[_0x15fd('0x1d')](respondWithFilteredResult(_0x533585,_0x72dd02))[_0x15fd('0x28')](handleError(_0x533585,null));};exports[_0x15fd('0x55')]=function(_0x2d9018,_0x4b6827){var _0x56c6be={'raw':![],'where':{'id':_0x2d9018['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x322623={};_0x322623[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x52')][_0x15fd('0x3b')]);_0x322623[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x2d9018['query']);_0x322623[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x322623[_0x15fd('0x3e')],_0x322623['query']);_0x56c6be[_0x15fd('0x44')]=_['intersection'](_0x322623[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x2d9018[_0x15fd('0x40')][_0x15fd('0x45')]));_0x56c6be[_0x15fd('0x44')]=_0x56c6be[_0x15fd('0x44')][_0x15fd('0x46')]?_0x56c6be[_0x15fd('0x44')]:_0x322623[_0x15fd('0x3e')];if(_0x2d9018[_0x15fd('0x40')][_0x15fd('0x53')]){_0x56c6be[_0x15fd('0x56')]=[{'all':!![]}];}_0x56c6be=_[_0x15fd('0x4e')]({},_0x56c6be,_0x2d9018['options']);return db[_0x15fd('0x52')]['find'](_0x56c6be)[_0x15fd('0x1d')](handleEntityNotFound(_0x4b6827,null))['then'](respondWithResult(_0x4b6827,null))[_0x15fd('0x28')](handleError(_0x4b6827,null));};exports[_0x15fd('0x57')]=function(_0x21f359,_0x5426d0){return db['OpenchannelAccount'][_0x15fd('0x57')](_0x21f359[_0x15fd('0x58')],{})[_0x15fd('0x1d')](function(_0x30ab06){var _0x5d94b3=_0x21f359[_0x15fd('0x59')][_0x15fd('0x34')]({'plain':!![]});if(!_0x5d94b3)throw new Error(_0x15fd('0x5a'));if(_0x5d94b3[_0x15fd('0x5b')]===_0x15fd('0x59')){var _0x321fe7=_0x30ab06['get']({'plain':!![]});var _0x8fd5c0=_0x15fd('0x35');return db[_0x15fd('0x5c')][_0x15fd('0x5d')]({'where':{'name':_0x8fd5c0,'userProfileId':_0x5d94b3[_0x15fd('0x5e')]},'raw':!![]})[_0x15fd('0x1d')](function(_0x585b4c){if(_0x585b4c&&_0x585b4c['autoAssociation']===0x0){return db[_0x15fd('0x5f')][_0x15fd('0x57')]({'name':_0x321fe7['name'],'resourceId':_0x321fe7['id'],'type':_0x585b4c[_0x15fd('0x3f')],'sectionId':_0x585b4c['id']},{})[_0x15fd('0x1d')](function(){return _0x30ab06;});}else{return _0x30ab06;}})['catch'](function(_0x285fd5){logger[_0x15fd('0x23')](_0x15fd('0x60'),_0x285fd5);throw _0x285fd5;});}return _0x30ab06;})['then'](respondWithResult(_0x5426d0,0xc9))[_0x15fd('0x28')](handleError(_0x5426d0,null));};exports[_0x15fd('0x61')]=function(_0x2c1ce5,_0x2db860){if(_0x2c1ce5[_0x15fd('0x58')]['id']){delete _0x2c1ce5[_0x15fd('0x58')]['id'];}return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x2c1ce5[_0x15fd('0x62')]['id']},'include':[{'model':db[_0x15fd('0x63')],'as':'mandatoryDispositionPause'}]})[_0x15fd('0x1d')](handleEntityNotFound(_0x2db860,null))[_0x15fd('0x1d')](saveUpdates(_0x2c1ce5['body'],null))['then'](respondWithResult(_0x2db860,null))[_0x15fd('0x28')](handleError(_0x2db860,null));};exports[_0x15fd('0x33')]=function(_0x2bd6ef,_0x105f03){return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x2bd6ef['params']['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x105f03,null))[_0x15fd('0x1d')](removeEntity(_0x105f03,null))[_0x15fd('0x28')](handleError(_0x105f03,null));};exports[_0x15fd('0x64')]=function(_0x7b4413,_0x132e29){return db[_0x15fd('0x52')][_0x15fd('0x64')]()[_0x15fd('0x1d')](respondWithResult(_0x132e29,null))[_0x15fd('0x28')](handleError(_0x132e29,null));};exports[_0x15fd('0x65')]=function(_0x56dfad,_0x515963,_0x8a8198){if(_0x56dfad[_0x15fd('0x58')]['id']){delete _0x56dfad[_0x15fd('0x58')]['id'];}return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x56dfad[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x515963,null))['then'](function(_0x46bb7d){if(_0x46bb7d){_0x56dfad['body'][_0x15fd('0x66')]=_0x46bb7d['id'];return db['Disposition'][_0x15fd('0x57')](_0x56dfad['body']);}})[_0x15fd('0x1d')](respondWithResult(_0x515963,null))[_0x15fd('0x28')](handleError(_0x515963,null));};exports[_0x15fd('0x67')]=function(_0x3d40f3,_0x2e3c9a,_0x1e3bf7){var _0xb910a4={'raw':![],'where':{}};var _0x29c0bf={};var _0x2cd8a8={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3d40f3[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x2e3c9a,null))[_0x15fd('0x1d')](function(_0x4a8659){if(_0x4a8659){_0x29c0bf[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x68')]['rawAttributes']);_0x29c0bf[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x3d40f3['query']);_0x29c0bf[_0x15fd('0x42')]=_['intersection'](_0x29c0bf[_0x15fd('0x3e')],_0x29c0bf[_0x15fd('0x40')]);_0xb910a4[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x29c0bf[_0x15fd('0x3e')],qs['fields'](_0x3d40f3[_0x15fd('0x40')]['fields']));_0xb910a4[_0x15fd('0x44')]=_0xb910a4['attributes'][_0x15fd('0x46')]?_0xb910a4[_0x15fd('0x44')]:_0x29c0bf['model'];if(!_0x3d40f3[_0x15fd('0x40')][_0x15fd('0x47')]('nolimit')){_0xb910a4['limit']=qs[_0x15fd('0x2e')](_0x3d40f3['query'][_0x15fd('0x2e')]);_0xb910a4[_0x15fd('0x2d')]=qs[_0x15fd('0x2d')](_0x3d40f3[_0x15fd('0x40')][_0x15fd('0x2d')]);}_0xb910a4['order']=qs[_0x15fd('0x4a')](_0x3d40f3[_0x15fd('0x40')]['sort']);_0xb910a4[_0x15fd('0x4d')]=qs[_0x15fd('0x42')](_[_0x15fd('0x4b')](_0x3d40f3[_0x15fd('0x40')],_0x29c0bf[_0x15fd('0x42')]));_0xb910a4[_0x15fd('0x4d')][_0x15fd('0x66')]=_0x4a8659['id'];if(_0x3d40f3[_0x15fd('0x40')][_0x15fd('0x4c')]){_0xb910a4[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0xb910a4[_0x15fd('0x4d')],{'$or':_[_0x15fd('0x3a')](_0xb910a4[_0x15fd('0x44')],function(_0x4ddc37){var _0x9738a6={};_0x9738a6[_0x4ddc37]={'$like':'%'+_0x3d40f3['query'][_0x15fd('0x4c')]+'%'};return _0x9738a6;})});}_0xb910a4=_[_0x15fd('0x4e')]({},_0xb910a4,_0x3d40f3[_0x15fd('0x51')]);return db[_0x15fd('0x68')]['count']({'where':_0xb910a4[_0x15fd('0x4d')]})[_0x15fd('0x1d')](function(_0x32d748){_0x2cd8a8[_0x15fd('0x2c')]=_0x32d748;if(_0x3d40f3['query'][_0x15fd('0x53')]){_0xb910a4[_0x15fd('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x15fd('0x54')](_0xb910a4);})[_0x15fd('0x1d')](function(_0x128ee3){_0x2cd8a8['rows']=_0x128ee3;return _0x2cd8a8;});}})[_0x15fd('0x1d')](respondWithFilteredResult(_0x2e3c9a,_0xb910a4))[_0x15fd('0x28')](handleError(_0x2e3c9a,null));};exports[_0x15fd('0x69')]=function(_0x2cef12,_0x13a008,_0x2d24a2){return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x2cef12[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x13a008,null))[_0x15fd('0x1d')](function(_0x3cab37){if(_0x3cab37){return _0x3cab37['removeDispositions'](_0x2cef12[_0x15fd('0x40')][_0x15fd('0x6a')]);}})[_0x15fd('0x1d')](respondWithStatusCode(_0x13a008,null))[_0x15fd('0x28')](handleError(_0x13a008,null));};exports[_0x15fd('0x6b')]=function(_0x5f2682,_0x51f45e,_0x3017c6){if(_0x5f2682[_0x15fd('0x58')]['id']){delete _0x5f2682[_0x15fd('0x58')]['id'];}return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x5f2682[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x51f45e,null))[_0x15fd('0x1d')](function(_0x132613){if(_0x132613){_0x5f2682['body'][_0x15fd('0x66')]=_0x132613['id'];return db[_0x15fd('0x6c')]['create'](_0x5f2682[_0x15fd('0x58')]);}})[_0x15fd('0x1d')](respondWithResult(_0x51f45e,null))[_0x15fd('0x28')](handleError(_0x51f45e,null));};exports[_0x15fd('0x6d')]=function(_0x52628a,_0x3e4563,_0x2928b0){var _0x4be4bb={'raw':![],'where':{}};var _0x47529c={};var _0x1b5407={'count':0x0,'rows':[]};return db[_0x15fd('0x52')]['findOne']({'where':{'id':_0x52628a[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x3e4563,null))[_0x15fd('0x1d')](function(_0x17ce0f){if(_0x17ce0f){_0x47529c[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x6c')][_0x15fd('0x3b')]);_0x47529c['query']=_[_0x15fd('0x41')](_0x52628a[_0x15fd('0x40')]);_0x47529c[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x47529c[_0x15fd('0x3e')],_0x47529c[_0x15fd('0x40')]);_0x4be4bb[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x47529c[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x52628a[_0x15fd('0x40')][_0x15fd('0x45')]));_0x4be4bb[_0x15fd('0x44')]=_0x4be4bb[_0x15fd('0x44')][_0x15fd('0x46')]?_0x4be4bb[_0x15fd('0x44')]:_0x47529c[_0x15fd('0x3e')];if(!_0x52628a[_0x15fd('0x40')][_0x15fd('0x47')](_0x15fd('0x48'))){_0x4be4bb[_0x15fd('0x2e')]=qs[_0x15fd('0x2e')](_0x52628a[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x4be4bb[_0x15fd('0x2d')]=qs[_0x15fd('0x2d')](_0x52628a['query'][_0x15fd('0x2d')]);}_0x4be4bb[_0x15fd('0x49')]=qs['sort'](_0x52628a[_0x15fd('0x40')][_0x15fd('0x4a')]);_0x4be4bb[_0x15fd('0x4d')]=qs[_0x15fd('0x42')](_['pick'](_0x52628a['query'],_0x47529c[_0x15fd('0x42')]));_0x4be4bb['where'][_0x15fd('0x66')]=_0x17ce0f['id'];if(_0x52628a[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x4be4bb[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0x4be4bb[_0x15fd('0x4d')],{'$or':_[_0x15fd('0x3a')](_0x4be4bb['attributes'],function(_0x4891da){var _0x107f64={};_0x107f64[_0x4891da]={'$like':'%'+_0x52628a[_0x15fd('0x40')][_0x15fd('0x4c')]+'%'};return _0x107f64;})});}_0x4be4bb=_[_0x15fd('0x4e')]({},_0x4be4bb,_0x52628a[_0x15fd('0x51')]);return db[_0x15fd('0x6c')]['count']({'where':_0x4be4bb['where']})[_0x15fd('0x1d')](function(_0x190a30){_0x1b5407[_0x15fd('0x2c')]=_0x190a30;if(_0x52628a[_0x15fd('0x40')][_0x15fd('0x53')]){_0x4be4bb[_0x15fd('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x15fd('0x54')](_0x4be4bb);})['then'](function(_0x40ffaf){_0x1b5407[_0x15fd('0x6e')]=_0x40ffaf;return _0x1b5407;});}})[_0x15fd('0x1d')](respondWithFilteredResult(_0x3e4563,_0x4be4bb))[_0x15fd('0x28')](handleError(_0x3e4563,null));};exports['removeAnswers']=function(_0x1e6ad9,_0x54f8fb,_0x3f82be){return db['OpenchannelAccount']['find']({'where':{'id':_0x1e6ad9[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x54f8fb,null))[_0x15fd('0x1d')](function(_0x333b37){if(_0x333b37){return _0x333b37[_0x15fd('0x6f')](_0x1e6ad9[_0x15fd('0x40')]['ids']);}})[_0x15fd('0x1d')](respondWithStatusCode(_0x54f8fb,null))['catch'](handleError(_0x54f8fb,null));};exports[_0x15fd('0x70')]=function(_0x3f4ff0,_0x2df806,_0x4079d3){var _0x21f005={'body':_0x3f4ff0[_0x15fd('0x58')],'channel':_0x15fd('0x71')};var _0x2d17ae=[];var _0x102c3d=[];var _0x38d481={};var _0x286dae=![];return db[_0x15fd('0x72')]['describe']()[_0x15fd('0x1d')](function(_0x2cb43e){if(!_0x2cb43e){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0x75'));}_0x2d17ae=_[_0x15fd('0x76')](_['keys'](_0x2cb43e),['createdAt',_0x15fd('0x77')]);_0x102c3d=_[_0x15fd('0x76')](_[_0x15fd('0x41')](_0x2cb43e),[_0x15fd('0x78'),'updatedAt','CompanyId',_0x15fd('0x79')]);if(_0x3f4ff0[_0x15fd('0x58')]['id']){delete _0x3f4ff0[_0x15fd('0x58')]['id'];}if(_['isNil'](_0x3f4ff0['body'][_0x15fd('0x7a')])){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0x7b'));}if(_[_0x15fd('0x7c')](_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x58')])||_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x58')]===''){throw new db[(_0x15fd('0x73'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x15fd('0x7c')](_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7d')])){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0x7e')+_0x102c3d);}if(!_[_0x15fd('0x7f')](_0x102c3d,_0x3f4ff0['body'][_0x15fd('0x7d')])){throw new db['Sequelize']['ValidationError'](_0x15fd('0x80')+_0x102c3d);}_0x38d481[_0x3f4ff0[_0x15fd('0x58')]['mapKey']]=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7a')];})[_0x15fd('0x1d')](function(){return db['OpenchannelAccount'][_0x15fd('0x5d')]({'where':{'id':_0x3f4ff0[_0x15fd('0x62')]['id']},'include':[{'model':db[_0x15fd('0x81')],'as':_0x15fd('0x82'),'include':[{'model':db[_0x15fd('0x72')],'as':_0x15fd('0x83'),'where':_0x38d481,'limit':0x1,'order':[[_0x15fd('0x77'),_0x15fd('0x84')]]}]},{'model':db[_0x15fd('0x85')],'as':_0x15fd('0x86')}]});})[_0x15fd('0x1d')](handleEntityNotFound(_0x2df806,null))['then'](function(_0x3c6998){if(_0x3c6998&&_0x3c6998['List']){_0x21f005[_0x15fd('0x87')]=_0x3c6998;_0x21f005[_0x15fd('0x88')]=_0x3c6998[_0x15fd('0x86')];_0x21f005[_0x15fd('0x89')]=_0x3c6998[_0x15fd('0x82')];_0x21f005[_0x15fd('0x88')]=_[_0x15fd('0x8a')](_0x21f005[_0x15fd('0x88')],[_0x15fd('0x8b')],[_0x15fd('0x8c')]);if(_0x21f005[_0x15fd('0x87')]['Applications']){delete _0x21f005['account'][_0x15fd('0x86')];}if(_0x21f005[_0x15fd('0x87')][_0x15fd('0x82')]&&_0x21f005[_0x15fd('0x87')][_0x15fd('0x82')]['Contacts']['length']){return _0x21f005[_0x15fd('0x87')][_0x15fd('0x82')][_0x15fd('0x83')][0x0];}var _0x3c06d7=_['defaults'](_0x3f4ff0[_0x15fd('0x58')],{'firstName':_0x3f4ff0['body'][_0x15fd('0x7a')],'ListId':_0x3c6998['ListId']});_0x3c06d7[_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7d')]]=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x7a')];return db[_0x15fd('0x72')][_0x15fd('0x57')](_0x3c06d7,{'fields':_0x2d17ae,'raw':!![]});}})['then'](handleEntityNotFound(_0x2df806,null))['then'](function(_0x29694f){_0x21f005[_0x15fd('0x8d')]=_0x29694f;if(_0x29694f){var _0x319963={'ContactId':_0x29694f['id'],'OpenchannelAccountId':_0x3f4ff0[_0x15fd('0x62')]['id'],'from':(_0x29694f[_0x15fd('0x8e')]||'')+'\x20'+(_0x29694f[_0x15fd('0x8f')]||'')};var _0x21ac8c={'OpenchannelAccountId':_0x3f4ff0['params']['id'],'closed':![]};if(_0x3f4ff0['body'][_0x15fd('0x90')]){_0x21ac8c['threadId']=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x90')];return db[_0x15fd('0x91')][_0x15fd('0x5d')]({'where':_0x21ac8c})[_0x15fd('0x1d')](function(_0x5a8f7){if(_0x5a8f7){return[_0x5a8f7,![]];}_0x319963[_0x15fd('0x90')]=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x90')];_0x319963['externalUrl']=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x92')];return db[_0x15fd('0x91')][_0x15fd('0x57')](_0x319963)[_0x15fd('0x1d')](function(_0x4e374b){return[_0x4e374b,!![]];});});}else{_0x21ac8c[_0x15fd('0x90')]=null;}_0x21ac8c['ContactId']=_0x29694f['id'];return db[_0x15fd('0x91')][_0x15fd('0x5d')]({'where':_0x21ac8c})[_0x15fd('0x1d')](function(_0x23593a){if(_0x23593a){return[_0x23593a,![]];}return db['OpenchannelInteraction']['create'](_0x319963)[_0x15fd('0x1d')](function(_0x1c34af){return[_0x1c34af,!![]];});});}})['spread'](function(_0x32eef3,_0x13d3e2){if(_0x32eef3){_0x286dae=_0x13d3e2;if(!_0x13d3e2){var _0x469af1={'from':(_0x21f005[_0x15fd('0x8d')][_0x15fd('0x8e')]||'')+'\x20'+(_0x21f005[_0x15fd('0x8d')][_0x15fd('0x8f')]||'')};if(_0x3f4ff0[_0x15fd('0x58')]['threadId']&&_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x93')]&&_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x90')]!=_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x93')]){_0x469af1[_0x15fd('0x90')]=_0x3f4ff0['body'][_0x15fd('0x93')];}return _0x32eef3['update'](_0x469af1);}else{return _0x32eef3;}}})['then'](function(_0x4158b3){_0x21f005[_0x15fd('0x94')]=_0x4158b3[_0x15fd('0x34')]({'plain':!![]});_0x21f005[_0x15fd('0x94')][_0x15fd('0x95')]=_0x286dae;if(_0x21f005[_0x15fd('0x94')][_0x15fd('0x95')]){if(_0x21f005[_0x15fd('0x87')]['autoclose']){_0x21f005[_0x15fd('0x88')][_0x15fd('0x96')]({'id':0x0,'priority':_0x21f005[_0x15fd('0x88')][_0x15fd('0x46')]+0x1,'app':_0x15fd('0x97'),'appdata':_0x15fd('0x98'),'interval':_0x15fd('0x99')});}}return db[_0x15fd('0x9a')]['create']({'body':_0x3f4ff0[_0x15fd('0x58')][_0x15fd('0x58')],'OpenchannelAccountId':_0x3f4ff0[_0x15fd('0x62')]['id'],'OpenchannelInteractionId':_0x4158b3['id'],'direction':'in','ContactId':_0x21f005[_0x15fd('0x8d')]['id'],'AttachmentId':_0x3f4ff0[_0x15fd('0x58')]['AttachmentId']});})[_0x15fd('0x1d')](function(_0x387f4b){_0x21f005['message']=_0x387f4b;if(_0x21f005[_0x15fd('0x94')][_0x15fd('0x9b')]){return db[_0x15fd('0x9c')][_0x15fd('0x5d')]({'attributes':['id',_0x15fd('0x3f')],'where':{'id':_0x21f005[_0x15fd('0x94')][_0x15fd('0x9b')]}})[_0x15fd('0x1d')](function(_0x38b404){if(_0x38b404){_0x21f005[_0x15fd('0x88')][_0x15fd('0x9d')]({'id':0x0,'priority':0x0,'app':_0x15fd('0x9e'),'appdata':_0x38b404[_0x15fd('0x3f')]+','+(_0x21f005[_0x15fd('0x87')][_0x15fd('0x9f')]||0xa),'interval':_0x15fd('0x99')});_0x21f005[_0x15fd('0xa0')]=![];}return respondWithRpcPromise(_0x15fd('0xa1'),_0x15fd('0xa2'),_0x21f005);});}return respondWithRpcPromise(_0x15fd('0xa1'),_0x15fd('0xa2'),_0x21f005);})[_0x15fd('0x1d')](function(_0x19a10f){respondWithRpcPromise('EventManager','EventManager',{'event':_0x15fd('0x70'),'message':_0x19a10f},client9002);return _0x19a10f;})[_0x15fd('0x1d')](respondWithResult(_0x2df806,null))[_0x15fd('0x28')](handleError(_0x2df806,null));};exports[_0x15fd('0xa3')]=function(_0x57e5b4,_0x30f466,_0x2cf7d9){return db[_0x15fd('0x52')]['findOne']({'where':{'id':_0x57e5b4[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x30f466,null))[_0x15fd('0x1d')](function(_0xb55c66){if(_0xb55c66){return db[_0x15fd('0xa4')]['transaction'](function(_0x58d559){return db[_0x15fd('0x85')][_0x15fd('0x33')]({'where':{'OpenchannelAccountId':_0x57e5b4['params']['id']},'transaction':_0x58d559})[_0x15fd('0x1d')](function(_0x34008e){var _0x1f00df=_[_0x15fd('0x3a')](_0x57e5b4[_0x15fd('0x58')],function(_0x493346){_0x493346[_0x15fd('0x66')]=_0x57e5b4[_0x15fd('0x62')]['id'];return _0x493346;});return db[_0x15fd('0x85')][_0x15fd('0xa5')](_0x1f00df,{'transaction':_0x58d559});});})['then'](function(){return db[_0x15fd('0x85')][_0x15fd('0xa6')]({'where':{'OpenchannelAccountId':_0x57e5b4[_0x15fd('0x62')]['id']},'order':_0x15fd('0x8b')});});}})[_0x15fd('0x1d')](respondWithResult(_0x30f466,null))[_0x15fd('0x28')](handleError(_0x30f466,null));};exports['getApplications']=function(_0x2bd82a,_0x88e79a,_0x30b58b){var _0x31a880={};var _0x3a30e7={};var _0x32f2b3;var _0xf0d9c;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2bd82a['params']['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x88e79a,null))[_0x15fd('0x1d')](function(_0x24f8eb){if(_0x24f8eb){_0x32f2b3=_0x24f8eb;_0x3a30e7[_0x15fd('0x3e')]=_[_0x15fd('0x41')](db[_0x15fd('0x85')][_0x15fd('0x3b')]);_0x3a30e7[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x2bd82a[_0x15fd('0x40')]);_0x3a30e7[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x3a30e7[_0x15fd('0x3e')],_0x3a30e7[_0x15fd('0x40')]);_0x31a880[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x3a30e7['model'],qs[_0x15fd('0x45')](_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x45')]));_0x31a880[_0x15fd('0x44')]=_0x31a880['attributes'][_0x15fd('0x46')]?_0x31a880[_0x15fd('0x44')]:_0x3a30e7[_0x15fd('0x3e')];_0x31a880[_0x15fd('0x49')]=qs[_0x15fd('0x4a')](_0x2bd82a['query'][_0x15fd('0x4a')]);_0x31a880[_0x15fd('0x4d')]=qs['filters'](_['pick'](_0x2bd82a[_0x15fd('0x40')],_0x3a30e7[_0x15fd('0x42')]));if(_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x31a880[_0x15fd('0x4d')]=_[_0x15fd('0x4e')](_0x31a880[_0x15fd('0x4d')],{'$or':_['map'](_0x31a880[_0x15fd('0x44')],function(_0x1655b6){var _0x2f9be5={};_0x2f9be5[_0x1655b6]={'$like':'%'+_0x2bd82a['query'][_0x15fd('0x4c')]+'%'};return _0x2f9be5;})});}_0x31a880=_[_0x15fd('0x4e')]({},_0x31a880,_0x2bd82a['options']);return _0x32f2b3[_0x15fd('0xa7')](_0x31a880);}})['then'](function(_0x5ddfb3){if(_0x5ddfb3){_0xf0d9c=_0x5ddfb3['length'];if(!_0x2bd82a[_0x15fd('0x40')]['hasOwnProperty'](_0x15fd('0x48'))){_0x31a880['limit']=qs['limit'](_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x31a880['offset']=qs[_0x15fd('0x2d')](_0x2bd82a[_0x15fd('0x40')][_0x15fd('0x2d')]);}return _0x32f2b3['getApplications'](_0x31a880);}})[_0x15fd('0x1d')](function(_0x44fe2a){if(_0x44fe2a){return _0x44fe2a?{'count':_0xf0d9c,'rows':_0x44fe2a}:null;}})['then'](respondWithResult(_0x88e79a,null))[_0x15fd('0x28')](handleError(_0x88e79a,null));};exports[_0x15fd('0xa8')]=function(_0x2c1f18,_0x24c9a4,_0x4be6f8){var _0x120c7e={'raw':![],'where':{}};var _0x3ef764={};var _0xcc72f2={'count':0x0,'rows':[]};return db[_0x15fd('0x52')][_0x15fd('0xa9')]({'where':{'id':_0x2c1f18[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x24c9a4,null))['then'](function(_0x2350c1){if(_0x2350c1){_0x3ef764['model']=_[_0x15fd('0x41')](db['OpenchannelInteraction'][_0x15fd('0x3b')]);_0x3ef764[_0x15fd('0x40')]=_[_0x15fd('0x41')](_0x2c1f18['query']);_0x3ef764['filters']=_[_0x15fd('0x43')](_0x3ef764['model'],_0x3ef764['query']);_0x120c7e[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x3ef764[_0x15fd('0x3e')],qs['fields'](_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x45')]));_0x120c7e[_0x15fd('0x44')]=_0x120c7e['attributes']['length']?_0x120c7e[_0x15fd('0x44')]:_0x3ef764[_0x15fd('0x3e')];if(!_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x47')](_0x15fd('0x48'))){_0x120c7e[_0x15fd('0x2e')]=qs[_0x15fd('0x2e')](_0x2c1f18['query'][_0x15fd('0x2e')]);_0x120c7e[_0x15fd('0x2d')]=qs['offset'](_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x2d')]);}_0x120c7e[_0x15fd('0x49')]=qs[_0x15fd('0x4a')](_0x2c1f18[_0x15fd('0x40')]['sort']);_0x120c7e[_0x15fd('0x4d')]=qs['filters'](_[_0x15fd('0x4b')](_0x2c1f18[_0x15fd('0x40')],_0x3ef764[_0x15fd('0x42')]));_0x120c7e[_0x15fd('0x4d')][_0x15fd('0x66')]=_0x2350c1['id'];if(_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x120c7e[_0x15fd('0x4d')]=_['merge'](_0x120c7e[_0x15fd('0x4d')],{'$or':_['map'](_0x120c7e[_0x15fd('0x44')],function(_0x1c6c2d){var _0x23b206={};_0x23b206[_0x1c6c2d]={'$like':'%'+_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x4c')]+'%'};return _0x23b206;})});}_0x120c7e=_[_0x15fd('0x4e')]({},_0x120c7e,_0x2c1f18[_0x15fd('0x51')]);return db['OpenchannelInteraction'][_0x15fd('0x2c')]({'where':_0x120c7e[_0x15fd('0x4d')]})[_0x15fd('0x1d')](function(_0x5f0a33){_0xcc72f2['count']=_0x5f0a33;if(_0x2c1f18[_0x15fd('0x40')][_0x15fd('0x53')]){_0x120c7e[_0x15fd('0x56')]=[{'model':db[_0x15fd('0x72')],'as':_0x15fd('0xaa'),'required':![]},{'model':db[_0x15fd('0x9c')],'as':_0x15fd('0xab'),'attributes':[_0x15fd('0x3f'),_0x15fd('0xac'),'internal'],'required':![]},{'model':db[_0x15fd('0xad')],'as':_0x15fd('0xae'),'attributes':['id',_0x15fd('0x3f'),_0x15fd('0xaf')],'where':_0x2c1f18['query']['tag']?{'id':_0x2c1f18[_0x15fd('0x40')][_0x15fd('0xb0')]}:undefined,'required':_0x2c1f18[_0x15fd('0x40')][_0x15fd('0xb0')]?!![]:![]}];}return db[_0x15fd('0x91')]['findAll'](_0x120c7e);})[_0x15fd('0x1d')](function(_0x4bdc4d){_0xcc72f2[_0x15fd('0x6e')]=_0x4bdc4d;return _0xcc72f2;});}})['then'](respondWithFilteredResult(_0x24c9a4,_0x120c7e))['catch'](handleError(_0x24c9a4,null));};exports[_0x15fd('0xb1')]=function(_0x2d960f,_0x3f4d13,_0x183938){return db[_0x15fd('0x52')]['find']({'where':{'id':_0x2d960f[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x3f4d13,null))[_0x15fd('0x1d')](function(_0x165cba){if(_0x165cba){return _0x165cba[_0x15fd('0xb1')](_0x2d960f['body'][_0x15fd('0x6a')],_[_0x15fd('0xb2')](_0x2d960f[_0x15fd('0x58')],['ids','id'])||{})[_0x15fd('0xb3')](function(_0x1c86e2){for(var _0x297246=0x0;_0x297246<_0x2d960f['body'][_0x15fd('0x6a')][_0x15fd('0x46')];_0x297246+=0x1){socket[_0x15fd('0xb4')](_0x15fd('0xb5'),{'UserId':_0x2d960f[_0x15fd('0x58')][_0x15fd('0x6a')][_0x297246],'OpenchannelAccountId':_0x2d960f[_0x15fd('0x62')]['id']});}return _0x1c86e2;});}})[_0x15fd('0x1d')](respondWithResult(_0x3f4d13,null))[_0x15fd('0x28')](handleError(_0x3f4d13,null));};exports[_0x15fd('0xb6')]=function(_0x557594,_0x3e1bd8,_0x3b3621){return db[_0x15fd('0x52')][_0x15fd('0x5d')]({'where':{'id':_0x557594[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x3e1bd8,null))[_0x15fd('0x1d')](function(_0x12ce80){if(_0x12ce80){return _0x12ce80['removeAgents'](_0x557594['query']['ids'])[_0x15fd('0x1d')](function(){if(_[_0x15fd('0xb7')](_0x557594['query']['ids'])){for(var _0x2ad54b=0x0;_0x2ad54b<_0x557594['query'][_0x15fd('0x6a')]['length'];_0x2ad54b+=0x1){socket[_0x15fd('0xb4')](_0x15fd('0xb8'),{'UserId':Number(_0x557594[_0x15fd('0x40')][_0x15fd('0x6a')][_0x2ad54b]),'OpenchannelAccountId':Number(_0x557594[_0x15fd('0x62')]['id'])});}}else{socket['emit'](_0x15fd('0xb8'),{'UserId':Number(_0x557594[_0x15fd('0x40')][_0x15fd('0x6a')]),'OpenchannelAccountId':Number(_0x557594['params']['id'])});}});}})[_0x15fd('0x1d')](respondWithStatusCode(_0x3e1bd8,null))[_0x15fd('0x28')](handleError(_0x3e1bd8,null));};exports[_0x15fd('0xb9')]=function(_0x64d8cb,_0x1b7daa,_0x38f1eb){var _0x30e164={};var _0x52951d={};var _0x762320;var _0x379141;return db[_0x15fd('0x52')][_0x15fd('0xa9')]({'where':{'id':_0x64d8cb[_0x15fd('0x62')]['id']}})['then'](handleEntityNotFound(_0x1b7daa,null))['then'](function(_0x56bdaf){if(_0x56bdaf){_0x762320=_0x56bdaf;_0x52951d['model']=_[_0x15fd('0x41')](db[_0x15fd('0x9c')][_0x15fd('0x3b')]);_0x52951d[_0x15fd('0x40')]=_['keys'](_0x64d8cb[_0x15fd('0x40')]);_0x52951d[_0x15fd('0x42')]=_[_0x15fd('0x43')](_0x52951d[_0x15fd('0x3e')],_0x52951d[_0x15fd('0x40')]);_0x30e164[_0x15fd('0x44')]=_[_0x15fd('0x43')](_0x52951d[_0x15fd('0x3e')],qs[_0x15fd('0x45')](_0x64d8cb[_0x15fd('0x40')]['fields']));_0x30e164[_0x15fd('0x44')]=_0x30e164[_0x15fd('0x44')][_0x15fd('0x46')]?_0x30e164[_0x15fd('0x44')]:_0x52951d['model'];_0x30e164[_0x15fd('0x49')]=qs[_0x15fd('0x4a')](_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x4a')]);_0x30e164['where']=qs['filters'](_['pick'](_0x64d8cb['query'],_0x52951d[_0x15fd('0x42')]));if(_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x4c')]){_0x30e164[_0x15fd('0x4d')]=_['merge'](_0x30e164[_0x15fd('0x4d')],{'$or':_[_0x15fd('0x3a')](_0x30e164[_0x15fd('0x44')],function(_0x1e9231){var _0x5136c3={};_0x5136c3[_0x1e9231]={'$like':'%'+_0x64d8cb['query']['filter']+'%'};return _0x5136c3;})});}_0x30e164=_['merge']({},_0x30e164,_0x64d8cb[_0x15fd('0x51')]);return _0x762320[_0x15fd('0xb9')](_0x30e164);}})[_0x15fd('0x1d')](function(_0x49cdad){if(_0x49cdad){_0x379141=_0x49cdad['length'];if(!_0x64d8cb[_0x15fd('0x40')]['hasOwnProperty'](_0x15fd('0x48'))){_0x30e164['limit']=qs[_0x15fd('0x2e')](_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x2e')]);_0x30e164['offset']=qs[_0x15fd('0x2d')](_0x64d8cb[_0x15fd('0x40')][_0x15fd('0x2d')]);}return _0x762320['getAgents'](_0x30e164);}})['then'](function(_0x354361){if(_0x354361){return _0x354361?{'count':_0x379141,'rows':_0x354361}:null;}})[_0x15fd('0x1d')](respondWithResult(_0x1b7daa,null))['catch'](handleError(_0x1b7daa,null));};exports[_0x15fd('0x37')]=function(_0x3c450e,_0x37b5c6,_0x42e6fb){var _0x57736b,_0x2cfc3d,_0x5b6a0e;if(_[_0x15fd('0x7c')](_0x3c450e[_0x15fd('0x58')]['body'])||_0x3c450e[_0x15fd('0x58')][_0x15fd('0x58')]===''){throw new db[(_0x15fd('0x73'))][(_0x15fd('0x74'))](_0x15fd('0xba'));}if(_[_0x15fd('0x7c')](_0x3c450e[_0x15fd('0x58')]['to'])){}_0x57736b=_0x3c450e[_0x15fd('0x58')]['to'];return db[_0x15fd('0x52')][_0x15fd('0xa9')]({'where':{'id':_0x3c450e[_0x15fd('0x62')]['id']}})[_0x15fd('0x1d')](handleEntityNotFound(_0x37b5c6,null))['then'](function(_0x5b7510){if(_0x5b7510){return db[_0x15fd('0x52')]['find']({'where':{'id':_0x5b7510['id']},'include':[{'model':db[_0x15fd('0x81')],'as':_0x15fd('0x82'),'include':[{'model':db[_0x15fd('0x72')],'as':_0x15fd('0x83'),'where':{[_0x5b7510[_0x15fd('0x7d')]]:_0x57736b},'limit':0x1,'order':[[_0x15fd('0x77'),'DESC']]}]}]})[_0x15fd('0x1d')](handleEntityNotFound(_0x37b5c6,null))[_0x15fd('0x1d')](function(_0x3b3684){if(_0x3b3684&&_0x3b3684['List']){_0x2cfc3d=_0x3b3684[_0x15fd('0x34')]({'plain':!![]});if(_0x2cfc3d[_0x15fd('0x82')]&&_0x2cfc3d[_0x15fd('0x82')][_0x15fd('0x83')][_0x15fd('0x46')]){return _0x2cfc3d[_0x15fd('0x82')][_0x15fd('0x83')][0x0];}return db['CmContact'][_0x15fd('0x57')](_[_0x15fd('0x17')](_0x3c450e['body'],{'firstName':_0x57736b,[_0x3b3684[_0x15fd('0x7d')]]:_0x57736b,'phone':_0x57736b,'ListId':_0x2cfc3d[_0x15fd('0x79')]}));}})['then'](handleEntityNotFound(_0x37b5c6,null))['then'](function(_0x289052){if(_0x289052){_0x5b6a0e=_0x289052;return db[_0x15fd('0x91')]['find']({'where':{'ContactId':_0x5b6a0e['id'],'closed':![],'OpenchannelAccountId':_0x2cfc3d['id']}})[_0x15fd('0x1d')](function(_0x5c8272){if(_0x5c8272){return[_0x5c8272,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x3c450e['user']['id'],'ContactId':_0x5b6a0e['id'],'OpenchannelAccountId':_0x2cfc3d['id'],'lastMsgDirection':'out','Messages':[_[_0x15fd('0x4e')](_0x3c450e[_0x15fd('0x58')],{'read':![],'body':_0x3c450e['body'][_0x15fd('0x58')],'OpenchannelAccountId':_0x2cfc3d['id'],'UserId':_0x3c450e['user']['id'],'ContactId':_0x5b6a0e['id']})]},{'include':[{'model':db[_0x15fd('0x9a')],'as':_0x15fd('0xbb')}]})[_0x15fd('0x1d')](function(_0x401f25){return[_0x401f25,!![]];});});}})[_0x15fd('0xb3')](function(_0x2945e1,_0x76d279){if(_0x76d279){return _0x2945e1;}return db[_0x15fd('0x9a')]['create'](_[_0x15fd('0x4e')](_0x3c450e[_0x15fd('0x58')],{'read':![],'body':_0x3c450e[_0x15fd('0x58')][_0x15fd('0x58')],'OpenchannelAccountId':_0x2cfc3d['id'],'OpenchannelInteractionId':_0x2945e1['id'],'UserId':_0x3c450e[_0x15fd('0x59')]['id'],'ContactId':_0x5b6a0e['id']}))['then'](function(_0x5d9021){_0x2945e1[_0x15fd('0xbc')][_0x15fd('0xbb')]=[];_0x2945e1[_0x15fd('0xbc')][_0x15fd('0xbb')][_0x15fd('0x96')](_0x5d9021[_0x15fd('0xbc')]);return _0x2945e1;});});}})['then'](respondWithResult(_0x37b5c6,null))[_0x15fd('0x28')](handleError(_0x37b5c6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 72529f6..08c4eb2 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 _0xf679=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save'];(function(_0x2729fd,_0x5ecee9){var _0x472934=function(_0x20785a){while(--_0x20785a){_0x2729fd['push'](_0x2729fd['shift']());}};_0x472934(++_0x5ecee9);}(_0xf679,0x1f0));var _0x9f67=function(_0x1978e9,_0x53c682){_0x1978e9=_0x1978e9-0x0;var _0x1cd319=_0xf679[_0x1978e9];return _0x1cd319;};'use strict';var EventEmitter=require(_0x9f67('0x0'));var OpenchannelAccount=require(_0x9f67('0x1'))['db'][_0x9f67('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f67('0x3'),'afterUpdate':_0x9f67('0x4'),'afterDestroy':_0x9f67('0x5')};function emitEvent(_0x312a10){return function(_0x13ebee,_0x54cdac,_0x418d5d){OpenchannelAccountEvents['emit'](_0x312a10+':'+_0x13ebee['id'],_0x13ebee);OpenchannelAccountEvents[_0x9f67('0x6')](_0x312a10,_0x13ebee);_0x418d5d(null);};}for(var e in events){if(events[_0x9f67('0x7')](e)){var event=events[e];OpenchannelAccount[_0x9f67('0x8')](e,emitEvent(event));}}module[_0x9f67('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6d2c=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x6d2c,0x1b1));var _0xc6d2=function(_0x4eef8a,_0x3cf759){_0x4eef8a=_0x4eef8a-0x0;var _0x2c4e03=_0x6d2c[_0x4eef8a];return _0x2c4e03;};'use strict';var EventEmitter=require(_0xc6d2('0x0'));var OpenchannelAccount=require(_0xc6d2('0x1'))['db'][_0xc6d2('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6d2('0x3')](0x0);var events={'afterCreate':_0xc6d2('0x4'),'afterUpdate':_0xc6d2('0x5'),'afterDestroy':_0xc6d2('0x6')};function emitEvent(_0x9e274b){return function(_0xd12e34,_0x991eb9,_0x28ffe7){OpenchannelAccountEvents[_0xc6d2('0x7')](_0x9e274b+':'+_0xd12e34['id'],_0xd12e34);OpenchannelAccountEvents['emit'](_0x9e274b,_0xd12e34);_0x28ffe7(null);};}for(var e in events){if(events[_0xc6d2('0x8')](e)){var event=events[e];OpenchannelAccount[_0xc6d2('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index fd4a2d6..db4231f 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 _0x0f8e=['define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x27a4fe,_0x44b38e){var _0x4195c4=function(_0x4b0dc4){while(--_0x4b0dc4){_0x27a4fe['push'](_0x27a4fe['shift']());}};_0x4195c4(++_0x44b38e);}(_0x0f8e,0x92));var _0xe0f8=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x0f8e[_0x27bd2c];return _0x3784ea;};'use strict';var _=require('lodash');var util=require(_0xe0f8('0x0'));var logger=require(_0xe0f8('0x1'))('api');var moment=require(_0xe0f8('0x2'));var BPromise=require(_0xe0f8('0x3'));var rp=require(_0xe0f8('0x4'));var fs=require('fs');var path=require(_0xe0f8('0x5'));var rimraf=require(_0xe0f8('0x6'));var config=require(_0xe0f8('0x7'));var attributes=require(_0xe0f8('0x8'));module[_0xe0f8('0x9')]=function(_0x271c9f,_0x17337d){return _0x271c9f[_0xe0f8('0xa')](_0xe0f8('0xb'),attributes,{'tableName':_0xe0f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2769=['bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','OpenchannelAccount','openchannel_accounts','util','api','moment'];(function(_0x12a581,_0x5622fd){var _0x580324=function(_0x2c9829){while(--_0x2c9829){_0x12a581['push'](_0x12a581['shift']());}};_0x580324(++_0x5622fd);}(_0x2769,0xcf));var _0x9276=function(_0x517644,_0x2f7068){_0x517644=_0x517644-0x0;var _0x1bef95=_0x2769[_0x517644];return _0x1bef95;};'use strict';var _=require('lodash');var util=require(_0x9276('0x0'));var logger=require('../../config/logger')(_0x9276('0x1'));var moment=require(_0x9276('0x2'));var BPromise=require(_0x9276('0x3'));var rp=require(_0x9276('0x4'));var fs=require('fs');var path=require(_0x9276('0x5'));var rimraf=require(_0x9276('0x6'));var config=require('../../config/environment');var attributes=require(_0x9276('0x7'));module['exports']=function(_0x30ca16,_0x30c895){return _0x30ca16['define'](_0x9276('0x8'),attributes,{'tableName':_0x9276('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index e8973a1..30f9d92 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 _0x7786=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x7786,0xd1));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6778('0x0'));var util=require(_0x6778('0x1'));var moment=require(_0x6778('0x2'));var BPromise=require('bluebird');var rs=require(_0x6778('0x3'));var fs=require('fs');var Redis=require(_0x6778('0x4'));var db=require(_0x6778('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6778('0x6'));var config=require('../../config/environment');var jayson=require(_0x6778('0x7'));var client=jayson[_0x6778('0x8')][_0x6778('0x9')]({'port':0x232a});config[_0x6778('0xa')]=_[_0x6778('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6778('0xa')]));require(_0x6778('0xc'))['register'](socket);function respondWithRpcPromise(_0x147212,_0x5ade39,_0x27879a){return new BPromise(function(_0x4daed2,_0x42b577){return client['request'](_0x147212,_0x27879a)[_0x6778('0xd')](function(_0x1b5d55){logger[_0x6778('0xe')](_0x6778('0xf'),_0x5ade39,_0x6778('0x10'));logger[_0x6778('0x11')](_0x6778('0x12'),_0x5ade39,_0x6778('0x10'),JSON[_0x6778('0x13')](_0x1b5d55));if(_0x1b5d55[_0x6778('0x14')]){if(_0x1b5d55[_0x6778('0x14')]['code']===0x1f4){logger[_0x6778('0x14')](_0x6778('0xf'),_0x5ade39,_0x1b5d55['error'][_0x6778('0x15')]);return _0x42b577(_0x1b5d55[_0x6778('0x14')][_0x6778('0x15')]);}logger[_0x6778('0x14')](_0x6778('0xf'),_0x5ade39,_0x1b5d55[_0x6778('0x14')]['message']);return _0x4daed2(_0x1b5d55[_0x6778('0x14')][_0x6778('0x15')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5ade39,_0x6778('0x10'));_0x4daed2(_0x1b5d55['result']['message']);}})[_0x6778('0x16')](function(_0x103ab5){logger[_0x6778('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ade39,_0x103ab5);_0x42b577(_0x103ab5);});});} \ No newline at end of file +var _0x6ff8=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x4cdfb5,_0x58ce18){var _0x5ca496=function(_0x39e67b){while(--_0x39e67b){_0x4cdfb5['push'](_0x4cdfb5['shift']());}};_0x5ca496(++_0x58ce18);}(_0x6ff8,0x1df));var _0x86ff=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0x6ff8[_0x4fecb6];return _0xa9a47;};'use strict';var _=require(_0x86ff('0x0'));var util=require('util');var moment=require(_0x86ff('0x1'));var BPromise=require(_0x86ff('0x2'));var rs=require(_0x86ff('0x3'));var fs=require('fs');var Redis=require(_0x86ff('0x4'));var db=require(_0x86ff('0x5'))['db'];var utils=require(_0x86ff('0x6'));var logger=require(_0x86ff('0x7'))(_0x86ff('0x8'));var config=require('../../config/environment');var jayson=require(_0x86ff('0x9'));var client=jayson[_0x86ff('0xa')][_0x86ff('0xb')]({'port':0x232a});config[_0x86ff('0xc')]=_[_0x86ff('0xd')](config[_0x86ff('0xc')],{'host':_0x86ff('0xe'),'port':0x18eb});var socket=require(_0x86ff('0xf'))(new Redis(config['redis']));require(_0x86ff('0x10'))[_0x86ff('0x11')](socket);function respondWithRpcPromise(_0x24ba6e,_0x3db8ac,_0x1ba942){return new BPromise(function(_0x28b5ff,_0x474557){return client[_0x86ff('0x12')](_0x24ba6e,_0x1ba942)[_0x86ff('0x13')](function(_0x159a36){logger[_0x86ff('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3db8ac,'request\x20sent');logger[_0x86ff('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3db8ac,'request\x20sent',JSON[_0x86ff('0x16')](_0x159a36));if(_0x159a36[_0x86ff('0x17')]){if(_0x159a36[_0x86ff('0x17')][_0x86ff('0x18')]===0x1f4){logger[_0x86ff('0x17')](_0x86ff('0x19'),_0x3db8ac,_0x159a36[_0x86ff('0x17')][_0x86ff('0x1a')]);return _0x474557(_0x159a36[_0x86ff('0x17')][_0x86ff('0x1a')]);}logger['error'](_0x86ff('0x19'),_0x3db8ac,_0x159a36['error']['message']);return _0x28b5ff(_0x159a36[_0x86ff('0x17')]['message']);}else{logger[_0x86ff('0x14')](_0x86ff('0x19'),_0x3db8ac,'request\x20sent');_0x28b5ff(_0x159a36[_0x86ff('0x1b')][_0x86ff('0x1a')]);}})[_0x86ff('0x1c')](function(_0x5ab9d9){logger[_0x86ff('0x17')](_0x86ff('0x19'),_0x3db8ac,_0x5ab9d9);_0x474557(_0x5ab9d9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index bdc20c6..9eb91a6 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 _0x9a3e=['removeListener','register','openchannelAccount:','save','emit'];(function(_0x58cd66,_0x8f3958){var _0x389e53=function(_0xfa6603){while(--_0xfa6603){_0x58cd66['push'](_0x58cd66['shift']());}};_0x389e53(++_0x8f3958);}(_0x9a3e,0x148));var _0xe9a3=function(_0x2c792c,_0x2c968a){_0x2c792c=_0x2c792c-0x0;var _0x4ab7b1=_0x9a3e[_0x2c792c];return _0x4ab7b1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xe9a3('0x0'),'remove','update'];function createListener(_0x16e734,_0x9e1d24){return function(_0x46ad44){_0x9e1d24[_0xe9a3('0x1')](_0x16e734,_0x46ad44);};}function removeListener(_0x18af43,_0x52a612){return function(){OpenchannelAccountEvents[_0xe9a3('0x2')](_0x18af43,_0x52a612);};}exports[_0xe9a3('0x3')]=function(_0x1195f5){for(var _0x197994=0x0,_0x2c66a9=events['length'];_0x197994<_0x2c66a9;_0x197994++){var _0x42cc3d=events[_0x197994];var _0x37a1b0=createListener(_0xe9a3('0x4')+_0x42cc3d,_0x1195f5);OpenchannelAccountEvents['on'](_0x42cc3d,_0x37a1b0);}}; \ No newline at end of file +var _0x6f46=['remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x4c44a0,_0xd7a260){var _0x3eec68=function(_0x12f172){while(--_0x12f172){_0x4c44a0['push'](_0x4c44a0['shift']());}};_0x3eec68(++_0xd7a260);}(_0x6f46,0x173));var _0x66f4=function(_0xbde8e7,_0x2d2702){_0xbde8e7=_0xbde8e7-0x0;var _0x1686d1=_0x6f46[_0xbde8e7];return _0x1686d1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x66f4('0x0'),_0x66f4('0x1')];function createListener(_0x97ff06,_0x2cfd19){return function(_0x320096){_0x2cfd19[_0x66f4('0x2')](_0x97ff06,_0x320096);};}function removeListener(_0x475349,_0x11d144){return function(){OpenchannelAccountEvents[_0x66f4('0x3')](_0x475349,_0x11d144);};}exports[_0x66f4('0x4')]=function(_0x44601e){for(var _0x597a2a=0x0,_0x3c578a=events[_0x66f4('0x5')];_0x597a2a<_0x3c578a;_0x597a2a++){var _0x38deb1=events[_0x597a2a];var _0x397587=createListener(_0x66f4('0x6')+_0x38deb1,_0x44601e);OpenchannelAccountEvents['on'](_0x38deb1,_0x397587);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a4b7eaa..6c444fc 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 _0x7ab1=['multer','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x27cb48,_0x1b896f){var _0x323cee=function(_0x2e8a91){while(--_0x2e8a91){_0x27cb48['push'](_0x27cb48['shift']());}};_0x323cee(++_0x1b896f);}(_0x7ab1,0x1e0));var _0x17ab=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x7ab1[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0x17ab('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ab('0x1'));var router=express[_0x17ab('0x2')]();var auth=require(_0x17ab('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x17ab('0x4'));var controller=require(_0x17ab('0x5'));router[_0x17ab('0x6')]('/',auth[_0x17ab('0x7')](),controller[_0x17ab('0x8')]);router[_0x17ab('0x6')](_0x17ab('0x9'),auth[_0x17ab('0x7')](),controller[_0x17ab('0xa')]);router[_0x17ab('0xb')]('/',auth[_0x17ab('0x7')](),controller[_0x17ab('0xc')]);router['put'](_0x17ab('0x9'),auth[_0x17ab('0x7')](),controller[_0x17ab('0xd')]);router[_0x17ab('0xe')](_0x17ab('0x9'),auth[_0x17ab('0x7')](),controller[_0x17ab('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0bcf=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1d76e3,_0x309956){var _0x1bb63e=function(_0x29a86f){while(--_0x29a86f){_0x1d76e3['push'](_0x1d76e3['shift']());}};_0x1bb63e(++_0x309956);}(_0x0bcf,0x6a));var _0xf0bc=function(_0x826b5d,_0x5a01c8){_0x826b5d=_0x826b5d-0x0;var _0x1e5727=_0x0bcf[_0x826b5d];return _0x1e5727;};'use strict';var multer=require('multer');var util=require(_0xf0bc('0x0'));var path=require(_0xf0bc('0x1'));var timeout=require(_0xf0bc('0x2'));var express=require(_0xf0bc('0x3'));var router=express[_0xf0bc('0x4')]();var auth=require(_0xf0bc('0x5'));var interaction=require(_0xf0bc('0x6'));var config=require(_0xf0bc('0x7'));var controller=require('./openchannelApplication.controller');router[_0xf0bc('0x8')]('/',auth[_0xf0bc('0x9')](),controller[_0xf0bc('0xa')]);router[_0xf0bc('0x8')]('/:id',auth[_0xf0bc('0x9')](),controller['show']);router['post']('/',auth[_0xf0bc('0x9')](),controller['create']);router['put']('/:id',auth[_0xf0bc('0x9')](),controller['update']);router[_0xf0bc('0xb')]('/:id',auth[_0xf0bc('0x9')](),controller[_0xf0bc('0xc')]);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 a474d07..6d52e0d 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 _0xff8d=['exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x2f63c6,_0x30b981){var _0x3c0769=function(_0x20994c){while(--_0x20994c){_0x2f63c6['push'](_0x2f63c6['shift']());}};_0x3c0769(++_0x30b981);}(_0xff8d,0x7d));var _0xdff8=function(_0x695267,_0x4cba23){_0x695267=_0x695267-0x0;var _0x2e4ef2=_0xff8d[_0x695267];return _0x2e4ef2;};'use strict';var Sequelize=require('sequelize');module[_0xdff8('0x0')]={'priority':{'type':Sequelize[_0xdff8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdff8('0x2')]()},'description':{'type':Sequelize[_0xdff8('0x3')]},'interval':{'type':Sequelize[_0xdff8('0x3')],'defaultValue':_0xdff8('0x4')}}; \ No newline at end of file +var _0x45d8=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x38c136,_0x5f0228){var _0x555243=function(_0x536de1){while(--_0x536de1){_0x38c136['push'](_0x38c136['shift']());}};_0x555243(++_0x5f0228);}(_0x45d8,0x174));var _0x845d=function(_0x138293,_0x197e7f){_0x138293=_0x138293-0x0;var _0x34c4a2=_0x45d8[_0x138293];return _0x34c4a2;};'use strict';var Sequelize=require(_0x845d('0x0'));module[_0x845d('0x1')]={'priority':{'type':Sequelize[_0x845d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x845d('0x3')],'allowNull':![],'defaultValue':_0x845d('0x4')},'appdata':{'type':Sequelize[_0x845d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x845d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index eecc4ca..1ee3000 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 _0xe8f6=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','OpenchannelApplication','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','html-pdf','eml-format','rimraf','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js'];(function(_0x3a2591,_0x31449f){var _0x439c48=function(_0x3ea499){while(--_0x3ea499){_0x3a2591['push'](_0x3a2591['shift']());}};_0x439c48(++_0x31449f);}(_0xe8f6,0x160));var _0x6e8f=function(_0x5dcfc6,_0x4d4e4f){_0x5dcfc6=_0x5dcfc6-0x0;var _0x3bd788=_0xe8f6[_0x5dcfc6];return _0x3bd788;};'use strict';var pdf=require(_0x6e8f('0x0'));var emlformat=require(_0x6e8f('0x1'));var rimraf=require(_0x6e8f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6e8f('0x3'));var moment=require(_0x6e8f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e8f('0x5'));var path=require(_0x6e8f('0x6'));var sox=require(_0x6e8f('0x7'));var csv=require('to-csv');var ejs=require(_0x6e8f('0x8'));var fs=require('fs');var _=require(_0x6e8f('0x9'));var squel=require(_0x6e8f('0xa'));var crypto=require(_0x6e8f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6e8f('0xc'));var toCsv=require(_0x6e8f('0xd'));var querystring=require('querystring');var Papa=require(_0x6e8f('0xe'));var Redis=require(_0x6e8f('0xf'));var authService=require(_0x6e8f('0x10'));var qs=require(_0x6e8f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e8f('0x12'));var logger=require(_0x6e8f('0x13'))(_0x6e8f('0x14'));var utils=require('../../config/utils');var config=require(_0x6e8f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e8f('0x16'))['db'];function respondWithStatusCode(_0x27af47,_0x5dc2ee){_0x5dc2ee=_0x5dc2ee||0xcc;return function(_0x2da264){if(_0x2da264){return _0x27af47[_0x6e8f('0x17')](_0x5dc2ee);}return _0x27af47[_0x6e8f('0x18')](_0x5dc2ee)[_0x6e8f('0x19')]();};}function respondWithResult(_0x1c16d2,_0x1473ec){_0x1473ec=_0x1473ec||0xc8;return function(_0x53ea14){if(_0x53ea14){return _0x1c16d2['status'](_0x1473ec)[_0x6e8f('0x1a')](_0x53ea14);}};}function respondWithFilteredResult(_0x81e71a,_0x4b2f79){return function(_0x40234c){if(_0x40234c){var _0x541f14=_0x40234c[_0x6e8f('0x1b')],_0x399804=_0x4b2f79[_0x6e8f('0x1c')],_0x2506f4=_0x4b2f79[_0x6e8f('0x1c')]+_0x4b2f79[_0x6e8f('0x1d')],_0x3f32e1;if(_0x2506f4>=_0x541f14){_0x2506f4=_0x541f14;_0x3f32e1=0xc8;}else{_0x3f32e1=0xce;}_0x81e71a[_0x6e8f('0x18')](_0x3f32e1);return _0x81e71a[_0x6e8f('0x1e')](_0x6e8f('0x1f'),_0x399804+'-'+_0x2506f4+'/'+_0x541f14)[_0x6e8f('0x1a')](_0x40234c);}return null;};}function patchUpdates(_0x144cb5){return function(_0x2c6e7f){try{jsonpatch[_0x6e8f('0x20')](_0x2c6e7f,_0x144cb5,!![]);}catch(_0x3efab1){return BPromise[_0x6e8f('0x21')](_0x3efab1);}return _0x2c6e7f['save']();};}function saveUpdates(_0x565e89,_0x3afdf6){return function(_0x14c341){if(_0x14c341){return _0x14c341[_0x6e8f('0x22')](_0x565e89)['then'](function(_0x4d4318){return _0x4d4318;});}return null;};}function removeEntity(_0x2c94a4,_0x371701){return function(_0x8ed67e){if(_0x8ed67e){return _0x8ed67e[_0x6e8f('0x23')]()['then'](function(){_0x2c94a4[_0x6e8f('0x18')](0xcc)[_0x6e8f('0x19')]();});}};}function handleEntityNotFound(_0x522b0e,_0x7bc72d){return function(_0x320ec4){if(!_0x320ec4){_0x522b0e[_0x6e8f('0x17')](0x194);}return _0x320ec4;};}function handleError(_0x28abf3,_0x7d47f3){_0x7d47f3=_0x7d47f3||0x1f4;return function(_0x640100){logger['error'](_0x640100[_0x6e8f('0x24')]);if(_0x640100[_0x6e8f('0x25')]){delete _0x640100[_0x6e8f('0x25')];}_0x28abf3['status'](_0x7d47f3)[_0x6e8f('0x26')](_0x640100);};}exports[_0x6e8f('0x27')]=function(_0x4a01f6,_0x56ee04){var _0x22fff1={},_0x26fe8b={},_0x20a5f1={'count':0x0,'rows':[]};var _0x541e33=_['map'](db[_0x6e8f('0x28')][_0x6e8f('0x29')],function(_0x4ebff8){return{'name':_0x4ebff8['fieldName'],'type':_0x4ebff8[_0x6e8f('0x2a')][_0x6e8f('0x2b')]};});_0x26fe8b[_0x6e8f('0x2c')]=_[_0x6e8f('0x2d')](_0x541e33,_0x6e8f('0x25'));_0x26fe8b[_0x6e8f('0x2e')]=_[_0x6e8f('0x2f')](_0x4a01f6[_0x6e8f('0x2e')]);_0x26fe8b['filters']=_[_0x6e8f('0x30')](_0x26fe8b[_0x6e8f('0x2c')],_0x26fe8b[_0x6e8f('0x2e')]);_0x22fff1[_0x6e8f('0x31')]=_[_0x6e8f('0x30')](_0x26fe8b[_0x6e8f('0x2c')],qs[_0x6e8f('0x32')](_0x4a01f6[_0x6e8f('0x2e')]['fields']));_0x22fff1['attributes']=_0x22fff1['attributes']['length']?_0x22fff1[_0x6e8f('0x31')]:_0x26fe8b[_0x6e8f('0x2c')];if(!_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x33')]('nolimit')){_0x22fff1['limit']=qs[_0x6e8f('0x1d')](_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x1d')]);_0x22fff1[_0x6e8f('0x1c')]=qs[_0x6e8f('0x1c')](_0x4a01f6['query'][_0x6e8f('0x1c')]);}_0x22fff1[_0x6e8f('0x34')]=qs[_0x6e8f('0x35')](_0x4a01f6[_0x6e8f('0x2e')]['sort']);_0x22fff1['where']=qs[_0x6e8f('0x36')](_[_0x6e8f('0x37')](_0x4a01f6[_0x6e8f('0x2e')],_0x26fe8b[_0x6e8f('0x36')]),_0x541e33);if(_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x38')]){_0x22fff1[_0x6e8f('0x39')]=_[_0x6e8f('0x3a')](_0x22fff1[_0x6e8f('0x39')],{'$or':_['map'](_0x541e33,function(_0x2da0dd){if(_0x2da0dd[_0x6e8f('0x2a')]!==_0x6e8f('0x3b')){var _0x1d806d={};_0x1d806d[_0x2da0dd[_0x6e8f('0x25')]]={'$like':'%'+_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x38')]+'%'};return _0x1d806d;}})});}_0x22fff1=_[_0x6e8f('0x3a')]({},_0x22fff1,_0x4a01f6[_0x6e8f('0x3c')]);var _0x599227={'where':_0x22fff1['where']};return db[_0x6e8f('0x28')][_0x6e8f('0x1b')](_0x599227)[_0x6e8f('0x3d')](function(_0x2a2290){_0x20a5f1['count']=_0x2a2290;if(_0x4a01f6[_0x6e8f('0x2e')][_0x6e8f('0x3e')]){_0x22fff1['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6e8f('0x3f')](_0x22fff1);})[_0x6e8f('0x3d')](function(_0x1802c3){_0x20a5f1[_0x6e8f('0x40')]=_0x1802c3;return _0x20a5f1;})[_0x6e8f('0x3d')](respondWithFilteredResult(_0x56ee04,_0x22fff1))['catch'](handleError(_0x56ee04,null));};exports[_0x6e8f('0x41')]=function(_0x3e337b,_0x3fc164){var _0x2af59a={'raw':!![],'where':{'id':_0x3e337b[_0x6e8f('0x42')]['id']}},_0x426ff1={};_0x426ff1[_0x6e8f('0x2c')]=_['keys'](db[_0x6e8f('0x28')][_0x6e8f('0x29')]);_0x426ff1[_0x6e8f('0x2e')]=_[_0x6e8f('0x2f')](_0x3e337b[_0x6e8f('0x2e')]);_0x426ff1[_0x6e8f('0x36')]=_[_0x6e8f('0x30')](_0x426ff1[_0x6e8f('0x2c')],_0x426ff1[_0x6e8f('0x2e')]);_0x2af59a['attributes']=_[_0x6e8f('0x30')](_0x426ff1[_0x6e8f('0x2c')],qs['fields'](_0x3e337b[_0x6e8f('0x2e')][_0x6e8f('0x32')]));_0x2af59a['attributes']=_0x2af59a[_0x6e8f('0x31')][_0x6e8f('0x43')]?_0x2af59a['attributes']:_0x426ff1[_0x6e8f('0x2c')];if(_0x3e337b['query'][_0x6e8f('0x3e')]){_0x2af59a[_0x6e8f('0x44')]=[{'all':!![]}];}_0x2af59a=_[_0x6e8f('0x3a')]({},_0x2af59a,_0x3e337b[_0x6e8f('0x3c')]);return db[_0x6e8f('0x28')][_0x6e8f('0x45')](_0x2af59a)[_0x6e8f('0x3d')](handleEntityNotFound(_0x3fc164,null))[_0x6e8f('0x3d')](respondWithResult(_0x3fc164,null))[_0x6e8f('0x46')](handleError(_0x3fc164,null));};exports[_0x6e8f('0x47')]=function(_0x37ff9e,_0x665247){return db[_0x6e8f('0x28')][_0x6e8f('0x47')](_0x37ff9e[_0x6e8f('0x48')],{})['then'](respondWithResult(_0x665247,0xc9))[_0x6e8f('0x46')](handleError(_0x665247,null));};exports[_0x6e8f('0x22')]=function(_0x37c71d,_0xf2bd44){if(_0x37c71d[_0x6e8f('0x48')]['id']){delete _0x37c71d[_0x6e8f('0x48')]['id'];}return db[_0x6e8f('0x28')][_0x6e8f('0x45')]({'where':{'id':_0x37c71d[_0x6e8f('0x42')]['id']}})['then'](handleEntityNotFound(_0xf2bd44,null))[_0x6e8f('0x3d')](saveUpdates(_0x37c71d[_0x6e8f('0x48')],null))['then'](respondWithResult(_0xf2bd44,null))[_0x6e8f('0x46')](handleError(_0xf2bd44,null));};exports[_0x6e8f('0x23')]=function(_0x34d2a7,_0x4ea9bc){return db[_0x6e8f('0x28')][_0x6e8f('0x45')]({'where':{'id':_0x34d2a7[_0x6e8f('0x42')]['id']}})[_0x6e8f('0x3d')](handleEntityNotFound(_0x4ea9bc,null))[_0x6e8f('0x3d')](removeEntity(_0x4ea9bc,null))[_0x6e8f('0x46')](handleError(_0x4ea9bc,null));}; \ No newline at end of file +var _0x0462=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0xad9b66,_0x4a6b2c){var _0x3e4c3f=function(_0x24725c){while(--_0x24725c){_0xad9b66['push'](_0xad9b66['shift']());}};_0x3e4c3f(++_0x4a6b2c);}(_0x0462,0x182));var _0x2046=function(_0x58ec67,_0x32d80e){_0x58ec67=_0x58ec67-0x0;var _0xbae977=_0x0462[_0x58ec67];return _0xbae977;};'use strict';var pdf=require(_0x2046('0x0'));var emlformat=require(_0x2046('0x1'));var rimraf=require(_0x2046('0x2'));var zipdir=require(_0x2046('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2046('0x4'));var moment=require('moment');var BPromise=require(_0x2046('0x5'));var Mustache=require('mustache');var util=require(_0x2046('0x6'));var path=require('path');var sox=require(_0x2046('0x7'));var csv=require(_0x2046('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2046('0x9'));var squel=require(_0x2046('0xa'));var crypto=require(_0x2046('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2046('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2046('0xd'));var Redis=require(_0x2046('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2046('0xf'));var as=require(_0x2046('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2046('0x11'))(_0x2046('0x12'));var utils=require(_0x2046('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2046('0x14'));var db=require(_0x2046('0x15'))['db'];function respondWithStatusCode(_0x4cd633,_0x4c6f61){_0x4c6f61=_0x4c6f61||0xcc;return function(_0x2eadeb){if(_0x2eadeb){return _0x4cd633[_0x2046('0x16')](_0x4c6f61);}return _0x4cd633[_0x2046('0x17')](_0x4c6f61)[_0x2046('0x18')]();};}function respondWithResult(_0x5f2a95,_0xefb703){_0xefb703=_0xefb703||0xc8;return function(_0x468e1d){if(_0x468e1d){return _0x5f2a95['status'](_0xefb703)[_0x2046('0x19')](_0x468e1d);}};}function respondWithFilteredResult(_0x22af87,_0x17dcc8){return function(_0x4c141f){if(_0x4c141f){var _0x18dd64=_0x4c141f[_0x2046('0x1a')],_0x571876=_0x17dcc8['offset'],_0x43e567=_0x17dcc8[_0x2046('0x1b')]+_0x17dcc8[_0x2046('0x1c')],_0x495ae7;if(_0x43e567>=_0x18dd64){_0x43e567=_0x18dd64;_0x495ae7=0xc8;}else{_0x495ae7=0xce;}_0x22af87[_0x2046('0x17')](_0x495ae7);return _0x22af87[_0x2046('0x1d')]('Content-Range',_0x571876+'-'+_0x43e567+'/'+_0x18dd64)[_0x2046('0x19')](_0x4c141f);}return null;};}function patchUpdates(_0x8aae49){return function(_0x420308){try{jsonpatch[_0x2046('0x1e')](_0x420308,_0x8aae49,!![]);}catch(_0x721e6){return BPromise[_0x2046('0x1f')](_0x721e6);}return _0x420308[_0x2046('0x20')]();};}function saveUpdates(_0x27551f,_0x8848f4){return function(_0x482e7f){if(_0x482e7f){return _0x482e7f[_0x2046('0x21')](_0x27551f)[_0x2046('0x22')](function(_0x7b2bc1){return _0x7b2bc1;});}return null;};}function removeEntity(_0x44003e,_0x21a09d){return function(_0x38968c){if(_0x38968c){return _0x38968c[_0x2046('0x23')]()['then'](function(){_0x44003e[_0x2046('0x17')](0xcc)[_0x2046('0x18')]();});}};}function handleEntityNotFound(_0x5f346f,_0x580d6c){return function(_0x569db4){if(!_0x569db4){_0x5f346f[_0x2046('0x16')](0x194);}return _0x569db4;};}function handleError(_0x1a867b,_0x3fb8d1){_0x3fb8d1=_0x3fb8d1||0x1f4;return function(_0x1f9284){logger['error'](_0x1f9284[_0x2046('0x24')]);if(_0x1f9284[_0x2046('0x25')]){delete _0x1f9284['name'];}_0x1a867b[_0x2046('0x17')](_0x3fb8d1)[_0x2046('0x26')](_0x1f9284);};}exports[_0x2046('0x27')]=function(_0x3db3b9,_0x197895){var _0xb8562c={},_0x3b4f3c={},_0x56e64d={'count':0x0,'rows':[]};var _0x406136=_['map'](db[_0x2046('0x28')][_0x2046('0x29')],function(_0x4e6df6){return{'name':_0x4e6df6[_0x2046('0x2a')],'type':_0x4e6df6[_0x2046('0x2b')]['key']};});_0x3b4f3c[_0x2046('0x2c')]=_[_0x2046('0x2d')](_0x406136,'name');_0x3b4f3c['query']=_['keys'](_0x3db3b9['query']);_0x3b4f3c[_0x2046('0x2e')]=_[_0x2046('0x2f')](_0x3b4f3c['model'],_0x3b4f3c[_0x2046('0x30')]);_0xb8562c['attributes']=_[_0x2046('0x2f')](_0x3b4f3c[_0x2046('0x2c')],qs[_0x2046('0x31')](_0x3db3b9[_0x2046('0x30')][_0x2046('0x31')]));_0xb8562c['attributes']=_0xb8562c[_0x2046('0x32')][_0x2046('0x33')]?_0xb8562c['attributes']:_0x3b4f3c[_0x2046('0x2c')];if(!_0x3db3b9[_0x2046('0x30')][_0x2046('0x34')](_0x2046('0x35'))){_0xb8562c[_0x2046('0x1c')]=qs['limit'](_0x3db3b9[_0x2046('0x30')][_0x2046('0x1c')]);_0xb8562c[_0x2046('0x1b')]=qs[_0x2046('0x1b')](_0x3db3b9[_0x2046('0x30')][_0x2046('0x1b')]);}_0xb8562c['order']=qs['sort'](_0x3db3b9[_0x2046('0x30')]['sort']);_0xb8562c[_0x2046('0x36')]=qs[_0x2046('0x2e')](_[_0x2046('0x37')](_0x3db3b9[_0x2046('0x30')],_0x3b4f3c[_0x2046('0x2e')]),_0x406136);if(_0x3db3b9[_0x2046('0x30')]['filter']){_0xb8562c[_0x2046('0x36')]=_['merge'](_0xb8562c[_0x2046('0x36')],{'$or':_[_0x2046('0x2d')](_0x406136,function(_0x1f9d2c){if(_0x1f9d2c[_0x2046('0x2b')]!=='VIRTUAL'){var _0x2423a4={};_0x2423a4[_0x1f9d2c[_0x2046('0x25')]]={'$like':'%'+_0x3db3b9[_0x2046('0x30')][_0x2046('0x38')]+'%'};return _0x2423a4;}})});}_0xb8562c=_['merge']({},_0xb8562c,_0x3db3b9['options']);var _0x398174={'where':_0xb8562c[_0x2046('0x36')]};return db['OpenchannelApplication']['count'](_0x398174)[_0x2046('0x22')](function(_0x58bb97){_0x56e64d[_0x2046('0x1a')]=_0x58bb97;if(_0x3db3b9[_0x2046('0x30')][_0x2046('0x39')]){_0xb8562c[_0x2046('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x2046('0x3b')](_0xb8562c);})[_0x2046('0x22')](function(_0x5caa92){_0x56e64d[_0x2046('0x3c')]=_0x5caa92;return _0x56e64d;})['then'](respondWithFilteredResult(_0x197895,_0xb8562c))[_0x2046('0x3d')](handleError(_0x197895,null));};exports[_0x2046('0x3e')]=function(_0x1cfae0,_0x1a0d84){var _0x280ca1={'raw':!![],'where':{'id':_0x1cfae0[_0x2046('0x3f')]['id']}},_0x1b08dd={};_0x1b08dd['model']=_['keys'](db[_0x2046('0x28')][_0x2046('0x29')]);_0x1b08dd[_0x2046('0x30')]=_[_0x2046('0x40')](_0x1cfae0[_0x2046('0x30')]);_0x1b08dd[_0x2046('0x2e')]=_[_0x2046('0x2f')](_0x1b08dd[_0x2046('0x2c')],_0x1b08dd[_0x2046('0x30')]);_0x280ca1[_0x2046('0x32')]=_[_0x2046('0x2f')](_0x1b08dd[_0x2046('0x2c')],qs[_0x2046('0x31')](_0x1cfae0[_0x2046('0x30')][_0x2046('0x31')]));_0x280ca1[_0x2046('0x32')]=_0x280ca1['attributes'][_0x2046('0x33')]?_0x280ca1['attributes']:_0x1b08dd[_0x2046('0x2c')];if(_0x1cfae0[_0x2046('0x30')][_0x2046('0x39')]){_0x280ca1['include']=[{'all':!![]}];}_0x280ca1=_[_0x2046('0x41')]({},_0x280ca1,_0x1cfae0[_0x2046('0x42')]);return db[_0x2046('0x28')][_0x2046('0x43')](_0x280ca1)[_0x2046('0x22')](handleEntityNotFound(_0x1a0d84,null))[_0x2046('0x22')](respondWithResult(_0x1a0d84,null))[_0x2046('0x3d')](handleError(_0x1a0d84,null));};exports['create']=function(_0x218d58,_0x3913c7){return db[_0x2046('0x28')]['create'](_0x218d58[_0x2046('0x44')],{})['then'](respondWithResult(_0x3913c7,0xc9))[_0x2046('0x3d')](handleError(_0x3913c7,null));};exports[_0x2046('0x21')]=function(_0x42d98d,_0x5e56aa){if(_0x42d98d[_0x2046('0x44')]['id']){delete _0x42d98d['body']['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x42d98d[_0x2046('0x3f')]['id']}})[_0x2046('0x22')](handleEntityNotFound(_0x5e56aa,null))[_0x2046('0x22')](saveUpdates(_0x42d98d[_0x2046('0x44')],null))['then'](respondWithResult(_0x5e56aa,null))[_0x2046('0x3d')](handleError(_0x5e56aa,null));};exports[_0x2046('0x23')]=function(_0x3ea360,_0x3c0c0c){return db[_0x2046('0x28')]['find']({'where':{'id':_0x3ea360['params']['id']}})[_0x2046('0x22')](handleEntityNotFound(_0x3c0c0c,null))['then'](removeEntity(_0x3c0c0c,null))['catch'](handleError(_0x3c0c0c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6f266f7..217b650 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 _0x422a=['rimraf','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x388412,_0x11b8bb){var _0xe25c45=function(_0x2a66d6){while(--_0x2a66d6){_0x388412['push'](_0x388412['shift']());}};_0xe25c45(++_0x11b8bb);}(_0x422a,0x131));var _0xa422=function(_0x2a06d5,_0x57f681){_0x2a06d5=_0x2a06d5-0x0;var _0x451fca=_0x422a[_0x2a06d5];return _0x451fca;};'use strict';var _=require(_0xa422('0x0'));var util=require(_0xa422('0x1'));var logger=require(_0xa422('0x2'))(_0xa422('0x3'));var moment=require('moment');var BPromise=require(_0xa422('0x4'));var rp=require(_0xa422('0x5'));var fs=require('fs');var path=require(_0xa422('0x6'));var rimraf=require(_0xa422('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xa422('0x8')]=function(_0x1ab4c9,_0x1bc58a){return _0x1ab4c9[_0xa422('0x9')](_0xa422('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa422('0xb'),'collate':_0xa422('0xc')});}; \ No newline at end of file +var _0x5555=['path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59001d,_0x37e7c2){var _0xb8f0e1=function(_0x1231fd){while(--_0x1231fd){_0x59001d['push'](_0x59001d['shift']());}};_0xb8f0e1(++_0x37e7c2);}(_0x5555,0x1d9));var _0x5555=function(_0x51b828,_0x450bac){_0x51b828=_0x51b828-0x0;var _0x31338e=_0x5555[_0x51b828];return _0x31338e;};'use strict';var _=require(_0x5555('0x0'));var util=require(_0x5555('0x1'));var logger=require(_0x5555('0x2'))(_0x5555('0x3'));var moment=require(_0x5555('0x4'));var BPromise=require(_0x5555('0x5'));var rp=require(_0x5555('0x6'));var fs=require('fs');var path=require(_0x5555('0x7'));var rimraf=require('rimraf');var config=require(_0x5555('0x8'));var attributes=require(_0x5555('0x9'));module[_0x5555('0xa')]=function(_0x5768ae,_0x9526af){return _0x5768ae[_0x5555('0xb')](_0x5555('0xc'),attributes,{'tableName':_0x5555('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5555('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 72a90df..0b3caff 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(_0x163347,_0xf0f25a){var _0x28913c=function(_0x5f3763){while(--_0x5f3763){_0x163347['push'](_0x163347['shift']());}};_0x28913c(++_0xf0f25a);}(_0xb10b,0x12a));var _0xbb10=function(_0x32ff1d,_0x3e29bb){_0x32ff1d=_0x32ff1d-0x0;var _0x50489e=_0xb10b[_0x32ff1d];return _0x50489e;};'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(_0xede442,_0x5a86dd){var _0x58ff86=function(_0xdf84ca){while(--_0xdf84ca){_0xede442['push'](_0xede442['shift']());}};_0x58ff86(++_0x5a86dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x323413,_0x421d63){_0x323413=_0x323413-0x0;var _0xe2aca0=_0xb10b[_0x323413];return _0xe2aca0;};'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 43e472b..0cbba14 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 _0x68e7=['util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','post','create','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x5ef1f0,_0x63038d){var _0x545554=function(_0x35cec9){while(--_0x35cec9){_0x5ef1f0['push'](_0x5ef1f0['shift']());}};_0x545554(++_0x63038d);}(_0x68e7,0x10d));var _0x768e=function(_0x2ec72b,_0x4bfe14){_0x2ec72b=_0x2ec72b-0x0;var _0x13e869=_0x68e7[_0x2ec72b];return _0x13e869;};'use strict';var multer=require(_0x768e('0x0'));var util=require(_0x768e('0x1'));var path=require(_0x768e('0x2'));var timeout=require('connect-timeout');var express=require(_0x768e('0x3'));var router=express[_0x768e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x768e('0x5'));var config=require(_0x768e('0x6'));var controller=require(_0x768e('0x7'));router[_0x768e('0x8')]('/',auth['isAuthenticated'](),controller[_0x768e('0x9')]);router[_0x768e('0x8')](_0x768e('0xa'),auth[_0x768e('0xb')](),controller['describe']);router[_0x768e('0x8')](_0x768e('0xc'),auth[_0x768e('0xb')](),controller['show']);router[_0x768e('0x8')]('/:id/messages',auth[_0x768e('0xb')](),controller[_0x768e('0xd')]);router[_0x768e('0x8')](_0x768e('0xe'),auth[_0x768e('0xb')](),controller['download']);router[_0x768e('0xf')]('/',auth['isAuthenticated'](),controller[_0x768e('0x10')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x768e('0xf')](_0x768e('0x11'),auth['isAuthenticated'](),interaction[_0x768e('0x12')]('openchannel',_0x768e('0x13')),controller[_0x768e('0x14')]);router[_0x768e('0x15')](_0x768e('0xc'),auth[_0x768e('0xb')](),interaction['tracked'](_0x768e('0x16'),_0x768e('0x17')),controller[_0x768e('0x18')]);router[_0x768e('0x19')](_0x768e('0xc'),auth[_0x768e('0xb')](),interaction['tracked'](_0x768e('0x16'),_0x768e('0x1a')),controller[_0x768e('0x1b')]);router[_0x768e('0x19')](_0x768e('0x11'),auth['isAuthenticated'](),controller[_0x768e('0x1c')]);module[_0x768e('0x1d')]=router; \ No newline at end of file +var _0x5427=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','/:id/download','create','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete'];(function(_0x6c22dd,_0xcc47c4){var _0x382af6=function(_0x151b5e){while(--_0x151b5e){_0x6c22dd['push'](_0x6c22dd['shift']());}};_0x382af6(++_0xcc47c4);}(_0x5427,0x1b1));var _0x7542=function(_0x45b6d2,_0x118ef1){_0x45b6d2=_0x45b6d2-0x0;var _0x372b9a=_0x5427[_0x45b6d2];return _0x372b9a;};'use strict';var multer=require(_0x7542('0x0'));var util=require(_0x7542('0x1'));var path=require('path');var timeout=require(_0x7542('0x2'));var express=require(_0x7542('0x3'));var router=express[_0x7542('0x4')]();var auth=require(_0x7542('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7542('0x6'));var controller=require(_0x7542('0x7'));router[_0x7542('0x8')]('/',auth[_0x7542('0x9')](),controller['index']);router[_0x7542('0x8')](_0x7542('0xa'),auth[_0x7542('0x9')](),controller[_0x7542('0xb')]);router[_0x7542('0x8')](_0x7542('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7542('0x8')](_0x7542('0xd'),auth[_0x7542('0x9')](),controller['getMessages']);router[_0x7542('0x8')](_0x7542('0xe'),auth[_0x7542('0x9')](),controller['download']);router['post']('/',auth[_0x7542('0x9')](),controller[_0x7542('0xf')]);router['post'](_0x7542('0xd'),auth['isAuthenticated'](),controller[_0x7542('0x10')]);router[_0x7542('0x11')](_0x7542('0x12'),auth[_0x7542('0x9')](),interaction[_0x7542('0x13')](_0x7542('0x14'),_0x7542('0x15')),controller[_0x7542('0x16')]);router[_0x7542('0x17')](_0x7542('0xc'),auth[_0x7542('0x9')](),interaction['tracked'](_0x7542('0x14'),'openchannelinteraction:update'),controller[_0x7542('0x18')]);router[_0x7542('0x19')](_0x7542('0xc'),auth[_0x7542('0x9')](),interaction['tracked'](_0x7542('0x14'),'openchannelinteraction:destroy'),controller[_0x7542('0x1a')]);router[_0x7542('0x19')](_0x7542('0x12'),auth[_0x7542('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 43a441c..23b8978 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 _0x8da1=['STRING','out','BOOLEAN','DATE'];(function(_0x4b594f,_0x1f02cc){var _0x56738a=function(_0x27599f){while(--_0x27599f){_0x4b594f['push'](_0x4b594f['shift']());}};_0x56738a(++_0x1f02cc);}(_0x8da1,0x1a6));var _0x18da=function(_0x10eb11,_0x1c2aaa){_0x10eb11=_0x10eb11-0x0;var _0x1aad42=_0x8da1[_0x10eb11];return _0x1aad42;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x18da('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x18da('0x1')]},'disposition':{'type':Sequelize[_0x18da('0x2')]},'secondDisposition':{'type':Sequelize[_0x18da('0x2')]},'thirdDisposition':{'type':Sequelize[_0x18da('0x2')]},'note':{'type':Sequelize[_0x18da('0x2')]},'read1stAt':{'type':Sequelize[_0x18da('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x18da('0x2')]},'lastMsgAt':{'type':Sequelize[_0x18da('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x18da('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4522=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x4522,0x9e));var _0x2452=function(_0x58ea99,_0x5902eb){_0x58ea99=_0x58ea99-0x0;var _0x30f4a0=_0x4522[_0x58ea99];return _0x30f4a0;};'use strict';var Sequelize=require('sequelize');module[_0x2452('0x0')]={'closed':{'type':Sequelize[_0x2452('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2452('0x2')]},'disposition':{'type':Sequelize[_0x2452('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2452('0x3')]},'note':{'type':Sequelize[_0x2452('0x3')]},'read1stAt':{'type':Sequelize[_0x2452('0x2')]},'threadId':{'type':Sequelize[_0x2452('0x3')]},'externalUrl':{'type':Sequelize[_0x2452('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2452('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2452('0x4')]('in',_0x2452('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2452('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5bade17..e910144 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 _0xdfc3=['err','unlinkSync','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','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','text','end','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','rows','catch','show','params','includeAll','include','merge','options','create','describe','OpenchannelMessage','addMessage','omit','ids','getMessages','findOne','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','format','CmContact','Contact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','Openchannel','YYYY-MM-DD','Owner','N.A.','closed','closedAt','threadId','Public','Private','existsSync','createWriteStream','basename','System','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf'];(function(_0x5ee99e,_0x10c80a){var _0x5d17e1=function(_0x3a5af8){while(--_0x3a5af8){_0x5ee99e['push'](_0x5ee99e['shift']());}};_0x5d17e1(++_0x10c80a);}(_0xdfc3,0xf4));var _0x3dfc=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xdfc3[_0x82129b];return _0x2ae5dc;};'use strict';var pdf=require(_0x3dfc('0x0'));var emlformat=require(_0x3dfc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3dfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3dfc('0x3'));var BPromise=require(_0x3dfc('0x4'));var Mustache=require(_0x3dfc('0x5'));var util=require(_0x3dfc('0x6'));var path=require(_0x3dfc('0x7'));var sox=require(_0x3dfc('0x8'));var csv=require(_0x3dfc('0x9'));var ejs=require(_0x3dfc('0xa'));var fs=require('fs');var _=require(_0x3dfc('0xb'));var squel=require('squel');var crypto=require(_0x3dfc('0xc'));var jsforce=require(_0x3dfc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3dfc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3dfc('0xe'));var authService=require(_0x3dfc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3dfc('0x10'));var hardwareService=require(_0x3dfc('0x11'));var logger=require(_0x3dfc('0x12'))('api');var utils=require(_0x3dfc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3dfc('0x14'));var db=require(_0x3dfc('0x15'))['db'];config[_0x3dfc('0x16')]=_[_0x3dfc('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3dfc('0x16')]));require(_0x3dfc('0x18'))[_0x3dfc('0x19')](socket);function respondWithStatusCode(_0x2b8b88,_0x12a5c3){_0x12a5c3=_0x12a5c3||0xcc;return function(_0x434e92){if(_0x434e92){return _0x2b8b88[_0x3dfc('0x1a')](_0x12a5c3);}return _0x2b8b88[_0x3dfc('0x1b')](_0x12a5c3)['end']();};}function respondWithResult(_0x4fc163,_0x1726e4){_0x1726e4=_0x1726e4||0xc8;return function(_0xb4b554){if(_0xb4b554){return _0x4fc163[_0x3dfc('0x1b')](_0x1726e4)['json'](_0xb4b554);}};}function respondWithFilteredResult(_0x3ca47e,_0x2962d3){return function(_0x4d21b4){if(_0x4d21b4){var _0x41174d=_0x4d21b4[_0x3dfc('0x1c')],_0x5bc1de=_0x2962d3[_0x3dfc('0x1d')],_0x1ad2e6=_0x2962d3['offset']+_0x2962d3[_0x3dfc('0x1e')],_0x53e4c1;if(_0x1ad2e6>=_0x41174d){_0x1ad2e6=_0x41174d;_0x53e4c1=0xc8;}else{_0x53e4c1=0xce;}_0x3ca47e[_0x3dfc('0x1b')](_0x53e4c1);return _0x3ca47e[_0x3dfc('0x1f')](_0x3dfc('0x20'),_0x5bc1de+'-'+_0x1ad2e6+'/'+_0x41174d)[_0x3dfc('0x21')](_0x4d21b4);}return null;};}function patchUpdates(_0x49785e){return function(_0x1a3d25){try{jsonpatch[_0x3dfc('0x22')](_0x1a3d25,_0x49785e,!![]);}catch(_0x55fcaf){return BPromise['reject'](_0x55fcaf);}return _0x1a3d25[_0x3dfc('0x23')]();};}function saveUpdates(_0x4f0636,_0x4ae238){return function(_0x49ae07){if(_0x49ae07){return _0x49ae07[_0x3dfc('0x24')](_0x4f0636)[_0x3dfc('0x25')](function(_0x3bab41){return _0x3bab41;});}return null;};}function removeEntity(_0x9f5463,_0x565a63){return function(_0x369a02){if(_0x369a02){return _0x369a02[_0x3dfc('0x26')]()['then'](function(){_0x9f5463[_0x3dfc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8d8b,_0x962335){return function(_0x1283e6){if(!_0x1283e6){_0x4b8d8b[_0x3dfc('0x1a')](0x194);}return _0x1283e6;};}function handleError(_0x840140,_0x427450){_0x427450=_0x427450||0x1f4;return function(_0x85e5fc){logger[_0x3dfc('0x27')](_0x85e5fc[_0x3dfc('0x28')]);if(_0x85e5fc[_0x3dfc('0x29')]){delete _0x85e5fc[_0x3dfc('0x29')];}_0x840140[_0x3dfc('0x1b')](_0x427450)[_0x3dfc('0x2a')](_0x85e5fc);};}function getInteractionUsers(_0xe5df08,_0xb8bfe0){return new BPromise(function(_0x48e885,_0x4a13ac){try{if(_0xb8bfe0[_0xe5df08['id']]){_0xe5df08[_0x3dfc('0x2b')]=_[_0x3dfc('0x2c')](_0xb8bfe0[_0xe5df08['id']],function(_0x4bad52){return{'id':_0x4bad52['id'],'fullname':_0x4bad52[_0x3dfc('0x2d')]};});}}catch(_0x2c1bdd){_0x4a13ac(_0x2c1bdd);}_0x48e885(_0xe5df08);});}function getInteractionTags(_0x23476e,_0x38cec2){return new BPromise(function(_0x3bfa9c,_0x4b2bda){try{if(_0x23476e[_0x3dfc('0x2e')]){_0x23476e[_0x3dfc('0x2f')]=[];_0x23476e[_0x3dfc('0x2e')][_0x3dfc('0x30')](',')[_0x3dfc('0x31')](function(_0x7762c){_0x23476e[_0x3dfc('0x2f')]['push'](_0x38cec2[_0x7762c]);});}delete _0x23476e[_0x3dfc('0x2e')];}catch(_0x1a2abd){_0x4b2bda(_0x1a2abd);}_0x3bfa9c(_0x23476e);});}function updateOpenchannelInteraction(_0x331785,_0x7da256,_0x2640e1){return new BPromise(function(_0x129e8a,_0x4eab8d){return getInteractionUsers(_0x331785,_0x2640e1)[_0x3dfc('0x25')](function(_0x201bf2){return getInteractionTags(_0x201bf2,_0x7da256);})[_0x3dfc('0x25')](function(_0x97a32d){_0x129e8a(_0x97a32d);})['catch'](function(_0x5509c4){_0x4eab8d(_0x5509c4);});});}exports[_0x3dfc('0x32')]=function(_0x94b785,_0x54dbf6){var _0x343f32={},_0x128eec={},_0x3b0c3e={'count':0x0,'rows':[]};var _0x4faf0e=_[_0x3dfc('0x2c')](db[_0x3dfc('0x33')][_0x3dfc('0x34')],function(_0x21bbff){return{'name':_0x21bbff[_0x3dfc('0x35')],'type':_0x21bbff[_0x3dfc('0x36')][_0x3dfc('0x37')]};});_0x128eec[_0x3dfc('0x38')]=_['map'](_0x4faf0e,_0x3dfc('0x29'));_0x128eec['query']=_[_0x3dfc('0x39')](_0x94b785[_0x3dfc('0x3a')]);_0x128eec[_0x3dfc('0x3b')]=_[_0x3dfc('0x3c')](_0x128eec[_0x3dfc('0x38')],_0x128eec['query']);_0x343f32[_0x3dfc('0x3d')]=_[_0x3dfc('0x3c')](_0x128eec[_0x3dfc('0x38')],qs['fields'](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x3e')]));_0x343f32['attributes']=_0x343f32[_0x3dfc('0x3d')][_0x3dfc('0x3f')]?_0x343f32['attributes']:_0x128eec['model'];if(!_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x40')](_0x3dfc('0x41'))){_0x343f32[_0x3dfc('0x1e')]=qs[_0x3dfc('0x1e')](_0x94b785[_0x3dfc('0x3a')]['limit']);_0x343f32[_0x3dfc('0x1d')]=qs[_0x3dfc('0x1d')](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x1d')]);}_0x343f32[_0x3dfc('0x42')]=qs[_0x3dfc('0x43')](_0x94b785[_0x3dfc('0x3a')]['sort']);_0x343f32[_0x3dfc('0x44')]=qs['filters'](_[_0x3dfc('0x45')](_0x94b785[_0x3dfc('0x3a')],_0x128eec[_0x3dfc('0x3b')]),_0x4faf0e);var _0x1ef0f1=[];var _0x19352c=squel['select']()[_0x3dfc('0x46')]('id')['field'](_0x3dfc('0x29'))[_0x3dfc('0x46')](_0x3dfc('0x47'))[_0x3dfc('0x48')]('tools_tags');var _0x3b55cf=squel['select']()[_0x3dfc('0x46')]('u.id')[_0x3dfc('0x46')](_0x3dfc('0x49'))[_0x3dfc('0x46')]('ui.OpenchannelInteractionId')[_0x3dfc('0x48')](_0x3dfc('0x4a'),'ui')[_0x3dfc('0x4b')]('users','u',_0x3dfc('0x4c'));var _0x625abd=squel[_0x3dfc('0x4d')]()[_0x3dfc('0x48')]('openchannel_interactions','i')[_0x3dfc('0x4b')](_0x3dfc('0x4e'),'c',_0x3dfc('0x4f'))[_0x3dfc('0x4b')](_0x3dfc('0x50'),'o',_0x3dfc('0x51'))['left_join'](_0x3dfc('0x52'),'a',_0x3dfc('0x53'))['left_join']('openchannel_messages','me',_0x3dfc('0x54'))[_0x3dfc('0x4b')](_0x3dfc('0x55'),'it',_0x3dfc('0x56'))[_0x3dfc('0x4b')](_0x3dfc('0x57'),'t',_0x3dfc('0x58'));var _0x4243c6=squel[_0x3dfc('0x59')]();var _0x2ed2af=[];var _0x2a61be=squel[_0x3dfc('0x59')]();var _0x371151;if(_0x94b785['query'][_0x3dfc('0x5a')]){_0x371151=as[_0x3dfc('0x5b')](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x5a')]);var _0x3b105b=_0x371151['sqlOperator'];for(var _0x52f3a1=0x0;_0x52f3a1<_0x371151[_0x3dfc('0x5c')]['length'];_0x52f3a1++){var _0xf3811=_0x371151[_0x3dfc('0x5c')][_0x52f3a1];var _0x57c77e='i';var _0x2aaba7=_[_0x3dfc('0x5d')](_0x4faf0e,[_0x3dfc('0x29'),_0xf3811[_0x3dfc('0x46')]]);if(!_0x2aaba7){switch(_0xf3811['field']){case _0x3dfc('0x5e'):if(_0xf3811[_0x3dfc('0x5f')]==0x1){_0x625abd[_0x3dfc('0x60')]('`'+_0xf3811[_0x3dfc('0x46')]+'`\x20=\x200');}else{_0x625abd[_0x3dfc('0x60')]('`'+_0xf3811[_0x3dfc('0x46')]+_0x3dfc('0x61'));}break;case'Contact':if(_0xf3811[_0x3dfc('0x62')]==='$substring'){if(_0xf3811[_0x3dfc('0x5f')][_0x3dfc('0x30')]('\x20')[_0x3dfc('0x3f')]>0x1){_0x4243c6[_0x3b105b](_0x3dfc('0x63'),qs[_0x3dfc('0x64')](_0xf3811[_0x3dfc('0x5f')]),null);}else{var _0x542ca6='%'+_0xf3811[_0x3dfc('0x5f')]+'%';_0x4243c6[_0x3b105b](_0x3dfc('0x65'),_0x542ca6,_0x542ca6,_0x542ca6);}}else{_0x2aaba7=_['find'](_0x4faf0e,['name',_0x3dfc('0x66')]);_0xf3811[_0x3dfc('0x46')]='ContactId';_0x35d8a9=as[_0x3dfc('0x67')](_0x57c77e,_0x2aaba7[_0x3dfc('0x36')],_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9['text'],_0x35d8a9['value'][_0x3dfc('0x68')],_0x35d8a9[_0x3dfc('0x5f')]['end']);}break;case'Tag':var _0x2e870e=_0xf3811[_0x3dfc('0x5f')][_0x3dfc('0x30')](',')[_0x3dfc('0x2c')](function(_0x296fd9){return Number(_0x296fd9);});_0x2e870e[_0x3dfc('0x31')](function(_0x2f985f){_0x2a61be['or'](_0x3dfc('0x69'),'%,'+_0x2f985f+',%');});_0x2ed2af=_[_0x3dfc('0x6a')](_0x2ed2af,_0x2e870e);break;case _0x3dfc('0x6b'):if(_0xf3811['operator']===_0x3dfc('0x6c')){_0x4243c6[_0x3b105b](_0x3dfc('0x6d'),'%'+_0xf3811[_0x3dfc('0x5f')]+'%',null);}else{_0x2aaba7=_[_0x3dfc('0x5d')](_0x4faf0e,[_0x3dfc('0x29'),'UserId']);_0xf3811[_0x3dfc('0x46')]=_0x3dfc('0x6e');_0x35d8a9=as[_0x3dfc('0x67')](_0x57c77e,_0x2aaba7[_0x3dfc('0x36')],_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9[_0x3dfc('0x6f')],_0x35d8a9['value'][_0x3dfc('0x68')],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x70')]);}break;case _0x3dfc('0x71'):_0x35d8a9=as['buildExpression']('me',null,_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9[_0x3dfc('0x6f')],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x68')],_0x35d8a9['value'][_0x3dfc('0x70')]);break;}}else{var _0x35d8a9=as[_0x3dfc('0x67')](_0x57c77e,_0x2aaba7[_0x3dfc('0x36')],_0xf3811);_0x4243c6[_0x3b105b](_0x35d8a9['text'],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x68')],_0x35d8a9[_0x3dfc('0x5f')][_0x3dfc('0x70')]);}}}else{var _0x2fec55=_(_0x94b785[_0x3dfc('0x3a')])[_0x3dfc('0x39')]()[_0x3dfc('0x2c')](function(_0x4495c1){return _[_0x3dfc('0x72')](_0x4faf0e,['name',_0x4495c1])?_0x4495c1:undefined;})[_0x3dfc('0x73')]()[_0x3dfc('0x5f')]();if(!_[_0x3dfc('0x74')](_0x2fec55)){_0x2fec55[_0x3dfc('0x31')](function(_0xd5f793){if(_0xd5f793===_0x3dfc('0x75')){_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x76'),[]['concat'](_0x94b785[_0x3dfc('0x3a')][_0xd5f793]));}else if(_0xd5f793===_0x3dfc('0x77')){var _0x126025=JSON[_0x3dfc('0x78')](_0x94b785[_0x3dfc('0x3a')][_0xd5f793])['$gte'];var _0x43ae5d=JSON['parse'](_0x94b785['query'][_0xd5f793])['$lte'];_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x79'),_0x126025,_0x43ae5d);}else{if(_0x94b785[_0x3dfc('0x3a')][_0xd5f793]==='null'){_0x625abd[_0x3dfc('0x44')]('i.'+_0xd5f793+_0x3dfc('0x7a'));}else{_0x625abd[_0x3dfc('0x44')]('i.'+_0xd5f793+'\x20=\x20?',_0x94b785[_0x3dfc('0x3a')][_0xd5f793]);}}});}if(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7b')]){if(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7b')]==0x1){_0x625abd['having']('`unreadMessages`\x20=\x200');}else{_0x625abd[_0x3dfc('0x60')](_0x3dfc('0x7c'));}}if(_0x94b785['query']['tag']){_0x2ed2af=_[_0x3dfc('0x7d')](_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7e')])?_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7e')]:new Array(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x7e')]);_0x2ed2af[_0x3dfc('0x31')](function(_0x5ef9ee){_0x2a61be['or'](_0x3dfc('0x69'),'%,'+_0x5ef9ee+',%');});}if(_0x94b785['query']['filter']){var _0x25a99e=_0x94b785[_0x3dfc('0x3a')]['filter'][_0x3dfc('0x7f')]('\x5c','\x5c\x5c')[_0x3dfc('0x7f')](/'/g,'\x27\x27');if(qs[_0x3dfc('0x80')](_0x25a99e)){_0x4243c6['or'](_0x3dfc('0x81'),_0x25a99e+'%');}else{_0x4243c6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3dfc('0x64')](_0x25a99e))['or'](_0x3dfc('0x82'),_0x25a99e+'%')['or'](_0x3dfc('0x83'),_0x25a99e+'%');}}}_0x625abd['where'](_0x4243c6);_0x625abd[_0x3dfc('0x84')](_0x3dfc('0x85'));var _0x2262d9={'type':db[_0x3dfc('0x86')][_0x3dfc('0x87')][_0x3dfc('0x88')],'raw':!![]};var _0x1ba7e0=_0x625abd[_0x3dfc('0x89')]();_0x1ba7e0[_0x3dfc('0x46')](_0x3dfc('0x85'));_0x1ba7e0[_0x3dfc('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x343f32[_0x3dfc('0x42')]){_0x343f32[_0x3dfc('0x42')][_0x3dfc('0x31')](function(_0x5b7223){var _0x4eecb7=_0x5b7223[0x0]===_0x3dfc('0x8a')?_0x5b7223[0x0]:'i.'+_0x5b7223[0x0];_0x625abd[_0x3dfc('0x42')](_0x4eecb7,_0x5b7223[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3dfc('0x74')](_0x2ed2af)){_0x625abd[_0x3dfc('0x60')](_0x2a61be);_0x1ba7e0[_0x3dfc('0x44')](_0x3dfc('0x8b'),_0x2ed2af);}BPromise[_0x3dfc('0x8c')]()['then'](function(){if(!_0x371151){if(_0x94b785['query']['OpenchannelAccountId']||_0x94b785['query'][_0x3dfc('0x8d')])return;_0x1ba7e0[_0x3dfc('0x44')](_0x3dfc('0x8e'));_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x8e'));return;}if(_0x94b785[_0x3dfc('0x8f')][_0x3dfc('0x90')]!==_0x3dfc('0x91'))return;return _0x94b785[_0x3dfc('0x8f')][_0x3dfc('0x92')]({'attributes':['id'],'raw':!![]})[_0x3dfc('0x25')](function(_0x5cb392){if(_[_0x3dfc('0x74')](_0x5cb392)){_0x1ba7e0[_0x3dfc('0x44')](_0x3dfc('0x93'));_0x625abd['where'](_0x3dfc('0x93'));}else{_0x1ba7e0[_0x3dfc('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5cb392,'id'));_0x625abd[_0x3dfc('0x44')](_0x3dfc('0x76'),_['map'](_0x5cb392,'id'));}});})[_0x3dfc('0x25')](function(){if(_0x94b785[_0x3dfc('0x8f')][_0x3dfc('0x90')]===_0x3dfc('0x91')&&!_0x371151&&!_0x94b785[_0x3dfc('0x3a')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x3dfc('0x3a')](_0x1ba7e0[_0x3dfc('0x94')](),_0x2262d9);})[_0x3dfc('0x25')](function(_0x26f600){_0x3b0c3e[_0x3dfc('0x1c')]=_0x26f600[_0x3dfc('0x3f')];if(_0x3b0c3e[_0x3dfc('0x1c')]===0x0)return[];return db[_0x3dfc('0x95')][_0x3dfc('0x3a')](_0x19352c[_0x3dfc('0x94')](),_0x2262d9)['then'](function(_0x4c4625){_0x1ef0f1=_[_0x3dfc('0x96')](_0x4c4625,'id');_0x2262d9=_['merge'](_0x2262d9,{'model':db[_0x3dfc('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x94b785[_0x3dfc('0x3a')][_0x3dfc('0x3e')]){_0x343f32[_0x3dfc('0x3d')]['forEach'](function(_0xa44c50){_0x625abd[_0x3dfc('0x46')]('i.'+_0xa44c50);});}else{_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x97'),'unreadMessages');_0x625abd['field'](_0x3dfc('0x98'),'Account.key');_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x99'),_0x3dfc('0x9a'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9b'),_0x3dfc('0x8a'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9c'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9d'),_0x3dfc('0x9e'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0x9f'),_0x3dfc('0xa0'));_0x625abd[_0x3dfc('0x46')]('c.email',_0x3dfc('0xa1'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0xa2'),_0x3dfc('0xa3'));_0x625abd[_0x3dfc('0x46')]('c.mobile',_0x3dfc('0xa4'));_0x625abd[_0x3dfc('0x46')]('c.fax',_0x3dfc('0xa5'));_0x625abd[_0x3dfc('0x46')](_0x3dfc('0xa6'),_0x3dfc('0xa7'));_0x625abd['field']('o.internal',_0x3dfc('0xa8'));_0x625abd[_0x3dfc('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3dfc('0x2e'));}if(_0x343f32[_0x3dfc('0x1e')])_0x625abd[_0x3dfc('0x1e')](_0x343f32[_0x3dfc('0x1e')]);if(_0x343f32[_0x3dfc('0x1d')])_0x625abd[_0x3dfc('0x1d')](_0x343f32[_0x3dfc('0x1d')]);return db[_0x3dfc('0x95')][_0x3dfc('0x3a')](_0x625abd[_0x3dfc('0x94')](),_0x2262d9);})[_0x3dfc('0x25')](function(_0x3088c0){_0x3b55cf[_0x3dfc('0x44')](_0x3dfc('0xa9'),_[_0x3dfc('0x2c')](_0x3088c0,'id'));return db[_0x3dfc('0x95')][_0x3dfc('0x3a')](_0x3b55cf['toString'](),_0x2262d9)['then'](function(_0x369076){var _0x947199=_['groupBy'](_0x369076,_0x3dfc('0xaa'));var _0x3c8014=[];_0x3088c0['forEach'](function(_0x14b62c){_0x3c8014[_0x3dfc('0xab')](updateOpenchannelInteraction(_0x14b62c,_0x1ef0f1,_0x947199));});return BPromise[_0x3dfc('0xac')](_0x3c8014);});});})[_0x3dfc('0x25')](function(_0xf79b6d){_0x3b0c3e[_0x3dfc('0xad')]=_0xf79b6d;return _0x3b0c3e;})[_0x3dfc('0x25')](respondWithFilteredResult(_0x54dbf6,_0x343f32))[_0x3dfc('0xae')](handleError(_0x54dbf6,null));};exports[_0x3dfc('0xaf')]=function(_0x598003,_0x2dbd69){var _0x10c007={};if(_0x598003[_0x3dfc('0x3a')]['type']&&_0x598003[_0x3dfc('0x3a')][_0x3dfc('0x36')]===_0x3dfc('0x48')){_0x10c007[_0x3dfc('0x48')]=_0x598003[_0x3dfc('0xb0')]['id'];}else{_0x10c007['id']=_0x598003[_0x3dfc('0xb0')]['id'];}var _0x3d2a86={'raw':![],'where':_0x10c007},_0x20a672={};_0x20a672[_0x3dfc('0x38')]=_['keys'](db[_0x3dfc('0x33')][_0x3dfc('0x34')]);_0x20a672[_0x3dfc('0x3a')]=_[_0x3dfc('0x39')](_0x598003[_0x3dfc('0x3a')]);_0x20a672[_0x3dfc('0x3b')]=_[_0x3dfc('0x3c')](_0x20a672[_0x3dfc('0x38')],_0x20a672[_0x3dfc('0x3a')]);_0x3d2a86[_0x3dfc('0x3d')]=_[_0x3dfc('0x3c')](_0x20a672[_0x3dfc('0x38')],qs['fields'](_0x598003['query'][_0x3dfc('0x3e')]));_0x3d2a86[_0x3dfc('0x3d')]=_0x3d2a86[_0x3dfc('0x3d')][_0x3dfc('0x3f')]?_0x3d2a86['attributes']:_0x20a672[_0x3dfc('0x38')];if(_0x598003[_0x3dfc('0x3a')][_0x3dfc('0xb1')]){_0x3d2a86[_0x3dfc('0xb2')]=[{'all':!![]}];}_0x3d2a86=_[_0x3dfc('0xb3')]({},_0x3d2a86,_0x598003[_0x3dfc('0xb4')]);return db[_0x3dfc('0x33')][_0x3dfc('0x5d')](_0x3d2a86)[_0x3dfc('0x25')](handleEntityNotFound(_0x2dbd69,null))[_0x3dfc('0x25')](respondWithResult(_0x2dbd69,null))['catch'](handleError(_0x2dbd69,null));};exports[_0x3dfc('0xb5')]=function(_0x174a72,_0x537570){return db[_0x3dfc('0x33')][_0x3dfc('0xb5')](_0x174a72[_0x3dfc('0x71')],{})[_0x3dfc('0x25')](respondWithResult(_0x537570,0xc9))[_0x3dfc('0xae')](handleError(_0x537570,null));};exports['update']=function(_0x42c50b,_0x3234e3){if(_0x42c50b[_0x3dfc('0x71')]['id']){delete _0x42c50b['body']['id'];}return db[_0x3dfc('0x33')]['find']({'where':{'id':_0x42c50b[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x3234e3,null))['then'](saveUpdates(_0x42c50b[_0x3dfc('0x71')],null))['then'](respondWithResult(_0x3234e3,null))['catch'](handleError(_0x3234e3,null));};exports[_0x3dfc('0x26')]=function(_0x445de0,_0x48648e){return db['OpenchannelInteraction']['find']({'where':{'id':_0x445de0[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x48648e,null))[_0x3dfc('0x25')](removeEntity(_0x48648e,null))['catch'](handleError(_0x48648e,null));};exports[_0x3dfc('0xb6')]=function(_0x4e58a0,_0x1171fd){return db[_0x3dfc('0x33')]['describe']()[_0x3dfc('0x25')](respondWithResult(_0x1171fd,null))[_0x3dfc('0xae')](handleError(_0x1171fd,null));};exports['addMessage']=function(_0x43ff25,_0x5aed40,_0x4b4064){return db[_0x3dfc('0xb7')]['find']({'where':{'id':_0x43ff25[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x5aed40,null))[_0x3dfc('0x25')](function(_0x40a22c){if(_0x40a22c){return _0x40a22c[_0x3dfc('0xb8')](_0x43ff25['body']['ids'],_[_0x3dfc('0xb9')](_0x43ff25[_0x3dfc('0x71')],[_0x3dfc('0xba'),'id'])||{});}})[_0x3dfc('0x25')](respondWithResult(_0x5aed40,null))[_0x3dfc('0xae')](handleError(_0x5aed40,null));};exports[_0x3dfc('0xbb')]=function(_0x57538d,_0x30f4a4,_0x172406){var _0x111282={'raw':![],'where':{}};var _0x1e6f06={};var _0x2a09d={'count':0x0,'rows':[]};return db[_0x3dfc('0x33')][_0x3dfc('0xbc')]({'where':{'id':_0x57538d[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x30f4a4,null))[_0x3dfc('0x25')](function(_0x275435){if(_0x275435){_0x1e6f06[_0x3dfc('0x38')]=_[_0x3dfc('0x39')](db['OpenchannelMessage'][_0x3dfc('0x34')]);_0x1e6f06[_0x3dfc('0x3a')]=_[_0x3dfc('0x39')](_0x57538d[_0x3dfc('0x3a')]);_0x1e6f06[_0x3dfc('0x3b')]=_[_0x3dfc('0x3c')](_0x1e6f06[_0x3dfc('0x38')],_0x1e6f06['query']);_0x111282[_0x3dfc('0x3d')]=_['intersection'](_0x1e6f06[_0x3dfc('0x38')],qs[_0x3dfc('0x3e')](_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x3e')]));_0x111282['attributes']=_0x111282[_0x3dfc('0x3d')]['length']?_0x111282[_0x3dfc('0x3d')]:_0x1e6f06[_0x3dfc('0x38')];if(!_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x40')](_0x3dfc('0x41'))){_0x111282['limit']=qs['limit'](_0x57538d[_0x3dfc('0x3a')]['limit']);_0x111282[_0x3dfc('0x1d')]=qs['offset'](_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x1d')]);}_0x111282[_0x3dfc('0x42')]=qs[_0x3dfc('0x43')](_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0x43')]);_0x111282[_0x3dfc('0x44')]=qs[_0x3dfc('0x3b')](_[_0x3dfc('0x45')](_0x57538d[_0x3dfc('0x3a')],_0x1e6f06[_0x3dfc('0x3b')]));_0x111282[_0x3dfc('0x44')][_0x3dfc('0xaa')]=_0x275435['id'];if(_0x57538d[_0x3dfc('0x3a')]['filter']){_0x111282['where']=_[_0x3dfc('0xb3')](_0x111282[_0x3dfc('0x44')],{'$or':_[_0x3dfc('0x2c')](_0x111282[_0x3dfc('0x3d')],function(_0x2c6ae3){var _0x3a951a={};_0x3a951a[_0x2c6ae3]={'$like':'%'+_0x57538d['query'][_0x3dfc('0xbd')]+'%'};return _0x3a951a;})});}if(_0x57538d[_0x3dfc('0x3a')][_0x3dfc('0xbe')]){var _0x493736=_0x57538d['query'][_0x3dfc('0xbe')]['split'](',');var _0x186864={};_0x186864[_0x493736[0x0]]={'$gte':moment(_0x493736[0x1])['format'](_0x3dfc('0xbf'))};_0x111282['where']=_['merge'](_0x111282[_0x3dfc('0x44')],_0x186864);}_0x111282=_[_0x3dfc('0xb3')]({},_0x111282,_0x57538d[_0x3dfc('0xb4')]);return db[_0x3dfc('0xb7')]['count']({'where':_0x111282[_0x3dfc('0x44')]})[_0x3dfc('0x25')](function(_0x53d1eb){_0x2a09d[_0x3dfc('0x1c')]=_0x53d1eb;if(_0x57538d['query'][_0x3dfc('0xb1')]){_0x111282[_0x3dfc('0xb2')]=[{'all':!![]}];}return db[_0x3dfc('0xb7')][_0x3dfc('0xc0')](_0x111282);})[_0x3dfc('0x25')](function(_0x1b0b37){_0x2a09d['rows']=_0x1b0b37;return _0x2a09d;});}})[_0x3dfc('0x25')](respondWithFilteredResult(_0x30f4a4,_0x111282))[_0x3dfc('0xae')](handleError(_0x30f4a4,null));};exports[_0x3dfc('0xc1')]=function(_0x4b361f,_0x29d6b9,_0x4bc7ee){return db[_0x3dfc('0x33')][_0x3dfc('0x5d')]({'where':{'id':_0x4b361f['params']['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x29d6b9,null))[_0x3dfc('0x25')](function(_0x4a3fee){if(_0x4a3fee){return _0x4a3fee[_0x3dfc('0xc2')](_0x4b361f[_0x3dfc('0x71')][_0x3dfc('0xba')],_[_0x3dfc('0xb9')](_0x4b361f[_0x3dfc('0x71')],[_0x3dfc('0xba'),'id'])||{})[_0x3dfc('0xc3')](function(){return db[_0x3dfc('0xc4')]['findAll']({'attributes':['id',_0x3dfc('0x29'),_0x3dfc('0x47')],'where':{'id':_0x4b361f[_0x3dfc('0x71')][_0x3dfc('0xba')]}});})['then'](function(_0x2b8f13){socket[_0x3dfc('0xc5')]('openchannelInteractionTags:save',{'id':Number(_0x4b361f[_0x3dfc('0xb0')]['id']),'tags':_0x2b8f13||[]});return{'id':Number(_0x4b361f[_0x3dfc('0xb0')]['id']),'tags':_0x2b8f13||[]};});}})[_0x3dfc('0x25')](respondWithResult(_0x29d6b9,null))['catch'](handleError(_0x29d6b9,null));};exports[_0x3dfc('0xc6')]=function(_0x579635,_0x54e0d0,_0x427a49){return db[_0x3dfc('0x33')][_0x3dfc('0x5d')]({'where':{'id':_0x579635[_0x3dfc('0xb0')]['id']}})[_0x3dfc('0x25')](handleEntityNotFound(_0x54e0d0,null))[_0x3dfc('0x25')](function(_0x512a75){if(_0x512a75){return _0x512a75[_0x3dfc('0xc6')](_0x579635[_0x3dfc('0x3a')][_0x3dfc('0xba')]);}})[_0x3dfc('0x25')](respondWithStatusCode(_0x54e0d0,null))[_0x3dfc('0xae')](handleError(_0x54e0d0,null));};exports[_0x3dfc('0xc7')]=function(_0x28bc09,_0x5b7086){var _0x141db4=moment()[_0x3dfc('0xc8')]()[_0x3dfc('0x94')]();var _0x12c1f8=path['join'](config[_0x3dfc('0xc9')],_0x3dfc('0xca'),_0x3dfc('0xcb'),_0x3dfc('0xcc'));var _0x481d86=path[_0x3dfc('0xcd')](config['root'],_0x3dfc('0xca'),_0x3dfc('0xcb'),_0x3dfc('0xce'));var _0x23be26=path['join'](_0x12c1f8,_0x141db4);var _0x2993c9=util[_0x3dfc('0xcf')]('transcript-%d-%s.zip',_0x28bc09['params']['id'],_0x141db4);var _0x31a9c9=path['join'](_0x12c1f8,_0x2993c9);var _0x52f5f5=[];_0x52f5f5[_0x3dfc('0xab')]({'model':db[_0x3dfc('0x6b')],'as':_0x3dfc('0x6b'),'attributes':['id',_0x3dfc('0x2d')],'raw':!![]});_0x52f5f5[_0x3dfc('0xab')]({'model':db[_0x3dfc('0xd0')],'as':_0x3dfc('0xd1'),'attributes':['id',_0x3dfc('0xd2'),'lastName'],'raw':!![]});if(_0x28bc09['query']['attachments']){_0x52f5f5[_0x3dfc('0xab')]({'model':db[_0x3dfc('0xd3')],'as':_0x3dfc('0xd3'),'raw':!![]});}var _0x4faafd=[{'model':db['OpenchannelMessage'],'as':_0x3dfc('0xd4'),'attributes':['id',_0x3dfc('0x71'),'createdAt',_0x3dfc('0xd5'),_0x3dfc('0xd6'),_0x3dfc('0x7b')],'include':_0x52f5f5}];_0x4faafd[_0x3dfc('0xab')]({'model':db[_0x3dfc('0xd7')],'as':_0x3dfc('0xd8'),'attributes':['id',_0x3dfc('0x29')]});_0x4faafd[_0x3dfc('0xab')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x3dfc('0x33')][_0x3dfc('0x5d')]({'where':{'id':_0x28bc09[_0x3dfc('0xb0')]['id']},'include':_0x4faafd})[_0x3dfc('0x25')](handleEntityNotFound(_0x5b7086,null))[_0x3dfc('0x25')](function(_0x570951){if(_0x570951){var _0x45c09e=_0x570951['get']({'plain':!![]});fs[_0x3dfc('0xd9')](_0x23be26);var _0x4553a5={'format':'A4','border':_0x3dfc('0xda'),'header':{'height':_0x3dfc('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util[_0x3dfc('0xcf')](_0x3dfc('0xdc'),util[_0x3dfc('0xcf')]('%s\x20#%d',_0x3dfc('0xdd'),_0x45c09e['id']),moment()[_0x3dfc('0xcf')](_0x3dfc('0xde'))[_0x3dfc('0x94')]())}}};var _0x1bad93={'channel':'Openchannel','account':_0x45c09e[_0x3dfc('0xd8')][_0x3dfc('0x29')],'agent':_0x45c09e[_0x3dfc('0xdf')]?_0x45c09e['Owner'][_0x3dfc('0x2d')]:_0x3dfc('0xe0'),'createdAt':moment(_0x45c09e['createdAt'])[_0x3dfc('0xcf')](_0x3dfc('0xbf'))['toString'](),'closedAt':_0x45c09e[_0x3dfc('0xe1')]?moment(_0x45c09e[_0x3dfc('0xe2')])[_0x3dfc('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3dfc('0x94')]():'','disposition':_0x45c09e['disposition'],'visibility':_0x45c09e[_0x3dfc('0xe3')]?_0x3dfc('0xe4'):_0x3dfc('0xe5'),'messages':_(_0x45c09e['Messages'])['filter']({'secret':![]})[_0x3dfc('0x2c')](function(_0x238b9b){if(_0x238b9b['Attachment']){var _0x5c4c75=path[_0x3dfc('0xcd')](_0x481d86,_0x238b9b[_0x3dfc('0xd3')]['basename']);if(fs[_0x3dfc('0xe6')](_0x5c4c75)){fs['createReadStream'](_0x5c4c75)['pipe'](fs[_0x3dfc('0xe7')](path[_0x3dfc('0xcd')](_0x23be26,_0x238b9b[_0x3dfc('0xd3')][_0x3dfc('0xe8')])));}}return{'date':moment(_0x238b9b[_0x3dfc('0x77')])['format'](_0x3dfc('0xbf'))['toString'](),'sender':_0x238b9b[_0x3dfc('0xd5')]==='out'?_0x238b9b['User']?_0x238b9b[_0x3dfc('0x6b')][_0x3dfc('0x2d')]:_0x3dfc('0xe9'):_0x238b9b[_0x3dfc('0xd1')][_0x3dfc('0xd2')]+(_0x238b9b[_0x3dfc('0xd1')]['lastName']?'\x20'+_0x238b9b[_0x3dfc('0xd1')][_0x3dfc('0xea')]:''),'body':_0x238b9b[_0x3dfc('0xd3')]?_0x238b9b[_0x3dfc('0xd3')][_0x3dfc('0xe8')]:_0x238b9b['body'],'direction':_0x238b9b[_0x3dfc('0xd5')]==='out'?'A':'C','secret':_0x238b9b[_0x3dfc('0xd6')],'read':_0x238b9b[_0x3dfc('0x7b')],'attachment':_0x238b9b[_0x3dfc('0xd3')]};})['value']()};return ejs[_0x3dfc('0xeb')](path[_0x3dfc('0xcd')](config[_0x3dfc('0xc9')],'server',_0x3dfc('0xec'),_0x3dfc('0xed')),{'interaction':_0x1bad93})[_0x3dfc('0x25')](function(_0x28dda1){return new BPromise(function(_0x105241,_0x386538){pdf[_0x3dfc('0xb5')](_0x28dda1,_0x4553a5)[_0x3dfc('0xee')](path[_0x3dfc('0xcd')](_0x23be26,'transcript-'+_0x45c09e['id']+'-'+_0x141db4+_0x3dfc('0xef')),function(_0x8896e8,_0x176ab5){if(_0x8896e8)return _0x386538(_0x8896e8);_0x105241(_0x176ab5);});});})[_0x3dfc('0x25')](function(){return new BPromise(function(_0x454cf2,_0xdfba39){zipdir(_0x23be26,{'saveTo':_0x31a9c9},function(_0x43b112,_0x3b377b){if(_0x43b112)return _0xdfba39(_0x43b112);return _0x454cf2(_0x3b377b);});})[_0x3dfc('0x25')](function(){return new BPromise(function(_0x11b2ff,_0x451cae){rimraf(_0x23be26,function(_0x2f5f55){if(_0x2f5f55)_0x451cae(_0x2f5f55);return _0x11b2ff();});});})[_0x3dfc('0x25')](function(){return _0x5b7086[_0x3dfc('0xc7')](_0x31a9c9,_0x2993c9,function(_0xdeee91){if(_0xdeee91){console['log'](_0x3dfc('0xf0'),_0xdeee91);}else{fs[_0x3dfc('0xf1')](_0x31a9c9);}});});});}else{return _0x5b7086[_0x3dfc('0x1a')](0xc8);}})['catch'](handleError(_0x5b7086,null));}; \ No newline at end of file +var _0xb76a=['User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','start','body','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','merge','options','create','describe','OpenchannelMessage','addMessage','ids','omit','findOne','rawAttributes','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','files','join','server','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','get','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Openchannel','Owner','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','end','error','name','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0xe1f9c,_0x2dabd6){var _0x3850b3=function(_0x16dd01){while(--_0x16dd01){_0xe1f9c['push'](_0xe1f9c['shift']());}};_0x3850b3(++_0x2dabd6);}(_0xb76a,0x180));var _0xab76=function(_0x292e26,_0x22a93a){_0x292e26=_0x292e26-0x0;var _0x1bde9d=_0xb76a[_0x292e26];return _0x1bde9d;};'use strict';var pdf=require(_0xab76('0x0'));var emlformat=require(_0xab76('0x1'));var rimraf=require(_0xab76('0x2'));var zipdir=require(_0xab76('0x3'));var jsonpatch=require(_0xab76('0x4'));var rp=require(_0xab76('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab76('0x6'));var path=require('path');var sox=require(_0xab76('0x7'));var csv=require(_0xab76('0x8'));var ejs=require(_0xab76('0x9'));var fs=require('fs');var _=require(_0xab76('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab76('0xb'));var deskjs=require(_0xab76('0xc'));var toCsv=require(_0xab76('0x8'));var querystring=require(_0xab76('0xd'));var Papa=require(_0xab76('0xe'));var Redis=require(_0xab76('0xf'));var authService=require(_0xab76('0x10'));var qs=require(_0xab76('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab76('0x12'))(_0xab76('0x13'));var utils=require(_0xab76('0x14'));var config=require(_0xab76('0x15'));var licenseUtil=require(_0xab76('0x16'));var db=require(_0xab76('0x17'))['db'];config[_0xab76('0x18')]=_['defaults'](config['redis'],{'host':_0xab76('0x19'),'port':0x18eb});var socket=require(_0xab76('0x1a'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x44d3be,_0x11d253){_0x11d253=_0x11d253||0xcc;return function(_0xfbb6bd){if(_0xfbb6bd){return _0x44d3be[_0xab76('0x1b')](_0x11d253);}return _0x44d3be[_0xab76('0x1c')](_0x11d253)['end']();};}function respondWithResult(_0x48d614,_0x5953b2){_0x5953b2=_0x5953b2||0xc8;return function(_0x4472e4){if(_0x4472e4){return _0x48d614['status'](_0x5953b2)[_0xab76('0x1d')](_0x4472e4);}};}function respondWithFilteredResult(_0xeb1d1f,_0x461765){return function(_0x49b0eb){if(_0x49b0eb){var _0x2ea196=_0x49b0eb[_0xab76('0x1e')],_0x2676ac=_0x461765[_0xab76('0x1f')],_0x5ed06e=_0x461765[_0xab76('0x1f')]+_0x461765[_0xab76('0x20')],_0xd3b19d;if(_0x5ed06e>=_0x2ea196){_0x5ed06e=_0x2ea196;_0xd3b19d=0xc8;}else{_0xd3b19d=0xce;}_0xeb1d1f['status'](_0xd3b19d);return _0xeb1d1f[_0xab76('0x21')](_0xab76('0x22'),_0x2676ac+'-'+_0x5ed06e+'/'+_0x2ea196)[_0xab76('0x1d')](_0x49b0eb);}return null;};}function patchUpdates(_0x553b61){return function(_0x136f71){try{jsonpatch['apply'](_0x136f71,_0x553b61,!![]);}catch(_0x4dbf3a){return BPromise['reject'](_0x4dbf3a);}return _0x136f71[_0xab76('0x23')]();};}function saveUpdates(_0x870ff6,_0x282994){return function(_0x39e7b7){if(_0x39e7b7){return _0x39e7b7[_0xab76('0x24')](_0x870ff6)['then'](function(_0x379bd8){return _0x379bd8;});}return null;};}function removeEntity(_0x3dd01d,_0x53d3be){return function(_0x363b4a){if(_0x363b4a){return _0x363b4a[_0xab76('0x25')]()[_0xab76('0x26')](function(){_0x3dd01d['status'](0xcc)[_0xab76('0x27')]();});}};}function handleEntityNotFound(_0x449723,_0x3ed02d){return function(_0x45bf2b){if(!_0x45bf2b){_0x449723[_0xab76('0x1b')](0x194);}return _0x45bf2b;};}function handleError(_0x534741,_0x13464d){_0x13464d=_0x13464d||0x1f4;return function(_0x14d1e5){logger[_0xab76('0x28')](_0x14d1e5['stack']);if(_0x14d1e5[_0xab76('0x29')]){delete _0x14d1e5['name'];}_0x534741[_0xab76('0x1c')](_0x13464d)['send'](_0x14d1e5);};}function getInteractionUsers(_0x26a135,_0x1f000e){return new BPromise(function(_0x9808e,_0x28f8a9){try{if(_0x1f000e[_0x26a135['id']]){_0x26a135[_0xab76('0x2a')]=_[_0xab76('0x2b')](_0x1f000e[_0x26a135['id']],function(_0x31b1a3){return{'id':_0x31b1a3['id'],'fullname':_0x31b1a3[_0xab76('0x2c')]};});}}catch(_0x36ab9b){_0x28f8a9(_0x36ab9b);}_0x9808e(_0x26a135);});}function getInteractionTags(_0x1f20a5,_0x43a3c5){return new BPromise(function(_0x6cfdca,_0x4c6981){try{if(_0x1f20a5['TagIds']){_0x1f20a5[_0xab76('0x2d')]=[];_0x1f20a5[_0xab76('0x2e')][_0xab76('0x2f')](',')[_0xab76('0x30')](function(_0x56ac0f){_0x1f20a5[_0xab76('0x2d')][_0xab76('0x31')](_0x43a3c5[_0x56ac0f]);});}delete _0x1f20a5[_0xab76('0x2e')];}catch(_0x4a96d3){_0x4c6981(_0x4a96d3);}_0x6cfdca(_0x1f20a5);});}function updateOpenchannelInteraction(_0x53dc03,_0xb58dd1,_0x4b73aa){return new BPromise(function(_0x41cded,_0x2ddf9c){return getInteractionUsers(_0x53dc03,_0x4b73aa)[_0xab76('0x26')](function(_0x38102e){return getInteractionTags(_0x38102e,_0xb58dd1);})[_0xab76('0x26')](function(_0x1edb8d){_0x41cded(_0x1edb8d);})[_0xab76('0x32')](function(_0x488ba3){_0x2ddf9c(_0x488ba3);});});}exports[_0xab76('0x33')]=function(_0x53bf3a,_0x335b21){var _0xa0262e={},_0x2d9980={},_0x559eff={'count':0x0,'rows':[]};var _0xbd6fd7=_['map'](db[_0xab76('0x34')]['rawAttributes'],function(_0x5f3037){return{'name':_0x5f3037['fieldName'],'type':_0x5f3037[_0xab76('0x35')][_0xab76('0x36')]};});_0x2d9980['model']=_[_0xab76('0x2b')](_0xbd6fd7,_0xab76('0x29'));_0x2d9980['query']=_[_0xab76('0x37')](_0x53bf3a['query']);_0x2d9980[_0xab76('0x38')]=_[_0xab76('0x39')](_0x2d9980[_0xab76('0x3a')],_0x2d9980[_0xab76('0x3b')]);_0xa0262e[_0xab76('0x3c')]=_[_0xab76('0x39')](_0x2d9980[_0xab76('0x3a')],qs[_0xab76('0x3d')](_0x53bf3a['query'][_0xab76('0x3d')]));_0xa0262e['attributes']=_0xa0262e['attributes']['length']?_0xa0262e[_0xab76('0x3c')]:_0x2d9980['model'];if(!_0x53bf3a['query'][_0xab76('0x3e')](_0xab76('0x3f'))){_0xa0262e[_0xab76('0x20')]=qs[_0xab76('0x20')](_0x53bf3a[_0xab76('0x3b')]['limit']);_0xa0262e[_0xab76('0x1f')]=qs[_0xab76('0x1f')](_0x53bf3a[_0xab76('0x3b')][_0xab76('0x1f')]);}_0xa0262e[_0xab76('0x40')]=qs[_0xab76('0x41')](_0x53bf3a[_0xab76('0x3b')]['sort']);_0xa0262e[_0xab76('0x42')]=qs['filters'](_[_0xab76('0x43')](_0x53bf3a[_0xab76('0x3b')],_0x2d9980[_0xab76('0x38')]),_0xbd6fd7);var _0x19066d=[];var _0x43934d=squel['select']()['field']('id')[_0xab76('0x44')](_0xab76('0x29'))[_0xab76('0x44')](_0xab76('0x45'))[_0xab76('0x46')]('tools_tags');var _0x5b3e30=squel['select']()[_0xab76('0x44')](_0xab76('0x47'))[_0xab76('0x44')]('u.fullname')[_0xab76('0x44')](_0xab76('0x48'))[_0xab76('0x46')](_0xab76('0x49'),'ui')[_0xab76('0x4a')](_0xab76('0x4b'),'u',_0xab76('0x4c'));var _0x4c96cc=squel[_0xab76('0x4d')]()[_0xab76('0x46')](_0xab76('0x4e'),'i')[_0xab76('0x4a')](_0xab76('0x4f'),'c',_0xab76('0x50'))['left_join'](_0xab76('0x4b'),'o',_0xab76('0x51'))['left_join'](_0xab76('0x52'),'a',_0xab76('0x53'))[_0xab76('0x4a')]('openchannel_messages','me',_0xab76('0x54'))[_0xab76('0x4a')](_0xab76('0x55'),'it',_0xab76('0x56'))['left_join'](_0xab76('0x57'),'t',_0xab76('0x58'));var _0x5dfc30=squel[_0xab76('0x59')]();var _0x546293=[];var _0x4d0b0d=squel[_0xab76('0x59')]();var _0x1ab539;if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x5a')]){_0x1ab539=as[_0xab76('0x5b')](_0x53bf3a[_0xab76('0x3b')][_0xab76('0x5a')]);var _0x494811=_0x1ab539[_0xab76('0x5c')];for(var _0x4e3e72=0x0;_0x4e3e72<_0x1ab539['conditions'][_0xab76('0x5d')];_0x4e3e72++){var _0x19810b=_0x1ab539[_0xab76('0x5e')][_0x4e3e72];var _0x3bb2da='i';var _0x54e7df=_['find'](_0xbd6fd7,[_0xab76('0x29'),_0x19810b[_0xab76('0x44')]]);if(!_0x54e7df){switch(_0x19810b['field']){case _0xab76('0x5f'):if(_0x19810b['value']==0x1){_0x4c96cc[_0xab76('0x60')]('`'+_0x19810b[_0xab76('0x44')]+_0xab76('0x61'));}else{_0x4c96cc[_0xab76('0x60')]('`'+_0x19810b[_0xab76('0x44')]+'`\x20>\x200');}break;case _0xab76('0x62'):if(_0x19810b[_0xab76('0x63')]===_0xab76('0x64')){if(_0x19810b[_0xab76('0x65')][_0xab76('0x2f')]('\x20')['length']>0x1){_0x5dfc30[_0x494811]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x19810b[_0xab76('0x65')]),null);}else{var _0x582797='%'+_0x19810b[_0xab76('0x65')]+'%';_0x5dfc30[_0x494811](_0xab76('0x66'),_0x582797,_0x582797,_0x582797);}}else{_0x54e7df=_['find'](_0xbd6fd7,['name',_0xab76('0x67')]);_0x19810b['field']='ContactId';_0x1c64d2=as['buildExpression'](_0x3bb2da,_0x54e7df[_0xab76('0x35')],_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2[_0xab76('0x65')]['start'],_0x1c64d2[_0xab76('0x65')][_0xab76('0x27')]);}break;case _0xab76('0x69'):var _0x3b3bfd=_0x19810b[_0xab76('0x65')][_0xab76('0x2f')](',')[_0xab76('0x2b')](function(_0xa1b99b){return Number(_0xa1b99b);});_0x3b3bfd['forEach'](function(_0x1953e2){_0x4d0b0d['or'](_0xab76('0x6a'),'%,'+_0x1953e2+',%');});_0x546293=_[_0xab76('0x6b')](_0x546293,_0x3b3bfd);break;case _0xab76('0x6c'):if(_0x19810b[_0xab76('0x63')]===_0xab76('0x64')){_0x5dfc30[_0x494811](_0xab76('0x6d'),'%'+_0x19810b['value']+'%',null);}else{_0x54e7df=_[_0xab76('0x6e')](_0xbd6fd7,[_0xab76('0x29'),_0xab76('0x6f')]);_0x19810b['field']=_0xab76('0x6f');_0x1c64d2=as[_0xab76('0x70')](_0x3bb2da,_0x54e7df[_0xab76('0x35')],_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2['value'][_0xab76('0x71')],_0x1c64d2[_0xab76('0x65')][_0xab76('0x27')]);}break;case _0xab76('0x72'):_0x1c64d2=as['buildExpression']('me',null,_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2[_0xab76('0x65')]['start'],_0x1c64d2['value'][_0xab76('0x27')]);break;}}else{var _0x1c64d2=as[_0xab76('0x70')](_0x3bb2da,_0x54e7df['type'],_0x19810b);_0x5dfc30[_0x494811](_0x1c64d2[_0xab76('0x68')],_0x1c64d2['value']['start'],_0x1c64d2[_0xab76('0x65')][_0xab76('0x27')]);}}}else{var _0x22f74e=_(_0x53bf3a[_0xab76('0x3b')])[_0xab76('0x37')]()[_0xab76('0x2b')](function(_0x213a48){return _[_0xab76('0x73')](_0xbd6fd7,[_0xab76('0x29'),_0x213a48])?_0x213a48:undefined;})['compact']()[_0xab76('0x65')]();if(!_[_0xab76('0x74')](_0x22f74e)){_0x22f74e['forEach'](function(_0xdcef44){if(_0xdcef44===_0xab76('0x75')){_0x4c96cc[_0xab76('0x42')](_0xab76('0x76'),[][_0xab76('0x77')](_0x53bf3a[_0xab76('0x3b')][_0xdcef44]));}else if(_0xdcef44===_0xab76('0x78')){var _0x1012b2=JSON[_0xab76('0x79')](_0x53bf3a[_0xab76('0x3b')][_0xdcef44])[_0xab76('0x7a')];var _0x420365=JSON['parse'](_0x53bf3a['query'][_0xdcef44])[_0xab76('0x7b')];_0x4c96cc[_0xab76('0x42')](_0xab76('0x7c'),_0x1012b2,_0x420365);}else{if(_0x53bf3a[_0xab76('0x3b')][_0xdcef44]===_0xab76('0x7d')){_0x4c96cc[_0xab76('0x42')]('i.'+_0xdcef44+_0xab76('0x7e'));}else{_0x4c96cc[_0xab76('0x42')]('i.'+_0xdcef44+'\x20=\x20?',_0x53bf3a['query'][_0xdcef44]);}}});}if(_0x53bf3a['query'][_0xab76('0x7f')]){if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x7f')]==0x1){_0x4c96cc[_0xab76('0x60')](_0xab76('0x80'));}else{_0x4c96cc[_0xab76('0x60')](_0xab76('0x81'));}}if(_0x53bf3a[_0xab76('0x3b')]['tag']){_0x546293=_[_0xab76('0x82')](_0x53bf3a['query'][_0xab76('0x83')])?_0x53bf3a['query'][_0xab76('0x83')]:new Array(_0x53bf3a[_0xab76('0x3b')]['tag']);_0x546293[_0xab76('0x30')](function(_0x1d7618){_0x4d0b0d['or'](_0xab76('0x6a'),'%,'+_0x1d7618+',%');});}if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x84')]){var _0x3ded18=_0x53bf3a[_0xab76('0x3b')][_0xab76('0x84')][_0xab76('0x85')]('\x5c','\x5c\x5c')[_0xab76('0x85')](/'/g,'\x27\x27');if(qs[_0xab76('0x86')](_0x3ded18)){_0x5dfc30['or'](_0xab76('0x87'),_0x3ded18+'%');}else{_0x5dfc30['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xab76('0x88')](_0x3ded18))['or']('i.from\x20LIKE\x20?',_0x3ded18+'%')['or'](_0xab76('0x89'),_0x3ded18+'%');}}}_0x4c96cc['where'](_0x5dfc30);_0x4c96cc[_0xab76('0x8a')](_0xab76('0x8b'));var _0x45eca7={'type':db[_0xab76('0x8c')][_0xab76('0x8d')]['SELECT'],'raw':!![]};var _0x2f9bd8=_0x4c96cc[_0xab76('0x8e')]();_0x2f9bd8[_0xab76('0x44')](_0xab76('0x8b'));_0x2f9bd8[_0xab76('0x44')](_0xab76('0x8f'),_0xab76('0x5f'));if(_0xa0262e['order']){_0xa0262e[_0xab76('0x40')][_0xab76('0x30')](function(_0xdc6f65){var _0x524929=_0xdc6f65[0x0]==='contactName'?_0xdc6f65[0x0]:'i.'+_0xdc6f65[0x0];_0x4c96cc['order'](_0x524929,_0xdc6f65[0x1]==='DESC'?![]:!![]);});}if(!_[_0xab76('0x74')](_0x546293)){_0x4c96cc[_0xab76('0x60')](_0x4d0b0d);_0x2f9bd8[_0xab76('0x42')](_0xab76('0x90'),_0x546293);}BPromise[_0xab76('0x91')]()[_0xab76('0x26')](function(){if(!_0x1ab539){if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x75')]||_0x53bf3a[_0xab76('0x3b')][_0xab76('0x92')])return;_0x2f9bd8[_0xab76('0x42')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4c96cc['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x53bf3a[_0xab76('0x93')]['role']!=='agent')return;return _0x53bf3a[_0xab76('0x93')][_0xab76('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1203c0){if(_['isEmpty'](_0x1203c0)){_0x2f9bd8[_0xab76('0x42')](_0xab76('0x95'));_0x4c96cc['where'](_0xab76('0x95'));}else{_0x2f9bd8['where'](_0xab76('0x76'),_[_0xab76('0x2b')](_0x1203c0,'id'));_0x4c96cc['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xab76('0x2b')](_0x1203c0,'id'));}});})[_0xab76('0x26')](function(){if(_0x53bf3a[_0xab76('0x93')]['role']===_0xab76('0x96')&&!_0x1ab539&&!_0x53bf3a[_0xab76('0x3b')][_0xab76('0x75')])return[];return db['sequelize'][_0xab76('0x3b')](_0x2f9bd8[_0xab76('0x97')](),_0x45eca7);})[_0xab76('0x26')](function(_0x3f6bf5){_0x559eff[_0xab76('0x1e')]=_0x3f6bf5[_0xab76('0x5d')];if(_0x559eff[_0xab76('0x1e')]===0x0)return[];return db[_0xab76('0x98')][_0xab76('0x3b')](_0x43934d[_0xab76('0x97')](),_0x45eca7)[_0xab76('0x26')](function(_0x55e8db){_0x19066d=_[_0xab76('0x99')](_0x55e8db,'id');_0x45eca7=_['merge'](_0x45eca7,{'model':db[_0xab76('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53bf3a[_0xab76('0x3b')][_0xab76('0x3d')]){_0xa0262e[_0xab76('0x3c')][_0xab76('0x30')](function(_0x5e6173){_0x4c96cc[_0xab76('0x44')]('i.'+_0x5e6173);});}else{_0x4c96cc[_0xab76('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4c96cc['field'](_0xab76('0x9a'),_0xab76('0x9b'));_0x4c96cc[_0xab76('0x44')](_0xab76('0x9c'),_0xab76('0x9d'));_0x4c96cc[_0xab76('0x44')](_0xab76('0x9e'),_0xab76('0x9f'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa0'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa1'),_0xab76('0xa2'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa3'),_0xab76('0xa4'));_0x4c96cc[_0xab76('0x44')]('c.email','Contact.email');_0x4c96cc['field'](_0xab76('0xa5'),_0xab76('0xa6'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa7'),_0xab76('0xa8'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xa9'),_0xab76('0xaa'));_0x4c96cc['field'](_0xab76('0xab'),_0xab76('0xac'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xad'),_0xab76('0xae'));_0x4c96cc[_0xab76('0x44')](_0xab76('0xaf'),_0xab76('0x2e'));}if(_0xa0262e['limit'])_0x4c96cc[_0xab76('0x20')](_0xa0262e['limit']);if(_0xa0262e[_0xab76('0x1f')])_0x4c96cc[_0xab76('0x1f')](_0xa0262e[_0xab76('0x1f')]);return db[_0xab76('0x98')][_0xab76('0x3b')](_0x4c96cc[_0xab76('0x97')](),_0x45eca7);})['then'](function(_0x235e57){_0x5b3e30[_0xab76('0x42')](_0xab76('0xb0'),_[_0xab76('0x2b')](_0x235e57,'id'));return db[_0xab76('0x98')][_0xab76('0x3b')](_0x5b3e30[_0xab76('0x97')](),_0x45eca7)[_0xab76('0x26')](function(_0x282755){var _0x59488f=_[_0xab76('0xb1')](_0x282755,_0xab76('0xb2'));var _0x475b23=[];_0x235e57[_0xab76('0x30')](function(_0x40f89f){_0x475b23[_0xab76('0x31')](updateOpenchannelInteraction(_0x40f89f,_0x19066d,_0x59488f));});return BPromise[_0xab76('0xb3')](_0x475b23);});});})[_0xab76('0x26')](function(_0x7ba614){_0x559eff[_0xab76('0xb4')]=_0x7ba614;return _0x559eff;})[_0xab76('0x26')](respondWithFilteredResult(_0x335b21,_0xa0262e))['catch'](handleError(_0x335b21,null));};exports[_0xab76('0xb5')]=function(_0x1590c5,_0x1b3688){var _0xdcf38={};if(_0x1590c5['query'][_0xab76('0x35')]&&_0x1590c5['query'][_0xab76('0x35')]===_0xab76('0x46')){_0xdcf38[_0xab76('0x46')]=_0x1590c5[_0xab76('0xb6')]['id'];}else{_0xdcf38['id']=_0x1590c5[_0xab76('0xb6')]['id'];}var _0x5b46b7={'raw':![],'where':_0xdcf38},_0x269691={};_0x269691[_0xab76('0x3a')]=_[_0xab76('0x37')](db[_0xab76('0x34')]['rawAttributes']);_0x269691['query']=_['keys'](_0x1590c5[_0xab76('0x3b')]);_0x269691[_0xab76('0x38')]=_[_0xab76('0x39')](_0x269691[_0xab76('0x3a')],_0x269691[_0xab76('0x3b')]);_0x5b46b7[_0xab76('0x3c')]=_[_0xab76('0x39')](_0x269691[_0xab76('0x3a')],qs[_0xab76('0x3d')](_0x1590c5[_0xab76('0x3b')][_0xab76('0x3d')]));_0x5b46b7[_0xab76('0x3c')]=_0x5b46b7['attributes'][_0xab76('0x5d')]?_0x5b46b7[_0xab76('0x3c')]:_0x269691[_0xab76('0x3a')];if(_0x1590c5[_0xab76('0x3b')]['includeAll']){_0x5b46b7[_0xab76('0xb7')]=[{'all':!![]}];}_0x5b46b7=_[_0xab76('0xb8')]({},_0x5b46b7,_0x1590c5[_0xab76('0xb9')]);return db['OpenchannelInteraction'][_0xab76('0x6e')](_0x5b46b7)[_0xab76('0x26')](handleEntityNotFound(_0x1b3688,null))[_0xab76('0x26')](respondWithResult(_0x1b3688,null))[_0xab76('0x32')](handleError(_0x1b3688,null));};exports[_0xab76('0xba')]=function(_0x23a1d7,_0x38c591){return db['OpenchannelInteraction'][_0xab76('0xba')](_0x23a1d7[_0xab76('0x72')],{})[_0xab76('0x26')](respondWithResult(_0x38c591,0xc9))[_0xab76('0x32')](handleError(_0x38c591,null));};exports[_0xab76('0x24')]=function(_0x2195ba,_0x3b8475){if(_0x2195ba[_0xab76('0x72')]['id']){delete _0x2195ba[_0xab76('0x72')]['id'];}return db['OpenchannelInteraction'][_0xab76('0x6e')]({'where':{'id':_0x2195ba[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x3b8475,null))[_0xab76('0x26')](saveUpdates(_0x2195ba['body'],null))[_0xab76('0x26')](respondWithResult(_0x3b8475,null))[_0xab76('0x32')](handleError(_0x3b8475,null));};exports[_0xab76('0x25')]=function(_0x2b71f1,_0x4b78e4){return db[_0xab76('0x34')]['find']({'where':{'id':_0x2b71f1[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x4b78e4,null))[_0xab76('0x26')](removeEntity(_0x4b78e4,null))['catch'](handleError(_0x4b78e4,null));};exports[_0xab76('0xbb')]=function(_0x1b928b,_0x5af2c0){return db[_0xab76('0x34')]['describe']()[_0xab76('0x26')](respondWithResult(_0x5af2c0,null))[_0xab76('0x32')](handleError(_0x5af2c0,null));};exports['addMessage']=function(_0x1161ba,_0x25ce00,_0x3ac62b){return db[_0xab76('0xbc')][_0xab76('0x6e')]({'where':{'id':_0x1161ba['params']['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x25ce00,null))[_0xab76('0x26')](function(_0x455df9){if(_0x455df9){return _0x455df9[_0xab76('0xbd')](_0x1161ba[_0xab76('0x72')][_0xab76('0xbe')],_[_0xab76('0xbf')](_0x1161ba['body'],[_0xab76('0xbe'),'id'])||{});}})[_0xab76('0x26')](respondWithResult(_0x25ce00,null))[_0xab76('0x32')](handleError(_0x25ce00,null));};exports['getMessages']=function(_0xd0b563,_0x3e1228,_0x54fec3){var _0xde3388={'raw':![],'where':{}};var _0x514c4b={};var _0x13cba6={'count':0x0,'rows':[]};return db[_0xab76('0x34')][_0xab76('0xc0')]({'where':{'id':_0xd0b563[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x3e1228,null))[_0xab76('0x26')](function(_0x438f2f){if(_0x438f2f){_0x514c4b[_0xab76('0x3a')]=_[_0xab76('0x37')](db['OpenchannelMessage'][_0xab76('0xc1')]);_0x514c4b[_0xab76('0x3b')]=_[_0xab76('0x37')](_0xd0b563[_0xab76('0x3b')]);_0x514c4b['filters']=_[_0xab76('0x39')](_0x514c4b['model'],_0x514c4b[_0xab76('0x3b')]);_0xde3388['attributes']=_[_0xab76('0x39')](_0x514c4b[_0xab76('0x3a')],qs[_0xab76('0x3d')](_0xd0b563[_0xab76('0x3b')][_0xab76('0x3d')]));_0xde3388[_0xab76('0x3c')]=_0xde3388[_0xab76('0x3c')][_0xab76('0x5d')]?_0xde3388[_0xab76('0x3c')]:_0x514c4b[_0xab76('0x3a')];if(!_0xd0b563[_0xab76('0x3b')][_0xab76('0x3e')]('nolimit')){_0xde3388[_0xab76('0x20')]=qs[_0xab76('0x20')](_0xd0b563[_0xab76('0x3b')]['limit']);_0xde3388[_0xab76('0x1f')]=qs[_0xab76('0x1f')](_0xd0b563[_0xab76('0x3b')]['offset']);}_0xde3388[_0xab76('0x40')]=qs[_0xab76('0x41')](_0xd0b563[_0xab76('0x3b')][_0xab76('0x41')]);_0xde3388[_0xab76('0x42')]=qs[_0xab76('0x38')](_[_0xab76('0x43')](_0xd0b563[_0xab76('0x3b')],_0x514c4b['filters']));_0xde3388['where'][_0xab76('0xb2')]=_0x438f2f['id'];if(_0xd0b563[_0xab76('0x3b')][_0xab76('0x84')]){_0xde3388['where']=_[_0xab76('0xb8')](_0xde3388['where'],{'$or':_['map'](_0xde3388[_0xab76('0x3c')],function(_0x5a7619){var _0x2e388d={};_0x2e388d[_0x5a7619]={'$like':'%'+_0xd0b563['query'][_0xab76('0x84')]+'%'};return _0x2e388d;})});}if(_0xd0b563[_0xab76('0x3b')]['$gte']){var _0x8a99b1=_0xd0b563['query'][_0xab76('0x7a')][_0xab76('0x2f')](',');var _0x4a86a2={};_0x4a86a2[_0x8a99b1[0x0]]={'$gte':moment(_0x8a99b1[0x1])['format'](_0xab76('0xc2'))};_0xde3388[_0xab76('0x42')]=_[_0xab76('0xb8')](_0xde3388[_0xab76('0x42')],_0x4a86a2);}_0xde3388=_[_0xab76('0xb8')]({},_0xde3388,_0xd0b563[_0xab76('0xb9')]);return db[_0xab76('0xbc')][_0xab76('0x1e')]({'where':_0xde3388[_0xab76('0x42')]})[_0xab76('0x26')](function(_0x3977dc){_0x13cba6[_0xab76('0x1e')]=_0x3977dc;if(_0xd0b563[_0xab76('0x3b')][_0xab76('0xc3')]){_0xde3388[_0xab76('0xb7')]=[{'all':!![]}];}return db[_0xab76('0xbc')][_0xab76('0xc4')](_0xde3388);})[_0xab76('0x26')](function(_0x11bb48){_0x13cba6[_0xab76('0xb4')]=_0x11bb48;return _0x13cba6;});}})['then'](respondWithFilteredResult(_0x3e1228,_0xde3388))[_0xab76('0x32')](handleError(_0x3e1228,null));};exports[_0xab76('0xc5')]=function(_0x199961,_0x4026c4,_0xa2cf6){return db[_0xab76('0x34')][_0xab76('0x6e')]({'where':{'id':_0x199961[_0xab76('0xb6')]['id']}})[_0xab76('0x26')](handleEntityNotFound(_0x4026c4,null))[_0xab76('0x26')](function(_0x544fe4){if(_0x544fe4){return _0x544fe4[_0xab76('0xc6')](_0x199961[_0xab76('0x72')][_0xab76('0xbe')],_['omit'](_0x199961['body'],[_0xab76('0xbe'),'id'])||{})[_0xab76('0xc7')](function(){return db[_0xab76('0x69')][_0xab76('0xc4')]({'attributes':['id',_0xab76('0x29'),_0xab76('0x45')],'where':{'id':_0x199961[_0xab76('0x72')][_0xab76('0xbe')]}});})[_0xab76('0x26')](function(_0x4e59cc){socket[_0xab76('0xc8')](_0xab76('0xc9'),{'id':Number(_0x199961[_0xab76('0xb6')]['id']),'tags':_0x4e59cc||[]});return{'id':Number(_0x199961['params']['id']),'tags':_0x4e59cc||[]};});}})[_0xab76('0x26')](respondWithResult(_0x4026c4,null))[_0xab76('0x32')](handleError(_0x4026c4,null));};exports[_0xab76('0xca')]=function(_0x4143fa,_0x15388d,_0x43517d){return db[_0xab76('0x34')][_0xab76('0x6e')]({'where':{'id':_0x4143fa['params']['id']}})['then'](handleEntityNotFound(_0x15388d,null))['then'](function(_0x4534dc){if(_0x4534dc){return _0x4534dc[_0xab76('0xca')](_0x4143fa[_0xab76('0x3b')][_0xab76('0xbe')]);}})[_0xab76('0x26')](respondWithStatusCode(_0x15388d,null))[_0xab76('0x32')](handleError(_0x15388d,null));};exports[_0xab76('0xcb')]=function(_0x2a4192,_0x34b9c2){var _0x449f8c=moment()[_0xab76('0xcc')]()[_0xab76('0x97')]();var _0x22c32b=path['join'](config[_0xab76('0xcd')],'server',_0xab76('0xce'),'tmp');var _0x57eaad=path[_0xab76('0xcf')](config['root'],_0xab76('0xd0'),_0xab76('0xce'),_0xab76('0xd1'));var _0x1d369c=path[_0xab76('0xcf')](_0x22c32b,_0x449f8c);var _0x4cae37=util[_0xab76('0xd2')](_0xab76('0xd3'),_0x2a4192[_0xab76('0xb6')]['id'],_0x449f8c);var _0x824b7f=path[_0xab76('0xcf')](_0x22c32b,_0x4cae37);var _0x40c795=[];_0x40c795[_0xab76('0x31')]({'model':db['User'],'as':_0xab76('0x6c'),'attributes':['id',_0xab76('0x2c')],'raw':!![]});_0x40c795[_0xab76('0x31')]({'model':db[_0xab76('0xd4')],'as':_0xab76('0x62'),'attributes':['id',_0xab76('0xd5'),_0xab76('0xd6')],'raw':!![]});if(_0x2a4192[_0xab76('0x3b')][_0xab76('0xd1')]){_0x40c795[_0xab76('0x31')]({'model':db[_0xab76('0xd7')],'as':_0xab76('0xd7'),'raw':!![]});}var _0x3ec5f5=[{'model':db['OpenchannelMessage'],'as':_0xab76('0xd8'),'attributes':['id',_0xab76('0x72'),_0xab76('0x78'),'direction',_0xab76('0xd9'),_0xab76('0x7f')],'include':_0x40c795}];_0x3ec5f5[_0xab76('0x31')]({'model':db[_0xab76('0xda')],'as':_0xab76('0xdb'),'attributes':['id',_0xab76('0x29')]});_0x3ec5f5['push']({'model':db[_0xab76('0x6c')],'as':'Owner','attributes':['id',_0xab76('0x2c')]});return db[_0xab76('0x34')][_0xab76('0x6e')]({'where':{'id':_0x2a4192[_0xab76('0xb6')]['id']},'include':_0x3ec5f5})[_0xab76('0x26')](handleEntityNotFound(_0x34b9c2,null))[_0xab76('0x26')](function(_0x5687d2){if(_0x5687d2){var _0x4810cb=_0x5687d2[_0xab76('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x1d369c);var _0x7e9d08={'format':'A4','border':'10px','header':{'height':_0xab76('0xdd'),'contents':{'first':_0xab76('0xde')}},'footer':{'height':_0xab76('0xdf'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0xab76('0xd2')](_0xab76('0xe0'),_0xab76('0xe1'),_0x4810cb['id']),moment()[_0xab76('0xd2')]('YYYY-MM-DD')['toString']())}}};var _0x299a27={'channel':_0xab76('0xe1'),'account':_0x4810cb[_0xab76('0xdb')]['name'],'agent':_0x4810cb[_0xab76('0xe2')]?_0x4810cb[_0xab76('0xe2')]['fullname']:'N.A.','createdAt':moment(_0x4810cb[_0xab76('0x78')])['format'](_0xab76('0xc2'))['toString'](),'closedAt':_0x4810cb[_0xab76('0xe3')]?moment(_0x4810cb[_0xab76('0xe4')])[_0xab76('0xd2')](_0xab76('0xc2'))[_0xab76('0x97')]():'','disposition':_0x4810cb['disposition'],'visibility':_0x4810cb[_0xab76('0xe5')]?_0xab76('0xe6'):_0xab76('0xe7'),'messages':_(_0x4810cb['Messages'])[_0xab76('0x84')]({'secret':![]})['map'](function(_0x3c6c3a){if(_0x3c6c3a[_0xab76('0xd7')]){var _0x42c062=path[_0xab76('0xcf')](_0x57eaad,_0x3c6c3a[_0xab76('0xd7')][_0xab76('0xe8')]);if(fs[_0xab76('0xe9')](_0x42c062)){fs[_0xab76('0xea')](_0x42c062)[_0xab76('0xeb')](fs[_0xab76('0xec')](path[_0xab76('0xcf')](_0x1d369c,_0x3c6c3a[_0xab76('0xd7')][_0xab76('0xe8')])));}}return{'date':moment(_0x3c6c3a[_0xab76('0x78')])[_0xab76('0xd2')](_0xab76('0xc2'))[_0xab76('0x97')](),'sender':_0x3c6c3a['direction']===_0xab76('0xed')?_0x3c6c3a[_0xab76('0x6c')]?_0x3c6c3a[_0xab76('0x6c')][_0xab76('0x2c')]:'System':_0x3c6c3a[_0xab76('0x62')][_0xab76('0xd5')]+(_0x3c6c3a['Contact'][_0xab76('0xd6')]?'\x20'+_0x3c6c3a[_0xab76('0x62')][_0xab76('0xd6')]:''),'body':_0x3c6c3a[_0xab76('0xd7')]?_0x3c6c3a[_0xab76('0xd7')]['basename']:_0x3c6c3a[_0xab76('0x72')],'direction':_0x3c6c3a['direction']==='out'?'A':'C','secret':_0x3c6c3a['secret'],'read':_0x3c6c3a[_0xab76('0x7f')],'attachment':_0x3c6c3a[_0xab76('0xd7')]};})['value']()};return ejs[_0xab76('0xee')](path['join'](config[_0xab76('0xcd')],_0xab76('0xd0'),_0xab76('0xef'),_0xab76('0xf0')),{'interaction':_0x299a27})[_0xab76('0x26')](function(_0x47c41c){return new BPromise(function(_0x3c9ae1,_0xcf441c){pdf[_0xab76('0xba')](_0x47c41c,_0x7e9d08)[_0xab76('0xf1')](path[_0xab76('0xcf')](_0x1d369c,_0xab76('0xf2')+_0x4810cb['id']+'-'+_0x449f8c+'.pdf'),function(_0x3c77a4,_0x1c0117){if(_0x3c77a4)return _0xcf441c(_0x3c77a4);_0x3c9ae1(_0x1c0117);});});})[_0xab76('0x26')](function(){return new BPromise(function(_0x585e3e,_0x28e227){zipdir(_0x1d369c,{'saveTo':_0x824b7f},function(_0x32bfa6,_0x51604a){if(_0x32bfa6)return _0x28e227(_0x32bfa6);return _0x585e3e(_0x51604a);});})[_0xab76('0x26')](function(){return new BPromise(function(_0x16c1c9,_0x46c0b3){rimraf(_0x1d369c,function(_0x4df44b){if(_0x4df44b)_0x46c0b3(_0x4df44b);return _0x16c1c9();});});})[_0xab76('0x26')](function(){return _0x34b9c2[_0xab76('0xcb')](_0x824b7f,_0x4cae37,function(_0x172a25){if(_0x172a25){console[_0xab76('0xf3')](_0xab76('0xf4'),_0x172a25);}else{fs[_0xab76('0xf5')](_0x824b7f);}});});});}else{return _0x34b9c2[_0xab76('0x1b')](0xc8);}})[_0xab76('0x32')](handleError(_0x34b9c2,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7641fba..6c681d5 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 _0xaae4=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','unreadMessages','length','emit','hook','exports','events'];(function(_0x5c0c5e,_0x1f38f1){var _0x59bcb6=function(_0x52f879){while(--_0x52f879){_0x5c0c5e['push'](_0x5c0c5e['shift']());}};_0x59bcb6(++_0x1f38f1);}(_0xaae4,0x149));var _0x4aae=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xaae4[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x4aae('0x0'));var OpenchannelInteraction=require(_0x4aae('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x4aae('0x1'))['db'][_0x4aae('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4aae('0x3')](0x0);var events={'afterCreate':_0x4aae('0x4'),'afterUpdate':_0x4aae('0x5'),'afterDestroy':_0x4aae('0x6')};function emitEvent(_0x1c4662){return function(_0x3c4fd7,_0x171f78,_0x4267f1){_0x3c4fd7['getUsers']({'attributes':['id'],'raw':!![]})[_0x4aae('0x7')](function(_0x5e096f){_0x3c4fd7['setDataValue'](_0x4aae('0x8'),_0x5e096f[_0x4aae('0x9')](function(_0x4d6cf7){return{'id':_0x4d6cf7['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3c4fd7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4aae('0x7')](function(_0x39331c){_0x3c4fd7['setDataValue'](_0x4aae('0xa'),_0x39331c[_0x4aae('0xb')]);OpenchannelInteractionEvents[_0x4aae('0xc')](_0x1c4662+':'+_0x3c4fd7['id'],_0x3c4fd7);OpenchannelInteractionEvents['emit'](_0x1c4662,_0x3c4fd7);_0x4267f1(null);})['catch'](_0x4267f1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x4aae('0xd')](e,emitEvent(event));}}module[_0x4aae('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x0ad8=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x2a9aa3,_0x168d70){var _0x316e20=function(_0xd36806){while(--_0xd36806){_0x2a9aa3['push'](_0x2a9aa3['shift']());}};_0x316e20(++_0x168d70);}(_0x0ad8,0x145));var _0x80ad=function(_0x5c4a10,_0xfa273e){_0x5c4a10=_0x5c4a10-0x0;var _0x153ab7=_0x0ad8[_0x5c4a10];return _0x153ab7;};'use strict';var EventEmitter=require(_0x80ad('0x0'));var OpenchannelInteraction=require(_0x80ad('0x1'))['db'][_0x80ad('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x80ad('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x80ad('0x4')](0x0);var events={'afterCreate':_0x80ad('0x5'),'afterUpdate':_0x80ad('0x6'),'afterDestroy':_0x80ad('0x7')};function emitEvent(_0x79ba94){return function(_0x3052c0,_0x146aa9,_0x3b67c7){_0x3052c0['getUsers']({'attributes':['id'],'raw':!![]})[_0x80ad('0x8')](function(_0x45ae0d){_0x3052c0[_0x80ad('0x9')](_0x80ad('0xa'),_0x45ae0d[_0x80ad('0xb')](function(_0x521446){return{'id':_0x521446['id']};}));return OpenchannelMessage[_0x80ad('0xc')]({'where':{'OpenchannelInteractionId':_0x3052c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x80ad('0x8')](function(_0x1fb969){_0x3052c0[_0x80ad('0x9')](_0x80ad('0xd'),_0x1fb969[_0x80ad('0xe')]);OpenchannelInteractionEvents[_0x80ad('0xf')](_0x79ba94+':'+_0x3052c0['id'],_0x3052c0);OpenchannelInteractionEvents[_0x80ad('0xf')](_0x79ba94,_0x3052c0);_0x3b67c7(null);})[_0x80ad('0x10')](_0x3b67c7(null));};}for(var e in events){if(events[_0x80ad('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x80ad('0x12')](e,emitEvent(event));}}module[_0x80ad('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e87d55f..9958361 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 _0x2eb2=['request-promise','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x58fe6d,_0x33f94f){var _0x32309f=function(_0x2f8065){while(--_0x2f8065){_0x58fe6d['push'](_0x58fe6d['shift']());}};_0x32309f(++_0x33f94f);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x2eb2[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33ddef,_0x3375d6,_0x419601){if(_0x33ddef[_0x22eb('0xb')](_0x22eb('0xc'))){_0x33ddef[_0x22eb('0xd')]=moment()['format'](_0x22eb('0xe'));}_0x419601(null,_0x33ddef);}}});}; \ No newline at end of file +var _0x7fbe=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment'];(function(_0x39f337,_0x1c137c){var _0x1f9754=function(_0x520869){while(--_0x520869){_0x39f337['push'](_0x39f337['shift']());}};_0x1f9754(++_0x1c137c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3677fc,_0x187168){_0x3677fc=_0x3677fc-0x0;var _0x183fc3=_0x7fbe[_0x3677fc];return _0x183fc3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x213ebc,_0x228f6b,_0x1d0741){if(_0x213ebc[_0xe7fb('0xc')]('closed')){_0x213ebc['closedAt']=moment()[_0xe7fb('0xd')](_0xe7fb('0xe'));}_0x1d0741(null,_0x213ebc);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index f48492d..1afc8ed 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 _0xa163=['AddTagsToOpenchannelInteraction','find','body','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelInteraction,\x20%s,\x20%s','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes'];(function(_0xae8375,_0x542d59){var _0x189cdf=function(_0x9215cf){while(--_0x9215cf){_0xae8375['push'](_0xae8375['shift']());}};_0x189cdf(++_0x542d59);}(_0xa163,0x12d));var _0x3a16=function(_0x50d83c,_0x2cea1d){_0x50d83c=_0x50d83c-0x0;var _0x12f92f=_0xa163[_0x50d83c];return _0x12f92f;};'use strict';var _=require(_0x3a16('0x0'));var util=require(_0x3a16('0x1'));var moment=require(_0x3a16('0x2'));var BPromise=require(_0x3a16('0x3'));var rs=require(_0x3a16('0x4'));var fs=require('fs');var Redis=require(_0x3a16('0x5'));var db=require(_0x3a16('0x6'))['db'];var utils=require(_0x3a16('0x7'));var logger=require(_0x3a16('0x8'))('rpc');var config=require(_0x3a16('0x9'));var jayson=require(_0x3a16('0xa'));var client=jayson[_0x3a16('0xb')][_0x3a16('0xc')]({'port':0x232a});config[_0x3a16('0xd')]=_['defaults'](config[_0x3a16('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a16('0xe'))(new Redis(config[_0x3a16('0xd')]));require(_0x3a16('0xf'))['register'](socket);function respondWithRpcPromise(_0x22ca7b,_0xc07920,_0x7fbb73){return new BPromise(function(_0x41c75d,_0xd88c86){return client[_0x3a16('0x10')](_0x22ca7b,_0x7fbb73)[_0x3a16('0x11')](function(_0x358725){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xc07920,_0x3a16('0x12'));logger[_0x3a16('0x13')](_0x3a16('0x14'),_0xc07920,_0x3a16('0x12'),JSON[_0x3a16('0x15')](_0x358725));if(_0x358725[_0x3a16('0x16')]){if(_0x358725[_0x3a16('0x16')][_0x3a16('0x17')]===0x1f4){logger[_0x3a16('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0xc07920,_0x358725['error']['message']);return _0xd88c86(_0x358725[_0x3a16('0x16')]['message']);}logger[_0x3a16('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0xc07920,_0x358725[_0x3a16('0x16')]['message']);return _0x41c75d(_0x358725[_0x3a16('0x16')][_0x3a16('0x18')]);}else{logger[_0x3a16('0x19')](_0x3a16('0x1a'),_0xc07920,_0x3a16('0x12'));_0x41c75d(_0x358725[_0x3a16('0x1b')][_0x3a16('0x18')]);}})['catch'](function(_0x5e6a5e){logger[_0x3a16('0x16')](_0x3a16('0x1a'),_0xc07920,_0x5e6a5e);_0xd88c86(_0x5e6a5e);});});}exports[_0x3a16('0x1c')]=function(_0x2443a7){var _0x1a177c=this;return new Promise(function(_0x579cd5,_0x1c292a){return db[_0x3a16('0x1d')][_0x3a16('0x1e')](_0x2443a7['body'],{'raw':_0x2443a7[_0x3a16('0x1f')]?_0x2443a7['options'][_0x3a16('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2443a7[_0x3a16('0x1f')]?_0x2443a7['options'][_0x3a16('0x21')]||null:null,'attributes':_0x2443a7['options']?_0x2443a7[_0x3a16('0x1f')][_0x3a16('0x22')]||null:null,'limit':_0x2443a7[_0x3a16('0x1f')]?_0x2443a7[_0x3a16('0x1f')]['limit']||null:null})[_0x3a16('0x11')](function(_0x30e75f){logger[_0x3a16('0x19')]('UpdateOpenchannelInteraction',_0x2443a7);logger[_0x3a16('0x13')](_0x3a16('0x1c'),_0x2443a7,JSON[_0x3a16('0x15')](_0x30e75f));_0x579cd5(_0x30e75f);})['catch'](function(_0x4241c2){logger[_0x3a16('0x16')](_0x3a16('0x1c'),_0x4241c2[_0x3a16('0x18')],_0x2443a7);_0x1c292a(_0x1a177c[_0x3a16('0x16')](0x1f4,_0x4241c2[_0x3a16('0x18')]));});});};exports[_0x3a16('0x23')]=function(_0x3dce3a){return new Promise(function(_0x97c78f,_0x2e52b6){return db[_0x3a16('0x1d')][_0x3a16('0x24')]({'where':_0x3dce3a['options']?_0x3dce3a[_0x3a16('0x1f')][_0x3a16('0x21')]||null:null})[_0x3a16('0x11')](function(_0xff0f8a){if(_0xff0f8a){return _0xff0f8a['addTags'](_0x3dce3a[_0x3a16('0x25')]['ids'],_['omit'](_0x3dce3a['body'],[_0x3a16('0x26'),'id'])||{});}})[_0x3a16('0x27')](function(_0x2e06e3){logger['info'](_0x3a16('0x28'),_0x3dce3a);logger[_0x3a16('0x13')]('AddTags',_0x3dce3a,JSON[_0x3a16('0x15')](_0x2e06e3));_0x97c78f(_0x2e06e3);})[_0x3a16('0x29')](function(_0x508e53){logger[_0x3a16('0x16')]('AddTags',_0x508e53['message'],_0x3dce3a);_0x2e52b6(_this[_0x3a16('0x16')](0x1f4,_0x508e53[_0x3a16('0x18')]));});});}; \ No newline at end of file +var _0x3629=['update','body','options','raw','attributes','then','AddTagsToOpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','UpdateOpenchannelInteraction','OpenchannelInteraction'];(function(_0x48fdef,_0x386060){var _0x50f85d=function(_0x2dc034){while(--_0x2dc034){_0x48fdef['push'](_0x48fdef['shift']());}};_0x50f85d(++_0x386060);}(_0x3629,0xaa));var _0x9362=function(_0x149033,_0x4fbd54){_0x149033=_0x149033-0x0;var _0x1fb5c7=_0x3629[_0x149033];return _0x1fb5c7;};'use strict';var _=require(_0x9362('0x0'));var util=require(_0x9362('0x1'));var moment=require(_0x9362('0x2'));var BPromise=require(_0x9362('0x3'));var rs=require(_0x9362('0x4'));var fs=require('fs');var Redis=require(_0x9362('0x5'));var db=require(_0x9362('0x6'))['db'];var utils=require(_0x9362('0x7'));var logger=require(_0x9362('0x8'))(_0x9362('0x9'));var config=require(_0x9362('0xa'));var jayson=require(_0x9362('0xb'));var client=jayson[_0x9362('0xc')]['http']({'port':0x232a});config[_0x9362('0xd')]=_['defaults'](config['redis'],{'host':_0x9362('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9362('0xd')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x45d2de,_0x4d9eaa,_0x5328de){return new BPromise(function(_0x2c01d9,_0x1e0ad2){return client['request'](_0x45d2de,_0x5328de)['then'](function(_0x56038d){logger['info'](_0x9362('0xf'),_0x4d9eaa,_0x9362('0x10'));logger[_0x9362('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4d9eaa,_0x9362('0x10'),JSON[_0x9362('0x12')](_0x56038d));if(_0x56038d[_0x9362('0x13')]){if(_0x56038d[_0x9362('0x13')][_0x9362('0x14')]===0x1f4){logger[_0x9362('0x13')](_0x9362('0xf'),_0x4d9eaa,_0x56038d['error'][_0x9362('0x15')]);return _0x1e0ad2(_0x56038d[_0x9362('0x13')][_0x9362('0x15')]);}logger[_0x9362('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4d9eaa,_0x56038d[_0x9362('0x13')][_0x9362('0x15')]);return _0x2c01d9(_0x56038d['error'][_0x9362('0x15')]);}else{logger[_0x9362('0x16')](_0x9362('0xf'),_0x4d9eaa,'request\x20sent');_0x2c01d9(_0x56038d['result']['message']);}})['catch'](function(_0x5ed37d){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4d9eaa,_0x5ed37d);_0x1e0ad2(_0x5ed37d);});});}exports[_0x9362('0x17')]=function(_0x182ba1){var _0x4ff8b2=this;return new Promise(function(_0x1a69c1,_0x1c0eda){return db[_0x9362('0x18')][_0x9362('0x19')](_0x182ba1[_0x9362('0x1a')],{'raw':_0x182ba1[_0x9362('0x1b')]?_0x182ba1[_0x9362('0x1b')][_0x9362('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x182ba1[_0x9362('0x1b')]?_0x182ba1['options']['where']||null:null,'attributes':_0x182ba1['options']?_0x182ba1['options'][_0x9362('0x1d')]||null:null,'limit':_0x182ba1[_0x9362('0x1b')]?_0x182ba1[_0x9362('0x1b')]['limit']||null:null})[_0x9362('0x1e')](function(_0x46d494){logger[_0x9362('0x16')](_0x9362('0x17'),_0x182ba1);logger['debug'](_0x9362('0x17'),_0x182ba1,JSON['stringify'](_0x46d494));_0x1a69c1(_0x46d494);})['catch'](function(_0x5ede37){logger[_0x9362('0x13')](_0x9362('0x17'),_0x5ede37[_0x9362('0x15')],_0x182ba1);_0x1c0eda(_0x4ff8b2[_0x9362('0x13')](0x1f4,_0x5ede37[_0x9362('0x15')]));});});};exports[_0x9362('0x1f')]=function(_0x7c877e){return new Promise(function(_0x2bad19,_0x259698){return db[_0x9362('0x18')][_0x9362('0x20')]({'where':_0x7c877e[_0x9362('0x1b')]?_0x7c877e[_0x9362('0x1b')][_0x9362('0x21')]||null:null})['then'](function(_0x3a4826){if(_0x3a4826){return _0x3a4826[_0x9362('0x22')](_0x7c877e[_0x9362('0x1a')][_0x9362('0x23')],_[_0x9362('0x24')](_0x7c877e[_0x9362('0x1a')],[_0x9362('0x23'),'id'])||{});}})[_0x9362('0x25')](function(_0x3907ec){logger[_0x9362('0x16')](_0x9362('0x26'),_0x7c877e);logger[_0x9362('0x11')](_0x9362('0x26'),_0x7c877e,JSON[_0x9362('0x12')](_0x3907ec));_0x2bad19(_0x3907ec);})['catch'](function(_0xb4be4){logger[_0x9362('0x13')](_0x9362('0x26'),_0xb4be4[_0x9362('0x15')],_0x7c877e);_0x259698(_this['error'](0x1f4,_0xb4be4[_0x9362('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b9acac0..27dd228 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 _0x9cbe=['openchannelInteraction:','save','remove','emit','removeListener','register','length'];(function(_0x28e258,_0x3c296c){var _0x233ac6=function(_0x379183){while(--_0x379183){_0x28e258['push'](_0x28e258['shift']());}};_0x233ac6(++_0x3c296c);}(_0x9cbe,0x1eb));var _0xe9cb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9cbe[_0x46e363];return _0x3fb059;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xe9cb('0x0'),_0xe9cb('0x1'),'update'];function createListener(_0x2e4d65,_0x5d0430){return function(_0x3c3e4b){_0x5d0430[_0xe9cb('0x2')](_0x2e4d65,_0x3c3e4b);};}function removeListener(_0xbec405,_0x25299e){return function(){OpenchannelInteractionEvents[_0xe9cb('0x3')](_0xbec405,_0x25299e);};}exports[_0xe9cb('0x4')]=function(_0x4e08ec){for(var _0x50b9bf=0x0,_0x3562d8=events[_0xe9cb('0x5')];_0x50b9bf<_0x3562d8;_0x50b9bf++){var _0x401f59=events[_0x50b9bf];var _0x10f78a=createListener(_0xe9cb('0x6')+_0x401f59,_0x4e08ec);OpenchannelInteractionEvents['on'](_0x401f59,_0x10f78a);}}; \ No newline at end of file +var _0x14b5=['update','emit','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x1b7683,_0x6c5a86){var _0xaa19db=function(_0x52442b){while(--_0x52442b){_0x1b7683['push'](_0x1b7683['shift']());}};_0xaa19db(++_0x6c5a86);}(_0x14b5,0x9a));var _0x514b=function(_0x1bd003,_0x8e39bf){_0x1bd003=_0x1bd003-0x0;var _0x575e3f=_0x14b5[_0x1bd003];return _0x575e3f;};'use strict';var OpenchannelInteractionEvents=require(_0x514b('0x0'));var events=[_0x514b('0x1'),'remove',_0x514b('0x2')];function createListener(_0x2208ed,_0xdfc624){return function(_0x57eb29){_0xdfc624[_0x514b('0x3')](_0x2208ed,_0x57eb29);};}function removeListener(_0x18bf82,_0x3aa35){return function(){OpenchannelInteractionEvents['removeListener'](_0x18bf82,_0x3aa35);};}exports['register']=function(_0x4d11ef){for(var _0xd7df29=0x0,_0x11583a=events[_0x514b('0x4')];_0xd7df29<_0x11583a;_0xd7df29++){var _0x143799=events[_0xd7df29];var _0x4281f2=createListener(_0x514b('0x5')+_0x143799,_0x4d11ef);OpenchannelInteractionEvents['on'](_0x143799,_0x4281f2);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ebe7ab7..fa0b936 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 _0x8f98=['show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','describe','/:id'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x8f98,0x1e8));var _0x88f9=function(_0x4ef4d3,_0x22f87d){_0x4ef4d3=_0x4ef4d3-0x0;var _0x422a0e=_0x8f98[_0x4ef4d3];return _0x422a0e;};'use strict';var multer=require(_0x88f9('0x0'));var util=require(_0x88f9('0x1'));var path=require(_0x88f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x88f9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x88f9('0x4'));var config=require(_0x88f9('0x5'));var controller=require(_0x88f9('0x6'));router[_0x88f9('0x7')]('/',auth['isAuthenticated'](),controller[_0x88f9('0x8')]);router['get'](_0x88f9('0x9'),auth['isAuthenticated'](),controller[_0x88f9('0xa')]);router[_0x88f9('0x7')](_0x88f9('0xb'),auth['isAuthenticated'](),controller[_0x88f9('0xc')]);router[_0x88f9('0xd')]('/',auth[_0x88f9('0xe')](),interaction[_0x88f9('0xf')](_0x88f9('0x10'),_0x88f9('0x11')),controller['create']);router[_0x88f9('0x12')](_0x88f9('0xb'),auth[_0x88f9('0xe')](),controller[_0x88f9('0x13')]);router['put']('/:id/accept',auth[_0x88f9('0xe')](),controller[_0x88f9('0x14')]);router['put'](_0x88f9('0x15'),auth[_0x88f9('0xe')](),controller['reject']);router[_0x88f9('0x16')](_0x88f9('0xb'),auth[_0x88f9('0xe')](),controller[_0x88f9('0x17')]);module[_0x88f9('0x18')]=router; \ No newline at end of file +var _0x2952=['../../config/environment','./openchannelMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','tracked','openchannel','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2952,0x1c2));var _0x2295=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2952[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2295('0x0'));var timeout=require(_0x2295('0x1'));var express=require(_0x2295('0x2'));var router=express[_0x2295('0x3')]();var auth=require(_0x2295('0x4'));var interaction=require(_0x2295('0x5'));var config=require(_0x2295('0x6'));var controller=require(_0x2295('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2295('0x8')](_0x2295('0x9'),auth[_0x2295('0xa')](),controller[_0x2295('0xb')]);router[_0x2295('0x8')](_0x2295('0xc'),auth['isAuthenticated'](),controller[_0x2295('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x2295('0xe')](_0x2295('0xf'),'openchannelmessage:create'),controller['create']);router['put'](_0x2295('0xc'),auth['isAuthenticated'](),controller[_0x2295('0x10')]);router[_0x2295('0x11')](_0x2295('0x12'),auth[_0x2295('0xa')](),controller[_0x2295('0x13')]);router[_0x2295('0x11')](_0x2295('0x14'),auth[_0x2295('0xa')](),controller[_0x2295('0x15')]);router['delete'](_0x2295('0xc'),auth[_0x2295('0xa')](),controller[_0x2295('0x16')]);module[_0x2295('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4497440..3301025 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 _0xc239=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x309540,_0x1b49b0){var _0x168416=function(_0x540219){while(--_0x540219){_0x309540['push'](_0x309540['shift']());}};_0x168416(++_0x1b49b0);}(_0xc239,0xc7));var _0x9c23=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xc239[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require(_0x9c23('0x0'));module[_0x9c23('0x1')]={'body':{'type':Sequelize[_0x9c23('0x2')](_0x9c23('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9c23('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9c23('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9c23('0x5')]('in','out'),'defaultValue':_0x9c23('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9c23('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9c23('0x2')]}}; \ No newline at end of file +var _0x6668=['out','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x19b673,_0x457ee5){var _0x10c7fb=function(_0x435432){while(--_0x435432){_0x19b673['push'](_0x19b673['shift']());}};_0x10c7fb(++_0x457ee5);}(_0x6668,0x1c9));var _0x8666=function(_0x520945,_0x28b144){_0x520945=_0x520945-0x0;var _0x17067a=_0x6668[_0x520945];return _0x17067a;};'use strict';var Sequelize=require('sequelize');module[_0x8666('0x0')]={'body':{'type':Sequelize[_0x8666('0x1')](_0x8666('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8666('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8666('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8666('0x4')]('in','out'),'defaultValue':_0x8666('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8666('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index da779b3..8f2f344 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 _0x7948=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','count','offset','limit','set','json','reject','save','update','destroy','end','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','type','filter','includeAll','include','findAll','rows','show','params','keys','intersection','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir'];(function(_0xb93450,_0x17605b){var _0x54387d=function(_0x5e9795){while(--_0x5e9795){_0xb93450['push'](_0xb93450['shift']());}};_0x54387d(++_0x17605b);}(_0x7948,0x185));var _0x8794=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x7948[_0x1911ed];return _0x11edaa;};'use strict';var pdf=require(_0x8794('0x0'));var emlformat=require(_0x8794('0x1'));var rimraf=require(_0x8794('0x2'));var zipdir=require(_0x8794('0x3'));var jsonpatch=require(_0x8794('0x4'));var rp=require(_0x8794('0x5'));var moment=require(_0x8794('0x6'));var BPromise=require(_0x8794('0x7'));var Mustache=require(_0x8794('0x8'));var util=require(_0x8794('0x9'));var path=require(_0x8794('0xa'));var sox=require(_0x8794('0xb'));var csv=require(_0x8794('0xc'));var ejs=require(_0x8794('0xd'));var fs=require('fs');var _=require(_0x8794('0xe'));var squel=require(_0x8794('0xf'));var crypto=require(_0x8794('0x10'));var jsforce=require(_0x8794('0x11'));var deskjs=require(_0x8794('0x12'));var toCsv=require(_0x8794('0xc'));var querystring=require(_0x8794('0x13'));var Papa=require(_0x8794('0x14'));var Redis=require(_0x8794('0x15'));var authService=require(_0x8794('0x16'));var qs=require(_0x8794('0x17'));var as=require(_0x8794('0x18'));var hardwareService=require(_0x8794('0x19'));var logger=require(_0x8794('0x1a'))(_0x8794('0x1b'));var utils=require(_0x8794('0x1c'));var config=require(_0x8794('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0x8794('0x1e'))['db'];config[_0x8794('0x1f')]=_[_0x8794('0x20')](config[_0x8794('0x1f')],{'host':_0x8794('0x21'),'port':0x18eb});var socket=require(_0x8794('0x22'))(new Redis(config[_0x8794('0x1f')]));require(_0x8794('0x23'))[_0x8794('0x24')](socket);var jayson=require(_0x8794('0x25'));var client=jayson[_0x8794('0x26')][_0x8794('0x27')]({'port':0x232c});var client9002=jayson[_0x8794('0x26')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7500eb,_0x4f8b21,_0x5623d7,_0x31f66c){return new BPromise(function(_0x8b862a,_0x247365){var _0x4b240b=_0x31f66c||client;return _0x4b240b[_0x8794('0x28')](_0x7500eb,_0x5623d7)[_0x8794('0x29')](function(_0x46be4d){logger['info'](_0x8794('0x2a'),_0x4f8b21,_0x8794('0x2b'));logger[_0x8794('0x2c')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4f8b21,_0x8794('0x2b'),JSON[_0x8794('0x2d')](_0x46be4d));if(_0x46be4d[_0x8794('0x2e')]){if(_0x46be4d['error'][_0x8794('0x2f')]===0x1f4){logger['error'](_0x8794('0x2a'),_0x4f8b21,_0x46be4d[_0x8794('0x2e')][_0x8794('0x30')]);return _0x247365(_0x46be4d[_0x8794('0x2e')][_0x8794('0x30')]);}logger[_0x8794('0x2e')](_0x8794('0x2a'),_0x4f8b21,_0x46be4d[_0x8794('0x2e')][_0x8794('0x30')]);return _0x8b862a(_0x46be4d[_0x8794('0x2e')]['message']);}else{logger[_0x8794('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f8b21,_0x8794('0x2b'));_0x8b862a(_0x46be4d[_0x8794('0x32')]['message']);}})[_0x8794('0x33')](function(_0x50bf48){logger[_0x8794('0x2e')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f8b21,_0x50bf48);_0x247365(_0x50bf48);});});}function respondWithStatusCode(_0x1f56f6,_0x5452dd){_0x5452dd=_0x5452dd||0xcc;return function(_0x17cbd2){if(_0x17cbd2){return _0x1f56f6[_0x8794('0x34')](_0x5452dd);}return _0x1f56f6[_0x8794('0x35')](_0x5452dd)['end']();};}function respondWithResult(_0x5e3afc,_0x4214d2){_0x4214d2=_0x4214d2||0xc8;return function(_0x3d6c3a){if(_0x3d6c3a){return _0x5e3afc[_0x8794('0x35')](_0x4214d2)['json'](_0x3d6c3a);}};}function respondWithFilteredResult(_0x1044b9,_0x536fed){return function(_0x4cb01c){if(_0x4cb01c){var _0x2c357b=_0x4cb01c[_0x8794('0x36')],_0x25f9f6=_0x536fed['offset'],_0x7ca073=_0x536fed[_0x8794('0x37')]+_0x536fed[_0x8794('0x38')],_0x45bbde;if(_0x7ca073>=_0x2c357b){_0x7ca073=_0x2c357b;_0x45bbde=0xc8;}else{_0x45bbde=0xce;}_0x1044b9[_0x8794('0x35')](_0x45bbde);return _0x1044b9[_0x8794('0x39')]('Content-Range',_0x25f9f6+'-'+_0x7ca073+'/'+_0x2c357b)[_0x8794('0x3a')](_0x4cb01c);}return null;};}function patchUpdates(_0x1b867c){return function(_0x57aaea){try{jsonpatch['apply'](_0x57aaea,_0x1b867c,!![]);}catch(_0xcbf239){return BPromise[_0x8794('0x3b')](_0xcbf239);}return _0x57aaea[_0x8794('0x3c')]();};}function saveUpdates(_0x455278,_0x4e1844){return function(_0x588297){if(_0x588297){return _0x588297[_0x8794('0x3d')](_0x455278)[_0x8794('0x29')](function(_0x1da4a2){return _0x1da4a2;});}return null;};}function removeEntity(_0x18a1a7,_0xcac6cd){return function(_0x5fcd1e){if(_0x5fcd1e){return _0x5fcd1e[_0x8794('0x3e')]()[_0x8794('0x29')](function(){_0x18a1a7[_0x8794('0x35')](0xcc)[_0x8794('0x3f')]();});}};}function handleEntityNotFound(_0x35e1a7,_0x5ba80f){return function(_0x3e149b){if(!_0x3e149b){_0x35e1a7[_0x8794('0x34')](0x194);}return _0x3e149b;};}function handleError(_0x18530d,_0x249921){_0x249921=_0x249921||0x1f4;return function(_0x5f2464){logger['error'](_0x5f2464[_0x8794('0x40')]);if(_0x5f2464[_0x8794('0x41')]){delete _0x5f2464[_0x8794('0x41')];}_0x18530d[_0x8794('0x35')](_0x249921)[_0x8794('0x42')](_0x5f2464);};}exports[_0x8794('0x43')]=function(_0x3ef23e,_0x42cbe8){var _0x58bfe7={},_0x32c443={},_0x426860={'count':0x0,'rows':[]};var _0x279a01=_['map'](db[_0x8794('0x44')][_0x8794('0x45')],function(_0xd99acb){return{'name':_0xd99acb[_0x8794('0x46')],'type':_0xd99acb['type'][_0x8794('0x47')]};});_0x32c443[_0x8794('0x48')]=_[_0x8794('0x49')](_0x279a01,_0x8794('0x41'));_0x32c443[_0x8794('0x4a')]=_['keys'](_0x3ef23e[_0x8794('0x4a')]);_0x32c443['filters']=_['intersection'](_0x32c443[_0x8794('0x48')],_0x32c443[_0x8794('0x4a')]);_0x58bfe7[_0x8794('0x4b')]=_['intersection'](_0x32c443[_0x8794('0x48')],qs[_0x8794('0x4c')](_0x3ef23e[_0x8794('0x4a')][_0x8794('0x4c')]));_0x58bfe7['attributes']=_0x58bfe7[_0x8794('0x4b')]['length']?_0x58bfe7[_0x8794('0x4b')]:_0x32c443[_0x8794('0x48')];if(!_0x3ef23e[_0x8794('0x4a')][_0x8794('0x4d')](_0x8794('0x4e'))){_0x58bfe7['limit']=qs[_0x8794('0x38')](_0x3ef23e['query'][_0x8794('0x38')]);_0x58bfe7['offset']=qs[_0x8794('0x37')](_0x3ef23e[_0x8794('0x4a')]['offset']);}_0x58bfe7[_0x8794('0x4f')]=qs[_0x8794('0x50')](_0x3ef23e[_0x8794('0x4a')][_0x8794('0x50')]);_0x58bfe7['where']=qs['filters'](_[_0x8794('0x51')](_0x3ef23e[_0x8794('0x4a')],_0x32c443[_0x8794('0x52')]),_0x279a01);if(_0x3ef23e[_0x8794('0x4a')]['filter']){_0x58bfe7['where']=_[_0x8794('0x53')](_0x58bfe7[_0x8794('0x54')],{'$or':_[_0x8794('0x49')](_0x279a01,function(_0x2ebfbe){if(_0x2ebfbe[_0x8794('0x55')]!=='VIRTUAL'){var _0x53f7fe={};_0x53f7fe[_0x2ebfbe[_0x8794('0x41')]]={'$like':'%'+_0x3ef23e['query'][_0x8794('0x56')]+'%'};return _0x53f7fe;}})});}_0x58bfe7=_[_0x8794('0x53')]({},_0x58bfe7,_0x3ef23e['options']);var _0xe59546={'where':_0x58bfe7[_0x8794('0x54')]};return db[_0x8794('0x44')][_0x8794('0x36')](_0xe59546)[_0x8794('0x29')](function(_0x25857d){_0x426860['count']=_0x25857d;if(_0x3ef23e[_0x8794('0x4a')][_0x8794('0x57')]){_0x58bfe7[_0x8794('0x58')]=[{'all':!![]}];}return db[_0x8794('0x44')][_0x8794('0x59')](_0x58bfe7);})['then'](function(_0x25e896){_0x426860[_0x8794('0x5a')]=_0x25e896;return _0x426860;})[_0x8794('0x29')](respondWithFilteredResult(_0x42cbe8,_0x58bfe7))[_0x8794('0x33')](handleError(_0x42cbe8,null));};exports[_0x8794('0x5b')]=function(_0x337aa9,_0x211a19){var _0x2b7512={'raw':!![],'where':{'id':_0x337aa9[_0x8794('0x5c')]['id']}},_0x5310a2={};_0x5310a2[_0x8794('0x48')]=_[_0x8794('0x5d')](db[_0x8794('0x44')][_0x8794('0x45')]);_0x5310a2[_0x8794('0x4a')]=_[_0x8794('0x5d')](_0x337aa9[_0x8794('0x4a')]);_0x5310a2[_0x8794('0x52')]=_[_0x8794('0x5e')](_0x5310a2[_0x8794('0x48')],_0x5310a2[_0x8794('0x4a')]);_0x2b7512['attributes']=_['intersection'](_0x5310a2['model'],qs[_0x8794('0x4c')](_0x337aa9[_0x8794('0x4a')][_0x8794('0x4c')]));_0x2b7512['attributes']=_0x2b7512[_0x8794('0x4b')]['length']?_0x2b7512[_0x8794('0x4b')]:_0x5310a2['model'];if(_0x337aa9[_0x8794('0x4a')]['includeAll']){_0x2b7512[_0x8794('0x58')]=[{'all':!![]}];}_0x2b7512=_['merge']({},_0x2b7512,_0x337aa9[_0x8794('0x5f')]);return db[_0x8794('0x44')][_0x8794('0x60')](_0x2b7512)['then'](handleEntityNotFound(_0x211a19,null))['then'](respondWithResult(_0x211a19,null))[_0x8794('0x33')](handleError(_0x211a19,null));};exports[_0x8794('0x61')]=function(_0x3f7785,_0x2997d1){return db[_0x8794('0x44')][_0x8794('0x61')](_0x3f7785['body'],{})[_0x8794('0x29')](respondWithResult(_0x2997d1,0xc9))[_0x8794('0x33')](handleError(_0x2997d1,null));};exports[_0x8794('0x3d')]=function(_0x14f2a5,_0x2fdc78){if(_0x14f2a5[_0x8794('0x62')]['id']){delete _0x14f2a5['body']['id'];}return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x14f2a5[_0x8794('0x5c')]['id']}})[_0x8794('0x29')](handleEntityNotFound(_0x2fdc78,null))['then'](saveUpdates(_0x14f2a5[_0x8794('0x62')],null))['then'](respondWithResult(_0x2fdc78,null))[_0x8794('0x33')](handleError(_0x2fdc78,null));};exports[_0x8794('0x3e')]=function(_0x226466,_0x202dfe){return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x226466['params']['id']}})[_0x8794('0x29')](handleEntityNotFound(_0x202dfe,null))[_0x8794('0x29')](removeEntity(_0x202dfe,null))[_0x8794('0x33')](handleError(_0x202dfe,null));};exports[_0x8794('0x63')]=function(_0x540898,_0x53d0dd){return db['OpenchannelMessage'][_0x8794('0x63')]()['then'](respondWithResult(_0x53d0dd,null))[_0x8794('0x33')](handleError(_0x53d0dd,null));};var interaction_log=require(_0x8794('0x1a'))(_0x8794('0x64'));exports[_0x8794('0x65')]=function(_0x46b204,_0x289942,_0x2307ec){var _0x4c9a59={'channel':_0x8794('0x66')};if(_0x46b204[_0x8794('0x62')]['id']){delete _0x46b204['body']['id'];}_0x46b204[_0x8794('0x62')][_0x8794('0x67')]=!![];_0x46b204[_0x8794('0x62')][_0x8794('0x68')]=moment()['format'](_0x8794('0x69'));_0x46b204[_0x8794('0x62')][_0x8794('0x6a')]=_0x46b204[_0x8794('0x62')][_0x8794('0x6a')]||_0x46b204[_0x8794('0x6b')]['id'];return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x46b204[_0x8794('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x8794('0x6c')],'as':_0x8794('0x6d')}]})['then'](handleEntityNotFound(_0x289942,null))[_0x8794('0x29')](saveUpdates(_0x46b204[_0x8794('0x62')],null))[_0x8794('0x29')](function(_0x410563){if(_0x410563){_0x4c9a59[_0x8794('0x30')]=_0x410563[_0x8794('0x6e')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x410563[_0x8794('0x6f')]}});}return null;})[_0x8794('0x29')](handleEntityNotFound(_0x289942,null))['then'](function(_0x3e8a5e){if(_0x3e8a5e){return _0x3e8a5e[_0x8794('0x3d')]({'UserId':_0x46b204[_0x8794('0x62')][_0x8794('0x6a')],'read1stAt':_[_0x8794('0x70')](_0x3e8a5e['read1stAt'])?moment()[_0x8794('0x71')](_0x8794('0x69')):undefined});}return null;})[_0x8794('0x29')](function(_0x56da44){if(_0x56da44){_0x4c9a59[_0x8794('0x72')]=_0x56da44['get']({'plain':!![]});interaction_log[_0x8794('0x31')](_0x8794('0x73'),_0x46b204[_0x8794('0x6b')]['id'],_0x46b204[_0x8794('0x6b')][_0x8794('0x41')],_0x46b204[_0x8794('0x6b')][_0x8794('0x74')],_0x4c9a59[_0x8794('0x72')]['id'],_0x46b204['body']?JSON[_0x8794('0x2d')](_0x46b204['body']):_0x8794('0x75'));return respondWithRpcPromise(_0x8794('0x76'),'acceptMessage',_0x4c9a59);}return null;})[_0x8794('0x29')](function(_0x78df3b){if(_0x78df3b){if(_0x46b204[_0x8794('0x62')][_0x8794('0x77')]){_0x4c9a59[_0x8794('0x30')][_0x8794('0x78')]=util[_0x8794('0x71')]('SIP/%s',_0x46b204['user'][_0x8794('0x41')]);_0x4c9a59['message']['channel']=_0x4c9a59[_0x8794('0x79')];_0x4c9a59[_0x8794('0x30')]['event']=_0x8794('0x65');return respondWithRpcPromise(_0x8794('0x7a'),_0x8794('0x7a'),{'event':_0x8794('0x7b'),'message':_0x4c9a59['message']},client9002)[_0x8794('0x29')](function(){return _0x4c9a59;});}return _0x4c9a59;}return null;})[_0x8794('0x29')](respondWithResult(_0x289942,null))[_0x8794('0x33')](handleError(_0x289942,null));};var interaction_log=require(_0x8794('0x1a'))(_0x8794('0x64'));exports['reject']=function(_0x1c4132,_0x2186ea,_0x2dd42e){var _0x2c1afc={'agent':{},'channel':_0x8794('0x66')};if(_0x1c4132[_0x8794('0x62')]['id']){delete _0x1c4132[_0x8794('0x62')]['id'];}_0x1c4132[_0x8794('0x62')][_0x8794('0x6a')]=_0x1c4132[_0x8794('0x62')][_0x8794('0x6a')]||_0x1c4132[_0x8794('0x6b')]['id'];_0x2c1afc[_0x8794('0x7c')]['id']=_0x1c4132[_0x8794('0x62')][_0x8794('0x6a')];return db[_0x8794('0x44')][_0x8794('0x60')]({'where':{'id':_0x1c4132[_0x8794('0x5c')]['id'],'UserId':null}})[_0x8794('0x29')](handleEntityNotFound(_0x2186ea,null))[_0x8794('0x29')](function(_0x2aca2a){if(_0x2aca2a){_0x2c1afc[_0x8794('0x30')]=_0x2aca2a[_0x8794('0x6e')]({'plain':!![]});return db[_0x8794('0x7d')]['find']({'where':{'id':_0x2aca2a['OpenchannelInteractionId']}});}return null;})[_0x8794('0x29')](handleEntityNotFound(_0x2186ea,null))[_0x8794('0x29')](function(_0x34743a){if(_0x34743a){_0x2c1afc['interaction']=_0x34743a['get']({'plain':!![]});interaction_log[_0x8794('0x31')](_0x8794('0x7e'),_0x1c4132[_0x8794('0x6b')]['id'],_0x1c4132[_0x8794('0x6b')][_0x8794('0x41')],_0x1c4132['user']['role'],_0x2c1afc[_0x8794('0x72')]['id'],_0x1c4132[_0x8794('0x62')]?JSON[_0x8794('0x2d')](_0x1c4132['body']):_0x8794('0x75'));return respondWithRpcPromise(_0x8794('0x7f'),_0x8794('0x80'),_0x2c1afc);}return null;})[_0x8794('0x29')](function(_0xd41bf5){if(_0xd41bf5){_0xd41bf5['message'][_0x8794('0x78')]=util['format'](_0x8794('0x81'),_0x1c4132[_0x8794('0x6b')]['name']);_0xd41bf5[_0x8794('0x30')][_0x8794('0x79')]=_0x2c1afc[_0x8794('0x79')];_0xd41bf5[_0x8794('0x30')]['event']=_0x8794('0x3b');respondWithRpcPromise(_0x8794('0x7a'),_0x8794('0x7a'),{'event':_0x8794('0x82'),'message':_0xd41bf5[_0x8794('0x30')]},client9002);return _0x2c1afc;}return null;})[_0x8794('0x29')](respondWithResult(_0x2186ea,null))[_0x8794('0x33')](handleError(_0x2186ea,null));}; \ No newline at end of file +var _0x3a79=['request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','set','Content-Range','reject','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','update','params','describe','../../config/logger','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','openchannel','agent','OpenchannelInteraction','role','null','RejectMessage','rejectMessage','SIP/%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info'];(function(_0x14691c,_0xe1c878){var _0xbec98=function(_0x100b9e){while(--_0x100b9e){_0x14691c['push'](_0x14691c['shift']());}};_0xbec98(++_0xe1c878);}(_0x3a79,0xca));var _0x93a7=function(_0x1f892f,_0x50aba){_0x1f892f=_0x1f892f-0x0;var _0x38d4c7=_0x3a79[_0x1f892f];return _0x38d4c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x93a7('0x0'));var rimraf=require(_0x93a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93a7('0x2'));var rp=require(_0x93a7('0x3'));var moment=require(_0x93a7('0x4'));var BPromise=require(_0x93a7('0x5'));var Mustache=require(_0x93a7('0x6'));var util=require(_0x93a7('0x7'));var path=require(_0x93a7('0x8'));var sox=require('sox');var csv=require(_0x93a7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x93a7('0xa'));var squel=require(_0x93a7('0xb'));var crypto=require(_0x93a7('0xc'));var jsforce=require(_0x93a7('0xd'));var deskjs=require(_0x93a7('0xe'));var toCsv=require(_0x93a7('0x9'));var querystring=require('querystring');var Papa=require(_0x93a7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93a7('0x10'));var as=require(_0x93a7('0x11'));var hardwareService=require(_0x93a7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x93a7('0x13'));var config=require(_0x93a7('0x14'));var licenseUtil=require(_0x93a7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x93a7('0x16')](config['redis'],{'host':_0x93a7('0x17'),'port':0x18eb});var socket=require(_0x93a7('0x18'))(new Redis(config[_0x93a7('0x19')]));require(_0x93a7('0x1a'))[_0x93a7('0x1b')](socket);var jayson=require(_0x93a7('0x1c'));var client=jayson[_0x93a7('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x93a7('0x1d')][_0x93a7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4aa44e,_0x517a72,_0x29fae6,_0x5d6109){return new BPromise(function(_0xfac49d,_0x46769f){var _0x8c8f3b=_0x5d6109||client;return _0x8c8f3b[_0x93a7('0x1f')](_0x4aa44e,_0x29fae6)[_0x93a7('0x20')](function(_0x4eb2da){logger[_0x93a7('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x517a72,_0x93a7('0x22'));logger[_0x93a7('0x23')](_0x93a7('0x24'),_0x517a72,_0x93a7('0x22'),JSON[_0x93a7('0x25')](_0x4eb2da));if(_0x4eb2da['error']){if(_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x27')]===0x1f4){logger[_0x93a7('0x26')](_0x93a7('0x28'),_0x517a72,_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x29')]);return _0x46769f(_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x29')]);}logger['error'](_0x93a7('0x28'),_0x517a72,_0x4eb2da[_0x93a7('0x26')]['message']);return _0xfac49d(_0x4eb2da[_0x93a7('0x26')][_0x93a7('0x29')]);}else{logger[_0x93a7('0x21')](_0x93a7('0x28'),_0x517a72,'request\x20sent');_0xfac49d(_0x4eb2da[_0x93a7('0x2a')][_0x93a7('0x29')]);}})['catch'](function(_0xafae92){logger[_0x93a7('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x517a72,_0xafae92);_0x46769f(_0xafae92);});});}function respondWithStatusCode(_0x8ac794,_0x4e72b4){_0x4e72b4=_0x4e72b4||0xcc;return function(_0x2c4ed7){if(_0x2c4ed7){return _0x8ac794[_0x93a7('0x2b')](_0x4e72b4);}return _0x8ac794[_0x93a7('0x2c')](_0x4e72b4)[_0x93a7('0x2d')]();};}function respondWithResult(_0x5994dd,_0x1eaff9){_0x1eaff9=_0x1eaff9||0xc8;return function(_0x4f3020){if(_0x4f3020){return _0x5994dd['status'](_0x1eaff9)[_0x93a7('0x2e')](_0x4f3020);}};}function respondWithFilteredResult(_0x44c6da,_0x15e30f){return function(_0x3f5448){if(_0x3f5448){var _0x1fad6e=_0x3f5448[_0x93a7('0x2f')],_0x4b1d61=_0x15e30f['offset'],_0x27e610=_0x15e30f['offset']+_0x15e30f['limit'],_0x4f2b58;if(_0x27e610>=_0x1fad6e){_0x27e610=_0x1fad6e;_0x4f2b58=0xc8;}else{_0x4f2b58=0xce;}_0x44c6da[_0x93a7('0x2c')](_0x4f2b58);return _0x44c6da[_0x93a7('0x30')](_0x93a7('0x31'),_0x4b1d61+'-'+_0x27e610+'/'+_0x1fad6e)['json'](_0x3f5448);}return null;};}function patchUpdates(_0x2842f8){return function(_0x5ca785){try{jsonpatch['apply'](_0x5ca785,_0x2842f8,!![]);}catch(_0x5136f1){return BPromise[_0x93a7('0x32')](_0x5136f1);}return _0x5ca785['save']();};}function saveUpdates(_0xb29e27,_0x1a0c46){return function(_0x507918){if(_0x507918){return _0x507918['update'](_0xb29e27)['then'](function(_0x165303){return _0x165303;});}return null;};}function removeEntity(_0x422a1d,_0x1ea17b){return function(_0xa24248){if(_0xa24248){return _0xa24248['destroy']()[_0x93a7('0x20')](function(){_0x422a1d[_0x93a7('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1992,_0x1057b3){return function(_0x210b21){if(!_0x210b21){_0x4d1992[_0x93a7('0x2b')](0x194);}return _0x210b21;};}function handleError(_0x2d4723,_0xa3bb5f){_0xa3bb5f=_0xa3bb5f||0x1f4;return function(_0xae3714){logger[_0x93a7('0x26')](_0xae3714['stack']);if(_0xae3714[_0x93a7('0x33')]){delete _0xae3714[_0x93a7('0x33')];}_0x2d4723[_0x93a7('0x2c')](_0xa3bb5f)[_0x93a7('0x34')](_0xae3714);};}exports[_0x93a7('0x35')]=function(_0x354de0,_0x33f8bf){var _0x5e72ca={},_0x53c540={},_0x7e980d={'count':0x0,'rows':[]};var _0x2cf9e7=_[_0x93a7('0x36')](db[_0x93a7('0x37')][_0x93a7('0x38')],function(_0x48a4bc){return{'name':_0x48a4bc[_0x93a7('0x39')],'type':_0x48a4bc[_0x93a7('0x3a')][_0x93a7('0x3b')]};});_0x53c540[_0x93a7('0x3c')]=_[_0x93a7('0x36')](_0x2cf9e7,_0x93a7('0x33'));_0x53c540[_0x93a7('0x3d')]=_[_0x93a7('0x3e')](_0x354de0[_0x93a7('0x3d')]);_0x53c540[_0x93a7('0x3f')]=_['intersection'](_0x53c540[_0x93a7('0x3c')],_0x53c540[_0x93a7('0x3d')]);_0x5e72ca['attributes']=_[_0x93a7('0x40')](_0x53c540[_0x93a7('0x3c')],qs[_0x93a7('0x41')](_0x354de0['query'][_0x93a7('0x41')]));_0x5e72ca[_0x93a7('0x42')]=_0x5e72ca[_0x93a7('0x42')][_0x93a7('0x43')]?_0x5e72ca[_0x93a7('0x42')]:_0x53c540[_0x93a7('0x3c')];if(!_0x354de0['query'][_0x93a7('0x44')]('nolimit')){_0x5e72ca[_0x93a7('0x45')]=qs[_0x93a7('0x45')](_0x354de0['query'][_0x93a7('0x45')]);_0x5e72ca[_0x93a7('0x46')]=qs['offset'](_0x354de0['query'][_0x93a7('0x46')]);}_0x5e72ca['order']=qs['sort'](_0x354de0[_0x93a7('0x3d')][_0x93a7('0x47')]);_0x5e72ca['where']=qs['filters'](_[_0x93a7('0x48')](_0x354de0['query'],_0x53c540[_0x93a7('0x3f')]),_0x2cf9e7);if(_0x354de0['query'][_0x93a7('0x49')]){_0x5e72ca[_0x93a7('0x4a')]=_[_0x93a7('0x4b')](_0x5e72ca[_0x93a7('0x4a')],{'$or':_['map'](_0x2cf9e7,function(_0x56db7f){if(_0x56db7f['type']!==_0x93a7('0x4c')){var _0x2c4150={};_0x2c4150[_0x56db7f[_0x93a7('0x33')]]={'$like':'%'+_0x354de0['query'][_0x93a7('0x49')]+'%'};return _0x2c4150;}})});}_0x5e72ca=_[_0x93a7('0x4b')]({},_0x5e72ca,_0x354de0[_0x93a7('0x4d')]);var _0x4e85fc={'where':_0x5e72ca[_0x93a7('0x4a')]};return db[_0x93a7('0x37')]['count'](_0x4e85fc)[_0x93a7('0x20')](function(_0x102e76){_0x7e980d['count']=_0x102e76;if(_0x354de0[_0x93a7('0x3d')][_0x93a7('0x4e')]){_0x5e72ca[_0x93a7('0x4f')]=[{'all':!![]}];}return db[_0x93a7('0x37')]['findAll'](_0x5e72ca);})[_0x93a7('0x20')](function(_0x2de07a){_0x7e980d[_0x93a7('0x50')]=_0x2de07a;return _0x7e980d;})['then'](respondWithFilteredResult(_0x33f8bf,_0x5e72ca))[_0x93a7('0x51')](handleError(_0x33f8bf,null));};exports[_0x93a7('0x52')]=function(_0xc03859,_0x439baf){var _0x3d1e65={'raw':!![],'where':{'id':_0xc03859['params']['id']}},_0x3a8786={};_0x3a8786['model']=_[_0x93a7('0x3e')](db[_0x93a7('0x37')][_0x93a7('0x38')]);_0x3a8786[_0x93a7('0x3d')]=_['keys'](_0xc03859[_0x93a7('0x3d')]);_0x3a8786[_0x93a7('0x3f')]=_[_0x93a7('0x40')](_0x3a8786[_0x93a7('0x3c')],_0x3a8786['query']);_0x3d1e65[_0x93a7('0x42')]=_[_0x93a7('0x40')](_0x3a8786[_0x93a7('0x3c')],qs['fields'](_0xc03859[_0x93a7('0x3d')][_0x93a7('0x41')]));_0x3d1e65['attributes']=_0x3d1e65[_0x93a7('0x42')][_0x93a7('0x43')]?_0x3d1e65[_0x93a7('0x42')]:_0x3a8786[_0x93a7('0x3c')];if(_0xc03859[_0x93a7('0x3d')][_0x93a7('0x4e')]){_0x3d1e65[_0x93a7('0x4f')]=[{'all':!![]}];}_0x3d1e65=_[_0x93a7('0x4b')]({},_0x3d1e65,_0xc03859['options']);return db['OpenchannelMessage'][_0x93a7('0x53')](_0x3d1e65)[_0x93a7('0x20')](handleEntityNotFound(_0x439baf,null))['then'](respondWithResult(_0x439baf,null))[_0x93a7('0x51')](handleError(_0x439baf,null));};exports['create']=function(_0xab1a47,_0x35b19a){return db[_0x93a7('0x37')][_0x93a7('0x54')](_0xab1a47[_0x93a7('0x55')],{})[_0x93a7('0x20')](respondWithResult(_0x35b19a,0xc9))[_0x93a7('0x51')](handleError(_0x35b19a,null));};exports[_0x93a7('0x56')]=function(_0x15905d,_0x5e1c9f){if(_0x15905d[_0x93a7('0x55')]['id']){delete _0x15905d[_0x93a7('0x55')]['id'];}return db[_0x93a7('0x37')][_0x93a7('0x53')]({'where':{'id':_0x15905d[_0x93a7('0x57')]['id']}})[_0x93a7('0x20')](handleEntityNotFound(_0x5e1c9f,null))[_0x93a7('0x20')](saveUpdates(_0x15905d[_0x93a7('0x55')],null))[_0x93a7('0x20')](respondWithResult(_0x5e1c9f,null))[_0x93a7('0x51')](handleError(_0x5e1c9f,null));};exports['destroy']=function(_0x4a5c82,_0x33223f){return db['OpenchannelMessage']['find']({'where':{'id':_0x4a5c82[_0x93a7('0x57')]['id']}})[_0x93a7('0x20')](handleEntityNotFound(_0x33223f,null))[_0x93a7('0x20')](removeEntity(_0x33223f,null))[_0x93a7('0x51')](handleError(_0x33223f,null));};exports[_0x93a7('0x58')]=function(_0x1aa329,_0x2a2335){return db[_0x93a7('0x37')][_0x93a7('0x58')]()[_0x93a7('0x20')](respondWithResult(_0x2a2335,null))[_0x93a7('0x51')](handleError(_0x2a2335,null));};var interaction_log=require(_0x93a7('0x59'))('openchannel-interactions');exports['accept']=function(_0x179aa2,_0x5b60bf,_0x4d7a3f){var _0x558a07={'channel':'openchannel'};if(_0x179aa2['body']['id']){delete _0x179aa2[_0x93a7('0x55')]['id'];}_0x179aa2[_0x93a7('0x55')]['read']=!![];_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5a')]=moment()[_0x93a7('0x5b')](_0x93a7('0x5c'));_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5d')]=_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5d')]||_0x179aa2[_0x93a7('0x5e')]['id'];return db[_0x93a7('0x37')][_0x93a7('0x53')]({'where':{'id':_0x179aa2[_0x93a7('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x93a7('0x5f')],'as':_0x93a7('0x60')}]})[_0x93a7('0x20')](handleEntityNotFound(_0x5b60bf,null))[_0x93a7('0x20')](saveUpdates(_0x179aa2[_0x93a7('0x55')],null))['then'](function(_0x3f2c4b){if(_0x3f2c4b){_0x558a07[_0x93a7('0x29')]=_0x3f2c4b[_0x93a7('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x93a7('0x53')]({'where':{'id':_0x3f2c4b[_0x93a7('0x62')]}});}return null;})[_0x93a7('0x20')](handleEntityNotFound(_0x5b60bf,null))['then'](function(_0x5f3b36){if(_0x5f3b36){return _0x5f3b36[_0x93a7('0x56')]({'UserId':_0x179aa2[_0x93a7('0x55')][_0x93a7('0x5d')],'read1stAt':_[_0x93a7('0x63')](_0x5f3b36[_0x93a7('0x64')])?moment()[_0x93a7('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x856c4a){if(_0x856c4a){_0x558a07[_0x93a7('0x65')]=_0x856c4a[_0x93a7('0x61')]({'plain':!![]});interaction_log[_0x93a7('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x179aa2[_0x93a7('0x5e')]['id'],_0x179aa2[_0x93a7('0x5e')][_0x93a7('0x33')],_0x179aa2['user']['role'],_0x558a07[_0x93a7('0x65')]['id'],_0x179aa2[_0x93a7('0x55')]?JSON[_0x93a7('0x25')](_0x179aa2[_0x93a7('0x55')]):'null');return respondWithRpcPromise(_0x93a7('0x66'),_0x93a7('0x67'),_0x558a07);}return null;})[_0x93a7('0x20')](function(_0x5b4e68){if(_0x5b4e68){if(_0x179aa2['body'][_0x93a7('0x68')]){_0x558a07['message'][_0x93a7('0x69')]=util[_0x93a7('0x5b')]('SIP/%s',_0x179aa2[_0x93a7('0x5e')][_0x93a7('0x33')]);_0x558a07['message'][_0x93a7('0x6a')]=_0x558a07['channel'];_0x558a07[_0x93a7('0x29')][_0x93a7('0x6b')]=_0x93a7('0x6c');return respondWithRpcPromise(_0x93a7('0x6d'),_0x93a7('0x6d'),{'event':'acceptmessage','message':_0x558a07[_0x93a7('0x29')]},client9002)[_0x93a7('0x20')](function(){return _0x558a07;});}return _0x558a07;}return null;})[_0x93a7('0x20')](respondWithResult(_0x5b60bf,null))[_0x93a7('0x51')](handleError(_0x5b60bf,null));};var interaction_log=require(_0x93a7('0x59'))('openchannel-interactions');exports[_0x93a7('0x32')]=function(_0x11e0cb,_0x108dd6,_0xe20c7){var _0x39bd68={'agent':{},'channel':_0x93a7('0x6e')};if(_0x11e0cb['body']['id']){delete _0x11e0cb[_0x93a7('0x55')]['id'];}_0x11e0cb[_0x93a7('0x55')][_0x93a7('0x5d')]=_0x11e0cb[_0x93a7('0x55')][_0x93a7('0x5d')]||_0x11e0cb[_0x93a7('0x5e')]['id'];_0x39bd68[_0x93a7('0x6f')]['id']=_0x11e0cb[_0x93a7('0x55')]['UserId'];return db[_0x93a7('0x37')][_0x93a7('0x53')]({'where':{'id':_0x11e0cb[_0x93a7('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x108dd6,null))[_0x93a7('0x20')](function(_0x312503){if(_0x312503){_0x39bd68[_0x93a7('0x29')]=_0x312503[_0x93a7('0x61')]({'plain':!![]});return db[_0x93a7('0x70')][_0x93a7('0x53')]({'where':{'id':_0x312503[_0x93a7('0x62')]}});}return null;})[_0x93a7('0x20')](handleEntityNotFound(_0x108dd6,null))[_0x93a7('0x20')](function(_0x723926){if(_0x723926){_0x39bd68[_0x93a7('0x65')]=_0x723926['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11e0cb['user']['id'],_0x11e0cb[_0x93a7('0x5e')][_0x93a7('0x33')],_0x11e0cb['user'][_0x93a7('0x71')],_0x39bd68['interaction']['id'],_0x11e0cb[_0x93a7('0x55')]?JSON[_0x93a7('0x25')](_0x11e0cb['body']):_0x93a7('0x72'));return respondWithRpcPromise(_0x93a7('0x73'),_0x93a7('0x74'),_0x39bd68);}return null;})[_0x93a7('0x20')](function(_0xb720bd){if(_0xb720bd){_0xb720bd[_0x93a7('0x29')][_0x93a7('0x69')]=util['format'](_0x93a7('0x75'),_0x11e0cb[_0x93a7('0x5e')][_0x93a7('0x33')]);_0xb720bd[_0x93a7('0x29')][_0x93a7('0x6a')]=_0x39bd68[_0x93a7('0x6a')];_0xb720bd[_0x93a7('0x29')][_0x93a7('0x6b')]=_0x93a7('0x32');respondWithRpcPromise('EventManager',_0x93a7('0x6d'),{'event':'rejectmessage','message':_0xb720bd[_0x93a7('0x29')]},client9002);return _0x39bd68;}return null;})[_0x93a7('0x20')](respondWithResult(_0x108dd6,null))[_0x93a7('0x51')](handleError(_0x108dd6,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9b3b938..67de8f9 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 _0xd2e6=['../../mysqldb','OpenchannelMessage','save','remove','hasOwnProperty','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd2e6,0x131));var _0x6d2e=function(_0x407593,_0x33dbf0){_0x407593=_0x407593-0x0;var _0x357aac=_0xd2e6[_0x407593];return _0x357aac;};'use strict';var EventEmitter=require(_0x6d2e('0x0'));var OpenchannelMessage=require(_0x6d2e('0x1'))['db'][_0x6d2e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6d2e('0x3'),'afterUpdate':'update','afterDestroy':_0x6d2e('0x4')};function emitEvent(_0x51212e){return function(_0x36046b,_0x4191e6,_0x15ffe5){OpenchannelMessageEvents['emit'](_0x51212e+':'+_0x36046b['id'],_0x36046b);OpenchannelMessageEvents['emit'](_0x51212e,_0x36046b);_0x15ffe5(null);};}for(var e in events){if(events[_0x6d2e('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x14c3=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x14c3,0x110));var _0x314c=function(_0x13861b,_0x18d6af){_0x13861b=_0x13861b-0x0;var _0x5240dc=_0x14c3[_0x13861b];return _0x5240dc;};'use strict';var EventEmitter=require(_0x314c('0x0'));var OpenchannelMessage=require(_0x314c('0x1'))['db'][_0x314c('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x314c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x41a493){return function(_0x5d82d2,_0x5842e6,_0x480497){OpenchannelMessageEvents[_0x314c('0x4')](_0x41a493+':'+_0x5d82d2['id'],_0x5d82d2);OpenchannelMessageEvents[_0x314c('0x4')](_0x41a493,_0x5d82d2);_0x480497(null);};}for(var e in events){if(events[_0x314c('0x5')](e)){var event=events[e];OpenchannelMessage[_0x314c('0x6')](e,emitEvent(event));}}module[_0x314c('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b691676..27a36a9 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 _0xc67d=['out','secret','isNil','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','POST','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x35ecc9,_0x22d5b4){var _0x53d5fc=function(_0x4cbebd){while(--_0x4cbebd){_0x35ecc9['push'](_0x35ecc9['shift']());}};_0x53d5fc(++_0x22d5b4);}(_0xc67d,0xab));var _0xdc67=function(_0x3caa2e,_0x170250){_0x3caa2e=_0x3caa2e-0x0;var _0x5b214e=_0xc67d[_0x3caa2e];return _0x5b214e;};'use strict';var _=require(_0xdc67('0x0'));var util=require(_0xdc67('0x1'));var logger=require('../../config/logger')(_0xdc67('0x2'));var moment=require(_0xdc67('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc67('0x4'));var fs=require('fs');var path=require(_0xdc67('0x5'));var rimraf=require(_0xdc67('0x6'));var config=require(_0xdc67('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xdc67('0x8')]=function(_0x3f0079,_0x534ee0){return _0x3f0079[_0xdc67('0x9')](_0xdc67('0xa'),attributes,{'tableName':_0xdc67('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xdc67('0xc')],'type':_0xdc67('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fa0c0,_0x1a431a,_0x5b571b){var _0x5ee3d5=_0x3f0079['models'];var _0x4f3321=_0x4fa0c0[_0xdc67('0xe')]({'plain':!![]});if(_0x4f3321[_0xdc67('0xf')][_0xdc67('0x10')]()==='in'||_0x4f3321[_0xdc67('0xf')]['toLowerCase']()===_0xdc67('0x11')&&!_0x4f3321[_0xdc67('0x12')]&&!_[_0xdc67('0x13')](_0x4f3321['UserId'])){_0x5ee3d5['OpenchannelInteraction'][_0xdc67('0x14')]({'where':{'id':_0x4f3321[_0xdc67('0x15')]}})[_0xdc67('0x16')](function(_0x1af14d){if(_0x1af14d){_0x1af14d[_0xdc67('0x17')]({'lastMsgAt':_0x4f3321['createdAt'],'lastMsgDirection':_0x4f3321[_0xdc67('0xf')]['toLowerCase']()});}})[_0xdc67('0x18')](function(_0x3dd8e8){console[_0xdc67('0x19')](_0x3dd8e8);});}if(_0x4f3321['direction']===_0xdc67('0x11')&&!_0x4f3321['secret']){var _0x3548df;_0x5ee3d5[_0xdc67('0x1a')][_0xdc67('0x1b')]()[_0xdc67('0x16')](function(_0x47ec67){return _0x5ee3d5[_0xdc67('0x1c')]['find']({'where':{'id':_0x4f3321['OpenchannelAccountId']},'include':[{'model':_0x5ee3d5[_0xdc67('0x1d')],'as':_0xdc67('0x1e'),'where':{'id':_0x4f3321[_0xdc67('0x15')]},'limit':0x1,'include':[{'model':_0x5ee3d5['CmContact'],'as':_0xdc67('0x1f'),'attributes':_[_0xdc67('0x20')](_0x47ec67)}]}]});})[_0xdc67('0x16')](function(_0x1183ed){_0x3548df=_0x1183ed['get']({'plain':!![]});if(_0x3548df&&_0x3548df[_0xdc67('0x21')]){logger[_0xdc67('0x22')](_0xdc67('0x23'),_0xdc67('0x24'),util['format'](_0xdc67('0x25'),_0x4f3321['id'],_0x3548df[_0xdc67('0x21')]));if(_0x3548df[_0xdc67('0x1e')]&&_0x3548df[_0xdc67('0x1e')]['length']){_0x4f3321[_0xdc67('0x26')]=_['omit'](_0x3548df[_0xdc67('0x1e')][0x0],'Contact');_0x4f3321[_0xdc67('0x1f')]=_0x3548df['Interactions'][0x0][_0xdc67('0x1f')];}var _0x1a431a={'method':_0xdc67('0x27'),'uri':encodeURI(_0x3548df[_0xdc67('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1a431a['method']){case _0xdc67('0x28'):_0x1a431a['qs']=_0x4f3321;break;case _0xdc67('0x27'):_0x1a431a[_0xdc67('0xc')]=_0x4f3321;break;}return rp(_0x1a431a)[_0xdc67('0x16')](function(_0x2c69bd){logger[_0xdc67('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xdc67('0x29')](_0xdc67('0x2a'),_0x4f3321['id'],_0x3548df[_0xdc67('0x21')]));if(_0x2c69bd['body'][_0xdc67('0x2b')]&&_0x2c69bd['body'][_0xdc67('0x2b')]!=_0x4f3321[_0xdc67('0x26')][_0xdc67('0x2b')]){return _0x5ee3d5[_0xdc67('0x1d')]['update']({'threadId':_0x2c69bd[_0xdc67('0xc')][_0xdc67('0x2b')]},{'logging':!![],'where':{'id':_0x4f3321['Interaction']['id']}});}else{return;}})['then'](function(){return _0x4fa0c0[_0xdc67('0x17')]({'read':!![]});})[_0xdc67('0x18')](function(_0x4d9bc7){logger[_0xdc67('0x19')](_0xdc67('0x23'),_0xdc67('0x24'),util[_0xdc67('0x2c')](_0x4d9bc7,{'showHidden':![],'depth':null}));_0x5b571b();});}else{_0x5b571b();}})[_0xdc67('0x2d')](function(){_0x5b571b();});}else{_0x5b571b();}}},'charset':_0xdc67('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0093=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','GET','body','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models'];(function(_0x1a5d07,_0x3dc909){var _0x36ccea=function(_0x539691){while(--_0x539691){_0x1a5d07['push'](_0x1a5d07['shift']());}};_0x36ccea(++_0x3dc909);}(_0x0093,0x164));var _0x3009=function(_0x1db1f2,_0x238fb1){_0x1db1f2=_0x1db1f2-0x0;var _0x530e85=_0x0093[_0x1db1f2];return _0x530e85;};'use strict';var _=require(_0x3009('0x0'));var util=require('util');var logger=require(_0x3009('0x1'))(_0x3009('0x2'));var moment=require('moment');var BPromise=require(_0x3009('0x3'));var rp=require(_0x3009('0x4'));var fs=require('fs');var path=require(_0x3009('0x5'));var rimraf=require(_0x3009('0x6'));var config=require('../../config/environment');var attributes=require(_0x3009('0x7'));module[_0x3009('0x8')]=function(_0xc8b457,_0x48a353){return _0xc8b457[_0x3009('0x9')](_0x3009('0xa'),attributes,{'tableName':_0x3009('0xb'),'paranoid':![],'indexes':[{'name':_0x3009('0xc'),'fields':['body'],'type':_0x3009('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe98efb,_0xeb1c27,_0x4cba25){var _0x2c1784=_0xc8b457[_0x3009('0xe')];var _0x204a29=_0xe98efb[_0x3009('0xf')]({'plain':!![]});if(_0x204a29[_0x3009('0x10')][_0x3009('0x11')]()==='in'||_0x204a29['direction'][_0x3009('0x11')]()===_0x3009('0x12')&&!_0x204a29[_0x3009('0x13')]&&!_[_0x3009('0x14')](_0x204a29[_0x3009('0x15')])){_0x2c1784['OpenchannelInteraction'][_0x3009('0x16')]({'where':{'id':_0x204a29[_0x3009('0x17')]}})['then'](function(_0x22fcfa){if(_0x22fcfa){_0x22fcfa[_0x3009('0x18')]({'lastMsgAt':_0x204a29[_0x3009('0x19')],'lastMsgDirection':_0x204a29[_0x3009('0x10')][_0x3009('0x11')]()});}})['catch'](function(_0x289eb3){console[_0x3009('0x1a')](_0x289eb3);});}if(_0x204a29[_0x3009('0x10')]===_0x3009('0x12')&&!_0x204a29[_0x3009('0x13')]){var _0x25ba34;_0x2c1784[_0x3009('0x1b')][_0x3009('0x1c')]()[_0x3009('0x1d')](function(_0x103ba7){return _0x2c1784[_0x3009('0x1e')][_0x3009('0x1f')]({'where':{'id':_0x204a29['OpenchannelAccountId']},'include':[{'model':_0x2c1784[_0x3009('0x20')],'as':_0x3009('0x21'),'where':{'id':_0x204a29[_0x3009('0x17')]},'limit':0x1,'include':[{'model':_0x2c1784[_0x3009('0x1b')],'as':_0x3009('0x22'),'attributes':_[_0x3009('0x23')](_0x103ba7)}]}]});})[_0x3009('0x1d')](function(_0x2ac547){_0x25ba34=_0x2ac547[_0x3009('0xf')]({'plain':!![]});if(_0x25ba34&&_0x25ba34['replyUri']){logger[_0x3009('0x24')](_0x3009('0x25'),'afterCreate',util['format'](_0x3009('0x26'),_0x204a29['id'],_0x25ba34[_0x3009('0x27')]));if(_0x25ba34[_0x3009('0x21')]&&_0x25ba34[_0x3009('0x21')][_0x3009('0x28')]){_0x204a29[_0x3009('0x29')]=_[_0x3009('0x2a')](_0x25ba34['Interactions'][0x0],_0x3009('0x22'));_0x204a29['Contact']=_0x25ba34['Interactions'][0x0]['Contact'];}var _0xeb1c27={'method':_0x3009('0x2b'),'uri':encodeURI(_0x25ba34[_0x3009('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xeb1c27[_0x3009('0x2c')]){case _0x3009('0x2d'):_0xeb1c27['qs']=_0x204a29;break;case'POST':_0xeb1c27[_0x3009('0x2e')]=_0x204a29;break;}return rp(_0xeb1c27)[_0x3009('0x1d')](function(_0x1b46cd){logger[_0x3009('0x24')](_0x3009('0x25'),_0x3009('0x2f'),util['format'](_0x3009('0x30'),_0x204a29['id'],_0x25ba34[_0x3009('0x27')]));if(_0x1b46cd[_0x3009('0x2e')]['threadId']&&_0x1b46cd[_0x3009('0x2e')][_0x3009('0x31')]!=_0x204a29[_0x3009('0x29')][_0x3009('0x31')]){return _0x2c1784[_0x3009('0x20')][_0x3009('0x18')]({'threadId':_0x1b46cd[_0x3009('0x2e')][_0x3009('0x31')]},{'logging':!![],'where':{'id':_0x204a29['Interaction']['id']}});}else{return;}})[_0x3009('0x1d')](function(){return _0xe98efb['update']({'read':!![]});})['catch'](function(_0x56346a){logger['error'](_0x3009('0x25'),_0x3009('0x2f'),util[_0x3009('0x32')](_0x56346a,{'showHidden':![],'depth':null}));_0x4cba25();});}else{_0x4cba25();}})['finally'](function(){_0x4cba25();});}else{_0x4cba25();}}},'charset':_0x3009('0x33'),'collate':_0x3009('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 03d8ffc..452732d 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x193a53,_0x3d7f81){var _0x385908=function(_0x1a7d4a){while(--_0x1a7d4a){_0x193a53['push'](_0x193a53['shift']());}};_0x385908(++_0x3d7f81);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x5f2f[_0x15cbce];return _0x257f29;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +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(_0x18175b,_0x4d7376){var _0x210d45=function(_0x24f924){while(--_0x24f924){_0x18175b['push'](_0x18175b['shift']());}};_0x210d45(++_0x4d7376);}(_0xb10b,0x12a));var _0xbb10=function(_0x35c97a,_0x513aba){_0x35c97a=_0x35c97a-0x0;var _0x388917=_0xb10b[_0x35c97a];return _0x388917;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 81f4e27..db958b1 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 _0xda3f=['openchannelMessage:','save','remove','register','length'];(function(_0x4a2917,_0xeb4863){var _0x410b4a=function(_0x351e3e){while(--_0x351e3e){_0x4a2917['push'](_0x4a2917['shift']());}};_0x410b4a(++_0xeb4863);}(_0xda3f,0xec));var _0xfda3=function(_0x17414c,_0x33b3c8){_0x17414c=_0x17414c-0x0;var _0x3f7130=_0xda3f[_0x17414c];return _0x3f7130;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){OpenchannelMessageEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);OpenchannelMessageEvents['on'](_0x42476a,_0x125e2a);}}; \ No newline at end of file +var _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 31a94a6..40b71a2 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 _0xbe3b=['express','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','exports','util','path'];(function(_0x4c65fd,_0x2ba5cc){var _0x315e4b=function(_0x557969){while(--_0x557969){_0x4c65fd['push'](_0x4c65fd['shift']());}};_0x315e4b(++_0x2ba5cc);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x28b7a2,_0x40aa58){_0x28b7a2=_0x28b7a2-0x0;var _0x404e08=_0xbe3b[_0x28b7a2];return _0x404e08;};'use strict';var multer=require('multer');var util=require(_0xbbe3('0x0'));var path=require(_0xbbe3('0x1'));var timeout=require('connect-timeout');var express=require(_0xbbe3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbbe3('0x3'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0xbbe3('0x4')]('/',auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x6')]);router[_0xbbe3('0x4')]('/describe',auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x7')]);router[_0xbbe3('0x4')](_0xbbe3('0x8'),auth[_0xbbe3('0x5')](),controller['show']);router[_0xbbe3('0x4')](_0xbbe3('0x9'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0xa')]);router[_0xbbe3('0x4')](_0xbbe3('0xb'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0xc')]);router['get'](_0xbbe3('0xd'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0xe')]);router[_0xbbe3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbbe3('0xf')](_0xbbe3('0xb'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x10')]);router[_0xbbe3('0xf')](_0xbbe3('0xd'),auth['isAuthenticated'](),controller[_0xbbe3('0x11')]);router['put'](_0xbbe3('0x8'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x12')]);router[_0xbbe3('0x13')](_0xbbe3('0x8'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x14')]);router[_0xbbe3('0x13')](_0xbbe3('0xb'),auth[_0xbbe3('0x5')](),controller[_0xbbe3('0x15')]);router[_0xbbe3('0x13')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xbbe3('0x16')]=router; \ No newline at end of file +var _0xc627=['getAgents','post','create','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x478fd2,_0x47e6eb){var _0x313061=function(_0x271a9f){while(--_0x271a9f){_0x478fd2['push'](_0x478fd2['shift']());}};_0x313061(++_0x47e6eb);}(_0xc627,0x14a));var _0x7c62=function(_0x330c31,_0x5e016b){_0x330c31=_0x330c31-0x0;var _0x4b655c=_0xc627[_0x330c31];return _0x4b655c;};'use strict';var multer=require('multer');var util=require(_0x7c62('0x0'));var path=require(_0x7c62('0x1'));var timeout=require(_0x7c62('0x2'));var express=require('express');var router=express[_0x7c62('0x3')]();var auth=require(_0x7c62('0x4'));var interaction=require(_0x7c62('0x5'));var config=require(_0x7c62('0x6'));var controller=require(_0x7c62('0x7'));router[_0x7c62('0x8')]('/',auth[_0x7c62('0x9')](),controller[_0x7c62('0xa')]);router[_0x7c62('0x8')](_0x7c62('0xb'),auth[_0x7c62('0x9')](),controller[_0x7c62('0xc')]);router['get']('/:id',auth[_0x7c62('0x9')](),controller[_0x7c62('0xd')]);router[_0x7c62('0x8')](_0x7c62('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x7c62('0xf'),auth['isAuthenticated'](),controller[_0x7c62('0x10')]);router[_0x7c62('0x8')](_0x7c62('0x11'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x12')]);router[_0x7c62('0x13')]('/',auth[_0x7c62('0x9')](),controller[_0x7c62('0x14')]);router[_0x7c62('0x13')](_0x7c62('0xf'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x15')]);router[_0x7c62('0x13')](_0x7c62('0x11'),auth[_0x7c62('0x9')](),controller['addAgents']);router[_0x7c62('0x16')]('/:id',auth[_0x7c62('0x9')](),controller['update']);router[_0x7c62('0x17')](_0x7c62('0x18'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x19')]);router[_0x7c62('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7c62('0x1a')]);router['delete'](_0x7c62('0x11'),auth[_0x7c62('0x9')](),controller[_0x7c62('0x1b')]);module[_0x7c62('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ee75e13..ecceb53 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 _0x5046=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5046,0x6d));var _0x6504=function(_0x15a768,_0xfe3901){_0x15a768=_0x15a768-0x0;var _0x332c93=_0x5046[_0x15a768];return _0x332c93;};'use strict';var Sequelize=require(_0x6504('0x0'));module[_0x6504('0x1')]={'name':{'type':Sequelize[_0x6504('0x2')],'unique':_0x6504('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6504('0x2')]},'timeout':{'type':Sequelize[_0x6504('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6504('0x5')](_0x6504('0x6'),_0x6504('0x7'),_0x6504('0x8'))}}; \ No newline at end of file +var _0x675f=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x1108a7,_0x4ac899){var _0x2dfa9d=function(_0x23289c){while(--_0x23289c){_0x1108a7['push'](_0x1108a7['shift']());}};_0x2dfa9d(++_0x4ac899);}(_0x675f,0x149));var _0xf675=function(_0x4d6b47,_0x42eff4){_0x4d6b47=_0x4d6b47-0x0;var _0x592951=_0x675f[_0x4d6b47];return _0x592951;};'use strict';var Sequelize=require(_0xf675('0x0'));module[_0xf675('0x1')]={'name':{'type':Sequelize[_0xf675('0x2')],'unique':_0xf675('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf675('0x2')]},'timeout':{'type':Sequelize[_0xf675('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf675('0x5')](_0xf675('0x6'),_0xf675('0x7'),_0xf675('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a4701ae..ec79e66 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 _0x4d8e=['value','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','OpenchannelQueues','UserProfileResource','destroy','stack','name','send','index','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','OpenchannelQueue','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','order','OpenchannelQueueId','map','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4d8e,0x128));var _0xe4d8=function(_0x1faa02,_0x2b2b65){_0x1faa02=_0x1faa02-0x0;var _0x25b362=_0x4d8e[_0x1faa02];return _0x25b362;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4d8('0x0'));var rimraf=require(_0xe4d8('0x1'));var zipdir=require(_0xe4d8('0x2'));var jsonpatch=require(_0xe4d8('0x3'));var rp=require(_0xe4d8('0x4'));var moment=require(_0xe4d8('0x5'));var BPromise=require(_0xe4d8('0x6'));var Mustache=require(_0xe4d8('0x7'));var util=require(_0xe4d8('0x8'));var path=require(_0xe4d8('0x9'));var sox=require(_0xe4d8('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4d8('0xb'));var jsforce=require(_0xe4d8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe4d8('0xd'));var querystring=require(_0xe4d8('0xe'));var Papa=require(_0xe4d8('0xf'));var Redis=require(_0xe4d8('0x10'));var authService=require(_0xe4d8('0x11'));var qs=require(_0xe4d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4d8('0x13'));var logger=require(_0xe4d8('0x14'))(_0xe4d8('0x15'));var utils=require(_0xe4d8('0x16'));var config=require(_0xe4d8('0x17'));var licenseUtil=require(_0xe4d8('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe4d8('0x19')](config[_0xe4d8('0x1a')],{'host':_0xe4d8('0x1b'),'port':0x18eb});var socket=require(_0xe4d8('0x1c'))(new Redis(config[_0xe4d8('0x1a')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f7448,_0x169842){_0x169842=_0x169842||0xcc;return function(_0x445f42){if(_0x445f42){return _0x4f7448[_0xe4d8('0x1d')](_0x169842);}return _0x4f7448[_0xe4d8('0x1e')](_0x169842)[_0xe4d8('0x1f')]();};}function respondWithResult(_0x59c186,_0x442cae){_0x442cae=_0x442cae||0xc8;return function(_0x469bdd){if(_0x469bdd){return _0x59c186[_0xe4d8('0x1e')](_0x442cae)[_0xe4d8('0x20')](_0x469bdd);}};}function respondWithFilteredResult(_0x4f677e,_0x324c32){return function(_0x46772a){if(_0x46772a){var _0x57ea17=_0x46772a[_0xe4d8('0x21')],_0x32844a=_0x324c32[_0xe4d8('0x22')],_0x4a45fe=_0x324c32[_0xe4d8('0x22')]+_0x324c32[_0xe4d8('0x23')],_0x4c188e;if(_0x4a45fe>=_0x57ea17){_0x4a45fe=_0x57ea17;_0x4c188e=0xc8;}else{_0x4c188e=0xce;}_0x4f677e[_0xe4d8('0x1e')](_0x4c188e);return _0x4f677e[_0xe4d8('0x24')](_0xe4d8('0x25'),_0x32844a+'-'+_0x4a45fe+'/'+_0x57ea17)['json'](_0x46772a);}return null;};}function patchUpdates(_0x6aa63d){return function(_0xfa2357){try{jsonpatch[_0xe4d8('0x26')](_0xfa2357,_0x6aa63d,!![]);}catch(_0x486a35){return BPromise[_0xe4d8('0x27')](_0x486a35);}return _0xfa2357[_0xe4d8('0x28')]();};}function saveUpdates(_0x289e90,_0x1fac1a){return function(_0x1436ae){if(_0x1436ae){return _0x1436ae['update'](_0x289e90)['then'](function(_0x4e3010){return _0x4e3010;});}return null;};}function removeEntity(_0x5f2df3,_0x59d13c){return function(_0x3230e5){if(_0x3230e5){return _0x3230e5['destroy']()[_0xe4d8('0x29')](function(){var _0x53592c=_0x3230e5['get']({'plain':!![]});var _0xc2957b=_0xe4d8('0x2a');return db[_0xe4d8('0x2b')][_0xe4d8('0x2c')]({'where':{'type':_0xc2957b,'resourceId':_0x53592c['id']}})[_0xe4d8('0x29')](function(){return _0x3230e5;});})[_0xe4d8('0x29')](function(){_0x5f2df3[_0xe4d8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f78d,_0x35a424){return function(_0x5ecd63){if(!_0x5ecd63){_0x45f78d[_0xe4d8('0x1d')](0x194);}return _0x5ecd63;};}function handleError(_0xdb1d2e,_0x235f54){_0x235f54=_0x235f54||0x1f4;return function(_0x396524){logger['error'](_0x396524[_0xe4d8('0x2d')]);if(_0x396524[_0xe4d8('0x2e')]){delete _0x396524[_0xe4d8('0x2e')];}_0xdb1d2e['status'](_0x235f54)[_0xe4d8('0x2f')](_0x396524);};}exports[_0xe4d8('0x30')]=function(_0xe5c183,_0x31a6b4){var _0x3d39cb={},_0x5816ca={},_0x27ad97={'count':0x0,'rows':[]};var _0x586d45=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x19e34a){return{'name':_0x19e34a['fieldName'],'type':_0x19e34a['type'][_0xe4d8('0x31')]};});_0x5816ca[_0xe4d8('0x32')]=_['map'](_0x586d45,_0xe4d8('0x2e'));_0x5816ca[_0xe4d8('0x33')]=_[_0xe4d8('0x34')](_0xe5c183['query']);_0x5816ca['filters']=_[_0xe4d8('0x35')](_0x5816ca[_0xe4d8('0x32')],_0x5816ca['query']);_0x3d39cb[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x5816ca[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x37')]));_0x3d39cb[_0xe4d8('0x36')]=_0x3d39cb[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x3d39cb[_0xe4d8('0x36')]:_0x5816ca[_0xe4d8('0x32')];if(!_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x39')](_0xe4d8('0x3a'))){_0x3d39cb[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0xe5c183['query'][_0xe4d8('0x23')]);_0x3d39cb[_0xe4d8('0x22')]=qs[_0xe4d8('0x22')](_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x22')]);}_0x3d39cb['order']=qs[_0xe4d8('0x3b')](_0xe5c183['query'][_0xe4d8('0x3b')]);_0x3d39cb[_0xe4d8('0x3c')]=qs[_0xe4d8('0x3d')](_[_0xe4d8('0x3e')](_0xe5c183[_0xe4d8('0x33')],_0x5816ca['filters']),_0x586d45);if(_0xe5c183[_0xe4d8('0x33')]['filter']){_0x3d39cb[_0xe4d8('0x3c')]=_['merge'](_0x3d39cb[_0xe4d8('0x3c')],{'$or':_['map'](_0x586d45,function(_0x1f1897){if(_0x1f1897[_0xe4d8('0x3f')]!==_0xe4d8('0x40')){var _0x1bb6fd={};_0x1bb6fd[_0x1f1897['name']]={'$like':'%'+_0xe5c183[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x1bb6fd;}})});}_0x3d39cb=_[_0xe4d8('0x42')]({},_0x3d39cb,_0xe5c183[_0xe4d8('0x43')]);var _0x39ef4d={'where':_0x3d39cb[_0xe4d8('0x3c')]};return db['OpenchannelQueue'][_0xe4d8('0x21')](_0x39ef4d)[_0xe4d8('0x29')](function(_0x451bfd){_0x27ad97['count']=_0x451bfd;if(_0xe5c183[_0xe4d8('0x33')]['includeAll']){_0x3d39cb[_0xe4d8('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xe4d8('0x45')](_0x3d39cb);})['then'](function(_0x46a4d5){_0x27ad97[_0xe4d8('0x46')]=_0x46a4d5;return _0x27ad97;})[_0xe4d8('0x29')](respondWithFilteredResult(_0x31a6b4,_0x3d39cb))[_0xe4d8('0x47')](handleError(_0x31a6b4,null));};exports[_0xe4d8('0x48')]=function(_0xff5d7a,_0x2035cd){var _0x8ab037={'raw':!![],'where':{'id':_0xff5d7a[_0xe4d8('0x49')]['id']}},_0x33c954={};_0x33c954[_0xe4d8('0x32')]=_[_0xe4d8('0x34')](db['OpenchannelQueue'][_0xe4d8('0x4a')]);_0x33c954[_0xe4d8('0x33')]=_[_0xe4d8('0x34')](_0xff5d7a['query']);_0x33c954[_0xe4d8('0x3d')]=_[_0xe4d8('0x35')](_0x33c954['model'],_0x33c954[_0xe4d8('0x33')]);_0x8ab037[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x33c954[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0xff5d7a[_0xe4d8('0x33')][_0xe4d8('0x37')]));_0x8ab037[_0xe4d8('0x36')]=_0x8ab037[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x8ab037[_0xe4d8('0x36')]:_0x33c954[_0xe4d8('0x32')];if(_0xff5d7a[_0xe4d8('0x33')][_0xe4d8('0x4b')]){_0x8ab037[_0xe4d8('0x44')]=[{'all':!![]}];}_0x8ab037=_[_0xe4d8('0x42')]({},_0x8ab037,_0xff5d7a[_0xe4d8('0x43')]);return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')](_0x8ab037)[_0xe4d8('0x29')](handleEntityNotFound(_0x2035cd,null))[_0xe4d8('0x29')](respondWithResult(_0x2035cd,null))[_0xe4d8('0x47')](handleError(_0x2035cd,null));};exports[_0xe4d8('0x4e')]=function(_0xc33c9a,_0x293446){return db['OpenchannelQueue'][_0xe4d8('0x4e')](_0xc33c9a[_0xe4d8('0x4f')],{})[_0xe4d8('0x29')](function(_0x1c5ca0){var _0x2ea119=_0xc33c9a[_0xe4d8('0x50')]['get']({'plain':!![]});if(!_0x2ea119)throw new Error(_0xe4d8('0x51'));if(_0x2ea119[_0xe4d8('0x52')]===_0xe4d8('0x50')){var _0x30d1a8=_0x1c5ca0[_0xe4d8('0x53')]({'plain':!![]});var _0xde734e=_0xe4d8('0x2a');return db[_0xe4d8('0x54')][_0xe4d8('0x4d')]({'where':{'name':_0xde734e,'userProfileId':_0x2ea119[_0xe4d8('0x55')]},'raw':!![]})[_0xe4d8('0x29')](function(_0x484073){if(_0x484073&&_0x484073[_0xe4d8('0x56')]===0x0){return db[_0xe4d8('0x2b')]['create']({'name':_0x30d1a8[_0xe4d8('0x2e')],'resourceId':_0x30d1a8['id'],'type':_0x484073['name'],'sectionId':_0x484073['id']},{})[_0xe4d8('0x29')](function(){return _0x1c5ca0;});}else{return _0x1c5ca0;}})[_0xe4d8('0x47')](function(_0x1f88ef){logger[_0xe4d8('0x57')](_0xe4d8('0x58'),_0x1f88ef);throw _0x1f88ef;});}return _0x1c5ca0;})['then'](respondWithResult(_0x293446,0xc9))[_0xe4d8('0x47')](handleError(_0x293446,null));};exports['update']=function(_0x4edbee,_0x188b2c){if(_0x4edbee[_0xe4d8('0x4f')]['id']){delete _0x4edbee[_0xe4d8('0x4f')]['id'];}return db[_0xe4d8('0x4c')]['find']({'where':{'id':_0x4edbee['params']['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x188b2c,null))[_0xe4d8('0x29')](saveUpdates(_0x4edbee[_0xe4d8('0x4f')],null))[_0xe4d8('0x29')](respondWithResult(_0x188b2c,null))['catch'](handleError(_0x188b2c,null));};exports['destroy']=function(_0x4971b4,_0x2ea9a9){return db['OpenchannelQueue'][_0xe4d8('0x4d')]({'where':{'id':_0x4971b4[_0xe4d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ea9a9,null))[_0xe4d8('0x29')](removeEntity(_0x2ea9a9,null))[_0xe4d8('0x47')](handleError(_0x2ea9a9,null));};exports[_0xe4d8('0x59')]=function(_0x172b5c,_0x32e83d){return db[_0xe4d8('0x4c')][_0xe4d8('0x59')]()[_0xe4d8('0x29')](respondWithResult(_0x32e83d,null))['catch'](handleError(_0x32e83d,null));};exports['getMembers']=function(_0x110067,_0x336ae9,_0x8b2dea){var _0x491797={'raw':!![],'where':{}},_0x5b9333={},_0x5c0e24;return db[_0xe4d8('0x4c')]['findOne']({'where':{'id':_0x110067[_0xe4d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x336ae9,null))['then'](function(_0x2910e7){if(_0x2910e7){_0x5c0e24=_0x2910e7[_0xe4d8('0x53')]({'plain':!![]});_0x5b9333['model']=_[_0xe4d8('0x34')](db['UserOpenchannelQueue']['rawAttributes']);_0x5b9333['query']=_[_0xe4d8('0x34')](_0x110067[_0xe4d8('0x33')]);_0x5b9333[_0xe4d8('0x3d')]=_['intersection'](_0x5b9333['model'],_0x5b9333[_0xe4d8('0x33')]);_0x491797[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x5b9333[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0x110067[_0xe4d8('0x33')][_0xe4d8('0x37')]));_0x491797[_0xe4d8('0x36')]=_0x491797[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x491797[_0xe4d8('0x36')]:_0x5b9333[_0xe4d8('0x32')];if(!_0x110067[_0xe4d8('0x33')][_0xe4d8('0x39')](_0xe4d8('0x3a'))){_0x491797[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0x110067[_0xe4d8('0x33')]['limit']);_0x491797[_0xe4d8('0x22')]=qs['offset'](_0x110067[_0xe4d8('0x33')][_0xe4d8('0x22')]);}_0x491797[_0xe4d8('0x5a')]=qs[_0xe4d8('0x3b')](_0x110067[_0xe4d8('0x33')][_0xe4d8('0x3b')]);_0x491797[_0xe4d8('0x3c')]=qs[_0xe4d8('0x3d')](_[_0xe4d8('0x3e')](_0x110067[_0xe4d8('0x33')],_0x5b9333[_0xe4d8('0x3d')]));_0x491797[_0xe4d8('0x3c')][_0xe4d8('0x5b')]=_0x2910e7['id'];if(_0x110067[_0xe4d8('0x33')][_0xe4d8('0x41')]){_0x491797[_0xe4d8('0x3c')]=_['merge'](_0x491797[_0xe4d8('0x3c')],{'$or':_[_0xe4d8('0x5c')](_0x491797[_0xe4d8('0x36')],function(_0x1be6d1){var _0x260f32={};_0x260f32[_0x1be6d1]={'$like':'%'+_0x110067[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x260f32;})});}_0x491797=_[_0xe4d8('0x42')]({},_0x491797,_0x110067['options']);return db[_0xe4d8('0x5d')][_0xe4d8('0x45')](_0x491797);}})[_0xe4d8('0x29')](function(_0x5f2f59){if(_0x5f2f59){return db[_0xe4d8('0x5e')][_0xe4d8('0x5f')]({'where':{'id':_[_0xe4d8('0x5c')](_0x5f2f59,'UserId'),'role':_0xe4d8('0x60')},'attributes':['id',_0xe4d8('0x2e'),_0xe4d8('0x61'),_0xe4d8('0x62'),_0xe4d8('0x63')]});}})['then'](function(_0x4a7b00){if(_0x4a7b00){return{'count':_0x4a7b00[_0xe4d8('0x21')],'rows':_[_0xe4d8('0x5c')](_0x4a7b00[_0xe4d8('0x46')],function(_0x1d5f37){return{'membername':_0x1d5f37[_0xe4d8('0x2e')],'UserId':_0x1d5f37['id'],'queue_name':_0x5c0e24[_0xe4d8('0x2e')],'OpenchannelQueueId':_0x5c0e24['id'],'interface':util[_0xe4d8('0x64')](_0xe4d8('0x65'),_0xe4d8('0x66'),_0x1d5f37['name']),'penalty':0x0,'paused':_0x1d5f37['openchannelPause'],'createdAt':_0x1d5f37[_0xe4d8('0x63')],'updatedAt':_0x1d5f37[_0xe4d8('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4d8('0x29')](respondWithFilteredResult(_0x336ae9,_0x491797))[_0xe4d8('0x47')](handleError(_0x336ae9,null));};exports[_0xe4d8('0x67')]=function(_0x586fdf,_0x37671e,_0x55ad5a){var _0xfb12eb={};var _0x799362={};var _0x1b45be;var _0x1d3bbf;return db[_0xe4d8('0x4c')][_0xe4d8('0x68')]({'where':{'id':_0x586fdf[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x37671e,null))['then'](function(_0x50f352){if(_0x50f352){_0x1b45be=_0x50f352;_0x799362[_0xe4d8('0x32')]=_[_0xe4d8('0x34')](db[_0xe4d8('0x69')][_0xe4d8('0x4a')]);_0x799362[_0xe4d8('0x33')]=_[_0xe4d8('0x34')](_0x586fdf[_0xe4d8('0x33')]);_0x799362['filters']=_['intersection'](_0x799362['model'],_0x799362['query']);_0xfb12eb[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0x799362[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0x586fdf[_0xe4d8('0x33')]['fields']));_0xfb12eb[_0xe4d8('0x36')]=_0xfb12eb[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0xfb12eb['attributes']:_0x799362['model'];_0xfb12eb['order']=qs[_0xe4d8('0x3b')](_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x3b')]);_0xfb12eb[_0xe4d8('0x3c')]=qs['filters'](_[_0xe4d8('0x3e')](_0x586fdf['query'],_0x799362['filters']));if(_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x41')]){_0xfb12eb[_0xe4d8('0x3c')]=_[_0xe4d8('0x42')](_0xfb12eb[_0xe4d8('0x3c')],{'$or':_['map'](_0xfb12eb[_0xe4d8('0x36')],function(_0x568d50){var _0x364167={};_0x364167[_0x568d50]={'$like':'%'+_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x364167;})});}_0xfb12eb=_[_0xe4d8('0x42')]({},_0xfb12eb,_0x586fdf[_0xe4d8('0x43')]);return _0x1b45be[_0xe4d8('0x67')](_0xfb12eb);}})['then'](function(_0x439ddd){if(_0x439ddd){_0x1d3bbf=_0x439ddd[_0xe4d8('0x38')];if(!_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x39')]('nolimit')){_0xfb12eb[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x23')]);_0xfb12eb['offset']=qs[_0xe4d8('0x22')](_0x586fdf[_0xe4d8('0x33')][_0xe4d8('0x22')]);}return _0x1b45be[_0xe4d8('0x67')](_0xfb12eb);}})['then'](function(_0x5eaefb){if(_0x5eaefb){return _0x5eaefb?{'count':_0x1d3bbf,'rows':_0x5eaefb}:null;}})[_0xe4d8('0x29')](respondWithResult(_0x37671e,null))[_0xe4d8('0x47')](handleError(_0x37671e,null));};exports['addTeams']=function(_0x5258e6,_0x4f9df5,_0x5b20bd){var _0x54dcde=_0x5258e6[_0xe4d8('0x4f')][_0xe4d8('0x6a')];return db[_0xe4d8('0x69')][_0xe4d8('0x45')]({'where':{'id':_0x54dcde},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe4d8('0x6b'),'attributes':['id',_0xe4d8('0x2e'),_0xe4d8('0x6c'),_0xe4d8('0x6d'),_0xe4d8('0x6e')],'raw':!![]}]})['then'](function(_0x53cc48){if(_0x53cc48){var _0x427a9c=_[_0xe4d8('0x6f')](_0x53cc48,function(_0x3ab535){var _0x1193d8=_0x3ab535[_0xe4d8('0x53')]({'plain':!![]});return _0x1193d8[_0xe4d8('0x6b')];});return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')]({'where':{'id':_0x5258e6['params']['id']}})[_0xe4d8('0x29')](function(_0x5014f5){return db[_0xe4d8('0x70')][_0xe4d8('0x71')](function(_0x2a0f87){return _0x5014f5[_0xe4d8('0x72')](_0x54dcde,{'transaction':_0x2a0f87})[_0xe4d8('0x29')](function(){return BPromise['each'](_0x427a9c,function(_0x5e4574){return db[_0xe4d8('0x5d')][_0xe4d8('0x73')]({'where':{'UserId':_0x5e4574['id'],'OpenchannelQueueId':_0x5258e6[_0xe4d8('0x49')]['id']},'transaction':_0x2a0f87});});})[_0xe4d8('0x29')](function(){_0x427a9c[_0xe4d8('0x74')](function(_0xedfa8e){socket[_0xe4d8('0x75')](_0xe4d8('0x76'),{'UserId':_0xedfa8e['id'],'OpenchannelQueueId':_0x5014f5['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9df5,null))[_0xe4d8('0x47')](handleError(_0x4f9df5,null));};exports[_0xe4d8('0x77')]=function(_0x38c9fb,_0x43f768,_0x2c11aa){return db['Team'][_0xe4d8('0x45')]({'where':{'id':_0x38c9fb['query'][_0xe4d8('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xe4d8('0x5e')],'as':_0xe4d8('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe4d8('0x29')](handleEntityNotFound(_0x43f768,null))[_0xe4d8('0x29')](function(_0x5be62e){var _0x2f20c0=_[_0xe4d8('0x5c')](_0x5be62e,'id');var _0x1a7e76=[];var _0x480a07=[];var _0x19beca=squel[_0xe4d8('0x78')]();_0x19beca[_0xe4d8('0x79')](_0xe4d8('0x7a'))[_0xe4d8('0x7b')](_0xe4d8('0x7c'),'tq')['join']('user_has_teams','ut',_0xe4d8('0x7d'))['where'](_0xe4d8('0x7e'),_0x38c9fb[_0xe4d8('0x49')]['id']);for(var _0x3eb455=0x0;_0x3eb455<_0x5be62e['length'];_0x3eb455+=0x1){let _0x3dd959=_0x5be62e[_0x3eb455];for(var _0x503877=0x0;_0x503877<_0x3dd959[_0xe4d8('0x6b')]['length'];_0x503877+=0x1){let _0x3ea000=_0x3dd959['Agents'][_0x503877];var _0x1b973e=_0x19beca[_0xe4d8('0x7f')]();_0x1b973e[_0xe4d8('0x3c')](_0xe4d8('0x80'),_0x3ea000['id']);_0x480a07['push'](db[_0xe4d8('0x70')]['query'](_0x1b973e[_0xe4d8('0x81')](),{'type':db[_0xe4d8('0x70')][_0xe4d8('0x82')][_0xe4d8('0x83')]})['then'](function(_0x51485e){if(_0x51485e[_0xe4d8('0x38')]===0x1){return _0x3ea000['id'];}else{var _0x579ba8=_['every'](_[_0xe4d8('0x5c')](_0x51485e,'TeamId'),function(_0x5450ad){return _[_0xe4d8('0x84')](_0x2f20c0,_0x5450ad);});if(_0x579ba8){return _0x3ea000['id'];}}}));}}return BPromise[_0xe4d8('0x85')](_0x480a07)['then'](function(_0x586a17){_0x1a7e76=_(_0x1a7e76)[_0xe4d8('0x86')](_0x586a17)[_0xe4d8('0x87')]()[_0xe4d8('0x88')]();return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')]({'where':{'id':_0x38c9fb[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](function(_0x1d3f79){return db[_0xe4d8('0x70')]['transaction'](function(_0x3c99f3){return _0x1d3f79['removeTeams'](_0x38c9fb[_0xe4d8('0x33')][_0xe4d8('0x6a')],{'transaction':_0x3c99f3})[_0xe4d8('0x29')](function(){if(!_[_0xe4d8('0x89')](_0x1a7e76)){return _0x1d3f79[_0xe4d8('0x8a')](_0x1a7e76,{'transaction':_0x3c99f3});}})[_0xe4d8('0x29')](function(){_0x1a7e76[_0xe4d8('0x74')](function(_0x59a220){socket[_0xe4d8('0x75')]('userOpenchannelQueue:remove',{'UserId':_0x59a220,'OpenchannelQueueId':_0x1d3f79['id']});});});});});});})[_0xe4d8('0x29')](respondWithStatusCode(_0x43f768,null))[_0xe4d8('0x47')](handleError(_0x43f768,null));};exports[_0xe4d8('0x8b')]=function(_0x5ab494,_0x33e2ef,_0x3b3c21){return db[_0xe4d8('0x4c')][_0xe4d8('0x4d')]({'where':{'id':_0x5ab494[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x33e2ef,null))['then'](function(_0xd6a1f3){if(_0xd6a1f3){return _0xd6a1f3['addAgents'](_0x5ab494[_0xe4d8('0x4f')][_0xe4d8('0x6a')],_[_0xe4d8('0x8c')](_0x5ab494[_0xe4d8('0x4f')],[_0xe4d8('0x6a'),'id'])||{})['spread'](function(_0x3aabda){for(var _0x254599=0x0;_0x254599<_0x5ab494[_0xe4d8('0x4f')][_0xe4d8('0x6a')][_0xe4d8('0x38')];_0x254599+=0x1){socket[_0xe4d8('0x75')]('userOpenchannelQueue:save',{'UserId':_0x5ab494[_0xe4d8('0x4f')][_0xe4d8('0x6a')][_0x254599],'OpenchannelQueueId':_0x5ab494['params']['id']});}return _0x3aabda;});}})[_0xe4d8('0x29')](respondWithResult(_0x33e2ef,null))[_0xe4d8('0x47')](handleError(_0x33e2ef,null));};exports[_0xe4d8('0x8a')]=function(_0xceab2b,_0x4f0d41,_0x1fc4f2){return db[_0xe4d8('0x4c')]['find']({'where':{'id':_0xceab2b[_0xe4d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f0d41,null))[_0xe4d8('0x29')](function(_0x224292){if(_0x224292){return _0x224292[_0xe4d8('0x8a')](_0xceab2b['query'][_0xe4d8('0x6a')])[_0xe4d8('0x29')](function(){if(_[_0xe4d8('0x8d')](_0xceab2b[_0xe4d8('0x33')]['ids'])){for(var _0x183723=0x0;_0x183723<_0xceab2b[_0xe4d8('0x33')][_0xe4d8('0x6a')][_0xe4d8('0x38')];_0x183723+=0x1){socket[_0xe4d8('0x75')](_0xe4d8('0x8e'),{'UserId':Number(_0xceab2b[_0xe4d8('0x33')][_0xe4d8('0x6a')][_0x183723]),'OpenchannelQueueId':Number(_0xceab2b[_0xe4d8('0x49')]['id'])});}}else{socket[_0xe4d8('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0xceab2b[_0xe4d8('0x33')][_0xe4d8('0x6a')]),'OpenchannelQueueId':Number(_0xceab2b[_0xe4d8('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f0d41,null))['catch'](handleError(_0x4f0d41,null));};exports[_0xe4d8('0x8f')]=function(_0x5a03b9,_0x593aff,_0x53e460){var _0x2432b7={};var _0xd8f5ed={};var _0xfdfa5b;var _0x6c0785;return db[_0xe4d8('0x4c')][_0xe4d8('0x68')]({'where':{'id':_0x5a03b9[_0xe4d8('0x49')]['id']}})[_0xe4d8('0x29')](handleEntityNotFound(_0x593aff,null))[_0xe4d8('0x29')](function(_0x492d12){if(_0x492d12){_0xfdfa5b=_0x492d12;_0xd8f5ed[_0xe4d8('0x32')]=_['keys'](db[_0xe4d8('0x5e')][_0xe4d8('0x4a')]);_0xd8f5ed[_0xe4d8('0x33')]=_['keys'](_0x5a03b9['query']);_0xd8f5ed[_0xe4d8('0x3d')]=_[_0xe4d8('0x35')](_0xd8f5ed[_0xe4d8('0x32')],_0xd8f5ed[_0xe4d8('0x33')]);_0x2432b7[_0xe4d8('0x36')]=_[_0xe4d8('0x35')](_0xd8f5ed[_0xe4d8('0x32')],qs[_0xe4d8('0x37')](_0x5a03b9['query'][_0xe4d8('0x37')]));_0x2432b7[_0xe4d8('0x36')]=_0x2432b7[_0xe4d8('0x36')][_0xe4d8('0x38')]?_0x2432b7['attributes']:_0xd8f5ed[_0xe4d8('0x32')];_0x2432b7[_0xe4d8('0x5a')]=qs[_0xe4d8('0x3b')](_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x3b')]);_0x2432b7[_0xe4d8('0x3c')]=qs[_0xe4d8('0x3d')](_[_0xe4d8('0x3e')](_0x5a03b9[_0xe4d8('0x33')],_0xd8f5ed['filters']));if(_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x41')]){_0x2432b7[_0xe4d8('0x3c')]=_[_0xe4d8('0x42')](_0x2432b7[_0xe4d8('0x3c')],{'$or':_[_0xe4d8('0x5c')](_0x2432b7['attributes'],function(_0x58a9b2){var _0x371dd6={};_0x371dd6[_0x58a9b2]={'$like':'%'+_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x41')]+'%'};return _0x371dd6;})});}_0x2432b7=_[_0xe4d8('0x42')]({},_0x2432b7,_0x5a03b9[_0xe4d8('0x43')]);return _0xfdfa5b['getAgents'](_0x2432b7);}})[_0xe4d8('0x29')](function(_0x250059){if(_0x250059){_0x6c0785=_0x250059['length'];if(!_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x39')](_0xe4d8('0x3a'))){_0x2432b7[_0xe4d8('0x23')]=qs[_0xe4d8('0x23')](_0x5a03b9[_0xe4d8('0x33')]['limit']);_0x2432b7[_0xe4d8('0x22')]=qs[_0xe4d8('0x22')](_0x5a03b9[_0xe4d8('0x33')][_0xe4d8('0x22')]);}return _0xfdfa5b[_0xe4d8('0x8f')](_0x2432b7);}})['then'](function(_0x3c4e68){if(_0x3c4e68){return _0x3c4e68?{'count':_0x6c0785,'rows':_0x3c4e68}:null;}})[_0xe4d8('0x29')](respondWithResult(_0x593aff,null))[_0xe4d8('0x47')](handleError(_0x593aff,null));}; \ No newline at end of file +var _0x4b77=['Team','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','User','field','tq.TeamId','from','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams'];(function(_0x44aa1b,_0x5a2a44){var _0x4dd483=function(_0xc46d11){while(--_0xc46d11){_0x44aa1b['push'](_0x44aa1b['shift']());}};_0x4dd483(++_0x5a2a44);}(_0x4b77,0x13a));var _0x74b7=function(_0x3b6a1e,_0x1395f0){_0x3b6a1e=_0x3b6a1e-0x0;var _0x2010c5=_0x4b77[_0x3b6a1e];return _0x2010c5;};'use strict';var pdf=require(_0x74b7('0x0'));var emlformat=require(_0x74b7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74b7('0x2'));var rp=require(_0x74b7('0x3'));var moment=require(_0x74b7('0x4'));var BPromise=require(_0x74b7('0x5'));var Mustache=require(_0x74b7('0x6'));var util=require(_0x74b7('0x7'));var path=require(_0x74b7('0x8'));var sox=require(_0x74b7('0x9'));var csv=require(_0x74b7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x74b7('0xb'));var crypto=require(_0x74b7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x74b7('0xd'));var Papa=require(_0x74b7('0xe'));var Redis=require(_0x74b7('0xf'));var authService=require(_0x74b7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x74b7('0x11'));var hardwareService=require(_0x74b7('0x12'));var logger=require(_0x74b7('0x13'))(_0x74b7('0x14'));var utils=require('../../config/utils');var config=require(_0x74b7('0x15'));var licenseUtil=require(_0x74b7('0x16'));var db=require(_0x74b7('0x17'))['db'];config[_0x74b7('0x18')]=_[_0x74b7('0x19')](config[_0x74b7('0x18')],{'host':_0x74b7('0x1a'),'port':0x18eb});var socket=require(_0x74b7('0x1b'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x74b7('0x1c')](socket);function respondWithStatusCode(_0x12d5ae,_0x18eb26){_0x18eb26=_0x18eb26||0xcc;return function(_0x295379){if(_0x295379){return _0x12d5ae[_0x74b7('0x1d')](_0x18eb26);}return _0x12d5ae[_0x74b7('0x1e')](_0x18eb26)['end']();};}function respondWithResult(_0xf6577d,_0x3c6680){_0x3c6680=_0x3c6680||0xc8;return function(_0x1cf4dd){if(_0x1cf4dd){return _0xf6577d[_0x74b7('0x1e')](_0x3c6680)[_0x74b7('0x1f')](_0x1cf4dd);}};}function respondWithFilteredResult(_0xf09e33,_0x338ef4){return function(_0x5402d4){if(_0x5402d4){var _0x5b32a9=_0x5402d4[_0x74b7('0x20')],_0x45908a=_0x338ef4[_0x74b7('0x21')],_0x4dd8f1=_0x338ef4[_0x74b7('0x21')]+_0x338ef4[_0x74b7('0x22')],_0x543f36;if(_0x4dd8f1>=_0x5b32a9){_0x4dd8f1=_0x5b32a9;_0x543f36=0xc8;}else{_0x543f36=0xce;}_0xf09e33[_0x74b7('0x1e')](_0x543f36);return _0xf09e33['set'](_0x74b7('0x23'),_0x45908a+'-'+_0x4dd8f1+'/'+_0x5b32a9)[_0x74b7('0x1f')](_0x5402d4);}return null;};}function patchUpdates(_0xb27f9a){return function(_0x3616e2){try{jsonpatch[_0x74b7('0x24')](_0x3616e2,_0xb27f9a,!![]);}catch(_0x5e0cd8){return BPromise[_0x74b7('0x25')](_0x5e0cd8);}return _0x3616e2['save']();};}function saveUpdates(_0x11a062,_0x501770){return function(_0x151db6){if(_0x151db6){return _0x151db6[_0x74b7('0x26')](_0x11a062)[_0x74b7('0x27')](function(_0x2157ef){return _0x2157ef;});}return null;};}function removeEntity(_0x2d189b,_0x489a2c){return function(_0x5b8588){if(_0x5b8588){return _0x5b8588['destroy']()['then'](function(){var _0x58aeec=_0x5b8588[_0x74b7('0x28')]({'plain':!![]});var _0x29c24d=_0x74b7('0x29');return db[_0x74b7('0x2a')][_0x74b7('0x2b')]({'where':{'type':_0x29c24d,'resourceId':_0x58aeec['id']}})['then'](function(){return _0x5b8588;});})['then'](function(){_0x2d189b['status'](0xcc)[_0x74b7('0x2c')]();});}};}function handleEntityNotFound(_0x9c081b,_0x358bf3){return function(_0xf27b45){if(!_0xf27b45){_0x9c081b[_0x74b7('0x1d')](0x194);}return _0xf27b45;};}function handleError(_0x3b9dd5,_0x290c90){_0x290c90=_0x290c90||0x1f4;return function(_0x12338f){logger[_0x74b7('0x2d')](_0x12338f[_0x74b7('0x2e')]);if(_0x12338f[_0x74b7('0x2f')]){delete _0x12338f[_0x74b7('0x2f')];}_0x3b9dd5[_0x74b7('0x1e')](_0x290c90)['send'](_0x12338f);};}exports['index']=function(_0x3e65ba,_0x4a1b51){var _0x464086={},_0x2ad790={},_0x1bda6e={'count':0x0,'rows':[]};var _0x3efa01=_[_0x74b7('0x30')](db[_0x74b7('0x31')][_0x74b7('0x32')],function(_0x429ac7){return{'name':_0x429ac7[_0x74b7('0x33')],'type':_0x429ac7[_0x74b7('0x34')]['key']};});_0x2ad790[_0x74b7('0x35')]=_[_0x74b7('0x30')](_0x3efa01,_0x74b7('0x2f'));_0x2ad790['query']=_[_0x74b7('0x36')](_0x3e65ba['query']);_0x2ad790[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x2ad790[_0x74b7('0x35')],_0x2ad790[_0x74b7('0x39')]);_0x464086['attributes']=_['intersection'](_0x2ad790['model'],qs[_0x74b7('0x3a')](_0x3e65ba['query'][_0x74b7('0x3a')]));_0x464086[_0x74b7('0x3b')]=_0x464086[_0x74b7('0x3b')][_0x74b7('0x3c')]?_0x464086[_0x74b7('0x3b')]:_0x2ad790[_0x74b7('0x35')];if(!_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x464086[_0x74b7('0x22')]=qs[_0x74b7('0x22')](_0x3e65ba[_0x74b7('0x39')]['limit']);_0x464086['offset']=qs[_0x74b7('0x21')](_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x21')]);}_0x464086[_0x74b7('0x3f')]=qs[_0x74b7('0x40')](_0x3e65ba['query']['sort']);_0x464086['where']=qs['filters'](_[_0x74b7('0x41')](_0x3e65ba['query'],_0x2ad790['filters']),_0x3efa01);if(_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x42')]){_0x464086[_0x74b7('0x43')]=_[_0x74b7('0x44')](_0x464086['where'],{'$or':_[_0x74b7('0x30')](_0x3efa01,function(_0x2fb195){if(_0x2fb195[_0x74b7('0x34')]!==_0x74b7('0x45')){var _0x5f02b8={};_0x5f02b8[_0x2fb195[_0x74b7('0x2f')]]={'$like':'%'+_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x42')]+'%'};return _0x5f02b8;}})});}_0x464086=_[_0x74b7('0x44')]({},_0x464086,_0x3e65ba[_0x74b7('0x46')]);var _0x13f68b={'where':_0x464086['where']};return db['OpenchannelQueue'][_0x74b7('0x20')](_0x13f68b)[_0x74b7('0x27')](function(_0xf247ee){_0x1bda6e[_0x74b7('0x20')]=_0xf247ee;if(_0x3e65ba[_0x74b7('0x39')][_0x74b7('0x47')]){_0x464086[_0x74b7('0x48')]=[{'all':!![]}];}return db[_0x74b7('0x31')][_0x74b7('0x49')](_0x464086);})[_0x74b7('0x27')](function(_0x2fb9eb){_0x1bda6e[_0x74b7('0x4a')]=_0x2fb9eb;return _0x1bda6e;})['then'](respondWithFilteredResult(_0x4a1b51,_0x464086))[_0x74b7('0x4b')](handleError(_0x4a1b51,null));};exports['show']=function(_0x46b419,_0x1a4969){var _0x4e27e5={'raw':!![],'where':{'id':_0x46b419[_0x74b7('0x4c')]['id']}},_0x9db739={};_0x9db739[_0x74b7('0x35')]=_['keys'](db[_0x74b7('0x31')]['rawAttributes']);_0x9db739[_0x74b7('0x39')]=_[_0x74b7('0x36')](_0x46b419['query']);_0x9db739[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x9db739[_0x74b7('0x35')],_0x9db739[_0x74b7('0x39')]);_0x4e27e5[_0x74b7('0x3b')]=_[_0x74b7('0x38')](_0x9db739[_0x74b7('0x35')],qs['fields'](_0x46b419['query'][_0x74b7('0x3a')]));_0x4e27e5[_0x74b7('0x3b')]=_0x4e27e5['attributes'][_0x74b7('0x3c')]?_0x4e27e5['attributes']:_0x9db739['model'];if(_0x46b419[_0x74b7('0x39')]['includeAll']){_0x4e27e5[_0x74b7('0x48')]=[{'all':!![]}];}_0x4e27e5=_[_0x74b7('0x44')]({},_0x4e27e5,_0x46b419[_0x74b7('0x46')]);return db['OpenchannelQueue'][_0x74b7('0x4d')](_0x4e27e5)[_0x74b7('0x27')](handleEntityNotFound(_0x1a4969,null))['then'](respondWithResult(_0x1a4969,null))[_0x74b7('0x4b')](handleError(_0x1a4969,null));};exports[_0x74b7('0x4e')]=function(_0x33dea4,_0x5e7aab){return db['OpenchannelQueue'][_0x74b7('0x4e')](_0x33dea4[_0x74b7('0x4f')],{})[_0x74b7('0x27')](function(_0x2085fd){var _0x1185fe=_0x33dea4[_0x74b7('0x50')][_0x74b7('0x28')]({'plain':!![]});if(!_0x1185fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1185fe[_0x74b7('0x51')]==='user'){var _0x582262=_0x2085fd[_0x74b7('0x28')]({'plain':!![]});var _0x2b1c80=_0x74b7('0x29');return db[_0x74b7('0x52')]['find']({'where':{'name':_0x2b1c80,'userProfileId':_0x1185fe[_0x74b7('0x53')]},'raw':!![]})[_0x74b7('0x27')](function(_0x1e928f){if(_0x1e928f&&_0x1e928f[_0x74b7('0x54')]===0x0){return db[_0x74b7('0x2a')][_0x74b7('0x4e')]({'name':_0x582262[_0x74b7('0x2f')],'resourceId':_0x582262['id'],'type':_0x1e928f['name'],'sectionId':_0x1e928f['id']},{})['then'](function(){return _0x2085fd;});}else{return _0x2085fd;}})['catch'](function(_0x569f07){logger['error'](_0x74b7('0x55'),_0x569f07);throw _0x569f07;});}return _0x2085fd;})['then'](respondWithResult(_0x5e7aab,0xc9))['catch'](handleError(_0x5e7aab,null));};exports[_0x74b7('0x26')]=function(_0x538d4b,_0x167f92){if(_0x538d4b[_0x74b7('0x4f')]['id']){delete _0x538d4b[_0x74b7('0x4f')]['id'];}return db[_0x74b7('0x31')][_0x74b7('0x4d')]({'where':{'id':_0x538d4b[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x167f92,null))[_0x74b7('0x27')](saveUpdates(_0x538d4b['body'],null))[_0x74b7('0x27')](respondWithResult(_0x167f92,null))[_0x74b7('0x4b')](handleError(_0x167f92,null));};exports[_0x74b7('0x2b')]=function(_0x1745e3,_0x116743){return db['OpenchannelQueue'][_0x74b7('0x4d')]({'where':{'id':_0x1745e3['params']['id']}})['then'](handleEntityNotFound(_0x116743,null))[_0x74b7('0x27')](removeEntity(_0x116743,null))[_0x74b7('0x4b')](handleError(_0x116743,null));};exports[_0x74b7('0x56')]=function(_0x3e9ac7,_0xace57a){return db['OpenchannelQueue'][_0x74b7('0x56')]()[_0x74b7('0x27')](respondWithResult(_0xace57a,null))['catch'](handleError(_0xace57a,null));};exports[_0x74b7('0x57')]=function(_0x2d5071,_0x52546c,_0x1f711b){var _0x5668da={'raw':!![],'where':{}},_0x28a2e3={},_0x5a6df1;return db[_0x74b7('0x31')]['findOne']({'where':{'id':_0x2d5071[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x52546c,null))[_0x74b7('0x27')](function(_0x1d4f7c){if(_0x1d4f7c){_0x5a6df1=_0x1d4f7c[_0x74b7('0x28')]({'plain':!![]});_0x28a2e3[_0x74b7('0x35')]=_['keys'](db[_0x74b7('0x58')]['rawAttributes']);_0x28a2e3[_0x74b7('0x39')]=_[_0x74b7('0x36')](_0x2d5071[_0x74b7('0x39')]);_0x28a2e3[_0x74b7('0x37')]=_['intersection'](_0x28a2e3[_0x74b7('0x35')],_0x28a2e3[_0x74b7('0x39')]);_0x5668da['attributes']=_[_0x74b7('0x38')](_0x28a2e3[_0x74b7('0x35')],qs[_0x74b7('0x3a')](_0x2d5071['query']['fields']));_0x5668da[_0x74b7('0x3b')]=_0x5668da[_0x74b7('0x3b')][_0x74b7('0x3c')]?_0x5668da[_0x74b7('0x3b')]:_0x28a2e3['model'];if(!_0x2d5071[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x5668da[_0x74b7('0x22')]=qs[_0x74b7('0x22')](_0x2d5071[_0x74b7('0x39')]['limit']);_0x5668da['offset']=qs['offset'](_0x2d5071['query'][_0x74b7('0x21')]);}_0x5668da[_0x74b7('0x3f')]=qs[_0x74b7('0x40')](_0x2d5071['query']['sort']);_0x5668da[_0x74b7('0x43')]=qs[_0x74b7('0x37')](_[_0x74b7('0x41')](_0x2d5071['query'],_0x28a2e3[_0x74b7('0x37')]));_0x5668da[_0x74b7('0x43')][_0x74b7('0x59')]=_0x1d4f7c['id'];if(_0x2d5071[_0x74b7('0x39')]['filter']){_0x5668da[_0x74b7('0x43')]=_[_0x74b7('0x44')](_0x5668da['where'],{'$or':_[_0x74b7('0x30')](_0x5668da[_0x74b7('0x3b')],function(_0x52ef55){var _0x3f6b82={};_0x3f6b82[_0x52ef55]={'$like':'%'+_0x2d5071[_0x74b7('0x39')][_0x74b7('0x42')]+'%'};return _0x3f6b82;})});}_0x5668da=_[_0x74b7('0x44')]({},_0x5668da,_0x2d5071['options']);return db['UserOpenchannelQueue'][_0x74b7('0x49')](_0x5668da);}})['then'](function(_0x4ce464){if(_0x4ce464){return db['User'][_0x74b7('0x5a')]({'where':{'id':_[_0x74b7('0x30')](_0x4ce464,_0x74b7('0x5b')),'role':_0x74b7('0x5c')},'attributes':['id',_0x74b7('0x2f'),_0x74b7('0x5d'),_0x74b7('0x5e'),_0x74b7('0x5f')]});}})['then'](function(_0x18c3e8){if(_0x18c3e8){return{'count':_0x18c3e8['count'],'rows':_[_0x74b7('0x30')](_0x18c3e8['rows'],function(_0x523936){return{'membername':_0x523936[_0x74b7('0x2f')],'UserId':_0x523936['id'],'queue_name':_0x5a6df1['name'],'OpenchannelQueueId':_0x5a6df1['id'],'interface':util[_0x74b7('0x60')](_0x74b7('0x61'),_0x74b7('0x62'),_0x523936['name']),'penalty':0x0,'paused':_0x523936[_0x74b7('0x5d')],'createdAt':_0x523936[_0x74b7('0x5f')],'updatedAt':_0x523936[_0x74b7('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x74b7('0x27')](respondWithFilteredResult(_0x52546c,_0x5668da))['catch'](handleError(_0x52546c,null));};exports[_0x74b7('0x63')]=function(_0x3fbee4,_0x4dfd4e,_0x4b78a1){var _0x239d1f={};var _0x5339de={};var _0xaa4565;var _0x360540;return db[_0x74b7('0x31')]['findOne']({'where':{'id':_0x3fbee4[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x4dfd4e,null))[_0x74b7('0x27')](function(_0x39afac){if(_0x39afac){_0xaa4565=_0x39afac;_0x5339de['model']=_[_0x74b7('0x36')](db[_0x74b7('0x64')][_0x74b7('0x32')]);_0x5339de[_0x74b7('0x39')]=_[_0x74b7('0x36')](_0x3fbee4[_0x74b7('0x39')]);_0x5339de[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x5339de[_0x74b7('0x35')],_0x5339de[_0x74b7('0x39')]);_0x239d1f[_0x74b7('0x3b')]=_['intersection'](_0x5339de[_0x74b7('0x35')],qs[_0x74b7('0x3a')](_0x3fbee4[_0x74b7('0x39')]['fields']));_0x239d1f[_0x74b7('0x3b')]=_0x239d1f['attributes'][_0x74b7('0x3c')]?_0x239d1f[_0x74b7('0x3b')]:_0x5339de[_0x74b7('0x35')];_0x239d1f[_0x74b7('0x3f')]=qs['sort'](_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x40')]);_0x239d1f[_0x74b7('0x43')]=qs[_0x74b7('0x37')](_[_0x74b7('0x41')](_0x3fbee4[_0x74b7('0x39')],_0x5339de[_0x74b7('0x37')]));if(_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x42')]){_0x239d1f['where']=_[_0x74b7('0x44')](_0x239d1f[_0x74b7('0x43')],{'$or':_[_0x74b7('0x30')](_0x239d1f['attributes'],function(_0x59439f){var _0x70f9e5={};_0x70f9e5[_0x59439f]={'$like':'%'+_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x42')]+'%'};return _0x70f9e5;})});}_0x239d1f=_[_0x74b7('0x44')]({},_0x239d1f,_0x3fbee4[_0x74b7('0x46')]);return _0xaa4565[_0x74b7('0x63')](_0x239d1f);}})['then'](function(_0x79d293){if(_0x79d293){_0x360540=_0x79d293['length'];if(!_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x239d1f['limit']=qs[_0x74b7('0x22')](_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x22')]);_0x239d1f[_0x74b7('0x21')]=qs['offset'](_0x3fbee4[_0x74b7('0x39')][_0x74b7('0x21')]);}return _0xaa4565[_0x74b7('0x63')](_0x239d1f);}})[_0x74b7('0x27')](function(_0x254e38){if(_0x254e38){return _0x254e38?{'count':_0x360540,'rows':_0x254e38}:null;}})[_0x74b7('0x27')](respondWithResult(_0x4dfd4e,null))[_0x74b7('0x4b')](handleError(_0x4dfd4e,null));};exports['addTeams']=function(_0x1fa611,_0xa93d3a,_0x544a37){var _0x3d71c7=_0x1fa611[_0x74b7('0x4f')][_0x74b7('0x65')];return db[_0x74b7('0x64')]['findAll']({'where':{'id':_0x3d71c7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x74b7('0x66'),'attributes':['id',_0x74b7('0x2f'),_0x74b7('0x67'),'voicePause',_0x74b7('0x68')],'raw':!![]}]})[_0x74b7('0x27')](function(_0x580419){if(_0x580419){var _0x3bdd36=_[_0x74b7('0x69')](_0x580419,function(_0x565bb9){var _0x58779b=_0x565bb9[_0x74b7('0x28')]({'plain':!![]});return _0x58779b[_0x74b7('0x66')];});return db[_0x74b7('0x31')][_0x74b7('0x4d')]({'where':{'id':_0x1fa611[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](function(_0x209e4f){return db[_0x74b7('0x6a')][_0x74b7('0x6b')](function(_0x1465de){return _0x209e4f['addTeams'](_0x3d71c7,{'transaction':_0x1465de})[_0x74b7('0x27')](function(){return BPromise[_0x74b7('0x6c')](_0x3bdd36,function(_0xbe26dc){return db[_0x74b7('0x58')][_0x74b7('0x6d')]({'where':{'UserId':_0xbe26dc['id'],'OpenchannelQueueId':_0x1fa611[_0x74b7('0x4c')]['id']},'transaction':_0x1465de});});})[_0x74b7('0x27')](function(){_0x3bdd36['forEach'](function(_0x31668a){socket[_0x74b7('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x31668a['id'],'OpenchannelQueueId':_0x209e4f['id']});});});});});}})[_0x74b7('0x27')](respondWithStatusCode(_0xa93d3a,null))[_0x74b7('0x4b')](handleError(_0xa93d3a,null));};exports['removeTeams']=function(_0x2f47ee,_0x2ad52c,_0x24d97b){return db[_0x74b7('0x64')][_0x74b7('0x49')]({'where':{'id':_0x2f47ee[_0x74b7('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x74b7('0x6f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b7('0x27')](handleEntityNotFound(_0x2ad52c,null))[_0x74b7('0x27')](function(_0x21f3f5){var _0x33a357=_[_0x74b7('0x30')](_0x21f3f5,'id');var _0x42e50e=[];var _0x29bfa7=[];var _0x53c0bf=squel['select']();_0x53c0bf[_0x74b7('0x70')](_0x74b7('0x71'))[_0x74b7('0x72')]('team_has_openchannel_queues','tq')[_0x74b7('0x73')](_0x74b7('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x74b7('0x43')]('OpenchannelQueueId\x20=\x20?',_0x2f47ee[_0x74b7('0x4c')]['id']);for(var _0x37ad80=0x0;_0x37ad80<_0x21f3f5[_0x74b7('0x3c')];_0x37ad80+=0x1){let _0x2beb0a=_0x21f3f5[_0x37ad80];for(var _0x3865be=0x0;_0x3865be<_0x2beb0a[_0x74b7('0x66')][_0x74b7('0x3c')];_0x3865be+=0x1){let _0x3f10aa=_0x2beb0a['Agents'][_0x3865be];var _0x3b68a9=_0x53c0bf['clone']();_0x3b68a9['where'](_0x74b7('0x75'),_0x3f10aa['id']);_0x29bfa7[_0x74b7('0x76')](db[_0x74b7('0x6a')][_0x74b7('0x39')](_0x3b68a9[_0x74b7('0x77')](),{'type':db[_0x74b7('0x6a')][_0x74b7('0x78')][_0x74b7('0x79')]})['then'](function(_0xa48b41){if(_0xa48b41[_0x74b7('0x3c')]===0x1){return _0x3f10aa['id'];}else{var _0x140c59=_[_0x74b7('0x7a')](_[_0x74b7('0x30')](_0xa48b41,_0x74b7('0x7b')),function(_0x43377f){return _['includes'](_0x33a357,_0x43377f);});if(_0x140c59){return _0x3f10aa['id'];}}}));}}return BPromise[_0x74b7('0x7c')](_0x29bfa7)['then'](function(_0x4ab463){_0x42e50e=_(_0x42e50e)[_0x74b7('0x7d')](_0x4ab463)[_0x74b7('0x7e')]()[_0x74b7('0x7f')]();return db['OpenchannelQueue'][_0x74b7('0x4d')]({'where':{'id':_0x2f47ee[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](function(_0xb2d540){return db[_0x74b7('0x6a')][_0x74b7('0x6b')](function(_0x5e4e61){return _0xb2d540['removeTeams'](_0x2f47ee['query'][_0x74b7('0x65')],{'transaction':_0x5e4e61})[_0x74b7('0x27')](function(){if(!_[_0x74b7('0x80')](_0x42e50e)){return _0xb2d540[_0x74b7('0x81')](_0x42e50e,{'transaction':_0x5e4e61});}})['then'](function(){_0x42e50e[_0x74b7('0x82')](function(_0x142719){socket[_0x74b7('0x6e')](_0x74b7('0x83'),{'UserId':_0x142719,'OpenchannelQueueId':_0xb2d540['id']});});});});});});})['then'](respondWithStatusCode(_0x2ad52c,null))[_0x74b7('0x4b')](handleError(_0x2ad52c,null));};exports[_0x74b7('0x84')]=function(_0x4b6cee,_0x4a003f,_0x1e0b60){return db['OpenchannelQueue'][_0x74b7('0x4d')]({'where':{'id':_0x4b6cee[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x4a003f,null))['then'](function(_0x4736ca){if(_0x4736ca){return _0x4736ca['addAgents'](_0x4b6cee[_0x74b7('0x4f')][_0x74b7('0x65')],_[_0x74b7('0x85')](_0x4b6cee[_0x74b7('0x4f')],[_0x74b7('0x65'),'id'])||{})[_0x74b7('0x86')](function(_0xa36c95){for(var _0x4a810e=0x0;_0x4a810e<_0x4b6cee[_0x74b7('0x4f')][_0x74b7('0x65')][_0x74b7('0x3c')];_0x4a810e+=0x1){socket[_0x74b7('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x4b6cee[_0x74b7('0x4f')]['ids'][_0x4a810e],'OpenchannelQueueId':_0x4b6cee[_0x74b7('0x4c')]['id']});}return _0xa36c95;});}})['then'](respondWithResult(_0x4a003f,null))[_0x74b7('0x4b')](handleError(_0x4a003f,null));};exports['removeAgents']=function(_0x4a9c4e,_0x814dd4,_0x5c6843){return db['OpenchannelQueue']['find']({'where':{'id':_0x4a9c4e[_0x74b7('0x4c')]['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x814dd4,null))[_0x74b7('0x27')](function(_0xd339d1){if(_0xd339d1){return _0xd339d1[_0x74b7('0x81')](_0x4a9c4e[_0x74b7('0x39')][_0x74b7('0x65')])[_0x74b7('0x27')](function(){if(_[_0x74b7('0x87')](_0x4a9c4e[_0x74b7('0x39')][_0x74b7('0x65')])){for(var _0x33ca55=0x0;_0x33ca55<_0x4a9c4e[_0x74b7('0x39')]['ids'][_0x74b7('0x3c')];_0x33ca55+=0x1){socket[_0x74b7('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4a9c4e[_0x74b7('0x39')][_0x74b7('0x65')][_0x33ca55]),'OpenchannelQueueId':Number(_0x4a9c4e[_0x74b7('0x4c')]['id'])});}}else{socket['emit'](_0x74b7('0x83'),{'UserId':Number(_0x4a9c4e['query'][_0x74b7('0x65')]),'OpenchannelQueueId':Number(_0x4a9c4e[_0x74b7('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x814dd4,null))[_0x74b7('0x4b')](handleError(_0x814dd4,null));};exports[_0x74b7('0x88')]=function(_0x5bc640,_0x268486,_0x250b33){var _0x137e97={};var _0x50fe04={};var _0x5ebb79;var _0x203b53;return db[_0x74b7('0x31')][_0x74b7('0x89')]({'where':{'id':_0x5bc640['params']['id']}})[_0x74b7('0x27')](handleEntityNotFound(_0x268486,null))['then'](function(_0x5378bc){if(_0x5378bc){_0x5ebb79=_0x5378bc;_0x50fe04[_0x74b7('0x35')]=_[_0x74b7('0x36')](db[_0x74b7('0x6f')][_0x74b7('0x32')]);_0x50fe04['query']=_[_0x74b7('0x36')](_0x5bc640[_0x74b7('0x39')]);_0x50fe04[_0x74b7('0x37')]=_[_0x74b7('0x38')](_0x50fe04[_0x74b7('0x35')],_0x50fe04['query']);_0x137e97[_0x74b7('0x3b')]=_[_0x74b7('0x38')](_0x50fe04[_0x74b7('0x35')],qs[_0x74b7('0x3a')](_0x5bc640[_0x74b7('0x39')][_0x74b7('0x3a')]));_0x137e97['attributes']=_0x137e97[_0x74b7('0x3b')][_0x74b7('0x3c')]?_0x137e97[_0x74b7('0x3b')]:_0x50fe04['model'];_0x137e97[_0x74b7('0x3f')]=qs[_0x74b7('0x40')](_0x5bc640[_0x74b7('0x39')][_0x74b7('0x40')]);_0x137e97[_0x74b7('0x43')]=qs['filters'](_[_0x74b7('0x41')](_0x5bc640[_0x74b7('0x39')],_0x50fe04['filters']));if(_0x5bc640[_0x74b7('0x39')][_0x74b7('0x42')]){_0x137e97[_0x74b7('0x43')]=_[_0x74b7('0x44')](_0x137e97[_0x74b7('0x43')],{'$or':_['map'](_0x137e97[_0x74b7('0x3b')],function(_0x3c75ce){var _0x2ffa5b={};_0x2ffa5b[_0x3c75ce]={'$like':'%'+_0x5bc640['query'][_0x74b7('0x42')]+'%'};return _0x2ffa5b;})});}_0x137e97=_[_0x74b7('0x44')]({},_0x137e97,_0x5bc640[_0x74b7('0x46')]);return _0x5ebb79[_0x74b7('0x88')](_0x137e97);}})[_0x74b7('0x27')](function(_0x309260){if(_0x309260){_0x203b53=_0x309260[_0x74b7('0x3c')];if(!_0x5bc640[_0x74b7('0x39')][_0x74b7('0x3d')](_0x74b7('0x3e'))){_0x137e97[_0x74b7('0x22')]=qs[_0x74b7('0x22')](_0x5bc640['query'][_0x74b7('0x22')]);_0x137e97[_0x74b7('0x21')]=qs['offset'](_0x5bc640[_0x74b7('0x39')][_0x74b7('0x21')]);}return _0x5ebb79[_0x74b7('0x88')](_0x137e97);}})['then'](function(_0x246765){if(_0x246765){return _0x246765?{'count':_0x203b53,'rows':_0x246765}:null;}})[_0x74b7('0x27')](respondWithResult(_0x268486,null))['catch'](handleError(_0x268486,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d9cddcd..8729634 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 _0x972a=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0xcde227,_0x14c6f8){var _0x369846=function(_0x456570){while(--_0x456570){_0xcde227['push'](_0xcde227['shift']());}};_0x369846(++_0x14c6f8);}(_0x972a,0x11c));var _0xa972=function(_0x1a61c1,_0x2f064d){_0x1a61c1=_0x1a61c1-0x0;var _0x2240bf=_0x972a[_0x1a61c1];return _0x2240bf;};'use strict';var EventEmitter=require(_0xa972('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa972('0x1')](0x0);var events={'afterCreate':_0xa972('0x2'),'afterUpdate':_0xa972('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37c9f9){return function(_0x30db9b,_0x15bd5a,_0xb8ea30){OpenchannelQueueEvents[_0xa972('0x4')](_0x37c9f9+':'+_0x30db9b['id'],_0x30db9b);OpenchannelQueueEvents[_0xa972('0x4')](_0x37c9f9,_0x30db9b);_0xb8ea30(null);};}for(var e in events){if(events[_0xa972('0x5')](e)){var event=events[e];OpenchannelQueue[_0xa972('0x6')](e,emitEvent(event));}}module[_0xa972('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xd762=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x41e519,_0x6bf4d9){var _0x5cd351=function(_0x3e8263){while(--_0x3e8263){_0x41e519['push'](_0x41e519['shift']());}};_0x5cd351(++_0x6bf4d9);}(_0xd762,0xa9));var _0x2d76=function(_0x39e2f5,_0x1a0163){_0x39e2f5=_0x39e2f5-0x0;var _0x2b1a29=_0xd762[_0x39e2f5];return _0x2b1a29;};'use strict';var EventEmitter=require(_0x2d76('0x0'));var OpenchannelQueue=require(_0x2d76('0x1'))['db'][_0x2d76('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2d76('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d76('0x4'),'afterDestroy':_0x2d76('0x5')};function emitEvent(_0x539ff3){return function(_0x5c081f,_0xdbeabd,_0x68408e){OpenchannelQueueEvents[_0x2d76('0x6')](_0x539ff3+':'+_0x5c081f['id'],_0x5c081f);OpenchannelQueueEvents[_0x2d76('0x6')](_0x539ff3,_0x5c081f);_0x68408e(null);};}for(var e in events){if(events[_0x2d76('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2d76('0x8')](e,emitEvent(event));}}module[_0x2d76('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d45621a..8851e52 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 _0x8aac=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x555ebb,_0x5cf17b){var _0x22c6e9=function(_0x4064be){while(--_0x4064be){_0x555ebb['push'](_0x555ebb['shift']());}};_0x22c6e9(++_0x5cf17b);}(_0x8aac,0x6f));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8aa('0x0'));var util=require(_0xc8aa('0x1'));var logger=require(_0xc8aa('0x2'))(_0xc8aa('0x3'));var moment=require('moment');var BPromise=require(_0xc8aa('0x4'));var rp=require(_0xc8aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8aa('0x6'));var config=require(_0xc8aa('0x7'));var attributes=require(_0xc8aa('0x8'));module[_0xc8aa('0x9')]=function(_0x4975be,_0x54e1b3){return _0x4975be[_0xc8aa('0xa')](_0xc8aa('0xb'),attributes,{'tableName':_0xc8aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bd=['exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x3dad7f,_0x1f0244){var _0x43cea6=function(_0x2928db){while(--_0x2928db){_0x3dad7f['push'](_0x3dad7f['shift']());}};_0x43cea6(++_0x1f0244);}(_0xa0bd,0x17e));var _0xda0b=function(_0x42cfa5,_0x2ac95b){_0x42cfa5=_0x42cfa5-0x0;var _0x2ae78b=_0xa0bd[_0x42cfa5];return _0x2ae78b;};'use strict';var _=require('lodash');var util=require(_0xda0b('0x0'));var logger=require(_0xda0b('0x1'))(_0xda0b('0x2'));var moment=require(_0xda0b('0x3'));var BPromise=require(_0xda0b('0x4'));var rp=require(_0xda0b('0x5'));var fs=require('fs');var path=require(_0xda0b('0x6'));var rimraf=require(_0xda0b('0x7'));var config=require(_0xda0b('0x8'));var attributes=require(_0xda0b('0x9'));module[_0xda0b('0xa')]=function(_0x103ef8,_0xc7ce90){return _0x103ef8[_0xda0b('0xb')](_0xda0b('0xc'),attributes,{'tableName':_0xda0b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index da4853d..dc73428 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 _0xb248=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','raw','options','where','include','map','attributes','model','GetOpenchannelQueue','OpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11ae28,_0x5a2fa9){var _0x5012ec=function(_0x520237){while(--_0x520237){_0x11ae28['push'](_0x11ae28['shift']());}};_0x5012ec(++_0x5a2fa9);}(_0xb248,0x71));var _0x8b24=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xb248[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x8b24('0x0'));var util=require(_0x8b24('0x1'));var moment=require(_0x8b24('0x2'));var BPromise=require(_0x8b24('0x3'));var rs=require(_0x8b24('0x4'));var fs=require('fs');var Redis=require(_0x8b24('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b24('0x6'));var logger=require(_0x8b24('0x7'))(_0x8b24('0x8'));var config=require(_0x8b24('0x9'));var jayson=require(_0x8b24('0xa'));var client=jayson[_0x8b24('0xb')]['http']({'port':0x232a});config[_0x8b24('0xc')]=_[_0x8b24('0xd')](config['redis'],{'host':_0x8b24('0xe'),'port':0x18eb});var socket=require(_0x8b24('0xf'))(new Redis(config[_0x8b24('0xc')]));require(_0x8b24('0x10'))[_0x8b24('0x11')](socket);function respondWithRpcPromise(_0x17e98c,_0x5ae472,_0x4bf381){return new BPromise(function(_0x368a1b,_0x192876){return client[_0x8b24('0x12')](_0x17e98c,_0x4bf381)[_0x8b24('0x13')](function(_0x1f694a){logger[_0x8b24('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ae472,_0x8b24('0x15'));logger[_0x8b24('0x16')](_0x8b24('0x17'),_0x5ae472,'request\x20sent',JSON[_0x8b24('0x18')](_0x1f694a));if(_0x1f694a['error']){if(_0x1f694a[_0x8b24('0x19')][_0x8b24('0x1a')]===0x1f4){logger[_0x8b24('0x19')](_0x8b24('0x1b'),_0x5ae472,_0x1f694a['error'][_0x8b24('0x1c')]);return _0x192876(_0x1f694a[_0x8b24('0x19')][_0x8b24('0x1c')]);}logger[_0x8b24('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ae472,_0x1f694a[_0x8b24('0x19')]['message']);return _0x368a1b(_0x1f694a['error'][_0x8b24('0x1c')]);}else{logger[_0x8b24('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ae472,'request\x20sent');_0x368a1b(_0x1f694a[_0x8b24('0x1d')][_0x8b24('0x1c')]);}})[_0x8b24('0x1e')](function(_0x7891c0){logger[_0x8b24('0x19')](_0x8b24('0x1b'),_0x5ae472,_0x7891c0);_0x192876(_0x7891c0);});});}exports['GetOpenchannelQueue']=function(_0x1ef827){var _0x181cac=this;return new Promise(function(_0x377a8f,_0x40d629){return db['OpenchannelQueue']['findAll']({'raw':_0x1ef827['options']?_0x1ef827['options'][_0x8b24('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')][_0x8b24('0x21')]||null:null,'attributes':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')]['attributes']||null:null,'limit':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')]['limit']||null:null,'include':_0x1ef827[_0x8b24('0x20')]?_0x1ef827[_0x8b24('0x20')][_0x8b24('0x22')]?_[_0x8b24('0x23')](_0x1ef827[_0x8b24('0x20')][_0x8b24('0x22')],function(_0x355128){return{'model':db[_0x355128['model']],'as':_0x355128['as'],'attributes':_0x355128['attributes'],'include':_0x355128[_0x8b24('0x22')]?_['map'](_0x355128[_0x8b24('0x22')],function(_0x225cd9){return{'model':db[_0x225cd9['model']],'as':_0x225cd9['as'],'attributes':_0x225cd9[_0x8b24('0x24')],'include':_0x225cd9[_0x8b24('0x22')]?_[_0x8b24('0x23')](_0x225cd9[_0x8b24('0x22')],function(_0xc0b7e2){return{'model':db[_0xc0b7e2[_0x8b24('0x25')]],'as':_0xc0b7e2['as'],'attributes':_0xc0b7e2[_0x8b24('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8b24('0x13')](function(_0x1b79b6){logger[_0x8b24('0x14')](_0x8b24('0x26'),_0x1ef827);logger['debug'](_0x8b24('0x26'),_0x1ef827,JSON['stringify'](_0x1b79b6));_0x377a8f(_0x1b79b6);})[_0x8b24('0x1e')](function(_0x750aea){logger['error'](_0x8b24('0x26'),_0x750aea[_0x8b24('0x1c')],_0x1ef827);_0x40d629(_0x181cac[_0x8b24('0x19')](0x1f4,_0x750aea[_0x8b24('0x1c')]));});});};exports['ShowOpenchannelQueue']=function(_0xfd1bed){var _0x425653=this;return new Promise(function(_0x365a64,_0x27b75b){return db[_0x8b24('0x27')]['find']({'raw':_0xfd1bed[_0x8b24('0x20')]?_0xfd1bed[_0x8b24('0x20')][_0x8b24('0x1f')]===undefined?!![]:![]:!![],'where':_0xfd1bed[_0x8b24('0x20')]?_0xfd1bed[_0x8b24('0x20')][_0x8b24('0x21')]||null:null,'attributes':_0xfd1bed[_0x8b24('0x20')]?_0xfd1bed['options'][_0x8b24('0x24')]||null:null,'include':_0xfd1bed['options']?_0xfd1bed['options'][_0x8b24('0x22')]?_[_0x8b24('0x23')](_0xfd1bed['options']['include'],function(_0x32649f){return{'model':db[_0x32649f[_0x8b24('0x25')]],'as':_0x32649f['as'],'attributes':_0x32649f[_0x8b24('0x24')],'include':_0x32649f[_0x8b24('0x22')]?_['map'](_0x32649f[_0x8b24('0x22')],function(_0x79f5d9){return{'model':db[_0x79f5d9[_0x8b24('0x25')]],'as':_0x79f5d9['as'],'attributes':_0x79f5d9[_0x8b24('0x24')],'include':_0x79f5d9[_0x8b24('0x22')]?_[_0x8b24('0x23')](_0x79f5d9['include'],function(_0x631dd8){return{'model':db[_0x631dd8[_0x8b24('0x25')]],'as':_0x631dd8['as'],'attributes':_0x631dd8[_0x8b24('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8b24('0x13')](function(_0x12efff){logger['info'](_0x8b24('0x28'),_0xfd1bed);logger['debug'](_0x8b24('0x28'),_0xfd1bed,JSON[_0x8b24('0x18')](_0x12efff));_0x365a64(_0x12efff);})[_0x8b24('0x1e')](function(_0x34c2ed){logger[_0x8b24('0x19')]('ShowOpenchannelQueue',_0x34c2ed[_0x8b24('0x1c')],_0xfd1bed);_0x27b75b(_0x425653['error'](0x1f4,_0x34c2ed[_0x8b24('0x1c')]));});});}; \ No newline at end of file +var _0xe494=['then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request'];(function(_0x2d1421,_0x1f708c){var _0x4ea5dc=function(_0x226b80){while(--_0x226b80){_0x2d1421['push'](_0x2d1421['shift']());}};_0x4ea5dc(++_0x1f708c);}(_0xe494,0x130));var _0x4e49=function(_0x235904,_0x5f4fcb){_0x235904=_0x235904-0x0;var _0x25499f=_0xe494[_0x235904];return _0x25499f;};'use strict';var _=require(_0x4e49('0x0'));var util=require(_0x4e49('0x1'));var moment=require(_0x4e49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e49('0x3'));var fs=require('fs');var Redis=require(_0x4e49('0x4'));var db=require(_0x4e49('0x5'))['db'];var utils=require(_0x4e49('0x6'));var logger=require(_0x4e49('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e49('0x8'));var client=jayson[_0x4e49('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4e49('0xa')],{'host':_0x4e49('0xb'),'port':0x18eb});var socket=require(_0x4e49('0xc'))(new Redis(config[_0x4e49('0xa')]));require(_0x4e49('0xd'))[_0x4e49('0xe')](socket);function respondWithRpcPromise(_0x16806c,_0x366484,_0x4f200f){return new BPromise(function(_0x5e2ea7,_0x23b701){return client[_0x4e49('0xf')](_0x16806c,_0x4f200f)[_0x4e49('0x10')](function(_0x11dfd4){logger[_0x4e49('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x366484,'request\x20sent');logger[_0x4e49('0x12')](_0x4e49('0x13'),_0x366484,_0x4e49('0x14'),JSON[_0x4e49('0x15')](_0x11dfd4));if(_0x11dfd4[_0x4e49('0x16')]){if(_0x11dfd4[_0x4e49('0x16')][_0x4e49('0x17')]===0x1f4){logger[_0x4e49('0x16')](_0x4e49('0x18'),_0x366484,_0x11dfd4[_0x4e49('0x16')][_0x4e49('0x19')]);return _0x23b701(_0x11dfd4[_0x4e49('0x16')][_0x4e49('0x19')]);}logger[_0x4e49('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x366484,_0x11dfd4[_0x4e49('0x16')]['message']);return _0x5e2ea7(_0x11dfd4['error'][_0x4e49('0x19')]);}else{logger[_0x4e49('0x11')](_0x4e49('0x18'),_0x366484,_0x4e49('0x14'));_0x5e2ea7(_0x11dfd4[_0x4e49('0x1a')]['message']);}})[_0x4e49('0x1b')](function(_0x191dac){logger[_0x4e49('0x16')](_0x4e49('0x18'),_0x366484,_0x191dac);_0x23b701(_0x191dac);});});}exports['GetOpenchannelQueue']=function(_0x557afc){var _0x37e17=this;return new Promise(function(_0x2534f4,_0x3bd33f){return db['OpenchannelQueue'][_0x4e49('0x1c')]({'raw':_0x557afc[_0x4e49('0x1d')]?_0x557afc['options'][_0x4e49('0x1e')]===undefined?!![]:![]:!![],'where':_0x557afc[_0x4e49('0x1d')]?_0x557afc['options'][_0x4e49('0x1f')]||null:null,'attributes':_0x557afc['options']?_0x557afc[_0x4e49('0x1d')][_0x4e49('0x20')]||null:null,'limit':_0x557afc[_0x4e49('0x1d')]?_0x557afc[_0x4e49('0x1d')][_0x4e49('0x21')]||null:null,'include':_0x557afc[_0x4e49('0x1d')]?_0x557afc[_0x4e49('0x1d')]['include']?_['map'](_0x557afc[_0x4e49('0x1d')][_0x4e49('0x22')],function(_0x29e3ac){return{'model':db[_0x29e3ac['model']],'as':_0x29e3ac['as'],'attributes':_0x29e3ac[_0x4e49('0x20')],'include':_0x29e3ac[_0x4e49('0x22')]?_[_0x4e49('0x23')](_0x29e3ac[_0x4e49('0x22')],function(_0xec7157){return{'model':db[_0xec7157['model']],'as':_0xec7157['as'],'attributes':_0xec7157['attributes'],'include':_0xec7157[_0x4e49('0x22')]?_[_0x4e49('0x23')](_0xec7157[_0x4e49('0x22')],function(_0x445b84){return{'model':db[_0x445b84[_0x4e49('0x24')]],'as':_0x445b84['as'],'attributes':_0x445b84['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49e7aa){logger[_0x4e49('0x11')](_0x4e49('0x25'),_0x557afc);logger['debug'](_0x4e49('0x25'),_0x557afc,JSON[_0x4e49('0x15')](_0x49e7aa));_0x2534f4(_0x49e7aa);})[_0x4e49('0x1b')](function(_0x2ae214){logger[_0x4e49('0x16')](_0x4e49('0x25'),_0x2ae214['message'],_0x557afc);_0x3bd33f(_0x37e17[_0x4e49('0x16')](0x1f4,_0x2ae214[_0x4e49('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x55f18d){var _0x5803a9=this;return new Promise(function(_0xd270d6,_0x5510b8){return db['OpenchannelQueue'][_0x4e49('0x26')]({'raw':_0x55f18d[_0x4e49('0x1d')]?_0x55f18d[_0x4e49('0x1d')][_0x4e49('0x1e')]===undefined?!![]:![]:!![],'where':_0x55f18d['options']?_0x55f18d[_0x4e49('0x1d')][_0x4e49('0x1f')]||null:null,'attributes':_0x55f18d['options']?_0x55f18d['options'][_0x4e49('0x20')]||null:null,'include':_0x55f18d[_0x4e49('0x1d')]?_0x55f18d['options']['include']?_[_0x4e49('0x23')](_0x55f18d[_0x4e49('0x1d')][_0x4e49('0x22')],function(_0x4f4a0f){return{'model':db[_0x4f4a0f['model']],'as':_0x4f4a0f['as'],'attributes':_0x4f4a0f[_0x4e49('0x20')],'include':_0x4f4a0f['include']?_[_0x4e49('0x23')](_0x4f4a0f['include'],function(_0x4f6eb3){return{'model':db[_0x4f6eb3[_0x4e49('0x24')]],'as':_0x4f6eb3['as'],'attributes':_0x4f6eb3[_0x4e49('0x20')],'include':_0x4f6eb3[_0x4e49('0x22')]?_[_0x4e49('0x23')](_0x4f6eb3[_0x4e49('0x22')],function(_0x5b9122){return{'model':db[_0x5b9122[_0x4e49('0x24')]],'as':_0x5b9122['as'],'attributes':_0x5b9122[_0x4e49('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4e49('0x10')](function(_0x5ec54d){logger[_0x4e49('0x11')]('ShowOpenchannelQueue',_0x55f18d);logger[_0x4e49('0x12')]('ShowOpenchannelQueue',_0x55f18d,JSON[_0x4e49('0x15')](_0x5ec54d));_0xd270d6(_0x5ec54d);})['catch'](function(_0x146864){logger['error'](_0x4e49('0x27'),_0x146864[_0x4e49('0x19')],_0x55f18d);_0x5510b8(_0x5803a9[_0x4e49('0x16')](0x1f4,_0x146864[_0x4e49('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 91a7f43..4c2ef9b 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 _0xaad7=['openchannelQueue:','./openchannelQueue.events','save','remove','update','length'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xaad7,0x15d));var _0x7aad=function(_0x3fe610,_0x47e914){_0x3fe610=_0x3fe610-0x0;var _0x2830c9=_0xaad7[_0x3fe610];return _0x2830c9;};'use strict';var OpenchannelQueueEvents=require(_0x7aad('0x0'));var events=[_0x7aad('0x1'),_0x7aad('0x2'),_0x7aad('0x3')];function createListener(_0x39c3da,_0x5e8839){return function(_0x3c9563){_0x5e8839['emit'](_0x39c3da,_0x3c9563);};}function removeListener(_0x17d130,_0x2bd340){return function(){OpenchannelQueueEvents['removeListener'](_0x17d130,_0x2bd340);};}exports['register']=function(_0x1d6ed7){for(var _0xd1513a=0x0,_0x1d09d9=events[_0x7aad('0x4')];_0xd1513a<_0x1d09d9;_0xd1513a++){var _0x519b2b=events[_0xd1513a];var _0x434c22=createListener(_0x7aad('0x5')+_0x519b2b,_0x1d6ed7);OpenchannelQueueEvents['on'](_0x519b2b,_0x434c22);}}; \ No newline at end of file +var _0xfb84=['update','emit','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x5c4587,_0x37f2a4){var _0x209263=function(_0x46ba5f){while(--_0x46ba5f){_0x5c4587['push'](_0x5c4587['shift']());}};_0x209263(++_0x37f2a4);}(_0xfb84,0x107));var _0x4fb8=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0xfb84[_0x28b7ab];return _0x56791b;};'use strict';var OpenchannelQueueEvents=require(_0x4fb8('0x0'));var events=[_0x4fb8('0x1'),'remove',_0x4fb8('0x2')];function createListener(_0xc2ffbc,_0x2cba1a){return function(_0x6abbc3){_0x2cba1a[_0x4fb8('0x3')](_0xc2ffbc,_0x6abbc3);};}function removeListener(_0x305969,_0x1e41a2){return function(){OpenchannelQueueEvents['removeListener'](_0x305969,_0x1e41a2);};}exports['register']=function(_0x566b05){for(var _0x5a9101=0x0,_0xf03c03=events['length'];_0x5a9101<_0xf03c03;_0x5a9101++){var _0x42a514=events[_0x5a9101];var _0x2cb901=createListener(_0x4fb8('0x4')+_0x42a514,_0x566b05);OpenchannelQueueEvents['on'](_0x42a514,_0x2cb901);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 87616d5..f406f4a 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 _0x8678=['put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8678,0x159));var _0x8867=function(_0x3cb0e6,_0x7638bb){_0x3cb0e6=_0x3cb0e6-0x0;var _0x31d53c=_0x8678[_0x3cb0e6];return _0x31d53c;};'use strict';var multer=require(_0x8867('0x0'));var util=require(_0x8867('0x1'));var path=require(_0x8867('0x2'));var timeout=require(_0x8867('0x3'));var express=require(_0x8867('0x4'));var router=express['Router']();var auth=require(_0x8867('0x5'));var interaction=require(_0x8867('0x6'));var config=require(_0x8867('0x7'));var controller=require(_0x8867('0x8'));router[_0x8867('0x9')]('/',auth[_0x8867('0xa')](),controller[_0x8867('0xb')]);router['get'](_0x8867('0xc'),auth[_0x8867('0xa')](),controller['describe']);router[_0x8867('0x9')](_0x8867('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8867('0xa')](),controller[_0x8867('0xe')]);router[_0x8867('0xf')](_0x8867('0xd'),auth[_0x8867('0xa')](),controller['update']);router['delete'](_0x8867('0xd'),auth[_0x8867('0xa')](),controller[_0x8867('0x10')]);module[_0x8867('0x11')]=router; \ No newline at end of file +var _0x4b26=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b26,0xa6));var _0x64b2=function(_0x34665d,_0x872c51){_0x34665d=_0x34665d-0x0;var _0x299f04=_0x4b26[_0x34665d];return _0x299f04;};'use strict';var multer=require(_0x64b2('0x0'));var util=require(_0x64b2('0x1'));var path=require('path');var timeout=require(_0x64b2('0x2'));var express=require(_0x64b2('0x3'));var router=express[_0x64b2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x64b2('0x5'));var config=require(_0x64b2('0x6'));var controller=require(_0x64b2('0x7'));router[_0x64b2('0x8')]('/',auth[_0x64b2('0x9')](),controller[_0x64b2('0xa')]);router[_0x64b2('0x8')](_0x64b2('0xb'),auth[_0x64b2('0x9')](),controller[_0x64b2('0xc')]);router['get']('/:id',auth[_0x64b2('0x9')](),controller['show']);router[_0x64b2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x64b2('0xe')](_0x64b2('0xf'),auth[_0x64b2('0x9')](),controller[_0x64b2('0x10')]);router[_0x64b2('0x11')](_0x64b2('0xf'),auth[_0x64b2('0x9')](),controller['destroy']);module[_0x64b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index abf0c30..3c5be85 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 _0x9225=['sequelize','STRING','DATE','moment'];(function(_0x202272,_0x4fc1c6){var _0x2ec82c=function(_0x4e4009){while(--_0x4e4009){_0x202272['push'](_0x202272['shift']());}};_0x2ec82c(++_0x4fc1c6);}(_0x9225,0x11b));var _0x5922=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9225[_0x2064e5];return _0x21a233;};'use strict';var moment=require(_0x5922('0x0'));var Sequelize=require(_0x5922('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5922('0x2')]},'joinAt':{'type':Sequelize[_0x5922('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5922('0x3')]},'exitAt':{'type':Sequelize[_0x5922('0x3')]},'reason':{'type':Sequelize[_0x5922('0x2')]}}; \ No newline at end of file +var _0x77da=['DATE','moment','sequelize','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x77da,0xbf));var _0xa77d=function(_0x867a42,_0x738f07){_0x867a42=_0x867a42-0x0;var _0x1c51af=_0x77da[_0x867a42];return _0x1c51af;};'use strict';var moment=require(_0xa77d('0x0'));var Sequelize=require(_0xa77d('0x1'));module[_0xa77d('0x2')]={'uniqueid':{'type':Sequelize[_0xa77d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa77d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa77d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa77d('0x4')]},'reason':{'type':Sequelize[_0xa77d('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9d3f117..bd4f121 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 _0xe43c=['update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelQueueReport','includeAll','findAll','catch','show','params','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject'];(function(_0x583829,_0x188b0e){var _0x34d994=function(_0x568753){while(--_0x568753){_0x583829['push'](_0x583829['shift']());}};_0x34d994(++_0x188b0e);}(_0xe43c,0x180));var _0xce43=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe43c[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0xce43('0x0'));var emlformat=require(_0xce43('0x1'));var rimraf=require(_0xce43('0x2'));var zipdir=require(_0xce43('0x3'));var jsonpatch=require(_0xce43('0x4'));var rp=require(_0xce43('0x5'));var moment=require('moment');var BPromise=require(_0xce43('0x6'));var Mustache=require('mustache');var util=require(_0xce43('0x7'));var path=require(_0xce43('0x8'));var sox=require(_0xce43('0x9'));var csv=require(_0xce43('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce43('0x13'))['db'];function respondWithStatusCode(_0x193861,_0x4c092b){_0x4c092b=_0x4c092b||0xcc;return function(_0x226f21){if(_0x226f21){return _0x193861[_0xce43('0x14')](_0x4c092b);}return _0x193861[_0xce43('0x15')](_0x4c092b)[_0xce43('0x16')]();};}function respondWithResult(_0x4b7970,_0x3034c7){_0x3034c7=_0x3034c7||0xc8;return function(_0x607d92){if(_0x607d92){return _0x4b7970[_0xce43('0x15')](_0x3034c7)[_0xce43('0x17')](_0x607d92);}};}function respondWithFilteredResult(_0x4cb58a,_0x588ddb){return function(_0x3c0948){if(_0x3c0948){var _0x3e4218=_0x3c0948[_0xce43('0x18')],_0x2eb70b=_0x588ddb['offset'],_0x2a9cb4=_0x588ddb[_0xce43('0x19')]+_0x588ddb[_0xce43('0x1a')],_0xd5282;if(_0x2a9cb4>=_0x3e4218){_0x2a9cb4=_0x3e4218;_0xd5282=0xc8;}else{_0xd5282=0xce;}_0x4cb58a[_0xce43('0x15')](_0xd5282);return _0x4cb58a[_0xce43('0x1b')]('Content-Range',_0x2eb70b+'-'+_0x2a9cb4+'/'+_0x3e4218)[_0xce43('0x17')](_0x3c0948);}return null;};}function patchUpdates(_0x403606){return function(_0x1976eb){try{jsonpatch[_0xce43('0x1c')](_0x1976eb,_0x403606,!![]);}catch(_0x2685fe){return BPromise[_0xce43('0x1d')](_0x2685fe);}return _0x1976eb['save']();};}function saveUpdates(_0x5bd459,_0x383f69){return function(_0x5973b9){if(_0x5973b9){return _0x5973b9[_0xce43('0x1e')](_0x5bd459)[_0xce43('0x1f')](function(_0x85b5a8){return _0x85b5a8;});}return null;};}function removeEntity(_0x5a5bd1,_0x57dcd4){return function(_0x37b34e){if(_0x37b34e){return _0x37b34e[_0xce43('0x20')]()[_0xce43('0x1f')](function(){_0x5a5bd1[_0xce43('0x15')](0xcc)[_0xce43('0x16')]();});}};}function handleEntityNotFound(_0x2b9874,_0x118a89){return function(_0x4e7611){if(!_0x4e7611){_0x2b9874[_0xce43('0x14')](0x194);}return _0x4e7611;};}function handleError(_0x2e58b0,_0x1edcda){_0x1edcda=_0x1edcda||0x1f4;return function(_0x2ae225){logger['error'](_0x2ae225[_0xce43('0x21')]);if(_0x2ae225[_0xce43('0x22')]){delete _0x2ae225[_0xce43('0x22')];}_0x2e58b0[_0xce43('0x15')](_0x1edcda)[_0xce43('0x23')](_0x2ae225);};}exports[_0xce43('0x24')]=function(_0x49e958,_0x371985){var _0x5cb93a={},_0xe9a34c={},_0x394280={'count':0x0,'rows':[]};var _0x453981=_[_0xce43('0x25')](db['OpenchannelQueueReport'][_0xce43('0x26')],function(_0x4402f8){return{'name':_0x4402f8[_0xce43('0x27')],'type':_0x4402f8[_0xce43('0x28')]['key']};});_0xe9a34c[_0xce43('0x29')]=_[_0xce43('0x25')](_0x453981,'name');_0xe9a34c[_0xce43('0x2a')]=_[_0xce43('0x2b')](_0x49e958[_0xce43('0x2a')]);_0xe9a34c[_0xce43('0x2c')]=_[_0xce43('0x2d')](_0xe9a34c[_0xce43('0x29')],_0xe9a34c['query']);_0x5cb93a['attributes']=_[_0xce43('0x2d')](_0xe9a34c[_0xce43('0x29')],qs['fields'](_0x49e958[_0xce43('0x2a')][_0xce43('0x2e')]));_0x5cb93a[_0xce43('0x2f')]=_0x5cb93a[_0xce43('0x2f')][_0xce43('0x30')]?_0x5cb93a['attributes']:_0xe9a34c[_0xce43('0x29')];if(!_0x49e958[_0xce43('0x2a')][_0xce43('0x31')](_0xce43('0x32'))){_0x5cb93a[_0xce43('0x1a')]=qs[_0xce43('0x1a')](_0x49e958[_0xce43('0x2a')][_0xce43('0x1a')]);_0x5cb93a[_0xce43('0x19')]=qs[_0xce43('0x19')](_0x49e958[_0xce43('0x2a')][_0xce43('0x19')]);}_0x5cb93a[_0xce43('0x33')]=qs[_0xce43('0x34')](_0x49e958[_0xce43('0x2a')][_0xce43('0x34')]);_0x5cb93a[_0xce43('0x35')]=qs[_0xce43('0x2c')](_['pick'](_0x49e958[_0xce43('0x2a')],_0xe9a34c[_0xce43('0x2c')]),_0x453981);if(_0x49e958[_0xce43('0x2a')][_0xce43('0x36')]){_0x5cb93a[_0xce43('0x35')]=_[_0xce43('0x37')](_0x5cb93a['where'],{'$or':_[_0xce43('0x25')](_0x453981,function(_0x1af0c2){if(_0x1af0c2[_0xce43('0x28')]!==_0xce43('0x38')){var _0x15ea6b={};_0x15ea6b[_0x1af0c2['name']]={'$like':'%'+_0x49e958['query'][_0xce43('0x36')]+'%'};return _0x15ea6b;}})});}_0x5cb93a=_[_0xce43('0x37')]({},_0x5cb93a,_0x49e958['options']);var _0x338c54={'where':_0x5cb93a[_0xce43('0x35')]};return db[_0xce43('0x39')][_0xce43('0x18')](_0x338c54)['then'](function(_0x42b73e){_0x394280['count']=_0x42b73e;if(_0x49e958[_0xce43('0x2a')][_0xce43('0x3a')]){_0x5cb93a['include']=[{'all':!![]}];}return db[_0xce43('0x39')][_0xce43('0x3b')](_0x5cb93a);})[_0xce43('0x1f')](function(_0x51cf3f){_0x394280['rows']=_0x51cf3f;return _0x394280;})[_0xce43('0x1f')](respondWithFilteredResult(_0x371985,_0x5cb93a))[_0xce43('0x3c')](handleError(_0x371985,null));};exports[_0xce43('0x3d')]=function(_0x4bf26d,_0xf20a50){var _0x149f6a={'raw':!![],'where':{'id':_0x4bf26d[_0xce43('0x3e')]['id']}},_0x43f171={};_0x43f171['model']=_[_0xce43('0x2b')](db[_0xce43('0x39')][_0xce43('0x26')]);_0x43f171[_0xce43('0x2a')]=_[_0xce43('0x2b')](_0x4bf26d[_0xce43('0x2a')]);_0x43f171[_0xce43('0x2c')]=_[_0xce43('0x2d')](_0x43f171[_0xce43('0x29')],_0x43f171['query']);_0x149f6a['attributes']=_[_0xce43('0x2d')](_0x43f171[_0xce43('0x29')],qs[_0xce43('0x2e')](_0x4bf26d[_0xce43('0x2a')][_0xce43('0x2e')]));_0x149f6a[_0xce43('0x2f')]=_0x149f6a[_0xce43('0x2f')][_0xce43('0x30')]?_0x149f6a[_0xce43('0x2f')]:_0x43f171[_0xce43('0x29')];if(_0x4bf26d[_0xce43('0x2a')][_0xce43('0x3a')]){_0x149f6a[_0xce43('0x3f')]=[{'all':!![]}];}_0x149f6a=_[_0xce43('0x37')]({},_0x149f6a,_0x4bf26d[_0xce43('0x40')]);return db[_0xce43('0x39')][_0xce43('0x41')](_0x149f6a)[_0xce43('0x1f')](handleEntityNotFound(_0xf20a50,null))['then'](respondWithResult(_0xf20a50,null))[_0xce43('0x3c')](handleError(_0xf20a50,null));};exports[_0xce43('0x42')]=function(_0x1021f4,_0x519e46){return db['OpenchannelQueueReport'][_0xce43('0x42')](_0x1021f4['body'],{})['then'](respondWithResult(_0x519e46,0xc9))['catch'](handleError(_0x519e46,null));};exports['update']=function(_0x3de6ec,_0x1b37ab){if(_0x3de6ec['body']['id']){delete _0x3de6ec[_0xce43('0x43')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3de6ec[_0xce43('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b37ab,null))['then'](saveUpdates(_0x3de6ec[_0xce43('0x43')],null))[_0xce43('0x1f')](respondWithResult(_0x1b37ab,null))['catch'](handleError(_0x1b37ab,null));};exports['destroy']=function(_0x440cc0,_0x4a5f2d){return db[_0xce43('0x39')][_0xce43('0x41')]({'where':{'id':_0x440cc0['params']['id']}})[_0xce43('0x1f')](handleEntityNotFound(_0x4a5f2d,null))[_0xce43('0x1f')](removeEntity(_0x4a5f2d,null))[_0xce43('0x3c')](handleError(_0x4a5f2d,null));};exports[_0xce43('0x44')]=function(_0x24a969,_0x3dc610){return db[_0xce43('0x39')][_0xce43('0x44')]()[_0xce43('0x1f')](respondWithResult(_0x3dc610,null))['catch'](handleError(_0x3dc610,null));}; \ No newline at end of file +var _0x984b=['model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','fieldName','type','key','query','keys','filters','intersection'];(function(_0x335bc7,_0x2feb4e){var _0x2a3fb1=function(_0x376029){while(--_0x376029){_0x335bc7['push'](_0x335bc7['shift']());}};_0x2a3fb1(++_0x2feb4e);}(_0x984b,0xee));var _0xb984=function(_0xe4f270,_0x315d18){_0xe4f270=_0xe4f270-0x0;var _0x44e466=_0x984b[_0xe4f270];return _0x44e466;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb984('0x0'));var jsonpatch=require(_0xb984('0x1'));var rp=require(_0xb984('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb984('0x3'));var util=require(_0xb984('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb984('0x5'));var ejs=require(_0xb984('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var as=require(_0xb984('0xf'));var hardwareService=require(_0xb984('0x10'));var logger=require(_0xb984('0x11'))(_0xb984('0x12'));var utils=require(_0xb984('0x13'));var config=require(_0xb984('0x14'));var licenseUtil=require(_0xb984('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b922b,_0x4b9c75){_0x4b9c75=_0x4b9c75||0xcc;return function(_0x61432f){if(_0x61432f){return _0x1b922b[_0xb984('0x16')](_0x4b9c75);}return _0x1b922b['status'](_0x4b9c75)[_0xb984('0x17')]();};}function respondWithResult(_0x2e7986,_0x564d24){_0x564d24=_0x564d24||0xc8;return function(_0x203dba){if(_0x203dba){return _0x2e7986[_0xb984('0x18')](_0x564d24)['json'](_0x203dba);}};}function respondWithFilteredResult(_0xede12d,_0x4073cb){return function(_0x57365c){if(_0x57365c){var _0x6fae41=_0x57365c[_0xb984('0x19')],_0x5cd1aa=_0x4073cb[_0xb984('0x1a')],_0x3b8241=_0x4073cb['offset']+_0x4073cb[_0xb984('0x1b')],_0x1dc4df;if(_0x3b8241>=_0x6fae41){_0x3b8241=_0x6fae41;_0x1dc4df=0xc8;}else{_0x1dc4df=0xce;}_0xede12d[_0xb984('0x18')](_0x1dc4df);return _0xede12d[_0xb984('0x1c')](_0xb984('0x1d'),_0x5cd1aa+'-'+_0x3b8241+'/'+_0x6fae41)[_0xb984('0x1e')](_0x57365c);}return null;};}function patchUpdates(_0x4374d0){return function(_0x5c2e25){try{jsonpatch[_0xb984('0x1f')](_0x5c2e25,_0x4374d0,!![]);}catch(_0x2f6d70){return BPromise[_0xb984('0x20')](_0x2f6d70);}return _0x5c2e25[_0xb984('0x21')]();};}function saveUpdates(_0x32831b,_0xcf9365){return function(_0x54dd81){if(_0x54dd81){return _0x54dd81[_0xb984('0x22')](_0x32831b)[_0xb984('0x23')](function(_0x551ad4){return _0x551ad4;});}return null;};}function removeEntity(_0x44b570,_0x97af5c){return function(_0x14734a){if(_0x14734a){return _0x14734a[_0xb984('0x24')]()[_0xb984('0x23')](function(){_0x44b570[_0xb984('0x18')](0xcc)[_0xb984('0x17')]();});}};}function handleEntityNotFound(_0x52c581,_0x391a1e){return function(_0x25de23){if(!_0x25de23){_0x52c581[_0xb984('0x16')](0x194);}return _0x25de23;};}function handleError(_0x5d4d38,_0x2da621){_0x2da621=_0x2da621||0x1f4;return function(_0x2e806e){logger[_0xb984('0x25')](_0x2e806e[_0xb984('0x26')]);if(_0x2e806e[_0xb984('0x27')]){delete _0x2e806e[_0xb984('0x27')];}_0x5d4d38[_0xb984('0x18')](_0x2da621)[_0xb984('0x28')](_0x2e806e);};}exports['index']=function(_0x249d47,_0x469af6){var _0x3e254b={},_0x2bd0f2={},_0x4fb896={'count':0x0,'rows':[]};var _0xa44895=_[_0xb984('0x29')](db[_0xb984('0x2a')]['rawAttributes'],function(_0x363e33){return{'name':_0x363e33[_0xb984('0x2b')],'type':_0x363e33[_0xb984('0x2c')][_0xb984('0x2d')]};});_0x2bd0f2['model']=_['map'](_0xa44895,'name');_0x2bd0f2[_0xb984('0x2e')]=_[_0xb984('0x2f')](_0x249d47['query']);_0x2bd0f2[_0xb984('0x30')]=_[_0xb984('0x31')](_0x2bd0f2[_0xb984('0x32')],_0x2bd0f2[_0xb984('0x2e')]);_0x3e254b['attributes']=_['intersection'](_0x2bd0f2[_0xb984('0x32')],qs[_0xb984('0x33')](_0x249d47[_0xb984('0x2e')][_0xb984('0x33')]));_0x3e254b['attributes']=_0x3e254b[_0xb984('0x34')][_0xb984('0x35')]?_0x3e254b[_0xb984('0x34')]:_0x2bd0f2[_0xb984('0x32')];if(!_0x249d47[_0xb984('0x2e')][_0xb984('0x36')]('nolimit')){_0x3e254b[_0xb984('0x1b')]=qs[_0xb984('0x1b')](_0x249d47[_0xb984('0x2e')][_0xb984('0x1b')]);_0x3e254b[_0xb984('0x1a')]=qs[_0xb984('0x1a')](_0x249d47['query'][_0xb984('0x1a')]);}_0x3e254b[_0xb984('0x37')]=qs['sort'](_0x249d47['query'][_0xb984('0x38')]);_0x3e254b['where']=qs[_0xb984('0x30')](_[_0xb984('0x39')](_0x249d47['query'],_0x2bd0f2[_0xb984('0x30')]),_0xa44895);if(_0x249d47['query'][_0xb984('0x3a')]){_0x3e254b['where']=_[_0xb984('0x3b')](_0x3e254b['where'],{'$or':_['map'](_0xa44895,function(_0xf6d925){if(_0xf6d925[_0xb984('0x2c')]!=='VIRTUAL'){var _0x26b36c={};_0x26b36c[_0xf6d925[_0xb984('0x27')]]={'$like':'%'+_0x249d47['query'][_0xb984('0x3a')]+'%'};return _0x26b36c;}})});}_0x3e254b=_[_0xb984('0x3b')]({},_0x3e254b,_0x249d47[_0xb984('0x3c')]);var _0x35f2c1={'where':_0x3e254b['where']};return db[_0xb984('0x2a')][_0xb984('0x19')](_0x35f2c1)[_0xb984('0x23')](function(_0x474fbd){_0x4fb896[_0xb984('0x19')]=_0x474fbd;if(_0x249d47[_0xb984('0x2e')][_0xb984('0x3d')]){_0x3e254b[_0xb984('0x3e')]=[{'all':!![]}];}return db[_0xb984('0x2a')][_0xb984('0x3f')](_0x3e254b);})['then'](function(_0x134ba5){_0x4fb896[_0xb984('0x40')]=_0x134ba5;return _0x4fb896;})[_0xb984('0x23')](respondWithFilteredResult(_0x469af6,_0x3e254b))[_0xb984('0x41')](handleError(_0x469af6,null));};exports[_0xb984('0x42')]=function(_0x1e06aa,_0x1e8323){var _0xce2f71={'raw':!![],'where':{'id':_0x1e06aa['params']['id']}},_0x52181e={};_0x52181e[_0xb984('0x32')]=_['keys'](db[_0xb984('0x2a')][_0xb984('0x43')]);_0x52181e[_0xb984('0x2e')]=_[_0xb984('0x2f')](_0x1e06aa['query']);_0x52181e[_0xb984('0x30')]=_[_0xb984('0x31')](_0x52181e['model'],_0x52181e[_0xb984('0x2e')]);_0xce2f71[_0xb984('0x34')]=_[_0xb984('0x31')](_0x52181e[_0xb984('0x32')],qs[_0xb984('0x33')](_0x1e06aa[_0xb984('0x2e')][_0xb984('0x33')]));_0xce2f71['attributes']=_0xce2f71[_0xb984('0x34')][_0xb984('0x35')]?_0xce2f71['attributes']:_0x52181e['model'];if(_0x1e06aa[_0xb984('0x2e')][_0xb984('0x3d')]){_0xce2f71[_0xb984('0x3e')]=[{'all':!![]}];}_0xce2f71=_[_0xb984('0x3b')]({},_0xce2f71,_0x1e06aa[_0xb984('0x3c')]);return db['OpenchannelQueueReport'][_0xb984('0x44')](_0xce2f71)[_0xb984('0x23')](handleEntityNotFound(_0x1e8323,null))[_0xb984('0x23')](respondWithResult(_0x1e8323,null))[_0xb984('0x41')](handleError(_0x1e8323,null));};exports[_0xb984('0x45')]=function(_0x44865b,_0x2097e6){return db[_0xb984('0x2a')][_0xb984('0x45')](_0x44865b[_0xb984('0x46')],{})['then'](respondWithResult(_0x2097e6,0xc9))[_0xb984('0x41')](handleError(_0x2097e6,null));};exports[_0xb984('0x22')]=function(_0x4bd4db,_0x1ba546){if(_0x4bd4db[_0xb984('0x46')]['id']){delete _0x4bd4db[_0xb984('0x46')]['id'];}return db[_0xb984('0x2a')][_0xb984('0x44')]({'where':{'id':_0x4bd4db[_0xb984('0x47')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x1ba546,null))[_0xb984('0x23')](saveUpdates(_0x4bd4db[_0xb984('0x46')],null))[_0xb984('0x23')](respondWithResult(_0x1ba546,null))['catch'](handleError(_0x1ba546,null));};exports[_0xb984('0x24')]=function(_0x303280,_0x262898){return db[_0xb984('0x2a')][_0xb984('0x44')]({'where':{'id':_0x303280[_0xb984('0x47')]['id']}})[_0xb984('0x23')](handleEntityNotFound(_0x262898,null))[_0xb984('0x23')](removeEntity(_0x262898,null))[_0xb984('0x41')](handleError(_0x262898,null));};exports['describe']=function(_0x386faf,_0x36e411){return db[_0xb984('0x2a')]['describe']()[_0xb984('0x23')](respondWithResult(_0x36e411,null))[_0xb984('0x41')](handleError(_0x36e411,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 95eecfd..ebee102 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 _0x971d=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue'];(function(_0x5e2116,_0x4a1748){var _0x18f0ed=function(_0x481f73){while(--_0x481f73){_0x5e2116['push'](_0x5e2116['shift']());}};_0x18f0ed(++_0x4a1748);}(_0x971d,0xc5));var _0xd971=function(_0x1492ec,_0x401196){_0x1492ec=_0x1492ec-0x0;var _0x278614=_0x971d[_0x1492ec];return _0x278614;};'use strict';var _=require(_0xd971('0x0'));var util=require(_0xd971('0x1'));var logger=require(_0xd971('0x2'))(_0xd971('0x3'));var moment=require('moment');var BPromise=require(_0xd971('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd971('0x5'));var rimraf=require(_0xd971('0x6'));var config=require(_0xd971('0x7'));var attributes=require(_0xd971('0x8'));module[_0xd971('0x9')]=function(_0x2e19c7,_0x1c82ee){return _0x2e19c7[_0xd971('0xa')](_0xd971('0xb'),attributes,{'tableName':_0xd971('0xc'),'paranoid':![],'indexes':[{'name':_0xd971('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','OpenchannelQueueReport','report_openchannel_queue','lodash','../../config/logger','moment'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xa8eb,0x179));var _0xba8e=function(_0x3f4a71,_0x367d39){_0x3f4a71=_0x3f4a71-0x0;var _0xee8f88=_0xa8eb[_0x3f4a71];return _0xee8f88;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./openchannelQueueReport.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','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 a690a73..5f55497 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 _0x0ee4=['result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','info','catch','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x0ee4,0x77));var _0x40ee=function(_0x3228c7,_0x85629b){_0x3228c7=_0x3228c7-0x0;var _0x215147=_0x0ee4[_0x3228c7];return _0x215147;};'use strict';var _=require(_0x40ee('0x0'));var util=require('util');var moment=require(_0x40ee('0x1'));var BPromise=require(_0x40ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40ee('0x3'));var db=require(_0x40ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x40ee('0x5'))(_0x40ee('0x6'));var config=require(_0x40ee('0x7'));var jayson=require(_0x40ee('0x8'));var client=jayson[_0x40ee('0x9')][_0x40ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5916a3,_0x3376f7,_0x4394de){return new BPromise(function(_0x9f1aad,_0x2d3b62){return client[_0x40ee('0xb')](_0x5916a3,_0x4394de)[_0x40ee('0xc')](function(_0x498bf3){logger['info'](_0x40ee('0xd'),_0x3376f7,'request\x20sent');logger[_0x40ee('0xe')](_0x40ee('0xf'),_0x3376f7,_0x40ee('0x10'),JSON[_0x40ee('0x11')](_0x498bf3));if(_0x498bf3[_0x40ee('0x12')]){if(_0x498bf3[_0x40ee('0x12')][_0x40ee('0x13')]===0x1f4){logger['error'](_0x40ee('0xd'),_0x3376f7,_0x498bf3[_0x40ee('0x12')][_0x40ee('0x14')]);return _0x2d3b62(_0x498bf3[_0x40ee('0x12')][_0x40ee('0x14')]);}logger['error'](_0x40ee('0xd'),_0x3376f7,_0x498bf3['error'][_0x40ee('0x14')]);return _0x9f1aad(_0x498bf3[_0x40ee('0x12')][_0x40ee('0x14')]);}else{logger['info'](_0x40ee('0xd'),_0x3376f7,_0x40ee('0x10'));_0x9f1aad(_0x498bf3[_0x40ee('0x15')][_0x40ee('0x14')]);}})['catch'](function(_0x38c55b){logger[_0x40ee('0x12')](_0x40ee('0xd'),_0x3376f7,_0x38c55b);_0x2d3b62(_0x38c55b);});});}exports[_0x40ee('0x16')]=function(_0x4562b1){var _0x45751a=this;return new Promise(function(_0x4a8943,_0x219996){return db[_0x40ee('0x17')][_0x40ee('0x18')](_0x4562b1['body'],{'raw':_0x4562b1[_0x40ee('0x19')]?_0x4562b1[_0x40ee('0x19')][_0x40ee('0x1a')]===undefined?!![]:![]:!![]})[_0x40ee('0xc')](function(_0x50887e){logger[_0x40ee('0x1b')]('CreateOpenchannelQueueReport',_0x4562b1);logger[_0x40ee('0xe')](_0x40ee('0x16'),_0x4562b1,JSON['stringify'](_0x50887e));_0x4a8943(_0x50887e);})[_0x40ee('0x1c')](function(_0x5422bc){logger[_0x40ee('0x12')](_0x40ee('0x16'),_0x5422bc[_0x40ee('0x14')],_0x4562b1);_0x219996(_0x45751a[_0x40ee('0x12')](0x1f4,_0x5422bc[_0x40ee('0x14')]));});});};exports[_0x40ee('0x1d')]=function(_0x2f2822){var _0x5b664f=this;return new Promise(function(_0x3da420,_0x371fc0){return db['OpenchannelQueueReport'][_0x40ee('0x1e')](_0x2f2822[_0x40ee('0x1f')],{'raw':_0x2f2822['options']?_0x2f2822[_0x40ee('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2822[_0x40ee('0x19')]?_0x2f2822[_0x40ee('0x19')][_0x40ee('0x20')]||null:null,'attributes':_0x2f2822[_0x40ee('0x19')]?_0x2f2822[_0x40ee('0x19')][_0x40ee('0x21')]||null:null,'limit':_0x2f2822[_0x40ee('0x19')]?_0x2f2822[_0x40ee('0x19')][_0x40ee('0x22')]||null:null})[_0x40ee('0xc')](function(_0x1ea89e){logger[_0x40ee('0x1b')](_0x40ee('0x1d'),_0x2f2822);logger[_0x40ee('0xe')]('UpdateOpenchannelQueueReport',_0x2f2822,JSON[_0x40ee('0x11')](_0x1ea89e));_0x3da420(_0x1ea89e);})[_0x40ee('0x1c')](function(_0x415baa){logger[_0x40ee('0x12')](_0x40ee('0x1d'),_0x415baa[_0x40ee('0x14')],_0x2f2822);_0x371fc0(_0x5b664f[_0x40ee('0x12')](0x1f4,_0x415baa[_0x40ee('0x14')]));});});}; \ No newline at end of file +var _0xceeb=['limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xceeb,0x140));var _0xbcee=function(_0xb6bdaf,_0x2b917f){_0xb6bdaf=_0xb6bdaf-0x0;var _0x2e98ab=_0xceeb[_0xb6bdaf];return _0x2e98ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbcee('0x0'));var rs=require(_0xbcee('0x1'));var fs=require('fs');var Redis=require(_0xbcee('0x2'));var db=require(_0xbcee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcee('0x4'))(_0xbcee('0x5'));var config=require(_0xbcee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbcee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3932da,_0x51190c,_0x2311d0){return new BPromise(function(_0x519d92,_0x176ca5){return client['request'](_0x3932da,_0x2311d0)[_0xbcee('0x8')](function(_0x4153b0){logger[_0xbcee('0x9')](_0xbcee('0xa'),_0x51190c,_0xbcee('0xb'));logger[_0xbcee('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x51190c,_0xbcee('0xb'),JSON[_0xbcee('0xd')](_0x4153b0));if(_0x4153b0[_0xbcee('0xe')]){if(_0x4153b0[_0xbcee('0xe')][_0xbcee('0xf')]===0x1f4){logger[_0xbcee('0xe')](_0xbcee('0xa'),_0x51190c,_0x4153b0[_0xbcee('0xe')][_0xbcee('0x10')]);return _0x176ca5(_0x4153b0[_0xbcee('0xe')]['message']);}logger[_0xbcee('0xe')](_0xbcee('0xa'),_0x51190c,_0x4153b0['error'][_0xbcee('0x10')]);return _0x519d92(_0x4153b0['error'][_0xbcee('0x10')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x51190c,_0xbcee('0xb'));_0x519d92(_0x4153b0[_0xbcee('0x11')]['message']);}})[_0xbcee('0x12')](function(_0x581dab){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x51190c,_0x581dab);_0x176ca5(_0x581dab);});});}exports[_0xbcee('0x13')]=function(_0x387d09){var _0x34f621=this;return new Promise(function(_0x3151f7,_0x4356df){return db['OpenchannelQueueReport']['create'](_0x387d09[_0xbcee('0x14')],{'raw':_0x387d09[_0xbcee('0x15')]?_0x387d09[_0xbcee('0x15')][_0xbcee('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1cbd1e){logger[_0xbcee('0x9')]('CreateOpenchannelQueueReport',_0x387d09);logger[_0xbcee('0xc')](_0xbcee('0x13'),_0x387d09,JSON['stringify'](_0x1cbd1e));_0x3151f7(_0x1cbd1e);})[_0xbcee('0x12')](function(_0xa91aaf){logger[_0xbcee('0xe')](_0xbcee('0x13'),_0xa91aaf[_0xbcee('0x10')],_0x387d09);_0x4356df(_0x34f621['error'](0x1f4,_0xa91aaf['message']));});});};exports[_0xbcee('0x17')]=function(_0x468759){var _0x597000=this;return new Promise(function(_0x1c8a66,_0x56a593){return db[_0xbcee('0x18')][_0xbcee('0x19')](_0x468759['body'],{'raw':_0x468759['options']?_0x468759[_0xbcee('0x15')][_0xbcee('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x468759['options']?_0x468759['options'][_0xbcee('0x1a')]||null:null,'attributes':_0x468759['options']?_0x468759[_0xbcee('0x15')][_0xbcee('0x1b')]||null:null,'limit':_0x468759[_0xbcee('0x15')]?_0x468759[_0xbcee('0x15')][_0xbcee('0x1c')]||null:null})[_0xbcee('0x8')](function(_0x3a6f17){logger[_0xbcee('0x9')](_0xbcee('0x17'),_0x468759);logger['debug'](_0xbcee('0x17'),_0x468759,JSON[_0xbcee('0xd')](_0x3a6f17));_0x1c8a66(_0x3a6f17);})[_0xbcee('0x12')](function(_0x4bcb98){logger[_0xbcee('0xe')](_0xbcee('0x17'),_0x4bcb98[_0xbcee('0x10')],_0x468759);_0x56a593(_0x597000[_0xbcee('0xe')](0x1f4,_0x4bcb98['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4a24d10..6dea26e 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(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 a63b522..ac74cd8 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 _0x2656=['STRING','account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x56b067,_0x536dec){var _0x27f66a=function(_0x18ecf6){while(--_0x18ecf6){_0x56b067['push'](_0x56b067['shift']());}};_0x27f66a(++_0x536dec);}(_0x2656,0x165));var _0x6265=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x2656[_0x3e3bee];return _0x3ae14c;};'use strict';var moment=require(_0x6265('0x0'));var Sequelize=require(_0x6265('0x1'));module[_0x6265('0x2')]={'uniqueid':{'type':Sequelize[_0x6265('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6265('0x4'),'agent',_0x6265('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6265('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x6265('0x7')]}}; \ No newline at end of file +var _0xea1b=['DATE','NOW','moment','sequelize','exports','ENUM','account','queue'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0xea1b,0xc2));var _0xbea1=function(_0x4def16,_0x5da0d5){_0x4def16=_0x4def16-0x0;var _0x5e3bc1=_0xea1b[_0x4def16];return _0x5e3bc1;};'use strict';var moment=require(_0xbea1('0x0'));var Sequelize=require(_0xbea1('0x1'));module[_0xbea1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbea1('0x3')](_0xbea1('0x4'),'agent',_0xbea1('0x5')),'allowNull':![],'defaultValue':_0xbea1('0x5')},'transferredAt':{'type':Sequelize[_0xbea1('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbea1('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index aad63cd..af74e2a 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 _0x4e0a=['sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','count','then','include','findAll','params','includeAll','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path'];(function(_0x1eafb6,_0xc72fa7){var _0x4f3b20=function(_0xcb472){while(--_0xcb472){_0x1eafb6['push'](_0x1eafb6['shift']());}};_0x4f3b20(++_0xc72fa7);}(_0x4e0a,0xd3));var _0xa4e0=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x4e0a[_0x1f0724];return _0x253ffb;};'use strict';var pdf=require(_0xa4e0('0x0'));var emlformat=require(_0xa4e0('0x1'));var rimraf=require(_0xa4e0('0x2'));var zipdir=require(_0xa4e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa4e0('0x4'));var BPromise=require(_0xa4e0('0x5'));var Mustache=require(_0xa4e0('0x6'));var util=require('util');var path=require(_0xa4e0('0x7'));var sox=require(_0xa4e0('0x8'));var csv=require(_0xa4e0('0x9'));var ejs=require(_0xa4e0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa4e0('0xb'));var crypto=require('crypto');var jsforce=require(_0xa4e0('0xc'));var deskjs=require(_0xa4e0('0xd'));var toCsv=require(_0xa4e0('0x9'));var querystring=require(_0xa4e0('0xe'));var Papa=require(_0xa4e0('0xf'));var Redis=require('ioredis');var authService=require(_0xa4e0('0x10'));var qs=require(_0xa4e0('0x11'));var as=require(_0xa4e0('0x12'));var hardwareService=require(_0xa4e0('0x13'));var logger=require(_0xa4e0('0x14'))(_0xa4e0('0x15'));var utils=require(_0xa4e0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa4e0('0x17'));var db=require(_0xa4e0('0x18'))['db'];function respondWithStatusCode(_0x33bee9,_0x3482f1){_0x3482f1=_0x3482f1||0xcc;return function(_0x138dd7){if(_0x138dd7){return _0x33bee9[_0xa4e0('0x19')](_0x3482f1);}return _0x33bee9[_0xa4e0('0x1a')](_0x3482f1)[_0xa4e0('0x1b')]();};}function respondWithResult(_0x5b5dee,_0x20b8db){_0x20b8db=_0x20b8db||0xc8;return function(_0x24d3f7){if(_0x24d3f7){return _0x5b5dee[_0xa4e0('0x1a')](_0x20b8db)['json'](_0x24d3f7);}};}function respondWithFilteredResult(_0xb0f329,_0x2f53ed){return function(_0x15d243){if(_0x15d243){var _0x41dea1=_0x15d243['count'],_0x2cc3d7=_0x2f53ed['offset'],_0x8915fe=_0x2f53ed['offset']+_0x2f53ed[_0xa4e0('0x1c')],_0x36bc88;if(_0x8915fe>=_0x41dea1){_0x8915fe=_0x41dea1;_0x36bc88=0xc8;}else{_0x36bc88=0xce;}_0xb0f329['status'](_0x36bc88);return _0xb0f329[_0xa4e0('0x1d')]('Content-Range',_0x2cc3d7+'-'+_0x8915fe+'/'+_0x41dea1)['json'](_0x15d243);}return null;};}function patchUpdates(_0x55dec8){return function(_0x26ab89){try{jsonpatch[_0xa4e0('0x1e')](_0x26ab89,_0x55dec8,!![]);}catch(_0xc4fa07){return BPromise[_0xa4e0('0x1f')](_0xc4fa07);}return _0x26ab89[_0xa4e0('0x20')]();};}function saveUpdates(_0x4ec53d,_0x5cfaad){return function(_0xdd99c9){if(_0xdd99c9){return _0xdd99c9[_0xa4e0('0x21')](_0x4ec53d)['then'](function(_0x5b047e){return _0x5b047e;});}return null;};}function removeEntity(_0x5a6f66,_0xeefe7d){return function(_0x5f5b12){if(_0x5f5b12){return _0x5f5b12[_0xa4e0('0x22')]()['then'](function(){_0x5a6f66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2129,_0x572d2f){return function(_0x4d1fd8){if(!_0x4d1fd8){_0x5b2129[_0xa4e0('0x19')](0x194);}return _0x4d1fd8;};}function handleError(_0xb5212b,_0x49ed07){_0x49ed07=_0x49ed07||0x1f4;return function(_0x4568b1){logger[_0xa4e0('0x23')](_0x4568b1[_0xa4e0('0x24')]);if(_0x4568b1['name']){delete _0x4568b1[_0xa4e0('0x25')];}_0xb5212b[_0xa4e0('0x1a')](_0x49ed07)[_0xa4e0('0x26')](_0x4568b1);};}exports[_0xa4e0('0x27')]=function(_0x21da72,_0x171061){var _0x495e32={},_0x127c1e={},_0x2c1541={'count':0x0,'rows':[]};var _0x2c4a71=_[_0xa4e0('0x28')](db[_0xa4e0('0x29')][_0xa4e0('0x2a')],function(_0x1d1dbf){return{'name':_0x1d1dbf['fieldName'],'type':_0x1d1dbf[_0xa4e0('0x2b')][_0xa4e0('0x2c')]};});_0x127c1e[_0xa4e0('0x2d')]=_['map'](_0x2c4a71,_0xa4e0('0x25'));_0x127c1e[_0xa4e0('0x2e')]=_[_0xa4e0('0x2f')](_0x21da72[_0xa4e0('0x2e')]);_0x127c1e[_0xa4e0('0x30')]=_[_0xa4e0('0x31')](_0x127c1e[_0xa4e0('0x2d')],_0x127c1e[_0xa4e0('0x2e')]);_0x495e32[_0xa4e0('0x32')]=_[_0xa4e0('0x31')](_0x127c1e[_0xa4e0('0x2d')],qs[_0xa4e0('0x33')](_0x21da72[_0xa4e0('0x2e')]['fields']));_0x495e32[_0xa4e0('0x32')]=_0x495e32['attributes'][_0xa4e0('0x34')]?_0x495e32[_0xa4e0('0x32')]:_0x127c1e['model'];if(!_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x35')](_0xa4e0('0x36'))){_0x495e32[_0xa4e0('0x1c')]=qs[_0xa4e0('0x1c')](_0x21da72[_0xa4e0('0x2e')]['limit']);_0x495e32[_0xa4e0('0x37')]=qs[_0xa4e0('0x37')](_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x37')]);}_0x495e32['order']=qs[_0xa4e0('0x38')](_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x38')]);_0x495e32[_0xa4e0('0x39')]=qs[_0xa4e0('0x30')](_['pick'](_0x21da72['query'],_0x127c1e[_0xa4e0('0x30')]),_0x2c4a71);if(_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x3a')]){_0x495e32[_0xa4e0('0x39')]=_[_0xa4e0('0x3b')](_0x495e32[_0xa4e0('0x39')],{'$or':_[_0xa4e0('0x28')](_0x2c4a71,function(_0x5000df){if(_0x5000df[_0xa4e0('0x2b')]!==_0xa4e0('0x3c')){var _0x3e9a68={};_0x3e9a68[_0x5000df['name']]={'$like':'%'+_0x21da72[_0xa4e0('0x2e')][_0xa4e0('0x3a')]+'%'};return _0x3e9a68;}})});}_0x495e32=_[_0xa4e0('0x3b')]({},_0x495e32,_0x21da72['options']);var _0x2b2e32={'where':_0x495e32['where']};return db[_0xa4e0('0x29')][_0xa4e0('0x3d')](_0x2b2e32)[_0xa4e0('0x3e')](function(_0x52a643){_0x2c1541['count']=_0x52a643;if(_0x21da72['query']['includeAll']){_0x495e32[_0xa4e0('0x3f')]=[{'all':!![]}];}return db[_0xa4e0('0x29')][_0xa4e0('0x40')](_0x495e32);})[_0xa4e0('0x3e')](function(_0x5986f2){_0x2c1541['rows']=_0x5986f2;return _0x2c1541;})[_0xa4e0('0x3e')](respondWithFilteredResult(_0x171061,_0x495e32))['catch'](handleError(_0x171061,null));};exports['show']=function(_0x8158ef,_0x4c9eb5){var _0x40cf31={'raw':!![],'where':{'id':_0x8158ef[_0xa4e0('0x41')]['id']}},_0x1f7cbf={};_0x1f7cbf[_0xa4e0('0x2d')]=_[_0xa4e0('0x2f')](db[_0xa4e0('0x29')][_0xa4e0('0x2a')]);_0x1f7cbf[_0xa4e0('0x2e')]=_['keys'](_0x8158ef[_0xa4e0('0x2e')]);_0x1f7cbf[_0xa4e0('0x30')]=_[_0xa4e0('0x31')](_0x1f7cbf[_0xa4e0('0x2d')],_0x1f7cbf[_0xa4e0('0x2e')]);_0x40cf31[_0xa4e0('0x32')]=_[_0xa4e0('0x31')](_0x1f7cbf[_0xa4e0('0x2d')],qs[_0xa4e0('0x33')](_0x8158ef[_0xa4e0('0x2e')]['fields']));_0x40cf31['attributes']=_0x40cf31['attributes']['length']?_0x40cf31[_0xa4e0('0x32')]:_0x1f7cbf[_0xa4e0('0x2d')];if(_0x8158ef[_0xa4e0('0x2e')][_0xa4e0('0x42')]){_0x40cf31[_0xa4e0('0x3f')]=[{'all':!![]}];}_0x40cf31=_['merge']({},_0x40cf31,_0x8158ef[_0xa4e0('0x43')]);return db['OpenchannelTransferReport'][_0xa4e0('0x44')](_0x40cf31)[_0xa4e0('0x3e')](handleEntityNotFound(_0x4c9eb5,null))[_0xa4e0('0x3e')](respondWithResult(_0x4c9eb5,null))[_0xa4e0('0x45')](handleError(_0x4c9eb5,null));};exports[_0xa4e0('0x46')]=function(_0x5e97b0,_0x4dc8d6){return db['OpenchannelTransferReport'][_0xa4e0('0x46')](_0x5e97b0[_0xa4e0('0x47')],{})['then'](respondWithResult(_0x4dc8d6,0xc9))['catch'](handleError(_0x4dc8d6,null));};exports['update']=function(_0x1a16e9,_0x2d6a89){if(_0x1a16e9[_0xa4e0('0x47')]['id']){delete _0x1a16e9[_0xa4e0('0x47')]['id'];}return db[_0xa4e0('0x29')][_0xa4e0('0x44')]({'where':{'id':_0x1a16e9[_0xa4e0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d6a89,null))[_0xa4e0('0x3e')](saveUpdates(_0x1a16e9['body'],null))[_0xa4e0('0x3e')](respondWithResult(_0x2d6a89,null))['catch'](handleError(_0x2d6a89,null));};exports[_0xa4e0('0x22')]=function(_0x2ad125,_0x18d560){return db[_0xa4e0('0x29')]['find']({'where':{'id':_0x2ad125['params']['id']}})[_0xa4e0('0x3e')](handleEntityNotFound(_0x18d560,null))[_0xa4e0('0x3e')](removeEntity(_0x18d560,null))[_0xa4e0('0x45')](handleError(_0x18d560,null));};exports[_0xa4e0('0x48')]=function(_0x2aa002,_0x61cf6b){return db[_0xa4e0('0x29')][_0xa4e0('0x48')]()[_0xa4e0('0x3e')](respondWithResult(_0x61cf6b,null))[_0xa4e0('0x45')](handleError(_0x61cf6b,null));}; \ No newline at end of file +var _0x6617=['show','params','keys','intersection','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','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','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch'];(function(_0x571bbc,_0x242132){var _0x3e8edb=function(_0x5cc0a2){while(--_0x5cc0a2){_0x571bbc['push'](_0x571bbc['shift']());}};_0x3e8edb(++_0x242132);}(_0x6617,0x9d));var _0x7661=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x6617[_0x231a47];return _0x48d7c9;};'use strict';var pdf=require(_0x7661('0x0'));var emlformat=require(_0x7661('0x1'));var rimraf=require(_0x7661('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7661('0x3'));var moment=require(_0x7661('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7661('0x5'));var path=require(_0x7661('0x6'));var sox=require('sox');var csv=require(_0x7661('0x7'));var ejs=require(_0x7661('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7661('0x9'));var crypto=require(_0x7661('0xa'));var jsforce=require(_0x7661('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7661('0x7'));var querystring=require('querystring');var Papa=require(_0x7661('0xc'));var Redis=require(_0x7661('0xd'));var authService=require(_0x7661('0xe'));var qs=require(_0x7661('0xf'));var as=require(_0x7661('0x10'));var hardwareService=require(_0x7661('0x11'));var logger=require(_0x7661('0x12'))('api');var utils=require(_0x7661('0x13'));var config=require(_0x7661('0x14'));var licenseUtil=require(_0x7661('0x15'));var db=require(_0x7661('0x16'))['db'];function respondWithStatusCode(_0x8090b2,_0x1f9049){_0x1f9049=_0x1f9049||0xcc;return function(_0x4fe486){if(_0x4fe486){return _0x8090b2[_0x7661('0x17')](_0x1f9049);}return _0x8090b2[_0x7661('0x18')](_0x1f9049)[_0x7661('0x19')]();};}function respondWithResult(_0x453947,_0xba4b5f){_0xba4b5f=_0xba4b5f||0xc8;return function(_0x189ac0){if(_0x189ac0){return _0x453947['status'](_0xba4b5f)[_0x7661('0x1a')](_0x189ac0);}};}function respondWithFilteredResult(_0x467bcc,_0x48a548){return function(_0x28723b){if(_0x28723b){var _0x2628a2=_0x28723b['count'],_0x2a9045=_0x48a548[_0x7661('0x1b')],_0x3637b7=_0x48a548[_0x7661('0x1b')]+_0x48a548[_0x7661('0x1c')],_0x31b4fb;if(_0x3637b7>=_0x2628a2){_0x3637b7=_0x2628a2;_0x31b4fb=0xc8;}else{_0x31b4fb=0xce;}_0x467bcc[_0x7661('0x18')](_0x31b4fb);return _0x467bcc['set'](_0x7661('0x1d'),_0x2a9045+'-'+_0x3637b7+'/'+_0x2628a2)[_0x7661('0x1a')](_0x28723b);}return null;};}function patchUpdates(_0x5a01cc){return function(_0x48d099){try{jsonpatch[_0x7661('0x1e')](_0x48d099,_0x5a01cc,!![]);}catch(_0x304f90){return BPromise['reject'](_0x304f90);}return _0x48d099[_0x7661('0x1f')]();};}function saveUpdates(_0x76ad13,_0x3e974d){return function(_0x33e7fa){if(_0x33e7fa){return _0x33e7fa[_0x7661('0x20')](_0x76ad13)[_0x7661('0x21')](function(_0x16a242){return _0x16a242;});}return null;};}function removeEntity(_0x19b617,_0x3beb16){return function(_0x3fd6d1){if(_0x3fd6d1){return _0x3fd6d1['destroy']()['then'](function(){_0x19b617[_0x7661('0x18')](0xcc)[_0x7661('0x19')]();});}};}function handleEntityNotFound(_0x28e236,_0xb506a2){return function(_0x6495ab){if(!_0x6495ab){_0x28e236[_0x7661('0x17')](0x194);}return _0x6495ab;};}function handleError(_0x2b879b,_0xb57697){_0xb57697=_0xb57697||0x1f4;return function(_0x1375cf){logger[_0x7661('0x22')](_0x1375cf[_0x7661('0x23')]);if(_0x1375cf['name']){delete _0x1375cf[_0x7661('0x24')];}_0x2b879b[_0x7661('0x18')](_0xb57697)[_0x7661('0x25')](_0x1375cf);};}exports[_0x7661('0x26')]=function(_0x3d561c,_0x16eed0){var _0x42de3c={},_0x53108d={},_0x468637={'count':0x0,'rows':[]};var _0x2aeba3=_['map'](db[_0x7661('0x27')][_0x7661('0x28')],function(_0x101220){return{'name':_0x101220[_0x7661('0x29')],'type':_0x101220[_0x7661('0x2a')][_0x7661('0x2b')]};});_0x53108d['model']=_['map'](_0x2aeba3,_0x7661('0x24'));_0x53108d[_0x7661('0x2c')]=_['keys'](_0x3d561c[_0x7661('0x2c')]);_0x53108d[_0x7661('0x2d')]=_['intersection'](_0x53108d[_0x7661('0x2e')],_0x53108d[_0x7661('0x2c')]);_0x42de3c['attributes']=_['intersection'](_0x53108d['model'],qs[_0x7661('0x2f')](_0x3d561c['query'][_0x7661('0x2f')]));_0x42de3c[_0x7661('0x30')]=_0x42de3c[_0x7661('0x30')][_0x7661('0x31')]?_0x42de3c['attributes']:_0x53108d[_0x7661('0x2e')];if(!_0x3d561c[_0x7661('0x2c')][_0x7661('0x32')](_0x7661('0x33'))){_0x42de3c[_0x7661('0x1c')]=qs[_0x7661('0x1c')](_0x3d561c[_0x7661('0x2c')][_0x7661('0x1c')]);_0x42de3c[_0x7661('0x1b')]=qs[_0x7661('0x1b')](_0x3d561c[_0x7661('0x2c')]['offset']);}_0x42de3c['order']=qs[_0x7661('0x34')](_0x3d561c[_0x7661('0x2c')]['sort']);_0x42de3c['where']=qs[_0x7661('0x2d')](_['pick'](_0x3d561c['query'],_0x53108d['filters']),_0x2aeba3);if(_0x3d561c[_0x7661('0x2c')][_0x7661('0x35')]){_0x42de3c[_0x7661('0x36')]=_[_0x7661('0x37')](_0x42de3c[_0x7661('0x36')],{'$or':_[_0x7661('0x38')](_0x2aeba3,function(_0x201b0c){if(_0x201b0c[_0x7661('0x2a')]!==_0x7661('0x39')){var _0xdcc2e5={};_0xdcc2e5[_0x201b0c[_0x7661('0x24')]]={'$like':'%'+_0x3d561c[_0x7661('0x2c')]['filter']+'%'};return _0xdcc2e5;}})});}_0x42de3c=_[_0x7661('0x37')]({},_0x42de3c,_0x3d561c[_0x7661('0x3a')]);var _0xfb37ee={'where':_0x42de3c[_0x7661('0x36')]};return db[_0x7661('0x27')][_0x7661('0x3b')](_0xfb37ee)['then'](function(_0x4f279e){_0x468637[_0x7661('0x3b')]=_0x4f279e;if(_0x3d561c[_0x7661('0x2c')][_0x7661('0x3c')]){_0x42de3c[_0x7661('0x3d')]=[{'all':!![]}];}return db[_0x7661('0x27')][_0x7661('0x3e')](_0x42de3c);})[_0x7661('0x21')](function(_0x411428){_0x468637[_0x7661('0x3f')]=_0x411428;return _0x468637;})[_0x7661('0x21')](respondWithFilteredResult(_0x16eed0,_0x42de3c))[_0x7661('0x40')](handleError(_0x16eed0,null));};exports[_0x7661('0x41')]=function(_0x51067d,_0x262d82){var _0xf4c7f2={'raw':!![],'where':{'id':_0x51067d[_0x7661('0x42')]['id']}},_0x133834={};_0x133834[_0x7661('0x2e')]=_['keys'](db[_0x7661('0x27')][_0x7661('0x28')]);_0x133834[_0x7661('0x2c')]=_[_0x7661('0x43')](_0x51067d[_0x7661('0x2c')]);_0x133834[_0x7661('0x2d')]=_[_0x7661('0x44')](_0x133834[_0x7661('0x2e')],_0x133834['query']);_0xf4c7f2[_0x7661('0x30')]=_[_0x7661('0x44')](_0x133834[_0x7661('0x2e')],qs['fields'](_0x51067d[_0x7661('0x2c')][_0x7661('0x2f')]));_0xf4c7f2[_0x7661('0x30')]=_0xf4c7f2[_0x7661('0x30')][_0x7661('0x31')]?_0xf4c7f2[_0x7661('0x30')]:_0x133834[_0x7661('0x2e')];if(_0x51067d['query'][_0x7661('0x3c')]){_0xf4c7f2[_0x7661('0x3d')]=[{'all':!![]}];}_0xf4c7f2=_[_0x7661('0x37')]({},_0xf4c7f2,_0x51067d[_0x7661('0x3a')]);return db['OpenchannelTransferReport']['find'](_0xf4c7f2)[_0x7661('0x21')](handleEntityNotFound(_0x262d82,null))[_0x7661('0x21')](respondWithResult(_0x262d82,null))[_0x7661('0x40')](handleError(_0x262d82,null));};exports[_0x7661('0x45')]=function(_0x1803de,_0x5f5603){return db[_0x7661('0x27')][_0x7661('0x45')](_0x1803de[_0x7661('0x46')],{})[_0x7661('0x21')](respondWithResult(_0x5f5603,0xc9))[_0x7661('0x40')](handleError(_0x5f5603,null));};exports[_0x7661('0x20')]=function(_0x38c648,_0x3facc3){if(_0x38c648['body']['id']){delete _0x38c648['body']['id'];}return db[_0x7661('0x27')][_0x7661('0x47')]({'where':{'id':_0x38c648[_0x7661('0x42')]['id']}})[_0x7661('0x21')](handleEntityNotFound(_0x3facc3,null))[_0x7661('0x21')](saveUpdates(_0x38c648[_0x7661('0x46')],null))[_0x7661('0x21')](respondWithResult(_0x3facc3,null))[_0x7661('0x40')](handleError(_0x3facc3,null));};exports[_0x7661('0x48')]=function(_0x5652e3,_0x38f81b){return db[_0x7661('0x27')][_0x7661('0x47')]({'where':{'id':_0x5652e3[_0x7661('0x42')]['id']}})[_0x7661('0x21')](handleEntityNotFound(_0x38f81b,null))[_0x7661('0x21')](removeEntity(_0x38f81b,null))['catch'](handleError(_0x38f81b,null));};exports[_0x7661('0x49')]=function(_0x2852e4,_0x144b83){return db['OpenchannelTransferReport']['describe']()[_0x7661('0x21')](respondWithResult(_0x144b83,null))[_0x7661('0x40')](handleError(_0x144b83,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4dcd060..f8aab7e 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 _0x80aa=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x27fcd6,_0xc05845){var _0x244158=function(_0x56fbf5){while(--_0x56fbf5){_0x27fcd6['push'](_0x27fcd6['shift']());}};_0x244158(++_0xc05845);}(_0x80aa,0xb3));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa80a('0x0'))(_0xa80a('0x1'));var moment=require(_0xa80a('0x2'));var BPromise=require(_0xa80a('0x3'));var rp=require(_0xa80a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa80a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa80a('0x6'));module[_0xa80a('0x7')]=function(_0x17f0a5,_0x1c4d73){return _0x17f0a5['define'](_0xa80a('0x8'),attributes,{'tableName':_0xa80a('0x9'),'paranoid':![],'indexes':[{'name':_0xa80a('0xa'),'fields':[_0xa80a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc83=['path','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43a17a,_0x4fc0aa){var _0x3aed05=function(_0x18fac9){while(--_0x18fac9){_0x43a17a['push'](_0x43a17a['shift']());}};_0x3aed05(++_0x4fc0aa);}(_0xdc83,0x103));var _0x3dc8=function(_0x8ddd56,_0x10f63c){_0x8ddd56=_0x8ddd56-0x0;var _0x5668f8=_0xdc83[_0x8ddd56];return _0x5668f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3dc8('0x0'))(_0x3dc8('0x1'));var moment=require(_0x3dc8('0x2'));var BPromise=require(_0x3dc8('0x3'));var rp=require(_0x3dc8('0x4'));var fs=require('fs');var path=require(_0x3dc8('0x5'));var rimraf=require('rimraf');var config=require(_0x3dc8('0x6'));var attributes=require(_0x3dc8('0x7'));module['exports']=function(_0x1abd8e,_0x583c8b){return _0x1abd8e['define'](_0x3dc8('0x8'),attributes,{'tableName':_0x3dc8('0x9'),'paranoid':![],'indexes':[{'name':_0x3dc8('0xa'),'fields':[_0x3dc8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 28b0dab..7d66047 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 _0x2436=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4d1409,_0x27aad3){var _0x3ae822=function(_0x15acd3){while(--_0x15acd3){_0x4d1409['push'](_0x4d1409['shift']());}};_0x3ae822(++_0x27aad3);}(_0x2436,0x1e7));var _0x6243=function(_0x32d825,_0x18af65){_0x32d825=_0x32d825-0x0;var _0x488bd0=_0x2436[_0x32d825];return _0x488bd0;};'use strict';var _=require('lodash');var util=require(_0x6243('0x0'));var moment=require(_0x6243('0x1'));var BPromise=require(_0x6243('0x2'));var rs=require(_0x6243('0x3'));var fs=require('fs');var Redis=require(_0x6243('0x4'));var db=require(_0x6243('0x5'))['db'];var utils=require(_0x6243('0x6'));var logger=require(_0x6243('0x7'))(_0x6243('0x8'));var config=require(_0x6243('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6243('0xa')][_0x6243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x443aad,_0x2ef23c,_0x1f7a31){return new BPromise(function(_0x24709a,_0x3517b4){return client['request'](_0x443aad,_0x1f7a31)[_0x6243('0xc')](function(_0x3c22fd){logger['info'](_0x6243('0xd'),_0x2ef23c,_0x6243('0xe'));logger[_0x6243('0xf')](_0x6243('0x10'),_0x2ef23c,'request\x20sent',JSON['stringify'](_0x3c22fd));if(_0x3c22fd['error']){if(_0x3c22fd[_0x6243('0x11')][_0x6243('0x12')]===0x1f4){logger['error'](_0x6243('0xd'),_0x2ef23c,_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);return _0x3517b4(_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);}logger[_0x6243('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2ef23c,_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);return _0x24709a(_0x3c22fd[_0x6243('0x11')][_0x6243('0x13')]);}else{logger[_0x6243('0x14')](_0x6243('0xd'),_0x2ef23c,_0x6243('0xe'));_0x24709a(_0x3c22fd['result'][_0x6243('0x13')]);}})[_0x6243('0x15')](function(_0x2bbde5){logger[_0x6243('0x11')](_0x6243('0xd'),_0x2ef23c,_0x2bbde5);_0x3517b4(_0x2bbde5);});});} \ No newline at end of file +var _0x621f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x6aefe0,_0x16efc4){var _0x3ec1e5=function(_0x180284){while(--_0x180284){_0x6aefe0['push'](_0x6aefe0['shift']());}};_0x3ec1e5(++_0x16efc4);}(_0x621f,0x128));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require(_0xf621('0x1'));var moment=require('moment');var BPromise=require(_0xf621('0x2'));var rs=require(_0xf621('0x3'));var fs=require('fs');var Redis=require(_0xf621('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf621('0x5'));var logger=require(_0xf621('0x6'))(_0xf621('0x7'));var config=require(_0xf621('0x8'));var jayson=require(_0xf621('0x9'));var client=jayson[_0xf621('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34acae,_0x545f38,_0x38fe85){return new BPromise(function(_0x88e735,_0x13012c){return client['request'](_0x34acae,_0x38fe85)[_0xf621('0xb')](function(_0x3b7d1c){logger[_0xf621('0xc')](_0xf621('0xd'),_0x545f38,'request\x20sent');logger[_0xf621('0xe')](_0xf621('0xf'),_0x545f38,_0xf621('0x10'),JSON[_0xf621('0x11')](_0x3b7d1c));if(_0x3b7d1c['error']){if(_0x3b7d1c[_0xf621('0x12')][_0xf621('0x13')]===0x1f4){logger[_0xf621('0x12')](_0xf621('0xd'),_0x545f38,_0x3b7d1c['error']['message']);return _0x13012c(_0x3b7d1c[_0xf621('0x12')][_0xf621('0x14')]);}logger[_0xf621('0x12')](_0xf621('0xd'),_0x545f38,_0x3b7d1c[_0xf621('0x12')]['message']);return _0x88e735(_0x3b7d1c[_0xf621('0x12')]['message']);}else{logger[_0xf621('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x545f38,'request\x20sent');_0x88e735(_0x3b7d1c[_0xf621('0x15')][_0xf621('0x14')]);}})[_0xf621('0x16')](function(_0xd5f0ef){logger[_0xf621('0x12')](_0xf621('0xd'),_0x545f38,_0xd5f0ef);_0x13012c(_0xd5f0ef);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6df7b09..580e044 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 _0xac30=['get','/:id','show','post','create','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0xc5c4a9,_0x260a6c){var _0x233feb=function(_0x2c78bf){while(--_0x2c78bf){_0xc5c4a9['push'](_0xc5c4a9['shift']());}};_0x233feb(++_0x260a6c);}(_0xac30,0x16f));var _0x0ac3=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xac30[_0x2bc3f4];return _0x14ac53;};'use strict';var multer=require('multer');var util=require(_0x0ac3('0x0'));var path=require(_0x0ac3('0x1'));var timeout=require(_0x0ac3('0x2'));var express=require(_0x0ac3('0x3'));var router=express[_0x0ac3('0x4')]();var auth=require(_0x0ac3('0x5'));var interaction=require(_0x0ac3('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0x0ac3('0x7')](),controller['index']);router[_0x0ac3('0x8')](_0x0ac3('0x9'),auth[_0x0ac3('0x7')](),controller[_0x0ac3('0xa')]);router[_0x0ac3('0xb')]('/',auth[_0x0ac3('0x7')](),controller[_0x0ac3('0xc')]);router['put'](_0x0ac3('0x9'),auth[_0x0ac3('0x7')](),controller['update']);router[_0x0ac3('0xd')](_0x0ac3('0x9'),auth['isAuthenticated'](),controller[_0x0ac3('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5bf6=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x59f126,_0x3e726b){var _0x4f8147=function(_0x4146e5){while(--_0x4146e5){_0x59f126['push'](_0x59f126['shift']());}};_0x4f8147(++_0x3e726b);}(_0x5bf6,0x87));var _0x65bf=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x5bf6[_0x9d1e6b];return _0x2b3070;};'use strict';var multer=require(_0x65bf('0x0'));var util=require(_0x65bf('0x1'));var path=require(_0x65bf('0x2'));var timeout=require(_0x65bf('0x3'));var express=require(_0x65bf('0x4'));var router=express[_0x65bf('0x5')]();var auth=require(_0x65bf('0x6'));var interaction=require(_0x65bf('0x7'));var config=require(_0x65bf('0x8'));var controller=require(_0x65bf('0x9'));router[_0x65bf('0xa')]('/',auth['isAuthenticated'](),controller[_0x65bf('0xb')]);router[_0x65bf('0xa')](_0x65bf('0xc'),auth[_0x65bf('0xd')](),controller[_0x65bf('0xe')]);router[_0x65bf('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65bf('0x10')](_0x65bf('0xc'),auth[_0x65bf('0xd')](),controller['update']);router[_0x65bf('0x11')](_0x65bf('0xc'),auth[_0x65bf('0xd')](),controller[_0x65bf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7f40cfa..0ae6f0f 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 _0x3067=['STRING','name','sequelize','exports'];(function(_0x1378e2,_0x52a6ee){var _0x865b40=function(_0x3c323d){while(--_0x3c323d){_0x1378e2['push'](_0x1378e2['shift']());}};_0x865b40(++_0x52a6ee);}(_0x3067,0xa6));var _0x7306=function(_0x2d9059,_0x536df5){_0x2d9059=_0x2d9059-0x0;var _0x39abdb=_0x3067[_0x2d9059];return _0x39abdb;};'use strict';var Sequelize=require(_0x7306('0x0'));module[_0x7306('0x1')]={'name':{'type':Sequelize[_0x7306('0x2')],'unique':_0x7306('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7306('0x2')]}}; \ No newline at end of file +var _0x21ee=['STRING','sequelize'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x21ee,0x1a5));var _0xe21e=function(_0x1ac3f9,_0x32169d){_0x1ac3f9=_0x1ac3f9-0x0;var _0x35982e=_0x21ee[_0x1ac3f9];return _0x35982e;};'use strict';var Sequelize=require(_0xe21e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe21e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe21e('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 65e8954..7ba2951 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 _0x668d=['util','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','Content-Range','reject','save','update','destroy','then','UserProfileResource','error','name','index','Pause','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','map','options','count','includeAll','findAll','rows','catch','show','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x362b7b,_0x1fe138){var _0x11c182=function(_0x5c5cea){while(--_0x5c5cea){_0x362b7b['push'](_0x362b7b['shift']());}};_0x11c182(++_0x1fe138);}(_0x668d,0xe7));var _0xd668=function(_0x5e7dd3,_0x1eecaf){_0x5e7dd3=_0x5e7dd3-0x0;var _0x48b3a8=_0x668d[_0x5e7dd3];return _0x48b3a8;};'use strict';var pdf=require(_0xd668('0x0'));var emlformat=require(_0xd668('0x1'));var rimraf=require(_0xd668('0x2'));var zipdir=require(_0xd668('0x3'));var jsonpatch=require(_0xd668('0x4'));var rp=require(_0xd668('0x5'));var moment=require(_0xd668('0x6'));var BPromise=require(_0xd668('0x7'));var Mustache=require(_0xd668('0x8'));var util=require(_0xd668('0x9'));var path=require('path');var sox=require(_0xd668('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd668('0xb'));var crypto=require(_0xd668('0xc'));var jsforce=require(_0xd668('0xd'));var deskjs=require(_0xd668('0xe'));var toCsv=require(_0xd668('0xf'));var querystring=require('querystring');var Papa=require(_0xd668('0x10'));var Redis=require(_0xd668('0x11'));var authService=require(_0xd668('0x12'));var qs=require(_0xd668('0x13'));var as=require(_0xd668('0x14'));var hardwareService=require(_0xd668('0x15'));var logger=require(_0xd668('0x16'))(_0xd668('0x17'));var utils=require(_0xd668('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd668('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1435aa,_0x2a5d1a){_0x2a5d1a=_0x2a5d1a||0xcc;return function(_0x38157e){if(_0x38157e){return _0x1435aa[_0xd668('0x1a')](_0x2a5d1a);}return _0x1435aa[_0xd668('0x1b')](_0x2a5d1a)[_0xd668('0x1c')]();};}function respondWithResult(_0x49bc08,_0x21bd01){_0x21bd01=_0x21bd01||0xc8;return function(_0x3f1621){if(_0x3f1621){return _0x49bc08[_0xd668('0x1b')](_0x21bd01)[_0xd668('0x1d')](_0x3f1621);}};}function respondWithFilteredResult(_0x1fb7a8,_0x55b240){return function(_0x31b30b){if(_0x31b30b){var _0x62a051=_0x31b30b['count'],_0x6bd9f2=_0x55b240[_0xd668('0x1e')],_0x22663b=_0x55b240[_0xd668('0x1e')]+_0x55b240['limit'],_0x153577;if(_0x22663b>=_0x62a051){_0x22663b=_0x62a051;_0x153577=0xc8;}else{_0x153577=0xce;}_0x1fb7a8[_0xd668('0x1b')](_0x153577);return _0x1fb7a8['set'](_0xd668('0x1f'),_0x6bd9f2+'-'+_0x22663b+'/'+_0x62a051)[_0xd668('0x1d')](_0x31b30b);}return null;};}function patchUpdates(_0x415abe){return function(_0x8f0b5b){try{jsonpatch['apply'](_0x8f0b5b,_0x415abe,!![]);}catch(_0x3b50d8){return BPromise[_0xd668('0x20')](_0x3b50d8);}return _0x8f0b5b[_0xd668('0x21')]();};}function saveUpdates(_0x2ff77c,_0x2b1c15){return function(_0x35cae1){if(_0x35cae1){return _0x35cae1[_0xd668('0x22')](_0x2ff77c)['then'](function(_0xb9304e){return _0xb9304e;});}return null;};}function removeEntity(_0x2937c3,_0x35c7fd){return function(_0x18560c){if(_0x18560c){return _0x18560c[_0xd668('0x23')]()[_0xd668('0x24')](function(){var _0x448d1e=_0x18560c['get']({'plain':!![]});var _0x2d2593='Pauses';return db[_0xd668('0x25')][_0xd668('0x23')]({'where':{'type':_0x2d2593,'resourceId':_0x448d1e['id']}})[_0xd668('0x24')](function(){return _0x18560c;});})['then'](function(){_0x2937c3[_0xd668('0x1b')](0xcc)[_0xd668('0x1c')]();});}};}function handleEntityNotFound(_0x2164fd,_0x17a67d){return function(_0x438139){if(!_0x438139){_0x2164fd[_0xd668('0x1a')](0x194);}return _0x438139;};}function handleError(_0x2556a8,_0xa4b68f){_0xa4b68f=_0xa4b68f||0x1f4;return function(_0x182083){logger[_0xd668('0x26')](_0x182083['stack']);if(_0x182083[_0xd668('0x27')]){delete _0x182083[_0xd668('0x27')];}_0x2556a8['status'](_0xa4b68f)['send'](_0x182083);};}exports[_0xd668('0x28')]=function(_0x4cdfb9,_0x5c57c7){var _0x5d50c0={},_0x37e53f={},_0x6e170={'count':0x0,'rows':[]};var _0x2edc5c=_['map'](db[_0xd668('0x29')][_0xd668('0x2a')],function(_0x201ce3){return{'name':_0x201ce3[_0xd668('0x2b')],'type':_0x201ce3['type'][_0xd668('0x2c')]};});_0x37e53f[_0xd668('0x2d')]=_['map'](_0x2edc5c,_0xd668('0x27'));_0x37e53f[_0xd668('0x2e')]=_['keys'](_0x4cdfb9[_0xd668('0x2e')]);_0x37e53f[_0xd668('0x2f')]=_[_0xd668('0x30')](_0x37e53f[_0xd668('0x2d')],_0x37e53f[_0xd668('0x2e')]);_0x5d50c0[_0xd668('0x31')]=_[_0xd668('0x30')](_0x37e53f[_0xd668('0x2d')],qs['fields'](_0x4cdfb9['query'][_0xd668('0x32')]));_0x5d50c0[_0xd668('0x31')]=_0x5d50c0[_0xd668('0x31')][_0xd668('0x33')]?_0x5d50c0[_0xd668('0x31')]:_0x37e53f[_0xd668('0x2d')];if(!_0x4cdfb9['query'][_0xd668('0x34')](_0xd668('0x35'))){_0x5d50c0[_0xd668('0x36')]=qs[_0xd668('0x36')](_0x4cdfb9['query'][_0xd668('0x36')]);_0x5d50c0[_0xd668('0x1e')]=qs[_0xd668('0x1e')](_0x4cdfb9[_0xd668('0x2e')][_0xd668('0x1e')]);}_0x5d50c0[_0xd668('0x37')]=qs[_0xd668('0x38')](_0x4cdfb9['query'][_0xd668('0x38')]);_0x5d50c0[_0xd668('0x39')]=qs[_0xd668('0x2f')](_['pick'](_0x4cdfb9[_0xd668('0x2e')],_0x37e53f['filters']),_0x2edc5c);if(_0x4cdfb9[_0xd668('0x2e')][_0xd668('0x3a')]){_0x5d50c0['where']=_[_0xd668('0x3b')](_0x5d50c0['where'],{'$or':_[_0xd668('0x3c')](_0x2edc5c,function(_0x30f8c0){if(_0x30f8c0['type']!=='VIRTUAL'){var _0x43787e={};_0x43787e[_0x30f8c0[_0xd668('0x27')]]={'$like':'%'+_0x4cdfb9['query']['filter']+'%'};return _0x43787e;}})});}_0x5d50c0=_[_0xd668('0x3b')]({},_0x5d50c0,_0x4cdfb9[_0xd668('0x3d')]);var _0xb7b6ce={'where':_0x5d50c0[_0xd668('0x39')]};return db[_0xd668('0x29')][_0xd668('0x3e')](_0xb7b6ce)[_0xd668('0x24')](function(_0x5431b5){_0x6e170[_0xd668('0x3e')]=_0x5431b5;if(_0x4cdfb9[_0xd668('0x2e')][_0xd668('0x3f')]){_0x5d50c0['include']=[{'all':!![]}];}return db[_0xd668('0x29')][_0xd668('0x40')](_0x5d50c0);})[_0xd668('0x24')](function(_0x5c62a8){_0x6e170[_0xd668('0x41')]=_0x5c62a8;return _0x6e170;})[_0xd668('0x24')](respondWithFilteredResult(_0x5c57c7,_0x5d50c0))[_0xd668('0x42')](handleError(_0x5c57c7,null));};exports[_0xd668('0x43')]=function(_0x310999,_0x4b6965){var _0x3ebccc={'raw':!![],'where':{'id':_0x310999['params']['id']}},_0x565ad6={};_0x565ad6[_0xd668('0x2d')]=_[_0xd668('0x44')](db[_0xd668('0x29')][_0xd668('0x2a')]);_0x565ad6[_0xd668('0x2e')]=_['keys'](_0x310999[_0xd668('0x2e')]);_0x565ad6[_0xd668('0x2f')]=_[_0xd668('0x30')](_0x565ad6[_0xd668('0x2d')],_0x565ad6[_0xd668('0x2e')]);_0x3ebccc[_0xd668('0x31')]=_[_0xd668('0x30')](_0x565ad6[_0xd668('0x2d')],qs[_0xd668('0x32')](_0x310999[_0xd668('0x2e')][_0xd668('0x32')]));_0x3ebccc[_0xd668('0x31')]=_0x3ebccc[_0xd668('0x31')]['length']?_0x3ebccc['attributes']:_0x565ad6[_0xd668('0x2d')];if(_0x310999['query']['includeAll']){_0x3ebccc['include']=[{'all':!![]}];}_0x3ebccc=_['merge']({},_0x3ebccc,_0x310999[_0xd668('0x3d')]);return db[_0xd668('0x29')][_0xd668('0x45')](_0x3ebccc)['then'](handleEntityNotFound(_0x4b6965,null))[_0xd668('0x24')](respondWithResult(_0x4b6965,null))['catch'](handleError(_0x4b6965,null));};exports[_0xd668('0x46')]=function(_0x1d9cc5,_0x1baa42){return db[_0xd668('0x29')]['create'](_0x1d9cc5[_0xd668('0x47')],{})['then'](function(_0x3eeb0e){var _0x560c57=_0x1d9cc5['user'][_0xd668('0x48')]({'plain':!![]});if(!_0x560c57)throw new Error(_0xd668('0x49'));if(_0x560c57[_0xd668('0x4a')]===_0xd668('0x4b')){var _0x31ef44=_0x3eeb0e['get']({'plain':!![]});var _0x4d20bf='Pauses';return db['UserProfileSection'][_0xd668('0x45')]({'where':{'name':_0x4d20bf,'userProfileId':_0x560c57[_0xd668('0x4c')]},'raw':!![]})[_0xd668('0x24')](function(_0x146b67){if(_0x146b67&&_0x146b67[_0xd668('0x4d')]===0x0){return db[_0xd668('0x25')]['create']({'name':_0x31ef44[_0xd668('0x27')],'resourceId':_0x31ef44['id'],'type':_0x146b67[_0xd668('0x27')],'sectionId':_0x146b67['id']},{})['then'](function(){return _0x3eeb0e;});}else{return _0x3eeb0e;}})[_0xd668('0x42')](function(_0x21b20d){logger['error'](_0xd668('0x4e'),_0x21b20d);throw _0x21b20d;});}return _0x3eeb0e;})['then'](respondWithResult(_0x1baa42,0xc9))[_0xd668('0x42')](handleError(_0x1baa42,null));};exports['update']=function(_0x5020cb,_0xce01a9){if(_0x5020cb[_0xd668('0x47')]['id']){delete _0x5020cb[_0xd668('0x47')]['id'];}return db['Pause'][_0xd668('0x45')]({'where':{'id':_0x5020cb[_0xd668('0x4f')]['id']}})[_0xd668('0x24')](handleEntityNotFound(_0xce01a9,null))[_0xd668('0x24')](saveUpdates(_0x5020cb[_0xd668('0x47')],null))[_0xd668('0x24')](respondWithResult(_0xce01a9,null))['catch'](handleError(_0xce01a9,null));};exports[_0xd668('0x23')]=function(_0x1a1636,_0x1ca735){return db['Pause']['find']({'where':{'id':_0x1a1636[_0xd668('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ca735,null))['then'](removeEntity(_0x1ca735,null))[_0xd668('0x42')](handleError(_0x1ca735,null));}; \ No newline at end of file +var _0x4e7f=['path','to-csv','ejs','lodash','squel','crypto','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','json','count','offset','Content-Range','apply','reject','save','destroy','then','get','Pauses','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e7f,0x1eb));var _0xf4e7=function(_0xb2454d,_0x291753){_0xb2454d=_0xb2454d-0x0;var _0x5464fb=_0x4e7f[_0xb2454d];return _0x5464fb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf4e7('0x0'));var rimraf=require(_0xf4e7('0x1'));var zipdir=require(_0xf4e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf4e7('0x3'));var BPromise=require(_0xf4e7('0x4'));var Mustache=require(_0xf4e7('0x5'));var util=require(_0xf4e7('0x6'));var path=require(_0xf4e7('0x7'));var sox=require('sox');var csv=require(_0xf4e7('0x8'));var ejs=require(_0xf4e7('0x9'));var fs=require('fs');var _=require(_0xf4e7('0xa'));var squel=require(_0xf4e7('0xb'));var crypto=require(_0xf4e7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4e7('0xd'));var Papa=require(_0xf4e7('0xe'));var Redis=require('ioredis');var authService=require(_0xf4e7('0xf'));var qs=require(_0xf4e7('0x10'));var as=require(_0xf4e7('0x11'));var hardwareService=require(_0xf4e7('0x12'));var logger=require(_0xf4e7('0x13'))(_0xf4e7('0x14'));var utils=require('../../config/utils');var config=require(_0xf4e7('0x15'));var licenseUtil=require(_0xf4e7('0x16'));var db=require(_0xf4e7('0x17'))['db'];function respondWithStatusCode(_0x2c44a4,_0x5718f2){_0x5718f2=_0x5718f2||0xcc;return function(_0x139b26){if(_0x139b26){return _0x2c44a4[_0xf4e7('0x18')](_0x5718f2);}return _0x2c44a4[_0xf4e7('0x19')](_0x5718f2)[_0xf4e7('0x1a')]();};}function respondWithResult(_0x4a8c41,_0x3f57e2){_0x3f57e2=_0x3f57e2||0xc8;return function(_0x191a7){if(_0x191a7){return _0x4a8c41[_0xf4e7('0x19')](_0x3f57e2)[_0xf4e7('0x1b')](_0x191a7);}};}function respondWithFilteredResult(_0x45f82e,_0x4231ee){return function(_0x599a88){if(_0x599a88){var _0xed8f83=_0x599a88[_0xf4e7('0x1c')],_0x5cdd54=_0x4231ee[_0xf4e7('0x1d')],_0x5c8330=_0x4231ee[_0xf4e7('0x1d')]+_0x4231ee['limit'],_0x3ebc42;if(_0x5c8330>=_0xed8f83){_0x5c8330=_0xed8f83;_0x3ebc42=0xc8;}else{_0x3ebc42=0xce;}_0x45f82e[_0xf4e7('0x19')](_0x3ebc42);return _0x45f82e['set'](_0xf4e7('0x1e'),_0x5cdd54+'-'+_0x5c8330+'/'+_0xed8f83)[_0xf4e7('0x1b')](_0x599a88);}return null;};}function patchUpdates(_0x7a36ab){return function(_0x1d4974){try{jsonpatch[_0xf4e7('0x1f')](_0x1d4974,_0x7a36ab,!![]);}catch(_0x2a899c){return BPromise[_0xf4e7('0x20')](_0x2a899c);}return _0x1d4974[_0xf4e7('0x21')]();};}function saveUpdates(_0x4cacf0,_0x413d9b){return function(_0x265225){if(_0x265225){return _0x265225['update'](_0x4cacf0)['then'](function(_0x40bbc8){return _0x40bbc8;});}return null;};}function removeEntity(_0x2c6592,_0x4188ed){return function(_0x3cf66b){if(_0x3cf66b){return _0x3cf66b[_0xf4e7('0x22')]()[_0xf4e7('0x23')](function(){var _0x1418b7=_0x3cf66b[_0xf4e7('0x24')]({'plain':!![]});var _0x2697c1=_0xf4e7('0x25');return db[_0xf4e7('0x26')][_0xf4e7('0x22')]({'where':{'type':_0x2697c1,'resourceId':_0x1418b7['id']}})[_0xf4e7('0x23')](function(){return _0x3cf66b;});})[_0xf4e7('0x23')](function(){_0x2c6592[_0xf4e7('0x19')](0xcc)[_0xf4e7('0x1a')]();});}};}function handleEntityNotFound(_0x943f19,_0x36b674){return function(_0xdc40b8){if(!_0xdc40b8){_0x943f19[_0xf4e7('0x18')](0x194);}return _0xdc40b8;};}function handleError(_0x3960f4,_0x1a4bda){_0x1a4bda=_0x1a4bda||0x1f4;return function(_0x459835){logger['error'](_0x459835['stack']);if(_0x459835[_0xf4e7('0x27')]){delete _0x459835[_0xf4e7('0x27')];}_0x3960f4[_0xf4e7('0x19')](_0x1a4bda)[_0xf4e7('0x28')](_0x459835);};}exports[_0xf4e7('0x29')]=function(_0x491e0c,_0x3b5520){var _0x138e47={},_0x1b944f={},_0x13412d={'count':0x0,'rows':[]};var _0x5cfc7e=_[_0xf4e7('0x2a')](db[_0xf4e7('0x2b')][_0xf4e7('0x2c')],function(_0x5eb74d){return{'name':_0x5eb74d[_0xf4e7('0x2d')],'type':_0x5eb74d[_0xf4e7('0x2e')][_0xf4e7('0x2f')]};});_0x1b944f['model']=_['map'](_0x5cfc7e,_0xf4e7('0x27'));_0x1b944f['query']=_[_0xf4e7('0x30')](_0x491e0c[_0xf4e7('0x31')]);_0x1b944f['filters']=_[_0xf4e7('0x32')](_0x1b944f[_0xf4e7('0x33')],_0x1b944f[_0xf4e7('0x31')]);_0x138e47[_0xf4e7('0x34')]=_[_0xf4e7('0x32')](_0x1b944f[_0xf4e7('0x33')],qs[_0xf4e7('0x35')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x35')]));_0x138e47['attributes']=_0x138e47[_0xf4e7('0x34')]['length']?_0x138e47[_0xf4e7('0x34')]:_0x1b944f[_0xf4e7('0x33')];if(!_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x36')](_0xf4e7('0x37'))){_0x138e47['limit']=qs[_0xf4e7('0x38')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x38')]);_0x138e47[_0xf4e7('0x1d')]=qs[_0xf4e7('0x1d')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x1d')]);}_0x138e47[_0xf4e7('0x39')]=qs[_0xf4e7('0x3a')](_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x3a')]);_0x138e47[_0xf4e7('0x3b')]=qs[_0xf4e7('0x3c')](_['pick'](_0x491e0c[_0xf4e7('0x31')],_0x1b944f[_0xf4e7('0x3c')]),_0x5cfc7e);if(_0x491e0c['query'][_0xf4e7('0x3d')]){_0x138e47[_0xf4e7('0x3b')]=_[_0xf4e7('0x3e')](_0x138e47[_0xf4e7('0x3b')],{'$or':_[_0xf4e7('0x2a')](_0x5cfc7e,function(_0x1f9e22){if(_0x1f9e22[_0xf4e7('0x2e')]!==_0xf4e7('0x3f')){var _0x288b97={};_0x288b97[_0x1f9e22[_0xf4e7('0x27')]]={'$like':'%'+_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x3d')]+'%'};return _0x288b97;}})});}_0x138e47=_[_0xf4e7('0x3e')]({},_0x138e47,_0x491e0c['options']);var _0x209648={'where':_0x138e47[_0xf4e7('0x3b')]};return db[_0xf4e7('0x2b')][_0xf4e7('0x1c')](_0x209648)[_0xf4e7('0x23')](function(_0x52505e){_0x13412d['count']=_0x52505e;if(_0x491e0c[_0xf4e7('0x31')][_0xf4e7('0x40')]){_0x138e47['include']=[{'all':!![]}];}return db[_0xf4e7('0x2b')][_0xf4e7('0x41')](_0x138e47);})[_0xf4e7('0x23')](function(_0x147a3e){_0x13412d[_0xf4e7('0x42')]=_0x147a3e;return _0x13412d;})['then'](respondWithFilteredResult(_0x3b5520,_0x138e47))['catch'](handleError(_0x3b5520,null));};exports[_0xf4e7('0x43')]=function(_0x52f010,_0x1e1a20){var _0x291b17={'raw':!![],'where':{'id':_0x52f010[_0xf4e7('0x44')]['id']}},_0x256c3f={};_0x256c3f[_0xf4e7('0x33')]=_[_0xf4e7('0x30')](db[_0xf4e7('0x2b')][_0xf4e7('0x2c')]);_0x256c3f[_0xf4e7('0x31')]=_['keys'](_0x52f010[_0xf4e7('0x31')]);_0x256c3f[_0xf4e7('0x3c')]=_['intersection'](_0x256c3f[_0xf4e7('0x33')],_0x256c3f[_0xf4e7('0x31')]);_0x291b17[_0xf4e7('0x34')]=_[_0xf4e7('0x32')](_0x256c3f[_0xf4e7('0x33')],qs[_0xf4e7('0x35')](_0x52f010['query'][_0xf4e7('0x35')]));_0x291b17[_0xf4e7('0x34')]=_0x291b17[_0xf4e7('0x34')][_0xf4e7('0x45')]?_0x291b17[_0xf4e7('0x34')]:_0x256c3f[_0xf4e7('0x33')];if(_0x52f010[_0xf4e7('0x31')][_0xf4e7('0x40')]){_0x291b17[_0xf4e7('0x46')]=[{'all':!![]}];}_0x291b17=_[_0xf4e7('0x3e')]({},_0x291b17,_0x52f010[_0xf4e7('0x47')]);return db[_0xf4e7('0x2b')][_0xf4e7('0x48')](_0x291b17)[_0xf4e7('0x23')](handleEntityNotFound(_0x1e1a20,null))[_0xf4e7('0x23')](respondWithResult(_0x1e1a20,null))['catch'](handleError(_0x1e1a20,null));};exports[_0xf4e7('0x49')]=function(_0x140065,_0x245e57){return db['Pause'][_0xf4e7('0x49')](_0x140065[_0xf4e7('0x4a')],{})[_0xf4e7('0x23')](function(_0x23629e){var _0x1e2282=_0x140065[_0xf4e7('0x4b')]['get']({'plain':!![]});if(!_0x1e2282)throw new Error(_0xf4e7('0x4c'));if(_0x1e2282[_0xf4e7('0x4d')]==='user'){var _0x4e0478=_0x23629e[_0xf4e7('0x24')]({'plain':!![]});var _0x2dff0a='Pauses';return db['UserProfileSection'][_0xf4e7('0x48')]({'where':{'name':_0x2dff0a,'userProfileId':_0x1e2282[_0xf4e7('0x4e')]},'raw':!![]})[_0xf4e7('0x23')](function(_0x93b685){if(_0x93b685&&_0x93b685['autoAssociation']===0x0){return db[_0xf4e7('0x26')][_0xf4e7('0x49')]({'name':_0x4e0478[_0xf4e7('0x27')],'resourceId':_0x4e0478['id'],'type':_0x93b685['name'],'sectionId':_0x93b685['id']},{})[_0xf4e7('0x23')](function(){return _0x23629e;});}else{return _0x23629e;}})[_0xf4e7('0x4f')](function(_0x560a18){logger[_0xf4e7('0x50')](_0xf4e7('0x51'),_0x560a18);throw _0x560a18;});}return _0x23629e;})[_0xf4e7('0x23')](respondWithResult(_0x245e57,0xc9))['catch'](handleError(_0x245e57,null));};exports[_0xf4e7('0x52')]=function(_0x2a3883,_0x5239d9){if(_0x2a3883[_0xf4e7('0x4a')]['id']){delete _0x2a3883[_0xf4e7('0x4a')]['id'];}return db[_0xf4e7('0x2b')][_0xf4e7('0x48')]({'where':{'id':_0x2a3883[_0xf4e7('0x44')]['id']}})[_0xf4e7('0x23')](handleEntityNotFound(_0x5239d9,null))['then'](saveUpdates(_0x2a3883[_0xf4e7('0x4a')],null))[_0xf4e7('0x23')](respondWithResult(_0x5239d9,null))['catch'](handleError(_0x5239d9,null));};exports[_0xf4e7('0x22')]=function(_0x28be22,_0x453f6c){return db['Pause'][_0xf4e7('0x48')]({'where':{'id':_0x28be22[_0xf4e7('0x44')]['id']}})[_0xf4e7('0x23')](handleEntityNotFound(_0x453f6c,null))[_0xf4e7('0x23')](removeEntity(_0x453f6c,null))['catch'](handleError(_0x453f6c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0c36089..7ef3bc1 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ed9=['moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','define','Pause','tools_pauses','lodash','util','api'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5ed9[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var logger=require('../../config/logger')(_0x95ed('0x2'));var moment=require(_0x95ed('0x3'));var BPromise=require(_0x95ed('0x4'));var rp=require(_0x95ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95ed('0x6'));var config=require(_0x95ed('0x7'));var attributes=require(_0x95ed('0x8'));module['exports']=function(_0x2c9009,_0x5a5117){return _0x2c9009[_0x95ed('0x9')](_0x95ed('0xa'),attributes,{'tableName':_0x95ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf79e=['../../config/logger','api','bluebird','request-promise','../../config/environment','./pause.attributes','exports','define','tools_pauses','util'];(function(_0x10a951,_0x5da875){var _0x6da0d=function(_0x249416){while(--_0x249416){_0x10a951['push'](_0x10a951['shift']());}};_0x6da0d(++_0x5da875);}(_0xf79e,0x185));var _0xef79=function(_0x22aab7,_0x368f0f){_0x22aab7=_0x22aab7-0x0;var _0x42f7ea=_0xf79e[_0x22aab7];return _0x42f7ea;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));module[_0xef79('0x7')]=function(_0x22b3c2,_0x396c51){return _0x22b3c2[_0xef79('0x8')]('Pause',attributes,{'tableName':_0xef79('0x9'),'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 68d26b2..dffaed7 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 _0x897d=['find','options','where','attributes','map','include','model','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowPause','Pause'];(function(_0x4239c8,_0x2c0c6e){var _0x40323b=function(_0x598d03){while(--_0x598d03){_0x4239c8['push'](_0x4239c8['shift']());}};_0x40323b(++_0x2c0c6e);}(_0x897d,0x1ca));var _0xd897=function(_0x34870c,_0x57435c){_0x34870c=_0x34870c-0x0;var _0x3315a9=_0x897d[_0x34870c];return _0x3315a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd897('0x0'));var BPromise=require(_0xd897('0x1'));var rs=require(_0xd897('0x2'));var fs=require('fs');var Redis=require(_0xd897('0x3'));var db=require(_0xd897('0x4'))['db'];var utils=require(_0xd897('0x5'));var logger=require(_0xd897('0x6'))(_0xd897('0x7'));var config=require(_0xd897('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd897('0x9')][_0xd897('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dbfaa,_0x294235,_0x74e183){return new BPromise(function(_0x8ae91f,_0x328ed0){return client['request'](_0x2dbfaa,_0x74e183)['then'](function(_0x48a113){logger['info'](_0xd897('0xb'),_0x294235,_0xd897('0xc'));logger[_0xd897('0xd')](_0xd897('0xe'),_0x294235,_0xd897('0xc'),JSON['stringify'](_0x48a113));if(_0x48a113[_0xd897('0xf')]){if(_0x48a113['error'][_0xd897('0x10')]===0x1f4){logger[_0xd897('0xf')](_0xd897('0xb'),_0x294235,_0x48a113['error'][_0xd897('0x11')]);return _0x328ed0(_0x48a113[_0xd897('0xf')][_0xd897('0x11')]);}logger[_0xd897('0xf')](_0xd897('0xb'),_0x294235,_0x48a113[_0xd897('0xf')]['message']);return _0x8ae91f(_0x48a113[_0xd897('0xf')][_0xd897('0x11')]);}else{logger[_0xd897('0x12')]('Pause,\x20%s,\x20%s',_0x294235,_0xd897('0xc'));_0x8ae91f(_0x48a113[_0xd897('0x13')]['message']);}})['catch'](function(_0x2a75ed){logger[_0xd897('0xf')](_0xd897('0xb'),_0x294235,_0x2a75ed);_0x328ed0(_0x2a75ed);});});}exports[_0xd897('0x14')]=function(_0x3a254c){var _0x499148=this;return new Promise(function(_0x4b5f34,_0x362db6){return db[_0xd897('0x15')][_0xd897('0x16')]({'raw':_0x3a254c[_0xd897('0x17')]?_0x3a254c[_0xd897('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3a254c[_0xd897('0x17')]?_0x3a254c['options'][_0xd897('0x18')]||null:null,'attributes':_0x3a254c[_0xd897('0x17')]?_0x3a254c[_0xd897('0x17')][_0xd897('0x19')]||null:null,'include':_0x3a254c[_0xd897('0x17')]?_0x3a254c['options']['include']?_[_0xd897('0x1a')](_0x3a254c[_0xd897('0x17')][_0xd897('0x1b')],function(_0x2af696){return{'model':db[_0x2af696[_0xd897('0x1c')]],'as':_0x2af696['as'],'attributes':_0x2af696[_0xd897('0x19')],'include':_0x2af696[_0xd897('0x1b')]?_[_0xd897('0x1a')](_0x2af696[_0xd897('0x1b')],function(_0x321b29){return{'model':db[_0x321b29[_0xd897('0x1c')]],'as':_0x321b29['as'],'attributes':_0x321b29[_0xd897('0x19')],'include':_0x321b29[_0xd897('0x1b')]?_[_0xd897('0x1a')](_0x321b29[_0xd897('0x1b')],function(_0x42ec8b){return{'model':db[_0x42ec8b[_0xd897('0x1c')]],'as':_0x42ec8b['as'],'attributes':_0x42ec8b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2700cb){logger[_0xd897('0x12')](_0xd897('0x14'),_0x3a254c);logger[_0xd897('0xd')](_0xd897('0x14'),_0x3a254c,JSON['stringify'](_0x2700cb));_0x4b5f34(_0x2700cb);})[_0xd897('0x1d')](function(_0x2ea413){logger['error'](_0xd897('0x14'),_0x2ea413['message'],_0x3a254c);_0x362db6(_0x499148[_0xd897('0xf')](0x1f4,_0x2ea413[_0xd897('0x11')]));});});}; \ No newline at end of file +var _0xf9f4=['Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','debug'];(function(_0xda5612,_0x5391df){var _0x38c7a8=function(_0x4fcaa6){while(--_0x4fcaa6){_0xda5612['push'](_0xda5612['shift']());}};_0x38c7a8(++_0x5391df);}(_0xf9f4,0x1be));var _0x4f9f=function(_0x3c098b,_0x5e88b8){_0x3c098b=_0x3c098b-0x0;var _0x2541d4=_0xf9f4[_0x3c098b];return _0x2541d4;};'use strict';var _=require(_0x4f9f('0x0'));var util=require(_0x4f9f('0x1'));var moment=require(_0x4f9f('0x2'));var BPromise=require(_0x4f9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f9f('0x5'));var logger=require(_0x4f9f('0x6'))('rpc');var config=require(_0x4f9f('0x7'));var jayson=require(_0x4f9f('0x8'));var client=jayson[_0x4f9f('0x9')][_0x4f9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ffa30,_0x4695a4,_0x3443be){return new BPromise(function(_0x95c0a7,_0x538b2a){return client[_0x4f9f('0xb')](_0x3ffa30,_0x3443be)[_0x4f9f('0xc')](function(_0x21aac2){logger[_0x4f9f('0xd')](_0x4f9f('0xe'),_0x4695a4,'request\x20sent');logger[_0x4f9f('0xf')](_0x4f9f('0x10'),_0x4695a4,_0x4f9f('0x11'),JSON['stringify'](_0x21aac2));if(_0x21aac2[_0x4f9f('0x12')]){if(_0x21aac2[_0x4f9f('0x12')]['code']===0x1f4){logger[_0x4f9f('0x12')]('Pause,\x20%s,\x20%s',_0x4695a4,_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);return _0x538b2a(_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);}logger[_0x4f9f('0x12')](_0x4f9f('0xe'),_0x4695a4,_0x21aac2['error'][_0x4f9f('0x13')]);return _0x95c0a7(_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);}else{logger[_0x4f9f('0xd')](_0x4f9f('0xe'),_0x4695a4,_0x4f9f('0x11'));_0x95c0a7(_0x21aac2[_0x4f9f('0x14')][_0x4f9f('0x13')]);}})[_0x4f9f('0x15')](function(_0x4cf8b2){logger[_0x4f9f('0x12')](_0x4f9f('0xe'),_0x4695a4,_0x4cf8b2);_0x538b2a(_0x4cf8b2);});});}exports[_0x4f9f('0x16')]=function(_0x537097){var _0x1b9538=this;return new Promise(function(_0x5b1f43,_0x516ffc){return db[_0x4f9f('0x17')][_0x4f9f('0x18')]({'raw':_0x537097[_0x4f9f('0x19')]?_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1a')]===undefined?!![]:![]:!![],'where':_0x537097[_0x4f9f('0x19')]?_0x537097['options'][_0x4f9f('0x1b')]||null:null,'attributes':_0x537097[_0x4f9f('0x19')]?_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1c')]||null:null,'include':_0x537097[_0x4f9f('0x19')]?_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1d')]?_[_0x4f9f('0x1e')](_0x537097[_0x4f9f('0x19')][_0x4f9f('0x1d')],function(_0xcd1f45){return{'model':db[_0xcd1f45[_0x4f9f('0x1f')]],'as':_0xcd1f45['as'],'attributes':_0xcd1f45['attributes'],'include':_0xcd1f45[_0x4f9f('0x1d')]?_[_0x4f9f('0x1e')](_0xcd1f45[_0x4f9f('0x1d')],function(_0x34df85){return{'model':db[_0x34df85[_0x4f9f('0x1f')]],'as':_0x34df85['as'],'attributes':_0x34df85[_0x4f9f('0x1c')],'include':_0x34df85[_0x4f9f('0x1d')]?_[_0x4f9f('0x1e')](_0x34df85[_0x4f9f('0x1d')],function(_0x21e756){return{'model':db[_0x21e756[_0x4f9f('0x1f')]],'as':_0x21e756['as'],'attributes':_0x21e756[_0x4f9f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4f9f('0xc')](function(_0x18cc3c){logger[_0x4f9f('0xd')](_0x4f9f('0x16'),_0x537097);logger[_0x4f9f('0xf')](_0x4f9f('0x16'),_0x537097,JSON[_0x4f9f('0x20')](_0x18cc3c));_0x5b1f43(_0x18cc3c);})[_0x4f9f('0x15')](function(_0xe9b1a4){logger[_0x4f9f('0x12')](_0x4f9f('0x16'),_0xe9b1a4[_0x4f9f('0x13')],_0x537097);_0x516ffc(_0x1b9538['error'](0x1f4,_0xe9b1a4['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 58df7f3..a9d3f8d 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 _0x3542=['../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x57255b,_0x48f42c){var _0x5a8ab0=function(_0x38a7ad){while(--_0x38a7ad){_0x57255b['push'](_0x57255b['shift']());}};_0x5a8ab0(++_0x48f42c);}(_0x3542,0x158));var _0x2354=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x3542[_0xef4cf0];return _0x497ad2;};'use strict';var multer=require(_0x2354('0x0'));var util=require(_0x2354('0x1'));var path=require(_0x2354('0x2'));var timeout=require(_0x2354('0x3'));var express=require(_0x2354('0x4'));var router=express[_0x2354('0x5')]();var auth=require(_0x2354('0x6'));var interaction=require(_0x2354('0x7'));var config=require(_0x2354('0x8'));var controller=require(_0x2354('0x9'));router[_0x2354('0xa')]('/',auth[_0x2354('0xb')](),controller['index']);router[_0x2354('0xa')](_0x2354('0xc'),controller[_0x2354('0xd')]);router[_0x2354('0xa')](_0x2354('0xe'),auth[_0x2354('0xb')](),controller['show']);router[_0x2354('0xa')]('/:id/download',auth[_0x2354('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x2354('0xf')]({'destination':function(_0x2b406c,_0x18abbf,_0xf2cead){_0xf2cead(null,path['join'](config[_0x2354('0x10')],_0x2354('0x11')));},'filename':function(_0x55bff7,_0x207f2d,_0x286d30){_0x207f2d[_0x2354('0x12')]=_0x207f2d[_0x2354('0x12')][_0x2354('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x286d30(null,util['format'](_0x2354('0x14'),path[_0x2354('0x15')](_0x207f2d['originalname'],path[_0x2354('0x16')](_0x207f2d[_0x2354('0x12')])),Date['now'](),path[_0x2354('0x16')](_0x207f2d[_0x2354('0x12')])));}})});router['post']('/',upload[_0x2354('0x17')](_0x2354('0x18')),controller[_0x2354('0x19')]);router[_0x2354('0x1a')](_0x2354('0xc'),controller[_0x2354('0x1b')]);router[_0x2354('0x1c')]('/:id',auth[_0x2354('0xb')](),controller[_0x2354('0x1d')]);router[_0x2354('0x1e')](_0x2354('0xe'),auth['isAuthenticated'](),controller[_0x2354('0x1e')]);module[_0x2354('0x1f')]=router; \ No newline at end of file +var _0xbc7c=['/webhook','webhookGet','/:id','show','/:id/download','isAuthenticated','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbc7c,0xbb));var _0xcbc7=function(_0x5c1ddc,_0x587040){_0x5c1ddc=_0x5c1ddc-0x0;var _0x542a11=_0xbc7c[_0x5c1ddc];return _0x542a11;};'use strict';var multer=require(_0xcbc7('0x0'));var util=require(_0xcbc7('0x1'));var path=require(_0xcbc7('0x2'));var timeout=require(_0xcbc7('0x3'));var express=require(_0xcbc7('0x4'));var router=express[_0xcbc7('0x5')]();var auth=require(_0xcbc7('0x6'));var interaction=require(_0xcbc7('0x7'));var config=require('../../config/environment');var controller=require(_0xcbc7('0x8'));router[_0xcbc7('0x9')]('/',auth['isAuthenticated'](),controller[_0xcbc7('0xa')]);router[_0xcbc7('0x9')](_0xcbc7('0xb'),controller[_0xcbc7('0xc')]);router[_0xcbc7('0x9')](_0xcbc7('0xd'),auth['isAuthenticated'](),controller[_0xcbc7('0xe')]);router[_0xcbc7('0x9')](_0xcbc7('0xf'),auth[_0xcbc7('0x10')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x54c769,_0x4ddda8,_0x543c4d){_0x543c4d(null,path['join'](config[_0xcbc7('0x11')],_0xcbc7('0x12')));},'filename':function(_0x2dcc2e,_0x9367b8,_0x1aa124){_0x9367b8[_0xcbc7('0x13')]=_0x9367b8[_0xcbc7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1aa124(null,util[_0xcbc7('0x14')](_0xcbc7('0x15'),path[_0xcbc7('0x16')](_0x9367b8[_0xcbc7('0x13')],path['extname'](_0x9367b8[_0xcbc7('0x13')])),Date['now'](),path[_0xcbc7('0x17')](_0x9367b8[_0xcbc7('0x13')])));}})});router['post']('/',upload[_0xcbc7('0x18')](_0xcbc7('0x19')),controller[_0xcbc7('0x1a')]);router[_0xcbc7('0x1b')](_0xcbc7('0xb'),controller[_0xcbc7('0x1c')]);router[_0xcbc7('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xcbc7('0x1e')]);router[_0xcbc7('0x1f')](_0xcbc7('0xd'),auth[_0xcbc7('0x10')](),controller[_0xcbc7('0x1f')]);module[_0xcbc7('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 74823a8..2f7a696 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 _0x4284=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4284,0x7d));var _0x4428=function(_0x487788,_0x69aae1){_0x487788=_0x487788-0x0;var _0x5cbcfa=_0x4284[_0x487788];return _0x5cbcfa;};'use strict';var Sequelize=require(_0x4428('0x0'));module[_0x4428('0x1')]={'name':{'type':Sequelize[_0x4428('0x2')]},'type':{'type':Sequelize[_0x4428('0x3')]('html',_0x4428('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4428('0x5')]},'path':{'type':Sequelize[_0x4428('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4428('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x4428('0x7'),_0x4428('0x8'),_0x4428('0x9'),_0x4428('0xa')),'defaultValue':_0x4428('0x9'),'comment':_0x4428('0xb')},'icon':{'type':Sequelize[_0x4428('0x2')]},'adminUrl':{'type':Sequelize[_0x4428('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4428('0x2')]},'scriptPath':{'type':Sequelize[_0x4428('0x2')]}}; \ No newline at end of file +var _0x2b2f=['never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x8d20cd,_0x14458b){var _0x1d30d4=function(_0x72a016){while(--_0x72a016){_0x8d20cd['push'](_0x8d20cd['shift']());}};_0x1d30d4(++_0x14458b);}(_0x2b2f,0x137));var _0xf2b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2b2f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf2b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2b2('0x1')]},'type':{'type':Sequelize[_0xf2b2('0x2')]('html','script')},'description':{'type':Sequelize[_0xf2b2('0x3')]},'version':{'type':Sequelize[_0xf2b2('0x3')]},'path':{'type':Sequelize[_0xf2b2('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf2b2('0x4')],'defaultValue':0x0,'comment':_0xf2b2('0x5')},'sidebar':{'type':Sequelize[_0xf2b2('0x2')](_0xf2b2('0x6'),_0xf2b2('0x7'),'always',_0xf2b2('0x8')),'defaultValue':_0xf2b2('0x9'),'comment':_0xf2b2('0xa')},'icon':{'type':Sequelize[_0xf2b2('0x1')]},'adminUrl':{'type':Sequelize[_0xf2b2('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xf2b2('0x1')]},'scriptPath':{'type':Sequelize[_0xf2b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f76462c..23efa84 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 _0x66e3=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','model','find','server/files/plugins','format','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','join','basename','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','catch','upload','filename','extname','root','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','extract-zip'];(function(_0x54750e,_0x59ccdb){var _0x568a1e=function(_0x425e11){while(--_0x425e11){_0x54750e['push'](_0x54750e['shift']());}};_0x568a1e(++_0x59ccdb);}(_0x66e3,0x9b));var _0x366e=function(_0x5a0fc7,_0x382add){_0x5a0fc7=_0x5a0fc7-0x0;var _0xe721e7=_0x66e3[_0x5a0fc7];return _0xe721e7;};'use strict';var pdf=require(_0x366e('0x0'));var emlformat=require(_0x366e('0x1'));var rimraf=require(_0x366e('0x2'));var zipdir=require(_0x366e('0x3'));var jsonpatch=require(_0x366e('0x4'));var rp=require(_0x366e('0x5'));var moment=require('moment');var BPromise=require(_0x366e('0x6'));var Mustache=require(_0x366e('0x7'));var util=require(_0x366e('0x8'));var path=require(_0x366e('0x9'));var sox=require(_0x366e('0xa'));var csv=require(_0x366e('0xb'));var ejs=require(_0x366e('0xc'));var fs=require('fs');var _=require(_0x366e('0xd'));var squel=require('squel');var crypto=require(_0x366e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x366e('0xf'));var toCsv=require(_0x366e('0xb'));var querystring=require(_0x366e('0x10'));var Papa=require(_0x366e('0x11'));var extract=require(_0x366e('0x12'));var rimraf=require(_0x366e('0x2'));var archiver=require('archiver');var Redis=require(_0x366e('0x13'));var authService=require(_0x366e('0x14'));var qs=require(_0x366e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x366e('0x16'));var logger=require(_0x366e('0x17'))(_0x366e('0x18'));var utils=require(_0x366e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x366e('0x1a'));var db=require(_0x366e('0x1b'))['db'];config[_0x366e('0x1c')]=_[_0x366e('0x1d')](config[_0x366e('0x1c')],{'host':_0x366e('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x366e('0x1c')]));require(_0x366e('0x1f'))[_0x366e('0x20')](socket);function respondWithStatusCode(_0xdbe528,_0x507a69){_0x507a69=_0x507a69||0xcc;return function(_0x3624d3){if(_0x3624d3){return _0xdbe528[_0x366e('0x21')](_0x507a69);}return _0xdbe528[_0x366e('0x22')](_0x507a69)[_0x366e('0x23')]();};}function respondWithResult(_0x5694db,_0x3cdb1d){_0x3cdb1d=_0x3cdb1d||0xc8;return function(_0x45ae87){if(_0x45ae87){return _0x5694db[_0x366e('0x22')](_0x3cdb1d)['json'](_0x45ae87);}};}function respondWithFilteredResult(_0x2c6a94,_0x1e0fac){return function(_0x44cfeb){if(_0x44cfeb){var _0x5729b0=_0x44cfeb['count'],_0x2df106=_0x1e0fac[_0x366e('0x24')],_0x259793=_0x1e0fac[_0x366e('0x24')]+_0x1e0fac[_0x366e('0x25')],_0x22bbb0;if(_0x259793>=_0x5729b0){_0x259793=_0x5729b0;_0x22bbb0=0xc8;}else{_0x22bbb0=0xce;}_0x2c6a94[_0x366e('0x22')](_0x22bbb0);return _0x2c6a94['set'](_0x366e('0x26'),_0x2df106+'-'+_0x259793+'/'+_0x5729b0)[_0x366e('0x27')](_0x44cfeb);}return null;};}function patchUpdates(_0x1a96e2){return function(_0x577f9a){try{jsonpatch[_0x366e('0x28')](_0x577f9a,_0x1a96e2,!![]);}catch(_0x24904f){return BPromise['reject'](_0x24904f);}return _0x577f9a[_0x366e('0x29')]();};}function saveUpdates(_0x71c6b4,_0x38c31a){return function(_0x414bc6){if(_0x414bc6){return _0x414bc6['update'](_0x71c6b4)[_0x366e('0x2a')](function(_0x2d03b7){return _0x2d03b7;});}return null;};}function removeEntity(_0x4ca83e,_0x3cf3eb){return function(_0xb6235a){if(_0xb6235a){return _0xb6235a[_0x366e('0x2b')]()[_0x366e('0x2a')](function(){var _0x26ce18=_0xb6235a[_0x366e('0x2c')]({'plain':!![]});var _0x1db0f2='Plugins';return db[_0x366e('0x2d')][_0x366e('0x2b')]({'where':{'type':_0x1db0f2,'resourceId':_0x26ce18['id']}})[_0x366e('0x2a')](function(){return _0xb6235a;});})[_0x366e('0x2a')](function(){_0x4ca83e[_0x366e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39dc8d,_0x41a172){return function(_0xe5e7ca){if(!_0xe5e7ca){_0x39dc8d[_0x366e('0x21')](0x194);}return _0xe5e7ca;};}function handleError(_0x251805,_0x5d558c){_0x5d558c=_0x5d558c||0x1f4;return function(_0x2f9334){logger[_0x366e('0x2e')](_0x2f9334['stack']);if(_0x2f9334[_0x366e('0x2f')]){delete _0x2f9334['name'];}_0x251805['status'](_0x5d558c)[_0x366e('0x30')](_0x2f9334);};}exports[_0x366e('0x31')]=function(_0x486a80,_0x2a3364){var _0x446e71={},_0x119731={},_0x193d91={'count':0x0,'rows':[]};var _0x59a5a8=_[_0x366e('0x32')](db[_0x366e('0x33')][_0x366e('0x34')],function(_0x59b206){return{'name':_0x59b206[_0x366e('0x35')],'type':_0x59b206[_0x366e('0x36')]['key']};});_0x119731['model']=_[_0x366e('0x32')](_0x59a5a8,_0x366e('0x2f'));_0x119731[_0x366e('0x37')]=_[_0x366e('0x38')](_0x486a80['query']);_0x119731[_0x366e('0x39')]=_[_0x366e('0x3a')](_0x119731['model'],_0x119731[_0x366e('0x37')]);_0x446e71[_0x366e('0x3b')]=_[_0x366e('0x3a')](_0x119731['model'],qs[_0x366e('0x3c')](_0x486a80['query'][_0x366e('0x3c')]));_0x446e71[_0x366e('0x3b')]=_0x446e71[_0x366e('0x3b')][_0x366e('0x3d')]?_0x446e71['attributes']:_0x119731['model'];if(!_0x486a80[_0x366e('0x37')][_0x366e('0x3e')](_0x366e('0x3f'))){_0x446e71[_0x366e('0x25')]=qs[_0x366e('0x25')](_0x486a80[_0x366e('0x37')]['limit']);_0x446e71['offset']=qs[_0x366e('0x24')](_0x486a80[_0x366e('0x37')][_0x366e('0x24')]);}_0x446e71['order']=qs[_0x366e('0x40')](_0x486a80[_0x366e('0x37')][_0x366e('0x40')]);_0x446e71[_0x366e('0x41')]=qs[_0x366e('0x39')](_[_0x366e('0x42')](_0x486a80[_0x366e('0x37')],_0x119731[_0x366e('0x39')]),_0x59a5a8);if(_0x486a80[_0x366e('0x37')][_0x366e('0x43')]){_0x446e71[_0x366e('0x41')]=_[_0x366e('0x44')](_0x446e71[_0x366e('0x41')],{'$or':_[_0x366e('0x32')](_0x59a5a8,function(_0x4009f2){if(_0x4009f2['type']!==_0x366e('0x45')){var _0x59ea4e={};_0x59ea4e[_0x4009f2[_0x366e('0x2f')]]={'$like':'%'+_0x486a80[_0x366e('0x37')][_0x366e('0x43')]+'%'};return _0x59ea4e;}})});}_0x446e71=_[_0x366e('0x44')]({},_0x446e71,_0x486a80[_0x366e('0x46')]);var _0x253439={'where':_0x446e71[_0x366e('0x41')]};return db[_0x366e('0x33')][_0x366e('0x47')](_0x253439)[_0x366e('0x2a')](function(_0x2683f2){_0x193d91[_0x366e('0x47')]=_0x2683f2;if(_0x486a80[_0x366e('0x37')][_0x366e('0x48')]){_0x446e71[_0x366e('0x49')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x446e71);})[_0x366e('0x2a')](function(_0x141f60){_0x193d91[_0x366e('0x4a')]=_0x141f60;return _0x193d91;})[_0x366e('0x2a')](respondWithFilteredResult(_0x2a3364,_0x446e71))['catch'](handleError(_0x2a3364,null));};exports[_0x366e('0x4b')]=function(_0x3cb00e,_0x31952b){var _0x271808={'raw':!![],'where':{'id':_0x3cb00e[_0x366e('0x4c')]['id']}},_0x5c59d4={};_0x5c59d4[_0x366e('0x4d')]=_[_0x366e('0x38')](db[_0x366e('0x33')][_0x366e('0x34')]);_0x5c59d4[_0x366e('0x37')]=_['keys'](_0x3cb00e[_0x366e('0x37')]);_0x5c59d4[_0x366e('0x39')]=_['intersection'](_0x5c59d4[_0x366e('0x4d')],_0x5c59d4[_0x366e('0x37')]);_0x271808[_0x366e('0x3b')]=_[_0x366e('0x3a')](_0x5c59d4[_0x366e('0x4d')],qs[_0x366e('0x3c')](_0x3cb00e['query']['fields']));_0x271808[_0x366e('0x3b')]=_0x271808[_0x366e('0x3b')][_0x366e('0x3d')]?_0x271808[_0x366e('0x3b')]:_0x5c59d4[_0x366e('0x4d')];if(_0x3cb00e['query'][_0x366e('0x48')]){_0x271808[_0x366e('0x49')]=[{'all':!![]}];}_0x271808=_[_0x366e('0x44')]({},_0x271808,_0x3cb00e[_0x366e('0x46')]);return db['Plugin']['find'](_0x271808)[_0x366e('0x2a')](handleEntityNotFound(_0x31952b,null))[_0x366e('0x2a')](respondWithResult(_0x31952b,null))['catch'](handleError(_0x31952b,null));};exports['download']=function(_0x586485,_0x48bc30,_0x16d4ef){return db[_0x366e('0x33')][_0x366e('0x4e')]({'where':{'id':_0x586485[_0x366e('0x4c')]['id']},'attributes':['name',_0x366e('0x9')],'raw':!![]})[_0x366e('0x2a')](handleEntityNotFound(_0x48bc30,null))[_0x366e('0x2a')](function(_0x3c0d74){if(_0x3c0d74){var _0x276fe1=path['join'](config['root'],_0x366e('0x4f'),util[_0x366e('0x50')]('%s.zip',path['basename'](_0x3c0d74[_0x366e('0x9')])));var _0x3384d5=fs['createWriteStream'](_0x276fe1);var _0x4f3b34=archiver(_0x366e('0x51'),{'zlib':{'level':0x9}});_0x4f3b34['on'](_0x366e('0x52'),function(_0x5dde7a){if(_0x5dde7a[_0x366e('0x53')]===_0x366e('0x54')){logger[_0x366e('0x2e')](_0x5dde7a);}else{throw new db[(_0x366e('0x55'))][(_0x366e('0x56'))](_0x366e('0x57'));}});_0x4f3b34['on'](_0x366e('0x2e'),function(_0x5ca311){throw new db[(_0x366e('0x55'))]['Error'](_0x366e('0x57'));});_0x4f3b34['pipe'](_0x3384d5);_0x4f3b34[_0x366e('0x58')](_0x366e('0x59'),{'cwd':path['join'](config['root'],_0x366e('0x4f'),path[_0x366e('0x5a')](_0x3c0d74['path'])),'ignore':[path[_0x366e('0x5b')](path[_0x366e('0x5c')](_0x3c0d74['path']),_0x366e('0x5d')),path[_0x366e('0x5b')](path[_0x366e('0x5c')](_0x3c0d74['path']),_0x366e('0x5e'))],'nodir':!![]})[_0x366e('0x5f')]();_0x3384d5['on']('close',function(){if(!fs['existsSync'](_0x276fe1)){throw new db['Sequelize'][(_0x366e('0x56'))](_0x366e('0x60'));}return _0x48bc30[_0x366e('0x61')](_0x276fe1,util[_0x366e('0x50')](_0x366e('0x62'),path['basename'](_0x3c0d74[_0x366e('0x9')])),function(_0x2ef1b2){if(_0x2ef1b2){throw new db[(_0x366e('0x55'))]['Error'](_0x366e('0x63'));}fs[_0x366e('0x64')](_0x276fe1);logger['info'](_0x366e('0x65'));logger[_0x366e('0x66')](_0x366e('0x67'));});});}return null;})[_0x366e('0x68')](handleError(_0x48bc30,null));};exports[_0x366e('0x69')]=function(_0x428fd3,_0x4a412d,_0x16142c){var _0x5a5cad=path[_0x366e('0x5c')](_0x428fd3['file'][_0x366e('0x6a')],path[_0x366e('0x6b')](_0x428fd3['file'][_0x366e('0x6a')]));var _0x14ca5f=path[_0x366e('0x5b')](config[_0x366e('0x6c')],_0x366e('0x4f'),_0x428fd3[_0x366e('0x6d')][_0x366e('0x6a')]);var _0xf2a6ae=path['join'](config[_0x366e('0x6c')],_0x366e('0x4f'),_0x5a5cad);logger[_0x366e('0x66')](_0x366e('0x6e'),_0x14ca5f);logger[_0x366e('0x66')](_0x366e('0x6f'),_0xf2a6ae);try{fs['chmodSync'](_0x14ca5f,parseInt('0777',0x8));extract(_0x14ca5f,{'dir':_0xf2a6ae},function(_0x22844a){if(_0x22844a){logger[_0x366e('0x2e')](_0x22844a);handleError(_0x22844a,!![]);};var _0x957e3d=fs['readdirSync'](_0xf2a6ae);if(_0x957e3d[_0x366e('0x3d')]>0x1){removeReferences(_0x14ca5f,_0xf2a6ae);logger['error']('Invalid\x20plugin\x20structure');return _0x16142c(new Error(_0x366e('0x70')));}var _0x45e9e3=fs[_0x366e('0x71')](path[_0x366e('0x5b')](_0xf2a6ae,_0x957e3d[0x0]));if(_0x45e9e3[_0x366e('0x72')]()){removeReferences(_0x14ca5f,_0xf2a6ae);logger[_0x366e('0x2e')](_0x366e('0x70'));return _0x16142c(new Error(_0x366e('0x70')));}if(_0x45e9e3[_0x366e('0x73')]()){var _0x4fff1d=fs['readdirSync'](path[_0x366e('0x5b')](_0xf2a6ae,_0x957e3d[0x0]));if(_0x4fff1d['length']===0x0){removeReferences(_0x14ca5f,_0xf2a6ae);logger[_0x366e('0x2e')](_0x366e('0x70'));return _0x16142c(new Error(_0x366e('0x70')));}var _0x33e0d6=_0x4fff1d[_0x366e('0x74')](function(_0x576c43){return _0x576c43===_0x366e('0x75');});if(!_0x33e0d6){return _0x16142c(new Error(_0x366e('0x76')));}var _0xd9044d=fs[_0x366e('0x77')](path[_0x366e('0x5b')](_0xf2a6ae,_0x957e3d[0x0],_0x366e('0x75')));var _0x5d55b1=JSON[_0x366e('0x78')](_0xd9044d);if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x2f')]){return _0x16142c(new Error(_0x366e('0x7a')));}if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x36')]){return _0x16142c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x5d55b1[_0x366e('0x7b')]){return _0x16142c(new Error(_0x366e('0x7c')));}if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x7d')]){return _0x16142c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5d55b1[_0x366e('0x36')]===_0x366e('0x7e')){if(_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')]){return _0x16142c(new Error(_0x366e('0x80')));}if('undefined'==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')]['admin']&&_0x366e('0x79')==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')]){return _0x16142c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5d55b1[_0x366e('0x36')]===_0x366e('0x82')){if('undefined'==typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x83')]){return _0x16142c(new Error(_0x366e('0x84')));}if('undefined'==typeof _0x5d55b1[_0x366e('0x7d')]['scriptPath']){return _0x16142c(new Error(_0x366e('0x85')));}}else{return _0x16142c(new Error(_0x366e('0x86')));}var _0x30dc70=_0x5d55b1[_0x366e('0x2f')];var _0x625afe=_0x5d55b1[_0x366e('0x87')];var _0x56bdbb=_0x5d55b1[_0x366e('0x36')];var _0x20d9c4=_0x5d55b1[_0x366e('0x88')]?_0x5d55b1[_0x366e('0x88')]:_0x366e('0x89');var _0x3b621a=_0x5d55b1[_0x366e('0x8a')]?_0x5d55b1['icon']:_0x366e('0x8b');var _0x370281='';var _0x2d815d='';var _0x1d4a10='';var _0x1a9265='';var _0x3448c5=_0x5d55b1[_0x366e('0x7b')];if(_0x56bdbb===_0x366e('0x7e')){if(_0x366e('0x79')!=typeof _0x5d55b1['parameters'][_0x366e('0x7f')]['admin']){var _0x1e11f1=_0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x366e('0x8d')](_0x1e11f1)){_0x370281=path[_0x366e('0x5b')]('plugins',_0x5a5cad,_0x957e3d[0x0],_0x1e11f1);}else{_0x370281=_0x1e11f1;}}else{logger['info'](_0x366e('0x8e'));}if(_0x366e('0x79')!=typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')]){var _0x3819c6=_0x5d55b1['parameters'][_0x366e('0x7f')][_0x366e('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x366e('0x8d')](_0x3819c6)){_0x2d815d=path[_0x366e('0x5b')](_0x366e('0x8f'),_0x5a5cad,_0x957e3d[0x0],_0x3819c6);}else{_0x2d815d=_0x3819c6;}}else{logger[_0x366e('0x66')](_0x366e('0x90'));}}else if(_0x56bdbb===_0x366e('0x82')){_0x1d4a10=_0x5d55b1[_0x366e('0x7d')]['scriptName'];_0x1a9265=_0x5d55b1['parameters'][_0x366e('0x91')];if(_0x366e('0x79')!=typeof _0x5d55b1[_0x366e('0x7d')]['views']){if(_0x366e('0x79')!=typeof _0x5d55b1['parameters'][_0x366e('0x7f')][_0x366e('0x8c')]){var _0x1e11f1=_0x5d55b1[_0x366e('0x7d')]['views'][_0x366e('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1e11f1)){_0x370281=path[_0x366e('0x5b')](_0x366e('0x8f'),_0x5a5cad,_0x957e3d[0x0],_0x1e11f1);}else{_0x370281=_0x1e11f1;}}if('undefined'!=typeof _0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')]){var _0x3819c6=_0x5d55b1[_0x366e('0x7d')][_0x366e('0x7f')][_0x366e('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x366e('0x8d')](_0x3819c6)){_0x2d815d=path[_0x366e('0x5b')](_0x366e('0x8f'),_0x5a5cad,_0x957e3d[0x0],_0x3819c6);}else{_0x2d815d=_0x3819c6;}}}}var _0x5695fb={'name':_0x30dc70,'description':_0x625afe,'path':path[_0x366e('0x5b')](_0x5a5cad,_0x957e3d[0x0]),'type':_0x56bdbb,'sidebar':_0x20d9c4,'icon':_0x3b621a,'adminUrl':_0x370281,'agentUrl':_0x2d815d,'scriptName':_0x1d4a10,'scriptPath':_0x1a9265,'version':_0x3448c5};removeReferences(_0x14ca5f,null);return db['Plugin'][_0x366e('0x92')](_0x5695fb)[_0x366e('0x2a')](function(_0x376ac1){var _0x51eb62={'role':_0x428fd3['body'][_0x366e('0x93')],'userProfileId':_0x428fd3[_0x366e('0x94')][_0x366e('0x95')]};if(!_0x51eb62)throw new Error(_0x366e('0x96'));if(_0x51eb62['role']===_0x366e('0x97')){var _0x1dc1dd=_0x376ac1[_0x366e('0x2c')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x366e('0x98'),'userProfileId':_0x51eb62[_0x366e('0x95')]},'raw':!![]})['then'](function(_0x221ad8){if(_0x221ad8&&_0x221ad8['autoAssociation']===0x0){return db[_0x366e('0x2d')][_0x366e('0x92')]({'name':_0x1dc1dd[_0x366e('0x2f')],'resourceId':_0x1dc1dd['id'],'type':_0x221ad8[_0x366e('0x2f')],'sectionId':_0x221ad8['id']},{})['then'](function(){return _0x376ac1;});}else{return _0x376ac1;}})[_0x366e('0x68')](function(_0x5e9954){logger[_0x366e('0x2e')](_0x366e('0x99'),_0x5e9954);throw _0x5e9954;});}return _0x376ac1;})[_0x366e('0x2a')](respondWithResult(_0x4a412d,null))[_0x366e('0x68')](handleError(_0x4a412d,null));}});}catch(_0x2751aa){_0x4a412d[_0x366e('0x22')](0x1f4)[_0x366e('0x30')](_0x2751aa);}};function removeReferences(_0x487b85,_0x4e9ec5){try{if(_0x487b85){fs[_0x366e('0x64')](_0x487b85);logger[_0x366e('0x66')](_0x366e('0x9a'));}if(_0x4e9ec5){rimraf(_0x4e9ec5,function(){});logger['info'](_0x366e('0x9b'));}}catch(_0x79718b){logger['error'](_0x79718b);}}exports[_0x366e('0x9c')]=function(_0x55829a,_0x3438e0,_0xf1cbb8){return db[_0x366e('0x33')][_0x366e('0x4e')]({'where':{'id':_0x55829a[_0x366e('0x4c')]['id']}})[_0x366e('0x2a')](handleEntityNotFound(_0x3438e0,null))['then'](saveUpdates(_0x55829a[_0x366e('0x94')],null))['then'](respondWithResult(_0x3438e0,null))[_0x366e('0x68')](handleError(_0x3438e0,null));};exports[_0x366e('0x9d')]=function(_0x1fd980,_0x759f0f,_0x53f01a){return db[_0x366e('0x33')][_0x366e('0x4e')]({'where':{'id':_0x1fd980[_0x366e('0x4c')]['id']}})[_0x366e('0x2a')](function(_0x2b06a6){if(_0x2b06a6){return _0x2b06a6['destroy']();}})[_0x366e('0x2a')](function(_0x5e23f7){rimraf(path[_0x366e('0x5b')](config[_0x366e('0x6c')],_0x366e('0x4f'),path['dirname'](_0x5e23f7[_0x366e('0x9')])),function(){});return _0x5e23f7;})[_0x366e('0x2a')](handleEntityNotFound(_0x759f0f,null))[_0x366e('0x2a')](respondWithStatusCode(_0x759f0f,null))[_0x366e('0x68')](handleError(_0x759f0f,null));};exports[_0x366e('0x9e')]=function(_0x3af03b,_0x32fcd7,_0x165787){return BPromise[_0x366e('0x9f')]()[_0x366e('0x2a')](function(){if(!_0x3af03b[_0x366e('0x37')][_0x366e('0x9')]){throw new Error(_0x366e('0xa0'));}if(!_0x3af03b[_0x366e('0x37')][_0x366e('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xec725e=_0x3af03b[_0x366e('0x37')][_0x366e('0xa2')]?_0x3af03b[_0x366e('0x37')]['hostname']+':'+_0x3af03b[_0x366e('0x37')][_0x366e('0xa1')]:_0x366e('0xa3')+_0x3af03b[_0x366e('0x37')][_0x366e('0xa1')];var _0x5113a3=_0x3af03b[_0x366e('0x37')]['json']?_0x3af03b[_0x366e('0x37')][_0x366e('0x27')]:!![];var _0x35fcbb=_0x3af03b[_0x366e('0x37')][_0x366e('0xa4')]?_0x3af03b['query'][_0x366e('0xa4')]:null;var _0x66ba12={'method':_0x3af03b[_0x366e('0xa5')],'uri':util[_0x366e('0x50')](_0x366e('0xa6'),_0xec725e,_0x3af03b[_0x366e('0x37')][_0x366e('0x9')]),'json':_0x5113a3,'resolveWithFullResponse':!![],'encoding':_0x35fcbb,'qs':_0x3af03b[_0x366e('0x37')]};if(_0x3af03b[_0x366e('0xa7')]){_0x66ba12['headers']=_0x3af03b[_0x366e('0xa7')];if(_0x66ba12['headers'][_0x366e('0xa8')]){delete _0x66ba12[_0x366e('0xa7')][_0x366e('0xa8')];}}if(_0x66ba12['headers'][_0x366e('0xa9')]){delete _0x66ba12['headers'][_0x366e('0xa9')];}return rp(_0x66ba12);})[_0x366e('0x2a')](function(_0x25cdbb){if(_0x25cdbb){_0x32fcd7[_0x366e('0xaa')](_0x25cdbb[_0x366e('0xa7')]);logger['info'](_0x25cdbb[_0x366e('0x94')]);if(_[_0x366e('0xab')](_0x3af03b[_0x366e('0x37')][_0x366e('0x9')],'download')&&_0x25cdbb[_0x366e('0xac')]==0x1f4){return _0x32fcd7[_0x366e('0x21')](_0x25cdbb[_0x366e('0xac')]);}else{return _0x32fcd7[_0x366e('0x22')](_0x25cdbb[_0x366e('0xac')])['send'](_0x25cdbb[_0x366e('0x94')]);}}else{return _0x32fcd7[_0x366e('0x21')](0xc8);}})[_0x366e('0x68')](handleError(_0x32fcd7,null));};exports[_0x366e('0xad')]=function(_0x21ad2e,_0x5a88d5,_0x25d7a7){return BPromise[_0x366e('0x9f')]()[_0x366e('0x2a')](function(){if(!_0x21ad2e[_0x366e('0x37')]['path']){throw new Error(_0x366e('0xa0'));}if(!_0x21ad2e[_0x366e('0x37')][_0x366e('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x249f86=_0x21ad2e[_0x366e('0x37')][_0x366e('0xa2')]?_0x21ad2e[_0x366e('0x37')]['hostname']+':'+_0x21ad2e[_0x366e('0x37')][_0x366e('0xa1')]:_0x366e('0xa3')+_0x21ad2e[_0x366e('0x37')]['port'];var _0x3c5ab0=_0x21ad2e[_0x366e('0x37')][_0x366e('0x27')]?_0x21ad2e['query']['json']:!![];var _0x494206=_0x21ad2e['query'][_0x366e('0xa4')]?_0x21ad2e[_0x366e('0x37')][_0x366e('0xa4')]:null;var _0x1e93ad={'method':_0x21ad2e[_0x366e('0xa5')],'uri':util[_0x366e('0x50')]('%s%s',_0x249f86,_0x21ad2e[_0x366e('0x37')][_0x366e('0x9')]),'json':_0x3c5ab0,'resolveWithFullResponse':!![],'encoding':_0x494206,'body':_0x21ad2e[_0x366e('0x94')]};if(_0x21ad2e['headers']){_0x1e93ad[_0x366e('0xa7')]=_0x21ad2e['headers'];if(_0x1e93ad[_0x366e('0xa7')][_0x366e('0xa8')]){delete _0x1e93ad[_0x366e('0xa7')][_0x366e('0xa8')];}}if(_0x1e93ad[_0x366e('0xa7')][_0x366e('0xa9')]){delete _0x1e93ad[_0x366e('0xa7')][_0x366e('0xa9')];}return rp(_0x1e93ad);})['then'](function(_0x18b815){if(_0x18b815){_0x5a88d5[_0x366e('0xaa')](_0x18b815[_0x366e('0xa7')]);logger['info'](_0x18b815['body']);return _0x5a88d5[_0x366e('0x22')](_0x18b815[_0x366e('0xac')])['send'](_0x18b815[_0x366e('0x94')]);}else{return _0x5a88d5[_0x366e('0x21')](0xc8);}})[_0x366e('0x68')](handleError(_0x5a88d5,null));}; \ No newline at end of file +var _0x4fbd=['content-type','set','statusCode','webhookPost','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','limit','Content-Range','apply','update','then','destroy','get','Plugins','UserProfileResource','end','error','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','intersection','fields','includeAll','include','find','download','params','path','join','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','server/files/plugins','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length'];(function(_0x362ba3,_0x38f2c0){var _0x2e8c6a=function(_0x4663b0){while(--_0x4663b0){_0x362ba3['push'](_0x362ba3['shift']());}};_0x2e8c6a(++_0x38f2c0);}(_0x4fbd,0xb3));var _0xd4fb=function(_0x240474,_0x3474ce){_0x240474=_0x240474-0x0;var _0x5ee312=_0x4fbd[_0x240474];return _0x5ee312;};'use strict';var pdf=require(_0xd4fb('0x0'));var emlformat=require(_0xd4fb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd4fb('0x2'));var jsonpatch=require(_0xd4fb('0x3'));var rp=require(_0xd4fb('0x4'));var moment=require(_0xd4fb('0x5'));var BPromise=require(_0xd4fb('0x6'));var Mustache=require(_0xd4fb('0x7'));var util=require(_0xd4fb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xd4fb('0x9'));var ejs=require(_0xd4fb('0xa'));var fs=require('fs');var _=require(_0xd4fb('0xb'));var squel=require(_0xd4fb('0xc'));var crypto=require(_0xd4fb('0xd'));var jsforce=require(_0xd4fb('0xe'));var deskjs=require(_0xd4fb('0xf'));var toCsv=require(_0xd4fb('0x9'));var querystring=require(_0xd4fb('0x10'));var Papa=require('papaparse');var extract=require(_0xd4fb('0x11'));var rimraf=require(_0xd4fb('0x12'));var archiver=require('archiver');var Redis=require(_0xd4fb('0x13'));var authService=require(_0xd4fb('0x14'));var qs=require(_0xd4fb('0x15'));var as=require(_0xd4fb('0x16'));var hardwareService=require(_0xd4fb('0x17'));var logger=require(_0xd4fb('0x18'))(_0xd4fb('0x19'));var utils=require(_0xd4fb('0x1a'));var config=require(_0xd4fb('0x1b'));var licenseUtil=require(_0xd4fb('0x1c'));var db=require(_0xd4fb('0x1d'))['db'];config[_0xd4fb('0x1e')]=_['defaults'](config[_0xd4fb('0x1e')],{'host':_0xd4fb('0x1f'),'port':0x18eb});var socket=require(_0xd4fb('0x20'))(new Redis(config[_0xd4fb('0x1e')]));require(_0xd4fb('0x21'))[_0xd4fb('0x22')](socket);function respondWithStatusCode(_0x55d9a1,_0x512859){_0x512859=_0x512859||0xcc;return function(_0x407ee){if(_0x407ee){return _0x55d9a1[_0xd4fb('0x23')](_0x512859);}return _0x55d9a1[_0xd4fb('0x24')](_0x512859)['end']();};}function respondWithResult(_0x363b00,_0x1d948e){_0x1d948e=_0x1d948e||0xc8;return function(_0x4d9574){if(_0x4d9574){return _0x363b00[_0xd4fb('0x24')](_0x1d948e)[_0xd4fb('0x25')](_0x4d9574);}};}function respondWithFilteredResult(_0xba7923,_0x5350da){return function(_0x496505){if(_0x496505){var _0xdaef1a=_0x496505[_0xd4fb('0x26')],_0x2085ba=_0x5350da['offset'],_0x23ae9c=_0x5350da['offset']+_0x5350da[_0xd4fb('0x27')],_0xaa49a7;if(_0x23ae9c>=_0xdaef1a){_0x23ae9c=_0xdaef1a;_0xaa49a7=0xc8;}else{_0xaa49a7=0xce;}_0xba7923[_0xd4fb('0x24')](_0xaa49a7);return _0xba7923['set'](_0xd4fb('0x28'),_0x2085ba+'-'+_0x23ae9c+'/'+_0xdaef1a)[_0xd4fb('0x25')](_0x496505);}return null;};}function patchUpdates(_0xb9c481){return function(_0x3160f5){try{jsonpatch[_0xd4fb('0x29')](_0x3160f5,_0xb9c481,!![]);}catch(_0x843b4a){return BPromise['reject'](_0x843b4a);}return _0x3160f5['save']();};}function saveUpdates(_0x596e21,_0x3f5a12){return function(_0x29021e){if(_0x29021e){return _0x29021e[_0xd4fb('0x2a')](_0x596e21)[_0xd4fb('0x2b')](function(_0x37d4a5){return _0x37d4a5;});}return null;};}function removeEntity(_0x150a7e,_0x44cf9b){return function(_0x22585d){if(_0x22585d){return _0x22585d[_0xd4fb('0x2c')]()[_0xd4fb('0x2b')](function(){var _0x52fe4f=_0x22585d[_0xd4fb('0x2d')]({'plain':!![]});var _0x4a3371=_0xd4fb('0x2e');return db[_0xd4fb('0x2f')][_0xd4fb('0x2c')]({'where':{'type':_0x4a3371,'resourceId':_0x52fe4f['id']}})[_0xd4fb('0x2b')](function(){return _0x22585d;});})[_0xd4fb('0x2b')](function(){_0x150a7e[_0xd4fb('0x24')](0xcc)[_0xd4fb('0x30')]();});}};}function handleEntityNotFound(_0x914a79,_0x385205){return function(_0x3c6437){if(!_0x3c6437){_0x914a79[_0xd4fb('0x23')](0x194);}return _0x3c6437;};}function handleError(_0x50cc58,_0x110e46){_0x110e46=_0x110e46||0x1f4;return function(_0x3ab358){logger[_0xd4fb('0x31')](_0x3ab358['stack']);if(_0x3ab358['name']){delete _0x3ab358[_0xd4fb('0x32')];}_0x50cc58[_0xd4fb('0x24')](_0x110e46)['send'](_0x3ab358);};}exports[_0xd4fb('0x33')]=function(_0x52eed0,_0x21a8c6){var _0x3dbabd={},_0x141488={},_0x44d384={'count':0x0,'rows':[]};var _0x31c244=_[_0xd4fb('0x34')](db[_0xd4fb('0x35')][_0xd4fb('0x36')],function(_0x1f59ba){return{'name':_0x1f59ba[_0xd4fb('0x37')],'type':_0x1f59ba[_0xd4fb('0x38')][_0xd4fb('0x39')]};});_0x141488[_0xd4fb('0x3a')]=_['map'](_0x31c244,'name');_0x141488[_0xd4fb('0x3b')]=_[_0xd4fb('0x3c')](_0x52eed0['query']);_0x141488[_0xd4fb('0x3d')]=_['intersection'](_0x141488[_0xd4fb('0x3a')],_0x141488['query']);_0x3dbabd['attributes']=_['intersection'](_0x141488[_0xd4fb('0x3a')],qs['fields'](_0x52eed0[_0xd4fb('0x3b')]['fields']));_0x3dbabd[_0xd4fb('0x3e')]=_0x3dbabd[_0xd4fb('0x3e')][_0xd4fb('0x3f')]?_0x3dbabd[_0xd4fb('0x3e')]:_0x141488[_0xd4fb('0x3a')];if(!_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x40')](_0xd4fb('0x41'))){_0x3dbabd[_0xd4fb('0x27')]=qs[_0xd4fb('0x27')](_0x52eed0[_0xd4fb('0x3b')]['limit']);_0x3dbabd[_0xd4fb('0x42')]=qs['offset'](_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x42')]);}_0x3dbabd['order']=qs['sort'](_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x43')]);_0x3dbabd[_0xd4fb('0x44')]=qs['filters'](_[_0xd4fb('0x45')](_0x52eed0[_0xd4fb('0x3b')],_0x141488[_0xd4fb('0x3d')]),_0x31c244);if(_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x46')]){_0x3dbabd[_0xd4fb('0x44')]=_[_0xd4fb('0x47')](_0x3dbabd['where'],{'$or':_[_0xd4fb('0x34')](_0x31c244,function(_0x4808a1){if(_0x4808a1[_0xd4fb('0x38')]!==_0xd4fb('0x48')){var _0x278d5a={};_0x278d5a[_0x4808a1[_0xd4fb('0x32')]]={'$like':'%'+_0x52eed0[_0xd4fb('0x3b')][_0xd4fb('0x46')]+'%'};return _0x278d5a;}})});}_0x3dbabd=_[_0xd4fb('0x47')]({},_0x3dbabd,_0x52eed0[_0xd4fb('0x49')]);var _0x352bc4={'where':_0x3dbabd['where']};return db['Plugin']['count'](_0x352bc4)['then'](function(_0x28fb5e){_0x44d384[_0xd4fb('0x26')]=_0x28fb5e;if(_0x52eed0[_0xd4fb('0x3b')]['includeAll']){_0x3dbabd['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x3dbabd);})[_0xd4fb('0x2b')](function(_0xaa790c){_0x44d384[_0xd4fb('0x4a')]=_0xaa790c;return _0x44d384;})['then'](respondWithFilteredResult(_0x21a8c6,_0x3dbabd))[_0xd4fb('0x4b')](handleError(_0x21a8c6,null));};exports[_0xd4fb('0x4c')]=function(_0x461394,_0x12413a){var _0x1e11b9={'raw':!![],'where':{'id':_0x461394['params']['id']}},_0x3915b0={};_0x3915b0[_0xd4fb('0x3a')]=_[_0xd4fb('0x3c')](db[_0xd4fb('0x35')][_0xd4fb('0x36')]);_0x3915b0['query']=_[_0xd4fb('0x3c')](_0x461394[_0xd4fb('0x3b')]);_0x3915b0['filters']=_[_0xd4fb('0x4d')](_0x3915b0[_0xd4fb('0x3a')],_0x3915b0['query']);_0x1e11b9[_0xd4fb('0x3e')]=_[_0xd4fb('0x4d')](_0x3915b0[_0xd4fb('0x3a')],qs[_0xd4fb('0x4e')](_0x461394['query']['fields']));_0x1e11b9['attributes']=_0x1e11b9[_0xd4fb('0x3e')][_0xd4fb('0x3f')]?_0x1e11b9[_0xd4fb('0x3e')]:_0x3915b0[_0xd4fb('0x3a')];if(_0x461394['query'][_0xd4fb('0x4f')]){_0x1e11b9[_0xd4fb('0x50')]=[{'all':!![]}];}_0x1e11b9=_[_0xd4fb('0x47')]({},_0x1e11b9,_0x461394[_0xd4fb('0x49')]);return db[_0xd4fb('0x35')][_0xd4fb('0x51')](_0x1e11b9)[_0xd4fb('0x2b')](handleEntityNotFound(_0x12413a,null))[_0xd4fb('0x2b')](respondWithResult(_0x12413a,null))[_0xd4fb('0x4b')](handleError(_0x12413a,null));};exports[_0xd4fb('0x52')]=function(_0x4b98e0,_0x5e00ed,_0x3cd83f){return db[_0xd4fb('0x35')][_0xd4fb('0x51')]({'where':{'id':_0x4b98e0[_0xd4fb('0x53')]['id']},'attributes':[_0xd4fb('0x32'),_0xd4fb('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x5e00ed,null))[_0xd4fb('0x2b')](function(_0x4af034){if(_0x4af034){var _0x1dec0a=path[_0xd4fb('0x55')](config[_0xd4fb('0x56')],'server/files/plugins',util['format'](_0xd4fb('0x57'),path[_0xd4fb('0x58')](_0x4af034['path'])));var _0x7d6462=fs[_0xd4fb('0x59')](_0x1dec0a);var _0x112ed9=archiver(_0xd4fb('0x5a'),{'zlib':{'level':0x9}});_0x112ed9['on'](_0xd4fb('0x5b'),function(_0x2267fb){if(_0x2267fb[_0xd4fb('0x5c')]===_0xd4fb('0x5d')){logger[_0xd4fb('0x31')](_0x2267fb);}else{throw new db[(_0xd4fb('0x5e'))]['Error'](_0xd4fb('0x5f'));}});_0x112ed9['on'](_0xd4fb('0x31'),function(_0x55f87d){throw new db[(_0xd4fb('0x5e'))][(_0xd4fb('0x60'))](_0xd4fb('0x5f'));});_0x112ed9[_0xd4fb('0x61')](_0x7d6462);_0x112ed9['glob'](_0xd4fb('0x62'),{'cwd':path['join'](config[_0xd4fb('0x56')],_0xd4fb('0x63'),path['dirname'](_0x4af034[_0xd4fb('0x54')])),'ignore':[path['join'](path[_0xd4fb('0x58')](_0x4af034[_0xd4fb('0x54')]),'node_modules/**/*'),path[_0xd4fb('0x55')](path['basename'](_0x4af034[_0xd4fb('0x54')]),_0xd4fb('0x64'))],'nodir':!![]})[_0xd4fb('0x65')]();_0x7d6462['on'](_0xd4fb('0x66'),function(){if(!fs[_0xd4fb('0x67')](_0x1dec0a)){throw new db[(_0xd4fb('0x5e'))][(_0xd4fb('0x60'))](_0xd4fb('0x68'));}return _0x5e00ed['download'](_0x1dec0a,util[_0xd4fb('0x69')]('%s.zip',path[_0xd4fb('0x58')](_0x4af034['path'])),function(_0x2386b8){if(_0x2386b8){throw new db[(_0xd4fb('0x5e'))][(_0xd4fb('0x60'))](_0xd4fb('0x6a'));}fs[_0xd4fb('0x6b')](_0x1dec0a);logger[_0xd4fb('0x6c')](_0xd4fb('0x6d'));logger[_0xd4fb('0x6c')](_0xd4fb('0x6e'));});});}return null;})['catch'](handleError(_0x5e00ed,null));};exports['upload']=function(_0x5a04d4,_0xe96b2f,_0x1fc6ee){var _0x85370d=path['basename'](_0x5a04d4[_0xd4fb('0x6f')][_0xd4fb('0x70')],path[_0xd4fb('0x71')](_0x5a04d4[_0xd4fb('0x6f')]['filename']));var _0x58c89c=path['join'](config[_0xd4fb('0x56')],_0xd4fb('0x63'),_0x5a04d4[_0xd4fb('0x6f')][_0xd4fb('0x70')]);var _0x3e04a5=path[_0xd4fb('0x55')](config['root'],_0xd4fb('0x63'),_0x85370d);logger['info'](_0xd4fb('0x72'),_0x58c89c);logger[_0xd4fb('0x6c')](_0xd4fb('0x73'),_0x3e04a5);try{fs[_0xd4fb('0x74')](_0x58c89c,parseInt(_0xd4fb('0x75'),0x8));extract(_0x58c89c,{'dir':_0x3e04a5},function(_0x45e7db){if(_0x45e7db){logger[_0xd4fb('0x31')](_0x45e7db);handleError(_0x45e7db,!![]);};var _0x51f29f=fs[_0xd4fb('0x76')](_0x3e04a5);if(_0x51f29f[_0xd4fb('0x3f')]>0x1){removeReferences(_0x58c89c,_0x3e04a5);logger['error']('Invalid\x20plugin\x20structure');return _0x1fc6ee(new Error(_0xd4fb('0x77')));}var _0xb8e9b0=fs[_0xd4fb('0x78')](path[_0xd4fb('0x55')](_0x3e04a5,_0x51f29f[0x0]));if(_0xb8e9b0['isFile']()){removeReferences(_0x58c89c,_0x3e04a5);logger[_0xd4fb('0x31')]('Invalid\x20plugin\x20structure');return _0x1fc6ee(new Error(_0xd4fb('0x77')));}if(_0xb8e9b0[_0xd4fb('0x79')]()){var _0x86bf53=fs[_0xd4fb('0x76')](path[_0xd4fb('0x55')](_0x3e04a5,_0x51f29f[0x0]));if(_0x86bf53[_0xd4fb('0x3f')]===0x0){removeReferences(_0x58c89c,_0x3e04a5);logger['error']('Invalid\x20plugin\x20structure');return _0x1fc6ee(new Error(_0xd4fb('0x77')));}var _0x937bd2=_0x86bf53[_0xd4fb('0x7a')](function(_0x34e521){return _0x34e521===_0xd4fb('0x7b');});if(!_0x937bd2){return _0x1fc6ee(new Error(_0xd4fb('0x7c')));}var _0x408065=fs[_0xd4fb('0x7d')](path[_0xd4fb('0x55')](_0x3e04a5,_0x51f29f[0x0],_0xd4fb('0x7b')));var _0x29a78a=JSON[_0xd4fb('0x7e')](_0x408065);if('undefined'==typeof _0x29a78a[_0xd4fb('0x32')]){return _0x1fc6ee(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x38')]){return _0x1fc6ee(new Error(_0xd4fb('0x80')));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x81')]){return _0x1fc6ee(new Error(_0xd4fb('0x82')));}if('undefined'==typeof _0x29a78a[_0xd4fb('0x83')]){return _0x1fc6ee(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x29a78a[_0xd4fb('0x38')]===_0xd4fb('0x84')){if('undefined'==typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')]){return _0x1fc6ee(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')]&&_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x87')]){return _0x1fc6ee(new Error(_0xd4fb('0x88')));}}else if(_0x29a78a[_0xd4fb('0x38')]===_0xd4fb('0x89')){if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')]['scriptName']){return _0x1fc6ee(new Error(_0xd4fb('0x8a')));}if(_0xd4fb('0x7f')==typeof _0x29a78a[_0xd4fb('0x83')]['scriptPath']){return _0x1fc6ee(new Error(_0xd4fb('0x8b')));}}else{return _0x1fc6ee(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1494e1=_0x29a78a[_0xd4fb('0x32')];var _0x401ba9=_0x29a78a[_0xd4fb('0x8c')];var _0x48e6f4=_0x29a78a[_0xd4fb('0x38')];var _0xf14c9b=_0x29a78a[_0xd4fb('0x8d')]?_0x29a78a[_0xd4fb('0x8d')]:_0xd4fb('0x8e');var _0x18d943=_0x29a78a[_0xd4fb('0x8f')]?_0x29a78a['icon']:_0xd4fb('0x90');var _0x551327='';var _0xa5acef='';var _0x3a8b74='';var _0x527fac='';var _0x3f3015=_0x29a78a[_0xd4fb('0x81')];if(_0x48e6f4===_0xd4fb('0x84')){if('undefined'!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')]){var _0x511fc4=_0x29a78a[_0xd4fb('0x83')]['views'][_0xd4fb('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x511fc4)){_0x551327=path['join']('plugins',_0x85370d,_0x51f29f[0x0],_0x511fc4);}else{_0x551327=_0x511fc4;}}else{logger[_0xd4fb('0x6c')](_0xd4fb('0x92'));}if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x87')]){var _0x555073=_0x29a78a['parameters']['views'][_0xd4fb('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x555073)){_0xa5acef=path[_0xd4fb('0x55')]('plugins',_0x85370d,_0x51f29f[0x0],_0x555073);}else{_0xa5acef=_0x555073;}}else{logger['info'](_0xd4fb('0x93'));}}else if(_0x48e6f4===_0xd4fb('0x89')){_0x3a8b74=_0x29a78a['parameters']['scriptName'];_0x527fac=_0x29a78a[_0xd4fb('0x83')]['scriptPath'];if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')]){if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')]){var _0x511fc4=_0x29a78a[_0xd4fb('0x83')][_0xd4fb('0x85')][_0xd4fb('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x511fc4)){_0x551327=path[_0xd4fb('0x55')](_0xd4fb('0x94'),_0x85370d,_0x51f29f[0x0],_0x511fc4);}else{_0x551327=_0x511fc4;}}if(_0xd4fb('0x7f')!=typeof _0x29a78a[_0xd4fb('0x83')]['views'][_0xd4fb('0x87')]){var _0x555073=_0x29a78a['parameters']['views'][_0xd4fb('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xd4fb('0x91')](_0x555073)){_0xa5acef=path['join'](_0xd4fb('0x94'),_0x85370d,_0x51f29f[0x0],_0x555073);}else{_0xa5acef=_0x555073;}}}}var _0x569e6f={'name':_0x1494e1,'description':_0x401ba9,'path':path[_0xd4fb('0x55')](_0x85370d,_0x51f29f[0x0]),'type':_0x48e6f4,'sidebar':_0xf14c9b,'icon':_0x18d943,'adminUrl':_0x551327,'agentUrl':_0xa5acef,'scriptName':_0x3a8b74,'scriptPath':_0x527fac,'version':_0x3f3015};removeReferences(_0x58c89c,null);return db[_0xd4fb('0x35')][_0xd4fb('0x95')](_0x569e6f)[_0xd4fb('0x2b')](function(_0x287fd0){var _0x254449={'role':_0x5a04d4[_0xd4fb('0x96')][_0xd4fb('0x97')],'userProfileId':_0x5a04d4[_0xd4fb('0x96')][_0xd4fb('0x98')]};if(!_0x254449)throw new Error(_0xd4fb('0x99'));if(_0x254449[_0xd4fb('0x97')]==='user'){var _0x33e9c1=_0x287fd0[_0xd4fb('0x2d')]({'plain':!![]});return db[_0xd4fb('0x9a')]['find']({'where':{'name':_0xd4fb('0x2e'),'userProfileId':_0x254449[_0xd4fb('0x98')]},'raw':!![]})[_0xd4fb('0x2b')](function(_0x2e4a48){if(_0x2e4a48&&_0x2e4a48[_0xd4fb('0x9b')]===0x0){return db[_0xd4fb('0x2f')]['create']({'name':_0x33e9c1['name'],'resourceId':_0x33e9c1['id'],'type':_0x2e4a48[_0xd4fb('0x32')],'sectionId':_0x2e4a48['id']},{})['then'](function(){return _0x287fd0;});}else{return _0x287fd0;}})[_0xd4fb('0x4b')](function(_0x4d7f21){logger[_0xd4fb('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d7f21);throw _0x4d7f21;});}return _0x287fd0;})['then'](respondWithResult(_0xe96b2f,null))[_0xd4fb('0x4b')](handleError(_0xe96b2f,null));}});}catch(_0x5e83d2){_0xe96b2f[_0xd4fb('0x24')](0x1f4)[_0xd4fb('0x9c')](_0x5e83d2);}};function removeReferences(_0x2957e3,_0x222f79){try{if(_0x2957e3){fs['unlinkSync'](_0x2957e3);logger[_0xd4fb('0x6c')](_0xd4fb('0x9d'));}if(_0x222f79){rimraf(_0x222f79,function(){});logger[_0xd4fb('0x6c')](_0xd4fb('0x9e'));}}catch(_0x6eb445){logger[_0xd4fb('0x31')](_0x6eb445);}}exports[_0xd4fb('0x2a')]=function(_0x386d4e,_0x16e16b,_0x1765cf){return db['Plugin'][_0xd4fb('0x51')]({'where':{'id':_0x386d4e[_0xd4fb('0x53')]['id']}})[_0xd4fb('0x2b')](handleEntityNotFound(_0x16e16b,null))[_0xd4fb('0x2b')](saveUpdates(_0x386d4e[_0xd4fb('0x96')],null))[_0xd4fb('0x2b')](respondWithResult(_0x16e16b,null))[_0xd4fb('0x4b')](handleError(_0x16e16b,null));};exports['delete']=function(_0x513df7,_0x3e7f1a,_0x16e025){return db[_0xd4fb('0x35')][_0xd4fb('0x51')]({'where':{'id':_0x513df7[_0xd4fb('0x53')]['id']}})[_0xd4fb('0x2b')](function(_0x1084cf){if(_0x1084cf){return _0x1084cf[_0xd4fb('0x2c')]();}})[_0xd4fb('0x2b')](function(_0x3eeda1){rimraf(path[_0xd4fb('0x55')](config[_0xd4fb('0x56')],_0xd4fb('0x63'),path['dirname'](_0x3eeda1['path'])),function(){});return _0x3eeda1;})[_0xd4fb('0x2b')](handleEntityNotFound(_0x3e7f1a,null))[_0xd4fb('0x2b')](respondWithStatusCode(_0x3e7f1a,null))[_0xd4fb('0x4b')](handleError(_0x3e7f1a,null));};exports[_0xd4fb('0x9f')]=function(_0x54f681,_0x3a0183,_0x1164b6){return BPromise[_0xd4fb('0xa0')]()[_0xd4fb('0x2b')](function(){if(!_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0x54')]){throw new Error(_0xd4fb('0xa1'));}if(!_0x54f681['query'][_0xd4fb('0xa2')]){throw new Error(_0xd4fb('0xa3'));}var _0x23e8dc=_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa4')]?_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa4')]+':'+_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa2')]:_0xd4fb('0xa5')+_0x54f681['query'][_0xd4fb('0xa2')];var _0x590255=_0x54f681[_0xd4fb('0x3b')]['json']?_0x54f681['query'][_0xd4fb('0x25')]:!![];var _0x58e20c=_0x54f681['query'][_0xd4fb('0xa6')]?_0x54f681[_0xd4fb('0x3b')][_0xd4fb('0xa6')]:null;var _0x102447={'method':_0x54f681[_0xd4fb('0xa7')],'uri':util[_0xd4fb('0x69')](_0xd4fb('0xa8'),_0x23e8dc,_0x54f681['query'][_0xd4fb('0x54')]),'json':_0x590255,'resolveWithFullResponse':!![],'encoding':_0x58e20c,'qs':_0x54f681['query']};if(_0x54f681[_0xd4fb('0xa9')]){_0x102447[_0xd4fb('0xa9')]=_0x54f681['headers'];if(_0x102447[_0xd4fb('0xa9')][_0xd4fb('0xaa')]){delete _0x102447[_0xd4fb('0xa9')][_0xd4fb('0xaa')];}}if(_0x102447[_0xd4fb('0xa9')][_0xd4fb('0xab')]){delete _0x102447[_0xd4fb('0xa9')]['content-type'];}return rp(_0x102447);})[_0xd4fb('0x2b')](function(_0x45d66c){if(_0x45d66c){_0x3a0183[_0xd4fb('0xac')](_0x45d66c[_0xd4fb('0xa9')]);logger['info'](_0x45d66c[_0xd4fb('0x96')]);if(_['endsWith'](_0x54f681[_0xd4fb('0x3b')]['path'],_0xd4fb('0x52'))&&_0x45d66c['statusCode']==0x1f4){return _0x3a0183[_0xd4fb('0x23')](_0x45d66c['statusCode']);}else{return _0x3a0183[_0xd4fb('0x24')](_0x45d66c[_0xd4fb('0xad')])[_0xd4fb('0x9c')](_0x45d66c[_0xd4fb('0x96')]);}}else{return _0x3a0183[_0xd4fb('0x23')](0xc8);}})[_0xd4fb('0x4b')](handleError(_0x3a0183,null));};exports[_0xd4fb('0xae')]=function(_0x4da78f,_0x128375,_0x1a1946){return BPromise[_0xd4fb('0xa0')]()[_0xd4fb('0x2b')](function(){if(!_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0x54')]){throw new Error(_0xd4fb('0xa1'));}if(!_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x38b8b5=_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa4')]?_0x4da78f['query']['hostname']+':'+_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa2')]:_0xd4fb('0xa5')+_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa2')];var _0xf5e838=_0x4da78f[_0xd4fb('0x3b')]['json']?_0x4da78f[_0xd4fb('0x3b')]['json']:!![];var _0x1bd60d=_0x4da78f[_0xd4fb('0x3b')][_0xd4fb('0xa6')]?_0x4da78f[_0xd4fb('0x3b')]['encoding']:null;var _0x270f1f={'method':_0x4da78f[_0xd4fb('0xa7')],'uri':util[_0xd4fb('0x69')]('%s%s',_0x38b8b5,_0x4da78f['query']['path']),'json':_0xf5e838,'resolveWithFullResponse':!![],'encoding':_0x1bd60d,'body':_0x4da78f[_0xd4fb('0x96')]};if(_0x4da78f[_0xd4fb('0xa9')]){_0x270f1f['headers']=_0x4da78f[_0xd4fb('0xa9')];if(_0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xaa')]){delete _0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xaa')];}}if(_0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xab')]){delete _0x270f1f[_0xd4fb('0xa9')][_0xd4fb('0xab')];}return rp(_0x270f1f);})[_0xd4fb('0x2b')](function(_0x1f807e){if(_0x1f807e){_0x128375[_0xd4fb('0xac')](_0x1f807e[_0xd4fb('0xa9')]);logger['info'](_0x1f807e[_0xd4fb('0x96')]);return _0x128375[_0xd4fb('0x24')](_0x1f807e['statusCode'])[_0xd4fb('0x9c')](_0x1f807e[_0xd4fb('0x96')]);}else{return _0x128375[_0xd4fb('0x23')](0xc8);}})[_0xd4fb('0x4b')](handleError(_0x128375,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 572f0c6..926372b 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(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x7b84,0x17c));var _0x47b8=function(_0x527b0b,_0xc537ce){_0x527b0b=_0x527b0b-0x0;var _0x413aed=_0x7b84[_0x527b0b];return _0x413aed;};'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 _0xcf2f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x524621,_0x6595c){var _0x228276=function(_0x3514e6){while(--_0x3514e6){_0x524621['push'](_0x524621['shift']());}};_0x228276(++_0x6595c);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x390fea,_0x25a6ed){_0x390fea=_0x390fea-0x0;var _0x412196=_0xcf2f[_0x390fea];return _0x412196;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var Plugin=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xfcf2('0x3')](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':'update','afterDestroy':_0xfcf2('0x5')};function emitEvent(_0x12ddf5){return function(_0x1e3661,_0x34bcaf,_0x179e60){PluginEvents[_0xfcf2('0x6')](_0x12ddf5+':'+_0x1e3661['id'],_0x1e3661);PluginEvents[_0xfcf2('0x6')](_0x12ddf5,_0x1e3661);_0x179e60(null);};}for(var e in events){if(events[_0xfcf2('0x7')](e)){var event=events[e];Plugin[_0xfcf2('0x8')](e,emitEvent(event));}}module[_0xfcf2('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index d861ae9..4622aa3 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c12=['./plugin.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa7215f,_0x3db0d2){var _0x29df74=function(_0x14fc00){while(--_0x14fc00){_0xa7215f['push'](_0xa7215f['shift']());}};_0x29df74(++_0x3db0d2);}(_0x5c12,0x188));var _0x25c1=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x5c12[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x58509c,_0x229042){var _0x285ef5=function(_0x45c713){while(--_0x45c713){_0x58509c['push'](_0x58509c['shift']());}};_0x285ef5(++_0x229042);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5b9aeb,_0x4cf4e1){_0x5b9aeb=_0x5b9aeb-0x0;var _0x22c26e=_0x9c5a[_0x5b9aeb];return _0x22c26e;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./plugin.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index f8b9ff6..9944a82 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 _0x248f=['body','options','info','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','CreatePlugin','Plugin','create'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x248f,0xb2));var _0xf248=function(_0x1fe4f2,_0xba736b){_0x1fe4f2=_0x1fe4f2-0x0;var _0x5d9333=_0x248f[_0x1fe4f2];return _0x5d9333;};'use strict';var _=require(_0xf248('0x0'));var util=require('util');var moment=require(_0xf248('0x1'));var BPromise=require(_0xf248('0x2'));var rs=require(_0xf248('0x3'));var fs=require('fs');var Redis=require(_0xf248('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf248('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf248('0x6'));var jayson=require(_0xf248('0x7'));var client=jayson[_0xf248('0x8')]['http']({'port':0x232a});config[_0xf248('0x9')]=_[_0xf248('0xa')](config[_0xf248('0x9')],{'host':_0xf248('0xb'),'port':0x18eb});var socket=require(_0xf248('0xc'))(new Redis(config[_0xf248('0x9')]));require(_0xf248('0xd'))[_0xf248('0xe')](socket);function respondWithRpcPromise(_0x5b78ab,_0x1b29a4,_0x12480e){return new BPromise(function(_0x4b4b71,_0x174fd1){return client['request'](_0x5b78ab,_0x12480e)[_0xf248('0xf')](function(_0x38a1c5){logger['info'](_0xf248('0x10'),_0x1b29a4,'request\x20sent');logger['debug'](_0xf248('0x11'),_0x1b29a4,'request\x20sent',JSON['stringify'](_0x38a1c5));if(_0x38a1c5['error']){if(_0x38a1c5['error']['code']===0x1f4){logger[_0xf248('0x12')](_0xf248('0x10'),_0x1b29a4,_0x38a1c5[_0xf248('0x12')]['message']);return _0x174fd1(_0x38a1c5['error'][_0xf248('0x13')]);}logger[_0xf248('0x12')](_0xf248('0x10'),_0x1b29a4,_0x38a1c5[_0xf248('0x12')]['message']);return _0x4b4b71(_0x38a1c5[_0xf248('0x12')][_0xf248('0x13')]);}else{logger['info'](_0xf248('0x10'),_0x1b29a4,_0xf248('0x14'));_0x4b4b71(_0x38a1c5['result'][_0xf248('0x13')]);}})[_0xf248('0x15')](function(_0x31918e){logger[_0xf248('0x12')](_0xf248('0x10'),_0x1b29a4,_0x31918e);_0x174fd1(_0x31918e);});});}exports[_0xf248('0x16')]=function(_0x5e1371){var _0x2df2fc=this;return new Promise(function(_0x2b4a24,_0x2f7983){return db[_0xf248('0x17')][_0xf248('0x18')](_0x5e1371[_0xf248('0x19')],{'raw':_0x5e1371[_0xf248('0x1a')]?_0x5e1371[_0xf248('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf248('0xf')](function(_0x4f0ce9){logger[_0xf248('0x1b')](_0xf248('0x16'),_0x5e1371);logger[_0xf248('0x1c')]('CreatePlugin',_0x5e1371,JSON['stringify'](_0x4f0ce9));_0x2b4a24(_0x4f0ce9);})[_0xf248('0x15')](function(_0x49a23d){logger[_0xf248('0x12')](_0xf248('0x16'),_0x49a23d['message'],_0x5e1371);_0x2f7983(_0x2df2fc[_0xf248('0x12')](0x1f4,_0x49a23d[_0xf248('0x13')]));});});}; \ No newline at end of file +var _0x54df=['catch','CreatePlugin','Plugin','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x54df,0x65));var _0xf54d=function(_0x4b124d,_0xefd723){_0x4b124d=_0x4b124d-0x0;var _0x44e812=_0x54df[_0x4b124d];return _0x44e812;};'use strict';var _=require(_0xf54d('0x0'));var util=require(_0xf54d('0x1'));var moment=require(_0xf54d('0x2'));var BPromise=require(_0xf54d('0x3'));var rs=require(_0xf54d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf54d('0x5'))['db'];var utils=require(_0xf54d('0x6'));var logger=require(_0xf54d('0x7'))('rpc');var config=require(_0xf54d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf54d('0x9')]['http']({'port':0x232a});config[_0xf54d('0xa')]=_[_0xf54d('0xb')](config['redis'],{'host':_0xf54d('0xc'),'port':0x18eb});var socket=require(_0xf54d('0xd'))(new Redis(config[_0xf54d('0xa')]));require('./plugin.socket')[_0xf54d('0xe')](socket);function respondWithRpcPromise(_0x48c4de,_0x13601f,_0x3f8ad7){return new BPromise(function(_0x25bc35,_0x3abdfe){return client[_0xf54d('0xf')](_0x48c4de,_0x3f8ad7)[_0xf54d('0x10')](function(_0x98b6a9){logger[_0xf54d('0x11')](_0xf54d('0x12'),_0x13601f,_0xf54d('0x13'));logger[_0xf54d('0x14')](_0xf54d('0x15'),_0x13601f,_0xf54d('0x13'),JSON[_0xf54d('0x16')](_0x98b6a9));if(_0x98b6a9[_0xf54d('0x17')]){if(_0x98b6a9[_0xf54d('0x17')][_0xf54d('0x18')]===0x1f4){logger[_0xf54d('0x17')]('Plugin,\x20%s,\x20%s',_0x13601f,_0x98b6a9['error'][_0xf54d('0x19')]);return _0x3abdfe(_0x98b6a9[_0xf54d('0x17')]['message']);}logger[_0xf54d('0x17')](_0xf54d('0x12'),_0x13601f,_0x98b6a9[_0xf54d('0x17')][_0xf54d('0x19')]);return _0x25bc35(_0x98b6a9[_0xf54d('0x17')][_0xf54d('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x13601f,'request\x20sent');_0x25bc35(_0x98b6a9[_0xf54d('0x1a')][_0xf54d('0x19')]);}})[_0xf54d('0x1b')](function(_0x4c4ce8){logger[_0xf54d('0x17')](_0xf54d('0x12'),_0x13601f,_0x4c4ce8);_0x3abdfe(_0x4c4ce8);});});}exports[_0xf54d('0x1c')]=function(_0x32cbc6){var _0x4faaf1=this;return new Promise(function(_0x3b460b,_0x23feaa){return db[_0xf54d('0x1d')]['create'](_0x32cbc6[_0xf54d('0x1e')],{'raw':_0x32cbc6[_0xf54d('0x1f')]?_0x32cbc6[_0xf54d('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53c412){logger['info'](_0xf54d('0x1c'),_0x32cbc6);logger[_0xf54d('0x14')](_0xf54d('0x1c'),_0x32cbc6,JSON['stringify'](_0x53c412));_0x3b460b(_0x53c412);})[_0xf54d('0x1b')](function(_0x1befba){logger[_0xf54d('0x17')](_0xf54d('0x1c'),_0x1befba[_0xf54d('0x19')],_0x32cbc6);_0x23feaa(_0x4faaf1[_0xf54d('0x17')](0x1f4,_0x1befba[_0xf54d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1980a4b..b9b8e59 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 _0x6c1f=['register','plugin:','save','remove','update','emit'];(function(_0x2b863a,_0x3b0871){var _0x2e2783=function(_0x188866){while(--_0x188866){_0x2b863a['push'](_0x2b863a['shift']());}};_0x2e2783(++_0x3b0871);}(_0x6c1f,0x158));var _0xf6c1=function(_0x22d7ae,_0x588bec){_0x22d7ae=_0x22d7ae-0x0;var _0x4155da=_0x6c1f[_0x22d7ae];return _0x4155da;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xf6c1('0x0'),_0xf6c1('0x1'),_0xf6c1('0x2')];function createListener(_0x465107,_0x118ec3){return function(_0x30e6e4){_0x118ec3[_0xf6c1('0x3')](_0x465107,_0x30e6e4);};}function removeListener(_0x348e05,_0x2fd698){return function(){PluginEvents['removeListener'](_0x348e05,_0x2fd698);};}exports[_0xf6c1('0x4')]=function(_0x2819ba){for(var _0x548416=0x0,_0x5a29bc=events['length'];_0x548416<_0x5a29bc;_0x548416++){var _0x2f5f21=events[_0x548416];var _0x5cd5de=createListener(_0xf6c1('0x5')+_0x2f5f21,_0x2819ba);PluginEvents['on'](_0x2f5f21,_0x5cd5de);}}; \ No newline at end of file +var _0xefe8=['removeListener','length','plugin:','./plugin.events','remove','emit'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xefe8,0xc3));var _0x8efe=function(_0x454f02,_0x32ce79){_0x454f02=_0x454f02-0x0;var _0x3369f7=_0xefe8[_0x454f02];return _0x3369f7;};'use strict';var PluginEvents=require(_0x8efe('0x0'));var events=['save',_0x8efe('0x1'),'update'];function createListener(_0x5d0fa2,_0x1d85e8){return function(_0x2b8534){_0x1d85e8[_0x8efe('0x2')](_0x5d0fa2,_0x2b8534);};}function removeListener(_0xc4b454,_0x3de15f){return function(){PluginEvents[_0x8efe('0x3')](_0xc4b454,_0x3de15f);};}exports['register']=function(_0x4e7d5a){for(var _0x7ad446=0x0,_0x29a478=events[_0x8efe('0x4')];_0x7ad446<_0x29a478;_0x7ad446++){var _0x583885=events[_0x7ad446];var _0x1de1de=createListener(_0x8efe('0x5')+_0x583885,_0x4e7d5a);PluginEvents['on'](_0x583885,_0x1de1de);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8e876b2..5bb6a0d 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 _0xb037=['index','/:id','isAuthenticated','show','update','delete','destroy','exports','express','Router','./pm2.controller','get'];(function(_0x56f80e,_0xc1e088){var _0xbff200=function(_0x4145fa){while(--_0x4145fa){_0x56f80e['push'](_0x56f80e['shift']());}};_0xbff200(++_0xc1e088);}(_0xb037,0x1c4));var _0x7b03=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xb037[_0x257642];return _0x3d813b;};'use strict';var express=require(_0x7b03('0x0'));var router=express[_0x7b03('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7b03('0x2'));router[_0x7b03('0x3')]('/',auth['isAuthenticated'](),controller[_0x7b03('0x4')]);router['get'](_0x7b03('0x5'),auth[_0x7b03('0x6')](),controller[_0x7b03('0x7')]);router['post']('/',auth[_0x7b03('0x6')](),controller['create']);router['put'](_0x7b03('0x5'),auth[_0x7b03('0x6')](),controller[_0x7b03('0x8')]);router[_0x7b03('0x9')](_0x7b03('0x5'),auth[_0x7b03('0x6')](),controller[_0x7b03('0xa')]);module[_0x7b03('0xb')]=router; \ No newline at end of file +var _0x2d21=['post','create','put','update','delete','/:id','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2d21,0x1e8));var _0x12d2=function(_0x3b20c2,_0x888661){_0x3b20c2=_0x3b20c2-0x0;var _0x5b4482=_0x2d21[_0x3b20c2];return _0x5b4482;};'use strict';var express=require(_0x12d2('0x0'));var router=express[_0x12d2('0x1')]();var auth=require(_0x12d2('0x2'));var controller=require(_0x12d2('0x3'));router[_0x12d2('0x4')]('/',auth[_0x12d2('0x5')](),controller[_0x12d2('0x6')]);router[_0x12d2('0x4')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x12d2('0x7')]('/',auth[_0x12d2('0x5')](),controller[_0x12d2('0x8')]);router[_0x12d2('0x9')]('/:id',auth[_0x12d2('0x5')](),controller[_0x12d2('0xa')]);router[_0x12d2('0xb')](_0x12d2('0xc'),auth[_0x12d2('0x5')](),controller[_0x12d2('0xd')]);module[_0x12d2('0xe')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 841458b..1c2845e 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 _0x417f=['then','express','motion2','length','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','catch','Unknown\x20id','lodash','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x417f,0x6d));var _0xf417=function(_0x5baa2d,_0x53c700){_0x5baa2d=_0x5baa2d-0x0;var _0x4c67e3=_0x417f[_0x5baa2d];return _0x4c67e3;};'use strict';var _=require(_0xf417('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xf417('0x1'))(_0xf417('0x2'));var path=require(_0xf417('0x3'));var exec=require('child_process')[_0xf417('0x4')];var BPromise=require(_0xf417('0x5'));function handleEntityNotFound(_0x55d32a,_0x347687){return function(_0x333f9b){if(!_0x333f9b){_0x55d32a[_0xf417('0x6')](0x194);;}return _0x333f9b;};}function respondWithResult(_0x5481ed,_0x2b4834){_0x2b4834=_0x2b4834||0xc8;return function(_0x1cb83b){if(_0x1cb83b){return _0x5481ed[_0xf417('0x7')](_0x2b4834)[_0xf417('0x8')](_0x1cb83b);}return null;};}function handleError(_0xfe02aa,_0x5e72e3){_0x5e72e3=_0x5e72e3||0x1f4;return function(_0xfa1537){logger[_0xf417('0x9')](_0xfa1537[_0xf417('0xa')]);if(_0xfa1537[_0xf417('0xb')]){delete _0xfa1537['name'];}_0xfe02aa[_0xf417('0x7')](_0x5e72e3)[_0xf417('0xc')](_0xfa1537);};}function execChildProcess(){return new BPromise(function(_0x27e478,_0x418d0f){exec(_0xf417('0xd'),function(_0x3e2313,_0x4763dd,_0x54f918){logger[_0xf417('0xe')](_0x4763dd);logger[_0xf417('0xe')](_0x54f918);if(_0x3e2313){logger[_0xf417('0x9')](_0x3e2313);return _0x418d0f(_0x3e2313);}return _0x27e478(_0x4763dd);});});}exports[_0xf417('0xf')]=function(_0x78d6da,_0x71c538){return pm2[_0xf417('0x10')]()[_0xf417('0x11')](function(_0x4606b7){if(_0x4606b7){var _0x1dedda=_['reject'](_0x4606b7,function(_0x5e47f3){return _0x5e47f3[_0xf417('0xb')]===_0xf417('0x12')||_0x5e47f3[_0xf417('0xb')]===_0xf417('0x13');});return{'rows':_0x1dedda,'count':_0x1dedda[_0xf417('0x14')]};}return null;})[_0xf417('0x11')](respondWithResult(_0x71c538,null))['catch'](handleError(_0x71c538,null));};exports[_0xf417('0x15')]=function(_0x113272,_0x2e6fc7){return pm2[_0xf417('0x16')](_0x113272[_0xf417('0x17')]['id'])[_0xf417('0x11')](respondWithResult(_0x2e6fc7,null))[_0xf417('0x11')](handleEntityNotFound(_0x2e6fc7,null))['catch'](handleError(_0x2e6fc7,null));};exports[_0xf417('0x18')]=function(_0x20c857,_0x437c9a){if(_0x20c857[_0xf417('0x19')][_0xf417('0xb')]&&_0x20c857[_0xf417('0x19')][_0xf417('0x1a')]){var _0x152234=path['join'](__dirname,_0xf417('0x1b'),_0x20c857[_0xf417('0x19')][_0xf417('0x1a')]);var _0x2554fb=process[_0xf417('0x1c')]();process[_0xf417('0x1d')](path[_0xf417('0x1e')](_0x152234));return execChildProcess()[_0xf417('0x11')](function(_0x4a4cc0){process[_0xf417('0x1d')](_0x2554fb);return pm2[_0xf417('0x1f')]({'name':_0x20c857[_0xf417('0x19')]['name'],'script':_0x152234});})[_0xf417('0x11')](function(_0x3a5ac4){pm2[_0xf417('0x20')]();return _0x3a5ac4[0x0];})['then'](respondWithResult(_0x437c9a,0xc9))['catch'](handleError(_0x437c9a,null));}else{return _0x437c9a['status'](0x1f4)[_0xf417('0xc')]({'message':_0xf417('0x21')});}};exports[_0xf417('0x22')]=function(_0x474412,_0x5c9c4f){if(_0x474412['body']['id']){delete _0x474412[_0xf417('0x19')]['id'];}var _0x595a81={'online':_0xf417('0x23'),'stopped':_0xf417('0x24')};if(_0x595a81[_0xf417('0x25')](_0x474412['body']['status'])){return pm2[_0x595a81[_0x474412['body'][_0xf417('0x7')]]](_0x474412[_0xf417('0x17')]['id'])[_0xf417('0x11')](respondWithResult(_0x5c9c4f,0xc8))['catch'](handleError(_0x5c9c4f,null));}else{return _0x5c9c4f[_0xf417('0x7')](0x1f4)[_0xf417('0xc')]({'message':_0xf417('0x26')});}};exports['destroy']=function(_0x33de56,_0x562e78){if(_0x33de56[_0xf417('0x19')]['id']){delete _0x33de56[_0xf417('0x19')]['id'];}if(_0x33de56[_0xf417('0x17')]['id']){return pm2[_0xf417('0x27')](_0x33de56[_0xf417('0x17')]['id'])[_0xf417('0x11')](function(_0x408e9f){pm2[_0xf417('0x20')]();return _0x408e9f[0x0];})[_0xf417('0x11')](respondWithResult(_0x562e78,null))[_0xf417('0x28')](handleError(_0x562e78,null));}else{return _0x562e78['status'](0x1f4)[_0xf417('0xc')]({'message':_0xf417('0x29')});}}; \ No newline at end of file +var _0xb207=['status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','create','body','script','../../files/plugins','cwd','dirname','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus'];(function(_0x251fa4,_0x3d5860){var _0x453047=function(_0x337a6f){while(--_0x337a6f){_0x251fa4['push'](_0x251fa4['shift']());}};_0x453047(++_0x3d5860);}(_0xb207,0x18a));var _0x7b20=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xb207[_0xa990b7];return _0x52c99c;};'use strict';var _=require('lodash');var pm2=require(_0x7b20('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x7b20('0x1'));var exec=require(_0x7b20('0x2'))[_0x7b20('0x3')];var BPromise=require(_0x7b20('0x4'));function handleEntityNotFound(_0x350618,_0x3f5dfc){return function(_0x57f7b4){if(!_0x57f7b4){_0x350618[_0x7b20('0x5')](0x194);;}return _0x57f7b4;};}function respondWithResult(_0x2c0014,_0x452d3d){_0x452d3d=_0x452d3d||0xc8;return function(_0xc7a089){if(_0xc7a089){return _0x2c0014[_0x7b20('0x6')](_0x452d3d)[_0x7b20('0x7')](_0xc7a089);}return null;};}function handleError(_0x1dfb10,_0x102d97){_0x102d97=_0x102d97||0x1f4;return function(_0xaf5d5b){logger[_0x7b20('0x8')](_0xaf5d5b['stack']);if(_0xaf5d5b[_0x7b20('0x9')]){delete _0xaf5d5b[_0x7b20('0x9')];}_0x1dfb10['status'](_0x102d97)[_0x7b20('0xa')](_0xaf5d5b);};}function execChildProcess(){return new BPromise(function(_0x195d59,_0x457c75){exec(_0x7b20('0xb'),function(_0x3942d3,_0x302577,_0x18b59b){logger[_0x7b20('0xc')](_0x302577);logger['info'](_0x18b59b);if(_0x3942d3){logger[_0x7b20('0x8')](_0x3942d3);return _0x457c75(_0x3942d3);}return _0x195d59(_0x302577);});});}exports[_0x7b20('0xd')]=function(_0x4faf14,_0x5f4112){return pm2[_0x7b20('0xe')]()[_0x7b20('0xf')](function(_0x396e1e){if(_0x396e1e){var _0x1d6d02=_[_0x7b20('0x10')](_0x396e1e,function(_0x4b88d9){return _0x4b88d9[_0x7b20('0x9')]===_0x7b20('0x11')||_0x4b88d9[_0x7b20('0x9')]===_0x7b20('0x12');});return{'rows':_0x1d6d02,'count':_0x1d6d02[_0x7b20('0x13')]};}return null;})[_0x7b20('0xf')](respondWithResult(_0x5f4112,null))[_0x7b20('0x14')](handleError(_0x5f4112,null));};exports[_0x7b20('0x15')]=function(_0x831d3e,_0x54808a){return pm2['describe'](_0x831d3e['params']['id'])[_0x7b20('0xf')](respondWithResult(_0x54808a,null))[_0x7b20('0xf')](handleEntityNotFound(_0x54808a,null))[_0x7b20('0x14')](handleError(_0x54808a,null));};exports[_0x7b20('0x16')]=function(_0x3b1242,_0x272d7b){if(_0x3b1242[_0x7b20('0x17')]['name']&&_0x3b1242[_0x7b20('0x17')][_0x7b20('0x18')]){var _0x127ae1=path['join'](__dirname,_0x7b20('0x19'),_0x3b1242[_0x7b20('0x17')][_0x7b20('0x18')]);var _0x514d2e=process[_0x7b20('0x1a')]();process['chdir'](path[_0x7b20('0x1b')](_0x127ae1));return execChildProcess()['then'](function(_0x20dc5c){process[_0x7b20('0x1c')](_0x514d2e);return pm2[_0x7b20('0x1d')]({'name':_0x3b1242[_0x7b20('0x17')][_0x7b20('0x9')],'script':_0x127ae1});})[_0x7b20('0xf')](function(_0x1c4ed1){pm2['dump']();return _0x1c4ed1[0x0];})[_0x7b20('0xf')](respondWithResult(_0x272d7b,0xc9))[_0x7b20('0x14')](handleError(_0x272d7b,null));}else{return _0x272d7b[_0x7b20('0x6')](0x1f4)[_0x7b20('0xa')]({'message':_0x7b20('0x1e')});}};exports[_0x7b20('0x1f')]=function(_0x25f470,_0x239f22){if(_0x25f470['body']['id']){delete _0x25f470[_0x7b20('0x17')]['id'];}var _0x484d0a={'online':_0x7b20('0x20'),'stopped':'stop'};if(_0x484d0a[_0x7b20('0x21')](_0x25f470[_0x7b20('0x17')][_0x7b20('0x6')])){return pm2[_0x484d0a[_0x25f470['body'][_0x7b20('0x6')]]](_0x25f470[_0x7b20('0x22')]['id'])['then'](respondWithResult(_0x239f22,0xc8))[_0x7b20('0x14')](handleError(_0x239f22,null));}else{return _0x239f22['status'](0x1f4)[_0x7b20('0xa')]({'message':_0x7b20('0x23')});}};exports[_0x7b20('0x24')]=function(_0x1c257c,_0x2623e7){if(_0x1c257c['body']['id']){delete _0x1c257c[_0x7b20('0x17')]['id'];}if(_0x1c257c[_0x7b20('0x22')]['id']){return pm2[_0x7b20('0x25')](_0x1c257c[_0x7b20('0x22')]['id'])['then'](function(_0x369e25){pm2[_0x7b20('0x26')]();return _0x369e25[0x0];})[_0x7b20('0xf')](respondWithResult(_0x2623e7,null))['catch'](handleError(_0x2623e7,null));}else{return _0x2623e7[_0x7b20('0x6')](0x1f4)[_0x7b20('0xa')]({'message':_0x7b20('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b3c3ec5..d360e66 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 _0xd75e=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','express'];(function(_0x757f83,_0x5b3ce4){var _0x2416a3=function(_0x39e4ee){while(--_0x39e4ee){_0x757f83['push'](_0x757f83['shift']());}};_0x2416a3(++_0x5b3ce4);}(_0xd75e,0x89));var _0xed75=function(_0xc8d73b,_0x533590){_0xc8d73b=_0xc8d73b-0x0;var _0x466f09=_0xd75e[_0xc8d73b];return _0x466f09;};'use strict';var multer=require(_0xed75('0x0'));var util=require(_0xed75('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed75('0x2'));var router=express[_0xed75('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xed75('0x4'));var config=require(_0xed75('0x5'));module[_0xed75('0x6')]=router; \ No newline at end of file +var _0xaa5d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaa5d,0xb7));var _0xdaa5=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xaa5d[_0x1f1511];return _0x1d9ab8;};'use strict';var multer=require('multer');var util=require(_0xdaa5('0x0'));var path=require(_0xdaa5('0x1'));var timeout=require(_0xdaa5('0x2'));var express=require(_0xdaa5('0x3'));var router=express[_0xdaa5('0x4')]();var auth=require(_0xdaa5('0x5'));var interaction=require(_0xdaa5('0x6'));var config=require('../../config/environment');module[_0xdaa5('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9695306..c5d2429 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 _0x3faf=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x47b472,_0x33e6ba){var _0x1d3567=function(_0x4f23c1){while(--_0x4f23c1){_0x47b472['push'](_0x47b472['shift']());}};_0x1d3567(++_0x33e6ba);}(_0x3faf,0x1e8));var _0xf3fa=function(_0x3fa5f7,_0xfc23ec){_0x3fa5f7=_0x3fa5f7-0x0;var _0x5544bd=_0x3faf[_0x3fa5f7];return _0x5544bd;};'use strict';var Sequelize=require(_0xf3fa('0x0'));module[_0xf3fa('0x1')]={'state':{'type':Sequelize[_0xf3fa('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf3fa('0x3')]},'scheduledat':{'type':Sequelize[_0xf3fa('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf3fa('0x4')]},'responsetime':{'type':Sequelize[_0xf3fa('0x4')]},'ringtime':{'type':Sequelize[_0xf3fa('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf3fa('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4de0=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x12283c,_0x379df9){var _0x536073=function(_0x1101a4){while(--_0x1101a4){_0x12283c['push'](_0x12283c['shift']());}};_0x536073(++_0x379df9);}(_0x4de0,0x198));var _0x04de=function(_0x4b05ee,_0x5e84e2){_0x4b05ee=_0x4b05ee-0x0;var _0x586d07=_0x4de0[_0x4b05ee];return _0x586d07;};'use strict';var Sequelize=require(_0x04de('0x0'));module[_0x04de('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x04de('0x2')]},'scheduledat':{'type':Sequelize[_0x04de('0x3')]},'uniqueid':{'type':Sequelize[_0x04de('0x2')]},'starttime':{'type':Sequelize[_0x04de('0x3')]},'responsetime':{'type':Sequelize[_0x04de('0x3')]},'ringtime':{'type':Sequelize[_0x04de('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x04de('0x2')]},'campaigntype':{'type':Sequelize[_0x04de('0x2')]},'membername':{'type':Sequelize[_0x04de('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 65006e9..4ab4d79 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 _0x2b2e=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','moment','bluebird','request-promise'];(function(_0x357ef2,_0x50fff8){var _0x4fb7b9=function(_0x4e6e50){while(--_0x4e6e50){_0x357ef2['push'](_0x357ef2['shift']());}};_0x4fb7b9(++_0x50fff8);}(_0x2b2e,0xba));var _0xe2b2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2b2e[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xe2b2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe2b2('0x1'));var BPromise=require(_0xe2b2('0x2'));var rp=require(_0xe2b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe2b2('0x4'));var attributes=require(_0xe2b2('0x5'));module[_0xe2b2('0x6')]=function(_0x5a3de5,_0x1d6dfb){return _0x5a3de5[_0xe2b2('0x7')](_0xe2b2('0x8'),attributes,{'tableName':_0xe2b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd099=['request-promise','path','rimraf','../../config/environment','define','ReportAgentPreview','report_agent_preview','../../config/logger','api','moment','bluebird'];(function(_0x503055,_0x304102){var _0x30fb63=function(_0x400662){while(--_0x400662){_0x503055['push'](_0x503055['shift']());}};_0x30fb63(++_0x304102);}(_0xd099,0x1d5));var _0x9d09=function(_0x4b90c2,_0xaae537){_0x4b90c2=_0x4b90c2-0x0;var _0x59b4c0=_0xd099[_0x4b90c2];return _0x59b4c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d09('0x0'))(_0x9d09('0x1'));var moment=require(_0x9d09('0x2'));var BPromise=require(_0x9d09('0x3'));var rp=require(_0x9d09('0x4'));var fs=require('fs');var path=require(_0x9d09('0x5'));var rimraf=require(_0x9d09('0x6'));var config=require(_0x9d09('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0xbd85de,_0x5ab2ef){return _0xbd85de[_0x9d09('0x8')](_0x9d09('0x9'),attributes,{'tableName':_0x9d09('0xa'),'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 c0075b5..ca3d5a9 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 _0x93cd=['stringify','error','message','result','catch','ReportAgentPreview','options','raw','CreateReportAgentPreview','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x3b0550,_0x3eede2){var _0xea40ee=function(_0x182c3b){while(--_0x182c3b){_0x3b0550['push'](_0x3b0550['shift']());}};_0xea40ee(++_0x3eede2);}(_0x93cd,0x14f));var _0xd93c=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x93cd[_0x3f0b30];return _0x2748a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd93c('0x0'));var BPromise=require(_0xd93c('0x1'));var rs=require(_0xd93c('0x2'));var fs=require('fs');var Redis=require(_0xd93c('0x3'));var db=require(_0xd93c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd93c('0x5'))(_0xd93c('0x6'));var config=require(_0xd93c('0x7'));var jayson=require(_0xd93c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6a2a,_0x4c301d,_0x46c941){return new BPromise(function(_0x403636,_0x5abaf6){return client[_0xd93c('0x9')](_0x4d6a2a,_0x46c941)[_0xd93c('0xa')](function(_0x21ae33){logger[_0xd93c('0xb')](_0xd93c('0xc'),_0x4c301d,_0xd93c('0xd'));logger['debug'](_0xd93c('0xe'),_0x4c301d,_0xd93c('0xd'),JSON[_0xd93c('0xf')](_0x21ae33));if(_0x21ae33['error']){if(_0x21ae33[_0xd93c('0x10')]['code']===0x1f4){logger[_0xd93c('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c301d,_0x21ae33[_0xd93c('0x10')][_0xd93c('0x11')]);return _0x5abaf6(_0x21ae33['error'][_0xd93c('0x11')]);}logger[_0xd93c('0x10')](_0xd93c('0xc'),_0x4c301d,_0x21ae33[_0xd93c('0x10')]['message']);return _0x403636(_0x21ae33['error']['message']);}else{logger['info'](_0xd93c('0xc'),_0x4c301d,_0xd93c('0xd'));_0x403636(_0x21ae33[_0xd93c('0x12')]['message']);}})[_0xd93c('0x13')](function(_0x5b2096){logger[_0xd93c('0x10')](_0xd93c('0xc'),_0x4c301d,_0x5b2096);_0x5abaf6(_0x5b2096);});});}exports['CreateReportAgentPreview']=function(_0x3fd2a9){var _0x4ae622=this;return new Promise(function(_0x44251a,_0xc25047){return db[_0xd93c('0x14')]['create'](_0x3fd2a9['body'],{'raw':_0x3fd2a9[_0xd93c('0x15')]?_0x3fd2a9[_0xd93c('0x15')][_0xd93c('0x16')]===undefined?!![]:![]:!![]})[_0xd93c('0xa')](function(_0x20d632){logger['info'](_0xd93c('0x17'),_0x3fd2a9);logger[_0xd93c('0x18')](_0xd93c('0x17'),_0x3fd2a9,JSON['stringify'](_0x20d632));_0x44251a(_0x20d632);})['catch'](function(_0x1c0acf){logger['error'](_0xd93c('0x17'),_0x1c0acf[_0xd93c('0x11')],_0x3fd2a9);_0xc25047(_0x4ae622[_0xd93c('0x10')](0x1f4,_0x1c0acf[_0xd93c('0x11')]));});});}; \ No newline at end of file +var _0x8517=['stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x8517,0x1d3));var _0x7851=function(_0x3f2e94,_0x591428){_0x3f2e94=_0x3f2e94-0x0;var _0x18349c=_0x8517[_0x3f2e94];return _0x18349c;};'use strict';var _=require('lodash');var util=require(_0x7851('0x0'));var moment=require('moment');var BPromise=require(_0x7851('0x1'));var rs=require(_0x7851('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7851('0x3'))['db'];var utils=require(_0x7851('0x4'));var logger=require('../../config/logger')(_0x7851('0x5'));var config=require('../../config/environment');var jayson=require(_0x7851('0x6'));var client=jayson[_0x7851('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13369d,_0x506fb4,_0x135b5f){return new BPromise(function(_0x2b382b,_0x150f78){return client['request'](_0x13369d,_0x135b5f)[_0x7851('0x8')](function(_0x35316d){logger[_0x7851('0x9')](_0x7851('0xa'),_0x506fb4,'request\x20sent');logger['debug'](_0x7851('0xb'),_0x506fb4,_0x7851('0xc'),JSON[_0x7851('0xd')](_0x35316d));if(_0x35316d[_0x7851('0xe')]){if(_0x35316d['error']['code']===0x1f4){logger[_0x7851('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x506fb4,_0x35316d['error'][_0x7851('0xf')]);return _0x150f78(_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);}logger[_0x7851('0xe')](_0x7851('0xa'),_0x506fb4,_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);return _0x2b382b(_0x35316d[_0x7851('0xe')][_0x7851('0xf')]);}else{logger[_0x7851('0x9')](_0x7851('0xa'),_0x506fb4,_0x7851('0xc'));_0x2b382b(_0x35316d[_0x7851('0x10')][_0x7851('0xf')]);}})[_0x7851('0x11')](function(_0x184a30){logger[_0x7851('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x506fb4,_0x184a30);_0x150f78(_0x184a30);});});}exports[_0x7851('0x12')]=function(_0x18763d){var _0x10781c=this;return new Promise(function(_0x239eeb,_0x456ba1){return db[_0x7851('0x13')][_0x7851('0x14')](_0x18763d[_0x7851('0x15')],{'raw':_0x18763d[_0x7851('0x16')]?_0x18763d['options']['raw']===undefined?!![]:![]:!![]})[_0x7851('0x8')](function(_0x8476f){logger[_0x7851('0x9')](_0x7851('0x12'),_0x18763d);logger[_0x7851('0x17')](_0x7851('0x12'),_0x18763d,JSON[_0x7851('0xd')](_0x8476f));_0x239eeb(_0x8476f);})[_0x7851('0x11')](function(_0x563199){logger['error'](_0x7851('0x12'),_0x563199[_0x7851('0xf')],_0x18763d);_0x456ba1(_0x10781c['error'](0x1f4,_0x563199[_0x7851('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7edd0ee..df0bcf3 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 _0xcfb8=['/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','/agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xcfb8,0x192));var _0x8cfb=function(_0x524c72,_0x4f6bd9){_0x524c72=_0x524c72-0x0;var _0x336f36=_0xcfb8[_0x524c72];return _0x336f36;};'use strict';var multer=require(_0x8cfb('0x0'));var util=require(_0x8cfb('0x1'));var path=require(_0x8cfb('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x8cfb('0x3'));router[_0x8cfb('0x4')](_0x8cfb('0x5'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x8cfb('0x4')](_0x8cfb('0x6'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x8')]);router[_0x8cfb('0x4')](_0x8cfb('0x9'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0xa')]);router['get'](_0x8cfb('0xb'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0xc')]);router[_0x8cfb('0x4')](_0x8cfb('0xd'),auth[_0x8cfb('0x7')](),controller['chatQueues']);router[_0x8cfb('0x4')](_0x8cfb('0xe'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0xf')]);router[_0x8cfb('0x4')](_0x8cfb('0x10'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x11')]);router[_0x8cfb('0x4')](_0x8cfb('0x12'),auth[_0x8cfb('0x7')](),controller['openchannelQueues']);router[_0x8cfb('0x4')](_0x8cfb('0x13'),auth[_0x8cfb('0x7')](),controller['smsQueues']);router['get'](_0x8cfb('0x14'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x15')]);router[_0x8cfb('0x4')](_0x8cfb('0x16'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x17')]);router[_0x8cfb('0x4')](_0x8cfb('0x18'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x19')]);router[_0x8cfb('0x4')]('/voice/queues/channels',auth[_0x8cfb('0x7')](),controller['voiceQueuesChannels']);router[_0x8cfb('0x4')](_0x8cfb('0x1a'),auth['isAuthenticated'](),controller[_0x8cfb('0x1b')]);router[_0x8cfb('0x4')](_0x8cfb('0x1c'),auth['isAuthenticated'](),controller[_0x8cfb('0x1d')]);router[_0x8cfb('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x8cfb('0x1e')]);router[_0x8cfb('0x4')](_0x8cfb('0x1f'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x20')]);router[_0x8cfb('0x4')]('/outbound',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x21')]);router['get'](_0x8cfb('0x22'),auth[_0x8cfb('0x7')](),controller['outboundChannels']);router[_0x8cfb('0x4')](_0x8cfb('0x23'),auth[_0x8cfb('0x7')](),controller['agents']);router[_0x8cfb('0x24')]('/agents/:id/capacity',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x25')]);router[_0x8cfb('0x4')](_0x8cfb('0x26'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x27')]);router[_0x8cfb('0x4')](_0x8cfb('0x28'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x29')]);router[_0x8cfb('0x4')](_0x8cfb('0x2a'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x2b')]);router[_0x8cfb('0x4')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x8cfb('0x2c')]);router[_0x8cfb('0x4')]('/chat/queues/waitinginteractions',auth[_0x8cfb('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0x8cfb('0x4')](_0x8cfb('0x2d'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x2e')]);router[_0x8cfb('0x4')](_0x8cfb('0x2f'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x8cfb('0x4')](_0x8cfb('0x30'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x31')]);router[_0x8cfb('0x4')](_0x8cfb('0x32'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x33')]);router[_0x8cfb('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0x8cfb('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x8cfb('0x4')](_0x8cfb('0x34'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x35')]);router[_0x8cfb('0x36')](_0x8cfb('0x37'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x38')](_0x8cfb('0x39')));router['get'](_0x8cfb('0x3a'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x3b')]);router[_0x8cfb('0x36')](_0x8cfb('0x3c'),auth[_0x8cfb('0x7')](),controller['queueNotify']('chat'));router[_0x8cfb('0x4')]('/chat/queues/:id',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x3d')]);router[_0x8cfb('0x36')](_0x8cfb('0x3e'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x38')]('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x8cfb('0x3f')]);router[_0x8cfb('0x36')](_0x8cfb('0x40'),auth[_0x8cfb('0x7')](),controller['queueNotify']('openchannel'));router['get'](_0x8cfb('0x41'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x42')]);router[_0x8cfb('0x36')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8cfb('0x38')](_0x8cfb('0x43')));router[_0x8cfb('0x36')](_0x8cfb('0x44'),auth['isAuthenticated'](),controller[_0x8cfb('0x38')](_0x8cfb('0x45')));router['get']('/sms/queues/:id',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x46')]);router[_0x8cfb('0x4')](_0x8cfb('0x47'),auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x48')]);router[_0x8cfb('0x36')]('/agents/:id/notify',auth[_0x8cfb('0x7')](),controller[_0x8cfb('0x49')]);module[_0x8cfb('0x4a')]=router; \ No newline at end of file +var _0xfde0=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','outboundChannels','agents','put','/telephones','/trunks','trunks','campaigns','/fax/accounts','chatQueuesWaitingInteractions'];(function(_0x59cc72,_0x11f2f9){var _0x218624=function(_0x40f945){while(--_0x40f945){_0x59cc72['push'](_0x59cc72['shift']());}};_0x218624(++_0x11f2f9);}(_0xfde0,0x1b0));var _0x0fde=function(_0xf570f7,_0x29c76a){_0xf570f7=_0xf570f7-0x0;var _0x4e4105=_0xfde0[_0xf570f7];return _0x4e4105;};'use strict';var multer=require('multer');var util=require(_0x0fde('0x0'));var path=require(_0x0fde('0x1'));var express=require(_0x0fde('0x2'));var router=express[_0x0fde('0x3')]();var auth=require(_0x0fde('0x4'));var controller=require('./rpc.controller');router['get'](_0x0fde('0x5'),auth[_0x0fde('0x6')](),controller['voiceChannels']);router[_0x0fde('0x7')](_0x0fde('0x8'),auth['isAuthenticated'](),controller[_0x0fde('0x9')]);router[_0x0fde('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x0fde('0x6')](),controller[_0x0fde('0xa')]);router[_0x0fde('0x7')](_0x0fde('0xb'),auth['isAuthenticated'](),controller[_0x0fde('0xc')]);router[_0x0fde('0x7')]('/chat/queues',auth[_0x0fde('0x6')](),controller[_0x0fde('0xd')]);router[_0x0fde('0x7')]('/mail/queues',auth['isAuthenticated'](),controller[_0x0fde('0xe')]);router[_0x0fde('0x7')]('/mail/accounts',auth[_0x0fde('0x6')](),controller[_0x0fde('0xf')]);router[_0x0fde('0x7')](_0x0fde('0x10'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x11')]);router[_0x0fde('0x7')]('/sms/queues',auth[_0x0fde('0x6')](),controller['smsQueues']);router[_0x0fde('0x7')](_0x0fde('0x12'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x13')]);router['get'](_0x0fde('0x14'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x15')]);router[_0x0fde('0x7')]('/voice/queues/preview/:id',auth[_0x0fde('0x6')](),controller[_0x0fde('0x16')]);router[_0x0fde('0x7')](_0x0fde('0x17'),auth['isAuthenticated'](),controller[_0x0fde('0x18')]);router[_0x0fde('0x7')](_0x0fde('0x19'),auth[_0x0fde('0x6')](),controller['voiceQueuesChannel']);router[_0x0fde('0x7')](_0x0fde('0x1a'),auth['isAuthenticated'](),controller[_0x0fde('0x1b')]);router[_0x0fde('0x7')](_0x0fde('0x1c'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x1d')]);router[_0x0fde('0x7')]('/voice/queues/:id',auth[_0x0fde('0x6')](),controller[_0x0fde('0x1e')]);router[_0x0fde('0x7')](_0x0fde('0x1f'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x20')]);router[_0x0fde('0x7')]('/outbound/channels',auth[_0x0fde('0x6')](),controller[_0x0fde('0x21')]);router[_0x0fde('0x7')]('/agents',auth['isAuthenticated'](),controller[_0x0fde('0x22')]);router[_0x0fde('0x23')]('/agents/:id/capacity',auth[_0x0fde('0x6')](),controller['agentCapacity']);router[_0x0fde('0x7')](_0x0fde('0x24'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0x0fde('0x25'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x26')]);router[_0x0fde('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x0fde('0x27')]);router['get'](_0x0fde('0x28'),auth[_0x0fde('0x6')](),controller['faxAccounts']);router[_0x0fde('0x7')]('/chat/queues/waitinginteractions',auth[_0x0fde('0x6')](),controller[_0x0fde('0x29')]);router['get']('/mail/queues/waitinginteractions',auth[_0x0fde('0x6')](),controller[_0x0fde('0x2a')]);router[_0x0fde('0x7')](_0x0fde('0x2b'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x2c')]);router[_0x0fde('0x7')](_0x0fde('0x2d'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x2e')]);router[_0x0fde('0x7')](_0x0fde('0x2f'),auth['isAuthenticated'](),controller[_0x0fde('0x30')]);router[_0x0fde('0x7')](_0x0fde('0x31'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x32')]);router[_0x0fde('0x7')](_0x0fde('0x33'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x34')]);router[_0x0fde('0x35')](_0x0fde('0x36'),auth['isAuthenticated'](),controller[_0x0fde('0x37')](_0x0fde('0x38')));router[_0x0fde('0x7')](_0x0fde('0x39'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x3a')]);router[_0x0fde('0x35')](_0x0fde('0x3b'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x37')](_0x0fde('0x3c')));router[_0x0fde('0x7')](_0x0fde('0x3d'),auth['isAuthenticated'](),controller[_0x0fde('0x3e')]);router[_0x0fde('0x35')](_0x0fde('0x3f'),auth['isAuthenticated'](),controller['queueNotify'](_0x0fde('0x40')));router[_0x0fde('0x7')](_0x0fde('0x41'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x42')]);router[_0x0fde('0x35')](_0x0fde('0x43'),auth[_0x0fde('0x6')](),controller[_0x0fde('0x37')](_0x0fde('0x44')));router[_0x0fde('0x7')](_0x0fde('0x45'),auth['isAuthenticated'](),controller[_0x0fde('0x46')]);router['post']('/sms/queues/:id/notify',auth[_0x0fde('0x6')](),controller[_0x0fde('0x37')](_0x0fde('0x47')));router[_0x0fde('0x35')](_0x0fde('0x48'),auth['isAuthenticated'](),controller[_0x0fde('0x37')](_0x0fde('0x49')));router[_0x0fde('0x7')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x0fde('0x4a')]);router[_0x0fde('0x7')](_0x0fde('0x4b'),auth[_0x0fde('0x6')](),controller['showWhatsappQueues']);router[_0x0fde('0x35')](_0x0fde('0x4c'),auth['isAuthenticated'](),controller[_0x0fde('0x4d')]);module[_0x0fde('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e088cff..54519e7 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 _0x55be=['voiceChannels','query','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','AgentCapacity','capacity','telephones','trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Queue','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','TransferReport','create','agent','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find'];(function(_0x4856bd,_0x3a74fb){var _0x1d047e=function(_0x4370fe){while(--_0x4370fe){_0x4856bd['push'](_0x4856bd['shift']());}};_0x1d047e(++_0x3a74fb);}(_0x55be,0x1ce));var _0xe55b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x55be[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require(_0xe55b('0x0'));var moment=require(_0xe55b('0x1'));var _=require(_0xe55b('0x2'));var util=require('util');var db=require(_0xe55b('0x3'))['db'];var logger=require(_0xe55b('0x4'))('api');var jayson=require(_0xe55b('0x5'));var amiClient=jayson[_0xe55b('0x6')][_0xe55b('0x7')]({'port':0x232a});var mailClient=jayson[_0xe55b('0x6')][_0xe55b('0x7')]({'port':0x232b});var routingClient=jayson[_0xe55b('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x22eb43,_0x1aa7d6,_0x4aebfe){return new BPromise(function(_0x466967,_0x150441){var _0x32df4f=_0x4aebfe?_0x4aebfe:amiClient;return _0x32df4f[_0xe55b('0x8')](_0x22eb43,_0x1aa7d6)[_0xe55b('0x9')](function(_0x2df905){if(_0x2df905[_0xe55b('0xa')]){if(_0x2df905[_0xe55b('0xa')]['code']===0x1f4){return _0x150441(_0x2df905[_0xe55b('0xa')][_0xe55b('0xb')]);}return _0x466967(_0x2df905[_0xe55b('0xa')]['message']);}else{_0x466967(_0x2df905[_0xe55b('0xc')]);}})[_0xe55b('0xd')](function(_0x32812b){_0x150441(_0x32812b);});});}function respondWithResult(_0x415f7f,_0x5ca881){_0x5ca881=_0x5ca881||0xc8;return function(_0x4f483f){if(_0x4f483f){return _0x415f7f[_0xe55b('0xe')](_0x5ca881)[_0xe55b('0xf')](_0x4f483f);}return _0x415f7f[_0xe55b('0x10')](0x194);};}function handleError(_0x9c02c7,_0xd2ba87){_0xd2ba87=_0xd2ba87||0x1f4;return function(_0xa9476e){logger['error'](_0xa9476e['stack']);if(_0xa9476e[_0xe55b('0x11')]){delete _0xa9476e[_0xe55b('0x11')];}_0x9c02c7[_0xe55b('0xe')](_0xd2ba87)[_0xe55b('0x12')](_0xa9476e);};}function findById(_0x3e7fca){return function(_0x43b565){if(!_[_0xe55b('0x13')](_0x3e7fca)&&!_[_0xe55b('0x13')](_0x43b565)&&!_[_0xe55b('0x13')](_0x43b565[_0xe55b('0x14')])){return _[_0xe55b('0x15')](_0x43b565[_0xe55b('0x14')],function(_0x6ba40f){return _0x6ba40f['id']==_0x3e7fca;});}return null;};}exports[_0xe55b('0x16')]=function(_0x21336d,_0x319e00){return respondWithRpcPromise('VoiceChannels',_0x21336d[_0xe55b('0x17')])['then'](respondWithResult(_0x319e00,null))['catch'](handleError(_0x319e00,null));};exports['voiceChannelMixMonitor']=function(_0x239edd,_0x431d1){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xe55b('0x18')](_0x239edd[_0xe55b('0x17')],_0x239edd[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x431d1,null))[_0xe55b('0xd')](handleError(_0x431d1,null));};exports['voiceChannelStopMixMonitor']=function(_0x3552d1,_0x134980){return respondWithRpcPromise(_0xe55b('0x1a'),_['merge'](_0x3552d1[_0xe55b('0x17')],_0x3552d1['params']))[_0xe55b('0x9')](respondWithResult(_0x134980,null))[_0xe55b('0xd')](handleError(_0x134980,null));};exports['voiceQueues']=function(_0x42e430,_0x188634){return respondWithRpcPromise(_0xe55b('0x1b'),_0x42e430[_0xe55b('0x17')])['then'](respondWithResult(_0x188634,null))[_0xe55b('0xd')](handleError(_0x188634,null));};exports['showVoiceQueues']=function(_0x531a9c,_0x5cc149){return respondWithRpcPromise(_0xe55b('0x1b'),_0x531a9c[_0xe55b('0x17')])[_0xe55b('0x9')](findById(_0x531a9c['params']['id']))['then'](respondWithResult(_0x5cc149,null))['catch'](handleError(_0x5cc149,null));};exports[_0xe55b('0x1c')]=function(_0xd30332,_0x22e8c0){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xe55b('0x18')](_0xd30332['query'],_0xd30332[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x22e8c0,null))[_0xe55b('0xd')](handleError(_0x22e8c0,null));};exports[_0xe55b('0x1d')]=function(_0xa24aae,_0x2a85a8){return respondWithRpcPromise(_0xe55b('0x1e'),_0xa24aae[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x2a85a8,null))['catch'](handleError(_0x2a85a8,null));};exports['voiceQueuesChannel']=function(_0x120969,_0x34027e){return respondWithRpcPromise(_0xe55b('0x1f'),_[_0xe55b('0x18')](_0x120969['query'],_0x120969[_0xe55b('0x19')]))['then'](respondWithResult(_0x34027e,null))['catch'](handleError(_0x34027e,null));};exports[_0xe55b('0x20')]=function(_0x2c8c11,_0x2bbc38){return respondWithRpcPromise(_0xe55b('0x21'),_[_0xe55b('0x18')](_0x2c8c11[_0xe55b('0x17')],_0x2c8c11[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x2bbc38,null))[_0xe55b('0xd')](handleError(_0x2bbc38,null));};exports[_0xe55b('0x22')]=function(_0xc2f6a2,_0x3109b0){return respondWithRpcPromise(_0xe55b('0x23'),_['merge'](_0xc2f6a2['query'],_0xc2f6a2[_0xe55b('0x19')]))[_0xe55b('0x9')](respondWithResult(_0x3109b0,null))[_0xe55b('0xd')](handleError(_0x3109b0,null));};exports[_0xe55b('0x24')]=function(_0x4b5bed,_0x56fa9a){return respondWithRpcPromise('Outbound',_0x4b5bed[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x56fa9a,null))['catch'](handleError(_0x56fa9a,null));};exports[_0xe55b('0x25')]=function(_0x5d5f9e,_0x59a90b){return respondWithRpcPromise('OutboundChannels',_0x5d5f9e[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x59a90b,null))[_0xe55b('0xd')](handleError(_0x59a90b,null));};exports[_0xe55b('0x26')]=function(_0x37c34a,_0x5467bd){var _0xeceea9;return respondWithRpcPromise(_0xe55b('0x27'),_0x37c34a[_0xe55b('0x17')])[_0xe55b('0x9')](function(_0x1f09a1){_0xeceea9=_0x1f09a1;return respondWithRpcPromise('Agents',_0x37c34a[_0xe55b('0x17')],routingClient);})[_0xe55b('0x9')](function(_0x42fbc6){return _[_0xe55b('0x18')]({},_0x42fbc6,_0xeceea9);})[_0xe55b('0x9')](respondWithResult(_0x5467bd,null))[_0xe55b('0xd')](handleError(_0x5467bd,null));};exports[_0xe55b('0x28')]=function(_0x34c40c,_0x51a501){if(_0x34c40c[_0xe55b('0x29')]&&_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')]&&_0x34c40c[_0xe55b('0x2b')]&&_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')]){for(var _0x1a53aa in _0x34c40c['body'][_0xe55b('0x2a')]){if(_0x34c40c[_0xe55b('0x29')]['interaction'][_0xe55b('0x2c')](_0x1a53aa)){db['MemberReport'][_0xe55b('0x2d')]({'where':{'channel':_0x1a53aa,'membername':_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')],'type':_0xe55b('0x2e'),'exitAt':null,'uniqueid':_0x34c40c['body'][_0xe55b('0x2a')][_0x1a53aa]&&_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')][_0x1a53aa][_0xe55b('0x2f')]?{'$notIn':_0x34c40c['body'][_0xe55b('0x2a')][_0x1a53aa]}:{'$ne':null}}})['then'](function(_0x1c2e8f){var _0x26e150=moment()['format'](_0xe55b('0x30'));for(var _0x25e0a=0x0,_0x2318c7=_0x1c2e8f['length'];_0x25e0a<_0x2318c7;_0x25e0a+=0x1){_0x1c2e8f[_0x25e0a][_0xe55b('0x31')]({'exitAt':_0x26e150});}});for(var _0x25f33e=0x0;_0x25f33e<_0x34c40c[_0xe55b('0x29')]['interaction'][_0x1a53aa][_0xe55b('0x2f')];_0x25f33e+=0x1){db['MemberReport'][_0xe55b('0x32')]({'where':{'channel':_0x1a53aa,'membername':_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')],'type':_0xe55b('0x2e'),'uniqueid':_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')][_0x1a53aa][_0x25f33e],'exitAt':null},'defaults':{'channel':_0x1a53aa,'membername':_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')],'interface':_[_0xe55b('0x13')](_0x34c40c['user'][_0xe55b('0x33')])?util[_0xe55b('0x34')]('SIP/%s',_0x34c40c[_0xe55b('0x2b')][_0xe55b('0x11')]):_0x34c40c['user'][_0xe55b('0x33')],'type':_0xe55b('0x2e'),'enterAt':moment()[_0xe55b('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x34c40c[_0xe55b('0x2b')]['internal'],'uniqueid':_0x34c40c[_0xe55b('0x29')][_0xe55b('0x2a')][_0x1a53aa][_0x25f33e]}});}}}}return respondWithRpcPromise(_0xe55b('0x35'),{'id':_0x34c40c[_0xe55b('0x19')]['id'],'capacity':_0x34c40c[_0xe55b('0x29')][_0xe55b('0x36')]},routingClient)[_0xe55b('0x9')](respondWithResult(_0x51a501,null))[_0xe55b('0xd')](handleError(_0x51a501,null));};exports[_0xe55b('0x37')]=function(_0xf1d789,_0x45a344){return respondWithRpcPromise('Telephones',_0xf1d789[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x45a344,null))['catch'](handleError(_0x45a344,null));};exports[_0xe55b('0x38')]=function(_0x104ec1,_0x287f6b){return respondWithRpcPromise('Trunks',_0x104ec1[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x287f6b,null))[_0xe55b('0xd')](handleError(_0x287f6b,null));};exports['campaigns']=function(_0x1f5bb2,_0x458786){return respondWithRpcPromise(_0xe55b('0x39'),_0x1f5bb2[_0xe55b('0x17')])['then'](respondWithResult(_0x458786,null))[_0xe55b('0xd')](handleError(_0x458786,null));};exports[_0xe55b('0x3a')]=function(_0x4fdf86,_0x450802){return respondWithRpcPromise(_0xe55b('0x3b'),_0x4fdf86[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x450802,null))[_0xe55b('0xd')](handleError(_0x450802,null));};exports['showChatQueues']=function(_0x338ed9,_0x3d4c29){return respondWithRpcPromise(_0xe55b('0x3b'),_0x338ed9[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](findById(_0x338ed9['params']['id']))[_0xe55b('0x9')](respondWithResult(_0x3d4c29,null))[_0xe55b('0xd')](handleError(_0x3d4c29,null));};exports[_0xe55b('0x3c')]=function(_0xc34855,_0x2e581a){return respondWithRpcPromise(_0xe55b('0x3d'),_0xc34855[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x2e581a,null))['catch'](handleError(_0x2e581a,null));};exports[_0xe55b('0x3e')]=function(_0x5f4552,_0xf249bb){return respondWithRpcPromise(_0xe55b('0x3d'),_0x5f4552['query'],routingClient)[_0xe55b('0x9')](findById(_0x5f4552['params']['id']))[_0xe55b('0x9')](respondWithResult(_0xf249bb,null))['catch'](handleError(_0xf249bb,null));};exports[_0xe55b('0x3f')]=function(_0x4944b8,_0xb6e28c){return respondWithRpcPromise(_0xe55b('0x40'),_0x4944b8[_0xe55b('0x17')],mailClient)[_0xe55b('0x9')](respondWithResult(_0xb6e28c,null))[_0xe55b('0xd')](handleError(_0xb6e28c,null));};exports[_0xe55b('0x41')]=function(_0x1e6573,_0x558c9a){return respondWithRpcPromise(_0xe55b('0x42'),_0x1e6573[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x558c9a,null))[_0xe55b('0xd')](handleError(_0x558c9a,null));};exports[_0xe55b('0x43')]=function(_0x51957d,_0x920672){return respondWithRpcPromise(_0xe55b('0x42'),_0x51957d[_0xe55b('0x17')],routingClient)['then'](findById(_0x51957d[_0xe55b('0x19')]['id']))[_0xe55b('0x9')](respondWithResult(_0x920672,null))[_0xe55b('0xd')](handleError(_0x920672,null));};exports[_0xe55b('0x44')]=function(_0x50798a,_0x566b87){return respondWithRpcPromise(_0xe55b('0x45'),_0x50798a[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x566b87,null))[_0xe55b('0xd')](handleError(_0x566b87,null));};exports[_0xe55b('0x46')]=function(_0x30dc22,_0x4b5c60){return respondWithRpcPromise('SmsQueues',_0x30dc22[_0xe55b('0x17')],routingClient)['then'](findById(_0x30dc22[_0xe55b('0x19')]['id']))[_0xe55b('0x9')](respondWithResult(_0x4b5c60,null))[_0xe55b('0xd')](handleError(_0x4b5c60,null));};exports[_0xe55b('0x47')]=function(_0x157d51,_0x1b0934){return respondWithRpcPromise(_0xe55b('0x48'),_0x157d51[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x1b0934,null))['catch'](handleError(_0x1b0934,null));};exports[_0xe55b('0x49')]=function(_0x3b3ae9,_0x463361){return respondWithRpcPromise(_0xe55b('0x48'),_0x3b3ae9['query'],routingClient)[_0xe55b('0x9')](findById(_0x3b3ae9['params']['id']))['then'](respondWithResult(_0x463361,null))['catch'](handleError(_0x463361,null));};exports[_0xe55b('0x4a')]=function(_0x4f609a,_0x47f154){return respondWithRpcPromise(_0xe55b('0x4b'),_0x4f609a[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x47f154,null))[_0xe55b('0xd')](handleError(_0x47f154,null));};exports[_0xe55b('0x4c')]=function(_0x7671f5,_0x5eb16d){return respondWithRpcPromise(_0xe55b('0x4b'),_0x7671f5[_0xe55b('0x17')],routingClient)['then'](findById(_0x7671f5['params']['id']))[_0xe55b('0x9')](respondWithResult(_0x5eb16d,null))[_0xe55b('0xd')](handleError(_0x5eb16d,null));};exports['faxAccounts']=function(_0x41564b,_0x1cb356){return respondWithRpcPromise('FaxAccounts',_0x41564b[_0xe55b('0x17')])[_0xe55b('0x9')](respondWithResult(_0x1cb356,null))[_0xe55b('0xd')](handleError(_0x1cb356,null));};exports[_0xe55b('0x4d')]=function(_0x2414a2,_0x31a45b){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x2414a2[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x31a45b,null))['catch'](handleError(_0x31a45b,null));};exports[_0xe55b('0x4e')]=function(_0x5380f0,_0x4f9907){return respondWithRpcPromise(_0xe55b('0x4f'),_0x5380f0[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x4f9907,null))[_0xe55b('0xd')](handleError(_0x4f9907,null));};exports[_0xe55b('0x50')]=function(_0x1c4073,_0x49efdc){return respondWithRpcPromise(_0xe55b('0x51'),_0x1c4073['query'],routingClient)[_0xe55b('0x9')](respondWithResult(_0x49efdc,null))[_0xe55b('0xd')](handleError(_0x49efdc,null));};exports[_0xe55b('0x52')]=function(_0x333ca8,_0x425d56){return respondWithRpcPromise(_0xe55b('0x51'),_0x333ca8['query'],routingClient)[_0xe55b('0x9')](function(_0xf264f7){if(_0x333ca8['query'][_0xe55b('0x53')]!==undefined){var _0x1f1bd2=_(_0xf264f7[_0xe55b('0x14')])[_0xe55b('0x54')]([_0x333ca8[_0xe55b('0x17')][_0xe55b('0x53')],_0x333ca8[_0xe55b('0x19')]['id']])[_0xe55b('0x55')](_0xe55b('0x56'))[_0xe55b('0x57')]()['value']();return _0xf264f7[_0xe55b('0x14')][_0xe55b('0x54')](function(_0x21a966){return _0x1f1bd2[_0xe55b('0x58')](_0x21a966[_0xe55b('0x56')])>-0x1;});}else{return _0xf264f7[_0xe55b('0x14')][_0xe55b('0x54')](function(_0x41de92){return _0x41de92[_0xe55b('0x56')]===parseInt(_0x333ca8['params']['id']);});}})[_0xe55b('0x9')](respondWithResult(_0x425d56,null))[_0xe55b('0xd')](handleError(_0x425d56,null));};exports[_0xe55b('0x59')]=function(_0x55534c,_0x185d37){return respondWithRpcPromise(_0xe55b('0x5a'),_0x55534c[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x185d37,null))['catch'](handleError(_0x185d37,null));};exports[_0xe55b('0x5b')]=function(_0x5358ba,_0x2bdfd4){return respondWithRpcPromise(_0xe55b('0x5c'),_0x5358ba['query'],routingClient)['then'](respondWithResult(_0x2bdfd4,null))['catch'](handleError(_0x2bdfd4,null));};exports[_0xe55b('0x5d')]=function(_0x186474,_0x54f102){return respondWithRpcPromise(_0xe55b('0x5e'),_0x186474[_0xe55b('0x17')],routingClient)[_0xe55b('0x9')](respondWithResult(_0x54f102,null))[_0xe55b('0xd')](handleError(_0x54f102,null));};exports['queueNotify']=function(_0x4960e6){return function(_0x82023d,_0x6957f2){var _0x2b543d,_0x18b49e;var _0x15af6b=_[_0xe55b('0x5f')](_0x4960e6);var _0x14a49e=_0x4960e6==='chat'?_0xe55b('0x60'):'Account';return db[_0x15af6b+_0xe55b('0x61')]['findOne']({'raw':!![],'where':{'id':_0x82023d[_0xe55b('0x19')]['id']}})[_0xe55b('0x9')](function(_0x1c42c2){if(_['isNil'](_0x1c42c2)){throw new Error(_0x15af6b+'\x20Queue\x20not\x20found');}_0x2b543d=_0x1c42c2;return db[_0x15af6b+_0xe55b('0x62')][_0xe55b('0x63')]({'where':{'id':_0x82023d[_0xe55b('0x29')][_0xe55b('0x64')]},'include':[{'model':db[_0x15af6b+_0xe55b('0x65')],'as':_0xe55b('0x65')},{'model':db[_0x15af6b+_0x14a49e],'as':'Account'}]});})['then'](function(_0x4f853c){if(_[_0xe55b('0x13')](_0x4f853c)){throw new Error(_0x15af6b+_0xe55b('0x66'));}_0x18b49e=_0x4f853c;return _0x4f853c[_0xe55b('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe55b('0x9')](function(){var _0x35c436={'uniqueid':_0x4960e6+'.'+_0x18b49e['id']+'.'+_0x18b49e[_0xe55b('0x65')]['id'],'FromUserId':_0x82023d[_0xe55b('0x2b')]['id'],'type':_0xe55b('0x68')};_0x35c436[_0x15af6b+_0xe55b('0x69')]=_0x18b49e['id'];_0x35c436[_0x15af6b+_0xe55b('0x6a')]=_0x18b49e[_0xe55b('0x65')]['id'];_0x35c436[_0xe55b('0x6b')+_0x15af6b+_0x14a49e+'Id']=_0x18b49e[_0xe55b('0x6c')]['id'];_0x35c436['To'+_0x15af6b+'QueueId']=_0x2b543d['id'];return db[_0x15af6b+'TransferReport']['create'](_0x35c436);})[_0xe55b('0x9')](function(){return respondWithRpcPromise(_0xe55b('0x6d'),{'channel':_0x4960e6,'interaction':_0x18b49e[_0xe55b('0x65')],'message':_0x18b49e,'account':_0x18b49e[_0xe55b('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2b543d[_0xe55b('0x11')]+','+(_0x18b49e[_0xe55b('0x6c')][_0xe55b('0x6e')]||0x12c),'interval':_0xe55b('0x6f')}]},routingClient);})[_0xe55b('0x9')](respondWithResult(_0x6957f2,null))[_0xe55b('0xd')](handleError(_0x6957f2,null));};};exports[_0xe55b('0x70')]=function(_0x40ffac,_0x1ab482){var _0x16b74e,_0x32b488;if(_[_0xe55b('0x13')](_0x40ffac[_0xe55b('0x29')][_0xe55b('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x33bde2=_0x40ffac[_0xe55b('0x29')][_0xe55b('0x71')];var _0x39ec60=_[_0xe55b('0x5f')](_0x33bde2);var _0xb4ab66=_0x33bde2===_0xe55b('0x72')?_0xe55b('0x60'):_0xe55b('0x6c');return db[_0xe55b('0x73')][_0xe55b('0x63')]({'raw':!![],'where':{'id':_0x40ffac['params']['id'],'role':'agent'}})['then'](function(_0x581748){if(_[_0xe55b('0x13')](_0x581748)){throw new Error(_0xe55b('0x74'));}_0x16b74e=_0x581748;return db[_0x39ec60+_0xe55b('0x62')][_0xe55b('0x63')]({'where':{'id':_0x40ffac[_0xe55b('0x29')][_0xe55b('0x64')]},'include':[{'model':db[_0x39ec60+_0xe55b('0x65')],'as':'Interaction'},{'model':db[_0x39ec60+_0xb4ab66],'as':_0xe55b('0x6c')}]});})[_0xe55b('0x9')](function(_0x4f015d){if(_['isNil'](_0x4f015d)){throw new Error(_0x39ec60+_0xe55b('0x66'));}_0x32b488=_0x4f015d;return _0x4f015d[_0xe55b('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe55b('0x9')](function(){var _0x30bd75={'uniqueid':_0x33bde2+'.'+_0x32b488['id']+'.'+_0x32b488[_0xe55b('0x65')]['id'],'FromUserId':_0x40ffac[_0xe55b('0x2b')]['id'],'type':'queue','ToUserId':_0x16b74e['id']};_0x30bd75[_0x39ec60+_0xe55b('0x69')]=_0x32b488['id'];_0x30bd75[_0x39ec60+'InteractionId']=_0x32b488[_0xe55b('0x65')]['id'];_0x30bd75[_0xe55b('0x6b')+_0x39ec60+_0xb4ab66+'Id']=_0x32b488[_0xe55b('0x6c')]['id'];return db[_0x39ec60+_0xe55b('0x75')][_0xe55b('0x76')](_0x30bd75);})[_0xe55b('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x33bde2,'interaction':_0x32b488[_0xe55b('0x65')],'message':_0x32b488,'account':_0x32b488[_0xe55b('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe55b('0x77'),'appdata':_0x16b74e[_0xe55b('0x11')]+','+(_0x32b488['Account'][_0xe55b('0x78')]||0x12c),'interval':_0xe55b('0x6f')}]},routingClient);})[_0xe55b('0x9')](respondWithResult(_0x1ab482,null))['catch'](handleError(_0x1ab482,null));}; \ No newline at end of file +var _0xd098=['lodash','../../config/logger','jayson/promise','http','client','request','then','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','updateAttributes','MemberReport','interface','format','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','telephones','trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','map','uniq','value','rows','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','create','Start','queue','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','InteractionId','TransferReport','agentTransferTimeout','*,*,*,*','bluebird'];(function(_0x3c9a89,_0x378778){var _0x1eb47b=function(_0x57998a){while(--_0x57998a){_0x3c9a89['push'](_0x3c9a89['shift']());}};_0x1eb47b(++_0x378778);}(_0xd098,0x105));var _0x8d09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd098[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x8d09('0x0'));var moment=require('moment');var _=require(_0x8d09('0x1'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x8d09('0x2'))('api');var jayson=require(_0x8d09('0x3'));var amiClient=jayson['client'][_0x8d09('0x4')]({'port':0x232a});var mailClient=jayson[_0x8d09('0x5')][_0x8d09('0x4')]({'port':0x232b});var routingClient=jayson['client'][_0x8d09('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x146d3b,_0xbfaf00,_0x13fe0e){return new BPromise(function(_0x548fde,_0x26d2dc){var _0xc66e60=_0x13fe0e?_0x13fe0e:amiClient;return _0xc66e60[_0x8d09('0x6')](_0x146d3b,_0xbfaf00)[_0x8d09('0x7')](function(_0x26b11d){if(_0x26b11d['error']){if(_0x26b11d[_0x8d09('0x8')][_0x8d09('0x9')]===0x1f4){return _0x26d2dc(_0x26b11d[_0x8d09('0x8')][_0x8d09('0xa')]);}return _0x548fde(_0x26b11d[_0x8d09('0x8')][_0x8d09('0xa')]);}else{_0x548fde(_0x26b11d[_0x8d09('0xb')]);}})['catch'](function(_0x4fd173){_0x26d2dc(_0x4fd173);});});}function respondWithResult(_0x42a75c,_0x59f82b){_0x59f82b=_0x59f82b||0xc8;return function(_0x5ba740){if(_0x5ba740){return _0x42a75c[_0x8d09('0xc')](_0x59f82b)[_0x8d09('0xd')](_0x5ba740);}return _0x42a75c[_0x8d09('0xe')](0x194);};}function handleError(_0x2856cb,_0x5922a1){_0x5922a1=_0x5922a1||0x1f4;return function(_0x2aa68f){logger['error'](_0x2aa68f[_0x8d09('0xf')]);if(_0x2aa68f['name']){delete _0x2aa68f[_0x8d09('0x10')];}_0x2856cb['status'](_0x5922a1)[_0x8d09('0x11')](_0x2aa68f);};}function findById(_0x330454){return function(_0x2786bb){if(!_['isNil'](_0x330454)&&!_['isNil'](_0x2786bb)&&!_[_0x8d09('0x12')](_0x2786bb['rows'])){return _[_0x8d09('0x13')](_0x2786bb['rows'],function(_0x5e21c6){return _0x5e21c6['id']==_0x330454;});}return null;};}exports[_0x8d09('0x14')]=function(_0x4668f1,_0x488812){return respondWithRpcPromise(_0x8d09('0x15'),_0x4668f1[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x488812,null))['catch'](handleError(_0x488812,null));};exports[_0x8d09('0x17')]=function(_0x17319a,_0x1b2dcf){return respondWithRpcPromise(_0x8d09('0x18'),_[_0x8d09('0x19')](_0x17319a[_0x8d09('0x16')],_0x17319a[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x1b2dcf,null))[_0x8d09('0x1b')](handleError(_0x1b2dcf,null));};exports[_0x8d09('0x1c')]=function(_0x3aa0e5,_0x1b20ac){return respondWithRpcPromise(_0x8d09('0x1d'),_[_0x8d09('0x19')](_0x3aa0e5[_0x8d09('0x16')],_0x3aa0e5['params']))['then'](respondWithResult(_0x1b20ac,null))['catch'](handleError(_0x1b20ac,null));};exports[_0x8d09('0x1e')]=function(_0x4f056b,_0xac79ce){return respondWithRpcPromise(_0x8d09('0x1f'),_0x4f056b[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0xac79ce,null))[_0x8d09('0x1b')](handleError(_0xac79ce,null));};exports[_0x8d09('0x20')]=function(_0x4dff93,_0x4f07fb){return respondWithRpcPromise('VoiceQueues',_0x4dff93[_0x8d09('0x16')])['then'](findById(_0x4dff93[_0x8d09('0x1a')]['id']))[_0x8d09('0x7')](respondWithResult(_0x4f07fb,null))[_0x8d09('0x1b')](handleError(_0x4f07fb,null));};exports[_0x8d09('0x21')]=function(_0x22d01b,_0x4278e1){return respondWithRpcPromise(_0x8d09('0x22'),_['merge'](_0x22d01b['query'],_0x22d01b[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x4278e1,null))[_0x8d09('0x1b')](handleError(_0x4278e1,null));};exports[_0x8d09('0x23')]=function(_0x413d3b,_0x6b440d){return respondWithRpcPromise(_0x8d09('0x24'),_0x413d3b[_0x8d09('0x16')])['then'](respondWithResult(_0x6b440d,null))[_0x8d09('0x1b')](handleError(_0x6b440d,null));};exports[_0x8d09('0x25')]=function(_0x549c71,_0x2071af){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x549c71['query'],_0x549c71[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x2071af,null))[_0x8d09('0x1b')](handleError(_0x2071af,null));};exports[_0x8d09('0x26')]=function(_0x1597ce,_0x53ac30){return respondWithRpcPromise(_0x8d09('0x27'),_['merge'](_0x1597ce[_0x8d09('0x16')],_0x1597ce[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x53ac30,null))[_0x8d09('0x1b')](handleError(_0x53ac30,null));};exports[_0x8d09('0x28')]=function(_0x263d88,_0x1149ff){return respondWithRpcPromise(_0x8d09('0x29'),_['merge'](_0x263d88[_0x8d09('0x16')],_0x263d88[_0x8d09('0x1a')]))[_0x8d09('0x7')](respondWithResult(_0x1149ff,null))[_0x8d09('0x1b')](handleError(_0x1149ff,null));};exports[_0x8d09('0x2a')]=function(_0x248c08,_0x174226){return respondWithRpcPromise('Outbound',_0x248c08[_0x8d09('0x16')])['then'](respondWithResult(_0x174226,null))[_0x8d09('0x1b')](handleError(_0x174226,null));};exports[_0x8d09('0x2b')]=function(_0x2c8d83,_0x1eeaac){return respondWithRpcPromise(_0x8d09('0x2c'),_0x2c8d83[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x1eeaac,null))[_0x8d09('0x1b')](handleError(_0x1eeaac,null));};exports[_0x8d09('0x2d')]=function(_0x316a58,_0x50b654){var _0x4f9c53;return respondWithRpcPromise('Agents',_0x316a58[_0x8d09('0x16')])[_0x8d09('0x7')](function(_0x518989){_0x4f9c53=_0x518989;return respondWithRpcPromise(_0x8d09('0x2e'),_0x316a58['query'],routingClient);})[_0x8d09('0x7')](function(_0x59d4f0){return _[_0x8d09('0x19')]({},_0x59d4f0,_0x4f9c53);})[_0x8d09('0x7')](respondWithResult(_0x50b654,null))['catch'](handleError(_0x50b654,null));};exports[_0x8d09('0x2f')]=function(_0x180460,_0x9f97bf){if(_0x180460[_0x8d09('0x30')]&&_0x180460['body'][_0x8d09('0x31')]&&_0x180460[_0x8d09('0x32')]&&_0x180460[_0x8d09('0x32')][_0x8d09('0x10')]){for(var _0x1dc39f in _0x180460[_0x8d09('0x30')][_0x8d09('0x31')]){if(_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x8d09('0x33')](_0x1dc39f)){db['MemberReport'][_0x8d09('0x34')]({'where':{'channel':_0x1dc39f,'membername':_0x180460[_0x8d09('0x32')][_0x8d09('0x10')],'type':_0x8d09('0x35'),'exitAt':null,'uniqueid':_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f]&&_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f][_0x8d09('0x36')]?{'$notIn':_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f]}:{'$ne':null}}})[_0x8d09('0x7')](function(_0x5c00bd){var _0x163439=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3d9d18=0x0,_0x468fa3=_0x5c00bd['length'];_0x3d9d18<_0x468fa3;_0x3d9d18+=0x1){_0x5c00bd[_0x3d9d18][_0x8d09('0x37')]({'exitAt':_0x163439});}});for(var _0x56426c=0x0;_0x56426c<_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f][_0x8d09('0x36')];_0x56426c+=0x1){db[_0x8d09('0x38')]['findOrCreate']({'where':{'channel':_0x1dc39f,'membername':_0x180460['user'][_0x8d09('0x10')],'type':'INTERACTION','uniqueid':_0x180460['body'][_0x8d09('0x31')][_0x1dc39f][_0x56426c],'exitAt':null},'defaults':{'channel':_0x1dc39f,'membername':_0x180460[_0x8d09('0x32')][_0x8d09('0x10')],'interface':_['isNil'](_0x180460['user'][_0x8d09('0x39')])?util[_0x8d09('0x3a')](_0x8d09('0x3b'),_0x180460[_0x8d09('0x32')]['name']):_0x180460[_0x8d09('0x32')][_0x8d09('0x39')],'type':'INTERACTION','enterAt':moment()['format'](_0x8d09('0x3c')),'role':_0x8d09('0x3d'),'internal':_0x180460[_0x8d09('0x32')][_0x8d09('0x3e')],'uniqueid':_0x180460[_0x8d09('0x30')][_0x8d09('0x31')][_0x1dc39f][_0x56426c]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x180460[_0x8d09('0x1a')]['id'],'capacity':_0x180460[_0x8d09('0x30')]['capacity']},routingClient)['then'](respondWithResult(_0x9f97bf,null))['catch'](handleError(_0x9f97bf,null));};exports[_0x8d09('0x3f')]=function(_0x3efe28,_0x55349e){return respondWithRpcPromise('Telephones',_0x3efe28[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x55349e,null))[_0x8d09('0x1b')](handleError(_0x55349e,null));};exports[_0x8d09('0x40')]=function(_0xcfb5f9,_0x10e437){return respondWithRpcPromise('Trunks',_0xcfb5f9['query'])[_0x8d09('0x7')](respondWithResult(_0x10e437,null))[_0x8d09('0x1b')](handleError(_0x10e437,null));};exports[_0x8d09('0x41')]=function(_0x4333b7,_0x3f6475){return respondWithRpcPromise(_0x8d09('0x42'),_0x4333b7[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x3f6475,null))[_0x8d09('0x1b')](handleError(_0x3f6475,null));};exports['chatQueues']=function(_0x17ffb0,_0x1610c1){return respondWithRpcPromise('ChatQueues',_0x17ffb0[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x1610c1,null))[_0x8d09('0x1b')](handleError(_0x1610c1,null));};exports[_0x8d09('0x43')]=function(_0x1cee90,_0x18722d){return respondWithRpcPromise(_0x8d09('0x44'),_0x1cee90[_0x8d09('0x16')],routingClient)['then'](findById(_0x1cee90[_0x8d09('0x1a')]['id']))['then'](respondWithResult(_0x18722d,null))[_0x8d09('0x1b')](handleError(_0x18722d,null));};exports[_0x8d09('0x45')]=function(_0x2c464e,_0x787b11){return respondWithRpcPromise('MailQueues',_0x2c464e[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x787b11,null))['catch'](handleError(_0x787b11,null));};exports['showMailQueues']=function(_0x483f90,_0x2711e1){return respondWithRpcPromise('MailQueues',_0x483f90[_0x8d09('0x16')],routingClient)['then'](findById(_0x483f90['params']['id']))['then'](respondWithResult(_0x2711e1,null))['catch'](handleError(_0x2711e1,null));};exports[_0x8d09('0x46')]=function(_0x544bdf,_0x5a3f4d){return respondWithRpcPromise(_0x8d09('0x47'),_0x544bdf[_0x8d09('0x16')],mailClient)['then'](respondWithResult(_0x5a3f4d,null))[_0x8d09('0x1b')](handleError(_0x5a3f4d,null));};exports[_0x8d09('0x48')]=function(_0xc9fd6c,_0x445c37){return respondWithRpcPromise(_0x8d09('0x49'),_0xc9fd6c['query'],routingClient)['then'](respondWithResult(_0x445c37,null))[_0x8d09('0x1b')](handleError(_0x445c37,null));};exports[_0x8d09('0x4a')]=function(_0x42c63b,_0x11cb4a){return respondWithRpcPromise('OpenchannelQueues',_0x42c63b['query'],routingClient)[_0x8d09('0x7')](findById(_0x42c63b['params']['id']))[_0x8d09('0x7')](respondWithResult(_0x11cb4a,null))[_0x8d09('0x1b')](handleError(_0x11cb4a,null));};exports['smsQueues']=function(_0x363998,_0x480293){return respondWithRpcPromise(_0x8d09('0x4b'),_0x363998[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x480293,null))[_0x8d09('0x1b')](handleError(_0x480293,null));};exports[_0x8d09('0x4c')]=function(_0x1e59d5,_0x32746b){return respondWithRpcPromise(_0x8d09('0x4b'),_0x1e59d5['query'],routingClient)['then'](findById(_0x1e59d5[_0x8d09('0x1a')]['id']))[_0x8d09('0x7')](respondWithResult(_0x32746b,null))[_0x8d09('0x1b')](handleError(_0x32746b,null));};exports[_0x8d09('0x4d')]=function(_0x38363f,_0x202cf0){return respondWithRpcPromise(_0x8d09('0x4e'),_0x38363f[_0x8d09('0x16')],routingClient)['then'](respondWithResult(_0x202cf0,null))['catch'](handleError(_0x202cf0,null));};exports[_0x8d09('0x4f')]=function(_0x1822f1,_0x4349a7){return respondWithRpcPromise(_0x8d09('0x4e'),_0x1822f1[_0x8d09('0x16')],routingClient)['then'](findById(_0x1822f1['params']['id']))[_0x8d09('0x7')](respondWithResult(_0x4349a7,null))['catch'](handleError(_0x4349a7,null));};exports[_0x8d09('0x50')]=function(_0x45300a,_0x380fe1){return respondWithRpcPromise(_0x8d09('0x51'),_0x45300a[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x380fe1,null))[_0x8d09('0x1b')](handleError(_0x380fe1,null));};exports[_0x8d09('0x52')]=function(_0x163672,_0x5de709){return respondWithRpcPromise(_0x8d09('0x51'),_0x163672[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](findById(_0x163672[_0x8d09('0x1a')]['id']))[_0x8d09('0x7')](respondWithResult(_0x5de709,null))[_0x8d09('0x1b')](handleError(_0x5de709,null));};exports[_0x8d09('0x53')]=function(_0x35c739,_0x5457b2){return respondWithRpcPromise(_0x8d09('0x54'),_0x35c739[_0x8d09('0x16')])[_0x8d09('0x7')](respondWithResult(_0x5457b2,null))[_0x8d09('0x1b')](handleError(_0x5457b2,null));};exports[_0x8d09('0x55')]=function(_0x266b24,_0x5b2d7f){return respondWithRpcPromise(_0x8d09('0x56'),_0x266b24[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x5b2d7f,null))[_0x8d09('0x1b')](handleError(_0x5b2d7f,null));};exports[_0x8d09('0x57')]=function(_0x116dae,_0x4b45db){return respondWithRpcPromise(_0x8d09('0x58'),_0x116dae[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x4b45db,null))[_0x8d09('0x1b')](handleError(_0x4b45db,null));};exports[_0x8d09('0x59')]=function(_0x51062c,_0x2c857e){return respondWithRpcPromise(_0x8d09('0x5a'),_0x51062c[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x2c857e,null))['catch'](handleError(_0x2c857e,null));};exports[_0x8d09('0x5b')]=function(_0x9daa4d,_0x22c353){return respondWithRpcPromise(_0x8d09('0x5a'),_0x9daa4d[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](function(_0x107275){if(_0x9daa4d[_0x8d09('0x16')]['type']!==undefined){var _0x41ef6f=_(_0x107275['rows'])[_0x8d09('0x5c')]([_0x9daa4d['query'][_0x8d09('0x5d')],_0x9daa4d[_0x8d09('0x1a')]['id']])[_0x8d09('0x5e')]('queue_id')[_0x8d09('0x5f')]()[_0x8d09('0x60')]();return _0x107275[_0x8d09('0x61')][_0x8d09('0x5c')](function(_0xf3a6b4){return _0x41ef6f[_0x8d09('0x62')](_0xf3a6b4['queue_id'])>-0x1;});}else{return _0x107275[_0x8d09('0x61')]['filter'](function(_0x13f799){return _0x13f799['queue_id']===parseInt(_0x9daa4d[_0x8d09('0x1a')]['id']);});}})[_0x8d09('0x7')](respondWithResult(_0x22c353,null))[_0x8d09('0x1b')](handleError(_0x22c353,null));};exports[_0x8d09('0x63')]=function(_0x1ef4d6,_0x4f445e){return respondWithRpcPromise(_0x8d09('0x64'),_0x1ef4d6['query'],routingClient)[_0x8d09('0x7')](respondWithResult(_0x4f445e,null))['catch'](handleError(_0x4f445e,null));};exports[_0x8d09('0x65')]=function(_0xcf7c2f,_0xf6a13){return respondWithRpcPromise(_0x8d09('0x66'),_0xcf7c2f[_0x8d09('0x16')],routingClient)['then'](respondWithResult(_0xf6a13,null))[_0x8d09('0x1b')](handleError(_0xf6a13,null));};exports['faxQueuesWaitingInteractions']=function(_0x4311a7,_0x4e82c9){return respondWithRpcPromise(_0x8d09('0x67'),_0x4311a7[_0x8d09('0x16')],routingClient)[_0x8d09('0x7')](respondWithResult(_0x4e82c9,null))[_0x8d09('0x1b')](handleError(_0x4e82c9,null));};exports[_0x8d09('0x68')]=function(_0x72f6d3){return function(_0x303899,_0x1eaafa){var _0x9f77df,_0x5e6423;var _0x2ced4d=_[_0x8d09('0x69')](_0x72f6d3);var _0x1b8e9e=_0x72f6d3==='chat'?_0x8d09('0x6a'):_0x8d09('0x6b');return db[_0x2ced4d+_0x8d09('0x6c')][_0x8d09('0x6d')]({'raw':!![],'where':{'id':_0x303899[_0x8d09('0x1a')]['id']}})['then'](function(_0x28512e){if(_[_0x8d09('0x12')](_0x28512e)){throw new Error(_0x2ced4d+_0x8d09('0x6e'));}_0x9f77df=_0x28512e;return db[_0x2ced4d+_0x8d09('0x6f')]['findOne']({'where':{'id':_0x303899[_0x8d09('0x30')][_0x8d09('0x70')]},'include':[{'model':db[_0x2ced4d+_0x8d09('0x71')],'as':_0x8d09('0x71')},{'model':db[_0x2ced4d+_0x1b8e9e],'as':_0x8d09('0x6b')}]});})['then'](function(_0x1a602c){if(_[_0x8d09('0x12')](_0x1a602c)){throw new Error(_0x2ced4d+_0x8d09('0x72'));}_0x5e6423=_0x1a602c;return _0x1a602c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8d09('0x7')](function(){var _0x514908={'uniqueid':_0x72f6d3+'.'+_0x5e6423['id']+'.'+_0x5e6423[_0x8d09('0x71')]['id'],'FromUserId':_0x303899[_0x8d09('0x32')]['id'],'type':'queue'};_0x514908[_0x2ced4d+_0x8d09('0x73')]=_0x5e6423['id'];_0x514908[_0x2ced4d+'InteractionId']=_0x5e6423[_0x8d09('0x71')]['id'];_0x514908[_0x8d09('0x74')+_0x2ced4d+_0x1b8e9e+'Id']=_0x5e6423[_0x8d09('0x6b')]['id'];_0x514908['To'+_0x2ced4d+_0x8d09('0x75')]=_0x9f77df['id'];return db[_0x2ced4d+'TransferReport'][_0x8d09('0x76')](_0x514908);})[_0x8d09('0x7')](function(){return respondWithRpcPromise(_0x8d09('0x77'),{'channel':_0x72f6d3,'interaction':_0x5e6423[_0x8d09('0x71')],'message':_0x5e6423,'account':_0x5e6423[_0x8d09('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8d09('0x78'),'appdata':_0x9f77df[_0x8d09('0x10')]+','+(_0x5e6423['Account'][_0x8d09('0x79')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x8d09('0x7')](respondWithResult(_0x1eaafa,null))[_0x8d09('0x1b')](handleError(_0x1eaafa,null));};};exports[_0x8d09('0x7a')]=function(_0x36a847,_0x3e3ed9){var _0x2a7ab7,_0x2dc280;if(_[_0x8d09('0x12')](_0x36a847[_0x8d09('0x30')][_0x8d09('0x7b')])){throw new Error(_0x8d09('0x7c'));}var _0x27e6e7=_0x36a847['body']['channel'];var _0x6fba39=_['capitalize'](_0x27e6e7);var _0x37a28a=_0x27e6e7===_0x8d09('0x7d')?_0x8d09('0x6a'):'Account';return db[_0x8d09('0x7e')][_0x8d09('0x6d')]({'raw':!![],'where':{'id':_0x36a847[_0x8d09('0x1a')]['id'],'role':_0x8d09('0x3d')}})[_0x8d09('0x7')](function(_0x2c6204){if(_[_0x8d09('0x12')](_0x2c6204)){throw new Error('Agent\x20not\x20found');}_0x2a7ab7=_0x2c6204;return db[_0x6fba39+_0x8d09('0x6f')][_0x8d09('0x6d')]({'where':{'id':_0x36a847[_0x8d09('0x30')]['messageId']},'include':[{'model':db[_0x6fba39+'Interaction'],'as':'Interaction'},{'model':db[_0x6fba39+_0x37a28a],'as':_0x8d09('0x6b')}]});})[_0x8d09('0x7')](function(_0x2914e4){if(_[_0x8d09('0x12')](_0x2914e4)){throw new Error(_0x6fba39+_0x8d09('0x72'));}_0x2dc280=_0x2914e4;return _0x2914e4['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8d09('0x7')](function(){var _0x12acfb={'uniqueid':_0x27e6e7+'.'+_0x2dc280['id']+'.'+_0x2dc280[_0x8d09('0x71')]['id'],'FromUserId':_0x36a847[_0x8d09('0x32')]['id'],'type':_0x8d09('0x78'),'ToUserId':_0x2a7ab7['id']};_0x12acfb[_0x6fba39+'MessageId']=_0x2dc280['id'];_0x12acfb[_0x6fba39+_0x8d09('0x7f')]=_0x2dc280[_0x8d09('0x71')]['id'];_0x12acfb[_0x8d09('0x74')+_0x6fba39+_0x37a28a+'Id']=_0x2dc280['Account']['id'];return db[_0x6fba39+_0x8d09('0x80')][_0x8d09('0x76')](_0x12acfb);})[_0x8d09('0x7')](function(){return respondWithRpcPromise(_0x8d09('0x77'),{'channel':_0x27e6e7,'interaction':_0x2dc280[_0x8d09('0x71')],'message':_0x2dc280,'account':_0x2dc280[_0x8d09('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2a7ab7[_0x8d09('0x10')]+','+(_0x2dc280[_0x8d09('0x6b')][_0x8d09('0x81')]||0x12c),'interval':_0x8d09('0x82')}]},routingClient);})[_0x8d09('0x7')](respondWithResult(_0x3e3ed9,null))['catch'](handleError(_0x3e3ed9,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3842b8f..393fd07 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 _0x84fe=['get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x4743ef,_0x29ff88){var _0x426d30=function(_0x4b6557){while(--_0x4b6557){_0x4743ef['push'](_0x4743ef['shift']());}};_0x426d30(++_0x29ff88);}(_0x84fe,0x1cd));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe84f('0x2')]();var auth=require(_0xe84f('0x3'));var interaction=require(_0xe84f('0x4'));var config=require(_0xe84f('0x5'));var controller=require(_0xe84f('0x6'));router[_0xe84f('0x7')]('/',auth[_0xe84f('0x8')](),controller[_0xe84f('0x9')]);router[_0xe84f('0x7')](_0xe84f('0xa'),auth[_0xe84f('0x8')](),controller[_0xe84f('0xb')]);router[_0xe84f('0x7')](_0xe84f('0xc'),auth[_0xe84f('0x8')](),controller[_0xe84f('0xd')]);router[_0xe84f('0xe')]('/',auth['isAuthenticated'](),controller[_0xe84f('0xf')]);router[_0xe84f('0x10')](_0xe84f('0xa'),auth[_0xe84f('0x8')](),controller['update']);router['delete'](_0xe84f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xe84f('0x11')]=router; \ No newline at end of file +var _0x47b5=['run','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/run'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x47b5,0x66));var _0x547b=function(_0x2484a1,_0x3f7b87){_0x2484a1=_0x2484a1-0x0;var _0x1032bf=_0x47b5[_0x2484a1];return _0x1032bf;};'use strict';var multer=require(_0x547b('0x0'));var util=require('util');var path=require(_0x547b('0x1'));var timeout=require(_0x547b('0x2'));var express=require(_0x547b('0x3'));var router=express['Router']();var auth=require(_0x547b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x547b('0x5'));var controller=require('./schedule.controller');router[_0x547b('0x6')]('/',auth['isAuthenticated'](),controller[_0x547b('0x7')]);router[_0x547b('0x6')](_0x547b('0x8'),auth[_0x547b('0x9')](),controller[_0x547b('0xa')]);router['get'](_0x547b('0xb'),auth['isAuthenticated'](),controller[_0x547b('0xc')]);router[_0x547b('0xd')]('/',auth[_0x547b('0x9')](),controller[_0x547b('0xe')]);router[_0x547b('0xf')](_0x547b('0x8'),auth['isAuthenticated'](),controller[_0x547b('0x10')]);router[_0x547b('0x11')]('/:id',auth[_0x547b('0x9')](),controller[_0x547b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f9b82a2..e0d094f 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 _0xdbf5=['exports','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','TEXT'];(function(_0x433b40,_0x47a559){var _0xc927c=function(_0x2c0dfb){while(--_0x2c0dfb){_0x433b40['push'](_0x433b40['shift']());}};_0xc927c(++_0x47a559);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x66c81a,_0x3bbf8c){_0x66c81a=_0x66c81a-0x0;var _0x4dd38b=_0xdbf5[_0x66c81a];return _0x4dd38b;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5dbf('0x2')],'allowNull':![],'defaultValue':_0x5dbf('0x3')},'startAt':{'type':Sequelize[_0x5dbf('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5dbf('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5dbf('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5dbf('0x6')](_0x5dbf('0x7'),_0x5dbf('0x8'),_0x5dbf('0x9'),_0x5dbf('0xa'),_0x5dbf('0xb'),_0x5dbf('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x5dbf('0xb')},'output':{'type':Sequelize['ENUM'](_0x5dbf('0xd'),_0x5dbf('0xe'),_0x5dbf('0xf')),'allowNull':![],'defaultValue':_0x5dbf('0xd')},'type':{'type':Sequelize['ENUM'](_0x5dbf('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x5dbf('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa630=['days','hours','minutes','pdf','xlsx','csv','custom','default','STRING','TEXT','sequelize','exports','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa630,0xbe));var _0x0a63=function(_0x24136e,_0x3e91ea){_0x24136e=_0x24136e-0x0;var _0x5379f3=_0xa630[_0x24136e];return _0x5379f3;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0a63('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a63('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0a63('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0a63('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0a63('0x6')](_0x0a63('0x7'),_0x0a63('0x8'),'months',_0x0a63('0x9'),_0x0a63('0xa'),_0x0a63('0xb'),_0x0a63('0xc')),'allowNull':![],'defaultValue':_0x0a63('0xa')},'output':{'type':Sequelize[_0x0a63('0x6')]('csv',_0x0a63('0xd'),_0x0a63('0xe')),'allowNull':![],'defaultValue':_0x0a63('0xf')},'type':{'type':Sequelize[_0x0a63('0x6')](_0x0a63('0x10'),_0x0a63('0x11')),'allowNull':![],'defaultValue':_0x0a63('0x10')},'sendMail':{'type':Sequelize[_0x0a63('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0a63('0x12')]},'cc':{'type':Sequelize[_0x0a63('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0a63('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c448eed..052d2e6 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 _0x0a12=['catch','params','intersection','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','Scheduler','UserProfileResource','status','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll'];(function(_0x1526a7,_0x2a94f4){var _0x14d22b=function(_0x3266be){while(--_0x3266be){_0x1526a7['push'](_0x1526a7['shift']());}};_0x14d22b(++_0x2a94f4);}(_0x0a12,0x10a));var _0x20a1=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x0a12[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0x20a1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x20a1('0x1'));var zipdir=require(_0x20a1('0x2'));var jsonpatch=require(_0x20a1('0x3'));var rp=require(_0x20a1('0x4'));var moment=require(_0x20a1('0x5'));var BPromise=require(_0x20a1('0x6'));var Mustache=require(_0x20a1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x20a1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x20a1('0x9'));var squel=require('squel');var crypto=require(_0x20a1('0xa'));var jsforce=require(_0x20a1('0xb'));var deskjs=require(_0x20a1('0xc'));var toCsv=require(_0x20a1('0xd'));var querystring=require(_0x20a1('0xe'));var Papa=require(_0x20a1('0xf'));var Redis=require('ioredis');var authService=require(_0x20a1('0x10'));var qs=require(_0x20a1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20a1('0x12'));var logger=require(_0x20a1('0x13'))(_0x20a1('0x14'));var utils=require('../../config/utils');var config=require(_0x20a1('0x15'));var licenseUtil=require(_0x20a1('0x16'));var db=require(_0x20a1('0x17'))['db'];function respondWithStatusCode(_0xba9a11,_0x307c0a){_0x307c0a=_0x307c0a||0xcc;return function(_0x3d0cb2){if(_0x3d0cb2){return _0xba9a11[_0x20a1('0x18')](_0x307c0a);}return _0xba9a11['status'](_0x307c0a)[_0x20a1('0x19')]();};}function respondWithResult(_0x265db2,_0x182003){_0x182003=_0x182003||0xc8;return function(_0x3f046f){if(_0x3f046f){return _0x265db2['status'](_0x182003)[_0x20a1('0x1a')](_0x3f046f);}};}function respondWithFilteredResult(_0x5b28a7,_0x193c6b){return function(_0x4d9649){if(_0x4d9649){var _0x2d14f8=_0x4d9649[_0x20a1('0x1b')],_0x103e16=_0x193c6b[_0x20a1('0x1c')],_0x2e371c=_0x193c6b[_0x20a1('0x1c')]+_0x193c6b[_0x20a1('0x1d')],_0x1b99b4;if(_0x2e371c>=_0x2d14f8){_0x2e371c=_0x2d14f8;_0x1b99b4=0xc8;}else{_0x1b99b4=0xce;}_0x5b28a7['status'](_0x1b99b4);return _0x5b28a7['set'](_0x20a1('0x1e'),_0x103e16+'-'+_0x2e371c+'/'+_0x2d14f8)[_0x20a1('0x1a')](_0x4d9649);}return null;};}function patchUpdates(_0x2222cc){return function(_0x1a896a){try{jsonpatch['apply'](_0x1a896a,_0x2222cc,!![]);}catch(_0x3d5c45){return BPromise[_0x20a1('0x1f')](_0x3d5c45);}return _0x1a896a['save']();};}function saveUpdates(_0x530c5c,_0x1ed3d6){return function(_0x264f2c){if(_0x264f2c){return _0x264f2c[_0x20a1('0x20')](_0x530c5c)[_0x20a1('0x21')](function(_0x28cc2b){return _0x28cc2b;});}return null;};}function removeEntity(_0xf9786e,_0x40999c){return function(_0x392766){if(_0x392766){return _0x392766[_0x20a1('0x22')]()[_0x20a1('0x21')](function(){var _0x3312a3=_0x392766[_0x20a1('0x23')]({'plain':!![]});var _0x4bd64e=_0x20a1('0x24');return db[_0x20a1('0x25')]['destroy']({'where':{'type':_0x4bd64e,'resourceId':_0x3312a3['id']}})[_0x20a1('0x21')](function(){return _0x392766;});})[_0x20a1('0x21')](function(){_0xf9786e[_0x20a1('0x26')](0xcc)[_0x20a1('0x19')]();});}};}function handleEntityNotFound(_0x4fa510,_0x3e4815){return function(_0x4ed4be){if(!_0x4ed4be){_0x4fa510[_0x20a1('0x18')](0x194);}return _0x4ed4be;};}function handleError(_0x2b3ac6,_0x4e5261){_0x4e5261=_0x4e5261||0x1f4;return function(_0x322120){logger['error'](_0x322120[_0x20a1('0x27')]);if(_0x322120[_0x20a1('0x28')]){delete _0x322120['name'];}_0x2b3ac6[_0x20a1('0x26')](_0x4e5261)[_0x20a1('0x29')](_0x322120);};}exports[_0x20a1('0x2a')]=function(_0x3a7326,_0x4073c9){var _0x1deb4b={},_0x4dd992={},_0x1e6531={'count':0x0,'rows':[]};var _0x2843d8=_[_0x20a1('0x2b')](db[_0x20a1('0x2c')][_0x20a1('0x2d')],function(_0x25b467){return{'name':_0x25b467[_0x20a1('0x2e')],'type':_0x25b467[_0x20a1('0x2f')]['key']};});_0x4dd992[_0x20a1('0x30')]=_[_0x20a1('0x2b')](_0x2843d8,'name');_0x4dd992[_0x20a1('0x31')]=_[_0x20a1('0x32')](_0x3a7326[_0x20a1('0x31')]);_0x4dd992[_0x20a1('0x33')]=_['intersection'](_0x4dd992['model'],_0x4dd992['query']);_0x1deb4b[_0x20a1('0x34')]=_['intersection'](_0x4dd992['model'],qs[_0x20a1('0x35')](_0x3a7326[_0x20a1('0x31')][_0x20a1('0x35')]));_0x1deb4b[_0x20a1('0x34')]=_0x1deb4b['attributes'][_0x20a1('0x36')]?_0x1deb4b[_0x20a1('0x34')]:_0x4dd992[_0x20a1('0x30')];if(!_0x3a7326['query'][_0x20a1('0x37')](_0x20a1('0x38'))){_0x1deb4b[_0x20a1('0x1d')]=qs[_0x20a1('0x1d')](_0x3a7326[_0x20a1('0x31')][_0x20a1('0x1d')]);_0x1deb4b[_0x20a1('0x1c')]=qs['offset'](_0x3a7326[_0x20a1('0x31')][_0x20a1('0x1c')]);}_0x1deb4b[_0x20a1('0x39')]=qs[_0x20a1('0x3a')](_0x3a7326['query'][_0x20a1('0x3a')]);_0x1deb4b[_0x20a1('0x3b')]=qs[_0x20a1('0x33')](_[_0x20a1('0x3c')](_0x3a7326['query'],_0x4dd992[_0x20a1('0x33')]),_0x2843d8);if(_0x3a7326['query'][_0x20a1('0x3d')]){_0x1deb4b[_0x20a1('0x3b')]=_[_0x20a1('0x3e')](_0x1deb4b[_0x20a1('0x3b')],{'$or':_[_0x20a1('0x2b')](_0x2843d8,function(_0x36caa0){if(_0x36caa0['type']!==_0x20a1('0x3f')){var _0x4494a2={};_0x4494a2[_0x36caa0[_0x20a1('0x28')]]={'$like':'%'+_0x3a7326['query'][_0x20a1('0x3d')]+'%'};return _0x4494a2;}})});}_0x1deb4b=_['merge']({},_0x1deb4b,_0x3a7326[_0x20a1('0x40')]);var _0x139c64={'where':_0x1deb4b[_0x20a1('0x3b')]};return db[_0x20a1('0x2c')][_0x20a1('0x1b')](_0x139c64)[_0x20a1('0x21')](function(_0x331899){_0x1e6531[_0x20a1('0x1b')]=_0x331899;if(_0x3a7326[_0x20a1('0x31')]['includeAll']){_0x1deb4b['include']=[{'all':!![]}];}return db[_0x20a1('0x2c')][_0x20a1('0x41')](_0x1deb4b);})[_0x20a1('0x21')](function(_0x370741){_0x1e6531['rows']=_0x370741;return _0x1e6531;})[_0x20a1('0x21')](respondWithFilteredResult(_0x4073c9,_0x1deb4b))[_0x20a1('0x42')](handleError(_0x4073c9,null));};exports['show']=function(_0x1d121c,_0x53cb24){var _0xde6d91={'raw':![],'where':{'id':_0x1d121c[_0x20a1('0x43')]['id']}},_0x369df7={};_0x369df7['model']=_[_0x20a1('0x32')](db[_0x20a1('0x2c')]['rawAttributes']);_0x369df7[_0x20a1('0x31')]=_[_0x20a1('0x32')](_0x1d121c[_0x20a1('0x31')]);_0x369df7['filters']=_[_0x20a1('0x44')](_0x369df7[_0x20a1('0x30')],_0x369df7[_0x20a1('0x31')]);_0xde6d91[_0x20a1('0x34')]=_[_0x20a1('0x44')](_0x369df7[_0x20a1('0x30')],qs[_0x20a1('0x35')](_0x1d121c[_0x20a1('0x31')][_0x20a1('0x35')]));_0xde6d91[_0x20a1('0x34')]=_0xde6d91[_0x20a1('0x34')][_0x20a1('0x36')]?_0xde6d91[_0x20a1('0x34')]:_0x369df7[_0x20a1('0x30')];if(_0x1d121c[_0x20a1('0x31')][_0x20a1('0x45')]){_0xde6d91[_0x20a1('0x46')]=[{'all':!![]}];}_0xde6d91=_[_0x20a1('0x3e')]({},_0xde6d91,_0x1d121c['options']);return db[_0x20a1('0x2c')][_0x20a1('0x47')](_0xde6d91)[_0x20a1('0x21')](handleEntityNotFound(_0x53cb24,null))['then'](respondWithResult(_0x53cb24,null))[_0x20a1('0x42')](handleError(_0x53cb24,null));};exports[_0x20a1('0x48')]=function(_0x545cd5,_0x2f0328){return db['Schedule'][_0x20a1('0x48')](_0x545cd5[_0x20a1('0x49')],{})[_0x20a1('0x21')](function(_0x2ce84e){var _0x532863=_0x545cd5[_0x20a1('0x4a')][_0x20a1('0x23')]({'plain':!![]});if(!_0x532863)throw new Error(_0x20a1('0x4b'));if(_0x532863[_0x20a1('0x4c')]===_0x20a1('0x4a')){var _0x4f54f2=_0x2ce84e[_0x20a1('0x23')]({'plain':!![]});var _0x1c1165=_0x20a1('0x24');return db[_0x20a1('0x4d')]['find']({'where':{'name':_0x1c1165,'userProfileId':_0x532863[_0x20a1('0x4e')]},'raw':!![]})[_0x20a1('0x21')](function(_0x2535de){if(_0x2535de&&_0x2535de['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4f54f2[_0x20a1('0x28')],'resourceId':_0x4f54f2['id'],'type':_0x2535de['name'],'sectionId':_0x2535de['id']},{})[_0x20a1('0x21')](function(){return _0x2ce84e;});}else{return _0x2ce84e;}})['catch'](function(_0x371357){logger[_0x20a1('0x4f')](_0x20a1('0x50'),_0x371357);throw _0x371357;});}return _0x2ce84e;})[_0x20a1('0x21')](respondWithResult(_0x2f0328,0xc9))[_0x20a1('0x42')](handleError(_0x2f0328,null));};exports[_0x20a1('0x20')]=function(_0x18f48a,_0x46a0fc){if(_0x18f48a[_0x20a1('0x49')]['id']){delete _0x18f48a['body']['id'];}return db[_0x20a1('0x2c')][_0x20a1('0x47')]({'where':{'id':_0x18f48a[_0x20a1('0x43')]['id']}})['then'](handleEntityNotFound(_0x46a0fc,null))['then'](saveUpdates(_0x18f48a[_0x20a1('0x49')],null))[_0x20a1('0x21')](respondWithResult(_0x46a0fc,null))[_0x20a1('0x42')](handleError(_0x46a0fc,null));};exports['destroy']=function(_0x2bf403,_0x2be8b5){return db[_0x20a1('0x2c')][_0x20a1('0x47')]({'where':{'id':_0x2bf403[_0x20a1('0x43')]['id']}})[_0x20a1('0x21')](handleEntityNotFound(_0x2be8b5,null))['then'](removeEntity(_0x2be8b5,null))[_0x20a1('0x42')](handleError(_0x2be8b5,null));};exports[_0x20a1('0x51')]=function(_0x2d1d6e,_0xe9af5e,_0x16c4cf){var _0xc43f28=require(_0x20a1('0x52'));return db['Schedule']['find']({'where':{'id':_0x2d1d6e['params']['id']},'raw':!![]})[_0x20a1('0x21')](handleEntityNotFound(_0xe9af5e,null))['then'](function(){_0xc43f28[_0x20a1('0x51')](_0x2d1d6e[_0x20a1('0x43')]['id']);})[_0x20a1('0x21')](respondWithStatusCode(_0xe9af5e,null))[_0x20a1('0x42')](handleError(_0xe9af5e,null));}; \ No newline at end of file +var _0x0ec0=['map','Schedule','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','reject','then','get','Scheduler','UserProfileResource','stack','name','index'];(function(_0x498a86,_0x27d3fb){var _0x16a89e=function(_0x1c2940){while(--_0x1c2940){_0x498a86['push'](_0x498a86['shift']());}};_0x16a89e(++_0x27d3fb);}(_0x0ec0,0x1c9));var _0x00ec=function(_0x34b7a2,_0x1d0571){_0x34b7a2=_0x34b7a2-0x0;var _0x1d9283=_0x0ec0[_0x34b7a2];return _0x1d9283;};'use strict';var pdf=require(_0x00ec('0x0'));var emlformat=require(_0x00ec('0x1'));var rimraf=require(_0x00ec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00ec('0x3'));var rp=require(_0x00ec('0x4'));var moment=require(_0x00ec('0x5'));var BPromise=require(_0x00ec('0x6'));var Mustache=require('mustache');var util=require(_0x00ec('0x7'));var path=require(_0x00ec('0x8'));var sox=require(_0x00ec('0x9'));var csv=require('to-csv');var ejs=require(_0x00ec('0xa'));var fs=require('fs');var _=require(_0x00ec('0xb'));var squel=require(_0x00ec('0xc'));var crypto=require(_0x00ec('0xd'));var jsforce=require(_0x00ec('0xe'));var deskjs=require(_0x00ec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x00ec('0x10'));var Papa=require('papaparse');var Redis=require(_0x00ec('0x11'));var authService=require(_0x00ec('0x12'));var qs=require(_0x00ec('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00ec('0x14'));var logger=require(_0x00ec('0x15'))('api');var utils=require(_0x00ec('0x16'));var config=require(_0x00ec('0x17'));var licenseUtil=require(_0x00ec('0x18'));var db=require(_0x00ec('0x19'))['db'];function respondWithStatusCode(_0x1859bf,_0x214697){_0x214697=_0x214697||0xcc;return function(_0x53ccc7){if(_0x53ccc7){return _0x1859bf[_0x00ec('0x1a')](_0x214697);}return _0x1859bf[_0x00ec('0x1b')](_0x214697)[_0x00ec('0x1c')]();};}function respondWithResult(_0x3c944d,_0x2350e8){_0x2350e8=_0x2350e8||0xc8;return function(_0x1576ca){if(_0x1576ca){return _0x3c944d[_0x00ec('0x1b')](_0x2350e8)['json'](_0x1576ca);}};}function respondWithFilteredResult(_0x5230ac,_0x3c3a02){return function(_0x4ceadd){if(_0x4ceadd){var _0x4b0bae=_0x4ceadd['count'],_0x7694a9=_0x3c3a02[_0x00ec('0x1d')],_0x5a5ae1=_0x3c3a02['offset']+_0x3c3a02['limit'],_0x133d1c;if(_0x5a5ae1>=_0x4b0bae){_0x5a5ae1=_0x4b0bae;_0x133d1c=0xc8;}else{_0x133d1c=0xce;}_0x5230ac['status'](_0x133d1c);return _0x5230ac[_0x00ec('0x1e')](_0x00ec('0x1f'),_0x7694a9+'-'+_0x5a5ae1+'/'+_0x4b0bae)[_0x00ec('0x20')](_0x4ceadd);}return null;};}function patchUpdates(_0x467ca8){return function(_0x41bee5){try{jsonpatch['apply'](_0x41bee5,_0x467ca8,!![]);}catch(_0x5ac5ed){return BPromise[_0x00ec('0x21')](_0x5ac5ed);}return _0x41bee5['save']();};}function saveUpdates(_0x21fc1c,_0x2fbf64){return function(_0x2537aa){if(_0x2537aa){return _0x2537aa['update'](_0x21fc1c)[_0x00ec('0x22')](function(_0x719ca8){return _0x719ca8;});}return null;};}function removeEntity(_0x108052,_0x2b3fb2){return function(_0x4a0ef9){if(_0x4a0ef9){return _0x4a0ef9['destroy']()['then'](function(){var _0x1ea6a4=_0x4a0ef9[_0x00ec('0x23')]({'plain':!![]});var _0x3c8873=_0x00ec('0x24');return db[_0x00ec('0x25')]['destroy']({'where':{'type':_0x3c8873,'resourceId':_0x1ea6a4['id']}})[_0x00ec('0x22')](function(){return _0x4a0ef9;});})[_0x00ec('0x22')](function(){_0x108052[_0x00ec('0x1b')](0xcc)[_0x00ec('0x1c')]();});}};}function handleEntityNotFound(_0xc7492d,_0x2977da){return function(_0x1cec4d){if(!_0x1cec4d){_0xc7492d[_0x00ec('0x1a')](0x194);}return _0x1cec4d;};}function handleError(_0xc2cbf1,_0x10cfeb){_0x10cfeb=_0x10cfeb||0x1f4;return function(_0x3c931b){logger['error'](_0x3c931b[_0x00ec('0x26')]);if(_0x3c931b[_0x00ec('0x27')]){delete _0x3c931b[_0x00ec('0x27')];}_0xc2cbf1[_0x00ec('0x1b')](_0x10cfeb)['send'](_0x3c931b);};}exports[_0x00ec('0x28')]=function(_0x4d6f18,_0xd46ba7){var _0x115e53={},_0x5cb9d1={},_0xb6634d={'count':0x0,'rows':[]};var _0x560498=_[_0x00ec('0x29')](db[_0x00ec('0x2a')][_0x00ec('0x2b')],function(_0x68ed0a){return{'name':_0x68ed0a['fieldName'],'type':_0x68ed0a[_0x00ec('0x2c')]['key']};});_0x5cb9d1[_0x00ec('0x2d')]=_[_0x00ec('0x29')](_0x560498,_0x00ec('0x27'));_0x5cb9d1[_0x00ec('0x2e')]=_[_0x00ec('0x2f')](_0x4d6f18[_0x00ec('0x2e')]);_0x5cb9d1[_0x00ec('0x30')]=_[_0x00ec('0x31')](_0x5cb9d1[_0x00ec('0x2d')],_0x5cb9d1[_0x00ec('0x2e')]);_0x115e53[_0x00ec('0x32')]=_[_0x00ec('0x31')](_0x5cb9d1[_0x00ec('0x2d')],qs[_0x00ec('0x33')](_0x4d6f18[_0x00ec('0x2e')]['fields']));_0x115e53[_0x00ec('0x32')]=_0x115e53[_0x00ec('0x32')][_0x00ec('0x34')]?_0x115e53[_0x00ec('0x32')]:_0x5cb9d1['model'];if(!_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x35')](_0x00ec('0x36'))){_0x115e53[_0x00ec('0x37')]=qs[_0x00ec('0x37')](_0x4d6f18[_0x00ec('0x2e')]['limit']);_0x115e53[_0x00ec('0x1d')]=qs[_0x00ec('0x1d')](_0x4d6f18[_0x00ec('0x2e')]['offset']);}_0x115e53['order']=qs['sort'](_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x38')]);_0x115e53[_0x00ec('0x39')]=qs[_0x00ec('0x30')](_[_0x00ec('0x3a')](_0x4d6f18[_0x00ec('0x2e')],_0x5cb9d1[_0x00ec('0x30')]),_0x560498);if(_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x3b')]){_0x115e53[_0x00ec('0x39')]=_['merge'](_0x115e53[_0x00ec('0x39')],{'$or':_[_0x00ec('0x29')](_0x560498,function(_0x3c7fe2){if(_0x3c7fe2[_0x00ec('0x2c')]!==_0x00ec('0x3c')){var _0x4c93cf={};_0x4c93cf[_0x3c7fe2[_0x00ec('0x27')]]={'$like':'%'+_0x4d6f18['query'][_0x00ec('0x3b')]+'%'};return _0x4c93cf;}})});}_0x115e53=_[_0x00ec('0x3d')]({},_0x115e53,_0x4d6f18[_0x00ec('0x3e')]);var _0x316f5e={'where':_0x115e53[_0x00ec('0x39')]};return db[_0x00ec('0x2a')][_0x00ec('0x3f')](_0x316f5e)['then'](function(_0x241ccd){_0xb6634d['count']=_0x241ccd;if(_0x4d6f18[_0x00ec('0x2e')][_0x00ec('0x40')]){_0x115e53[_0x00ec('0x41')]=[{'all':!![]}];}return db[_0x00ec('0x2a')]['findAll'](_0x115e53);})[_0x00ec('0x22')](function(_0xb311df){_0xb6634d[_0x00ec('0x42')]=_0xb311df;return _0xb6634d;})[_0x00ec('0x22')](respondWithFilteredResult(_0xd46ba7,_0x115e53))[_0x00ec('0x43')](handleError(_0xd46ba7,null));};exports[_0x00ec('0x44')]=function(_0xed8b37,_0xb06072){var _0x2d9afe={'raw':![],'where':{'id':_0xed8b37['params']['id']}},_0x8f52f3={};_0x8f52f3[_0x00ec('0x2d')]=_[_0x00ec('0x2f')](db['Schedule'][_0x00ec('0x2b')]);_0x8f52f3[_0x00ec('0x2e')]=_[_0x00ec('0x2f')](_0xed8b37['query']);_0x8f52f3[_0x00ec('0x30')]=_[_0x00ec('0x31')](_0x8f52f3[_0x00ec('0x2d')],_0x8f52f3['query']);_0x2d9afe[_0x00ec('0x32')]=_[_0x00ec('0x31')](_0x8f52f3[_0x00ec('0x2d')],qs['fields'](_0xed8b37[_0x00ec('0x2e')][_0x00ec('0x33')]));_0x2d9afe[_0x00ec('0x32')]=_0x2d9afe[_0x00ec('0x32')][_0x00ec('0x34')]?_0x2d9afe[_0x00ec('0x32')]:_0x8f52f3[_0x00ec('0x2d')];if(_0xed8b37[_0x00ec('0x2e')][_0x00ec('0x40')]){_0x2d9afe[_0x00ec('0x41')]=[{'all':!![]}];}_0x2d9afe=_[_0x00ec('0x3d')]({},_0x2d9afe,_0xed8b37[_0x00ec('0x3e')]);return db[_0x00ec('0x2a')]['find'](_0x2d9afe)[_0x00ec('0x22')](handleEntityNotFound(_0xb06072,null))[_0x00ec('0x22')](respondWithResult(_0xb06072,null))[_0x00ec('0x43')](handleError(_0xb06072,null));};exports[_0x00ec('0x45')]=function(_0x208eae,_0x26a8f0){return db['Schedule'][_0x00ec('0x45')](_0x208eae[_0x00ec('0x46')],{})['then'](function(_0x386f2f){var _0x456fd0=_0x208eae[_0x00ec('0x47')][_0x00ec('0x23')]({'plain':!![]});if(!_0x456fd0)throw new Error(_0x00ec('0x48'));if(_0x456fd0[_0x00ec('0x49')]===_0x00ec('0x47')){var _0x3f7f1=_0x386f2f[_0x00ec('0x23')]({'plain':!![]});var _0x5e34ce='Scheduler';return db[_0x00ec('0x4a')][_0x00ec('0x4b')]({'where':{'name':_0x5e34ce,'userProfileId':_0x456fd0['userProfileId']},'raw':!![]})[_0x00ec('0x22')](function(_0x34b011){if(_0x34b011&&_0x34b011[_0x00ec('0x4c')]===0x0){return db[_0x00ec('0x25')][_0x00ec('0x45')]({'name':_0x3f7f1[_0x00ec('0x27')],'resourceId':_0x3f7f1['id'],'type':_0x34b011[_0x00ec('0x27')],'sectionId':_0x34b011['id']},{})[_0x00ec('0x22')](function(){return _0x386f2f;});}else{return _0x386f2f;}})[_0x00ec('0x43')](function(_0x2af6f1){logger[_0x00ec('0x4d')](_0x00ec('0x4e'),_0x2af6f1);throw _0x2af6f1;});}return _0x386f2f;})[_0x00ec('0x22')](respondWithResult(_0x26a8f0,0xc9))[_0x00ec('0x43')](handleError(_0x26a8f0,null));};exports[_0x00ec('0x4f')]=function(_0x58e98c,_0x39211c){if(_0x58e98c['body']['id']){delete _0x58e98c[_0x00ec('0x46')]['id'];}return db[_0x00ec('0x2a')][_0x00ec('0x4b')]({'where':{'id':_0x58e98c[_0x00ec('0x50')]['id']}})['then'](handleEntityNotFound(_0x39211c,null))[_0x00ec('0x22')](saveUpdates(_0x58e98c['body'],null))[_0x00ec('0x22')](respondWithResult(_0x39211c,null))[_0x00ec('0x43')](handleError(_0x39211c,null));};exports[_0x00ec('0x51')]=function(_0x95b63c,_0x1136bb){return db[_0x00ec('0x2a')][_0x00ec('0x4b')]({'where':{'id':_0x95b63c[_0x00ec('0x50')]['id']}})[_0x00ec('0x22')](handleEntityNotFound(_0x1136bb,null))[_0x00ec('0x22')](removeEntity(_0x1136bb,null))[_0x00ec('0x43')](handleError(_0x1136bb,null));};exports[_0x00ec('0x52')]=function(_0x199595,_0x56cdf0,_0x138be0){var _0x8592fd=require('../../config/schedule');return db[_0x00ec('0x2a')][_0x00ec('0x4b')]({'where':{'id':_0x199595['params']['id']},'raw':!![]})[_0x00ec('0x22')](handleEntityNotFound(_0x56cdf0,null))[_0x00ec('0x22')](function(){_0x8592fd[_0x00ec('0x52')](_0x199595[_0x00ec('0x50')]['id']);})[_0x00ec('0x22')](respondWithStatusCode(_0x56cdf0,null))['catch'](handleError(_0x56cdf0,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 12d781f..a8c0678 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 _0xa63e=['./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x44c271,_0x2a3f7c){var _0x38b5bc=function(_0x42a94c){while(--_0x42a94c){_0x44c271['push'](_0x44c271['shift']());}};_0x38b5bc(++_0x2a3f7c);}(_0xa63e,0x13c));var _0xea63=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa63e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xea63('0x0'));var util=require(_0xea63('0x1'));var logger=require(_0xea63('0x2'))(_0xea63('0x3'));var moment=require('moment');var BPromise=require(_0xea63('0x4'));var rp=require(_0xea63('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea63('0x6'));var config=require(_0xea63('0x7'));var attributes=require(_0xea63('0x8'));module['exports']=function(_0x28ec3a,_0x278052){return _0x28ec3a[_0xea63('0x9')](_0xea63('0xa'),attributes,{'tableName':_0xea63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb2d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xcb2d,0x1a0));var _0xdcb2=function(_0xcc7039,_0x5a3274){_0xcc7039=_0xcc7039-0x0;var _0x4e308a=_0xcb2d[_0xcc7039];return _0x4e308a;};'use strict';var _=require(_0xdcb2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdcb2('0x1'));var moment=require(_0xdcb2('0x2'));var BPromise=require(_0xdcb2('0x3'));var rp=require(_0xdcb2('0x4'));var fs=require('fs');var path=require(_0xdcb2('0x5'));var rimraf=require(_0xdcb2('0x6'));var config=require(_0xdcb2('0x7'));var attributes=require(_0xdcb2('0x8'));module[_0xdcb2('0x9')]=function(_0x385c06,_0x26aee7){return _0x385c06[_0xdcb2('0xa')](_0xdcb2('0xb'),attributes,{'tableName':_0xdcb2('0xc'),'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 26b1093..215114c 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 _0xb76f=['../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x511019,_0x57e5a7){var _0x101183=function(_0x58ab2a){while(--_0x58ab2a){_0x511019['push'](_0x511019['shift']());}};_0x101183(++_0x57e5a7);}(_0xb76f,0x16e));var _0xfb76=function(_0x3299c2,_0x51f479){_0x3299c2=_0x3299c2-0x0;var _0x2cdc44=_0xb76f[_0x3299c2];return _0x2cdc44;};'use strict';var _=require(_0xfb76('0x0'));var util=require(_0xfb76('0x1'));var moment=require(_0xfb76('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb76('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb76('0x4'))['db'];var utils=require(_0xfb76('0x5'));var logger=require(_0xfb76('0x6'))(_0xfb76('0x7'));var config=require(_0xfb76('0x8'));var jayson=require(_0xfb76('0x9'));var client=jayson[_0xfb76('0xa')][_0xfb76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b69e,_0x5086b7,_0x2a2784){return new BPromise(function(_0xb1fc65,_0x118f5f){return client[_0xfb76('0xc')](_0x33b69e,_0x2a2784)['then'](function(_0x42dc74){logger[_0xfb76('0xd')](_0xfb76('0xe'),_0x5086b7,_0xfb76('0xf'));logger[_0xfb76('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5086b7,'request\x20sent',JSON[_0xfb76('0x11')](_0x42dc74));if(_0x42dc74[_0xfb76('0x12')]){if(_0x42dc74[_0xfb76('0x12')][_0xfb76('0x13')]===0x1f4){logger[_0xfb76('0x12')](_0xfb76('0xe'),_0x5086b7,_0x42dc74['error'][_0xfb76('0x14')]);return _0x118f5f(_0x42dc74['error'][_0xfb76('0x14')]);}logger[_0xfb76('0x12')](_0xfb76('0xe'),_0x5086b7,_0x42dc74['error'][_0xfb76('0x14')]);return _0xb1fc65(_0x42dc74[_0xfb76('0x12')][_0xfb76('0x14')]);}else{logger[_0xfb76('0xd')](_0xfb76('0xe'),_0x5086b7,'request\x20sent');_0xb1fc65(_0x42dc74[_0xfb76('0x15')][_0xfb76('0x14')]);}})['catch'](function(_0x4470d8){logger[_0xfb76('0x12')](_0xfb76('0xe'),_0x5086b7,_0x4470d8);_0x118f5f(_0x4470d8);});});} \ No newline at end of file +var _0x7ad6=['debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','Schedule,\x20%s,\x20%s'];(function(_0x205489,_0x36bc54){var _0x5da094=function(_0x4faae3){while(--_0x4faae3){_0x205489['push'](_0x205489['shift']());}};_0x5da094(++_0x36bc54);}(_0x7ad6,0x158));var _0x67ad=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7ad6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x67ad('0x0'));var moment=require(_0x67ad('0x1'));var BPromise=require(_0x67ad('0x2'));var rs=require(_0x67ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67ad('0x4'))['db'];var utils=require(_0x67ad('0x5'));var logger=require('../../config/logger')(_0x67ad('0x6'));var config=require(_0x67ad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x67ad('0x8')][_0x67ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19562b,_0x5892bc,_0x21a1d3){return new BPromise(function(_0x2997ee,_0xf7de77){return client['request'](_0x19562b,_0x21a1d3)[_0x67ad('0xa')](function(_0x1a5230){logger[_0x67ad('0xb')](_0x67ad('0xc'),_0x5892bc,'request\x20sent');logger[_0x67ad('0xd')](_0x67ad('0xe'),_0x5892bc,_0x67ad('0xf'),JSON[_0x67ad('0x10')](_0x1a5230));if(_0x1a5230[_0x67ad('0x11')]){if(_0x1a5230[_0x67ad('0x11')]['code']===0x1f4){logger[_0x67ad('0x11')](_0x67ad('0xc'),_0x5892bc,_0x1a5230['error'][_0x67ad('0x12')]);return _0xf7de77(_0x1a5230[_0x67ad('0x11')]['message']);}logger['error']('Schedule,\x20%s,\x20%s',_0x5892bc,_0x1a5230[_0x67ad('0x11')]['message']);return _0x2997ee(_0x1a5230[_0x67ad('0x11')][_0x67ad('0x12')]);}else{logger[_0x67ad('0xb')](_0x67ad('0xc'),_0x5892bc,_0x67ad('0xf'));_0x2997ee(_0x1a5230[_0x67ad('0x13')][_0x67ad('0x12')]);}})[_0x67ad('0x14')](function(_0x47c5b7){logger['error'](_0x67ad('0xc'),_0x5892bc,_0x47c5b7);_0xf7de77(_0x47c5b7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c455bcc..82ef041 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 _0xcb4e=['delete','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','download','post','put','update'];(function(_0x411f8d,_0x34f587){var _0x7997a5=function(_0x194de0){while(--_0x194de0){_0x411f8d['push'](_0x411f8d['shift']());}};_0x7997a5(++_0x34f587);}(_0xcb4e,0x134));var _0xecb4=function(_0x3eaf3b,_0xc8ebc3){_0x3eaf3b=_0x3eaf3b-0x0;var _0x9bc405=_0xcb4e[_0x3eaf3b];return _0x9bc405;};'use strict';var multer=require(_0xecb4('0x0'));var util=require(_0xecb4('0x1'));var path=require('path');var timeout=require(_0xecb4('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xecb4('0x3'));var config=require(_0xecb4('0x4'));var controller=require('./screenRecording.controller');router[_0xecb4('0x5')]('/',auth[_0xecb4('0x6')](),controller[_0xecb4('0x7')]);router['get'](_0xecb4('0x8'),auth[_0xecb4('0x6')](),controller[_0xecb4('0x9')]);router[_0xecb4('0x5')]('/:id',auth[_0xecb4('0x6')](),controller[_0xecb4('0xa')]);router[_0xecb4('0x5')]('/:id/download',auth[_0xecb4('0x6')](),controller[_0xecb4('0xb')]);router[_0xecb4('0xc')]('/',auth[_0xecb4('0x6')](),controller['create']);router[_0xecb4('0xd')]('/:id',auth[_0xecb4('0x6')](),controller[_0xecb4('0xe')]);router[_0xecb4('0xf')]('/:id',auth[_0xecb4('0x6')](),controller['destroy']);module[_0xecb4('0x10')]=router; \ No newline at end of file +var _0x5d20=['update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','create','put'];(function(_0x17e099,_0x2a46ac){var _0x3719dc=function(_0x4cf4fa){while(--_0x4cf4fa){_0x17e099['push'](_0x17e099['shift']());}};_0x3719dc(++_0x2a46ac);}(_0x5d20,0xb7));var _0x05d2=function(_0x2e77c3,_0x3181d2){_0x2e77c3=_0x2e77c3-0x0;var _0x5c9031=_0x5d20[_0x2e77c3];return _0x5c9031;};'use strict';var multer=require(_0x05d2('0x0'));var util=require(_0x05d2('0x1'));var path=require(_0x05d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x05d2('0x3'));var router=express[_0x05d2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x05d2('0x5'));var config=require(_0x05d2('0x6'));var controller=require('./screenRecording.controller');router[_0x05d2('0x7')]('/',auth[_0x05d2('0x8')](),controller['index']);router[_0x05d2('0x7')](_0x05d2('0x9'),auth['isAuthenticated'](),controller[_0x05d2('0xa')]);router[_0x05d2('0x7')](_0x05d2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x05d2('0x7')](_0x05d2('0xc'),auth[_0x05d2('0x8')](),controller[_0x05d2('0xd')]);router[_0x05d2('0xe')]('/',auth[_0x05d2('0x8')](),controller[_0x05d2('0xf')]);router[_0x05d2('0x10')](_0x05d2('0xb'),auth['isAuthenticated'](),controller[_0x05d2('0x11')]);router['delete'](_0x05d2('0xb'),auth[_0x05d2('0x8')](),controller[_0x05d2('0x12')]);module[_0x05d2('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9994905..130af07 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 _0x55ca=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','extname','value'];(function(_0x34ef44,_0x462e43){var _0x5ca03b=function(_0x40be90){while(--_0x40be90){_0x34ef44['push'](_0x34ef44['shift']());}};_0x5ca03b(++_0x462e43);}(_0x55ca,0x126));var _0xa55c=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x55ca[_0xfd495c];return _0x561dd8;};'use strict';var Sequelize=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xa55c('0x2')],'get':function(){return this[_0xa55c('0x3')]('value')?path[_0xa55c('0x4')](this[_0xa55c('0x3')](_0xa55c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa55c('0x6')]},'channel':{'type':Sequelize[_0xa55c('0x6')]},'value':{'type':Sequelize[_0xa55c('0x6')],'set':function(_0x36b623){var _0x4d0624=_0x36b623[_0xa55c('0x7')](/\\/g,'/');this[_0xa55c('0x8')]('value',_0x4d0624);}},'rating':{'type':Sequelize[_0xa55c('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa55c('0x9')],'set':function(_0x52a3bc){this['setDataValue'](_0xa55c('0xa'),moment()[_0xa55c('0xb')](_0x52a3bc,'ms'));this[_0xa55c('0x8')](_0xa55c('0xc'),moment());this[_0xa55c('0x8')](_0xa55c('0xd'),_0x52a3bc);}},'startedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0xa')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0xa55c('0x10'))[_0xa55c('0x11')]();}},'createdAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x12')))[_0xa55c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xa55c('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa55c('0xe')],'get':function(){return moment(this[_0xa55c('0x3')](_0xa55c('0x13')))[_0xa55c('0xf')](_0xa55c('0x10'))[_0xa55c('0x11')]();}}}; \ No newline at end of file +var _0xee14=['extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value'];(function(_0x10df85,_0x12bcdd){var _0x680fc=function(_0x292b01){while(--_0x292b01){_0x10df85['push'](_0x10df85['shift']());}};_0x680fc(++_0x12bcdd);}(_0xee14,0x13a));var _0x4ee1=function(_0x5c565c,_0x55fc8d){_0x5c565c=_0x5c565c-0x0;var _0x389886=_0xee14[_0x5c565c];return _0x389886;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x4ee1('0x0'));var config=require(_0x4ee1('0x1'));module[_0x4ee1('0x2')]={'format':{'type':Sequelize[_0x4ee1('0x3')],'get':function(){return this[_0x4ee1('0x4')](_0x4ee1('0x5'))?path[_0x4ee1('0x6')](this[_0x4ee1('0x4')](_0x4ee1('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4ee1('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x327c18){var _0x3a45a3=_0x327c18[_0x4ee1('0x8')](/\\/g,'/');this[_0x4ee1('0x9')](_0x4ee1('0x5'),_0x3a45a3);}},'rating':{'type':Sequelize[_0x4ee1('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x33dbe6){this[_0x4ee1('0x9')]('startedAt',moment()[_0x4ee1('0xb')](_0x33dbe6,'ms'));this[_0x4ee1('0x9')](_0x4ee1('0xc'),moment());this[_0x4ee1('0x9')]('duration',_0x33dbe6);}},'startedAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0xe')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0xc')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}},'createdAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0x12')))[_0x4ee1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4ee1('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4ee1('0xd')],'get':function(){return moment(this[_0x4ee1('0x4')](_0x4ee1('0x13')))[_0x4ee1('0xf')](_0x4ee1('0x10'))[_0x4ee1('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2ace8ee..1fac132 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 _0xcf60=['findAll','params','rawAttributes','length','find','catch','create','body','duration','createdAt','describe','download','../../components/encryptor','uniqueid','value','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','join','root','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ScreenRecording','fieldName','type','key','differenceBy','format','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll'];(function(_0x4d38b9,_0x323a8b){var _0x5c734d=function(_0x4d2185){while(--_0x4d2185){_0x4d38b9['push'](_0x4d38b9['shift']());}};_0x5c734d(++_0x323a8b);}(_0xcf60,0x1d1));var _0x0cf6=function(_0x160665,_0x2504f0){_0x160665=_0x160665-0x0;var _0x469385=_0xcf60[_0x160665];return _0x469385;};'use strict';var pdf=require(_0x0cf6('0x0'));var emlformat=require(_0x0cf6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0cf6('0x2'));var jsonpatch=require(_0x0cf6('0x3'));var rp=require(_0x0cf6('0x4'));var moment=require('moment');var BPromise=require(_0x0cf6('0x5'));var Mustache=require(_0x0cf6('0x6'));var util=require(_0x0cf6('0x7'));var path=require(_0x0cf6('0x8'));var sox=require(_0x0cf6('0x9'));var csv=require(_0x0cf6('0xa'));var ejs=require(_0x0cf6('0xb'));var fs=require('fs');var _=require(_0x0cf6('0xc'));var squel=require(_0x0cf6('0xd'));var crypto=require('crypto');var jsforce=require(_0x0cf6('0xe'));var deskjs=require(_0x0cf6('0xf'));var toCsv=require(_0x0cf6('0xa'));var querystring=require(_0x0cf6('0x10'));var Papa=require(_0x0cf6('0x11'));var Redis=require('ioredis');var authService=require(_0x0cf6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0cf6('0x13'));var hardwareService=require(_0x0cf6('0x14'));var logger=require(_0x0cf6('0x15'))(_0x0cf6('0x16'));var utils=require('../../config/utils');var config=require(_0x0cf6('0x17'));var licenseUtil=require(_0x0cf6('0x18'));var db=require(_0x0cf6('0x19'))['db'];function respondWithStatusCode(_0x1c9c6e,_0x330c13){_0x330c13=_0x330c13||0xcc;return function(_0x451789){if(_0x451789){return _0x1c9c6e[_0x0cf6('0x1a')](_0x330c13);}return _0x1c9c6e[_0x0cf6('0x1b')](_0x330c13)[_0x0cf6('0x1c')]();};}function respondWithResult(_0x4145f1,_0x3e3c4e){_0x3e3c4e=_0x3e3c4e||0xc8;return function(_0x35fa5b){if(_0x35fa5b){return _0x4145f1['status'](_0x3e3c4e)[_0x0cf6('0x1d')](_0x35fa5b);}};}function respondWithFilteredResult(_0x4ce5a9,_0x291cbf){return function(_0x1e5bab){if(_0x1e5bab){var _0x5bc6a6=_0x1e5bab['count'],_0x408dc3=_0x291cbf[_0x0cf6('0x1e')],_0x1cd2e2=_0x291cbf[_0x0cf6('0x1e')]+_0x291cbf[_0x0cf6('0x1f')],_0x336bf4;if(_0x1cd2e2>=_0x5bc6a6){_0x1cd2e2=_0x5bc6a6;_0x336bf4=0xc8;}else{_0x336bf4=0xce;}_0x4ce5a9[_0x0cf6('0x1b')](_0x336bf4);return _0x4ce5a9[_0x0cf6('0x20')](_0x0cf6('0x21'),_0x408dc3+'-'+_0x1cd2e2+'/'+_0x5bc6a6)[_0x0cf6('0x1d')](_0x1e5bab);}return null;};}function patchUpdates(_0x535f08){return function(_0x172847){try{jsonpatch[_0x0cf6('0x22')](_0x172847,_0x535f08,!![]);}catch(_0x473527){return BPromise[_0x0cf6('0x23')](_0x473527);}return _0x172847[_0x0cf6('0x24')]();};}function saveUpdates(_0x4037bc,_0x3f8297){return function(_0x2742f4){if(_0x2742f4){return _0x2742f4[_0x0cf6('0x25')](_0x4037bc)[_0x0cf6('0x26')](function(_0xcf957d){return _0xcf957d;});}return null;};}function removeEntity(_0x4a95d6,_0x938b37){return function(_0x9db8e3){if(_0x9db8e3){return _0x9db8e3[_0x0cf6('0x27')]()[_0x0cf6('0x26')](function(){_0x4a95d6['status'](0xcc)[_0x0cf6('0x1c')]();});}};}function handleEntityNotFound(_0x33b051,_0x265209){return function(_0x1f72f0){if(!_0x1f72f0){_0x33b051['sendStatus'](0x194);}return _0x1f72f0;};}function handleError(_0xa2be10,_0x1e78b3){_0x1e78b3=_0x1e78b3||0x1f4;return function(_0x18b533){logger[_0x0cf6('0x28')](_0x18b533['stack']);if(_0x18b533['name']){delete _0x18b533[_0x0cf6('0x29')];}_0xa2be10[_0x0cf6('0x1b')](_0x1e78b3)[_0x0cf6('0x2a')](_0x18b533);};}exports[_0x0cf6('0x2b')]=function(_0x2c0ff3,_0xb2995a){var _0x35b785={},_0x24c091={},_0x3ac5e3={'count':0x0,'rows':[]};var _0x5232f2=_[_0x0cf6('0x2c')](db[_0x0cf6('0x2d')]['rawAttributes'],function(_0x4396ba){return{'name':_0x4396ba[_0x0cf6('0x2e')],'type':_0x4396ba[_0x0cf6('0x2f')][_0x0cf6('0x30')]};});_0x24c091['model']=_[_0x0cf6('0x31')](_[_0x0cf6('0x2c')](_0x5232f2,'name'),[_0x0cf6('0x32')]);_0x24c091[_0x0cf6('0x33')]=_[_0x0cf6('0x34')](_0x2c0ff3[_0x0cf6('0x33')]);_0x24c091[_0x0cf6('0x35')]=_['intersection'](_0x24c091[_0x0cf6('0x36')],_0x24c091[_0x0cf6('0x33')]);_0x35b785['attributes']=_[_0x0cf6('0x37')](_0x24c091[_0x0cf6('0x36')],qs[_0x0cf6('0x38')](_0x2c0ff3['query'][_0x0cf6('0x38')]));_0x35b785[_0x0cf6('0x39')]=_0x35b785[_0x0cf6('0x39')]['length']?_0x35b785[_0x0cf6('0x39')]:_0x24c091[_0x0cf6('0x36')];if(!_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3a')](_0x0cf6('0x3b'))){_0x35b785['limit']=qs[_0x0cf6('0x1f')](_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x1f')]);_0x35b785[_0x0cf6('0x1e')]=qs[_0x0cf6('0x1e')](_0x2c0ff3['query'][_0x0cf6('0x1e')]);}_0x35b785[_0x0cf6('0x3c')]=qs['sort'](_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3d')]);_0x35b785['where']=qs['filters'](_[_0x0cf6('0x3e')](_0x2c0ff3[_0x0cf6('0x33')],_0x24c091[_0x0cf6('0x35')]),_0x5232f2);if(_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3f')]){_0x35b785[_0x0cf6('0x40')]=_['merge'](_0x35b785[_0x0cf6('0x40')],{'$or':_[_0x0cf6('0x2c')](_0x5232f2,function(_0x54fee0){if(_0x54fee0[_0x0cf6('0x2f')]!==_0x0cf6('0x41')){var _0xaf43c8={};_0xaf43c8[_0x54fee0[_0x0cf6('0x29')]]={'$like':'%'+_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x3f')]+'%'};return _0xaf43c8;}})});}_0x35b785=_[_0x0cf6('0x42')]({},_0x35b785,_0x2c0ff3[_0x0cf6('0x43')]);var _0x377452={'where':_0x35b785[_0x0cf6('0x40')]};return db[_0x0cf6('0x2d')]['count'](_0x377452)[_0x0cf6('0x26')](function(_0x759303){_0x3ac5e3[_0x0cf6('0x44')]=_0x759303;if(_0x2c0ff3[_0x0cf6('0x33')][_0x0cf6('0x45')]){_0x35b785['include']=[{'all':!![]}];}return db[_0x0cf6('0x2d')][_0x0cf6('0x46')](_0x35b785);})[_0x0cf6('0x26')](function(_0x5cc204){_0x3ac5e3['rows']=_0x5cc204;return _0x3ac5e3;})['then'](respondWithFilteredResult(_0xb2995a,_0x35b785))['catch'](handleError(_0xb2995a,null));};exports['show']=function(_0x4c73ad,_0x5f5a62){var _0x21bbce={'raw':![],'where':{'id':_0x4c73ad[_0x0cf6('0x47')]['id']}},_0x563ce2={};_0x563ce2[_0x0cf6('0x36')]=_[_0x0cf6('0x34')](db[_0x0cf6('0x2d')][_0x0cf6('0x48')]);_0x563ce2[_0x0cf6('0x33')]=_[_0x0cf6('0x34')](_0x4c73ad['query']);_0x563ce2[_0x0cf6('0x35')]=_[_0x0cf6('0x37')](_0x563ce2[_0x0cf6('0x36')],_0x563ce2[_0x0cf6('0x33')]);_0x21bbce[_0x0cf6('0x39')]=_[_0x0cf6('0x37')](_0x563ce2['model'],qs['fields'](_0x4c73ad[_0x0cf6('0x33')][_0x0cf6('0x38')]));_0x21bbce[_0x0cf6('0x39')]=_0x21bbce[_0x0cf6('0x39')][_0x0cf6('0x49')]?_0x21bbce[_0x0cf6('0x39')]:_0x563ce2['model'];if(_0x4c73ad[_0x0cf6('0x33')][_0x0cf6('0x45')]){_0x21bbce['include']=[{'all':!![]}];}_0x21bbce=_[_0x0cf6('0x42')]({},_0x21bbce,_0x4c73ad['options']);return db[_0x0cf6('0x2d')][_0x0cf6('0x4a')](_0x21bbce)['then'](handleEntityNotFound(_0x5f5a62,null))[_0x0cf6('0x26')](respondWithResult(_0x5f5a62,null))[_0x0cf6('0x4b')](handleError(_0x5f5a62,null));};exports[_0x0cf6('0x4c')]=function(_0x4cace1,_0x35c827){return db[_0x0cf6('0x2d')][_0x0cf6('0x4c')](_0x4cace1[_0x0cf6('0x4d')],{})[_0x0cf6('0x26')](respondWithResult(_0x35c827,0xc9))['catch'](handleError(_0x35c827,null));};exports[_0x0cf6('0x25')]=function(_0x603b00,_0x3412de){if(_0x603b00['body']['id']){delete _0x603b00[_0x0cf6('0x4d')]['id'];}delete _0x603b00[_0x0cf6('0x4d')][_0x0cf6('0x4e')];delete _0x603b00[_0x0cf6('0x4d')][_0x0cf6('0x4f')];delete _0x603b00[_0x0cf6('0x4d')]['closedAt'];delete _0x603b00['body']['value'];return db[_0x0cf6('0x2d')]['find']({'where':{'id':_0x603b00[_0x0cf6('0x47')]['id']}})[_0x0cf6('0x26')](handleEntityNotFound(_0x3412de,null))[_0x0cf6('0x26')](saveUpdates(_0x603b00[_0x0cf6('0x4d')],null))[_0x0cf6('0x26')](respondWithResult(_0x3412de,null))['catch'](handleError(_0x3412de,null));};exports[_0x0cf6('0x50')]=function(_0x44145f,_0x3f4f5f){return db[_0x0cf6('0x2d')]['describe']()[_0x0cf6('0x26')](respondWithResult(_0x3f4f5f,null))[_0x0cf6('0x4b')](handleError(_0x3f4f5f,null));};exports[_0x0cf6('0x51')]=function(_0x3f4fcb,_0x6e1763,_0x205b09){var _0x527c75=require(_0x0cf6('0x52'));var _0x381432=![];var _0x2d5f59={};if(_0x3f4fcb[_0x0cf6('0x33')]['type']&&_0x3f4fcb[_0x0cf6('0x33')]['type']==='uniqueid'){_0x2d5f59[_0x0cf6('0x53')]=_0x3f4fcb[_0x0cf6('0x47')]['id'];}else{_0x2d5f59['id']=_0x3f4fcb[_0x0cf6('0x47')]['id'];}return db[_0x0cf6('0x2d')]['find']({'where':_0x2d5f59,'attributes':['id',_0x0cf6('0x54')],'raw':!![]})[_0x0cf6('0x26')](handleEntityNotFound(_0x6e1763,null))[_0x0cf6('0x26')](function(_0x57fada){if(_0x57fada){var _0x314a0d=path['join'](config['root'],_0x0cf6('0x55'),_0x57fada[_0x0cf6('0x54')]);var _0x10e186=util['format'](_0x0cf6('0x56'),_0x314a0d);if(fs[_0x0cf6('0x57')](_0x10e186)){_0x381432=!![];return _0x527c75['decryptFile'](_0x10e186,_0x314a0d,config[_0x0cf6('0x58')][_0x0cf6('0x59')])[_0x0cf6('0x26')](function(){return _0x57fada;});}return _0x57fada;}})['then'](function(_0x1d9326){if(_0x1d9326){var _0x409856=path['join'](config['root'],_0x0cf6('0x55'),_0x1d9326[_0x0cf6('0x54')]);if(!fs['existsSync'](_0x409856)){throw new db[(_0x0cf6('0x5a'))][(_0x0cf6('0x5b'))](_0x0cf6('0x5c'));}if(_0x1d9326[_0x0cf6('0x5d')]){return _0x6e1763[_0x0cf6('0x51')](_0x409856,_0x1d9326[_0x0cf6('0x5d')]+path[_0x0cf6('0x5e')](_0x409856),function(){if(_0x381432){fs[_0x0cf6('0x5f')](_0x409856);}});}else{return _0x6e1763[_0x0cf6('0x51')](_0x409856,function(_0x47457b){if(_0x381432){fs[_0x0cf6('0x5f')](_0x409856);}});}}})[_0x0cf6('0x4b')](function(_0x41dfa7){if(_0x41dfa7[_0x0cf6('0x60')]==='ScreenRecording\x20not\x20found'){_0x6e1763['status'](0x194)[_0x0cf6('0x2a')](_0x0cf6('0x61'));}else{return handleError(_0x6e1763,null);}});};exports[_0x0cf6('0x27')]=function(_0x10127d,_0x2c38e7){return db['ScreenRecording'][_0x0cf6('0x4a')]({'where':{'id':_0x10127d[_0x0cf6('0x47')]['id']}})['then'](function(_0x262fd6){if(!_0x262fd6)throw new ReferenceError(_0x0cf6('0x62'));return _0x262fd6;})[_0x0cf6('0x26')](function(_0x53d503){var _0x5ccaf0=path[_0x0cf6('0x63')](config[_0x0cf6('0x64')],_0x0cf6('0x55'),_0x53d503[_0x0cf6('0x54')]);logger[_0x0cf6('0x65')](_0x0cf6('0x66'),_0x5ccaf0);if(!_[_0x0cf6('0x67')](_0x53d503[_0x0cf6('0x54')])&&fs[_0x0cf6('0x57')](_0x5ccaf0)){logger['info']('File:\x20\x22'+_0x5ccaf0+_0x0cf6('0x68'));fs['unlinkSync'](_0x5ccaf0);}_0x5ccaf0=_0x5ccaf0+'.cypher';if(!_[_0x0cf6('0x67')](_0x53d503['value'])&&fs[_0x0cf6('0x57')](_0x5ccaf0)){logger['info'](_0x0cf6('0x69')+_0x5ccaf0+_0x0cf6('0x68'));fs[_0x0cf6('0x6a')](_0x5ccaf0);}return _0x53d503;})['then'](function(_0x238b2b){if(!_0x238b2b)throw new InternalError();return _0x238b2b[_0x0cf6('0x27')]();})[_0x0cf6('0x26')](function(){_0x2c38e7[_0x0cf6('0x1b')](0xcc)[_0x0cf6('0x1c')]();})[_0x0cf6('0x4b')](handleError(_0x2c38e7,null));}; \ No newline at end of file +var _0x9111=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','destroy','end','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','join','server/files/screen_recordings','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x2b490d,_0x50c391){var _0x459a4c=function(_0x5f240f){while(--_0x5f240f){_0x2b490d['push'](_0x2b490d['shift']());}};_0x459a4c(++_0x50c391);}(_0x9111,0xb9));var _0x1911=function(_0x3688dd,_0x3830b7){_0x3688dd=_0x3688dd-0x0;var _0x13df2c=_0x9111[_0x3688dd];return _0x13df2c;};'use strict';var pdf=require(_0x1911('0x0'));var emlformat=require(_0x1911('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1911('0x2'));var jsonpatch=require(_0x1911('0x3'));var rp=require(_0x1911('0x4'));var moment=require('moment');var BPromise=require(_0x1911('0x5'));var Mustache=require(_0x1911('0x6'));var util=require(_0x1911('0x7'));var path=require(_0x1911('0x8'));var sox=require(_0x1911('0x9'));var csv=require(_0x1911('0xa'));var ejs=require(_0x1911('0xb'));var fs=require('fs');var _=require(_0x1911('0xc'));var squel=require('squel');var crypto=require(_0x1911('0xd'));var jsforce=require(_0x1911('0xe'));var deskjs=require(_0x1911('0xf'));var toCsv=require(_0x1911('0xa'));var querystring=require(_0x1911('0x10'));var Papa=require(_0x1911('0x11'));var Redis=require(_0x1911('0x12'));var authService=require(_0x1911('0x13'));var qs=require(_0x1911('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1911('0x15'));var logger=require(_0x1911('0x16'))(_0x1911('0x17'));var utils=require(_0x1911('0x18'));var config=require(_0x1911('0x19'));var licenseUtil=require(_0x1911('0x1a'));var db=require(_0x1911('0x1b'))['db'];function respondWithStatusCode(_0x3fe786,_0x301c6d){_0x301c6d=_0x301c6d||0xcc;return function(_0x41db8c){if(_0x41db8c){return _0x3fe786[_0x1911('0x1c')](_0x301c6d);}return _0x3fe786[_0x1911('0x1d')](_0x301c6d)['end']();};}function respondWithResult(_0x50daff,_0xcb2425){_0xcb2425=_0xcb2425||0xc8;return function(_0x30b479){if(_0x30b479){return _0x50daff[_0x1911('0x1d')](_0xcb2425)[_0x1911('0x1e')](_0x30b479);}};}function respondWithFilteredResult(_0x37b5a3,_0x187d41){return function(_0x20607a){if(_0x20607a){var _0x2835bc=_0x20607a[_0x1911('0x1f')],_0x2cadae=_0x187d41[_0x1911('0x20')],_0x468adf=_0x187d41[_0x1911('0x20')]+_0x187d41[_0x1911('0x21')],_0x22ecab;if(_0x468adf>=_0x2835bc){_0x468adf=_0x2835bc;_0x22ecab=0xc8;}else{_0x22ecab=0xce;}_0x37b5a3[_0x1911('0x1d')](_0x22ecab);return _0x37b5a3[_0x1911('0x22')]('Content-Range',_0x2cadae+'-'+_0x468adf+'/'+_0x2835bc)[_0x1911('0x1e')](_0x20607a);}return null;};}function patchUpdates(_0x897d5){return function(_0x37f24b){try{jsonpatch['apply'](_0x37f24b,_0x897d5,!![]);}catch(_0x7b988a){return BPromise[_0x1911('0x23')](_0x7b988a);}return _0x37f24b['save']();};}function saveUpdates(_0x5740d6,_0x43bd4e){return function(_0x5d189e){if(_0x5d189e){return _0x5d189e[_0x1911('0x24')](_0x5740d6)[_0x1911('0x25')](function(_0x3f7ce2){return _0x3f7ce2;});}return null;};}function removeEntity(_0x2b82c5,_0x18bf36){return function(_0x319926){if(_0x319926){return _0x319926[_0x1911('0x26')]()[_0x1911('0x25')](function(){_0x2b82c5[_0x1911('0x1d')](0xcc)[_0x1911('0x27')]();});}};}function handleEntityNotFound(_0x1c8d6c,_0xd0e782){return function(_0x4c8940){if(!_0x4c8940){_0x1c8d6c[_0x1911('0x1c')](0x194);}return _0x4c8940;};}function handleError(_0x26f0ff,_0x405002){_0x405002=_0x405002||0x1f4;return function(_0x139175){logger['error'](_0x139175[_0x1911('0x28')]);if(_0x139175[_0x1911('0x29')]){delete _0x139175[_0x1911('0x29')];}_0x26f0ff[_0x1911('0x1d')](_0x405002)[_0x1911('0x2a')](_0x139175);};}exports['index']=function(_0x7778f9,_0x2a8357){var _0x2d776e={},_0x22e502={},_0x5e2f85={'count':0x0,'rows':[]};var _0x1f4363=_[_0x1911('0x2b')](db[_0x1911('0x2c')]['rawAttributes'],function(_0x525a28){return{'name':_0x525a28['fieldName'],'type':_0x525a28[_0x1911('0x2d')][_0x1911('0x2e')]};});_0x22e502[_0x1911('0x2f')]=_[_0x1911('0x30')](_[_0x1911('0x2b')](_0x1f4363,_0x1911('0x29')),[_0x1911('0x31')]);_0x22e502['query']=_[_0x1911('0x32')](_0x7778f9[_0x1911('0x33')]);_0x22e502['filters']=_[_0x1911('0x34')](_0x22e502['model'],_0x22e502[_0x1911('0x33')]);_0x2d776e[_0x1911('0x35')]=_[_0x1911('0x34')](_0x22e502[_0x1911('0x2f')],qs[_0x1911('0x36')](_0x7778f9[_0x1911('0x33')][_0x1911('0x36')]));_0x2d776e[_0x1911('0x35')]=_0x2d776e[_0x1911('0x35')][_0x1911('0x37')]?_0x2d776e[_0x1911('0x35')]:_0x22e502[_0x1911('0x2f')];if(!_0x7778f9[_0x1911('0x33')][_0x1911('0x38')](_0x1911('0x39'))){_0x2d776e['limit']=qs[_0x1911('0x21')](_0x7778f9[_0x1911('0x33')][_0x1911('0x21')]);_0x2d776e['offset']=qs[_0x1911('0x20')](_0x7778f9['query'][_0x1911('0x20')]);}_0x2d776e[_0x1911('0x3a')]=qs[_0x1911('0x3b')](_0x7778f9[_0x1911('0x33')][_0x1911('0x3b')]);_0x2d776e[_0x1911('0x3c')]=qs[_0x1911('0x3d')](_['pick'](_0x7778f9[_0x1911('0x33')],_0x22e502[_0x1911('0x3d')]),_0x1f4363);if(_0x7778f9[_0x1911('0x33')][_0x1911('0x3e')]){_0x2d776e[_0x1911('0x3c')]=_[_0x1911('0x3f')](_0x2d776e[_0x1911('0x3c')],{'$or':_[_0x1911('0x2b')](_0x1f4363,function(_0x18c14a){if(_0x18c14a['type']!==_0x1911('0x40')){var _0xa69034={};_0xa69034[_0x18c14a[_0x1911('0x29')]]={'$like':'%'+_0x7778f9['query'][_0x1911('0x3e')]+'%'};return _0xa69034;}})});}_0x2d776e=_[_0x1911('0x3f')]({},_0x2d776e,_0x7778f9[_0x1911('0x41')]);var _0x1d3454={'where':_0x2d776e[_0x1911('0x3c')]};return db[_0x1911('0x2c')][_0x1911('0x1f')](_0x1d3454)['then'](function(_0x51f91e){_0x5e2f85[_0x1911('0x1f')]=_0x51f91e;if(_0x7778f9[_0x1911('0x33')]['includeAll']){_0x2d776e[_0x1911('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x1911('0x43')](_0x2d776e);})[_0x1911('0x25')](function(_0x509faa){_0x5e2f85['rows']=_0x509faa;return _0x5e2f85;})[_0x1911('0x25')](respondWithFilteredResult(_0x2a8357,_0x2d776e))[_0x1911('0x44')](handleError(_0x2a8357,null));};exports['show']=function(_0x82269f,_0x1e2047){var _0x4b47b5={'raw':![],'where':{'id':_0x82269f[_0x1911('0x45')]['id']}},_0x3afdb5={};_0x3afdb5[_0x1911('0x2f')]=_[_0x1911('0x32')](db['ScreenRecording']['rawAttributes']);_0x3afdb5['query']=_['keys'](_0x82269f[_0x1911('0x33')]);_0x3afdb5[_0x1911('0x3d')]=_[_0x1911('0x34')](_0x3afdb5[_0x1911('0x2f')],_0x3afdb5[_0x1911('0x33')]);_0x4b47b5[_0x1911('0x35')]=_['intersection'](_0x3afdb5['model'],qs[_0x1911('0x36')](_0x82269f[_0x1911('0x33')][_0x1911('0x36')]));_0x4b47b5[_0x1911('0x35')]=_0x4b47b5[_0x1911('0x35')][_0x1911('0x37')]?_0x4b47b5['attributes']:_0x3afdb5[_0x1911('0x2f')];if(_0x82269f[_0x1911('0x33')][_0x1911('0x46')]){_0x4b47b5['include']=[{'all':!![]}];}_0x4b47b5=_[_0x1911('0x3f')]({},_0x4b47b5,_0x82269f[_0x1911('0x41')]);return db['ScreenRecording'][_0x1911('0x47')](_0x4b47b5)['then'](handleEntityNotFound(_0x1e2047,null))['then'](respondWithResult(_0x1e2047,null))[_0x1911('0x44')](handleError(_0x1e2047,null));};exports[_0x1911('0x48')]=function(_0x3896b5,_0x5c4691){return db[_0x1911('0x2c')][_0x1911('0x48')](_0x3896b5[_0x1911('0x49')],{})[_0x1911('0x25')](respondWithResult(_0x5c4691,0xc9))[_0x1911('0x44')](handleError(_0x5c4691,null));};exports[_0x1911('0x24')]=function(_0x3b7d4d,_0x2a353f){if(_0x3b7d4d[_0x1911('0x49')]['id']){delete _0x3b7d4d[_0x1911('0x49')]['id'];}delete _0x3b7d4d[_0x1911('0x49')]['duration'];delete _0x3b7d4d[_0x1911('0x49')]['createdAt'];delete _0x3b7d4d[_0x1911('0x49')][_0x1911('0x4a')];delete _0x3b7d4d[_0x1911('0x49')][_0x1911('0x4b')];return db['ScreenRecording'][_0x1911('0x47')]({'where':{'id':_0x3b7d4d['params']['id']}})[_0x1911('0x25')](handleEntityNotFound(_0x2a353f,null))[_0x1911('0x25')](saveUpdates(_0x3b7d4d[_0x1911('0x49')],null))[_0x1911('0x25')](respondWithResult(_0x2a353f,null))[_0x1911('0x44')](handleError(_0x2a353f,null));};exports[_0x1911('0x4c')]=function(_0x56a333,_0x408be2){return db[_0x1911('0x2c')][_0x1911('0x4c')]()[_0x1911('0x25')](respondWithResult(_0x408be2,null))[_0x1911('0x44')](handleError(_0x408be2,null));};exports[_0x1911('0x4d')]=function(_0x4b85d8,_0x1f93ee,_0xe83ab0){var _0x3479fb=require(_0x1911('0x4e'));var _0x517608=![];var _0x4e437b={};if(_0x4b85d8['query']['type']&&_0x4b85d8[_0x1911('0x33')][_0x1911('0x2d')]===_0x1911('0x4f')){_0x4e437b[_0x1911('0x4f')]=_0x4b85d8[_0x1911('0x45')]['id'];}else{_0x4e437b['id']=_0x4b85d8[_0x1911('0x45')]['id'];}return db[_0x1911('0x2c')][_0x1911('0x47')]({'where':_0x4e437b,'attributes':['id',_0x1911('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x1f93ee,null))[_0x1911('0x25')](function(_0x433c18){if(_0x433c18){var _0x1f6e13=path['join'](config[_0x1911('0x50')],'server/files/screen_recordings',_0x433c18[_0x1911('0x4b')]);var _0x59a416=util[_0x1911('0x31')]('%s.cypher',_0x1f6e13);if(fs[_0x1911('0x51')](_0x59a416)){_0x517608=!![];return _0x3479fb[_0x1911('0x52')](_0x59a416,_0x1f6e13,config[_0x1911('0x53')][_0x1911('0x54')])[_0x1911('0x25')](function(){return _0x433c18;});}return _0x433c18;}})[_0x1911('0x25')](function(_0x42bac1){if(_0x42bac1){var _0x1a1059=path['join'](config[_0x1911('0x50')],'server/files/screen_recordings',_0x42bac1['value']);if(!fs[_0x1911('0x51')](_0x1a1059)){throw new db[(_0x1911('0x55'))][(_0x1911('0x56'))](_0x1911('0x57'));}if(_0x42bac1['filename']){return _0x1f93ee[_0x1911('0x4d')](_0x1a1059,_0x42bac1['filename']+path['extname'](_0x1a1059),function(){if(_0x517608){fs[_0x1911('0x58')](_0x1a1059);}});}else{return _0x1f93ee[_0x1911('0x4d')](_0x1a1059,function(_0x2fcad9){if(_0x517608){fs[_0x1911('0x58')](_0x1a1059);}});}}})[_0x1911('0x44')](function(_0x35545a){if(_0x35545a[_0x1911('0x59')]===_0x1911('0x57')){_0x1f93ee[_0x1911('0x1d')](0x194)[_0x1911('0x2a')](_0x1911('0x5a'));}else{return handleError(_0x1f93ee,null);}});};exports[_0x1911('0x26')]=function(_0x58b48b,_0x43f952){return db[_0x1911('0x2c')]['find']({'where':{'id':_0x58b48b[_0x1911('0x45')]['id']}})['then'](function(_0x50b879){if(!_0x50b879)throw new ReferenceError(_0x1911('0x5b'));return _0x50b879;})[_0x1911('0x25')](function(_0x2d405c){var _0x2e50a5=path[_0x1911('0x5c')](config[_0x1911('0x50')],_0x1911('0x5d'),_0x2d405c[_0x1911('0x4b')]);logger[_0x1911('0x5e')](_0x1911('0x5f'),_0x2e50a5);if(!_['isNil'](_0x2d405c[_0x1911('0x4b')])&&fs[_0x1911('0x51')](_0x2e50a5)){logger[_0x1911('0x5e')](_0x1911('0x60')+_0x2e50a5+_0x1911('0x61'));fs[_0x1911('0x62')](_0x2e50a5);}_0x2e50a5=_0x2e50a5+_0x1911('0x63');if(!_['isNil'](_0x2d405c[_0x1911('0x4b')])&&fs[_0x1911('0x51')](_0x2e50a5)){logger[_0x1911('0x5e')]('File:\x20\x22'+_0x2e50a5+_0x1911('0x61'));fs[_0x1911('0x62')](_0x2e50a5);}return _0x2d405c;})[_0x1911('0x25')](function(_0x2ad9af){if(!_0x2ad9af)throw new InternalError();return _0x2ad9af[_0x1911('0x26')]();})[_0x1911('0x25')](function(){_0x43f952[_0x1911('0x1d')](0xcc)[_0x1911('0x27')]();})[_0x1911('0x44')](handleError(_0x43f952,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ccdbbfa..04d5352 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 _0x92f0=['interactionid','../../config/logger','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings'];(function(_0x5ae136,_0x5c7498){var _0x3a59b3=function(_0x5ee88f){while(--_0x5ee88f){_0x5ae136['push'](_0x5ae136['shift']());}};_0x3a59b3(++_0x5c7498);}(_0x92f0,0xf3));var _0x092f=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x92f0[_0x2134b7];return _0x6c5914;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x092f('0x0'))('api');var moment=require(_0x092f('0x1'));var BPromise=require(_0x092f('0x2'));var rp=require(_0x092f('0x3'));var fs=require('fs');var path=require(_0x092f('0x4'));var rimraf=require(_0x092f('0x5'));var config=require('../../config/environment');var attributes=require(_0x092f('0x6'));module['exports']=function(_0xe3aadb,_0x6b720d){return _0xe3aadb[_0x092f('0x7')](_0x092f('0x8'),attributes,{'tableName':_0x092f('0x9'),'paranoid':![],'indexes':[{'name':_0x092f('0xa'),'fields':[_0x092f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcde4=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43e180,_0x3b75c9){var _0x527e07=function(_0x11eb8d){while(--_0x11eb8d){_0x43e180['push'](_0x43e180['shift']());}};_0x527e07(++_0x3b75c9);}(_0xcde4,0x125));var _0x4cde=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xcde4[_0x118139];return _0x2fece9;};'use strict';var _=require(_0x4cde('0x0'));var util=require(_0x4cde('0x1'));var logger=require(_0x4cde('0x2'))(_0x4cde('0x3'));var moment=require(_0x4cde('0x4'));var BPromise=require(_0x4cde('0x5'));var rp=require(_0x4cde('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cde('0x7'));var config=require(_0x4cde('0x8'));var attributes=require(_0x4cde('0x9'));module[_0x4cde('0xa')]=function(_0x2a66d1,_0x15e07c){return _0x2a66d1[_0x4cde('0xb')](_0x4cde('0xc'),attributes,{'tableName':_0x4cde('0xd'),'paranoid':![],'indexes':[{'name':_0x4cde('0xe'),'fields':[_0x4cde('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c0bf41a..c6b3b33 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(_0x44b7d1,_0x1d8689){var _0x4fea3d=function(_0x1ba82e){while(--_0x1ba82e){_0x44b7d1['push'](_0x44b7d1['shift']());}};_0x4fea3d(++_0x1d8689);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x2131eb,_0x3a47f0){var _0x33b65e=function(_0x3f3300){while(--_0x3f3300){_0x2131eb['push'](_0x2131eb['shift']());}};_0x33b65e(++_0x3a47f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 9481dca..2103780 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 _0x0f0c=['getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','root','logologin','preferred','addPreferred','favicon','/:id/favicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0f0c,0x111));var _0xc0f0=function(_0x25d68d,_0x69adf9){_0x25d68d=_0x25d68d-0x0;var _0x3f5c89=_0x0f0c[_0x25d68d];return _0x3f5c89;};'use strict';var multer=require(_0xc0f0('0x0'));var util=require(_0xc0f0('0x1'));var path=require(_0xc0f0('0x2'));var timeout=require(_0xc0f0('0x3'));var express=require(_0xc0f0('0x4'));var router=express[_0xc0f0('0x5')]();var auth=require(_0xc0f0('0x6'));var interaction=require(_0xc0f0('0x7'));var config=require(_0xc0f0('0x8'));var controller=require(_0xc0f0('0x9'));router[_0xc0f0('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc0f0('0xa')]('/now',controller[_0xc0f0('0xb')]);router[_0xc0f0('0xa')](_0xc0f0('0xc'),controller['show']);router[_0xc0f0('0xa')](_0xc0f0('0xd'),controller[_0xc0f0('0xe')]);router[_0xc0f0('0xa')](_0xc0f0('0xf'),controller[_0xc0f0('0x10')]);router[_0xc0f0('0xa')](_0xc0f0('0x11'),controller[_0xc0f0('0x12')]);router['get'](_0xc0f0('0x13'),controller[_0xc0f0('0x14')]);router[_0xc0f0('0xa')]('/:id/favicon',controller[_0xc0f0('0x15')]);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x35ccbb,_0x316fa2,_0x4d582d){_0x4d582d(null,path[_0xc0f0('0x17')](config['root'],_0xc0f0('0x18')));},'filename':function(_0xd966d0,_0x162b64,_0x45a130){_0x45a130(null,util[_0xc0f0('0x19')](_0xc0f0('0x1a'),_0xc0f0('0x1b'),path[_0xc0f0('0x1c')](_0x162b64[_0xc0f0('0x1d')])));}})});router[_0xc0f0('0x1e')](_0xc0f0('0xd'),upload[_0xc0f0('0x1f')](_0xc0f0('0x20')),controller[_0xc0f0('0x21')]);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x159c4a,_0x1aae76,_0x33be42){_0x33be42(null,path[_0xc0f0('0x17')](config[_0xc0f0('0x22')],_0xc0f0('0x18')));},'filename':function(_0x55e39b,_0x195f3d,_0x559fc9){_0x559fc9(null,util[_0xc0f0('0x19')](_0xc0f0('0x1a'),_0xc0f0('0x23'),path[_0xc0f0('0x1c')](_0x195f3d[_0xc0f0('0x1d')])));}})});router['post'](_0xc0f0('0xf'),upload['single'](_0xc0f0('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x7a6d37,_0x4386f3,_0x15c242){_0x15c242(null,path[_0xc0f0('0x17')](config[_0xc0f0('0x22')],_0xc0f0('0x18')));},'filename':function(_0x416d73,_0x936c95,_0x293399){_0x293399(null,util[_0xc0f0('0x19')]('%s%s',_0xc0f0('0x24'),path[_0xc0f0('0x1c')](_0x936c95[_0xc0f0('0x1d')])));}})});router['post'](_0xc0f0('0x13'),upload[_0xc0f0('0x1f')](_0xc0f0('0x20')),controller[_0xc0f0('0x25')]);var upload=multer({'storage':multer[_0xc0f0('0x16')]({'destination':function(_0x1742ca,_0x42e339,_0x55698c){_0x55698c(null,path[_0xc0f0('0x17')](config[_0xc0f0('0x22')],_0xc0f0('0x18')));},'filename':function(_0x241c36,_0x1ed95e,_0x4d775e){_0x4d775e(null,util[_0xc0f0('0x19')](_0xc0f0('0x1a'),_0xc0f0('0x26'),path['extname'](_0x1ed95e[_0xc0f0('0x1d')])));}})});router[_0xc0f0('0x1e')](_0xc0f0('0x27'),upload[_0xc0f0('0x1f')]('file'),controller['addFavicon']);router[_0xc0f0('0x28')](_0xc0f0('0xc'),auth['isAuthenticated'](),controller[_0xc0f0('0x29')]);module['exports']=router; \ No newline at end of file +var _0x8a26=['show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','originalname','post','single','file','addLogo','root','logologin','extname','addLogoLogin','join','preferred','/:id/preferred','addPreferred','favicon','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','getDate','/:id'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8a26,0x153));var _0x68a2=function(_0xd29673,_0x424156){_0xd29673=_0xd29673-0x0;var _0x3fe33e=_0x8a26[_0xd29673];return _0x3fe33e;};'use strict';var multer=require(_0x68a2('0x0'));var util=require('util');var path=require(_0x68a2('0x1'));var timeout=require(_0x68a2('0x2'));var express=require(_0x68a2('0x3'));var router=express[_0x68a2('0x4')]();var auth=require(_0x68a2('0x5'));var interaction=require(_0x68a2('0x6'));var config=require('../../config/environment');var controller=require(_0x68a2('0x7'));router['get']('/',auth[_0x68a2('0x8')](),controller[_0x68a2('0x9')]);router[_0x68a2('0xa')]('/now',controller[_0x68a2('0xb')]);router['get'](_0x68a2('0xc'),controller[_0x68a2('0xd')]);router[_0x68a2('0xa')](_0x68a2('0xe'),controller[_0x68a2('0xf')]);router[_0x68a2('0xa')](_0x68a2('0x10'),controller['getLogoLogin']);router[_0x68a2('0xa')](_0x68a2('0x11'),controller[_0x68a2('0x12')]);router[_0x68a2('0xa')]('/:id/preferred',controller[_0x68a2('0x13')]);router[_0x68a2('0xa')](_0x68a2('0x14'),controller[_0x68a2('0x15')]);var upload=multer({'storage':multer[_0x68a2('0x16')]({'destination':function(_0x3413bb,_0x3e0c4f,_0x921e44){_0x921e44(null,path['join'](config['root'],_0x68a2('0x17')));},'filename':function(_0x5c81c0,_0x35a71b,_0x314b8e){_0x314b8e(null,util[_0x68a2('0x18')](_0x68a2('0x19'),_0x68a2('0x1a'),path['extname'](_0x35a71b[_0x68a2('0x1b')])));}})});router[_0x68a2('0x1c')](_0x68a2('0xe'),upload[_0x68a2('0x1d')](_0x68a2('0x1e')),controller[_0x68a2('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13a1a7,_0x5944bc,_0x1ae48f){_0x1ae48f(null,path['join'](config[_0x68a2('0x20')],_0x68a2('0x17')));},'filename':function(_0x328e6f,_0x45a1e2,_0x238060){_0x238060(null,util['format'](_0x68a2('0x19'),_0x68a2('0x21'),path[_0x68a2('0x22')](_0x45a1e2['originalname'])));}})});router[_0x68a2('0x1c')](_0x68a2('0x10'),upload['single'](_0x68a2('0x1e')),controller[_0x68a2('0x23')]);var upload=multer({'storage':multer[_0x68a2('0x16')]({'destination':function(_0x1b327d,_0xf140d6,_0x28e1bc){_0x28e1bc(null,path[_0x68a2('0x24')](config[_0x68a2('0x20')],_0x68a2('0x17')));},'filename':function(_0x46b6ac,_0x1e49f2,_0x509fdb){_0x509fdb(null,util[_0x68a2('0x18')](_0x68a2('0x19'),_0x68a2('0x25'),path[_0x68a2('0x22')](_0x1e49f2[_0x68a2('0x1b')])));}})});router[_0x68a2('0x1c')](_0x68a2('0x26'),upload['single'](_0x68a2('0x1e')),controller[_0x68a2('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1fc4af,_0xb92f42,_0x35014e){_0x35014e(null,path[_0x68a2('0x24')](config[_0x68a2('0x20')],_0x68a2('0x17')));},'filename':function(_0xccb721,_0x291cb4,_0xeed134){_0xeed134(null,util['format'](_0x68a2('0x19'),_0x68a2('0x28'),path[_0x68a2('0x22')](_0x291cb4[_0x68a2('0x1b')])));}})});router[_0x68a2('0x1c')](_0x68a2('0x14'),upload[_0x68a2('0x1d')]('file'),controller['addFavicon']);router[_0x68a2('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x68a2('0x2a')]);module[_0x68a2('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index addd4c9..244d345 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 _0xa179=['BOOLEAN','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xa179,0x17b));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9a17('0x0')]={'min_internal':{'type':Sequelize[_0x9a17('0x1')](0xb),'unique':_0x9a17('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9a17('0x1')](0xb),'unique':_0x9a17('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9a17('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9a17('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x9a17('0x4')]},'defaultLogo':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9a17('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9a17('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9a17('0x4')]},'turnaddr':{'type':Sequelize[_0x9a17('0x4')]},'turnusername':{'type':Sequelize[_0x9a17('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x9a17('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9a17('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9a17('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9a17('0x6')},'chatTimeout':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9a17('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9a17('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9a17('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9a17('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9a17('0x4')]},'bucket':{'type':Sequelize[_0x9a17('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9a17('0x1')](0x2)[_0x9a17('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x9a17('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa61a=['UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x55dc8e,_0xeb9f17){var _0x2d739b=function(_0x47cf16){while(--_0x47cf16){_0x55dc8e['push'](_0x55dc8e['shift']());}};_0x2d739b(++_0xeb9f17);}(_0xa61a,0x169));var _0xaa61=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xa61a[_0x280f4a];return _0x1bb157;};'use strict';var Sequelize=require(_0xaa61('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xaa61('0x1')](0xb),'unique':_0xaa61('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xaa61('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xaa61('0x3')],'defaultValue':_0xaa61('0x4')},'logo':{'type':Sequelize[_0xaa61('0x3')]},'defaultLogo':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xaa61('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xaa61('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xaa61('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xaa61('0x3')]},'turnpassword':{'type':Sequelize[_0xaa61('0x3')]},'pageTitle':{'type':Sequelize[_0xaa61('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xaa61('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xaa61('0x3')],'defaultValue':_0xaa61('0x6')},'enableEmailPreview':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xaa61('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xaa61('0x3')]},'defaultPreferred':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xaa61('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xaa61('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xaa61('0x1')]},'transcribeRegion':{'type':Sequelize[_0xaa61('0x3')]},'sentiment':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xaa61('0x3')]},'language':{'type':Sequelize[_0xaa61('0x3')]},'bucket':{'type':Sequelize[_0xaa61('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xaa61('0x1')](0x2)[_0xaa61('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b26e060..9cb4089 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 _0xfc04=['findAll','rows','catch','show','params','length','options','find','body','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','defaultFavicon','default_loginLogo.svg','Sequelize','gdpr','securePassword','server/files/images/logos','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','end','json','count','offset','limit','status','Content-Range','reject','save','destroy','sendStatus','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x4e9d7f,_0x383253){var _0x51f0bc=function(_0x367d9c){while(--_0x367d9c){_0x4e9d7f['push'](_0x4e9d7f['shift']());}};_0x51f0bc(++_0x383253);}(_0xfc04,0x11d));var _0x4fc0=function(_0x427b9b,_0x4d2c97){_0x427b9b=_0x427b9b-0x0;var _0x2fdd95=_0xfc04[_0x427b9b];return _0x2fdd95;};'use strict';var pdf=require(_0x4fc0('0x0'));var emlformat=require(_0x4fc0('0x1'));var rimraf=require(_0x4fc0('0x2'));var zipdir=require(_0x4fc0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fc0('0x4'));var moment=require('moment');var BPromise=require(_0x4fc0('0x5'));var Mustache=require('mustache');var util=require(_0x4fc0('0x6'));var path=require('path');var sox=require(_0x4fc0('0x7'));var csv=require('to-csv');var ejs=require(_0x4fc0('0x8'));var fs=require('fs');var _=require(_0x4fc0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4fc0('0xa'));var deskjs=require(_0x4fc0('0xb'));var toCsv=require(_0x4fc0('0xc'));var querystring=require(_0x4fc0('0xd'));var Papa=require(_0x4fc0('0xe'));var Redis=require('ioredis');var authService=require(_0x4fc0('0xf'));var qs=require(_0x4fc0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fc0('0x11'));var logger=require(_0x4fc0('0x12'))(_0x4fc0('0x13'));var utils=require(_0x4fc0('0x14'));var config=require(_0x4fc0('0x15'));var licenseUtil=require(_0x4fc0('0x16'));var db=require(_0x4fc0('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4fc0('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x504b35,_0x3e502a,_0x450cc6,_0x2e9f7b){return new BPromise(function(_0x26398e,_0x33b531){var _0x4f098a=_0x2e9f7b||client;return _0x4f098a[_0x4fc0('0x19')](_0x504b35,_0x450cc6)[_0x4fc0('0x1a')](function(_0x396d40){logger['info'](_0x4fc0('0x1b'),_0x3e502a,'request\x20sent');logger[_0x4fc0('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0x3e502a,_0x4fc0('0x1d'),JSON[_0x4fc0('0x1e')](_0x396d40));if(_0x396d40['error']){if(_0x396d40['error'][_0x4fc0('0x1f')]===0x1f4){logger[_0x4fc0('0x20')](_0x4fc0('0x1b'),_0x3e502a,_0x396d40[_0x4fc0('0x20')][_0x4fc0('0x21')]);return _0x33b531(_0x396d40[_0x4fc0('0x20')][_0x4fc0('0x21')]);}logger[_0x4fc0('0x20')](_0x4fc0('0x1b'),_0x3e502a,_0x396d40['error']['message']);return _0x26398e(_0x396d40[_0x4fc0('0x20')][_0x4fc0('0x21')]);}else{logger[_0x4fc0('0x22')](_0x4fc0('0x1b'),_0x3e502a,_0x4fc0('0x1d'));_0x26398e(_0x396d40[_0x4fc0('0x23')]['message']);}})['catch'](function(_0x2387e1){logger['error']('Setting,\x20%s,\x20%s',_0x3e502a,_0x2387e1);_0x33b531(_0x2387e1);});});}function respondWithStatusCode(_0xb7a6b2,_0x223fe9){_0x223fe9=_0x223fe9||0xcc;return function(_0x33f5a8){if(_0x33f5a8){return _0xb7a6b2['sendStatus'](_0x223fe9);}return _0xb7a6b2['status'](_0x223fe9)[_0x4fc0('0x24')]();};}function respondWithResult(_0x5c6ed,_0x476520){_0x476520=_0x476520||0xc8;return function(_0x4754e7){if(_0x4754e7){return _0x5c6ed['status'](_0x476520)[_0x4fc0('0x25')](_0x4754e7);}};}function respondWithFilteredResult(_0x2c2cb5,_0x1a006a){return function(_0x1b307f){if(_0x1b307f){var _0x41d8c1=_0x1b307f[_0x4fc0('0x26')],_0x3a2a95=_0x1a006a[_0x4fc0('0x27')],_0x5de8d4=_0x1a006a[_0x4fc0('0x27')]+_0x1a006a[_0x4fc0('0x28')],_0x2fffcf;if(_0x5de8d4>=_0x41d8c1){_0x5de8d4=_0x41d8c1;_0x2fffcf=0xc8;}else{_0x2fffcf=0xce;}_0x2c2cb5[_0x4fc0('0x29')](_0x2fffcf);return _0x2c2cb5['set'](_0x4fc0('0x2a'),_0x3a2a95+'-'+_0x5de8d4+'/'+_0x41d8c1)['json'](_0x1b307f);}return null;};}function patchUpdates(_0x1d85b2){return function(_0x4b0338){try{jsonpatch['apply'](_0x4b0338,_0x1d85b2,!![]);}catch(_0x3d79d4){return BPromise[_0x4fc0('0x2b')](_0x3d79d4);}return _0x4b0338[_0x4fc0('0x2c')]();};}function saveUpdates(_0x256729,_0x12770e){return function(_0x952a04){if(_0x952a04){return _0x952a04['update'](_0x256729)['then'](function(_0x33ff99){return _0x33ff99;});}return null;};}function removeEntity(_0x44b23e,_0x3bde89){return function(_0x16653d){if(_0x16653d){return _0x16653d[_0x4fc0('0x2d')]()[_0x4fc0('0x1a')](function(){_0x44b23e[_0x4fc0('0x29')](0xcc)[_0x4fc0('0x24')]();});}};}function handleEntityNotFound(_0x5586a4,_0x2b4843){return function(_0x220600){if(!_0x220600){_0x5586a4[_0x4fc0('0x2e')](0x194);}return _0x220600;};}function handleError(_0x4f8463,_0x2336d9){_0x2336d9=_0x2336d9||0x1f4;return function(_0x327582){logger[_0x4fc0('0x20')](_0x327582[_0x4fc0('0x2f')]);if(_0x327582[_0x4fc0('0x30')]){delete _0x327582[_0x4fc0('0x30')];}_0x4f8463[_0x4fc0('0x29')](_0x2336d9)[_0x4fc0('0x31')](_0x327582);};}exports['index']=function(_0x2b66d7,_0x18d59d){var _0x328e6={},_0x2cf1a8={},_0x2be68c={'count':0x0,'rows':[]};var _0x54d4d9=_[_0x4fc0('0x32')](db[_0x4fc0('0x33')][_0x4fc0('0x34')],function(_0x2b6896){return{'name':_0x2b6896[_0x4fc0('0x35')],'type':_0x2b6896[_0x4fc0('0x36')][_0x4fc0('0x37')]};});_0x2cf1a8['model']=_[_0x4fc0('0x32')](_0x54d4d9,'name');_0x2cf1a8['query']=_[_0x4fc0('0x38')](_0x2b66d7[_0x4fc0('0x39')]);_0x2cf1a8[_0x4fc0('0x3a')]=_[_0x4fc0('0x3b')](_0x2cf1a8['model'],_0x2cf1a8[_0x4fc0('0x39')]);_0x328e6[_0x4fc0('0x3c')]=_[_0x4fc0('0x3b')](_0x2cf1a8[_0x4fc0('0x3d')],qs[_0x4fc0('0x3e')](_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x3e')]));_0x328e6['attributes']=_0x328e6['attributes']['length']?_0x328e6[_0x4fc0('0x3c')]:_0x2cf1a8[_0x4fc0('0x3d')];if(!_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x3f')](_0x4fc0('0x40'))){_0x328e6['limit']=qs['limit'](_0x2b66d7['query'][_0x4fc0('0x28')]);_0x328e6[_0x4fc0('0x27')]=qs[_0x4fc0('0x27')](_0x2b66d7['query'][_0x4fc0('0x27')]);}_0x328e6[_0x4fc0('0x41')]=qs['sort'](_0x2b66d7[_0x4fc0('0x39')]['sort']);_0x328e6['where']=qs['filters'](_['pick'](_0x2b66d7[_0x4fc0('0x39')],_0x2cf1a8[_0x4fc0('0x3a')]),_0x54d4d9);if(_0x2b66d7['query'][_0x4fc0('0x42')]){_0x328e6[_0x4fc0('0x43')]=_[_0x4fc0('0x44')](_0x328e6[_0x4fc0('0x43')],{'$or':_['map'](_0x54d4d9,function(_0x1e1d3c){if(_0x1e1d3c['type']!==_0x4fc0('0x45')){var _0x1f6ff0={};_0x1f6ff0[_0x1e1d3c['name']]={'$like':'%'+_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x42')]+'%'};return _0x1f6ff0;}})});}_0x328e6=_[_0x4fc0('0x44')]({},_0x328e6,_0x2b66d7['options']);var _0x1fc9b1={'where':_0x328e6[_0x4fc0('0x43')]};return db[_0x4fc0('0x33')][_0x4fc0('0x26')](_0x1fc9b1)['then'](function(_0x1d6a56){_0x2be68c['count']=_0x1d6a56;if(_0x2b66d7[_0x4fc0('0x39')][_0x4fc0('0x46')]){_0x328e6[_0x4fc0('0x47')]=[{'all':!![]}];}return db[_0x4fc0('0x33')][_0x4fc0('0x48')](_0x328e6);})[_0x4fc0('0x1a')](function(_0x50ada1){_0x2be68c[_0x4fc0('0x49')]=_0x50ada1;return _0x2be68c;})['then'](respondWithFilteredResult(_0x18d59d,_0x328e6))[_0x4fc0('0x4a')](handleError(_0x18d59d,null));};exports[_0x4fc0('0x4b')]=function(_0x191554,_0x1ab5b2){var _0x54d5d8={'raw':![],'where':{'id':_0x191554[_0x4fc0('0x4c')]['id']}},_0x3ae198={};_0x3ae198[_0x4fc0('0x3d')]=_[_0x4fc0('0x38')](db['Setting'][_0x4fc0('0x34')]);_0x3ae198[_0x4fc0('0x39')]=_[_0x4fc0('0x38')](_0x191554['query']);_0x3ae198[_0x4fc0('0x3a')]=_[_0x4fc0('0x3b')](_0x3ae198['model'],_0x3ae198[_0x4fc0('0x39')]);_0x54d5d8[_0x4fc0('0x3c')]=_[_0x4fc0('0x3b')](_0x3ae198['model'],qs['fields'](_0x191554[_0x4fc0('0x39')][_0x4fc0('0x3e')]));_0x54d5d8[_0x4fc0('0x3c')]=_0x54d5d8[_0x4fc0('0x3c')][_0x4fc0('0x4d')]?_0x54d5d8[_0x4fc0('0x3c')]:_0x3ae198['model'];if(_0x191554[_0x4fc0('0x39')][_0x4fc0('0x46')]){_0x54d5d8[_0x4fc0('0x47')]=[{'all':!![]}];}_0x54d5d8=_[_0x4fc0('0x44')]({},_0x54d5d8,_0x191554[_0x4fc0('0x4e')]);return db[_0x4fc0('0x33')][_0x4fc0('0x4f')](_0x54d5d8)[_0x4fc0('0x1a')](handleEntityNotFound(_0x1ab5b2,null))[_0x4fc0('0x1a')](respondWithResult(_0x1ab5b2,null))['catch'](handleError(_0x1ab5b2,null));};exports['update']=function(_0x27a65f,_0x3a3e04){if(_0x27a65f['body']['id']){delete _0x27a65f[_0x4fc0('0x50')]['id'];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x27a65f['params']['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x3a3e04,null))[_0x4fc0('0x1a')](saveUpdates(_0x27a65f['body'],null))[_0x4fc0('0x1a')](respondWithResult(_0x3a3e04,null))[_0x4fc0('0x4a')](handleError(_0x3a3e04,null));};exports['addLogo']=function(_0x390165,_0x1a4c8c,_0x592b7d){if(_0x390165[_0x4fc0('0x51')]&&_0x390165['file'][_0x4fc0('0x52')]){_0x390165[_0x4fc0('0x50')]['logo']=_0x390165[_0x4fc0('0x51')]['filename'];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x390165['params']['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x1a4c8c,null))['then'](saveUpdates(_0x390165[_0x4fc0('0x50')],null))[_0x4fc0('0x1a')](respondWithResult(_0x1a4c8c,null))[_0x4fc0('0x4a')](handleError(_0x1a4c8c,null));};exports[_0x4fc0('0x53')]=function(_0x3df62d,_0x49e036,_0x2b6392){if(_0x3df62d['file']&&_0x3df62d[_0x4fc0('0x51')]['filename']){_0x3df62d[_0x4fc0('0x50')][_0x4fc0('0x54')]=_0x3df62d[_0x4fc0('0x51')][_0x4fc0('0x52')];}return db['Setting']['find']({'where':{'id':_0x3df62d[_0x4fc0('0x4c')]['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x49e036,null))['then'](saveUpdates(_0x3df62d['body'],null))['then'](respondWithResult(_0x49e036,null))[_0x4fc0('0x4a')](handleError(_0x49e036,null));};var utilLicense=require(_0x4fc0('0x16'));exports[_0x4fc0('0x55')]=function(_0x320b27,_0x1b279e,_0x3e5722){var _0x43383a='server/files/images/logos';var _0x4d390f={'custom':![]};return utilLicense[_0x4fc0('0x56')]()[_0x4fc0('0x1a')](function(_0x527f3b){if(_0x527f3b){_0x4d390f=_0x527f3b;}return db['Setting'][_0x4fc0('0x4f')]({'where':{'id':_0x320b27['params']['id']},'attributes':[_0x4fc0('0x57'),'loginLogo',_0x4fc0('0x58'),_0x4fc0('0x59'),_0x4fc0('0x5a'),_0x4fc0('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x1b279e,null))[_0x4fc0('0x1a')](function(_0x3d9608){if(_0x3d9608){var _0x1e5c7c=_0x3d9608[_0x4fc0('0x57')]&&fs[_0x4fc0('0x5c')](path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x43383a,_[_0x4fc0('0x5f')](_0x3d9608[_0x4fc0('0x57')])))?path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x43383a,_[_0x4fc0('0x5f')](_0x3d9608[_0x4fc0('0x57')])):path[_0x4fc0('0x5d')](config['root'],_0x43383a,_['toLower'](_0x4fc0('0x60')));var _0x20f0c9=_0x4fc0('0x61')+_[_0x4fc0('0x62')](_0x4fc0('0x57'));if(_0x3d9608[_0x20f0c9]||!_0x4d390f[_0x4fc0('0x63')]){_0x1e5c7c=path[_0x4fc0('0x5d')](config['root'],_0x43383a,_['toLower'](_0x4fc0('0x60')));}if(!fs[_0x4fc0('0x5c')](_0x1e5c7c)){throw new db['Sequelize'][(_0x4fc0('0x64'))](_[_0x4fc0('0x62')](_0x4fc0('0x57'))+_0x4fc0('0x65'));}return _0x1b279e[_0x4fc0('0x66')](_0x1e5c7c);}})['catch'](handleError(_0x1b279e,null));};var utilLicense=require('../../config/license/util');exports[_0x4fc0('0x67')]=function(_0x4ca63c,_0x9a9b0b,_0x599b5b){var _0x57c245='server/files/images/logos';var _0x50153c={'custom':![]};return utilLicense[_0x4fc0('0x56')]()[_0x4fc0('0x1a')](function(_0x83e15f){if(_0x83e15f){_0x50153c=_0x83e15f;}return db[_0x4fc0('0x33')]['find']({'where':{'id':_0x4ca63c[_0x4fc0('0x4c')]['id']},'attributes':['logo',_0x4fc0('0x54'),_0x4fc0('0x58'),_0x4fc0('0x59'),_0x4fc0('0x5a'),_0x4fc0('0x5b'),_0x4fc0('0x68'),_0x4fc0('0x69')],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x9a9b0b,null))[_0x4fc0('0x1a')](function(_0x29ad2a){if(_0x29ad2a){var _0x44228e=_0x29ad2a[_0x4fc0('0x54')]&&fs[_0x4fc0('0x5c')](path['join'](config['root'],_0x57c245,_[_0x4fc0('0x5f')](_0x29ad2a[_0x4fc0('0x54')])))?path['join'](config['root'],_0x57c245,_[_0x4fc0('0x5f')](_0x29ad2a[_0x4fc0('0x54')])):path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x57c245,_[_0x4fc0('0x5f')](_0x4fc0('0x6a')));var _0x3d83c2=_0x4fc0('0x61')+_[_0x4fc0('0x62')](_0x4fc0('0x54'));if(_0x29ad2a[_0x3d83c2]||!_0x50153c[_0x4fc0('0x63')]){_0x44228e=path['join'](config[_0x4fc0('0x5e')],_0x57c245,_[_0x4fc0('0x5f')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x44228e)){throw new db[(_0x4fc0('0x6b'))]['ValidationError'](_[_0x4fc0('0x62')]('loginLogo')+_0x4fc0('0x65'));}return _0x9a9b0b[_0x4fc0('0x66')](_0x44228e);}})['catch'](handleError(_0x9a9b0b,null));};exports[_0x4fc0('0x6c')]=function(_0x5db3ce,_0x14467f){return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x5db3ce[_0x4fc0('0x4c')]['id']},'attributes':[_0x4fc0('0x6d')]})[_0x4fc0('0x1a')](respondWithResult(_0x14467f,null))['catch'](handleError(_0x14467f,null));};exports['addPreferred']=function(_0x1d4abc,_0x5b3f10,_0x436186){if(_0x1d4abc[_0x4fc0('0x51')]&&_0x1d4abc[_0x4fc0('0x51')][_0x4fc0('0x52')]){_0x1d4abc[_0x4fc0('0x50')][_0x4fc0('0x58')]=_0x1d4abc[_0x4fc0('0x51')][_0x4fc0('0x52')];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x1d4abc[_0x4fc0('0x4c')]['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x5b3f10,null))['then'](saveUpdates(_0x1d4abc['body'],null))['then'](respondWithResult(_0x5b3f10,null))['catch'](handleError(_0x5b3f10,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x192322,_0x58caef,_0x1324a3){var _0x368ca7=_0x4fc0('0x6e');var _0x421a65={'custom':![]};return utilLicense['getLicense']()[_0x4fc0('0x1a')](function(_0x2995d6){if(_0x2995d6){_0x421a65=_0x2995d6;}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x192322[_0x4fc0('0x4c')]['id']},'attributes':[_0x4fc0('0x57'),_0x4fc0('0x54'),'preferred','favicon',_0x4fc0('0x5a'),_0x4fc0('0x5b'),'defaultPreferred',_0x4fc0('0x69')],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x58caef,null))[_0x4fc0('0x1a')](function(_0x875840){if(_0x875840){var _0x5971a9=_0x875840[_0x4fc0('0x58')]&&fs[_0x4fc0('0x5c')](path[_0x4fc0('0x5d')](config['root'],_0x368ca7,_[_0x4fc0('0x5f')](_0x875840[_0x4fc0('0x58')])))?path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x368ca7,_[_0x4fc0('0x5f')](_0x875840[_0x4fc0('0x58')])):path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x368ca7,_[_0x4fc0('0x5f')](_0x4fc0('0x6f')));var _0x1dbd83=_0x4fc0('0x61')+_[_0x4fc0('0x62')](_0x4fc0('0x58'));if(_0x875840[_0x1dbd83]||!_0x421a65[_0x4fc0('0x63')]||!_0x421a65[_0x4fc0('0x58')]){_0x5971a9=path[_0x4fc0('0x5d')](config['root'],_0x368ca7,_[_0x4fc0('0x5f')](_0x4fc0('0x6f')));}if(!fs[_0x4fc0('0x5c')](_0x5971a9)){throw new db[(_0x4fc0('0x6b'))]['ValidationError'](_['upperFirst'](_0x4fc0('0x58'))+'\x20not\x20found');}return _0x58caef[_0x4fc0('0x66')](_0x5971a9);}})[_0x4fc0('0x4a')](handleError(_0x58caef,null));};exports[_0x4fc0('0x70')]=function(_0x118c80,_0x1f9def,_0x2af6de){if(_0x118c80[_0x4fc0('0x51')]&&_0x118c80[_0x4fc0('0x51')]['filename']){_0x118c80[_0x4fc0('0x50')]['favicon']=_0x118c80[_0x4fc0('0x51')][_0x4fc0('0x52')];}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x118c80[_0x4fc0('0x4c')]['id']}})[_0x4fc0('0x1a')](handleEntityNotFound(_0x1f9def,null))['then'](saveUpdates(_0x118c80[_0x4fc0('0x50')],null))['then'](respondWithResult(_0x1f9def,null))[_0x4fc0('0x4a')](handleError(_0x1f9def,null));};var utilLicense=require(_0x4fc0('0x16'));exports[_0x4fc0('0x71')]=function(_0x608e,_0x21f8c5,_0x526971){var _0x12f636=_0x4fc0('0x6e');var _0x3e2943={'custom':![]};return utilLicense[_0x4fc0('0x56')]()[_0x4fc0('0x1a')](function(_0x170d20){if(_0x170d20){_0x3e2943=_0x170d20;}return db[_0x4fc0('0x33')][_0x4fc0('0x4f')]({'where':{'id':_0x608e['params']['id']},'attributes':[_0x4fc0('0x57'),_0x4fc0('0x54'),_0x4fc0('0x58'),_0x4fc0('0x59'),_0x4fc0('0x5a'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x4fc0('0x1a')](handleEntityNotFound(_0x21f8c5,null))[_0x4fc0('0x1a')](function(_0x5cf948){if(_0x5cf948){var _0x53849e=_0x5cf948['favicon']&&fs[_0x4fc0('0x5c')](path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x12f636,_[_0x4fc0('0x5f')](_0x5cf948[_0x4fc0('0x59')])))?path[_0x4fc0('0x5d')](config['root'],_0x12f636,_[_0x4fc0('0x5f')](_0x5cf948['favicon'])):path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x12f636,_[_0x4fc0('0x5f')]('default_favicon.ico'));var _0x522542=_0x4fc0('0x61')+_['upperFirst']('favicon');if(_0x5cf948[_0x522542]||!_0x3e2943['custom']){_0x53849e=path[_0x4fc0('0x5d')](config[_0x4fc0('0x5e')],_0x12f636,_[_0x4fc0('0x5f')](_0x4fc0('0x72')));}if(!fs[_0x4fc0('0x5c')](_0x53849e)){throw new db['Sequelize'][(_0x4fc0('0x64'))](_[_0x4fc0('0x62')]('favicon')+_0x4fc0('0x65'));}return _0x21f8c5[_0x4fc0('0x66')](_0x53849e);}})[_0x4fc0('0x4a')](handleError(_0x21f8c5,null));};exports[_0x4fc0('0x73')]=function(_0x234d27,_0x518044){var _0xbb8925={'offset':moment()[_0x4fc0('0x74')]()};_0xbb8925['now']=moment()[_0x4fc0('0x74')](_0xbb8925['offset'])[_0x4fc0('0x75')](_0x4fc0('0x76'));return _0x518044[_0x4fc0('0x29')](0xc8)['send'](_0xbb8925);}; \ No newline at end of file +var _0x386e=['existsSync','join','root','toLower','default_logo.svg','upperFirst','ValidationError','\x20not\x20found','download','defaultLogo','default_loginLogo.svg','default','custom','Sequelize','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','send','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x386e,0x94));var _0xe386=function(_0x3b9bc0,_0x1c48df){_0x3b9bc0=_0x3b9bc0-0x0;var _0x9eeb03=_0x386e[_0x3b9bc0];return _0x9eeb03;};'use strict';var pdf=require(_0xe386('0x0'));var emlformat=require(_0xe386('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe386('0x2'));var rp=require(_0xe386('0x3'));var moment=require(_0xe386('0x4'));var BPromise=require(_0xe386('0x5'));var Mustache=require(_0xe386('0x6'));var util=require(_0xe386('0x7'));var path=require(_0xe386('0x8'));var sox=require(_0xe386('0x9'));var csv=require(_0xe386('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe386('0xb'));var squel=require(_0xe386('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe386('0xa'));var querystring=require(_0xe386('0xd'));var Papa=require(_0xe386('0xe'));var Redis=require(_0xe386('0xf'));var authService=require(_0xe386('0x10'));var qs=require(_0xe386('0x11'));var as=require(_0xe386('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe386('0x13'))('api');var utils=require(_0xe386('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe386('0x15'))['db'];var jayson=require(_0xe386('0x16'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54ab85,_0x4ffcf3,_0x201147,_0x19b9fa){return new BPromise(function(_0x1b046c,_0x45cb37){var _0x39e23e=_0x19b9fa||client;return _0x39e23e[_0xe386('0x17')](_0x54ab85,_0x201147)['then'](function(_0x110be3){logger[_0xe386('0x18')](_0xe386('0x19'),_0x4ffcf3,_0xe386('0x1a'));logger['debug'](_0xe386('0x1b'),_0x4ffcf3,_0xe386('0x1a'),JSON[_0xe386('0x1c')](_0x110be3));if(_0x110be3['error']){if(_0x110be3[_0xe386('0x1d')][_0xe386('0x1e')]===0x1f4){logger[_0xe386('0x1d')](_0xe386('0x19'),_0x4ffcf3,_0x110be3['error'][_0xe386('0x1f')]);return _0x45cb37(_0x110be3[_0xe386('0x1d')][_0xe386('0x1f')]);}logger[_0xe386('0x1d')](_0xe386('0x19'),_0x4ffcf3,_0x110be3[_0xe386('0x1d')]['message']);return _0x1b046c(_0x110be3[_0xe386('0x1d')][_0xe386('0x1f')]);}else{logger[_0xe386('0x18')]('Setting,\x20%s,\x20%s',_0x4ffcf3,_0xe386('0x1a'));_0x1b046c(_0x110be3['result'][_0xe386('0x1f')]);}})[_0xe386('0x20')](function(_0x58067f){logger[_0xe386('0x1d')](_0xe386('0x19'),_0x4ffcf3,_0x58067f);_0x45cb37(_0x58067f);});});}function respondWithStatusCode(_0x244b5c,_0x3d76c3){_0x3d76c3=_0x3d76c3||0xcc;return function(_0x2ce124){if(_0x2ce124){return _0x244b5c['sendStatus'](_0x3d76c3);}return _0x244b5c['status'](_0x3d76c3)[_0xe386('0x21')]();};}function respondWithResult(_0x3b203d,_0x10f2b5){_0x10f2b5=_0x10f2b5||0xc8;return function(_0x252942){if(_0x252942){return _0x3b203d['status'](_0x10f2b5)[_0xe386('0x22')](_0x252942);}};}function respondWithFilteredResult(_0x3a4cec,_0xc4f8b8){return function(_0x5c37bd){if(_0x5c37bd){var _0x14acd2=_0x5c37bd[_0xe386('0x23')],_0x571322=_0xc4f8b8['offset'],_0x4d3822=_0xc4f8b8[_0xe386('0x24')]+_0xc4f8b8[_0xe386('0x25')],_0x40abd4;if(_0x4d3822>=_0x14acd2){_0x4d3822=_0x14acd2;_0x40abd4=0xc8;}else{_0x40abd4=0xce;}_0x3a4cec[_0xe386('0x26')](_0x40abd4);return _0x3a4cec[_0xe386('0x27')](_0xe386('0x28'),_0x571322+'-'+_0x4d3822+'/'+_0x14acd2)['json'](_0x5c37bd);}return null;};}function patchUpdates(_0x4ce051){return function(_0x75d686){try{jsonpatch[_0xe386('0x29')](_0x75d686,_0x4ce051,!![]);}catch(_0x1ebcd0){return BPromise[_0xe386('0x2a')](_0x1ebcd0);}return _0x75d686[_0xe386('0x2b')]();};}function saveUpdates(_0x2202ea,_0x10b5d2){return function(_0x585f6e){if(_0x585f6e){return _0x585f6e[_0xe386('0x2c')](_0x2202ea)[_0xe386('0x2d')](function(_0x150da4){return _0x150da4;});}return null;};}function removeEntity(_0x2d04ff,_0x56e4d8){return function(_0x32614a){if(_0x32614a){return _0x32614a[_0xe386('0x2e')]()[_0xe386('0x2d')](function(){_0x2d04ff[_0xe386('0x26')](0xcc)[_0xe386('0x21')]();});}};}function handleEntityNotFound(_0x1636b7,_0x95dfb5){return function(_0x2e2c7b){if(!_0x2e2c7b){_0x1636b7[_0xe386('0x2f')](0x194);}return _0x2e2c7b;};}function handleError(_0x5edff9,_0x9c885f){_0x9c885f=_0x9c885f||0x1f4;return function(_0x208155){logger[_0xe386('0x1d')](_0x208155[_0xe386('0x30')]);if(_0x208155[_0xe386('0x31')]){delete _0x208155[_0xe386('0x31')];}_0x5edff9[_0xe386('0x26')](_0x9c885f)['send'](_0x208155);};}exports[_0xe386('0x32')]=function(_0x2168b3,_0x34ca52){var _0x23e633={},_0x116995={},_0x51c4e7={'count':0x0,'rows':[]};var _0x1c47e0=_[_0xe386('0x33')](db[_0xe386('0x34')][_0xe386('0x35')],function(_0x1c8554){return{'name':_0x1c8554[_0xe386('0x36')],'type':_0x1c8554[_0xe386('0x37')][_0xe386('0x38')]};});_0x116995[_0xe386('0x39')]=_[_0xe386('0x33')](_0x1c47e0,_0xe386('0x31'));_0x116995['query']=_[_0xe386('0x3a')](_0x2168b3[_0xe386('0x3b')]);_0x116995[_0xe386('0x3c')]=_[_0xe386('0x3d')](_0x116995['model'],_0x116995[_0xe386('0x3b')]);_0x23e633[_0xe386('0x3e')]=_[_0xe386('0x3d')](_0x116995[_0xe386('0x39')],qs[_0xe386('0x3f')](_0x2168b3[_0xe386('0x3b')][_0xe386('0x3f')]));_0x23e633['attributes']=_0x23e633[_0xe386('0x3e')][_0xe386('0x40')]?_0x23e633[_0xe386('0x3e')]:_0x116995[_0xe386('0x39')];if(!_0x2168b3['query'][_0xe386('0x41')](_0xe386('0x42'))){_0x23e633[_0xe386('0x25')]=qs['limit'](_0x2168b3['query'][_0xe386('0x25')]);_0x23e633[_0xe386('0x24')]=qs[_0xe386('0x24')](_0x2168b3[_0xe386('0x3b')][_0xe386('0x24')]);}_0x23e633[_0xe386('0x43')]=qs[_0xe386('0x44')](_0x2168b3['query'][_0xe386('0x44')]);_0x23e633[_0xe386('0x45')]=qs[_0xe386('0x3c')](_[_0xe386('0x46')](_0x2168b3['query'],_0x116995[_0xe386('0x3c')]),_0x1c47e0);if(_0x2168b3[_0xe386('0x3b')][_0xe386('0x47')]){_0x23e633[_0xe386('0x45')]=_[_0xe386('0x48')](_0x23e633[_0xe386('0x45')],{'$or':_[_0xe386('0x33')](_0x1c47e0,function(_0x14abcc){if(_0x14abcc['type']!=='VIRTUAL'){var _0x195f2e={};_0x195f2e[_0x14abcc['name']]={'$like':'%'+_0x2168b3[_0xe386('0x3b')]['filter']+'%'};return _0x195f2e;}})});}_0x23e633=_[_0xe386('0x48')]({},_0x23e633,_0x2168b3[_0xe386('0x49')]);var _0xd336dd={'where':_0x23e633[_0xe386('0x45')]};return db['Setting'][_0xe386('0x23')](_0xd336dd)['then'](function(_0x373861){_0x51c4e7['count']=_0x373861;if(_0x2168b3[_0xe386('0x3b')][_0xe386('0x4a')]){_0x23e633[_0xe386('0x4b')]=[{'all':!![]}];}return db[_0xe386('0x34')][_0xe386('0x4c')](_0x23e633);})[_0xe386('0x2d')](function(_0x5564b5){_0x51c4e7[_0xe386('0x4d')]=_0x5564b5;return _0x51c4e7;})[_0xe386('0x2d')](respondWithFilteredResult(_0x34ca52,_0x23e633))['catch'](handleError(_0x34ca52,null));};exports[_0xe386('0x4e')]=function(_0x3020c0,_0x2b883a){var _0x24ec30={'raw':![],'where':{'id':_0x3020c0[_0xe386('0x4f')]['id']}},_0x5f3fdf={};_0x5f3fdf[_0xe386('0x39')]=_['keys'](db[_0xe386('0x34')][_0xe386('0x35')]);_0x5f3fdf[_0xe386('0x3b')]=_['keys'](_0x3020c0[_0xe386('0x3b')]);_0x5f3fdf[_0xe386('0x3c')]=_[_0xe386('0x3d')](_0x5f3fdf[_0xe386('0x39')],_0x5f3fdf[_0xe386('0x3b')]);_0x24ec30[_0xe386('0x3e')]=_[_0xe386('0x3d')](_0x5f3fdf['model'],qs['fields'](_0x3020c0['query'][_0xe386('0x3f')]));_0x24ec30[_0xe386('0x3e')]=_0x24ec30[_0xe386('0x3e')]['length']?_0x24ec30[_0xe386('0x3e')]:_0x5f3fdf[_0xe386('0x39')];if(_0x3020c0[_0xe386('0x3b')][_0xe386('0x4a')]){_0x24ec30[_0xe386('0x4b')]=[{'all':!![]}];}_0x24ec30=_[_0xe386('0x48')]({},_0x24ec30,_0x3020c0['options']);return db[_0xe386('0x34')][_0xe386('0x50')](_0x24ec30)[_0xe386('0x2d')](handleEntityNotFound(_0x2b883a,null))[_0xe386('0x2d')](respondWithResult(_0x2b883a,null))[_0xe386('0x20')](handleError(_0x2b883a,null));};exports[_0xe386('0x2c')]=function(_0x44e977,_0x667296){if(_0x44e977['body']['id']){delete _0x44e977[_0xe386('0x51')]['id'];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x44e977[_0xe386('0x4f')]['id']}})['then'](handleEntityNotFound(_0x667296,null))[_0xe386('0x2d')](saveUpdates(_0x44e977[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x667296,null))[_0xe386('0x20')](handleError(_0x667296,null));};exports[_0xe386('0x52')]=function(_0x138f9e,_0x9d298e,_0x230bce){if(_0x138f9e[_0xe386('0x53')]&&_0x138f9e[_0xe386('0x53')][_0xe386('0x54')]){_0x138f9e[_0xe386('0x51')][_0xe386('0x55')]=_0x138f9e[_0xe386('0x53')][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x138f9e[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x9d298e,null))[_0xe386('0x2d')](saveUpdates(_0x138f9e[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x9d298e,null))[_0xe386('0x20')](handleError(_0x9d298e,null));};exports[_0xe386('0x56')]=function(_0x495f07,_0x3fcc41,_0x28b288){if(_0x495f07[_0xe386('0x53')]&&_0x495f07[_0xe386('0x53')][_0xe386('0x54')]){_0x495f07['body']['loginLogo']=_0x495f07[_0xe386('0x53')][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x495f07[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x3fcc41,null))[_0xe386('0x2d')](saveUpdates(_0x495f07[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x3fcc41,null))[_0xe386('0x20')](handleError(_0x3fcc41,null));};var utilLicense=require(_0xe386('0x57'));exports['getLogo']=function(_0x185635,_0x3d4294,_0x14f5c0){var _0x552b35=_0xe386('0x58');var _0xbff8c8={'custom':![]};return utilLicense[_0xe386('0x59')]()['then'](function(_0x15b117){if(_0x15b117){_0xbff8c8=_0x15b117;}return db['Setting']['find']({'where':{'id':_0x185635[_0xe386('0x4f')]['id']},'attributes':['logo',_0xe386('0x5a'),_0xe386('0x5b'),_0xe386('0x5c'),'defaultLogo',_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x3d4294,null))[_0xe386('0x2d')](function(_0x59ccc7){if(_0x59ccc7){var _0x1775a1=_0x59ccc7[_0xe386('0x55')]&&fs[_0xe386('0x60')](path[_0xe386('0x61')](config['root'],_0x552b35,_['toLower'](_0x59ccc7[_0xe386('0x55')])))?path['join'](config[_0xe386('0x62')],_0x552b35,_['toLower'](_0x59ccc7[_0xe386('0x55')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x552b35,_[_0xe386('0x63')](_0xe386('0x64')));var _0x395dd8='default'+_[_0xe386('0x65')]('logo');if(_0x59ccc7[_0x395dd8]||!_0xbff8c8['custom']){_0x1775a1=path[_0xe386('0x61')](config[_0xe386('0x62')],_0x552b35,_[_0xe386('0x63')](_0xe386('0x64')));}if(!fs[_0xe386('0x60')](_0x1775a1)){throw new db['Sequelize'][(_0xe386('0x66'))](_[_0xe386('0x65')](_0xe386('0x55'))+_0xe386('0x67'));}return _0x3d4294[_0xe386('0x68')](_0x1775a1);}})[_0xe386('0x20')](handleError(_0x3d4294,null));};var utilLicense=require(_0xe386('0x57'));exports['getLogoLogin']=function(_0x304a67,_0x1c9fdc,_0x4f67b2){var _0x36595d=_0xe386('0x58');var _0x492261={'custom':![]};return utilLicense['getLicense']()[_0xe386('0x2d')](function(_0x54183e){if(_0x54183e){_0x492261=_0x54183e;}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x304a67[_0xe386('0x4f')]['id']},'attributes':[_0xe386('0x55'),_0xe386('0x5a'),_0xe386('0x5b'),_0xe386('0x5c'),_0xe386('0x69'),_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x1c9fdc,null))[_0xe386('0x2d')](function(_0x4894ff){if(_0x4894ff){var _0x395881=_0x4894ff['loginLogo']&&fs['existsSync'](path[_0xe386('0x61')](config['root'],_0x36595d,_[_0xe386('0x63')](_0x4894ff['loginLogo'])))?path[_0xe386('0x61')](config[_0xe386('0x62')],_0x36595d,_[_0xe386('0x63')](_0x4894ff[_0xe386('0x5a')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x36595d,_['toLower'](_0xe386('0x6a')));var _0x48cf89=_0xe386('0x6b')+_[_0xe386('0x65')]('loginLogo');if(_0x4894ff[_0x48cf89]||!_0x492261[_0xe386('0x6c')]){_0x395881=path['join'](config[_0xe386('0x62')],_0x36595d,_[_0xe386('0x63')](_0xe386('0x6a')));}if(!fs[_0xe386('0x60')](_0x395881)){throw new db[(_0xe386('0x6d'))][(_0xe386('0x66'))](_[_0xe386('0x65')](_0xe386('0x5a'))+_0xe386('0x67'));}return _0x1c9fdc[_0xe386('0x68')](_0x395881);}})['catch'](handleError(_0x1c9fdc,null));};exports['gdpr']=function(_0xfcf38e,_0x198ecc){return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0xfcf38e[_0xe386('0x4f')]['id']},'attributes':[_0xe386('0x6e')]})[_0xe386('0x2d')](respondWithResult(_0x198ecc,null))[_0xe386('0x20')](handleError(_0x198ecc,null));};exports[_0xe386('0x6f')]=function(_0x3b9345,_0x3b46e9,_0x585a20){if(_0x3b9345[_0xe386('0x53')]&&_0x3b9345['file']['filename']){_0x3b9345['body'][_0xe386('0x5b')]=_0x3b9345[_0xe386('0x53')][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x3b9345[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x3b46e9,null))[_0xe386('0x2d')](saveUpdates(_0x3b9345[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x3b46e9,null))[_0xe386('0x20')](handleError(_0x3b46e9,null));};var utilLicense=require(_0xe386('0x57'));exports[_0xe386('0x70')]=function(_0x3b6b19,_0x41b84e,_0x3c9ee2){var _0x2baaff='server/files/images/logos';var _0x236768={'custom':![]};return utilLicense[_0xe386('0x59')]()[_0xe386('0x2d')](function(_0x48667e){if(_0x48667e){_0x236768=_0x48667e;}return db[_0xe386('0x34')]['find']({'where':{'id':_0x3b6b19[_0xe386('0x4f')]['id']},'attributes':['logo',_0xe386('0x5a'),'preferred',_0xe386('0x5c'),_0xe386('0x69'),_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x41b84e,null))['then'](function(_0xb40249){if(_0xb40249){var _0x155262=_0xb40249['preferred']&&fs[_0xe386('0x60')](path[_0xe386('0x61')](config['root'],_0x2baaff,_[_0xe386('0x63')](_0xb40249[_0xe386('0x5b')])))?path[_0xe386('0x61')](config['root'],_0x2baaff,_['toLower'](_0xb40249[_0xe386('0x5b')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x2baaff,_[_0xe386('0x63')](_0xe386('0x71')));var _0xe38173=_0xe386('0x6b')+_['upperFirst']('preferred');if(_0xb40249[_0xe38173]||!_0x236768[_0xe386('0x6c')]||!_0x236768[_0xe386('0x5b')]){_0x155262=path[_0xe386('0x61')](config[_0xe386('0x62')],_0x2baaff,_[_0xe386('0x63')](_0xe386('0x71')));}if(!fs[_0xe386('0x60')](_0x155262)){throw new db[(_0xe386('0x6d'))]['ValidationError'](_[_0xe386('0x65')]('preferred')+'\x20not\x20found');}return _0x41b84e[_0xe386('0x68')](_0x155262);}})[_0xe386('0x20')](handleError(_0x41b84e,null));};exports[_0xe386('0x72')]=function(_0x2e20ba,_0x15f78b,_0x30fe4b){if(_0x2e20ba[_0xe386('0x53')]&&_0x2e20ba[_0xe386('0x53')][_0xe386('0x54')]){_0x2e20ba[_0xe386('0x51')][_0xe386('0x5c')]=_0x2e20ba['file'][_0xe386('0x54')];}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x2e20ba[_0xe386('0x4f')]['id']}})[_0xe386('0x2d')](handleEntityNotFound(_0x15f78b,null))['then'](saveUpdates(_0x2e20ba[_0xe386('0x51')],null))[_0xe386('0x2d')](respondWithResult(_0x15f78b,null))['catch'](handleError(_0x15f78b,null));};var utilLicense=require(_0xe386('0x57'));exports[_0xe386('0x73')]=function(_0x5e8e89,_0x4c7998,_0x54e6a0){var _0x43a74d='server/files/images/logos';var _0x25a403={'custom':![]};return utilLicense[_0xe386('0x59')]()['then'](function(_0x4124e0){if(_0x4124e0){_0x25a403=_0x4124e0;}return db[_0xe386('0x34')][_0xe386('0x50')]({'where':{'id':_0x5e8e89['params']['id']},'attributes':['logo',_0xe386('0x5a'),_0xe386('0x5b'),_0xe386('0x5c'),'defaultLogo',_0xe386('0x5d'),_0xe386('0x5e'),_0xe386('0x5f')],'raw':!![]});})[_0xe386('0x2d')](handleEntityNotFound(_0x4c7998,null))[_0xe386('0x2d')](function(_0x59fa53){if(_0x59fa53){var _0x522c57=_0x59fa53['favicon']&&fs[_0xe386('0x60')](path[_0xe386('0x61')](config['root'],_0x43a74d,_['toLower'](_0x59fa53[_0xe386('0x5c')])))?path[_0xe386('0x61')](config[_0xe386('0x62')],_0x43a74d,_[_0xe386('0x63')](_0x59fa53[_0xe386('0x5c')])):path[_0xe386('0x61')](config[_0xe386('0x62')],_0x43a74d,_[_0xe386('0x63')](_0xe386('0x74')));var _0xd07795=_0xe386('0x6b')+_['upperFirst'](_0xe386('0x5c'));if(_0x59fa53[_0xd07795]||!_0x25a403[_0xe386('0x6c')]){_0x522c57=path[_0xe386('0x61')](config[_0xe386('0x62')],_0x43a74d,_[_0xe386('0x63')](_0xe386('0x74')));}if(!fs[_0xe386('0x60')](_0x522c57)){throw new db[(_0xe386('0x6d'))][(_0xe386('0x66'))](_[_0xe386('0x65')]('favicon')+_0xe386('0x67'));}return _0x4c7998[_0xe386('0x68')](_0x522c57);}})[_0xe386('0x20')](handleError(_0x4c7998,null));};exports[_0xe386('0x75')]=function(_0x36a1fd,_0x5a6e8a){var _0x4a8b52={'offset':moment()['utcOffset']()};_0x4a8b52[_0xe386('0x76')]=moment()[_0xe386('0x77')](_0x4a8b52[_0xe386('0x24')])[_0xe386('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5a6e8a['status'](0xc8)[_0xe386('0x79')](_0x4a8b52);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 737d4b2..e7c6621 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 _0xc239=['define','Setting','settings','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x267fe7,_0x356d98){var _0x19fd55=function(_0xf18753){while(--_0xf18753){_0x267fe7['push'](_0x267fe7['shift']());}};_0x19fd55(++_0x356d98);}(_0xc239,0x12e));var _0x9c23=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc239[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x9c23('0x0'));var util=require(_0x9c23('0x1'));var logger=require('../../config/logger')(_0x9c23('0x2'));var moment=require('moment');var BPromise=require(_0x9c23('0x3'));var rp=require(_0x9c23('0x4'));var fs=require('fs');var path=require(_0x9c23('0x5'));var rimraf=require(_0x9c23('0x6'));var config=require(_0x9c23('0x7'));var attributes=require(_0x9c23('0x8'));module[_0x9c23('0x9')]=function(_0x58580d,_0x28a254){return _0x58580d[_0x9c23('0xa')](_0x9c23('0xb'),attributes,{'tableName':_0x9c23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x941c=['../../config/environment','./setting.attributes','define','settings','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x47f277,_0x1c88e4){var _0x156c11=function(_0x3d19cf){while(--_0x3d19cf){_0x47f277['push'](_0x47f277['shift']());}};_0x156c11(++_0x1c88e4);}(_0x941c,0x1c7));var _0xc941=function(_0x212234,_0x54d864){_0x212234=_0x212234-0x0;var _0x232226=_0x941c[_0x212234];return _0x232226;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var logger=require('../../config/logger')(_0xc941('0x2'));var moment=require('moment');var BPromise=require(_0xc941('0x3'));var rp=require(_0xc941('0x4'));var fs=require('fs');var path=require(_0xc941('0x5'));var rimraf=require(_0xc941('0x6'));var config=require(_0xc941('0x7'));var attributes=require(_0xc941('0x8'));module['exports']=function(_0x4e172a,_0x382de3){return _0x4e172a[_0xc941('0x9')]('Setting',attributes,{'tableName':_0xc941('0xa'),'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 3aa1361..5c60432 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 _0xd132=['../../config/environment','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2b3669,_0x3cd96b){var _0x10fe0c=function(_0x2d380c){while(--_0x2d380c){_0x2b3669['push'](_0x2b3669['shift']());}};_0x10fe0c(++_0x3cd96b);}(_0xd132,0xd3));var _0x2d13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd132[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2d13('0x0'));var util=require(_0x2d13('0x1'));var moment=require(_0x2d13('0x2'));var BPromise=require(_0x2d13('0x3'));var rs=require(_0x2d13('0x4'));var fs=require('fs');var Redis=require(_0x2d13('0x5'));var db=require(_0x2d13('0x6'))['db'];var utils=require(_0x2d13('0x7'));var logger=require('../../config/logger')(_0x2d13('0x8'));var config=require(_0x2d13('0x9'));var jayson=require(_0x2d13('0xa'));var client=jayson[_0x2d13('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb78612,_0x337a0d,_0x67333e){return new BPromise(function(_0x11a8d3,_0x4987bc){return client[_0x2d13('0xc')](_0xb78612,_0x67333e)['then'](function(_0x284cb2){logger[_0x2d13('0xd')](_0x2d13('0xe'),_0x337a0d,_0x2d13('0xf'));logger[_0x2d13('0x10')](_0x2d13('0x11'),_0x337a0d,_0x2d13('0xf'),JSON['stringify'](_0x284cb2));if(_0x284cb2[_0x2d13('0x12')]){if(_0x284cb2['error']['code']===0x1f4){logger[_0x2d13('0x12')]('Setting,\x20%s,\x20%s',_0x337a0d,_0x284cb2[_0x2d13('0x12')][_0x2d13('0x13')]);return _0x4987bc(_0x284cb2[_0x2d13('0x12')]['message']);}logger[_0x2d13('0x12')]('Setting,\x20%s,\x20%s',_0x337a0d,_0x284cb2[_0x2d13('0x12')][_0x2d13('0x13')]);return _0x11a8d3(_0x284cb2[_0x2d13('0x12')][_0x2d13('0x13')]);}else{logger[_0x2d13('0xd')]('Setting,\x20%s,\x20%s',_0x337a0d,'request\x20sent');_0x11a8d3(_0x284cb2[_0x2d13('0x14')][_0x2d13('0x13')]);}})[_0x2d13('0x15')](function(_0x17ef20){logger[_0x2d13('0x12')](_0x2d13('0xe'),_0x337a0d,_0x17ef20);_0x4987bc(_0x17ef20);});});} \ No newline at end of file +var _0xf94d=['stringify','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x5c4b6a,_0x3e4163){var _0x2dec05=function(_0x17017e){while(--_0x17017e){_0x5c4b6a['push'](_0x5c4b6a['shift']());}};_0x2dec05(++_0x3e4163);}(_0xf94d,0xd5));var _0xdf94=function(_0xcbfa19,_0x2bbe04){_0xcbfa19=_0xcbfa19-0x0;var _0x232afc=_0xf94d[_0xcbfa19];return _0x232afc;};'use strict';var _=require(_0xdf94('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf94('0x1'));var rs=require(_0xdf94('0x2'));var fs=require('fs');var Redis=require(_0xdf94('0x3'));var db=require(_0xdf94('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf94('0x5'));var config=require(_0xdf94('0x6'));var jayson=require(_0xdf94('0x7'));var client=jayson[_0xdf94('0x8')][_0xdf94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371f79,_0x24a115,_0x37e31e){return new BPromise(function(_0x2bc8b9,_0x576489){return client[_0xdf94('0xa')](_0x371f79,_0x37e31e)[_0xdf94('0xb')](function(_0x3c9035){logger[_0xdf94('0xc')](_0xdf94('0xd'),_0x24a115,_0xdf94('0xe'));logger[_0xdf94('0xf')](_0xdf94('0x10'),_0x24a115,_0xdf94('0xe'),JSON[_0xdf94('0x11')](_0x3c9035));if(_0x3c9035['error']){if(_0x3c9035['error'][_0xdf94('0x12')]===0x1f4){logger[_0xdf94('0x13')](_0xdf94('0xd'),_0x24a115,_0x3c9035[_0xdf94('0x13')][_0xdf94('0x14')]);return _0x576489(_0x3c9035[_0xdf94('0x13')][_0xdf94('0x14')]);}logger[_0xdf94('0x13')]('Setting,\x20%s,\x20%s',_0x24a115,_0x3c9035[_0xdf94('0x13')]['message']);return _0x2bc8b9(_0x3c9035[_0xdf94('0x13')]['message']);}else{logger[_0xdf94('0xc')](_0xdf94('0xd'),_0x24a115,_0xdf94('0xe'));_0x2bc8b9(_0x3c9035[_0xdf94('0x15')][_0xdf94('0x14')]);}})[_0xdf94('0x16')](function(_0x3b4fac){logger[_0xdf94('0x13')](_0xdf94('0xd'),_0x24a115,_0x3b4fac);_0x576489(_0x3b4fac);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4f0e162..7b57d49 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 _0xbaf0=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x362057,_0x448ff9){var _0x397f79=function(_0x22b0ff){while(--_0x22b0ff){_0x362057['push'](_0x362057['shift']());}};_0x397f79(++_0x448ff9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x0baf('0x8')](_0x0baf('0x14'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router['get'](_0x0baf('0x16'),controller['statusGet']);router[_0x0baf('0x8')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x19')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller['addAnswer']);router[_0x0baf('0x19')](_0x0baf('0x1b'),controller[_0x0baf('0x1c')]);router[_0x0baf('0x19')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller['addApplications']);router['post'](_0x0baf('0x1d'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1e')]);router[_0x0baf('0x19')](_0x0baf('0x16'),controller[_0x0baf('0x1f')]);router[_0x0baf('0x19')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);router['put'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0x21')]);router['delete']('/:id',auth[_0x0baf('0x9')](),controller['destroy']);router['delete'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x22')]);router[_0x0baf('0x23')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x24')]);router[_0x0baf('0x23')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x25')]);module[_0x0baf('0x26')]=router; \ No newline at end of file +var _0xb10b=['destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update','delete'];(function(_0x40b793,_0x15f176){var _0x2084aa=function(_0x4bba09){while(--_0x4bba09){_0x40b793['push'](_0x40b793['shift']());}};_0x2084aa(++_0x15f176);}(_0xb10b,0x12a));var _0xbb10=function(_0x6ea106,_0x181b3d){_0x6ea106=_0x6ea106-0x0;var _0x49ecfe=_0xb10b[_0x6ea106];return _0x49ecfe;};'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['getDispositions']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x8')](_0xbb10('0x13'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x8')]('/:id/status',controller[_0xbb10('0x15')]);router[_0xbb10('0x8')](_0xbb10('0x16'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x18')](_0xbb10('0xe'),auth['isAuthenticated'](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x18')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x18')](_0xbb10('0x1c'),controller[_0xbb10('0x1d')]);router[_0xbb10('0x18')](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x18')](_0xbb10('0x1f'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x20')]);router[_0xbb10('0x18')]('/:id/status',controller[_0xbb10('0x21')]);router[_0xbb10('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x22')]);router[_0xbb10('0x23')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xbb10('0x9')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0x9')](),controller[_0xbb10('0x28')]);module[_0xbb10('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f27957f..bef3425 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 _0x0b63=['TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','BOOLEAN'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x0b63,0x16e));var _0x30b6=function(_0x70772a,_0x51fba4){_0x70772a=_0x70772a-0x0;var _0x2c9bec=_0x0b63[_0x70772a];return _0x2c9bec;};'use strict';var Sequelize=require(_0x30b6('0x0'));var rs=require(_0x30b6('0x1'));module[_0x30b6('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x30b6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x30b6('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x30b6('0x4')]();}},'phone':{'type':Sequelize[_0x30b6('0x3')]},'type':{'type':Sequelize[_0x30b6('0x5')]('twilio',_0x30b6('0x6'),_0x30b6('0x7'),_0x30b6('0x8'),_0x30b6('0x9'),_0x30b6('0xa'),_0x30b6('0xb'),_0x30b6('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x30b6('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x30b6('0x3')]},'smsMethod':{'type':Sequelize[_0x30b6('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x30b6('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x30b6('0x3')]},'senderString':{'type':Sequelize[_0x30b6('0x3')]},'deliveryReport':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x30b6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x30b6('0xe')],'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[_0x30b6('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x30b6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x30b6('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x30b6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x30b6('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x30b6('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1fbf33){if(!_0x1fbf33)this['setDataValue'](_0x30b6('0x11'),null);this[_0x30b6('0x12')]('mandatoryDisposition',_0x1fbf33);}}}; \ No newline at end of file +var _0x59ce=['skebby','clickatell','csc','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio'];(function(_0x58faba,_0x607ff5){var _0x2527df=function(_0x3917d3){while(--_0x3917d3){_0x58faba['push'](_0x58faba['shift']());}};_0x2527df(++_0x607ff5);}(_0x59ce,0x88));var _0xe59c=function(_0x419901,_0x597fb7){_0x419901=_0x419901-0x0;var _0x2e41dc=_0x59ce[_0x419901];return _0x2e41dc;};'use strict';var Sequelize=require(_0xe59c('0x0'));var rs=require(_0xe59c('0x1'));module[_0xe59c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe59c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe59c('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe59c('0x5')]();}},'phone':{'type':Sequelize[_0xe59c('0x4')]},'type':{'type':Sequelize[_0xe59c('0x6')](_0xe59c('0x7'),_0xe59c('0x8'),'connectel','clicksend','plivo',_0xe59c('0x9'),_0xe59c('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xe59c('0x4')]},'authId':{'type':Sequelize[_0xe59c('0x4')]},'authToken':{'type':Sequelize[_0xe59c('0x4')]},'smsMethod':{'type':Sequelize[_0xe59c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe59c('0x4')]},'password':{'type':Sequelize[_0xe59c('0x4')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xe59c('0x4')]},'deliveryReport':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe59c('0xc');}},'notificationSound':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe59c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe59c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe59c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe59c('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe59c('0xd')],'comment':_0xe59c('0xe')},'mandatoryDisposition':{'type':Sequelize[_0xe59c('0xb')],'defaultValue':![],'comment':_0xe59c('0xf'),'set':function(_0x1276ac){if(!_0x1276ac)this['setDataValue'](_0xe59c('0x10'),null);this[_0xe59c('0x11')]('mandatoryDisposition',_0x1276ac);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index eed84d5..db0e0f5 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 _0x954d=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','get','UserProfileResource','destroy','name','index','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','Pause','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','include','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','Body','messageId','MessageSid','skebby','sender','text','connectel','from','plivo','From','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','startRouting','Start','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','infobip','groupName','clickatell','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','intelepeer','ACCEPTD','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x292f6d,_0x47073b){var _0x21a98=function(_0x4246f7){while(--_0x4246f7){_0x292f6d['push'](_0x292f6d['shift']());}};_0x21a98(++_0x47073b);}(_0x954d,0x1c3));var _0xd954=function(_0x32ffb5,_0x3866b5){_0x32ffb5=_0x32ffb5-0x0;var _0x3cbd7a=_0x954d[_0x32ffb5];return _0x3cbd7a;};'use strict';var pdf=require(_0xd954('0x0'));var emlformat=require(_0xd954('0x1'));var rimraf=require(_0xd954('0x2'));var zipdir=require(_0xd954('0x3'));var jsonpatch=require(_0xd954('0x4'));var rp=require(_0xd954('0x5'));var moment=require('moment');var BPromise=require(_0xd954('0x6'));var Mustache=require(_0xd954('0x7'));var util=require(_0xd954('0x8'));var path=require(_0xd954('0x9'));var sox=require(_0xd954('0xa'));var csv=require(_0xd954('0xb'));var ejs=require(_0xd954('0xc'));var fs=require('fs');var _=require(_0xd954('0xd'));var squel=require(_0xd954('0xe'));var crypto=require(_0xd954('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd954('0x10'));var toCsv=require(_0xd954('0xb'));var querystring=require(_0xd954('0x11'));var Papa=require('papaparse');var Redis=require(_0xd954('0x12'));var authService=require(_0xd954('0x13'));var qs=require(_0xd954('0x14'));var as=require(_0xd954('0x15'));var hardwareService=require(_0xd954('0x16'));var logger=require(_0xd954('0x17'))('api');var utils=require(_0xd954('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd954('0x19'));var db=require(_0xd954('0x1a'))['db'];config['redis']=_[_0xd954('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd954('0x1c'))(new Redis(config[_0xd954('0x1d')]));require(_0xd954('0x1e'))['register'](socket);var jayson=require(_0xd954('0x1f'));var client=jayson[_0xd954('0x20')][_0xd954('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3a6677,_0x5e56a8,_0x3bfb6b,_0x208dd4){return new BPromise(function(_0x426873,_0x487928){var _0x57c5e6=_0x208dd4||client;return _0x57c5e6[_0xd954('0x22')](_0x3a6677,_0x3bfb6b)[_0xd954('0x23')](function(_0x495a77){logger[_0xd954('0x24')](_0xd954('0x25'),_0x5e56a8,_0xd954('0x26'));logger['debug'](_0xd954('0x27'),_0x5e56a8,'request\x20sent',JSON[_0xd954('0x28')](_0x495a77));if(_0x495a77[_0xd954('0x29')]){if(_0x495a77[_0xd954('0x29')]['code']===0x1f4){logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s',_0x5e56a8,_0x495a77['error'][_0xd954('0x2a')]);return _0x487928(_0x495a77['error'][_0xd954('0x2a')]);}logger['error'](_0xd954('0x25'),_0x5e56a8,_0x495a77[_0xd954('0x29')][_0xd954('0x2a')]);return _0x426873(_0x495a77[_0xd954('0x29')][_0xd954('0x2a')]);}else{logger['info'](_0xd954('0x25'),_0x5e56a8,'request\x20sent');_0x426873(_0x495a77[_0xd954('0x2b')][_0xd954('0x2a')]);}})['catch'](function(_0x5b7ffe){logger['error'](_0xd954('0x25'),_0x5e56a8,_0x5b7ffe);_0x487928(_0x5b7ffe);});});}function respondWithStatusCode(_0xe7531a,_0x4c7dc4){_0x4c7dc4=_0x4c7dc4||0xcc;return function(_0x123382){if(_0x123382){return _0xe7531a[_0xd954('0x2c')](_0x4c7dc4);}return _0xe7531a[_0xd954('0x2d')](_0x4c7dc4)[_0xd954('0x2e')]();};}function respondWithResult(_0x56e005,_0x303ac1){_0x303ac1=_0x303ac1||0xc8;return function(_0x4dd336){if(_0x4dd336){return _0x56e005['status'](_0x303ac1)[_0xd954('0x2f')](_0x4dd336);}};}function respondWithFilteredResult(_0x35a27a,_0x24d6bd){return function(_0x137483){if(_0x137483){var _0x1f6a7d=_0x137483[_0xd954('0x30')],_0x5ab319=_0x24d6bd[_0xd954('0x31')],_0x4f2c3c=_0x24d6bd[_0xd954('0x31')]+_0x24d6bd[_0xd954('0x32')],_0x5aaf96;if(_0x4f2c3c>=_0x1f6a7d){_0x4f2c3c=_0x1f6a7d;_0x5aaf96=0xc8;}else{_0x5aaf96=0xce;}_0x35a27a['status'](_0x5aaf96);return _0x35a27a[_0xd954('0x33')]('Content-Range',_0x5ab319+'-'+_0x4f2c3c+'/'+_0x1f6a7d)['json'](_0x137483);}return null;};}function patchUpdates(_0x26d1bd){return function(_0x17ea37){try{jsonpatch[_0xd954('0x34')](_0x17ea37,_0x26d1bd,!![]);}catch(_0x43ed8e){return BPromise[_0xd954('0x35')](_0x43ed8e);}return _0x17ea37[_0xd954('0x36')]();};}function saveUpdates(_0x59574f,_0x3ce160){return function(_0x253170){if(_0x253170){return _0x253170[_0xd954('0x37')](_0x59574f)[_0xd954('0x23')](function(_0x173cd8){return _0x173cd8;});}return null;};}function removeEntity(_0x5e047c,_0x51f8e1){return function(_0x31b48b){if(_0x31b48b){return _0x31b48b['destroy']()[_0xd954('0x23')](function(){var _0x38140c=_0x31b48b[_0xd954('0x38')]({'plain':!![]});var _0x4bfdc1='SmsAccounts';return db[_0xd954('0x39')][_0xd954('0x3a')]({'where':{'type':_0x4bfdc1,'resourceId':_0x38140c['id']}})['then'](function(){return _0x31b48b;});})[_0xd954('0x23')](function(){_0x5e047c[_0xd954('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300cc5,_0x2f9b20){return function(_0x5395f7){if(!_0x5395f7){_0x300cc5[_0xd954('0x2c')](0x194);}return _0x5395f7;};}function handleError(_0xe0fb1,_0x2620d7){_0x2620d7=_0x2620d7||0x1f4;return function(_0x52d937){logger['error'](_0x52d937['stack']);if(_0x52d937[_0xd954('0x3b')]){delete _0x52d937[_0xd954('0x3b')];}_0xe0fb1['status'](_0x2620d7)['send'](_0x52d937);};}exports[_0xd954('0x3c')]=function(_0x3194d8,_0x48cd37){var _0xd9a813={'include':[{'model':db['Pause'],'as':_0xd954('0x3d')}]},_0x483ddd={},_0x508ab2={'count':0x0,'rows':[]};var _0x3b4723=_[_0xd954('0x3e')](db[_0xd954('0x3f')]['rawAttributes'],function(_0xaab520){return{'name':_0xaab520[_0xd954('0x40')],'type':_0xaab520[_0xd954('0x41')]['key']};});_0x483ddd[_0xd954('0x42')]=_[_0xd954('0x3e')](_0x3b4723,_0xd954('0x3b'));_0x483ddd['query']=_[_0xd954('0x43')](_0x3194d8[_0xd954('0x44')]);_0x483ddd['filters']=_[_0xd954('0x45')](_0x483ddd[_0xd954('0x42')],_0x483ddd[_0xd954('0x44')]);_0xd9a813[_0xd954('0x46')]=_['intersection'](_0x483ddd[_0xd954('0x42')],qs[_0xd954('0x47')](_0x3194d8[_0xd954('0x44')][_0xd954('0x47')]));_0xd9a813[_0xd954('0x46')]=_0xd9a813[_0xd954('0x46')][_0xd954('0x48')]?_0xd9a813['attributes']:_0x483ddd[_0xd954('0x42')];if(!_0x3194d8[_0xd954('0x44')][_0xd954('0x49')](_0xd954('0x4a'))){_0xd9a813[_0xd954('0x32')]=qs['limit'](_0x3194d8['query'][_0xd954('0x32')]);_0xd9a813[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x3194d8[_0xd954('0x44')]['offset']);}_0xd9a813['order']=qs['sort'](_0x3194d8[_0xd954('0x44')][_0xd954('0x4b')]);_0xd9a813[_0xd954('0x4c')]=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x3194d8[_0xd954('0x44')],_0x483ddd[_0xd954('0x4d')]),_0x3b4723);if(_0x3194d8[_0xd954('0x44')]['filter']){_0xd9a813[_0xd954('0x4c')]=_[_0xd954('0x4f')](_0xd9a813[_0xd954('0x4c')],{'$or':_['map'](_0x3b4723,function(_0x5e693d){if(_0x5e693d[_0xd954('0x41')]!==_0xd954('0x50')){var _0x5ecfa9={};_0x5ecfa9[_0x5e693d[_0xd954('0x3b')]]={'$like':'%'+_0x3194d8[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x5ecfa9;}})});}_0xd9a813=_[_0xd954('0x4f')]({},_0xd9a813,_0x3194d8[_0xd954('0x52')]);var _0x3778d7={'where':_0xd9a813[_0xd954('0x4c')]};return db[_0xd954('0x3f')][_0xd954('0x30')](_0x3778d7)[_0xd954('0x23')](function(_0xb6622){_0x508ab2['count']=_0xb6622;if(_0x3194d8[_0xd954('0x44')][_0xd954('0x53')]){_0xd9a813['include']=[{'all':!![]}];}return db[_0xd954('0x3f')]['findAll'](_0xd9a813);})[_0xd954('0x23')](function(_0x4e90ea){_0x508ab2[_0xd954('0x54')]=_0x4e90ea;return _0x508ab2;})[_0xd954('0x23')](respondWithFilteredResult(_0x48cd37,_0xd9a813))[_0xd954('0x55')](handleError(_0x48cd37,null));};exports[_0xd954('0x56')]=function(_0x475845,_0x549834){var _0x2ae540={'raw':![],'where':{'id':_0x475845[_0xd954('0x57')]['id']},'include':[{'model':db[_0xd954('0x58')],'as':_0xd954('0x3d')}]},_0x43680f={};_0x43680f[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0x3f')][_0xd954('0x59')]);_0x43680f[_0xd954('0x44')]=_[_0xd954('0x43')](_0x475845[_0xd954('0x44')]);_0x43680f[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x43680f[_0xd954('0x42')],_0x43680f['query']);_0x2ae540[_0xd954('0x46')]=_[_0xd954('0x45')](_0x43680f[_0xd954('0x42')],qs[_0xd954('0x47')](_0x475845[_0xd954('0x44')]['fields']));_0x2ae540['attributes']=_0x2ae540[_0xd954('0x46')]['length']?_0x2ae540['attributes']:_0x43680f[_0xd954('0x42')];if(_0x475845[_0xd954('0x44')][_0xd954('0x53')]){_0x2ae540['include']=[{'all':!![]}];}_0x2ae540=_[_0xd954('0x4f')]({},_0x2ae540,_0x475845[_0xd954('0x52')]);return db[_0xd954('0x3f')][_0xd954('0x5a')](_0x2ae540)[_0xd954('0x23')](handleEntityNotFound(_0x549834,null))[_0xd954('0x23')](respondWithResult(_0x549834,null))['catch'](handleError(_0x549834,null));};exports[_0xd954('0x5b')]=function(_0xaa3ca8,_0x44e448){return db[_0xd954('0x3f')][_0xd954('0x5b')](_0xaa3ca8[_0xd954('0x5c')],{})[_0xd954('0x23')](function(_0x3e6770){var _0x299fbb=_0xaa3ca8['user']['get']({'plain':!![]});if(!_0x299fbb)throw new Error(_0xd954('0x5d'));if(_0x299fbb[_0xd954('0x5e')]===_0xd954('0x5f')){var _0x34941f=_0x3e6770['get']({'plain':!![]});var _0x233d2a=_0xd954('0x60');return db[_0xd954('0x61')][_0xd954('0x5a')]({'where':{'name':_0x233d2a,'userProfileId':_0x299fbb['userProfileId']},'raw':!![]})[_0xd954('0x23')](function(_0x179111){if(_0x179111&&_0x179111[_0xd954('0x62')]===0x0){return db['UserProfileResource'][_0xd954('0x5b')]({'name':_0x34941f[_0xd954('0x3b')],'resourceId':_0x34941f['id'],'type':_0x179111[_0xd954('0x3b')],'sectionId':_0x179111['id']},{})['then'](function(){return _0x3e6770;});}else{return _0x3e6770;}})[_0xd954('0x55')](function(_0x5e680a){logger[_0xd954('0x29')](_0xd954('0x63'),_0x5e680a);throw _0x5e680a;});}return _0x3e6770;})[_0xd954('0x23')](respondWithResult(_0x44e448,0xc9))[_0xd954('0x55')](handleError(_0x44e448,null));};exports['update']=function(_0x4da352,_0x9020e7){if(_0x4da352[_0xd954('0x5c')]['id']){delete _0x4da352['body']['id'];}return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x4da352['params']['id']},'include':[{'model':db['Pause'],'as':_0xd954('0x3d')}]})['then'](handleEntityNotFound(_0x9020e7,null))[_0xd954('0x23')](saveUpdates(_0x4da352[_0xd954('0x5c')],null))[_0xd954('0x23')](respondWithResult(_0x9020e7,null))[_0xd954('0x55')](handleError(_0x9020e7,null));};exports[_0xd954('0x3a')]=function(_0x5537e3,_0x4f2e39){return db['SmsAccount']['find']({'where':{'id':_0x5537e3['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x4f2e39,null))[_0xd954('0x23')](removeEntity(_0x4f2e39,null))[_0xd954('0x55')](handleError(_0x4f2e39,null));};exports[_0xd954('0x64')]=function(_0x4e0e18,_0x34a662){return db[_0xd954('0x3f')]['describe']()[_0xd954('0x23')](respondWithResult(_0x34a662,null))[_0xd954('0x55')](handleError(_0x34a662,null));};exports[_0xd954('0x65')]=function(_0x5c13e1,_0x1de2e8,_0x11ec41){if(_0x5c13e1[_0xd954('0x5c')]['id']){delete _0x5c13e1[_0xd954('0x5c')]['id'];}return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x5c13e1[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x1de2e8,null))[_0xd954('0x23')](function(_0xe725ce){if(_0xe725ce){_0x5c13e1[_0xd954('0x5c')][_0xd954('0x66')]=_0xe725ce['id'];return db[_0xd954('0x67')]['create'](_0x5c13e1[_0xd954('0x5c')]);}})[_0xd954('0x23')](respondWithResult(_0x1de2e8,null))[_0xd954('0x55')](handleError(_0x1de2e8,null));};exports[_0xd954('0x68')]=function(_0x157370,_0x47be25,_0x4de3fd){var _0x381b77={'raw':![],'where':{}};var _0x5e6a66={};var _0x1eb32e={'count':0x0,'rows':[]};return db[_0xd954('0x3f')][_0xd954('0x69')]({'where':{'id':_0x157370[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x47be25,null))[_0xd954('0x23')](function(_0x11cbf2){if(_0x11cbf2){_0x5e6a66['model']=_[_0xd954('0x43')](db[_0xd954('0x67')][_0xd954('0x59')]);_0x5e6a66['query']=_['keys'](_0x157370[_0xd954('0x44')]);_0x5e6a66[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x5e6a66[_0xd954('0x42')],_0x5e6a66[_0xd954('0x44')]);_0x381b77[_0xd954('0x46')]=_['intersection'](_0x5e6a66[_0xd954('0x42')],qs[_0xd954('0x47')](_0x157370[_0xd954('0x44')][_0xd954('0x47')]));_0x381b77[_0xd954('0x46')]=_0x381b77[_0xd954('0x46')][_0xd954('0x48')]?_0x381b77[_0xd954('0x46')]:_0x5e6a66['model'];if(!_0x157370['query'][_0xd954('0x49')](_0xd954('0x4a'))){_0x381b77['limit']=qs[_0xd954('0x32')](_0x157370[_0xd954('0x44')][_0xd954('0x32')]);_0x381b77[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x157370[_0xd954('0x44')][_0xd954('0x31')]);}_0x381b77[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x157370['query'][_0xd954('0x4b')]);_0x381b77['where']=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x157370[_0xd954('0x44')],_0x5e6a66[_0xd954('0x4d')]));_0x381b77['where'][_0xd954('0x66')]=_0x11cbf2['id'];if(_0x157370[_0xd954('0x44')][_0xd954('0x51')]){_0x381b77[_0xd954('0x4c')]=_[_0xd954('0x4f')](_0x381b77[_0xd954('0x4c')],{'$or':_['map'](_0x381b77['attributes'],function(_0x2a46ef){var _0x416979={};_0x416979[_0x2a46ef]={'$like':'%'+_0x157370['query'][_0xd954('0x51')]+'%'};return _0x416979;})});}_0x381b77=_['merge']({},_0x381b77,_0x157370[_0xd954('0x52')]);return db['Disposition']['count']({'where':_0x381b77[_0xd954('0x4c')]})[_0xd954('0x23')](function(_0x2ae150){_0x1eb32e[_0xd954('0x30')]=_0x2ae150;if(_0x157370[_0xd954('0x44')][_0xd954('0x53')]){_0x381b77[_0xd954('0x6b')]=[{'all':!![]}];}return db[_0xd954('0x67')]['findAll'](_0x381b77);})[_0xd954('0x23')](function(_0xdc8534){_0x1eb32e['rows']=_0xdc8534;return _0x1eb32e;});}})[_0xd954('0x23')](respondWithFilteredResult(_0x47be25,_0x381b77))[_0xd954('0x55')](handleError(_0x47be25,null));};exports[_0xd954('0x6c')]=function(_0x516345,_0x1af0c4,_0x1160f8){return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x516345[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x1af0c4,null))[_0xd954('0x23')](function(_0x22ac04){if(_0x22ac04){return _0x22ac04['removeDispositions'](_0x516345[_0xd954('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x1af0c4,null))[_0xd954('0x55')](handleError(_0x1af0c4,null));};exports[_0xd954('0x6d')]=function(_0x4c4641,_0x455270,_0x317deb){if(_0x4c4641[_0xd954('0x5c')]['id']){delete _0x4c4641[_0xd954('0x5c')]['id'];}return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x4c4641['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x455270,null))[_0xd954('0x23')](function(_0x29aaaf){if(_0x29aaaf){_0x4c4641['body'][_0xd954('0x66')]=_0x29aaaf['id'];return db['CannedAnswer'][_0xd954('0x5b')](_0x4c4641[_0xd954('0x5c')]);}})['then'](respondWithResult(_0x455270,null))[_0xd954('0x55')](handleError(_0x455270,null));};exports[_0xd954('0x6e')]=function(_0x1b8c29,_0x36b1a9,_0x567984){var _0xdabd67={'raw':![],'where':{}};var _0xf9756c={};var _0x424e42={'count':0x0,'rows':[]};return db[_0xd954('0x3f')]['findOne']({'where':{'id':_0x1b8c29[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x36b1a9,null))[_0xd954('0x23')](function(_0x3d6ece){if(_0x3d6ece){_0xf9756c[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0x6f')][_0xd954('0x59')]);_0xf9756c[_0xd954('0x44')]=_[_0xd954('0x43')](_0x1b8c29[_0xd954('0x44')]);_0xf9756c[_0xd954('0x4d')]=_[_0xd954('0x45')](_0xf9756c[_0xd954('0x42')],_0xf9756c[_0xd954('0x44')]);_0xdabd67[_0xd954('0x46')]=_[_0xd954('0x45')](_0xf9756c[_0xd954('0x42')],qs[_0xd954('0x47')](_0x1b8c29[_0xd954('0x44')][_0xd954('0x47')]));_0xdabd67[_0xd954('0x46')]=_0xdabd67[_0xd954('0x46')][_0xd954('0x48')]?_0xdabd67[_0xd954('0x46')]:_0xf9756c['model'];if(!_0x1b8c29[_0xd954('0x44')][_0xd954('0x49')]('nolimit')){_0xdabd67[_0xd954('0x32')]=qs[_0xd954('0x32')](_0x1b8c29['query'][_0xd954('0x32')]);_0xdabd67[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x1b8c29[_0xd954('0x44')][_0xd954('0x31')]);}_0xdabd67['order']=qs[_0xd954('0x4b')](_0x1b8c29[_0xd954('0x44')][_0xd954('0x4b')]);_0xdabd67[_0xd954('0x4c')]=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x1b8c29[_0xd954('0x44')],_0xf9756c['filters']));_0xdabd67[_0xd954('0x4c')][_0xd954('0x66')]=_0x3d6ece['id'];if(_0x1b8c29[_0xd954('0x44')]['filter']){_0xdabd67[_0xd954('0x4c')]=_['merge'](_0xdabd67['where'],{'$or':_[_0xd954('0x3e')](_0xdabd67[_0xd954('0x46')],function(_0x1ed87c){var _0x5c739d={};_0x5c739d[_0x1ed87c]={'$like':'%'+_0x1b8c29[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x5c739d;})});}_0xdabd67=_['merge']({},_0xdabd67,_0x1b8c29[_0xd954('0x52')]);return db[_0xd954('0x6f')][_0xd954('0x30')]({'where':_0xdabd67[_0xd954('0x4c')]})[_0xd954('0x23')](function(_0xa2bf92){_0x424e42[_0xd954('0x30')]=_0xa2bf92;if(_0x1b8c29[_0xd954('0x44')][_0xd954('0x53')]){_0xdabd67['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd954('0x70')](_0xdabd67);})['then'](function(_0x8ef4db){_0x424e42[_0xd954('0x54')]=_0x8ef4db;return _0x424e42;});}})['then'](respondWithFilteredResult(_0x36b1a9,_0xdabd67))[_0xd954('0x55')](handleError(_0x36b1a9,null));};exports[_0xd954('0x71')]=function(_0x5c2c9e,_0x434742,_0x36e2a0){return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x5c2c9e[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x434742,null))[_0xd954('0x23')](function(_0x1755b7){if(_0x1755b7){return _0x1755b7[_0xd954('0x71')](_0x5c2c9e['query'][_0xd954('0x72')]);}})[_0xd954('0x23')](respondWithStatusCode(_0x434742,null))['catch'](handleError(_0x434742,null));};exports[_0xd954('0x73')]=function(_0x3fc552,_0x406a52,_0xdf7cc9){var _0xdec31f={'channel':_0xd954('0x74')};var _0x1ef74d=[];var _0x378190=[];var _0x585840={};return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x3fc552[_0xd954('0x57')]['id']},'include':[{'model':db[_0xd954('0x75')],'as':_0xd954('0x76')}]})[_0xd954('0x23')](handleEntityNotFound(_0x406a52,null))['then'](function(_0x50d49b){_0xdec31f[_0xd954('0x77')]=_0x50d49b;_0xdec31f[_0xd954('0x78')]=_[_0xd954('0x79')](_0x50d49b['Applications'],[_0xd954('0x7a')],[_0xd954('0x7b')]);if(_0xdec31f[_0xd954('0x77')][_0xd954('0x76')]){delete _0xdec31f['account'][_0xd954('0x76')];}return db[_0xd954('0x7c')]['describe']();})[_0xd954('0x23')](function(_0x901e7f){if(!_0x901e7f){throw new db[(_0xd954('0x7d'))][(_0xd954('0x7e'))](_0xd954('0x7f'));}_0x1ef74d=_[_0xd954('0x80')](_[_0xd954('0x43')](_0x901e7f),[_0xd954('0x81'),_0xd954('0x82')]);_0x378190=_[_0xd954('0x80')](_[_0xd954('0x43')](_0x901e7f),[_0xd954('0x81'),_0xd954('0x82'),_0xd954('0x83'),_0xd954('0x84')]);_0xdec31f[_0xd954('0x5c')]={'mapKey':'mobile'};if(_0xdec31f['account'][_0xd954('0x41')]){switch(_0xdec31f[_0xd954('0x77')]['type']){case _0xd954('0x85'):_0xdec31f[_0xd954('0x5c')]['from']=_0x3fc552[_0xd954('0x5c')]['From'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x86')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x88')];break;case _0xd954('0x89'):_0xdec31f[_0xd954('0x5c')]['from']='+'+_0x3fc552['body'][_0xd954('0x8a')];_0xdec31f[_0xd954('0x5c')]['body']=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8b')];break;case _0xd954('0x8c'):_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8d')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body']['message'];break;case'clicksend':_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8d')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x5c')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552[_0xd954('0x5c')]['message_id'];break;case _0xd954('0x8e'):_0xdec31f['body']['from']=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8f')];_0xdec31f[_0xd954('0x5c')]['body']=_0x3fc552[_0xd954('0x5c')]['Text'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552['body']['MessageUUID'];break;case'infobip':_0xdec31f['body'][_0xd954('0x8d')]='+'+_0x3fc552['body']['results'][0x0]['from'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x90')][0x0][_0xd954('0x8b')];_0xdec31f[_0xd954('0x5c')]['messageId']=_0x3fc552[_0xd954('0x5c')]['results'][0x0][_0xd954('0x87')];break;case _0xd954('0x91'):_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x92')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x93')][_0xd954('0x2a')];break;case'clickatell':_0xdec31f['body'][_0xd954('0x8d')]=_0x3fc552[_0xd954('0x5c')][_0xd954('0x94')];_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]=_0x3fc552[_0xd954('0x5c')]['text'];_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')]=_0x3fc552['body'][_0xd954('0x95')];break;case'intelepeer':_0xdec31f['body']['from']=_0x3fc552[_0xd954('0x5c')][_0xd954('0x8d')];_0xdec31f['body'][_0xd954('0x5c')]=_0x3fc552['body'][_0xd954('0x2a')];_0xdec31f[_0xd954('0x5c')]['messageId']=_0x3fc552['body'][_0xd954('0x96')];break;}}if(_0xdec31f[_0xd954('0x5c')]['id']){delete _0xdec31f['body']['id'];}if(_[_0xd954('0x97')](_0xdec31f['body'][_0xd954('0x8d')])){throw new db[(_0xd954('0x7d'))][(_0xd954('0x7e'))](_0xd954('0x98'));}if(_[_0xd954('0x97')](_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')])||_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0xd954('0x99'));}if(_[_0xd954('0x97')](_0xdec31f['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xd954('0x9a')+_0x378190);}if(!_[_0xd954('0x9b')](_0x378190,_0xdec31f['body']['mapKey'])){throw new db[(_0xd954('0x7d'))][(_0xd954('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x378190);}_0x585840[_0xdec31f['body'][_0xd954('0x9c')]]=_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')];return db['CmList'][_0xd954('0x5a')]({'where':{'id':_0xdec31f['account']['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x585840,'limit':0x1,'order':[[_0xd954('0x82'),_0xd954('0x9d')]]}]});})[_0xd954('0x23')](handleEntityNotFound(_0x406a52,null))['then'](function(_0x2e1e9b){if(_0x2e1e9b){_0xdec31f[_0xd954('0x9e')]=_['omit'](_0x2e1e9b,['Contacts']);if(_0x2e1e9b[_0xd954('0x9f')][_0xd954('0x48')]){return _0x2e1e9b[_0xd954('0x9f')][0x0];}var _0x154dd9=_[_0xd954('0x1b')](_0xdec31f[_0xd954('0x5c')],{'firstName':_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')],'ListId':_0x2e1e9b['id']});_0x154dd9[_0xdec31f[_0xd954('0x5c')][_0xd954('0x9c')]]=_0xdec31f['body'][_0xd954('0x8d')];return db[_0xd954('0x7c')][_0xd954('0x5b')](_0x154dd9,{'fields':_0x1ef74d,'raw':!![]});}})[_0xd954('0x23')](handleEntityNotFound(_0x406a52,null))[_0xd954('0x23')](function(_0x176cb5){if(_0x176cb5){_0xdec31f[_0xd954('0xa0')]=_0x176cb5;var _0x54691e={'ContactId':_0x176cb5['id'],'phone':_0xdec31f[_0xd954('0x5c')][_0xd954('0x8d')],'SmsAccountId':_0x3fc552[_0xd954('0x57')]['id']};var _0x2e18fd={'ContactId':_0x176cb5['id'],'SmsAccountId':_0x3fc552[_0xd954('0x57')]['id'],'closed':![]};return db[_0xd954('0xa1')][_0xd954('0x5a')]({'where':_0x2e18fd})['then'](function(_0x5a286d){if(_0x5a286d){return[_0x5a286d,![]];}return db[_0xd954('0xa1')]['create'](_0x54691e)[_0xd954('0x23')](function(_0x2038ee){return[_0x2038ee,!![]];});});}})[_0xd954('0xa2')](function(_0x3651ca,_0x4ceb78){_0xdec31f[_0xd954('0xa3')]=_0x3651ca[_0xd954('0x38')]({'plain':!![]});_0xdec31f[_0xd954('0xa3')]['created']=![];if(_0x4ceb78){if(_0xdec31f['account'][_0xd954('0xa4')]){_0xdec31f[_0xd954('0x78')][_0xd954('0xa5')]({'id':0x0,'priority':_0xdec31f[_0xd954('0x78')]['length']+0x1,'app':_0xd954('0xa6'),'appdata':_0xd954('0xa7'),'interval':_0xd954('0xa8')});}_0xdec31f[_0xd954('0xa3')]['created']=!![];}return db[_0xd954('0xa9')][_0xd954('0x5b')]({'phone':_0xdec31f[_0xd954('0x5c')]['from'],'messageId':_0xdec31f[_0xd954('0x5c')][_0xd954('0x87')],'body':_0xdec31f[_0xd954('0x5c')][_0xd954('0x5c')],'SmsAccountId':_0x3fc552[_0xd954('0x57')]['id'],'SmsInteractionId':_0x3651ca['id'],'direction':'in','ContactId':_0x3651ca['ContactId'],'AttachmentId':_0xdec31f['body'][_0xd954('0xaa')]});})['then'](function(_0x29b7e0){_0xdec31f[_0xd954('0x2a')]=_0x29b7e0;if(_0xdec31f[_0xd954('0xa3')][_0xd954('0xab')]){return db[_0xd954('0xac')]['find']({'attributes':['id',_0xd954('0x3b')],'where':{'id':_0xdec31f[_0xd954('0xa3')]['UserId']}})[_0xd954('0x23')](function(_0x16badd){if(_0x16badd){_0xdec31f[_0xd954('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd954('0xad'),'appdata':_0x16badd[_0xd954('0x3b')]+','+(_0xdec31f[_0xd954('0x77')][_0xd954('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd954('0xaf'),_0xdec31f);});}return respondWithRpcPromise(_0xd954('0xb0'),_0xd954('0xaf'),_0xdec31f);})[_0xd954('0x23')](function(_0x31db22){if(_0x31db22){var _0x5c269c=0xc8;var _0x36c11c='receiveMessage';logger[_0xd954('0x24')](_0xd954('0x27'),_0x36c11c,_0x5c269c,_0xd954('0xb1'));logger[_0xd954('0xb2')](_0xd954('0xb3'),_0x36c11c,_0x5c269c,'entity\x20found',JSON[_0xd954('0x28')](_0x31db22));if(_0xdec31f[_0xd954('0x77')][_0xd954('0x41')]===_0xd954('0x85')){return _0x406a52[_0xd954('0x2d')](_0x5c269c)[_0xd954('0x33')]('Content-Type',_0xd954('0xb4'))[_0xd954('0xb5')](_0xd954('0xb6'));}else{return _0x406a52[_0xd954('0x2d')](_0x5c269c)['json'](_0x31db22);}}})[_0xd954('0x55')](handleError(_0x406a52,null));};exports[_0xd954('0xb7')]=function(_0x21eaf9,_0x485881,_0x265b9d){return db['SmsAccount'][_0xd954('0x69')]({'where':{'id':_0x21eaf9[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x485881,null))[_0xd954('0x23')](function(_0x3faf4b){if(_0x3faf4b){return db[_0xd954('0xb8')][_0xd954('0xb9')](function(_0x49bb9d){return db[_0xd954('0x75')]['destroy']({'where':{'SmsAccountId':_0x21eaf9[_0xd954('0x57')]['id']},'transaction':_0x49bb9d})[_0xd954('0x23')](function(_0x5778f5){var _0x2a1251=_[_0xd954('0x3e')](_0x21eaf9[_0xd954('0x5c')],function(_0x1fb08c){_0x1fb08c[_0xd954('0x66')]=_0x21eaf9[_0xd954('0x57')]['id'];return _0x1fb08c;});return db[_0xd954('0x75')][_0xd954('0xba')](_0x2a1251,{'transaction':_0x49bb9d});});})[_0xd954('0x23')](function(){return db[_0xd954('0x75')][_0xd954('0xbb')]({'where':{'SmsAccountId':_0x21eaf9[_0xd954('0x57')]['id']},'order':_0xd954('0x7a')});});}})['then'](respondWithResult(_0x485881,null))[_0xd954('0x55')](handleError(_0x485881,null));};exports[_0xd954('0xbc')]=function(_0x2ff91e,_0x4f6303,_0x3120ca){var _0x5f15b7={};var _0x41179f={};var _0x4f611b;var _0x2e1b24;return db[_0xd954('0x3f')]['findOne']({'where':{'id':_0x2ff91e['params']['id']}})['then'](handleEntityNotFound(_0x4f6303,null))[_0xd954('0x23')](function(_0x855881){if(_0x855881){_0x4f611b=_0x855881;_0x41179f[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0x75')][_0xd954('0x59')]);_0x41179f[_0xd954('0x44')]=_[_0xd954('0x43')](_0x2ff91e[_0xd954('0x44')]);_0x41179f[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x41179f[_0xd954('0x42')],_0x41179f[_0xd954('0x44')]);_0x5f15b7[_0xd954('0x46')]=_[_0xd954('0x45')](_0x41179f['model'],qs[_0xd954('0x47')](_0x2ff91e[_0xd954('0x44')][_0xd954('0x47')]));_0x5f15b7[_0xd954('0x46')]=_0x5f15b7[_0xd954('0x46')]['length']?_0x5f15b7[_0xd954('0x46')]:_0x41179f['model'];_0x5f15b7[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x2ff91e[_0xd954('0x44')][_0xd954('0x4b')]);_0x5f15b7[_0xd954('0x4c')]=qs['filters'](_[_0xd954('0x4e')](_0x2ff91e[_0xd954('0x44')],_0x41179f[_0xd954('0x4d')]));if(_0x2ff91e[_0xd954('0x44')][_0xd954('0x51')]){_0x5f15b7[_0xd954('0x4c')]=_['merge'](_0x5f15b7[_0xd954('0x4c')],{'$or':_[_0xd954('0x3e')](_0x5f15b7[_0xd954('0x46')],function(_0x2bf3df){var _0x2d4bbd={};_0x2d4bbd[_0x2bf3df]={'$like':'%'+_0x2ff91e[_0xd954('0x44')]['filter']+'%'};return _0x2d4bbd;})});}_0x5f15b7=_['merge']({},_0x5f15b7,_0x2ff91e[_0xd954('0x52')]);return _0x4f611b[_0xd954('0xbc')](_0x5f15b7);}})['then'](function(_0x24f66a){if(_0x24f66a){_0x2e1b24=_0x24f66a[_0xd954('0x48')];if(!_0x2ff91e[_0xd954('0x44')]['hasOwnProperty'](_0xd954('0x4a'))){_0x5f15b7[_0xd954('0x32')]=qs[_0xd954('0x32')](_0x2ff91e['query']['limit']);_0x5f15b7[_0xd954('0x31')]=qs['offset'](_0x2ff91e[_0xd954('0x44')][_0xd954('0x31')]);}return _0x4f611b[_0xd954('0xbc')](_0x5f15b7);}})[_0xd954('0x23')](function(_0x967de0){if(_0x967de0){return _0x967de0?{'count':_0x2e1b24,'rows':_0x967de0}:null;}})[_0xd954('0x23')](respondWithResult(_0x4f6303,null))['catch'](handleError(_0x4f6303,null));};exports[_0xd954('0xbd')]=function(_0x41bd0d,_0x58ad00,_0x3723fc){var _0x1bd136={'raw':![],'where':{}};var _0x4d62dd={};var _0x4dfd7e={'count':0x0,'rows':[]};return db[_0xd954('0x3f')][_0xd954('0x69')]({'where':{'id':_0x41bd0d['params']['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x58ad00,null))[_0xd954('0x23')](function(_0x5e926b){if(_0x5e926b){_0x4d62dd['model']=_[_0xd954('0x43')](db['SmsInteraction'][_0xd954('0x59')]);_0x4d62dd[_0xd954('0x44')]=_['keys'](_0x41bd0d[_0xd954('0x44')]);_0x4d62dd['filters']=_[_0xd954('0x45')](_0x4d62dd[_0xd954('0x42')],_0x4d62dd[_0xd954('0x44')]);_0x1bd136[_0xd954('0x46')]=_[_0xd954('0x45')](_0x4d62dd[_0xd954('0x42')],qs[_0xd954('0x47')](_0x41bd0d[_0xd954('0x44')][_0xd954('0x47')]));_0x1bd136[_0xd954('0x46')]=_0x1bd136[_0xd954('0x46')][_0xd954('0x48')]?_0x1bd136['attributes']:_0x4d62dd[_0xd954('0x42')];if(!_0x41bd0d[_0xd954('0x44')][_0xd954('0x49')](_0xd954('0x4a'))){_0x1bd136[_0xd954('0x32')]=qs[_0xd954('0x32')](_0x41bd0d[_0xd954('0x44')]['limit']);_0x1bd136[_0xd954('0x31')]=qs[_0xd954('0x31')](_0x41bd0d[_0xd954('0x44')][_0xd954('0x31')]);}_0x1bd136[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x41bd0d[_0xd954('0x44')][_0xd954('0x4b')]);_0x1bd136['where']=qs['filters'](_[_0xd954('0x4e')](_0x41bd0d[_0xd954('0x44')],_0x4d62dd[_0xd954('0x4d')]));_0x1bd136['where'][_0xd954('0x66')]=_0x5e926b['id'];if(_0x41bd0d[_0xd954('0x44')][_0xd954('0x51')]){_0x1bd136['where']=_['merge'](_0x1bd136[_0xd954('0x4c')],{'$or':_[_0xd954('0x3e')](_0x1bd136[_0xd954('0x46')],function(_0x45b790){var _0x57df99={};_0x57df99[_0x45b790]={'$like':'%'+_0x41bd0d[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x57df99;})});}_0x1bd136=_[_0xd954('0x4f')]({},_0x1bd136,_0x41bd0d[_0xd954('0x52')]);return db[_0xd954('0xa1')]['count']({'where':_0x1bd136[_0xd954('0x4c')]})['then'](function(_0x112c9c){_0x4dfd7e['count']=_0x112c9c;if(_0x41bd0d['query'][_0xd954('0x53')]){_0x1bd136[_0xd954('0x6b')]=[{'model':db['CmContact'],'as':_0xd954('0xbe'),'required':![]},{'model':db[_0xd954('0xac')],'as':_0xd954('0xbf'),'attributes':[_0xd954('0x3b'),_0xd954('0xc0'),'internal'],'required':![]},{'model':db[_0xd954('0xc1')],'as':_0xd954('0xc2'),'attributes':['id','name','color'],'where':_0x41bd0d[_0xd954('0x44')][_0xd954('0xc3')]?{'id':_0x41bd0d[_0xd954('0x44')][_0xd954('0xc3')]}:undefined,'required':_0x41bd0d['query'][_0xd954('0xc3')]?!![]:![]}];}return db['SmsInteraction'][_0xd954('0x70')](_0x1bd136);})['then'](function(_0x27dc0b){_0x4dfd7e[_0xd954('0x54')]=_0x27dc0b;return _0x4dfd7e;});}})[_0xd954('0x23')](respondWithFilteredResult(_0x58ad00,_0x1bd136))[_0xd954('0x55')](handleError(_0x58ad00,null));};exports[_0xd954('0xb5')]=function(_0x29067a,_0xbd011f,_0x289e8c){var _0x262c81,_0x45d918,_0x2ab1e3;if(_['isNil'](_0x29067a['body'][_0xd954('0x5c')])||_0x29067a[_0xd954('0x5c')][_0xd954('0x5c')]===''){throw new db['Sequelize'][(_0xd954('0x7e'))](_0xd954('0x99'));}if(_['isNil'](_0x29067a['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xd954('0xc4'));}_0x262c81=_0x29067a[_0xd954('0x5c')]['to'];return db[_0xd954('0x3f')]['find']({'where':{'id':_0x29067a[_0xd954('0x57')]['id']},'include':[{'model':db[_0xd954('0xc5')],'as':_0xd954('0xc6'),'include':[{'model':db[_0xd954('0x7c')],'as':'Contacts','where':{'mobile':_0x262c81},'limit':0x1,'order':[[_0xd954('0x82'),_0xd954('0x9d')]]}]}]})[_0xd954('0x23')](handleEntityNotFound(_0xbd011f,null))['then'](function(_0x20f8e7){if(_0x20f8e7&&_0x20f8e7[_0xd954('0xc6')]){_0x45d918=_0x20f8e7['get']({'plain':!![]});if(_0x45d918['List']&&_0x45d918[_0xd954('0xc6')][_0xd954('0x9f')]['length']){return _0x45d918[_0xd954('0xc6')]['Contacts'][0x0];}return db[_0xd954('0x7c')][_0xd954('0x5b')](_[_0xd954('0x1b')](_0x29067a[_0xd954('0x5c')],{'firstName':_0x262c81,'mobile':_0x262c81,'phone':_0x262c81,'ListId':_0x45d918[_0xd954('0x84')]}));}})[_0xd954('0x23')](handleEntityNotFound(_0xbd011f,null))[_0xd954('0x23')](function(_0x7b16aa){if(_0x7b16aa){_0x2ab1e3=_0x7b16aa;return db[_0xd954('0xa1')][_0xd954('0x5a')]({'where':{'ContactId':_0x2ab1e3['id'],'closed':![],'SmsAccountId':_0x45d918['id']}})['then'](function(_0x3cb056){if(_0x3cb056){return[_0x3cb056,![]];}return db[_0xd954('0xa1')][_0xd954('0x5b')]({'UserId':_0x29067a[_0xd954('0x5f')]['id'],'ContactId':_0x2ab1e3['id'],'SmsAccountId':_0x45d918['id'],'phone':_0x262c81,'firstMsgDirection':_0xd954('0xc7'),'Messages':[_['merge'](_0x29067a[_0xd954('0x5c')],{'read':![],'body':_0x29067a['body'][_0xd954('0x5c')],'phone':_0x262c81,'SmsAccountId':_0x45d918['id'],'UserId':_0x29067a[_0xd954('0x5f')]['id'],'ContactId':_0x2ab1e3['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd954('0xc8')}]})[_0xd954('0x23')](function(_0x1b56e2){return[_0x1b56e2,!![]];});});}})[_0xd954('0xa2')](function(_0x5ed38c,_0x493934){if(_0x493934){return _0x5ed38c;}return db[_0xd954('0xa9')][_0xd954('0x5b')](_[_0xd954('0x4f')](_0x29067a[_0xd954('0x5c')],{'read':![],'body':_0x29067a[_0xd954('0x5c')][_0xd954('0x5c')],'phone':_0x262c81,'SmsAccountId':_0x45d918['id'],'SmsInteractionId':_0x5ed38c['id'],'UserId':_0x29067a['user']['id'],'ContactId':_0x2ab1e3['id']}))['then'](function(_0xc54d6d){_0x5ed38c['dataValues'][_0xd954('0xc8')]=[];_0x5ed38c['dataValues']['Messages'][_0xd954('0xa5')](_0xc54d6d[_0xd954('0xc9')]);return _0x5ed38c;});})[_0xd954('0x23')](respondWithResult(_0xbd011f,null))['catch'](handleError(_0xbd011f,null));};exports[_0xd954('0x2d')]=function(_0x31483b,_0x36e8df,_0x25d26a){if(_0x31483b['body']['id']){delete _0x31483b[_0xd954('0x5c')]['id'];}console[_0xd954('0xca')](_0xd954('0xcb'),_0x31483b[_0xd954('0x5c')]);var _0x5f5239,_0x552bef,_0x3dac64;return db[_0xd954('0x3f')][_0xd954('0x5a')]({'where':{'id':_0x31483b[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x36e8df,null))[_0xd954('0x23')](function(_0x1b74b0){if(_0x1b74b0){_0x3dac64=_0x1b74b0;logger[_0xd954('0xb2')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),_0xd954('0xcc'),_0x1b74b0['type'],util[_0xd954('0xcd')](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));switch(_0x1b74b0[_0xd954('0x41')]){case _0xd954('0x89'):if(_0x31483b[_0xd954('0x5c')]['skebby_dispatch_id']&&_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')]){_0x552bef=_0x31483b['body'][_0xd954('0x2d')];return db['SmsMessage'][_0xd954('0x5a')]({'where':{'messageId':_0x31483b[_0xd954('0x5c')][_0xd954('0xce')]}});}break;case _0xd954('0x8c'):if(_0x31483b['body'][_0xd954('0xcf')]&&_0x31483b[_0xd954('0x5c')][_0xd954('0xd0')]){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0xd0')];return db[_0xd954('0xa9')][_0xd954('0x5a')]({'where':{'messageId':_0x31483b['body'][_0xd954('0xcf')]}});}break;case _0xd954('0xd1'):if(_0x31483b[_0xd954('0x5c')][_0xd954('0xd2')]&&_0x31483b[_0xd954('0x5c')][_0xd954('0xd3')]){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0xd3')];return db[_0xd954('0xa9')][_0xd954('0x5a')]({'where':{'messageId':_0x31483b[_0xd954('0x5c')][_0xd954('0xd2')]}});}break;case _0xd954('0xd4'):var _0x4d28bb=_0x31483b[_0xd954('0x5c')][_0xd954('0x90')][0x0];if(_0x4d28bb[_0xd954('0x87')]&&_0x4d28bb[_0xd954('0x2d')][_0xd954('0xd5')]==='DELIVERED'){_0x552bef=_0x4d28bb[_0xd954('0x2d')][_0xd954('0xd5')];return db[_0xd954('0xa9')]['find']({'where':{'messageId':_0x4d28bb[_0xd954('0x87')]}});}break;case _0xd954('0xd6'):if(_0x31483b[_0xd954('0x5c')][_0xd954('0x87')]&&_0x31483b[_0xd954('0x5c')]['status']){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')];return db['SmsMessage'][_0xd954('0x5a')]({'where':{'messageId':_0x31483b[_0xd954('0x5c')][_0xd954('0x87')]}});}break;case'intelepeer':if(_0x31483b[_0xd954('0x5c')][_0xd954('0xd7')]&&_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')]){_0x552bef=_0x31483b[_0xd954('0x5c')][_0xd954('0x2d')];return db[_0xd954('0xa9')]['find']({'where':{'messageId':_0x31483b['body']['redif']}});}break;}}})[_0xd954('0x23')](handleEntityNotFound(_0x36e8df,null))['then'](function(_0x441e4a){if(_0x441e4a){_0x5f5239=_0x441e4a;switch(_0x3dac64[_0xd954('0x41')]){case'skebby':if(_0x552bef===_0xd954('0xd8')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),_0xd954('0x89'),util[_0xd954('0xcd')](_0x31483b['body'],{'showHidden':![],'depth':null}));}break;case _0xd954('0x8c'):if(_0x552bef==='1'){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xd954('0xcd')](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x31483b[_0xd954('0x5c')][_0xd954('0xd9')]&&_0x552bef>=0xc8&&_0x552bef<=0xce){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),_0xd954('0xd1'),util[_0xd954('0xcd')](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xd954('0xd4'):var _0x394cfa=_0x31483b['body'][_0xd954('0x90')][0x0];if(_0x394cfa['status'][_0xd954('0xd5')]===_0xd954('0xd8')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')](_0xd954('0x27'),_0xd954('0x2d'),_0xd954('0xd4'),util[_0xd954('0xcd')](_0x31483b['body'],{'showHidden':![],'depth':null}));}break;case _0xd954('0xd6'):if(_0x552bef=='DELIVERED_TO_GATEWAY'||_0x552bef==_0xd954('0xda')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')](_0xd954('0x27'),'status',_0xd954('0xd6'),util[_0xd954('0xcd')](_0x31483b['body'],{'showHidden':![],'depth':null}));}break;case _0xd954('0xdb'):if(_0x552bef==='DELIVRD'||_0x552bef===_0xd954('0xdc')){return _0x5f5239[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')](_0xd954('0x27'),_0xd954('0x2d'),_0xd954('0xdb'),util['inspect'](_0x31483b[_0xd954('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x5f5239;}})[_0xd954('0x23')](respondWithResult(_0x36e8df,null))[_0xd954('0x55')](handleError(_0x36e8df,null));};exports['statusGet']=function(_0x3eb191,_0x4962cf,_0x8873b5){var _0x2198b0,_0x17e212,_0x264eca;return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x3eb191[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x4962cf,null))['then'](function(_0x514bc9){if(_0x514bc9){_0x264eca=_0x514bc9;logger['debug'](_0xd954('0x27'),_0xd954('0x2d'),_0xd954('0xcc'),_0x514bc9[_0xd954('0x41')],util[_0xd954('0xcd')](_0x3eb191[_0xd954('0x44')],{'showHidden':![],'depth':null}));switch(_0x514bc9[_0xd954('0x41')]){case'csc':if(_0x3eb191[_0xd954('0x44')][_0xd954('0xdd')]&&_0x3eb191[_0xd954('0x44')][_0xd954('0xde')]){_0x17e212=_0x3eb191[_0xd954('0x44')][_0xd954('0xde')];return db[_0xd954('0xa9')]['find']({'where':{'messageId':_0x3eb191[_0xd954('0x44')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x4962cf,null))[_0xd954('0x23')](function(_0x5b9c26){if(_0x5b9c26){_0x2198b0=_0x5b9c26;switch(_0x264eca[_0xd954('0x41')]){case _0xd954('0x91'):if(_0x17e212==='2'||_0x17e212==='6'){return _0x2198b0[_0xd954('0x37')]({'read':!![]});}else{logger[_0xd954('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd954('0x2d'),'csc',util['inspect'](_0x3eb191['query'],{'showHidden':![],'depth':null}));};break;}return _0x2198b0;}})['then'](respondWithResult(_0x4962cf,null))[_0xd954('0x55')](handleError(_0x4962cf,null));};exports[_0xd954('0xdf')]=function(_0x4f9059,_0x47838c,_0x2a4d0e){return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x4f9059[_0xd954('0x57')]['id']}})[_0xd954('0x23')](handleEntityNotFound(_0x47838c,null))[_0xd954('0x23')](function(_0x2f0b1f){if(_0x2f0b1f){return _0x2f0b1f['addAgents'](_0x4f9059['body']['ids'],_[_0xd954('0xe0')](_0x4f9059[_0xd954('0x5c')],[_0xd954('0x72'),'id'])||{})[_0xd954('0xa2')](function(_0x54a94a){for(var _0x54badc=0x0;_0x54badc<_0x4f9059['body']['ids'][_0xd954('0x48')];_0x54badc+=0x1){socket['emit'](_0xd954('0xe1'),{'UserId':_0x4f9059[_0xd954('0x5c')][_0xd954('0x72')][_0x54badc],'SmsAccountId':_0x4f9059[_0xd954('0x57')]['id']});}return _0x54a94a;});}})[_0xd954('0x23')](respondWithResult(_0x47838c,null))[_0xd954('0x55')](handleError(_0x47838c,null));};exports[_0xd954('0xe2')]=function(_0x419c3a,_0x22c9ce,_0x5968b6){return db['SmsAccount'][_0xd954('0x5a')]({'where':{'id':_0x419c3a[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x22c9ce,null))['then'](function(_0x825df){if(_0x825df){return _0x825df[_0xd954('0xe2')](_0x419c3a['query']['ids'])[_0xd954('0x23')](function(){if(_[_0xd954('0xe3')](_0x419c3a[_0xd954('0x44')][_0xd954('0x72')])){for(var _0x5a2862=0x0;_0x5a2862<_0x419c3a[_0xd954('0x44')][_0xd954('0x72')]['length'];_0x5a2862+=0x1){socket['emit'](_0xd954('0xe4'),{'UserId':Number(_0x419c3a[_0xd954('0x44')][_0xd954('0x72')][_0x5a2862]),'SmsAccountId':Number(_0x419c3a['params']['id'])});}}else{socket[_0xd954('0xe5')](_0xd954('0xe4'),{'UserId':Number(_0x419c3a[_0xd954('0x44')]['ids']),'SmsAccountId':Number(_0x419c3a[_0xd954('0x57')]['id'])});}});}})[_0xd954('0x23')](respondWithStatusCode(_0x22c9ce,null))[_0xd954('0x55')](handleError(_0x22c9ce,null));};exports[_0xd954('0xe6')]=function(_0x4dc4ea,_0x12568a,_0x402997){var _0x511f72={};var _0x409fc5={};var _0xa1601d;var _0x41f132;return db[_0xd954('0x3f')][_0xd954('0x69')]({'where':{'id':_0x4dc4ea[_0xd954('0x57')]['id']}})['then'](handleEntityNotFound(_0x12568a,null))[_0xd954('0x23')](function(_0x4dad31){if(_0x4dad31){_0xa1601d=_0x4dad31;_0x409fc5[_0xd954('0x42')]=_[_0xd954('0x43')](db[_0xd954('0xac')]['rawAttributes']);_0x409fc5['query']=_[_0xd954('0x43')](_0x4dc4ea['query']);_0x409fc5[_0xd954('0x4d')]=_[_0xd954('0x45')](_0x409fc5[_0xd954('0x42')],_0x409fc5[_0xd954('0x44')]);_0x511f72[_0xd954('0x46')]=_[_0xd954('0x45')](_0x409fc5['model'],qs[_0xd954('0x47')](_0x4dc4ea[_0xd954('0x44')][_0xd954('0x47')]));_0x511f72[_0xd954('0x46')]=_0x511f72[_0xd954('0x46')][_0xd954('0x48')]?_0x511f72[_0xd954('0x46')]:_0x409fc5['model'];_0x511f72[_0xd954('0x6a')]=qs[_0xd954('0x4b')](_0x4dc4ea[_0xd954('0x44')]['sort']);_0x511f72[_0xd954('0x4c')]=qs[_0xd954('0x4d')](_[_0xd954('0x4e')](_0x4dc4ea[_0xd954('0x44')],_0x409fc5['filters']));if(_0x4dc4ea[_0xd954('0x44')][_0xd954('0x51')]){_0x511f72[_0xd954('0x4c')]=_['merge'](_0x511f72[_0xd954('0x4c')],{'$or':_[_0xd954('0x3e')](_0x511f72[_0xd954('0x46')],function(_0x23225e){var _0x522db0={};_0x522db0[_0x23225e]={'$like':'%'+_0x4dc4ea[_0xd954('0x44')][_0xd954('0x51')]+'%'};return _0x522db0;})});}_0x511f72=_[_0xd954('0x4f')]({},_0x511f72,_0x4dc4ea[_0xd954('0x52')]);return _0xa1601d[_0xd954('0xe6')](_0x511f72);}})[_0xd954('0x23')](function(_0x479552){if(_0x479552){_0x41f132=_0x479552[_0xd954('0x48')];if(!_0x4dc4ea['query'][_0xd954('0x49')]('nolimit')){_0x511f72['limit']=qs['limit'](_0x4dc4ea[_0xd954('0x44')]['limit']);_0x511f72['offset']=qs[_0xd954('0x31')](_0x4dc4ea['query'][_0xd954('0x31')]);}return _0xa1601d['getAgents'](_0x511f72);}})[_0xd954('0x23')](function(_0x1e9648){if(_0x1e9648){return _0x1e9648?{'count':_0x41f132,'rows':_0x1e9648}:null;}})[_0xd954('0x23')](respondWithResult(_0x12568a,null))[_0xd954('0x55')](handleError(_0x12568a,null));}; \ No newline at end of file +var _0xabd6=['catch','sendStatus','status','end','count','offset','json','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','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','describe','addDisposition','SmsAccountId','Disposition','getDispositions','length','hasOwnProperty','nolimit','removeDispositions','ids','getAnswers','findOne','CannedAnswer','rows','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','from','Body','MessageSid','skebby','text','connectel','messageId','message_id','From','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','List','DESC','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','csc','message-id','state','addAgents','omit','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../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','./smsAccount.socket','register','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'];(function(_0x2da630,_0x2614db){var _0x1d88d1=function(_0x4ebcd1){while(--_0x4ebcd1){_0x2da630['push'](_0x2da630['shift']());}};_0x1d88d1(++_0x2614db);}(_0xabd6,0xb2));var _0x6abd=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xabd6[_0x2d3ab3];return _0x321f9e;};'use strict';var pdf=require(_0x6abd('0x0'));var emlformat=require(_0x6abd('0x1'));var rimraf=require(_0x6abd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6abd('0x3'));var rp=require(_0x6abd('0x4'));var moment=require('moment');var BPromise=require(_0x6abd('0x5'));var Mustache=require('mustache');var util=require(_0x6abd('0x6'));var path=require(_0x6abd('0x7'));var sox=require(_0x6abd('0x8'));var csv=require('to-csv');var ejs=require(_0x6abd('0x9'));var fs=require('fs');var _=require(_0x6abd('0xa'));var squel=require(_0x6abd('0xb'));var crypto=require(_0x6abd('0xc'));var jsforce=require(_0x6abd('0xd'));var deskjs=require(_0x6abd('0xe'));var toCsv=require(_0x6abd('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6abd('0x10'));var qs=require(_0x6abd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6abd('0x12'));var logger=require(_0x6abd('0x13'))(_0x6abd('0x14'));var utils=require(_0x6abd('0x15'));var config=require(_0x6abd('0x16'));var licenseUtil=require(_0x6abd('0x17'));var db=require('../../mysqldb')['db'];config[_0x6abd('0x18')]=_[_0x6abd('0x19')](config[_0x6abd('0x18')],{'host':_0x6abd('0x1a'),'port':0x18eb});var socket=require(_0x6abd('0x1b'))(new Redis(config['redis']));require(_0x6abd('0x1c'))[_0x6abd('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6abd('0x1e')][_0x6abd('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4ccd95,_0x346a5e,_0x438882,_0x488846){return new BPromise(function(_0x5973b1,_0x373a46){var _0x58f69c=_0x488846||client;return _0x58f69c[_0x6abd('0x20')](_0x4ccd95,_0x438882)[_0x6abd('0x21')](function(_0x1bdf69){logger[_0x6abd('0x22')]('SmsAccount,\x20%s,\x20%s',_0x346a5e,_0x6abd('0x23'));logger[_0x6abd('0x24')](_0x6abd('0x25'),_0x346a5e,_0x6abd('0x23'),JSON[_0x6abd('0x26')](_0x1bdf69));if(_0x1bdf69[_0x6abd('0x27')]){if(_0x1bdf69[_0x6abd('0x27')][_0x6abd('0x28')]===0x1f4){logger[_0x6abd('0x27')](_0x6abd('0x29'),_0x346a5e,_0x1bdf69[_0x6abd('0x27')]['message']);return _0x373a46(_0x1bdf69[_0x6abd('0x27')][_0x6abd('0x2a')]);}logger[_0x6abd('0x27')](_0x6abd('0x29'),_0x346a5e,_0x1bdf69[_0x6abd('0x27')][_0x6abd('0x2a')]);return _0x5973b1(_0x1bdf69['error'][_0x6abd('0x2a')]);}else{logger['info'](_0x6abd('0x29'),_0x346a5e,_0x6abd('0x23'));_0x5973b1(_0x1bdf69[_0x6abd('0x2b')][_0x6abd('0x2a')]);}})[_0x6abd('0x2c')](function(_0x244d84){logger[_0x6abd('0x27')](_0x6abd('0x29'),_0x346a5e,_0x244d84);_0x373a46(_0x244d84);});});}function respondWithStatusCode(_0x14e90c,_0x10aecf){_0x10aecf=_0x10aecf||0xcc;return function(_0x261732){if(_0x261732){return _0x14e90c[_0x6abd('0x2d')](_0x10aecf);}return _0x14e90c[_0x6abd('0x2e')](_0x10aecf)[_0x6abd('0x2f')]();};}function respondWithResult(_0x1315d7,_0x20ed1f){_0x20ed1f=_0x20ed1f||0xc8;return function(_0x1c7cea){if(_0x1c7cea){return _0x1315d7[_0x6abd('0x2e')](_0x20ed1f)['json'](_0x1c7cea);}};}function respondWithFilteredResult(_0x1f187c,_0x585c9a){return function(_0x2b340a){if(_0x2b340a){var _0x1098ee=_0x2b340a[_0x6abd('0x30')],_0x451ad8=_0x585c9a['offset'],_0x526e25=_0x585c9a[_0x6abd('0x31')]+_0x585c9a['limit'],_0x428bbf;if(_0x526e25>=_0x1098ee){_0x526e25=_0x1098ee;_0x428bbf=0xc8;}else{_0x428bbf=0xce;}_0x1f187c['status'](_0x428bbf);return _0x1f187c['set']('Content-Range',_0x451ad8+'-'+_0x526e25+'/'+_0x1098ee)[_0x6abd('0x32')](_0x2b340a);}return null;};}function patchUpdates(_0x396bcf){return function(_0x2353ea){try{jsonpatch[_0x6abd('0x33')](_0x2353ea,_0x396bcf,!![]);}catch(_0x5b50a5){return BPromise['reject'](_0x5b50a5);}return _0x2353ea[_0x6abd('0x34')]();};}function saveUpdates(_0x15d649,_0x1ebb8f){return function(_0x16a1e6){if(_0x16a1e6){return _0x16a1e6[_0x6abd('0x35')](_0x15d649)['then'](function(_0x11e7b5){return _0x11e7b5;});}return null;};}function removeEntity(_0x51131c,_0x33c61b){return function(_0x1e74b5){if(_0x1e74b5){return _0x1e74b5[_0x6abd('0x36')]()[_0x6abd('0x21')](function(){var _0x5d0f96=_0x1e74b5[_0x6abd('0x37')]({'plain':!![]});var _0x2d9529=_0x6abd('0x38');return db[_0x6abd('0x39')][_0x6abd('0x36')]({'where':{'type':_0x2d9529,'resourceId':_0x5d0f96['id']}})[_0x6abd('0x21')](function(){return _0x1e74b5;});})[_0x6abd('0x21')](function(){_0x51131c[_0x6abd('0x2e')](0xcc)[_0x6abd('0x2f')]();});}};}function handleEntityNotFound(_0x56acee,_0x37def2){return function(_0x539ec4){if(!_0x539ec4){_0x56acee[_0x6abd('0x2d')](0x194);}return _0x539ec4;};}function handleError(_0x2f8a87,_0x293e70){_0x293e70=_0x293e70||0x1f4;return function(_0x1e6c1b){logger['error'](_0x1e6c1b[_0x6abd('0x3a')]);if(_0x1e6c1b[_0x6abd('0x3b')]){delete _0x1e6c1b['name'];}_0x2f8a87[_0x6abd('0x2e')](_0x293e70)['send'](_0x1e6c1b);};}exports['index']=function(_0x6b9ac8,_0x354729){var _0x509238={'include':[{'model':db[_0x6abd('0x3c')],'as':_0x6abd('0x3d')}]},_0x4a1e5e={},_0x18f7b5={'count':0x0,'rows':[]};var _0x2ef619=_[_0x6abd('0x3e')](db[_0x6abd('0x3f')][_0x6abd('0x40')],function(_0x4a6fb2){return{'name':_0x4a6fb2[_0x6abd('0x41')],'type':_0x4a6fb2[_0x6abd('0x42')][_0x6abd('0x43')]};});_0x4a1e5e[_0x6abd('0x44')]=_[_0x6abd('0x3e')](_0x2ef619,_0x6abd('0x3b'));_0x4a1e5e['query']=_[_0x6abd('0x45')](_0x6b9ac8[_0x6abd('0x46')]);_0x4a1e5e['filters']=_['intersection'](_0x4a1e5e[_0x6abd('0x44')],_0x4a1e5e[_0x6abd('0x46')]);_0x509238[_0x6abd('0x47')]=_[_0x6abd('0x48')](_0x4a1e5e['model'],qs[_0x6abd('0x49')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x49')]));_0x509238[_0x6abd('0x47')]=_0x509238['attributes']['length']?_0x509238[_0x6abd('0x47')]:_0x4a1e5e[_0x6abd('0x44')];if(!_0x6b9ac8[_0x6abd('0x46')]['hasOwnProperty']('nolimit')){_0x509238[_0x6abd('0x4a')]=qs[_0x6abd('0x4a')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x4a')]);_0x509238[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x31')]);}_0x509238[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x509238[_0x6abd('0x4d')]=qs['filters'](_[_0x6abd('0x4e')](_0x6b9ac8[_0x6abd('0x46')],_0x4a1e5e[_0x6abd('0x4f')]),_0x2ef619);if(_0x6b9ac8['query']['filter']){_0x509238[_0x6abd('0x4d')]=_[_0x6abd('0x50')](_0x509238[_0x6abd('0x4d')],{'$or':_[_0x6abd('0x3e')](_0x2ef619,function(_0x1ac5e4){if(_0x1ac5e4[_0x6abd('0x42')]!==_0x6abd('0x51')){var _0x350032={};_0x350032[_0x1ac5e4[_0x6abd('0x3b')]]={'$like':'%'+_0x6b9ac8[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x350032;}})});}_0x509238=_[_0x6abd('0x50')]({},_0x509238,_0x6b9ac8[_0x6abd('0x53')]);var _0xf93919={'where':_0x509238[_0x6abd('0x4d')]};return db[_0x6abd('0x3f')][_0x6abd('0x30')](_0xf93919)['then'](function(_0x462dc9){_0x18f7b5[_0x6abd('0x30')]=_0x462dc9;if(_0x6b9ac8['query'][_0x6abd('0x54')]){_0x509238[_0x6abd('0x55')]=[{'all':!![]}];}return db['SmsAccount'][_0x6abd('0x56')](_0x509238);})['then'](function(_0x59476e){_0x18f7b5['rows']=_0x59476e;return _0x18f7b5;})[_0x6abd('0x21')](respondWithFilteredResult(_0x354729,_0x509238))['catch'](handleError(_0x354729,null));};exports['show']=function(_0x19a799,_0x5cbbc8){var _0x1da621={'raw':![],'where':{'id':_0x19a799[_0x6abd('0x57')]['id']},'include':[{'model':db[_0x6abd('0x3c')],'as':_0x6abd('0x3d')}]},_0x4b62af={};_0x4b62af[_0x6abd('0x44')]=_[_0x6abd('0x45')](db[_0x6abd('0x3f')][_0x6abd('0x40')]);_0x4b62af[_0x6abd('0x46')]=_['keys'](_0x19a799[_0x6abd('0x46')]);_0x4b62af[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x4b62af[_0x6abd('0x44')],_0x4b62af[_0x6abd('0x46')]);_0x1da621[_0x6abd('0x47')]=_['intersection'](_0x4b62af[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x19a799[_0x6abd('0x46')][_0x6abd('0x49')]));_0x1da621[_0x6abd('0x47')]=_0x1da621[_0x6abd('0x47')]['length']?_0x1da621[_0x6abd('0x47')]:_0x4b62af[_0x6abd('0x44')];if(_0x19a799[_0x6abd('0x46')][_0x6abd('0x54')]){_0x1da621[_0x6abd('0x55')]=[{'all':!![]}];}_0x1da621=_[_0x6abd('0x50')]({},_0x1da621,_0x19a799[_0x6abd('0x53')]);return db[_0x6abd('0x3f')][_0x6abd('0x58')](_0x1da621)[_0x6abd('0x21')](handleEntityNotFound(_0x5cbbc8,null))[_0x6abd('0x21')](respondWithResult(_0x5cbbc8,null))[_0x6abd('0x2c')](handleError(_0x5cbbc8,null));};exports['create']=function(_0x123448,_0x5ec24f){return db['SmsAccount'][_0x6abd('0x59')](_0x123448[_0x6abd('0x5a')],{})[_0x6abd('0x21')](function(_0x2aed6){var _0x4b7ff7=_0x123448[_0x6abd('0x5b')][_0x6abd('0x37')]({'plain':!![]});if(!_0x4b7ff7)throw new Error(_0x6abd('0x5c'));if(_0x4b7ff7['role']===_0x6abd('0x5b')){var _0x3f4346=_0x2aed6[_0x6abd('0x37')]({'plain':!![]});var _0x4314e3='SmsAccounts';return db[_0x6abd('0x5d')][_0x6abd('0x58')]({'where':{'name':_0x4314e3,'userProfileId':_0x4b7ff7[_0x6abd('0x5e')]},'raw':!![]})[_0x6abd('0x21')](function(_0x40c3eb){if(_0x40c3eb&&_0x40c3eb[_0x6abd('0x5f')]===0x0){return db[_0x6abd('0x39')][_0x6abd('0x59')]({'name':_0x3f4346['name'],'resourceId':_0x3f4346['id'],'type':_0x40c3eb['name'],'sectionId':_0x40c3eb['id']},{})[_0x6abd('0x21')](function(){return _0x2aed6;});}else{return _0x2aed6;}})[_0x6abd('0x2c')](function(_0x95b63a){logger['error'](_0x6abd('0x60'),_0x95b63a);throw _0x95b63a;});}return _0x2aed6;})[_0x6abd('0x21')](respondWithResult(_0x5ec24f,0xc9))[_0x6abd('0x2c')](handleError(_0x5ec24f,null));};exports['update']=function(_0x37987f,_0x19526c){if(_0x37987f[_0x6abd('0x5a')]['id']){delete _0x37987f[_0x6abd('0x5a')]['id'];}return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x37987f['params']['id']},'include':[{'model':db[_0x6abd('0x3c')],'as':_0x6abd('0x3d')}]})['then'](handleEntityNotFound(_0x19526c,null))[_0x6abd('0x21')](saveUpdates(_0x37987f[_0x6abd('0x5a')],null))[_0x6abd('0x21')](respondWithResult(_0x19526c,null))['catch'](handleError(_0x19526c,null));};exports[_0x6abd('0x36')]=function(_0x271f77,_0x353f43){return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x271f77[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0x353f43,null))['then'](removeEntity(_0x353f43,null))[_0x6abd('0x2c')](handleError(_0x353f43,null));};exports[_0x6abd('0x61')]=function(_0x152299,_0x2a9f41){return db[_0x6abd('0x3f')]['describe']()['then'](respondWithResult(_0x2a9f41,null))[_0x6abd('0x2c')](handleError(_0x2a9f41,null));};exports[_0x6abd('0x62')]=function(_0x1e3ee7,_0x634b62,_0x51b206){if(_0x1e3ee7[_0x6abd('0x5a')]['id']){delete _0x1e3ee7['body']['id'];}return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x1e3ee7[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0x634b62,null))[_0x6abd('0x21')](function(_0xfe0683){if(_0xfe0683){_0x1e3ee7[_0x6abd('0x5a')][_0x6abd('0x63')]=_0xfe0683['id'];return db[_0x6abd('0x64')][_0x6abd('0x59')](_0x1e3ee7[_0x6abd('0x5a')]);}})[_0x6abd('0x21')](respondWithResult(_0x634b62,null))[_0x6abd('0x2c')](handleError(_0x634b62,null));};exports[_0x6abd('0x65')]=function(_0x1d5630,_0x5ddb2d,_0x55ce55){var _0x436a96={'raw':![],'where':{}};var _0x4c1176={};var _0x2b9ef2={'count':0x0,'rows':[]};return db[_0x6abd('0x3f')]['findOne']({'where':{'id':_0x1d5630[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x5ddb2d,null))[_0x6abd('0x21')](function(_0x2fe461){if(_0x2fe461){_0x4c1176[_0x6abd('0x44')]=_['keys'](db[_0x6abd('0x64')][_0x6abd('0x40')]);_0x4c1176[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x1d5630['query']);_0x4c1176[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x4c1176[_0x6abd('0x44')],_0x4c1176['query']);_0x436a96[_0x6abd('0x47')]=_['intersection'](_0x4c1176[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x1d5630['query'][_0x6abd('0x49')]));_0x436a96['attributes']=_0x436a96[_0x6abd('0x47')][_0x6abd('0x66')]?_0x436a96['attributes']:_0x4c1176['model'];if(!_0x1d5630[_0x6abd('0x46')][_0x6abd('0x67')](_0x6abd('0x68'))){_0x436a96[_0x6abd('0x4a')]=qs[_0x6abd('0x4a')](_0x1d5630[_0x6abd('0x46')][_0x6abd('0x4a')]);_0x436a96['offset']=qs[_0x6abd('0x31')](_0x1d5630[_0x6abd('0x46')]['offset']);}_0x436a96['order']=qs[_0x6abd('0x4c')](_0x1d5630[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x436a96['where']=qs[_0x6abd('0x4f')](_['pick'](_0x1d5630[_0x6abd('0x46')],_0x4c1176[_0x6abd('0x4f')]));_0x436a96[_0x6abd('0x4d')][_0x6abd('0x63')]=_0x2fe461['id'];if(_0x1d5630[_0x6abd('0x46')][_0x6abd('0x52')]){_0x436a96[_0x6abd('0x4d')]=_[_0x6abd('0x50')](_0x436a96[_0x6abd('0x4d')],{'$or':_['map'](_0x436a96['attributes'],function(_0x28f44d){var _0x30bf9d={};_0x30bf9d[_0x28f44d]={'$like':'%'+_0x1d5630[_0x6abd('0x46')]['filter']+'%'};return _0x30bf9d;})});}_0x436a96=_[_0x6abd('0x50')]({},_0x436a96,_0x1d5630[_0x6abd('0x53')]);return db['Disposition'][_0x6abd('0x30')]({'where':_0x436a96[_0x6abd('0x4d')]})['then'](function(_0x5f0ef0){_0x2b9ef2[_0x6abd('0x30')]=_0x5f0ef0;if(_0x1d5630['query']['includeAll']){_0x436a96['include']=[{'all':!![]}];}return db[_0x6abd('0x64')]['findAll'](_0x436a96);})['then'](function(_0x29550c){_0x2b9ef2['rows']=_0x29550c;return _0x2b9ef2;});}})[_0x6abd('0x21')](respondWithFilteredResult(_0x5ddb2d,_0x436a96))['catch'](handleError(_0x5ddb2d,null));};exports['removeDispositions']=function(_0x320ebb,_0x175fec,_0x4042fc){return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x320ebb[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x175fec,null))[_0x6abd('0x21')](function(_0x36e568){if(_0x36e568){return _0x36e568[_0x6abd('0x69')](_0x320ebb['query'][_0x6abd('0x6a')]);}})[_0x6abd('0x21')](respondWithStatusCode(_0x175fec,null))[_0x6abd('0x2c')](handleError(_0x175fec,null));};exports['addAnswer']=function(_0x376f0c,_0x2b7655,_0x1745d6){if(_0x376f0c['body']['id']){delete _0x376f0c['body']['id'];}return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x376f0c[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x2b7655,null))[_0x6abd('0x21')](function(_0x2c9f30){if(_0x2c9f30){_0x376f0c['body'][_0x6abd('0x63')]=_0x2c9f30['id'];return db['CannedAnswer'][_0x6abd('0x59')](_0x376f0c[_0x6abd('0x5a')]);}})[_0x6abd('0x21')](respondWithResult(_0x2b7655,null))['catch'](handleError(_0x2b7655,null));};exports[_0x6abd('0x6b')]=function(_0x269929,_0xebf0dd,_0x32dc3b){var _0x18fef5={'raw':![],'where':{}};var _0x591703={};var _0x290f98={'count':0x0,'rows':[]};return db[_0x6abd('0x3f')][_0x6abd('0x6c')]({'where':{'id':_0x269929[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0xebf0dd,null))['then'](function(_0x3af450){if(_0x3af450){_0x591703[_0x6abd('0x44')]=_['keys'](db[_0x6abd('0x6d')]['rawAttributes']);_0x591703[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x269929[_0x6abd('0x46')]);_0x591703[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x591703['model'],_0x591703[_0x6abd('0x46')]);_0x18fef5[_0x6abd('0x47')]=_[_0x6abd('0x48')](_0x591703['model'],qs['fields'](_0x269929[_0x6abd('0x46')][_0x6abd('0x49')]));_0x18fef5[_0x6abd('0x47')]=_0x18fef5['attributes'][_0x6abd('0x66')]?_0x18fef5[_0x6abd('0x47')]:_0x591703['model'];if(!_0x269929[_0x6abd('0x46')][_0x6abd('0x67')]('nolimit')){_0x18fef5['limit']=qs['limit'](_0x269929[_0x6abd('0x46')]['limit']);_0x18fef5[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x269929[_0x6abd('0x46')][_0x6abd('0x31')]);}_0x18fef5[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x269929[_0x6abd('0x46')]['sort']);_0x18fef5[_0x6abd('0x4d')]=qs[_0x6abd('0x4f')](_[_0x6abd('0x4e')](_0x269929[_0x6abd('0x46')],_0x591703[_0x6abd('0x4f')]));_0x18fef5[_0x6abd('0x4d')][_0x6abd('0x63')]=_0x3af450['id'];if(_0x269929['query'][_0x6abd('0x52')]){_0x18fef5['where']=_[_0x6abd('0x50')](_0x18fef5[_0x6abd('0x4d')],{'$or':_[_0x6abd('0x3e')](_0x18fef5['attributes'],function(_0x48a3f3){var _0x259263={};_0x259263[_0x48a3f3]={'$like':'%'+_0x269929[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x259263;})});}_0x18fef5=_[_0x6abd('0x50')]({},_0x18fef5,_0x269929[_0x6abd('0x53')]);return db[_0x6abd('0x6d')]['count']({'where':_0x18fef5[_0x6abd('0x4d')]})[_0x6abd('0x21')](function(_0x20b7f7){_0x290f98[_0x6abd('0x30')]=_0x20b7f7;if(_0x269929[_0x6abd('0x46')][_0x6abd('0x54')]){_0x18fef5[_0x6abd('0x55')]=[{'all':!![]}];}return db[_0x6abd('0x6d')][_0x6abd('0x56')](_0x18fef5);})[_0x6abd('0x21')](function(_0x4b3783){_0x290f98[_0x6abd('0x6e')]=_0x4b3783;return _0x290f98;});}})[_0x6abd('0x21')](respondWithFilteredResult(_0xebf0dd,_0x18fef5))[_0x6abd('0x2c')](handleError(_0xebf0dd,null));};exports[_0x6abd('0x6f')]=function(_0x27033f,_0x2786c3,_0x4ad2ba){return db[_0x6abd('0x3f')]['find']({'where':{'id':_0x27033f['params']['id']}})['then'](handleEntityNotFound(_0x2786c3,null))[_0x6abd('0x21')](function(_0x21d6b6){if(_0x21d6b6){return _0x21d6b6[_0x6abd('0x6f')](_0x27033f[_0x6abd('0x46')][_0x6abd('0x6a')]);}})[_0x6abd('0x21')](respondWithStatusCode(_0x2786c3,null))[_0x6abd('0x2c')](handleError(_0x2786c3,null));};exports['notify']=function(_0x17e1c2,_0x54aca5,_0x1261cb){var _0x53827f={'channel':_0x6abd('0x70')};var _0x373b61=[];var _0x206755=[];var _0x2c7383={};return db['SmsAccount']['find']({'where':{'id':_0x17e1c2[_0x6abd('0x57')]['id']},'include':[{'model':db[_0x6abd('0x71')],'as':_0x6abd('0x72')}]})[_0x6abd('0x21')](handleEntityNotFound(_0x54aca5,null))[_0x6abd('0x21')](function(_0x2b3fc4){_0x53827f['account']=_0x2b3fc4;_0x53827f[_0x6abd('0x73')]=_[_0x6abd('0x74')](_0x2b3fc4[_0x6abd('0x72')],[_0x6abd('0x75')],[_0x6abd('0x76')]);if(_0x53827f[_0x6abd('0x77')][_0x6abd('0x72')]){delete _0x53827f[_0x6abd('0x77')][_0x6abd('0x72')];}return db[_0x6abd('0x78')][_0x6abd('0x61')]();})[_0x6abd('0x21')](function(_0x165ac5){if(!_0x165ac5){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))](_0x6abd('0x7b'));}_0x373b61=_['difference'](_[_0x6abd('0x45')](_0x165ac5),[_0x6abd('0x7c'),_0x6abd('0x7d')]);_0x206755=_[_0x6abd('0x7e')](_[_0x6abd('0x45')](_0x165ac5),[_0x6abd('0x7c'),'updatedAt',_0x6abd('0x7f'),_0x6abd('0x80')]);_0x53827f[_0x6abd('0x5a')]={'mapKey':'mobile'};if(_0x53827f[_0x6abd('0x77')][_0x6abd('0x42')]){switch(_0x53827f[_0x6abd('0x77')][_0x6abd('0x42')]){case _0x6abd('0x81'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')]['From'];_0x53827f['body']['body']=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x83')];_0x53827f['body']['messageId']=_0x17e1c2['body'][_0x6abd('0x84')];break;case _0x6abd('0x85'):_0x53827f[_0x6abd('0x5a')]['from']='+'+_0x17e1c2[_0x6abd('0x5a')]['sender'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x86')];break;case _0x6abd('0x87'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')]['from'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x2a')];break;case'clicksend':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x82')];_0x53827f['body'][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x5a')];_0x53827f['body'][_0x6abd('0x88')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x89')];break;case'plivo':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2['body'][_0x6abd('0x8a')];_0x53827f[_0x6abd('0x5a')]['body']=_0x17e1c2['body']['Text'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x88')]=_0x17e1c2[_0x6abd('0x5a')]['MessageUUID'];break;case _0x6abd('0x8b'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]='+'+_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x8c')][0x0]['from'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')]['results'][0x0]['text'];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x88')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x8c')][0x0][_0x6abd('0x88')];break;case'csc':_0x53827f['body'][_0x6abd('0x82')]=_0x17e1c2['body'][_0x6abd('0x8d')];_0x53827f['body']['body']=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x8e')][_0x6abd('0x2a')];break;case _0x6abd('0x8f'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x90')];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')]['text'];_0x53827f['body'][_0x6abd('0x88')]=_0x17e1c2['body'][_0x6abd('0x91')];break;case _0x6abd('0x92'):_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x82')];_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x2a')];_0x53827f['body']['messageId']=_0x17e1c2[_0x6abd('0x5a')][_0x6abd('0x93')];break;}}if(_0x53827f[_0x6abd('0x5a')]['id']){delete _0x53827f[_0x6abd('0x5a')]['id'];}if(_['isNil'](_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')])){throw new db[(_0x6abd('0x79'))]['ValidationError'](_0x6abd('0x94'));}if(_[_0x6abd('0x95')](_0x53827f['body'][_0x6abd('0x5a')])||_0x53827f[_0x6abd('0x5a')][_0x6abd('0x5a')]===''){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))](_0x6abd('0x96'));}if(_[_0x6abd('0x95')](_0x53827f[_0x6abd('0x5a')][_0x6abd('0x97')])){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x206755);}if(!_['includes'](_0x206755,_0x53827f[_0x6abd('0x5a')]['mapKey'])){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x206755);}_0x2c7383[_0x53827f['body'][_0x6abd('0x97')]]=_0x53827f[_0x6abd('0x5a')]['from'];return db[_0x6abd('0x98')][_0x6abd('0x58')]({'where':{'id':_0x53827f['account'][_0x6abd('0x80')]},'include':[{'model':db['CmContact'],'as':_0x6abd('0x99'),'where':_0x2c7383,'limit':0x1,'order':[[_0x6abd('0x7d'),'DESC']]}]});})[_0x6abd('0x21')](handleEntityNotFound(_0x54aca5,null))[_0x6abd('0x21')](function(_0x1b3d61){if(_0x1b3d61){_0x53827f['list']=_['omit'](_0x1b3d61,[_0x6abd('0x99')]);if(_0x1b3d61[_0x6abd('0x99')][_0x6abd('0x66')]){return _0x1b3d61[_0x6abd('0x99')][0x0];}var _0x5efae4=_[_0x6abd('0x19')](_0x53827f['body'],{'firstName':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')],'ListId':_0x1b3d61['id']});_0x5efae4[_0x53827f['body'][_0x6abd('0x97')]]=_0x53827f[_0x6abd('0x5a')]['from'];return db[_0x6abd('0x78')]['create'](_0x5efae4,{'fields':_0x373b61,'raw':!![]});}})[_0x6abd('0x21')](handleEntityNotFound(_0x54aca5,null))[_0x6abd('0x21')](function(_0x45c48c){if(_0x45c48c){_0x53827f['contact']=_0x45c48c;var _0x2daa7a={'ContactId':_0x45c48c['id'],'phone':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')],'SmsAccountId':_0x17e1c2['params']['id']};var _0xe65d14={'ContactId':_0x45c48c['id'],'SmsAccountId':_0x17e1c2['params']['id'],'closed':![]};return db['SmsInteraction'][_0x6abd('0x58')]({'where':_0xe65d14})[_0x6abd('0x21')](function(_0x3d81fa){if(_0x3d81fa){return[_0x3d81fa,![]];}return db['SmsInteraction'][_0x6abd('0x59')](_0x2daa7a)[_0x6abd('0x21')](function(_0x3ad0f6){return[_0x3ad0f6,!![]];});});}})[_0x6abd('0x9a')](function(_0x4721e7,_0x1f6c8b){_0x53827f[_0x6abd('0x9b')]=_0x4721e7[_0x6abd('0x37')]({'plain':!![]});_0x53827f[_0x6abd('0x9b')][_0x6abd('0x9c')]=![];if(_0x1f6c8b){if(_0x53827f[_0x6abd('0x77')]['autoclose']){_0x53827f[_0x6abd('0x73')][_0x6abd('0x9d')]({'id':0x0,'priority':_0x53827f[_0x6abd('0x73')][_0x6abd('0x66')]+0x1,'app':_0x6abd('0x9e'),'appdata':_0x6abd('0x9f'),'interval':_0x6abd('0xa0')});}_0x53827f[_0x6abd('0x9b')][_0x6abd('0x9c')]=!![];}return db[_0x6abd('0xa1')][_0x6abd('0x59')]({'phone':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x82')],'messageId':_0x53827f[_0x6abd('0x5a')][_0x6abd('0x88')],'body':_0x53827f[_0x6abd('0x5a')]['body'],'SmsAccountId':_0x17e1c2['params']['id'],'SmsInteractionId':_0x4721e7['id'],'direction':'in','ContactId':_0x4721e7[_0x6abd('0xa2')],'AttachmentId':_0x53827f[_0x6abd('0x5a')]['AttachmentId']});})['then'](function(_0x52a8a8){_0x53827f[_0x6abd('0x2a')]=_0x52a8a8;if(_0x53827f[_0x6abd('0x9b')][_0x6abd('0xa3')]){return db['User']['find']({'attributes':['id',_0x6abd('0x3b')],'where':{'id':_0x53827f[_0x6abd('0x9b')][_0x6abd('0xa3')]}})[_0x6abd('0x21')](function(_0x2536bf){if(_0x2536bf){_0x53827f['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6abd('0xa4'),'appdata':_0x2536bf[_0x6abd('0x3b')]+','+(_0x53827f[_0x6abd('0x77')][_0x6abd('0xa5')]||0xa),'interval':_0x6abd('0xa0')});}return respondWithRpcPromise('Start',_0x6abd('0xa6'),_0x53827f);});}return respondWithRpcPromise('Start',_0x6abd('0xa6'),_0x53827f);})[_0x6abd('0x21')](function(_0x3d67a3){if(_0x3d67a3){var _0x51f1e7=0xc8;var _0x15f9cb=_0x6abd('0xa7');logger['info'](_0x6abd('0x25'),_0x15f9cb,_0x51f1e7,_0x6abd('0xa8'));logger[_0x6abd('0x24')](_0x6abd('0xa9'),_0x15f9cb,_0x51f1e7,_0x6abd('0xa8'),JSON[_0x6abd('0x26')](_0x3d67a3));if(_0x53827f[_0x6abd('0x77')]['type']==='twilio'){return _0x54aca5[_0x6abd('0x2e')](_0x51f1e7)[_0x6abd('0xaa')](_0x6abd('0xab'),_0x6abd('0xac'))[_0x6abd('0xad')](_0x6abd('0xae'));}else{return _0x54aca5[_0x6abd('0x2e')](_0x51f1e7)[_0x6abd('0x32')](_0x3d67a3);}}})[_0x6abd('0x2c')](handleError(_0x54aca5,null));};exports[_0x6abd('0xaf')]=function(_0x179aa1,_0x372d66,_0x44ea39){return db['SmsAccount'][_0x6abd('0x6c')]({'where':{'id':_0x179aa1[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x372d66,null))[_0x6abd('0x21')](function(_0x2f258d){if(_0x2f258d){return db[_0x6abd('0xb0')][_0x6abd('0xb1')](function(_0x305ce1){return db[_0x6abd('0x71')][_0x6abd('0x36')]({'where':{'SmsAccountId':_0x179aa1[_0x6abd('0x57')]['id']},'transaction':_0x305ce1})[_0x6abd('0x21')](function(_0x47da94){var _0x25adbe=_['map'](_0x179aa1[_0x6abd('0x5a')],function(_0x590f85){_0x590f85[_0x6abd('0x63')]=_0x179aa1['params']['id'];return _0x590f85;});return db[_0x6abd('0x71')][_0x6abd('0xb2')](_0x25adbe,{'transaction':_0x305ce1});});})[_0x6abd('0x21')](function(){return db[_0x6abd('0x71')][_0x6abd('0xb3')]({'where':{'SmsAccountId':_0x179aa1[_0x6abd('0x57')]['id']},'order':_0x6abd('0x75')});});}})[_0x6abd('0x21')](respondWithResult(_0x372d66,null))[_0x6abd('0x2c')](handleError(_0x372d66,null));};exports[_0x6abd('0xb4')]=function(_0x333144,_0x26b134,_0x2bfcf7){var _0x4b6505={};var _0x231d63={};var _0x181fed;var _0x10bb1d;return db[_0x6abd('0x3f')][_0x6abd('0x6c')]({'where':{'id':_0x333144[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x26b134,null))['then'](function(_0x27fd05){if(_0x27fd05){_0x181fed=_0x27fd05;_0x231d63[_0x6abd('0x44')]=_[_0x6abd('0x45')](db[_0x6abd('0x71')][_0x6abd('0x40')]);_0x231d63[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x333144[_0x6abd('0x46')]);_0x231d63[_0x6abd('0x4f')]=_['intersection'](_0x231d63['model'],_0x231d63[_0x6abd('0x46')]);_0x4b6505[_0x6abd('0x47')]=_[_0x6abd('0x48')](_0x231d63[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x333144[_0x6abd('0x46')][_0x6abd('0x49')]));_0x4b6505['attributes']=_0x4b6505[_0x6abd('0x47')]['length']?_0x4b6505['attributes']:_0x231d63['model'];_0x4b6505[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x333144[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x4b6505['where']=qs['filters'](_[_0x6abd('0x4e')](_0x333144[_0x6abd('0x46')],_0x231d63[_0x6abd('0x4f')]));if(_0x333144[_0x6abd('0x46')][_0x6abd('0x52')]){_0x4b6505[_0x6abd('0x4d')]=_[_0x6abd('0x50')](_0x4b6505[_0x6abd('0x4d')],{'$or':_['map'](_0x4b6505[_0x6abd('0x47')],function(_0x5d8e4d){var _0x298f99={};_0x298f99[_0x5d8e4d]={'$like':'%'+_0x333144[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x298f99;})});}_0x4b6505=_[_0x6abd('0x50')]({},_0x4b6505,_0x333144[_0x6abd('0x53')]);return _0x181fed[_0x6abd('0xb4')](_0x4b6505);}})[_0x6abd('0x21')](function(_0x39efe2){if(_0x39efe2){_0x10bb1d=_0x39efe2['length'];if(!_0x333144[_0x6abd('0x46')][_0x6abd('0x67')]('nolimit')){_0x4b6505[_0x6abd('0x4a')]=qs['limit'](_0x333144['query'][_0x6abd('0x4a')]);_0x4b6505[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x333144['query'][_0x6abd('0x31')]);}return _0x181fed[_0x6abd('0xb4')](_0x4b6505);}})['then'](function(_0x299b5a){if(_0x299b5a){return _0x299b5a?{'count':_0x10bb1d,'rows':_0x299b5a}:null;}})['then'](respondWithResult(_0x26b134,null))[_0x6abd('0x2c')](handleError(_0x26b134,null));};exports[_0x6abd('0xb5')]=function(_0x5aa787,_0xd68588,_0x3ca06d){var _0x46f8de={'raw':![],'where':{}};var _0x40f60e={};var _0x38af21={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6abd('0x6c')]({'where':{'id':_0x5aa787[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0xd68588,null))[_0x6abd('0x21')](function(_0x3dc7f1){if(_0x3dc7f1){_0x40f60e[_0x6abd('0x44')]=_['keys'](db[_0x6abd('0xb6')][_0x6abd('0x40')]);_0x40f60e[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x5aa787[_0x6abd('0x46')]);_0x40f60e['filters']=_[_0x6abd('0x48')](_0x40f60e[_0x6abd('0x44')],_0x40f60e['query']);_0x46f8de[_0x6abd('0x47')]=_['intersection'](_0x40f60e['model'],qs[_0x6abd('0x49')](_0x5aa787['query'][_0x6abd('0x49')]));_0x46f8de[_0x6abd('0x47')]=_0x46f8de[_0x6abd('0x47')][_0x6abd('0x66')]?_0x46f8de['attributes']:_0x40f60e[_0x6abd('0x44')];if(!_0x5aa787['query'][_0x6abd('0x67')]('nolimit')){_0x46f8de[_0x6abd('0x4a')]=qs['limit'](_0x5aa787['query'][_0x6abd('0x4a')]);_0x46f8de['offset']=qs[_0x6abd('0x31')](_0x5aa787[_0x6abd('0x46')][_0x6abd('0x31')]);}_0x46f8de[_0x6abd('0x4b')]=qs[_0x6abd('0x4c')](_0x5aa787[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x46f8de[_0x6abd('0x4d')]=qs[_0x6abd('0x4f')](_[_0x6abd('0x4e')](_0x5aa787[_0x6abd('0x46')],_0x40f60e[_0x6abd('0x4f')]));_0x46f8de[_0x6abd('0x4d')][_0x6abd('0x63')]=_0x3dc7f1['id'];if(_0x5aa787[_0x6abd('0x46')][_0x6abd('0x52')]){_0x46f8de['where']=_[_0x6abd('0x50')](_0x46f8de[_0x6abd('0x4d')],{'$or':_[_0x6abd('0x3e')](_0x46f8de['attributes'],function(_0xa45c6a){var _0x5eecbc={};_0x5eecbc[_0xa45c6a]={'$like':'%'+_0x5aa787['query'][_0x6abd('0x52')]+'%'};return _0x5eecbc;})});}_0x46f8de=_['merge']({},_0x46f8de,_0x5aa787[_0x6abd('0x53')]);return db[_0x6abd('0xb6')]['count']({'where':_0x46f8de[_0x6abd('0x4d')]})[_0x6abd('0x21')](function(_0x1af6dc){_0x38af21[_0x6abd('0x30')]=_0x1af6dc;if(_0x5aa787[_0x6abd('0x46')]['includeAll']){_0x46f8de[_0x6abd('0x55')]=[{'model':db[_0x6abd('0x78')],'as':_0x6abd('0xb7'),'required':![]},{'model':db[_0x6abd('0xb8')],'as':_0x6abd('0xb9'),'attributes':[_0x6abd('0x3b'),_0x6abd('0xba'),_0x6abd('0xbb')],'required':![]},{'model':db[_0x6abd('0xbc')],'as':_0x6abd('0xbd'),'attributes':['id','name',_0x6abd('0xbe')],'where':_0x5aa787[_0x6abd('0x46')][_0x6abd('0xbf')]?{'id':_0x5aa787[_0x6abd('0x46')][_0x6abd('0xbf')]}:undefined,'required':_0x5aa787[_0x6abd('0x46')][_0x6abd('0xbf')]?!![]:![]}];}return db[_0x6abd('0xb6')]['findAll'](_0x46f8de);})[_0x6abd('0x21')](function(_0x106257){_0x38af21[_0x6abd('0x6e')]=_0x106257;return _0x38af21;});}})['then'](respondWithFilteredResult(_0xd68588,_0x46f8de))[_0x6abd('0x2c')](handleError(_0xd68588,null));};exports[_0x6abd('0xad')]=function(_0x100cd6,_0x47e85b,_0x3b93b6){var _0xedb800,_0x451a61,_0x213517;if(_[_0x6abd('0x95')](_0x100cd6[_0x6abd('0x5a')][_0x6abd('0x5a')])||_0x100cd6[_0x6abd('0x5a')][_0x6abd('0x5a')]===''){throw new db['Sequelize'][(_0x6abd('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x100cd6[_0x6abd('0x5a')]['to'])){throw new db[(_0x6abd('0x79'))][(_0x6abd('0x7a'))]('to\x20is\x20mandatory');}_0xedb800=_0x100cd6[_0x6abd('0x5a')]['to'];return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x100cd6[_0x6abd('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x6abd('0xc0'),'include':[{'model':db['CmContact'],'as':_0x6abd('0x99'),'where':{'mobile':_0xedb800},'limit':0x1,'order':[[_0x6abd('0x7d'),_0x6abd('0xc1')]]}]}]})[_0x6abd('0x21')](handleEntityNotFound(_0x47e85b,null))[_0x6abd('0x21')](function(_0x50dc5a){if(_0x50dc5a&&_0x50dc5a[_0x6abd('0xc0')]){_0x451a61=_0x50dc5a[_0x6abd('0x37')]({'plain':!![]});if(_0x451a61[_0x6abd('0xc0')]&&_0x451a61[_0x6abd('0xc0')][_0x6abd('0x99')][_0x6abd('0x66')]){return _0x451a61[_0x6abd('0xc0')][_0x6abd('0x99')][0x0];}return db[_0x6abd('0x78')][_0x6abd('0x59')](_[_0x6abd('0x19')](_0x100cd6[_0x6abd('0x5a')],{'firstName':_0xedb800,'mobile':_0xedb800,'phone':_0xedb800,'ListId':_0x451a61['ListId']}));}})[_0x6abd('0x21')](handleEntityNotFound(_0x47e85b,null))['then'](function(_0x9c7325){if(_0x9c7325){_0x213517=_0x9c7325;return db['SmsInteraction'][_0x6abd('0x58')]({'where':{'ContactId':_0x213517['id'],'closed':![],'SmsAccountId':_0x451a61['id']}})[_0x6abd('0x21')](function(_0x14447b){if(_0x14447b){return[_0x14447b,![]];}return db[_0x6abd('0xb6')][_0x6abd('0x59')]({'UserId':_0x100cd6['user']['id'],'ContactId':_0x213517['id'],'SmsAccountId':_0x451a61['id'],'phone':_0xedb800,'firstMsgDirection':_0x6abd('0xc2'),'Messages':[_[_0x6abd('0x50')](_0x100cd6[_0x6abd('0x5a')],{'read':![],'body':_0x100cd6[_0x6abd('0x5a')][_0x6abd('0x5a')],'phone':_0xedb800,'SmsAccountId':_0x451a61['id'],'UserId':_0x100cd6['user']['id'],'ContactId':_0x213517['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6abd('0xc3')}]})[_0x6abd('0x21')](function(_0xb02f1d){return[_0xb02f1d,!![]];});});}})[_0x6abd('0x9a')](function(_0x3c31ec,_0x49031b){if(_0x49031b){return _0x3c31ec;}return db[_0x6abd('0xa1')][_0x6abd('0x59')](_['merge'](_0x100cd6['body'],{'read':![],'body':_0x100cd6['body'][_0x6abd('0x5a')],'phone':_0xedb800,'SmsAccountId':_0x451a61['id'],'SmsInteractionId':_0x3c31ec['id'],'UserId':_0x100cd6['user']['id'],'ContactId':_0x213517['id']}))[_0x6abd('0x21')](function(_0x1e409e){_0x3c31ec['dataValues'][_0x6abd('0xc3')]=[];_0x3c31ec[_0x6abd('0xc4')][_0x6abd('0xc3')]['push'](_0x1e409e[_0x6abd('0xc4')]);return _0x3c31ec;});})[_0x6abd('0x21')](respondWithResult(_0x47e85b,null))['catch'](handleError(_0x47e85b,null));};exports[_0x6abd('0x2e')]=function(_0x4ad2c9,_0x3511c2,_0x41766a){if(_0x4ad2c9[_0x6abd('0x5a')]['id']){delete _0x4ad2c9[_0x6abd('0x5a')]['id'];}console[_0x6abd('0xc5')](_0x6abd('0xc6'),_0x4ad2c9[_0x6abd('0x5a')]);var _0x597a41,_0x97412f,_0x384dd4;return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x4ad2c9['params']['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x3511c2,null))[_0x6abd('0x21')](function(_0x65ddb7){if(_0x65ddb7){_0x384dd4=_0x65ddb7;logger[_0x6abd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6abd('0x2e'),_0x6abd('0xc7'),_0x65ddb7[_0x6abd('0x42')],util[_0x6abd('0xc8')](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));switch(_0x65ddb7[_0x6abd('0x42')]){case _0x6abd('0x85'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xc9')]&&_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x2e')]){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')]['status'];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xc9')]}});}break;case _0x6abd('0x87'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xca')]&&_0x4ad2c9[_0x6abd('0x5a')]['statusInt']){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xcb')];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xca')]}});}break;case _0x6abd('0xcc'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x89')]&&_0x4ad2c9['body'][_0x6abd('0xcd')]){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xcd')];return db[_0x6abd('0xa1')]['find']({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x89')]}});}break;case _0x6abd('0x8b'):var _0x23c91a=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x8c')][0x0];if(_0x23c91a['messageId']&&_0x23c91a[_0x6abd('0x2e')][_0x6abd('0xce')]===_0x6abd('0xcf')){_0x97412f=_0x23c91a['status']['groupName'];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x23c91a[_0x6abd('0x88')]}});}break;case _0x6abd('0x8f'):if(_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x88')]&&_0x4ad2c9[_0x6abd('0x5a')]['status']){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x2e')];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x88')]}});}break;case'intelepeer':if(_0x4ad2c9[_0x6abd('0x5a')]['redif']&&_0x4ad2c9['body'][_0x6abd('0x2e')]){_0x97412f=_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0x2e')];return db[_0x6abd('0xa1')]['find']({'where':{'messageId':_0x4ad2c9[_0x6abd('0x5a')][_0x6abd('0xd0')]}});}break;}}})[_0x6abd('0x21')](handleEntityNotFound(_0x3511c2,null))['then'](function(_0x5b1803){if(_0x5b1803){_0x597a41=_0x5b1803;switch(_0x384dd4[_0x6abd('0x42')]){case _0x6abd('0x85'):if(_0x97412f===_0x6abd('0xcf')){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0x85'),util['inspect'](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x97412f==='1'){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger['error'](_0x6abd('0x25'),'status',_0x6abd('0x85'),util['inspect'](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6abd('0xcc'):if(!_0x4ad2c9['body'][_0x6abd('0xd1')]&&_0x97412f>=0xc8&&_0x97412f<=0xce){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger['error'](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0xcc'),util[_0x6abd('0xc8')](_0x4ad2c9['body'],{'showHidden':![],'depth':null}));}break;case _0x6abd('0x8b'):var _0x48d5f2=_0x4ad2c9[_0x6abd('0x5a')]['results'][0x0];if(_0x48d5f2[_0x6abd('0x2e')][_0x6abd('0xce')]==='DELIVERED'){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),'status','infobip',util[_0x6abd('0xc8')](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6abd('0x8f'):if(_0x97412f==_0x6abd('0xd2')||_0x97412f=='RECEIVED_BY_RECIPIENT'){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0x8f'),util['inspect'](_0x4ad2c9[_0x6abd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6abd('0x92'):if(_0x97412f===_0x6abd('0xd3')||_0x97412f===_0x6abd('0xd4')){return _0x597a41[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0x92'),util[_0x6abd('0xc8')](_0x4ad2c9['body'],{'showHidden':![],'depth':null}));}break;}return _0x597a41;}})['then'](respondWithResult(_0x3511c2,null))[_0x6abd('0x2c')](handleError(_0x3511c2,null));};exports['statusGet']=function(_0x56a06e,_0x131c9a,_0x44db41){var _0x31eed1,_0x4ec23f,_0x31b1e3;return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x56a06e[_0x6abd('0x57')]['id']}})['then'](handleEntityNotFound(_0x131c9a,null))['then'](function(_0x18b8e1){if(_0x18b8e1){_0x31b1e3=_0x18b8e1;logger[_0x6abd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6abd('0x2e'),_0x6abd('0xc7'),_0x18b8e1['type'],util[_0x6abd('0xc8')](_0x56a06e[_0x6abd('0x46')],{'showHidden':![],'depth':null}));switch(_0x18b8e1['type']){case _0x6abd('0xd5'):if(_0x56a06e[_0x6abd('0x46')][_0x6abd('0xd6')]&&_0x56a06e[_0x6abd('0x46')][_0x6abd('0xd7')]){_0x4ec23f=_0x56a06e[_0x6abd('0x46')][_0x6abd('0xd7')];return db[_0x6abd('0xa1')][_0x6abd('0x58')]({'where':{'messageId':_0x56a06e['query'][_0x6abd('0xd6')]}});}break;}}})[_0x6abd('0x21')](handleEntityNotFound(_0x131c9a,null))[_0x6abd('0x21')](function(_0x1828ac){if(_0x1828ac){_0x31eed1=_0x1828ac;switch(_0x31b1e3[_0x6abd('0x42')]){case'csc':if(_0x4ec23f==='2'||_0x4ec23f==='6'){return _0x31eed1[_0x6abd('0x35')]({'read':!![]});}else{logger[_0x6abd('0x27')](_0x6abd('0x25'),_0x6abd('0x2e'),_0x6abd('0xd5'),util['inspect'](_0x56a06e[_0x6abd('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x31eed1;}})[_0x6abd('0x21')](respondWithResult(_0x131c9a,null))[_0x6abd('0x2c')](handleError(_0x131c9a,null));};exports['addAgents']=function(_0x3f4cc2,_0x1b5019,_0x4e9a86){return db[_0x6abd('0x3f')][_0x6abd('0x58')]({'where':{'id':_0x3f4cc2['params']['id']}})['then'](handleEntityNotFound(_0x1b5019,null))[_0x6abd('0x21')](function(_0x20df8c){if(_0x20df8c){return _0x20df8c[_0x6abd('0xd8')](_0x3f4cc2[_0x6abd('0x5a')][_0x6abd('0x6a')],_[_0x6abd('0xd9')](_0x3f4cc2[_0x6abd('0x5a')],[_0x6abd('0x6a'),'id'])||{})[_0x6abd('0x9a')](function(_0xef90c9){for(var _0x52ca41=0x0;_0x52ca41<_0x3f4cc2[_0x6abd('0x5a')]['ids']['length'];_0x52ca41+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x3f4cc2[_0x6abd('0x5a')]['ids'][_0x52ca41],'SmsAccountId':_0x3f4cc2[_0x6abd('0x57')]['id']});}return _0xef90c9;});}})['then'](respondWithResult(_0x1b5019,null))[_0x6abd('0x2c')](handleError(_0x1b5019,null));};exports['removeAgents']=function(_0x3847e3,_0x25f300,_0x1eeb45){return db['SmsAccount'][_0x6abd('0x58')]({'where':{'id':_0x3847e3[_0x6abd('0x57')]['id']}})[_0x6abd('0x21')](handleEntityNotFound(_0x25f300,null))['then'](function(_0xeaa7d8){if(_0xeaa7d8){return _0xeaa7d8['removeAgents'](_0x3847e3['query'][_0x6abd('0x6a')])[_0x6abd('0x21')](function(){if(_[_0x6abd('0xda')](_0x3847e3[_0x6abd('0x46')]['ids'])){for(var _0x46442a=0x0;_0x46442a<_0x3847e3['query']['ids'][_0x6abd('0x66')];_0x46442a+=0x1){socket[_0x6abd('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x3847e3['query'][_0x6abd('0x6a')][_0x46442a]),'SmsAccountId':Number(_0x3847e3[_0x6abd('0x57')]['id'])});}}else{socket[_0x6abd('0xdb')](_0x6abd('0xdc'),{'UserId':Number(_0x3847e3['query'][_0x6abd('0x6a')]),'SmsAccountId':Number(_0x3847e3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x25f300,null))[_0x6abd('0x2c')](handleError(_0x25f300,null));};exports[_0x6abd('0xdd')]=function(_0x72dd1b,_0x16b711,_0x4686a9){var _0x285d1c={};var _0x3026f5={};var _0x3e1a1d;var _0x40e55f;return db[_0x6abd('0x3f')]['findOne']({'where':{'id':_0x72dd1b['params']['id']}})['then'](handleEntityNotFound(_0x16b711,null))['then'](function(_0x38008e){if(_0x38008e){_0x3e1a1d=_0x38008e;_0x3026f5[_0x6abd('0x44')]=_[_0x6abd('0x45')](db[_0x6abd('0xb8')][_0x6abd('0x40')]);_0x3026f5[_0x6abd('0x46')]=_[_0x6abd('0x45')](_0x72dd1b['query']);_0x3026f5[_0x6abd('0x4f')]=_[_0x6abd('0x48')](_0x3026f5['model'],_0x3026f5[_0x6abd('0x46')]);_0x285d1c['attributes']=_[_0x6abd('0x48')](_0x3026f5[_0x6abd('0x44')],qs[_0x6abd('0x49')](_0x72dd1b['query'][_0x6abd('0x49')]));_0x285d1c[_0x6abd('0x47')]=_0x285d1c[_0x6abd('0x47')][_0x6abd('0x66')]?_0x285d1c[_0x6abd('0x47')]:_0x3026f5[_0x6abd('0x44')];_0x285d1c['order']=qs['sort'](_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x4c')]);_0x285d1c[_0x6abd('0x4d')]=qs['filters'](_[_0x6abd('0x4e')](_0x72dd1b[_0x6abd('0x46')],_0x3026f5[_0x6abd('0x4f')]));if(_0x72dd1b[_0x6abd('0x46')]['filter']){_0x285d1c['where']=_[_0x6abd('0x50')](_0x285d1c['where'],{'$or':_[_0x6abd('0x3e')](_0x285d1c[_0x6abd('0x47')],function(_0x38d178){var _0x3d2830={};_0x3d2830[_0x38d178]={'$like':'%'+_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x52')]+'%'};return _0x3d2830;})});}_0x285d1c=_[_0x6abd('0x50')]({},_0x285d1c,_0x72dd1b[_0x6abd('0x53')]);return _0x3e1a1d['getAgents'](_0x285d1c);}})[_0x6abd('0x21')](function(_0x47df87){if(_0x47df87){_0x40e55f=_0x47df87[_0x6abd('0x66')];if(!_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x67')](_0x6abd('0x68'))){_0x285d1c[_0x6abd('0x4a')]=qs[_0x6abd('0x4a')](_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x4a')]);_0x285d1c[_0x6abd('0x31')]=qs[_0x6abd('0x31')](_0x72dd1b[_0x6abd('0x46')][_0x6abd('0x31')]);}return _0x3e1a1d[_0x6abd('0xdd')](_0x285d1c);}})[_0x6abd('0x21')](function(_0x97145f){if(_0x97145f){return _0x97145f?{'count':_0x40e55f,'rows':_0x97145f}:null;}})[_0x6abd('0x21')](respondWithResult(_0x16b711,null))['catch'](handleError(_0x16b711,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ac35f18..e7df1d3 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 _0x34a1=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','save'];(function(_0x256910,_0x270d4e){var _0x16ed34=function(_0x18d892){while(--_0x18d892){_0x256910['push'](_0x256910['shift']());}};_0x16ed34(++_0x270d4e);}(_0x34a1,0x19a));var _0x134a=function(_0x3adf24,_0x45ed8a){_0x3adf24=_0x3adf24-0x0;var _0x4ec313=_0x34a1[_0x3adf24];return _0x4ec313;};'use strict';var EventEmitter=require(_0x134a('0x0'));var SmsAccount=require(_0x134a('0x1'))['db'][_0x134a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x134a('0x3'),'afterUpdate':_0x134a('0x4'),'afterDestroy':_0x134a('0x5')};function emitEvent(_0x35a272){return function(_0x4adfbb,_0x3879c9,_0x29c136){SmsAccountEvents[_0x134a('0x6')](_0x35a272+':'+_0x4adfbb['id'],_0x4adfbb);SmsAccountEvents[_0x134a('0x6')](_0x35a272,_0x4adfbb);_0x29c136(null);};}for(var e in events){if(events[_0x134a('0x7')](e)){var event=events[e];SmsAccount[_0x134a('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x0577=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x8cd354,_0x2d9bec){var _0x4aa12e=function(_0x46568c){while(--_0x46568c){_0x8cd354['push'](_0x8cd354['shift']());}};_0x4aa12e(++_0x2d9bec);}(_0x0577,0x1ac));var _0x7057=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x0577[_0x1b6186];return _0x186121;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x7057('0x0'))['db'][_0x7057('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7057('0x2')](0x0);var events={'afterCreate':_0x7057('0x3'),'afterUpdate':_0x7057('0x4'),'afterDestroy':_0x7057('0x5')};function emitEvent(_0x7160e1){return function(_0x41c3d0,_0x9c96e9,_0x36e509){SmsAccountEvents['emit'](_0x7160e1+':'+_0x41c3d0['id'],_0x41c3d0);SmsAccountEvents[_0x7057('0x6')](_0x7160e1,_0x41c3d0);_0x36e509(null);};}for(var e in events){if(events[_0x7057('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7057('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0a0a64f..abd90bb 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 _0x64ab=['path','rimraf','../../config/environment','exports','define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42d002,_0x4dbc43){var _0x5b7320=function(_0x4a20eb){while(--_0x4a20eb){_0x42d002['push'](_0x42d002['shift']());}};_0x5b7320(++_0x4dbc43);}(_0x64ab,0xa2));var _0xb64a=function(_0x53fa81,_0x4cfbb3){_0x53fa81=_0x53fa81-0x0;var _0x49cda8=_0x64ab[_0x53fa81];return _0x49cda8;};'use strict';var _=require(_0xb64a('0x0'));var util=require(_0xb64a('0x1'));var logger=require(_0xb64a('0x2'))(_0xb64a('0x3'));var moment=require(_0xb64a('0x4'));var BPromise=require(_0xb64a('0x5'));var rp=require(_0xb64a('0x6'));var fs=require('fs');var path=require(_0xb64a('0x7'));var rimraf=require(_0xb64a('0x8'));var config=require(_0xb64a('0x9'));var attributes=require('./smsAccount.attributes');module[_0xb64a('0xa')]=function(_0x2ee273,_0x58307f){return _0x2ee273[_0xb64a('0xb')]('SmsAccount',attributes,{'tableName':_0xb64a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0443=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x363367,_0xc487bc){var _0x32caf7=function(_0x2dde84){while(--_0x2dde84){_0x363367['push'](_0x363367['shift']());}};_0x32caf7(++_0xc487bc);}(_0x0443,0x114));var _0x3044=function(_0x20c928,_0x3cf13b){_0x20c928=_0x20c928-0x0;var _0x541e41=_0x0443[_0x20c928];return _0x541e41;};'use strict';var _=require(_0x3044('0x0'));var util=require(_0x3044('0x1'));var logger=require(_0x3044('0x2'))('api');var moment=require(_0x3044('0x3'));var BPromise=require(_0x3044('0x4'));var rp=require(_0x3044('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3044('0x6'));var config=require(_0x3044('0x7'));var attributes=require(_0x3044('0x8'));module[_0x3044('0x9')]=function(_0x5913cf,_0x465c3e){return _0x5913cf[_0x3044('0xa')](_0x3044('0xb'),attributes,{'tableName':_0x3044('0xc'),'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 c0a45f3..10f1ec6 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 _0x9a65=['stringify','error','code','message','result','catch','ShowSmsAccount','find','options','where','include','model','map','attributes','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1bd247,_0x14f195){var _0x54d8d5=function(_0x2aaf14){while(--_0x2aaf14){_0x1bd247['push'](_0x1bd247['shift']());}};_0x54d8d5(++_0x14f195);}(_0x9a65,0x11f));var _0x59a6=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x9a65[_0x2b4448];return _0xb4b465;};'use strict';var _=require(_0x59a6('0x0'));var util=require('util');var moment=require(_0x59a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x59a6('0x2'));var fs=require('fs');var Redis=require(_0x59a6('0x3'));var db=require(_0x59a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x59a6('0x5'));var jayson=require(_0x59a6('0x6'));var client=jayson[_0x59a6('0x7')]['http']({'port':0x232a});config[_0x59a6('0x8')]=_[_0x59a6('0x9')](config[_0x59a6('0x8')],{'host':_0x59a6('0xa'),'port':0x18eb});var socket=require(_0x59a6('0xb'))(new Redis(config[_0x59a6('0x8')]));require(_0x59a6('0xc'))['register'](socket);function respondWithRpcPromise(_0x2a5dfd,_0x2d2832,_0x4d5d2f){return new BPromise(function(_0x1f7570,_0xfc120d){return client[_0x59a6('0xd')](_0x2a5dfd,_0x4d5d2f)[_0x59a6('0xe')](function(_0x358b64){logger[_0x59a6('0xf')](_0x59a6('0x10'),_0x2d2832,_0x59a6('0x11'));logger['debug'](_0x59a6('0x12'),_0x2d2832,_0x59a6('0x11'),JSON[_0x59a6('0x13')](_0x358b64));if(_0x358b64['error']){if(_0x358b64[_0x59a6('0x14')][_0x59a6('0x15')]===0x1f4){logger[_0x59a6('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2d2832,_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);return _0xfc120d(_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);}logger[_0x59a6('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2d2832,_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);return _0x1f7570(_0x358b64[_0x59a6('0x14')][_0x59a6('0x16')]);}else{logger[_0x59a6('0xf')](_0x59a6('0x10'),_0x2d2832,_0x59a6('0x11'));_0x1f7570(_0x358b64[_0x59a6('0x17')][_0x59a6('0x16')]);}})[_0x59a6('0x18')](function(_0x20c1b4){logger[_0x59a6('0x14')](_0x59a6('0x10'),_0x2d2832,_0x20c1b4);_0xfc120d(_0x20c1b4);});});}exports[_0x59a6('0x19')]=function(_0x2736db){var _0x4380e6=this;return new Promise(function(_0x35901e,_0x1be69c){return db['SmsAccount'][_0x59a6('0x1a')]({'raw':_0x2736db['options']?_0x2736db[_0x59a6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2736db[_0x59a6('0x1b')]?_0x2736db[_0x59a6('0x1b')][_0x59a6('0x1c')]||null:null,'attributes':_0x2736db['options']?_0x2736db[_0x59a6('0x1b')]['attributes']||null:null,'include':_0x2736db[_0x59a6('0x1b')]?_0x2736db[_0x59a6('0x1b')][_0x59a6('0x1d')]?_['map'](_0x2736db['options']['include'],function(_0x2b2069){return{'model':db[_0x2b2069[_0x59a6('0x1e')]],'as':_0x2b2069['as'],'attributes':_0x2b2069['attributes'],'include':_0x2b2069[_0x59a6('0x1d')]?_[_0x59a6('0x1f')](_0x2b2069[_0x59a6('0x1d')],function(_0x24675f){return{'model':db[_0x24675f['model']],'as':_0x24675f['as'],'attributes':_0x24675f[_0x59a6('0x20')],'include':_0x24675f[_0x59a6('0x1d')]?_[_0x59a6('0x1f')](_0x24675f['include'],function(_0x341086){return{'model':db[_0x341086[_0x59a6('0x1e')]],'as':_0x341086['as'],'attributes':_0x341086['attributes']};}):[]};}):[]};}):[]:[]})[_0x59a6('0xe')](function(_0xa229c1){logger[_0x59a6('0xf')](_0x59a6('0x19'),_0x2736db);logger[_0x59a6('0x21')]('ShowSmsAccount',_0x2736db,JSON[_0x59a6('0x13')](_0xa229c1));_0x35901e(_0xa229c1);})['catch'](function(_0x1a39d7){logger[_0x59a6('0x14')](_0x59a6('0x19'),_0x1a39d7['message'],_0x2736db);_0x1be69c(_0x4380e6[_0x59a6('0x14')](0x1f4,_0x1a39d7[_0x59a6('0x16')]));});});}; \ No newline at end of file +var _0x27c6=['localhost','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount','find','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0x467511,_0x464ec3){var _0x3b54d6=function(_0x343cc9){while(--_0x343cc9){_0x467511['push'](_0x467511['shift']());}};_0x3b54d6(++_0x464ec3);}(_0x27c6,0x12c));var _0x627c=function(_0x29c896,_0x1084c3){_0x29c896=_0x29c896-0x0;var _0x2c654c=_0x27c6[_0x29c896];return _0x2c654c;};'use strict';var _=require('lodash');var util=require(_0x627c('0x0'));var moment=require('moment');var BPromise=require(_0x627c('0x1'));var rs=require(_0x627c('0x2'));var fs=require('fs');var Redis=require(_0x627c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x627c('0x4'))(_0x627c('0x5'));var config=require('../../config/environment');var jayson=require(_0x627c('0x6'));var client=jayson['client'][_0x627c('0x7')]({'port':0x232a});config['redis']=_[_0x627c('0x8')](config[_0x627c('0x9')],{'host':_0x627c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x627c('0x9')]));require(_0x627c('0xb'))[_0x627c('0xc')](socket);function respondWithRpcPromise(_0x3a8f9a,_0x4f4f10,_0x52dee5){return new BPromise(function(_0x565a0d,_0x9d5165){return client['request'](_0x3a8f9a,_0x52dee5)[_0x627c('0xd')](function(_0x388a84){logger[_0x627c('0xe')](_0x627c('0xf'),_0x4f4f10,_0x627c('0x10'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f4f10,'request\x20sent',JSON[_0x627c('0x11')](_0x388a84));if(_0x388a84[_0x627c('0x12')]){if(_0x388a84[_0x627c('0x12')][_0x627c('0x13')]===0x1f4){logger[_0x627c('0x12')](_0x627c('0xf'),_0x4f4f10,_0x388a84[_0x627c('0x12')][_0x627c('0x14')]);return _0x9d5165(_0x388a84[_0x627c('0x12')][_0x627c('0x14')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4f4f10,_0x388a84[_0x627c('0x12')]['message']);return _0x565a0d(_0x388a84[_0x627c('0x12')][_0x627c('0x14')]);}else{logger[_0x627c('0xe')]('SmsAccount,\x20%s,\x20%s',_0x4f4f10,_0x627c('0x10'));_0x565a0d(_0x388a84['result'][_0x627c('0x14')]);}})[_0x627c('0x15')](function(_0x189161){logger[_0x627c('0x12')](_0x627c('0xf'),_0x4f4f10,_0x189161);_0x9d5165(_0x189161);});});}exports[_0x627c('0x16')]=function(_0x446b93){var _0x741220=this;return new Promise(function(_0x4dd29e,_0x478a87){return db['SmsAccount'][_0x627c('0x17')]({'raw':_0x446b93[_0x627c('0x18')]?_0x446b93[_0x627c('0x18')][_0x627c('0x19')]===undefined?!![]:![]:!![],'where':_0x446b93[_0x627c('0x18')]?_0x446b93[_0x627c('0x18')][_0x627c('0x1a')]||null:null,'attributes':_0x446b93[_0x627c('0x18')]?_0x446b93[_0x627c('0x18')]['attributes']||null:null,'include':_0x446b93[_0x627c('0x18')]?_0x446b93['options'][_0x627c('0x1b')]?_[_0x627c('0x1c')](_0x446b93[_0x627c('0x18')][_0x627c('0x1b')],function(_0x1ed2d2){return{'model':db[_0x1ed2d2[_0x627c('0x1d')]],'as':_0x1ed2d2['as'],'attributes':_0x1ed2d2[_0x627c('0x1e')],'include':_0x1ed2d2['include']?_[_0x627c('0x1c')](_0x1ed2d2[_0x627c('0x1b')],function(_0x5efba8){return{'model':db[_0x5efba8[_0x627c('0x1d')]],'as':_0x5efba8['as'],'attributes':_0x5efba8[_0x627c('0x1e')],'include':_0x5efba8[_0x627c('0x1b')]?_[_0x627c('0x1c')](_0x5efba8[_0x627c('0x1b')],function(_0x220b82){return{'model':db[_0x220b82['model']],'as':_0x220b82['as'],'attributes':_0x220b82['attributes']};}):[]};}):[]};}):[]:[]})[_0x627c('0xd')](function(_0x4c2705){logger[_0x627c('0xe')]('ShowSmsAccount',_0x446b93);logger['debug']('ShowSmsAccount',_0x446b93,JSON[_0x627c('0x11')](_0x4c2705));_0x4dd29e(_0x4c2705);})['catch'](function(_0x30977f){logger[_0x627c('0x12')](_0x627c('0x16'),_0x30977f[_0x627c('0x14')],_0x446b93);_0x478a87(_0x741220[_0x627c('0x12')](0x1f4,_0x30977f[_0x627c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b23c14a..f36b9b8 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 _0x7d14=['smsAccount:','./smsAccount.events','save','update','removeListener','register'];(function(_0x4bfe5f,_0x45399e){var _0x2a2522=function(_0x58f426){while(--_0x58f426){_0x4bfe5f['push'](_0x4bfe5f['shift']());}};_0x2a2522(++_0x45399e);}(_0x7d14,0x6d));var _0x47d1=function(_0x43091a,_0x48ce84){_0x43091a=_0x43091a-0x0;var _0x1921f1=_0x7d14[_0x43091a];return _0x1921f1;};'use strict';var SmsAccountEvents=require(_0x47d1('0x0'));var events=[_0x47d1('0x1'),'remove',_0x47d1('0x2')];function createListener(_0x325761,_0x21f244){return function(_0x8645d1){_0x21f244['emit'](_0x325761,_0x8645d1);};}function removeListener(_0x37d8f2,_0x33fe33){return function(){SmsAccountEvents[_0x47d1('0x3')](_0x37d8f2,_0x33fe33);};}exports[_0x47d1('0x4')]=function(_0x1b2f47){for(var _0x550ee2=0x0,_0x533402=events['length'];_0x550ee2<_0x533402;_0x550ee2++){var _0x38e165=events[_0x550ee2];var _0x57d410=createListener(_0x47d1('0x5')+_0x38e165,_0x1b2f47);SmsAccountEvents['on'](_0x38e165,_0x57d410);}}; \ No newline at end of file +var _0x51c5=['save','remove','update','removeListener','register','length','smsAccount:','./smsAccount.events'];(function(_0x381271,_0x282e3f){var _0x2a68a6=function(_0x3f0e41){while(--_0x3f0e41){_0x381271['push'](_0x381271['shift']());}};_0x2a68a6(++_0x282e3f);}(_0x51c5,0x8f));var _0x551c=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x51c5[_0x4e7d25];return _0x526fe6;};'use strict';var SmsAccountEvents=require(_0x551c('0x0'));var events=[_0x551c('0x1'),_0x551c('0x2'),_0x551c('0x3')];function createListener(_0x3b6f53,_0x2279a3){return function(_0xe03709){_0x2279a3['emit'](_0x3b6f53,_0xe03709);};}function removeListener(_0x230657,_0x1639d0){return function(){SmsAccountEvents[_0x551c('0x4')](_0x230657,_0x1639d0);};}exports[_0x551c('0x5')]=function(_0xe0272c){for(var _0x1aa8df=0x0,_0x21dfa1=events[_0x551c('0x6')];_0x1aa8df<_0x21dfa1;_0x1aa8df++){var _0x4f3a0a=events[_0x1aa8df];var _0x414edb=createListener(_0x551c('0x7')+_0x4f3a0a,_0xe0272c);SmsAccountEvents['on'](_0x4f3a0a,_0x414edb);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 7b8ab7a..5f94769 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 _0xb176=['update','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x132d2c,_0x1e4a9b){var _0x419e6f=function(_0x202017){while(--_0x202017){_0x132d2c['push'](_0x132d2c['shift']());}};_0x419e6f(++_0x1e4a9b);}(_0xb176,0x1de));var _0x6b17=function(_0x9eafd4,_0x6c31df){_0x9eafd4=_0x9eafd4-0x0;var _0x390716=_0xb176[_0x9eafd4];return _0x390716;};'use strict';var multer=require(_0x6b17('0x0'));var util=require(_0x6b17('0x1'));var path=require(_0x6b17('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b17('0x3'));var router=express[_0x6b17('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6b17('0x5'));var config=require(_0x6b17('0x6'));var controller=require('./smsApplication.controller');router[_0x6b17('0x7')]('/',auth[_0x6b17('0x8')](),controller[_0x6b17('0x9')]);router['get'](_0x6b17('0xa'),auth['isAuthenticated'](),controller[_0x6b17('0xb')]);router[_0x6b17('0xc')]('/',auth[_0x6b17('0x8')](),controller[_0x6b17('0xd')]);router[_0x6b17('0xe')]('/:id',auth[_0x6b17('0x8')](),controller[_0x6b17('0xf')]);router['delete'](_0x6b17('0xa'),auth[_0x6b17('0x8')](),controller[_0x6b17('0x10')]);module['exports']=router; \ No newline at end of file +var _0xca7f=['index','/:id','show','post','create','put','update','exports','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated'];(function(_0x3f6b57,_0x4996a2){var _0x35b267=function(_0x2017f3){while(--_0x2017f3){_0x3f6b57['push'](_0x3f6b57['shift']());}};_0x35b267(++_0x4996a2);}(_0xca7f,0x1ac));var _0xfca7=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xca7f[_0x1e4f2d];return _0xd05ce5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfca7('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfca7('0x1'));var interaction=require(_0xfca7('0x2'));var config=require(_0xfca7('0x3'));var controller=require(_0xfca7('0x4'));router[_0xfca7('0x5')]('/',auth[_0xfca7('0x6')](),controller[_0xfca7('0x7')]);router[_0xfca7('0x5')](_0xfca7('0x8'),auth[_0xfca7('0x6')](),controller[_0xfca7('0x9')]);router[_0xfca7('0xa')]('/',auth[_0xfca7('0x6')](),controller[_0xfca7('0xb')]);router[_0xfca7('0xc')](_0xfca7('0x8'),auth['isAuthenticated'](),controller[_0xfca7('0xd')]);router['delete'](_0xfca7('0x8'),auth[_0xfca7('0x6')](),controller['destroy']);module[_0xfca7('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index fe8b6dd..c7617d2 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 _0x80de=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4fe8ce,_0x4007e3){var _0x338fa0=function(_0x444ecd){while(--_0x444ecd){_0x4fe8ce['push'](_0x4fe8ce['shift']());}};_0x338fa0(++_0x4007e3);}(_0x80de,0xb5));var _0xe80d=function(_0x445436,_0x3c462f){_0x445436=_0x445436-0x0;var _0x1c199f=_0x80de[_0x445436];return _0x1c199f;};'use strict';var Sequelize=require(_0xe80d('0x0'));module[_0xe80d('0x1')]={'priority':{'type':Sequelize[_0xe80d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe80d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe80d('0x3')]},'interval':{'type':Sequelize[_0xe80d('0x3')],'defaultValue':_0xe80d('0x4')}}; \ No newline at end of file +var _0x501b=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x4e82ff,_0x3cbf4b){var _0x495205=function(_0x21bc88){while(--_0x21bc88){_0x4e82ff['push'](_0x4e82ff['shift']());}};_0x495205(++_0x3cbf4b);}(_0x501b,0x13e));var _0xb501=function(_0x11b237,_0x135320){_0x11b237=_0x11b237-0x0;var _0x5932da=_0x501b[_0x11b237];return _0x5932da;};'use strict';var Sequelize=require(_0xb501('0x0'));module[_0xb501('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb501('0x2')},'appdata':{'type':Sequelize[_0xb501('0x3')]()},'description':{'type':Sequelize[_0xb501('0x4')]},'interval':{'type':Sequelize[_0xb501('0x4')],'defaultValue':_0xb501('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 56dbf3a..87bf790 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 _0xb2a6=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','SmsApplication','includeAll','include','catch','show','find','create','body','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x20e7c6,_0x11d21f){_0x20e7c6=_0x20e7c6-0x0;var _0x23b888=_0xb2a6[_0x20e7c6];return _0x23b888;};'use strict';var pdf=require(_0x6b2a('0x0'));var emlformat=require(_0x6b2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6b2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b2a('0x3'));var moment=require(_0x6b2a('0x4'));var BPromise=require(_0x6b2a('0x5'));var Mustache=require(_0x6b2a('0x6'));var util=require(_0x6b2a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b2a('0x8'));var fs=require('fs');var _=require(_0x6b2a('0x9'));var squel=require(_0x6b2a('0xa'));var crypto=require(_0x6b2a('0xb'));var jsforce=require(_0x6b2a('0xc'));var deskjs=require(_0x6b2a('0xd'));var toCsv=require(_0x6b2a('0xe'));var querystring=require(_0x6b2a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b2a('0x10'));var authService=require(_0x6b2a('0x11'));var qs=require(_0x6b2a('0x12'));var as=require(_0x6b2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b2a('0x14'))(_0x6b2a('0x15'));var utils=require(_0x6b2a('0x16'));var config=require(_0x6b2a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b2a('0x18'))['db'];function respondWithStatusCode(_0x2e8f05,_0x57047a){_0x57047a=_0x57047a||0xcc;return function(_0x461c95){if(_0x461c95){return _0x2e8f05[_0x6b2a('0x19')](_0x57047a);}return _0x2e8f05[_0x6b2a('0x1a')](_0x57047a)[_0x6b2a('0x1b')]();};}function respondWithResult(_0xb6c388,_0x246f92){_0x246f92=_0x246f92||0xc8;return function(_0x1ad2b1){if(_0x1ad2b1){return _0xb6c388['status'](_0x246f92)[_0x6b2a('0x1c')](_0x1ad2b1);}};}function respondWithFilteredResult(_0x261727,_0x20c428){return function(_0xd8c0f3){if(_0xd8c0f3){var _0x1f4d73=_0xd8c0f3[_0x6b2a('0x1d')],_0x58ad9f=_0x20c428[_0x6b2a('0x1e')],_0x5ad266=_0x20c428[_0x6b2a('0x1e')]+_0x20c428[_0x6b2a('0x1f')],_0x101bd5;if(_0x5ad266>=_0x1f4d73){_0x5ad266=_0x1f4d73;_0x101bd5=0xc8;}else{_0x101bd5=0xce;}_0x261727[_0x6b2a('0x1a')](_0x101bd5);return _0x261727['set']('Content-Range',_0x58ad9f+'-'+_0x5ad266+'/'+_0x1f4d73)[_0x6b2a('0x1c')](_0xd8c0f3);}return null;};}function patchUpdates(_0x4a71e1){return function(_0xfe576e){try{jsonpatch[_0x6b2a('0x20')](_0xfe576e,_0x4a71e1,!![]);}catch(_0x5cdda6){return BPromise[_0x6b2a('0x21')](_0x5cdda6);}return _0xfe576e[_0x6b2a('0x22')]();};}function saveUpdates(_0x9a61d8,_0x180726){return function(_0x4b39d1){if(_0x4b39d1){return _0x4b39d1[_0x6b2a('0x23')](_0x9a61d8)[_0x6b2a('0x24')](function(_0x5c5808){return _0x5c5808;});}return null;};}function removeEntity(_0x32fa10,_0x5ebf6a){return function(_0x2fbfd8){if(_0x2fbfd8){return _0x2fbfd8[_0x6b2a('0x25')]()['then'](function(){_0x32fa10[_0x6b2a('0x1a')](0xcc)[_0x6b2a('0x1b')]();});}};}function handleEntityNotFound(_0x5b669f,_0x30e47c){return function(_0x937c8b){if(!_0x937c8b){_0x5b669f[_0x6b2a('0x19')](0x194);}return _0x937c8b;};}function handleError(_0x1d92ad,_0x26da03){_0x26da03=_0x26da03||0x1f4;return function(_0x2284a3){logger[_0x6b2a('0x26')](_0x2284a3[_0x6b2a('0x27')]);if(_0x2284a3[_0x6b2a('0x28')]){delete _0x2284a3[_0x6b2a('0x28')];}_0x1d92ad[_0x6b2a('0x1a')](_0x26da03)[_0x6b2a('0x29')](_0x2284a3);};}exports[_0x6b2a('0x2a')]=function(_0x193e5a,_0xd01fdc){var _0x1b51f0={},_0x18b917={},_0x5acbbf={'count':0x0,'rows':[]};var _0x97b9b2=_[_0x6b2a('0x2b')](db['SmsApplication'][_0x6b2a('0x2c')],function(_0x52d110){return{'name':_0x52d110[_0x6b2a('0x2d')],'type':_0x52d110[_0x6b2a('0x2e')][_0x6b2a('0x2f')]};});_0x18b917[_0x6b2a('0x30')]=_[_0x6b2a('0x2b')](_0x97b9b2,_0x6b2a('0x28'));_0x18b917[_0x6b2a('0x31')]=_[_0x6b2a('0x32')](_0x193e5a[_0x6b2a('0x31')]);_0x18b917[_0x6b2a('0x33')]=_[_0x6b2a('0x34')](_0x18b917['model'],_0x18b917['query']);_0x1b51f0[_0x6b2a('0x35')]=_[_0x6b2a('0x34')](_0x18b917[_0x6b2a('0x30')],qs['fields'](_0x193e5a['query'][_0x6b2a('0x36')]));_0x1b51f0[_0x6b2a('0x35')]=_0x1b51f0[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0x1b51f0[_0x6b2a('0x35')]:_0x18b917[_0x6b2a('0x30')];if(!_0x193e5a[_0x6b2a('0x31')][_0x6b2a('0x38')](_0x6b2a('0x39'))){_0x1b51f0[_0x6b2a('0x1f')]=qs[_0x6b2a('0x1f')](_0x193e5a[_0x6b2a('0x31')][_0x6b2a('0x1f')]);_0x1b51f0[_0x6b2a('0x1e')]=qs[_0x6b2a('0x1e')](_0x193e5a['query'][_0x6b2a('0x1e')]);}_0x1b51f0[_0x6b2a('0x3a')]=qs[_0x6b2a('0x3b')](_0x193e5a['query'][_0x6b2a('0x3b')]);_0x1b51f0[_0x6b2a('0x3c')]=qs[_0x6b2a('0x33')](_['pick'](_0x193e5a[_0x6b2a('0x31')],_0x18b917[_0x6b2a('0x33')]),_0x97b9b2);if(_0x193e5a[_0x6b2a('0x31')]['filter']){_0x1b51f0['where']=_['merge'](_0x1b51f0['where'],{'$or':_['map'](_0x97b9b2,function(_0x43598c){if(_0x43598c['type']!==_0x6b2a('0x3d')){var _0x316ab5={};_0x316ab5[_0x43598c[_0x6b2a('0x28')]]={'$like':'%'+_0x193e5a[_0x6b2a('0x31')]['filter']+'%'};return _0x316ab5;}})});}_0x1b51f0=_[_0x6b2a('0x3e')]({},_0x1b51f0,_0x193e5a[_0x6b2a('0x3f')]);var _0x2b5659={'where':_0x1b51f0[_0x6b2a('0x3c')]};return db[_0x6b2a('0x40')]['count'](_0x2b5659)['then'](function(_0x486ce9){_0x5acbbf[_0x6b2a('0x1d')]=_0x486ce9;if(_0x193e5a['query'][_0x6b2a('0x41')]){_0x1b51f0[_0x6b2a('0x42')]=[{'all':!![]}];}return db[_0x6b2a('0x40')]['findAll'](_0x1b51f0);})['then'](function(_0x5e3b5d){_0x5acbbf['rows']=_0x5e3b5d;return _0x5acbbf;})[_0x6b2a('0x24')](respondWithFilteredResult(_0xd01fdc,_0x1b51f0))[_0x6b2a('0x43')](handleError(_0xd01fdc,null));};exports[_0x6b2a('0x44')]=function(_0x5d652f,_0x4a83e3){var _0x37c8e6={'raw':!![],'where':{'id':_0x5d652f['params']['id']}},_0x4caa1e={};_0x4caa1e[_0x6b2a('0x30')]=_[_0x6b2a('0x32')](db['SmsApplication'][_0x6b2a('0x2c')]);_0x4caa1e[_0x6b2a('0x31')]=_[_0x6b2a('0x32')](_0x5d652f[_0x6b2a('0x31')]);_0x4caa1e['filters']=_['intersection'](_0x4caa1e['model'],_0x4caa1e[_0x6b2a('0x31')]);_0x37c8e6[_0x6b2a('0x35')]=_['intersection'](_0x4caa1e[_0x6b2a('0x30')],qs['fields'](_0x5d652f[_0x6b2a('0x31')][_0x6b2a('0x36')]));_0x37c8e6[_0x6b2a('0x35')]=_0x37c8e6[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0x37c8e6['attributes']:_0x4caa1e[_0x6b2a('0x30')];if(_0x5d652f[_0x6b2a('0x31')][_0x6b2a('0x41')]){_0x37c8e6[_0x6b2a('0x42')]=[{'all':!![]}];}_0x37c8e6=_[_0x6b2a('0x3e')]({},_0x37c8e6,_0x5d652f[_0x6b2a('0x3f')]);return db[_0x6b2a('0x40')][_0x6b2a('0x45')](_0x37c8e6)[_0x6b2a('0x24')](handleEntityNotFound(_0x4a83e3,null))[_0x6b2a('0x24')](respondWithResult(_0x4a83e3,null))[_0x6b2a('0x43')](handleError(_0x4a83e3,null));};exports[_0x6b2a('0x46')]=function(_0x5548ab,_0x3059ed){return db[_0x6b2a('0x40')][_0x6b2a('0x46')](_0x5548ab[_0x6b2a('0x47')],{})['then'](respondWithResult(_0x3059ed,0xc9))[_0x6b2a('0x43')](handleError(_0x3059ed,null));};exports[_0x6b2a('0x23')]=function(_0x2ca15b,_0x2bf58b){if(_0x2ca15b[_0x6b2a('0x47')]['id']){delete _0x2ca15b[_0x6b2a('0x47')]['id'];}return db['SmsApplication'][_0x6b2a('0x45')]({'where':{'id':_0x2ca15b[_0x6b2a('0x48')]['id']}})[_0x6b2a('0x24')](handleEntityNotFound(_0x2bf58b,null))[_0x6b2a('0x24')](saveUpdates(_0x2ca15b[_0x6b2a('0x47')],null))['then'](respondWithResult(_0x2bf58b,null))[_0x6b2a('0x43')](handleError(_0x2bf58b,null));};exports[_0x6b2a('0x25')]=function(_0x2fb896,_0x85b62a){return db[_0x6b2a('0x40')][_0x6b2a('0x45')]({'where':{'id':_0x2fb896['params']['id']}})[_0x6b2a('0x24')](handleEntityNotFound(_0x85b62a,null))['then'](removeEntity(_0x85b62a,null))[_0x6b2a('0x43')](handleError(_0x85b62a,null));}; \ No newline at end of file +var _0xc8be=['map','SmsApplication','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','keys','includeAll','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name'];(function(_0x48303b,_0x1c2207){var _0x39226e=function(_0x56703e){while(--_0x56703e){_0x48303b['push'](_0x48303b['shift']());}};_0x39226e(++_0x1c2207);}(_0xc8be,0x66));var _0xec8b=function(_0x5e85a7,_0x180744){_0x5e85a7=_0x5e85a7-0x0;var _0x4768b1=_0xc8be[_0x5e85a7];return _0x4768b1;};'use strict';var pdf=require(_0xec8b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec8b('0x1'));var zipdir=require(_0xec8b('0x2'));var jsonpatch=require(_0xec8b('0x3'));var rp=require(_0xec8b('0x4'));var moment=require('moment');var BPromise=require(_0xec8b('0x5'));var Mustache=require('mustache');var util=require(_0xec8b('0x6'));var path=require('path');var sox=require(_0xec8b('0x7'));var csv=require(_0xec8b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec8b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec8b('0xa'));var deskjs=require(_0xec8b('0xb'));var toCsv=require(_0xec8b('0x8'));var querystring=require(_0xec8b('0xc'));var Papa=require(_0xec8b('0xd'));var Redis=require(_0xec8b('0xe'));var authService=require(_0xec8b('0xf'));var qs=require(_0xec8b('0x10'));var as=require(_0xec8b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec8b('0x12'));var utils=require(_0xec8b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xec8b('0x14'));var db=require(_0xec8b('0x15'))['db'];function respondWithStatusCode(_0x4ca809,_0x1995c1){_0x1995c1=_0x1995c1||0xcc;return function(_0x422fa4){if(_0x422fa4){return _0x4ca809['sendStatus'](_0x1995c1);}return _0x4ca809[_0xec8b('0x16')](_0x1995c1)[_0xec8b('0x17')]();};}function respondWithResult(_0x13f906,_0x5690ae){_0x5690ae=_0x5690ae||0xc8;return function(_0xf45552){if(_0xf45552){return _0x13f906[_0xec8b('0x16')](_0x5690ae)['json'](_0xf45552);}};}function respondWithFilteredResult(_0xce7885,_0xaeb0e8){return function(_0x58b20c){if(_0x58b20c){var _0x20b6d3=_0x58b20c[_0xec8b('0x18')],_0x37d573=_0xaeb0e8['offset'],_0x108044=_0xaeb0e8['offset']+_0xaeb0e8[_0xec8b('0x19')],_0x3102f2;if(_0x108044>=_0x20b6d3){_0x108044=_0x20b6d3;_0x3102f2=0xc8;}else{_0x3102f2=0xce;}_0xce7885[_0xec8b('0x16')](_0x3102f2);return _0xce7885[_0xec8b('0x1a')](_0xec8b('0x1b'),_0x37d573+'-'+_0x108044+'/'+_0x20b6d3)['json'](_0x58b20c);}return null;};}function patchUpdates(_0x2c0057){return function(_0x2fc86){try{jsonpatch[_0xec8b('0x1c')](_0x2fc86,_0x2c0057,!![]);}catch(_0x471996){return BPromise[_0xec8b('0x1d')](_0x471996);}return _0x2fc86[_0xec8b('0x1e')]();};}function saveUpdates(_0x87ed51,_0xc28469){return function(_0x3e1d73){if(_0x3e1d73){return _0x3e1d73[_0xec8b('0x1f')](_0x87ed51)['then'](function(_0x34b786){return _0x34b786;});}return null;};}function removeEntity(_0x4201c9,_0x5d393b){return function(_0x886b1f){if(_0x886b1f){return _0x886b1f['destroy']()[_0xec8b('0x20')](function(){_0x4201c9[_0xec8b('0x16')](0xcc)[_0xec8b('0x17')]();});}};}function handleEntityNotFound(_0x3b0e3b,_0xccd17d){return function(_0x3cb789){if(!_0x3cb789){_0x3b0e3b[_0xec8b('0x21')](0x194);}return _0x3cb789;};}function handleError(_0x11afdf,_0xfa0e21){_0xfa0e21=_0xfa0e21||0x1f4;return function(_0x437b20){logger['error'](_0x437b20[_0xec8b('0x22')]);if(_0x437b20[_0xec8b('0x23')]){delete _0x437b20['name'];}_0x11afdf[_0xec8b('0x16')](_0xfa0e21)['send'](_0x437b20);};}exports['index']=function(_0x1344d0,_0x57b70e){var _0x96ff6d={},_0x5929b9={},_0x4b950b={'count':0x0,'rows':[]};var _0x29c5=_[_0xec8b('0x24')](db[_0xec8b('0x25')]['rawAttributes'],function(_0x3167d0){return{'name':_0x3167d0[_0xec8b('0x26')],'type':_0x3167d0[_0xec8b('0x27')][_0xec8b('0x28')]};});_0x5929b9[_0xec8b('0x29')]=_[_0xec8b('0x24')](_0x29c5,_0xec8b('0x23'));_0x5929b9[_0xec8b('0x2a')]=_['keys'](_0x1344d0['query']);_0x5929b9[_0xec8b('0x2b')]=_[_0xec8b('0x2c')](_0x5929b9[_0xec8b('0x29')],_0x5929b9['query']);_0x96ff6d[_0xec8b('0x2d')]=_[_0xec8b('0x2c')](_0x5929b9[_0xec8b('0x29')],qs[_0xec8b('0x2e')](_0x1344d0['query']['fields']));_0x96ff6d[_0xec8b('0x2d')]=_0x96ff6d[_0xec8b('0x2d')][_0xec8b('0x2f')]?_0x96ff6d[_0xec8b('0x2d')]:_0x5929b9[_0xec8b('0x29')];if(!_0x1344d0['query'][_0xec8b('0x30')](_0xec8b('0x31'))){_0x96ff6d['limit']=qs[_0xec8b('0x19')](_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x19')]);_0x96ff6d[_0xec8b('0x32')]=qs['offset'](_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x32')]);}_0x96ff6d['order']=qs[_0xec8b('0x33')](_0x1344d0['query'][_0xec8b('0x33')]);_0x96ff6d[_0xec8b('0x34')]=qs[_0xec8b('0x2b')](_[_0xec8b('0x35')](_0x1344d0['query'],_0x5929b9[_0xec8b('0x2b')]),_0x29c5);if(_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x36')]){_0x96ff6d[_0xec8b('0x34')]=_['merge'](_0x96ff6d['where'],{'$or':_['map'](_0x29c5,function(_0x4cd469){if(_0x4cd469[_0xec8b('0x27')]!=='VIRTUAL'){var _0x515778={};_0x515778[_0x4cd469['name']]={'$like':'%'+_0x1344d0[_0xec8b('0x2a')][_0xec8b('0x36')]+'%'};return _0x515778;}})});}_0x96ff6d=_[_0xec8b('0x37')]({},_0x96ff6d,_0x1344d0[_0xec8b('0x38')]);var _0x21d2e5={'where':_0x96ff6d['where']};return db[_0xec8b('0x25')][_0xec8b('0x18')](_0x21d2e5)[_0xec8b('0x20')](function(_0x515b67){_0x4b950b[_0xec8b('0x18')]=_0x515b67;if(_0x1344d0[_0xec8b('0x2a')]['includeAll']){_0x96ff6d[_0xec8b('0x39')]=[{'all':!![]}];}return db[_0xec8b('0x25')][_0xec8b('0x3a')](_0x96ff6d);})[_0xec8b('0x20')](function(_0x2f30ef){_0x4b950b[_0xec8b('0x3b')]=_0x2f30ef;return _0x4b950b;})[_0xec8b('0x20')](respondWithFilteredResult(_0x57b70e,_0x96ff6d))[_0xec8b('0x3c')](handleError(_0x57b70e,null));};exports[_0xec8b('0x3d')]=function(_0x44e0e8,_0x308ff7){var _0x180e1f={'raw':!![],'where':{'id':_0x44e0e8['params']['id']}},_0x1ddccd={};_0x1ddccd[_0xec8b('0x29')]=_['keys'](db[_0xec8b('0x25')][_0xec8b('0x3e')]);_0x1ddccd['query']=_[_0xec8b('0x3f')](_0x44e0e8['query']);_0x1ddccd['filters']=_[_0xec8b('0x2c')](_0x1ddccd[_0xec8b('0x29')],_0x1ddccd[_0xec8b('0x2a')]);_0x180e1f['attributes']=_['intersection'](_0x1ddccd[_0xec8b('0x29')],qs['fields'](_0x44e0e8['query'][_0xec8b('0x2e')]));_0x180e1f[_0xec8b('0x2d')]=_0x180e1f[_0xec8b('0x2d')][_0xec8b('0x2f')]?_0x180e1f['attributes']:_0x1ddccd[_0xec8b('0x29')];if(_0x44e0e8[_0xec8b('0x2a')][_0xec8b('0x40')]){_0x180e1f[_0xec8b('0x39')]=[{'all':!![]}];}_0x180e1f=_[_0xec8b('0x37')]({},_0x180e1f,_0x44e0e8['options']);return db[_0xec8b('0x25')][_0xec8b('0x41')](_0x180e1f)[_0xec8b('0x20')](handleEntityNotFound(_0x308ff7,null))['then'](respondWithResult(_0x308ff7,null))['catch'](handleError(_0x308ff7,null));};exports[_0xec8b('0x42')]=function(_0x54e0b6,_0x4c6575){return db[_0xec8b('0x25')][_0xec8b('0x42')](_0x54e0b6['body'],{})[_0xec8b('0x20')](respondWithResult(_0x4c6575,0xc9))[_0xec8b('0x3c')](handleError(_0x4c6575,null));};exports[_0xec8b('0x1f')]=function(_0x4fc726,_0x162918){if(_0x4fc726[_0xec8b('0x43')]['id']){delete _0x4fc726[_0xec8b('0x43')]['id'];}return db[_0xec8b('0x25')][_0xec8b('0x41')]({'where':{'id':_0x4fc726['params']['id']}})['then'](handleEntityNotFound(_0x162918,null))[_0xec8b('0x20')](saveUpdates(_0x4fc726[_0xec8b('0x43')],null))['then'](respondWithResult(_0x162918,null))[_0xec8b('0x3c')](handleError(_0x162918,null));};exports['destroy']=function(_0x24859d,_0x5d93cd){return db['SmsApplication'][_0xec8b('0x41')]({'where':{'id':_0x24859d[_0xec8b('0x44')]['id']}})[_0xec8b('0x20')](handleEntityNotFound(_0x5d93cd,null))['then'](removeEntity(_0x5d93cd,null))['catch'](handleError(_0x5d93cd,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8172d93..11fbc2e 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 _0x0a2c=['./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0x0a2c,0x123));var _0xc0a2=function(_0x3aee09,_0x3c77c8){_0x3aee09=_0x3aee09-0x0;var _0x4329d4=_0x0a2c[_0x3aee09];return _0x4329d4;};'use strict';var _=require(_0xc0a2('0x0'));var util=require('util');var logger=require(_0xc0a2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc0a2('0x2'));var rp=require(_0xc0a2('0x3'));var fs=require('fs');var path=require(_0xc0a2('0x4'));var rimraf=require(_0xc0a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xc0a2('0x6'));module['exports']=function(_0x6544e9,_0x56d751){return _0x6544e9[_0xc0a2('0x7')](_0xc0a2('0x8'),attributes,{'tableName':_0xc0a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0a2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1c59=['request-promise','path','rimraf','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x4c74f4,_0x2f93c4){var _0x5aaee1=function(_0x41326b){while(--_0x41326b){_0x4c74f4['push'](_0x4c74f4['shift']());}};_0x5aaee1(++_0x2f93c4);}(_0x1c59,0x11c));var _0x91c5=function(_0x5cd082,_0x149ca3){_0x5cd082=_0x5cd082-0x0;var _0x34e4c8=_0x1c59[_0x5cd082];return _0x34e4c8;};'use strict';var _=require(_0x91c5('0x0'));var util=require(_0x91c5('0x1'));var logger=require(_0x91c5('0x2'))('api');var moment=require(_0x91c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x91c5('0x4'));var fs=require('fs');var path=require(_0x91c5('0x5'));var rimraf=require(_0x91c5('0x6'));var config=require('../../config/environment');var attributes=require(_0x91c5('0x7'));module['exports']=function(_0x46bae7,_0x42aeb5){return _0x46bae7[_0x91c5('0x8')](_0x91c5('0x9'),attributes,{'tableName':_0x91c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x91c5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index de95330..286d5bc 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 _0x49df=['../../config/environment','jayson/promise','client','http','request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SmsApplication,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e266f,_0x134719){var _0x2e531c=function(_0x6076e1){while(--_0x6076e1){_0x5e266f['push'](_0x5e266f['shift']());}};_0x2e531c(++_0x134719);}(_0x49df,0xad));var _0xf49d=function(_0xbcbd76,_0x25722b){_0xbcbd76=_0xbcbd76-0x0;var _0x503680=_0x49df[_0xbcbd76];return _0x503680;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf49d('0x0'));var BPromise=require(_0xf49d('0x1'));var rs=require(_0xf49d('0x2'));var fs=require('fs');var Redis=require(_0xf49d('0x3'));var db=require(_0xf49d('0x4'))['db'];var utils=require(_0xf49d('0x5'));var logger=require(_0xf49d('0x6'))('rpc');var config=require(_0xf49d('0x7'));var jayson=require(_0xf49d('0x8'));var client=jayson[_0xf49d('0x9')][_0xf49d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aaf37,_0x29b82e,_0x4e8b5e){return new BPromise(function(_0xadfde5,_0x36ed1d){return client[_0xf49d('0xb')](_0x1aaf37,_0x4e8b5e)['then'](function(_0x5aca77){logger[_0xf49d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x29b82e,'request\x20sent');logger[_0xf49d('0xd')](_0xf49d('0xe'),_0x29b82e,_0xf49d('0xf'),JSON['stringify'](_0x5aca77));if(_0x5aca77[_0xf49d('0x10')]){if(_0x5aca77[_0xf49d('0x10')]['code']===0x1f4){logger[_0xf49d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x29b82e,_0x5aca77['error'][_0xf49d('0x11')]);return _0x36ed1d(_0x5aca77['error'][_0xf49d('0x11')]);}logger[_0xf49d('0x10')](_0xf49d('0x12'),_0x29b82e,_0x5aca77['error'][_0xf49d('0x11')]);return _0xadfde5(_0x5aca77[_0xf49d('0x10')][_0xf49d('0x11')]);}else{logger['info'](_0xf49d('0x12'),_0x29b82e,_0xf49d('0xf'));_0xadfde5(_0x5aca77[_0xf49d('0x13')][_0xf49d('0x11')]);}})['catch'](function(_0x2927b9){logger[_0xf49d('0x10')](_0xf49d('0x12'),_0x29b82e,_0x2927b9);_0x36ed1d(_0x2927b9);});});} \ No newline at end of file +var _0x9658=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x6d1330,_0xd87fc9){var _0x20776e=function(_0x2593b6){while(--_0x2593b6){_0x6d1330['push'](_0x6d1330['shift']());}};_0x20776e(++_0xd87fc9);}(_0x9658,0x6f));var _0x8965=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x9658[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var moment=require(_0x8965('0x1'));var BPromise=require(_0x8965('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8965('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8965('0x4'));var logger=require(_0x8965('0x5'))(_0x8965('0x6'));var config=require('../../config/environment');var jayson=require(_0x8965('0x7'));var client=jayson[_0x8965('0x8')][_0x8965('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x290f30,_0x271060,_0x27b334){return new BPromise(function(_0x1e7d61,_0xe14503){return client[_0x8965('0xa')](_0x290f30,_0x27b334)[_0x8965('0xb')](function(_0x214249){logger[_0x8965('0xc')](_0x8965('0xd'),_0x271060,_0x8965('0xe'));logger[_0x8965('0xf')](_0x8965('0x10'),_0x271060,_0x8965('0xe'),JSON[_0x8965('0x11')](_0x214249));if(_0x214249[_0x8965('0x12')]){if(_0x214249['error'][_0x8965('0x13')]===0x1f4){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0xe14503(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}logger[_0x8965('0x12')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x214249[_0x8965('0x12')][_0x8965('0x14')]);return _0x1e7d61(_0x214249[_0x8965('0x12')][_0x8965('0x14')]);}else{logger[_0x8965('0xc')]('SmsApplication,\x20%s,\x20%s',_0x271060,_0x8965('0xe'));_0x1e7d61(_0x214249[_0x8965('0x15')][_0x8965('0x14')]);}})[_0x8965('0x16')](function(_0x5c7d55){logger[_0x8965('0x12')](_0x8965('0xd'),_0x271060,_0x5c7d55);_0xe14503(_0x5c7d55);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5df7f1a..e0f54c8 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 _0xd515=['/:id','show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xd515,0x168));var _0x5d51=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xd515[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0x5d51('0x0'));var util=require('util');var path=require(_0x5d51('0x1'));var timeout=require(_0x5d51('0x2'));var express=require('express');var router=express[_0x5d51('0x3')]();var auth=require(_0x5d51('0x4'));var interaction=require(_0x5d51('0x5'));var config=require(_0x5d51('0x6'));var controller=require(_0x5d51('0x7'));router[_0x5d51('0x8')]('/',auth[_0x5d51('0x9')](),controller[_0x5d51('0xa')]);router['get']('/describe',auth[_0x5d51('0x9')](),controller[_0x5d51('0xb')]);router[_0x5d51('0x8')](_0x5d51('0xc'),auth[_0x5d51('0x9')](),controller[_0x5d51('0xd')]);router[_0x5d51('0x8')]('/:id/messages',auth[_0x5d51('0x9')](),controller[_0x5d51('0xe')]);router['get'](_0x5d51('0xf'),auth[_0x5d51('0x9')](),controller['download']);router[_0x5d51('0x10')]('/',auth[_0x5d51('0x9')](),controller[_0x5d51('0x11')]);router[_0x5d51('0x10')](_0x5d51('0x12'),auth[_0x5d51('0x9')](),controller[_0x5d51('0x13')]);router[_0x5d51('0x10')](_0x5d51('0x14'),auth[_0x5d51('0x9')](),interaction['tracked'](_0x5d51('0x15'),_0x5d51('0x16')),controller[_0x5d51('0x17')]);router[_0x5d51('0x18')](_0x5d51('0xc'),auth[_0x5d51('0x9')](),interaction[_0x5d51('0x19')](_0x5d51('0x15'),_0x5d51('0x1a')),controller[_0x5d51('0x1b')]);router['delete'](_0x5d51('0xc'),auth[_0x5d51('0x9')](),interaction[_0x5d51('0x19')]('sms',_0x5d51('0x1c')),controller[_0x5d51('0x1d')]);router[_0x5d51('0x1e')](_0x5d51('0x14'),auth[_0x5d51('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc863=['sms','smsinteraction:addtags','addTags','put','/:id','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc863,0x155));var _0x3c86=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xc863[_0xf50820];return _0x2a9b10;};'use strict';var multer=require('multer');var util=require(_0x3c86('0x0'));var path=require(_0x3c86('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c86('0x2'));var router=express[_0x3c86('0x3')]();var auth=require(_0x3c86('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsInteraction.controller');router[_0x3c86('0x5')]('/',auth[_0x3c86('0x6')](),controller[_0x3c86('0x7')]);router[_0x3c86('0x5')](_0x3c86('0x8'),auth[_0x3c86('0x6')](),controller[_0x3c86('0x9')]);router[_0x3c86('0x5')]('/:id',auth[_0x3c86('0x6')](),controller[_0x3c86('0xa')]);router['get'](_0x3c86('0xb'),auth[_0x3c86('0x6')](),controller[_0x3c86('0xc')]);router['get'](_0x3c86('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x3c86('0xe')]('/',auth[_0x3c86('0x6')](),controller[_0x3c86('0xf')]);router['post'](_0x3c86('0xb'),auth['isAuthenticated'](),controller[_0x3c86('0x10')]);router[_0x3c86('0xe')](_0x3c86('0x11'),auth['isAuthenticated'](),interaction[_0x3c86('0x12')](_0x3c86('0x13'),_0x3c86('0x14')),controller[_0x3c86('0x15')]);router[_0x3c86('0x16')](_0x3c86('0x17'),auth[_0x3c86('0x6')](),interaction[_0x3c86('0x12')](_0x3c86('0x13'),'smsinteraction:update'),controller[_0x3c86('0x18')]);router[_0x3c86('0x19')](_0x3c86('0x17'),auth[_0x3c86('0x6')](),interaction[_0x3c86('0x12')](_0x3c86('0x13'),_0x3c86('0x1a')),controller[_0x3c86('0x1b')]);router[_0x3c86('0x19')](_0x3c86('0x11'),auth[_0x3c86('0x6')](),controller[_0x3c86('0x1c')]);module[_0x3c86('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 f52941a..71cff58 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 _0x35c4=['out','sequelize','moment','DATE','STRING','ENUM'];(function(_0x1394a2,_0x533264){var _0x31dcd1=function(_0x58c693){while(--_0x58c693){_0x1394a2['push'](_0x1394a2['shift']());}};_0x31dcd1(++_0x533264);}(_0x35c4,0x73));var _0x435c=function(_0x1dbd39,_0x1c9841){_0x1dbd39=_0x1dbd39-0x0;var _0x2eb447=_0x35c4[_0x1dbd39];return _0x2eb447;};'use strict';var Sequelize=require(_0x435c('0x0'));var moment=require(_0x435c('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x435c('0x2')]},'disposition':{'type':Sequelize[_0x435c('0x3')]},'secondDisposition':{'type':Sequelize[_0x435c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x435c('0x3')]},'phone':{'type':Sequelize[_0x435c('0x3')]},'read1stAt':{'type':Sequelize[_0x435c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x435c('0x4')]('in',_0x435c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x435c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x435c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3ef8=['exports','STRING','ENUM','out','DATE','sequelize'];(function(_0x1f2ef2,_0x5ae3a7){var _0x31bce2=function(_0x5a7e1c){while(--_0x5a7e1c){_0x1f2ef2['push'](_0x1f2ef2['shift']());}};_0x31bce2(++_0x5ae3a7);}(_0x3ef8,0xef));var _0x83ef=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3ef8[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x83ef('0x0'));var moment=require('moment');module[_0x83ef('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x83ef('0x2')]},'thirdDisposition':{'type':Sequelize[_0x83ef('0x2')]},'note':{'type':Sequelize[_0x83ef('0x2')]},'phone':{'type':Sequelize[_0x83ef('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x83ef('0x3')]('in',_0x83ef('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x83ef('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x83ef('0x3')]('in',_0x83ef('0x4')),'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 fb04e16..2c91b2e 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 _0x7548=['isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','a.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','omit','ids','getMessages','findOne','rawAttributes','pick','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','lastName','direction','SmsAccount','Account','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','N.A.','closedAt','disposition','Messages','out','System','Contact','firstName','secret','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','SmsInteraction','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0x7548,0x15c));var _0x8754=function(_0x5e4d39,_0x4bc6a3){_0x5e4d39=_0x5e4d39-0x0;var _0x57657f=_0x7548[_0x5e4d39];return _0x57657f;};'use strict';var pdf=require(_0x8754('0x0'));var emlformat=require(_0x8754('0x1'));var rimraf=require(_0x8754('0x2'));var zipdir=require(_0x8754('0x3'));var jsonpatch=require(_0x8754('0x4'));var rp=require(_0x8754('0x5'));var moment=require(_0x8754('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8754('0x7'));var path=require(_0x8754('0x8'));var sox=require(_0x8754('0x9'));var csv=require(_0x8754('0xa'));var ejs=require(_0x8754('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8754('0xc'));var crypto=require(_0x8754('0xd'));var jsforce=require(_0x8754('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8754('0xf'));var Redis=require(_0x8754('0x10'));var authService=require(_0x8754('0x11'));var qs=require(_0x8754('0x12'));var as=require(_0x8754('0x13'));var hardwareService=require(_0x8754('0x14'));var logger=require(_0x8754('0x15'))(_0x8754('0x16'));var utils=require(_0x8754('0x17'));var config=require(_0x8754('0x18'));var licenseUtil=require(_0x8754('0x19'));var db=require(_0x8754('0x1a'))['db'];config[_0x8754('0x1b')]=_[_0x8754('0x1c')](config[_0x8754('0x1b')],{'host':_0x8754('0x1d'),'port':0x18eb});var socket=require(_0x8754('0x1e'))(new Redis(config['redis']));require(_0x8754('0x1f'))[_0x8754('0x20')](socket);function respondWithStatusCode(_0x5b53ea,_0xf31c29){_0xf31c29=_0xf31c29||0xcc;return function(_0xabaacd){if(_0xabaacd){return _0x5b53ea[_0x8754('0x21')](_0xf31c29);}return _0x5b53ea['status'](_0xf31c29)[_0x8754('0x22')]();};}function respondWithResult(_0x424c2e,_0x1b7372){_0x1b7372=_0x1b7372||0xc8;return function(_0x11943a){if(_0x11943a){return _0x424c2e[_0x8754('0x23')](_0x1b7372)[_0x8754('0x24')](_0x11943a);}};}function respondWithFilteredResult(_0x3644e5,_0x418f0a){return function(_0x41fcde){if(_0x41fcde){var _0x3c04f7=_0x41fcde['count'],_0xe0fa60=_0x418f0a[_0x8754('0x25')],_0x500391=_0x418f0a[_0x8754('0x25')]+_0x418f0a[_0x8754('0x26')],_0x55612b;if(_0x500391>=_0x3c04f7){_0x500391=_0x3c04f7;_0x55612b=0xc8;}else{_0x55612b=0xce;}_0x3644e5[_0x8754('0x23')](_0x55612b);return _0x3644e5[_0x8754('0x27')](_0x8754('0x28'),_0xe0fa60+'-'+_0x500391+'/'+_0x3c04f7)['json'](_0x41fcde);}return null;};}function patchUpdates(_0x37b8fc){return function(_0x5335c1){try{jsonpatch[_0x8754('0x29')](_0x5335c1,_0x37b8fc,!![]);}catch(_0x4e9f41){return BPromise[_0x8754('0x2a')](_0x4e9f41);}return _0x5335c1['save']();};}function saveUpdates(_0x2e07cd,_0x2dbbab){return function(_0x9a7cf8){if(_0x9a7cf8){return _0x9a7cf8[_0x8754('0x2b')](_0x2e07cd)[_0x8754('0x2c')](function(_0x347d9c){return _0x347d9c;});}return null;};}function removeEntity(_0x2bfbd6,_0x253812){return function(_0x1c31ea){if(_0x1c31ea){return _0x1c31ea[_0x8754('0x2d')]()[_0x8754('0x2c')](function(){_0x2bfbd6[_0x8754('0x23')](0xcc)[_0x8754('0x22')]();});}};}function handleEntityNotFound(_0x4882af,_0x3b04b1){return function(_0x38d80c){if(!_0x38d80c){_0x4882af['sendStatus'](0x194);}return _0x38d80c;};}function handleError(_0x2def92,_0x304e16){_0x304e16=_0x304e16||0x1f4;return function(_0x261468){logger[_0x8754('0x2e')](_0x261468[_0x8754('0x2f')]);if(_0x261468[_0x8754('0x30')]){delete _0x261468[_0x8754('0x30')];}_0x2def92[_0x8754('0x23')](_0x304e16)[_0x8754('0x31')](_0x261468);};}function getInteractionUsers(_0x358924,_0x17b684){return new BPromise(function(_0x4a6514,_0xf2f3fb){try{if(_0x17b684[_0x358924['id']]){_0x358924[_0x8754('0x32')]=_[_0x8754('0x33')](_0x17b684[_0x358924['id']],function(_0x4ec781){return{'id':_0x4ec781['id'],'fullname':_0x4ec781[_0x8754('0x34')]};});}}catch(_0x483c80){_0xf2f3fb(_0x483c80);}_0x4a6514(_0x358924);});}function getInteractionTags(_0x37d379,_0x3cf18f){return new BPromise(function(_0x40f0f8,_0x44ecbc){try{if(_0x37d379['TagIds']){_0x37d379['Tags']=[];_0x37d379[_0x8754('0x35')][_0x8754('0x36')](',')[_0x8754('0x37')](function(_0x31f50f){_0x37d379[_0x8754('0x38')][_0x8754('0x39')](_0x3cf18f[_0x31f50f]);});}delete _0x37d379[_0x8754('0x35')];}catch(_0x439991){_0x44ecbc(_0x439991);}_0x40f0f8(_0x37d379);});}function updateSmsInteraction(_0x5840e4,_0x34970a,_0x5e9c1f){return new BPromise(function(_0x48f9e6,_0xe1afc4){return getInteractionUsers(_0x5840e4,_0x5e9c1f)[_0x8754('0x2c')](function(_0x29d1c7){return getInteractionTags(_0x29d1c7,_0x34970a);})[_0x8754('0x2c')](function(_0x397186){_0x48f9e6(_0x397186);})['catch'](function(_0x369046){_0xe1afc4(_0x369046);});});}exports['index']=function(_0x3bab81,_0x414bef){var _0x3846be={},_0x1a6244={},_0x4be467={'count':0x0,'rows':[]};var _0x53105f=_[_0x8754('0x33')](db[_0x8754('0x3a')]['rawAttributes'],function(_0x1e112e){return{'name':_0x1e112e[_0x8754('0x3b')],'type':_0x1e112e[_0x8754('0x3c')]['key']};});_0x1a6244[_0x8754('0x3d')]=_[_0x8754('0x33')](_0x53105f,_0x8754('0x30'));_0x1a6244[_0x8754('0x3e')]=_[_0x8754('0x3f')](_0x3bab81[_0x8754('0x3e')]);_0x1a6244['filters']=_[_0x8754('0x40')](_0x1a6244[_0x8754('0x3d')],_0x1a6244[_0x8754('0x3e')]);_0x3846be[_0x8754('0x41')]=_[_0x8754('0x40')](_0x1a6244[_0x8754('0x3d')],qs['fields'](_0x3bab81[_0x8754('0x3e')][_0x8754('0x42')]));_0x3846be[_0x8754('0x41')]=_0x3846be[_0x8754('0x41')][_0x8754('0x43')]?_0x3846be[_0x8754('0x41')]:_0x1a6244[_0x8754('0x3d')];if(!_0x3bab81[_0x8754('0x3e')][_0x8754('0x44')](_0x8754('0x45'))){_0x3846be[_0x8754('0x26')]=qs[_0x8754('0x26')](_0x3bab81[_0x8754('0x3e')][_0x8754('0x26')]);_0x3846be['offset']=qs[_0x8754('0x25')](_0x3bab81[_0x8754('0x3e')][_0x8754('0x25')]);}_0x3846be[_0x8754('0x46')]=qs['sort'](_0x3bab81[_0x8754('0x3e')][_0x8754('0x47')]);_0x3846be['where']=qs['filters'](_['pick'](_0x3bab81[_0x8754('0x3e')],_0x1a6244[_0x8754('0x48')]),_0x53105f);var _0x58ea77=[];var _0x286ac5=squel['select']()[_0x8754('0x49')]('id')[_0x8754('0x49')]('name')['field'](_0x8754('0x4a'))[_0x8754('0x4b')](_0x8754('0x4c'));var _0x5beb3d=squel['select']()[_0x8754('0x49')](_0x8754('0x4d'))[_0x8754('0x49')](_0x8754('0x4e'))[_0x8754('0x49')](_0x8754('0x4f'))[_0x8754('0x4b')](_0x8754('0x50'),'ui')[_0x8754('0x51')](_0x8754('0x52'),'u',_0x8754('0x53'));var _0x54918c=squel[_0x8754('0x54')]()[_0x8754('0x4b')](_0x8754('0x55'),'i')[_0x8754('0x51')](_0x8754('0x56'),'c',_0x8754('0x57'))[_0x8754('0x51')](_0x8754('0x52'),'o',_0x8754('0x58'))['left_join']('sms_accounts','a',_0x8754('0x59'))['left_join'](_0x8754('0x5a'),'me',_0x8754('0x5b'))[_0x8754('0x51')](_0x8754('0x5c'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x8754('0x51')](_0x8754('0x4c'),'t',_0x8754('0x5d'));var _0x36ab9f=squel[_0x8754('0x5e')]();var _0x18b9fa=[];var _0x5e12b3=squel[_0x8754('0x5e')]();var _0x3dfb96;if(_0x3bab81['query']['search']){_0x3dfb96=as['parseSearch'](_0x3bab81[_0x8754('0x3e')][_0x8754('0x5f')]);var _0x1477ff=_0x3dfb96['sqlOperator'];for(var _0x7a2189=0x0;_0x7a2189<_0x3dfb96['conditions'][_0x8754('0x43')];_0x7a2189++){var _0x1f2494=_0x3dfb96[_0x8754('0x60')][_0x7a2189];var _0x29d725='i';var _0x2f4e55=_[_0x8754('0x61')](_0x53105f,[_0x8754('0x30'),_0x1f2494[_0x8754('0x49')]]);if(!_0x2f4e55){switch(_0x1f2494[_0x8754('0x49')]){case'unreadMessages':if(_0x1f2494[_0x8754('0x62')]==0x1){_0x54918c[_0x8754('0x63')]('`'+_0x1f2494[_0x8754('0x49')]+_0x8754('0x64'));}else{_0x54918c[_0x8754('0x63')]('`'+_0x1f2494[_0x8754('0x49')]+_0x8754('0x65'));}break;case'Contact':if(_0x1f2494[_0x8754('0x66')]===_0x8754('0x67')){if(_0x1f2494[_0x8754('0x62')][_0x8754('0x36')]('\x20')[_0x8754('0x43')]>0x1){_0x36ab9f[_0x1477ff](_0x8754('0x68'),qs[_0x8754('0x69')](_0x1f2494[_0x8754('0x62')]),null);}else{var _0x59d105='%'+_0x1f2494[_0x8754('0x62')]+'%';_0x36ab9f[_0x1477ff]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x59d105,_0x59d105,_0x59d105);}}else{_0x2f4e55=_[_0x8754('0x61')](_0x53105f,[_0x8754('0x30'),_0x8754('0x6a')]);_0x1f2494[_0x8754('0x49')]=_0x8754('0x6a');_0x4be4db=as[_0x8754('0x6b')](_0x29d725,_0x2f4e55['type'],_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db['text'],_0x4be4db['value']['start'],_0x4be4db[_0x8754('0x62')][_0x8754('0x22')]);}break;case _0x8754('0x6c'):var _0x5f3fe4=_0x1f2494[_0x8754('0x62')][_0x8754('0x36')](',')[_0x8754('0x33')](function(_0x248fe4){return Number(_0x248fe4);});_0x5f3fe4[_0x8754('0x37')](function(_0x26e026){_0x5e12b3['or'](_0x8754('0x6d'),'%,'+_0x26e026+',%');});_0x18b9fa=_[_0x8754('0x6e')](_0x18b9fa,_0x5f3fe4);break;case _0x8754('0x6f'):if(_0x1f2494['operator']===_0x8754('0x67')){_0x36ab9f[_0x1477ff](_0x8754('0x70'),'%'+_0x1f2494[_0x8754('0x62')]+'%',null);}else{_0x2f4e55=_[_0x8754('0x61')](_0x53105f,['name',_0x8754('0x71')]);_0x1f2494[_0x8754('0x49')]=_0x8754('0x71');_0x4be4db=as[_0x8754('0x6b')](_0x29d725,_0x2f4e55['type'],_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db[_0x8754('0x72')],_0x4be4db[_0x8754('0x62')][_0x8754('0x73')],_0x4be4db['value']['end']);}break;case _0x8754('0x74'):_0x4be4db=as[_0x8754('0x6b')]('me',null,_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db[_0x8754('0x72')],_0x4be4db[_0x8754('0x62')][_0x8754('0x73')],_0x4be4db['value'][_0x8754('0x22')]);break;}}else{var _0x4be4db=as[_0x8754('0x6b')](_0x29d725,_0x2f4e55[_0x8754('0x3c')],_0x1f2494);_0x36ab9f[_0x1477ff](_0x4be4db[_0x8754('0x72')],_0x4be4db[_0x8754('0x62')]['start'],_0x4be4db['value'][_0x8754('0x22')]);}}}else{var _0x44ac1c=_(_0x3bab81[_0x8754('0x3e')])[_0x8754('0x3f')]()[_0x8754('0x33')](function(_0x317707){return _[_0x8754('0x75')](_0x53105f,[_0x8754('0x30'),_0x317707])?_0x317707:undefined;})[_0x8754('0x76')]()[_0x8754('0x62')]();if(!_[_0x8754('0x77')](_0x44ac1c)){_0x44ac1c[_0x8754('0x37')](function(_0x36774c){if(_0x36774c===_0x8754('0x78')){_0x54918c['where'](_0x8754('0x79'),[][_0x8754('0x7a')](_0x3bab81['query'][_0x36774c]));}else if(_0x36774c===_0x8754('0x7b')){var _0x3550d2=JSON[_0x8754('0x7c')](_0x3bab81[_0x8754('0x3e')][_0x36774c])[_0x8754('0x7d')];var _0x122669=JSON['parse'](_0x3bab81[_0x8754('0x3e')][_0x36774c])[_0x8754('0x7e')];_0x54918c['where'](_0x8754('0x7f'),_0x3550d2,_0x122669);}else{if(_0x3bab81[_0x8754('0x3e')][_0x36774c]===_0x8754('0x80')){_0x54918c[_0x8754('0x81')]('i.'+_0x36774c+'\x20IS\x20NULL');}else{_0x54918c['where']('i.'+_0x36774c+'\x20=\x20?',_0x3bab81[_0x8754('0x3e')][_0x36774c]);}}});}if(_0x3bab81[_0x8754('0x3e')][_0x8754('0x82')]){if(_0x3bab81['query']['read']==0x1){_0x54918c['having'](_0x8754('0x83'));}else{_0x54918c[_0x8754('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x3bab81[_0x8754('0x3e')]['tag']){_0x18b9fa=_[_0x8754('0x84')](_0x3bab81[_0x8754('0x3e')][_0x8754('0x85')])?_0x3bab81[_0x8754('0x3e')]['tag']:new Array(_0x3bab81['query'][_0x8754('0x85')]);_0x18b9fa[_0x8754('0x37')](function(_0x2513fe){_0x5e12b3['or'](_0x8754('0x6d'),'%,'+_0x2513fe+',%');});}if(_0x3bab81[_0x8754('0x3e')][_0x8754('0x86')]){var _0x28e5f5=_0x3bab81[_0x8754('0x3e')]['filter'][_0x8754('0x87')]('\x5c','\x5c\x5c')[_0x8754('0x87')](/'/g,'\x27\x27');if(qs[_0x8754('0x88')](_0x28e5f5)){_0x36ab9f['or']('i.id\x20LIKE\x20?',_0x28e5f5+'%')['or']('i.phone\x20LIKE\x20?',_0x28e5f5+'%');}else{_0x36ab9f['or'](_0x8754('0x89'),qs[_0x8754('0x69')](_0x28e5f5))['or'](_0x8754('0x8a'),_0x28e5f5+'%');}}}_0x54918c['where'](_0x36ab9f);_0x54918c[_0x8754('0x8b')](_0x8754('0x8c'));var _0x33a881={'type':db[_0x8754('0x8d')][_0x8754('0x8e')][_0x8754('0x8f')],'raw':!![]};var _0x431772=_0x54918c['clone']();_0x431772['field'](_0x8754('0x8c'));_0x431772[_0x8754('0x49')](_0x8754('0x90'),_0x8754('0x91'));if(_0x3846be[_0x8754('0x46')]){_0x3846be[_0x8754('0x46')][_0x8754('0x37')](function(_0x92fdb8){var _0x2e4ce4=_0x92fdb8[0x0]===_0x8754('0x92')?_0x92fdb8[0x0]:'i.'+_0x92fdb8[0x0];_0x54918c[_0x8754('0x46')](_0x2e4ce4,_0x92fdb8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8754('0x77')](_0x18b9fa)){_0x54918c[_0x8754('0x63')](_0x5e12b3);_0x431772[_0x8754('0x81')](_0x8754('0x93'),_0x18b9fa);}BPromise[_0x8754('0x94')]()[_0x8754('0x2c')](function(){if(!_0x3dfb96){if(_0x3bab81['query'][_0x8754('0x78')]||_0x3bab81[_0x8754('0x3e')][_0x8754('0x95')])return;_0x431772[_0x8754('0x81')](_0x8754('0x96'));_0x54918c['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3bab81[_0x8754('0x97')]['role']!==_0x8754('0x98'))return;return _0x3bab81[_0x8754('0x97')][_0x8754('0x99')]({'attributes':['id'],'raw':!![]})[_0x8754('0x2c')](function(_0x3e89fa){if(_[_0x8754('0x77')](_0x3e89fa)){_0x431772[_0x8754('0x81')](_0x8754('0x9a'));_0x54918c['where'](_0x8754('0x9a'));}else{_0x431772[_0x8754('0x81')]('i.SmsAccountId\x20IN\x20?',_[_0x8754('0x33')](_0x3e89fa,'id'));_0x54918c[_0x8754('0x81')](_0x8754('0x79'),_['map'](_0x3e89fa,'id'));}});})[_0x8754('0x2c')](function(){if(_0x3bab81[_0x8754('0x97')][_0x8754('0x9b')]==='agent'&&!_0x3dfb96&&!_0x3bab81[_0x8754('0x3e')][_0x8754('0x78')])return[];return db[_0x8754('0x9c')][_0x8754('0x3e')](_0x431772[_0x8754('0x9d')](),_0x33a881);})[_0x8754('0x2c')](function(_0x3d630f){_0x4be467[_0x8754('0x9e')]=_0x3d630f['length'];if(_0x4be467['count']===0x0)return[];return db[_0x8754('0x9c')][_0x8754('0x3e')](_0x286ac5['toString'](),_0x33a881)[_0x8754('0x2c')](function(_0x4191ee){_0x58ea77=_[_0x8754('0x9f')](_0x4191ee,'id');_0x33a881=_['merge'](_0x33a881,{'model':db[_0x8754('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bab81[_0x8754('0x3e')][_0x8754('0x42')]){_0x3846be[_0x8754('0x41')][_0x8754('0x37')](function(_0x3371d0){_0x54918c[_0x8754('0x49')]('i.'+_0x3371d0);});}else{_0x54918c[_0x8754('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8754('0x91'));_0x54918c[_0x8754('0x49')](_0x8754('0xa0'),'Account.key');_0x54918c[_0x8754('0x49')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x54918c['field'](_0x8754('0xa1'),_0x8754('0x92'));_0x54918c[_0x8754('0x49')](_0x8754('0xa2'));_0x54918c['field'](_0x8754('0xa3'),_0x8754('0xa4'));_0x54918c[_0x8754('0x49')](_0x8754('0xa5'),'Contact.lastName');_0x54918c[_0x8754('0x49')]('c.email',_0x8754('0xa6'));_0x54918c[_0x8754('0x49')](_0x8754('0xa7'),_0x8754('0xa8'));_0x54918c[_0x8754('0x49')](_0x8754('0xa9'),_0x8754('0xaa'));_0x54918c[_0x8754('0x49')](_0x8754('0xab'),'Contact.fax');_0x54918c[_0x8754('0x49')](_0x8754('0xac'),_0x8754('0xad'));_0x54918c[_0x8754('0x49')](_0x8754('0xae'),'Owner.internal');_0x54918c[_0x8754('0x49')](_0x8754('0xaf'),_0x8754('0x35'));}if(_0x3846be[_0x8754('0x26')])_0x54918c[_0x8754('0x26')](_0x3846be[_0x8754('0x26')]);if(_0x3846be[_0x8754('0x25')])_0x54918c[_0x8754('0x25')](_0x3846be[_0x8754('0x25')]);return db['sequelize'][_0x8754('0x3e')](_0x54918c[_0x8754('0x9d')](),_0x33a881);})['then'](function(_0x131d4e){_0x5beb3d[_0x8754('0x81')](_0x8754('0xb0'),_[_0x8754('0x33')](_0x131d4e,'id'));return db['sequelize']['query'](_0x5beb3d['toString'](),_0x33a881)[_0x8754('0x2c')](function(_0x1ba26a){var _0x38e506=_['groupBy'](_0x1ba26a,_0x8754('0xb1'));var _0x4deaa8=[];_0x131d4e['forEach'](function(_0x2ca289){_0x4deaa8[_0x8754('0x39')](updateSmsInteraction(_0x2ca289,_0x58ea77,_0x38e506));});return BPromise[_0x8754('0xb2')](_0x4deaa8);});});})['then'](function(_0x97c446){_0x4be467[_0x8754('0xb3')]=_0x97c446;return _0x4be467;})[_0x8754('0x2c')](respondWithFilteredResult(_0x414bef,_0x3846be))[_0x8754('0xb4')](handleError(_0x414bef,null));};exports[_0x8754('0xb5')]=function(_0x347cda,_0x585d9d){var _0x421302={'raw':![],'where':{'id':_0x347cda[_0x8754('0xb6')]['id']}},_0x1c1973={};_0x1c1973['model']=_[_0x8754('0x3f')](db[_0x8754('0x3a')]['rawAttributes']);_0x1c1973[_0x8754('0x3e')]=_[_0x8754('0x3f')](_0x347cda['query']);_0x1c1973['filters']=_['intersection'](_0x1c1973['model'],_0x1c1973[_0x8754('0x3e')]);_0x421302[_0x8754('0x41')]=_[_0x8754('0x40')](_0x1c1973['model'],qs['fields'](_0x347cda[_0x8754('0x3e')][_0x8754('0x42')]));_0x421302[_0x8754('0x41')]=_0x421302['attributes'][_0x8754('0x43')]?_0x421302[_0x8754('0x41')]:_0x1c1973['model'];if(_0x347cda[_0x8754('0x3e')][_0x8754('0xb7')]){_0x421302[_0x8754('0xb8')]=[{'all':!![]}];}_0x421302=_[_0x8754('0xb9')]({},_0x421302,_0x347cda[_0x8754('0xba')]);return db[_0x8754('0x3a')][_0x8754('0x61')](_0x421302)[_0x8754('0x2c')](handleEntityNotFound(_0x585d9d,null))[_0x8754('0x2c')](respondWithResult(_0x585d9d,null))['catch'](handleError(_0x585d9d,null));};exports['create']=function(_0x2684c7,_0x1217b0){return db[_0x8754('0x3a')][_0x8754('0xbb')](_0x2684c7['body'],{})[_0x8754('0x2c')](respondWithResult(_0x1217b0,0xc9))[_0x8754('0xb4')](handleError(_0x1217b0,null));};exports[_0x8754('0x2b')]=function(_0x513ba3,_0x131ebe){if(_0x513ba3[_0x8754('0x74')]['id']){delete _0x513ba3[_0x8754('0x74')]['id'];}return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x513ba3['params']['id']}})['then'](handleEntityNotFound(_0x131ebe,null))['then'](saveUpdates(_0x513ba3[_0x8754('0x74')],null))[_0x8754('0x2c')](respondWithResult(_0x131ebe,null))['catch'](handleError(_0x131ebe,null));};exports['destroy']=function(_0x2e5969,_0x2a9dc2){return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x2e5969[_0x8754('0xb6')]['id']}})[_0x8754('0x2c')](handleEntityNotFound(_0x2a9dc2,null))[_0x8754('0x2c')](removeEntity(_0x2a9dc2,null))['catch'](handleError(_0x2a9dc2,null));};exports[_0x8754('0xbc')]=function(_0x2d3b82,_0x5384f0){return db[_0x8754('0x3a')][_0x8754('0xbc')]()[_0x8754('0x2c')](respondWithResult(_0x5384f0,null))[_0x8754('0xb4')](handleError(_0x5384f0,null));};exports[_0x8754('0xbd')]=function(_0x44ac3a,_0x54749d,_0x5b25f6){return db['SmsMessage'][_0x8754('0x61')]({'where':{'id':_0x44ac3a[_0x8754('0xb6')]['id']}})['then'](handleEntityNotFound(_0x54749d,null))['then'](function(_0x51b2b0){if(_0x51b2b0){return _0x51b2b0[_0x8754('0xbd')](_0x44ac3a[_0x8754('0x74')]['ids'],_[_0x8754('0xbe')](_0x44ac3a[_0x8754('0x74')],[_0x8754('0xbf'),'id'])||{});}})[_0x8754('0x2c')](respondWithResult(_0x54749d,null))[_0x8754('0xb4')](handleError(_0x54749d,null));};exports[_0x8754('0xc0')]=function(_0x498b4b,_0x287032,_0x120398){var _0x2e44ce={'raw':![],'where':{}};var _0x2cd453={};var _0x4a3c99={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8754('0xc1')]({'where':{'id':_0x498b4b[_0x8754('0xb6')]['id']}})['then'](handleEntityNotFound(_0x287032,null))[_0x8754('0x2c')](function(_0x42ad00){if(_0x42ad00){_0x2cd453[_0x8754('0x3d')]=_[_0x8754('0x3f')](db['SmsMessage'][_0x8754('0xc2')]);_0x2cd453[_0x8754('0x3e')]=_[_0x8754('0x3f')](_0x498b4b[_0x8754('0x3e')]);_0x2cd453[_0x8754('0x48')]=_[_0x8754('0x40')](_0x2cd453[_0x8754('0x3d')],_0x2cd453[_0x8754('0x3e')]);_0x2e44ce[_0x8754('0x41')]=_[_0x8754('0x40')](_0x2cd453[_0x8754('0x3d')],qs[_0x8754('0x42')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x42')]));_0x2e44ce[_0x8754('0x41')]=_0x2e44ce[_0x8754('0x41')][_0x8754('0x43')]?_0x2e44ce[_0x8754('0x41')]:_0x2cd453['model'];if(!_0x498b4b[_0x8754('0x3e')]['hasOwnProperty'](_0x8754('0x45'))){_0x2e44ce[_0x8754('0x26')]=qs[_0x8754('0x26')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x26')]);_0x2e44ce[_0x8754('0x25')]=qs[_0x8754('0x25')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x25')]);}_0x2e44ce[_0x8754('0x46')]=qs[_0x8754('0x47')](_0x498b4b[_0x8754('0x3e')][_0x8754('0x47')]);_0x2e44ce[_0x8754('0x81')]=qs[_0x8754('0x48')](_[_0x8754('0xc3')](_0x498b4b[_0x8754('0x3e')],_0x2cd453[_0x8754('0x48')]));_0x2e44ce['where'][_0x8754('0xb1')]=_0x42ad00['id'];if(_0x498b4b[_0x8754('0x3e')][_0x8754('0x86')]){_0x2e44ce[_0x8754('0x81')]=_[_0x8754('0xb9')](_0x2e44ce[_0x8754('0x81')],{'$or':_[_0x8754('0x33')](_0x2e44ce[_0x8754('0x41')],function(_0x4ad979){var _0x37da25={};_0x37da25[_0x4ad979]={'$like':'%'+_0x498b4b[_0x8754('0x3e')][_0x8754('0x86')]+'%'};return _0x37da25;})});}if(_0x498b4b[_0x8754('0x3e')]['$gte']){var _0x470f0a=_0x498b4b['query'][_0x8754('0x7d')][_0x8754('0x36')](',');var _0x29b9f3={};_0x29b9f3[_0x470f0a[0x0]]={'$gte':moment(_0x470f0a[0x1])[_0x8754('0xc4')](_0x8754('0xc5'))};_0x2e44ce['where']=_['merge'](_0x2e44ce['where'],_0x29b9f3);}_0x2e44ce=_[_0x8754('0xb9')]({},_0x2e44ce,_0x498b4b[_0x8754('0xba')]);return db[_0x8754('0xc6')][_0x8754('0x9e')]({'where':_0x2e44ce[_0x8754('0x81')]})[_0x8754('0x2c')](function(_0x20a892){_0x4a3c99[_0x8754('0x9e')]=_0x20a892;if(_0x498b4b[_0x8754('0x3e')][_0x8754('0xb7')]){_0x2e44ce[_0x8754('0xb8')]=[{'all':!![]}];}return db[_0x8754('0xc6')][_0x8754('0xc7')](_0x2e44ce);})[_0x8754('0x2c')](function(_0x538ba2){_0x4a3c99[_0x8754('0xb3')]=_0x538ba2;return _0x4a3c99;});}})[_0x8754('0x2c')](respondWithFilteredResult(_0x287032,_0x2e44ce))[_0x8754('0xb4')](handleError(_0x287032,null));};exports[_0x8754('0xc8')]=function(_0x3e2b1f,_0xc76574,_0xd7610d){return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x3e2b1f['params']['id']}})[_0x8754('0x2c')](handleEntityNotFound(_0xc76574,null))[_0x8754('0x2c')](function(_0xf96dbc){if(_0xf96dbc){return _0xf96dbc[_0x8754('0xc9')](_0x3e2b1f[_0x8754('0x74')][_0x8754('0xbf')],_[_0x8754('0xbe')](_0x3e2b1f[_0x8754('0x74')],[_0x8754('0xbf'),'id'])||{})[_0x8754('0xca')](function(){return db[_0x8754('0x6c')][_0x8754('0xc7')]({'attributes':['id',_0x8754('0x30'),_0x8754('0x4a')],'where':{'id':_0x3e2b1f['body'][_0x8754('0xbf')]}});})['then'](function(_0x475ace){socket[_0x8754('0xcb')](_0x8754('0xcc'),{'id':Number(_0x3e2b1f[_0x8754('0xb6')]['id']),'tags':_0x475ace||[]});return{'id':Number(_0x3e2b1f[_0x8754('0xb6')]['id']),'tags':_0x475ace||[]};});}})['then'](respondWithResult(_0xc76574,null))['catch'](handleError(_0xc76574,null));};exports[_0x8754('0xcd')]=function(_0x4de373,_0x5b8e40,_0x20b4d0){return db[_0x8754('0x3a')][_0x8754('0x61')]({'where':{'id':_0x4de373[_0x8754('0xb6')]['id']}})[_0x8754('0x2c')](handleEntityNotFound(_0x5b8e40,null))[_0x8754('0x2c')](function(_0x15c5fb){if(_0x15c5fb){return _0x15c5fb[_0x8754('0xcd')](_0x4de373[_0x8754('0x3e')][_0x8754('0xbf')]);}})[_0x8754('0x2c')](respondWithStatusCode(_0x5b8e40,null))[_0x8754('0xb4')](handleError(_0x5b8e40,null));};exports[_0x8754('0xce')]=function(_0x349026,_0x5cda63){var _0x1c8cce=moment()[_0x8754('0xcf')]()[_0x8754('0x9d')]();var _0x15fbbb=path[_0x8754('0xd0')](config[_0x8754('0xd1')],_0x8754('0xd2'),_0x8754('0xd3'),'tmp');var _0x27dd07=path[_0x8754('0xd0')](config['root'],'server','files','attachments');var _0x414316=path[_0x8754('0xd0')](_0x15fbbb,_0x1c8cce);var _0xe0f440=util['format'](_0x8754('0xd4'),_0x349026[_0x8754('0xb6')]['id'],_0x1c8cce);var _0x5312f9=path[_0x8754('0xd0')](_0x15fbbb,_0xe0f440);var _0x3e49f7=[];_0x3e49f7[_0x8754('0x39')]({'model':db[_0x8754('0x6f')],'as':_0x8754('0x6f'),'attributes':['id',_0x8754('0x34')],'raw':!![]});_0x3e49f7['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x8754('0xd5')],'raw':!![]});var _0x4c0adf=[{'model':db[_0x8754('0xc6')],'as':'Messages','attributes':['id',_0x8754('0x74'),_0x8754('0x7b'),_0x8754('0xd6'),'secret',_0x8754('0x82')],'include':_0x3e49f7}];_0x4c0adf[_0x8754('0x39')]({'model':db[_0x8754('0xd7')],'as':_0x8754('0xd8'),'attributes':['id',_0x8754('0x30')]});_0x4c0adf['push']({'model':db[_0x8754('0x6f')],'as':'Owner','attributes':['id',_0x8754('0x34')]});return db[_0x8754('0x3a')]['find']({'where':{'id':_0x349026[_0x8754('0xb6')]['id']},'include':_0x4c0adf})[_0x8754('0x2c')](handleEntityNotFound(_0x5cda63,null))['then'](function(_0x5ef8a3){if(_0x5ef8a3){var _0x42db47=_0x5ef8a3[_0x8754('0xd9')]({'plain':!![]});fs[_0x8754('0xda')](_0x414316);var _0x56a194={'format':'A4','border':'10px','header':{'height':_0x8754('0xdb'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x8754('0xdc'),'contents':{'default':util[_0x8754('0xc4')](_0x8754('0xdd'),util[_0x8754('0xc4')](_0x8754('0xde'),'Sms',_0x42db47['id']),moment()[_0x8754('0xc4')]('YYYY-MM-DD')[_0x8754('0x9d')]())}}};var _0xf8d2e7={'channel':_0x8754('0xdf'),'account':_0x42db47[_0x8754('0xd8')][_0x8754('0x30')],'agent':_0x42db47[_0x8754('0xe0')]?_0x42db47[_0x8754('0xe0')][_0x8754('0x34')]:_0x8754('0xe1'),'createdAt':moment(_0x42db47[_0x8754('0x7b')])['format'](_0x8754('0xc5'))[_0x8754('0x9d')](),'closedAt':_0x42db47['closed']?moment(_0x42db47[_0x8754('0xe2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x8754('0x9d')]():'','disposition':_0x42db47[_0x8754('0xe3')],'messages':_(_0x42db47[_0x8754('0xe4')])[_0x8754('0x86')]({'secret':![]})[_0x8754('0x33')](function(_0x3de7b0){return{'date':moment(_0x3de7b0[_0x8754('0x7b')])['format'](_0x8754('0xc5'))['toString'](),'sender':_0x3de7b0[_0x8754('0xd6')]===_0x8754('0xe5')?_0x3de7b0[_0x8754('0x6f')]?_0x3de7b0[_0x8754('0x6f')][_0x8754('0x34')]:_0x8754('0xe6'):_0x3de7b0[_0x8754('0xe7')][_0x8754('0xe8')]+(_0x3de7b0[_0x8754('0xe7')][_0x8754('0xd5')]?'\x20'+_0x3de7b0['Contact'][_0x8754('0xd5')]:''),'body':_0x3de7b0['body'],'direction':_0x3de7b0['direction']===_0x8754('0xe5')?'A':'C','secret':_0x3de7b0[_0x8754('0xe9')],'read':_0x3de7b0['read']};})[_0x8754('0x62')]()};return ejs['renderFile'](path[_0x8754('0xd0')](config[_0x8754('0xd1')],'server',_0x8754('0xea'),_0x8754('0xeb')),{'interaction':_0xf8d2e7})[_0x8754('0x2c')](function(_0x37e4ec){return new BPromise(function(_0x1d9ecb,_0x4f03ef){pdf[_0x8754('0xbb')](_0x37e4ec,_0x56a194)[_0x8754('0xec')](path['join'](_0x414316,_0x8754('0xed')+_0x42db47['id']+'-'+_0x1c8cce+_0x8754('0xee')),function(_0x179286,_0x1e5df2){if(_0x179286)return _0x4f03ef(_0x179286);_0x1d9ecb(_0x1e5df2);});});})['then'](function(){return new BPromise(function(_0x389955,_0x5f1c42){zipdir(_0x414316,{'saveTo':_0x5312f9},function(_0x5b5b9e,_0x38970c){if(_0x5b5b9e)return _0x5f1c42(_0x5b5b9e);return _0x389955(_0x38970c);});})[_0x8754('0x2c')](function(){return new BPromise(function(_0x20e92f,_0x2ed501){rimraf(_0x414316,function(_0x25165d){if(_0x25165d)_0x2ed501(_0x25165d);return _0x20e92f();});});})['then'](function(){return _0x5cda63[_0x8754('0xce')](_0x5312f9,_0xe0f440,function(_0x3a7b14){if(_0x3a7b14){console[_0x8754('0xef')](_0x8754('0xf0'),_0x3a7b14);}else{fs[_0x8754('0xf1')](_0x5312f9);}});});});}else{return _0x5cda63[_0x8754('0x21')](0xc8);}})[_0x8754('0xb4')](handleError(_0x5cda63,null));}; \ No newline at end of file +var _0xc2c2=['redis','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','select','field','from','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','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','find','UserId','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','options','create','body','destroy','addMessage','SmsMessage','ids','omit','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','N.A.','closedAt','disposition','out','System','views','toFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc2c2,0x1bb));var _0x2c2c=function(_0x5cb366,_0x2a3d54){_0x5cb366=_0x5cb366-0x0;var _0x4358cd=_0xc2c2[_0x5cb366];return _0x4358cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c2c('0x0'));var rimraf=require(_0x2c2c('0x1'));var zipdir=require(_0x2c2c('0x2'));var jsonpatch=require(_0x2c2c('0x3'));var rp=require(_0x2c2c('0x4'));var moment=require(_0x2c2c('0x5'));var BPromise=require(_0x2c2c('0x6'));var Mustache=require(_0x2c2c('0x7'));var util=require(_0x2c2c('0x8'));var path=require(_0x2c2c('0x9'));var sox=require(_0x2c2c('0xa'));var csv=require(_0x2c2c('0xb'));var ejs=require(_0x2c2c('0xc'));var fs=require('fs');var _=require(_0x2c2c('0xd'));var squel=require(_0x2c2c('0xe'));var crypto=require(_0x2c2c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2c2c('0x10'));var toCsv=require(_0x2c2c('0xb'));var querystring=require(_0x2c2c('0x11'));var Papa=require(_0x2c2c('0x12'));var Redis=require(_0x2c2c('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2c2c('0x14'));var hardwareService=require(_0x2c2c('0x15'));var logger=require(_0x2c2c('0x16'))(_0x2c2c('0x17'));var utils=require(_0x2c2c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2c2c('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2c2c('0x1a')](config[_0x2c2c('0x1b')],{'host':_0x2c2c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c2c('0x1b')]));require('./smsInteraction.socket')[_0x2c2c('0x1d')](socket);function respondWithStatusCode(_0x2e6935,_0x392cdc){_0x392cdc=_0x392cdc||0xcc;return function(_0x4db14c){if(_0x4db14c){return _0x2e6935[_0x2c2c('0x1e')](_0x392cdc);}return _0x2e6935[_0x2c2c('0x1f')](_0x392cdc)[_0x2c2c('0x20')]();};}function respondWithResult(_0x1f587c,_0x33dcea){_0x33dcea=_0x33dcea||0xc8;return function(_0xcbee95){if(_0xcbee95){return _0x1f587c[_0x2c2c('0x1f')](_0x33dcea)[_0x2c2c('0x21')](_0xcbee95);}};}function respondWithFilteredResult(_0x4ea8dc,_0xbaa836){return function(_0x1d190c){if(_0x1d190c){var _0x2f1020=_0x1d190c[_0x2c2c('0x22')],_0x5b5aeb=_0xbaa836[_0x2c2c('0x23')],_0x578875=_0xbaa836[_0x2c2c('0x23')]+_0xbaa836[_0x2c2c('0x24')],_0x2d5241;if(_0x578875>=_0x2f1020){_0x578875=_0x2f1020;_0x2d5241=0xc8;}else{_0x2d5241=0xce;}_0x4ea8dc[_0x2c2c('0x1f')](_0x2d5241);return _0x4ea8dc[_0x2c2c('0x25')](_0x2c2c('0x26'),_0x5b5aeb+'-'+_0x578875+'/'+_0x2f1020)[_0x2c2c('0x21')](_0x1d190c);}return null;};}function patchUpdates(_0x102f0f){return function(_0x16fbab){try{jsonpatch[_0x2c2c('0x27')](_0x16fbab,_0x102f0f,!![]);}catch(_0x21066d){return BPromise[_0x2c2c('0x28')](_0x21066d);}return _0x16fbab[_0x2c2c('0x29')]();};}function saveUpdates(_0x42d936,_0x159cbb){return function(_0x366253){if(_0x366253){return _0x366253[_0x2c2c('0x2a')](_0x42d936)['then'](function(_0x247bf2){return _0x247bf2;});}return null;};}function removeEntity(_0x579cb8,_0x5c9ed9){return function(_0x5170cd){if(_0x5170cd){return _0x5170cd['destroy']()[_0x2c2c('0x2b')](function(){_0x579cb8['status'](0xcc)[_0x2c2c('0x20')]();});}};}function handleEntityNotFound(_0x4480be,_0x2bf15b){return function(_0xe83116){if(!_0xe83116){_0x4480be[_0x2c2c('0x1e')](0x194);}return _0xe83116;};}function handleError(_0x3a581c,_0x43d69c){_0x43d69c=_0x43d69c||0x1f4;return function(_0x238232){logger['error'](_0x238232[_0x2c2c('0x2c')]);if(_0x238232[_0x2c2c('0x2d')]){delete _0x238232[_0x2c2c('0x2d')];}_0x3a581c[_0x2c2c('0x1f')](_0x43d69c)[_0x2c2c('0x2e')](_0x238232);};}function getInteractionUsers(_0x4dfb15,_0xebee03){return new BPromise(function(_0x3d78a8,_0x2c4e86){try{if(_0xebee03[_0x4dfb15['id']]){_0x4dfb15[_0x2c2c('0x2f')]=_[_0x2c2c('0x30')](_0xebee03[_0x4dfb15['id']],function(_0x43453d){return{'id':_0x43453d['id'],'fullname':_0x43453d[_0x2c2c('0x31')]};});}}catch(_0x24513e){_0x2c4e86(_0x24513e);}_0x3d78a8(_0x4dfb15);});}function getInteractionTags(_0x4cf22d,_0x131ac8){return new BPromise(function(_0x4b23fb,_0x237fe8){try{if(_0x4cf22d[_0x2c2c('0x32')]){_0x4cf22d[_0x2c2c('0x33')]=[];_0x4cf22d[_0x2c2c('0x32')][_0x2c2c('0x34')](',')[_0x2c2c('0x35')](function(_0x37721c){_0x4cf22d[_0x2c2c('0x33')]['push'](_0x131ac8[_0x37721c]);});}delete _0x4cf22d[_0x2c2c('0x32')];}catch(_0x24de10){_0x237fe8(_0x24de10);}_0x4b23fb(_0x4cf22d);});}function updateSmsInteraction(_0x64be85,_0x1771b3,_0x43c225){return new BPromise(function(_0x1ee92f,_0x210836){return getInteractionUsers(_0x64be85,_0x43c225)['then'](function(_0x28faa4){return getInteractionTags(_0x28faa4,_0x1771b3);})[_0x2c2c('0x2b')](function(_0x516a94){_0x1ee92f(_0x516a94);})[_0x2c2c('0x36')](function(_0x54efe1){_0x210836(_0x54efe1);});});}exports[_0x2c2c('0x37')]=function(_0x2fc72f,_0xff594){var _0x2ccea9={},_0x1c5c73={},_0x260f52={'count':0x0,'rows':[]};var _0x1f6371=_[_0x2c2c('0x30')](db[_0x2c2c('0x38')][_0x2c2c('0x39')],function(_0x5b4b75){return{'name':_0x5b4b75[_0x2c2c('0x3a')],'type':_0x5b4b75[_0x2c2c('0x3b')][_0x2c2c('0x3c')]};});_0x1c5c73[_0x2c2c('0x3d')]=_[_0x2c2c('0x30')](_0x1f6371,_0x2c2c('0x2d'));_0x1c5c73[_0x2c2c('0x3e')]=_[_0x2c2c('0x3f')](_0x2fc72f[_0x2c2c('0x3e')]);_0x1c5c73['filters']=_['intersection'](_0x1c5c73[_0x2c2c('0x3d')],_0x1c5c73[_0x2c2c('0x3e')]);_0x2ccea9[_0x2c2c('0x40')]=_[_0x2c2c('0x41')](_0x1c5c73[_0x2c2c('0x3d')],qs[_0x2c2c('0x42')](_0x2fc72f[_0x2c2c('0x3e')]['fields']));_0x2ccea9['attributes']=_0x2ccea9[_0x2c2c('0x40')]['length']?_0x2ccea9[_0x2c2c('0x40')]:_0x1c5c73['model'];if(!_0x2fc72f[_0x2c2c('0x3e')]['hasOwnProperty'](_0x2c2c('0x43'))){_0x2ccea9[_0x2c2c('0x24')]=qs['limit'](_0x2fc72f[_0x2c2c('0x3e')]['limit']);_0x2ccea9[_0x2c2c('0x23')]=qs[_0x2c2c('0x23')](_0x2fc72f['query'][_0x2c2c('0x23')]);}_0x2ccea9[_0x2c2c('0x44')]=qs[_0x2c2c('0x45')](_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x45')]);_0x2ccea9['where']=qs[_0x2c2c('0x46')](_[_0x2c2c('0x47')](_0x2fc72f['query'],_0x1c5c73[_0x2c2c('0x46')]),_0x1f6371);var _0x27817f=[];var _0x3b1ece=squel[_0x2c2c('0x48')]()[_0x2c2c('0x49')]('id')[_0x2c2c('0x49')](_0x2c2c('0x2d'))[_0x2c2c('0x49')]('color')[_0x2c2c('0x4a')](_0x2c2c('0x4b'));var _0x38e593=squel[_0x2c2c('0x48')]()[_0x2c2c('0x49')]('u.id')['field']('u.fullname')['field'](_0x2c2c('0x4c'))[_0x2c2c('0x4a')](_0x2c2c('0x4d'),'ui')[_0x2c2c('0x4e')](_0x2c2c('0x4f'),'u',_0x2c2c('0x50'));var _0x5e2d5a=squel[_0x2c2c('0x48')]()[_0x2c2c('0x4a')]('sms_interactions','i')[_0x2c2c('0x4e')]('cm_contacts','c',_0x2c2c('0x51'))[_0x2c2c('0x4e')](_0x2c2c('0x4f'),'o',_0x2c2c('0x52'))[_0x2c2c('0x4e')](_0x2c2c('0x53'),'a',_0x2c2c('0x54'))[_0x2c2c('0x4e')]('sms_messages','me',_0x2c2c('0x55'))[_0x2c2c('0x4e')]('sms_interaction_has_tags','it',_0x2c2c('0x56'))[_0x2c2c('0x4e')](_0x2c2c('0x4b'),'t',_0x2c2c('0x57'));var _0x1b1048=squel[_0x2c2c('0x58')]();var _0x222c51=[];var _0x273566=squel['expr']();var _0x337a95;if(_0x2fc72f['query'][_0x2c2c('0x59')]){_0x337a95=as[_0x2c2c('0x5a')](_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x59')]);var _0x2f204a=_0x337a95['sqlOperator'];for(var _0x5004c8=0x0;_0x5004c8<_0x337a95['conditions']['length'];_0x5004c8++){var _0x1d2390=_0x337a95[_0x2c2c('0x5b')][_0x5004c8];var _0x3e674b='i';var _0x364e56=_['find'](_0x1f6371,['name',_0x1d2390[_0x2c2c('0x49')]]);if(!_0x364e56){switch(_0x1d2390[_0x2c2c('0x49')]){case _0x2c2c('0x5c'):if(_0x1d2390['value']==0x1){_0x5e2d5a[_0x2c2c('0x5d')]('`'+_0x1d2390[_0x2c2c('0x49')]+_0x2c2c('0x5e'));}else{_0x5e2d5a[_0x2c2c('0x5d')]('`'+_0x1d2390[_0x2c2c('0x49')]+_0x2c2c('0x5f'));}break;case _0x2c2c('0x60'):if(_0x1d2390[_0x2c2c('0x61')]===_0x2c2c('0x62')){if(_0x1d2390['value'][_0x2c2c('0x34')]('\x20')[_0x2c2c('0x63')]>0x1){_0x1b1048[_0x2f204a](_0x2c2c('0x64'),qs['getFullTextValue'](_0x1d2390[_0x2c2c('0x65')]),null);}else{var _0x70ce7a='%'+_0x1d2390[_0x2c2c('0x65')]+'%';_0x1b1048[_0x2f204a](_0x2c2c('0x66'),_0x70ce7a,_0x70ce7a,_0x70ce7a);}}else{_0x364e56=_['find'](_0x1f6371,[_0x2c2c('0x2d'),_0x2c2c('0x67')]);_0x1d2390[_0x2c2c('0x49')]='ContactId';_0x578f0d=as[_0x2c2c('0x68')](_0x3e674b,_0x364e56['type'],_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d[_0x2c2c('0x69')],_0x578f0d['value'][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x20')]);}break;case _0x2c2c('0x6b'):var _0x214199=_0x1d2390[_0x2c2c('0x65')]['split'](',')['map'](function(_0x1b0b6d){return Number(_0x1b0b6d);});_0x214199['forEach'](function(_0x2246dd){_0x273566['or'](_0x2c2c('0x6c'),'%,'+_0x2246dd+',%');});_0x222c51=_[_0x2c2c('0x6d')](_0x222c51,_0x214199);break;case _0x2c2c('0x6e'):if(_0x1d2390[_0x2c2c('0x61')]==='$substring'){_0x1b1048[_0x2f204a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1d2390[_0x2c2c('0x65')]+'%',null);}else{_0x364e56=_[_0x2c2c('0x6f')](_0x1f6371,[_0x2c2c('0x2d'),_0x2c2c('0x70')]);_0x1d2390[_0x2c2c('0x49')]=_0x2c2c('0x70');_0x578f0d=as[_0x2c2c('0x68')](_0x3e674b,_0x364e56[_0x2c2c('0x3b')],_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d['text'],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x20')]);}break;case'body':_0x578f0d=as[_0x2c2c('0x68')]('me',null,_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d[_0x2c2c('0x69')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')]['end']);break;}}else{var _0x578f0d=as[_0x2c2c('0x68')](_0x3e674b,_0x364e56[_0x2c2c('0x3b')],_0x1d2390);_0x1b1048[_0x2f204a](_0x578f0d[_0x2c2c('0x69')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x6a')],_0x578f0d[_0x2c2c('0x65')][_0x2c2c('0x20')]);}}}else{var _0xa7b6c9=_(_0x2fc72f[_0x2c2c('0x3e')])['keys']()[_0x2c2c('0x30')](function(_0x44c115){return _[_0x2c2c('0x71')](_0x1f6371,[_0x2c2c('0x2d'),_0x44c115])?_0x44c115:undefined;})[_0x2c2c('0x72')]()[_0x2c2c('0x65')]();if(!_[_0x2c2c('0x73')](_0xa7b6c9)){_0xa7b6c9[_0x2c2c('0x35')](function(_0x3a2bcd){if(_0x3a2bcd===_0x2c2c('0x74')){_0x5e2d5a[_0x2c2c('0x75')](_0x2c2c('0x76'),[]['concat'](_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd]));}else if(_0x3a2bcd===_0x2c2c('0x77')){var _0x44f4e6=JSON[_0x2c2c('0x78')](_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd])[_0x2c2c('0x79')];var _0x301362=JSON[_0x2c2c('0x78')](_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd])[_0x2c2c('0x7a')];_0x5e2d5a[_0x2c2c('0x75')](_0x2c2c('0x7b'),_0x44f4e6,_0x301362);}else{if(_0x2fc72f['query'][_0x3a2bcd]===_0x2c2c('0x7c')){_0x5e2d5a[_0x2c2c('0x75')]('i.'+_0x3a2bcd+_0x2c2c('0x7d'));}else{_0x5e2d5a[_0x2c2c('0x75')]('i.'+_0x3a2bcd+_0x2c2c('0x7e'),_0x2fc72f[_0x2c2c('0x3e')][_0x3a2bcd]);}}});}if(_0x2fc72f['query'][_0x2c2c('0x7f')]){if(_0x2fc72f[_0x2c2c('0x3e')]['read']==0x1){_0x5e2d5a[_0x2c2c('0x5d')](_0x2c2c('0x80'));}else{_0x5e2d5a[_0x2c2c('0x5d')](_0x2c2c('0x81'));}}if(_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x82')]){_0x222c51=_['isArray'](_0x2fc72f[_0x2c2c('0x3e')]['tag'])?_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x82')]:new Array(_0x2fc72f['query']['tag']);_0x222c51['forEach'](function(_0x2e93c0){_0x273566['or'](_0x2c2c('0x6c'),'%,'+_0x2e93c0+',%');});}if(_0x2fc72f[_0x2c2c('0x3e')]['filter']){var _0x2a405b=_0x2fc72f['query'][_0x2c2c('0x83')][_0x2c2c('0x84')]('\x5c','\x5c\x5c')[_0x2c2c('0x84')](/'/g,'\x27\x27');if(qs[_0x2c2c('0x85')](_0x2a405b)){_0x1b1048['or'](_0x2c2c('0x86'),_0x2a405b+'%')['or']('i.phone\x20LIKE\x20?',_0x2a405b+'%');}else{_0x1b1048['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2c2c('0x87')](_0x2a405b))['or'](_0x2c2c('0x88'),_0x2a405b+'%');}}}_0x5e2d5a[_0x2c2c('0x75')](_0x1b1048);_0x5e2d5a['group']('i.id');var _0x22c414={'type':db[_0x2c2c('0x89')]['QueryTypes'][_0x2c2c('0x8a')],'raw':!![]};var _0x25a29b=_0x5e2d5a[_0x2c2c('0x8b')]();_0x25a29b[_0x2c2c('0x49')](_0x2c2c('0x8c'));_0x25a29b[_0x2c2c('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2c2c('0x5c'));if(_0x2ccea9[_0x2c2c('0x44')]){_0x2ccea9['order']['forEach'](function(_0x21c2ce){var _0x2cc99e=_0x21c2ce[0x0]===_0x2c2c('0x8d')?_0x21c2ce[0x0]:'i.'+_0x21c2ce[0x0];_0x5e2d5a['order'](_0x2cc99e,_0x21c2ce[0x1]===_0x2c2c('0x8e')?![]:!![]);});}if(!_[_0x2c2c('0x73')](_0x222c51)){_0x5e2d5a['having'](_0x273566);_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x8f'),_0x222c51);}BPromise[_0x2c2c('0x90')]()['then'](function(){if(!_0x337a95){if(_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x74')]||_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x91')])return;_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x92'));_0x5e2d5a[_0x2c2c('0x75')](_0x2c2c('0x92'));return;}if(_0x2fc72f[_0x2c2c('0x93')]['role']!=='agent')return;return _0x2fc72f[_0x2c2c('0x93')][_0x2c2c('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x351fb5){if(_[_0x2c2c('0x73')](_0x351fb5)){_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x95'));_0x5e2d5a[_0x2c2c('0x75')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x25a29b[_0x2c2c('0x75')](_0x2c2c('0x76'),_[_0x2c2c('0x30')](_0x351fb5,'id'));_0x5e2d5a[_0x2c2c('0x75')]('i.SmsAccountId\x20IN\x20?',_[_0x2c2c('0x30')](_0x351fb5,'id'));}});})['then'](function(){if(_0x2fc72f['user'][_0x2c2c('0x96')]===_0x2c2c('0x97')&&!_0x337a95&&!_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x74')])return[];return db['sequelize']['query'](_0x25a29b['toString'](),_0x22c414);})[_0x2c2c('0x2b')](function(_0xe6d4f5){_0x260f52[_0x2c2c('0x22')]=_0xe6d4f5[_0x2c2c('0x63')];if(_0x260f52[_0x2c2c('0x22')]===0x0)return[];return db[_0x2c2c('0x98')]['query'](_0x3b1ece['toString'](),_0x22c414)['then'](function(_0x1bb396){_0x27817f=_[_0x2c2c('0x99')](_0x1bb396,'id');_0x22c414=_[_0x2c2c('0x9a')](_0x22c414,{'model':db[_0x2c2c('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc72f[_0x2c2c('0x3e')][_0x2c2c('0x42')]){_0x2ccea9['attributes'][_0x2c2c('0x35')](function(_0x6f3d13){_0x5e2d5a[_0x2c2c('0x49')]('i.'+_0x6f3d13);});}else{_0x5e2d5a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5e2d5a['field'](_0x2c2c('0x9b'),'Account.key');_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0x9c'),_0x2c2c('0x9d'));_0x5e2d5a['field'](_0x2c2c('0x9e'),_0x2c2c('0x8d'));_0x5e2d5a[_0x2c2c('0x49')]('i.*');_0x5e2d5a['field'](_0x2c2c('0x9f'),_0x2c2c('0xa0'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa1'),'Contact.lastName');_0x5e2d5a['field']('c.email',_0x2c2c('0xa2'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa3'),_0x2c2c('0xa4'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa5'),_0x2c2c('0xa6'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa7'),'Contact.fax');_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xa8'),_0x2c2c('0xa9'));_0x5e2d5a[_0x2c2c('0x49')]('o.internal',_0x2c2c('0xaa'));_0x5e2d5a[_0x2c2c('0x49')](_0x2c2c('0xab'),_0x2c2c('0x32'));}if(_0x2ccea9[_0x2c2c('0x24')])_0x5e2d5a[_0x2c2c('0x24')](_0x2ccea9[_0x2c2c('0x24')]);if(_0x2ccea9[_0x2c2c('0x23')])_0x5e2d5a['offset'](_0x2ccea9[_0x2c2c('0x23')]);return db[_0x2c2c('0x98')][_0x2c2c('0x3e')](_0x5e2d5a[_0x2c2c('0xac')](),_0x22c414);})[_0x2c2c('0x2b')](function(_0x229652){_0x38e593['where'](_0x2c2c('0xad'),_[_0x2c2c('0x30')](_0x229652,'id'));return db[_0x2c2c('0x98')][_0x2c2c('0x3e')](_0x38e593['toString'](),_0x22c414)[_0x2c2c('0x2b')](function(_0x109d89){var _0x185a4b=_[_0x2c2c('0xae')](_0x109d89,'SmsInteractionId');var _0xf4c18a=[];_0x229652[_0x2c2c('0x35')](function(_0x1839ad){_0xf4c18a['push'](updateSmsInteraction(_0x1839ad,_0x27817f,_0x185a4b));});return BPromise[_0x2c2c('0xaf')](_0xf4c18a);});});})[_0x2c2c('0x2b')](function(_0x28b062){_0x260f52['rows']=_0x28b062;return _0x260f52;})[_0x2c2c('0x2b')](respondWithFilteredResult(_0xff594,_0x2ccea9))[_0x2c2c('0x36')](handleError(_0xff594,null));};exports[_0x2c2c('0xb0')]=function(_0x30f322,_0x56f40c){var _0x3b76a0={'raw':![],'where':{'id':_0x30f322[_0x2c2c('0xb1')]['id']}},_0x5639e5={};_0x5639e5[_0x2c2c('0x3d')]=_[_0x2c2c('0x3f')](db[_0x2c2c('0x38')][_0x2c2c('0x39')]);_0x5639e5['query']=_[_0x2c2c('0x3f')](_0x30f322[_0x2c2c('0x3e')]);_0x5639e5[_0x2c2c('0x46')]=_['intersection'](_0x5639e5['model'],_0x5639e5[_0x2c2c('0x3e')]);_0x3b76a0[_0x2c2c('0x40')]=_[_0x2c2c('0x41')](_0x5639e5[_0x2c2c('0x3d')],qs[_0x2c2c('0x42')](_0x30f322[_0x2c2c('0x3e')][_0x2c2c('0x42')]));_0x3b76a0[_0x2c2c('0x40')]=_0x3b76a0[_0x2c2c('0x40')]['length']?_0x3b76a0[_0x2c2c('0x40')]:_0x5639e5[_0x2c2c('0x3d')];if(_0x30f322[_0x2c2c('0x3e')][_0x2c2c('0xb2')]){_0x3b76a0[_0x2c2c('0xb3')]=[{'all':!![]}];}_0x3b76a0=_[_0x2c2c('0x9a')]({},_0x3b76a0,_0x30f322[_0x2c2c('0xb4')]);return db[_0x2c2c('0x38')]['find'](_0x3b76a0)[_0x2c2c('0x2b')](handleEntityNotFound(_0x56f40c,null))[_0x2c2c('0x2b')](respondWithResult(_0x56f40c,null))['catch'](handleError(_0x56f40c,null));};exports[_0x2c2c('0xb5')]=function(_0x7c9e36,_0x1c4bf8){return db['SmsInteraction'][_0x2c2c('0xb5')](_0x7c9e36[_0x2c2c('0xb6')],{})[_0x2c2c('0x2b')](respondWithResult(_0x1c4bf8,0xc9))[_0x2c2c('0x36')](handleError(_0x1c4bf8,null));};exports['update']=function(_0x35a23f,_0x2de9df){if(_0x35a23f[_0x2c2c('0xb6')]['id']){delete _0x35a23f[_0x2c2c('0xb6')]['id'];}return db[_0x2c2c('0x38')][_0x2c2c('0x6f')]({'where':{'id':_0x35a23f[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x2de9df,null))[_0x2c2c('0x2b')](saveUpdates(_0x35a23f[_0x2c2c('0xb6')],null))['then'](respondWithResult(_0x2de9df,null))['catch'](handleError(_0x2de9df,null));};exports[_0x2c2c('0xb7')]=function(_0x2f549b,_0xe65f8f){return db['SmsInteraction'][_0x2c2c('0x6f')]({'where':{'id':_0x2f549b[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0xe65f8f,null))[_0x2c2c('0x2b')](removeEntity(_0xe65f8f,null))['catch'](handleError(_0xe65f8f,null));};exports['describe']=function(_0x306e80,_0x57380d){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x57380d,null))[_0x2c2c('0x36')](handleError(_0x57380d,null));};exports[_0x2c2c('0xb8')]=function(_0x1b17ff,_0x32ed49,_0x3cc25a){return db[_0x2c2c('0xb9')][_0x2c2c('0x6f')]({'where':{'id':_0x1b17ff[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x32ed49,null))[_0x2c2c('0x2b')](function(_0x321166){if(_0x321166){return _0x321166[_0x2c2c('0xb8')](_0x1b17ff['body'][_0x2c2c('0xba')],_[_0x2c2c('0xbb')](_0x1b17ff[_0x2c2c('0xb6')],[_0x2c2c('0xba'),'id'])||{});}})[_0x2c2c('0x2b')](respondWithResult(_0x32ed49,null))[_0x2c2c('0x36')](handleError(_0x32ed49,null));};exports['getMessages']=function(_0xeb02c9,_0x4673ca,_0x138815){var _0x9bbea6={'raw':![],'where':{}};var _0x1921f4={};var _0x13a72c={'count':0x0,'rows':[]};return db[_0x2c2c('0x38')][_0x2c2c('0xbc')]({'where':{'id':_0xeb02c9[_0x2c2c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4673ca,null))['then'](function(_0x30ff16){if(_0x30ff16){_0x1921f4['model']=_[_0x2c2c('0x3f')](db[_0x2c2c('0xb9')][_0x2c2c('0x39')]);_0x1921f4[_0x2c2c('0x3e')]=_['keys'](_0xeb02c9['query']);_0x1921f4[_0x2c2c('0x46')]=_[_0x2c2c('0x41')](_0x1921f4[_0x2c2c('0x3d')],_0x1921f4[_0x2c2c('0x3e')]);_0x9bbea6[_0x2c2c('0x40')]=_['intersection'](_0x1921f4[_0x2c2c('0x3d')],qs[_0x2c2c('0x42')](_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x42')]));_0x9bbea6['attributes']=_0x9bbea6[_0x2c2c('0x40')]['length']?_0x9bbea6[_0x2c2c('0x40')]:_0x1921f4['model'];if(!_0xeb02c9['query']['hasOwnProperty'](_0x2c2c('0x43'))){_0x9bbea6[_0x2c2c('0x24')]=qs[_0x2c2c('0x24')](_0xeb02c9['query'][_0x2c2c('0x24')]);_0x9bbea6[_0x2c2c('0x23')]=qs[_0x2c2c('0x23')](_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x23')]);}_0x9bbea6[_0x2c2c('0x44')]=qs['sort'](_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x45')]);_0x9bbea6[_0x2c2c('0x75')]=qs[_0x2c2c('0x46')](_['pick'](_0xeb02c9[_0x2c2c('0x3e')],_0x1921f4[_0x2c2c('0x46')]));_0x9bbea6[_0x2c2c('0x75')][_0x2c2c('0xbd')]=_0x30ff16['id'];if(_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x83')]){_0x9bbea6[_0x2c2c('0x75')]=_['merge'](_0x9bbea6[_0x2c2c('0x75')],{'$or':_['map'](_0x9bbea6['attributes'],function(_0xde536e){var _0x3398e9={};_0x3398e9[_0xde536e]={'$like':'%'+_0xeb02c9[_0x2c2c('0x3e')]['filter']+'%'};return _0x3398e9;})});}if(_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x79')]){var _0x481ac8=_0xeb02c9[_0x2c2c('0x3e')][_0x2c2c('0x79')][_0x2c2c('0x34')](',');var _0x17854b={};_0x17854b[_0x481ac8[0x0]]={'$gte':moment(_0x481ac8[0x1])[_0x2c2c('0xbe')](_0x2c2c('0xbf'))};_0x9bbea6[_0x2c2c('0x75')]=_[_0x2c2c('0x9a')](_0x9bbea6[_0x2c2c('0x75')],_0x17854b);}_0x9bbea6=_[_0x2c2c('0x9a')]({},_0x9bbea6,_0xeb02c9['options']);return db['SmsMessage'][_0x2c2c('0x22')]({'where':_0x9bbea6['where']})[_0x2c2c('0x2b')](function(_0x2bc5a6){_0x13a72c[_0x2c2c('0x22')]=_0x2bc5a6;if(_0xeb02c9[_0x2c2c('0x3e')]['includeAll']){_0x9bbea6[_0x2c2c('0xb3')]=[{'all':!![]}];}return db[_0x2c2c('0xb9')][_0x2c2c('0xc0')](_0x9bbea6);})['then'](function(_0x59981a){_0x13a72c[_0x2c2c('0xc1')]=_0x59981a;return _0x13a72c;});}})[_0x2c2c('0x2b')](respondWithFilteredResult(_0x4673ca,_0x9bbea6))[_0x2c2c('0x36')](handleError(_0x4673ca,null));};exports[_0x2c2c('0xc2')]=function(_0x356646,_0x3cf4d3,_0x3cf89d){return db['SmsInteraction'][_0x2c2c('0x6f')]({'where':{'id':_0x356646[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x3cf4d3,null))[_0x2c2c('0x2b')](function(_0x42c5c8){if(_0x42c5c8){return _0x42c5c8[_0x2c2c('0xc3')](_0x356646[_0x2c2c('0xb6')]['ids'],_[_0x2c2c('0xbb')](_0x356646[_0x2c2c('0xb6')],['ids','id'])||{})[_0x2c2c('0xc4')](function(){return db[_0x2c2c('0x6b')][_0x2c2c('0xc0')]({'attributes':['id',_0x2c2c('0x2d'),_0x2c2c('0xc5')],'where':{'id':_0x356646[_0x2c2c('0xb6')][_0x2c2c('0xba')]}});})['then'](function(_0x5a3f3a){socket['emit'](_0x2c2c('0xc6'),{'id':Number(_0x356646[_0x2c2c('0xb1')]['id']),'tags':_0x5a3f3a||[]});return{'id':Number(_0x356646['params']['id']),'tags':_0x5a3f3a||[]};});}})[_0x2c2c('0x2b')](respondWithResult(_0x3cf4d3,null))['catch'](handleError(_0x3cf4d3,null));};exports[_0x2c2c('0xc7')]=function(_0x22f585,_0x5abcca,_0x2d3c82){return db[_0x2c2c('0x38')][_0x2c2c('0x6f')]({'where':{'id':_0x22f585[_0x2c2c('0xb1')]['id']}})[_0x2c2c('0x2b')](handleEntityNotFound(_0x5abcca,null))['then'](function(_0x3e8e73){if(_0x3e8e73){return _0x3e8e73[_0x2c2c('0xc7')](_0x22f585[_0x2c2c('0x3e')][_0x2c2c('0xba')]);}})[_0x2c2c('0x2b')](respondWithStatusCode(_0x5abcca,null))['catch'](handleError(_0x5abcca,null));};exports[_0x2c2c('0xc8')]=function(_0x3fd7af,_0x27f88e){var _0x18a6dd=moment()[_0x2c2c('0xc9')]()[_0x2c2c('0xac')]();var _0x417f11=path[_0x2c2c('0xca')](config[_0x2c2c('0xcb')],_0x2c2c('0xcc'),_0x2c2c('0xcd'),_0x2c2c('0xce'));var _0x37a110=path['join'](config[_0x2c2c('0xcb')],_0x2c2c('0xcc'),_0x2c2c('0xcd'),_0x2c2c('0xcf'));var _0x25af55=path[_0x2c2c('0xca')](_0x417f11,_0x18a6dd);var _0x3f406b=util[_0x2c2c('0xbe')]('transcript-%d-%s.zip',_0x3fd7af[_0x2c2c('0xb1')]['id'],_0x18a6dd);var _0x41ebbf=path['join'](_0x417f11,_0x3f406b);var _0x5a5dac=[];_0x5a5dac[_0x2c2c('0xd0')]({'model':db[_0x2c2c('0x6e')],'as':_0x2c2c('0x6e'),'attributes':['id',_0x2c2c('0x31')],'raw':!![]});_0x5a5dac['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x2c2c('0xd1'),_0x2c2c('0xd2')],'raw':!![]});var _0x562a2d=[{'model':db[_0x2c2c('0xb9')],'as':_0x2c2c('0xd3'),'attributes':['id',_0x2c2c('0xb6'),_0x2c2c('0x77'),_0x2c2c('0xd4'),_0x2c2c('0xd5'),'read'],'include':_0x5a5dac}];_0x562a2d[_0x2c2c('0xd0')]({'model':db[_0x2c2c('0xd6')],'as':_0x2c2c('0xd7'),'attributes':['id',_0x2c2c('0x2d')]});_0x562a2d[_0x2c2c('0xd0')]({'model':db[_0x2c2c('0x6e')],'as':_0x2c2c('0xd8'),'attributes':['id',_0x2c2c('0x31')]});return db[_0x2c2c('0x38')][_0x2c2c('0x6f')]({'where':{'id':_0x3fd7af['params']['id']},'include':_0x562a2d})[_0x2c2c('0x2b')](handleEntityNotFound(_0x27f88e,null))[_0x2c2c('0x2b')](function(_0x1c8442){if(_0x1c8442){var _0xec352d=_0x1c8442['get']({'plain':!![]});fs[_0x2c2c('0xd9')](_0x25af55);var _0x10f16c={'format':'A4','border':'10px','header':{'height':_0x2c2c('0xda'),'contents':{'first':_0x2c2c('0xdb')}},'footer':{'height':_0x2c2c('0xdc'),'contents':{'default':util[_0x2c2c('0xbe')](_0x2c2c('0xdd'),util[_0x2c2c('0xbe')](_0x2c2c('0xde'),_0x2c2c('0xdf'),_0xec352d['id']),moment()['format']('YYYY-MM-DD')[_0x2c2c('0xac')]())}}};var _0xa7198d={'channel':'Sms','account':_0xec352d[_0x2c2c('0xd7')]['name'],'agent':_0xec352d['Owner']?_0xec352d['Owner'][_0x2c2c('0x31')]:_0x2c2c('0xe0'),'createdAt':moment(_0xec352d['createdAt'])[_0x2c2c('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2c2c('0xac')](),'closedAt':_0xec352d['closed']?moment(_0xec352d[_0x2c2c('0xe1')])[_0x2c2c('0xbe')](_0x2c2c('0xbf'))[_0x2c2c('0xac')]():'','disposition':_0xec352d[_0x2c2c('0xe2')],'messages':_(_0xec352d[_0x2c2c('0xd3')])[_0x2c2c('0x83')]({'secret':![]})['map'](function(_0x47c8ec){return{'date':moment(_0x47c8ec['createdAt'])[_0x2c2c('0xbe')](_0x2c2c('0xbf'))[_0x2c2c('0xac')](),'sender':_0x47c8ec[_0x2c2c('0xd4')]===_0x2c2c('0xe3')?_0x47c8ec[_0x2c2c('0x6e')]?_0x47c8ec[_0x2c2c('0x6e')][_0x2c2c('0x31')]:_0x2c2c('0xe4'):_0x47c8ec['Contact'][_0x2c2c('0xd1')]+(_0x47c8ec[_0x2c2c('0x60')][_0x2c2c('0xd2')]?'\x20'+_0x47c8ec[_0x2c2c('0x60')][_0x2c2c('0xd2')]:''),'body':_0x47c8ec[_0x2c2c('0xb6')],'direction':_0x47c8ec[_0x2c2c('0xd4')]===_0x2c2c('0xe3')?'A':'C','secret':_0x47c8ec[_0x2c2c('0xd5')],'read':_0x47c8ec['read']};})['value']()};return ejs['renderFile'](path['join'](config[_0x2c2c('0xcb')],'server',_0x2c2c('0xe5'),'downloadInteraction.html'),{'interaction':_0xa7198d})['then'](function(_0x536289){return new BPromise(function(_0x2d963a,_0x42110d){pdf[_0x2c2c('0xb5')](_0x536289,_0x10f16c)[_0x2c2c('0xe6')](path[_0x2c2c('0xca')](_0x25af55,_0x2c2c('0xe7')+_0xec352d['id']+'-'+_0x18a6dd+'.pdf'),function(_0x5be366,_0x4c8fea){if(_0x5be366)return _0x42110d(_0x5be366);_0x2d963a(_0x4c8fea);});});})[_0x2c2c('0x2b')](function(){return new BPromise(function(_0x48d54d,_0x5cf23e){zipdir(_0x25af55,{'saveTo':_0x41ebbf},function(_0x5453b1,_0x1cac58){if(_0x5453b1)return _0x5cf23e(_0x5453b1);return _0x48d54d(_0x1cac58);});})[_0x2c2c('0x2b')](function(){return new BPromise(function(_0xc830a5,_0x21d3fc){rimraf(_0x25af55,function(_0x4b2721){if(_0x4b2721)_0x21d3fc(_0x4b2721);return _0xc830a5();});});})[_0x2c2c('0x2b')](function(){return _0x27f88e['download'](_0x41ebbf,_0x3f406b,function(_0xd1f891){if(_0xd1f891){console[_0x2c2c('0xe8')](_0x2c2c('0xe9'),_0xd1f891);}else{fs[_0x2c2c('0xea')](_0x41ebbf);}});});});}else{return _0x27f88e['sendStatus'](0xc8);}})['catch'](handleError(_0x27f88e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d78afd7..f8ba01e 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 _0xf725=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xf725,0x7e));var _0x5f72=function(_0x487351,_0x3c9a65){_0x487351=_0x487351-0x0;var _0x293d80=_0xf725[_0x487351];return _0x293d80;};'use strict';var EventEmitter=require(_0x5f72('0x0'));var SmsInteraction=require(_0x5f72('0x1'))['db'][_0x5f72('0x2')];var SmsMessage=require(_0x5f72('0x1'))['db'][_0x5f72('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5f72('0x4')](0x0);var events={'afterCreate':_0x5f72('0x5'),'afterUpdate':_0x5f72('0x6'),'afterDestroy':_0x5f72('0x7')};function emitEvent(_0x17a5bc){return function(_0x557be3,_0x453992,_0x14a92d){_0x557be3[_0x5f72('0x8')]({'attributes':['id'],'raw':!![]})[_0x5f72('0x9')](function(_0x148af8){_0x557be3[_0x5f72('0xa')](_0x5f72('0xb'),_0x148af8['map'](function(_0x499e28){return{'id':_0x499e28['id']};}));return SmsMessage[_0x5f72('0xc')]({'where':{'SmsInteractionId':_0x557be3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5f72('0x9')](function(_0x5b74cf){_0x557be3[_0x5f72('0xa')](_0x5f72('0xd'),_0x5b74cf['length']);SmsInteractionEvents[_0x5f72('0xe')](_0x17a5bc+':'+_0x557be3['id'],_0x557be3);SmsInteractionEvents[_0x5f72('0xe')](_0x17a5bc,_0x557be3);_0x14a92d(null);})[_0x5f72('0xf')](_0x14a92d(null));};}for(var e in events){if(events[_0x5f72('0x10')](e)){var event=events[e];SmsInteraction[_0x5f72('0x11')](e,emitEvent(event));}}module[_0x5f72('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x5fc3=['SmsMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x4a4bcd,_0x3438a4){var _0x4e2d0f=function(_0x1d61c5){while(--_0x1d61c5){_0x4a4bcd['push'](_0x4a4bcd['shift']());}};_0x4e2d0f(++_0x3438a4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x5fc3[_0x37a7c6];return _0x539905;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var SmsInteraction=require(_0x35fc('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x35fc('0x1'))['db'][_0x35fc('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x35fc('0x3')](0x0);var events={'afterCreate':_0x35fc('0x4'),'afterUpdate':_0x35fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2d1404){return function(_0x1d5fec,_0x186a06,_0x5b85ad){_0x1d5fec['getUsers']({'attributes':['id'],'raw':!![]})[_0x35fc('0x6')](function(_0x508b32){_0x1d5fec[_0x35fc('0x7')](_0x35fc('0x8'),_0x508b32[_0x35fc('0x9')](function(_0x1e5f90){return{'id':_0x1e5f90['id']};}));return SmsMessage[_0x35fc('0xa')]({'where':{'SmsInteractionId':_0x1d5fec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x35fc('0x6')](function(_0x2051ab){_0x1d5fec['setDataValue'](_0x35fc('0xb'),_0x2051ab[_0x35fc('0xc')]);SmsInteractionEvents['emit'](_0x2d1404+':'+_0x1d5fec['id'],_0x1d5fec);SmsInteractionEvents[_0x35fc('0xd')](_0x2d1404,_0x1d5fec);_0x5b85ad(null);})[_0x35fc('0xe')](_0x5b85ad(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x35fc('0xf')](e,emitEvent(event));}}module[_0x35fc('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7aff339..8386280 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 _0xfb6a=['closed','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfb6a,0x79));var _0xafb6=function(_0x10d341,_0x57ff35){_0x10d341=_0x10d341-0x0;var _0xddc36d=_0xfb6a[_0x10d341];return _0xddc36d;};'use strict';var _=require(_0xafb6('0x0'));var util=require('util');var logger=require(_0xafb6('0x1'))(_0xafb6('0x2'));var moment=require('moment');var BPromise=require(_0xafb6('0x3'));var rp=require(_0xafb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafb6('0x5'));var attributes=require(_0xafb6('0x6'));module[_0xafb6('0x7')]=function(_0x5b6795,_0xc92b9b){return _0x5b6795[_0xafb6('0x8')]('SmsInteraction',attributes,{'tableName':_0xafb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3532bd,_0x92024f,_0x229ce0){if(_0x3532bd[_0xafb6('0xa')](_0xafb6('0xb'))){_0x3532bd['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x229ce0(null,_0x3532bd);}}});}; \ No newline at end of file +var _0xbd2a=['rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path'];(function(_0x57c9ab,_0x4622fc){var _0x53afc0=function(_0x26cc14){while(--_0x26cc14){_0x57c9ab['push'](_0x57c9ab['shift']());}};_0x53afc0(++_0x4622fc);}(_0xbd2a,0x13d));var _0xabd2=function(_0x303d60,_0x26a9da){_0x303d60=_0x303d60-0x0;var _0x55854d=_0xbd2a[_0x303d60];return _0x55854d;};'use strict';var _=require('lodash');var util=require(_0xabd2('0x0'));var logger=require(_0xabd2('0x1'))('api');var moment=require(_0xabd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xabd2('0x3'));var fs=require('fs');var path=require(_0xabd2('0x4'));var rimraf=require(_0xabd2('0x5'));var config=require(_0xabd2('0x6'));var attributes=require(_0xabd2('0x7'));module[_0xabd2('0x8')]=function(_0x48184e,_0x5ab43e){return _0x48184e[_0xabd2('0x9')](_0xabd2('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x452091,_0x20c3c7,_0x15c7b6){if(_0x452091[_0xabd2('0xb')]('closed')){_0x452091['closedAt']=moment()[_0xabd2('0xc')](_0xabd2('0xd'));}_0x15c7b6(null,_0x452091);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ad46a9b..72dca48 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 _0xa831=['AddTagsToSmsInteraction','SmsInteraction','addTags','ids','omit','spread','AddTags','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','update','body','options','where'];(function(_0x35c4d8,_0x90c257){var _0xeb1b20=function(_0x1ec7c7){while(--_0x1ec7c7){_0x35c4d8['push'](_0x35c4d8['shift']());}};_0xeb1b20(++_0x90c257);}(_0xa831,0xca));var _0x1a83=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xa831[_0x319e2e];return _0x302524;};'use strict';var _=require('lodash');var util=require(_0x1a83('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a83('0x1'));var db=require(_0x1a83('0x2'))['db'];var utils=require(_0x1a83('0x3'));var logger=require(_0x1a83('0x4'))(_0x1a83('0x5'));var config=require(_0x1a83('0x6'));var jayson=require(_0x1a83('0x7'));var client=jayson['client'][_0x1a83('0x8')]({'port':0x232a});config['redis']=_[_0x1a83('0x9')](config['redis'],{'host':_0x1a83('0xa'),'port':0x18eb});var socket=require(_0x1a83('0xb'))(new Redis(config[_0x1a83('0xc')]));require(_0x1a83('0xd'))[_0x1a83('0xe')](socket);function respondWithRpcPromise(_0x4ab75a,_0x172955,_0x2d6ea6){return new BPromise(function(_0x177b84,_0x5a658e){return client['request'](_0x4ab75a,_0x2d6ea6)[_0x1a83('0xf')](function(_0x28a913){logger['info'](_0x1a83('0x10'),_0x172955,_0x1a83('0x11'));logger[_0x1a83('0x12')](_0x1a83('0x13'),_0x172955,_0x1a83('0x11'),JSON[_0x1a83('0x14')](_0x28a913));if(_0x28a913[_0x1a83('0x15')]){if(_0x28a913['error'][_0x1a83('0x16')]===0x1f4){logger['error'](_0x1a83('0x10'),_0x172955,_0x28a913['error'][_0x1a83('0x17')]);return _0x5a658e(_0x28a913[_0x1a83('0x15')][_0x1a83('0x17')]);}logger[_0x1a83('0x15')](_0x1a83('0x10'),_0x172955,_0x28a913[_0x1a83('0x15')][_0x1a83('0x17')]);return _0x177b84(_0x28a913['error'][_0x1a83('0x17')]);}else{logger[_0x1a83('0x18')](_0x1a83('0x10'),_0x172955,_0x1a83('0x11'));_0x177b84(_0x28a913[_0x1a83('0x19')][_0x1a83('0x17')]);}})[_0x1a83('0x1a')](function(_0x3a4769){logger[_0x1a83('0x15')](_0x1a83('0x10'),_0x172955,_0x3a4769);_0x5a658e(_0x3a4769);});});}exports[_0x1a83('0x1b')]=function(_0x4abe2d){var _0x506bec=this;return new Promise(function(_0x3fe9c1,_0x3af58a){return db['SmsInteraction'][_0x1a83('0x1c')](_0x4abe2d[_0x1a83('0x1d')],{'raw':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')][_0x1a83('0x1f')]||null:null,'attributes':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')]['attributes']||null:null,'limit':_0x4abe2d[_0x1a83('0x1e')]?_0x4abe2d[_0x1a83('0x1e')]['limit']||null:null})[_0x1a83('0xf')](function(_0x5113df){logger[_0x1a83('0x18')]('UpdateSmsInteraction',_0x4abe2d);logger['debug'](_0x1a83('0x1b'),_0x4abe2d,JSON[_0x1a83('0x14')](_0x5113df));_0x3fe9c1(_0x5113df);})[_0x1a83('0x1a')](function(_0x408897){logger[_0x1a83('0x15')](_0x1a83('0x1b'),_0x408897[_0x1a83('0x17')],_0x4abe2d);_0x3af58a(_0x506bec[_0x1a83('0x15')](0x1f4,_0x408897['message']));});});};exports[_0x1a83('0x20')]=function(_0x30eed3){return new Promise(function(_0x1651b1,_0x2e1f76){return db[_0x1a83('0x21')]['find']({'where':_0x30eed3[_0x1a83('0x1e')]?_0x30eed3[_0x1a83('0x1e')]['where']||null:null})['then'](function(_0x1f9d66){if(_0x1f9d66){return _0x1f9d66[_0x1a83('0x22')](_0x30eed3[_0x1a83('0x1d')][_0x1a83('0x23')],_[_0x1a83('0x24')](_0x30eed3[_0x1a83('0x1d')],[_0x1a83('0x23'),'id'])||{});}})[_0x1a83('0x25')](function(_0x454a6d){logger['info'](_0x1a83('0x26'),_0x30eed3);logger[_0x1a83('0x12')]('AddTags',_0x30eed3,JSON[_0x1a83('0x14')](_0x454a6d));_0x1651b1(_0x454a6d);})['catch'](function(_0x1414e1){logger[_0x1a83('0x15')](_0x1a83('0x26'),_0x1414e1[_0x1a83('0x17')],_0x30eed3);_0x2e1f76(_this[_0x1a83('0x15')](0x1f4,_0x1414e1[_0x1a83('0x17')]));});});}; \ No newline at end of file +var _0x5d87=['redis','defaults','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','error','code','message','result','SmsInteraction','update','body','options','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x452985,_0x1ca4af){var _0x115294=function(_0x38a74d){while(--_0x38a74d){_0x452985['push'](_0x452985['shift']());}};_0x115294(++_0x1ca4af);}(_0x5d87,0x115));var _0x75d8=function(_0x1208d7,_0x4d4ec0){_0x1208d7=_0x1208d7-0x0;var _0x4b4988=_0x5d87[_0x1208d7];return _0x4b4988;};'use strict';var _=require(_0x75d8('0x0'));var util=require(_0x75d8('0x1'));var moment=require('moment');var BPromise=require(_0x75d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75d8('0x3'));var db=require(_0x75d8('0x4'))['db'];var utils=require(_0x75d8('0x5'));var logger=require(_0x75d8('0x6'))('rpc');var config=require(_0x75d8('0x7'));var jayson=require(_0x75d8('0x8'));var client=jayson[_0x75d8('0x9')]['http']({'port':0x232a});config[_0x75d8('0xa')]=_[_0x75d8('0xb')](config[_0x75d8('0xa')],{'host':_0x75d8('0xc'),'port':0x18eb});var socket=require(_0x75d8('0xd'))(new Redis(config[_0x75d8('0xa')]));require(_0x75d8('0xe'))[_0x75d8('0xf')](socket);function respondWithRpcPromise(_0x5711d9,_0x430002,_0x5ace6d){return new BPromise(function(_0x8001ff,_0x500f8a){return client[_0x75d8('0x10')](_0x5711d9,_0x5ace6d)[_0x75d8('0x11')](function(_0x505063){logger[_0x75d8('0x12')](_0x75d8('0x13'),_0x430002,_0x75d8('0x14'));logger[_0x75d8('0x15')](_0x75d8('0x16'),_0x430002,_0x75d8('0x14'),JSON['stringify'](_0x505063));if(_0x505063[_0x75d8('0x17')]){if(_0x505063[_0x75d8('0x17')][_0x75d8('0x18')]===0x1f4){logger['error'](_0x75d8('0x13'),_0x430002,_0x505063['error'][_0x75d8('0x19')]);return _0x500f8a(_0x505063['error'][_0x75d8('0x19')]);}logger[_0x75d8('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x430002,_0x505063[_0x75d8('0x17')][_0x75d8('0x19')]);return _0x8001ff(_0x505063['error']['message']);}else{logger[_0x75d8('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x430002,_0x75d8('0x14'));_0x8001ff(_0x505063[_0x75d8('0x1a')][_0x75d8('0x19')]);}})['catch'](function(_0x4d438c){logger[_0x75d8('0x17')](_0x75d8('0x13'),_0x430002,_0x4d438c);_0x500f8a(_0x4d438c);});});}exports['UpdateSmsInteraction']=function(_0x52950a){var _0x240df0=this;return new Promise(function(_0x457a6e,_0x5a5137){return db[_0x75d8('0x1b')][_0x75d8('0x1c')](_0x52950a[_0x75d8('0x1d')],{'raw':_0x52950a[_0x75d8('0x1e')]?_0x52950a[_0x75d8('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52950a['options']?_0x52950a['options']['where']||null:null,'attributes':_0x52950a[_0x75d8('0x1e')]?_0x52950a[_0x75d8('0x1e')][_0x75d8('0x1f')]||null:null,'limit':_0x52950a[_0x75d8('0x1e')]?_0x52950a[_0x75d8('0x1e')]['limit']||null:null})['then'](function(_0x35eb08){logger[_0x75d8('0x12')](_0x75d8('0x20'),_0x52950a);logger[_0x75d8('0x15')](_0x75d8('0x20'),_0x52950a,JSON[_0x75d8('0x21')](_0x35eb08));_0x457a6e(_0x35eb08);})['catch'](function(_0x5ed3f0){logger['error'](_0x75d8('0x20'),_0x5ed3f0[_0x75d8('0x19')],_0x52950a);_0x5a5137(_0x240df0[_0x75d8('0x17')](0x1f4,_0x5ed3f0['message']));});});};exports[_0x75d8('0x22')]=function(_0x9392e4){return new Promise(function(_0x19c1ba,_0x311917){return db[_0x75d8('0x1b')][_0x75d8('0x23')]({'where':_0x9392e4[_0x75d8('0x1e')]?_0x9392e4[_0x75d8('0x1e')]['where']||null:null})['then'](function(_0x31b1f6){if(_0x31b1f6){return _0x31b1f6['addTags'](_0x9392e4['body'][_0x75d8('0x24')],_[_0x75d8('0x25')](_0x9392e4[_0x75d8('0x1d')],[_0x75d8('0x24'),'id'])||{});}})[_0x75d8('0x26')](function(_0x37e7a6){logger[_0x75d8('0x12')]('AddTags',_0x9392e4);logger['debug'](_0x75d8('0x27'),_0x9392e4,JSON['stringify'](_0x37e7a6));_0x19c1ba(_0x37e7a6);})[_0x75d8('0x28')](function(_0x1185d9){logger[_0x75d8('0x17')](_0x75d8('0x27'),_0x1185d9['message'],_0x9392e4);_0x311917(_this[_0x75d8('0x17')](0x1f4,_0x1185d9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d99b52b..5403ab3 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x27bd60,_0x10e9fb){var _0x1784c0=function(_0x5a23f0){while(--_0x5a23f0){_0x27bd60['push'](_0x27bd60['shift']());}};_0x1784c0(++_0x10e9fb);}(_0x757a,0xde));var _0xa757=function(_0x39ddd2,_0x1626b4){_0x39ddd2=_0x39ddd2-0x0;var _0x1424c1=_0x757a[_0x39ddd2];return _0x1424c1;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x30345f,_0x51718e){var _0x20f2fe=function(_0x4edb09){while(--_0x4edb09){_0x30345f['push'](_0x30345f['shift']());}};_0x20f2fe(++_0x51718e);}(_0x757a,0xde));var _0xa757=function(_0x1365a8,_0x35fbc8){_0x1365a8=_0x1365a8-0x0;var _0x4de0bf=_0x757a[_0x1365a8];return _0x4de0bf;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a1181b6..7c5d1f6 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 _0x98e9=['express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','show','post','sms','smsmessage:create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','path','connect-timeout'];(function(_0x21ae6f,_0x2ca34d){var _0x4d0e36=function(_0x595217){while(--_0x595217){_0x21ae6f['push'](_0x21ae6f['shift']());}};_0x4d0e36(++_0x2ca34d);}(_0x98e9,0x14e));var _0x998e=function(_0x292e3c,_0xc94a85){_0x292e3c=_0x292e3c-0x0;var _0xc9a35c=_0x98e9[_0x292e3c];return _0xc9a35c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x998e('0x0'));var timeout=require(_0x998e('0x1'));var express=require(_0x998e('0x2'));var router=express[_0x998e('0x3')]();var auth=require(_0x998e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x998e('0x5'));var controller=require(_0x998e('0x6'));router[_0x998e('0x7')]('/',auth['isAuthenticated'](),controller[_0x998e('0x8')]);router['get']('/describe',auth[_0x998e('0x9')](),controller[_0x998e('0xa')]);router[_0x998e('0x7')]('/:id',auth[_0x998e('0x9')](),controller[_0x998e('0xb')]);router[_0x998e('0xc')]('/',auth[_0x998e('0x9')](),interaction['tracked'](_0x998e('0xd'),_0x998e('0xe')),controller['create']);router[_0x998e('0xc')](_0x998e('0xf'),controller[_0x998e('0x10')]);router[_0x998e('0x11')](_0x998e('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x998e('0x11')](_0x998e('0x13'),auth[_0x998e('0x9')](),controller[_0x998e('0x14')]);router[_0x998e('0x11')](_0x998e('0x15'),auth['isAuthenticated'](),controller[_0x998e('0x16')]);router[_0x998e('0x17')](_0x998e('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x727d=['index','/describe','isAuthenticated','describe','/:id','show','post','sms','create','status','update','/:id/accept','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get'];(function(_0x2e9094,_0x3765b8){var _0x5b5cab=function(_0x3c2925){while(--_0x3c2925){_0x2e9094['push'](_0x2e9094['shift']());}};_0x5b5cab(++_0x3765b8);}(_0x727d,0xf1));var _0xd727=function(_0x50c7e5,_0x380f0f){_0x50c7e5=_0x50c7e5-0x0;var _0x108f56=_0x727d[_0x50c7e5];return _0x108f56;};'use strict';var multer=require('multer');var util=require(_0xd727('0x0'));var path=require(_0xd727('0x1'));var timeout=require(_0xd727('0x2'));var express=require(_0xd727('0x3'));var router=express[_0xd727('0x4')]();var auth=require(_0xd727('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd727('0x6'));var controller=require(_0xd727('0x7'));router[_0xd727('0x8')]('/',auth['isAuthenticated'](),controller[_0xd727('0x9')]);router[_0xd727('0x8')](_0xd727('0xa'),auth[_0xd727('0xb')](),controller[_0xd727('0xc')]);router[_0xd727('0x8')](_0xd727('0xd'),auth[_0xd727('0xb')](),controller[_0xd727('0xe')]);router[_0xd727('0xf')]('/',auth[_0xd727('0xb')](),interaction['tracked'](_0xd727('0x10'),'smsmessage:create'),controller[_0xd727('0x11')]);router[_0xd727('0xf')]('/:id/status',controller[_0xd727('0x12')]);router['put'](_0xd727('0xd'),auth[_0xd727('0xb')](),controller[_0xd727('0x13')]);router['put'](_0xd727('0x14'),auth[_0xd727('0xb')](),controller['accept']);router[_0xd727('0x15')]('/:id/reject',auth[_0xd727('0xb')](),controller['reject']);router[_0xd727('0x16')](_0xd727('0xd'),auth[_0xd727('0xb')](),controller[_0xd727('0x17')]);module[_0xd727('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a6d4b63..a4b14fa 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 _0x7262=['STRING','DATE','BOOLEAN','sequelize','ENUM','out'];(function(_0x4a7fc8,_0x3d2a12){var _0xc6bf=function(_0x5a6003){while(--_0x5a6003){_0x4a7fc8['push'](_0x4a7fc8['shift']());}};_0xc6bf(++_0x3d2a12);}(_0x7262,0x8d));var _0x2726=function(_0x11dba1,_0x54dff2){_0x11dba1=_0x11dba1-0x0;var _0x50ef22=_0x7262[_0x11dba1];return _0x50ef22;};'use strict';var Sequelize=require(_0x2726('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2726('0x1')]('in',_0x2726('0x2')),'defaultValue':_0x2726('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2726('0x3')](0xbe)},'phone':{'type':Sequelize[_0x2726('0x3')]},'readAt':{'type':Sequelize[_0x2726('0x4')]},'secret':{'type':Sequelize[_0x2726('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2726('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6c3a=['sequelize','exports','medium','ENUM','out','STRING','BOOLEAN','TEXT'];(function(_0x3719b9,_0x15d82e){var _0x3f8893=function(_0x2301b9){while(--_0x2301b9){_0x3719b9['push'](_0x3719b9['shift']());}};_0x3f8893(++_0x15d82e);}(_0x6c3a,0x198));var _0xa6c3=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x6c3a[_0xcfd89f];return _0x59acd4;};'use strict';var Sequelize=require(_0xa6c3('0x0'));module[_0xa6c3('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa6c3('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa6c3('0x3')]('in',_0xa6c3('0x4')),'defaultValue':_0xa6c3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa6c3('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa6c3('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa6c3('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c1af6fe..46909c7 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 _0x7026=['count','offset','limit','Content-Range','apply','reject','update','destroy','then','send','index','map','SmsMessage','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','include','show','params','includeAll','options','find','create','body','sms-interactions','sms','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','SmsInteractionId','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','groupName','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','json'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7026,0x152));var _0x6702=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7026[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x6702('0x0'));var emlformat=require(_0x6702('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6702('0x2'));var jsonpatch=require(_0x6702('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6702('0x4'));var util=require(_0x6702('0x5'));var path=require('path');var sox=require(_0x6702('0x6'));var csv=require(_0x6702('0x7'));var ejs=require(_0x6702('0x8'));var fs=require('fs');var _=require(_0x6702('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6702('0xa'));var toCsv=require(_0x6702('0x7'));var querystring=require(_0x6702('0xb'));var Papa=require(_0x6702('0xc'));var Redis=require(_0x6702('0xd'));var authService=require(_0x6702('0xe'));var qs=require(_0x6702('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6702('0x10'))('api');var utils=require(_0x6702('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6702('0x12')]=_[_0x6702('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6702('0x14'))(new Redis(config[_0x6702('0x12')]));require(_0x6702('0x15'))[_0x6702('0x16')](socket);var jayson=require(_0x6702('0x17'));var client=jayson[_0x6702('0x18')][_0x6702('0x19')]({'port':0x232c});var client9002=jayson[_0x6702('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4198bd,_0x1c8294,_0x11b263,_0x4e2b02){return new BPromise(function(_0x517c5f,_0x14e49b){var _0xf38ab3=_0x4e2b02||client;return _0xf38ab3[_0x6702('0x1a')](_0x4198bd,_0x11b263)['then'](function(_0x3af4df){logger['info'](_0x6702('0x1b'),_0x1c8294,'request\x20sent');logger[_0x6702('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1c8294,'request\x20sent',JSON[_0x6702('0x1d')](_0x3af4df));if(_0x3af4df[_0x6702('0x1e')]){if(_0x3af4df['error'][_0x6702('0x1f')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1c8294,_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);return _0x14e49b(_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);}logger[_0x6702('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x1c8294,_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);return _0x517c5f(_0x3af4df[_0x6702('0x1e')][_0x6702('0x20')]);}else{logger[_0x6702('0x21')]('SmsMessage,\x20%s,\x20%s',_0x1c8294,'request\x20sent');_0x517c5f(_0x3af4df[_0x6702('0x22')][_0x6702('0x20')]);}})[_0x6702('0x23')](function(_0x205277){logger[_0x6702('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x1c8294,_0x205277);_0x14e49b(_0x205277);});});}function respondWithStatusCode(_0x241341,_0x379f94){_0x379f94=_0x379f94||0xcc;return function(_0x3a447f){if(_0x3a447f){return _0x241341[_0x6702('0x24')](_0x379f94);}return _0x241341['status'](_0x379f94)[_0x6702('0x25')]();};}function respondWithResult(_0x3be04d,_0x17eac4){_0x17eac4=_0x17eac4||0xc8;return function(_0x472665){if(_0x472665){return _0x3be04d[_0x6702('0x26')](_0x17eac4)[_0x6702('0x27')](_0x472665);}};}function respondWithFilteredResult(_0x4792c0,_0x5ce1d7){return function(_0x4f295b){if(_0x4f295b){var _0x36818d=_0x4f295b[_0x6702('0x28')],_0x12da73=_0x5ce1d7['offset'],_0x489e45=_0x5ce1d7[_0x6702('0x29')]+_0x5ce1d7[_0x6702('0x2a')],_0x1ff473;if(_0x489e45>=_0x36818d){_0x489e45=_0x36818d;_0x1ff473=0xc8;}else{_0x1ff473=0xce;}_0x4792c0[_0x6702('0x26')](_0x1ff473);return _0x4792c0['set'](_0x6702('0x2b'),_0x12da73+'-'+_0x489e45+'/'+_0x36818d)[_0x6702('0x27')](_0x4f295b);}return null;};}function patchUpdates(_0x395885){return function(_0x21a27f){try{jsonpatch[_0x6702('0x2c')](_0x21a27f,_0x395885,!![]);}catch(_0x5a8c8e){return BPromise[_0x6702('0x2d')](_0x5a8c8e);}return _0x21a27f['save']();};}function saveUpdates(_0x4eb6dc,_0x153deb){return function(_0x16cb3a){if(_0x16cb3a){return _0x16cb3a[_0x6702('0x2e')](_0x4eb6dc)['then'](function(_0x27ef90){return _0x27ef90;});}return null;};}function removeEntity(_0x2c94ac,_0x38ca1b){return function(_0x257f83){if(_0x257f83){return _0x257f83[_0x6702('0x2f')]()[_0x6702('0x30')](function(){_0x2c94ac[_0x6702('0x26')](0xcc)[_0x6702('0x25')]();});}};}function handleEntityNotFound(_0xc5bf2c,_0x12f57a){return function(_0x4b8cd5){if(!_0x4b8cd5){_0xc5bf2c[_0x6702('0x24')](0x194);}return _0x4b8cd5;};}function handleError(_0x431ed9,_0x6ba486){_0x6ba486=_0x6ba486||0x1f4;return function(_0x123118){logger[_0x6702('0x1e')](_0x123118['stack']);if(_0x123118['name']){delete _0x123118['name'];}_0x431ed9['status'](_0x6ba486)[_0x6702('0x31')](_0x123118);};}exports[_0x6702('0x32')]=function(_0x2c07de,_0x388544){var _0x16d6b8={},_0x2d1987={},_0xfa59bb={'count':0x0,'rows':[]};var _0x143539=_[_0x6702('0x33')](db[_0x6702('0x34')][_0x6702('0x35')],function(_0x52b70a){return{'name':_0x52b70a[_0x6702('0x36')],'type':_0x52b70a['type']['key']};});_0x2d1987[_0x6702('0x37')]=_[_0x6702('0x33')](_0x143539,_0x6702('0x38'));_0x2d1987[_0x6702('0x39')]=_[_0x6702('0x3a')](_0x2c07de['query']);_0x2d1987[_0x6702('0x3b')]=_[_0x6702('0x3c')](_0x2d1987[_0x6702('0x37')],_0x2d1987[_0x6702('0x39')]);_0x16d6b8[_0x6702('0x3d')]=_[_0x6702('0x3c')](_0x2d1987[_0x6702('0x37')],qs[_0x6702('0x3e')](_0x2c07de[_0x6702('0x39')][_0x6702('0x3e')]));_0x16d6b8[_0x6702('0x3d')]=_0x16d6b8[_0x6702('0x3d')][_0x6702('0x3f')]?_0x16d6b8[_0x6702('0x3d')]:_0x2d1987[_0x6702('0x37')];if(!_0x2c07de[_0x6702('0x39')][_0x6702('0x40')](_0x6702('0x41'))){_0x16d6b8['limit']=qs[_0x6702('0x2a')](_0x2c07de[_0x6702('0x39')][_0x6702('0x2a')]);_0x16d6b8[_0x6702('0x29')]=qs[_0x6702('0x29')](_0x2c07de[_0x6702('0x39')][_0x6702('0x29')]);}_0x16d6b8[_0x6702('0x42')]=qs['sort'](_0x2c07de[_0x6702('0x39')]['sort']);_0x16d6b8['where']=qs['filters'](_['pick'](_0x2c07de[_0x6702('0x39')],_0x2d1987[_0x6702('0x3b')]),_0x143539);if(_0x2c07de[_0x6702('0x39')][_0x6702('0x43')]){_0x16d6b8['where']=_[_0x6702('0x44')](_0x16d6b8[_0x6702('0x45')],{'$or':_[_0x6702('0x33')](_0x143539,function(_0x682fb3){if(_0x682fb3['type']!==_0x6702('0x46')){var _0x22894d={};_0x22894d[_0x682fb3['name']]={'$like':'%'+_0x2c07de[_0x6702('0x39')][_0x6702('0x43')]+'%'};return _0x22894d;}})});}_0x16d6b8=_[_0x6702('0x44')]({},_0x16d6b8,_0x2c07de['options']);var _0x3a0e37={'where':_0x16d6b8[_0x6702('0x45')]};return db['SmsMessage'][_0x6702('0x28')](_0x3a0e37)[_0x6702('0x30')](function(_0x23deb2){_0xfa59bb[_0x6702('0x28')]=_0x23deb2;if(_0x2c07de[_0x6702('0x39')]['includeAll']){_0x16d6b8[_0x6702('0x47')]=[{'all':!![]}];}return db[_0x6702('0x34')]['findAll'](_0x16d6b8);})['then'](function(_0x2921c5){_0xfa59bb['rows']=_0x2921c5;return _0xfa59bb;})[_0x6702('0x30')](respondWithFilteredResult(_0x388544,_0x16d6b8))[_0x6702('0x23')](handleError(_0x388544,null));};exports[_0x6702('0x48')]=function(_0x5342d2,_0x3434a3){var _0x1fbde8={'raw':!![],'where':{'id':_0x5342d2[_0x6702('0x49')]['id']}},_0x5793bb={};_0x5793bb[_0x6702('0x37')]=_[_0x6702('0x3a')](db[_0x6702('0x34')][_0x6702('0x35')]);_0x5793bb[_0x6702('0x39')]=_[_0x6702('0x3a')](_0x5342d2[_0x6702('0x39')]);_0x5793bb[_0x6702('0x3b')]=_[_0x6702('0x3c')](_0x5793bb[_0x6702('0x37')],_0x5793bb['query']);_0x1fbde8[_0x6702('0x3d')]=_[_0x6702('0x3c')](_0x5793bb['model'],qs[_0x6702('0x3e')](_0x5342d2[_0x6702('0x39')][_0x6702('0x3e')]));_0x1fbde8[_0x6702('0x3d')]=_0x1fbde8[_0x6702('0x3d')][_0x6702('0x3f')]?_0x1fbde8[_0x6702('0x3d')]:_0x5793bb[_0x6702('0x37')];if(_0x5342d2[_0x6702('0x39')][_0x6702('0x4a')]){_0x1fbde8[_0x6702('0x47')]=[{'all':!![]}];}_0x1fbde8=_[_0x6702('0x44')]({},_0x1fbde8,_0x5342d2[_0x6702('0x4b')]);return db[_0x6702('0x34')][_0x6702('0x4c')](_0x1fbde8)[_0x6702('0x30')](handleEntityNotFound(_0x3434a3,null))[_0x6702('0x30')](respondWithResult(_0x3434a3,null))[_0x6702('0x23')](handleError(_0x3434a3,null));};exports[_0x6702('0x4d')]=function(_0x34e9f3,_0x585637){return db[_0x6702('0x34')][_0x6702('0x4d')](_0x34e9f3['body'],{})['then'](respondWithResult(_0x585637,0xc9))[_0x6702('0x23')](handleError(_0x585637,null));};exports['update']=function(_0x5e61c9,_0x3aa338){if(_0x5e61c9[_0x6702('0x4e')]['id']){delete _0x5e61c9[_0x6702('0x4e')]['id'];}return db[_0x6702('0x34')][_0x6702('0x4c')]({'where':{'id':_0x5e61c9[_0x6702('0x49')]['id']}})['then'](handleEntityNotFound(_0x3aa338,null))['then'](saveUpdates(_0x5e61c9[_0x6702('0x4e')],null))[_0x6702('0x30')](respondWithResult(_0x3aa338,null))[_0x6702('0x23')](handleError(_0x3aa338,null));};exports[_0x6702('0x2f')]=function(_0x99b209,_0x4342f2){return db[_0x6702('0x34')][_0x6702('0x4c')]({'where':{'id':_0x99b209[_0x6702('0x49')]['id']}})[_0x6702('0x30')](handleEntityNotFound(_0x4342f2,null))[_0x6702('0x30')](removeEntity(_0x4342f2,null))[_0x6702('0x23')](handleError(_0x4342f2,null));};exports['describe']=function(_0x4a64c8,_0x411bda){return db[_0x6702('0x34')]['describe']()['then'](respondWithResult(_0x411bda,null))[_0x6702('0x23')](handleError(_0x411bda,null));};var interaction_log=require(_0x6702('0x10'))(_0x6702('0x4f'));exports['accept']=function(_0x19c4a0,_0x4a8406,_0x8c298a){var _0x181e7c={'channel':_0x6702('0x50')};if(_0x19c4a0[_0x6702('0x4e')]['id']){delete _0x19c4a0[_0x6702('0x4e')]['id'];}_0x19c4a0[_0x6702('0x4e')]['read']=!![];_0x19c4a0['body']['readAt']=moment()['format'](_0x6702('0x51'));_0x19c4a0['body']['UserId']=_0x19c4a0[_0x6702('0x4e')][_0x6702('0x52')]||_0x19c4a0[_0x6702('0x53')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x19c4a0[_0x6702('0x49')]['id'],'UserId':null},'include':[{'model':db[_0x6702('0x54')],'as':_0x6702('0x55')}]})[_0x6702('0x30')](handleEntityNotFound(_0x4a8406,null))[_0x6702('0x30')](saveUpdates(_0x19c4a0[_0x6702('0x4e')],null))[_0x6702('0x30')](function(_0x2c39fc){if(_0x2c39fc){_0x181e7c[_0x6702('0x20')]=_0x2c39fc[_0x6702('0x56')]({'plain':!![]});return db[_0x6702('0x57')][_0x6702('0x4c')]({'where':{'id':_0x2c39fc['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4a8406,null))['then'](function(_0x59c4af){if(_0x59c4af){return _0x59c4af[_0x6702('0x2e')]({'UserId':_0x19c4a0[_0x6702('0x4e')][_0x6702('0x52')],'read1stAt':_[_0x6702('0x58')](_0x59c4af[_0x6702('0x59')])?moment()[_0x6702('0x5a')](_0x6702('0x51')):undefined});}return null;})[_0x6702('0x30')](function(_0x40eed2){if(_0x40eed2){_0x181e7c[_0x6702('0x5b')]=_0x40eed2[_0x6702('0x56')]({'plain':!![]});interaction_log[_0x6702('0x21')](_0x6702('0x5c'),_0x19c4a0[_0x6702('0x53')]['id'],_0x19c4a0[_0x6702('0x53')][_0x6702('0x38')],_0x19c4a0['user'][_0x6702('0x5d')],_0x181e7c['interaction']['id'],_0x19c4a0[_0x6702('0x4e')]?JSON[_0x6702('0x1d')](_0x19c4a0[_0x6702('0x4e')]):_0x6702('0x5e'));return respondWithRpcPromise(_0x6702('0x5f'),_0x6702('0x60'),_0x181e7c);}return null;})[_0x6702('0x30')](function(_0x5bc97a){if(_0x5bc97a){if(_0x19c4a0[_0x6702('0x4e')][_0x6702('0x61')]){_0x181e7c[_0x6702('0x20')]['interface']=util[_0x6702('0x5a')](_0x6702('0x62'),_0x19c4a0[_0x6702('0x53')][_0x6702('0x38')]);_0x181e7c['message'][_0x6702('0x63')]=_0x181e7c[_0x6702('0x63')];_0x181e7c['message'][_0x6702('0x64')]=_0x6702('0x65');return respondWithRpcPromise(_0x6702('0x66'),'EventManager',{'event':_0x6702('0x67'),'message':_0x181e7c[_0x6702('0x20')]},client9002)[_0x6702('0x30')](function(){return _0x181e7c;});}return _0x181e7c;}return null;})[_0x6702('0x30')](respondWithResult(_0x4a8406,null))['catch'](handleError(_0x4a8406,null));};var interaction_log=require('../../config/logger')(_0x6702('0x4f'));exports[_0x6702('0x2d')]=function(_0x52ad9a,_0x3a1269,_0xce68b2){var _0x5eac0d={'agent':{},'channel':_0x6702('0x50')};if(_0x52ad9a['body']['id']){delete _0x52ad9a[_0x6702('0x4e')]['id'];}_0x52ad9a[_0x6702('0x4e')][_0x6702('0x52')]=_0x52ad9a[_0x6702('0x4e')][_0x6702('0x52')]||_0x52ad9a[_0x6702('0x53')]['id'];_0x5eac0d['agent']['id']=_0x52ad9a[_0x6702('0x4e')][_0x6702('0x52')];return db['SmsMessage']['find']({'where':{'id':_0x52ad9a[_0x6702('0x49')]['id'],'UserId':null}})[_0x6702('0x30')](handleEntityNotFound(_0x3a1269,null))[_0x6702('0x30')](function(_0x206e21){if(_0x206e21){_0x5eac0d['message']=_0x206e21[_0x6702('0x56')]({'plain':!![]});return db[_0x6702('0x57')][_0x6702('0x4c')]({'where':{'id':_0x206e21[_0x6702('0x68')]}});}return null;})[_0x6702('0x30')](handleEntityNotFound(_0x3a1269,null))[_0x6702('0x30')](function(_0x5158ce){if(_0x5158ce){_0x5eac0d[_0x6702('0x5b')]=_0x5158ce[_0x6702('0x56')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x52ad9a['user']['id'],_0x52ad9a['user'][_0x6702('0x38')],_0x52ad9a[_0x6702('0x53')][_0x6702('0x5d')],_0x5eac0d['interaction']['id'],_0x52ad9a[_0x6702('0x4e')]?JSON['stringify'](_0x52ad9a[_0x6702('0x4e')]):_0x6702('0x5e'));return respondWithRpcPromise(_0x6702('0x69'),_0x6702('0x6a'),_0x5eac0d);}return null;})['then'](function(_0x308aa8){if(_0x308aa8){_0x308aa8[_0x6702('0x20')][_0x6702('0x6b')]=util['format'](_0x6702('0x62'),_0x52ad9a[_0x6702('0x53')][_0x6702('0x38')]);_0x308aa8[_0x6702('0x20')]['channel']=_0x5eac0d[_0x6702('0x63')];_0x308aa8[_0x6702('0x20')][_0x6702('0x64')]=_0x6702('0x2d');respondWithRpcPromise(_0x6702('0x66'),_0x6702('0x66'),{'event':_0x6702('0x6c'),'message':_0x308aa8[_0x6702('0x20')]},client9002);return _0x5eac0d;}return null;})[_0x6702('0x30')](respondWithResult(_0x3a1269,null))['catch'](handleError(_0x3a1269,null));};exports[_0x6702('0x26')]=function(_0x447bb6,_0x11016d,_0x5206cc){if(_0x447bb6[_0x6702('0x4e')]['id']){delete _0x447bb6[_0x6702('0x4e')]['id'];}var _0x183c29;return db[_0x6702('0x34')][_0x6702('0x4c')]({'where':{'id':_0x447bb6[_0x6702('0x49')]['id']}})['then'](handleEntityNotFound(_0x11016d,null))[_0x6702('0x30')](function(_0x108c3e){if(_0x108c3e){_0x183c29=_0x108c3e;return db[_0x6702('0x6d')][_0x6702('0x4c')]({'where':{'id':_0x108c3e['SmsAccountId']}});}})[_0x6702('0x30')](handleEntityNotFound(_0x11016d,null))[_0x6702('0x30')](function(_0x27d67d){if(_0x27d67d){logger[_0x6702('0x1c')](_0x6702('0x6e'),_0x6702('0x26'),_0x6702('0x6f'),_0x27d67d[_0x6702('0x70')],util[_0x6702('0x71')](_0x447bb6[_0x6702('0x4e')],{'showHidden':![],'depth':null}));switch(_0x27d67d[_0x6702('0x70')]){case _0x6702('0x72'):if(_0x447bb6[_0x6702('0x4e')][_0x6702('0x73')]&&_0x447bb6[_0x6702('0x4e')][_0x6702('0x73')]===_0x183c29[_0x6702('0x74')]){return _0x183c29[_0x6702('0x2e')]({'read':!![]});}else{logger[_0x6702('0x1e')](_0x6702('0x75'),_0x6702('0x26'),_0x6702('0x72'),util[_0x6702('0x71')](_0x447bb6['body'],{'showHidden':![],'depth':null}));}break;case _0x6702('0x76'):if(_0x447bb6[_0x6702('0x4e')][_0x6702('0x77')]&&_0x447bb6['body'][_0x6702('0x77')]===_0x183c29[_0x6702('0x74')]&&_[_0x6702('0x78')]([_0x6702('0x79'),'delivered'],_0x447bb6['body']['Status'])>=0x0){return _0x183c29[_0x6702('0x2e')]({'read':!![]});}else{logger['error'](_0x6702('0x75'),_0x6702('0x26'),_0x6702('0x7a'),util[_0x6702('0x71')](_0x447bb6[_0x6702('0x4e')],{'showHidden':![],'depth':null}));}break;case _0x6702('0x7b'):var _0x3dbde7=_0x447bb6[_0x6702('0x4e')][_0x6702('0x7c')][0x0];if(_0x3dbde7['status'][_0x6702('0x7d')]==='DELIVERED'){return _0x183c29[_0x6702('0x2e')]({'read':!![]});}else{logger[_0x6702('0x1e')](_0x6702('0x75'),_0x6702('0x26'),_0x6702('0x7b'),util[_0x6702('0x71')](_0x447bb6['body'],{'showHidden':![],'depth':null}));}break;}return _0x183c29;}})['then'](respondWithResult(_0x11016d,null))[_0x6702('0x23')](handleError(_0x11016d,null));}; \ No newline at end of file +var _0xf610=['[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsMessage.socket','register','jayson/promise','client','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','status','end','offset','limit','set','Content-Range','apply','reject','save','sendStatus','name','send','map','SmsMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','merge','where','filter','options','count','include','findAll','rows','show','params','keys','includeAll','find','create','body','update','destroy','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','../../config/logger','agent','info'];(function(_0x1ae139,_0x529c60){var _0x5e0de7=function(_0x2b8273){while(--_0x2b8273){_0x1ae139['push'](_0x1ae139['shift']());}};_0x5e0de7(++_0x529c60);}(_0xf610,0x199));var _0x0f61=function(_0x58fb9b,_0x345a74){_0x58fb9b=_0x58fb9b-0x0;var _0x496ffe=_0xf610[_0x58fb9b];return _0x496ffe;};'use strict';var pdf=require(_0x0f61('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f61('0x1'));var jsonpatch=require(_0x0f61('0x2'));var rp=require(_0x0f61('0x3'));var moment=require('moment');var BPromise=require(_0x0f61('0x4'));var Mustache=require('mustache');var util=require(_0x0f61('0x5'));var path=require(_0x0f61('0x6'));var sox=require(_0x0f61('0x7'));var csv=require(_0x0f61('0x8'));var ejs=require(_0x0f61('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f61('0xa'));var jsforce=require(_0x0f61('0xb'));var deskjs=require(_0x0f61('0xc'));var toCsv=require(_0x0f61('0x8'));var querystring=require(_0x0f61('0xd'));var Papa=require('papaparse');var Redis=require(_0x0f61('0xe'));var authService=require(_0x0f61('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0f61('0x10'));var hardwareService=require(_0x0f61('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0f61('0x12'));var licenseUtil=require(_0x0f61('0x13'));var db=require(_0x0f61('0x14'))['db'];config[_0x0f61('0x15')]=_['defaults'](config[_0x0f61('0x15')],{'host':_0x0f61('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f61('0x17'))[_0x0f61('0x18')](socket);var jayson=require(_0x0f61('0x19'));var client=jayson[_0x0f61('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x0f61('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4da776,_0x174b69,_0x5932b6,_0x40a676){return new BPromise(function(_0x1052fa,_0x20803a){var _0x4038dd=_0x40a676||client;return _0x4038dd['request'](_0x4da776,_0x5932b6)[_0x0f61('0x1b')](function(_0x409d3d){logger['info'](_0x0f61('0x1c'),_0x174b69,'request\x20sent');logger[_0x0f61('0x1d')](_0x0f61('0x1e'),_0x174b69,'request\x20sent',JSON[_0x0f61('0x1f')](_0x409d3d));if(_0x409d3d[_0x0f61('0x20')]){if(_0x409d3d[_0x0f61('0x20')]['code']===0x1f4){logger[_0x0f61('0x20')](_0x0f61('0x1c'),_0x174b69,_0x409d3d[_0x0f61('0x20')][_0x0f61('0x21')]);return _0x20803a(_0x409d3d['error'][_0x0f61('0x21')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x174b69,_0x409d3d[_0x0f61('0x20')]['message']);return _0x1052fa(_0x409d3d['error'][_0x0f61('0x21')]);}else{logger['info'](_0x0f61('0x1c'),_0x174b69,_0x0f61('0x22'));_0x1052fa(_0x409d3d['result'][_0x0f61('0x21')]);}})[_0x0f61('0x23')](function(_0x2d7717){logger['error']('SmsMessage,\x20%s,\x20%s',_0x174b69,_0x2d7717);_0x20803a(_0x2d7717);});});}function respondWithStatusCode(_0x545b6d,_0x1fabab){_0x1fabab=_0x1fabab||0xcc;return function(_0x5f31f1){if(_0x5f31f1){return _0x545b6d['sendStatus'](_0x1fabab);}return _0x545b6d[_0x0f61('0x24')](_0x1fabab)[_0x0f61('0x25')]();};}function respondWithResult(_0x23baa9,_0x117ef0){_0x117ef0=_0x117ef0||0xc8;return function(_0x36e3db){if(_0x36e3db){return _0x23baa9[_0x0f61('0x24')](_0x117ef0)['json'](_0x36e3db);}};}function respondWithFilteredResult(_0x3191de,_0x4ec347){return function(_0x28a937){if(_0x28a937){var _0x28d9a1=_0x28a937['count'],_0x3f04d9=_0x4ec347[_0x0f61('0x26')],_0x33d6eb=_0x4ec347[_0x0f61('0x26')]+_0x4ec347[_0x0f61('0x27')],_0x5dfbc5;if(_0x33d6eb>=_0x28d9a1){_0x33d6eb=_0x28d9a1;_0x5dfbc5=0xc8;}else{_0x5dfbc5=0xce;}_0x3191de[_0x0f61('0x24')](_0x5dfbc5);return _0x3191de[_0x0f61('0x28')](_0x0f61('0x29'),_0x3f04d9+'-'+_0x33d6eb+'/'+_0x28d9a1)['json'](_0x28a937);}return null;};}function patchUpdates(_0x2f9da2){return function(_0x27120a){try{jsonpatch[_0x0f61('0x2a')](_0x27120a,_0x2f9da2,!![]);}catch(_0x687534){return BPromise[_0x0f61('0x2b')](_0x687534);}return _0x27120a[_0x0f61('0x2c')]();};}function saveUpdates(_0x24b69e,_0x2d7147){return function(_0x5d7b5f){if(_0x5d7b5f){return _0x5d7b5f['update'](_0x24b69e)['then'](function(_0x2f462b){return _0x2f462b;});}return null;};}function removeEntity(_0x341785,_0x4ed62c){return function(_0x1953bc){if(_0x1953bc){return _0x1953bc['destroy']()[_0x0f61('0x1b')](function(){_0x341785[_0x0f61('0x24')](0xcc)[_0x0f61('0x25')]();});}};}function handleEntityNotFound(_0x346708,_0x5c15b1){return function(_0x139ecd){if(!_0x139ecd){_0x346708[_0x0f61('0x2d')](0x194);}return _0x139ecd;};}function handleError(_0x55dad5,_0x47ee80){_0x47ee80=_0x47ee80||0x1f4;return function(_0xa9a0d1){logger['error'](_0xa9a0d1['stack']);if(_0xa9a0d1[_0x0f61('0x2e')]){delete _0xa9a0d1['name'];}_0x55dad5[_0x0f61('0x24')](_0x47ee80)[_0x0f61('0x2f')](_0xa9a0d1);};}exports['index']=function(_0x383ae3,_0x40b406){var _0xd4fea7={},_0x468424={},_0x4befeb={'count':0x0,'rows':[]};var _0x2f2363=_[_0x0f61('0x30')](db[_0x0f61('0x31')][_0x0f61('0x32')],function(_0x55202b){return{'name':_0x55202b['fieldName'],'type':_0x55202b[_0x0f61('0x33')][_0x0f61('0x34')]};});_0x468424[_0x0f61('0x35')]=_[_0x0f61('0x30')](_0x2f2363,_0x0f61('0x2e'));_0x468424[_0x0f61('0x36')]=_['keys'](_0x383ae3[_0x0f61('0x36')]);_0x468424[_0x0f61('0x37')]=_[_0x0f61('0x38')](_0x468424[_0x0f61('0x35')],_0x468424[_0x0f61('0x36')]);_0xd4fea7[_0x0f61('0x39')]=_[_0x0f61('0x38')](_0x468424[_0x0f61('0x35')],qs[_0x0f61('0x3a')](_0x383ae3[_0x0f61('0x36')][_0x0f61('0x3a')]));_0xd4fea7[_0x0f61('0x39')]=_0xd4fea7[_0x0f61('0x39')]['length']?_0xd4fea7['attributes']:_0x468424['model'];if(!_0x383ae3['query'][_0x0f61('0x3b')]('nolimit')){_0xd4fea7['limit']=qs[_0x0f61('0x27')](_0x383ae3[_0x0f61('0x36')][_0x0f61('0x27')]);_0xd4fea7['offset']=qs[_0x0f61('0x26')](_0x383ae3[_0x0f61('0x36')]['offset']);}_0xd4fea7['order']=qs[_0x0f61('0x3c')](_0x383ae3['query'][_0x0f61('0x3c')]);_0xd4fea7['where']=qs[_0x0f61('0x37')](_[_0x0f61('0x3d')](_0x383ae3['query'],_0x468424[_0x0f61('0x37')]),_0x2f2363);if(_0x383ae3[_0x0f61('0x36')]['filter']){_0xd4fea7['where']=_[_0x0f61('0x3e')](_0xd4fea7[_0x0f61('0x3f')],{'$or':_[_0x0f61('0x30')](_0x2f2363,function(_0x41dbb9){if(_0x41dbb9['type']!=='VIRTUAL'){var _0x50f38d={};_0x50f38d[_0x41dbb9['name']]={'$like':'%'+_0x383ae3['query'][_0x0f61('0x40')]+'%'};return _0x50f38d;}})});}_0xd4fea7=_[_0x0f61('0x3e')]({},_0xd4fea7,_0x383ae3[_0x0f61('0x41')]);var _0x14aec5={'where':_0xd4fea7[_0x0f61('0x3f')]};return db[_0x0f61('0x31')][_0x0f61('0x42')](_0x14aec5)[_0x0f61('0x1b')](function(_0x40d00e){_0x4befeb[_0x0f61('0x42')]=_0x40d00e;if(_0x383ae3['query']['includeAll']){_0xd4fea7[_0x0f61('0x43')]=[{'all':!![]}];}return db[_0x0f61('0x31')][_0x0f61('0x44')](_0xd4fea7);})[_0x0f61('0x1b')](function(_0x52375d){_0x4befeb[_0x0f61('0x45')]=_0x52375d;return _0x4befeb;})[_0x0f61('0x1b')](respondWithFilteredResult(_0x40b406,_0xd4fea7))[_0x0f61('0x23')](handleError(_0x40b406,null));};exports[_0x0f61('0x46')]=function(_0x1450d2,_0x1edca){var _0x2e25a6={'raw':!![],'where':{'id':_0x1450d2[_0x0f61('0x47')]['id']}},_0x242c8d={};_0x242c8d['model']=_[_0x0f61('0x48')](db[_0x0f61('0x31')][_0x0f61('0x32')]);_0x242c8d[_0x0f61('0x36')]=_[_0x0f61('0x48')](_0x1450d2[_0x0f61('0x36')]);_0x242c8d['filters']=_['intersection'](_0x242c8d[_0x0f61('0x35')],_0x242c8d[_0x0f61('0x36')]);_0x2e25a6[_0x0f61('0x39')]=_[_0x0f61('0x38')](_0x242c8d[_0x0f61('0x35')],qs[_0x0f61('0x3a')](_0x1450d2[_0x0f61('0x36')][_0x0f61('0x3a')]));_0x2e25a6[_0x0f61('0x39')]=_0x2e25a6[_0x0f61('0x39')]['length']?_0x2e25a6[_0x0f61('0x39')]:_0x242c8d[_0x0f61('0x35')];if(_0x1450d2['query'][_0x0f61('0x49')]){_0x2e25a6['include']=[{'all':!![]}];}_0x2e25a6=_['merge']({},_0x2e25a6,_0x1450d2[_0x0f61('0x41')]);return db['SmsMessage'][_0x0f61('0x4a')](_0x2e25a6)['then'](handleEntityNotFound(_0x1edca,null))[_0x0f61('0x1b')](respondWithResult(_0x1edca,null))['catch'](handleError(_0x1edca,null));};exports[_0x0f61('0x4b')]=function(_0x4ae0a1,_0x15f4eb){return db[_0x0f61('0x31')][_0x0f61('0x4b')](_0x4ae0a1[_0x0f61('0x4c')],{})[_0x0f61('0x1b')](respondWithResult(_0x15f4eb,0xc9))[_0x0f61('0x23')](handleError(_0x15f4eb,null));};exports[_0x0f61('0x4d')]=function(_0x1c4238,_0x1bc764){if(_0x1c4238[_0x0f61('0x4c')]['id']){delete _0x1c4238['body']['id'];}return db['SmsMessage'][_0x0f61('0x4a')]({'where':{'id':_0x1c4238['params']['id']}})['then'](handleEntityNotFound(_0x1bc764,null))[_0x0f61('0x1b')](saveUpdates(_0x1c4238[_0x0f61('0x4c')],null))['then'](respondWithResult(_0x1bc764,null))['catch'](handleError(_0x1bc764,null));};exports[_0x0f61('0x4e')]=function(_0x51b05d,_0x2615a6){return db[_0x0f61('0x31')]['find']({'where':{'id':_0x51b05d[_0x0f61('0x47')]['id']}})['then'](handleEntityNotFound(_0x2615a6,null))[_0x0f61('0x1b')](removeEntity(_0x2615a6,null))['catch'](handleError(_0x2615a6,null));};exports[_0x0f61('0x4f')]=function(_0x3e4d1e,_0x1c7a31){return db[_0x0f61('0x31')][_0x0f61('0x4f')]()['then'](respondWithResult(_0x1c7a31,null))[_0x0f61('0x23')](handleError(_0x1c7a31,null));};var interaction_log=require('../../config/logger')(_0x0f61('0x50'));exports[_0x0f61('0x51')]=function(_0x747884,_0x3c657d,_0x44ce37){var _0x5d4986={'channel':_0x0f61('0x52')};if(_0x747884[_0x0f61('0x4c')]['id']){delete _0x747884[_0x0f61('0x4c')]['id'];}_0x747884['body'][_0x0f61('0x53')]=!![];_0x747884[_0x0f61('0x4c')][_0x0f61('0x54')]=moment()[_0x0f61('0x55')](_0x0f61('0x56'));_0x747884[_0x0f61('0x4c')][_0x0f61('0x57')]=_0x747884[_0x0f61('0x4c')][_0x0f61('0x57')]||_0x747884[_0x0f61('0x58')]['id'];return db[_0x0f61('0x31')][_0x0f61('0x4a')]({'where':{'id':_0x747884[_0x0f61('0x47')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x0f61('0x59')}]})[_0x0f61('0x1b')](handleEntityNotFound(_0x3c657d,null))['then'](saveUpdates(_0x747884[_0x0f61('0x4c')],null))[_0x0f61('0x1b')](function(_0x54f96a){if(_0x54f96a){_0x5d4986['message']=_0x54f96a[_0x0f61('0x5a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x54f96a[_0x0f61('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x3c657d,null))[_0x0f61('0x1b')](function(_0x5a7944){if(_0x5a7944){return _0x5a7944[_0x0f61('0x4d')]({'UserId':_0x747884[_0x0f61('0x4c')][_0x0f61('0x57')],'read1stAt':_[_0x0f61('0x5c')](_0x5a7944[_0x0f61('0x5d')])?moment()[_0x0f61('0x55')](_0x0f61('0x56')):undefined});}return null;})['then'](function(_0x29e188){if(_0x29e188){_0x5d4986[_0x0f61('0x5e')]=_0x29e188['get']({'plain':!![]});interaction_log['info'](_0x0f61('0x5f'),_0x747884['user']['id'],_0x747884[_0x0f61('0x58')]['name'],_0x747884[_0x0f61('0x58')][_0x0f61('0x60')],_0x5d4986[_0x0f61('0x5e')]['id'],_0x747884[_0x0f61('0x4c')]?JSON[_0x0f61('0x1f')](_0x747884['body']):_0x0f61('0x61'));return respondWithRpcPromise(_0x0f61('0x62'),'acceptMessage',_0x5d4986);}return null;})[_0x0f61('0x1b')](function(_0x4253f7){if(_0x4253f7){if(_0x747884[_0x0f61('0x4c')][_0x0f61('0x63')]){_0x5d4986[_0x0f61('0x21')]['interface']=util['format'](_0x0f61('0x64'),_0x747884[_0x0f61('0x58')][_0x0f61('0x2e')]);_0x5d4986[_0x0f61('0x21')][_0x0f61('0x65')]=_0x5d4986['channel'];_0x5d4986[_0x0f61('0x21')][_0x0f61('0x66')]=_0x0f61('0x51');return respondWithRpcPromise(_0x0f61('0x67'),_0x0f61('0x67'),{'event':'acceptmessage','message':_0x5d4986[_0x0f61('0x21')]},client9002)[_0x0f61('0x1b')](function(){return _0x5d4986;});}return _0x5d4986;}return null;})[_0x0f61('0x1b')](respondWithResult(_0x3c657d,null))['catch'](handleError(_0x3c657d,null));};var interaction_log=require(_0x0f61('0x68'))(_0x0f61('0x50'));exports[_0x0f61('0x2b')]=function(_0x5d5719,_0x484960,_0x33213a){var _0x8c0b45={'agent':{},'channel':_0x0f61('0x52')};if(_0x5d5719[_0x0f61('0x4c')]['id']){delete _0x5d5719[_0x0f61('0x4c')]['id'];}_0x5d5719[_0x0f61('0x4c')][_0x0f61('0x57')]=_0x5d5719[_0x0f61('0x4c')][_0x0f61('0x57')]||_0x5d5719['user']['id'];_0x8c0b45[_0x0f61('0x69')]['id']=_0x5d5719[_0x0f61('0x4c')]['UserId'];return db[_0x0f61('0x31')][_0x0f61('0x4a')]({'where':{'id':_0x5d5719[_0x0f61('0x47')]['id'],'UserId':null}})[_0x0f61('0x1b')](handleEntityNotFound(_0x484960,null))['then'](function(_0x3b4b66){if(_0x3b4b66){_0x8c0b45[_0x0f61('0x21')]=_0x3b4b66[_0x0f61('0x5a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3b4b66[_0x0f61('0x5b')]}});}return null;})['then'](handleEntityNotFound(_0x484960,null))['then'](function(_0x57895d){if(_0x57895d){_0x8c0b45[_0x0f61('0x5e')]=_0x57895d['get']({'plain':!![]});interaction_log[_0x0f61('0x6a')](_0x0f61('0x6b'),_0x5d5719[_0x0f61('0x58')]['id'],_0x5d5719[_0x0f61('0x58')][_0x0f61('0x2e')],_0x5d5719[_0x0f61('0x58')]['role'],_0x8c0b45[_0x0f61('0x5e')]['id'],_0x5d5719[_0x0f61('0x4c')]?JSON[_0x0f61('0x1f')](_0x5d5719[_0x0f61('0x4c')]):_0x0f61('0x61'));return respondWithRpcPromise(_0x0f61('0x6c'),'rejectMessage',_0x8c0b45);}return null;})[_0x0f61('0x1b')](function(_0x53d19a){if(_0x53d19a){_0x53d19a[_0x0f61('0x21')][_0x0f61('0x6d')]=util[_0x0f61('0x55')](_0x0f61('0x64'),_0x5d5719[_0x0f61('0x58')][_0x0f61('0x2e')]);_0x53d19a['message'][_0x0f61('0x65')]=_0x8c0b45[_0x0f61('0x65')];_0x53d19a[_0x0f61('0x21')][_0x0f61('0x66')]=_0x0f61('0x2b');respondWithRpcPromise(_0x0f61('0x67'),_0x0f61('0x67'),{'event':'rejectmessage','message':_0x53d19a[_0x0f61('0x21')]},client9002);return _0x8c0b45;}return null;})[_0x0f61('0x1b')](respondWithResult(_0x484960,null))[_0x0f61('0x23')](handleError(_0x484960,null));};exports[_0x0f61('0x24')]=function(_0x4d3552,_0x4817c7,_0xdce0a0){if(_0x4d3552[_0x0f61('0x4c')]['id']){delete _0x4d3552[_0x0f61('0x4c')]['id'];}var _0x38edbc;return db[_0x0f61('0x31')][_0x0f61('0x4a')]({'where':{'id':_0x4d3552[_0x0f61('0x47')]['id']}})[_0x0f61('0x1b')](handleEntityNotFound(_0x4817c7,null))[_0x0f61('0x1b')](function(_0x10089e){if(_0x10089e){_0x38edbc=_0x10089e;return db[_0x0f61('0x6e')]['find']({'where':{'id':_0x10089e[_0x0f61('0x6f')]}});}})[_0x0f61('0x1b')](handleEntityNotFound(_0x4817c7,null))['then'](function(_0x294343){if(_0x294343){logger[_0x0f61('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0f61('0x24'),_0x0f61('0x70'),_0x294343[_0x0f61('0x33')],util[_0x0f61('0x71')](_0x4d3552[_0x0f61('0x4c')],{'showHidden':![],'depth':null}));switch(_0x294343[_0x0f61('0x33')]){case _0x0f61('0x72'):if(_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x73')]&&_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x73')]===_0x38edbc[_0x0f61('0x74')]){return _0x38edbc[_0x0f61('0x4d')]({'read':!![]});}else{logger['error'](_0x0f61('0x75'),_0x0f61('0x24'),_0x0f61('0x72'),util[_0x0f61('0x71')](_0x4d3552[_0x0f61('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x0f61('0x76'):if(_0x4d3552['body'][_0x0f61('0x77')]&&_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x77')]===_0x38edbc['messageId']&&_[_0x0f61('0x78')]([_0x0f61('0x79'),_0x0f61('0x7a')],_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x7b')])>=0x0){return _0x38edbc[_0x0f61('0x4d')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0f61('0x24'),_0x0f61('0x7c'),util[_0x0f61('0x71')](_0x4d3552[_0x0f61('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x0f61('0x7d'):var _0x2f991c=_0x4d3552[_0x0f61('0x4c')][_0x0f61('0x7e')][0x0];if(_0x2f991c['status'][_0x0f61('0x7f')]===_0x0f61('0x80')){return _0x38edbc[_0x0f61('0x4d')]({'read':!![]});}else{logger[_0x0f61('0x20')](_0x0f61('0x75'),_0x0f61('0x24'),_0x0f61('0x7d'),util[_0x0f61('0x71')](_0x4d3552['body'],{'showHidden':![],'depth':null}));}break;}return _0x38edbc;}})['then'](respondWithResult(_0x4817c7,null))[_0x0f61('0x23')](handleError(_0x4817c7,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7533004..66a579b 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 _0x0d8c=['update','remove','emit','exports','events','../../mysqldb','save'];(function(_0x3e4a22,_0x2f9159){var _0x11fa59=function(_0x530512){while(--_0x530512){_0x3e4a22['push'](_0x3e4a22['shift']());}};_0x11fa59(++_0x2f9159);}(_0x0d8c,0x89));var _0xc0d8=function(_0x1c13d7,_0x47be22){_0x1c13d7=_0x1c13d7-0x0;var _0x59b6ce=_0x0d8c[_0x1c13d7];return _0x59b6ce;};'use strict';var EventEmitter=require(_0xc0d8('0x0'));var SmsMessage=require(_0xc0d8('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc0d8('0x2'),'afterUpdate':_0xc0d8('0x3'),'afterDestroy':_0xc0d8('0x4')};function emitEvent(_0x592007){return function(_0x5999f4,_0x111d5b,_0x29a50f){SmsMessageEvents[_0xc0d8('0x5')](_0x592007+':'+_0x5999f4['id'],_0x5999f4);SmsMessageEvents[_0xc0d8('0x5')](_0x592007,_0x5999f4);_0x29a50f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xc0d8('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x79b6=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x207d4e,_0x5158dc){var _0x24b6f4=function(_0x96ce36){while(--_0x96ce36){_0x207d4e['push'](_0x207d4e['shift']());}};_0x24b6f4(++_0x5158dc);}(_0x79b6,0xd6));var _0x679b=function(_0x50a1a9,_0xd1fbe7){_0x50a1a9=_0x50a1a9-0x0;var _0x535056=_0x79b6[_0x50a1a9];return _0x535056;};'use strict';var EventEmitter=require(_0x679b('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x679b('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x679b('0x2')](0x0);var events={'afterCreate':_0x679b('0x3'),'afterUpdate':_0x679b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b55c5){return function(_0x2cf023,_0x27eee6,_0x3ca0c0){SmsMessageEvents['emit'](_0x2b55c5+':'+_0x2cf023['id'],_0x2cf023);SmsMessageEvents[_0x679b('0x5')](_0x2b55c5,_0x2cf023);_0x3ca0c0(null);};}for(var e in events){if(events[_0x679b('0x6')](e)){var event=events[e];SmsMessage[_0x679b('0x7')](e,emitEvent(event));}}module[_0x679b('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 cdf7195..41c2eac 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 _0x193f=['fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','findOne','SmsInteractionId','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','GET','split','POST','user_key','session_key','then','total_sent','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','queued_count','data','message_id','clickSend','plivo','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/sms/2/text/advanced','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','length','hex','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId'];(function(_0x11be93,_0x4a816d){var _0x4438b7=function(_0x59c882){while(--_0x59c882){_0x11be93['push'](_0x11be93['shift']());}};_0x4438b7(++_0x4a816d);}(_0x193f,0xd6));var _0xf193=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x193f[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0xf193('0x0'));var util=require(_0xf193('0x1'));var logger=require('../../config/logger')(_0xf193('0x2'));var moment=require(_0xf193('0x3'));var BPromise=require('bluebird');var rp=require(_0xf193('0x4'));var fs=require('fs');var path=require(_0xf193('0x5'));var rimraf=require('rimraf');var config=require(_0xf193('0x6'));var attributes=require(_0xf193('0x7'));module[_0xf193('0x8')]=function(_0x2e6e85,_0x15e2be){return _0x2e6e85[_0xf193('0x9')]('SmsMessage',attributes,{'tableName':_0xf193('0xa'),'paranoid':![],'indexes':[{'name':_0xf193('0xb'),'fields':['messageId']},{'name':_0xf193('0xc'),'fields':[_0xf193('0xd')],'type':_0xf193('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27a2df,_0xa46f89,_0x1e32fe){var _0x3d5a24=_0x2e6e85[_0xf193('0xf')];var _0x380d7c=_0x27a2df[_0xf193('0x10')]({'plain':!![]});if(_0x380d7c[_0xf193('0x11')][_0xf193('0x12')]()==='in'||_0x380d7c['direction'][_0xf193('0x12')]()===_0xf193('0x13')&&!_0x380d7c['secret']&&!_['isNil'](_0x380d7c[_0xf193('0x14')])){_0x3d5a24['SmsInteraction'][_0xf193('0x15')]({'where':{'id':_0x380d7c[_0xf193('0x16')]}})['then'](function(_0x54d087){if(_0x54d087){_0x54d087['update']({'lastMsgAt':_0x380d7c[_0xf193('0x17')],'lastMsgDirection':_0x380d7c[_0xf193('0x11')]['toLowerCase']()});}})[_0xf193('0x18')](function(_0x29fd83){console[_0xf193('0x19')](_0x29fd83);});}if(_0x380d7c[_0xf193('0x11')]===_0xf193('0x13')&&!_0x380d7c[_0xf193('0x1a')]){var _0x17a727;_0x3d5a24[_0xf193('0x1b')][_0xf193('0x1c')]({'where':{'id':_0x380d7c[_0xf193('0x1d')]},'raw':!![]})['then'](function(_0x28cbf5){_0x17a727=_0x28cbf5;if(_0x17a727&&_0x17a727['type']){switch(_0x17a727[_0xf193('0x1e')]){case _0xf193('0x1f'):var _0x5bcaca=require(_0xf193('0x1f'));if(_0x17a727[_0xf193('0x20')]&&_0x17a727['authToken']&&_0x17a727[_0xf193('0x21')]){var _0x28ef71=new _0x5bcaca(_0x17a727[_0xf193('0x20')],_0x17a727[_0xf193('0x22')]);_0x28ef71[_0xf193('0x23')][_0xf193('0x24')]({'body':_0x380d7c[_0xf193('0xd')],'to':_0x380d7c['phone'],'from':_0x17a727['phone'],'statusCallback':_0x17a727['remote']+_0xf193('0x25')+_0x380d7c['id']+'/status?token='+_0x17a727[_0xf193('0x26')]})['then'](function(_0x59cea0){if(_0x59cea0['sid']){return _0x27a2df['update']({'messageId':_0x59cea0[_0xf193('0x27')]});}})[_0xf193('0x18')](function(_0x315805){logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x1f'),util[_0xf193('0x2a')](_0x315805,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x1f'),_0xf193('0x2b'));}break;case _0xf193('0x2c'):var _0x2600e6='https://api.skebby.it/API/v1.0/REST/';if(_0x17a727[_0xf193('0x2d')]&&_0x17a727[_0xf193('0x2e')]){var _0x1e02a5={'recipient':[_0x380d7c[_0xf193('0x21')]],'message':_0x380d7c[_0xf193('0xd')],'message_type':_0x17a727[_0xf193('0x2f')]};if(_0x17a727[_0xf193('0x2f')]&&_0x17a727[_0xf193('0x2f')]!=='SI'){_0x1e02a5[_0xf193('0x30')]=_0x17a727[_0xf193('0x21')];}var _0x100ed4={'url':_0x2600e6+'login?username='+_0x17a727[_0xf193('0x2d')]+'&password='+_0x17a727[_0xf193('0x2e')],'method':_0xf193('0x31')};rp(_0x100ed4)['then'](function(_0x54471f){var _0x32c1bc=_0x54471f[_0xf193('0x32')](';');var _0x3a1a3f={'user_key':_0x32c1bc[0x0],'session_key':_0x32c1bc[0x1]};_0x100ed4={'url':_0x2600e6+'sms','method':_0xf193('0x33'),'headers':{'user_key':_0x3a1a3f[_0xf193('0x34')],'Session_key':_0x3a1a3f[_0xf193('0x35')]},'json':!![],'body':_0x1e02a5};return rp(_0x100ed4);})[_0xf193('0x36')](function(_0x2f1f0b){if(_0x2f1f0b[_0xf193('0x37')]>=0x1){var _0x10fc54={'messageId':_0x2f1f0b['internal_order_id']};if(_0x17a727['smsMethod']!=='GP'||!_0x17a727[_0xf193('0x38')]){_0x10fc54[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x10fc54);}else{return logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x2c'),util[_0xf193('0x2a')](_0x2f1f0b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x37c1f0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),'skebby',util[_0xf193('0x2a')](_0x37c1f0,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x2c'),_0xf193('0x3b'));}break;case _0xf193('0x3c'):if(_0x17a727[_0xf193('0x22')]){var _0x5086f1={'recipient':_0x380d7c[_0xf193('0x21')],'message':_0x380d7c['body'],'sender':_0x17a727[_0xf193('0x3d')]||_0x17a727[_0xf193('0x21')],'authorization':_0x17a727[_0xf193('0x22')]};var _0xa46f89={'method':'POST','uri':_0xf193('0x3e'),'body':_0x5086f1,'json':!![]};rp(_0xa46f89)[_0xf193('0x36')](function(_0x1d9a67){var _0x5df67e={'messageId':_0x1d9a67[_0xf193('0x3f')]};if(!_0x17a727[_0xf193('0x38')]){_0x5df67e[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x5df67e);})['catch'](function(_0x57e189){logger['error'](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x3c'),util[_0xf193('0x2a')](_0x57e189,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x3c'),_0xf193('0x40'));}break;case'clicksend':if(_0x17a727['username']&&_0x17a727[_0xf193('0x2e')]){var _0x5086f1={'messages':[{'source':_0xf193('0x41'),'to':_0x380d7c['phone'],'body':_0x380d7c[_0xf193('0xd')],'from':_0x17a727[_0xf193('0x3d')]||_0x17a727[_0xf193('0x21')]}]};var _0x2b440f=util[_0xf193('0x42')](_0xf193('0x43'),_0x17a727[_0xf193('0x2d')],_0x17a727['password']);var _0xa46f89={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5086f1,'headers':{'Authorization':util[_0xf193('0x42')](_0xf193('0x44'),new Buffer(_0x2b440f)[_0xf193('0x45')](_0xf193('0x46')))},'json':!![]};rp(_0xa46f89)['then'](function(_0x237954){if(_0x237954['http_code']>=0xc8&&_0x237954[_0xf193('0x47')]<=0xce){if(_0x237954['data']&&_0x237954['data'][_0xf193('0x48')]>0x0){var _0x2977b9=_['head'](_0x237954[_0xf193('0x49')][_0xf193('0x23')]);var _0x1b85cc={'messageId':_0x2977b9[_0xf193('0x4a')]};if(!_0x17a727[_0xf193('0x38')]){_0x1b85cc[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x1b85cc);}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x4b'),util[_0xf193('0x2a')](_0x237954,{'showHidden':![],'depth':null}));}}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x4b'),util[_0xf193('0x2a')](_0x237954,{'showHidden':![],'depth':null}));}})[_0xf193('0x18')](function(_0x324b01){logger['error'](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x4b'),util[_0xf193('0x2a')](_0x324b01,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0xf193('0x3b'));}break;case _0xf193('0x4c'):if(_0x17a727['authId']&&_0x17a727[_0xf193('0x22')]){var _0x5086f1={'dst':_0x380d7c[_0xf193('0x21')],'text':_0x380d7c[_0xf193('0xd')],'src':_0x17a727['senderString']||_0x17a727['phone'],'url':_0x17a727['remote']+'/api/sms/messages/'+_0x380d7c['id']+_0xf193('0x4d')+_0x17a727[_0xf193('0x26')]};var _0x2b440f=util[_0xf193('0x42')](_0xf193('0x43'),_0x17a727[_0xf193('0x4e')],_0x17a727[_0xf193('0x22')]);var _0xa46f89={'method':_0xf193('0x33'),'uri':util[_0xf193('0x42')](_0xf193('0x4f'),_0x17a727[_0xf193('0x4e')]),'body':_0x5086f1,'headers':{'Authorization':util[_0xf193('0x42')]('Basic\x20%s',new Buffer(_0x2b440f)[_0xf193('0x45')](_0xf193('0x46')))},'json':!![]};rp(_0xa46f89)[_0xf193('0x36')](function(_0x17c062){var _0x2fece0={'messageId':_0x17c062[_0xf193('0x50')][0x0]};return _0x27a2df['update'](_0x2fece0);})[_0xf193('0x18')](function(_0x5a7d89){logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x4c'),util[_0xf193('0x2a')](_0x5a7d89,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf193('0x51'):if(_0x17a727['username']&&_0x17a727['password']){if(_0x17a727[_0xf193('0x52')]){var _0x51769c={'method':_0xf193('0x33'),'uri':_0x17a727['baseUrl']+'/auth/1/session','body':{'username':_0x17a727[_0xf193('0x2d')],'password':_0x17a727[_0xf193('0x2e')]},'json':!![]};return rp(_0x51769c)[_0xf193('0x36')](function(_0x42ef93){var _0x13772e={'method':_0xf193('0x33'),'uri':_0x17a727['baseUrl']+_0xf193('0x53'),'body':{'messages':[{'from':_0x17a727[_0xf193('0x21')],'destinations':[{'to':_0x380d7c[_0xf193('0x21')]}],'text':_0x380d7c[_0xf193('0xd')],'notifyUrl':_0x17a727[_0xf193('0x54')]+'/api/sms/messages/'+_0x380d7c['id']+'/status?token='+_0x17a727[_0xf193('0x26')],'notifyContentType':_0xf193('0x55'),'callbackData':_0x17a727[_0xf193('0x21')]+';'+_0x380d7c[_0xf193('0xd')]}]},'headers':{'Authorization':_0xf193('0x56')+_0x42ef93[_0xf193('0x26')]},'json':!![]};return rp(_0x13772e)[_0xf193('0x36')](function(_0x33ee7a){if(_0x33ee7a[_0xf193('0x23')]){var _0x328153={'messageId':_0x33ee7a[_0xf193('0x23')][0x0][_0xf193('0xb')]};if(!_0x17a727[_0xf193('0x38')]){_0x328153[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x328153);}else{return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x51'),util[_0xf193('0x2a')](_0x33ee7a,{'showHidden':![],'depth':null}));}});})[_0xf193('0x18')](function(_0x441ad5){return logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x51'),util[_0xf193('0x2a')](_0x441ad5,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),'infobip',_0xf193('0x57'));}}else{logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x51'),_0xf193('0x3b'));}break;case _0xf193('0x58'):var _0x4a1c7c=require('crypto');if(_0x17a727[_0xf193('0x59')]){var _0x20b15e={};_0x20b15e[_0xf193('0x5a')]=_0x17a727[_0xf193('0x2d')];_0x20b15e[_0xf193('0x21')]=_0x380d7c[_0xf193('0x21')];_0x20b15e['sender']=_0x17a727['phone'];_0x20b15e[_0xf193('0x5b')]=_0x380d7c[_0xf193('0xd')];_0x20b15e[_0xf193('0x5c')]=+new Date();var _0x4755f4='';var _0x1dd2dd='';var _0xe20da3=Object[_0xf193('0x5d')](_0x20b15e);_0xe20da3[_0xf193('0x5e')]();for(var _0x1ccc82=0x0;_0x1ccc82<_0xe20da3[_0xf193('0x5f')];_0x1ccc82++){if(_0x4755f4!=''){_0x4755f4+='&';}_0x4755f4+=_0xe20da3[_0x1ccc82]+'='+encodeURIComponent(_0x20b15e[_0xe20da3[_0x1ccc82]]);_0x1dd2dd+=_0x20b15e[_0xe20da3[_0x1ccc82]];}_0x1dd2dd+=_0x17a727[_0xf193('0x59')];_0x1dd2dd=_0x4a1c7c['createHash']('md5')[_0xf193('0x3a')](_0x1dd2dd)['digest'](_0xf193('0x60'));if(_0x4755f4!==''){_0x4755f4+='&';}_0x4755f4+='signature='+_0x1dd2dd;var _0x100ed4={'method':_0xf193('0x31'),'uri':_0x17a727[_0xf193('0x52')]+_0xf193('0x61')+_0x4755f4,'json':!![]};return rp(_0x100ed4)['then'](function(_0x35040d){var _0x1ecc9f=Object['keys'](_0x35040d);if(_0x35040d[_0x1ecc9f[0x0]][_0xf193('0x19')]&&parseInt(_0x35040d[_0x1ecc9f[0x0]][_0xf193('0x19')])===0x0){var _0x1e57a2={'messageId':_0x35040d[_0x1ecc9f[0x0]][_0xf193('0x62')]};if(!_0x17a727[_0xf193('0x38')]){_0x1e57a2[_0xf193('0x39')]=!![];}return _0x27a2df[_0xf193('0x3a')](_0x1e57a2);}else{return logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x58'),util[_0xf193('0x2a')](_0x35040d[_0xf193('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x491930){return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),'csc',util[_0xf193('0x2a')](_0x491930,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),_0xf193('0x58'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x17a727['apiKey']){var _0x1ac2b8={'method':'POST','uri':_0xf193('0x63'),'headers':{'Authorization':_0x17a727[_0xf193('0x59')]},'body':{'content':_0x380d7c['body'],'to':[_0x380d7c['phone']],'from':_0x17a727[_0xf193('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xf193('0x64')},'json':!![]};rp(_0x1ac2b8)[_0xf193('0x36')](function(_0x48f228){if(!_0x48f228[_0xf193('0x19')]){var _0x5bc5c4={'messageId':_0x48f228[_0xf193('0x23')][0x0][_0xf193('0x65')]};if(!_0x17a727['deliveryReport']){_0x5bc5c4['read']=!![];}return _0x27a2df['update'](_0x5bc5c4);}else{return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf193('0x66'),util[_0xf193('0x2a')](_0x48f228['error'],{'showHidden':![],'depth':null}));}})[_0xf193('0x18')](function(_0x5aa8aa){return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x66'),util['inspect'](_0x5aa8aa,{'showHidden':![],'depth':null}));});}else{logger[_0xf193('0x19')](_0xf193('0x28'),'afterCreate',_0xf193('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0xf193('0x67'):if(_0x17a727[_0xf193('0x59')]){var _0x35115c={};var _0x100ed4={'method':_0xf193('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xf193('0x68')+_0x17a727[_0xf193('0x59')],'Content-Type':_0xf193('0x55')},'body':{'from':_0x17a727[_0xf193('0x21')],'to':_0x380d7c[_0xf193('0x21')],'text':_0x380d7c['body']},'json':!![]};return rp(_0x100ed4)['then'](function(_0x3b621f){if(_0x3b621f[_0xf193('0x69')]==0xca){_0x35115c['message']=_0x3b621f;var _0x21a743={'method':_0xf193('0x33'),'uri':_0xf193('0x6a'),'headers':{'Authorization':_0xf193('0x68')+_0x17a727[_0xf193('0x59')],'Content-Type':_0xf193('0x55')},'body':{'refid':_0x35115c[_0xf193('0x6b')][_0xf193('0x6c')]},'json':!![]};return rp(_0x21a743)[_0xf193('0x36')](function(_0x55117d){_0x35115c[_0xf193('0x6d')]=_0x55117d;var _0x178a8c={'messageId':_0x35115c[_0xf193('0x6b')][_0xf193('0x6c')],'read':!![]};return _0x27a2df[_0xf193('0x3a')](_0x178a8c);});}else{return logger[_0xf193('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf193('0x29'),_0xf193('0x67'),util['inspect'](_0x3b621f,{'showHidden':![],'depth':null}));}})[_0xf193('0x18')](function(_0x3f7432){return logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),'intelepeer',util['inspect'](_0x3f7432,{'showHidden':![],'depth':null}));});}else{return logger[_0xf193('0x19')](_0xf193('0x28'),_0xf193('0x29'),'intelepeer',_0xf193('0x6e'));}break;}}})['finally'](function(){_0x1e32fe();});}else{_0x1e32fe();}}},'charset':_0xf193('0x6f'),'collate':_0xf193('0x70')});}; \ No newline at end of file +var _0x2f0f=['login','timestamp','sort','createHash','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','SmsInteractionId','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','messages','create','phone','remote','/api/sms/messages/','/status?token=','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','body','smsMethod','login?username=','&password=','password','then','split','sms','POST','user_key','total_sent','internal_order_id','read','afterCreate','Missing\x20parameters:\x20username,\x20password','senderString','authToken','https://smsapi.connectel.se/api/v2/send/','deliveryReport','connectel','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','baseUrl','/sms/2/text/advanced','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey'];(function(_0x244f2c,_0x478ac9){var _0x1f1b7e=function(_0xd8ef0){while(--_0xd8ef0){_0x244f2c['push'](_0x244f2c['shift']());}};_0x1f1b7e(++_0x478ac9);}(_0x2f0f,0x10b));var _0xf2f0=function(_0x19903c,_0x5192e4){_0x19903c=_0x19903c-0x0;var _0x222a6c=_0x2f0f[_0x19903c];return _0x222a6c;};'use strict';var _=require('lodash');var util=require(_0xf2f0('0x0'));var logger=require(_0xf2f0('0x1'))(_0xf2f0('0x2'));var moment=require(_0xf2f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2f0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2f0('0x5'));var config=require(_0xf2f0('0x6'));var attributes=require(_0xf2f0('0x7'));module['exports']=function(_0x3046cf,_0x1a38bb){return _0x3046cf[_0xf2f0('0x8')](_0xf2f0('0x9'),attributes,{'tableName':_0xf2f0('0xa'),'paranoid':![],'indexes':[{'name':_0xf2f0('0xb'),'fields':[_0xf2f0('0xb')]},{'name':_0xf2f0('0xc'),'fields':['body'],'type':_0xf2f0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5847b6,_0x183716,_0xfab420){var _0xc3d4b=_0x3046cf[_0xf2f0('0xe')];var _0x3f2e5d=_0x5847b6[_0xf2f0('0xf')]({'plain':!![]});if(_0x3f2e5d[_0xf2f0('0x10')][_0xf2f0('0x11')]()==='in'||_0x3f2e5d[_0xf2f0('0x10')][_0xf2f0('0x11')]()===_0xf2f0('0x12')&&!_0x3f2e5d[_0xf2f0('0x13')]&&!_['isNil'](_0x3f2e5d[_0xf2f0('0x14')])){_0xc3d4b['SmsInteraction'][_0xf2f0('0x15')]({'where':{'id':_0x3f2e5d[_0xf2f0('0x16')]}})['then'](function(_0x47e1b7){if(_0x47e1b7){_0x47e1b7['update']({'lastMsgAt':_0x3f2e5d[_0xf2f0('0x17')],'lastMsgDirection':_0x3f2e5d[_0xf2f0('0x10')][_0xf2f0('0x11')]()});}})[_0xf2f0('0x18')](function(_0x52b9b4){console[_0xf2f0('0x19')](_0x52b9b4);});}if(_0x3f2e5d[_0xf2f0('0x10')]===_0xf2f0('0x12')&&!_0x3f2e5d['secret']){var _0x36d0db;_0xc3d4b['SmsAccount'][_0xf2f0('0x1a')]({'where':{'id':_0x3f2e5d[_0xf2f0('0x1b')]},'raw':!![]})['then'](function(_0x514bd1){_0x36d0db=_0x514bd1;if(_0x36d0db&&_0x36d0db[_0xf2f0('0x1c')]){switch(_0x36d0db[_0xf2f0('0x1c')]){case _0xf2f0('0x1d'):var _0x21faec=require('twilio');if(_0x36d0db[_0xf2f0('0x1e')]&&_0x36d0db['authToken']&&_0x36d0db['phone']){var _0x5aa287=new _0x21faec(_0x36d0db['accountSid'],_0x36d0db['authToken']);_0x5aa287[_0xf2f0('0x1f')][_0xf2f0('0x20')]({'body':_0x3f2e5d['body'],'to':_0x3f2e5d[_0xf2f0('0x21')],'from':_0x36d0db[_0xf2f0('0x21')],'statusCallback':_0x36d0db[_0xf2f0('0x22')]+_0xf2f0('0x23')+_0x3f2e5d['id']+_0xf2f0('0x24')+_0x36d0db['token']})['then'](function(_0x5c67c7){if(_0x5c67c7[_0xf2f0('0x25')]){return _0x5847b6[_0xf2f0('0x26')]({'messageId':_0x5c67c7['sid']});}})[_0xf2f0('0x18')](function(_0x4da7c4){logger[_0xf2f0('0x19')](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x1d'),util[_0xf2f0('0x28')](_0x4da7c4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x1d'),_0xf2f0('0x29'));}break;case _0xf2f0('0x2a'):var _0x2809d2=_0xf2f0('0x2b');if(_0x36d0db[_0xf2f0('0x2c')]&&_0x36d0db['password']){var _0x418fb5={'recipient':[_0x3f2e5d[_0xf2f0('0x21')]],'message':_0x3f2e5d[_0xf2f0('0x2d')],'message_type':_0x36d0db[_0xf2f0('0x2e')]};if(_0x36d0db['smsMethod']&&_0x36d0db[_0xf2f0('0x2e')]!=='SI'){_0x418fb5['sender']=_0x36d0db['phone'];}var _0x2dcbd0={'url':_0x2809d2+_0xf2f0('0x2f')+_0x36d0db[_0xf2f0('0x2c')]+_0xf2f0('0x30')+_0x36d0db[_0xf2f0('0x31')],'method':'GET'};rp(_0x2dcbd0)[_0xf2f0('0x32')](function(_0x415d02){var _0x2fac70=_0x415d02[_0xf2f0('0x33')](';');var _0xc32c16={'user_key':_0x2fac70[0x0],'session_key':_0x2fac70[0x1]};_0x2dcbd0={'url':_0x2809d2+_0xf2f0('0x34'),'method':_0xf2f0('0x35'),'headers':{'user_key':_0xc32c16[_0xf2f0('0x36')],'Session_key':_0xc32c16['session_key']},'json':!![],'body':_0x418fb5};return rp(_0x2dcbd0);})[_0xf2f0('0x32')](function(_0x10f5da){if(_0x10f5da[_0xf2f0('0x37')]>=0x1){var _0x3246a8={'messageId':_0x10f5da[_0xf2f0('0x38')]};if(_0x36d0db[_0xf2f0('0x2e')]!=='GP'||!_0x36d0db['deliveryReport']){_0x3246a8[_0xf2f0('0x39')]=!![];}return _0x5847b6['update'](_0x3246a8);}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'skebby',util[_0xf2f0('0x28')](_0x10f5da,{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0xec9b5a){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x2a'),util[_0xf2f0('0x28')](_0xec9b5a,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf2f0('0x3a'),_0xf2f0('0x2a'),_0xf2f0('0x3b'));}break;case'connectel':if(_0x36d0db['authToken']){var _0x23fb85={'recipient':_0x3f2e5d[_0xf2f0('0x21')],'message':_0x3f2e5d['body'],'sender':_0x36d0db[_0xf2f0('0x3c')]||_0x36d0db[_0xf2f0('0x21')],'authorization':_0x36d0db[_0xf2f0('0x3d')]};var _0x183716={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x3e'),'body':_0x23fb85,'json':!![]};rp(_0x183716)['then'](function(_0x5dfef5){var _0x45682e={'messageId':_0x5dfef5['requestid']};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x45682e[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x45682e);})[_0xf2f0('0x18')](function(_0x1c35ac){logger[_0xf2f0('0x19')](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x40'),util[_0xf2f0('0x28')](_0x1c35ac,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0xf2f0('0x41'):if(_0x36d0db[_0xf2f0('0x2c')]&&_0x36d0db[_0xf2f0('0x31')]){var _0x23fb85={'messages':[{'source':_0xf2f0('0x42'),'to':_0x3f2e5d[_0xf2f0('0x21')],'body':_0x3f2e5d[_0xf2f0('0x2d')],'from':_0x36d0db[_0xf2f0('0x3c')]||_0x36d0db[_0xf2f0('0x21')]}]};var _0x1e8b02=util['format'](_0xf2f0('0x43'),_0x36d0db[_0xf2f0('0x2c')],_0x36d0db[_0xf2f0('0x31')]);var _0x183716={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x44'),'body':_0x23fb85,'headers':{'Authorization':util[_0xf2f0('0x45')](_0xf2f0('0x46'),new Buffer(_0x1e8b02)['toString'](_0xf2f0('0x47')))},'json':!![]};rp(_0x183716)[_0xf2f0('0x32')](function(_0x386b50){if(_0x386b50[_0xf2f0('0x48')]>=0xc8&&_0x386b50['http_code']<=0xce){if(_0x386b50[_0xf2f0('0x49')]&&_0x386b50[_0xf2f0('0x49')]['queued_count']>0x0){var _0x5502bb=_['head'](_0x386b50['data'][_0xf2f0('0x1f')]);var _0x329bcc={'messageId':_0x5502bb[_0xf2f0('0x4a')]};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x329bcc[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x329bcc);}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x4b'),util['inspect'](_0x386b50,{'showHidden':![],'depth':null}));}}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'clickSend',util[_0xf2f0('0x28')](_0x386b50,{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x5885d1){logger[_0xf2f0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf2f0('0x4b'),util[_0xf2f0('0x28')](_0x5885d1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x4b'),_0xf2f0('0x3b'));}break;case _0xf2f0('0x4c'):if(_0x36d0db[_0xf2f0('0x4d')]&&_0x36d0db[_0xf2f0('0x3d')]){var _0x23fb85={'dst':_0x3f2e5d[_0xf2f0('0x21')],'text':_0x3f2e5d[_0xf2f0('0x2d')],'src':_0x36d0db[_0xf2f0('0x3c')]||_0x36d0db[_0xf2f0('0x21')],'url':_0x36d0db[_0xf2f0('0x22')]+'/api/sms/messages/'+_0x3f2e5d['id']+_0xf2f0('0x24')+_0x36d0db[_0xf2f0('0x4e')]};var _0x1e8b02=util['format'](_0xf2f0('0x43'),_0x36d0db[_0xf2f0('0x4d')],_0x36d0db['authToken']);var _0x183716={'method':_0xf2f0('0x35'),'uri':util[_0xf2f0('0x45')](_0xf2f0('0x4f'),_0x36d0db[_0xf2f0('0x4d')]),'body':_0x23fb85,'headers':{'Authorization':util[_0xf2f0('0x45')](_0xf2f0('0x46'),new Buffer(_0x1e8b02)[_0xf2f0('0x50')](_0xf2f0('0x47')))},'json':!![]};rp(_0x183716)[_0xf2f0('0x32')](function(_0x1107d4){var _0x39e305={'messageId':_0x1107d4[_0xf2f0('0x51')][0x0]};return _0x5847b6[_0xf2f0('0x26')](_0x39e305);})[_0xf2f0('0x18')](function(_0x206a4e){logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x4c'),util[_0xf2f0('0x28')](_0x206a4e,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x36d0db['username']&&_0x36d0db[_0xf2f0('0x31')]){if(_0x36d0db[_0xf2f0('0x52')]){var _0x94e5a9={'method':'POST','uri':_0x36d0db['baseUrl']+'/auth/1/session','body':{'username':_0x36d0db['username'],'password':_0x36d0db[_0xf2f0('0x31')]},'json':!![]};return rp(_0x94e5a9)[_0xf2f0('0x32')](function(_0x2b7f66){var _0x357130={'method':'POST','uri':_0x36d0db[_0xf2f0('0x52')]+_0xf2f0('0x53'),'body':{'messages':[{'from':_0x36d0db[_0xf2f0('0x21')],'destinations':[{'to':_0x3f2e5d[_0xf2f0('0x21')]}],'text':_0x3f2e5d[_0xf2f0('0x2d')],'notifyUrl':_0x36d0db[_0xf2f0('0x22')]+_0xf2f0('0x23')+_0x3f2e5d['id']+_0xf2f0('0x24')+_0x36d0db['token'],'notifyContentType':'application/json','callbackData':_0x36d0db[_0xf2f0('0x21')]+';'+_0x3f2e5d[_0xf2f0('0x2d')]}]},'headers':{'Authorization':_0xf2f0('0x54')+_0x2b7f66[_0xf2f0('0x4e')]},'json':!![]};return rp(_0x357130)['then'](function(_0x171c01){if(_0x171c01['messages']){var _0x171eee={'messageId':_0x171c01[_0xf2f0('0x1f')][0x0]['messageId']};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x171eee[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x171eee);}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x55'),util[_0xf2f0('0x28')](_0x171c01,{'showHidden':![],'depth':null}));}});})[_0xf2f0('0x18')](function(_0x13f8bc){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x55'),util[_0xf2f0('0x28')](_0x13f8bc,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x55'),_0xf2f0('0x56'));}}else{logger['error'](_0xf2f0('0x27'),'afterCreate','infobip',_0xf2f0('0x3b'));}break;case _0xf2f0('0x57'):var _0x4c9e92=require(_0xf2f0('0x58'));if(_0x36d0db[_0xf2f0('0x59')]){var _0x46ea10={};_0x46ea10[_0xf2f0('0x5a')]=_0x36d0db[_0xf2f0('0x2c')];_0x46ea10['phone']=_0x3f2e5d['phone'];_0x46ea10['sender']=_0x36d0db[_0xf2f0('0x21')];_0x46ea10['text']=_0x3f2e5d[_0xf2f0('0x2d')];_0x46ea10[_0xf2f0('0x5b')]=+new Date();var _0x14cb2c='';var _0x4bc52e='';var _0xe25395=Object['keys'](_0x46ea10);_0xe25395[_0xf2f0('0x5c')]();for(var _0x4d88f2=0x0;_0x4d88f2<_0xe25395['length'];_0x4d88f2++){if(_0x14cb2c!=''){_0x14cb2c+='&';}_0x14cb2c+=_0xe25395[_0x4d88f2]+'='+encodeURIComponent(_0x46ea10[_0xe25395[_0x4d88f2]]);_0x4bc52e+=_0x46ea10[_0xe25395[_0x4d88f2]];}_0x4bc52e+=_0x36d0db[_0xf2f0('0x59')];_0x4bc52e=_0x4c9e92[_0xf2f0('0x5d')](_0xf2f0('0x5e'))[_0xf2f0('0x26')](_0x4bc52e)[_0xf2f0('0x5f')](_0xf2f0('0x60'));if(_0x14cb2c!==''){_0x14cb2c+='&';}_0x14cb2c+=_0xf2f0('0x61')+_0x4bc52e;var _0x2dcbd0={'method':'GET','uri':_0x36d0db[_0xf2f0('0x52')]+'/external/get/send.php?'+_0x14cb2c,'json':!![]};return rp(_0x2dcbd0)[_0xf2f0('0x32')](function(_0x19ae1e){var _0x179b3b=Object[_0xf2f0('0x62')](_0x19ae1e);if(_0x19ae1e[_0x179b3b[0x0]][_0xf2f0('0x19')]&&parseInt(_0x19ae1e[_0x179b3b[0x0]][_0xf2f0('0x19')])===0x0){var _0x4b6493={'messageId':_0x19ae1e[_0x179b3b[0x0]][_0xf2f0('0x63')]};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x4b6493[_0xf2f0('0x39')]=!![];}return _0x5847b6[_0xf2f0('0x26')](_0x4b6493);}else{return logger[_0xf2f0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf2f0('0x3a'),_0xf2f0('0x57'),util[_0xf2f0('0x28')](_0x19ae1e[_0xf2f0('0x19')],{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x11f6bb){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x57'),util[_0xf2f0('0x28')](_0x11f6bb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf2f0('0x27'),'afterCreate','csc',_0xf2f0('0x64'));}break;case _0xf2f0('0x65'):if(_0x36d0db[_0xf2f0('0x59')]){var _0x2091a6={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x66'),'headers':{'Authorization':_0x36d0db[_0xf2f0('0x59')]},'body':{'content':_0x3f2e5d[_0xf2f0('0x2d')],'to':[_0x3f2e5d[_0xf2f0('0x21')]],'from':_0x36d0db['phone'],'binary':![],'clientMessageId':_0xf2f0('0x67'),'charset':_0xf2f0('0x68')},'json':!![]};rp(_0x2091a6)[_0xf2f0('0x32')](function(_0x4ff493){if(!_0x4ff493[_0xf2f0('0x19')]){var _0x34cc75={'messageId':_0x4ff493[_0xf2f0('0x1f')][0x0][_0xf2f0('0x69')]};if(!_0x36d0db[_0xf2f0('0x3f')]){_0x34cc75[_0xf2f0('0x39')]=!![];}return _0x5847b6['update'](_0x34cc75);}else{return logger['error'](_0xf2f0('0x27'),'afterCreate',_0xf2f0('0x65'),util[_0xf2f0('0x28')](_0x4ff493[_0xf2f0('0x19')],{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x444660){return logger['error'](_0xf2f0('0x27'),_0xf2f0('0x3a'),_0xf2f0('0x65'),util[_0xf2f0('0x28')](_0x444660,{'showHidden':![],'depth':null}));});}else{logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xf2f0('0x6a'):if(_0x36d0db['apiKey']){var _0x3720b2={};var _0x2dcbd0={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x6b'),'headers':{'Authorization':_0xf2f0('0x6c')+_0x36d0db['apiKey'],'Content-Type':_0xf2f0('0x6d')},'body':{'from':_0x36d0db[_0xf2f0('0x21')],'to':_0x3f2e5d['phone'],'text':_0x3f2e5d[_0xf2f0('0x2d')]},'json':!![]};return rp(_0x2dcbd0)['then'](function(_0x51e6fc){if(_0x51e6fc[_0xf2f0('0x6e')]==0xca){_0x3720b2[_0xf2f0('0x6f')]=_0x51e6fc;var _0x48bee1={'method':_0xf2f0('0x35'),'uri':_0xf2f0('0x70'),'headers':{'Authorization':_0xf2f0('0x6c')+_0x36d0db['apiKey'],'Content-Type':_0xf2f0('0x6d')},'body':{'refid':_0x3720b2['message'][_0xf2f0('0x71')]},'json':!![]};return rp(_0x48bee1)[_0xf2f0('0x32')](function(_0x58a8d3){_0x3720b2[_0xf2f0('0x72')]=_0x58a8d3;var _0x2d623e={'messageId':_0x3720b2['message'][_0xf2f0('0x71')],'read':!![]};return _0x5847b6[_0xf2f0('0x26')](_0x2d623e);});}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'intelepeer',util[_0xf2f0('0x28')](_0x51e6fc,{'showHidden':![],'depth':null}));}})[_0xf2f0('0x18')](function(_0x58d595){return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),'afterCreate','intelepeer',util[_0xf2f0('0x28')](_0x58d595,{'showHidden':![],'depth':null}));});}else{return logger[_0xf2f0('0x19')](_0xf2f0('0x27'),_0xf2f0('0x3a'),'intelepeer',_0xf2f0('0x73'));}break;}}})[_0xf2f0('0x74')](function(){_0xfab420();});}else{_0xfab420();}}},'charset':_0xf2f0('0x75'),'collate':_0xf2f0('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4c83ba1..e4703f4 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 _0x449f=['localhost','socket.io-emitter','redis','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults'];(function(_0x289f73,_0xf18b3a){var _0x10f03e=function(_0x86a0a4){while(--_0x86a0a4){_0x289f73['push'](_0x289f73['shift']());}};_0x10f03e(++_0xf18b3a);}(_0x449f,0x14a));var _0xf449=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x449f[_0x28f1de];return _0x5b5dad;};'use strict';var _=require(_0xf449('0x0'));var util=require(_0xf449('0x1'));var moment=require(_0xf449('0x2'));var BPromise=require(_0xf449('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf449('0x4'));var db=require(_0xf449('0x5'))['db'];var utils=require(_0xf449('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf449('0x7'));var jayson=require(_0xf449('0x8'));var client=jayson['client'][_0xf449('0x9')]({'port':0x232a});config['redis']=_[_0xf449('0xa')](config['redis'],{'host':_0xf449('0xb'),'port':0x18eb});var socket=require(_0xf449('0xc'))(new Redis(config[_0xf449('0xd')]));require('./smsMessage.socket')[_0xf449('0xe')](socket);function respondWithRpcPromise(_0x27877d,_0x402798,_0x445f7e){return new BPromise(function(_0x1854c2,_0x59a1aa){return client[_0xf449('0xf')](_0x27877d,_0x445f7e)[_0xf449('0x10')](function(_0x1d3e80){logger[_0xf449('0x11')](_0xf449('0x12'),_0x402798,_0xf449('0x13'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x402798,_0xf449('0x13'),JSON[_0xf449('0x14')](_0x1d3e80));if(_0x1d3e80[_0xf449('0x15')]){if(_0x1d3e80[_0xf449('0x15')][_0xf449('0x16')]===0x1f4){logger['error'](_0xf449('0x12'),_0x402798,_0x1d3e80[_0xf449('0x15')][_0xf449('0x17')]);return _0x59a1aa(_0x1d3e80[_0xf449('0x15')]['message']);}logger[_0xf449('0x15')](_0xf449('0x12'),_0x402798,_0x1d3e80[_0xf449('0x15')]['message']);return _0x1854c2(_0x1d3e80[_0xf449('0x15')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x402798,_0xf449('0x13'));_0x1854c2(_0x1d3e80[_0xf449('0x18')][_0xf449('0x17')]);}})[_0xf449('0x19')](function(_0x5c2a93){logger['error'](_0xf449('0x12'),_0x402798,_0x5c2a93);_0x59a1aa(_0x5c2a93);});});}exports['CreateSmsMessage']=function(_0x272c11){var _0x58cdb2=this;return new Promise(function(_0x17567c,_0x2ee217){return db['SmsMessage'][_0xf449('0x1a')](_0x272c11[_0xf449('0x1b')],{'raw':_0x272c11[_0xf449('0x1c')]?_0x272c11[_0xf449('0x1c')][_0xf449('0x1d')]===undefined?!![]:![]:!![]})[_0xf449('0x10')](function(_0x15a2ea){logger['info']('CreateSmsMessage',_0x272c11);logger['debug'](_0xf449('0x1e'),_0x272c11,JSON[_0xf449('0x14')](_0x15a2ea));_0x17567c(_0x15a2ea);})['catch'](function(_0x4a6e3e){logger['error']('CreateSmsMessage',_0x4a6e3e[_0xf449('0x17')],_0x272c11);_0x2ee217(_0x58cdb2[_0xf449('0x15')](0x1f4,_0x4a6e3e[_0xf449('0x17')]));});});}; \ No newline at end of file +var _0xabdb=['SmsMessage','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage'];(function(_0x21cd58,_0x4604d6){var _0x3fba55=function(_0x51922e){while(--_0x51922e){_0x21cd58['push'](_0x21cd58['shift']());}};_0x3fba55(++_0x4604d6);}(_0xabdb,0x185));var _0xbabd=function(_0x7568a,_0x41c9fe){_0x7568a=_0x7568a-0x0;var _0x29e8eb=_0xabdb[_0x7568a];return _0x29e8eb;};'use strict';var _=require('lodash');var util=require(_0xbabd('0x0'));var moment=require('moment');var BPromise=require(_0xbabd('0x1'));var rs=require(_0xbabd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbabd('0x3'))['db'];var utils=require(_0xbabd('0x4'));var logger=require('../../config/logger')(_0xbabd('0x5'));var config=require(_0xbabd('0x6'));var jayson=require(_0xbabd('0x7'));var client=jayson[_0xbabd('0x8')][_0xbabd('0x9')]({'port':0x232a});config['redis']=_[_0xbabd('0xa')](config[_0xbabd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbabd('0xc'))(new Redis(config[_0xbabd('0xb')]));require(_0xbabd('0xd'))['register'](socket);function respondWithRpcPromise(_0x8232ae,_0x498c05,_0x1c7eac){return new BPromise(function(_0x15157b,_0x2aab99){return client[_0xbabd('0xe')](_0x8232ae,_0x1c7eac)[_0xbabd('0xf')](function(_0x243353){logger[_0xbabd('0x10')](_0xbabd('0x11'),_0x498c05,_0xbabd('0x12'));logger[_0xbabd('0x13')](_0xbabd('0x14'),_0x498c05,_0xbabd('0x12'),JSON[_0xbabd('0x15')](_0x243353));if(_0x243353[_0xbabd('0x16')]){if(_0x243353[_0xbabd('0x16')]['code']===0x1f4){logger[_0xbabd('0x16')](_0xbabd('0x11'),_0x498c05,_0x243353[_0xbabd('0x16')]['message']);return _0x2aab99(_0x243353['error']['message']);}logger[_0xbabd('0x16')](_0xbabd('0x11'),_0x498c05,_0x243353[_0xbabd('0x16')][_0xbabd('0x17')]);return _0x15157b(_0x243353[_0xbabd('0x16')]['message']);}else{logger[_0xbabd('0x10')](_0xbabd('0x11'),_0x498c05,_0xbabd('0x12'));_0x15157b(_0x243353[_0xbabd('0x18')][_0xbabd('0x17')]);}})[_0xbabd('0x19')](function(_0x55e8f8){logger[_0xbabd('0x16')](_0xbabd('0x11'),_0x498c05,_0x55e8f8);_0x2aab99(_0x55e8f8);});});}exports[_0xbabd('0x1a')]=function(_0xd28281){var _0x34d6d5=this;return new Promise(function(_0x1393b8,_0x1c8172){return db[_0xbabd('0x1b')][_0xbabd('0x1c')](_0xd28281[_0xbabd('0x1d')],{'raw':_0xd28281[_0xbabd('0x1e')]?_0xd28281['options'][_0xbabd('0x1f')]===undefined?!![]:![]:!![]})[_0xbabd('0xf')](function(_0x296250){logger[_0xbabd('0x10')](_0xbabd('0x1a'),_0xd28281);logger[_0xbabd('0x13')](_0xbabd('0x1a'),_0xd28281,JSON[_0xbabd('0x15')](_0x296250));_0x1393b8(_0x296250);})[_0xbabd('0x19')](function(_0x1c5cfd){logger[_0xbabd('0x16')](_0xbabd('0x1a'),_0x1c5cfd['message'],_0xd28281);_0x1c8172(_0x34d6d5[_0xbabd('0x16')](0x1f4,_0x1c5cfd[_0xbabd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c68fa98..336c3af 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 _0x787f=['smsMessage:','./smsMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x48a84a,_0x22222e){var _0x470b42=function(_0x274811){while(--_0x274811){_0x48a84a['push'](_0x48a84a['shift']());}};_0x470b42(++_0x22222e);}(_0x787f,0x1f1));var _0xf787=function(_0x48e885,_0x1b7f8a){_0x48e885=_0x48e885-0x0;var _0x3830a4=_0x787f[_0x48e885];return _0x3830a4;};'use strict';var SmsMessageEvents=require(_0xf787('0x0'));var events=[_0xf787('0x1'),_0xf787('0x2'),'update'];function createListener(_0x9eb528,_0x5aa41c){return function(_0x148b00){_0x5aa41c[_0xf787('0x3')](_0x9eb528,_0x148b00);};}function removeListener(_0xa1ad07,_0x40850e){return function(){SmsMessageEvents[_0xf787('0x4')](_0xa1ad07,_0x40850e);};}exports[_0xf787('0x5')]=function(_0x346865){for(var _0x4cd47b=0x0,_0x3a3b19=events[_0xf787('0x6')];_0x4cd47b<_0x3a3b19;_0x4cd47b++){var _0x1e21e7=events[_0x4cd47b];var _0x56fd41=createListener(_0xf787('0x7')+_0x1e21e7,_0x346865);SmsMessageEvents['on'](_0x1e21e7,_0x56fd41);}}; \ No newline at end of file +var _0x6015=['emit','removeListener','register','length','smsMessage:','remove','update'];(function(_0xe66101,_0x6eb5a6){var _0x5bae1b=function(_0x4aeda5){while(--_0x4aeda5){_0xe66101['push'](_0xe66101['shift']());}};_0x5bae1b(++_0x6eb5a6);}(_0x6015,0xde));var _0x5601=function(_0x5826b2,_0x2bb5fe){_0x5826b2=_0x5826b2-0x0;var _0x565929=_0x6015[_0x5826b2];return _0x565929;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x5601('0x0'),_0x5601('0x1')];function createListener(_0x4cfb8b,_0x4b2547){return function(_0x250c50){_0x4b2547[_0x5601('0x2')](_0x4cfb8b,_0x250c50);};}function removeListener(_0x3aaabd,_0x5c83af){return function(){SmsMessageEvents[_0x5601('0x3')](_0x3aaabd,_0x5c83af);};}exports[_0x5601('0x4')]=function(_0x532fda){for(var _0x3e883f=0x0,_0x43a755=events[_0x5601('0x5')];_0x3e883f<_0x43a755;_0x3e883f++){var _0x57ae8a=events[_0x3e883f];var _0x585894=createListener(_0x5601('0x6')+_0x57ae8a,_0x532fda);SmsMessageEvents['on'](_0x57ae8a,_0x585894);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 90e9806..5b93f46 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 _0x5d59=['getMembers','get','/:id/teams','getTeams','create','post','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x34090a,_0x5e94ec){var _0xf1051=function(_0x4ee37e){while(--_0x4ee37e){_0x34090a['push'](_0x34090a['shift']());}};_0xf1051(++_0x5e94ec);}(_0x5d59,0x15f));var _0x95d5=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x5d59[_0x55969b];return _0x3d7fc1;};'use strict';var multer=require('multer');var util=require(_0x95d5('0x0'));var path=require(_0x95d5('0x1'));var timeout=require(_0x95d5('0x2'));var express=require(_0x95d5('0x3'));var router=express[_0x95d5('0x4')]();var auth=require(_0x95d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95d5('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x95d5('0x7')](),controller['index']);router['get'](_0x95d5('0x8'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x9')]);router['get'](_0x95d5('0xa'),auth['isAuthenticated'](),controller[_0x95d5('0xb')]);router['get'](_0x95d5('0xc'),auth[_0x95d5('0x7')](),controller[_0x95d5('0xd')]);router[_0x95d5('0xe')](_0x95d5('0xf'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x10')]);router[_0x95d5('0xe')]('/:id/users',auth[_0x95d5('0x7')](),controller['getAgents']);router['post']('/',auth[_0x95d5('0x7')](),controller[_0x95d5('0x11')]);router[_0x95d5('0x12')](_0x95d5('0xf'),auth['isAuthenticated'](),controller[_0x95d5('0x13')]);router[_0x95d5('0x12')](_0x95d5('0x14'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x15')]);router[_0x95d5('0x16')](_0x95d5('0xa'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x17')]);router['delete']('/:id',auth[_0x95d5('0x7')](),controller['destroy']);router[_0x95d5('0x18')](_0x95d5('0xf'),auth['isAuthenticated'](),controller[_0x95d5('0x19')]);router[_0x95d5('0x18')](_0x95d5('0x14'),auth[_0x95d5('0x7')](),controller[_0x95d5('0x1a')]);module[_0x95d5('0x1b')]=router; \ No newline at end of file +var _0xf95f=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','delete','destroy','removeTeams','exports','multer','util'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf95f,0x142));var _0xff95=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xf95f[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var path=require(_0xff95('0x2'));var timeout=require(_0xff95('0x3'));var express=require(_0xff95('0x4'));var router=express[_0xff95('0x5')]();var auth=require(_0xff95('0x6'));var interaction=require(_0xff95('0x7'));var config=require(_0xff95('0x8'));var controller=require('./smsQueue.controller');router[_0xff95('0x9')]('/',auth['isAuthenticated'](),controller[_0xff95('0xa')]);router['get'](_0xff95('0xb'),auth[_0xff95('0xc')](),controller[_0xff95('0xd')]);router[_0xff95('0x9')](_0xff95('0xe'),auth[_0xff95('0xc')](),controller[_0xff95('0xf')]);router[_0xff95('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xff95('0x10')]);router[_0xff95('0x9')](_0xff95('0x11'),auth[_0xff95('0xc')](),controller[_0xff95('0x12')]);router[_0xff95('0x9')](_0xff95('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xff95('0x14')]('/',auth[_0xff95('0xc')](),controller['create']);router[_0xff95('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xff95('0x14')](_0xff95('0x13'),auth[_0xff95('0xc')](),controller[_0xff95('0x15')]);router[_0xff95('0x16')](_0xff95('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xff95('0x17')](_0xff95('0xe'),auth[_0xff95('0xc')](),controller[_0xff95('0x18')]);router[_0xff95('0x17')](_0xff95('0x11'),auth['isAuthenticated'](),controller[_0xff95('0x19')]);router[_0xff95('0x17')](_0xff95('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xff95('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 32a4c7c..43ca8c1 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 _0x4196=['sequelize','exports','STRING','INTEGER','ENUM','roundrobin'];(function(_0x4c56d1,_0x11d94b){var _0x33bb7e=function(_0x12725b){while(--_0x12725b){_0x4c56d1['push'](_0x4c56d1['shift']());}};_0x33bb7e(++_0x11d94b);}(_0x4196,0x14a));var _0x6419=function(_0x441034,_0x1b5912){_0x441034=_0x441034-0x0;var _0x13cb8c=_0x4196[_0x441034];return _0x13cb8c;};'use strict';var Sequelize=require(_0x6419('0x0'));module[_0x6419('0x1')]={'name':{'type':Sequelize[_0x6419('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6419('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6419('0x4')]('rrmemory','beepall',_0x6419('0x5'))}}; \ No newline at end of file +var _0x77f5=['STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x20ac6e,_0x2d5d0c){var _0x2df2b9=function(_0x290c0c){while(--_0x290c0c){_0x20ac6e['push'](_0x20ac6e['shift']());}};_0x2df2b9(++_0x2d5d0c);}(_0x77f5,0x17c));var _0x577f=function(_0x23629f,_0x4b37fa){_0x23629f=_0x23629f-0x0;var _0x4d810a=_0x77f5[_0x23629f];return _0x4d810a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x577f('0x0')],'unique':_0x577f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x577f('0x0')]},'timeout':{'type':Sequelize[_0x577f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x577f('0x3')](_0x577f('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4359f82..27649c6 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 _0x7da7=['getAgents','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','count','offset','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','status','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','include','findAll','rows','catch','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','pick','getTeams','Agents','online','interface','flatMap','sequelize','transaction','each','emit','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','compact','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x7da7,0x10d));var _0x77da=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x7da7[_0x531cb8];return _0x5cf297;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];config[_0x77da('0x17')]=_['defaults'](config['redis'],{'host':_0x77da('0x18'),'port':0x18eb});var socket=require(_0x77da('0x19'))(new Redis(config['redis']));require(_0x77da('0x1a'))[_0x77da('0x1b')](socket);function respondWithStatusCode(_0x355719,_0x3c87c2){_0x3c87c2=_0x3c87c2||0xcc;return function(_0x519253){if(_0x519253){return _0x355719[_0x77da('0x1c')](_0x3c87c2);}return _0x355719['status'](_0x3c87c2)[_0x77da('0x1d')]();};}function respondWithResult(_0x366443,_0x1b0e17){_0x1b0e17=_0x1b0e17||0xc8;return function(_0x4500c4){if(_0x4500c4){return _0x366443['status'](_0x1b0e17)['json'](_0x4500c4);}};}function respondWithFilteredResult(_0x514016,_0x482b87){return function(_0x103e46){if(_0x103e46){var _0x295bef=_0x103e46[_0x77da('0x1e')],_0x289887=_0x482b87[_0x77da('0x1f')],_0x335dcb=_0x482b87[_0x77da('0x1f')]+_0x482b87['limit'],_0x19a00c;if(_0x335dcb>=_0x295bef){_0x335dcb=_0x295bef;_0x19a00c=0xc8;}else{_0x19a00c=0xce;}_0x514016['status'](_0x19a00c);return _0x514016[_0x77da('0x20')](_0x77da('0x21'),_0x289887+'-'+_0x335dcb+'/'+_0x295bef)['json'](_0x103e46);}return null;};}function patchUpdates(_0x45a122){return function(_0x304a2b){try{jsonpatch[_0x77da('0x22')](_0x304a2b,_0x45a122,!![]);}catch(_0x5ab79a){return BPromise['reject'](_0x5ab79a);}return _0x304a2b[_0x77da('0x23')]();};}function saveUpdates(_0x58f6c1,_0x175ac4){return function(_0x1c27aa){if(_0x1c27aa){return _0x1c27aa[_0x77da('0x24')](_0x58f6c1)[_0x77da('0x25')](function(_0x10399a){return _0x10399a;});}return null;};}function removeEntity(_0x270318,_0x95b5db){return function(_0x50799d){if(_0x50799d){return _0x50799d['destroy']()[_0x77da('0x25')](function(){var _0x2d009f=_0x50799d[_0x77da('0x26')]({'plain':!![]});var _0xbd06b7='SmsQueues';return db[_0x77da('0x27')][_0x77da('0x28')]({'where':{'type':_0xbd06b7,'resourceId':_0x2d009f['id']}})[_0x77da('0x25')](function(){return _0x50799d;});})[_0x77da('0x25')](function(){_0x270318[_0x77da('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce24b8,_0x3e090d){return function(_0x1f2279){if(!_0x1f2279){_0xce24b8[_0x77da('0x1c')](0x194);}return _0x1f2279;};}function handleError(_0x496ecd,_0x5b4638){_0x5b4638=_0x5b4638||0x1f4;return function(_0x4d395a){logger[_0x77da('0x2a')](_0x4d395a[_0x77da('0x2b')]);if(_0x4d395a[_0x77da('0x2c')]){delete _0x4d395a[_0x77da('0x2c')];}_0x496ecd[_0x77da('0x29')](_0x5b4638)['send'](_0x4d395a);};}exports[_0x77da('0x2d')]=function(_0x26f5a0,_0x356bfb){var _0x1d381b={},_0x1e7853={},_0x46e6b4={'count':0x0,'rows':[]};var _0x52c5be=_[_0x77da('0x2e')](db[_0x77da('0x2f')][_0x77da('0x30')],function(_0x38643a){return{'name':_0x38643a[_0x77da('0x31')],'type':_0x38643a[_0x77da('0x32')][_0x77da('0x33')]};});_0x1e7853[_0x77da('0x34')]=_['map'](_0x52c5be,'name');_0x1e7853[_0x77da('0x35')]=_[_0x77da('0x36')](_0x26f5a0['query']);_0x1e7853[_0x77da('0x37')]=_[_0x77da('0x38')](_0x1e7853[_0x77da('0x34')],_0x1e7853[_0x77da('0x35')]);_0x1d381b[_0x77da('0x39')]=_[_0x77da('0x38')](_0x1e7853[_0x77da('0x34')],qs['fields'](_0x26f5a0[_0x77da('0x35')]['fields']));_0x1d381b['attributes']=_0x1d381b['attributes'][_0x77da('0x3a')]?_0x1d381b['attributes']:_0x1e7853[_0x77da('0x34')];if(!_0x26f5a0[_0x77da('0x35')][_0x77da('0x3b')](_0x77da('0x3c'))){_0x1d381b[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x26f5a0[_0x77da('0x35')]['limit']);_0x1d381b[_0x77da('0x1f')]=qs[_0x77da('0x1f')](_0x26f5a0[_0x77da('0x35')][_0x77da('0x1f')]);}_0x1d381b[_0x77da('0x3e')]=qs[_0x77da('0x3f')](_0x26f5a0['query'][_0x77da('0x3f')]);_0x1d381b[_0x77da('0x40')]=qs[_0x77da('0x37')](_['pick'](_0x26f5a0[_0x77da('0x35')],_0x1e7853['filters']),_0x52c5be);if(_0x26f5a0['query']['filter']){_0x1d381b['where']=_[_0x77da('0x41')](_0x1d381b[_0x77da('0x40')],{'$or':_[_0x77da('0x2e')](_0x52c5be,function(_0x4e4351){if(_0x4e4351[_0x77da('0x32')]!=='VIRTUAL'){var _0xf79c20={};_0xf79c20[_0x4e4351['name']]={'$like':'%'+_0x26f5a0[_0x77da('0x35')][_0x77da('0x42')]+'%'};return _0xf79c20;}})});}_0x1d381b=_[_0x77da('0x41')]({},_0x1d381b,_0x26f5a0[_0x77da('0x43')]);var _0x240bee={'where':_0x1d381b['where']};return db[_0x77da('0x2f')][_0x77da('0x1e')](_0x240bee)[_0x77da('0x25')](function(_0x2f14f4){_0x46e6b4[_0x77da('0x1e')]=_0x2f14f4;if(_0x26f5a0[_0x77da('0x35')]['includeAll']){_0x1d381b[_0x77da('0x44')]=[{'all':!![]}];}return db[_0x77da('0x2f')][_0x77da('0x45')](_0x1d381b);})[_0x77da('0x25')](function(_0x7d11f9){_0x46e6b4[_0x77da('0x46')]=_0x7d11f9;return _0x46e6b4;})['then'](respondWithFilteredResult(_0x356bfb,_0x1d381b))[_0x77da('0x47')](handleError(_0x356bfb,null));};exports['show']=function(_0x1ae806,_0x373fb2){var _0x40a492={'raw':!![],'where':{'id':_0x1ae806[_0x77da('0x48')]['id']}},_0x514355={};_0x514355[_0x77da('0x34')]=_[_0x77da('0x36')](db[_0x77da('0x2f')][_0x77da('0x30')]);_0x514355[_0x77da('0x35')]=_[_0x77da('0x36')](_0x1ae806[_0x77da('0x35')]);_0x514355[_0x77da('0x37')]=_['intersection'](_0x514355[_0x77da('0x34')],_0x514355[_0x77da('0x35')]);_0x40a492[_0x77da('0x39')]=_[_0x77da('0x38')](_0x514355[_0x77da('0x34')],qs[_0x77da('0x49')](_0x1ae806['query']['fields']));_0x40a492[_0x77da('0x39')]=_0x40a492[_0x77da('0x39')][_0x77da('0x3a')]?_0x40a492[_0x77da('0x39')]:_0x514355[_0x77da('0x34')];if(_0x1ae806[_0x77da('0x35')]['includeAll']){_0x40a492[_0x77da('0x44')]=[{'all':!![]}];}_0x40a492=_[_0x77da('0x41')]({},_0x40a492,_0x1ae806[_0x77da('0x43')]);return db[_0x77da('0x2f')]['find'](_0x40a492)[_0x77da('0x25')](handleEntityNotFound(_0x373fb2,null))['then'](respondWithResult(_0x373fb2,null))['catch'](handleError(_0x373fb2,null));};exports[_0x77da('0x4a')]=function(_0x176f01,_0x143a68){return db[_0x77da('0x2f')]['create'](_0x176f01[_0x77da('0x4b')],{})[_0x77da('0x25')](function(_0x56a3d9){var _0x731995=_0x176f01[_0x77da('0x4c')]['get']({'plain':!![]});if(!_0x731995)throw new Error(_0x77da('0x4d'));if(_0x731995[_0x77da('0x4e')]===_0x77da('0x4c')){var _0xef2496=_0x56a3d9[_0x77da('0x26')]({'plain':!![]});var _0x1043c7=_0x77da('0x4f');return db[_0x77da('0x50')][_0x77da('0x51')]({'where':{'name':_0x1043c7,'userProfileId':_0x731995[_0x77da('0x52')]},'raw':!![]})['then'](function(_0x3d04a3){if(_0x3d04a3&&_0x3d04a3['autoAssociation']===0x0){return db[_0x77da('0x27')][_0x77da('0x4a')]({'name':_0xef2496[_0x77da('0x2c')],'resourceId':_0xef2496['id'],'type':_0x3d04a3[_0x77da('0x2c')],'sectionId':_0x3d04a3['id']},{})[_0x77da('0x25')](function(){return _0x56a3d9;});}else{return _0x56a3d9;}})[_0x77da('0x47')](function(_0x3a78d2){logger['error'](_0x77da('0x53'),_0x3a78d2);throw _0x3a78d2;});}return _0x56a3d9;})[_0x77da('0x25')](respondWithResult(_0x143a68,0xc9))[_0x77da('0x47')](handleError(_0x143a68,null));};exports[_0x77da('0x24')]=function(_0x4f30a1,_0x2c4f68){if(_0x4f30a1[_0x77da('0x4b')]['id']){delete _0x4f30a1[_0x77da('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4f30a1[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x2c4f68,null))[_0x77da('0x25')](saveUpdates(_0x4f30a1[_0x77da('0x4b')],null))[_0x77da('0x25')](respondWithResult(_0x2c4f68,null))['catch'](handleError(_0x2c4f68,null));};exports['destroy']=function(_0x365e91,_0x36f161){return db['SmsQueue'][_0x77da('0x51')]({'where':{'id':_0x365e91[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x36f161,null))['then'](removeEntity(_0x36f161,null))[_0x77da('0x47')](handleError(_0x36f161,null));};exports[_0x77da('0x54')]=function(_0x5a5309,_0x3ae855){return db[_0x77da('0x2f')][_0x77da('0x54')]()[_0x77da('0x25')](respondWithResult(_0x3ae855,null))[_0x77da('0x47')](handleError(_0x3ae855,null));};exports[_0x77da('0x55')]=function(_0x1dc4ab,_0x1719f5,_0x1ecb28){var _0x4831ce={'raw':!![],'where':{}},_0x3076ea={},_0x11c240;return db[_0x77da('0x2f')][_0x77da('0x56')]({'where':{'id':_0x1dc4ab[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x1719f5,null))['then'](function(_0x316666){if(_0x316666){_0x11c240=_0x316666[_0x77da('0x26')]({'plain':!![]});_0x3076ea[_0x77da('0x34')]=_['keys'](db[_0x77da('0x57')][_0x77da('0x30')]);_0x3076ea[_0x77da('0x35')]=_[_0x77da('0x36')](_0x1dc4ab[_0x77da('0x35')]);_0x3076ea[_0x77da('0x37')]=_[_0x77da('0x38')](_0x3076ea['model'],_0x3076ea[_0x77da('0x35')]);_0x4831ce['attributes']=_[_0x77da('0x38')](_0x3076ea[_0x77da('0x34')],qs[_0x77da('0x49')](_0x1dc4ab['query'][_0x77da('0x49')]));_0x4831ce[_0x77da('0x39')]=_0x4831ce[_0x77da('0x39')][_0x77da('0x3a')]?_0x4831ce['attributes']:_0x3076ea['model'];if(!_0x1dc4ab['query'][_0x77da('0x3b')](_0x77da('0x3c'))){_0x4831ce[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x1dc4ab[_0x77da('0x35')][_0x77da('0x3d')]);_0x4831ce[_0x77da('0x1f')]=qs[_0x77da('0x1f')](_0x1dc4ab[_0x77da('0x35')][_0x77da('0x1f')]);}_0x4831ce['order']=qs[_0x77da('0x3f')](_0x1dc4ab[_0x77da('0x35')]['sort']);_0x4831ce['where']=qs[_0x77da('0x37')](_['pick'](_0x1dc4ab[_0x77da('0x35')],_0x3076ea[_0x77da('0x37')]));_0x4831ce[_0x77da('0x40')]['SmsQueueId']=_0x316666['id'];if(_0x1dc4ab[_0x77da('0x35')][_0x77da('0x42')]){_0x4831ce[_0x77da('0x40')]=_[_0x77da('0x41')](_0x4831ce[_0x77da('0x40')],{'$or':_['map'](_0x4831ce[_0x77da('0x39')],function(_0x20a636){var _0x5f0938={};_0x5f0938[_0x20a636]={'$like':'%'+_0x1dc4ab[_0x77da('0x35')][_0x77da('0x42')]+'%'};return _0x5f0938;})});}_0x4831ce=_[_0x77da('0x41')]({},_0x4831ce,_0x1dc4ab[_0x77da('0x43')]);return db[_0x77da('0x57')][_0x77da('0x45')](_0x4831ce);}})[_0x77da('0x25')](function(_0x4b7260){if(_0x4b7260){return db[_0x77da('0x58')]['findAndCountAll']({'where':{'id':_[_0x77da('0x2e')](_0x4b7260,_0x77da('0x59')),'role':_0x77da('0x5a')},'attributes':['id',_0x77da('0x2c'),_0x77da('0x5b'),_0x77da('0x5c'),_0x77da('0x5d')]});}})[_0x77da('0x25')](function(_0x195a34){if(_0x195a34){return{'count':_0x195a34[_0x77da('0x1e')],'rows':_[_0x77da('0x2e')](_0x195a34[_0x77da('0x46')],function(_0x4e0fd5){return{'membername':_0x4e0fd5[_0x77da('0x2c')],'UserId':_0x4e0fd5['id'],'queue_name':_0x11c240[_0x77da('0x2c')],'SmsQueueId':_0x11c240['id'],'interface':util[_0x77da('0x5e')](_0x77da('0x5f'),'SIP',_0x4e0fd5[_0x77da('0x2c')]),'penalty':0x0,'paused':_0x4e0fd5[_0x77da('0x5b')],'createdAt':_0x4e0fd5[_0x77da('0x5d')],'updatedAt':_0x4e0fd5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x77da('0x25')](respondWithFilteredResult(_0x1719f5,_0x4831ce))['catch'](handleError(_0x1719f5,null));};exports['getTeams']=function(_0x2a4f85,_0x4015f0,_0x11f029){var _0x371d38={};var _0x3cb69e={};var _0x337621;var _0x14dec8;return db[_0x77da('0x2f')][_0x77da('0x56')]({'where':{'id':_0x2a4f85['params']['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x4015f0,null))[_0x77da('0x25')](function(_0x2d3ab4){if(_0x2d3ab4){_0x337621=_0x2d3ab4;_0x3cb69e[_0x77da('0x34')]=_[_0x77da('0x36')](db['Team'][_0x77da('0x30')]);_0x3cb69e[_0x77da('0x35')]=_[_0x77da('0x36')](_0x2a4f85[_0x77da('0x35')]);_0x3cb69e[_0x77da('0x37')]=_[_0x77da('0x38')](_0x3cb69e[_0x77da('0x34')],_0x3cb69e[_0x77da('0x35')]);_0x371d38[_0x77da('0x39')]=_[_0x77da('0x38')](_0x3cb69e['model'],qs['fields'](_0x2a4f85['query'][_0x77da('0x49')]));_0x371d38[_0x77da('0x39')]=_0x371d38[_0x77da('0x39')]['length']?_0x371d38['attributes']:_0x3cb69e[_0x77da('0x34')];_0x371d38[_0x77da('0x3e')]=qs[_0x77da('0x3f')](_0x2a4f85[_0x77da('0x35')][_0x77da('0x3f')]);_0x371d38[_0x77da('0x40')]=qs[_0x77da('0x37')](_[_0x77da('0x60')](_0x2a4f85[_0x77da('0x35')],_0x3cb69e[_0x77da('0x37')]));if(_0x2a4f85[_0x77da('0x35')][_0x77da('0x42')]){_0x371d38[_0x77da('0x40')]=_['merge'](_0x371d38['where'],{'$or':_[_0x77da('0x2e')](_0x371d38['attributes'],function(_0x4f9121){var _0x22de60={};_0x22de60[_0x4f9121]={'$like':'%'+_0x2a4f85[_0x77da('0x35')][_0x77da('0x42')]+'%'};return _0x22de60;})});}_0x371d38=_['merge']({},_0x371d38,_0x2a4f85['options']);return _0x337621[_0x77da('0x61')](_0x371d38);}})['then'](function(_0x278f20){if(_0x278f20){_0x14dec8=_0x278f20[_0x77da('0x3a')];if(!_0x2a4f85['query'][_0x77da('0x3b')]('nolimit')){_0x371d38[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x2a4f85[_0x77da('0x35')][_0x77da('0x3d')]);_0x371d38['offset']=qs[_0x77da('0x1f')](_0x2a4f85[_0x77da('0x35')][_0x77da('0x1f')]);}return _0x337621[_0x77da('0x61')](_0x371d38);}})[_0x77da('0x25')](function(_0x227739){if(_0x227739){return _0x227739?{'count':_0x14dec8,'rows':_0x227739}:null;}})[_0x77da('0x25')](respondWithResult(_0x4015f0,null))['catch'](handleError(_0x4015f0,null));};exports['addTeams']=function(_0x115876,_0x32676b,_0x3c96b9){var _0x55ee92=_0x115876['body']['ids'];return db['Team'][_0x77da('0x45')]({'where':{'id':_0x55ee92},'attributes':['id'],'include':[{'model':db[_0x77da('0x58')],'as':_0x77da('0x62'),'attributes':['id','name',_0x77da('0x63'),'voicePause',_0x77da('0x64')],'raw':!![]}]})['then'](function(_0x202365){if(_0x202365){var _0x5bbf75=_[_0x77da('0x65')](_0x202365,function(_0x415b56){var _0x54c5bf=_0x415b56[_0x77da('0x26')]({'plain':!![]});return _0x54c5bf[_0x77da('0x62')];});return db[_0x77da('0x2f')][_0x77da('0x51')]({'where':{'id':_0x115876[_0x77da('0x48')]['id']}})[_0x77da('0x25')](function(_0x2059ba){return db[_0x77da('0x66')][_0x77da('0x67')](function(_0x485e38){return _0x2059ba['addTeams'](_0x55ee92,{'transaction':_0x485e38})['then'](function(){return BPromise[_0x77da('0x68')](_0x5bbf75,function(_0x330db7){return db[_0x77da('0x57')]['findOrCreate']({'where':{'UserId':_0x330db7['id'],'SmsQueueId':_0x115876[_0x77da('0x48')]['id']},'transaction':_0x485e38});});})['then'](function(){_0x5bbf75['forEach'](function(_0x3474c2){socket[_0x77da('0x69')]('userSmsQueue:save',{'UserId':_0x3474c2['id'],'SmsQueueId':_0x2059ba['id']});});});});});}})['then'](respondWithStatusCode(_0x32676b,null))[_0x77da('0x47')](handleError(_0x32676b,null));};exports[_0x77da('0x6a')]=function(_0x35bd7f,_0x5d9750,_0x17536b){return db['Team'][_0x77da('0x45')]({'where':{'id':_0x35bd7f[_0x77da('0x35')][_0x77da('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x77da('0x58')],'as':_0x77da('0x62'),'attributes':['id'],'raw':!![]}]})[_0x77da('0x25')](handleEntityNotFound(_0x5d9750,null))['then'](function(_0x304029){var _0x2410ae=_[_0x77da('0x2e')](_0x304029,'id');var _0x2c8d07=[];var _0x49c170=[];var _0x33ad4f=squel['select']();_0x33ad4f[_0x77da('0x6c')](_0x77da('0x6d'))[_0x77da('0x6e')](_0x77da('0x6f'),'tq')[_0x77da('0x70')](_0x77da('0x71'),'ut',_0x77da('0x72'))[_0x77da('0x40')]('SmsQueueId\x20=\x20?',_0x35bd7f[_0x77da('0x48')]['id']);for(var _0x3132f0=0x0;_0x3132f0<_0x304029[_0x77da('0x3a')];_0x3132f0+=0x1){let _0x651f1a=_0x304029[_0x3132f0];for(var _0x384cff=0x0;_0x384cff<_0x651f1a[_0x77da('0x62')][_0x77da('0x3a')];_0x384cff+=0x1){let _0x12299f=_0x651f1a['Agents'][_0x384cff];var _0x531cc6=_0x33ad4f[_0x77da('0x73')]();_0x531cc6[_0x77da('0x40')](_0x77da('0x74'),_0x12299f['id']);_0x49c170['push'](db[_0x77da('0x66')]['query'](_0x531cc6[_0x77da('0x75')](),{'type':db[_0x77da('0x66')][_0x77da('0x76')]['SELECT']})['then'](function(_0x20ae0a){if(_0x20ae0a['length']===0x1){return _0x12299f['id'];}else{var _0x517621=_[_0x77da('0x77')](_[_0x77da('0x2e')](_0x20ae0a,_0x77da('0x78')),function(_0xdc2773){return _['includes'](_0x2410ae,_0xdc2773);});if(_0x517621){return _0x12299f['id'];}}}));}}return BPromise[_0x77da('0x79')](_0x49c170)['then'](function(_0x490dd8){_0x2c8d07=_(_0x2c8d07)['union'](_0x490dd8)[_0x77da('0x7a')]()[_0x77da('0x7b')]();return db[_0x77da('0x2f')][_0x77da('0x51')]({'where':{'id':_0x35bd7f[_0x77da('0x48')]['id']}})[_0x77da('0x25')](function(_0xd8218e){return db[_0x77da('0x66')]['transaction'](function(_0x91641b){return _0xd8218e[_0x77da('0x6a')](_0x35bd7f['query'][_0x77da('0x6b')],{'transaction':_0x91641b})['then'](function(){if(!_[_0x77da('0x7c')](_0x2c8d07)){return _0xd8218e[_0x77da('0x7d')](_0x2c8d07,{'transaction':_0x91641b});}})[_0x77da('0x25')](function(){_0x2c8d07[_0x77da('0x7e')](function(_0xdd97a){socket['emit'](_0x77da('0x7f'),{'UserId':_0xdd97a,'SmsQueueId':_0xd8218e['id']});});});});});});})[_0x77da('0x25')](respondWithStatusCode(_0x5d9750,null))['catch'](handleError(_0x5d9750,null));};exports[_0x77da('0x80')]=function(_0x4cc398,_0x5e5d6d,_0x2ef41b){return db['SmsQueue']['find']({'where':{'id':_0x4cc398[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x5e5d6d,null))[_0x77da('0x25')](function(_0x42a225){if(_0x42a225){return _0x42a225['addAgents'](_0x4cc398[_0x77da('0x4b')]['ids'],_[_0x77da('0x81')](_0x4cc398['body'],['ids','id'])||{})[_0x77da('0x82')](function(_0x515bd8){for(var _0x29116c=0x0;_0x29116c<_0x4cc398[_0x77da('0x4b')]['ids'][_0x77da('0x3a')];_0x29116c+=0x1){socket[_0x77da('0x69')](_0x77da('0x83'),{'UserId':_0x4cc398['body'][_0x77da('0x6b')][_0x29116c],'SmsQueueId':_0x4cc398[_0x77da('0x48')]['id']});}return _0x515bd8;});}})[_0x77da('0x25')](respondWithResult(_0x5e5d6d,null))[_0x77da('0x47')](handleError(_0x5e5d6d,null));};exports['removeAgents']=function(_0x38b861,_0x5c1e1b,_0x15cd24){return db[_0x77da('0x2f')][_0x77da('0x51')]({'where':{'id':_0x38b861[_0x77da('0x48')]['id']}})[_0x77da('0x25')](handleEntityNotFound(_0x5c1e1b,null))[_0x77da('0x25')](function(_0x1015f4){if(_0x1015f4){return _0x1015f4[_0x77da('0x7d')](_0x38b861[_0x77da('0x35')][_0x77da('0x6b')])[_0x77da('0x25')](function(){if(_[_0x77da('0x84')](_0x38b861[_0x77da('0x35')]['ids'])){for(var _0x27e0e9=0x0;_0x27e0e9<_0x38b861['query']['ids'][_0x77da('0x3a')];_0x27e0e9+=0x1){socket['emit'](_0x77da('0x7f'),{'UserId':Number(_0x38b861[_0x77da('0x35')]['ids'][_0x27e0e9]),'SmsQueueId':Number(_0x38b861[_0x77da('0x48')]['id'])});}}else{socket[_0x77da('0x69')](_0x77da('0x7f'),{'UserId':Number(_0x38b861[_0x77da('0x35')][_0x77da('0x6b')]),'SmsQueueId':Number(_0x38b861[_0x77da('0x48')]['id'])});}});}})[_0x77da('0x25')](respondWithStatusCode(_0x5c1e1b,null))[_0x77da('0x47')](handleError(_0x5c1e1b,null));};exports[_0x77da('0x85')]=function(_0x2e7460,_0x41d7e2,_0x2267c4){var _0x3def5c={};var _0x53d153={};var _0x1a2bd8;var _0x2cf6d2;return db['SmsQueue']['findOne']({'where':{'id':_0x2e7460[_0x77da('0x48')]['id']}})['then'](handleEntityNotFound(_0x41d7e2,null))[_0x77da('0x25')](function(_0x58ffcd){if(_0x58ffcd){_0x1a2bd8=_0x58ffcd;_0x53d153[_0x77da('0x34')]=_['keys'](db[_0x77da('0x58')][_0x77da('0x30')]);_0x53d153[_0x77da('0x35')]=_['keys'](_0x2e7460['query']);_0x53d153[_0x77da('0x37')]=_[_0x77da('0x38')](_0x53d153['model'],_0x53d153[_0x77da('0x35')]);_0x3def5c[_0x77da('0x39')]=_[_0x77da('0x38')](_0x53d153[_0x77da('0x34')],qs[_0x77da('0x49')](_0x2e7460[_0x77da('0x35')][_0x77da('0x49')]));_0x3def5c[_0x77da('0x39')]=_0x3def5c[_0x77da('0x39')][_0x77da('0x3a')]?_0x3def5c[_0x77da('0x39')]:_0x53d153[_0x77da('0x34')];_0x3def5c[_0x77da('0x3e')]=qs['sort'](_0x2e7460[_0x77da('0x35')]['sort']);_0x3def5c['where']=qs[_0x77da('0x37')](_[_0x77da('0x60')](_0x2e7460[_0x77da('0x35')],_0x53d153[_0x77da('0x37')]));if(_0x2e7460['query'][_0x77da('0x42')]){_0x3def5c[_0x77da('0x40')]=_['merge'](_0x3def5c[_0x77da('0x40')],{'$or':_[_0x77da('0x2e')](_0x3def5c[_0x77da('0x39')],function(_0x211853){var _0x2fdd40={};_0x2fdd40[_0x211853]={'$like':'%'+_0x2e7460[_0x77da('0x35')]['filter']+'%'};return _0x2fdd40;})});}_0x3def5c=_[_0x77da('0x41')]({},_0x3def5c,_0x2e7460['options']);return _0x1a2bd8[_0x77da('0x85')](_0x3def5c);}})[_0x77da('0x25')](function(_0x4beafb){if(_0x4beafb){_0x2cf6d2=_0x4beafb[_0x77da('0x3a')];if(!_0x2e7460['query']['hasOwnProperty'](_0x77da('0x3c'))){_0x3def5c[_0x77da('0x3d')]=qs[_0x77da('0x3d')](_0x2e7460['query']['limit']);_0x3def5c['offset']=qs[_0x77da('0x1f')](_0x2e7460[_0x77da('0x35')][_0x77da('0x1f')]);}return _0x1a2bd8[_0x77da('0x85')](_0x3def5c);}})[_0x77da('0x25')](function(_0x171987){if(_0x171987){return _0x171987?{'count':_0x2cf6d2,'rows':_0x171987}:null;}})[_0x77da('0x25')](respondWithResult(_0x41d7e2,null))['catch'](handleError(_0x41d7e2,null));}; \ No newline at end of file +var _0xf69d=['role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','hasOwnProperty','pick','SmsQueueId','UserId','agent','updatedAt','createdAt','rows','%s/%s','SIP','smsPause','getTeams','Team','order','addTeams','ids','User','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','isEmpty','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','status','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','sort','filter','where','merge','options','count','findAll','catch','show','params','fields','includeAll','SmsQueue','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x24a956,_0x1a7a4f){var _0x38aac9=function(_0x12d778){while(--_0x12d778){_0x24a956['push'](_0x24a956['shift']());}};_0x38aac9(++_0x1a7a4f);}(_0xf69d,0xd3));var _0xdf69=function(_0x471e3a,_0x144537){_0x471e3a=_0x471e3a-0x0;var _0x330052=_0xf69d[_0x471e3a];return _0x330052;};'use strict';var pdf=require(_0xdf69('0x0'));var emlformat=require(_0xdf69('0x1'));var rimraf=require(_0xdf69('0x2'));var zipdir=require(_0xdf69('0x3'));var jsonpatch=require(_0xdf69('0x4'));var rp=require('request-promise');var moment=require(_0xdf69('0x5'));var BPromise=require(_0xdf69('0x6'));var Mustache=require(_0xdf69('0x7'));var util=require(_0xdf69('0x8'));var path=require(_0xdf69('0x9'));var sox=require(_0xdf69('0xa'));var csv=require(_0xdf69('0xb'));var ejs=require(_0xdf69('0xc'));var fs=require('fs');var _=require(_0xdf69('0xd'));var squel=require(_0xdf69('0xe'));var crypto=require(_0xdf69('0xf'));var jsforce=require(_0xdf69('0x10'));var deskjs=require(_0xdf69('0x11'));var toCsv=require(_0xdf69('0xb'));var querystring=require(_0xdf69('0x12'));var Papa=require(_0xdf69('0x13'));var Redis=require(_0xdf69('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdf69('0x15'));var as=require(_0xdf69('0x16'));var hardwareService=require(_0xdf69('0x17'));var logger=require(_0xdf69('0x18'))(_0xdf69('0x19'));var utils=require(_0xdf69('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdf69('0x1b')](config[_0xdf69('0x1c')],{'host':_0xdf69('0x1d'),'port':0x18eb});var socket=require(_0xdf69('0x1e'))(new Redis(config[_0xdf69('0x1c')]));require(_0xdf69('0x1f'))['register'](socket);function respondWithStatusCode(_0x41cc77,_0x42d448){_0x42d448=_0x42d448||0xcc;return function(_0x3da128){if(_0x3da128){return _0x41cc77[_0xdf69('0x20')](_0x42d448);}return _0x41cc77['status'](_0x42d448)[_0xdf69('0x21')]();};}function respondWithResult(_0x56be66,_0x2a6e55){_0x2a6e55=_0x2a6e55||0xc8;return function(_0x1899a2){if(_0x1899a2){return _0x56be66['status'](_0x2a6e55)[_0xdf69('0x22')](_0x1899a2);}};}function respondWithFilteredResult(_0x449908,_0x1af696){return function(_0x85d1d){if(_0x85d1d){var _0x59bfd2=_0x85d1d['count'],_0x5ae237=_0x1af696[_0xdf69('0x23')],_0x352400=_0x1af696[_0xdf69('0x23')]+_0x1af696[_0xdf69('0x24')],_0x15e73a;if(_0x352400>=_0x59bfd2){_0x352400=_0x59bfd2;_0x15e73a=0xc8;}else{_0x15e73a=0xce;}_0x449908['status'](_0x15e73a);return _0x449908[_0xdf69('0x25')](_0xdf69('0x26'),_0x5ae237+'-'+_0x352400+'/'+_0x59bfd2)['json'](_0x85d1d);}return null;};}function patchUpdates(_0x56647c){return function(_0x32505a){try{jsonpatch[_0xdf69('0x27')](_0x32505a,_0x56647c,!![]);}catch(_0x13b98e){return BPromise['reject'](_0x13b98e);}return _0x32505a['save']();};}function saveUpdates(_0x5be7dd,_0x2ae7d4){return function(_0x5b931b){if(_0x5b931b){return _0x5b931b[_0xdf69('0x28')](_0x5be7dd)[_0xdf69('0x29')](function(_0x1d37d8){return _0x1d37d8;});}return null;};}function removeEntity(_0x54d2ca,_0x541da0){return function(_0x3c916d){if(_0x3c916d){return _0x3c916d[_0xdf69('0x2a')]()[_0xdf69('0x29')](function(){var _0x3fd933=_0x3c916d['get']({'plain':!![]});var _0x3b727c=_0xdf69('0x2b');return db[_0xdf69('0x2c')]['destroy']({'where':{'type':_0x3b727c,'resourceId':_0x3fd933['id']}})[_0xdf69('0x29')](function(){return _0x3c916d;});})['then'](function(){_0x54d2ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2738,_0x146b6a){return function(_0xe339ac){if(!_0xe339ac){_0x5c2738['sendStatus'](0x194);}return _0xe339ac;};}function handleError(_0x301bd2,_0xd81d0a){_0xd81d0a=_0xd81d0a||0x1f4;return function(_0x19cf2d){logger[_0xdf69('0x2d')](_0x19cf2d[_0xdf69('0x2e')]);if(_0x19cf2d[_0xdf69('0x2f')]){delete _0x19cf2d[_0xdf69('0x2f')];}_0x301bd2[_0xdf69('0x30')](_0xd81d0a)[_0xdf69('0x31')](_0x19cf2d);};}exports[_0xdf69('0x32')]=function(_0x38c1bb,_0x2a23ed){var _0x38f848={},_0x2cb97e={},_0x1b145b={'count':0x0,'rows':[]};var _0x31cee5=_[_0xdf69('0x33')](db['SmsQueue'][_0xdf69('0x34')],function(_0x2aab76){return{'name':_0x2aab76[_0xdf69('0x35')],'type':_0x2aab76[_0xdf69('0x36')][_0xdf69('0x37')]};});_0x2cb97e['model']=_[_0xdf69('0x33')](_0x31cee5,'name');_0x2cb97e[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0x38c1bb['query']);_0x2cb97e[_0xdf69('0x3a')]=_['intersection'](_0x2cb97e[_0xdf69('0x3b')],_0x2cb97e[_0xdf69('0x38')]);_0x38f848[_0xdf69('0x3c')]=_[_0xdf69('0x3d')](_0x2cb97e[_0xdf69('0x3b')],qs['fields'](_0x38c1bb[_0xdf69('0x38')]['fields']));_0x38f848[_0xdf69('0x3c')]=_0x38f848[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x38f848[_0xdf69('0x3c')]:_0x2cb97e['model'];if(!_0x38c1bb[_0xdf69('0x38')]['hasOwnProperty'](_0xdf69('0x3f'))){_0x38f848['limit']=qs[_0xdf69('0x24')](_0x38c1bb['query'][_0xdf69('0x24')]);_0x38f848[_0xdf69('0x23')]=qs[_0xdf69('0x23')](_0x38c1bb[_0xdf69('0x38')][_0xdf69('0x23')]);}_0x38f848['order']=qs[_0xdf69('0x40')](_0x38c1bb[_0xdf69('0x38')]['sort']);_0x38f848['where']=qs['filters'](_['pick'](_0x38c1bb[_0xdf69('0x38')],_0x2cb97e['filters']),_0x31cee5);if(_0x38c1bb[_0xdf69('0x38')][_0xdf69('0x41')]){_0x38f848[_0xdf69('0x42')]=_[_0xdf69('0x43')](_0x38f848['where'],{'$or':_[_0xdf69('0x33')](_0x31cee5,function(_0x1a4114){if(_0x1a4114[_0xdf69('0x36')]!=='VIRTUAL'){var _0x216f62={};_0x216f62[_0x1a4114[_0xdf69('0x2f')]]={'$like':'%'+_0x38c1bb[_0xdf69('0x38')][_0xdf69('0x41')]+'%'};return _0x216f62;}})});}_0x38f848=_[_0xdf69('0x43')]({},_0x38f848,_0x38c1bb[_0xdf69('0x44')]);var _0x4094d7={'where':_0x38f848['where']};return db['SmsQueue'][_0xdf69('0x45')](_0x4094d7)[_0xdf69('0x29')](function(_0x1d7b7c){_0x1b145b[_0xdf69('0x45')]=_0x1d7b7c;if(_0x38c1bb['query']['includeAll']){_0x38f848['include']=[{'all':!![]}];}return db['SmsQueue'][_0xdf69('0x46')](_0x38f848);})['then'](function(_0x366701){_0x1b145b['rows']=_0x366701;return _0x1b145b;})[_0xdf69('0x29')](respondWithFilteredResult(_0x2a23ed,_0x38f848))[_0xdf69('0x47')](handleError(_0x2a23ed,null));};exports[_0xdf69('0x48')]=function(_0x26c404,_0x13a3e8){var _0x2a7c7d={'raw':!![],'where':{'id':_0x26c404[_0xdf69('0x49')]['id']}},_0x1fcf56={};_0x1fcf56[_0xdf69('0x3b')]=_['keys'](db['SmsQueue'][_0xdf69('0x34')]);_0x1fcf56['query']=_[_0xdf69('0x39')](_0x26c404[_0xdf69('0x38')]);_0x1fcf56[_0xdf69('0x3a')]=_['intersection'](_0x1fcf56[_0xdf69('0x3b')],_0x1fcf56[_0xdf69('0x38')]);_0x2a7c7d[_0xdf69('0x3c')]=_[_0xdf69('0x3d')](_0x1fcf56['model'],qs[_0xdf69('0x4a')](_0x26c404[_0xdf69('0x38')]['fields']));_0x2a7c7d['attributes']=_0x2a7c7d[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x2a7c7d[_0xdf69('0x3c')]:_0x1fcf56[_0xdf69('0x3b')];if(_0x26c404[_0xdf69('0x38')][_0xdf69('0x4b')]){_0x2a7c7d['include']=[{'all':!![]}];}_0x2a7c7d=_['merge']({},_0x2a7c7d,_0x26c404[_0xdf69('0x44')]);return db[_0xdf69('0x4c')][_0xdf69('0x4d')](_0x2a7c7d)[_0xdf69('0x29')](handleEntityNotFound(_0x13a3e8,null))['then'](respondWithResult(_0x13a3e8,null))['catch'](handleError(_0x13a3e8,null));};exports[_0xdf69('0x4e')]=function(_0xe4e247,_0x3ee7a5){return db[_0xdf69('0x4c')][_0xdf69('0x4e')](_0xe4e247[_0xdf69('0x4f')],{})[_0xdf69('0x29')](function(_0x2f2e18){var _0x714374=_0xe4e247[_0xdf69('0x50')][_0xdf69('0x51')]({'plain':!![]});if(!_0x714374)throw new Error(_0xdf69('0x52'));if(_0x714374[_0xdf69('0x53')]===_0xdf69('0x50')){var _0x4bf6d0=_0x2f2e18[_0xdf69('0x51')]({'plain':!![]});var _0x476833=_0xdf69('0x2b');return db['UserProfileSection'][_0xdf69('0x4d')]({'where':{'name':_0x476833,'userProfileId':_0x714374[_0xdf69('0x54')]},'raw':!![]})[_0xdf69('0x29')](function(_0x4abeb7){if(_0x4abeb7&&_0x4abeb7[_0xdf69('0x55')]===0x0){return db['UserProfileResource'][_0xdf69('0x4e')]({'name':_0x4bf6d0[_0xdf69('0x2f')],'resourceId':_0x4bf6d0['id'],'type':_0x4abeb7[_0xdf69('0x2f')],'sectionId':_0x4abeb7['id']},{})[_0xdf69('0x29')](function(){return _0x2f2e18;});}else{return _0x2f2e18;}})['catch'](function(_0x2b1fe2){logger[_0xdf69('0x2d')](_0xdf69('0x56'),_0x2b1fe2);throw _0x2b1fe2;});}return _0x2f2e18;})[_0xdf69('0x29')](respondWithResult(_0x3ee7a5,0xc9))[_0xdf69('0x47')](handleError(_0x3ee7a5,null));};exports[_0xdf69('0x28')]=function(_0x25b5f3,_0x905914){if(_0x25b5f3[_0xdf69('0x4f')]['id']){delete _0x25b5f3['body']['id'];}return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0x25b5f3['params']['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x905914,null))[_0xdf69('0x29')](saveUpdates(_0x25b5f3['body'],null))['then'](respondWithResult(_0x905914,null))[_0xdf69('0x47')](handleError(_0x905914,null));};exports['destroy']=function(_0x36bd47,_0x1bbdda){return db[_0xdf69('0x4c')]['find']({'where':{'id':_0x36bd47['params']['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x1bbdda,null))[_0xdf69('0x29')](removeEntity(_0x1bbdda,null))[_0xdf69('0x47')](handleError(_0x1bbdda,null));};exports[_0xdf69('0x57')]=function(_0x2f57f1,_0x13adae){return db[_0xdf69('0x4c')][_0xdf69('0x57')]()[_0xdf69('0x29')](respondWithResult(_0x13adae,null))[_0xdf69('0x47')](handleError(_0x13adae,null));};exports['getMembers']=function(_0x653233,_0x2762df,_0x260294){var _0x25b8ec={'raw':!![],'where':{}},_0x11ee6c={},_0x18ead3;return db[_0xdf69('0x4c')][_0xdf69('0x58')]({'where':{'id':_0x653233[_0xdf69('0x49')]['id']}})['then'](handleEntityNotFound(_0x2762df,null))['then'](function(_0x293925){if(_0x293925){_0x18ead3=_0x293925[_0xdf69('0x51')]({'plain':!![]});_0x11ee6c['model']=_[_0xdf69('0x39')](db[_0xdf69('0x59')][_0xdf69('0x34')]);_0x11ee6c[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0x653233[_0xdf69('0x38')]);_0x11ee6c['filters']=_[_0xdf69('0x3d')](_0x11ee6c['model'],_0x11ee6c[_0xdf69('0x38')]);_0x25b8ec['attributes']=_['intersection'](_0x11ee6c[_0xdf69('0x3b')],qs[_0xdf69('0x4a')](_0x653233['query'][_0xdf69('0x4a')]));_0x25b8ec[_0xdf69('0x3c')]=_0x25b8ec[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x25b8ec[_0xdf69('0x3c')]:_0x11ee6c[_0xdf69('0x3b')];if(!_0x653233[_0xdf69('0x38')][_0xdf69('0x5a')](_0xdf69('0x3f'))){_0x25b8ec['limit']=qs['limit'](_0x653233['query'][_0xdf69('0x24')]);_0x25b8ec['offset']=qs[_0xdf69('0x23')](_0x653233[_0xdf69('0x38')]['offset']);}_0x25b8ec['order']=qs[_0xdf69('0x40')](_0x653233[_0xdf69('0x38')][_0xdf69('0x40')]);_0x25b8ec[_0xdf69('0x42')]=qs[_0xdf69('0x3a')](_[_0xdf69('0x5b')](_0x653233[_0xdf69('0x38')],_0x11ee6c[_0xdf69('0x3a')]));_0x25b8ec['where'][_0xdf69('0x5c')]=_0x293925['id'];if(_0x653233[_0xdf69('0x38')][_0xdf69('0x41')]){_0x25b8ec[_0xdf69('0x42')]=_['merge'](_0x25b8ec[_0xdf69('0x42')],{'$or':_[_0xdf69('0x33')](_0x25b8ec[_0xdf69('0x3c')],function(_0xccac7a){var _0xc360d4={};_0xc360d4[_0xccac7a]={'$like':'%'+_0x653233['query']['filter']+'%'};return _0xc360d4;})});}_0x25b8ec=_['merge']({},_0x25b8ec,_0x653233['options']);return db['UserSmsQueue'][_0xdf69('0x46')](_0x25b8ec);}})['then'](function(_0x5af4f0){if(_0x5af4f0){return db['User']['findAndCountAll']({'where':{'id':_[_0xdf69('0x33')](_0x5af4f0,_0xdf69('0x5d')),'role':_0xdf69('0x5e')},'attributes':['id',_0xdf69('0x2f'),'smsPause',_0xdf69('0x5f'),_0xdf69('0x60')]});}})['then'](function(_0x40fc57){if(_0x40fc57){return{'count':_0x40fc57[_0xdf69('0x45')],'rows':_[_0xdf69('0x33')](_0x40fc57[_0xdf69('0x61')],function(_0x463a2a){return{'membername':_0x463a2a[_0xdf69('0x2f')],'UserId':_0x463a2a['id'],'queue_name':_0x18ead3[_0xdf69('0x2f')],'SmsQueueId':_0x18ead3['id'],'interface':util['format'](_0xdf69('0x62'),_0xdf69('0x63'),_0x463a2a[_0xdf69('0x2f')]),'penalty':0x0,'paused':_0x463a2a[_0xdf69('0x64')],'createdAt':_0x463a2a[_0xdf69('0x60')],'updatedAt':_0x463a2a[_0xdf69('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf69('0x29')](respondWithFilteredResult(_0x2762df,_0x25b8ec))[_0xdf69('0x47')](handleError(_0x2762df,null));};exports[_0xdf69('0x65')]=function(_0xcfff2b,_0x2bea8b,_0x385da6){var _0x42d7a9={};var _0x291639={};var _0x5deae0;var _0xccdaef;return db['SmsQueue'][_0xdf69('0x58')]({'where':{'id':_0xcfff2b[_0xdf69('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bea8b,null))[_0xdf69('0x29')](function(_0x42fa46){if(_0x42fa46){_0x5deae0=_0x42fa46;_0x291639[_0xdf69('0x3b')]=_[_0xdf69('0x39')](db[_0xdf69('0x66')][_0xdf69('0x34')]);_0x291639[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0xcfff2b['query']);_0x291639['filters']=_['intersection'](_0x291639[_0xdf69('0x3b')],_0x291639[_0xdf69('0x38')]);_0x42d7a9[_0xdf69('0x3c')]=_['intersection'](_0x291639['model'],qs['fields'](_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x4a')]));_0x42d7a9[_0xdf69('0x3c')]=_0x42d7a9['attributes']['length']?_0x42d7a9[_0xdf69('0x3c')]:_0x291639[_0xdf69('0x3b')];_0x42d7a9[_0xdf69('0x67')]=qs[_0xdf69('0x40')](_0xcfff2b['query'][_0xdf69('0x40')]);_0x42d7a9[_0xdf69('0x42')]=qs['filters'](_['pick'](_0xcfff2b[_0xdf69('0x38')],_0x291639[_0xdf69('0x3a')]));if(_0xcfff2b['query'][_0xdf69('0x41')]){_0x42d7a9[_0xdf69('0x42')]=_[_0xdf69('0x43')](_0x42d7a9['where'],{'$or':_[_0xdf69('0x33')](_0x42d7a9['attributes'],function(_0x4ba3a0){var _0x5d0eac={};_0x5d0eac[_0x4ba3a0]={'$like':'%'+_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x41')]+'%'};return _0x5d0eac;})});}_0x42d7a9=_[_0xdf69('0x43')]({},_0x42d7a9,_0xcfff2b[_0xdf69('0x44')]);return _0x5deae0['getTeams'](_0x42d7a9);}})[_0xdf69('0x29')](function(_0x59b5bf){if(_0x59b5bf){_0xccdaef=_0x59b5bf['length'];if(!_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x5a')](_0xdf69('0x3f'))){_0x42d7a9[_0xdf69('0x24')]=qs[_0xdf69('0x24')](_0xcfff2b[_0xdf69('0x38')][_0xdf69('0x24')]);_0x42d7a9[_0xdf69('0x23')]=qs[_0xdf69('0x23')](_0xcfff2b['query']['offset']);}return _0x5deae0[_0xdf69('0x65')](_0x42d7a9);}})[_0xdf69('0x29')](function(_0x247084){if(_0x247084){return _0x247084?{'count':_0xccdaef,'rows':_0x247084}:null;}})[_0xdf69('0x29')](respondWithResult(_0x2bea8b,null))[_0xdf69('0x47')](handleError(_0x2bea8b,null));};exports[_0xdf69('0x68')]=function(_0xc4b56b,_0x24f8ab,_0x3ab275){var _0x2d443c=_0xc4b56b['body'][_0xdf69('0x69')];return db[_0xdf69('0x66')][_0xdf69('0x46')]({'where':{'id':_0x2d443c},'attributes':['id'],'include':[{'model':db[_0xdf69('0x6a')],'as':_0xdf69('0x6b'),'attributes':['id',_0xdf69('0x2f'),'online',_0xdf69('0x6c'),_0xdf69('0x6d')],'raw':!![]}]})[_0xdf69('0x29')](function(_0x35d3db){if(_0x35d3db){var _0x4e85a6=_[_0xdf69('0x6e')](_0x35d3db,function(_0x5168c6){var _0x57f356=_0x5168c6[_0xdf69('0x51')]({'plain':!![]});return _0x57f356[_0xdf69('0x6b')];});return db['SmsQueue'][_0xdf69('0x4d')]({'where':{'id':_0xc4b56b['params']['id']}})[_0xdf69('0x29')](function(_0x4a2ce5){return db['sequelize'][_0xdf69('0x6f')](function(_0x1428ed){return _0x4a2ce5[_0xdf69('0x68')](_0x2d443c,{'transaction':_0x1428ed})['then'](function(){return BPromise[_0xdf69('0x70')](_0x4e85a6,function(_0xb13308){return db[_0xdf69('0x59')][_0xdf69('0x71')]({'where':{'UserId':_0xb13308['id'],'SmsQueueId':_0xc4b56b[_0xdf69('0x49')]['id']},'transaction':_0x1428ed});});})[_0xdf69('0x29')](function(){_0x4e85a6[_0xdf69('0x72')](function(_0x31df4e){socket[_0xdf69('0x73')]('userSmsQueue:save',{'UserId':_0x31df4e['id'],'SmsQueueId':_0x4a2ce5['id']});});});});});}})[_0xdf69('0x29')](respondWithStatusCode(_0x24f8ab,null))[_0xdf69('0x47')](handleError(_0x24f8ab,null));};exports['removeTeams']=function(_0x2a7998,_0x36537b,_0x3ef9fa){return db['Team'][_0xdf69('0x46')]({'where':{'id':_0x2a7998['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdf69('0x29')](handleEntityNotFound(_0x36537b,null))[_0xdf69('0x29')](function(_0x5a3074){var _0x2a1402=_['map'](_0x5a3074,'id');var _0x23a0e2=[];var _0x30b78d=[];var _0x2e6820=squel[_0xdf69('0x74')]();_0x2e6820[_0xdf69('0x75')](_0xdf69('0x76'))[_0xdf69('0x77')](_0xdf69('0x78'),'tq')[_0xdf69('0x79')](_0xdf69('0x7a'),'ut',_0xdf69('0x7b'))[_0xdf69('0x42')](_0xdf69('0x7c'),_0x2a7998[_0xdf69('0x49')]['id']);for(var _0x5a15c4=0x0;_0x5a15c4<_0x5a3074[_0xdf69('0x3e')];_0x5a15c4+=0x1){let _0x310cb2=_0x5a3074[_0x5a15c4];for(var _0x57bef0=0x0;_0x57bef0<_0x310cb2['Agents'][_0xdf69('0x3e')];_0x57bef0+=0x1){let _0x304ddc=_0x310cb2['Agents'][_0x57bef0];var _0x508716=_0x2e6820[_0xdf69('0x7d')]();_0x508716[_0xdf69('0x42')](_0xdf69('0x7e'),_0x304ddc['id']);_0x30b78d[_0xdf69('0x7f')](db[_0xdf69('0x80')][_0xdf69('0x38')](_0x508716[_0xdf69('0x81')](),{'type':db[_0xdf69('0x80')][_0xdf69('0x82')][_0xdf69('0x83')]})['then'](function(_0x26ed52){if(_0x26ed52[_0xdf69('0x3e')]===0x1){return _0x304ddc['id'];}else{var _0x7e9145=_['every'](_[_0xdf69('0x33')](_0x26ed52,_0xdf69('0x84')),function(_0x56192e){return _[_0xdf69('0x85')](_0x2a1402,_0x56192e);});if(_0x7e9145){return _0x304ddc['id'];}}}));}}return BPromise['all'](_0x30b78d)[_0xdf69('0x29')](function(_0x3f9900){_0x23a0e2=_(_0x23a0e2)[_0xdf69('0x86')](_0x3f9900)[_0xdf69('0x87')]()[_0xdf69('0x88')]();return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0x2a7998[_0xdf69('0x49')]['id']}})[_0xdf69('0x29')](function(_0x49c6bf){return db[_0xdf69('0x80')][_0xdf69('0x6f')](function(_0x328692){return _0x49c6bf[_0xdf69('0x89')](_0x2a7998['query']['ids'],{'transaction':_0x328692})[_0xdf69('0x29')](function(){if(!_[_0xdf69('0x8a')](_0x23a0e2)){return _0x49c6bf['removeAgents'](_0x23a0e2,{'transaction':_0x328692});}})['then'](function(){_0x23a0e2[_0xdf69('0x72')](function(_0x2b9c50){socket[_0xdf69('0x73')]('userSmsQueue:remove',{'UserId':_0x2b9c50,'SmsQueueId':_0x49c6bf['id']});});});});});});})['then'](respondWithStatusCode(_0x36537b,null))[_0xdf69('0x47')](handleError(_0x36537b,null));};exports['addAgents']=function(_0xe5f628,_0x5ccc91,_0x46d2f8){return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0xe5f628['params']['id']}})['then'](handleEntityNotFound(_0x5ccc91,null))['then'](function(_0x420dc1){if(_0x420dc1){return _0x420dc1[_0xdf69('0x8b')](_0xe5f628[_0xdf69('0x4f')][_0xdf69('0x69')],_[_0xdf69('0x8c')](_0xe5f628[_0xdf69('0x4f')],['ids','id'])||{})[_0xdf69('0x8d')](function(_0x30d7cc){for(var _0x53024e=0x0;_0x53024e<_0xe5f628[_0xdf69('0x4f')]['ids'][_0xdf69('0x3e')];_0x53024e+=0x1){socket[_0xdf69('0x73')](_0xdf69('0x8e'),{'UserId':_0xe5f628[_0xdf69('0x4f')]['ids'][_0x53024e],'SmsQueueId':_0xe5f628[_0xdf69('0x49')]['id']});}return _0x30d7cc;});}})[_0xdf69('0x29')](respondWithResult(_0x5ccc91,null))['catch'](handleError(_0x5ccc91,null));};exports[_0xdf69('0x8f')]=function(_0x3c8583,_0x552a02,_0x8395f7){return db[_0xdf69('0x4c')][_0xdf69('0x4d')]({'where':{'id':_0x3c8583[_0xdf69('0x49')]['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x552a02,null))[_0xdf69('0x29')](function(_0xd3d0a7){if(_0xd3d0a7){return _0xd3d0a7[_0xdf69('0x8f')](_0x3c8583['query'][_0xdf69('0x69')])['then'](function(){if(_[_0xdf69('0x90')](_0x3c8583[_0xdf69('0x38')]['ids'])){for(var _0x3253a8=0x0;_0x3253a8<_0x3c8583['query'][_0xdf69('0x69')]['length'];_0x3253a8+=0x1){socket[_0xdf69('0x73')](_0xdf69('0x91'),{'UserId':Number(_0x3c8583[_0xdf69('0x38')][_0xdf69('0x69')][_0x3253a8]),'SmsQueueId':Number(_0x3c8583[_0xdf69('0x49')]['id'])});}}else{socket['emit'](_0xdf69('0x91'),{'UserId':Number(_0x3c8583[_0xdf69('0x38')][_0xdf69('0x69')]),'SmsQueueId':Number(_0x3c8583[_0xdf69('0x49')]['id'])});}});}})[_0xdf69('0x29')](respondWithStatusCode(_0x552a02,null))[_0xdf69('0x47')](handleError(_0x552a02,null));};exports[_0xdf69('0x92')]=function(_0x85db67,_0x5cf24a,_0x27b622){var _0x8b66d3={};var _0x14f1c2={};var _0x4f7290;var _0xc935d5;return db[_0xdf69('0x4c')][_0xdf69('0x58')]({'where':{'id':_0x85db67[_0xdf69('0x49')]['id']}})[_0xdf69('0x29')](handleEntityNotFound(_0x5cf24a,null))[_0xdf69('0x29')](function(_0x587d8e){if(_0x587d8e){_0x4f7290=_0x587d8e;_0x14f1c2['model']=_[_0xdf69('0x39')](db[_0xdf69('0x6a')][_0xdf69('0x34')]);_0x14f1c2[_0xdf69('0x38')]=_[_0xdf69('0x39')](_0x85db67[_0xdf69('0x38')]);_0x14f1c2[_0xdf69('0x3a')]=_['intersection'](_0x14f1c2[_0xdf69('0x3b')],_0x14f1c2[_0xdf69('0x38')]);_0x8b66d3['attributes']=_['intersection'](_0x14f1c2[_0xdf69('0x3b')],qs['fields'](_0x85db67[_0xdf69('0x38')][_0xdf69('0x4a')]));_0x8b66d3[_0xdf69('0x3c')]=_0x8b66d3[_0xdf69('0x3c')][_0xdf69('0x3e')]?_0x8b66d3[_0xdf69('0x3c')]:_0x14f1c2[_0xdf69('0x3b')];_0x8b66d3[_0xdf69('0x67')]=qs[_0xdf69('0x40')](_0x85db67[_0xdf69('0x38')]['sort']);_0x8b66d3[_0xdf69('0x42')]=qs['filters'](_[_0xdf69('0x5b')](_0x85db67[_0xdf69('0x38')],_0x14f1c2[_0xdf69('0x3a')]));if(_0x85db67[_0xdf69('0x38')][_0xdf69('0x41')]){_0x8b66d3[_0xdf69('0x42')]=_[_0xdf69('0x43')](_0x8b66d3[_0xdf69('0x42')],{'$or':_[_0xdf69('0x33')](_0x8b66d3[_0xdf69('0x3c')],function(_0x4d1ad2){var _0x423c2b={};_0x423c2b[_0x4d1ad2]={'$like':'%'+_0x85db67[_0xdf69('0x38')]['filter']+'%'};return _0x423c2b;})});}_0x8b66d3=_[_0xdf69('0x43')]({},_0x8b66d3,_0x85db67[_0xdf69('0x44')]);return _0x4f7290[_0xdf69('0x92')](_0x8b66d3);}})[_0xdf69('0x29')](function(_0x107676){if(_0x107676){_0xc935d5=_0x107676[_0xdf69('0x3e')];if(!_0x85db67[_0xdf69('0x38')][_0xdf69('0x5a')](_0xdf69('0x3f'))){_0x8b66d3[_0xdf69('0x24')]=qs['limit'](_0x85db67[_0xdf69('0x38')][_0xdf69('0x24')]);_0x8b66d3[_0xdf69('0x23')]=qs['offset'](_0x85db67[_0xdf69('0x38')]['offset']);}return _0x4f7290[_0xdf69('0x92')](_0x8b66d3);}})['then'](function(_0x4fee9c){if(_0x4fee9c){return _0x4fee9c?{'count':_0xc935d5,'rows':_0x4fee9c}:null;}})[_0xdf69('0x29')](respondWithResult(_0x5cf24a,null))[_0xdf69('0x47')](handleError(_0x5cf24a,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7991a65..8f091c2 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 _0x8131=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','save'];(function(_0x31244f,_0x4a775f){var _0x4e9957=function(_0x4991ff){while(--_0x4991ff){_0x31244f['push'](_0x31244f['shift']());}};_0x4e9957(++_0x4a775f);}(_0x8131,0x71));var _0x1813=function(_0x3c473e,_0x42a012){_0x3c473e=_0x3c473e-0x0;var _0xa8295=_0x8131[_0x3c473e];return _0xa8295;};'use strict';var EventEmitter=require(_0x1813('0x0'));var SmsQueue=require(_0x1813('0x1'))['db'][_0x1813('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1813('0x3'),'afterUpdate':_0x1813('0x4'),'afterDestroy':_0x1813('0x5')};function emitEvent(_0x1860da){return function(_0x3ad84f,_0x599ca8,_0x34e4d8){SmsQueueEvents[_0x1813('0x6')](_0x1860da+':'+_0x3ad84f['id'],_0x3ad84f);SmsQueueEvents[_0x1813('0x6')](_0x1860da,_0x3ad84f);_0x34e4d8(null);};}for(var e in events){if(events[_0x1813('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1813('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x8e89=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x50a1af,_0x1d5a5d){var _0x1ece76=function(_0x31a57b){while(--_0x31a57b){_0x50a1af['push'](_0x50a1af['shift']());}};_0x1ece76(++_0x1d5a5d);}(_0x8e89,0x1a5));var _0x98e8=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0x8e89[_0x35fabd];return _0x61a8ee;};'use strict';var EventEmitter=require(_0x98e8('0x0'));var SmsQueue=require(_0x98e8('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x98e8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x98e8('0x3'),'afterDestroy':_0x98e8('0x4')};function emitEvent(_0x4980b1){return function(_0xb3d96b,_0x1bbe96,_0x4474f8){SmsQueueEvents[_0x98e8('0x5')](_0x4980b1+':'+_0xb3d96b['id'],_0xb3d96b);SmsQueueEvents[_0x98e8('0x5')](_0x4980b1,_0xb3d96b);_0x4474f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x98e8('0x6')](e,emitEvent(event));}}module[_0x98e8('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b2d058e..408f48c 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 _0x2420=['define','SmsQueue','sms_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x476575,_0x3aa617){var _0x1f2bb8=function(_0x4da296){while(--_0x4da296){_0x476575['push'](_0x476575['shift']());}};_0x1f2bb8(++_0x3aa617);}(_0x2420,0x1e3));var _0x0242=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x2420[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0242('0x2'));var rp=require(_0x0242('0x3'));var fs=require('fs');var path=require(_0x0242('0x4'));var rimraf=require(_0x0242('0x5'));var config=require(_0x0242('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x3717fb,_0x447859){return _0x3717fb[_0x0242('0x7')](_0x0242('0x8'),attributes,{'tableName':_0x0242('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7409=['sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','SmsQueue'];(function(_0x3f8bdf,_0x39bf38){var _0x46c99b=function(_0x2f365d){while(--_0x2f365d){_0x3f8bdf['push'](_0x3f8bdf['shift']());}};_0x46c99b(++_0x39bf38);}(_0x7409,0x64));var _0x9740=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x7409[_0x1dd82f];return _0x353ca4;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var logger=require(_0x9740('0x2'))(_0x9740('0x3'));var moment=require('moment');var BPromise=require(_0x9740('0x4'));var rp=require(_0x9740('0x5'));var fs=require('fs');var path=require(_0x9740('0x6'));var rimraf=require(_0x9740('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x9740('0x8')]=function(_0x9a551b,_0xb32931){return _0x9a551b['define'](_0x9740('0x9'),attributes,{'tableName':_0x9740('0xa'),'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 b9a78ce..7bb76e7 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 _0x9d19=['http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SmsQueue','options','where','attributes','limit','include','map','model','GetSmsQueue','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9d19,0x10e));var _0x99d1=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x9d19[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x99d1('0x0'));var util=require(_0x99d1('0x1'));var moment=require(_0x99d1('0x2'));var BPromise=require(_0x99d1('0x3'));var rs=require(_0x99d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99d1('0x5'));var logger=require(_0x99d1('0x6'))(_0x99d1('0x7'));var config=require(_0x99d1('0x8'));var jayson=require(_0x99d1('0x9'));var client=jayson['client'][_0x99d1('0xa')]({'port':0x232a});config[_0x99d1('0xb')]=_[_0x99d1('0xc')](config[_0x99d1('0xb')],{'host':_0x99d1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99d1('0xb')]));require(_0x99d1('0xe'))[_0x99d1('0xf')](socket);function respondWithRpcPromise(_0x323539,_0x326f6e,_0x18e0fc){return new BPromise(function(_0x1787f9,_0x70123b){return client[_0x99d1('0x10')](_0x323539,_0x18e0fc)[_0x99d1('0x11')](function(_0x3c2bb3){logger[_0x99d1('0x12')](_0x99d1('0x13'),_0x326f6e,'request\x20sent');logger[_0x99d1('0x14')](_0x99d1('0x15'),_0x326f6e,_0x99d1('0x16'),JSON[_0x99d1('0x17')](_0x3c2bb3));if(_0x3c2bb3[_0x99d1('0x18')]){if(_0x3c2bb3[_0x99d1('0x18')]['code']===0x1f4){logger['error'](_0x99d1('0x13'),_0x326f6e,_0x3c2bb3[_0x99d1('0x18')][_0x99d1('0x19')]);return _0x70123b(_0x3c2bb3[_0x99d1('0x18')][_0x99d1('0x19')]);}logger[_0x99d1('0x18')](_0x99d1('0x13'),_0x326f6e,_0x3c2bb3['error'][_0x99d1('0x19')]);return _0x1787f9(_0x3c2bb3['error'][_0x99d1('0x19')]);}else{logger[_0x99d1('0x12')](_0x99d1('0x13'),_0x326f6e,'request\x20sent');_0x1787f9(_0x3c2bb3[_0x99d1('0x1a')][_0x99d1('0x19')]);}})[_0x99d1('0x1b')](function(_0x411910){logger[_0x99d1('0x18')]('SmsQueue,\x20%s,\x20%s',_0x326f6e,_0x411910);_0x70123b(_0x411910);});});}exports['GetSmsQueue']=function(_0x2ac991){var _0x1262fd=this;return new Promise(function(_0xf5684b,_0x177d83){return db[_0x99d1('0x1c')]['findAll']({'raw':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991[_0x99d1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2ac991['options']?_0x2ac991[_0x99d1('0x1d')][_0x99d1('0x1e')]||null:null,'attributes':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991['options'][_0x99d1('0x1f')]||null:null,'limit':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991['options'][_0x99d1('0x20')]||null:null,'include':_0x2ac991[_0x99d1('0x1d')]?_0x2ac991[_0x99d1('0x1d')][_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x2ac991[_0x99d1('0x1d')][_0x99d1('0x21')],function(_0x3db792){return{'model':db[_0x3db792['model']],'as':_0x3db792['as'],'attributes':_0x3db792[_0x99d1('0x1f')],'include':_0x3db792[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x3db792[_0x99d1('0x21')],function(_0x5d98f8){return{'model':db[_0x5d98f8[_0x99d1('0x23')]],'as':_0x5d98f8['as'],'attributes':_0x5d98f8[_0x99d1('0x1f')],'include':_0x5d98f8[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x5d98f8['include'],function(_0x1338cf){return{'model':db[_0x1338cf[_0x99d1('0x23')]],'as':_0x1338cf['as'],'attributes':_0x1338cf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25012d){logger[_0x99d1('0x12')]('GetSmsQueue',_0x2ac991);logger[_0x99d1('0x14')](_0x99d1('0x24'),_0x2ac991,JSON['stringify'](_0x25012d));_0xf5684b(_0x25012d);})[_0x99d1('0x1b')](function(_0x281aec){logger[_0x99d1('0x18')](_0x99d1('0x24'),_0x281aec[_0x99d1('0x19')],_0x2ac991);_0x177d83(_0x1262fd[_0x99d1('0x18')](0x1f4,_0x281aec['message']));});});};exports['ShowSmsQueue']=function(_0x4af9fb){var _0xf3b5e4=this;return new Promise(function(_0x2ec0e5,_0x37a90b){return db['SmsQueue'][_0x99d1('0x25')]({'raw':_0x4af9fb[_0x99d1('0x1d')]?_0x4af9fb[_0x99d1('0x1d')][_0x99d1('0x26')]===undefined?!![]:![]:!![],'where':_0x4af9fb['options']?_0x4af9fb[_0x99d1('0x1d')][_0x99d1('0x1e')]||null:null,'attributes':_0x4af9fb['options']?_0x4af9fb['options']['attributes']||null:null,'include':_0x4af9fb[_0x99d1('0x1d')]?_0x4af9fb['options']['include']?_[_0x99d1('0x22')](_0x4af9fb['options']['include'],function(_0x4c97be){return{'model':db[_0x4c97be[_0x99d1('0x23')]],'as':_0x4c97be['as'],'attributes':_0x4c97be[_0x99d1('0x1f')],'include':_0x4c97be[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x4c97be[_0x99d1('0x21')],function(_0x4d1960){return{'model':db[_0x4d1960['model']],'as':_0x4d1960['as'],'attributes':_0x4d1960[_0x99d1('0x1f')],'include':_0x4d1960[_0x99d1('0x21')]?_[_0x99d1('0x22')](_0x4d1960[_0x99d1('0x21')],function(_0x285520){return{'model':db[_0x285520['model']],'as':_0x285520['as'],'attributes':_0x285520[_0x99d1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ffe0c){logger['info'](_0x99d1('0x27'),_0x4af9fb);logger[_0x99d1('0x14')]('ShowSmsQueue',_0x4af9fb,JSON[_0x99d1('0x17')](_0x2ffe0c));_0x2ec0e5(_0x2ffe0c);})[_0x99d1('0x1b')](function(_0x471b7a){logger[_0x99d1('0x18')](_0x99d1('0x27'),_0x471b7a[_0x99d1('0x19')],_0x4af9fb);_0x37a90b(_0xf3b5e4['error'](0x1f4,_0x471b7a[_0x99d1('0x19')]));});});}; \ No newline at end of file +var _0xd9dc=['register','request','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueue,\x20%s,\x20%s','message','request\x20sent','catch','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','then','GetSmsQueue','find','where','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsQueue.socket'];(function(_0x4f5e67,_0x163a00){var _0xa8e9dc=function(_0x3f69ae){while(--_0x3f69ae){_0x4f5e67['push'](_0x4f5e67['shift']());}};_0xa8e9dc(++_0x163a00);}(_0xd9dc,0x1aa));var _0xcd9d=function(_0x317f85,_0x267263){_0x317f85=_0x317f85-0x0;var _0x594b2c=_0xd9dc[_0x317f85];return _0x594b2c;};'use strict';var _=require(_0xcd9d('0x0'));var util=require(_0xcd9d('0x1'));var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rs=require(_0xcd9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcd9d('0x5'));var logger=require(_0xcd9d('0x6'))(_0xcd9d('0x7'));var config=require(_0xcd9d('0x8'));var jayson=require(_0xcd9d('0x9'));var client=jayson['client'][_0xcd9d('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcd9d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd9d('0xc'))(new Redis(config[_0xcd9d('0xb')]));require(_0xcd9d('0xd'))[_0xcd9d('0xe')](socket);function respondWithRpcPromise(_0x470f06,_0x59564c,_0x4bbb1f){return new BPromise(function(_0x1eca63,_0x3ee32c){return client[_0xcd9d('0xf')](_0x470f06,_0x4bbb1f)['then'](function(_0x4fa74e){logger[_0xcd9d('0x10')]('SmsQueue,\x20%s,\x20%s',_0x59564c,'request\x20sent');logger[_0xcd9d('0x11')](_0xcd9d('0x12'),_0x59564c,'request\x20sent',JSON[_0xcd9d('0x13')](_0x4fa74e));if(_0x4fa74e['error']){if(_0x4fa74e['error'][_0xcd9d('0x14')]===0x1f4){logger[_0xcd9d('0x15')](_0xcd9d('0x16'),_0x59564c,_0x4fa74e[_0xcd9d('0x15')]['message']);return _0x3ee32c(_0x4fa74e[_0xcd9d('0x15')]['message']);}logger[_0xcd9d('0x15')](_0xcd9d('0x16'),_0x59564c,_0x4fa74e[_0xcd9d('0x15')][_0xcd9d('0x17')]);return _0x1eca63(_0x4fa74e[_0xcd9d('0x15')][_0xcd9d('0x17')]);}else{logger['info'](_0xcd9d('0x16'),_0x59564c,_0xcd9d('0x18'));_0x1eca63(_0x4fa74e['result'][_0xcd9d('0x17')]);}})[_0xcd9d('0x19')](function(_0x48e0b3){logger[_0xcd9d('0x15')](_0xcd9d('0x16'),_0x59564c,_0x48e0b3);_0x3ee32c(_0x48e0b3);});});}exports['GetSmsQueue']=function(_0x2756cd){var _0x483dc2=this;return new Promise(function(_0x2b92c2,_0x5f02b8){return db[_0xcd9d('0x1a')][_0xcd9d('0x1b')]({'raw':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x1d')]===undefined?!![]:![]:!![],'where':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd['options']['where']||null:null,'attributes':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x1e')]||null:null,'limit':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x1f')]||null:null,'include':_0x2756cd[_0xcd9d('0x1c')]?_0x2756cd[_0xcd9d('0x1c')][_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0x2756cd[_0xcd9d('0x1c')]['include'],function(_0x2d8d7a){return{'model':db[_0x2d8d7a[_0xcd9d('0x22')]],'as':_0x2d8d7a['as'],'attributes':_0x2d8d7a[_0xcd9d('0x1e')],'include':_0x2d8d7a[_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0x2d8d7a['include'],function(_0x7f80de){return{'model':db[_0x7f80de[_0xcd9d('0x22')]],'as':_0x7f80de['as'],'attributes':_0x7f80de[_0xcd9d('0x1e')],'include':_0x7f80de[_0xcd9d('0x20')]?_['map'](_0x7f80de[_0xcd9d('0x20')],function(_0xb94f5a){return{'model':db[_0xb94f5a[_0xcd9d('0x22')]],'as':_0xb94f5a['as'],'attributes':_0xb94f5a[_0xcd9d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcd9d('0x23')](function(_0x2cc32e){logger[_0xcd9d('0x10')](_0xcd9d('0x24'),_0x2756cd);logger[_0xcd9d('0x11')](_0xcd9d('0x24'),_0x2756cd,JSON[_0xcd9d('0x13')](_0x2cc32e));_0x2b92c2(_0x2cc32e);})[_0xcd9d('0x19')](function(_0x4178bf){logger[_0xcd9d('0x15')](_0xcd9d('0x24'),_0x4178bf[_0xcd9d('0x17')],_0x2756cd);_0x5f02b8(_0x483dc2['error'](0x1f4,_0x4178bf[_0xcd9d('0x17')]));});});};exports['ShowSmsQueue']=function(_0x578522){var _0x10070a=this;return new Promise(function(_0x5cec80,_0xe3e39c){return db[_0xcd9d('0x1a')][_0xcd9d('0x25')]({'raw':_0x578522[_0xcd9d('0x1c')]?_0x578522['options'][_0xcd9d('0x1d')]===undefined?!![]:![]:!![],'where':_0x578522['options']?_0x578522[_0xcd9d('0x1c')][_0xcd9d('0x26')]||null:null,'attributes':_0x578522['options']?_0x578522['options'][_0xcd9d('0x1e')]||null:null,'include':_0x578522['options']?_0x578522[_0xcd9d('0x1c')][_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0x578522['options']['include'],function(_0xfe6648){return{'model':db[_0xfe6648['model']],'as':_0xfe6648['as'],'attributes':_0xfe6648[_0xcd9d('0x1e')],'include':_0xfe6648[_0xcd9d('0x20')]?_[_0xcd9d('0x21')](_0xfe6648['include'],function(_0x5eea28){return{'model':db[_0x5eea28[_0xcd9d('0x22')]],'as':_0x5eea28['as'],'attributes':_0x5eea28[_0xcd9d('0x1e')],'include':_0x5eea28[_0xcd9d('0x20')]?_['map'](_0x5eea28[_0xcd9d('0x20')],function(_0x5be98f){return{'model':db[_0x5be98f[_0xcd9d('0x22')]],'as':_0x5be98f['as'],'attributes':_0x5be98f[_0xcd9d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcd9d('0x23')](function(_0x340bc9){logger['info'](_0xcd9d('0x27'),_0x578522);logger['debug'](_0xcd9d('0x27'),_0x578522,JSON['stringify'](_0x340bc9));_0x5cec80(_0x340bc9);})[_0xcd9d('0x19')](function(_0x530b49){logger[_0xcd9d('0x15')]('ShowSmsQueue',_0x530b49[_0xcd9d('0x17')],_0x578522);_0xe3e39c(_0x10070a[_0xcd9d('0x15')](0x1f4,_0x530b49['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7102c42..35e2bb5 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 _0x8226=['smsQueue:','./smsQueue.events','save','update','emit','removeListener','length'];(function(_0x5700ed,_0x3b72f9){var _0x2a60bf=function(_0x6694f2){while(--_0x6694f2){_0x5700ed['push'](_0x5700ed['shift']());}};_0x2a60bf(++_0x3b72f9);}(_0x8226,0xbe));var _0x6822=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0x8226[_0x150bff];return _0x296f9a;};'use strict';var SmsQueueEvents=require(_0x6822('0x0'));var events=[_0x6822('0x1'),'remove',_0x6822('0x2')];function createListener(_0x6ab579,_0x2001b1){return function(_0xc09c7b){_0x2001b1[_0x6822('0x3')](_0x6ab579,_0xc09c7b);};}function removeListener(_0x52bf21,_0x4cd34e){return function(){SmsQueueEvents[_0x6822('0x4')](_0x52bf21,_0x4cd34e);};}exports['register']=function(_0x1a8c97){for(var _0x3070f0=0x0,_0x5c7cf5=events[_0x6822('0x5')];_0x3070f0<_0x5c7cf5;_0x3070f0++){var _0x503c56=events[_0x3070f0];var _0x605236=createListener(_0x6822('0x6')+_0x503c56,_0x1a8c97);SmsQueueEvents['on'](_0x503c56,_0x605236);}}; \ No newline at end of file +var _0x37a4=['removeListener','length','smsQueue:','save','update','emit'];(function(_0x23257e,_0x108e5b){var _0x41199a=function(_0x11464b){while(--_0x11464b){_0x23257e['push'](_0x23257e['shift']());}};_0x41199a(++_0x108e5b);}(_0x37a4,0x1dd));var _0x437a=function(_0x379ad8,_0x13c7e3){_0x379ad8=_0x379ad8-0x0;var _0x11a862=_0x37a4[_0x379ad8];return _0x11a862;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x437a('0x0'),'remove',_0x437a('0x1')];function createListener(_0x47b4de,_0x1afddc){return function(_0x5828ed){_0x1afddc[_0x437a('0x2')](_0x47b4de,_0x5828ed);};}function removeListener(_0x452d46,_0x29526b){return function(){SmsQueueEvents[_0x437a('0x3')](_0x452d46,_0x29526b);};}exports['register']=function(_0x23d365){for(var _0x7b4b34=0x0,_0xe77051=events[_0x437a('0x4')];_0x7b4b34<_0xe77051;_0x7b4b34++){var _0x5de36f=events[_0x7b4b34];var _0x5a6155=createListener(_0x437a('0x5')+_0x5de36f,_0x23d365);SmsQueueEvents['on'](_0x5de36f,_0x5a6155);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b62109e..edded98 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 _0x6d41=['update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x237e11,_0x2cb7e5){var _0xa0bf6b=function(_0x5c783e){while(--_0x5c783e){_0x237e11['push'](_0x237e11['shift']());}};_0xa0bf6b(++_0x2cb7e5);}(_0x6d41,0x7b));var _0x16d4=function(_0x12a535,_0x2ec3d3){_0x12a535=_0x12a535-0x0;var _0x2677b4=_0x6d41[_0x12a535];return _0x2677b4;};'use strict';var multer=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var path=require('path');var timeout=require(_0x16d4('0x2'));var express=require(_0x16d4('0x3'));var router=express['Router']();var auth=require(_0x16d4('0x4'));var interaction=require(_0x16d4('0x5'));var config=require(_0x16d4('0x6'));var controller=require(_0x16d4('0x7'));router[_0x16d4('0x8')]('/',auth['isAuthenticated'](),controller[_0x16d4('0x9')]);router[_0x16d4('0x8')](_0x16d4('0xa'),auth[_0x16d4('0xb')](),controller[_0x16d4('0xc')]);router['get'](_0x16d4('0xd'),auth['isAuthenticated'](),controller[_0x16d4('0xe')]);router['post']('/',auth[_0x16d4('0xb')](),controller[_0x16d4('0xf')]);router[_0x16d4('0x10')]('/:id',auth[_0x16d4('0xb')](),controller[_0x16d4('0x11')]);router[_0x16d4('0x12')](_0x16d4('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x16d4('0x13')]=router; \ No newline at end of file +var _0x7789=['get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x515dad,_0x453976){var _0x12f992=function(_0x2235de){while(--_0x2235de){_0x515dad['push'](_0x515dad['shift']());}};_0x12f992(++_0x453976);}(_0x7789,0x161));var _0x9778=function(_0x436b9e,_0x335d1b){_0x436b9e=_0x436b9e-0x0;var _0x46aa4a=_0x7789[_0x436b9e];return _0x46aa4a;};'use strict';var multer=require(_0x9778('0x0'));var util=require(_0x9778('0x1'));var path=require(_0x9778('0x2'));var timeout=require(_0x9778('0x3'));var express=require(_0x9778('0x4'));var router=express['Router']();var auth=require(_0x9778('0x5'));var interaction=require(_0x9778('0x6'));var config=require(_0x9778('0x7'));var controller=require('./smsQueueReport.controller');router[_0x9778('0x8')]('/',auth[_0x9778('0x9')](),controller['index']);router[_0x9778('0x8')](_0x9778('0xa'),auth['isAuthenticated'](),controller[_0x9778('0xb')]);router['get'](_0x9778('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9778('0xd')]('/',auth[_0x9778('0x9')](),controller['create']);router[_0x9778('0xe')](_0x9778('0xc'),auth[_0x9778('0x9')](),controller[_0x9778('0xf')]);router[_0x9778('0x10')](_0x9778('0xc'),auth[_0x9778('0x9')](),controller[_0x9778('0x11')]);module[_0x9778('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ca3a89a..4bc2e60 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 _0x01fb=['sequelize','DATE','STRING','moment'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x01fb,0x17f));var _0xb01f=function(_0x5a0e57,_0x2cd966){_0x5a0e57=_0x5a0e57-0x0;var _0xf8a6a1=_0x01fb[_0x5a0e57];return _0xf8a6a1;};'use strict';var moment=require(_0xb01f('0x0'));var Sequelize=require(_0xb01f('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb01f('0x2')]},'leaveAt':{'type':Sequelize[_0xb01f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb01f('0x2')]},'reason':{'type':Sequelize[_0xb01f('0x3')]}}; \ No newline at end of file +var _0x505f=['moment','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x505f,0xc3));var _0xf505=function(_0xd4b1a0,_0x51247e){_0xd4b1a0=_0xd4b1a0-0x0;var _0x25b461=_0x505f[_0xd4b1a0];return _0x25b461;};'use strict';var moment=require(_0xf505('0x0'));var Sequelize=require(_0xf505('0x1'));module[_0xf505('0x2')]={'uniqueid':{'type':Sequelize[_0xf505('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf505('0x3')]},'joinAt':{'type':Sequelize[_0xf505('0x4')]},'leaveAt':{'type':Sequelize[_0xf505('0x4')]},'acceptAt':{'type':Sequelize[_0xf505('0x4')]},'exitAt':{'type':Sequelize[_0xf505('0x4')]},'reason':{'type':Sequelize[_0xf505('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e549748..4c49c45 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 _0x6f94=['json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4b4e8f,_0x3ab560){var _0x347232=function(_0xc04d11){while(--_0xc04d11){_0x4b4e8f['push'](_0x4b4e8f['shift']());}};_0x347232(++_0x3ab560);}(_0x6f94,0x198));var _0x46f9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x6f94[_0x1b6186];return _0x186121;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x46f9('0x0'));var rimraf=require(_0x46f9('0x1'));var zipdir=require(_0x46f9('0x2'));var jsonpatch=require(_0x46f9('0x3'));var rp=require('request-promise');var moment=require(_0x46f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46f9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x46f9('0x6'));var csv=require(_0x46f9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x46f9('0x8'));var jsforce=require(_0x46f9('0x9'));var deskjs=require(_0x46f9('0xa'));var toCsv=require(_0x46f9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46f9('0xb'));var authService=require(_0x46f9('0xc'));var qs=require(_0x46f9('0xd'));var as=require(_0x46f9('0xe'));var hardwareService=require(_0x46f9('0xf'));var logger=require(_0x46f9('0x10'))(_0x46f9('0x11'));var utils=require(_0x46f9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x46f9('0x13'));var db=require(_0x46f9('0x14'))['db'];function respondWithStatusCode(_0x5a5cec,_0x200df8){_0x200df8=_0x200df8||0xcc;return function(_0xe48ef7){if(_0xe48ef7){return _0x5a5cec[_0x46f9('0x15')](_0x200df8);}return _0x5a5cec[_0x46f9('0x16')](_0x200df8)[_0x46f9('0x17')]();};}function respondWithResult(_0x4c02c3,_0x3101c8){_0x3101c8=_0x3101c8||0xc8;return function(_0x4bc594){if(_0x4bc594){return _0x4c02c3[_0x46f9('0x16')](_0x3101c8)[_0x46f9('0x18')](_0x4bc594);}};}function respondWithFilteredResult(_0x45a6e6,_0x595790){return function(_0x241425){if(_0x241425){var _0xba4de7=_0x241425[_0x46f9('0x19')],_0x1552fe=_0x595790[_0x46f9('0x1a')],_0x4b8993=_0x595790[_0x46f9('0x1a')]+_0x595790[_0x46f9('0x1b')],_0x485500;if(_0x4b8993>=_0xba4de7){_0x4b8993=_0xba4de7;_0x485500=0xc8;}else{_0x485500=0xce;}_0x45a6e6[_0x46f9('0x16')](_0x485500);return _0x45a6e6[_0x46f9('0x1c')](_0x46f9('0x1d'),_0x1552fe+'-'+_0x4b8993+'/'+_0xba4de7)[_0x46f9('0x18')](_0x241425);}return null;};}function patchUpdates(_0x420f0d){return function(_0x492906){try{jsonpatch[_0x46f9('0x1e')](_0x492906,_0x420f0d,!![]);}catch(_0x1f1ecf){return BPromise[_0x46f9('0x1f')](_0x1f1ecf);}return _0x492906['save']();};}function saveUpdates(_0x417169,_0xf90a93){return function(_0x220097){if(_0x220097){return _0x220097[_0x46f9('0x20')](_0x417169)['then'](function(_0x569b89){return _0x569b89;});}return null;};}function removeEntity(_0x530ae9,_0x28911f){return function(_0x41af01){if(_0x41af01){return _0x41af01[_0x46f9('0x21')]()[_0x46f9('0x22')](function(){_0x530ae9[_0x46f9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da8be,_0x3a301e){return function(_0x2da87a){if(!_0x2da87a){_0x3da8be[_0x46f9('0x15')](0x194);}return _0x2da87a;};}function handleError(_0x6a535e,_0x430b49){_0x430b49=_0x430b49||0x1f4;return function(_0x3e2190){logger['error'](_0x3e2190[_0x46f9('0x23')]);if(_0x3e2190[_0x46f9('0x24')]){delete _0x3e2190[_0x46f9('0x24')];}_0x6a535e['status'](_0x430b49)[_0x46f9('0x25')](_0x3e2190);};}exports[_0x46f9('0x26')]=function(_0x5631b3,_0x5b4952){var _0x255199={},_0x390b89={},_0x28a635={'count':0x0,'rows':[]};var _0x1ace61=_[_0x46f9('0x27')](db[_0x46f9('0x28')][_0x46f9('0x29')],function(_0x13ff4c){return{'name':_0x13ff4c[_0x46f9('0x2a')],'type':_0x13ff4c[_0x46f9('0x2b')][_0x46f9('0x2c')]};});_0x390b89[_0x46f9('0x2d')]=_['map'](_0x1ace61,_0x46f9('0x24'));_0x390b89[_0x46f9('0x2e')]=_[_0x46f9('0x2f')](_0x5631b3[_0x46f9('0x2e')]);_0x390b89[_0x46f9('0x30')]=_[_0x46f9('0x31')](_0x390b89['model'],_0x390b89['query']);_0x255199[_0x46f9('0x32')]=_[_0x46f9('0x31')](_0x390b89[_0x46f9('0x2d')],qs['fields'](_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x33')]));_0x255199['attributes']=_0x255199[_0x46f9('0x32')][_0x46f9('0x34')]?_0x255199[_0x46f9('0x32')]:_0x390b89[_0x46f9('0x2d')];if(!_0x5631b3['query']['hasOwnProperty'](_0x46f9('0x35'))){_0x255199[_0x46f9('0x1b')]=qs[_0x46f9('0x1b')](_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x1b')]);_0x255199[_0x46f9('0x1a')]=qs[_0x46f9('0x1a')](_0x5631b3['query'][_0x46f9('0x1a')]);}_0x255199[_0x46f9('0x36')]=qs['sort'](_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x37')]);_0x255199['where']=qs[_0x46f9('0x30')](_[_0x46f9('0x38')](_0x5631b3[_0x46f9('0x2e')],_0x390b89[_0x46f9('0x30')]),_0x1ace61);if(_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x39')]){_0x255199[_0x46f9('0x3a')]=_[_0x46f9('0x3b')](_0x255199[_0x46f9('0x3a')],{'$or':_[_0x46f9('0x27')](_0x1ace61,function(_0x5c2d85){if(_0x5c2d85[_0x46f9('0x2b')]!==_0x46f9('0x3c')){var _0x291816={};_0x291816[_0x5c2d85[_0x46f9('0x24')]]={'$like':'%'+_0x5631b3[_0x46f9('0x2e')][_0x46f9('0x39')]+'%'};return _0x291816;}})});}_0x255199=_[_0x46f9('0x3b')]({},_0x255199,_0x5631b3[_0x46f9('0x3d')]);var _0x13e521={'where':_0x255199['where']};return db[_0x46f9('0x28')][_0x46f9('0x19')](_0x13e521)[_0x46f9('0x22')](function(_0xe97461){_0x28a635['count']=_0xe97461;if(_0x5631b3['query'][_0x46f9('0x3e')]){_0x255199[_0x46f9('0x3f')]=[{'all':!![]}];}return db[_0x46f9('0x28')][_0x46f9('0x40')](_0x255199);})[_0x46f9('0x22')](function(_0xc2f36d){_0x28a635['rows']=_0xc2f36d;return _0x28a635;})['then'](respondWithFilteredResult(_0x5b4952,_0x255199))[_0x46f9('0x41')](handleError(_0x5b4952,null));};exports[_0x46f9('0x42')]=function(_0x353739,_0x3b438f){var _0x3af0c7={'raw':!![],'where':{'id':_0x353739[_0x46f9('0x43')]['id']}},_0x4952fd={};_0x4952fd[_0x46f9('0x2d')]=_['keys'](db[_0x46f9('0x28')][_0x46f9('0x29')]);_0x4952fd[_0x46f9('0x2e')]=_[_0x46f9('0x2f')](_0x353739['query']);_0x4952fd[_0x46f9('0x30')]=_['intersection'](_0x4952fd[_0x46f9('0x2d')],_0x4952fd[_0x46f9('0x2e')]);_0x3af0c7[_0x46f9('0x32')]=_['intersection'](_0x4952fd[_0x46f9('0x2d')],qs[_0x46f9('0x33')](_0x353739[_0x46f9('0x2e')]['fields']));_0x3af0c7[_0x46f9('0x32')]=_0x3af0c7[_0x46f9('0x32')][_0x46f9('0x34')]?_0x3af0c7['attributes']:_0x4952fd[_0x46f9('0x2d')];if(_0x353739['query'][_0x46f9('0x3e')]){_0x3af0c7[_0x46f9('0x3f')]=[{'all':!![]}];}_0x3af0c7=_[_0x46f9('0x3b')]({},_0x3af0c7,_0x353739[_0x46f9('0x3d')]);return db[_0x46f9('0x28')][_0x46f9('0x44')](_0x3af0c7)[_0x46f9('0x22')](handleEntityNotFound(_0x3b438f,null))['then'](respondWithResult(_0x3b438f,null))['catch'](handleError(_0x3b438f,null));};exports[_0x46f9('0x45')]=function(_0x28c06e,_0x448b88){return db[_0x46f9('0x28')][_0x46f9('0x45')](_0x28c06e[_0x46f9('0x46')],{})[_0x46f9('0x22')](respondWithResult(_0x448b88,0xc9))[_0x46f9('0x41')](handleError(_0x448b88,null));};exports[_0x46f9('0x20')]=function(_0x2390f7,_0x207ca4){if(_0x2390f7[_0x46f9('0x46')]['id']){delete _0x2390f7[_0x46f9('0x46')]['id'];}return db[_0x46f9('0x28')][_0x46f9('0x44')]({'where':{'id':_0x2390f7[_0x46f9('0x43')]['id']}})[_0x46f9('0x22')](handleEntityNotFound(_0x207ca4,null))['then'](saveUpdates(_0x2390f7[_0x46f9('0x46')],null))[_0x46f9('0x22')](respondWithResult(_0x207ca4,null))[_0x46f9('0x41')](handleError(_0x207ca4,null));};exports[_0x46f9('0x21')]=function(_0x1d38d8,_0x31b5b5){return db['SmsQueueReport'][_0x46f9('0x44')]({'where':{'id':_0x1d38d8[_0x46f9('0x43')]['id']}})[_0x46f9('0x22')](handleEntityNotFound(_0x31b5b5,null))[_0x46f9('0x22')](removeEntity(_0x31b5b5,null))[_0x46f9('0x41')](handleError(_0x31b5b5,null));};exports[_0x46f9('0x47')]=function(_0x147600,_0x2a5149){return db['SmsQueueReport'][_0x46f9('0x47')]()[_0x46f9('0x22')](respondWithResult(_0x2a5149,null))[_0x46f9('0x41')](handleError(_0x2a5149,null));}; \ No newline at end of file +var _0x860d=['then','sendStatus','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','rows','catch','params','rawAttributes','length','includeAll','merge','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update'];(function(_0x22b61f,_0x5886c8){var _0x55e512=function(_0x20009f){while(--_0x20009f){_0x22b61f['push'](_0x22b61f['shift']());}};_0x55e512(++_0x5886c8);}(_0x860d,0xff));var _0xd860=function(_0x5e8b46,_0x21eb4a){_0x5e8b46=_0x5e8b46-0x0;var _0x252814=_0x860d[_0x5e8b46];return _0x252814;};'use strict';var pdf=require(_0xd860('0x0'));var emlformat=require(_0xd860('0x1'));var rimraf=require(_0xd860('0x2'));var zipdir=require(_0xd860('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd860('0x4'));var BPromise=require(_0xd860('0x5'));var Mustache=require(_0xd860('0x6'));var util=require('util');var path=require(_0xd860('0x7'));var sox=require(_0xd860('0x8'));var csv=require(_0xd860('0x9'));var ejs=require(_0xd860('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd860('0xb'));var jsforce=require(_0xd860('0xc'));var deskjs=require(_0xd860('0xd'));var toCsv=require(_0xd860('0x9'));var querystring=require(_0xd860('0xe'));var Papa=require('papaparse');var Redis=require(_0xd860('0xf'));var authService=require(_0xd860('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd860('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd860('0x12'))('api');var utils=require(_0xd860('0x13'));var config=require(_0xd860('0x14'));var licenseUtil=require(_0xd860('0x15'));var db=require(_0xd860('0x16'))['db'];function respondWithStatusCode(_0xf4d6c5,_0x432d5c){_0x432d5c=_0x432d5c||0xcc;return function(_0x3bbabf){if(_0x3bbabf){return _0xf4d6c5['sendStatus'](_0x432d5c);}return _0xf4d6c5[_0xd860('0x17')](_0x432d5c)['end']();};}function respondWithResult(_0xd11c28,_0x3df8f8){_0x3df8f8=_0x3df8f8||0xc8;return function(_0x1cee5c){if(_0x1cee5c){return _0xd11c28['status'](_0x3df8f8)[_0xd860('0x18')](_0x1cee5c);}};}function respondWithFilteredResult(_0x37e4f0,_0x1b8334){return function(_0xabe8fd){if(_0xabe8fd){var _0x8303ef=_0xabe8fd[_0xd860('0x19')],_0x2bfe0d=_0x1b8334[_0xd860('0x1a')],_0x5c333c=_0x1b8334['offset']+_0x1b8334[_0xd860('0x1b')],_0x2fdeb4;if(_0x5c333c>=_0x8303ef){_0x5c333c=_0x8303ef;_0x2fdeb4=0xc8;}else{_0x2fdeb4=0xce;}_0x37e4f0[_0xd860('0x17')](_0x2fdeb4);return _0x37e4f0[_0xd860('0x1c')]('Content-Range',_0x2bfe0d+'-'+_0x5c333c+'/'+_0x8303ef)[_0xd860('0x18')](_0xabe8fd);}return null;};}function patchUpdates(_0x50a1ef){return function(_0x50a8f2){try{jsonpatch[_0xd860('0x1d')](_0x50a8f2,_0x50a1ef,!![]);}catch(_0x5916dd){return BPromise[_0xd860('0x1e')](_0x5916dd);}return _0x50a8f2[_0xd860('0x1f')]();};}function saveUpdates(_0x372fa4,_0x3e65b4){return function(_0x53bd59){if(_0x53bd59){return _0x53bd59[_0xd860('0x20')](_0x372fa4)[_0xd860('0x21')](function(_0x3d9a0e){return _0x3d9a0e;});}return null;};}function removeEntity(_0x5e82e3,_0x34ce00){return function(_0x145136){if(_0x145136){return _0x145136['destroy']()['then'](function(){_0x5e82e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b800,_0x35ad19){return function(_0x5ec818){if(!_0x5ec818){_0x44b800[_0xd860('0x22')](0x194);}return _0x5ec818;};}function handleError(_0x37000f,_0xe6c280){_0xe6c280=_0xe6c280||0x1f4;return function(_0x330660){logger[_0xd860('0x23')](_0x330660[_0xd860('0x24')]);if(_0x330660[_0xd860('0x25')]){delete _0x330660[_0xd860('0x25')];}_0x37000f[_0xd860('0x17')](_0xe6c280)[_0xd860('0x26')](_0x330660);};}exports[_0xd860('0x27')]=function(_0x3650d9,_0x30fc95){var _0x3a054f={},_0x216661={},_0x383bdf={'count':0x0,'rows':[]};var _0x528f4c=_[_0xd860('0x28')](db[_0xd860('0x29')]['rawAttributes'],function(_0x4bc401){return{'name':_0x4bc401[_0xd860('0x2a')],'type':_0x4bc401[_0xd860('0x2b')]['key']};});_0x216661[_0xd860('0x2c')]=_[_0xd860('0x28')](_0x528f4c,_0xd860('0x25'));_0x216661[_0xd860('0x2d')]=_[_0xd860('0x2e')](_0x3650d9[_0xd860('0x2d')]);_0x216661['filters']=_[_0xd860('0x2f')](_0x216661[_0xd860('0x2c')],_0x216661[_0xd860('0x2d')]);_0x3a054f[_0xd860('0x30')]=_[_0xd860('0x2f')](_0x216661[_0xd860('0x2c')],qs[_0xd860('0x31')](_0x3650d9[_0xd860('0x2d')][_0xd860('0x31')]));_0x3a054f[_0xd860('0x30')]=_0x3a054f[_0xd860('0x30')]['length']?_0x3a054f['attributes']:_0x216661[_0xd860('0x2c')];if(!_0x3650d9[_0xd860('0x2d')][_0xd860('0x32')](_0xd860('0x33'))){_0x3a054f[_0xd860('0x1b')]=qs[_0xd860('0x1b')](_0x3650d9[_0xd860('0x2d')]['limit']);_0x3a054f[_0xd860('0x1a')]=qs[_0xd860('0x1a')](_0x3650d9['query'][_0xd860('0x1a')]);}_0x3a054f[_0xd860('0x34')]=qs[_0xd860('0x35')](_0x3650d9[_0xd860('0x2d')][_0xd860('0x35')]);_0x3a054f[_0xd860('0x36')]=qs[_0xd860('0x37')](_[_0xd860('0x38')](_0x3650d9['query'],_0x216661[_0xd860('0x37')]),_0x528f4c);if(_0x3650d9[_0xd860('0x2d')][_0xd860('0x39')]){_0x3a054f[_0xd860('0x36')]=_['merge'](_0x3a054f['where'],{'$or':_[_0xd860('0x28')](_0x528f4c,function(_0x518cda){if(_0x518cda[_0xd860('0x2b')]!==_0xd860('0x3a')){var _0x168b81={};_0x168b81[_0x518cda['name']]={'$like':'%'+_0x3650d9['query'][_0xd860('0x39')]+'%'};return _0x168b81;}})});}_0x3a054f=_['merge']({},_0x3a054f,_0x3650d9[_0xd860('0x3b')]);var _0x3ddc36={'where':_0x3a054f['where']};return db[_0xd860('0x29')]['count'](_0x3ddc36)['then'](function(_0x3c2565){_0x383bdf[_0xd860('0x19')]=_0x3c2565;if(_0x3650d9[_0xd860('0x2d')]['includeAll']){_0x3a054f[_0xd860('0x3c')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x3a054f);})['then'](function(_0x4e84de){_0x383bdf[_0xd860('0x3d')]=_0x4e84de;return _0x383bdf;})['then'](respondWithFilteredResult(_0x30fc95,_0x3a054f))[_0xd860('0x3e')](handleError(_0x30fc95,null));};exports['show']=function(_0x571668,_0x1433b3){var _0x29876b={'raw':!![],'where':{'id':_0x571668[_0xd860('0x3f')]['id']}},_0x1ea65a={};_0x1ea65a[_0xd860('0x2c')]=_[_0xd860('0x2e')](db[_0xd860('0x29')][_0xd860('0x40')]);_0x1ea65a['query']=_[_0xd860('0x2e')](_0x571668[_0xd860('0x2d')]);_0x1ea65a[_0xd860('0x37')]=_[_0xd860('0x2f')](_0x1ea65a[_0xd860('0x2c')],_0x1ea65a[_0xd860('0x2d')]);_0x29876b[_0xd860('0x30')]=_['intersection'](_0x1ea65a['model'],qs[_0xd860('0x31')](_0x571668[_0xd860('0x2d')][_0xd860('0x31')]));_0x29876b[_0xd860('0x30')]=_0x29876b['attributes'][_0xd860('0x41')]?_0x29876b['attributes']:_0x1ea65a[_0xd860('0x2c')];if(_0x571668['query'][_0xd860('0x42')]){_0x29876b['include']=[{'all':!![]}];}_0x29876b=_[_0xd860('0x43')]({},_0x29876b,_0x571668[_0xd860('0x3b')]);return db[_0xd860('0x29')][_0xd860('0x44')](_0x29876b)[_0xd860('0x21')](handleEntityNotFound(_0x1433b3,null))[_0xd860('0x21')](respondWithResult(_0x1433b3,null))['catch'](handleError(_0x1433b3,null));};exports[_0xd860('0x45')]=function(_0x15af27,_0x1347b0){return db[_0xd860('0x29')]['create'](_0x15af27['body'],{})[_0xd860('0x21')](respondWithResult(_0x1347b0,0xc9))[_0xd860('0x3e')](handleError(_0x1347b0,null));};exports['update']=function(_0x32402c,_0x5e9590){if(_0x32402c[_0xd860('0x46')]['id']){delete _0x32402c[_0xd860('0x46')]['id'];}return db['SmsQueueReport'][_0xd860('0x44')]({'where':{'id':_0x32402c['params']['id']}})[_0xd860('0x21')](handleEntityNotFound(_0x5e9590,null))[_0xd860('0x21')](saveUpdates(_0x32402c[_0xd860('0x46')],null))[_0xd860('0x21')](respondWithResult(_0x5e9590,null))['catch'](handleError(_0x5e9590,null));};exports[_0xd860('0x47')]=function(_0x5c153a,_0x2a4a8c){return db[_0xd860('0x29')]['find']({'where':{'id':_0x5c153a['params']['id']}})[_0xd860('0x21')](handleEntityNotFound(_0x2a4a8c,null))[_0xd860('0x21')](removeEntity(_0x2a4a8c,null))[_0xd860('0x3e')](handleError(_0x2a4a8c,null));};exports['describe']=function(_0x217f0b,_0x59915c){return db[_0xd860('0x29')]['describe']()[_0xd860('0x21')](respondWithResult(_0x59915c,null))['catch'](handleError(_0x59915c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e70eb29..9474c61 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 _0xb821=['report_sms_queue','uniqueid','util','../../config/logger','bluebird','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport'];(function(_0x53821e,_0x31f58d){var _0x40cc4d=function(_0x17bdee){while(--_0x17bdee){_0x53821e['push'](_0x53821e['shift']());}};_0x40cc4d(++_0x31f58d);}(_0xb821,0xa7));var _0x1b82=function(_0x3bc111,_0x137248){_0x3bc111=_0x3bc111-0x0;var _0x3431d1=_0xb821[_0x3bc111];return _0x3431d1;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[{'name':_0x1b82('0xa'),'fields':[_0x1b82('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe739=['moment','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid','lodash','../../config/logger','api'];(function(_0x2d28cf,_0xbc4f5f){var _0x486821=function(_0x3ce6f0){while(--_0x3ce6f0){_0x2d28cf['push'](_0x2d28cf['shift']());}};_0x486821(++_0xbc4f5f);}(_0xe739,0x105));var _0x9e73=function(_0x313133,_0x39f2e5){_0x313133=_0x313133-0x0;var _0x68f3bb=_0xe739[_0x313133];return _0x68f3bb;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var attributes=require(_0x9e73('0x6'));module[_0x9e73('0x7')]=function(_0x4cb2ed,_0x3db8fa){return _0x4cb2ed[_0x9e73('0x8')](_0x9e73('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x9e73('0xa'),'fields':[_0x9e73('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 555a111..08dfb9f 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 _0xe203=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','message','SmsQueueReport,\x20%s,\x20%s','info','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','where','limit','lodash','util','moment'];(function(_0x5091c0,_0x10cab3){var _0x2d065f=function(_0x16b026){while(--_0x16b026){_0x5091c0['push'](_0x5091c0['shift']());}};_0x2d065f(++_0x10cab3);}(_0xe203,0x1a1));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e20('0x0'));var util=require(_0x3e20('0x1'));var moment=require(_0x3e20('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e20('0x4'));var logger=require(_0x3e20('0x5'))(_0x3e20('0x6'));var config=require(_0x3e20('0x7'));var jayson=require(_0x3e20('0x8'));var client=jayson[_0x3e20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174a07,_0x185ed3,_0x331d44){return new BPromise(function(_0x20717d,_0x59dd42){return client[_0x3e20('0xa')](_0x174a07,_0x331d44)[_0x3e20('0xb')](function(_0x4209c0){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x185ed3,_0x3e20('0xc'));logger[_0x3e20('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x185ed3,_0x3e20('0xc'),JSON['stringify'](_0x4209c0));if(_0x4209c0['error']){if(_0x4209c0[_0x3e20('0xe')][_0x3e20('0xf')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x185ed3,_0x4209c0['error'][_0x3e20('0x10')]);return _0x59dd42(_0x4209c0[_0x3e20('0xe')][_0x3e20('0x10')]);}logger['error'](_0x3e20('0x11'),_0x185ed3,_0x4209c0[_0x3e20('0xe')][_0x3e20('0x10')]);return _0x20717d(_0x4209c0['error']['message']);}else{logger[_0x3e20('0x12')](_0x3e20('0x11'),_0x185ed3,'request\x20sent');_0x20717d(_0x4209c0['result'][_0x3e20('0x10')]);}})['catch'](function(_0x30fb6d){logger[_0x3e20('0xe')](_0x3e20('0x11'),_0x185ed3,_0x30fb6d);_0x59dd42(_0x30fb6d);});});}exports[_0x3e20('0x13')]=function(_0x3e8c90){var _0x2afb1d=this;return new Promise(function(_0x461521,_0x5bffac){return db[_0x3e20('0x14')][_0x3e20('0x15')](_0x3e8c90[_0x3e20('0x16')],{'raw':_0x3e8c90[_0x3e20('0x17')]?_0x3e8c90['options'][_0x3e20('0x18')]===undefined?!![]:![]:!![]})[_0x3e20('0xb')](function(_0x35d0c2){logger['info'](_0x3e20('0x13'),_0x3e8c90);logger[_0x3e20('0xd')](_0x3e20('0x13'),_0x3e8c90,JSON[_0x3e20('0x19')](_0x35d0c2));_0x461521(_0x35d0c2);})['catch'](function(_0x31422f){logger[_0x3e20('0xe')](_0x3e20('0x13'),_0x31422f[_0x3e20('0x10')],_0x3e8c90);_0x5bffac(_0x2afb1d['error'](0x1f4,_0x31422f[_0x3e20('0x10')]));});});};exports[_0x3e20('0x1a')]=function(_0x1b8f1e){var _0x5e48c9=this;return new Promise(function(_0x13b92d,_0x23f117){return db[_0x3e20('0x14')][_0x3e20('0x1b')](_0x1b8f1e[_0x3e20('0x16')],{'raw':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e[_0x3e20('0x17')][_0x3e20('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e['options'][_0x3e20('0x1c')]||null:null,'attributes':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e[_0x3e20('0x17')]['attributes']||null:null,'limit':_0x1b8f1e[_0x3e20('0x17')]?_0x1b8f1e['options'][_0x3e20('0x1d')]||null:null})[_0x3e20('0xb')](function(_0x56844a){logger[_0x3e20('0x12')]('UpdateSmsQueueReport',_0x1b8f1e);logger[_0x3e20('0xd')](_0x3e20('0x1a'),_0x1b8f1e,JSON[_0x3e20('0x19')](_0x56844a));_0x13b92d(_0x56844a);})['catch'](function(_0x2b538f){logger[_0x3e20('0xe')]('UpdateSmsQueueReport',_0x2b538f['message'],_0x1b8f1e);_0x23f117(_0x5e48c9[_0x3e20('0xe')](0x1f4,_0x2b538f[_0x3e20('0x10')]));});});}; \ No newline at end of file +var _0x7515=['update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','create','body','options','raw','info','UpdateSmsQueueReport','SmsQueueReport'];(function(_0x4ae683,_0x343b9e){var _0x537532=function(_0x62eded){while(--_0x62eded){_0x4ae683['push'](_0x4ae683['shift']());}};_0x537532(++_0x343b9e);}(_0x7515,0x1c2));var _0x5751=function(_0xcdcd20,_0x441b40){_0xcdcd20=_0xcdcd20-0x0;var _0x43f9d4=_0x7515[_0xcdcd20];return _0x43f9d4;};'use strict';var _=require(_0x5751('0x0'));var util=require(_0x5751('0x1'));var moment=require(_0x5751('0x2'));var BPromise=require(_0x5751('0x3'));var rs=require(_0x5751('0x4'));var fs=require('fs');var Redis=require(_0x5751('0x5'));var db=require(_0x5751('0x6'))['db'];var utils=require(_0x5751('0x7'));var logger=require(_0x5751('0x8'))(_0x5751('0x9'));var config=require(_0x5751('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38f313,_0x495faa,_0x3725a8){return new BPromise(function(_0x11fd33,_0x5f3151){return client[_0x5751('0xb')](_0x38f313,_0x3725a8)[_0x5751('0xc')](function(_0x41c52d){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x495faa,_0x5751('0xd'));logger[_0x5751('0xe')](_0x5751('0xf'),_0x495faa,_0x5751('0xd'),JSON[_0x5751('0x10')](_0x41c52d));if(_0x41c52d[_0x5751('0x11')]){if(_0x41c52d[_0x5751('0x11')][_0x5751('0x12')]===0x1f4){logger[_0x5751('0x11')](_0x5751('0x13'),_0x495faa,_0x41c52d[_0x5751('0x11')][_0x5751('0x14')]);return _0x5f3151(_0x41c52d[_0x5751('0x11')][_0x5751('0x14')]);}logger[_0x5751('0x11')](_0x5751('0x13'),_0x495faa,_0x41c52d[_0x5751('0x11')][_0x5751('0x14')]);return _0x11fd33(_0x41c52d['error'][_0x5751('0x14')]);}else{logger['info'](_0x5751('0x13'),_0x495faa,'request\x20sent');_0x11fd33(_0x41c52d['result']['message']);}})[_0x5751('0x15')](function(_0x3ed159){logger[_0x5751('0x11')](_0x5751('0x13'),_0x495faa,_0x3ed159);_0x5f3151(_0x3ed159);});});}exports[_0x5751('0x16')]=function(_0xdfa804){var _0x123c4a=this;return new Promise(function(_0xaebd36,_0x11c78f){return db['SmsQueueReport'][_0x5751('0x17')](_0xdfa804[_0x5751('0x18')],{'raw':_0xdfa804[_0x5751('0x19')]?_0xdfa804[_0x5751('0x19')][_0x5751('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xbaabd6){logger[_0x5751('0x1b')]('CreateSmsQueueReport',_0xdfa804);logger[_0x5751('0xe')](_0x5751('0x16'),_0xdfa804,JSON[_0x5751('0x10')](_0xbaabd6));_0xaebd36(_0xbaabd6);})['catch'](function(_0x39e40c){logger[_0x5751('0x11')](_0x5751('0x16'),_0x39e40c['message'],_0xdfa804);_0x11c78f(_0x123c4a['error'](0x1f4,_0x39e40c[_0x5751('0x14')]));});});};exports[_0x5751('0x1c')]=function(_0x23c518){var _0x737ef6=this;return new Promise(function(_0x17ca41,_0x3ff5fa){return db[_0x5751('0x1d')][_0x5751('0x1e')](_0x23c518['body'],{'raw':_0x23c518[_0x5751('0x19')]?_0x23c518[_0x5751('0x19')][_0x5751('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c518[_0x5751('0x19')]?_0x23c518['options']['where']||null:null,'attributes':_0x23c518[_0x5751('0x19')]?_0x23c518[_0x5751('0x19')][_0x5751('0x1f')]||null:null,'limit':_0x23c518[_0x5751('0x19')]?_0x23c518[_0x5751('0x19')]['limit']||null:null})['then'](function(_0x59b776){logger[_0x5751('0x1b')](_0x5751('0x1c'),_0x23c518);logger[_0x5751('0xe')](_0x5751('0x1c'),_0x23c518,JSON[_0x5751('0x10')](_0x59b776));_0x17ca41(_0x59b776);})[_0x5751('0x15')](function(_0x26197f){logger[_0x5751('0x11')]('UpdateSmsQueueReport',_0x26197f['message'],_0x23c518);_0x3ff5fa(_0x737ef6[_0x5751('0x11')](0x1f4,_0x26197f[_0x5751('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 63f0080..938dad9 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 _0x3423=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','path','connect-timeout','express','Router'];(function(_0x2dc098,_0x48eb28){var _0x391d8d=function(_0x54bdb7){while(--_0x54bdb7){_0x2dc098['push'](_0x2dc098['shift']());}};_0x391d8d(++_0x48eb28);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0x8')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3342('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3342('0x10')](_0x3342('0xd'),auth['isAuthenticated'](),controller[_0x3342('0x11')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['../../components/auth/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','delete','destroy','exports','util','path'];(function(_0x3f9bd,_0x510fb9){var _0x52508b=function(_0x17dbfc){while(--_0x17dbfc){_0x3f9bd['push'](_0x3f9bd['shift']());}};_0x52508b(++_0x510fb9);}(_0xda3f,0xec));var _0xfda3=function(_0x2a8a3d,_0x446cb1){_0x2a8a3d=_0x2a8a3d-0x0;var _0x53580e=_0xda3f[_0x2a8a3d];return _0x53580e;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfda3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfda3('0x3'));var controller=require(_0xfda3('0x4'));router['get']('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0x6')]);router['get']('/describe',auth[_0xfda3('0x5')](),controller[_0xfda3('0x7')]);router[_0xfda3('0x8')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')]('/',auth[_0xfda3('0x5')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller['update']);router[_0xfda3('0xe')](_0xfda3('0x9'),auth[_0xfda3('0x5')](),controller[_0xfda3('0xf')]);module[_0xfda3('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5d3efea..6fd37ff 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 _0x200c=['exports','STRING','account','queue','DATE','NOW','moment','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x200c,0x1c6));var _0xc200=function(_0x3a41df,_0x37f11d){_0x3a41df=_0x3a41df-0x0;var _0x46a76f=_0x200c[_0x3a41df];return _0x46a76f;};'use strict';var moment=require(_0xc200('0x0'));var Sequelize=require(_0xc200('0x1'));module[_0xc200('0x2')]={'uniqueid':{'type':Sequelize[_0xc200('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc200('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0xc200('0x5')},'transferredAt':{'type':Sequelize[_0xc200('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc200('0x7')]}}; \ No newline at end of file +var _0x7dca=['sequelize','STRING','ENUM','account','queue','DATE','moment'];(function(_0x482cf9,_0x496732){var _0x36c2a8=function(_0x6a8d81){while(--_0x6a8d81){_0x482cf9['push'](_0x482cf9['shift']());}};_0x36c2a8(++_0x496732);}(_0x7dca,0x76));var _0xa7dc=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x7dca[_0x5a9c0c];return _0x53c77d;};'use strict';var moment=require(_0xa7dc('0x0'));var Sequelize=require(_0xa7dc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa7dc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa7dc('0x3')](_0xa7dc('0x4'),'agent',_0xa7dc('0x5')),'allowNull':![],'defaultValue':_0xa7dc('0x5')},'transferredAt':{'type':Sequelize[_0xa7dc('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index fdeef55..883cdc2 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 _0x61a1=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','params','destroy','describe','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xf2f6,_0x38fba6){var _0x4321fc=function(_0x52eb50){while(--_0x52eb50){_0xf2f6['push'](_0xf2f6['shift']());}};_0x4321fc(++_0x38fba6);}(_0x61a1,0x127));var _0x161a=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x61a1[_0x56e4e7];return _0x383618;};'use strict';var pdf=require(_0x161a('0x0'));var emlformat=require(_0x161a('0x1'));var rimraf=require(_0x161a('0x2'));var zipdir=require(_0x161a('0x3'));var jsonpatch=require(_0x161a('0x4'));var rp=require('request-promise');var moment=require(_0x161a('0x5'));var BPromise=require(_0x161a('0x6'));var Mustache=require('mustache');var util=require(_0x161a('0x7'));var path=require(_0x161a('0x8'));var sox=require(_0x161a('0x9'));var csv=require(_0x161a('0xa'));var ejs=require(_0x161a('0xb'));var fs=require('fs');var _=require(_0x161a('0xc'));var squel=require(_0x161a('0xd'));var crypto=require(_0x161a('0xe'));var jsforce=require(_0x161a('0xf'));var deskjs=require(_0x161a('0x10'));var toCsv=require(_0x161a('0xa'));var querystring=require(_0x161a('0x11'));var Papa=require(_0x161a('0x12'));var Redis=require(_0x161a('0x13'));var authService=require(_0x161a('0x14'));var qs=require(_0x161a('0x15'));var as=require(_0x161a('0x16'));var hardwareService=require(_0x161a('0x17'));var logger=require(_0x161a('0x18'))(_0x161a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561e37,_0x2f61f0){_0x2f61f0=_0x2f61f0||0xcc;return function(_0xe588d6){if(_0xe588d6){return _0x561e37[_0x161a('0x1a')](_0x2f61f0);}return _0x561e37[_0x161a('0x1b')](_0x2f61f0)[_0x161a('0x1c')]();};}function respondWithResult(_0x2f6a2c,_0x891d45){_0x891d45=_0x891d45||0xc8;return function(_0x4a16a8){if(_0x4a16a8){return _0x2f6a2c['status'](_0x891d45)['json'](_0x4a16a8);}};}function respondWithFilteredResult(_0x2b2a3e,_0x42eebf){return function(_0x4cbdb3){if(_0x4cbdb3){var _0x359ccd=_0x4cbdb3[_0x161a('0x1d')],_0x32b1a3=_0x42eebf[_0x161a('0x1e')],_0x510209=_0x42eebf[_0x161a('0x1e')]+_0x42eebf[_0x161a('0x1f')],_0x31dcc6;if(_0x510209>=_0x359ccd){_0x510209=_0x359ccd;_0x31dcc6=0xc8;}else{_0x31dcc6=0xce;}_0x2b2a3e[_0x161a('0x1b')](_0x31dcc6);return _0x2b2a3e[_0x161a('0x20')](_0x161a('0x21'),_0x32b1a3+'-'+_0x510209+'/'+_0x359ccd)[_0x161a('0x22')](_0x4cbdb3);}return null;};}function patchUpdates(_0x22132c){return function(_0x4118fe){try{jsonpatch[_0x161a('0x23')](_0x4118fe,_0x22132c,!![]);}catch(_0x1744ae){return BPromise['reject'](_0x1744ae);}return _0x4118fe[_0x161a('0x24')]();};}function saveUpdates(_0x172488,_0x8243dd){return function(_0x411007){if(_0x411007){return _0x411007[_0x161a('0x25')](_0x172488)[_0x161a('0x26')](function(_0x1adf3c){return _0x1adf3c;});}return null;};}function removeEntity(_0x79e925,_0xffe8e1){return function(_0xa11a84){if(_0xa11a84){return _0xa11a84['destroy']()[_0x161a('0x26')](function(){_0x79e925['status'](0xcc)[_0x161a('0x1c')]();});}};}function handleEntityNotFound(_0x2e7a46,_0x4da7fa){return function(_0x1b4937){if(!_0x1b4937){_0x2e7a46[_0x161a('0x1a')](0x194);}return _0x1b4937;};}function handleError(_0x46695c,_0x210bc7){_0x210bc7=_0x210bc7||0x1f4;return function(_0x1541c6){logger[_0x161a('0x27')](_0x1541c6[_0x161a('0x28')]);if(_0x1541c6[_0x161a('0x29')]){delete _0x1541c6['name'];}_0x46695c[_0x161a('0x1b')](_0x210bc7)[_0x161a('0x2a')](_0x1541c6);};}exports['index']=function(_0x4be3ca,_0x46a1e1){var _0x3b5779={},_0x49f7a1={},_0x1472c7={'count':0x0,'rows':[]};var _0x4a3eb6=_['map'](db[_0x161a('0x2b')][_0x161a('0x2c')],function(_0x2c5039){return{'name':_0x2c5039[_0x161a('0x2d')],'type':_0x2c5039[_0x161a('0x2e')][_0x161a('0x2f')]};});_0x49f7a1[_0x161a('0x30')]=_['map'](_0x4a3eb6,_0x161a('0x29'));_0x49f7a1[_0x161a('0x31')]=_[_0x161a('0x32')](_0x4be3ca[_0x161a('0x31')]);_0x49f7a1['filters']=_['intersection'](_0x49f7a1[_0x161a('0x30')],_0x49f7a1[_0x161a('0x31')]);_0x3b5779[_0x161a('0x33')]=_[_0x161a('0x34')](_0x49f7a1[_0x161a('0x30')],qs[_0x161a('0x35')](_0x4be3ca[_0x161a('0x31')][_0x161a('0x35')]));_0x3b5779['attributes']=_0x3b5779[_0x161a('0x33')][_0x161a('0x36')]?_0x3b5779[_0x161a('0x33')]:_0x49f7a1[_0x161a('0x30')];if(!_0x4be3ca['query'][_0x161a('0x37')](_0x161a('0x38'))){_0x3b5779[_0x161a('0x1f')]=qs[_0x161a('0x1f')](_0x4be3ca[_0x161a('0x31')][_0x161a('0x1f')]);_0x3b5779[_0x161a('0x1e')]=qs[_0x161a('0x1e')](_0x4be3ca['query'][_0x161a('0x1e')]);}_0x3b5779[_0x161a('0x39')]=qs[_0x161a('0x3a')](_0x4be3ca[_0x161a('0x31')]['sort']);_0x3b5779[_0x161a('0x3b')]=qs[_0x161a('0x3c')](_['pick'](_0x4be3ca[_0x161a('0x31')],_0x49f7a1[_0x161a('0x3c')]),_0x4a3eb6);if(_0x4be3ca['query'][_0x161a('0x3d')]){_0x3b5779[_0x161a('0x3b')]=_[_0x161a('0x3e')](_0x3b5779[_0x161a('0x3b')],{'$or':_[_0x161a('0x3f')](_0x4a3eb6,function(_0x430cbc){if(_0x430cbc[_0x161a('0x2e')]!==_0x161a('0x40')){var _0x132d5d={};_0x132d5d[_0x430cbc[_0x161a('0x29')]]={'$like':'%'+_0x4be3ca[_0x161a('0x31')][_0x161a('0x3d')]+'%'};return _0x132d5d;}})});}_0x3b5779=_[_0x161a('0x3e')]({},_0x3b5779,_0x4be3ca[_0x161a('0x41')]);var _0x36deef={'where':_0x3b5779[_0x161a('0x3b')]};return db[_0x161a('0x2b')][_0x161a('0x1d')](_0x36deef)[_0x161a('0x26')](function(_0x2b8b37){_0x1472c7[_0x161a('0x1d')]=_0x2b8b37;if(_0x4be3ca['query'][_0x161a('0x42')]){_0x3b5779[_0x161a('0x43')]=[{'all':!![]}];}return db[_0x161a('0x2b')][_0x161a('0x44')](_0x3b5779);})['then'](function(_0x1808ae){_0x1472c7[_0x161a('0x45')]=_0x1808ae;return _0x1472c7;})[_0x161a('0x26')](respondWithFilteredResult(_0x46a1e1,_0x3b5779))['catch'](handleError(_0x46a1e1,null));};exports['show']=function(_0x4c533c,_0x1e6bc0){var _0x15c055={'raw':!![],'where':{'id':_0x4c533c['params']['id']}},_0x3b3399={};_0x3b3399[_0x161a('0x30')]=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x3b3399[_0x161a('0x31')]=_[_0x161a('0x32')](_0x4c533c['query']);_0x3b3399[_0x161a('0x3c')]=_[_0x161a('0x34')](_0x3b3399[_0x161a('0x30')],_0x3b3399[_0x161a('0x31')]);_0x15c055['attributes']=_[_0x161a('0x34')](_0x3b3399[_0x161a('0x30')],qs[_0x161a('0x35')](_0x4c533c['query'][_0x161a('0x35')]));_0x15c055['attributes']=_0x15c055[_0x161a('0x33')][_0x161a('0x36')]?_0x15c055[_0x161a('0x33')]:_0x3b3399[_0x161a('0x30')];if(_0x4c533c[_0x161a('0x31')][_0x161a('0x42')]){_0x15c055[_0x161a('0x43')]=[{'all':!![]}];}_0x15c055=_[_0x161a('0x3e')]({},_0x15c055,_0x4c533c['options']);return db[_0x161a('0x2b')][_0x161a('0x46')](_0x15c055)[_0x161a('0x26')](handleEntityNotFound(_0x1e6bc0,null))[_0x161a('0x26')](respondWithResult(_0x1e6bc0,null))['catch'](handleError(_0x1e6bc0,null));};exports[_0x161a('0x47')]=function(_0x39d3b0,_0x29429e){return db[_0x161a('0x2b')][_0x161a('0x47')](_0x39d3b0['body'],{})[_0x161a('0x26')](respondWithResult(_0x29429e,0xc9))['catch'](handleError(_0x29429e,null));};exports[_0x161a('0x25')]=function(_0x4185b2,_0xe83c49){if(_0x4185b2[_0x161a('0x48')]['id']){delete _0x4185b2[_0x161a('0x48')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x4185b2[_0x161a('0x49')]['id']}})[_0x161a('0x26')](handleEntityNotFound(_0xe83c49,null))['then'](saveUpdates(_0x4185b2[_0x161a('0x48')],null))[_0x161a('0x26')](respondWithResult(_0xe83c49,null))['catch'](handleError(_0xe83c49,null));};exports[_0x161a('0x4a')]=function(_0xfa0639,_0x6cd3c0){return db[_0x161a('0x2b')][_0x161a('0x46')]({'where':{'id':_0xfa0639['params']['id']}})['then'](handleEntityNotFound(_0x6cd3c0,null))[_0x161a('0x26')](removeEntity(_0x6cd3c0,null))['catch'](handleError(_0x6cd3c0,null));};exports[_0x161a('0x4b')]=function(_0x4d8cd8,_0x1e47eb){return db[_0x161a('0x2b')][_0x161a('0x4b')]()['then'](respondWithResult(_0x1e47eb,null))[_0x161a('0x4c')](handleError(_0x1e47eb,null));}; \ No newline at end of file +var _0x24cd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3b932a,_0x16d059){var _0x524678=function(_0x30cfe5){while(--_0x30cfe5){_0x3b932a['push'](_0x3b932a['shift']());}};_0x524678(++_0x16d059);}(_0x24cd,0x83));var _0xd24c=function(_0xd1292a,_0x427782){_0xd1292a=_0xd1292a-0x0;var _0x2fcfc3=_0x24cd[_0xd1292a];return _0x2fcfc3;};'use strict';var pdf=require(_0xd24c('0x0'));var emlformat=require(_0xd24c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd24c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24c('0x3'));var moment=require(_0xd24c('0x4'));var BPromise=require(_0xd24c('0x5'));var Mustache=require('mustache');var util=require(_0xd24c('0x6'));var path=require(_0xd24c('0x7'));var sox=require('sox');var csv=require(_0xd24c('0x8'));var ejs=require(_0xd24c('0x9'));var fs=require('fs');var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0xf'));var authService=require(_0xd24c('0x10'));var qs=require(_0xd24c('0x11'));var as=require(_0xd24c('0x12'));var hardwareService=require(_0xd24c('0x13'));var logger=require(_0xd24c('0x14'))(_0xd24c('0x15'));var utils=require(_0xd24c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x17'));var db=require(_0xd24c('0x18'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x19')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1a')](_0x3296ea)[_0xd24c('0x1b')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1c')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=_0x34aa92['count'],_0x1a1111=_0x528489[_0xd24c('0x1d')],_0x3221a8=_0x528489[_0xd24c('0x1d')]+_0x528489[_0xd24c('0x1e')],_0x509992;if(_0x3221a8>=_0x3aa193){_0x3221a8=_0x3aa193;_0x509992=0xc8;}else{_0x509992=0xce;}_0xe096c['status'](_0x509992);return _0xe096c[_0xd24c('0x1f')](_0xd24c('0x20'),_0x1a1111+'-'+_0x3221a8+'/'+_0x3aa193)[_0xd24c('0x1c')](_0x34aa92);}return null;};}function patchUpdates(_0x62e228){return function(_0x478a0f){try{jsonpatch[_0xd24c('0x21')](_0x478a0f,_0x62e228,!![]);}catch(_0x56f8af){return BPromise[_0xd24c('0x22')](_0x56f8af);}return _0x478a0f[_0xd24c('0x23')]();};}function saveUpdates(_0x1b3a2f,_0x38c380){return function(_0x333416){if(_0x333416){return _0x333416[_0xd24c('0x24')](_0x1b3a2f)[_0xd24c('0x25')](function(_0x298d73){return _0x298d73;});}return null;};}function removeEntity(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')]()[_0xd24c('0x25')](function(){_0x17375b[_0xd24c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44471f,_0x2c3328){return function(_0x317eb0){if(!_0x317eb0){_0x44471f['sendStatus'](0x194);}return _0x317eb0;};}function handleError(_0x4539e7,_0x391cd5){_0x391cd5=_0x391cd5||0x1f4;return function(_0x848e0e){logger[_0xd24c('0x27')](_0x848e0e['stack']);if(_0x848e0e['name']){delete _0x848e0e[_0xd24c('0x28')];}_0x4539e7['status'](_0x391cd5)[_0xd24c('0x29')](_0x848e0e);};}exports[_0xd24c('0x2a')]=function(_0x325fcc,_0x4c0d99){var _0x4cb1b3={},_0x26fd85={},_0x14d44a={'count':0x0,'rows':[]};var _0x1a18b7=_[_0xd24c('0x2b')](db[_0xd24c('0x2c')][_0xd24c('0x2d')],function(_0x1be144){return{'name':_0x1be144[_0xd24c('0x2e')],'type':_0x1be144[_0xd24c('0x2f')][_0xd24c('0x30')]};});_0x26fd85[_0xd24c('0x31')]=_['map'](_0x1a18b7,_0xd24c('0x28'));_0x26fd85[_0xd24c('0x32')]=_[_0xd24c('0x33')](_0x325fcc[_0xd24c('0x32')]);_0x26fd85['filters']=_['intersection'](_0x26fd85[_0xd24c('0x31')],_0x26fd85[_0xd24c('0x32')]);_0x4cb1b3[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x26fd85['model'],qs[_0xd24c('0x36')](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x36')]));_0x4cb1b3[_0xd24c('0x34')]=_0x4cb1b3[_0xd24c('0x34')][_0xd24c('0x37')]?_0x4cb1b3[_0xd24c('0x34')]:_0x26fd85[_0xd24c('0x31')];if(!_0x325fcc[_0xd24c('0x32')]['hasOwnProperty'](_0xd24c('0x38'))){_0x4cb1b3['limit']=qs['limit'](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x1e')]);_0x4cb1b3[_0xd24c('0x1d')]=qs[_0xd24c('0x1d')](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x1d')]);}_0x4cb1b3[_0xd24c('0x39')]=qs['sort'](_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3a')]);_0x4cb1b3[_0xd24c('0x3b')]=qs[_0xd24c('0x3c')](_[_0xd24c('0x3d')](_0x325fcc[_0xd24c('0x32')],_0x26fd85['filters']),_0x1a18b7);if(_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3e')]){_0x4cb1b3['where']=_[_0xd24c('0x3f')](_0x4cb1b3[_0xd24c('0x3b')],{'$or':_['map'](_0x1a18b7,function(_0x1e5718){if(_0x1e5718[_0xd24c('0x2f')]!=='VIRTUAL'){var _0x2e1cce={};_0x2e1cce[_0x1e5718[_0xd24c('0x28')]]={'$like':'%'+_0x325fcc[_0xd24c('0x32')][_0xd24c('0x3e')]+'%'};return _0x2e1cce;}})});}_0x4cb1b3=_['merge']({},_0x4cb1b3,_0x325fcc[_0xd24c('0x40')]);var _0x5c2a39={'where':_0x4cb1b3[_0xd24c('0x3b')]};return db['SmsTransferReport']['count'](_0x5c2a39)['then'](function(_0x4160fb){_0x14d44a['count']=_0x4160fb;if(_0x325fcc['query'][_0xd24c('0x41')]){_0x4cb1b3[_0xd24c('0x42')]=[{'all':!![]}];}return db[_0xd24c('0x2c')][_0xd24c('0x43')](_0x4cb1b3);})['then'](function(_0xe5fe3a){_0x14d44a['rows']=_0xe5fe3a;return _0x14d44a;})[_0xd24c('0x25')](respondWithFilteredResult(_0x4c0d99,_0x4cb1b3))[_0xd24c('0x44')](handleError(_0x4c0d99,null));};exports[_0xd24c('0x45')]=function(_0x181836,_0x27eefa){var _0x5ee293={'raw':!![],'where':{'id':_0x181836[_0xd24c('0x46')]['id']}},_0x17f070={};_0x17f070[_0xd24c('0x31')]=_[_0xd24c('0x33')](db['SmsTransferReport'][_0xd24c('0x2d')]);_0x17f070[_0xd24c('0x32')]=_['keys'](_0x181836[_0xd24c('0x32')]);_0x17f070[_0xd24c('0x3c')]=_['intersection'](_0x17f070[_0xd24c('0x31')],_0x17f070['query']);_0x5ee293[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x17f070[_0xd24c('0x31')],qs[_0xd24c('0x36')](_0x181836[_0xd24c('0x32')]['fields']));_0x5ee293[_0xd24c('0x34')]=_0x5ee293['attributes'][_0xd24c('0x37')]?_0x5ee293['attributes']:_0x17f070[_0xd24c('0x31')];if(_0x181836[_0xd24c('0x32')]['includeAll']){_0x5ee293[_0xd24c('0x42')]=[{'all':!![]}];}_0x5ee293=_[_0xd24c('0x3f')]({},_0x5ee293,_0x181836['options']);return db[_0xd24c('0x2c')]['find'](_0x5ee293)['then'](handleEntityNotFound(_0x27eefa,null))['then'](respondWithResult(_0x27eefa,null))[_0xd24c('0x44')](handleError(_0x27eefa,null));};exports[_0xd24c('0x47')]=function(_0x490957,_0x516734){return db[_0xd24c('0x2c')][_0xd24c('0x47')](_0x490957[_0xd24c('0x48')],{})[_0xd24c('0x25')](respondWithResult(_0x516734,0xc9))['catch'](handleError(_0x516734,null));};exports[_0xd24c('0x24')]=function(_0x186348,_0x496694){if(_0x186348[_0xd24c('0x48')]['id']){delete _0x186348[_0xd24c('0x48')]['id'];}return db[_0xd24c('0x2c')]['find']({'where':{'id':_0x186348[_0xd24c('0x46')]['id']}})['then'](handleEntityNotFound(_0x496694,null))[_0xd24c('0x25')](saveUpdates(_0x186348[_0xd24c('0x48')],null))[_0xd24c('0x25')](respondWithResult(_0x496694,null))[_0xd24c('0x44')](handleError(_0x496694,null));};exports['destroy']=function(_0x14684c,_0x153dc4){return db[_0xd24c('0x2c')][_0xd24c('0x49')]({'where':{'id':_0x14684c[_0xd24c('0x46')]['id']}})[_0xd24c('0x25')](handleEntityNotFound(_0x153dc4,null))[_0xd24c('0x25')](removeEntity(_0x153dc4,null))[_0xd24c('0x44')](handleError(_0x153dc4,null));};exports[_0xd24c('0x4a')]=function(_0x3f29e6,_0x131e14){return db['SmsTransferReport'][_0xd24c('0x4a')]()[_0xd24c('0x25')](respondWithResult(_0x131e14,null))['catch'](handleError(_0x131e14,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6420877..61c424c 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 _0x4c60=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0xb7c5f9,_0x1d27c7){var _0x185287=function(_0x36a191){while(--_0x36a191){_0xb7c5f9['push'](_0xb7c5f9['shift']());}};_0x185287(++_0x1d27c7);}(_0x4c60,0xc1));var _0x04c6=function(_0x44e9af,_0x50094e){_0x44e9af=_0x44e9af-0x0;var _0x452e81=_0x4c60[_0x44e9af];return _0x452e81;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x04c6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','util'];(function(_0x5ad79c,_0x24f27c){var _0x5080a9=function(_0x3556e9){while(--_0x3556e9){_0x5ad79c['push'](_0x5ad79c['shift']());}};_0x5080a9(++_0x24f27c);}(_0x1261,0x144));var _0x1126=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x1261[_0x28d225];return _0x1f79e1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('SmsTransferReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b2dd4bc..255d7a0 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 _0x6883=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0x57b90a,_0x246933){var _0x9b9abd=function(_0x347cc9){while(--_0x347cc9){_0x57b90a['push'](_0x57b90a['shift']());}};_0x9b9abd(++_0x246933);}(_0x6883,0x139));var _0x3688=function(_0x4e1386,_0x2bc8a0){_0x4e1386=_0x4e1386-0x0;var _0x240049=_0x6883[_0x4e1386];return _0x240049;};'use strict';var _=require(_0x3688('0x0'));var util=require(_0x3688('0x1'));var moment=require(_0x3688('0x2'));var BPromise=require(_0x3688('0x3'));var rs=require(_0x3688('0x4'));var fs=require('fs');var Redis=require(_0x3688('0x5'));var db=require(_0x3688('0x6'))['db'];var utils=require(_0x3688('0x7'));var logger=require(_0x3688('0x8'))(_0x3688('0x9'));var config=require(_0x3688('0xa'));var jayson=require(_0x3688('0xb'));var client=jayson['client'][_0x3688('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4541c,_0x58a59e,_0x2dd817){return new BPromise(function(_0x566c8c,_0x8f603f){return client['request'](_0x4541c,_0x2dd817)[_0x3688('0xd')](function(_0x2309ef){logger[_0x3688('0xe')](_0x3688('0xf'),_0x58a59e,_0x3688('0x10'));logger[_0x3688('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x58a59e,'request\x20sent',JSON[_0x3688('0x12')](_0x2309ef));if(_0x2309ef['error']){if(_0x2309ef['error'][_0x3688('0x13')]===0x1f4){logger['error'](_0x3688('0xf'),_0x58a59e,_0x2309ef[_0x3688('0x14')]['message']);return _0x8f603f(_0x2309ef['error'][_0x3688('0x15')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x58a59e,_0x2309ef[_0x3688('0x14')][_0x3688('0x15')]);return _0x566c8c(_0x2309ef['error'][_0x3688('0x15')]);}else{logger[_0x3688('0xe')](_0x3688('0xf'),_0x58a59e,_0x3688('0x10'));_0x566c8c(_0x2309ef[_0x3688('0x16')]['message']);}})[_0x3688('0x17')](function(_0x2981f7){logger[_0x3688('0x14')](_0x3688('0xf'),_0x58a59e,_0x2981f7);_0x8f603f(_0x2981f7);});});} \ No newline at end of file +var _0x8032=['code','SmsTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59de37,_0x255cf5){var _0x2532a5=function(_0x5ec6b2){while(--_0x5ec6b2){_0x59de37['push'](_0x59de37['shift']());}};_0x2532a5(++_0x255cf5);}(_0x8032,0xc1));var _0x2803=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0x8032[_0x84a85];return _0x1c2943;};'use strict';var _=require(_0x2803('0x0'));var util=require(_0x2803('0x1'));var moment=require('moment');var BPromise=require(_0x2803('0x2'));var rs=require(_0x2803('0x3'));var fs=require('fs');var Redis=require(_0x2803('0x4'));var db=require(_0x2803('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2803('0x6'))(_0x2803('0x7'));var config=require('../../config/environment');var jayson=require(_0x2803('0x8'));var client=jayson[_0x2803('0x9')][_0x2803('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xef3a87,_0x3bade1,_0x197700){return new BPromise(function(_0x44356e,_0x4e3c7b){return client[_0x2803('0xb')](_0xef3a87,_0x197700)['then'](function(_0x1ed089){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3bade1,_0x2803('0xc'));logger[_0x2803('0xd')](_0x2803('0xe'),_0x3bade1,_0x2803('0xc'),JSON[_0x2803('0xf')](_0x1ed089));if(_0x1ed089[_0x2803('0x10')]){if(_0x1ed089[_0x2803('0x10')][_0x2803('0x11')]===0x1f4){logger[_0x2803('0x10')](_0x2803('0x12'),_0x3bade1,_0x1ed089[_0x2803('0x10')][_0x2803('0x13')]);return _0x4e3c7b(_0x1ed089[_0x2803('0x10')][_0x2803('0x13')]);}logger[_0x2803('0x10')](_0x2803('0x12'),_0x3bade1,_0x1ed089[_0x2803('0x10')]['message']);return _0x44356e(_0x1ed089[_0x2803('0x10')][_0x2803('0x13')]);}else{logger['info'](_0x2803('0x12'),_0x3bade1,_0x2803('0xc'));_0x44356e(_0x1ed089['result'][_0x2803('0x13')]);}})[_0x2803('0x14')](function(_0x4682db){logger[_0x2803('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3bade1,_0x4682db);_0x4e3c7b(_0x4682db);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 16bdeaa..b6ebd7a 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 _0x7aca=['file','create','put','update','delete','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0x7aca,0x114));var _0xa7ac=function(_0x4c63d8,_0x50e70d){_0x4c63d8=_0x4c63d8-0x0;var _0x5f1fd1=_0x7aca[_0x4c63d8];return _0x5f1fd1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa7ac('0x0'));var timeout=require(_0xa7ac('0x1'));var express=require(_0xa7ac('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa7ac('0x3'));var config=require(_0xa7ac('0x4'));var controller=require(_0xa7ac('0x5'));router[_0xa7ac('0x6')]('/',auth[_0xa7ac('0x7')](),controller['index']);router[_0xa7ac('0x6')](_0xa7ac('0x8'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0x9')]);router['get'](_0xa7ac('0xa'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcf4577,_0x3bec4b,_0x3e274d){_0x3e274d(null,path['join'](config[_0xa7ac('0xc')],_0xa7ac('0xd')));},'filename':function(_0x21765e,_0x3fbeed,_0x4ba8c8){_0x3fbeed[_0xa7ac('0xe')]=_0x3fbeed[_0xa7ac('0xe')][_0xa7ac('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ba8c8(null,util[_0xa7ac('0x10')](_0xa7ac('0x11'),path['basename'](_0x3fbeed['originalname'],path[_0xa7ac('0x12')](_0x3fbeed[_0xa7ac('0xe')])),Date[_0xa7ac('0x13')](),path[_0xa7ac('0x12')](_0x3fbeed[_0xa7ac('0xe')])));}})});router[_0xa7ac('0x14')]('/',upload['single'](_0xa7ac('0x15')),controller[_0xa7ac('0x16')]);router[_0xa7ac('0x17')](_0xa7ac('0x8'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0x18')]);router[_0xa7ac('0x19')](_0xa7ac('0x8'),auth[_0xa7ac('0x7')](),controller[_0xa7ac('0x19')]);module[_0xa7ac('0x1a')]=router; \ No newline at end of file +var _0x286f=['../../config/environment','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x286f,0x160));var _0xf286=function(_0x33ebf7,_0x4820e3){_0x33ebf7=_0x33ebf7-0x0;var _0xdc6fc4=_0x286f[_0x33ebf7];return _0xdc6fc4;};'use strict';var multer=require(_0xf286('0x0'));var util=require(_0xf286('0x1'));var path=require(_0xf286('0x2'));var timeout=require(_0xf286('0x3'));var express=require(_0xf286('0x4'));var router=express[_0xf286('0x5')]();var auth=require(_0xf286('0x6'));var interaction=require(_0xf286('0x7'));var config=require(_0xf286('0x8'));var controller=require('./sound.controller');router[_0xf286('0x9')]('/',auth[_0xf286('0xa')](),controller['index']);router[_0xf286('0x9')]('/:id',auth[_0xf286('0xa')](),controller[_0xf286('0xb')]);router[_0xf286('0x9')](_0xf286('0xc'),auth[_0xf286('0xa')](),controller[_0xf286('0xd')]);var upload=multer({'storage':multer[_0xf286('0xe')]({'destination':function(_0x704d5b,_0x587991,_0x7ddfc1){_0x7ddfc1(null,path[_0xf286('0xf')](config[_0xf286('0x10')],'server/files/sounds/original/'));},'filename':function(_0x3ccafa,_0x40ba19,_0x3c812b){_0x40ba19[_0xf286('0x11')]=_0x40ba19[_0xf286('0x11')][_0xf286('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c812b(null,util[_0xf286('0x13')](_0xf286('0x14'),path[_0xf286('0x15')](_0x40ba19[_0xf286('0x11')],path[_0xf286('0x16')](_0x40ba19[_0xf286('0x11')])),Date[_0xf286('0x17')](),path[_0xf286('0x16')](_0x40ba19[_0xf286('0x11')])));}})});router[_0xf286('0x18')]('/',upload['single'](_0xf286('0x19')),controller[_0xf286('0x1a')]);router[_0xf286('0x1b')](_0xf286('0x1c'),auth[_0xf286('0xa')](),controller['update']);router[_0xf286('0x1d')](_0xf286('0x1c'),auth['isAuthenticated'](),controller[_0xf286('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a5c9822..ecbdc36 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 _0xe875=['INTEGER','FLOAT','exports','STRING','name','BIGINT'];(function(_0x1413c4,_0x47f820){var _0x1edec3=function(_0x59966d){while(--_0x59966d){_0x1413c4['push'](_0x1413c4['shift']());}};_0x1edec3(++_0x47f820);}(_0xe875,0x15e));var _0x5e87=function(_0x9c9561,_0x26fd2b){_0x9c9561=_0x9c9561-0x0;var _0x212afa=_0xe875[_0x9c9561];return _0x212afa;};'use strict';var Sequelize=require('sequelize');module[_0x5e87('0x0')]={'name':{'type':Sequelize[_0x5e87('0x1')],'unique':_0x5e87('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x5e87('0x3')]},'original_channelCount':{'type':Sequelize[_0x5e87('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5e87('0x4')]},'converted_format':{'type':Sequelize[_0x5e87('0x1')]},'converted_duration':{'type':Sequelize[_0x5e87('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x5e87('0x3')]},'converted_channelCount':{'type':Sequelize[_0x5e87('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5e87('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7144=['name','STRING','FLOAT','INTEGER','BIGINT'];(function(_0xd98def,_0x19ebc7){var _0x55b182=function(_0x1d3372){while(--_0x1d3372){_0xd98def['push'](_0xd98def['shift']());}};_0x55b182(++_0x19ebc7);}(_0x7144,0x8c));var _0x4714=function(_0x10fb3d,_0x33f9dc){_0x10fb3d=_0x10fb3d-0x0;var _0x33781f=_0x7144[_0x10fb3d];return _0x33781f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4714('0x0'),'allowNull':![]},'save_name':{'type':Sequelize[_0x4714('0x1')]},'display_name':{'type':Sequelize[_0x4714('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4714('0x1')]},'original_format':{'type':Sequelize[_0x4714('0x1')]},'original_duration':{'type':Sequelize[_0x4714('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x4714('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x4714('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x4714('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4714('0x3')]},'converted_bitRate':{'type':Sequelize[_0x4714('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b76403c..8e65a28 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 _0x67c4=['stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','Sounds','sendStatus','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67c4,0xd6));var _0x467c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x67c4[_0x5a776b];return _0xbbef59;};'use strict';var pdf=require(_0x467c('0x0'));var emlformat=require(_0x467c('0x1'));var rimraf=require(_0x467c('0x2'));var zipdir=require(_0x467c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x467c('0x4'));var util=require(_0x467c('0x5'));var path=require('path');var sox=require(_0x467c('0x6'));var csv=require(_0x467c('0x7'));var ejs=require(_0x467c('0x8'));var fs=require('fs');var _=require(_0x467c('0x9'));var squel=require('squel');var crypto=require(_0x467c('0xa'));var jsforce=require(_0x467c('0xb'));var deskjs=require(_0x467c('0xc'));var toCsv=require(_0x467c('0x7'));var querystring=require(_0x467c('0xd'));var Papa=require(_0x467c('0xe'));var Redis=require(_0x467c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x467c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x467c('0x11'))(_0x467c('0x12'));var utils=require(_0x467c('0x13'));var config=require(_0x467c('0x14'));var licenseUtil=require(_0x467c('0x15'));var db=require(_0x467c('0x16'))['db'];function respondWithStatusCode(_0x366673,_0x27f000){_0x27f000=_0x27f000||0xcc;return function(_0x487264){if(_0x487264){return _0x366673['sendStatus'](_0x27f000);}return _0x366673[_0x467c('0x17')](_0x27f000)[_0x467c('0x18')]();};}function respondWithResult(_0x5b97c7,_0xa5bdba){_0xa5bdba=_0xa5bdba||0xc8;return function(_0x53be6a){if(_0x53be6a){return _0x5b97c7[_0x467c('0x17')](_0xa5bdba)[_0x467c('0x19')](_0x53be6a);}};}function respondWithFilteredResult(_0x111eb8,_0x14df2c){return function(_0x4424c7){if(_0x4424c7){var _0x334888=_0x4424c7[_0x467c('0x1a')],_0x4ccc8e=_0x14df2c[_0x467c('0x1b')],_0x3e88a7=_0x14df2c['offset']+_0x14df2c[_0x467c('0x1c')],_0x393379;if(_0x3e88a7>=_0x334888){_0x3e88a7=_0x334888;_0x393379=0xc8;}else{_0x393379=0xce;}_0x111eb8[_0x467c('0x17')](_0x393379);return _0x111eb8['set'](_0x467c('0x1d'),_0x4ccc8e+'-'+_0x3e88a7+'/'+_0x334888)[_0x467c('0x19')](_0x4424c7);}return null;};}function patchUpdates(_0x3767cb){return function(_0x23534a){try{jsonpatch['apply'](_0x23534a,_0x3767cb,!![]);}catch(_0x1f20a6){return BPromise[_0x467c('0x1e')](_0x1f20a6);}return _0x23534a['save']();};}function saveUpdates(_0x3a6cc0,_0x155f39){return function(_0x121885){if(_0x121885){return _0x121885[_0x467c('0x1f')](_0x3a6cc0)[_0x467c('0x20')](function(_0x4b1756){return _0x4b1756;});}return null;};}function removeEntity(_0x243208,_0x4e34f4){return function(_0x5322b7){if(_0x5322b7){return _0x5322b7[_0x467c('0x21')]()[_0x467c('0x20')](function(){var _0x45f17a=_0x5322b7[_0x467c('0x22')]({'plain':!![]});var _0xa4192f=_0x467c('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0xa4192f,'resourceId':_0x45f17a['id']}})[_0x467c('0x20')](function(){return _0x5322b7;});})['then'](function(){_0x243208['status'](0xcc)[_0x467c('0x18')]();});}};}function handleEntityNotFound(_0xa19d28,_0x8b3f2f){return function(_0x97c0e0){if(!_0x97c0e0){_0xa19d28[_0x467c('0x24')](0x194);}return _0x97c0e0;};}function handleError(_0x21e6ac,_0x26d90a){_0x26d90a=_0x26d90a||0x1f4;return function(_0x1c3945){logger[_0x467c('0x25')](_0x1c3945[_0x467c('0x26')]);if(_0x1c3945[_0x467c('0x27')]){delete _0x1c3945[_0x467c('0x27')];}_0x21e6ac[_0x467c('0x17')](_0x26d90a)[_0x467c('0x28')](_0x1c3945);};}exports[_0x467c('0x29')]=function(_0x584f9b,_0x3a99dd){var _0x4e53e7={},_0x3a911a={},_0x556e1c={'count':0x0,'rows':[]};var _0x37eb30=_[_0x467c('0x2a')](db['Sound'][_0x467c('0x2b')],function(_0x39d068){return{'name':_0x39d068['fieldName'],'type':_0x39d068[_0x467c('0x2c')][_0x467c('0x2d')]};});_0x3a911a['model']=_[_0x467c('0x2a')](_0x37eb30,_0x467c('0x27'));_0x3a911a[_0x467c('0x2e')]=_[_0x467c('0x2f')](_0x584f9b['query']);_0x3a911a[_0x467c('0x30')]=_['intersection'](_0x3a911a[_0x467c('0x31')],_0x3a911a['query']);_0x4e53e7['attributes']=_['intersection'](_0x3a911a[_0x467c('0x31')],qs[_0x467c('0x32')](_0x584f9b['query'][_0x467c('0x32')]));_0x4e53e7[_0x467c('0x33')]=_0x4e53e7[_0x467c('0x33')]['length']?_0x4e53e7[_0x467c('0x33')]:_0x3a911a['model'];if(!_0x584f9b[_0x467c('0x2e')][_0x467c('0x34')](_0x467c('0x35'))){_0x4e53e7[_0x467c('0x1c')]=qs[_0x467c('0x1c')](_0x584f9b[_0x467c('0x2e')][_0x467c('0x1c')]);_0x4e53e7['offset']=qs['offset'](_0x584f9b[_0x467c('0x2e')][_0x467c('0x1b')]);}_0x4e53e7[_0x467c('0x36')]=qs[_0x467c('0x37')](_0x584f9b['query'][_0x467c('0x37')]);_0x4e53e7[_0x467c('0x38')]=qs[_0x467c('0x30')](_['pick'](_0x584f9b['query'],_0x3a911a[_0x467c('0x30')]),_0x37eb30);if(_0x584f9b['query'][_0x467c('0x39')]){_0x4e53e7[_0x467c('0x38')]=_[_0x467c('0x3a')](_0x4e53e7[_0x467c('0x38')],{'$or':_['map'](_0x37eb30,function(_0x537a5c){if(_0x537a5c[_0x467c('0x2c')]!==_0x467c('0x3b')){var _0x14c27a={};_0x14c27a[_0x537a5c[_0x467c('0x27')]]={'$like':'%'+_0x584f9b['query'][_0x467c('0x39')]+'%'};return _0x14c27a;}})});}_0x4e53e7=_[_0x467c('0x3a')]({},_0x4e53e7,_0x584f9b[_0x467c('0x3c')]);var _0x101d09={'where':_0x4e53e7[_0x467c('0x38')]};return db[_0x467c('0x3d')][_0x467c('0x1a')](_0x101d09)['then'](function(_0x127e64){_0x556e1c[_0x467c('0x1a')]=_0x127e64;if(_0x584f9b[_0x467c('0x2e')][_0x467c('0x3e')]){_0x4e53e7['include']=[{'all':!![]}];}return db[_0x467c('0x3d')][_0x467c('0x3f')](_0x4e53e7);})['then'](function(_0x341e4f){_0x556e1c[_0x467c('0x40')]=_0x341e4f;return _0x556e1c;})['then'](respondWithFilteredResult(_0x3a99dd,_0x4e53e7))[_0x467c('0x41')](handleError(_0x3a99dd,null));};exports[_0x467c('0x42')]=function(_0x1005eb,_0x55fcb1){var _0x395a44={'raw':!![],'where':{'id':_0x1005eb[_0x467c('0x43')]['id']}},_0x1ce021={};_0x1ce021[_0x467c('0x31')]=_[_0x467c('0x2f')](db[_0x467c('0x3d')][_0x467c('0x2b')]);_0x1ce021[_0x467c('0x2e')]=_[_0x467c('0x2f')](_0x1005eb[_0x467c('0x2e')]);_0x1ce021[_0x467c('0x30')]=_[_0x467c('0x44')](_0x1ce021[_0x467c('0x31')],_0x1ce021[_0x467c('0x2e')]);_0x395a44[_0x467c('0x33')]=_[_0x467c('0x44')](_0x1ce021[_0x467c('0x31')],qs[_0x467c('0x32')](_0x1005eb[_0x467c('0x2e')]['fields']));_0x395a44['attributes']=_0x395a44[_0x467c('0x33')][_0x467c('0x45')]?_0x395a44[_0x467c('0x33')]:_0x1ce021[_0x467c('0x31')];if(_0x1005eb[_0x467c('0x2e')][_0x467c('0x3e')]){_0x395a44[_0x467c('0x46')]=[{'all':!![]}];}_0x395a44=_[_0x467c('0x3a')]({},_0x395a44,_0x1005eb[_0x467c('0x3c')]);return db[_0x467c('0x3d')][_0x467c('0x47')](_0x395a44)['then'](handleEntityNotFound(_0x55fcb1,null))['then'](respondWithResult(_0x55fcb1,null))[_0x467c('0x41')](handleError(_0x55fcb1,null));};exports[_0x467c('0x48')]=function(_0xbfff88,_0x399d35,_0x3ef716){return db[_0x467c('0x3d')][_0x467c('0x47')]({'where':{'id':_0xbfff88[_0x467c('0x43')]['id']},'attributes':['name',_0x467c('0x49'),_0x467c('0x4a')],'raw':!![]})[_0x467c('0x20')](handleEntityNotFound(_0x399d35,null))[_0x467c('0x20')](function(_0x56a797){if(_0x56a797){if(!fs['existsSync'](path[_0x467c('0x4b')](config[_0x467c('0x4c')],_0x467c('0x4d'),_0x56a797[_0x467c('0x49')]+'.'+_0x56a797[_0x467c('0x4a')]))){throw new db[(_0x467c('0x4e'))]['ValidationError'](_0x467c('0x4f'));}return _0x399d35['download'](path[_0x467c('0x4b')](config[_0x467c('0x4c')],'server/files/sounds/converted',util[_0x467c('0x50')](_0x467c('0x51'),_0x56a797[_0x467c('0x49')],_0x56a797['converted_format'])),util[_0x467c('0x50')](_0x467c('0x51'),_0x56a797[_0x467c('0x27')],_0x56a797['converted_format']));}return null;})[_0x467c('0x41')](handleError(_0x399d35,null));};exports['create']=function(_0x4017a5,_0x2c754b,_0x578654){var _0x2744f5={'name':path[_0x467c('0x52')](_0x4017a5[_0x467c('0x53')][_0x467c('0x54')],path['extname'](_0x4017a5[_0x467c('0x53')][_0x467c('0x54')])),'save_name':path[_0x467c('0x52')](_0x4017a5[_0x467c('0x53')]['filename'],path[_0x467c('0x55')](_0x4017a5[_0x467c('0x53')][_0x467c('0x56')])),'original_format':path[_0x467c('0x55')](_0x4017a5[_0x467c('0x53')][_0x467c('0x54')])[_0x467c('0x57')](0x1),'converted_format':_0x467c('0x58')};var _0x235aa9=path['join'](config[_0x467c('0x4c')],'server/files/sounds/original',_0x4017a5['file'][_0x467c('0x56')]);var _0x19dc3a=path['join'](config[_0x467c('0x4c')],_0x467c('0x4d'),util[_0x467c('0x50')](_0x467c('0x51'),path[_0x467c('0x52')](_0x4017a5[_0x467c('0x53')]['filename'],path[_0x467c('0x55')](_0x4017a5[_0x467c('0x53')][_0x467c('0x56')])),_0x2744f5['converted_format']));logger[_0x467c('0x59')](_0x467c('0x5a'),_0x235aa9);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x19dc3a);try{fs[_0x467c('0x5b')](_0x235aa9,parseInt(_0x467c('0x5c'),0x8));var _0x3641f0=sox[_0x467c('0x5d')](_0x235aa9,_0x19dc3a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3641f0['on'](_0x467c('0x25'),function(_0x16db34){fs[_0x467c('0x5e')](_0x235aa9);_0x2c754b[_0x467c('0x17')](0x1f4)[_0x467c('0x28')](_0x16db34);});_0x3641f0['on'](_0x467c('0x5f'),function(_0x2872c9){_0x2744f5[_0x467c('0x60')]=isNaN(_0x2872c9[_0x467c('0x61')])?null:_0x2872c9['duration']*0x3e8;_0x2744f5[_0x467c('0x62')]=isNaN(_0x2872c9['sampleCount'])?null:_0x2872c9['sampleCount'];_0x2744f5['original_channelCount']=isNaN(_0x2872c9[_0x467c('0x63')])?null:_0x2872c9[_0x467c('0x63')];_0x2744f5[_0x467c('0x64')]=isNaN(_0x2872c9['bitRate'])?null:_0x2872c9['bitRate'];_0x2744f5[_0x467c('0x65')]=isNaN(_0x2872c9[_0x467c('0x66')])?null:_0x2872c9['sampleRate'];});_0x3641f0['on'](_0x467c('0x67'),function(_0x1c09f8){_0x2744f5[_0x467c('0x68')]=isNaN(_0x1c09f8[_0x467c('0x61')])?null:_0x1c09f8[_0x467c('0x61')]*0x3e8;_0x2744f5[_0x467c('0x69')]=isNaN(_0x1c09f8[_0x467c('0x6a')])?null:_0x1c09f8[_0x467c('0x6a')];_0x2744f5[_0x467c('0x6b')]=isNaN(_0x1c09f8['channelCount'])?null:_0x1c09f8[_0x467c('0x63')];_0x2744f5[_0x467c('0x6c')]=isNaN(_0x1c09f8[_0x467c('0x6d')])?null:_0x1c09f8['bitRate'];_0x2744f5[_0x467c('0x6e')]=isNaN(_0x1c09f8[_0x467c('0x66')])?null:_0x1c09f8[_0x467c('0x66')];});_0x3641f0['on']('end',function(){fs[_0x467c('0x5b')](_0x19dc3a,parseInt(_0x467c('0x5c'),0x8));return db['Sound']['create'](_0x2744f5)[_0x467c('0x20')](function(_0x2cff9a){var _0x590506={'role':_0x4017a5[_0x467c('0x6f')][_0x467c('0x70')],'userProfileId':_0x4017a5['body']['userProfileId']};if(!_0x590506)throw new Error(_0x467c('0x71'));if(_0x590506['role']===_0x467c('0x72')){var _0x290553=_0x2cff9a[_0x467c('0x22')]({'plain':!![]});return db[_0x467c('0x73')][_0x467c('0x47')]({'where':{'name':_0x467c('0x23'),'userProfileId':_0x590506[_0x467c('0x74')]},'raw':!![]})['then'](function(_0x263293){if(_0x263293&&_0x263293[_0x467c('0x75')]===0x0){return db[_0x467c('0x76')][_0x467c('0x77')]({'name':_0x290553[_0x467c('0x27')],'resourceId':_0x290553['id'],'type':_0x263293['name'],'sectionId':_0x263293['id']},{})[_0x467c('0x20')](function(){return _0x2cff9a;});}else{return _0x2cff9a;}})[_0x467c('0x41')](function(_0x500289){logger['error'](_0x467c('0x78'),_0x500289);throw _0x500289;});}return _0x2cff9a;})[_0x467c('0x20')](respondWithResult(_0x2c754b,null))[_0x467c('0x41')](handleError(_0x2c754b,null));});_0x3641f0[_0x467c('0x79')]();}catch(_0x3ed1f1){_0x2c754b[_0x467c('0x17')](0x1f4)[_0x467c('0x28')](_0x3ed1f1);}};exports[_0x467c('0x1f')]=function(_0x58ad3a,_0x558832,_0x37c14b){return db[_0x467c('0x3d')][_0x467c('0x47')]({'where':{'id':_0x58ad3a[_0x467c('0x43')]['id']}})['then'](handleEntityNotFound(_0x558832,null))[_0x467c('0x20')](saveUpdates(_['pick'](_0x58ad3a[_0x467c('0x6f')],[_0x467c('0x27'),_0x467c('0x7a')]),null))[_0x467c('0x20')](respondWithResult(_0x558832,null))[_0x467c('0x41')](handleError(_0x558832,null));};exports[_0x467c('0x7b')]=function(_0x244f48,_0x51a603,_0xc2495d){return db[_0x467c('0x3d')][_0x467c('0x47')]({'where':{'id':_0x244f48[_0x467c('0x43')]['id']}})['then'](function(_0x21169d){if(_0x21169d){return _0x21169d[_0x467c('0x21')]();}})[_0x467c('0x20')](function(_0x5cfd86){var _0x415c03=path[_0x467c('0x4b')](config['root'],_0x467c('0x7c'),util[_0x467c('0x50')](_0x467c('0x51'),_0x5cfd86['save_name'],_0x5cfd86[_0x467c('0x7d')]));var _0x4b5e4d=path[_0x467c('0x4b')](config['root'],_0x467c('0x4d'),util[_0x467c('0x50')](_0x467c('0x51'),_0x5cfd86['save_name'],_0x5cfd86[_0x467c('0x4a')]));fs['unlinkSync'](_0x415c03);fs[_0x467c('0x5e')](_0x4b5e4d);return _0x5cfd86;})[_0x467c('0x20')](function(_0x445abd){if(_0x445abd){return _0x51a603[_0x467c('0x17')](0xcc)[_0x467c('0x18')]();}})[_0x467c('0x20')](handleEntityNotFound(_0x51a603,null))['catch'](handleError(_0x51a603,null));}; \ No newline at end of file +var _0xf0e8=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','keys','filters','intersection','include','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','%s.%s','format','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','src','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf0e8,0x173));var _0x8f0e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf0e8[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x8f0e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8f0e('0x1'));var zipdir=require(_0x8f0e('0x2'));var jsonpatch=require(_0x8f0e('0x3'));var rp=require(_0x8f0e('0x4'));var moment=require(_0x8f0e('0x5'));var BPromise=require(_0x8f0e('0x6'));var Mustache=require(_0x8f0e('0x7'));var util=require(_0x8f0e('0x8'));var path=require(_0x8f0e('0x9'));var sox=require(_0x8f0e('0xa'));var csv=require(_0x8f0e('0xb'));var ejs=require(_0x8f0e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f0e('0xd'));var crypto=require(_0x8f0e('0xe'));var jsforce=require(_0x8f0e('0xf'));var deskjs=require(_0x8f0e('0x10'));var toCsv=require(_0x8f0e('0xb'));var querystring=require(_0x8f0e('0x11'));var Papa=require(_0x8f0e('0x12'));var Redis=require(_0x8f0e('0x13'));var authService=require(_0x8f0e('0x14'));var qs=require(_0x8f0e('0x15'));var as=require(_0x8f0e('0x16'));var hardwareService=require(_0x8f0e('0x17'));var logger=require(_0x8f0e('0x18'))(_0x8f0e('0x19'));var utils=require('../../config/utils');var config=require(_0x8f0e('0x1a'));var licenseUtil=require(_0x8f0e('0x1b'));var db=require(_0x8f0e('0x1c'))['db'];function respondWithStatusCode(_0x364f82,_0x1a8145){_0x1a8145=_0x1a8145||0xcc;return function(_0x269085){if(_0x269085){return _0x364f82['sendStatus'](_0x1a8145);}return _0x364f82['status'](_0x1a8145)[_0x8f0e('0x1d')]();};}function respondWithResult(_0x37d605,_0x53ca95){_0x53ca95=_0x53ca95||0xc8;return function(_0x134ae7){if(_0x134ae7){return _0x37d605['status'](_0x53ca95)[_0x8f0e('0x1e')](_0x134ae7);}};}function respondWithFilteredResult(_0xc72463,_0x7bd907){return function(_0x5d5f01){if(_0x5d5f01){var _0x577857=_0x5d5f01[_0x8f0e('0x1f')],_0x4dd04f=_0x7bd907[_0x8f0e('0x20')],_0x3f7a47=_0x7bd907['offset']+_0x7bd907[_0x8f0e('0x21')],_0x14befb;if(_0x3f7a47>=_0x577857){_0x3f7a47=_0x577857;_0x14befb=0xc8;}else{_0x14befb=0xce;}_0xc72463[_0x8f0e('0x22')](_0x14befb);return _0xc72463['set'](_0x8f0e('0x23'),_0x4dd04f+'-'+_0x3f7a47+'/'+_0x577857)[_0x8f0e('0x1e')](_0x5d5f01);}return null;};}function patchUpdates(_0xb1900c){return function(_0x9f9c15){try{jsonpatch[_0x8f0e('0x24')](_0x9f9c15,_0xb1900c,!![]);}catch(_0xfcd764){return BPromise[_0x8f0e('0x25')](_0xfcd764);}return _0x9f9c15[_0x8f0e('0x26')]();};}function saveUpdates(_0x493493,_0x1cc5e5){return function(_0x2238e7){if(_0x2238e7){return _0x2238e7[_0x8f0e('0x27')](_0x493493)[_0x8f0e('0x28')](function(_0x1bd4ec){return _0x1bd4ec;});}return null;};}function removeEntity(_0x219804,_0x2a2647){return function(_0x371ce3){if(_0x371ce3){return _0x371ce3[_0x8f0e('0x29')]()[_0x8f0e('0x28')](function(){var _0x36cea5=_0x371ce3[_0x8f0e('0x2a')]({'plain':!![]});var _0x32983c=_0x8f0e('0x2b');return db[_0x8f0e('0x2c')]['destroy']({'where':{'type':_0x32983c,'resourceId':_0x36cea5['id']}})[_0x8f0e('0x28')](function(){return _0x371ce3;});})['then'](function(){_0x219804[_0x8f0e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x455b30,_0x5e8bde){return function(_0x53dcba){if(!_0x53dcba){_0x455b30[_0x8f0e('0x2d')](0x194);}return _0x53dcba;};}function handleError(_0x3e8eeb,_0x18212f){_0x18212f=_0x18212f||0x1f4;return function(_0x3882a5){logger['error'](_0x3882a5[_0x8f0e('0x2e')]);if(_0x3882a5[_0x8f0e('0x2f')]){delete _0x3882a5['name'];}_0x3e8eeb[_0x8f0e('0x22')](_0x18212f)[_0x8f0e('0x30')](_0x3882a5);};}exports[_0x8f0e('0x31')]=function(_0x1ceec2,_0x56c3ec){var _0x2bc535={},_0x5aac82={},_0x4f850e={'count':0x0,'rows':[]};var _0x47ae50=_[_0x8f0e('0x32')](db[_0x8f0e('0x33')][_0x8f0e('0x34')],function(_0x199329){return{'name':_0x199329['fieldName'],'type':_0x199329[_0x8f0e('0x35')][_0x8f0e('0x36')]};});_0x5aac82[_0x8f0e('0x37')]=_[_0x8f0e('0x32')](_0x47ae50,_0x8f0e('0x2f'));_0x5aac82[_0x8f0e('0x38')]=_['keys'](_0x1ceec2[_0x8f0e('0x38')]);_0x5aac82['filters']=_['intersection'](_0x5aac82[_0x8f0e('0x37')],_0x5aac82[_0x8f0e('0x38')]);_0x2bc535[_0x8f0e('0x39')]=_['intersection'](_0x5aac82[_0x8f0e('0x37')],qs['fields'](_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x3a')]));_0x2bc535['attributes']=_0x2bc535[_0x8f0e('0x39')][_0x8f0e('0x3b')]?_0x2bc535['attributes']:_0x5aac82[_0x8f0e('0x37')];if(!_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x3c')]('nolimit')){_0x2bc535[_0x8f0e('0x21')]=qs['limit'](_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x21')]);_0x2bc535[_0x8f0e('0x20')]=qs[_0x8f0e('0x20')](_0x1ceec2['query'][_0x8f0e('0x20')]);}_0x2bc535[_0x8f0e('0x3d')]=qs[_0x8f0e('0x3e')](_0x1ceec2['query'][_0x8f0e('0x3e')]);_0x2bc535[_0x8f0e('0x3f')]=qs['filters'](_[_0x8f0e('0x40')](_0x1ceec2[_0x8f0e('0x38')],_0x5aac82['filters']),_0x47ae50);if(_0x1ceec2[_0x8f0e('0x38')][_0x8f0e('0x41')]){_0x2bc535[_0x8f0e('0x3f')]=_['merge'](_0x2bc535[_0x8f0e('0x3f')],{'$or':_[_0x8f0e('0x32')](_0x47ae50,function(_0x426708){if(_0x426708[_0x8f0e('0x35')]!==_0x8f0e('0x42')){var _0x197e6e={};_0x197e6e[_0x426708['name']]={'$like':'%'+_0x1ceec2['query']['filter']+'%'};return _0x197e6e;}})});}_0x2bc535=_[_0x8f0e('0x43')]({},_0x2bc535,_0x1ceec2['options']);var _0x4726fe={'where':_0x2bc535['where']};return db[_0x8f0e('0x33')]['count'](_0x4726fe)[_0x8f0e('0x28')](function(_0x26aabc){_0x4f850e[_0x8f0e('0x1f')]=_0x26aabc;if(_0x1ceec2['query'][_0x8f0e('0x44')]){_0x2bc535['include']=[{'all':!![]}];}return db[_0x8f0e('0x33')][_0x8f0e('0x45')](_0x2bc535);})['then'](function(_0xc5777d){_0x4f850e['rows']=_0xc5777d;return _0x4f850e;})[_0x8f0e('0x28')](respondWithFilteredResult(_0x56c3ec,_0x2bc535))[_0x8f0e('0x46')](handleError(_0x56c3ec,null));};exports[_0x8f0e('0x47')]=function(_0x53f1af,_0x5ae124){var _0x1da02f={'raw':!![],'where':{'id':_0x53f1af[_0x8f0e('0x48')]['id']}},_0x530296={};_0x530296['model']=_[_0x8f0e('0x49')](db[_0x8f0e('0x33')][_0x8f0e('0x34')]);_0x530296[_0x8f0e('0x38')]=_[_0x8f0e('0x49')](_0x53f1af[_0x8f0e('0x38')]);_0x530296[_0x8f0e('0x4a')]=_[_0x8f0e('0x4b')](_0x530296[_0x8f0e('0x37')],_0x530296[_0x8f0e('0x38')]);_0x1da02f[_0x8f0e('0x39')]=_[_0x8f0e('0x4b')](_0x530296[_0x8f0e('0x37')],qs[_0x8f0e('0x3a')](_0x53f1af[_0x8f0e('0x38')][_0x8f0e('0x3a')]));_0x1da02f[_0x8f0e('0x39')]=_0x1da02f['attributes']['length']?_0x1da02f[_0x8f0e('0x39')]:_0x530296['model'];if(_0x53f1af[_0x8f0e('0x38')]['includeAll']){_0x1da02f[_0x8f0e('0x4c')]=[{'all':!![]}];}_0x1da02f=_[_0x8f0e('0x43')]({},_0x1da02f,_0x53f1af[_0x8f0e('0x4d')]);return db[_0x8f0e('0x33')][_0x8f0e('0x4e')](_0x1da02f)['then'](handleEntityNotFound(_0x5ae124,null))[_0x8f0e('0x28')](respondWithResult(_0x5ae124,null))['catch'](handleError(_0x5ae124,null));};exports[_0x8f0e('0x4f')]=function(_0x407322,_0x4404c2,_0x3ef821){return db[_0x8f0e('0x33')][_0x8f0e('0x4e')]({'where':{'id':_0x407322['params']['id']},'attributes':[_0x8f0e('0x2f'),_0x8f0e('0x50'),_0x8f0e('0x51')],'raw':!![]})[_0x8f0e('0x28')](handleEntityNotFound(_0x4404c2,null))['then'](function(_0x320a2b){if(_0x320a2b){if(!fs[_0x8f0e('0x52')](path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x55'),_0x320a2b['save_name']+'.'+_0x320a2b[_0x8f0e('0x51')]))){throw new db[(_0x8f0e('0x56'))][(_0x8f0e('0x57'))]('Sound\x20not\x20found');}return _0x4404c2[_0x8f0e('0x4f')](path['join'](config[_0x8f0e('0x54')],_0x8f0e('0x55'),util['format'](_0x8f0e('0x58'),_0x320a2b[_0x8f0e('0x50')],_0x320a2b['converted_format'])),util[_0x8f0e('0x59')]('%s.%s',_0x320a2b['name'],_0x320a2b[_0x8f0e('0x51')]));}return null;})['catch'](handleError(_0x4404c2,null));};exports[_0x8f0e('0x5a')]=function(_0x2f8925,_0x285c33,_0x547c7a){var _0x2e4076={'name':path[_0x8f0e('0x5b')](_0x2f8925[_0x8f0e('0x5c')]['originalname'],path[_0x8f0e('0x5d')](_0x2f8925[_0x8f0e('0x5c')][_0x8f0e('0x5e')])),'save_name':path['basename'](_0x2f8925[_0x8f0e('0x5c')][_0x8f0e('0x5f')],path[_0x8f0e('0x5d')](_0x2f8925['file']['filename'])),'original_format':path[_0x8f0e('0x5d')](_0x2f8925[_0x8f0e('0x5c')]['originalname'])[_0x8f0e('0x60')](0x1),'converted_format':_0x8f0e('0x61')};var _0x197837=path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x62'),_0x2f8925[_0x8f0e('0x5c')][_0x8f0e('0x5f')]);var _0x1b50b0=path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x55'),util[_0x8f0e('0x59')]('%s.%s',path['basename'](_0x2f8925['file']['filename'],path['extname'](_0x2f8925['file'][_0x8f0e('0x5f')])),_0x2e4076[_0x8f0e('0x51')]));logger[_0x8f0e('0x63')](_0x8f0e('0x64'),_0x197837);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1b50b0);try{fs[_0x8f0e('0x65')](_0x197837,parseInt('0777',0x8));var _0x28fef8=sox['transcode'](_0x197837,_0x1b50b0,{'sampleRate':0x1f40,'format':_0x8f0e('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x28fef8['on']('error',function(_0x51977b){fs['unlinkSync'](_0x197837);_0x285c33[_0x8f0e('0x22')](0x1f4)['send'](_0x51977b);});_0x28fef8['on'](_0x8f0e('0x66'),function(_0x2b02f3){_0x2e4076[_0x8f0e('0x67')]=isNaN(_0x2b02f3['duration'])?null:_0x2b02f3['duration']*0x3e8;_0x2e4076[_0x8f0e('0x68')]=isNaN(_0x2b02f3[_0x8f0e('0x69')])?null:_0x2b02f3[_0x8f0e('0x69')];_0x2e4076[_0x8f0e('0x6a')]=isNaN(_0x2b02f3[_0x8f0e('0x6b')])?null:_0x2b02f3[_0x8f0e('0x6b')];_0x2e4076[_0x8f0e('0x6c')]=isNaN(_0x2b02f3[_0x8f0e('0x6d')])?null:_0x2b02f3[_0x8f0e('0x6d')];_0x2e4076['original_sampleRate']=isNaN(_0x2b02f3['sampleRate'])?null:_0x2b02f3[_0x8f0e('0x6e')];});_0x28fef8['on']('dest',function(_0x4be8d5){_0x2e4076[_0x8f0e('0x6f')]=isNaN(_0x4be8d5[_0x8f0e('0x70')])?null:_0x4be8d5[_0x8f0e('0x70')]*0x3e8;_0x2e4076[_0x8f0e('0x71')]=isNaN(_0x4be8d5[_0x8f0e('0x69')])?null:_0x4be8d5[_0x8f0e('0x69')];_0x2e4076[_0x8f0e('0x72')]=isNaN(_0x4be8d5['channelCount'])?null:_0x4be8d5[_0x8f0e('0x6b')];_0x2e4076['converted_bitRate']=isNaN(_0x4be8d5[_0x8f0e('0x6d')])?null:_0x4be8d5[_0x8f0e('0x6d')];_0x2e4076['converted_sampleRate']=isNaN(_0x4be8d5[_0x8f0e('0x6e')])?null:_0x4be8d5['sampleRate'];});_0x28fef8['on'](_0x8f0e('0x1d'),function(){fs[_0x8f0e('0x65')](_0x1b50b0,parseInt(_0x8f0e('0x73'),0x8));return db[_0x8f0e('0x33')]['create'](_0x2e4076)[_0x8f0e('0x28')](function(_0x2af7f6){var _0x8af55f={'role':_0x2f8925[_0x8f0e('0x74')]['role'],'userProfileId':_0x2f8925['body'][_0x8f0e('0x75')]};if(!_0x8af55f)throw new Error(_0x8f0e('0x76'));if(_0x8af55f[_0x8f0e('0x77')]===_0x8f0e('0x78')){var _0xce9511=_0x2af7f6[_0x8f0e('0x2a')]({'plain':!![]});return db[_0x8f0e('0x79')][_0x8f0e('0x4e')]({'where':{'name':_0x8f0e('0x2b'),'userProfileId':_0x8af55f['userProfileId']},'raw':!![]})[_0x8f0e('0x28')](function(_0x3d7997){if(_0x3d7997&&_0x3d7997[_0x8f0e('0x7a')]===0x0){return db[_0x8f0e('0x2c')][_0x8f0e('0x5a')]({'name':_0xce9511[_0x8f0e('0x2f')],'resourceId':_0xce9511['id'],'type':_0x3d7997[_0x8f0e('0x2f')],'sectionId':_0x3d7997['id']},{})['then'](function(){return _0x2af7f6;});}else{return _0x2af7f6;}})['catch'](function(_0x54341c){logger[_0x8f0e('0x7b')](_0x8f0e('0x7c'),_0x54341c);throw _0x54341c;});}return _0x2af7f6;})[_0x8f0e('0x28')](respondWithResult(_0x285c33,null))[_0x8f0e('0x46')](handleError(_0x285c33,null));});_0x28fef8[_0x8f0e('0x7d')]();}catch(_0x58a4e5){_0x285c33['status'](0x1f4)[_0x8f0e('0x30')](_0x58a4e5);}};exports['update']=function(_0x5ba249,_0x3e3e0a,_0x3783c9){return db[_0x8f0e('0x33')][_0x8f0e('0x4e')]({'where':{'id':_0x5ba249[_0x8f0e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e3e0a,null))[_0x8f0e('0x28')](saveUpdates(_[_0x8f0e('0x40')](_0x5ba249[_0x8f0e('0x74')],['name',_0x8f0e('0x7e')]),null))[_0x8f0e('0x28')](respondWithResult(_0x3e3e0a,null))[_0x8f0e('0x46')](handleError(_0x3e3e0a,null));};exports['delete']=function(_0x2a3deb,_0x4fcd6d,_0x12f27f){return db[_0x8f0e('0x33')]['find']({'where':{'id':_0x2a3deb[_0x8f0e('0x48')]['id']}})[_0x8f0e('0x28')](function(_0x358a53){if(_0x358a53){return _0x358a53[_0x8f0e('0x29')]();}})[_0x8f0e('0x28')](function(_0x1dc40d){var _0x48759e=path[_0x8f0e('0x53')](config[_0x8f0e('0x54')],_0x8f0e('0x62'),util[_0x8f0e('0x59')]('%s.%s',_0x1dc40d['save_name'],_0x1dc40d['original_format']));var _0xbd605a=path['join'](config[_0x8f0e('0x54')],_0x8f0e('0x55'),util[_0x8f0e('0x59')](_0x8f0e('0x58'),_0x1dc40d[_0x8f0e('0x50')],_0x1dc40d['converted_format']));fs[_0x8f0e('0x7f')](_0x48759e);fs['unlinkSync'](_0xbd605a);return _0x1dc40d;})[_0x8f0e('0x28')](function(_0x20111b){if(_0x20111b){return _0x4fcd6d[_0x8f0e('0x22')](0xcc)[_0x8f0e('0x1d')]();}})[_0x8f0e('0x28')](handleEntityNotFound(_0x4fcd6d,null))['catch'](handleError(_0x4fcd6d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a5ae06f..a3fb3d6 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 _0xf3d0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x4d1d2c,_0x44f4d8){var _0x2c4cb9=function(_0x4b0c5f){while(--_0x4b0c5f){_0x4d1d2c['push'](_0x4d1d2c['shift']());}};_0x2c4cb9(++_0x44f4d8);}(_0xf3d0,0x1b2));var _0x0f3d=function(_0x21e8f9,_0x569e33){_0x21e8f9=_0x21e8f9-0x0;var _0x196c7f=_0xf3d0[_0x21e8f9];return _0x196c7f;};'use strict';var _=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var logger=require(_0x0f3d('0x2'))(_0x0f3d('0x3'));var moment=require(_0x0f3d('0x4'));var BPromise=require(_0x0f3d('0x5'));var rp=require(_0x0f3d('0x6'));var fs=require('fs');var path=require(_0x0f3d('0x7'));var rimraf=require(_0x0f3d('0x8'));var config=require(_0x0f3d('0x9'));var attributes=require(_0x0f3d('0xa'));module[_0x0f3d('0xb')]=function(_0xf5611b,_0xa034af){return _0xf5611b[_0x0f3d('0xc')](_0x0f3d('0xd'),attributes,{'tableName':_0x0f3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4682=['define','Sound','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x2e3065,_0x1e21bd){var _0x3a59d1=function(_0x1520f0){while(--_0x1520f0){_0x2e3065['push'](_0x2e3065['shift']());}};_0x3a59d1(++_0x1e21bd);}(_0x4682,0xa7));var _0x2468=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4682[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x2468('0x0'));var util=require(_0x2468('0x1'));var logger=require('../../config/logger')(_0x2468('0x2'));var moment=require('moment');var BPromise=require(_0x2468('0x3'));var rp=require(_0x2468('0x4'));var fs=require('fs');var path=require(_0x2468('0x5'));var rimraf=require(_0x2468('0x6'));var config=require(_0x2468('0x7'));var attributes=require(_0x2468('0x8'));module['exports']=function(_0x2e6fa6,_0x4b9592){return _0x2e6fa6[_0x2468('0x9')](_0x2468('0xa'),attributes,{'tableName':'tools_sounds','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 8444f11..70854f7 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 _0xbeec=['Sound,\x20%s,\x20%s','info','result','catch','ShowSound','Sound','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0xbeec,0xdf));var _0xcbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xcbee('0x0'));var moment=require('moment');var BPromise=require(_0xcbee('0x1'));var rs=require(_0xcbee('0x2'));var fs=require('fs');var Redis=require(_0xcbee('0x3'));var db=require(_0xcbee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbee('0x5'))(_0xcbee('0x6'));var config=require('../../config/environment');var jayson=require(_0xcbee('0x7'));var client=jayson[_0xcbee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26d02a,_0x1245ea,_0x107083){return new BPromise(function(_0x319659,_0x100a4b){return client[_0xcbee('0x9')](_0x26d02a,_0x107083)[_0xcbee('0xa')](function(_0x33a5ce){logger['info']('Sound,\x20%s,\x20%s',_0x1245ea,_0xcbee('0xb'));logger[_0xcbee('0xc')](_0xcbee('0xd'),_0x1245ea,_0xcbee('0xb'),JSON[_0xcbee('0xe')](_0x33a5ce));if(_0x33a5ce[_0xcbee('0xf')]){if(_0x33a5ce[_0xcbee('0xf')]['code']===0x1f4){logger[_0xcbee('0xf')]('Sound,\x20%s,\x20%s',_0x1245ea,_0x33a5ce['error'][_0xcbee('0x10')]);return _0x100a4b(_0x33a5ce[_0xcbee('0xf')][_0xcbee('0x10')]);}logger[_0xcbee('0xf')](_0xcbee('0x11'),_0x1245ea,_0x33a5ce['error'][_0xcbee('0x10')]);return _0x319659(_0x33a5ce[_0xcbee('0xf')][_0xcbee('0x10')]);}else{logger[_0xcbee('0x12')]('Sound,\x20%s,\x20%s',_0x1245ea,'request\x20sent');_0x319659(_0x33a5ce[_0xcbee('0x13')][_0xcbee('0x10')]);}})[_0xcbee('0x14')](function(_0x4a1c00){logger[_0xcbee('0xf')](_0xcbee('0x11'),_0x1245ea,_0x4a1c00);_0x100a4b(_0x4a1c00);});});}exports[_0xcbee('0x15')]=function(_0x1165ac){var _0x36fc1f=this;return new Promise(function(_0x31f37a,_0x379bd5){return db[_0xcbee('0x16')]['find']({'raw':_0x1165ac[_0xcbee('0x17')]?_0x1165ac['options'][_0xcbee('0x18')]===undefined?!![]:![]:!![],'where':_0x1165ac[_0xcbee('0x17')]?_0x1165ac[_0xcbee('0x17')][_0xcbee('0x19')]||null:null,'attributes':_0x1165ac['options']?_0x1165ac['options']['attributes']||null:null,'include':_0x1165ac[_0xcbee('0x17')]?_0x1165ac[_0xcbee('0x17')][_0xcbee('0x1a')]?_[_0xcbee('0x1b')](_0x1165ac[_0xcbee('0x17')][_0xcbee('0x1a')],function(_0xe780c5){return{'model':db[_0xe780c5[_0xcbee('0x1c')]],'as':_0xe780c5['as'],'attributes':_0xe780c5[_0xcbee('0x1d')],'include':_0xe780c5['include']?_[_0xcbee('0x1b')](_0xe780c5['include'],function(_0x37ee9e){return{'model':db[_0x37ee9e['model']],'as':_0x37ee9e['as'],'attributes':_0x37ee9e[_0xcbee('0x1d')],'include':_0x37ee9e[_0xcbee('0x1a')]?_['map'](_0x37ee9e[_0xcbee('0x1a')],function(_0x50750d){return{'model':db[_0x50750d['model']],'as':_0x50750d['as'],'attributes':_0x50750d['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbee('0xa')](function(_0x1856ec){logger[_0xcbee('0x12')](_0xcbee('0x15'),_0x1165ac);logger[_0xcbee('0xc')](_0xcbee('0x15'),_0x1165ac,JSON[_0xcbee('0xe')](_0x1856ec));_0x31f37a(_0x1856ec);})[_0xcbee('0x14')](function(_0x3168df){logger[_0xcbee('0xf')](_0xcbee('0x15'),_0x3168df[_0xcbee('0x10')],_0x1165ac);_0x379bd5(_0x36fc1f['error'](0x1f4,_0x3168df[_0xcbee('0x10')]));});});}; \ No newline at end of file +var _0xc788=['debug','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','include','map','attributes','model'];(function(_0x550c75,_0x1d84fe){var _0x28624b=function(_0x37df51){while(--_0x37df51){_0x550c75['push'](_0x550c75['shift']());}};_0x28624b(++_0x1d84fe);}(_0xc788,0x156));var _0x8c78=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0xc788[_0x169a8a];return _0x2e8502;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c78('0x0'));var BPromise=require('bluebird');var rs=require(_0x8c78('0x1'));var fs=require('fs');var Redis=require(_0x8c78('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c78('0x3'));var logger=require('../../config/logger')(_0x8c78('0x4'));var config=require(_0x8c78('0x5'));var jayson=require(_0x8c78('0x6'));var client=jayson[_0x8c78('0x7')][_0x8c78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a17ba,_0x426cd5,_0x4733f0){return new BPromise(function(_0x393e51,_0x187a80){return client[_0x8c78('0x9')](_0x4a17ba,_0x4733f0)[_0x8c78('0xa')](function(_0x2b9bef){logger[_0x8c78('0xb')](_0x8c78('0xc'),_0x426cd5,'request\x20sent');logger['debug'](_0x8c78('0xd'),_0x426cd5,_0x8c78('0xe'),JSON['stringify'](_0x2b9bef));if(_0x2b9bef[_0x8c78('0xf')]){if(_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x10')]===0x1f4){logger['error'](_0x8c78('0xc'),_0x426cd5,_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x11')]);return _0x187a80(_0x2b9bef[_0x8c78('0xf')]['message']);}logger[_0x8c78('0xf')]('Sound,\x20%s,\x20%s',_0x426cd5,_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x11')]);return _0x393e51(_0x2b9bef[_0x8c78('0xf')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xb')]('Sound,\x20%s,\x20%s',_0x426cd5,_0x8c78('0xe'));_0x393e51(_0x2b9bef[_0x8c78('0x12')][_0x8c78('0x11')]);}})[_0x8c78('0x13')](function(_0x4483a5){logger['error'](_0x8c78('0xc'),_0x426cd5,_0x4483a5);_0x187a80(_0x4483a5);});});}exports[_0x8c78('0x14')]=function(_0x554fb1){var _0x6ff759=this;return new Promise(function(_0x39e1fc,_0x4d711a){return db[_0x8c78('0x15')][_0x8c78('0x16')]({'raw':_0x554fb1[_0x8c78('0x17')]?_0x554fb1[_0x8c78('0x17')][_0x8c78('0x18')]===undefined?!![]:![]:!![],'where':_0x554fb1['options']?_0x554fb1[_0x8c78('0x17')][_0x8c78('0x19')]||null:null,'attributes':_0x554fb1['options']?_0x554fb1[_0x8c78('0x17')]['attributes']||null:null,'include':_0x554fb1[_0x8c78('0x17')]?_0x554fb1[_0x8c78('0x17')][_0x8c78('0x1a')]?_[_0x8c78('0x1b')](_0x554fb1['options'][_0x8c78('0x1a')],function(_0x21fedb){return{'model':db[_0x21fedb['model']],'as':_0x21fedb['as'],'attributes':_0x21fedb[_0x8c78('0x1c')],'include':_0x21fedb[_0x8c78('0x1a')]?_[_0x8c78('0x1b')](_0x21fedb['include'],function(_0x32a779){return{'model':db[_0x32a779[_0x8c78('0x1d')]],'as':_0x32a779['as'],'attributes':_0x32a779[_0x8c78('0x1c')],'include':_0x32a779[_0x8c78('0x1a')]?_['map'](_0x32a779[_0x8c78('0x1a')],function(_0x76e138){return{'model':db[_0x76e138[_0x8c78('0x1d')]],'as':_0x76e138['as'],'attributes':_0x76e138['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x295334){logger[_0x8c78('0xb')](_0x8c78('0x14'),_0x554fb1);logger[_0x8c78('0x1e')](_0x8c78('0x14'),_0x554fb1,JSON['stringify'](_0x295334));_0x39e1fc(_0x295334);})[_0x8c78('0x13')](function(_0x329850){logger[_0x8c78('0xf')](_0x8c78('0x14'),_0x329850['message'],_0x554fb1);_0x4d711a(_0x6ff759[_0x8c78('0xf')](0x1f4,_0x329850[_0x8c78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 3663293..434b04b 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 _0x7fcb=['index','show','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get','isAuthenticated'];(function(_0x378bf4,_0x3c2061){var _0xd59b4=function(_0x5de8d6){while(--_0x5de8d6){_0x378bf4['push'](_0x378bf4['shift']());}};_0xd59b4(++_0x3c2061);}(_0x7fcb,0xf6));var _0xb7fc=function(_0x37e7a4,_0xb7a496){_0x37e7a4=_0x37e7a4-0x0;var _0x269b2a=_0x7fcb[_0x37e7a4];return _0x269b2a;};'use strict';var multer=require(_0xb7fc('0x0'));var util=require(_0xb7fc('0x1'));var path=require('path');var timeout=require(_0xb7fc('0x2'));var express=require(_0xb7fc('0x3'));var router=express[_0xb7fc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7fc('0x5'));var controller=require(_0xb7fc('0x6'));router[_0xb7fc('0x7')]('/',auth[_0xb7fc('0x8')](),controller[_0xb7fc('0x9')]);router[_0xb7fc('0x7')]('/:id',auth[_0xb7fc('0x8')](),controller[_0xb7fc('0xa')]);router[_0xb7fc('0xb')]('/',auth[_0xb7fc('0x8')](),controller['create']);router[_0xb7fc('0xc')](_0xb7fc('0xd'),auth[_0xb7fc('0x8')](),controller[_0xb7fc('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb7fc('0xf')]);module[_0xb7fc('0x10')]=router; \ No newline at end of file +var _0x136d=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','/:id','show','create'];(function(_0x26bfb4,_0x1673ed){var _0x53579a=function(_0x256635){while(--_0x256635){_0x26bfb4['push'](_0x26bfb4['shift']());}};_0x53579a(++_0x1673ed);}(_0x136d,0x135));var _0xd136=function(_0x179c89,_0x3a69b2){_0x179c89=_0x179c89-0x0;var _0x4b87e5=_0x136d[_0x179c89];return _0x4b87e5;};'use strict';var multer=require(_0xd136('0x0'));var util=require(_0xd136('0x1'));var path=require(_0xd136('0x2'));var timeout=require(_0xd136('0x3'));var express=require(_0xd136('0x4'));var router=express[_0xd136('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd136('0x6'));var config=require(_0xd136('0x7'));var controller=require(_0xd136('0x8'));router['get']('/',auth[_0xd136('0x9')](),controller['index']);router[_0xd136('0xa')](_0xd136('0xb'),auth[_0xd136('0x9')](),controller[_0xd136('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd136('0xd')]);router['put']('/:id',auth[_0xd136('0x9')](),controller[_0xd136('0xe')]);router[_0xd136('0xf')](_0xd136('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd136('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index daf7220..4a68bf0 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 _0x56a4=['STRING','sequelize','exports','TEXT','medium','out'];(function(_0x4ff2d1,_0x2fabe3){var _0x3377de=function(_0x485772){while(--_0x485772){_0x4ff2d1['push'](_0x4ff2d1['shift']());}};_0x3377de(++_0x2fabe3);}(_0x56a4,0x11b));var _0x456a=function(_0x13f2ec,_0x407206){_0x13f2ec=_0x13f2ec-0x0;var _0x389ca9=_0x56a4[_0x13f2ec];return _0x389ca9;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x456a('0x2')](_0x456a('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x456a('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x456a('0x5')]},'providerResponse':{'type':Sequelize[_0x456a('0x2')]}}; \ No newline at end of file +var _0x4b84=['medium','out','STRING','TEXT','sequelize','exports'];(function(_0x2ccf5e,_0x1fe9d9){var _0x3fcd82=function(_0x37e85e){while(--_0x37e85e){_0x2ccf5e['push'](_0x2ccf5e['shift']());}};_0x3fcd82(++_0x1fe9d9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x4b84[_0x22bee0];return _0x2d295b;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x44b8('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x44b8('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x44b8('0x4')]},'providerResponse':{'type':Sequelize[_0x44b8('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c3d147a..24b4ddf 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 _0xf9a4=['set','Content-Range','save','update','then','destroy','end','error','stack','name','SquareMessage','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit'];(function(_0x363618,_0x5ebf3a){var _0x496dee=function(_0x3b312a){while(--_0x3b312a){_0x363618['push'](_0x363618['shift']());}};_0x496dee(++_0x5ebf3a);}(_0xf9a4,0x13f));var _0x4f9a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf9a4[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x4f9a('0x0'));var emlformat=require(_0x4f9a('0x1'));var rimraf=require(_0x4f9a('0x2'));var zipdir=require(_0x4f9a('0x3'));var jsonpatch=require(_0x4f9a('0x4'));var rp=require('request-promise');var moment=require(_0x4f9a('0x5'));var BPromise=require(_0x4f9a('0x6'));var Mustache=require(_0x4f9a('0x7'));var util=require(_0x4f9a('0x8'));var path=require('path');var sox=require(_0x4f9a('0x9'));var csv=require('to-csv');var ejs=require(_0x4f9a('0xa'));var fs=require('fs');var _=require(_0x4f9a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f9a('0xc'));var toCsv=require(_0x4f9a('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f9a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4f9a('0xf'));var as=require(_0x4f9a('0x10'));var hardwareService=require(_0x4f9a('0x11'));var logger=require(_0x4f9a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4f9a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f9a('0x14'))['db'];function respondWithStatusCode(_0x2c812c,_0x1e302d){_0x1e302d=_0x1e302d||0xcc;return function(_0x15c0b6){if(_0x15c0b6){return _0x2c812c[_0x4f9a('0x15')](_0x1e302d);}return _0x2c812c['status'](_0x1e302d)['end']();};}function respondWithResult(_0x1dbdff,_0x59adc7){_0x59adc7=_0x59adc7||0xc8;return function(_0x3b9dfc){if(_0x3b9dfc){return _0x1dbdff[_0x4f9a('0x16')](_0x59adc7)[_0x4f9a('0x17')](_0x3b9dfc);}};}function respondWithFilteredResult(_0x4fa131,_0x1f076f){return function(_0x53c5e4){if(_0x53c5e4){var _0x533fec=_0x53c5e4['count'],_0x3b84ca=_0x1f076f[_0x4f9a('0x18')],_0x151c8a=_0x1f076f[_0x4f9a('0x18')]+_0x1f076f[_0x4f9a('0x19')],_0x574b28;if(_0x151c8a>=_0x533fec){_0x151c8a=_0x533fec;_0x574b28=0xc8;}else{_0x574b28=0xce;}_0x4fa131['status'](_0x574b28);return _0x4fa131[_0x4f9a('0x1a')](_0x4f9a('0x1b'),_0x3b84ca+'-'+_0x151c8a+'/'+_0x533fec)['json'](_0x53c5e4);}return null;};}function patchUpdates(_0xce8f8e){return function(_0x37d55c){try{jsonpatch['apply'](_0x37d55c,_0xce8f8e,!![]);}catch(_0x2f455f){return BPromise['reject'](_0x2f455f);}return _0x37d55c[_0x4f9a('0x1c')]();};}function saveUpdates(_0x1dddcc,_0x3ffe85){return function(_0x5d31ff){if(_0x5d31ff){return _0x5d31ff[_0x4f9a('0x1d')](_0x1dddcc)[_0x4f9a('0x1e')](function(_0x3164b6){return _0x3164b6;});}return null;};}function removeEntity(_0x5ddd8e,_0x39f4fb){return function(_0x4bc47b){if(_0x4bc47b){return _0x4bc47b[_0x4f9a('0x1f')]()[_0x4f9a('0x1e')](function(){_0x5ddd8e[_0x4f9a('0x16')](0xcc)[_0x4f9a('0x20')]();});}};}function handleEntityNotFound(_0x4a77f0,_0x42779e){return function(_0x32bd33){if(!_0x32bd33){_0x4a77f0['sendStatus'](0x194);}return _0x32bd33;};}function handleError(_0x131f59,_0x4df48d){_0x4df48d=_0x4df48d||0x1f4;return function(_0x149c40){logger[_0x4f9a('0x21')](_0x149c40[_0x4f9a('0x22')]);if(_0x149c40[_0x4f9a('0x23')]){delete _0x149c40['name'];}_0x131f59[_0x4f9a('0x16')](_0x4df48d)['send'](_0x149c40);};}exports['index']=function(_0x8471d0,_0x3903d0){var _0x5e1f24={},_0x1365da={},_0x587f2d={'count':0x0,'rows':[]};var _0xdddbb0=_['map'](db[_0x4f9a('0x24')][_0x4f9a('0x25')],function(_0xd26331){return{'name':_0xd26331[_0x4f9a('0x26')],'type':_0xd26331['type']['key']};});_0x1365da['model']=_[_0x4f9a('0x27')](_0xdddbb0,'name');_0x1365da[_0x4f9a('0x28')]=_[_0x4f9a('0x29')](_0x8471d0[_0x4f9a('0x28')]);_0x1365da[_0x4f9a('0x2a')]=_[_0x4f9a('0x2b')](_0x1365da[_0x4f9a('0x2c')],_0x1365da[_0x4f9a('0x28')]);_0x5e1f24['attributes']=_[_0x4f9a('0x2b')](_0x1365da[_0x4f9a('0x2c')],qs[_0x4f9a('0x2d')](_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x2d')]));_0x5e1f24[_0x4f9a('0x2e')]=_0x5e1f24[_0x4f9a('0x2e')][_0x4f9a('0x2f')]?_0x5e1f24[_0x4f9a('0x2e')]:_0x1365da[_0x4f9a('0x2c')];if(!_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x30')](_0x4f9a('0x31'))){_0x5e1f24[_0x4f9a('0x19')]=qs['limit'](_0x8471d0['query']['limit']);_0x5e1f24[_0x4f9a('0x18')]=qs['offset'](_0x8471d0['query'][_0x4f9a('0x18')]);}_0x5e1f24[_0x4f9a('0x32')]=qs[_0x4f9a('0x33')](_0x8471d0['query'][_0x4f9a('0x33')]);_0x5e1f24['where']=qs[_0x4f9a('0x2a')](_[_0x4f9a('0x34')](_0x8471d0[_0x4f9a('0x28')],_0x1365da[_0x4f9a('0x2a')]),_0xdddbb0);if(_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x35')]){_0x5e1f24['where']=_[_0x4f9a('0x36')](_0x5e1f24[_0x4f9a('0x37')],{'$or':_[_0x4f9a('0x27')](_0xdddbb0,function(_0x5727ec){if(_0x5727ec[_0x4f9a('0x38')]!==_0x4f9a('0x39')){var _0xaf0825={};_0xaf0825[_0x5727ec['name']]={'$like':'%'+_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x35')]+'%'};return _0xaf0825;}})});}_0x5e1f24=_[_0x4f9a('0x36')]({},_0x5e1f24,_0x8471d0[_0x4f9a('0x3a')]);var _0x2bc35d={'where':_0x5e1f24[_0x4f9a('0x37')]};return db['SquareMessage'][_0x4f9a('0x3b')](_0x2bc35d)[_0x4f9a('0x1e')](function(_0x1e1a80){_0x587f2d['count']=_0x1e1a80;if(_0x8471d0[_0x4f9a('0x28')][_0x4f9a('0x3c')]){_0x5e1f24[_0x4f9a('0x3d')]=[{'all':!![]}];}return db[_0x4f9a('0x24')][_0x4f9a('0x3e')](_0x5e1f24);})[_0x4f9a('0x1e')](function(_0xf5961f){_0x587f2d['rows']=_0xf5961f;return _0x587f2d;})['then'](respondWithFilteredResult(_0x3903d0,_0x5e1f24))['catch'](handleError(_0x3903d0,null));};exports[_0x4f9a('0x3f')]=function(_0x252a2a,_0x2ad30f){var _0x4a5114={'raw':!![],'where':{'id':_0x252a2a[_0x4f9a('0x40')]['id']}},_0x4485ac={};_0x4485ac[_0x4f9a('0x2c')]=_[_0x4f9a('0x29')](db[_0x4f9a('0x24')]['rawAttributes']);_0x4485ac[_0x4f9a('0x28')]=_[_0x4f9a('0x29')](_0x252a2a[_0x4f9a('0x28')]);_0x4485ac['filters']=_['intersection'](_0x4485ac[_0x4f9a('0x2c')],_0x4485ac[_0x4f9a('0x28')]);_0x4a5114[_0x4f9a('0x2e')]=_[_0x4f9a('0x2b')](_0x4485ac[_0x4f9a('0x2c')],qs[_0x4f9a('0x2d')](_0x252a2a[_0x4f9a('0x28')]['fields']));_0x4a5114['attributes']=_0x4a5114[_0x4f9a('0x2e')]['length']?_0x4a5114['attributes']:_0x4485ac[_0x4f9a('0x2c')];if(_0x252a2a[_0x4f9a('0x28')][_0x4f9a('0x3c')]){_0x4a5114['include']=[{'all':!![]}];}_0x4a5114=_['merge']({},_0x4a5114,_0x252a2a[_0x4f9a('0x3a')]);return db['SquareMessage'][_0x4f9a('0x41')](_0x4a5114)['then'](handleEntityNotFound(_0x2ad30f,null))['then'](respondWithResult(_0x2ad30f,null))['catch'](handleError(_0x2ad30f,null));};exports[_0x4f9a('0x42')]=function(_0x329f54,_0x13eee3){return db[_0x4f9a('0x24')]['create'](_0x329f54[_0x4f9a('0x43')],{})[_0x4f9a('0x1e')](respondWithResult(_0x13eee3,0xc9))[_0x4f9a('0x44')](handleError(_0x13eee3,null));};exports[_0x4f9a('0x1d')]=function(_0xda9609,_0x189737){if(_0xda9609['body']['id']){delete _0xda9609[_0x4f9a('0x43')]['id'];}return db[_0x4f9a('0x24')][_0x4f9a('0x41')]({'where':{'id':_0xda9609['params']['id']}})['then'](handleEntityNotFound(_0x189737,null))[_0x4f9a('0x1e')](saveUpdates(_0xda9609[_0x4f9a('0x43')],null))['then'](respondWithResult(_0x189737,null))['catch'](handleError(_0x189737,null));};exports[_0x4f9a('0x1f')]=function(_0x10b608,_0x50d0df){return db[_0x4f9a('0x24')][_0x4f9a('0x41')]({'where':{'id':_0x10b608[_0x4f9a('0x40')]['id']}})['then'](handleEntityNotFound(_0x50d0df,null))[_0x4f9a('0x1e')](removeEntity(_0x50d0df,null))[_0x4f9a('0x44')](handleError(_0x50d0df,null));}; \ No newline at end of file +var _0xfeb7=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','SquareMessage','catch','params','include','create','body','update','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xfeb7,0xc9));var _0x7feb=function(_0x5201c5,_0xb32238){_0x5201c5=_0x5201c5-0x0;var _0x3bf676=_0xfeb7[_0x5201c5];return _0x3bf676;};'use strict';var pdf=require(_0x7feb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7feb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7feb('0x2'));var rp=require(_0x7feb('0x3'));var moment=require(_0x7feb('0x4'));var BPromise=require(_0x7feb('0x5'));var Mustache=require(_0x7feb('0x6'));var util=require(_0x7feb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7feb('0x8'));var ejs=require(_0x7feb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7feb('0xa'));var crypto=require(_0x7feb('0xb'));var jsforce=require(_0x7feb('0xc'));var deskjs=require(_0x7feb('0xd'));var toCsv=require(_0x7feb('0x8'));var querystring=require(_0x7feb('0xe'));var Papa=require(_0x7feb('0xf'));var Redis=require('ioredis');var authService=require(_0x7feb('0x10'));var qs=require(_0x7feb('0x11'));var as=require(_0x7feb('0x12'));var hardwareService=require(_0x7feb('0x13'));var logger=require(_0x7feb('0x14'))('api');var utils=require(_0x7feb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7feb('0x16'));var db=require(_0x7feb('0x17'))['db'];function respondWithStatusCode(_0x55924d,_0x2702ad){_0x2702ad=_0x2702ad||0xcc;return function(_0x5a8127){if(_0x5a8127){return _0x55924d[_0x7feb('0x18')](_0x2702ad);}return _0x55924d[_0x7feb('0x19')](_0x2702ad)[_0x7feb('0x1a')]();};}function respondWithResult(_0x1f9b23,_0x4c0f19){_0x4c0f19=_0x4c0f19||0xc8;return function(_0x1c4c8f){if(_0x1c4c8f){return _0x1f9b23['status'](_0x4c0f19)['json'](_0x1c4c8f);}};}function respondWithFilteredResult(_0x442c2,_0x3768b5){return function(_0x37bd59){if(_0x37bd59){var _0x33fab8=_0x37bd59[_0x7feb('0x1b')],_0x10569e=_0x3768b5[_0x7feb('0x1c')],_0x4d09ae=_0x3768b5[_0x7feb('0x1c')]+_0x3768b5[_0x7feb('0x1d')],_0x7f8b55;if(_0x4d09ae>=_0x33fab8){_0x4d09ae=_0x33fab8;_0x7f8b55=0xc8;}else{_0x7f8b55=0xce;}_0x442c2[_0x7feb('0x19')](_0x7f8b55);return _0x442c2[_0x7feb('0x1e')](_0x7feb('0x1f'),_0x10569e+'-'+_0x4d09ae+'/'+_0x33fab8)[_0x7feb('0x20')](_0x37bd59);}return null;};}function patchUpdates(_0xbb3f9c){return function(_0x3cc709){try{jsonpatch[_0x7feb('0x21')](_0x3cc709,_0xbb3f9c,!![]);}catch(_0x223e2b){return BPromise[_0x7feb('0x22')](_0x223e2b);}return _0x3cc709[_0x7feb('0x23')]();};}function saveUpdates(_0xe7f23e,_0xe0c78c){return function(_0xa57717){if(_0xa57717){return _0xa57717['update'](_0xe7f23e)['then'](function(_0x2204fb){return _0x2204fb;});}return null;};}function removeEntity(_0x3388f4,_0x7c4c90){return function(_0x47508c){if(_0x47508c){return _0x47508c[_0x7feb('0x24')]()[_0x7feb('0x25')](function(){_0x3388f4[_0x7feb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1ee1,_0x199304){return function(_0x358cb0){if(!_0x358cb0){_0x4e1ee1['sendStatus'](0x194);}return _0x358cb0;};}function handleError(_0x4c3e10,_0x31e90f){_0x31e90f=_0x31e90f||0x1f4;return function(_0x451c39){logger[_0x7feb('0x26')](_0x451c39[_0x7feb('0x27')]);if(_0x451c39[_0x7feb('0x28')]){delete _0x451c39[_0x7feb('0x28')];}_0x4c3e10['status'](_0x31e90f)[_0x7feb('0x29')](_0x451c39);};}exports[_0x7feb('0x2a')]=function(_0x775536,_0x420529){var _0x390e80={},_0x486f8e={},_0xc7e7d0={'count':0x0,'rows':[]};var _0x59d5f8=_['map'](db['SquareMessage'][_0x7feb('0x2b')],function(_0x3b40f2){return{'name':_0x3b40f2[_0x7feb('0x2c')],'type':_0x3b40f2[_0x7feb('0x2d')][_0x7feb('0x2e')]};});_0x486f8e[_0x7feb('0x2f')]=_[_0x7feb('0x30')](_0x59d5f8,_0x7feb('0x28'));_0x486f8e[_0x7feb('0x31')]=_[_0x7feb('0x32')](_0x775536[_0x7feb('0x31')]);_0x486f8e[_0x7feb('0x33')]=_[_0x7feb('0x34')](_0x486f8e['model'],_0x486f8e[_0x7feb('0x31')]);_0x390e80[_0x7feb('0x35')]=_['intersection'](_0x486f8e[_0x7feb('0x2f')],qs['fields'](_0x775536['query'][_0x7feb('0x36')]));_0x390e80[_0x7feb('0x35')]=_0x390e80[_0x7feb('0x35')][_0x7feb('0x37')]?_0x390e80[_0x7feb('0x35')]:_0x486f8e['model'];if(!_0x775536['query']['hasOwnProperty'](_0x7feb('0x38'))){_0x390e80[_0x7feb('0x1d')]=qs[_0x7feb('0x1d')](_0x775536[_0x7feb('0x31')][_0x7feb('0x1d')]);_0x390e80[_0x7feb('0x1c')]=qs[_0x7feb('0x1c')](_0x775536[_0x7feb('0x31')]['offset']);}_0x390e80[_0x7feb('0x39')]=qs[_0x7feb('0x3a')](_0x775536[_0x7feb('0x31')][_0x7feb('0x3a')]);_0x390e80[_0x7feb('0x3b')]=qs['filters'](_[_0x7feb('0x3c')](_0x775536[_0x7feb('0x31')],_0x486f8e[_0x7feb('0x33')]),_0x59d5f8);if(_0x775536['query'][_0x7feb('0x3d')]){_0x390e80[_0x7feb('0x3b')]=_[_0x7feb('0x3e')](_0x390e80[_0x7feb('0x3b')],{'$or':_[_0x7feb('0x30')](_0x59d5f8,function(_0xdc3e6a){if(_0xdc3e6a[_0x7feb('0x2d')]!=='VIRTUAL'){var _0xebf989={};_0xebf989[_0xdc3e6a[_0x7feb('0x28')]]={'$like':'%'+_0x775536[_0x7feb('0x31')][_0x7feb('0x3d')]+'%'};return _0xebf989;}})});}_0x390e80=_[_0x7feb('0x3e')]({},_0x390e80,_0x775536[_0x7feb('0x3f')]);var _0x32c8ac={'where':_0x390e80[_0x7feb('0x3b')]};return db[_0x7feb('0x40')][_0x7feb('0x1b')](_0x32c8ac)['then'](function(_0x2197cf){_0xc7e7d0[_0x7feb('0x1b')]=_0x2197cf;if(_0x775536[_0x7feb('0x31')]['includeAll']){_0x390e80['include']=[{'all':!![]}];}return db[_0x7feb('0x40')]['findAll'](_0x390e80);})['then'](function(_0x37b7dc){_0xc7e7d0['rows']=_0x37b7dc;return _0xc7e7d0;})['then'](respondWithFilteredResult(_0x420529,_0x390e80))[_0x7feb('0x41')](handleError(_0x420529,null));};exports['show']=function(_0x4adf8a,_0x13b93e){var _0x51c52b={'raw':!![],'where':{'id':_0x4adf8a[_0x7feb('0x42')]['id']}},_0x170e4f={};_0x170e4f[_0x7feb('0x2f')]=_['keys'](db['SquareMessage'][_0x7feb('0x2b')]);_0x170e4f['query']=_['keys'](_0x4adf8a[_0x7feb('0x31')]);_0x170e4f[_0x7feb('0x33')]=_['intersection'](_0x170e4f[_0x7feb('0x2f')],_0x170e4f['query']);_0x51c52b[_0x7feb('0x35')]=_[_0x7feb('0x34')](_0x170e4f[_0x7feb('0x2f')],qs[_0x7feb('0x36')](_0x4adf8a[_0x7feb('0x31')][_0x7feb('0x36')]));_0x51c52b[_0x7feb('0x35')]=_0x51c52b[_0x7feb('0x35')]['length']?_0x51c52b['attributes']:_0x170e4f[_0x7feb('0x2f')];if(_0x4adf8a[_0x7feb('0x31')]['includeAll']){_0x51c52b[_0x7feb('0x43')]=[{'all':!![]}];}_0x51c52b=_[_0x7feb('0x3e')]({},_0x51c52b,_0x4adf8a[_0x7feb('0x3f')]);return db[_0x7feb('0x40')]['find'](_0x51c52b)[_0x7feb('0x25')](handleEntityNotFound(_0x13b93e,null))[_0x7feb('0x25')](respondWithResult(_0x13b93e,null))[_0x7feb('0x41')](handleError(_0x13b93e,null));};exports[_0x7feb('0x44')]=function(_0x29a347,_0x7282c3){return db[_0x7feb('0x40')]['create'](_0x29a347[_0x7feb('0x45')],{})['then'](respondWithResult(_0x7282c3,0xc9))[_0x7feb('0x41')](handleError(_0x7282c3,null));};exports[_0x7feb('0x46')]=function(_0x499914,_0xccab04){if(_0x499914[_0x7feb('0x45')]['id']){delete _0x499914['body']['id'];}return db[_0x7feb('0x40')][_0x7feb('0x47')]({'where':{'id':_0x499914[_0x7feb('0x42')]['id']}})[_0x7feb('0x25')](handleEntityNotFound(_0xccab04,null))['then'](saveUpdates(_0x499914[_0x7feb('0x45')],null))[_0x7feb('0x25')](respondWithResult(_0xccab04,null))[_0x7feb('0x41')](handleError(_0xccab04,null));};exports[_0x7feb('0x24')]=function(_0x5d7202,_0x317085){return db[_0x7feb('0x40')][_0x7feb('0x47')]({'where':{'id':_0x5d7202[_0x7feb('0x42')]['id']}})[_0x7feb('0x25')](handleEntityNotFound(_0x317085,null))[_0x7feb('0x25')](removeEntity(_0x317085,null))[_0x7feb('0x41')](handleError(_0x317085,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d414471..938dab8 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 _0x596f=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','api','moment'];(function(_0x4b9a62,_0x528ba3){var _0x45c582=function(_0x596041){while(--_0x596041){_0x4b9a62['push'](_0x4b9a62['shift']());}};_0x45c582(++_0x528ba3);}(_0x596f,0x1be));var _0xf596=function(_0x1724b9,_0x2bf8b7){_0x1724b9=_0x1724b9-0x0;var _0xcb0209=_0x596f[_0x1724b9];return _0xcb0209;};'use strict';var _=require(_0xf596('0x0'));var util=require(_0xf596('0x1'));var logger=require('../../config/logger')(_0xf596('0x2'));var moment=require(_0xf596('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf596('0x4'));var config=require(_0xf596('0x5'));var attributes=require(_0xf596('0x6'));module[_0xf596('0x7')]=function(_0x1014f1,_0x674676){return _0x1014f1[_0xf596('0x8')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3dc=['request-promise','path','exports','SquareMessage','square_messages','../../config/logger','api','moment','bluebird'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xb3dc,0x1e2));var _0xcb3d=function(_0x448206,_0x1b0bda){_0x448206=_0x448206-0x0;var _0x159290=_0xb3dc[_0x448206];return _0x159290;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb3d('0x0'))(_0xcb3d('0x1'));var moment=require(_0xcb3d('0x2'));var BPromise=require(_0xcb3d('0x3'));var rp=require(_0xcb3d('0x4'));var fs=require('fs');var path=require(_0xcb3d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xcb3d('0x6')]=function(_0x1fd76c,_0x5cec7f){return _0x1fd76c['define'](_0xcb3d('0x7'),attributes,{'tableName':_0xcb3d('0x8'),'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 b1cfc44..7e8fb11 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(_0x421fa3,_0x2b4973){var _0x4b093d=function(_0x31c8ed){while(--_0x31c8ed){_0x421fa3['push'](_0x421fa3['shift']());}};_0x4b093d(++_0x2b4973);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x44ef2b,_0x3dff5e){var _0x92db20=function(_0xcadf03){while(--_0xcadf03){_0x44ef2b['push'](_0x44ef2b['shift']());}};_0x92db20(++_0x3dff5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 a45016a..3b84b07 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 _0xa6ee=['index','15s','test','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6ee,0x136));var _0xea6e=function(_0x181fba,_0x3bb25e){_0x181fba=_0x181fba-0x0;var _0x18383a=_0xa6ee[_0x181fba];return _0x18383a;};'use strict';var multer=require(_0xea6e('0x0'));var util=require('util');var path=require(_0xea6e('0x1'));var timeout=require(_0xea6e('0x2'));var express=require(_0xea6e('0x3'));var router=express[_0xea6e('0x4')]();var auth=require(_0xea6e('0x5'));var interaction=require(_0xea6e('0x6'));var config=require('../../config/environment');var controller=require(_0xea6e('0x7'));router[_0xea6e('0x8')]('/',auth[_0xea6e('0x9')](),controller[_0xea6e('0xa')]);router[_0xea6e('0x8')]('/:id',auth[_0xea6e('0x9')](),controller['show']);router['get']('/:id/test',auth[_0xea6e('0x9')](),timeout(_0xea6e('0xb')),controller[_0xea6e('0xc')]);router[_0xea6e('0xd')]('/',auth['isAuthenticated'](),controller[_0xea6e('0xe')]);router[_0xea6e('0xf')](_0xea6e('0x10'),auth[_0xea6e('0x9')](),controller[_0xea6e('0x11')]);router[_0xea6e('0x12')](_0xea6e('0x10'),auth[_0xea6e('0x9')](),controller['destroy']);module[_0xea6e('0x13')]=router; \ No newline at end of file +var _0xe15a=['../../config/environment','./squareOdbc.controller','index','get','isAuthenticated','show','/:id/test','15s','test','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x58ade6,_0x5a676c){var _0x317afe=function(_0x160540){while(--_0x160540){_0x58ade6['push'](_0x58ade6['shift']());}};_0x317afe(++_0x5a676c);}(_0xe15a,0x180));var _0xae15=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0xe15a[_0x547e20];return _0x359171;};'use strict';var multer=require(_0xae15('0x0'));var util=require(_0xae15('0x1'));var path=require(_0xae15('0x2'));var timeout=require(_0xae15('0x3'));var express=require(_0xae15('0x4'));var router=express[_0xae15('0x5')]();var auth=require(_0xae15('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae15('0x7'));var controller=require(_0xae15('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xae15('0x9')]);router[_0xae15('0xa')]('/:id',auth[_0xae15('0xb')](),controller[_0xae15('0xc')]);router[_0xae15('0xa')](_0xae15('0xd'),auth[_0xae15('0xb')](),timeout(_0xae15('0xe')),controller[_0xae15('0xf')]);router[_0xae15('0x10')]('/',auth[_0xae15('0xb')](),controller[_0xae15('0x11')]);router[_0xae15('0x12')](_0xae15('0x13'),auth[_0xae15('0xb')](),controller[_0xae15('0x14')]);router['delete'](_0xae15('0x13'),auth[_0xae15('0xb')](),controller[_0xae15('0x15')]);module[_0xae15('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index c7267f7..cc9d5b7 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 _0xa9ea=['STRING','name'];(function(_0x386688,_0x29d853){var _0x139544=function(_0x23a70d){while(--_0x23a70d){_0x386688['push'](_0x386688['shift']());}};_0x139544(++_0x29d853);}(_0xa9ea,0x152));var _0xaa9e=function(_0xeb6f8d,_0x1138f1){_0xeb6f8d=_0xeb6f8d-0x0;var _0x41f045=_0xa9ea[_0xeb6f8d];return _0x41f045;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa9e('0x0')],'unique':_0xaa9e('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xaa9e('0x0')]},'description':{'type':Sequelize[_0xaa9e('0x0')]}}; \ No newline at end of file +var _0x3b0e=['sequelize','exports','name','STRING'];(function(_0x5adc49,_0x471f9b){var _0xd90bd=function(_0xb8f68a){while(--_0xb8f68a){_0x5adc49['push'](_0x5adc49['shift']());}};_0xd90bd(++_0x471f9b);}(_0x3b0e,0x78));var _0xe3b0=function(_0x12dbe9,_0x4b8a5a){_0x12dbe9=_0x12dbe9-0x0;var _0x96ad6d=_0x3b0e[_0x12dbe9];return _0x96ad6d;};'use strict';var Sequelize=require(_0xe3b0('0x0'));module[_0xe3b0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe3b0('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe3b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5322551..e6dd898 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 _0xe3ae=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','request-promise'];(function(_0x32deb5,_0x4be591){var _0x5a860b=function(_0x172257){while(--_0x172257){_0x32deb5['push'](_0x32deb5['shift']());}};_0x5a860b(++_0x4be591);}(_0xe3ae,0xb0));var _0xee3a=function(_0x1b7500,_0x2eb0ed){_0x1b7500=_0x1b7500-0x0;var _0x12f833=_0xe3ae[_0x1b7500];return _0x12f833;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee3a('0x0'));var rimraf=require(_0xee3a('0x1'));var zipdir=require(_0xee3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee3a('0x3'));var moment=require('moment');var BPromise=require(_0xee3a('0x4'));var Mustache=require(_0xee3a('0x5'));var util=require(_0xee3a('0x6'));var path=require('path');var sox=require(_0xee3a('0x7'));var csv=require(_0xee3a('0x8'));var ejs=require(_0xee3a('0x9'));var fs=require('fs');var _=require(_0xee3a('0xa'));var squel=require(_0xee3a('0xb'));var crypto=require(_0xee3a('0xc'));var jsforce=require(_0xee3a('0xd'));var deskjs=require(_0xee3a('0xe'));var toCsv=require(_0xee3a('0x8'));var querystring=require(_0xee3a('0xf'));var Papa=require(_0xee3a('0x10'));var Redis=require(_0xee3a('0x11'));var authService=require(_0xee3a('0x12'));var qs=require(_0xee3a('0x13'));var as=require(_0xee3a('0x14'));var hardwareService=require(_0xee3a('0x15'));var logger=require(_0xee3a('0x16'))(_0xee3a('0x17'));var utils=require('../../config/utils');var config=require(_0xee3a('0x18'));var licenseUtil=require(_0xee3a('0x19'));var db=require(_0xee3a('0x1a'))['db'];function respondWithStatusCode(_0x55977c,_0x523be7){_0x523be7=_0x523be7||0xcc;return function(_0x5b1057){if(_0x5b1057){return _0x55977c[_0xee3a('0x1b')](_0x523be7);}return _0x55977c['status'](_0x523be7)[_0xee3a('0x1c')]();};}function respondWithResult(_0x4dc864,_0x265c7c){_0x265c7c=_0x265c7c||0xc8;return function(_0x213b64){if(_0x213b64){return _0x4dc864[_0xee3a('0x1d')](_0x265c7c)[_0xee3a('0x1e')](_0x213b64);}};}function respondWithFilteredResult(_0x5acb25,_0x4273ca){return function(_0x5113f1){if(_0x5113f1){var _0x5a980f=_0x5113f1[_0xee3a('0x1f')],_0x4c5b03=_0x4273ca['offset'],_0xb83ea6=_0x4273ca[_0xee3a('0x20')]+_0x4273ca[_0xee3a('0x21')],_0x61c278;if(_0xb83ea6>=_0x5a980f){_0xb83ea6=_0x5a980f;_0x61c278=0xc8;}else{_0x61c278=0xce;}_0x5acb25[_0xee3a('0x1d')](_0x61c278);return _0x5acb25[_0xee3a('0x22')](_0xee3a('0x23'),_0x4c5b03+'-'+_0xb83ea6+'/'+_0x5a980f)[_0xee3a('0x1e')](_0x5113f1);}return null;};}function patchUpdates(_0x28311e){return function(_0x4ca809){try{jsonpatch[_0xee3a('0x24')](_0x4ca809,_0x28311e,!![]);}catch(_0x363220){return BPromise['reject'](_0x363220);}return _0x4ca809[_0xee3a('0x25')]();};}function saveUpdates(_0x5d4cfa,_0x32a03d){return function(_0x29a3d8){if(_0x29a3d8){return _0x29a3d8[_0xee3a('0x26')](_0x5d4cfa)['then'](function(_0x2236dc){return _0x2236dc;});}return null;};}function removeEntity(_0x2573d7,_0x5e8116){return function(_0xc96d34){if(_0xc96d34){return _0xc96d34[_0xee3a('0x27')]()[_0xee3a('0x28')](function(){var _0x1f2b08=_0xc96d34['get']({'plain':!![]});var _0x689e0f='ODBC';return db['UserProfileResource'][_0xee3a('0x27')]({'where':{'type':_0x689e0f,'resourceId':_0x1f2b08['id']}})[_0xee3a('0x28')](function(){return _0xc96d34;});})[_0xee3a('0x28')](function(){_0x2573d7[_0xee3a('0x1d')](0xcc)[_0xee3a('0x1c')]();});}};}function handleEntityNotFound(_0x4a313,_0x530d39){return function(_0x4be22d){if(!_0x4be22d){_0x4a313[_0xee3a('0x1b')](0x194);}return _0x4be22d;};}function handleError(_0x205785,_0x4ff179){_0x4ff179=_0x4ff179||0x1f4;return function(_0xc0474a){logger[_0xee3a('0x29')](_0xc0474a[_0xee3a('0x2a')]);if(_0xc0474a['name']){delete _0xc0474a[_0xee3a('0x2b')];}_0x205785[_0xee3a('0x1d')](_0x4ff179)[_0xee3a('0x2c')](_0xc0474a);};}exports['index']=function(_0x545616,_0x1fbcc4){var _0xc0fd25={},_0x1b2dd8={},_0xc3439f={'count':0x0,'rows':[]};var _0x3760a2=_[_0xee3a('0x2d')](db[_0xee3a('0x2e')][_0xee3a('0x2f')],function(_0x3e592b){return{'name':_0x3e592b[_0xee3a('0x30')],'type':_0x3e592b[_0xee3a('0x31')][_0xee3a('0x32')]};});_0x1b2dd8[_0xee3a('0x33')]=_[_0xee3a('0x2d')](_0x3760a2,'name');_0x1b2dd8[_0xee3a('0x34')]=_[_0xee3a('0x35')](_0x545616[_0xee3a('0x34')]);_0x1b2dd8[_0xee3a('0x36')]=_[_0xee3a('0x37')](_0x1b2dd8[_0xee3a('0x33')],_0x1b2dd8[_0xee3a('0x34')]);_0xc0fd25['attributes']=_['intersection'](_0x1b2dd8[_0xee3a('0x33')],qs[_0xee3a('0x38')](_0x545616[_0xee3a('0x34')]['fields']));_0xc0fd25[_0xee3a('0x39')]=_0xc0fd25[_0xee3a('0x39')]['length']?_0xc0fd25[_0xee3a('0x39')]:_0x1b2dd8[_0xee3a('0x33')];if(!_0x545616[_0xee3a('0x34')][_0xee3a('0x3a')]('nolimit')){_0xc0fd25[_0xee3a('0x21')]=qs[_0xee3a('0x21')](_0x545616[_0xee3a('0x34')][_0xee3a('0x21')]);_0xc0fd25[_0xee3a('0x20')]=qs['offset'](_0x545616[_0xee3a('0x34')][_0xee3a('0x20')]);}_0xc0fd25[_0xee3a('0x3b')]=qs[_0xee3a('0x3c')](_0x545616[_0xee3a('0x34')][_0xee3a('0x3c')]);_0xc0fd25[_0xee3a('0x3d')]=qs['filters'](_[_0xee3a('0x3e')](_0x545616[_0xee3a('0x34')],_0x1b2dd8['filters']),_0x3760a2);if(_0x545616['query'][_0xee3a('0x3f')]){_0xc0fd25[_0xee3a('0x3d')]=_[_0xee3a('0x40')](_0xc0fd25['where'],{'$or':_[_0xee3a('0x2d')](_0x3760a2,function(_0x3ad80b){if(_0x3ad80b[_0xee3a('0x31')]!==_0xee3a('0x41')){var _0x12e7cd={};_0x12e7cd[_0x3ad80b[_0xee3a('0x2b')]]={'$like':'%'+_0x545616[_0xee3a('0x34')][_0xee3a('0x3f')]+'%'};return _0x12e7cd;}})});}_0xc0fd25=_[_0xee3a('0x40')]({},_0xc0fd25,_0x545616[_0xee3a('0x42')]);var _0x406936={'where':_0xc0fd25[_0xee3a('0x3d')]};return db[_0xee3a('0x2e')][_0xee3a('0x1f')](_0x406936)['then'](function(_0x44db08){_0xc3439f[_0xee3a('0x1f')]=_0x44db08;if(_0x545616['query'][_0xee3a('0x43')]){_0xc0fd25[_0xee3a('0x44')]=[{'all':!![]}];}return db[_0xee3a('0x2e')][_0xee3a('0x45')](_0xc0fd25);})[_0xee3a('0x28')](function(_0x3041bb){_0xc3439f['rows']=_0x3041bb;return _0xc3439f;})[_0xee3a('0x28')](respondWithFilteredResult(_0x1fbcc4,_0xc0fd25))[_0xee3a('0x46')](handleError(_0x1fbcc4,null));};exports[_0xee3a('0x47')]=function(_0x594135,_0x367452){var _0x2d24e9={'raw':!![],'where':{'id':_0x594135[_0xee3a('0x48')]['id']}},_0x48c5c2={};_0x48c5c2[_0xee3a('0x33')]=_[_0xee3a('0x35')](db['SquareOdbc'][_0xee3a('0x2f')]);_0x48c5c2[_0xee3a('0x34')]=_[_0xee3a('0x35')](_0x594135[_0xee3a('0x34')]);_0x48c5c2[_0xee3a('0x36')]=_[_0xee3a('0x37')](_0x48c5c2[_0xee3a('0x33')],_0x48c5c2[_0xee3a('0x34')]);_0x2d24e9[_0xee3a('0x39')]=_[_0xee3a('0x37')](_0x48c5c2[_0xee3a('0x33')],qs['fields'](_0x594135['query'][_0xee3a('0x38')]));_0x2d24e9[_0xee3a('0x39')]=_0x2d24e9['attributes'][_0xee3a('0x49')]?_0x2d24e9['attributes']:_0x48c5c2[_0xee3a('0x33')];if(_0x594135[_0xee3a('0x34')]['includeAll']){_0x2d24e9[_0xee3a('0x44')]=[{'all':!![]}];}_0x2d24e9=_[_0xee3a('0x40')]({},_0x2d24e9,_0x594135[_0xee3a('0x42')]);return db[_0xee3a('0x2e')][_0xee3a('0x4a')](_0x2d24e9)['then'](handleEntityNotFound(_0x367452,null))[_0xee3a('0x28')](respondWithResult(_0x367452,null))[_0xee3a('0x46')](handleError(_0x367452,null));};exports[_0xee3a('0x4b')]=function(_0x450b19,_0x22ebfd){return db[_0xee3a('0x2e')][_0xee3a('0x4b')](_0x450b19[_0xee3a('0x4c')],{})[_0xee3a('0x28')](function(_0x1d061d){var _0x4f2cb7=_0x450b19[_0xee3a('0x4d')][_0xee3a('0x4e')]({'plain':!![]});if(!_0x4f2cb7)throw new Error(_0xee3a('0x4f'));if(_0x4f2cb7[_0xee3a('0x50')]===_0xee3a('0x4d')){var _0x45a3fc=_0x1d061d[_0xee3a('0x4e')]({'plain':!![]});var _0x5dd33a=_0xee3a('0x51');return db[_0xee3a('0x52')][_0xee3a('0x4a')]({'where':{'name':_0x5dd33a,'userProfileId':_0x4f2cb7['userProfileId']},'raw':!![]})[_0xee3a('0x28')](function(_0x5209e8){if(_0x5209e8&&_0x5209e8[_0xee3a('0x53')]===0x0){return db[_0xee3a('0x54')]['create']({'name':_0x45a3fc[_0xee3a('0x2b')],'resourceId':_0x45a3fc['id'],'type':_0x5209e8[_0xee3a('0x2b')],'sectionId':_0x5209e8['id']},{})[_0xee3a('0x28')](function(){return _0x1d061d;});}else{return _0x1d061d;}})[_0xee3a('0x46')](function(_0x104520){logger[_0xee3a('0x29')](_0xee3a('0x55'),_0x104520);throw _0x104520;});}return _0x1d061d;})[_0xee3a('0x28')](respondWithResult(_0x22ebfd,0xc9))[_0xee3a('0x46')](handleError(_0x22ebfd,null));};exports[_0xee3a('0x26')]=function(_0x1b6900,_0x756846){if(_0x1b6900[_0xee3a('0x4c')]['id']){delete _0x1b6900[_0xee3a('0x4c')]['id'];}return db[_0xee3a('0x2e')][_0xee3a('0x4a')]({'where':{'id':_0x1b6900[_0xee3a('0x48')]['id']}})[_0xee3a('0x28')](handleEntityNotFound(_0x756846,null))[_0xee3a('0x28')](saveUpdates(_0x1b6900[_0xee3a('0x4c')],null))[_0xee3a('0x28')](respondWithResult(_0x756846,null))['catch'](handleError(_0x756846,null));};exports['destroy']=function(_0x465639,_0x12da21){return db[_0xee3a('0x2e')][_0xee3a('0x4a')]({'where':{'id':_0x465639['params']['id']}})[_0xee3a('0x28')](handleEntityNotFound(_0x12da21,null))[_0xee3a('0x28')](removeEntity(_0x12da21,null))['catch'](handleError(_0x12da21,null));};exports[_0xee3a('0x56')]=function(_0x537642,_0x840b8d,_0xa67136){var _0x553806;return db[_0xee3a('0x2e')][_0xee3a('0x4a')]({'where':{'id':_0x537642[_0xee3a('0x48')]['id']},'attributes':['id',_0xee3a('0x57')]})[_0xee3a('0x28')](handleEntityNotFound(_0x840b8d,null))[_0xee3a('0x28')](function(_0x577bfb){if(_0x577bfb){var _0x39036b=require(_0xee3a('0x58'))();_0x39036b[_0xee3a('0x59')](_0x577bfb['dsn']);_0x39036b['closeSync']();return _0x577bfb;}})[_0xee3a('0x28')](respondWithResult(_0x840b8d,null))[_0xee3a('0x46')](handleError(_0x840b8d,null));}; \ No newline at end of file +var _0xbff6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SquareOdbc','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','include','rows','catch','params','rawAttributes','includeAll','find','create','user','role','ODBC','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xbff6,0x136));var _0x6bff=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xbff6[_0x24f31b];return _0x488401;};'use strict';var pdf=require(_0x6bff('0x0'));var emlformat=require(_0x6bff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6bff('0x3'));var moment=require(_0x6bff('0x4'));var BPromise=require(_0x6bff('0x5'));var Mustache=require(_0x6bff('0x6'));var util=require(_0x6bff('0x7'));var path=require(_0x6bff('0x8'));var sox=require('sox');var csv=require(_0x6bff('0x9'));var ejs=require(_0x6bff('0xa'));var fs=require('fs');var _=require(_0x6bff('0xb'));var squel=require('squel');var crypto=require(_0x6bff('0xc'));var jsforce=require(_0x6bff('0xd'));var deskjs=require(_0x6bff('0xe'));var toCsv=require(_0x6bff('0x9'));var querystring=require(_0x6bff('0xf'));var Papa=require(_0x6bff('0x10'));var Redis=require(_0x6bff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6bff('0x12'));var as=require(_0x6bff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bff('0x14'))('api');var utils=require(_0x6bff('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e909a,_0x22a2ed){_0x22a2ed=_0x22a2ed||0xcc;return function(_0x1e17e0){if(_0x1e17e0){return _0x5e909a[_0x6bff('0x17')](_0x22a2ed);}return _0x5e909a[_0x6bff('0x18')](_0x22a2ed)[_0x6bff('0x19')]();};}function respondWithResult(_0x5ba955,_0x11fb6e){_0x11fb6e=_0x11fb6e||0xc8;return function(_0x5a4edc){if(_0x5a4edc){return _0x5ba955[_0x6bff('0x18')](_0x11fb6e)['json'](_0x5a4edc);}};}function respondWithFilteredResult(_0x31bc7e,_0x540e09){return function(_0xc325ea){if(_0xc325ea){var _0x14114e=_0xc325ea[_0x6bff('0x1a')],_0xb23c1a=_0x540e09[_0x6bff('0x1b')],_0x46775d=_0x540e09[_0x6bff('0x1b')]+_0x540e09[_0x6bff('0x1c')],_0x6ea6b5;if(_0x46775d>=_0x14114e){_0x46775d=_0x14114e;_0x6ea6b5=0xc8;}else{_0x6ea6b5=0xce;}_0x31bc7e[_0x6bff('0x18')](_0x6ea6b5);return _0x31bc7e['set']('Content-Range',_0xb23c1a+'-'+_0x46775d+'/'+_0x14114e)[_0x6bff('0x1d')](_0xc325ea);}return null;};}function patchUpdates(_0x4d1e11){return function(_0x5d96b6){try{jsonpatch[_0x6bff('0x1e')](_0x5d96b6,_0x4d1e11,!![]);}catch(_0x4ed7bc){return BPromise[_0x6bff('0x1f')](_0x4ed7bc);}return _0x5d96b6['save']();};}function saveUpdates(_0x3ab20a,_0x5274fa){return function(_0x258afc){if(_0x258afc){return _0x258afc[_0x6bff('0x20')](_0x3ab20a)[_0x6bff('0x21')](function(_0x3db0eb){return _0x3db0eb;});}return null;};}function removeEntity(_0x3c9bf4,_0x1ef6e5){return function(_0xf19d6a){if(_0xf19d6a){return _0xf19d6a[_0x6bff('0x22')]()[_0x6bff('0x21')](function(){var _0x261ca7=_0xf19d6a[_0x6bff('0x23')]({'plain':!![]});var _0x470bca='ODBC';return db[_0x6bff('0x24')][_0x6bff('0x22')]({'where':{'type':_0x470bca,'resourceId':_0x261ca7['id']}})['then'](function(){return _0xf19d6a;});})[_0x6bff('0x21')](function(){_0x3c9bf4['status'](0xcc)[_0x6bff('0x19')]();});}};}function handleEntityNotFound(_0x47c54c,_0x371113){return function(_0x36843c){if(!_0x36843c){_0x47c54c[_0x6bff('0x17')](0x194);}return _0x36843c;};}function handleError(_0x59fead,_0x5a0407){_0x5a0407=_0x5a0407||0x1f4;return function(_0x2363ab){logger['error'](_0x2363ab[_0x6bff('0x25')]);if(_0x2363ab[_0x6bff('0x26')]){delete _0x2363ab[_0x6bff('0x26')];}_0x59fead['status'](_0x5a0407)[_0x6bff('0x27')](_0x2363ab);};}exports[_0x6bff('0x28')]=function(_0x5d2dfb,_0x3534a0){var _0x5071c3={},_0x5b11ca={},_0xe0424f={'count':0x0,'rows':[]};var _0x27c7e2=_[_0x6bff('0x29')](db[_0x6bff('0x2a')]['rawAttributes'],function(_0x2e4eef){return{'name':_0x2e4eef['fieldName'],'type':_0x2e4eef[_0x6bff('0x2b')][_0x6bff('0x2c')]};});_0x5b11ca[_0x6bff('0x2d')]=_[_0x6bff('0x29')](_0x27c7e2,'name');_0x5b11ca[_0x6bff('0x2e')]=_[_0x6bff('0x2f')](_0x5d2dfb[_0x6bff('0x2e')]);_0x5b11ca[_0x6bff('0x30')]=_[_0x6bff('0x31')](_0x5b11ca[_0x6bff('0x2d')],_0x5b11ca['query']);_0x5071c3['attributes']=_['intersection'](_0x5b11ca[_0x6bff('0x2d')],qs[_0x6bff('0x32')](_0x5d2dfb['query']['fields']));_0x5071c3[_0x6bff('0x33')]=_0x5071c3['attributes'][_0x6bff('0x34')]?_0x5071c3[_0x6bff('0x33')]:_0x5b11ca['model'];if(!_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x35')](_0x6bff('0x36'))){_0x5071c3[_0x6bff('0x1c')]=qs[_0x6bff('0x1c')](_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x1c')]);_0x5071c3[_0x6bff('0x1b')]=qs[_0x6bff('0x1b')](_0x5d2dfb[_0x6bff('0x2e')]['offset']);}_0x5071c3['order']=qs[_0x6bff('0x37')](_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x37')]);_0x5071c3['where']=qs[_0x6bff('0x30')](_[_0x6bff('0x38')](_0x5d2dfb['query'],_0x5b11ca[_0x6bff('0x30')]),_0x27c7e2);if(_0x5d2dfb[_0x6bff('0x2e')]['filter']){_0x5071c3[_0x6bff('0x39')]=_[_0x6bff('0x3a')](_0x5071c3[_0x6bff('0x39')],{'$or':_[_0x6bff('0x29')](_0x27c7e2,function(_0x5e2f67){if(_0x5e2f67[_0x6bff('0x2b')]!=='VIRTUAL'){var _0x3b2ea0={};_0x3b2ea0[_0x5e2f67[_0x6bff('0x26')]]={'$like':'%'+_0x5d2dfb[_0x6bff('0x2e')][_0x6bff('0x3b')]+'%'};return _0x3b2ea0;}})});}_0x5071c3=_[_0x6bff('0x3a')]({},_0x5071c3,_0x5d2dfb[_0x6bff('0x3c')]);var _0x57b655={'where':_0x5071c3[_0x6bff('0x39')]};return db[_0x6bff('0x2a')][_0x6bff('0x1a')](_0x57b655)['then'](function(_0x3337c0){_0xe0424f[_0x6bff('0x1a')]=_0x3337c0;if(_0x5d2dfb[_0x6bff('0x2e')]['includeAll']){_0x5071c3[_0x6bff('0x3d')]=[{'all':!![]}];}return db[_0x6bff('0x2a')]['findAll'](_0x5071c3);})[_0x6bff('0x21')](function(_0xf39f35){_0xe0424f[_0x6bff('0x3e')]=_0xf39f35;return _0xe0424f;})[_0x6bff('0x21')](respondWithFilteredResult(_0x3534a0,_0x5071c3))[_0x6bff('0x3f')](handleError(_0x3534a0,null));};exports['show']=function(_0x4984c2,_0x9164b9){var _0x2fb648={'raw':!![],'where':{'id':_0x4984c2[_0x6bff('0x40')]['id']}},_0x313840={};_0x313840[_0x6bff('0x2d')]=_[_0x6bff('0x2f')](db['SquareOdbc'][_0x6bff('0x41')]);_0x313840['query']=_[_0x6bff('0x2f')](_0x4984c2['query']);_0x313840[_0x6bff('0x30')]=_[_0x6bff('0x31')](_0x313840[_0x6bff('0x2d')],_0x313840['query']);_0x2fb648['attributes']=_[_0x6bff('0x31')](_0x313840['model'],qs[_0x6bff('0x32')](_0x4984c2[_0x6bff('0x2e')][_0x6bff('0x32')]));_0x2fb648[_0x6bff('0x33')]=_0x2fb648[_0x6bff('0x33')]['length']?_0x2fb648[_0x6bff('0x33')]:_0x313840['model'];if(_0x4984c2[_0x6bff('0x2e')][_0x6bff('0x42')]){_0x2fb648[_0x6bff('0x3d')]=[{'all':!![]}];}_0x2fb648=_['merge']({},_0x2fb648,_0x4984c2[_0x6bff('0x3c')]);return db[_0x6bff('0x2a')][_0x6bff('0x43')](_0x2fb648)[_0x6bff('0x21')](handleEntityNotFound(_0x9164b9,null))[_0x6bff('0x21')](respondWithResult(_0x9164b9,null))['catch'](handleError(_0x9164b9,null));};exports[_0x6bff('0x44')]=function(_0x4a3833,_0xf43b54){return db[_0x6bff('0x2a')][_0x6bff('0x44')](_0x4a3833['body'],{})[_0x6bff('0x21')](function(_0x3797bc){var _0x145170=_0x4a3833[_0x6bff('0x45')][_0x6bff('0x23')]({'plain':!![]});if(!_0x145170)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145170[_0x6bff('0x46')]==='user'){var _0x18427d=_0x3797bc[_0x6bff('0x23')]({'plain':!![]});var _0x2e0041=_0x6bff('0x47');return db[_0x6bff('0x48')][_0x6bff('0x43')]({'where':{'name':_0x2e0041,'userProfileId':_0x145170['userProfileId']},'raw':!![]})[_0x6bff('0x21')](function(_0x40126a){if(_0x40126a&&_0x40126a[_0x6bff('0x49')]===0x0){return db[_0x6bff('0x24')][_0x6bff('0x44')]({'name':_0x18427d[_0x6bff('0x26')],'resourceId':_0x18427d['id'],'type':_0x40126a['name'],'sectionId':_0x40126a['id']},{})[_0x6bff('0x21')](function(){return _0x3797bc;});}else{return _0x3797bc;}})[_0x6bff('0x3f')](function(_0x475404){logger[_0x6bff('0x4a')](_0x6bff('0x4b'),_0x475404);throw _0x475404;});}return _0x3797bc;})[_0x6bff('0x21')](respondWithResult(_0xf43b54,0xc9))[_0x6bff('0x3f')](handleError(_0xf43b54,null));};exports[_0x6bff('0x20')]=function(_0x23938c,_0x51685a){if(_0x23938c[_0x6bff('0x4c')]['id']){delete _0x23938c[_0x6bff('0x4c')]['id'];}return db['SquareOdbc'][_0x6bff('0x43')]({'where':{'id':_0x23938c[_0x6bff('0x40')]['id']}})[_0x6bff('0x21')](handleEntityNotFound(_0x51685a,null))[_0x6bff('0x21')](saveUpdates(_0x23938c[_0x6bff('0x4c')],null))[_0x6bff('0x21')](respondWithResult(_0x51685a,null))[_0x6bff('0x3f')](handleError(_0x51685a,null));};exports[_0x6bff('0x22')]=function(_0x1350da,_0x100f8a){return db[_0x6bff('0x2a')][_0x6bff('0x43')]({'where':{'id':_0x1350da['params']['id']}})[_0x6bff('0x21')](handleEntityNotFound(_0x100f8a,null))[_0x6bff('0x21')](removeEntity(_0x100f8a,null))[_0x6bff('0x3f')](handleError(_0x100f8a,null));};exports[_0x6bff('0x4d')]=function(_0x109c22,_0x2dbe53,_0x4c594f){var _0x1a6985;return db[_0x6bff('0x2a')]['find']({'where':{'id':_0x109c22[_0x6bff('0x40')]['id']},'attributes':['id',_0x6bff('0x4e')]})[_0x6bff('0x21')](handleEntityNotFound(_0x2dbe53,null))[_0x6bff('0x21')](function(_0x1e3d23){if(_0x1e3d23){var _0x33276a=require(_0x6bff('0x4f'))();_0x33276a[_0x6bff('0x50')](_0x1e3d23[_0x6bff('0x4e')]);_0x33276a[_0x6bff('0x51')]();return _0x1e3d23;}})[_0x6bff('0x21')](respondWithResult(_0x2dbe53,null))[_0x6bff('0x3f')](handleError(_0x2dbe53,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c33381a..fbf1b3c 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 _0xb251=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','api','moment','bluebird'];(function(_0x1560f5,_0x52a673){var _0x2ad9d0=function(_0x3125dc){while(--_0x3125dc){_0x1560f5['push'](_0x1560f5['shift']());}};_0x2ad9d0(++_0x52a673);}(_0xb251,0x15a));var _0x1b25=function(_0x1bfc4c,_0x13383e){_0x1bfc4c=_0x1bfc4c-0x0;var _0x141d23=_0xb251[_0x1bfc4c];return _0x141d23;};'use strict';var _=require(_0x1b25('0x0'));var util=require(_0x1b25('0x1'));var logger=require('../../config/logger')(_0x1b25('0x2'));var moment=require(_0x1b25('0x3'));var BPromise=require(_0x1b25('0x4'));var rp=require(_0x1b25('0x5'));var fs=require('fs');var path=require(_0x1b25('0x6'));var rimraf=require(_0x1b25('0x7'));var config=require(_0x1b25('0x8'));var attributes=require(_0x1b25('0x9'));module[_0x1b25('0xa')]=function(_0x363b8c,_0x5bbbbf){return _0x363b8c[_0x1b25('0xb')]('SquareOdbc',attributes,{'tableName':_0x1b25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f63=['path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x570984,_0x53e43c){var _0xc80b08=function(_0x2c8ef1){while(--_0x2c8ef1){_0x570984['push'](_0x570984['shift']());}};_0xc80b08(++_0x53e43c);}(_0x5f63,0x117));var _0x35f6=function(_0x372175,_0x3b50ce){_0x372175=_0x372175-0x0;var _0x3fa7e1=_0x5f63[_0x372175];return _0x3fa7e1;};'use strict';var _=require(_0x35f6('0x0'));var util=require(_0x35f6('0x1'));var logger=require(_0x35f6('0x2'))(_0x35f6('0x3'));var moment=require(_0x35f6('0x4'));var BPromise=require(_0x35f6('0x5'));var rp=require(_0x35f6('0x6'));var fs=require('fs');var path=require(_0x35f6('0x7'));var rimraf=require('rimraf');var config=require(_0x35f6('0x8'));var attributes=require(_0x35f6('0x9'));module[_0x35f6('0xa')]=function(_0xe63a5b,_0x36101a){return _0xe63a5b[_0x35f6('0xb')]('SquareOdbc',attributes,{'tableName':_0x35f6('0xc'),'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 feadf13..67bbc56 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(_0x5b312a,_0x4dc09b){var _0x448b0b=function(_0x56e870){while(--_0x56e870){_0x5b312a['push'](_0x5b312a['shift']());}};_0x448b0b(++_0x4dc09b);}(_0x008c,0x188));var _0xc008=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x008c[_0x36d203];return _0x2f9e62;};'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(_0x378c37,_0x5ad9df){var _0x3766e9=function(_0x522612){while(--_0x522612){_0x378c37['push'](_0x378c37['shift']());}};_0x3766e9(++_0x5ad9df);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 2f88673..5c3ee09 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 _0x3b0b=['post','put','destroy','removeUsers','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users','getUsers'];(function(_0xd2826b,_0x295fc3){var _0x5a0dc5=function(_0x4fb436){while(--_0x4fb436){_0xd2826b['push'](_0xd2826b['shift']());}};_0x5a0dc5(++_0x295fc3);}(_0x3b0b,0x194));var _0xb3b0=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3b0b[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xb3b0('0x0'));var util=require(_0xb3b0('0x1'));var path=require(_0xb3b0('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3b0('0x3'));var router=express[_0xb3b0('0x4')]();var auth=require(_0xb3b0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb3b0('0x6'));var controller=require(_0xb3b0('0x7'));router[_0xb3b0('0x8')]('/',auth[_0xb3b0('0x9')](),controller[_0xb3b0('0xa')]);router[_0xb3b0('0x8')](_0xb3b0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb3b0('0x8')](_0xb3b0('0xc'),auth['isAuthenticated'](),controller[_0xb3b0('0xd')]);router[_0xb3b0('0xe')]('/',auth[_0xb3b0('0x9')](),controller['create']);router[_0xb3b0('0xe')](_0xb3b0('0xc'),auth[_0xb3b0('0x9')](),controller['addUsers']);router[_0xb3b0('0xf')](_0xb3b0('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb3b0('0x9')](),controller[_0xb3b0('0x10')]);router['delete'](_0xb3b0('0xc'),auth[_0xb3b0('0x9')](),controller[_0xb3b0('0x11')]);module[_0xb3b0('0x12')]=router; \ No newline at end of file +var _0x50e1=['destroy','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','show','getUsers','post','/:id/users','addUsers','put','/:id','update'];(function(_0x4b14a8,_0x56c223){var _0x442b6c=function(_0x2c433a){while(--_0x2c433a){_0x4b14a8['push'](_0x4b14a8['shift']());}};_0x442b6c(++_0x56c223);}(_0x50e1,0x113));var _0x150e=function(_0x540646,_0x3bfae2){_0x540646=_0x540646-0x0;var _0x5373e9=_0x50e1[_0x540646];return _0x5373e9;};'use strict';var multer=require(_0x150e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x150e('0x1'));var express=require(_0x150e('0x2'));var router=express[_0x150e('0x3')]();var auth=require(_0x150e('0x4'));var interaction=require(_0x150e('0x5'));var config=require(_0x150e('0x6'));var controller=require(_0x150e('0x7'));router[_0x150e('0x8')]('/',auth['isAuthenticated'](),controller[_0x150e('0x9')]);router['get']('/:id',auth[_0x150e('0xa')](),controller[_0x150e('0xb')]);router[_0x150e('0x8')]('/:id/users',auth[_0x150e('0xa')](),controller[_0x150e('0xc')]);router[_0x150e('0xd')]('/',auth[_0x150e('0xa')](),controller['create']);router[_0x150e('0xd')](_0x150e('0xe'),auth[_0x150e('0xa')](),controller[_0x150e('0xf')]);router[_0x150e('0x10')](_0x150e('0x11'),auth[_0x150e('0xa')](),controller[_0x150e('0x12')]);router['delete'](_0x150e('0x11'),auth[_0x150e('0xa')](),controller[_0x150e('0x13')]);router[_0x150e('0x14')](_0x150e('0xe'),auth[_0x150e('0xa')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 029c414..510a23e 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 _0x8d05=['DATE','sequelize','exports','STRING','name','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x544eb6,_0x2f4757){var _0x318db2=function(_0x23002d){while(--_0x23002d){_0x544eb6['push'](_0x544eb6['shift']());}};_0x318db2(++_0x2f4757);}(_0x8d05,0xe8));var _0x58d0=function(_0x4ce03d,_0x57e13a){_0x4ce03d=_0x4ce03d-0x0;var _0xeb61be=_0x8d05[_0x4ce03d];return _0xeb61be;};'use strict';var Sequelize=require(_0x58d0('0x0'));module[_0x58d0('0x1')]={'name':{'type':Sequelize[_0x58d0('0x2')],'unique':_0x58d0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x58d0('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x58d0('0x4')),'get':function(){if(this[_0x58d0('0x5')](_0x58d0('0x6'))){return this[_0x58d0('0x5')]('preproduction')[_0x58d0('0x7')](_0x58d0('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x58d0('0x4')),'get':function(){if(this['getDataValue'](_0x58d0('0x9'))){return this[_0x58d0('0x5')](_0x58d0('0x9'))[_0x58d0('0x7')](_0x58d0('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x58d0('0xa')]}}; \ No newline at end of file +var _0x5761=['production','toString','DATE','sequelize','exports','STRING','BLOB','long','getDataValue','preproduction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5761,0x107));var _0x1576=function(_0x5352fc,_0x4cfcf7){_0x5352fc=_0x5352fc-0x0;var _0x25a45d=_0x5761[_0x5352fc];return _0x25a45d;};'use strict';var Sequelize=require(_0x1576('0x0'));module[_0x1576('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1576('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1576('0x3')](_0x1576('0x4')),'get':function(){if(this[_0x1576('0x5')](_0x1576('0x6'))){return this[_0x1576('0x5')](_0x1576('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x1576('0x3')](_0x1576('0x4')),'get':function(){if(this[_0x1576('0x5')](_0x1576('0x7'))){return this['getDataValue'](_0x1576('0x7'))[_0x1576('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1576('0x9')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bbfaff8..ca57775 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 _0xf503=['pick','filter','merge','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','SquareProjects','UserProfileResource','end','error','send','index','SquareProject','rawAttributes','fieldName','type','key','map','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3d27fd,_0x5eb681){var _0x4fcc8c=function(_0x2ce57b){while(--_0x2ce57b){_0x3d27fd['push'](_0x3d27fd['shift']());}};_0x4fcc8c(++_0x5eb681);}(_0xf503,0x1a4));var _0x3f50=function(_0x422469,_0x180fc5){_0x422469=_0x422469-0x0;var _0x39eab6=_0xf503[_0x422469];return _0x39eab6;};'use strict';var pdf=require(_0x3f50('0x0'));var emlformat=require(_0x3f50('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f50('0x2'));var jsonpatch=require(_0x3f50('0x3'));var rp=require(_0x3f50('0x4'));var moment=require(_0x3f50('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3f50('0x6'));var path=require(_0x3f50('0x7'));var sox=require(_0x3f50('0x8'));var csv=require(_0x3f50('0x9'));var ejs=require(_0x3f50('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f50('0xb'));var crypto=require(_0x3f50('0xc'));var jsforce=require(_0x3f50('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f50('0xe'));var Papa=require(_0x3f50('0xf'));var Redis=require('ioredis');var authService=require(_0x3f50('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f50('0x11'));var logger=require(_0x3f50('0x12'))(_0x3f50('0x13'));var utils=require(_0x3f50('0x14'));var config=require(_0x3f50('0x15'));var licenseUtil=require(_0x3f50('0x16'));var db=require(_0x3f50('0x17'))['db'];config[_0x3f50('0x18')]=_['defaults'](config['redis'],{'host':_0x3f50('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f50('0x18')]));require('./squareProject.socket')[_0x3f50('0x1a')](socket);function respondWithStatusCode(_0x5a7e5f,_0x122b58){_0x122b58=_0x122b58||0xcc;return function(_0x521e06){if(_0x521e06){return _0x5a7e5f[_0x3f50('0x1b')](_0x122b58);}return _0x5a7e5f[_0x3f50('0x1c')](_0x122b58)['end']();};}function respondWithResult(_0x348dbb,_0x581aa1){_0x581aa1=_0x581aa1||0xc8;return function(_0xaa4f8c){if(_0xaa4f8c){return _0x348dbb[_0x3f50('0x1c')](_0x581aa1)['json'](_0xaa4f8c);}};}function respondWithFilteredResult(_0x5e5f77,_0x3a8e61){return function(_0x1aef85){if(_0x1aef85){var _0x404009=_0x1aef85[_0x3f50('0x1d')],_0x153188=_0x3a8e61[_0x3f50('0x1e')],_0x27dab2=_0x3a8e61[_0x3f50('0x1e')]+_0x3a8e61[_0x3f50('0x1f')],_0x5eb2dc;if(_0x27dab2>=_0x404009){_0x27dab2=_0x404009;_0x5eb2dc=0xc8;}else{_0x5eb2dc=0xce;}_0x5e5f77[_0x3f50('0x1c')](_0x5eb2dc);return _0x5e5f77['set'](_0x3f50('0x20'),_0x153188+'-'+_0x27dab2+'/'+_0x404009)[_0x3f50('0x21')](_0x1aef85);}return null;};}function patchUpdates(_0x22e6b7){return function(_0x4649e7){try{jsonpatch[_0x3f50('0x22')](_0x4649e7,_0x22e6b7,!![]);}catch(_0x49de99){return BPromise[_0x3f50('0x23')](_0x49de99);}return _0x4649e7[_0x3f50('0x24')]();};}function saveUpdates(_0x1b204e,_0x13bf02){return function(_0x14b5bb){if(_0x14b5bb){return _0x14b5bb['update'](_0x1b204e)[_0x3f50('0x25')](function(_0x257c3d){return _0x257c3d;});}return null;};}function removeEntity(_0x38564d,_0x5ccbe1){return function(_0x28dd16){if(_0x28dd16){return _0x28dd16[_0x3f50('0x26')]()[_0x3f50('0x25')](function(){var _0x3ffb63=_0x28dd16['get']({'plain':!![]});var _0x401710=_0x3f50('0x27');return db[_0x3f50('0x28')][_0x3f50('0x26')]({'where':{'type':_0x401710,'resourceId':_0x3ffb63['id']}})[_0x3f50('0x25')](function(){return _0x28dd16;});})[_0x3f50('0x25')](function(){_0x38564d[_0x3f50('0x1c')](0xcc)[_0x3f50('0x29')]();});}};}function handleEntityNotFound(_0x5ca5cc,_0x33261e){return function(_0xc2601f){if(!_0xc2601f){_0x5ca5cc[_0x3f50('0x1b')](0x194);}return _0xc2601f;};}function handleError(_0x288b7d,_0x3e113a){_0x3e113a=_0x3e113a||0x1f4;return function(_0x44794d){logger[_0x3f50('0x2a')](_0x44794d['stack']);if(_0x44794d['name']){delete _0x44794d['name'];}_0x288b7d[_0x3f50('0x1c')](_0x3e113a)[_0x3f50('0x2b')](_0x44794d);};}exports[_0x3f50('0x2c')]=function(_0x3d68e6,_0x19690d){var _0x314af9={},_0x1d334e={},_0x487843={'count':0x0,'rows':[]};var _0x151ba9=_['map'](db[_0x3f50('0x2d')][_0x3f50('0x2e')],function(_0x52ec85){return{'name':_0x52ec85[_0x3f50('0x2f')],'type':_0x52ec85[_0x3f50('0x30')][_0x3f50('0x31')]};});_0x1d334e['model']=_[_0x3f50('0x32')](_0x151ba9,_0x3f50('0x33'));_0x1d334e['query']=_[_0x3f50('0x34')](_0x3d68e6[_0x3f50('0x35')]);_0x1d334e['filters']=_[_0x3f50('0x36')](_0x1d334e[_0x3f50('0x37')],_0x1d334e[_0x3f50('0x35')]);_0x314af9[_0x3f50('0x38')]=_['intersection'](_0x1d334e[_0x3f50('0x37')],qs[_0x3f50('0x39')](_0x3d68e6[_0x3f50('0x35')]['fields']));_0x314af9['attributes']=_0x314af9[_0x3f50('0x38')][_0x3f50('0x3a')]?_0x314af9[_0x3f50('0x38')]:_0x1d334e[_0x3f50('0x37')];if(!_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x3b')](_0x3f50('0x3c'))){_0x314af9[_0x3f50('0x1f')]=qs[_0x3f50('0x1f')](_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x1f')]);_0x314af9[_0x3f50('0x1e')]=qs[_0x3f50('0x1e')](_0x3d68e6['query'][_0x3f50('0x1e')]);}_0x314af9[_0x3f50('0x3d')]=qs['sort'](_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x3e')]);_0x314af9[_0x3f50('0x3f')]=qs[_0x3f50('0x40')](_[_0x3f50('0x41')](_0x3d68e6[_0x3f50('0x35')],_0x1d334e[_0x3f50('0x40')]),_0x151ba9);if(_0x3d68e6[_0x3f50('0x35')][_0x3f50('0x42')]){_0x314af9[_0x3f50('0x3f')]=_[_0x3f50('0x43')](_0x314af9[_0x3f50('0x3f')],{'$or':_[_0x3f50('0x32')](_0x151ba9,function(_0x31a54f){if(_0x31a54f[_0x3f50('0x30')]!=='VIRTUAL'){var _0x528dbd={};_0x528dbd[_0x31a54f[_0x3f50('0x33')]]={'$like':'%'+_0x3d68e6[_0x3f50('0x35')]['filter']+'%'};return _0x528dbd;}})});}_0x314af9=_['merge']({},_0x314af9,_0x3d68e6['options']);var _0x753601={'where':_0x314af9[_0x3f50('0x3f')]};return db[_0x3f50('0x2d')][_0x3f50('0x1d')](_0x753601)[_0x3f50('0x25')](function(_0x34dc28){_0x487843[_0x3f50('0x1d')]=_0x34dc28;if(_0x3d68e6[_0x3f50('0x35')]['includeAll']){_0x314af9['include']=[{'all':!![]}];}return db['SquareProject'][_0x3f50('0x44')](_0x314af9);})[_0x3f50('0x25')](function(_0x390b20){_0x487843[_0x3f50('0x45')]=_0x390b20;return _0x487843;})['then'](respondWithFilteredResult(_0x19690d,_0x314af9))[_0x3f50('0x46')](handleError(_0x19690d,null));};exports[_0x3f50('0x47')]=function(_0xe5f0be,_0x4f1425){var _0x2b9025={'raw':![],'where':{'id':_0xe5f0be[_0x3f50('0x48')]['id']}},_0x410f9d={};_0x410f9d['model']=_[_0x3f50('0x34')](db[_0x3f50('0x2d')][_0x3f50('0x2e')]);_0x410f9d[_0x3f50('0x35')]=_[_0x3f50('0x34')](_0xe5f0be[_0x3f50('0x35')]);_0x410f9d[_0x3f50('0x40')]=_['intersection'](_0x410f9d[_0x3f50('0x37')],_0x410f9d[_0x3f50('0x35')]);_0x2b9025['attributes']=_[_0x3f50('0x36')](_0x410f9d['model'],qs[_0x3f50('0x39')](_0xe5f0be[_0x3f50('0x35')][_0x3f50('0x39')]));_0x2b9025[_0x3f50('0x38')]=_0x2b9025[_0x3f50('0x38')][_0x3f50('0x3a')]?_0x2b9025[_0x3f50('0x38')]:_0x410f9d[_0x3f50('0x37')];if(_0xe5f0be[_0x3f50('0x35')][_0x3f50('0x49')]){_0x2b9025[_0x3f50('0x4a')]=[{'all':!![]}];}_0x2b9025=_[_0x3f50('0x43')]({},_0x2b9025,_0xe5f0be[_0x3f50('0x4b')]);return db['SquareProject'][_0x3f50('0x4c')](_0x2b9025)['then'](handleEntityNotFound(_0x4f1425,null))['then'](respondWithResult(_0x4f1425,null))[_0x3f50('0x46')](handleError(_0x4f1425,null));};exports['create']=function(_0x34aa7f,_0x964900){return db[_0x3f50('0x2d')][_0x3f50('0x4d')](_0x34aa7f[_0x3f50('0x4e')],{})['then'](function(_0x33df6a){var _0x315a14=_0x34aa7f[_0x3f50('0x4f')][_0x3f50('0x50')]({'plain':!![]});if(!_0x315a14)throw new Error(_0x3f50('0x51'));if(_0x315a14[_0x3f50('0x52')]==='user'){var _0x4bbf89=_0x33df6a[_0x3f50('0x50')]({'plain':!![]});var _0x354d65=_0x3f50('0x27');return db[_0x3f50('0x53')]['find']({'where':{'name':_0x354d65,'userProfileId':_0x315a14[_0x3f50('0x54')]},'raw':!![]})['then'](function(_0x3c2f2d){if(_0x3c2f2d&&_0x3c2f2d[_0x3f50('0x55')]===0x0){return db[_0x3f50('0x28')][_0x3f50('0x4d')]({'name':_0x4bbf89[_0x3f50('0x33')],'resourceId':_0x4bbf89['id'],'type':_0x3c2f2d[_0x3f50('0x33')],'sectionId':_0x3c2f2d['id']},{})['then'](function(){return _0x33df6a;});}else{return _0x33df6a;}})[_0x3f50('0x46')](function(_0x394433){logger[_0x3f50('0x2a')](_0x3f50('0x56'),_0x394433);throw _0x394433;});}return _0x33df6a;})[_0x3f50('0x25')](respondWithResult(_0x964900,0xc9))[_0x3f50('0x46')](handleError(_0x964900,null));};exports['update']=function(_0x28416e,_0xdb0f0c){if(_0x28416e['body']['id']){delete _0x28416e[_0x3f50('0x4e')]['id'];}return db[_0x3f50('0x2d')][_0x3f50('0x4c')]({'where':{'id':_0x28416e[_0x3f50('0x48')]['id']}})[_0x3f50('0x25')](handleEntityNotFound(_0xdb0f0c,null))[_0x3f50('0x25')](saveUpdates(_0x28416e[_0x3f50('0x4e')],null))[_0x3f50('0x25')](respondWithResult(_0xdb0f0c,null))[_0x3f50('0x46')](handleError(_0xdb0f0c,null));};exports[_0x3f50('0x26')]=function(_0x11056a,_0x3925b2){return db[_0x3f50('0x2d')]['find']({'where':{'id':_0x11056a[_0x3f50('0x48')]['id']}})['then'](handleEntityNotFound(_0x3925b2,null))[_0x3f50('0x25')](removeEntity(_0x3925b2,null))[_0x3f50('0x46')](handleError(_0x3925b2,null));};exports[_0x3f50('0x57')]=function(_0x2731d5,_0x20e046,_0x55cdb9){return db[_0x3f50('0x2d')][_0x3f50('0x4c')]({'where':{'id':_0x2731d5[_0x3f50('0x48')]['id']}})[_0x3f50('0x25')](handleEntityNotFound(_0x20e046,null))[_0x3f50('0x25')](function(_0xab8079){if(_0xab8079){return _0xab8079['addUsers'](_0x2731d5[_0x3f50('0x4e')]['ids'],_[_0x3f50('0x58')](_0x2731d5[_0x3f50('0x4e')],[_0x3f50('0x59'),'id'])||{});}})[_0x3f50('0x25')](respondWithResult(_0x20e046,null))[_0x3f50('0x46')](handleError(_0x20e046,null));};exports[_0x3f50('0x5a')]=function(_0x30418a,_0x3eef48,_0x56a34c){return db[_0x3f50('0x2d')]['find']({'where':{'id':_0x30418a[_0x3f50('0x48')]['id']}})['then'](handleEntityNotFound(_0x3eef48,null))[_0x3f50('0x25')](function(_0x3a0dc2){if(_0x3a0dc2){return _0x3a0dc2['removeUsers'](_0x30418a[_0x3f50('0x35')]['ids'])[_0x3f50('0x25')](function(){if(_[_0x3f50('0x5b')](_0x30418a[_0x3f50('0x35')][_0x3f50('0x59')])){for(var _0x2d3ebf=0x0;_0x2d3ebf<_0x30418a[_0x3f50('0x35')]['ids'][_0x3f50('0x3a')];_0x2d3ebf+=0x1){socket['emit'](_0x3f50('0x5c'),{'UserId':Number(_0x30418a[_0x3f50('0x35')]['ids'][_0x2d3ebf]),'SquareProjectId':Number(_0x30418a['params']['id'])});}}else{socket[_0x3f50('0x5d')](_0x3f50('0x5c'),{'UserId':Number(_0x30418a[_0x3f50('0x35')][_0x3f50('0x59')]),'SquareProjectId':Number(_0x30418a['params']['id'])});}});}})[_0x3f50('0x25')](respondWithStatusCode(_0x3eef48,null))[_0x3f50('0x46')](handleError(_0x3eef48,null));};exports[_0x3f50('0x5e')]=function(_0x597ebd,_0x90f334,_0x130e72){var _0x5e1a40={};var _0x8fc8ca={};var _0x2f9689;var _0x17649c;return db[_0x3f50('0x2d')][_0x3f50('0x5f')]({'where':{'id':_0x597ebd[_0x3f50('0x48')]['id']}})[_0x3f50('0x25')](handleEntityNotFound(_0x90f334,null))[_0x3f50('0x25')](function(_0x1069c9){if(_0x1069c9){_0x2f9689=_0x1069c9;_0x8fc8ca[_0x3f50('0x37')]=_[_0x3f50('0x34')](db[_0x3f50('0x60')][_0x3f50('0x2e')]);_0x8fc8ca[_0x3f50('0x35')]=_[_0x3f50('0x34')](_0x597ebd[_0x3f50('0x35')]);_0x8fc8ca[_0x3f50('0x40')]=_[_0x3f50('0x36')](_0x8fc8ca['model'],_0x8fc8ca[_0x3f50('0x35')]);_0x5e1a40[_0x3f50('0x38')]=_['intersection'](_0x8fc8ca['model'],qs[_0x3f50('0x39')](_0x597ebd['query'][_0x3f50('0x39')]));_0x5e1a40['attributes']=_0x5e1a40[_0x3f50('0x38')]['length']?_0x5e1a40[_0x3f50('0x38')]:_0x8fc8ca[_0x3f50('0x37')];_0x5e1a40[_0x3f50('0x3d')]=qs[_0x3f50('0x3e')](_0x597ebd['query'][_0x3f50('0x3e')]);_0x5e1a40['where']=qs[_0x3f50('0x40')](_[_0x3f50('0x41')](_0x597ebd[_0x3f50('0x35')],_0x8fc8ca[_0x3f50('0x40')]));if(_0x597ebd[_0x3f50('0x35')][_0x3f50('0x42')]){_0x5e1a40[_0x3f50('0x3f')]=_['merge'](_0x5e1a40[_0x3f50('0x3f')],{'$or':_['map'](_0x5e1a40[_0x3f50('0x38')],function(_0x2e6a01){var _0x38e890={};_0x38e890[_0x2e6a01]={'$like':'%'+_0x597ebd['query'][_0x3f50('0x42')]+'%'};return _0x38e890;})});}_0x5e1a40=_[_0x3f50('0x43')]({},_0x5e1a40,_0x597ebd[_0x3f50('0x4b')]);return _0x2f9689[_0x3f50('0x5e')](_0x5e1a40);}})[_0x3f50('0x25')](function(_0x3f5764){if(_0x3f5764){_0x17649c=_0x3f5764[_0x3f50('0x3a')];if(!_0x597ebd[_0x3f50('0x35')][_0x3f50('0x3b')](_0x3f50('0x3c'))){_0x5e1a40['limit']=qs['limit'](_0x597ebd[_0x3f50('0x35')]['limit']);_0x5e1a40[_0x3f50('0x1e')]=qs[_0x3f50('0x1e')](_0x597ebd[_0x3f50('0x35')][_0x3f50('0x1e')]);}return _0x2f9689[_0x3f50('0x5e')](_0x5e1a40);}})[_0x3f50('0x25')](function(_0x513aad){if(_0x513aad){return _0x513aad?{'count':_0x17649c,'rows':_0x513aad}:null;}})[_0x3f50('0x25')](respondWithResult(_0x90f334,null))[_0x3f50('0x46')](handleError(_0x90f334,null));}; \ No newline at end of file +var _0xd18c=['UserProfileResource','stack','name','send','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','SquareProject','include','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','get','SquareProjects'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0xd18c,0xee));var _0xcd18=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0xd18c[_0x5383f1];return _0xa23930;};'use strict';var pdf=require(_0xcd18('0x0'));var emlformat=require(_0xcd18('0x1'));var rimraf=require(_0xcd18('0x2'));var zipdir=require(_0xcd18('0x3'));var jsonpatch=require(_0xcd18('0x4'));var rp=require(_0xcd18('0x5'));var moment=require('moment');var BPromise=require(_0xcd18('0x6'));var Mustache=require(_0xcd18('0x7'));var util=require('util');var path=require(_0xcd18('0x8'));var sox=require('sox');var csv=require(_0xcd18('0x9'));var ejs=require(_0xcd18('0xa'));var fs=require('fs');var _=require(_0xcd18('0xb'));var squel=require(_0xcd18('0xc'));var crypto=require('crypto');var jsforce=require(_0xcd18('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd18('0x9'));var querystring=require(_0xcd18('0xe'));var Papa=require(_0xcd18('0xf'));var Redis=require(_0xcd18('0x10'));var authService=require(_0xcd18('0x11'));var qs=require(_0xcd18('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd18('0x13'))(_0xcd18('0x14'));var utils=require('../../config/utils');var config=require(_0xcd18('0x15'));var licenseUtil=require(_0xcd18('0x16'));var db=require(_0xcd18('0x17'))['db'];config['redis']=_[_0xcd18('0x18')](config[_0xcd18('0x19')],{'host':_0xcd18('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd18('0x19')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x48bf39,_0x49f286){_0x49f286=_0x49f286||0xcc;return function(_0x385e4c){if(_0x385e4c){return _0x48bf39[_0xcd18('0x1b')](_0x49f286);}return _0x48bf39[_0xcd18('0x1c')](_0x49f286)[_0xcd18('0x1d')]();};}function respondWithResult(_0x10064e,_0x20761f){_0x20761f=_0x20761f||0xc8;return function(_0x44a88a){if(_0x44a88a){return _0x10064e[_0xcd18('0x1c')](_0x20761f)[_0xcd18('0x1e')](_0x44a88a);}};}function respondWithFilteredResult(_0x4adde4,_0x5e6bc9){return function(_0x4fee42){if(_0x4fee42){var _0x1bbafd=_0x4fee42[_0xcd18('0x1f')],_0xd4ba1d=_0x5e6bc9[_0xcd18('0x20')],_0x4f28e0=_0x5e6bc9[_0xcd18('0x20')]+_0x5e6bc9[_0xcd18('0x21')],_0x4d0026;if(_0x4f28e0>=_0x1bbafd){_0x4f28e0=_0x1bbafd;_0x4d0026=0xc8;}else{_0x4d0026=0xce;}_0x4adde4[_0xcd18('0x1c')](_0x4d0026);return _0x4adde4[_0xcd18('0x22')]('Content-Range',_0xd4ba1d+'-'+_0x4f28e0+'/'+_0x1bbafd)['json'](_0x4fee42);}return null;};}function patchUpdates(_0x5a205b){return function(_0x1a44da){try{jsonpatch[_0xcd18('0x23')](_0x1a44da,_0x5a205b,!![]);}catch(_0xb703b){return BPromise[_0xcd18('0x24')](_0xb703b);}return _0x1a44da['save']();};}function saveUpdates(_0x2dfac5,_0x2e9ebd){return function(_0x41ea91){if(_0x41ea91){return _0x41ea91['update'](_0x2dfac5)[_0xcd18('0x25')](function(_0x3fc7a5){return _0x3fc7a5;});}return null;};}function removeEntity(_0x4bb620,_0x32997e){return function(_0x387d74){if(_0x387d74){return _0x387d74[_0xcd18('0x26')]()[_0xcd18('0x25')](function(){var _0x7275d6=_0x387d74[_0xcd18('0x27')]({'plain':!![]});var _0x5b7b8b=_0xcd18('0x28');return db[_0xcd18('0x29')][_0xcd18('0x26')]({'where':{'type':_0x5b7b8b,'resourceId':_0x7275d6['id']}})[_0xcd18('0x25')](function(){return _0x387d74;});})[_0xcd18('0x25')](function(){_0x4bb620[_0xcd18('0x1c')](0xcc)[_0xcd18('0x1d')]();});}};}function handleEntityNotFound(_0x236daa,_0x200a8b){return function(_0x3da41e){if(!_0x3da41e){_0x236daa['sendStatus'](0x194);}return _0x3da41e;};}function handleError(_0x3702af,_0x2c3934){_0x2c3934=_0x2c3934||0x1f4;return function(_0x7ebd40){logger['error'](_0x7ebd40[_0xcd18('0x2a')]);if(_0x7ebd40[_0xcd18('0x2b')]){delete _0x7ebd40[_0xcd18('0x2b')];}_0x3702af[_0xcd18('0x1c')](_0x2c3934)[_0xcd18('0x2c')](_0x7ebd40);};}exports['index']=function(_0x17b371,_0x30289f){var _0xd1cd7={},_0x3cfd2e={},_0x173eb4={'count':0x0,'rows':[]};var _0x1724ba=_[_0xcd18('0x2d')](db['SquareProject'][_0xcd18('0x2e')],function(_0x121c59){return{'name':_0x121c59['fieldName'],'type':_0x121c59['type'][_0xcd18('0x2f')]};});_0x3cfd2e[_0xcd18('0x30')]=_[_0xcd18('0x2d')](_0x1724ba,_0xcd18('0x2b'));_0x3cfd2e[_0xcd18('0x31')]=_[_0xcd18('0x32')](_0x17b371[_0xcd18('0x31')]);_0x3cfd2e[_0xcd18('0x33')]=_['intersection'](_0x3cfd2e[_0xcd18('0x30')],_0x3cfd2e['query']);_0xd1cd7[_0xcd18('0x34')]=_[_0xcd18('0x35')](_0x3cfd2e['model'],qs[_0xcd18('0x36')](_0x17b371[_0xcd18('0x31')][_0xcd18('0x36')]));_0xd1cd7['attributes']=_0xd1cd7[_0xcd18('0x34')]['length']?_0xd1cd7[_0xcd18('0x34')]:_0x3cfd2e[_0xcd18('0x30')];if(!_0x17b371[_0xcd18('0x31')][_0xcd18('0x37')](_0xcd18('0x38'))){_0xd1cd7[_0xcd18('0x21')]=qs[_0xcd18('0x21')](_0x17b371[_0xcd18('0x31')]['limit']);_0xd1cd7['offset']=qs[_0xcd18('0x20')](_0x17b371[_0xcd18('0x31')][_0xcd18('0x20')]);}_0xd1cd7['order']=qs[_0xcd18('0x39')](_0x17b371['query'][_0xcd18('0x39')]);_0xd1cd7[_0xcd18('0x3a')]=qs['filters'](_[_0xcd18('0x3b')](_0x17b371[_0xcd18('0x31')],_0x3cfd2e[_0xcd18('0x33')]),_0x1724ba);if(_0x17b371[_0xcd18('0x31')][_0xcd18('0x3c')]){_0xd1cd7[_0xcd18('0x3a')]=_[_0xcd18('0x3d')](_0xd1cd7[_0xcd18('0x3a')],{'$or':_[_0xcd18('0x2d')](_0x1724ba,function(_0x33e8c4){if(_0x33e8c4[_0xcd18('0x3e')]!=='VIRTUAL'){var _0x5dae9e={};_0x5dae9e[_0x33e8c4[_0xcd18('0x2b')]]={'$like':'%'+_0x17b371[_0xcd18('0x31')][_0xcd18('0x3c')]+'%'};return _0x5dae9e;}})});}_0xd1cd7=_[_0xcd18('0x3d')]({},_0xd1cd7,_0x17b371[_0xcd18('0x3f')]);var _0xaf21ab={'where':_0xd1cd7['where']};return db[_0xcd18('0x40')][_0xcd18('0x1f')](_0xaf21ab)[_0xcd18('0x25')](function(_0x27f312){_0x173eb4[_0xcd18('0x1f')]=_0x27f312;if(_0x17b371[_0xcd18('0x31')]['includeAll']){_0xd1cd7[_0xcd18('0x41')]=[{'all':!![]}];}return db[_0xcd18('0x40')]['findAll'](_0xd1cd7);})[_0xcd18('0x25')](function(_0x10c915){_0x173eb4[_0xcd18('0x42')]=_0x10c915;return _0x173eb4;})['then'](respondWithFilteredResult(_0x30289f,_0xd1cd7))[_0xcd18('0x43')](handleError(_0x30289f,null));};exports[_0xcd18('0x44')]=function(_0x215792,_0x1abc6d){var _0x3cef73={'raw':![],'where':{'id':_0x215792[_0xcd18('0x45')]['id']}},_0x1a589f={};_0x1a589f[_0xcd18('0x30')]=_['keys'](db[_0xcd18('0x40')]['rawAttributes']);_0x1a589f[_0xcd18('0x31')]=_[_0xcd18('0x32')](_0x215792[_0xcd18('0x31')]);_0x1a589f[_0xcd18('0x33')]=_[_0xcd18('0x35')](_0x1a589f['model'],_0x1a589f[_0xcd18('0x31')]);_0x3cef73['attributes']=_[_0xcd18('0x35')](_0x1a589f[_0xcd18('0x30')],qs[_0xcd18('0x36')](_0x215792[_0xcd18('0x31')][_0xcd18('0x36')]));_0x3cef73[_0xcd18('0x34')]=_0x3cef73[_0xcd18('0x34')][_0xcd18('0x46')]?_0x3cef73[_0xcd18('0x34')]:_0x1a589f[_0xcd18('0x30')];if(_0x215792[_0xcd18('0x31')][_0xcd18('0x47')]){_0x3cef73[_0xcd18('0x41')]=[{'all':!![]}];}_0x3cef73=_['merge']({},_0x3cef73,_0x215792[_0xcd18('0x3f')]);return db[_0xcd18('0x40')][_0xcd18('0x48')](_0x3cef73)[_0xcd18('0x25')](handleEntityNotFound(_0x1abc6d,null))['then'](respondWithResult(_0x1abc6d,null))[_0xcd18('0x43')](handleError(_0x1abc6d,null));};exports[_0xcd18('0x49')]=function(_0x180a3e,_0x111425){return db[_0xcd18('0x40')][_0xcd18('0x49')](_0x180a3e[_0xcd18('0x4a')],{})[_0xcd18('0x25')](function(_0x290de5){var _0x2e1f54=_0x180a3e[_0xcd18('0x4b')]['get']({'plain':!![]});if(!_0x2e1f54)throw new Error(_0xcd18('0x4c'));if(_0x2e1f54[_0xcd18('0x4d')]===_0xcd18('0x4b')){var _0x34b24b=_0x290de5[_0xcd18('0x27')]({'plain':!![]});var _0x425e3d=_0xcd18('0x28');return db[_0xcd18('0x4e')][_0xcd18('0x48')]({'where':{'name':_0x425e3d,'userProfileId':_0x2e1f54[_0xcd18('0x4f')]},'raw':!![]})[_0xcd18('0x25')](function(_0x1818d3){if(_0x1818d3&&_0x1818d3[_0xcd18('0x50')]===0x0){return db['UserProfileResource'][_0xcd18('0x49')]({'name':_0x34b24b[_0xcd18('0x2b')],'resourceId':_0x34b24b['id'],'type':_0x1818d3['name'],'sectionId':_0x1818d3['id']},{})[_0xcd18('0x25')](function(){return _0x290de5;});}else{return _0x290de5;}})[_0xcd18('0x43')](function(_0x45bf7a){logger['error'](_0xcd18('0x51'),_0x45bf7a);throw _0x45bf7a;});}return _0x290de5;})[_0xcd18('0x25')](respondWithResult(_0x111425,0xc9))['catch'](handleError(_0x111425,null));};exports[_0xcd18('0x52')]=function(_0x2ab701,_0x14b63c){if(_0x2ab701[_0xcd18('0x4a')]['id']){delete _0x2ab701['body']['id'];}return db[_0xcd18('0x40')]['find']({'where':{'id':_0x2ab701[_0xcd18('0x45')]['id']}})['then'](handleEntityNotFound(_0x14b63c,null))[_0xcd18('0x25')](saveUpdates(_0x2ab701[_0xcd18('0x4a')],null))[_0xcd18('0x25')](respondWithResult(_0x14b63c,null))[_0xcd18('0x43')](handleError(_0x14b63c,null));};exports[_0xcd18('0x26')]=function(_0xc52f6e,_0x2a9cea){return db[_0xcd18('0x40')][_0xcd18('0x48')]({'where':{'id':_0xc52f6e[_0xcd18('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a9cea,null))['then'](removeEntity(_0x2a9cea,null))[_0xcd18('0x43')](handleError(_0x2a9cea,null));};exports[_0xcd18('0x53')]=function(_0x53235b,_0x510394,_0x4ad5b0){return db[_0xcd18('0x40')][_0xcd18('0x48')]({'where':{'id':_0x53235b[_0xcd18('0x45')]['id']}})['then'](handleEntityNotFound(_0x510394,null))['then'](function(_0x380312){if(_0x380312){return _0x380312[_0xcd18('0x53')](_0x53235b[_0xcd18('0x4a')][_0xcd18('0x54')],_[_0xcd18('0x55')](_0x53235b['body'],[_0xcd18('0x54'),'id'])||{});}})[_0xcd18('0x25')](respondWithResult(_0x510394,null))['catch'](handleError(_0x510394,null));};exports[_0xcd18('0x56')]=function(_0x4b1d6f,_0xb8acb3,_0x39b749){return db[_0xcd18('0x40')][_0xcd18('0x48')]({'where':{'id':_0x4b1d6f[_0xcd18('0x45')]['id']}})[_0xcd18('0x25')](handleEntityNotFound(_0xb8acb3,null))['then'](function(_0x4f0682){if(_0x4f0682){return _0x4f0682[_0xcd18('0x56')](_0x4b1d6f[_0xcd18('0x31')]['ids'])[_0xcd18('0x25')](function(){if(_[_0xcd18('0x57')](_0x4b1d6f[_0xcd18('0x31')]['ids'])){for(var _0x5074f0=0x0;_0x5074f0<_0x4b1d6f['query'][_0xcd18('0x54')]['length'];_0x5074f0+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x4b1d6f[_0xcd18('0x31')][_0xcd18('0x54')][_0x5074f0]),'SquareProjectId':Number(_0x4b1d6f['params']['id'])});}}else{socket[_0xcd18('0x58')](_0xcd18('0x59'),{'UserId':Number(_0x4b1d6f[_0xcd18('0x31')]['ids']),'SquareProjectId':Number(_0x4b1d6f['params']['id'])});}});}})[_0xcd18('0x25')](respondWithStatusCode(_0xb8acb3,null))[_0xcd18('0x43')](handleError(_0xb8acb3,null));};exports[_0xcd18('0x5a')]=function(_0x3ba632,_0x40c237,_0x40ab22){var _0x51d9f7={};var _0x65a6f3={};var _0x1c7302;var _0x40ded8;return db[_0xcd18('0x40')]['findOne']({'where':{'id':_0x3ba632[_0xcd18('0x45')]['id']}})[_0xcd18('0x25')](handleEntityNotFound(_0x40c237,null))[_0xcd18('0x25')](function(_0x2a116e){if(_0x2a116e){_0x1c7302=_0x2a116e;_0x65a6f3[_0xcd18('0x30')]=_[_0xcd18('0x32')](db[_0xcd18('0x5b')][_0xcd18('0x2e')]);_0x65a6f3['query']=_['keys'](_0x3ba632['query']);_0x65a6f3['filters']=_['intersection'](_0x65a6f3[_0xcd18('0x30')],_0x65a6f3['query']);_0x51d9f7[_0xcd18('0x34')]=_[_0xcd18('0x35')](_0x65a6f3[_0xcd18('0x30')],qs[_0xcd18('0x36')](_0x3ba632[_0xcd18('0x31')]['fields']));_0x51d9f7[_0xcd18('0x34')]=_0x51d9f7['attributes'][_0xcd18('0x46')]?_0x51d9f7[_0xcd18('0x34')]:_0x65a6f3[_0xcd18('0x30')];_0x51d9f7[_0xcd18('0x5c')]=qs[_0xcd18('0x39')](_0x3ba632[_0xcd18('0x31')]['sort']);_0x51d9f7[_0xcd18('0x3a')]=qs[_0xcd18('0x33')](_['pick'](_0x3ba632['query'],_0x65a6f3[_0xcd18('0x33')]));if(_0x3ba632[_0xcd18('0x31')]['filter']){_0x51d9f7['where']=_[_0xcd18('0x3d')](_0x51d9f7[_0xcd18('0x3a')],{'$or':_[_0xcd18('0x2d')](_0x51d9f7[_0xcd18('0x34')],function(_0x289b5c){var _0x16d49c={};_0x16d49c[_0x289b5c]={'$like':'%'+_0x3ba632[_0xcd18('0x31')][_0xcd18('0x3c')]+'%'};return _0x16d49c;})});}_0x51d9f7=_[_0xcd18('0x3d')]({},_0x51d9f7,_0x3ba632[_0xcd18('0x3f')]);return _0x1c7302[_0xcd18('0x5a')](_0x51d9f7);}})[_0xcd18('0x25')](function(_0x2ec3eb){if(_0x2ec3eb){_0x40ded8=_0x2ec3eb[_0xcd18('0x46')];if(!_0x3ba632['query'][_0xcd18('0x37')](_0xcd18('0x38'))){_0x51d9f7[_0xcd18('0x21')]=qs['limit'](_0x3ba632[_0xcd18('0x31')][_0xcd18('0x21')]);_0x51d9f7['offset']=qs[_0xcd18('0x20')](_0x3ba632[_0xcd18('0x31')][_0xcd18('0x20')]);}return _0x1c7302[_0xcd18('0x5a')](_0x51d9f7);}})[_0xcd18('0x25')](function(_0x33262f){if(_0x33262f){return _0x33262f?{'count':_0x40ded8,'rows':_0x33262f}:null;}})[_0xcd18('0x25')](respondWithResult(_0x40c237,null))['catch'](handleError(_0x40c237,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7f46a15..1d13658 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 _0xe349=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0xa9eac1,_0x39a4f7){var _0x282f35=function(_0x30dbd4){while(--_0x30dbd4){_0xa9eac1['push'](_0xa9eac1['shift']());}};_0x282f35(++_0x39a4f7);}(_0xe349,0x107));var _0x9e34=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0xe349[_0x1faaa1];return _0x994ec;};'use strict';var EventEmitter=require(_0x9e34('0x0'));var SquareProject=require(_0x9e34('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9e34('0x2')](0x0);var events={'afterCreate':_0x9e34('0x3'),'afterUpdate':_0x9e34('0x4'),'afterDestroy':'remove'};function emitEvent(_0x92037e){return function(_0x14f1ef,_0x1915b4,_0x214c05){SquareProjectEvents['emit'](_0x92037e+':'+_0x14f1ef['id'],_0x14f1ef);SquareProjectEvents[_0x9e34('0x5')](_0x92037e,_0x14f1ef);_0x214c05(null);};}for(var e in events){if(events[_0x9e34('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x9e34('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x5a1f=['SquareProject','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x5a1f,0x19c));var _0xf5a1=function(_0x14daf3,_0x5a90f9){_0x14daf3=_0x14daf3-0x0;var _0x390818=_0x5a1f[_0x14daf3];return _0x390818;};'use strict';var EventEmitter=require(_0xf5a1('0x0'));var SquareProject=require(_0xf5a1('0x1'))['db'][_0xf5a1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf5a1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf5a1('0x4')};function emitEvent(_0x4287f1){return function(_0x431b16,_0x508949,_0x4d3415){SquareProjectEvents[_0xf5a1('0x5')](_0x4287f1+':'+_0x431b16['id'],_0x431b16);SquareProjectEvents[_0xf5a1('0x5')](_0x4287f1,_0x431b16);_0x4d3415(null);};}for(var e in events){if(events[_0xf5a1('0x6')](e)){var event=events[e];SquareProject[_0xf5a1('0x7')](e,emitEvent(event));}}module[_0xf5a1('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 14a5f88..9b4609a 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 _0x3fec=['square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','api','moment','request-promise','../../config/environment','exports','define','SquareProject'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc3fe('0x1'));var moment=require(_0xc3fe('0x2'));var BPromise=require('bluebird');var rp=require(_0xc3fe('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc3fe('0x4'));var attributes=require('./squareProject.attributes');module[_0xc3fe('0x5')]=function(_0x327d2f,_0x22dd19){return _0x327d2f[_0xc3fe('0x6')](_0xc3fe('0x7'),attributes,{'tableName':_0xc3fe('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e532e,_0x849ec7,_0x25b1eb){if(_0x1e532e[_0xc3fe('0x9')](_0xc3fe('0xa'))){_0x1e532e[_0xc3fe('0xb')]=moment()[_0xc3fe('0xc')](_0xc3fe('0xd'));}if(_0x1e532e[_0xc3fe('0x9')](_0xc3fe('0xe'))){_0x1e532e['publishedAt']=moment()[_0xc3fe('0xc')](_0xc3fe('0xd'));}_0x25b1eb(null,_0x1e532e);}}});}; \ No newline at end of file +var _0x7a59=['exports','define','SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes'];(function(_0xe5ce72,_0x3245b9){var _0x4c8f5d=function(_0x31ea60){while(--_0x31ea60){_0xe5ce72['push'](_0xe5ce72['shift']());}};_0x4c8f5d(++_0x3245b9);}(_0x7a59,0x16e));var _0x97a5=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x7a59[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97a5('0x1'));var moment=require(_0x97a5('0x2'));var BPromise=require(_0x97a5('0x3'));var rp=require(_0x97a5('0x4'));var fs=require('fs');var path=require(_0x97a5('0x5'));var rimraf=require('rimraf');var config=require(_0x97a5('0x6'));var attributes=require(_0x97a5('0x7'));module[_0x97a5('0x8')]=function(_0x48201b,_0x438520){return _0x48201b[_0x97a5('0x9')](_0x97a5('0xa'),attributes,{'tableName':_0x97a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27e8a6,_0x156789,_0x260690){if(_0x27e8a6['changed'](_0x97a5('0xc'))){_0x27e8a6[_0x97a5('0xd')]=moment()[_0x97a5('0xe')](_0x97a5('0xf'));}if(_0x27e8a6[_0x97a5('0x10')]('production')){_0x27e8a6['publishedAt']=moment()[_0x97a5('0xe')](_0x97a5('0xf'));}_0x260690(null,_0x27e8a6);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 39161a6..2143e2a 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 _0xfe9a=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xdb2714,_0x5420d8){var _0x4842dc=function(_0x1eca66){while(--_0x1eca66){_0xdb2714['push'](_0xdb2714['shift']());}};_0x4842dc(++_0x5420d8);}(_0xfe9a,0xb1));var _0xafe9=function(_0x3a27de,_0x5b3849){_0x3a27de=_0x3a27de-0x0;var _0x134c04=_0xfe9a[_0x3a27de];return _0x134c04;};'use strict';var _=require(_0xafe9('0x0'));var util=require('util');var moment=require(_0xafe9('0x1'));var BPromise=require('bluebird');var rs=require(_0xafe9('0x2'));var fs=require('fs');var Redis=require(_0xafe9('0x3'));var db=require(_0xafe9('0x4'))['db'];var utils=require(_0xafe9('0x5'));var logger=require('../../config/logger')(_0xafe9('0x6'));var config=require(_0xafe9('0x7'));var jayson=require(_0xafe9('0x8'));var client=jayson[_0xafe9('0x9')][_0xafe9('0xa')]({'port':0x232a});config[_0xafe9('0xb')]=_[_0xafe9('0xc')](config['redis'],{'host':_0xafe9('0xd'),'port':0x18eb});var socket=require(_0xafe9('0xe'))(new Redis(config['redis']));require(_0xafe9('0xf'))['register'](socket);function respondWithRpcPromise(_0x2c39f4,_0x3ffbf8,_0x4c91e3){return new BPromise(function(_0x2fb84a,_0x485857){return client[_0xafe9('0x10')](_0x2c39f4,_0x4c91e3)[_0xafe9('0x11')](function(_0x592575){logger[_0xafe9('0x12')](_0xafe9('0x13'),_0x3ffbf8,'request\x20sent');logger[_0xafe9('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3ffbf8,_0xafe9('0x15'),JSON[_0xafe9('0x16')](_0x592575));if(_0x592575[_0xafe9('0x17')]){if(_0x592575['error'][_0xafe9('0x18')]===0x1f4){logger['error'](_0xafe9('0x13'),_0x3ffbf8,_0x592575[_0xafe9('0x17')]['message']);return _0x485857(_0x592575[_0xafe9('0x17')][_0xafe9('0x19')]);}logger[_0xafe9('0x17')]('SquareProject,\x20%s,\x20%s',_0x3ffbf8,_0x592575[_0xafe9('0x17')]['message']);return _0x2fb84a(_0x592575[_0xafe9('0x17')][_0xafe9('0x19')]);}else{logger[_0xafe9('0x12')](_0xafe9('0x13'),_0x3ffbf8,_0xafe9('0x15'));_0x2fb84a(_0x592575[_0xafe9('0x1a')]['message']);}})['catch'](function(_0x29a493){logger[_0xafe9('0x17')]('SquareProject,\x20%s,\x20%s',_0x3ffbf8,_0x29a493);_0x485857(_0x29a493);});});}exports[_0xafe9('0x1b')]=function(_0x23a8c8){var _0x57e385=this;return new Promise(function(_0x23d0f2,_0x43f416){return db[_0xafe9('0x1c')][_0xafe9('0x1d')]({'raw':_0x23a8c8['options']?_0x23a8c8[_0xafe9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x23a8c8['options']?_0x23a8c8[_0xafe9('0x1e')][_0xafe9('0x1f')]||null:null,'attributes':_0x23a8c8[_0xafe9('0x1e')]?_0x23a8c8[_0xafe9('0x1e')][_0xafe9('0x20')]||null:null,'include':_0x23a8c8[_0xafe9('0x1e')]?_0x23a8c8['options'][_0xafe9('0x21')]?_[_0xafe9('0x22')](_0x23a8c8['options'][_0xafe9('0x21')],function(_0xf9df31){return{'model':db[_0xf9df31['model']],'as':_0xf9df31['as'],'attributes':_0xf9df31[_0xafe9('0x20')],'include':_0xf9df31[_0xafe9('0x21')]?_[_0xafe9('0x22')](_0xf9df31['include'],function(_0x15ca76){return{'model':db[_0x15ca76[_0xafe9('0x23')]],'as':_0x15ca76['as'],'attributes':_0x15ca76['attributes'],'include':_0x15ca76[_0xafe9('0x21')]?_[_0xafe9('0x22')](_0x15ca76[_0xafe9('0x21')],function(_0x45dd0a){return{'model':db[_0x45dd0a[_0xafe9('0x23')]],'as':_0x45dd0a['as'],'attributes':_0x45dd0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xafe9('0x11')](function(_0x354db6){logger[_0xafe9('0x12')](_0xafe9('0x1b'),_0x23a8c8);logger[_0xafe9('0x14')](_0xafe9('0x1b'),_0x23a8c8,JSON['stringify'](_0x354db6));_0x23d0f2(_0x354db6);})[_0xafe9('0x24')](function(_0x4766f0){logger[_0xafe9('0x17')](_0xafe9('0x1b'),_0x4766f0[_0xafe9('0x19')],_0x23a8c8);_0x43f416(_0x57e385[_0xafe9('0x17')](0x1f4,_0x4766f0[_0xafe9('0x19')]));});});}; \ No newline at end of file +var _0xe287=['SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','attributes','include','map','model','ShowSquareProject','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xe287,0x1ce));var _0x7e28=function(_0x1bc0e2,_0x2a65e3){_0x1bc0e2=_0x1bc0e2-0x0;var _0xac6e4e=_0xe287[_0x1bc0e2];return _0xac6e4e;};'use strict';var _=require('lodash');var util=require(_0x7e28('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e28('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7e28('0x2'))(_0x7e28('0x3'));var config=require(_0x7e28('0x4'));var jayson=require(_0x7e28('0x5'));var client=jayson['client'][_0x7e28('0x6')]({'port':0x232a});config[_0x7e28('0x7')]=_[_0x7e28('0x8')](config['redis'],{'host':_0x7e28('0x9'),'port':0x18eb});var socket=require(_0x7e28('0xa'))(new Redis(config[_0x7e28('0x7')]));require(_0x7e28('0xb'))[_0x7e28('0xc')](socket);function respondWithRpcPromise(_0x2d202e,_0x4f60e3,_0x419f88){return new BPromise(function(_0x199cc9,_0x9955e2){return client['request'](_0x2d202e,_0x419f88)[_0x7e28('0xd')](function(_0x47ebf9){logger[_0x7e28('0xe')](_0x7e28('0xf'),_0x4f60e3,_0x7e28('0x10'));logger[_0x7e28('0x11')](_0x7e28('0x12'),_0x4f60e3,'request\x20sent',JSON[_0x7e28('0x13')](_0x47ebf9));if(_0x47ebf9[_0x7e28('0x14')]){if(_0x47ebf9[_0x7e28('0x14')]['code']===0x1f4){logger['error'](_0x7e28('0xf'),_0x4f60e3,_0x47ebf9[_0x7e28('0x14')][_0x7e28('0x15')]);return _0x9955e2(_0x47ebf9[_0x7e28('0x14')][_0x7e28('0x15')]);}logger[_0x7e28('0x14')](_0x7e28('0xf'),_0x4f60e3,_0x47ebf9[_0x7e28('0x14')][_0x7e28('0x15')]);return _0x199cc9(_0x47ebf9[_0x7e28('0x14')]['message']);}else{logger['info'](_0x7e28('0xf'),_0x4f60e3,_0x7e28('0x10'));_0x199cc9(_0x47ebf9[_0x7e28('0x16')][_0x7e28('0x15')]);}})[_0x7e28('0x17')](function(_0xaf1a0b){logger['error'](_0x7e28('0xf'),_0x4f60e3,_0xaf1a0b);_0x9955e2(_0xaf1a0b);});});}exports['ShowSquareProject']=function(_0x5f0fb7){var _0xcc6099=this;return new Promise(function(_0x299965,_0xee5cd2){return db['SquareProject']['find']({'raw':_0x5f0fb7['options']?_0x5f0fb7[_0x7e28('0x18')][_0x7e28('0x19')]===undefined?!![]:![]:!![],'where':_0x5f0fb7[_0x7e28('0x18')]?_0x5f0fb7[_0x7e28('0x18')][_0x7e28('0x1a')]||null:null,'attributes':_0x5f0fb7['options']?_0x5f0fb7[_0x7e28('0x18')][_0x7e28('0x1b')]||null:null,'include':_0x5f0fb7[_0x7e28('0x18')]?_0x5f0fb7['options'][_0x7e28('0x1c')]?_['map'](_0x5f0fb7[_0x7e28('0x18')]['include'],function(_0x1ae6fb){return{'model':db[_0x1ae6fb['model']],'as':_0x1ae6fb['as'],'attributes':_0x1ae6fb[_0x7e28('0x1b')],'include':_0x1ae6fb['include']?_[_0x7e28('0x1d')](_0x1ae6fb[_0x7e28('0x1c')],function(_0x34a7e2){return{'model':db[_0x34a7e2[_0x7e28('0x1e')]],'as':_0x34a7e2['as'],'attributes':_0x34a7e2[_0x7e28('0x1b')],'include':_0x34a7e2['include']?_['map'](_0x34a7e2[_0x7e28('0x1c')],function(_0xa8c7b6){return{'model':db[_0xa8c7b6[_0x7e28('0x1e')]],'as':_0xa8c7b6['as'],'attributes':_0xa8c7b6[_0x7e28('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34fbfa){logger[_0x7e28('0xe')](_0x7e28('0x1f'),_0x5f0fb7);logger[_0x7e28('0x11')](_0x7e28('0x1f'),_0x5f0fb7,JSON[_0x7e28('0x13')](_0x34fbfa));_0x299965(_0x34fbfa);})[_0x7e28('0x17')](function(_0x45d226){logger['error'](_0x7e28('0x1f'),_0x45d226[_0x7e28('0x15')],_0x5f0fb7);_0xee5cd2(_0xcc6099[_0x7e28('0x14')](0x1f4,_0x45d226[_0x7e28('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 720c209..d2172b2 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 _0x1883=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x197b97,_0x9a1b0){var _0x169f4e=function(_0x594b63){while(--_0x594b63){_0x197b97['push'](_0x197b97['shift']());}};_0x169f4e(++_0x9a1b0);}(_0x1883,0xab));var _0x3188=function(_0x19a3df,_0x464053){_0x19a3df=_0x19a3df-0x0;var _0x3935b2=_0x1883[_0x19a3df];return _0x3935b2;};'use strict';var SquareProjectEvents=require(_0x3188('0x0'));var events=[_0x3188('0x1'),_0x3188('0x2'),_0x3188('0x3')];function createListener(_0x11e3bf,_0x7ce655){return function(_0x2551e5){_0x7ce655[_0x3188('0x4')](_0x11e3bf,_0x2551e5);};}function removeListener(_0x1c7c86,_0x44afb8){return function(){SquareProjectEvents[_0x3188('0x5')](_0x1c7c86,_0x44afb8);};}exports[_0x3188('0x6')]=function(_0x408ae0){for(var _0x33b62d=0x0,_0x24f2f1=events[_0x3188('0x7')];_0x33b62d<_0x24f2f1;_0x33b62d++){var _0x3e3afb=events[_0x33b62d];var _0x5c8f26=createListener(_0x3188('0x8')+_0x3e3afb,_0x408ae0);SquareProjectEvents['on'](_0x3e3afb,_0x5c8f26);}}; \ No newline at end of file +var _0xd117=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x452d3e,_0x46aff8){var _0x3b1530=function(_0x51aee7){while(--_0x51aee7){_0x452d3e['push'](_0x452d3e['shift']());}};_0x3b1530(++_0x46aff8);}(_0xd117,0x182));var _0x7d11=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0xd117[_0x3ce937];return _0x41d2fa;};'use strict';var SquareProjectEvents=require(_0x7d11('0x0'));var events=[_0x7d11('0x1'),_0x7d11('0x2'),_0x7d11('0x3')];function createListener(_0x454387,_0x26e0f0){return function(_0x306ae4){_0x26e0f0[_0x7d11('0x4')](_0x454387,_0x306ae4);};}function removeListener(_0x3c07be,_0x31fcb0){return function(){SquareProjectEvents[_0x7d11('0x5')](_0x3c07be,_0x31fcb0);};}exports[_0x7d11('0x6')]=function(_0x27d7e8){for(var _0x40c3c4=0x0,_0x345602=events[_0x7d11('0x7')];_0x40c3c4<_0x345602;_0x40c3c4++){var _0x47b5e6=events[_0x40c3c4];var _0x3803b5=createListener(_0x7d11('0x8')+_0x47b5e6,_0x27d7e8);SquareProjectEvents['on'](_0x47b5e6,_0x3803b5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9693062..4fb2a16 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 _0x8e62=['get','isAuthenticated','index','show','/:id/download','download','create','/:id','update','/:id/delete','exports','multer','util','path','connect-timeout','express','Router','./squareRecording.controller'];(function(_0x170f4c,_0x4a4c80){var _0x52eedd=function(_0x473905){while(--_0x473905){_0x170f4c['push'](_0x170f4c['shift']());}};_0x52eedd(++_0x4a4c80);}(_0x8e62,0xe3));var _0x28e6=function(_0x13573c,_0x585238){_0x13573c=_0x13573c-0x0;var _0x37bc6e=_0x8e62[_0x13573c];return _0x37bc6e;};'use strict';var multer=require(_0x28e6('0x0'));var util=require(_0x28e6('0x1'));var path=require(_0x28e6('0x2'));var timeout=require(_0x28e6('0x3'));var express=require(_0x28e6('0x4'));var router=express[_0x28e6('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28e6('0x6'));router[_0x28e6('0x7')]('/',auth[_0x28e6('0x8')](),controller[_0x28e6('0x9')]);router['get']('/:id',auth[_0x28e6('0x8')](),controller[_0x28e6('0xa')]);router[_0x28e6('0x7')](_0x28e6('0xb'),auth[_0x28e6('0x8')](),controller[_0x28e6('0xc')]);router['post']('/',auth[_0x28e6('0x8')](),controller[_0x28e6('0xd')]);router['put'](_0x28e6('0xe'),auth[_0x28e6('0x8')](),controller[_0x28e6('0xf')]);router['delete'](_0x28e6('0x10'),auth[_0x28e6('0x8')](),controller['destroy']);module[_0x28e6('0x11')]=router; \ No newline at end of file +var _0x22a8=['/:id/delete','destroy','multer','path','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','download','post','create','put','/:id','update','delete'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x22a8,0xec));var _0x822a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x22a8[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x822a('0x0'));var util=require('util');var path=require(_0x822a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x822a('0x2')]();var auth=require(_0x822a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x822a('0x4'));var controller=require(_0x822a('0x5'));router[_0x822a('0x6')]('/',auth[_0x822a('0x7')](),controller[_0x822a('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x822a('0x6')]('/:id/download',auth[_0x822a('0x7')](),controller[_0x822a('0x9')]);router[_0x822a('0xa')]('/',auth[_0x822a('0x7')](),controller[_0x822a('0xb')]);router[_0x822a('0xc')](_0x822a('0xd'),auth[_0x822a('0x7')](),controller[_0x822a('0xe')]);router[_0x822a('0xf')](_0x822a('0x10'),auth[_0x822a('0x7')](),controller[_0x822a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 4a6d806..ab77089 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 _0xe1de=['lastIndexOf','sequelize','exports','STRING','getDataValue','savePath','substring'];(function(_0x201c57,_0x58d3b1){var _0x251ce4=function(_0x41714b){while(--_0x41714b){_0x201c57['push'](_0x201c57['shift']());}};_0x251ce4(++_0x58d3b1);}(_0xe1de,0x14a));var _0xee1d=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe1de[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0xee1d('0x0'));module[_0xee1d('0x1')]={'uniqueid':{'type':Sequelize[_0xee1d('0x2')]},'callerid':{'type':Sequelize[_0xee1d('0x2')]},'calleridname':{'type':Sequelize[_0xee1d('0x2')]},'context':{'type':Sequelize[_0xee1d('0x2')]},'extension':{'type':Sequelize[_0xee1d('0x2')]},'priority':{'type':Sequelize[_0xee1d('0x2')]},'accountcode':{'type':Sequelize[_0xee1d('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xee1d('0x2')]},'filename':{'type':Sequelize[_0xee1d('0x2')]},'savePath':{'type':Sequelize[_0xee1d('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x46f1f3='';var _0x3e470b=this[_0xee1d('0x3')](_0xee1d('0x4'));if(_0x3e470b){_0x46f1f3=_0x3e470b[_0xee1d('0x5')](_0x3e470b[_0xee1d('0x6')]('.'));}return _0x46f1f3;}}}; \ No newline at end of file +var _0xdaa1=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xdaa1,0x17d));var _0x1daa=function(_0x2042f7,_0x4d5c82){_0x2042f7=_0x2042f7-0x0;var _0x1d7e2a=_0xdaa1[_0x2042f7];return _0x1d7e2a;};'use strict';var Sequelize=require(_0x1daa('0x0'));module[_0x1daa('0x1')]={'uniqueid':{'type':Sequelize[_0x1daa('0x2')]},'callerid':{'type':Sequelize[_0x1daa('0x2')]},'calleridname':{'type':Sequelize[_0x1daa('0x2')]},'context':{'type':Sequelize[_0x1daa('0x2')]},'extension':{'type':Sequelize[_0x1daa('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1daa('0x2')]},'dnid':{'type':Sequelize[_0x1daa('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x1daa('0x2')]},'filename':{'type':Sequelize[_0x1daa('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1daa('0x3')],'get':function(){var _0x25e882='';var _0x2aef81=this[_0x1daa('0x4')]('savePath');if(_0x2aef81){_0x25e882=_0x2aef81[_0x1daa('0x5')](_0x2aef81[_0x1daa('0x6')]('.'));}return _0x25e882;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e8dd101..57dbe83 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 _0x35fa=['count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x35fa,0x1c7));var _0xa35f=function(_0x23f81d,_0x74a4c5){_0x23f81d=_0x23f81d-0x0;var _0x244b49=_0x35fa[_0x23f81d];return _0x244b49;};'use strict';var pdf=require(_0xa35f('0x0'));var emlformat=require(_0xa35f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa35f('0x2'));var jsonpatch=require(_0xa35f('0x3'));var rp=require(_0xa35f('0x4'));var moment=require(_0xa35f('0x5'));var BPromise=require(_0xa35f('0x6'));var Mustache=require(_0xa35f('0x7'));var util=require(_0xa35f('0x8'));var path=require(_0xa35f('0x9'));var sox=require(_0xa35f('0xa'));var csv=require(_0xa35f('0xb'));var ejs=require(_0xa35f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa35f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa35f('0xb'));var querystring=require(_0xa35f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa35f('0xf'));var authService=require(_0xa35f('0x10'));var qs=require(_0xa35f('0x11'));var as=require(_0xa35f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa35f('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa35f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5f39,_0x8e01b5){_0x8e01b5=_0x8e01b5||0xcc;return function(_0x1076da){if(_0x1076da){return _0x1a5f39[_0xa35f('0x15')](_0x8e01b5);}return _0x1a5f39[_0xa35f('0x16')](_0x8e01b5)[_0xa35f('0x17')]();};}function respondWithResult(_0x19e45d,_0x1d724c){_0x1d724c=_0x1d724c||0xc8;return function(_0x450eb3){if(_0x450eb3){return _0x19e45d['status'](_0x1d724c)[_0xa35f('0x18')](_0x450eb3);}};}function respondWithFilteredResult(_0x454428,_0x50234e){return function(_0x2d36b4){if(_0x2d36b4){var _0x56e027=_0x2d36b4[_0xa35f('0x19')],_0x186971=_0x50234e[_0xa35f('0x1a')],_0x5c309c=_0x50234e[_0xa35f('0x1a')]+_0x50234e['limit'],_0x365ed8;if(_0x5c309c>=_0x56e027){_0x5c309c=_0x56e027;_0x365ed8=0xc8;}else{_0x365ed8=0xce;}_0x454428[_0xa35f('0x16')](_0x365ed8);return _0x454428['set'](_0xa35f('0x1b'),_0x186971+'-'+_0x5c309c+'/'+_0x56e027)[_0xa35f('0x18')](_0x2d36b4);}return null;};}function patchUpdates(_0x524167){return function(_0x650b74){try{jsonpatch[_0xa35f('0x1c')](_0x650b74,_0x524167,!![]);}catch(_0x244c83){return BPromise[_0xa35f('0x1d')](_0x244c83);}return _0x650b74['save']();};}function saveUpdates(_0x32e038,_0x161d46){return function(_0xeb85e2){if(_0xeb85e2){return _0xeb85e2[_0xa35f('0x1e')](_0x32e038)[_0xa35f('0x1f')](function(_0x3b5c7e){return _0x3b5c7e;});}return null;};}function removeEntity(_0x19e775,_0x263d68){return function(_0x555ac4){if(_0x555ac4){return _0x555ac4[_0xa35f('0x20')]()['then'](function(){_0x19e775['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c526,_0x2bec47){return function(_0x57b9e5){if(!_0x57b9e5){_0x29c526[_0xa35f('0x15')](0x194);}return _0x57b9e5;};}function handleError(_0x50c426,_0x3ee86a){_0x3ee86a=_0x3ee86a||0x1f4;return function(_0x55b6fc){logger[_0xa35f('0x21')](_0x55b6fc[_0xa35f('0x22')]);if(_0x55b6fc[_0xa35f('0x23')]){delete _0x55b6fc[_0xa35f('0x23')];}_0x50c426[_0xa35f('0x16')](_0x3ee86a)[_0xa35f('0x24')](_0x55b6fc);};}exports[_0xa35f('0x25')]=function(_0x22e561,_0x132de1){var _0x1481f7={},_0x5c0750={},_0x3ae4e1={'count':0x0,'rows':[]};var _0xdad901=_[_0xa35f('0x26')](db['SquareRecording'][_0xa35f('0x27')],function(_0x1e3429){return{'name':_0x1e3429[_0xa35f('0x28')],'type':_0x1e3429[_0xa35f('0x29')][_0xa35f('0x2a')]};});_0x5c0750[_0xa35f('0x2b')]=_[_0xa35f('0x26')](_0xdad901,'name');_0x5c0750[_0xa35f('0x2c')]=_[_0xa35f('0x2d')](_0x22e561['query']);_0x5c0750[_0xa35f('0x2e')]=_['intersection'](_0x5c0750[_0xa35f('0x2b')],_0x5c0750[_0xa35f('0x2c')]);_0x1481f7[_0xa35f('0x2f')]=_[_0xa35f('0x30')](_0x5c0750['model'],qs[_0xa35f('0x31')](_0x22e561[_0xa35f('0x2c')][_0xa35f('0x31')]));_0x1481f7[_0xa35f('0x2f')]=_0x1481f7['attributes'][_0xa35f('0x32')]?_0x1481f7[_0xa35f('0x2f')]:_0x5c0750[_0xa35f('0x2b')];if(!_0x22e561[_0xa35f('0x2c')]['hasOwnProperty'](_0xa35f('0x33'))){_0x1481f7[_0xa35f('0x34')]=qs[_0xa35f('0x34')](_0x22e561['query'][_0xa35f('0x34')]);_0x1481f7[_0xa35f('0x1a')]=qs['offset'](_0x22e561[_0xa35f('0x2c')][_0xa35f('0x1a')]);}_0x1481f7[_0xa35f('0x35')]=qs[_0xa35f('0x36')](_0x22e561[_0xa35f('0x2c')][_0xa35f('0x36')]);_0x1481f7[_0xa35f('0x37')]=qs[_0xa35f('0x2e')](_[_0xa35f('0x38')](_0x22e561[_0xa35f('0x2c')],_0x5c0750[_0xa35f('0x2e')]),_0xdad901);if(_0x22e561['query'][_0xa35f('0x39')]){_0x1481f7[_0xa35f('0x37')]=_[_0xa35f('0x3a')](_0x1481f7['where'],{'$or':_[_0xa35f('0x26')](_0xdad901,function(_0x27b8f8){if(_0x27b8f8[_0xa35f('0x29')]!=='VIRTUAL'){var _0x57b3e4={};_0x57b3e4[_0x27b8f8[_0xa35f('0x23')]]={'$like':'%'+_0x22e561[_0xa35f('0x2c')]['filter']+'%'};return _0x57b3e4;}})});}_0x1481f7=_[_0xa35f('0x3a')]({},_0x1481f7,_0x22e561[_0xa35f('0x3b')]);var _0x4e6657={'where':_0x1481f7[_0xa35f('0x37')]};return db[_0xa35f('0x3c')][_0xa35f('0x19')](_0x4e6657)[_0xa35f('0x1f')](function(_0x28ffcb){_0x3ae4e1['count']=_0x28ffcb;if(_0x22e561[_0xa35f('0x2c')][_0xa35f('0x3d')]){_0x1481f7[_0xa35f('0x3e')]=[{'all':!![]}];}return db[_0xa35f('0x3c')][_0xa35f('0x3f')](_0x1481f7);})[_0xa35f('0x1f')](function(_0x1f2083){_0x3ae4e1[_0xa35f('0x40')]=_0x1f2083;return _0x3ae4e1;})[_0xa35f('0x1f')](respondWithFilteredResult(_0x132de1,_0x1481f7))[_0xa35f('0x41')](handleError(_0x132de1,null));};exports[_0xa35f('0x42')]=function(_0x376197,_0xabfadf){var _0x243f64={'raw':!![],'where':{'id':_0x376197[_0xa35f('0x43')]['id']}},_0x4f4b08={};_0x4f4b08[_0xa35f('0x2b')]=_[_0xa35f('0x2d')](db[_0xa35f('0x3c')][_0xa35f('0x27')]);_0x4f4b08['query']=_[_0xa35f('0x2d')](_0x376197[_0xa35f('0x2c')]);_0x4f4b08['filters']=_[_0xa35f('0x30')](_0x4f4b08[_0xa35f('0x2b')],_0x4f4b08[_0xa35f('0x2c')]);_0x243f64['attributes']=_[_0xa35f('0x30')](_0x4f4b08[_0xa35f('0x2b')],qs[_0xa35f('0x31')](_0x376197[_0xa35f('0x2c')]['fields']));_0x243f64[_0xa35f('0x2f')]=_0x243f64[_0xa35f('0x2f')][_0xa35f('0x32')]?_0x243f64[_0xa35f('0x2f')]:_0x4f4b08[_0xa35f('0x2b')];if(_0x376197[_0xa35f('0x2c')][_0xa35f('0x3d')]){_0x243f64[_0xa35f('0x3e')]=[{'all':!![]}];}_0x243f64=_[_0xa35f('0x3a')]({},_0x243f64,_0x376197[_0xa35f('0x3b')]);return db[_0xa35f('0x3c')][_0xa35f('0x44')](_0x243f64)[_0xa35f('0x1f')](handleEntityNotFound(_0xabfadf,null))[_0xa35f('0x1f')](respondWithResult(_0xabfadf,null))[_0xa35f('0x41')](handleError(_0xabfadf,null));};exports[_0xa35f('0x45')]=function(_0x14c3c5,_0x614a3a){return db['SquareRecording'][_0xa35f('0x45')](_0x14c3c5[_0xa35f('0x46')],{})[_0xa35f('0x1f')](respondWithResult(_0x614a3a,0xc9))['catch'](handleError(_0x614a3a,null));};exports[_0xa35f('0x1e')]=function(_0xa95eb2,_0x4ca041){if(_0xa95eb2['body']['id']){delete _0xa95eb2['body']['id'];}return db[_0xa35f('0x3c')][_0xa35f('0x44')]({'where':{'id':_0xa95eb2[_0xa35f('0x43')]['id']}})[_0xa35f('0x1f')](handleEntityNotFound(_0x4ca041,null))[_0xa35f('0x1f')](saveUpdates(_0xa95eb2[_0xa35f('0x46')],null))[_0xa35f('0x1f')](respondWithResult(_0x4ca041,null))[_0xa35f('0x41')](handleError(_0x4ca041,null));};exports[_0xa35f('0x47')]=function(_0x4e8ebc,_0x140d9e,_0x59601d){var _0x5764b1=require(_0xa35f('0x48'));var _0x4e020a=![];var _0x1790f6={};if(_0x4e8ebc['query'][_0xa35f('0x29')]&&_0x4e8ebc[_0xa35f('0x2c')]['type']===_0xa35f('0x49')){_0x1790f6[_0xa35f('0x49')]=_0x4e8ebc[_0xa35f('0x43')]['id'];}else{_0x1790f6['id']=_0x4e8ebc[_0xa35f('0x43')]['id'];}return db['SquareRecording']['find']({'where':_0x1790f6,'attributes':['id',_0xa35f('0x4a'),_0xa35f('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x140d9e,null))[_0xa35f('0x1f')](function(_0x142159){if(_0x142159){var _0xccd36d=_0x142159[_0xa35f('0x4a')];var _0xcf158=util[_0xa35f('0x4c')](_0xa35f('0x4d'),_0xccd36d);if(fs[_0xa35f('0x4e')](_0xcf158)){_0x4e020a=!![];return _0x5764b1[_0xa35f('0x4f')](_0xcf158,_0xccd36d,config[_0xa35f('0x50')][_0xa35f('0x51')])[_0xa35f('0x1f')](function(){return _0x142159;});}return _0x142159;}})['then'](function(_0x43dfc6){if(_0x43dfc6){var _0x33bcdb=_0x43dfc6[_0xa35f('0x4a')];if(!fs[_0xa35f('0x4e')](_0x33bcdb)){throw new db[(_0xa35f('0x52'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x43dfc6[_0xa35f('0x4b')]){return _0x140d9e[_0xa35f('0x47')](_0x33bcdb,_0x43dfc6['filename']+path[_0xa35f('0x53')](_0x33bcdb),function(){if(_0x4e020a){fs[_0xa35f('0x54')](_0x33bcdb);}});}else{return _0x140d9e[_0xa35f('0x47')](_0x33bcdb,function(_0x565832){if(_0x4e020a){fs['unlink'](_0x33bcdb);}});}}})[_0xa35f('0x41')](function(_0x40f682){if(_0x40f682[_0xa35f('0x55')]===_0xa35f('0x56')){_0x140d9e[_0xa35f('0x16')](0x194)['send'](_0xa35f('0x57'));}else{return handleError(_0x140d9e,null);}});};exports[_0xa35f('0x20')]=function(_0x49211f,_0x30af7a){return db['SquareRecording'][_0xa35f('0x44')]({'where':{'id':_0x49211f[_0xa35f('0x43')]['id']}})[_0xa35f('0x1f')](function(_0x10db86){if(!_0x10db86)throw new ReferenceError(_0xa35f('0x58'));return _0x10db86;})[_0xa35f('0x1f')](function(_0x1c1dc9){var _0x152969=_0x1c1dc9['savePath'];logger[_0xa35f('0x59')](_0xa35f('0x5a'),_0x152969);if(!_['isNil'](_0x1c1dc9['savePath'])&&fs[_0xa35f('0x4e')](_0x152969)){logger[_0xa35f('0x59')](_0xa35f('0x5b')+_0x152969+_0xa35f('0x5c'));fs[_0xa35f('0x5d')](_0x152969);}_0x152969=_0x152969+_0xa35f('0x5e');if(!_[_0xa35f('0x5f')](_0x1c1dc9['savePath'])&&fs[_0xa35f('0x4e')](_0x152969)){logger[_0xa35f('0x59')](_0xa35f('0x5b')+_0x152969+_0xa35f('0x5c'));fs[_0xa35f('0x5d')](_0x152969);}return _0x1c1dc9;})[_0xa35f('0x1f')](function(_0x16e4f9){if(!_0x16e4f9)throw new InternalError();return _0x16e4f9[_0xa35f('0x20')]();})[_0xa35f('0x1f')](function(){_0x30af7a[_0xa35f('0x16')](0xcc)[_0xa35f('0x17')]();})['catch'](handleError(_0x30af7a,null));}; \ No newline at end of file +var _0xbf13=['destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','error','stack','map','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','merge','options','where','include','SquareRecording','findAll','rows','catch','show','params','keys','body','update','find','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found'];(function(_0x5a5aaf,_0x108d76){var _0x1cdd42=function(_0x4332fe){while(--_0x4332fe){_0x5a5aaf['push'](_0x5a5aaf['shift']());}};_0x1cdd42(++_0x108d76);}(_0xbf13,0x66));var _0x3bf1=function(_0x5ae055,_0x2d5726){_0x5ae055=_0x5ae055-0x0;var _0x4eb3fe=_0xbf13[_0x5ae055];return _0x4eb3fe;};'use strict';var pdf=require(_0x3bf1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3bf1('0x1'));var zipdir=require(_0x3bf1('0x2'));var jsonpatch=require(_0x3bf1('0x3'));var rp=require(_0x3bf1('0x4'));var moment=require(_0x3bf1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3bf1('0x6'));var util=require(_0x3bf1('0x7'));var path=require(_0x3bf1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bf1('0x9'));var fs=require('fs');var _=require(_0x3bf1('0xa'));var squel=require(_0x3bf1('0xb'));var crypto=require(_0x3bf1('0xc'));var jsforce=require(_0x3bf1('0xd'));var deskjs=require(_0x3bf1('0xe'));var toCsv=require(_0x3bf1('0xf'));var querystring=require(_0x3bf1('0x10'));var Papa=require(_0x3bf1('0x11'));var Redis=require(_0x3bf1('0x12'));var authService=require(_0x3bf1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bf1('0x14'));var logger=require('../../config/logger')(_0x3bf1('0x15'));var utils=require(_0x3bf1('0x16'));var config=require(_0x3bf1('0x17'));var licenseUtil=require(_0x3bf1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250432,_0x2aa27a){_0x2aa27a=_0x2aa27a||0xcc;return function(_0x3bbca7){if(_0x3bbca7){return _0x250432[_0x3bf1('0x19')](_0x2aa27a);}return _0x250432[_0x3bf1('0x1a')](_0x2aa27a)[_0x3bf1('0x1b')]();};}function respondWithResult(_0x13a831,_0x5eb98c){_0x5eb98c=_0x5eb98c||0xc8;return function(_0x4d802d){if(_0x4d802d){return _0x13a831[_0x3bf1('0x1a')](_0x5eb98c)[_0x3bf1('0x1c')](_0x4d802d);}};}function respondWithFilteredResult(_0xd1da3,_0x33fafd){return function(_0x46f535){if(_0x46f535){var _0x501254=_0x46f535[_0x3bf1('0x1d')],_0x4c009d=_0x33fafd[_0x3bf1('0x1e')],_0x308ad4=_0x33fafd[_0x3bf1('0x1e')]+_0x33fafd['limit'],_0x851237;if(_0x308ad4>=_0x501254){_0x308ad4=_0x501254;_0x851237=0xc8;}else{_0x851237=0xce;}_0xd1da3['status'](_0x851237);return _0xd1da3[_0x3bf1('0x1f')](_0x3bf1('0x20'),_0x4c009d+'-'+_0x308ad4+'/'+_0x501254)[_0x3bf1('0x1c')](_0x46f535);}return null;};}function patchUpdates(_0x5937f5){return function(_0x705e87){try{jsonpatch[_0x3bf1('0x21')](_0x705e87,_0x5937f5,!![]);}catch(_0x19c3ff){return BPromise['reject'](_0x19c3ff);}return _0x705e87[_0x3bf1('0x22')]();};}function saveUpdates(_0x20e095,_0x126a25){return function(_0xc65b2e){if(_0xc65b2e){return _0xc65b2e['update'](_0x20e095)[_0x3bf1('0x23')](function(_0x37ae11){return _0x37ae11;});}return null;};}function removeEntity(_0x156a11,_0x372bfc){return function(_0x4106bc){if(_0x4106bc){return _0x4106bc['destroy']()[_0x3bf1('0x23')](function(){_0x156a11[_0x3bf1('0x1a')](0xcc)[_0x3bf1('0x1b')]();});}};}function handleEntityNotFound(_0x1b59c4,_0x3631b4){return function(_0x1ef719){if(!_0x1ef719){_0x1b59c4[_0x3bf1('0x19')](0x194);}return _0x1ef719;};}function handleError(_0x257666,_0x4d95e2){_0x4d95e2=_0x4d95e2||0x1f4;return function(_0x347f7e){logger[_0x3bf1('0x24')](_0x347f7e[_0x3bf1('0x25')]);if(_0x347f7e['name']){delete _0x347f7e['name'];}_0x257666[_0x3bf1('0x1a')](_0x4d95e2)['send'](_0x347f7e);};}exports['index']=function(_0x2c78a4,_0xf5a037){var _0x7fa220={},_0x462b1d={},_0x47b21f={'count':0x0,'rows':[]};var _0x4de752=_[_0x3bf1('0x26')](db['SquareRecording'][_0x3bf1('0x27')],function(_0x1681ac){return{'name':_0x1681ac['fieldName'],'type':_0x1681ac[_0x3bf1('0x28')][_0x3bf1('0x29')]};});_0x462b1d[_0x3bf1('0x2a')]=_[_0x3bf1('0x26')](_0x4de752,_0x3bf1('0x2b'));_0x462b1d[_0x3bf1('0x2c')]=_['keys'](_0x2c78a4[_0x3bf1('0x2c')]);_0x462b1d[_0x3bf1('0x2d')]=_[_0x3bf1('0x2e')](_0x462b1d[_0x3bf1('0x2a')],_0x462b1d[_0x3bf1('0x2c')]);_0x7fa220['attributes']=_[_0x3bf1('0x2e')](_0x462b1d[_0x3bf1('0x2a')],qs[_0x3bf1('0x2f')](_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x2f')]));_0x7fa220[_0x3bf1('0x30')]=_0x7fa220[_0x3bf1('0x30')][_0x3bf1('0x31')]?_0x7fa220[_0x3bf1('0x30')]:_0x462b1d[_0x3bf1('0x2a')];if(!_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x32')]('nolimit')){_0x7fa220[_0x3bf1('0x33')]=qs['limit'](_0x2c78a4[_0x3bf1('0x2c')]['limit']);_0x7fa220[_0x3bf1('0x1e')]=qs[_0x3bf1('0x1e')](_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x1e')]);}_0x7fa220[_0x3bf1('0x34')]=qs['sort'](_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x35')]);_0x7fa220['where']=qs[_0x3bf1('0x2d')](_[_0x3bf1('0x36')](_0x2c78a4[_0x3bf1('0x2c')],_0x462b1d['filters']),_0x4de752);if(_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x37')]){_0x7fa220['where']=_[_0x3bf1('0x38')](_0x7fa220['where'],{'$or':_['map'](_0x4de752,function(_0x3b59c0){if(_0x3b59c0['type']!=='VIRTUAL'){var _0x356670={};_0x356670[_0x3b59c0['name']]={'$like':'%'+_0x2c78a4[_0x3bf1('0x2c')][_0x3bf1('0x37')]+'%'};return _0x356670;}})});}_0x7fa220=_[_0x3bf1('0x38')]({},_0x7fa220,_0x2c78a4[_0x3bf1('0x39')]);var _0xa03e70={'where':_0x7fa220[_0x3bf1('0x3a')]};return db['SquareRecording'][_0x3bf1('0x1d')](_0xa03e70)[_0x3bf1('0x23')](function(_0x3a7f77){_0x47b21f[_0x3bf1('0x1d')]=_0x3a7f77;if(_0x2c78a4[_0x3bf1('0x2c')]['includeAll']){_0x7fa220[_0x3bf1('0x3b')]=[{'all':!![]}];}return db[_0x3bf1('0x3c')][_0x3bf1('0x3d')](_0x7fa220);})['then'](function(_0x420794){_0x47b21f[_0x3bf1('0x3e')]=_0x420794;return _0x47b21f;})[_0x3bf1('0x23')](respondWithFilteredResult(_0xf5a037,_0x7fa220))[_0x3bf1('0x3f')](handleError(_0xf5a037,null));};exports[_0x3bf1('0x40')]=function(_0x463130,_0x15d834){var _0x2ce706={'raw':!![],'where':{'id':_0x463130[_0x3bf1('0x41')]['id']}},_0x44e447={};_0x44e447[_0x3bf1('0x2a')]=_[_0x3bf1('0x42')](db['SquareRecording'][_0x3bf1('0x27')]);_0x44e447[_0x3bf1('0x2c')]=_['keys'](_0x463130['query']);_0x44e447[_0x3bf1('0x2d')]=_[_0x3bf1('0x2e')](_0x44e447[_0x3bf1('0x2a')],_0x44e447[_0x3bf1('0x2c')]);_0x2ce706[_0x3bf1('0x30')]=_['intersection'](_0x44e447[_0x3bf1('0x2a')],qs[_0x3bf1('0x2f')](_0x463130['query'][_0x3bf1('0x2f')]));_0x2ce706[_0x3bf1('0x30')]=_0x2ce706[_0x3bf1('0x30')]['length']?_0x2ce706[_0x3bf1('0x30')]:_0x44e447['model'];if(_0x463130['query']['includeAll']){_0x2ce706['include']=[{'all':!![]}];}_0x2ce706=_[_0x3bf1('0x38')]({},_0x2ce706,_0x463130[_0x3bf1('0x39')]);return db[_0x3bf1('0x3c')]['find'](_0x2ce706)[_0x3bf1('0x23')](handleEntityNotFound(_0x15d834,null))['then'](respondWithResult(_0x15d834,null))[_0x3bf1('0x3f')](handleError(_0x15d834,null));};exports['create']=function(_0x4ebb09,_0x21f9c4){return db[_0x3bf1('0x3c')]['create'](_0x4ebb09[_0x3bf1('0x43')],{})[_0x3bf1('0x23')](respondWithResult(_0x21f9c4,0xc9))[_0x3bf1('0x3f')](handleError(_0x21f9c4,null));};exports[_0x3bf1('0x44')]=function(_0x24bcd7,_0x2b1f02){if(_0x24bcd7[_0x3bf1('0x43')]['id']){delete _0x24bcd7[_0x3bf1('0x43')]['id'];}return db[_0x3bf1('0x3c')][_0x3bf1('0x45')]({'where':{'id':_0x24bcd7[_0x3bf1('0x41')]['id']}})[_0x3bf1('0x23')](handleEntityNotFound(_0x2b1f02,null))[_0x3bf1('0x23')](saveUpdates(_0x24bcd7['body'],null))[_0x3bf1('0x23')](respondWithResult(_0x2b1f02,null))[_0x3bf1('0x3f')](handleError(_0x2b1f02,null));};exports[_0x3bf1('0x46')]=function(_0x46f086,_0x285198,_0x55c27e){var _0x40ebca=require(_0x3bf1('0x47'));var _0x50a212=![];var _0x3b77b8={};if(_0x46f086[_0x3bf1('0x2c')][_0x3bf1('0x28')]&&_0x46f086[_0x3bf1('0x2c')][_0x3bf1('0x28')]===_0x3bf1('0x48')){_0x3b77b8[_0x3bf1('0x48')]=_0x46f086[_0x3bf1('0x41')]['id'];}else{_0x3b77b8['id']=_0x46f086[_0x3bf1('0x41')]['id'];}return db[_0x3bf1('0x3c')][_0x3bf1('0x45')]({'where':_0x3b77b8,'attributes':['id',_0x3bf1('0x49'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x285198,null))[_0x3bf1('0x23')](function(_0x1b982b){if(_0x1b982b){var _0xf671be=_0x1b982b['savePath'];var _0x252d3c=util[_0x3bf1('0x4a')]('%s.cypher',_0xf671be);if(fs[_0x3bf1('0x4b')](_0x252d3c)){_0x50a212=!![];return _0x40ebca[_0x3bf1('0x4c')](_0x252d3c,_0xf671be,config[_0x3bf1('0x4d')][_0x3bf1('0x4e')])['then'](function(){return _0x1b982b;});}return _0x1b982b;}})['then'](function(_0x3e5291){if(_0x3e5291){var _0x1846ef=_0x3e5291[_0x3bf1('0x49')];if(!fs[_0x3bf1('0x4b')](_0x1846ef)){throw new db['Sequelize'][(_0x3bf1('0x4f'))](_0x3bf1('0x50'));}if(_0x3e5291[_0x3bf1('0x51')]){return _0x285198[_0x3bf1('0x46')](_0x1846ef,_0x3e5291[_0x3bf1('0x51')]+path[_0x3bf1('0x52')](_0x1846ef),function(){if(_0x50a212){fs[_0x3bf1('0x53')](_0x1846ef);}});}else{return _0x285198[_0x3bf1('0x46')](_0x1846ef,function(_0x163613){if(_0x50a212){fs[_0x3bf1('0x53')](_0x1846ef);}});}}})[_0x3bf1('0x3f')](function(_0x1f17ab){if(_0x1f17ab[_0x3bf1('0x54')]===_0x3bf1('0x50')){_0x285198[_0x3bf1('0x1a')](0x194)['send'](_0x3bf1('0x55'));}else{return handleError(_0x285198,null);}});};exports[_0x3bf1('0x56')]=function(_0x5b90e3,_0x27c841){return db[_0x3bf1('0x3c')]['find']({'where':{'id':_0x5b90e3[_0x3bf1('0x41')]['id']}})[_0x3bf1('0x23')](function(_0x30db08){if(!_0x30db08)throw new ReferenceError(_0x3bf1('0x57'));return _0x30db08;})['then'](function(_0x3cacb0){var _0x1c1d86=_0x3cacb0[_0x3bf1('0x49')];logger['info'](_0x3bf1('0x58'),_0x1c1d86);if(!_[_0x3bf1('0x59')](_0x3cacb0[_0x3bf1('0x49')])&&fs[_0x3bf1('0x4b')](_0x1c1d86)){logger[_0x3bf1('0x5a')](_0x3bf1('0x5b')+_0x1c1d86+_0x3bf1('0x5c'));fs['unlinkSync'](_0x1c1d86);}_0x1c1d86=_0x1c1d86+'.cypher';if(!_['isNil'](_0x3cacb0['savePath'])&&fs[_0x3bf1('0x4b')](_0x1c1d86)){logger['info'](_0x3bf1('0x5b')+_0x1c1d86+_0x3bf1('0x5c'));fs[_0x3bf1('0x5d')](_0x1c1d86);}return _0x3cacb0;})[_0x3bf1('0x23')](function(_0x466cdd){if(!_0x466cdd)throw new InternalError();return _0x466cdd[_0x3bf1('0x56')]();})[_0x3bf1('0x23')](function(){_0x27c841[_0x3bf1('0x1a')](0xcc)[_0x3bf1('0x1b')]();})[_0x3bf1('0x3f')](handleError(_0x27c841,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d5f9592..77856d2 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 _0xd9eb=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x246194,_0x27cdd9){var _0x4fed0e=function(_0x5a92bc){while(--_0x5a92bc){_0x246194['push'](_0x246194['shift']());}};_0x4fed0e(++_0x27cdd9);}(_0xd9eb,0xca));var _0xbd9e=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0xd9eb[_0x317bf0];return _0x225932;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var logger=require(_0xbd9e('0x2'))(_0xbd9e('0x3'));var moment=require(_0xbd9e('0x4'));var BPromise=require(_0xbd9e('0x5'));var rp=require(_0xbd9e('0x6'));var fs=require('fs');var path=require(_0xbd9e('0x7'));var rimraf=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var attributes=require(_0xbd9e('0xa'));module[_0xbd9e('0xb')]=function(_0x20c36a,_0x4ade3f){return _0x20c36a[_0xbd9e('0xc')](_0xbd9e('0xd'),attributes,{'tableName':_0xbd9e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c2c=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording'];(function(_0x3d2b19,_0x349a5b){var _0x29769b=function(_0x5048ad){while(--_0x5048ad){_0x3d2b19['push'](_0x3d2b19['shift']());}};_0x29769b(++_0x349a5b);}(_0x3c2c,0x160));var _0xc3c2=function(_0x54591e,_0x375db5){_0x54591e=_0x54591e-0x0;var _0xb8d1f0=_0x3c2c[_0x54591e];return _0xb8d1f0;};'use strict';var _=require(_0xc3c2('0x0'));var util=require(_0xc3c2('0x1'));var logger=require(_0xc3c2('0x2'))(_0xc3c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc3c2('0x4'));var fs=require('fs');var path=require(_0xc3c2('0x5'));var rimraf=require(_0xc3c2('0x6'));var config=require(_0xc3c2('0x7'));var attributes=require('./squareRecording.attributes');module[_0xc3c2('0x8')]=function(_0x158a5f,_0x234da9){return _0x158a5f[_0xc3c2('0x9')](_0xc3c2('0xa'),attributes,{'tableName':'square_recordings','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 37b9aee..4f128bd 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 _0xba5a=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareRecording','create','body','options','raw','stringify','catch','util'];(function(_0x1266bc,_0x4aa145){var _0x5e8426=function(_0x5c1c1d){while(--_0x5c1c1d){_0x1266bc['push'](_0x1266bc['shift']());}};_0x5e8426(++_0x4aa145);}(_0xba5a,0x67));var _0xaba5=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0xba5a[_0x569fef];return _0x11f20b;};'use strict';var _=require('lodash');var util=require(_0xaba5('0x0'));var moment=require(_0xaba5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaba5('0x2'))['db'];var utils=require(_0xaba5('0x3'));var logger=require(_0xaba5('0x4'))(_0xaba5('0x5'));var config=require(_0xaba5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaba5('0x7')][_0xaba5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13cd28,_0x2c342f,_0x4cb8f7){return new BPromise(function(_0x5f0691,_0x3fcf49){return client['request'](_0x13cd28,_0x4cb8f7)[_0xaba5('0x9')](function(_0x2ffee6){logger[_0xaba5('0xa')](_0xaba5('0xb'),_0x2c342f,_0xaba5('0xc'));logger[_0xaba5('0xd')](_0xaba5('0xe'),_0x2c342f,_0xaba5('0xc'),JSON['stringify'](_0x2ffee6));if(_0x2ffee6[_0xaba5('0xf')]){if(_0x2ffee6[_0xaba5('0xf')][_0xaba5('0x10')]===0x1f4){logger[_0xaba5('0xf')](_0xaba5('0xb'),_0x2c342f,_0x2ffee6['error'][_0xaba5('0x11')]);return _0x3fcf49(_0x2ffee6[_0xaba5('0xf')]['message']);}logger[_0xaba5('0xf')](_0xaba5('0xb'),_0x2c342f,_0x2ffee6['error'][_0xaba5('0x11')]);return _0x5f0691(_0x2ffee6[_0xaba5('0xf')][_0xaba5('0x11')]);}else{logger[_0xaba5('0xa')]('SquareRecording,\x20%s,\x20%s',_0x2c342f,_0xaba5('0xc'));_0x5f0691(_0x2ffee6[_0xaba5('0x12')][_0xaba5('0x11')]);}})['catch'](function(_0x178568){logger['error'](_0xaba5('0xb'),_0x2c342f,_0x178568);_0x3fcf49(_0x178568);});});}exports[_0xaba5('0x13')]=function(_0x3f9312){var _0x3cf30f=this;return new Promise(function(_0x19c3ba,_0x1b45c9){return db['SquareRecording'][_0xaba5('0x14')](_0x3f9312[_0xaba5('0x15')],{'raw':_0x3f9312[_0xaba5('0x16')]?_0x3f9312[_0xaba5('0x16')][_0xaba5('0x17')]===undefined?!![]:![]:!![]})[_0xaba5('0x9')](function(_0x1b5e7d){logger[_0xaba5('0xa')]('CreateSquareRecording',_0x3f9312);logger['debug'](_0xaba5('0x13'),_0x3f9312,JSON[_0xaba5('0x18')](_0x1b5e7d));_0x19c3ba(_0x1b5e7d);})[_0xaba5('0x19')](function(_0x32f241){logger[_0xaba5('0xf')](_0xaba5('0x13'),_0x32f241[_0xaba5('0x11')],_0x3f9312);_0x1b45c9(_0x3cf30f[_0xaba5('0xf')](0x1f4,_0x32f241['message']));});});}; \ No newline at end of file +var _0x01d4=['stringify','error','message','result','CreateSquareRecording','SquareRecording','options','raw','debug','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x01d4,0x142));var _0x401d=function(_0x20cd96,_0x3812e7){_0x20cd96=_0x20cd96-0x0;var _0x12c893=_0x01d4[_0x20cd96];return _0x12c893;};'use strict';var _=require('lodash');var util=require(_0x401d('0x0'));var moment=require(_0x401d('0x1'));var BPromise=require('bluebird');var rs=require(_0x401d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x401d('0x3'))['db'];var utils=require(_0x401d('0x4'));var logger=require(_0x401d('0x5'))(_0x401d('0x6'));var config=require(_0x401d('0x7'));var jayson=require(_0x401d('0x8'));var client=jayson[_0x401d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5153fa,_0x43d249,_0x6a095a){return new BPromise(function(_0x4d0737,_0xe3d04c){return client[_0x401d('0xa')](_0x5153fa,_0x6a095a)[_0x401d('0xb')](function(_0x57320b){logger[_0x401d('0xc')](_0x401d('0xd'),_0x43d249,'request\x20sent');logger['debug'](_0x401d('0xe'),_0x43d249,_0x401d('0xf'),JSON[_0x401d('0x10')](_0x57320b));if(_0x57320b['error']){if(_0x57320b[_0x401d('0x11')]['code']===0x1f4){logger['error'](_0x401d('0xd'),_0x43d249,_0x57320b['error'][_0x401d('0x12')]);return _0xe3d04c(_0x57320b['error'][_0x401d('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x43d249,_0x57320b[_0x401d('0x11')][_0x401d('0x12')]);return _0x4d0737(_0x57320b[_0x401d('0x11')][_0x401d('0x12')]);}else{logger[_0x401d('0xc')](_0x401d('0xd'),_0x43d249,_0x401d('0xf'));_0x4d0737(_0x57320b[_0x401d('0x13')]['message']);}})['catch'](function(_0x571a1c){logger['error'](_0x401d('0xd'),_0x43d249,_0x571a1c);_0xe3d04c(_0x571a1c);});});}exports[_0x401d('0x14')]=function(_0x3c30fb){var _0x4a25b7=this;return new Promise(function(_0x5f1e5d,_0xb3eceb){return db[_0x401d('0x15')]['create'](_0x3c30fb['body'],{'raw':_0x3c30fb['options']?_0x3c30fb[_0x401d('0x16')][_0x401d('0x17')]===undefined?!![]:![]:!![]})[_0x401d('0xb')](function(_0x2a8ece){logger[_0x401d('0xc')](_0x401d('0x14'),_0x3c30fb);logger[_0x401d('0x18')](_0x401d('0x14'),_0x3c30fb,JSON[_0x401d('0x10')](_0x2a8ece));_0x5f1e5d(_0x2a8ece);})[_0x401d('0x19')](function(_0x36d921){logger[_0x401d('0x11')](_0x401d('0x14'),_0x36d921[_0x401d('0x12')],_0x3c30fb);_0xb3eceb(_0x4a25b7[_0x401d('0x11')](0x1f4,_0x36d921[_0x401d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ee970ef..49ab0f7 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 _0x3d9f=['post','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x403132,_0x302532){var _0x4a88ff=function(_0x29c1aa){while(--_0x29c1aa){_0x403132['push'](_0x403132['shift']());}};_0x4a88ff(++_0x302532);}(_0x3d9f,0x16e));var _0xf3d9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3d9f[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0xf3d9('0x0'));var path=require('path');var timeout=require(_0xf3d9('0x1'));var express=require(_0xf3d9('0x2'));var router=express['Router']();var auth=require(_0xf3d9('0x3'));var interaction=require(_0xf3d9('0x4'));var config=require('../../config/environment');var controller=require(_0xf3d9('0x5'));router['get']('/',auth[_0xf3d9('0x6')](),controller[_0xf3d9('0x7')]);router[_0xf3d9('0x8')](_0xf3d9('0x9'),auth['isAuthenticated'](),controller[_0xf3d9('0xa')]);router[_0xf3d9('0x8')](_0xf3d9('0xb'),auth[_0xf3d9('0x6')](),controller['show']);router[_0xf3d9('0xc')]('/',auth[_0xf3d9('0x6')](),controller['create']);router[_0xf3d9('0xd')](_0xf3d9('0xb'),auth[_0xf3d9('0x6')](),controller[_0xf3d9('0xe')]);router[_0xf3d9('0xf')]('/:id',auth[_0xf3d9('0x6')](),controller[_0xf3d9('0x10')]);module[_0xf3d9('0x11')]=router; \ No newline at end of file +var _0x1f54=['../../config/environment','./squareReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5b998d,_0x1b78ff){var _0x5311b7=function(_0x594d59){while(--_0x594d59){_0x5b998d['push'](_0x5b998d['shift']());}};_0x5311b7(++_0x1b78ff);}(_0x1f54,0x14e));var _0x41f5=function(_0x1e35bd,_0x40ee90){_0x1e35bd=_0x1e35bd-0x0;var _0x2c379d=_0x1f54[_0x1e35bd];return _0x2c379d;};'use strict';var multer=require(_0x41f5('0x0'));var util=require(_0x41f5('0x1'));var path=require(_0x41f5('0x2'));var timeout=require(_0x41f5('0x3'));var express=require('express');var router=express[_0x41f5('0x4')]();var auth=require(_0x41f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x41f5('0x6'));var controller=require(_0x41f5('0x7'));router[_0x41f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x41f5('0x9')]);router[_0x41f5('0x8')](_0x41f5('0xa'),auth['isAuthenticated'](),controller[_0x41f5('0xb')]);router[_0x41f5('0x8')](_0x41f5('0xc'),auth[_0x41f5('0xd')](),controller['show']);router[_0x41f5('0xe')]('/',auth['isAuthenticated'](),controller[_0x41f5('0xf')]);router[_0x41f5('0x10')](_0x41f5('0xc'),auth[_0x41f5('0xd')](),controller[_0x41f5('0x11')]);router['delete'](_0x41f5('0xc'),auth[_0x41f5('0xd')](),controller[_0x41f5('0x12')]);module[_0x41f5('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 f9128c1..303cbd0 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 _0x0e40=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0x0e40,0x1c2));var _0x00e4=function(_0x401557,_0x4a160d){_0x401557=_0x401557-0x0;var _0x20cc44=_0x0e40[_0x401557];return _0x20cc44;};'use strict';var Sequelize=require(_0x00e4('0x0'));module[_0x00e4('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x00e4('0x2')]},'channel':{'type':Sequelize[_0x00e4('0x2')]},'language':{'type':Sequelize[_0x00e4('0x2')]},'type':{'type':Sequelize[_0x00e4('0x2')]},'uniqueid':{'type':Sequelize[_0x00e4('0x2')]},'version':{'type':Sequelize[_0x00e4('0x2')]},'callerid':{'type':Sequelize[_0x00e4('0x2')]},'calleridname':{'type':Sequelize[_0x00e4('0x2')]},'callingpres':{'type':Sequelize[_0x00e4('0x2')]},'callingani2':{'type':Sequelize[_0x00e4('0x2')]},'callington':{'type':Sequelize[_0x00e4('0x2')]},'callingtns':{'type':Sequelize[_0x00e4('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x00e4('0x2')]},'extension':{'type':Sequelize[_0x00e4('0x2')]},'priority':{'type':Sequelize[_0x00e4('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x00e4('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x00e4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x00e4('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e21=['exports','STRING','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e21,0x98));var _0x16e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6e21[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x16e2('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x16e2('0x1')]},'channel':{'type':Sequelize[_0x16e2('0x1')]},'language':{'type':Sequelize[_0x16e2('0x1')]},'type':{'type':Sequelize[_0x16e2('0x1')]},'uniqueid':{'type':Sequelize[_0x16e2('0x1')]},'version':{'type':Sequelize[_0x16e2('0x1')]},'callerid':{'type':Sequelize[_0x16e2('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x16e2('0x1')]},'callington':{'type':Sequelize[_0x16e2('0x1')]},'callingtns':{'type':Sequelize[_0x16e2('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x16e2('0x1')]},'context':{'type':Sequelize[_0x16e2('0x1')]},'extension':{'type':Sequelize[_0x16e2('0x1')]},'priority':{'type':Sequelize[_0x16e2('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x16e2('0x1')]},'threadid':{'type':Sequelize[_0x16e2('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x16e2('0x2')]},'bot':{'type':Sequelize[_0x16e2('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2c453dc..c91ade2 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 _0x6d5e=['reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','fields','find','create','params','describe','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','sendStatus','end','status','json','offset','Content-Range'];(function(_0x355f27,_0x14f185){var _0x4e183c=function(_0x29e334){while(--_0x29e334){_0x355f27['push'](_0x355f27['shift']());}};_0x4e183c(++_0x14f185);}(_0x6d5e,0x103));var _0xe6d5=function(_0x10a7f3,_0x4dc2c7){_0x10a7f3=_0x10a7f3-0x0;var _0x3e1bf7=_0x6d5e[_0x10a7f3];return _0x3e1bf7;};'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'];function respondWithStatusCode(_0x35455a,_0x3b1948){_0x3b1948=_0x3b1948||0xcc;return function(_0x24c8f9){if(_0x24c8f9){return _0x35455a[_0xe6d5('0x17')](_0x3b1948);}return _0x35455a['status'](_0x3b1948)[_0xe6d5('0x18')]();};}function respondWithResult(_0x188ca1,_0x317352){_0x317352=_0x317352||0xc8;return function(_0x32dbdb){if(_0x32dbdb){return _0x188ca1[_0xe6d5('0x19')](_0x317352)[_0xe6d5('0x1a')](_0x32dbdb);}};}function respondWithFilteredResult(_0x35599f,_0x37ff40){return function(_0x3c7b7a){if(_0x3c7b7a){var _0x49adf8=_0x3c7b7a['count'],_0x2a8aa7=_0x37ff40[_0xe6d5('0x1b')],_0x2adb34=_0x37ff40[_0xe6d5('0x1b')]+_0x37ff40['limit'],_0x268ced;if(_0x2adb34>=_0x49adf8){_0x2adb34=_0x49adf8;_0x268ced=0xc8;}else{_0x268ced=0xce;}_0x35599f[_0xe6d5('0x19')](_0x268ced);return _0x35599f['set'](_0xe6d5('0x1c'),_0x2a8aa7+'-'+_0x2adb34+'/'+_0x49adf8)['json'](_0x3c7b7a);}return null;};}function patchUpdates(_0x4d2fd2){return function(_0x3d9ccb){try{jsonpatch['apply'](_0x3d9ccb,_0x4d2fd2,!![]);}catch(_0x35c3ee){return BPromise[_0xe6d5('0x1d')](_0x35c3ee);}return _0x3d9ccb[_0xe6d5('0x1e')]();};}function saveUpdates(_0x542db8,_0x480e7a){return function(_0xe35cc4){if(_0xe35cc4){return _0xe35cc4[_0xe6d5('0x1f')](_0x542db8)[_0xe6d5('0x20')](function(_0x10ea01){return _0x10ea01;});}return null;};}function removeEntity(_0x27d667,_0x569fc6){return function(_0x19e2b4){if(_0x19e2b4){return _0x19e2b4[_0xe6d5('0x21')]()['then'](function(){_0x27d667[_0xe6d5('0x19')](0xcc)[_0xe6d5('0x18')]();});}};}function handleEntityNotFound(_0x150aaf,_0x49bd97){return function(_0x1fdacf){if(!_0x1fdacf){_0x150aaf[_0xe6d5('0x17')](0x194);}return _0x1fdacf;};}function handleError(_0x11af80,_0x32bd59){_0x32bd59=_0x32bd59||0x1f4;return function(_0x1be7b0){logger[_0xe6d5('0x22')](_0x1be7b0[_0xe6d5('0x23')]);if(_0x1be7b0[_0xe6d5('0x24')]){delete _0x1be7b0['name'];}_0x11af80[_0xe6d5('0x19')](_0x32bd59)[_0xe6d5('0x25')](_0x1be7b0);};}exports[_0xe6d5('0x26')]=function(_0x2e4bde,_0x543934){var _0x3c90dc={},_0x4a4b27={},_0x21ba91={'count':0x0,'rows':[]};var _0x20e1b4=_['map'](db[_0xe6d5('0x27')]['rawAttributes'],function(_0x4377bc){return{'name':_0x4377bc[_0xe6d5('0x28')],'type':_0x4377bc[_0xe6d5('0x29')][_0xe6d5('0x2a')]};});_0x4a4b27[_0xe6d5('0x2b')]=_[_0xe6d5('0x2c')](_0x20e1b4,_0xe6d5('0x24'));_0x4a4b27['query']=_[_0xe6d5('0x2d')](_0x2e4bde[_0xe6d5('0x2e')]);_0x4a4b27[_0xe6d5('0x2f')]=_[_0xe6d5('0x30')](_0x4a4b27['model'],_0x4a4b27[_0xe6d5('0x2e')]);_0x3c90dc[_0xe6d5('0x31')]=_['intersection'](_0x4a4b27[_0xe6d5('0x2b')],qs['fields'](_0x2e4bde[_0xe6d5('0x2e')]['fields']));_0x3c90dc[_0xe6d5('0x31')]=_0x3c90dc['attributes'][_0xe6d5('0x32')]?_0x3c90dc[_0xe6d5('0x31')]:_0x4a4b27[_0xe6d5('0x2b')];if(!_0x2e4bde[_0xe6d5('0x2e')]['hasOwnProperty'](_0xe6d5('0x33'))){_0x3c90dc[_0xe6d5('0x34')]=qs['limit'](_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x34')]);_0x3c90dc['offset']=qs[_0xe6d5('0x1b')](_0x2e4bde[_0xe6d5('0x2e')]['offset']);}_0x3c90dc[_0xe6d5('0x35')]=qs[_0xe6d5('0x36')](_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x36')]);_0x3c90dc[_0xe6d5('0x37')]=qs[_0xe6d5('0x2f')](_[_0xe6d5('0x38')](_0x2e4bde[_0xe6d5('0x2e')],_0x4a4b27['filters']),_0x20e1b4);if(_0x2e4bde['query'][_0xe6d5('0x39')]){_0x3c90dc[_0xe6d5('0x37')]=_[_0xe6d5('0x3a')](_0x3c90dc[_0xe6d5('0x37')],{'$or':_[_0xe6d5('0x2c')](_0x20e1b4,function(_0x4f604d){if(_0x4f604d[_0xe6d5('0x29')]!==_0xe6d5('0x3b')){var _0x7cc756={};_0x7cc756[_0x4f604d[_0xe6d5('0x24')]]={'$like':'%'+_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x39')]+'%'};return _0x7cc756;}})});}_0x3c90dc=_[_0xe6d5('0x3a')]({},_0x3c90dc,_0x2e4bde[_0xe6d5('0x3c')]);var _0x46fd58={'where':_0x3c90dc[_0xe6d5('0x37')]};return db[_0xe6d5('0x27')][_0xe6d5('0x3d')](_0x46fd58)[_0xe6d5('0x20')](function(_0xc90dfc){_0x21ba91[_0xe6d5('0x3d')]=_0xc90dfc;if(_0x2e4bde[_0xe6d5('0x2e')][_0xe6d5('0x3e')]){_0x3c90dc[_0xe6d5('0x3f')]=[{'all':!![]}];}return db[_0xe6d5('0x27')]['findAll'](_0x3c90dc);})[_0xe6d5('0x20')](function(_0xac9be2){_0x21ba91[_0xe6d5('0x40')]=_0xac9be2;return _0x21ba91;})[_0xe6d5('0x20')](respondWithFilteredResult(_0x543934,_0x3c90dc))[_0xe6d5('0x41')](handleError(_0x543934,null));};exports[_0xe6d5('0x42')]=function(_0x242c2e,_0x31ff1a){var _0x1e543e={'raw':!![],'where':{'id':_0x242c2e['params']['id']}},_0x4370fb={};_0x4370fb['model']=_[_0xe6d5('0x2d')](db['SquareReport']['rawAttributes']);_0x4370fb[_0xe6d5('0x2e')]=_[_0xe6d5('0x2d')](_0x242c2e[_0xe6d5('0x2e')]);_0x4370fb[_0xe6d5('0x2f')]=_[_0xe6d5('0x30')](_0x4370fb[_0xe6d5('0x2b')],_0x4370fb['query']);_0x1e543e[_0xe6d5('0x31')]=_['intersection'](_0x4370fb[_0xe6d5('0x2b')],qs[_0xe6d5('0x43')](_0x242c2e['query'][_0xe6d5('0x43')]));_0x1e543e['attributes']=_0x1e543e['attributes'][_0xe6d5('0x32')]?_0x1e543e['attributes']:_0x4370fb[_0xe6d5('0x2b')];if(_0x242c2e[_0xe6d5('0x2e')][_0xe6d5('0x3e')]){_0x1e543e['include']=[{'all':!![]}];}_0x1e543e=_[_0xe6d5('0x3a')]({},_0x1e543e,_0x242c2e[_0xe6d5('0x3c')]);return db[_0xe6d5('0x27')][_0xe6d5('0x44')](_0x1e543e)[_0xe6d5('0x20')](handleEntityNotFound(_0x31ff1a,null))['then'](respondWithResult(_0x31ff1a,null))[_0xe6d5('0x41')](handleError(_0x31ff1a,null));};exports[_0xe6d5('0x45')]=function(_0xf82a13,_0x5effad){return db[_0xe6d5('0x27')][_0xe6d5('0x45')](_0xf82a13['body'],{})[_0xe6d5('0x20')](respondWithResult(_0x5effad,0xc9))[_0xe6d5('0x41')](handleError(_0x5effad,null));};exports[_0xe6d5('0x1f')]=function(_0x3a805b,_0x5a9fd7){if(_0x3a805b['body']['id']){delete _0x3a805b['body']['id'];}return db[_0xe6d5('0x27')][_0xe6d5('0x44')]({'where':{'id':_0x3a805b[_0xe6d5('0x46')]['id']}})[_0xe6d5('0x20')](handleEntityNotFound(_0x5a9fd7,null))[_0xe6d5('0x20')](saveUpdates(_0x3a805b['body'],null))[_0xe6d5('0x20')](respondWithResult(_0x5a9fd7,null))[_0xe6d5('0x41')](handleError(_0x5a9fd7,null));};exports[_0xe6d5('0x21')]=function(_0x5a8bcb,_0x1d5281){return db[_0xe6d5('0x27')][_0xe6d5('0x44')]({'where':{'id':_0x5a8bcb[_0xe6d5('0x46')]['id']}})[_0xe6d5('0x20')](handleEntityNotFound(_0x1d5281,null))['then'](removeEntity(_0x1d5281,null))[_0xe6d5('0x41')](handleError(_0x1d5281,null));};exports[_0xe6d5('0x47')]=function(_0x49f3d9,_0xfd9c2c){return db[_0xe6d5('0x27')][_0xe6d5('0x47')]()[_0xe6d5('0x20')](respondWithResult(_0xfd9c2c,null))[_0xe6d5('0x41')](handleError(_0xfd9c2c,null));}; \ No newline at end of file +var _0xaf0d=['limit','Content-Range','apply','reject','update','then','end','error','stack','name','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','rawAttributes','options','find','create','body','params','describe','eml-format','rimraf','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x2139c8,_0x2e22f1){var _0x4e9f84=function(_0x2ee187){while(--_0x2ee187){_0x2139c8['push'](_0x2139c8['shift']());}};_0x4e9f84(++_0x2e22f1);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x2820e3,_0xe8629e){_0x2820e3=_0x2820e3-0x0;var _0x436eb6=_0xaf0d[_0x2820e3];return _0x436eb6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdaf0('0x0'));var rimraf=require(_0xdaf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdaf0('0x2'));var util=require(_0xdaf0('0x3'));var path=require(_0xdaf0('0x4'));var sox=require('sox');var csv=require(_0xdaf0('0x5'));var ejs=require(_0xdaf0('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdaf0('0x7'));var jsforce=require(_0xdaf0('0x8'));var deskjs=require(_0xdaf0('0x9'));var toCsv=require(_0xdaf0('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdaf0('0xa'));var as=require(_0xdaf0('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaf0('0xc'))(_0xdaf0('0xd'));var utils=require(_0xdaf0('0xe'));var config=require(_0xdaf0('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaf0('0x10'))['db'];function respondWithStatusCode(_0x149261,_0x1e7a70){_0x1e7a70=_0x1e7a70||0xcc;return function(_0x4fbd9c){if(_0x4fbd9c){return _0x149261[_0xdaf0('0x11')](_0x1e7a70);}return _0x149261[_0xdaf0('0x12')](_0x1e7a70)['end']();};}function respondWithResult(_0x557f8b,_0x48ea31){_0x48ea31=_0x48ea31||0xc8;return function(_0x4f0b4a){if(_0x4f0b4a){return _0x557f8b['status'](_0x48ea31)[_0xdaf0('0x13')](_0x4f0b4a);}};}function respondWithFilteredResult(_0x4ab77b,_0x4296fc){return function(_0x56bc8e){if(_0x56bc8e){var _0x499482=_0x56bc8e['count'],_0x3b5edf=_0x4296fc[_0xdaf0('0x14')],_0xeefdcd=_0x4296fc[_0xdaf0('0x14')]+_0x4296fc[_0xdaf0('0x15')],_0x370345;if(_0xeefdcd>=_0x499482){_0xeefdcd=_0x499482;_0x370345=0xc8;}else{_0x370345=0xce;}_0x4ab77b['status'](_0x370345);return _0x4ab77b['set'](_0xdaf0('0x16'),_0x3b5edf+'-'+_0xeefdcd+'/'+_0x499482)[_0xdaf0('0x13')](_0x56bc8e);}return null;};}function patchUpdates(_0x26bf71){return function(_0x15d2a9){try{jsonpatch[_0xdaf0('0x17')](_0x15d2a9,_0x26bf71,!![]);}catch(_0x77c850){return BPromise[_0xdaf0('0x18')](_0x77c850);}return _0x15d2a9['save']();};}function saveUpdates(_0x353229,_0x350f65){return function(_0x164632){if(_0x164632){return _0x164632[_0xdaf0('0x19')](_0x353229)['then'](function(_0x176ca4){return _0x176ca4;});}return null;};}function removeEntity(_0x320d6e,_0x100817){return function(_0xdc104f){if(_0xdc104f){return _0xdc104f['destroy']()[_0xdaf0('0x1a')](function(){_0x320d6e[_0xdaf0('0x12')](0xcc)[_0xdaf0('0x1b')]();});}};}function handleEntityNotFound(_0x13abfc,_0xb921d5){return function(_0x444800){if(!_0x444800){_0x13abfc[_0xdaf0('0x11')](0x194);}return _0x444800;};}function handleError(_0x5a3584,_0x13ee7f){_0x13ee7f=_0x13ee7f||0x1f4;return function(_0x33e5c2){logger[_0xdaf0('0x1c')](_0x33e5c2[_0xdaf0('0x1d')]);if(_0x33e5c2[_0xdaf0('0x1e')]){delete _0x33e5c2[_0xdaf0('0x1e')];}_0x5a3584[_0xdaf0('0x12')](_0x13ee7f)['send'](_0x33e5c2);};}exports[_0xdaf0('0x1f')]=function(_0x4cd0bf,_0x413d27){var _0x740ff={},_0x4e6974={},_0x39a5b2={'count':0x0,'rows':[]};var _0x5762cc=_[_0xdaf0('0x20')](db[_0xdaf0('0x21')]['rawAttributes'],function(_0xaf86cb){return{'name':_0xaf86cb[_0xdaf0('0x22')],'type':_0xaf86cb[_0xdaf0('0x23')][_0xdaf0('0x24')]};});_0x4e6974[_0xdaf0('0x25')]=_['map'](_0x5762cc,_0xdaf0('0x1e'));_0x4e6974[_0xdaf0('0x26')]=_[_0xdaf0('0x27')](_0x4cd0bf['query']);_0x4e6974[_0xdaf0('0x28')]=_[_0xdaf0('0x29')](_0x4e6974['model'],_0x4e6974[_0xdaf0('0x26')]);_0x740ff[_0xdaf0('0x2a')]=_['intersection'](_0x4e6974[_0xdaf0('0x25')],qs[_0xdaf0('0x2b')](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x2b')]));_0x740ff[_0xdaf0('0x2a')]=_0x740ff[_0xdaf0('0x2a')][_0xdaf0('0x2c')]?_0x740ff[_0xdaf0('0x2a')]:_0x4e6974[_0xdaf0('0x25')];if(!_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x2d')]('nolimit')){_0x740ff['limit']=qs['limit'](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x15')]);_0x740ff['offset']=qs[_0xdaf0('0x14')](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x14')]);}_0x740ff[_0xdaf0('0x2e')]=qs[_0xdaf0('0x2f')](_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x2f')]);_0x740ff[_0xdaf0('0x30')]=qs[_0xdaf0('0x28')](_[_0xdaf0('0x31')](_0x4cd0bf[_0xdaf0('0x26')],_0x4e6974[_0xdaf0('0x28')]),_0x5762cc);if(_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x32')]){_0x740ff[_0xdaf0('0x30')]=_[_0xdaf0('0x33')](_0x740ff[_0xdaf0('0x30')],{'$or':_['map'](_0x5762cc,function(_0xe61d26){if(_0xe61d26[_0xdaf0('0x23')]!==_0xdaf0('0x34')){var _0x2b8272={};_0x2b8272[_0xe61d26[_0xdaf0('0x1e')]]={'$like':'%'+_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x32')]+'%'};return _0x2b8272;}})});}_0x740ff=_[_0xdaf0('0x33')]({},_0x740ff,_0x4cd0bf['options']);var _0x514d1c={'where':_0x740ff[_0xdaf0('0x30')]};return db[_0xdaf0('0x21')][_0xdaf0('0x35')](_0x514d1c)['then'](function(_0x4699c1){_0x39a5b2['count']=_0x4699c1;if(_0x4cd0bf[_0xdaf0('0x26')][_0xdaf0('0x36')]){_0x740ff[_0xdaf0('0x37')]=[{'all':!![]}];}return db[_0xdaf0('0x21')][_0xdaf0('0x38')](_0x740ff);})[_0xdaf0('0x1a')](function(_0x357e4b){_0x39a5b2['rows']=_0x357e4b;return _0x39a5b2;})[_0xdaf0('0x1a')](respondWithFilteredResult(_0x413d27,_0x740ff))[_0xdaf0('0x39')](handleError(_0x413d27,null));};exports['show']=function(_0x2a9209,_0x5b5f3b){var _0x480b2b={'raw':!![],'where':{'id':_0x2a9209['params']['id']}},_0x60218a={};_0x60218a[_0xdaf0('0x25')]=_['keys'](db[_0xdaf0('0x21')][_0xdaf0('0x3a')]);_0x60218a[_0xdaf0('0x26')]=_['keys'](_0x2a9209[_0xdaf0('0x26')]);_0x60218a[_0xdaf0('0x28')]=_[_0xdaf0('0x29')](_0x60218a['model'],_0x60218a[_0xdaf0('0x26')]);_0x480b2b[_0xdaf0('0x2a')]=_[_0xdaf0('0x29')](_0x60218a[_0xdaf0('0x25')],qs[_0xdaf0('0x2b')](_0x2a9209[_0xdaf0('0x26')][_0xdaf0('0x2b')]));_0x480b2b[_0xdaf0('0x2a')]=_0x480b2b['attributes'][_0xdaf0('0x2c')]?_0x480b2b[_0xdaf0('0x2a')]:_0x60218a['model'];if(_0x2a9209[_0xdaf0('0x26')][_0xdaf0('0x36')]){_0x480b2b[_0xdaf0('0x37')]=[{'all':!![]}];}_0x480b2b=_[_0xdaf0('0x33')]({},_0x480b2b,_0x2a9209[_0xdaf0('0x3b')]);return db[_0xdaf0('0x21')][_0xdaf0('0x3c')](_0x480b2b)['then'](handleEntityNotFound(_0x5b5f3b,null))[_0xdaf0('0x1a')](respondWithResult(_0x5b5f3b,null))[_0xdaf0('0x39')](handleError(_0x5b5f3b,null));};exports['create']=function(_0x48c69b,_0x59c70a){return db[_0xdaf0('0x21')][_0xdaf0('0x3d')](_0x48c69b[_0xdaf0('0x3e')],{})[_0xdaf0('0x1a')](respondWithResult(_0x59c70a,0xc9))[_0xdaf0('0x39')](handleError(_0x59c70a,null));};exports[_0xdaf0('0x19')]=function(_0x859066,_0x425e2f){if(_0x859066[_0xdaf0('0x3e')]['id']){delete _0x859066[_0xdaf0('0x3e')]['id'];}return db[_0xdaf0('0x21')]['find']({'where':{'id':_0x859066[_0xdaf0('0x3f')]['id']}})[_0xdaf0('0x1a')](handleEntityNotFound(_0x425e2f,null))[_0xdaf0('0x1a')](saveUpdates(_0x859066['body'],null))[_0xdaf0('0x1a')](respondWithResult(_0x425e2f,null))[_0xdaf0('0x39')](handleError(_0x425e2f,null));};exports['destroy']=function(_0x432cf7,_0x28e19f){return db['SquareReport'][_0xdaf0('0x3c')]({'where':{'id':_0x432cf7[_0xdaf0('0x3f')]['id']}})[_0xdaf0('0x1a')](handleEntityNotFound(_0x28e19f,null))[_0xdaf0('0x1a')](removeEntity(_0x28e19f,null))[_0xdaf0('0x39')](handleError(_0x28e19f,null));};exports['describe']=function(_0x2364e8,_0x34ae87){return db[_0xdaf0('0x21')][_0xdaf0('0x40')]()[_0xdaf0('0x1a')](respondWithResult(_0x34ae87,null))[_0xdaf0('0x39')](handleError(_0x34ae87,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1d5f3ac..953b0ee 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 _0x839b=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','leaveAt','util'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x839b,0x192));var _0xb839=function(_0x1b7181,_0x17403d){_0x1b7181=_0x1b7181-0x0;var _0x5b165d=_0x839b[_0x1b7181];return _0x5b165d;};'use strict';var _=require('lodash');var util=require(_0xb839('0x0'));var logger=require(_0xb839('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb839('0x2'));var rp=require(_0xb839('0x3'));var fs=require('fs');var path=require(_0xb839('0x4'));var rimraf=require(_0xb839('0x5'));var config=require(_0xb839('0x6'));var attributes=require(_0xb839('0x7'));module[_0xb839('0x8')]=function(_0x463ef1,_0x162f9d){return _0x463ef1[_0xb839('0x9')](_0xb839('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xb839('0xb'),'fields':['uniqueid','project_name']},{'name':_0xb839('0xc'),'fields':[_0xb839('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x741d=['leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','report_square','uid_pname','uniqueid','project_name'];(function(_0x9972d9,_0x2afda8){var _0x1ee4cb=function(_0x5ceded){while(--_0x5ceded){_0x9972d9['push'](_0x9972d9['shift']());}};_0x1ee4cb(++_0x2afda8);}(_0x741d,0x71));var _0xd741=function(_0x507d71,_0x260c61){_0x507d71=_0x507d71-0x0;var _0xa8f225=_0x741d[_0x507d71];return _0xa8f225;};'use strict';var _=require(_0xd741('0x0'));var util=require(_0xd741('0x1'));var logger=require(_0xd741('0x2'))(_0xd741('0x3'));var moment=require('moment');var BPromise=require(_0xd741('0x4'));var rp=require(_0xd741('0x5'));var fs=require('fs');var path=require(_0xd741('0x6'));var rimraf=require(_0xd741('0x7'));var config=require('../../config/environment');var attributes=require(_0xd741('0x8'));module['exports']=function(_0x53298f,_0x3fda09){return _0x53298f['define']('SquareReport',attributes,{'tableName':_0xd741('0x9'),'paranoid':![],'indexes':[{'name':_0xd741('0xa'),'fields':[_0xd741('0xb'),_0xd741('0xc')]},{'name':'leaveAt','fields':[_0xd741('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 795db42..51bcab7 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 _0x9c5a=['stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x72a767,_0x59bdb1){_0x72a767=_0x72a767-0x0;var _0x19b82b=_0x9c5a[_0x72a767];return _0x19b82b;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('SquareReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});}exports[_0xa9c5('0x14')]=function(_0x1142d9){var _0x2b9ac5=this;return new Promise(function(_0x3b8cf7,_0x452a9b){return db[_0xa9c5('0x15')][_0xa9c5('0x16')](_0x1142d9[_0xa9c5('0x17')],{'raw':_0x1142d9[_0xa9c5('0x18')]?_0x1142d9[_0xa9c5('0x18')][_0xa9c5('0x19')]===undefined?!![]:![]:!![]})[_0xa9c5('0xa')](function(_0x54f8b9){logger[_0xa9c5('0x11')](_0xa9c5('0x14'),_0x1142d9);logger['debug']('CreateSquareReport',_0x1142d9,JSON[_0xa9c5('0xd')](_0x54f8b9));_0x3b8cf7(_0x54f8b9);})[_0xa9c5('0x13')](function(_0x10b208){logger[_0xa9c5('0xe')](_0xa9c5('0x14'),_0x10b208[_0xa9c5('0x10')],_0x1142d9);_0x452a9b(_0x2b9ac5['error'](0x1f4,_0x10b208['message']));});});};exports[_0xa9c5('0x1a')]=function(_0x11d395){var _0x4b0f05=this;return new Promise(function(_0x6819b3,_0x424b4c){return db[_0xa9c5('0x15')][_0xa9c5('0x1b')](_0x11d395[_0xa9c5('0x17')],{'raw':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d395['options']?_0x11d395[_0xa9c5('0x18')]['where']||null:null,'attributes':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['attributes']||null:null,'limit':_0x11d395[_0xa9c5('0x18')]?_0x11d395[_0xa9c5('0x18')]['limit']||null:null})[_0xa9c5('0xa')](function(_0x32baf9){logger[_0xa9c5('0x11')](_0xa9c5('0x1a'),_0x11d395);logger[_0xa9c5('0x1c')]('UpdateSquareReport',_0x11d395,JSON[_0xa9c5('0xd')](_0x32baf9));_0x6819b3(_0x32baf9);})['catch'](function(_0x3c3da7){logger[_0xa9c5('0xe')](_0xa9c5('0x1a'),_0x3c3da7['message'],_0x11d395);_0x424b4c(_0x4b0f05[_0xa9c5('0xe')](0x1f4,_0x3c3da7[_0xa9c5('0x10')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','debug','stringify','update','raw','where','UpdateSquareReport','lodash','util','randomstring'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0xe14b,0x93));var _0xbe14=function(_0x1719e8,_0x16c4bd){_0x1719e8=_0x1719e8-0x0;var _0x2c6523=_0xe14b[_0x1719e8];return _0x2c6523;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')](_0x29ab73[_0xbe14('0x16')],{'raw':_0x29ab73[_0xbe14('0x17')]?_0x29ab73[_0xbe14('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbe14('0x9')](function(_0x4a1bbd){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger[_0xbe14('0x18')]('CreateSquareReport',_0x29ab73,JSON[_0xbe14('0x19')](_0x4a1bbd));_0x5ea1f8(_0x4a1bbd);})['catch'](function(_0x3c1c85){logger['error'](_0xbe14('0x13'),_0x3c1c85['message'],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c1c85[_0xbe14('0x10')]));});});};exports['UpdateSquareReport']=function(_0x2da350){var _0x4d4190=this;return new Promise(function(_0x4587a8,_0x4851f8){return db[_0xbe14('0x14')][_0xbe14('0x1a')](_0x2da350[_0xbe14('0x16')],{'raw':_0x2da350[_0xbe14('0x17')]?_0x2da350[_0xbe14('0x17')][_0xbe14('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da350['options']?_0x2da350[_0xbe14('0x17')][_0xbe14('0x1c')]||null:null,'attributes':_0x2da350[_0xbe14('0x17')]?_0x2da350[_0xbe14('0x17')]['attributes']||null:null,'limit':_0x2da350[_0xbe14('0x17')]?_0x2da350[_0xbe14('0x17')]['limit']||null:null})[_0xbe14('0x9')](function(_0x3b3e84){logger[_0xbe14('0xa')](_0xbe14('0x1d'),_0x2da350);logger[_0xbe14('0x18')](_0xbe14('0x1d'),_0x2da350,JSON[_0xbe14('0x19')](_0x3b3e84));_0x4587a8(_0x3b3e84);})[_0xbe14('0x12')](function(_0x4168c8){logger[_0xbe14('0xe')](_0xbe14('0x1d'),_0x4168c8[_0xbe14('0x10')],_0x2da350);_0x4851f8(_0x4d4190[_0xbe14('0xe')](0x1f4,_0x4168c8[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a447200..12813cd 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(_0x45af42,_0x5e67b0){var _0x6c1c8f=function(_0x390e32){while(--_0x390e32){_0x45af42['push'](_0x45af42['shift']());}};_0x6c1c8f(++_0x5e67b0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1210a3,_0x123054){_0x1210a3=_0x1210a3-0x0;var _0x7aa841=_0x5f2f[_0x1210a3];return _0x7aa841;};'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(_0x3df552,_0x2988c1){var _0xed396a=function(_0x58fe8c){while(--_0x58fe8c){_0x3df552['push'](_0x3df552['shift']());}};_0xed396a(++_0x2988c1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ebaf,_0x2e737f){_0x20ebaf=_0x20ebaf-0x0;var _0x3fa8d7=_0x5f2f[_0x20ebaf];return _0x3fa8d7;};'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 5376501..7f6490f 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 _0x7d6a=['exports','STRING','TEXT','sequelize'];(function(_0x3ad014,_0x1df303){var _0x47eff0=function(_0x580f2a){while(--_0x580f2a){_0x3ad014['push'](_0x3ad014['shift']());}};_0x47eff0(++_0x1df303);}(_0x7d6a,0x1a3));var _0xa7d6=function(_0x484652,_0x9f771f){_0x484652=_0x484652-0x0;var _0x5c3e01=_0x7d6a[_0x484652];return _0x5c3e01;};'use strict';var Sequelize=require(_0xa7d6('0x0'));module[_0xa7d6('0x1')]={'uniqueid':{'type':Sequelize[_0xa7d6('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xa7d6('0x2')]},'data':{'type':Sequelize[_0xa7d6('0x3')]},'project_name':{'type':Sequelize[_0xa7d6('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x06a8=['TEXT','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x06a8,0x111));var _0x806a=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x06a8[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x806a('0x0'));module[_0x806a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x806a('0x2')]},'application':{'type':Sequelize[_0x806a('0x2')]},'data':{'type':Sequelize[_0x806a('0x3')]},'project_name':{'type':Sequelize[_0x806a('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7b0fe67..29348de 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 _0x689b=['merge','VIRTUAL','options','SquareDetailsReport','count','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','find','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter'];(function(_0x209cf1,_0x2de964){var _0x5486ce=function(_0x12edbe){while(--_0x12edbe){_0x209cf1['push'](_0x209cf1['shift']());}};_0x5486ce(++_0x2de964);}(_0x689b,0x142));var _0xb689=function(_0x240078,_0x449e05){_0x240078=_0x240078-0x0;var _0x4c936f=_0x689b[_0x240078];return _0x4c936f;};'use strict';var pdf=require(_0xb689('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb689('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb689('0x2'));var moment=require(_0xb689('0x3'));var BPromise=require(_0xb689('0x4'));var Mustache=require(_0xb689('0x5'));var util=require(_0xb689('0x6'));var path=require(_0xb689('0x7'));var sox=require(_0xb689('0x8'));var csv=require('to-csv');var ejs=require(_0xb689('0x9'));var fs=require('fs');var _=require(_0xb689('0xa'));var squel=require(_0xb689('0xb'));var crypto=require(_0xb689('0xc'));var jsforce=require(_0xb689('0xd'));var deskjs=require(_0xb689('0xe'));var toCsv=require(_0xb689('0xf'));var querystring=require('querystring');var Papa=require(_0xb689('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb689('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb689('0x12'));var logger=require('../../config/logger')(_0xb689('0x13'));var utils=require(_0xb689('0x14'));var config=require(_0xb689('0x15'));var licenseUtil=require(_0xb689('0x16'));var db=require(_0xb689('0x17'))['db'];function respondWithStatusCode(_0x3b8460,_0x18a8f6){_0x18a8f6=_0x18a8f6||0xcc;return function(_0x3160a7){if(_0x3160a7){return _0x3b8460[_0xb689('0x18')](_0x18a8f6);}return _0x3b8460['status'](_0x18a8f6)[_0xb689('0x19')]();};}function respondWithResult(_0x320640,_0xa8ddb){_0xa8ddb=_0xa8ddb||0xc8;return function(_0x45f044){if(_0x45f044){return _0x320640[_0xb689('0x1a')](_0xa8ddb)[_0xb689('0x1b')](_0x45f044);}};}function respondWithFilteredResult(_0x59094e,_0xf09cd4){return function(_0x1ec1b4){if(_0x1ec1b4){var _0x5f2456=_0x1ec1b4['count'],_0x23a825=_0xf09cd4['offset'],_0x51647d=_0xf09cd4[_0xb689('0x1c')]+_0xf09cd4[_0xb689('0x1d')],_0xf950eb;if(_0x51647d>=_0x5f2456){_0x51647d=_0x5f2456;_0xf950eb=0xc8;}else{_0xf950eb=0xce;}_0x59094e['status'](_0xf950eb);return _0x59094e[_0xb689('0x1e')]('Content-Range',_0x23a825+'-'+_0x51647d+'/'+_0x5f2456)[_0xb689('0x1b')](_0x1ec1b4);}return null;};}function patchUpdates(_0x4dfd1b){return function(_0x3091eb){try{jsonpatch[_0xb689('0x1f')](_0x3091eb,_0x4dfd1b,!![]);}catch(_0x27fe5a){return BPromise[_0xb689('0x20')](_0x27fe5a);}return _0x3091eb[_0xb689('0x21')]();};}function saveUpdates(_0x4a9b09,_0x36000e){return function(_0xdd8dcd){if(_0xdd8dcd){return _0xdd8dcd['update'](_0x4a9b09)[_0xb689('0x22')](function(_0x3419cb){return _0x3419cb;});}return null;};}function removeEntity(_0x5a1970,_0x5aea04){return function(_0x404435){if(_0x404435){return _0x404435[_0xb689('0x23')]()[_0xb689('0x22')](function(){_0x5a1970[_0xb689('0x1a')](0xcc)[_0xb689('0x19')]();});}};}function handleEntityNotFound(_0x1db07b,_0x17a31d){return function(_0xba2b33){if(!_0xba2b33){_0x1db07b[_0xb689('0x18')](0x194);}return _0xba2b33;};}function handleError(_0x1a9cf6,_0xf821f2){_0xf821f2=_0xf821f2||0x1f4;return function(_0x3855b6){logger[_0xb689('0x24')](_0x3855b6[_0xb689('0x25')]);if(_0x3855b6[_0xb689('0x26')]){delete _0x3855b6['name'];}_0x1a9cf6[_0xb689('0x1a')](_0xf821f2)[_0xb689('0x27')](_0x3855b6);};}exports[_0xb689('0x28')]=function(_0x134db6,_0x2dca44){var _0x1e9cdd={},_0x3a77fb={},_0x9dc1be={'count':0x0,'rows':[]};var _0x2ad1fa=_['map'](db['SquareDetailsReport'][_0xb689('0x29')],function(_0x363443){return{'name':_0x363443[_0xb689('0x2a')],'type':_0x363443[_0xb689('0x2b')][_0xb689('0x2c')]};});_0x3a77fb[_0xb689('0x2d')]=_[_0xb689('0x2e')](_0x2ad1fa,'name');_0x3a77fb['query']=_['keys'](_0x134db6[_0xb689('0x2f')]);_0x3a77fb[_0xb689('0x30')]=_[_0xb689('0x31')](_0x3a77fb[_0xb689('0x2d')],_0x3a77fb[_0xb689('0x2f')]);_0x1e9cdd[_0xb689('0x32')]=_['intersection'](_0x3a77fb[_0xb689('0x2d')],qs[_0xb689('0x33')](_0x134db6[_0xb689('0x2f')][_0xb689('0x33')]));_0x1e9cdd['attributes']=_0x1e9cdd[_0xb689('0x32')][_0xb689('0x34')]?_0x1e9cdd['attributes']:_0x3a77fb[_0xb689('0x2d')];if(!_0x134db6[_0xb689('0x2f')]['hasOwnProperty'](_0xb689('0x35'))){_0x1e9cdd['limit']=qs[_0xb689('0x1d')](_0x134db6[_0xb689('0x2f')][_0xb689('0x1d')]);_0x1e9cdd['offset']=qs[_0xb689('0x1c')](_0x134db6[_0xb689('0x2f')][_0xb689('0x1c')]);}_0x1e9cdd[_0xb689('0x36')]=qs['sort'](_0x134db6[_0xb689('0x2f')][_0xb689('0x37')]);_0x1e9cdd[_0xb689('0x38')]=qs[_0xb689('0x30')](_['pick'](_0x134db6[_0xb689('0x2f')],_0x3a77fb[_0xb689('0x30')]),_0x2ad1fa);if(_0x134db6['query'][_0xb689('0x39')]){_0x1e9cdd[_0xb689('0x38')]=_[_0xb689('0x3a')](_0x1e9cdd[_0xb689('0x38')],{'$or':_['map'](_0x2ad1fa,function(_0x442860){if(_0x442860[_0xb689('0x2b')]!==_0xb689('0x3b')){var _0x3df38d={};_0x3df38d[_0x442860[_0xb689('0x26')]]={'$like':'%'+_0x134db6[_0xb689('0x2f')]['filter']+'%'};return _0x3df38d;}})});}_0x1e9cdd=_['merge']({},_0x1e9cdd,_0x134db6[_0xb689('0x3c')]);var _0x1b7c63={'where':_0x1e9cdd[_0xb689('0x38')]};return db[_0xb689('0x3d')][_0xb689('0x3e')](_0x1b7c63)[_0xb689('0x22')](function(_0x26ec12){_0x9dc1be['count']=_0x26ec12;if(_0x134db6[_0xb689('0x2f')][_0xb689('0x3f')]){_0x1e9cdd[_0xb689('0x40')]=[{'all':!![]}];}return db[_0xb689('0x3d')][_0xb689('0x41')](_0x1e9cdd);})[_0xb689('0x22')](function(_0x11dab9){_0x9dc1be[_0xb689('0x42')]=_0x11dab9;return _0x9dc1be;})[_0xb689('0x22')](respondWithFilteredResult(_0x2dca44,_0x1e9cdd))[_0xb689('0x43')](handleError(_0x2dca44,null));};exports[_0xb689('0x44')]=function(_0x1d3170,_0x2ba4a2){var _0x59024e={'raw':!![],'where':{'id':_0x1d3170[_0xb689('0x45')]['id']}},_0x56e0f2={};_0x56e0f2['model']=_[_0xb689('0x46')](db[_0xb689('0x3d')][_0xb689('0x29')]);_0x56e0f2['query']=_['keys'](_0x1d3170[_0xb689('0x2f')]);_0x56e0f2['filters']=_[_0xb689('0x31')](_0x56e0f2['model'],_0x56e0f2['query']);_0x59024e[_0xb689('0x32')]=_['intersection'](_0x56e0f2[_0xb689('0x2d')],qs[_0xb689('0x33')](_0x1d3170[_0xb689('0x2f')]['fields']));_0x59024e['attributes']=_0x59024e[_0xb689('0x32')][_0xb689('0x34')]?_0x59024e[_0xb689('0x32')]:_0x56e0f2[_0xb689('0x2d')];if(_0x1d3170[_0xb689('0x2f')][_0xb689('0x3f')]){_0x59024e['include']=[{'all':!![]}];}_0x59024e=_[_0xb689('0x3a')]({},_0x59024e,_0x1d3170[_0xb689('0x3c')]);return db[_0xb689('0x3d')]['find'](_0x59024e)[_0xb689('0x22')](handleEntityNotFound(_0x2ba4a2,null))[_0xb689('0x22')](respondWithResult(_0x2ba4a2,null))['catch'](handleError(_0x2ba4a2,null));};exports[_0xb689('0x47')]=function(_0x18254b,_0x23fa31){return db[_0xb689('0x3d')]['create'](_0x18254b['body'],{})[_0xb689('0x22')](respondWithResult(_0x23fa31,0xc9))[_0xb689('0x43')](handleError(_0x23fa31,null));};exports[_0xb689('0x48')]=function(_0x166c7f,_0x5a3171){if(_0x166c7f[_0xb689('0x49')]['id']){delete _0x166c7f[_0xb689('0x49')]['id'];}return db[_0xb689('0x3d')]['find']({'where':{'id':_0x166c7f[_0xb689('0x45')]['id']}})[_0xb689('0x22')](handleEntityNotFound(_0x5a3171,null))[_0xb689('0x22')](saveUpdates(_0x166c7f[_0xb689('0x49')],null))[_0xb689('0x22')](respondWithResult(_0x5a3171,null))[_0xb689('0x43')](handleError(_0x5a3171,null));};exports['destroy']=function(_0x579790,_0x3ddd01){return db['SquareDetailsReport'][_0xb689('0x4a')]({'where':{'id':_0x579790[_0xb689('0x45')]['id']}})[_0xb689('0x22')](handleEntityNotFound(_0x3ddd01,null))['then'](removeEntity(_0x3ddd01,null))[_0xb689('0x43')](handleError(_0x3ddd01,null));};exports[_0xb689('0x4b')]=function(_0x4df6a4,_0x1eaa4f){return db['SquareDetailsReport'][_0xb689('0x4b')]()[_0xb689('0x22')](respondWithResult(_0x1eaa4f,null))[_0xb689('0x43')](handleError(_0x1eaa4f,null));}; \ No newline at end of file +var _0x02ce=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','status','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x20cb79,_0x11e512){var _0x5e3f60=function(_0x1035b1){while(--_0x1035b1){_0x20cb79['push'](_0x20cb79['shift']());}};_0x5e3f60(++_0x11e512);}(_0x02ce,0x1ac));var _0xe02c=function(_0x33e6c6,_0x278c94){_0x33e6c6=_0x33e6c6-0x0;var _0x540e66=_0x02ce[_0x33e6c6];return _0x540e66;};'use strict';var pdf=require(_0xe02c('0x0'));var emlformat=require(_0xe02c('0x1'));var rimraf=require(_0xe02c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02c('0x3'));var rp=require('request-promise');var moment=require(_0xe02c('0x4'));var BPromise=require(_0xe02c('0x5'));var Mustache=require(_0xe02c('0x6'));var util=require(_0xe02c('0x7'));var path=require(_0xe02c('0x8'));var sox=require(_0xe02c('0x9'));var csv=require(_0xe02c('0xa'));var ejs=require(_0xe02c('0xb'));var fs=require('fs');var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0xa'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=_0x366893[_0xe02c('0x1e')],_0x10a2a6=_0x256311[_0xe02c('0x1f')],_0x226a80=_0x256311['offset']+_0x256311['limit'],_0x51676c;if(_0x226a80>=_0x59f2f6){_0x226a80=_0x59f2f6;_0x51676c=0xc8;}else{_0x51676c=0xce;}_0x4e9c6d[_0xe02c('0x20')](_0x51676c);return _0x4e9c6d['set'](_0xe02c('0x21'),_0x10a2a6+'-'+_0x226a80+'/'+_0x59f2f6)[_0xe02c('0x1d')](_0x366893);}return null;};}function patchUpdates(_0x706946){return function(_0x36fed0){try{jsonpatch[_0xe02c('0x22')](_0x36fed0,_0x706946,!![]);}catch(_0x54c5b0){return BPromise[_0xe02c('0x23')](_0x54c5b0);}return _0x36fed0['save']();};}function saveUpdates(_0x4ea9b5,_0x393621){return function(_0x4514ac){if(_0x4514ac){return _0x4514ac['update'](_0x4ea9b5)[_0xe02c('0x24')](function(_0x2d652e){return _0x2d652e;});}return null;};}function removeEntity(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x25')]()[_0xe02c('0x24')](function(){_0x4ce5ee[_0xe02c('0x20')](0xcc)[_0xe02c('0x26')]();});}};}function handleEntityNotFound(_0x3e80e3,_0xf41d4c){return function(_0xeae877){if(!_0xeae877){_0x3e80e3[_0xe02c('0x1c')](0x194);}return _0xeae877;};}function handleError(_0x60b65e,_0x47bbef){_0x47bbef=_0x47bbef||0x1f4;return function(_0xefd882){logger[_0xe02c('0x27')](_0xefd882[_0xe02c('0x28')]);if(_0xefd882[_0xe02c('0x29')]){delete _0xefd882[_0xe02c('0x29')];}_0x60b65e[_0xe02c('0x20')](_0x47bbef)[_0xe02c('0x2a')](_0xefd882);};}exports[_0xe02c('0x2b')]=function(_0x55ef2a,_0x55e475){var _0x3790eb={},_0x148e2b={},_0x481e02={'count':0x0,'rows':[]};var _0x18b572=_[_0xe02c('0x2c')](db[_0xe02c('0x2d')][_0xe02c('0x2e')],function(_0x1e7eab){return{'name':_0x1e7eab[_0xe02c('0x2f')],'type':_0x1e7eab[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x148e2b[_0xe02c('0x32')]=_[_0xe02c('0x2c')](_0x18b572,_0xe02c('0x29'));_0x148e2b['query']=_[_0xe02c('0x33')](_0x55ef2a[_0xe02c('0x34')]);_0x148e2b[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x148e2b[_0xe02c('0x32')],_0x148e2b[_0xe02c('0x34')]);_0x3790eb['attributes']=_[_0xe02c('0x36')](_0x148e2b[_0xe02c('0x32')],qs['fields'](_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x37')]));_0x3790eb[_0xe02c('0x38')]=_0x3790eb[_0xe02c('0x38')][_0xe02c('0x39')]?_0x3790eb['attributes']:_0x148e2b['model'];if(!_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x3a')]('nolimit')){_0x3790eb[_0xe02c('0x3b')]=qs['limit'](_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x3b')]);_0x3790eb[_0xe02c('0x1f')]=qs[_0xe02c('0x1f')](_0x55ef2a[_0xe02c('0x34')]['offset']);}_0x3790eb[_0xe02c('0x3c')]=qs['sort'](_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x3d')]);_0x3790eb[_0xe02c('0x3e')]=qs[_0xe02c('0x35')](_[_0xe02c('0x3f')](_0x55ef2a[_0xe02c('0x34')],_0x148e2b['filters']),_0x18b572);if(_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x40')]){_0x3790eb['where']=_[_0xe02c('0x41')](_0x3790eb[_0xe02c('0x3e')],{'$or':_['map'](_0x18b572,function(_0x396a06){if(_0x396a06['type']!==_0xe02c('0x42')){var _0x12b3e5={};_0x12b3e5[_0x396a06['name']]={'$like':'%'+_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x40')]+'%'};return _0x12b3e5;}})});}_0x3790eb=_[_0xe02c('0x41')]({},_0x3790eb,_0x55ef2a[_0xe02c('0x43')]);var _0x3c4a65={'where':_0x3790eb[_0xe02c('0x3e')]};return db['SquareDetailsReport'][_0xe02c('0x1e')](_0x3c4a65)['then'](function(_0x5ae8cd){_0x481e02[_0xe02c('0x1e')]=_0x5ae8cd;if(_0x55ef2a[_0xe02c('0x34')][_0xe02c('0x44')]){_0x3790eb[_0xe02c('0x45')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xe02c('0x46')](_0x3790eb);})[_0xe02c('0x24')](function(_0x163573){_0x481e02['rows']=_0x163573;return _0x481e02;})['then'](respondWithFilteredResult(_0x55e475,_0x3790eb))[_0xe02c('0x47')](handleError(_0x55e475,null));};exports[_0xe02c('0x48')]=function(_0x381db9,_0x2313d2){var _0x1b0876={'raw':!![],'where':{'id':_0x381db9[_0xe02c('0x49')]['id']}},_0x4543a8={};_0x4543a8[_0xe02c('0x32')]=_[_0xe02c('0x33')](db['SquareDetailsReport'][_0xe02c('0x2e')]);_0x4543a8['query']=_['keys'](_0x381db9[_0xe02c('0x34')]);_0x4543a8[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x4543a8[_0xe02c('0x32')],_0x4543a8[_0xe02c('0x34')]);_0x1b0876[_0xe02c('0x38')]=_[_0xe02c('0x36')](_0x4543a8[_0xe02c('0x32')],qs['fields'](_0x381db9['query'][_0xe02c('0x37')]));_0x1b0876[_0xe02c('0x38')]=_0x1b0876[_0xe02c('0x38')]['length']?_0x1b0876[_0xe02c('0x38')]:_0x4543a8[_0xe02c('0x32')];if(_0x381db9[_0xe02c('0x34')][_0xe02c('0x44')]){_0x1b0876[_0xe02c('0x45')]=[{'all':!![]}];}_0x1b0876=_[_0xe02c('0x41')]({},_0x1b0876,_0x381db9[_0xe02c('0x43')]);return db[_0xe02c('0x2d')][_0xe02c('0x4a')](_0x1b0876)[_0xe02c('0x24')](handleEntityNotFound(_0x2313d2,null))['then'](respondWithResult(_0x2313d2,null))[_0xe02c('0x47')](handleError(_0x2313d2,null));};exports[_0xe02c('0x4b')]=function(_0x292707,_0x1a39ea){return db[_0xe02c('0x2d')][_0xe02c('0x4b')](_0x292707[_0xe02c('0x4c')],{})[_0xe02c('0x24')](respondWithResult(_0x1a39ea,0xc9))[_0xe02c('0x47')](handleError(_0x1a39ea,null));};exports[_0xe02c('0x4d')]=function(_0xfed475,_0x693565){if(_0xfed475[_0xe02c('0x4c')]['id']){delete _0xfed475['body']['id'];}return db[_0xe02c('0x2d')]['find']({'where':{'id':_0xfed475[_0xe02c('0x49')]['id']}})[_0xe02c('0x24')](handleEntityNotFound(_0x693565,null))[_0xe02c('0x24')](saveUpdates(_0xfed475[_0xe02c('0x4c')],null))[_0xe02c('0x24')](respondWithResult(_0x693565,null))[_0xe02c('0x47')](handleError(_0x693565,null));};exports[_0xe02c('0x25')]=function(_0xc2b5dd,_0xc6ea7b){return db[_0xe02c('0x2d')]['find']({'where':{'id':_0xc2b5dd[_0xe02c('0x49')]['id']}})[_0xe02c('0x24')](handleEntityNotFound(_0xc6ea7b,null))[_0xe02c('0x24')](removeEntity(_0xc6ea7b,null))['catch'](handleError(_0xc6ea7b,null));};exports[_0xe02c('0x4e')]=function(_0x5ab97d,_0x21a126){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x21a126,null))['catch'](handleError(_0x21a126,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 715232f..3e3a673 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 _0x76f4=['request-promise','path','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','../../config/logger','api','moment','bluebird'];(function(_0x1c1dc4,_0x58f27c){var _0x1a0c35=function(_0x82fc2f){while(--_0x82fc2f){_0x1c1dc4['push'](_0x1c1dc4['shift']());}};_0x1a0c35(++_0x58f27c);}(_0x76f4,0x1e0));var _0x476f=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x76f4[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x476f('0x0'))(_0x476f('0x1'));var moment=require(_0x476f('0x2'));var BPromise=require(_0x476f('0x3'));var rp=require(_0x476f('0x4'));var fs=require('fs');var path=require(_0x476f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x476f('0x6'));module[_0x476f('0x7')]=function(_0x2c9b54,_0x2350d6){return _0x2c9b54[_0x476f('0x8')](_0x476f('0x9'),attributes,{'tableName':_0x476f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1f9=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa1f9,0x16f));var _0x9a1f=function(_0x5daebd,_0x3b96a8){_0x5daebd=_0x5daebd-0x0;var _0x2f5a67=_0xa1f9[_0x5daebd];return _0x2f5a67;};'use strict';var _=require(_0x9a1f('0x0'));var util=require(_0x9a1f('0x1'));var logger=require(_0x9a1f('0x2'))(_0x9a1f('0x3'));var moment=require(_0x9a1f('0x4'));var BPromise=require(_0x9a1f('0x5'));var rp=require(_0x9a1f('0x6'));var fs=require('fs');var path=require(_0x9a1f('0x7'));var rimraf=require(_0x9a1f('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a1f('0x9'));module['exports']=function(_0x1802e4,_0x418db5){return _0x1802e4[_0x9a1f('0xa')](_0x9a1f('0xb'),attributes,{'tableName':_0x9a1f('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 525316e..c0747be 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 _0x5593=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x5593,0x1c4));var _0x3559=function(_0x1dda39,_0x221826){_0x1dda39=_0x1dda39-0x0;var _0x269408=_0x5593[_0x1dda39];return _0x269408;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3559('0x0'));var BPromise=require(_0x3559('0x1'));var rs=require(_0x3559('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3559('0x3'))['db'];var utils=require(_0x3559('0x4'));var logger=require(_0x3559('0x5'))(_0x3559('0x6'));var config=require(_0x3559('0x7'));var jayson=require(_0x3559('0x8'));var client=jayson['client'][_0x3559('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa65e,_0x246dd1,_0x51aed6){return new BPromise(function(_0x4159c8,_0x5aa513){return client['request'](_0x2aa65e,_0x51aed6)['then'](function(_0x3af5e5){logger[_0x3559('0xa')](_0x3559('0xb'),_0x246dd1,_0x3559('0xc'));logger[_0x3559('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x246dd1,_0x3559('0xc'),JSON[_0x3559('0xe')](_0x3af5e5));if(_0x3af5e5[_0x3559('0xf')]){if(_0x3af5e5['error']['code']===0x1f4){logger['error'](_0x3559('0xb'),_0x246dd1,_0x3af5e5[_0x3559('0xf')]['message']);return _0x5aa513(_0x3af5e5[_0x3559('0xf')]['message']);}logger[_0x3559('0xf')](_0x3559('0xb'),_0x246dd1,_0x3af5e5[_0x3559('0xf')][_0x3559('0x10')]);return _0x4159c8(_0x3af5e5[_0x3559('0xf')][_0x3559('0x10')]);}else{logger[_0x3559('0xa')](_0x3559('0xb'),_0x246dd1,_0x3559('0xc'));_0x4159c8(_0x3af5e5[_0x3559('0x11')]['message']);}})[_0x3559('0x12')](function(_0x1c4b64){logger[_0x3559('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x246dd1,_0x1c4b64);_0x5aa513(_0x1c4b64);});});}exports[_0x3559('0x13')]=function(_0x4b13c9){var _0x529925=this;return new Promise(function(_0x34875a,_0x7962b2){return db[_0x3559('0x14')][_0x3559('0x15')](_0x4b13c9[_0x3559('0x16')],{'raw':_0x4b13c9[_0x3559('0x17')]?_0x4b13c9[_0x3559('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x17fcc8){logger[_0x3559('0xa')](_0x3559('0x13'),_0x4b13c9);logger['debug'](_0x3559('0x13'),_0x4b13c9,JSON[_0x3559('0xe')](_0x17fcc8));_0x34875a(_0x17fcc8);})[_0x3559('0x12')](function(_0x166e02){logger[_0x3559('0xf')]('CreateSquareDetailsReport',_0x166e02[_0x3559('0x10')],_0x4b13c9);_0x7962b2(_0x529925[_0x3559('0xf')](0x1f4,_0x166e02[_0x3559('0x10')]));});});}; \ No newline at end of file +var _0x1ebc=['raw','then','CreateSquareDetailsReport','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create'];(function(_0x4ba1cb,_0x2c19c5){var _0x1ea1d4=function(_0x48f320){while(--_0x48f320){_0x4ba1cb['push'](_0x4ba1cb['shift']());}};_0x1ea1d4(++_0x2c19c5);}(_0x1ebc,0x1cb));var _0xc1eb=function(_0x37e257,_0x165bba){_0x37e257=_0x37e257-0x0;var _0x368a96=_0x1ebc[_0x37e257];return _0x368a96;};'use strict';var _=require(_0xc1eb('0x0'));var util=require(_0xc1eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1eb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1eb('0x3'));var logger=require(_0xc1eb('0x4'))(_0xc1eb('0x5'));var config=require(_0xc1eb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc1eb('0x7')][_0xc1eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd691d0,_0x374461,_0x58dfbd){return new BPromise(function(_0x2dffeb,_0x46ee06){return client[_0xc1eb('0x9')](_0xd691d0,_0x58dfbd)['then'](function(_0x5b66a4){logger['info'](_0xc1eb('0xa'),_0x374461,'request\x20sent');logger['debug'](_0xc1eb('0xb'),_0x374461,_0xc1eb('0xc'),JSON[_0xc1eb('0xd')](_0x5b66a4));if(_0x5b66a4['error']){if(_0x5b66a4[_0xc1eb('0xe')][_0xc1eb('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x374461,_0x5b66a4[_0xc1eb('0xe')]['message']);return _0x46ee06(_0x5b66a4[_0xc1eb('0xe')]['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x374461,_0x5b66a4[_0xc1eb('0xe')][_0xc1eb('0x10')]);return _0x2dffeb(_0x5b66a4['error'][_0xc1eb('0x10')]);}else{logger['info'](_0xc1eb('0xa'),_0x374461,'request\x20sent');_0x2dffeb(_0x5b66a4[_0xc1eb('0x11')][_0xc1eb('0x10')]);}})[_0xc1eb('0x12')](function(_0x515171){logger[_0xc1eb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x374461,_0x515171);_0x46ee06(_0x515171);});});}exports['CreateSquareDetailsReport']=function(_0x968be5){var _0xe5016b=this;return new Promise(function(_0x49da90,_0x3a54b9){return db[_0xc1eb('0x13')][_0xc1eb('0x14')](_0x968be5['body'],{'raw':_0x968be5['options']?_0x968be5['options'][_0xc1eb('0x15')]===undefined?!![]:![]:!![]})[_0xc1eb('0x16')](function(_0x2656b7){logger['info']('CreateSquareDetailsReport',_0x968be5);logger['debug'](_0xc1eb('0x17'),_0x968be5,JSON[_0xc1eb('0xd')](_0x2656b7));_0x49da90(_0x2656b7);})[_0xc1eb('0x12')](function(_0x509104){logger[_0xc1eb('0xe')](_0xc1eb('0x17'),_0x509104[_0xc1eb('0x10')],_0x968be5);_0x3a54b9(_0xe5016b['error'](0x1f4,_0x509104['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 49afc97..d4757e1 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 _0x02d4=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x326c2a,_0x12ed32){var _0x386496=function(_0x47de9d){while(--_0x47de9d){_0x326c2a['push'](_0x326c2a['shift']());}};_0x386496(++_0x12ed32);}(_0x02d4,0x18b));var _0x402d=function(_0x1cc8b2,_0xf292e0){_0x1cc8b2=_0x1cc8b2-0x0;var _0x4f3059=_0x02d4[_0x1cc8b2];return _0x4f3059;};'use strict';var express=require(_0x402d('0x0'));var router=express['Router']();var auth=require(_0x402d('0x1'));var controller=require(_0x402d('0x2'));router[_0x402d('0x3')]('/',auth[_0x402d('0x4')](),controller[_0x402d('0x5')]);router[_0x402d('0x3')](_0x402d('0x6'),auth[_0x402d('0x4')](),controller[_0x402d('0x7')]);module[_0x402d('0x8')]=router; \ No newline at end of file +var _0x760b=['get','/process/:pid/kill','killProcess','exports','express','isAuthenticated','index'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x760b,0x97));var _0xb760=function(_0x33583d,_0x248810){_0x33583d=_0x33583d-0x0;var _0x26803d=_0x760b[_0x33583d];return _0x26803d;};'use strict';var express=require(_0xb760('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0xb760('0x1')](),controller[_0xb760('0x2')]);router[_0xb760('0x3')](_0xb760('0x4'),auth[_0xb760('0x1')](),controller[_0xb760('0x5')]);module[_0xb760('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index cec27a7..4719834 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 _0x2ca0=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','json','status','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','indexOf','kill','SIGINT','catch','systeminformation','util'];(function(_0x495c65,_0x1325c1){var _0x1e70b9=function(_0x3b2bac){while(--_0x3b2bac){_0x495c65['push'](_0x495c65['shift']());}};_0x1e70b9(++_0x1325c1);}(_0x2ca0,0x143));var _0x02ca=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x2ca0[_0x1ca4c3];return _0x4426a6;};'use strict';var info=require(_0x02ca('0x0'));var exec=require('child_process')['exec'];var logger=require('../../config/logger')('api');var util=require(_0x02ca('0x1'));var BPromise=require(_0x02ca('0x2'));var _=require(_0x02ca('0x3'));function handleError(_0x45b705,_0x292047,_0x4cf96f){_0x292047=_0x292047||0x1f4;return function(_0x35cafe){logger[_0x02ca('0x4')](_0x02ca('0x5'),_0x4cf96f,_0x292047,util[_0x02ca('0x6')](_0x35cafe,{'showHidden':![],'depth':null}));delete _0x35cafe[_0x02ca('0x7')];_0x45b705['status'](_0x292047)[_0x02ca('0x8')](_0x35cafe);};}exports[_0x02ca('0x9')]=function(_0x2ce03a,_0x2ef003){return info[_0x02ca('0xa')]()['then'](function(_0x12cec5){return _0x2ef003['status'](0xc8)[_0x02ca('0xb')](_0x12cec5);})['catch'](function(_0x48c2be){return _0x2ef003[_0x02ca('0xc')](0x1f4)['json'](_0x48c2be);});};exports[_0x02ca('0xd')]=function(_0x1d5409,_0x530dd7){var _0x5e95fa=[_0x02ca('0xe')];return new BPromise(function(_0x4b68e1,_0x4bdda1){return exec(util[_0x02ca('0xf')](_0x02ca('0x10'),_0x1d5409[_0x02ca('0x11')][_0x02ca('0x12')]),function(_0x516eea,_0x59bb7f,_0x5b5683){if(_0x516eea){return _0x4bdda1(_0x516eea);}return _0x4b68e1(_0x59bb7f);});})[_0x02ca('0x13')](function(_0x55e8a0){var _0x3e04d8=![];var _0x116b4a=_0x55e8a0[_0x02ca('0x14')](/\n/);for(var _0x5c5c18=0x0,_0x4dbe7e=_0x5e95fa['length'];_0x5c5c18<_0x4dbe7e,_0x3e04d8===![];_0x5c5c18+=0x1){if(_0x55e8a0[_0x02ca('0x15')](_0x5e95fa[_0x5c5c18])>=0x0){_0x3e04d8=!![];}}if(!_0x3e04d8){throw new Error(util[_0x02ca('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1d5409['params'][_0x02ca('0x12')]));}process[_0x02ca('0x16')](_0x1d5409[_0x02ca('0x11')][_0x02ca('0x12')],_0x02ca('0x17'));return _0x530dd7[_0x02ca('0xc')](0xc8)[_0x02ca('0xb')]({'message':util[_0x02ca('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x1d5409['params'][_0x02ca('0x12')])});})[_0x02ca('0x18')](handleError(_0x530dd7,null,'killProcess'));}; \ No newline at end of file +var _0x17c1=['send','index','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status'];(function(_0x3358ee,_0x599447){var _0x2d976f=function(_0x26e7af){while(--_0x26e7af){_0x3358ee['push'](_0x3358ee['shift']());}};_0x2d976f(++_0x599447);}(_0x17c1,0x1c2));var _0x117c=function(_0xb1f07c,_0x28311a){_0xb1f07c=_0xb1f07c-0x0;var _0x27da11=_0x17c1[_0xb1f07c];return _0x27da11;};'use strict';var info=require(_0x117c('0x0'));var exec=require(_0x117c('0x1'))[_0x117c('0x2')];var logger=require(_0x117c('0x3'))(_0x117c('0x4'));var util=require(_0x117c('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x2e633b,_0x466af0,_0xf5804){_0x466af0=_0x466af0||0x1f4;return function(_0x4d4ff9){logger[_0x117c('0x6')](_0x117c('0x7'),_0xf5804,_0x466af0,util['inspect'](_0x4d4ff9,{'showHidden':![],'depth':null}));delete _0x4d4ff9[_0x117c('0x8')];_0x2e633b[_0x117c('0x9')](_0x466af0)[_0x117c('0xa')](_0x4d4ff9);};}exports[_0x117c('0xb')]=function(_0x3e09de,_0x1a54b8){return info[_0x117c('0xc')]()[_0x117c('0xd')](function(_0x19cac6){return _0x1a54b8['status'](0xc8)[_0x117c('0xe')](_0x19cac6);})['catch'](function(_0x1b6ca8){return _0x1a54b8[_0x117c('0x9')](0x1f4)['json'](_0x1b6ca8);});};exports[_0x117c('0xf')]=function(_0x39a780,_0x2fb7c9){var _0x1d863c=['components/import/cm'];return new BPromise(function(_0x2680ef,_0x4e3990){return exec(util[_0x117c('0x10')](_0x117c('0x11'),_0x39a780[_0x117c('0x12')][_0x117c('0x13')]),function(_0x32788d,_0x525c5d,_0x1a5ab5){if(_0x32788d){return _0x4e3990(_0x32788d);}return _0x2680ef(_0x525c5d);});})['then'](function(_0x22a8ca){var _0x14c9b1=![];var _0xde4ed7=_0x22a8ca[_0x117c('0x14')](/\n/);for(var _0x2565ed=0x0,_0x399809=_0x1d863c['length'];_0x2565ed<_0x399809,_0x14c9b1===![];_0x2565ed+=0x1){if(_0x22a8ca['indexOf'](_0x1d863c[_0x2565ed])>=0x0){_0x14c9b1=!![];}}if(!_0x14c9b1){throw new Error(util[_0x117c('0x10')](_0x117c('0x15'),_0x39a780[_0x117c('0x12')]['pid']));}process['kill'](_0x39a780['params'][_0x117c('0x13')],'SIGINT');return _0x2fb7c9['status'](0xc8)[_0x117c('0xe')]({'message':util[_0x117c('0x10')](_0x117c('0x16'),_0x39a780['params'][_0x117c('0x13')])});})['catch'](handleError(_0x2fb7c9,null,_0x117c('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 675bb96..71e5bca 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 _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x49e1d5,_0x30d540){var _0x303960=function(_0x39b8a8){while(--_0x39b8a8){_0x49e1d5['push'](_0x49e1d5['shift']());}};_0x303960(++_0x30d540);}(_0x750a,0x140));var _0xa750=function(_0x257abb,_0x3d1d2f){_0x257abb=_0x257abb-0x0;var _0x40ba4c=_0x750a[_0x257abb];return _0x40ba4c;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file +var _0x9bde=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create','put','destroy'];(function(_0x36c9c5,_0x295ff6){var _0x1c960b=function(_0x4060ad){while(--_0x4060ad){_0x36c9c5['push'](_0x36c9c5['shift']());}};_0x1c960b(++_0x295ff6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d7eaa,_0x59746a){_0x1d7eaa=_0x1d7eaa-0x0;var _0x343f77=_0x9bde[_0x1d7eaa];return _0x343f77;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var auth=require(_0xe9bd('0x3'));var interaction=require(_0xe9bd('0x4'));var config=require(_0xe9bd('0x5'));var controller=require(_0xe9bd('0x6'));router[_0xe9bd('0x7')]('/',auth[_0xe9bd('0x8')](),controller['index']);router[_0xe9bd('0x7')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0xb')]('/',auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0xd')](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller['update']);router['delete'](_0xe9bd('0x9'),auth[_0xe9bd('0x8')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b84f9fe..6b6b309 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 _0xda3f=['exports','STRING'];(function(_0x437a33,_0xcd1d22){var _0x2ab9c8=function(_0x432d6a){while(--_0x432d6a){_0x437a33['push'](_0x437a33['shift']());}};_0x2ab9c8(++_0xcd1d22);}(_0xda3f,0xec));var _0xfda3=function(_0x48da35,_0x1dfbc2){_0x48da35=_0x48da35-0x0;var _0x261f9a=_0xda3f[_0x48da35];return _0x261f9a;};'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 +var _0x8603=['name','exports','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8603,0x190));var _0x3860=function(_0xeb80c9,_0x3fe888){_0xeb80c9=_0xeb80c9-0x0;var _0x259c37=_0x8603[_0xeb80c9];return _0x259c37;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3860('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index affe7f5..d0d7851 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 _0x4e3b=['../../config/logger','../../config/license/util','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Tag','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x36456c,_0x47427b){var _0x97b131=function(_0x223387){while(--_0x223387){_0x36456c['push'](_0x36456c['shift']());}};_0x97b131(++_0x47427b);}(_0x4e3b,0x8f));var _0xb4e3=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x4e3b[_0x582f72];return _0x4cd5fe;};'use strict';var pdf=require(_0xb4e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb4e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4e3('0x2'));var rp=require(_0xb4e3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb4e3('0x4'));var util=require(_0xb4e3('0x5'));var path=require(_0xb4e3('0x6'));var sox=require(_0xb4e3('0x7'));var csv=require(_0xb4e3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb4e3('0x9'));var squel=require(_0xb4e3('0xa'));var crypto=require(_0xb4e3('0xb'));var jsforce=require(_0xb4e3('0xc'));var deskjs=require(_0xb4e3('0xd'));var toCsv=require(_0xb4e3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb4e3('0xe'));var authService=require(_0xb4e3('0xf'));var qs=require(_0xb4e3('0x10'));var as=require(_0xb4e3('0x11'));var hardwareService=require(_0xb4e3('0x12'));var logger=require(_0xb4e3('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb4e3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3badd9,_0x3c3259){_0x3c3259=_0x3c3259||0xcc;return function(_0x4be2ca){if(_0x4be2ca){return _0x3badd9[_0xb4e3('0x15')](_0x3c3259);}return _0x3badd9[_0xb4e3('0x16')](_0x3c3259)['end']();};}function respondWithResult(_0x31265e,_0x15221a){_0x15221a=_0x15221a||0xc8;return function(_0x569a05){if(_0x569a05){return _0x31265e[_0xb4e3('0x16')](_0x15221a)[_0xb4e3('0x17')](_0x569a05);}};}function respondWithFilteredResult(_0x13592d,_0x1ccada){return function(_0x2d8691){if(_0x2d8691){var _0x1207f6=_0x2d8691['count'],_0x2132c8=_0x1ccada[_0xb4e3('0x18')],_0xf00f8b=_0x1ccada[_0xb4e3('0x18')]+_0x1ccada[_0xb4e3('0x19')],_0xb10d6;if(_0xf00f8b>=_0x1207f6){_0xf00f8b=_0x1207f6;_0xb10d6=0xc8;}else{_0xb10d6=0xce;}_0x13592d[_0xb4e3('0x16')](_0xb10d6);return _0x13592d['set'](_0xb4e3('0x1a'),_0x2132c8+'-'+_0xf00f8b+'/'+_0x1207f6)[_0xb4e3('0x17')](_0x2d8691);}return null;};}function patchUpdates(_0x40b61a){return function(_0x4cf20f){try{jsonpatch[_0xb4e3('0x1b')](_0x4cf20f,_0x40b61a,!![]);}catch(_0xdb3a85){return BPromise[_0xb4e3('0x1c')](_0xdb3a85);}return _0x4cf20f[_0xb4e3('0x1d')]();};}function saveUpdates(_0x357acc,_0x5f4185){return function(_0x4a1e3b){if(_0x4a1e3b){return _0x4a1e3b[_0xb4e3('0x1e')](_0x357acc)['then'](function(_0x37d0bd){return _0x37d0bd;});}return null;};}function removeEntity(_0x498cb7,_0x43743d){return function(_0x497b2e){if(_0x497b2e){return _0x497b2e[_0xb4e3('0x1f')]()[_0xb4e3('0x20')](function(){var _0x2b6056=_0x497b2e[_0xb4e3('0x21')]({'plain':!![]});var _0x4a27bc=_0xb4e3('0x22');return db[_0xb4e3('0x23')][_0xb4e3('0x1f')]({'where':{'type':_0x4a27bc,'resourceId':_0x2b6056['id']}})['then'](function(){return _0x497b2e;});})['then'](function(){_0x498cb7[_0xb4e3('0x16')](0xcc)[_0xb4e3('0x24')]();});}};}function handleEntityNotFound(_0x516fd3,_0x1eda12){return function(_0x4dbd03){if(!_0x4dbd03){_0x516fd3[_0xb4e3('0x15')](0x194);}return _0x4dbd03;};}function handleError(_0x332d17,_0x33a087){_0x33a087=_0x33a087||0x1f4;return function(_0x4cca69){logger['error'](_0x4cca69[_0xb4e3('0x25')]);if(_0x4cca69[_0xb4e3('0x26')]){delete _0x4cca69['name'];}_0x332d17[_0xb4e3('0x16')](_0x33a087)[_0xb4e3('0x27')](_0x4cca69);};}exports['index']=function(_0x48ffd6,_0xab9a7b){var _0x171b34={},_0x710853={},_0x4f8108={'count':0x0,'rows':[]};var _0x106d4c=_[_0xb4e3('0x28')](db['Tag'][_0xb4e3('0x29')],function(_0x4f8cb8){return{'name':_0x4f8cb8[_0xb4e3('0x2a')],'type':_0x4f8cb8[_0xb4e3('0x2b')][_0xb4e3('0x2c')]};});_0x710853['model']=_[_0xb4e3('0x28')](_0x106d4c,'name');_0x710853[_0xb4e3('0x2d')]=_['keys'](_0x48ffd6[_0xb4e3('0x2d')]);_0x710853[_0xb4e3('0x2e')]=_['intersection'](_0x710853[_0xb4e3('0x2f')],_0x710853[_0xb4e3('0x2d')]);_0x171b34[_0xb4e3('0x30')]=_[_0xb4e3('0x31')](_0x710853[_0xb4e3('0x2f')],qs[_0xb4e3('0x32')](_0x48ffd6[_0xb4e3('0x2d')]['fields']));_0x171b34[_0xb4e3('0x30')]=_0x171b34[_0xb4e3('0x30')][_0xb4e3('0x33')]?_0x171b34[_0xb4e3('0x30')]:_0x710853[_0xb4e3('0x2f')];if(!_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x34')](_0xb4e3('0x35'))){_0x171b34[_0xb4e3('0x19')]=qs[_0xb4e3('0x19')](_0x48ffd6[_0xb4e3('0x2d')]['limit']);_0x171b34['offset']=qs[_0xb4e3('0x18')](_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x18')]);}_0x171b34['order']=qs['sort'](_0x48ffd6['query'][_0xb4e3('0x36')]);_0x171b34[_0xb4e3('0x37')]=qs[_0xb4e3('0x2e')](_[_0xb4e3('0x38')](_0x48ffd6[_0xb4e3('0x2d')],_0x710853[_0xb4e3('0x2e')]),_0x106d4c);if(_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x39')]){_0x171b34[_0xb4e3('0x37')]=_[_0xb4e3('0x3a')](_0x171b34[_0xb4e3('0x37')],{'$or':_[_0xb4e3('0x28')](_0x106d4c,function(_0x232c6a){if(_0x232c6a[_0xb4e3('0x2b')]!==_0xb4e3('0x3b')){var _0x1d7dc4={};_0x1d7dc4[_0x232c6a[_0xb4e3('0x26')]]={'$like':'%'+_0x48ffd6['query'][_0xb4e3('0x39')]+'%'};return _0x1d7dc4;}})});}_0x171b34=_[_0xb4e3('0x3a')]({},_0x171b34,_0x48ffd6[_0xb4e3('0x3c')]);var _0x5e824f={'where':_0x171b34[_0xb4e3('0x37')]};return db[_0xb4e3('0x3d')][_0xb4e3('0x3e')](_0x5e824f)[_0xb4e3('0x20')](function(_0x4e00b8){_0x4f8108[_0xb4e3('0x3e')]=_0x4e00b8;if(_0x48ffd6[_0xb4e3('0x2d')][_0xb4e3('0x3f')]){_0x171b34[_0xb4e3('0x40')]=[{'all':!![]}];}return db[_0xb4e3('0x3d')][_0xb4e3('0x41')](_0x171b34);})[_0xb4e3('0x20')](function(_0x283cef){_0x4f8108[_0xb4e3('0x42')]=_0x283cef;return _0x4f8108;})['then'](respondWithFilteredResult(_0xab9a7b,_0x171b34))[_0xb4e3('0x43')](handleError(_0xab9a7b,null));};exports[_0xb4e3('0x44')]=function(_0x117ed2,_0x40a508){var _0x589d16={'raw':!![],'where':{'id':_0x117ed2[_0xb4e3('0x45')]['id']}},_0x55d961={};_0x55d961['model']=_[_0xb4e3('0x46')](db[_0xb4e3('0x3d')][_0xb4e3('0x29')]);_0x55d961[_0xb4e3('0x2d')]=_[_0xb4e3('0x46')](_0x117ed2['query']);_0x55d961['filters']=_['intersection'](_0x55d961['model'],_0x55d961[_0xb4e3('0x2d')]);_0x589d16[_0xb4e3('0x30')]=_['intersection'](_0x55d961[_0xb4e3('0x2f')],qs[_0xb4e3('0x32')](_0x117ed2['query'][_0xb4e3('0x32')]));_0x589d16[_0xb4e3('0x30')]=_0x589d16[_0xb4e3('0x30')][_0xb4e3('0x33')]?_0x589d16[_0xb4e3('0x30')]:_0x55d961[_0xb4e3('0x2f')];if(_0x117ed2['query'][_0xb4e3('0x3f')]){_0x589d16[_0xb4e3('0x40')]=[{'all':!![]}];}_0x589d16=_[_0xb4e3('0x3a')]({},_0x589d16,_0x117ed2[_0xb4e3('0x3c')]);return db['Tag'][_0xb4e3('0x47')](_0x589d16)[_0xb4e3('0x20')](handleEntityNotFound(_0x40a508,null))[_0xb4e3('0x20')](respondWithResult(_0x40a508,null))[_0xb4e3('0x43')](handleError(_0x40a508,null));};exports['create']=function(_0x2fc381,_0x7e49e2){return db['Tag'][_0xb4e3('0x48')](_0x2fc381[_0xb4e3('0x49')],{})[_0xb4e3('0x20')](function(_0xae3bcc){var _0x4203a4=_0x2fc381['user'][_0xb4e3('0x21')]({'plain':!![]});if(!_0x4203a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4203a4[_0xb4e3('0x4a')]===_0xb4e3('0x4b')){var _0x40d6e3=_0xae3bcc[_0xb4e3('0x21')]({'plain':!![]});var _0x5e79ce=_0xb4e3('0x22');return db[_0xb4e3('0x4c')]['find']({'where':{'name':_0x5e79ce,'userProfileId':_0x4203a4[_0xb4e3('0x4d')]},'raw':!![]})[_0xb4e3('0x20')](function(_0x21ca34){if(_0x21ca34&&_0x21ca34[_0xb4e3('0x4e')]===0x0){return db[_0xb4e3('0x23')]['create']({'name':_0x40d6e3[_0xb4e3('0x26')],'resourceId':_0x40d6e3['id'],'type':_0x21ca34[_0xb4e3('0x26')],'sectionId':_0x21ca34['id']},{})[_0xb4e3('0x20')](function(){return _0xae3bcc;});}else{return _0xae3bcc;}})[_0xb4e3('0x43')](function(_0x485f0e){logger[_0xb4e3('0x4f')](_0xb4e3('0x50'),_0x485f0e);throw _0x485f0e;});}return _0xae3bcc;})[_0xb4e3('0x20')](respondWithResult(_0x7e49e2,0xc9))['catch'](handleError(_0x7e49e2,null));};exports['update']=function(_0xb83e3,_0x34b083){if(_0xb83e3[_0xb4e3('0x49')]['id']){delete _0xb83e3[_0xb4e3('0x49')]['id'];}return db[_0xb4e3('0x3d')]['find']({'where':{'id':_0xb83e3[_0xb4e3('0x45')]['id']}})[_0xb4e3('0x20')](handleEntityNotFound(_0x34b083,null))[_0xb4e3('0x20')](saveUpdates(_0xb83e3[_0xb4e3('0x49')],null))[_0xb4e3('0x20')](respondWithResult(_0x34b083,null))[_0xb4e3('0x43')](handleError(_0x34b083,null));};exports['destroy']=function(_0x317d59,_0x4fbd32){return db[_0xb4e3('0x3d')][_0xb4e3('0x47')]({'where':{'id':_0x317d59[_0xb4e3('0x45')]['id']}})[_0xb4e3('0x20')](handleEntityNotFound(_0x4fbd32,null))[_0xb4e3('0x20')](removeEntity(_0x4fbd32,null))[_0xb4e3('0x43')](handleError(_0x4fbd32,null));}; \ No newline at end of file +var _0x9f2b=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x9f2b,0xe9));var _0xb9f2=function(_0x35f6a6,_0x1b8d2d){_0x35f6a6=_0x35f6a6-0x0;var _0x1f4882=_0x9f2b[_0x35f6a6];return _0x1f4882;};'use strict';var pdf=require(_0xb9f2('0x0'));var emlformat=require(_0xb9f2('0x1'));var rimraf=require(_0xb9f2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9f2('0x3'));var rp=require(_0xb9f2('0x4'));var moment=require(_0xb9f2('0x5'));var BPromise=require(_0xb9f2('0x6'));var Mustache=require(_0xb9f2('0x7'));var util=require('util');var path=require(_0xb9f2('0x8'));var sox=require(_0xb9f2('0x9'));var csv=require(_0xb9f2('0xa'));var ejs=require(_0xb9f2('0xb'));var fs=require('fs');var _=require(_0xb9f2('0xc'));var squel=require(_0xb9f2('0xd'));var crypto=require(_0xb9f2('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9f2('0xa'));var querystring=require(_0xb9f2('0xf'));var Papa=require(_0xb9f2('0x10'));var Redis=require(_0xb9f2('0x11'));var authService=require(_0xb9f2('0x12'));var qs=require(_0xb9f2('0x13'));var as=require(_0xb9f2('0x14'));var hardwareService=require(_0xb9f2('0x15'));var logger=require('../../config/logger')(_0xb9f2('0x16'));var utils=require(_0xb9f2('0x17'));var config=require(_0xb9f2('0x18'));var licenseUtil=require(_0xb9f2('0x19'));var db=require(_0xb9f2('0x1a'))['db'];function respondWithStatusCode(_0x1b1589,_0x5505cb){_0x5505cb=_0x5505cb||0xcc;return function(_0x300f99){if(_0x300f99){return _0x1b1589[_0xb9f2('0x1b')](_0x5505cb);}return _0x1b1589['status'](_0x5505cb)[_0xb9f2('0x1c')]();};}function respondWithResult(_0x3bd9a1,_0x1ea2b1){_0x1ea2b1=_0x1ea2b1||0xc8;return function(_0x2dcfbe){if(_0x2dcfbe){return _0x3bd9a1[_0xb9f2('0x1d')](_0x1ea2b1)[_0xb9f2('0x1e')](_0x2dcfbe);}};}function respondWithFilteredResult(_0x2090e6,_0x44aa6c){return function(_0x3a6a60){if(_0x3a6a60){var _0x3cf5fa=_0x3a6a60[_0xb9f2('0x1f')],_0x151556=_0x44aa6c[_0xb9f2('0x20')],_0x2a765e=_0x44aa6c['offset']+_0x44aa6c[_0xb9f2('0x21')],_0x3d9857;if(_0x2a765e>=_0x3cf5fa){_0x2a765e=_0x3cf5fa;_0x3d9857=0xc8;}else{_0x3d9857=0xce;}_0x2090e6[_0xb9f2('0x1d')](_0x3d9857);return _0x2090e6[_0xb9f2('0x22')](_0xb9f2('0x23'),_0x151556+'-'+_0x2a765e+'/'+_0x3cf5fa)['json'](_0x3a6a60);}return null;};}function patchUpdates(_0xc39022){return function(_0x365e7a){try{jsonpatch[_0xb9f2('0x24')](_0x365e7a,_0xc39022,!![]);}catch(_0x94acfc){return BPromise[_0xb9f2('0x25')](_0x94acfc);}return _0x365e7a[_0xb9f2('0x26')]();};}function saveUpdates(_0x4dd1be,_0x95e3ce){return function(_0x3c3899){if(_0x3c3899){return _0x3c3899['update'](_0x4dd1be)['then'](function(_0x979a8d){return _0x979a8d;});}return null;};}function removeEntity(_0x4019ef,_0x4d9513){return function(_0x4061f3){if(_0x4061f3){return _0x4061f3[_0xb9f2('0x27')]()[_0xb9f2('0x28')](function(){var _0x1a895f=_0x4061f3[_0xb9f2('0x29')]({'plain':!![]});var _0x4edc08=_0xb9f2('0x2a');return db[_0xb9f2('0x2b')][_0xb9f2('0x27')]({'where':{'type':_0x4edc08,'resourceId':_0x1a895f['id']}})[_0xb9f2('0x28')](function(){return _0x4061f3;});})[_0xb9f2('0x28')](function(){_0x4019ef[_0xb9f2('0x1d')](0xcc)[_0xb9f2('0x1c')]();});}};}function handleEntityNotFound(_0x942121,_0x259ab9){return function(_0x3276e8){if(!_0x3276e8){_0x942121[_0xb9f2('0x1b')](0x194);}return _0x3276e8;};}function handleError(_0x1aa127,_0x296f92){_0x296f92=_0x296f92||0x1f4;return function(_0x33a2d0){logger[_0xb9f2('0x2c')](_0x33a2d0[_0xb9f2('0x2d')]);if(_0x33a2d0[_0xb9f2('0x2e')]){delete _0x33a2d0[_0xb9f2('0x2e')];}_0x1aa127[_0xb9f2('0x1d')](_0x296f92)[_0xb9f2('0x2f')](_0x33a2d0);};}exports['index']=function(_0x1de423,_0x595d68){var _0x3aaed5={},_0x43f100={},_0x5ac5ef={'count':0x0,'rows':[]};var _0x4cd925=_[_0xb9f2('0x30')](db[_0xb9f2('0x31')]['rawAttributes'],function(_0xac4152){return{'name':_0xac4152[_0xb9f2('0x32')],'type':_0xac4152['type']['key']};});_0x43f100['model']=_[_0xb9f2('0x30')](_0x4cd925,_0xb9f2('0x2e'));_0x43f100[_0xb9f2('0x33')]=_[_0xb9f2('0x34')](_0x1de423[_0xb9f2('0x33')]);_0x43f100[_0xb9f2('0x35')]=_[_0xb9f2('0x36')](_0x43f100[_0xb9f2('0x37')],_0x43f100[_0xb9f2('0x33')]);_0x3aaed5[_0xb9f2('0x38')]=_[_0xb9f2('0x36')](_0x43f100[_0xb9f2('0x37')],qs[_0xb9f2('0x39')](_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x39')]));_0x3aaed5[_0xb9f2('0x38')]=_0x3aaed5[_0xb9f2('0x38')][_0xb9f2('0x3a')]?_0x3aaed5['attributes']:_0x43f100[_0xb9f2('0x37')];if(!_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x3b')](_0xb9f2('0x3c'))){_0x3aaed5['limit']=qs[_0xb9f2('0x21')](_0x1de423[_0xb9f2('0x33')]['limit']);_0x3aaed5[_0xb9f2('0x20')]=qs[_0xb9f2('0x20')](_0x1de423[_0xb9f2('0x33')]['offset']);}_0x3aaed5[_0xb9f2('0x3d')]=qs['sort'](_0x1de423['query'][_0xb9f2('0x3e')]);_0x3aaed5[_0xb9f2('0x3f')]=qs['filters'](_[_0xb9f2('0x40')](_0x1de423[_0xb9f2('0x33')],_0x43f100[_0xb9f2('0x35')]),_0x4cd925);if(_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x41')]){_0x3aaed5['where']=_[_0xb9f2('0x42')](_0x3aaed5['where'],{'$or':_['map'](_0x4cd925,function(_0x35d1f9){if(_0x35d1f9['type']!==_0xb9f2('0x43')){var _0x396790={};_0x396790[_0x35d1f9[_0xb9f2('0x2e')]]={'$like':'%'+_0x1de423[_0xb9f2('0x33')][_0xb9f2('0x41')]+'%'};return _0x396790;}})});}_0x3aaed5=_[_0xb9f2('0x42')]({},_0x3aaed5,_0x1de423[_0xb9f2('0x44')]);var _0x186812={'where':_0x3aaed5[_0xb9f2('0x3f')]};return db[_0xb9f2('0x31')][_0xb9f2('0x1f')](_0x186812)['then'](function(_0x286c20){_0x5ac5ef['count']=_0x286c20;if(_0x1de423[_0xb9f2('0x33')]['includeAll']){_0x3aaed5[_0xb9f2('0x45')]=[{'all':!![]}];}return db[_0xb9f2('0x31')][_0xb9f2('0x46')](_0x3aaed5);})[_0xb9f2('0x28')](function(_0x1ea34c){_0x5ac5ef[_0xb9f2('0x47')]=_0x1ea34c;return _0x5ac5ef;})[_0xb9f2('0x28')](respondWithFilteredResult(_0x595d68,_0x3aaed5))[_0xb9f2('0x48')](handleError(_0x595d68,null));};exports['show']=function(_0x21956f,_0x50155d){var _0x257a21={'raw':!![],'where':{'id':_0x21956f[_0xb9f2('0x49')]['id']}},_0x54c038={};_0x54c038[_0xb9f2('0x37')]=_['keys'](db[_0xb9f2('0x31')][_0xb9f2('0x4a')]);_0x54c038[_0xb9f2('0x33')]=_[_0xb9f2('0x34')](_0x21956f['query']);_0x54c038[_0xb9f2('0x35')]=_[_0xb9f2('0x36')](_0x54c038[_0xb9f2('0x37')],_0x54c038[_0xb9f2('0x33')]);_0x257a21[_0xb9f2('0x38')]=_[_0xb9f2('0x36')](_0x54c038[_0xb9f2('0x37')],qs['fields'](_0x21956f[_0xb9f2('0x33')]['fields']));_0x257a21[_0xb9f2('0x38')]=_0x257a21[_0xb9f2('0x38')][_0xb9f2('0x3a')]?_0x257a21['attributes']:_0x54c038[_0xb9f2('0x37')];if(_0x21956f['query']['includeAll']){_0x257a21[_0xb9f2('0x45')]=[{'all':!![]}];}_0x257a21=_[_0xb9f2('0x42')]({},_0x257a21,_0x21956f[_0xb9f2('0x44')]);return db[_0xb9f2('0x31')]['find'](_0x257a21)[_0xb9f2('0x28')](handleEntityNotFound(_0x50155d,null))[_0xb9f2('0x28')](respondWithResult(_0x50155d,null))[_0xb9f2('0x48')](handleError(_0x50155d,null));};exports[_0xb9f2('0x4b')]=function(_0x3b7f61,_0x503607){return db['Tag']['create'](_0x3b7f61[_0xb9f2('0x4c')],{})[_0xb9f2('0x28')](function(_0xc31c65){var _0x301ab1=_0x3b7f61['user']['get']({'plain':!![]});if(!_0x301ab1)throw new Error(_0xb9f2('0x4d'));if(_0x301ab1['role']===_0xb9f2('0x4e')){var _0x5dfce3=_0xc31c65['get']({'plain':!![]});var _0x285843=_0xb9f2('0x2a');return db[_0xb9f2('0x4f')]['find']({'where':{'name':_0x285843,'userProfileId':_0x301ab1[_0xb9f2('0x50')]},'raw':!![]})[_0xb9f2('0x28')](function(_0x23d5e3){if(_0x23d5e3&&_0x23d5e3[_0xb9f2('0x51')]===0x0){return db['UserProfileResource'][_0xb9f2('0x4b')]({'name':_0x5dfce3['name'],'resourceId':_0x5dfce3['id'],'type':_0x23d5e3[_0xb9f2('0x2e')],'sectionId':_0x23d5e3['id']},{})[_0xb9f2('0x28')](function(){return _0xc31c65;});}else{return _0xc31c65;}})[_0xb9f2('0x48')](function(_0x2a843f){logger[_0xb9f2('0x2c')](_0xb9f2('0x52'),_0x2a843f);throw _0x2a843f;});}return _0xc31c65;})[_0xb9f2('0x28')](respondWithResult(_0x503607,0xc9))[_0xb9f2('0x48')](handleError(_0x503607,null));};exports[_0xb9f2('0x53')]=function(_0x123ff7,_0x13b39a){if(_0x123ff7['body']['id']){delete _0x123ff7[_0xb9f2('0x4c')]['id'];}return db['Tag'][_0xb9f2('0x54')]({'where':{'id':_0x123ff7[_0xb9f2('0x49')]['id']}})[_0xb9f2('0x28')](handleEntityNotFound(_0x13b39a,null))[_0xb9f2('0x28')](saveUpdates(_0x123ff7[_0xb9f2('0x4c')],null))[_0xb9f2('0x28')](respondWithResult(_0x13b39a,null))[_0xb9f2('0x48')](handleError(_0x13b39a,null));};exports[_0xb9f2('0x27')]=function(_0xeb30d,_0xe4d878){return db[_0xb9f2('0x31')][_0xb9f2('0x54')]({'where':{'id':_0xeb30d[_0xb9f2('0x49')]['id']}})[_0xb9f2('0x28')](handleEntityNotFound(_0xe4d878,null))[_0xb9f2('0x28')](removeEntity(_0xe4d878,null))['catch'](handleError(_0xe4d878,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 6f3af54..3898d8c 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 _0x009e=['../../config/logger','api','moment','request-promise','rimraf','./tag.attributes','exports','Tag','tools_tags','lodash','util'];(function(_0x59622b,_0x5cba34){var _0x2edf4b=function(_0x729c0a){while(--_0x729c0a){_0x59622b['push'](_0x59622b['shift']());}};_0x2edf4b(++_0x5cba34);}(_0x009e,0x11c));var _0xe009=function(_0x285d03,_0x12c298){_0x285d03=_0x285d03-0x0;var _0x4a9ec8=_0x009e[_0x285d03];return _0x4a9ec8;};'use strict';var _=require(_0xe009('0x0'));var util=require(_0xe009('0x1'));var logger=require(_0xe009('0x2'))(_0xe009('0x3'));var moment=require(_0xe009('0x4'));var BPromise=require('bluebird');var rp=require(_0xe009('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe009('0x6'));var config=require('../../config/environment');var attributes=require(_0xe009('0x7'));module[_0xe009('0x8')]=function(_0x49d0aa,_0x4091ca){return _0x49d0aa['define'](_0xe009('0x9'),attributes,{'tableName':_0xe009('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6e4=['tools_tags','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','define','Tag'];(function(_0x165abf,_0x1c8df5){var _0x25d167=function(_0x1bd1f0){while(--_0x1bd1f0){_0x165abf['push'](_0x165abf['shift']());}};_0x25d167(++_0x1c8df5);}(_0xe6e4,0x139));var _0x4e6e=function(_0x1d53b0,_0x42145e){_0x1d53b0=_0x1d53b0-0x0;var _0x11cf0f=_0xe6e4[_0x1d53b0];return _0x11cf0f;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var logger=require('../../config/logger')(_0x4e6e('0x2'));var moment=require(_0x4e6e('0x3'));var BPromise=require(_0x4e6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e6e('0x5'));var rimraf=require(_0x4e6e('0x6'));var config=require(_0x4e6e('0x7'));var attributes=require(_0x4e6e('0x8'));module['exports']=function(_0x439090,_0x248b61){return _0x439090[_0x4e6e('0x9')](_0x4e6e('0xa'),attributes,{'tableName':_0x4e6e('0xb'),'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 5ea07fc..0b3dbe4 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 _0x5ec6=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','debug'];(function(_0x3d8c28,_0x5b7233){var _0x409a65=function(_0x43ef27){while(--_0x43ef27){_0x3d8c28['push'](_0x3d8c28['shift']());}};_0x409a65(++_0x5b7233);}(_0x5ec6,0x7f));var _0x65ec=function(_0x511a6a,_0x3dac82){_0x511a6a=_0x511a6a-0x0;var _0x5a248d=_0x5ec6[_0x511a6a];return _0x5a248d;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('Tag,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});} \ 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(_0x26e9ff,_0x335566){var _0x5018d7=function(_0x61810b){while(--_0x61810b){_0x26e9ff['push'](_0x26e9ff['shift']());}};_0x5018d7(++_0x335566);}(_0x41bb,0xc5));var _0xb41b=function(_0x4353b9,_0x1e8c39){_0x4353b9=_0x4353b9-0x0;var _0x4ccfa3=_0x41bb[_0x4353b9];return _0x4ccfa3;};'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 a591809..21e4871 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 _0x148f=['put','/:id','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','./team.controller','isAuthenticated','index','get','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x148f,0xf2));var _0xf148=function(_0x3b2165,_0x5455ef){_0x3b2165=_0x3b2165-0x0;var _0x361ed8=_0x148f[_0x3b2165];return _0x361ed8;};'use strict';var multer=require(_0xf148('0x0'));var util=require(_0xf148('0x1'));var path=require(_0xf148('0x2'));var timeout=require(_0xf148('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf148('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf148('0x5'));router['get']('/',auth[_0xf148('0x6')](),controller[_0xf148('0x7')]);router[_0xf148('0x8')]('/:id',auth[_0xf148('0x6')](),controller[_0xf148('0x9')]);router[_0xf148('0x8')](_0xf148('0xa'),auth['isAuthenticated'](),controller[_0xf148('0xb')]);router['get'](_0xf148('0xc'),auth[_0xf148('0x6')](),controller[_0xf148('0xd')]);router[_0xf148('0xe')]('/',auth[_0xf148('0x6')](),controller[_0xf148('0xf')]);router['post'](_0xf148('0xa'),auth[_0xf148('0x6')](),controller[_0xf148('0x10')]);router[_0xf148('0xe')](_0xf148('0xc'),auth[_0xf148('0x6')](),controller[_0xf148('0x11')]);router[_0xf148('0x12')](_0xf148('0x13'),auth['isAuthenticated'](),controller[_0xf148('0x14')]);router[_0xf148('0x15')](_0xf148('0x13'),auth['isAuthenticated'](),controller[_0xf148('0x16')]);router[_0xf148('0x15')](_0xf148('0xa'),auth['isAuthenticated'](),controller[_0xf148('0x17')]);router[_0xf148('0x15')](_0xf148('0xc'),auth[_0xf148('0x6')](),controller[_0xf148('0x18')]);module[_0xf148('0x19')]=router; \ No newline at end of file +var _0xf3bc=['index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','addQueues','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x34ae7d,_0x359c6f){var _0x5d4f3d=function(_0x2701c7){while(--_0x2701c7){_0x34ae7d['push'](_0x34ae7d['shift']());}};_0x5d4f3d(++_0x359c6f);}(_0xf3bc,0x13b));var _0xcf3b=function(_0x1a4a9a,_0x500630){_0x1a4a9a=_0x1a4a9a-0x0;var _0x40a449=_0xf3bc[_0x1a4a9a];return _0x40a449;};'use strict';var multer=require(_0xcf3b('0x0'));var util=require(_0xcf3b('0x1'));var path=require(_0xcf3b('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf3b('0x3'));var router=express[_0xcf3b('0x4')]();var auth=require(_0xcf3b('0x5'));var interaction=require(_0xcf3b('0x6'));var config=require(_0xcf3b('0x7'));var controller=require('./team.controller');router[_0xcf3b('0x8')]('/',auth[_0xcf3b('0x9')](),controller[_0xcf3b('0xa')]);router[_0xcf3b('0x8')](_0xcf3b('0xb'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0xc')]);router['get'](_0xcf3b('0xd'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0xe')]);router['get'](_0xcf3b('0xf'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0x10')]);router[_0xcf3b('0x11')]('/',auth[_0xcf3b('0x9')](),controller['create']);router[_0xcf3b('0x11')]('/:id/queues',auth[_0xcf3b('0x9')](),controller[_0xcf3b('0x12')]);router[_0xcf3b('0x11')](_0xcf3b('0xf'),auth['isAuthenticated'](),controller[_0xcf3b('0x13')]);router[_0xcf3b('0x14')]('/:id',auth[_0xcf3b('0x9')](),controller['update']);router[_0xcf3b('0x15')](_0xcf3b('0xb'),auth['isAuthenticated'](),controller[_0xcf3b('0x16')]);router[_0xcf3b('0x15')](_0xcf3b('0xd'),auth[_0xcf3b('0x9')](),controller['removeQueues']);router[_0xcf3b('0x15')](_0xcf3b('0xf'),auth[_0xcf3b('0x9')](),controller[_0xcf3b('0x17')]);module[_0xcf3b('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 1049248..94191d5 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 _0x5c8b=['exports','STRING','name','sequelize'];(function(_0x4a8c57,_0x419a69){var _0x3b1d79=function(_0x287baf){while(--_0x287baf){_0x4a8c57['push'](_0x4a8c57['shift']());}};_0x3b1d79(++_0x419a69);}(_0x5c8b,0x97));var _0xb5c8=function(_0x33e5c1,_0x1c9ea3){_0x33e5c1=_0x33e5c1-0x0;var _0x3edda9=_0x5c8b[_0x33e5c1];return _0x3edda9;};'use strict';var Sequelize=require(_0xb5c8('0x0'));module[_0xb5c8('0x1')]={'name':{'type':Sequelize[_0xb5c8('0x2')],'allowNull':![],'unique':_0xb5c8('0x3')},'description':{'type':Sequelize[_0xb5c8('0x2')]}}; \ No newline at end of file +var _0x5acd=['sequelize','STRING','name'];(function(_0x42b67b,_0x23bca1){var _0x5e1cb2=function(_0x28a266){while(--_0x28a266){_0x42b67b['push'](_0x42b67b['shift']());}};_0x5e1cb2(++_0x23bca1);}(_0x5acd,0xe4));var _0xd5ac=function(_0xd16d89,_0x1af913){_0xd16d89=_0xd16d89-0x0;var _0x2a3a16=_0x5acd[_0xd16d89];return _0x2a3a16;};'use strict';var Sequelize=require(_0xd5ac('0x0'));module['exports']={'name':{'type':Sequelize[_0xd5ac('0x1')],'allowNull':![],'unique':_0xd5ac('0x2')},'description':{'type':Sequelize[_0xd5ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 688e196..5923512 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 _0xa4c6=['each','chat','mail','sms','whatsapp','voice','isArray','emit','userTeam:remove','getAgents','User','html-pdf','zip-dir','fast-json-patch','request-promise','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','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','addQueues','add','ids','removeQueues','Queues','Chat','Sms','Fax','Openchannel','addAgents','Voice','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','omit','spread','userTeam:save','removeAgents'];(function(_0x3b0d35,_0x29fd12){var _0xbb303f=function(_0x331757){while(--_0x331757){_0x3b0d35['push'](_0x3b0d35['shift']());}};_0xbb303f(++_0x29fd12);}(_0xa4c6,0x8f));var _0x6a4c=function(_0x4329cf,_0x1258ba){_0x4329cf=_0x4329cf-0x0;var _0x30fe54=_0xa4c6[_0x4329cf];return _0x30fe54;};'use strict';var pdf=require(_0x6a4c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a4c('0x1'));var jsonpatch=require(_0x6a4c('0x2'));var rp=require(_0x6a4c('0x3'));var moment=require('moment');var BPromise=require(_0x6a4c('0x4'));var Mustache=require(_0x6a4c('0x5'));var util=require(_0x6a4c('0x6'));var path=require(_0x6a4c('0x7'));var sox=require(_0x6a4c('0x8'));var csv=require(_0x6a4c('0x9'));var ejs=require(_0x6a4c('0xa'));var fs=require('fs');var _=require(_0x6a4c('0xb'));var squel=require(_0x6a4c('0xc'));var crypto=require(_0x6a4c('0xd'));var jsforce=require(_0x6a4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a4c('0x9'));var querystring=require('querystring');var Papa=require(_0x6a4c('0xf'));var Redis=require(_0x6a4c('0x10'));var authService=require(_0x6a4c('0x11'));var qs=require(_0x6a4c('0x12'));var as=require(_0x6a4c('0x13'));var hardwareService=require(_0x6a4c('0x14'));var logger=require(_0x6a4c('0x15'))(_0x6a4c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a4c('0x17'))['db'];config['redis']=_['defaults'](config[_0x6a4c('0x18')],{'host':_0x6a4c('0x19'),'port':0x18eb});var socket=require(_0x6a4c('0x1a'))(new Redis(config[_0x6a4c('0x18')]));require(_0x6a4c('0x1b'))['register'](socket);function respondWithStatusCode(_0x7c8592,_0x42f60b){_0x42f60b=_0x42f60b||0xcc;return function(_0x3a48b2){if(_0x3a48b2){return _0x7c8592[_0x6a4c('0x1c')](_0x42f60b);}return _0x7c8592[_0x6a4c('0x1d')](_0x42f60b)[_0x6a4c('0x1e')]();};}function respondWithResult(_0x18e831,_0x164a91){_0x164a91=_0x164a91||0xc8;return function(_0x21927f){if(_0x21927f){return _0x18e831[_0x6a4c('0x1d')](_0x164a91)[_0x6a4c('0x1f')](_0x21927f);}};}function respondWithFilteredResult(_0x2e5498,_0x142720){return function(_0xc700c){if(_0xc700c){var _0x39c4c9=_0xc700c[_0x6a4c('0x20')],_0x470e85=_0x142720[_0x6a4c('0x21')],_0x3fa985=_0x142720[_0x6a4c('0x21')]+_0x142720['limit'],_0x37d483;if(_0x3fa985>=_0x39c4c9){_0x3fa985=_0x39c4c9;_0x37d483=0xc8;}else{_0x37d483=0xce;}_0x2e5498['status'](_0x37d483);return _0x2e5498[_0x6a4c('0x22')](_0x6a4c('0x23'),_0x470e85+'-'+_0x3fa985+'/'+_0x39c4c9)[_0x6a4c('0x1f')](_0xc700c);}return null;};}function patchUpdates(_0xfc9347){return function(_0x1dea49){try{jsonpatch['apply'](_0x1dea49,_0xfc9347,!![]);}catch(_0x18b1b8){return BPromise['reject'](_0x18b1b8);}return _0x1dea49[_0x6a4c('0x24')]();};}function saveUpdates(_0x218f8c,_0x2010ad){return function(_0x311f7){if(_0x311f7){return _0x311f7[_0x6a4c('0x25')](_0x218f8c)[_0x6a4c('0x26')](function(_0x4859b3){return _0x4859b3;});}return null;};}function removeEntity(_0x31f81d,_0x1e42b7){return function(_0x1f8aff){if(_0x1f8aff){return _0x1f8aff['destroy']()[_0x6a4c('0x26')](function(){var _0x47bb4f=_0x1f8aff[_0x6a4c('0x27')]({'plain':!![]});var _0x4cdb73=_0x6a4c('0x28');return db[_0x6a4c('0x29')]['destroy']({'where':{'type':_0x4cdb73,'resourceId':_0x47bb4f['id']}})[_0x6a4c('0x26')](function(){return _0x1f8aff;});})[_0x6a4c('0x26')](function(){_0x31f81d['status'](0xcc)[_0x6a4c('0x1e')]();});}};}function handleEntityNotFound(_0x237ef3,_0x8649cc){return function(_0xb75702){if(!_0xb75702){_0x237ef3['sendStatus'](0x194);}return _0xb75702;};}function handleError(_0x325866,_0x473944){_0x473944=_0x473944||0x1f4;return function(_0x26a938){logger[_0x6a4c('0x2a')](_0x26a938[_0x6a4c('0x2b')]);if(_0x26a938[_0x6a4c('0x2c')]){delete _0x26a938[_0x6a4c('0x2c')];}_0x325866['status'](_0x473944)[_0x6a4c('0x2d')](_0x26a938);};}exports[_0x6a4c('0x2e')]=function(_0x2b2678,_0x4b09fb){var _0x161b58={},_0x159cc7={},_0x1a8d35={'count':0x0,'rows':[]};var _0xc9dff0=_[_0x6a4c('0x2f')](db[_0x6a4c('0x30')][_0x6a4c('0x31')],function(_0x13373b){return{'name':_0x13373b[_0x6a4c('0x32')],'type':_0x13373b[_0x6a4c('0x33')][_0x6a4c('0x34')]};});_0x159cc7[_0x6a4c('0x35')]=_['map'](_0xc9dff0,_0x6a4c('0x2c'));_0x159cc7[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x2b2678[_0x6a4c('0x36')]);_0x159cc7['filters']=_[_0x6a4c('0x38')](_0x159cc7[_0x6a4c('0x35')],_0x159cc7[_0x6a4c('0x36')]);_0x161b58['attributes']=_[_0x6a4c('0x38')](_0x159cc7[_0x6a4c('0x35')],qs['fields'](_0x2b2678[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x161b58[_0x6a4c('0x3a')]=_0x161b58['attributes'][_0x6a4c('0x3b')]?_0x161b58['attributes']:_0x159cc7[_0x6a4c('0x35')];if(!_0x2b2678['query'][_0x6a4c('0x3c')](_0x6a4c('0x3d'))){_0x161b58[_0x6a4c('0x3e')]=qs['limit'](_0x2b2678[_0x6a4c('0x36')][_0x6a4c('0x3e')]);_0x161b58['offset']=qs[_0x6a4c('0x21')](_0x2b2678['query']['offset']);}_0x161b58[_0x6a4c('0x3f')]=qs[_0x6a4c('0x40')](_0x2b2678['query'][_0x6a4c('0x40')]);_0x161b58[_0x6a4c('0x41')]=qs[_0x6a4c('0x42')](_[_0x6a4c('0x43')](_0x2b2678[_0x6a4c('0x36')],_0x159cc7['filters']),_0xc9dff0);if(_0x2b2678['query'][_0x6a4c('0x44')]){_0x161b58[_0x6a4c('0x41')]=_[_0x6a4c('0x45')](_0x161b58[_0x6a4c('0x41')],{'$or':_['map'](_0xc9dff0,function(_0xb99590){if(_0xb99590[_0x6a4c('0x33')]!==_0x6a4c('0x46')){var _0x2f4574={};_0x2f4574[_0xb99590['name']]={'$like':'%'+_0x2b2678[_0x6a4c('0x36')]['filter']+'%'};return _0x2f4574;}})});}_0x161b58=_[_0x6a4c('0x45')]({},_0x161b58,_0x2b2678['options']);var _0x425dc7={'where':_0x161b58['where']};return db[_0x6a4c('0x30')][_0x6a4c('0x20')](_0x425dc7)[_0x6a4c('0x26')](function(_0x3f623b){_0x1a8d35[_0x6a4c('0x20')]=_0x3f623b;if(_0x2b2678[_0x6a4c('0x36')][_0x6a4c('0x47')]){_0x161b58[_0x6a4c('0x48')]=[{'all':!![]}];}return db[_0x6a4c('0x30')][_0x6a4c('0x49')](_0x161b58);})['then'](function(_0x21718a){_0x1a8d35['rows']=_0x21718a;return _0x1a8d35;})[_0x6a4c('0x26')](respondWithFilteredResult(_0x4b09fb,_0x161b58))['catch'](handleError(_0x4b09fb,null));};exports[_0x6a4c('0x4a')]=function(_0x574593,_0x4e659d){var _0x1a5e84={'raw':![],'where':{'id':_0x574593['params']['id']}},_0x31b2c8={};_0x31b2c8[_0x6a4c('0x35')]=_[_0x6a4c('0x37')](db[_0x6a4c('0x30')][_0x6a4c('0x31')]);_0x31b2c8[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x574593[_0x6a4c('0x36')]);_0x31b2c8['filters']=_[_0x6a4c('0x38')](_0x31b2c8[_0x6a4c('0x35')],_0x31b2c8[_0x6a4c('0x36')]);_0x1a5e84[_0x6a4c('0x3a')]=_[_0x6a4c('0x38')](_0x31b2c8[_0x6a4c('0x35')],qs[_0x6a4c('0x39')](_0x574593[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x1a5e84['attributes']=_0x1a5e84['attributes'][_0x6a4c('0x3b')]?_0x1a5e84[_0x6a4c('0x3a')]:_0x31b2c8[_0x6a4c('0x35')];if(_0x574593['query']['includeAll']){_0x1a5e84[_0x6a4c('0x48')]=[{'all':!![]}];}_0x1a5e84=_[_0x6a4c('0x45')]({},_0x1a5e84,_0x574593[_0x6a4c('0x4b')]);return db[_0x6a4c('0x30')]['find'](_0x1a5e84)[_0x6a4c('0x26')](handleEntityNotFound(_0x4e659d,null))[_0x6a4c('0x26')](respondWithResult(_0x4e659d,null))['catch'](handleError(_0x4e659d,null));};exports[_0x6a4c('0x4c')]=function(_0xe5300e,_0x369beb){return db['Team'][_0x6a4c('0x4c')](_0xe5300e[_0x6a4c('0x4d')],{})['then'](function(_0x45cf47){var _0x102a1f=_0xe5300e[_0x6a4c('0x4e')][_0x6a4c('0x27')]({'plain':!![]});if(!_0x102a1f)throw new Error(_0x6a4c('0x4f'));if(_0x102a1f[_0x6a4c('0x50')]===_0x6a4c('0x4e')){var _0x24678c=_0x45cf47[_0x6a4c('0x27')]({'plain':!![]});var _0x3cce16=_0x6a4c('0x28');return db[_0x6a4c('0x51')][_0x6a4c('0x52')]({'where':{'name':_0x3cce16,'userProfileId':_0x102a1f[_0x6a4c('0x53')]},'raw':!![]})[_0x6a4c('0x26')](function(_0x2452ff){if(_0x2452ff&&_0x2452ff[_0x6a4c('0x54')]===0x0){return db[_0x6a4c('0x29')][_0x6a4c('0x4c')]({'name':_0x24678c[_0x6a4c('0x2c')],'resourceId':_0x24678c['id'],'type':_0x2452ff['name'],'sectionId':_0x2452ff['id']},{})[_0x6a4c('0x26')](function(){return _0x45cf47;});}else{return _0x45cf47;}})[_0x6a4c('0x55')](function(_0x3dbc42){logger[_0x6a4c('0x2a')](_0x6a4c('0x56'),_0x3dbc42);throw _0x3dbc42;});}return _0x45cf47;})['then'](respondWithResult(_0x369beb,0xc9))[_0x6a4c('0x55')](handleError(_0x369beb,null));};exports[_0x6a4c('0x25')]=function(_0x169705,_0x58a8c5){if(_0x169705[_0x6a4c('0x4d')]['id']){delete _0x169705[_0x6a4c('0x4d')]['id'];}return db[_0x6a4c('0x30')]['find']({'where':{'id':_0x169705[_0x6a4c('0x57')]['id']}})['then'](handleEntityNotFound(_0x58a8c5,null))[_0x6a4c('0x26')](saveUpdates(_0x169705[_0x6a4c('0x4d')],null))['then'](respondWithResult(_0x58a8c5,null))[_0x6a4c('0x55')](handleError(_0x58a8c5,null));};exports[_0x6a4c('0x58')]=function(_0x117a6a,_0x329d71){return db['Team'][_0x6a4c('0x52')]({'where':{'id':_0x117a6a['params']['id']}})['then'](handleEntityNotFound(_0x329d71,null))[_0x6a4c('0x26')](removeEntity(_0x329d71,null))[_0x6a4c('0x55')](handleError(_0x329d71,null));};exports[_0x6a4c('0x59')]=function(_0x4b8771,_0xbc5ae6,_0x5bbedd){return db[_0x6a4c('0x30')][_0x6a4c('0x5a')]({'where':{'id':_0x4b8771[_0x6a4c('0x57')]['id']}})[_0x6a4c('0x26')](handleEntityNotFound(_0xbc5ae6,null))[_0x6a4c('0x26')](function(_0x1ae1f8){if(!_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x5b')]||!utils[_0x6a4c('0x5c')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x5b')])){throw new db[(_0x6a4c('0x5d'))][(_0x6a4c('0x5e'))](_0x6a4c('0x5f'));}var _0x928e0b={};var _0x247bf0={};_0x247bf0[_0x6a4c('0x35')]=_[_0x6a4c('0x37')](db[_[_0x6a4c('0x60')](_0x4b8771[_0x6a4c('0x36')]['channel']['toLowerCase']())+_0x6a4c('0x61')][_0x6a4c('0x31')]);_0x247bf0[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x4b8771[_0x6a4c('0x36')]);_0x247bf0[_0x6a4c('0x42')]=_['intersection'](_0x247bf0['model'],_0x247bf0[_0x6a4c('0x36')]);_0x928e0b[_0x6a4c('0x3a')]=_[_0x6a4c('0x38')](_0x247bf0['model'],qs[_0x6a4c('0x39')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x928e0b[_0x6a4c('0x3a')]=_0x928e0b['attributes'][_0x6a4c('0x3b')]?_0x928e0b[_0x6a4c('0x3a')]:_0x247bf0[_0x6a4c('0x35')];_0x928e0b['limit']=qs[_0x6a4c('0x3e')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x3e')]);_0x928e0b[_0x6a4c('0x21')]=qs['offset'](_0x4b8771['query']['offset']);_0x928e0b[_0x6a4c('0x3f')]=qs[_0x6a4c('0x40')](_0x4b8771[_0x6a4c('0x36')][_0x6a4c('0x40')]);_0x928e0b[_0x6a4c('0x41')]=qs['filters'](_[_0x6a4c('0x43')](_0x4b8771['query'],_0x247bf0[_0x6a4c('0x42')]));_0x928e0b=_[_0x6a4c('0x45')]({},_0x928e0b,_0x4b8771[_0x6a4c('0x4b')]);return _0x1ae1f8['get'+_[_0x6a4c('0x60')](_0x4b8771[_0x6a4c('0x36')]['channel'][_0x6a4c('0x62')]())+'Queues'](_0x928e0b);})['then'](respondWithResult(_0xbc5ae6,null))[_0x6a4c('0x55')](handleError(_0xbc5ae6,null));};exports[_0x6a4c('0x63')]=function(_0x5d7b06,_0x337c8c,_0x18df53){return db['Team'][_0x6a4c('0x5a')]({'where':{'id':_0x5d7b06[_0x6a4c('0x57')]['id']}})[_0x6a4c('0x26')](function(_0x4c42e0){if(_0x4c42e0){if(!_0x5d7b06[_0x6a4c('0x4d')]['channel']||!utils[_0x6a4c('0x5c')](_0x5d7b06[_0x6a4c('0x4d')]['channel'])){throw new db[(_0x6a4c('0x5d'))][(_0x6a4c('0x5e'))]('Unknown\x20channel');}return _0x4c42e0[_0x6a4c('0x64')+_['capitalize'](_0x5d7b06[_0x6a4c('0x4d')][_0x6a4c('0x5b')]['toLowerCase']())+'Queues'](_0x5d7b06[_0x6a4c('0x4d')][_0x6a4c('0x65')]);}return null;})[_0x6a4c('0x26')](handleEntityNotFound(_0x337c8c,null))[_0x6a4c('0x26')](respondWithStatusCode(_0x337c8c,null))[_0x6a4c('0x55')](handleError(_0x337c8c,null));};exports[_0x6a4c('0x66')]=function(_0x152361,_0x159f29,_0x21c57c){return db[_0x6a4c('0x30')]['findOne']({'where':{'id':_0x152361[_0x6a4c('0x57')]['id']}})['then'](function(_0x3188d7){if(_0x3188d7){if(!_0x152361['query'][_0x6a4c('0x5b')]||!utils[_0x6a4c('0x5c')](_0x152361[_0x6a4c('0x36')]['channel'])){throw new db[(_0x6a4c('0x5d'))]['ValidationError'](_0x6a4c('0x5f'));}return _0x3188d7['remove'+_[_0x6a4c('0x60')](_0x152361[_0x6a4c('0x36')][_0x6a4c('0x5b')][_0x6a4c('0x62')]())+_0x6a4c('0x67')](_0x152361[_0x6a4c('0x36')]['ids']);}return null;})['then'](handleEntityNotFound(_0x159f29,null))[_0x6a4c('0x26')](respondWithStatusCode(_0x159f29,null))[_0x6a4c('0x55')](handleError(_0x159f29,null));};exports['addAgents']=function(_0x4c4eb7,_0x589fce,_0x3615f2){return db[_0x6a4c('0x30')][_0x6a4c('0x52')]({'where':{'id':_0x4c4eb7[_0x6a4c('0x57')]['id']}})['then'](handleEntityNotFound(_0x589fce,null))['then'](function(_0xfe957e){if(_0xfe957e){var _0x1700b3=['Voice',_0x6a4c('0x68'),'Mail',_0x6a4c('0x69'),_0x6a4c('0x6a'),_0x6a4c('0x6b'),'Whatsapp'];return BPromise['each'](_0x1700b3,function(_0x744e7c){return _0xfe957e[_0x6a4c('0x27')+_0x744e7c+_0x6a4c('0x67')]({'attributes':['id','name']})[_0x6a4c('0x26')](function(_0x397b1e){return BPromise['each'](_0x397b1e,function(_0x3f4bfb){return _0x3f4bfb[_0x6a4c('0x6c')](_0x4c4eb7[_0x6a4c('0x4d')][_0x6a4c('0x65')])['then'](function(){if(_0x744e7c===_0x6a4c('0x6d')){return db['User'][_0x6a4c('0x49')]({'where':{'id':_0x4c4eb7['body'][_0x6a4c('0x65')]},'attributes':['id',_0x6a4c('0x2c'),_0x6a4c('0x6e'),_0x6a4c('0x6f'),_0x6a4c('0x70')],'raw':!![]})[_0x6a4c('0x26')](function(_0x3f3ce4){return BPromise['each'](_['filter'](_0x3f3ce4,{'online':0x1}),function(_0x3bd148){return db[_0x6a4c('0x71')]['upsert']({'membername':_0x3bd148[_0x6a4c('0x2c')],'UserId':_0x3bd148['id'],'queue_name':_0x3f4bfb[_0x6a4c('0x2c')],'VoiceQueueId':_0x3f4bfb['id'],'interface':_[_0x6a4c('0x72')](_0x3bd148[_0x6a4c('0x70')])?util[_0x6a4c('0x73')](_0x6a4c('0x74'),_0x3bd148['name']):_0x3bd148[_0x6a4c('0x70')],'paused':_0x3bd148[_0x6a4c('0x6f')]||![],'penalty':0x0});});});}});});})[_0x6a4c('0x26')](function(){return _0xfe957e;});})[_0x6a4c('0x26')](function(){return _0xfe957e;});}})[_0x6a4c('0x26')](function(_0x1e3051){if(_0x1e3051){return _0x1e3051[_0x6a4c('0x6c')](_0x4c4eb7[_0x6a4c('0x4d')][_0x6a4c('0x65')],_[_0x6a4c('0x75')](_0x4c4eb7[_0x6a4c('0x4d')],[_0x6a4c('0x65'),'id'])||{})[_0x6a4c('0x76')](function(_0x13e94c){for(var _0x46dbd0=0x0;_0x46dbd0<_0x4c4eb7[_0x6a4c('0x4d')]['ids'][_0x6a4c('0x3b')];_0x46dbd0+=0x1){socket['emit'](_0x6a4c('0x77'),{'UserId':_0x4c4eb7[_0x6a4c('0x4d')]['ids'][_0x46dbd0],'TeamId':_0x4c4eb7['params']['id']});}return _0x13e94c;});}})['then'](respondWithResult(_0x589fce,null))[_0x6a4c('0x55')](handleError(_0x589fce,null));};exports[_0x6a4c('0x78')]=function(_0x129ac8,_0x5af19b,_0x4499d2){return db['Team'][_0x6a4c('0x52')]({'where':{'id':_0x129ac8['params']['id']}})[_0x6a4c('0x26')](handleEntityNotFound(_0x5af19b,null))[_0x6a4c('0x26')](function(_0x5d46a1){if(_0x5d46a1){return BPromise[_0x6a4c('0x79')](['voice',_0x6a4c('0x7a'),_0x6a4c('0x7b'),_0x6a4c('0x7c'),'fax','openchannel',_0x6a4c('0x7d')],function(_0x422a6d){return _0x5d46a1[_0x6a4c('0x27')+_[_0x6a4c('0x60')](_0x422a6d)+_0x6a4c('0x67')]({'attributes':['id',_0x6a4c('0x2c')]})[_0x6a4c('0x26')](function(_0x5b6547){return BPromise[_0x6a4c('0x79')](_0x5b6547,function(_0x4c8c1f){return _0x4c8c1f[_0x6a4c('0x78')](_0x129ac8[_0x6a4c('0x36')]['ids'])[_0x6a4c('0x26')](function(){if(_0x422a6d===_0x6a4c('0x7e')){return db[_0x6a4c('0x71')][_0x6a4c('0x58')]({'where':{'VoiceQueueId':_0x4c8c1f['id'],'UserId':_0x129ac8[_0x6a4c('0x36')]['ids']}});}});});})['then'](function(){return _0x5d46a1;});})[_0x6a4c('0x26')](function(){return _0x5d46a1;});}})[_0x6a4c('0x26')](function(_0xea68b1){if(_0xea68b1){return _0xea68b1[_0x6a4c('0x78')](_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')])[_0x6a4c('0x26')](function(){if(_[_0x6a4c('0x7f')](_0x129ac8[_0x6a4c('0x36')]['ids'])){for(var _0x3aa7ba=0x0;_0x3aa7ba<_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')][_0x6a4c('0x3b')];_0x3aa7ba+=0x1){socket[_0x6a4c('0x80')](_0x6a4c('0x81'),{'UserId':Number(_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')][_0x3aa7ba]),'TeamId':Number(_0x129ac8[_0x6a4c('0x57')]['id'])});}}else{socket[_0x6a4c('0x80')]('userTeam:remove',{'UserId':Number(_0x129ac8[_0x6a4c('0x36')][_0x6a4c('0x65')]),'TeamId':Number(_0x129ac8['params']['id'])});}});}})[_0x6a4c('0x26')](respondWithStatusCode(_0x5af19b,null))[_0x6a4c('0x55')](handleError(_0x5af19b,null));};exports[_0x6a4c('0x82')]=function(_0x4587a0,_0x3e874d,_0x104351){var _0x416b6e={};var _0x579db7={};var _0x4befce;var _0x3b47e7;return db[_0x6a4c('0x30')]['findOne']({'where':{'id':_0x4587a0[_0x6a4c('0x57')]['id']}})[_0x6a4c('0x26')](handleEntityNotFound(_0x3e874d,null))[_0x6a4c('0x26')](function(_0x4e15ef){if(_0x4e15ef){_0x4befce=_0x4e15ef;_0x579db7['model']=_[_0x6a4c('0x37')](db[_0x6a4c('0x83')][_0x6a4c('0x31')]);_0x579db7[_0x6a4c('0x36')]=_[_0x6a4c('0x37')](_0x4587a0[_0x6a4c('0x36')]);_0x579db7[_0x6a4c('0x42')]=_[_0x6a4c('0x38')](_0x579db7[_0x6a4c('0x35')],_0x579db7[_0x6a4c('0x36')]);_0x416b6e[_0x6a4c('0x3a')]=_['intersection'](_0x579db7[_0x6a4c('0x35')],qs[_0x6a4c('0x39')](_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x39')]));_0x416b6e[_0x6a4c('0x3a')]=_0x416b6e['attributes'][_0x6a4c('0x3b')]?_0x416b6e[_0x6a4c('0x3a')]:_0x579db7[_0x6a4c('0x35')];_0x416b6e[_0x6a4c('0x3f')]=qs['sort'](_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x40')]);_0x416b6e[_0x6a4c('0x41')]=qs[_0x6a4c('0x42')](_[_0x6a4c('0x43')](_0x4587a0['query'],_0x579db7[_0x6a4c('0x42')]));if(_0x4587a0['query']['filter']){_0x416b6e[_0x6a4c('0x41')]=_[_0x6a4c('0x45')](_0x416b6e[_0x6a4c('0x41')],{'$or':_[_0x6a4c('0x2f')](_0x416b6e[_0x6a4c('0x3a')],function(_0x29d800){var _0x4537b4={};_0x4537b4[_0x29d800]={'$like':'%'+_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x44')]+'%'};return _0x4537b4;})});}_0x416b6e=_[_0x6a4c('0x45')]({},_0x416b6e,_0x4587a0[_0x6a4c('0x4b')]);return _0x4befce['getAgents'](_0x416b6e);}})[_0x6a4c('0x26')](function(_0x10c780){if(_0x10c780){_0x3b47e7=_0x10c780[_0x6a4c('0x3b')];if(!_0x4587a0[_0x6a4c('0x36')][_0x6a4c('0x3c')](_0x6a4c('0x3d'))){_0x416b6e[_0x6a4c('0x3e')]=qs['limit'](_0x4587a0[_0x6a4c('0x36')]['limit']);_0x416b6e['offset']=qs[_0x6a4c('0x21')](_0x4587a0['query'][_0x6a4c('0x21')]);}return _0x4befce[_0x6a4c('0x82')](_0x416b6e);}})[_0x6a4c('0x26')](function(_0x483890){if(_0x483890){return _0x483890?{'count':_0x3b47e7,'rows':_0x483890}:null;}})[_0x6a4c('0x26')](respondWithResult(_0x3e874d,null))[_0x6a4c('0x55')](handleError(_0x3e874d,null));}; \ No newline at end of file +var _0x23d5=['UserProfileResource','create','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','merge','Queues','addQueues','findOne','Sequelize','capitalize','ids','removeQueues','remove','Voice','Chat','Fax','Openchannel','each','User','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','addAgents','omit','spread','userTeam:save','removeAgents','chat','mail','sms','fax','whatsapp','isArray','emit','userTeam:remove','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','get','Teams','destroy','error','stack','send','index','map','Team','rawAttributes','key','name','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','catch','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x1147ca,_0x4c5058){var _0x46c270=function(_0x57ef50){while(--_0x57ef50){_0x1147ca['push'](_0x1147ca['shift']());}};_0x46c270(++_0x4c5058);}(_0x23d5,0x12a));var _0x523d=function(_0x27e45a,_0x580214){_0x27e45a=_0x27e45a-0x0;var _0x20ce3b=_0x23d5[_0x27e45a];return _0x20ce3b;};'use strict';var pdf=require(_0x523d('0x0'));var emlformat=require(_0x523d('0x1'));var rimraf=require(_0x523d('0x2'));var zipdir=require(_0x523d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x523d('0x4'));var Mustache=require('mustache');var util=require(_0x523d('0x5'));var path=require(_0x523d('0x6'));var sox=require(_0x523d('0x7'));var csv=require('to-csv');var ejs=require(_0x523d('0x8'));var fs=require('fs');var _=require(_0x523d('0x9'));var squel=require('squel');var crypto=require(_0x523d('0xa'));var jsforce=require(_0x523d('0xb'));var deskjs=require(_0x523d('0xc'));var toCsv=require(_0x523d('0xd'));var querystring=require(_0x523d('0xe'));var Papa=require(_0x523d('0xf'));var Redis=require(_0x523d('0x10'));var authService=require(_0x523d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x523d('0x12'));var logger=require(_0x523d('0x13'))(_0x523d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x523d('0x15'));var db=require(_0x523d('0x16'))['db'];config[_0x523d('0x17')]=_[_0x523d('0x18')](config[_0x523d('0x17')],{'host':_0x523d('0x19'),'port':0x18eb});var socket=require(_0x523d('0x1a'))(new Redis(config['redis']));require(_0x523d('0x1b'))[_0x523d('0x1c')](socket);function respondWithStatusCode(_0x36570b,_0x5669a3){_0x5669a3=_0x5669a3||0xcc;return function(_0x2ce5c7){if(_0x2ce5c7){return _0x36570b[_0x523d('0x1d')](_0x5669a3);}return _0x36570b['status'](_0x5669a3)[_0x523d('0x1e')]();};}function respondWithResult(_0x3a90c6,_0x3846cd){_0x3846cd=_0x3846cd||0xc8;return function(_0x34548e){if(_0x34548e){return _0x3a90c6[_0x523d('0x1f')](_0x3846cd)[_0x523d('0x20')](_0x34548e);}};}function respondWithFilteredResult(_0x517b48,_0x44e687){return function(_0x2c973a){if(_0x2c973a){var _0x1e6cc7=_0x2c973a['count'],_0x129c8d=_0x44e687['offset'],_0x3ab614=_0x44e687[_0x523d('0x21')]+_0x44e687[_0x523d('0x22')],_0x236519;if(_0x3ab614>=_0x1e6cc7){_0x3ab614=_0x1e6cc7;_0x236519=0xc8;}else{_0x236519=0xce;}_0x517b48['status'](_0x236519);return _0x517b48[_0x523d('0x23')](_0x523d('0x24'),_0x129c8d+'-'+_0x3ab614+'/'+_0x1e6cc7)[_0x523d('0x20')](_0x2c973a);}return null;};}function patchUpdates(_0x3612e0){return function(_0x350816){try{jsonpatch[_0x523d('0x25')](_0x350816,_0x3612e0,!![]);}catch(_0x15663){return BPromise[_0x523d('0x26')](_0x15663);}return _0x350816['save']();};}function saveUpdates(_0x5c5ee6,_0x2daace){return function(_0x48a056){if(_0x48a056){return _0x48a056[_0x523d('0x27')](_0x5c5ee6)[_0x523d('0x28')](function(_0x1d7183){return _0x1d7183;});}return null;};}function removeEntity(_0x5cc5be,_0x4beb3f){return function(_0x1dea5f){if(_0x1dea5f){return _0x1dea5f['destroy']()[_0x523d('0x28')](function(){var _0xeedeb3=_0x1dea5f[_0x523d('0x29')]({'plain':!![]});var _0x565c17=_0x523d('0x2a');return db['UserProfileResource'][_0x523d('0x2b')]({'where':{'type':_0x565c17,'resourceId':_0xeedeb3['id']}})[_0x523d('0x28')](function(){return _0x1dea5f;});})[_0x523d('0x28')](function(){_0x5cc5be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d24c,_0x4c0cd4){return function(_0x1c0e68){if(!_0x1c0e68){_0x17d24c[_0x523d('0x1d')](0x194);}return _0x1c0e68;};}function handleError(_0x376fbb,_0x407c06){_0x407c06=_0x407c06||0x1f4;return function(_0xafbc34){logger[_0x523d('0x2c')](_0xafbc34[_0x523d('0x2d')]);if(_0xafbc34['name']){delete _0xafbc34['name'];}_0x376fbb[_0x523d('0x1f')](_0x407c06)[_0x523d('0x2e')](_0xafbc34);};}exports[_0x523d('0x2f')]=function(_0x57a9cf,_0x5b992b){var _0x137d69={},_0x518c04={},_0x2e2621={'count':0x0,'rows':[]};var _0x711260=_[_0x523d('0x30')](db[_0x523d('0x31')][_0x523d('0x32')],function(_0x3587cd){return{'name':_0x3587cd['fieldName'],'type':_0x3587cd['type'][_0x523d('0x33')]};});_0x518c04['model']=_[_0x523d('0x30')](_0x711260,_0x523d('0x34'));_0x518c04[_0x523d('0x35')]=_['keys'](_0x57a9cf[_0x523d('0x35')]);_0x518c04['filters']=_[_0x523d('0x36')](_0x518c04[_0x523d('0x37')],_0x518c04[_0x523d('0x35')]);_0x137d69[_0x523d('0x38')]=_[_0x523d('0x36')](_0x518c04[_0x523d('0x37')],qs[_0x523d('0x39')](_0x57a9cf[_0x523d('0x35')]['fields']));_0x137d69[_0x523d('0x38')]=_0x137d69['attributes'][_0x523d('0x3a')]?_0x137d69['attributes']:_0x518c04[_0x523d('0x37')];if(!_0x57a9cf[_0x523d('0x35')]['hasOwnProperty'](_0x523d('0x3b'))){_0x137d69[_0x523d('0x22')]=qs[_0x523d('0x22')](_0x57a9cf[_0x523d('0x35')]['limit']);_0x137d69[_0x523d('0x21')]=qs[_0x523d('0x21')](_0x57a9cf[_0x523d('0x35')][_0x523d('0x21')]);}_0x137d69[_0x523d('0x3c')]=qs[_0x523d('0x3d')](_0x57a9cf[_0x523d('0x35')][_0x523d('0x3d')]);_0x137d69[_0x523d('0x3e')]=qs[_0x523d('0x3f')](_[_0x523d('0x40')](_0x57a9cf[_0x523d('0x35')],_0x518c04[_0x523d('0x3f')]),_0x711260);if(_0x57a9cf['query'][_0x523d('0x41')]){_0x137d69[_0x523d('0x3e')]=_['merge'](_0x137d69[_0x523d('0x3e')],{'$or':_[_0x523d('0x30')](_0x711260,function(_0x34dbd5){if(_0x34dbd5['type']!==_0x523d('0x42')){var _0x3b84c8={};_0x3b84c8[_0x34dbd5[_0x523d('0x34')]]={'$like':'%'+_0x57a9cf[_0x523d('0x35')][_0x523d('0x41')]+'%'};return _0x3b84c8;}})});}_0x137d69=_['merge']({},_0x137d69,_0x57a9cf[_0x523d('0x43')]);var _0x2c6ebb={'where':_0x137d69[_0x523d('0x3e')]};return db[_0x523d('0x31')]['count'](_0x2c6ebb)[_0x523d('0x28')](function(_0x2d5333){_0x2e2621[_0x523d('0x44')]=_0x2d5333;if(_0x57a9cf[_0x523d('0x35')][_0x523d('0x45')]){_0x137d69[_0x523d('0x46')]=[{'all':!![]}];}return db['Team'][_0x523d('0x47')](_0x137d69);})['then'](function(_0x4574c5){_0x2e2621['rows']=_0x4574c5;return _0x2e2621;})[_0x523d('0x28')](respondWithFilteredResult(_0x5b992b,_0x137d69))[_0x523d('0x48')](handleError(_0x5b992b,null));};exports['show']=function(_0x57d528,_0x1ed9a7){var _0x1f7a0c={'raw':![],'where':{'id':_0x57d528[_0x523d('0x49')]['id']}},_0x14618d={};_0x14618d[_0x523d('0x37')]=_[_0x523d('0x4a')](db[_0x523d('0x31')][_0x523d('0x32')]);_0x14618d[_0x523d('0x35')]=_[_0x523d('0x4a')](_0x57d528['query']);_0x14618d['filters']=_[_0x523d('0x36')](_0x14618d[_0x523d('0x37')],_0x14618d[_0x523d('0x35')]);_0x1f7a0c[_0x523d('0x38')]=_['intersection'](_0x14618d['model'],qs[_0x523d('0x39')](_0x57d528[_0x523d('0x35')][_0x523d('0x39')]));_0x1f7a0c['attributes']=_0x1f7a0c[_0x523d('0x38')][_0x523d('0x3a')]?_0x1f7a0c[_0x523d('0x38')]:_0x14618d[_0x523d('0x37')];if(_0x57d528[_0x523d('0x35')][_0x523d('0x45')]){_0x1f7a0c[_0x523d('0x46')]=[{'all':!![]}];}_0x1f7a0c=_['merge']({},_0x1f7a0c,_0x57d528[_0x523d('0x43')]);return db[_0x523d('0x31')][_0x523d('0x4b')](_0x1f7a0c)['then'](handleEntityNotFound(_0x1ed9a7,null))[_0x523d('0x28')](respondWithResult(_0x1ed9a7,null))[_0x523d('0x48')](handleError(_0x1ed9a7,null));};exports['create']=function(_0x3d08f9,_0x5dddde){return db[_0x523d('0x31')]['create'](_0x3d08f9[_0x523d('0x4c')],{})['then'](function(_0x3e122b){var _0x31abb1=_0x3d08f9[_0x523d('0x4d')][_0x523d('0x29')]({'plain':!![]});if(!_0x31abb1)throw new Error(_0x523d('0x4e'));if(_0x31abb1[_0x523d('0x4f')]==='user'){var _0x30e94d=_0x3e122b[_0x523d('0x29')]({'plain':!![]});var _0x1defe8=_0x523d('0x2a');return db[_0x523d('0x50')]['find']({'where':{'name':_0x1defe8,'userProfileId':_0x31abb1[_0x523d('0x51')]},'raw':!![]})[_0x523d('0x28')](function(_0x52114c){if(_0x52114c&&_0x52114c[_0x523d('0x52')]===0x0){return db[_0x523d('0x53')][_0x523d('0x54')]({'name':_0x30e94d[_0x523d('0x34')],'resourceId':_0x30e94d['id'],'type':_0x52114c[_0x523d('0x34')],'sectionId':_0x52114c['id']},{})[_0x523d('0x28')](function(){return _0x3e122b;});}else{return _0x3e122b;}})[_0x523d('0x48')](function(_0x59eef5){logger[_0x523d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59eef5);throw _0x59eef5;});}return _0x3e122b;})['then'](respondWithResult(_0x5dddde,0xc9))['catch'](handleError(_0x5dddde,null));};exports[_0x523d('0x27')]=function(_0x4a53e5,_0x259093){if(_0x4a53e5[_0x523d('0x4c')]['id']){delete _0x4a53e5[_0x523d('0x4c')]['id'];}return db[_0x523d('0x31')]['find']({'where':{'id':_0x4a53e5[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x259093,null))[_0x523d('0x28')](saveUpdates(_0x4a53e5['body'],null))['then'](respondWithResult(_0x259093,null))['catch'](handleError(_0x259093,null));};exports['destroy']=function(_0xca4fc3,_0x5214dc){return db[_0x523d('0x31')]['find']({'where':{'id':_0xca4fc3[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x5214dc,null))['then'](removeEntity(_0x5214dc,null))[_0x523d('0x48')](handleError(_0x5214dc,null));};exports['getQueues']=function(_0x170e70,_0xf4e2bf,_0x1db5d4){return db[_0x523d('0x31')]['findOne']({'where':{'id':_0x170e70[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0xf4e2bf,null))['then'](function(_0x536eea){if(!_0x170e70[_0x523d('0x35')]['channel']||!utils[_0x523d('0x55')](_0x170e70['query'][_0x523d('0x56')])){throw new db['Sequelize'][(_0x523d('0x57'))](_0x523d('0x58'));}var _0x5793cc={};var _0x3b410f={};_0x3b410f[_0x523d('0x37')]=_[_0x523d('0x4a')](db[_['capitalize'](_0x170e70[_0x523d('0x35')]['channel'][_0x523d('0x59')]())+_0x523d('0x5a')][_0x523d('0x32')]);_0x3b410f[_0x523d('0x35')]=_[_0x523d('0x4a')](_0x170e70['query']);_0x3b410f[_0x523d('0x3f')]=_[_0x523d('0x36')](_0x3b410f[_0x523d('0x37')],_0x3b410f[_0x523d('0x35')]);_0x5793cc[_0x523d('0x38')]=_['intersection'](_0x3b410f[_0x523d('0x37')],qs[_0x523d('0x39')](_0x170e70[_0x523d('0x35')][_0x523d('0x39')]));_0x5793cc[_0x523d('0x38')]=_0x5793cc[_0x523d('0x38')][_0x523d('0x3a')]?_0x5793cc[_0x523d('0x38')]:_0x3b410f['model'];_0x5793cc[_0x523d('0x22')]=qs[_0x523d('0x22')](_0x170e70[_0x523d('0x35')][_0x523d('0x22')]);_0x5793cc[_0x523d('0x21')]=qs[_0x523d('0x21')](_0x170e70['query'][_0x523d('0x21')]);_0x5793cc[_0x523d('0x3c')]=qs[_0x523d('0x3d')](_0x170e70['query'][_0x523d('0x3d')]);_0x5793cc[_0x523d('0x3e')]=qs['filters'](_[_0x523d('0x40')](_0x170e70[_0x523d('0x35')],_0x3b410f[_0x523d('0x3f')]));_0x5793cc=_[_0x523d('0x5b')]({},_0x5793cc,_0x170e70['options']);return _0x536eea[_0x523d('0x29')+_['capitalize'](_0x170e70['query'][_0x523d('0x56')]['toLowerCase']())+_0x523d('0x5c')](_0x5793cc);})[_0x523d('0x28')](respondWithResult(_0xf4e2bf,null))['catch'](handleError(_0xf4e2bf,null));};exports[_0x523d('0x5d')]=function(_0x214b00,_0x303019,_0xd1716){return db['Team'][_0x523d('0x5e')]({'where':{'id':_0x214b00['params']['id']}})[_0x523d('0x28')](function(_0x1f8d8b){if(_0x1f8d8b){if(!_0x214b00[_0x523d('0x4c')][_0x523d('0x56')]||!utils[_0x523d('0x55')](_0x214b00[_0x523d('0x4c')][_0x523d('0x56')])){throw new db[(_0x523d('0x5f'))][(_0x523d('0x57'))]('Unknown\x20channel');}return _0x1f8d8b['add'+_[_0x523d('0x60')](_0x214b00[_0x523d('0x4c')][_0x523d('0x56')][_0x523d('0x59')]())+_0x523d('0x5c')](_0x214b00['body'][_0x523d('0x61')]);}return null;})[_0x523d('0x28')](handleEntityNotFound(_0x303019,null))[_0x523d('0x28')](respondWithStatusCode(_0x303019,null))[_0x523d('0x48')](handleError(_0x303019,null));};exports[_0x523d('0x62')]=function(_0x15c67a,_0xbc1280,_0x2e9504){return db[_0x523d('0x31')][_0x523d('0x5e')]({'where':{'id':_0x15c67a[_0x523d('0x49')]['id']}})[_0x523d('0x28')](function(_0x45161d){if(_0x45161d){if(!_0x15c67a[_0x523d('0x35')][_0x523d('0x56')]||!utils[_0x523d('0x55')](_0x15c67a['query'][_0x523d('0x56')])){throw new db[(_0x523d('0x5f'))][(_0x523d('0x57'))](_0x523d('0x58'));}return _0x45161d[_0x523d('0x63')+_[_0x523d('0x60')](_0x15c67a['query'][_0x523d('0x56')]['toLowerCase']())+'Queues'](_0x15c67a[_0x523d('0x35')][_0x523d('0x61')]);}return null;})['then'](handleEntityNotFound(_0xbc1280,null))[_0x523d('0x28')](respondWithStatusCode(_0xbc1280,null))['catch'](handleError(_0xbc1280,null));};exports['addAgents']=function(_0x320c83,_0x58e149,_0x7aa5b7){return db[_0x523d('0x31')]['find']({'where':{'id':_0x320c83['params']['id']}})['then'](handleEntityNotFound(_0x58e149,null))['then'](function(_0x3ae3e7){if(_0x3ae3e7){var _0x38c2a5=[_0x523d('0x64'),_0x523d('0x65'),'Mail','Sms',_0x523d('0x66'),_0x523d('0x67'),'Whatsapp'];return BPromise['each'](_0x38c2a5,function(_0x173e13){return _0x3ae3e7[_0x523d('0x29')+_0x173e13+'Queues']({'attributes':['id',_0x523d('0x34')]})[_0x523d('0x28')](function(_0x3a26fe){return BPromise[_0x523d('0x68')](_0x3a26fe,function(_0x2d20be){return _0x2d20be['addAgents'](_0x320c83['body']['ids'])[_0x523d('0x28')](function(){if(_0x173e13===_0x523d('0x64')){return db[_0x523d('0x69')][_0x523d('0x47')]({'where':{'id':_0x320c83['body'][_0x523d('0x61')]},'attributes':['id',_0x523d('0x34'),_0x523d('0x6a'),'voicePause',_0x523d('0x6b')],'raw':!![]})[_0x523d('0x28')](function(_0x2aea8a){return BPromise[_0x523d('0x68')](_[_0x523d('0x41')](_0x2aea8a,{'online':0x1}),function(_0x40f32b){return db[_0x523d('0x6c')][_0x523d('0x6d')]({'membername':_0x40f32b['name'],'UserId':_0x40f32b['id'],'queue_name':_0x2d20be[_0x523d('0x34')],'VoiceQueueId':_0x2d20be['id'],'interface':_['isNil'](_0x40f32b[_0x523d('0x6b')])?util[_0x523d('0x6e')](_0x523d('0x6f'),_0x40f32b[_0x523d('0x34')]):_0x40f32b[_0x523d('0x6b')],'paused':_0x40f32b['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x3ae3e7;});})[_0x523d('0x28')](function(){return _0x3ae3e7;});}})[_0x523d('0x28')](function(_0x290d7b){if(_0x290d7b){return _0x290d7b[_0x523d('0x70')](_0x320c83[_0x523d('0x4c')]['ids'],_[_0x523d('0x71')](_0x320c83[_0x523d('0x4c')],[_0x523d('0x61'),'id'])||{})[_0x523d('0x72')](function(_0x5928c6){for(var _0x29d021=0x0;_0x29d021<_0x320c83['body'][_0x523d('0x61')][_0x523d('0x3a')];_0x29d021+=0x1){socket['emit'](_0x523d('0x73'),{'UserId':_0x320c83['body']['ids'][_0x29d021],'TeamId':_0x320c83[_0x523d('0x49')]['id']});}return _0x5928c6;});}})[_0x523d('0x28')](respondWithResult(_0x58e149,null))[_0x523d('0x48')](handleError(_0x58e149,null));};exports[_0x523d('0x74')]=function(_0x17467e,_0x2304fe,_0x568bb1){return db[_0x523d('0x31')][_0x523d('0x4b')]({'where':{'id':_0x17467e[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x2304fe,null))[_0x523d('0x28')](function(_0x652b59){if(_0x652b59){return BPromise[_0x523d('0x68')](['voice',_0x523d('0x75'),_0x523d('0x76'),_0x523d('0x77'),_0x523d('0x78'),'openchannel',_0x523d('0x79')],function(_0x59f137){return _0x652b59['get'+_[_0x523d('0x60')](_0x59f137)+_0x523d('0x5c')]({'attributes':['id',_0x523d('0x34')]})[_0x523d('0x28')](function(_0x2dcc8d){return BPromise['each'](_0x2dcc8d,function(_0x2467ad){return _0x2467ad['removeAgents'](_0x17467e['query'][_0x523d('0x61')])['then'](function(){if(_0x59f137==='voice'){return db[_0x523d('0x6c')][_0x523d('0x2b')]({'where':{'VoiceQueueId':_0x2467ad['id'],'UserId':_0x17467e[_0x523d('0x35')]['ids']}});}});});})[_0x523d('0x28')](function(){return _0x652b59;});})[_0x523d('0x28')](function(){return _0x652b59;});}})['then'](function(_0x46ccdb){if(_0x46ccdb){return _0x46ccdb[_0x523d('0x74')](_0x17467e['query'][_0x523d('0x61')])[_0x523d('0x28')](function(){if(_[_0x523d('0x7a')](_0x17467e['query'][_0x523d('0x61')])){for(var _0x2cf688=0x0;_0x2cf688<_0x17467e['query'][_0x523d('0x61')][_0x523d('0x3a')];_0x2cf688+=0x1){socket[_0x523d('0x7b')](_0x523d('0x7c'),{'UserId':Number(_0x17467e[_0x523d('0x35')][_0x523d('0x61')][_0x2cf688]),'TeamId':Number(_0x17467e[_0x523d('0x49')]['id'])});}}else{socket['emit'](_0x523d('0x7c'),{'UserId':Number(_0x17467e[_0x523d('0x35')][_0x523d('0x61')]),'TeamId':Number(_0x17467e[_0x523d('0x49')]['id'])});}});}})[_0x523d('0x28')](respondWithStatusCode(_0x2304fe,null))['catch'](handleError(_0x2304fe,null));};exports['getAgents']=function(_0x538287,_0x3a9432,_0x198049){var _0x5008cb={};var _0x36c390={};var _0xdf50b1;var _0x14b0f8;return db[_0x523d('0x31')]['findOne']({'where':{'id':_0x538287[_0x523d('0x49')]['id']}})[_0x523d('0x28')](handleEntityNotFound(_0x3a9432,null))[_0x523d('0x28')](function(_0x15faee){if(_0x15faee){_0xdf50b1=_0x15faee;_0x36c390[_0x523d('0x37')]=_[_0x523d('0x4a')](db[_0x523d('0x69')]['rawAttributes']);_0x36c390[_0x523d('0x35')]=_[_0x523d('0x4a')](_0x538287[_0x523d('0x35')]);_0x36c390[_0x523d('0x3f')]=_[_0x523d('0x36')](_0x36c390[_0x523d('0x37')],_0x36c390[_0x523d('0x35')]);_0x5008cb[_0x523d('0x38')]=_['intersection'](_0x36c390[_0x523d('0x37')],qs[_0x523d('0x39')](_0x538287[_0x523d('0x35')][_0x523d('0x39')]));_0x5008cb[_0x523d('0x38')]=_0x5008cb[_0x523d('0x38')][_0x523d('0x3a')]?_0x5008cb['attributes']:_0x36c390[_0x523d('0x37')];_0x5008cb[_0x523d('0x3c')]=qs[_0x523d('0x3d')](_0x538287[_0x523d('0x35')]['sort']);_0x5008cb['where']=qs['filters'](_[_0x523d('0x40')](_0x538287[_0x523d('0x35')],_0x36c390[_0x523d('0x3f')]));if(_0x538287[_0x523d('0x35')][_0x523d('0x41')]){_0x5008cb[_0x523d('0x3e')]=_[_0x523d('0x5b')](_0x5008cb[_0x523d('0x3e')],{'$or':_['map'](_0x5008cb[_0x523d('0x38')],function(_0x1f9781){var _0x328d86={};_0x328d86[_0x1f9781]={'$like':'%'+_0x538287[_0x523d('0x35')]['filter']+'%'};return _0x328d86;})});}_0x5008cb=_[_0x523d('0x5b')]({},_0x5008cb,_0x538287[_0x523d('0x43')]);return _0xdf50b1[_0x523d('0x7d')](_0x5008cb);}})['then'](function(_0x4a06f3){if(_0x4a06f3){_0x14b0f8=_0x4a06f3[_0x523d('0x3a')];if(!_0x538287[_0x523d('0x35')][_0x523d('0x7e')](_0x523d('0x3b'))){_0x5008cb['limit']=qs['limit'](_0x538287['query']['limit']);_0x5008cb['offset']=qs[_0x523d('0x21')](_0x538287[_0x523d('0x35')][_0x523d('0x21')]);}return _0xdf50b1[_0x523d('0x7d')](_0x5008cb);}})[_0x523d('0x28')](function(_0x354a2e){if(_0x354a2e){return _0x354a2e?{'count':_0x14b0f8,'rows':_0x354a2e}:null;}})['then'](respondWithResult(_0x3a9432,null))['catch'](handleError(_0x3a9432,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1a8bbb4..455c1fa 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 _0x80b8=['Team','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x80b8,0x19d));var _0x880b=function(_0x4c3869,_0x5375d){_0x4c3869=_0x4c3869-0x0;var _0x375b92=_0x80b8[_0x4c3869];return _0x375b92;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x880b('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x880b('0x1')](0x0);var events={'afterCreate':_0x880b('0x2'),'afterUpdate':'update','afterDestroy':_0x880b('0x3')};function emitEvent(_0x4e53f5){return function(_0x417447,_0x4512de,_0x39870a){TeamEvents[_0x880b('0x4')](_0x4e53f5+':'+_0x417447['id'],_0x417447);TeamEvents[_0x880b('0x4')](_0x4e53f5,_0x417447);_0x39870a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x880b('0x5')](e,emitEvent(event));}}module[_0x880b('0x6')]=TeamEvents; \ No newline at end of file +var _0x6456=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x6456,0x172));var _0x6645=function(_0x7a6e0,_0x35f1d3){_0x7a6e0=_0x7a6e0-0x0;var _0x2ef4a7=_0x6456[_0x7a6e0];return _0x2ef4a7;};'use strict';var EventEmitter=require(_0x6645('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x6645('0x1')](0x0);var events={'afterCreate':_0x6645('0x2'),'afterUpdate':_0x6645('0x3'),'afterDestroy':_0x6645('0x4')};function emitEvent(_0x14fe57){return function(_0x183eaf,_0x2f8a1c,_0x174008){TeamEvents[_0x6645('0x5')](_0x14fe57+':'+_0x183eaf['id'],_0x183eaf);TeamEvents[_0x6645('0x5')](_0x14fe57,_0x183eaf);_0x174008(null);};}for(var e in events){if(events[_0x6645('0x6')](e)){var event=events[e];Team[_0x6645('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4b26a86..781f820 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 _0x63a1=['Team','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./team.attributes','exports','define'];(function(_0x21e062,_0x27b032){var _0xc4cd51=function(_0x16176d){while(--_0x16176d){_0x21e062['push'](_0x21e062['shift']());}};_0xc4cd51(++_0x27b032);}(_0x63a1,0x140));var _0x163a=function(_0x13040d,_0x436867){_0x13040d=_0x13040d-0x0;var _0x580759=_0x63a1[_0x13040d];return _0x580759;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x163a('0x0'))(_0x163a('0x1'));var moment=require(_0x163a('0x2'));var BPromise=require(_0x163a('0x3'));var rp=require(_0x163a('0x4'));var fs=require('fs');var path=require(_0x163a('0x5'));var rimraf=require(_0x163a('0x6'));var config=require('../../config/environment');var attributes=require(_0x163a('0x7'));module[_0x163a('0x8')]=function(_0xd23044,_0x123bf0){return _0xd23044[_0x163a('0x9')](_0x163a('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf455=['define','Team','teams','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./team.attributes','exports'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0xf455,0x153));var _0x5f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf455[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f45('0x0'));var util=require('util');var logger=require(_0x5f45('0x1'))(_0x5f45('0x2'));var moment=require('moment');var BPromise=require(_0x5f45('0x3'));var rp=require(_0x5f45('0x4'));var fs=require('fs');var path=require(_0x5f45('0x5'));var rimraf=require(_0x5f45('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f45('0x7'));module[_0x5f45('0x8')]=function(_0x4007c1,_0x48945c){return _0x4007c1[_0x5f45('0x9')](_0x5f45('0xa'),attributes,{'tableName':_0x5f45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 6bbbe4a..d56d467 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 _0xf5aa=['request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket'];(function(_0x32acd4,_0x5f34fd){var _0x342d89=function(_0x1671f8){while(--_0x1671f8){_0x32acd4['push'](_0x32acd4['shift']());}};_0x342d89(++_0x5f34fd);}(_0xf5aa,0x140));var _0xaf5a=function(_0xec0bfb,_0x19018d){_0xec0bfb=_0xec0bfb-0x0;var _0x5a1611=_0xf5aa[_0xec0bfb];return _0x5a1611;};'use strict';var _=require(_0xaf5a('0x0'));var util=require(_0xaf5a('0x1'));var moment=require(_0xaf5a('0x2'));var BPromise=require(_0xaf5a('0x3'));var rs=require(_0xaf5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaf5a('0x5'));var logger=require(_0xaf5a('0x6'))(_0xaf5a('0x7'));var config=require(_0xaf5a('0x8'));var jayson=require(_0xaf5a('0x9'));var client=jayson[_0xaf5a('0xa')][_0xaf5a('0xb')]({'port':0x232a});config[_0xaf5a('0xc')]=_[_0xaf5a('0xd')](config[_0xaf5a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf5a('0xe'))(new Redis(config['redis']));require(_0xaf5a('0xf'))['register'](socket);function respondWithRpcPromise(_0x4fd2a1,_0x22b3dd,_0x5a31fe){return new BPromise(function(_0x4c41f1,_0x34ab98){return client[_0xaf5a('0x10')](_0x4fd2a1,_0x5a31fe)[_0xaf5a('0x11')](function(_0xcf035d){logger[_0xaf5a('0x12')](_0xaf5a('0x13'),_0x22b3dd,_0xaf5a('0x14'));logger['debug'](_0xaf5a('0x15'),_0x22b3dd,_0xaf5a('0x14'),JSON[_0xaf5a('0x16')](_0xcf035d));if(_0xcf035d[_0xaf5a('0x17')]){if(_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x18')]===0x1f4){logger[_0xaf5a('0x17')]('Team,\x20%s,\x20%s',_0x22b3dd,_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x19')]);return _0x34ab98(_0xcf035d[_0xaf5a('0x17')]['message']);}logger[_0xaf5a('0x17')]('Team,\x20%s,\x20%s',_0x22b3dd,_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x19')]);return _0x4c41f1(_0xcf035d[_0xaf5a('0x17')][_0xaf5a('0x19')]);}else{logger[_0xaf5a('0x12')](_0xaf5a('0x13'),_0x22b3dd,_0xaf5a('0x14'));_0x4c41f1(_0xcf035d[_0xaf5a('0x1a')]['message']);}})[_0xaf5a('0x1b')](function(_0x3b0321){logger['error'](_0xaf5a('0x13'),_0x22b3dd,_0x3b0321);_0x34ab98(_0x3b0321);});});} \ No newline at end of file +var _0x1bcb=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x1bcb,0x146));var _0xb1bc=function(_0x2ae8fe,_0x5aeef3){_0x2ae8fe=_0x2ae8fe-0x0;var _0x5a3b29=_0x1bcb[_0x2ae8fe];return _0x5a3b29;};'use strict';var _=require(_0xb1bc('0x0'));var util=require(_0xb1bc('0x1'));var moment=require(_0xb1bc('0x2'));var BPromise=require(_0xb1bc('0x3'));var rs=require(_0xb1bc('0x4'));var fs=require('fs');var Redis=require(_0xb1bc('0x5'));var db=require(_0xb1bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1bc('0x7'))(_0xb1bc('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1bc('0x9'));var client=jayson['client'][_0xb1bc('0xa')]({'port':0x232a});config[_0xb1bc('0xb')]=_[_0xb1bc('0xc')](config[_0xb1bc('0xb')],{'host':_0xb1bc('0xd'),'port':0x18eb});var socket=require(_0xb1bc('0xe'))(new Redis(config[_0xb1bc('0xb')]));require(_0xb1bc('0xf'))[_0xb1bc('0x10')](socket);function respondWithRpcPromise(_0x42c316,_0x1112f6,_0x29eac3){return new BPromise(function(_0x20e104,_0x10652d){return client[_0xb1bc('0x11')](_0x42c316,_0x29eac3)[_0xb1bc('0x12')](function(_0x5b262d){logger[_0xb1bc('0x13')]('Team,\x20%s,\x20%s',_0x1112f6,_0xb1bc('0x14'));logger[_0xb1bc('0x15')](_0xb1bc('0x16'),_0x1112f6,_0xb1bc('0x14'),JSON[_0xb1bc('0x17')](_0x5b262d));if(_0x5b262d['error']){if(_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x19')]===0x1f4){logger['error'](_0xb1bc('0x1a'),_0x1112f6,_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);return _0x10652d(_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);}logger['error'](_0xb1bc('0x1a'),_0x1112f6,_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);return _0x20e104(_0x5b262d[_0xb1bc('0x18')][_0xb1bc('0x1b')]);}else{logger[_0xb1bc('0x13')](_0xb1bc('0x1a'),_0x1112f6,_0xb1bc('0x14'));_0x20e104(_0x5b262d['result']['message']);}})['catch'](function(_0x2ff85a){logger['error'](_0xb1bc('0x1a'),_0x1112f6,_0x2ff85a);_0x10652d(_0x2ff85a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 86b1cc9..a39cac8 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 _0x4af9=['./team.events','save','emit','removeListener','length','team:'];(function(_0x5d3fec,_0x3990a3){var _0x5b8963=function(_0x2c9c7d){while(--_0x2c9c7d){_0x5d3fec['push'](_0x5d3fec['shift']());}};_0x5b8963(++_0x3990a3);}(_0x4af9,0x12c));var _0x94af=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4af9[_0x3ab51d];return _0x29a04e;};'use strict';var TeamEvents=require(_0x94af('0x0'));var events=[_0x94af('0x1'),'remove','update'];function createListener(_0x11a2c7,_0x1fc2ed){return function(_0x3a5ecc){_0x1fc2ed[_0x94af('0x2')](_0x11a2c7,_0x3a5ecc);};}function removeListener(_0x1362cc,_0x14d407){return function(){TeamEvents[_0x94af('0x3')](_0x1362cc,_0x14d407);};}exports['register']=function(_0x28a640){for(var _0x360a33=0x0,_0x3e19c9=events[_0x94af('0x4')];_0x360a33<_0x3e19c9;_0x360a33++){var _0x5ad956=events[_0x360a33];var _0x2f84d4=createListener(_0x94af('0x5')+_0x5ad956,_0x28a640);TeamEvents['on'](_0x5ad956,_0x2f84d4);}}; \ No newline at end of file +var _0xf562=['./team.events','save','remove','update','emit','removeListener','length','team:'];(function(_0x569b08,_0x3ea265){var _0xa1e05d=function(_0x467658){while(--_0x467658){_0x569b08['push'](_0x569b08['shift']());}};_0xa1e05d(++_0x3ea265);}(_0xf562,0x100));var _0x2f56=function(_0x12dc05,_0x55988f){_0x12dc05=_0x12dc05-0x0;var _0x4489cc=_0xf562[_0x12dc05];return _0x4489cc;};'use strict';var TeamEvents=require(_0x2f56('0x0'));var events=[_0x2f56('0x1'),_0x2f56('0x2'),_0x2f56('0x3')];function createListener(_0x2f77c6,_0x1f9134){return function(_0x2e6618){_0x1f9134[_0x2f56('0x4')](_0x2f77c6,_0x2e6618);};}function removeListener(_0x38a249,_0x55a78f){return function(){TeamEvents[_0x2f56('0x5')](_0x38a249,_0x55a78f);};}exports['register']=function(_0x14436b){for(var _0x5b3784=0x0,_0x1fd9d8=events[_0x2f56('0x6')];_0x5b3784<_0x1fd9d8;_0x5b3784++){var _0x25f51a=events[_0x5b3784];var _0x1add20=createListener(_0x2f56('0x7')+_0x25f51a,_0x14436b);TeamEvents['on'](_0x25f51a,_0x1add20);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c6cbc82..857347f 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 _0x5f0f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','express'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x5f0f,0x18a));var _0xf5f0=function(_0x127122,_0x145860){_0x127122=_0x127122-0x0;var _0x2b5158=_0x5f0f[_0x127122];return _0x2b5158;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf5f0('0x0'));var timeout=require('connect-timeout');var express=require(_0xf5f0('0x1'));var router=express[_0xf5f0('0x2')]();var auth=require(_0xf5f0('0x3'));var interaction=require(_0xf5f0('0x4'));var config=require(_0xf5f0('0x5'));var controller=require(_0xf5f0('0x6'));router[_0xf5f0('0x7')]('/',auth[_0xf5f0('0x8')](),controller[_0xf5f0('0x9')]);router[_0xf5f0('0x7')](_0xf5f0('0xa'),auth['isAuthenticated'](),controller[_0xf5f0('0xb')]);router[_0xf5f0('0xc')]('/',auth[_0xf5f0('0x8')](),controller[_0xf5f0('0xd')]);router[_0xf5f0('0xe')]('/:id',auth[_0xf5f0('0x8')](),controller['update']);router[_0xf5f0('0xf')](_0xf5f0('0xa'),auth[_0xf5f0('0x8')](),controller[_0xf5f0('0x10')]);module[_0xf5f0('0x11')]=router; \ No newline at end of file +var _0xa02f=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy'];(function(_0x31db5f,_0x555bf0){var _0x10888e=function(_0x1ccd2f){while(--_0x1ccd2f){_0x31db5f['push'](_0x31db5f['shift']());}};_0x10888e(++_0x555bf0);}(_0xa02f,0x8d));var _0xfa02=function(_0x582d4c,_0x4a5361){_0x582d4c=_0x582d4c-0x0;var _0x3676d7=_0xa02f[_0x582d4c];return _0x3676d7;};'use strict';var multer=require(_0xfa02('0x0'));var util=require(_0xfa02('0x1'));var path=require('path');var timeout=require(_0xfa02('0x2'));var express=require(_0xfa02('0x3'));var router=express['Router']();var auth=require(_0xfa02('0x4'));var interaction=require(_0xfa02('0x5'));var config=require(_0xfa02('0x6'));var controller=require(_0xfa02('0x7'));router['get']('/',auth[_0xfa02('0x8')](),controller[_0xfa02('0x9')]);router[_0xfa02('0xa')]('/:id',auth[_0xfa02('0x8')](),controller[_0xfa02('0xb')]);router[_0xfa02('0xc')]('/',auth[_0xfa02('0x8')](),controller[_0xfa02('0xd')]);router[_0xfa02('0xe')](_0xfa02('0xf'),auth['isAuthenticated'](),controller[_0xfa02('0x10')]);router[_0xfa02('0x11')]('/:id',auth[_0xfa02('0x8')](),controller[_0xfa02('0x12')]);module[_0xfa02('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 5aa484e..ac4c583 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 _0xaef2=['TEXT','sequelize','exports'];(function(_0x577f7f,_0x34b78a){var _0x40625a=function(_0xbeb647){while(--_0xbeb647){_0x577f7f['push'](_0x577f7f['shift']());}};_0x40625a(++_0x34b78a);}(_0xaef2,0x169));var _0x2aef=function(_0x243473,_0x462a89){_0x243473=_0x243473-0x0;var _0x5cbea7=_0xaef2[_0x243473];return _0x5cbea7;};'use strict';var Sequelize=require(_0x2aef('0x0'));module[_0x2aef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x2aef('0x2')]}}; \ No newline at end of file +var _0xa4db=['sequelize','exports','STRING','TEXT'];(function(_0x5576ca,_0x3b6f29){var _0x384933=function(_0x50e46d){while(--_0x50e46d){_0x5576ca['push'](_0x5576ca['shift']());}};_0x384933(++_0x3b6f29);}(_0xa4db,0xd4));var _0xba4d=function(_0x2f949c,_0x12b42d){_0x2f949c=_0x2f949c-0x0;var _0x665c7f=_0xa4db[_0x2f949c];return _0x665c7f;};'use strict';var Sequelize=require(_0xba4d('0x0'));module[_0xba4d('0x1')]={'name':{'type':Sequelize[_0xba4d('0x2')]},'description':{'type':Sequelize[_0xba4d('0x2')]},'html':{'type':Sequelize[_0xba4d('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5a6a0d9..c50584b 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 _0x1261=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','name','send','index','Template','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x308ee4,_0x2331fe){var _0x353ed9=function(_0x262145){while(--_0x262145){_0x308ee4['push'](_0x308ee4['shift']());}};_0x353ed9(++_0x2331fe);}(_0x1261,0x144));var _0x1126=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x1261[_0x2dadb9];return _0x2f0097;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=_0x45149c['count'],_0x35fe9f=_0x4be0c6[_0x1126('0x1c')],_0x42f379=_0x4be0c6[_0x1126('0x1c')]+_0x4be0c6['limit'],_0x257b5f;if(_0x42f379>=_0x4794a7){_0x42f379=_0x4794a7;_0x257b5f=0xc8;}else{_0x257b5f=0xce;}_0x279455['status'](_0x257b5f);return _0x279455[_0x1126('0x1d')](_0x1126('0x1e'),_0x35fe9f+'-'+_0x42f379+'/'+_0x4794a7)['json'](_0x45149c);}return null;};}function patchUpdates(_0x548359){return function(_0x4564c0){try{jsonpatch['apply'](_0x4564c0,_0x548359,!![]);}catch(_0x22ed37){return BPromise[_0x1126('0x1f')](_0x22ed37);}return _0x4564c0[_0x1126('0x20')]();};}function saveUpdates(_0x54400a,_0x2a08ba){return function(_0x49d209){if(_0x49d209){return _0x49d209['update'](_0x54400a)[_0x1126('0x21')](function(_0x3a9bed){return _0x3a9bed;});}return null;};}function removeEntity(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x22')]()[_0x1126('0x21')](function(){var _0x48a08d=_0x526ca1[_0x1126('0x23')]({'plain':!![]});var _0x59cd8e='Templates';return db['UserProfileResource'][_0x1126('0x22')]({'where':{'type':_0x59cd8e,'resourceId':_0x48a08d['id']}})[_0x1126('0x21')](function(){return _0x526ca1;});})[_0x1126('0x21')](function(){_0x25b24b[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x1b07a7,_0xea0971){return function(_0x38119d){if(!_0x38119d){_0x1b07a7['sendStatus'](0x194);}return _0x38119d;};}function handleError(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0x1f4;return function(_0xa293f4){logger['error'](_0xa293f4['stack']);if(_0xa293f4[_0x1126('0x24')]){delete _0xa293f4[_0x1126('0x24')];}_0x35eec3['status'](_0x375e59)[_0x1126('0x25')](_0xa293f4);};}exports[_0x1126('0x26')]=function(_0x4a334a,_0x3fa694){var _0x4bf807={},_0xc62460={},_0x4bd50b={'count':0x0,'rows':[]};var _0x771bb8=_['map'](db[_0x1126('0x27')]['rawAttributes'],function(_0x5252e0){return{'name':_0x5252e0['fieldName'],'type':_0x5252e0[_0x1126('0x28')][_0x1126('0x29')]};});_0xc62460[_0x1126('0x2a')]=_['map'](_0x771bb8,_0x1126('0x24'));_0xc62460[_0x1126('0x2b')]=_['keys'](_0x4a334a[_0x1126('0x2b')]);_0xc62460[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],_0xc62460['query']);_0x4bf807['attributes']=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],qs[_0x1126('0x2e')](_0x4a334a[_0x1126('0x2b')]['fields']));_0x4bf807[_0x1126('0x2f')]=_0x4bf807[_0x1126('0x2f')][_0x1126('0x30')]?_0x4bf807[_0x1126('0x2f')]:_0xc62460[_0x1126('0x2a')];if(!_0x4a334a['query'][_0x1126('0x31')](_0x1126('0x32'))){_0x4bf807[_0x1126('0x33')]=qs[_0x1126('0x33')](_0x4a334a['query']['limit']);_0x4bf807[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x4a334a['query'][_0x1126('0x1c')]);}_0x4bf807[_0x1126('0x34')]=qs[_0x1126('0x35')](_0x4a334a['query']['sort']);_0x4bf807[_0x1126('0x36')]=qs[_0x1126('0x2c')](_[_0x1126('0x37')](_0x4a334a[_0x1126('0x2b')],_0xc62460['filters']),_0x771bb8);if(_0x4a334a[_0x1126('0x2b')]['filter']){_0x4bf807[_0x1126('0x36')]=_[_0x1126('0x38')](_0x4bf807[_0x1126('0x36')],{'$or':_[_0x1126('0x39')](_0x771bb8,function(_0x57e5d2){if(_0x57e5d2['type']!==_0x1126('0x3a')){var _0x3ea9de={};_0x3ea9de[_0x57e5d2[_0x1126('0x24')]]={'$like':'%'+_0x4a334a[_0x1126('0x2b')][_0x1126('0x3b')]+'%'};return _0x3ea9de;}})});}_0x4bf807=_[_0x1126('0x38')]({},_0x4bf807,_0x4a334a[_0x1126('0x3c')]);var _0x4faaa3={'where':_0x4bf807[_0x1126('0x36')]};return db[_0x1126('0x27')][_0x1126('0x3d')](_0x4faaa3)[_0x1126('0x21')](function(_0xcf0483){_0x4bd50b['count']=_0xcf0483;if(_0x4a334a['query'][_0x1126('0x3e')]){_0x4bf807[_0x1126('0x3f')]=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x40')](_0x4bf807);})[_0x1126('0x21')](function(_0x276fd5){_0x4bd50b['rows']=_0x276fd5;return _0x4bd50b;})['then'](respondWithFilteredResult(_0x3fa694,_0x4bf807))['catch'](handleError(_0x3fa694,null));};exports[_0x1126('0x41')]=function(_0x5d4194,_0xf84005){var _0x462da8={'raw':!![],'where':{'id':_0x5d4194[_0x1126('0x42')]['id']}},_0x3584a3={};_0x3584a3['model']=_['keys'](db[_0x1126('0x27')][_0x1126('0x43')]);_0x3584a3[_0x1126('0x2b')]=_['keys'](_0x5d4194[_0x1126('0x2b')]);_0x3584a3['filters']=_[_0x1126('0x2d')](_0x3584a3['model'],_0x3584a3[_0x1126('0x2b')]);_0x462da8[_0x1126('0x2f')]=_[_0x1126('0x2d')](_0x3584a3['model'],qs[_0x1126('0x2e')](_0x5d4194[_0x1126('0x2b')][_0x1126('0x2e')]));_0x462da8['attributes']=_0x462da8['attributes']['length']?_0x462da8[_0x1126('0x2f')]:_0x3584a3['model'];if(_0x5d4194[_0x1126('0x2b')]['includeAll']){_0x462da8[_0x1126('0x3f')]=[{'all':!![]}];}_0x462da8=_[_0x1126('0x38')]({},_0x462da8,_0x5d4194[_0x1126('0x3c')]);return db[_0x1126('0x27')][_0x1126('0x44')](_0x462da8)['then'](handleEntityNotFound(_0xf84005,null))[_0x1126('0x21')](respondWithResult(_0xf84005,null))[_0x1126('0x45')](handleError(_0xf84005,null));};exports['create']=function(_0x1a15f8,_0x13dc39){return db['Template'][_0x1126('0x46')](_0x1a15f8[_0x1126('0x47')],{})['then'](function(_0x3e4eeb){var _0xbdde58=_0x1a15f8[_0x1126('0x48')]['get']({'plain':!![]});if(!_0xbdde58)throw new Error(_0x1126('0x49'));if(_0xbdde58[_0x1126('0x4a')]===_0x1126('0x48')){var _0x5878bb=_0x3e4eeb[_0x1126('0x23')]({'plain':!![]});var _0x2081f2=_0x1126('0x4b');return db[_0x1126('0x4c')]['find']({'where':{'name':_0x2081f2,'userProfileId':_0xbdde58[_0x1126('0x4d')]},'raw':!![]})['then'](function(_0x40168e){if(_0x40168e&&_0x40168e[_0x1126('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5878bb[_0x1126('0x24')],'resourceId':_0x5878bb['id'],'type':_0x40168e[_0x1126('0x24')],'sectionId':_0x40168e['id']},{})[_0x1126('0x21')](function(){return _0x3e4eeb;});}else{return _0x3e4eeb;}})['catch'](function(_0x3cb44c){logger[_0x1126('0x4f')](_0x1126('0x50'),_0x3cb44c);throw _0x3cb44c;});}return _0x3e4eeb;})[_0x1126('0x21')](respondWithResult(_0x13dc39,0xc9))['catch'](handleError(_0x13dc39,null));};exports[_0x1126('0x51')]=function(_0x46551f,_0x5c36b9){if(_0x46551f['body']['id']){delete _0x46551f['body']['id'];}return db['Template'][_0x1126('0x44')]({'where':{'id':_0x46551f[_0x1126('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c36b9,null))[_0x1126('0x21')](saveUpdates(_0x46551f[_0x1126('0x47')],null))[_0x1126('0x21')](respondWithResult(_0x5c36b9,null))[_0x1126('0x45')](handleError(_0x5c36b9,null));};exports[_0x1126('0x22')]=function(_0x4e4d49,_0x41cbb6){return db[_0x1126('0x27')]['find']({'where':{'id':_0x4e4d49[_0x1126('0x42')]['id']}})[_0x1126('0x21')](handleEntityNotFound(_0x41cbb6,null))[_0x1126('0x21')](removeEntity(_0x41cbb6,null))[_0x1126('0x45')](handleError(_0x41cbb6,null));}; \ No newline at end of file +var _0xc4aa=['send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','filter','options','Template','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name'];(function(_0x31b8c9,_0x39c14d){var _0x5805e6=function(_0x3cb619){while(--_0x3cb619){_0x31b8c9['push'](_0x31b8c9['shift']());}};_0x5805e6(++_0x39c14d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=_0x26dbb8[_0xac4a('0x1b')],_0x402fff=_0x11e101[_0xac4a('0x1c')],_0x34d797=_0x11e101[_0xac4a('0x1c')]+_0x11e101[_0xac4a('0x1d')],_0x23eb66;if(_0x34d797>=_0x4a2119){_0x34d797=_0x4a2119;_0x23eb66=0xc8;}else{_0x23eb66=0xce;}_0x42c7fc[_0xac4a('0x18')](_0x23eb66);return _0x42c7fc['set']('Content-Range',_0x402fff+'-'+_0x34d797+'/'+_0x4a2119)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x13c8eb){return function(_0x39b691){try{jsonpatch['apply'](_0x39b691,_0x13c8eb,!![]);}catch(_0x39e83e){return BPromise[_0xac4a('0x1e')](_0x39e83e);}return _0x39b691[_0xac4a('0x1f')]();};}function saveUpdates(_0x3a3cdb,_0x123694){return function(_0x3e829c){if(_0x3e829c){return _0x3e829c[_0xac4a('0x20')](_0x3a3cdb)[_0xac4a('0x21')](function(_0x534092){return _0x534092;});}return null;};}function removeEntity(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x22')]()[_0xac4a('0x21')](function(){var _0x3eacd3=_0x599787[_0xac4a('0x23')]({'plain':!![]});var _0x4d2d6c=_0xac4a('0x24');return db[_0xac4a('0x25')][_0xac4a('0x22')]({'where':{'type':_0x4d2d6c,'resourceId':_0x3eacd3['id']}})[_0xac4a('0x21')](function(){return _0x599787;});})[_0xac4a('0x21')](function(){_0x3d8f0a[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x36054a,_0x3e2c69){return function(_0x3bc318){if(!_0x3bc318){_0x36054a[_0xac4a('0x17')](0x194);}return _0x3bc318;};}function handleError(_0x215a31,_0x14832b){_0x14832b=_0x14832b||0x1f4;return function(_0x472c57){logger[_0xac4a('0x26')](_0x472c57[_0xac4a('0x27')]);if(_0x472c57['name']){delete _0x472c57[_0xac4a('0x28')];}_0x215a31[_0xac4a('0x18')](_0x14832b)[_0xac4a('0x29')](_0x472c57);};}exports[_0xac4a('0x2a')]=function(_0x116700,_0x4a5a9e){var _0x47f49c={},_0xdb7e={},_0x7a948b={'count':0x0,'rows':[]};var _0x1f12d5=_['map'](db['Template'][_0xac4a('0x2b')],function(_0x2896bc){return{'name':_0x2896bc[_0xac4a('0x2c')],'type':_0x2896bc[_0xac4a('0x2d')][_0xac4a('0x2e')]};});_0xdb7e['model']=_[_0xac4a('0x2f')](_0x1f12d5,'name');_0xdb7e[_0xac4a('0x30')]=_['keys'](_0x116700[_0xac4a('0x30')]);_0xdb7e[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0xdb7e[_0xac4a('0x33')],_0xdb7e[_0xac4a('0x30')]);_0x47f49c[_0xac4a('0x34')]=_[_0xac4a('0x32')](_0xdb7e[_0xac4a('0x33')],qs[_0xac4a('0x35')](_0x116700[_0xac4a('0x30')][_0xac4a('0x35')]));_0x47f49c[_0xac4a('0x34')]=_0x47f49c[_0xac4a('0x34')][_0xac4a('0x36')]?_0x47f49c['attributes']:_0xdb7e[_0xac4a('0x33')];if(!_0x116700[_0xac4a('0x30')]['hasOwnProperty'](_0xac4a('0x37'))){_0x47f49c[_0xac4a('0x1d')]=qs['limit'](_0x116700['query'][_0xac4a('0x1d')]);_0x47f49c[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x116700[_0xac4a('0x30')]['offset']);}_0x47f49c[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x116700['query'][_0xac4a('0x39')]);_0x47f49c[_0xac4a('0x3a')]=qs[_0xac4a('0x31')](_['pick'](_0x116700[_0xac4a('0x30')],_0xdb7e[_0xac4a('0x31')]),_0x1f12d5);if(_0x116700[_0xac4a('0x30')]['filter']){_0x47f49c[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x47f49c['where'],{'$or':_['map'](_0x1f12d5,function(_0x4319a1){if(_0x4319a1['type']!=='VIRTUAL'){var _0x5f0af0={};_0x5f0af0[_0x4319a1['name']]={'$like':'%'+_0x116700[_0xac4a('0x30')][_0xac4a('0x3c')]+'%'};return _0x5f0af0;}})});}_0x47f49c=_[_0xac4a('0x3b')]({},_0x47f49c,_0x116700[_0xac4a('0x3d')]);var _0x2bdb21={'where':_0x47f49c[_0xac4a('0x3a')]};return db[_0xac4a('0x3e')][_0xac4a('0x1b')](_0x2bdb21)[_0xac4a('0x21')](function(_0x1f7721){_0x7a948b[_0xac4a('0x1b')]=_0x1f7721;if(_0x116700[_0xac4a('0x30')]['includeAll']){_0x47f49c['include']=[{'all':!![]}];}return db['Template'][_0xac4a('0x3f')](_0x47f49c);})[_0xac4a('0x21')](function(_0x14e80b){_0x7a948b[_0xac4a('0x40')]=_0x14e80b;return _0x7a948b;})[_0xac4a('0x21')](respondWithFilteredResult(_0x4a5a9e,_0x47f49c))[_0xac4a('0x41')](handleError(_0x4a5a9e,null));};exports[_0xac4a('0x42')]=function(_0x3441f2,_0x3e9973){var _0x3edb19={'raw':!![],'where':{'id':_0x3441f2[_0xac4a('0x43')]['id']}},_0x561cb7={};_0x561cb7[_0xac4a('0x33')]=_[_0xac4a('0x44')](db[_0xac4a('0x3e')][_0xac4a('0x2b')]);_0x561cb7['query']=_[_0xac4a('0x44')](_0x3441f2[_0xac4a('0x30')]);_0x561cb7['filters']=_[_0xac4a('0x32')](_0x561cb7['model'],_0x561cb7[_0xac4a('0x30')]);_0x3edb19[_0xac4a('0x34')]=_[_0xac4a('0x32')](_0x561cb7[_0xac4a('0x33')],qs[_0xac4a('0x35')](_0x3441f2[_0xac4a('0x30')][_0xac4a('0x35')]));_0x3edb19[_0xac4a('0x34')]=_0x3edb19[_0xac4a('0x34')][_0xac4a('0x36')]?_0x3edb19[_0xac4a('0x34')]:_0x561cb7[_0xac4a('0x33')];if(_0x3441f2['query'][_0xac4a('0x45')]){_0x3edb19[_0xac4a('0x46')]=[{'all':!![]}];}_0x3edb19=_[_0xac4a('0x3b')]({},_0x3edb19,_0x3441f2['options']);return db[_0xac4a('0x3e')][_0xac4a('0x47')](_0x3edb19)['then'](handleEntityNotFound(_0x3e9973,null))[_0xac4a('0x21')](respondWithResult(_0x3e9973,null))['catch'](handleError(_0x3e9973,null));};exports[_0xac4a('0x48')]=function(_0xe620f6,_0x136a65){return db['Template']['create'](_0xe620f6[_0xac4a('0x49')],{})['then'](function(_0x18ae96){var _0x566258=_0xe620f6[_0xac4a('0x4a')]['get']({'plain':!![]});if(!_0x566258)throw new Error(_0xac4a('0x4b'));if(_0x566258[_0xac4a('0x4c')]===_0xac4a('0x4a')){var _0x1c8c39=_0x18ae96['get']({'plain':!![]});var _0x31c794=_0xac4a('0x24');return db[_0xac4a('0x4d')][_0xac4a('0x47')]({'where':{'name':_0x31c794,'userProfileId':_0x566258[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x21')](function(_0x187306){if(_0x187306&&_0x187306['autoAssociation']===0x0){return db[_0xac4a('0x25')][_0xac4a('0x48')]({'name':_0x1c8c39['name'],'resourceId':_0x1c8c39['id'],'type':_0x187306[_0xac4a('0x28')],'sectionId':_0x187306['id']},{})[_0xac4a('0x21')](function(){return _0x18ae96;});}else{return _0x18ae96;}})[_0xac4a('0x41')](function(_0x3ac36e){logger['error'](_0xac4a('0x4f'),_0x3ac36e);throw _0x3ac36e;});}return _0x18ae96;})[_0xac4a('0x21')](respondWithResult(_0x136a65,0xc9))[_0xac4a('0x41')](handleError(_0x136a65,null));};exports[_0xac4a('0x20')]=function(_0x890910,_0x49fbc3){if(_0x890910[_0xac4a('0x49')]['id']){delete _0x890910['body']['id'];}return db[_0xac4a('0x3e')][_0xac4a('0x47')]({'where':{'id':_0x890910['params']['id']}})['then'](handleEntityNotFound(_0x49fbc3,null))[_0xac4a('0x21')](saveUpdates(_0x890910[_0xac4a('0x49')],null))['then'](respondWithResult(_0x49fbc3,null))[_0xac4a('0x41')](handleError(_0x49fbc3,null));};exports[_0xac4a('0x22')]=function(_0x26b582,_0x103d05){return db['Template'][_0xac4a('0x47')]({'where':{'id':_0x26b582[_0xac4a('0x43')]['id']}})[_0xac4a('0x21')](handleEntityNotFound(_0x103d05,null))[_0xac4a('0x21')](removeEntity(_0x103d05,null))[_0xac4a('0x41')](handleError(_0x103d05,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a736da1..36115d0 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 _0x48d2=['bluebird','request-promise','path','rimraf','../../config/environment','define','Template','tools_templates','lodash','../../config/logger','api'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x48d2,0x1e1));var _0x248d=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x48d2[_0x211fef];return _0x5447bf;};'use strict';var _=require(_0x248d('0x0'));var util=require('util');var logger=require(_0x248d('0x1'))(_0x248d('0x2'));var moment=require('moment');var BPromise=require(_0x248d('0x3'));var rp=require(_0x248d('0x4'));var fs=require('fs');var path=require(_0x248d('0x5'));var rimraf=require(_0x248d('0x6'));var config=require(_0x248d('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x3fda73,_0x85f63c){return _0x3fda73[_0x248d('0x8')](_0x248d('0x9'),attributes,{'tableName':_0x248d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4046=['./template.attributes','exports','define','Template','tools_templates','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x244c65,_0x104d0a){var _0x33029e=function(_0x297f2a){while(--_0x297f2a){_0x244c65['push'](_0x244c65['shift']());}};_0x33029e(++_0x104d0a);}(_0x4046,0x102));var _0x6404=function(_0x44738f,_0x29dea7){_0x44738f=_0x44738f-0x0;var _0x1e3ca8=_0x4046[_0x44738f];return _0x1e3ca8;};'use strict';var _=require('lodash');var util=require(_0x6404('0x0'));var logger=require(_0x6404('0x1'))(_0x6404('0x2'));var moment=require(_0x6404('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6404('0x4'));var config=require(_0x6404('0x5'));var attributes=require(_0x6404('0x6'));module[_0x6404('0x7')]=function(_0x4fccef,_0x5480ca){return _0x4fccef[_0x6404('0x8')](_0x6404('0x9'),attributes,{'tableName':_0x6404('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index e64d6b5..fb8c44d 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 _0x75e3=['catch','Template','findAll','options','raw','where','attributes','limit','map','include','model','then','GetTemplate','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','info','result','message'];(function(_0x2d3ef7,_0x2fb595){var _0x25b7e4=function(_0xe09595){while(--_0xe09595){_0x2d3ef7['push'](_0x2d3ef7['shift']());}};_0x25b7e4(++_0x2fb595);}(_0x75e3,0x1ed));var _0x375e=function(_0x17b2ab,_0xf4e367){_0x17b2ab=_0x17b2ab-0x0;var _0xd57d00=_0x75e3[_0x17b2ab];return _0xd57d00;};'use strict';var _=require('lodash');var util=require(_0x375e('0x0'));var moment=require(_0x375e('0x1'));var BPromise=require(_0x375e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x375e('0x3'));var db=require(_0x375e('0x4'))['db'];var utils=require(_0x375e('0x5'));var logger=require(_0x375e('0x6'))(_0x375e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x375e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dfa7d,_0x369b30,_0x45d18a){return new BPromise(function(_0x40bbae,_0x2a50d6){return client[_0x375e('0x9')](_0x1dfa7d,_0x45d18a)['then'](function(_0x1cd23a){logger['info'](_0x375e('0xa'),_0x369b30,'request\x20sent');logger[_0x375e('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x369b30,_0x375e('0xc'),JSON[_0x375e('0xd')](_0x1cd23a));if(_0x1cd23a[_0x375e('0xe')]){if(_0x1cd23a[_0x375e('0xe')][_0x375e('0xf')]===0x1f4){logger[_0x375e('0xe')](_0x375e('0xa'),_0x369b30,_0x1cd23a[_0x375e('0xe')]['message']);return _0x2a50d6(_0x1cd23a[_0x375e('0xe')]['message']);}logger[_0x375e('0xe')](_0x375e('0xa'),_0x369b30,_0x1cd23a[_0x375e('0xe')]['message']);return _0x40bbae(_0x1cd23a['error']['message']);}else{logger[_0x375e('0x10')]('Template,\x20%s,\x20%s',_0x369b30,_0x375e('0xc'));_0x40bbae(_0x1cd23a[_0x375e('0x11')][_0x375e('0x12')]);}})[_0x375e('0x13')](function(_0x5eca46){logger[_0x375e('0xe')]('Template,\x20%s,\x20%s',_0x369b30,_0x5eca46);_0x2a50d6(_0x5eca46);});});}exports['GetTemplate']=function(_0x18734f){var _0x5fd2c9=this;return new Promise(function(_0x8a6b51,_0x5e3233){return db[_0x375e('0x14')][_0x375e('0x15')]({'raw':_0x18734f['options']?_0x18734f[_0x375e('0x16')][_0x375e('0x17')]===undefined?!![]:![]:!![],'where':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')][_0x375e('0x18')]||null:null,'attributes':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')][_0x375e('0x19')]||null:null,'limit':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')][_0x375e('0x1a')]||null:null,'include':_0x18734f[_0x375e('0x16')]?_0x18734f[_0x375e('0x16')]['include']?_[_0x375e('0x1b')](_0x18734f[_0x375e('0x16')][_0x375e('0x1c')],function(_0x2ed014){return{'model':db[_0x2ed014[_0x375e('0x1d')]],'as':_0x2ed014['as'],'attributes':_0x2ed014['attributes'],'include':_0x2ed014[_0x375e('0x1c')]?_[_0x375e('0x1b')](_0x2ed014['include'],function(_0x5162a9){return{'model':db[_0x5162a9['model']],'as':_0x5162a9['as'],'attributes':_0x5162a9[_0x375e('0x19')],'include':_0x5162a9[_0x375e('0x1c')]?_[_0x375e('0x1b')](_0x5162a9[_0x375e('0x1c')],function(_0x6fdc6a){return{'model':db[_0x6fdc6a[_0x375e('0x1d')]],'as':_0x6fdc6a['as'],'attributes':_0x6fdc6a[_0x375e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x375e('0x1e')](function(_0x4adf5d){logger[_0x375e('0x10')](_0x375e('0x1f'),_0x18734f);logger[_0x375e('0xb')]('GetTemplate',_0x18734f,JSON[_0x375e('0xd')](_0x4adf5d));_0x8a6b51(_0x4adf5d);})[_0x375e('0x13')](function(_0x1e9303){logger[_0x375e('0xe')](_0x375e('0x1f'),_0x1e9303[_0x375e('0x12')],_0x18734f);_0x5e3233(_0x5fd2c9[_0x375e('0xe')](0x1f4,_0x1e9303[_0x375e('0x12')]));});});}; \ No newline at end of file +var _0x5bd4=['debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x5bd4,0x77));var _0x45bd=function(_0x1f480c,_0x4ce48e){_0x1f480c=_0x1f480c-0x0;var _0x357483=_0x5bd4[_0x1f480c];return _0x357483;};'use strict';var _=require(_0x45bd('0x0'));var util=require('util');var moment=require(_0x45bd('0x1'));var BPromise=require(_0x45bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45bd('0x3'));var db=require(_0x45bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45bd('0x5'))(_0x45bd('0x6'));var config=require('../../config/environment');var jayson=require(_0x45bd('0x7'));var client=jayson[_0x45bd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bf123,_0x10e3e2,_0x35152e){return new BPromise(function(_0x40569a,_0x330637){return client[_0x45bd('0x9')](_0x2bf123,_0x35152e)[_0x45bd('0xa')](function(_0x135910){logger['info'](_0x45bd('0xb'),_0x10e3e2,_0x45bd('0xc'));logger[_0x45bd('0xd')](_0x45bd('0xe'),_0x10e3e2,_0x45bd('0xc'),JSON[_0x45bd('0xf')](_0x135910));if(_0x135910[_0x45bd('0x10')]){if(_0x135910[_0x45bd('0x10')][_0x45bd('0x11')]===0x1f4){logger[_0x45bd('0x10')](_0x45bd('0xb'),_0x10e3e2,_0x135910[_0x45bd('0x10')]['message']);return _0x330637(_0x135910[_0x45bd('0x10')][_0x45bd('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x10e3e2,_0x135910['error'][_0x45bd('0x12')]);return _0x40569a(_0x135910[_0x45bd('0x10')][_0x45bd('0x12')]);}else{logger['info'](_0x45bd('0xb'),_0x10e3e2,'request\x20sent');_0x40569a(_0x135910[_0x45bd('0x13')][_0x45bd('0x12')]);}})[_0x45bd('0x14')](function(_0x4311bb){logger[_0x45bd('0x10')](_0x45bd('0xb'),_0x10e3e2,_0x4311bb);_0x330637(_0x4311bb);});});}exports[_0x45bd('0x15')]=function(_0xe96bad){var _0x256f03=this;return new Promise(function(_0x398b22,_0x487d1f){return db[_0x45bd('0x16')][_0x45bd('0x17')]({'raw':_0xe96bad[_0x45bd('0x18')]?_0xe96bad['options'][_0x45bd('0x19')]===undefined?!![]:![]:!![],'where':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1a')]||null:null,'attributes':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1b')]||null:null,'limit':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1c')]||null:null,'include':_0xe96bad[_0x45bd('0x18')]?_0xe96bad[_0x45bd('0x18')][_0x45bd('0x1d')]?_[_0x45bd('0x1e')](_0xe96bad['options'][_0x45bd('0x1d')],function(_0x3f8949){return{'model':db[_0x3f8949[_0x45bd('0x1f')]],'as':_0x3f8949['as'],'attributes':_0x3f8949[_0x45bd('0x1b')],'include':_0x3f8949[_0x45bd('0x1d')]?_['map'](_0x3f8949[_0x45bd('0x1d')],function(_0x30f4b1){return{'model':db[_0x30f4b1['model']],'as':_0x30f4b1['as'],'attributes':_0x30f4b1[_0x45bd('0x1b')],'include':_0x30f4b1[_0x45bd('0x1d')]?_['map'](_0x30f4b1[_0x45bd('0x1d')],function(_0x2bc100){return{'model':db[_0x2bc100[_0x45bd('0x1f')]],'as':_0x2bc100['as'],'attributes':_0x2bc100[_0x45bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45bd('0xa')](function(_0x41ec97){logger[_0x45bd('0x20')](_0x45bd('0x15'),_0xe96bad);logger[_0x45bd('0xd')](_0x45bd('0x15'),_0xe96bad,JSON[_0x45bd('0xf')](_0x41ec97));_0x398b22(_0x41ec97);})['catch'](function(_0x440575){logger['error'](_0x45bd('0x15'),_0x440575[_0x45bd('0x12')],_0xe96bad);_0x487d1f(_0x256f03[_0x45bd('0x10')](0x1f4,_0x440575['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b496bb7..b1bf117 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 _0x40a0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x40a0,0x101));var _0x040a=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x40a0[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require(_0x040a('0x0'));var path=require(_0x040a('0x1'));var timeout=require(_0x040a('0x2'));var express=require(_0x040a('0x3'));var router=express[_0x040a('0x4')]();var auth=require(_0x040a('0x5'));var interaction=require(_0x040a('0x6'));var config=require(_0x040a('0x7'));var controller=require('./trigger.controller');router[_0x040a('0x8')]('/',auth[_0x040a('0x9')](),controller[_0x040a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x040a('0x8')](_0x040a('0xb'),auth['isAuthenticated'](),controller[_0x040a('0xc')]);router[_0x040a('0x8')](_0x040a('0xd'),auth[_0x040a('0x9')](),controller[_0x040a('0xe')]);router['get'](_0x040a('0xf'),auth[_0x040a('0x9')](),controller[_0x040a('0x10')]);router[_0x040a('0x11')]('/',auth[_0x040a('0x9')](),controller[_0x040a('0x12')]);router[_0x040a('0x11')](_0x040a('0xb'),auth[_0x040a('0x9')](),controller[_0x040a('0x13')]);router[_0x040a('0x11')]('/:id/any_conditions',auth[_0x040a('0x9')](),controller[_0x040a('0x14')]);router['post'](_0x040a('0xf'),auth[_0x040a('0x9')](),controller['addAction']);router['put'](_0x040a('0x15'),auth[_0x040a('0x9')](),controller[_0x040a('0x16')]);router[_0x040a('0x17')](_0x040a('0x15'),auth[_0x040a('0x9')](),controller[_0x040a('0x18')]);module[_0x040a('0x19')]=router; \ No newline at end of file +var _0xd6e8=['../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x14ea8e,_0x218880){var _0x2806da=function(_0x511891){while(--_0x511891){_0x14ea8e['push'](_0x14ea8e['shift']());}};_0x2806da(++_0x218880);}(_0xd6e8,0x166));var _0x8d6e=function(_0x598fa0,_0x183280){_0x598fa0=_0x598fa0-0x0;var _0x29a6ab=_0xd6e8[_0x598fa0];return _0x29a6ab;};'use strict';var multer=require(_0x8d6e('0x0'));var util=require(_0x8d6e('0x1'));var path=require(_0x8d6e('0x2'));var timeout=require(_0x8d6e('0x3'));var express=require('express');var router=express[_0x8d6e('0x4')]();var auth=require(_0x8d6e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d6e('0x6'));var controller=require(_0x8d6e('0x7'));router[_0x8d6e('0x8')]('/',auth[_0x8d6e('0x9')](),controller[_0x8d6e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d6e('0xb')]);router[_0x8d6e('0x8')](_0x8d6e('0xc'),auth[_0x8d6e('0x9')](),controller['getAllConditions']);router['get'](_0x8d6e('0xd'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0xe')]);router[_0x8d6e('0x8')](_0x8d6e('0xf'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x10')]);router['post']('/',auth[_0x8d6e('0x9')](),controller['create']);router[_0x8d6e('0x11')](_0x8d6e('0xc'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x12')]);router['post'](_0x8d6e('0xd'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x13')]);router[_0x8d6e('0x11')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x8d6e('0x14')](_0x8d6e('0x15'),auth['isAuthenticated'](),controller[_0x8d6e('0x16')]);router[_0x8d6e('0x17')](_0x8d6e('0x15'),auth[_0x8d6e('0x9')](),controller[_0x8d6e('0x18')]);module[_0x8d6e('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 dfba753..1930396 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 _0x81fb=['BOOLEAN','STRING'];(function(_0x5322eb,_0x38596c){var _0x2dc225=function(_0x5ed302){while(--_0x5ed302){_0x5322eb['push'](_0x5322eb['shift']());}};_0x2dc225(++_0x38596c);}(_0x81fb,0x1d7));var _0xb81f=function(_0x4764da,_0x4c2812){_0x4764da=_0x4764da-0x0;var _0x3f17a6=_0x81fb[_0x4764da];return _0x3f17a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb81f('0x0')]},'channel':{'type':Sequelize[_0xb81f('0x0')]},'description':{'type':Sequelize[_0xb81f('0x0')]},'status':{'type':Sequelize[_0xb81f('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xe784=['sequelize','STRING'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xe784,0x98));var _0x4e78=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe784[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x4e78('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4e78('0x1')]},'description':{'type':Sequelize[_0x4e78('0x1')]},'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 779cc7c..fdb55fd 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 _0x5e11=['to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','name','send','index','map','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','Trigger','findAll','rows','show','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','TriggerAnyId','getAllConditions','sort','pick','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x5878ee,_0x406ff5){var _0x2068a0=function(_0x345719){while(--_0x345719){_0x5878ee['push'](_0x5878ee['shift']());}};_0x2068a0(++_0x406ff5);}(_0x5e11,0x1c3));var _0x15e1=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x5e11[_0x251e8c];return _0x1e0c1d;};'use strict';var pdf=require(_0x15e1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15e1('0x1'));var zipdir=require(_0x15e1('0x2'));var jsonpatch=require(_0x15e1('0x3'));var rp=require(_0x15e1('0x4'));var moment=require(_0x15e1('0x5'));var BPromise=require(_0x15e1('0x6'));var Mustache=require('mustache');var util=require(_0x15e1('0x7'));var path=require('path');var sox=require(_0x15e1('0x8'));var csv=require(_0x15e1('0x9'));var ejs=require(_0x15e1('0xa'));var fs=require('fs');var _=require(_0x15e1('0xb'));var squel=require(_0x15e1('0xc'));var crypto=require('crypto');var jsforce=require(_0x15e1('0xd'));var deskjs=require(_0x15e1('0xe'));var toCsv=require(_0x15e1('0x9'));var querystring=require(_0x15e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x15e1('0x10'));var authService=require(_0x15e1('0x11'));var qs=require(_0x15e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15e1('0x13'));var logger=require(_0x15e1('0x14'))(_0x15e1('0x15'));var utils=require(_0x15e1('0x16'));var config=require(_0x15e1('0x17'));var licenseUtil=require(_0x15e1('0x18'));var db=require(_0x15e1('0x19'))['db'];function respondWithStatusCode(_0xacda2f,_0x3d423c){_0x3d423c=_0x3d423c||0xcc;return function(_0x11486f){if(_0x11486f){return _0xacda2f[_0x15e1('0x1a')](_0x3d423c);}return _0xacda2f[_0x15e1('0x1b')](_0x3d423c)['end']();};}function respondWithResult(_0x3629ea,_0x158d0f){_0x158d0f=_0x158d0f||0xc8;return function(_0x3db265){if(_0x3db265){return _0x3629ea['status'](_0x158d0f)[_0x15e1('0x1c')](_0x3db265);}};}function respondWithFilteredResult(_0x4647a0,_0x499bd3){return function(_0x381bb4){if(_0x381bb4){var _0xa1ba90=_0x381bb4[_0x15e1('0x1d')],_0x36f758=_0x499bd3[_0x15e1('0x1e')],_0x448d59=_0x499bd3[_0x15e1('0x1e')]+_0x499bd3[_0x15e1('0x1f')],_0x36d214;if(_0x448d59>=_0xa1ba90){_0x448d59=_0xa1ba90;_0x36d214=0xc8;}else{_0x36d214=0xce;}_0x4647a0[_0x15e1('0x1b')](_0x36d214);return _0x4647a0[_0x15e1('0x20')](_0x15e1('0x21'),_0x36f758+'-'+_0x448d59+'/'+_0xa1ba90)[_0x15e1('0x1c')](_0x381bb4);}return null;};}function patchUpdates(_0x38f496){return function(_0x1b3b13){try{jsonpatch[_0x15e1('0x22')](_0x1b3b13,_0x38f496,!![]);}catch(_0x533e00){return BPromise[_0x15e1('0x23')](_0x533e00);}return _0x1b3b13[_0x15e1('0x24')]();};}function saveUpdates(_0x5de6d9,_0x4712fe){return function(_0x3d6c99){if(_0x3d6c99){return _0x3d6c99[_0x15e1('0x25')](_0x5de6d9)[_0x15e1('0x26')](function(_0x57339c){return _0x57339c;});}return null;};}function removeEntity(_0x522dd0,_0x1648f4){return function(_0x160c65){if(_0x160c65){return _0x160c65[_0x15e1('0x27')]()[_0x15e1('0x26')](function(){var _0x2d91ee=_0x160c65[_0x15e1('0x28')]({'plain':!![]});var _0x2e8796='Triggers';return db['UserProfileResource'][_0x15e1('0x27')]({'where':{'type':_0x2e8796,'resourceId':_0x2d91ee['id']}})[_0x15e1('0x26')](function(){return _0x160c65;});})['then'](function(){_0x522dd0['status'](0xcc)[_0x15e1('0x29')]();});}};}function handleEntityNotFound(_0x130ed6,_0x4c3cdb){return function(_0x477ff1){if(!_0x477ff1){_0x130ed6[_0x15e1('0x1a')](0x194);}return _0x477ff1;};}function handleError(_0x21d188,_0x3bcb9f){_0x3bcb9f=_0x3bcb9f||0x1f4;return function(_0x3ecffa){logger['error'](_0x3ecffa['stack']);if(_0x3ecffa['name']){delete _0x3ecffa[_0x15e1('0x2a')];}_0x21d188['status'](_0x3bcb9f)[_0x15e1('0x2b')](_0x3ecffa);};}exports[_0x15e1('0x2c')]=function(_0x201b53,_0x16c14e){var _0x40f5ef={},_0x4e1dcf={},_0x29f2a7={'count':0x0,'rows':[]};var _0x55513b=_[_0x15e1('0x2d')](db['Trigger']['rawAttributes'],function(_0x2bc1e6){return{'name':_0x2bc1e6['fieldName'],'type':_0x2bc1e6['type']['key']};});_0x4e1dcf[_0x15e1('0x2e')]=_[_0x15e1('0x2d')](_0x55513b,'name');_0x4e1dcf[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x201b53['query']);_0x4e1dcf[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x4e1dcf[_0x15e1('0x2e')],_0x4e1dcf[_0x15e1('0x2f')]);_0x40f5ef['attributes']=_[_0x15e1('0x32')](_0x4e1dcf[_0x15e1('0x2e')],qs['fields'](_0x201b53['query'][_0x15e1('0x33')]));_0x40f5ef['attributes']=_0x40f5ef['attributes']['length']?_0x40f5ef[_0x15e1('0x34')]:_0x4e1dcf[_0x15e1('0x2e')];if(!_0x201b53[_0x15e1('0x2f')][_0x15e1('0x35')](_0x15e1('0x36'))){_0x40f5ef[_0x15e1('0x1f')]=qs[_0x15e1('0x1f')](_0x201b53[_0x15e1('0x2f')][_0x15e1('0x1f')]);_0x40f5ef[_0x15e1('0x1e')]=qs[_0x15e1('0x1e')](_0x201b53[_0x15e1('0x2f')]['offset']);}_0x40f5ef['order']=qs['sort'](_0x201b53[_0x15e1('0x2f')]['sort']);_0x40f5ef[_0x15e1('0x37')]=qs['filters'](_['pick'](_0x201b53[_0x15e1('0x2f')],_0x4e1dcf[_0x15e1('0x31')]),_0x55513b);if(_0x201b53[_0x15e1('0x2f')][_0x15e1('0x38')]){_0x40f5ef[_0x15e1('0x37')]=_[_0x15e1('0x39')](_0x40f5ef['where'],{'$or':_[_0x15e1('0x2d')](_0x55513b,function(_0x350826){if(_0x350826['type']!=='VIRTUAL'){var _0x554329={};_0x554329[_0x350826[_0x15e1('0x2a')]]={'$like':'%'+_0x201b53[_0x15e1('0x2f')][_0x15e1('0x38')]+'%'};return _0x554329;}})});}_0x40f5ef=_[_0x15e1('0x39')]({},_0x40f5ef,_0x201b53[_0x15e1('0x3a')]);var _0x23cb2a={'where':_0x40f5ef[_0x15e1('0x37')]};return db['Trigger'][_0x15e1('0x1d')](_0x23cb2a)[_0x15e1('0x26')](function(_0x2c6734){_0x29f2a7['count']=_0x2c6734;if(_0x201b53[_0x15e1('0x2f')][_0x15e1('0x3b')]){_0x40f5ef[_0x15e1('0x3c')]=[{'all':!![]}];}return db[_0x15e1('0x3d')][_0x15e1('0x3e')](_0x40f5ef);})[_0x15e1('0x26')](function(_0x4c0997){_0x29f2a7[_0x15e1('0x3f')]=_0x4c0997;return _0x29f2a7;})['then'](respondWithFilteredResult(_0x16c14e,_0x40f5ef))['catch'](handleError(_0x16c14e,null));};exports[_0x15e1('0x40')]=function(_0x5d782e,_0x27c1a3){var _0x23e343={'raw':![],'where':{'id':_0x5d782e['params']['id']}},_0x1702b8={};_0x1702b8[_0x15e1('0x2e')]=_[_0x15e1('0x30')](db[_0x15e1('0x3d')][_0x15e1('0x41')]);_0x1702b8[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x5d782e[_0x15e1('0x2f')]);_0x1702b8['filters']=_[_0x15e1('0x32')](_0x1702b8[_0x15e1('0x2e')],_0x1702b8['query']);_0x23e343[_0x15e1('0x34')]=_['intersection'](_0x1702b8[_0x15e1('0x2e')],qs[_0x15e1('0x33')](_0x5d782e[_0x15e1('0x2f')]['fields']));_0x23e343[_0x15e1('0x34')]=_0x23e343['attributes'][_0x15e1('0x42')]?_0x23e343[_0x15e1('0x34')]:_0x1702b8[_0x15e1('0x2e')];if(_0x5d782e[_0x15e1('0x2f')]['includeAll']){_0x23e343[_0x15e1('0x3c')]=[{'all':!![]}];}_0x23e343=_[_0x15e1('0x39')]({},_0x23e343,_0x5d782e[_0x15e1('0x3a')]);return db[_0x15e1('0x3d')][_0x15e1('0x43')](_0x23e343)[_0x15e1('0x26')](handleEntityNotFound(_0x27c1a3,null))[_0x15e1('0x26')](respondWithResult(_0x27c1a3,null))[_0x15e1('0x44')](handleError(_0x27c1a3,null));};exports['create']=function(_0x53f9ef,_0x1abac3){return db[_0x15e1('0x3d')][_0x15e1('0x45')](_0x53f9ef[_0x15e1('0x46')],{})[_0x15e1('0x26')](function(_0x189a01){var _0x40a4f2=_0x53f9ef[_0x15e1('0x47')][_0x15e1('0x28')]({'plain':!![]});if(!_0x40a4f2)throw new Error(_0x15e1('0x48'));if(_0x40a4f2[_0x15e1('0x49')]===_0x15e1('0x47')){var _0x31a27e=_0x189a01['get']({'plain':!![]});var _0x42e3b2=_0x15e1('0x4a');return db['UserProfileSection'][_0x15e1('0x43')]({'where':{'name':_0x42e3b2,'userProfileId':_0x40a4f2[_0x15e1('0x4b')]},'raw':!![]})[_0x15e1('0x26')](function(_0x15012e){if(_0x15012e&&_0x15012e['autoAssociation']===0x0){return db[_0x15e1('0x4c')][_0x15e1('0x45')]({'name':_0x31a27e[_0x15e1('0x2a')],'resourceId':_0x31a27e['id'],'type':_0x15012e[_0x15e1('0x2a')],'sectionId':_0x15012e['id']},{})[_0x15e1('0x26')](function(){return _0x189a01;});}else{return _0x189a01;}})['catch'](function(_0x171db0){logger['error'](_0x15e1('0x4d'),_0x171db0);throw _0x171db0;});}return _0x189a01;})[_0x15e1('0x26')](respondWithResult(_0x1abac3,0xc9))[_0x15e1('0x44')](handleError(_0x1abac3,null));};exports[_0x15e1('0x25')]=function(_0x53863b,_0x161112){if(_0x53863b['body']['id']){delete _0x53863b['body']['id'];}return db[_0x15e1('0x3d')][_0x15e1('0x43')]({'where':{'id':_0x53863b[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x161112,null))[_0x15e1('0x26')](saveUpdates(_0x53863b[_0x15e1('0x46')],null))['then'](respondWithResult(_0x161112,null))[_0x15e1('0x44')](handleError(_0x161112,null));};exports[_0x15e1('0x27')]=function(_0x5cbc70,_0x2ff63c){return db[_0x15e1('0x3d')][_0x15e1('0x43')]({'where':{'id':_0x5cbc70[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x2ff63c,null))['then'](removeEntity(_0x2ff63c,null))['catch'](handleError(_0x2ff63c,null));};exports[_0x15e1('0x4f')]=function(_0x355803,_0x2a0981,_0x631c60){if(_0x355803[_0x15e1('0x46')]['id']){delete _0x355803[_0x15e1('0x46')]['id'];}return db[_0x15e1('0x3d')]['find']({'where':{'id':_0x355803[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x2a0981,null))['then'](function(_0x29f209){if(_0x29f209){_0x355803[_0x15e1('0x46')]['TriggerAllId']=_0x29f209['id'];return db[_0x15e1('0x50')][_0x15e1('0x45')](_0x355803[_0x15e1('0x46')]);}})[_0x15e1('0x26')](respondWithResult(_0x2a0981,null))[_0x15e1('0x44')](handleError(_0x2a0981,null));};exports['addAnyCondition']=function(_0x17a0ff,_0x4bb4ee,_0x2fb635){if(_0x17a0ff[_0x15e1('0x46')]['id']){delete _0x17a0ff[_0x15e1('0x46')]['id'];}return db['Trigger'][_0x15e1('0x43')]({'where':{'id':_0x17a0ff[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x4bb4ee,null))[_0x15e1('0x26')](function(_0x31bc5f){if(_0x31bc5f){_0x17a0ff[_0x15e1('0x46')][_0x15e1('0x51')]=_0x31bc5f['id'];return db[_0x15e1('0x50')][_0x15e1('0x45')](_0x17a0ff[_0x15e1('0x46')]);}})[_0x15e1('0x26')](respondWithResult(_0x4bb4ee,null))[_0x15e1('0x44')](handleError(_0x4bb4ee,null));};exports[_0x15e1('0x52')]=function(_0x18b6ec,_0x3a0bbb,_0x5f025f){var _0xffa5d2={};var _0x47a342={};var _0x209354;var _0x20282d;return db[_0x15e1('0x3d')]['findOne']({'where':{'id':_0x18b6ec[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x3a0bbb,null))['then'](function(_0x487293){if(_0x487293){_0x209354=_0x487293;_0x47a342[_0x15e1('0x2e')]=_['keys'](db[_0x15e1('0x50')][_0x15e1('0x41')]);_0x47a342[_0x15e1('0x2f')]=_['keys'](_0x18b6ec['query']);_0x47a342['filters']=_['intersection'](_0x47a342['model'],_0x47a342['query']);_0xffa5d2['attributes']=_[_0x15e1('0x32')](_0x47a342[_0x15e1('0x2e')],qs[_0x15e1('0x33')](_0x18b6ec[_0x15e1('0x2f')]['fields']));_0xffa5d2[_0x15e1('0x34')]=_0xffa5d2[_0x15e1('0x34')][_0x15e1('0x42')]?_0xffa5d2[_0x15e1('0x34')]:_0x47a342[_0x15e1('0x2e')];_0xffa5d2['order']=qs['sort'](_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x53')]);_0xffa5d2['where']=qs[_0x15e1('0x31')](_[_0x15e1('0x54')](_0x18b6ec[_0x15e1('0x2f')],_0x47a342[_0x15e1('0x31')]));if(_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x38')]){_0xffa5d2['where']=_['merge'](_0xffa5d2[_0x15e1('0x37')],{'$or':_[_0x15e1('0x2d')](_0xffa5d2[_0x15e1('0x34')],function(_0x1cad54){var _0x33f500={};_0x33f500[_0x1cad54]={'$like':'%'+_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x38')]+'%'};return _0x33f500;})});}_0xffa5d2=_[_0x15e1('0x39')]({},_0xffa5d2,_0x18b6ec[_0x15e1('0x3a')]);return _0x209354[_0x15e1('0x52')](_0xffa5d2);}})[_0x15e1('0x26')](function(_0x13a4f0){if(_0x13a4f0){_0x20282d=_0x13a4f0[_0x15e1('0x42')];if(!_0x18b6ec[_0x15e1('0x2f')][_0x15e1('0x35')](_0x15e1('0x36'))){_0xffa5d2['limit']=qs[_0x15e1('0x1f')](_0x18b6ec['query'][_0x15e1('0x1f')]);_0xffa5d2[_0x15e1('0x1e')]=qs[_0x15e1('0x1e')](_0x18b6ec['query']['offset']);}return _0x209354[_0x15e1('0x52')](_0xffa5d2);}})[_0x15e1('0x26')](function(_0x2bfddc){if(_0x2bfddc){return _0x2bfddc?{'count':_0x20282d,'rows':_0x2bfddc}:null;}})[_0x15e1('0x26')](respondWithResult(_0x3a0bbb,null))[_0x15e1('0x44')](handleError(_0x3a0bbb,null));};exports['getAnyConditions']=function(_0x157d01,_0x43c505,_0x62e148){var _0x313e86={};var _0x29c758={};var _0x411e6d;var _0x4551bb;return db[_0x15e1('0x3d')][_0x15e1('0x55')]({'where':{'id':_0x157d01[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x43c505,null))[_0x15e1('0x26')](function(_0x25646a){if(_0x25646a){_0x411e6d=_0x25646a;_0x29c758[_0x15e1('0x2e')]=_[_0x15e1('0x30')](db[_0x15e1('0x50')][_0x15e1('0x41')]);_0x29c758[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x157d01[_0x15e1('0x2f')]);_0x29c758[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x29c758[_0x15e1('0x2e')],_0x29c758[_0x15e1('0x2f')]);_0x313e86[_0x15e1('0x34')]=_[_0x15e1('0x32')](_0x29c758['model'],qs[_0x15e1('0x33')](_0x157d01[_0x15e1('0x2f')]['fields']));_0x313e86['attributes']=_0x313e86['attributes'][_0x15e1('0x42')]?_0x313e86[_0x15e1('0x34')]:_0x29c758[_0x15e1('0x2e')];_0x313e86['order']=qs[_0x15e1('0x53')](_0x157d01[_0x15e1('0x2f')][_0x15e1('0x53')]);_0x313e86[_0x15e1('0x37')]=qs['filters'](_[_0x15e1('0x54')](_0x157d01['query'],_0x29c758[_0x15e1('0x31')]));if(_0x157d01['query']['filter']){_0x313e86[_0x15e1('0x37')]=_[_0x15e1('0x39')](_0x313e86[_0x15e1('0x37')],{'$or':_[_0x15e1('0x2d')](_0x313e86['attributes'],function(_0x238b01){var _0x45bbd5={};_0x45bbd5[_0x238b01]={'$like':'%'+_0x157d01['query'][_0x15e1('0x38')]+'%'};return _0x45bbd5;})});}_0x313e86=_['merge']({},_0x313e86,_0x157d01[_0x15e1('0x3a')]);return _0x411e6d[_0x15e1('0x56')](_0x313e86);}})[_0x15e1('0x26')](function(_0x2e9baa){if(_0x2e9baa){_0x4551bb=_0x2e9baa[_0x15e1('0x42')];if(!_0x157d01[_0x15e1('0x2f')][_0x15e1('0x35')](_0x15e1('0x36'))){_0x313e86[_0x15e1('0x1f')]=qs['limit'](_0x157d01[_0x15e1('0x2f')][_0x15e1('0x1f')]);_0x313e86[_0x15e1('0x1e')]=qs[_0x15e1('0x1e')](_0x157d01[_0x15e1('0x2f')][_0x15e1('0x1e')]);}return _0x411e6d[_0x15e1('0x56')](_0x313e86);}})[_0x15e1('0x26')](function(_0x4099e7){if(_0x4099e7){return _0x4099e7?{'count':_0x4551bb,'rows':_0x4099e7}:null;}})[_0x15e1('0x26')](respondWithResult(_0x43c505,null))[_0x15e1('0x44')](handleError(_0x43c505,null));};exports[_0x15e1('0x57')]=function(_0x52b5a2,_0x2f573b,_0x1404fc){if(_0x52b5a2[_0x15e1('0x46')]['id']){delete _0x52b5a2[_0x15e1('0x46')]['id'];}return db[_0x15e1('0x3d')][_0x15e1('0x43')]({'where':{'id':_0x52b5a2[_0x15e1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2f573b,null))[_0x15e1('0x26')](function(_0x36e4cf){if(_0x36e4cf){_0x52b5a2[_0x15e1('0x46')][_0x15e1('0x58')]=_0x36e4cf['id'];return db[_0x15e1('0x59')][_0x15e1('0x45')](_0x52b5a2[_0x15e1('0x46')]);}})[_0x15e1('0x26')](respondWithResult(_0x2f573b,null))[_0x15e1('0x44')](handleError(_0x2f573b,null));};exports[_0x15e1('0x5a')]=function(_0x50d341,_0x1bafb2,_0x46fee4){var _0x391726={};var _0x295a7c={};var _0x1682d4;var _0x8d595a;return db[_0x15e1('0x3d')][_0x15e1('0x55')]({'where':{'id':_0x50d341[_0x15e1('0x4e')]['id']}})[_0x15e1('0x26')](handleEntityNotFound(_0x1bafb2,null))[_0x15e1('0x26')](function(_0x24b653){if(_0x24b653){_0x1682d4=_0x24b653;_0x295a7c['model']=_[_0x15e1('0x30')](db[_0x15e1('0x59')][_0x15e1('0x41')]);_0x295a7c[_0x15e1('0x2f')]=_[_0x15e1('0x30')](_0x50d341[_0x15e1('0x2f')]);_0x295a7c[_0x15e1('0x31')]=_[_0x15e1('0x32')](_0x295a7c[_0x15e1('0x2e')],_0x295a7c['query']);_0x391726[_0x15e1('0x34')]=_[_0x15e1('0x32')](_0x295a7c[_0x15e1('0x2e')],qs['fields'](_0x50d341[_0x15e1('0x2f')][_0x15e1('0x33')]));_0x391726[_0x15e1('0x34')]=_0x391726[_0x15e1('0x34')][_0x15e1('0x42')]?_0x391726['attributes']:_0x295a7c[_0x15e1('0x2e')];_0x391726[_0x15e1('0x5b')]=qs[_0x15e1('0x53')](_0x50d341[_0x15e1('0x2f')][_0x15e1('0x53')]);_0x391726[_0x15e1('0x37')]=qs[_0x15e1('0x31')](_[_0x15e1('0x54')](_0x50d341['query'],_0x295a7c[_0x15e1('0x31')]));if(_0x50d341[_0x15e1('0x2f')][_0x15e1('0x38')]){_0x391726[_0x15e1('0x37')]=_[_0x15e1('0x39')](_0x391726['where'],{'$or':_[_0x15e1('0x2d')](_0x391726[_0x15e1('0x34')],function(_0xd0a1e1){var _0x5e55a6={};_0x5e55a6[_0xd0a1e1]={'$like':'%'+_0x50d341[_0x15e1('0x2f')][_0x15e1('0x38')]+'%'};return _0x5e55a6;})});}_0x391726=_[_0x15e1('0x39')]({},_0x391726,_0x50d341[_0x15e1('0x3a')]);return _0x1682d4['getActions'](_0x391726);}})['then'](function(_0x24aefa){if(_0x24aefa){_0x8d595a=_0x24aefa['length'];if(!_0x50d341[_0x15e1('0x2f')]['hasOwnProperty'](_0x15e1('0x36'))){_0x391726[_0x15e1('0x1f')]=qs[_0x15e1('0x1f')](_0x50d341[_0x15e1('0x2f')]['limit']);_0x391726[_0x15e1('0x1e')]=qs['offset'](_0x50d341[_0x15e1('0x2f')][_0x15e1('0x1e')]);}return _0x1682d4[_0x15e1('0x5a')](_0x391726);}})[_0x15e1('0x26')](function(_0x3d19ef){if(_0x3d19ef){return _0x3d19ef?{'count':_0x8d595a,'rows':_0x3d19ef}:null;}})[_0x15e1('0x26')](respondWithResult(_0x1bafb2,null))[_0x15e1('0x44')](handleError(_0x1bafb2,null));}; \ No newline at end of file +var _0x5ed2=['TriggerAnyId','findOne','pick','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','type','merge','options','Trigger','include','findAll','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5ed2,0x114));var _0x25ed=function(_0x3da1c5,_0x53f43f){_0x3da1c5=_0x3da1c5-0x0;var _0x20d262=_0x5ed2[_0x3da1c5];return _0x20d262;};'use strict';var pdf=require(_0x25ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25ed('0x1'));var zipdir=require(_0x25ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25ed('0x3'));var moment=require(_0x25ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25ed('0x5'));var util=require(_0x25ed('0x6'));var path=require(_0x25ed('0x7'));var sox=require(_0x25ed('0x8'));var csv=require('to-csv');var ejs=require(_0x25ed('0x9'));var fs=require('fs');var _=require(_0x25ed('0xa'));var squel=require(_0x25ed('0xb'));var crypto=require(_0x25ed('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x25ed('0xd'));var Redis=require(_0x25ed('0xe'));var authService=require(_0x25ed('0xf'));var qs=require(_0x25ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25ed('0x11'));var logger=require(_0x25ed('0x12'))(_0x25ed('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x25ed('0x14'));var db=require(_0x25ed('0x15'))['db'];function respondWithStatusCode(_0x1530e0,_0x623120){_0x623120=_0x623120||0xcc;return function(_0x187a10){if(_0x187a10){return _0x1530e0[_0x25ed('0x16')](_0x623120);}return _0x1530e0['status'](_0x623120)[_0x25ed('0x17')]();};}function respondWithResult(_0xbdc943,_0x4730c5){_0x4730c5=_0x4730c5||0xc8;return function(_0x54c37c){if(_0x54c37c){return _0xbdc943[_0x25ed('0x18')](_0x4730c5)['json'](_0x54c37c);}};}function respondWithFilteredResult(_0x3e9b5e,_0x7244b7){return function(_0x43e295){if(_0x43e295){var _0x551342=_0x43e295[_0x25ed('0x19')],_0xfabdb=_0x7244b7[_0x25ed('0x1a')],_0x419076=_0x7244b7[_0x25ed('0x1a')]+_0x7244b7['limit'],_0x1796d8;if(_0x419076>=_0x551342){_0x419076=_0x551342;_0x1796d8=0xc8;}else{_0x1796d8=0xce;}_0x3e9b5e[_0x25ed('0x18')](_0x1796d8);return _0x3e9b5e[_0x25ed('0x1b')]('Content-Range',_0xfabdb+'-'+_0x419076+'/'+_0x551342)[_0x25ed('0x1c')](_0x43e295);}return null;};}function patchUpdates(_0x3a144b){return function(_0x3ec467){try{jsonpatch['apply'](_0x3ec467,_0x3a144b,!![]);}catch(_0x1a079c){return BPromise[_0x25ed('0x1d')](_0x1a079c);}return _0x3ec467[_0x25ed('0x1e')]();};}function saveUpdates(_0x2fb6ba,_0xc04e54){return function(_0x2bff09){if(_0x2bff09){return _0x2bff09[_0x25ed('0x1f')](_0x2fb6ba)[_0x25ed('0x20')](function(_0x24f315){return _0x24f315;});}return null;};}function removeEntity(_0x3414ac,_0x3bc398){return function(_0x4a8135){if(_0x4a8135){return _0x4a8135[_0x25ed('0x21')]()[_0x25ed('0x20')](function(){var _0x402010=_0x4a8135[_0x25ed('0x22')]({'plain':!![]});var _0x1e33f1='Triggers';return db[_0x25ed('0x23')][_0x25ed('0x21')]({'where':{'type':_0x1e33f1,'resourceId':_0x402010['id']}})[_0x25ed('0x20')](function(){return _0x4a8135;});})[_0x25ed('0x20')](function(){_0x3414ac['status'](0xcc)[_0x25ed('0x17')]();});}};}function handleEntityNotFound(_0x225916,_0x1dcb61){return function(_0x5cd61f){if(!_0x5cd61f){_0x225916['sendStatus'](0x194);}return _0x5cd61f;};}function handleError(_0x35b206,_0x5141ba){_0x5141ba=_0x5141ba||0x1f4;return function(_0x2e7de5){logger[_0x25ed('0x24')](_0x2e7de5['stack']);if(_0x2e7de5[_0x25ed('0x25')]){delete _0x2e7de5[_0x25ed('0x25')];}_0x35b206['status'](_0x5141ba)[_0x25ed('0x26')](_0x2e7de5);};}exports[_0x25ed('0x27')]=function(_0x31bde0,_0x6f3d9){var _0x26cac4={},_0x1988a4={},_0x35f14c={'count':0x0,'rows':[]};var _0x47c592=_[_0x25ed('0x28')](db['Trigger'][_0x25ed('0x29')],function(_0xc64318){return{'name':_0xc64318[_0x25ed('0x2a')],'type':_0xc64318['type'][_0x25ed('0x2b')]};});_0x1988a4['model']=_[_0x25ed('0x28')](_0x47c592,_0x25ed('0x25'));_0x1988a4[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x31bde0['query']);_0x1988a4[_0x25ed('0x2e')]=_[_0x25ed('0x2f')](_0x1988a4[_0x25ed('0x30')],_0x1988a4[_0x25ed('0x2c')]);_0x26cac4[_0x25ed('0x31')]=_['intersection'](_0x1988a4[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x32')]));_0x26cac4[_0x25ed('0x31')]=_0x26cac4[_0x25ed('0x31')][_0x25ed('0x33')]?_0x26cac4[_0x25ed('0x31')]:_0x1988a4[_0x25ed('0x30')];if(!_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x34')](_0x25ed('0x35'))){_0x26cac4['limit']=qs[_0x25ed('0x36')](_0x31bde0['query'][_0x25ed('0x36')]);_0x26cac4[_0x25ed('0x1a')]=qs['offset'](_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x1a')]);}_0x26cac4[_0x25ed('0x37')]=qs[_0x25ed('0x38')](_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x26cac4['where']=qs[_0x25ed('0x2e')](_['pick'](_0x31bde0[_0x25ed('0x2c')],_0x1988a4['filters']),_0x47c592);if(_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x39')]){_0x26cac4[_0x25ed('0x3a')]=_['merge'](_0x26cac4[_0x25ed('0x3a')],{'$or':_[_0x25ed('0x28')](_0x47c592,function(_0x2c8cd9){if(_0x2c8cd9[_0x25ed('0x3b')]!=='VIRTUAL'){var _0x2a56c7={};_0x2a56c7[_0x2c8cd9[_0x25ed('0x25')]]={'$like':'%'+_0x31bde0[_0x25ed('0x2c')][_0x25ed('0x39')]+'%'};return _0x2a56c7;}})});}_0x26cac4=_[_0x25ed('0x3c')]({},_0x26cac4,_0x31bde0[_0x25ed('0x3d')]);var _0x2301ad={'where':_0x26cac4[_0x25ed('0x3a')]};return db[_0x25ed('0x3e')][_0x25ed('0x19')](_0x2301ad)['then'](function(_0x4be845){_0x35f14c[_0x25ed('0x19')]=_0x4be845;if(_0x31bde0[_0x25ed('0x2c')]['includeAll']){_0x26cac4[_0x25ed('0x3f')]=[{'all':!![]}];}return db[_0x25ed('0x3e')][_0x25ed('0x40')](_0x26cac4);})[_0x25ed('0x20')](function(_0x2002ea){_0x35f14c['rows']=_0x2002ea;return _0x35f14c;})[_0x25ed('0x20')](respondWithFilteredResult(_0x6f3d9,_0x26cac4))[_0x25ed('0x41')](handleError(_0x6f3d9,null));};exports[_0x25ed('0x42')]=function(_0x560235,_0x29d252){var _0x59af90={'raw':![],'where':{'id':_0x560235[_0x25ed('0x43')]['id']}},_0x5101ec={};_0x5101ec[_0x25ed('0x30')]=_[_0x25ed('0x2d')](db['Trigger'][_0x25ed('0x29')]);_0x5101ec[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x560235[_0x25ed('0x2c')]);_0x5101ec[_0x25ed('0x2e')]=_[_0x25ed('0x2f')](_0x5101ec[_0x25ed('0x30')],_0x5101ec['query']);_0x59af90['attributes']=_[_0x25ed('0x2f')](_0x5101ec[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x560235[_0x25ed('0x2c')]['fields']));_0x59af90[_0x25ed('0x31')]=_0x59af90[_0x25ed('0x31')]['length']?_0x59af90[_0x25ed('0x31')]:_0x5101ec['model'];if(_0x560235['query'][_0x25ed('0x44')]){_0x59af90['include']=[{'all':!![]}];}_0x59af90=_[_0x25ed('0x3c')]({},_0x59af90,_0x560235['options']);return db['Trigger'][_0x25ed('0x45')](_0x59af90)[_0x25ed('0x20')](handleEntityNotFound(_0x29d252,null))['then'](respondWithResult(_0x29d252,null))[_0x25ed('0x41')](handleError(_0x29d252,null));};exports[_0x25ed('0x46')]=function(_0x56a572,_0x50bcb5){return db[_0x25ed('0x3e')][_0x25ed('0x46')](_0x56a572['body'],{})[_0x25ed('0x20')](function(_0x874493){var _0x2154fd=_0x56a572['user'][_0x25ed('0x22')]({'plain':!![]});if(!_0x2154fd)throw new Error(_0x25ed('0x47'));if(_0x2154fd[_0x25ed('0x48')]===_0x25ed('0x49')){var _0x5a6d45=_0x874493[_0x25ed('0x22')]({'plain':!![]});var _0x2f030b='Triggers';return db[_0x25ed('0x4a')][_0x25ed('0x45')]({'where':{'name':_0x2f030b,'userProfileId':_0x2154fd['userProfileId']},'raw':!![]})['then'](function(_0x423ca2){if(_0x423ca2&&_0x423ca2['autoAssociation']===0x0){return db[_0x25ed('0x23')]['create']({'name':_0x5a6d45[_0x25ed('0x25')],'resourceId':_0x5a6d45['id'],'type':_0x423ca2[_0x25ed('0x25')],'sectionId':_0x423ca2['id']},{})[_0x25ed('0x20')](function(){return _0x874493;});}else{return _0x874493;}})[_0x25ed('0x41')](function(_0x4d9615){logger[_0x25ed('0x24')](_0x25ed('0x4b'),_0x4d9615);throw _0x4d9615;});}return _0x874493;})[_0x25ed('0x20')](respondWithResult(_0x50bcb5,0xc9))['catch'](handleError(_0x50bcb5,null));};exports[_0x25ed('0x1f')]=function(_0x536d29,_0x2ed575){if(_0x536d29[_0x25ed('0x4c')]['id']){delete _0x536d29['body']['id'];}return db[_0x25ed('0x3e')]['find']({'where':{'id':_0x536d29[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x2ed575,null))[_0x25ed('0x20')](saveUpdates(_0x536d29[_0x25ed('0x4c')],null))[_0x25ed('0x20')](respondWithResult(_0x2ed575,null))['catch'](handleError(_0x2ed575,null));};exports[_0x25ed('0x21')]=function(_0x45ed31,_0x1d41a7){return db[_0x25ed('0x3e')][_0x25ed('0x45')]({'where':{'id':_0x45ed31['params']['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x1d41a7,null))[_0x25ed('0x20')](removeEntity(_0x1d41a7,null))['catch'](handleError(_0x1d41a7,null));};exports[_0x25ed('0x4d')]=function(_0x224785,_0x167bcb,_0xbd46f3){if(_0x224785[_0x25ed('0x4c')]['id']){delete _0x224785[_0x25ed('0x4c')]['id'];}return db['Trigger'][_0x25ed('0x45')]({'where':{'id':_0x224785[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x167bcb,null))[_0x25ed('0x20')](function(_0x12de91){if(_0x12de91){_0x224785[_0x25ed('0x4c')][_0x25ed('0x4e')]=_0x12de91['id'];return db[_0x25ed('0x4f')][_0x25ed('0x46')](_0x224785[_0x25ed('0x4c')]);}})[_0x25ed('0x20')](respondWithResult(_0x167bcb,null))[_0x25ed('0x41')](handleError(_0x167bcb,null));};exports['addAnyCondition']=function(_0x2341ca,_0x4da499,_0x5cd163){if(_0x2341ca['body']['id']){delete _0x2341ca[_0x25ed('0x4c')]['id'];}return db[_0x25ed('0x3e')]['find']({'where':{'id':_0x2341ca[_0x25ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x4da499,null))['then'](function(_0x3dbe29){if(_0x3dbe29){_0x2341ca[_0x25ed('0x4c')][_0x25ed('0x50')]=_0x3dbe29['id'];return db['Condition'][_0x25ed('0x46')](_0x2341ca[_0x25ed('0x4c')]);}})[_0x25ed('0x20')](respondWithResult(_0x4da499,null))[_0x25ed('0x41')](handleError(_0x4da499,null));};exports['getAllConditions']=function(_0x3ac514,_0x45c000,_0x33c594){var _0x101403={};var _0x3c8264={};var _0x16a32f;var _0x12eceb;return db[_0x25ed('0x3e')][_0x25ed('0x51')]({'where':{'id':_0x3ac514[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x45c000,null))[_0x25ed('0x20')](function(_0x3d1ab8){if(_0x3d1ab8){_0x16a32f=_0x3d1ab8;_0x3c8264[_0x25ed('0x30')]=_[_0x25ed('0x2d')](db[_0x25ed('0x4f')]['rawAttributes']);_0x3c8264[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x3ac514[_0x25ed('0x2c')]);_0x3c8264['filters']=_['intersection'](_0x3c8264[_0x25ed('0x30')],_0x3c8264[_0x25ed('0x2c')]);_0x101403[_0x25ed('0x31')]=_[_0x25ed('0x2f')](_0x3c8264['model'],qs[_0x25ed('0x32')](_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x32')]));_0x101403[_0x25ed('0x31')]=_0x101403['attributes']['length']?_0x101403['attributes']:_0x3c8264['model'];_0x101403[_0x25ed('0x37')]=qs['sort'](_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x101403[_0x25ed('0x3a')]=qs['filters'](_[_0x25ed('0x52')](_0x3ac514[_0x25ed('0x2c')],_0x3c8264[_0x25ed('0x2e')]));if(_0x3ac514['query'][_0x25ed('0x39')]){_0x101403[_0x25ed('0x3a')]=_['merge'](_0x101403[_0x25ed('0x3a')],{'$or':_['map'](_0x101403[_0x25ed('0x31')],function(_0x4a8485){var _0x588630={};_0x588630[_0x4a8485]={'$like':'%'+_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x39')]+'%'};return _0x588630;})});}_0x101403=_['merge']({},_0x101403,_0x3ac514['options']);return _0x16a32f[_0x25ed('0x53')](_0x101403);}})[_0x25ed('0x20')](function(_0x1fed33){if(_0x1fed33){_0x12eceb=_0x1fed33[_0x25ed('0x33')];if(!_0x3ac514[_0x25ed('0x2c')][_0x25ed('0x34')]('nolimit')){_0x101403['limit']=qs[_0x25ed('0x36')](_0x3ac514[_0x25ed('0x2c')]['limit']);_0x101403[_0x25ed('0x1a')]=qs[_0x25ed('0x1a')](_0x3ac514['query'][_0x25ed('0x1a')]);}return _0x16a32f[_0x25ed('0x53')](_0x101403);}})[_0x25ed('0x20')](function(_0x3ac796){if(_0x3ac796){return _0x3ac796?{'count':_0x12eceb,'rows':_0x3ac796}:null;}})[_0x25ed('0x20')](respondWithResult(_0x45c000,null))['catch'](handleError(_0x45c000,null));};exports[_0x25ed('0x54')]=function(_0x5bb0b8,_0x3e54e8,_0x5d2413){var _0x4c4d4e={};var _0x319f54={};var _0xe1a35;var _0x462049;return db[_0x25ed('0x3e')]['findOne']({'where':{'id':_0x5bb0b8[_0x25ed('0x43')]['id']}})[_0x25ed('0x20')](handleEntityNotFound(_0x3e54e8,null))[_0x25ed('0x20')](function(_0x1c5a0c){if(_0x1c5a0c){_0xe1a35=_0x1c5a0c;_0x319f54['model']=_[_0x25ed('0x2d')](db[_0x25ed('0x4f')][_0x25ed('0x29')]);_0x319f54[_0x25ed('0x2c')]=_['keys'](_0x5bb0b8['query']);_0x319f54['filters']=_[_0x25ed('0x2f')](_0x319f54[_0x25ed('0x30')],_0x319f54[_0x25ed('0x2c')]);_0x4c4d4e['attributes']=_['intersection'](_0x319f54[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x32')]));_0x4c4d4e[_0x25ed('0x31')]=_0x4c4d4e[_0x25ed('0x31')][_0x25ed('0x33')]?_0x4c4d4e['attributes']:_0x319f54[_0x25ed('0x30')];_0x4c4d4e[_0x25ed('0x37')]=qs[_0x25ed('0x38')](_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x4c4d4e[_0x25ed('0x3a')]=qs[_0x25ed('0x2e')](_['pick'](_0x5bb0b8[_0x25ed('0x2c')],_0x319f54['filters']));if(_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x39')]){_0x4c4d4e[_0x25ed('0x3a')]=_[_0x25ed('0x3c')](_0x4c4d4e[_0x25ed('0x3a')],{'$or':_[_0x25ed('0x28')](_0x4c4d4e[_0x25ed('0x31')],function(_0x86177a){var _0x68f3c2={};_0x68f3c2[_0x86177a]={'$like':'%'+_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x39')]+'%'};return _0x68f3c2;})});}_0x4c4d4e=_['merge']({},_0x4c4d4e,_0x5bb0b8[_0x25ed('0x3d')]);return _0xe1a35['getAnyConditions'](_0x4c4d4e);}})[_0x25ed('0x20')](function(_0x18f138){if(_0x18f138){_0x462049=_0x18f138['length'];if(!_0x5bb0b8[_0x25ed('0x2c')]['hasOwnProperty'](_0x25ed('0x35'))){_0x4c4d4e[_0x25ed('0x36')]=qs[_0x25ed('0x36')](_0x5bb0b8[_0x25ed('0x2c')]['limit']);_0x4c4d4e['offset']=qs['offset'](_0x5bb0b8[_0x25ed('0x2c')][_0x25ed('0x1a')]);}return _0xe1a35[_0x25ed('0x54')](_0x4c4d4e);}})[_0x25ed('0x20')](function(_0xc32ed){if(_0xc32ed){return _0xc32ed?{'count':_0x462049,'rows':_0xc32ed}:null;}})['then'](respondWithResult(_0x3e54e8,null))['catch'](handleError(_0x3e54e8,null));};exports[_0x25ed('0x55')]=function(_0x1ccd63,_0x372215,_0x1c68f4){if(_0x1ccd63[_0x25ed('0x4c')]['id']){delete _0x1ccd63[_0x25ed('0x4c')]['id'];}return db[_0x25ed('0x3e')][_0x25ed('0x45')]({'where':{'id':_0x1ccd63[_0x25ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x372215,null))[_0x25ed('0x20')](function(_0x2b786a){if(_0x2b786a){_0x1ccd63['body'][_0x25ed('0x56')]=_0x2b786a['id'];return db[_0x25ed('0x57')][_0x25ed('0x46')](_0x1ccd63['body']);}})['then'](respondWithResult(_0x372215,null))[_0x25ed('0x41')](handleError(_0x372215,null));};exports[_0x25ed('0x58')]=function(_0x5d2733,_0x449012,_0x229042){var _0x6e2206={};var _0x1b0982={};var _0x375485;var _0x52174d;return db[_0x25ed('0x3e')][_0x25ed('0x51')]({'where':{'id':_0x5d2733[_0x25ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x449012,null))[_0x25ed('0x20')](function(_0x2ce969){if(_0x2ce969){_0x375485=_0x2ce969;_0x1b0982[_0x25ed('0x30')]=_[_0x25ed('0x2d')](db[_0x25ed('0x57')][_0x25ed('0x29')]);_0x1b0982[_0x25ed('0x2c')]=_[_0x25ed('0x2d')](_0x5d2733[_0x25ed('0x2c')]);_0x1b0982[_0x25ed('0x2e')]=_[_0x25ed('0x2f')](_0x1b0982[_0x25ed('0x30')],_0x1b0982['query']);_0x6e2206[_0x25ed('0x31')]=_[_0x25ed('0x2f')](_0x1b0982[_0x25ed('0x30')],qs[_0x25ed('0x32')](_0x5d2733['query'][_0x25ed('0x32')]));_0x6e2206[_0x25ed('0x31')]=_0x6e2206['attributes']['length']?_0x6e2206['attributes']:_0x1b0982[_0x25ed('0x30')];_0x6e2206['order']=qs[_0x25ed('0x38')](_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x38')]);_0x6e2206[_0x25ed('0x3a')]=qs[_0x25ed('0x2e')](_[_0x25ed('0x52')](_0x5d2733['query'],_0x1b0982['filters']));if(_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x39')]){_0x6e2206['where']=_['merge'](_0x6e2206[_0x25ed('0x3a')],{'$or':_[_0x25ed('0x28')](_0x6e2206['attributes'],function(_0x1ad12f){var _0x2b7900={};_0x2b7900[_0x1ad12f]={'$like':'%'+_0x5d2733[_0x25ed('0x2c')]['filter']+'%'};return _0x2b7900;})});}_0x6e2206=_[_0x25ed('0x3c')]({},_0x6e2206,_0x5d2733[_0x25ed('0x3d')]);return _0x375485[_0x25ed('0x58')](_0x6e2206);}})[_0x25ed('0x20')](function(_0x8c17e3){if(_0x8c17e3){_0x52174d=_0x8c17e3[_0x25ed('0x33')];if(!_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x34')]('nolimit')){_0x6e2206[_0x25ed('0x36')]=qs['limit'](_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x36')]);_0x6e2206[_0x25ed('0x1a')]=qs[_0x25ed('0x1a')](_0x5d2733[_0x25ed('0x2c')][_0x25ed('0x1a')]);}return _0x375485['getActions'](_0x6e2206);}})['then'](function(_0x4ffb56){if(_0x4ffb56){return _0x4ffb56?{'count':_0x52174d,'rows':_0x4ffb56}:null;}})[_0x25ed('0x20')](respondWithResult(_0x449012,null))[_0x25ed('0x41')](handleError(_0x449012,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1e35886..7913704 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 _0x677b=['moment','request-promise','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','../../config/logger'];(function(_0x31e982,_0x521c6a){var _0x3efb59=function(_0x9a5416){while(--_0x9a5416){_0x31e982['push'](_0x31e982['shift']());}};_0x3efb59(++_0x521c6a);}(_0x677b,0x1d3));var _0xb677=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x677b[_0x587fb5];return _0x551105;};'use strict';var _=require(_0xb677('0x0'));var util=require(_0xb677('0x1'));var logger=require(_0xb677('0x2'))('api');var moment=require(_0xb677('0x3'));var BPromise=require('bluebird');var rp=require(_0xb677('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb677('0x5'));var attributes=require(_0xb677('0x6'));module[_0xb677('0x7')]=function(_0x4679c5,_0x4d251c){return _0x4679c5['define'](_0xb677('0x8'),attributes,{'tableName':_0xb677('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf23d=['rimraf','../../config/environment','./trigger.attributes','define','Trigger','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf23d,0xd1));var _0xdf23=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xf23d[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xdf23('0x0'));var util=require('util');var logger=require(_0xdf23('0x1'))(_0xdf23('0x2'));var moment=require(_0xdf23('0x3'));var BPromise=require(_0xdf23('0x4'));var rp=require(_0xdf23('0x5'));var fs=require('fs');var path=require(_0xdf23('0x6'));var rimraf=require(_0xdf23('0x7'));var config=require(_0xdf23('0x8'));var attributes=require(_0xdf23('0x9'));module['exports']=function(_0x3fef08,_0x49c9f3){return _0x3fef08[_0xdf23('0xa')](_0xdf23('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 8a3a9ec..7020363 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 _0x3de3=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','findAll','options','raw','where','include','map','model','attributes','ShowTrigger','Trigger','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x20e8e2,_0x56f78a){var _0x50f868=function(_0x24d74e){while(--_0x24d74e){_0x20e8e2['push'](_0x20e8e2['shift']());}};_0x50f868(++_0x56f78a);}(_0x3de3,0x1ce));var _0x33de=function(_0x38aa8d,_0x19e3e0){_0x38aa8d=_0x38aa8d-0x0;var _0x1b1683=_0x3de3[_0x38aa8d];return _0x1b1683;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['Trigger'][_0x33de('0x17')]({'raw':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x1a')]||null:null,'attributes':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')]['attributes']||null:null,'limit':_0x52cfa0['options']?_0x52cfa0[_0x33de('0x18')]['limit']||null:null,'include':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0['options'][_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x52cfa0['options'][_0x33de('0x1b')],function(_0x5cd77e){return{'model':db[_0x5cd77e[_0x33de('0x1d')]],'as':_0x5cd77e['as'],'attributes':_0x5cd77e['attributes'],'include':_0x5cd77e[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x5cd77e[_0x33de('0x1b')],function(_0x5b79d7){return{'model':db[_0x5b79d7[_0x33de('0x1d')]],'as':_0x5b79d7['as'],'attributes':_0x5b79d7[_0x33de('0x1e')],'include':_0x5b79d7[_0x33de('0x1b')]?_['map'](_0x5b79d7[_0x33de('0x1b')],function(_0x5585a2){return{'model':db[_0x5585a2['model']],'as':_0x5585a2['as'],'attributes':_0x5585a2[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x1a870a){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger[_0x33de('0xe')](_0x33de('0x16'),_0x52cfa0,JSON[_0x33de('0x10')](_0x1a870a));_0x201ff3(_0x1a870a);})['catch'](function(_0x5ae0e8){logger[_0x33de('0x11')](_0x33de('0x16'),_0x5ae0e8[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7[_0x33de('0x11')](0x1f4,_0x5ae0e8[_0x33de('0x13')]));});});};exports[_0x33de('0x1f')]=function(_0x427e82){var _0x4e1898=this;return new Promise(function(_0x282158,_0x1cee91){return db[_0x33de('0x20')][_0x33de('0x21')]({'raw':_0x427e82['options']?_0x427e82[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![],'where':_0x427e82['options']?_0x427e82['options']['where']||null:null,'attributes':_0x427e82[_0x33de('0x18')]?_0x427e82[_0x33de('0x18')]['attributes']||null:null,'include':_0x427e82[_0x33de('0x18')]?_0x427e82['options']['include']?_[_0x33de('0x1c')](_0x427e82[_0x33de('0x18')][_0x33de('0x1b')],function(_0x335794){return{'model':db[_0x335794[_0x33de('0x1d')]],'as':_0x335794['as'],'attributes':_0x335794[_0x33de('0x1e')],'include':_0x335794[_0x33de('0x1b')]?_[_0x33de('0x1c')](_0x335794['include'],function(_0x26d2a5){return{'model':db[_0x26d2a5['model']],'as':_0x26d2a5['as'],'attributes':_0x26d2a5[_0x33de('0x1e')],'include':_0x26d2a5['include']?_['map'](_0x26d2a5[_0x33de('0x1b')],function(_0x3614e0){return{'model':db[_0x3614e0[_0x33de('0x1d')]],'as':_0x3614e0['as'],'attributes':_0x3614e0[_0x33de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x33de('0xb')](function(_0x173ae6){logger['info'](_0x33de('0x1f'),_0x427e82);logger[_0x33de('0xe')](_0x33de('0x1f'),_0x427e82,JSON[_0x33de('0x10')](_0x173ae6));_0x282158(_0x173ae6);})[_0x33de('0x15')](function(_0x9f5688){logger[_0x33de('0x11')]('ShowTrigger',_0x9f5688[_0x33de('0x13')],_0x427e82);_0x1cee91(_0x4e1898[_0x33de('0x11')](0x1f4,_0x9f5688[_0x33de('0x13')]));});});}; \ No newline at end of file +var _0x13f6=['debug','stringify','error','code','message','info','result','GetTrigger','Trigger','findAll','options','limit','include','map','model','attributes','ShowTrigger','find','raw','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent'];(function(_0x1d2064,_0x47aef1){var _0x269138=function(_0xe10ada){while(--_0xe10ada){_0x1d2064['push'](_0x1d2064['shift']());}};_0x269138(++_0x47aef1);}(_0x13f6,0x124));var _0x613f=function(_0x336a7e,_0x4af2ca){_0x336a7e=_0x336a7e-0x0;var _0x587ba1=_0x13f6[_0x336a7e];return _0x587ba1;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('Trigger,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('Trigger,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')]({'raw':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['where']||null:null,'attributes':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')]['attributes']||null:null,'limit':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')][_0x613f('0x19')]||null:null,'include':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x4f9dae[_0x613f('0x18')]['include'],function(_0x41104e){return{'model':db[_0x41104e[_0x613f('0x1c')]],'as':_0x41104e['as'],'attributes':_0x41104e[_0x613f('0x1d')],'include':_0x41104e[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x41104e['include'],function(_0x30fb15){return{'model':db[_0x30fb15[_0x613f('0x1c')]],'as':_0x30fb15['as'],'attributes':_0x30fb15['attributes'],'include':_0x30fb15[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x30fb15[_0x613f('0x1a')],function(_0x4a878d){return{'model':db[_0x4a878d['model']],'as':_0x4a878d['as'],'attributes':_0x4a878d['attributes']};}):[]};}):[]};}):[]:[]})[_0x613f('0xb')](function(_0x594c28){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x594c28));_0x1e5a11(_0x594c28);})['catch'](function(_0x4cff5d){logger['error'](_0x613f('0x15'),_0x4cff5d[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x4cff5d['message']));});});};exports[_0x613f('0x1e')]=function(_0x439478){var _0xd335a6=this;return new Promise(function(_0x19bb8f,_0x4f8500){return db[_0x613f('0x16')][_0x613f('0x1f')]({'raw':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')][_0x613f('0x20')]===undefined?!![]:![]:!![],'where':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x21')]||null:null,'attributes':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')]['attributes']||null:null,'include':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x439478[_0x613f('0x18')][_0x613f('0x1a')],function(_0x2bceaa){return{'model':db[_0x2bceaa[_0x613f('0x1c')]],'as':_0x2bceaa['as'],'attributes':_0x2bceaa['attributes'],'include':_0x2bceaa[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x2bceaa[_0x613f('0x1a')],function(_0x25b2e4){return{'model':db[_0x25b2e4[_0x613f('0x1c')]],'as':_0x25b2e4['as'],'attributes':_0x25b2e4['attributes'],'include':_0x25b2e4['include']?_['map'](_0x25b2e4[_0x613f('0x1a')],function(_0x72c804){return{'model':db[_0x72c804[_0x613f('0x1c')]],'as':_0x72c804['as'],'attributes':_0x72c804[_0x613f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fc02e){logger[_0x613f('0x13')]('ShowTrigger',_0x439478);logger[_0x613f('0xe')]('ShowTrigger',_0x439478,JSON[_0x613f('0xf')](_0x2fc02e));_0x19bb8f(_0x2fc02e);})['catch'](function(_0x36dfd4){logger['error'](_0x613f('0x1e'),_0x36dfd4[_0x613f('0x12')],_0x439478);_0x4f8500(_0xd335a6[_0x613f('0x10')](0x1f4,_0x36dfd4['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e68c313..2f02986 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 _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy'];(function(_0x2ade3e,_0x505087){var _0x4d648c=function(_0x3afb53){while(--_0x3afb53){_0x2ade3e['push'](_0x2ade3e['shift']());}};_0x4d648c(++_0x505087);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0xf2ca[_0x15f8ad];return _0xc0238a;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id/clone',auth[_0xaf2c('0x9')](),controller['clone']);router[_0xaf2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller['update']);router['delete'](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller[_0xaf2c('0x11')]);module[_0xaf2c('0x12')]=router; \ No newline at end of file +var _0x0e85=['connect-timeout','express','../../config/environment','get','isAuthenticated','index','show','post','/:id/clone','clone','create','put','/:id','update','delete','exports','multer','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0e85,0x7c));var _0x50e8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0e85[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./trunk.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/:id',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x9')](_0x50e8('0xa'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xb')]);router['post']('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0xd')](_0x50e8('0xe'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')](_0x50e8('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x50e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 4f4d4c2..9bd3a1c 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 _0x39fd=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm'];(function(_0x80fc01,_0x3f8ecd){var _0x854b02=function(_0x243329){while(--_0x243329){_0x80fc01['push'](_0x80fc01['shift']());}};_0x854b02(++_0x3f8ecd);}(_0x39fd,0x13e));var _0xd39f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39fd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xd39f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd39f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x3'),_0xd39f('0x4'),_0xd39f('0x5')),'allowNull':![],'defaultValue':_0xd39f('0x3')},'context':{'type':Sequelize[_0xd39f('0x6')],'allowNull':![],'defaultValue':_0xd39f('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xd39f('0x8'),_0xd39f('0x9'),'ALLOWED_FAILED_SCREEN',_0xd39f('0xa'),_0xd39f('0xb'),'PROHIB_PASSED_SCREEN',_0xd39f('0xc'),_0xd39f('0xd'))},'deny':{'type':Sequelize[_0xd39f('0x6')]},'permit':{'type':Sequelize[_0xd39f('0x6')]},'secret':{'type':Sequelize[_0xd39f('0x6')]},'md5secret':{'type':Sequelize[_0xd39f('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd39f('0xe'),'set':function(_0x270890){this[_0xd39f('0xf')](_0xd39f('0x10'),_0x270890?_0x270890[_0xd39f('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xd39f('0x10'))?this[_0xd39f('0x12')](_0xd39f('0x10'))[_0xd39f('0x13')](','):null;},'comment':_0xd39f('0x14')},'dtmfmode':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x15'),'info','shortinfo',_0xd39f('0x16'),_0xd39f('0x17')),'defaultValue':_0xd39f('0x15')},'directmedia':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x19'),_0xd39f('0x1a'),_0xd39f('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd39f('0x6')]},'directmediadeny':{'type':Sequelize[_0xd39f('0x6')]},'nat':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':_0xd39f('0x1c'),'set':function(_0x16df61){this['setDataValue'](_0xd39f('0x1d'),_0x16df61?_0x16df61[_0xd39f('0x11')](','):null);},'get':function(){return this[_0xd39f('0x12')](_0xd39f('0x1d'))?this[_0xd39f('0x12')](_0xd39f('0x1d'))[_0xd39f('0x13')](','):null;},'comment':_0xd39f('0x1e')},'callgroup':{'type':Sequelize[_0xd39f('0x6')]},'namedcallgroup':{'type':Sequelize[_0xd39f('0x6')]},'pickupgroup':{'type':Sequelize[_0xd39f('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xd39f('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd39f('0x6')],'allowNull':![],'defaultValue':_0xd39f('0x1f'),'set':function(_0x5251e1){this['setDataValue'](_0xd39f('0x20'),_0x5251e1?_0x5251e1[_0xd39f('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xd39f('0x20'))?this[_0xd39f('0x12')](_0xd39f('0x20'))['split'](';'):null;},'comment':_0xd39f('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no')},'insecure':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':_0xd39f('0x22'),'set':function(_0x1f7d7f){this[_0xd39f('0xf')](_0xd39f('0x23'),_0x1f7d7f?_0x1f7d7f[_0xd39f('0x11')](','):null);},'get':function(){return this[_0xd39f('0x12')](_0xd39f('0x23'))?this[_0xd39f('0x12')](_0xd39f('0x23'))[_0xd39f('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xd39f('0x25')](0xb)},'setvar':{'type':Sequelize[_0xd39f('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd39f('0x6')]},'callcounter':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':_0xd39f('0x18')},'busylevel':{'type':Sequelize[_0xd39f('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd39f('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xd39f('0x6')]},'template':{'type':Sequelize[_0xd39f('0x6')]},'videosupport':{'type':Sequelize[_0xd39f('0x2')]('yes','no',_0xd39f('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd39f('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0xd39f('0x6')]},'session_timers':{'type':Sequelize[_0xd39f('0x2')]('accept',_0xd39f('0x27'),_0xd39f('0x28'))},'session_expires':{'type':Sequelize[_0xd39f('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xd39f('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd39f('0x29'),_0xd39f('0x2a')),'defaultValue':_0xd39f('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xd39f('0x6')]},'regexten':{'type':Sequelize[_0xd39f('0x6')]},'fromdomain':{'type':Sequelize[_0xd39f('0x6')]},'fromuser':{'type':Sequelize[_0xd39f('0x6')]},'port':{'type':Sequelize[_0xd39f('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xd39f('0x6')]},'defaultuser':{'type':Sequelize[_0xd39f('0x6')]},'rtptimeout':{'type':Sequelize[_0xd39f('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xd39f('0x6')]},'timert1':{'type':Sequelize[_0xd39f('0x25')](0xb)},'timerb':{'type':Sequelize[_0xd39f('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd39f('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xd39f('0x6')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xd39f('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xd39f('0x6')]},'use_q850_reason':{'type':Sequelize[_0xd39f('0x6')]},'maxforwards':{'type':Sequelize[_0xd39f('0x25')](0xb)},'encryption':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'icesupport':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xd39f('0x2c'),_0xd39f('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xd39f('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd39f('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xd39f('0x6')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xd39f('0x2e'),_0xd39f('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd39f('0x6')]},'recordofffeature':{'type':Sequelize[_0xd39f('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd39f('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no')},'vmexten':{'type':Sequelize[_0xd39f('0x6')]},'mohinterpret':{'type':Sequelize[_0xd39f('0x6')]},'mohsuggest':{'type':Sequelize[_0xd39f('0x6')]},'parkinglot':{'type':Sequelize[_0xd39f('0x6')]},'description':{'type':Sequelize[_0xd39f('0x6')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd39f('0x30')},'canreinvite':{'type':Sequelize[_0xd39f('0x2')](_0xd39f('0x18'),'no',_0xd39f('0x19'),_0xd39f('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd39f('0x6')]},'otherFields':{'type':Sequelize[_0xd39f('0x6')]},'active':{'type':Sequelize[_0xd39f('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd39f('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0xee93=['INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','setDataValue','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x289ed9,_0x40b982){var _0xb02f85=function(_0x1ef4ec){while(--_0x1ef4ec){_0x289ed9['push'](_0x289ed9['shift']());}};_0xb02f85(++_0x40b982);}(_0xee93,0x11d));var _0x3ee9=function(_0x264eef,_0x109ed3){_0x264eef=_0x264eef-0x0;var _0x124df1=_0xee93[_0x264eef];return _0x124df1;};'use strict';var Sequelize=require(_0x3ee9('0x0'));module[_0x3ee9('0x1')]={'name':{'type':Sequelize[_0x3ee9('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3ee9('0x3'),_0x3ee9('0x4'),_0x3ee9('0x5')),'allowNull':![],'defaultValue':_0x3ee9('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x7'),_0x3ee9('0x8'),_0x3ee9('0x9'),_0x3ee9('0xa'),_0x3ee9('0xb'),_0x3ee9('0xc'),_0x3ee9('0xd'),_0x3ee9('0xe'))},'deny':{'type':Sequelize[_0x3ee9('0x2')]},'permit':{'type':Sequelize[_0x3ee9('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3ee9('0x2')]},'remotesecret':{'type':Sequelize[_0x3ee9('0x2')]},'transport':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0xf'),'set':function(_0x26728d){this['setDataValue'](_0x3ee9('0x10'),_0x26728d?_0x26728d[_0x3ee9('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x3ee9('0x10'))?this['getDataValue'](_0x3ee9('0x10'))[_0x3ee9('0x12')](','):null;},'comment':_0x3ee9('0x13')},'dtmfmode':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x14'),_0x3ee9('0x15'),_0x3ee9('0x16'),'inband','auto'),'defaultValue':_0x3ee9('0x14')},'directmedia':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x18'),'update',_0x3ee9('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0x1a'),'set':function(_0x55ac98){this['setDataValue'](_0x3ee9('0x1b'),_0x55ac98?_0x55ac98[_0x3ee9('0x11')](','):null);},'get':function(){return this[_0x3ee9('0x1c')](_0x3ee9('0x1b'))?this[_0x3ee9('0x1c')](_0x3ee9('0x1b'))['split'](','):null;},'comment':_0x3ee9('0x1d')},'callgroup':{'type':Sequelize[_0x3ee9('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3ee9('0x2')]},'pickupgroup':{'type':Sequelize[_0x3ee9('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3ee9('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x3ee9('0x1e')},'allow':{'type':Sequelize[_0x3ee9('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x36d5eb){this[_0x3ee9('0x1f')]('allow',_0x36d5eb?_0x36d5eb['join'](';'):_0x3ee9('0x20'));},'get':function(){return this[_0x3ee9('0x1c')](_0x3ee9('0x21'))?this[_0x3ee9('0x1c')](_0x3ee9('0x21'))[_0x3ee9('0x12')](';'):null;},'comment':_0x3ee9('0x22')},'autoframing':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'insecure':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0x23'),'set':function(_0x5252bd){this[_0x3ee9('0x1f')](_0x3ee9('0x24'),_0x5252bd?_0x5252bd[_0x3ee9('0x11')](','):null);},'get':function(){return this[_0x3ee9('0x1c')](_0x3ee9('0x24'))?this[_0x3ee9('0x1c')](_0x3ee9('0x24'))['split'](','):null;},'comment':_0x3ee9('0x25')},'trustrpid':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0x3ee9('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':_0x3ee9('0x28')},'amaflags':{'type':Sequelize[_0x3ee9('0x2')]},'callcounter':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':_0x3ee9('0x17')},'busylevel':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x3ee9('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3ee9('0x6')]('yes','no',_0x3ee9('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'mailbox':{'type':Sequelize[_0x3ee9('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x3ee9('0x2a'),_0x3ee9('0x2b'))},'session_expires':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x2c'),_0x3ee9('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3ee9('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x3ee9('0x6')]('yes','no'),'defaultValue':_0x3ee9('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3ee9('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3ee9('0x2')]},'callbackextension':{'type':Sequelize[_0x3ee9('0x2')]},'timert1':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'timerb':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x3ee9('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3ee9('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3ee9('0x2')]},'maxforwards':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x3ee9('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x3ee9('0x17'),'no',_0x3ee9('0x2f'),_0x3ee9('0x30'))},'dtlsrekey':{'type':Sequelize[_0x3ee9('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3ee9('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3ee9('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x3ee9('0x2')]},'dtlscapath':{'type':Sequelize[_0x3ee9('0x2')]},'dtlssetup':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x31'),_0x3ee9('0x32'),_0x3ee9('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3ee9('0x2')]},'usereqphone':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3ee9('0x2')]},'recordofffeature':{'type':Sequelize[_0x3ee9('0x2')]},'call_limit':{'type':Sequelize[_0x3ee9('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x3ee9('0x2')]},'mohinterpret':{'type':Sequelize[_0x3ee9('0x2')]},'mohsuggest':{'type':Sequelize[_0x3ee9('0x2')]},'parkinglot':{'type':Sequelize[_0x3ee9('0x2')]},'description':{'type':Sequelize[_0x3ee9('0x2')]},'host':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x3ee9('0x6')](_0x3ee9('0x17'),'no',_0x3ee9('0x18'),'update',_0x3ee9('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3ee9('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3ee9('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3ee9('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 15ed62d..22346ed 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 _0x32b3=['../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','Trunks','UserProfileResource','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Trunk','findAll','rows','show','params','keys','length','includeAll','include','find','clone','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x439bf5,_0x4aa8bf){var _0x452d97=function(_0x5152ad){while(--_0x5152ad){_0x439bf5['push'](_0x439bf5['shift']());}};_0x452d97(++_0x4aa8bf);}(_0x32b3,0x138));var _0x332b=function(_0x3e72da,_0x7909e3){_0x3e72da=_0x3e72da-0x0;var _0x20a27d=_0x32b3[_0x3e72da];return _0x20a27d;};'use strict';var pdf=require(_0x332b('0x0'));var emlformat=require(_0x332b('0x1'));var rimraf=require(_0x332b('0x2'));var zipdir=require(_0x332b('0x3'));var jsonpatch=require(_0x332b('0x4'));var rp=require(_0x332b('0x5'));var moment=require(_0x332b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x332b('0x7'));var path=require(_0x332b('0x8'));var sox=require(_0x332b('0x9'));var csv=require(_0x332b('0xa'));var ejs=require(_0x332b('0xb'));var fs=require('fs');var _=require(_0x332b('0xc'));var squel=require(_0x332b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x332b('0xe'));var toCsv=require(_0x332b('0xa'));var querystring=require('querystring');var Papa=require(_0x332b('0xf'));var Redis=require(_0x332b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x332b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x332b('0x12'));var logger=require(_0x332b('0x13'))(_0x332b('0x14'));var utils=require(_0x332b('0x15'));var config=require(_0x332b('0x16'));var licenseUtil=require(_0x332b('0x17'));var db=require(_0x332b('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x332b('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8ccb5,_0x25b066,_0x31a750,_0x1c08eb){return new BPromise(function(_0x448da4,_0x311920){var _0x5b91e9=_0x1c08eb||client;return _0x5b91e9[_0x332b('0x1a')](_0xe8ccb5,_0x31a750)[_0x332b('0x1b')](function(_0x558201){logger[_0x332b('0x1c')](_0x332b('0x1d'),_0x25b066,_0x332b('0x1e'));logger[_0x332b('0x1f')](_0x332b('0x20'),_0x25b066,_0x332b('0x1e'),JSON[_0x332b('0x21')](_0x558201));if(_0x558201[_0x332b('0x22')]){if(_0x558201[_0x332b('0x22')][_0x332b('0x23')]===0x1f4){logger[_0x332b('0x22')](_0x332b('0x1d'),_0x25b066,_0x558201['error'][_0x332b('0x24')]);return _0x311920(_0x558201[_0x332b('0x22')]['message']);}logger[_0x332b('0x22')](_0x332b('0x1d'),_0x25b066,_0x558201[_0x332b('0x22')]['message']);return _0x448da4(_0x558201[_0x332b('0x22')][_0x332b('0x24')]);}else{logger['info'](_0x332b('0x1d'),_0x25b066,_0x332b('0x1e'));_0x448da4(_0x558201['result'][_0x332b('0x24')]);}})[_0x332b('0x25')](function(_0x5162e9){logger[_0x332b('0x22')](_0x332b('0x1d'),_0x25b066,_0x5162e9);_0x311920(_0x5162e9);});});}function respondWithStatusCode(_0x408265,_0x3cd9b8){_0x3cd9b8=_0x3cd9b8||0xcc;return function(_0x6fa5b6){if(_0x6fa5b6){return _0x408265[_0x332b('0x26')](_0x3cd9b8);}return _0x408265[_0x332b('0x27')](_0x3cd9b8)[_0x332b('0x28')]();};}function respondWithResult(_0x36aaa4,_0x4838df){_0x4838df=_0x4838df||0xc8;return function(_0x1ae297){if(_0x1ae297){return _0x36aaa4[_0x332b('0x27')](_0x4838df)[_0x332b('0x29')](_0x1ae297);}};}function respondWithFilteredResult(_0x157aa7,_0x56595c){return function(_0xe8f848){if(_0xe8f848){var _0x557573=_0xe8f848[_0x332b('0x2a')],_0x2dc433=_0x56595c[_0x332b('0x2b')],_0x29d679=_0x56595c[_0x332b('0x2b')]+_0x56595c[_0x332b('0x2c')],_0x37a5d8;if(_0x29d679>=_0x557573){_0x29d679=_0x557573;_0x37a5d8=0xc8;}else{_0x37a5d8=0xce;}_0x157aa7['status'](_0x37a5d8);return _0x157aa7[_0x332b('0x2d')](_0x332b('0x2e'),_0x2dc433+'-'+_0x29d679+'/'+_0x557573)[_0x332b('0x29')](_0xe8f848);}return null;};}function patchUpdates(_0x49c4f3){return function(_0x28b7b5){try{jsonpatch[_0x332b('0x2f')](_0x28b7b5,_0x49c4f3,!![]);}catch(_0x1d02c2){return BPromise['reject'](_0x1d02c2);}return _0x28b7b5['save']();};}function saveUpdates(_0x4a691a,_0x5c6311){return function(_0x5b1b03){if(_0x5b1b03){return _0x5b1b03[_0x332b('0x30')](_0x4a691a)[_0x332b('0x1b')](function(_0x1c44b8){return _0x1c44b8;});}return null;};}function removeEntity(_0x375274,_0x425ffb){return function(_0x1f87df){if(_0x1f87df){return _0x1f87df[_0x332b('0x31')]()[_0x332b('0x1b')](function(){var _0x2b13cb=_0x1f87df['get']({'plain':!![]});var _0x322638=_0x332b('0x32');return db[_0x332b('0x33')][_0x332b('0x31')]({'where':{'type':_0x322638,'resourceId':_0x2b13cb['id']}})['then'](function(){return _0x1f87df;});})[_0x332b('0x1b')](function(){_0x375274[_0x332b('0x27')](0xcc)[_0x332b('0x28')]();});}};}function handleEntityNotFound(_0x544500,_0x462b2f){return function(_0x472394){if(!_0x472394){_0x544500[_0x332b('0x26')](0x194);}return _0x472394;};}function handleError(_0x315142,_0x2b0bb2){_0x2b0bb2=_0x2b0bb2||0x1f4;return function(_0x40195c){logger[_0x332b('0x22')](_0x40195c['stack']);if(_0x40195c[_0x332b('0x34')]){delete _0x40195c[_0x332b('0x34')];}_0x315142[_0x332b('0x27')](_0x2b0bb2)[_0x332b('0x35')](_0x40195c);};}exports['index']=function(_0x4786d5,_0x262ebf){var _0x583143={},_0x2a6c94={},_0x3514ee={'count':0x0,'rows':[]};var _0x2a1a83=_[_0x332b('0x36')](db['Trunk'][_0x332b('0x37')],function(_0x1ccb43){return{'name':_0x1ccb43[_0x332b('0x38')],'type':_0x1ccb43[_0x332b('0x39')][_0x332b('0x3a')]};});_0x2a6c94[_0x332b('0x3b')]=_[_0x332b('0x36')](_0x2a1a83,_0x332b('0x34'));_0x2a6c94[_0x332b('0x3c')]=_['keys'](_0x4786d5[_0x332b('0x3c')]);_0x2a6c94[_0x332b('0x3d')]=_[_0x332b('0x3e')](_0x2a6c94['model'],_0x2a6c94[_0x332b('0x3c')]);_0x583143[_0x332b('0x3f')]=_['intersection'](_0x2a6c94['model'],qs[_0x332b('0x40')](_0x4786d5[_0x332b('0x3c')][_0x332b('0x40')]));_0x583143[_0x332b('0x3f')]=_0x583143[_0x332b('0x3f')]['length']?_0x583143[_0x332b('0x3f')]:_0x2a6c94[_0x332b('0x3b')];if(!_0x4786d5[_0x332b('0x3c')][_0x332b('0x41')](_0x332b('0x42'))){_0x583143[_0x332b('0x2c')]=qs[_0x332b('0x2c')](_0x4786d5[_0x332b('0x3c')]['limit']);_0x583143[_0x332b('0x2b')]=qs['offset'](_0x4786d5[_0x332b('0x3c')][_0x332b('0x2b')]);}_0x583143[_0x332b('0x43')]=qs[_0x332b('0x44')](_0x4786d5['query']['sort']);_0x583143[_0x332b('0x45')]=qs[_0x332b('0x3d')](_[_0x332b('0x46')](_0x4786d5[_0x332b('0x3c')],_0x2a6c94[_0x332b('0x3d')]),_0x2a1a83);if(_0x4786d5['query'][_0x332b('0x47')]){_0x583143[_0x332b('0x45')]=_['merge'](_0x583143[_0x332b('0x45')],{'$or':_[_0x332b('0x36')](_0x2a1a83,function(_0x312a1e){if(_0x312a1e[_0x332b('0x39')]!==_0x332b('0x48')){var _0x12285d={};_0x12285d[_0x312a1e[_0x332b('0x34')]]={'$like':'%'+_0x4786d5[_0x332b('0x3c')][_0x332b('0x47')]+'%'};return _0x12285d;}})});}_0x583143=_[_0x332b('0x49')]({},_0x583143,_0x4786d5[_0x332b('0x4a')]);var _0x10a8a7={'where':_0x583143['where']};return db['Trunk'][_0x332b('0x2a')](_0x10a8a7)[_0x332b('0x1b')](function(_0x57c980){_0x3514ee[_0x332b('0x2a')]=_0x57c980;if(_0x4786d5[_0x332b('0x3c')]['includeAll']){_0x583143['include']=[{'all':!![]}];}return db[_0x332b('0x4b')][_0x332b('0x4c')](_0x583143);})[_0x332b('0x1b')](function(_0x21328a){_0x3514ee[_0x332b('0x4d')]=_0x21328a;return _0x3514ee;})['then'](respondWithFilteredResult(_0x262ebf,_0x583143))[_0x332b('0x25')](handleError(_0x262ebf,null));};exports[_0x332b('0x4e')]=function(_0x4cb0bc,_0x168828){var _0x398f59={'raw':![],'where':{'id':_0x4cb0bc[_0x332b('0x4f')]['id']}},_0x3ca711={};_0x3ca711[_0x332b('0x3b')]=_[_0x332b('0x50')](db[_0x332b('0x4b')][_0x332b('0x37')]);_0x3ca711[_0x332b('0x3c')]=_['keys'](_0x4cb0bc[_0x332b('0x3c')]);_0x3ca711[_0x332b('0x3d')]=_[_0x332b('0x3e')](_0x3ca711['model'],_0x3ca711[_0x332b('0x3c')]);_0x398f59[_0x332b('0x3f')]=_['intersection'](_0x3ca711['model'],qs[_0x332b('0x40')](_0x4cb0bc['query'][_0x332b('0x40')]));_0x398f59[_0x332b('0x3f')]=_0x398f59[_0x332b('0x3f')][_0x332b('0x51')]?_0x398f59[_0x332b('0x3f')]:_0x3ca711[_0x332b('0x3b')];if(_0x4cb0bc[_0x332b('0x3c')][_0x332b('0x52')]){_0x398f59[_0x332b('0x53')]=[{'all':!![]}];}_0x398f59=_['merge']({},_0x398f59,_0x4cb0bc[_0x332b('0x4a')]);return db[_0x332b('0x4b')][_0x332b('0x54')](_0x398f59)['then'](handleEntityNotFound(_0x168828,null))[_0x332b('0x1b')](respondWithResult(_0x168828,null))[_0x332b('0x25')](handleError(_0x168828,null));};exports[_0x332b('0x55')]=function(_0x9e861e,_0xb77e6d){var _0x31d5a2={'where':{'id':_0x9e861e[_0x332b('0x4f')]['id']}},_0x2a8770={};_0x2a8770['model']=_['keys'](db[_0x332b('0x4b')][_0x332b('0x37')]);_0x31d5a2[_0x332b('0x3f')]=_[_0x332b('0x3e')](_0x2a8770[_0x332b('0x3b')],qs[_0x332b('0x40')](_0x9e861e[_0x332b('0x3c')]['fields']));_0x31d5a2[_0x332b('0x3f')]=_0x31d5a2[_0x332b('0x3f')]['length']?_0x31d5a2['attributes']:_0x2a8770[_0x332b('0x3b')];if(_0x9e861e[_0x332b('0x3c')]['includeAll']){_0x31d5a2[_0x332b('0x53')]=[{'all':!![]}];}_0x31d5a2=_['merge']({},_0x31d5a2,_0x9e861e[_0x332b('0x4a')]);return db[_0x332b('0x4b')][_0x332b('0x54')](_0x31d5a2)['then'](handleEntityNotFound(_0xb77e6d,null))['then'](function(_0x525844){if(_0x525844){var _0x201719=_0x525844[_0x332b('0x56')]({'plain':!![]});_0x201719=qs[_0x332b('0x57')](_0x201719,['id',_0x332b('0x58'),_0x332b('0x59')]);_0x9e861e[_0x332b('0x5a')]=_['omit'](_0x9e861e[_0x332b('0x5a')],['id','createdAt',_0x332b('0x59')]);return db[_0x332b('0x4b')][_0x332b('0x5b')](_['merge'](_0x201719,_0x9e861e[_0x332b('0x5a')]),{'include':_0x9e861e['query'][_0x332b('0x52')]?[{'all':!![]}]:undefined})[_0x332b('0x1b')](function(_0x45b3df){var _0x5a7908=_0x9e861e['user'][_0x332b('0x56')]({'plain':!![]});if(!_0x5a7908)throw new Error(_0x332b('0x5c'));if(_0x5a7908[_0x332b('0x5d')]===_0x332b('0x5e')){var _0x19898a=_0x45b3df[_0x332b('0x56')]({'plain':!![]});var _0x18e297=_0x332b('0x32');return db[_0x332b('0x5f')]['find']({'where':{'name':_0x18e297,'userProfileId':_0x5a7908[_0x332b('0x60')]},'raw':!![]})[_0x332b('0x1b')](function(_0x3893fb){if(_0x3893fb&&_0x3893fb[_0x332b('0x61')]===0x0){return db[_0x332b('0x33')][_0x332b('0x5b')]({'name':_0x19898a['name'],'resourceId':_0x19898a['id'],'type':_0x3893fb[_0x332b('0x34')],'sectionId':_0x3893fb['id']},{})[_0x332b('0x1b')](function(){return _0x45b3df;});}else{return _0x45b3df;}})[_0x332b('0x25')](function(_0x374fec){logger[_0x332b('0x22')](_0x332b('0x62'),_0x374fec);throw _0x374fec;});}return _0x45b3df;});}})[_0x332b('0x1b')](respondWithResult(_0xb77e6d,0xc9))[_0x332b('0x25')](handleError(_0xb77e6d,null));};exports[_0x332b('0x5b')]=function(_0x7fc30d,_0x182349,_0x36fc08){var _0x120e3a;return db[_0x332b('0x4b')][_0x332b('0x5b')](_0x7fc30d[_0x332b('0x5a')],{'raw':!![]})[_0x332b('0x1b')](function(_0x554a86){_0x120e3a=_0x554a86;return db[_0x332b('0x4b')][_0x332b('0x4c')]({'raw':!![]});})[_0x332b('0x1b')](function(_0x8788b2){var _0xbc6253=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x66')),'utf8');var _0x303ebf=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x67')),_0x332b('0x68'));var _0x5212c1=ejs['render'](_0xbc6253,{'trunks':_0x8788b2||[]});fs[_0x332b('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5212c1);if(_0x120e3a[_0x332b('0x6a')]){var _0x376941=ejs[_0x332b('0x6b')](_0x303ebf,{'trunks':_0x8788b2||[]});fs[_0x332b('0x69')](_0x332b('0x6c'),_0x376941);}})['then'](function(){return respondWithRpcPromise('Reload',_0x332b('0x5b'),{'module':'chan_sip.so'});})['then'](function(){var _0x54f553=_0x7fc30d['user'][_0x332b('0x56')]({'plain':!![]});if(!_0x54f553)throw new Error(_0x332b('0x5c'));if(_0x54f553[_0x332b('0x5d')]==='user'){var _0x4caa39=_0x120e3a[_0x332b('0x56')]({'plain':!![]});return db[_0x332b('0x5f')][_0x332b('0x54')]({'where':{'name':_0x332b('0x32'),'userProfileId':_0x54f553['userProfileId']},'raw':!![]})[_0x332b('0x1b')](function(_0x5d6e00){if(_0x5d6e00&&_0x5d6e00[_0x332b('0x61')]===0x0){return db[_0x332b('0x33')][_0x332b('0x5b')]({'name':_0x4caa39['name'],'resourceId':_0x4caa39['id'],'type':_0x5d6e00['name'],'sectionId':_0x5d6e00['id']},{})[_0x332b('0x1b')](function(){return _0x120e3a;});}else{return _0x120e3a;}})['catch'](function(_0x5312d5){logger[_0x332b('0x22')](_0x332b('0x62'),_0x5312d5);throw _0x5312d5;});}return _0x120e3a;})[_0x332b('0x1b')](respondWithResult(_0x182349,0xc9))['catch'](handleError(_0x182349,null));};exports[_0x332b('0x30')]=function(_0xe5f69e,_0x126fd3,_0x3d74f0){var _0x85ac78;return db[_0x332b('0x4b')][_0x332b('0x54')]({'where':{'id':_0xe5f69e[_0x332b('0x4f')]['id']}})[_0x332b('0x1b')](handleEntityNotFound(_0x126fd3,null))[_0x332b('0x1b')](saveUpdates(_0xe5f69e['body'],null))[_0x332b('0x1b')](function(_0x207f9c){if(_0x207f9c){_0x85ac78=_0x207f9c;return db[_0x332b('0x4b')]['findAll']({'raw':!![]});}})[_0x332b('0x1b')](function(_0x1494e4){if(_0x1494e4){var _0x330b0f=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x66')),_0x332b('0x68'));var _0x2f4c61=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x67')),_0x332b('0x68'));var _0x1a5713=ejs['render'](_0x330b0f,{'trunks':_0x1494e4||[]});fs[_0x332b('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a5713);var _0x1c7ed6=ejs[_0x332b('0x6b')](_0x2f4c61,{'trunks':_0x1494e4||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1c7ed6);return respondWithRpcPromise(_0x332b('0x6d'),'update',{'module':_0x332b('0x6e')});}return null;})[_0x332b('0x1b')](function(_0x28981e){if(_0x28981e){return _0x85ac78;}})[_0x332b('0x1b')](respondWithResult(_0x126fd3,null))[_0x332b('0x25')](handleError(_0x126fd3,null));};exports['destroy']=function(_0x4157d9,_0x1e747e,_0x52e63e){var _0x539dd7;return db[_0x332b('0x4b')][_0x332b('0x54')]({'where':{'id':_0x4157d9[_0x332b('0x4f')]['id']}})[_0x332b('0x1b')](handleEntityNotFound(_0x1e747e,null))[_0x332b('0x1b')](removeEntity(_0x1e747e,null))[_0x332b('0x1b')](function(){return db['Trunk'][_0x332b('0x4c')]({'raw':!![]});})['then'](function(_0x57dc28){var _0x3d2512=fs[_0x332b('0x63')](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x66')),_0x332b('0x68'));var _0x282925=fs['readFileSync'](path[_0x332b('0x64')](config[_0x332b('0x65')],_0x332b('0x67')),_0x332b('0x68'));var _0xfd4a42=ejs[_0x332b('0x6b')](_0x3d2512,{'trunks':_0x57dc28});var _0x3f9136=ejs[_0x332b('0x6b')](_0x282925,{'trunks':_0x57dc28});fs['writeFileSync'](_0x332b('0x6f'),_0xfd4a42);fs['writeFileSync'](_0x332b('0x6c'),_0x3f9136);return respondWithRpcPromise('Reload','destroy',{'module':_0x332b('0x6e')});})['catch'](handleError(_0x1e747e,null));}; \ No newline at end of file +var _0x7a51=['pick','filter','merge','options','includeAll','include','rows','show','params','keys','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','findAll','utf8','writeFileSync','Reload','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','end','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x26a76e,_0x3ca834){var _0x2d0b8a=function(_0xb2376e){while(--_0xb2376e){_0x26a76e['push'](_0x26a76e['shift']());}};_0x2d0b8a(++_0x3ca834);}(_0x7a51,0x96));var _0x17a5=function(_0x4789a4,_0x5b9016){_0x4789a4=_0x4789a4-0x0;var _0x2f2a51=_0x7a51[_0x4789a4];return _0x2f2a51;};'use strict';var pdf=require(_0x17a5('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x17a5('0x1'));var jsonpatch=require(_0x17a5('0x2'));var rp=require(_0x17a5('0x3'));var moment=require(_0x17a5('0x4'));var BPromise=require(_0x17a5('0x5'));var Mustache=require(_0x17a5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x17a5('0x7'));var csv=require(_0x17a5('0x8'));var ejs=require(_0x17a5('0x9'));var fs=require('fs');var _=require(_0x17a5('0xa'));var squel=require(_0x17a5('0xb'));var crypto=require('crypto');var jsforce=require(_0x17a5('0xc'));var deskjs=require(_0x17a5('0xd'));var toCsv=require(_0x17a5('0x8'));var querystring=require('querystring');var Papa=require(_0x17a5('0xe'));var Redis=require(_0x17a5('0xf'));var authService=require(_0x17a5('0x10'));var qs=require(_0x17a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17a5('0x12'));var logger=require(_0x17a5('0x13'))(_0x17a5('0x14'));var utils=require(_0x17a5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x17a5('0x16'));var db=require(_0x17a5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x17a5('0x18')][_0x17a5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5bfbd9,_0x1e0dc4,_0x218032,_0x1969ed){return new BPromise(function(_0x16281a,_0x4fc8b6){var _0x2cd5b1=_0x1969ed||client;return _0x2cd5b1[_0x17a5('0x1a')](_0x5bfbd9,_0x218032)[_0x17a5('0x1b')](function(_0x25d07c){logger[_0x17a5('0x1c')]('Trunk,\x20%s,\x20%s',_0x1e0dc4,_0x17a5('0x1d'));logger['debug'](_0x17a5('0x1e'),_0x1e0dc4,_0x17a5('0x1d'),JSON[_0x17a5('0x1f')](_0x25d07c));if(_0x25d07c[_0x17a5('0x20')]){if(_0x25d07c[_0x17a5('0x20')][_0x17a5('0x21')]===0x1f4){logger[_0x17a5('0x20')](_0x17a5('0x22'),_0x1e0dc4,_0x25d07c[_0x17a5('0x20')][_0x17a5('0x23')]);return _0x4fc8b6(_0x25d07c['error'][_0x17a5('0x23')]);}logger[_0x17a5('0x20')](_0x17a5('0x22'),_0x1e0dc4,_0x25d07c[_0x17a5('0x20')][_0x17a5('0x23')]);return _0x16281a(_0x25d07c['error']['message']);}else{logger[_0x17a5('0x1c')](_0x17a5('0x22'),_0x1e0dc4,_0x17a5('0x1d'));_0x16281a(_0x25d07c[_0x17a5('0x24')][_0x17a5('0x23')]);}})[_0x17a5('0x25')](function(_0x37c545){logger[_0x17a5('0x20')](_0x17a5('0x22'),_0x1e0dc4,_0x37c545);_0x4fc8b6(_0x37c545);});});}function respondWithStatusCode(_0x182756,_0x2ee257){_0x2ee257=_0x2ee257||0xcc;return function(_0x559802){if(_0x559802){return _0x182756[_0x17a5('0x26')](_0x2ee257);}return _0x182756['status'](_0x2ee257)['end']();};}function respondWithResult(_0xd06bed,_0x18a87){_0x18a87=_0x18a87||0xc8;return function(_0x5a2767){if(_0x5a2767){return _0xd06bed[_0x17a5('0x27')](_0x18a87)[_0x17a5('0x28')](_0x5a2767);}};}function respondWithFilteredResult(_0x868ae7,_0x84db96){return function(_0x555d0e){if(_0x555d0e){var _0x887ed1=_0x555d0e[_0x17a5('0x29')],_0x52b45d=_0x84db96[_0x17a5('0x2a')],_0x267cfd=_0x84db96[_0x17a5('0x2a')]+_0x84db96[_0x17a5('0x2b')],_0x303d83;if(_0x267cfd>=_0x887ed1){_0x267cfd=_0x887ed1;_0x303d83=0xc8;}else{_0x303d83=0xce;}_0x868ae7['status'](_0x303d83);return _0x868ae7[_0x17a5('0x2c')](_0x17a5('0x2d'),_0x52b45d+'-'+_0x267cfd+'/'+_0x887ed1)[_0x17a5('0x28')](_0x555d0e);}return null;};}function patchUpdates(_0x14dfa3){return function(_0x2d7042){try{jsonpatch[_0x17a5('0x2e')](_0x2d7042,_0x14dfa3,!![]);}catch(_0xbd5b80){return BPromise[_0x17a5('0x2f')](_0xbd5b80);}return _0x2d7042[_0x17a5('0x30')]();};}function saveUpdates(_0x33a251,_0x5aff41){return function(_0x20d526){if(_0x20d526){return _0x20d526[_0x17a5('0x31')](_0x33a251)[_0x17a5('0x1b')](function(_0x1aa138){return _0x1aa138;});}return null;};}function removeEntity(_0x1c12a0,_0x1d7337){return function(_0x58c76e){if(_0x58c76e){return _0x58c76e[_0x17a5('0x32')]()[_0x17a5('0x1b')](function(){var _0x54dc41=_0x58c76e[_0x17a5('0x33')]({'plain':!![]});var _0x3d7db8=_0x17a5('0x34');return db[_0x17a5('0x35')][_0x17a5('0x32')]({'where':{'type':_0x3d7db8,'resourceId':_0x54dc41['id']}})[_0x17a5('0x1b')](function(){return _0x58c76e;});})[_0x17a5('0x1b')](function(){_0x1c12a0[_0x17a5('0x27')](0xcc)[_0x17a5('0x36')]();});}};}function handleEntityNotFound(_0xfbf698,_0xc38613){return function(_0x5db5a1){if(!_0x5db5a1){_0xfbf698[_0x17a5('0x26')](0x194);}return _0x5db5a1;};}function handleError(_0x3b9a9f,_0xdae019){_0xdae019=_0xdae019||0x1f4;return function(_0x1d0dff){logger[_0x17a5('0x20')](_0x1d0dff['stack']);if(_0x1d0dff[_0x17a5('0x37')]){delete _0x1d0dff[_0x17a5('0x37')];}_0x3b9a9f[_0x17a5('0x27')](_0xdae019)[_0x17a5('0x38')](_0x1d0dff);};}exports[_0x17a5('0x39')]=function(_0x16b717,_0x1b3d1e){var _0x543fb0={},_0x1b8675={},_0x7ff32e={'count':0x0,'rows':[]};var _0x89880f=_[_0x17a5('0x3a')](db[_0x17a5('0x3b')][_0x17a5('0x3c')],function(_0x39729d){return{'name':_0x39729d[_0x17a5('0x3d')],'type':_0x39729d[_0x17a5('0x3e')][_0x17a5('0x3f')]};});_0x1b8675[_0x17a5('0x40')]=_['map'](_0x89880f,_0x17a5('0x37'));_0x1b8675['query']=_['keys'](_0x16b717['query']);_0x1b8675[_0x17a5('0x41')]=_[_0x17a5('0x42')](_0x1b8675[_0x17a5('0x40')],_0x1b8675[_0x17a5('0x43')]);_0x543fb0[_0x17a5('0x44')]=_[_0x17a5('0x42')](_0x1b8675[_0x17a5('0x40')],qs[_0x17a5('0x45')](_0x16b717['query'][_0x17a5('0x45')]));_0x543fb0[_0x17a5('0x44')]=_0x543fb0[_0x17a5('0x44')][_0x17a5('0x46')]?_0x543fb0[_0x17a5('0x44')]:_0x1b8675[_0x17a5('0x40')];if(!_0x16b717[_0x17a5('0x43')][_0x17a5('0x47')](_0x17a5('0x48'))){_0x543fb0[_0x17a5('0x2b')]=qs['limit'](_0x16b717[_0x17a5('0x43')][_0x17a5('0x2b')]);_0x543fb0[_0x17a5('0x2a')]=qs['offset'](_0x16b717[_0x17a5('0x43')][_0x17a5('0x2a')]);}_0x543fb0[_0x17a5('0x49')]=qs['sort'](_0x16b717[_0x17a5('0x43')][_0x17a5('0x4a')]);_0x543fb0[_0x17a5('0x4b')]=qs['filters'](_[_0x17a5('0x4c')](_0x16b717[_0x17a5('0x43')],_0x1b8675[_0x17a5('0x41')]),_0x89880f);if(_0x16b717[_0x17a5('0x43')][_0x17a5('0x4d')]){_0x543fb0['where']=_['merge'](_0x543fb0['where'],{'$or':_['map'](_0x89880f,function(_0x52c4d2){if(_0x52c4d2[_0x17a5('0x3e')]!=='VIRTUAL'){var _0x113ce1={};_0x113ce1[_0x52c4d2[_0x17a5('0x37')]]={'$like':'%'+_0x16b717[_0x17a5('0x43')]['filter']+'%'};return _0x113ce1;}})});}_0x543fb0=_[_0x17a5('0x4e')]({},_0x543fb0,_0x16b717[_0x17a5('0x4f')]);var _0x38ab48={'where':_0x543fb0[_0x17a5('0x4b')]};return db['Trunk']['count'](_0x38ab48)[_0x17a5('0x1b')](function(_0x24f9e4){_0x7ff32e[_0x17a5('0x29')]=_0x24f9e4;if(_0x16b717[_0x17a5('0x43')][_0x17a5('0x50')]){_0x543fb0[_0x17a5('0x51')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x543fb0);})[_0x17a5('0x1b')](function(_0x4b7a6a){_0x7ff32e[_0x17a5('0x52')]=_0x4b7a6a;return _0x7ff32e;})[_0x17a5('0x1b')](respondWithFilteredResult(_0x1b3d1e,_0x543fb0))[_0x17a5('0x25')](handleError(_0x1b3d1e,null));};exports[_0x17a5('0x53')]=function(_0x443d1e,_0x3a9532){var _0x1ea8f7={'raw':![],'where':{'id':_0x443d1e[_0x17a5('0x54')]['id']}},_0x3c4678={};_0x3c4678[_0x17a5('0x40')]=_[_0x17a5('0x55')](db['Trunk'][_0x17a5('0x3c')]);_0x3c4678[_0x17a5('0x43')]=_['keys'](_0x443d1e[_0x17a5('0x43')]);_0x3c4678[_0x17a5('0x41')]=_[_0x17a5('0x42')](_0x3c4678[_0x17a5('0x40')],_0x3c4678[_0x17a5('0x43')]);_0x1ea8f7[_0x17a5('0x44')]=_[_0x17a5('0x42')](_0x3c4678[_0x17a5('0x40')],qs[_0x17a5('0x45')](_0x443d1e[_0x17a5('0x43')][_0x17a5('0x45')]));_0x1ea8f7[_0x17a5('0x44')]=_0x1ea8f7[_0x17a5('0x44')][_0x17a5('0x46')]?_0x1ea8f7[_0x17a5('0x44')]:_0x3c4678[_0x17a5('0x40')];if(_0x443d1e[_0x17a5('0x43')][_0x17a5('0x50')]){_0x1ea8f7['include']=[{'all':!![]}];}_0x1ea8f7=_[_0x17a5('0x4e')]({},_0x1ea8f7,_0x443d1e[_0x17a5('0x4f')]);return db['Trunk'][_0x17a5('0x56')](_0x1ea8f7)['then'](handleEntityNotFound(_0x3a9532,null))['then'](respondWithResult(_0x3a9532,null))[_0x17a5('0x25')](handleError(_0x3a9532,null));};exports[_0x17a5('0x57')]=function(_0x56aa04,_0x5e7693){var _0x85e33c={'where':{'id':_0x56aa04[_0x17a5('0x54')]['id']}},_0x1a3de8={};_0x1a3de8[_0x17a5('0x40')]=_['keys'](db['Trunk'][_0x17a5('0x3c')]);_0x85e33c[_0x17a5('0x44')]=_[_0x17a5('0x42')](_0x1a3de8[_0x17a5('0x40')],qs[_0x17a5('0x45')](_0x56aa04['query'][_0x17a5('0x45')]));_0x85e33c[_0x17a5('0x44')]=_0x85e33c[_0x17a5('0x44')][_0x17a5('0x46')]?_0x85e33c[_0x17a5('0x44')]:_0x1a3de8[_0x17a5('0x40')];if(_0x56aa04[_0x17a5('0x43')]['includeAll']){_0x85e33c[_0x17a5('0x51')]=[{'all':!![]}];}_0x85e33c=_[_0x17a5('0x4e')]({},_0x85e33c,_0x56aa04[_0x17a5('0x4f')]);return db[_0x17a5('0x3b')][_0x17a5('0x56')](_0x85e33c)['then'](handleEntityNotFound(_0x5e7693,null))['then'](function(_0x3484f2){if(_0x3484f2){var _0x54bc04=_0x3484f2[_0x17a5('0x33')]({'plain':!![]});_0x54bc04=qs[_0x17a5('0x58')](_0x54bc04,['id',_0x17a5('0x59'),_0x17a5('0x5a')]);_0x56aa04[_0x17a5('0x5b')]=_[_0x17a5('0x58')](_0x56aa04[_0x17a5('0x5b')],['id',_0x17a5('0x59'),'updatedAt']);return db[_0x17a5('0x3b')][_0x17a5('0x5c')](_[_0x17a5('0x4e')](_0x54bc04,_0x56aa04['body']),{'include':_0x56aa04[_0x17a5('0x43')][_0x17a5('0x50')]?[{'all':!![]}]:undefined})[_0x17a5('0x1b')](function(_0x3c293b){var _0x40ebf6=_0x56aa04[_0x17a5('0x5d')]['get']({'plain':!![]});if(!_0x40ebf6)throw new Error(_0x17a5('0x5e'));if(_0x40ebf6[_0x17a5('0x5f')]==='user'){var _0x220c3d=_0x3c293b['get']({'plain':!![]});var _0x4d421e=_0x17a5('0x34');return db[_0x17a5('0x60')][_0x17a5('0x56')]({'where':{'name':_0x4d421e,'userProfileId':_0x40ebf6[_0x17a5('0x61')]},'raw':!![]})[_0x17a5('0x1b')](function(_0x2f2646){if(_0x2f2646&&_0x2f2646[_0x17a5('0x62')]===0x0){return db['UserProfileResource'][_0x17a5('0x5c')]({'name':_0x220c3d[_0x17a5('0x37')],'resourceId':_0x220c3d['id'],'type':_0x2f2646['name'],'sectionId':_0x2f2646['id']},{})[_0x17a5('0x1b')](function(){return _0x3c293b;});}else{return _0x3c293b;}})['catch'](function(_0x3d848a){logger['error'](_0x17a5('0x63'),_0x3d848a);throw _0x3d848a;});}return _0x3c293b;});}})[_0x17a5('0x1b')](respondWithResult(_0x5e7693,0xc9))[_0x17a5('0x25')](handleError(_0x5e7693,null));};exports[_0x17a5('0x5c')]=function(_0xe84ca1,_0x2ede16,_0x360590){var _0x3d6aa4;return db[_0x17a5('0x3b')][_0x17a5('0x5c')](_0xe84ca1[_0x17a5('0x5b')],{'raw':!![]})['then'](function(_0x1d8f78){_0x3d6aa4=_0x1d8f78;return db['Trunk']['findAll']({'raw':!![]});})[_0x17a5('0x1b')](function(_0x491d8d){var _0x2592c3=fs[_0x17a5('0x64')](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x67')),'utf8');var _0x1b2e6d=fs[_0x17a5('0x64')](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x68')),'utf8');var _0x512269=ejs['render'](_0x2592c3,{'trunks':_0x491d8d||[]});fs['writeFileSync'](_0x17a5('0x69'),_0x512269);if(_0x3d6aa4[_0x17a5('0x6a')]){var _0x3c5b52=ejs[_0x17a5('0x6b')](_0x1b2e6d,{'trunks':_0x491d8d||[]});fs['writeFileSync'](_0x17a5('0x6c'),_0x3c5b52);}})[_0x17a5('0x1b')](function(){return respondWithRpcPromise('Reload',_0x17a5('0x5c'),{'module':'chan_sip.so'});})[_0x17a5('0x1b')](function(){var _0xde4842=_0xe84ca1[_0x17a5('0x5d')][_0x17a5('0x33')]({'plain':!![]});if(!_0xde4842)throw new Error(_0x17a5('0x5e'));if(_0xde4842[_0x17a5('0x5f')]===_0x17a5('0x5d')){var _0x4fe3f4=_0x3d6aa4[_0x17a5('0x33')]({'plain':!![]});return db[_0x17a5('0x60')]['find']({'where':{'name':'Trunks','userProfileId':_0xde4842[_0x17a5('0x61')]},'raw':!![]})['then'](function(_0x573015){if(_0x573015&&_0x573015[_0x17a5('0x62')]===0x0){return db[_0x17a5('0x35')][_0x17a5('0x5c')]({'name':_0x4fe3f4[_0x17a5('0x37')],'resourceId':_0x4fe3f4['id'],'type':_0x573015[_0x17a5('0x37')],'sectionId':_0x573015['id']},{})[_0x17a5('0x1b')](function(){return _0x3d6aa4;});}else{return _0x3d6aa4;}})[_0x17a5('0x25')](function(_0x348ad5){logger[_0x17a5('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x348ad5);throw _0x348ad5;});}return _0x3d6aa4;})[_0x17a5('0x1b')](respondWithResult(_0x2ede16,0xc9))['catch'](handleError(_0x2ede16,null));};exports[_0x17a5('0x31')]=function(_0x29b88c,_0xd91e8c,_0x41ef3e){var _0x3397fe;return db[_0x17a5('0x3b')][_0x17a5('0x56')]({'where':{'id':_0x29b88c[_0x17a5('0x54')]['id']}})[_0x17a5('0x1b')](handleEntityNotFound(_0xd91e8c,null))[_0x17a5('0x1b')](saveUpdates(_0x29b88c[_0x17a5('0x5b')],null))[_0x17a5('0x1b')](function(_0x16f363){if(_0x16f363){_0x3397fe=_0x16f363;return db[_0x17a5('0x3b')][_0x17a5('0x6d')]({'raw':!![]});}})[_0x17a5('0x1b')](function(_0x4d35cb){if(_0x4d35cb){var _0x1e3544=fs['readFileSync'](path[_0x17a5('0x65')](config['root'],_0x17a5('0x67')),_0x17a5('0x6e'));var _0x2d9f2b=fs[_0x17a5('0x64')](path[_0x17a5('0x65')](config['root'],'server/files/templates/registry.ejs'),_0x17a5('0x6e'));var _0x1c4d89=ejs[_0x17a5('0x6b')](_0x1e3544,{'trunks':_0x4d35cb||[]});fs[_0x17a5('0x6f')](_0x17a5('0x69'),_0x1c4d89);var _0x3dd46c=ejs['render'](_0x2d9f2b,{'trunks':_0x4d35cb||[]});fs['writeFileSync'](_0x17a5('0x6c'),_0x3dd46c);return respondWithRpcPromise('Reload',_0x17a5('0x31'),{'module':'chan_sip.so'});}return null;})[_0x17a5('0x1b')](function(_0x5a9a4e){if(_0x5a9a4e){return _0x3397fe;}})[_0x17a5('0x1b')](respondWithResult(_0xd91e8c,null))[_0x17a5('0x25')](handleError(_0xd91e8c,null));};exports[_0x17a5('0x32')]=function(_0x92570e,_0x65379f,_0x493569){var _0x5bb25c;return db[_0x17a5('0x3b')][_0x17a5('0x56')]({'where':{'id':_0x92570e[_0x17a5('0x54')]['id']}})[_0x17a5('0x1b')](handleEntityNotFound(_0x65379f,null))['then'](removeEntity(_0x65379f,null))[_0x17a5('0x1b')](function(){return db[_0x17a5('0x3b')]['findAll']({'raw':!![]});})[_0x17a5('0x1b')](function(_0x4b88cb){var _0xae2e7a=fs['readFileSync'](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x67')),_0x17a5('0x6e'));var _0x1f9708=fs['readFileSync'](path[_0x17a5('0x65')](config[_0x17a5('0x66')],_0x17a5('0x68')),'utf8');var _0x2725bf=ejs[_0x17a5('0x6b')](_0xae2e7a,{'trunks':_0x4b88cb});var _0x20f9d8=ejs[_0x17a5('0x6b')](_0x1f9708,{'trunks':_0x4b88cb});fs['writeFileSync'](_0x17a5('0x69'),_0x2725bf);fs[_0x17a5('0x6f')]('/etc/asterisk/sip_xcally_registers.conf',_0x20f9d8);return respondWithRpcPromise(_0x17a5('0x70'),'destroy',{'module':'chan_sip.so'});})[_0x17a5('0x25')](handleError(_0x65379f,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 3b710b0..1c68fbb 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 _0x5854=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes'];(function(_0xe988b8,_0x56616a){var _0x119f53=function(_0x296219){while(--_0x296219){_0xe988b8['push'](_0xe988b8['shift']());}};_0x119f53(++_0x56616a);}(_0x5854,0x115));var _0x4585=function(_0x298769,_0x231c31){_0x298769=_0x298769-0x0;var _0x5def73=_0x5854[_0x298769];return _0x5def73;};'use strict';var _=require(_0x4585('0x0'));var util=require(_0x4585('0x1'));var logger=require(_0x4585('0x2'))('api');var moment=require(_0x4585('0x3'));var BPromise=require(_0x4585('0x4'));var rp=require(_0x4585('0x5'));var fs=require('fs');var path=require(_0x4585('0x6'));var rimraf=require('rimraf');var config=require(_0x4585('0x7'));var attributes=require(_0x4585('0x8'));module[_0x4585('0x9')]=function(_0x263e3a,_0x26eed9){return _0x263e3a[_0x4585('0xa')](_0x4585('0xb'),attributes,{'tableName':_0x4585('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eeb=['path','rimraf','define','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe6a9f9,_0x1d399d){var _0x3a80fe=function(_0x1365e0){while(--_0x1365e0){_0xe6a9f9['push'](_0xe6a9f9['shift']());}};_0x3a80fe(++_0x1d399d);}(_0x2eeb,0x7d));var _0xb2ee=function(_0x3ba0da,_0x3a68f2){_0x3ba0da=_0x3ba0da-0x0;var _0x3b7d84=_0x2eeb[_0x3ba0da];return _0x3b7d84;};'use strict';var _=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var logger=require(_0xb2ee('0x2'))(_0xb2ee('0x3'));var moment=require(_0xb2ee('0x4'));var BPromise=require(_0xb2ee('0x5'));var rp=require(_0xb2ee('0x6'));var fs=require('fs');var path=require(_0xb2ee('0x7'));var rimraf=require(_0xb2ee('0x8'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module['exports']=function(_0x42f4ff,_0x4a80ab){return _0x42f4ff[_0xb2ee('0x9')]('Trunk',attributes,{'tableName':_0xb2ee('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 ee76a94..807f0dc 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 _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x1a85,0x178));var _0x51a8=function(_0x28e919,_0x145939){_0x28e919=_0x28e919-0x0;var _0x692b7e=_0x1a85[_0x28e919];return _0x692b7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file +var _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4751d6,_0x2911a1){var _0x55e2c3=function(_0x420a54){while(--_0x420a54){_0x4751d6['push'](_0x4751d6['shift']());}};_0x55e2c3(++_0x2911a1);}(_0xb10b,0x12a));var _0xbb10=function(_0x96691d,_0x544a9d){_0x96691d=_0x96691d-0x0;var _0x5a79ca=_0xb10b[_0x96691d];return _0x5a79ca;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1b5a8ff..ceb7cff 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 _0xc084=['createApiKey','put','update','delete','removeQueues','removeTeams','destroy','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts'];(function(_0xe5f4a,_0x4753dd){var _0x5ce9a2=function(_0xf147b1){while(--_0xf147b1){_0xe5f4a['push'](_0xe5f4a['shift']());}};_0x5ce9a2(++_0x4753dd);}(_0xc084,0x159));var _0x4c08=function(_0x11ad65,_0x352d3c){_0x11ad65=_0x11ad65-0x0;var _0x35590c=_0xc084[_0x11ad65];return _0x35590c;};'use strict';var multer=require(_0x4c08('0x0'));var util=require(_0x4c08('0x1'));var path=require(_0x4c08('0x2'));var timeout=require(_0x4c08('0x3'));var express=require(_0x4c08('0x4'));var router=express[_0x4c08('0x5')]();var auth=require(_0x4c08('0x6'));var interaction=require(_0x4c08('0x7'));var config=require(_0x4c08('0x8'));var controller=require(_0x4c08('0x9'));router['get']('/',auth[_0x4c08('0xa')](),controller['index']);router[_0x4c08('0xb')](_0x4c08('0xc'),auth[_0x4c08('0xa')](),controller['describe']);router[_0x4c08('0xb')](_0x4c08('0xd'),auth[_0x4c08('0xa')](),controller['whoami']);router['get'](_0x4c08('0xe'),auth[_0x4c08('0xa')](),controller[_0x4c08('0xf')]);router[_0x4c08('0xb')](_0x4c08('0x10'),controller[_0x4c08('0x11')]);router[_0x4c08('0xb')](_0x4c08('0x12'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x13')]);router[_0x4c08('0xb')](_0x4c08('0x14'),auth['isAuthenticated'](),controller[_0x4c08('0x15')]);router[_0x4c08('0xb')](_0x4c08('0x16'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x17')]);router['get'](_0x4c08('0x18'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x19')]);router['get']('/:id/recordings',auth[_0x4c08('0xa')](),controller[_0x4c08('0x1a')]);router[_0x4c08('0xb')]('/:id/screen_recordings',auth[_0x4c08('0xa')](),controller['getScreenRecordings']);router['get'](_0x4c08('0x1b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x1c')]);router[_0x4c08('0xb')](_0x4c08('0x1d'),auth[_0x4c08('0xa')](),controller['getOpenchannelInteractions']);router[_0x4c08('0xb')]('/:id/mail/interactions',auth[_0x4c08('0xa')](),controller[_0x4c08('0x1e')]);router[_0x4c08('0xb')]('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x4c08('0xb')](_0x4c08('0x1f'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x20')]);router[_0x4c08('0xb')](_0x4c08('0x21'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x22')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x4c08('0x23')]);router[_0x4c08('0xb')](_0x4c08('0x24'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x25')]);router['get'](_0x4c08('0x26'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x27')]);router['get']('/:id/prefixes',auth[_0x4c08('0xa')](),controller[_0x4c08('0x28')]);router[_0x4c08('0xb')](_0x4c08('0x29'),auth['isAuthenticated'](),controller[_0x4c08('0x2a')]);router[_0x4c08('0xb')](_0x4c08('0x2b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x2c')]);router[_0x4c08('0xb')]('/:id/openchannel_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x2d')]);router[_0x4c08('0xb')]('/:id/sms_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x2e')]);router[_0x4c08('0xb')](_0x4c08('0x2f'),auth[_0x4c08('0xa')](),controller['getChatWebsites']);router[_0x4c08('0xb')](_0x4c08('0x30'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x4c08('0xb')]('/:id/square_projects',auth[_0x4c08('0xa')](),controller[_0x4c08('0x31')]);router[_0x4c08('0xb')](_0x4c08('0x32'),auth[_0x4c08('0xa')](),controller['getScheduledCalls']);router[_0x4c08('0xb')](_0x4c08('0x33'),auth[_0x4c08('0xa')](),controller['getApiKey']);router[_0x4c08('0x34')](_0x4c08('0x12'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x35')]);router[_0x4c08('0x34')]('/',auth['isAuthenticated'](),controller[_0x4c08('0x36')]);router[_0x4c08('0x34')](_0x4c08('0x37'),auth['isAuthenticated'](),controller[_0x4c08('0x38')]);router[_0x4c08('0x34')](_0x4c08('0x14'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x39')]);var upload=multer({'storage':multer[_0x4c08('0x3a')]({'destination':function(_0x3567b4,_0x276b6d,_0x176d2e){_0x176d2e(null,path[_0x4c08('0x3b')](config[_0x4c08('0x3c')],_0x4c08('0x3d')));},'filename':function(_0x4c51cd,_0x517748,_0x31cd28){_0x31cd28(null,util[_0x4c08('0x3e')](_0x4c08('0x3f'),Date[_0x4c08('0x40')](),_0x517748[_0x4c08('0x41')]));}})});router['post'](_0x4c08('0x10'),upload[_0x4c08('0x42')](_0x4c08('0x43')),controller[_0x4c08('0x44')]);router[_0x4c08('0x34')]('/:id/login',auth['isAuthenticated'](),controller[_0x4c08('0x45')]);router['post'](_0x4c08('0x46'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x47')]);router[_0x4c08('0x34')](_0x4c08('0x48'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x49')]);router[_0x4c08('0x34')]('/:id/unpause',auth[_0x4c08('0xa')](),controller[_0x4c08('0x4a')]);router['post'](_0x4c08('0x4b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x4c')]);router[_0x4c08('0x34')](_0x4c08('0x4d'),auth[_0x4c08('0xa')](),controller['addChatInteractions']);router[_0x4c08('0x34')](_0x4c08('0x4e'),auth['isAuthenticated'](),controller[_0x4c08('0x4f')]);router[_0x4c08('0x34')](_0x4c08('0x50'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x51')]);router[_0x4c08('0x34')](_0x4c08('0x52'),auth[_0x4c08('0xa')](),controller['addSmsInteractions']);router[_0x4c08('0x34')](_0x4c08('0x53'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x4c08('0x34')]('/:id/whatsapp_interactions',auth[_0x4c08('0xa')](),controller[_0x4c08('0x54')]);router['post'](_0x4c08('0x29'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x4c08('0x34')](_0x4c08('0x2b'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x55')]);router[_0x4c08('0x34')]('/:id/openchannel_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x56')]);router['post'](_0x4c08('0x57'),auth['isAuthenticated'](),controller[_0x4c08('0x58')]);router[_0x4c08('0x34')](_0x4c08('0x2f'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x59')]);router['post'](_0x4c08('0x30'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x5a')]);router['post']('/:id/square_projects',auth[_0x4c08('0xa')](),controller['addSquareProjects']);router[_0x4c08('0x34')]('/:id/api_key',auth[_0x4c08('0xa')](),controller[_0x4c08('0x5b')]);router[_0x4c08('0x5c')](_0x4c08('0xe'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x5d')]);router[_0x4c08('0x5c')]('/:id/password',auth[_0x4c08('0xa')](),controller['changePassword']);router[_0x4c08('0x5e')](_0x4c08('0x14'),auth['isAuthenticated'](),controller[_0x4c08('0x5f')]);router[_0x4c08('0x5e')](_0x4c08('0x4b'),auth['isAuthenticated'](),controller[_0x4c08('0x60')]);router[_0x4c08('0x5e')](_0x4c08('0xe'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x61')]);router[_0x4c08('0x5e')]('/:id/chat_interactions',auth[_0x4c08('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0x4c08('0xa')](),controller['removeMailInteractions']);router[_0x4c08('0x5e')]('/:id/fax_interactions',auth[_0x4c08('0xa')](),controller['removeFaxInteractions']);router[_0x4c08('0x5e')](_0x4c08('0x52'),auth[_0x4c08('0xa')](),controller['removeSmsInteractions']);router[_0x4c08('0x5e')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x4c08('0x62')]);router[_0x4c08('0x5e')](_0x4c08('0x63'),auth[_0x4c08('0xa')](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x64')]);router['delete'](_0x4c08('0x2b'),auth['isAuthenticated'](),controller[_0x4c08('0x65')]);router[_0x4c08('0x5e')]('/:id/openchannel_accounts',auth[_0x4c08('0xa')](),controller[_0x4c08('0x66')]);router['delete'](_0x4c08('0x57'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x67')]);router[_0x4c08('0x5e')](_0x4c08('0x2f'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x68')]);router[_0x4c08('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x4c08('0x69')]);router['delete'](_0x4c08('0x6a'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x6b')]);router[_0x4c08('0x5e')](_0x4c08('0x33'),auth[_0x4c08('0xa')](),controller[_0x4c08('0x6c')]);module['exports']=router; \ No newline at end of file +var _0xfeef=['bulkCreate','post','addQueues','diskStorage','join','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','createApiKey','/:id','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','create'];(function(_0x5544ef,_0x5030df){var _0x35ad53=function(_0x179bb0){while(--_0x179bb0){_0x5544ef['push'](_0x5544ef['shift']());}};_0x35ad53(++_0x5030df);}(_0xfeef,0x11b));var _0xffee=function(_0x2ee47b,_0x137886){_0x2ee47b=_0x2ee47b-0x0;var _0x4ee090=_0xfeef[_0x2ee47b];return _0x4ee090;};'use strict';var multer=require(_0xffee('0x0'));var util=require(_0xffee('0x1'));var path=require(_0xffee('0x2'));var timeout=require(_0xffee('0x3'));var express=require('express');var router=express[_0xffee('0x4')]();var auth=require(_0xffee('0x5'));var interaction=require(_0xffee('0x6'));var config=require(_0xffee('0x7'));var controller=require(_0xffee('0x8'));router['get']('/',auth[_0xffee('0x9')](),controller[_0xffee('0xa')]);router[_0xffee('0xb')](_0xffee('0xc'),auth[_0xffee('0x9')](),controller[_0xffee('0xd')]);router['get']('/whoami',auth[_0xffee('0x9')](),controller[_0xffee('0xe')]);router[_0xffee('0xb')]('/:id',auth[_0xffee('0x9')](),controller[_0xffee('0xf')]);router[_0xffee('0xb')]('/:id/avatar',controller[_0xffee('0x10')]);router[_0xffee('0xb')](_0xffee('0x11'),auth['isAuthenticated'](),controller[_0xffee('0x12')]);router[_0xffee('0xb')](_0xffee('0x13'),auth[_0xffee('0x9')](),controller[_0xffee('0x14')]);router[_0xffee('0xb')](_0xffee('0x15'),auth[_0xffee('0x9')](),controller[_0xffee('0x16')]);router['get'](_0xffee('0x17'),auth[_0xffee('0x9')](),controller[_0xffee('0x18')]);router[_0xffee('0xb')](_0xffee('0x19'),auth['isAuthenticated'](),controller[_0xffee('0x1a')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xffee('0x1b')]);router[_0xffee('0xb')](_0xffee('0x1c'),auth[_0xffee('0x9')](),controller[_0xffee('0x1d')]);router[_0xffee('0xb')](_0xffee('0x1e'),auth[_0xffee('0x9')](),controller[_0xffee('0x1f')]);router[_0xffee('0xb')](_0xffee('0x20'),auth[_0xffee('0x9')](),controller[_0xffee('0x21')]);router[_0xffee('0xb')](_0xffee('0x22'),auth[_0xffee('0x9')](),controller[_0xffee('0x23')]);router[_0xffee('0xb')](_0xffee('0x24'),auth['isAuthenticated'](),controller[_0xffee('0x25')]);router[_0xffee('0xb')](_0xffee('0x26'),auth[_0xffee('0x9')](),controller['getWhatsappInteractions']);router[_0xffee('0xb')](_0xffee('0x27'),auth[_0xffee('0x9')](),controller[_0xffee('0x28')]);router[_0xffee('0xb')]('/:id/lists',auth['isAuthenticated'](),controller[_0xffee('0x29')]);router['get']('/:id/agents',auth[_0xffee('0x9')](),controller['getAgents']);router[_0xffee('0xb')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xffee('0x2a')]);router[_0xffee('0xb')](_0xffee('0x2b'),auth[_0xffee('0x9')](),controller[_0xffee('0x2c')]);router[_0xffee('0xb')](_0xffee('0x2d'),auth[_0xffee('0x9')](),controller['getMailAccounts']);router['get'](_0xffee('0x2e'),auth[_0xffee('0x9')](),controller[_0xffee('0x2f')]);router[_0xffee('0xb')](_0xffee('0x30'),auth[_0xffee('0x9')](),controller[_0xffee('0x31')]);router[_0xffee('0xb')]('/:id/chat_websites',auth[_0xffee('0x9')](),controller[_0xffee('0x32')]);router['get'](_0xffee('0x33'),auth['isAuthenticated'](),controller[_0xffee('0x34')]);router[_0xffee('0xb')](_0xffee('0x35'),auth[_0xffee('0x9')](),controller['getSquareProjects']);router[_0xffee('0xb')](_0xffee('0x36'),auth['isAuthenticated'](),controller[_0xffee('0x37')]);router[_0xffee('0xb')](_0xffee('0x38'),auth[_0xffee('0x9')](),controller[_0xffee('0x39')]);router['post'](_0xffee('0x11'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0xffee('0x9')](),controller[_0xffee('0x3a')]);router['post']('/create_many',auth[_0xffee('0x9')](),controller[_0xffee('0x3b')]);router[_0xffee('0x3c')](_0xffee('0x13'),auth[_0xffee('0x9')](),controller[_0xffee('0x3d')]);var upload=multer({'storage':multer[_0xffee('0x3e')]({'destination':function(_0xcfe692,_0x111748,_0x4f3b07){_0x4f3b07(null,path[_0xffee('0x3f')](config['root'],'server/files/images/'));},'filename':function(_0x525fce,_0x4b061b,_0x2a2cb4){_0x2a2cb4(null,util[_0xffee('0x40')](_0xffee('0x41'),Date['now'](),_0x4b061b[_0xffee('0x42')]));}})});router[_0xffee('0x3c')](_0xffee('0x43'),upload[_0xffee('0x44')](_0xffee('0x45')),controller[_0xffee('0x46')]);router[_0xffee('0x3c')](_0xffee('0x47'),auth[_0xffee('0x9')](),controller[_0xffee('0x48')]);router[_0xffee('0x3c')]('/:id/logout',auth[_0xffee('0x9')](),controller['logout']);router[_0xffee('0x3c')]('/:id/pause',auth[_0xffee('0x9')](),controller['pause']);router[_0xffee('0x3c')](_0xffee('0x49'),auth['isAuthenticated'](),controller[_0xffee('0x4a')]);router[_0xffee('0x3c')](_0xffee('0x27'),auth[_0xffee('0x9')](),controller[_0xffee('0x4b')]);router['post'](_0xffee('0x4c'),auth[_0xffee('0x9')](),controller[_0xffee('0x4d')]);router[_0xffee('0x3c')]('/:id/mail_interactions',auth[_0xffee('0x9')](),controller[_0xffee('0x4e')]);router[_0xffee('0x3c')](_0xffee('0x4f'),auth['isAuthenticated'](),controller[_0xffee('0x50')]);router[_0xffee('0x3c')](_0xffee('0x51'),auth[_0xffee('0x9')](),controller[_0xffee('0x52')]);router[_0xffee('0x3c')](_0xffee('0x53'),auth[_0xffee('0x9')](),controller[_0xffee('0x54')]);router[_0xffee('0x3c')](_0xffee('0x55'),auth[_0xffee('0x9')](),controller['addWhatsappInteractions']);router[_0xffee('0x3c')](_0xffee('0x2b'),auth[_0xffee('0x9')](),controller[_0xffee('0x56')]);router[_0xffee('0x3c')](_0xffee('0x2d'),auth['isAuthenticated'](),controller[_0xffee('0x57')]);router[_0xffee('0x3c')](_0xffee('0x2e'),auth[_0xffee('0x9')](),controller[_0xffee('0x58')]);router['post'](_0xffee('0x30'),auth[_0xffee('0x9')](),controller[_0xffee('0x59')]);router['post'](_0xffee('0x5a'),auth[_0xffee('0x9')](),controller['addChatWebsites']);router[_0xffee('0x3c')]('/:id/whatsapp_accounts',auth[_0xffee('0x9')](),controller[_0xffee('0x5b')]);router[_0xffee('0x3c')]('/:id/square_projects',auth[_0xffee('0x9')](),controller[_0xffee('0x5c')]);router[_0xffee('0x3c')](_0xffee('0x38'),auth[_0xffee('0x9')](),controller[_0xffee('0x5d')]);router['put'](_0xffee('0x5e'),auth[_0xffee('0x9')](),controller[_0xffee('0x5f')]);router[_0xffee('0x60')](_0xffee('0x61'),auth['isAuthenticated'](),controller[_0xffee('0x62')]);router[_0xffee('0x63')](_0xffee('0x13'),auth[_0xffee('0x9')](),controller[_0xffee('0x64')]);router[_0xffee('0x63')](_0xffee('0x27'),auth[_0xffee('0x9')](),controller[_0xffee('0x65')]);router[_0xffee('0x63')](_0xffee('0x5e'),auth[_0xffee('0x9')](),controller['destroy']);router[_0xffee('0x63')](_0xffee('0x4c'),auth[_0xffee('0x9')](),controller['removeChatInteractions']);router[_0xffee('0x63')](_0xffee('0x66'),auth[_0xffee('0x9')](),controller[_0xffee('0x67')]);router[_0xffee('0x63')](_0xffee('0x4f'),auth[_0xffee('0x9')](),controller[_0xffee('0x68')]);router[_0xffee('0x63')](_0xffee('0x51'),auth[_0xffee('0x9')](),controller[_0xffee('0x69')]);router[_0xffee('0x63')](_0xffee('0x53'),auth['isAuthenticated'](),controller[_0xffee('0x6a')]);router[_0xffee('0x63')](_0xffee('0x55'),auth['isAuthenticated'](),controller[_0xffee('0x6b')]);router[_0xffee('0x63')](_0xffee('0x2b'),auth[_0xffee('0x9')](),controller[_0xffee('0x6c')]);router[_0xffee('0x63')](_0xffee('0x2d'),auth[_0xffee('0x9')](),controller['removeMailAccounts']);router[_0xffee('0x63')](_0xffee('0x2e'),auth[_0xffee('0x9')](),controller[_0xffee('0x6d')]);router[_0xffee('0x63')](_0xffee('0x30'),auth[_0xffee('0x9')](),controller[_0xffee('0x6e')]);router['delete'](_0xffee('0x5a'),auth[_0xffee('0x9')](),controller['removeChatWebsites']);router['delete']('/:id/whatsapp_accounts',auth[_0xffee('0x9')](),controller[_0xffee('0x6f')]);router['delete']('/:id/square_projects',auth[_0xffee('0x9')](),controller['removeSquareProjects']);router[_0xffee('0x63')](_0xffee('0x38'),auth[_0xffee('0x9')](),controller[_0xffee('0x70')]);module[_0xffee('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 969bf42..f05f491 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 _0x1ab1=['nonat','update','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','true','false','screenrecording','blockedAt','loginAttempts','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','ALLOWED_PASSED_SCREEN','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]','info','shortinfo','rfc2833','yes','outgoing','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass'];(function(_0xc16403,_0x19f30c){var _0x4e351d=function(_0x4fe512){while(--_0x4fe512){_0xc16403['push'](_0xc16403['shift']());}};_0x4e351d(++_0x19f30c);}(_0x1ab1,0x1cd));var _0x11ab=function(_0x378820,_0x42c20e){_0x378820=_0x378820-0x0;var _0x45d922=_0x1ab1[_0x378820];return _0x45d922;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x11ab('0x0'));var _=require(_0x11ab('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11ab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1837a0){this[_0x11ab('0x3')](_0x11ab('0x2'),_0x1837a0);this[_0x11ab('0x3')](_0x11ab('0x4'),_0x1837a0);},'comment':_0x11ab('0x5')},'fullname':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'set':function(_0x3e7490){this['setDataValue'](_0x11ab('0x7'),_0x3e7490);this[_0x11ab('0x3')](_0x11ab('0x8'),util[_0x11ab('0x9')](_0x11ab('0xa'),_0x3e7490,this[_0x11ab('0xb')](_0x11ab('0xc'))));}},'alias':{'type':Sequelize[_0x11ab('0x6')]},'email':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'unique':_0x11ab('0xd'),'validate':{'isEmail':!![]},'set':function(_0x4f555e){if(_0x4f555e){this[_0x11ab('0x3')]('email',_0x4f555e[_0x11ab('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x11ab('0xf'),_0x11ab('0x10'),_0x11ab('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x11ab('0xc'),'set':function(_0x409b00){this[_0x11ab('0x3')]('internal',_0x409b00);this[_0x11ab('0x3')](_0x11ab('0x12'),_0x409b00);this[_0x11ab('0x3')](_0x11ab('0x8'),util[_0x11ab('0x9')](_0x11ab('0xa'),this[_0x11ab('0xb')](_0x11ab('0x7')),_0x409b00));}},'salt':{'type':Sequelize[_0x11ab('0x6')]},'phone':{'type':Sequelize[_0x11ab('0x6')]},'mobile':{'type':Sequelize[_0x11ab('0x6')]},'address':{'type':Sequelize[_0x11ab('0x6')]},'zipcode':{'type':Sequelize[_0x11ab('0x6')]},'userpic':{'type':Sequelize[_0x11ab('0x6')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x11ab('0x6')]},'online':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x11ab('0x14')]},'voicePause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':_0x11ab('0x15')},'lastPauseAt':{'type':Sequelize[_0x11ab('0x14')]},'chatCapacity':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x11ab('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x11ab('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x17')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x19'),_0x11ab('0x10'),_0x11ab('0x1a')),'allowNull':!![],'defaultValue':_0x11ab('0x19')},'context':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x11ab('0x18')]('ALLOWED_NOT_SCREENED',_0x11ab('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x11ab('0x1c'),_0x11ab('0x1d'),_0x11ab('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x1f'),'set':function(_0x476758){this[_0x11ab('0x3')](_0x11ab('0x20'),_0x476758?_0x476758['join'](','):null);},'get':function(){return this['getDataValue'](_0x11ab('0x20'))?this[_0x11ab('0xb')]('transport')[_0x11ab('0x21')](','):null;},'comment':_0x11ab('0x22')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x11ab('0x23'),_0x11ab('0x24'),'inband','auto'),'allowNull':!![],'defaultValue':_0x11ab('0x25')},'directmedia':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no','nonat','update',_0x11ab('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x28'),'set':function(_0x5a6967){this[_0x11ab('0x3')]('nat',_0x5a6967?_0x5a6967[_0x11ab('0x29')](','):null);},'get':function(){return this['getDataValue'](_0x11ab('0x2a'))?this['getDataValue'](_0x11ab('0x2a'))[_0x11ab('0x21')](','):null;},'comment':_0x11ab('0x2b')},'callgroup':{'type':Sequelize[_0x11ab('0x6')]},'namedcallgroup':{'type':Sequelize[_0x11ab('0x6')]},'pickupgroup':{'type':Sequelize[_0x11ab('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'defaultValue':_0x11ab('0x2c')},'allow':{'type':Sequelize[_0x11ab('0x6')],'allowNull':![],'defaultValue':_0x11ab('0x2d'),'set':function(_0x49bbd2){this[_0x11ab('0x3')]('allow',_0x49bbd2?_0x49bbd2['join'](';'):_0x11ab('0x2d'));},'get':function(){return this[_0x11ab('0xb')](_0x11ab('0x2e'))?this[_0x11ab('0xb')]('allow')[_0x11ab('0x21')](';'):null;},'comment':_0x11ab('0x2f')},'autoframing':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x18beca){this[_0x11ab('0x3')](_0x11ab('0x30'),_0x18beca?_0x18beca[_0x11ab('0x29')](','):null);},'get':function(){return this[_0x11ab('0xb')](_0x11ab('0x30'))?this[_0x11ab('0xb')](_0x11ab('0x30'))[_0x11ab('0x21')](','):null;},'comment':_0x11ab('0x31')},'trustrpid':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no',_0x11ab('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![],'defaultValue':_0x11ab('0x33')},'amaflags':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':_0x11ab('0x26')},'busylevel':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x11ab('0x18')]('yes','no',_0x11ab('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x35'),'refuse',_0x11ab('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x11ab('0x37'),_0x11ab('0x38')),'allowNull':!![],'defaultValue':_0x11ab('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no','fingerprint',_0x11ab('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x3a'),_0x11ab('0x3b'),_0x11ab('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x11ab('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x11ab('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x11ab('0x18')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no',_0x11ab('0x3d'),_0x11ab('0x3e'),_0x11ab('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x11ab('0x6')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x11ab('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x11ab('0x6')]},'showWebBar':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0,'set':function(_0x39362a){this['setDataValue'](_0x11ab('0x40'),_0x39362a);var _0x31e4d6=this[_0x11ab('0x41')]({'plain':!![]});switch(_0x39362a){case 0x0:case 0x1:var _0xbd944f=_0x31e4d6['transport']?_[_0x11ab('0x42')](_0x31e4d6[_0x11ab('0x20')])?_0x31e4d6[_0x11ab('0x20')][_0x11ab('0x29')]():_0x31e4d6[_0x11ab('0x20')]:'udp';if(_0xbd944f===_0x11ab('0x43')){_0xbd944f='udp';}this['setDataValue']('transport',_0xbd944f);this[_0x11ab('0x3')](_0x11ab('0x44'),'no');this[_0x11ab('0x3')](_0x11ab('0x45'),null);this['setDataValue'](_0x11ab('0x46'),null);this[_0x11ab('0x3')]('icesupport',null);this[_0x11ab('0x3')](_0x11ab('0x47'),null);this['setDataValue'](_0x11ab('0x48'),null);this['setDataValue'](_0x11ab('0x49'),null);this['setDataValue'](_0x11ab('0x4a'),null);this[_0x11ab('0x3')](_0x11ab('0x4b'),null);this[_0x11ab('0x3')]('rtcp_mux','no');break;case 0x2:this[_0x11ab('0x3')]('transport',_0x11ab('0x43'));this[_0x11ab('0x3')](_0x11ab('0x44'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x45'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x46'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x4c'),'yes');this[_0x11ab('0x3')](_0x11ab('0x47'),_0x11ab('0x26'));this[_0x11ab('0x3')](_0x11ab('0x48'),'no');this[_0x11ab('0x3')](_0x11ab('0x49'),_0x11ab('0x3c'));this[_0x11ab('0x3')](_0x11ab('0x4a'),_0x31e4d6[_0x11ab('0x4a')]||'/etc/pki/tls/certs/motion.crt');this[_0x11ab('0x3')]('dtlsprivatekey',_0x31e4d6[_0x11ab('0x4b')]||_0x11ab('0x4d'));this[_0x11ab('0x3')](_0x11ab('0x4e'),_0x11ab('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x74c763){this[_0x11ab('0x3')](_0x11ab('0x4f'),_0x74c763?_0x74c763[_0x11ab('0x29')](','):[]);},'get':function(){return this['getDataValue'](_0x11ab('0x4f'))?_[_0x11ab('0x50')](this[_0x11ab('0xb')](_0x11ab('0x4f'))['split'](','),function(_0x30d0a3){return parseInt(_0x30d0a3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x11ab('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x11ab('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x11ab('0x18')](_0x11ab('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x11ab('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x11ab('0x51')],'get':function(){return this[_0x11ab('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x11ab('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x11ab('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x11ab('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![],'set':function(_0x5d6995){if(typeof _0x5d6995==='string'){var _0x109e4c=_0x5d6995==='1'?!![]:_0x5d6995==='0'?![]:_0x5d6995===_0x11ab('0x52')?!![]:_0x5d6995===_0x11ab('0x53')?![]:![];this[_0x11ab('0x3')]('screenrecording',_0x109e4c);}else{this['setDataValue'](_0x11ab('0x54'),_0x5d6995);}}},'blocked':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![],'set':function(_0x596789){this[_0x11ab('0x3')]('blocked',_0x596789);if(_0x596789===!![]){this[_0x11ab('0x3')](_0x11ab('0x55'),moment());this[_0x11ab('0x3')](_0x11ab('0x56'),0x0);}else{this[_0x11ab('0x3')](_0x11ab('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x11ab('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x11ab('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x11ab('0x13')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3bad=['map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive','actpass','showWebBar','isArray','wss','encryption','force_avp','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','avpf','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','TEXT','permissions'];(function(_0x7ae37,_0x37fc1d){var _0x1d1a9a=function(_0x4ab086){while(--_0x4ab086){_0x7ae37['push'](_0x7ae37['shift']());}};_0x1d1a9a(++_0x37fc1d);}(_0x3bad,0xc1));var _0xd3ba=function(_0x56937e,_0x1afc7d){_0x56937e=_0x56937e-0x0;var _0x337487=_0x3bad[_0x56937e];return _0x337487;};'use strict';var Sequelize=require(_0xd3ba('0x0'));var moment=require(_0xd3ba('0x1'));var util=require(_0xd3ba('0x2'));var _=require(_0xd3ba('0x3'));module[_0xd3ba('0x4')]={'name':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'unique':_0xd3ba('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x332e8b){this[_0xd3ba('0x7')]('name',_0x332e8b);this[_0xd3ba('0x7')](_0xd3ba('0x8'),_0x332e8b);},'comment':_0xd3ba('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x25665c){this['setDataValue'](_0xd3ba('0xa'),_0x25665c);this['setDataValue'](_0xd3ba('0xb'),util[_0xd3ba('0xc')]('\x22%s\x22\x20<%s>',_0x25665c,this[_0xd3ba('0xd')](_0xd3ba('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'unique':_0xd3ba('0xf'),'validate':{'isEmail':!![]},'set':function(_0x4c5e18){if(_0x4c5e18){this[_0xd3ba('0x7')](_0xd3ba('0xf'),_0x4c5e18[_0xd3ba('0x10')]());}}},'role':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x12'),_0xd3ba('0x13'),'agent',_0xd3ba('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':_0xd3ba('0x15')},'internal':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':![],'unique':_0xd3ba('0xe'),'set':function(_0xf55a06){this[_0xd3ba('0x7')](_0xd3ba('0xe'),_0xf55a06);this[_0xd3ba('0x7')](_0xd3ba('0x17'),_0xf55a06);this[_0xd3ba('0x7')](_0xd3ba('0xb'),util[_0xd3ba('0xc')](_0xd3ba('0x18'),this[_0xd3ba('0xd')](_0xd3ba('0xa')),_0xf55a06));}},'salt':{'type':Sequelize[_0xd3ba('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd3ba('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xd3ba('0x5')]},'userpic':{'type':Sequelize[_0xd3ba('0x5')]},'city':{'type':Sequelize[_0xd3ba('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd3ba('0x1a')]},'voicePause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':_0xd3ba('0x1b')},'lastPauseAt':{'type':Sequelize[_0xd3ba('0x1a')]},'chatCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd3ba('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd3ba('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x1c')},'ipaddr':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xd3ba('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x1d'),_0xd3ba('0x13'),_0xd3ba('0x1e')),'allowNull':!![],'defaultValue':_0xd3ba('0x1d')},'context':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x1f')},'callingpres':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x20'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xd3ba('0x21'),_0xd3ba('0x22'),'PROHIB_PASSED_SCREEN',_0xd3ba('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x24'),'set':function(_0x473779){this['setDataValue'](_0xd3ba('0x25'),_0x473779?_0x473779[_0xd3ba('0x26')](','):null);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x25'))?this['getDataValue'](_0xd3ba('0x25'))['split'](','):null;},'comment':_0xd3ba('0x27')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xd3ba('0x28'),_0xd3ba('0x29'),_0xd3ba('0x2a'),_0xd3ba('0x2b')),'allowNull':!![],'defaultValue':_0xd3ba('0x2c')},'directmedia':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no',_0xd3ba('0x2e'),_0xd3ba('0x2f'),_0xd3ba('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x11167f){this[_0xd3ba('0x7')](_0xd3ba('0x31'),_0x11167f?_0x11167f[_0xd3ba('0x26')](','):null);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x31'))?this[_0xd3ba('0xd')](_0xd3ba('0x31'))[_0xd3ba('0x32')](','):null;},'comment':_0xd3ba('0x33')},'callgroup':{'type':Sequelize[_0xd3ba('0x5')]},'namedcallgroup':{'type':Sequelize[_0xd3ba('0x5')]},'pickupgroup':{'type':Sequelize[_0xd3ba('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xd3ba('0x5')]},'language':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd3ba('0x5')]},'disallow':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'defaultValue':_0xd3ba('0x34')},'allow':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':![],'defaultValue':_0xd3ba('0x35'),'set':function(_0x45983a){this[_0xd3ba('0x7')](_0xd3ba('0x36'),_0x45983a?_0x45983a[_0xd3ba('0x26')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xd3ba('0xd')]('allow')?this[_0xd3ba('0xd')]('allow')[_0xd3ba('0x32')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'set':function(_0x123852){this[_0xd3ba('0x7')]('insecure',_0x123852?_0x123852[_0xd3ba('0x26')](','):null);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x37'))?this[_0xd3ba('0xd')]('insecure')[_0xd3ba('0x32')](','):null;},'comment':_0xd3ba('0x38')},'trustrpid':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no',_0xd3ba('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![],'defaultValue':_0xd3ba('0x3a')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xd3ba('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd3ba('0x11')]('yes','no',_0xd3ba('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x3c'),_0xd3ba('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x3e'),_0xd3ba('0x3f')),'allowNull':!![],'defaultValue':_0xd3ba('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no',_0xd3ba('0x40'),_0xd3ba('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd3ba('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd3ba('0x11')]('active',_0xd3ba('0x42'),_0xd3ba('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd3ba('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xd3ba('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no',_0xd3ba('0x2e'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd3ba('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xd3ba('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xd3ba('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0,'set':function(_0x1a7bd0){this[_0xd3ba('0x7')](_0xd3ba('0x44'),_0x1a7bd0);var _0x29ecb7=this['get']({'plain':!![]});switch(_0x1a7bd0){case 0x0:case 0x1:var _0x5e166c=_0x29ecb7[_0xd3ba('0x25')]?_[_0xd3ba('0x45')](_0x29ecb7[_0xd3ba('0x25')])?_0x29ecb7[_0xd3ba('0x25')]['join']():_0x29ecb7[_0xd3ba('0x25')]:_0xd3ba('0x24');if(_0x5e166c===_0xd3ba('0x46')){_0x5e166c=_0xd3ba('0x24');}this[_0xd3ba('0x7')](_0xd3ba('0x25'),_0x5e166c);this[_0xd3ba('0x7')](_0xd3ba('0x47'),'no');this['setDataValue']('avpf',null);this['setDataValue'](_0xd3ba('0x48'),null);this[_0xd3ba('0x7')]('icesupport',null);this[_0xd3ba('0x7')](_0xd3ba('0x49'),null);this['setDataValue'](_0xd3ba('0x4a'),null);this[_0xd3ba('0x7')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0xd3ba('0x7')](_0xd3ba('0x4b'),null);this[_0xd3ba('0x7')](_0xd3ba('0x4c'),'no');break;case 0x2:this[_0xd3ba('0x7')]('transport',_0xd3ba('0x46'));this['setDataValue']('encryption',_0xd3ba('0x2d'));this[_0xd3ba('0x7')](_0xd3ba('0x4d'),_0xd3ba('0x2d'));this[_0xd3ba('0x7')]('force_avp','yes');this['setDataValue']('icesupport',_0xd3ba('0x2d'));this[_0xd3ba('0x7')](_0xd3ba('0x49'),'yes');this['setDataValue'](_0xd3ba('0x4a'),'no');this[_0xd3ba('0x7')](_0xd3ba('0x4e'),_0xd3ba('0x43'));this[_0xd3ba('0x7')](_0xd3ba('0x4f'),_0x29ecb7['dtlscertfile']||_0xd3ba('0x50'));this[_0xd3ba('0x7')](_0xd3ba('0x4b'),_0x29ecb7[_0xd3ba('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0xd3ba('0x7')](_0xd3ba('0x4c'),_0xd3ba('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xd3ba('0x51')],'set':function(_0x5e9433){this[_0xd3ba('0x7')](_0xd3ba('0x52'),_0x5e9433?_0x5e9433[_0xd3ba('0x26')](','):[]);},'get':function(){return this[_0xd3ba('0xd')](_0xd3ba('0x52'))?_[_0xd3ba('0x53')](this[_0xd3ba('0xd')](_0xd3ba('0x52'))[_0xd3ba('0x32')](','),function(_0x47621b){return parseInt(_0x47621b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd3ba('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd3ba('0x11')](_0xd3ba('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd3ba('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xd3ba('0x54'))?this['getDataValue'](_0xd3ba('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd3ba('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![],'set':function(_0x596cfb){if(typeof _0x596cfb===_0xd3ba('0x55')){var _0x293894=_0x596cfb==='1'?!![]:_0x596cfb==='0'?![]:_0x596cfb===_0xd3ba('0x56')?!![]:_0x596cfb===_0xd3ba('0x57')?![]:![];this[_0xd3ba('0x7')](_0xd3ba('0x58'),_0x293894);}else{this[_0xd3ba('0x7')]('screenrecording',_0x596cfb);}}},'blocked':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![],'set':function(_0x3c8582){this[_0xd3ba('0x7')](_0xd3ba('0x59'),_0x3c8582);if(_0x3c8582===!![]){this[_0xd3ba('0x7')]('blockedAt',moment());this[_0xd3ba('0x7')](_0xd3ba('0x5a'),0x0);}else{this[_0xd3ba('0x7')](_0xd3ba('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0xd3ba('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd3ba('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd3ba('0x19')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f82e561..bf6381b 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 _0xf984=['$lte','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','CmHopper','firstName','phone','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./user.socket','register','client','http','request','info','request\x20sent','debug','stringify','error','code','User,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','role','admin','user','agent','Telephones','filter','ignore','value','includes','name','destroy','stack','send','index','map','rawAttributes','fieldName','type','differenceBy','salt','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','sequelize','lower','col','options','User','includeAll','include','findAll','show','password','find','catch','body','params','describe','addContacts','ids','omit','findById','securePassword','validatePasswordPattern','internal','min_internal','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','113','104','105','106','107','108','109','111','114','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Agents','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','some','telephone','isEmpty','compact','changePassword','Sequelize','ValidationError','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','newPassword','Setting','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','Queue:save','format','SIP/%s','penalty','each','UserVoiceQueueRt','upsert','removeQueues','remove','QueueId','emit','Queue:remove','voice','addAvatar','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','findOne','CmContact','Tag','Tags','color','tag','getQueues','Unknown\x20role','Queue','getVoiceQueuesRt','hasOwnProperty','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','rows','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','concat','resolve','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','lastPauseAt','QueuePause','manual','mail','chat','fax','sms','Pause','Team','getTeams','addTeams','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','addAgent','voicePause','removeTeams','Chat','Sms','flatten','getDataValue','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$or','$gte','$lt'];(function(_0x17bfae,_0x52023d){var _0x6af798=function(_0x21a0f4){while(--_0x21a0f4){_0x17bfae['push'](_0x17bfae['shift']());}};_0x6af798(++_0x52023d);}(_0xf984,0x193));var _0x4f98=function(_0x1fa274,_0x27a51f){_0x1fa274=_0x1fa274-0x0;var _0x5601e0=_0xf984[_0x1fa274];return _0x5601e0;};'use strict';var pdf=require(_0x4f98('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f98('0x2'));var moment=require('moment');var BPromise=require(_0x4f98('0x3'));var Mustache=require(_0x4f98('0x4'));var util=require(_0x4f98('0x5'));var path=require(_0x4f98('0x6'));var sox=require(_0x4f98('0x7'));var csv=require(_0x4f98('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f98('0x9'));var squel=require(_0x4f98('0xa'));var crypto=require(_0x4f98('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4f98('0xc'));var toCsv=require(_0x4f98('0x8'));var querystring=require(_0x4f98('0xd'));var Papa=require(_0x4f98('0xe'));var Redis=require('ioredis');var authService=require(_0x4f98('0xf'));var qs=require(_0x4f98('0x10'));var as=require(_0x4f98('0x11'));var hardwareService=require(_0x4f98('0x12'));var logger=require('../../config/logger')(_0x4f98('0x13'));var utils=require(_0x4f98('0x14'));var config=require(_0x4f98('0x15'));var licenseUtil=require(_0x4f98('0x16'));var db=require('../../mysqldb')['db'];config[_0x4f98('0x17')]=_['defaults'](config[_0x4f98('0x17')],{'host':_0x4f98('0x18'),'port':0x18eb});var socket=require(_0x4f98('0x19'))(new Redis(config[_0x4f98('0x17')]));require(_0x4f98('0x1a'))[_0x4f98('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4f98('0x1c')][_0x4f98('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x287945,_0xa05c72,_0x55286e,_0x7073f6){return new BPromise(function(_0x30a5a6,_0x143229){var _0x47f6e7=_0x7073f6||client;return _0x47f6e7[_0x4f98('0x1e')](_0x287945,_0x55286e)['then'](function(_0xf4cb20){logger[_0x4f98('0x1f')]('User,\x20%s,\x20%s',_0xa05c72,_0x4f98('0x20'));logger[_0x4f98('0x21')]('User,\x20%s,\x20%s,\x20%s',_0xa05c72,_0x4f98('0x20'),JSON[_0x4f98('0x22')](_0xf4cb20));if(_0xf4cb20[_0x4f98('0x23')]){if(_0xf4cb20[_0x4f98('0x23')][_0x4f98('0x24')]===0x1f4){logger[_0x4f98('0x23')](_0x4f98('0x25'),_0xa05c72,_0xf4cb20[_0x4f98('0x23')][_0x4f98('0x26')]);return _0x143229(_0xf4cb20[_0x4f98('0x23')][_0x4f98('0x26')]);}logger[_0x4f98('0x23')](_0x4f98('0x25'),_0xa05c72,_0xf4cb20[_0x4f98('0x23')][_0x4f98('0x26')]);return _0x30a5a6(_0xf4cb20[_0x4f98('0x23')]['message']);}else{logger[_0x4f98('0x1f')](_0x4f98('0x25'),_0xa05c72,_0x4f98('0x20'));_0x30a5a6(_0xf4cb20['result'][_0x4f98('0x26')]);}})['catch'](function(_0x486330){logger[_0x4f98('0x23')](_0x4f98('0x25'),_0xa05c72,_0x486330);_0x143229(_0x486330);});});}function respondWithStatusCode(_0x57c459,_0x5cf782){_0x5cf782=_0x5cf782||0xcc;return function(_0x55e8c6){if(_0x55e8c6){return _0x57c459[_0x4f98('0x27')](_0x5cf782);}return _0x57c459[_0x4f98('0x28')](_0x5cf782)[_0x4f98('0x29')]();};}function respondWithResult(_0x15f3ce,_0x4ad1d1){_0x4ad1d1=_0x4ad1d1||0xc8;return function(_0x5460fb){if(_0x5460fb){return _0x15f3ce[_0x4f98('0x28')](_0x4ad1d1)[_0x4f98('0x2a')](_0x5460fb);}};}function respondWithFilteredResult(_0xcd5f20,_0x29ec6d){return function(_0x5b0d2a){if(_0x5b0d2a){var _0x43918a=_0x5b0d2a[_0x4f98('0x2b')],_0x5563d0=_0x29ec6d[_0x4f98('0x2c')],_0x20c158=_0x29ec6d['offset']+_0x29ec6d[_0x4f98('0x2d')],_0x4663b4;if(_0x20c158>=_0x43918a){_0x20c158=_0x43918a;_0x4663b4=0xc8;}else{_0x4663b4=0xce;}_0xcd5f20[_0x4f98('0x28')](_0x4663b4);return _0xcd5f20[_0x4f98('0x2e')](_0x4f98('0x2f'),_0x5563d0+'-'+_0x20c158+'/'+_0x43918a)[_0x4f98('0x2a')](_0x5b0d2a);}return null;};}function patchUpdates(_0x3bbaf4){return function(_0x4f956f){try{jsonpatch[_0x4f98('0x30')](_0x4f956f,_0x3bbaf4,!![]);}catch(_0x7bd913){return BPromise[_0x4f98('0x31')](_0x7bd913);}return _0x4f956f[_0x4f98('0x32')]();};}function saveUpdates(_0x5baf02,_0x1a88fe){return function(_0x705178){if(_0x705178){return _0x705178[_0x4f98('0x33')](_0x5baf02)[_0x4f98('0x34')](function(_0x5065ee){return _0x5065ee;});}return null;};}function removeEntity(_0x6aafa9,_0x246bef){return function(_0x533661){if(_0x533661){return _0x533661['destroy']()[_0x4f98('0x34')](function(){var _0x62bdbb=_0x533661[_0x4f98('0x35')]({'plain':!![]});if(_0x62bdbb[_0x4f98('0x36')]===_0x4f98('0x37'))return;var _0x5c5c4a=[{'name':'Users','value':_0x4f98('0x38'),'ignore':!![]},{'name':'Agents','value':_0x4f98('0x39'),'ignore':![]},{'name':_0x4f98('0x3a'),'value':'telephone','ignore':![]}];var _0x5429bb=_(_0x5c5c4a)[_0x4f98('0x3b')](_0x4f98('0x3c'))['map'](_0x4f98('0x3d'))[_0x4f98('0x3d')]();if(_[_0x4f98('0x3e')](_0x5429bb,_0x62bdbb[_0x4f98('0x36')])){return;}var _0x2ae0c4=_['find'](_0x5c5c4a,[_0x4f98('0x3d'),_0x62bdbb[_0x4f98('0x36')]])[_0x4f98('0x3f')];return db['UserProfileResource'][_0x4f98('0x40')]({'where':{'type':_0x2ae0c4,'resourceId':_0x62bdbb['id']}})[_0x4f98('0x34')](function(){return _0x533661;});})[_0x4f98('0x34')](function(){_0x6aafa9[_0x4f98('0x28')](0xcc)[_0x4f98('0x29')]();});}};}function handleEntityNotFound(_0x892b2b,_0xaae01){return function(_0x5f5ccb){if(!_0x5f5ccb){_0x892b2b[_0x4f98('0x27')](0x194);}return _0x5f5ccb;};}function handleError(_0x4fcc54,_0x469bfc){_0x469bfc=_0x469bfc||0x1f4;return function(_0x3b15b1){logger['error'](_0x3b15b1[_0x4f98('0x41')]);if(_0x3b15b1[_0x4f98('0x3f')]){delete _0x3b15b1[_0x4f98('0x3f')];}_0x4fcc54['status'](_0x469bfc)[_0x4f98('0x42')](_0x3b15b1);};}exports[_0x4f98('0x43')]=function(_0x202fd2,_0x3d813b){var _0x22dc6f={},_0x5f2516={},_0x43f4f4={'count':0x0,'rows':[]};var _0x204fe6=_[_0x4f98('0x44')](db['User'][_0x4f98('0x45')],function(_0x216859){return{'name':_0x216859[_0x4f98('0x46')],'type':_0x216859[_0x4f98('0x47')]['key']};});_0x5f2516['model']=_[_0x4f98('0x48')](_[_0x4f98('0x44')](_0x204fe6,'name'),['password',_0x4f98('0x49')]);_0x5f2516[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x202fd2['query']);_0x5f2516[_0x4f98('0x4c')]=_['intersection'](_0x5f2516[_0x4f98('0x4d')],_0x5f2516[_0x4f98('0x4a')]);_0x22dc6f[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x5f2516['model'],qs[_0x4f98('0x50')](_0x202fd2[_0x4f98('0x4a')]['fields']));_0x22dc6f[_0x4f98('0x4e')]=_0x22dc6f[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x22dc6f[_0x4f98('0x4e')]:_0x5f2516[_0x4f98('0x4d')];if(!_0x202fd2[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x52'))){_0x22dc6f['limit']=qs[_0x4f98('0x2d')](_0x202fd2[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x22dc6f['offset']=qs[_0x4f98('0x2c')](_0x202fd2[_0x4f98('0x4a')]['offset']);}_0x22dc6f[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x202fd2[_0x4f98('0x4a')]['sort']);_0x22dc6f[_0x4f98('0x55')]=qs['filters'](_[_0x4f98('0x56')](_0x202fd2[_0x4f98('0x4a')],_0x5f2516[_0x4f98('0x4c')]),_0x204fe6);if(_0x202fd2['query'][_0x4f98('0x3b')]){_0x22dc6f['where']=_[_0x4f98('0x57')](_0x22dc6f[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x204fe6,function(_0x378c16){if(_0x378c16[_0x4f98('0x47')]!=='VIRTUAL'){return db[_0x4f98('0x58')][_0x4f98('0x55')](db[_0x4f98('0x58')]['fn'](_0x4f98('0x59'),db['sequelize'][_0x4f98('0x5a')](_0x378c16[_0x4f98('0x3f')])),{'$like':db[_0x4f98('0x58')]['fn'](_0x4f98('0x59'),'%'+_0x202fd2[_0x4f98('0x4a')]['filter']+'%')});}})});}_0x22dc6f=_['merge']({},_0x22dc6f,_0x202fd2[_0x4f98('0x5b')]);var _0x17e550={'where':_0x22dc6f[_0x4f98('0x55')]};return db[_0x4f98('0x5c')][_0x4f98('0x2b')](_0x17e550)[_0x4f98('0x34')](function(_0x171da8){_0x43f4f4['count']=_0x171da8;if(_0x202fd2['query'][_0x4f98('0x5d')]){_0x22dc6f[_0x4f98('0x5e')]=[{'all':!![]}];}return db[_0x4f98('0x5c')][_0x4f98('0x5f')](_0x22dc6f);})['then'](function(_0x187c47){_0x43f4f4['rows']=_0x187c47;return _0x43f4f4;})['then'](respondWithFilteredResult(_0x3d813b,_0x22dc6f))['catch'](handleError(_0x3d813b,null));};exports[_0x4f98('0x60')]=function(_0x3d0870,_0x4ef8b4){var _0xa97608={'raw':![],'where':{'id':_0x3d0870['params']['id']}},_0x171da2={};_0x171da2[_0x4f98('0x4d')]=_[_0x4f98('0x48')](_[_0x4f98('0x4b')](db[_0x4f98('0x5c')][_0x4f98('0x45')]),[_0x4f98('0x61'),_0x4f98('0x49')]);_0x171da2['query']=_[_0x4f98('0x4b')](_0x3d0870[_0x4f98('0x4a')]);_0x171da2['filters']=_[_0x4f98('0x4f')](_0x171da2['model'],_0x171da2[_0x4f98('0x4a')]);_0xa97608[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x171da2[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x3d0870[_0x4f98('0x4a')][_0x4f98('0x50')]));_0xa97608[_0x4f98('0x4e')]=_0xa97608['attributes'][_0x4f98('0x51')]?_0xa97608[_0x4f98('0x4e')]:_0x171da2[_0x4f98('0x4d')];if(_0x3d0870[_0x4f98('0x4a')][_0x4f98('0x5d')]){_0xa97608[_0x4f98('0x5e')]=[{'all':!![]}];}_0xa97608=_[_0x4f98('0x57')]({},_0xa97608,_0x3d0870[_0x4f98('0x5b')]);return db['User'][_0x4f98('0x62')](_0xa97608)[_0x4f98('0x34')](handleEntityNotFound(_0x4ef8b4,null))[_0x4f98('0x34')](respondWithResult(_0x4ef8b4,null))[_0x4f98('0x63')](handleError(_0x4ef8b4,null));};exports['update']=function(_0x3a2dfa,_0x2964c4){if(_0x3a2dfa[_0x4f98('0x64')]['id']){delete _0x3a2dfa['body']['id'];}delete _0x3a2dfa[_0x4f98('0x64')][_0x4f98('0x36')];return db['User'][_0x4f98('0x62')]({'where':{'id':_0x3a2dfa[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x2964c4,null))[_0x4f98('0x34')](saveUpdates(_0x3a2dfa['body'],null))[_0x4f98('0x34')](respondWithResult(_0x2964c4,null))[_0x4f98('0x63')](handleError(_0x2964c4,null));};exports[_0x4f98('0x66')]=function(_0x1b8988,_0x44af94){return db[_0x4f98('0x5c')][_0x4f98('0x66')]()[_0x4f98('0x34')](respondWithResult(_0x44af94,null))[_0x4f98('0x63')](handleError(_0x44af94,null));};exports['addContacts']=function(_0x3450b6,_0x151524,_0x2e3c6f){return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x3450b6[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x151524,null))[_0x4f98('0x34')](function(_0x3bae37){if(_0x3bae37){return _0x3bae37[_0x4f98('0x67')](_0x3450b6[_0x4f98('0x64')][_0x4f98('0x68')],_[_0x4f98('0x69')](_0x3450b6[_0x4f98('0x64')],[_0x4f98('0x68'),'id'])||{});}})[_0x4f98('0x34')](respondWithResult(_0x151524,null))[_0x4f98('0x63')](handleError(_0x151524,null));};function validateUser(_0x4d3309){return new BPromise(function(_0xfc1e20,_0x324932){if(_0x4d3309['internal'])return _0xfc1e20(_0x4d3309);return db['Setting'][_0x4f98('0x6a')](0x1)['then'](function(_0x4ba692){if(_0x4ba692[_0x4f98('0x6b')])authService[_0x4f98('0x6c')](_0x4d3309[_0x4f98('0x61')]);db[_0x4f98('0x5c')]['max'](_0x4f98('0x6d'))[_0x4f98('0x34')](function(_0x5a165b){if(_['isNil'](_0x5a165b)){_0x4d3309[_0x4f98('0x6d')]=_0x4ba692[_0x4f98('0x6e')]||0x1;return;}if(_[_0x4f98('0x6f')](_0x4ba692[_0x4f98('0x6e')])||_0x4ba692[_0x4f98('0x6e')]===_0x5a165b){_0x4d3309[_0x4f98('0x6d')]=_0x5a165b+0x1;return;}if(_0x4ba692['min_internal']>_0x5a165b){_0x4d3309[_0x4f98('0x6d')]=_0x4ba692[_0x4f98('0x6e')];return;}return db[_0x4f98('0x58')]['query'](_0x4f98('0x70'),{'type':db[_0x4f98('0x58')][_0x4f98('0x71')][_0x4f98('0x72')]})['then'](function(_0x38d96a){if(_0x38d96a&&_0x38d96a[_0x4f98('0x51')]){for(var _0x4d8bf6=0x0,_0x5e9bcd=_0x38d96a['length'];_0x4d8bf6<_0x5e9bcd&&_[_0x4f98('0x6f')](_0x4d3309['internal']);_0x4d8bf6++){if(_0x4ba692['min_internal']<=_0x38d96a[_0x4d8bf6][_0x4f98('0x73')]){_0x4d3309[_0x4f98('0x6d')]=_0x38d96a[_0x4d8bf6][_0x4f98('0x73')];}else if(_0x4ba692[_0x4f98('0x6e')]>_0x38d96a[_0x4d8bf6][_0x4f98('0x73')]&&_0x4ba692['min_internal']<=_0x38d96a[_0x4d8bf6]['to']){_0x4d3309[_0x4f98('0x6d')]=_0x4ba692['min_internal'];}}}if(_[_0x4f98('0x6f')](_0x4d3309['internal'])){_0x4d3309['internal']=_0x5a165b+0x1;}return _0xfc1e20(_0x4d3309);});});})[_0x4f98('0x63')](function(_0x44c13f){_0x324932(_0x44c13f);});});}function updateUser(_0x2ed50b){return new BPromise(function(_0x44b5a6,_0x583239){try{if(_0x2ed50b[_0x4f98('0x74')]){_0x2ed50b[_0x4f98('0x75')]=_0x2ed50b[_0x4f98('0x6d')];_0x2ed50b[_0x4f98('0x76')]={'mailbox':_0x2ed50b[_0x4f98('0x6d')],'password':_0x2ed50b[_0x4f98('0x61')],'fullname':_0x2ed50b['fullname'],'email':_0x2ed50b[_0x4f98('0x77')]};}if(_0x2ed50b['role']===_0x4f98('0x39')){if(!_0x2ed50b[_0x4f98('0x78')])_0x2ed50b[_0x4f98('0x78')]=[_0x4f98('0x79'),_0x4f98('0x7a'),'103',_0x4f98('0x7b'),'110',_0x4f98('0x7c'),_0x4f98('0x7d'),_0x4f98('0x7e'),_0x4f98('0x7f'),_0x4f98('0x80'),_0x4f98('0x81'),'100',_0x4f98('0x82'),_0x4f98('0x83')];}_0x44b5a6(_0x2ed50b);}catch(_0x305feb){_0x583239(_0x305feb);}});}exports['create']=function(_0x5f4881,_0xc19bd6){if(_0x5f4881['user'][_0x4f98('0x36')]===_0x4f98('0x39'))throw new Error(_0x4f98('0x84'));if(_0x5f4881[_0x4f98('0x64')][_0x4f98('0x36')]===_0x4f98('0x38')&&_0x5f4881[_0x4f98('0x38')][_0x4f98('0x36')]!==_0x4f98('0x37')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5f4881['body']['role']===_0x4f98('0x37')&&_0x5f4881[_0x4f98('0x38')]['role']!==_0x4f98('0x37')){throw new Error(_0x4f98('0x85'));}return licenseUtil[_0x4f98('0x86')]([_0x5f4881[_0x4f98('0x64')]])[_0x4f98('0x34')](function(){return validateUser(_0x5f4881['body']);})[_0x4f98('0x34')](function(_0x5e2f5f){return updateUser(_0x5e2f5f)['then'](function(_0x3a79c){if(_0x3a79c['role']==='admin'){_0x3a79c[_0x4f98('0x87')]=_0x5f4881['user']['settingsEnabled'];delete _0x3a79c[_0x4f98('0x88')];}return _0x3a79c;});})[_0x4f98('0x34')](function(_0x3389f2){return db['User'][_0x4f98('0x89')](_0x3389f2,{'include':[{'model':db['VoiceMail'],'as':_0x4f98('0x76')}]});})[_0x4f98('0x34')](function(_0xe4bb65){if(_0x5f4881[_0x4f98('0x64')][_0x4f98('0x36')]===_0x4f98('0x38'))return _0xe4bb65;if(_0x5f4881[_0x4f98('0x38')]['role']!==_0x4f98('0x38'))return _0xe4bb65;return db[_0x4f98('0x8a')][_0x4f98('0x62')]({'where':{'name':_0xe4bb65[_0x4f98('0x36')]===_0x4f98('0x39')?_0x4f98('0x8b'):_0x4f98('0x3a'),'userProfileId':_0x5f4881[_0x4f98('0x38')]['userProfileId']},'raw':!![]})[_0x4f98('0x34')](function(_0x300419){if(!_0x300419||_0x300419[_0x4f98('0x8c')]!=0x0)return _0xe4bb65;return db[_0x4f98('0x8d')][_0x4f98('0x89')]({'name':_0xe4bb65[_0x4f98('0x3f')],'resourceId':_0xe4bb65['id'],'type':_0x300419[_0x4f98('0x3f')],'sectionId':_0x300419['id']},{})['then'](function(){return _0xe4bb65;});})['catch'](function(_0x500fac){logger[_0x4f98('0x23')](_0x4f98('0x8e'),_0x500fac);throw _0x500fac;});})['then'](respondWithResult(_0xc19bd6,0xc9))[_0x4f98('0x63')](handleError(_0xc19bd6,null));};exports[_0x4f98('0x8f')]=function(_0x50517c,_0x266b9d){var _0x180f52=_0x50517c[_0x4f98('0x64')];var _0xd79545=[];if(_0x50517c['user'][_0x4f98('0x36')]==='agent')throw new Error(_0x4f98('0x84'));if(_['some'](_0x180f52,[_0x4f98('0x36'),_0x4f98('0x38')])&&_0x50517c[_0x4f98('0x38')][_0x4f98('0x36')]!==_0x4f98('0x37')){throw new Error(_0x4f98('0x90'));}if(_['some'](_0x180f52,[_0x4f98('0x36'),_0x4f98('0x37')])&&_0x50517c[_0x4f98('0x38')]['role']!==_0x4f98('0x37')){throw new Error(_0x4f98('0x91'));}return licenseUtil[_0x4f98('0x86')](_0x180f52)[_0x4f98('0x34')](function(){return validateUser(_0x180f52[0x0]);})[_0x4f98('0x34')](function(){for(var _0x19bb9f=0x1;_0x19bb9f<_0x180f52['length'];_0x19bb9f++){var _0xa21148=_0x180f52[_0x19bb9f-0x1][_0x4f98('0x6d')];if(!_0x180f52[_0x19bb9f][_0x4f98('0x6d')])_0x180f52[_0x19bb9f][_0x4f98('0x6d')]=_0xa21148+0x1;_0xd79545[_0x4f98('0x92')](validateUser(_0x180f52[_0x19bb9f]));}return BPromise[_0x4f98('0x93')](_0xd79545);})[_0x4f98('0x34')](function(){_0xd79545=[];for(var _0xf5001a=0x0;_0xf5001a<_0x180f52['length'];_0xf5001a++){_0xd79545[_0x4f98('0x92')](updateUser(_0x180f52[_0xf5001a]));}return BPromise[_0x4f98('0x93')](_0xd79545);})[_0x4f98('0x34')](function(){return BPromise['each'](_0x180f52,function(_0xbba2d9){return db[_0x4f98('0x5c')]['create'](_0xbba2d9,{'include':[{'model':db[_0x4f98('0x76')],'as':_0x4f98('0x76')}]})[_0x4f98('0x34')](function(_0x4f08b2){_0xbba2d9['id']=_0x4f08b2['id'];return _0xbba2d9;});});})[_0x4f98('0x34')](function(_0x468f25){if(_0x50517c[_0x4f98('0x64')][_0x4f98('0x36')]==='user')return _0x468f25;if(_0x50517c[_0x4f98('0x38')][_0x4f98('0x36')]!==_0x4f98('0x38'))return _0x468f25;var _0x1b46a6=_[_0x4f98('0x94')](_0x468f25,function(_0x32b157){return _0x32b157[_0x4f98('0x36')]===_0x4f98('0x39')||_0x32b157['role']===_0x4f98('0x95');});if(!_0x1b46a6)return _0x468f25;return db[_0x4f98('0x8a')][_0x4f98('0x5f')]({'where':{'name':{'$or':[_0x4f98('0x8b'),'Telephones']},'userProfileId':_0x50517c['user'][_0x4f98('0x88')]},'raw':!![]})[_0x4f98('0x34')](function(_0x37c669){if(_[_0x4f98('0x96')](_0x37c669)||!_[_0x4f98('0x94')](_0x37c669,[_0x4f98('0x8c'),0x0]))return _0x468f25;_0xd79545=[];var _0x7d5a5f=_(_0x37c669)[_0x4f98('0x44')](function(_0x4c2257){if(_0x4c2257['autoAssociation']===0x1)return;return _0x4c2257[_0x4f98('0x3f')]===_0x4f98('0x8b')?_0x4f98('0x39'):_0x4f98('0x95');})[_0x4f98('0x97')]()[_0x4f98('0x3d')]();for(var _0x235309=0x0;_0x235309<_0x468f25[_0x4f98('0x51')];_0x235309++){if(!_[_0x4f98('0x3e')](_0x7d5a5f,_0x468f25[_0x235309][_0x4f98('0x36')]))return;var _0xd79bb7=_0x468f25[_0x235309]['role']===_0x4f98('0x39')?_0x4f98('0x8b'):_0x4f98('0x3a');_0xd79545[_0x4f98('0x92')](db['UserProfileResource'][_0x4f98('0x89')]({'name':_0x468f25[_0x235309][_0x4f98('0x3f')],'resourceId':_0x468f25[_0x235309]['id'],'type':_0xd79bb7,'sectionId':_[_0x4f98('0x62')](_0x37c669,[_0x4f98('0x3f'),_0xd79bb7])['id']},{}));}return BPromise[_0x4f98('0x93')](_0xd79545);})['then'](respondWithResult(_0x266b9d,0xc9))[_0x4f98('0x63')](handleError(_0x266b9d,null));});};exports[_0x4f98('0x98')]=function(_0x48407d,_0x383a82,_0x40884a){if(_0x48407d[_0x4f98('0x64')]['id']){delete _0x48407d[_0x4f98('0x64')]['id'];}return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x48407d[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](function(_0x52c5c6){if(!_0x52c5c6)return null;if(_0x52c5c6['id']===_0x48407d['user']['id']){if(!_0x48407d[_0x4f98('0x64')]['oldPassword']||!_0x48407d[_0x4f98('0x64')]['newPassword']){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x52c5c6[_0x4f98('0x9b')](_0x48407d[_0x4f98('0x64')][_0x4f98('0x9c')])){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x9d'));}if(_0x48407d[_0x4f98('0x64')]['oldPassword']===_0x48407d[_0x4f98('0x64')]['newPassword']){throw new db[(_0x4f98('0x99'))]['ValidationError'](_0x4f98('0x9e'));}}else if(_0x48407d[_0x4f98('0x38')][_0x4f98('0x36')]===_0x4f98('0x37')){if(!_0x48407d[_0x4f98('0x64')]['newPassword']){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x9f'));}}else if(_0x48407d['user'][_0x4f98('0x36')]===_0x4f98('0x38')){if(!_0x48407d[_0x4f98('0x64')][_0x4f98('0xa0')]){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x9f'));}if(_0x52c5c6[_0x4f98('0x36')]!==_0x4f98('0x39')){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0x84'));}}else{throw new db['Sequelize'][(_0x4f98('0x9a'))](_0x4f98('0x84'));}return _0x52c5c6;})['then'](handleEntityNotFound(_0x383a82,null))[_0x4f98('0x34')](function(_0x1c0517){return db[_0x4f98('0xa1')]['findOne']({'attributes':['id',_0x4f98('0x6b'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x4f98('0x34')](function(_0x55e5d0){if(_0x55e5d0['securePassword'])authService[_0x4f98('0x6c')](_0x48407d[_0x4f98('0x64')][_0x4f98('0xa0')]);if(!_0x55e5d0[_0x4f98('0xa2')]||!_0x1c0517['previousPasswords'])return _0x1c0517;authService[_0x4f98('0xa3')](_0x48407d['body']['newPassword'],_0x1c0517[_0x4f98('0xa4')],_0x55e5d0[_0x4f98('0xa5')]);return _0x1c0517;})['then'](saveUpdates({'password':_0x48407d['body'][_0x4f98('0xa0')],'passwordResetAt':_0x48407d['user']['id']==_0x48407d[_0x4f98('0x65')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x48407d[_0x4f98('0x64')][_0x4f98('0xa0')],_0x1c0517[_0x4f98('0xa4')])},null));})['then'](respondWithResult(_0x383a82,null))[_0x4f98('0x63')](handleError(_0x383a82,null));};exports[_0x4f98('0xa6')]=function(_0xe81623,_0x8a6f04,_0x36bff5){var _0x409734=_0xe81623[_0x4f98('0x64')][_0x4f98('0xa7')];return db['User']['find']({'where':{'id':_0xe81623[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),'role',_0x4f98('0xa8'),_0x4f98('0xa9'),'voicePause',_0x4f98('0xaa')]})[_0x4f98('0x34')](handleEntityNotFound(_0x8a6f04,null))['then'](function(_0x33c7f8){if(_0x33c7f8){if(!utils[_0x4f98('0xab')](_0x409734)){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0xac'));}return _0x33c7f8[_0x4f98('0xad')+_[_0x4f98('0xae')](_0x409734[_0x4f98('0xaf')]())+_0x4f98('0xb0')](_0xe81623['body'][_0x4f98('0x68')],{'penalty':_0xe81623['body']['penalty']||0x0})[_0x4f98('0xb1')](function(_0x757933){for(var _0x55ee7e=0x0;_0x55ee7e<_0xe81623[_0x4f98('0x64')]['ids']['length'];_0x55ee7e+=0x1){var _0x24b9d7={'UserId':_0xe81623[_0x4f98('0x65')]['id']};_0x24b9d7[_['capitalize'](_0x409734[_0x4f98('0xaf')]())+'QueueId']=_0xe81623[_0x4f98('0x64')][_0x4f98('0x68')][_0x55ee7e];socket['emit'](_0x4f98('0x38')+_['capitalize'](_0x409734['toLowerCase']())+_0x4f98('0xb2'),_0x24b9d7);}return _0x757933;})['then'](function(){if(_0x409734==='voice'){return db['VoiceQueue'][_0x4f98('0x5f')]({'where':{'id':_0xe81623[_0x4f98('0x64')][_0x4f98('0x68')]||[]},'raw':!![],'attributes':['id',_0x4f98('0x3f')]});}})[_0x4f98('0x34')](function(_0x3df862){var _0x30b3bf=_0x33c7f8[_0x4f98('0x35')]({'plain':!![]});var _0x5d61b2=[];if(_0x409734==='voice'&&_0x30b3bf['role']===_0x4f98('0x39')&&_0x30b3bf[_0x4f98('0xa8')]){for(var _0xe01a1=0x0;_0xe01a1<_0x3df862['length'];_0xe01a1+=0x1){_0x5d61b2['push']({'membername':_0x30b3bf[_0x4f98('0x3f')],'UserId':_0x30b3bf['id'],'queue_name':_0x3df862[_0xe01a1][_0x4f98('0x3f')],'VoiceQueueId':_0x3df862[_0xe01a1]['id'],'interface':_[_0x4f98('0x6f')](_0x30b3bf[_0x4f98('0xaa')])?util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x30b3bf[_0x4f98('0x3f')]):_0x30b3bf['interface'],'paused':_0x30b3bf['voicePause']||![],'penalty':_0xe81623[_0x4f98('0x64')][_0x4f98('0xb5')]||0x0});}return BPromise[_0x4f98('0xb6')](_0x5d61b2,function(_0xa6c03d){return db[_0x4f98('0xb7')][_0x4f98('0xb8')](_0xa6c03d);});}return _0x33c7f8;});}})[_0x4f98('0x34')](respondWithStatusCode(_0x8a6f04,null))[_0x4f98('0x63')](handleError(_0x8a6f04,null));};exports[_0x4f98('0xb9')]=function(_0x34b676,_0x14a100,_0x321845){var _0x42170d;return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x34b676[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36')]})[_0x4f98('0x34')](handleEntityNotFound(_0x14a100,null))[_0x4f98('0x34')](function(_0x438ecf){if(_0x438ecf){_0x42170d=_0x438ecf;if(!_0x34b676['query']['channel']||!utils[_0x4f98('0xab')](_0x34b676[_0x4f98('0x4a')][_0x4f98('0xa7')])){throw new db[(_0x4f98('0x99'))]['ValidationError']('Unknown\x20channel');}return _0x438ecf[_0x4f98('0xba')+_['capitalize'](_0x34b676['query'][_0x4f98('0xa7')][_0x4f98('0xaf')]())+_0x4f98('0xb0')](_0x34b676[_0x4f98('0x4a')][_0x4f98('0x68')]);}})['then'](function(_0x4a8324){for(var _0x1c0fbb=0x0;_0x1c0fbb<_0x34b676[_0x4f98('0x4a')][_0x4f98('0x68')]['length'];_0x1c0fbb+=0x1){var _0x2619cd={'UserId':_0x34b676['params']['id']};_0x2619cd[_[_0x4f98('0xae')](_0x34b676['query'][_0x4f98('0xa7')]['toLowerCase']())+_0x4f98('0xbb')]=_0x34b676[_0x4f98('0x4a')]['ids'][_0x1c0fbb];socket[_0x4f98('0xbc')](_0x4f98('0x38')+_['capitalize'](_0x34b676['query']['channel'][_0x4f98('0xaf')]())+_0x4f98('0xbd'),_0x2619cd);}return _0x4a8324;})['then'](function(){if(_0x34b676[_0x4f98('0x4a')]['channel']===_0x4f98('0xbe')){return db['UserVoiceQueueRt'][_0x4f98('0x40')]({'where':{'UserId':_0x34b676[_0x4f98('0x65')]['id'],'VoiceQueueId':_0x34b676['query'][_0x4f98('0x68')]},'individualHooks':!![]})[_0x4f98('0x34')](function(){return _0x42170d;});}return _0x42170d;})[_0x4f98('0x34')](respondWithStatusCode(_0x14a100,null))[_0x4f98('0x63')](handleError(_0x14a100,null));};exports[_0x4f98('0xbf')]=function(_0x4bbacc,_0xf962ce,_0xf68429){_0x4bbacc[_0x4f98('0x64')][_0x4f98('0xc0')]=_0x4bbacc['file']['filename'];return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x4bbacc['params']['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0xf962ce,null))[_0x4f98('0x34')](saveUpdates(_0x4bbacc[_0x4f98('0x64')],null))['then'](respondWithResult(_0xf962ce,null))['catch'](handleError(_0xf962ce,null));};exports[_0x4f98('0xc1')]=function(_0x4260ad,_0x3235f1,_0x5e5e9f){var _0x16274e=path[_0x4f98('0xc2')](config[_0x4f98('0xc3')],_0x4f98('0xc4'));return db[_0x4f98('0x5c')]['find']({'where':{'id':_0x4260ad[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0xc0')],'raw':!![]})[_0x4f98('0x34')](handleEntityNotFound(_0x3235f1,null))[_0x4f98('0x34')](function(_0x50ec1d){if(_0x50ec1d){if(_['isNil'](_0x50ec1d[_0x4f98('0xc0')])){return _0x3235f1[_0x4f98('0xc5')](_0x16274e);}else{if(!fs[_0x4f98('0xc6')](path[_0x4f98('0xc2')](config['root'],_0x4f98('0xc7'),_0x50ec1d[_0x4f98('0xc0')]))){return _0x3235f1['download'](_0x16274e);}return _0x3235f1[_0x4f98('0xc5')](path[_0x4f98('0xc2')](config[_0x4f98('0xc3')],'server/files/images/',_0x50ec1d['userpic']));}}})[_0x4f98('0x63')](handleError(_0x3235f1,null));};exports[_0x4f98('0xc8')]=function(_0x35540b,_0x32c863,_0x550ab8){var _0x4a4a70={};var _0x17560c={};var _0x5b2ea2;var _0x5871fc;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x35540b[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x32c863,null))[_0x4f98('0x34')](function(_0x35693c){if(_0x35693c){_0x5b2ea2=_0x35693c;_0x17560c['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xca')][_0x4f98('0x45')]);_0x17560c[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x35540b['query']);_0x17560c[_0x4f98('0x4c')]=_['intersection'](_0x17560c[_0x4f98('0x4d')],_0x17560c['query']);_0x4a4a70[_0x4f98('0x4e')]=_['intersection'](_0x17560c[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x35540b[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x4a4a70[_0x4f98('0x4e')]=_0x4a4a70[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x4a4a70['attributes']:_0x17560c[_0x4f98('0x4d')];_0x4a4a70[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x35540b[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x4a4a70[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x35540b[_0x4f98('0x4a')],_0x17560c[_0x4f98('0x4c')]));if(_0x35540b[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x4a4a70[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4a4a70[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x4a4a70['attributes'],function(_0x486bb9){var _0xe45fef={};_0xe45fef[_0x486bb9]={'$like':'%'+_0x35540b[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0xe45fef;})});}_0x4a4a70=_[_0x4f98('0x57')]({},_0x4a4a70,_0x35540b[_0x4f98('0x5b')]);return _0x5b2ea2[_0x4f98('0xc8')](_0x4a4a70);}})[_0x4f98('0x34')](function(_0xbd3a3e){if(_0xbd3a3e){_0x5871fc=_0xbd3a3e[_0x4f98('0x51')];if(_0x35540b[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x5d'))){_0x4a4a70[_0x4f98('0x5e')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x4f98('0xcb')],'as':_0x4f98('0xcc'),'attributes':['id','name',_0x4f98('0xcd')],'where':_0x35540b[_0x4f98('0x4a')]['tag']?{'id':_0x35540b[_0x4f98('0x4a')][_0x4f98('0xce')]}:undefined,'required':_0x35540b[_0x4f98('0x4a')][_0x4f98('0xce')]?!![]:![]}];}if(!_0x35540b['query']['hasOwnProperty'](_0x4f98('0x52'))){_0x4a4a70[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x35540b[_0x4f98('0x4a')]['limit']);_0x4a4a70[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x35540b['query']['offset']);}return _0x5b2ea2[_0x4f98('0xc8')](_0x4a4a70);}})['then'](function(_0x2437eb){if(_0x2437eb){return _0x2437eb?{'count':_0x5871fc,'rows':_0x2437eb}:null;}})['then'](respondWithResult(_0x32c863,null))['catch'](handleError(_0x32c863,null));};exports[_0x4f98('0xcf')]=function(_0x4fc617,_0x159f7d,_0xa6a7a1){var _0x103867;var _0x21ba23;var _0x4b324f={};var _0x2a8be6;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x4fc617[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36')]})[_0x4f98('0x34')](handleEntityNotFound(_0x159f7d,null))[_0x4f98('0x34')](function(_0x32e147){if(!utils[_0x4f98('0xab')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0xa7')])){throw new db[(_0x4f98('0x99'))]['ValidationError'](_0x4f98('0xac'));}_0x103867=_0x32e147;var _0x552bb4={};_0x552bb4['model']=_['keys'](db[_[_0x4f98('0xae')](_0x4fc617[_0x4f98('0x4a')]['channel'])+'Queue'][_0x4f98('0x45')]);_0x552bb4[_0x4f98('0x4a')]=_['keys'](_0x4fc617[_0x4f98('0x4a')]);_0x552bb4[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x552bb4[_0x4f98('0x4d')],_0x552bb4[_0x4f98('0x4a')]);_0x4b324f[_0x4f98('0x4e')]=_['intersection'](_0x552bb4[_0x4f98('0x4d')],qs['fields'](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x4b324f[_0x4f98('0x4e')]=_0x4b324f[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x4b324f['attributes']:_0x552bb4[_0x4f98('0x4d')];_0x4b324f[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x4fc617[_0x4f98('0x4a')]['sort']);_0x4b324f['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x4fc617['query'],_0x552bb4['filters']));if(_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x4b324f[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4b324f[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x4b324f[_0x4f98('0x4e')],function(_0x283432){var _0x1134f5={};_0x1134f5[_0x283432]={'$like':'%'+_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1134f5;})});}_0x4b324f=_[_0x4f98('0x57')]({},_0x4b324f,_0x4fc617[_0x4f98('0x5b')]);switch(_0x103867['role']){case _0x4f98('0x37'):return db[_[_0x4f98('0xae')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0xa7')])+'Queue'][_0x4f98('0x5f')](_0x4b324f);case'user':case _0x4f98('0x39'):return _0x103867[_0x4f98('0x35')+_[_0x4f98('0xae')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0xa7')])+_0x4f98('0xb0')](_0x4b324f);default:throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0xd0'));}})[_0x4f98('0x34')](function(_0x543d69){_0x2a8be6=_0x543d69[_0x4f98('0x51')];if(!_0x4fc617[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x52'))){_0x4b324f[_0x4f98('0x2d')]=qs['limit'](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x4b324f['offset']=qs[_0x4f98('0x2c')](_0x4fc617[_0x4f98('0x4a')][_0x4f98('0x2c')]);}switch(_0x103867[_0x4f98('0x36')]){case'admin':return db[_[_0x4f98('0xae')](_0x4fc617['query'][_0x4f98('0xa7')])+_0x4f98('0xd1')][_0x4f98('0x5f')](_0x4b324f);case _0x4f98('0x38'):case _0x4f98('0x39'):return _0x103867[_0x4f98('0x35')+_['capitalize'](_0x4fc617['query'][_0x4f98('0xa7')])+_0x4f98('0xb0')](_0x4b324f);}})[_0x4f98('0x34')](function(_0x1236aa){return{'count':_0x2a8be6,'rows':_0x1236aa};})[_0x4f98('0x34')](respondWithResult(_0x159f7d,null))[_0x4f98('0x63')](handleError(_0x159f7d,null));};exports['getVoiceQueuesRt']=function(_0x508934,_0xe06674,_0x1f34d2){var _0x526ff0={};var _0xfe05d8={};var _0x5d92dc;var _0x4d36d3;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x508934[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0xe06674,null))[_0x4f98('0x34')](function(_0x39fc44){if(_0x39fc44){_0x5d92dc=_0x39fc44;_0xfe05d8[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0xb7')]['rawAttributes']);_0xfe05d8['query']=_['keys'](_0x508934['query']);_0xfe05d8[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0xfe05d8[_0x4f98('0x4d')],_0xfe05d8['query']);_0x526ff0[_0x4f98('0x4e')]=_['intersection'](_0xfe05d8['model'],qs[_0x4f98('0x50')](_0x508934[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x526ff0[_0x4f98('0x4e')]=_0x526ff0[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x526ff0[_0x4f98('0x4e')]:_0xfe05d8['model'];_0x526ff0[_0x4f98('0x53')]=qs['sort'](_0x508934[_0x4f98('0x4a')]['sort']);_0x526ff0[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x508934[_0x4f98('0x4a')],_0xfe05d8[_0x4f98('0x4c')]));if(_0x508934[_0x4f98('0x4a')]['filter']){_0x526ff0[_0x4f98('0x55')]=_['merge'](_0x526ff0[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x526ff0[_0x4f98('0x4e')],function(_0x215598){var _0x17c5fe={};_0x17c5fe[_0x215598]={'$like':'%'+_0x508934[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x17c5fe;})});}_0x526ff0=_['merge']({},_0x526ff0,_0x508934[_0x4f98('0x5b')]);return _0x5d92dc[_0x4f98('0xd2')](_0x526ff0);}})[_0x4f98('0x34')](function(_0x32dc8f){if(_0x32dc8f){_0x4d36d3=_0x32dc8f[_0x4f98('0x51')];if(!_0x508934[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x526ff0[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x508934[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x526ff0[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x508934[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x5d92dc[_0x4f98('0xd2')](_0x526ff0);}})[_0x4f98('0x34')](function(_0x3b66be){if(_0x3b66be){return _0x3b66be?{'count':_0x4d36d3,'rows':_0x3b66be}:null;}})['then'](respondWithResult(_0xe06674,null))[_0x4f98('0x63')](handleError(_0xe06674,null));};exports[_0x4f98('0xd4')]=function(_0x22bf56,_0x52af47,_0x23a861){var _0x5604dc={};var _0xf7c179={};var _0x1ff904;var _0xad2a0f;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x22bf56[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x52af47,null))['then'](function(_0x3f3eae){if(_0x3f3eae){_0x1ff904=_0x3f3eae;_0xf7c179[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0xd5')][_0x4f98('0x45')]);_0xf7c179[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x22bf56[_0x4f98('0x4a')]);_0xf7c179['filters']=_[_0x4f98('0x4f')](_0xf7c179['model'],_0xf7c179[_0x4f98('0x4a')]);_0x5604dc['attributes']=_[_0x4f98('0x4f')](_0xf7c179[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x22bf56[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x5604dc[_0x4f98('0x4e')]=_0x5604dc[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x5604dc['attributes']:_0xf7c179[_0x4f98('0x4d')];_0x5604dc[_0x4f98('0x53')]=qs['sort'](_0x22bf56[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x5604dc[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x22bf56[_0x4f98('0x4a')],_0xf7c179[_0x4f98('0x4c')]));if(_0x22bf56[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x5604dc['where']=_[_0x4f98('0x57')](_0x5604dc[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x5604dc[_0x4f98('0x4e')],function(_0x5757c7){var _0x2e61a7={};_0x2e61a7[_0x5757c7]={'$like':'%'+_0x22bf56['query'][_0x4f98('0x3b')]+'%'};return _0x2e61a7;})});}_0x5604dc=_[_0x4f98('0x57')]({},_0x5604dc,_0x22bf56[_0x4f98('0x5b')]);return _0x1ff904['getGroups'](_0x5604dc);}})['then'](function(_0x463602){if(_0x463602){_0xad2a0f=_0x463602[_0x4f98('0x51')];if(!_0x22bf56[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x5604dc[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x22bf56[_0x4f98('0x4a')]['limit']);_0x5604dc[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x22bf56[_0x4f98('0x4a')]['offset']);}return _0x1ff904[_0x4f98('0xd4')](_0x5604dc);}})[_0x4f98('0x34')](function(_0x849716){if(_0x849716){return _0x849716?{'count':_0xad2a0f,'rows':_0x849716}:null;}})['then'](respondWithResult(_0x52af47,null))[_0x4f98('0x63')](handleError(_0x52af47,null));};exports[_0x4f98('0xd6')]=function(_0x18bfd1,_0x543aa0,_0x57232c){var _0x364adc={'raw':!![],'where':{}};var _0x18453b={};var _0x277b20={'count':0x0,'rows':[]};return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x18bfd1[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x543aa0,null))[_0x4f98('0x34')](function(_0x4c4bce){if(_0x4c4bce){_0x18453b['model']=_['keys'](db[_0x4f98('0xd7')]['rawAttributes']);_0x18453b[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x18bfd1[_0x4f98('0x4a')]);_0x18453b[_0x4f98('0x4c')]=_['intersection'](_0x18453b[_0x4f98('0x4d')],_0x18453b[_0x4f98('0x4a')]);_0x364adc[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x18453b['model'],qs['fields'](_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x364adc[_0x4f98('0x4e')]=_0x364adc[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x364adc[_0x4f98('0x4e')]:_0x18453b[_0x4f98('0x4d')];if(!_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x364adc[_0x4f98('0x2d')]=qs['limit'](_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x364adc[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x2c')]);}_0x364adc[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x18bfd1[_0x4f98('0x4a')]['sort']);_0x364adc[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_['pick'](_0x18bfd1[_0x4f98('0x4a')],_0x18453b[_0x4f98('0x4c')]));_0x364adc[_0x4f98('0x55')][_0x4f98('0xd8')]=_0x4c4bce['id'];if(_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x364adc[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x364adc[_0x4f98('0x55')],{'$or':_['map'](_0x364adc[_0x4f98('0x4e')],function(_0x199ec8){var _0x2959fb={};_0x2959fb[_0x199ec8]={'$like':'%'+_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x2959fb;})});}_0x364adc=_[_0x4f98('0x57')]({},_0x364adc,_0x18bfd1[_0x4f98('0x5b')]);return db['VoiceRecording'][_0x4f98('0x2b')]({'where':_0x364adc[_0x4f98('0x55')]})[_0x4f98('0x34')](function(_0x1f9621){_0x277b20['count']=_0x1f9621;if(_0x18bfd1[_0x4f98('0x4a')][_0x4f98('0x5d')]){_0x364adc[_0x4f98('0x5e')]=[{'all':!![]}];}return db[_0x4f98('0xd7')][_0x4f98('0x5f')](_0x364adc);})[_0x4f98('0x34')](function(_0x561d73){_0x277b20[_0x4f98('0xd9')]=_0x561d73;return _0x277b20;});}})['then'](respondWithFilteredResult(_0x543aa0,_0x364adc))['catch'](handleError(_0x543aa0,null));};exports[_0x4f98('0xda')]=function(_0x22ebbe,_0x4670d5,_0x49c628){var _0xff2cab={'raw':!![],'where':{}};var _0x20c40c={};var _0x447f11={'count':0x0,'rows':[]};return db['User'][_0x4f98('0xc9')]({'where':{'id':_0x22ebbe[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x4670d5,null))[_0x4f98('0x34')](function(_0x173368){if(_0x173368){_0x20c40c[_0x4f98('0x4d')]=_['keys'](db['ScreenRecording'][_0x4f98('0x45')]);_0x20c40c['query']=_['keys'](_0x22ebbe[_0x4f98('0x4a')]);_0x20c40c[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x20c40c[_0x4f98('0x4d')],_0x20c40c[_0x4f98('0x4a')]);_0xff2cab[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x20c40c['model'],qs[_0x4f98('0x50')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x50')]));_0xff2cab[_0x4f98('0x4e')]=_0xff2cab['attributes']['length']?_0xff2cab['attributes']:_0x20c40c[_0x4f98('0x4d')];if(!_0x22ebbe['query']['hasOwnProperty'](_0x4f98('0x52'))){_0xff2cab[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0xff2cab[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x2c')]);}_0xff2cab[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x54')]);_0xff2cab[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x22ebbe['query'],_0x20c40c[_0x4f98('0x4c')]));_0xff2cab['where']['UserId']=_0x173368['id'];if(_0x22ebbe[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0xff2cab['where']=_['merge'](_0xff2cab[_0x4f98('0x55')],{'$or':_['map'](_0xff2cab[_0x4f98('0x4e')],function(_0x5b9059){var _0x9b84e2={};_0x9b84e2[_0x5b9059]={'$like':'%'+_0x22ebbe['query'][_0x4f98('0x3b')]+'%'};return _0x9b84e2;})});}_0xff2cab=_[_0x4f98('0x57')]({},_0xff2cab,_0x22ebbe[_0x4f98('0x5b')]);return db['ScreenRecording']['count']({'where':_0xff2cab[_0x4f98('0x55')]})[_0x4f98('0x34')](function(_0x34a433){_0x447f11[_0x4f98('0x2b')]=_0x34a433;if(_0x22ebbe[_0x4f98('0x4a')]['includeAll']){_0xff2cab[_0x4f98('0x5e')]=[{'all':!![]}];}return db[_0x4f98('0xdb')][_0x4f98('0x5f')](_0xff2cab);})[_0x4f98('0x34')](function(_0x38e1cb){_0x447f11['rows']=_0x38e1cb;return _0x447f11;});}})[_0x4f98('0x34')](respondWithFilteredResult(_0x4670d5,_0xff2cab))['catch'](handleError(_0x4670d5,null));};exports[_0x4f98('0xdc')]=function(_0x3fc10f,_0x4a6176,_0xc200d6){var _0x32c68d={};var _0x20f3e5={};var _0x39640f;var _0x4f9e06;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x3fc10f[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x4a6176,null))[_0x4f98('0x34')](function(_0xcf63e8){if(_0xcf63e8){_0x39640f=_0xcf63e8;_0x20f3e5[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0xdd')]['rawAttributes']);_0x20f3e5['query']=_[_0x4f98('0x4b')](_0x3fc10f[_0x4f98('0x4a')]);_0x20f3e5['filters']=_[_0x4f98('0x4f')](_0x20f3e5['model'],_0x20f3e5['query']);_0x32c68d[_0x4f98('0x4e')]=_['intersection'](_0x20f3e5[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x3fc10f[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x32c68d['attributes']=_0x32c68d[_0x4f98('0x4e')]['length']?_0x32c68d[_0x4f98('0x4e')]:_0x20f3e5['model'];_0x32c68d[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x3fc10f[_0x4f98('0x4a')]['sort']);_0x32c68d[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x3fc10f[_0x4f98('0x4a')],_0x20f3e5['filters']));if(_0x3fc10f[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x32c68d['where']=_[_0x4f98('0x57')](_0x32c68d[_0x4f98('0x55')],{'$or':_['map'](_0x32c68d[_0x4f98('0x4e')],function(_0x1b425c){var _0x4a462f={};_0x4a462f[_0x1b425c]={'$like':'%'+_0x3fc10f[_0x4f98('0x4a')]['filter']+'%'};return _0x4a462f;})});}_0x32c68d=_[_0x4f98('0x57')]({},_0x32c68d,_0x3fc10f[_0x4f98('0x5b')]);return _0x39640f[_0x4f98('0xdc')](_0x32c68d);}})[_0x4f98('0x34')](function(_0xe175c6){if(_0xe175c6){_0x4f9e06=_0xe175c6[_0x4f98('0x51')];if(!_0x3fc10f[_0x4f98('0x4a')]['hasOwnProperty']('nolimit')){_0x32c68d['limit']=qs['limit'](_0x3fc10f[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x32c68d[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x3fc10f['query'][_0x4f98('0x2c')]);}return _0x39640f['getChatInteractions'](_0x32c68d);}})['then'](function(_0x2b0e06){if(_0x2b0e06){return _0x2b0e06?{'count':_0x4f9e06,'rows':_0x2b0e06}:null;}})[_0x4f98('0x34')](respondWithResult(_0x4a6176,null))[_0x4f98('0x63')](handleError(_0x4a6176,null));};exports[_0x4f98('0xde')]=function(_0x51baa2,_0x24751a,_0x5ad09c){var _0x2592f2={};var _0x4bc7e5={};var _0x365cd4;var _0x1fca50;return db['User'][_0x4f98('0xc9')]({'where':{'id':_0x51baa2[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x24751a,null))[_0x4f98('0x34')](function(_0x40063b){if(_0x40063b){_0x365cd4=_0x40063b;_0x4bc7e5['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xdf')][_0x4f98('0x45')]);_0x4bc7e5[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x51baa2[_0x4f98('0x4a')]);_0x4bc7e5[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x4bc7e5[_0x4f98('0x4d')],_0x4bc7e5['query']);_0x2592f2[_0x4f98('0x4e')]=_['intersection'](_0x4bc7e5[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x51baa2[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x2592f2[_0x4f98('0x4e')]=_0x2592f2['attributes'][_0x4f98('0x51')]?_0x2592f2[_0x4f98('0x4e')]:_0x4bc7e5[_0x4f98('0x4d')];_0x2592f2[_0x4f98('0x53')]=qs['sort'](_0x51baa2[_0x4f98('0x4a')]['sort']);_0x2592f2[_0x4f98('0x55')]=qs['filters'](_[_0x4f98('0x56')](_0x51baa2['query'],_0x4bc7e5['filters']));if(_0x51baa2[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x2592f2['where']=_[_0x4f98('0x57')](_0x2592f2[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x2592f2['attributes'],function(_0x387710){var _0x1a5393={};_0x1a5393[_0x387710]={'$like':'%'+_0x51baa2[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1a5393;})});}_0x2592f2=_[_0x4f98('0x57')]({},_0x2592f2,_0x51baa2[_0x4f98('0x5b')]);return _0x365cd4['getOpenchannelInteractions'](_0x2592f2);}})[_0x4f98('0x34')](function(_0x24b127){if(_0x24b127){_0x1fca50=_0x24b127[_0x4f98('0x51')];if(!_0x51baa2['query']['hasOwnProperty'](_0x4f98('0x52'))){_0x2592f2[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x51baa2['query']['limit']);_0x2592f2[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x51baa2['query']['offset']);}return _0x365cd4[_0x4f98('0xde')](_0x2592f2);}})[_0x4f98('0x34')](function(_0x47272b){if(_0x47272b){return _0x47272b?{'count':_0x1fca50,'rows':_0x47272b}:null;}})['then'](respondWithResult(_0x24751a,null))[_0x4f98('0x63')](handleError(_0x24751a,null));};exports[_0x4f98('0xe0')]=function(_0x2e834c,_0x357d58,_0x4ffb99){var _0xefe243={'raw':!![],'where':{}};var _0x16fffd={};var _0x34fc9c={'count':0x0,'rows':[]};return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x2e834c[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x357d58,null))[_0x4f98('0x34')](function(_0x60b415){if(_0x60b415){_0x16fffd['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xe1')][_0x4f98('0x45')]);_0x16fffd[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x2e834c[_0x4f98('0x4a')]);_0x16fffd[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x16fffd[_0x4f98('0x4d')],_0x16fffd['query']);_0xefe243['attributes']=_[_0x4f98('0x4f')](_0x16fffd[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x2e834c['query'][_0x4f98('0x50')]));_0xefe243[_0x4f98('0x4e')]=_0xefe243['attributes'][_0x4f98('0x51')]?_0xefe243[_0x4f98('0x4e')]:_0x16fffd[_0x4f98('0x4d')];if(!_0x2e834c[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0xefe243[_0x4f98('0x2d')]=qs['limit'](_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0xefe243[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x2e834c[_0x4f98('0x4a')]['offset']);}_0xefe243[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x2e834c[_0x4f98('0x4a')]['sort']);_0xefe243['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x2e834c[_0x4f98('0x4a')],_0x16fffd[_0x4f98('0x4c')]));_0xefe243['where'][_0x4f98('0xd8')]=_0x60b415['id'];if(_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0xefe243[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0xefe243[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0xefe243[_0x4f98('0x4e')],function(_0x5f1ae8){var _0x1f9393={};_0x1f9393[_0x5f1ae8]={'$like':'%'+_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1f9393;})});}_0xefe243=_[_0x4f98('0x57')]({},_0xefe243,_0x2e834c[_0x4f98('0x5b')]);return db[_0x4f98('0xe1')]['count']({'where':_0xefe243[_0x4f98('0x55')]})[_0x4f98('0x34')](function(_0x302d30){_0x34fc9c['count']=_0x302d30;if(_0x2e834c[_0x4f98('0x4a')][_0x4f98('0x5d')]){_0xefe243['include']=[{'all':!![]}];}return db['MailInteraction'][_0x4f98('0x5f')](_0xefe243);})[_0x4f98('0x34')](function(_0x54d013){_0x34fc9c[_0x4f98('0xd9')]=_0x54d013;return _0x34fc9c;});}})[_0x4f98('0x34')](respondWithFilteredResult(_0x357d58,_0xefe243))[_0x4f98('0x63')](handleError(_0x357d58,null));};exports[_0x4f98('0xe2')]=function(_0x4348db,_0x2ca881,_0x509de5){var _0x51317f={};var _0x2328af={};var _0x3700ad;var _0x575734;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x4348db['params']['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x2ca881,null))[_0x4f98('0x34')](function(_0xa99d21){if(_0xa99d21){_0x3700ad=_0xa99d21;_0x2328af['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xe3')][_0x4f98('0x45')]);_0x2328af[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x4348db[_0x4f98('0x4a')]);_0x2328af[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x2328af[_0x4f98('0x4d')],_0x2328af[_0x4f98('0x4a')]);_0x51317f[_0x4f98('0x4e')]=_['intersection'](_0x2328af['model'],qs[_0x4f98('0x50')](_0x4348db[_0x4f98('0x4a')]['fields']));_0x51317f[_0x4f98('0x4e')]=_0x51317f['attributes'][_0x4f98('0x51')]?_0x51317f[_0x4f98('0x4e')]:_0x2328af[_0x4f98('0x4d')];_0x51317f[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x4348db[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x51317f['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x4348db[_0x4f98('0x4a')],_0x2328af[_0x4f98('0x4c')]));if(_0x4348db[_0x4f98('0x4a')]['filter']){_0x51317f[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x51317f[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x51317f[_0x4f98('0x4e')],function(_0xaa00b9){var _0x5dfc24={};_0x5dfc24[_0xaa00b9]={'$like':'%'+_0x4348db[_0x4f98('0x4a')]['filter']+'%'};return _0x5dfc24;})});}_0x51317f=_[_0x4f98('0x57')]({},_0x51317f,_0x4348db[_0x4f98('0x5b')]);return _0x3700ad[_0x4f98('0xe2')](_0x51317f);}})[_0x4f98('0x34')](function(_0xa80b1){if(_0xa80b1){_0x575734=_0xa80b1[_0x4f98('0x51')];if(!_0x4348db[_0x4f98('0x4a')][_0x4f98('0xd3')]('nolimit')){_0x51317f[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x4348db[_0x4f98('0x4a')]['limit']);_0x51317f['offset']=qs[_0x4f98('0x2c')](_0x4348db[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x3700ad['getSmsInteractions'](_0x51317f);}})['then'](function(_0x3deb48){if(_0x3deb48){return _0x3deb48?{'count':_0x575734,'rows':_0x3deb48}:null;}})[_0x4f98('0x34')](respondWithResult(_0x2ca881,null))['catch'](handleError(_0x2ca881,null));};exports['getFaxInteractions']=function(_0x1f02a6,_0x5a4b80,_0x2e7a7f){var _0x279faf={};var _0x2e0124={};var _0x36afb4;var _0x2a7661;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x1f02a6['params']['id']}})['then'](handleEntityNotFound(_0x5a4b80,null))[_0x4f98('0x34')](function(_0x396f86){if(_0x396f86){_0x36afb4=_0x396f86;_0x2e0124[_0x4f98('0x4d')]=_['keys'](db[_0x4f98('0xe4')][_0x4f98('0x45')]);_0x2e0124[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0x1f02a6[_0x4f98('0x4a')]);_0x2e0124[_0x4f98('0x4c')]=_['intersection'](_0x2e0124[_0x4f98('0x4d')],_0x2e0124[_0x4f98('0x4a')]);_0x279faf[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x2e0124[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x1f02a6[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x279faf[_0x4f98('0x4e')]=_0x279faf[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x279faf[_0x4f98('0x4e')]:_0x2e0124['model'];_0x279faf[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0x1f02a6[_0x4f98('0x4a')]['sort']);_0x279faf[_0x4f98('0x55')]=qs['filters'](_[_0x4f98('0x56')](_0x1f02a6[_0x4f98('0x4a')],_0x2e0124[_0x4f98('0x4c')]));if(_0x1f02a6[_0x4f98('0x4a')]['filter']){_0x279faf[_0x4f98('0x55')]=_['merge'](_0x279faf['where'],{'$or':_[_0x4f98('0x44')](_0x279faf[_0x4f98('0x4e')],function(_0x289129){var _0x5700a6={};_0x5700a6[_0x289129]={'$like':'%'+_0x1f02a6['query'][_0x4f98('0x3b')]+'%'};return _0x5700a6;})});}_0x279faf=_['merge']({},_0x279faf,_0x1f02a6['options']);return _0x36afb4['getFaxInteractions'](_0x279faf);}})['then'](function(_0xbef742){if(_0xbef742){_0x2a7661=_0xbef742['length'];if(!_0x1f02a6[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x279faf[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x1f02a6[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x279faf[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0x1f02a6[_0x4f98('0x4a')]['offset']);}return _0x36afb4[_0x4f98('0xe5')](_0x279faf);}})[_0x4f98('0x34')](function(_0x8b02f0){if(_0x8b02f0){return _0x8b02f0?{'count':_0x2a7661,'rows':_0x8b02f0}:null;}})[_0x4f98('0x34')](respondWithResult(_0x5a4b80,null))[_0x4f98('0x63')](handleError(_0x5a4b80,null));};exports[_0x4f98('0xe6')]=function(_0x524b01,_0x623961,_0x41d657){var _0x5241a7={};var _0x209ddb={};var _0x9b4393;var _0x1a0b7f;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0x524b01[_0x4f98('0x65')]['id']}})['then'](handleEntityNotFound(_0x623961,null))[_0x4f98('0x34')](function(_0x13d7df){if(_0x13d7df){_0x9b4393=_0x13d7df;_0x209ddb['model']=_[_0x4f98('0x4b')](db[_0x4f98('0xe7')][_0x4f98('0x45')]);_0x209ddb['query']=_['keys'](_0x524b01[_0x4f98('0x4a')]);_0x209ddb[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x209ddb[_0x4f98('0x4d')],_0x209ddb[_0x4f98('0x4a')]);_0x5241a7[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x209ddb['model'],qs[_0x4f98('0x50')](_0x524b01['query'][_0x4f98('0x50')]));_0x5241a7[_0x4f98('0x4e')]=_0x5241a7[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x5241a7[_0x4f98('0x4e')]:_0x209ddb[_0x4f98('0x4d')];_0x5241a7['order']=qs[_0x4f98('0x54')](_0x524b01[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x5241a7['where']=qs[_0x4f98('0x4c')](_['pick'](_0x524b01[_0x4f98('0x4a')],_0x209ddb[_0x4f98('0x4c')]));if(_0x524b01[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x5241a7[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x5241a7[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x5241a7[_0x4f98('0x4e')],function(_0x3c13fc){var _0x1051bd={};_0x1051bd[_0x3c13fc]={'$like':'%'+_0x524b01['query'][_0x4f98('0x3b')]+'%'};return _0x1051bd;})});}_0x5241a7=_[_0x4f98('0x57')]({},_0x5241a7,_0x524b01[_0x4f98('0x5b')]);return _0x9b4393[_0x4f98('0xe6')](_0x5241a7);}})['then'](function(_0x32c9ae){if(_0x32c9ae){_0x1a0b7f=_0x32c9ae[_0x4f98('0x51')];if(!_0x524b01[_0x4f98('0x4a')][_0x4f98('0xd3')](_0x4f98('0x52'))){_0x5241a7[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0x524b01[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x5241a7[_0x4f98('0x2c')]=qs['offset'](_0x524b01[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x9b4393[_0x4f98('0xe6')](_0x5241a7);}})[_0x4f98('0x34')](function(_0x9ab438){if(_0x9ab438){return _0x9ab438?{'count':_0x1a0b7f,'rows':_0x9ab438}:null;}})['then'](respondWithResult(_0x623961,null))['catch'](handleError(_0x623961,null));};exports[_0x4f98('0xe8')]=function(_0x286b37,_0x43d887,_0x4afc00){var _0x5441f1;var _0x1cbf5d;var _0x6cc6e3;var _0x176648=!_[_0x4f98('0x6f')](_0x286b37[_0x4f98('0x65')]['id'])?_0x286b37[_0x4f98('0x65')]['id']:!_['isNil'](_0x286b37['user']['id'])?_0x286b37[_0x4f98('0x38')]['id']:null;return db['User']['find']({'where':{'id':_0x176648,'role':{'$or':[_0x4f98('0x37'),_0x4f98('0x38'),_0x4f98('0x39')]}},'attributes':['id',_0x4f98('0x3f'),'phone','mobile',_0x4f98('0x36'),_0x4f98('0x6d'),_0x4f98('0xa9')]})[_0x4f98('0x34')](function(_0x25efd0){if(_0x25efd0){if(_0x25efd0[_0x4f98('0x36')]===_0x4f98('0x39')){_0x5441f1=_0x25efd0;if(_0x286b37[_0x4f98('0x64')][_0x4f98('0xaa')]){_0x6cc6e3=util['format'](_0x4f98('0xe9'),_0x5441f1[_0x286b37[_0x4f98('0x64')][_0x4f98('0xaa')]]);}else if(_0x286b37[_0x4f98('0x64')][_0x4f98('0xea')]){_0x6cc6e3=util['format'](_0x4f98('0xb4'),_0x286b37[_0x4f98('0x64')][_0x4f98('0xea')]);}else{_0x6cc6e3=util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x5441f1[_0x4f98('0x3f')]);}socket['to'](util[_0x4f98('0xb3')](_0x4f98('0xeb'),_0x5441f1[_0x4f98('0x3f')]))[_0x4f98('0xbc')](_0x4f98('0xec'),{'ip':_0x286b37[_0x4f98('0xed')][_0x4f98('0xee')]||_0x286b37[_0x4f98('0xef')][_0x4f98('0xf0')]||_0x286b37['socket']['remoteAddress']||_0x286b37[_0x4f98('0xef')]['socket']['remoteAddress']});return db[_0x4f98('0xb7')]['destroy']({'where':{'membername':_0x5441f1[_0x4f98('0x3f')]},'individualHooks':!![]});}}else{throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x4f98('0x34')](function(){if(_0x5441f1){return _0x5441f1[_0x4f98('0xf1')]({'raw':!![]});}})[_0x4f98('0x34')](function(_0x140d6b){if(_0x5441f1){var _0x4a5ba9=[];if(_0x140d6b){_0x1cbf5d=_0x140d6b;if(_0x1cbf5d[_0x4f98('0x51')]){for(var _0x4beaf7=0x0;_0x4beaf7<_0x1cbf5d[_0x4f98('0x51')];_0x4beaf7++){_0x4a5ba9[_0x4f98('0x92')]({'membername':_0x5441f1[_0x4f98('0x3f')],'UserId':_0x5441f1['id'],'queue_name':_0x1cbf5d[_0x4beaf7][_0x4f98('0x3f')],'VoiceQueueId':_0x1cbf5d[_0x4beaf7]['id'],'interface':_0x6cc6e3,'paused':_0x5441f1[_0x4f98('0xa9')]||![],'penalty':_0x1cbf5d[_0x4beaf7][_0x4f98('0xf2')]||0x0});}return BPromise['each'](_0x4a5ba9,function(_0x589c3d){return db['UserVoiceQueueRt'][_0x4f98('0xb8')](_0x589c3d);});}}}})[_0x4f98('0x34')](function(){if(_0x5441f1){return db[_0x4f98('0xf3')][_0x4f98('0x5f')]({'where':{'membername':_0x5441f1['name'],'exitAt':null}});}})[_0x4f98('0x34')](function(_0x1a54e8){if(_0x5441f1){var _0x1fb787=[];_0x1a54e8[_0x4f98('0xf4')](function(_0x2ee686){_0x1fb787[_0x4f98('0x92')](_0x2ee686['update']({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5'))}));});return BPromise[_0x4f98('0x93')](_0x1fb787);}})[_0x4f98('0x34')](function(){if(_0x5441f1){var _0x17092a=[];var _0x109018=[];var _0x14f1f7=utils[_0x4f98('0xf6')]();var _0x93b786={'membername':_0x5441f1[_0x4f98('0x3f')],'interface':_0x6cc6e3,'enterAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'role':_0x5441f1[_0x4f98('0x36')],'internal':_0x5441f1[_0x4f98('0x6d')]};_0x14f1f7['forEach'](function(_0x1c831a){_0x17092a[_0x4f98('0x92')](_[_0x4f98('0x57')]({'channel':_0x1c831a,'type':_0x4f98('0xf7'),'data1':_0x286b37['body'][_0x4f98('0xf8')],'data2':_0x6cc6e3},_0x93b786));if(_0x5441f1[_0x4f98('0xa9')]){_0x109018[_0x4f98('0x92')](_[_0x4f98('0x57')]({'channel':_0x1c831a,'type':_0x4f98('0xf9'),'data1':'LOGININPAUSE'},_0x93b786));}});return db['MemberReport'][_0x4f98('0x8f')](_0x17092a[_0x4f98('0xfa')](_0x109018),{'individualHooks':!![]});}})[_0x4f98('0x34')](function(){if(_0x5441f1){return _0x5441f1[_0x4f98('0x33')]({'online':!![],'lastLoginAt':moment()[_0x4f98('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5441f1['loginInPause']||![],'mailPause':_0x5441f1['loginInPause']||![],'chatPause':_0x5441f1[_0x4f98('0xa9')]||![],'faxPause':_0x5441f1[_0x4f98('0xa9')]||![],'smsPause':_0x5441f1[_0x4f98('0xa9')]||![],'openchannelPause':_0x5441f1['loginInPause']||![],'whatsappPause':_0x5441f1[_0x4f98('0xa9')]||![],'pauseType':_0x5441f1['loginInPause']?'LOGININPAUSE':null,'interface':_0x6cc6e3,'lastPauseAt':moment()['format'](_0x4f98('0xf5'))});}})['then'](function(_0x1cb938){if(_0x286b37['isMiddleware']){return _0x4afc00();}else{return BPromise[_0x4f98('0xfb')](_0x1cb938)['then'](respondWithResult(_0x43d887,null));}})[_0x4f98('0x63')](handleError(_0x43d887,null));};exports['logout']=function(_0xbbe6fb,_0x3eb64f,_0x4d946b){var _0x829b93;return db['User']['find']({'where':{'id':_0xbbe6fb['params']['id'],'role':_0x4f98('0x39')},'attributes':['id',_0x4f98('0x3f'),'role']})[_0x4f98('0x34')](handleEntityNotFound(_0x3eb64f,null))[_0x4f98('0x34')](function(_0x5a078){if(_0x5a078){_0x829b93=_0x5a078;return db[_0x4f98('0xb7')][_0x4f98('0x40')]({'where':{'membername':_0x829b93[_0x4f98('0x3f')]},'individualHooks':!![]});}})[_0x4f98('0x34')](function(){return db[_0x4f98('0xf3')][_0x4f98('0x5f')]({'where':{'membername':_0x829b93['name'],'exitAt':null}});})[_0x4f98('0x34')](function(_0x206c4e){var _0x29857b=[];_0x206c4e[_0x4f98('0xf4')](function(_0x4b3ea2){_0x29857b[_0x4f98('0x92')](_0x4b3ea2[_0x4f98('0x33')]({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5'))}));});return BPromise[_0x4f98('0x93')](_0x29857b);})[_0x4f98('0x34')](function(){return _0x829b93[_0x4f98('0x33')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4f98('0x34')](respondWithResult(_0x3eb64f,null))['catch'](handleError(_0x3eb64f,null));};exports[_0x4f98('0xfc')]=function(_0x47de2b,_0x28bcda,_0x1fa3a8){var _0x4e334d;return db[_0x4f98('0xb7')][_0x4f98('0x33')]({'paused':0x1},{'where':{'UserId':_0x47de2b['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x47de2b['params']['id'],'role':_0x4f98('0x39')},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36'),_0x4f98('0x6d'),_0x4f98('0xaa')]});})[_0x4f98('0x34')](handleEntityNotFound(_0x28bcda,null))[_0x4f98('0x34')](function(_0xfdf277){if(_0xfdf277){_0x4e334d=_0xfdf277;return respondWithRpcPromise('QueuePause',_0x4f98('0xfc'),{'id':_0x4e334d['id'],'name':_0x4e334d['name'],'pause':!![]});}})[_0x4f98('0x34')](function(){if(_0x4e334d){return db[_0x4f98('0xf3')]['findAll']({'where':{'membername':_0x4e334d[_0x4f98('0x3f')],'type':_0x4f98('0xf9'),'exitAt':null}});}})['then'](function(_0x54367b){if(_0x54367b[_0x4f98('0x51')]){var _0x488ad7=moment()[_0x4f98('0xb3')](_0x4f98('0xf5'));for(var _0x1501f1=0x0,_0x36ba8c=_0x54367b['length'];_0x1501f1<_0x36ba8c;_0x1501f1++){_0x54367b[_0x1501f1][_0x4f98('0xfd')]({'exitAt':_0x488ad7});}}})['then'](function(){var _0x2b1329=[];var _0x35079f=utils[_0x4f98('0xf6')]();_0x35079f[_0x4f98('0xf4')](function(_0x16bbd4){_0x2b1329[_0x4f98('0x92')]({'channel':_0x16bbd4,'membername':_0x4e334d[_0x4f98('0x3f')],'interface':_[_0x4f98('0x6f')](_0x4e334d[_0x4f98('0xaa')])?util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x4e334d['name']):_0x4e334d[_0x4f98('0xaa')],'type':'PAUSE','enterAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'data1':_0x47de2b['body'][_0x4f98('0x47')]||_0x4f98('0xfe'),'role':_0x4e334d[_0x4f98('0x36')],'internal':_0x4e334d[_0x4f98('0x6d')]});});return db[_0x4f98('0xf3')][_0x4f98('0x8f')](_0x2b1329,{'individualHooks':!![]});})[_0x4f98('0x34')](function(){return _0x4e334d[_0x4f98('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x47de2b[_0x4f98('0x64')][_0x4f98('0x47')]||_0x4f98('0xfe'),'lastPauseAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5'))});})['then'](respondWithResult(_0x28bcda,null))['catch'](handleError(_0x28bcda,null));};exports[_0x4f98('0xff')]=function(_0x9a875a,_0x23f4a4,_0xe1b537){var _0x8b5803;return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0x9a875a[_0x4f98('0x65')]['id']},'attributes':['id',_0x4f98('0x3f'),_0x4f98('0x36'),'voicePause',_0x4f98('0x100'),'chatPause',_0x4f98('0x101'),'openchannelPause','smsPause','whatsapppause','pauseType',_0x4f98('0x102')]})[_0x4f98('0x34')](handleEntityNotFound(_0x23f4a4,null))[_0x4f98('0x34')](function(_0x114b4d){if(_0x114b4d){_0x8b5803=_0x114b4d;if(_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')]&&!utils[_0x4f98('0xab')](_0x9a875a['body'][_0x4f98('0xa7')])){throw new db[(_0x4f98('0x99'))][(_0x4f98('0x9a'))](_0x4f98('0xac'));}switch(_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')]){case _0x4f98('0xbe'):return respondWithRpcPromise(_0x4f98('0x103'),'unpause',{'id':_0x8b5803['id'],'name':_0x8b5803[_0x4f98('0x3f')],'pause':![]})[_0x4f98('0x34')](function(){return db['UserVoiceQueueRt'][_0x4f98('0x33')]({'paused':0x0},{'where':{'UserId':_0x8b5803['id']},'individualHooks':!![]});})['then'](function(){return db[_0x4f98('0xf3')]['find']({'where':{'channel':_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')],'membername':_0x8b5803[_0x4f98('0x3f')],'type':_0x4f98('0xf9'),'exitAt':null}});})[_0x4f98('0x34')](function(_0x179b18){if(_0x179b18){return _0x179b18[_0x4f98('0x33')]({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'data2':_0x4f98('0x104')},{'individualHooks':!![]});}return null;})[_0x4f98('0x34')](function(){return _0x8b5803[_0x4f98('0x33')]({'voicePause':![]});});case _0x4f98('0x105'):case _0x4f98('0x106'):case _0x4f98('0x107'):case _0x4f98('0x108'):case'whatsapp':case'openchannel':return db['MemberReport'][_0x4f98('0x62')]({'where':{'channel':_0x9a875a[_0x4f98('0x64')][_0x4f98('0xa7')],'membername':_0x8b5803['name'],'type':_0x4f98('0xf9'),'exitAt':null}})[_0x4f98('0x34')](function(_0x1a8320){if(_0x1a8320){return _0x1a8320[_0x4f98('0x33')]({'exitAt':moment()[_0x4f98('0xb3')](_0x4f98('0xf5')),'data2':_0x4f98('0x104')},{'individualHooks':!![]});}return null;})[_0x4f98('0x34')](function(){var _0x1ac9a6={};_[_0x4f98('0x2e')](_0x1ac9a6,util[_0x4f98('0xb3')]('%s%s',_0x9a875a['body'][_0x4f98('0xa7')],_0x4f98('0x109')),![]);return _0x8b5803[_0x4f98('0x33')](_0x1ac9a6);});default:return respondWithRpcPromise(_0x4f98('0x103'),_0x4f98('0xff'),{'id':_0x8b5803['id'],'name':_0x8b5803[_0x4f98('0x3f')],'pause':![]})[_0x4f98('0x34')](function(){return db[_0x4f98('0xb7')][_0x4f98('0x33')]({'paused':0x0},{'where':{'UserId':_0x8b5803['id']}});})[_0x4f98('0x34')](function(){return db['MemberReport'][_0x4f98('0x5f')]({'where':{'membername':_0x8b5803[_0x4f98('0x3f')],'type':_0x4f98('0xf9'),'exitAt':null}});})['then'](function(_0x13dee8){var _0x5bfb97=[];_0x13dee8[_0x4f98('0xf4')](function(_0x3de5e8){_0x5bfb97[_0x4f98('0x92')](_0x3de5e8['update']({'exitAt':moment()[_0x4f98('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x4f98('0x104')}));});return BPromise['all'](_0x5bfb97);})[_0x4f98('0x34')](function(){return _0x8b5803[_0x4f98('0x33')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x23f4a4,null))[_0x4f98('0x63')](handleError(_0x23f4a4,null));};exports['getTeams']=function(_0xb69afb,_0x4c5c8d,_0x55a81d){var _0x4bd0f9={};var _0x59d467={};var _0x484b03;var _0x126530;return db[_0x4f98('0x5c')][_0x4f98('0xc9')]({'where':{'id':_0xb69afb[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x4c5c8d,null))['then'](function(_0x4e240d){if(_0x4e240d){_0x484b03=_0x4e240d;_0x59d467['model']=_[_0x4f98('0x4b')](db[_0x4f98('0x10a')]['rawAttributes']);_0x59d467['query']=_[_0x4f98('0x4b')](_0xb69afb[_0x4f98('0x4a')]);_0x59d467[_0x4f98('0x4c')]=_['intersection'](_0x59d467['model'],_0x59d467[_0x4f98('0x4a')]);_0x4bd0f9[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0x59d467[_0x4f98('0x4d')],qs['fields'](_0xb69afb['query']['fields']));_0x4bd0f9[_0x4f98('0x4e')]=_0x4bd0f9['attributes'][_0x4f98('0x51')]?_0x4bd0f9[_0x4f98('0x4e')]:_0x59d467[_0x4f98('0x4d')];_0x4bd0f9[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0xb69afb[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x4bd0f9[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_['pick'](_0xb69afb[_0x4f98('0x4a')],_0x59d467['filters']));if(_0xb69afb[_0x4f98('0x4a')]['filter']){_0x4bd0f9[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4bd0f9[_0x4f98('0x55')],{'$or':_[_0x4f98('0x44')](_0x4bd0f9[_0x4f98('0x4e')],function(_0x553b14){var _0x20abf7={};_0x20abf7[_0x553b14]={'$like':'%'+_0xb69afb[_0x4f98('0x4a')]['filter']+'%'};return _0x20abf7;})});}_0x4bd0f9=_[_0x4f98('0x57')]({},_0x4bd0f9,_0xb69afb[_0x4f98('0x5b')]);return _0x484b03[_0x4f98('0x10b')](_0x4bd0f9);}})[_0x4f98('0x34')](function(_0xcabfd6){if(_0xcabfd6){_0x126530=_0xcabfd6[_0x4f98('0x51')];if(!_0xb69afb[_0x4f98('0x4a')]['hasOwnProperty'](_0x4f98('0x52'))){_0x4bd0f9[_0x4f98('0x2d')]=qs[_0x4f98('0x2d')](_0xb69afb[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x4bd0f9[_0x4f98('0x2c')]=qs[_0x4f98('0x2c')](_0xb69afb[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0x484b03[_0x4f98('0x10b')](_0x4bd0f9);}})[_0x4f98('0x34')](function(_0x2895a6){if(_0x2895a6){return _0x2895a6?{'count':_0x126530,'rows':_0x2895a6}:null;}})['then'](respondWithResult(_0x4c5c8d,null))[_0x4f98('0x63')](handleError(_0x4c5c8d,null));};exports[_0x4f98('0x10c')]=function(_0xf84f9e,_0xe44c52){return db[_0x4f98('0x5c')][_0x4f98('0x62')]({'where':{'id':_0xf84f9e['params']['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0xe44c52,null))[_0x4f98('0x34')](function(_0x4369f3){if(_0x4369f3){var _0x152562=_0x4369f3[_0x4f98('0x35')]({'plain':!![]});return _0x4369f3[_0x4f98('0x10c')](_0xf84f9e[_0x4f98('0x64')][_0x4f98('0x68')],_['omit'](_0xf84f9e[_0x4f98('0x64')],[_0x4f98('0x68'),'id'])||{})[_0x4f98('0x34')](function(){for(var _0x55496e=0x0;_0x55496e<_0xf84f9e[_0x4f98('0x64')]['ids'][_0x4f98('0x51')];_0x55496e++){var _0x251f8f=[];db[_0x4f98('0x10a')][_0x4f98('0xc9')]({'where':{'id':_0xf84f9e[_0x4f98('0x64')]['ids'][_0x55496e]}})[_0x4f98('0x34')](function(_0x4dec67){_0x251f8f[_0x4f98('0x92')](_0x4dec67['getVoiceQueues']()[_0x4f98('0x34')](function(_0x1d4182){for(var _0xc9d1ae=0x0;_0xc9d1ae<_0x1d4182['length'];_0xc9d1ae++){_0x1d4182[_0xc9d1ae][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x10e'));}return _0x1d4182;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x10f')]()['then'](function(_0x16dd84){for(var _0xd3d1bd=0x0;_0xd3d1bd<_0x16dd84[_0x4f98('0x51')];_0xd3d1bd++){_0x16dd84[_0xd3d1bd][_0x4f98('0x10d')](_0x4f98('0xa7'),'Chat');}return _0x16dd84;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x110')]()[_0x4f98('0x34')](function(_0x8abf1f){for(var _0x2e71fd=0x0;_0x2e71fd<_0x8abf1f['length'];_0x2e71fd++){_0x8abf1f[_0x2e71fd][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x111'));}return _0x8abf1f;}));_0x251f8f[_0x4f98('0x92')](_0x4dec67[_0x4f98('0x112')]()[_0x4f98('0x34')](function(_0x5dce1a){for(var _0x357d98=0x0;_0x357d98<_0x5dce1a[_0x4f98('0x51')];_0x357d98++){_0x5dce1a[_0x357d98][_0x4f98('0x10d')](_0x4f98('0xa7'),'Sms');}return _0x5dce1a;}));_0x251f8f[_0x4f98('0x92')](_0x4dec67[_0x4f98('0x113')]()[_0x4f98('0x34')](function(_0x256cf7){for(var _0x4e63a3=0x0;_0x4e63a3<_0x256cf7[_0x4f98('0x51')];_0x4e63a3++){_0x256cf7[_0x4e63a3][_0x4f98('0x10d')]('channel',_0x4f98('0x114'));}return _0x256cf7;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x115')]()[_0x4f98('0x34')](function(_0x263664){for(var _0x4a358f=0x0;_0x4a358f<_0x263664[_0x4f98('0x51')];_0x4a358f++){_0x263664[_0x4a358f][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x116'));}return _0x263664;}));_0x251f8f['push'](_0x4dec67[_0x4f98('0x117')]()[_0x4f98('0x34')](function(_0x36b23f){for(var _0x4ef78c=0x0;_0x4ef78c<_0x36b23f[_0x4f98('0x51')];_0x4ef78c++){_0x36b23f[_0x4ef78c]['setDataValue'](_0x4f98('0xa7'),_0x4f98('0x118'));}return _0x36b23f;}));return BPromise[_0x4f98('0x93')](_0x251f8f);})['then'](function(_0x19ca9a){var _0x54c69e=_['flatten'](_0x19ca9a);_0x251f8f=[];return db['sequelize']['transaction'](function(_0x5d9b44){for(var _0x2a94b1=0x0;_0x2a94b1<_0x54c69e[_0x4f98('0x51')];_0x2a94b1++){_0x251f8f[_0x4f98('0x92')](_0x54c69e[_0x2a94b1][_0x4f98('0x119')](_0x152562['id']),{'transaction':_0x5d9b44});}return BPromise[_0x4f98('0x93')](_0x251f8f)[_0x4f98('0x34')](function(){if(_0x152562['online']){return BPromise[_0x4f98('0xb6')](_[_0x4f98('0x3b')](_0x54c69e,function(_0x416245){return _0x416245['getDataValue'](_0x4f98('0xa7'))==='Voice';}),function(_0x2db987){return db[_0x4f98('0xb7')][_0x4f98('0xb8')]({'membername':_0x152562['name'],'UserId':_0x152562['id'],'queue_name':_0x2db987['name'],'VoiceQueueId':_0x2db987['id'],'interface':_['isNil'](_0x152562[_0x4f98('0xaa')])?util[_0x4f98('0xb3')](_0x4f98('0xb4'),_0x152562[_0x4f98('0x3f')]):_0x152562['interface'],'paused':_0x152562[_0x4f98('0x11a')]||![],'penalty':_0x152562[_0x4f98('0xb5')]},{'transaction':_0x5d9b44});});}else{return;}})[_0x4f98('0x34')](function(){for(var _0x1e18fe=0x0;_0x1e18fe<_0x54c69e[_0x4f98('0x51')];_0x1e18fe++){var _0x16dba=_0x54c69e[_0x1e18fe]['getDataValue'](_0x4f98('0xa7'));var _0x585e4a=_0x16dba+_0x4f98('0xbb');socket[_0x4f98('0xbc')](_0x4f98('0x38')+_0x16dba+_0x4f98('0xb2'),{'UserId':_0x152562['id'],['queueField']:_0x54c69e[_0x1e18fe]['id']});}});});});}});}})[_0x4f98('0x34')](respondWithStatusCode(_0xe44c52,null))[_0x4f98('0x63')](handleError(_0xe44c52,null));};exports[_0x4f98('0x11b')]=function(_0x1cb57b,_0x38bb86){return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x1cb57b[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x38bb86,null))[_0x4f98('0x34')](function(_0x26c330){if(_0x26c330){var _0x403aa4=_0x26c330['get']({'plain':!![]});var _0x4400db=_0x1cb57b[_0x4f98('0x4a')][_0x4f98('0x68')];return _0x26c330[_0x4f98('0x11b')](_0x4400db)['then'](function(){for(var _0x9f39e3=0x0;_0x9f39e3<_0x4400db[_0x4f98('0x51')];_0x9f39e3++){var _0x4f310b=[];db[_0x4f98('0x10a')][_0x4f98('0xc9')]({'where':{'id':_0x4400db[_0x9f39e3]}})[_0x4f98('0x34')](function(_0x5b4b7c){_0x4f310b[_0x4f98('0x92')](_0x5b4b7c['getVoiceQueues']()[_0x4f98('0x34')](function(_0x1bc285){for(var _0xe873d4=0x0;_0xe873d4<_0x1bc285[_0x4f98('0x51')];_0xe873d4++){_0x1bc285[_0xe873d4][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x10e'));}return _0x1bc285;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c['getChatQueues']()[_0x4f98('0x34')](function(_0x542853){for(var _0x57874c=0x0;_0x57874c<_0x542853[_0x4f98('0x51')];_0x57874c++){_0x542853[_0x57874c][_0x4f98('0x10d')]('channel',_0x4f98('0x11c'));}return _0x542853;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x110')]()[_0x4f98('0x34')](function(_0xf7f262){for(var _0x183887=0x0;_0x183887<_0xf7f262[_0x4f98('0x51')];_0x183887++){_0xf7f262[_0x183887]['setDataValue'](_0x4f98('0xa7'),'Mail');}return _0xf7f262;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x112')]()['then'](function(_0x22a351){for(var _0x446e46=0x0;_0x446e46<_0x22a351[_0x4f98('0x51')];_0x446e46++){_0x22a351[_0x446e46][_0x4f98('0x10d')]('channel',_0x4f98('0x11d'));}return _0x22a351;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x113')]()['then'](function(_0x59a17e){for(var _0xb23d0=0x0;_0xb23d0<_0x59a17e[_0x4f98('0x51')];_0xb23d0++){_0x59a17e[_0xb23d0][_0x4f98('0x10d')]('channel','Whatsapp');}return _0x59a17e;}));_0x4f310b['push'](_0x5b4b7c['getFaxQueues']()[_0x4f98('0x34')](function(_0x3ff308){for(var _0x48a23c=0x0;_0x48a23c<_0x3ff308[_0x4f98('0x51')];_0x48a23c++){_0x3ff308[_0x48a23c][_0x4f98('0x10d')](_0x4f98('0xa7'),_0x4f98('0x116'));}return _0x3ff308;}));_0x4f310b[_0x4f98('0x92')](_0x5b4b7c[_0x4f98('0x117')]()['then'](function(_0x4d3b04){for(var _0x19c65c=0x0;_0x19c65c<_0x4d3b04['length'];_0x19c65c++){_0x4d3b04[_0x19c65c]['setDataValue'](_0x4f98('0xa7'),_0x4f98('0x118'));}return _0x4d3b04;}));return BPromise[_0x4f98('0x93')](_0x4f310b);})[_0x4f98('0x34')](function(_0x450e20){var _0x28de4b=_[_0x4f98('0x11e')](_0x450e20);_0x4f310b=[];return db[_0x4f98('0x58')]['transaction'](function(_0x49a2ba){for(var _0x5b8c19=0x0;_0x5b8c19<_0x28de4b[_0x4f98('0x51')];_0x5b8c19++){_0x4f310b['push'](_0x28de4b[_0x5b8c19]['removeAgent'](_0x403aa4['id']),{'transaction':_0x49a2ba});}return BPromise[_0x4f98('0x93')](_0x4f310b)[_0x4f98('0x34')](function(){if(_0x403aa4[_0x4f98('0xa8')]){return BPromise['each'](_[_0x4f98('0x3b')](_0x28de4b,function(_0x16eaf9){return _0x16eaf9['getDataValue'](_0x4f98('0xa7'))===_0x4f98('0x10e');}),function(_0x37df06){return db[_0x4f98('0xb7')][_0x4f98('0x40')]({'where':{'VoiceQueueId':_0x37df06['id'],'UserId':_0x403aa4['id']},'transaction':_0x49a2ba});});}else{return;}})['then'](function(){for(var _0x24e874=0x0;_0x24e874<_0x28de4b[_0x4f98('0x51')];_0x24e874++){var _0x44e62d=_0x28de4b[_0x24e874][_0x4f98('0x11f')](_0x4f98('0xa7'));var _0x2984b1=_0x44e62d+'QueueId';socket[_0x4f98('0xbc')](_0x4f98('0x38')+_0x44e62d+_0x4f98('0xbd'),{'UserId':_0x403aa4['id'],['queueField']:_0x28de4b[_0x24e874]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x38bb86,null))['catch'](handleError(_0x38bb86,null));};exports[_0x4f98('0x120')]=function(_0x5b1e13,_0x4ec4a3,_0xeb9569){var _0x4834db={};var _0x2a4029={};var _0xbd5a65;var _0x4a0f6c;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0x5b1e13[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x4ec4a3,null))['then'](function(_0x41feca){if(_0x41feca){_0xbd5a65=_0x41feca;_0x2a4029[_0x4f98('0x4d')]=_['keys'](db['CmList'][_0x4f98('0x45')]);_0x2a4029['query']=_['keys'](_0x5b1e13[_0x4f98('0x4a')]);_0x2a4029[_0x4f98('0x4c')]=_[_0x4f98('0x4f')](_0x2a4029[_0x4f98('0x4d')],_0x2a4029[_0x4f98('0x4a')]);_0x4834db[_0x4f98('0x4e')]=_['intersection'](_0x2a4029[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x4834db['attributes']=_0x4834db[_0x4f98('0x4e')][_0x4f98('0x51')]?_0x4834db[_0x4f98('0x4e')]:_0x2a4029['model'];_0x4834db['order']=qs[_0x4f98('0x54')](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x4834db['where']=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0x5b1e13[_0x4f98('0x4a')],_0x2a4029[_0x4f98('0x4c')]));if(_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x3b')]){_0x4834db[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x4834db['where'],{'$or':_['map'](_0x4834db['attributes'],function(_0x2c79be){var _0x3cf635={};_0x3cf635[_0x2c79be]={'$like':'%'+_0x5b1e13[_0x4f98('0x4a')]['filter']+'%'};return _0x3cf635;})});}_0x4834db=_[_0x4f98('0x57')]({},_0x4834db,_0x5b1e13[_0x4f98('0x5b')]);return _0xbd5a65[_0x4f98('0x120')](_0x4834db);}})[_0x4f98('0x34')](function(_0x1d391a){if(_0x1d391a){_0x4a0f6c=_0x1d391a[_0x4f98('0x51')];if(!_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0xd3')]('nolimit')){_0x4834db[_0x4f98('0x2d')]=qs['limit'](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x2d')]);_0x4834db[_0x4f98('0x2c')]=qs['offset'](_0x5b1e13[_0x4f98('0x4a')][_0x4f98('0x2c')]);}return _0xbd5a65[_0x4f98('0x120')](_0x4834db);}})[_0x4f98('0x34')](function(_0x2c6a66){if(_0x2c6a66){return _0x2c6a66?{'count':_0x4a0f6c,'rows':_0x2c6a66}:null;}})[_0x4f98('0x34')](respondWithResult(_0x4ec4a3,null))[_0x4f98('0x63')](handleError(_0x4ec4a3,null));};exports[_0x4f98('0x121')]=function(_0xcf93fd,_0x5305d1,_0x28a5f1){var _0x482486={};var _0xb99719={};var _0x37ae55;var _0x25e313;return db[_0x4f98('0x5c')]['findOne']({'where':{'id':_0xcf93fd[_0x4f98('0x65')]['id']}})[_0x4f98('0x34')](handleEntityNotFound(_0x5305d1,null))[_0x4f98('0x34')](function(_0x54507c){if(_0x54507c){_0x37ae55=_0x54507c;_0xb99719[_0x4f98('0x4d')]=_[_0x4f98('0x4b')](db[_0x4f98('0x5c')][_0x4f98('0x45')]);_0xb99719[_0x4f98('0x4a')]=_[_0x4f98('0x4b')](_0xcf93fd['query']);_0xb99719['filters']=_[_0x4f98('0x4f')](_0xb99719['model'],_0xb99719[_0x4f98('0x4a')]);_0x482486[_0x4f98('0x4e')]=_[_0x4f98('0x4f')](_0xb99719[_0x4f98('0x4d')],qs[_0x4f98('0x50')](_0xcf93fd[_0x4f98('0x4a')][_0x4f98('0x50')]));_0x482486[_0x4f98('0x4e')]=_0x482486['attributes'][_0x4f98('0x51')]?_0x482486['attributes']:_0xb99719[_0x4f98('0x4d')];_0x482486[_0x4f98('0x53')]=qs[_0x4f98('0x54')](_0xcf93fd[_0x4f98('0x4a')][_0x4f98('0x54')]);_0x482486[_0x4f98('0x55')]=qs[_0x4f98('0x4c')](_[_0x4f98('0x56')](_0xcf93fd[_0x4f98('0x4a')],_0xb99719[_0x4f98('0x4c')]));if(_0xcf93fd['query'][_0x4f98('0x3b')]){_0x482486[_0x4f98('0x55')]=_[_0x4f98('0x57')](_0x482486['where'],{'$or':_[_0x4f98('0x44')](_0x482486[_0x4f98('0x4e')],function(_0x12383c){var _0x1f092={};_0x1f092[_0x12383c]={'$like':'%'+_0xcf93fd[_0x4f98('0x4a')][_0x4f98('0x3b')]+'%'};return _0x1f092;})});}_0x482486['model']=db['User'];_0x482486['as']=_0x4f98('0x8b');_0x482486=_[_0x4f98('0x57')]({},_0x482486,_0xcf93fd[_0x4f98('0x5b')]);return _0x37ae55[_0x4f98('0xf1')]({'include':[_0x482486]});}})['then'](function(_0x30eca7){if(_0x30eca7){var _0x300437={},_0x123069=[],_0x477222=0x0;for(var _0x553d31=0x0;_0x553d31<_0x30eca7[_0x4f98('0x51')];_0x553d31+=0x1){for(var _0x287097=0x0,_0x54d229;_0x287097<_0x30eca7[_0x553d31][_0x4f98('0x8b')][_0x4f98('0x51')];_0x287097+=0x1){_0x54d229=_0x30eca7[_0x553d31][_0x4f98('0x8b')][_0x287097]['get']({'plain':!![]});_0x300437[_0x54d229['id']]=_0x54d229;}}_0x300437=_[_0x4f98('0x122')](_0x300437);for(var _0xb6a726=qs['offset'](_0xcf93fd['query'][_0x4f98('0x2c')]);_0xb6a726<_0x300437['length']&&_0x123069[_0x4f98('0x51')]=_0x298b12){_0x12c857=_0x298b12;_0x5bc6f6=0xc8;}else{_0x5bc6f6=0xce;}_0x47736f['status'](_0x5bc6f6);return _0x47736f[_0x2a99('0x33')](_0x2a99('0x34'),_0x17a9a0+'-'+_0x12c857+'/'+_0x298b12)['json'](_0x5ad092);}return null;};}function patchUpdates(_0x153a3e){return function(_0xe463af){try{jsonpatch[_0x2a99('0x35')](_0xe463af,_0x153a3e,!![]);}catch(_0x56dee2){return BPromise[_0x2a99('0x36')](_0x56dee2);}return _0xe463af[_0x2a99('0x37')]();};}function saveUpdates(_0xafccad,_0x4756de){return function(_0x18ad48){if(_0x18ad48){return _0x18ad48['update'](_0xafccad)[_0x2a99('0x24')](function(_0x4fef34){return _0x4fef34;});}return null;};}function removeEntity(_0x177dae,_0x3e6bbc){return function(_0x29567a){if(_0x29567a){return _0x29567a[_0x2a99('0x38')]()[_0x2a99('0x24')](function(){var _0x1f2e46=_0x29567a[_0x2a99('0x39')]({'plain':!![]});if(_0x1f2e46[_0x2a99('0x3a')]===_0x2a99('0x3b'))return;var _0x1232da=[{'name':_0x2a99('0x3c'),'value':'user','ignore':!![]},{'name':_0x2a99('0x3d'),'value':_0x2a99('0x3e'),'ignore':![]},{'name':_0x2a99('0x3f'),'value':_0x2a99('0x40'),'ignore':![]}];var _0x2e7b21=_(_0x1232da)[_0x2a99('0x41')](_0x2a99('0x42'))[_0x2a99('0x43')](_0x2a99('0x44'))[_0x2a99('0x44')]();if(_['includes'](_0x2e7b21,_0x1f2e46['role'])){return;}var _0x5b8fce=_[_0x2a99('0x45')](_0x1232da,[_0x2a99('0x44'),_0x1f2e46[_0x2a99('0x3a')]])[_0x2a99('0x46')];return db[_0x2a99('0x47')][_0x2a99('0x38')]({'where':{'type':_0x5b8fce,'resourceId':_0x1f2e46['id']}})[_0x2a99('0x24')](function(){return _0x29567a;});})['then'](function(){_0x177dae[_0x2a99('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501835,_0x28ab83){return function(_0x22cf4b){if(!_0x22cf4b){_0x501835[_0x2a99('0x2d')](0x194);}return _0x22cf4b;};}function handleError(_0x10dd44,_0x475268){_0x475268=_0x475268||0x1f4;return function(_0x3f6729){logger[_0x2a99('0x2a')](_0x3f6729[_0x2a99('0x48')]);if(_0x3f6729[_0x2a99('0x46')]){delete _0x3f6729[_0x2a99('0x46')];}_0x10dd44[_0x2a99('0x2e')](_0x475268)[_0x2a99('0x49')](_0x3f6729);};}exports[_0x2a99('0x4a')]=function(_0x57df22,_0x9d46e3){var _0x20e4b7={},_0x529822={},_0xa1dba5={'count':0x0,'rows':[]};var _0x1af68b=_[_0x2a99('0x43')](db[_0x2a99('0x4b')][_0x2a99('0x4c')],function(_0x5a6850){return{'name':_0x5a6850[_0x2a99('0x4d')],'type':_0x5a6850[_0x2a99('0x4e')][_0x2a99('0x4f')]};});_0x529822[_0x2a99('0x50')]=_['differenceBy'](_[_0x2a99('0x43')](_0x1af68b,_0x2a99('0x46')),[_0x2a99('0x51'),_0x2a99('0x52')]);_0x529822['query']=_['keys'](_0x57df22['query']);_0x529822[_0x2a99('0x53')]=_['intersection'](_0x529822[_0x2a99('0x50')],_0x529822[_0x2a99('0x54')]);_0x20e4b7['attributes']=_[_0x2a99('0x55')](_0x529822['model'],qs[_0x2a99('0x56')](_0x57df22[_0x2a99('0x54')][_0x2a99('0x56')]));_0x20e4b7['attributes']=_0x20e4b7[_0x2a99('0x57')]['length']?_0x20e4b7['attributes']:_0x529822[_0x2a99('0x50')];if(!_0x57df22[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x20e4b7[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x57df22['query'][_0x2a99('0x32')]);_0x20e4b7[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x57df22[_0x2a99('0x54')]['offset']);}_0x20e4b7['order']=qs[_0x2a99('0x5a')](_0x57df22[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x20e4b7[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_['pick'](_0x57df22[_0x2a99('0x54')],_0x529822[_0x2a99('0x53')]),_0x1af68b);if(_0x57df22[_0x2a99('0x54')][_0x2a99('0x41')]){_0x20e4b7[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x20e4b7[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x1af68b,function(_0x525e61){if(_0x525e61['type']!==_0x2a99('0x5d')){return db[_0x2a99('0x5e')][_0x2a99('0x5b')](db[_0x2a99('0x5e')]['fn'](_0x2a99('0x5f'),db[_0x2a99('0x5e')][_0x2a99('0x60')](_0x525e61['name'])),{'$like':db[_0x2a99('0x5e')]['fn']('lower','%'+_0x57df22[_0x2a99('0x54')][_0x2a99('0x41')]+'%')});}})});}_0x20e4b7=_['merge']({},_0x20e4b7,_0x57df22[_0x2a99('0x61')]);var _0x50cb3d={'where':_0x20e4b7['where']};return db[_0x2a99('0x4b')]['count'](_0x50cb3d)[_0x2a99('0x24')](function(_0x5188e0){_0xa1dba5[_0x2a99('0x30')]=_0x5188e0;if(_0x57df22['query'][_0x2a99('0x62')]){_0x20e4b7[_0x2a99('0x63')]=[{'all':!![]}];}return db[_0x2a99('0x4b')][_0x2a99('0x64')](_0x20e4b7);})[_0x2a99('0x24')](function(_0x464b01){_0xa1dba5['rows']=_0x464b01;return _0xa1dba5;})[_0x2a99('0x24')](respondWithFilteredResult(_0x9d46e3,_0x20e4b7))[_0x2a99('0x65')](handleError(_0x9d46e3,null));};exports['show']=function(_0x4d4216,_0x529e8d){var _0x7fe1f={'raw':![],'where':{'id':_0x4d4216[_0x2a99('0x66')]['id']}},_0x51be38={};_0x51be38['model']=_[_0x2a99('0x67')](_[_0x2a99('0x68')](db[_0x2a99('0x4b')][_0x2a99('0x4c')]),[_0x2a99('0x51'),_0x2a99('0x52')]);_0x51be38['query']=_['keys'](_0x4d4216[_0x2a99('0x54')]);_0x51be38[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x51be38[_0x2a99('0x50')],_0x51be38['query']);_0x7fe1f[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x51be38[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x4d4216['query'][_0x2a99('0x56')]));_0x7fe1f[_0x2a99('0x57')]=_0x7fe1f[_0x2a99('0x57')][_0x2a99('0x69')]?_0x7fe1f[_0x2a99('0x57')]:_0x51be38[_0x2a99('0x50')];if(_0x4d4216['query'][_0x2a99('0x62')]){_0x7fe1f['include']=[{'all':!![]}];}_0x7fe1f=_[_0x2a99('0x5c')]({},_0x7fe1f,_0x4d4216[_0x2a99('0x61')]);return db[_0x2a99('0x4b')]['find'](_0x7fe1f)[_0x2a99('0x24')](handleEntityNotFound(_0x529e8d,null))[_0x2a99('0x24')](respondWithResult(_0x529e8d,null))[_0x2a99('0x65')](handleError(_0x529e8d,null));};exports['update']=function(_0x2526ed,_0x39fc69){if(_0x2526ed['body']['id']){delete _0x2526ed[_0x2a99('0x6a')]['id'];}delete _0x2526ed[_0x2a99('0x6a')][_0x2a99('0x3a')];return db[_0x2a99('0x4b')]['find']({'where':{'id':_0x2526ed[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x39fc69,null))[_0x2a99('0x24')](saveUpdates(_0x2526ed['body'],null))[_0x2a99('0x24')](respondWithResult(_0x39fc69,null))['catch'](handleError(_0x39fc69,null));};exports['describe']=function(_0x2a043e,_0x318b6f){return db['User'][_0x2a99('0x6b')]()[_0x2a99('0x24')](respondWithResult(_0x318b6f,null))['catch'](handleError(_0x318b6f,null));};exports[_0x2a99('0x6c')]=function(_0x2c7a62,_0x27c6c6,_0x1e2c1c){return db[_0x2a99('0x4b')]['find']({'where':{'id':_0x2c7a62[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x27c6c6,null))[_0x2a99('0x24')](function(_0x480bb3){if(_0x480bb3){return _0x480bb3[_0x2a99('0x6c')](_0x2c7a62[_0x2a99('0x6a')][_0x2a99('0x6d')],_[_0x2a99('0x6e')](_0x2c7a62[_0x2a99('0x6a')],['ids','id'])||{});}})[_0x2a99('0x24')](respondWithResult(_0x27c6c6,null))[_0x2a99('0x65')](handleError(_0x27c6c6,null));};function validateUser(_0x2df943){return new BPromise(function(_0x332327,_0x499356){if(_0x2df943[_0x2a99('0x6f')])return _0x332327(_0x2df943);return db['Setting'][_0x2a99('0x70')](0x1)[_0x2a99('0x24')](function(_0x4867e6){if(_0x4867e6[_0x2a99('0x71')])authService[_0x2a99('0x72')](_0x2df943[_0x2a99('0x51')]);db[_0x2a99('0x4b')][_0x2a99('0x73')](_0x2a99('0x6f'))[_0x2a99('0x24')](function(_0x4c61e0){if(_['isNil'](_0x4c61e0)){_0x2df943[_0x2a99('0x6f')]=_0x4867e6[_0x2a99('0x74')]||0x1;return;}if(_[_0x2a99('0x75')](_0x4867e6[_0x2a99('0x74')])||_0x4867e6[_0x2a99('0x74')]===_0x4c61e0){_0x2df943['internal']=_0x4c61e0+0x1;return;}if(_0x4867e6[_0x2a99('0x74')]>_0x4c61e0){_0x2df943[_0x2a99('0x6f')]=_0x4867e6[_0x2a99('0x74')];return;}return db['sequelize'][_0x2a99('0x54')](_0x2a99('0x76'),{'type':db[_0x2a99('0x5e')][_0x2a99('0x77')][_0x2a99('0x78')]})[_0x2a99('0x24')](function(_0x15f496){if(_0x15f496&&_0x15f496[_0x2a99('0x69')]){for(var _0x4a4478=0x0,_0x38b15e=_0x15f496[_0x2a99('0x69')];_0x4a4478<_0x38b15e&&_[_0x2a99('0x75')](_0x2df943[_0x2a99('0x6f')]);_0x4a4478++){if(_0x4867e6[_0x2a99('0x74')]<=_0x15f496[_0x4a4478][_0x2a99('0x79')]){_0x2df943[_0x2a99('0x6f')]=_0x15f496[_0x4a4478]['from'];}else if(_0x4867e6[_0x2a99('0x74')]>_0x15f496[_0x4a4478][_0x2a99('0x79')]&&_0x4867e6[_0x2a99('0x74')]<=_0x15f496[_0x4a4478]['to']){_0x2df943[_0x2a99('0x6f')]=_0x4867e6[_0x2a99('0x74')];}}}if(_[_0x2a99('0x75')](_0x2df943[_0x2a99('0x6f')])){_0x2df943[_0x2a99('0x6f')]=_0x4c61e0+0x1;}return _0x332327(_0x2df943);});});})[_0x2a99('0x65')](function(_0x2e1aea){_0x499356(_0x2e1aea);});});}function updateUser(_0x5f4ebb){return new BPromise(function(_0x2c6778,_0x158c26){try{if(_0x5f4ebb['voicemail']){_0x5f4ebb[_0x2a99('0x7a')]=_0x5f4ebb[_0x2a99('0x6f')];_0x5f4ebb['VoiceMail']={'mailbox':_0x5f4ebb['internal'],'password':_0x5f4ebb[_0x2a99('0x51')],'fullname':_0x5f4ebb[_0x2a99('0x7b')],'email':_0x5f4ebb[_0x2a99('0x7c')]};}if(_0x5f4ebb[_0x2a99('0x3a')]==='agent'){if(!_0x5f4ebb[_0x2a99('0x7d')])_0x5f4ebb['permissions']=[_0x2a99('0x7e'),_0x2a99('0x7f'),_0x2a99('0x80'),_0x2a99('0x81'),_0x2a99('0x82'),_0x2a99('0x83'),_0x2a99('0x84'),'106',_0x2a99('0x85'),_0x2a99('0x86'),_0x2a99('0x87'),_0x2a99('0x88'),_0x2a99('0x89'),_0x2a99('0x8a')];}_0x2c6778(_0x5f4ebb);}catch(_0x152f94){_0x158c26(_0x152f94);}});}exports[_0x2a99('0x8b')]=function(_0x2754de,_0x5aad22){if(_0x2754de[_0x2a99('0x8c')][_0x2a99('0x3a')]===_0x2a99('0x3e'))throw new Error(_0x2a99('0x8d'));if(_0x2754de[_0x2a99('0x6a')][_0x2a99('0x3a')]==='user'&&_0x2754de[_0x2a99('0x8c')]['role']!==_0x2a99('0x3b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2754de[_0x2a99('0x6a')][_0x2a99('0x3a')]===_0x2a99('0x3b')&&_0x2754de[_0x2a99('0x8c')]['role']!=='admin'){throw new Error(_0x2a99('0x8e'));}return licenseUtil[_0x2a99('0x8f')]([_0x2754de['body']])['then'](function(){return validateUser(_0x2754de['body']);})[_0x2a99('0x24')](function(_0x4baad9){return updateUser(_0x4baad9)[_0x2a99('0x24')](function(_0x4f90a1){if(_0x4f90a1[_0x2a99('0x3a')]===_0x2a99('0x3b')){_0x4f90a1[_0x2a99('0x90')]=_0x2754de[_0x2a99('0x8c')][_0x2a99('0x90')];delete _0x4f90a1[_0x2a99('0x91')];}return _0x4f90a1;});})['then'](function(_0x466370){return db[_0x2a99('0x4b')][_0x2a99('0x8b')](_0x466370,{'include':[{'model':db[_0x2a99('0x92')],'as':_0x2a99('0x92')}]});})[_0x2a99('0x24')](function(_0x58ca4d){if(_0x2754de['body'][_0x2a99('0x3a')]===_0x2a99('0x8c'))return _0x58ca4d;if(_0x2754de['user'][_0x2a99('0x3a')]!==_0x2a99('0x8c'))return _0x58ca4d;return db[_0x2a99('0x93')][_0x2a99('0x45')]({'where':{'name':_0x58ca4d[_0x2a99('0x3a')]===_0x2a99('0x3e')?_0x2a99('0x3d'):_0x2a99('0x3f'),'userProfileId':_0x2754de[_0x2a99('0x8c')][_0x2a99('0x91')]},'raw':!![]})[_0x2a99('0x24')](function(_0x21ac05){if(!_0x21ac05||_0x21ac05[_0x2a99('0x94')]!=0x0)return _0x58ca4d;return db['UserProfileResource'][_0x2a99('0x8b')]({'name':_0x58ca4d[_0x2a99('0x46')],'resourceId':_0x58ca4d['id'],'type':_0x21ac05['name'],'sectionId':_0x21ac05['id']},{})[_0x2a99('0x24')](function(){return _0x58ca4d;});})[_0x2a99('0x65')](function(_0x424cd5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x424cd5);throw _0x424cd5;});})[_0x2a99('0x24')](respondWithResult(_0x5aad22,0xc9))[_0x2a99('0x65')](handleError(_0x5aad22,null));};exports[_0x2a99('0x95')]=function(_0x1bc2a1,_0x1d613d){var _0x137249=_0x1bc2a1[_0x2a99('0x6a')];var _0x3d4381=[];if(_0x1bc2a1[_0x2a99('0x8c')][_0x2a99('0x3a')]==='agent')throw new Error('Unauthorized');if(_[_0x2a99('0x96')](_0x137249,[_0x2a99('0x3a'),_0x2a99('0x8c')])&&_0x1bc2a1[_0x2a99('0x8c')][_0x2a99('0x3a')]!==_0x2a99('0x3b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x137249,['role',_0x2a99('0x3b')])&&_0x1bc2a1[_0x2a99('0x8c')]['role']!==_0x2a99('0x3b')){throw new Error(_0x2a99('0x97'));}return licenseUtil[_0x2a99('0x8f')](_0x137249)[_0x2a99('0x24')](function(){return validateUser(_0x137249[0x0]);})[_0x2a99('0x24')](function(){for(var _0x1e63aa=0x1;_0x1e63aa<_0x137249['length'];_0x1e63aa++){var _0x4da9ce=_0x137249[_0x1e63aa-0x1][_0x2a99('0x6f')];if(!_0x137249[_0x1e63aa]['internal'])_0x137249[_0x1e63aa][_0x2a99('0x6f')]=_0x4da9ce+0x1;_0x3d4381[_0x2a99('0x98')](validateUser(_0x137249[_0x1e63aa]));}return BPromise[_0x2a99('0x99')](_0x3d4381);})[_0x2a99('0x24')](function(){_0x3d4381=[];for(var _0x341553=0x0;_0x341553<_0x137249[_0x2a99('0x69')];_0x341553++){_0x3d4381[_0x2a99('0x98')](updateUser(_0x137249[_0x341553]));}return BPromise['all'](_0x3d4381);})[_0x2a99('0x24')](function(){return BPromise[_0x2a99('0x9a')](_0x137249,function(_0x5c8f65){return db[_0x2a99('0x4b')][_0x2a99('0x8b')](_0x5c8f65,{'include':[{'model':db[_0x2a99('0x92')],'as':_0x2a99('0x92')}]})[_0x2a99('0x24')](function(_0x3e31f5){_0x5c8f65['id']=_0x3e31f5['id'];return _0x5c8f65;});});})['then'](function(_0x1469b6){if(_0x1bc2a1[_0x2a99('0x6a')][_0x2a99('0x3a')]==='user')return _0x1469b6;if(_0x1bc2a1['user'][_0x2a99('0x3a')]!==_0x2a99('0x8c'))return _0x1469b6;var _0x25f448=_['some'](_0x1469b6,function(_0xcbe054){return _0xcbe054[_0x2a99('0x3a')]==='agent'||_0xcbe054[_0x2a99('0x3a')]===_0x2a99('0x40');});if(!_0x25f448)return _0x1469b6;return db[_0x2a99('0x93')]['findAll']({'where':{'name':{'$or':['Agents',_0x2a99('0x3f')]},'userProfileId':_0x1bc2a1[_0x2a99('0x8c')]['userProfileId']},'raw':!![]})[_0x2a99('0x24')](function(_0x258682){if(_[_0x2a99('0x9b')](_0x258682)||!_[_0x2a99('0x96')](_0x258682,['autoAssociation',0x0]))return _0x1469b6;_0x3d4381=[];var _0x546281=_(_0x258682)[_0x2a99('0x43')](function(_0x312c54){if(_0x312c54[_0x2a99('0x94')]===0x1)return;return _0x312c54[_0x2a99('0x46')]==='Agents'?_0x2a99('0x3e'):_0x2a99('0x40');})['compact']()['value']();for(var _0x57c240=0x0;_0x57c240<_0x1469b6['length'];_0x57c240++){if(!_[_0x2a99('0x9c')](_0x546281,_0x1469b6[_0x57c240]['role']))return;var _0x3fba73=_0x1469b6[_0x57c240][_0x2a99('0x3a')]===_0x2a99('0x3e')?'Agents':_0x2a99('0x3f');_0x3d4381[_0x2a99('0x98')](db[_0x2a99('0x47')][_0x2a99('0x8b')]({'name':_0x1469b6[_0x57c240][_0x2a99('0x46')],'resourceId':_0x1469b6[_0x57c240]['id'],'type':_0x3fba73,'sectionId':_[_0x2a99('0x45')](_0x258682,[_0x2a99('0x46'),_0x3fba73])['id']},{}));}return BPromise[_0x2a99('0x99')](_0x3d4381);})['then'](respondWithResult(_0x1d613d,0xc9))['catch'](handleError(_0x1d613d,null));});};exports[_0x2a99('0x9d')]=function(_0x4e6a4c,_0x2cc9a4,_0x861497){if(_0x4e6a4c[_0x2a99('0x6a')]['id']){delete _0x4e6a4c[_0x2a99('0x6a')]['id'];}return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x4e6a4c['params']['id']}})[_0x2a99('0x24')](function(_0x4ff915){if(!_0x4ff915)return null;if(_0x4ff915['id']===_0x4e6a4c[_0x2a99('0x8c')]['id']){if(!_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9e')]||!_0x4e6a4c['body'][_0x2a99('0x9f')]){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xa2'));}if(!_0x4ff915[_0x2a99('0xa3')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9e')])){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xa4'));}if(_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9e')]===_0x4e6a4c['body']['newPassword']){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4e6a4c['user'][_0x2a99('0x3a')]==='admin'){if(!_0x4e6a4c['body'][_0x2a99('0x9f')]){throw new db['Sequelize'][(_0x2a99('0xa1'))](_0x2a99('0xa5'));}}else if(_0x4e6a4c[_0x2a99('0x8c')]['role']==='user'){if(!_0x4e6a4c[_0x2a99('0x6a')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x2a99('0xa5'));}if(_0x4ff915[_0x2a99('0x3a')]!==_0x2a99('0x3e')){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0x8d'));}}else{throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0x8d'));}return _0x4ff915;})[_0x2a99('0x24')](handleEntityNotFound(_0x2cc9a4,null))['then'](function(_0x3b8fd4){return db[_0x2a99('0xa6')]['findOne']({'attributes':['id',_0x2a99('0x71'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x2a99('0x24')](function(_0xfd4cdb){if(_0xfd4cdb['securePassword'])authService[_0x2a99('0x72')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9f')]);if(!_0xfd4cdb[_0x2a99('0xa7')]||!_0x3b8fd4[_0x2a99('0xa8')])return _0x3b8fd4;authService[_0x2a99('0xa9')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9f')],_0x3b8fd4[_0x2a99('0xa8')],_0xfd4cdb[_0x2a99('0xaa')]);return _0x3b8fd4;})[_0x2a99('0x24')](saveUpdates({'password':_0x4e6a4c['body'][_0x2a99('0x9f')],'passwordResetAt':_0x4e6a4c[_0x2a99('0x8c')]['id']==_0x4e6a4c[_0x2a99('0x66')]['id']?moment():null,'previousPasswords':authService[_0x2a99('0xab')](_0x4e6a4c[_0x2a99('0x6a')][_0x2a99('0x9f')],_0x3b8fd4[_0x2a99('0xa8')])},null));})['then'](respondWithResult(_0x2cc9a4,null))['catch'](handleError(_0x2cc9a4,null));};exports[_0x2a99('0xac')]=function(_0x585b6b,_0x2d0891,_0x1613b0){var _0x39ffa4=_0x585b6b[_0x2a99('0x6a')][_0x2a99('0xad')];return db['User']['find']({'where':{'id':_0x585b6b[_0x2a99('0x66')]['id']},'attributes':['id','name',_0x2a99('0x3a'),'online',_0x2a99('0xae'),_0x2a99('0xaf'),_0x2a99('0xb0')]})[_0x2a99('0x24')](handleEntityNotFound(_0x2d0891,null))[_0x2a99('0x24')](function(_0x3bac3b){if(_0x3bac3b){if(!utils['isValidChannel'](_0x39ffa4)){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}return _0x3bac3b[_0x2a99('0xb2')+_['capitalize'](_0x39ffa4[_0x2a99('0xb3')]())+_0x2a99('0xb4')](_0x585b6b[_0x2a99('0x6a')]['ids'],{'penalty':_0x585b6b['body'][_0x2a99('0xb5')]||0x0})[_0x2a99('0xb6')](function(_0x57ff3a){for(var _0x188dd8=0x0;_0x188dd8<_0x585b6b[_0x2a99('0x6a')][_0x2a99('0x6d')][_0x2a99('0x69')];_0x188dd8+=0x1){var _0x208954={'UserId':_0x585b6b[_0x2a99('0x66')]['id']};_0x208954[_['capitalize'](_0x39ffa4[_0x2a99('0xb3')]())+_0x2a99('0xb7')]=_0x585b6b[_0x2a99('0x6a')][_0x2a99('0x6d')][_0x188dd8];socket[_0x2a99('0xb8')](_0x2a99('0x8c')+_[_0x2a99('0xb9')](_0x39ffa4['toLowerCase']())+_0x2a99('0xba'),_0x208954);}return _0x57ff3a;})[_0x2a99('0x24')](function(){if(_0x39ffa4===_0x2a99('0xbb')){return db[_0x2a99('0xbc')][_0x2a99('0x64')]({'where':{'id':_0x585b6b[_0x2a99('0x6a')][_0x2a99('0x6d')]||[]},'raw':!![],'attributes':['id',_0x2a99('0x46')]});}})[_0x2a99('0x24')](function(_0x1073bb){var _0x2a4b8d=_0x3bac3b[_0x2a99('0x39')]({'plain':!![]});var _0x2acd16=[];if(_0x39ffa4==='voice'&&_0x2a4b8d[_0x2a99('0x3a')]==='agent'&&_0x2a4b8d[_0x2a99('0xbd')]){for(var _0x38dccc=0x0;_0x38dccc<_0x1073bb[_0x2a99('0x69')];_0x38dccc+=0x1){_0x2acd16[_0x2a99('0x98')]({'membername':_0x2a4b8d[_0x2a99('0x46')],'UserId':_0x2a4b8d['id'],'queue_name':_0x1073bb[_0x38dccc][_0x2a99('0x46')],'VoiceQueueId':_0x1073bb[_0x38dccc]['id'],'interface':_[_0x2a99('0x75')](_0x2a4b8d['interface'])?util[_0x2a99('0xbe')](_0x2a99('0xbf'),_0x2a4b8d['name']):_0x2a4b8d[_0x2a99('0xb0')],'paused':_0x2a4b8d[_0x2a99('0xaf')]||![],'penalty':_0x585b6b[_0x2a99('0x6a')][_0x2a99('0xb5')]||0x0});}return BPromise[_0x2a99('0x9a')](_0x2acd16,function(_0x3f0305){return db[_0x2a99('0xc0')][_0x2a99('0xc1')](_0x3f0305);});}return _0x3bac3b;});}})[_0x2a99('0x24')](respondWithStatusCode(_0x2d0891,null))[_0x2a99('0x65')](handleError(_0x2d0891,null));};exports[_0x2a99('0xc2')]=function(_0x2c05ff,_0x21bf23,_0x448932){var _0x5dc18f;return db['User'][_0x2a99('0x45')]({'where':{'id':_0x2c05ff[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a')]})[_0x2a99('0x24')](handleEntityNotFound(_0x21bf23,null))[_0x2a99('0x24')](function(_0x4afc2e){if(_0x4afc2e){_0x5dc18f=_0x4afc2e;if(!_0x2c05ff[_0x2a99('0x54')]['channel']||!utils[_0x2a99('0xc3')](_0x2c05ff[_0x2a99('0x54')][_0x2a99('0xad')])){throw new db['Sequelize'][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}return _0x4afc2e[_0x2a99('0xc4')+_[_0x2a99('0xb9')](_0x2c05ff[_0x2a99('0x54')]['channel'][_0x2a99('0xb3')]())+_0x2a99('0xb4')](_0x2c05ff[_0x2a99('0x54')][_0x2a99('0x6d')]);}})[_0x2a99('0x24')](function(_0x60f301){for(var _0xee0b9=0x0;_0xee0b9<_0x2c05ff[_0x2a99('0x54')][_0x2a99('0x6d')][_0x2a99('0x69')];_0xee0b9+=0x1){var _0x2e851f={'UserId':_0x2c05ff[_0x2a99('0x66')]['id']};_0x2e851f[_['capitalize'](_0x2c05ff['query']['channel'][_0x2a99('0xb3')]())+'QueueId']=_0x2c05ff['query']['ids'][_0xee0b9];socket['emit'](_0x2a99('0x8c')+_[_0x2a99('0xb9')](_0x2c05ff[_0x2a99('0x54')][_0x2a99('0xad')]['toLowerCase']())+_0x2a99('0xc5'),_0x2e851f);}return _0x60f301;})[_0x2a99('0x24')](function(){if(_0x2c05ff['query'][_0x2a99('0xad')]==='voice'){return db[_0x2a99('0xc0')]['destroy']({'where':{'UserId':_0x2c05ff['params']['id'],'VoiceQueueId':_0x2c05ff[_0x2a99('0x54')][_0x2a99('0x6d')]},'individualHooks':!![]})[_0x2a99('0x24')](function(){return _0x5dc18f;});}return _0x5dc18f;})['then'](respondWithStatusCode(_0x21bf23,null))[_0x2a99('0x65')](handleError(_0x21bf23,null));};exports[_0x2a99('0xc6')]=function(_0x380633,_0x805370,_0x1a30e4){_0x380633[_0x2a99('0x6a')][_0x2a99('0xc7')]=_0x380633[_0x2a99('0xc8')][_0x2a99('0xc9')];return db['User'][_0x2a99('0x45')]({'where':{'id':_0x380633[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x805370,null))['then'](saveUpdates(_0x380633[_0x2a99('0x6a')],null))[_0x2a99('0x24')](respondWithResult(_0x805370,null))[_0x2a99('0x65')](handleError(_0x805370,null));};exports[_0x2a99('0xca')]=function(_0x957bc7,_0x5b0d57,_0x595573){var _0x39d733=path[_0x2a99('0xcb')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x957bc7[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0xc7')],'raw':!![]})[_0x2a99('0x24')](handleEntityNotFound(_0x5b0d57,null))[_0x2a99('0x24')](function(_0x445fca){if(_0x445fca){if(_['isNil'](_0x445fca['userpic'])){return _0x5b0d57[_0x2a99('0xcc')](_0x39d733);}else{if(!fs[_0x2a99('0xcd')](path[_0x2a99('0xcb')](config[_0x2a99('0xce')],_0x2a99('0xcf'),_0x445fca[_0x2a99('0xc7')]))){return _0x5b0d57[_0x2a99('0xcc')](_0x39d733);}return _0x5b0d57['download'](path[_0x2a99('0xcb')](config[_0x2a99('0xce')],_0x2a99('0xcf'),_0x445fca['userpic']));}}})['catch'](handleError(_0x5b0d57,null));};exports[_0x2a99('0xd0')]=function(_0x29ec15,_0x57cee3,_0x7d457f){var _0x47bef1={};var _0x5776ee={};var _0x22f086;var _0x4418e3;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x29ec15['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x57cee3,null))[_0x2a99('0x24')](function(_0x42c0a4){if(_0x42c0a4){_0x22f086=_0x42c0a4;_0x5776ee[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xd2')][_0x2a99('0x4c')]);_0x5776ee[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x29ec15[_0x2a99('0x54')]);_0x5776ee[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x5776ee[_0x2a99('0x50')],_0x5776ee['query']);_0x47bef1['attributes']=_['intersection'](_0x5776ee[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x29ec15[_0x2a99('0x54')]['fields']));_0x47bef1[_0x2a99('0x57')]=_0x47bef1[_0x2a99('0x57')][_0x2a99('0x69')]?_0x47bef1['attributes']:_0x5776ee[_0x2a99('0x50')];_0x47bef1[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x29ec15[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x47bef1['where']=qs['filters'](_[_0x2a99('0xd4')](_0x29ec15[_0x2a99('0x54')],_0x5776ee[_0x2a99('0x53')]));if(_0x29ec15[_0x2a99('0x54')][_0x2a99('0x41')]){_0x47bef1[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x47bef1[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x47bef1[_0x2a99('0x57')],function(_0x1b8390){var _0xdd324={};_0xdd324[_0x1b8390]={'$like':'%'+_0x29ec15[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0xdd324;})});}_0x47bef1=_['merge']({},_0x47bef1,_0x29ec15['options']);return _0x22f086[_0x2a99('0xd0')](_0x47bef1);}})['then'](function(_0x521a93){if(_0x521a93){_0x4418e3=_0x521a93[_0x2a99('0x69')];if(_0x29ec15[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x62'))){_0x47bef1[_0x2a99('0x63')]=[{'model':db[_0x2a99('0xd5')],'as':_0x2a99('0xd6'),'required':![]},{'model':db['Tag'],'as':_0x2a99('0xd7'),'attributes':['id',_0x2a99('0x46'),_0x2a99('0xd8')],'where':_0x29ec15[_0x2a99('0x54')][_0x2a99('0xd9')]?{'id':_0x29ec15[_0x2a99('0x54')][_0x2a99('0xd9')]}:undefined,'required':_0x29ec15[_0x2a99('0x54')]['tag']?!![]:![]}];}if(!_0x29ec15[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x47bef1[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x29ec15[_0x2a99('0x54')][_0x2a99('0x32')]);_0x47bef1[_0x2a99('0x31')]=qs['offset'](_0x29ec15[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x22f086['getContacts'](_0x47bef1);}})[_0x2a99('0x24')](function(_0x33e2cb){if(_0x33e2cb){return _0x33e2cb?{'count':_0x4418e3,'rows':_0x33e2cb}:null;}})[_0x2a99('0x24')](respondWithResult(_0x57cee3,null))[_0x2a99('0x65')](handleError(_0x57cee3,null));};exports[_0x2a99('0xda')]=function(_0x44398f,_0x21b529,_0x25800f){var _0x1dca9e;var _0x226e77;var _0x2f489f={};var _0x1eed53;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x44398f[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a')]})[_0x2a99('0x24')](handleEntityNotFound(_0x21b529,null))['then'](function(_0x5142cd){if(!utils[_0x2a99('0xc3')](_0x44398f['query'][_0x2a99('0xad')])){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}_0x1dca9e=_0x5142cd;var _0x20ba77={};_0x20ba77['model']=_[_0x2a99('0x68')](db[_[_0x2a99('0xb9')](_0x44398f[_0x2a99('0x54')][_0x2a99('0xad')])+_0x2a99('0xdb')]['rawAttributes']);_0x20ba77[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x44398f[_0x2a99('0x54')]);_0x20ba77[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x20ba77[_0x2a99('0x50')],_0x20ba77['query']);_0x2f489f[_0x2a99('0x57')]=_['intersection'](_0x20ba77['model'],qs[_0x2a99('0x56')](_0x44398f[_0x2a99('0x54')][_0x2a99('0x56')]));_0x2f489f[_0x2a99('0x57')]=_0x2f489f[_0x2a99('0x57')][_0x2a99('0x69')]?_0x2f489f['attributes']:_0x20ba77[_0x2a99('0x50')];_0x2f489f[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x44398f[_0x2a99('0x54')]['sort']);_0x2f489f[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x44398f['query'],_0x20ba77[_0x2a99('0x53')]));if(_0x44398f['query'][_0x2a99('0x41')]){_0x2f489f[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x2f489f[_0x2a99('0x5b')],{'$or':_['map'](_0x2f489f[_0x2a99('0x57')],function(_0x1a3d57){var _0x183efe={};_0x183efe[_0x1a3d57]={'$like':'%'+_0x44398f[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x183efe;})});}_0x2f489f=_[_0x2a99('0x5c')]({},_0x2f489f,_0x44398f['options']);switch(_0x1dca9e[_0x2a99('0x3a')]){case _0x2a99('0x3b'):return db[_['capitalize'](_0x44398f[_0x2a99('0x54')][_0x2a99('0xad')])+_0x2a99('0xdb')]['findAll'](_0x2f489f);case _0x2a99('0x8c'):case'agent':return _0x1dca9e['get'+_[_0x2a99('0xb9')](_0x44398f['query'][_0x2a99('0xad')])+_0x2a99('0xb4')](_0x2f489f);default:throw new db[(_0x2a99('0xa0'))]['ValidationError'](_0x2a99('0xdc'));}})['then'](function(_0x3f92c9){_0x1eed53=_0x3f92c9[_0x2a99('0x69')];if(!_0x44398f[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x2f489f[_0x2a99('0x32')]=qs['limit'](_0x44398f['query']['limit']);_0x2f489f[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x44398f[_0x2a99('0x54')][_0x2a99('0x31')]);}switch(_0x1dca9e['role']){case _0x2a99('0x3b'):return db[_[_0x2a99('0xb9')](_0x44398f[_0x2a99('0x54')]['channel'])+_0x2a99('0xdb')][_0x2a99('0x64')](_0x2f489f);case _0x2a99('0x8c'):case _0x2a99('0x3e'):return _0x1dca9e['get'+_[_0x2a99('0xb9')](_0x44398f[_0x2a99('0x54')]['channel'])+_0x2a99('0xb4')](_0x2f489f);}})[_0x2a99('0x24')](function(_0x2ee24c){return{'count':_0x1eed53,'rows':_0x2ee24c};})[_0x2a99('0x24')](respondWithResult(_0x21b529,null))['catch'](handleError(_0x21b529,null));};exports[_0x2a99('0xdd')]=function(_0x1b41c4,_0xf12c3a,_0x52dcae){var _0x50ebfe={};var _0x28a6ba={};var _0x240a18;var _0x1be5cb;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x1b41c4[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0xf12c3a,null))[_0x2a99('0x24')](function(_0x34d235){if(_0x34d235){_0x240a18=_0x34d235;_0x28a6ba['model']=_['keys'](db[_0x2a99('0xc0')][_0x2a99('0x4c')]);_0x28a6ba[_0x2a99('0x54')]=_['keys'](_0x1b41c4[_0x2a99('0x54')]);_0x28a6ba[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x28a6ba[_0x2a99('0x50')],_0x28a6ba['query']);_0x50ebfe[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x28a6ba[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x56')]));_0x50ebfe[_0x2a99('0x57')]=_0x50ebfe[_0x2a99('0x57')][_0x2a99('0x69')]?_0x50ebfe['attributes']:_0x28a6ba[_0x2a99('0x50')];_0x50ebfe[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x50ebfe['where']=qs[_0x2a99('0x53')](_['pick'](_0x1b41c4[_0x2a99('0x54')],_0x28a6ba['filters']));if(_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x41')]){_0x50ebfe[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x50ebfe[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x50ebfe[_0x2a99('0x57')],function(_0x37db2e){var _0x4c981b={};_0x4c981b[_0x37db2e]={'$like':'%'+_0x1b41c4['query'][_0x2a99('0x41')]+'%'};return _0x4c981b;})});}_0x50ebfe=_[_0x2a99('0x5c')]({},_0x50ebfe,_0x1b41c4[_0x2a99('0x61')]);return _0x240a18[_0x2a99('0xdd')](_0x50ebfe);}})[_0x2a99('0x24')](function(_0x3e833b){if(_0x3e833b){_0x1be5cb=_0x3e833b[_0x2a99('0x69')];if(!_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x50ebfe['limit']=qs['limit'](_0x1b41c4[_0x2a99('0x54')][_0x2a99('0x32')]);_0x50ebfe['offset']=qs['offset'](_0x1b41c4[_0x2a99('0x54')]['offset']);}return _0x240a18[_0x2a99('0xdd')](_0x50ebfe);}})[_0x2a99('0x24')](function(_0x41fb14){if(_0x41fb14){return _0x41fb14?{'count':_0x1be5cb,'rows':_0x41fb14}:null;}})['then'](respondWithResult(_0xf12c3a,null))[_0x2a99('0x65')](handleError(_0xf12c3a,null));};exports[_0x2a99('0xde')]=function(_0x395a29,_0x1563bb,_0x16187a){var _0x5552a5={};var _0xf9eda5={};var _0x19816c;var _0x552206;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x395a29[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x1563bb,null))['then'](function(_0x2d9e2e){if(_0x2d9e2e){_0x19816c=_0x2d9e2e;_0xf9eda5['model']=_['keys'](db['ChatGroup']['rawAttributes']);_0xf9eda5[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x395a29[_0x2a99('0x54')]);_0xf9eda5[_0x2a99('0x53')]=_['intersection'](_0xf9eda5[_0x2a99('0x50')],_0xf9eda5[_0x2a99('0x54')]);_0x5552a5[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0xf9eda5[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x395a29[_0x2a99('0x54')]['fields']));_0x5552a5[_0x2a99('0x57')]=_0x5552a5[_0x2a99('0x57')][_0x2a99('0x69')]?_0x5552a5['attributes']:_0xf9eda5[_0x2a99('0x50')];_0x5552a5['order']=qs[_0x2a99('0x5a')](_0x395a29['query']['sort']);_0x5552a5[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x395a29[_0x2a99('0x54')],_0xf9eda5['filters']));if(_0x395a29['query'][_0x2a99('0x41')]){_0x5552a5[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x5552a5[_0x2a99('0x5b')],{'$or':_['map'](_0x5552a5['attributes'],function(_0x42adf6){var _0x12fb8e={};_0x12fb8e[_0x42adf6]={'$like':'%'+_0x395a29[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x12fb8e;})});}_0x5552a5=_['merge']({},_0x5552a5,_0x395a29[_0x2a99('0x61')]);return _0x19816c['getGroups'](_0x5552a5);}})['then'](function(_0x2a810c){if(_0x2a810c){_0x552206=_0x2a810c[_0x2a99('0x69')];if(!_0x395a29[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x5552a5[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x395a29[_0x2a99('0x54')][_0x2a99('0x32')]);_0x5552a5['offset']=qs[_0x2a99('0x31')](_0x395a29[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x19816c[_0x2a99('0xde')](_0x5552a5);}})[_0x2a99('0x24')](function(_0x59f918){if(_0x59f918){return _0x59f918?{'count':_0x552206,'rows':_0x59f918}:null;}})['then'](respondWithResult(_0x1563bb,null))[_0x2a99('0x65')](handleError(_0x1563bb,null));};exports[_0x2a99('0xdf')]=function(_0x24ff40,_0x1cbd05,_0x150092){var _0x1c4d74={'raw':!![],'where':{}};var _0x4d06a7={};var _0x4d7b63={'count':0x0,'rows':[]};return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x24ff40[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x1cbd05,null))[_0x2a99('0x24')](function(_0x31a9a0){if(_0x31a9a0){_0x4d06a7[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xe0')][_0x2a99('0x4c')]);_0x4d06a7[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x24ff40[_0x2a99('0x54')]);_0x4d06a7[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x4d06a7['model'],_0x4d06a7['query']);_0x1c4d74[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x4d06a7['model'],qs['fields'](_0x24ff40['query']['fields']));_0x1c4d74[_0x2a99('0x57')]=_0x1c4d74[_0x2a99('0x57')]['length']?_0x1c4d74[_0x2a99('0x57')]:_0x4d06a7[_0x2a99('0x50')];if(!_0x24ff40[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x1c4d74['limit']=qs['limit'](_0x24ff40['query'][_0x2a99('0x32')]);_0x1c4d74[_0x2a99('0x31')]=qs['offset'](_0x24ff40[_0x2a99('0x54')][_0x2a99('0x31')]);}_0x1c4d74['order']=qs[_0x2a99('0x5a')](_0x24ff40[_0x2a99('0x54')]['sort']);_0x1c4d74['where']=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x24ff40[_0x2a99('0x54')],_0x4d06a7[_0x2a99('0x53')]));_0x1c4d74[_0x2a99('0x5b')][_0x2a99('0xe1')]=_0x31a9a0['id'];if(_0x24ff40[_0x2a99('0x54')]['filter']){_0x1c4d74[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x1c4d74[_0x2a99('0x5b')],{'$or':_['map'](_0x1c4d74['attributes'],function(_0x3ab369){var _0x1ff52f={};_0x1ff52f[_0x3ab369]={'$like':'%'+_0x24ff40[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x1ff52f;})});}_0x1c4d74=_[_0x2a99('0x5c')]({},_0x1c4d74,_0x24ff40[_0x2a99('0x61')]);return db['VoiceRecording']['count']({'where':_0x1c4d74[_0x2a99('0x5b')]})[_0x2a99('0x24')](function(_0x4f81bf){_0x4d7b63['count']=_0x4f81bf;if(_0x24ff40[_0x2a99('0x54')]['includeAll']){_0x1c4d74[_0x2a99('0x63')]=[{'all':!![]}];}return db[_0x2a99('0xe0')][_0x2a99('0x64')](_0x1c4d74);})[_0x2a99('0x24')](function(_0x3fe4c3){_0x4d7b63['rows']=_0x3fe4c3;return _0x4d7b63;});}})[_0x2a99('0x24')](respondWithFilteredResult(_0x1cbd05,_0x1c4d74))[_0x2a99('0x65')](handleError(_0x1cbd05,null));};exports[_0x2a99('0xe2')]=function(_0x56504a,_0x4a7974,_0x4997a2){var _0x188f63={'raw':!![],'where':{}};var _0x12baa1={};var _0x481576={'count':0x0,'rows':[]};return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x56504a[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x4a7974,null))[_0x2a99('0x24')](function(_0x30397a){if(_0x30397a){_0x12baa1['model']=_[_0x2a99('0x68')](db[_0x2a99('0xe3')][_0x2a99('0x4c')]);_0x12baa1[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x56504a[_0x2a99('0x54')]);_0x12baa1[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x12baa1['model'],_0x12baa1[_0x2a99('0x54')]);_0x188f63['attributes']=_[_0x2a99('0x55')](_0x12baa1[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x56504a[_0x2a99('0x54')][_0x2a99('0x56')]));_0x188f63[_0x2a99('0x57')]=_0x188f63[_0x2a99('0x57')]['length']?_0x188f63[_0x2a99('0x57')]:_0x12baa1['model'];if(!_0x56504a[_0x2a99('0x54')]['hasOwnProperty'](_0x2a99('0x59'))){_0x188f63[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x56504a[_0x2a99('0x54')][_0x2a99('0x32')]);_0x188f63[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x56504a[_0x2a99('0x54')]['offset']);}_0x188f63['order']=qs[_0x2a99('0x5a')](_0x56504a['query'][_0x2a99('0x5a')]);_0x188f63[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x56504a[_0x2a99('0x54')],_0x12baa1[_0x2a99('0x53')]));_0x188f63['where']['UserId']=_0x30397a['id'];if(_0x56504a[_0x2a99('0x54')][_0x2a99('0x41')]){_0x188f63[_0x2a99('0x5b')]=_['merge'](_0x188f63['where'],{'$or':_[_0x2a99('0x43')](_0x188f63[_0x2a99('0x57')],function(_0xae51ed){var _0x4547bb={};_0x4547bb[_0xae51ed]={'$like':'%'+_0x56504a[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x4547bb;})});}_0x188f63=_[_0x2a99('0x5c')]({},_0x188f63,_0x56504a[_0x2a99('0x61')]);return db['ScreenRecording'][_0x2a99('0x30')]({'where':_0x188f63[_0x2a99('0x5b')]})[_0x2a99('0x24')](function(_0xab854c){_0x481576[_0x2a99('0x30')]=_0xab854c;if(_0x56504a[_0x2a99('0x54')][_0x2a99('0x62')]){_0x188f63[_0x2a99('0x63')]=[{'all':!![]}];}return db[_0x2a99('0xe3')][_0x2a99('0x64')](_0x188f63);})['then'](function(_0x415101){_0x481576[_0x2a99('0xe4')]=_0x415101;return _0x481576;});}})[_0x2a99('0x24')](respondWithFilteredResult(_0x4a7974,_0x188f63))[_0x2a99('0x65')](handleError(_0x4a7974,null));};exports[_0x2a99('0xe5')]=function(_0x1997b7,_0x39c9e8,_0x2b8311){var _0x29a9e9={};var _0x38353d={};var _0x181f8c;var _0x1fc731;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x1997b7['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x39c9e8,null))[_0x2a99('0x24')](function(_0x361a31){if(_0x361a31){_0x181f8c=_0x361a31;_0x38353d['model']=_['keys'](db[_0x2a99('0xe6')]['rawAttributes']);_0x38353d['query']=_[_0x2a99('0x68')](_0x1997b7[_0x2a99('0x54')]);_0x38353d[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x38353d['model'],_0x38353d['query']);_0x29a9e9['attributes']=_[_0x2a99('0x55')](_0x38353d[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x1997b7['query'][_0x2a99('0x56')]));_0x29a9e9[_0x2a99('0x57')]=_0x29a9e9[_0x2a99('0x57')]['length']?_0x29a9e9['attributes']:_0x38353d[_0x2a99('0x50')];_0x29a9e9['order']=qs['sort'](_0x1997b7[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x29a9e9[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x1997b7[_0x2a99('0x54')],_0x38353d[_0x2a99('0x53')]));if(_0x1997b7[_0x2a99('0x54')][_0x2a99('0x41')]){_0x29a9e9[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x29a9e9[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x29a9e9[_0x2a99('0x57')],function(_0x11ab7e){var _0x363908={};_0x363908[_0x11ab7e]={'$like':'%'+_0x1997b7[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x363908;})});}_0x29a9e9=_[_0x2a99('0x5c')]({},_0x29a9e9,_0x1997b7[_0x2a99('0x61')]);return _0x181f8c['getChatInteractions'](_0x29a9e9);}})[_0x2a99('0x24')](function(_0x409f41){if(_0x409f41){_0x1fc731=_0x409f41['length'];if(!_0x1997b7[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x29a9e9['limit']=qs[_0x2a99('0x32')](_0x1997b7['query'][_0x2a99('0x32')]);_0x29a9e9[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x1997b7[_0x2a99('0x54')]['offset']);}return _0x181f8c[_0x2a99('0xe5')](_0x29a9e9);}})[_0x2a99('0x24')](function(_0x255ed8){if(_0x255ed8){return _0x255ed8?{'count':_0x1fc731,'rows':_0x255ed8}:null;}})['then'](respondWithResult(_0x39c9e8,null))[_0x2a99('0x65')](handleError(_0x39c9e8,null));};exports[_0x2a99('0xe7')]=function(_0x2a9564,_0x34d72d,_0x4bb73d){var _0x25cc70={};var _0xef2ce5={};var _0x39e4b7;var _0xc6afc3;return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x2a9564[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x34d72d,null))[_0x2a99('0x24')](function(_0x254e82){if(_0x254e82){_0x39e4b7=_0x254e82;_0xef2ce5['model']=_[_0x2a99('0x68')](db[_0x2a99('0xe8')][_0x2a99('0x4c')]);_0xef2ce5[_0x2a99('0x54')]=_['keys'](_0x2a9564['query']);_0xef2ce5[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0xef2ce5[_0x2a99('0x50')],_0xef2ce5['query']);_0x25cc70[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0xef2ce5['model'],qs[_0x2a99('0x56')](_0x2a9564[_0x2a99('0x54')]['fields']));_0x25cc70[_0x2a99('0x57')]=_0x25cc70['attributes'][_0x2a99('0x69')]?_0x25cc70[_0x2a99('0x57')]:_0xef2ce5['model'];_0x25cc70['order']=qs[_0x2a99('0x5a')](_0x2a9564[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x25cc70[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x2a9564[_0x2a99('0x54')],_0xef2ce5[_0x2a99('0x53')]));if(_0x2a9564['query']['filter']){_0x25cc70[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x25cc70['where'],{'$or':_['map'](_0x25cc70[_0x2a99('0x57')],function(_0x5a4940){var _0x1a1283={};_0x1a1283[_0x5a4940]={'$like':'%'+_0x2a9564['query'][_0x2a99('0x41')]+'%'};return _0x1a1283;})});}_0x25cc70=_['merge']({},_0x25cc70,_0x2a9564[_0x2a99('0x61')]);return _0x39e4b7[_0x2a99('0xe7')](_0x25cc70);}})[_0x2a99('0x24')](function(_0x11624e){if(_0x11624e){_0xc6afc3=_0x11624e[_0x2a99('0x69')];if(!_0x2a9564[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x25cc70[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x2a9564[_0x2a99('0x54')][_0x2a99('0x32')]);_0x25cc70[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x2a9564[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x39e4b7[_0x2a99('0xe7')](_0x25cc70);}})[_0x2a99('0x24')](function(_0x3505f4){if(_0x3505f4){return _0x3505f4?{'count':_0xc6afc3,'rows':_0x3505f4}:null;}})[_0x2a99('0x24')](respondWithResult(_0x34d72d,null))[_0x2a99('0x65')](handleError(_0x34d72d,null));};exports[_0x2a99('0xe9')]=function(_0x4498fe,_0x5b8e9f,_0x5e9c59){var _0x239910={'raw':!![],'where':{}};var _0x4a965d={};var _0x196a8e={'count':0x0,'rows':[]};return db['User'][_0x2a99('0xd1')]({'where':{'id':_0x4498fe[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x5b8e9f,null))[_0x2a99('0x24')](function(_0x3b1a10){if(_0x3b1a10){_0x4a965d[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xea')][_0x2a99('0x4c')]);_0x4a965d[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x4498fe[_0x2a99('0x54')]);_0x4a965d[_0x2a99('0x53')]=_['intersection'](_0x4a965d[_0x2a99('0x50')],_0x4a965d[_0x2a99('0x54')]);_0x239910[_0x2a99('0x57')]=_['intersection'](_0x4a965d[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x4498fe[_0x2a99('0x54')][_0x2a99('0x56')]));_0x239910[_0x2a99('0x57')]=_0x239910[_0x2a99('0x57')][_0x2a99('0x69')]?_0x239910[_0x2a99('0x57')]:_0x4a965d['model'];if(!_0x4498fe[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x239910[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x4498fe[_0x2a99('0x54')][_0x2a99('0x32')]);_0x239910[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x4498fe[_0x2a99('0x54')]['offset']);}_0x239910[_0x2a99('0xd3')]=qs['sort'](_0x4498fe['query'][_0x2a99('0x5a')]);_0x239910[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x4498fe[_0x2a99('0x54')],_0x4a965d[_0x2a99('0x53')]));_0x239910['where'][_0x2a99('0xe1')]=_0x3b1a10['id'];if(_0x4498fe[_0x2a99('0x54')][_0x2a99('0x41')]){_0x239910[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x239910[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x239910[_0x2a99('0x57')],function(_0x32b2fe){var _0xc45bd6={};_0xc45bd6[_0x32b2fe]={'$like':'%'+_0x4498fe[_0x2a99('0x54')]['filter']+'%'};return _0xc45bd6;})});}_0x239910=_['merge']({},_0x239910,_0x4498fe[_0x2a99('0x61')]);return db['MailInteraction'][_0x2a99('0x30')]({'where':_0x239910[_0x2a99('0x5b')]})['then'](function(_0x3cb7c3){_0x196a8e[_0x2a99('0x30')]=_0x3cb7c3;if(_0x4498fe[_0x2a99('0x54')]['includeAll']){_0x239910['include']=[{'all':!![]}];}return db[_0x2a99('0xea')][_0x2a99('0x64')](_0x239910);})[_0x2a99('0x24')](function(_0x3c8b16){_0x196a8e[_0x2a99('0xe4')]=_0x3c8b16;return _0x196a8e;});}})['then'](respondWithFilteredResult(_0x5b8e9f,_0x239910))[_0x2a99('0x65')](handleError(_0x5b8e9f,null));};exports[_0x2a99('0xeb')]=function(_0xba9f,_0x240c74,_0x2f271e){var _0x3cbb9b={};var _0x49458f={};var _0x356b69;var _0x40abfe;return db['User']['findOne']({'where':{'id':_0xba9f[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x240c74,null))[_0x2a99('0x24')](function(_0x28333b){if(_0x28333b){_0x356b69=_0x28333b;_0x49458f[_0x2a99('0x50')]=_[_0x2a99('0x68')](db[_0x2a99('0xec')][_0x2a99('0x4c')]);_0x49458f[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0xba9f['query']);_0x49458f[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x49458f[_0x2a99('0x50')],_0x49458f[_0x2a99('0x54')]);_0x3cbb9b[_0x2a99('0x57')]=_['intersection'](_0x49458f[_0x2a99('0x50')],qs['fields'](_0xba9f['query']['fields']));_0x3cbb9b['attributes']=_0x3cbb9b[_0x2a99('0x57')][_0x2a99('0x69')]?_0x3cbb9b[_0x2a99('0x57')]:_0x49458f['model'];_0x3cbb9b[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0xba9f['query'][_0x2a99('0x5a')]);_0x3cbb9b['where']=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0xba9f[_0x2a99('0x54')],_0x49458f[_0x2a99('0x53')]));if(_0xba9f[_0x2a99('0x54')]['filter']){_0x3cbb9b[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x3cbb9b[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x3cbb9b['attributes'],function(_0x521943){var _0x1d23a4={};_0x1d23a4[_0x521943]={'$like':'%'+_0xba9f[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x1d23a4;})});}_0x3cbb9b=_[_0x2a99('0x5c')]({},_0x3cbb9b,_0xba9f[_0x2a99('0x61')]);return _0x356b69['getSmsInteractions'](_0x3cbb9b);}})[_0x2a99('0x24')](function(_0x266a65){if(_0x266a65){_0x40abfe=_0x266a65['length'];if(!_0xba9f[_0x2a99('0x54')]['hasOwnProperty'](_0x2a99('0x59'))){_0x3cbb9b[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0xba9f['query']['limit']);_0x3cbb9b[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0xba9f[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x356b69[_0x2a99('0xeb')](_0x3cbb9b);}})[_0x2a99('0x24')](function(_0x5a3647){if(_0x5a3647){return _0x5a3647?{'count':_0x40abfe,'rows':_0x5a3647}:null;}})[_0x2a99('0x24')](respondWithResult(_0x240c74,null))[_0x2a99('0x65')](handleError(_0x240c74,null));};exports[_0x2a99('0xed')]=function(_0x56eac9,_0x55ad96,_0x44d26f){var _0x2b5449={};var _0x2e842d={};var _0x5bfc0f;var _0x51d356;return db['User']['findOne']({'where':{'id':_0x56eac9['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x55ad96,null))[_0x2a99('0x24')](function(_0x3de53f){if(_0x3de53f){_0x5bfc0f=_0x3de53f;_0x2e842d[_0x2a99('0x50')]=_['keys'](db[_0x2a99('0xee')][_0x2a99('0x4c')]);_0x2e842d[_0x2a99('0x54')]=_[_0x2a99('0x68')](_0x56eac9[_0x2a99('0x54')]);_0x2e842d[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x2e842d[_0x2a99('0x50')],_0x2e842d[_0x2a99('0x54')]);_0x2b5449[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x2e842d[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x56eac9['query']['fields']));_0x2b5449[_0x2a99('0x57')]=_0x2b5449[_0x2a99('0x57')][_0x2a99('0x69')]?_0x2b5449[_0x2a99('0x57')]:_0x2e842d[_0x2a99('0x50')];_0x2b5449[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x56eac9[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x2b5449[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x56eac9[_0x2a99('0x54')],_0x2e842d[_0x2a99('0x53')]));if(_0x56eac9[_0x2a99('0x54')][_0x2a99('0x41')]){_0x2b5449[_0x2a99('0x5b')]=_['merge'](_0x2b5449['where'],{'$or':_[_0x2a99('0x43')](_0x2b5449['attributes'],function(_0x5ed6b8){var _0x2f851d={};_0x2f851d[_0x5ed6b8]={'$like':'%'+_0x56eac9[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x2f851d;})});}_0x2b5449=_['merge']({},_0x2b5449,_0x56eac9[_0x2a99('0x61')]);return _0x5bfc0f['getFaxInteractions'](_0x2b5449);}})[_0x2a99('0x24')](function(_0x2ba6e3){if(_0x2ba6e3){_0x51d356=_0x2ba6e3['length'];if(!_0x56eac9['query'][_0x2a99('0x58')](_0x2a99('0x59'))){_0x2b5449[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x56eac9['query'][_0x2a99('0x32')]);_0x2b5449[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x56eac9[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x5bfc0f[_0x2a99('0xed')](_0x2b5449);}})['then'](function(_0x32113e){if(_0x32113e){return _0x32113e?{'count':_0x51d356,'rows':_0x32113e}:null;}})[_0x2a99('0x24')](respondWithResult(_0x55ad96,null))['catch'](handleError(_0x55ad96,null));};exports[_0x2a99('0xef')]=function(_0x1ba918,_0x42e524,_0x3e0060){var _0x21eca0={};var _0x497a67={};var _0x81ef03;var _0xd1be8e;return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x1ba918[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x42e524,null))[_0x2a99('0x24')](function(_0x3aae0e){if(_0x3aae0e){_0x81ef03=_0x3aae0e;_0x497a67[_0x2a99('0x50')]=_[_0x2a99('0x68')](db['WhatsappInteraction']['rawAttributes']);_0x497a67[_0x2a99('0x54')]=_['keys'](_0x1ba918['query']);_0x497a67[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x497a67['model'],_0x497a67[_0x2a99('0x54')]);_0x21eca0[_0x2a99('0x57')]=_['intersection'](_0x497a67[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x1ba918['query'][_0x2a99('0x56')]));_0x21eca0[_0x2a99('0x57')]=_0x21eca0[_0x2a99('0x57')][_0x2a99('0x69')]?_0x21eca0[_0x2a99('0x57')]:_0x497a67[_0x2a99('0x50')];_0x21eca0[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x1ba918[_0x2a99('0x54')]['sort']);_0x21eca0[_0x2a99('0x5b')]=qs['filters'](_[_0x2a99('0xd4')](_0x1ba918[_0x2a99('0x54')],_0x497a67['filters']));if(_0x1ba918['query'][_0x2a99('0x41')]){_0x21eca0[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x21eca0[_0x2a99('0x5b')],{'$or':_['map'](_0x21eca0[_0x2a99('0x57')],function(_0x2d9e84){var _0x43d901={};_0x43d901[_0x2d9e84]={'$like':'%'+_0x1ba918[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x43d901;})});}_0x21eca0=_[_0x2a99('0x5c')]({},_0x21eca0,_0x1ba918[_0x2a99('0x61')]);return _0x81ef03[_0x2a99('0xef')](_0x21eca0);}})['then'](function(_0x10749c){if(_0x10749c){_0xd1be8e=_0x10749c[_0x2a99('0x69')];if(!_0x1ba918[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x21eca0['limit']=qs['limit'](_0x1ba918[_0x2a99('0x54')][_0x2a99('0x32')]);_0x21eca0[_0x2a99('0x31')]=qs['offset'](_0x1ba918['query']['offset']);}return _0x81ef03[_0x2a99('0xef')](_0x21eca0);}})[_0x2a99('0x24')](function(_0x54215d){if(_0x54215d){return _0x54215d?{'count':_0xd1be8e,'rows':_0x54215d}:null;}})['then'](respondWithResult(_0x42e524,null))['catch'](handleError(_0x42e524,null));};exports[_0x2a99('0xf0')]=function(_0x3d6725,_0x350c23,_0x3f21cc){var _0x1b17cb;var _0x418208;var _0x52374b;var _0x5a04cd=!_[_0x2a99('0x75')](_0x3d6725['params']['id'])?_0x3d6725[_0x2a99('0x66')]['id']:!_['isNil'](_0x3d6725['user']['id'])?_0x3d6725['user']['id']:null;return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x5a04cd,'role':{'$or':[_0x2a99('0x3b'),_0x2a99('0x8c'),_0x2a99('0x3e')]}},'attributes':['id',_0x2a99('0x46'),_0x2a99('0xf1'),'mobile',_0x2a99('0x3a'),_0x2a99('0x6f'),'loginInPause']})[_0x2a99('0x24')](function(_0x428a77){if(_0x428a77){if(_0x428a77[_0x2a99('0x3a')]==='agent'){_0x1b17cb=_0x428a77;if(_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xb0')]){_0x52374b=util['format'](_0x2a99('0xf2'),_0x1b17cb[_0x3d6725[_0x2a99('0x6a')]['interface']]);}else if(_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xf3')]){_0x52374b=util[_0x2a99('0xbe')](_0x2a99('0xbf'),_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xf3')]);}else{_0x52374b=util[_0x2a99('0xbe')]('SIP/%s',_0x1b17cb['name']);}socket['to'](util[_0x2a99('0xbe')](_0x2a99('0xf4'),_0x1b17cb[_0x2a99('0x46')]))[_0x2a99('0xb8')](_0x2a99('0xf5'),{'ip':_0x3d6725[_0x2a99('0xf6')]['x-forwarded-for']||_0x3d6725['connection'][_0x2a99('0xf7')]||_0x3d6725[_0x2a99('0xf8')][_0x2a99('0xf7')]||_0x3d6725[_0x2a99('0xf9')]['socket'][_0x2a99('0xf7')]});return db[_0x2a99('0xc0')][_0x2a99('0x38')]({'where':{'membername':_0x1b17cb[_0x2a99('0x46')]},'individualHooks':!![]});}}else{throw new db[(_0x2a99('0xa0'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2a99('0x24')](function(){if(_0x1b17cb){return _0x1b17cb[_0x2a99('0xfa')]({'raw':!![]});}})['then'](function(_0x5d7b4e){if(_0x1b17cb){var _0x3cf40f=[];if(_0x5d7b4e){_0x418208=_0x5d7b4e;if(_0x418208[_0x2a99('0x69')]){for(var _0x851c75=0x0;_0x851c75<_0x418208[_0x2a99('0x69')];_0x851c75++){_0x3cf40f[_0x2a99('0x98')]({'membername':_0x1b17cb['name'],'UserId':_0x1b17cb['id'],'queue_name':_0x418208[_0x851c75][_0x2a99('0x46')],'VoiceQueueId':_0x418208[_0x851c75]['id'],'interface':_0x52374b,'paused':_0x1b17cb[_0x2a99('0xae')]||![],'penalty':_0x418208[_0x851c75][_0x2a99('0xfb')]||0x0});}return BPromise[_0x2a99('0x9a')](_0x3cf40f,function(_0x37d448){return db['UserVoiceQueueRt'][_0x2a99('0xc1')](_0x37d448);});}}}})[_0x2a99('0x24')](function(){if(_0x1b17cb){return db['MemberReport'][_0x2a99('0x64')]({'where':{'membername':_0x1b17cb[_0x2a99('0x46')],'exitAt':null}});}})[_0x2a99('0x24')](function(_0xbb9cab){if(_0x1b17cb){var _0x2586fd=[];_0xbb9cab[_0x2a99('0xfc')](function(_0x41e8aa){_0x2586fd[_0x2a99('0x98')](_0x41e8aa[_0x2a99('0xfd')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2a99('0x99')](_0x2586fd);}})[_0x2a99('0x24')](function(){if(_0x1b17cb){var _0x205627=[];var _0xec2c10=[];var _0x1e5cef=utils['getChannels']();var _0x4c0c35={'membername':_0x1b17cb[_0x2a99('0x46')],'interface':_0x52374b,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1b17cb[_0x2a99('0x3a')],'internal':_0x1b17cb[_0x2a99('0x6f')]};_0x1e5cef[_0x2a99('0xfc')](function(_0x2bcc89){_0x205627['push'](_[_0x2a99('0x5c')]({'channel':_0x2bcc89,'type':_0x2a99('0xfe'),'data1':_0x3d6725[_0x2a99('0x6a')][_0x2a99('0xff')],'data2':_0x52374b},_0x4c0c35));if(_0x1b17cb[_0x2a99('0xae')]){_0xec2c10[_0x2a99('0x98')](_['merge']({'channel':_0x2bcc89,'type':_0x2a99('0x100'),'data1':'LOGININPAUSE'},_0x4c0c35));}});return db[_0x2a99('0x101')][_0x2a99('0x95')](_0x205627['concat'](_0xec2c10),{'individualHooks':!![]});}})[_0x2a99('0x24')](function(){if(_0x1b17cb){return _0x1b17cb[_0x2a99('0xfd')]({'online':!![],'lastLoginAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102')),'voicePause':_0x1b17cb[_0x2a99('0xae')]||![],'mailPause':_0x1b17cb['loginInPause']||![],'chatPause':_0x1b17cb['loginInPause']||![],'faxPause':_0x1b17cb[_0x2a99('0xae')]||![],'smsPause':_0x1b17cb[_0x2a99('0xae')]||![],'openchannelPause':_0x1b17cb[_0x2a99('0xae')]||![],'whatsappPause':_0x1b17cb[_0x2a99('0xae')]||![],'pauseType':_0x1b17cb[_0x2a99('0xae')]?_0x2a99('0x103'):null,'interface':_0x52374b,'lastPauseAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102'))});}})[_0x2a99('0x24')](function(_0x20aa4c){if(_0x3d6725['isMiddleware']){return _0x3f21cc();}else{return BPromise[_0x2a99('0x104')](_0x20aa4c)['then'](respondWithResult(_0x350c23,null));}})[_0x2a99('0x65')](handleError(_0x350c23,null));};exports['logout']=function(_0x1da883,_0xc046b2,_0x19d148){var _0x3ef3ed;return db['User'][_0x2a99('0x45')]({'where':{'id':_0x1da883['params']['id'],'role':_0x2a99('0x3e')},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a')]})[_0x2a99('0x24')](handleEntityNotFound(_0xc046b2,null))['then'](function(_0xb93bbf){if(_0xb93bbf){_0x3ef3ed=_0xb93bbf;return db[_0x2a99('0xc0')][_0x2a99('0x38')]({'where':{'membername':_0x3ef3ed[_0x2a99('0x46')]},'individualHooks':!![]});}})[_0x2a99('0x24')](function(){return db[_0x2a99('0x101')][_0x2a99('0x64')]({'where':{'membername':_0x3ef3ed[_0x2a99('0x46')],'exitAt':null}});})[_0x2a99('0x24')](function(_0x3f8ec5){var _0x38f179=[];_0x3f8ec5[_0x2a99('0xfc')](function(_0x588fc3){_0x38f179[_0x2a99('0x98')](_0x588fc3['update']({'exitAt':moment()[_0x2a99('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2a99('0x99')](_0x38f179);})[_0x2a99('0x24')](function(){return _0x3ef3ed[_0x2a99('0xfd')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xc046b2,null))[_0x2a99('0x65')](handleError(_0xc046b2,null));};exports['pause']=function(_0x19f14e,_0xb18456,_0x107166){var _0x386ad6;return db['UserVoiceQueueRt'][_0x2a99('0xfd')]({'paused':0x1},{'where':{'UserId':_0x19f14e['params']['id']},'individualHooks':!![]})[_0x2a99('0x24')](function(){return db['User'][_0x2a99('0x45')]({'where':{'id':_0x19f14e[_0x2a99('0x66')]['id'],'role':_0x2a99('0x3e')},'attributes':['id',_0x2a99('0x46'),_0x2a99('0x3a'),'internal',_0x2a99('0xb0')]});})['then'](handleEntityNotFound(_0xb18456,null))[_0x2a99('0x24')](function(_0x4578da){if(_0x4578da){_0x386ad6=_0x4578da;return respondWithRpcPromise(_0x2a99('0x105'),_0x2a99('0x106'),{'id':_0x386ad6['id'],'name':_0x386ad6[_0x2a99('0x46')],'pause':!![]});}})[_0x2a99('0x24')](function(){if(_0x386ad6){return db[_0x2a99('0x101')][_0x2a99('0x64')]({'where':{'membername':_0x386ad6[_0x2a99('0x46')],'type':_0x2a99('0x100'),'exitAt':null}});}})['then'](function(_0x45c26f){if(_0x45c26f[_0x2a99('0x69')]){var _0x43840c=moment()['format'](_0x2a99('0x102'));for(var _0x130864=0x0,_0x160155=_0x45c26f[_0x2a99('0x69')];_0x130864<_0x160155;_0x130864++){_0x45c26f[_0x130864][_0x2a99('0x107')]({'exitAt':_0x43840c});}}})['then'](function(){var _0x357e5c=[];var _0x3fb3ac=utils[_0x2a99('0x108')]();_0x3fb3ac[_0x2a99('0xfc')](function(_0x1e9af5){_0x357e5c[_0x2a99('0x98')]({'channel':_0x1e9af5,'membername':_0x386ad6['name'],'interface':_['isNil'](_0x386ad6[_0x2a99('0xb0')])?util['format'](_0x2a99('0xbf'),_0x386ad6[_0x2a99('0x46')]):_0x386ad6['interface'],'type':_0x2a99('0x100'),'enterAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102')),'data1':_0x19f14e[_0x2a99('0x6a')]['type']||_0x2a99('0x109'),'role':_0x386ad6[_0x2a99('0x3a')],'internal':_0x386ad6[_0x2a99('0x6f')]});});return db[_0x2a99('0x101')][_0x2a99('0x95')](_0x357e5c,{'individualHooks':!![]});})[_0x2a99('0x24')](function(){return _0x386ad6['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x19f14e[_0x2a99('0x6a')][_0x2a99('0x4e')]||_0x2a99('0x109'),'lastPauseAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102'))});})[_0x2a99('0x24')](respondWithResult(_0xb18456,null))[_0x2a99('0x65')](handleError(_0xb18456,null));};exports[_0x2a99('0x10a')]=function(_0x25e282,_0x57898d,_0xb2f754){var _0x440075;return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x25e282[_0x2a99('0x66')]['id']},'attributes':['id',_0x2a99('0x46'),'role','voicePause','mailPause',_0x2a99('0x10b'),_0x2a99('0x10c'),_0x2a99('0x10d'),'smsPause',_0x2a99('0x10e'),_0x2a99('0x10f'),_0x2a99('0x110')]})[_0x2a99('0x24')](handleEntityNotFound(_0x57898d,null))[_0x2a99('0x24')](function(_0x3c60fc){if(_0x3c60fc){_0x440075=_0x3c60fc;if(_0x25e282[_0x2a99('0x6a')][_0x2a99('0xad')]&&!utils[_0x2a99('0xc3')](_0x25e282[_0x2a99('0x6a')]['channel'])){throw new db[(_0x2a99('0xa0'))][(_0x2a99('0xa1'))](_0x2a99('0xb1'));}switch(_0x25e282[_0x2a99('0x6a')][_0x2a99('0xad')]){case _0x2a99('0xbb'):return respondWithRpcPromise('QueuePause',_0x2a99('0x10a'),{'id':_0x440075['id'],'name':_0x440075['name'],'pause':![]})[_0x2a99('0x24')](function(){return db[_0x2a99('0xc0')]['update']({'paused':0x0},{'where':{'UserId':_0x440075['id']},'individualHooks':!![]});})[_0x2a99('0x24')](function(){return db['MemberReport'][_0x2a99('0x45')]({'where':{'channel':_0x25e282['body']['channel'],'membername':_0x440075['name'],'type':_0x2a99('0x100'),'exitAt':null}});})['then'](function(_0x201cb4){if(_0x201cb4){return _0x201cb4[_0x2a99('0xfd')]({'exitAt':moment()[_0x2a99('0xbe')](_0x2a99('0x102')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x440075[_0x2a99('0xfd')]({'voicePause':![]});});case _0x2a99('0x111'):case'chat':case _0x2a99('0x112'):case _0x2a99('0x113'):case _0x2a99('0x114'):case _0x2a99('0x115'):return db[_0x2a99('0x101')][_0x2a99('0x45')]({'where':{'channel':_0x25e282[_0x2a99('0x6a')]['channel'],'membername':_0x440075[_0x2a99('0x46')],'type':_0x2a99('0x100'),'exitAt':null}})[_0x2a99('0x24')](function(_0x2dba6c){if(_0x2dba6c){return _0x2dba6c['update']({'exitAt':moment()[_0x2a99('0xbe')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x2a99('0x116')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x49db6f={};_[_0x2a99('0x33')](_0x49db6f,util[_0x2a99('0xbe')](_0x2a99('0x117'),_0x25e282[_0x2a99('0x6a')]['channel'],_0x2a99('0x118')),![]);return _0x440075['update'](_0x49db6f);});default:return respondWithRpcPromise(_0x2a99('0x105'),'unpause',{'id':_0x440075['id'],'name':_0x440075[_0x2a99('0x46')],'pause':![]})[_0x2a99('0x24')](function(){return db[_0x2a99('0xc0')]['update']({'paused':0x0},{'where':{'UserId':_0x440075['id']}});})[_0x2a99('0x24')](function(){return db[_0x2a99('0x101')][_0x2a99('0x64')]({'where':{'membername':_0x440075[_0x2a99('0x46')],'type':_0x2a99('0x100'),'exitAt':null}});})[_0x2a99('0x24')](function(_0x1415f1){var _0x35425b=[];_0x1415f1[_0x2a99('0xfc')](function(_0x2613e7){_0x35425b['push'](_0x2613e7[_0x2a99('0xfd')]({'exitAt':moment()['format'](_0x2a99('0x102')),'data2':_0x2a99('0x116')}));});return BPromise[_0x2a99('0x99')](_0x35425b);})['then'](function(){return _0x440075[_0x2a99('0xfd')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x2a99('0x24')](respondWithResult(_0x57898d,null))['catch'](handleError(_0x57898d,null));};exports[_0x2a99('0x119')]=function(_0x150f05,_0x531cf4,_0x537996){var _0x5c6a34={};var _0x5417fa={};var _0x12b39d;var _0x547d0f;return db['User']['findOne']({'where':{'id':_0x150f05[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x531cf4,null))[_0x2a99('0x24')](function(_0x37affa){if(_0x37affa){_0x12b39d=_0x37affa;_0x5417fa[_0x2a99('0x50')]=_[_0x2a99('0x68')](db['Team'][_0x2a99('0x4c')]);_0x5417fa['query']=_[_0x2a99('0x68')](_0x150f05[_0x2a99('0x54')]);_0x5417fa[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x5417fa[_0x2a99('0x50')],_0x5417fa['query']);_0x5c6a34['attributes']=_[_0x2a99('0x55')](_0x5417fa[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x150f05[_0x2a99('0x54')][_0x2a99('0x56')]));_0x5c6a34[_0x2a99('0x57')]=_0x5c6a34[_0x2a99('0x57')]['length']?_0x5c6a34[_0x2a99('0x57')]:_0x5417fa[_0x2a99('0x50')];_0x5c6a34[_0x2a99('0xd3')]=qs[_0x2a99('0x5a')](_0x150f05[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x5c6a34[_0x2a99('0x5b')]=qs['filters'](_[_0x2a99('0xd4')](_0x150f05['query'],_0x5417fa[_0x2a99('0x53')]));if(_0x150f05['query'][_0x2a99('0x41')]){_0x5c6a34['where']=_['merge'](_0x5c6a34[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x5c6a34[_0x2a99('0x57')],function(_0x34acab){var _0x5c6ba4={};_0x5c6ba4[_0x34acab]={'$like':'%'+_0x150f05[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x5c6ba4;})});}_0x5c6a34=_['merge']({},_0x5c6a34,_0x150f05[_0x2a99('0x61')]);return _0x12b39d[_0x2a99('0x119')](_0x5c6a34);}})['then'](function(_0x27b2d3){if(_0x27b2d3){_0x547d0f=_0x27b2d3[_0x2a99('0x69')];if(!_0x150f05['query'][_0x2a99('0x58')](_0x2a99('0x59'))){_0x5c6a34[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x150f05[_0x2a99('0x54')][_0x2a99('0x32')]);_0x5c6a34[_0x2a99('0x31')]=qs[_0x2a99('0x31')](_0x150f05[_0x2a99('0x54')]['offset']);}return _0x12b39d['getTeams'](_0x5c6a34);}})[_0x2a99('0x24')](function(_0x22e4ac){if(_0x22e4ac){return _0x22e4ac?{'count':_0x547d0f,'rows':_0x22e4ac}:null;}})[_0x2a99('0x24')](respondWithResult(_0x531cf4,null))[_0x2a99('0x65')](handleError(_0x531cf4,null));};exports[_0x2a99('0x11a')]=function(_0x2c412f,_0x402ab8){return db[_0x2a99('0x4b')][_0x2a99('0x45')]({'where':{'id':_0x2c412f[_0x2a99('0x66')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x402ab8,null))[_0x2a99('0x24')](function(_0x36a2b6){if(_0x36a2b6){var _0x5f052e=_0x36a2b6[_0x2a99('0x39')]({'plain':!![]});return _0x36a2b6['addTeams'](_0x2c412f[_0x2a99('0x6a')]['ids'],_[_0x2a99('0x6e')](_0x2c412f[_0x2a99('0x6a')],[_0x2a99('0x6d'),'id'])||{})[_0x2a99('0x24')](function(){for(var _0x1cdf6b=0x0;_0x1cdf6b<_0x2c412f['body']['ids'][_0x2a99('0x69')];_0x1cdf6b++){var _0xd0b129=[];db[_0x2a99('0x11b')][_0x2a99('0xd1')]({'where':{'id':_0x2c412f[_0x2a99('0x6a')][_0x2a99('0x6d')][_0x1cdf6b]}})['then'](function(_0x96f9cb){_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0xfa')]()['then'](function(_0x1dbbf4){for(var _0x448437=0x0;_0x448437<_0x1dbbf4['length'];_0x448437++){_0x1dbbf4[_0x448437]['setDataValue'](_0x2a99('0xad'),_0x2a99('0x11c'));}return _0x1dbbf4;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x11d')]()[_0x2a99('0x24')](function(_0x1290fb){for(var _0x3b4973=0x0;_0x3b4973<_0x1290fb[_0x2a99('0x69')];_0x3b4973++){_0x1290fb[_0x3b4973][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x11f'));}return _0x1290fb;}));_0xd0b129['push'](_0x96f9cb[_0x2a99('0x120')]()[_0x2a99('0x24')](function(_0x448975){for(var _0x16a994=0x0;_0x16a994<_0x448975['length'];_0x16a994++){_0x448975[_0x16a994][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x121'));}return _0x448975;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x122')]()[_0x2a99('0x24')](function(_0x2fc4a7){for(var _0x16d39a=0x0;_0x16d39a<_0x2fc4a7[_0x2a99('0x69')];_0x16d39a++){_0x2fc4a7[_0x16d39a]['setDataValue'](_0x2a99('0xad'),_0x2a99('0x123'));}return _0x2fc4a7;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x124')]()[_0x2a99('0x24')](function(_0x44c46e){for(var _0x46818d=0x0;_0x46818d<_0x44c46e[_0x2a99('0x69')];_0x46818d++){_0x44c46e[_0x46818d][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x125'));}return _0x44c46e;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb[_0x2a99('0x126')]()[_0x2a99('0x24')](function(_0x27f7d0){for(var _0x31dbd7=0x0;_0x31dbd7<_0x27f7d0[_0x2a99('0x69')];_0x31dbd7++){_0x27f7d0[_0x31dbd7]['setDataValue'](_0x2a99('0xad'),'Fax');}return _0x27f7d0;}));_0xd0b129[_0x2a99('0x98')](_0x96f9cb['getOpenchannelQueues']()[_0x2a99('0x24')](function(_0x3ef82e){for(var _0x5a30dd=0x0;_0x5a30dd<_0x3ef82e[_0x2a99('0x69')];_0x5a30dd++){_0x3ef82e[_0x5a30dd]['setDataValue']('channel',_0x2a99('0x127'));}return _0x3ef82e;}));return BPromise[_0x2a99('0x99')](_0xd0b129);})['then'](function(_0xe830b3){var _0x44c65c=_[_0x2a99('0x128')](_0xe830b3);_0xd0b129=[];return db[_0x2a99('0x5e')][_0x2a99('0x129')](function(_0x3e3f2a){for(var _0x5f5782=0x0;_0x5f5782<_0x44c65c[_0x2a99('0x69')];_0x5f5782++){_0xd0b129[_0x2a99('0x98')](_0x44c65c[_0x5f5782][_0x2a99('0x12a')](_0x5f052e['id']),{'transaction':_0x3e3f2a});}return BPromise['all'](_0xd0b129)[_0x2a99('0x24')](function(){if(_0x5f052e[_0x2a99('0xbd')]){return BPromise[_0x2a99('0x9a')](_[_0x2a99('0x41')](_0x44c65c,function(_0x17e0cb){return _0x17e0cb[_0x2a99('0x12b')](_0x2a99('0xad'))===_0x2a99('0x11c');}),function(_0x3a3322){return db[_0x2a99('0xc0')][_0x2a99('0xc1')]({'membername':_0x5f052e[_0x2a99('0x46')],'UserId':_0x5f052e['id'],'queue_name':_0x3a3322[_0x2a99('0x46')],'VoiceQueueId':_0x3a3322['id'],'interface':_[_0x2a99('0x75')](_0x5f052e[_0x2a99('0xb0')])?util[_0x2a99('0xbe')](_0x2a99('0xbf'),_0x5f052e[_0x2a99('0x46')]):_0x5f052e[_0x2a99('0xb0')],'paused':_0x5f052e[_0x2a99('0xaf')]||![],'penalty':_0x5f052e[_0x2a99('0xb5')]},{'transaction':_0x3e3f2a});});}else{return;}})[_0x2a99('0x24')](function(){for(var _0x18b1eb=0x0;_0x18b1eb<_0x44c65c['length'];_0x18b1eb++){var _0x580fd8=_0x44c65c[_0x18b1eb][_0x2a99('0x12b')](_0x2a99('0xad'));var _0x63b18b=_0x580fd8+_0x2a99('0xb7');socket[_0x2a99('0xb8')](_0x2a99('0x8c')+_0x580fd8+_0x2a99('0xba'),{'UserId':_0x5f052e['id'],['queueField']:_0x44c65c[_0x18b1eb]['id']});}});});});}});}})[_0x2a99('0x24')](respondWithStatusCode(_0x402ab8,null))['catch'](handleError(_0x402ab8,null));};exports[_0x2a99('0x12c')]=function(_0x50c5dd,_0x5c41af){return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x50c5dd['params']['id']}})['then'](handleEntityNotFound(_0x5c41af,null))[_0x2a99('0x24')](function(_0x220a90){if(_0x220a90){var _0x4539c2=_0x220a90[_0x2a99('0x39')]({'plain':!![]});var _0x4dbc67=_0x50c5dd[_0x2a99('0x54')][_0x2a99('0x6d')];return _0x220a90[_0x2a99('0x12c')](_0x4dbc67)[_0x2a99('0x24')](function(){for(var _0x5f3895=0x0;_0x5f3895<_0x4dbc67['length'];_0x5f3895++){var _0x3c0e87=[];db['Team']['findOne']({'where':{'id':_0x4dbc67[_0x5f3895]}})['then'](function(_0x2909f5){_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0xfa')]()[_0x2a99('0x24')](function(_0x561255){for(var _0x4f19b6=0x0;_0x4f19b6<_0x561255[_0x2a99('0x69')];_0x4f19b6++){_0x561255[_0x4f19b6][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x11c'));}return _0x561255;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x11d')]()[_0x2a99('0x24')](function(_0x2331e5){for(var _0x3a9d05=0x0;_0x3a9d05<_0x2331e5[_0x2a99('0x69')];_0x3a9d05++){_0x2331e5[_0x3a9d05]['setDataValue'](_0x2a99('0xad'),_0x2a99('0x11f'));}return _0x2331e5;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x120')]()[_0x2a99('0x24')](function(_0x1399e9){for(var _0x83a959=0x0;_0x83a959<_0x1399e9[_0x2a99('0x69')];_0x83a959++){_0x1399e9[_0x83a959][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x121'));}return _0x1399e9;}));_0x3c0e87['push'](_0x2909f5['getSmsQueues']()['then'](function(_0x204104){for(var _0x44f5e5=0x0;_0x44f5e5<_0x204104[_0x2a99('0x69')];_0x44f5e5++){_0x204104[_0x44f5e5][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x123'));}return _0x204104;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x124')]()[_0x2a99('0x24')](function(_0x4518dc){for(var _0x38eba0=0x0;_0x38eba0<_0x4518dc[_0x2a99('0x69')];_0x38eba0++){_0x4518dc[_0x38eba0]['setDataValue']('channel',_0x2a99('0x125'));}return _0x4518dc;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5[_0x2a99('0x126')]()[_0x2a99('0x24')](function(_0x309571){for(var _0x3d9a73=0x0;_0x3d9a73<_0x309571[_0x2a99('0x69')];_0x3d9a73++){_0x309571[_0x3d9a73]['setDataValue'](_0x2a99('0xad'),'Fax');}return _0x309571;}));_0x3c0e87[_0x2a99('0x98')](_0x2909f5['getOpenchannelQueues']()['then'](function(_0x37b7ca){for(var _0x4e6be5=0x0;_0x4e6be5<_0x37b7ca[_0x2a99('0x69')];_0x4e6be5++){_0x37b7ca[_0x4e6be5][_0x2a99('0x11e')](_0x2a99('0xad'),_0x2a99('0x127'));}return _0x37b7ca;}));return BPromise['all'](_0x3c0e87);})[_0x2a99('0x24')](function(_0x345220){var _0xbf5b38=_[_0x2a99('0x128')](_0x345220);_0x3c0e87=[];return db[_0x2a99('0x5e')][_0x2a99('0x129')](function(_0x3fc870){for(var _0x573dc4=0x0;_0x573dc4<_0xbf5b38[_0x2a99('0x69')];_0x573dc4++){_0x3c0e87[_0x2a99('0x98')](_0xbf5b38[_0x573dc4][_0x2a99('0x12d')](_0x4539c2['id']),{'transaction':_0x3fc870});}return BPromise[_0x2a99('0x99')](_0x3c0e87)[_0x2a99('0x24')](function(){if(_0x4539c2[_0x2a99('0xbd')]){return BPromise[_0x2a99('0x9a')](_['filter'](_0xbf5b38,function(_0x187c93){return _0x187c93['getDataValue'](_0x2a99('0xad'))==='Voice';}),function(_0x2492e8){return db[_0x2a99('0xc0')][_0x2a99('0x38')]({'where':{'VoiceQueueId':_0x2492e8['id'],'UserId':_0x4539c2['id']},'transaction':_0x3fc870});});}else{return;}})['then'](function(){for(var _0x24a449=0x0;_0x24a449<_0xbf5b38['length'];_0x24a449++){var _0x2f0ed5=_0xbf5b38[_0x24a449]['getDataValue'](_0x2a99('0xad'));var _0x404000=_0x2f0ed5+_0x2a99('0xb7');socket['emit'](_0x2a99('0x8c')+_0x2f0ed5+_0x2a99('0xc5'),{'UserId':_0x4539c2['id'],['queueField']:_0xbf5b38[_0x24a449]['id']});}});});});}});}})[_0x2a99('0x24')](respondWithStatusCode(_0x5c41af,null))[_0x2a99('0x65')](handleError(_0x5c41af,null));};exports['getLists']=function(_0x5c20f6,_0x16129f,_0x3a0ff9){var _0x59fb11={};var _0x5b46b0={};var _0x44b87f;var _0x48a7df;return db[_0x2a99('0x4b')]['findOne']({'where':{'id':_0x5c20f6['params']['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x16129f,null))[_0x2a99('0x24')](function(_0x282096){if(_0x282096){_0x44b87f=_0x282096;_0x5b46b0[_0x2a99('0x50')]=_[_0x2a99('0x68')](db['CmList'][_0x2a99('0x4c')]);_0x5b46b0[_0x2a99('0x54')]=_['keys'](_0x5c20f6[_0x2a99('0x54')]);_0x5b46b0[_0x2a99('0x53')]=_[_0x2a99('0x55')](_0x5b46b0['model'],_0x5b46b0['query']);_0x59fb11[_0x2a99('0x57')]=_[_0x2a99('0x55')](_0x5b46b0['model'],qs[_0x2a99('0x56')](_0x5c20f6['query'][_0x2a99('0x56')]));_0x59fb11[_0x2a99('0x57')]=_0x59fb11[_0x2a99('0x57')][_0x2a99('0x69')]?_0x59fb11[_0x2a99('0x57')]:_0x5b46b0['model'];_0x59fb11[_0x2a99('0xd3')]=qs['sort'](_0x5c20f6['query'][_0x2a99('0x5a')]);_0x59fb11[_0x2a99('0x5b')]=qs['filters'](_[_0x2a99('0xd4')](_0x5c20f6[_0x2a99('0x54')],_0x5b46b0[_0x2a99('0x53')]));if(_0x5c20f6['query'][_0x2a99('0x41')]){_0x59fb11[_0x2a99('0x5b')]=_[_0x2a99('0x5c')](_0x59fb11[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x59fb11['attributes'],function(_0x15ac3d){var _0x2d94a9={};_0x2d94a9[_0x15ac3d]={'$like':'%'+_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x41')]+'%'};return _0x2d94a9;})});}_0x59fb11=_[_0x2a99('0x5c')]({},_0x59fb11,_0x5c20f6[_0x2a99('0x61')]);return _0x44b87f[_0x2a99('0x12e')](_0x59fb11);}})[_0x2a99('0x24')](function(_0x349325){if(_0x349325){_0x48a7df=_0x349325[_0x2a99('0x69')];if(!_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x58')](_0x2a99('0x59'))){_0x59fb11[_0x2a99('0x32')]=qs[_0x2a99('0x32')](_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x32')]);_0x59fb11[_0x2a99('0x31')]=qs['offset'](_0x5c20f6[_0x2a99('0x54')][_0x2a99('0x31')]);}return _0x44b87f[_0x2a99('0x12e')](_0x59fb11);}})[_0x2a99('0x24')](function(_0x5bcdec){if(_0x5bcdec){return _0x5bcdec?{'count':_0x48a7df,'rows':_0x5bcdec}:null;}})[_0x2a99('0x24')](respondWithResult(_0x16129f,null))['catch'](handleError(_0x16129f,null));};exports['getAgents']=function(_0x417d11,_0x467e65,_0x359e49){var _0x1a1c45={};var _0x488281={};var _0x3167b7;var _0x4f199b;return db[_0x2a99('0x4b')][_0x2a99('0xd1')]({'where':{'id':_0x417d11[_0x2a99('0x66')]['id']}})['then'](handleEntityNotFound(_0x467e65,null))[_0x2a99('0x24')](function(_0x42fc4d){if(_0x42fc4d){_0x3167b7=_0x42fc4d;_0x488281['model']=_[_0x2a99('0x68')](db['User'][_0x2a99('0x4c')]);_0x488281[_0x2a99('0x54')]=_['keys'](_0x417d11[_0x2a99('0x54')]);_0x488281['filters']=_['intersection'](_0x488281[_0x2a99('0x50')],_0x488281[_0x2a99('0x54')]);_0x1a1c45['attributes']=_[_0x2a99('0x55')](_0x488281[_0x2a99('0x50')],qs[_0x2a99('0x56')](_0x417d11[_0x2a99('0x54')][_0x2a99('0x56')]));_0x1a1c45[_0x2a99('0x57')]=_0x1a1c45[_0x2a99('0x57')][_0x2a99('0x69')]?_0x1a1c45[_0x2a99('0x57')]:_0x488281['model'];_0x1a1c45[_0x2a99('0xd3')]=qs['sort'](_0x417d11[_0x2a99('0x54')][_0x2a99('0x5a')]);_0x1a1c45[_0x2a99('0x5b')]=qs[_0x2a99('0x53')](_[_0x2a99('0xd4')](_0x417d11[_0x2a99('0x54')],_0x488281['filters']));if(_0x417d11[_0x2a99('0x54')][_0x2a99('0x41')]){_0x1a1c45[_0x2a99('0x5b')]=_['merge'](_0x1a1c45[_0x2a99('0x5b')],{'$or':_[_0x2a99('0x43')](_0x1a1c45[_0x2a99('0x57')],function(_0x19ba68){var _0x54939e={};_0x54939e[_0x19ba68]={'$like':'%'+_0x417d11['query']['filter']+'%'};return _0x54939e;})});}_0x1a1c45[_0x2a99('0x50')]=db[_0x2a99('0x4b')];_0x1a1c45['as']=_0x2a99('0x3d');_0x1a1c45=_[_0x2a99('0x5c')]({},_0x1a1c45,_0x417d11['options']);return _0x3167b7[_0x2a99('0xfa')]({'include':[_0x1a1c45]});}})['then'](function(_0x2dbaed){if(_0x2dbaed){var _0x53cb8e={},_0x39166c=[],_0x380e92=0x0;for(var _0x1a8472=0x0;_0x1a8472<_0x2dbaed[_0x2a99('0x69')];_0x1a8472+=0x1){for(var _0x258be8=0x0,_0x1119a5;_0x258be8<_0x2dbaed[_0x1a8472][_0x2a99('0x3d')]['length'];_0x258be8+=0x1){_0x1119a5=_0x2dbaed[_0x1a8472][_0x2a99('0x3d')][_0x258be8][_0x2a99('0x39')]({'plain':!![]});_0x53cb8e[_0x1119a5['id']]=_0x1119a5;}}_0x53cb8e=_[_0x2a99('0x12f')](_0x53cb8e);for(var _0x9a583f=qs[_0x2a99('0x31')](_0x417d11[_0x2a99('0x54')][_0x2a99('0x31')]);_0x9a583f<_0x53cb8e[_0x2a99('0x69')]&&_0x39166c['length']=_0x2ffbb3[_0xc4f3('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x23ac5e){return db['UserVoiceQueueRt'][_0xc4f3('0x53')]({'where':{'membername':_0x23ac5e[_0xc4f3('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x23ac5e){return _0x23ac5e['getVoiceQueues']({'raw':!![]});}})[_0xc4f3('0x12')](function(_0x8b087e){if(_0x23ac5e){if(_0x8b087e){var _0x4b9fe0=[];_0x1e0832=_0x8b087e;if(_0x1e0832[_0xc4f3('0x2f')]){for(var _0x324f5b=0x0;_0x324f5b<_0x1e0832['length'];_0x324f5b++){_0x4b9fe0['push'](db[_0xc4f3('0x41')][_0xc4f3('0x54')]({'membername':_0x23ac5e[_0xc4f3('0x2a')],'UserId':_0x23ac5e['id'],'queue_name':_0x1e0832[_0x324f5b][_0xc4f3('0x2a')],'VoiceQueueId':_0x1e0832[_0x324f5b]['id'],'interface':_0x3615b8,'paused':_0x23ac5e[_0xc4f3('0x4e')]||![],'penalty':_0x1e0832[_0x324f5b][_0xc4f3('0x55')]||0x0}));}return BPromise[_0xc4f3('0x4b')](_0x4b9fe0);}}}})['then'](function(){if(_0x23ac5e){return db[_0xc4f3('0x3a')]['findAll']({'where':{'membername':_0x23ac5e[_0xc4f3('0x2a')],'exitAt':null}});}})[_0xc4f3('0x12')](function(_0x122bf4){if(_0x23ac5e){if(_0x122bf4&&_0x122bf4['length']){var _0x18db4b=[];_0x122bf4[_0xc4f3('0x49')](function(_0x3f9cb6){_0x18db4b[_0xc4f3('0x34')](_0x3f9cb6[_0xc4f3('0x2d')]({'exitAt':moment()[_0xc4f3('0x30')](_0xc4f3('0x31'))}));});return BPromise['all'](_0x18db4b);}}})[_0xc4f3('0x12')](function(_0x234175){if(_0x23ac5e){var _0x34f05a=[];var _0x446e24=[];var _0x4944aa=utils[_0xc4f3('0x33')]();var _0x41be6a={'membername':_0x23ac5e[_0xc4f3('0x2a')],'interface':_0x3615b8,'enterAt':moment()['format'](_0xc4f3('0x31')),'role':_0x23ac5e['role'],'internal':_0x23ac5e['internal']};_0x4944aa['forEach'](function(_0xd59f24){_0x34f05a[_0xc4f3('0x34')](_[_0xc4f3('0x56')]({'channel':_0xd59f24,'type':_0xc4f3('0x57'),'data1':'callysquare','data2':_0x3615b8},_0x41be6a));if(_0x23ac5e[_0xc4f3('0x4e')]){_0x446e24[_0xc4f3('0x34')](_[_0xc4f3('0x56')]({'channel':_0xd59f24,'type':_0xc4f3('0x2e'),'data1':_0xc4f3('0x58')},_0x41be6a));}});return db[_0xc4f3('0x3a')][_0xc4f3('0x3b')](_0x34f05a['concat'](_0x446e24),{'individualHooks':!![]});}})[_0xc4f3('0x12')](function(){if(_0x23ac5e){return _0x23ac5e[_0xc4f3('0x2d')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x23ac5e['loginInPause']||![],'mailPause':_0x23ac5e['loginInPause']||![],'chatPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'faxPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'smsPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'openchannelPause':_0x23ac5e[_0xc4f3('0x4e')]||![],'pauseType':_0x23ac5e[_0xc4f3('0x4e')]?_0xc4f3('0x58'):null,'lastPauseAt':moment()['format'](_0xc4f3('0x31')),'interface':_0x3615b8});}})[_0xc4f3('0x12')](function(_0x4ea226){_0x4d7e8d(_0x4ea226);})[_0xc4f3('0x1b')](function(_0x2e5dca){_0x4dba2a(_0x55ce2b[_0xc4f3('0x16')](0x1f4,_0x2e5dca['message']));});});}; \ No newline at end of file +var _0x6a95=['mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','destroy','getVoiceQueues','UserVoiceQueue.penalty','all','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','findAll','options','raw','where','limit','map','include','model','attributes','ShowUser','User','find','info','PauseUser','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','update','type','findOne','channel','isValidChannel','Unknown\x20channel','system','mail','chat','sms','openchannel','whatsapp','set','%s%s','length','LoginUser'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x6a95,0x1db));var _0x56a9=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x6a95[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./user.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['User'][_0x56a9('0x1d')]({'raw':_0x335cc3[_0x56a9('0x1e')]?_0x335cc3[_0x56a9('0x1e')][_0x56a9('0x1f')]===undefined?!![]:![]:!![],'where':_0x335cc3['options']?_0x335cc3[_0x56a9('0x1e')][_0x56a9('0x20')]||null:null,'attributes':_0x335cc3[_0x56a9('0x1e')]?_0x335cc3[_0x56a9('0x1e')]['attributes']||null:null,'limit':_0x335cc3[_0x56a9('0x1e')]?_0x335cc3[_0x56a9('0x1e')][_0x56a9('0x21')]||null:null,'include':_0x335cc3[_0x56a9('0x1e')]?_0x335cc3[_0x56a9('0x1e')]['include']?_[_0x56a9('0x22')](_0x335cc3[_0x56a9('0x1e')][_0x56a9('0x23')],function(_0x5e3052){return{'model':db[_0x5e3052[_0x56a9('0x24')]],'as':_0x5e3052['as'],'attributes':_0x5e3052['attributes'],'include':_0x5e3052[_0x56a9('0x23')]?_[_0x56a9('0x22')](_0x5e3052[_0x56a9('0x23')],function(_0x20432a){return{'model':db[_0x20432a[_0x56a9('0x24')]],'as':_0x20432a['as'],'attributes':_0x20432a[_0x56a9('0x25')],'include':_0x20432a[_0x56a9('0x23')]?_[_0x56a9('0x22')](_0x20432a['include'],function(_0x437ccf){return{'model':db[_0x437ccf[_0x56a9('0x24')]],'as':_0x437ccf['as'],'attributes':_0x437ccf['attributes']};}):[]};}):[]};}):[]:[]})[_0x56a9('0x11')](function(_0x4f9be1){logger['info'](_0x56a9('0x1c'),_0x335cc3);logger['debug'](_0x56a9('0x1c'),_0x335cc3,JSON[_0x56a9('0x16')](_0x4f9be1));_0x62f79f(_0x4f9be1);})[_0x56a9('0x1b')](function(_0x2c1c3d){logger['error'](_0x56a9('0x1c'),_0x2c1c3d[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0x2c1c3d[_0x56a9('0x19')]));});});};exports[_0x56a9('0x26')]=function(_0x1fa0a6){var _0x3a7a4e=this;return new Promise(function(_0x2b5447,_0x42c2da){return db[_0x56a9('0x27')][_0x56a9('0x28')]({'raw':_0x1fa0a6[_0x56a9('0x1e')]?_0x1fa0a6['options'][_0x56a9('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fa0a6[_0x56a9('0x1e')]?_0x1fa0a6[_0x56a9('0x1e')]['where']||null:null,'attributes':_0x1fa0a6[_0x56a9('0x1e')]?_0x1fa0a6['options']['attributes']||null:null,'include':_0x1fa0a6['options']?_0x1fa0a6[_0x56a9('0x1e')][_0x56a9('0x23')]?_['map'](_0x1fa0a6['options'][_0x56a9('0x23')],function(_0x18d7d0){return{'model':db[_0x18d7d0[_0x56a9('0x24')]],'as':_0x18d7d0['as'],'attributes':_0x18d7d0[_0x56a9('0x25')],'include':_0x18d7d0[_0x56a9('0x23')]?_[_0x56a9('0x22')](_0x18d7d0[_0x56a9('0x23')],function(_0x3f8bd0){return{'model':db[_0x3f8bd0[_0x56a9('0x24')]],'as':_0x3f8bd0['as'],'attributes':_0x3f8bd0[_0x56a9('0x25')],'include':_0x3f8bd0['include']?_['map'](_0x3f8bd0['include'],function(_0x4a67e0){return{'model':db[_0x4a67e0[_0x56a9('0x24')]],'as':_0x4a67e0['as'],'attributes':_0x4a67e0[_0x56a9('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f623f){logger[_0x56a9('0x29')](_0x56a9('0x26'),_0x1fa0a6);logger[_0x56a9('0x13')](_0x56a9('0x26'),_0x1fa0a6,JSON[_0x56a9('0x16')](_0x2f623f));_0x2b5447(_0x2f623f);})[_0x56a9('0x1b')](function(_0x549f53){logger[_0x56a9('0x17')](_0x56a9('0x26'),_0x549f53['message'],_0x1fa0a6);_0x42c2da(_0x3a7a4e['error'](0x1f4,_0x549f53[_0x56a9('0x19')]));});});};exports[_0x56a9('0x2a')]=function(_0x1534d7){var _0x3ee429=this;return new Promise(function(_0x158504,_0x78835a){var _0x28c2fb;return db[_0x56a9('0x27')][_0x56a9('0x28')]({'where':_0x1534d7[_0x56a9('0x1e')][_0x56a9('0x20')]||{},'attributes':['id',_0x56a9('0x2b'),_0x56a9('0x2c'),_0x56a9('0x2d'),_0x56a9('0x2e')]})[_0x56a9('0x11')](function(_0x33a020){if(_0x33a020){_0x28c2fb=_0x33a020;return db[_0x56a9('0x2f')]['update']({'paused':0x1},{'where':{'UserId':_0x28c2fb['id']},'individualHooks':!![]});}})[_0x56a9('0x11')](function(){if(_0x28c2fb){return db[_0x56a9('0x30')][_0x56a9('0x1d')]({'where':{'membername':_0x28c2fb['name'],'type':_0x56a9('0x31'),'exitAt':null}});}})['then'](function(_0x316c43){if(_0x28c2fb){if(_0x316c43&&_0x316c43['length']){var _0x2d61bd=moment()[_0x56a9('0x32')](_0x56a9('0x33'));for(var _0x49286b=0x0,_0x5192d8=_0x316c43['length'];_0x49286b<_0x5192d8;_0x49286b++){_0x316c43[_0x49286b]['updateAttributes']({'exitAt':_0x2d61bd});}}}})[_0x56a9('0x11')](function(){if(_0x28c2fb){var _0x1dc6e9=[];var _0x288eaa=utils[_0x56a9('0x34')]();_0x288eaa[_0x56a9('0x35')](function(_0x182990){_0x1dc6e9[_0x56a9('0x36')]({'channel':_0x182990,'membername':_0x28c2fb[_0x56a9('0x2b')],'interface':_[_0x56a9('0x37')](_0x28c2fb[_0x56a9('0x2e')])?util[_0x56a9('0x32')](_0x56a9('0x38'),_0x28c2fb[_0x56a9('0x2b')]):_0x28c2fb[_0x56a9('0x2e')],'type':'PAUSE','enterAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'data1':_0x1534d7[_0x56a9('0x39')]['type']||_0x56a9('0x3a'),'role':_0x28c2fb[_0x56a9('0x2c')],'internal':_0x28c2fb['internal'],'uniqueid':_0x1534d7[_0x56a9('0x39')][_0x56a9('0x3b')]||null});});return db[_0x56a9('0x30')][_0x56a9('0x3c')](_0x1dc6e9,{'individualHooks':!![]});}})['then'](function(){if(_0x28c2fb){return _0x28c2fb[_0x56a9('0x3d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1534d7[_0x56a9('0x39')][_0x56a9('0x3e')]||_0x56a9('0x3a'),'lastPauseAt':moment()[_0x56a9('0x32')](_0x56a9('0x33'))});}})[_0x56a9('0x11')](function(_0x214d67){_0x158504(_0x214d67);})[_0x56a9('0x1b')](function(_0x2c3794){_0x78835a(_0x3ee429[_0x56a9('0x17')](0x1f4,_0x2c3794['message']));});});};exports['UnpauseUser']=function(_0x46aa63){var _0x35fb7b=this;return new Promise(function(_0x1eb88a,_0x8c5a95){var _0x4a3cd3;return db[_0x56a9('0x27')][_0x56a9('0x3f')]({'where':_0x46aa63[_0x56a9('0x1e')][_0x56a9('0x20')]||{},'attributes':['id','name']})[_0x56a9('0x11')](function(_0x1f905b){if(_0x1f905b){_0x4a3cd3=_0x1f905b;if(_0x46aa63['body'][_0x56a9('0x40')]&&!utils[_0x56a9('0x41')](_0x46aa63['body'][_0x56a9('0x40')])){throw new Error(_0x56a9('0x42'));}switch(_0x46aa63[_0x56a9('0x39')][_0x56a9('0x40')]){case'voice':return db['UserVoiceQueueRt'][_0x56a9('0x3d')]({'paused':0x0},{'where':{'UserId':_0x4a3cd3['id']}})[_0x56a9('0x11')](function(){return db[_0x56a9('0x30')][_0x56a9('0x28')]({'where':{'channel':_0x46aa63[_0x56a9('0x39')][_0x56a9('0x40')],'membername':_0x4a3cd3[_0x56a9('0x2b')],'type':_0x56a9('0x31'),'exitAt':null}});})[_0x56a9('0x11')](function(_0x4229a8){if(_0x4229a8){return _0x4229a8['update']({'exitAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'data2':_0x56a9('0x43')},{'individualHooks':!![]});}return null;})[_0x56a9('0x11')](function(){return _0x4a3cd3[_0x56a9('0x3d')]({'voicePause':![]});});case _0x56a9('0x44'):case _0x56a9('0x45'):case'fax':case _0x56a9('0x46'):case _0x56a9('0x47'):case _0x56a9('0x48'):return db[_0x56a9('0x30')][_0x56a9('0x28')]({'where':{'channel':_0x46aa63[_0x56a9('0x39')][_0x56a9('0x40')],'membername':_0x4a3cd3['name'],'type':_0x56a9('0x31'),'exitAt':null}})['then'](function(_0x5c8aaf){return _0x5c8aaf[_0x56a9('0x3d')]({'exitAt':moment()['format'](_0x56a9('0x33')),'data2':_0x56a9('0x43')},{'individualHooks':!![]});})[_0x56a9('0x11')](function(){var _0xfcc413={};_[_0x56a9('0x49')](_0xfcc413,util[_0x56a9('0x32')](_0x56a9('0x4a'),_0x46aa63[_0x56a9('0x39')][_0x56a9('0x40')],'Pause'),![]);return _0x4a3cd3[_0x56a9('0x3d')](_0xfcc413);});default:return db[_0x56a9('0x2f')][_0x56a9('0x3d')]({'paused':0x0},{'where':{'UserId':_0x4a3cd3['id']}})[_0x56a9('0x11')](function(){return db[_0x56a9('0x30')][_0x56a9('0x1d')]({'where':{'membername':_0x4a3cd3[_0x56a9('0x2b')],'type':_0x56a9('0x31'),'exitAt':null}});})[_0x56a9('0x11')](function(_0x25c6d6){var _0x5df43d=[];_0x25c6d6[_0x56a9('0x35')](function(_0x286939){_0x5df43d[_0x56a9('0x36')](_0x286939['update']({'exitAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'data2':_0x56a9('0x43')}));});return BPromise['all'](_0x5df43d);})['then'](function(){return _0x4a3cd3[_0x56a9('0x3d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x56a9('0x11')](function(_0x302aa0){_0x1eb88a(_0x302aa0);})[_0x56a9('0x1b')](function(_0x3fc6eb){_0x8c5a95(_0x35fb7b['error'](0x1f4,_0x3fc6eb[_0x56a9('0x19')]));});});};exports['LogoutUser']=function(_0x352f1c){var _0x1cffdc=this;return new Promise(function(_0x2fb33b,_0x23ed84){var _0x4b2afd;return db['User']['findOne']({'where':_0x352f1c['options'][_0x56a9('0x20')]||{},'attributes':['id',_0x56a9('0x2b')]})[_0x56a9('0x11')](function(_0x5bbbf3){if(_0x5bbbf3){_0x4b2afd=_0x5bbbf3;return db[_0x56a9('0x2f')]['destroy']({'where':{'membername':_0x4b2afd[_0x56a9('0x2b')]},'individualHooks':!![]});}})[_0x56a9('0x11')](function(){if(_0x4b2afd){return db[_0x56a9('0x30')]['findAll']({'where':{'membername':_0x4b2afd['name'],'exitAt':null}});}})[_0x56a9('0x11')](function(_0xb915dd){if(_0x4b2afd){if(_0xb915dd&&_0xb915dd[_0x56a9('0x4b')]){var _0x3fb66a=[];_0xb915dd[_0x56a9('0x35')](function(_0x20ed78){_0x3fb66a['push'](_0x20ed78[_0x56a9('0x3d')]({'exitAt':moment()[_0x56a9('0x32')](_0x56a9('0x33'))}));});return BPromise['all'](_0x3fb66a);}}})['then'](function(){if(_0x4b2afd){return _0x4b2afd['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x4270ba){_0x2fb33b(_0x4270ba);})[_0x56a9('0x1b')](function(_0x48ed16){_0x23ed84(_0x1cffdc[_0x56a9('0x17')](0x1f4,_0x48ed16[_0x56a9('0x19')]));});});};exports[_0x56a9('0x4c')]=function(_0x194179){var _0x58108a=this;return new Promise(function(_0x26315b,_0x398a63){var _0x25b6b6;var _0x1eeae3;var _0x216ffe;var _0x2efe37;return db[_0x56a9('0x27')][_0x56a9('0x3f')]({'where':_0x194179[_0x56a9('0x1e')][_0x56a9('0x20')]||{},'attributes':['id',_0x56a9('0x2b'),_0x56a9('0x2c'),_0x56a9('0x4d'),_0x56a9('0x4e'),_0x56a9('0x2d'),_0x56a9('0x4f'),'interface']})[_0x56a9('0x11')](function(_0x5997e8){if(_0x5997e8){_0x25b6b6=_0x5997e8;_0x2efe37=_0x194179[_0x56a9('0x39')][_0x56a9('0x2e')]?_0x194179[_0x56a9('0x39')]['interface']:util[_0x56a9('0x32')]('SIP/%s',_0x25b6b6['name']);return db[_0x56a9('0x27')][_0x56a9('0x50')]({'where':{'role':_0x56a9('0x51'),'online':!![],'id':{'$ne':_0x25b6b6['id']}}});}})[_0x56a9('0x11')](function(_0x500ddf){if(_0x500ddf){_0x216ffe=_0x500ddf;return require(_0x56a9('0x52'))[_0x56a9('0x53')]();}})[_0x56a9('0x11')](function(_0x7321ab){if(_0x7321ab&&_0x7321ab['agents']&&_0x216ffe>=_0x7321ab['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x56a9('0x11')](function(){if(_0x25b6b6){return db[_0x56a9('0x2f')][_0x56a9('0x54')]({'where':{'membername':_0x25b6b6[_0x56a9('0x2b')]},'individualHooks':!![]});}})[_0x56a9('0x11')](function(){if(_0x25b6b6){return _0x25b6b6[_0x56a9('0x55')]({'raw':!![]});}})[_0x56a9('0x11')](function(_0x30874d){if(_0x25b6b6){if(_0x30874d){var _0x4ce390=[];_0x1eeae3=_0x30874d;if(_0x1eeae3['length']){for(var _0x57f598=0x0;_0x57f598<_0x1eeae3[_0x56a9('0x4b')];_0x57f598++){_0x4ce390['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x25b6b6['name'],'UserId':_0x25b6b6['id'],'queue_name':_0x1eeae3[_0x57f598][_0x56a9('0x2b')],'VoiceQueueId':_0x1eeae3[_0x57f598]['id'],'interface':_0x2efe37,'paused':_0x25b6b6[_0x56a9('0x4f')]||![],'penalty':_0x1eeae3[_0x57f598][_0x56a9('0x56')]||0x0}));}return BPromise[_0x56a9('0x57')](_0x4ce390);}}}})['then'](function(){if(_0x25b6b6){return db[_0x56a9('0x30')][_0x56a9('0x1d')]({'where':{'membername':_0x25b6b6[_0x56a9('0x2b')],'exitAt':null}});}})[_0x56a9('0x11')](function(_0x174cb8){if(_0x25b6b6){if(_0x174cb8&&_0x174cb8[_0x56a9('0x4b')]){var _0x16dd48=[];_0x174cb8[_0x56a9('0x35')](function(_0x3b6fe7){_0x16dd48[_0x56a9('0x36')](_0x3b6fe7[_0x56a9('0x3d')]({'exitAt':moment()[_0x56a9('0x32')](_0x56a9('0x33'))}));});return BPromise['all'](_0x16dd48);}}})['then'](function(_0x4c2f80){if(_0x25b6b6){var _0x54e04a=[];var _0x135b37=[];var _0x3f1da4=utils['getChannels']();var _0x447177={'membername':_0x25b6b6[_0x56a9('0x2b')],'interface':_0x2efe37,'enterAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'role':_0x25b6b6[_0x56a9('0x2c')],'internal':_0x25b6b6[_0x56a9('0x2d')]};_0x3f1da4['forEach'](function(_0x8a5775){_0x54e04a['push'](_[_0x56a9('0x58')]({'channel':_0x8a5775,'type':_0x56a9('0x59'),'data1':_0x56a9('0x5a'),'data2':_0x2efe37},_0x447177));if(_0x25b6b6['loginInPause']){_0x135b37[_0x56a9('0x36')](_[_0x56a9('0x58')]({'channel':_0x8a5775,'type':_0x56a9('0x31'),'data1':_0x56a9('0x5b')},_0x447177));}});return db[_0x56a9('0x30')][_0x56a9('0x3c')](_0x54e04a['concat'](_0x135b37),{'individualHooks':!![]});}})[_0x56a9('0x11')](function(){if(_0x25b6b6){return _0x25b6b6[_0x56a9('0x3d')]({'online':!![],'lastLoginAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'voicePause':_0x25b6b6[_0x56a9('0x4f')]||![],'mailPause':_0x25b6b6['loginInPause']||![],'chatPause':_0x25b6b6[_0x56a9('0x4f')]||![],'faxPause':_0x25b6b6[_0x56a9('0x4f')]||![],'smsPause':_0x25b6b6[_0x56a9('0x4f')]||![],'openchannelPause':_0x25b6b6[_0x56a9('0x4f')]||![],'pauseType':_0x25b6b6[_0x56a9('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x56a9('0x32')](_0x56a9('0x33')),'interface':_0x2efe37});}})['then'](function(_0x6d9a59){_0x26315b(_0x6d9a59);})[_0x56a9('0x1b')](function(_0x38f65d){_0x398a63(_0x58108a['error'](0x1f4,_0x38f65d[_0x56a9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1c09a16..5d0c50d 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 _0x3355=['user:','./user.events','save','remove','emit','register','length'];(function(_0x23ec26,_0x194900){var _0x4a68c9=function(_0x3acc48){while(--_0x3acc48){_0x23ec26['push'](_0x23ec26['shift']());}};_0x4a68c9(++_0x194900);}(_0x3355,0x135));var _0x5335=function(_0x3fa729,_0x2cc40b){_0x3fa729=_0x3fa729-0x0;var _0x2d7326=_0x3355[_0x3fa729];return _0x2d7326;};'use strict';var UserEvents=require(_0x5335('0x0'));var events=[_0x5335('0x1'),_0x5335('0x2'),'update'];function createListener(_0x3d328b,_0x4b1e9d){return function(_0x2a7d0f){_0x4b1e9d[_0x5335('0x3')](_0x3d328b,_0x2a7d0f);};}function removeListener(_0x377f59,_0x5e1446){return function(){UserEvents['removeListener'](_0x377f59,_0x5e1446);};}exports[_0x5335('0x4')]=function(_0x5679d8){for(var _0x818cfa=0x0,_0x1fbef8=events[_0x5335('0x5')];_0x818cfa<_0x1fbef8;_0x818cfa++){var _0x1bd785=events[_0x818cfa];var _0x3ac468=createListener(_0x5335('0x6')+_0x1bd785,_0x5679d8);UserEvents['on'](_0x1bd785,_0x3ac468);}}; \ No newline at end of file +var _0xd7c0=['remove','update','emit','register','length','user:','./user.events','save'];(function(_0x4d2472,_0x217290){var _0x313bb4=function(_0x15248b){while(--_0x15248b){_0x4d2472['push'](_0x4d2472['shift']());}};_0x313bb4(++_0x217290);}(_0xd7c0,0x116));var _0x0d7c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7c0[_0xfae23b];return _0x200640;};'use strict';var UserEvents=require(_0x0d7c('0x0'));var events=[_0x0d7c('0x1'),_0x0d7c('0x2'),_0x0d7c('0x3')];function createListener(_0x23e582,_0x5164ba){return function(_0x23b73){_0x5164ba[_0x0d7c('0x4')](_0x23e582,_0x23b73);};}function removeListener(_0x2a5607,_0x2c4059){return function(){UserEvents['removeListener'](_0x2a5607,_0x2c4059);};}exports[_0x0d7c('0x5')]=function(_0x3fbdd6){for(var _0x2929cc=0x0,_0xdfec7c=events[_0x0d7c('0x6')];_0x2929cc<_0xdfec7c;_0x2929cc++){var _0x43aca3=events[_0x2929cc];var _0x34c5dc=createListener(_0x0d7c('0x7')+_0x43aca3,_0x3fbdd6);UserEvents['on'](_0x43aca3,_0x34c5dc);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 607934a..9b1ac3f 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 _0x0cbe=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0cbe,0x15a));var _0xe0cb=function(_0x4facd2,_0x546072){_0x4facd2=_0x4facd2-0x0;var _0x2f0690=_0x0cbe[_0x4facd2];return _0x2f0690;};'use strict';var multer=require(_0xe0cb('0x0'));var util=require(_0xe0cb('0x1'));var path=require(_0xe0cb('0x2'));var timeout=require(_0xe0cb('0x3'));var express=require(_0xe0cb('0x4'));var router=express['Router']();var auth=require(_0xe0cb('0x5'));var interaction=require(_0xe0cb('0x6'));var config=require(_0xe0cb('0x7'));module[_0xe0cb('0x8')]=router; \ No newline at end of file +var _0xf61e=['../../config/environment','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5cb857,_0x30c229){var _0x152e27=function(_0x400fb6){while(--_0x400fb6){_0x5cb857['push'](_0x5cb857['shift']());}};_0x152e27(++_0x30c229);}(_0xf61e,0x82));var _0xef61=function(_0x5bc35a,_0x4f707f){_0x5bc35a=_0x5bc35a-0x0;var _0x1f7e8d=_0xf61e[_0x5bc35a];return _0x1f7e8d;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef61('0x3')]();var auth=require(_0xef61('0x4'));var interaction=require(_0xef61('0x5'));var config=require(_0xef61('0x6'));module[_0xef61('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 056a5f3..1da1df7 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_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 _0xd8b0=['exports','sequelize'];(function(_0x230962,_0x5e9cdc){var _0x198020=function(_0x14b30c){while(--_0x14b30c){_0x230962['push'](_0x230962['shift']());}};_0x198020(++_0x5e9cdc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 9d1b33c..cc4b236 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 _0xcd3e=['rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','path'];(function(_0x35046e,_0x5aaaba){var _0x576ae4=function(_0x587176){while(--_0x587176){_0x35046e['push'](_0x35046e['shift']());}};_0x576ae4(++_0x5aaaba);}(_0xcd3e,0x132));var _0xecd3=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xcd3e[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0xecd3('0x0'));var util=require(_0xecd3('0x1'));var logger=require(_0xecd3('0x2'))(_0xecd3('0x3'));var moment=require(_0xecd3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xecd3('0x5'));var rimraf=require(_0xecd3('0x6'));var config=require(_0xecd3('0x7'));var attributes=require(_0xecd3('0x8'));module[_0xecd3('0x9')]=function(_0x2b7dcd,_0x31fdd3){return _0x2b7dcd['define'](_0xecd3('0xa'),attributes,{'tableName':_0xecd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7582=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','util'];(function(_0x4004c2,_0x11f4be){var _0x553b69=function(_0x3d199e){while(--_0x3d199e){_0x4004c2['push'](_0x4004c2['shift']());}};_0x553b69(++_0x11f4be);}(_0x7582,0x167));var _0x2758=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0x7582[_0x3d2d6f];return _0x5c0022;};'use strict';var _=require('lodash');var util=require(_0x2758('0x0'));var logger=require(_0x2758('0x1'))(_0x2758('0x2'));var moment=require('moment');var BPromise=require(_0x2758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2758('0x4'));var rimraf=require(_0x2758('0x5'));var config=require(_0x2758('0x6'));var attributes=require(_0x2758('0x7'));module['exports']=function(_0x1d5ddd,_0x1dcc5f){return _0x1d5ddd['define'](_0x2758('0x8'),attributes,{'tableName':_0x2758('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index c96110e..d1ea946 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 _0xcedb=['jayson/promise','http','request','then','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xc4cfed,_0x1cdd96){var _0xc4c8e0=function(_0x5ca848){while(--_0x5ca848){_0xc4cfed['push'](_0xc4cfed['shift']());}};_0xc4c8e0(++_0x1cdd96);}(_0xcedb,0x1d8));var _0xbced=function(_0x458e6c,_0x145c84){_0x458e6c=_0x458e6c-0x0;var _0x824387=_0xcedb[_0x458e6c];return _0x824387;};'use strict';var _=require(_0xbced('0x0'));var util=require(_0xbced('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbced('0x2'));var fs=require('fs');var Redis=require(_0xbced('0x3'));var db=require(_0xbced('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbced('0x5'))(_0xbced('0x6'));var config=require(_0xbced('0x7'));var jayson=require(_0xbced('0x8'));var client=jayson['client'][_0xbced('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41ca07,_0x4d2043,_0x5ba8ab){return new BPromise(function(_0x2c3114,_0x192840){return client[_0xbced('0xa')](_0x41ca07,_0x5ba8ab)[_0xbced('0xb')](function(_0xaeb608){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x4d2043,_0xbced('0xc'));logger['debug'](_0xbced('0xd'),_0x4d2043,_0xbced('0xc'),JSON[_0xbced('0xe')](_0xaeb608));if(_0xaeb608[_0xbced('0xf')]){if(_0xaeb608[_0xbced('0xf')][_0xbced('0x10')]===0x1f4){logger['error'](_0xbced('0x11'),_0x4d2043,_0xaeb608[_0xbced('0xf')]['message']);return _0x192840(_0xaeb608['error'][_0xbced('0x12')]);}logger[_0xbced('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x4d2043,_0xaeb608[_0xbced('0xf')]['message']);return _0x2c3114(_0xaeb608[_0xbced('0xf')][_0xbced('0x12')]);}else{logger[_0xbced('0x13')](_0xbced('0x11'),_0x4d2043,_0xbced('0xc'));_0x2c3114(_0xaeb608['result']['message']);}})['catch'](function(_0x35ab11){logger[_0xbced('0xf')](_0xbced('0x11'),_0x4d2043,_0x35ab11);_0x192840(_0x35ab11);});});} \ No newline at end of file +var _0x425f=['jayson/promise','client','http','request','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserChatQueue,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x425f,0x1ac));var _0xf425=function(_0x3caac8,_0x57ce64){_0x3caac8=_0x3caac8-0x0;var _0x5622a6=_0x425f[_0x3caac8];return _0x5622a6;};'use strict';var _=require(_0xf425('0x0'));var util=require(_0xf425('0x1'));var moment=require(_0xf425('0x2'));var BPromise=require(_0xf425('0x3'));var rs=require(_0xf425('0x4'));var fs=require('fs');var Redis=require(_0xf425('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf425('0x6'));var logger=require(_0xf425('0x7'))(_0xf425('0x8'));var config=require('../../config/environment');var jayson=require(_0xf425('0x9'));var client=jayson[_0xf425('0xa')][_0xf425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x92c7c5,_0x22f18a,_0x548696){return new BPromise(function(_0x3807c9,_0x451ed3){return client[_0xf425('0xc')](_0x92c7c5,_0x548696)['then'](function(_0x5e3a40){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x22f18a,_0xf425('0xd'));logger[_0xf425('0xe')](_0xf425('0xf'),_0x22f18a,'request\x20sent',JSON[_0xf425('0x10')](_0x5e3a40));if(_0x5e3a40[_0xf425('0x11')]){if(_0x5e3a40['error']['code']===0x1f4){logger[_0xf425('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x22f18a,_0x5e3a40[_0xf425('0x11')][_0xf425('0x12')]);return _0x451ed3(_0x5e3a40['error'][_0xf425('0x12')]);}logger[_0xf425('0x11')](_0xf425('0x13'),_0x22f18a,_0x5e3a40[_0xf425('0x11')][_0xf425('0x12')]);return _0x3807c9(_0x5e3a40[_0xf425('0x11')][_0xf425('0x12')]);}else{logger[_0xf425('0x14')](_0xf425('0x13'),_0x22f18a,_0xf425('0xd'));_0x3807c9(_0x5e3a40[_0xf425('0x15')][_0xf425('0x12')]);}})[_0xf425('0x16')](function(_0x89bcd3){logger['error'](_0xf425('0x13'),_0x22f18a,_0x89bcd3);_0x451ed3(_0x89bcd3);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 17668ee..5da0e49 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 _0x0ce3=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x4ec36b,_0x1735ca){var _0x337d41=function(_0x5c5d4b){while(--_0x5c5d4b){_0x4ec36b['push'](_0x4ec36b['shift']());}};_0x337d41(++_0x1735ca);}(_0x0ce3,0x187));var _0x30ce=function(_0x41904c,_0x4f6b93){_0x41904c=_0x41904c-0x0;var _0xe97d41=_0x0ce3[_0x41904c];return _0xe97d41;};'use strict';var multer=require(_0x30ce('0x0'));var util=require(_0x30ce('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30ce('0x2'));var router=express[_0x30ce('0x3')]();var auth=require(_0x30ce('0x4'));var interaction=require(_0x30ce('0x5'));var config=require(_0x30ce('0x6'));module[_0x30ce('0x7')]=router; \ No newline at end of file +var _0x0457=['express','Router','../../components/auth/service','../../components/interaction/service','util','connect-timeout'];(function(_0x2d9e46,_0x299ee4){var _0xb343dd=function(_0x311a03){while(--_0x311a03){_0x2d9e46['push'](_0x2d9e46['shift']());}};_0xb343dd(++_0x299ee4);}(_0x0457,0x82));var _0x7045=function(_0x4de02a,_0x111635){_0x4de02a=_0x4de02a-0x0;var _0x14be17=_0x0457[_0x4de02a];return _0x14be17;};'use strict';var multer=require('multer');var util=require(_0x7045('0x0'));var path=require('path');var timeout=require(_0x7045('0x1'));var express=require(_0x7045('0x2'));var router=express[_0x7045('0x3')]();var auth=require(_0x7045('0x4'));var interaction=require(_0x7045('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 52db712..ad71373 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 _0xb7e7=['STRING','sequelize','INTEGER'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7b7e('0x2')]}}; \ No newline at end of file +var _0x0abf=['sequelize','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf0ab('0x1')],'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 d59ac2e..908abfd 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 _0xabae=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','../../config/logger'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xabae,0x1a1));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeaba('0x0'))(_0xeaba('0x1'));var moment=require(_0xeaba('0x2'));var BPromise=require(_0xeaba('0x3'));var rp=require(_0xeaba('0x4'));var fs=require('fs');var path=require(_0xeaba('0x5'));var rimraf=require(_0xeaba('0x6'));var config=require(_0xeaba('0x7'));var attributes=require(_0xeaba('0x8'));module[_0xeaba('0x9')]=function(_0xe39f39,_0x37903a){return _0xe39f39['define'](_0xeaba('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1f2=['UserFaxQueue','user_has_fax_queues','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x233f8d,_0x2bbfc4){var _0x5d08f3=function(_0x236564){while(--_0x236564){_0x233f8d['push'](_0x233f8d['shift']());}};_0x5d08f3(++_0x2bbfc4);}(_0xf1f2,0x192));var _0x2f1f=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xf1f2[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2f1f('0x0'))(_0x2f1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f1f('0x2'));var fs=require('fs');var path=require(_0x2f1f('0x3'));var rimraf=require(_0x2f1f('0x4'));var config=require(_0x2f1f('0x5'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3888cc,_0x20f42b){return _0x3888cc['define'](_0x2f1f('0x6'),attributes,{'tableName':_0x2f1f('0x7'),'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 3ca881b..0bb1153 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 _0x38d2=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36fd9f,_0x1cc5d6){var _0x257dbb=function(_0x501651){while(--_0x501651){_0x36fd9f['push'](_0x36fd9f['shift']());}};_0x257dbb(++_0x1cc5d6);}(_0x38d2,0xed));var _0x238d=function(_0x7af6da,_0x4e742b){_0x7af6da=_0x7af6da-0x0;var _0x23ada3=_0x38d2[_0x7af6da];return _0x23ada3;};'use strict';var _=require('lodash');var util=require(_0x238d('0x0'));var moment=require('moment');var BPromise=require(_0x238d('0x1'));var rs=require(_0x238d('0x2'));var fs=require('fs');var Redis=require(_0x238d('0x3'));var db=require(_0x238d('0x4'))['db'];var utils=require(_0x238d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x238d('0x6'));var jayson=require(_0x238d('0x7'));var client=jayson[_0x238d('0x8')][_0x238d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x136e5e,_0x1b68ee,_0x4d5448){return new BPromise(function(_0x45e0f5,_0x6e4ee5){return client[_0x238d('0xa')](_0x136e5e,_0x4d5448)[_0x238d('0xb')](function(_0x4c7808){logger[_0x238d('0xc')](_0x238d('0xd'),_0x1b68ee,_0x238d('0xe'));logger['debug'](_0x238d('0xf'),_0x1b68ee,_0x238d('0xe'),JSON[_0x238d('0x10')](_0x4c7808));if(_0x4c7808[_0x238d('0x11')]){if(_0x4c7808[_0x238d('0x11')][_0x238d('0x12')]===0x1f4){logger[_0x238d('0x11')](_0x238d('0xd'),_0x1b68ee,_0x4c7808[_0x238d('0x11')][_0x238d('0x13')]);return _0x6e4ee5(_0x4c7808[_0x238d('0x11')][_0x238d('0x13')]);}logger['error'](_0x238d('0xd'),_0x1b68ee,_0x4c7808[_0x238d('0x11')]['message']);return _0x45e0f5(_0x4c7808[_0x238d('0x11')]['message']);}else{logger[_0x238d('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x1b68ee,_0x238d('0xe'));_0x45e0f5(_0x4c7808[_0x238d('0x14')][_0x238d('0x13')]);}})[_0x238d('0x15')](function(_0x1151b4){logger['error'](_0x238d('0xd'),_0x1b68ee,_0x1151b4);_0x6e4ee5(_0x1151b4);});});} \ No newline at end of file +var _0x63ea=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x23f52f,_0x30f497){var _0x5db5cf=function(_0x3de15e){while(--_0x3de15e){_0x23f52f['push'](_0x23f52f['shift']());}};_0x5db5cf(++_0x30f497);}(_0x63ea,0x113));var _0xa63e=function(_0x1053d6,_0x479a3e){_0x1053d6=_0x1053d6-0x0;var _0x1ee809=_0x63ea[_0x1053d6];return _0x1ee809;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa63e('0x0'));var BPromise=require(_0xa63e('0x1'));var rs=require(_0xa63e('0x2'));var fs=require('fs');var Redis=require(_0xa63e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa63e('0x4'));var logger=require('../../config/logger')(_0xa63e('0x5'));var config=require(_0xa63e('0x6'));var jayson=require(_0xa63e('0x7'));var client=jayson['client'][_0xa63e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x196c91,_0x62ae88,_0x309ce7){return new BPromise(function(_0x5c8083,_0x54c46a){return client[_0xa63e('0x9')](_0x196c91,_0x309ce7)['then'](function(_0x32d5ea){logger[_0xa63e('0xa')](_0xa63e('0xb'),_0x62ae88,_0xa63e('0xc'));logger['debug'](_0xa63e('0xd'),_0x62ae88,_0xa63e('0xc'),JSON[_0xa63e('0xe')](_0x32d5ea));if(_0x32d5ea[_0xa63e('0xf')]){if(_0x32d5ea[_0xa63e('0xf')]['code']===0x1f4){logger[_0xa63e('0xf')](_0xa63e('0xb'),_0x62ae88,_0x32d5ea['error'][_0xa63e('0x10')]);return _0x54c46a(_0x32d5ea['error'][_0xa63e('0x10')]);}logger[_0xa63e('0xf')](_0xa63e('0xb'),_0x62ae88,_0x32d5ea['error']['message']);return _0x5c8083(_0x32d5ea[_0xa63e('0xf')][_0xa63e('0x10')]);}else{logger[_0xa63e('0xa')](_0xa63e('0xb'),_0x62ae88,_0xa63e('0xc'));_0x5c8083(_0x32d5ea[_0xa63e('0x11')]['message']);}})['catch'](function(_0x1cec12){logger[_0xa63e('0xf')](_0xa63e('0xb'),_0x62ae88,_0x1cec12);_0x54c46a(_0x1cec12);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d208e0c..065c9b6 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 _0x030b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x030b,0x184));var _0xb030=function(_0x2f67ac,_0x4fbdd2){_0x2f67ac=_0x2f67ac-0x0;var _0x6c0999=_0x030b[_0x2f67ac];return _0x6c0999;};'use strict';var multer=require(_0xb030('0x0'));var util=require(_0xb030('0x1'));var path=require(_0xb030('0x2'));var timeout=require(_0xb030('0x3'));var express=require(_0xb030('0x4'));var router=express[_0xb030('0x5')]();var auth=require(_0xb030('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb030('0x7'));module[_0xb030('0x8')]=router; \ No newline at end of file +var _0xc5c6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','util'];(function(_0x8fe4b7,_0x3a880c){var _0x11d6e4=function(_0x15e7e5){while(--_0x15e7e5){_0x8fe4b7['push'](_0x8fe4b7['shift']());}};_0x11d6e4(++_0x3a880c);}(_0xc5c6,0x1c7));var _0x6c5c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xc5c6[_0x36884e];return _0x1cc367;};'use strict';var multer=require('multer');var util=require(_0x6c5c('0x0'));var path=require(_0x6c5c('0x1'));var timeout=require(_0x6c5c('0x2'));var express=require(_0x6c5c('0x3'));var router=express[_0x6c5c('0x4')]();var auth=require(_0x6c5c('0x5'));var interaction=require(_0x6c5c('0x6'));var config=require('../../config/environment');module[_0x6c5c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3e1c708..499ddeb 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_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 +var _0xb10b=['sequelize','INTEGER'];(function(_0x364632,_0x2a4740){var _0x108956=function(_0x32b775){while(--_0x32b775){_0x364632['push'](_0x364632['shift']());}};_0x108956(++_0x2a4740);}(_0xb10b,0x12a));var _0xbb10=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0xb10b[_0x9e7f3a];return _0x5ab145;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 0259774..21cc202 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x2e8437,_0xbb7be9){var _0x23442d=function(_0x43eb98){while(--_0x43eb98){_0x2e8437['push'](_0x2e8437['shift']());}};_0x23442d(++_0xbb7be9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb7e7[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x5596fe,_0x2c4a14){var _0x4a8707=function(_0x25182e){while(--_0x25182e){_0x5596fe['push'](_0x5596fe['shift']());}};_0x4a8707(++_0x2c4a14);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 5150c82..e02514d 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 _0xf715=['jayson/promise','client','http','request','info','request\x20sent','stringify','error','message','UserMailQueue,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x52a329,_0xa14a96){var _0x15c966=function(_0x301737){while(--_0x301737){_0x52a329['push'](_0x52a329['shift']());}};_0x15c966(++_0xa14a96);}(_0xf715,0x90));var _0x5f71=function(_0x5d32f1,_0x41bb11){_0x5d32f1=_0x5d32f1-0x0;var _0x1e0130=_0xf715[_0x5d32f1];return _0x1e0130;};'use strict';var _=require('lodash');var util=require(_0x5f71('0x0'));var moment=require('moment');var BPromise=require(_0x5f71('0x1'));var rs=require(_0x5f71('0x2'));var fs=require('fs');var Redis=require(_0x5f71('0x3'));var db=require(_0x5f71('0x4'))['db'];var utils=require(_0x5f71('0x5'));var logger=require(_0x5f71('0x6'))('rpc');var config=require(_0x5f71('0x7'));var jayson=require(_0x5f71('0x8'));var client=jayson[_0x5f71('0x9')][_0x5f71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4210a7,_0x5e34c0,_0x52cab5){return new BPromise(function(_0x7eec34,_0x2d0515){return client[_0x5f71('0xb')](_0x4210a7,_0x52cab5)['then'](function(_0x5d8110){logger[_0x5f71('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x5e34c0,_0x5f71('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x5e34c0,'request\x20sent',JSON[_0x5f71('0xe')](_0x5d8110));if(_0x5d8110['error']){if(_0x5d8110['error']['code']===0x1f4){logger[_0x5f71('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x5e34c0,_0x5d8110[_0x5f71('0xf')][_0x5f71('0x10')]);return _0x2d0515(_0x5d8110['error'][_0x5f71('0x10')]);}logger[_0x5f71('0xf')](_0x5f71('0x11'),_0x5e34c0,_0x5d8110[_0x5f71('0xf')][_0x5f71('0x10')]);return _0x7eec34(_0x5d8110['error'][_0x5f71('0x10')]);}else{logger[_0x5f71('0xc')](_0x5f71('0x11'),_0x5e34c0,'request\x20sent');_0x7eec34(_0x5d8110[_0x5f71('0x12')][_0x5f71('0x10')]);}})['catch'](function(_0x532036){logger[_0x5f71('0xf')](_0x5f71('0x11'),_0x5e34c0,_0x532036);_0x2d0515(_0x532036);});});} \ No newline at end of file +var _0xf693=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xf693,0x181));var _0x3f69=function(_0x247cb2,_0x3c912e){_0x247cb2=_0x247cb2-0x0;var _0x51f2b2=_0xf693[_0x247cb2];return _0x51f2b2;};'use strict';var _=require('lodash');var util=require(_0x3f69('0x0'));var moment=require(_0x3f69('0x1'));var BPromise=require(_0x3f69('0x2'));var rs=require(_0x3f69('0x3'));var fs=require('fs');var Redis=require(_0x3f69('0x4'));var db=require(_0x3f69('0x5'))['db'];var utils=require(_0x3f69('0x6'));var logger=require('../../config/logger')(_0x3f69('0x7'));var config=require(_0x3f69('0x8'));var jayson=require(_0x3f69('0x9'));var client=jayson[_0x3f69('0xa')][_0x3f69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45461a,_0x7ecb76,_0x32544e){return new BPromise(function(_0x1ac268,_0xad860e){return client[_0x3f69('0xc')](_0x45461a,_0x32544e)[_0x3f69('0xd')](function(_0x134f69){logger[_0x3f69('0xe')](_0x3f69('0xf'),_0x7ecb76,_0x3f69('0x10'));logger[_0x3f69('0x11')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x7ecb76,_0x3f69('0x10'),JSON[_0x3f69('0x12')](_0x134f69));if(_0x134f69[_0x3f69('0x13')]){if(_0x134f69[_0x3f69('0x13')][_0x3f69('0x14')]===0x1f4){logger['error'](_0x3f69('0xf'),_0x7ecb76,_0x134f69[_0x3f69('0x13')]['message']);return _0xad860e(_0x134f69[_0x3f69('0x13')]['message']);}logger['error'](_0x3f69('0xf'),_0x7ecb76,_0x134f69[_0x3f69('0x13')][_0x3f69('0x15')]);return _0x1ac268(_0x134f69['error'][_0x3f69('0x15')]);}else{logger[_0x3f69('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x7ecb76,_0x3f69('0x10'));_0x1ac268(_0x134f69[_0x3f69('0x16')][_0x3f69('0x15')]);}})[_0x3f69('0x17')](function(_0x18f60a){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x7ecb76,_0x18f60a);_0xad860e(_0x18f60a);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9d3c063..ca70bfd 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 _0x8bae=['../../components/auth/service','exports','util','path','connect-timeout','express','Router'];(function(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0x8bae,0x1b4));var _0xe8ba=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8bae[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xe8ba('0x0'));var path=require(_0xe8ba('0x1'));var timeout=require(_0xe8ba('0x2'));var express=require(_0xe8ba('0x3'));var router=express[_0xe8ba('0x4')]();var auth=require(_0xe8ba('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xe8ba('0x6')]=router; \ No newline at end of file +var _0x1243=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','util','path'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x1243,0x9e));var _0x3124=function(_0x4583f5,_0x48986e){_0x4583f5=_0x4583f5-0x0;var _0x16513b=_0x1243[_0x4583f5];return _0x16513b;};'use strict';var multer=require('multer');var util=require(_0x3124('0x0'));var path=require(_0x3124('0x1'));var timeout=require(_0x3124('0x2'));var express=require(_0x3124('0x3'));var router=express[_0x3124('0x4')]();var auth=require(_0x3124('0x5'));var interaction=require(_0x3124('0x6'));var config=require('../../config/environment');module[_0x3124('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 1726f43..0546f5a 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 _0xd8b0=['exports','sequelize'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1038f3,_0x277b63){var _0x34aa4e=function(_0x2c33dc){while(--_0x2c33dc){_0x1038f3['push'](_0x1038f3['shift']());}};_0x34aa4e(++_0x277b63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index fa32fc4..5738bf7 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 _0xc89a=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x30e952,_0x123520){var _0x2cf13a=function(_0x57347a){while(--_0x57347a){_0x30e952['push'](_0x30e952['shift']());}};_0x2cf13a(++_0x123520);}(_0xc89a,0x1e6));var _0xac89=function(_0x53dc6d,_0x5f52b1){_0x53dc6d=_0x53dc6d-0x0;var _0x3aefa2=_0xc89a[_0x53dc6d];return _0x3aefa2;};'use strict';var _=require(_0xac89('0x0'));var util=require(_0xac89('0x1'));var logger=require(_0xac89('0x2'))('api');var moment=require(_0xac89('0x3'));var BPromise=require(_0xac89('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac89('0x5'));var rimraf=require('rimraf');var config=require(_0xac89('0x6'));var attributes=require(_0xac89('0x7'));module['exports']=function(_0x30aafc,_0x3c5ce0){return _0x30aafc[_0xac89('0x8')](_0xac89('0x9'),attributes,{'tableName':_0xac89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x484c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x484c,0xee));var _0xc484=function(_0xdd436e,_0x13b655){_0xdd436e=_0xdd436e-0x0;var _0x2e5d98=_0x484c[_0xdd436e];return _0x2e5d98;};'use strict';var _=require(_0xc484('0x0'));var util=require(_0xc484('0x1'));var logger=require(_0xc484('0x2'))(_0xc484('0x3'));var moment=require(_0xc484('0x4'));var BPromise=require(_0xc484('0x5'));var rp=require(_0xc484('0x6'));var fs=require('fs');var path=require(_0xc484('0x7'));var rimraf=require(_0xc484('0x8'));var config=require('../../config/environment');var attributes=require(_0xc484('0x9'));module[_0xc484('0xa')]=function(_0x3dbfa0,_0x3f8153){return _0x3dbfa0[_0xc484('0xb')](_0xc484('0xc'),attributes,{'tableName':_0xc484('0xd'),'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 91850b1..50e1734 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 _0x8b93=['error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x39887a,_0x5835ca){var _0x1f8468=function(_0x43032f){while(--_0x43032f){_0x39887a['push'](_0x39887a['shift']());}};_0x1f8468(++_0x5835ca);}(_0x8b93,0x153));var _0x38b9=function(_0x49cde7,_0x1a5daa){_0x49cde7=_0x49cde7-0x0;var _0x3c7f08=_0x8b93[_0x49cde7];return _0x3c7f08;};'use strict';var _=require(_0x38b9('0x0'));var util=require(_0x38b9('0x1'));var moment=require(_0x38b9('0x2'));var BPromise=require(_0x38b9('0x3'));var rs=require(_0x38b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x38b9('0x5'))(_0x38b9('0x6'));var config=require(_0x38b9('0x7'));var jayson=require(_0x38b9('0x8'));var client=jayson[_0x38b9('0x9')][_0x38b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x182c26,_0x3f3823,_0x1f3413){return new BPromise(function(_0x44fedc,_0x16ba4){return client[_0x38b9('0xb')](_0x182c26,_0x1f3413)['then'](function(_0x553767){logger[_0x38b9('0xc')](_0x38b9('0xd'),_0x3f3823,'request\x20sent');logger[_0x38b9('0xe')](_0x38b9('0xf'),_0x3f3823,_0x38b9('0x10'),JSON[_0x38b9('0x11')](_0x553767));if(_0x553767[_0x38b9('0x12')]){if(_0x553767[_0x38b9('0x12')]['code']===0x1f4){logger[_0x38b9('0x12')](_0x38b9('0xd'),_0x3f3823,_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);return _0x16ba4(_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);}logger[_0x38b9('0x12')](_0x38b9('0xd'),_0x3f3823,_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);return _0x44fedc(_0x553767[_0x38b9('0x12')][_0x38b9('0x13')]);}else{logger[_0x38b9('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3f3823,_0x38b9('0x10'));_0x44fedc(_0x553767['result'][_0x38b9('0x13')]);}})[_0x38b9('0x14')](function(_0x2a886d){logger[_0x38b9('0x12')](_0x38b9('0xd'),_0x3f3823,_0x2a886d);_0x16ba4(_0x2a886d);});});} \ No newline at end of file +var _0xf7ad=['../../config/utils','../../config/logger','rpc','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29a66a,_0x39988c){var _0x3b8e17=function(_0x4149ec){while(--_0x4149ec){_0x29a66a['push'](_0x29a66a['shift']());}};_0x3b8e17(++_0x39988c);}(_0xf7ad,0x1f2));var _0xdf7a=function(_0x376e96,_0x2a53b4){_0x376e96=_0x376e96-0x0;var _0x54bd5f=_0xf7ad[_0x376e96];return _0x54bd5f;};'use strict';var _=require(_0xdf7a('0x0'));var util=require('util');var moment=require(_0xdf7a('0x1'));var BPromise=require(_0xdf7a('0x2'));var rs=require(_0xdf7a('0x3'));var fs=require('fs');var Redis=require(_0xdf7a('0x4'));var db=require(_0xdf7a('0x5'))['db'];var utils=require(_0xdf7a('0x6'));var logger=require(_0xdf7a('0x7'))(_0xdf7a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf7a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x339ff4,_0x4eb8aa,_0x4c9a72){return new BPromise(function(_0x32ff12,_0x1b4943){return client[_0xdf7a('0xa')](_0x339ff4,_0x4c9a72)[_0xdf7a('0xb')](function(_0x2aa892){logger['info'](_0xdf7a('0xc'),_0x4eb8aa,_0xdf7a('0xd'));logger['debug'](_0xdf7a('0xe'),_0x4eb8aa,'request\x20sent',JSON[_0xdf7a('0xf')](_0x2aa892));if(_0x2aa892[_0xdf7a('0x10')]){if(_0x2aa892[_0xdf7a('0x10')]['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4eb8aa,_0x2aa892['error'][_0xdf7a('0x11')]);return _0x1b4943(_0x2aa892[_0xdf7a('0x10')][_0xdf7a('0x11')]);}logger[_0xdf7a('0x10')](_0xdf7a('0xc'),_0x4eb8aa,_0x2aa892[_0xdf7a('0x10')][_0xdf7a('0x11')]);return _0x32ff12(_0x2aa892[_0xdf7a('0x10')][_0xdf7a('0x11')]);}else{logger[_0xdf7a('0x12')](_0xdf7a('0xc'),_0x4eb8aa,'request\x20sent');_0x32ff12(_0x2aa892[_0xdf7a('0x13')]['message']);}})[_0xdf7a('0x14')](function(_0x2a37dd){logger[_0xdf7a('0x10')](_0xdf7a('0xc'),_0x4eb8aa,_0x2a37dd);_0x1b4943(_0x2a37dd);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d893bc9..365ee09 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 _0x2f00=['clone','addSections','addResources','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0x500c6d,_0x5897e4){var _0x41596e=function(_0x395d2b){while(--_0x395d2b){_0x500c6d['push'](_0x500c6d['shift']());}};_0x41596e(++_0x5897e4);}(_0x2f00,0x102));var _0x02f0=function(_0x228a25,_0xc617b7){_0x228a25=_0x228a25-0x0;var _0x4c305c=_0x2f00[_0x228a25];return _0x4c305c;};'use strict';var multer=require(_0x02f0('0x0'));var util=require(_0x02f0('0x1'));var path=require(_0x02f0('0x2'));var timeout=require(_0x02f0('0x3'));var express=require(_0x02f0('0x4'));var router=express[_0x02f0('0x5')]();var auth=require(_0x02f0('0x6'));var interaction=require(_0x02f0('0x7'));var config=require(_0x02f0('0x8'));var controller=require(_0x02f0('0x9'));router[_0x02f0('0xa')]('/',auth['isAuthenticated'](),controller[_0x02f0('0xb')]);router[_0x02f0('0xa')](_0x02f0('0xc'),auth[_0x02f0('0xd')](),controller[_0x02f0('0xe')]);router['get'](_0x02f0('0xf'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x10')]);router['get'](_0x02f0('0x11'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x12')]);router[_0x02f0('0xa')](_0x02f0('0x13'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x14')]);router[_0x02f0('0x15')]('/',auth[_0x02f0('0xd')](),controller['create']);router[_0x02f0('0x15')]('/:id/clone',auth[_0x02f0('0xd')](),controller[_0x02f0('0x16')]);router[_0x02f0('0x15')]('/:id/sections',auth['isAuthenticated'](),controller[_0x02f0('0x17')]);router[_0x02f0('0x15')](_0x02f0('0x13'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x18')]);router['put'](_0x02f0('0xf'),auth[_0x02f0('0xd')](),controller['update']);router[_0x02f0('0x19')](_0x02f0('0xf'),auth[_0x02f0('0xd')](),controller[_0x02f0('0x1a')]);router[_0x02f0('0x19')](_0x02f0('0x11'),auth[_0x02f0('0xd')](),controller['removeSections']);router[_0x02f0('0x19')](_0x02f0('0x13'),auth[_0x02f0('0xd')](),controller['removeResources']);module[_0x02f0('0x1b')]=router; \ No newline at end of file +var _0x142d=['removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','/:id/resources','addResources','put','/:id','delete','destroy'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x142d,0x199));var _0xd142=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x142d[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0xd142('0x0'));var util=require(_0xd142('0x1'));var path=require(_0xd142('0x2'));var timeout=require(_0xd142('0x3'));var express=require(_0xd142('0x4'));var router=express[_0xd142('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd142('0x6'));router[_0xd142('0x7')]('/',auth[_0xd142('0x8')](),controller[_0xd142('0x9')]);router[_0xd142('0x7')](_0xd142('0xa'),auth['isAuthenticated'](),controller[_0xd142('0xb')]);router[_0xd142('0x7')]('/:id',auth[_0xd142('0x8')](),controller[_0xd142('0xc')]);router[_0xd142('0x7')](_0xd142('0xd'),auth['isAuthenticated'](),controller[_0xd142('0xe')]);router['get']('/:id/resources',auth[_0xd142('0x8')](),controller[_0xd142('0xf')]);router[_0xd142('0x10')]('/',auth[_0xd142('0x8')](),controller[_0xd142('0x11')]);router['post'](_0xd142('0x12'),auth[_0xd142('0x8')](),controller[_0xd142('0x13')]);router['post'](_0xd142('0xd'),auth[_0xd142('0x8')](),controller['addSections']);router[_0xd142('0x10')](_0xd142('0x14'),auth[_0xd142('0x8')](),controller[_0xd142('0x15')]);router[_0xd142('0x16')](_0xd142('0x17'),auth['isAuthenticated'](),controller['update']);router[_0xd142('0x18')]('/:id',auth[_0xd142('0x8')](),controller[_0xd142('0x19')]);router[_0xd142('0x18')]('/:id/sections',auth[_0xd142('0x8')](),controller[_0xd142('0x1a')]);router[_0xd142('0x18')](_0xd142('0x14'),auth['isAuthenticated'](),controller[_0xd142('0x1b')]);module[_0xd142('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c1bf310..e4de6a5 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 _0xdb28=['STRING','name','setDataValue','join','getDataValue','crudPermissions','split','sequelize','exports'];(function(_0x4c29f9,_0x5bddd4){var _0x4e17b8=function(_0x12e055){while(--_0x12e055){_0x4c29f9['push'](_0x4c29f9['shift']());}};_0x4e17b8(++_0x5bddd4);}(_0xdb28,0x1ae));var _0x8db2=function(_0x1172a1,_0x57e7aa){_0x1172a1=_0x1172a1-0x0;var _0x340bda=_0xdb28[_0x1172a1];return _0x340bda;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')],'allowNull':![],'unique':_0x8db2('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x8f381c){this[_0x8db2('0x4')]('crudPermissions',_0x8f381c?_0x8f381c[_0x8db2('0x5')](''):[]);},'get':function(){return this[_0x8db2('0x6')](_0x8db2('0x7'))?this[_0x8db2('0x6')](_0x8db2('0x7'))[_0x8db2('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8db2('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8de9=['STRING','name','setDataValue','crudPermissions','getDataValue','split','exports'];(function(_0x9a51b3,_0x34ac18){var _0x4ca7b1=function(_0x455c6d){while(--_0x455c6d){_0x9a51b3['push'](_0x9a51b3['shift']());}};_0x4ca7b1(++_0x34ac18);}(_0x8de9,0x1e2));var _0x98de=function(_0xd00ca0,_0xfc9fa0){_0xd00ca0=_0xd00ca0-0x0;var _0x5a2c81=_0x8de9[_0xd00ca0];return _0x5a2c81;};'use strict';var Sequelize=require('sequelize');module[_0x98de('0x0')]={'name':{'type':Sequelize[_0x98de('0x1')],'allowNull':![],'unique':_0x98de('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5442b3){this[_0x98de('0x3')](_0x98de('0x4'),_0x5442b3?_0x5442b3['join'](''):[]);},'get':function(){return this[_0x98de('0x5')](_0x98de('0x4'))?this[_0x98de('0x5')](_0x98de('0x4'))[_0x98de('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x98de('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2d3f35b..58106dd 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 _0xf82e=['userProfileId','Resources','describe','addSections','push','removeSections','getSections','enabled','includes','subsections','autoAssociation','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Unknown\x20section','mergeResources','childModel','Sequelize','ValidationError','Invalid\x20section\x20\x27','parentSections','all','isEmpty','union','hasOwnProperty','VIRTUAL','AnalyticExtractedReport','foreignKey','associatedResources','field','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','color','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','projectName','projects','JscriptyProject','Lists','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','customdashboards','pauses','Pause','Schedule','sounds','Sound','templates','Template','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','AnalyticMetric','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','UserProfileResource','sectionId'];(function(_0x561a05,_0x5de84b){var _0xe12373=function(_0x1ea29c){while(--_0x1ea29c){_0x561a05['push'](_0x561a05['shift']());}};_0xe12373(++_0x5de84b);}(_0xf82e,0x172));var _0xef82=function(_0x10606e,_0x16846d){_0x10606e=_0x10606e-0x0;var _0x4a1108=_0xf82e[_0x10606e];return _0x4a1108;};'use strict';var pdf=require(_0xef82('0x0'));var emlformat=require(_0xef82('0x1'));var rimraf=require(_0xef82('0x2'));var zipdir=require(_0xef82('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xef82('0x4'));var BPromise=require(_0xef82('0x5'));var Mustache=require(_0xef82('0x6'));var util=require(_0xef82('0x7'));var path=require(_0xef82('0x8'));var sox=require(_0xef82('0x9'));var csv=require(_0xef82('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xef82('0xb'));var crypto=require(_0xef82('0xc'));var jsforce=require(_0xef82('0xd'));var deskjs=require(_0xef82('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef82('0xf'));var authService=require(_0xef82('0x10'));var qs=require(_0xef82('0x11'));var as=require(_0xef82('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef82('0x13'))(_0xef82('0x14'));var utils=require(_0xef82('0x15'));var config=require(_0xef82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xef82('0x17'))['db'];config[_0xef82('0x18')]=_[_0xef82('0x19')](config['redis'],{'host':_0xef82('0x1a'),'port':0x18eb});var socket=require(_0xef82('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')[_0xef82('0x1c')](socket);function respondWithStatusCode(_0x1672d5,_0x3b0cfe){_0x3b0cfe=_0x3b0cfe||0xcc;return function(_0x59caeb){if(_0x59caeb){return _0x1672d5['sendStatus'](_0x3b0cfe);}return _0x1672d5[_0xef82('0x1d')](_0x3b0cfe)[_0xef82('0x1e')]();};}function respondWithResult(_0x69a4d6,_0x5e9523){_0x5e9523=_0x5e9523||0xc8;return function(_0x4b9257){if(_0x4b9257){return _0x69a4d6[_0xef82('0x1d')](_0x5e9523)[_0xef82('0x1f')](_0x4b9257);}};}function respondWithFilteredResult(_0x5e4307,_0x25a035){return function(_0x56d3ab){if(_0x56d3ab){var _0x2af186=_0x56d3ab[_0xef82('0x20')],_0x4345da=_0x25a035[_0xef82('0x21')],_0x1689ba=_0x25a035[_0xef82('0x21')]+_0x25a035['limit'],_0x53b33a;if(_0x1689ba>=_0x2af186){_0x1689ba=_0x2af186;_0x53b33a=0xc8;}else{_0x53b33a=0xce;}_0x5e4307[_0xef82('0x1d')](_0x53b33a);return _0x5e4307['set']('Content-Range',_0x4345da+'-'+_0x1689ba+'/'+_0x2af186)['json'](_0x56d3ab);}return null;};}function patchUpdates(_0x3ab850){return function(_0x2b79fd){try{jsonpatch['apply'](_0x2b79fd,_0x3ab850,!![]);}catch(_0x47b29a){return BPromise[_0xef82('0x22')](_0x47b29a);}return _0x2b79fd[_0xef82('0x23')]();};}function saveUpdates(_0x3682dd,_0x1a775c){return function(_0xb51868){if(_0xb51868){return _0xb51868[_0xef82('0x24')](_0x3682dd)['then'](function(_0x285e1){return _0x285e1;});}return null;};}function removeEntity(_0x330417,_0xc9b02c){return function(_0x1999fc){if(_0x1999fc){return _0x1999fc[_0xef82('0x25')]()[_0xef82('0x26')](function(){_0x330417[_0xef82('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ffe1,_0xd14b06){return function(_0x54674e){if(!_0x54674e){_0x24ffe1[_0xef82('0x27')](0x194);}return _0x54674e;};}function handleError(_0x55d897,_0x21a073){_0x21a073=_0x21a073||0x1f4;return function(_0x4dedad){logger[_0xef82('0x28')](_0x4dedad[_0xef82('0x29')]);if(_0x4dedad['name']){delete _0x4dedad[_0xef82('0x2a')];}_0x55d897['status'](_0x21a073)[_0xef82('0x2b')](_0x4dedad);};}exports[_0xef82('0x2c')]=function(_0x4d5619,_0x23c42a){var _0x3fdad0={},_0x18766f={},_0x584925={'count':0x0,'rows':[]};var _0x38a307=_[_0xef82('0x2d')](db[_0xef82('0x2e')][_0xef82('0x2f')],function(_0xc08abe){return{'name':_0xc08abe[_0xef82('0x30')],'type':_0xc08abe[_0xef82('0x31')][_0xef82('0x32')]};});_0x18766f[_0xef82('0x33')]=_[_0xef82('0x2d')](_0x38a307,_0xef82('0x2a'));_0x18766f[_0xef82('0x34')]=_[_0xef82('0x35')](_0x4d5619['query']);_0x18766f[_0xef82('0x36')]=_['intersection'](_0x18766f[_0xef82('0x33')],_0x18766f[_0xef82('0x34')]);_0x3fdad0[_0xef82('0x37')]=_[_0xef82('0x38')](_0x18766f[_0xef82('0x33')],qs[_0xef82('0x39')](_0x4d5619[_0xef82('0x34')]['fields']));_0x3fdad0[_0xef82('0x37')]=_0x3fdad0[_0xef82('0x37')]['length']?_0x3fdad0[_0xef82('0x37')]:_0x18766f[_0xef82('0x33')];if(!_0x4d5619['query']['hasOwnProperty'](_0xef82('0x3a'))){_0x3fdad0[_0xef82('0x3b')]=qs[_0xef82('0x3b')](_0x4d5619[_0xef82('0x34')]['limit']);_0x3fdad0['offset']=qs[_0xef82('0x21')](_0x4d5619[_0xef82('0x34')][_0xef82('0x21')]);}_0x3fdad0[_0xef82('0x3c')]=qs[_0xef82('0x3d')](_0x4d5619[_0xef82('0x34')][_0xef82('0x3d')]);_0x3fdad0['where']=qs[_0xef82('0x36')](_[_0xef82('0x3e')](_0x4d5619[_0xef82('0x34')],_0x18766f[_0xef82('0x36')]),_0x38a307);if(_0x4d5619[_0xef82('0x34')][_0xef82('0x3f')]){_0x3fdad0[_0xef82('0x40')]=_[_0xef82('0x41')](_0x3fdad0[_0xef82('0x40')],{'$or':_[_0xef82('0x2d')](_0x38a307,function(_0x426fb1){if(_0x426fb1[_0xef82('0x31')]!=='VIRTUAL'){var _0x405bdd={};_0x405bdd[_0x426fb1[_0xef82('0x2a')]]={'$like':'%'+_0x4d5619['query'][_0xef82('0x3f')]+'%'};return _0x405bdd;}})});}_0x3fdad0=_['merge']({},_0x3fdad0,_0x4d5619[_0xef82('0x42')]);var _0x1ef698={'where':_0x3fdad0[_0xef82('0x40')]};return db[_0xef82('0x2e')][_0xef82('0x20')](_0x1ef698)[_0xef82('0x26')](function(_0x1e5e40){_0x584925['count']=_0x1e5e40;if(_0x4d5619['query']['includeAll']){_0x3fdad0[_0xef82('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0xef82('0x44')](_0x3fdad0);})['then'](function(_0x4cb99a){_0x584925[_0xef82('0x45')]=_0x4cb99a;return _0x584925;})[_0xef82('0x26')](respondWithFilteredResult(_0x23c42a,_0x3fdad0))[_0xef82('0x46')](handleError(_0x23c42a,null));};exports[_0xef82('0x47')]=function(_0xb490f6,_0x10a135){var _0x143a67={'raw':![],'where':{'id':_0xb490f6[_0xef82('0x48')]['id']}},_0x69bace={};_0x69bace[_0xef82('0x33')]=_[_0xef82('0x35')](db[_0xef82('0x2e')][_0xef82('0x2f')]);_0x69bace['query']=_[_0xef82('0x35')](_0xb490f6['query']);_0x69bace[_0xef82('0x36')]=_[_0xef82('0x38')](_0x69bace[_0xef82('0x33')],_0x69bace[_0xef82('0x34')]);_0x143a67['attributes']=_[_0xef82('0x38')](_0x69bace[_0xef82('0x33')],qs['fields'](_0xb490f6[_0xef82('0x34')][_0xef82('0x39')]));_0x143a67[_0xef82('0x37')]=_0x143a67[_0xef82('0x37')][_0xef82('0x49')]?_0x143a67[_0xef82('0x37')]:_0x69bace[_0xef82('0x33')];if(_0xb490f6[_0xef82('0x34')][_0xef82('0x4a')]){_0x143a67['include']=[{'all':!![]}];}_0x143a67=_[_0xef82('0x41')]({},_0x143a67,_0xb490f6[_0xef82('0x42')]);return db[_0xef82('0x2e')][_0xef82('0x4b')](_0x143a67)[_0xef82('0x26')](handleEntityNotFound(_0x10a135,null))[_0xef82('0x26')](respondWithResult(_0x10a135,null))[_0xef82('0x46')](handleError(_0x10a135,null));};exports['create']=function(_0x198ea0,_0x292785){return db['UserProfile'][_0xef82('0x4c')](_0x198ea0[_0xef82('0x4d')],{})[_0xef82('0x26')](respondWithResult(_0x292785,0xc9))['catch'](handleError(_0x292785,null));};exports['clone']=function(_0x302380,_0x3607f4){var _0x209e24={'where':{'id':_0x302380[_0xef82('0x48')]['id']}},_0x492811={};_0x492811[_0xef82('0x33')]=_[_0xef82('0x35')](db['UserProfile'][_0xef82('0x2f')]);_0x209e24[_0xef82('0x37')]=_[_0xef82('0x38')](_0x492811[_0xef82('0x33')],qs['fields'](_0x302380['query'][_0xef82('0x39')]));_0x209e24[_0xef82('0x37')]=_0x209e24[_0xef82('0x37')][_0xef82('0x49')]?_0x209e24[_0xef82('0x37')]:_0x492811['model'];if(_0x302380[_0xef82('0x34')][_0xef82('0x4a')]){_0x209e24[_0xef82('0x43')]=[{'all':!![]}];}_0x209e24=_[_0xef82('0x41')]({},_0x209e24,_0x302380['options']);return db[_0xef82('0x2e')][_0xef82('0x4b')](_0x209e24)[_0xef82('0x26')](handleEntityNotFound(_0x3607f4,null))[_0xef82('0x26')](function(_0xd764d9){if(_0xd764d9){var _0x1b99a5=_0xd764d9[_0xef82('0x4e')]({'plain':!![]});_0x1b99a5=qs[_0xef82('0x4f')](_0x1b99a5,['id',_0xef82('0x50'),_0xef82('0x51'),_0xef82('0x52')]);_0x302380[_0xef82('0x4d')]=_[_0xef82('0x4f')](_0x302380[_0xef82('0x4d')],['id',_0xef82('0x50'),_0xef82('0x51')]);return db[_0xef82('0x53')][_0xef82('0x54')](function(_0x313bf2){return db[_0xef82('0x2e')]['create'](_['merge'](_0x1b99a5,_0x302380['body']),{'include':_0x302380[_0xef82('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x313bf2})[_0xef82('0x26')](function(_0x1f0d67){var _0x58b376=_0x1f0d67[_0xef82('0x4e')]({'plain':!![]});return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x302380[_0xef82('0x48')]['id']},'raw':!![]})[_0xef82('0x26')](function(_0x29a5b9){if(_0x29a5b9){return BPromise['each'](_0x29a5b9,function(_0x4c120e){return new BPromise(function(_0x53dd56,_0x280af2){if(_0x4c120e['autoAssociation']===null||_0x4c120e['autoAssociation']===0x1)_0x53dd56(null);return db[_0xef82('0x56')]['findAll']({'where':{'sectionId':_0x4c120e['id']},'raw':!![]})['then'](function(_0xe11f03){var _0x51edb2=_[_0xef82('0x2d')](_0xe11f03,function(_0x246c55){return qs[_0xef82('0x4f')](_0x246c55,['id',_0xef82('0x50'),_0xef82('0x51'),_0xef82('0x57')]);});_0x53dd56(_0x51edb2);})['catch'](function(_0x25f849){_0x280af2(_0x25f849);});})[_0xef82('0x26')](function(_0x1fda39){var _0x481388=qs[_0xef82('0x4f')](_0x4c120e,['id',_0xef82('0x50'),_0xef82('0x51')]);_0x481388[_0xef82('0x58')]=_0x58b376['id'];if(_0x1fda39)_0x481388[_0xef82('0x59')]=_0x1fda39;return _0x481388;})[_0xef82('0x26')](function(_0x2a4215){return db[_0xef82('0x55')]['create'](_0x2a4215,{'include':[{'model':db['UserProfileResource'],'as':_0xef82('0x59')}],'raw':!![],'transaction':_0x313bf2});});})[_0xef82('0x26')](function(){return _0x58b376;});}});});});}})['then'](respondWithResult(_0x3607f4,0xc9))[_0xef82('0x46')](handleError(_0x3607f4,null));};exports[_0xef82('0x24')]=function(_0xfbe1ee,_0x38b27a){if(_0xfbe1ee[_0xef82('0x4d')]['id']){delete _0xfbe1ee[_0xef82('0x4d')]['id'];}return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0xfbe1ee[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x38b27a,null))[_0xef82('0x26')](saveUpdates(_0xfbe1ee[_0xef82('0x4d')],null))[_0xef82('0x26')](respondWithResult(_0x38b27a,null))[_0xef82('0x46')](handleError(_0x38b27a,null));};exports[_0xef82('0x25')]=function(_0x3465e4,_0x5c1917){return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0x3465e4[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x5c1917,null))[_0xef82('0x26')](removeEntity(_0x5c1917,null))[_0xef82('0x46')](handleError(_0x5c1917,null));};exports['describe']=function(_0x287a84,_0x413fe9){return db[_0xef82('0x2e')][_0xef82('0x5a')]()[_0xef82('0x26')](respondWithResult(_0x413fe9,null))['catch'](handleError(_0x413fe9,null));};exports[_0xef82('0x5b')]=function(_0x44c8c4,_0x3fe9cd){var _0x3ec0e8=_0x44c8c4[_0xef82('0x4d')];return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0x44c8c4[_0xef82('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fe9cd,null))[_0xef82('0x26')](function(_0x52682f){if(_0x52682f){return db[_0xef82('0x53')][_0xef82('0x54')](function(_0x45e846){return db[_0xef82('0x55')][_0xef82('0x25')]({'where':{'userProfileId':_0x44c8c4[_0xef82('0x48')]['id'],'sectionId':_[_0xef82('0x2d')](_0x3ec0e8,function(_0x38a335){return _0x38a335[_0xef82('0x57')];})},'transaction':_0x45e846})['then'](function(){var _0x5c876c=_[_0xef82('0x2d')](_0x3ec0e8,function(_0x2b87f8){_0x2b87f8[_0xef82('0x58')]=_0x44c8c4[_0xef82('0x48')]['id'];return _0x2b87f8;});var _0x40e600=[];return BPromise['each'](_0x5c876c,function(_0x115d02){return db['UserProfileSection'][_0xef82('0x4c')](_0x115d02,{'include':[{'model':db[_0xef82('0x56')],'as':_0xef82('0x59')}],'raw':!![],'transaction':_0x45e846})[_0xef82('0x26')](function(_0x117177){_0x40e600[_0xef82('0x5c')](_0x117177[_0xef82('0x4e')]({'plain':!![]}));});})[_0xef82('0x26')](function(){return _0x40e600;});});});}})[_0xef82('0x26')](function(_0x203174){return _0x203174;})['then'](respondWithResult(_0x3fe9cd,null))[_0xef82('0x46')](handleError(_0x3fe9cd,null));};exports[_0xef82('0x5d')]=function(_0x4f883e,_0x19cefe){var _0x18ad4e;return db[_0xef82('0x2e')][_0xef82('0x4b')]({'where':{'id':_0x4f883e[_0xef82('0x48')]['id']},'attributes':['id',_0xef82('0x2a')]})[_0xef82('0x26')](handleEntityNotFound(_0x19cefe,null))['then'](function(_0x36b496){if(_0x36b496){_0x18ad4e=_0x36b496;return db[_0xef82('0x55')][_0xef82('0x25')]({'where':{'userProfileId':_0x4f883e['params']['id'],'sectionId':_0x4f883e[_0xef82('0x34')]['ids']}});}})[_0xef82('0x26')](function(){return _0x18ad4e;})[_0xef82('0x26')](respondWithStatusCode(_0x19cefe,null))[_0xef82('0x46')](handleError(_0x19cefe,null));};exports[_0xef82('0x5e')]=function(_0x50a6c1,_0x2103d0){var _0xc17979=[];var _0x23e0f2=[];return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x50a6c1[_0xef82('0x48')]['id']},'raw':!![]})[_0xef82('0x26')](function(_0x51964c){_0xc17979=_['filter'](_0x51964c,function(_0x48b69a){return _0x48b69a[_0xef82('0x5f')]===0x1||_[_0xef82('0x60')]([0x3eb,0x709],_0x48b69a[_0xef82('0x57')]);});if(!_['isEmpty'](_0xc17979)){return _[_0xef82('0x2d')](_0xc17979,function(_0x3dc13a){return _0x3dc13a[_0xef82('0x57')];});}else{return;}})[_0xef82('0x26')](function(_0x46becd){if(_0x46becd)_0x23e0f2=_0x46becd;if(_[_0xef82('0x60')](_0x23e0f2,0x64)){var _0x3afe11=_[_0xef82('0x4b')](_0xc17979,{'sectionId':0x64});return hasDefaultDashboard(_0x3afe11)[_0xef82('0x26')](function(_0x386457){return _[_0xef82('0x2d')](_0xc17979,function(_0xb88335){if(_0xb88335[_0xef82('0x57')]===0x64){_0xb88335[_0xef82('0x61')]=_0x386457;}return _0xb88335;});});}else{return;}})[_0xef82('0x26')](function(_0x4795e7){if(_0x4795e7)_0xc17979=_0x4795e7;if(_[_0xef82('0x60')](_0x23e0f2,0x3eb)){var _0x4d44be=_['find'](_0xc17979,{'sectionId':0x3eb});return getCustomDashboards(_0x4d44be)[_0xef82('0x26')](function(_0x40a1cf){return _['map'](_0xc17979,function(_0x58a42d){if(_0x4d44be[_0xef82('0x5f')]){if(_0x58a42d[_0xef82('0x57')]===0x3eb){_0x58a42d[_0xef82('0x61')]=_0x40a1cf;}}else{if(_0x58a42d[_0xef82('0x57')]===0x64){_0x58a42d['subsections']=_0x40a1cf;}}return _0x58a42d;});});}else{return;}})[_0xef82('0x26')](function(_0xa6bd96){if(_0xa6bd96)_0xc17979=_0xa6bd96;if(_[_0xef82('0x60')](_0x23e0f2,0x709)){var _0x312da1=_[_0xef82('0x4b')](_0xc17979,{'sectionId':0x709});return getPlugins(_0x312da1)[_0xef82('0x26')](function(_0x4b9e0e){if(_0x312da1[_0xef82('0x5f')]){return _[_0xef82('0x2d')](_0xc17979,function(_0x2fb048){if(_0x2fb048[_0xef82('0x57')]===0x709){_0x2fb048[_0xef82('0x61')]=_0x4b9e0e;}return _0x2fb048;});}else{var _0xb119bb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4b9e0e};var _0x3ed208=_[_0xef82('0x2d')](_0xc17979);_0x3ed208[_0xef82('0x5c')](_0xb119bb);return _0x3ed208;}});}else{return;}})[_0xef82('0x26')](function(_0x591b3d){if(_0x591b3d)_0xc17979=_0x591b3d;return _[_0xef82('0x3f')](_0xc17979,[_0xef82('0x5f'),0x1]);})[_0xef82('0x26')](respondWithResult(_0x2103d0,null))['catch'](handleError(_0x2103d0,null));};function hasDefaultDashboard(_0x32cc5b){var _0xef686a=[0x65];return new BPromise(function(_0x40ff0a,_0x3dd796){try{if(_0x32cc5b[_0xef82('0x62')]){_0x40ff0a(_0xef686a);}else{return db[_0xef82('0x56')][_0xef82('0x63')]({'where':{'sectionId':_0x32cc5b['id']},'raw':!![]})['then'](function(_0x5da8bd){_0x5da8bd?_0x40ff0a(_0xef686a):_0x40ff0a();});}}catch(_0x4cd5f9){_0x3dd796(_0x4cd5f9);}});}function getCustomDashboards(_0x292133){var _0x271266=[];return new BPromise(function(_0x544386,_0x16b48d){try{if(_0x292133[_0xef82('0x62')]){return db[_0xef82('0x64')][_0xef82('0x44')]({'raw':!![]})[_0xef82('0x26')](function(_0x44c5b7){_0x44c5b7[_0xef82('0x65')](function(_0x457dda){_0x271266[_0xef82('0x5c')](_0x457dda['id']+0x1869f);});_0x544386(_0x271266);});}else{return db['UserProfileResource'][_0xef82('0x44')]({'where':{'sectionId':_0x292133['id']},'raw':!![]})[_0xef82('0x26')](function(_0x4966f4){_0x4966f4['forEach'](function(_0x17c390){_0x271266['push'](_0x17c390[_0xef82('0x66')]+0x1869f);});_0x544386(_0x271266);});}}catch(_0x8fed6a){_0x16b48d(_0x8fed6a);}});}function getPlugins(_0x4f8442){var _0x4bb229=[];return new BPromise(function(_0x40bf36,_0x2f5370){try{if(_0x4f8442['autoAssociation']){return db['Plugin'][_0xef82('0x44')]({'raw':!![]})['then'](function(_0x3fc17){_0x3fc17[_0xef82('0x65')](function(_0x31ed10){_0x4bb229[_0xef82('0x5c')](_0x31ed10['id']+0x15b38);});_0x40bf36(_0x4bb229);});}else{return db[_0xef82('0x56')]['findAll']({'where':{'sectionId':_0x4f8442['id']},'raw':!![]})[_0xef82('0x26')](function(_0xde263f){_0xde263f[_0xef82('0x65')](function(_0x129390){_0x4bb229[_0xef82('0x5c')](_0x129390['resourceId']+0x15b38);});_0x40bf36(_0x4bb229);});}}catch(_0x30168d){_0x2f5370(_0x30168d);}});}exports[_0xef82('0x67')]=function(_0x53596e,_0xc99a5){return db['UserProfile'][_0xef82('0x4b')]({'where':{'id':_0x53596e[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0xc99a5,null))['then'](function(_0x16372a){if(_0x16372a){return db['sequelize'][_0xef82('0x54')](function(_0x46f418){return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x53596e[_0xef82('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xef82('0x26')](function(_0x4f23e1){if(_0x4f23e1){return db[_0xef82('0x55')]['destroy']({'where':{'userProfileId':_0x53596e[_0xef82('0x48')]['id'],'id':_['map'](_0x4f23e1,function(_0x11968c){return _0x11968c['id'];})},'transaction':_0x46f418});}})[_0xef82('0x26')](function(_0x37992e){var _0x2734d3=_[_0xef82('0x2d')](_0x53596e[_0xef82('0x4d')],function(_0xe4605){_0xe4605['userProfileId']=_0x53596e[_0xef82('0x48')]['id'];return _0xe4605;});return db[_0xef82('0x55')][_0xef82('0x68')](_0x2734d3,{'raw':!![],'transaction':_0x46f418});})[_0xef82('0x26')](function(_0x31781f){var _0x370410=_[_0xef82('0x3f')](_[_0xef82('0x2d')](_0x31781f,function(_0x41f50b){return _0x41f50b['get']({'plain':!![]});}),{'includeAll':![]});if(_0x370410){return db[_0xef82('0x55')][_0xef82('0x44')]({'where':{'userProfileId':_0x53596e[_0xef82('0x48')]['id'],'sectionId':_[_0xef82('0x2d')](_0x370410,function(_0x251cbf){return _0x251cbf[_0xef82('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xef82('0x26')](function(_0x10835d){var _0x230647=_[_0xef82('0x2d')](_0x53596e[_0xef82('0x4d')],function(_0xde2a00){_0xde2a00['userProfileId']=_0x53596e[_0xef82('0x48')]['id'];return _0xde2a00;});return db[_0xef82('0x56')][_0xef82('0x68')](_0x230647,{'raw':!![],'transaction':_0x46f418});});}})[_0xef82('0x46')](handleError(_0xc99a5,null));});}})[_0xef82('0x26')](function(_0x86a754){var _0xc96c72=_[_0xef82('0x2d')](_0x86a754,function(_0x4892e3){return _0x4892e3[_0xef82('0x4e')]({'plain':!![]});});})[_0xef82('0x26')](respondWithResult(_0xc99a5,null))[_0xef82('0x46')](handleError(_0xc99a5,null));};exports[_0xef82('0x69')]=function(_0x4dd4de,_0x4aa8be,_0xaa1171){return db['UserProfile'][_0xef82('0x4b')]({'where':{'id':_0x4dd4de[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x4aa8be,null))[_0xef82('0x26')](function(_0x3b768c){if(_0x3b768c){return _0x3b768c[_0xef82('0x69')](_0x4dd4de['query'][_0xef82('0x6a')]);}})[_0xef82('0x26')](respondWithStatusCode(_0x4aa8be,null))[_0xef82('0x46')](handleError(_0x4aa8be,null));};exports[_0xef82('0x6b')]=function(_0x2d97a3,_0x17172d){var _0x105df4={'raw':![],'where':{}};var _0x18bb52={};var _0x46d315={'count':0x0,'rows':[]};var _0x56a822=_0x2d97a3['query'][_0xef82('0x6c')];if(typeof _0x56a822===_0xef82('0x6d')){throw new db['Sequelize']['ValidationError'](_0xef82('0x6e'));}var _0x50fd6=_0x2d97a3[_0xef82('0x34')][_0xef82('0x6f')]||![];var _0x17c1f1=getQueryModels(_0x56a822,_0x50fd6);if(typeof _0x17c1f1[_0xef82('0x70')]===_0xef82('0x6d')){throw new db[(_0xef82('0x71'))][(_0xef82('0x72'))](_0xef82('0x73')+_0x56a822+'\x27');}var _0x171b7b=[];if(!_['isEmpty'](_0x17c1f1[_0xef82('0x74')])){_0x171b7b=_0x17c1f1[_0xef82('0x74')];}else{_0x171b7b=[{'name':_0x56a822}];}return db['UserProfile'][_0xef82('0x63')]({'where':{'id':_0x2d97a3[_0xef82('0x48')]['id']}})[_0xef82('0x26')](handleEntityNotFound(_0x17172d,null))[_0xef82('0x26')](function(_0x10aa45){if(_0x10aa45){var _0x10687e=[];for(var _0x3d0e31=0x0;_0x3d0e31<_0x171b7b[_0xef82('0x49')];_0x3d0e31++){_0x10687e[_0xef82('0x5c')](db[_0xef82('0x55')][_0xef82('0x63')]({'where':{'userProfileId':_0x10aa45['id'],'name':_0x171b7b[_0x3d0e31][_0xef82('0x2a')]},'raw':!![]}));}return BPromise[_0xef82('0x75')](_0x10687e);}})['then'](function(_0x48243c){var _0x2e4a65=_[_0xef82('0x3f')](_0x48243c,function(_0x26700b){return _0x26700b?_0x26700b:undefined;});var _0xfa4545=_['filter'](_0x171b7b,['ignore',!![]]);var _0x196ff9=_[_0xef82('0x76')](_0x2e4a65)&&_[_0xef82('0x76')](_0xfa4545)?null:_[_0xef82('0x77')](_0xfa4545,_0x2e4a65);if(_0x196ff9){var _0x153db7=[];for(var _0x4935a0=0x0;_0x4935a0<_0x196ff9[_0xef82('0x49')];_0x4935a0++){var _0xc24765=_[_0xef82('0x4b')](_0x171b7b,function(_0x11077b){return _0x196ff9[_0x4935a0]?_0x11077b[_0xef82('0x2a')]===_0x196ff9[_0x4935a0][_0xef82('0x2a')]:null;});if(_0xc24765){if(_0x196ff9[_0x4935a0]['ignore']){_0x153db7['push'](getAllResources(_0x17c1f1[_0xef82('0x70')],_0x196ff9[_0x4935a0]));}else{if(!_0x196ff9[_0x4935a0][_0xef82('0x62')]){_0x153db7[_0xef82('0x5c')](getAllowedResources(_0xc24765,_0x196ff9[_0x4935a0],_0x17c1f1[_0xef82('0x70')]));}else{if(_0xc24765[_0xef82('0x33')]){_0x153db7[_0xef82('0x5c')](getAllFilteredResources(_0xc24765,_0x196ff9[_0x4935a0]));}}}}}return BPromise[_0xef82('0x75')](_0x153db7);}else{return null;}})[_0xef82('0x26')](function(_0x3f0c47){var _0x5bb54b=_0x3f0c47;var _0x476df2=null;if(_0x5bb54b){_0x476df2=_0x5bb54b[_0xef82('0x49')]===0x1?_0x5bb54b[0x0]:null;}if(_0x476df2||_0x5bb54b){var _0x46998c=db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x2f')];_0x18bb52[_0xef82('0x33')]=_['keys'](_0x46998c);_0x18bb52[_0xef82('0x34')]=_['keys'](_0x2d97a3[_0xef82('0x34')]);_0x18bb52[_0xef82('0x36')]=_[_0xef82('0x38')](_0x18bb52['model'],_0x18bb52[_0xef82('0x34')]);_0x105df4['attributes']=_[_0xef82('0x38')](_0x18bb52[_0xef82('0x33')],qs[_0xef82('0x39')](_0x2d97a3['query'][_0xef82('0x39')]));_0x105df4[_0xef82('0x37')]=_0x105df4[_0xef82('0x37')]['length']?_0x105df4[_0xef82('0x37')]:_0x18bb52[_0xef82('0x33')];if(!_0x2d97a3[_0xef82('0x34')][_0xef82('0x78')]('nolimit')){_0x105df4[_0xef82('0x3b')]=qs[_0xef82('0x3b')](_0x2d97a3[_0xef82('0x34')][_0xef82('0x3b')]);_0x105df4['offset']=qs['offset'](_0x2d97a3['query'][_0xef82('0x21')]);}_0x105df4[_0xef82('0x3c')]=qs[_0xef82('0x3d')](_0x2d97a3['query'][_0xef82('0x3d')]);_0x105df4[_0xef82('0x40')]=qs[_0xef82('0x36')](_[_0xef82('0x3e')](_0x2d97a3['query'],_0x18bb52[_0xef82('0x36')]));if(_0x2d97a3[_0xef82('0x34')][_0xef82('0x3f')]){_0x105df4[_0xef82('0x40')]=_[_0xef82('0x41')](_0x105df4[_0xef82('0x40')],{'$or':_[_0xef82('0x2d')](_0x46998c,function(_0x35f265){if(_0x35f265['type'][_0xef82('0x32')]!==_0xef82('0x79')){var _0x541811={};_0x541811[_0x35f265['field']]={'$like':'%'+_0x2d97a3[_0xef82('0x34')]['filter']+'%'};return _0x541811;}})});}var _0x1b9ceb=[];if(_0x476df2){var _0x1f2d5d=_[_0xef82('0x4b')](_0x171b7b,['name',_0x476df2[_0xef82('0x2a')]]);if(_0x1f2d5d['field']){var _0xf13de9={};if(_0x17c1f1['childModel']===_0xef82('0x7a')){_0xf13de9[_0x1f2d5d[_0xef82('0x7b')]]=_[_0xef82('0x2d')](_0x476df2['associatedResources'],'id');}else{_0xf13de9[_0x1f2d5d[_0xef82('0x7b')]]=_0x476df2[_0xef82('0x7c')];}_0x1b9ceb['push'](_0xf13de9);}else{_0x105df4[_0xef82('0x40')]['id']=_0x476df2[_0xef82('0x7c')];}}else{for(var _0x37acd6=0x0;_0x37acd6<_0x5bb54b[_0xef82('0x49')];_0x37acd6++){var _0x1f2d5d=_['find'](_0x171b7b,[_0xef82('0x2a'),_0x5bb54b[_0x37acd6][_0xef82('0x2a')]]);if(_0x1f2d5d[_0xef82('0x7d')]){var _0xf13de9={};_0xf13de9[_0x1f2d5d[_0xef82('0x7b')]]=_0x5bb54b[_0x37acd6][_0xef82('0x7c')];_0x1b9ceb[_0xef82('0x5c')](_0xf13de9);}else{if(!_0x105df4[_0xef82('0x40')]['id'])_0x105df4[_0xef82('0x40')]['id']=[];_0x5bb54b[_0x37acd6]['associatedResources'][_0xef82('0x65')](function(_0x2f0c75){_0x105df4[_0xef82('0x40')]['id'][_0xef82('0x5c')](_0x2f0c75);});}}}if(!_[_0xef82('0x76')](_0x1b9ceb)){_0x105df4[_0xef82('0x40')]=_[_0xef82('0x41')](_0x105df4[_0xef82('0x40')],{'$and':{'$or':_0x1b9ceb}});}_0x105df4=_['merge']({},_0x105df4,_0x2d97a3['options']);if(_0x476df2&&!_0x476df2['autoAssociation']&&_0x17c1f1[_0xef82('0x70')]===_0xef82('0x7a')){if(_0x2d97a3['query'][_0xef82('0x4a')]){_0x105df4['include']=[{'all':!![]}];}return db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x44')](_0x105df4)[_0xef82('0x26')](function(_0x2dddcc){var _0xd6e8ef=[];_0x2dddcc['forEach'](function(_0x206823){var _0x289871;switch(_0x206823[_0xef82('0x7e')]){case _0xef82('0x7f'):_0x289871=_[_0xef82('0x4b')](_0x476df2['associatedResources'],function(_0x11ee94){return _0x11ee94['id']===_0x206823[_0xef82('0x80')]&&_0x11ee94[_0xef82('0x31')]===_0xef82('0x81');});break;case _0xef82('0x82'):_0x289871=_[_0xef82('0x4b')](_0x476df2[_0xef82('0x7c')],function(_0x348ffb){return _0x348ffb['id']===_0x206823['reportId']&&_0x348ffb['type']===_0xef82('0x83');});break;}if(_0x289871)_0xd6e8ef[_0xef82('0x5c')](_0x206823);});_0x46d315[_0xef82('0x20')]=_0xd6e8ef['length'];_0x46d315[_0xef82('0x45')]=_0xd6e8ef;return _0x46d315;});}else{return db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x20')]({'where':_0x105df4[_0xef82('0x40')]})[_0xef82('0x26')](function(_0x209fc2){_0x46d315[_0xef82('0x20')]=_0x209fc2;if(_0x2d97a3['query']['includeAll']){if(_0x17c1f1['childModel']===_0xef82('0x84')){_0x105df4[_0xef82('0x43')]=[{'model':db[_0xef82('0x85')],'as':_0xef82('0x86'),'attributes':['id',_0xef82('0x2a'),'color'],'required':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]?!![]:![]},{'model':db['Tag'],'as':_0xef82('0x88'),'attributes':['id',_0xef82('0x2a'),_0xef82('0x89')],'through':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]?{'attributes':[],'where':{'TagId':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]||undefined}}:{},'required':_0x2d97a3[_0xef82('0x34')][_0xef82('0x87')]?!![]:![]}];}else{_0x105df4[_0xef82('0x43')]=[{'all':!![]}];}}return db[_0x17c1f1[_0xef82('0x70')]][_0xef82('0x44')](_0x105df4);})[_0xef82('0x26')](function(_0x39a121){_0x46d315[_0xef82('0x45')]=_0x39a121;return _0x46d315;});}}else{return _0x46d315;}})[_0xef82('0x26')](respondWithFilteredResult(_0x17172d,_0x105df4))['catch'](handleError(_0x17172d,null));};function getAllResources(_0x3d8ee0,_0x120bd2){return new BPromise(function(_0x1aa570,_0x4308b6){if(_0x120bd2){var _0x396d1b=_0x120bd2[_0xef82('0x3f')]?{[_0x120bd2[_0xef82('0x3f')][_0xef82('0x7d')]]:_0x120bd2['filter']['value']}:undefined;return db[_0x3d8ee0][_0xef82('0x44')]({'where':_0x396d1b,'raw':!![]})[_0xef82('0x26')](function(_0x539af5){_0x120bd2['associatedResources']=_[_0xef82('0x2d')](_0x539af5,'id');_0x1aa570(_0x120bd2);})['catch'](function(_0x4eda77){_0x4308b6(_0x4eda77);});}else{_0x1aa570(null);}});}function getAllFilteredResources(_0x39f560,_0x412b10){return new BPromise(function(_0x21397c,_0x44371a){var _0xa72eb7=_0x39f560[_0xef82('0x3f')]?{[_0x39f560['filter']['field']]:_0x39f560[_0xef82('0x3f')]['value']}:undefined;return db[_0x39f560[_0xef82('0x33')]][_0xef82('0x44')]({'where':_0xa72eb7,'raw':!![]})['then'](function(_0x56c58f){_0x412b10[_0xef82('0x7c')]=_[_0xef82('0x2d')](_0x56c58f,function(_0x42cf23){return _0x42cf23[_0xef82('0x2a')];});_0x21397c(_0x412b10);})['catch'](function(_0x1fce6a){_0x44371a(_0x1fce6a);});});}function getAllowedResources(_0x688a6a,_0xbec23f,_0x47ec4c){return new BPromise(function(_0x19ade0,_0x155b1d){if(_0xbec23f){return db[_0xef82('0x56')]['findAll']({'where':{'sectionId':_0xbec23f['id']},'raw':!![]})[_0xef82('0x26')](function(_0x56aaa6){if(_0x688a6a[_0xef82('0x7d')]&&_0x688a6a[_0xef82('0x7d')]!=='id'){_0xbec23f['associatedResources']=_['map'](_0x56aaa6,function(_0x4d5038){return _0x4d5038[_0x688a6a['field']];});}else{if(_0x47ec4c===_0xef82('0x7a')){_0xbec23f[_0xef82('0x7c')]=_[_0xef82('0x2d')](_0x56aaa6,function(_0x4d836a){return{'id':_0x4d836a['resourceId'],'type':_0x4d836a[_0xef82('0x31')]};});}else{_0xbec23f[_0xef82('0x7c')]=_[_0xef82('0x2d')](_0x56aaa6,function(_0x3c782b){return _0x3c782b[_0xef82('0x66')];});}}_0x19ade0(_0xbec23f);})[_0xef82('0x46')](function(_0x2dacf5){_0x155b1d(_0x2dacf5);});}else{_0x19ade0(null);}});}function getQueryModels(_0x455d05,_0x19d883){var _0x48eb83=_0x455d05[_0xef82('0x8a')]();var _0x59f7fc={'childModel':undefined,'parentSections':[]};switch(_0x48eb83){case _0xef82('0x8b'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x8c');break;case _0xef82('0x8d'):_0x59f7fc['childModel']=_0xef82('0x8e');break;case'squarerecordings':_0x59f7fc[_0xef82('0x70')]='SquareRecording';_0x59f7fc[_0xef82('0x74')]=[{'name':'SquareProjects','field':_0xef82('0x2a'),'foreignKey':_0xef82('0x8f')}];break;case _0xef82('0x90'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x91');break;case'contacts':_0x59f7fc[_0xef82('0x70')]=_0xef82('0x84');_0x59f7fc[_0xef82('0x74')]=[{'name':_0xef82('0x92'),'field':'id','foreignKey':'ListId'}];break;case _0xef82('0x93'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x94');break;case _0xef82('0x95'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x96');break;case'globalcustomfields':_0x59f7fc[_0xef82('0x70')]='CmCustomField';break;case _0xef82('0x97'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x98');break;case _0xef82('0x99'):_0x59f7fc['childModel']='ChatWebsite';break;case _0xef82('0x9a'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x9b');break;case _0xef82('0x9c'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x9d');break;case _0xef82('0x9e'):case _0xef82('0x9f'):case'outboundroutes':_0x59f7fc['childModel']='VoiceExtension';break;case _0xef82('0xa0'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xa1');break;case _0xef82('0xa2'):_0x59f7fc[_0xef82('0x70')]='VoiceMail';break;case'voicerecordings':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xa3');_0x59f7fc['parentSections']=[{'name':_0xef82('0xa4'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xa5'),'model':_0xef82('0xa6'),'filter':{'field':_0xef82('0xa7'),'value':[_0xef82('0xa8')]}},{'name':_0xef82('0xa9'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xa5'),'model':_0xef82('0xa6'),'filter':{'field':_0xef82('0xa7'),'value':[_0xef82('0xaa')]}},{'name':_0xef82('0xab'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xac'),'model':_0xef82('0xad'),'filter':{'field':_0xef82('0x31'),'value':[_0xef82('0xae')]}},{'name':_0xef82('0xaf'),'field':_0xef82('0x2a'),'foreignKey':_0xef82('0xac'),'model':_0xef82('0xad'),'filter':{'field':_0xef82('0x31'),'value':['outbound']}}];break;case _0xef82('0xb0'):_0x59f7fc['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb1');break;case _0xef82('0xb2'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb3');break;case _0xef82('0xb4'):_0x59f7fc['childModel']=_0xef82('0xb5');break;case _0xef82('0xb6'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb7');break;case _0xef82('0xb8'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xb9');break;case'mailsubstatuses':_0x59f7fc[_0xef82('0x70')]='MailSubstatus';break;case _0xef82('0xba'):_0x59f7fc['childModel']='OpenchannelQueue';break;case _0xef82('0xbb'):_0x59f7fc[_0xef82('0x70')]='OpenchannelAccount';break;case _0xef82('0xbc'):_0x59f7fc[_0xef82('0x70')]='SmsQueue';break;case _0xef82('0xbd'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xbe');break;case _0xef82('0xbf'):_0x59f7fc['childModel']=_0xef82('0xc0');break;case _0xef82('0xc1'):_0x59f7fc[_0xef82('0x70')]='WhatsappAccount';break;case _0xef82('0xc2'):_0x59f7fc['childModel']=_0xef82('0xc3');break;case _0xef82('0xc4'):case _0xef82('0xc5'):_0x59f7fc[_0xef82('0x70')]='VoiceQueue';if(_0x19d883){_0x59f7fc[_0xef82('0x74')]=[{'name':_0xef82('0xab')},{'name':'QueueCampaigns'}];}break;case _0xef82('0xc6'):case _0xef82('0xc7'):case'telephones':_0x59f7fc['childModel']='User';if(_0x19d883){_0x59f7fc[_0xef82('0x74')]=[{'name':_0xef82('0xc8'),'filter':{'field':_0xef82('0xa7'),'value':[_0xef82('0xc9'),_0xef82('0xca')]},'ignore':!![]},{'name':_0xef82('0xa4')},{'name':_0xef82('0xa9')}];}break;case'zendeskaccounts':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xcb');break;case _0xef82('0xcc'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xcd');break;case'freshdeskaccounts':_0x59f7fc[_0xef82('0x70')]='FreshdeskAccount';break;case _0xef82('0xce'):_0x59f7fc['childModel']=_0xef82('0xcf');break;case _0xef82('0xd0'):_0x59f7fc['childModel']='DeskAccount';break;case _0xef82('0xd1'):_0x59f7fc[_0xef82('0x70')]='ZohoAccount';break;case _0xef82('0xd2'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xa6');break;case _0xef82('0xd3'):_0x59f7fc[_0xef82('0x70')]='CannedAnswer';break;case'dispositions':_0x59f7fc['childModel']='Disposition';break;case _0xef82('0xd4'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0x64');break;case'intervals':_0x59f7fc[_0xef82('0x70')]='Interval';break;case _0xef82('0xd5'):_0x59f7fc['childModel']=_0xef82('0xd6');break;case'scheduler':_0x59f7fc[_0xef82('0x70')]=_0xef82('0xd7');break;case _0xef82('0xd8'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xd9');break;case'tags':_0x59f7fc[_0xef82('0x70')]=_0xef82('0x85');break;case _0xef82('0xda'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xdb');break;case'triggers':_0x59f7fc[_0xef82('0x70')]='Trigger';break;case _0xef82('0xdc'):_0x59f7fc['childModel']=_0xef82('0xdd');break;case _0xef82('0xde'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xdf');break;case _0xef82('0xe0'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xe1');break;case'extractedreports':_0x59f7fc[_0xef82('0x70')]='AnalyticExtractedReport';_0x59f7fc['parentSections']=[{'name':_0xef82('0xe2'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x59f7fc['childModel']=_0xef82('0xe3');break;case _0xef82('0xc1'):_0x59f7fc[_0xef82('0x70')]=_0xef82('0xe4');break;default:return _0x59f7fc;}return _0x59f7fc;} \ No newline at end of file +var _0x014e=['enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','order','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','reportId','CustomReports','CmContact','Tag','Tags','tag','color','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','admin','user','zendeskaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Pause','scheduler','Schedule','Sound','templates','Template','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','./userProfile.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','merge','VIRTUAL','filter','options','UserProfile','findAll','rows','catch','show','params','includeAll','include','find','create','body','clone','createdAt','crudPermissions','omit','updatedAt','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','update','describe','sectionId','push','ids','getSections'];(function(_0x238b9a,_0x4fcbb8){var _0x59ebf3=function(_0x165123){while(--_0x165123){_0x238b9a['push'](_0x238b9a['shift']());}};_0x59ebf3(++_0x4fcbb8);}(_0x014e,0x16d));var _0xe014=function(_0x476b89,_0x2817d3){_0x476b89=_0x476b89-0x0;var _0x508f23=_0x014e[_0x476b89];return _0x508f23;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe014('0x0'));var rimraf=require(_0xe014('0x1'));var zipdir=require(_0xe014('0x2'));var jsonpatch=require(_0xe014('0x3'));var rp=require(_0xe014('0x4'));var moment=require(_0xe014('0x5'));var BPromise=require(_0xe014('0x6'));var Mustache=require(_0xe014('0x7'));var util=require(_0xe014('0x8'));var path=require('path');var sox=require(_0xe014('0x9'));var csv=require(_0xe014('0xa'));var ejs=require(_0xe014('0xb'));var fs=require('fs');var _=require(_0xe014('0xc'));var squel=require(_0xe014('0xd'));var crypto=require(_0xe014('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe014('0xf'));var toCsv=require(_0xe014('0xa'));var querystring=require(_0xe014('0x10'));var Papa=require(_0xe014('0x11'));var Redis=require(_0xe014('0x12'));var authService=require(_0xe014('0x13'));var qs=require(_0xe014('0x14'));var as=require(_0xe014('0x15'));var hardwareService=require(_0xe014('0x16'));var logger=require(_0xe014('0x17'))(_0xe014('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe014('0x19'));var db=require(_0xe014('0x1a'))['db'];config[_0xe014('0x1b')]=_['defaults'](config[_0xe014('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe014('0x1b')]));require(_0xe014('0x1c'))['register'](socket);function respondWithStatusCode(_0x284034,_0x1d17a5){_0x1d17a5=_0x1d17a5||0xcc;return function(_0xa524ac){if(_0xa524ac){return _0x284034[_0xe014('0x1d')](_0x1d17a5);}return _0x284034[_0xe014('0x1e')](_0x1d17a5)[_0xe014('0x1f')]();};}function respondWithResult(_0x4ab119,_0x5f1329){_0x5f1329=_0x5f1329||0xc8;return function(_0x246aa2){if(_0x246aa2){return _0x4ab119[_0xe014('0x1e')](_0x5f1329)[_0xe014('0x20')](_0x246aa2);}};}function respondWithFilteredResult(_0x172282,_0x19d413){return function(_0x22248f){if(_0x22248f){var _0xdc7ead=_0x22248f[_0xe014('0x21')],_0x38808f=_0x19d413[_0xe014('0x22')],_0x45cb3f=_0x19d413[_0xe014('0x22')]+_0x19d413['limit'],_0x7e3ecf;if(_0x45cb3f>=_0xdc7ead){_0x45cb3f=_0xdc7ead;_0x7e3ecf=0xc8;}else{_0x7e3ecf=0xce;}_0x172282[_0xe014('0x1e')](_0x7e3ecf);return _0x172282[_0xe014('0x23')](_0xe014('0x24'),_0x38808f+'-'+_0x45cb3f+'/'+_0xdc7ead)[_0xe014('0x20')](_0x22248f);}return null;};}function patchUpdates(_0x39bef1){return function(_0x1a58c0){try{jsonpatch[_0xe014('0x25')](_0x1a58c0,_0x39bef1,!![]);}catch(_0x5a572f){return BPromise[_0xe014('0x26')](_0x5a572f);}return _0x1a58c0[_0xe014('0x27')]();};}function saveUpdates(_0x25d86e,_0xd6e7da){return function(_0xf774ea){if(_0xf774ea){return _0xf774ea['update'](_0x25d86e)['then'](function(_0x1c5946){return _0x1c5946;});}return null;};}function removeEntity(_0x2fbc7c,_0x1f0803){return function(_0x5d9355){if(_0x5d9355){return _0x5d9355[_0xe014('0x28')]()[_0xe014('0x29')](function(){_0x2fbc7c['status'](0xcc)[_0xe014('0x1f')]();});}};}function handleEntityNotFound(_0x13c133,_0x7be509){return function(_0x1144d8){if(!_0x1144d8){_0x13c133[_0xe014('0x1d')](0x194);}return _0x1144d8;};}function handleError(_0x367832,_0x5215b9){_0x5215b9=_0x5215b9||0x1f4;return function(_0x1a7e0b){logger[_0xe014('0x2a')](_0x1a7e0b[_0xe014('0x2b')]);if(_0x1a7e0b[_0xe014('0x2c')]){delete _0x1a7e0b['name'];}_0x367832['status'](_0x5215b9)[_0xe014('0x2d')](_0x1a7e0b);};}exports[_0xe014('0x2e')]=function(_0x1cf8d3,_0x4c59ad){var _0x39c458={},_0x3e5e5d={},_0x5b9548={'count':0x0,'rows':[]};var _0x48b7d1=_['map'](db['UserProfile'][_0xe014('0x2f')],function(_0x1e0735){return{'name':_0x1e0735[_0xe014('0x30')],'type':_0x1e0735[_0xe014('0x31')]['key']};});_0x3e5e5d[_0xe014('0x32')]=_[_0xe014('0x33')](_0x48b7d1,_0xe014('0x2c'));_0x3e5e5d[_0xe014('0x34')]=_[_0xe014('0x35')](_0x1cf8d3[_0xe014('0x34')]);_0x3e5e5d['filters']=_[_0xe014('0x36')](_0x3e5e5d['model'],_0x3e5e5d[_0xe014('0x34')]);_0x39c458[_0xe014('0x37')]=_[_0xe014('0x36')](_0x3e5e5d['model'],qs[_0xe014('0x38')](_0x1cf8d3[_0xe014('0x34')]['fields']));_0x39c458[_0xe014('0x37')]=_0x39c458[_0xe014('0x37')][_0xe014('0x39')]?_0x39c458['attributes']:_0x3e5e5d['model'];if(!_0x1cf8d3[_0xe014('0x34')][_0xe014('0x3a')](_0xe014('0x3b'))){_0x39c458[_0xe014('0x3c')]=qs[_0xe014('0x3c')](_0x1cf8d3[_0xe014('0x34')][_0xe014('0x3c')]);_0x39c458[_0xe014('0x22')]=qs['offset'](_0x1cf8d3[_0xe014('0x34')][_0xe014('0x22')]);}_0x39c458['order']=qs[_0xe014('0x3d')](_0x1cf8d3[_0xe014('0x34')][_0xe014('0x3d')]);_0x39c458[_0xe014('0x3e')]=qs['filters'](_[_0xe014('0x3f')](_0x1cf8d3[_0xe014('0x34')],_0x3e5e5d[_0xe014('0x40')]),_0x48b7d1);if(_0x1cf8d3[_0xe014('0x34')]['filter']){_0x39c458[_0xe014('0x3e')]=_[_0xe014('0x41')](_0x39c458[_0xe014('0x3e')],{'$or':_[_0xe014('0x33')](_0x48b7d1,function(_0x1d5acc){if(_0x1d5acc[_0xe014('0x31')]!==_0xe014('0x42')){var _0x36f54d={};_0x36f54d[_0x1d5acc[_0xe014('0x2c')]]={'$like':'%'+_0x1cf8d3[_0xe014('0x34')][_0xe014('0x43')]+'%'};return _0x36f54d;}})});}_0x39c458=_[_0xe014('0x41')]({},_0x39c458,_0x1cf8d3[_0xe014('0x44')]);var _0x597ff4={'where':_0x39c458[_0xe014('0x3e')]};return db[_0xe014('0x45')][_0xe014('0x21')](_0x597ff4)[_0xe014('0x29')](function(_0x371d03){_0x5b9548[_0xe014('0x21')]=_0x371d03;if(_0x1cf8d3[_0xe014('0x34')]['includeAll']){_0x39c458['include']=[{'all':!![]}];}return db[_0xe014('0x45')][_0xe014('0x46')](_0x39c458);})['then'](function(_0xfd32e8){_0x5b9548[_0xe014('0x47')]=_0xfd32e8;return _0x5b9548;})[_0xe014('0x29')](respondWithFilteredResult(_0x4c59ad,_0x39c458))[_0xe014('0x48')](handleError(_0x4c59ad,null));};exports[_0xe014('0x49')]=function(_0x4300fa,_0x4cdfe7){var _0x1ddd2a={'raw':![],'where':{'id':_0x4300fa[_0xe014('0x4a')]['id']}},_0x368911={};_0x368911[_0xe014('0x32')]=_['keys'](db['UserProfile'][_0xe014('0x2f')]);_0x368911[_0xe014('0x34')]=_[_0xe014('0x35')](_0x4300fa[_0xe014('0x34')]);_0x368911[_0xe014('0x40')]=_[_0xe014('0x36')](_0x368911[_0xe014('0x32')],_0x368911[_0xe014('0x34')]);_0x1ddd2a['attributes']=_['intersection'](_0x368911[_0xe014('0x32')],qs[_0xe014('0x38')](_0x4300fa['query'][_0xe014('0x38')]));_0x1ddd2a['attributes']=_0x1ddd2a[_0xe014('0x37')][_0xe014('0x39')]?_0x1ddd2a[_0xe014('0x37')]:_0x368911['model'];if(_0x4300fa[_0xe014('0x34')][_0xe014('0x4b')]){_0x1ddd2a[_0xe014('0x4c')]=[{'all':!![]}];}_0x1ddd2a=_[_0xe014('0x41')]({},_0x1ddd2a,_0x4300fa[_0xe014('0x44')]);return db[_0xe014('0x45')][_0xe014('0x4d')](_0x1ddd2a)[_0xe014('0x29')](handleEntityNotFound(_0x4cdfe7,null))[_0xe014('0x29')](respondWithResult(_0x4cdfe7,null))[_0xe014('0x48')](handleError(_0x4cdfe7,null));};exports[_0xe014('0x4e')]=function(_0x34b077,_0x5c8fdc){return db[_0xe014('0x45')][_0xe014('0x4e')](_0x34b077[_0xe014('0x4f')],{})['then'](respondWithResult(_0x5c8fdc,0xc9))[_0xe014('0x48')](handleError(_0x5c8fdc,null));};exports[_0xe014('0x50')]=function(_0x50e5fd,_0x2f5ff1){var _0x3ed83a={'where':{'id':_0x50e5fd['params']['id']}},_0x47779d={};_0x47779d['model']=_[_0xe014('0x35')](db[_0xe014('0x45')][_0xe014('0x2f')]);_0x3ed83a[_0xe014('0x37')]=_[_0xe014('0x36')](_0x47779d['model'],qs[_0xe014('0x38')](_0x50e5fd[_0xe014('0x34')][_0xe014('0x38')]));_0x3ed83a[_0xe014('0x37')]=_0x3ed83a[_0xe014('0x37')]['length']?_0x3ed83a[_0xe014('0x37')]:_0x47779d['model'];if(_0x50e5fd['query']['includeAll']){_0x3ed83a['include']=[{'all':!![]}];}_0x3ed83a=_[_0xe014('0x41')]({},_0x3ed83a,_0x50e5fd[_0xe014('0x44')]);return db[_0xe014('0x45')][_0xe014('0x4d')](_0x3ed83a)['then'](handleEntityNotFound(_0x2f5ff1,null))[_0xe014('0x29')](function(_0x2f874e){if(_0x2f874e){var _0x14d456=_0x2f874e['get']({'plain':!![]});_0x14d456=qs['omit'](_0x14d456,['id',_0xe014('0x51'),'updatedAt',_0xe014('0x52')]);_0x50e5fd[_0xe014('0x4f')]=_[_0xe014('0x53')](_0x50e5fd[_0xe014('0x4f')],['id',_0xe014('0x51'),_0xe014('0x54')]);return db[_0xe014('0x55')][_0xe014('0x56')](function(_0x4410ca){return db['UserProfile'][_0xe014('0x4e')](_[_0xe014('0x41')](_0x14d456,_0x50e5fd[_0xe014('0x4f')]),{'include':_0x50e5fd[_0xe014('0x34')][_0xe014('0x4b')]?[{'all':!![]}]:undefined,'transaction':_0x4410ca})[_0xe014('0x29')](function(_0x31c0ed){var _0x58c0eb=_0x31c0ed[_0xe014('0x57')]({'plain':!![]});return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x50e5fd[_0xe014('0x4a')]['id']},'raw':!![]})[_0xe014('0x29')](function(_0x4c1c6d){if(_0x4c1c6d){return BPromise['each'](_0x4c1c6d,function(_0x21ec01){return new BPromise(function(_0x3a7d60,_0x3f0cc7){if(_0x21ec01[_0xe014('0x59')]===null||_0x21ec01[_0xe014('0x59')]===0x1)_0x3a7d60(null);return db[_0xe014('0x5a')][_0xe014('0x46')]({'where':{'sectionId':_0x21ec01['id']},'raw':!![]})[_0xe014('0x29')](function(_0x579bb3){var _0x3f2128=_[_0xe014('0x33')](_0x579bb3,function(_0x39512b){return qs[_0xe014('0x53')](_0x39512b,['id',_0xe014('0x51'),_0xe014('0x54'),'sectionId']);});_0x3a7d60(_0x3f2128);})[_0xe014('0x48')](function(_0xf67d3){_0x3f0cc7(_0xf67d3);});})[_0xe014('0x29')](function(_0x29373c){var _0x202da4=qs['omit'](_0x21ec01,['id','createdAt',_0xe014('0x54')]);_0x202da4[_0xe014('0x5b')]=_0x58c0eb['id'];if(_0x29373c)_0x202da4[_0xe014('0x5c')]=_0x29373c;return _0x202da4;})[_0xe014('0x29')](function(_0x4ae8a0){return db['UserProfileSection'][_0xe014('0x4e')](_0x4ae8a0,{'include':[{'model':db['UserProfileResource'],'as':_0xe014('0x5c')}],'raw':!![],'transaction':_0x4410ca});});})[_0xe014('0x29')](function(){return _0x58c0eb;});}});});});}})[_0xe014('0x29')](respondWithResult(_0x2f5ff1,0xc9))[_0xe014('0x48')](handleError(_0x2f5ff1,null));};exports[_0xe014('0x5d')]=function(_0x475250,_0x1046e5){if(_0x475250['body']['id']){delete _0x475250[_0xe014('0x4f')]['id'];}return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x475250[_0xe014('0x4a')]['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x1046e5,null))[_0xe014('0x29')](saveUpdates(_0x475250[_0xe014('0x4f')],null))[_0xe014('0x29')](respondWithResult(_0x1046e5,null))['catch'](handleError(_0x1046e5,null));};exports[_0xe014('0x28')]=function(_0x684aa1,_0x59201a){return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x684aa1['params']['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x59201a,null))[_0xe014('0x29')](removeEntity(_0x59201a,null))[_0xe014('0x48')](handleError(_0x59201a,null));};exports[_0xe014('0x5e')]=function(_0x529aa5,_0x19e1f6){return db[_0xe014('0x45')][_0xe014('0x5e')]()[_0xe014('0x29')](respondWithResult(_0x19e1f6,null))[_0xe014('0x48')](handleError(_0x19e1f6,null));};exports['addSections']=function(_0x544416,_0x221635){var _0x296025=_0x544416[_0xe014('0x4f')];return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x544416['params']['id']}})['then'](handleEntityNotFound(_0x221635,null))[_0xe014('0x29')](function(_0x492337){if(_0x492337){return db[_0xe014('0x55')][_0xe014('0x56')](function(_0x256c51){return db['UserProfileSection'][_0xe014('0x28')]({'where':{'userProfileId':_0x544416['params']['id'],'sectionId':_[_0xe014('0x33')](_0x296025,function(_0x4d1c22){return _0x4d1c22[_0xe014('0x5f')];})},'transaction':_0x256c51})[_0xe014('0x29')](function(){var _0x3d722a=_[_0xe014('0x33')](_0x296025,function(_0x3e85ae){_0x3e85ae[_0xe014('0x5b')]=_0x544416['params']['id'];return _0x3e85ae;});var _0x5e2124=[];return BPromise['each'](_0x3d722a,function(_0x42416c){return db[_0xe014('0x58')]['create'](_0x42416c,{'include':[{'model':db['UserProfileResource'],'as':_0xe014('0x5c')}],'raw':!![],'transaction':_0x256c51})[_0xe014('0x29')](function(_0x3f5110){_0x5e2124[_0xe014('0x60')](_0x3f5110['get']({'plain':!![]}));});})[_0xe014('0x29')](function(){return _0x5e2124;});});});}})[_0xe014('0x29')](function(_0x26fd86){return _0x26fd86;})['then'](respondWithResult(_0x221635,null))[_0xe014('0x48')](handleError(_0x221635,null));};exports['removeSections']=function(_0x299a38,_0x9f04f3){var _0x7c610b;return db['UserProfile'][_0xe014('0x4d')]({'where':{'id':_0x299a38[_0xe014('0x4a')]['id']},'attributes':['id','name']})[_0xe014('0x29')](handleEntityNotFound(_0x9f04f3,null))[_0xe014('0x29')](function(_0x5b1811){if(_0x5b1811){_0x7c610b=_0x5b1811;return db['UserProfileSection'][_0xe014('0x28')]({'where':{'userProfileId':_0x299a38[_0xe014('0x4a')]['id'],'sectionId':_0x299a38[_0xe014('0x34')][_0xe014('0x61')]}});}})['then'](function(){return _0x7c610b;})[_0xe014('0x29')](respondWithStatusCode(_0x9f04f3,null))[_0xe014('0x48')](handleError(_0x9f04f3,null));};exports[_0xe014('0x62')]=function(_0x172f71,_0x32baaf){var _0x27e7be=[];var _0x1ebfcf=[];return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x172f71[_0xe014('0x4a')]['id']},'raw':!![]})[_0xe014('0x29')](function(_0x392e22){_0x27e7be=_['filter'](_0x392e22,function(_0x3a3fe1){return _0x3a3fe1[_0xe014('0x63')]===0x1||_[_0xe014('0x64')]([0x3eb,0x709],_0x3a3fe1[_0xe014('0x5f')]);});if(!_[_0xe014('0x65')](_0x27e7be)){return _[_0xe014('0x33')](_0x27e7be,function(_0x3b0ef5){return _0x3b0ef5['sectionId'];});}else{return;}})[_0xe014('0x29')](function(_0x43d3d4){if(_0x43d3d4)_0x1ebfcf=_0x43d3d4;if(_[_0xe014('0x64')](_0x1ebfcf,0x64)){var _0x9bc974=_['find'](_0x27e7be,{'sectionId':0x64});return hasDefaultDashboard(_0x9bc974)['then'](function(_0x936709){return _['map'](_0x27e7be,function(_0x206806){if(_0x206806['sectionId']===0x64){_0x206806['subsections']=_0x936709;}return _0x206806;});});}else{return;}})[_0xe014('0x29')](function(_0x809857){if(_0x809857)_0x27e7be=_0x809857;if(_[_0xe014('0x64')](_0x1ebfcf,0x3eb)){var _0x573500=_['find'](_0x27e7be,{'sectionId':0x3eb});return getCustomDashboards(_0x573500)[_0xe014('0x29')](function(_0x538b05){return _[_0xe014('0x33')](_0x27e7be,function(_0x4ef7c5){if(_0x573500[_0xe014('0x63')]){if(_0x4ef7c5[_0xe014('0x5f')]===0x3eb){_0x4ef7c5[_0xe014('0x66')]=_0x538b05;}}else{if(_0x4ef7c5[_0xe014('0x5f')]===0x64){_0x4ef7c5[_0xe014('0x66')]=_0x538b05;}}return _0x4ef7c5;});});}else{return;}})[_0xe014('0x29')](function(_0x1a4e6e){if(_0x1a4e6e)_0x27e7be=_0x1a4e6e;if(_[_0xe014('0x64')](_0x1ebfcf,0x709)){var _0xd61418=_[_0xe014('0x4d')](_0x27e7be,{'sectionId':0x709});return getPlugins(_0xd61418)[_0xe014('0x29')](function(_0x19b003){if(_0xd61418[_0xe014('0x63')]){return _['map'](_0x27e7be,function(_0x3a3eef){if(_0x3a3eef['sectionId']===0x709){_0x3a3eef[_0xe014('0x66')]=_0x19b003;}return _0x3a3eef;});}else{var _0x3c9f14={'sectionId':0x76c,'enabled':0x1,'subsections':_0x19b003};var _0x3633ea=_[_0xe014('0x33')](_0x27e7be);_0x3633ea[_0xe014('0x60')](_0x3c9f14);return _0x3633ea;}});}else{return;}})[_0xe014('0x29')](function(_0x408d94){if(_0x408d94)_0x27e7be=_0x408d94;return _[_0xe014('0x43')](_0x27e7be,[_0xe014('0x63'),0x1]);})['then'](respondWithResult(_0x32baaf,null))[_0xe014('0x48')](handleError(_0x32baaf,null));};function hasDefaultDashboard(_0x5aabe5){var _0xaf65d7=[0x65];return new BPromise(function(_0x4b778f,_0x381e64){try{if(_0x5aabe5[_0xe014('0x59')]){_0x4b778f(_0xaf65d7);}else{return db[_0xe014('0x5a')][_0xe014('0x67')]({'where':{'sectionId':_0x5aabe5['id']},'raw':!![]})[_0xe014('0x29')](function(_0x1528f0){_0x1528f0?_0x4b778f(_0xaf65d7):_0x4b778f();});}}catch(_0x1ef942){_0x381e64(_0x1ef942);}});}function getCustomDashboards(_0x1e0546){var _0x1a1750=[];return new BPromise(function(_0x47cdef,_0x40faf6){try{if(_0x1e0546['autoAssociation']){return db['Dashboard'][_0xe014('0x46')]({'raw':!![]})['then'](function(_0x412a3f){_0x412a3f['forEach'](function(_0x432296){_0x1a1750[_0xe014('0x60')](_0x432296['id']+0x1869f);});_0x47cdef(_0x1a1750);});}else{return db[_0xe014('0x5a')][_0xe014('0x46')]({'where':{'sectionId':_0x1e0546['id']},'raw':!![]})[_0xe014('0x29')](function(_0x411052){_0x411052[_0xe014('0x68')](function(_0x10ab8d){_0x1a1750[_0xe014('0x60')](_0x10ab8d[_0xe014('0x69')]+0x1869f);});_0x47cdef(_0x1a1750);});}}catch(_0x23479e){_0x40faf6(_0x23479e);}});}function getPlugins(_0x5642f2){var _0x188ca2=[];return new BPromise(function(_0x2fb4c7,_0x1266fe){try{if(_0x5642f2[_0xe014('0x59')]){return db['Plugin'][_0xe014('0x46')]({'raw':!![]})[_0xe014('0x29')](function(_0x1d7a7c){_0x1d7a7c['forEach'](function(_0x285338){_0x188ca2['push'](_0x285338['id']+0x15b38);});_0x2fb4c7(_0x188ca2);});}else{return db[_0xe014('0x5a')][_0xe014('0x46')]({'where':{'sectionId':_0x5642f2['id']},'raw':!![]})[_0xe014('0x29')](function(_0x15cd4e){_0x15cd4e[_0xe014('0x68')](function(_0x5eec00){_0x188ca2[_0xe014('0x60')](_0x5eec00[_0xe014('0x69')]+0x15b38);});_0x2fb4c7(_0x188ca2);});}}catch(_0x5a000d){_0x1266fe(_0x5a000d);}});}exports[_0xe014('0x6a')]=function(_0x2605e0,_0x1681d6){return db[_0xe014('0x45')][_0xe014('0x4d')]({'where':{'id':_0x2605e0[_0xe014('0x4a')]['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x1681d6,null))[_0xe014('0x29')](function(_0x1d4ec3){if(_0x1d4ec3){return db[_0xe014('0x55')][_0xe014('0x56')](function(_0x590fd1){return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x2605e0[_0xe014('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xe014('0x29')](function(_0xb55927){if(_0xb55927){return db[_0xe014('0x58')][_0xe014('0x28')]({'where':{'userProfileId':_0x2605e0[_0xe014('0x4a')]['id'],'id':_[_0xe014('0x33')](_0xb55927,function(_0x254554){return _0x254554['id'];})},'transaction':_0x590fd1});}})[_0xe014('0x29')](function(_0x49505f){var _0x44edaa=_[_0xe014('0x33')](_0x2605e0[_0xe014('0x4f')],function(_0x1dfbdd){_0x1dfbdd['userProfileId']=_0x2605e0[_0xe014('0x4a')]['id'];return _0x1dfbdd;});return db[_0xe014('0x58')][_0xe014('0x6b')](_0x44edaa,{'raw':!![],'transaction':_0x590fd1});})[_0xe014('0x29')](function(_0x91e091){var _0x4fabe3=_[_0xe014('0x43')](_['map'](_0x91e091,function(_0x927846){return _0x927846[_0xe014('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x4fabe3){return db[_0xe014('0x58')][_0xe014('0x46')]({'where':{'userProfileId':_0x2605e0[_0xe014('0x4a')]['id'],'sectionId':_[_0xe014('0x33')](_0x4fabe3,function(_0x45c525){return _0x45c525['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xe014('0x29')](function(_0x4532c7){var _0x55b366=_[_0xe014('0x33')](_0x2605e0[_0xe014('0x4f')],function(_0x12bb5e){_0x12bb5e[_0xe014('0x5b')]=_0x2605e0['params']['id'];return _0x12bb5e;});return db[_0xe014('0x5a')]['bulkCreate'](_0x55b366,{'raw':!![],'transaction':_0x590fd1});});}})['catch'](handleError(_0x1681d6,null));});}})[_0xe014('0x29')](function(_0x2d44f8){var _0x255746=_[_0xe014('0x33')](_0x2d44f8,function(_0x3d2e20){return _0x3d2e20[_0xe014('0x57')]({'plain':!![]});});})[_0xe014('0x29')](respondWithResult(_0x1681d6,null))[_0xe014('0x48')](handleError(_0x1681d6,null));};exports['removeResources']=function(_0x107a04,_0x2a560a,_0x3b6408){return db[_0xe014('0x45')]['find']({'where':{'id':_0x107a04['params']['id']}})['then'](handleEntityNotFound(_0x2a560a,null))[_0xe014('0x29')](function(_0x455da8){if(_0x455da8){return _0x455da8[_0xe014('0x6c')](_0x107a04['query']['ids']);}})[_0xe014('0x29')](respondWithStatusCode(_0x2a560a,null))[_0xe014('0x48')](handleError(_0x2a560a,null));};exports[_0xe014('0x6d')]=function(_0xcc90d9,_0x3b3836){var _0x3d0564={'raw':![],'where':{}};var _0x508506={};var _0x3a589e={'count':0x0,'rows':[]};var _0x4ac5c6=_0xcc90d9[_0xe014('0x34')]['section'];if(typeof _0x4ac5c6===_0xe014('0x6e')){throw new db[(_0xe014('0x6f'))][(_0xe014('0x70'))](_0xe014('0x71'));}var _0x2385b3=_0xcc90d9['query'][_0xe014('0x72')]||![];var _0x11522c=getQueryModels(_0x4ac5c6,_0x2385b3);if(typeof _0x11522c[_0xe014('0x73')]==='undefined'){throw new db[(_0xe014('0x6f'))]['ValidationError'](_0xe014('0x74')+_0x4ac5c6+'\x27');}var _0x49c4bb=[];if(!_['isEmpty'](_0x11522c[_0xe014('0x75')])){_0x49c4bb=_0x11522c[_0xe014('0x75')];}else{_0x49c4bb=[{'name':_0x4ac5c6}];}return db['UserProfile']['findOne']({'where':{'id':_0xcc90d9[_0xe014('0x4a')]['id']}})[_0xe014('0x29')](handleEntityNotFound(_0x3b3836,null))[_0xe014('0x29')](function(_0x413ddf){if(_0x413ddf){var _0x5b30c3=[];for(var _0x1a7bdd=0x0;_0x1a7bdd<_0x49c4bb[_0xe014('0x39')];_0x1a7bdd++){_0x5b30c3[_0xe014('0x60')](db[_0xe014('0x58')][_0xe014('0x67')]({'where':{'userProfileId':_0x413ddf['id'],'name':_0x49c4bb[_0x1a7bdd][_0xe014('0x2c')]},'raw':!![]}));}return BPromise[_0xe014('0x76')](_0x5b30c3);}})[_0xe014('0x29')](function(_0x294cef){var _0x2a2f69=_[_0xe014('0x43')](_0x294cef,function(_0x4c7c5e){return _0x4c7c5e?_0x4c7c5e:undefined;});var _0x5ed568=_[_0xe014('0x43')](_0x49c4bb,[_0xe014('0x77'),!![]]);var _0x1d6bfe=_[_0xe014('0x65')](_0x2a2f69)&&_[_0xe014('0x65')](_0x5ed568)?null:_['union'](_0x5ed568,_0x2a2f69);if(_0x1d6bfe){var _0x51d917=[];for(var _0x11f73f=0x0;_0x11f73f<_0x1d6bfe[_0xe014('0x39')];_0x11f73f++){var _0x437b98=_[_0xe014('0x4d')](_0x49c4bb,function(_0x44d927){return _0x1d6bfe[_0x11f73f]?_0x44d927[_0xe014('0x2c')]===_0x1d6bfe[_0x11f73f][_0xe014('0x2c')]:null;});if(_0x437b98){if(_0x1d6bfe[_0x11f73f]['ignore']){_0x51d917[_0xe014('0x60')](getAllResources(_0x11522c[_0xe014('0x73')],_0x1d6bfe[_0x11f73f]));}else{if(!_0x1d6bfe[_0x11f73f][_0xe014('0x59')]){_0x51d917[_0xe014('0x60')](getAllowedResources(_0x437b98,_0x1d6bfe[_0x11f73f],_0x11522c[_0xe014('0x73')]));}else{if(_0x437b98[_0xe014('0x32')]){_0x51d917[_0xe014('0x60')](getAllFilteredResources(_0x437b98,_0x1d6bfe[_0x11f73f]));}}}}}return BPromise[_0xe014('0x76')](_0x51d917);}else{return null;}})['then'](function(_0x5f0a22){var _0x57b3d4=_0x5f0a22;var _0x94f0d2=null;if(_0x57b3d4){_0x94f0d2=_0x57b3d4[_0xe014('0x39')]===0x1?_0x57b3d4[0x0]:null;}if(_0x94f0d2||_0x57b3d4){var _0x2897b3=db[_0x11522c['childModel']][_0xe014('0x2f')];_0x508506[_0xe014('0x32')]=_[_0xe014('0x35')](_0x2897b3);_0x508506['query']=_[_0xe014('0x35')](_0xcc90d9[_0xe014('0x34')]);_0x508506[_0xe014('0x40')]=_['intersection'](_0x508506[_0xe014('0x32')],_0x508506[_0xe014('0x34')]);_0x3d0564[_0xe014('0x37')]=_[_0xe014('0x36')](_0x508506[_0xe014('0x32')],qs[_0xe014('0x38')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x38')]));_0x3d0564['attributes']=_0x3d0564['attributes']['length']?_0x3d0564['attributes']:_0x508506[_0xe014('0x32')];if(!_0xcc90d9[_0xe014('0x34')][_0xe014('0x3a')]('nolimit')){_0x3d0564[_0xe014('0x3c')]=qs[_0xe014('0x3c')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x3c')]);_0x3d0564[_0xe014('0x22')]=qs[_0xe014('0x22')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x22')]);}_0x3d0564[_0xe014('0x78')]=qs[_0xe014('0x3d')](_0xcc90d9[_0xe014('0x34')][_0xe014('0x3d')]);_0x3d0564[_0xe014('0x3e')]=qs[_0xe014('0x40')](_[_0xe014('0x3f')](_0xcc90d9[_0xe014('0x34')],_0x508506[_0xe014('0x40')]));if(_0xcc90d9['query']['filter']){_0x3d0564[_0xe014('0x3e')]=_[_0xe014('0x41')](_0x3d0564[_0xe014('0x3e')],{'$or':_['map'](_0x2897b3,function(_0x50f76f){if(_0x50f76f[_0xe014('0x31')]['key']!==_0xe014('0x42')){var _0x211641={};_0x211641[_0x50f76f['field']]={'$like':'%'+_0xcc90d9[_0xe014('0x34')][_0xe014('0x43')]+'%'};return _0x211641;}})});}var _0x5a1496=[];if(_0x94f0d2){var _0x249351=_[_0xe014('0x4d')](_0x49c4bb,[_0xe014('0x2c'),_0x94f0d2[_0xe014('0x2c')]]);if(_0x249351[_0xe014('0x79')]){var _0x296c47={};if(_0x11522c[_0xe014('0x73')]===_0xe014('0x7a')){_0x296c47[_0x249351[_0xe014('0x7b')]]=_['map'](_0x94f0d2['associatedResources'],'id');}else{_0x296c47[_0x249351['foreignKey']]=_0x94f0d2['associatedResources'];}_0x5a1496[_0xe014('0x60')](_0x296c47);}else{_0x3d0564[_0xe014('0x3e')]['id']=_0x94f0d2['associatedResources'];}}else{for(var _0x5c42e9=0x0;_0x5c42e9<_0x57b3d4[_0xe014('0x39')];_0x5c42e9++){var _0x249351=_['find'](_0x49c4bb,[_0xe014('0x2c'),_0x57b3d4[_0x5c42e9][_0xe014('0x2c')]]);if(_0x249351[_0xe014('0x79')]){var _0x296c47={};_0x296c47[_0x249351['foreignKey']]=_0x57b3d4[_0x5c42e9][_0xe014('0x7c')];_0x5a1496[_0xe014('0x60')](_0x296c47);}else{if(!_0x3d0564[_0xe014('0x3e')]['id'])_0x3d0564['where']['id']=[];_0x57b3d4[_0x5c42e9][_0xe014('0x7c')]['forEach'](function(_0x16db46){_0x3d0564[_0xe014('0x3e')]['id'][_0xe014('0x60')](_0x16db46);});}}}if(!_['isEmpty'](_0x5a1496)){_0x3d0564[_0xe014('0x3e')]=_[_0xe014('0x41')](_0x3d0564[_0xe014('0x3e')],{'$and':{'$or':_0x5a1496}});}_0x3d0564=_[_0xe014('0x41')]({},_0x3d0564,_0xcc90d9[_0xe014('0x44')]);if(_0x94f0d2&&!_0x94f0d2[_0xe014('0x59')]&&_0x11522c[_0xe014('0x73')]==='AnalyticExtractedReport'){if(_0xcc90d9[_0xe014('0x34')][_0xe014('0x4b')]){_0x3d0564['include']=[{'all':!![]}];}return db[_0x11522c[_0xe014('0x73')]][_0xe014('0x46')](_0x3d0564)[_0xe014('0x29')](function(_0x435763){var _0x12bd70=[];_0x435763[_0xe014('0x68')](function(_0x345fa9){var _0x1ad02a;switch(_0x345fa9[_0xe014('0x7d')]){case _0xe014('0x7e'):_0x1ad02a=_[_0xe014('0x4d')](_0x94f0d2[_0xe014('0x7c')],function(_0x18399d){return _0x18399d['id']===_0x345fa9['reportId']&&_0x18399d[_0xe014('0x31')]===_0xe014('0x7f');});break;case'custom':_0x1ad02a=_['find'](_0x94f0d2[_0xe014('0x7c')],function(_0x897e84){return _0x897e84['id']===_0x345fa9[_0xe014('0x80')]&&_0x897e84[_0xe014('0x31')]===_0xe014('0x81');});break;}if(_0x1ad02a)_0x12bd70[_0xe014('0x60')](_0x345fa9);});_0x3a589e[_0xe014('0x21')]=_0x12bd70['length'];_0x3a589e[_0xe014('0x47')]=_0x12bd70;return _0x3a589e;});}else{return db[_0x11522c['childModel']]['count']({'where':_0x3d0564[_0xe014('0x3e')]})[_0xe014('0x29')](function(_0x412125){_0x3a589e['count']=_0x412125;if(_0xcc90d9[_0xe014('0x34')][_0xe014('0x4b')]){if(_0x11522c[_0xe014('0x73')]===_0xe014('0x82')){_0x3d0564[_0xe014('0x4c')]=[{'model':db[_0xe014('0x83')],'as':_0xe014('0x84'),'attributes':['id',_0xe014('0x2c'),'color'],'required':_0xcc90d9[_0xe014('0x34')][_0xe014('0x85')]?!![]:![]},{'model':db[_0xe014('0x83')],'as':'ThroughTags','attributes':['id',_0xe014('0x2c'),_0xe014('0x86')],'through':_0xcc90d9[_0xe014('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0xcc90d9['query'][_0xe014('0x85')]||undefined}}:{},'required':_0xcc90d9[_0xe014('0x34')][_0xe014('0x85')]?!![]:![]}];}else{_0x3d0564[_0xe014('0x4c')]=[{'all':!![]}];}}return db[_0x11522c['childModel']][_0xe014('0x46')](_0x3d0564);})[_0xe014('0x29')](function(_0xe5cc08){_0x3a589e[_0xe014('0x47')]=_0xe5cc08;return _0x3a589e;});}}else{return _0x3a589e;}})[_0xe014('0x29')](respondWithFilteredResult(_0x3b3836,_0x3d0564))[_0xe014('0x48')](handleError(_0x3b3836,null));};function getAllResources(_0x431e92,_0x2f24cf){return new BPromise(function(_0x40a907,_0x407fe1){if(_0x2f24cf){var _0x97f5d8=_0x2f24cf[_0xe014('0x43')]?{[_0x2f24cf[_0xe014('0x43')][_0xe014('0x79')]]:_0x2f24cf[_0xe014('0x43')]['value']}:undefined;return db[_0x431e92][_0xe014('0x46')]({'where':_0x97f5d8,'raw':!![]})[_0xe014('0x29')](function(_0x436039){_0x2f24cf['associatedResources']=_[_0xe014('0x33')](_0x436039,'id');_0x40a907(_0x2f24cf);})[_0xe014('0x48')](function(_0x5168b9){_0x407fe1(_0x5168b9);});}else{_0x40a907(null);}});}function getAllFilteredResources(_0x590586,_0x28e597){return new BPromise(function(_0xadefef,_0x1e7d4e){var _0x36ac9c=_0x590586[_0xe014('0x43')]?{[_0x590586[_0xe014('0x43')][_0xe014('0x79')]]:_0x590586[_0xe014('0x43')]['value']}:undefined;return db[_0x590586[_0xe014('0x32')]]['findAll']({'where':_0x36ac9c,'raw':!![]})['then'](function(_0x4ec7fd){_0x28e597[_0xe014('0x7c')]=_['map'](_0x4ec7fd,function(_0x57c48b){return _0x57c48b[_0xe014('0x2c')];});_0xadefef(_0x28e597);})[_0xe014('0x48')](function(_0x13357a){_0x1e7d4e(_0x13357a);});});}function getAllowedResources(_0x5adaa6,_0x2e9e36,_0x5f1323){return new BPromise(function(_0x22533f,_0x59c698){if(_0x2e9e36){return db['UserProfileResource'][_0xe014('0x46')]({'where':{'sectionId':_0x2e9e36['id']},'raw':!![]})[_0xe014('0x29')](function(_0x3e455e){if(_0x5adaa6['field']&&_0x5adaa6[_0xe014('0x79')]!=='id'){_0x2e9e36[_0xe014('0x7c')]=_[_0xe014('0x33')](_0x3e455e,function(_0x6df8b5){return _0x6df8b5[_0x5adaa6['field']];});}else{if(_0x5f1323===_0xe014('0x7a')){_0x2e9e36[_0xe014('0x7c')]=_[_0xe014('0x33')](_0x3e455e,function(_0x2fb198){return{'id':_0x2fb198[_0xe014('0x69')],'type':_0x2fb198[_0xe014('0x31')]};});}else{_0x2e9e36[_0xe014('0x7c')]=_[_0xe014('0x33')](_0x3e455e,function(_0x48e74e){return _0x48e74e['resourceId'];});}}_0x22533f(_0x2e9e36);})[_0xe014('0x48')](function(_0x3e631d){_0x59c698(_0x3e631d);});}else{_0x22533f(null);}});}function getQueryModels(_0x8a0e2a,_0x44de78){var _0x663c09=_0x8a0e2a['toLowerCase']();var _0x2705c5={'childModel':undefined,'parentSections':[]};switch(_0x663c09){case _0xe014('0x87'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x88');break;case _0xe014('0x89'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x8a');break;case _0xe014('0x8b'):_0x2705c5['childModel']=_0xe014('0x8c');_0x2705c5[_0xe014('0x75')]=[{'name':_0xe014('0x8d'),'field':'name','foreignKey':_0xe014('0x8e')}];break;case'projects':_0x2705c5[_0xe014('0x73')]=_0xe014('0x8f');break;case _0xe014('0x90'):_0x2705c5['childModel']=_0xe014('0x82');_0x2705c5['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xe014('0x91'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x92');break;case _0xe014('0x93'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x94');break;case _0xe014('0x95'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x96');break;case _0xe014('0x97'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x98');break;case _0xe014('0x99'):_0x2705c5['childModel']='ChatWebsite';break;case _0xe014('0x9a'):_0x2705c5['childModel']='FaxQueue';break;case'faxaccounts':_0x2705c5[_0xe014('0x73')]=_0xe014('0x9b');break;case _0xe014('0x9c'):case _0xe014('0x9d'):case'outboundroutes':_0x2705c5[_0xe014('0x73')]=_0xe014('0x9e');break;case'contexts':_0x2705c5[_0xe014('0x73')]=_0xe014('0x9f');break;case _0xe014('0xa0'):_0x2705c5['childModel']=_0xe014('0xa1');break;case _0xe014('0xa2'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xa3');_0x2705c5['parentSections']=[{'name':_0xe014('0xa4'),'field':_0xe014('0x2c'),'foreignKey':_0xe014('0xa5'),'model':_0xe014('0xa6'),'filter':{'field':_0xe014('0xa7'),'value':[_0xe014('0xa8')]}},{'name':_0xe014('0xa9'),'field':'name','foreignKey':'membername','model':_0xe014('0xa6'),'filter':{'field':_0xe014('0xa7'),'value':[_0xe014('0xaa')]}},{'name':_0xe014('0xab'),'field':_0xe014('0x2c'),'foreignKey':_0xe014('0xac'),'model':_0xe014('0xad'),'filter':{'field':_0xe014('0x31'),'value':['inbound']}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xe014('0xac'),'model':_0xe014('0xad'),'filter':{'field':_0xe014('0x31'),'value':['outbound']}}];break;case'musiconholds':_0x2705c5[_0xe014('0x73')]=_0xe014('0xae');break;case'chanspies':_0x2705c5[_0xe014('0x73')]='VoiceChanSpy';break;case _0xe014('0xaf'):_0x2705c5['childModel']=_0xe014('0xb0');break;case _0xe014('0xb1'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xb2');break;case _0xe014('0xb3'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xb4');break;case'mailaccounts':_0x2705c5['childModel']=_0xe014('0xb5');break;case'mailsubstatuses':_0x2705c5[_0xe014('0x73')]=_0xe014('0xb6');break;case _0xe014('0xb7'):_0x2705c5['childModel']=_0xe014('0xb8');break;case _0xe014('0xb9'):_0x2705c5['childModel']='OpenchannelAccount';break;case _0xe014('0xba'):_0x2705c5['childModel']=_0xe014('0xbb');break;case'smsaccounts':_0x2705c5[_0xe014('0x73')]='SmsAccount';break;case _0xe014('0xbc'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xbd');break;case _0xe014('0xbe'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xbf');break;case _0xe014('0xc0'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xc1');break;case _0xe014('0xc2'):case _0xe014('0xc3'):_0x2705c5[_0xe014('0x73')]='VoiceQueue';if(_0x44de78){_0x2705c5['parentSections']=[{'name':_0xe014('0xab')},{'name':_0xe014('0xc4')}];}break;case _0xe014('0xc5'):case _0xe014('0xc6'):case _0xe014('0xc7'):_0x2705c5['childModel']=_0xe014('0xa6');if(_0x44de78){_0x2705c5[_0xe014('0x75')]=[{'name':'Users','filter':{'field':_0xe014('0xa7'),'value':[_0xe014('0xc8'),_0xe014('0xc9')]},'ignore':!![]},{'name':_0xe014('0xa4')},{'name':_0xe014('0xa9')}];}break;case _0xe014('0xca'):_0x2705c5[_0xe014('0x73')]='ZendeskAccount';break;case'salesforceaccounts':_0x2705c5['childModel']='SalesforceAccount';break;case _0xe014('0xcb'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xcc');break;case _0xe014('0xcd'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xce');break;case _0xe014('0xcf'):_0x2705c5['childModel']='DeskAccount';break;case'zohoaccounts':_0x2705c5[_0xe014('0x73')]=_0xe014('0xd0');break;case'vtigeraccounts':_0x2705c5[_0xe014('0x73')]='User';break;case _0xe014('0xd1'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd2');break;case _0xe014('0xd3'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd4');break;case _0xe014('0xd5'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd6');break;case'intervals':_0x2705c5[_0xe014('0x73')]='Interval';break;case _0xe014('0xd7'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xd8');break;case _0xe014('0xd9'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xda');break;case'sounds':_0x2705c5['childModel']=_0xe014('0xdb');break;case'tags':_0x2705c5[_0xe014('0x73')]=_0xe014('0x83');break;case _0xe014('0xdc'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xdd');break;case'triggers':_0x2705c5[_0xe014('0x73')]=_0xe014('0xde');break;case'trunks':_0x2705c5[_0xe014('0x73')]=_0xe014('0xdf');break;case _0xe014('0xe0'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xe1');break;case _0xe014('0xe2'):_0x2705c5[_0xe014('0x73')]=_0xe014('0xe3');break;case _0xe014('0xe4'):_0x2705c5[_0xe014('0x73')]=_0xe014('0x7a');_0x2705c5['parentSections']=[{'name':_0xe014('0xe5'),'field':'id','foreignKey':_0xe014('0x80')}];break;case _0xe014('0xe6'):_0x2705c5['childModel']=_0xe014('0xe7');break;case _0xe014('0xbe'):_0x2705c5[_0xe014('0x73')]='WhatsappAccount';break;default:return _0x2705c5;}return _0x2705c5;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 60f51b9..875a0dd 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 _0x995f=['hasOwnProperty','../../mysqldb','UserProfile','setMaxListeners','emit'];(function(_0xbe7a75,_0x2b4534){var _0x3d83ed=function(_0x188baf){while(--_0x188baf){_0xbe7a75['push'](_0xbe7a75['shift']());}};_0x3d83ed(++_0x2b4534);}(_0x995f,0xb0));var _0xf995=function(_0x2ce4bb,_0x4bc632){_0x2ce4bb=_0x2ce4bb-0x0;var _0x19356b=_0x995f[_0x2ce4bb];return _0x19356b;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf995('0x0'))['db'][_0xf995('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf995('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b879){return function(_0x23bb31,_0x129baf,_0x9ef59c){UserProfileEvents[_0xf995('0x3')](_0x22b879+':'+_0x23bb31['id'],_0x23bb31);UserProfileEvents[_0xf995('0x3')](_0x22b879,_0x23bb31);_0x9ef59c(null);};}for(var e in events){if(events[_0xf995('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x9ab2=['hook','exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x9ab2,0x1a6));var _0x29ab=function(_0x5bd03b,_0x477364){_0x5bd03b=_0x5bd03b-0x0;var _0x3bd1f7=_0x9ab2[_0x5bd03b];return _0x3bd1f7;};'use strict';var EventEmitter=require(_0x29ab('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x29ab('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x29ab('0x2')](0x0);var events={'afterCreate':_0x29ab('0x3'),'afterUpdate':_0x29ab('0x4'),'afterDestroy':_0x29ab('0x5')};function emitEvent(_0x30256c){return function(_0x5a6da2,_0x2d5614,_0x289b6e){UserProfileEvents[_0x29ab('0x6')](_0x30256c+':'+_0x5a6da2['id'],_0x5a6da2);UserProfileEvents[_0x29ab('0x6')](_0x30256c,_0x5a6da2);_0x289b6e(null);};}for(var e in events){if(events[_0x29ab('0x7')](e)){var event=events[e];UserProfile[_0x29ab('0x8')](e,emitEvent(event));}}module[_0x29ab('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 efbb81e..12c564f 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 _0x7ee0=['user_profiles','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','UserProfile'];(function(_0x4a3ee3,_0x304512){var _0x56d16d=function(_0x280251){while(--_0x280251){_0x4a3ee3['push'](_0x4a3ee3['shift']());}};_0x56d16d(++_0x304512);}(_0x7ee0,0x7a));var _0x07ee=function(_0x438008,_0x3e71f7){_0x438008=_0x438008-0x0;var _0x3da515=_0x7ee0[_0x438008];return _0x3da515;};'use strict';var _=require(_0x07ee('0x0'));var util=require(_0x07ee('0x1'));var logger=require(_0x07ee('0x2'))(_0x07ee('0x3'));var moment=require('moment');var BPromise=require(_0x07ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07ee('0x5'));var rimraf=require(_0x07ee('0x6'));var config=require(_0x07ee('0x7'));var attributes=require('./userProfile.attributes');module[_0x07ee('0x8')]=function(_0x14dca2,_0x579793){return _0x14dca2['define'](_0x07ee('0x9'),attributes,{'tableName':_0x07ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x776e=['path','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','api','moment','bluebird','request-promise'];(function(_0x7e7e5a,_0x387a27){var _0x227db7=function(_0x7abe46){while(--_0x7abe46){_0x7e7e5a['push'](_0x7e7e5a['shift']());}};_0x227db7(++_0x387a27);}(_0x776e,0x167));var _0xe776=function(_0x1350d5,_0x46ad96){_0x1350d5=_0x1350d5-0x0;var _0x15f8c9=_0x776e[_0x1350d5];return _0x15f8c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe776('0x0'));var moment=require(_0xe776('0x1'));var BPromise=require(_0xe776('0x2'));var rp=require(_0xe776('0x3'));var fs=require('fs');var path=require(_0xe776('0x4'));var rimraf=require('rimraf');var config=require(_0xe776('0x5'));var attributes=require(_0xe776('0x6'));module[_0xe776('0x7')]=function(_0x5bceeb,_0x1b2ebe){return _0x5bceeb[_0xe776('0x8')](_0xe776('0x9'),attributes,{'tableName':_0xe776('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ba7751d..29486d6 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 _0x9957=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('UserProfile,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});} \ No newline at end of file +var _0xc4aa=['redis','defaults','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29eb61,_0x364104){var _0x2ed150=function(_0x4dc5b2){while(--_0x4dc5b2){_0x29eb61['push'](_0x29eb61['shift']());}};_0x2ed150(++_0x364104);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});config[_0xac4a('0xb')]=_[_0xac4a('0xc')](config[_0xac4a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac4a('0xb')]));require(_0xac4a('0xd'))[_0xac4a('0xe')](socket);function respondWithRpcPromise(_0x4f4146,_0x1d182e,_0x3a82de){return new BPromise(function(_0x3e64f5,_0x4d4acc){return client[_0xac4a('0xf')](_0x4f4146,_0x3a82de)['then'](function(_0x2f062c){logger['info'](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));logger[_0xac4a('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1d182e,_0xac4a('0x11'),JSON[_0xac4a('0x13')](_0x2f062c));if(_0x2f062c[_0xac4a('0x14')]){if(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x15')]===0x1f4){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x4d4acc(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}logger[_0xac4a('0x14')]('UserProfile,\x20%s,\x20%s',_0x1d182e,_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);return _0x3e64f5(_0x2f062c[_0xac4a('0x14')][_0xac4a('0x16')]);}else{logger[_0xac4a('0x17')](_0xac4a('0x10'),_0x1d182e,_0xac4a('0x11'));_0x3e64f5(_0x2f062c[_0xac4a('0x18')]['message']);}})['catch'](function(_0x21a729){logger[_0xac4a('0x14')](_0xac4a('0x10'),_0x1d182e,_0x21a729);_0x4d4acc(_0x21a729);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f4ef1f3..a5feabc 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 _0xf686=['length','userProfile:','./userProfile.events','save','remove','update','emit','register'];(function(_0x25a04e,_0x435456){var _0x195480=function(_0x1e33b7){while(--_0x1e33b7){_0x25a04e['push'](_0x25a04e['shift']());}};_0x195480(++_0x435456);}(_0xf686,0x1ba));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require(_0x6f68('0x0'));var events=[_0x6f68('0x1'),_0x6f68('0x2'),_0x6f68('0x3')];function createListener(_0x330ed8,_0x220929){return function(_0xf33999){_0x220929[_0x6f68('0x4')](_0x330ed8,_0xf33999);};}function removeListener(_0x2371f6,_0x343264){return function(){UserProfileEvents['removeListener'](_0x2371f6,_0x343264);};}exports[_0x6f68('0x5')]=function(_0x5c8b6b){for(var _0xa993a9=0x0,_0x58a511=events[_0x6f68('0x6')];_0xa993a9<_0x58a511;_0xa993a9++){var _0x171d22=events[_0xa993a9];var _0x4bcbe3=createListener(_0x6f68('0x7')+_0x171d22,_0x5c8b6b);UserProfileEvents['on'](_0x171d22,_0x4bcbe3);}}; \ No newline at end of file +var _0xa1a2=['removeListener','register','length','userProfile:','remove','update'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xa1a2,0xca));var _0x2a1a=function(_0x1d25f4,_0x2900db){_0x1d25f4=_0x1d25f4-0x0;var _0x5ca4ee=_0xa1a2[_0x1d25f4];return _0x5ca4ee;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x2a1a('0x0'),_0x2a1a('0x1')];function createListener(_0x138a29,_0x1f062e){return function(_0x63903c){_0x1f062e['emit'](_0x138a29,_0x63903c);};}function removeListener(_0x348f66,_0x1e50f7){return function(){UserProfileEvents[_0x2a1a('0x2')](_0x348f66,_0x1e50f7);};}exports[_0x2a1a('0x3')]=function(_0x4baf3e){for(var _0x39beb6=0x0,_0x3eda83=events[_0x2a1a('0x4')];_0x39beb6<_0x3eda83;_0x39beb6++){var _0x293e4b=events[_0x39beb6];var _0x27458a=createListener(_0x2a1a('0x5')+_0x293e4b,_0x4baf3e);UserProfileEvents['on'](_0x293e4b,_0x27458a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 190ab39..4488b30 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 _0xc15c=['express','../../components/auth/service','./userProfileResource.controller','index','get','describe','/:id','isAuthenticated','show','create','put','update','delete','exports','path','connect-timeout'];(function(_0x422ae7,_0x26f223){var _0x53f008=function(_0x1f76f6){while(--_0x1f76f6){_0x422ae7['push'](_0x422ae7['shift']());}};_0x53f008(++_0x26f223);}(_0xc15c,0xae));var _0xcc15=function(_0x3b3fb0,_0x1d428a){_0x3b3fb0=_0x3b3fb0-0x0;var _0x2c68c4=_0xc15c[_0x3b3fb0];return _0x2c68c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcc15('0x0'));var timeout=require(_0xcc15('0x1'));var express=require(_0xcc15('0x2'));var router=express['Router']();var auth=require(_0xcc15('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc15('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc15('0x5')]);router[_0xcc15('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xcc15('0x7')]);router[_0xcc15('0x6')](_0xcc15('0x8'),auth[_0xcc15('0x9')](),controller[_0xcc15('0xa')]);router['post']('/',auth[_0xcc15('0x9')](),controller[_0xcc15('0xb')]);router[_0xcc15('0xc')](_0xcc15('0x8'),auth['isAuthenticated'](),controller[_0xcc15('0xd')]);router[_0xcc15('0xe')](_0xcc15('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc15('0xf')]=router; \ No newline at end of file +var _0x9aea=['isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','Router','../../config/environment','./userProfileResource.controller','get','index'];(function(_0x5bbcab,_0xad0ce8){var _0x1c1413=function(_0x15408d){while(--_0x15408d){_0x5bbcab['push'](_0x5bbcab['shift']());}};_0x1c1413(++_0xad0ce8);}(_0x9aea,0x196));var _0xa9ae=function(_0x5d67c8,_0x3fe315){_0x5d67c8=_0x5d67c8-0x0;var _0x51d9dc=_0x9aea[_0x5d67c8];return _0x51d9dc;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require(_0xa9ae('0x1'));var path=require(_0xa9ae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa9ae('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9ae('0x4'));var controller=require(_0xa9ae('0x5'));router[_0xa9ae('0x6')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x7')]);router[_0xa9ae('0x6')]('/describe',auth[_0xa9ae('0x8')](),controller[_0xa9ae('0x9')]);router['get'](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router['post']('/',auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xc')]);router[_0xa9ae('0xd')](_0xa9ae('0xa'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0xf')](_0xa9ae('0xa'),auth[_0xa9ae('0x8')](),controller[_0xa9ae('0x10')]);module[_0xa9ae('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 e171907..e5b0d38 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 _0x43f6=['STRING','sequelize','exports'];(function(_0x5e77ff,_0x1fe29c){var _0x115c32=function(_0x5a446b){while(--_0x5a446b){_0x5e77ff['push'](_0x5e77ff['shift']());}};_0x115c32(++_0x1fe29c);}(_0x43f6,0x1a8));var _0x643f=function(_0x8153ce,_0xcb6429){_0x8153ce=_0x8153ce-0x0;var _0x3294bc=_0x43f6[_0x8153ce];return _0x3294bc;};'use strict';var Sequelize=require(_0x643f('0x0'));module[_0x643f('0x1')]={'name':{'type':Sequelize[_0x643f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x643f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3e2b=['STRING','INTEGER','sequelize','exports'];(function(_0x39523d,_0x1d5cb3){var _0x5a2675=function(_0x22e0a1){while(--_0x22e0a1){_0x39523d['push'](_0x39523d['shift']());}};_0x5a2675(++_0x1d5cb3);}(_0x3e2b,0x14e));var _0xb3e2=function(_0xe99807,_0x180b47){_0xe99807=_0xe99807-0x0;var _0x2f4762=_0x3e2b[_0xe99807];return _0x2f4762;};'use strict';var Sequelize=require(_0xb3e2('0x0'));module[_0xb3e2('0x1')]={'name':{'type':Sequelize[_0xb3e2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb3e2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb3e2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 961bfd8..edc290a 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 _0x7da7=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','UserProfileResource','rows','catch','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2ce685,_0x3d8575){var _0x11dd12=function(_0x28be80){while(--_0x28be80){_0x2ce685['push'](_0x2ce685['shift']());}};_0x11dd12(++_0x3d8575);}(_0x7da7,0x10d));var _0x77da=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x7da7[_0x39d39d];return _0x577ac3;};'use strict';var pdf=require(_0x77da('0x0'));var emlformat=require(_0x77da('0x1'));var rimraf=require(_0x77da('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77da('0x3'));var moment=require(_0x77da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77da('0x5'));var util=require(_0x77da('0x6'));var path=require('path');var sox=require(_0x77da('0x7'));var csv=require(_0x77da('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x8'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=_0x29cd7b['count'],_0x1b0e17=_0x4e130c['offset'],_0x4500c4=_0x4e130c['offset']+_0x4e130c[_0x77da('0x19')],_0x4ecd98;if(_0x4500c4>=_0x366443){_0x4500c4=_0x366443;_0x4ecd98=0xc8;}else{_0x4ecd98=0xce;}_0x2172d0[_0x77da('0x18')](_0x4ecd98);return _0x2172d0[_0x77da('0x1a')](_0x77da('0x1b'),_0x1b0e17+'-'+_0x4500c4+'/'+_0x366443)[_0x77da('0x1c')](_0x29cd7b);}return null;};}function patchUpdates(_0x12d2b1){return function(_0x1d325c){try{jsonpatch[_0x77da('0x1d')](_0x1d325c,_0x12d2b1,!![]);}catch(_0x544104){return BPromise['reject'](_0x544104);}return _0x1d325c[_0x77da('0x1e')]();};}function saveUpdates(_0x4d1512,_0x507979){return function(_0x45a122){if(_0x45a122){return _0x45a122[_0x77da('0x1f')](_0x4d1512)[_0x77da('0x20')](function(_0x5ab79a){return _0x5ab79a;});}return null;};}function removeEntity(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x21')]()[_0x77da('0x20')](function(){_0x58270c[_0x77da('0x18')](0xcc)[_0x77da('0x22')]();});}};}function handleEntityNotFound(_0x10399a,_0x270318){return function(_0x95b5db){if(!_0x95b5db){_0x10399a['sendStatus'](0x194);}return _0x95b5db;};}function handleError(_0x4885ec,_0xfd160){_0xfd160=_0xfd160||0x1f4;return function(_0x2d009f){logger[_0x77da('0x23')](_0x2d009f[_0x77da('0x24')]);if(_0x2d009f['name']){delete _0x2d009f[_0x77da('0x25')];}_0x4885ec[_0x77da('0x18')](_0xfd160)[_0x77da('0x26')](_0x2d009f);};}exports[_0x77da('0x27')]=function(_0x446ae7,_0x5997b6){var _0xce24b8={},_0x3e090d={},_0x1f2279={'count':0x0,'rows':[]};var _0x2913f7=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x2258e9){return{'name':_0x2258e9[_0x77da('0x28')],'type':_0x2258e9[_0x77da('0x29')][_0x77da('0x2a')]};});_0x3e090d[_0x77da('0x2b')]=_['map'](_0x2913f7,_0x77da('0x25'));_0x3e090d[_0x77da('0x2c')]=_[_0x77da('0x2d')](_0x446ae7[_0x77da('0x2c')]);_0x3e090d[_0x77da('0x2e')]=_[_0x77da('0x2f')](_0x3e090d['model'],_0x3e090d[_0x77da('0x2c')]);_0xce24b8[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x3e090d[_0x77da('0x2b')],qs[_0x77da('0x31')](_0x446ae7[_0x77da('0x2c')][_0x77da('0x31')]));_0xce24b8[_0x77da('0x30')]=_0xce24b8['attributes']['length']?_0xce24b8[_0x77da('0x30')]:_0x3e090d[_0x77da('0x2b')];if(!_0x446ae7['query'][_0x77da('0x32')](_0x77da('0x33'))){_0xce24b8[_0x77da('0x19')]=qs[_0x77da('0x19')](_0x446ae7[_0x77da('0x2c')][_0x77da('0x19')]);_0xce24b8[_0x77da('0x34')]=qs['offset'](_0x446ae7[_0x77da('0x2c')]['offset']);}_0xce24b8['order']=qs['sort'](_0x446ae7[_0x77da('0x2c')]['sort']);_0xce24b8[_0x77da('0x35')]=qs[_0x77da('0x2e')](_[_0x77da('0x36')](_0x446ae7[_0x77da('0x2c')],_0x3e090d[_0x77da('0x2e')]),_0x2913f7);if(_0x446ae7[_0x77da('0x2c')][_0x77da('0x37')]){_0xce24b8['where']=_[_0x77da('0x38')](_0xce24b8[_0x77da('0x35')],{'$or':_[_0x77da('0x39')](_0x2913f7,function(_0x32785f){if(_0x32785f[_0x77da('0x29')]!==_0x77da('0x3a')){var _0x48fccc={};_0x48fccc[_0x32785f[_0x77da('0x25')]]={'$like':'%'+_0x446ae7[_0x77da('0x2c')][_0x77da('0x37')]+'%'};return _0x48fccc;}})});}_0xce24b8=_['merge']({},_0xce24b8,_0x446ae7[_0x77da('0x3b')]);var _0x505ffb={'where':_0xce24b8['where']};return db['UserProfileResource']['count'](_0x505ffb)[_0x77da('0x20')](function(_0x1adba5){_0x1f2279[_0x77da('0x3c')]=_0x1adba5;if(_0x446ae7['query'][_0x77da('0x3d')]){_0xce24b8['include']=[{'all':!![]}];}return db[_0x77da('0x3e')]['findAll'](_0xce24b8);})[_0x77da('0x20')](function(_0xa19b50){_0x1f2279[_0x77da('0x3f')]=_0xa19b50;return _0x1f2279;})[_0x77da('0x20')](respondWithFilteredResult(_0x5997b6,_0xce24b8))[_0x77da('0x40')](handleError(_0x5997b6,null));};exports['show']=function(_0x759b86,_0x1f48bd){var _0x44717a={'raw':![],'where':{'id':_0x759b86[_0x77da('0x41')]['id']}},_0x2f14f4={};_0x2f14f4[_0x77da('0x2b')]=_['keys'](db[_0x77da('0x3e')][_0x77da('0x42')]);_0x2f14f4[_0x77da('0x2c')]=_[_0x77da('0x2d')](_0x759b86[_0x77da('0x2c')]);_0x2f14f4[_0x77da('0x2e')]=_['intersection'](_0x2f14f4[_0x77da('0x2b')],_0x2f14f4['query']);_0x44717a[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x2f14f4[_0x77da('0x2b')],qs['fields'](_0x759b86[_0x77da('0x2c')][_0x77da('0x31')]));_0x44717a[_0x77da('0x30')]=_0x44717a[_0x77da('0x30')][_0x77da('0x43')]?_0x44717a[_0x77da('0x30')]:_0x2f14f4[_0x77da('0x2b')];if(_0x759b86[_0x77da('0x2c')][_0x77da('0x3d')]){_0x44717a['include']=[{'all':!![]}];}_0x44717a=_[_0x77da('0x38')]({},_0x44717a,_0x759b86[_0x77da('0x3b')]);return db[_0x77da('0x3e')][_0x77da('0x44')](_0x44717a)[_0x77da('0x20')](handleEntityNotFound(_0x1f48bd,null))[_0x77da('0x20')](respondWithResult(_0x1f48bd,null))['catch'](handleError(_0x1f48bd,null));};exports['create']=function(_0x240d7b,_0x1597d8){return db[_0x77da('0x3e')][_0x77da('0x45')](_0x240d7b[_0x77da('0x46')],{})[_0x77da('0x20')](respondWithResult(_0x1597d8,0xc9))['catch'](handleError(_0x1597d8,null));};exports[_0x77da('0x1f')]=function(_0x357ee4,_0x332f80){if(_0x357ee4[_0x77da('0x46')]['id']){delete _0x357ee4['body']['id'];}return db[_0x77da('0x3e')]['find']({'where':{'id':_0x357ee4['params']['id']}})[_0x77da('0x20')](handleEntityNotFound(_0x332f80,null))[_0x77da('0x20')](saveUpdates(_0x357ee4[_0x77da('0x46')],null))[_0x77da('0x20')](respondWithResult(_0x332f80,null))['catch'](handleError(_0x332f80,null));};exports[_0x77da('0x21')]=function(_0x1e36ee,_0x56a3d9){return db[_0x77da('0x3e')][_0x77da('0x44')]({'where':{'id':_0x1e36ee['params']['id']}})[_0x77da('0x20')](handleEntityNotFound(_0x56a3d9,null))[_0x77da('0x20')](removeEntity(_0x56a3d9,null))[_0x77da('0x40')](handleError(_0x56a3d9,null));};exports[_0x77da('0x47')]=function(_0xfc13ed,_0x1043c7){return db[_0x77da('0x3e')][_0x77da('0x47')]()[_0x77da('0x20')](respondWithResult(_0x1043c7,null))[_0x77da('0x40')](handleError(_0x1043c7,null));}; \ No newline at end of file +var _0x1cb9=['json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','find','create','body','describe','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','sendStatus','status','end','offset','limit','Content-Range'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x1cb9,0x14e));var _0x91cb=function(_0x80f21,_0x4398ae){_0x80f21=_0x80f21-0x0;var _0x473e58=_0x1cb9[_0x80f21];return _0x473e58;};'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'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=_0xc3629e['count'],_0x5ea796=_0x576369[_0x91cb('0x1c')],_0x238f11=_0x576369[_0x91cb('0x1c')]+_0x576369[_0x91cb('0x1d')],_0x135890;if(_0x238f11>=_0x347980){_0x238f11=_0x347980;_0x135890=0xc8;}else{_0x135890=0xce;}_0x528f73[_0x91cb('0x1a')](_0x135890);return _0x528f73['set'](_0x91cb('0x1e'),_0x5ea796+'-'+_0x238f11+'/'+_0x347980)[_0x91cb('0x1f')](_0xc3629e);}return null;};}function patchUpdates(_0x4ca8e8){return function(_0x123847){try{jsonpatch['apply'](_0x123847,_0x4ca8e8,!![]);}catch(_0x55042a){return BPromise[_0x91cb('0x20')](_0x55042a);}return _0x123847[_0x91cb('0x21')]();};}function saveUpdates(_0x56e409,_0x51a1d5){return function(_0x5b385a){if(_0x5b385a){return _0x5b385a[_0x91cb('0x22')](_0x56e409)[_0x91cb('0x23')](function(_0x20aff5){return _0x20aff5;});}return null;};}function removeEntity(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){_0x1dbee2['status'](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x1a7a54,_0x2447e7){return function(_0x422d14){if(!_0x422d14){_0x1a7a54[_0x91cb('0x19')](0x194);}return _0x422d14;};}function handleError(_0x7ad361,_0x414e60){_0x414e60=_0x414e60||0x1f4;return function(_0x423c4f){logger[_0x91cb('0x25')](_0x423c4f['stack']);if(_0x423c4f['name']){delete _0x423c4f[_0x91cb('0x26')];}_0x7ad361['status'](_0x414e60)[_0x91cb('0x27')](_0x423c4f);};}exports[_0x91cb('0x28')]=function(_0x318031,_0x5595c5){var _0x9b26a6={},_0x4f5a7b={},_0x4572f6={'count':0x0,'rows':[]};var _0x308e8c=_[_0x91cb('0x29')](db[_0x91cb('0x2a')][_0x91cb('0x2b')],function(_0x504275){return{'name':_0x504275[_0x91cb('0x2c')],'type':_0x504275['type'][_0x91cb('0x2d')]};});_0x4f5a7b[_0x91cb('0x2e')]=_[_0x91cb('0x29')](_0x308e8c,'name');_0x4f5a7b[_0x91cb('0x2f')]=_[_0x91cb('0x30')](_0x318031[_0x91cb('0x2f')]);_0x4f5a7b[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x4f5a7b[_0x91cb('0x2e')],_0x4f5a7b[_0x91cb('0x2f')]);_0x9b26a6[_0x91cb('0x33')]=_[_0x91cb('0x32')](_0x4f5a7b['model'],qs[_0x91cb('0x34')](_0x318031[_0x91cb('0x2f')][_0x91cb('0x34')]));_0x9b26a6[_0x91cb('0x33')]=_0x9b26a6[_0x91cb('0x33')]['length']?_0x9b26a6[_0x91cb('0x33')]:_0x4f5a7b[_0x91cb('0x2e')];if(!_0x318031[_0x91cb('0x2f')][_0x91cb('0x35')](_0x91cb('0x36'))){_0x9b26a6['limit']=qs[_0x91cb('0x1d')](_0x318031['query']['limit']);_0x9b26a6['offset']=qs[_0x91cb('0x1c')](_0x318031['query'][_0x91cb('0x1c')]);}_0x9b26a6['order']=qs['sort'](_0x318031[_0x91cb('0x2f')][_0x91cb('0x37')]);_0x9b26a6[_0x91cb('0x38')]=qs[_0x91cb('0x31')](_[_0x91cb('0x39')](_0x318031['query'],_0x4f5a7b[_0x91cb('0x31')]),_0x308e8c);if(_0x318031[_0x91cb('0x2f')][_0x91cb('0x3a')]){_0x9b26a6[_0x91cb('0x38')]=_['merge'](_0x9b26a6['where'],{'$or':_[_0x91cb('0x29')](_0x308e8c,function(_0x135bf1){if(_0x135bf1['type']!==_0x91cb('0x3b')){var _0x1dcdfe={};_0x1dcdfe[_0x135bf1['name']]={'$like':'%'+_0x318031[_0x91cb('0x2f')][_0x91cb('0x3a')]+'%'};return _0x1dcdfe;}})});}_0x9b26a6=_['merge']({},_0x9b26a6,_0x318031[_0x91cb('0x3c')]);var _0x545687={'where':_0x9b26a6[_0x91cb('0x38')]};return db[_0x91cb('0x2a')][_0x91cb('0x3d')](_0x545687)[_0x91cb('0x23')](function(_0x51d0ea){_0x4572f6[_0x91cb('0x3d')]=_0x51d0ea;if(_0x318031['query'][_0x91cb('0x3e')]){_0x9b26a6[_0x91cb('0x3f')]=[{'all':!![]}];}return db['UserProfileResource'][_0x91cb('0x40')](_0x9b26a6);})['then'](function(_0x2c6102){_0x4572f6[_0x91cb('0x41')]=_0x2c6102;return _0x4572f6;})[_0x91cb('0x23')](respondWithFilteredResult(_0x5595c5,_0x9b26a6))[_0x91cb('0x42')](handleError(_0x5595c5,null));};exports['show']=function(_0x435fff,_0x5af0e6){var _0x2cf27e={'raw':![],'where':{'id':_0x435fff[_0x91cb('0x43')]['id']}},_0x37e777={};_0x37e777[_0x91cb('0x2e')]=_[_0x91cb('0x30')](db[_0x91cb('0x2a')][_0x91cb('0x2b')]);_0x37e777[_0x91cb('0x2f')]=_['keys'](_0x435fff[_0x91cb('0x2f')]);_0x37e777['filters']=_[_0x91cb('0x32')](_0x37e777['model'],_0x37e777[_0x91cb('0x2f')]);_0x2cf27e['attributes']=_[_0x91cb('0x32')](_0x37e777[_0x91cb('0x2e')],qs[_0x91cb('0x34')](_0x435fff[_0x91cb('0x2f')]['fields']));_0x2cf27e[_0x91cb('0x33')]=_0x2cf27e[_0x91cb('0x33')]['length']?_0x2cf27e[_0x91cb('0x33')]:_0x37e777[_0x91cb('0x2e')];if(_0x435fff[_0x91cb('0x2f')][_0x91cb('0x3e')]){_0x2cf27e[_0x91cb('0x3f')]=[{'all':!![]}];}_0x2cf27e=_[_0x91cb('0x44')]({},_0x2cf27e,_0x435fff[_0x91cb('0x3c')]);return db[_0x91cb('0x2a')][_0x91cb('0x45')](_0x2cf27e)['then'](handleEntityNotFound(_0x5af0e6,null))[_0x91cb('0x23')](respondWithResult(_0x5af0e6,null))[_0x91cb('0x42')](handleError(_0x5af0e6,null));};exports[_0x91cb('0x46')]=function(_0x470996,_0x3314cc){return db[_0x91cb('0x2a')][_0x91cb('0x46')](_0x470996[_0x91cb('0x47')],{})['then'](respondWithResult(_0x3314cc,0xc9))[_0x91cb('0x42')](handleError(_0x3314cc,null));};exports[_0x91cb('0x22')]=function(_0x2b8b7f,_0x3b8cfd){if(_0x2b8b7f['body']['id']){delete _0x2b8b7f[_0x91cb('0x47')]['id'];}return db[_0x91cb('0x2a')]['find']({'where':{'id':_0x2b8b7f[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b8cfd,null))[_0x91cb('0x23')](saveUpdates(_0x2b8b7f['body'],null))['then'](respondWithResult(_0x3b8cfd,null))['catch'](handleError(_0x3b8cfd,null));};exports[_0x91cb('0x24')]=function(_0xff3d11,_0x3d62c4){return db[_0x91cb('0x2a')][_0x91cb('0x45')]({'where':{'id':_0xff3d11['params']['id']}})['then'](handleEntityNotFound(_0x3d62c4,null))[_0x91cb('0x23')](removeEntity(_0x3d62c4,null))[_0x91cb('0x42')](handleError(_0x3d62c4,null));};exports[_0x91cb('0x48')]=function(_0x14eaab,_0x57adff){return db['UserProfileResource']['describe']()[_0x91cb('0x23')](respondWithResult(_0x57adff,null))['catch'](handleError(_0x57adff,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 81f443c..f336734 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 _0x9f4d=['../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f4d,0xd7));var _0xd9f4=function(_0x1c2e29,_0x3ad48a){_0x1c2e29=_0x1c2e29-0x0;var _0x39174d=_0x9f4d[_0x1c2e29];return _0x39174d;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var logger=require(_0xd9f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd9f4('0x3'));var rp=require(_0xd9f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9f4('0x5'));var config=require(_0xd9f4('0x6'));var attributes=require('./userProfileResource.attributes');module[_0xd9f4('0x7')]=function(_0x3c9268,_0x18e190){return _0x3c9268[_0xd9f4('0x8')](_0xd9f4('0x9'),attributes,{'tableName':_0xd9f4('0xa'),'paranoid':![],'indexes':[{'name':_0xd9f4('0xb'),'fields':[_0xd9f4('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a4e=['bluebird','request-promise','path','rimraf','exports','UserProfileResource','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3a4e,0x1b5));var _0xe3a4=function(_0x2ac804,_0x536f14){_0x2ac804=_0x2ac804-0x0;var _0x563dea=_0x3a4e[_0x2ac804];return _0x563dea;};'use strict';var _=require(_0xe3a4('0x0'));var util=require(_0xe3a4('0x1'));var logger=require(_0xe3a4('0x2'))(_0xe3a4('0x3'));var moment=require(_0xe3a4('0x4'));var BPromise=require(_0xe3a4('0x5'));var rp=require(_0xe3a4('0x6'));var fs=require('fs');var path=require(_0xe3a4('0x7'));var rimraf=require(_0xe3a4('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xe3a4('0x9')]=function(_0x73e538,_0xdfa38f){return _0x73e538['define'](_0xe3a4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xe3a4('0xb'),'fields':['resourceId',_0xe3a4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d29fb92..145efee 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 _0x8885=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x8885,0x156));var _0x5888=function(_0x236002,_0x49115f){_0x236002=_0x236002-0x0;var _0x11bb9f=_0x8885[_0x236002];return _0x11bb9f;};'use strict';var _=require(_0x5888('0x0'));var util=require(_0x5888('0x1'));var moment=require(_0x5888('0x2'));var BPromise=require(_0x5888('0x3'));var rs=require(_0x5888('0x4'));var fs=require('fs');var Redis=require(_0x5888('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5888('0x6'));var logger=require(_0x5888('0x7'))(_0x5888('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5888('0x9')][_0x5888('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x481389,_0x2967b9,_0xce9393){return new BPromise(function(_0x174701,_0x65bdb6){return client['request'](_0x481389,_0xce9393)[_0x5888('0xb')](function(_0x485e1){logger['info'](_0x5888('0xc'),_0x2967b9,'request\x20sent');logger['debug'](_0x5888('0xd'),_0x2967b9,'request\x20sent',JSON['stringify'](_0x485e1));if(_0x485e1[_0x5888('0xe')]){if(_0x485e1[_0x5888('0xe')][_0x5888('0xf')]===0x1f4){logger[_0x5888('0xe')](_0x5888('0xc'),_0x2967b9,_0x485e1[_0x5888('0xe')]['message']);return _0x65bdb6(_0x485e1[_0x5888('0xe')][_0x5888('0x10')]);}logger[_0x5888('0xe')](_0x5888('0xc'),_0x2967b9,_0x485e1[_0x5888('0xe')][_0x5888('0x10')]);return _0x174701(_0x485e1[_0x5888('0xe')][_0x5888('0x10')]);}else{logger[_0x5888('0x11')](_0x5888('0xc'),_0x2967b9,'request\x20sent');_0x174701(_0x485e1['result'][_0x5888('0x10')]);}})['catch'](function(_0x2033da){logger[_0x5888('0xe')](_0x5888('0xc'),_0x2967b9,_0x2033da);_0x65bdb6(_0x2033da);});});} \ No newline at end of file +var _0xf376=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x429e7e,_0x5ae693){var _0x22c7d7=function(_0x1d4c77){while(--_0x1d4c77){_0x429e7e['push'](_0x429e7e['shift']());}};_0x22c7d7(++_0x5ae693);}(_0xf376,0x14d));var _0x6f37=function(_0x3970df,_0x2522a4){_0x3970df=_0x3970df-0x0;var _0x2c7054=_0xf376[_0x3970df];return _0x2c7054;};'use strict';var _=require(_0x6f37('0x0'));var util=require(_0x6f37('0x1'));var moment=require(_0x6f37('0x2'));var BPromise=require(_0x6f37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f37('0x4'))['db'];var utils=require(_0x6f37('0x5'));var logger=require('../../config/logger')(_0x6f37('0x6'));var config=require(_0x6f37('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f37('0x8')][_0x6f37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x127411,_0x31da6e,_0x2c9abe){return new BPromise(function(_0x286b38,_0x36c0b8){return client['request'](_0x127411,_0x2c9abe)[_0x6f37('0xa')](function(_0x4952cb){logger[_0x6f37('0xb')](_0x6f37('0xc'),_0x31da6e,_0x6f37('0xd'));logger[_0x6f37('0xe')](_0x6f37('0xf'),_0x31da6e,'request\x20sent',JSON[_0x6f37('0x10')](_0x4952cb));if(_0x4952cb['error']){if(_0x4952cb['error'][_0x6f37('0x11')]===0x1f4){logger[_0x6f37('0x12')](_0x6f37('0xc'),_0x31da6e,_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);return _0x36c0b8(_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x31da6e,_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);return _0x286b38(_0x4952cb[_0x6f37('0x12')][_0x6f37('0x13')]);}else{logger[_0x6f37('0xb')](_0x6f37('0xc'),_0x31da6e,_0x6f37('0xd'));_0x286b38(_0x4952cb[_0x6f37('0x14')][_0x6f37('0x13')]);}})[_0x6f37('0x15')](function(_0x3d088c){logger[_0x6f37('0x12')](_0x6f37('0xc'),_0x31da6e,_0x3d088c);_0x36c0b8(_0x3d088c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6de8d54..d51fe67 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 _0xbab0=['/describe','describe','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x24870e,_0x1977ea){var _0x68bdf7=function(_0x5ceddb){while(--_0x5ceddb){_0x24870e['push'](_0x24870e['shift']());}};_0x68bdf7(++_0x1977ea);}(_0xbab0,0x183));var _0x0bab=function(_0x1e36dc,_0x33fab9){_0x1e36dc=_0x1e36dc-0x0;var _0x3f25d0=_0xbab0[_0x1e36dc];return _0x3f25d0;};'use strict';var multer=require(_0x0bab('0x0'));var util=require(_0x0bab('0x1'));var path=require(_0x0bab('0x2'));var timeout=require(_0x0bab('0x3'));var express=require('express');var router=express[_0x0bab('0x4')]();var auth=require(_0x0bab('0x5'));var interaction=require(_0x0bab('0x6'));var config=require(_0x0bab('0x7'));var controller=require(_0x0bab('0x8'));router[_0x0bab('0x9')]('/',auth[_0x0bab('0xa')](),controller[_0x0bab('0xb')]);router[_0x0bab('0x9')](_0x0bab('0xc'),auth['isAuthenticated'](),controller[_0x0bab('0xd')]);router[_0x0bab('0x9')]('/:id',auth[_0x0bab('0xa')](),controller[_0x0bab('0xe')]);router[_0x0bab('0xf')]('/',auth[_0x0bab('0xa')](),controller[_0x0bab('0x10')]);router['put'](_0x0bab('0x11'),auth[_0x0bab('0xa')](),controller[_0x0bab('0x12')]);router[_0x0bab('0x13')]('/:id',auth[_0x0bab('0xa')](),controller[_0x0bab('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3a5e=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5e5099,_0x32b6a1){var _0x21b248=function(_0x156236){while(--_0x156236){_0x5e5099['push'](_0x5e5099['shift']());}};_0x21b248(++_0x32b6a1);}(_0x3a5e,0x14c));var _0xe3a5=function(_0xe2872,_0x5f9a58){_0xe2872=_0xe2872-0x0;var _0x3967ad=_0x3a5e[_0xe2872];return _0x3967ad;};'use strict';var multer=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var path=require(_0xe3a5('0x2'));var timeout=require(_0xe3a5('0x3'));var express=require(_0xe3a5('0x4'));var router=express[_0xe3a5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe3a5('0x6'));var config=require(_0xe3a5('0x7'));var controller=require(_0xe3a5('0x8'));router[_0xe3a5('0x9')]('/',auth[_0xe3a5('0xa')](),controller['index']);router['get'](_0xe3a5('0xb'),auth['isAuthenticated'](),controller[_0xe3a5('0xc')]);router[_0xe3a5('0x9')](_0xe3a5('0xd'),auth[_0xe3a5('0xa')](),controller[_0xe3a5('0xe')]);router[_0xe3a5('0xf')]('/',auth[_0xe3a5('0xa')](),controller['create']);router[_0xe3a5('0x10')](_0xe3a5('0xd'),auth[_0xe3a5('0xa')](),controller[_0xe3a5('0x11')]);router['delete'](_0xe3a5('0xd'),auth[_0xe3a5('0xa')](),controller[_0xe3a5('0x12')]);module[_0xe3a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e415c36..ff35764 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 _0x20a2=['STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','sequelize'];(function(_0x49c341,_0x5b9570){var _0x1c106d=function(_0x535c3f){while(--_0x535c3f){_0x49c341['push'](_0x49c341['shift']());}};_0x1c106d(++_0x5b9570);}(_0x20a2,0x102));var _0x220a=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x20a2[_0x25efdf];return _0x22c495;};'use strict';var Sequelize=require(_0x220a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x220a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x220a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x220a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x220a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x220a('0x1')],'set':function(_0x3d9745){this['setDataValue'](_0x220a('0x4'),_0x3d9745?_0x3d9745[_0x220a('0x5')](''):[]);},'get':function(){return this[_0x220a('0x6')](_0x220a('0x4'))?this[_0x220a('0x6')](_0x220a('0x4'))['split'](''):[];}}}; \ No newline at end of file +var _0x8e0d=['BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','STRING','INTEGER'];(function(_0x38194f,_0x282edf){var _0x27975b=function(_0x1c1d62){while(--_0x1c1d62){_0x38194f['push'](_0x38194f['shift']());}};_0x27975b(++_0x282edf);}(_0x8e0d,0x82));var _0xd8e0=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x8e0d[_0x95411e];return _0x2c8718;};'use strict';var Sequelize=require(_0xd8e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xd8e0('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd8e0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd8e0('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd8e0('0x1')],'set':function(_0x14598d){this[_0xd8e0('0x4')]('crudPermissions',_0x14598d?_0x14598d['join'](''):[]);},'get':function(){return this[_0xd8e0('0x5')](_0xd8e0('0x6'))?this[_0xd8e0('0x5')](_0xd8e0('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 067327a..6157ac1 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 _0x57c6=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length'];(function(_0x45d96e,_0x33a73a){var _0x5d2ddd=function(_0x4fa2a2){while(--_0x4fa2a2){_0x45d96e['push'](_0x45d96e['shift']());}};_0x5d2ddd(++_0x33a73a);}(_0x57c6,0x17f));var _0x657c=function(_0x261602,_0x4d3f4c){_0x261602=_0x261602-0x0;var _0x3cd0d7=_0x57c6[_0x261602];return _0x3cd0d7;};'use strict';var pdf=require(_0x657c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x657c('0x1'));var zipdir=require(_0x657c('0x2'));var jsonpatch=require(_0x657c('0x3'));var rp=require('request-promise');var moment=require(_0x657c('0x4'));var BPromise=require(_0x657c('0x5'));var Mustache=require(_0x657c('0x6'));var util=require('util');var path=require(_0x657c('0x7'));var sox=require(_0x657c('0x8'));var csv=require(_0x657c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x657c('0xa'));var squel=require(_0x657c('0xb'));var crypto=require(_0x657c('0xc'));var jsforce=require(_0x657c('0xd'));var deskjs=require(_0x657c('0xe'));var toCsv=require(_0x657c('0x9'));var querystring=require(_0x657c('0xf'));var Papa=require(_0x657c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x657c('0x11'));var as=require(_0x657c('0x12'));var hardwareService=require(_0x657c('0x13'));var logger=require(_0x657c('0x14'))(_0x657c('0x15'));var utils=require(_0x657c('0x16'));var config=require(_0x657c('0x17'));var licenseUtil=require(_0x657c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38ffb2,_0x4b402f){_0x4b402f=_0x4b402f||0xcc;return function(_0x1f8993){if(_0x1f8993){return _0x38ffb2[_0x657c('0x19')](_0x4b402f);}return _0x38ffb2['status'](_0x4b402f)[_0x657c('0x1a')]();};}function respondWithResult(_0x48ab69,_0x53ccc9){_0x53ccc9=_0x53ccc9||0xc8;return function(_0x2f823f){if(_0x2f823f){return _0x48ab69[_0x657c('0x1b')](_0x53ccc9)[_0x657c('0x1c')](_0x2f823f);}};}function respondWithFilteredResult(_0x2ec6cb,_0x1ad348){return function(_0xd6f2fd){if(_0xd6f2fd){var _0x3c86bb=_0xd6f2fd['count'],_0x35a88f=_0x1ad348['offset'],_0x5696fb=_0x1ad348[_0x657c('0x1d')]+_0x1ad348[_0x657c('0x1e')],_0xf2a209;if(_0x5696fb>=_0x3c86bb){_0x5696fb=_0x3c86bb;_0xf2a209=0xc8;}else{_0xf2a209=0xce;}_0x2ec6cb[_0x657c('0x1b')](_0xf2a209);return _0x2ec6cb['set']('Content-Range',_0x35a88f+'-'+_0x5696fb+'/'+_0x3c86bb)[_0x657c('0x1c')](_0xd6f2fd);}return null;};}function patchUpdates(_0x212af7){return function(_0x140d1d){try{jsonpatch[_0x657c('0x1f')](_0x140d1d,_0x212af7,!![]);}catch(_0x3b3585){return BPromise[_0x657c('0x20')](_0x3b3585);}return _0x140d1d[_0x657c('0x21')]();};}function saveUpdates(_0x5461a9,_0x2b0637){return function(_0x5127f4){if(_0x5127f4){return _0x5127f4[_0x657c('0x22')](_0x5461a9)[_0x657c('0x23')](function(_0x578cf3){return _0x578cf3;});}return null;};}function removeEntity(_0x17d138,_0x504209){return function(_0x3aeeba){if(_0x3aeeba){return _0x3aeeba[_0x657c('0x24')]()[_0x657c('0x23')](function(){_0x17d138[_0x657c('0x1b')](0xcc)[_0x657c('0x1a')]();});}};}function handleEntityNotFound(_0x155706,_0x2b421a){return function(_0x3e8f39){if(!_0x3e8f39){_0x155706['sendStatus'](0x194);}return _0x3e8f39;};}function handleError(_0x38d8f5,_0x453e06){_0x453e06=_0x453e06||0x1f4;return function(_0x3042af){logger[_0x657c('0x25')](_0x3042af[_0x657c('0x26')]);if(_0x3042af[_0x657c('0x27')]){delete _0x3042af[_0x657c('0x27')];}_0x38d8f5[_0x657c('0x1b')](_0x453e06)[_0x657c('0x28')](_0x3042af);};}exports[_0x657c('0x29')]=function(_0x3f4de7,_0x8bd943){var _0x1ae0c5={},_0x4bff16={},_0x4aef7e={'count':0x0,'rows':[]};var _0x471b1d=_[_0x657c('0x2a')](db[_0x657c('0x2b')][_0x657c('0x2c')],function(_0x37da5d){return{'name':_0x37da5d[_0x657c('0x2d')],'type':_0x37da5d[_0x657c('0x2e')][_0x657c('0x2f')]};});_0x4bff16[_0x657c('0x30')]=_[_0x657c('0x2a')](_0x471b1d,_0x657c('0x27'));_0x4bff16['query']=_[_0x657c('0x31')](_0x3f4de7['query']);_0x4bff16['filters']=_[_0x657c('0x32')](_0x4bff16[_0x657c('0x30')],_0x4bff16[_0x657c('0x33')]);_0x1ae0c5['attributes']=_[_0x657c('0x32')](_0x4bff16[_0x657c('0x30')],qs[_0x657c('0x34')](_0x3f4de7[_0x657c('0x33')][_0x657c('0x34')]));_0x1ae0c5[_0x657c('0x35')]=_0x1ae0c5[_0x657c('0x35')][_0x657c('0x36')]?_0x1ae0c5[_0x657c('0x35')]:_0x4bff16[_0x657c('0x30')];if(!_0x3f4de7[_0x657c('0x33')]['hasOwnProperty'](_0x657c('0x37'))){_0x1ae0c5[_0x657c('0x1e')]=qs[_0x657c('0x1e')](_0x3f4de7[_0x657c('0x33')][_0x657c('0x1e')]);_0x1ae0c5[_0x657c('0x1d')]=qs[_0x657c('0x1d')](_0x3f4de7[_0x657c('0x33')][_0x657c('0x1d')]);}_0x1ae0c5[_0x657c('0x38')]=qs[_0x657c('0x39')](_0x3f4de7[_0x657c('0x33')]['sort']);_0x1ae0c5[_0x657c('0x3a')]=qs[_0x657c('0x3b')](_[_0x657c('0x3c')](_0x3f4de7[_0x657c('0x33')],_0x4bff16[_0x657c('0x3b')]),_0x471b1d);if(_0x3f4de7[_0x657c('0x33')][_0x657c('0x3d')]){_0x1ae0c5[_0x657c('0x3a')]=_[_0x657c('0x3e')](_0x1ae0c5['where'],{'$or':_[_0x657c('0x2a')](_0x471b1d,function(_0x1c9bc6){if(_0x1c9bc6[_0x657c('0x2e')]!==_0x657c('0x3f')){var _0x93d93f={};_0x93d93f[_0x1c9bc6[_0x657c('0x27')]]={'$like':'%'+_0x3f4de7['query']['filter']+'%'};return _0x93d93f;}})});}_0x1ae0c5=_['merge']({},_0x1ae0c5,_0x3f4de7[_0x657c('0x40')]);var _0x2f1e95={'where':_0x1ae0c5[_0x657c('0x3a')]};return db[_0x657c('0x2b')]['count'](_0x2f1e95)['then'](function(_0x18219b){_0x4aef7e['count']=_0x18219b;if(_0x3f4de7[_0x657c('0x33')][_0x657c('0x41')]){_0x1ae0c5[_0x657c('0x42')]=[{'all':!![]}];}return db[_0x657c('0x2b')]['findAll'](_0x1ae0c5);})[_0x657c('0x23')](function(_0x2a2000){_0x4aef7e[_0x657c('0x43')]=_0x2a2000;return _0x4aef7e;})['then'](respondWithFilteredResult(_0x8bd943,_0x1ae0c5))[_0x657c('0x44')](handleError(_0x8bd943,null));};exports[_0x657c('0x45')]=function(_0x56cc3e,_0x5ca966){var _0x26e19c={'raw':![],'where':{'id':_0x56cc3e[_0x657c('0x46')]['id']}},_0x55fb00={};_0x55fb00[_0x657c('0x30')]=_[_0x657c('0x31')](db[_0x657c('0x2b')][_0x657c('0x2c')]);_0x55fb00[_0x657c('0x33')]=_[_0x657c('0x31')](_0x56cc3e['query']);_0x55fb00[_0x657c('0x3b')]=_[_0x657c('0x32')](_0x55fb00[_0x657c('0x30')],_0x55fb00[_0x657c('0x33')]);_0x26e19c[_0x657c('0x35')]=_[_0x657c('0x32')](_0x55fb00[_0x657c('0x30')],qs['fields'](_0x56cc3e['query'][_0x657c('0x34')]));_0x26e19c[_0x657c('0x35')]=_0x26e19c[_0x657c('0x35')][_0x657c('0x36')]?_0x26e19c[_0x657c('0x35')]:_0x55fb00[_0x657c('0x30')];if(_0x56cc3e[_0x657c('0x33')][_0x657c('0x41')]){_0x26e19c['include']=[{'all':!![]}];}_0x26e19c=_[_0x657c('0x3e')]({},_0x26e19c,_0x56cc3e[_0x657c('0x40')]);return db[_0x657c('0x2b')]['find'](_0x26e19c)['then'](handleEntityNotFound(_0x5ca966,null))['then'](respondWithResult(_0x5ca966,null))['catch'](handleError(_0x5ca966,null));};exports['create']=function(_0xdf2a93,_0x1026b3){return db[_0x657c('0x2b')]['create'](_0xdf2a93['body'],{})[_0x657c('0x23')](respondWithResult(_0x1026b3,0xc9))[_0x657c('0x44')](handleError(_0x1026b3,null));};exports[_0x657c('0x22')]=function(_0xb2ccb5,_0x38ea90){if(_0xb2ccb5['body']['id']){delete _0xb2ccb5[_0x657c('0x47')]['id'];}return db['UserProfileSection'][_0x657c('0x48')]({'where':{'id':_0xb2ccb5[_0x657c('0x46')]['id']}})[_0x657c('0x23')](handleEntityNotFound(_0x38ea90,null))[_0x657c('0x23')](saveUpdates(_0xb2ccb5[_0x657c('0x47')],null))[_0x657c('0x23')](respondWithResult(_0x38ea90,null))[_0x657c('0x44')](handleError(_0x38ea90,null));};exports['destroy']=function(_0x235a7f,_0x299fb1){return db[_0x657c('0x2b')]['find']({'where':{'id':_0x235a7f[_0x657c('0x46')]['id']}})[_0x657c('0x23')](handleEntityNotFound(_0x299fb1,null))[_0x657c('0x23')](removeEntity(_0x299fb1,null))[_0x657c('0x44')](handleError(_0x299fb1,null));};exports['describe']=function(_0x592f8a,_0x3edb16){return db[_0x657c('0x2b')]['describe']()[_0x657c('0x23')](respondWithResult(_0x3edb16,null))['catch'](handleError(_0x3edb16,null));}; \ No newline at end of file +var _0x544a=['key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type'];(function(_0x4c7f5d,_0x4e0ba0){var _0xff7bb4=function(_0x1f5316){while(--_0x1f5316){_0x4c7f5d['push'](_0x4c7f5d['shift']());}};_0xff7bb4(++_0x4e0ba0);}(_0x544a,0xaf));var _0xa544=function(_0x49ba83,_0x190d71){_0x49ba83=_0x49ba83-0x0;var _0xf84e81=_0x544a[_0x49ba83];return _0xf84e81;};'use strict';var pdf=require(_0xa544('0x0'));var emlformat=require(_0xa544('0x1'));var rimraf=require(_0xa544('0x2'));var zipdir=require(_0xa544('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa544('0x4'));var moment=require(_0xa544('0x5'));var BPromise=require(_0xa544('0x6'));var Mustache=require(_0xa544('0x7'));var util=require('util');var path=require(_0xa544('0x8'));var sox=require(_0xa544('0x9'));var csv=require(_0xa544('0xa'));var ejs=require(_0xa544('0xb'));var fs=require('fs');var _=require(_0xa544('0xc'));var squel=require(_0xa544('0xd'));var crypto=require(_0xa544('0xe'));var jsforce=require(_0xa544('0xf'));var deskjs=require(_0xa544('0x10'));var toCsv=require(_0xa544('0xa'));var querystring=require(_0xa544('0x11'));var Papa=require('papaparse');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(_0xa544('0x12'))(_0xa544('0x13'));var utils=require(_0xa544('0x14'));var config=require(_0xa544('0x15'));var licenseUtil=require(_0xa544('0x16'));var db=require(_0xa544('0x17'))['db'];function respondWithStatusCode(_0x1bead8,_0x22ee61){_0x22ee61=_0x22ee61||0xcc;return function(_0x38412d){if(_0x38412d){return _0x1bead8['sendStatus'](_0x22ee61);}return _0x1bead8[_0xa544('0x18')](_0x22ee61)[_0xa544('0x19')]();};}function respondWithResult(_0x62cd1d,_0x3144fe){_0x3144fe=_0x3144fe||0xc8;return function(_0x5406a8){if(_0x5406a8){return _0x62cd1d['status'](_0x3144fe)[_0xa544('0x1a')](_0x5406a8);}};}function respondWithFilteredResult(_0x41b544,_0x4a5831){return function(_0x1409ba){if(_0x1409ba){var _0x1b39f3=_0x1409ba[_0xa544('0x1b')],_0x4f4a65=_0x4a5831[_0xa544('0x1c')],_0x558d62=_0x4a5831[_0xa544('0x1c')]+_0x4a5831['limit'],_0x38d339;if(_0x558d62>=_0x1b39f3){_0x558d62=_0x1b39f3;_0x38d339=0xc8;}else{_0x38d339=0xce;}_0x41b544[_0xa544('0x18')](_0x38d339);return _0x41b544[_0xa544('0x1d')](_0xa544('0x1e'),_0x4f4a65+'-'+_0x558d62+'/'+_0x1b39f3)['json'](_0x1409ba);}return null;};}function patchUpdates(_0x3c2a94){return function(_0x3e8cec){try{jsonpatch[_0xa544('0x1f')](_0x3e8cec,_0x3c2a94,!![]);}catch(_0x4227ff){return BPromise['reject'](_0x4227ff);}return _0x3e8cec[_0xa544('0x20')]();};}function saveUpdates(_0x3ba847,_0x15f841){return function(_0x3fed97){if(_0x3fed97){return _0x3fed97[_0xa544('0x21')](_0x3ba847)[_0xa544('0x22')](function(_0x574e5f){return _0x574e5f;});}return null;};}function removeEntity(_0x196a54,_0x1f2e25){return function(_0xb2c3f7){if(_0xb2c3f7){return _0xb2c3f7[_0xa544('0x23')]()['then'](function(){_0x196a54[_0xa544('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcdf95f,_0x586b1b){return function(_0x453de5){if(!_0x453de5){_0xcdf95f[_0xa544('0x24')](0x194);}return _0x453de5;};}function handleError(_0x4dce75,_0x16ed8d){_0x16ed8d=_0x16ed8d||0x1f4;return function(_0x1eac75){logger[_0xa544('0x25')](_0x1eac75[_0xa544('0x26')]);if(_0x1eac75['name']){delete _0x1eac75[_0xa544('0x27')];}_0x4dce75['status'](_0x16ed8d)[_0xa544('0x28')](_0x1eac75);};}exports[_0xa544('0x29')]=function(_0x1f0b5d,_0xdd8d75){var _0x2af390={},_0x57db12={},_0x31127e={'count':0x0,'rows':[]};var _0x2b361d=_[_0xa544('0x2a')](db[_0xa544('0x2b')][_0xa544('0x2c')],function(_0x526a36){return{'name':_0x526a36[_0xa544('0x2d')],'type':_0x526a36[_0xa544('0x2e')][_0xa544('0x2f')]};});_0x57db12[_0xa544('0x30')]=_[_0xa544('0x2a')](_0x2b361d,'name');_0x57db12['query']=_[_0xa544('0x31')](_0x1f0b5d[_0xa544('0x32')]);_0x57db12['filters']=_['intersection'](_0x57db12[_0xa544('0x30')],_0x57db12[_0xa544('0x32')]);_0x2af390[_0xa544('0x33')]=_[_0xa544('0x34')](_0x57db12[_0xa544('0x30')],qs[_0xa544('0x35')](_0x1f0b5d[_0xa544('0x32')][_0xa544('0x35')]));_0x2af390[_0xa544('0x33')]=_0x2af390[_0xa544('0x33')][_0xa544('0x36')]?_0x2af390[_0xa544('0x33')]:_0x57db12[_0xa544('0x30')];if(!_0x1f0b5d[_0xa544('0x32')][_0xa544('0x37')](_0xa544('0x38'))){_0x2af390[_0xa544('0x39')]=qs[_0xa544('0x39')](_0x1f0b5d[_0xa544('0x32')]['limit']);_0x2af390[_0xa544('0x1c')]=qs[_0xa544('0x1c')](_0x1f0b5d['query'][_0xa544('0x1c')]);}_0x2af390['order']=qs[_0xa544('0x3a')](_0x1f0b5d[_0xa544('0x32')][_0xa544('0x3a')]);_0x2af390[_0xa544('0x3b')]=qs[_0xa544('0x3c')](_[_0xa544('0x3d')](_0x1f0b5d[_0xa544('0x32')],_0x57db12[_0xa544('0x3c')]),_0x2b361d);if(_0x1f0b5d[_0xa544('0x32')]['filter']){_0x2af390[_0xa544('0x3b')]=_[_0xa544('0x3e')](_0x2af390[_0xa544('0x3b')],{'$or':_[_0xa544('0x2a')](_0x2b361d,function(_0x27cca9){if(_0x27cca9[_0xa544('0x2e')]!=='VIRTUAL'){var _0x1a3b1f={};_0x1a3b1f[_0x27cca9['name']]={'$like':'%'+_0x1f0b5d[_0xa544('0x32')][_0xa544('0x3f')]+'%'};return _0x1a3b1f;}})});}_0x2af390=_[_0xa544('0x3e')]({},_0x2af390,_0x1f0b5d[_0xa544('0x40')]);var _0x5d72a4={'where':_0x2af390['where']};return db['UserProfileSection'][_0xa544('0x1b')](_0x5d72a4)[_0xa544('0x22')](function(_0x5b8d5a){_0x31127e['count']=_0x5b8d5a;if(_0x1f0b5d[_0xa544('0x32')][_0xa544('0x41')]){_0x2af390['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xa544('0x42')](_0x2af390);})[_0xa544('0x22')](function(_0x25f64e){_0x31127e[_0xa544('0x43')]=_0x25f64e;return _0x31127e;})[_0xa544('0x22')](respondWithFilteredResult(_0xdd8d75,_0x2af390))[_0xa544('0x44')](handleError(_0xdd8d75,null));};exports[_0xa544('0x45')]=function(_0x5081b2,_0x51d7a1){var _0x1e687f={'raw':![],'where':{'id':_0x5081b2[_0xa544('0x46')]['id']}},_0x3a6dae={};_0x3a6dae[_0xa544('0x30')]=_['keys'](db[_0xa544('0x2b')][_0xa544('0x2c')]);_0x3a6dae[_0xa544('0x32')]=_[_0xa544('0x31')](_0x5081b2[_0xa544('0x32')]);_0x3a6dae['filters']=_[_0xa544('0x34')](_0x3a6dae[_0xa544('0x30')],_0x3a6dae[_0xa544('0x32')]);_0x1e687f[_0xa544('0x33')]=_[_0xa544('0x34')](_0x3a6dae['model'],qs['fields'](_0x5081b2['query'][_0xa544('0x35')]));_0x1e687f[_0xa544('0x33')]=_0x1e687f[_0xa544('0x33')]['length']?_0x1e687f[_0xa544('0x33')]:_0x3a6dae[_0xa544('0x30')];if(_0x5081b2[_0xa544('0x32')][_0xa544('0x41')]){_0x1e687f['include']=[{'all':!![]}];}_0x1e687f=_[_0xa544('0x3e')]({},_0x1e687f,_0x5081b2[_0xa544('0x40')]);return db[_0xa544('0x2b')][_0xa544('0x47')](_0x1e687f)[_0xa544('0x22')](handleEntityNotFound(_0x51d7a1,null))[_0xa544('0x22')](respondWithResult(_0x51d7a1,null))[_0xa544('0x44')](handleError(_0x51d7a1,null));};exports['create']=function(_0x2e1e41,_0x453352){return db['UserProfileSection']['create'](_0x2e1e41[_0xa544('0x48')],{})[_0xa544('0x22')](respondWithResult(_0x453352,0xc9))[_0xa544('0x44')](handleError(_0x453352,null));};exports['update']=function(_0xf5ede6,_0x3c5a23){if(_0xf5ede6[_0xa544('0x48')]['id']){delete _0xf5ede6['body']['id'];}return db[_0xa544('0x2b')][_0xa544('0x47')]({'where':{'id':_0xf5ede6[_0xa544('0x46')]['id']}})[_0xa544('0x22')](handleEntityNotFound(_0x3c5a23,null))[_0xa544('0x22')](saveUpdates(_0xf5ede6['body'],null))[_0xa544('0x22')](respondWithResult(_0x3c5a23,null))['catch'](handleError(_0x3c5a23,null));};exports[_0xa544('0x23')]=function(_0x5f1634,_0x1523cc){return db[_0xa544('0x2b')][_0xa544('0x47')]({'where':{'id':_0x5f1634[_0xa544('0x46')]['id']}})[_0xa544('0x22')](handleEntityNotFound(_0x1523cc,null))[_0xa544('0x22')](removeEntity(_0x1523cc,null))[_0xa544('0x44')](handleError(_0x1523cc,null));};exports[_0xa544('0x49')]=function(_0x396e3b,_0x1de60){return db[_0xa544('0x2b')][_0xa544('0x49')]()['then'](respondWithResult(_0x1de60,null))['catch'](handleError(_0x1de60,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 30433ae..2225e01 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 _0xdab3=['request-promise','rimraf','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','api'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0xdab3,0x97));var _0x3dab=function(_0x1fa896,_0x19dca0){_0x1fa896=_0x1fa896-0x0;var _0x2f856c=_0xdab3[_0x1fa896];return _0x2f856c;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var logger=require('../../config/logger')(_0x3dab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3dab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dab('0x4'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x3dab('0x5')]=function(_0x1ab4b1,_0x1c00a4){return _0x1ab4b1[_0x3dab('0x6')](_0x3dab('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x3dab('0x8'),'fields':[_0x3dab('0x9'),_0x3dab('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4b=['rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','sectionId','userProfileId','../../config/logger','api','moment','bluebird'];(function(_0x4eca71,_0x93e47e){var _0x45d25d=function(_0x155791){while(--_0x155791){_0x4eca71['push'](_0x4eca71['shift']());}};_0x45d25d(++_0x93e47e);}(_0x0f4b,0x1a9));var _0xb0f4=function(_0x2c93f0,_0x2a88e7){_0x2c93f0=_0x2c93f0-0x0;var _0x2dc388=_0x0f4b[_0x2c93f0];return _0x2dc388;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb0f4('0x0'))(_0xb0f4('0x1'));var moment=require(_0xb0f4('0x2'));var BPromise=require(_0xb0f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0f4('0x4'));var config=require(_0xb0f4('0x5'));var attributes=require(_0xb0f4('0x6'));module['exports']=function(_0x3cc841,_0x379070){return _0x3cc841[_0xb0f4('0x7')](_0xb0f4('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb0f4('0x9'),_0xb0f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 25f8879..faeaf15 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 _0x28fd=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x92bfee,_0x432620){var _0x49cca2=function(_0x8336a4){while(--_0x8336a4){_0x92bfee['push'](_0x92bfee['shift']());}};_0x49cca2(++_0x432620);}(_0x28fd,0x135));var _0xd28f=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x28fd[_0x24fa1a];return _0xc5621f;};'use strict';var _=require(_0xd28f('0x0'));var util=require(_0xd28f('0x1'));var moment=require(_0xd28f('0x2'));var BPromise=require(_0xd28f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd28f('0x4'));var db=require(_0xd28f('0x5'))['db'];var utils=require(_0xd28f('0x6'));var logger=require(_0xd28f('0x7'))(_0xd28f('0x8'));var config=require(_0xd28f('0x9'));var jayson=require(_0xd28f('0xa'));var client=jayson[_0xd28f('0xb')][_0xd28f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58c5f8,_0x2eda16,_0x28acdf){return new BPromise(function(_0x1ffa2c,_0x307a2e){return client[_0xd28f('0xd')](_0x58c5f8,_0x28acdf)[_0xd28f('0xe')](function(_0x46c5cc){logger[_0xd28f('0xf')](_0xd28f('0x10'),_0x2eda16,_0xd28f('0x11'));logger['debug'](_0xd28f('0x12'),_0x2eda16,_0xd28f('0x11'),JSON[_0xd28f('0x13')](_0x46c5cc));if(_0x46c5cc[_0xd28f('0x14')]){if(_0x46c5cc[_0xd28f('0x14')]['code']===0x1f4){logger['error'](_0xd28f('0x10'),_0x2eda16,_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);return _0x307a2e(_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);}logger[_0xd28f('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x2eda16,_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);return _0x1ffa2c(_0x46c5cc[_0xd28f('0x14')][_0xd28f('0x15')]);}else{logger[_0xd28f('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2eda16,_0xd28f('0x11'));_0x1ffa2c(_0x46c5cc[_0xd28f('0x16')][_0xd28f('0x15')]);}})[_0xd28f('0x17')](function(_0x594e7a){logger['error'](_0xd28f('0x10'),_0x2eda16,_0x594e7a);_0x307a2e(_0x594e7a);});});} \ No newline at end of file +var _0x7056=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x881128,_0x4e73b9){var _0x53f69f=function(_0x17f410){while(--_0x17f410){_0x881128['push'](_0x881128['shift']());}};_0x53f69f(++_0x4e73b9);}(_0x7056,0xc1));var _0x6705=function(_0x23291a,_0x9d9e12){_0x23291a=_0x23291a-0x0;var _0x75ae3d=_0x7056[_0x23291a];return _0x75ae3d;};'use strict';var _=require(_0x6705('0x0'));var util=require(_0x6705('0x1'));var moment=require('moment');var BPromise=require(_0x6705('0x2'));var rs=require(_0x6705('0x3'));var fs=require('fs');var Redis=require(_0x6705('0x4'));var db=require(_0x6705('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6705('0x6'))('rpc');var config=require(_0x6705('0x7'));var jayson=require(_0x6705('0x8'));var client=jayson[_0x6705('0x9')][_0x6705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b9e0a,_0x424809,_0x2033c6){return new BPromise(function(_0x555454,_0x67a6b5){return client[_0x6705('0xb')](_0x4b9e0a,_0x2033c6)[_0x6705('0xc')](function(_0x15b58c){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x424809,_0x6705('0xd'));logger[_0x6705('0xe')](_0x6705('0xf'),_0x424809,_0x6705('0xd'),JSON[_0x6705('0x10')](_0x15b58c));if(_0x15b58c[_0x6705('0x11')]){if(_0x15b58c[_0x6705('0x11')][_0x6705('0x12')]===0x1f4){logger['error'](_0x6705('0x13'),_0x424809,_0x15b58c[_0x6705('0x11')]['message']);return _0x67a6b5(_0x15b58c[_0x6705('0x11')][_0x6705('0x14')]);}logger[_0x6705('0x11')](_0x6705('0x13'),_0x424809,_0x15b58c[_0x6705('0x11')][_0x6705('0x14')]);return _0x555454(_0x15b58c['error']['message']);}else{logger[_0x6705('0x15')](_0x6705('0x13'),_0x424809,_0x6705('0xd'));_0x555454(_0x15b58c[_0x6705('0x16')]['message']);}})['catch'](function(_0x2cec7f){logger[_0x6705('0x11')](_0x6705('0x13'),_0x424809,_0x2cec7f);_0x67a6b5(_0x2cec7f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 92a6eee..7d85fb7 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 _0x9a50=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x9a50,0xe4));var _0x09a5=function(_0x36e0e9,_0x138073){_0x36e0e9=_0x36e0e9-0x0;var _0x4591f5=_0x9a50[_0x36e0e9];return _0x4591f5;};'use strict';var multer=require(_0x09a5('0x0'));var util=require(_0x09a5('0x1'));var path=require(_0x09a5('0x2'));var timeout=require(_0x09a5('0x3'));var express=require(_0x09a5('0x4'));var router=express[_0x09a5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x09a5('0x6'));var config=require(_0x09a5('0x7'));module[_0x09a5('0x8')]=router; \ No newline at end of file +var _0x0edc=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x526137,_0x43ff1c){var _0x92cec=function(_0x7b288e){while(--_0x7b288e){_0x526137['push'](_0x526137['shift']());}};_0x92cec(++_0x43ff1c);}(_0x0edc,0x9f));var _0xc0ed=function(_0x2d964d,_0x599ad8){_0x2d964d=_0x2d964d-0x0;var _0x59d1d2=_0x0edc[_0x2d964d];return _0x59d1d2;};'use strict';var multer=require(_0xc0ed('0x0'));var util=require(_0xc0ed('0x1'));var path=require(_0xc0ed('0x2'));var timeout=require('connect-timeout');var express=require(_0xc0ed('0x3'));var router=express[_0xc0ed('0x4')]();var auth=require(_0xc0ed('0x5'));var interaction=require(_0xc0ed('0x6'));var config=require(_0xc0ed('0x7'));module[_0xc0ed('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6261860..9920734 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x436dba,_0x3ed17f){var _0x4a3de6=function(_0x41f56b){while(--_0x41f56b){_0x436dba['push'](_0x436dba['shift']());}};_0x4a3de6(++_0x3ed17f);}(_0xe706,0xa3));var _0x6e70=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0xe706[_0x1903aa];return _0x51fe28;};'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(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index dc4109f..151c5e6 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 _0xada1=['define','UserSmsQueue','user_has_sms_queues','lodash','util','api','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x172e2a,_0x1addf7){var _0xa5c441=function(_0x10c1f1){while(--_0x10c1f1){_0x172e2a['push'](_0x172e2a['shift']());}};_0xa5c441(++_0x1addf7);}(_0xada1,0x12c));var _0x1ada=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xada1[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x1ada('0x0'));var util=require(_0x1ada('0x1'));var logger=require('../../config/logger')(_0x1ada('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ada('0x3'));var fs=require('fs');var path=require(_0x1ada('0x4'));var rimraf=require('rimraf');var config=require(_0x1ada('0x5'));var attributes=require(_0x1ada('0x6'));module[_0x1ada('0x7')]=function(_0x185211,_0x21aecb){return _0x185211[_0x1ada('0x8')](_0x1ada('0x9'),attributes,{'tableName':_0x1ada('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75a4=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','UserSmsQueue','user_has_sms_queues'];(function(_0x4765c5,_0x40917e){var _0x22576e=function(_0x194252){while(--_0x194252){_0x4765c5['push'](_0x4765c5['shift']());}};_0x22576e(++_0x40917e);}(_0x75a4,0x110));var _0x475a=function(_0x1d344b,_0x3a7f7c){_0x1d344b=_0x1d344b-0x0;var _0x421744=_0x75a4[_0x1d344b];return _0x421744;};'use strict';var _=require(_0x475a('0x0'));var util=require(_0x475a('0x1'));var logger=require(_0x475a('0x2'))('api');var moment=require(_0x475a('0x3'));var BPromise=require(_0x475a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x475a('0x5'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x23ef57,_0x2b26ae){return _0x23ef57['define'](_0x475a('0x6'),attributes,{'tableName':_0x475a('0x7'),'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 023ba44..042ace1 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 _0xec69=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4557a9,_0x1e7ecb){var _0x45796a=function(_0xf01e00){while(--_0xf01e00){_0x4557a9['push'](_0x4557a9['shift']());}};_0x45796a(++_0x1e7ecb);}(_0xec69,0xdb));var _0x9ec6=function(_0x23607f,_0x51db51){_0x23607f=_0x23607f-0x0;var _0x5a5be0=_0xec69[_0x23607f];return _0x5a5be0;};'use strict';var _=require(_0x9ec6('0x0'));var util=require(_0x9ec6('0x1'));var moment=require(_0x9ec6('0x2'));var BPromise=require(_0x9ec6('0x3'));var rs=require(_0x9ec6('0x4'));var fs=require('fs');var Redis=require(_0x9ec6('0x5'));var db=require(_0x9ec6('0x6'))['db'];var utils=require(_0x9ec6('0x7'));var logger=require(_0x9ec6('0x8'))('rpc');var config=require(_0x9ec6('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a299b,_0x59a129,_0xbce34f){return new BPromise(function(_0x3beeb4,_0x16d536){return client['request'](_0x4a299b,_0xbce34f)['then'](function(_0x4a6e8b){logger['info'](_0x9ec6('0xa'),_0x59a129,'request\x20sent');logger['debug'](_0x9ec6('0xb'),_0x59a129,_0x9ec6('0xc'),JSON[_0x9ec6('0xd')](_0x4a6e8b));if(_0x4a6e8b[_0x9ec6('0xe')]){if(_0x4a6e8b[_0x9ec6('0xe')][_0x9ec6('0xf')]===0x1f4){logger[_0x9ec6('0xe')](_0x9ec6('0xa'),_0x59a129,_0x4a6e8b['error'][_0x9ec6('0x10')]);return _0x16d536(_0x4a6e8b[_0x9ec6('0xe')][_0x9ec6('0x10')]);}logger[_0x9ec6('0xe')](_0x9ec6('0xa'),_0x59a129,_0x4a6e8b[_0x9ec6('0xe')]['message']);return _0x3beeb4(_0x4a6e8b[_0x9ec6('0xe')][_0x9ec6('0x10')]);}else{logger[_0x9ec6('0x11')](_0x9ec6('0xa'),_0x59a129,'request\x20sent');_0x3beeb4(_0x4a6e8b[_0x9ec6('0x12')]['message']);}})[_0x9ec6('0x13')](function(_0x1b40d0){logger[_0x9ec6('0xe')](_0x9ec6('0xa'),_0x59a129,_0x1b40d0);_0x16d536(_0x1b40d0);});});} \ No newline at end of file +var _0xc455=['../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x24040c,_0x45d054){var _0x2e7880=function(_0x29f701){while(--_0x29f701){_0x24040c['push'](_0x24040c['shift']());}};_0x2e7880(++_0x45d054);}(_0xc455,0x19f));var _0x5c45=function(_0x5bfff5,_0x13a721){_0x5bfff5=_0x5bfff5-0x0;var _0x3a00c6=_0xc455[_0x5bfff5];return _0x3a00c6;};'use strict';var _=require(_0x5c45('0x0'));var util=require(_0x5c45('0x1'));var moment=require('moment');var BPromise=require(_0x5c45('0x2'));var rs=require(_0x5c45('0x3'));var fs=require('fs');var Redis=require(_0x5c45('0x4'));var db=require(_0x5c45('0x5'))['db'];var utils=require(_0x5c45('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5c45('0x7'));var client=jayson[_0x5c45('0x8')][_0x5c45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bc57a,_0x309fff,_0x16a261){return new BPromise(function(_0x41c442,_0x5a4f94){return client[_0x5c45('0xa')](_0x5bc57a,_0x16a261)[_0x5c45('0xb')](function(_0x8c9d76){logger['info'](_0x5c45('0xc'),_0x309fff,_0x5c45('0xd'));logger['debug'](_0x5c45('0xe'),_0x309fff,_0x5c45('0xd'),JSON[_0x5c45('0xf')](_0x8c9d76));if(_0x8c9d76[_0x5c45('0x10')]){if(_0x8c9d76[_0x5c45('0x10')]['code']===0x1f4){logger[_0x5c45('0x10')](_0x5c45('0xc'),_0x309fff,_0x8c9d76[_0x5c45('0x10')]['message']);return _0x5a4f94(_0x8c9d76[_0x5c45('0x10')][_0x5c45('0x11')]);}logger[_0x5c45('0x10')](_0x5c45('0xc'),_0x309fff,_0x8c9d76[_0x5c45('0x10')]['message']);return _0x41c442(_0x8c9d76[_0x5c45('0x10')][_0x5c45('0x11')]);}else{logger[_0x5c45('0x12')](_0x5c45('0xc'),_0x309fff,_0x5c45('0xd'));_0x41c442(_0x8c9d76['result'][_0x5c45('0x11')]);}})[_0x5c45('0x13')](function(_0x2c8945){logger[_0x5c45('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x309fff,_0x2c8945);_0x5a4f94(_0x2c8945);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index df06b4b..8d58991 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 _0x96ef=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x356989,_0x307520){var _0x198ec0=function(_0x4bd207){while(--_0x4bd207){_0x356989['push'](_0x356989['shift']());}};_0x198ec0(++_0x307520);}(_0x96ef,0x96));var _0xf96e=function(_0x1e8b55,_0x48387f){_0x1e8b55=_0x1e8b55-0x0;var _0x2472d1=_0x96ef[_0x1e8b55];return _0x2472d1;};'use strict';var multer=require(_0xf96e('0x0'));var util=require(_0xf96e('0x1'));var path=require(_0xf96e('0x2'));var timeout=require(_0xf96e('0x3'));var express=require(_0xf96e('0x4'));var router=express[_0xf96e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf96e('0x6'));var config=require(_0xf96e('0x7'));module[_0xf96e('0x8')]=router; \ No newline at end of file +var _0x8446=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x8446,0xfe));var _0x6844=function(_0x1715a2,_0x13d1d3){_0x1715a2=_0x1715a2-0x0;var _0x447fc1=_0x8446[_0x1715a2];return _0x447fc1;};'use strict';var multer=require(_0x6844('0x0'));var util=require(_0x6844('0x1'));var path=require(_0x6844('0x2'));var timeout=require(_0x6844('0x3'));var express=require(_0x6844('0x4'));var router=express['Router']();var auth=require(_0x6844('0x5'));var interaction=require(_0x6844('0x6'));var config=require(_0x6844('0x7'));module[_0x6844('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 dce7f56..d6c321f 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x591121,_0x4cdfb5){var _0x2f466a=function(_0x43c759){while(--_0x43c759){_0x591121['push'](_0x591121['shift']());}};_0x2f466a(++_0x4cdfb5);}(_0xe706,0xa3));var _0x6e70=function(_0x302d1a,_0x387081){_0x302d1a=_0x302d1a-0x0;var _0xd82ca=_0xe706[_0x302d1a];return _0xd82ca;};'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(_0x32f2ed,_0x467862){var _0x38f276=function(_0x5b85ce){while(--_0x5b85ce){_0x32f2ed['push'](_0x32f2ed['shift']());}};_0x38f276(++_0x467862);}(_0xb10b,0x12a));var _0xbb10=function(_0x210ccc,_0x18a85a){_0x210ccc=_0x210ccc-0x0;var _0x334164=_0xb10b[_0x210ccc];return _0x334164;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ff68519..dbddc4a 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 _0x80d9=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','user_has_voice_queues','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d9,0x15c));var _0x980d=function(_0x593cef,_0x55348d){_0x593cef=_0x593cef-0x0;var _0x1f7ed4=_0x80d9[_0x593cef];return _0x1f7ed4;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('UserVoiceQueue',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','UserVoiceQueue','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x4b84[_0x22663b];return _0x310d0a;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),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 9873aed..6019ceb 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 _0x8695=['http','request','then','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8695,0xb5));var _0x5869=function(_0x4808ee,_0x5e1d72){_0x4808ee=_0x4808ee-0x0;var _0x23ed56=_0x8695[_0x4808ee];return _0x23ed56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5869('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5869('0x1'));var db=require(_0x5869('0x2'))['db'];var utils=require(_0x5869('0x3'));var logger=require('../../config/logger')(_0x5869('0x4'));var config=require(_0x5869('0x5'));var jayson=require(_0x5869('0x6'));var client=jayson[_0x5869('0x7')][_0x5869('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25668e,_0x21ddc0,_0x341908){return new BPromise(function(_0x3d4771,_0x4da5ab){return client[_0x5869('0x9')](_0x25668e,_0x341908)[_0x5869('0xa')](function(_0x372e18){logger['info'](_0x5869('0xb'),_0x21ddc0,'request\x20sent');logger[_0x5869('0xc')](_0x5869('0xd'),_0x21ddc0,_0x5869('0xe'),JSON['stringify'](_0x372e18));if(_0x372e18[_0x5869('0xf')]){if(_0x372e18[_0x5869('0xf')][_0x5869('0x10')]===0x1f4){logger[_0x5869('0xf')](_0x5869('0xb'),_0x21ddc0,_0x372e18[_0x5869('0xf')][_0x5869('0x11')]);return _0x4da5ab(_0x372e18[_0x5869('0xf')][_0x5869('0x11')]);}logger[_0x5869('0xf')](_0x5869('0xb'),_0x21ddc0,_0x372e18[_0x5869('0xf')][_0x5869('0x11')]);return _0x3d4771(_0x372e18['error'][_0x5869('0x11')]);}else{logger[_0x5869('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x21ddc0,_0x5869('0xe'));_0x3d4771(_0x372e18[_0x5869('0x13')][_0x5869('0x11')]);}})[_0x5869('0x14')](function(_0x488481){logger[_0x5869('0xf')](_0x5869('0xb'),_0x21ddc0,_0x488481);_0x4da5ab(_0x488481);});});} \ No newline at end of file +var _0x8f95=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x1524a7,_0xffe64d){var _0x6a4acf=function(_0x28fb95){while(--_0x28fb95){_0x1524a7['push'](_0x1524a7['shift']());}};_0x6a4acf(++_0xffe64d);}(_0x8f95,0x108));var _0x58f9=function(_0x3f2ef3,_0x3f16f1){_0x3f2ef3=_0x3f2ef3-0x0;var _0x3fd1a3=_0x8f95[_0x3f2ef3];return _0x3fd1a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x58f9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f9('0x1'))['db'];var utils=require(_0x58f9('0x2'));var logger=require(_0x58f9('0x3'))(_0x58f9('0x4'));var config=require(_0x58f9('0x5'));var jayson=require(_0x58f9('0x6'));var client=jayson[_0x58f9('0x7')][_0x58f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12245f,_0x5071f7,_0x3e5374){return new BPromise(function(_0x23261f,_0x468523){return client[_0x58f9('0x9')](_0x12245f,_0x3e5374)[_0x58f9('0xa')](function(_0x581e45){logger[_0x58f9('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x5071f7,_0x58f9('0xc'));logger[_0x58f9('0xd')](_0x58f9('0xe'),_0x5071f7,_0x58f9('0xc'),JSON[_0x58f9('0xf')](_0x581e45));if(_0x581e45[_0x58f9('0x10')]){if(_0x581e45[_0x58f9('0x10')][_0x58f9('0x11')]===0x1f4){logger[_0x58f9('0x10')](_0x58f9('0x12'),_0x5071f7,_0x581e45['error'][_0x58f9('0x13')]);return _0x468523(_0x581e45[_0x58f9('0x10')][_0x58f9('0x13')]);}logger['error'](_0x58f9('0x12'),_0x5071f7,_0x581e45[_0x58f9('0x10')][_0x58f9('0x13')]);return _0x23261f(_0x581e45[_0x58f9('0x10')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x5071f7,_0x58f9('0xc'));_0x23261f(_0x581e45[_0x58f9('0x14')][_0x58f9('0x13')]);}})[_0x58f9('0x15')](function(_0x599c9b){logger[_0x58f9('0x10')](_0x58f9('0x12'),_0x5071f7,_0x599c9b);_0x468523(_0x599c9b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f6cf0dd..abdea36 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 _0x254b=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xb31f,_0x229502){var _0x134fe7=function(_0x53de89){while(--_0x53de89){_0xb31f['push'](_0xb31f['shift']());}};_0x134fe7(++_0x229502);}(_0x254b,0x110));var _0xb254=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x254b[_0x270adf];return _0x29eda9;};'use strict';var multer=require(_0xb254('0x0'));var util=require(_0xb254('0x1'));var path=require(_0xb254('0x2'));var timeout=require(_0xb254('0x3'));var express=require(_0xb254('0x4'));var router=express['Router']();var auth=require(_0xb254('0x5'));var interaction=require(_0xb254('0x6'));var config=require(_0xb254('0x7'));module[_0xb254('0x8')]=router; \ No newline at end of file +var _0xc855=['connect-timeout','../../components/auth/service','../../components/interaction/service','exports','multer','util'];(function(_0x61dcaa,_0x59ee33){var _0x1e3674=function(_0x2b0c01){while(--_0x2b0c01){_0x61dcaa['push'](_0x61dcaa['shift']());}};_0x1e3674(++_0x59ee33);}(_0xc855,0xdc));var _0x5c85=function(_0x3a2354,_0x5c0602){_0x3a2354=_0x3a2354-0x0;var _0x43ba2e=_0xc855[_0x3a2354];return _0x43ba2e;};'use strict';var multer=require(_0x5c85('0x0'));var util=require(_0x5c85('0x1'));var path=require('path');var timeout=require(_0x5c85('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5c85('0x3'));var interaction=require(_0x5c85('0x4'));var config=require('../../config/environment');module[_0x5c85('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 4b24e8a..c95db32 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 _0x76c9=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x1475be,_0x4ed47c){var _0x306b4e=function(_0x991d85){while(--_0x991d85){_0x1475be['push'](_0x1475be['shift']());}};_0x306b4e(++_0x4ed47c);}(_0x76c9,0x1bc));var _0x976c=function(_0x5d63af,_0x4e8f02){_0x5d63af=_0x5d63af-0x0;var _0x819714=_0x76c9[_0x5d63af];return _0x819714;};'use strict';var Sequelize=require(_0x976c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x976c('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x976c('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x976c('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x976c('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x976c('0x4'),'comment':_0x976c('0x2')},'penalty':{'type':Sequelize[_0x976c('0x1')](0xb),'defaultValue':0x0,'comment':_0x976c('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x976c('0x2')}}; \ No newline at end of file +var _0xa200=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4d0ab9,_0x33fc36){var _0x2ac90d=function(_0x2b114c){while(--_0x2b114c){_0x4d0ab9['push'](_0x4d0ab9['shift']());}};_0x2ac90d(++_0x33fc36);}(_0xa200,0x1a9));var _0x0a20=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa200[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0a20('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0a20('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0a20('0x2')},'membername':{'type':Sequelize[_0x0a20('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x0a20('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a20('0x4'),'comment':_0x0a20('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0a20('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0a20('0x3')],'allowNull':![],'unique':_0x0a20('0x4'),'comment':_0x0a20('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](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 2ecc1df..67f16a3 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 _0x1908=['emit','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x1908,0x119));var _0x8190=function(_0x28d1fa,_0x31125b){_0x28d1fa=_0x28d1fa-0x0;var _0x5d5dc9=_0x1908[_0x28d1fa];return _0x5d5dc9;};'use strict';var EventEmitter=require(_0x8190('0x0'));var UserVoiceQueueRt=require(_0x8190('0x1'))['db'][_0x8190('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8190('0x3')](0x0);var events={'afterCreate':_0x8190('0x4'),'afterUpdate':_0x8190('0x5'),'afterDestroy':_0x8190('0x6')};function emitEvent(_0x240069){return function(_0x507a97,_0x43e6df,_0x45a33a){UserVoiceQueueRtEvents[_0x8190('0x7')](_0x240069+':'+_0x507a97['id'],_0x507a97);UserVoiceQueueRtEvents[_0x8190('0x7')](_0x240069,_0x507a97);_0x45a33a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x8190('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x734a=['../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x231295,_0x5f0700){var _0x15c39b=function(_0x542343){while(--_0x542343){_0x231295['push'](_0x231295['shift']());}};_0x15c39b(++_0x5f0700);}(_0x734a,0x16f));var _0xa734=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x734a[_0x4cb8e7];return _0x3d0188;};'use strict';var EventEmitter=require(_0xa734('0x0'));var UserVoiceQueueRt=require(_0xa734('0x1'))['db'][_0xa734('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa734('0x3'),'afterDestroy':_0xa734('0x4')};function emitEvent(_0x39011f){return function(_0x1a75d9,_0x43b3f6,_0x1ab08e){UserVoiceQueueRtEvents[_0xa734('0x5')](_0x39011f+':'+_0x1a75d9['id'],_0x1a75d9);UserVoiceQueueRtEvents[_0xa734('0x5')](_0x39011f,_0x1a75d9);_0x1ab08e(null);};}for(var e in events){if(events[_0xa734('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa734('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index b4b06a8..24bfe12 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 _0x06bc=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06bc,0x1c9));var _0xc06b=function(_0x500489,_0x3e7970){_0x500489=_0x500489-0x0;var _0x5b8ddd=_0x06bc[_0x500489];return _0x5b8ddd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc06b('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc06b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc06b('0x2'));var rimraf=require(_0xc06b('0x3'));var config=require(_0xc06b('0x4'));var attributes=require(_0xc06b('0x5'));module[_0xc06b('0x6')]=function(_0x243376,_0x4f6dce){return _0x243376['define'](_0xc06b('0x7'),attributes,{'tableName':_0xc06b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d9=['bluebird','../../config/environment','./userVoiceQueueRt.attributes','exports','define','../../config/logger','api','moment'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0xb0d9,0x115));var _0x9b0d=function(_0x199c00,_0x76ae17){_0x199c00=_0x199c00-0x0;var _0x4732f1=_0xb0d9[_0x199c00];return _0x4732f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9b0d('0x0'))(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9b0d('0x4'));var attributes=require(_0x9b0d('0x5'));module[_0x9b0d('0x6')]=function(_0x518073,_0x2b96ba){return _0x518073[_0x9b0d('0x7')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index d3200f6..52cf262 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 _0x130b=['COUNT','then','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize'];(function(_0x4c759e,_0x47c638){var _0xd74c92=function(_0x4b5544){while(--_0x4b5544){_0x4c759e['push'](_0x4c759e['shift']());}};_0xd74c92(++_0x47c638);}(_0x130b,0xff));var _0xb130=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x130b[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0xb130('0x0'));var moment=require('moment');var BPromise=require(_0xb130('0x1'));var rs=require(_0xb130('0x2'));var fs=require('fs');var Redis=require(_0xb130('0x3'));var db=require(_0xb130('0x4'))['db'];var utils=require(_0xb130('0x5'));var logger=require(_0xb130('0x6'))(_0xb130('0x7'));var config=require(_0xb130('0x8'));var jayson=require(_0xb130('0x9'));var client=jayson[_0xb130('0xa')][_0xb130('0xb')]({'port':0x232a});config[_0xb130('0xc')]=_[_0xb130('0xd')](config[_0xb130('0xc')],{'host':_0xb130('0xe'),'port':0x18eb});var socket=require(_0xb130('0xf'))(new Redis(config[_0xb130('0xc')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x2b35f9,_0x4b349a,_0x3e5c9c){return new BPromise(function(_0x1e9efd,_0x591ee2){return client[_0xb130('0x10')](_0x2b35f9,_0x3e5c9c)['then'](function(_0x15bed1){logger['info'](_0xb130('0x11'),_0x4b349a,_0xb130('0x12'));logger[_0xb130('0x13')](_0xb130('0x14'),_0x4b349a,_0xb130('0x12'),JSON[_0xb130('0x15')](_0x15bed1));if(_0x15bed1['error']){if(_0x15bed1[_0xb130('0x16')][_0xb130('0x17')]===0x1f4){logger[_0xb130('0x16')](_0xb130('0x11'),_0x4b349a,_0x15bed1[_0xb130('0x16')]['message']);return _0x591ee2(_0x15bed1[_0xb130('0x16')][_0xb130('0x18')]);}logger[_0xb130('0x16')](_0xb130('0x11'),_0x4b349a,_0x15bed1[_0xb130('0x16')][_0xb130('0x18')]);return _0x1e9efd(_0x15bed1[_0xb130('0x16')][_0xb130('0x18')]);}else{logger['info'](_0xb130('0x11'),_0x4b349a,_0xb130('0x12'));_0x1e9efd(_0x15bed1[_0xb130('0x19')][_0xb130('0x18')]);}})[_0xb130('0x1a')](function(_0x3f0ee0){logger['error'](_0xb130('0x11'),_0x4b349a,_0x3f0ee0);_0x591ee2(_0x3f0ee0);});});}exports[_0xb130('0x1b')]=function(_0x29f1b8){var _0x489707=this;return new Promise(function(_0x59a333,_0x322d3e){return db['UserVoiceQueueRt'][_0xb130('0x1c')]({'raw':_0x29f1b8[_0xb130('0x1d')]?_0x29f1b8[_0xb130('0x1d')][_0xb130('0x1e')]===undefined?!![]:![]:!![],'where':_0x29f1b8['options']?_0x29f1b8[_0xb130('0x1d')][_0xb130('0x1f')]||null:null,'attributes':[[db[_0xb130('0x20')]['fn'](_0xb130('0x21'),db['sequelize']['fn']('IF',db[_0xb130('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xb130('0x22')](function(_0x36dd3c){logger[_0xb130('0x23')](_0xb130('0x1b'),_0x29f1b8);logger[_0xb130('0x13')](_0xb130('0x1b'),_0x29f1b8,JSON[_0xb130('0x15')](_0x36dd3c));_0x59a333(_0x36dd3c);})[_0xb130('0x1a')](function(_0x2db011){logger[_0xb130('0x16')](_0xb130('0x1b'),_0x2db011[_0xb130('0x18')],_0x29f1b8);_0x322d3e(_0x489707[_0xb130('0x16')](0x1f4,_0x2db011[_0xb130('0x18')]));});});}; \ No newline at end of file +var _0xb6d8=['defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','literal','outboundQueuePauses','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1f7e3a,_0x57975f){var _0x27e6f6=function(_0x4523bc){while(--_0x4523bc){_0x1f7e3a['push'](_0x1f7e3a['shift']());}};_0x27e6f6(++_0x57975f);}(_0xb6d8,0x198));var _0x8b6d=function(_0x43675c,_0x408d85){_0x43675c=_0x43675c-0x0;var _0x362215=_0xb6d8[_0x43675c];return _0x362215;};'use strict';var _=require(_0x8b6d('0x0'));var util=require('util');var moment=require(_0x8b6d('0x1'));var BPromise=require(_0x8b6d('0x2'));var rs=require(_0x8b6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b6d('0x4'))['db'];var utils=require(_0x8b6d('0x5'));var logger=require(_0x8b6d('0x6'))(_0x8b6d('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b6d('0x8'));var client=jayson[_0x8b6d('0x9')][_0x8b6d('0xa')]({'port':0x232a});config[_0x8b6d('0xb')]=_[_0x8b6d('0xc')](config[_0x8b6d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b6d('0xd'))(new Redis(config[_0x8b6d('0xb')]));require(_0x8b6d('0xe'))['register'](socket);function respondWithRpcPromise(_0x5363f6,_0x4a1657,_0x3bfd69){return new BPromise(function(_0x42e104,_0x3dfdc8){return client[_0x8b6d('0xf')](_0x5363f6,_0x3bfd69)[_0x8b6d('0x10')](function(_0x36272b){logger[_0x8b6d('0x11')](_0x8b6d('0x12'),_0x4a1657,_0x8b6d('0x13'));logger['debug'](_0x8b6d('0x14'),_0x4a1657,'request\x20sent',JSON[_0x8b6d('0x15')](_0x36272b));if(_0x36272b[_0x8b6d('0x16')]){if(_0x36272b['error'][_0x8b6d('0x17')]===0x1f4){logger[_0x8b6d('0x16')](_0x8b6d('0x12'),_0x4a1657,_0x36272b[_0x8b6d('0x16')][_0x8b6d('0x18')]);return _0x3dfdc8(_0x36272b[_0x8b6d('0x16')]['message']);}logger[_0x8b6d('0x16')](_0x8b6d('0x12'),_0x4a1657,_0x36272b[_0x8b6d('0x16')][_0x8b6d('0x18')]);return _0x42e104(_0x36272b[_0x8b6d('0x16')][_0x8b6d('0x18')]);}else{logger['info'](_0x8b6d('0x12'),_0x4a1657,_0x8b6d('0x13'));_0x42e104(_0x36272b[_0x8b6d('0x19')][_0x8b6d('0x18')]);}})[_0x8b6d('0x1a')](function(_0x191357){logger[_0x8b6d('0x16')](_0x8b6d('0x12'),_0x4a1657,_0x191357);_0x3dfdc8(_0x191357);});});}exports[_0x8b6d('0x1b')]=function(_0x1a8107){var _0x15dcbc=this;return new Promise(function(_0x508255,_0x36835b){return db['UserVoiceQueueRt'][_0x8b6d('0x1c')]({'raw':_0x1a8107[_0x8b6d('0x1d')]?_0x1a8107[_0x8b6d('0x1d')][_0x8b6d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a8107[_0x8b6d('0x1d')]?_0x1a8107['options'][_0x8b6d('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8b6d('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x8b6d('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0x8b6d('0x22')]]})[_0x8b6d('0x10')](function(_0x444d59){logger[_0x8b6d('0x11')]('GetVoiceQueueRtPauses',_0x1a8107);logger['debug'](_0x8b6d('0x1b'),_0x1a8107,JSON[_0x8b6d('0x15')](_0x444d59));_0x508255(_0x444d59);})['catch'](function(_0x186662){logger['error'](_0x8b6d('0x1b'),_0x186662[_0x8b6d('0x18')],_0x1a8107);_0x36835b(_0x15dcbc[_0x8b6d('0x16')](0x1f4,_0x186662[_0x8b6d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 09e7b8d..0838308 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 _0xb1c0=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener','length'];(function(_0x22bc06,_0x234eb3){var _0x7e0288=function(_0x4bdf90){while(--_0x4bdf90){_0x22bc06['push'](_0x22bc06['shift']());}};_0x7e0288(++_0x234eb3);}(_0xb1c0,0x1a5));var _0x0b1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1c0[_0x20a584];return _0x4b41a8;};'use strict';var UserVoiceQueueRtEvents=require(_0x0b1c('0x0'));var events=[_0x0b1c('0x1'),_0x0b1c('0x2'),'update'];function createListener(_0x1cf00c,_0x5efe3a){return function(_0x2a3e94){_0x5efe3a[_0x0b1c('0x3')](_0x1cf00c,_0x2a3e94);};}function removeListener(_0x5532e3,_0x2e8820){return function(){UserVoiceQueueRtEvents[_0x0b1c('0x4')](_0x5532e3,_0x2e8820);};}exports['register']=function(_0x40a4b4){for(var _0x2bdc6c=0x0,_0x27206c=events[_0x0b1c('0x5')];_0x2bdc6c<_0x27206c;_0x2bdc6c++){var _0x5a1b82=events[_0x2bdc6c];var _0x1cdb02=createListener(_0x0b1c('0x6')+_0x5a1b82,_0x40a4b4);UserVoiceQueueRtEvents['on'](_0x5a1b82,_0x1cdb02);}}; \ No newline at end of file +var _0x0df8=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x0df8,0x98));var _0x80df=function(_0x233f1e,_0x4c42f6){_0x233f1e=_0x233f1e-0x0;var _0x27dc8a=_0x0df8[_0x233f1e];return _0x27dc8a;};'use strict';var UserVoiceQueueRtEvents=require(_0x80df('0x0'));var events=[_0x80df('0x1'),'remove','update'];function createListener(_0x3be113,_0x6d03ce){return function(_0x88e992){_0x6d03ce[_0x80df('0x2')](_0x3be113,_0x88e992);};}function removeListener(_0x3fec57,_0x11b556){return function(){UserVoiceQueueRtEvents[_0x80df('0x3')](_0x3fec57,_0x11b556);};}exports[_0x80df('0x4')]=function(_0x34668a){for(var _0x181c0a=0x0,_0x781c60=events[_0x80df('0x5')];_0x181c0a<_0x781c60;_0x181c0a++){var _0x1e2605=events[_0x181c0a];var _0x247128=createListener(_0x80df('0x6')+_0x1e2605,_0x34668a);UserVoiceQueueRtEvents['on'](_0x1e2605,_0x247128);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2383677..636f5f8 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 _0x023d=['../../config/environment','multer','path','Router','../../components/auth/service'];(function(_0x53cfc1,_0x12ab2b){var _0x399090=function(_0x564ddc){while(--_0x564ddc){_0x53cfc1['push'](_0x53cfc1['shift']());}};_0x399090(++_0x12ab2b);}(_0x023d,0xe7));var _0xd023=function(_0x3885fc,_0x43a3b8){_0x3885fc=_0x3885fc-0x0;var _0x1ce95d=_0x023d[_0x3885fc];return _0x1ce95d;};'use strict';var multer=require(_0xd023('0x0'));var util=require('util');var path=require(_0xd023('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd023('0x2')]();var auth=require(_0xd023('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd023('0x4'));module['exports']=router; \ No newline at end of file +var _0x6d2b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x250ce7,_0x502ad3){var _0x416428=function(_0x46564d){while(--_0x46564d){_0x250ce7['push'](_0x250ce7['shift']());}};_0x416428(++_0x502ad3);}(_0x6d2b,0x16e));var _0xb6d2=function(_0x4d2a53,_0x5a4760){_0x4d2a53=_0x4d2a53-0x0;var _0x421f9d=_0x6d2b[_0x4d2a53];return _0x421f9d;};'use strict';var multer=require(_0xb6d2('0x0'));var util=require(_0xb6d2('0x1'));var path=require(_0xb6d2('0x2'));var timeout=require(_0xb6d2('0x3'));var express=require(_0xb6d2('0x4'));var router=express[_0xb6d2('0x5')]();var auth=require(_0xb6d2('0x6'));var interaction=require(_0xb6d2('0x7'));var config=require(_0xb6d2('0x8'));module[_0xb6d2('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ab45552..08d352a 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(_0x110d5f,_0x2fe2ee){var _0x108100=function(_0x3b70c1){while(--_0x3b70c1){_0x110d5f['push'](_0x110d5f['shift']());}};_0x108100(++_0x2fe2ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x58ac8b,_0x51c5fd){var _0x8f584=function(_0x2231b5){while(--_0x2231b5){_0x58ac8b['push'](_0x58ac8b['shift']());}};_0x8f584(++_0x51c5fd);}(_0xe706,0xa3));var _0x6e70=function(_0x10c4f9,_0x100fb4){_0x10c4f9=_0x10c4f9-0x0;var _0x522b09=_0xe706[_0x10c4f9];return _0x522b09;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 8db88ff..2eb0851 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 _0xb688=['exports','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x4f7c83,_0x380cb4){var _0x3e18a3=function(_0x4cbf58){while(--_0x4cbf58){_0x4f7c83['push'](_0x4f7c83['shift']());}};_0x3e18a3(++_0x380cb4);}(_0xb688,0xcf));var _0x8b68=function(_0x3a5783,_0x1eaa11){_0x3a5783=_0x3a5783-0x0;var _0x1dacac=_0xb688[_0x3a5783];return _0x1dacac;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','api','moment'];(function(_0x88902,_0x494283){var _0x3b16b6=function(_0x27423a){while(--_0x27423a){_0x88902['push'](_0x88902['shift']());}};_0x3b16b6(++_0x494283);}(_0x5423,0xe3));var _0x3542=function(_0x20d34c,_0x30372){_0x20d34c=_0x20d34c-0x0;var _0x660145=_0x5423[_0x20d34c];return _0x660145;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 54aee0e..b6719f4 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(_0x4c8529,_0x20391){var _0x128fac=function(_0x168aec){while(--_0x168aec){_0x4c8529['push'](_0x4c8529['shift']());}};_0x128fac(++_0x20391);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x5788c8,_0x36efd7){var _0x5111bd=function(_0x46a667){while(--_0x46a667){_0x5788c8['push'](_0x5788c8['shift']());}};_0x5111bd(++_0x36efd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0ca5ba4..367146e 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 _0x2c9e=['isAuthenticated','index','post','create','/:id','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x2a118c,_0x593c5b){var _0x2f6aed=function(_0x48c36a){while(--_0x48c36a){_0x2a118c['push'](_0x2a118c['shift']());}};_0x2f6aed(++_0x593c5b);}(_0x2c9e,0x19a));var _0xe2c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c9e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe2c9('0x0'));var path=require('path');var timeout=require(_0xe2c9('0x1'));var express=require('express');var router=express[_0xe2c9('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe2c9('0x3'));var config=require(_0xe2c9('0x4'));var controller=require('./variable.controller');router[_0xe2c9('0x5')]('/',auth[_0xe2c9('0x6')](),controller[_0xe2c9('0x7')]);router[_0xe2c9('0x5')]('/:id',auth[_0xe2c9('0x6')](),controller['show']);router[_0xe2c9('0x8')]('/',auth[_0xe2c9('0x6')](),controller[_0xe2c9('0x9')]);router['put']('/:id',auth[_0xe2c9('0x6')](),controller['update']);router['delete'](_0xe2c9('0xa'),auth[_0xe2c9('0x6')](),controller[_0xe2c9('0xb')]);module[_0xe2c9('0xc')]=router; \ No newline at end of file +var _0x97fb=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','show','post','create'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0x97fb,0x137));var _0xb97f=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0x97fb[_0x3f993e];return _0x39c135;};'use strict';var multer=require(_0xb97f('0x0'));var util=require(_0xb97f('0x1'));var path=require('path');var timeout=require(_0xb97f('0x2'));var express=require(_0xb97f('0x3'));var router=express[_0xb97f('0x4')]();var auth=require(_0xb97f('0x5'));var interaction=require(_0xb97f('0x6'));var config=require('../../config/environment');var controller=require(_0xb97f('0x7'));router['get']('/',auth[_0xb97f('0x8')](),controller['index']);router['get']('/:id',auth[_0xb97f('0x8')](),controller[_0xb97f('0x9')]);router[_0xb97f('0xa')]('/',auth[_0xb97f('0x8')](),controller[_0xb97f('0xb')]);router[_0xb97f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb97f('0xd')]);router[_0xb97f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb97f('0xf')]);module[_0xb97f('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 30debfb..d0fd700 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 _0x923f=['exports','sequelize'];(function(_0x21cb98,_0x44db75){var _0x10cc9e=function(_0x4fef7b){while(--_0x4fef7b){_0x21cb98['push'](_0x21cb98['shift']());}};_0x10cc9e(++_0x44db75);}(_0x923f,0x65));var _0xf923=function(_0x53d435,_0x139b47){_0x53d435=_0x53d435-0x0;var _0x27c2c9=_0x923f[_0x53d435];return _0x27c2c9;};'use strict';var Sequelize=require(_0xf923('0x0'));module[_0xf923('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb1b9=['name','exports','STRING'];(function(_0x1ce23d,_0x25a351){var _0x4338d9=function(_0xf8d3a9){while(--_0xf8d3a9){_0x1ce23d['push'](_0x1ce23d['shift']());}};_0x4338d9(++_0x25a351);}(_0xb1b9,0x12d));var _0x9b1b=function(_0x5b5670,_0x59b8e1){_0x5b5670=_0x5b5670-0x0;var _0x1f569d=_0xb1b9[_0x5b5670];return _0x1f569d;};'use strict';var Sequelize=require('sequelize');module[_0x9b1b('0x0')]={'name':{'type':Sequelize[_0x9b1b('0x1')],'unique':_0x9b1b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9b1b('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7fe3f2c..1f1422f 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 _0x3ccb=['apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','role','Variables','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range'];(function(_0x967492,_0xc41af){var _0x3f7088=function(_0x2d6738){while(--_0x2d6738){_0x967492['push'](_0x967492['shift']());}};_0x3f7088(++_0xc41af);}(_0x3ccb,0xdb));var _0xb3cc=function(_0x18f790,_0x2685ac){_0x18f790=_0x18f790-0x0;var _0x10488c=_0x3ccb[_0x18f790];return _0x10488c;};'use strict';var pdf=require(_0xb3cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb3cc('0x1'));var zipdir=require(_0xb3cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb3cc('0x3'));var util=require(_0xb3cc('0x4'));var path=require(_0xb3cc('0x5'));var sox=require(_0xb3cc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3cc('0x7'));var squel=require('squel');var crypto=require(_0xb3cc('0x8'));var jsforce=require(_0xb3cc('0x9'));var deskjs=require(_0xb3cc('0xa'));var toCsv=require(_0xb3cc('0xb'));var querystring=require(_0xb3cc('0xc'));var Papa=require(_0xb3cc('0xd'));var Redis=require(_0xb3cc('0xe'));var authService=require(_0xb3cc('0xf'));var qs=require(_0xb3cc('0x10'));var as=require(_0xb3cc('0x11'));var hardwareService=require(_0xb3cc('0x12'));var logger=require(_0xb3cc('0x13'))(_0xb3cc('0x14'));var utils=require(_0xb3cc('0x15'));var config=require(_0xb3cc('0x16'));var licenseUtil=require(_0xb3cc('0x17'));var db=require(_0xb3cc('0x18'))['db'];function respondWithStatusCode(_0x302699,_0x4579fb){_0x4579fb=_0x4579fb||0xcc;return function(_0x36935c){if(_0x36935c){return _0x302699[_0xb3cc('0x19')](_0x4579fb);}return _0x302699[_0xb3cc('0x1a')](_0x4579fb)['end']();};}function respondWithResult(_0xcb1402,_0x402685){_0x402685=_0x402685||0xc8;return function(_0x20658e){if(_0x20658e){return _0xcb1402[_0xb3cc('0x1a')](_0x402685)[_0xb3cc('0x1b')](_0x20658e);}};}function respondWithFilteredResult(_0x19d73e,_0x509d76){return function(_0x43a649){if(_0x43a649){var _0x3e234c=_0x43a649[_0xb3cc('0x1c')],_0x852398=_0x509d76[_0xb3cc('0x1d')],_0x16ce0c=_0x509d76[_0xb3cc('0x1d')]+_0x509d76[_0xb3cc('0x1e')],_0x3c240f;if(_0x16ce0c>=_0x3e234c){_0x16ce0c=_0x3e234c;_0x3c240f=0xc8;}else{_0x3c240f=0xce;}_0x19d73e[_0xb3cc('0x1a')](_0x3c240f);return _0x19d73e[_0xb3cc('0x1f')](_0xb3cc('0x20'),_0x852398+'-'+_0x16ce0c+'/'+_0x3e234c)['json'](_0x43a649);}return null;};}function patchUpdates(_0xea8309){return function(_0x40230f){try{jsonpatch[_0xb3cc('0x21')](_0x40230f,_0xea8309,!![]);}catch(_0x3d3733){return BPromise[_0xb3cc('0x22')](_0x3d3733);}return _0x40230f[_0xb3cc('0x23')]();};}function saveUpdates(_0x29eb85,_0x2c10ee){return function(_0x2a42ab){if(_0x2a42ab){return _0x2a42ab[_0xb3cc('0x24')](_0x29eb85)[_0xb3cc('0x25')](function(_0xc11f90){return _0xc11f90;});}return null;};}function removeEntity(_0x5244e1,_0xb74ad0){return function(_0x4bb5d1){if(_0x4bb5d1){return _0x4bb5d1[_0xb3cc('0x26')]()[_0xb3cc('0x25')](function(){var _0x54d158=_0x4bb5d1[_0xb3cc('0x27')]({'plain':!![]});var _0x4e59fe='Variables';return db[_0xb3cc('0x28')][_0xb3cc('0x26')]({'where':{'type':_0x4e59fe,'resourceId':_0x54d158['id']}})[_0xb3cc('0x25')](function(){return _0x4bb5d1;});})[_0xb3cc('0x25')](function(){_0x5244e1[_0xb3cc('0x1a')](0xcc)[_0xb3cc('0x29')]();});}};}function handleEntityNotFound(_0x2d2059,_0x1604a7){return function(_0x490e06){if(!_0x490e06){_0x2d2059['sendStatus'](0x194);}return _0x490e06;};}function handleError(_0x32d6fe,_0x5e44c9){_0x5e44c9=_0x5e44c9||0x1f4;return function(_0x31fc14){logger[_0xb3cc('0x2a')](_0x31fc14[_0xb3cc('0x2b')]);if(_0x31fc14[_0xb3cc('0x2c')]){delete _0x31fc14[_0xb3cc('0x2c')];}_0x32d6fe[_0xb3cc('0x1a')](_0x5e44c9)[_0xb3cc('0x2d')](_0x31fc14);};}exports[_0xb3cc('0x2e')]=function(_0x4d1353,_0x3cd8a2){var _0x45707f={},_0x1d79d5={},_0x422187={'count':0x0,'rows':[]};var _0x57acfb=_[_0xb3cc('0x2f')](db['Variable'][_0xb3cc('0x30')],function(_0x563702){return{'name':_0x563702[_0xb3cc('0x31')],'type':_0x563702[_0xb3cc('0x32')][_0xb3cc('0x33')]};});_0x1d79d5[_0xb3cc('0x34')]=_[_0xb3cc('0x2f')](_0x57acfb,'name');_0x1d79d5['query']=_['keys'](_0x4d1353['query']);_0x1d79d5[_0xb3cc('0x35')]=_[_0xb3cc('0x36')](_0x1d79d5['model'],_0x1d79d5[_0xb3cc('0x37')]);_0x45707f[_0xb3cc('0x38')]=_[_0xb3cc('0x36')](_0x1d79d5['model'],qs['fields'](_0x4d1353[_0xb3cc('0x37')]['fields']));_0x45707f[_0xb3cc('0x38')]=_0x45707f[_0xb3cc('0x38')][_0xb3cc('0x39')]?_0x45707f['attributes']:_0x1d79d5[_0xb3cc('0x34')];if(!_0x4d1353[_0xb3cc('0x37')]['hasOwnProperty'](_0xb3cc('0x3a'))){_0x45707f['limit']=qs['limit'](_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x1e')]);_0x45707f[_0xb3cc('0x1d')]=qs['offset'](_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x1d')]);}_0x45707f[_0xb3cc('0x3b')]=qs[_0xb3cc('0x3c')](_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x3c')]);_0x45707f[_0xb3cc('0x3d')]=qs['filters'](_[_0xb3cc('0x3e')](_0x4d1353[_0xb3cc('0x37')],_0x1d79d5['filters']),_0x57acfb);if(_0x4d1353[_0xb3cc('0x37')][_0xb3cc('0x3f')]){_0x45707f[_0xb3cc('0x3d')]=_[_0xb3cc('0x40')](_0x45707f[_0xb3cc('0x3d')],{'$or':_[_0xb3cc('0x2f')](_0x57acfb,function(_0x5ebc64){if(_0x5ebc64[_0xb3cc('0x32')]!==_0xb3cc('0x41')){var _0x5ee616={};_0x5ee616[_0x5ebc64[_0xb3cc('0x2c')]]={'$like':'%'+_0x4d1353[_0xb3cc('0x37')]['filter']+'%'};return _0x5ee616;}})});}_0x45707f=_[_0xb3cc('0x40')]({},_0x45707f,_0x4d1353[_0xb3cc('0x42')]);var _0x4a4040={'where':_0x45707f[_0xb3cc('0x3d')]};return db[_0xb3cc('0x43')][_0xb3cc('0x1c')](_0x4a4040)[_0xb3cc('0x25')](function(_0x193171){_0x422187['count']=_0x193171;if(_0x4d1353['query'][_0xb3cc('0x44')]){_0x45707f[_0xb3cc('0x45')]=[{'all':!![]}];}return db[_0xb3cc('0x43')][_0xb3cc('0x46')](_0x45707f);})[_0xb3cc('0x25')](function(_0x38f817){_0x422187[_0xb3cc('0x47')]=_0x38f817;return _0x422187;})[_0xb3cc('0x25')](respondWithFilteredResult(_0x3cd8a2,_0x45707f))[_0xb3cc('0x48')](handleError(_0x3cd8a2,null));};exports[_0xb3cc('0x49')]=function(_0x1a4266,_0x5237ee){var _0x30f67d={'raw':!![],'where':{'id':_0x1a4266[_0xb3cc('0x4a')]['id']}},_0x407e66={};_0x407e66[_0xb3cc('0x34')]=_['keys'](db[_0xb3cc('0x43')][_0xb3cc('0x30')]);_0x407e66[_0xb3cc('0x37')]=_['keys'](_0x1a4266[_0xb3cc('0x37')]);_0x407e66[_0xb3cc('0x35')]=_[_0xb3cc('0x36')](_0x407e66[_0xb3cc('0x34')],_0x407e66['query']);_0x30f67d[_0xb3cc('0x38')]=_[_0xb3cc('0x36')](_0x407e66[_0xb3cc('0x34')],qs[_0xb3cc('0x4b')](_0x1a4266[_0xb3cc('0x37')][_0xb3cc('0x4b')]));_0x30f67d[_0xb3cc('0x38')]=_0x30f67d['attributes'][_0xb3cc('0x39')]?_0x30f67d[_0xb3cc('0x38')]:_0x407e66['model'];if(_0x1a4266['query'][_0xb3cc('0x44')]){_0x30f67d[_0xb3cc('0x45')]=[{'all':!![]}];}_0x30f67d=_[_0xb3cc('0x40')]({},_0x30f67d,_0x1a4266[_0xb3cc('0x42')]);return db[_0xb3cc('0x43')][_0xb3cc('0x4c')](_0x30f67d)['then'](handleEntityNotFound(_0x5237ee,null))[_0xb3cc('0x25')](respondWithResult(_0x5237ee,null))['catch'](handleError(_0x5237ee,null));};exports['create']=function(_0x4ffdfe,_0x6f8349){return db['Variable'][_0xb3cc('0x4d')](_0x4ffdfe[_0xb3cc('0x4e')],{})[_0xb3cc('0x25')](function(_0x3e7176){var _0x467c8c=_0x4ffdfe['user'][_0xb3cc('0x27')]({'plain':!![]});if(!_0x467c8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467c8c[_0xb3cc('0x4f')]==='user'){var _0x2a13bf=_0x3e7176[_0xb3cc('0x27')]({'plain':!![]});var _0xf8466a=_0xb3cc('0x50');return db[_0xb3cc('0x51')][_0xb3cc('0x4c')]({'where':{'name':_0xf8466a,'userProfileId':_0x467c8c[_0xb3cc('0x52')]},'raw':!![]})[_0xb3cc('0x25')](function(_0x381693){if(_0x381693&&_0x381693[_0xb3cc('0x53')]===0x0){return db[_0xb3cc('0x28')][_0xb3cc('0x4d')]({'name':_0x2a13bf[_0xb3cc('0x2c')],'resourceId':_0x2a13bf['id'],'type':_0x381693[_0xb3cc('0x2c')],'sectionId':_0x381693['id']},{})[_0xb3cc('0x25')](function(){return _0x3e7176;});}else{return _0x3e7176;}})[_0xb3cc('0x48')](function(_0x2a147d){logger[_0xb3cc('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a147d);throw _0x2a147d;});}return _0x3e7176;})[_0xb3cc('0x25')](respondWithResult(_0x6f8349,0xc9))[_0xb3cc('0x48')](handleError(_0x6f8349,null));};exports[_0xb3cc('0x24')]=function(_0x586017,_0x52275f){if(_0x586017[_0xb3cc('0x4e')]['id']){delete _0x586017[_0xb3cc('0x4e')]['id'];}return db['Variable'][_0xb3cc('0x4c')]({'where':{'id':_0x586017['params']['id']}})[_0xb3cc('0x25')](handleEntityNotFound(_0x52275f,null))[_0xb3cc('0x25')](saveUpdates(_0x586017['body'],null))[_0xb3cc('0x25')](respondWithResult(_0x52275f,null))[_0xb3cc('0x48')](handleError(_0x52275f,null));};exports[_0xb3cc('0x26')]=function(_0x4dfd3d,_0x1c95e4){return db['Variable']['find']({'where':{'id':_0x4dfd3d[_0xb3cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c95e4,null))[_0xb3cc('0x25')](removeEntity(_0x1c95e4,null))[_0xb3cc('0x48')](handleError(_0x1c95e4,null));}; \ No newline at end of file +var _0x9d80=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','get','Variables','error','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filter','merge','options','Variable','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','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','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x9d80,0xf2));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x09d8('0x0'));var emlformat=require(_0x09d8('0x1'));var rimraf=require(_0x09d8('0x2'));var zipdir=require(_0x09d8('0x3'));var jsonpatch=require(_0x09d8('0x4'));var rp=require(_0x09d8('0x5'));var moment=require(_0x09d8('0x6'));var BPromise=require(_0x09d8('0x7'));var Mustache=require(_0x09d8('0x8'));var util=require(_0x09d8('0x9'));var path=require(_0x09d8('0xa'));var sox=require(_0x09d8('0xb'));var csv=require('to-csv');var ejs=require(_0x09d8('0xc'));var fs=require('fs');var _=require(_0x09d8('0xd'));var squel=require(_0x09d8('0xe'));var crypto=require(_0x09d8('0xf'));var jsforce=require(_0x09d8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x09d8('0x11'));var querystring=require(_0x09d8('0x12'));var Papa=require(_0x09d8('0x13'));var Redis=require(_0x09d8('0x14'));var authService=require(_0x09d8('0x15'));var qs=require(_0x09d8('0x16'));var as=require(_0x09d8('0x17'));var hardwareService=require(_0x09d8('0x18'));var logger=require(_0x09d8('0x19'))(_0x09d8('0x1a'));var utils=require(_0x09d8('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x09d8('0x1c'));var db=require(_0x09d8('0x1d'))['db'];function respondWithStatusCode(_0x29647f,_0x20a75b){_0x20a75b=_0x20a75b||0xcc;return function(_0x30cfa8){if(_0x30cfa8){return _0x29647f[_0x09d8('0x1e')](_0x20a75b);}return _0x29647f[_0x09d8('0x1f')](_0x20a75b)[_0x09d8('0x20')]();};}function respondWithResult(_0x55bdb0,_0x52d7e1){_0x52d7e1=_0x52d7e1||0xc8;return function(_0x34bbcb){if(_0x34bbcb){return _0x55bdb0[_0x09d8('0x1f')](_0x52d7e1)[_0x09d8('0x21')](_0x34bbcb);}};}function respondWithFilteredResult(_0x34c39e,_0x2a3830){return function(_0x57625d){if(_0x57625d){var _0x569650=_0x57625d[_0x09d8('0x22')],_0x58fee1=_0x2a3830[_0x09d8('0x23')],_0x1b3aec=_0x2a3830[_0x09d8('0x23')]+_0x2a3830['limit'],_0x5e2356;if(_0x1b3aec>=_0x569650){_0x1b3aec=_0x569650;_0x5e2356=0xc8;}else{_0x5e2356=0xce;}_0x34c39e[_0x09d8('0x1f')](_0x5e2356);return _0x34c39e[_0x09d8('0x24')](_0x09d8('0x25'),_0x58fee1+'-'+_0x1b3aec+'/'+_0x569650)[_0x09d8('0x21')](_0x57625d);}return null;};}function patchUpdates(_0x31e6fd){return function(_0x2226dd){try{jsonpatch[_0x09d8('0x26')](_0x2226dd,_0x31e6fd,!![]);}catch(_0x470f5f){return BPromise['reject'](_0x470f5f);}return _0x2226dd[_0x09d8('0x27')]();};}function saveUpdates(_0x18a2f0,_0x1591aa){return function(_0xc1af5b){if(_0xc1af5b){return _0xc1af5b['update'](_0x18a2f0)[_0x09d8('0x28')](function(_0xaadec6){return _0xaadec6;});}return null;};}function removeEntity(_0x585568,_0x5a9462){return function(_0xe24091){if(_0xe24091){return _0xe24091['destroy']()[_0x09d8('0x28')](function(){var _0x5960ec=_0xe24091[_0x09d8('0x29')]({'plain':!![]});var _0x3d9f30=_0x09d8('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d9f30,'resourceId':_0x5960ec['id']}})[_0x09d8('0x28')](function(){return _0xe24091;});})[_0x09d8('0x28')](function(){_0x585568[_0x09d8('0x1f')](0xcc)[_0x09d8('0x20')]();});}};}function handleEntityNotFound(_0x1be897,_0x5d49b9){return function(_0x47b942){if(!_0x47b942){_0x1be897['sendStatus'](0x194);}return _0x47b942;};}function handleError(_0x55661e,_0x32ba51){_0x32ba51=_0x32ba51||0x1f4;return function(_0x201fa0){logger[_0x09d8('0x2b')](_0x201fa0['stack']);if(_0x201fa0['name']){delete _0x201fa0[_0x09d8('0x2c')];}_0x55661e['status'](_0x32ba51)['send'](_0x201fa0);};}exports[_0x09d8('0x2d')]=function(_0x2378dd,_0x54f685){var _0xd37353={},_0x3394c2={},_0x10b0b1={'count':0x0,'rows':[]};var _0x39aac8=_[_0x09d8('0x2e')](db['Variable']['rawAttributes'],function(_0x149a97){return{'name':_0x149a97[_0x09d8('0x2f')],'type':_0x149a97[_0x09d8('0x30')][_0x09d8('0x31')]};});_0x3394c2[_0x09d8('0x32')]=_[_0x09d8('0x2e')](_0x39aac8,_0x09d8('0x2c'));_0x3394c2[_0x09d8('0x33')]=_[_0x09d8('0x34')](_0x2378dd[_0x09d8('0x33')]);_0x3394c2[_0x09d8('0x35')]=_['intersection'](_0x3394c2[_0x09d8('0x32')],_0x3394c2[_0x09d8('0x33')]);_0xd37353[_0x09d8('0x36')]=_[_0x09d8('0x37')](_0x3394c2[_0x09d8('0x32')],qs[_0x09d8('0x38')](_0x2378dd[_0x09d8('0x33')]['fields']));_0xd37353[_0x09d8('0x36')]=_0xd37353[_0x09d8('0x36')]['length']?_0xd37353[_0x09d8('0x36')]:_0x3394c2[_0x09d8('0x32')];if(!_0x2378dd['query'][_0x09d8('0x39')]('nolimit')){_0xd37353[_0x09d8('0x3a')]=qs[_0x09d8('0x3a')](_0x2378dd['query'][_0x09d8('0x3a')]);_0xd37353['offset']=qs[_0x09d8('0x23')](_0x2378dd[_0x09d8('0x33')][_0x09d8('0x23')]);}_0xd37353[_0x09d8('0x3b')]=qs[_0x09d8('0x3c')](_0x2378dd['query'][_0x09d8('0x3c')]);_0xd37353[_0x09d8('0x3d')]=qs[_0x09d8('0x35')](_['pick'](_0x2378dd['query'],_0x3394c2[_0x09d8('0x35')]),_0x39aac8);if(_0x2378dd[_0x09d8('0x33')]['filter']){_0xd37353[_0x09d8('0x3d')]=_['merge'](_0xd37353[_0x09d8('0x3d')],{'$or':_[_0x09d8('0x2e')](_0x39aac8,function(_0x2763a1){if(_0x2763a1[_0x09d8('0x30')]!=='VIRTUAL'){var _0x19451d={};_0x19451d[_0x2763a1[_0x09d8('0x2c')]]={'$like':'%'+_0x2378dd[_0x09d8('0x33')][_0x09d8('0x3e')]+'%'};return _0x19451d;}})});}_0xd37353=_[_0x09d8('0x3f')]({},_0xd37353,_0x2378dd[_0x09d8('0x40')]);var _0x2407e4={'where':_0xd37353[_0x09d8('0x3d')]};return db[_0x09d8('0x41')]['count'](_0x2407e4)[_0x09d8('0x28')](function(_0x302a29){_0x10b0b1[_0x09d8('0x22')]=_0x302a29;if(_0x2378dd[_0x09d8('0x33')][_0x09d8('0x42')]){_0xd37353[_0x09d8('0x43')]=[{'all':!![]}];}return db['Variable'][_0x09d8('0x44')](_0xd37353);})['then'](function(_0x23d978){_0x10b0b1[_0x09d8('0x45')]=_0x23d978;return _0x10b0b1;})[_0x09d8('0x28')](respondWithFilteredResult(_0x54f685,_0xd37353))['catch'](handleError(_0x54f685,null));};exports[_0x09d8('0x46')]=function(_0x40d8cb,_0x458194){var _0x1ebcd2={'raw':!![],'where':{'id':_0x40d8cb['params']['id']}},_0x1cbd9d={};_0x1cbd9d['model']=_['keys'](db['Variable'][_0x09d8('0x47')]);_0x1cbd9d[_0x09d8('0x33')]=_[_0x09d8('0x34')](_0x40d8cb[_0x09d8('0x33')]);_0x1cbd9d[_0x09d8('0x35')]=_[_0x09d8('0x37')](_0x1cbd9d[_0x09d8('0x32')],_0x1cbd9d[_0x09d8('0x33')]);_0x1ebcd2[_0x09d8('0x36')]=_[_0x09d8('0x37')](_0x1cbd9d['model'],qs[_0x09d8('0x38')](_0x40d8cb[_0x09d8('0x33')][_0x09d8('0x38')]));_0x1ebcd2['attributes']=_0x1ebcd2[_0x09d8('0x36')][_0x09d8('0x48')]?_0x1ebcd2[_0x09d8('0x36')]:_0x1cbd9d[_0x09d8('0x32')];if(_0x40d8cb['query'][_0x09d8('0x42')]){_0x1ebcd2[_0x09d8('0x43')]=[{'all':!![]}];}_0x1ebcd2=_[_0x09d8('0x3f')]({},_0x1ebcd2,_0x40d8cb[_0x09d8('0x40')]);return db[_0x09d8('0x41')][_0x09d8('0x49')](_0x1ebcd2)[_0x09d8('0x28')](handleEntityNotFound(_0x458194,null))[_0x09d8('0x28')](respondWithResult(_0x458194,null))[_0x09d8('0x4a')](handleError(_0x458194,null));};exports[_0x09d8('0x4b')]=function(_0x4d317c,_0x486c2c){return db[_0x09d8('0x41')]['create'](_0x4d317c[_0x09d8('0x4c')],{})[_0x09d8('0x28')](function(_0x2821a0){var _0x55b87b=_0x4d317c[_0x09d8('0x4d')][_0x09d8('0x29')]({'plain':!![]});if(!_0x55b87b)throw new Error(_0x09d8('0x4e'));if(_0x55b87b[_0x09d8('0x4f')]===_0x09d8('0x4d')){var _0x304b2c=_0x2821a0[_0x09d8('0x29')]({'plain':!![]});var _0x48fec9='Variables';return db[_0x09d8('0x50')][_0x09d8('0x49')]({'where':{'name':_0x48fec9,'userProfileId':_0x55b87b[_0x09d8('0x51')]},'raw':!![]})[_0x09d8('0x28')](function(_0x3e3537){if(_0x3e3537&&_0x3e3537[_0x09d8('0x52')]===0x0){return db[_0x09d8('0x53')][_0x09d8('0x4b')]({'name':_0x304b2c[_0x09d8('0x2c')],'resourceId':_0x304b2c['id'],'type':_0x3e3537['name'],'sectionId':_0x3e3537['id']},{})[_0x09d8('0x28')](function(){return _0x2821a0;});}else{return _0x2821a0;}})[_0x09d8('0x4a')](function(_0x256332){logger[_0x09d8('0x2b')](_0x09d8('0x54'),_0x256332);throw _0x256332;});}return _0x2821a0;})['then'](respondWithResult(_0x486c2c,0xc9))[_0x09d8('0x4a')](handleError(_0x486c2c,null));};exports['update']=function(_0x3d19f0,_0x3d96fa){if(_0x3d19f0[_0x09d8('0x4c')]['id']){delete _0x3d19f0[_0x09d8('0x4c')]['id'];}return db[_0x09d8('0x41')][_0x09d8('0x49')]({'where':{'id':_0x3d19f0[_0x09d8('0x55')]['id']}})[_0x09d8('0x28')](handleEntityNotFound(_0x3d96fa,null))[_0x09d8('0x28')](saveUpdates(_0x3d19f0[_0x09d8('0x4c')],null))[_0x09d8('0x28')](respondWithResult(_0x3d96fa,null))['catch'](handleError(_0x3d96fa,null));};exports[_0x09d8('0x56')]=function(_0x309dba,_0x2ff0f2){return db[_0x09d8('0x41')][_0x09d8('0x49')]({'where':{'id':_0x309dba[_0x09d8('0x55')]['id']}})[_0x09d8('0x28')](handleEntityNotFound(_0x2ff0f2,null))[_0x09d8('0x28')](removeEntity(_0x2ff0f2,null))[_0x09d8('0x4a')](handleError(_0x2ff0f2,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 049d6f2..b65ac88 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 _0xbed7=['rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xd7d9c0,_0x3b375b){var _0x31a50a=function(_0x2e3bf0){while(--_0x2e3bf0){_0xd7d9c0['push'](_0xd7d9c0['shift']());}};_0x31a50a(++_0x3b375b);}(_0xbed7,0x14b));var _0x7bed=function(_0x39f6b8,_0xca7eb2){_0x39f6b8=_0x39f6b8-0x0;var _0x403b8f=_0xbed7[_0x39f6b8];return _0x403b8f;};'use strict';var _=require(_0x7bed('0x0'));var util=require(_0x7bed('0x1'));var logger=require(_0x7bed('0x2'))(_0x7bed('0x3'));var moment=require(_0x7bed('0x4'));var BPromise=require('bluebird');var rp=require(_0x7bed('0x5'));var fs=require('fs');var path=require(_0x7bed('0x6'));var rimraf=require(_0x7bed('0x7'));var config=require(_0x7bed('0x8'));var attributes=require(_0x7bed('0x9'));module[_0x7bed('0xa')]=function(_0x41c148,_0x3aa0e9){return _0x41c148[_0x7bed('0xb')]('Variable',attributes,{'tableName':_0x7bed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe062=['moment','bluebird','rimraf','../../config/environment','tools_variables','lodash','util','api'];(function(_0x3fb74d,_0x59c3b3){var _0x570bf4=function(_0x4d7040){while(--_0x4d7040){_0x3fb74d['push'](_0x3fb74d['shift']());}};_0x570bf4(++_0x59c3b3);}(_0xe062,0xd5));var _0x2e06=function(_0xbbb392,_0x303aa8){_0xbbb392=_0xbbb392-0x0;var _0x2454fe=_0xe062[_0xbbb392];return _0x2454fe;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var logger=require('../../config/logger')(_0x2e06('0x2'));var moment=require(_0x2e06('0x3'));var BPromise=require(_0x2e06('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e06('0x5'));var config=require(_0x2e06('0x6'));var attributes=require('./variable.attributes');module['exports']=function(_0x912daf,_0x31d2a3){return _0x912daf['define']('Variable',attributes,{'tableName':_0x2e06('0x7'),'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 251c91e..72cabf4 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 _0xfb48=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowVariable','Variable','options','raw','where','attributes','include','map','then','lodash','bluebird'];(function(_0x2fe299,_0x2e1408){var _0x3e7659=function(_0x399706){while(--_0x399706){_0x2fe299['push'](_0x2fe299['shift']());}};_0x3e7659(++_0x2e1408);}(_0xfb48,0x1eb));var _0x8fb4=function(_0x37cd82,_0x2266ab){_0x37cd82=_0x37cd82-0x0;var _0x53de39=_0xfb48[_0x37cd82];return _0x53de39;};'use strict';var _=require(_0x8fb4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8fb4('0x1'));var rs=require(_0x8fb4('0x2'));var fs=require('fs');var Redis=require(_0x8fb4('0x3'));var db=require(_0x8fb4('0x4'))['db'];var utils=require(_0x8fb4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8fb4('0x6'));var jayson=require(_0x8fb4('0x7'));var client=jayson['client'][_0x8fb4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x209286,_0x4f9d2b,_0xcd5bd6){return new BPromise(function(_0x1ee7f7,_0x3ab733){return client[_0x8fb4('0x9')](_0x209286,_0xcd5bd6)['then'](function(_0x2ea61b){logger['info'](_0x8fb4('0xa'),_0x4f9d2b,'request\x20sent');logger[_0x8fb4('0xb')]('Variable,\x20%s,\x20%s,\x20%s',_0x4f9d2b,_0x8fb4('0xc'),JSON[_0x8fb4('0xd')](_0x2ea61b));if(_0x2ea61b[_0x8fb4('0xe')]){if(_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0xf')]===0x1f4){logger[_0x8fb4('0xe')](_0x8fb4('0xa'),_0x4f9d2b,_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0x10')]);return _0x3ab733(_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0x10')]);}logger[_0x8fb4('0xe')](_0x8fb4('0xa'),_0x4f9d2b,_0x2ea61b[_0x8fb4('0xe')][_0x8fb4('0x10')]);return _0x1ee7f7(_0x2ea61b['error']['message']);}else{logger[_0x8fb4('0x11')](_0x8fb4('0xa'),_0x4f9d2b,_0x8fb4('0xc'));_0x1ee7f7(_0x2ea61b[_0x8fb4('0x12')]['message']);}})[_0x8fb4('0x13')](function(_0x2a1028){logger['error'](_0x8fb4('0xa'),_0x4f9d2b,_0x2a1028);_0x3ab733(_0x2a1028);});});}exports[_0x8fb4('0x14')]=function(_0x585faa){var _0x23ec59=this;return new Promise(function(_0x146eaa,_0x58be94){return db[_0x8fb4('0x15')]['find']({'raw':_0x585faa['options']?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x17')]===undefined?!![]:![]:!![],'where':_0x585faa[_0x8fb4('0x16')]?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x18')]||null:null,'attributes':_0x585faa[_0x8fb4('0x16')]?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x19')]||null:null,'include':_0x585faa[_0x8fb4('0x16')]?_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x1a')]?_[_0x8fb4('0x1b')](_0x585faa[_0x8fb4('0x16')][_0x8fb4('0x1a')],function(_0x14bd6d){return{'model':db[_0x14bd6d['model']],'as':_0x14bd6d['as'],'attributes':_0x14bd6d['attributes'],'include':_0x14bd6d['include']?_['map'](_0x14bd6d[_0x8fb4('0x1a')],function(_0x1e9c06){return{'model':db[_0x1e9c06['model']],'as':_0x1e9c06['as'],'attributes':_0x1e9c06[_0x8fb4('0x19')],'include':_0x1e9c06[_0x8fb4('0x1a')]?_[_0x8fb4('0x1b')](_0x1e9c06[_0x8fb4('0x1a')],function(_0x344a97){return{'model':db[_0x344a97['model']],'as':_0x344a97['as'],'attributes':_0x344a97[_0x8fb4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8fb4('0x1c')](function(_0x46f9fe){logger[_0x8fb4('0x11')](_0x8fb4('0x14'),_0x585faa);logger[_0x8fb4('0xb')](_0x8fb4('0x14'),_0x585faa,JSON[_0x8fb4('0xd')](_0x46f9fe));_0x146eaa(_0x46f9fe);})['catch'](function(_0x1d7375){logger[_0x8fb4('0xe')]('ShowVariable',_0x1d7375[_0x8fb4('0x10')],_0x585faa);_0x58be94(_0x23ec59[_0x8fb4('0xe')](0x1f4,_0x1d7375[_0x8fb4('0x10')]));});});}; \ No newline at end of file +var _0x27ef=['catch','Variable','find','options','raw','attributes','include','map','model','ShowVariable','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0xa1bae2,_0x352272){var _0x2f3344=function(_0x336692){while(--_0x336692){_0xa1bae2['push'](_0xa1bae2['shift']());}};_0x2f3344(++_0x352272);}(_0x27ef,0xb5));var _0xf27e=function(_0x4f828c,_0x2f6cac){_0x4f828c=_0x4f828c-0x0;var _0x1fea4d=_0x27ef[_0x4f828c];return _0x1fea4d;};'use strict';var _=require(_0xf27e('0x0'));var util=require(_0xf27e('0x1'));var moment=require(_0xf27e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf27e('0x3'));var fs=require('fs');var Redis=require(_0xf27e('0x4'));var db=require(_0xf27e('0x5'))['db'];var utils=require(_0xf27e('0x6'));var logger=require(_0xf27e('0x7'))(_0xf27e('0x8'));var config=require(_0xf27e('0x9'));var jayson=require(_0xf27e('0xa'));var client=jayson[_0xf27e('0xb')][_0xf27e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x477b7a,_0x27cd21,_0x313615){return new BPromise(function(_0x20606b,_0x58ed79){return client[_0xf27e('0xd')](_0x477b7a,_0x313615)[_0xf27e('0xe')](function(_0x3d0dd7){logger[_0xf27e('0xf')](_0xf27e('0x10'),_0x27cd21,_0xf27e('0x11'));logger[_0xf27e('0x12')](_0xf27e('0x13'),_0x27cd21,_0xf27e('0x11'),JSON['stringify'](_0x3d0dd7));if(_0x3d0dd7['error']){if(_0x3d0dd7[_0xf27e('0x14')]['code']===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x27cd21,_0x3d0dd7[_0xf27e('0x14')][_0xf27e('0x15')]);return _0x58ed79(_0x3d0dd7[_0xf27e('0x14')][_0xf27e('0x15')]);}logger[_0xf27e('0x14')](_0xf27e('0x10'),_0x27cd21,_0x3d0dd7['error'][_0xf27e('0x15')]);return _0x20606b(_0x3d0dd7[_0xf27e('0x14')]['message']);}else{logger['info'](_0xf27e('0x10'),_0x27cd21,_0xf27e('0x11'));_0x20606b(_0x3d0dd7[_0xf27e('0x16')]['message']);}})[_0xf27e('0x17')](function(_0x1f25ab){logger[_0xf27e('0x14')](_0xf27e('0x10'),_0x27cd21,_0x1f25ab);_0x58ed79(_0x1f25ab);});});}exports['ShowVariable']=function(_0x5bce68){var _0x5417fd=this;return new Promise(function(_0x480810,_0x3b8e94){return db[_0xf27e('0x18')][_0xf27e('0x19')]({'raw':_0x5bce68['options']?_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bce68[_0xf27e('0x1a')]?_0x5bce68[_0xf27e('0x1a')]['where']||null:null,'attributes':_0x5bce68['options']?_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1c')]||null:null,'include':_0x5bce68[_0xf27e('0x1a')]?_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1d')]?_[_0xf27e('0x1e')](_0x5bce68[_0xf27e('0x1a')][_0xf27e('0x1d')],function(_0x173f46){return{'model':db[_0x173f46[_0xf27e('0x1f')]],'as':_0x173f46['as'],'attributes':_0x173f46[_0xf27e('0x1c')],'include':_0x173f46['include']?_[_0xf27e('0x1e')](_0x173f46[_0xf27e('0x1d')],function(_0x48d194){return{'model':db[_0x48d194[_0xf27e('0x1f')]],'as':_0x48d194['as'],'attributes':_0x48d194[_0xf27e('0x1c')],'include':_0x48d194[_0xf27e('0x1d')]?_[_0xf27e('0x1e')](_0x48d194[_0xf27e('0x1d')],function(_0x4f69f8){return{'model':db[_0x4f69f8[_0xf27e('0x1f')]],'as':_0x4f69f8['as'],'attributes':_0x4f69f8[_0xf27e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf27e('0xe')](function(_0x38c0ad){logger[_0xf27e('0xf')](_0xf27e('0x20'),_0x5bce68);logger[_0xf27e('0x12')](_0xf27e('0x20'),_0x5bce68,JSON[_0xf27e('0x21')](_0x38c0ad));_0x480810(_0x38c0ad);})['catch'](function(_0x184fd4){logger[_0xf27e('0x14')](_0xf27e('0x20'),_0x184fd4[_0xf27e('0x15')],_0x5bce68);_0x3b8e94(_0x5417fd['error'](0x1f4,_0x184fd4[_0xf27e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 26c1442..68ba812 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 _0x75b4=['../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','canUpdate','/pull','pull','/restart','migrations','exports','Router'];(function(_0x51da3e,_0x586ae1){var _0x49ca6e=function(_0x4f1055){while(--_0x4f1055){_0x51da3e['push'](_0x51da3e['shift']());}};_0x49ca6e(++_0x586ae1);}(_0x75b4,0xc2));var _0x475b=function(_0xb90eac,_0xb8941d){_0xb90eac=_0xb90eac-0x0;var _0x24c911=_0x75b4[_0xb90eac];return _0x24c911;};'use strict';var express=require('express');var router=express[_0x475b('0x0')]();var auth=require(_0x475b('0x1'));var controller=require(_0x475b('0x2'));router['get']('/',controller['index']);router[_0x475b('0x3')](_0x475b('0x4'),auth[_0x475b('0x5')](),auth['canUpdate'](),controller[_0x475b('0x6')]);router[_0x475b('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x475b('0x7')](),controller['reset']);router[_0x475b('0x3')](_0x475b('0x8'),auth[_0x475b('0x5')](),auth['canUpdate'](),controller[_0x475b('0x9')]);router[_0x475b('0x3')](_0x475b('0xa'),auth[_0x475b('0x5')](),controller['restart']);router[_0x475b('0x3')]('/migrations',controller[_0x475b('0xb')]);module[_0x475b('0xc')]=router; \ No newline at end of file +var _0xfa3a=['isAuthenticated','canUpdate','fetch','/reset','reset','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','index','get','/fetch'];(function(_0x1b98c9,_0x5cf679){var _0x158af9=function(_0x30795a){while(--_0x30795a){_0x1b98c9['push'](_0x1b98c9['shift']());}};_0x158af9(++_0x5cf679);}(_0xfa3a,0x1ad));var _0xafa3=function(_0xfaaad,_0x4c46e6){_0xfaaad=_0xfaaad-0x0;var _0x59136e=_0xfa3a[_0xfaaad];return _0x59136e;};'use strict';var express=require(_0xafa3('0x0'));var router=express[_0xafa3('0x1')]();var auth=require(_0xafa3('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0xafa3('0x3')]);router[_0xafa3('0x4')](_0xafa3('0x5'),auth[_0xafa3('0x6')](),auth[_0xafa3('0x7')](),controller[_0xafa3('0x8')]);router[_0xafa3('0x4')](_0xafa3('0x9'),auth[_0xafa3('0x6')](),auth[_0xafa3('0x7')](),controller[_0xafa3('0xa')]);router[_0xafa3('0x4')]('/pull',auth[_0xafa3('0x6')](),auth['canUpdate'](),controller['pull']);router[_0xafa3('0x4')](_0xafa3('0xb'),auth[_0xafa3('0x6')](),controller[_0xafa3('0xc')]);router['get'](_0xafa3('0xd'),controller['migrations']);module[_0xafa3('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 4c7b123..0190b9a 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 _0x29b7=['migrations','readdirSync','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch'];(function(_0x383b0f,_0x137a87){var _0x419636=function(_0x3fca2c){while(--_0x3fca2c){_0x383b0f['push'](_0x383b0f['shift']());}};_0x419636(++_0x137a87);}(_0x29b7,0x17d));var _0x729b=function(_0x125f28,_0x102cde){_0x125f28=_0x125f28-0x0;var _0x212813=_0x29b7[_0x125f28];return _0x212813;};'use strict';var Umzug=require('umzug');var path=require(_0x729b('0x0'));var fs=require('fs');var _=require(_0x729b('0x1'));var pkginfo=require(_0x729b('0x2'))(module,_0x729b('0x3'));var compareVersions=require(_0x729b('0x4'));var exec=require(_0x729b('0x5'))[_0x729b('0x6')];var db=require(_0x729b('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x729b('0x8'));var logger=require(_0x729b('0x9'))('update');var git=require(_0x729b('0xa'))(config[_0x729b('0xb')]);exports[_0x729b('0xc')]=function(_0x2c4252,_0x4d75fd){var _0x3df326={'current':module[_0x729b('0xd')][_0x729b('0x3')],'phonebar':0x2};if(_0x2c4252[_0x729b('0xe')]&&_0x2c4252[_0x729b('0xe')][_0x729b('0xf')]){return git['fetch']()[_0x729b('0x10')](function(_0x4bfdae,_0x3da764){_0x3df326[_0x729b('0xf')]=(_0x4bfdae?module[_0x729b('0xd')]['version']:_0x3da764[_0x729b('0xf')])||_0x729b('0x11');return _0x4d75fd[_0x729b('0x12')](0xc8)[_0x729b('0x13')](_0x3df326);});}else{return _0x4d75fd[_0x729b('0x12')](0xc8)['json'](_0x3df326);}};exports[_0x729b('0x14')]=function(_0x40fb58,_0x56883a){return git[_0x729b('0x14')]([_0x729b('0x15'),_0x729b('0x16')],function(_0xc89ca7){if(_0xc89ca7){logger[_0x729b('0x17')](_0xc89ca7);return _0x56883a['status'](0x1f4)['json'](_0xc89ca7);}logger[_0x729b('0x18')](_0x729b('0x19'));return _0x56883a[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x729b('0x1a')]=function(_0x18a434,_0x58fce1){return git[_0x729b('0x1a')]([_0x729b('0x1b'),_0x729b('0x1c')],function(_0x2b3a82){if(_0x2b3a82){logger[_0x729b('0x17')](_0x2b3a82);return _0x58fce1['status'](0x1f4)[_0x729b('0x13')](_0x2b3a82);}logger[_0x729b('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x58fce1[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0xf511cb,_0x91ad76){exec(_0x729b('0x1d'),function(_0x80814f,_0x31d58f,_0x257290){logger[_0x729b('0x18')](_0x31d58f);logger[_0x729b('0x18')](_0x257290);if(_0x80814f){logger['error'](_0x80814f);return _0x91ad76[_0x729b('0x12')](0x1f4)[_0x729b('0x13')](_0x80814f);}return _0x91ad76[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':_0x31d58f});});};exports[_0x729b('0x1e')]=function(_0x51608f,_0x28aa22){return pm2[_0x729b('0x1e')]('motion2')[_0x729b('0x1f')](function(_0x5d2baf){logger['info'](_0x729b('0x20'),_0x5d2baf);return _0x28aa22[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':_0x729b('0x21')});})[_0x729b('0x22')](function(_0x4ab773){logger[_0x729b('0x17')](_0x4ab773);return _0x28aa22[_0x729b('0x12')](0x1f4)[_0x729b('0x13')](_0x4ab773);});};exports[_0x729b('0x23')]=function(_0x11053e,_0x147797){var _0x41fe6a=fs[_0x729b('0x24')](path['join'](config[_0x729b('0xb')],_0x729b('0x25'),_0x729b('0x23')));var _0x4fe559=[];for(var _0x18d4fa=0x0;_0x18d4fa<_0x41fe6a[_0x729b('0x26')];_0x18d4fa++){var _0x3babe2=_0x41fe6a[_0x18d4fa]['replace'](_0x729b('0x27'),'');if(compareVersions(module[_0x729b('0xd')]['version'],_0x3babe2)===-0x1){_0x4fe559[_0x729b('0x28')](_0x3babe2);}}if(_0x4fe559['length']){var _0x26d51d=_0x4fe559[_0x729b('0x29')](compareVersions);var _0x4859a3=new Umzug({'storage':_0x729b('0x2a'),'storageOptions':{'model':db[_0x729b('0x2b')],'modelName':_0x729b('0x2b'),'columnName':_0x729b('0x3')},'migrations':{'params':[db[_0x729b('0x2a')][_0x729b('0x2c')](),db['sequelize'][_0x729b('0x2d')],function(){throw new Error(_0x729b('0x2e'));}],'path':path[_0x729b('0x2f')](config[_0x729b('0xb')],_0x729b('0x25'),_0x729b('0x23')),'pattern':/\.js$/}});_0x4859a3['up']({'migrations':_['map'](_0x26d51d,function(_0x1a9366){return _0x1a9366+_0x729b('0x27');})})['then'](function(){return _0x147797[_0x729b('0x12')](0xc8)[_0x729b('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x729b('0xd')][_0x729b('0x3')]+_0x729b('0x30')+_[_0x729b('0x31')](_0x26d51d),'migrations':_[_0x729b('0x2f')](_0x26d51d)});})[_0x729b('0x22')](function(_0x319c17){if(_0x319c17 instanceof db[_0x729b('0x2a')][_0x729b('0x32')]){return _0x147797[_0x729b('0x12')](0xc8)['json']({'output':_0x729b('0x33')});}else{return _0x147797[_0x729b('0x12')](0x1f4)[_0x729b('0x13')](_0x319c17);}});}else{return _0x147797[_0x729b('0x12')](0xc8)['json']({'output':_0x729b('0x33')});}}; \ No newline at end of file +var _0x5800=['getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','exec','../../config/environment','update','simple-git','index','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','root','server','migrations','length','replace','.js','push','sort','sequelize','Migration'];(function(_0x47dd12,_0x2ac0e0){var _0x5a2e04=function(_0x73cb8){while(--_0x73cb8){_0x47dd12['push'](_0x47dd12['shift']());}};_0x5a2e04(++_0x2ac0e0);}(_0x5800,0x1b9));var _0x0580=function(_0x21ff61,_0x4b2027){_0x21ff61=_0x21ff61-0x0;var _0x21cf68=_0x5800[_0x21ff61];return _0x21cf68;};'use strict';var Umzug=require('umzug');var path=require(_0x0580('0x0'));var fs=require('fs');var _=require(_0x0580('0x1'));var pkginfo=require(_0x0580('0x2'))(module,_0x0580('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x0580('0x4'))[_0x0580('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x0580('0x6'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x0580('0x7'));var git=require(_0x0580('0x8'))(config['root']);exports[_0x0580('0x9')]=function(_0x5c4ab8,_0x1e4b42){var _0x51bb48={'current':module[_0x0580('0xa')][_0x0580('0x3')],'phonebar':0x2};if(_0x5c4ab8[_0x0580('0xb')]&&_0x5c4ab8[_0x0580('0xb')][_0x0580('0xc')]){return git[_0x0580('0xd')]()[_0x0580('0xe')](function(_0x1edc39,_0x4a6786){_0x51bb48[_0x0580('0xc')]=(_0x1edc39?module[_0x0580('0xa')][_0x0580('0x3')]:_0x4a6786['latest'])||'2.0.0';return _0x1e4b42[_0x0580('0xf')](0xc8)[_0x0580('0x10')](_0x51bb48);});}else{return _0x1e4b42[_0x0580('0xf')](0xc8)['json'](_0x51bb48);}};exports[_0x0580('0xd')]=function(_0x41ec01,_0x45d8b2){return git['fetch']([_0x0580('0x11'),_0x0580('0x12')],function(_0x473bcd){if(_0x473bcd){logger[_0x0580('0x13')](_0x473bcd);return _0x45d8b2[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x473bcd);}logger[_0x0580('0x14')]('git\x20fetch');return _0x45d8b2[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x15')});});};exports[_0x0580('0x16')]=function(_0x18739d,_0x549e64){return git[_0x0580('0x16')]([_0x0580('0x17'),_0x0580('0x18')],function(_0x5b3db9){if(_0x5b3db9){logger[_0x0580('0x13')](_0x5b3db9);return _0x549e64[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x5b3db9);}logger[_0x0580('0x14')](_0x0580('0x19'));return _0x549e64[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':'git\x20reset\x20--hard'});});};exports[_0x0580('0x1a')]=function(_0x3c9415,_0xab9d36){exec(_0x0580('0x1b'),function(_0x23cfa8,_0x36f360,_0x180fc3){logger[_0x0580('0x14')](_0x36f360);logger[_0x0580('0x14')](_0x180fc3);if(_0x23cfa8){logger[_0x0580('0x13')](_0x23cfa8);return _0xab9d36[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x23cfa8);}return _0xab9d36[_0x0580('0xf')](0xc8)['json']({'output':_0x36f360});});};exports['restart']=function(_0x137ac6,_0x5ee76e){return pm2[_0x0580('0x1c')](_0x0580('0x1d'))[_0x0580('0x1e')](function(_0x1833db){logger[_0x0580('0x14')](_0x0580('0x1f'),_0x1833db);return _0x5ee76e[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x20')});})[_0x0580('0x21')](function(_0x22a5c2){logger['error'](_0x22a5c2);return _0x5ee76e[_0x0580('0xf')](0x1f4)[_0x0580('0x10')](_0x22a5c2);});};exports['migrations']=function(_0x36333e,_0x2720f3){var _0xae8068=fs[_0x0580('0x22')](path['join'](config[_0x0580('0x23')],_0x0580('0x24'),_0x0580('0x25')));var _0x457f1b=[];for(var _0x2522df=0x0;_0x2522df<_0xae8068[_0x0580('0x26')];_0x2522df++){var _0x3429ed=_0xae8068[_0x2522df][_0x0580('0x27')](_0x0580('0x28'),'');if(compareVersions(module[_0x0580('0xa')][_0x0580('0x3')],_0x3429ed)===-0x1){_0x457f1b[_0x0580('0x29')](_0x3429ed);}}if(_0x457f1b['length']){var _0x5227ed=_0x457f1b[_0x0580('0x2a')](compareVersions);var _0x1eaef0=new Umzug({'storage':_0x0580('0x2b'),'storageOptions':{'model':db[_0x0580('0x2c')],'modelName':_0x0580('0x2c'),'columnName':_0x0580('0x3')},'migrations':{'params':[db[_0x0580('0x2b')][_0x0580('0x2d')](),db[_0x0580('0x2b')]['constructor'],function(){throw new Error(_0x0580('0x2e'));}],'path':path[_0x0580('0x2f')](config[_0x0580('0x23')],_0x0580('0x24'),_0x0580('0x25')),'pattern':/\.js$/}});_0x1eaef0['up']({'migrations':_[_0x0580('0x30')](_0x5227ed,function(_0x4ce695){return _0x4ce695+_0x0580('0x28');})})['then'](function(){return _0x2720f3['status'](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x31')+module[_0x0580('0xa')][_0x0580('0x3')]+_0x0580('0x32')+_[_0x0580('0x33')](_0x5227ed),'migrations':_['join'](_0x5227ed)});})[_0x0580('0x21')](function(_0xb89e6c){if(_0xb89e6c instanceof db[_0x0580('0x2b')][_0x0580('0x34')]){return _0x2720f3['status'](0xc8)[_0x0580('0x10')]({'output':_0x0580('0x35')});}else{return _0x2720f3['status'](0x1f4)[_0x0580('0x10')](_0xb89e6c);}});}else{return _0x2720f3[_0x0580('0xf')](0xc8)[_0x0580('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0e5423a..7999942 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 _0x7995=['put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','create'];(function(_0x3df08b,_0x5bfd53){var _0x5a61f4=function(_0x8668db){while(--_0x8668db){_0x3df08b['push'](_0x3df08b['shift']());}};_0x5a61f4(++_0x5bfd53);}(_0x7995,0x1f4));var _0x5799=function(_0x49d750,_0x24815e){_0x49d750=_0x49d750-0x0;var _0x15184f=_0x7995[_0x49d750];return _0x15184f;};'use strict';var multer=require(_0x5799('0x0'));var util=require(_0x5799('0x1'));var path=require(_0x5799('0x2'));var timeout=require(_0x5799('0x3'));var express=require(_0x5799('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5799('0x5'));var config=require(_0x5799('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x5799('0x7')]('/',auth[_0x5799('0x8')](),controller['index']);router[_0x5799('0x7')]('/describe',auth[_0x5799('0x8')](),controller[_0x5799('0x9')]);router['get'](_0x5799('0xa'),auth[_0x5799('0x8')](),controller['show']);router['post']('/',auth[_0x5799('0x8')](),controller[_0x5799('0xb')]);router[_0x5799('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5799('0xd')]);router['delete'](_0x5799('0xa'),auth[_0x5799('0x8')](),controller[_0x5799('0xe')]);module[_0x5799('0xf')]=router; \ No newline at end of file +var _0x7bd8=['show','post','create','put','/:id','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get'];(function(_0x1c0c5d,_0x4747dd){var _0x687a80=function(_0x1a1ff6){while(--_0x1a1ff6){_0x1c0c5d['push'](_0x1c0c5d['shift']());}};_0x687a80(++_0x4747dd);}(_0x7bd8,0x1dc));var _0x87bd=function(_0x310c37,_0x3b921b){_0x310c37=_0x310c37-0x0;var _0x3f414a=_0x7bd8[_0x310c37];return _0x3f414a;};'use strict';var multer=require(_0x87bd('0x0'));var util=require(_0x87bd('0x1'));var path=require(_0x87bd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x87bd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x87bd('0x4'));var config=require(_0x87bd('0x5'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x87bd('0x6')]);router['get']('/describe',auth[_0x87bd('0x7')](),controller[_0x87bd('0x8')]);router[_0x87bd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x87bd('0xa')]);router[_0x87bd('0xb')]('/',auth[_0x87bd('0x7')](),controller[_0x87bd('0xc')]);router[_0x87bd('0xd')](_0x87bd('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x87bd('0xf')](_0x87bd('0xe'),auth['isAuthenticated'](),controller[_0x87bd('0x10')]);module[_0x87bd('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 2083de5..fa7e5de 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 _0x5d58=['FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x37a580,_0x3135a6){var _0x77d8d1=function(_0x4c719a){while(--_0x4c719a){_0x37a580['push'](_0x37a580['shift']());}};_0x77d8d1(++_0x3135a6);}(_0x5d58,0x187));var _0x85d5=function(_0x5f184e,_0x4fa6ac){_0x5f184e=_0x5f184e-0x0;var _0x50a519=_0x5d58[_0x5f184e];return _0x50a519;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x85d5('0x0')]},'queue':{'type':Sequelize[_0x85d5('0x0')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x85d5('0x0')]},'agentcalledAt':{'type':Sequelize[_0x85d5('0x1')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x85d5('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x85d5('0x1')]},'agentdumpAt':{'type':Sequelize[_0x85d5('0x1')]},'holdtime':{'type':Sequelize[_0x85d5('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x85d5('0x0')]},'lastevent':{'type':Sequelize[_0x85d5('0x0')]},'channel':{'type':Sequelize[_0x85d5('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x85d5('0x0')]},'language':{'type':Sequelize[_0x85d5('0x0')]},'accountcode':{'type':Sequelize[_0x85d5('0x0')]},'context':{'type':Sequelize[_0x85d5('0x0')]},'exten':{'type':Sequelize[_0x85d5('0x0')]},'priority':{'type':Sequelize[_0x85d5('0x0')]},'destchannel':{'type':Sequelize[_0x85d5('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x85d5('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x85d5('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x85d5('0x0')]},'destlanguage':{'type':Sequelize[_0x85d5('0x0')]},'destaccountcode':{'type':Sequelize[_0x85d5('0x0')]},'destcontext':{'type':Sequelize[_0x85d5('0x0')]},'destexten':{'type':Sequelize[_0x85d5('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x85d5('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x85d5('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x85d5('0x0')]},'transfer':{'type':Sequelize[_0x85d5('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x85d5('0x0')],'comment':_0x85d5('0x4')},'transferexten':{'type':Sequelize[_0x85d5('0x0')]},'transferuniqueid':{'type':Sequelize[_0x85d5('0x0')]},'agententerreason':{'type':Sequelize[_0x85d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xabce=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x4d79b6,_0x1efe78){var _0x44650f=function(_0x50f328){while(--_0x50f328){_0x4d79b6['push'](_0x4d79b6['shift']());}};_0x44650f(++_0x1efe78);}(_0xabce,0x103));var _0xeabc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xabce[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'type':{'type':Sequelize[_0xeabc('0x2')]},'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'calleridnum':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xeabc('0x2')]},'membername':{'type':Sequelize[_0xeabc('0x2')]},'agentcalledAt':{'type':Sequelize[_0xeabc('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xeabc('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xeabc('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeabc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeabc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeabc('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeabc('0x4')]},'reason':{'type':Sequelize[_0xeabc('0x2')]},'lastevent':{'type':Sequelize[_0xeabc('0x2')]},'channel':{'type':Sequelize[_0xeabc('0x2')]},'channelstate':{'type':Sequelize[_0xeabc('0x4')]},'channelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'language':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize[_0xeabc('0x2')]},'exten':{'type':Sequelize[_0xeabc('0x2')]},'priority':{'type':Sequelize[_0xeabc('0x2')]},'destchannel':{'type':Sequelize[_0xeabc('0x2')]},'destchannelstate':{'type':Sequelize[_0xeabc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xeabc('0x2')]},'destexten':{'type':Sequelize[_0xeabc('0x2')]},'destpriority':{'type':Sequelize[_0xeabc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeabc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xeabc('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xeabc('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeabc('0x2')]},'agententerreason':{'type':Sequelize[_0xeabc('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 1a76e85..8ed715c 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 _0x40aa=['model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceAgentReport','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','end','map','rawAttributes','fieldName','key'];(function(_0x2a5203,_0x42834d){var _0x580809=function(_0x319619){while(--_0x319619){_0x2a5203['push'](_0x2a5203['shift']());}};_0x580809(++_0x42834d);}(_0x40aa,0xfd));var _0xa40a=function(_0x4d45fd,_0x16b74c){_0x4d45fd=_0x4d45fd-0x0;var _0x2b5aa5=_0x40aa[_0x4d45fd];return _0x2b5aa5;};'use strict';var pdf=require(_0xa40a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa40a('0x1'));var zipdir=require(_0xa40a('0x2'));var jsonpatch=require(_0xa40a('0x3'));var rp=require(_0xa40a('0x4'));var moment=require(_0xa40a('0x5'));var BPromise=require(_0xa40a('0x6'));var Mustache=require(_0xa40a('0x7'));var util=require(_0xa40a('0x8'));var path=require(_0xa40a('0x9'));var sox=require(_0xa40a('0xa'));var csv=require(_0xa40a('0xb'));var ejs=require(_0xa40a('0xc'));var fs=require('fs');var _=require(_0xa40a('0xd'));var squel=require(_0xa40a('0xe'));var crypto=require(_0xa40a('0xf'));var jsforce=require(_0xa40a('0x10'));var deskjs=require(_0xa40a('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa40a('0x12'));var Redis=require('ioredis');var authService=require(_0xa40a('0x13'));var qs=require(_0xa40a('0x14'));var as=require(_0xa40a('0x15'));var hardwareService=require(_0xa40a('0x16'));var logger=require('../../config/logger')(_0xa40a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa40a('0x18'));var db=require(_0xa40a('0x19'))['db'];function respondWithStatusCode(_0x57e87a,_0x1c0838){_0x1c0838=_0x1c0838||0xcc;return function(_0x32f430){if(_0x32f430){return _0x57e87a[_0xa40a('0x1a')](_0x1c0838);}return _0x57e87a[_0xa40a('0x1b')](_0x1c0838)['end']();};}function respondWithResult(_0x5f23b2,_0x38794f){_0x38794f=_0x38794f||0xc8;return function(_0x48a420){if(_0x48a420){return _0x5f23b2[_0xa40a('0x1b')](_0x38794f)[_0xa40a('0x1c')](_0x48a420);}};}function respondWithFilteredResult(_0x2305c4,_0x75627e){return function(_0xf1ea5f){if(_0xf1ea5f){var _0x58c02d=_0xf1ea5f[_0xa40a('0x1d')],_0x40533b=_0x75627e[_0xa40a('0x1e')],_0x20137a=_0x75627e[_0xa40a('0x1e')]+_0x75627e[_0xa40a('0x1f')],_0x548e77;if(_0x20137a>=_0x58c02d){_0x20137a=_0x58c02d;_0x548e77=0xc8;}else{_0x548e77=0xce;}_0x2305c4[_0xa40a('0x1b')](_0x548e77);return _0x2305c4[_0xa40a('0x20')](_0xa40a('0x21'),_0x40533b+'-'+_0x20137a+'/'+_0x58c02d)[_0xa40a('0x1c')](_0xf1ea5f);}return null;};}function patchUpdates(_0xf8c027){return function(_0x39ea61){try{jsonpatch['apply'](_0x39ea61,_0xf8c027,!![]);}catch(_0x152adc){return BPromise[_0xa40a('0x22')](_0x152adc);}return _0x39ea61[_0xa40a('0x23')]();};}function saveUpdates(_0x59c6c3,_0x48705e){return function(_0x3abfa2){if(_0x3abfa2){return _0x3abfa2['update'](_0x59c6c3)['then'](function(_0x32182f){return _0x32182f;});}return null;};}function removeEntity(_0x4e7f29,_0xace5d6){return function(_0x3b231c){if(_0x3b231c){return _0x3b231c[_0xa40a('0x24')]()[_0xa40a('0x25')](function(){_0x4e7f29[_0xa40a('0x1b')](0xcc)[_0xa40a('0x26')]();});}};}function handleEntityNotFound(_0x20bbab,_0x31f6e3){return function(_0x34a22c){if(!_0x34a22c){_0x20bbab[_0xa40a('0x1a')](0x194);}return _0x34a22c;};}function handleError(_0x2da7e4,_0x1fae12){_0x1fae12=_0x1fae12||0x1f4;return function(_0x416d74){logger['error'](_0x416d74['stack']);if(_0x416d74['name']){delete _0x416d74['name'];}_0x2da7e4[_0xa40a('0x1b')](_0x1fae12)['send'](_0x416d74);};}exports['index']=function(_0x3cc463,_0x14035b){var _0x4d39c3={},_0xca188={},_0x20356a={'count':0x0,'rows':[]};var _0x52e770=_[_0xa40a('0x27')](db['VoiceAgentReport'][_0xa40a('0x28')],function(_0x4acc39){return{'name':_0x4acc39[_0xa40a('0x29')],'type':_0x4acc39['type'][_0xa40a('0x2a')]};});_0xca188[_0xa40a('0x2b')]=_[_0xa40a('0x27')](_0x52e770,_0xa40a('0x2c'));_0xca188[_0xa40a('0x2d')]=_['keys'](_0x3cc463[_0xa40a('0x2d')]);_0xca188[_0xa40a('0x2e')]=_['intersection'](_0xca188[_0xa40a('0x2b')],_0xca188['query']);_0x4d39c3[_0xa40a('0x2f')]=_[_0xa40a('0x30')](_0xca188['model'],qs[_0xa40a('0x31')](_0x3cc463['query'][_0xa40a('0x31')]));_0x4d39c3[_0xa40a('0x2f')]=_0x4d39c3[_0xa40a('0x2f')][_0xa40a('0x32')]?_0x4d39c3['attributes']:_0xca188[_0xa40a('0x2b')];if(!_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x33')](_0xa40a('0x34'))){_0x4d39c3[_0xa40a('0x1f')]=qs[_0xa40a('0x1f')](_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x1f')]);_0x4d39c3[_0xa40a('0x1e')]=qs[_0xa40a('0x1e')](_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x1e')]);}_0x4d39c3[_0xa40a('0x35')]=qs[_0xa40a('0x36')](_0x3cc463[_0xa40a('0x2d')]['sort']);_0x4d39c3[_0xa40a('0x37')]=qs[_0xa40a('0x2e')](_[_0xa40a('0x38')](_0x3cc463[_0xa40a('0x2d')],_0xca188[_0xa40a('0x2e')]),_0x52e770);if(_0x3cc463[_0xa40a('0x2d')][_0xa40a('0x39')]){_0x4d39c3[_0xa40a('0x37')]=_['merge'](_0x4d39c3[_0xa40a('0x37')],{'$or':_[_0xa40a('0x27')](_0x52e770,function(_0x528d66){if(_0x528d66['type']!==_0xa40a('0x3a')){var _0x38e65d={};_0x38e65d[_0x528d66[_0xa40a('0x2c')]]={'$like':'%'+_0x3cc463[_0xa40a('0x2d')]['filter']+'%'};return _0x38e65d;}})});}_0x4d39c3=_[_0xa40a('0x3b')]({},_0x4d39c3,_0x3cc463[_0xa40a('0x3c')]);var _0xfb2b59={'where':_0x4d39c3['where']};return db[_0xa40a('0x3d')][_0xa40a('0x1d')](_0xfb2b59)[_0xa40a('0x25')](function(_0x2a18ac){_0x20356a[_0xa40a('0x1d')]=_0x2a18ac;if(_0x3cc463[_0xa40a('0x2d')]['includeAll']){_0x4d39c3[_0xa40a('0x3e')]=[{'all':!![]}];}return db[_0xa40a('0x3d')][_0xa40a('0x3f')](_0x4d39c3);})[_0xa40a('0x25')](function(_0x4b60f6){_0x20356a[_0xa40a('0x40')]=_0x4b60f6;return _0x20356a;})['then'](respondWithFilteredResult(_0x14035b,_0x4d39c3))[_0xa40a('0x41')](handleError(_0x14035b,null));};exports[_0xa40a('0x42')]=function(_0x102761,_0x1d2f9e){var _0x15c240={'raw':![],'where':{'id':_0x102761['params']['id']}},_0x4a9265={};_0x4a9265['model']=_[_0xa40a('0x43')](db[_0xa40a('0x3d')][_0xa40a('0x28')]);_0x4a9265[_0xa40a('0x2d')]=_[_0xa40a('0x43')](_0x102761[_0xa40a('0x2d')]);_0x4a9265[_0xa40a('0x2e')]=_['intersection'](_0x4a9265[_0xa40a('0x2b')],_0x4a9265[_0xa40a('0x2d')]);_0x15c240[_0xa40a('0x2f')]=_[_0xa40a('0x30')](_0x4a9265[_0xa40a('0x2b')],qs[_0xa40a('0x31')](_0x102761[_0xa40a('0x2d')][_0xa40a('0x31')]));_0x15c240[_0xa40a('0x2f')]=_0x15c240[_0xa40a('0x2f')][_0xa40a('0x32')]?_0x15c240[_0xa40a('0x2f')]:_0x4a9265[_0xa40a('0x2b')];if(_0x102761[_0xa40a('0x2d')][_0xa40a('0x44')]){_0x15c240['include']=[{'all':!![]}];}_0x15c240=_['merge']({},_0x15c240,_0x102761[_0xa40a('0x3c')]);return db['VoiceAgentReport'][_0xa40a('0x45')](_0x15c240)['then'](handleEntityNotFound(_0x1d2f9e,null))[_0xa40a('0x25')](respondWithResult(_0x1d2f9e,null))[_0xa40a('0x41')](handleError(_0x1d2f9e,null));};exports[_0xa40a('0x46')]=function(_0x4b4b6a,_0x2de1b0){return db[_0xa40a('0x3d')][_0xa40a('0x46')](_0x4b4b6a['body'],{})[_0xa40a('0x25')](respondWithResult(_0x2de1b0,0xc9))['catch'](handleError(_0x2de1b0,null));};exports['update']=function(_0x4453a3,_0x364d6a){if(_0x4453a3[_0xa40a('0x47')]['id']){delete _0x4453a3[_0xa40a('0x47')]['id'];}return db[_0xa40a('0x3d')][_0xa40a('0x45')]({'where':{'id':_0x4453a3[_0xa40a('0x48')]['id']}})['then'](handleEntityNotFound(_0x364d6a,null))[_0xa40a('0x25')](saveUpdates(_0x4453a3['body'],null))[_0xa40a('0x25')](respondWithResult(_0x364d6a,null))[_0xa40a('0x41')](handleError(_0x364d6a,null));};exports['destroy']=function(_0x10f639,_0x4d8fe5){return db[_0xa40a('0x3d')][_0xa40a('0x45')]({'where':{'id':_0x10f639[_0xa40a('0x48')]['id']}})[_0xa40a('0x25')](handleEntityNotFound(_0x4d8fe5,null))[_0xa40a('0x25')](removeEntity(_0x4d8fe5,null))[_0xa40a('0x41')](handleError(_0x4d8fe5,null));};exports['describe']=function(_0x3e9f5b,_0x59b217){return db[_0xa40a('0x3d')][_0xa40a('0x49')]()[_0xa40a('0x25')](respondWithResult(_0x59b217,null))[_0xa40a('0x41')](handleError(_0x59b217,null));}; \ No newline at end of file +var _0x8b58=['VoiceAgentReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','fields','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x745e14,_0x262a08){var _0x55b28d=function(_0x582d93){while(--_0x582d93){_0x745e14['push'](_0x745e14['shift']());}};_0x55b28d(++_0x262a08);}(_0x8b58,0x6b));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x88b5('0x0'));var emlformat=require(_0x88b5('0x1'));var rimraf=require(_0x88b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88b5('0x3'));var rp=require('request-promise');var moment=require(_0x88b5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x88b5('0x5'));var sox=require(_0x88b5('0x6'));var csv=require('to-csv');var ejs=require(_0x88b5('0x7'));var fs=require('fs');var _=require(_0x88b5('0x8'));var squel=require(_0x88b5('0x9'));var crypto=require(_0x88b5('0xa'));var jsforce=require(_0x88b5('0xb'));var deskjs=require(_0x88b5('0xc'));var toCsv=require(_0x88b5('0xd'));var querystring=require(_0x88b5('0xe'));var Papa=require(_0x88b5('0xf'));var Redis=require('ioredis');var authService=require(_0x88b5('0x10'));var qs=require(_0x88b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88b5('0x12'));var logger=require(_0x88b5('0x13'))(_0x88b5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x88b5('0x15'));var db=require(_0x88b5('0x16'))['db'];function respondWithStatusCode(_0x17a1bc,_0x49fd93){_0x49fd93=_0x49fd93||0xcc;return function(_0x1a3a20){if(_0x1a3a20){return _0x17a1bc['sendStatus'](_0x49fd93);}return _0x17a1bc[_0x88b5('0x17')](_0x49fd93)[_0x88b5('0x18')]();};}function respondWithResult(_0x5823eb,_0x33df42){_0x33df42=_0x33df42||0xc8;return function(_0x9b09d0){if(_0x9b09d0){return _0x5823eb[_0x88b5('0x17')](_0x33df42)[_0x88b5('0x19')](_0x9b09d0);}};}function respondWithFilteredResult(_0x1cebea,_0x4b3890){return function(_0x33a6d8){if(_0x33a6d8){var _0x23f1fa=_0x33a6d8[_0x88b5('0x1a')],_0x447331=_0x4b3890['offset'],_0x4e74da=_0x4b3890[_0x88b5('0x1b')]+_0x4b3890['limit'],_0x45ddf8;if(_0x4e74da>=_0x23f1fa){_0x4e74da=_0x23f1fa;_0x45ddf8=0xc8;}else{_0x45ddf8=0xce;}_0x1cebea['status'](_0x45ddf8);return _0x1cebea['set'](_0x88b5('0x1c'),_0x447331+'-'+_0x4e74da+'/'+_0x23f1fa)[_0x88b5('0x19')](_0x33a6d8);}return null;};}function patchUpdates(_0x1b69fb){return function(_0x57c1fa){try{jsonpatch['apply'](_0x57c1fa,_0x1b69fb,!![]);}catch(_0x481e80){return BPromise[_0x88b5('0x1d')](_0x481e80);}return _0x57c1fa[_0x88b5('0x1e')]();};}function saveUpdates(_0x167c71,_0x336a47){return function(_0x1fa893){if(_0x1fa893){return _0x1fa893[_0x88b5('0x1f')](_0x167c71)[_0x88b5('0x20')](function(_0x4f546a){return _0x4f546a;});}return null;};}function removeEntity(_0x4d3a38,_0x21c7d1){return function(_0x285c01){if(_0x285c01){return _0x285c01[_0x88b5('0x21')]()[_0x88b5('0x20')](function(){_0x4d3a38[_0x88b5('0x17')](0xcc)[_0x88b5('0x18')]();});}};}function handleEntityNotFound(_0x407f16,_0x52f193){return function(_0x423f7b){if(!_0x423f7b){_0x407f16[_0x88b5('0x22')](0x194);}return _0x423f7b;};}function handleError(_0x1b208a,_0x282929){_0x282929=_0x282929||0x1f4;return function(_0x84330f){logger[_0x88b5('0x23')](_0x84330f[_0x88b5('0x24')]);if(_0x84330f[_0x88b5('0x25')]){delete _0x84330f[_0x88b5('0x25')];}_0x1b208a['status'](_0x282929)[_0x88b5('0x26')](_0x84330f);};}exports[_0x88b5('0x27')]=function(_0x9dd3d8,_0x2aedf0){var _0x5c24d6={},_0x275d9a={},_0x4cb68c={'count':0x0,'rows':[]};var _0x3dd664=_[_0x88b5('0x28')](db[_0x88b5('0x29')][_0x88b5('0x2a')],function(_0x16e06a){return{'name':_0x16e06a['fieldName'],'type':_0x16e06a[_0x88b5('0x2b')][_0x88b5('0x2c')]};});_0x275d9a[_0x88b5('0x2d')]=_[_0x88b5('0x28')](_0x3dd664,_0x88b5('0x25'));_0x275d9a[_0x88b5('0x2e')]=_[_0x88b5('0x2f')](_0x9dd3d8['query']);_0x275d9a[_0x88b5('0x30')]=_[_0x88b5('0x31')](_0x275d9a[_0x88b5('0x2d')],_0x275d9a[_0x88b5('0x2e')]);_0x5c24d6[_0x88b5('0x32')]=_[_0x88b5('0x31')](_0x275d9a[_0x88b5('0x2d')],qs['fields'](_0x9dd3d8[_0x88b5('0x2e')]['fields']));_0x5c24d6['attributes']=_0x5c24d6[_0x88b5('0x32')]['length']?_0x5c24d6[_0x88b5('0x32')]:_0x275d9a[_0x88b5('0x2d')];if(!_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x33')](_0x88b5('0x34'))){_0x5c24d6[_0x88b5('0x35')]=qs[_0x88b5('0x35')](_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x35')]);_0x5c24d6[_0x88b5('0x1b')]=qs['offset'](_0x9dd3d8['query']['offset']);}_0x5c24d6[_0x88b5('0x36')]=qs[_0x88b5('0x37')](_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x37')]);_0x5c24d6[_0x88b5('0x38')]=qs[_0x88b5('0x30')](_[_0x88b5('0x39')](_0x9dd3d8[_0x88b5('0x2e')],_0x275d9a[_0x88b5('0x30')]),_0x3dd664);if(_0x9dd3d8[_0x88b5('0x2e')]['filter']){_0x5c24d6[_0x88b5('0x38')]=_[_0x88b5('0x3a')](_0x5c24d6[_0x88b5('0x38')],{'$or':_[_0x88b5('0x28')](_0x3dd664,function(_0x5c0fd2){if(_0x5c0fd2[_0x88b5('0x2b')]!==_0x88b5('0x3b')){var _0x5e6454={};_0x5e6454[_0x5c0fd2[_0x88b5('0x25')]]={'$like':'%'+_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x3c')]+'%'};return _0x5e6454;}})});}_0x5c24d6=_[_0x88b5('0x3a')]({},_0x5c24d6,_0x9dd3d8[_0x88b5('0x3d')]);var _0x8bf2fa={'where':_0x5c24d6[_0x88b5('0x38')]};return db['VoiceAgentReport'][_0x88b5('0x1a')](_0x8bf2fa)['then'](function(_0x168b23){_0x4cb68c[_0x88b5('0x1a')]=_0x168b23;if(_0x9dd3d8[_0x88b5('0x2e')][_0x88b5('0x3e')]){_0x5c24d6[_0x88b5('0x3f')]=[{'all':!![]}];}return db[_0x88b5('0x29')]['findAll'](_0x5c24d6);})['then'](function(_0x39820c){_0x4cb68c[_0x88b5('0x40')]=_0x39820c;return _0x4cb68c;})['then'](respondWithFilteredResult(_0x2aedf0,_0x5c24d6))[_0x88b5('0x41')](handleError(_0x2aedf0,null));};exports[_0x88b5('0x42')]=function(_0x2b73a7,_0x45c9fe){var _0x3eaa66={'raw':![],'where':{'id':_0x2b73a7['params']['id']}},_0x57b7c6={};_0x57b7c6[_0x88b5('0x2d')]=_[_0x88b5('0x2f')](db[_0x88b5('0x29')][_0x88b5('0x2a')]);_0x57b7c6[_0x88b5('0x2e')]=_[_0x88b5('0x2f')](_0x2b73a7[_0x88b5('0x2e')]);_0x57b7c6[_0x88b5('0x30')]=_[_0x88b5('0x31')](_0x57b7c6[_0x88b5('0x2d')],_0x57b7c6[_0x88b5('0x2e')]);_0x3eaa66['attributes']=_[_0x88b5('0x31')](_0x57b7c6[_0x88b5('0x2d')],qs[_0x88b5('0x43')](_0x2b73a7[_0x88b5('0x2e')][_0x88b5('0x43')]));_0x3eaa66[_0x88b5('0x32')]=_0x3eaa66[_0x88b5('0x32')][_0x88b5('0x44')]?_0x3eaa66[_0x88b5('0x32')]:_0x57b7c6[_0x88b5('0x2d')];if(_0x2b73a7[_0x88b5('0x2e')][_0x88b5('0x3e')]){_0x3eaa66[_0x88b5('0x3f')]=[{'all':!![]}];}_0x3eaa66=_[_0x88b5('0x3a')]({},_0x3eaa66,_0x2b73a7[_0x88b5('0x3d')]);return db[_0x88b5('0x29')][_0x88b5('0x45')](_0x3eaa66)['then'](handleEntityNotFound(_0x45c9fe,null))[_0x88b5('0x20')](respondWithResult(_0x45c9fe,null))['catch'](handleError(_0x45c9fe,null));};exports[_0x88b5('0x46')]=function(_0x45e641,_0x53bd11){return db['VoiceAgentReport'][_0x88b5('0x46')](_0x45e641[_0x88b5('0x47')],{})['then'](respondWithResult(_0x53bd11,0xc9))[_0x88b5('0x41')](handleError(_0x53bd11,null));};exports[_0x88b5('0x1f')]=function(_0x4e8869,_0x1691ad){if(_0x4e8869['body']['id']){delete _0x4e8869[_0x88b5('0x47')]['id'];}return db['VoiceAgentReport'][_0x88b5('0x45')]({'where':{'id':_0x4e8869[_0x88b5('0x48')]['id']}})['then'](handleEntityNotFound(_0x1691ad,null))[_0x88b5('0x20')](saveUpdates(_0x4e8869[_0x88b5('0x47')],null))[_0x88b5('0x20')](respondWithResult(_0x1691ad,null))['catch'](handleError(_0x1691ad,null));};exports[_0x88b5('0x21')]=function(_0x53ce9b,_0x2148a0){return db[_0x88b5('0x29')][_0x88b5('0x45')]({'where':{'id':_0x53ce9b[_0x88b5('0x48')]['id']}})[_0x88b5('0x20')](handleEntityNotFound(_0x2148a0,null))[_0x88b5('0x20')](removeEntity(_0x2148a0,null))[_0x88b5('0x41')](handleError(_0x2148a0,null));};exports[_0x88b5('0x49')]=function(_0x24e2ab,_0x2811b){return db[_0x88b5('0x29')][_0x88b5('0x49')]()['then'](respondWithResult(_0x2811b,null))[_0x88b5('0x41')](handleError(_0x2811b,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 26edd4e..ff28262 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 _0x36fe=['exports','define','VoiceAgentReport','report_agent','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x13fb74,_0x42e5eb){var _0x140f20=function(_0x224782){while(--_0x224782){_0x13fb74['push'](_0x13fb74['shift']());}};_0x140f20(++_0x42e5eb);}(_0x36fe,0x17b));var _0xe36f=function(_0x48b6c6,_0xba4073){_0x48b6c6=_0x48b6c6-0x0;var _0x1bcc9a=_0x36fe[_0x48b6c6];return _0x1bcc9a;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var logger=require(_0xe36f('0x2'))(_0xe36f('0x3'));var moment=require(_0xe36f('0x4'));var BPromise=require(_0xe36f('0x5'));var rp=require(_0xe36f('0x6'));var fs=require('fs');var path=require(_0xe36f('0x7'));var rimraf=require(_0xe36f('0x8'));var config=require(_0xe36f('0x9'));var attributes=require(_0xe36f('0xa'));module[_0xe36f('0xb')]=function(_0x24e508,_0x2a4d54){return _0x24e508[_0xe36f('0xc')](_0xe36f('0xd'),attributes,{'tableName':_0xe36f('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf3c=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','destuniqueid','lodash','../../config/logger','moment'];(function(_0x11ff55,_0x313baf){var _0x25afdd=function(_0x386058){while(--_0x386058){_0x11ff55['push'](_0x11ff55['shift']());}};_0x25afdd(++_0x313baf);}(_0xcf3c,0x168));var _0xccf3=function(_0x394d8b,_0x365fa2){_0x394d8b=_0x394d8b-0x0;var _0x172da4=_0xcf3c[_0x394d8b];return _0x172da4;};'use strict';var _=require(_0xccf3('0x0'));var util=require('util');var logger=require(_0xccf3('0x1'))('api');var moment=require(_0xccf3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xccf3('0x3'));var rimraf=require(_0xccf3('0x4'));var config=require(_0xccf3('0x5'));var attributes=require(_0xccf3('0x6'));module[_0xccf3('0x7')]=function(_0x29c751,_0x282b6e){return _0x29c751[_0xccf3('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xccf3('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xccf3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b6d3686..9c0a041 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 _0x440a=['request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x3160c5,_0x26e2b4){var _0x24139e=function(_0x51aa9b){while(--_0x51aa9b){_0x3160c5['push'](_0x3160c5['shift']());}};_0x24139e(++_0x26e2b4);}(_0x440a,0x19a));var _0xa440=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x440a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa440('0x0'));var util=require(_0xa440('0x1'));var moment=require(_0xa440('0x2'));var BPromise=require(_0xa440('0x3'));var rs=require(_0xa440('0x4'));var fs=require('fs');var Redis=require(_0xa440('0x5'));var db=require(_0xa440('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa440('0x7'))(_0xa440('0x8'));var config=require('../../config/environment');var jayson=require(_0xa440('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58dca2,_0x4099d3,_0x24eb4c){return new BPromise(function(_0x1f5ae4,_0x5c236d){return client['request'](_0x58dca2,_0x24eb4c)[_0xa440('0xa')](function(_0x2ad3bb){logger[_0xa440('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x4099d3,'request\x20sent');logger[_0xa440('0xc')](_0xa440('0xd'),_0x4099d3,'request\x20sent',JSON[_0xa440('0xe')](_0x2ad3bb));if(_0x2ad3bb[_0xa440('0xf')]){if(_0x2ad3bb[_0xa440('0xf')][_0xa440('0x10')]===0x1f4){logger['error'](_0xa440('0x11'),_0x4099d3,_0x2ad3bb[_0xa440('0xf')][_0xa440('0x12')]);return _0x5c236d(_0x2ad3bb[_0xa440('0xf')][_0xa440('0x12')]);}logger[_0xa440('0xf')](_0xa440('0x11'),_0x4099d3,_0x2ad3bb[_0xa440('0xf')][_0xa440('0x12')]);return _0x1f5ae4(_0x2ad3bb['error'][_0xa440('0x12')]);}else{logger['info'](_0xa440('0x11'),_0x4099d3,_0xa440('0x13'));_0x1f5ae4(_0x2ad3bb[_0xa440('0x14')][_0xa440('0x12')]);}})[_0xa440('0x15')](function(_0x2c2914){logger[_0xa440('0xf')](_0xa440('0x11'),_0x4099d3,_0x2c2914);_0x5c236d(_0x2c2914);});});}exports[_0xa440('0x16')]=function(_0x194c27){var _0x4523f7=this;return new Promise(function(_0x3b6edb,_0x55c5bc){return db[_0xa440('0x17')][_0xa440('0x18')](_0x194c27['body'],{'raw':_0x194c27['options']?_0x194c27[_0xa440('0x19')][_0xa440('0x1a')]===undefined?!![]:![]:!![]})[_0xa440('0xa')](function(_0xc0f27e){logger[_0xa440('0xb')](_0xa440('0x16'),_0x194c27);logger['debug'](_0xa440('0x16'),_0x194c27,JSON[_0xa440('0xe')](_0xc0f27e));_0x3b6edb(_0xc0f27e);})['catch'](function(_0x40e5d7){logger[_0xa440('0xf')](_0xa440('0x16'),_0x40e5d7['message'],_0x194c27);_0x55c5bc(_0x4523f7[_0xa440('0xf')](0x1f4,_0x40e5d7[_0xa440('0x12')]));});});};exports[_0xa440('0x1b')]=function(_0x4294d0){var _0x228831=this;return new Promise(function(_0x375b1e,_0x3dbaae){return db['VoiceAgentReport'][_0xa440('0x1c')](_0x4294d0[_0xa440('0x1d')],{'raw':_0x4294d0['options']?_0x4294d0[_0xa440('0x19')][_0xa440('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4294d0['options']?_0x4294d0[_0xa440('0x19')][_0xa440('0x1e')]||null:null,'attributes':_0x4294d0[_0xa440('0x19')]?_0x4294d0[_0xa440('0x19')][_0xa440('0x1f')]||null:null,'limit':_0x4294d0[_0xa440('0x19')]?_0x4294d0[_0xa440('0x19')][_0xa440('0x20')]||null:null})[_0xa440('0xa')](function(_0x377774){logger[_0xa440('0xb')]('UpdateVoiceAgentReport',_0x4294d0);logger[_0xa440('0xc')]('UpdateVoiceAgentReport',_0x4294d0,JSON['stringify'](_0x377774));_0x375b1e(_0x377774);})[_0xa440('0x15')](function(_0x459642){logger[_0xa440('0xf')]('UpdateVoiceAgentReport',_0x459642[_0xa440('0x12')],_0x4294d0);_0x3dbaae(_0x228831[_0xa440('0xf')](0x1f4,_0x459642[_0xa440('0x12')]));});});}; \ No newline at end of file +var _0x5655=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','UpdateVoiceAgentReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5655,0x82));var _0x5565=function(_0x309af6,_0x38b21e){_0x309af6=_0x309af6-0x0;var _0x104daa=_0x5655[_0x309af6];return _0x104daa;};'use strict';var _=require('lodash');var util=require(_0x5565('0x0'));var moment=require(_0x5565('0x1'));var BPromise=require(_0x5565('0x2'));var rs=require(_0x5565('0x3'));var fs=require('fs');var Redis=require(_0x5565('0x4'));var db=require(_0x5565('0x5'))['db'];var utils=require(_0x5565('0x6'));var logger=require('../../config/logger')(_0x5565('0x7'));var config=require(_0x5565('0x8'));var jayson=require(_0x5565('0x9'));var client=jayson[_0x5565('0xa')][_0x5565('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb23,_0x4169bc,_0x52546a){return new BPromise(function(_0x35ef77,_0x4bd9f9){return client[_0x5565('0xc')](_0x4eeb23,_0x52546a)[_0x5565('0xd')](function(_0x1ef82c){logger[_0x5565('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4169bc,_0x5565('0xf'));logger[_0x5565('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4169bc,_0x5565('0xf'),JSON['stringify'](_0x1ef82c));if(_0x1ef82c[_0x5565('0x11')]){if(_0x1ef82c[_0x5565('0x11')][_0x5565('0x12')]===0x1f4){logger[_0x5565('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4169bc,_0x1ef82c[_0x5565('0x11')][_0x5565('0x13')]);return _0x4bd9f9(_0x1ef82c[_0x5565('0x11')][_0x5565('0x13')]);}logger[_0x5565('0x11')](_0x5565('0x14'),_0x4169bc,_0x1ef82c['error']['message']);return _0x35ef77(_0x1ef82c[_0x5565('0x11')][_0x5565('0x13')]);}else{logger[_0x5565('0xe')](_0x5565('0x14'),_0x4169bc,_0x5565('0xf'));_0x35ef77(_0x1ef82c[_0x5565('0x15')][_0x5565('0x13')]);}})[_0x5565('0x16')](function(_0x3230ca){logger[_0x5565('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4169bc,_0x3230ca);_0x4bd9f9(_0x3230ca);});});}exports[_0x5565('0x17')]=function(_0x473f63){var _0x3a1a3a=this;return new Promise(function(_0x575cd5,_0x2b81fb){return db[_0x5565('0x18')][_0x5565('0x19')](_0x473f63[_0x5565('0x1a')],{'raw':_0x473f63[_0x5565('0x1b')]?_0x473f63[_0x5565('0x1b')][_0x5565('0x1c')]===undefined?!![]:![]:!![]})[_0x5565('0xd')](function(_0x2b54f2){logger[_0x5565('0xe')](_0x5565('0x17'),_0x473f63);logger[_0x5565('0x10')](_0x5565('0x17'),_0x473f63,JSON[_0x5565('0x1d')](_0x2b54f2));_0x575cd5(_0x2b54f2);})[_0x5565('0x16')](function(_0x313190){logger[_0x5565('0x11')](_0x5565('0x17'),_0x313190[_0x5565('0x13')],_0x473f63);_0x2b81fb(_0x3a1a3a[_0x5565('0x11')](0x1f4,_0x313190[_0x5565('0x13')]));});});};exports[_0x5565('0x1e')]=function(_0xcf9ecb){var _0x5dee86=this;return new Promise(function(_0x24d67f,_0x5615e9){return db[_0x5565('0x18')]['update'](_0xcf9ecb[_0x5565('0x1a')],{'raw':_0xcf9ecb['options']?_0xcf9ecb['options'][_0x5565('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf9ecb[_0x5565('0x1b')]?_0xcf9ecb[_0x5565('0x1b')][_0x5565('0x1f')]||null:null,'attributes':_0xcf9ecb[_0x5565('0x1b')]?_0xcf9ecb[_0x5565('0x1b')][_0x5565('0x20')]||null:null,'limit':_0xcf9ecb[_0x5565('0x1b')]?_0xcf9ecb[_0x5565('0x1b')][_0x5565('0x21')]||null:null})[_0x5565('0xd')](function(_0x56ca8f){logger[_0x5565('0xe')](_0x5565('0x1e'),_0xcf9ecb);logger['debug'](_0x5565('0x1e'),_0xcf9ecb,JSON['stringify'](_0x56ca8f));_0x24d67f(_0x56ca8f);})[_0x5565('0x16')](function(_0x3fba4a){logger[_0x5565('0x11')]('UpdateVoiceAgentReport',_0x3fba4a[_0x5565('0x13')],_0xcf9ecb);_0x5615e9(_0x5dee86[_0x5565('0x11')](0x1f4,_0x3fba4a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7d169ef..a1ab1b8 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 _0x9597=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x31e51c,_0x3eb8d7){var _0x1d25d5=function(_0x18033b){while(--_0x18033b){_0x31e51c['push'](_0x31e51c['shift']());}};_0x1d25d5(++_0x3eb8d7);}(_0x9597,0x1bb));var _0x7959=function(_0x3144f9,_0x4e0dd3){_0x3144f9=_0x3144f9-0x0;var _0x390992=_0x9597[_0x3144f9];return _0x390992;};'use strict';var multer=require(_0x7959('0x0'));var util=require(_0x7959('0x1'));var path=require(_0x7959('0x2'));var timeout=require('connect-timeout');var express=require(_0x7959('0x3'));var router=express[_0x7959('0x4')]();var auth=require(_0x7959('0x5'));var interaction=require(_0x7959('0x6'));var config=require(_0x7959('0x7'));var controller=require(_0x7959('0x8'));router[_0x7959('0x9')]('/',auth[_0x7959('0xa')](),controller[_0x7959('0xb')]);router[_0x7959('0x9')](_0x7959('0xc'),auth[_0x7959('0xa')](),controller[_0x7959('0xd')]);router[_0x7959('0x9')](_0x7959('0xe'),auth[_0x7959('0xa')](),controller[_0x7959('0xf')]);router[_0x7959('0x10')]('/',auth['isAuthenticated'](),controller[_0x7959('0x11')]);router[_0x7959('0x12')]('/:id',auth[_0x7959('0xa')](),controller[_0x7959('0x13')]);router[_0x7959('0x14')](_0x7959('0xe'),auth[_0x7959('0xa')](),controller[_0x7959('0x15')]);module[_0x7959('0x16')]=router; \ No newline at end of file +var _0x7538=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7538,0x78));var _0x8753=function(_0x1bb536,_0x23501c){_0x1bb536=_0x1bb536-0x0;var _0x12e57b=_0x7538[_0x1bb536];return _0x12e57b;};'use strict';var multer=require(_0x8753('0x0'));var util=require(_0x8753('0x1'));var path=require('path');var timeout=require(_0x8753('0x2'));var express=require(_0x8753('0x3'));var router=express[_0x8753('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8753('0x5'));var config=require(_0x8753('0x6'));var controller=require('./voiceCallReport.controller');router[_0x8753('0x7')]('/',auth[_0x8753('0x8')](),controller['index']);router[_0x8753('0x7')](_0x8753('0x9'),auth[_0x8753('0x8')](),controller['describe']);router[_0x8753('0x7')](_0x8753('0xa'),auth[_0x8753('0x8')](),controller[_0x8753('0xb')]);router[_0x8753('0xc')]('/',auth[_0x8753('0x8')](),controller[_0x8753('0xd')]);router[_0x8753('0xe')](_0x8753('0xa'),auth['isAuthenticated'](),controller[_0x8753('0xf')]);router[_0x8753('0x10')](_0x8753('0xa'),auth['isAuthenticated'](),controller[_0x8753('0x11')]);module[_0x8753('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f94af9e..bbbeb64 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 _0x9c5a=['sequelize','exports','ENUM','inbound','internal','outbound','outbound-fax','dialer','STRING','DATE','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4c4eee,_0x212a47){_0x4c4eee=_0x4c4eee-0x0;var _0x5e8d4b=_0x9c5a[_0x4c4eee];return _0x5e8d4b;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa9c5('0x2')](_0xa9c5('0x3'),_0xa9c5('0x4'),_0xa9c5('0x5'),'inbound-fax',_0xa9c5('0x6'),_0xa9c5('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x8')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa9c5('0x8')]},'destinationcontext':{'type':Sequelize[_0xa9c5('0x8')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xa9c5('0x8')]},'lastapplication':{'type':Sequelize[_0xa9c5('0x8')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xa9c5('0x9')]},'systemanswertime':{'type':Sequelize[_0xa9c5('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa9c5('0x9')]},'duration':{'type':Sequelize[_0xa9c5('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9c5('0x8')]},'amaflags':{'type':Sequelize[_0xa9c5('0x8')]},'userfield':{'type':Sequelize[_0xa9c5('0x8')]},'userDisposition':{'type':Sequelize[_0xa9c5('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xa9c5('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xa9c5('0x8')]},'note':{'type':Sequelize[_0xa9c5('0x8')]},'prefix':{'type':Sequelize[_0xa9c5('0x8')]},'routeid':{'type':Sequelize[_0xa9c5('0xa')]},'sipcallid':{'type':Sequelize[_0xa9c5('0x8')]}}; \ No newline at end of file +var _0x6aa7=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x2d0f8a,_0x286053){var _0x8bcfb4=function(_0x369e1b){while(--_0x369e1b){_0x2d0f8a['push'](_0x2d0f8a['shift']());}};_0x8bcfb4(++_0x286053);}(_0x6aa7,0x178));var _0x76aa=function(_0x2bfe09,_0x47309d){_0x2bfe09=_0x2bfe09-0x0;var _0x39dae4=_0x6aa7[_0x2bfe09];return _0x39dae4;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'type':{'type':Sequelize[_0x76aa('0x2')](_0x76aa('0x3'),_0x76aa('0x4'),'outbound',_0x76aa('0x5'),_0x76aa('0x6'),_0x76aa('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x76aa('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x76aa('0x1')]},'lastdata':{'type':Sequelize[_0x76aa('0x8')]},'starttime':{'type':Sequelize[_0x76aa('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x76aa('0x9')]},'endtime':{'type':Sequelize[_0x76aa('0x9')]},'duration':{'type':Sequelize[_0x76aa('0xa')]},'billableseconds':{'type':Sequelize[_0x76aa('0xa')]},'mohtime':{'type':Sequelize[_0x76aa('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x76aa('0x1')]},'amaflags':{'type':Sequelize[_0x76aa('0x1')]},'userfield':{'type':Sequelize[_0x76aa('0x1')]},'userDisposition':{'type':Sequelize[_0x76aa('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x76aa('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x76aa('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x76aa('0xa')]},'sipcallid':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 358b533..8eb81f5 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 9585e4e..d1fd6e9 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 _0xa74f=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x41c76f,_0x339363){var _0x22fefb=function(_0x7e37da){while(--_0x7e37da){_0x41c76f['push'](_0x41c76f['shift']());}};_0x22fefb(++_0x339363);}(_0xa74f,0xa2));var _0xfa74=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xa74f[_0x2eb3db];return _0x358f33;};'use strict';var _=require(_0xfa74('0x0'));var util=require(_0xfa74('0x1'));var logger=require(_0xfa74('0x2'))(_0xfa74('0x3'));var moment=require(_0xfa74('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa74('0x5'));var fs=require('fs');var path=require(_0xfa74('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa74('0x7'));module[_0xfa74('0x8')]=function(_0x927018,_0x1f6c66){return _0x927018[_0xfa74('0x9')](_0xfa74('0xa'),attributes,{'tableName':_0xfa74('0xb'),'paranoid':![],'indexes':[{'fields':[_0xfa74('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7254=['bluebird','path','rimraf','../../config/environment','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x7254,0x6b));var _0x4725=function(_0x3857f8,_0x58417b){_0x3857f8=_0x3857f8-0x0;var _0x2c51ea=_0x7254[_0x3857f8];return _0x2c51ea;};'use strict';var _=require('lodash');var util=require(_0x4725('0x0'));var logger=require(_0x4725('0x1'))(_0x4725('0x2'));var moment=require('moment');var BPromise=require(_0x4725('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4725('0x4'));var rimraf=require(_0x4725('0x5'));var config=require(_0x4725('0x6'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x26c202,_0x59c7be){return _0x26c202['define'](_0x4725('0x7'),attributes,{'tableName':_0x4725('0x8'),'paranoid':![],'indexes':[{'fields':[_0x4725('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index effe89f..1f2144f 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 _0x8f4d=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','raw','map','include','attributes','model','GetVoiceCallReport','stringify','catch','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','where','limit','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x8f4d,0xff));var _0xd8f4=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8f4d[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd8f4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8f4('0x1'));var fs=require('fs');var Redis=require(_0xd8f4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd8f4('0x3'));var logger=require(_0xd8f4('0x4'))(_0xd8f4('0x5'));var config=require(_0xd8f4('0x6'));var jayson=require(_0xd8f4('0x7'));var client=jayson[_0xd8f4('0x8')][_0xd8f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7e79,_0xc22757,_0x2480c2){return new BPromise(function(_0x8ae768,_0x2ae4e5){return client['request'](_0x3e7e79,_0x2480c2)[_0xd8f4('0xa')](function(_0x2e12c8){logger[_0xd8f4('0xb')](_0xd8f4('0xc'),_0xc22757,_0xd8f4('0xd'));logger[_0xd8f4('0xe')](_0xd8f4('0xf'),_0xc22757,_0xd8f4('0xd'),JSON['stringify'](_0x2e12c8));if(_0x2e12c8[_0xd8f4('0x10')]){if(_0x2e12c8[_0xd8f4('0x10')][_0xd8f4('0x11')]===0x1f4){logger[_0xd8f4('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0xc22757,_0x2e12c8[_0xd8f4('0x10')]['message']);return _0x2ae4e5(_0x2e12c8['error'][_0xd8f4('0x12')]);}logger['error'](_0xd8f4('0xc'),_0xc22757,_0x2e12c8['error'][_0xd8f4('0x12')]);return _0x8ae768(_0x2e12c8['error']['message']);}else{logger[_0xd8f4('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0xc22757,_0xd8f4('0xd'));_0x8ae768(_0x2e12c8[_0xd8f4('0x13')][_0xd8f4('0x12')]);}})['catch'](function(_0x469651){logger[_0xd8f4('0x10')](_0xd8f4('0xc'),_0xc22757,_0x469651);_0x2ae4e5(_0x469651);});});}exports['GetVoiceCallReport']=function(_0x500837){var _0x499df3=this;return new Promise(function(_0xbf5908,_0x190a57){return db['VoiceCallReport'][_0xd8f4('0x14')]({'raw':_0x500837['options']?_0x500837[_0xd8f4('0x15')][_0xd8f4('0x16')]===undefined?!![]:![]:!![],'where':_0x500837['options']?_0x500837[_0xd8f4('0x15')]['where']||null:null,'attributes':_0x500837[_0xd8f4('0x15')]?_0x500837[_0xd8f4('0x15')]['attributes']||null:null,'limit':_0x500837[_0xd8f4('0x15')]?_0x500837[_0xd8f4('0x15')]['limit']||null:null,'include':_0x500837[_0xd8f4('0x15')]?_0x500837[_0xd8f4('0x15')]['include']?_[_0xd8f4('0x17')](_0x500837[_0xd8f4('0x15')][_0xd8f4('0x18')],function(_0x5471c5){return{'model':db[_0x5471c5['model']],'as':_0x5471c5['as'],'attributes':_0x5471c5[_0xd8f4('0x19')],'include':_0x5471c5['include']?_[_0xd8f4('0x17')](_0x5471c5[_0xd8f4('0x18')],function(_0x31b84d){return{'model':db[_0x31b84d[_0xd8f4('0x1a')]],'as':_0x31b84d['as'],'attributes':_0x31b84d[_0xd8f4('0x19')],'include':_0x31b84d[_0xd8f4('0x18')]?_[_0xd8f4('0x17')](_0x31b84d[_0xd8f4('0x18')],function(_0xc65fd6){return{'model':db[_0xc65fd6[_0xd8f4('0x1a')]],'as':_0xc65fd6['as'],'attributes':_0xc65fd6[_0xd8f4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd8f4('0xa')](function(_0x54c55c){logger[_0xd8f4('0xb')](_0xd8f4('0x1b'),_0x500837);logger['debug']('GetVoiceCallReport',_0x500837,JSON[_0xd8f4('0x1c')](_0x54c55c));_0xbf5908(_0x54c55c);})[_0xd8f4('0x1d')](function(_0x435142){logger['error'](_0xd8f4('0x1b'),_0x435142['message'],_0x500837);_0x190a57(_0x499df3[_0xd8f4('0x10')](0x1f4,_0x435142[_0xd8f4('0x12')]));});});};exports[_0xd8f4('0x1e')]=function(_0x39f25){var _0x61b50d=this;return new Promise(function(_0x39a153,_0x10429f){return db[_0xd8f4('0x1f')][_0xd8f4('0x20')](_0x39f25[_0xd8f4('0x21')],{'raw':_0x39f25[_0xd8f4('0x15')]?_0x39f25[_0xd8f4('0x15')][_0xd8f4('0x16')]===undefined?!![]:![]:!![]})[_0xd8f4('0xa')](function(_0x227ec4){logger[_0xd8f4('0xb')](_0xd8f4('0x1e'),_0x39f25);logger[_0xd8f4('0xe')]('CreateVoiceCallReport',_0x39f25,JSON[_0xd8f4('0x1c')](_0x227ec4));_0x39a153(_0x227ec4);})[_0xd8f4('0x1d')](function(_0x4dae4a){logger[_0xd8f4('0x10')](_0xd8f4('0x1e'),_0x4dae4a[_0xd8f4('0x12')],_0x39f25);_0x10429f(_0x61b50d['error'](0x1f4,_0x4dae4a[_0xd8f4('0x12')]));});});};exports[_0xd8f4('0x22')]=function(_0x8a5d84){var _0xf7be50=this;return new Promise(function(_0x3d3b47,_0x7318fe){return db['VoiceCallReport'][_0xd8f4('0x23')](_0x8a5d84[_0xd8f4('0x21')],{'raw':_0x8a5d84['options']?_0x8a5d84['options'][_0xd8f4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a5d84[_0xd8f4('0x15')]?_0x8a5d84[_0xd8f4('0x15')][_0xd8f4('0x24')]||null:null,'attributes':_0x8a5d84['options']?_0x8a5d84[_0xd8f4('0x15')]['attributes']||null:null,'limit':_0x8a5d84[_0xd8f4('0x15')]?_0x8a5d84[_0xd8f4('0x15')][_0xd8f4('0x25')]||null:null})['then'](function(_0x39e3a6){logger['info'](_0xd8f4('0x22'),_0x8a5d84);logger['debug'](_0xd8f4('0x22'),_0x8a5d84,JSON[_0xd8f4('0x1c')](_0x39e3a6));_0x3d3b47(_0x39e3a6);})[_0xd8f4('0x1d')](function(_0x1e770c){logger[_0xd8f4('0x10')]('UpdateVoiceCallReport',_0x1e770c[_0xd8f4('0x12')],_0x8a5d84);_0x7318fe(_0xf7be50[_0xd8f4('0x10')](0x1f4,_0x1e770c[_0xd8f4('0x12')]));});});}; \ No newline at end of file +var _0xb118=['VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','map','model','include','debug','CreateVoiceCallReport','VoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xb118,0xce));var _0x8b11=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0xb118[_0x24693e];return _0x53e672;};'use strict';var _=require(_0x8b11('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b11('0x1'));var fs=require('fs');var Redis=require(_0x8b11('0x2'));var db=require(_0x8b11('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8b11('0x4'));var config=require(_0x8b11('0x5'));var jayson=require(_0x8b11('0x6'));var client=jayson['client'][_0x8b11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d7ba1,_0x3a285c,_0x489882){return new BPromise(function(_0x3927f1,_0x5ca678){return client['request'](_0x1d7ba1,_0x489882)[_0x8b11('0x8')](function(_0x1bc55f){logger[_0x8b11('0x9')](_0x8b11('0xa'),_0x3a285c,'request\x20sent');logger['debug'](_0x8b11('0xb'),_0x3a285c,_0x8b11('0xc'),JSON[_0x8b11('0xd')](_0x1bc55f));if(_0x1bc55f[_0x8b11('0xe')]){if(_0x1bc55f[_0x8b11('0xe')][_0x8b11('0xf')]===0x1f4){logger['error'](_0x8b11('0xa'),_0x3a285c,_0x1bc55f['error'][_0x8b11('0x10')]);return _0x5ca678(_0x1bc55f['error'][_0x8b11('0x10')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3a285c,_0x1bc55f[_0x8b11('0xe')][_0x8b11('0x10')]);return _0x3927f1(_0x1bc55f[_0x8b11('0xe')][_0x8b11('0x10')]);}else{logger[_0x8b11('0x9')](_0x8b11('0xa'),_0x3a285c,_0x8b11('0xc'));_0x3927f1(_0x1bc55f[_0x8b11('0x11')][_0x8b11('0x10')]);}})[_0x8b11('0x12')](function(_0x5db860){logger[_0x8b11('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x3a285c,_0x5db860);_0x5ca678(_0x5db860);});});}exports[_0x8b11('0x13')]=function(_0x1d88ea){var _0x1f3f16=this;return new Promise(function(_0x37eaf9,_0x3649c4){return db['VoiceCallReport'][_0x8b11('0x14')]({'raw':_0x1d88ea[_0x8b11('0x15')]?_0x1d88ea[_0x8b11('0x15')][_0x8b11('0x16')]===undefined?!![]:![]:!![],'where':_0x1d88ea['options']?_0x1d88ea[_0x8b11('0x15')][_0x8b11('0x17')]||null:null,'attributes':_0x1d88ea[_0x8b11('0x15')]?_0x1d88ea[_0x8b11('0x15')][_0x8b11('0x18')]||null:null,'limit':_0x1d88ea['options']?_0x1d88ea['options'][_0x8b11('0x19')]||null:null,'include':_0x1d88ea[_0x8b11('0x15')]?_0x1d88ea[_0x8b11('0x15')]['include']?_[_0x8b11('0x1a')](_0x1d88ea[_0x8b11('0x15')]['include'],function(_0x247b7c){return{'model':db[_0x247b7c[_0x8b11('0x1b')]],'as':_0x247b7c['as'],'attributes':_0x247b7c[_0x8b11('0x18')],'include':_0x247b7c['include']?_['map'](_0x247b7c[_0x8b11('0x1c')],function(_0x4de9c2){return{'model':db[_0x4de9c2[_0x8b11('0x1b')]],'as':_0x4de9c2['as'],'attributes':_0x4de9c2[_0x8b11('0x18')],'include':_0x4de9c2[_0x8b11('0x1c')]?_[_0x8b11('0x1a')](_0x4de9c2[_0x8b11('0x1c')],function(_0x31b352){return{'model':db[_0x31b352['model']],'as':_0x31b352['as'],'attributes':_0x31b352['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b11('0x8')](function(_0x29a233){logger[_0x8b11('0x9')](_0x8b11('0x13'),_0x1d88ea);logger[_0x8b11('0x1d')](_0x8b11('0x13'),_0x1d88ea,JSON['stringify'](_0x29a233));_0x37eaf9(_0x29a233);})[_0x8b11('0x12')](function(_0x330c0b){logger['error']('GetVoiceCallReport',_0x330c0b['message'],_0x1d88ea);_0x3649c4(_0x1f3f16[_0x8b11('0xe')](0x1f4,_0x330c0b[_0x8b11('0x10')]));});});};exports[_0x8b11('0x1e')]=function(_0x566291){var _0x26bba6=this;return new Promise(function(_0x1b8361,_0x41f301){return db[_0x8b11('0x1f')][_0x8b11('0x20')](_0x566291['body'],{'raw':_0x566291[_0x8b11('0x15')]?_0x566291[_0x8b11('0x15')][_0x8b11('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x58d504){logger[_0x8b11('0x9')](_0x8b11('0x1e'),_0x566291);logger[_0x8b11('0x1d')](_0x8b11('0x1e'),_0x566291,JSON[_0x8b11('0xd')](_0x58d504));_0x1b8361(_0x58d504);})['catch'](function(_0x5ea5dd){logger[_0x8b11('0xe')](_0x8b11('0x1e'),_0x5ea5dd[_0x8b11('0x10')],_0x566291);_0x41f301(_0x26bba6[_0x8b11('0xe')](0x1f4,_0x5ea5dd[_0x8b11('0x10')]));});});};exports['UpdateVoiceCallReport']=function(_0x3b880f){var _0x6cee19=this;return new Promise(function(_0x53adff,_0x295d69){return db[_0x8b11('0x1f')][_0x8b11('0x21')](_0x3b880f[_0x8b11('0x22')],{'raw':_0x3b880f[_0x8b11('0x15')]?_0x3b880f[_0x8b11('0x15')][_0x8b11('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b880f[_0x8b11('0x15')]?_0x3b880f[_0x8b11('0x15')]['where']||null:null,'attributes':_0x3b880f[_0x8b11('0x15')]?_0x3b880f['options']['attributes']||null:null,'limit':_0x3b880f[_0x8b11('0x15')]?_0x3b880f[_0x8b11('0x15')]['limit']||null:null})[_0x8b11('0x8')](function(_0x414b7e){logger[_0x8b11('0x9')](_0x8b11('0x23'),_0x3b880f);logger[_0x8b11('0x1d')]('UpdateVoiceCallReport',_0x3b880f,JSON['stringify'](_0x414b7e));_0x53adff(_0x414b7e);})[_0x8b11('0x12')](function(_0x2b1558){logger['error'](_0x8b11('0x23'),_0x2b1558[_0x8b11('0x10')],_0x3b880f);_0x295d69(_0x6cee19[_0x8b11('0xe')](0x1f4,_0x2b1558[_0x8b11('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index f7defc8..c26e99d 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 _0xb7a7=['delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','update'];(function(_0x255b7e,_0x193175){var _0x4e6aa6=function(_0x5434e5){while(--_0x5434e5){_0x255b7e['push'](_0x255b7e['shift']());}};_0x4e6aa6(++_0x193175);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x1ab00a,_0xd5cd5e){_0x1ab00a=_0x1ab00a-0x0;var _0x5bb48b=_0xb7a7[_0x1ab00a];return _0x5bb48b;};'use strict';var multer=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var path=require(_0x7b7a('0x2'));var timeout=require(_0x7b7a('0x3'));var express=require(_0x7b7a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7b7a('0x5'));var config=require(_0x7b7a('0x6'));var controller=require(_0x7b7a('0x7'));router['get']('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x9')]);router[_0x7b7a('0xa')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0xd')]('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xe')]);router['put'](_0x7b7a('0xb'),auth['isAuthenticated'](),controller[_0x7b7a('0xf')]);router[_0x7b7a('0x10')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe9a6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xd3a0a0,_0x3bdab1){var _0x18846f=function(_0x2347e8){while(--_0x2347e8){_0xd3a0a0['push'](_0xd3a0a0['shift']());}};_0x18846f(++_0x3bdab1);}(_0xe9a6,0x64));var _0x6e9a=function(_0x2a6c77,_0x2e2a06){_0x2a6c77=_0x2a6c77-0x0;var _0x18b81a=_0xe9a6[_0x2a6c77];return _0x18b81a;};'use strict';var multer=require(_0x6e9a('0x0'));var util=require('util');var path=require(_0x6e9a('0x1'));var timeout=require(_0x6e9a('0x2'));var express=require(_0x6e9a('0x3'));var router=express[_0x6e9a('0x4')]();var auth=require(_0x6e9a('0x5'));var interaction=require(_0x6e9a('0x6'));var config=require(_0x6e9a('0x7'));var controller=require(_0x6e9a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e9a('0x9')]);router[_0x6e9a('0xa')](_0x6e9a('0xb'),auth['isAuthenticated'](),controller[_0x6e9a('0xc')]);router[_0x6e9a('0xd')]('/',auth[_0x6e9a('0xe')](),controller[_0x6e9a('0xf')]);router[_0x6e9a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6e9a('0x11')]);router[_0x6e9a('0x12')](_0x6e9a('0xb'),auth[_0x6e9a('0xe')](),controller[_0x6e9a('0x13')]);module[_0x6e9a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1427449..41f531a 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 _0xddcd=['name','setDataValue','getDataValue','options','split','BOOLEAN','exports','STRING'];(function(_0x17b5a1,_0x461863){var _0x19813d=function(_0x110509){while(--_0x110509){_0x17b5a1['push'](_0x17b5a1['shift']());}};_0x19813d(++_0x461863);}(_0xddcd,0x1be));var _0xdddc=function(_0x231291,_0x391a3d){_0x231291=_0x231291-0x0;var _0x32dbdd=_0xddcd[_0x231291];return _0x32dbdd;};'use strict';var Sequelize=require('sequelize');module[_0xdddc('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xdddc('0x1')],'unique':_0xdddc('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xdddc('0x1')],'set':function(_0x5e3a80){this[_0xdddc('0x3')]('options',_0x5e3a80?_0x5e3a80['join'](''):[]);},'get':function(){return this[_0xdddc('0x4')](_0xdddc('0x5'))?this[_0xdddc('0x4')](_0xdddc('0x5'))[_0xdddc('0x6')](''):[];}},'auth':{'type':Sequelize[_0xdddc('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xdddc('0x1')]},'record':{'type':Sequelize[_0xdddc('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdddc('0x1')]},'description':{'type':Sequelize[_0xdddc('0x1')]}}; \ No newline at end of file +var _0xcc19=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0xcc19,0x1ab));var _0x9cc1=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xcc19[_0x378b4];return _0x11d07b;};'use strict';var Sequelize=require(_0x9cc1('0x0'));module[_0x9cc1('0x1')]={'name':{'type':Sequelize[_0x9cc1('0x2')]},'prefix':{'type':Sequelize[_0x9cc1('0x2')],'unique':_0x9cc1('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x245488){this[_0x9cc1('0x4')]('options',_0x245488?_0x245488['join'](''):[]);},'get':function(){return this[_0x9cc1('0x5')]('options')?this[_0x9cc1('0x5')](_0x9cc1('0x6'))[_0x9cc1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x9cc1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x9cc1('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9cc1('0x2')]},'description':{'type':Sequelize[_0x9cc1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d9037f5..fcc0a52 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 _0x0667=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','index','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','filter','where','merge','map','type','VIRTUAL','options','include','VoiceChanSpy','rows','catch','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','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','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x1f8ff5,_0x523c89){var _0x3c7cec=function(_0x18d1ec){while(--_0x18d1ec){_0x1f8ff5['push'](_0x1f8ff5['shift']());}};_0x3c7cec(++_0x523c89);}(_0x0667,0x183));var _0x7066=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0667[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0x7066('0x0'));var emlformat=require(_0x7066('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7066('0x2'));var jsonpatch=require(_0x7066('0x3'));var rp=require(_0x7066('0x4'));var moment=require(_0x7066('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7066('0x6'));var util=require('util');var path=require(_0x7066('0x7'));var sox=require(_0x7066('0x8'));var csv=require(_0x7066('0x9'));var ejs=require(_0x7066('0xa'));var fs=require('fs');var _=require(_0x7066('0xb'));var squel=require(_0x7066('0xc'));var crypto=require(_0x7066('0xd'));var jsforce=require(_0x7066('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7066('0x9'));var querystring=require(_0x7066('0xf'));var Papa=require(_0x7066('0x10'));var Redis=require(_0x7066('0x11'));var authService=require(_0x7066('0x12'));var qs=require(_0x7066('0x13'));var as=require(_0x7066('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7066('0x15'))(_0x7066('0x16'));var utils=require(_0x7066('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7066('0x18'));var db=require(_0x7066('0x19'))['db'];function respondWithStatusCode(_0x51761d,_0x1af224){_0x1af224=_0x1af224||0xcc;return function(_0x85ae1f){if(_0x85ae1f){return _0x51761d[_0x7066('0x1a')](_0x1af224);}return _0x51761d[_0x7066('0x1b')](_0x1af224)[_0x7066('0x1c')]();};}function respondWithResult(_0x1cfc9e,_0x467bad){_0x467bad=_0x467bad||0xc8;return function(_0xb05d3a){if(_0xb05d3a){return _0x1cfc9e[_0x7066('0x1b')](_0x467bad)[_0x7066('0x1d')](_0xb05d3a);}};}function respondWithFilteredResult(_0x1d2f59,_0x49e75a){return function(_0x74ab25){if(_0x74ab25){var _0x516e2e=_0x74ab25[_0x7066('0x1e')],_0x11ed32=_0x49e75a[_0x7066('0x1f')],_0x251fab=_0x49e75a[_0x7066('0x1f')]+_0x49e75a['limit'],_0x1b87ce;if(_0x251fab>=_0x516e2e){_0x251fab=_0x516e2e;_0x1b87ce=0xc8;}else{_0x1b87ce=0xce;}_0x1d2f59[_0x7066('0x1b')](_0x1b87ce);return _0x1d2f59[_0x7066('0x20')](_0x7066('0x21'),_0x11ed32+'-'+_0x251fab+'/'+_0x516e2e)[_0x7066('0x1d')](_0x74ab25);}return null;};}function patchUpdates(_0x211ca8){return function(_0xe2b889){try{jsonpatch[_0x7066('0x22')](_0xe2b889,_0x211ca8,!![]);}catch(_0x5ede0d){return BPromise[_0x7066('0x23')](_0x5ede0d);}return _0xe2b889[_0x7066('0x24')]();};}function saveUpdates(_0x18a90b,_0x30150a){return function(_0x3d7718){if(_0x3d7718){return _0x3d7718[_0x7066('0x25')](_0x18a90b)['then'](function(_0xfdaca3){return _0xfdaca3;});}return null;};}function removeEntity(_0x25324a,_0x5ef6be){return function(_0x58572f){if(_0x58572f){return _0x58572f['destroy']()[_0x7066('0x26')](function(){var _0x155f83=_0x58572f[_0x7066('0x27')]({'plain':!![]});var _0x22ae3f=_0x7066('0x28');return db[_0x7066('0x29')]['destroy']({'where':{'type':_0x22ae3f,'resourceId':_0x155f83['id']}})[_0x7066('0x26')](function(){return _0x58572f;});})[_0x7066('0x26')](function(){_0x25324a['status'](0xcc)[_0x7066('0x1c')]();});}};}function handleEntityNotFound(_0x180410,_0x5151cd){return function(_0x174c60){if(!_0x174c60){_0x180410[_0x7066('0x1a')](0x194);}return _0x174c60;};}function handleError(_0x22e4e0,_0x24fe02){_0x24fe02=_0x24fe02||0x1f4;return function(_0x161ff7){logger[_0x7066('0x2a')](_0x161ff7[_0x7066('0x2b')]);if(_0x161ff7[_0x7066('0x2c')]){delete _0x161ff7[_0x7066('0x2c')];}_0x22e4e0['status'](_0x24fe02)['send'](_0x161ff7);};}exports[_0x7066('0x2d')]=function(_0xe55b5e,_0x2edfeb){var _0x3b1497={},_0x530e50={},_0x4fc32b={'count':0x0,'rows':[]};var _0x3f4441=_['map'](db['VoiceChanSpy'][_0x7066('0x2e')],function(_0x35b1e9){return{'name':_0x35b1e9['fieldName'],'type':_0x35b1e9['type'][_0x7066('0x2f')]};});_0x530e50[_0x7066('0x30')]=_['map'](_0x3f4441,_0x7066('0x2c'));_0x530e50[_0x7066('0x31')]=_[_0x7066('0x32')](_0xe55b5e[_0x7066('0x31')]);_0x530e50[_0x7066('0x33')]=_[_0x7066('0x34')](_0x530e50[_0x7066('0x30')],_0x530e50['query']);_0x3b1497['attributes']=_[_0x7066('0x34')](_0x530e50['model'],qs[_0x7066('0x35')](_0xe55b5e[_0x7066('0x31')][_0x7066('0x35')]));_0x3b1497['attributes']=_0x3b1497[_0x7066('0x36')]['length']?_0x3b1497[_0x7066('0x36')]:_0x530e50['model'];if(!_0xe55b5e['query']['hasOwnProperty'](_0x7066('0x37'))){_0x3b1497[_0x7066('0x38')]=qs[_0x7066('0x38')](_0xe55b5e['query']['limit']);_0x3b1497[_0x7066('0x1f')]=qs[_0x7066('0x1f')](_0xe55b5e[_0x7066('0x31')]['offset']);}_0x3b1497[_0x7066('0x39')]=qs[_0x7066('0x3a')](_0xe55b5e[_0x7066('0x31')][_0x7066('0x3a')]);_0x3b1497['where']=qs[_0x7066('0x33')](_['pick'](_0xe55b5e[_0x7066('0x31')],_0x530e50[_0x7066('0x33')]),_0x3f4441);if(_0xe55b5e['query'][_0x7066('0x3b')]){_0x3b1497[_0x7066('0x3c')]=_[_0x7066('0x3d')](_0x3b1497['where'],{'$or':_[_0x7066('0x3e')](_0x3f4441,function(_0x199238){if(_0x199238[_0x7066('0x3f')]!==_0x7066('0x40')){var _0x339bb5={};_0x339bb5[_0x199238[_0x7066('0x2c')]]={'$like':'%'+_0xe55b5e['query'][_0x7066('0x3b')]+'%'};return _0x339bb5;}})});}_0x3b1497=_[_0x7066('0x3d')]({},_0x3b1497,_0xe55b5e[_0x7066('0x41')]);var _0x4f70fa={'where':_0x3b1497[_0x7066('0x3c')]};return db['VoiceChanSpy'][_0x7066('0x1e')](_0x4f70fa)[_0x7066('0x26')](function(_0x5bb072){_0x4fc32b['count']=_0x5bb072;if(_0xe55b5e[_0x7066('0x31')]['includeAll']){_0x3b1497[_0x7066('0x42')]=[{'all':!![]}];}return db[_0x7066('0x43')]['findAll'](_0x3b1497);})[_0x7066('0x26')](function(_0x449a16){_0x4fc32b[_0x7066('0x44')]=_0x449a16;return _0x4fc32b;})[_0x7066('0x26')](respondWithFilteredResult(_0x2edfeb,_0x3b1497))[_0x7066('0x45')](handleError(_0x2edfeb,null));};exports['show']=function(_0x386738,_0x3a9481){var _0x52a03c={'raw':![],'where':{'id':_0x386738['params']['id']}},_0x72304={};_0x72304[_0x7066('0x30')]=_['keys'](db[_0x7066('0x43')][_0x7066('0x2e')]);_0x72304['query']=_[_0x7066('0x32')](_0x386738['query']);_0x72304[_0x7066('0x33')]=_[_0x7066('0x34')](_0x72304['model'],_0x72304[_0x7066('0x31')]);_0x52a03c['attributes']=_['intersection'](_0x72304['model'],qs[_0x7066('0x35')](_0x386738['query'][_0x7066('0x35')]));_0x52a03c['attributes']=_0x52a03c['attributes'][_0x7066('0x46')]?_0x52a03c[_0x7066('0x36')]:_0x72304['model'];if(_0x386738[_0x7066('0x31')][_0x7066('0x47')]){_0x52a03c[_0x7066('0x42')]=[{'all':!![]}];}_0x52a03c=_['merge']({},_0x52a03c,_0x386738[_0x7066('0x41')]);return db['VoiceChanSpy'][_0x7066('0x48')](_0x52a03c)[_0x7066('0x26')](handleEntityNotFound(_0x3a9481,null))['then'](respondWithResult(_0x3a9481,null))[_0x7066('0x45')](handleError(_0x3a9481,null));};exports[_0x7066('0x49')]=function(_0x45347b,_0x534aca){return db[_0x7066('0x43')][_0x7066('0x49')](_0x45347b[_0x7066('0x4a')],{})[_0x7066('0x26')](function(_0xb877ae){var _0x24eba4=_0x45347b['user'][_0x7066('0x27')]({'plain':!![]});if(!_0x24eba4)throw new Error(_0x7066('0x4b'));if(_0x24eba4['role']===_0x7066('0x4c')){var _0x50fc06=_0xb877ae['get']({'plain':!![]});var _0x26ead2=_0x7066('0x28');return db[_0x7066('0x4d')][_0x7066('0x48')]({'where':{'name':_0x26ead2,'userProfileId':_0x24eba4[_0x7066('0x4e')]},'raw':!![]})['then'](function(_0x464e16){if(_0x464e16&&_0x464e16[_0x7066('0x4f')]===0x0){return db[_0x7066('0x29')][_0x7066('0x49')]({'name':_0x50fc06[_0x7066('0x2c')],'resourceId':_0x50fc06['id'],'type':_0x464e16[_0x7066('0x2c')],'sectionId':_0x464e16['id']},{})[_0x7066('0x26')](function(){return _0xb877ae;});}else{return _0xb877ae;}})[_0x7066('0x45')](function(_0x4c9eac){logger[_0x7066('0x2a')](_0x7066('0x50'),_0x4c9eac);throw _0x4c9eac;});}return _0xb877ae;})['then'](respondWithResult(_0x534aca,0xc9))[_0x7066('0x45')](handleError(_0x534aca,null));};exports['update']=function(_0x6a255b,_0x36c616){if(_0x6a255b[_0x7066('0x4a')]['id']){delete _0x6a255b[_0x7066('0x4a')]['id'];}return db[_0x7066('0x43')][_0x7066('0x48')]({'where':{'id':_0x6a255b[_0x7066('0x51')]['id']}})['then'](handleEntityNotFound(_0x36c616,null))[_0x7066('0x26')](saveUpdates(_0x6a255b['body'],null))['then'](respondWithResult(_0x36c616,null))['catch'](handleError(_0x36c616,null));};exports['destroy']=function(_0x245414,_0x5d99a2){return db[_0x7066('0x43')][_0x7066('0x48')]({'where':{'id':_0x245414['params']['id']}})[_0x7066('0x26')](handleEntityNotFound(_0x5d99a2,null))['then'](removeEntity(_0x5d99a2,null))[_0x7066('0x45')](handleError(_0x5d99a2,null));}; \ No newline at end of file +var _0x7463=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','stack','name','send','map','VoiceChanSpy','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies'];(function(_0x4a40ce,_0x396eba){var _0x1919f0=function(_0x443658){while(--_0x443658){_0x4a40ce['push'](_0x4a40ce['shift']());}};_0x1919f0(++_0x396eba);}(_0x7463,0x18d));var _0x3746=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x7463[_0xbc2974];return _0x3a5b4f;};'use strict';var pdf=require(_0x3746('0x0'));var emlformat=require(_0x3746('0x1'));var rimraf=require(_0x3746('0x2'));var zipdir=require(_0x3746('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3746('0x4'));var moment=require(_0x3746('0x5'));var BPromise=require(_0x3746('0x6'));var Mustache=require(_0x3746('0x7'));var util=require(_0x3746('0x8'));var path=require(_0x3746('0x9'));var sox=require(_0x3746('0xa'));var csv=require(_0x3746('0xb'));var ejs=require(_0x3746('0xc'));var fs=require('fs');var _=require(_0x3746('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3746('0xe'));var deskjs=require(_0x3746('0xf'));var toCsv=require(_0x3746('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3746('0x10'));var authService=require(_0x3746('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3746('0x12'));var hardwareService=require(_0x3746('0x13'));var logger=require(_0x3746('0x14'))(_0x3746('0x15'));var utils=require(_0x3746('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40576e,_0x4fa401){_0x4fa401=_0x4fa401||0xcc;return function(_0x5198ee){if(_0x5198ee){return _0x40576e[_0x3746('0x17')](_0x4fa401);}return _0x40576e[_0x3746('0x18')](_0x4fa401)[_0x3746('0x19')]();};}function respondWithResult(_0x30cedd,_0x4d2cc9){_0x4d2cc9=_0x4d2cc9||0xc8;return function(_0x16f6a1){if(_0x16f6a1){return _0x30cedd['status'](_0x4d2cc9)[_0x3746('0x1a')](_0x16f6a1);}};}function respondWithFilteredResult(_0x22b154,_0x5d28bd){return function(_0x46b736){if(_0x46b736){var _0xdb539c=_0x46b736[_0x3746('0x1b')],_0x404c26=_0x5d28bd[_0x3746('0x1c')],_0x59e899=_0x5d28bd[_0x3746('0x1c')]+_0x5d28bd[_0x3746('0x1d')],_0x40bdc8;if(_0x59e899>=_0xdb539c){_0x59e899=_0xdb539c;_0x40bdc8=0xc8;}else{_0x40bdc8=0xce;}_0x22b154[_0x3746('0x18')](_0x40bdc8);return _0x22b154['set'](_0x3746('0x1e'),_0x404c26+'-'+_0x59e899+'/'+_0xdb539c)[_0x3746('0x1a')](_0x46b736);}return null;};}function patchUpdates(_0x1b2914){return function(_0x1d71c4){try{jsonpatch[_0x3746('0x1f')](_0x1d71c4,_0x1b2914,!![]);}catch(_0x555f30){return BPromise['reject'](_0x555f30);}return _0x1d71c4[_0x3746('0x20')]();};}function saveUpdates(_0x4028c2,_0x36fe83){return function(_0x782524){if(_0x782524){return _0x782524[_0x3746('0x21')](_0x4028c2)[_0x3746('0x22')](function(_0x16ba6b){return _0x16ba6b;});}return null;};}function removeEntity(_0x4a800a,_0x2d536a){return function(_0x1fc895){if(_0x1fc895){return _0x1fc895[_0x3746('0x23')]()['then'](function(){var _0x4f65ca=_0x1fc895[_0x3746('0x24')]({'plain':!![]});var _0x2e2177='ChanSpies';return db['UserProfileResource'][_0x3746('0x23')]({'where':{'type':_0x2e2177,'resourceId':_0x4f65ca['id']}})[_0x3746('0x22')](function(){return _0x1fc895;});})[_0x3746('0x22')](function(){_0x4a800a['status'](0xcc)[_0x3746('0x19')]();});}};}function handleEntityNotFound(_0x5d2189,_0xb48c7f){return function(_0x19ae06){if(!_0x19ae06){_0x5d2189[_0x3746('0x17')](0x194);}return _0x19ae06;};}function handleError(_0x2d6f75,_0x183165){_0x183165=_0x183165||0x1f4;return function(_0x36fba2){logger['error'](_0x36fba2[_0x3746('0x25')]);if(_0x36fba2[_0x3746('0x26')]){delete _0x36fba2[_0x3746('0x26')];}_0x2d6f75['status'](_0x183165)[_0x3746('0x27')](_0x36fba2);};}exports['index']=function(_0x43a1f6,_0x582ace){var _0xea3ede={},_0x482093={},_0x2ac26f={'count':0x0,'rows':[]};var _0x5967a3=_[_0x3746('0x28')](db[_0x3746('0x29')][_0x3746('0x2a')],function(_0x18a5d9){return{'name':_0x18a5d9['fieldName'],'type':_0x18a5d9[_0x3746('0x2b')]['key']};});_0x482093[_0x3746('0x2c')]=_[_0x3746('0x28')](_0x5967a3,_0x3746('0x26'));_0x482093['query']=_[_0x3746('0x2d')](_0x43a1f6[_0x3746('0x2e')]);_0x482093[_0x3746('0x2f')]=_['intersection'](_0x482093[_0x3746('0x2c')],_0x482093[_0x3746('0x2e')]);_0xea3ede[_0x3746('0x30')]=_['intersection'](_0x482093['model'],qs[_0x3746('0x31')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x31')]));_0xea3ede[_0x3746('0x30')]=_0xea3ede[_0x3746('0x30')][_0x3746('0x32')]?_0xea3ede[_0x3746('0x30')]:_0x482093[_0x3746('0x2c')];if(!_0x43a1f6['query'][_0x3746('0x33')]('nolimit')){_0xea3ede[_0x3746('0x1d')]=qs[_0x3746('0x1d')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x1d')]);_0xea3ede[_0x3746('0x1c')]=qs[_0x3746('0x1c')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x1c')]);}_0xea3ede['order']=qs[_0x3746('0x34')](_0x43a1f6[_0x3746('0x2e')][_0x3746('0x34')]);_0xea3ede[_0x3746('0x35')]=qs[_0x3746('0x2f')](_['pick'](_0x43a1f6['query'],_0x482093[_0x3746('0x2f')]),_0x5967a3);if(_0x43a1f6[_0x3746('0x2e')]['filter']){_0xea3ede[_0x3746('0x35')]=_['merge'](_0xea3ede['where'],{'$or':_[_0x3746('0x28')](_0x5967a3,function(_0x5f5924){if(_0x5f5924[_0x3746('0x2b')]!==_0x3746('0x36')){var _0x30a3ef={};_0x30a3ef[_0x5f5924[_0x3746('0x26')]]={'$like':'%'+_0x43a1f6[_0x3746('0x2e')]['filter']+'%'};return _0x30a3ef;}})});}_0xea3ede=_[_0x3746('0x37')]({},_0xea3ede,_0x43a1f6[_0x3746('0x38')]);var _0x22c674={'where':_0xea3ede[_0x3746('0x35')]};return db['VoiceChanSpy'][_0x3746('0x1b')](_0x22c674)['then'](function(_0x30cfbd){_0x2ac26f['count']=_0x30cfbd;if(_0x43a1f6[_0x3746('0x2e')][_0x3746('0x39')]){_0xea3ede[_0x3746('0x3a')]=[{'all':!![]}];}return db[_0x3746('0x29')][_0x3746('0x3b')](_0xea3ede);})[_0x3746('0x22')](function(_0x47646b){_0x2ac26f[_0x3746('0x3c')]=_0x47646b;return _0x2ac26f;})['then'](respondWithFilteredResult(_0x582ace,_0xea3ede))['catch'](handleError(_0x582ace,null));};exports[_0x3746('0x3d')]=function(_0x5dcf56,_0x475fd0){var _0x11aed0={'raw':![],'where':{'id':_0x5dcf56[_0x3746('0x3e')]['id']}},_0x29b9f5={};_0x29b9f5['model']=_[_0x3746('0x2d')](db[_0x3746('0x29')]['rawAttributes']);_0x29b9f5[_0x3746('0x2e')]=_['keys'](_0x5dcf56[_0x3746('0x2e')]);_0x29b9f5[_0x3746('0x2f')]=_[_0x3746('0x3f')](_0x29b9f5['model'],_0x29b9f5[_0x3746('0x2e')]);_0x11aed0[_0x3746('0x30')]=_['intersection'](_0x29b9f5[_0x3746('0x2c')],qs['fields'](_0x5dcf56['query'][_0x3746('0x31')]));_0x11aed0[_0x3746('0x30')]=_0x11aed0[_0x3746('0x30')]['length']?_0x11aed0[_0x3746('0x30')]:_0x29b9f5[_0x3746('0x2c')];if(_0x5dcf56[_0x3746('0x2e')]['includeAll']){_0x11aed0['include']=[{'all':!![]}];}_0x11aed0=_[_0x3746('0x37')]({},_0x11aed0,_0x5dcf56[_0x3746('0x38')]);return db['VoiceChanSpy']['find'](_0x11aed0)[_0x3746('0x22')](handleEntityNotFound(_0x475fd0,null))['then'](respondWithResult(_0x475fd0,null))[_0x3746('0x40')](handleError(_0x475fd0,null));};exports['create']=function(_0x1c7a18,_0x2aa1a8){return db['VoiceChanSpy'][_0x3746('0x41')](_0x1c7a18[_0x3746('0x42')],{})[_0x3746('0x22')](function(_0x1393bf){var _0x5aa674=_0x1c7a18[_0x3746('0x43')][_0x3746('0x24')]({'plain':!![]});if(!_0x5aa674)throw new Error(_0x3746('0x44'));if(_0x5aa674[_0x3746('0x45')]===_0x3746('0x43')){var _0x527f81=_0x1393bf[_0x3746('0x24')]({'plain':!![]});var _0x440d14=_0x3746('0x46');return db[_0x3746('0x47')]['find']({'where':{'name':_0x440d14,'userProfileId':_0x5aa674[_0x3746('0x48')]},'raw':!![]})['then'](function(_0x5315a6){if(_0x5315a6&&_0x5315a6[_0x3746('0x49')]===0x0){return db[_0x3746('0x4a')]['create']({'name':_0x527f81[_0x3746('0x26')],'resourceId':_0x527f81['id'],'type':_0x5315a6[_0x3746('0x26')],'sectionId':_0x5315a6['id']},{})[_0x3746('0x22')](function(){return _0x1393bf;});}else{return _0x1393bf;}})[_0x3746('0x40')](function(_0x181de5){logger[_0x3746('0x4b')](_0x3746('0x4c'),_0x181de5);throw _0x181de5;});}return _0x1393bf;})[_0x3746('0x22')](respondWithResult(_0x2aa1a8,0xc9))[_0x3746('0x40')](handleError(_0x2aa1a8,null));};exports[_0x3746('0x21')]=function(_0x5c4ae4,_0x11051e){if(_0x5c4ae4['body']['id']){delete _0x5c4ae4['body']['id'];}return db[_0x3746('0x29')][_0x3746('0x4d')]({'where':{'id':_0x5c4ae4[_0x3746('0x3e')]['id']}})[_0x3746('0x22')](handleEntityNotFound(_0x11051e,null))[_0x3746('0x22')](saveUpdates(_0x5c4ae4[_0x3746('0x42')],null))[_0x3746('0x22')](respondWithResult(_0x11051e,null))[_0x3746('0x40')](handleError(_0x11051e,null));};exports[_0x3746('0x23')]=function(_0x4efdf6,_0x2ad310){return db[_0x3746('0x29')][_0x3746('0x4d')]({'where':{'id':_0x4efdf6[_0x3746('0x3e')]['id']}})[_0x3746('0x22')](handleEntityNotFound(_0x2ad310,null))[_0x3746('0x22')](removeEntity(_0x2ad310,null))[_0x3746('0x40')](handleError(_0x2ad310,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a816f2a..c178481 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 _0x41bb=['util','./voiceChanSpy.attributes','context','from-sip','format','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','length','concat','internal','User','agent','then','catch','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash'];(function(_0x534121,_0x18e34e){var _0x634d95=function(_0x482084){while(--_0x482084){_0x534121['push'](_0x534121['shift']());}};_0x634d95(++_0x18e34e);}(_0x41bb,0xc5));var _0xb41b=function(_0x3aab4f,_0x2fc299){_0x3aab4f=_0x3aab4f-0x0;var _0x3e360d=_0x41bb[_0x3aab4f];return _0x3e360d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var BPromise=require('bluebird');var attributes=require(_0xb41b('0x2'));var getUserApplications=function(_0x4d5578,_0x30ea75,_0x1c9d36){var _0x148333=0x1;var _0x448c8e=[];var _0x4ee21b={'context':_0x30ea75[_0xb41b('0x3')]||_0xb41b('0x4'),'exten':util[_0xb41b('0x5')]('%s%s',_0x4d5578['prefix'],_0x1c9d36),'type':'system','isApp':![],'ChanSpyId':_0x4d5578['id'],'UserId':_0x30ea75['id']};_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':'Set','appdata':util[_0xb41b('0x5')](_0xb41b('0x8'),_0xb41b('0x9')),'priority':_0x148333++},_0x4ee21b));if(_0x4d5578[_0xb41b('0xa')]){_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':_0xb41b('0xb'),'appdata':util['format'](_0xb41b('0xc'),_0x4d5578['recordingFormat']),'priority':_0x148333++},_0x4ee21b));}if(_0x4d5578[_0xb41b('0xd')]){_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':_0xb41b('0xe'),'appdata':_0x4d5578[_0xb41b('0xf')],'priority':_0x148333++},_0x4ee21b));}_0x448c8e['push'](_[_0xb41b('0x7')]({'app':_0xb41b('0x10'),'appdata':util[_0xb41b('0x5')](_0xb41b('0x11'),_0x30ea75[_0xb41b('0x12')],_0x4d5578['options']?_0x4d5578['options']['join'](''):''),'priority':_0x148333++},_0x4ee21b));if(_0x4d5578[_0xb41b('0xa')]){_0x448c8e[_0xb41b('0x6')](_[_0xb41b('0x7')]({'app':_0xb41b('0x13'),'priority':_0x148333++},_0x4ee21b));}return _0x448c8e;};var getChanSpyApplications=function(_0x29ea51,_0x54591e){var _0x2f3673=[];for(var _0xd0b6b5=0x0,_0x401dd9=0x1;_0xd0b6b5<_0x54591e[_0xb41b('0x14')];_0xd0b6b5++,_0x401dd9=0x1){_0x2f3673=_0x2f3673[_0xb41b('0x15')](getUserApplications(_0x29ea51,_0x54591e[_0xd0b6b5],_0x54591e[_0xd0b6b5][_0xb41b('0x16')]));if(_0x54591e[_0xd0b6b5][_0xb41b('0x16')]!=_0x54591e[_0xd0b6b5]['name']){_0x2f3673=_0x2f3673['concat'](getUserApplications(_0x29ea51,_0x54591e[_0xd0b6b5],_0x54591e[_0xd0b6b5]['name']));}}return _0x2f3673;};var getChanSpyPromise=function(_0xf109f8,_0x503e86){return new BPromise(function(_0x307633,_0x1de9ea){return _0xf109f8[_0xb41b('0x17')]['findAll']({'attributes':['id','name',_0xb41b('0x16')],'where':{'role':_0xb41b('0x18'),'chanspy':!![]},'raw':!![]})[_0xb41b('0x19')](function(_0x2373f4){if(_0x2373f4){return _0x307633(getChanSpyApplications(_0x503e86,_0x2373f4));}return _0x307633([]);})[_0xb41b('0x1a')](function(_0x42dccb){_0x1de9ea(_0x42dccb);});});};module['exports']=function(_0x58f149,_0x2b436f){var _0x21045f=_0x58f149[_0xb41b('0x1b')];return _0x58f149['define'](_0xb41b('0x1c'),attributes,{'tableName':_0xb41b('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x546101,_0x2a5306,_0x34f908){return getChanSpyPromise(_0x21045f,_0x546101)['then'](function(_0xed3c7e){if(_0xed3c7e&&_0xed3c7e['length']){return _0x21045f[_0xb41b('0x1e')][_0xb41b('0x1f')](_0xed3c7e);}})['then'](function(){_0x34f908();})[_0xb41b('0x1a')](function(_0x4265b8){_0x34f908(_0x4265b8);});},'afterUpdate':function(_0x583099,_0x4c2e41,_0x2a5286){return _0x21045f[_0xb41b('0x1e')][_0xb41b('0x20')]({'where':{'ChanSpyId':_0x583099['id']}})[_0xb41b('0x19')](function(){return getChanSpyPromise(_0x21045f,_0x583099);})[_0xb41b('0x19')](function(_0x181cbd){if(_0x181cbd&&_0x181cbd[_0xb41b('0x14')]){return _0x21045f['VoiceExtension'][_0xb41b('0x1f')](_0x181cbd);}})[_0xb41b('0x19')](function(){_0x2a5286();})['catch'](function(_0xe64568){_0x2a5286(_0xe64568);});},'afterDestroy':function(_0x482764,_0x38277f,_0x31d4cd){return _0x21045f['VoiceExtension'][_0xb41b('0x20')]({'where':{'ChanSpyId':_0x482764['id']}})['then'](function(){_0x31d4cd();})[_0xb41b('0x1a')](function(_0x37c142){_0x31d4cd(_0x37c142);});}}});}; \ No newline at end of file +var _0x37dc=['%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','internal','concat','User','findAll','agent','exports','models','define','VoiceChanSpy','voice_chanspy','then','length','catch','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','format'];(function(_0x38ea94,_0x7c929f){var _0x1c429e=function(_0x1e57d6){while(--_0x1e57d6){_0x38ea94['push'](_0x38ea94['shift']());}};_0x1c429e(++_0x7c929f);}(_0x37dc,0x1e9));var _0xc37d=function(_0x4c3bee,_0x556316){_0x4c3bee=_0x4c3bee-0x0;var _0x1f629f=_0x37dc[_0x4c3bee];return _0x1f629f;};'use strict';var _=require(_0xc37d('0x0'));var util=require(_0xc37d('0x1'));var BPromise=require(_0xc37d('0x2'));var attributes=require(_0xc37d('0x3'));var getUserApplications=function(_0x4cfb8b,_0x3f4a3e,_0x551d27){var _0x4240cc=0x1;var _0x52c6ae=[];var _0x5ecb1f={'context':_0x3f4a3e['context']||'from-sip','exten':util[_0xc37d('0x4')](_0xc37d('0x5'),_0x4cfb8b[_0xc37d('0x6')],_0x551d27),'type':_0xc37d('0x7'),'isApp':![],'ChanSpyId':_0x4cfb8b['id'],'UserId':_0x3f4a3e['id']};_0x52c6ae[_0xc37d('0x8')](_[_0xc37d('0x9')]({'app':_0xc37d('0xa'),'appdata':util[_0xc37d('0x4')](_0xc37d('0xb'),'chanspy'),'priority':_0x4240cc++},_0x5ecb1f));if(_0x4cfb8b[_0xc37d('0xc')]){_0x52c6ae[_0xc37d('0x8')](_['merge']({'app':_0xc37d('0xd'),'appdata':util[_0xc37d('0x4')]('${UNIQUEID}.%s,a',_0x4cfb8b[_0xc37d('0xe')]),'priority':_0x4240cc++},_0x5ecb1f));}if(_0x4cfb8b[_0xc37d('0xf')]){_0x52c6ae['push'](_[_0xc37d('0x9')]({'app':_0xc37d('0x10'),'appdata':_0x4cfb8b[_0xc37d('0x11')],'priority':_0x4240cc++},_0x5ecb1f));}_0x52c6ae[_0xc37d('0x8')](_[_0xc37d('0x9')]({'app':_0xc37d('0x12'),'appdata':util[_0xc37d('0x4')](_0xc37d('0x13'),_0x3f4a3e[_0xc37d('0x14')],_0x4cfb8b[_0xc37d('0x15')]?_0x4cfb8b[_0xc37d('0x15')][_0xc37d('0x16')](''):''),'priority':_0x4240cc++},_0x5ecb1f));if(_0x4cfb8b['record']){_0x52c6ae['push'](_[_0xc37d('0x9')]({'app':'StopMixMonitor','priority':_0x4240cc++},_0x5ecb1f));}return _0x52c6ae;};var getChanSpyApplications=function(_0x5c90e3,_0xce39b1){var _0x11615a=[];for(var _0x5b204f=0x0,_0x365126=0x1;_0x5b204f<_0xce39b1['length'];_0x5b204f++,_0x365126=0x1){_0x11615a=_0x11615a['concat'](getUserApplications(_0x5c90e3,_0xce39b1[_0x5b204f],_0xce39b1[_0x5b204f][_0xc37d('0x17')]));if(_0xce39b1[_0x5b204f][_0xc37d('0x17')]!=_0xce39b1[_0x5b204f][_0xc37d('0x14')]){_0x11615a=_0x11615a[_0xc37d('0x18')](getUserApplications(_0x5c90e3,_0xce39b1[_0x5b204f],_0xce39b1[_0x5b204f][_0xc37d('0x14')]));}}return _0x11615a;};var getChanSpyPromise=function(_0x314a6c,_0x59d7cb){return new BPromise(function(_0x5dbbb1,_0x210663){return _0x314a6c[_0xc37d('0x19')][_0xc37d('0x1a')]({'attributes':['id','name',_0xc37d('0x17')],'where':{'role':_0xc37d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3356a){if(_0x3356a){return _0x5dbbb1(getChanSpyApplications(_0x59d7cb,_0x3356a));}return _0x5dbbb1([]);})['catch'](function(_0x219840){_0x210663(_0x219840);});});};module[_0xc37d('0x1c')]=function(_0x1c1e3a,_0x2d1c55){var _0x2e6752=_0x1c1e3a[_0xc37d('0x1d')];return _0x1c1e3a[_0xc37d('0x1e')](_0xc37d('0x1f'),attributes,{'tableName':_0xc37d('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4960a4,_0x32dff8,_0x3940a5){return getChanSpyPromise(_0x2e6752,_0x4960a4)[_0xc37d('0x21')](function(_0x5c1dd7){if(_0x5c1dd7&&_0x5c1dd7[_0xc37d('0x22')]){return _0x2e6752['VoiceExtension']['bulkCreate'](_0x5c1dd7);}})[_0xc37d('0x21')](function(){_0x3940a5();})[_0xc37d('0x23')](function(_0x459f13){_0x3940a5(_0x459f13);});},'afterUpdate':function(_0x806e96,_0x2fd529,_0x59abfd){return _0x2e6752[_0xc37d('0x24')]['destroy']({'where':{'ChanSpyId':_0x806e96['id']}})[_0xc37d('0x21')](function(){return getChanSpyPromise(_0x2e6752,_0x806e96);})['then'](function(_0x1f69fb){if(_0x1f69fb&&_0x1f69fb[_0xc37d('0x22')]){return _0x2e6752[_0xc37d('0x24')][_0xc37d('0x25')](_0x1f69fb);}})[_0xc37d('0x21')](function(){_0x59abfd();})[_0xc37d('0x23')](function(_0x429b4f){_0x59abfd(_0x429b4f);});},'afterDestroy':function(_0x8a18f2,_0x5281cd,_0x146831){return _0x2e6752['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x8a18f2['id']}})[_0xc37d('0x21')](function(){_0x146831();})[_0xc37d('0x23')](function(_0x404049){_0x146831(_0x404049);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9903e90..e85c0f0 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 _0x7668=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x7390ac,_0x5653ce){var _0x32d4ed=function(_0x25e62d){while(--_0x25e62d){_0x7390ac['push'](_0x7390ac['shift']());}};_0x32d4ed(++_0x5653ce);}(_0x7668,0x1be));var _0x8766=function(_0x2a53e9,_0x5289ce){_0x2a53e9=_0x2a53e9-0x0;var _0x463d5a=_0x7668[_0x2a53e9];return _0x463d5a;};'use strict';var _=require(_0x8766('0x0'));var util=require(_0x8766('0x1'));var moment=require(_0x8766('0x2'));var BPromise=require('bluebird');var rs=require(_0x8766('0x3'));var fs=require('fs');var Redis=require(_0x8766('0x4'));var db=require(_0x8766('0x5'))['db'];var utils=require(_0x8766('0x6'));var logger=require(_0x8766('0x7'))(_0x8766('0x8'));var config=require('../../config/environment');var jayson=require(_0x8766('0x9'));var client=jayson[_0x8766('0xa')][_0x8766('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad889,_0x1093e8,_0x3f7e0a){return new BPromise(function(_0xf16586,_0x3e95ad){return client[_0x8766('0xc')](_0x5ad889,_0x3f7e0a)[_0x8766('0xd')](function(_0x4a96e9){logger[_0x8766('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1093e8,_0x8766('0xf'));logger[_0x8766('0x10')](_0x8766('0x11'),_0x1093e8,_0x8766('0xf'),JSON['stringify'](_0x4a96e9));if(_0x4a96e9[_0x8766('0x12')]){if(_0x4a96e9[_0x8766('0x12')][_0x8766('0x13')]===0x1f4){logger['error'](_0x8766('0x14'),_0x1093e8,_0x4a96e9[_0x8766('0x12')]['message']);return _0x3e95ad(_0x4a96e9['error'][_0x8766('0x15')]);}logger[_0x8766('0x12')](_0x8766('0x14'),_0x1093e8,_0x4a96e9[_0x8766('0x12')][_0x8766('0x15')]);return _0xf16586(_0x4a96e9[_0x8766('0x12')][_0x8766('0x15')]);}else{logger[_0x8766('0xe')](_0x8766('0x14'),_0x1093e8,'request\x20sent');_0xf16586(_0x4a96e9['result'][_0x8766('0x15')]);}})[_0x8766('0x16')](function(_0x21f30d){logger[_0x8766('0x12')](_0x8766('0x14'),_0x1093e8,_0x21f30d);_0x3e95ad(_0x21f30d);});});} \ No newline at end of file +var _0x041f=['message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4925de,_0x5672ba){var _0x1faf03=function(_0x5bc9ff){while(--_0x5bc9ff){_0x4925de['push'](_0x4925de['shift']());}};_0x1faf03(++_0x5672ba);}(_0x041f,0x190));var _0xf041=function(_0x22ec4c,_0x35356c){_0x22ec4c=_0x22ec4c-0x0;var _0x593ca1=_0x041f[_0x22ec4c];return _0x593ca1;};'use strict';var _=require('lodash');var util=require(_0xf041('0x0'));var moment=require(_0xf041('0x1'));var BPromise=require(_0xf041('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf041('0x3'));var db=require(_0xf041('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf041('0x5'))(_0xf041('0x6'));var config=require(_0xf041('0x7'));var jayson=require(_0xf041('0x8'));var client=jayson[_0xf041('0x9')][_0xf041('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5164a2,_0x1832e2,_0x33ace0){return new BPromise(function(_0x5844fd,_0x3b2ad1){return client[_0xf041('0xb')](_0x5164a2,_0x33ace0)['then'](function(_0x4e2b0a){logger[_0xf041('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x1832e2,_0xf041('0xd'));logger['debug'](_0xf041('0xe'),_0x1832e2,_0xf041('0xd'),JSON[_0xf041('0xf')](_0x4e2b0a));if(_0x4e2b0a['error']){if(_0x4e2b0a[_0xf041('0x10')][_0xf041('0x11')]===0x1f4){logger[_0xf041('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1832e2,_0x4e2b0a[_0xf041('0x10')]['message']);return _0x3b2ad1(_0x4e2b0a[_0xf041('0x10')][_0xf041('0x12')]);}logger['error'](_0xf041('0x13'),_0x1832e2,_0x4e2b0a[_0xf041('0x10')]['message']);return _0x5844fd(_0x4e2b0a[_0xf041('0x10')][_0xf041('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x1832e2,'request\x20sent');_0x5844fd(_0x4e2b0a[_0xf041('0x14')][_0xf041('0x12')]);}})[_0xf041('0x15')](function(_0x3776f9){logger[_0xf041('0x10')](_0xf041('0x13'),_0x1832e2,_0x3776f9);_0x3b2ad1(_0x3776f9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 6ee03eb..0ac3754 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 _0x74b4=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','put','update','delete','destroy','multer','util','path'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x74b4,0x96));var _0x474b=function(_0x1bb6ff,_0x4a424c){_0x1bb6ff=_0x1bb6ff-0x0;var _0x427af5=_0x74b4[_0x1bb6ff];return _0x427af5;};'use strict';var multer=require(_0x474b('0x0'));var util=require(_0x474b('0x1'));var path=require(_0x474b('0x2'));var timeout=require(_0x474b('0x3'));var express=require(_0x474b('0x4'));var router=express['Router']();var auth=require(_0x474b('0x5'));var interaction=require(_0x474b('0x6'));var config=require(_0x474b('0x7'));var controller=require(_0x474b('0x8'));router[_0x474b('0x9')]('/',auth[_0x474b('0xa')](),controller[_0x474b('0xb')]);router['get']('/:id',auth[_0x474b('0xa')](),controller[_0x474b('0xc')]);router['post']('/',auth[_0x474b('0xa')](),controller['create']);router[_0x474b('0xd')]('/:id',auth[_0x474b('0xa')](),controller[_0x474b('0xe')]);router[_0x474b('0xf')]('/:id',auth[_0x474b('0xa')](),controller[_0x474b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x708b=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id'];(function(_0x5285b1,_0x18ff14){var _0x1294ed=function(_0x37f1f6){while(--_0x37f1f6){_0x5285b1['push'](_0x5285b1['shift']());}};_0x1294ed(++_0x18ff14);}(_0x708b,0x77));var _0xb708=function(_0x523ce3,_0x9790e4){_0x523ce3=_0x523ce3-0x0;var _0x4dcd46=_0x708b[_0x523ce3];return _0x4dcd46;};'use strict';var multer=require(_0xb708('0x0'));var util=require(_0xb708('0x1'));var path=require(_0xb708('0x2'));var timeout=require(_0xb708('0x3'));var express=require(_0xb708('0x4'));var router=express['Router']();var auth=require(_0xb708('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb708('0x6'));var controller=require(_0xb708('0x7'));router[_0xb708('0x8')]('/',auth[_0xb708('0x9')](),controller[_0xb708('0xa')]);router[_0xb708('0x8')]('/:id',auth[_0xb708('0x9')](),controller[_0xb708('0xb')]);router[_0xb708('0xc')]('/',auth[_0xb708('0x9')](),controller[_0xb708('0xd')]);router[_0xb708('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb708('0xf')](_0xb708('0x10'),auth[_0xb708('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 00501a9..c8fb1f9 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['name','sequelize','STRING'];(function(_0x3a4d57,_0x270c2d){var _0x1175dd=function(_0x1f689a){while(--_0x1f689a){_0x3a4d57['push'](_0x3a4d57['shift']());}};_0x1175dd(++_0x270c2d);}(_0x3e74,0x175));var _0x43e7=function(_0x2b8d94,_0x2a606f){_0x2b8d94=_0x2b8d94-0x0;var _0xb7c898=_0x3e74[_0x2b8d94];return _0xb7c898;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x17d8a8,_0x255ae3){var _0x16b317=function(_0x4f4518){while(--_0x4f4518){_0x17d8a8['push'](_0x17d8a8['shift']());}};_0x16b317(++_0x255ae3);}(_0x3e74,0x175));var _0x43e7=function(_0x3ac282,_0x169de8){_0x3ac282=_0x3ac282-0x0;var _0x1af8ab=_0x3e74[_0x3ac282];return _0x1af8ab;};'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 54e9ef3..e50fe50 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 _0x3fec=['root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','params','html-pdf','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','length','find','create','body','readFileSync'];(function(_0x1bd41f,_0x1044e2){var _0x456a47=function(_0x68f5ff){while(--_0x68f5ff){_0x1bd41f['push'](_0x1bd41f['shift']());}};_0x456a47(++_0x1044e2);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc3fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3fe('0x1'));var jsonpatch=require(_0xc3fe('0x2'));var rp=require('request-promise');var moment=require(_0xc3fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc3fe('0x4'));var path=require('path');var sox=require(_0xc3fe('0x5'));var csv=require(_0xc3fe('0x6'));var ejs=require(_0xc3fe('0x7'));var fs=require('fs');var _=require(_0xc3fe('0x8'));var squel=require(_0xc3fe('0x9'));var crypto=require(_0xc3fe('0xa'));var jsforce=require(_0xc3fe('0xb'));var deskjs=require(_0xc3fe('0xc'));var toCsv=require(_0xc3fe('0x6'));var querystring=require(_0xc3fe('0xd'));var Papa=require(_0xc3fe('0xe'));var Redis=require(_0xc3fe('0xf'));var authService=require(_0xc3fe('0x10'));var qs=require(_0xc3fe('0x11'));var as=require(_0xc3fe('0x12'));var hardwareService=require(_0xc3fe('0x13'));var logger=require('../../config/logger')(_0xc3fe('0x14'));var utils=require(_0xc3fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc3fe('0x16'));var db=require(_0xc3fe('0x17'))['db'];var jayson=require(_0xc3fe('0x18'));var client=jayson[_0xc3fe('0x19')][_0xc3fe('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1b560f,_0x1ac4d7,_0x7d5e67,_0xb6a471){return new BPromise(function(_0x432539,_0x4b8088){var _0x400476=_0xb6a471||client;return _0x400476['request'](_0x1b560f,_0x7d5e67)[_0xc3fe('0x1b')](function(_0x18e5ed){logger[_0xc3fe('0x1c')](_0xc3fe('0x1d'),_0x1ac4d7,_0xc3fe('0x1e'));logger[_0xc3fe('0x1f')](_0xc3fe('0x20'),_0x1ac4d7,_0xc3fe('0x1e'),JSON[_0xc3fe('0x21')](_0x18e5ed));if(_0x18e5ed[_0xc3fe('0x22')]){if(_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x23')]===0x1f4){logger[_0xc3fe('0x22')](_0xc3fe('0x1d'),_0x1ac4d7,_0x18e5ed[_0xc3fe('0x22')]['message']);return _0x4b8088(_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x24')]);}logger[_0xc3fe('0x22')]('VoiceContext,\x20%s,\x20%s',_0x1ac4d7,_0x18e5ed[_0xc3fe('0x22')][_0xc3fe('0x24')]);return _0x432539(_0x18e5ed['error']['message']);}else{logger[_0xc3fe('0x1c')](_0xc3fe('0x1d'),_0x1ac4d7,_0xc3fe('0x1e'));_0x432539(_0x18e5ed['result'][_0xc3fe('0x24')]);}})[_0xc3fe('0x25')](function(_0x3f9418){logger[_0xc3fe('0x22')](_0xc3fe('0x1d'),_0x1ac4d7,_0x3f9418);_0x4b8088(_0x3f9418);});});}function respondWithStatusCode(_0x474195,_0x1dcfec){_0x1dcfec=_0x1dcfec||0xcc;return function(_0x6b57a6){if(_0x6b57a6){return _0x474195[_0xc3fe('0x26')](_0x1dcfec);}return _0x474195[_0xc3fe('0x27')](_0x1dcfec)[_0xc3fe('0x28')]();};}function respondWithResult(_0x2999e7,_0x4da635){_0x4da635=_0x4da635||0xc8;return function(_0x3220e7){if(_0x3220e7){return _0x2999e7[_0xc3fe('0x27')](_0x4da635)[_0xc3fe('0x29')](_0x3220e7);}};}function respondWithFilteredResult(_0x3e8075,_0x416149){return function(_0x5672b9){if(_0x5672b9){var _0xcadfae=_0x5672b9[_0xc3fe('0x2a')],_0x431594=_0x416149[_0xc3fe('0x2b')],_0x2bfaa0=_0x416149[_0xc3fe('0x2b')]+_0x416149[_0xc3fe('0x2c')],_0x1593b0;if(_0x2bfaa0>=_0xcadfae){_0x2bfaa0=_0xcadfae;_0x1593b0=0xc8;}else{_0x1593b0=0xce;}_0x3e8075[_0xc3fe('0x27')](_0x1593b0);return _0x3e8075[_0xc3fe('0x2d')](_0xc3fe('0x2e'),_0x431594+'-'+_0x2bfaa0+'/'+_0xcadfae)[_0xc3fe('0x29')](_0x5672b9);}return null;};}function patchUpdates(_0x18dbc0){return function(_0x499b99){try{jsonpatch[_0xc3fe('0x2f')](_0x499b99,_0x18dbc0,!![]);}catch(_0x1339e7){return BPromise[_0xc3fe('0x30')](_0x1339e7);}return _0x499b99[_0xc3fe('0x31')]();};}function saveUpdates(_0x5ac845,_0x1e8a38){return function(_0x19d353){if(_0x19d353){return _0x19d353[_0xc3fe('0x32')](_0x5ac845)[_0xc3fe('0x1b')](function(_0x11a44e){return _0x11a44e;});}return null;};}function removeEntity(_0x293999,_0x3f4573){return function(_0x28fc3b){if(_0x28fc3b){return _0x28fc3b[_0xc3fe('0x33')]()[_0xc3fe('0x1b')](function(){var _0x7b42b9=_0x28fc3b['get']({'plain':!![]});var _0x5b6151='Contexts';return db[_0xc3fe('0x34')][_0xc3fe('0x33')]({'where':{'type':_0x5b6151,'resourceId':_0x7b42b9['id']}})['then'](function(){return _0x28fc3b;});})[_0xc3fe('0x1b')](function(){_0x293999[_0xc3fe('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b76ae,_0x38c948){return function(_0x237680){if(!_0x237680){_0x5b76ae[_0xc3fe('0x26')](0x194);}return _0x237680;};}function handleError(_0x2aa7b8,_0x5716b0){_0x5716b0=_0x5716b0||0x1f4;return function(_0x53dca7){logger[_0xc3fe('0x22')](_0x53dca7[_0xc3fe('0x35')]);if(_0x53dca7[_0xc3fe('0x36')]){delete _0x53dca7[_0xc3fe('0x36')];}_0x2aa7b8['status'](_0x5716b0)[_0xc3fe('0x37')](_0x53dca7);};}exports['index']=function(_0x1b0090,_0x4e694d){var _0x7fc7fb={},_0x201d72={},_0x51776c={'count':0x0,'rows':[]};var _0x40fdfc=_[_0xc3fe('0x38')](db['VoiceContext'][_0xc3fe('0x39')],function(_0x5bdc6d){return{'name':_0x5bdc6d[_0xc3fe('0x3a')],'type':_0x5bdc6d[_0xc3fe('0x3b')][_0xc3fe('0x3c')]};});_0x201d72[_0xc3fe('0x3d')]=_[_0xc3fe('0x38')](_0x40fdfc,'name');_0x201d72[_0xc3fe('0x3e')]=_[_0xc3fe('0x3f')](_0x1b0090[_0xc3fe('0x3e')]);_0x201d72[_0xc3fe('0x40')]=_[_0xc3fe('0x41')](_0x201d72[_0xc3fe('0x3d')],_0x201d72[_0xc3fe('0x3e')]);_0x7fc7fb['attributes']=_[_0xc3fe('0x41')](_0x201d72[_0xc3fe('0x3d')],qs[_0xc3fe('0x42')](_0x1b0090[_0xc3fe('0x3e')][_0xc3fe('0x42')]));_0x7fc7fb[_0xc3fe('0x43')]=_0x7fc7fb[_0xc3fe('0x43')]['length']?_0x7fc7fb['attributes']:_0x201d72[_0xc3fe('0x3d')];if(!_0x1b0090['query']['hasOwnProperty'](_0xc3fe('0x44'))){_0x7fc7fb[_0xc3fe('0x2c')]=qs[_0xc3fe('0x2c')](_0x1b0090[_0xc3fe('0x3e')]['limit']);_0x7fc7fb[_0xc3fe('0x2b')]=qs[_0xc3fe('0x2b')](_0x1b0090[_0xc3fe('0x3e')]['offset']);}_0x7fc7fb[_0xc3fe('0x45')]=qs[_0xc3fe('0x46')](_0x1b0090[_0xc3fe('0x3e')]['sort']);_0x7fc7fb['where']=qs['filters'](_[_0xc3fe('0x47')](_0x1b0090[_0xc3fe('0x3e')],_0x201d72[_0xc3fe('0x40')]),_0x40fdfc);if(_0x1b0090[_0xc3fe('0x3e')][_0xc3fe('0x48')]){_0x7fc7fb[_0xc3fe('0x49')]=_[_0xc3fe('0x4a')](_0x7fc7fb['where'],{'$or':_[_0xc3fe('0x38')](_0x40fdfc,function(_0x3b9569){if(_0x3b9569[_0xc3fe('0x3b')]!==_0xc3fe('0x4b')){var _0x367140={};_0x367140[_0x3b9569[_0xc3fe('0x36')]]={'$like':'%'+_0x1b0090['query'][_0xc3fe('0x48')]+'%'};return _0x367140;}})});}_0x7fc7fb=_[_0xc3fe('0x4a')]({},_0x7fc7fb,_0x1b0090[_0xc3fe('0x4c')]);var _0x3ab38c={'where':_0x7fc7fb[_0xc3fe('0x49')]};return db[_0xc3fe('0x4d')][_0xc3fe('0x2a')](_0x3ab38c)[_0xc3fe('0x1b')](function(_0x4328b0){_0x51776c[_0xc3fe('0x2a')]=_0x4328b0;if(_0x1b0090['query'][_0xc3fe('0x4e')]){_0x7fc7fb[_0xc3fe('0x4f')]=[{'all':!![]}];}return db[_0xc3fe('0x4d')][_0xc3fe('0x50')](_0x7fc7fb);})[_0xc3fe('0x1b')](function(_0xb8edd7){_0x51776c[_0xc3fe('0x51')]=_0xb8edd7;return _0x51776c;})[_0xc3fe('0x1b')](respondWithFilteredResult(_0x4e694d,_0x7fc7fb))[_0xc3fe('0x25')](handleError(_0x4e694d,null));};exports[_0xc3fe('0x52')]=function(_0x24c37c,_0x378c16){var _0xccbee9={'raw':![],'where':{'id':_0x24c37c['params']['id']}},_0x91221e={};_0x91221e[_0xc3fe('0x3d')]=_[_0xc3fe('0x3f')](db[_0xc3fe('0x4d')]['rawAttributes']);_0x91221e[_0xc3fe('0x3e')]=_[_0xc3fe('0x3f')](_0x24c37c[_0xc3fe('0x3e')]);_0x91221e[_0xc3fe('0x40')]=_[_0xc3fe('0x41')](_0x91221e['model'],_0x91221e['query']);_0xccbee9[_0xc3fe('0x43')]=_[_0xc3fe('0x41')](_0x91221e['model'],qs[_0xc3fe('0x42')](_0x24c37c[_0xc3fe('0x3e')]['fields']));_0xccbee9[_0xc3fe('0x43')]=_0xccbee9[_0xc3fe('0x43')][_0xc3fe('0x53')]?_0xccbee9[_0xc3fe('0x43')]:_0x91221e['model'];if(_0x24c37c['query'][_0xc3fe('0x4e')]){_0xccbee9[_0xc3fe('0x4f')]=[{'all':!![]}];}_0xccbee9=_[_0xc3fe('0x4a')]({},_0xccbee9,_0x24c37c['options']);return db[_0xc3fe('0x4d')][_0xc3fe('0x54')](_0xccbee9)[_0xc3fe('0x1b')](handleEntityNotFound(_0x378c16,null))['then'](respondWithResult(_0x378c16,null))[_0xc3fe('0x25')](handleError(_0x378c16,null));};exports[_0xc3fe('0x55')]=function(_0x5caf49,_0x228482,_0x39beab){var _0x89a042;return db[_0xc3fe('0x4d')][_0xc3fe('0x55')](_0x5caf49[_0xc3fe('0x56')],{'raw':!![]})[_0xc3fe('0x1b')](function(_0x2f3568){_0x89a042=_0x2f3568;return db[_0xc3fe('0x4d')]['findAll']({'raw':!![]});})[_0xc3fe('0x1b')](function(_0x5d1b6d){var _0x3d6045=fs[_0xc3fe('0x57')](path['join'](config[_0xc3fe('0x58')],_0xc3fe('0x59')),_0xc3fe('0x5a'));var _0x527027=ejs[_0xc3fe('0x5b')](_0x3d6045,{'contexts':_0x5d1b6d||[]});fs[_0xc3fe('0x5c')](_0xc3fe('0x5d'),_0x527027);})['then'](function(){return respondWithRpcPromise(_0xc3fe('0x5e'),_0xc3fe('0x55'),{'module':_0xc3fe('0x5f')});})[_0xc3fe('0x1b')](function(){var _0x17fc18=_0x5caf49[_0xc3fe('0x60')][_0xc3fe('0x61')]({'plain':!![]});if(!_0x17fc18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17fc18[_0xc3fe('0x62')]===_0xc3fe('0x60')){var _0x1ab9c8=_0x89a042[_0xc3fe('0x61')]({'plain':!![]});return db[_0xc3fe('0x63')][_0xc3fe('0x54')]({'where':{'name':_0xc3fe('0x64'),'userProfileId':_0x17fc18[_0xc3fe('0x65')]},'raw':!![]})[_0xc3fe('0x1b')](function(_0x3a64c6){if(_0x3a64c6&&_0x3a64c6[_0xc3fe('0x66')]===0x0){return db['UserProfileResource'][_0xc3fe('0x55')]({'name':_0x1ab9c8[_0xc3fe('0x36')],'resourceId':_0x1ab9c8['id'],'type':_0x3a64c6['name'],'sectionId':_0x3a64c6['id']},{})[_0xc3fe('0x1b')](function(){return _0x89a042;});}else{return _0x89a042;}})['catch'](function(_0xf42f67){logger[_0xc3fe('0x22')](_0xc3fe('0x67'),_0xf42f67);throw _0xf42f67;});}return _0x89a042;})[_0xc3fe('0x1b')](respondWithResult(_0x228482,0xc9))[_0xc3fe('0x25')](handleError(_0x228482,null));};exports['update']=function(_0x304dcc,_0x519596,_0x12a9ce){var _0x5e6d75;return db[_0xc3fe('0x4d')][_0xc3fe('0x54')]({'where':{'id':_0x304dcc['params']['id']}})[_0xc3fe('0x1b')](handleEntityNotFound(_0x519596,null))[_0xc3fe('0x1b')](saveUpdates(_0x304dcc[_0xc3fe('0x56')],null))[_0xc3fe('0x1b')](function(_0x3b2d01){if(_0x3b2d01){_0x5e6d75=_0x3b2d01;return db[_0xc3fe('0x4d')][_0xc3fe('0x50')]({'raw':!![]});}})[_0xc3fe('0x1b')](function(_0x5beeec){var _0x77b85b=fs[_0xc3fe('0x57')](path[_0xc3fe('0x68')](config[_0xc3fe('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x85224c=ejs[_0xc3fe('0x5b')](_0x77b85b,{'contexts':_0x5beeec||[]});fs[_0xc3fe('0x5c')](_0xc3fe('0x5d'),_0x85224c);})[_0xc3fe('0x1b')](function(){return respondWithRpcPromise(_0xc3fe('0x5e'),_0xc3fe('0x32'),{'module':_0xc3fe('0x5f')});})[_0xc3fe('0x1b')](function(){return _0x5e6d75;})['then'](respondWithResult(_0x519596,null))[_0xc3fe('0x25')](handleError(_0x519596,null));};exports[_0xc3fe('0x33')]=function(_0x1d943d,_0x4fcd43,_0xae8545){var _0x1935f3;return db[_0xc3fe('0x4d')][_0xc3fe('0x54')]({'where':{'id':_0x1d943d[_0xc3fe('0x69')]['id']}})[_0xc3fe('0x1b')](handleEntityNotFound(_0x4fcd43,null))[_0xc3fe('0x1b')](removeEntity(_0x4fcd43,null))[_0xc3fe('0x1b')](function(){return db[_0xc3fe('0x4d')][_0xc3fe('0x50')]({'raw':!![]});})[_0xc3fe('0x1b')](function(_0x432e09){var _0x3844e4=fs[_0xc3fe('0x57')](path['join'](config['root'],_0xc3fe('0x59')),'utf8');var _0x402b0b=ejs[_0xc3fe('0x5b')](_0x3844e4,{'contexts':_0x432e09});fs['writeFileSync'](_0xc3fe('0x5d'),_0x402b0b);return respondWithRpcPromise('Reload',_0xc3fe('0x33'),{'module':'chan_sip.so'});})[_0xc3fe('0x25')](handleError(_0x4fcd43,null));}; \ No newline at end of file +var _0x2e31=['utf8','render','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/extensions_xcally_contexts.conf','Reload','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','index','VoiceContext','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0x2e31,0x145));var _0x12e3=function(_0x1f86c8,_0x44d603){_0x1f86c8=_0x1f86c8-0x0;var _0x248fd8=_0x2e31[_0x1f86c8];return _0x248fd8;};'use strict';var pdf=require(_0x12e3('0x0'));var emlformat=require(_0x12e3('0x1'));var rimraf=require(_0x12e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12e3('0x3'));var rp=require(_0x12e3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12e3('0x5'));var util=require(_0x12e3('0x6'));var path=require(_0x12e3('0x7'));var sox=require('sox');var csv=require(_0x12e3('0x8'));var ejs=require(_0x12e3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x12e3('0xa'));var jsforce=require(_0x12e3('0xb'));var deskjs=require(_0x12e3('0xc'));var toCsv=require(_0x12e3('0x8'));var querystring=require('querystring');var Papa=require(_0x12e3('0xd'));var Redis=require(_0x12e3('0xe'));var authService=require(_0x12e3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12e3('0x10'));var logger=require(_0x12e3('0x11'))(_0x12e3('0x12'));var utils=require(_0x12e3('0x13'));var config=require(_0x12e3('0x14'));var licenseUtil=require(_0x12e3('0x15'));var db=require(_0x12e3('0x16'))['db'];var jayson=require(_0x12e3('0x17'));var client=jayson[_0x12e3('0x18')][_0x12e3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x247631,_0x4320d3,_0x5a18bb,_0x2b5352){return new BPromise(function(_0x19de67,_0xd9f80f){var _0x5f315a=_0x2b5352||client;return _0x5f315a[_0x12e3('0x1a')](_0x247631,_0x5a18bb)[_0x12e3('0x1b')](function(_0x4a29e8){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4320d3,_0x12e3('0x1c'));logger['debug'](_0x12e3('0x1d'),_0x4320d3,_0x12e3('0x1c'),JSON[_0x12e3('0x1e')](_0x4a29e8));if(_0x4a29e8[_0x12e3('0x1f')]){if(_0x4a29e8[_0x12e3('0x1f')][_0x12e3('0x20')]===0x1f4){logger['error'](_0x12e3('0x21'),_0x4320d3,_0x4a29e8[_0x12e3('0x1f')]['message']);return _0xd9f80f(_0x4a29e8['error']['message']);}logger[_0x12e3('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x4320d3,_0x4a29e8[_0x12e3('0x1f')][_0x12e3('0x22')]);return _0x19de67(_0x4a29e8['error']['message']);}else{logger[_0x12e3('0x23')](_0x12e3('0x21'),_0x4320d3,_0x12e3('0x1c'));_0x19de67(_0x4a29e8[_0x12e3('0x24')]['message']);}})['catch'](function(_0x3e03d8){logger[_0x12e3('0x1f')](_0x12e3('0x21'),_0x4320d3,_0x3e03d8);_0xd9f80f(_0x3e03d8);});});}function respondWithStatusCode(_0x2705e8,_0x2cf78a){_0x2cf78a=_0x2cf78a||0xcc;return function(_0x553982){if(_0x553982){return _0x2705e8[_0x12e3('0x25')](_0x2cf78a);}return _0x2705e8[_0x12e3('0x26')](_0x2cf78a)[_0x12e3('0x27')]();};}function respondWithResult(_0x2218e7,_0x43a59f){_0x43a59f=_0x43a59f||0xc8;return function(_0x3361d2){if(_0x3361d2){return _0x2218e7['status'](_0x43a59f)[_0x12e3('0x28')](_0x3361d2);}};}function respondWithFilteredResult(_0x1c5344,_0x4213db){return function(_0x42765f){if(_0x42765f){var _0x4d1792=_0x42765f['count'],_0x1609ea=_0x4213db[_0x12e3('0x29')],_0x29880d=_0x4213db[_0x12e3('0x29')]+_0x4213db[_0x12e3('0x2a')],_0x2293ec;if(_0x29880d>=_0x4d1792){_0x29880d=_0x4d1792;_0x2293ec=0xc8;}else{_0x2293ec=0xce;}_0x1c5344[_0x12e3('0x26')](_0x2293ec);return _0x1c5344['set'](_0x12e3('0x2b'),_0x1609ea+'-'+_0x29880d+'/'+_0x4d1792)[_0x12e3('0x28')](_0x42765f);}return null;};}function patchUpdates(_0x40aefe){return function(_0x546f26){try{jsonpatch[_0x12e3('0x2c')](_0x546f26,_0x40aefe,!![]);}catch(_0x531923){return BPromise[_0x12e3('0x2d')](_0x531923);}return _0x546f26[_0x12e3('0x2e')]();};}function saveUpdates(_0x286676,_0x1b3b79){return function(_0x18fe12){if(_0x18fe12){return _0x18fe12[_0x12e3('0x2f')](_0x286676)['then'](function(_0x25219e){return _0x25219e;});}return null;};}function removeEntity(_0x2609c4,_0x5d731c){return function(_0xf4647c){if(_0xf4647c){return _0xf4647c[_0x12e3('0x30')]()['then'](function(){var _0x3012c9=_0xf4647c[_0x12e3('0x31')]({'plain':!![]});var _0x5afd7b=_0x12e3('0x32');return db[_0x12e3('0x33')][_0x12e3('0x30')]({'where':{'type':_0x5afd7b,'resourceId':_0x3012c9['id']}})['then'](function(){return _0xf4647c;});})[_0x12e3('0x1b')](function(){_0x2609c4[_0x12e3('0x26')](0xcc)[_0x12e3('0x27')]();});}};}function handleEntityNotFound(_0xc4a3d1,_0x1cd7e9){return function(_0x418952){if(!_0x418952){_0xc4a3d1[_0x12e3('0x25')](0x194);}return _0x418952;};}function handleError(_0x3a7a8b,_0x31c6e2){_0x31c6e2=_0x31c6e2||0x1f4;return function(_0x273d2f){logger[_0x12e3('0x1f')](_0x273d2f[_0x12e3('0x34')]);if(_0x273d2f[_0x12e3('0x35')]){delete _0x273d2f['name'];}_0x3a7a8b[_0x12e3('0x26')](_0x31c6e2)['send'](_0x273d2f);};}exports[_0x12e3('0x36')]=function(_0x56fde2,_0x14f0d1){var _0x1a29b1={},_0x584cc5={},_0x61a053={'count':0x0,'rows':[]};var _0x31910f=_['map'](db[_0x12e3('0x37')][_0x12e3('0x38')],function(_0x1f1ed3){return{'name':_0x1f1ed3['fieldName'],'type':_0x1f1ed3[_0x12e3('0x39')][_0x12e3('0x3a')]};});_0x584cc5[_0x12e3('0x3b')]=_['map'](_0x31910f,_0x12e3('0x35'));_0x584cc5['query']=_['keys'](_0x56fde2[_0x12e3('0x3c')]);_0x584cc5[_0x12e3('0x3d')]=_[_0x12e3('0x3e')](_0x584cc5['model'],_0x584cc5['query']);_0x1a29b1[_0x12e3('0x3f')]=_['intersection'](_0x584cc5[_0x12e3('0x3b')],qs['fields'](_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x40')]));_0x1a29b1[_0x12e3('0x3f')]=_0x1a29b1['attributes'][_0x12e3('0x41')]?_0x1a29b1[_0x12e3('0x3f')]:_0x584cc5[_0x12e3('0x3b')];if(!_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x42')](_0x12e3('0x43'))){_0x1a29b1['limit']=qs[_0x12e3('0x2a')](_0x56fde2[_0x12e3('0x3c')]['limit']);_0x1a29b1[_0x12e3('0x29')]=qs[_0x12e3('0x29')](_0x56fde2['query'][_0x12e3('0x29')]);}_0x1a29b1[_0x12e3('0x44')]=qs[_0x12e3('0x45')](_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x45')]);_0x1a29b1[_0x12e3('0x46')]=qs[_0x12e3('0x3d')](_['pick'](_0x56fde2[_0x12e3('0x3c')],_0x584cc5[_0x12e3('0x3d')]),_0x31910f);if(_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x47')]){_0x1a29b1[_0x12e3('0x46')]=_[_0x12e3('0x48')](_0x1a29b1[_0x12e3('0x46')],{'$or':_[_0x12e3('0x49')](_0x31910f,function(_0x5539f7){if(_0x5539f7['type']!==_0x12e3('0x4a')){var _0x2db2d1={};_0x2db2d1[_0x5539f7['name']]={'$like':'%'+_0x56fde2[_0x12e3('0x3c')]['filter']+'%'};return _0x2db2d1;}})});}_0x1a29b1=_[_0x12e3('0x48')]({},_0x1a29b1,_0x56fde2[_0x12e3('0x4b')]);var _0x2b75aa={'where':_0x1a29b1[_0x12e3('0x46')]};return db[_0x12e3('0x37')][_0x12e3('0x4c')](_0x2b75aa)['then'](function(_0x4f9a5e){_0x61a053['count']=_0x4f9a5e;if(_0x56fde2[_0x12e3('0x3c')][_0x12e3('0x4d')]){_0x1a29b1['include']=[{'all':!![]}];}return db['VoiceContext'][_0x12e3('0x4e')](_0x1a29b1);})['then'](function(_0x117af4){_0x61a053[_0x12e3('0x4f')]=_0x117af4;return _0x61a053;})[_0x12e3('0x1b')](respondWithFilteredResult(_0x14f0d1,_0x1a29b1))[_0x12e3('0x50')](handleError(_0x14f0d1,null));};exports[_0x12e3('0x51')]=function(_0x1b129a,_0x20fb60){var _0x5541db={'raw':![],'where':{'id':_0x1b129a[_0x12e3('0x52')]['id']}},_0x193ef7={};_0x193ef7['model']=_['keys'](db[_0x12e3('0x37')][_0x12e3('0x38')]);_0x193ef7[_0x12e3('0x3c')]=_['keys'](_0x1b129a[_0x12e3('0x3c')]);_0x193ef7[_0x12e3('0x3d')]=_[_0x12e3('0x3e')](_0x193ef7['model'],_0x193ef7[_0x12e3('0x3c')]);_0x5541db[_0x12e3('0x3f')]=_[_0x12e3('0x3e')](_0x193ef7['model'],qs[_0x12e3('0x40')](_0x1b129a[_0x12e3('0x3c')][_0x12e3('0x40')]));_0x5541db[_0x12e3('0x3f')]=_0x5541db[_0x12e3('0x3f')][_0x12e3('0x41')]?_0x5541db[_0x12e3('0x3f')]:_0x193ef7[_0x12e3('0x3b')];if(_0x1b129a[_0x12e3('0x3c')][_0x12e3('0x4d')]){_0x5541db[_0x12e3('0x53')]=[{'all':!![]}];}_0x5541db=_[_0x12e3('0x48')]({},_0x5541db,_0x1b129a[_0x12e3('0x4b')]);return db[_0x12e3('0x37')][_0x12e3('0x54')](_0x5541db)['then'](handleEntityNotFound(_0x20fb60,null))['then'](respondWithResult(_0x20fb60,null))[_0x12e3('0x50')](handleError(_0x20fb60,null));};exports[_0x12e3('0x55')]=function(_0x37d793,_0x125013,_0x18bda5){var _0x3c17ec;return db[_0x12e3('0x37')]['create'](_0x37d793[_0x12e3('0x56')],{'raw':!![]})[_0x12e3('0x1b')](function(_0x5e0a3d){_0x3c17ec=_0x5e0a3d;return db[_0x12e3('0x37')][_0x12e3('0x4e')]({'raw':!![]});})['then'](function(_0x4f0e64){var _0x23ceb2=fs[_0x12e3('0x57')](path[_0x12e3('0x58')](config[_0x12e3('0x59')],_0x12e3('0x5a')),_0x12e3('0x5b'));var _0x39955f=ejs[_0x12e3('0x5c')](_0x23ceb2,{'contexts':_0x4f0e64||[]});fs[_0x12e3('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x39955f);})[_0x12e3('0x1b')](function(){return respondWithRpcPromise('Reload',_0x12e3('0x55'),{'module':_0x12e3('0x5e')});})[_0x12e3('0x1b')](function(){var _0x41d9fe=_0x37d793[_0x12e3('0x5f')][_0x12e3('0x31')]({'plain':!![]});if(!_0x41d9fe)throw new Error(_0x12e3('0x60'));if(_0x41d9fe[_0x12e3('0x61')]===_0x12e3('0x5f')){var _0x189b23=_0x3c17ec[_0x12e3('0x31')]({'plain':!![]});return db[_0x12e3('0x62')][_0x12e3('0x54')]({'where':{'name':_0x12e3('0x32'),'userProfileId':_0x41d9fe[_0x12e3('0x63')]},'raw':!![]})['then'](function(_0x2fd3ba){if(_0x2fd3ba&&_0x2fd3ba[_0x12e3('0x64')]===0x0){return db['UserProfileResource'][_0x12e3('0x55')]({'name':_0x189b23[_0x12e3('0x35')],'resourceId':_0x189b23['id'],'type':_0x2fd3ba[_0x12e3('0x35')],'sectionId':_0x2fd3ba['id']},{})['then'](function(){return _0x3c17ec;});}else{return _0x3c17ec;}})[_0x12e3('0x50')](function(_0x2414d5){logger[_0x12e3('0x1f')](_0x12e3('0x65'),_0x2414d5);throw _0x2414d5;});}return _0x3c17ec;})['then'](respondWithResult(_0x125013,0xc9))[_0x12e3('0x50')](handleError(_0x125013,null));};exports[_0x12e3('0x2f')]=function(_0x1e0a81,_0x570d5e,_0x154734){var _0x1f98b0;return db['VoiceContext'][_0x12e3('0x54')]({'where':{'id':_0x1e0a81[_0x12e3('0x52')]['id']}})[_0x12e3('0x1b')](handleEntityNotFound(_0x570d5e,null))[_0x12e3('0x1b')](saveUpdates(_0x1e0a81[_0x12e3('0x56')],null))[_0x12e3('0x1b')](function(_0xa1527c){if(_0xa1527c){_0x1f98b0=_0xa1527c;return db['VoiceContext'][_0x12e3('0x4e')]({'raw':!![]});}})[_0x12e3('0x1b')](function(_0x485098){var _0x45bb1b=fs[_0x12e3('0x57')](path[_0x12e3('0x58')](config[_0x12e3('0x59')],_0x12e3('0x5a')),'utf8');var _0x44dd0d=ejs['render'](_0x45bb1b,{'contexts':_0x485098||[]});fs['writeFileSync'](_0x12e3('0x66'),_0x44dd0d);})[_0x12e3('0x1b')](function(){return respondWithRpcPromise(_0x12e3('0x67'),_0x12e3('0x2f'),{'module':_0x12e3('0x5e')});})['then'](function(){return _0x1f98b0;})[_0x12e3('0x1b')](respondWithResult(_0x570d5e,null))[_0x12e3('0x50')](handleError(_0x570d5e,null));};exports['destroy']=function(_0x25d281,_0x1438d1,_0x2bc574){var _0xd45690;return db[_0x12e3('0x37')]['find']({'where':{'id':_0x25d281[_0x12e3('0x52')]['id']}})[_0x12e3('0x1b')](handleEntityNotFound(_0x1438d1,null))[_0x12e3('0x1b')](removeEntity(_0x1438d1,null))[_0x12e3('0x1b')](function(){return db[_0x12e3('0x37')]['findAll']({'raw':!![]});})[_0x12e3('0x1b')](function(_0xe73106){var _0x2d8d37=fs[_0x12e3('0x57')](path['join'](config[_0x12e3('0x59')],_0x12e3('0x5a')),'utf8');var _0x408987=ejs[_0x12e3('0x5c')](_0x2d8d37,{'contexts':_0xe73106});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x408987);return respondWithRpcPromise(_0x12e3('0x67'),_0x12e3('0x30'),{'module':_0x12e3('0x5e')});})[_0x12e3('0x50')](handleError(_0x1438d1,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 26a4127..5f2f720 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 _0xfef6=['exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes'];(function(_0x4227e5,_0x751f2c){var _0x2e52e7=function(_0x87a699){while(--_0x87a699){_0x4227e5['push'](_0x4227e5['shift']());}};_0x2e52e7(++_0x751f2c);}(_0xfef6,0x197));var _0x6fef=function(_0x505735,_0x7417cc){_0x505735=_0x505735-0x0;var _0x20dd8b=_0xfef6[_0x505735];return _0x20dd8b;};'use strict';var _=require(_0x6fef('0x0'));var util=require('util');var logger=require(_0x6fef('0x1'))(_0x6fef('0x2'));var moment=require(_0x6fef('0x3'));var BPromise=require(_0x6fef('0x4'));var rp=require(_0x6fef('0x5'));var fs=require('fs');var path=require(_0x6fef('0x6'));var rimraf=require('rimraf');var config=require(_0x6fef('0x7'));var attributes=require(_0x6fef('0x8'));module[_0x6fef('0x9')]=function(_0x3102b6,_0x28790a){return _0x3102b6[_0x6fef('0xa')](_0x6fef('0xb'),attributes,{'tableName':_0x6fef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb9=['util','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts'];(function(_0x37feab,_0x1e4e8b){var _0x4e81e7=function(_0x323de7){while(--_0x323de7){_0x37feab['push'](_0x37feab['shift']());}};_0x4e81e7(++_0x1e4e8b);}(_0x7fb9,0x15e));var _0x97fb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7fb9[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var util=require(_0x97fb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x97fb('0x1'));var BPromise=require(_0x97fb('0x2'));var rp=require(_0x97fb('0x3'));var fs=require('fs');var path=require(_0x97fb('0x4'));var rimraf=require('rimraf');var config=require(_0x97fb('0x5'));var attributes=require(_0x97fb('0x6'));module[_0x97fb('0x7')]=function(_0x50b63b,_0x13dd02){return _0x50b63b['define'](_0x97fb('0x8'),attributes,{'tableName':_0x97fb('0x9'),'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 680999d..22aac91 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 _0xd9a2=['jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x40e419,_0xab5803){var _0x56801b=function(_0x5e2223){while(--_0x5e2223){_0x40e419['push'](_0x40e419['shift']());}};_0x56801b(++_0xab5803);}(_0xd9a2,0x16e));var _0x2d9a=function(_0x2c739c,_0x14b7a8){_0x2c739c=_0x2c739c-0x0;var _0x2b36f4=_0xd9a2[_0x2c739c];return _0x2b36f4;};'use strict';var _=require('lodash');var util=require(_0x2d9a('0x0'));var moment=require(_0x2d9a('0x1'));var BPromise=require(_0x2d9a('0x2'));var rs=require(_0x2d9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d9a('0x4'))['db'];var utils=require(_0x2d9a('0x5'));var logger=require('../../config/logger')(_0x2d9a('0x6'));var config=require(_0x2d9a('0x7'));var jayson=require(_0x2d9a('0x8'));var client=jayson[_0x2d9a('0x9')][_0x2d9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52b024,_0x368bbe,_0x390d2c){return new BPromise(function(_0x1aedea,_0x29ad79){return client['request'](_0x52b024,_0x390d2c)[_0x2d9a('0xb')](function(_0x4dd456){logger[_0x2d9a('0xc')](_0x2d9a('0xd'),_0x368bbe,'request\x20sent');logger[_0x2d9a('0xe')](_0x2d9a('0xf'),_0x368bbe,'request\x20sent',JSON['stringify'](_0x4dd456));if(_0x4dd456['error']){if(_0x4dd456['error'][_0x2d9a('0x10')]===0x1f4){logger[_0x2d9a('0x11')](_0x2d9a('0xd'),_0x368bbe,_0x4dd456['error'][_0x2d9a('0x12')]);return _0x29ad79(_0x4dd456[_0x2d9a('0x11')][_0x2d9a('0x12')]);}logger[_0x2d9a('0x11')](_0x2d9a('0xd'),_0x368bbe,_0x4dd456['error'][_0x2d9a('0x12')]);return _0x1aedea(_0x4dd456[_0x2d9a('0x11')][_0x2d9a('0x12')]);}else{logger['info'](_0x2d9a('0xd'),_0x368bbe,_0x2d9a('0x13'));_0x1aedea(_0x4dd456[_0x2d9a('0x14')][_0x2d9a('0x12')]);}})[_0x2d9a('0x15')](function(_0x5099d3){logger[_0x2d9a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x368bbe,_0x5099d3);_0x29ad79(_0x5099d3);});});} \ No newline at end of file +var _0x0360=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4484c2,_0x38a289){var _0x510748=function(_0x3e4fd1){while(--_0x3e4fd1){_0x4484c2['push'](_0x4484c2['shift']());}};_0x510748(++_0x38a289);}(_0x0360,0x15c));var _0x0036=function(_0x376ac8,_0x4d43a0){_0x376ac8=_0x376ac8-0x0;var _0x399eae=_0x0360[_0x376ac8];return _0x399eae;};'use strict';var _=require('lodash');var util=require(_0x0036('0x0'));var moment=require(_0x0036('0x1'));var BPromise=require(_0x0036('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0036('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0036('0x4'));var logger=require('../../config/logger')(_0x0036('0x5'));var config=require(_0x0036('0x6'));var jayson=require(_0x0036('0x7'));var client=jayson[_0x0036('0x8')][_0x0036('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5981a1,_0x31f672,_0x36956b){return new BPromise(function(_0x503597,_0x28d21c){return client[_0x0036('0xa')](_0x5981a1,_0x36956b)[_0x0036('0xb')](function(_0x5a1bbb){logger[_0x0036('0xc')](_0x0036('0xd'),_0x31f672,_0x0036('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x31f672,'request\x20sent',JSON['stringify'](_0x5a1bbb));if(_0x5a1bbb[_0x0036('0xf')]){if(_0x5a1bbb[_0x0036('0xf')][_0x0036('0x10')]===0x1f4){logger[_0x0036('0xf')](_0x0036('0xd'),_0x31f672,_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);return _0x28d21c(_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);}logger['error'](_0x0036('0xd'),_0x31f672,_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);return _0x503597(_0x5a1bbb[_0x0036('0xf')][_0x0036('0x11')]);}else{logger[_0x0036('0xc')](_0x0036('0xd'),_0x31f672,_0x0036('0xe'));_0x503597(_0x5a1bbb[_0x0036('0x12')][_0x0036('0x11')]);}})[_0x0036('0x13')](function(_0x1b5544){logger[_0x0036('0xf')](_0x0036('0xd'),_0x31f672,_0x1b5544);_0x28d21c(_0x1b5544);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 097c47c..d29965b 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 _0xac20=['index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','get','isAuthenticated'];(function(_0x251489,_0x24d3cf){var _0x1b2364=function(_0x3443d6){while(--_0x3443d6){_0x251489['push'](_0x251489['shift']());}};_0x1b2364(++_0x24d3cf);}(_0xac20,0x12b));var _0x0ac2=function(_0x21d020,_0x38c02e){_0x21d020=_0x21d020-0x0;var _0x400e04=_0xac20[_0x21d020];return _0x400e04;};'use strict';var multer=require(_0x0ac2('0x0'));var util=require(_0x0ac2('0x1'));var path=require('path');var timeout=require(_0x0ac2('0x2'));var express=require(_0x0ac2('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0ac2('0x4'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x0ac2('0x5')]('/',auth[_0x0ac2('0x6')](),controller[_0x0ac2('0x7')]);router[_0x0ac2('0x5')](_0x0ac2('0x8'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0x9')]);router[_0x0ac2('0x5')](_0x0ac2('0xa'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xb')]);router[_0x0ac2('0xc')]('/',auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xd')]);router['put'](_0x0ac2('0xa'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xe')]);router['delete'](_0x0ac2('0xa'),auth[_0x0ac2('0x6')](),controller[_0x0ac2('0xf')]);module[_0x0ac2('0x10')]=router; \ No newline at end of file +var _0x71d8=['get','isAuthenticated','index','/describe','/:id','show','post','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x47ec21,_0x9ec608){var _0x4113b1=function(_0x9d7e63){while(--_0x9d7e63){_0x47ec21['push'](_0x47ec21['shift']());}};_0x4113b1(++_0x9ec608);}(_0x71d8,0x13c));var _0x871d=function(_0x2a7c45,_0x33185c){_0x2a7c45=_0x2a7c45-0x0;var _0x45c675=_0x71d8[_0x2a7c45];return _0x45c675;};'use strict';var multer=require('multer');var util=require(_0x871d('0x0'));var path=require(_0x871d('0x1'));var timeout=require('connect-timeout');var express=require(_0x871d('0x2'));var router=express[_0x871d('0x3')]();var auth=require(_0x871d('0x4'));var interaction=require(_0x871d('0x5'));var config=require(_0x871d('0x6'));var controller=require(_0x871d('0x7'));router[_0x871d('0x8')]('/',auth[_0x871d('0x9')](),controller[_0x871d('0xa')]);router[_0x871d('0x8')](_0x871d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x871d('0xc'),auth[_0x871d('0x9')](),controller[_0x871d('0xd')]);router[_0x871d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x871d('0xc'),auth[_0x871d('0x9')](),controller[_0x871d('0xf')]);router[_0x871d('0x10')](_0x871d('0xc'),auth[_0x871d('0x9')](),controller['destroy']);module[_0x871d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 50e15e0..5676995 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 _0x62f0=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x62f0,0x193));var _0x062f=function(_0x24cf7f,_0xcda231){_0x24cf7f=_0x24cf7f-0x0;var _0x4c6742=_0x62f0[_0x24cf7f];return _0x4c6742;};'use strict';var Sequelize=require(_0x062f('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x062f('0x1')]},'channel':{'type':Sequelize[_0x062f('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x062f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x062f('0x1')]},'connectedlinename':{'type':Sequelize[_0x062f('0x1')]},'language':{'type':Sequelize[_0x062f('0x1')]},'accountcode':{'type':Sequelize[_0x062f('0x1')]},'context':{'type':Sequelize[_0x062f('0x1')]},'exten':{'type':Sequelize[_0x062f('0x1')]},'priority':{'type':Sequelize[_0x062f('0x2')]},'uniqueid':{'type':Sequelize[_0x062f('0x1')]},'linkedid':{'type':Sequelize[_0x062f('0x1')]},'destchannel':{'type':Sequelize[_0x062f('0x1')]},'destchannelstate':{'type':Sequelize[_0x062f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x062f('0x1')]},'destaccountcode':{'type':Sequelize[_0x062f('0x1')]},'destcontext':{'type':Sequelize[_0x062f('0x1')]},'destexten':{'type':Sequelize[_0x062f('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x062f('0x1')]},'dialstatus':{'type':Sequelize[_0x062f('0x1')]},'starttime':{'type':Sequelize[_0x062f('0x3')]},'answertime':{'type':Sequelize[_0x062f('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x062f('0x1')],'comment':_0x062f('0x4')},'routeId':{'type':Sequelize[_0x062f('0x2')]},'duration':{'type':Sequelize[_0x062f('0x2')]},'holdtime':{'type':Sequelize[_0x062f('0x2')]},'billableseconds':{'type':Sequelize[_0x062f('0x2')]}}; \ No newline at end of file +var _0x060d=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x3fd22e,_0x3d57e5){var _0x1e1666=function(_0x25d47b){while(--_0x25d47b){_0x3fd22e['push'](_0x3fd22e['shift']());}};_0x1e1666(++_0x3d57e5);}(_0x060d,0x112));var _0xd060=function(_0x5665a8,_0xaf288d){_0x5665a8=_0x5665a8-0x0;var _0x2d5928=_0x060d[_0x5665a8];return _0x2d5928;};'use strict';var Sequelize=require(_0xd060('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd060('0x1')]},'channel':{'type':Sequelize[_0xd060('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd060('0x1')]},'calleridnum':{'type':Sequelize[_0xd060('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd060('0x1')]},'connectedlinename':{'type':Sequelize[_0xd060('0x1')]},'language':{'type':Sequelize[_0xd060('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd060('0x1')]},'exten':{'type':Sequelize[_0xd060('0x1')]},'priority':{'type':Sequelize[_0xd060('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd060('0x1')]},'destchannel':{'type':Sequelize[_0xd060('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd060('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd060('0x1')]},'destcalleridname':{'type':Sequelize[_0xd060('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd060('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd060('0x1')]},'destlanguage':{'type':Sequelize[_0xd060('0x1')]},'destaccountcode':{'type':Sequelize[_0xd060('0x1')]},'destcontext':{'type':Sequelize[_0xd060('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd060('0x2')]},'destuniqueid':{'type':Sequelize[_0xd060('0x1')]},'destlinkedid':{'type':Sequelize[_0xd060('0x1')]},'dialstring':{'type':Sequelize[_0xd060('0x1')]},'dialstatus':{'type':Sequelize[_0xd060('0x1')]},'starttime':{'type':Sequelize[_0xd060('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd060('0x3')]},'lastevent':{'type':Sequelize[_0xd060('0x1')],'comment':_0xd060('0x4')},'routeId':{'type':Sequelize[_0xd060('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd060('0x2')]},'billableseconds':{'type':Sequelize[_0xd060('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 51412b3..b1d95d7 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 _0x4aa4=['status','json','count','offset','limit','apply','save','update','destroy','then','end','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1779fe,_0x5d05c9){var _0x25756f=function(_0x5d3e71){while(--_0x5d3e71){_0x1779fe['push'](_0x1779fe['shift']());}};_0x25756f(++_0x5d05c9);}(_0x4aa4,0x70));var _0x44aa=function(_0x39faae,_0x574c35){_0x39faae=_0x39faae-0x0;var _0x357f4c=_0x4aa4[_0x39faae];return _0x357f4c;};'use strict';var pdf=require(_0x44aa('0x0'));var emlformat=require(_0x44aa('0x1'));var rimraf=require(_0x44aa('0x2'));var zipdir=require(_0x44aa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44aa('0x4'));var moment=require(_0x44aa('0x5'));var BPromise=require(_0x44aa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x44aa('0x7'));var sox=require('sox');var csv=require(_0x44aa('0x8'));var ejs=require(_0x44aa('0x9'));var fs=require('fs');var _=require(_0x44aa('0xa'));var squel=require(_0x44aa('0xb'));var crypto=require(_0x44aa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x44aa('0xd'));var toCsv=require(_0x44aa('0x8'));var querystring=require(_0x44aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x44aa('0xf'));var authService=require(_0x44aa('0x10'));var qs=require(_0x44aa('0x11'));var as=require(_0x44aa('0x12'));var hardwareService=require(_0x44aa('0x13'));var logger=require(_0x44aa('0x14'))(_0x44aa('0x15'));var utils=require('../../config/utils');var config=require(_0x44aa('0x16'));var licenseUtil=require(_0x44aa('0x17'));var db=require(_0x44aa('0x18'))['db'];function respondWithStatusCode(_0x19709a,_0x516199){_0x516199=_0x516199||0xcc;return function(_0x6a371b){if(_0x6a371b){return _0x19709a[_0x44aa('0x19')](_0x516199);}return _0x19709a[_0x44aa('0x1a')](_0x516199)['end']();};}function respondWithResult(_0x4b098e,_0x3b095e){_0x3b095e=_0x3b095e||0xc8;return function(_0x1b536f){if(_0x1b536f){return _0x4b098e[_0x44aa('0x1a')](_0x3b095e)[_0x44aa('0x1b')](_0x1b536f);}};}function respondWithFilteredResult(_0x17ca82,_0x5665e5){return function(_0x5e918b){if(_0x5e918b){var _0xd2b68=_0x5e918b[_0x44aa('0x1c')],_0x577471=_0x5665e5[_0x44aa('0x1d')],_0x2aafe0=_0x5665e5[_0x44aa('0x1d')]+_0x5665e5[_0x44aa('0x1e')],_0x23c8bd;if(_0x2aafe0>=_0xd2b68){_0x2aafe0=_0xd2b68;_0x23c8bd=0xc8;}else{_0x23c8bd=0xce;}_0x17ca82[_0x44aa('0x1a')](_0x23c8bd);return _0x17ca82['set']('Content-Range',_0x577471+'-'+_0x2aafe0+'/'+_0xd2b68)[_0x44aa('0x1b')](_0x5e918b);}return null;};}function patchUpdates(_0x284925){return function(_0x218199){try{jsonpatch[_0x44aa('0x1f')](_0x218199,_0x284925,!![]);}catch(_0x2fb86f){return BPromise['reject'](_0x2fb86f);}return _0x218199[_0x44aa('0x20')]();};}function saveUpdates(_0x386a01,_0x686f66){return function(_0x44736c){if(_0x44736c){return _0x44736c[_0x44aa('0x21')](_0x386a01)['then'](function(_0x14a0af){return _0x14a0af;});}return null;};}function removeEntity(_0x15b454,_0x41b769){return function(_0x4ab030){if(_0x4ab030){return _0x4ab030[_0x44aa('0x22')]()[_0x44aa('0x23')](function(){_0x15b454['status'](0xcc)[_0x44aa('0x24')]();});}};}function handleEntityNotFound(_0x5de47b,_0x5a25ad){return function(_0x2a1c11){if(!_0x2a1c11){_0x5de47b[_0x44aa('0x19')](0x194);}return _0x2a1c11;};}function handleError(_0x4987b4,_0x116fcc){_0x116fcc=_0x116fcc||0x1f4;return function(_0x5c24f6){logger[_0x44aa('0x25')](_0x5c24f6[_0x44aa('0x26')]);if(_0x5c24f6[_0x44aa('0x27')]){delete _0x5c24f6['name'];}_0x4987b4[_0x44aa('0x1a')](_0x116fcc)['send'](_0x5c24f6);};}exports[_0x44aa('0x28')]=function(_0x33ef7a,_0x176e34){var _0x521fa9={},_0x25db24={},_0x3ad26c={'count':0x0,'rows':[]};var _0x489ba4=_[_0x44aa('0x29')](db[_0x44aa('0x2a')][_0x44aa('0x2b')],function(_0x3ae672){return{'name':_0x3ae672[_0x44aa('0x2c')],'type':_0x3ae672[_0x44aa('0x2d')][_0x44aa('0x2e')]};});_0x25db24[_0x44aa('0x2f')]=_[_0x44aa('0x29')](_0x489ba4,'name');_0x25db24[_0x44aa('0x30')]=_[_0x44aa('0x31')](_0x33ef7a[_0x44aa('0x30')]);_0x25db24['filters']=_[_0x44aa('0x32')](_0x25db24[_0x44aa('0x2f')],_0x25db24[_0x44aa('0x30')]);_0x521fa9[_0x44aa('0x33')]=_['intersection'](_0x25db24[_0x44aa('0x2f')],qs[_0x44aa('0x34')](_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x34')]));_0x521fa9['attributes']=_0x521fa9[_0x44aa('0x33')]['length']?_0x521fa9[_0x44aa('0x33')]:_0x25db24[_0x44aa('0x2f')];if(!_0x33ef7a['query']['hasOwnProperty'](_0x44aa('0x35'))){_0x521fa9['limit']=qs['limit'](_0x33ef7a['query'][_0x44aa('0x1e')]);_0x521fa9[_0x44aa('0x1d')]=qs['offset'](_0x33ef7a[_0x44aa('0x30')]['offset']);}_0x521fa9['order']=qs[_0x44aa('0x36')](_0x33ef7a[_0x44aa('0x30')]['sort']);_0x521fa9[_0x44aa('0x37')]=qs[_0x44aa('0x38')](_[_0x44aa('0x39')](_0x33ef7a[_0x44aa('0x30')],_0x25db24[_0x44aa('0x38')]),_0x489ba4);if(_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x3a')]){_0x521fa9[_0x44aa('0x37')]=_[_0x44aa('0x3b')](_0x521fa9[_0x44aa('0x37')],{'$or':_[_0x44aa('0x29')](_0x489ba4,function(_0x21dc01){if(_0x21dc01[_0x44aa('0x2d')]!==_0x44aa('0x3c')){var _0x972aa8={};_0x972aa8[_0x21dc01[_0x44aa('0x27')]]={'$like':'%'+_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x3a')]+'%'};return _0x972aa8;}})});}_0x521fa9=_[_0x44aa('0x3b')]({},_0x521fa9,_0x33ef7a['options']);var _0x2d4dc5={'where':_0x521fa9[_0x44aa('0x37')]};return db[_0x44aa('0x2a')][_0x44aa('0x1c')](_0x2d4dc5)[_0x44aa('0x23')](function(_0x5044c8){_0x3ad26c[_0x44aa('0x1c')]=_0x5044c8;if(_0x33ef7a[_0x44aa('0x30')][_0x44aa('0x3d')]){_0x521fa9[_0x44aa('0x3e')]=[{'all':!![]}];}return db[_0x44aa('0x2a')]['findAll'](_0x521fa9);})[_0x44aa('0x23')](function(_0x3ec1d2){_0x3ad26c['rows']=_0x3ec1d2;return _0x3ad26c;})['then'](respondWithFilteredResult(_0x176e34,_0x521fa9))[_0x44aa('0x3f')](handleError(_0x176e34,null));};exports[_0x44aa('0x40')]=function(_0x2ed8d0,_0x4ef955){var _0x523658={'raw':!![],'where':{'id':_0x2ed8d0['params']['id']}},_0xe5e0a9={};_0xe5e0a9[_0x44aa('0x2f')]=_[_0x44aa('0x31')](db['VoiceDialReport'][_0x44aa('0x2b')]);_0xe5e0a9[_0x44aa('0x30')]=_[_0x44aa('0x31')](_0x2ed8d0[_0x44aa('0x30')]);_0xe5e0a9[_0x44aa('0x38')]=_['intersection'](_0xe5e0a9[_0x44aa('0x2f')],_0xe5e0a9['query']);_0x523658['attributes']=_['intersection'](_0xe5e0a9[_0x44aa('0x2f')],qs[_0x44aa('0x34')](_0x2ed8d0['query'][_0x44aa('0x34')]));_0x523658[_0x44aa('0x33')]=_0x523658['attributes']['length']?_0x523658[_0x44aa('0x33')]:_0xe5e0a9[_0x44aa('0x2f')];if(_0x2ed8d0['query']['includeAll']){_0x523658[_0x44aa('0x3e')]=[{'all':!![]}];}_0x523658=_['merge']({},_0x523658,_0x2ed8d0['options']);return db[_0x44aa('0x2a')][_0x44aa('0x41')](_0x523658)['then'](handleEntityNotFound(_0x4ef955,null))[_0x44aa('0x23')](respondWithResult(_0x4ef955,null))[_0x44aa('0x3f')](handleError(_0x4ef955,null));};exports[_0x44aa('0x42')]=function(_0x3756fa,_0x23307d){return db[_0x44aa('0x2a')][_0x44aa('0x42')](_0x3756fa['body'],{})[_0x44aa('0x23')](respondWithResult(_0x23307d,0xc9))['catch'](handleError(_0x23307d,null));};exports[_0x44aa('0x21')]=function(_0x56edc6,_0x1c41c0){if(_0x56edc6[_0x44aa('0x43')]['id']){delete _0x56edc6['body']['id'];}return db['VoiceDialReport'][_0x44aa('0x41')]({'where':{'id':_0x56edc6['params']['id']}})[_0x44aa('0x23')](handleEntityNotFound(_0x1c41c0,null))[_0x44aa('0x23')](saveUpdates(_0x56edc6['body'],null))[_0x44aa('0x23')](respondWithResult(_0x1c41c0,null))[_0x44aa('0x3f')](handleError(_0x1c41c0,null));};exports[_0x44aa('0x22')]=function(_0x4ee813,_0x2e42a1){return db['VoiceDialReport']['find']({'where':{'id':_0x4ee813['params']['id']}})[_0x44aa('0x23')](handleEntityNotFound(_0x2e42a1,null))[_0x44aa('0x23')](removeEntity(_0x2e42a1,null))['catch'](handleError(_0x2e42a1,null));};exports[_0x44aa('0x44')]=function(_0x5ee2f9,_0x12292d){return db[_0x44aa('0x2a')][_0x44aa('0x44')]()[_0x44aa('0x23')](respondWithResult(_0x12292d,null))['catch'](handleError(_0x12292d,null));}; \ No newline at end of file +var _0x5b08=['create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params'];(function(_0x3ae018,_0x10e030){var _0x5296db=function(_0x2d08f9){while(--_0x2d08f9){_0x3ae018['push'](_0x3ae018['shift']());}};_0x5296db(++_0x10e030);}(_0x5b08,0xa0));var _0x85b0=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x5b08[_0x2b0a86];return _0x955940;};'use strict';var pdf=require(_0x85b0('0x0'));var emlformat=require(_0x85b0('0x1'));var rimraf=require(_0x85b0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85b0('0x3'));var rp=require(_0x85b0('0x4'));var moment=require(_0x85b0('0x5'));var BPromise=require(_0x85b0('0x6'));var Mustache=require(_0x85b0('0x7'));var util=require(_0x85b0('0x8'));var path=require(_0x85b0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85b0('0xa'));var fs=require('fs');var _=require(_0x85b0('0xb'));var squel=require(_0x85b0('0xc'));var crypto=require(_0x85b0('0xd'));var jsforce=require(_0x85b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85b0('0xf'));var querystring=require(_0x85b0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85b0('0x11'));var as=require(_0x85b0('0x12'));var hardwareService=require(_0x85b0('0x13'));var logger=require('../../config/logger')(_0x85b0('0x14'));var utils=require(_0x85b0('0x15'));var config=require(_0x85b0('0x16'));var licenseUtil=require(_0x85b0('0x17'));var db=require(_0x85b0('0x18'))['db'];function respondWithStatusCode(_0x4e0b4c,_0x1e5e68){_0x1e5e68=_0x1e5e68||0xcc;return function(_0x539488){if(_0x539488){return _0x4e0b4c[_0x85b0('0x19')](_0x1e5e68);}return _0x4e0b4c[_0x85b0('0x1a')](_0x1e5e68)[_0x85b0('0x1b')]();};}function respondWithResult(_0x5ac264,_0x2185a8){_0x2185a8=_0x2185a8||0xc8;return function(_0xfe0f34){if(_0xfe0f34){return _0x5ac264[_0x85b0('0x1a')](_0x2185a8)[_0x85b0('0x1c')](_0xfe0f34);}};}function respondWithFilteredResult(_0x519a13,_0x1cc933){return function(_0x2df506){if(_0x2df506){var _0x5dc1c0=_0x2df506[_0x85b0('0x1d')],_0x174bb9=_0x1cc933[_0x85b0('0x1e')],_0x90e098=_0x1cc933[_0x85b0('0x1e')]+_0x1cc933['limit'],_0x544217;if(_0x90e098>=_0x5dc1c0){_0x90e098=_0x5dc1c0;_0x544217=0xc8;}else{_0x544217=0xce;}_0x519a13[_0x85b0('0x1a')](_0x544217);return _0x519a13[_0x85b0('0x1f')](_0x85b0('0x20'),_0x174bb9+'-'+_0x90e098+'/'+_0x5dc1c0)['json'](_0x2df506);}return null;};}function patchUpdates(_0x82b477){return function(_0x12ea09){try{jsonpatch[_0x85b0('0x21')](_0x12ea09,_0x82b477,!![]);}catch(_0xf1d79f){return BPromise[_0x85b0('0x22')](_0xf1d79f);}return _0x12ea09[_0x85b0('0x23')]();};}function saveUpdates(_0x2891b8,_0x4375b9){return function(_0x5b89e4){if(_0x5b89e4){return _0x5b89e4[_0x85b0('0x24')](_0x2891b8)[_0x85b0('0x25')](function(_0x3e9098){return _0x3e9098;});}return null;};}function removeEntity(_0x136794,_0x21863e){return function(_0x19a95f){if(_0x19a95f){return _0x19a95f[_0x85b0('0x26')]()[_0x85b0('0x25')](function(){_0x136794[_0x85b0('0x1a')](0xcc)[_0x85b0('0x1b')]();});}};}function handleEntityNotFound(_0x40cb95,_0x2d2f8b){return function(_0x25f292){if(!_0x25f292){_0x40cb95[_0x85b0('0x19')](0x194);}return _0x25f292;};}function handleError(_0x7c3716,_0x5d2f18){_0x5d2f18=_0x5d2f18||0x1f4;return function(_0x51812e){logger[_0x85b0('0x27')](_0x51812e[_0x85b0('0x28')]);if(_0x51812e[_0x85b0('0x29')]){delete _0x51812e[_0x85b0('0x29')];}_0x7c3716[_0x85b0('0x1a')](_0x5d2f18)[_0x85b0('0x2a')](_0x51812e);};}exports['index']=function(_0x1e569d,_0x50b4e9){var _0x8277b1={},_0x3f30a8={},_0x4b22d4={'count':0x0,'rows':[]};var _0x407b01=_[_0x85b0('0x2b')](db['VoiceDialReport'][_0x85b0('0x2c')],function(_0x32da48){return{'name':_0x32da48[_0x85b0('0x2d')],'type':_0x32da48[_0x85b0('0x2e')][_0x85b0('0x2f')]};});_0x3f30a8[_0x85b0('0x30')]=_[_0x85b0('0x2b')](_0x407b01,_0x85b0('0x29'));_0x3f30a8[_0x85b0('0x31')]=_[_0x85b0('0x32')](_0x1e569d[_0x85b0('0x31')]);_0x3f30a8[_0x85b0('0x33')]=_[_0x85b0('0x34')](_0x3f30a8[_0x85b0('0x30')],_0x3f30a8[_0x85b0('0x31')]);_0x8277b1[_0x85b0('0x35')]=_[_0x85b0('0x34')](_0x3f30a8[_0x85b0('0x30')],qs[_0x85b0('0x36')](_0x1e569d[_0x85b0('0x31')][_0x85b0('0x36')]));_0x8277b1[_0x85b0('0x35')]=_0x8277b1[_0x85b0('0x35')][_0x85b0('0x37')]?_0x8277b1[_0x85b0('0x35')]:_0x3f30a8[_0x85b0('0x30')];if(!_0x1e569d[_0x85b0('0x31')][_0x85b0('0x38')](_0x85b0('0x39'))){_0x8277b1[_0x85b0('0x3a')]=qs[_0x85b0('0x3a')](_0x1e569d[_0x85b0('0x31')][_0x85b0('0x3a')]);_0x8277b1['offset']=qs[_0x85b0('0x1e')](_0x1e569d[_0x85b0('0x31')][_0x85b0('0x1e')]);}_0x8277b1[_0x85b0('0x3b')]=qs[_0x85b0('0x3c')](_0x1e569d[_0x85b0('0x31')]['sort']);_0x8277b1[_0x85b0('0x3d')]=qs[_0x85b0('0x33')](_[_0x85b0('0x3e')](_0x1e569d[_0x85b0('0x31')],_0x3f30a8['filters']),_0x407b01);if(_0x1e569d['query'][_0x85b0('0x3f')]){_0x8277b1[_0x85b0('0x3d')]=_[_0x85b0('0x40')](_0x8277b1[_0x85b0('0x3d')],{'$or':_[_0x85b0('0x2b')](_0x407b01,function(_0x27445a){if(_0x27445a[_0x85b0('0x2e')]!==_0x85b0('0x41')){var _0x147388={};_0x147388[_0x27445a[_0x85b0('0x29')]]={'$like':'%'+_0x1e569d[_0x85b0('0x31')][_0x85b0('0x3f')]+'%'};return _0x147388;}})});}_0x8277b1=_[_0x85b0('0x40')]({},_0x8277b1,_0x1e569d[_0x85b0('0x42')]);var _0x5484a9={'where':_0x8277b1[_0x85b0('0x3d')]};return db[_0x85b0('0x43')][_0x85b0('0x1d')](_0x5484a9)[_0x85b0('0x25')](function(_0x3807ed){_0x4b22d4[_0x85b0('0x1d')]=_0x3807ed;if(_0x1e569d[_0x85b0('0x31')][_0x85b0('0x44')]){_0x8277b1['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x85b0('0x45')](_0x8277b1);})['then'](function(_0x201f89){_0x4b22d4[_0x85b0('0x46')]=_0x201f89;return _0x4b22d4;})[_0x85b0('0x25')](respondWithFilteredResult(_0x50b4e9,_0x8277b1))[_0x85b0('0x47')](handleError(_0x50b4e9,null));};exports[_0x85b0('0x48')]=function(_0x466017,_0x5d1912){var _0x17adbf={'raw':!![],'where':{'id':_0x466017[_0x85b0('0x49')]['id']}},_0x53e432={};_0x53e432['model']=_['keys'](db[_0x85b0('0x43')][_0x85b0('0x2c')]);_0x53e432[_0x85b0('0x31')]=_[_0x85b0('0x32')](_0x466017[_0x85b0('0x31')]);_0x53e432[_0x85b0('0x33')]=_['intersection'](_0x53e432[_0x85b0('0x30')],_0x53e432['query']);_0x17adbf['attributes']=_[_0x85b0('0x34')](_0x53e432['model'],qs[_0x85b0('0x36')](_0x466017[_0x85b0('0x31')][_0x85b0('0x36')]));_0x17adbf[_0x85b0('0x35')]=_0x17adbf[_0x85b0('0x35')][_0x85b0('0x37')]?_0x17adbf[_0x85b0('0x35')]:_0x53e432['model'];if(_0x466017[_0x85b0('0x31')][_0x85b0('0x44')]){_0x17adbf['include']=[{'all':!![]}];}_0x17adbf=_[_0x85b0('0x40')]({},_0x17adbf,_0x466017[_0x85b0('0x42')]);return db[_0x85b0('0x43')]['find'](_0x17adbf)['then'](handleEntityNotFound(_0x5d1912,null))['then'](respondWithResult(_0x5d1912,null))[_0x85b0('0x47')](handleError(_0x5d1912,null));};exports[_0x85b0('0x4a')]=function(_0x1c8613,_0x51d7a2){return db[_0x85b0('0x43')][_0x85b0('0x4a')](_0x1c8613[_0x85b0('0x4b')],{})['then'](respondWithResult(_0x51d7a2,0xc9))[_0x85b0('0x47')](handleError(_0x51d7a2,null));};exports[_0x85b0('0x24')]=function(_0x3a17bb,_0x578b44){if(_0x3a17bb['body']['id']){delete _0x3a17bb[_0x85b0('0x4b')]['id'];}return db[_0x85b0('0x43')]['find']({'where':{'id':_0x3a17bb[_0x85b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x578b44,null))[_0x85b0('0x25')](saveUpdates(_0x3a17bb['body'],null))[_0x85b0('0x25')](respondWithResult(_0x578b44,null))[_0x85b0('0x47')](handleError(_0x578b44,null));};exports[_0x85b0('0x26')]=function(_0x181697,_0x28ce53){return db[_0x85b0('0x43')][_0x85b0('0x4c')]({'where':{'id':_0x181697[_0x85b0('0x49')]['id']}})[_0x85b0('0x25')](handleEntityNotFound(_0x28ce53,null))['then'](removeEntity(_0x28ce53,null))[_0x85b0('0x47')](handleError(_0x28ce53,null));};exports[_0x85b0('0x4d')]=function(_0xbbc69b,_0x5610fa){return db['VoiceDialReport']['describe']()[_0x85b0('0x25')](respondWithResult(_0x5610fa,null))['catch'](handleError(_0x5610fa,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 619c4c4..c22503d 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 _0xf46c=['rimraf','../../config/environment','exports','VoiceDialReport','uniqueid','../../config/logger','api','moment','request-promise','path'];(function(_0x4a25b9,_0x3195ed){var _0x21f5fc=function(_0x38aff3){while(--_0x38aff3){_0x4a25b9['push'](_0x4a25b9['shift']());}};_0x21f5fc(++_0x3195ed);}(_0xf46c,0x11d));var _0xcf46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf46c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcf46('0x0'))(_0xcf46('0x1'));var moment=require(_0xcf46('0x2'));var BPromise=require('bluebird');var rp=require(_0xcf46('0x3'));var fs=require('fs');var path=require(_0xcf46('0x4'));var rimraf=require(_0xcf46('0x5'));var config=require(_0xcf46('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xcf46('0x7')]=function(_0x592625,_0x27ca7e){return _0x592625['define'](_0xcf46('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xcf46('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb30=['bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial','lodash','util','api'];(function(_0xd2d0e2,_0x206b4d){var _0x3fa79b=function(_0xfd6eda){while(--_0xfd6eda){_0xd2d0e2['push'](_0xd2d0e2['shift']());}};_0x3fa79b(++_0x206b4d);}(_0xcb30,0xce));var _0x0cb3=function(_0x10eca9,_0x147bf8){_0x10eca9=_0x10eca9-0x0;var _0x17d5cf=_0xcb30[_0x10eca9];return _0x17d5cf;};'use strict';var _=require(_0x0cb3('0x0'));var util=require(_0x0cb3('0x1'));var logger=require('../../config/logger')(_0x0cb3('0x2'));var moment=require('moment');var BPromise=require(_0x0cb3('0x3'));var rp=require(_0x0cb3('0x4'));var fs=require('fs');var path=require(_0x0cb3('0x5'));var rimraf=require(_0x0cb3('0x6'));var config=require(_0x0cb3('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x2cd72d,_0x28defa){return _0x2cd72d[_0x0cb3('0x8')](_0x0cb3('0x9'),attributes,{'tableName':_0x0cb3('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 55f4548..febf542 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 _0xbccb=['error','VoiceDialReport,\x20%s,\x20%s','message','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','stringify','code'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xbccb,0x1a4));var _0xbbcc=function(_0x525d35,_0xe67489){_0x525d35=_0x525d35-0x0;var _0x4813d2=_0xbccb[_0x525d35];return _0x4813d2;};'use strict';var _=require('lodash');var util=require(_0xbbcc('0x0'));var moment=require(_0xbbcc('0x1'));var BPromise=require(_0xbbcc('0x2'));var rs=require(_0xbbcc('0x3'));var fs=require('fs');var Redis=require(_0xbbcc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbcc('0x5'));var logger=require(_0xbbcc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbcc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x276621,_0x3fb981,_0x12987b){return new BPromise(function(_0x155b4e,_0x3afc8c){return client[_0xbbcc('0x8')](_0x276621,_0x12987b)[_0xbbcc('0x9')](function(_0x1f5f47){logger[_0xbbcc('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x3fb981,_0xbbcc('0xb'));logger[_0xbbcc('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3fb981,_0xbbcc('0xb'),JSON[_0xbbcc('0xd')](_0x1f5f47));if(_0x1f5f47['error']){if(_0x1f5f47['error'][_0xbbcc('0xe')]===0x1f4){logger[_0xbbcc('0xf')](_0xbbcc('0x10'),_0x3fb981,_0x1f5f47['error'][_0xbbcc('0x11')]);return _0x3afc8c(_0x1f5f47['error'][_0xbbcc('0x11')]);}logger[_0xbbcc('0xf')](_0xbbcc('0x10'),_0x3fb981,_0x1f5f47[_0xbbcc('0xf')][_0xbbcc('0x11')]);return _0x155b4e(_0x1f5f47[_0xbbcc('0xf')][_0xbbcc('0x11')]);}else{logger[_0xbbcc('0xa')](_0xbbcc('0x10'),_0x3fb981,_0xbbcc('0xb'));_0x155b4e(_0x1f5f47['result'][_0xbbcc('0x11')]);}})['catch'](function(_0x1bd7ce){logger[_0xbbcc('0xf')](_0xbbcc('0x10'),_0x3fb981,_0x1bd7ce);_0x3afc8c(_0x1bd7ce);});});}exports[_0xbbcc('0x12')]=function(_0x52bd69){var _0xa2fed7=this;return new Promise(function(_0xb9253c,_0x5dc434){return db[_0xbbcc('0x13')][_0xbbcc('0x14')](_0x52bd69[_0xbbcc('0x15')],{'raw':_0x52bd69[_0xbbcc('0x16')]?_0x52bd69['options']['raw']===undefined?!![]:![]:!![]})[_0xbbcc('0x9')](function(_0x4c207){logger[_0xbbcc('0xa')](_0xbbcc('0x12'),_0x52bd69);logger[_0xbbcc('0xc')](_0xbbcc('0x12'),_0x52bd69,JSON[_0xbbcc('0xd')](_0x4c207));_0xb9253c(_0x4c207);})['catch'](function(_0x35cc4b){logger[_0xbbcc('0xf')]('CreateVoiceDialReport',_0x35cc4b[_0xbbcc('0x11')],_0x52bd69);_0x5dc434(_0xa2fed7[_0xbbcc('0xf')](0x1f4,_0x35cc4b[_0xbbcc('0x11')]));});});};exports[_0xbbcc('0x17')]=function(_0x14386b){var _0x5f54e6=this;return new Promise(function(_0x21e826,_0xd63626){return db['VoiceDialReport'][_0xbbcc('0x18')](_0x14386b['body'],{'raw':_0x14386b[_0xbbcc('0x16')]?_0x14386b[_0xbbcc('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14386b[_0xbbcc('0x16')]?_0x14386b[_0xbbcc('0x16')][_0xbbcc('0x19')]||null:null,'attributes':_0x14386b[_0xbbcc('0x16')]?_0x14386b[_0xbbcc('0x16')][_0xbbcc('0x1a')]||null:null,'limit':_0x14386b[_0xbbcc('0x16')]?_0x14386b['options'][_0xbbcc('0x1b')]||null:null})[_0xbbcc('0x9')](function(_0x1fdbde){logger[_0xbbcc('0xa')](_0xbbcc('0x17'),_0x14386b);logger[_0xbbcc('0xc')](_0xbbcc('0x17'),_0x14386b,JSON[_0xbbcc('0xd')](_0x1fdbde));_0x21e826(_0x1fdbde);})[_0xbbcc('0x1c')](function(_0x2dfa85){logger[_0xbbcc('0xf')](_0xbbcc('0x17'),_0x2dfa85[_0xbbcc('0x11')],_0x14386b);_0xd63626(_0x5f54e6[_0xbbcc('0xf')](0x1f4,_0x2dfa85['message']));});});}; \ No newline at end of file +var _0x3aa5=['request\x20sent','stringify','error','message','info','result','CreateVoiceDialReport','VoiceDialReport','options','raw','catch','UpdateVoiceDialReport','update','body','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','debug'];(function(_0xc2f6df,_0x3d8598){var _0x5b427b=function(_0x26bdb7){while(--_0x26bdb7){_0xc2f6df['push'](_0xc2f6df['shift']());}};_0x5b427b(++_0x3d8598);}(_0x3aa5,0x1bd));var _0x53aa=function(_0xbb30f3,_0x203773){_0xbb30f3=_0xbb30f3-0x0;var _0x5f58ae=_0x3aa5[_0xbb30f3];return _0x5f58ae;};'use strict';var _=require(_0x53aa('0x0'));var util=require(_0x53aa('0x1'));var moment=require(_0x53aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x53aa('0x3'));var fs=require('fs');var Redis=require(_0x53aa('0x4'));var db=require(_0x53aa('0x5'))['db'];var utils=require(_0x53aa('0x6'));var logger=require(_0x53aa('0x7'))(_0x53aa('0x8'));var config=require(_0x53aa('0x9'));var jayson=require(_0x53aa('0xa'));var client=jayson[_0x53aa('0xb')][_0x53aa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x439542,_0x38efe0,_0x5a4fbe){return new BPromise(function(_0x21e750,_0x3c9f6a){return client[_0x53aa('0xd')](_0x439542,_0x5a4fbe)[_0x53aa('0xe')](function(_0x3d215d){logger['info'](_0x53aa('0xf'),_0x38efe0,'request\x20sent');logger[_0x53aa('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x38efe0,_0x53aa('0x11'),JSON[_0x53aa('0x12')](_0x3d215d));if(_0x3d215d[_0x53aa('0x13')]){if(_0x3d215d['error']['code']===0x1f4){logger[_0x53aa('0x13')](_0x53aa('0xf'),_0x38efe0,_0x3d215d[_0x53aa('0x13')][_0x53aa('0x14')]);return _0x3c9f6a(_0x3d215d['error'][_0x53aa('0x14')]);}logger[_0x53aa('0x13')](_0x53aa('0xf'),_0x38efe0,_0x3d215d[_0x53aa('0x13')][_0x53aa('0x14')]);return _0x21e750(_0x3d215d[_0x53aa('0x13')][_0x53aa('0x14')]);}else{logger[_0x53aa('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x38efe0,'request\x20sent');_0x21e750(_0x3d215d[_0x53aa('0x16')][_0x53aa('0x14')]);}})['catch'](function(_0x116f5){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x38efe0,_0x116f5);_0x3c9f6a(_0x116f5);});});}exports[_0x53aa('0x17')]=function(_0x1e70f4){var _0x3aec70=this;return new Promise(function(_0x3af864,_0x4ecda2){return db[_0x53aa('0x18')]['create'](_0x1e70f4['body'],{'raw':_0x1e70f4[_0x53aa('0x19')]?_0x1e70f4[_0x53aa('0x19')][_0x53aa('0x1a')]===undefined?!![]:![]:!![]})[_0x53aa('0xe')](function(_0x5edeac){logger[_0x53aa('0x15')](_0x53aa('0x17'),_0x1e70f4);logger[_0x53aa('0x10')](_0x53aa('0x17'),_0x1e70f4,JSON[_0x53aa('0x12')](_0x5edeac));_0x3af864(_0x5edeac);})[_0x53aa('0x1b')](function(_0x2c949d){logger[_0x53aa('0x13')](_0x53aa('0x17'),_0x2c949d['message'],_0x1e70f4);_0x4ecda2(_0x3aec70[_0x53aa('0x13')](0x1f4,_0x2c949d[_0x53aa('0x14')]));});});};exports[_0x53aa('0x1c')]=function(_0x370eff){var _0x292482=this;return new Promise(function(_0x278f27,_0x51dfa1){return db[_0x53aa('0x18')][_0x53aa('0x1d')](_0x370eff[_0x53aa('0x1e')],{'raw':_0x370eff[_0x53aa('0x19')]?_0x370eff['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x370eff['options']?_0x370eff[_0x53aa('0x19')][_0x53aa('0x1f')]||null:null,'attributes':_0x370eff['options']?_0x370eff[_0x53aa('0x19')]['attributes']||null:null,'limit':_0x370eff[_0x53aa('0x19')]?_0x370eff['options'][_0x53aa('0x20')]||null:null})[_0x53aa('0xe')](function(_0x4a51f2){logger[_0x53aa('0x15')](_0x53aa('0x1c'),_0x370eff);logger[_0x53aa('0x10')](_0x53aa('0x1c'),_0x370eff,JSON[_0x53aa('0x12')](_0x4a51f2));_0x278f27(_0x4a51f2);})[_0x53aa('0x1b')](function(_0x2af533){logger[_0x53aa('0x13')](_0x53aa('0x1c'),_0x2af533['message'],_0x370eff);_0x51dfa1(_0x292482[_0x53aa('0x13')](0x1f4,_0x2af533['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 6230059..c905b84 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 _0x27cb=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27cb,0x73));var _0xb27c=function(_0x270c48,_0x15064d){_0x270c48=_0x270c48-0x0;var _0x24aa62=_0x27cb[_0x270c48];return _0x24aa62;};'use strict';var multer=require(_0xb27c('0x0'));var util=require('util');var path=require(_0xb27c('0x1'));var timeout=require(_0xb27c('0x2'));var express=require(_0xb27c('0x3'));var router=express[_0xb27c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb27c('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xb27c('0x6')](),controller[_0xb27c('0x7')]);router[_0xb27c('0x8')](_0xb27c('0x9'),auth['isAuthenticated'](),controller[_0xb27c('0xa')]);router[_0xb27c('0xb')]('/',auth[_0xb27c('0x6')](),controller[_0xb27c('0xc')]);router[_0xb27c('0xb')](_0xb27c('0xd'),auth[_0xb27c('0x6')](),controller[_0xb27c('0xe')]);router[_0xb27c('0xf')]('/:id',auth[_0xb27c('0x6')](),controller[_0xb27c('0x10')]);router[_0xb27c('0x11')](_0xb27c('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xb27c('0x12')]=router; \ No newline at end of file +var _0x392a=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post','create','/:id/applications','addApplications','put','update','/:id','destroy','exports'];(function(_0x470d82,_0x2fb808){var _0x121f86=function(_0x5dc702){while(--_0x5dc702){_0x470d82['push'](_0x470d82['shift']());}};_0x121f86(++_0x2fb808);}(_0x392a,0x11d));var _0xa392=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x392a[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xa392('0x0'));var util=require('util');var path=require(_0xa392('0x1'));var timeout=require(_0xa392('0x2'));var express=require(_0xa392('0x3'));var router=express[_0xa392('0x4')]();var auth=require(_0xa392('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa392('0x6'));var controller=require('./voiceExtension.controller');router[_0xa392('0x7')]('/',auth[_0xa392('0x8')](),controller['index']);router[_0xa392('0x7')]('/:id',auth[_0xa392('0x8')](),controller[_0xa392('0x9')]);router[_0xa392('0xa')]('/',auth[_0xa392('0x8')](),controller[_0xa392('0xb')]);router[_0xa392('0xa')](_0xa392('0xc'),auth[_0xa392('0x8')](),controller[_0xa392('0xd')]);router[_0xa392('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa392('0xf')]);router['delete'](_0xa392('0x10'),auth[_0xa392('0x8')](),controller[_0xa392('0x11')]);module[_0xa392('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e1cfcc4..57febe6 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(_0x23490f,_0x456320){var _0x2ec6c6=function(_0x587094){while(--_0x587094){_0x23490f['push'](_0x23490f['shift']());}};_0x2ec6c6(++_0x456320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0xac4b31,_0x4403cc){var _0x4370ea=function(_0x480b01){while(--_0x480b01){_0xac4b31['push'](_0xac4b31['shift']());}};_0x4370ea(++_0x4403cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 fa9c79c..4bbb966 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 _0x7e4e=['type','find','name','UserProfileResource','destroy','end','error','stack','VoiceExtension','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes'];(function(_0x541b8d,_0x384e14){var _0x186c69=function(_0x4a4a16){while(--_0x4a4a16){_0x541b8d['push'](_0x541b8d['shift']());}};_0x186c69(++_0x384e14);}(_0x7e4e,0x184));var _0xe7e4=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0x7e4e[_0x4e7c1c];return _0x47adb2;};'use strict';var pdf=require(_0xe7e4('0x0'));var emlformat=require(_0xe7e4('0x1'));var rimraf=require(_0xe7e4('0x2'));var zipdir=require(_0xe7e4('0x3'));var jsonpatch=require(_0xe7e4('0x4'));var rp=require(_0xe7e4('0x5'));var moment=require(_0xe7e4('0x6'));var BPromise=require(_0xe7e4('0x7'));var Mustache=require(_0xe7e4('0x8'));var util=require(_0xe7e4('0x9'));var path=require(_0xe7e4('0xa'));var sox=require(_0xe7e4('0xb'));var csv=require('to-csv');var ejs=require(_0xe7e4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe7e4('0xd'));var crypto=require(_0xe7e4('0xe'));var jsforce=require(_0xe7e4('0xf'));var deskjs=require(_0xe7e4('0x10'));var toCsv=require(_0xe7e4('0x11'));var querystring=require(_0xe7e4('0x12'));var Papa=require(_0xe7e4('0x13'));var Redis=require(_0xe7e4('0x14'));var authService=require(_0xe7e4('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe7e4('0x16'));var hardwareService=require(_0xe7e4('0x17'));var logger=require(_0xe7e4('0x18'))(_0xe7e4('0x19'));var utils=require(_0xe7e4('0x1a'));var config=require(_0xe7e4('0x1b'));var licenseUtil=require(_0xe7e4('0x1c'));var db=require(_0xe7e4('0x1d'))['db'];config['redis']=_[_0xe7e4('0x1e')](config[_0xe7e4('0x1f')],{'host':_0xe7e4('0x20'),'port':0x18eb});var socket=require(_0xe7e4('0x21'))(new Redis(config['redis']));require(_0xe7e4('0x22'))[_0xe7e4('0x23')](socket);function respondWithStatusCode(_0x224a4e,_0x360adc){_0x360adc=_0x360adc||0xcc;return function(_0x9beda6){if(_0x9beda6){return _0x224a4e[_0xe7e4('0x24')](_0x360adc);}return _0x224a4e[_0xe7e4('0x25')](_0x360adc)['end']();};}function respondWithResult(_0x2048f1,_0x3caebd){_0x3caebd=_0x3caebd||0xc8;return function(_0x5aa39b){if(_0x5aa39b){return _0x2048f1[_0xe7e4('0x25')](_0x3caebd)['json'](_0x5aa39b);}};}function respondWithFilteredResult(_0x4bc357,_0x2d9739){return function(_0x3cd15c){if(_0x3cd15c){var _0x10039f=_0x3cd15c[_0xe7e4('0x26')],_0x9d5a50=_0x2d9739[_0xe7e4('0x27')],_0x17aa00=_0x2d9739[_0xe7e4('0x27')]+_0x2d9739[_0xe7e4('0x28')],_0x215be9;if(_0x17aa00>=_0x10039f){_0x17aa00=_0x10039f;_0x215be9=0xc8;}else{_0x215be9=0xce;}_0x4bc357[_0xe7e4('0x25')](_0x215be9);return _0x4bc357[_0xe7e4('0x29')](_0xe7e4('0x2a'),_0x9d5a50+'-'+_0x17aa00+'/'+_0x10039f)[_0xe7e4('0x2b')](_0x3cd15c);}return null;};}function patchUpdates(_0x1a39ef){return function(_0x4a2a7b){try{jsonpatch[_0xe7e4('0x2c')](_0x4a2a7b,_0x1a39ef,!![]);}catch(_0x46bdf9){return BPromise[_0xe7e4('0x2d')](_0x46bdf9);}return _0x4a2a7b[_0xe7e4('0x2e')]();};}function saveUpdates(_0xd0c84f,_0x22baba){return function(_0x212623){if(_0x212623){return _0x212623[_0xe7e4('0x2f')](_0xd0c84f)[_0xe7e4('0x30')](function(_0x425bb4){return _0x425bb4;});}return null;};}function removeEntity(_0x3afddf,_0x13ebe7){return function(_0x31115f){if(_0x31115f){return _0x31115f['destroy']()[_0xe7e4('0x30')](function(){var _0x1c2e3c=_0x31115f[_0xe7e4('0x31')]({'plain':!![]});var _0x58a9a6=[{'name':_0xe7e4('0x32'),'value':'inbound','ignore':![]},{'name':_0xe7e4('0x33'),'value':_0xe7e4('0x34'),'ignore':![]},{'name':_0xe7e4('0x35'),'value':_0xe7e4('0x36'),'ignore':![]}];var _0x4fec70=_(_0x58a9a6)[_0xe7e4('0x37')](_0xe7e4('0x38'))[_0xe7e4('0x39')](_0xe7e4('0x3a'))[_0xe7e4('0x3a')]();if(_[_0xe7e4('0x3b')](_0x4fec70,_0x1c2e3c[_0xe7e4('0x3c')])){return;}var _0x557e08=_[_0xe7e4('0x3d')](_0x58a9a6,[_0xe7e4('0x3a'),_0x1c2e3c['type']])[_0xe7e4('0x3e')];return db[_0xe7e4('0x3f')][_0xe7e4('0x40')]({'where':{'type':_0x557e08,'resourceId':_0x1c2e3c['id']}})['then'](function(){return _0x31115f;});})[_0xe7e4('0x30')](function(){_0x3afddf['status'](0xcc)[_0xe7e4('0x41')]();});}};}function handleEntityNotFound(_0x2c6ba0,_0x243058){return function(_0x1ed4e5){if(!_0x1ed4e5){_0x2c6ba0[_0xe7e4('0x24')](0x194);}return _0x1ed4e5;};}function handleError(_0x17209b,_0x2846f6){_0x2846f6=_0x2846f6||0x1f4;return function(_0x493367){logger[_0xe7e4('0x42')](_0x493367[_0xe7e4('0x43')]);if(_0x493367['name']){delete _0x493367['name'];}_0x17209b[_0xe7e4('0x25')](_0x2846f6)['send'](_0x493367);};}exports['index']=function(_0x4dfc40,_0x1ad5b5){var _0x45fb8a={},_0xdc1ee4={},_0x64b383={'count':0x0,'rows':[]};var _0x2b57e5=_[_0xe7e4('0x39')](db[_0xe7e4('0x44')][_0xe7e4('0x45')],function(_0x25ac40){return{'name':_0x25ac40['fieldName'],'type':_0x25ac40[_0xe7e4('0x3c')][_0xe7e4('0x46')]};});_0xdc1ee4[_0xe7e4('0x47')]=_[_0xe7e4('0x39')](_0x2b57e5,'name');_0xdc1ee4['query']=_[_0xe7e4('0x48')](_0x4dfc40[_0xe7e4('0x49')]);_0xdc1ee4[_0xe7e4('0x4a')]=_['intersection'](_0xdc1ee4[_0xe7e4('0x47')],_0xdc1ee4[_0xe7e4('0x49')]);_0x45fb8a[_0xe7e4('0x4b')]=_[_0xe7e4('0x4c')](_0xdc1ee4[_0xe7e4('0x47')],qs[_0xe7e4('0x4d')](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x4d')]));_0x45fb8a[_0xe7e4('0x4b')]=_0x45fb8a[_0xe7e4('0x4b')][_0xe7e4('0x4e')]?_0x45fb8a[_0xe7e4('0x4b')]:_0xdc1ee4[_0xe7e4('0x47')];if(!_0x4dfc40[_0xe7e4('0x49')]['hasOwnProperty']('nolimit')){_0x45fb8a[_0xe7e4('0x28')]=qs['limit'](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x28')]);_0x45fb8a[_0xe7e4('0x27')]=qs[_0xe7e4('0x27')](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x27')]);}_0x45fb8a[_0xe7e4('0x4f')]=qs[_0xe7e4('0x50')](_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x50')]);_0x45fb8a['where']=qs[_0xe7e4('0x4a')](_[_0xe7e4('0x51')](_0x4dfc40[_0xe7e4('0x49')],_0xdc1ee4[_0xe7e4('0x4a')]),_0x2b57e5);if(_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x37')]){_0x45fb8a[_0xe7e4('0x52')]=_[_0xe7e4('0x53')](_0x45fb8a[_0xe7e4('0x52')],{'$or':_[_0xe7e4('0x39')](_0x2b57e5,function(_0x2a18a9){if(_0x2a18a9[_0xe7e4('0x3c')]!==_0xe7e4('0x54')){var _0x4fc751={};_0x4fc751[_0x2a18a9['name']]={'$like':'%'+_0x4dfc40[_0xe7e4('0x49')][_0xe7e4('0x37')]+'%'};return _0x4fc751;}})});}_0x45fb8a=_[_0xe7e4('0x53')]({},_0x45fb8a,_0x4dfc40[_0xe7e4('0x55')]);var _0x12a978={'where':_0x45fb8a['where']};return db[_0xe7e4('0x44')]['count'](_0x12a978)[_0xe7e4('0x30')](function(_0x259436){_0x64b383[_0xe7e4('0x26')]=_0x259436;if(_0x4dfc40[_0xe7e4('0x49')]['includeAll']){_0x45fb8a['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xe7e4('0x56')](_0x45fb8a);})[_0xe7e4('0x30')](function(_0xd2ffee){_0x64b383[_0xe7e4('0x57')]=_0xd2ffee;return _0x64b383;})['then'](respondWithFilteredResult(_0x1ad5b5,_0x45fb8a))[_0xe7e4('0x58')](handleError(_0x1ad5b5,null));};exports[_0xe7e4('0x59')]=function(_0x3db079,_0x26146f){var _0x17181f={'raw':![],'where':{'id':_0x3db079[_0xe7e4('0x5a')]['id']}},_0x4ed501={};_0x4ed501[_0xe7e4('0x47')]=_[_0xe7e4('0x48')](db[_0xe7e4('0x44')][_0xe7e4('0x45')]);_0x4ed501[_0xe7e4('0x49')]=_[_0xe7e4('0x48')](_0x3db079[_0xe7e4('0x49')]);_0x4ed501['filters']=_[_0xe7e4('0x4c')](_0x4ed501[_0xe7e4('0x47')],_0x4ed501[_0xe7e4('0x49')]);_0x17181f[_0xe7e4('0x4b')]=_['intersection'](_0x4ed501['model'],qs[_0xe7e4('0x4d')](_0x3db079['query'][_0xe7e4('0x4d')]));_0x17181f['attributes']=_0x17181f[_0xe7e4('0x4b')][_0xe7e4('0x4e')]?_0x17181f[_0xe7e4('0x4b')]:_0x4ed501[_0xe7e4('0x47')];if(_0x3db079[_0xe7e4('0x49')][_0xe7e4('0x5b')]){_0x17181f[_0xe7e4('0x5c')]=[{'all':!![]}];}_0x17181f=_[_0xe7e4('0x53')]({},_0x17181f,_0x3db079['options']);return db[_0xe7e4('0x44')][_0xe7e4('0x3d')](_0x17181f)[_0xe7e4('0x30')](handleEntityNotFound(_0x26146f,null))['then'](respondWithResult(_0x26146f,null))[_0xe7e4('0x58')](handleError(_0x26146f,null));};exports[_0xe7e4('0x40')]=function(_0x4cb3f5,_0x4667e7){return db['VoiceExtension']['find']({'where':{'id':_0x4cb3f5[_0xe7e4('0x5a')]['id']}})[_0xe7e4('0x30')](handleEntityNotFound(_0x4667e7,null))[_0xe7e4('0x30')](removeEntity(_0x4667e7,null))[_0xe7e4('0x58')](handleError(_0x4667e7,null));};exports[_0xe7e4('0x5d')]=function(_0x523c57,_0x440818){if(_0x523c57[_0xe7e4('0x5e')][_0xe7e4('0x3c')]===_0xe7e4('0x34')&&!_[_0xe7e4('0x5f')](_0x523c57[_0xe7e4('0x5e')][_0xe7e4('0x60')],'_')){_0x523c57['body'][_0xe7e4('0x60')]='_'[_0xe7e4('0x61')](_0x523c57[_0xe7e4('0x5e')][_0xe7e4('0x60')]);}return db[_0xe7e4('0x44')][_0xe7e4('0x5d')](_0x523c57[_0xe7e4('0x5e')],{'raw':![]})['then'](function(_0x3736f2){var _0x31f3a9=_0x523c57[_0xe7e4('0x62')][_0xe7e4('0x31')]({'plain':!![]});if(!_0x31f3a9)throw new Error(_0xe7e4('0x63'));if(_0x31f3a9[_0xe7e4('0x64')]==='user'){var _0x117ceb=_0x3736f2[_0xe7e4('0x31')]({'plain':!![]});var _0x520362=[{'name':_0xe7e4('0x32'),'value':'inbound'},{'name':_0xe7e4('0x33'),'value':_0xe7e4('0x34')},{'name':_0xe7e4('0x35'),'value':_0xe7e4('0x36')}];var _0x36e9b7=_[_0xe7e4('0x3d')](_0x520362,[_0xe7e4('0x3a'),_0x117ceb['type']])[_0xe7e4('0x3e')];return db[_0xe7e4('0x65')]['find']({'where':{'name':_0x36e9b7,'userProfileId':_0x31f3a9['userProfileId']},'raw':!![]})['then'](function(_0x4b8c9b){if(_0x4b8c9b&&_0x4b8c9b['autoAssociation']===0x0){return db[_0xe7e4('0x3f')]['create']({'name':_0x117ceb[_0xe7e4('0x3e')],'resourceId':_0x117ceb['id'],'type':_0x4b8c9b['name'],'sectionId':_0x4b8c9b['id']},{})['then'](function(){return _0x3736f2;});}else{return _0x3736f2;}})[_0xe7e4('0x58')](function(_0x24a450){logger[_0xe7e4('0x42')](_0xe7e4('0x66'),_0x24a450);throw _0x24a450;});}return _0x3736f2;})[_0xe7e4('0x30')](respondWithResult(_0x440818,0xc9))[_0xe7e4('0x58')](handleError(_0x440818,null));};exports['update']=function(_0x6331a1,_0x552246){if(_0x6331a1[_0xe7e4('0x5e')]['id']){delete _0x6331a1[_0xe7e4('0x5e')]['id'];}return db['VoiceExtension'][_0xe7e4('0x3d')]({'where':{'id':_0x6331a1[_0xe7e4('0x5a')]['id']}})[_0xe7e4('0x30')](handleEntityNotFound(_0x552246,null))[_0xe7e4('0x30')](function(_0x240236){if(_0x240236){return db[_0xe7e4('0x44')]['update'](_[_0xe7e4('0x51')](_0x6331a1[_0xe7e4('0x5e')],['exten',_0xe7e4('0x67'),_0xe7e4('0x68'),'recordingFormat','cutdigits',_0xe7e4('0x69')]),{'where':{'context':_0x240236[_0xe7e4('0x67')],'exten':_0x240236[_0xe7e4('0x60')]},'individualHooks':!![]})['then'](function(_0x35f3ff){return _0x35f3ff;});}return null;})[_0xe7e4('0x30')](respondWithStatusCode(_0x552246,null))[_0xe7e4('0x58')](handleError(_0x552246,null));};exports[_0xe7e4('0x6a')]=function(_0x40b50e,_0x45f6dd,_0xf1b0ad){return db[_0xe7e4('0x44')][_0xe7e4('0x6b')]({'where':{'id':_0x40b50e[_0xe7e4('0x5a')]['id']}})[_0xe7e4('0x30')](handleEntityNotFound(_0x45f6dd,null))['then'](function(_0x280b9e){if(_0x280b9e){return db[_0xe7e4('0x6c')][_0xe7e4('0x6d')](function(_0x90a087){return db[_0xe7e4('0x44')][_0xe7e4('0x40')]({'where':{'VoiceExtensionId':_0x40b50e[_0xe7e4('0x5a')]['id']},'transaction':_0x90a087})['then'](function(_0x2878e3){var _0xf78d75=_[_0xe7e4('0x39')](_0x40b50e[_0xe7e4('0x5e')],function(_0x23ccc7){_0x23ccc7[_0xe7e4('0x6e')]=_0x40b50e['params']['id'];return _0x23ccc7;});return db[_0xe7e4('0x44')]['bulkCreate'](_0xf78d75,{'transaction':_0x90a087});});})[_0xe7e4('0x30')](function(){return db[_0xe7e4('0x44')][_0xe7e4('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x40b50e['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xe7e4('0x30')](respondWithResult(_0x45f6dd,null))[_0xe7e4('0x58')](handleError(_0x45f6dd,null));}; \ No newline at end of file +var _0x27be=['context','description','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','count','offset','set','apply','reject','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','internal','map','value','includes','type','find','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','create','body','startsWith','exten','concat','user','inbound','InternalRoutes','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x5f483c,_0x436f4d){var _0x23c745=function(_0x15d4fd){while(--_0x15d4fd){_0x5f483c['push'](_0x5f483c['shift']());}};_0x23c745(++_0x436f4d);}(_0x27be,0x74));var _0xe27b=function(_0x231397,_0x45ad7c){_0x231397=_0x231397-0x0;var _0x586b4b=_0x27be[_0x231397];return _0x586b4b;};'use strict';var pdf=require(_0xe27b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe27b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe27b('0x2'));var rp=require(_0xe27b('0x3'));var moment=require(_0xe27b('0x4'));var BPromise=require(_0xe27b('0x5'));var Mustache=require(_0xe27b('0x6'));var util=require('util');var path=require(_0xe27b('0x7'));var sox=require(_0xe27b('0x8'));var csv=require('to-csv');var ejs=require(_0xe27b('0x9'));var fs=require('fs');var _=require(_0xe27b('0xa'));var squel=require(_0xe27b('0xb'));var crypto=require(_0xe27b('0xc'));var jsforce=require(_0xe27b('0xd'));var deskjs=require(_0xe27b('0xe'));var toCsv=require(_0xe27b('0xf'));var querystring=require('querystring');var Papa=require(_0xe27b('0x10'));var Redis=require(_0xe27b('0x11'));var authService=require(_0xe27b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe27b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe27b('0x14'))(_0xe27b('0x15'));var utils=require(_0xe27b('0x16'));var config=require(_0xe27b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe27b('0x18'))['db'];config[_0xe27b('0x19')]=_[_0xe27b('0x1a')](config[_0xe27b('0x19')],{'host':_0xe27b('0x1b'),'port':0x18eb});var socket=require(_0xe27b('0x1c'))(new Redis(config[_0xe27b('0x19')]));require(_0xe27b('0x1d'))[_0xe27b('0x1e')](socket);function respondWithStatusCode(_0x4515db,_0x98f149){_0x98f149=_0x98f149||0xcc;return function(_0xed550a){if(_0xed550a){return _0x4515db[_0xe27b('0x1f')](_0x98f149);}return _0x4515db['status'](_0x98f149)[_0xe27b('0x20')]();};}function respondWithResult(_0x42e5f0,_0x32e2c0){_0x32e2c0=_0x32e2c0||0xc8;return function(_0x1399fc){if(_0x1399fc){return _0x42e5f0[_0xe27b('0x21')](_0x32e2c0)[_0xe27b('0x22')](_0x1399fc);}};}function respondWithFilteredResult(_0x6a90b3,_0x312575){return function(_0x9cf3a7){if(_0x9cf3a7){var _0x32eaeb=_0x9cf3a7[_0xe27b('0x23')],_0x2ddc3c=_0x312575[_0xe27b('0x24')],_0x54b3f4=_0x312575[_0xe27b('0x24')]+_0x312575['limit'],_0x4e660e;if(_0x54b3f4>=_0x32eaeb){_0x54b3f4=_0x32eaeb;_0x4e660e=0xc8;}else{_0x4e660e=0xce;}_0x6a90b3[_0xe27b('0x21')](_0x4e660e);return _0x6a90b3[_0xe27b('0x25')]('Content-Range',_0x2ddc3c+'-'+_0x54b3f4+'/'+_0x32eaeb)[_0xe27b('0x22')](_0x9cf3a7);}return null;};}function patchUpdates(_0xc6cd25){return function(_0x2e8bd6){try{jsonpatch[_0xe27b('0x26')](_0x2e8bd6,_0xc6cd25,!![]);}catch(_0x235ede){return BPromise[_0xe27b('0x27')](_0x235ede);}return _0x2e8bd6['save']();};}function saveUpdates(_0x27ddb1,_0x37ee3b){return function(_0x5d5fa3){if(_0x5d5fa3){return _0x5d5fa3['update'](_0x27ddb1)[_0xe27b('0x28')](function(_0x5ef12d){return _0x5ef12d;});}return null;};}function removeEntity(_0x57ed6a,_0x47e966){return function(_0x10c940){if(_0x10c940){return _0x10c940[_0xe27b('0x29')]()[_0xe27b('0x28')](function(){var _0x5268a6=_0x10c940[_0xe27b('0x2a')]({'plain':!![]});var _0x1edf73=[{'name':_0xe27b('0x2b'),'value':'inbound','ignore':![]},{'name':_0xe27b('0x2c'),'value':_0xe27b('0x2d'),'ignore':![]},{'name':'InternalRoutes','value':_0xe27b('0x2e'),'ignore':![]}];var _0x142a5c=_(_0x1edf73)['filter']('ignore')[_0xe27b('0x2f')]('value')[_0xe27b('0x30')]();if(_[_0xe27b('0x31')](_0x142a5c,_0x5268a6[_0xe27b('0x32')])){return;}var _0x36ae44=_[_0xe27b('0x33')](_0x1edf73,[_0xe27b('0x30'),_0x5268a6[_0xe27b('0x32')]])[_0xe27b('0x34')];return db[_0xe27b('0x35')][_0xe27b('0x29')]({'where':{'type':_0x36ae44,'resourceId':_0x5268a6['id']}})[_0xe27b('0x28')](function(){return _0x10c940;});})['then'](function(){_0x57ed6a['status'](0xcc)[_0xe27b('0x20')]();});}};}function handleEntityNotFound(_0x136b72,_0x38390c){return function(_0xe3451a){if(!_0xe3451a){_0x136b72[_0xe27b('0x1f')](0x194);}return _0xe3451a;};}function handleError(_0x47742c,_0x5780aa){_0x5780aa=_0x5780aa||0x1f4;return function(_0x2cfa18){logger[_0xe27b('0x36')](_0x2cfa18[_0xe27b('0x37')]);if(_0x2cfa18['name']){delete _0x2cfa18[_0xe27b('0x34')];}_0x47742c[_0xe27b('0x21')](_0x5780aa)['send'](_0x2cfa18);};}exports[_0xe27b('0x38')]=function(_0x2b947b,_0x5f54e4){var _0x3b3806={},_0x908c21={},_0x6b933e={'count':0x0,'rows':[]};var _0x3ceacc=_[_0xe27b('0x2f')](db[_0xe27b('0x39')][_0xe27b('0x3a')],function(_0x2c1f80){return{'name':_0x2c1f80['fieldName'],'type':_0x2c1f80[_0xe27b('0x32')][_0xe27b('0x3b')]};});_0x908c21[_0xe27b('0x3c')]=_[_0xe27b('0x2f')](_0x3ceacc,_0xe27b('0x34'));_0x908c21[_0xe27b('0x3d')]=_[_0xe27b('0x3e')](_0x2b947b[_0xe27b('0x3d')]);_0x908c21[_0xe27b('0x3f')]=_[_0xe27b('0x40')](_0x908c21[_0xe27b('0x3c')],_0x908c21[_0xe27b('0x3d')]);_0x3b3806[_0xe27b('0x41')]=_[_0xe27b('0x40')](_0x908c21[_0xe27b('0x3c')],qs[_0xe27b('0x42')](_0x2b947b['query']['fields']));_0x3b3806[_0xe27b('0x41')]=_0x3b3806[_0xe27b('0x41')][_0xe27b('0x43')]?_0x3b3806[_0xe27b('0x41')]:_0x908c21[_0xe27b('0x3c')];if(!_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x44')](_0xe27b('0x45'))){_0x3b3806[_0xe27b('0x46')]=qs[_0xe27b('0x46')](_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x46')]);_0x3b3806[_0xe27b('0x24')]=qs[_0xe27b('0x24')](_0x2b947b['query']['offset']);}_0x3b3806[_0xe27b('0x47')]=qs[_0xe27b('0x48')](_0x2b947b[_0xe27b('0x3d')]['sort']);_0x3b3806[_0xe27b('0x49')]=qs[_0xe27b('0x3f')](_[_0xe27b('0x4a')](_0x2b947b[_0xe27b('0x3d')],_0x908c21[_0xe27b('0x3f')]),_0x3ceacc);if(_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x4b')]){_0x3b3806[_0xe27b('0x49')]=_['merge'](_0x3b3806[_0xe27b('0x49')],{'$or':_['map'](_0x3ceacc,function(_0x4c1e2d){if(_0x4c1e2d['type']!==_0xe27b('0x4c')){var _0x3faa9d={};_0x3faa9d[_0x4c1e2d[_0xe27b('0x34')]]={'$like':'%'+_0x2b947b[_0xe27b('0x3d')][_0xe27b('0x4b')]+'%'};return _0x3faa9d;}})});}_0x3b3806=_[_0xe27b('0x4d')]({},_0x3b3806,_0x2b947b['options']);var _0x553c85={'where':_0x3b3806[_0xe27b('0x49')]};return db[_0xe27b('0x39')][_0xe27b('0x23')](_0x553c85)[_0xe27b('0x28')](function(_0x5d9f00){_0x6b933e[_0xe27b('0x23')]=_0x5d9f00;if(_0x2b947b['query']['includeAll']){_0x3b3806[_0xe27b('0x4e')]=[{'all':!![]}];}return db[_0xe27b('0x39')][_0xe27b('0x4f')](_0x3b3806);})['then'](function(_0x5d0e81){_0x6b933e['rows']=_0x5d0e81;return _0x6b933e;})[_0xe27b('0x28')](respondWithFilteredResult(_0x5f54e4,_0x3b3806))[_0xe27b('0x50')](handleError(_0x5f54e4,null));};exports[_0xe27b('0x51')]=function(_0x13f056,_0x2b6ebd){var _0xd05050={'raw':![],'where':{'id':_0x13f056[_0xe27b('0x52')]['id']}},_0x429d23={};_0x429d23[_0xe27b('0x3c')]=_['keys'](db[_0xe27b('0x39')]['rawAttributes']);_0x429d23['query']=_['keys'](_0x13f056['query']);_0x429d23['filters']=_['intersection'](_0x429d23['model'],_0x429d23['query']);_0xd05050[_0xe27b('0x41')]=_[_0xe27b('0x40')](_0x429d23[_0xe27b('0x3c')],qs[_0xe27b('0x42')](_0x13f056[_0xe27b('0x3d')]['fields']));_0xd05050[_0xe27b('0x41')]=_0xd05050[_0xe27b('0x41')]['length']?_0xd05050[_0xe27b('0x41')]:_0x429d23['model'];if(_0x13f056[_0xe27b('0x3d')][_0xe27b('0x53')]){_0xd05050[_0xe27b('0x4e')]=[{'all':!![]}];}_0xd05050=_[_0xe27b('0x4d')]({},_0xd05050,_0x13f056['options']);return db['VoiceExtension'][_0xe27b('0x33')](_0xd05050)[_0xe27b('0x28')](handleEntityNotFound(_0x2b6ebd,null))[_0xe27b('0x28')](respondWithResult(_0x2b6ebd,null))[_0xe27b('0x50')](handleError(_0x2b6ebd,null));};exports['destroy']=function(_0x35e24f,_0x28dc36){return db[_0xe27b('0x39')][_0xe27b('0x33')]({'where':{'id':_0x35e24f[_0xe27b('0x52')]['id']}})[_0xe27b('0x28')](handleEntityNotFound(_0x28dc36,null))[_0xe27b('0x28')](removeEntity(_0x28dc36,null))[_0xe27b('0x50')](handleError(_0x28dc36,null));};exports[_0xe27b('0x54')]=function(_0x15aa35,_0x3e048e){if(_0x15aa35[_0xe27b('0x55')][_0xe27b('0x32')]===_0xe27b('0x2d')&&!_[_0xe27b('0x56')](_0x15aa35[_0xe27b('0x55')][_0xe27b('0x57')],'_')){_0x15aa35[_0xe27b('0x55')]['exten']='_'[_0xe27b('0x58')](_0x15aa35[_0xe27b('0x55')][_0xe27b('0x57')]);}return db[_0xe27b('0x39')][_0xe27b('0x54')](_0x15aa35[_0xe27b('0x55')],{'raw':![]})['then'](function(_0x2f7c5c){var _0x4b2ee9=_0x15aa35[_0xe27b('0x59')][_0xe27b('0x2a')]({'plain':!![]});if(!_0x4b2ee9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2ee9['role']==='user'){var _0x2cb6e9=_0x2f7c5c[_0xe27b('0x2a')]({'plain':!![]});var _0x5ba15d=[{'name':_0xe27b('0x2b'),'value':_0xe27b('0x5a')},{'name':_0xe27b('0x2c'),'value':'outbound'},{'name':_0xe27b('0x5b'),'value':_0xe27b('0x2e')}];var _0x30fe28=_['find'](_0x5ba15d,[_0xe27b('0x30'),_0x2cb6e9[_0xe27b('0x32')]])['name'];return db[_0xe27b('0x5c')][_0xe27b('0x33')]({'where':{'name':_0x30fe28,'userProfileId':_0x4b2ee9[_0xe27b('0x5d')]},'raw':!![]})[_0xe27b('0x28')](function(_0x8d0dcb){if(_0x8d0dcb&&_0x8d0dcb['autoAssociation']===0x0){return db[_0xe27b('0x35')]['create']({'name':_0x2cb6e9[_0xe27b('0x34')],'resourceId':_0x2cb6e9['id'],'type':_0x8d0dcb['name'],'sectionId':_0x8d0dcb['id']},{})['then'](function(){return _0x2f7c5c;});}else{return _0x2f7c5c;}})[_0xe27b('0x50')](function(_0x152441){logger['error'](_0xe27b('0x5e'),_0x152441);throw _0x152441;});}return _0x2f7c5c;})['then'](respondWithResult(_0x3e048e,0xc9))['catch'](handleError(_0x3e048e,null));};exports['update']=function(_0x3af835,_0x488cb6){if(_0x3af835['body']['id']){delete _0x3af835[_0xe27b('0x55')]['id'];}return db[_0xe27b('0x39')][_0xe27b('0x33')]({'where':{'id':_0x3af835[_0xe27b('0x52')]['id']}})[_0xe27b('0x28')](handleEntityNotFound(_0x488cb6,null))[_0xe27b('0x28')](function(_0xc8be05){if(_0xc8be05){return db['VoiceExtension'][_0xe27b('0x5f')](_[_0xe27b('0x4a')](_0x3af835[_0xe27b('0x55')],[_0xe27b('0x57'),_0xe27b('0x60'),_0xe27b('0x61'),'recordingFormat',_0xe27b('0x62'),_0xe27b('0x63')]),{'where':{'context':_0xc8be05[_0xe27b('0x60')],'exten':_0xc8be05[_0xe27b('0x57')]},'individualHooks':!![]})[_0xe27b('0x28')](function(_0x3e8bd8){return _0x3e8bd8;});}return null;})[_0xe27b('0x28')](respondWithStatusCode(_0x488cb6,null))[_0xe27b('0x50')](handleError(_0x488cb6,null));};exports['addApplications']=function(_0x41bc6b,_0x4cf4e7,_0x2b4fd4){return db['VoiceExtension'][_0xe27b('0x64')]({'where':{'id':_0x41bc6b[_0xe27b('0x52')]['id']}})[_0xe27b('0x28')](handleEntityNotFound(_0x4cf4e7,null))[_0xe27b('0x28')](function(_0xef495d){if(_0xef495d){return db[_0xe27b('0x65')][_0xe27b('0x66')](function(_0x314b71){return db[_0xe27b('0x39')][_0xe27b('0x29')]({'where':{'VoiceExtensionId':_0x41bc6b[_0xe27b('0x52')]['id']},'transaction':_0x314b71})[_0xe27b('0x28')](function(_0x37ca41){var _0x4b4de8=_['map'](_0x41bc6b[_0xe27b('0x55')],function(_0x3248b0){_0x3248b0[_0xe27b('0x67')]=_0x41bc6b[_0xe27b('0x52')]['id'];return _0x3248b0;});return db[_0xe27b('0x39')][_0xe27b('0x68')](_0x4b4de8,{'transaction':_0x314b71});});})[_0xe27b('0x28')](function(){return db[_0xe27b('0x39')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x41bc6b['params']['id']},'order':_0xe27b('0x69')});});}})[_0xe27b('0x28')](respondWithResult(_0x4cf4e7,null))[_0xe27b('0x50')](handleError(_0x4cf4e7,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b857fd2..f4e7907 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 _0x8997=['VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3f34e3,_0x462e36){var _0xe9f307=function(_0x2d3f61){while(--_0x2d3f61){_0x3f34e3['push'](_0x3f34e3['shift']());}};_0xe9f307(++_0x462e36);}(_0x8997,0x18e));var _0x7899=function(_0x1573da,_0x10b4f4){_0x1573da=_0x1573da-0x0;var _0x3bf905=_0x8997[_0x1573da];return _0x3bf905;};'use strict';var EventEmitter=require(_0x7899('0x0'));var VoiceExtension=require(_0x7899('0x1'))['db'][_0x7899('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7899('0x3')](0x0);var events={'afterCreate':_0x7899('0x4'),'afterUpdate':_0x7899('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3b5d92){return function(_0x4a897e,_0x156d70,_0x4a3496){VoiceExtensionEvents[_0x7899('0x6')](_0x3b5d92+':'+_0x4a897e['id'],_0x4a897e);VoiceExtensionEvents[_0x7899('0x6')](_0x3b5d92,_0x4a897e);_0x4a3496(null);};}for(var e in events){if(events[_0x7899('0x7')](e)){var event=events[e];VoiceExtension[_0x7899('0x8')](e,emitEvent(event));}}module[_0x7899('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6bd6=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x6bd6,0x17d));var _0x66bd=function(_0x194618,_0x2b8535){_0x194618=_0x194618-0x0;var _0x3a6638=_0x6bd6[_0x194618];return _0x3a6638;};'use strict';var EventEmitter=require(_0x66bd('0x0'));var VoiceExtension=require(_0x66bd('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x66bd('0x2')](0x0);var events={'afterCreate':_0x66bd('0x3'),'afterUpdate':_0x66bd('0x4'),'afterDestroy':_0x66bd('0x5')};function emitEvent(_0x39447a){return function(_0x40115e,_0x5b8843,_0x4609c1){VoiceExtensionEvents[_0x66bd('0x6')](_0x39447a+':'+_0x40115e['id'],_0x40115e);VoiceExtensionEvents['emit'](_0x39447a,_0x40115e);_0x4609c1(null);};}for(var e in events){if(events[_0x66bd('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x66bd('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6435888..e4ee131 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 _0x1d43=['lodash','util','moment','bluebird','request-promise','path','rimraf','define','VoiceExtension','voice_extensions'];(function(_0x3f1d77,_0x14cf84){var _0x8dc1e5=function(_0x374925){while(--_0x374925){_0x3f1d77['push'](_0x3f1d77['shift']());}};_0x8dc1e5(++_0x14cf84);}(_0x1d43,0x1c2));var _0x31d4=function(_0x5e4360,_0x2b3d33){_0x5e4360=_0x5e4360-0x0;var _0x9cdbf0=_0x1d43[_0x5e4360];return _0x9cdbf0;};'use strict';var _=require(_0x31d4('0x0'));var util=require(_0x31d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31d4('0x2'));var BPromise=require(_0x31d4('0x3'));var rp=require(_0x31d4('0x4'));var fs=require('fs');var path=require(_0x31d4('0x5'));var rimraf=require(_0x31d4('0x6'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x234ead,_0x5be021){return _0x234ead[_0x31d4('0x7')](_0x31d4('0x8'),attributes,{'tableName':_0x31d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9b2=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','lodash'];(function(_0x410a16,_0x5655c4){var _0x1d67b8=function(_0x14bcf6){while(--_0x14bcf6){_0x410a16['push'](_0x410a16['shift']());}};_0x1d67b8(++_0x5655c4);}(_0xa9b2,0xbf));var _0x2a9b=function(_0x404b9a,_0xca0480){_0x404b9a=_0x404b9a-0x0;var _0x30ba61=_0xa9b2[_0x404b9a];return _0x30ba61;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var logger=require(_0x2a9b('0x2'))('api');var moment=require(_0x2a9b('0x3'));var BPromise=require(_0x2a9b('0x4'));var rp=require(_0x2a9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a9b('0x6'));var config=require(_0x2a9b('0x7'));var attributes=require(_0x2a9b('0x8'));module[_0x2a9b('0x9')]=function(_0x495b73,_0x345b91){return _0x495b73[_0x2a9b('0xa')](_0x2a9b('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e43579e..eaf007b 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 _0x9f60=['error','code','message','result','catch','VoiceExtension','options','raw','limit','include','map','model','attributes','then','GetVoiceExtension','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x9f60,0x7b));var _0x09f6=function(_0x3f139a,_0x4d3b2f){_0x3f139a=_0x3f139a-0x0;var _0x13afc6=_0x9f60[_0x3f139a];return _0x13afc6;};'use strict';var _=require(_0x09f6('0x0'));var util=require(_0x09f6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09f6('0x2'));var fs=require('fs');var Redis=require(_0x09f6('0x3'));var db=require(_0x09f6('0x4'))['db'];var utils=require(_0x09f6('0x5'));var logger=require(_0x09f6('0x6'))('rpc');var config=require(_0x09f6('0x7'));var jayson=require(_0x09f6('0x8'));var client=jayson[_0x09f6('0x9')][_0x09f6('0xa')]({'port':0x232a});config['redis']=_[_0x09f6('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x09f6('0xc'))(new Redis(config[_0x09f6('0xd')]));require('./voiceExtension.socket')[_0x09f6('0xe')](socket);function respondWithRpcPromise(_0x28658b,_0x22428f,_0x5bfa3f){return new BPromise(function(_0x4ddc3a,_0x5e9ba2){return client['request'](_0x28658b,_0x5bfa3f)['then'](function(_0x275123){logger[_0x09f6('0xf')](_0x09f6('0x10'),_0x22428f,_0x09f6('0x11'));logger[_0x09f6('0x12')](_0x09f6('0x13'),_0x22428f,_0x09f6('0x11'),JSON[_0x09f6('0x14')](_0x275123));if(_0x275123[_0x09f6('0x15')]){if(_0x275123[_0x09f6('0x15')][_0x09f6('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x22428f,_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);return _0x5e9ba2(_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);}logger[_0x09f6('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x22428f,_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);return _0x4ddc3a(_0x275123[_0x09f6('0x15')][_0x09f6('0x17')]);}else{logger[_0x09f6('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x22428f,'request\x20sent');_0x4ddc3a(_0x275123[_0x09f6('0x18')][_0x09f6('0x17')]);}})[_0x09f6('0x19')](function(_0x339614){logger[_0x09f6('0x15')](_0x09f6('0x10'),_0x22428f,_0x339614);_0x5e9ba2(_0x339614);});});}exports['GetVoiceExtension']=function(_0x53fc2c){var _0x506872=this;return new Promise(function(_0x3589a1,_0x4e63b4){return db[_0x09f6('0x1a')]['findAll']({'raw':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')]['where']||null:null,'attributes':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')]['attributes']||null:null,'limit':_0x53fc2c['options']?_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1d')]||null:null,'include':_0x53fc2c[_0x09f6('0x1b')]?_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1e')]?_[_0x09f6('0x1f')](_0x53fc2c[_0x09f6('0x1b')][_0x09f6('0x1e')],function(_0x20c70c){return{'model':db[_0x20c70c[_0x09f6('0x20')]],'as':_0x20c70c['as'],'attributes':_0x20c70c[_0x09f6('0x21')],'include':_0x20c70c['include']?_['map'](_0x20c70c['include'],function(_0x5e32ed){return{'model':db[_0x5e32ed[_0x09f6('0x20')]],'as':_0x5e32ed['as'],'attributes':_0x5e32ed['attributes'],'include':_0x5e32ed['include']?_[_0x09f6('0x1f')](_0x5e32ed[_0x09f6('0x1e')],function(_0x4f2f2b){return{'model':db[_0x4f2f2b['model']],'as':_0x4f2f2b['as'],'attributes':_0x4f2f2b[_0x09f6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x09f6('0x22')](function(_0x41ea30){logger[_0x09f6('0xf')](_0x09f6('0x23'),_0x53fc2c);logger[_0x09f6('0x12')](_0x09f6('0x23'),_0x53fc2c,JSON[_0x09f6('0x14')](_0x41ea30));_0x3589a1(_0x41ea30);})['catch'](function(_0x3b45ca){logger[_0x09f6('0x15')](_0x09f6('0x23'),_0x3b45ca[_0x09f6('0x17')],_0x53fc2c);_0x4e63b4(_0x506872['error'](0x1f4,_0x3b45ca[_0x09f6('0x17')]));});});}; \ No newline at end of file +var _0xc628=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xc628,0x196));var _0x8c62=function(_0x461c63,_0x38147e){_0x461c63=_0x461c63-0x0;var _0x29c6f1=_0xc628[_0x461c63];return _0x29c6f1;};'use strict';var _=require(_0x8c62('0x0'));var util=require(_0x8c62('0x1'));var moment=require(_0x8c62('0x2'));var BPromise=require(_0x8c62('0x3'));var rs=require(_0x8c62('0x4'));var fs=require('fs');var Redis=require(_0x8c62('0x5'));var db=require(_0x8c62('0x6'))['db'];var utils=require(_0x8c62('0x7'));var logger=require(_0x8c62('0x8'))(_0x8c62('0x9'));var config=require(_0x8c62('0xa'));var jayson=require(_0x8c62('0xb'));var client=jayson[_0x8c62('0xc')][_0x8c62('0xd')]({'port':0x232a});config[_0x8c62('0xe')]=_['defaults'](config[_0x8c62('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c62('0xf'))(new Redis(config[_0x8c62('0xe')]));require(_0x8c62('0x10'))[_0x8c62('0x11')](socket);function respondWithRpcPromise(_0x19acfc,_0x112704,_0x234a22){return new BPromise(function(_0x55f926,_0x1d3538){return client[_0x8c62('0x12')](_0x19acfc,_0x234a22)[_0x8c62('0x13')](function(_0x1c852a){logger['info'](_0x8c62('0x14'),_0x112704,_0x8c62('0x15'));logger['debug'](_0x8c62('0x16'),_0x112704,_0x8c62('0x15'),JSON[_0x8c62('0x17')](_0x1c852a));if(_0x1c852a['error']){if(_0x1c852a[_0x8c62('0x18')][_0x8c62('0x19')]===0x1f4){logger[_0x8c62('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x112704,_0x1c852a[_0x8c62('0x18')][_0x8c62('0x1a')]);return _0x1d3538(_0x1c852a[_0x8c62('0x18')]['message']);}logger[_0x8c62('0x18')](_0x8c62('0x14'),_0x112704,_0x1c852a[_0x8c62('0x18')][_0x8c62('0x1a')]);return _0x55f926(_0x1c852a['error'][_0x8c62('0x1a')]);}else{logger[_0x8c62('0x1b')](_0x8c62('0x14'),_0x112704,_0x8c62('0x15'));_0x55f926(_0x1c852a[_0x8c62('0x1c')][_0x8c62('0x1a')]);}})[_0x8c62('0x1d')](function(_0x3d865a){logger['error'](_0x8c62('0x14'),_0x112704,_0x3d865a);_0x1d3538(_0x3d865a);});});}exports[_0x8c62('0x1e')]=function(_0xb9caea){var _0x7744c2=this;return new Promise(function(_0x39794e,_0x43d7be){return db[_0x8c62('0x1f')][_0x8c62('0x20')]({'raw':_0xb9caea['options']?_0xb9caea['options']['raw']===undefined?!![]:![]:!![],'where':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x22')]||null:null,'attributes':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x23')]||null:null,'limit':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x24')]||null:null,'include':_0xb9caea[_0x8c62('0x21')]?_0xb9caea[_0x8c62('0x21')][_0x8c62('0x25')]?_[_0x8c62('0x26')](_0xb9caea[_0x8c62('0x21')]['include'],function(_0x5eaca1){return{'model':db[_0x5eaca1[_0x8c62('0x27')]],'as':_0x5eaca1['as'],'attributes':_0x5eaca1['attributes'],'include':_0x5eaca1['include']?_[_0x8c62('0x26')](_0x5eaca1['include'],function(_0x1ffc50){return{'model':db[_0x1ffc50[_0x8c62('0x27')]],'as':_0x1ffc50['as'],'attributes':_0x1ffc50[_0x8c62('0x23')],'include':_0x1ffc50[_0x8c62('0x25')]?_[_0x8c62('0x26')](_0x1ffc50[_0x8c62('0x25')],function(_0x18d3a1){return{'model':db[_0x18d3a1['model']],'as':_0x18d3a1['as'],'attributes':_0x18d3a1[_0x8c62('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8c62('0x13')](function(_0x175b7a){logger[_0x8c62('0x1b')](_0x8c62('0x1e'),_0xb9caea);logger[_0x8c62('0x28')](_0x8c62('0x1e'),_0xb9caea,JSON['stringify'](_0x175b7a));_0x39794e(_0x175b7a);})[_0x8c62('0x1d')](function(_0x20d7ca){logger[_0x8c62('0x18')]('GetVoiceExtension',_0x20d7ca['message'],_0xb9caea);_0x43d7be(_0x7744c2[_0x8c62('0x18')](0x1f4,_0x20d7ca[_0x8c62('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 812ff07..f246c97 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 _0xd623=['remove','emit','removeListener','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4b6373,_0x11004a){var _0x42a1b0=function(_0x593df9){while(--_0x593df9){_0x4b6373['push'](_0x4b6373['shift']());}};_0x42a1b0(++_0x11004a);}(_0xd623,0x1ef));var _0x3d62=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xd623[_0x36ed48];return _0x51c63a;};'use strict';var VoiceExtensionEvents=require(_0x3d62('0x0'));var events=[_0x3d62('0x1'),_0x3d62('0x2'),'update'];function createListener(_0x2cf6e5,_0x1e3d25){return function(_0x7e6777){_0x1e3d25[_0x3d62('0x3')](_0x2cf6e5,_0x7e6777);};}function removeListener(_0x3a8cbe,_0x414378){return function(){VoiceExtensionEvents[_0x3d62('0x4')](_0x3a8cbe,_0x414378);};}exports['register']=function(_0x3b0cc2){for(var _0x248984=0x0,_0x3ae1ff=events[_0x3d62('0x5')];_0x248984<_0x3ae1ff;_0x248984++){var _0x260ed8=events[_0x248984];var _0x5ecf33=createListener(_0x3d62('0x6')+_0x260ed8,_0x3b0cc2);VoiceExtensionEvents['on'](_0x260ed8,_0x5ecf33);}}; \ No newline at end of file +var _0x18ed=['./voiceExtension.events','remove','update','emit','removeListener','length'];(function(_0x46f1fa,_0x1b583f){var _0x2e4360=function(_0x262dcb){while(--_0x262dcb){_0x46f1fa['push'](_0x46f1fa['shift']());}};_0x2e4360(++_0x1b583f);}(_0x18ed,0x1e0));var _0xd18e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x18ed[_0x565c49];return _0x20ca34;};'use strict';var VoiceExtensionEvents=require(_0xd18e('0x0'));var events=['save',_0xd18e('0x1'),_0xd18e('0x2')];function createListener(_0x576bf4,_0x44b1c5){return function(_0x30082a){_0x44b1c5[_0xd18e('0x3')](_0x576bf4,_0x30082a);};}function removeListener(_0x1edb5f,_0x3539fb){return function(){VoiceExtensionEvents[_0xd18e('0x4')](_0x1edb5f,_0x3539fb);};}exports['register']=function(_0x415056){for(var _0x3bd967=0x0,_0x543743=events[_0xd18e('0x5')];_0x3bd967<_0x543743;_0x3bd967++){var _0x189035=events[_0x3bd967];var _0x3f80a3=createListener('voiceExtension:'+_0x189035,_0x415056);VoiceExtensionEvents['on'](_0x189035,_0x3f80a3);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9cc47e8..d2b3688 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 _0x1295=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1295,0x123));var _0x5129=function(_0x250783,_0x2e7ff9){_0x250783=_0x250783-0x0;var _0x2d7e03=_0x1295[_0x250783];return _0x2d7e03;};'use strict';var multer=require(_0x5129('0x0'));var util=require('util');var path=require(_0x5129('0x1'));var timeout=require(_0x5129('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5129('0x3'));var config=require(_0x5129('0x4'));var controller=require('./voiceMail.controller');router[_0x5129('0x5')]('/',auth[_0x5129('0x6')](),controller[_0x5129('0x7')]);router[_0x5129('0x5')](_0x5129('0x8'),auth[_0x5129('0x6')](),controller[_0x5129('0x9')]);router['get'](_0x5129('0xa'),auth[_0x5129('0x6')](),controller[_0x5129('0xb')]);router[_0x5129('0xc')]('/',auth[_0x5129('0x6')](),controller[_0x5129('0xd')]);router[_0x5129('0xe')]('/:id',auth[_0x5129('0x6')](),controller[_0x5129('0xf')]);router[_0x5129('0x10')](_0x5129('0x8'),auth[_0x5129('0x6')](),controller[_0x5129('0x11')]);module[_0x5129('0x12')]=router; \ No newline at end of file +var _0x3690=['isAuthenticated','index','/:id/messages','post','create','put','/:id','update','delete','multer','path','express','../../components/interaction/service','./voiceMail.controller'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3690,0x1c9));var _0x0369=function(_0x867c94,_0x44ec82){_0x867c94=_0x867c94-0x0;var _0x5a51a4=_0x3690[_0x867c94];return _0x5a51a4;};'use strict';var multer=require(_0x0369('0x0'));var util=require('util');var path=require(_0x0369('0x1'));var timeout=require('connect-timeout');var express=require(_0x0369('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0369('0x3'));var config=require('../../config/environment');var controller=require(_0x0369('0x4'));router['get']('/',auth[_0x0369('0x5')](),controller[_0x0369('0x6')]);router['get']('/:id',auth[_0x0369('0x5')](),controller['show']);router['get'](_0x0369('0x7'),auth[_0x0369('0x5')](),controller['getMessages']);router[_0x0369('0x8')]('/',auth[_0x0369('0x5')](),controller[_0x0369('0x9')]);router[_0x0369('0xa')](_0x0369('0xb'),auth['isAuthenticated'](),controller[_0x0369('0xc')]);router[_0x0369('0xd')](_0x0369('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c46654d..d2ea113 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 _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x4c97d4,_0x19c6d2){var _0x3be2e1=function(_0x39e521){while(--_0x39e521){_0x4c97d4['push'](_0x4c97d4['shift']());}};_0x3be2e1(++_0x19c6d2);}(_0x13f6,0x124));var _0x613f=function(_0x267280,_0x447862){_0x267280=_0x267280-0x0;var _0x1015ef=_0x13f6[_0x267280];return _0x1015ef;};'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 +var _0x80ed=['setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox'];(function(_0x2ba807,_0x8e028f){var _0x2acc06=function(_0x147100){while(--_0x147100){_0x2ba807['push'](_0x2ba807['shift']());}};_0x2acc06(++_0x8e028f);}(_0x80ed,0x11c));var _0xd80e=function(_0x32de1e,_0x5c3d68){_0x32de1e=_0x32de1e-0x0;var _0x5301f8=_0x80ed[_0x32de1e];return _0x5301f8;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xd80e('0x1')]},'context':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'','allowNull':![],'unique':_0xd80e('0x3')},'password':{'type':Sequelize[_0xd80e('0x1')]},'fullname':{'type':Sequelize[_0xd80e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x26e6ff){this[_0xd80e('0x4')](_0xd80e('0x5'),typeof _0x26e6ff==='string'&&_0x26e6ff[_0xd80e('0x6')]()?_0x26e6ff[_0xd80e('0x6')]():null);}},'pager':{'type':Sequelize[_0xd80e('0x1')]},'tz':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':_0xd80e('0x7')},'attach':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xd80e('0x1')]},'callback':{'type':Sequelize[_0xd80e('0x1')]},'review':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd80e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd80e('0x8')](_0xd80e('0x9'),'no'),'defaultValue':_0xd80e('0x9'),'allowNull':![]},'stamp':{'type':_0xd80e('0xa')},'emailsubject':{'type':Sequelize[_0xd80e('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd80e('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd80e('0xc')],'get':function(){return this[_0xd80e('0xd')]('fullname')+_0xd80e('0xe')+this[_0xd80e('0xd')](_0xd80e('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ef071e4..3499be4 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 _0x1f75=['fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','catch','show','keys','rawAttributes','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','params','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','Voicemails','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1f75,0x13c));var _0x51f7=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1f75[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x51f7('0x0'));var rimraf=require(_0x51f7('0x1'));var zipdir=require(_0x51f7('0x2'));var jsonpatch=require(_0x51f7('0x3'));var rp=require(_0x51f7('0x4'));var moment=require('moment');var BPromise=require(_0x51f7('0x5'));var Mustache=require(_0x51f7('0x6'));var util=require(_0x51f7('0x7'));var path=require(_0x51f7('0x8'));var sox=require(_0x51f7('0x9'));var csv=require(_0x51f7('0xa'));var ejs=require(_0x51f7('0xb'));var fs=require('fs');var _=require(_0x51f7('0xc'));var squel=require(_0x51f7('0xd'));var crypto=require(_0x51f7('0xe'));var jsforce=require(_0x51f7('0xf'));var deskjs=require(_0x51f7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x51f7('0x11'));var Papa=require(_0x51f7('0x12'));var Redis=require('ioredis');var authService=require(_0x51f7('0x13'));var qs=require(_0x51f7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51f7('0x15'))(_0x51f7('0x16'));var utils=require('../../config/utils');var config=require(_0x51f7('0x17'));var licenseUtil=require(_0x51f7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452c6b,_0x180e9d){_0x180e9d=_0x180e9d||0xcc;return function(_0x11cc37){if(_0x11cc37){return _0x452c6b['sendStatus'](_0x180e9d);}return _0x452c6b['status'](_0x180e9d)[_0x51f7('0x19')]();};}function respondWithResult(_0x29884b,_0x3c4b5a){_0x3c4b5a=_0x3c4b5a||0xc8;return function(_0x3fc869){if(_0x3fc869){return _0x29884b[_0x51f7('0x1a')](_0x3c4b5a)[_0x51f7('0x1b')](_0x3fc869);}};}function respondWithFilteredResult(_0x56f9e3,_0x10aa7f){return function(_0x6e0f2e){if(_0x6e0f2e){var _0x12e09d=_0x6e0f2e[_0x51f7('0x1c')],_0x23998b=_0x10aa7f['offset'],_0x350b32=_0x10aa7f[_0x51f7('0x1d')]+_0x10aa7f[_0x51f7('0x1e')],_0x1b3532;if(_0x350b32>=_0x12e09d){_0x350b32=_0x12e09d;_0x1b3532=0xc8;}else{_0x1b3532=0xce;}_0x56f9e3['status'](_0x1b3532);return _0x56f9e3[_0x51f7('0x1f')](_0x51f7('0x20'),_0x23998b+'-'+_0x350b32+'/'+_0x12e09d)['json'](_0x6e0f2e);}return null;};}function patchUpdates(_0x57b918){return function(_0x564686){try{jsonpatch[_0x51f7('0x21')](_0x564686,_0x57b918,!![]);}catch(_0x5a4e63){return BPromise['reject'](_0x5a4e63);}return _0x564686[_0x51f7('0x22')]();};}function saveUpdates(_0x1decc1,_0x475566){return function(_0x311e00){if(_0x311e00){return _0x311e00[_0x51f7('0x23')](_0x1decc1)[_0x51f7('0x24')](function(_0xb501de){return _0xb501de;});}return null;};}function removeEntity(_0x22f585,_0x4e277e){return function(_0x28566c){if(_0x28566c){return _0x28566c['destroy']()[_0x51f7('0x24')](function(){var _0x38801b=_0x28566c[_0x51f7('0x25')]({'plain':!![]});var _0x1bde25=_0x51f7('0x26');return db[_0x51f7('0x27')][_0x51f7('0x28')]({'where':{'type':_0x1bde25,'resourceId':_0x38801b['id']}})[_0x51f7('0x24')](function(){return _0x28566c;});})[_0x51f7('0x24')](function(){_0x22f585[_0x51f7('0x1a')](0xcc)[_0x51f7('0x19')]();});}};}function handleEntityNotFound(_0x47ed7c,_0xb6aec9){return function(_0x384ca0){if(!_0x384ca0){_0x47ed7c[_0x51f7('0x29')](0x194);}return _0x384ca0;};}function handleError(_0x54bf48,_0x1bcb72){_0x1bcb72=_0x1bcb72||0x1f4;return function(_0x11e723){logger[_0x51f7('0x2a')](_0x11e723[_0x51f7('0x2b')]);if(_0x11e723['name']){delete _0x11e723[_0x51f7('0x2c')];}_0x54bf48[_0x51f7('0x1a')](_0x1bcb72)[_0x51f7('0x2d')](_0x11e723);};}exports[_0x51f7('0x2e')]=function(_0xf70aa2,_0x4bced1){var _0x31cf1f={},_0x32056c={},_0x31b26e={'count':0x0,'rows':[]};var _0x56b181=_[_0x51f7('0x2f')](db['VoiceMail']['rawAttributes'],function(_0x12a9ce){return{'name':_0x12a9ce[_0x51f7('0x30')],'type':_0x12a9ce[_0x51f7('0x31')][_0x51f7('0x32')]};});_0x32056c[_0x51f7('0x33')]=_[_0x51f7('0x2f')](_0x56b181,_0x51f7('0x2c'));_0x32056c['query']=_['keys'](_0xf70aa2[_0x51f7('0x34')]);_0x32056c[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x32056c[_0x51f7('0x33')],_0x32056c[_0x51f7('0x34')]);_0x31cf1f[_0x51f7('0x37')]=_[_0x51f7('0x36')](_0x32056c[_0x51f7('0x33')],qs[_0x51f7('0x38')](_0xf70aa2['query'][_0x51f7('0x38')]));_0x31cf1f['attributes']=_0x31cf1f[_0x51f7('0x37')]['length']?_0x31cf1f[_0x51f7('0x37')]:_0x32056c['model'];if(!_0xf70aa2[_0x51f7('0x34')]['hasOwnProperty'](_0x51f7('0x39'))){_0x31cf1f[_0x51f7('0x1e')]=qs[_0x51f7('0x1e')](_0xf70aa2['query'][_0x51f7('0x1e')]);_0x31cf1f[_0x51f7('0x1d')]=qs['offset'](_0xf70aa2['query']['offset']);}_0x31cf1f[_0x51f7('0x3a')]=qs[_0x51f7('0x3b')](_0xf70aa2[_0x51f7('0x34')]['sort']);_0x31cf1f[_0x51f7('0x3c')]=qs[_0x51f7('0x35')](_[_0x51f7('0x3d')](_0xf70aa2['query'],_0x32056c[_0x51f7('0x35')]),_0x56b181);if(_0xf70aa2[_0x51f7('0x34')][_0x51f7('0x3e')]){_0x31cf1f['where']=_[_0x51f7('0x3f')](_0x31cf1f[_0x51f7('0x3c')],{'$or':_[_0x51f7('0x2f')](_0x56b181,function(_0x48ba5b){if(_0x48ba5b[_0x51f7('0x31')]!==_0x51f7('0x40')){var _0x9ba482={};_0x9ba482[_0x48ba5b[_0x51f7('0x2c')]]={'$like':'%'+_0xf70aa2[_0x51f7('0x34')]['filter']+'%'};return _0x9ba482;}})});}_0x31cf1f=_[_0x51f7('0x3f')]({},_0x31cf1f,_0xf70aa2[_0x51f7('0x41')]);var _0xd30b96={'where':_0x31cf1f[_0x51f7('0x3c')]};return db['VoiceMail'][_0x51f7('0x1c')](_0xd30b96)['then'](function(_0x11f94c){_0x31b26e[_0x51f7('0x1c')]=_0x11f94c;if(_0xf70aa2[_0x51f7('0x34')][_0x51f7('0x42')]){_0x31cf1f[_0x51f7('0x43')]=[{'all':!![]}];}return db[_0x51f7('0x44')][_0x51f7('0x45')](_0x31cf1f);})[_0x51f7('0x24')](function(_0x4099f0){_0x31b26e[_0x51f7('0x46')]=_0x4099f0;return _0x31b26e;})[_0x51f7('0x24')](respondWithFilteredResult(_0x4bced1,_0x31cf1f))[_0x51f7('0x47')](handleError(_0x4bced1,null));};exports[_0x51f7('0x48')]=function(_0x52d6fb,_0x53ba21){var _0xe474f7={'raw':!![],'where':{'id':_0x52d6fb['params']['id']}},_0x3b8215={};_0x3b8215['model']=_[_0x51f7('0x49')](db[_0x51f7('0x44')][_0x51f7('0x4a')]);_0x3b8215['query']=_[_0x51f7('0x49')](_0x52d6fb[_0x51f7('0x34')]);_0x3b8215[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x3b8215['model'],_0x3b8215[_0x51f7('0x34')]);_0xe474f7[_0x51f7('0x37')]=_[_0x51f7('0x36')](_0x3b8215[_0x51f7('0x33')],qs[_0x51f7('0x38')](_0x52d6fb[_0x51f7('0x34')][_0x51f7('0x38')]));_0xe474f7[_0x51f7('0x37')]=_0xe474f7['attributes'][_0x51f7('0x4b')]?_0xe474f7['attributes']:_0x3b8215[_0x51f7('0x33')];if(_0x52d6fb[_0x51f7('0x34')][_0x51f7('0x42')]){_0xe474f7[_0x51f7('0x43')]=[{'all':!![]}];}_0xe474f7=_[_0x51f7('0x3f')]({},_0xe474f7,_0x52d6fb[_0x51f7('0x41')]);return db[_0x51f7('0x44')][_0x51f7('0x4c')](_0xe474f7)['then'](handleEntityNotFound(_0x53ba21,null))[_0x51f7('0x24')](respondWithResult(_0x53ba21,null))['catch'](handleError(_0x53ba21,null));};exports[_0x51f7('0x4d')]=function(_0x5655c0,_0x20a2ae){return db['VoiceMail'][_0x51f7('0x4d')](_0x5655c0[_0x51f7('0x4e')],{})[_0x51f7('0x24')](function(_0x501cb8){var _0x5c0207=_0x5655c0[_0x51f7('0x4f')][_0x51f7('0x25')]({'plain':!![]});if(!_0x5c0207)throw new Error(_0x51f7('0x50'));if(_0x5c0207[_0x51f7('0x51')]===_0x51f7('0x4f')){var _0x3c6f9f=_0x501cb8[_0x51f7('0x25')]({'plain':!![]});var _0x416ac=_0x51f7('0x26');return db[_0x51f7('0x52')][_0x51f7('0x4c')]({'where':{'name':_0x416ac,'userProfileId':_0x5c0207[_0x51f7('0x53')]},'raw':!![]})['then'](function(_0x2a66ba){if(_0x2a66ba&&_0x2a66ba[_0x51f7('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c6f9f[_0x51f7('0x2c')],'resourceId':_0x3c6f9f['id'],'type':_0x2a66ba['name'],'sectionId':_0x2a66ba['id']},{})[_0x51f7('0x24')](function(){return _0x501cb8;});}else{return _0x501cb8;}})[_0x51f7('0x47')](function(_0x3d2984){logger['error'](_0x51f7('0x55'),_0x3d2984);throw _0x3d2984;});}return _0x501cb8;})['then'](respondWithResult(_0x20a2ae,0xc9))[_0x51f7('0x47')](handleError(_0x20a2ae,null));};exports[_0x51f7('0x23')]=function(_0x1eadbc,_0x80beab){if(_0x1eadbc[_0x51f7('0x4e')]['id']){delete _0x1eadbc['body']['id'];}return db[_0x51f7('0x44')][_0x51f7('0x4c')]({'where':{'id':_0x1eadbc[_0x51f7('0x56')]['id']}})[_0x51f7('0x24')](handleEntityNotFound(_0x80beab,null))[_0x51f7('0x24')](saveUpdates(_0x1eadbc[_0x51f7('0x4e')],null))['then'](respondWithResult(_0x80beab,null))[_0x51f7('0x47')](handleError(_0x80beab,null));};exports['destroy']=function(_0x1ed831,_0x2e2816){return db['VoiceMail'][_0x51f7('0x4c')]({'where':{'id':_0x1ed831[_0x51f7('0x56')]['id']}})[_0x51f7('0x24')](handleEntityNotFound(_0x2e2816,null))['then'](removeEntity(_0x2e2816,null))[_0x51f7('0x47')](handleError(_0x2e2816,null));};exports['getMessages']=function(_0x127364,_0xf5f54f,_0x14d71c){return db[_0x51f7('0x44')][_0x51f7('0x57')]({'where':{'id':_0x127364[_0x51f7('0x56')]['id']}})[_0x51f7('0x24')](handleEntityNotFound(_0xf5f54f,null))[_0x51f7('0x24')](function(_0x5113d3){var _0x124415;var _0x23f751={},_0x3cceea={};_0x3cceea[_0x51f7('0x33')]=_[_0x51f7('0x49')](db[_0x51f7('0x58')][_0x51f7('0x4a')]);_0x3cceea['query']=_[_0x51f7('0x49')](_0x127364[_0x51f7('0x34')]);_0x3cceea[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x3cceea[_0x51f7('0x33')],_0x3cceea[_0x51f7('0x34')]);_0x23f751[_0x51f7('0x37')]=_[_0x51f7('0x36')](_0x3cceea[_0x51f7('0x33')],qs[_0x51f7('0x38')](_0x127364[_0x51f7('0x34')][_0x51f7('0x38')]));_0x23f751[_0x51f7('0x37')]=_0x23f751[_0x51f7('0x37')]['length']?_0x23f751['attributes']:_0x3cceea[_0x51f7('0x33')];if(!_0x127364['query'][_0x51f7('0x59')](_0x51f7('0x39'))){_0x23f751[_0x51f7('0x1e')]=qs['limit'](_0x127364[_0x51f7('0x34')]['limit']);_0x23f751[_0x51f7('0x1d')]=qs[_0x51f7('0x1d')](_0x127364[_0x51f7('0x34')][_0x51f7('0x1d')]);}_0x23f751[_0x51f7('0x3a')]=qs[_0x51f7('0x3b')](_0x127364[_0x51f7('0x34')][_0x51f7('0x3b')]);_0x23f751['where']=qs[_0x51f7('0x35')](_[_0x51f7('0x3d')](_0x127364[_0x51f7('0x34')],_0x3cceea[_0x51f7('0x35')]));if(_0x127364[_0x51f7('0x34')]['filter']){_0x23f751['where']=_['merge'](_0x23f751[_0x51f7('0x3c')],{'$or':_[_0x51f7('0x2f')](_0x23f751['attributes'],function(_0xe5988d){var _0xcfabd6={};_0xcfabd6[_0xe5988d]={'$like':'%'+_0x127364[_0x51f7('0x34')][_0x51f7('0x3e')]+'%'};return _0xcfabd6;})});}_0x23f751[_0x51f7('0x3c')]=_[_0x51f7('0x3f')](_0x23f751[_0x51f7('0x3c')],{'mailboxuser':_0x5113d3['mailbox']});_0x23f751=_[_0x51f7('0x3f')]({},_0x23f751,_0x127364[_0x51f7('0x41')]);return db[_0x51f7('0x58')][_0x51f7('0x5a')](_0x23f751)['then'](respondWithFilteredResult(_0xf5f54f,_0x23f751));})[_0x51f7('0x47')](handleError(_0xf5f54f,null));}; \ No newline at end of file +var _0x0a93=['findAll','catch','params','options','create','role','user','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','update','body','getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','count','include'];(function(_0x28a286,_0x1617aa){var _0x1859d4=function(_0x510854){while(--_0x510854){_0x28a286['push'](_0x28a286['shift']());}};_0x1859d4(++_0x1617aa);}(_0x0a93,0x6a));var _0x30a9=function(_0x2ec4bf,_0x402cff){_0x2ec4bf=_0x2ec4bf-0x0;var _0x5b965f=_0x0a93[_0x2ec4bf];return _0x5b965f;};'use strict';var pdf=require(_0x30a9('0x0'));var emlformat=require(_0x30a9('0x1'));var rimraf=require(_0x30a9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30a9('0x3'));var rp=require(_0x30a9('0x4'));var moment=require(_0x30a9('0x5'));var BPromise=require(_0x30a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30a9('0x7'));var fs=require('fs');var _=require(_0x30a9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30a9('0x9'));var deskjs=require(_0x30a9('0xa'));var toCsv=require(_0x30a9('0xb'));var querystring=require('querystring');var Papa=require(_0x30a9('0xc'));var Redis=require(_0x30a9('0xd'));var authService=require(_0x30a9('0xe'));var qs=require(_0x30a9('0xf'));var as=require(_0x30a9('0x10'));var hardwareService=require(_0x30a9('0x11'));var logger=require(_0x30a9('0x12'))(_0x30a9('0x13'));var utils=require(_0x30a9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x30a9('0x15'));var db=require(_0x30a9('0x16'))['db'];function respondWithStatusCode(_0x2a0a7a,_0x37c981){_0x37c981=_0x37c981||0xcc;return function(_0x49c22c){if(_0x49c22c){return _0x2a0a7a[_0x30a9('0x17')](_0x37c981);}return _0x2a0a7a['status'](_0x37c981)[_0x30a9('0x18')]();};}function respondWithResult(_0x3f641d,_0x5912b6){_0x5912b6=_0x5912b6||0xc8;return function(_0x58a4f3){if(_0x58a4f3){return _0x3f641d[_0x30a9('0x19')](_0x5912b6)[_0x30a9('0x1a')](_0x58a4f3);}};}function respondWithFilteredResult(_0x4b9f6e,_0x3230fe){return function(_0x2d007d){if(_0x2d007d){var _0x3c50d1=_0x2d007d['count'],_0x17fec2=_0x3230fe[_0x30a9('0x1b')],_0x39cee7=_0x3230fe[_0x30a9('0x1b')]+_0x3230fe[_0x30a9('0x1c')],_0x1e7927;if(_0x39cee7>=_0x3c50d1){_0x39cee7=_0x3c50d1;_0x1e7927=0xc8;}else{_0x1e7927=0xce;}_0x4b9f6e[_0x30a9('0x19')](_0x1e7927);return _0x4b9f6e[_0x30a9('0x1d')](_0x30a9('0x1e'),_0x17fec2+'-'+_0x39cee7+'/'+_0x3c50d1)[_0x30a9('0x1a')](_0x2d007d);}return null;};}function patchUpdates(_0x29e1e9){return function(_0x1c412c){try{jsonpatch[_0x30a9('0x1f')](_0x1c412c,_0x29e1e9,!![]);}catch(_0x5129cc){return BPromise[_0x30a9('0x20')](_0x5129cc);}return _0x1c412c[_0x30a9('0x21')]();};}function saveUpdates(_0x465581,_0x117d4f){return function(_0x553532){if(_0x553532){return _0x553532['update'](_0x465581)[_0x30a9('0x22')](function(_0x2f2cc9){return _0x2f2cc9;});}return null;};}function removeEntity(_0x541b86,_0x3408f4){return function(_0x4c92e8){if(_0x4c92e8){return _0x4c92e8[_0x30a9('0x23')]()[_0x30a9('0x22')](function(){var _0x5a6e49=_0x4c92e8[_0x30a9('0x24')]({'plain':!![]});var _0x41792d='Voicemails';return db[_0x30a9('0x25')]['destroy']({'where':{'type':_0x41792d,'resourceId':_0x5a6e49['id']}})[_0x30a9('0x22')](function(){return _0x4c92e8;});})[_0x30a9('0x22')](function(){_0x541b86[_0x30a9('0x19')](0xcc)[_0x30a9('0x18')]();});}};}function handleEntityNotFound(_0x405744,_0x45cfc3){return function(_0x3e216f){if(!_0x3e216f){_0x405744['sendStatus'](0x194);}return _0x3e216f;};}function handleError(_0x4146c9,_0x234926){_0x234926=_0x234926||0x1f4;return function(_0x1bf9a3){logger[_0x30a9('0x26')](_0x1bf9a3[_0x30a9('0x27')]);if(_0x1bf9a3[_0x30a9('0x28')]){delete _0x1bf9a3[_0x30a9('0x28')];}_0x4146c9[_0x30a9('0x19')](_0x234926)[_0x30a9('0x29')](_0x1bf9a3);};}exports[_0x30a9('0x2a')]=function(_0x4e124c,_0x41fb30){var _0x5810a0={},_0x3f9102={},_0x3724da={'count':0x0,'rows':[]};var _0x23d7ef=_[_0x30a9('0x2b')](db[_0x30a9('0x2c')][_0x30a9('0x2d')],function(_0x2f9a5c){return{'name':_0x2f9a5c[_0x30a9('0x2e')],'type':_0x2f9a5c[_0x30a9('0x2f')][_0x30a9('0x30')]};});_0x3f9102['model']=_[_0x30a9('0x2b')](_0x23d7ef,'name');_0x3f9102[_0x30a9('0x31')]=_[_0x30a9('0x32')](_0x4e124c[_0x30a9('0x31')]);_0x3f9102['filters']=_[_0x30a9('0x33')](_0x3f9102[_0x30a9('0x34')],_0x3f9102[_0x30a9('0x31')]);_0x5810a0[_0x30a9('0x35')]=_['intersection'](_0x3f9102[_0x30a9('0x34')],qs['fields'](_0x4e124c['query'][_0x30a9('0x36')]));_0x5810a0['attributes']=_0x5810a0[_0x30a9('0x35')][_0x30a9('0x37')]?_0x5810a0[_0x30a9('0x35')]:_0x3f9102['model'];if(!_0x4e124c[_0x30a9('0x31')][_0x30a9('0x38')](_0x30a9('0x39'))){_0x5810a0[_0x30a9('0x1c')]=qs['limit'](_0x4e124c[_0x30a9('0x31')][_0x30a9('0x1c')]);_0x5810a0['offset']=qs[_0x30a9('0x1b')](_0x4e124c[_0x30a9('0x31')][_0x30a9('0x1b')]);}_0x5810a0['order']=qs[_0x30a9('0x3a')](_0x4e124c['query'][_0x30a9('0x3a')]);_0x5810a0[_0x30a9('0x3b')]=qs[_0x30a9('0x3c')](_[_0x30a9('0x3d')](_0x4e124c[_0x30a9('0x31')],_0x3f9102['filters']),_0x23d7ef);if(_0x4e124c[_0x30a9('0x31')][_0x30a9('0x3e')]){_0x5810a0['where']=_[_0x30a9('0x3f')](_0x5810a0[_0x30a9('0x3b')],{'$or':_[_0x30a9('0x2b')](_0x23d7ef,function(_0x2791db){if(_0x2791db[_0x30a9('0x2f')]!=='VIRTUAL'){var _0x351c26={};_0x351c26[_0x2791db[_0x30a9('0x28')]]={'$like':'%'+_0x4e124c['query'][_0x30a9('0x3e')]+'%'};return _0x351c26;}})});}_0x5810a0=_['merge']({},_0x5810a0,_0x4e124c['options']);var _0x204879={'where':_0x5810a0[_0x30a9('0x3b')]};return db[_0x30a9('0x2c')]['count'](_0x204879)[_0x30a9('0x22')](function(_0x5aff76){_0x3724da[_0x30a9('0x40')]=_0x5aff76;if(_0x4e124c[_0x30a9('0x31')]['includeAll']){_0x5810a0[_0x30a9('0x41')]=[{'all':!![]}];}return db[_0x30a9('0x2c')][_0x30a9('0x42')](_0x5810a0);})[_0x30a9('0x22')](function(_0x3defb5){_0x3724da['rows']=_0x3defb5;return _0x3724da;})[_0x30a9('0x22')](respondWithFilteredResult(_0x41fb30,_0x5810a0))[_0x30a9('0x43')](handleError(_0x41fb30,null));};exports['show']=function(_0x425c72,_0x210085){var _0x3dfb6d={'raw':!![],'where':{'id':_0x425c72[_0x30a9('0x44')]['id']}},_0x1fead1={};_0x1fead1['model']=_['keys'](db[_0x30a9('0x2c')]['rawAttributes']);_0x1fead1[_0x30a9('0x31')]=_[_0x30a9('0x32')](_0x425c72[_0x30a9('0x31')]);_0x1fead1[_0x30a9('0x3c')]=_[_0x30a9('0x33')](_0x1fead1[_0x30a9('0x34')],_0x1fead1[_0x30a9('0x31')]);_0x3dfb6d[_0x30a9('0x35')]=_[_0x30a9('0x33')](_0x1fead1[_0x30a9('0x34')],qs[_0x30a9('0x36')](_0x425c72[_0x30a9('0x31')][_0x30a9('0x36')]));_0x3dfb6d[_0x30a9('0x35')]=_0x3dfb6d[_0x30a9('0x35')]['length']?_0x3dfb6d[_0x30a9('0x35')]:_0x1fead1[_0x30a9('0x34')];if(_0x425c72[_0x30a9('0x31')]['includeAll']){_0x3dfb6d[_0x30a9('0x41')]=[{'all':!![]}];}_0x3dfb6d=_[_0x30a9('0x3f')]({},_0x3dfb6d,_0x425c72[_0x30a9('0x45')]);return db[_0x30a9('0x2c')]['find'](_0x3dfb6d)[_0x30a9('0x22')](handleEntityNotFound(_0x210085,null))[_0x30a9('0x22')](respondWithResult(_0x210085,null))['catch'](handleError(_0x210085,null));};exports[_0x30a9('0x46')]=function(_0x3b054f,_0x29df86){return db[_0x30a9('0x2c')][_0x30a9('0x46')](_0x3b054f['body'],{})['then'](function(_0x2d902b){var _0x3fa36c=_0x3b054f['user'][_0x30a9('0x24')]({'plain':!![]});if(!_0x3fa36c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fa36c[_0x30a9('0x47')]===_0x30a9('0x48')){var _0x1a45ec=_0x2d902b['get']({'plain':!![]});var _0x4ce93e=_0x30a9('0x49');return db[_0x30a9('0x4a')][_0x30a9('0x4b')]({'where':{'name':_0x4ce93e,'userProfileId':_0x3fa36c[_0x30a9('0x4c')]},'raw':!![]})[_0x30a9('0x22')](function(_0x41b5cf){if(_0x41b5cf&&_0x41b5cf[_0x30a9('0x4d')]===0x0){return db[_0x30a9('0x25')]['create']({'name':_0x1a45ec['name'],'resourceId':_0x1a45ec['id'],'type':_0x41b5cf[_0x30a9('0x28')],'sectionId':_0x41b5cf['id']},{})['then'](function(){return _0x2d902b;});}else{return _0x2d902b;}})[_0x30a9('0x43')](function(_0x56c2e2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56c2e2);throw _0x56c2e2;});}return _0x2d902b;})[_0x30a9('0x22')](respondWithResult(_0x29df86,0xc9))[_0x30a9('0x43')](handleError(_0x29df86,null));};exports[_0x30a9('0x4e')]=function(_0x468051,_0x3a7bbd){if(_0x468051['body']['id']){delete _0x468051[_0x30a9('0x4f')]['id'];}return db[_0x30a9('0x2c')][_0x30a9('0x4b')]({'where':{'id':_0x468051[_0x30a9('0x44')]['id']}})[_0x30a9('0x22')](handleEntityNotFound(_0x3a7bbd,null))[_0x30a9('0x22')](saveUpdates(_0x468051[_0x30a9('0x4f')],null))[_0x30a9('0x22')](respondWithResult(_0x3a7bbd,null))[_0x30a9('0x43')](handleError(_0x3a7bbd,null));};exports[_0x30a9('0x23')]=function(_0x3f6537,_0x48ba49){return db[_0x30a9('0x2c')]['find']({'where':{'id':_0x3f6537[_0x30a9('0x44')]['id']}})[_0x30a9('0x22')](handleEntityNotFound(_0x48ba49,null))[_0x30a9('0x22')](removeEntity(_0x48ba49,null))[_0x30a9('0x43')](handleError(_0x48ba49,null));};exports[_0x30a9('0x50')]=function(_0x535344,_0x1c0e74,_0x430f0b){return db['VoiceMail'][_0x30a9('0x51')]({'where':{'id':_0x535344[_0x30a9('0x44')]['id']}})[_0x30a9('0x22')](handleEntityNotFound(_0x1c0e74,null))[_0x30a9('0x22')](function(_0x401397){var _0x114a63;var _0x1b7e9a={},_0x3b7174={};_0x3b7174[_0x30a9('0x34')]=_[_0x30a9('0x32')](db[_0x30a9('0x52')][_0x30a9('0x2d')]);_0x3b7174['query']=_['keys'](_0x535344['query']);_0x3b7174[_0x30a9('0x3c')]=_[_0x30a9('0x33')](_0x3b7174[_0x30a9('0x34')],_0x3b7174[_0x30a9('0x31')]);_0x1b7e9a[_0x30a9('0x35')]=_[_0x30a9('0x33')](_0x3b7174['model'],qs['fields'](_0x535344[_0x30a9('0x31')][_0x30a9('0x36')]));_0x1b7e9a[_0x30a9('0x35')]=_0x1b7e9a[_0x30a9('0x35')][_0x30a9('0x37')]?_0x1b7e9a[_0x30a9('0x35')]:_0x3b7174[_0x30a9('0x34')];if(!_0x535344[_0x30a9('0x31')][_0x30a9('0x38')](_0x30a9('0x39'))){_0x1b7e9a[_0x30a9('0x1c')]=qs[_0x30a9('0x1c')](_0x535344['query'][_0x30a9('0x1c')]);_0x1b7e9a[_0x30a9('0x1b')]=qs['offset'](_0x535344[_0x30a9('0x31')][_0x30a9('0x1b')]);}_0x1b7e9a[_0x30a9('0x53')]=qs[_0x30a9('0x3a')](_0x535344['query'][_0x30a9('0x3a')]);_0x1b7e9a[_0x30a9('0x3b')]=qs[_0x30a9('0x3c')](_['pick'](_0x535344['query'],_0x3b7174[_0x30a9('0x3c')]));if(_0x535344[_0x30a9('0x31')]['filter']){_0x1b7e9a[_0x30a9('0x3b')]=_['merge'](_0x1b7e9a[_0x30a9('0x3b')],{'$or':_[_0x30a9('0x2b')](_0x1b7e9a[_0x30a9('0x35')],function(_0x414512){var _0x1209eb={};_0x1209eb[_0x414512]={'$like':'%'+_0x535344['query'][_0x30a9('0x3e')]+'%'};return _0x1209eb;})});}_0x1b7e9a[_0x30a9('0x3b')]=_[_0x30a9('0x3f')](_0x1b7e9a[_0x30a9('0x3b')],{'mailboxuser':_0x401397[_0x30a9('0x54')]});_0x1b7e9a=_[_0x30a9('0x3f')]({},_0x1b7e9a,_0x535344[_0x30a9('0x45')]);return db['VoiceMailMessage'][_0x30a9('0x55')](_0x1b7e9a)['then'](respondWithFilteredResult(_0x1c0e74,_0x1b7e9a));})[_0x30a9('0x43')](handleError(_0x1c0e74,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5afacb9..a1ca9f8 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 _0x55c3=['mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x2b5423,_0x24db35){var _0x334056=function(_0x4647e9){while(--_0x4647e9){_0x2b5423['push'](_0x2b5423['shift']());}};_0x334056(++_0x24db35);}(_0x55c3,0x189));var _0x355c=function(_0x24109b,_0x338f16){_0x24109b=_0x24109b-0x0;var _0x23aca4=_0x55c3[_0x24109b];return _0x23aca4;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var logger=require(_0x355c('0x1'))(_0x355c('0x2'));var moment=require(_0x355c('0x3'));var BPromise=require(_0x355c('0x4'));var rp=require(_0x355c('0x5'));var fs=require('fs');var path=require(_0x355c('0x6'));var rimraf=require(_0x355c('0x7'));var config=require(_0x355c('0x8'));var attributes=require(_0x355c('0x9'));module[_0x355c('0xa')]=function(_0x19c4e4,_0x8570ef){return _0x19c4e4[_0x355c('0xb')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x355c('0xc'),'fields':[_0x355c('0xd'),_0x355c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5522=['api','moment','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x363560,_0x156d88){var _0x18a1a2=function(_0x21456c){while(--_0x21456c){_0x363560['push'](_0x363560['shift']());}};_0x18a1a2(++_0x156d88);}(_0x5522,0x1bd));var _0x2552=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5522[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x2552('0x0'));var util=require(_0x2552('0x1'));var logger=require(_0x2552('0x2'))(_0x2552('0x3'));var moment=require(_0x2552('0x4'));var BPromise=require('bluebird');var rp=require(_0x2552('0x5'));var fs=require('fs');var path=require(_0x2552('0x6'));var rimraf=require(_0x2552('0x7'));var config=require('../../config/environment');var attributes=require(_0x2552('0x8'));module[_0x2552('0x9')]=function(_0x53db98,_0x45dbe9){return _0x53db98[_0x2552('0xa')](_0x2552('0xb'),attributes,{'tableName':_0x2552('0xc'),'paranoid':![],'indexes':[{'name':_0x2552('0xd'),'fields':[_0x2552('0xe'),_0x2552('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b5bd29b..cbe144a 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 _0x6403=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceMail,\x20%s,\x20%s','message','info'];(function(_0x1cdfe3,_0x2fabf2){var _0x3de796=function(_0x32283d){while(--_0x32283d){_0x1cdfe3['push'](_0x1cdfe3['shift']());}};_0x3de796(++_0x2fabf2);}(_0x6403,0x112));var _0x3640=function(_0x24fc3d,_0x1b10d0){_0x24fc3d=_0x24fc3d-0x0;var _0x144024=_0x6403[_0x24fc3d];return _0x144024;};'use strict';var _=require(_0x3640('0x0'));var util=require(_0x3640('0x1'));var moment=require(_0x3640('0x2'));var BPromise=require(_0x3640('0x3'));var rs=require(_0x3640('0x4'));var fs=require('fs');var Redis=require(_0x3640('0x5'));var db=require(_0x3640('0x6'))['db'];var utils=require(_0x3640('0x7'));var logger=require(_0x3640('0x8'))('rpc');var config=require(_0x3640('0x9'));var jayson=require(_0x3640('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x544e41,_0x28f20b,_0x3baf90){return new BPromise(function(_0x4057af,_0x20ab0e){return client[_0x3640('0xb')](_0x544e41,_0x3baf90)['then'](function(_0x2a4039){logger['info']('VoiceMail,\x20%s,\x20%s',_0x28f20b,'request\x20sent');logger[_0x3640('0xc')](_0x3640('0xd'),_0x28f20b,_0x3640('0xe'),JSON[_0x3640('0xf')](_0x2a4039));if(_0x2a4039['error']){if(_0x2a4039[_0x3640('0x10')]['code']===0x1f4){logger[_0x3640('0x10')](_0x3640('0x11'),_0x28f20b,_0x2a4039[_0x3640('0x10')]['message']);return _0x20ab0e(_0x2a4039[_0x3640('0x10')][_0x3640('0x12')]);}logger[_0x3640('0x10')]('VoiceMail,\x20%s,\x20%s',_0x28f20b,_0x2a4039['error']['message']);return _0x4057af(_0x2a4039[_0x3640('0x10')][_0x3640('0x12')]);}else{logger[_0x3640('0x13')]('VoiceMail,\x20%s,\x20%s',_0x28f20b,_0x3640('0xe'));_0x4057af(_0x2a4039[_0x3640('0x14')]['message']);}})['catch'](function(_0x202d5d){logger[_0x3640('0x10')](_0x3640('0x11'),_0x28f20b,_0x202d5d);_0x20ab0e(_0x202d5d);});});} \ No newline at end of file +var _0x13ff=['jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x465b6f,_0x252683){var _0x4b2193=function(_0x368e28){while(--_0x368e28){_0x465b6f['push'](_0x465b6f['shift']());}};_0x4b2193(++_0x252683);}(_0x13ff,0xa7));var _0xf13f=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x13ff[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xf13f('0x0'));var util=require(_0xf13f('0x1'));var moment=require(_0xf13f('0x2'));var BPromise=require(_0xf13f('0x3'));var rs=require(_0xf13f('0x4'));var fs=require('fs');var Redis=require(_0xf13f('0x5'));var db=require(_0xf13f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf13f('0x7'));var config=require(_0xf13f('0x8'));var jayson=require(_0xf13f('0x9'));var client=jayson[_0xf13f('0xa')][_0xf13f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab6aa4,_0xa4bcfd,_0xc5f8f6){return new BPromise(function(_0xfd75ab,_0x12d81f){return client[_0xf13f('0xc')](_0xab6aa4,_0xc5f8f6)[_0xf13f('0xd')](function(_0x2f111f){logger[_0xf13f('0xe')]('VoiceMail,\x20%s,\x20%s',_0xa4bcfd,'request\x20sent');logger['debug'](_0xf13f('0xf'),_0xa4bcfd,_0xf13f('0x10'),JSON[_0xf13f('0x11')](_0x2f111f));if(_0x2f111f[_0xf13f('0x12')]){if(_0x2f111f[_0xf13f('0x12')][_0xf13f('0x13')]===0x1f4){logger[_0xf13f('0x12')](_0xf13f('0x14'),_0xa4bcfd,_0x2f111f[_0xf13f('0x12')][_0xf13f('0x15')]);return _0x12d81f(_0x2f111f[_0xf13f('0x12')]['message']);}logger[_0xf13f('0x12')]('VoiceMail,\x20%s,\x20%s',_0xa4bcfd,_0x2f111f['error'][_0xf13f('0x15')]);return _0xfd75ab(_0x2f111f['error'][_0xf13f('0x15')]);}else{logger[_0xf13f('0xe')](_0xf13f('0x14'),_0xa4bcfd,_0xf13f('0x10'));_0xfd75ab(_0x2f111f['result'][_0xf13f('0x15')]);}})['catch'](function(_0x24adb6){logger[_0xf13f('0x12')](_0xf13f('0x14'),_0xa4bcfd,_0x24adb6);_0x12d81f(_0x24adb6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a4b0af9..49fcff0 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 _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x45a4e0,_0x345f4d){var _0x43f49d=function(_0x564c57){while(--_0x564c57){_0x45a4e0['push'](_0x45a4e0['shift']());}};_0x43f49d(++_0x345f4d);}(_0x4819,0xcd));var _0x9481=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x4819[_0xa8883];return _0x479426;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file +var _0x1cb9=['../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0x1cb9,0x14e));var _0x91cb=function(_0x173d83,_0x3b596d){_0x173d83=_0x173d83-0x0;var _0x31272b=_0x1cb9[_0x173d83];return _0x31272b;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0x7')]('/:id/download',auth[_0x91cb('0x8')](),controller['download']);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0xd')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['destroy']);module[_0x91cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ec54d7b..fa5e940 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 _0x90b9=['sequelize','exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP'];(function(_0x401e4a,_0x1bfada){var _0x7dfdc1=function(_0x488705){while(--_0x488705){_0x401e4a['push'](_0x401e4a['shift']());}};_0x7dfdc1(++_0x1bfada);}(_0x90b9,0xd9));var _0x990b=function(_0x3356c6,_0x27cb3b){_0x3356c6=_0x3356c6-0x0;var _0x2a2976=_0x90b9[_0x3356c6];return _0x2a2976;};'use strict';var Sequelize=require(_0x990b('0x0'));module[_0x990b('0x1')]={'name':{'type':Sequelize[_0x990b('0x2')],'get':function(_0x441232){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x990b('0x4')](_0x990b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x990b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x990b('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x8e76=['exports','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP','sequelize'];(function(_0x113c26,_0x5bf13c){var _0x565778=function(_0x322345){while(--_0x322345){_0x113c26['push'](_0x113c26['shift']());}};_0x565778(++_0x5bf13c);}(_0x8e76,0x157));var _0x68e7=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8e76[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x68e7('0x0'));module[_0x68e7('0x1')]={'name':{'type':Sequelize[_0x68e7('0x2')],'get':function(_0x518a82){return this[_0x68e7('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x68e7('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x68e7('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x68e7('0x5')],'defaultValue':''},'stamp':{'type':_0x68e7('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 38ed996..4985967 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 _0x0afd=['status','count','offset','set','Content-Range','apply','save','update','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceMailMessage','then','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','html-pdf','eml-format','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0afd,0x1df));var _0xd0af=function(_0x28bd5e,_0xe90421){_0x28bd5e=_0x28bd5e-0x0;var _0x479fb9=_0x0afd[_0x28bd5e];return _0x479fb9;};'use strict';var pdf=require(_0xd0af('0x0'));var emlformat=require(_0xd0af('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd0af('0x2'));var BPromise=require(_0xd0af('0x3'));var Mustache=require(_0xd0af('0x4'));var util=require(_0xd0af('0x5'));var path=require(_0xd0af('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0af('0x7'));var fs=require('fs');var _=require(_0xd0af('0x8'));var squel=require(_0xd0af('0x9'));var crypto=require('crypto');var jsforce=require(_0xd0af('0xa'));var deskjs=require(_0xd0af('0xb'));var toCsv=require(_0xd0af('0xc'));var querystring=require(_0xd0af('0xd'));var Papa=require(_0xd0af('0xe'));var Redis=require('ioredis');var authService=require(_0xd0af('0xf'));var qs=require(_0xd0af('0x10'));var as=require(_0xd0af('0x11'));var hardwareService=require(_0xd0af('0x12'));var logger=require(_0xd0af('0x13'))(_0xd0af('0x14'));var utils=require('../../config/utils');var config=require(_0xd0af('0x15'));var licenseUtil=require(_0xd0af('0x16'));var db=require(_0xd0af('0x17'))['db'];function respondWithStatusCode(_0x38f9a4,_0x472e63){_0x472e63=_0x472e63||0xcc;return function(_0x53044b){if(_0x53044b){return _0x38f9a4[_0xd0af('0x18')](_0x472e63);}return _0x38f9a4[_0xd0af('0x19')](_0x472e63)['end']();};}function respondWithResult(_0x2ccf85,_0x9d5098){_0x9d5098=_0x9d5098||0xc8;return function(_0x20f7e2){if(_0x20f7e2){return _0x2ccf85[_0xd0af('0x19')](_0x9d5098)['json'](_0x20f7e2);}};}function respondWithFilteredResult(_0x541833,_0xeba85d){return function(_0x10ecef){if(_0x10ecef){var _0x51934d=_0x10ecef[_0xd0af('0x1a')],_0x5616e8=_0xeba85d[_0xd0af('0x1b')],_0x40ffe5=_0xeba85d[_0xd0af('0x1b')]+_0xeba85d['limit'],_0x139fbc;if(_0x40ffe5>=_0x51934d){_0x40ffe5=_0x51934d;_0x139fbc=0xc8;}else{_0x139fbc=0xce;}_0x541833[_0xd0af('0x19')](_0x139fbc);return _0x541833[_0xd0af('0x1c')](_0xd0af('0x1d'),_0x5616e8+'-'+_0x40ffe5+'/'+_0x51934d)['json'](_0x10ecef);}return null;};}function patchUpdates(_0x292e97){return function(_0x5d74f8){try{jsonpatch[_0xd0af('0x1e')](_0x5d74f8,_0x292e97,!![]);}catch(_0x52f845){return BPromise['reject'](_0x52f845);}return _0x5d74f8[_0xd0af('0x1f')]();};}function saveUpdates(_0x52ac08,_0x4eff14){return function(_0x2876da){if(_0x2876da){return _0x2876da[_0xd0af('0x20')](_0x52ac08)['then'](function(_0x1a79bb){return _0x1a79bb;});}return null;};}function removeEntity(_0x4d26ea,_0xb6e822){return function(_0x50dcc4){if(_0x50dcc4){return _0x50dcc4['destroy']()['then'](function(){_0x4d26ea['status'](0xcc)[_0xd0af('0x21')]();});}};}function handleEntityNotFound(_0x4bc8f5,_0x15c572){return function(_0x72d0b9){if(!_0x72d0b9){_0x4bc8f5['sendStatus'](0x194);}return _0x72d0b9;};}function handleError(_0x57601c,_0x127f89){_0x127f89=_0x127f89||0x1f4;return function(_0x1cb4dc){logger[_0xd0af('0x22')](_0x1cb4dc[_0xd0af('0x23')]);if(_0x1cb4dc[_0xd0af('0x24')]){delete _0x1cb4dc['name'];}_0x57601c[_0xd0af('0x19')](_0x127f89)[_0xd0af('0x25')](_0x1cb4dc);};}exports[_0xd0af('0x26')]=function(_0x12d0cd,_0x51d114){var _0x342365={},_0x3ea036={},_0x453472={'count':0x0,'rows':[]};var _0x322209=_[_0xd0af('0x27')](db['VoiceMailMessage'][_0xd0af('0x28')],function(_0x65f347){return{'name':_0x65f347[_0xd0af('0x29')],'type':_0x65f347[_0xd0af('0x2a')][_0xd0af('0x2b')]};});_0x3ea036[_0xd0af('0x2c')]=_[_0xd0af('0x2d')](_[_0xd0af('0x27')](_0x322209,'name'),[_0xd0af('0x24')]);_0x3ea036[_0xd0af('0x2e')]=_['keys'](_0x12d0cd[_0xd0af('0x2e')]);_0x3ea036[_0xd0af('0x2f')]=_[_0xd0af('0x30')](_0x3ea036[_0xd0af('0x2c')],_0x3ea036['query']);_0x342365[_0xd0af('0x31')]=_[_0xd0af('0x30')](_0x3ea036[_0xd0af('0x2c')],qs[_0xd0af('0x32')](_0x12d0cd[_0xd0af('0x2e')]['fields']));_0x342365['attributes']=_0x342365[_0xd0af('0x31')][_0xd0af('0x33')]?_0x342365[_0xd0af('0x31')]:_0x3ea036[_0xd0af('0x2c')];if(!_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x34')](_0xd0af('0x35'))){_0x342365[_0xd0af('0x36')]=qs[_0xd0af('0x36')](_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x36')]);_0x342365['offset']=qs['offset'](_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x1b')]);}_0x342365[_0xd0af('0x37')]=qs[_0xd0af('0x38')](_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x38')]);_0x342365[_0xd0af('0x39')]=qs[_0xd0af('0x2f')](_[_0xd0af('0x3a')](_0x12d0cd[_0xd0af('0x2e')],_0x3ea036[_0xd0af('0x2f')]),_0x322209);if(_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x3b')]){_0x342365['where']=_[_0xd0af('0x3c')](_0x342365[_0xd0af('0x39')],{'$or':_[_0xd0af('0x27')](_0x322209,function(_0x7eefc2){if(_0x7eefc2[_0xd0af('0x2a')]!==_0xd0af('0x3d')){var _0x2dbaf2={};_0x2dbaf2[_0x7eefc2['name']]={'$like':'%'+_0x12d0cd[_0xd0af('0x2e')][_0xd0af('0x3b')]+'%'};return _0x2dbaf2;}})});}_0x342365=_['merge']({},_0x342365,_0x12d0cd['options']);var _0x382fbe={'where':_0x342365[_0xd0af('0x39')]};return db[_0xd0af('0x3e')][_0xd0af('0x1a')](_0x382fbe)[_0xd0af('0x3f')](function(_0x33f7a3){_0x453472[_0xd0af('0x1a')]=_0x33f7a3;if(_0x12d0cd['query'][_0xd0af('0x40')]){_0x342365[_0xd0af('0x41')]=[{'all':!![]}];}return db[_0xd0af('0x3e')][_0xd0af('0x42')](_0x342365);})['then'](function(_0x29af08){_0x453472[_0xd0af('0x43')]=_0x29af08;return _0x453472;})['then'](respondWithFilteredResult(_0x51d114,_0x342365))[_0xd0af('0x44')](handleError(_0x51d114,null));};exports[_0xd0af('0x45')]=function(_0x380347,_0x10b722){var _0x20c7ff={'raw':!![],'where':{'id':_0x380347[_0xd0af('0x46')]['id']}},_0x124c65={};_0x124c65[_0xd0af('0x2c')]=_[_0xd0af('0x47')](db[_0xd0af('0x3e')][_0xd0af('0x28')]);_0x124c65[_0xd0af('0x2e')]=_[_0xd0af('0x47')](_0x380347['query']);_0x124c65['filters']=_['intersection'](_0x124c65[_0xd0af('0x2c')],_0x124c65[_0xd0af('0x2e')]);_0x20c7ff['attributes']=_[_0xd0af('0x30')](_0x124c65[_0xd0af('0x2c')],qs['fields'](_0x380347[_0xd0af('0x2e')][_0xd0af('0x32')]));_0x20c7ff['attributes']=_0x20c7ff[_0xd0af('0x31')][_0xd0af('0x33')]?_0x20c7ff['attributes']:_0x124c65['model'];if(_0x380347[_0xd0af('0x2e')][_0xd0af('0x40')]){_0x20c7ff[_0xd0af('0x41')]=[{'all':!![]}];}_0x20c7ff=_[_0xd0af('0x3c')]({},_0x20c7ff,_0x380347[_0xd0af('0x48')]);return db[_0xd0af('0x3e')]['find'](_0x20c7ff)[_0xd0af('0x3f')](handleEntityNotFound(_0x10b722,null))[_0xd0af('0x3f')](respondWithResult(_0x10b722,null))[_0xd0af('0x44')](handleError(_0x10b722,null));};exports[_0xd0af('0x49')]=function(_0x5f11eb,_0x4d72a9){return db[_0xd0af('0x3e')][_0xd0af('0x49')](_0x5f11eb[_0xd0af('0x4a')],{})[_0xd0af('0x3f')](respondWithResult(_0x4d72a9,0xc9))[_0xd0af('0x44')](handleError(_0x4d72a9,null));};exports[_0xd0af('0x20')]=function(_0x46d9a6,_0x343e60){if(_0x46d9a6[_0xd0af('0x4a')]['id']){delete _0x46d9a6['body']['id'];}return db[_0xd0af('0x3e')][_0xd0af('0x4b')]({'where':{'id':_0x46d9a6[_0xd0af('0x46')]['id']}})[_0xd0af('0x3f')](handleEntityNotFound(_0x343e60,null))[_0xd0af('0x3f')](saveUpdates(_0x46d9a6[_0xd0af('0x4a')],null))[_0xd0af('0x3f')](respondWithResult(_0x343e60,null))['catch'](handleError(_0x343e60,null));};exports[_0xd0af('0x4c')]=function(_0x5c5469,_0x10d302){return db[_0xd0af('0x3e')][_0xd0af('0x4b')]({'where':{'id':_0x5c5469[_0xd0af('0x46')]['id']}})[_0xd0af('0x3f')](handleEntityNotFound(_0x10d302,null))[_0xd0af('0x3f')](removeEntity(_0x10d302,null))[_0xd0af('0x44')](handleError(_0x10d302,null));};exports[_0xd0af('0x4d')]=function(_0x2edac1,_0x9ed6f8,_0x4d2f3e){return db['VoiceMailMessage'][_0xd0af('0x4b')]({'where':{'id':_0x2edac1[_0xd0af('0x46')]['id']},'attributes':['id',_0xd0af('0x4e'),_0xd0af('0x4f')]})[_0xd0af('0x3f')](handleEntityNotFound(_0x9ed6f8,null))[_0xd0af('0x3f')](function(_0x96d96f){if(_0x96d96f){if(!_0x96d96f[_0xd0af('0x4e')]){throw new db[(_0xd0af('0x50'))][(_0xd0af('0x51'))](_0xd0af('0x52'));}var _0x458339={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x96d96f['msg_id']){_0x458339[_0xd0af('0x53')]='attachment;\x20filename=\x22'+_0x96d96f[_0xd0af('0x4f')]+'.wav\x22';}_0x9ed6f8['set'](_0x458339);return _0x9ed6f8[_0xd0af('0x25')](new Buffer(_0x96d96f['recording']));}})[_0xd0af('0x44')](handleError(_0x9ed6f8,null));}; \ No newline at end of file +var _0x3c42=['../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','apply','save','destroy','then','end','error','name','index','fieldName','type','key','model','differenceBy','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','include','findAll','rows','catch','show','params','includeAll','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','send','html-pdf','eml-format','zip-dir','request-promise','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/logger','api','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c42,0xe2));var _0x23c4=function(_0x209aae,_0x25b88a){_0x209aae=_0x209aae-0x0;var _0x128793=_0x3c42[_0x209aae];return _0x128793;};'use strict';var pdf=require(_0x23c4('0x0'));var emlformat=require(_0x23c4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x23c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c4('0x3'));var moment=require('moment');var BPromise=require(_0x23c4('0x4'));var Mustache=require('mustache');var util=require(_0x23c4('0x5'));var path=require(_0x23c4('0x6'));var sox=require('sox');var csv=require(_0x23c4('0x7'));var ejs=require(_0x23c4('0x8'));var fs=require('fs');var _=require(_0x23c4('0x9'));var squel=require(_0x23c4('0xa'));var crypto=require(_0x23c4('0xb'));var jsforce=require(_0x23c4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x23c4('0x7'));var querystring=require(_0x23c4('0xd'));var Papa=require(_0x23c4('0xe'));var Redis=require(_0x23c4('0xf'));var authService=require(_0x23c4('0x10'));var qs=require(_0x23c4('0x11'));var as=require(_0x23c4('0x12'));var hardwareService=require(_0x23c4('0x13'));var logger=require(_0x23c4('0x14'))(_0x23c4('0x15'));var utils=require(_0x23c4('0x16'));var config=require(_0x23c4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x23c4('0x18'))['db'];function respondWithStatusCode(_0x23ccde,_0x4b978c){_0x4b978c=_0x4b978c||0xcc;return function(_0x1ecf4c){if(_0x1ecf4c){return _0x23ccde[_0x23c4('0x19')](_0x4b978c);}return _0x23ccde[_0x23c4('0x1a')](_0x4b978c)['end']();};}function respondWithResult(_0x29a8c9,_0x587ef7){_0x587ef7=_0x587ef7||0xc8;return function(_0x28ebca){if(_0x28ebca){return _0x29a8c9[_0x23c4('0x1a')](_0x587ef7)['json'](_0x28ebca);}};}function respondWithFilteredResult(_0x5dc768,_0x37ef78){return function(_0x4c58c1){if(_0x4c58c1){var _0x44bcf7=_0x4c58c1[_0x23c4('0x1b')],_0x148d0f=_0x37ef78['offset'],_0x40a307=_0x37ef78[_0x23c4('0x1c')]+_0x37ef78['limit'],_0x366111;if(_0x40a307>=_0x44bcf7){_0x40a307=_0x44bcf7;_0x366111=0xc8;}else{_0x366111=0xce;}_0x5dc768[_0x23c4('0x1a')](_0x366111);return _0x5dc768[_0x23c4('0x1d')](_0x23c4('0x1e'),_0x148d0f+'-'+_0x40a307+'/'+_0x44bcf7)['json'](_0x4c58c1);}return null;};}function patchUpdates(_0x28adba){return function(_0x5eaa33){try{jsonpatch[_0x23c4('0x1f')](_0x5eaa33,_0x28adba,!![]);}catch(_0x48b4ac){return BPromise['reject'](_0x48b4ac);}return _0x5eaa33[_0x23c4('0x20')]();};}function saveUpdates(_0x274e27,_0x52928f){return function(_0x2fd15d){if(_0x2fd15d){return _0x2fd15d['update'](_0x274e27)['then'](function(_0xe54709){return _0xe54709;});}return null;};}function removeEntity(_0x453ba2,_0xa11304){return function(_0x3e41aa){if(_0x3e41aa){return _0x3e41aa[_0x23c4('0x21')]()[_0x23c4('0x22')](function(){_0x453ba2[_0x23c4('0x1a')](0xcc)[_0x23c4('0x23')]();});}};}function handleEntityNotFound(_0x471c77,_0x2f1abf){return function(_0x599b0d){if(!_0x599b0d){_0x471c77['sendStatus'](0x194);}return _0x599b0d;};}function handleError(_0x3a6eac,_0x1fc29a){_0x1fc29a=_0x1fc29a||0x1f4;return function(_0x4d0580){logger[_0x23c4('0x24')](_0x4d0580['stack']);if(_0x4d0580[_0x23c4('0x25')]){delete _0x4d0580[_0x23c4('0x25')];}_0x3a6eac['status'](_0x1fc29a)['send'](_0x4d0580);};}exports[_0x23c4('0x26')]=function(_0x257465,_0x5a07c7){var _0xaaf104={},_0x5354b9={},_0x465934={'count':0x0,'rows':[]};var _0x351ae9=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x13f3f8){return{'name':_0x13f3f8[_0x23c4('0x27')],'type':_0x13f3f8[_0x23c4('0x28')][_0x23c4('0x29')]};});_0x5354b9[_0x23c4('0x2a')]=_[_0x23c4('0x2b')](_[_0x23c4('0x2c')](_0x351ae9,'name'),[_0x23c4('0x25')]);_0x5354b9[_0x23c4('0x2d')]=_[_0x23c4('0x2e')](_0x257465[_0x23c4('0x2d')]);_0x5354b9[_0x23c4('0x2f')]=_['intersection'](_0x5354b9[_0x23c4('0x2a')],_0x5354b9[_0x23c4('0x2d')]);_0xaaf104[_0x23c4('0x30')]=_[_0x23c4('0x31')](_0x5354b9[_0x23c4('0x2a')],qs[_0x23c4('0x32')](_0x257465['query'][_0x23c4('0x32')]));_0xaaf104['attributes']=_0xaaf104['attributes'][_0x23c4('0x33')]?_0xaaf104[_0x23c4('0x30')]:_0x5354b9['model'];if(!_0x257465[_0x23c4('0x2d')][_0x23c4('0x34')]('nolimit')){_0xaaf104[_0x23c4('0x35')]=qs[_0x23c4('0x35')](_0x257465[_0x23c4('0x2d')][_0x23c4('0x35')]);_0xaaf104[_0x23c4('0x1c')]=qs[_0x23c4('0x1c')](_0x257465[_0x23c4('0x2d')][_0x23c4('0x1c')]);}_0xaaf104[_0x23c4('0x36')]=qs[_0x23c4('0x37')](_0x257465['query'][_0x23c4('0x37')]);_0xaaf104[_0x23c4('0x38')]=qs[_0x23c4('0x2f')](_[_0x23c4('0x39')](_0x257465[_0x23c4('0x2d')],_0x5354b9[_0x23c4('0x2f')]),_0x351ae9);if(_0x257465[_0x23c4('0x2d')][_0x23c4('0x3a')]){_0xaaf104[_0x23c4('0x38')]=_[_0x23c4('0x3b')](_0xaaf104[_0x23c4('0x38')],{'$or':_[_0x23c4('0x2c')](_0x351ae9,function(_0x4d9341){if(_0x4d9341['type']!==_0x23c4('0x3c')){var _0x38a813={};_0x38a813[_0x4d9341[_0x23c4('0x25')]]={'$like':'%'+_0x257465['query'][_0x23c4('0x3a')]+'%'};return _0x38a813;}})});}_0xaaf104=_[_0x23c4('0x3b')]({},_0xaaf104,_0x257465[_0x23c4('0x3d')]);var _0x10f868={'where':_0xaaf104[_0x23c4('0x38')]};return db[_0x23c4('0x3e')][_0x23c4('0x1b')](_0x10f868)[_0x23c4('0x22')](function(_0x430eed){_0x465934[_0x23c4('0x1b')]=_0x430eed;if(_0x257465[_0x23c4('0x2d')]['includeAll']){_0xaaf104[_0x23c4('0x3f')]=[{'all':!![]}];}return db[_0x23c4('0x3e')][_0x23c4('0x40')](_0xaaf104);})['then'](function(_0x1cad4c){_0x465934[_0x23c4('0x41')]=_0x1cad4c;return _0x465934;})[_0x23c4('0x22')](respondWithFilteredResult(_0x5a07c7,_0xaaf104))[_0x23c4('0x42')](handleError(_0x5a07c7,null));};exports[_0x23c4('0x43')]=function(_0x13f75b,_0x174aea){var _0x49672c={'raw':!![],'where':{'id':_0x13f75b[_0x23c4('0x44')]['id']}},_0x4f0fa5={};_0x4f0fa5['model']=_['keys'](db[_0x23c4('0x3e')]['rawAttributes']);_0x4f0fa5['query']=_[_0x23c4('0x2e')](_0x13f75b[_0x23c4('0x2d')]);_0x4f0fa5['filters']=_[_0x23c4('0x31')](_0x4f0fa5[_0x23c4('0x2a')],_0x4f0fa5[_0x23c4('0x2d')]);_0x49672c[_0x23c4('0x30')]=_[_0x23c4('0x31')](_0x4f0fa5[_0x23c4('0x2a')],qs[_0x23c4('0x32')](_0x13f75b[_0x23c4('0x2d')]['fields']));_0x49672c[_0x23c4('0x30')]=_0x49672c[_0x23c4('0x30')][_0x23c4('0x33')]?_0x49672c[_0x23c4('0x30')]:_0x4f0fa5[_0x23c4('0x2a')];if(_0x13f75b['query'][_0x23c4('0x45')]){_0x49672c[_0x23c4('0x3f')]=[{'all':!![]}];}_0x49672c=_['merge']({},_0x49672c,_0x13f75b[_0x23c4('0x3d')]);return db[_0x23c4('0x3e')]['find'](_0x49672c)['then'](handleEntityNotFound(_0x174aea,null))[_0x23c4('0x22')](respondWithResult(_0x174aea,null))[_0x23c4('0x42')](handleError(_0x174aea,null));};exports[_0x23c4('0x46')]=function(_0x3aa5f6,_0x44ad4c){return db[_0x23c4('0x3e')][_0x23c4('0x46')](_0x3aa5f6[_0x23c4('0x47')],{})[_0x23c4('0x22')](respondWithResult(_0x44ad4c,0xc9))[_0x23c4('0x42')](handleError(_0x44ad4c,null));};exports['update']=function(_0x50528f,_0x4de5d2){if(_0x50528f['body']['id']){delete _0x50528f['body']['id'];}return db[_0x23c4('0x3e')]['find']({'where':{'id':_0x50528f[_0x23c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4de5d2,null))[_0x23c4('0x22')](saveUpdates(_0x50528f[_0x23c4('0x47')],null))['then'](respondWithResult(_0x4de5d2,null))[_0x23c4('0x42')](handleError(_0x4de5d2,null));};exports[_0x23c4('0x21')]=function(_0x5be171,_0x7fcd3e){return db[_0x23c4('0x3e')][_0x23c4('0x48')]({'where':{'id':_0x5be171[_0x23c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x7fcd3e,null))[_0x23c4('0x22')](removeEntity(_0x7fcd3e,null))['catch'](handleError(_0x7fcd3e,null));};exports[_0x23c4('0x49')]=function(_0x5cbd2f,_0x42684c,_0x4eea6d){return db['VoiceMailMessage']['find']({'where':{'id':_0x5cbd2f['params']['id']},'attributes':['id',_0x23c4('0x4a'),_0x23c4('0x4b')]})['then'](handleEntityNotFound(_0x42684c,null))[_0x23c4('0x22')](function(_0xb9f83){if(_0xb9f83){if(!_0xb9f83[_0x23c4('0x4a')]){throw new db[(_0x23c4('0x4c'))][(_0x23c4('0x4d'))](_0x23c4('0x4e'));}var _0x69fadc={'Content-Type':'audio/wav','Content-Disposition':_0x23c4('0x4f')};if(_0xb9f83[_0x23c4('0x4b')]){_0x69fadc[_0x23c4('0x50')]='attachment;\x20filename=\x22'+_0xb9f83[_0x23c4('0x4b')]+_0x23c4('0x51');}_0x42684c['set'](_0x69fadc);return _0x42684c[_0x23c4('0x52')](new Buffer(_0xb9f83[_0x23c4('0x4a')]));}})[_0x23c4('0x42')](handleError(_0x42684c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c5caa43..b9d344c 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 _0x05d5=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0x05d5,0x1d9));var _0x505d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x05d5[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x505d('0x0'));var util=require(_0x505d('0x1'));var logger=require(_0x505d('0x2'))(_0x505d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x505d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x505d('0x5'));var config=require(_0x505d('0x6'));var attributes=require(_0x505d('0x7'));module[_0x505d('0x8')]=function(_0x4fcdd8,_0x33eab5){return _0x4fcdd8[_0x505d('0x9')](_0x505d('0xa'),attributes,{'tableName':_0x505d('0xb'),'paranoid':![],'indexes':[{'name':_0x505d('0xc'),'fields':[_0x505d('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4ab3=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x7e6cf7,_0x4c8e23){var _0x18d4ee=function(_0x14b2fc){while(--_0x14b2fc){_0x7e6cf7['push'](_0x7e6cf7['shift']());}};_0x18d4ee(++_0x4c8e23);}(_0x4ab3,0x14a));var _0x34ab=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0x4ab3[_0xad57ee];return _0x3eaea9;};'use strict';var _=require(_0x34ab('0x0'));var util=require(_0x34ab('0x1'));var logger=require(_0x34ab('0x2'))('api');var moment=require(_0x34ab('0x3'));var BPromise=require(_0x34ab('0x4'));var rp=require(_0x34ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ab('0x6'));module[_0x34ab('0x7')]=function(_0x25430d,_0x14eb14){return _0x25430d[_0x34ab('0x8')](_0x34ab('0x9'),attributes,{'tableName':_0x34ab('0xa'),'paranoid':![],'indexes':[{'name':_0x34ab('0xb'),'fields':[_0x34ab('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index bd35893..c781708 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 _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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x5d370e,_0x35fd82){_0x5d370e=_0x5d370e-0x0;var _0x3e7dbc=_0x7a54[_0x5d370e];return _0x3e7dbc;};'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 +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4050a2,_0x185d9d){var _0x2fea5c=function(_0x1e778d){while(--_0x1e778d){_0x4050a2['push'](_0x4050a2['shift']());}};_0x2fea5c(++_0x185d9d);}(_0x14a0,0x8e));var _0x014a=function(_0xe256de,_0x8cd3f3){_0xe256de=_0xe256de-0x0;var _0x4f67b8=_0x14a0[_0xe256de];return _0x4f67b8;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0c715cb..64fec4e 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 _0xda8c=['getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds'];(function(_0x11a3bb,_0x5c5466){var _0x3c3e36=function(_0x59f16f){while(--_0x59f16f){_0x11a3bb['push'](_0x11a3bb['shift']());}};_0x3c3e36(++_0x5c5466);}(_0xda8c,0xb2));var _0xcda8=function(_0xc359da,_0x18423b){_0xc359da=_0xc359da-0x0;var _0x83d2fd=_0xda8c[_0xc359da];return _0x83d2fd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcda8('0x0'));var express=require(_0xcda8('0x1'));var router=express[_0xcda8('0x2')]();var auth=require(_0xcda8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcda8('0x4'));var controller=require(_0xcda8('0x5'));router[_0xcda8('0x6')]('/',auth[_0xcda8('0x7')](),controller[_0xcda8('0x8')]);router['get'](_0xcda8('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xcda8('0x6')](_0xcda8('0xa'),auth['isAuthenticated'](),controller[_0xcda8('0xb')]);router[_0xcda8('0xc')]('/',auth[_0xcda8('0x7')](),controller['create']);router['post']('/:id/sounds',auth[_0xcda8('0x7')](),controller[_0xcda8('0xd')]);router[_0xcda8('0xe')](_0xcda8('0x9'),auth[_0xcda8('0x7')](),controller[_0xcda8('0xf')]);router[_0xcda8('0x10')](_0xcda8('0x9'),auth['isAuthenticated'](),controller[_0xcda8('0x11')]);router[_0xcda8('0x10')](_0xcda8('0x12'),auth[_0xcda8('0x7')](),controller[_0xcda8('0x13')]);module[_0xcda8('0x14')]=router; \ No newline at end of file +var _0x78ca=['/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','index','get'];(function(_0x1a7630,_0x32cf65){var _0x3148db=function(_0x4f55f5){while(--_0x4f55f5){_0x1a7630['push'](_0x1a7630['shift']());}};_0x3148db(++_0x32cf65);}(_0x78ca,0xee));var _0xa78c=function(_0x45c9c3,_0x19d602){_0x45c9c3=_0x45c9c3-0x0;var _0x1f5f1d=_0x78ca[_0x45c9c3];return _0x1f5f1d;};'use strict';var multer=require(_0xa78c('0x0'));var util=require(_0xa78c('0x1'));var path=require(_0xa78c('0x2'));var timeout=require(_0xa78c('0x3'));var express=require(_0xa78c('0x4'));var router=express[_0xa78c('0x5')]();var auth=require(_0xa78c('0x6'));var interaction=require(_0xa78c('0x7'));var config=require('../../config/environment');var controller=require(_0xa78c('0x8'));router['get']('/',auth[_0xa78c('0x9')](),controller[_0xa78c('0xa')]);router[_0xa78c('0xb')](_0xa78c('0xc'),auth['isAuthenticated'](),controller[_0xa78c('0xd')]);router[_0xa78c('0xb')](_0xa78c('0xe'),auth[_0xa78c('0x9')](),controller[_0xa78c('0xf')]);router[_0xa78c('0x10')]('/',auth[_0xa78c('0x9')](),controller[_0xa78c('0x11')]);router[_0xa78c('0x10')](_0xa78c('0xe'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x12')]);router[_0xa78c('0x13')](_0xa78c('0xc'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x14')]);router[_0xa78c('0x15')](_0xa78c('0xc'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x16')]);router[_0xa78c('0x15')](_0xa78c('0x17'),auth[_0xa78c('0x9')](),controller[_0xa78c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f68bef1..4e1bada 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 _0x1798=['exports','STRING','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0xdb0814,_0x1bc20e){var _0x28c819=function(_0x33a390){while(--_0x33a390){_0xdb0814['push'](_0xdb0814['shift']());}};_0x28c819(++_0x1bc20e);}(_0x1798,0xa7));var _0x8179=function(_0x50fad3,_0x1e01d4){_0x50fad3=_0x50fad3-0x0;var _0x2fee19=_0x1798[_0x50fad3];return _0x2fee19;};'use strict';var Sequelize=require(_0x8179('0x0'));module[_0x8179('0x1')]={'name':{'type':Sequelize[_0x8179('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x8179('0x3'),_0x8179('0x4'),_0x8179('0x5'),_0x8179('0x6'),_0x8179('0x7'),_0x8179('0x8')),'allowNull':!![],'defaultValue':_0x8179('0x4')},'directory':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![],'defaultValue':_0x8179('0x9')},'format':{'type':Sequelize[_0x8179('0x2')],'allowNull':!![]},'stamp':{'type':_0x8179('0xa')},'defaultEntry':{'type':Sequelize[_0x8179('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x94b9=['sequelize','exports','STRING','name','ENUM','mp3nb','quietmp3nb','quietmp3','files','alpha','TIMESTAMP','BOOLEAN'];(function(_0x13d9ac,_0x193a78){var _0x348a17=function(_0x5625a2){while(--_0x5625a2){_0x13d9ac['push'](_0x13d9ac['shift']());}};_0x348a17(++_0x193a78);}(_0x94b9,0xe4));var _0x994b=function(_0x561663,_0x760489){_0x561663=_0x561663-0x0;var _0x1f6580=_0x94b9[_0x561663];return _0x1f6580;};'use strict';var Sequelize=require(_0x994b('0x0'));module[_0x994b('0x1')]={'name':{'type':Sequelize[_0x994b('0x2')],'allowNull':![],'unique':_0x994b('0x3')},'mode':{'type':Sequelize[_0x994b('0x4')]('custom','files',_0x994b('0x5'),_0x994b('0x6'),_0x994b('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x994b('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x994b('0x2')],'allowNull':!![],'defaultValue':_0x994b('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x994b('0xa')},'defaultEntry':{'type':Sequelize[_0x994b('0xb')],'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 21c50eb..e6a77fd 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 _0xb686=['pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','find','body','create','sequelize','transaction','mode','files','server/files/moh','directory','0777','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','format','basename','root','%s.%s','removeSound','id2','getSounds','nolimit','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xb686,0xa1));var _0x6b68=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb686[_0x36eaaa];return _0x461349;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b68('0x0'));var rimraf=require(_0x6b68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b68('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b68('0x3'));var Mustache=require(_0x6b68('0x4'));var util=require(_0x6b68('0x5'));var path=require(_0x6b68('0x6'));var sox=require('sox');var csv=require(_0x6b68('0x7'));var ejs=require(_0x6b68('0x8'));var fs=require('fs');var _=require(_0x6b68('0x9'));var squel=require(_0x6b68('0xa'));var crypto=require(_0x6b68('0xb'));var jsforce=require(_0x6b68('0xc'));var deskjs=require(_0x6b68('0xd'));var toCsv=require(_0x6b68('0x7'));var querystring=require(_0x6b68('0xe'));var Papa=require(_0x6b68('0xf'));var Redis=require(_0x6b68('0x10'));var authService=require(_0x6b68('0x11'));var qs=require(_0x6b68('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b68('0x13'))(_0x6b68('0x14'));var utils=require(_0x6b68('0x15'));var config=require(_0x6b68('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b68('0x17'))['db'];function respondWithStatusCode(_0x432fbe,_0x15af87){_0x15af87=_0x15af87||0xcc;return function(_0x293bcd){if(_0x293bcd){return _0x432fbe[_0x6b68('0x18')](_0x15af87);}return _0x432fbe[_0x6b68('0x19')](_0x15af87)[_0x6b68('0x1a')]();};}function respondWithResult(_0x367713,_0x306cc8){_0x306cc8=_0x306cc8||0xc8;return function(_0x4f1bd3){if(_0x4f1bd3){return _0x367713[_0x6b68('0x19')](_0x306cc8)[_0x6b68('0x1b')](_0x4f1bd3);}};}function respondWithFilteredResult(_0x25a247,_0x46aa0c){return function(_0x551416){if(_0x551416){var _0x9bb29f=_0x551416[_0x6b68('0x1c')],_0x3267ae=_0x46aa0c[_0x6b68('0x1d')],_0x25a7c2=_0x46aa0c['offset']+_0x46aa0c[_0x6b68('0x1e')],_0x186c5a;if(_0x25a7c2>=_0x9bb29f){_0x25a7c2=_0x9bb29f;_0x186c5a=0xc8;}else{_0x186c5a=0xce;}_0x25a247['status'](_0x186c5a);return _0x25a247[_0x6b68('0x1f')](_0x6b68('0x20'),_0x3267ae+'-'+_0x25a7c2+'/'+_0x9bb29f)['json'](_0x551416);}return null;};}function patchUpdates(_0x31f240){return function(_0x3fc8bd){try{jsonpatch[_0x6b68('0x21')](_0x3fc8bd,_0x31f240,!![]);}catch(_0x505e6b){return BPromise[_0x6b68('0x22')](_0x505e6b);}return _0x3fc8bd['save']();};}function saveUpdates(_0x2934cb,_0x213830){return function(_0x116b24){if(_0x116b24){return _0x116b24['update'](_0x2934cb)[_0x6b68('0x23')](function(_0x35cfb6){return _0x35cfb6;});}return null;};}function removeEntity(_0x30e33a,_0x2b3879){return function(_0x5e2e66){if(_0x5e2e66){return _0x5e2e66[_0x6b68('0x24')]()[_0x6b68('0x23')](function(){var _0x797407=_0x5e2e66[_0x6b68('0x25')]({'plain':!![]});var _0x5eeff7=_0x6b68('0x26');return db[_0x6b68('0x27')]['destroy']({'where':{'type':_0x5eeff7,'resourceId':_0x797407['id']}})['then'](function(){return _0x5e2e66;});})[_0x6b68('0x23')](function(){_0x30e33a[_0x6b68('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a88da,_0x1c271a){return function(_0x299807){if(!_0x299807){_0x3a88da['sendStatus'](0x194);}return _0x299807;};}function handleError(_0x3a4316,_0x12e837){_0x12e837=_0x12e837||0x1f4;return function(_0x29ba69){logger[_0x6b68('0x28')](_0x29ba69[_0x6b68('0x29')]);if(_0x29ba69[_0x6b68('0x2a')]){delete _0x29ba69['name'];}_0x3a4316['status'](_0x12e837)[_0x6b68('0x2b')](_0x29ba69);};}exports['index']=function(_0x413eed,_0x16e734){var _0x25b431={},_0x596c72={},_0x28644d={'count':0x0,'rows':[]};var _0x555d37=_[_0x6b68('0x2c')](db['VoiceMusicOnHold'][_0x6b68('0x2d')],function(_0x22913c){return{'name':_0x22913c[_0x6b68('0x2e')],'type':_0x22913c[_0x6b68('0x2f')][_0x6b68('0x30')]};});_0x596c72[_0x6b68('0x31')]=_['map'](_0x555d37,_0x6b68('0x2a'));_0x596c72['query']=_[_0x6b68('0x32')](_0x413eed[_0x6b68('0x33')]);_0x596c72[_0x6b68('0x34')]=_['intersection'](_0x596c72[_0x6b68('0x31')],_0x596c72[_0x6b68('0x33')]);_0x25b431[_0x6b68('0x35')]=_[_0x6b68('0x36')](_0x596c72[_0x6b68('0x31')],qs[_0x6b68('0x37')](_0x413eed[_0x6b68('0x33')][_0x6b68('0x37')]));_0x25b431[_0x6b68('0x35')]=_0x25b431[_0x6b68('0x35')][_0x6b68('0x38')]?_0x25b431[_0x6b68('0x35')]:_0x596c72[_0x6b68('0x31')];if(!_0x413eed['query'][_0x6b68('0x39')]('nolimit')){_0x25b431[_0x6b68('0x1e')]=qs['limit'](_0x413eed[_0x6b68('0x33')]['limit']);_0x25b431[_0x6b68('0x1d')]=qs['offset'](_0x413eed[_0x6b68('0x33')][_0x6b68('0x1d')]);}_0x25b431[_0x6b68('0x3a')]=qs[_0x6b68('0x3b')](_0x413eed['query'][_0x6b68('0x3b')]);_0x25b431[_0x6b68('0x3c')]=qs[_0x6b68('0x34')](_[_0x6b68('0x3d')](_0x413eed['query'],_0x596c72['filters']),_0x555d37);if(_0x413eed[_0x6b68('0x33')][_0x6b68('0x3e')]){_0x25b431['where']=_[_0x6b68('0x3f')](_0x25b431['where'],{'$or':_[_0x6b68('0x2c')](_0x555d37,function(_0x3e4283){if(_0x3e4283[_0x6b68('0x2f')]!==_0x6b68('0x40')){var _0x2f572f={};_0x2f572f[_0x3e4283[_0x6b68('0x2a')]]={'$like':'%'+_0x413eed[_0x6b68('0x33')][_0x6b68('0x3e')]+'%'};return _0x2f572f;}})});}_0x25b431=_[_0x6b68('0x3f')]({},_0x25b431,_0x413eed[_0x6b68('0x41')]);var _0x3dbe91={'where':_0x25b431[_0x6b68('0x3c')]};return db[_0x6b68('0x42')]['count'](_0x3dbe91)[_0x6b68('0x23')](function(_0x51b35e){_0x28644d[_0x6b68('0x1c')]=_0x51b35e;if(_0x413eed['query'][_0x6b68('0x43')]){_0x25b431[_0x6b68('0x44')]=[{'all':!![]}];}return db[_0x6b68('0x42')][_0x6b68('0x45')](_0x25b431);})[_0x6b68('0x23')](function(_0x200b1f){_0x28644d[_0x6b68('0x46')]=_0x200b1f;return _0x28644d;})[_0x6b68('0x23')](respondWithFilteredResult(_0x16e734,_0x25b431))[_0x6b68('0x47')](handleError(_0x16e734,null));};exports[_0x6b68('0x48')]=function(_0x42eaaf,_0x260b1f){var _0x59ce24={'raw':![],'where':{'id':_0x42eaaf[_0x6b68('0x49')]['id']}},_0x25fbe0={};_0x25fbe0[_0x6b68('0x31')]=_[_0x6b68('0x32')](db[_0x6b68('0x42')][_0x6b68('0x2d')]);_0x25fbe0[_0x6b68('0x33')]=_['keys'](_0x42eaaf['query']);_0x25fbe0[_0x6b68('0x34')]=_[_0x6b68('0x36')](_0x25fbe0['model'],_0x25fbe0['query']);_0x59ce24[_0x6b68('0x35')]=_[_0x6b68('0x36')](_0x25fbe0[_0x6b68('0x31')],qs['fields'](_0x42eaaf[_0x6b68('0x33')][_0x6b68('0x37')]));_0x59ce24[_0x6b68('0x35')]=_0x59ce24[_0x6b68('0x35')][_0x6b68('0x38')]?_0x59ce24['attributes']:_0x25fbe0[_0x6b68('0x31')];if(_0x42eaaf['query'][_0x6b68('0x43')]){_0x59ce24['include']=[{'all':!![]}];}_0x59ce24=_[_0x6b68('0x3f')]({},_0x59ce24,_0x42eaaf[_0x6b68('0x41')]);return db[_0x6b68('0x42')][_0x6b68('0x4a')](_0x59ce24)[_0x6b68('0x23')](handleEntityNotFound(_0x260b1f,null))[_0x6b68('0x23')](respondWithResult(_0x260b1f,null))[_0x6b68('0x47')](handleError(_0x260b1f,null));};exports['update']=function(_0xdac5d1,_0x3a7226){if(_0xdac5d1[_0x6b68('0x4b')]['id']){delete _0xdac5d1[_0x6b68('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x6b68('0x4a')]({'where':{'id':_0xdac5d1[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](handleEntityNotFound(_0x3a7226,null))[_0x6b68('0x23')](saveUpdates(_0xdac5d1[_0x6b68('0x4b')],null))[_0x6b68('0x23')](respondWithResult(_0x3a7226,null))[_0x6b68('0x47')](handleError(_0x3a7226,null));};exports[_0x6b68('0x4c')]=function(_0x2b4d31,_0x3d348b,_0x5b7dc5){return db[_0x6b68('0x4d')][_0x6b68('0x4e')](function(_0x576289){if(_0x2b4d31[_0x6b68('0x4b')][_0x6b68('0x4f')]===_0x6b68('0x50')){_0x2b4d31[_0x6b68('0x4b')]['directory']=path['join'](config['root'],_0x6b68('0x51'),_0x2b4d31[_0x6b68('0x4b')]['name']);}return db[_0x6b68('0x42')][_0x6b68('0x4c')](_0x2b4d31[_0x6b68('0x4b')],{'transaction':_0x576289})[_0x6b68('0x23')](function(_0x5638fe){if(_0x2b4d31['body'][_0x6b68('0x4f')]===_0x6b68('0x50')){fs['mkdirSync'](_0x5638fe[_0x6b68('0x52')],parseInt(_0x6b68('0x53'),0x8));}var _0x16d35b=_0x2b4d31['user'][_0x6b68('0x25')]({'plain':!![]});if(!_0x16d35b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16d35b['role']===_0x6b68('0x54')){var _0x2d9828=_0x5638fe[_0x6b68('0x25')]({'plain':!![]});return db[_0x6b68('0x55')][_0x6b68('0x4a')]({'where':{'name':_0x6b68('0x26'),'userProfileId':_0x16d35b[_0x6b68('0x56')]},'raw':!![]})[_0x6b68('0x23')](function(_0x5a2971){if(_0x5a2971&&_0x5a2971[_0x6b68('0x57')]===0x0){return db[_0x6b68('0x27')]['create']({'name':_0x2d9828[_0x6b68('0x2a')],'resourceId':_0x2d9828['id'],'type':_0x5a2971[_0x6b68('0x2a')],'sectionId':_0x5a2971['id']},{})[_0x6b68('0x23')](function(){return _0x5638fe;});}else{return _0x5638fe;}})[_0x6b68('0x47')](function(_0x333a42){logger['error'](_0x6b68('0x58'),_0x333a42);});}return _0x5638fe;});})['then'](respondWithResult(_0x3d348b,0xc9))['catch'](handleError(_0x3d348b,null));};exports[_0x6b68('0x24')]=function(_0x90105e,_0x3dd078,_0x48d3fb){var _0x54e1a2;return db[_0x6b68('0x42')][_0x6b68('0x4a')]({'where':{'id':_0x90105e[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](function(_0x32a134){if(_0x32a134){return db['sequelize'][_0x6b68('0x4e')](function(_0x4c8f2a){return _0x32a134[_0x6b68('0x24')]({'transaction':_0x4c8f2a,'raw':!![]})[_0x6b68('0x23')](function(_0x313856){if(_0x313856[_0x6b68('0x52')]){fs[_0x6b68('0x59')](_0x313856[_0x6b68('0x52')])[_0x6b68('0x5a')](function(_0x332228){fs[_0x6b68('0x5b')](path['join'](_0x313856['directory'],_0x332228));});fs[_0x6b68('0x5c')](_0x313856[_0x6b68('0x52')]);}return _0x313856;});})[_0x6b68('0x47')](function(_0x4d9e3e){throw new db[(_0x6b68('0x5d'))][(_0x6b68('0x5e'))](_0x4d9e3e[_0x6b68('0x5f')]);});}})[_0x6b68('0x23')](handleEntityNotFound(_0x3dd078,null))['then'](removeEntity(_0x3dd078,null))[_0x6b68('0x47')](handleError(_0x3dd078,null));};exports['addSound']=function(_0x15bb19,_0x4a7db1,_0x564897){return db[_0x6b68('0x4d')]['transaction'](function(_0xbcbe86){var _0x50ce3d;return db[_0x6b68('0x42')]['find']({'where':{'id':_0x15bb19[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](function(_0x424c17){if(_0x424c17){_0x50ce3d=_0x424c17;return _0x424c17[_0x6b68('0x60')](_0x15bb19[_0x6b68('0x4b')]['id'],{'transaction':_0xbcbe86});}})[_0x6b68('0x23')](function(_0xc0861a){if(_0xc0861a){return db[_0x6b68('0x61')][_0x6b68('0x62')]({'where':{'id':_0x15bb19[_0x6b68('0x4b')]['id']},'attributes':['id','name',_0x6b68('0x63'),_0x6b68('0x64'),_0x6b68('0x65')],'raw':!![]});}})[_0x6b68('0x23')](function(_0x4d8b3e){if(_0x4d8b3e){var _0x549eaa=path[_0x6b68('0x66')](config['root'],'server/files/sounds/converted',util[_0x6b68('0x67')]('%s.%s',path[_0x6b68('0x68')](_0x4d8b3e[_0x6b68('0x63')],path['extname'](_0x4d8b3e[_0x6b68('0x63')])),_0x4d8b3e[_0x6b68('0x64')]));var _0x2c4e88=path[_0x6b68('0x66')](config[_0x6b68('0x69')],_0x6b68('0x51'),_0x50ce3d[_0x6b68('0x2a')],util['format'](_0x6b68('0x6a'),_0x4d8b3e['name'],_0x4d8b3e[_0x6b68('0x64')]));fs['symlinkSync'](_0x549eaa,_0x2c4e88);return _0x4d8b3e;}})[_0x6b68('0x47')](function(_0x29a9b9){throw new db[(_0x6b68('0x5d'))][(_0x6b68('0x5e'))](_0x29a9b9[_0x6b68('0x5f')]);});})['then'](handleEntityNotFound(_0x4a7db1,null))[_0x6b68('0x23')](respondWithResult(_0x4a7db1,0xc9))[_0x6b68('0x47')](handleError(_0x4a7db1,null));};exports['removeSound']=function(_0x2d5e01,_0x5e6bd8,_0x169134){return db[_0x6b68('0x4d')][_0x6b68('0x4e')](function(_0x19173b){var _0x23c327;return db[_0x6b68('0x42')][_0x6b68('0x62')]({'where':{'id':_0x2d5e01[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](handleEntityNotFound(_0x5e6bd8,null))[_0x6b68('0x23')](function(_0x125a3a){if(_0x125a3a){_0x23c327=_0x125a3a;return _0x125a3a[_0x6b68('0x6b')](_0x2d5e01[_0x6b68('0x49')]['id2']);}})[_0x6b68('0x23')](function(_0x4918e5){if(_0x4918e5){return db[_0x6b68('0x61')][_0x6b68('0x62')]({'where':{'id':_0x2d5e01[_0x6b68('0x49')][_0x6b68('0x6c')]},'attributes':['id',_0x6b68('0x2a'),_0x6b68('0x63'),_0x6b68('0x64'),_0x6b68('0x65')],'raw':!![]});}})['then'](function(_0x4059f7){if(_0x4059f7){fs['unlinkSync'](path['join'](_0x23c327[_0x6b68('0x52')],util['format']('%s.%s',_0x4059f7[_0x6b68('0x2a')],_0x4059f7[_0x6b68('0x64')])));return _0x4059f7;}})[_0x6b68('0x47')](function(_0x5124aa){throw new db['Sequelize'][(_0x6b68('0x5e'))](_0x5124aa['message']);});})['then'](handleEntityNotFound(_0x5e6bd8,null))[_0x6b68('0x23')](respondWithStatusCode(_0x5e6bd8,0xcc))[_0x6b68('0x47')](handleError(_0x5e6bd8,null));};exports[_0x6b68('0x6d')]=function(_0x3a2e69,_0x1ab5be,_0x3a9c8f){var _0x26eb8b={};var _0x27e5e8={};var _0x2341bf;var _0x45357c;return db[_0x6b68('0x42')]['findOne']({'where':{'id':_0x3a2e69[_0x6b68('0x49')]['id']}})[_0x6b68('0x23')](handleEntityNotFound(_0x1ab5be,null))['then'](function(_0x5cdd33){if(_0x5cdd33){_0x2341bf=_0x5cdd33;_0x27e5e8[_0x6b68('0x31')]=_[_0x6b68('0x32')](db[_0x6b68('0x61')][_0x6b68('0x2d')]);_0x27e5e8[_0x6b68('0x33')]=_['keys'](_0x3a2e69[_0x6b68('0x33')]);_0x27e5e8[_0x6b68('0x34')]=_[_0x6b68('0x36')](_0x27e5e8['model'],_0x27e5e8[_0x6b68('0x33')]);_0x26eb8b['attributes']=_['intersection'](_0x27e5e8[_0x6b68('0x31')],qs[_0x6b68('0x37')](_0x3a2e69[_0x6b68('0x33')]['fields']));_0x26eb8b['attributes']=_0x26eb8b[_0x6b68('0x35')]['length']?_0x26eb8b[_0x6b68('0x35')]:_0x27e5e8[_0x6b68('0x31')];_0x26eb8b[_0x6b68('0x3a')]=qs[_0x6b68('0x3b')](_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x3b')]);_0x26eb8b['where']=qs[_0x6b68('0x34')](_[_0x6b68('0x3d')](_0x3a2e69[_0x6b68('0x33')],_0x27e5e8[_0x6b68('0x34')]));if(_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x3e')]){_0x26eb8b[_0x6b68('0x3c')]=_[_0x6b68('0x3f')](_0x26eb8b[_0x6b68('0x3c')],{'$or':_[_0x6b68('0x2c')](_0x26eb8b['attributes'],function(_0xc4bd50){var _0x4097a8={};_0x4097a8[_0xc4bd50]={'$like':'%'+_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x3e')]+'%'};return _0x4097a8;})});}_0x26eb8b=_[_0x6b68('0x3f')]({},_0x26eb8b,_0x3a2e69[_0x6b68('0x41')]);return _0x2341bf[_0x6b68('0x6d')](_0x26eb8b);}})['then'](function(_0x30aacc){if(_0x30aacc){_0x45357c=_0x30aacc[_0x6b68('0x38')];if(!_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x39')](_0x6b68('0x6e'))){_0x26eb8b['limit']=qs[_0x6b68('0x1e')](_0x3a2e69['query'][_0x6b68('0x1e')]);_0x26eb8b[_0x6b68('0x1d')]=qs[_0x6b68('0x1d')](_0x3a2e69[_0x6b68('0x33')][_0x6b68('0x1d')]);}return _0x2341bf[_0x6b68('0x6d')](_0x26eb8b);}})[_0x6b68('0x23')](function(_0x42dc4c){if(_0x42dc4c){return _0x42dc4c?{'count':_0x45357c,'rows':_0x42dc4c}:null;}})[_0x6b68('0x23')](respondWithResult(_0x1ab5be,null))[_0x6b68('0x47')](handleError(_0x1ab5be,null));}; \ No newline at end of file +var _0xc188=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','update','destroy','then','end','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','ValidationError','message','addSound','sequelize','Sound','findOne','save_name','converted_format','createdAt','format','extname','%s.%s','symlinkSync','Sequelize','removeSound','id2','length','html-pdf','fast-json-patch','bluebird','util','path','to-csv','lodash','squel'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc188,0x1ec));var _0x8c18=function(_0x1caa5e,_0x228179){_0x1caa5e=_0x1caa5e-0x0;var _0x4bf1ea=_0xc188[_0x1caa5e];return _0x4bf1ea;};'use strict';var pdf=require(_0x8c18('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c18('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8c18('0x2'));var Mustache=require('mustache');var util=require(_0x8c18('0x3'));var path=require(_0x8c18('0x4'));var sox=require('sox');var csv=require(_0x8c18('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c18('0x6'));var squel=require(_0x8c18('0x7'));var crypto=require(_0x8c18('0x8'));var jsforce=require(_0x8c18('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8c18('0x5'));var querystring=require(_0x8c18('0xa'));var Papa=require('papaparse');var Redis=require(_0x8c18('0xb'));var authService=require(_0x8c18('0xc'));var qs=require(_0x8c18('0xd'));var as=require(_0x8c18('0xe'));var hardwareService=require(_0x8c18('0xf'));var logger=require('../../config/logger')(_0x8c18('0x10'));var utils=require(_0x8c18('0x11'));var config=require(_0x8c18('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e1e4,_0xa6061d){_0xa6061d=_0xa6061d||0xcc;return function(_0x16025b){if(_0x16025b){return _0x23e1e4[_0x8c18('0x13')](_0xa6061d);}return _0x23e1e4[_0x8c18('0x14')](_0xa6061d)['end']();};}function respondWithResult(_0xf3f140,_0x57b715){_0x57b715=_0x57b715||0xc8;return function(_0x2683eb){if(_0x2683eb){return _0xf3f140[_0x8c18('0x14')](_0x57b715)[_0x8c18('0x15')](_0x2683eb);}};}function respondWithFilteredResult(_0x32a92e,_0x16c49e){return function(_0x4a4b9d){if(_0x4a4b9d){var _0x345a55=_0x4a4b9d[_0x8c18('0x16')],_0x1cc01c=_0x16c49e[_0x8c18('0x17')],_0x2d7a55=_0x16c49e[_0x8c18('0x17')]+_0x16c49e[_0x8c18('0x18')],_0x38f70b;if(_0x2d7a55>=_0x345a55){_0x2d7a55=_0x345a55;_0x38f70b=0xc8;}else{_0x38f70b=0xce;}_0x32a92e[_0x8c18('0x14')](_0x38f70b);return _0x32a92e[_0x8c18('0x19')](_0x8c18('0x1a'),_0x1cc01c+'-'+_0x2d7a55+'/'+_0x345a55)[_0x8c18('0x15')](_0x4a4b9d);}return null;};}function patchUpdates(_0x82a713){return function(_0x396606){try{jsonpatch['apply'](_0x396606,_0x82a713,!![]);}catch(_0x35e564){return BPromise['reject'](_0x35e564);}return _0x396606['save']();};}function saveUpdates(_0x585aba,_0x51a895){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0x8c18('0x1b')](_0x585aba)['then'](function(_0x1730bd){return _0x1730bd;});}return null;};}function removeEntity(_0x3df6c1,_0x10a647){return function(_0xe8ca04){if(_0xe8ca04){return _0xe8ca04[_0x8c18('0x1c')]()[_0x8c18('0x1d')](function(){var _0x395992=_0xe8ca04['get']({'plain':!![]});var _0x3aa12c='MusicOnHolds';return db['UserProfileResource']['destroy']({'where':{'type':_0x3aa12c,'resourceId':_0x395992['id']}})[_0x8c18('0x1d')](function(){return _0xe8ca04;});})[_0x8c18('0x1d')](function(){_0x3df6c1[_0x8c18('0x14')](0xcc)[_0x8c18('0x1e')]();});}};}function handleEntityNotFound(_0x27c1dc,_0x313efe){return function(_0x4c1737){if(!_0x4c1737){_0x27c1dc[_0x8c18('0x13')](0x194);}return _0x4c1737;};}function handleError(_0x560027,_0x2f5eb9){_0x2f5eb9=_0x2f5eb9||0x1f4;return function(_0x183d09){logger[_0x8c18('0x1f')](_0x183d09[_0x8c18('0x20')]);if(_0x183d09[_0x8c18('0x21')]){delete _0x183d09[_0x8c18('0x21')];}_0x560027[_0x8c18('0x14')](_0x2f5eb9)['send'](_0x183d09);};}exports[_0x8c18('0x22')]=function(_0x426223,_0xf8d97d){var _0xe113de={},_0x39132a={},_0x38ecfd={'count':0x0,'rows':[]};var _0x40fb24=_['map'](db[_0x8c18('0x23')][_0x8c18('0x24')],function(_0x429e34){return{'name':_0x429e34[_0x8c18('0x25')],'type':_0x429e34[_0x8c18('0x26')]['key']};});_0x39132a['model']=_[_0x8c18('0x27')](_0x40fb24,_0x8c18('0x21'));_0x39132a[_0x8c18('0x28')]=_[_0x8c18('0x29')](_0x426223[_0x8c18('0x28')]);_0x39132a[_0x8c18('0x2a')]=_[_0x8c18('0x2b')](_0x39132a[_0x8c18('0x2c')],_0x39132a[_0x8c18('0x28')]);_0xe113de['attributes']=_['intersection'](_0x39132a[_0x8c18('0x2c')],qs[_0x8c18('0x2d')](_0x426223[_0x8c18('0x28')]['fields']));_0xe113de[_0x8c18('0x2e')]=_0xe113de[_0x8c18('0x2e')]['length']?_0xe113de[_0x8c18('0x2e')]:_0x39132a[_0x8c18('0x2c')];if(!_0x426223['query'][_0x8c18('0x2f')](_0x8c18('0x30'))){_0xe113de[_0x8c18('0x18')]=qs['limit'](_0x426223['query'][_0x8c18('0x18')]);_0xe113de[_0x8c18('0x17')]=qs[_0x8c18('0x17')](_0x426223[_0x8c18('0x28')]['offset']);}_0xe113de[_0x8c18('0x31')]=qs[_0x8c18('0x32')](_0x426223[_0x8c18('0x28')][_0x8c18('0x32')]);_0xe113de[_0x8c18('0x33')]=qs[_0x8c18('0x2a')](_[_0x8c18('0x34')](_0x426223[_0x8c18('0x28')],_0x39132a[_0x8c18('0x2a')]),_0x40fb24);if(_0x426223[_0x8c18('0x28')][_0x8c18('0x35')]){_0xe113de[_0x8c18('0x33')]=_[_0x8c18('0x36')](_0xe113de['where'],{'$or':_[_0x8c18('0x27')](_0x40fb24,function(_0x22ef00){if(_0x22ef00[_0x8c18('0x26')]!=='VIRTUAL'){var _0x363c81={};_0x363c81[_0x22ef00[_0x8c18('0x21')]]={'$like':'%'+_0x426223[_0x8c18('0x28')]['filter']+'%'};return _0x363c81;}})});}_0xe113de=_['merge']({},_0xe113de,_0x426223[_0x8c18('0x37')]);var _0x3185c5={'where':_0xe113de[_0x8c18('0x33')]};return db[_0x8c18('0x23')][_0x8c18('0x16')](_0x3185c5)[_0x8c18('0x1d')](function(_0x3594d1){_0x38ecfd[_0x8c18('0x16')]=_0x3594d1;if(_0x426223[_0x8c18('0x28')][_0x8c18('0x38')]){_0xe113de[_0x8c18('0x39')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x8c18('0x3a')](_0xe113de);})[_0x8c18('0x1d')](function(_0x4eabd5){_0x38ecfd[_0x8c18('0x3b')]=_0x4eabd5;return _0x38ecfd;})[_0x8c18('0x1d')](respondWithFilteredResult(_0xf8d97d,_0xe113de))[_0x8c18('0x3c')](handleError(_0xf8d97d,null));};exports[_0x8c18('0x3d')]=function(_0x2fa2f7,_0x241e31){var _0xacbd23={'raw':![],'where':{'id':_0x2fa2f7[_0x8c18('0x3e')]['id']}},_0x401020={};_0x401020[_0x8c18('0x2c')]=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x401020['query']=_[_0x8c18('0x29')](_0x2fa2f7[_0x8c18('0x28')]);_0x401020[_0x8c18('0x2a')]=_['intersection'](_0x401020[_0x8c18('0x2c')],_0x401020['query']);_0xacbd23['attributes']=_[_0x8c18('0x2b')](_0x401020[_0x8c18('0x2c')],qs[_0x8c18('0x2d')](_0x2fa2f7[_0x8c18('0x28')]['fields']));_0xacbd23[_0x8c18('0x2e')]=_0xacbd23[_0x8c18('0x2e')]['length']?_0xacbd23[_0x8c18('0x2e')]:_0x401020[_0x8c18('0x2c')];if(_0x2fa2f7[_0x8c18('0x28')]['includeAll']){_0xacbd23[_0x8c18('0x39')]=[{'all':!![]}];}_0xacbd23=_[_0x8c18('0x36')]({},_0xacbd23,_0x2fa2f7[_0x8c18('0x37')]);return db['VoiceMusicOnHold'][_0x8c18('0x3f')](_0xacbd23)['then'](handleEntityNotFound(_0x241e31,null))[_0x8c18('0x1d')](respondWithResult(_0x241e31,null))[_0x8c18('0x3c')](handleError(_0x241e31,null));};exports[_0x8c18('0x1b')]=function(_0x976d0d,_0x4c963d){if(_0x976d0d[_0x8c18('0x40')]['id']){delete _0x976d0d['body']['id'];}return db[_0x8c18('0x23')][_0x8c18('0x3f')]({'where':{'id':_0x976d0d['params']['id']}})[_0x8c18('0x1d')](handleEntityNotFound(_0x4c963d,null))[_0x8c18('0x1d')](saveUpdates(_0x976d0d['body'],null))[_0x8c18('0x1d')](respondWithResult(_0x4c963d,null))['catch'](handleError(_0x4c963d,null));};exports[_0x8c18('0x41')]=function(_0x5bbf03,_0x32b4ce,_0x2a8bf1){return db['sequelize'][_0x8c18('0x42')](function(_0x24977b){if(_0x5bbf03[_0x8c18('0x40')]['mode']===_0x8c18('0x43')){_0x5bbf03['body']['directory']=path[_0x8c18('0x44')](config[_0x8c18('0x45')],_0x8c18('0x46'),_0x5bbf03[_0x8c18('0x40')][_0x8c18('0x21')]);}return db['VoiceMusicOnHold'][_0x8c18('0x41')](_0x5bbf03[_0x8c18('0x40')],{'transaction':_0x24977b})[_0x8c18('0x1d')](function(_0x2d0a1e){if(_0x5bbf03[_0x8c18('0x40')][_0x8c18('0x47')]===_0x8c18('0x43')){fs[_0x8c18('0x48')](_0x2d0a1e[_0x8c18('0x49')],parseInt(_0x8c18('0x4a'),0x8));}var _0x527b99=_0x5bbf03['user']['get']({'plain':!![]});if(!_0x527b99)throw new Error(_0x8c18('0x4b'));if(_0x527b99['role']==='user'){var _0x5457d2=_0x2d0a1e['get']({'plain':!![]});return db[_0x8c18('0x4c')][_0x8c18('0x3f')]({'where':{'name':_0x8c18('0x4d'),'userProfileId':_0x527b99[_0x8c18('0x4e')]},'raw':!![]})['then'](function(_0x48540e){if(_0x48540e&&_0x48540e[_0x8c18('0x4f')]===0x0){return db[_0x8c18('0x50')][_0x8c18('0x41')]({'name':_0x5457d2[_0x8c18('0x21')],'resourceId':_0x5457d2['id'],'type':_0x48540e['name'],'sectionId':_0x48540e['id']},{})[_0x8c18('0x1d')](function(){return _0x2d0a1e;});}else{return _0x2d0a1e;}})['catch'](function(_0x52bdf2){logger[_0x8c18('0x1f')](_0x8c18('0x51'),_0x52bdf2);});}return _0x2d0a1e;});})[_0x8c18('0x1d')](respondWithResult(_0x32b4ce,0xc9))[_0x8c18('0x3c')](handleError(_0x32b4ce,null));};exports[_0x8c18('0x1c')]=function(_0x10a1c6,_0x499628,_0x580a70){var _0x2a123d;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x10a1c6[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](function(_0x8a5c8f){if(_0x8a5c8f){return db['sequelize'][_0x8c18('0x42')](function(_0x182c83){return _0x8a5c8f['destroy']({'transaction':_0x182c83,'raw':!![]})[_0x8c18('0x1d')](function(_0x1c7d31){if(_0x1c7d31[_0x8c18('0x49')]){fs[_0x8c18('0x52')](_0x1c7d31[_0x8c18('0x49')])['forEach'](function(_0x3bee09){fs['unlinkSync'](path[_0x8c18('0x44')](_0x1c7d31[_0x8c18('0x49')],_0x3bee09));});fs['rmdirSync'](_0x1c7d31[_0x8c18('0x49')]);}return _0x1c7d31;});})['catch'](function(_0x3b5da9){throw new db['Sequelize'][(_0x8c18('0x53'))](_0x3b5da9[_0x8c18('0x54')]);});}})['then'](handleEntityNotFound(_0x499628,null))[_0x8c18('0x1d')](removeEntity(_0x499628,null))[_0x8c18('0x3c')](handleError(_0x499628,null));};exports[_0x8c18('0x55')]=function(_0x82111b,_0x23b07e,_0x24f907){return db[_0x8c18('0x56')][_0x8c18('0x42')](function(_0x484e4a){var _0x28cc1e;return db[_0x8c18('0x23')][_0x8c18('0x3f')]({'where':{'id':_0x82111b[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](function(_0x470ae0){if(_0x470ae0){_0x28cc1e=_0x470ae0;return _0x470ae0[_0x8c18('0x55')](_0x82111b[_0x8c18('0x40')]['id'],{'transaction':_0x484e4a});}})[_0x8c18('0x1d')](function(_0x6ec1f1){if(_0x6ec1f1){return db[_0x8c18('0x57')][_0x8c18('0x58')]({'where':{'id':_0x82111b['body']['id']},'attributes':['id','name',_0x8c18('0x59'),_0x8c18('0x5a'),_0x8c18('0x5b')],'raw':!![]});}})[_0x8c18('0x1d')](function(_0x126e59){if(_0x126e59){var _0x2952d8=path[_0x8c18('0x44')](config[_0x8c18('0x45')],'server/files/sounds/converted',util[_0x8c18('0x5c')]('%s.%s',path['basename'](_0x126e59[_0x8c18('0x59')],path[_0x8c18('0x5d')](_0x126e59[_0x8c18('0x59')])),_0x126e59[_0x8c18('0x5a')]));var _0x24f61c=path[_0x8c18('0x44')](config[_0x8c18('0x45')],'server/files/moh',_0x28cc1e[_0x8c18('0x21')],util[_0x8c18('0x5c')](_0x8c18('0x5e'),_0x126e59[_0x8c18('0x21')],_0x126e59[_0x8c18('0x5a')]));fs[_0x8c18('0x5f')](_0x2952d8,_0x24f61c);return _0x126e59;}})[_0x8c18('0x3c')](function(_0x215caf){throw new db[(_0x8c18('0x60'))][(_0x8c18('0x53'))](_0x215caf[_0x8c18('0x54')]);});})['then'](handleEntityNotFound(_0x23b07e,null))[_0x8c18('0x1d')](respondWithResult(_0x23b07e,0xc9))[_0x8c18('0x3c')](handleError(_0x23b07e,null));};exports[_0x8c18('0x61')]=function(_0x5edae4,_0x12a25c,_0x49730a){return db[_0x8c18('0x56')][_0x8c18('0x42')](function(_0x28fd6c){var _0x273f30;return db['VoiceMusicOnHold'][_0x8c18('0x58')]({'where':{'id':_0x5edae4[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](handleEntityNotFound(_0x12a25c,null))[_0x8c18('0x1d')](function(_0x421770){if(_0x421770){_0x273f30=_0x421770;return _0x421770[_0x8c18('0x61')](_0x5edae4['params'][_0x8c18('0x62')]);}})[_0x8c18('0x1d')](function(_0x382cf3){if(_0x382cf3){return db[_0x8c18('0x57')][_0x8c18('0x58')]({'where':{'id':_0x5edae4[_0x8c18('0x3e')]['id2']},'attributes':['id',_0x8c18('0x21'),'save_name',_0x8c18('0x5a'),'createdAt'],'raw':!![]});}})[_0x8c18('0x1d')](function(_0x41d141){if(_0x41d141){fs['unlinkSync'](path[_0x8c18('0x44')](_0x273f30['directory'],util['format'](_0x8c18('0x5e'),_0x41d141[_0x8c18('0x21')],_0x41d141['converted_format'])));return _0x41d141;}})[_0x8c18('0x3c')](function(_0x5a72ff){throw new db['Sequelize'][(_0x8c18('0x53'))](_0x5a72ff[_0x8c18('0x54')]);});})[_0x8c18('0x1d')](handleEntityNotFound(_0x12a25c,null))['then'](respondWithStatusCode(_0x12a25c,0xcc))[_0x8c18('0x3c')](handleError(_0x12a25c,null));};exports['getSounds']=function(_0x52281a,_0x5e3ed2,_0x57b28f){var _0x10c432={};var _0x1aa18b={};var _0x2a79d8;var _0xe19393;return db[_0x8c18('0x23')][_0x8c18('0x58')]({'where':{'id':_0x52281a[_0x8c18('0x3e')]['id']}})[_0x8c18('0x1d')](handleEntityNotFound(_0x5e3ed2,null))[_0x8c18('0x1d')](function(_0x1acf58){if(_0x1acf58){_0x2a79d8=_0x1acf58;_0x1aa18b['model']=_[_0x8c18('0x29')](db[_0x8c18('0x57')][_0x8c18('0x24')]);_0x1aa18b['query']=_[_0x8c18('0x29')](_0x52281a[_0x8c18('0x28')]);_0x1aa18b['filters']=_[_0x8c18('0x2b')](_0x1aa18b[_0x8c18('0x2c')],_0x1aa18b[_0x8c18('0x28')]);_0x10c432[_0x8c18('0x2e')]=_['intersection'](_0x1aa18b['model'],qs[_0x8c18('0x2d')](_0x52281a['query'][_0x8c18('0x2d')]));_0x10c432[_0x8c18('0x2e')]=_0x10c432[_0x8c18('0x2e')][_0x8c18('0x63')]?_0x10c432[_0x8c18('0x2e')]:_0x1aa18b[_0x8c18('0x2c')];_0x10c432[_0x8c18('0x31')]=qs[_0x8c18('0x32')](_0x52281a['query']['sort']);_0x10c432[_0x8c18('0x33')]=qs[_0x8c18('0x2a')](_['pick'](_0x52281a[_0x8c18('0x28')],_0x1aa18b['filters']));if(_0x52281a['query']['filter']){_0x10c432['where']=_[_0x8c18('0x36')](_0x10c432[_0x8c18('0x33')],{'$or':_[_0x8c18('0x27')](_0x10c432[_0x8c18('0x2e')],function(_0x44561d){var _0x274ffa={};_0x274ffa[_0x44561d]={'$like':'%'+_0x52281a[_0x8c18('0x28')][_0x8c18('0x35')]+'%'};return _0x274ffa;})});}_0x10c432=_[_0x8c18('0x36')]({},_0x10c432,_0x52281a['options']);return _0x2a79d8['getSounds'](_0x10c432);}})[_0x8c18('0x1d')](function(_0x2a0912){if(_0x2a0912){_0xe19393=_0x2a0912['length'];if(!_0x52281a[_0x8c18('0x28')][_0x8c18('0x2f')](_0x8c18('0x30'))){_0x10c432['limit']=qs['limit'](_0x52281a[_0x8c18('0x28')][_0x8c18('0x18')]);_0x10c432['offset']=qs[_0x8c18('0x17')](_0x52281a[_0x8c18('0x28')][_0x8c18('0x17')]);}return _0x2a79d8['getSounds'](_0x10c432);}})[_0x8c18('0x1d')](function(_0x17eb1f){if(_0x17eb1f){return _0x17eb1f?{'count':_0xe19393,'rows':_0x17eb1f}:null;}})[_0x8c18('0x1d')](respondWithResult(_0x5e3ed2,null))[_0x8c18('0x3c')](handleError(_0x5e3ed2,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 84ccd4c..c6c8ee8 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 _0xb262=['VoiceMusicOnHold','voice_musiconhold','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x4e8971,_0x2055b1){var _0x269ff4=function(_0x269d47){while(--_0x269d47){_0x4e8971['push'](_0x4e8971['shift']());}};_0x269ff4(++_0x2055b1);}(_0xb262,0x70));var _0x2b26=function(_0x1054fb,_0x2ea752){_0x1054fb=_0x1054fb-0x0;var _0x36507b=_0xb262[_0x1054fb];return _0x36507b;};'use strict';var _=require(_0x2b26('0x0'));var util=require(_0x2b26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2b26('0x2'));var BPromise=require(_0x2b26('0x3'));var rp=require(_0x2b26('0x4'));var fs=require('fs');var path=require(_0x2b26('0x5'));var rimraf=require(_0x2b26('0x6'));var config=require(_0x2b26('0x7'));var attributes=require(_0x2b26('0x8'));module['exports']=function(_0x258307,_0x291195){return _0x258307['define'](_0x2b26('0x9'),attributes,{'tableName':_0x2b26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd0=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1c0930,_0x5495ad){var _0x7ce376=function(_0x2a26f0){while(--_0x2a26f0){_0x1c0930['push'](_0x1c0930['shift']());}};_0x7ce376(++_0x5495ad);}(_0xbdd0,0x1cc));var _0x0bdd=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0xbdd0[_0x2c0b5c];return _0x331c54;};'use strict';var _=require(_0x0bdd('0x0'));var util=require(_0x0bdd('0x1'));var logger=require(_0x0bdd('0x2'))(_0x0bdd('0x3'));var moment=require(_0x0bdd('0x4'));var BPromise=require(_0x0bdd('0x5'));var rp=require(_0x0bdd('0x6'));var fs=require('fs');var path=require(_0x0bdd('0x7'));var rimraf=require(_0x0bdd('0x8'));var config=require(_0x0bdd('0x9'));var attributes=require(_0x0bdd('0xa'));module['exports']=function(_0x1fc8b3,_0x34beb7){return _0x1fc8b3['define'](_0x0bdd('0xb'),attributes,{'tableName':_0x0bdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index b8627dc..1aef401 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 _0x92da=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4b5260,_0xcab6a2){var _0x16a58b=function(_0x168aba){while(--_0x168aba){_0x4b5260['push'](_0x4b5260['shift']());}};_0x16a58b(++_0xcab6a2);}(_0x92da,0x11c));var _0xa92d=function(_0x570e36,_0x33917c){_0x570e36=_0x570e36-0x0;var _0x56581a=_0x92da[_0x570e36];return _0x56581a;};'use strict';var _=require(_0xa92d('0x0'));var util=require(_0xa92d('0x1'));var moment=require(_0xa92d('0x2'));var BPromise=require(_0xa92d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa92d('0x4'))['db'];var utils=require(_0xa92d('0x5'));var logger=require(_0xa92d('0x6'))(_0xa92d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa92d('0x8'));var client=jayson[_0xa92d('0x9')][_0xa92d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2ff2,_0x284580,_0x3ff8d7){return new BPromise(function(_0x4db8d7,_0x5eacb3){return client[_0xa92d('0xb')](_0x1a2ff2,_0x3ff8d7)[_0xa92d('0xc')](function(_0x121724){logger[_0xa92d('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x284580,_0xa92d('0xe'));logger[_0xa92d('0xf')](_0xa92d('0x10'),_0x284580,_0xa92d('0xe'),JSON[_0xa92d('0x11')](_0x121724));if(_0x121724['error']){if(_0x121724[_0xa92d('0x12')][_0xa92d('0x13')]===0x1f4){logger[_0xa92d('0x12')](_0xa92d('0x14'),_0x284580,_0x121724[_0xa92d('0x12')][_0xa92d('0x15')]);return _0x5eacb3(_0x121724[_0xa92d('0x12')][_0xa92d('0x15')]);}logger['error'](_0xa92d('0x14'),_0x284580,_0x121724[_0xa92d('0x12')][_0xa92d('0x15')]);return _0x4db8d7(_0x121724[_0xa92d('0x12')]['message']);}else{logger[_0xa92d('0xd')](_0xa92d('0x14'),_0x284580,_0xa92d('0xe'));_0x4db8d7(_0x121724[_0xa92d('0x16')]['message']);}})[_0xa92d('0x17')](function(_0x1c354e){logger[_0xa92d('0x12')](_0xa92d('0x14'),_0x284580,_0x1c354e);_0x5eacb3(_0x1c354e);});});} \ No newline at end of file +var _0x2711=['rpc','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x727f82,_0x29531d){var _0x324e51=function(_0x2f90a5){while(--_0x2f90a5){_0x727f82['push'](_0x727f82['shift']());}};_0x324e51(++_0x29531d);}(_0x2711,0xa2));var _0x1271=function(_0x2c3758,_0x2a1cd7){_0x2c3758=_0x2c3758-0x0;var _0x4bf3b7=_0x2711[_0x2c3758];return _0x4bf3b7;};'use strict';var _=require(_0x1271('0x0'));var util=require('util');var moment=require(_0x1271('0x1'));var BPromise=require('bluebird');var rs=require(_0x1271('0x2'));var fs=require('fs');var Redis=require(_0x1271('0x3'));var db=require(_0x1271('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1271('0x5'))(_0x1271('0x6'));var config=require('../../config/environment');var jayson=require(_0x1271('0x7'));var client=jayson['client'][_0x1271('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d4334,_0x47027f,_0x3c0c6a){return new BPromise(function(_0x69b472,_0x4c55c5){return client[_0x1271('0x9')](_0x1d4334,_0x3c0c6a)[_0x1271('0xa')](function(_0x4ba2dc){logger[_0x1271('0xb')](_0x1271('0xc'),_0x47027f,'request\x20sent');logger[_0x1271('0xd')](_0x1271('0xe'),_0x47027f,'request\x20sent',JSON[_0x1271('0xf')](_0x4ba2dc));if(_0x4ba2dc[_0x1271('0x10')]){if(_0x4ba2dc['error'][_0x1271('0x11')]===0x1f4){logger[_0x1271('0x10')](_0x1271('0xc'),_0x47027f,_0x4ba2dc['error'][_0x1271('0x12')]);return _0x4c55c5(_0x4ba2dc['error'][_0x1271('0x12')]);}logger[_0x1271('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x47027f,_0x4ba2dc[_0x1271('0x10')][_0x1271('0x12')]);return _0x69b472(_0x4ba2dc['error'][_0x1271('0x12')]);}else{logger['info'](_0x1271('0xc'),_0x47027f,_0x1271('0x13'));_0x69b472(_0x4ba2dc['result'][_0x1271('0x12')]);}})[_0x1271('0x14')](function(_0x2584ec){logger[_0x1271('0x10')](_0x1271('0xc'),_0x47027f,_0x2584ec);_0x4c55c5(_0x2584ec);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index bda4b1a..fd6ab82 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 _0xc9c5=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','put','update','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc9c5,0xdf));var _0x5c9c=function(_0x42fc3e,_0xdc5885){_0x42fc3e=_0x42fc3e-0x0;var _0x52e1fa=_0xc9c5[_0x42fc3e];return _0x52e1fa;};'use strict';var multer=require(_0x5c9c('0x0'));var util=require(_0x5c9c('0x1'));var path=require(_0x5c9c('0x2'));var timeout=require(_0x5c9c('0x3'));var express=require(_0x5c9c('0x4'));var router=express[_0x5c9c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c9c('0x6'));var config=require(_0x5c9c('0x7'));var controller=require(_0x5c9c('0x8'));router[_0x5c9c('0x9')]('/',auth[_0x5c9c('0xa')](),controller['index']);router[_0x5c9c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5c9c('0xb')]);router['get'](_0x5c9c('0xc'),auth[_0x5c9c('0xa')](),controller[_0x5c9c('0xd')]);router['get'](_0x5c9c('0xe'),auth[_0x5c9c('0xa')](),controller[_0x5c9c('0xf')]);router[_0x5c9c('0x10')]('/',auth[_0x5c9c('0xa')](),controller[_0x5c9c('0x11')]);router[_0x5c9c('0x10')](_0x5c9c('0xe'),auth[_0x5c9c('0xa')](),controller['addAgents']);router[_0x5c9c('0x12')]('/:id',auth[_0x5c9c('0xa')](),controller[_0x5c9c('0x13')]);router['delete'](_0x5c9c('0xc'),auth['isAuthenticated'](),controller[_0x5c9c('0x14')]);router[_0x5c9c('0x15')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5c9c('0x16')]=router; \ No newline at end of file +var _0x4e35=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','show','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x101646,_0x9bd8d8){var _0x2df860=function(_0x2bfdb9){while(--_0x2bfdb9){_0x101646['push'](_0x101646['shift']());}};_0x2df860(++_0x9bd8d8);}(_0x4e35,0x1f3));var _0x54e3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4e35[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x54e3('0x0'));var util=require('util');var path=require(_0x54e3('0x1'));var timeout=require(_0x54e3('0x2'));var express=require(_0x54e3('0x3'));var router=express[_0x54e3('0x4')]();var auth=require(_0x54e3('0x5'));var interaction=require(_0x54e3('0x6'));var config=require(_0x54e3('0x7'));var controller=require(_0x54e3('0x8'));router[_0x54e3('0x9')]('/',auth[_0x54e3('0xa')](),controller['index']);router[_0x54e3('0x9')](_0x54e3('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x54e3('0xc'),auth[_0x54e3('0xa')](),controller[_0x54e3('0xd')]);router[_0x54e3('0x9')](_0x54e3('0xe'),auth[_0x54e3('0xa')](),controller[_0x54e3('0xf')]);router[_0x54e3('0x10')]('/',auth[_0x54e3('0xa')](),controller[_0x54e3('0x11')]);router[_0x54e3('0x10')]('/:id/users',auth[_0x54e3('0xa')](),controller[_0x54e3('0x12')]);router['put'](_0x54e3('0xc'),auth[_0x54e3('0xa')](),controller['update']);router[_0x54e3('0x13')]('/:id',auth[_0x54e3('0xa')](),controller[_0x54e3('0x14')]);router[_0x54e3('0x13')](_0x54e3('0xe'),auth[_0x54e3('0xa')](),controller[_0x54e3('0x15')]);module[_0x54e3('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 fdaf9df..6e07be5 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 _0xd450=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0xd450,0x157));var _0x0d45=function(_0x41fc60,_0x5e5ec6){_0x41fc60=_0x41fc60-0x0;var _0x164ee9=_0xd450[_0x41fc60];return _0x164ee9;};'use strict';var Sequelize=require(_0x0d45('0x0'));module[_0x0d45('0x1')]={'name':{'type':Sequelize[_0x0d45('0x2')],'allowNull':![],'unique':_0x0d45('0x3')},'prefix':{'type':Sequelize[_0x0d45('0x4')],'get':function(_0x3c3e73){return _0x0d45('0x5')+this[_0x0d45('0x6')](_0x0d45('0x3'))+'-';}},'description':{'type':Sequelize[_0x0d45('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0d45('0x7')]}}; \ No newline at end of file +var _0x4274=['name','VIRTUAL','system-','INTEGER','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4274,0x94));var _0x4427=function(_0x189061,_0x21d774){_0x189061=_0x189061-0x0;var _0x257e15=_0x4274[_0x189061];return _0x257e15;};'use strict';var Sequelize=require('sequelize');module[_0x4427('0x0')]={'name':{'type':Sequelize[_0x4427('0x1')],'allowNull':![],'unique':_0x4427('0x2')},'prefix':{'type':Sequelize[_0x4427('0x3')],'get':function(_0x503079){return _0x4427('0x4')+this['getDataValue'](_0x4427('0x2'))+'-';}},'description':{'type':Sequelize[_0x4427('0x1')]},'callerIdAll':{'type':Sequelize[_0x4427('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x4427('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1b8699f..aed86d0 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 _0x6363=['filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','body','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x1fe100,_0x3874e3){var _0x581d5d=function(_0x4c0950){while(--_0x4c0950){_0x1fe100['push'](_0x1fe100['shift']());}};_0x581d5d(++_0x3874e3);}(_0x6363,0x13a));var _0x3636=function(_0x3e1f2d,_0xa30add){_0x3e1f2d=_0x3e1f2d-0x0;var _0x113330=_0x6363[_0x3e1f2d];return _0x113330;};'use strict';var pdf=require(_0x3636('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3636('0x1'));var zipdir=require(_0x3636('0x2'));var jsonpatch=require(_0x3636('0x3'));var rp=require(_0x3636('0x4'));var moment=require(_0x3636('0x5'));var BPromise=require(_0x3636('0x6'));var Mustache=require(_0x3636('0x7'));var util=require(_0x3636('0x8'));var path=require(_0x3636('0x9'));var sox=require(_0x3636('0xa'));var csv=require(_0x3636('0xb'));var ejs=require(_0x3636('0xc'));var fs=require('fs');var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xb'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];config[_0x3636('0x1a')]=_[_0x3636('0x1b')](config[_0x3636('0x1a')],{'host':_0x3636('0x1c'),'port':0x18eb});var socket=require(_0x3636('0x1d'))(new Redis(config[_0x3636('0x1a')]));require(_0x3636('0x1e'))[_0x3636('0x1f')](socket);function respondWithStatusCode(_0x7b4b16,_0x102f90){_0x102f90=_0x102f90||0xcc;return function(_0xaacadb){if(_0xaacadb){return _0x7b4b16[_0x3636('0x20')](_0x102f90);}return _0x7b4b16[_0x3636('0x21')](_0x102f90)[_0x3636('0x22')]();};}function respondWithResult(_0x3cbd0d,_0x2dbd4d){_0x2dbd4d=_0x2dbd4d||0xc8;return function(_0x50474f){if(_0x50474f){return _0x3cbd0d[_0x3636('0x21')](_0x2dbd4d)[_0x3636('0x23')](_0x50474f);}};}function respondWithFilteredResult(_0x4aa7fc,_0xe3be56){return function(_0x5aa0ff){if(_0x5aa0ff){var _0x5e85f2=_0x5aa0ff[_0x3636('0x24')],_0xae6469=_0xe3be56[_0x3636('0x25')],_0x337e3d=_0xe3be56[_0x3636('0x25')]+_0xe3be56[_0x3636('0x26')],_0xdba761;if(_0x337e3d>=_0x5e85f2){_0x337e3d=_0x5e85f2;_0xdba761=0xc8;}else{_0xdba761=0xce;}_0x4aa7fc[_0x3636('0x21')](_0xdba761);return _0x4aa7fc['set']('Content-Range',_0xae6469+'-'+_0x337e3d+'/'+_0x5e85f2)[_0x3636('0x23')](_0x5aa0ff);}return null;};}function patchUpdates(_0x34a975){return function(_0x42b271){try{jsonpatch['apply'](_0x42b271,_0x34a975,!![]);}catch(_0x1734cd){return BPromise[_0x3636('0x27')](_0x1734cd);}return _0x42b271[_0x3636('0x28')]();};}function saveUpdates(_0xe34cd9,_0x325dce){return function(_0x49f43b){if(_0x49f43b){return _0x49f43b['update'](_0xe34cd9)['then'](function(_0x368356){return _0x368356;});}return null;};}function removeEntity(_0x4ee098,_0x50ba2f){return function(_0x8b3182){if(_0x8b3182){return _0x8b3182['destroy']()[_0x3636('0x29')](function(){var _0x4c24cf=_0x8b3182[_0x3636('0x2a')]({'plain':!![]});var _0x477c34=_0x3636('0x2b');return db[_0x3636('0x2c')][_0x3636('0x2d')]({'where':{'type':_0x477c34,'resourceId':_0x4c24cf['id']}})[_0x3636('0x29')](function(){return _0x8b3182;});})[_0x3636('0x29')](function(){_0x4ee098[_0x3636('0x21')](0xcc)[_0x3636('0x22')]();});}};}function handleEntityNotFound(_0x701651,_0x22574e){return function(_0x550443){if(!_0x550443){_0x701651[_0x3636('0x20')](0x194);}return _0x550443;};}function handleError(_0x236f54,_0x2d644c){_0x2d644c=_0x2d644c||0x1f4;return function(_0x22b12f){logger[_0x3636('0x2e')](_0x22b12f[_0x3636('0x2f')]);if(_0x22b12f['name']){delete _0x22b12f[_0x3636('0x30')];}_0x236f54[_0x3636('0x21')](_0x2d644c)['send'](_0x22b12f);};}exports[_0x3636('0x31')]=function(_0x26b6de,_0x306774){var _0x474ad3={},_0x3febfd={},_0x57613e={'count':0x0,'rows':[]};var _0x37983b=_[_0x3636('0x32')](db[_0x3636('0x33')][_0x3636('0x34')],function(_0x184fa8){return{'name':_0x184fa8[_0x3636('0x35')],'type':_0x184fa8[_0x3636('0x36')][_0x3636('0x37')]};});_0x3febfd[_0x3636('0x38')]=_['map'](_0x37983b,'name');_0x3febfd[_0x3636('0x39')]=_['keys'](_0x26b6de['query']);_0x3febfd[_0x3636('0x3a')]=_[_0x3636('0x3b')](_0x3febfd[_0x3636('0x38')],_0x3febfd['query']);_0x474ad3[_0x3636('0x3c')]=_[_0x3636('0x3b')](_0x3febfd[_0x3636('0x38')],qs[_0x3636('0x3d')](_0x26b6de[_0x3636('0x39')][_0x3636('0x3d')]));_0x474ad3[_0x3636('0x3c')]=_0x474ad3[_0x3636('0x3c')][_0x3636('0x3e')]?_0x474ad3[_0x3636('0x3c')]:_0x3febfd[_0x3636('0x38')];if(!_0x26b6de[_0x3636('0x39')][_0x3636('0x3f')]('nolimit')){_0x474ad3[_0x3636('0x26')]=qs[_0x3636('0x26')](_0x26b6de[_0x3636('0x39')][_0x3636('0x26')]);_0x474ad3['offset']=qs['offset'](_0x26b6de[_0x3636('0x39')][_0x3636('0x25')]);}_0x474ad3[_0x3636('0x40')]=qs['sort'](_0x26b6de[_0x3636('0x39')][_0x3636('0x41')]);_0x474ad3['where']=qs['filters'](_[_0x3636('0x42')](_0x26b6de['query'],_0x3febfd[_0x3636('0x3a')]),_0x37983b);if(_0x26b6de[_0x3636('0x39')][_0x3636('0x43')]){_0x474ad3[_0x3636('0x44')]=_[_0x3636('0x45')](_0x474ad3[_0x3636('0x44')],{'$or':_[_0x3636('0x32')](_0x37983b,function(_0x37f89a){if(_0x37f89a[_0x3636('0x36')]!=='VIRTUAL'){var _0x30cf4e={};_0x30cf4e[_0x37f89a[_0x3636('0x30')]]={'$like':'%'+_0x26b6de[_0x3636('0x39')][_0x3636('0x43')]+'%'};return _0x30cf4e;}})});}_0x474ad3=_[_0x3636('0x45')]({},_0x474ad3,_0x26b6de[_0x3636('0x46')]);var _0x28d6fb={'where':_0x474ad3[_0x3636('0x44')]};return db[_0x3636('0x33')]['count'](_0x28d6fb)[_0x3636('0x29')](function(_0x2d2d88){_0x57613e[_0x3636('0x24')]=_0x2d2d88;if(_0x26b6de[_0x3636('0x39')][_0x3636('0x47')]){_0x474ad3[_0x3636('0x48')]=[{'all':!![]}];}return db[_0x3636('0x33')][_0x3636('0x49')](_0x474ad3);})[_0x3636('0x29')](function(_0x24f5bc){_0x57613e[_0x3636('0x4a')]=_0x24f5bc;return _0x57613e;})[_0x3636('0x29')](respondWithFilteredResult(_0x306774,_0x474ad3))[_0x3636('0x4b')](handleError(_0x306774,null));};exports[_0x3636('0x4c')]=function(_0x1786b9,_0x534a73){var _0x329499={'raw':![],'where':{'id':_0x1786b9[_0x3636('0x4d')]['id']}},_0x17c784={};_0x17c784[_0x3636('0x38')]=_[_0x3636('0x4e')](db[_0x3636('0x33')][_0x3636('0x34')]);_0x17c784[_0x3636('0x39')]=_[_0x3636('0x4e')](_0x1786b9[_0x3636('0x39')]);_0x17c784[_0x3636('0x3a')]=_[_0x3636('0x3b')](_0x17c784[_0x3636('0x38')],_0x17c784['query']);_0x329499['attributes']=_['intersection'](_0x17c784[_0x3636('0x38')],qs['fields'](_0x1786b9['query'][_0x3636('0x3d')]));_0x329499[_0x3636('0x3c')]=_0x329499[_0x3636('0x3c')]['length']?_0x329499[_0x3636('0x3c')]:_0x17c784[_0x3636('0x38')];if(_0x1786b9[_0x3636('0x39')][_0x3636('0x47')]){_0x329499[_0x3636('0x48')]=[{'all':!![]}];}_0x329499=_[_0x3636('0x45')]({},_0x329499,_0x1786b9[_0x3636('0x46')]);return db[_0x3636('0x33')][_0x3636('0x4f')](_0x329499)['then'](handleEntityNotFound(_0x534a73,null))[_0x3636('0x29')](respondWithResult(_0x534a73,null))[_0x3636('0x4b')](handleError(_0x534a73,null));};exports[_0x3636('0x2d')]=function(_0x372ee8,_0x12be53){return db[_0x3636('0x33')]['find']({'where':{'id':_0x372ee8[_0x3636('0x4d')]['id']}})[_0x3636('0x29')](handleEntityNotFound(_0x12be53,null))[_0x3636('0x29')](removeEntity(_0x12be53,null))[_0x3636('0x4b')](handleError(_0x12be53,null));};exports[_0x3636('0x50')]=function(_0x4b7431,_0x2146c5){return db[_0x3636('0x33')][_0x3636('0x50')]()[_0x3636('0x29')](respondWithResult(_0x2146c5,null))[_0x3636('0x4b')](handleError(_0x2146c5,null));};exports['create']=function(_0x3b7bf7,_0x4db5ba){var _0x54deca;return db[_0x3636('0x51')][_0x3636('0x52')](function(_0x2575ba){return db[_0x3636('0x33')]['create'](_0x3b7bf7['body'],{'transaction':_0x2575ba})[_0x3636('0x29')](function(_0x1e1ad5){_0x54deca=_0x1e1ad5[_0x3636('0x2a')]({'plain':!![]});return db[_0x3636('0x53')][_0x3636('0x4f')]({'where':{'id':_0x54deca[_0x3636('0x54')]},'raw':!![]})['then'](function(_0x3dd6e8){return createVoicePrefixExtensions(_0x54deca,_0x3dd6e8,_0x2575ba);});});})[_0x3636('0x29')](function(){var _0x25637c=_0x3b7bf7[_0x3636('0x55')][_0x3636('0x2a')]({'plain':!![]});if(!_0x25637c)throw new Error(_0x3636('0x56'));if(_0x25637c[_0x3636('0x57')]===_0x3636('0x55')){var _0x4ffa31=_0x54deca;return db[_0x3636('0x58')]['find']({'where':{'name':_0x3636('0x2b'),'userProfileId':_0x25637c['userProfileId']},'raw':!![]})[_0x3636('0x29')](function(_0x3db86a){if(_0x3db86a&&_0x3db86a[_0x3636('0x59')]===0x0){return db[_0x3636('0x2c')][_0x3636('0x5a')]({'name':_0x4ffa31[_0x3636('0x30')],'resourceId':_0x4ffa31['id'],'type':_0x3db86a['name'],'sectionId':_0x3db86a['id']},{})[_0x3636('0x29')](function(){return _0x54deca;});}else{return _0x54deca;}})['catch'](function(_0x10db7e){logger[_0x3636('0x2e')](_0x3636('0x5b'),_0x10db7e);throw _0x10db7e;});}return _0x54deca;})[_0x3636('0x29')](respondWithResult(_0x4db5ba,null))['catch'](handleError(_0x4db5ba,null));};function Extension(_0x215fe5,_0x11028c,_0x3975eb,_0x225f63){this[_0x3636('0x5c')]=_0x3636('0x5d');this[_0x3636('0x5e')]=_0x215fe5;this[_0x3636('0x5f')]=_0x3975eb;this[_0x3636('0x36')]='system';this[_0x3636('0x60')]=_0x3636('0x61');this[_0x3636('0x62')]=_0x11028c;this[_0x3636('0x63')]=_0x225f63;}function createVoicePrefixExtensions(_0x453e38,_0xbeddf8,_0x491af3){return new BPromise(function(_0x3496ff,_0x163830){var _0x329117=new Extension(formatPrefixName(_0x453e38[_0x3636('0x64')]),0x1,_0x3636('0x65'),_0x3636('0x66'));_0x329117[_0x3636('0x67')]=_0x453e38['id'];return db[_0x3636('0x53')][_0x3636('0x5a')](_0x329117,{'transaction':_0x491af3})[_0x3636('0x29')](function(_0x111818){var _0x2c10a4=_0x111818[_0x3636('0x2a')]({'plain':!![]});var _0x57550f=_['map'](addVoicePrefixExtensions(_0x453e38,_0xbeddf8),function(_0xbc16a0){_0xbc16a0[_0x3636('0x54')]=_0x2c10a4['id'];_0xbc16a0[_0x3636('0x67')]=_0x453e38['id'];return _0xbc16a0;});return db[_0x3636('0x53')][_0x3636('0x68')](_0x57550f,{'transaction':_0x491af3})[_0x3636('0x29')](function(_0x2d43c9){if(!_0x2d43c9){return _0x163830(_0x3636('0x69'));}else{return _0x3496ff(_0x2d43c9);}})['catch'](function(_0x1df426){return _0x163830(_0x1df426);});});;});};function addVoicePrefixExtensions(_0x48f4ee,_0x2a461b){var _0x2115e4=[];var _0x228716=formatPrefixName(_0x48f4ee['prefix']);_0x2115e4[_0x3636('0x6a')](new Extension(_0x228716,0x2,'Set',_0x3636('0x6b')+_0x48f4ee[_0x3636('0x30')]));if(_0x48f4ee[_0x3636('0x6c')]){_0x2115e4[_0x3636('0x6a')](new Extension(_0x228716,0x3,_0x3636('0x6d'),_0x3636('0x6e')+_0x48f4ee[_0x3636('0x6c')]));}else{_0x2115e4[_0x3636('0x6a')](new Extension(_0x228716,0x3,_0x3636('0x65'),_0x3636('0x6f')));}_0x2115e4['push'](new Extension(_0x228716,0x4,'goto',_0x2a461b['context']+','+_0x3636('0x70')+(0x8+_0x48f4ee['name'][_0x3636('0x3e')])+'}'+','+0x1));return _0x2115e4;}function formatPrefixName(_0x2f07b1){var _0x4216c9='_';for(var _0x50b5a7=0x0;_0x50b5a7<_0x2f07b1[_0x3636('0x3e')];_0x50b5a7++){if(_0x2f07b1[_0x3636('0x71')](_0x50b5a7)=='-'){_0x4216c9+=_0x2f07b1[_0x3636('0x71')](_0x50b5a7);}else{_0x4216c9+='['+_0x2f07b1[_0x3636('0x71')](_0x50b5a7)+']';}}_0x4216c9+='.';return _0x4216c9;}exports['update']=function(_0x43b7b2,_0x54f66e,_0x17e31b){var _0x4fb8d2=_0x43b7b2['body'];_0x4fb8d2[_0x3636('0x64')]=_0x3636('0x72')+_0x4fb8d2[_0x3636('0x30')]+'-';return db[_0x3636('0x51')][_0x3636('0x52')](function(_0x44c747){return db['VoicePrefix']['update'](_0x4fb8d2,{'where':{'id':_0x4fb8d2['id']},'transaction':_0x44c747})[_0x3636('0x29')](function(){return db['VoiceExtension'][_0x3636('0x2d')]({'where':{'VoicePrefixId':_0x4fb8d2['id']},'transaction':_0x44c747})[_0x3636('0x29')](function(){return db[_0x3636('0x53')][_0x3636('0x4f')]({'where':{'id':_0x4fb8d2[_0x3636('0x54')]},'raw':!![]})[_0x3636('0x29')](function(_0x26c1cf){return createVoicePrefixExtensions(_0x4fb8d2,_0x26c1cf,_0x44c747);});});});})[_0x3636('0x29')](function(){return db['VoicePrefix'][_0x3636('0x73')](_0x4fb8d2['id']);})['then'](respondWithResult(_0x54f66e,null))['catch'](handleError(_0x54f66e,null));};exports[_0x3636('0x74')]=function(_0x3bd459,_0x3b6087,_0x1884b4){return db['VoicePrefix'][_0x3636('0x4f')]({'where':{'id':_0x3bd459['params']['id']}})['then'](handleEntityNotFound(_0x3b6087,null))[_0x3636('0x29')](function(_0x2a2040){if(_0x2a2040){return _0x2a2040[_0x3636('0x74')](_0x3bd459[_0x3636('0x75')][_0x3636('0x76')],_['omit'](_0x3bd459[_0x3636('0x75')],[_0x3636('0x76'),'id'])||{})[_0x3636('0x77')](function(_0x147f34){for(var _0x261f00=0x0;_0x261f00<_0x3bd459[_0x3636('0x75')][_0x3636('0x76')][_0x3636('0x3e')];_0x261f00+=0x1){socket[_0x3636('0x78')](_0x3636('0x79'),{'UserId':_0x3bd459[_0x3636('0x75')][_0x3636('0x76')][_0x261f00],'VoicePrefixId':_0x3bd459['params']['id']});}return _0x147f34;});}})['then'](respondWithResult(_0x3b6087,null))['catch'](handleError(_0x3b6087,null));};exports[_0x3636('0x7a')]=function(_0x3501a8,_0x45c0cc,_0x55b616){return db[_0x3636('0x33')]['find']({'where':{'id':_0x3501a8[_0x3636('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45c0cc,null))[_0x3636('0x29')](function(_0x5a00fd){if(_0x5a00fd){return _0x5a00fd[_0x3636('0x7a')](_0x3501a8[_0x3636('0x39')]['ids'])[_0x3636('0x29')](function(){if(_['isArray'](_0x3501a8['query'][_0x3636('0x76')])){for(var _0x38f6ac=0x0;_0x38f6ac<_0x3501a8[_0x3636('0x39')][_0x3636('0x76')][_0x3636('0x3e')];_0x38f6ac+=0x1){socket[_0x3636('0x78')](_0x3636('0x7b'),{'UserId':Number(_0x3501a8[_0x3636('0x39')][_0x3636('0x76')][_0x38f6ac]),'VoicePrefixId':Number(_0x3501a8[_0x3636('0x4d')]['id'])});}}else{socket['emit'](_0x3636('0x7b'),{'UserId':Number(_0x3501a8[_0x3636('0x39')][_0x3636('0x76')]),'VoicePrefixId':Number(_0x3501a8['params']['id'])});}});}})[_0x3636('0x29')](respondWithStatusCode(_0x45c0cc,null))[_0x3636('0x4b')](handleError(_0x45c0cc,null));};exports[_0x3636('0x7c')]=function(_0x515bf1,_0x154ab2,_0x2d778f){var _0x573dba={};var _0x5a0ec5={};var _0x467644;var _0x2cf46c;return db['VoicePrefix'][_0x3636('0x7d')]({'where':{'id':_0x515bf1[_0x3636('0x4d')]['id']}})['then'](handleEntityNotFound(_0x154ab2,null))['then'](function(_0xedaab6){if(_0xedaab6){_0x467644=_0xedaab6;_0x5a0ec5[_0x3636('0x38')]=_['keys'](db[_0x3636('0x7e')][_0x3636('0x34')]);_0x5a0ec5['query']=_[_0x3636('0x4e')](_0x515bf1[_0x3636('0x39')]);_0x5a0ec5[_0x3636('0x3a')]=_[_0x3636('0x3b')](_0x5a0ec5[_0x3636('0x38')],_0x5a0ec5[_0x3636('0x39')]);_0x573dba[_0x3636('0x3c')]=_[_0x3636('0x3b')](_0x5a0ec5[_0x3636('0x38')],qs[_0x3636('0x3d')](_0x515bf1[_0x3636('0x39')][_0x3636('0x3d')]));_0x573dba[_0x3636('0x3c')]=_0x573dba[_0x3636('0x3c')]['length']?_0x573dba[_0x3636('0x3c')]:_0x5a0ec5[_0x3636('0x38')];_0x573dba[_0x3636('0x40')]=qs[_0x3636('0x41')](_0x515bf1['query'][_0x3636('0x41')]);_0x573dba[_0x3636('0x44')]=qs[_0x3636('0x3a')](_['pick'](_0x515bf1[_0x3636('0x39')],_0x5a0ec5[_0x3636('0x3a')]));if(_0x515bf1['query'][_0x3636('0x43')]){_0x573dba[_0x3636('0x44')]=_[_0x3636('0x45')](_0x573dba['where'],{'$or':_[_0x3636('0x32')](_0x573dba[_0x3636('0x3c')],function(_0x2dcbf0){var _0x1a47d1={};_0x1a47d1[_0x2dcbf0]={'$like':'%'+_0x515bf1[_0x3636('0x39')][_0x3636('0x43')]+'%'};return _0x1a47d1;})});}_0x573dba=_[_0x3636('0x45')]({},_0x573dba,_0x515bf1[_0x3636('0x46')]);return _0x467644[_0x3636('0x7c')](_0x573dba);}})[_0x3636('0x29')](function(_0x55ba76){if(_0x55ba76){_0x2cf46c=_0x55ba76['length'];if(!_0x515bf1[_0x3636('0x39')][_0x3636('0x3f')]('nolimit')){_0x573dba[_0x3636('0x26')]=qs[_0x3636('0x26')](_0x515bf1[_0x3636('0x39')][_0x3636('0x26')]);_0x573dba['offset']=qs[_0x3636('0x25')](_0x515bf1[_0x3636('0x39')][_0x3636('0x25')]);}return _0x467644[_0x3636('0x7c')](_0x573dba);}})['then'](function(_0x450d6b){if(_0x450d6b){return _0x450d6b?{'count':_0x2cf46c,'rows':_0x450d6b}:null;}})['then'](respondWithResult(_0x154ab2,null))['catch'](handleError(_0x154ab2,null));}; \ No newline at end of file +var _0x0c42=['NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','sequelize','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','filter','options','VoicePrefix','includeAll','include','rows','catch','show','params','merge','find','describe','create','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0c42,0x191));var _0x20c4=function(_0x3b3dca,_0x311836){_0x3b3dca=_0x3b3dca-0x0;var _0x47bf7f=_0x0c42[_0x3b3dca];return _0x47bf7f;};'use strict';var pdf=require(_0x20c4('0x0'));var emlformat=require(_0x20c4('0x1'));var rimraf=require(_0x20c4('0x2'));var zipdir=require(_0x20c4('0x3'));var jsonpatch=require(_0x20c4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x20c4('0x5'));var Mustache=require(_0x20c4('0x6'));var util=require(_0x20c4('0x7'));var path=require(_0x20c4('0x8'));var sox=require(_0x20c4('0x9'));var csv=require('to-csv');var ejs=require(_0x20c4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x20c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x20c4('0xc'));var deskjs=require(_0x20c4('0xd'));var toCsv=require(_0x20c4('0xe'));var querystring=require('querystring');var Papa=require(_0x20c4('0xf'));var Redis=require(_0x20c4('0x10'));var authService=require(_0x20c4('0x11'));var qs=require(_0x20c4('0x12'));var as=require(_0x20c4('0x13'));var hardwareService=require(_0x20c4('0x14'));var logger=require(_0x20c4('0x15'))(_0x20c4('0x16'));var utils=require(_0x20c4('0x17'));var config=require(_0x20c4('0x18'));var licenseUtil=require(_0x20c4('0x19'));var db=require(_0x20c4('0x1a'))['db'];config[_0x20c4('0x1b')]=_['defaults'](config[_0x20c4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x20c4('0x1c'))(new Redis(config[_0x20c4('0x1b')]));require('./voicePrefix.socket')[_0x20c4('0x1d')](socket);function respondWithStatusCode(_0x4c6dae,_0x13213d){_0x13213d=_0x13213d||0xcc;return function(_0x3b1399){if(_0x3b1399){return _0x4c6dae[_0x20c4('0x1e')](_0x13213d);}return _0x4c6dae['status'](_0x13213d)[_0x20c4('0x1f')]();};}function respondWithResult(_0x25b671,_0x3c989a){_0x3c989a=_0x3c989a||0xc8;return function(_0x3e7c5b){if(_0x3e7c5b){return _0x25b671[_0x20c4('0x20')](_0x3c989a)[_0x20c4('0x21')](_0x3e7c5b);}};}function respondWithFilteredResult(_0x2f79a0,_0x3fd9b7){return function(_0x3f9b92){if(_0x3f9b92){var _0x301ff1=_0x3f9b92[_0x20c4('0x22')],_0xda61dc=_0x3fd9b7['offset'],_0x542cb2=_0x3fd9b7[_0x20c4('0x23')]+_0x3fd9b7[_0x20c4('0x24')],_0x513dc7;if(_0x542cb2>=_0x301ff1){_0x542cb2=_0x301ff1;_0x513dc7=0xc8;}else{_0x513dc7=0xce;}_0x2f79a0[_0x20c4('0x20')](_0x513dc7);return _0x2f79a0[_0x20c4('0x25')](_0x20c4('0x26'),_0xda61dc+'-'+_0x542cb2+'/'+_0x301ff1)[_0x20c4('0x21')](_0x3f9b92);}return null;};}function patchUpdates(_0xac3dda){return function(_0x3fa1a5){try{jsonpatch[_0x20c4('0x27')](_0x3fa1a5,_0xac3dda,!![]);}catch(_0x1a2d2c){return BPromise[_0x20c4('0x28')](_0x1a2d2c);}return _0x3fa1a5[_0x20c4('0x29')]();};}function saveUpdates(_0xbe436d,_0x2d1eda){return function(_0x498d4){if(_0x498d4){return _0x498d4[_0x20c4('0x2a')](_0xbe436d)[_0x20c4('0x2b')](function(_0x287753){return _0x287753;});}return null;};}function removeEntity(_0x20e812,_0x3e4b27){return function(_0x11cc05){if(_0x11cc05){return _0x11cc05[_0x20c4('0x2c')]()[_0x20c4('0x2b')](function(){var _0x7c7d69=_0x11cc05['get']({'plain':!![]});var _0x5efa2b=_0x20c4('0x2d');return db[_0x20c4('0x2e')]['destroy']({'where':{'type':_0x5efa2b,'resourceId':_0x7c7d69['id']}})[_0x20c4('0x2b')](function(){return _0x11cc05;});})[_0x20c4('0x2b')](function(){_0x20e812['status'](0xcc)[_0x20c4('0x1f')]();});}};}function handleEntityNotFound(_0x12e4f5,_0x58af11){return function(_0x5592dd){if(!_0x5592dd){_0x12e4f5['sendStatus'](0x194);}return _0x5592dd;};}function handleError(_0x19907c,_0x5bbb21){_0x5bbb21=_0x5bbb21||0x1f4;return function(_0x341b66){logger[_0x20c4('0x2f')](_0x341b66[_0x20c4('0x30')]);if(_0x341b66[_0x20c4('0x31')]){delete _0x341b66[_0x20c4('0x31')];}_0x19907c[_0x20c4('0x20')](_0x5bbb21)['send'](_0x341b66);};}exports['index']=function(_0x2045ac,_0x1673ff){var _0x2b6f72={},_0x2f4a51={},_0x18b5a1={'count':0x0,'rows':[]};var _0x523412=_[_0x20c4('0x32')](db['VoicePrefix'][_0x20c4('0x33')],function(_0x5649c4){return{'name':_0x5649c4['fieldName'],'type':_0x5649c4['type']['key']};});_0x2f4a51[_0x20c4('0x34')]=_['map'](_0x523412,_0x20c4('0x31'));_0x2f4a51[_0x20c4('0x35')]=_[_0x20c4('0x36')](_0x2045ac['query']);_0x2f4a51[_0x20c4('0x37')]=_[_0x20c4('0x38')](_0x2f4a51[_0x20c4('0x34')],_0x2f4a51[_0x20c4('0x35')]);_0x2b6f72[_0x20c4('0x39')]=_['intersection'](_0x2f4a51['model'],qs['fields'](_0x2045ac['query'][_0x20c4('0x3a')]));_0x2b6f72[_0x20c4('0x39')]=_0x2b6f72[_0x20c4('0x39')][_0x20c4('0x3b')]?_0x2b6f72[_0x20c4('0x39')]:_0x2f4a51['model'];if(!_0x2045ac[_0x20c4('0x35')]['hasOwnProperty']('nolimit')){_0x2b6f72['limit']=qs[_0x20c4('0x24')](_0x2045ac[_0x20c4('0x35')][_0x20c4('0x24')]);_0x2b6f72[_0x20c4('0x23')]=qs[_0x20c4('0x23')](_0x2045ac['query'][_0x20c4('0x23')]);}_0x2b6f72[_0x20c4('0x3c')]=qs[_0x20c4('0x3d')](_0x2045ac[_0x20c4('0x35')][_0x20c4('0x3d')]);_0x2b6f72[_0x20c4('0x3e')]=qs[_0x20c4('0x37')](_[_0x20c4('0x3f')](_0x2045ac[_0x20c4('0x35')],_0x2f4a51[_0x20c4('0x37')]),_0x523412);if(_0x2045ac[_0x20c4('0x35')]['filter']){_0x2b6f72[_0x20c4('0x3e')]=_['merge'](_0x2b6f72[_0x20c4('0x3e')],{'$or':_[_0x20c4('0x32')](_0x523412,function(_0x32fdba){if(_0x32fdba[_0x20c4('0x40')]!==_0x20c4('0x41')){var _0x9d7cd5={};_0x9d7cd5[_0x32fdba[_0x20c4('0x31')]]={'$like':'%'+_0x2045ac[_0x20c4('0x35')][_0x20c4('0x42')]+'%'};return _0x9d7cd5;}})});}_0x2b6f72=_['merge']({},_0x2b6f72,_0x2045ac[_0x20c4('0x43')]);var _0x268683={'where':_0x2b6f72['where']};return db[_0x20c4('0x44')]['count'](_0x268683)[_0x20c4('0x2b')](function(_0x5c45ac){_0x18b5a1[_0x20c4('0x22')]=_0x5c45ac;if(_0x2045ac['query'][_0x20c4('0x45')]){_0x2b6f72[_0x20c4('0x46')]=[{'all':!![]}];}return db[_0x20c4('0x44')]['findAll'](_0x2b6f72);})['then'](function(_0x4c32b1){_0x18b5a1[_0x20c4('0x47')]=_0x4c32b1;return _0x18b5a1;})[_0x20c4('0x2b')](respondWithFilteredResult(_0x1673ff,_0x2b6f72))[_0x20c4('0x48')](handleError(_0x1673ff,null));};exports[_0x20c4('0x49')]=function(_0x252e9f,_0xdb39bc){var _0x332beb={'raw':![],'where':{'id':_0x252e9f[_0x20c4('0x4a')]['id']}},_0x40928b={};_0x40928b[_0x20c4('0x34')]=_[_0x20c4('0x36')](db[_0x20c4('0x44')][_0x20c4('0x33')]);_0x40928b['query']=_[_0x20c4('0x36')](_0x252e9f[_0x20c4('0x35')]);_0x40928b['filters']=_[_0x20c4('0x38')](_0x40928b[_0x20c4('0x34')],_0x40928b[_0x20c4('0x35')]);_0x332beb[_0x20c4('0x39')]=_[_0x20c4('0x38')](_0x40928b[_0x20c4('0x34')],qs['fields'](_0x252e9f[_0x20c4('0x35')][_0x20c4('0x3a')]));_0x332beb[_0x20c4('0x39')]=_0x332beb[_0x20c4('0x39')][_0x20c4('0x3b')]?_0x332beb[_0x20c4('0x39')]:_0x40928b[_0x20c4('0x34')];if(_0x252e9f[_0x20c4('0x35')][_0x20c4('0x45')]){_0x332beb['include']=[{'all':!![]}];}_0x332beb=_[_0x20c4('0x4b')]({},_0x332beb,_0x252e9f[_0x20c4('0x43')]);return db[_0x20c4('0x44')][_0x20c4('0x4c')](_0x332beb)[_0x20c4('0x2b')](handleEntityNotFound(_0xdb39bc,null))['then'](respondWithResult(_0xdb39bc,null))[_0x20c4('0x48')](handleError(_0xdb39bc,null));};exports['destroy']=function(_0x8c4b05,_0x472877){return db[_0x20c4('0x44')]['find']({'where':{'id':_0x8c4b05[_0x20c4('0x4a')]['id']}})[_0x20c4('0x2b')](handleEntityNotFound(_0x472877,null))[_0x20c4('0x2b')](removeEntity(_0x472877,null))[_0x20c4('0x48')](handleError(_0x472877,null));};exports[_0x20c4('0x4d')]=function(_0x1176d1,_0x5a5cea){return db[_0x20c4('0x44')][_0x20c4('0x4d')]()[_0x20c4('0x2b')](respondWithResult(_0x5a5cea,null))['catch'](handleError(_0x5a5cea,null));};exports[_0x20c4('0x4e')]=function(_0x14ee27,_0x34aa44){var _0x32c21f;return db['sequelize']['transaction'](function(_0x335fa8){return db[_0x20c4('0x44')][_0x20c4('0x4e')](_0x14ee27[_0x20c4('0x4f')],{'transaction':_0x335fa8})['then'](function(_0x316780){_0x32c21f=_0x316780[_0x20c4('0x50')]({'plain':!![]});return db[_0x20c4('0x51')][_0x20c4('0x4c')]({'where':{'id':_0x32c21f[_0x20c4('0x52')]},'raw':!![]})[_0x20c4('0x2b')](function(_0x393abf){return createVoicePrefixExtensions(_0x32c21f,_0x393abf,_0x335fa8);});});})['then'](function(){var _0x4ef3cc=_0x14ee27[_0x20c4('0x53')][_0x20c4('0x50')]({'plain':!![]});if(!_0x4ef3cc)throw new Error(_0x20c4('0x54'));if(_0x4ef3cc['role']===_0x20c4('0x53')){var _0x3553fd=_0x32c21f;return db['UserProfileSection'][_0x20c4('0x4c')]({'where':{'name':_0x20c4('0x2d'),'userProfileId':_0x4ef3cc['userProfileId']},'raw':!![]})[_0x20c4('0x2b')](function(_0x3a1174){if(_0x3a1174&&_0x3a1174[_0x20c4('0x55')]===0x0){return db[_0x20c4('0x2e')]['create']({'name':_0x3553fd[_0x20c4('0x31')],'resourceId':_0x3553fd['id'],'type':_0x3a1174[_0x20c4('0x31')],'sectionId':_0x3a1174['id']},{})[_0x20c4('0x2b')](function(){return _0x32c21f;});}else{return _0x32c21f;}})[_0x20c4('0x48')](function(_0x593a86){logger[_0x20c4('0x2f')](_0x20c4('0x56'),_0x593a86);throw _0x593a86;});}return _0x32c21f;})[_0x20c4('0x2b')](respondWithResult(_0x34aa44,null))['catch'](handleError(_0x34aa44,null));};function Extension(_0x3e3069,_0xa733eb,_0x4742f6,_0x5aef23){this[_0x20c4('0x57')]='from-sip';this[_0x20c4('0x58')]=_0x3e3069;this[_0x20c4('0x59')]=_0x4742f6;this[_0x20c4('0x40')]=_0x20c4('0x5a');this[_0x20c4('0x5b')]=_0x20c4('0x5c');this[_0x20c4('0x5d')]=_0xa733eb;this['appdata']=_0x5aef23;}function createVoicePrefixExtensions(_0xc8d8a,_0x51d204,_0x4ea16d){return new BPromise(function(_0x1f544f,_0x5b56ff){var _0xbe326c=new Extension(formatPrefixName(_0xc8d8a[_0x20c4('0x5e')]),0x1,_0x20c4('0x5f'),_0x20c4('0x60'));_0xbe326c[_0x20c4('0x61')]=_0xc8d8a['id'];return db[_0x20c4('0x51')][_0x20c4('0x4e')](_0xbe326c,{'transaction':_0x4ea16d})[_0x20c4('0x2b')](function(_0x7160ef){var _0x566251=_0x7160ef[_0x20c4('0x50')]({'plain':!![]});var _0x476448=_[_0x20c4('0x32')](addVoicePrefixExtensions(_0xc8d8a,_0x51d204),function(_0x6d14f3){_0x6d14f3[_0x20c4('0x52')]=_0x566251['id'];_0x6d14f3[_0x20c4('0x61')]=_0xc8d8a['id'];return _0x6d14f3;});return db['VoiceExtension'][_0x20c4('0x62')](_0x476448,{'transaction':_0x4ea16d})[_0x20c4('0x2b')](function(_0xe3bfbf){if(!_0xe3bfbf){return _0x5b56ff(_0x20c4('0x63'));}else{return _0x1f544f(_0xe3bfbf);}})[_0x20c4('0x48')](function(_0x45539d){return _0x5b56ff(_0x45539d);});});;});};function addVoicePrefixExtensions(_0x480ec5,_0x265210){var _0x41a829=[];var _0x414df9=formatPrefixName(_0x480ec5[_0x20c4('0x5e')]);_0x41a829[_0x20c4('0x64')](new Extension(_0x414df9,0x2,_0x20c4('0x65'),_0x20c4('0x66')+_0x480ec5[_0x20c4('0x31')]));if(_0x480ec5['callerIdAll']){_0x41a829[_0x20c4('0x64')](new Extension(_0x414df9,0x3,'Set',_0x20c4('0x67')+_0x480ec5[_0x20c4('0x68')]));}else{_0x41a829[_0x20c4('0x64')](new Extension(_0x414df9,0x3,_0x20c4('0x5f'),_0x20c4('0x69')));}_0x41a829['push'](new Extension(_0x414df9,0x4,_0x20c4('0x6a'),_0x265210['context']+','+'${EXTEN:'+(0x8+_0x480ec5['name'][_0x20c4('0x3b')])+'}'+','+0x1));return _0x41a829;}function formatPrefixName(_0x28af33){var _0x1d210e='_';for(var _0x488dde=0x0;_0x488dde<_0x28af33[_0x20c4('0x3b')];_0x488dde++){if(_0x28af33[_0x20c4('0x6b')](_0x488dde)=='-'){_0x1d210e+=_0x28af33['charAt'](_0x488dde);}else{_0x1d210e+='['+_0x28af33[_0x20c4('0x6b')](_0x488dde)+']';}}_0x1d210e+='.';return _0x1d210e;}exports[_0x20c4('0x2a')]=function(_0x557da6,_0x49905a,_0x213a23){var _0x1b0b97=_0x557da6[_0x20c4('0x4f')];_0x1b0b97[_0x20c4('0x5e')]=_0x20c4('0x6c')+_0x1b0b97[_0x20c4('0x31')]+'-';return db[_0x20c4('0x6d')][_0x20c4('0x6e')](function(_0x252a77){return db['VoicePrefix'][_0x20c4('0x2a')](_0x1b0b97,{'where':{'id':_0x1b0b97['id']},'transaction':_0x252a77})['then'](function(){return db['VoiceExtension'][_0x20c4('0x2c')]({'where':{'VoicePrefixId':_0x1b0b97['id']},'transaction':_0x252a77})['then'](function(){return db[_0x20c4('0x51')][_0x20c4('0x4c')]({'where':{'id':_0x1b0b97[_0x20c4('0x52')]},'raw':!![]})[_0x20c4('0x2b')](function(_0x3f60e5){return createVoicePrefixExtensions(_0x1b0b97,_0x3f60e5,_0x252a77);});});});})[_0x20c4('0x2b')](function(){return db[_0x20c4('0x44')][_0x20c4('0x6f')](_0x1b0b97['id']);})['then'](respondWithResult(_0x49905a,null))[_0x20c4('0x48')](handleError(_0x49905a,null));};exports['addAgents']=function(_0x474784,_0x6ddc06,_0x21e70e){return db[_0x20c4('0x44')]['find']({'where':{'id':_0x474784[_0x20c4('0x4a')]['id']}})[_0x20c4('0x2b')](handleEntityNotFound(_0x6ddc06,null))[_0x20c4('0x2b')](function(_0x42156e){if(_0x42156e){return _0x42156e[_0x20c4('0x70')](_0x474784[_0x20c4('0x4f')]['ids'],_[_0x20c4('0x71')](_0x474784['body'],[_0x20c4('0x72'),'id'])||{})[_0x20c4('0x73')](function(_0x42dab7){for(var _0x3caafe=0x0;_0x3caafe<_0x474784[_0x20c4('0x4f')]['ids']['length'];_0x3caafe+=0x1){socket[_0x20c4('0x74')](_0x20c4('0x75'),{'UserId':_0x474784[_0x20c4('0x4f')][_0x20c4('0x72')][_0x3caafe],'VoicePrefixId':_0x474784[_0x20c4('0x4a')]['id']});}return _0x42dab7;});}})[_0x20c4('0x2b')](respondWithResult(_0x6ddc06,null))['catch'](handleError(_0x6ddc06,null));};exports[_0x20c4('0x76')]=function(_0x5be032,_0x5a15f6,_0x395105){return db[_0x20c4('0x44')]['find']({'where':{'id':_0x5be032['params']['id']}})['then'](handleEntityNotFound(_0x5a15f6,null))['then'](function(_0x268910){if(_0x268910){return _0x268910[_0x20c4('0x76')](_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')])[_0x20c4('0x2b')](function(){if(_['isArray'](_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')])){for(var _0x29b4e1=0x0;_0x29b4e1<_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')][_0x20c4('0x3b')];_0x29b4e1+=0x1){socket[_0x20c4('0x74')](_0x20c4('0x77'),{'UserId':Number(_0x5be032['query'][_0x20c4('0x72')][_0x29b4e1]),'VoicePrefixId':Number(_0x5be032[_0x20c4('0x4a')]['id'])});}}else{socket[_0x20c4('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x5be032[_0x20c4('0x35')][_0x20c4('0x72')]),'VoicePrefixId':Number(_0x5be032[_0x20c4('0x4a')]['id'])});}});}})[_0x20c4('0x2b')](respondWithStatusCode(_0x5a15f6,null))['catch'](handleError(_0x5a15f6,null));};exports[_0x20c4('0x78')]=function(_0x353ec0,_0x2abcb9,_0x3036bc){var _0x161cf9={};var _0x741bc8={};var _0x4bbd7a;var _0x3707fb;return db[_0x20c4('0x44')][_0x20c4('0x79')]({'where':{'id':_0x353ec0[_0x20c4('0x4a')]['id']}})[_0x20c4('0x2b')](handleEntityNotFound(_0x2abcb9,null))[_0x20c4('0x2b')](function(_0x48bd36){if(_0x48bd36){_0x4bbd7a=_0x48bd36;_0x741bc8[_0x20c4('0x34')]=_[_0x20c4('0x36')](db[_0x20c4('0x7a')][_0x20c4('0x33')]);_0x741bc8[_0x20c4('0x35')]=_[_0x20c4('0x36')](_0x353ec0[_0x20c4('0x35')]);_0x741bc8[_0x20c4('0x37')]=_[_0x20c4('0x38')](_0x741bc8[_0x20c4('0x34')],_0x741bc8[_0x20c4('0x35')]);_0x161cf9['attributes']=_[_0x20c4('0x38')](_0x741bc8[_0x20c4('0x34')],qs[_0x20c4('0x3a')](_0x353ec0[_0x20c4('0x35')][_0x20c4('0x3a')]));_0x161cf9[_0x20c4('0x39')]=_0x161cf9[_0x20c4('0x39')][_0x20c4('0x3b')]?_0x161cf9[_0x20c4('0x39')]:_0x741bc8[_0x20c4('0x34')];_0x161cf9[_0x20c4('0x3c')]=qs[_0x20c4('0x3d')](_0x353ec0[_0x20c4('0x35')][_0x20c4('0x3d')]);_0x161cf9['where']=qs['filters'](_['pick'](_0x353ec0[_0x20c4('0x35')],_0x741bc8[_0x20c4('0x37')]));if(_0x353ec0[_0x20c4('0x35')][_0x20c4('0x42')]){_0x161cf9['where']=_[_0x20c4('0x4b')](_0x161cf9[_0x20c4('0x3e')],{'$or':_[_0x20c4('0x32')](_0x161cf9[_0x20c4('0x39')],function(_0x5ebf1b){var _0x239a4f={};_0x239a4f[_0x5ebf1b]={'$like':'%'+_0x353ec0[_0x20c4('0x35')]['filter']+'%'};return _0x239a4f;})});}_0x161cf9=_[_0x20c4('0x4b')]({},_0x161cf9,_0x353ec0[_0x20c4('0x43')]);return _0x4bbd7a[_0x20c4('0x78')](_0x161cf9);}})[_0x20c4('0x2b')](function(_0xa77b3a){if(_0xa77b3a){_0x3707fb=_0xa77b3a['length'];if(!_0x353ec0['query'][_0x20c4('0x7b')]('nolimit')){_0x161cf9[_0x20c4('0x24')]=qs[_0x20c4('0x24')](_0x353ec0[_0x20c4('0x35')][_0x20c4('0x24')]);_0x161cf9['offset']=qs[_0x20c4('0x23')](_0x353ec0[_0x20c4('0x35')]['offset']);}return _0x4bbd7a[_0x20c4('0x78')](_0x161cf9);}})['then'](function(_0x13a1cc){if(_0x13a1cc){return _0x13a1cc?{'count':_0x3707fb,'rows':_0x13a1cc}:null;}})[_0x20c4('0x2b')](respondWithResult(_0x2abcb9,null))[_0x20c4('0x48')](handleError(_0x2abcb9,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0314f37..dbfe277 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x17bafa,_0x44a873){var _0x152b32=function(_0x40ad39){while(--_0x40ad39){_0x17bafa['push'](_0x17bafa['shift']());}};_0x152b32(++_0x44a873);}(_0x70e0,0x17b));var _0x070e=function(_0x1930c0,_0x3fe8b9){_0x1930c0=_0x1930c0-0x0;var _0x58bd75=_0x70e0[_0x1930c0];return _0x58bd75;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0xd1c88a,_0x4eaf97){var _0x12272e=function(_0x1faf63){while(--_0x1faf63){_0xd1c88a['push'](_0xd1c88a['shift']());}};_0x12272e(++_0x4eaf97);}(_0x70e0,0x17b));var _0x070e=function(_0x50273d,_0x174732){_0x50273d=_0x50273d-0x0;var _0x3d3feb=_0x70e0[_0x50273d];return _0x3d3feb;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7febd9a..a7dfe69 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 _0xe336=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x25931e,_0x47905b){var _0x30e7f5=function(_0xbd6d7e){while(--_0xbd6d7e){_0x25931e['push'](_0x25931e['shift']());}};_0x30e7f5(++_0x47905b);}(_0xe336,0x16c));var _0x6e33=function(_0x381098,_0xc74c53){_0x381098=_0x381098-0x0;var _0x34348a=_0xe336[_0x381098];return _0x34348a;};'use strict';var _=require('lodash');var util=require(_0x6e33('0x0'));var logger=require(_0x6e33('0x1'))('api');var moment=require(_0x6e33('0x2'));var BPromise=require(_0x6e33('0x3'));var rp=require(_0x6e33('0x4'));var fs=require('fs');var path=require(_0x6e33('0x5'));var rimraf=require(_0x6e33('0x6'));var config=require(_0x6e33('0x7'));var attributes=require(_0x6e33('0x8'));module[_0x6e33('0x9')]=function(_0x349611,_0x125b4d){return _0x349611[_0x6e33('0xa')](_0x6e33('0xb'),attributes,{'tableName':_0x6e33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a4f=['VoicePrefix','voice_prefixes','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x1523f2,_0x1e4e92){var _0x5a4770=function(_0x138c85){while(--_0x138c85){_0x1523f2['push'](_0x1523f2['shift']());}};_0x5a4770(++_0x1e4e92);}(_0x5a4f,0xa7));var _0xf5a4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5a4f[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xf5a4('0x0'));var util=require(_0xf5a4('0x1'));var logger=require('../../config/logger')(_0xf5a4('0x2'));var moment=require(_0xf5a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5a4('0x4'));var fs=require('fs');var path=require(_0xf5a4('0x5'));var rimraf=require('rimraf');var config=require(_0xf5a4('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xf5a4('0x7')]=function(_0x1d5db4,_0x116556){return _0x1d5db4[_0xf5a4('0x8')](_0xf5a4('0x9'),attributes,{'tableName':_0xf5a4('0xa'),'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 5c9942b..59927c8 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 _0x7fe0=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28b266,_0x37b41c){var _0x22c6ac=function(_0x1ad1a6){while(--_0x1ad1a6){_0x28b266['push'](_0x28b266['shift']());}};_0x22c6ac(++_0x37b41c);}(_0x7fe0,0x198));var _0x07fe=function(_0x54c895,_0x1e62e8){_0x54c895=_0x54c895-0x0;var _0x47e855=_0x7fe0[_0x54c895];return _0x47e855;};'use strict';var _=require(_0x07fe('0x0'));var util=require(_0x07fe('0x1'));var moment=require(_0x07fe('0x2'));var BPromise=require(_0x07fe('0x3'));var rs=require(_0x07fe('0x4'));var fs=require('fs');var Redis=require(_0x07fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07fe('0x6'))('rpc');var config=require(_0x07fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x07fe('0x8')]['http']({'port':0x232a});config[_0x07fe('0x9')]=_[_0x07fe('0xa')](config[_0x07fe('0x9')],{'host':_0x07fe('0xb'),'port':0x18eb});var socket=require(_0x07fe('0xc'))(new Redis(config[_0x07fe('0x9')]));require(_0x07fe('0xd'))[_0x07fe('0xe')](socket);function respondWithRpcPromise(_0x33b600,_0x5e9554,_0x459441){return new BPromise(function(_0x3af89c,_0x3f9579){return client[_0x07fe('0xf')](_0x33b600,_0x459441)[_0x07fe('0x10')](function(_0x5d95a6){logger[_0x07fe('0x11')](_0x07fe('0x12'),_0x5e9554,_0x07fe('0x13'));logger['debug'](_0x07fe('0x14'),_0x5e9554,_0x07fe('0x13'),JSON[_0x07fe('0x15')](_0x5d95a6));if(_0x5d95a6[_0x07fe('0x16')]){if(_0x5d95a6[_0x07fe('0x16')][_0x07fe('0x17')]===0x1f4){logger['error'](_0x07fe('0x12'),_0x5e9554,_0x5d95a6[_0x07fe('0x16')][_0x07fe('0x18')]);return _0x3f9579(_0x5d95a6['error'][_0x07fe('0x18')]);}logger[_0x07fe('0x16')](_0x07fe('0x12'),_0x5e9554,_0x5d95a6[_0x07fe('0x16')]['message']);return _0x3af89c(_0x5d95a6[_0x07fe('0x16')]['message']);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5e9554,_0x07fe('0x13'));_0x3af89c(_0x5d95a6[_0x07fe('0x19')]['message']);}})[_0x07fe('0x1a')](function(_0x3835f1){logger[_0x07fe('0x16')](_0x07fe('0x12'),_0x5e9554,_0x3835f1);_0x3f9579(_0x3835f1);});});} \ No newline at end of file +var _0x9d5b=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','info','request\x20sent','debug','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9d5b,0x12d));var _0xb9d5=function(_0x421ac9,_0x4ca2af){_0x421ac9=_0x421ac9-0x0;var _0x1037f0=_0x9d5b[_0x421ac9];return _0x1037f0;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require(_0xb9d5('0x6'))(_0xb9d5('0x7'));var config=require('../../config/environment');var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});config[_0xb9d5('0xb')]=_[_0xb9d5('0xc')](config['redis'],{'host':_0xb9d5('0xd'),'port':0x18eb});var socket=require(_0xb9d5('0xe'))(new Redis(config[_0xb9d5('0xb')]));require(_0xb9d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4f6d7b,_0x273dcf,_0x528602){return new BPromise(function(_0x5908cf,_0x54593a){return client['request'](_0x4f6d7b,_0x528602)['then'](function(_0x41a955){logger[_0xb9d5('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x273dcf,_0xb9d5('0x11'));logger[_0xb9d5('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x273dcf,_0xb9d5('0x11'),JSON[_0xb9d5('0x13')](_0x41a955));if(_0x41a955[_0xb9d5('0x14')]){if(_0x41a955[_0xb9d5('0x14')][_0xb9d5('0x15')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x273dcf,_0x41a955['error'][_0xb9d5('0x16')]);return _0x54593a(_0x41a955['error'][_0xb9d5('0x16')]);}logger[_0xb9d5('0x14')](_0xb9d5('0x17'),_0x273dcf,_0x41a955[_0xb9d5('0x14')][_0xb9d5('0x16')]);return _0x5908cf(_0x41a955['error'][_0xb9d5('0x16')]);}else{logger['info'](_0xb9d5('0x17'),_0x273dcf,_0xb9d5('0x11'));_0x5908cf(_0x41a955[_0xb9d5('0x18')]['message']);}})[_0xb9d5('0x19')](function(_0x2b6b72){logger[_0xb9d5('0x14')](_0xb9d5('0x17'),_0x273dcf,_0x2b6b72);_0x54593a(_0x2b6b72);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 547d7b7..3334d8e 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 _0xb47a=['removeListener','register','voicePrefix:','./voicePrefix.events','save'];(function(_0x1a3597,_0x317a21){var _0x313c4a=function(_0x5e11d5){while(--_0x5e11d5){_0x1a3597['push'](_0x1a3597['shift']());}};_0x313c4a(++_0x317a21);}(_0xb47a,0x1ca));var _0xab47=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xb47a[_0xd0b415];return _0x2bdf2c;};'use strict';var VoicePrefixEvents=require(_0xab47('0x0'));var events=[_0xab47('0x1'),'remove','update'];function createListener(_0x5295ae,_0x4ed4e3){return function(_0x1aae4c){_0x4ed4e3['emit'](_0x5295ae,_0x1aae4c);};}function removeListener(_0x501838,_0x2b5f4f){return function(){VoicePrefixEvents[_0xab47('0x2')](_0x501838,_0x2b5f4f);};}exports[_0xab47('0x3')]=function(_0x20f268){for(var _0x360269=0x0,_0x85eb16=events['length'];_0x360269<_0x85eb16;_0x360269++){var _0x27470b=events[_0x360269];var _0x596fb1=createListener(_0xab47('0x4')+_0x27470b,_0x20f268);VoicePrefixEvents['on'](_0x27470b,_0x596fb1);}}; \ No newline at end of file +var _0x3a9f=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x513516,_0x522cc6){var _0x4abdc5=function(_0x2ab357){while(--_0x2ab357){_0x513516['push'](_0x513516['shift']());}};_0x4abdc5(++_0x522cc6);}(_0x3a9f,0x1ef));var _0xf3a9=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x3a9f[_0x54eab6];return _0x1e7435;};'use strict';var VoicePrefixEvents=require(_0xf3a9('0x0'));var events=[_0xf3a9('0x1'),_0xf3a9('0x2'),_0xf3a9('0x3')];function createListener(_0x54c07e,_0x20bb8b){return function(_0x55b054){_0x20bb8b[_0xf3a9('0x4')](_0x54c07e,_0x55b054);};}function removeListener(_0x2f4341,_0x2caa06){return function(){VoicePrefixEvents[_0xf3a9('0x5')](_0x2f4341,_0x2caa06);};}exports[_0xf3a9('0x6')]=function(_0x40e06b){for(var _0x2c154f=0x0,_0x129263=events[_0xf3a9('0x7')];_0x2c154f<_0x129263;_0x2c154f++){var _0x3797a3=events[_0x2c154f];var _0xac15a9=createListener(_0xf3a9('0x8')+_0x3797a3,_0x40e06b);VoicePrefixEvents['on'](_0x3797a3,_0xac15a9);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6af5181..757f742 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 _0x242e=['destroy','removeTeams','removeAgents','removeLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/teams','/:id/users','/:id/members','getMembers','getLists','post','create','/:id/clone','addTeams','addAgents','/:id/lists','/:id/blacklists','addBlackLists','put','delete'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x242e,0x1cd));var _0xe242=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x242e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xe242('0x0'));var util=require(_0xe242('0x1'));var path=require(_0xe242('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe242('0x3')]();var auth=require(_0xe242('0x4'));var interaction=require(_0xe242('0x5'));var config=require(_0xe242('0x6'));var controller=require('./voiceQueue.controller');router[_0xe242('0x7')]('/',auth[_0xe242('0x8')](),controller[_0xe242('0x9')]);router['get'](_0xe242('0xa'),auth[_0xe242('0x8')](),controller[_0xe242('0xb')]);router['get'](_0xe242('0xc'),auth['isAuthenticated'](),controller[_0xe242('0xd')]);router[_0xe242('0x7')](_0xe242('0xe'),auth[_0xe242('0x8')](),controller[_0xe242('0xf')]);router[_0xe242('0x7')]('/:id/hopper_finals',auth[_0xe242('0x8')](),controller[_0xe242('0x10')]);router[_0xe242('0x7')](_0xe242('0x11'),auth[_0xe242('0x8')](),controller['getHopperBlacks']);router[_0xe242('0x7')](_0xe242('0x12'),auth[_0xe242('0x8')](),controller['getTeams']);router[_0xe242('0x7')](_0xe242('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe242('0x7')](_0xe242('0x14'),auth['isAuthenticated'](),controller[_0xe242('0x15')]);router[_0xe242('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0xe242('0x16')]);router[_0xe242('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0xe242('0x17')]('/',auth[_0xe242('0x8')](),controller[_0xe242('0x18')]);router[_0xe242('0x17')](_0xe242('0x19'),auth[_0xe242('0x8')](),controller['clone']);router[_0xe242('0x17')](_0xe242('0x12'),auth[_0xe242('0x8')](),controller[_0xe242('0x1a')]);router[_0xe242('0x17')](_0xe242('0x13'),auth[_0xe242('0x8')](),controller[_0xe242('0x1b')]);router['post'](_0xe242('0x1c'),auth[_0xe242('0x8')](),controller['addLists']);router['post'](_0xe242('0x1d'),auth['isAuthenticated'](),controller[_0xe242('0x1e')]);router[_0xe242('0x1f')](_0xe242('0xa'),auth[_0xe242('0x8')](),controller['update']);router[_0xe242('0x20')]('/:id',auth['isAuthenticated'](),controller[_0xe242('0x21')]);router['delete'](_0xe242('0x12'),auth[_0xe242('0x8')](),controller[_0xe242('0x22')]);router['delete'](_0xe242('0x13'),auth[_0xe242('0x8')](),controller[_0xe242('0x23')]);router['delete'](_0xe242('0x1c'),auth[_0xe242('0x8')](),controller[_0xe242('0x24')]);router[_0xe242('0x20')](_0xe242('0x1d'),auth[_0xe242('0x8')](),controller['removeBlackLists']);module[_0xe242('0x25')]=router; \ No newline at end of file +var _0x345b=['/:id/members','getMembers','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0x345b,0x93));var _0xb345=function(_0x2c9928,_0x3015ef){_0x2c9928=_0x2c9928-0x0;var _0x12dd4d=_0x345b[_0x2c9928];return _0x12dd4d;};'use strict';var multer=require(_0xb345('0x0'));var util=require(_0xb345('0x1'));var path=require('path');var timeout=require(_0xb345('0x2'));var express=require(_0xb345('0x3'));var router=express[_0xb345('0x4')]();var auth=require(_0xb345('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb345('0x6'));var controller=require(_0xb345('0x7'));router[_0xb345('0x8')]('/',auth[_0xb345('0x9')](),controller[_0xb345('0xa')]);router['get'](_0xb345('0xb'),auth[_0xb345('0x9')](),controller[_0xb345('0xc')]);router[_0xb345('0x8')](_0xb345('0xd'),auth[_0xb345('0x9')](),controller[_0xb345('0xe')]);router['get'](_0xb345('0xf'),auth[_0xb345('0x9')](),controller[_0xb345('0x10')]);router['get']('/:id/hopper_finals',auth[_0xb345('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xb345('0x9')](),controller['getHopperBlacks']);router[_0xb345('0x8')](_0xb345('0x11'),auth['isAuthenticated'](),controller[_0xb345('0x12')]);router[_0xb345('0x8')](_0xb345('0x13'),auth[_0xb345('0x9')](),controller[_0xb345('0x14')]);router[_0xb345('0x8')](_0xb345('0x15'),auth[_0xb345('0x9')](),controller[_0xb345('0x16')]);router[_0xb345('0x8')]('/:id/lists',auth[_0xb345('0x9')](),controller['getLists']);router[_0xb345('0x8')](_0xb345('0x17'),auth['isAuthenticated'](),controller[_0xb345('0x18')]);router[_0xb345('0x19')]('/',auth[_0xb345('0x9')](),controller[_0xb345('0x1a')]);router[_0xb345('0x19')](_0xb345('0x1b'),auth['isAuthenticated'](),controller[_0xb345('0x1c')]);router[_0xb345('0x19')](_0xb345('0x11'),auth[_0xb345('0x9')](),controller[_0xb345('0x1d')]);router[_0xb345('0x19')](_0xb345('0x13'),auth[_0xb345('0x9')](),controller[_0xb345('0x1e')]);router['post'](_0xb345('0x1f'),auth[_0xb345('0x9')](),controller[_0xb345('0x20')]);router[_0xb345('0x19')](_0xb345('0x17'),auth[_0xb345('0x9')](),controller[_0xb345('0x21')]);router[_0xb345('0x22')]('/:id',auth[_0xb345('0x9')](),controller[_0xb345('0x23')]);router[_0xb345('0x24')](_0xb345('0xb'),auth[_0xb345('0x9')](),controller[_0xb345('0x25')]);router[_0xb345('0x24')](_0xb345('0x11'),auth['isAuthenticated'](),controller[_0xb345('0x26')]);router[_0xb345('0x24')](_0xb345('0x13'),auth['isAuthenticated'](),controller[_0xb345('0x27')]);router[_0xb345('0x24')](_0xb345('0x1f'),auth[_0xb345('0x9')](),controller[_0xb345('0x28')]);router[_0xb345('0x24')](_0xb345('0x17'),auth[_0xb345('0x9')](),controller['removeBlackLists']);module[_0xb345('0x29')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c3da83b..986a170 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(_0x53c739,_0x34dd56){var _0x1cf22e=function(_0x176909){while(--_0x176909){_0x53c739['push'](_0x53c739['shift']());}};_0x1cf22e(++_0x34dd56);}(_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(_0x26db15,_0x50daec){var _0x31f013=function(_0x2b71fe){while(--_0x2b71fe){_0x26db15['push'](_0x26db15['shift']());}};_0x31f013(++_0x50daec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 01904c0..ce2c8ad 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 _0xedc2=['sendStatus','status','offset','limit','set','apply','reject','save','update','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','count','includeAll','findAll','rows','catch','show','params','length','include','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','addTeams','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','push','isArray','destroy','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x5c753d,_0x47ccd9){var _0x5859ca=function(_0xc791a5){while(--_0xc791a5){_0x5c753d['push'](_0x5c753d['shift']());}};_0x5859ca(++_0x47ccd9);}(_0xedc2,0x98));var _0x2edc=function(_0x542b1c,_0x581e16){_0x542b1c=_0x542b1c-0x0;var _0xc08a22=_0xedc2[_0x542b1c];return _0xc08a22;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2edc('0x0'));var rimraf=require(_0x2edc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2edc('0x2'));var moment=require(_0x2edc('0x3'));var BPromise=require(_0x2edc('0x4'));var Mustache=require('mustache');var util=require(_0x2edc('0x5'));var path=require(_0x2edc('0x6'));var sox=require('sox');var csv=require(_0x2edc('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2edc('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2edc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2edc('0x7'));var querystring=require('querystring');var Papa=require(_0x2edc('0xa'));var Redis=require('ioredis');var authService=require(_0x2edc('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x2edc('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2edc('0xd'));var utils=require(_0x2edc('0xe'));var config=require(_0x2edc('0xf'));var licenseUtil=require(_0x2edc('0x10'));var db=require(_0x2edc('0x11'))['db'];config[_0x2edc('0x12')]=_[_0x2edc('0x13')](config[_0x2edc('0x12')],{'host':_0x2edc('0x14'),'port':0x18eb});var socket=require(_0x2edc('0x15'))(new Redis(config[_0x2edc('0x12')]));require(_0x2edc('0x16'))[_0x2edc('0x17')](socket);function respondWithStatusCode(_0x542e87,_0x43466f){_0x43466f=_0x43466f||0xcc;return function(_0x1fcca9){if(_0x1fcca9){return _0x542e87[_0x2edc('0x18')](_0x43466f);}return _0x542e87[_0x2edc('0x19')](_0x43466f)['end']();};}function respondWithResult(_0x1da16a,_0x27aeb3){_0x27aeb3=_0x27aeb3||0xc8;return function(_0x3a98bd){if(_0x3a98bd){return _0x1da16a[_0x2edc('0x19')](_0x27aeb3)['json'](_0x3a98bd);}};}function respondWithFilteredResult(_0xdd3287,_0x50ea15){return function(_0x46fbad){if(_0x46fbad){var _0x1ba39d=_0x46fbad['count'],_0x5a89ea=_0x50ea15[_0x2edc('0x1a')],_0x4528f7=_0x50ea15[_0x2edc('0x1a')]+_0x50ea15[_0x2edc('0x1b')],_0x209e66;if(_0x4528f7>=_0x1ba39d){_0x4528f7=_0x1ba39d;_0x209e66=0xc8;}else{_0x209e66=0xce;}_0xdd3287[_0x2edc('0x19')](_0x209e66);return _0xdd3287[_0x2edc('0x1c')]('Content-Range',_0x5a89ea+'-'+_0x4528f7+'/'+_0x1ba39d)['json'](_0x46fbad);}return null;};}function patchUpdates(_0x574964){return function(_0x788071){try{jsonpatch[_0x2edc('0x1d')](_0x788071,_0x574964,!![]);}catch(_0x3df4b6){return BPromise[_0x2edc('0x1e')](_0x3df4b6);}return _0x788071[_0x2edc('0x1f')]();};}function saveUpdates(_0x5ef234,_0x34663a){return function(_0x141f20){if(_0x141f20){return _0x141f20[_0x2edc('0x20')](_0x5ef234)[_0x2edc('0x21')](function(_0x3aab75){return _0x3aab75;});}return null;};}function removeEntity(_0x1205fc,_0x76e922){return function(_0x44fcb6){if(_0x44fcb6){return _0x44fcb6['destroy']()['then'](function(){var _0xae5946=_0x44fcb6[_0x2edc('0x22')]({'plain':!![]});var _0x4214d9=[{'name':'VoiceQueues','value':_0x2edc('0x23'),'ignore':![]},{'name':_0x2edc('0x24'),'value':_0x2edc('0x25'),'ignore':![]}];var _0x39cc49=_(_0x4214d9)[_0x2edc('0x26')](_0x2edc('0x27'))[_0x2edc('0x28')](_0x2edc('0x29'))[_0x2edc('0x29')]();if(_[_0x2edc('0x2a')](_0x39cc49,_0xae5946[_0x2edc('0x2b')])){return;}var _0x13ac4e=_[_0x2edc('0x2c')](_0x4214d9,[_0x2edc('0x29'),_0xae5946[_0x2edc('0x2b')]])[_0x2edc('0x2d')];return db[_0x2edc('0x2e')]['destroy']({'where':{'type':_0x13ac4e,'resourceId':_0xae5946['id']}})[_0x2edc('0x21')](function(){return _0x44fcb6;});})[_0x2edc('0x21')](function(){_0x1205fc[_0x2edc('0x19')](0xcc)[_0x2edc('0x2f')]();});}};}function handleEntityNotFound(_0x5f564a,_0x10b49e){return function(_0x1288c2){if(!_0x1288c2){_0x5f564a[_0x2edc('0x18')](0x194);}return _0x1288c2;};}function handleError(_0x2dcc41,_0xd132ba){_0xd132ba=_0xd132ba||0x1f4;return function(_0x9177c0){logger[_0x2edc('0x30')](_0x9177c0[_0x2edc('0x31')]);if(_0x9177c0[_0x2edc('0x2d')]){delete _0x9177c0[_0x2edc('0x2d')];}_0x2dcc41[_0x2edc('0x19')](_0xd132ba)[_0x2edc('0x32')](_0x9177c0);};}exports[_0x2edc('0x33')]=function(_0x8a726e,_0x3a2af4){var _0x2e9774={},_0x194f20={},_0x32290e={'count':0x0,'rows':[]};var _0x5b4925=_[_0x2edc('0x28')](db[_0x2edc('0x34')][_0x2edc('0x35')],function(_0xa246b4){return{'name':_0xa246b4['fieldName'],'type':_0xa246b4[_0x2edc('0x2b')]['key']};});_0x194f20[_0x2edc('0x36')]=_[_0x2edc('0x28')](_0x5b4925,_0x2edc('0x2d'));_0x194f20[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x8a726e[_0x2edc('0x37')]);_0x194f20[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x194f20['model'],_0x194f20[_0x2edc('0x37')]);_0x2e9774[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x194f20['model'],qs[_0x2edc('0x3c')](_0x8a726e[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x2e9774[_0x2edc('0x3b')]=_0x2e9774[_0x2edc('0x3b')]['length']?_0x2e9774[_0x2edc('0x3b')]:_0x194f20[_0x2edc('0x36')];if(!_0x8a726e[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x2e9774['limit']=qs[_0x2edc('0x1b')](_0x8a726e['query'][_0x2edc('0x1b')]);_0x2e9774[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x8a726e[_0x2edc('0x37')]['offset']);}_0x2e9774[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x8a726e[_0x2edc('0x37')][_0x2edc('0x40')]);_0x2e9774[_0x2edc('0x41')]=qs['filters'](_[_0x2edc('0x42')](_0x8a726e['query'],_0x194f20['filters']),_0x5b4925);if(_0x8a726e['query'][_0x2edc('0x26')]){_0x2e9774[_0x2edc('0x41')]=_['merge'](_0x2e9774[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x5b4925,function(_0x35064a){if(_0x35064a[_0x2edc('0x2b')]!=='VIRTUAL'){var _0x4a9fa5={};_0x4a9fa5[_0x35064a['name']]={'$like':'%'+_0x8a726e['query'][_0x2edc('0x26')]+'%'};return _0x4a9fa5;}})});}_0x2e9774=_['merge']({},_0x2e9774,_0x8a726e['options']);var _0x394eb4={'where':_0x2e9774[_0x2edc('0x41')]};return db['VoiceQueue']['count'](_0x394eb4)['then'](function(_0x3b8003){_0x32290e[_0x2edc('0x43')]=_0x3b8003;if(_0x8a726e[_0x2edc('0x37')][_0x2edc('0x44')]){_0x2e9774['include']=[{'all':!![]}];}return db[_0x2edc('0x34')][_0x2edc('0x45')](_0x2e9774);})['then'](function(_0x532704){_0x32290e[_0x2edc('0x46')]=_0x532704;return _0x32290e;})[_0x2edc('0x21')](respondWithFilteredResult(_0x3a2af4,_0x2e9774))[_0x2edc('0x47')](handleError(_0x3a2af4,null));};exports[_0x2edc('0x48')]=function(_0x56391,_0x2fa358){var _0x5ba42d={'raw':![],'where':{'id':_0x56391[_0x2edc('0x49')]['id']}},_0xd73320={};_0xd73320['model']=_[_0x2edc('0x38')](db[_0x2edc('0x34')]['rawAttributes']);_0xd73320[_0x2edc('0x37')]=_['keys'](_0x56391[_0x2edc('0x37')]);_0xd73320['filters']=_[_0x2edc('0x3a')](_0xd73320[_0x2edc('0x36')],_0xd73320['query']);_0x5ba42d[_0x2edc('0x3b')]=_['intersection'](_0xd73320[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0x56391[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x5ba42d['attributes']=_0x5ba42d[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x5ba42d[_0x2edc('0x3b')]:_0xd73320[_0x2edc('0x36')];if(_0x56391[_0x2edc('0x37')][_0x2edc('0x44')]){_0x5ba42d[_0x2edc('0x4b')]=[{'all':!![]}];}_0x5ba42d=_[_0x2edc('0x4c')]({},_0x5ba42d,_0x56391['options']);return db[_0x2edc('0x34')][_0x2edc('0x2c')](_0x5ba42d)[_0x2edc('0x21')](handleEntityNotFound(_0x2fa358,null))[_0x2edc('0x21')](respondWithResult(_0x2fa358,null))[_0x2edc('0x47')](handleError(_0x2fa358,null));};exports['create']=function(_0x4d4ab5,_0x1c014f){return db[_0x2edc('0x34')][_0x2edc('0x4d')](_0x4d4ab5['body'],{})[_0x2edc('0x21')](function(_0x58680a){var _0x144ea9=_0x4d4ab5[_0x2edc('0x4e')][_0x2edc('0x22')]({'plain':!![]});if(!_0x144ea9)throw new Error(_0x2edc('0x4f'));if(_0x144ea9[_0x2edc('0x50')]==='user'){var _0x5acc63=_0x58680a['get']({'plain':!![]});var _0x47a9fc=[{'name':_0x2edc('0x51'),'value':_0x2edc('0x23')},{'name':_0x2edc('0x24'),'value':'outbound'}];var _0x254154=_['find'](_0x47a9fc,[_0x2edc('0x29'),_0x5acc63[_0x2edc('0x2b')]])[_0x2edc('0x2d')];return db[_0x2edc('0x52')]['find']({'where':{'name':_0x254154,'userProfileId':_0x144ea9[_0x2edc('0x53')]},'raw':!![]})[_0x2edc('0x21')](function(_0x45dee1){if(_0x45dee1&&_0x45dee1[_0x2edc('0x54')]===0x0){return db[_0x2edc('0x2e')][_0x2edc('0x4d')]({'name':_0x5acc63[_0x2edc('0x2d')],'resourceId':_0x5acc63['id'],'type':_0x45dee1['name'],'sectionId':_0x45dee1['id']},{})[_0x2edc('0x21')](function(){return _0x58680a;});}else{return _0x58680a;}})[_0x2edc('0x47')](function(_0x29f1fd){logger[_0x2edc('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29f1fd);throw _0x29f1fd;});}return _0x58680a;})[_0x2edc('0x21')](respondWithResult(_0x1c014f,0xc9))['catch'](handleError(_0x1c014f,null));};exports[_0x2edc('0x55')]=function(_0x5ee2f0,_0x31c52a){var _0x43e0d1={'where':{'id':_0x5ee2f0['params']['id']}},_0xf3e9fd={};_0xf3e9fd['model']=_[_0x2edc('0x38')](db['VoiceQueue'][_0x2edc('0x35')]);_0x43e0d1[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0xf3e9fd['model'],qs['fields'](_0x5ee2f0[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x43e0d1[_0x2edc('0x3b')]=_0x43e0d1[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x43e0d1[_0x2edc('0x3b')]:_0xf3e9fd[_0x2edc('0x36')];if(_0x5ee2f0['query'][_0x2edc('0x44')]){_0x43e0d1['include']=[{'all':!![]}];}_0x43e0d1=_[_0x2edc('0x4c')]({},_0x43e0d1,_0x5ee2f0[_0x2edc('0x56')]);return db[_0x2edc('0x34')]['find'](_0x43e0d1)[_0x2edc('0x21')](handleEntityNotFound(_0x31c52a,null))['then'](function(_0x55923b){if(_0x55923b){var _0x4e8d95=_0x55923b['get']({'plain':!![]});_0x4e8d95=qs[_0x2edc('0x57')](_0x4e8d95,['id',_0x2edc('0x58'),_0x2edc('0x59')]);_0x5ee2f0[_0x2edc('0x5a')]=_[_0x2edc('0x57')](_0x5ee2f0[_0x2edc('0x5a')],['id',_0x2edc('0x58'),_0x2edc('0x59')]);return db[_0x2edc('0x34')]['create'](_[_0x2edc('0x4c')](_0x4e8d95,_0x5ee2f0[_0x2edc('0x5a')]),{'include':_0x5ee2f0[_0x2edc('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x2edc('0x21')](function(_0xbe18c0){var _0x215e21=_0x5ee2f0[_0x2edc('0x4e')][_0x2edc('0x22')]({'plain':!![]});if(!_0x215e21)throw new Error(_0x2edc('0x4f'));if(_0x215e21['role']===_0x2edc('0x4e')){var _0x428d20=_0xbe18c0[_0x2edc('0x22')]({'plain':!![]});var _0xaa5f2f=[{'name':_0x2edc('0x51'),'value':_0x2edc('0x23')},{'name':_0x2edc('0x24'),'value':'outbound'}];var _0x20361d=_[_0x2edc('0x2c')](_0xaa5f2f,[_0x2edc('0x29'),_0x428d20['type']])[_0x2edc('0x2d')];return db[_0x2edc('0x52')][_0x2edc('0x2c')]({'where':{'name':_0x20361d,'userProfileId':_0x215e21[_0x2edc('0x53')]},'raw':!![]})[_0x2edc('0x21')](function(_0x44e44b){if(_0x44e44b&&_0x44e44b[_0x2edc('0x54')]===0x0){return db[_0x2edc('0x2e')][_0x2edc('0x4d')]({'name':_0x428d20[_0x2edc('0x2d')],'resourceId':_0x428d20['id'],'type':_0x44e44b[_0x2edc('0x2d')],'sectionId':_0x44e44b['id']},{})[_0x2edc('0x21')](function(){return _0xbe18c0;});}else{return _0xbe18c0;}})[_0x2edc('0x47')](function(_0x3fc374){logger[_0x2edc('0x30')](_0x2edc('0x5b'),_0x3fc374);throw _0x3fc374;});}return _0xbe18c0;});}})[_0x2edc('0x21')](respondWithResult(_0x31c52a,0xc9))[_0x2edc('0x47')](handleError(_0x31c52a,null));};exports['update']=function(_0x4be25c,_0x557ed0){if(_0x4be25c[_0x2edc('0x5a')]['id']){delete _0x4be25c[_0x2edc('0x5a')]['id'];}return db[_0x2edc('0x34')]['find']({'where':{'id':_0x4be25c[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x557ed0,null))[_0x2edc('0x21')](saveUpdates(_0x4be25c[_0x2edc('0x5a')],null))[_0x2edc('0x21')](respondWithResult(_0x557ed0,null))[_0x2edc('0x47')](handleError(_0x557ed0,null));};exports['destroy']=function(_0x2a7020,_0x3dfb88){return db[_0x2edc('0x34')]['find']({'where':{'id':_0x2a7020[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x3dfb88,null))[_0x2edc('0x21')](removeEntity(_0x3dfb88,null))[_0x2edc('0x47')](handleError(_0x3dfb88,null));};exports[_0x2edc('0x5c')]=function(_0x57779a,_0x894faa,_0x599fbf){var _0x2b6962={'raw':![],'where':{}};var _0x304229={};var _0x401d36={'count':0x0,'rows':[]};return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x57779a['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x894faa,null))[_0x2edc('0x21')](function(_0x87f7){if(_0x87f7){_0x304229[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x5e')][_0x2edc('0x35')]);_0x304229[_0x2edc('0x37')]=_['keys'](_0x57779a[_0x2edc('0x37')]);_0x304229[_0x2edc('0x39')]=_['intersection'](_0x304229[_0x2edc('0x36')],_0x304229[_0x2edc('0x37')]);_0x2b6962['attributes']=_[_0x2edc('0x3a')](_0x304229[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0x57779a[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x2b6962['attributes']=_0x2b6962[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x2b6962[_0x2edc('0x3b')]:_0x304229[_0x2edc('0x36')];if(!_0x57779a[_0x2edc('0x37')][_0x2edc('0x3d')]('nolimit')){_0x2b6962[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x57779a[_0x2edc('0x37')][_0x2edc('0x1b')]);_0x2b6962[_0x2edc('0x1a')]=qs['offset'](_0x57779a[_0x2edc('0x37')]['offset']);}_0x2b6962['order']=qs['sort'](_0x57779a[_0x2edc('0x37')][_0x2edc('0x40')]);_0x2b6962[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x57779a[_0x2edc('0x37')],_0x304229[_0x2edc('0x39')]));_0x2b6962['where']['VoiceQueueId']=_0x87f7['id'];if(_0x57779a[_0x2edc('0x37')][_0x2edc('0x26')]){_0x2b6962[_0x2edc('0x41')]=_['merge'](_0x2b6962[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x2b6962['attributes'],function(_0x305c43){var _0xe60b9b={};_0xe60b9b[_0x305c43]={'$like':'%'+_0x57779a[_0x2edc('0x37')]['filter']+'%'};return _0xe60b9b;})});}_0x2b6962=_[_0x2edc('0x4c')]({},_0x2b6962,_0x57779a[_0x2edc('0x56')]);return db[_0x2edc('0x5e')][_0x2edc('0x43')]({'where':_0x2b6962['where']})['then'](function(_0x480601){_0x401d36['count']=_0x480601;if(_0x57779a[_0x2edc('0x37')][_0x2edc('0x44')]){_0x2b6962[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x5e')][_0x2edc('0x45')](_0x2b6962);})[_0x2edc('0x21')](function(_0x4f50b9){_0x401d36[_0x2edc('0x46')]=_0x4f50b9;return _0x401d36;});}})[_0x2edc('0x21')](respondWithFilteredResult(_0x894faa,_0x2b6962))[_0x2edc('0x47')](handleError(_0x894faa,null));};exports[_0x2edc('0x5f')]=function(_0x5956dc,_0x4da5f6,_0x18c2aa){var _0x4a303f={'raw':!![],'where':{}};var _0x19ad09={};var _0xf07a85={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2edc('0x5d')]({'where':{'id':_0x5956dc[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x4da5f6,null))['then'](function(_0x3afded){if(_0x3afded){_0x19ad09[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x60')][_0x2edc('0x35')]);_0x19ad09[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x5956dc[_0x2edc('0x37')]);_0x19ad09[_0x2edc('0x39')]=_['intersection'](_0x19ad09[_0x2edc('0x36')],_0x19ad09[_0x2edc('0x37')]);_0x4a303f['attributes']=_['intersection'](_0x19ad09[_0x2edc('0x36')],qs['fields'](_0x5956dc[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x4a303f[_0x2edc('0x3b')]=_0x4a303f[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x4a303f[_0x2edc('0x3b')]:_0x19ad09[_0x2edc('0x36')];if(!_0x5956dc[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x4a303f[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x5956dc['query'][_0x2edc('0x1b')]);_0x4a303f[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x5956dc[_0x2edc('0x37')][_0x2edc('0x1a')]);}_0x4a303f['order']=qs[_0x2edc('0x40')](_0x5956dc['query']['sort']);_0x4a303f[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x5956dc[_0x2edc('0x37')],_0x19ad09[_0x2edc('0x39')]));_0x4a303f[_0x2edc('0x41')][_0x2edc('0x61')]=_0x3afded['id'];if(_0x5956dc['query'][_0x2edc('0x26')]){_0x4a303f[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x4a303f['where'],{'$or':_[_0x2edc('0x28')](_0x4a303f[_0x2edc('0x3b')],function(_0x46d95e){var _0x4d589c={};_0x4d589c[_0x46d95e]={'$like':'%'+_0x5956dc[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x4d589c;})});}_0x4a303f=_[_0x2edc('0x4c')]({},_0x4a303f,_0x5956dc[_0x2edc('0x56')]);return db[_0x2edc('0x60')][_0x2edc('0x43')]({'where':_0x4a303f[_0x2edc('0x41')]})[_0x2edc('0x21')](function(_0x439b1a){_0xf07a85[_0x2edc('0x43')]=_0x439b1a;if(_0x5956dc[_0x2edc('0x37')][_0x2edc('0x44')]){_0x4a303f[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x60')][_0x2edc('0x45')](_0x4a303f);})[_0x2edc('0x21')](function(_0x111392){_0xf07a85['rows']=_0x111392;return _0xf07a85;});}})['then'](respondWithFilteredResult(_0x4da5f6,_0x4a303f))['catch'](handleError(_0x4da5f6,null));};exports['getHopperFinals']=function(_0x110d72,_0x6c1065,_0x3f348c){var _0x44faaa={'raw':!![],'where':{}};var _0x496db4={};var _0x24b79f={'count':0x0,'rows':[]};return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x110d72[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x6c1065,null))[_0x2edc('0x21')](function(_0xbb7f3b){if(_0xbb7f3b){_0x496db4['model']=_[_0x2edc('0x38')](db[_0x2edc('0x62')][_0x2edc('0x35')]);_0x496db4[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x110d72[_0x2edc('0x37')]);_0x496db4[_0x2edc('0x39')]=_['intersection'](_0x496db4[_0x2edc('0x36')],_0x496db4[_0x2edc('0x37')]);_0x44faaa['attributes']=_[_0x2edc('0x3a')](_0x496db4['model'],qs[_0x2edc('0x3c')](_0x110d72[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x44faaa[_0x2edc('0x3b')]=_0x44faaa['attributes'][_0x2edc('0x4a')]?_0x44faaa[_0x2edc('0x3b')]:_0x496db4['model'];if(!_0x110d72['query'][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x44faaa[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x110d72[_0x2edc('0x37')][_0x2edc('0x1b')]);_0x44faaa[_0x2edc('0x1a')]=qs['offset'](_0x110d72[_0x2edc('0x37')]['offset']);}_0x44faaa[_0x2edc('0x3f')]=qs['sort'](_0x110d72[_0x2edc('0x37')]['sort']);_0x44faaa[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_['pick'](_0x110d72[_0x2edc('0x37')],_0x496db4[_0x2edc('0x39')]));_0x44faaa[_0x2edc('0x41')][_0x2edc('0x61')]=_0xbb7f3b['id'];if(_0x110d72[_0x2edc('0x37')][_0x2edc('0x26')]){_0x44faaa[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x44faaa[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x44faaa['attributes'],function(_0x54eeb5){var _0x4eaea8={};_0x4eaea8[_0x54eeb5]={'$like':'%'+_0x110d72[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x4eaea8;})});}_0x44faaa=_[_0x2edc('0x4c')]({},_0x44faaa,_0x110d72['options']);return db[_0x2edc('0x62')]['count']({'where':_0x44faaa['where']})[_0x2edc('0x21')](function(_0x1082e3){_0x24b79f[_0x2edc('0x43')]=_0x1082e3;if(_0x110d72['query']['includeAll']){_0x44faaa[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x62')]['findAll'](_0x44faaa);})[_0x2edc('0x21')](function(_0x17457c){_0x24b79f[_0x2edc('0x46')]=_0x17457c;return _0x24b79f;});}})[_0x2edc('0x21')](respondWithFilteredResult(_0x6c1065,_0x44faaa))[_0x2edc('0x47')](handleError(_0x6c1065,null));};exports[_0x2edc('0x63')]=function(_0x492e3f,_0x17214c,_0x41eab0){var _0x33d46c={'raw':!![],'where':{}};var _0x64eaab={};var _0x234fcb={'count':0x0,'rows':[]};return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x492e3f[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x17214c,null))[_0x2edc('0x21')](function(_0x5993dd){if(_0x5993dd){_0x64eaab[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x64')]['rawAttributes']);_0x64eaab['query']=_[_0x2edc('0x38')](_0x492e3f[_0x2edc('0x37')]);_0x64eaab[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x64eaab[_0x2edc('0x36')],_0x64eaab[_0x2edc('0x37')]);_0x33d46c[_0x2edc('0x3b')]=_['intersection'](_0x64eaab[_0x2edc('0x36')],qs['fields'](_0x492e3f['query']['fields']));_0x33d46c[_0x2edc('0x3b')]=_0x33d46c[_0x2edc('0x3b')]['length']?_0x33d46c[_0x2edc('0x3b')]:_0x64eaab['model'];if(!_0x492e3f[_0x2edc('0x37')][_0x2edc('0x3d')]('nolimit')){_0x33d46c['limit']=qs[_0x2edc('0x1b')](_0x492e3f[_0x2edc('0x37')]['limit']);_0x33d46c[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x492e3f['query'][_0x2edc('0x1a')]);}_0x33d46c[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x492e3f[_0x2edc('0x37')]['sort']);_0x33d46c[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x492e3f['query'],_0x64eaab[_0x2edc('0x39')]));_0x33d46c[_0x2edc('0x41')]['VoiceQueueId']=_0x5993dd['id'];if(_0x492e3f[_0x2edc('0x37')]['filter']){_0x33d46c[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x33d46c[_0x2edc('0x41')],{'$or':_['map'](_0x33d46c[_0x2edc('0x3b')],function(_0x38c8f9){var _0x385b2d={};_0x385b2d[_0x38c8f9]={'$like':'%'+_0x492e3f['query']['filter']+'%'};return _0x385b2d;})});}_0x33d46c=_['merge']({},_0x33d46c,_0x492e3f['options']);return db[_0x2edc('0x64')][_0x2edc('0x43')]({'where':_0x33d46c[_0x2edc('0x41')]})['then'](function(_0x3b0fef){_0x234fcb[_0x2edc('0x43')]=_0x3b0fef;if(_0x492e3f[_0x2edc('0x37')][_0x2edc('0x44')]){_0x33d46c[_0x2edc('0x4b')]=[{'all':!![]}];}return db[_0x2edc('0x64')][_0x2edc('0x45')](_0x33d46c);})[_0x2edc('0x21')](function(_0x4ba67c){_0x234fcb['rows']=_0x4ba67c;return _0x234fcb;});}})['then'](respondWithFilteredResult(_0x17214c,_0x33d46c))[_0x2edc('0x47')](handleError(_0x17214c,null));};exports['getTeams']=function(_0x761185,_0x176558,_0x3e8c23){var _0x3fa701={};var _0x11bfc4={};var _0x580004;var _0x1fa8d3;return db['VoiceQueue'][_0x2edc('0x5d')]({'where':{'id':_0x761185['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x176558,null))[_0x2edc('0x21')](function(_0x14d464){if(_0x14d464){_0x580004=_0x14d464;_0x11bfc4[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x65')][_0x2edc('0x35')]);_0x11bfc4[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x761185[_0x2edc('0x37')]);_0x11bfc4[_0x2edc('0x39')]=_['intersection'](_0x11bfc4[_0x2edc('0x36')],_0x11bfc4['query']);_0x3fa701['attributes']=_['intersection'](_0x11bfc4[_0x2edc('0x36')],qs['fields'](_0x761185[_0x2edc('0x37')]['fields']));_0x3fa701[_0x2edc('0x3b')]=_0x3fa701[_0x2edc('0x3b')]['length']?_0x3fa701[_0x2edc('0x3b')]:_0x11bfc4[_0x2edc('0x36')];_0x3fa701[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x761185[_0x2edc('0x37')]['sort']);_0x3fa701[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_['pick'](_0x761185[_0x2edc('0x37')],_0x11bfc4[_0x2edc('0x39')]));if(_0x761185[_0x2edc('0x37')][_0x2edc('0x26')]){_0x3fa701[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x3fa701[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x3fa701[_0x2edc('0x3b')],function(_0x44d43a){var _0x1d7771={};_0x1d7771[_0x44d43a]={'$like':'%'+_0x761185[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x1d7771;})});}_0x3fa701=_[_0x2edc('0x4c')]({},_0x3fa701,_0x761185[_0x2edc('0x56')]);return _0x580004['getTeams'](_0x3fa701);}})[_0x2edc('0x21')](function(_0x263684){if(_0x263684){_0x1fa8d3=_0x263684[_0x2edc('0x4a')];if(!_0x761185[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x3fa701[_0x2edc('0x1b')]=qs['limit'](_0x761185[_0x2edc('0x37')]['limit']);_0x3fa701[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x761185[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0x580004['getTeams'](_0x3fa701);}})[_0x2edc('0x21')](function(_0x2c0987){if(_0x2c0987){return _0x2c0987?{'count':_0x1fa8d3,'rows':_0x2c0987}:null;}})[_0x2edc('0x21')](respondWithResult(_0x176558,null))[_0x2edc('0x47')](handleError(_0x176558,null));};exports[_0x2edc('0x66')]=function(_0x535b64,_0x42b8ce,_0x48515b){var _0x3ccd5a=_0x535b64[_0x2edc('0x5a')]['teams'];var _0x19f879=_['map'](_0x3ccd5a,'id');return db['Team']['findAll']({'where':{'id':_0x19f879},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2edc('0x67'),'attributes':['id','name',_0x2edc('0x68'),_0x2edc('0x69'),_0x2edc('0x6a')],'raw':!![]}]})['then'](function(_0x515440){if(_0x515440){var _0x21c580=_['flatMap'](_0x515440,function(_0x254eff){var _0x188446=_0x254eff[_0x2edc('0x22')]({'plain':!![]});_0x188446[_0x2edc('0x67')][_0x2edc('0x6b')](function(_0x3361c9){_0x3361c9[_0x2edc('0x6c')]=_[_0x2edc('0x2c')](_0x3ccd5a,{'id':_0x188446['id']})[_0x2edc('0x6c')];});return _0x188446[_0x2edc('0x67')];});return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x535b64[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](function(_0x29679c){return db[_0x2edc('0x6d')][_0x2edc('0x6e')](function(_0x2f170d){return _0x29679c[_0x2edc('0x66')](_0x19f879,{'transaction':_0x2f170d})['then'](function(){return BPromise[_0x2edc('0x6f')](_0x21c580,function(_0x36791f){return db[_0x2edc('0x70')][_0x2edc('0x71')]({'where':{'UserId':_0x36791f['id'],'VoiceQueueId':_0x535b64['params']['id']},'defaults':{'penalty':_0x36791f[_0x2edc('0x6c')]},'transaction':_0x2f170d});});})[_0x2edc('0x21')](function(){return BPromise['each'](_[_0x2edc('0x26')](_0x21c580,{'online':!![]}),function(_0x218755){return db[_0x2edc('0x72')][_0x2edc('0x73')]({'membername':_0x218755[_0x2edc('0x2d')],'UserId':_0x218755['id'],'queue_name':_0x29679c[_0x2edc('0x2d')],'VoiceQueueId':_0x29679c['id'],'interface':_[_0x2edc('0x74')](_0x218755[_0x2edc('0x6a')])?util[_0x2edc('0x75')](_0x2edc('0x76'),_0x218755[_0x2edc('0x2d')]):_0x218755[_0x2edc('0x6a')],'paused':_0x218755[_0x2edc('0x69')]||![],'penalty':_0x218755[_0x2edc('0x6c')]},{'transaction':_0x2f170d});});})[_0x2edc('0x21')](function(){_0x21c580[_0x2edc('0x6b')](function(_0xccbc22){socket[_0x2edc('0x77')](_0x2edc('0x78'),{'UserId':_0xccbc22['id'],'VoiceQueueId':_0x29679c['id']});});});});});}})[_0x2edc('0x21')](respondWithStatusCode(_0x42b8ce,null))[_0x2edc('0x47')](handleError(_0x42b8ce,null));};exports[_0x2edc('0x79')]=function(_0x146eb6,_0x38ee65,_0x5bb2ab){return db[_0x2edc('0x65')][_0x2edc('0x45')]({'where':{'id':_0x146eb6[_0x2edc('0x37')][_0x2edc('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x2edc('0x7b')],'as':_0x2edc('0x67'),'attributes':['id'],'raw':!![]}]})[_0x2edc('0x21')](handleEntityNotFound(_0x38ee65,null))[_0x2edc('0x21')](function(_0x1da53a){var _0x4b95d2=_['map'](_0x1da53a,'id');var _0x1a4659=[];var _0x3e4e52=[];var _0x1d2697=squel[_0x2edc('0x7c')]();_0x1d2697[_0x2edc('0x7d')]('tq.TeamId')[_0x2edc('0x7e')](_0x2edc('0x7f'),'tq')[_0x2edc('0x80')](_0x2edc('0x81'),'ut',_0x2edc('0x82'))[_0x2edc('0x41')](_0x2edc('0x83'),_0x146eb6[_0x2edc('0x49')]['id']);for(var _0x143753=0x0;_0x143753<_0x1da53a[_0x2edc('0x4a')];_0x143753+=0x1){let _0x3a2499=_0x1da53a[_0x143753];for(var _0x28fe86=0x0;_0x28fe86<_0x3a2499[_0x2edc('0x67')][_0x2edc('0x4a')];_0x28fe86+=0x1){let _0x1eb9a0=_0x3a2499['Agents'][_0x28fe86];var _0xd29737=_0x1d2697['clone']();_0xd29737[_0x2edc('0x41')](_0x2edc('0x84'),_0x1eb9a0['id']);_0x3e4e52['push'](db[_0x2edc('0x6d')][_0x2edc('0x37')](_0xd29737[_0x2edc('0x85')](),{'type':db[_0x2edc('0x6d')]['QueryTypes'][_0x2edc('0x86')]})[_0x2edc('0x21')](function(_0x1b2490){if(_0x1b2490[_0x2edc('0x4a')]===0x1){return _0x1eb9a0['id'];}else{var _0x190172=_[_0x2edc('0x87')](_[_0x2edc('0x28')](_0x1b2490,_0x2edc('0x88')),function(_0x2ee928){return _[_0x2edc('0x2a')](_0x4b95d2,_0x2ee928);});if(_0x190172){return _0x1eb9a0['id'];}}}));}}return BPromise[_0x2edc('0x89')](_0x3e4e52)[_0x2edc('0x21')](function(_0x293162){_0x1a4659=_(_0x1a4659)[_0x2edc('0x8a')](_0x293162)['compact']()['value']();return db['VoiceQueue'][_0x2edc('0x2c')]({'where':{'id':_0x146eb6['params']['id']}})[_0x2edc('0x21')](function(_0x5d7a06){return db[_0x2edc('0x6d')][_0x2edc('0x6e')](function(_0x24e82a){return _0x5d7a06['removeTeams'](_0x146eb6[_0x2edc('0x37')][_0x2edc('0x7a')],{'transaction':_0x24e82a})['then'](function(){if(!_['isEmpty'](_0x1a4659)){return _0x5d7a06[_0x2edc('0x8b')](_0x1a4659,{'transaction':_0x24e82a})[_0x2edc('0x21')](function(){return db[_0x2edc('0x72')]['destroy']({'where':{'VoiceQueueId':_0x146eb6[_0x2edc('0x49')]['id'],'UserId':_0x1a4659},'transaction':_0x24e82a});});}})[_0x2edc('0x21')](function(){_0x1a4659[_0x2edc('0x6b')](function(_0x3e0a28){socket[_0x2edc('0x77')](_0x2edc('0x8c'),{'UserId':_0x3e0a28,'VoiceQueueId':_0x5d7a06['id']});});});});});});})[_0x2edc('0x21')](respondWithStatusCode(_0x38ee65,null))[_0x2edc('0x47')](handleError(_0x38ee65,null));};exports['addAgents']=function(_0x49f49b,_0x132b0e,_0x141409){var _0x10b441,_0x3ce075;return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x49f49b['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x132b0e,null))[_0x2edc('0x21')](function(_0x5595ed){if(_0x5595ed){_0x3ce075=_0x5595ed;return _0x5595ed[_0x2edc('0x8d')](_0x49f49b[_0x2edc('0x5a')]['ids'],_[_0x2edc('0x57')](_0x49f49b['body'],[_0x2edc('0x7a'),'id'])||{})[_0x2edc('0x8e')](function(_0x3ea4c5){for(var _0x2bcc9e=0x0;_0x2bcc9e<_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x7a')][_0x2edc('0x4a')];_0x2bcc9e+=0x1){socket[_0x2edc('0x77')](_0x2edc('0x78'),{'UserId':_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x7a')][_0x2bcc9e],'VoiceQueueId':_0x49f49b[_0x2edc('0x49')]['id']});}return _0x3ea4c5;});}})['then'](function(_0x24dbd6){_0x10b441=_0x24dbd6||[];if(_0x3ce075){return db[_0x2edc('0x7b')]['findAll']({'where':{'id':_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x7a')]},'attributes':['id',_0x2edc('0x2d'),_0x2edc('0x68'),'voicePause',_0x2edc('0x6a')],'raw':!![]});}})[_0x2edc('0x21')](function(_0x4d169d){if(!_[_0x2edc('0x8f')](_0x4d169d)){var _0x70e2e=[];for(var _0x2e9f87=0x0;_0x2e9f87<_0x4d169d[_0x2edc('0x4a')];_0x2e9f87++){if(_0x4d169d[_0x2e9f87][_0x2edc('0x68')]){_0x70e2e[_0x2edc('0x90')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4d169d[_0x2e9f87]['name'],'UserId':_0x4d169d[_0x2e9f87]['id'],'queue_name':_0x3ce075[_0x2edc('0x2d')],'VoiceQueueId':_0x3ce075['id'],'interface':_[_0x2edc('0x74')](_0x4d169d[_0x2e9f87][_0x2edc('0x6a')])?util[_0x2edc('0x75')](_0x2edc('0x76'),_0x4d169d[_0x2e9f87][_0x2edc('0x2d')]):_0x4d169d[_0x2e9f87][_0x2edc('0x6a')],'paused':_0x4d169d[_0x2e9f87][_0x2edc('0x69')]||![],'penalty':_0x49f49b[_0x2edc('0x5a')][_0x2edc('0x6c')]||0x0}));}}return BPromise[_0x2edc('0x89')](_0x70e2e);}})[_0x2edc('0x21')](function(){return _0x10b441;})[_0x2edc('0x21')](respondWithResult(_0x132b0e,null))[_0x2edc('0x47')](handleError(_0x132b0e,null));};exports[_0x2edc('0x8b')]=function(_0x1666c2,_0x2f5eb2,_0xb10c0f){return db['VoiceQueue'][_0x2edc('0x2c')]({'where':{'id':_0x1666c2['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x2f5eb2,null))[_0x2edc('0x21')](function(_0x9bcca1){if(_0x9bcca1){return _0x9bcca1[_0x2edc('0x8b')](_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')])['then'](function(){if(_[_0x2edc('0x91')](_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')])){for(var _0x4dbf1d=0x0;_0x4dbf1d<_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')]['length'];_0x4dbf1d+=0x1){socket[_0x2edc('0x77')](_0x2edc('0x8c'),{'UserId':Number(_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')][_0x4dbf1d]),'VoiceQueueId':Number(_0x1666c2[_0x2edc('0x49')]['id'])});}}else{socket[_0x2edc('0x77')](_0x2edc('0x8c'),{'UserId':Number(_0x1666c2[_0x2edc('0x37')]['ids']),'VoiceQueueId':Number(_0x1666c2[_0x2edc('0x49')]['id'])});}});}})[_0x2edc('0x21')](function(_0x2a3988){return db[_0x2edc('0x72')][_0x2edc('0x92')]({'where':{'VoiceQueueId':_0x1666c2[_0x2edc('0x49')]['id'],'UserId':_0x1666c2[_0x2edc('0x37')][_0x2edc('0x7a')]}})[_0x2edc('0x21')](function(){return _0x2a3988;});})[_0x2edc('0x21')](respondWithStatusCode(_0x2f5eb2,null))[_0x2edc('0x47')](handleError(_0x2f5eb2,null));};exports[_0x2edc('0x93')]=function(_0x3449de,_0x2cc649,_0x26f857){var _0x2523c9={};var _0x493eb1={};var _0xd28d33;var _0x59612a;return db['VoiceQueue']['findOne']({'where':{'id':_0x3449de[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cc649,null))[_0x2edc('0x21')](function(_0x1309ad){if(_0x1309ad){_0xd28d33=_0x1309ad;_0x493eb1[_0x2edc('0x36')]=_[_0x2edc('0x38')](db['User'][_0x2edc('0x35')]);_0x493eb1[_0x2edc('0x37')]=_['keys'](_0x3449de['query']);_0x493eb1[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x493eb1[_0x2edc('0x36')],_0x493eb1[_0x2edc('0x37')]);_0x2523c9[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x493eb1[_0x2edc('0x36')],qs['fields'](_0x3449de[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x2523c9['attributes']=_0x2523c9[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x2523c9[_0x2edc('0x3b')]:_0x493eb1['model'];_0x2523c9[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x3449de[_0x2edc('0x37')][_0x2edc('0x40')]);_0x2523c9[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x3449de[_0x2edc('0x37')],_0x493eb1[_0x2edc('0x39')]));if(_0x3449de['query'][_0x2edc('0x26')]){_0x2523c9[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x2523c9[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x2523c9[_0x2edc('0x3b')],function(_0x59aab3){var _0x3325ac={};_0x3325ac[_0x59aab3]={'$like':'%'+_0x3449de[_0x2edc('0x37')]['filter']+'%'};return _0x3325ac;})});}_0x2523c9=_[_0x2edc('0x4c')]({},_0x2523c9,_0x3449de['options']);return _0xd28d33[_0x2edc('0x93')](_0x2523c9);}})[_0x2edc('0x21')](function(_0x34d8dc){if(_0x34d8dc){_0x59612a=_0x34d8dc[_0x2edc('0x4a')];if(!_0x3449de[_0x2edc('0x37')]['hasOwnProperty'](_0x2edc('0x3e'))){_0x2523c9[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x3449de['query'][_0x2edc('0x1b')]);_0x2523c9[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x3449de[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0xd28d33[_0x2edc('0x93')](_0x2523c9);}})[_0x2edc('0x21')](function(_0x4fa2e0){if(_0x4fa2e0){return _0x4fa2e0?{'count':_0x59612a,'rows':_0x4fa2e0}:null;}})[_0x2edc('0x21')](respondWithResult(_0x2cc649,null))['catch'](handleError(_0x2cc649,null));};exports[_0x2edc('0x94')]=function(_0x1e6b06,_0x119c33,_0x4f6d07){var _0x45b7c0={};var _0x12f597={};var _0x38f6b;var _0x18260a;return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x1e6b06['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x119c33,null))[_0x2edc('0x21')](function(_0x9b146e){if(_0x9b146e){_0x38f6b=_0x9b146e;_0x12f597[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x72')][_0x2edc('0x35')]);_0x12f597[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0x1e6b06[_0x2edc('0x37')]);_0x12f597[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x12f597[_0x2edc('0x36')],_0x12f597[_0x2edc('0x37')]);_0x45b7c0[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x12f597[_0x2edc('0x36')],qs['fields'](_0x1e6b06[_0x2edc('0x37')]['fields']));_0x45b7c0[_0x2edc('0x3b')]=_0x45b7c0[_0x2edc('0x3b')][_0x2edc('0x4a')]?_0x45b7c0[_0x2edc('0x3b')]:_0x12f597[_0x2edc('0x36')];_0x45b7c0[_0x2edc('0x3f')]=qs['sort'](_0x1e6b06['query'][_0x2edc('0x40')]);_0x45b7c0[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0x1e6b06[_0x2edc('0x37')],_0x12f597[_0x2edc('0x39')]));if(_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x26')]){_0x45b7c0[_0x2edc('0x41')]=_[_0x2edc('0x4c')](_0x45b7c0['where'],{'$or':_[_0x2edc('0x28')](_0x45b7c0['attributes'],function(_0x28a2f6){var _0x41b684={};_0x41b684[_0x28a2f6]={'$like':'%'+_0x1e6b06[_0x2edc('0x37')]['filter']+'%'};return _0x41b684;})});}_0x45b7c0=_[_0x2edc('0x4c')]({},_0x45b7c0,_0x1e6b06[_0x2edc('0x56')]);return _0x38f6b[_0x2edc('0x94')](_0x45b7c0);}})['then'](function(_0x4e62f6){if(_0x4e62f6){_0x18260a=_0x4e62f6['length'];if(!_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x45b7c0[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x1b')]);_0x45b7c0[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x1e6b06[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0x38f6b[_0x2edc('0x94')](_0x45b7c0);}})[_0x2edc('0x21')](function(_0x176541){return _0x176541?{'count':_0x18260a,'rows':_0x176541}:null;})['then'](respondWithResult(_0x119c33,null))[_0x2edc('0x47')](handleError(_0x119c33,null));};exports[_0x2edc('0x95')]=function(_0xfd234a,_0x522290,_0x5d23f1){var _0x16ba5b={};var _0x535cee={};var _0x559ca0;var _0x1d6bb2;return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0xfd234a[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x522290,null))['then'](function(_0xbf628f){if(_0xbf628f){_0x559ca0=_0xbf628f;_0x535cee['model']=_[_0x2edc('0x38')](db[_0x2edc('0x96')][_0x2edc('0x35')]);_0x535cee[_0x2edc('0x37')]=_[_0x2edc('0x38')](_0xfd234a[_0x2edc('0x37')]);_0x535cee[_0x2edc('0x39')]=_['intersection'](_0x535cee[_0x2edc('0x36')],_0x535cee[_0x2edc('0x37')]);_0x16ba5b[_0x2edc('0x3b')]=_['intersection'](_0x535cee[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0xfd234a[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x16ba5b['attributes']=_0x16ba5b['attributes']['length']?_0x16ba5b[_0x2edc('0x3b')]:_0x535cee[_0x2edc('0x36')];_0x16ba5b[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0xfd234a[_0x2edc('0x37')][_0x2edc('0x40')]);_0x16ba5b[_0x2edc('0x41')]=qs[_0x2edc('0x39')](_[_0x2edc('0x42')](_0xfd234a[_0x2edc('0x37')],_0x535cee[_0x2edc('0x39')]));if(_0xfd234a[_0x2edc('0x37')][_0x2edc('0x26')]){_0x16ba5b['where']=_[_0x2edc('0x4c')](_0x16ba5b[_0x2edc('0x41')],{'$or':_['map'](_0x16ba5b[_0x2edc('0x3b')],function(_0x19c753){var _0x3f785c={};_0x3f785c[_0x19c753]={'$like':'%'+_0xfd234a[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x3f785c;})});}_0x16ba5b=_[_0x2edc('0x4c')]({},_0x16ba5b,_0xfd234a[_0x2edc('0x56')]);return _0x559ca0[_0x2edc('0x95')](_0x16ba5b);}})[_0x2edc('0x21')](function(_0x256bbe){if(_0x256bbe){_0x1d6bb2=_0x256bbe[_0x2edc('0x4a')];if(!_0xfd234a[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x16ba5b[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0xfd234a['query'][_0x2edc('0x1b')]);_0x16ba5b['offset']=qs['offset'](_0xfd234a['query'][_0x2edc('0x1a')]);}return _0x559ca0[_0x2edc('0x95')](_0x16ba5b);}})[_0x2edc('0x21')](function(_0x3cf092){if(_0x3cf092){return _0x3cf092?{'count':_0x1d6bb2,'rows':_0x3cf092}:null;}})['then'](respondWithResult(_0x522290,null))[_0x2edc('0x47')](handleError(_0x522290,null));};exports[_0x2edc('0x97')]=function(_0x2919fd,_0x319968,_0x3319ef){var _0x1a5b62,_0x44b148;return db[_0x2edc('0x34')]['find']({'where':{'id':_0x2919fd[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x319968,null))['then'](function(_0xc62cb0){if(_0xc62cb0){_0x44b148=_0xc62cb0;return _0xc62cb0[_0x2edc('0x97')](_0x2919fd[_0x2edc('0x5a')][_0x2edc('0x7a')],_[_0x2edc('0x57')](_0x2919fd[_0x2edc('0x5a')],[_0x2edc('0x7a'),'id'])||{});}return null;})[_0x2edc('0x8e')](function(_0x504bbb){var _0x2763c4;_0x1a5b62=_0x504bbb||[];var _0x356681=[];if(_0x504bbb){for(var _0x599ed7=0x0;_0x599ed7<_0x504bbb[_0x2edc('0x4a')];_0x599ed7+=0x1){var _0x37e9d2=_0x504bbb[_0x599ed7]['get']({'plain':!![]});_0x44b148[_0x2edc('0x98')]=_0x2919fd['body'][_0x2edc('0x98')]?_0x2919fd[_0x2edc('0x5a')][_0x2edc('0x98')]:_0x44b148[_0x2edc('0x98')];switch(_0x44b148[_0x2edc('0x98')]){case'always':_0x2763c4=squel['insert']()[_0x2edc('0x99')](_0x2edc('0x9a'))['fromQuery']([_0x2edc('0x9b'),_0x2edc('0x9c'),'ContactId',_0x2edc('0x9d'),_0x2edc('0x61'),_0x2edc('0x58'),_0x2edc('0x59')],squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')]('phone',_0x2edc('0x9b'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x9c'))['field']('id',_0x2edc('0x9f'))[_0x2edc('0x7d')](_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')](),'ListId')['field'](_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),_0x2edc('0x61'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x58'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x59'))[_0x2edc('0x7e')](_0x2edc('0xa1'))[_0x2edc('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0x2edc('0xa2'),_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')]())[_0x2edc('0x41')](_0x2edc('0xa3'))[_0x2edc('0x41')](_0x2edc('0xa4'),squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0xa5'))[_0x2edc('0x7e')](_0x2edc('0xa6'))[_0x2edc('0x41')](_0x2edc('0x83'),_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')]()))[_0x2edc('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2edc('0x7c')]()['field'](_0x2edc('0xa7'))[_0x2edc('0x7e')](_0x2edc('0x9a'))['where'](_0x2edc('0x83'),_0x2919fd['params']['id'][_0x2edc('0x85')]())))[_0x2edc('0x85')]();break;case _0x2edc('0xa8'):_0x2763c4=squel[_0x2edc('0xa9')]()[_0x2edc('0x99')](_0x2edc('0x9a'))[_0x2edc('0xaa')](['phone','scheduledAt',_0x2edc('0x9f'),_0x2edc('0x9d'),'VoiceQueueId',_0x2edc('0x58'),_0x2edc('0x59')],squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0x9b'),_0x2edc('0x9b'))['field']('NOW()',_0x2edc('0x9c'))['field']('id',_0x2edc('0x9f'))[_0x2edc('0x7d')](_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')](),_0x2edc('0x9d'))[_0x2edc('0x7d')](_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),_0x2edc('0x61'))[_0x2edc('0x7d')]('NOW()','createdAt')[_0x2edc('0x7d')](_0x2edc('0x9e'),'updatedAt')[_0x2edc('0x7e')]('cm_contacts')[_0x2edc('0x41')](_0x2edc('0xab'))[_0x2edc('0x41')](_0x2edc('0xa2'),_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')]())['where'](_0x2edc('0xa3'))['where'](_0x2edc('0xa4'),squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0xa7'))['from']('cm_hopper')[_0x2edc('0x41')]('VoiceQueueId\x20=\x20?',_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')]())))['toString']();break;default:_0x2763c4=squel['insert']()[_0x2edc('0x99')](_0x2edc('0x9a'))[_0x2edc('0xaa')]([_0x2edc('0x9b'),_0x2edc('0x9c'),'ContactId',_0x2edc('0x9d'),_0x2edc('0x61'),_0x2edc('0x58'),_0x2edc('0x59')],squel[_0x2edc('0x7c')]()[_0x2edc('0x7d')](_0x2edc('0x9b'),_0x2edc('0x9b'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x9c'))[_0x2edc('0x7d')]('id','ContactId')['field'](_0x37e9d2[_0x2edc('0xa0')][_0x2edc('0x85')](),_0x2edc('0x9d'))[_0x2edc('0x7d')](_0x2919fd[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),_0x2edc('0x61'))[_0x2edc('0x7d')](_0x2edc('0x9e'),_0x2edc('0x58'))['field'](_0x2edc('0x9e'),_0x2edc('0x59'))[_0x2edc('0x7e')](_0x2edc('0xa1'))['where']('deletedAt\x20IS\x20NULL')[_0x2edc('0x41')](_0x2edc('0xa2'),_0x37e9d2[_0x2edc('0xa0')]['toString']())[_0x2edc('0x41')](_0x2edc('0xa3')))['toString']();}_0x356681['push'](db['sequelize'][_0x2edc('0x37')](_0x2763c4));}return BPromise[_0x2edc('0x89')](_0x356681);}})[_0x2edc('0x21')](function(){return _0x1a5b62;})[_0x2edc('0x21')](respondWithResult(_0x319968,null))[_0x2edc('0x47')](handleError(_0x319968,null));};exports[_0x2edc('0xac')]=function(_0x23bfae,_0x2bfb74,_0x12ad23){return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x23bfae[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x2bfb74,null))[_0x2edc('0x21')](function(_0x5cac54){if(_0x5cac54){return _0x5cac54[_0x2edc('0xac')](_0x23bfae[_0x2edc('0x37')][_0x2edc('0x7a')]);}})[_0x2edc('0x21')](function(_0x2dc814){if(_0x2dc814){return db[_0x2edc('0x5e')][_0x2edc('0x92')]({'where':{'ListId':_0x23bfae[_0x2edc('0x37')][_0x2edc('0x7a')],'VoiceQueueId':_0x23bfae[_0x2edc('0x49')]['id']}})['then'](function(){return _0x2dc814;});}})[_0x2edc('0x21')](respondWithStatusCode(_0x2bfb74,null))[_0x2edc('0x47')](handleError(_0x2bfb74,null));};exports[_0x2edc('0xad')]=function(_0x8d886a,_0x2e7f78,_0x24be80){var _0x37322b={};var _0x4b2fe5={};var _0x143900;var _0x17fdc9;return db[_0x2edc('0x34')][_0x2edc('0x5d')]({'where':{'id':_0x8d886a['params']['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x2e7f78,null))[_0x2edc('0x21')](function(_0x587a60){if(_0x587a60){_0x143900=_0x587a60;_0x4b2fe5[_0x2edc('0x36')]=_[_0x2edc('0x38')](db[_0x2edc('0x96')][_0x2edc('0x35')]);_0x4b2fe5[_0x2edc('0x37')]=_['keys'](_0x8d886a[_0x2edc('0x37')]);_0x4b2fe5[_0x2edc('0x39')]=_[_0x2edc('0x3a')](_0x4b2fe5[_0x2edc('0x36')],_0x4b2fe5[_0x2edc('0x37')]);_0x37322b[_0x2edc('0x3b')]=_[_0x2edc('0x3a')](_0x4b2fe5[_0x2edc('0x36')],qs[_0x2edc('0x3c')](_0x8d886a[_0x2edc('0x37')][_0x2edc('0x3c')]));_0x37322b[_0x2edc('0x3b')]=_0x37322b['attributes'][_0x2edc('0x4a')]?_0x37322b[_0x2edc('0x3b')]:_0x4b2fe5[_0x2edc('0x36')];_0x37322b[_0x2edc('0x3f')]=qs[_0x2edc('0x40')](_0x8d886a['query'][_0x2edc('0x40')]);_0x37322b['where']=qs[_0x2edc('0x39')](_['pick'](_0x8d886a[_0x2edc('0x37')],_0x4b2fe5[_0x2edc('0x39')]));if(_0x8d886a['query']['filter']){_0x37322b[_0x2edc('0x41')]=_['merge'](_0x37322b[_0x2edc('0x41')],{'$or':_[_0x2edc('0x28')](_0x37322b[_0x2edc('0x3b')],function(_0x1d2fdd){var _0x23c370={};_0x23c370[_0x1d2fdd]={'$like':'%'+_0x8d886a[_0x2edc('0x37')][_0x2edc('0x26')]+'%'};return _0x23c370;})});}_0x37322b=_[_0x2edc('0x4c')]({},_0x37322b,_0x8d886a[_0x2edc('0x56')]);return _0x143900[_0x2edc('0xad')](_0x37322b);}})[_0x2edc('0x21')](function(_0x542e16){if(_0x542e16){_0x17fdc9=_0x542e16['length'];if(!_0x8d886a[_0x2edc('0x37')][_0x2edc('0x3d')](_0x2edc('0x3e'))){_0x37322b[_0x2edc('0x1b')]=qs[_0x2edc('0x1b')](_0x8d886a['query'][_0x2edc('0x1b')]);_0x37322b[_0x2edc('0x1a')]=qs[_0x2edc('0x1a')](_0x8d886a[_0x2edc('0x37')][_0x2edc('0x1a')]);}return _0x143900[_0x2edc('0xad')](_0x37322b);}})[_0x2edc('0x21')](function(_0x323b26){if(_0x323b26){return _0x323b26?{'count':_0x17fdc9,'rows':_0x323b26}:null;}})[_0x2edc('0x21')](respondWithResult(_0x2e7f78,null))[_0x2edc('0x47')](handleError(_0x2e7f78,null));};exports[_0x2edc('0xae')]=function(_0x42efef,_0x535bc2,_0x4e470d){var _0x32d50c,_0x36ecfb;return db[_0x2edc('0x34')][_0x2edc('0x2c')]({'where':{'id':_0x42efef[_0x2edc('0x49')]['id']}})['then'](handleEntityNotFound(_0x535bc2,null))[_0x2edc('0x21')](function(_0x4105ae){if(_0x4105ae){_0x36ecfb=_0x4105ae;return _0x4105ae[_0x2edc('0xae')](_0x42efef[_0x2edc('0x5a')][_0x2edc('0x7a')],_['omit'](_0x42efef[_0x2edc('0x5a')],[_0x2edc('0x7a'),'id'])||{});}return null;})[_0x2edc('0x8e')](function(_0x114ec8){var _0x3c52da;_0x32d50c=_0x114ec8||[];var _0x27f48f=[];if(_0x114ec8){for(var _0xe56038=0x0;_0xe56038<_0x114ec8[_0x2edc('0x4a')];_0xe56038+=0x1){var _0x5c2eb9=_0x114ec8[_0xe56038][_0x2edc('0x22')]({'plain':!![]});_0x3c52da=squel[_0x2edc('0xa9')]()[_0x2edc('0x99')]('cm_hopper_black')[_0x2edc('0xaa')]([_0x2edc('0x9b'),_0x2edc('0x9f'),_0x2edc('0x9d'),_0x2edc('0x61'),'createdAt','updatedAt'],squel[_0x2edc('0x7c')]()['field']('phone',_0x2edc('0x9b'))[_0x2edc('0x7d')]('id','ContactId')[_0x2edc('0x7d')](_0x5c2eb9[_0x2edc('0xa0')][_0x2edc('0x85')](),_0x2edc('0x9d'))[_0x2edc('0x7d')](_0x42efef[_0x2edc('0x49')]['id'][_0x2edc('0x85')](),'VoiceQueueId')['field'](_0x2edc('0x9e'),_0x2edc('0x58'))[_0x2edc('0x7d')]('NOW()',_0x2edc('0x59'))[_0x2edc('0x7e')]('cm_contacts')[_0x2edc('0x41')]('deletedAt\x20IS\x20NULL')[_0x2edc('0x41')](_0x2edc('0xa2'),_0x5c2eb9[_0x2edc('0xa0')][_0x2edc('0x85')]())['where'](_0x2edc('0xa3')))[_0x2edc('0x85')]();_0x27f48f[_0x2edc('0x90')](db[_0x2edc('0x6d')][_0x2edc('0x37')](_0x3c52da));}return BPromise[_0x2edc('0x89')](_0x27f48f);}})['then'](function(){return _0x32d50c;})[_0x2edc('0x21')](respondWithResult(_0x535bc2,null))[_0x2edc('0x47')](handleError(_0x535bc2,null));};exports[_0x2edc('0xaf')]=function(_0x2f2c54,_0x599742,_0x56d652){return db['VoiceQueue'][_0x2edc('0x2c')]({'where':{'id':_0x2f2c54[_0x2edc('0x49')]['id']}})[_0x2edc('0x21')](handleEntityNotFound(_0x599742,null))[_0x2edc('0x21')](function(_0x541cc1){if(_0x541cc1){return _0x541cc1[_0x2edc('0xaf')](_0x2f2c54[_0x2edc('0x37')][_0x2edc('0x7a')]);}})['then'](function(_0xa5ccd6){if(_0xa5ccd6){return db[_0x2edc('0x64')]['destroy']({'where':{'ListId':_0x2f2c54[_0x2edc('0x37')][_0x2edc('0x7a')],'VoiceQueueId':_0x2f2c54['params']['id']}})[_0x2edc('0x21')](function(){return _0xa5ccd6;});}})['then'](respondWithStatusCode(_0x599742,null))[_0x2edc('0x47')](handleError(_0x599742,null));}; \ No newline at end of file +var _0x28b1=['isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','ids','spread','userVoiceQueue:save','SIP/%s','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','field','NOW()','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CmListId','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','value','includes','type','find','UserProfileResource','sendStatus','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','options','includeAll','include','findAll','rows','catch','show','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','order','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','addTeams','each','UserVoiceQueueRt','upsert','isNil','format','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','compact','removeTeams'];(function(_0x6373ae,_0x58b42e){var _0x1ba442=function(_0x412261){while(--_0x412261){_0x6373ae['push'](_0x6373ae['shift']());}};_0x1ba442(++_0x58b42e);}(_0x28b1,0x19a));var _0x128b=function(_0x19ce74,_0xe23ac0){_0x19ce74=_0x19ce74-0x0;var _0x1c465d=_0x28b1[_0x19ce74];return _0x1c465d;};'use strict';var pdf=require(_0x128b('0x0'));var emlformat=require(_0x128b('0x1'));var rimraf=require(_0x128b('0x2'));var zipdir=require(_0x128b('0x3'));var jsonpatch=require(_0x128b('0x4'));var rp=require('request-promise');var moment=require(_0x128b('0x5'));var BPromise=require(_0x128b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x128b('0x7'));var sox=require('sox');var csv=require(_0x128b('0x8'));var ejs=require(_0x128b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x128b('0xa'));var crypto=require(_0x128b('0xb'));var jsforce=require(_0x128b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x128b('0x8'));var querystring=require(_0x128b('0xd'));var Papa=require(_0x128b('0xe'));var Redis=require(_0x128b('0xf'));var authService=require(_0x128b('0x10'));var qs=require(_0x128b('0x11'));var as=require(_0x128b('0x12'));var hardwareService=require(_0x128b('0x13'));var logger=require(_0x128b('0x14'))(_0x128b('0x15'));var utils=require('../../config/utils');var config=require(_0x128b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x128b('0x17'))['db'];config[_0x128b('0x18')]=_[_0x128b('0x19')](config[_0x128b('0x18')],{'host':_0x128b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x128b('0x18')]));require(_0x128b('0x1b'))['register'](socket);function respondWithStatusCode(_0xc3e541,_0x2537f8){_0x2537f8=_0x2537f8||0xcc;return function(_0x175b61){if(_0x175b61){return _0xc3e541['sendStatus'](_0x2537f8);}return _0xc3e541[_0x128b('0x1c')](_0x2537f8)[_0x128b('0x1d')]();};}function respondWithResult(_0x449a7b,_0x1b8fd7){_0x1b8fd7=_0x1b8fd7||0xc8;return function(_0x51084f){if(_0x51084f){return _0x449a7b[_0x128b('0x1c')](_0x1b8fd7)[_0x128b('0x1e')](_0x51084f);}};}function respondWithFilteredResult(_0x287baa,_0xbda825){return function(_0x2d0faf){if(_0x2d0faf){var _0x37c4a0=_0x2d0faf[_0x128b('0x1f')],_0x15ed8f=_0xbda825['offset'],_0x69636a=_0xbda825[_0x128b('0x20')]+_0xbda825[_0x128b('0x21')],_0xf95705;if(_0x69636a>=_0x37c4a0){_0x69636a=_0x37c4a0;_0xf95705=0xc8;}else{_0xf95705=0xce;}_0x287baa['status'](_0xf95705);return _0x287baa[_0x128b('0x22')]('Content-Range',_0x15ed8f+'-'+_0x69636a+'/'+_0x37c4a0)[_0x128b('0x1e')](_0x2d0faf);}return null;};}function patchUpdates(_0x9bda55){return function(_0x3e5297){try{jsonpatch['apply'](_0x3e5297,_0x9bda55,!![]);}catch(_0x455e30){return BPromise[_0x128b('0x23')](_0x455e30);}return _0x3e5297[_0x128b('0x24')]();};}function saveUpdates(_0x2b97d0,_0x10ac01){return function(_0x46700c){if(_0x46700c){return _0x46700c[_0x128b('0x25')](_0x2b97d0)[_0x128b('0x26')](function(_0x3ae990){return _0x3ae990;});}return null;};}function removeEntity(_0x5d089d,_0xbcb9e8){return function(_0x2a32e8){if(_0x2a32e8){return _0x2a32e8[_0x128b('0x27')]()[_0x128b('0x26')](function(){var _0x23e274=_0x2a32e8['get']({'plain':!![]});var _0x5c2a4a=[{'name':_0x128b('0x28'),'value':_0x128b('0x29'),'ignore':![]},{'name':_0x128b('0x2a'),'value':_0x128b('0x2b'),'ignore':![]}];var _0x277115=_(_0x5c2a4a)[_0x128b('0x2c')]('ignore')['map'](_0x128b('0x2d'))[_0x128b('0x2d')]();if(_[_0x128b('0x2e')](_0x277115,_0x23e274[_0x128b('0x2f')])){return;}var _0x8e7236=_[_0x128b('0x30')](_0x5c2a4a,['value',_0x23e274[_0x128b('0x2f')]])['name'];return db[_0x128b('0x31')][_0x128b('0x27')]({'where':{'type':_0x8e7236,'resourceId':_0x23e274['id']}})['then'](function(){return _0x2a32e8;});})[_0x128b('0x26')](function(){_0x5d089d[_0x128b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1076c9,_0x45e27f){return function(_0x145cb8){if(!_0x145cb8){_0x1076c9[_0x128b('0x32')](0x194);}return _0x145cb8;};}function handleError(_0x43ef7e,_0x32ec05){_0x32ec05=_0x32ec05||0x1f4;return function(_0xda152d){logger[_0x128b('0x33')](_0xda152d['stack']);if(_0xda152d['name']){delete _0xda152d[_0x128b('0x34')];}_0x43ef7e['status'](_0x32ec05)[_0x128b('0x35')](_0xda152d);};}exports[_0x128b('0x36')]=function(_0x265355,_0x261b60){var _0x19801b={},_0x192d8f={},_0x1b0832={'count':0x0,'rows':[]};var _0x1696aa=_['map'](db[_0x128b('0x37')][_0x128b('0x38')],function(_0x2909a9){return{'name':_0x2909a9[_0x128b('0x39')],'type':_0x2909a9['type'][_0x128b('0x3a')]};});_0x192d8f[_0x128b('0x3b')]=_[_0x128b('0x3c')](_0x1696aa,'name');_0x192d8f[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x265355[_0x128b('0x3d')]);_0x192d8f['filters']=_[_0x128b('0x3f')](_0x192d8f[_0x128b('0x3b')],_0x192d8f[_0x128b('0x3d')]);_0x19801b['attributes']=_['intersection'](_0x192d8f[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x265355[_0x128b('0x3d')]['fields']));_0x19801b[_0x128b('0x41')]=_0x19801b[_0x128b('0x41')][_0x128b('0x42')]?_0x19801b['attributes']:_0x192d8f['model'];if(!_0x265355[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x19801b['limit']=qs[_0x128b('0x21')](_0x265355[_0x128b('0x3d')]['limit']);_0x19801b[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x265355[_0x128b('0x3d')][_0x128b('0x20')]);}_0x19801b['order']=qs[_0x128b('0x45')](_0x265355[_0x128b('0x3d')]['sort']);_0x19801b[_0x128b('0x46')]=qs[_0x128b('0x47')](_['pick'](_0x265355[_0x128b('0x3d')],_0x192d8f[_0x128b('0x47')]),_0x1696aa);if(_0x265355['query'][_0x128b('0x2c')]){_0x19801b[_0x128b('0x46')]=_['merge'](_0x19801b[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x1696aa,function(_0x4d2c77){if(_0x4d2c77['type']!=='VIRTUAL'){var _0x3f0aa2={};_0x3f0aa2[_0x4d2c77[_0x128b('0x34')]]={'$like':'%'+_0x265355[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x3f0aa2;}})});}_0x19801b=_[_0x128b('0x48')]({},_0x19801b,_0x265355[_0x128b('0x49')]);var _0x5700ea={'where':_0x19801b[_0x128b('0x46')]};return db[_0x128b('0x37')]['count'](_0x5700ea)[_0x128b('0x26')](function(_0x54b82e){_0x1b0832[_0x128b('0x1f')]=_0x54b82e;if(_0x265355[_0x128b('0x3d')][_0x128b('0x4a')]){_0x19801b[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x37')][_0x128b('0x4c')](_0x19801b);})['then'](function(_0x1fa058){_0x1b0832[_0x128b('0x4d')]=_0x1fa058;return _0x1b0832;})['then'](respondWithFilteredResult(_0x261b60,_0x19801b))[_0x128b('0x4e')](handleError(_0x261b60,null));};exports[_0x128b('0x4f')]=function(_0x4f2a83,_0x32af81){var _0x4da9c0={'raw':![],'where':{'id':_0x4f2a83['params']['id']}},_0x1bc4b8={};_0x1bc4b8[_0x128b('0x3b')]=_['keys'](db[_0x128b('0x37')]['rawAttributes']);_0x1bc4b8[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x4f2a83[_0x128b('0x3d')]);_0x1bc4b8[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x1bc4b8[_0x128b('0x3b')],_0x1bc4b8[_0x128b('0x3d')]);_0x4da9c0['attributes']=_[_0x128b('0x3f')](_0x1bc4b8[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x4f2a83['query']['fields']));_0x4da9c0[_0x128b('0x41')]=_0x4da9c0[_0x128b('0x41')][_0x128b('0x42')]?_0x4da9c0[_0x128b('0x41')]:_0x1bc4b8[_0x128b('0x3b')];if(_0x4f2a83[_0x128b('0x3d')]['includeAll']){_0x4da9c0[_0x128b('0x4b')]=[{'all':!![]}];}_0x4da9c0=_[_0x128b('0x48')]({},_0x4da9c0,_0x4f2a83[_0x128b('0x49')]);return db[_0x128b('0x37')]['find'](_0x4da9c0)[_0x128b('0x26')](handleEntityNotFound(_0x32af81,null))[_0x128b('0x26')](respondWithResult(_0x32af81,null))[_0x128b('0x4e')](handleError(_0x32af81,null));};exports['create']=function(_0x55a9e4,_0x1c56ca){return db[_0x128b('0x37')][_0x128b('0x50')](_0x55a9e4[_0x128b('0x51')],{})[_0x128b('0x26')](function(_0x7789de){var _0x57fbc9=_0x55a9e4['user'][_0x128b('0x52')]({'plain':!![]});if(!_0x57fbc9)throw new Error(_0x128b('0x53'));if(_0x57fbc9[_0x128b('0x54')]==='user'){var _0x5e5a8c=_0x7789de[_0x128b('0x52')]({'plain':!![]});var _0x6f2ab8=[{'name':_0x128b('0x28'),'value':_0x128b('0x29')},{'name':_0x128b('0x2a'),'value':_0x128b('0x2b')}];var _0x5e55f4=_['find'](_0x6f2ab8,[_0x128b('0x2d'),_0x5e5a8c['type']])[_0x128b('0x34')];return db[_0x128b('0x55')]['find']({'where':{'name':_0x5e55f4,'userProfileId':_0x57fbc9[_0x128b('0x56')]},'raw':!![]})[_0x128b('0x26')](function(_0x2f6e78){if(_0x2f6e78&&_0x2f6e78[_0x128b('0x57')]===0x0){return db['UserProfileResource'][_0x128b('0x50')]({'name':_0x5e5a8c[_0x128b('0x34')],'resourceId':_0x5e5a8c['id'],'type':_0x2f6e78[_0x128b('0x34')],'sectionId':_0x2f6e78['id']},{})[_0x128b('0x26')](function(){return _0x7789de;});}else{return _0x7789de;}})[_0x128b('0x4e')](function(_0x3a06aa){logger[_0x128b('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a06aa);throw _0x3a06aa;});}return _0x7789de;})['then'](respondWithResult(_0x1c56ca,0xc9))[_0x128b('0x4e')](handleError(_0x1c56ca,null));};exports[_0x128b('0x58')]=function(_0x394512,_0x44a643){var _0xf7ae23={'where':{'id':_0x394512[_0x128b('0x59')]['id']}},_0x5a4398={};_0x5a4398[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x37')]['rawAttributes']);_0xf7ae23[_0x128b('0x41')]=_[_0x128b('0x3f')](_0x5a4398[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x394512[_0x128b('0x3d')][_0x128b('0x40')]));_0xf7ae23[_0x128b('0x41')]=_0xf7ae23[_0x128b('0x41')]['length']?_0xf7ae23[_0x128b('0x41')]:_0x5a4398[_0x128b('0x3b')];if(_0x394512[_0x128b('0x3d')]['includeAll']){_0xf7ae23[_0x128b('0x4b')]=[{'all':!![]}];}_0xf7ae23=_[_0x128b('0x48')]({},_0xf7ae23,_0x394512['options']);return db[_0x128b('0x37')][_0x128b('0x30')](_0xf7ae23)[_0x128b('0x26')](handleEntityNotFound(_0x44a643,null))[_0x128b('0x26')](function(_0x50a70e){if(_0x50a70e){var _0x11c683=_0x50a70e['get']({'plain':!![]});_0x11c683=qs[_0x128b('0x5a')](_0x11c683,['id',_0x128b('0x5b'),_0x128b('0x5c')]);_0x394512[_0x128b('0x51')]=_[_0x128b('0x5a')](_0x394512['body'],['id','createdAt',_0x128b('0x5c')]);return db[_0x128b('0x37')][_0x128b('0x50')](_[_0x128b('0x48')](_0x11c683,_0x394512[_0x128b('0x51')]),{'include':_0x394512[_0x128b('0x3d')][_0x128b('0x4a')]?[{'all':!![]}]:undefined})[_0x128b('0x26')](function(_0x8d51c7){var _0x5861ec=_0x394512[_0x128b('0x5d')]['get']({'plain':!![]});if(!_0x5861ec)throw new Error(_0x128b('0x53'));if(_0x5861ec['role']===_0x128b('0x5d')){var _0x31758a=_0x8d51c7['get']({'plain':!![]});var _0x12f993=[{'name':'VoiceQueues','value':_0x128b('0x29')},{'name':_0x128b('0x2a'),'value':_0x128b('0x2b')}];var _0x370937=_[_0x128b('0x30')](_0x12f993,['value',_0x31758a['type']])[_0x128b('0x34')];return db['UserProfileSection'][_0x128b('0x30')]({'where':{'name':_0x370937,'userProfileId':_0x5861ec[_0x128b('0x56')]},'raw':!![]})[_0x128b('0x26')](function(_0xfc05a){if(_0xfc05a&&_0xfc05a[_0x128b('0x57')]===0x0){return db[_0x128b('0x31')][_0x128b('0x50')]({'name':_0x31758a['name'],'resourceId':_0x31758a['id'],'type':_0xfc05a[_0x128b('0x34')],'sectionId':_0xfc05a['id']},{})['then'](function(){return _0x8d51c7;});}else{return _0x8d51c7;}})[_0x128b('0x4e')](function(_0x4c31dc){logger['error'](_0x128b('0x5e'),_0x4c31dc);throw _0x4c31dc;});}return _0x8d51c7;});}})[_0x128b('0x26')](respondWithResult(_0x44a643,0xc9))[_0x128b('0x4e')](handleError(_0x44a643,null));};exports['update']=function(_0x4a71c5,_0x203a25){if(_0x4a71c5['body']['id']){delete _0x4a71c5[_0x128b('0x51')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x4a71c5[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x203a25,null))[_0x128b('0x26')](saveUpdates(_0x4a71c5[_0x128b('0x51')],null))[_0x128b('0x26')](respondWithResult(_0x203a25,null))['catch'](handleError(_0x203a25,null));};exports[_0x128b('0x27')]=function(_0x32819e,_0x38fa81){return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x32819e[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x38fa81,null))[_0x128b('0x26')](removeEntity(_0x38fa81,null))[_0x128b('0x4e')](handleError(_0x38fa81,null));};exports['getHoppers']=function(_0x2eeb17,_0x5e9ed8,_0x42375d){var _0x7aef81={'raw':![],'where':{}};var _0x5e28df={};var _0x253712={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x2eeb17['params']['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x5e9ed8,null))['then'](function(_0x48d3c6){if(_0x48d3c6){_0x5e28df[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x60')]['rawAttributes']);_0x5e28df['query']=_[_0x128b('0x3e')](_0x2eeb17[_0x128b('0x3d')]);_0x5e28df['filters']=_[_0x128b('0x3f')](_0x5e28df[_0x128b('0x3b')],_0x5e28df[_0x128b('0x3d')]);_0x7aef81[_0x128b('0x41')]=_[_0x128b('0x3f')](_0x5e28df[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x2eeb17['query'][_0x128b('0x40')]));_0x7aef81[_0x128b('0x41')]=_0x7aef81['attributes'][_0x128b('0x42')]?_0x7aef81[_0x128b('0x41')]:_0x5e28df['model'];if(!_0x2eeb17[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x7aef81[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x2eeb17[_0x128b('0x3d')][_0x128b('0x21')]);_0x7aef81[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x2eeb17['query'][_0x128b('0x20')]);}_0x7aef81[_0x128b('0x61')]=qs['sort'](_0x2eeb17[_0x128b('0x3d')][_0x128b('0x45')]);_0x7aef81['where']=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x2eeb17[_0x128b('0x3d')],_0x5e28df[_0x128b('0x47')]));_0x7aef81['where'][_0x128b('0x63')]=_0x48d3c6['id'];if(_0x2eeb17[_0x128b('0x3d')][_0x128b('0x2c')]){_0x7aef81['where']=_['merge'](_0x7aef81['where'],{'$or':_['map'](_0x7aef81[_0x128b('0x41')],function(_0xdf2a61){var _0x105125={};_0x105125[_0xdf2a61]={'$like':'%'+_0x2eeb17['query'][_0x128b('0x2c')]+'%'};return _0x105125;})});}_0x7aef81=_[_0x128b('0x48')]({},_0x7aef81,_0x2eeb17[_0x128b('0x49')]);return db[_0x128b('0x60')][_0x128b('0x1f')]({'where':_0x7aef81[_0x128b('0x46')]})[_0x128b('0x26')](function(_0x5220a9){_0x253712['count']=_0x5220a9;if(_0x2eeb17[_0x128b('0x3d')][_0x128b('0x4a')]){_0x7aef81['include']=[{'all':!![]}];}return db['CmHopper'][_0x128b('0x4c')](_0x7aef81);})[_0x128b('0x26')](function(_0x12eb40){_0x253712[_0x128b('0x4d')]=_0x12eb40;return _0x253712;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x5e9ed8,_0x7aef81))[_0x128b('0x4e')](handleError(_0x5e9ed8,null));};exports[_0x128b('0x64')]=function(_0x5d52a2,_0x3ff32e,_0x4e53b3){var _0x20def5={'raw':!![],'where':{}};var _0x3b1630={};var _0x4af006={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x5d52a2[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ff32e,null))['then'](function(_0x655cb3){if(_0x655cb3){_0x3b1630[_0x128b('0x3b')]=_['keys'](db[_0x128b('0x65')]['rawAttributes']);_0x3b1630[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x5d52a2[_0x128b('0x3d')]);_0x3b1630[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x3b1630[_0x128b('0x3b')],_0x3b1630[_0x128b('0x3d')]);_0x20def5[_0x128b('0x41')]=_['intersection'](_0x3b1630[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x5d52a2['query'][_0x128b('0x40')]));_0x20def5[_0x128b('0x41')]=_0x20def5[_0x128b('0x41')][_0x128b('0x42')]?_0x20def5[_0x128b('0x41')]:_0x3b1630[_0x128b('0x3b')];if(!_0x5d52a2[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x20def5['limit']=qs[_0x128b('0x21')](_0x5d52a2[_0x128b('0x3d')]['limit']);_0x20def5[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x5d52a2['query']['offset']);}_0x20def5[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x5d52a2[_0x128b('0x3d')]['sort']);_0x20def5[_0x128b('0x46')]=qs['filters'](_[_0x128b('0x62')](_0x5d52a2[_0x128b('0x3d')],_0x3b1630[_0x128b('0x47')]));_0x20def5[_0x128b('0x46')][_0x128b('0x63')]=_0x655cb3['id'];if(_0x5d52a2[_0x128b('0x3d')][_0x128b('0x2c')]){_0x20def5[_0x128b('0x46')]=_[_0x128b('0x48')](_0x20def5[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x20def5['attributes'],function(_0xcc46f9){var _0x5b18a6={};_0x5b18a6[_0xcc46f9]={'$like':'%'+_0x5d52a2['query'][_0x128b('0x2c')]+'%'};return _0x5b18a6;})});}_0x20def5=_[_0x128b('0x48')]({},_0x20def5,_0x5d52a2[_0x128b('0x49')]);return db[_0x128b('0x65')][_0x128b('0x1f')]({'where':_0x20def5['where']})[_0x128b('0x26')](function(_0x221cf7){_0x4af006['count']=_0x221cf7;if(_0x5d52a2[_0x128b('0x3d')]['includeAll']){_0x20def5[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x65')][_0x128b('0x4c')](_0x20def5);})[_0x128b('0x26')](function(_0x19fd82){_0x4af006[_0x128b('0x4d')]=_0x19fd82;return _0x4af006;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x3ff32e,_0x20def5))['catch'](handleError(_0x3ff32e,null));};exports[_0x128b('0x66')]=function(_0xfd7a0b,_0x26cc99,_0xc6c42f){var _0x1d1b27={'raw':!![],'where':{}};var _0x5b6fa7={};var _0x21ffba={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0xfd7a0b[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x26cc99,null))[_0x128b('0x26')](function(_0x42e130){if(_0x42e130){_0x5b6fa7[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x67')][_0x128b('0x38')]);_0x5b6fa7[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0xfd7a0b[_0x128b('0x3d')]);_0x5b6fa7[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x5b6fa7[_0x128b('0x3b')],_0x5b6fa7[_0x128b('0x3d')]);_0x1d1b27['attributes']=_[_0x128b('0x3f')](_0x5b6fa7[_0x128b('0x3b')],qs[_0x128b('0x40')](_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x40')]));_0x1d1b27['attributes']=_0x1d1b27[_0x128b('0x41')][_0x128b('0x42')]?_0x1d1b27[_0x128b('0x41')]:_0x5b6fa7[_0x128b('0x3b')];if(!_0xfd7a0b[_0x128b('0x3d')]['hasOwnProperty'](_0x128b('0x44'))){_0x1d1b27[_0x128b('0x21')]=qs[_0x128b('0x21')](_0xfd7a0b[_0x128b('0x3d')]['limit']);_0x1d1b27[_0x128b('0x20')]=qs[_0x128b('0x20')](_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x20')]);}_0x1d1b27[_0x128b('0x61')]=qs[_0x128b('0x45')](_0xfd7a0b[_0x128b('0x3d')]['sort']);_0x1d1b27[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0xfd7a0b[_0x128b('0x3d')],_0x5b6fa7[_0x128b('0x47')]));_0x1d1b27[_0x128b('0x46')][_0x128b('0x63')]=_0x42e130['id'];if(_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x2c')]){_0x1d1b27[_0x128b('0x46')]=_[_0x128b('0x48')](_0x1d1b27[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x1d1b27[_0x128b('0x41')],function(_0x406b55){var _0x17b381={};_0x17b381[_0x406b55]={'$like':'%'+_0xfd7a0b['query'][_0x128b('0x2c')]+'%'};return _0x17b381;})});}_0x1d1b27=_[_0x128b('0x48')]({},_0x1d1b27,_0xfd7a0b[_0x128b('0x49')]);return db[_0x128b('0x67')][_0x128b('0x1f')]({'where':_0x1d1b27['where']})['then'](function(_0x598b45){_0x21ffba[_0x128b('0x1f')]=_0x598b45;if(_0xfd7a0b[_0x128b('0x3d')][_0x128b('0x4a')]){_0x1d1b27[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x67')]['findAll'](_0x1d1b27);})[_0x128b('0x26')](function(_0x395984){_0x21ffba[_0x128b('0x4d')]=_0x395984;return _0x21ffba;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x26cc99,_0x1d1b27))[_0x128b('0x4e')](handleError(_0x26cc99,null));};exports[_0x128b('0x68')]=function(_0x42cd72,_0x3b02fb,_0x42455e){var _0x3fda92={'raw':!![],'where':{}};var _0x4bcea1={};var _0x378b1={'count':0x0,'rows':[]};return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x42cd72[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x3b02fb,null))[_0x128b('0x26')](function(_0x26a332){if(_0x26a332){_0x4bcea1[_0x128b('0x3b')]=_[_0x128b('0x3e')](db['CmHopperBlack']['rawAttributes']);_0x4bcea1['query']=_[_0x128b('0x3e')](_0x42cd72[_0x128b('0x3d')]);_0x4bcea1['filters']=_['intersection'](_0x4bcea1['model'],_0x4bcea1[_0x128b('0x3d')]);_0x3fda92[_0x128b('0x41')]=_['intersection'](_0x4bcea1['model'],qs[_0x128b('0x40')](_0x42cd72['query'][_0x128b('0x40')]));_0x3fda92['attributes']=_0x3fda92[_0x128b('0x41')][_0x128b('0x42')]?_0x3fda92[_0x128b('0x41')]:_0x4bcea1['model'];if(!_0x42cd72[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x3fda92[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x42cd72['query'][_0x128b('0x21')]);_0x3fda92['offset']=qs[_0x128b('0x20')](_0x42cd72[_0x128b('0x3d')][_0x128b('0x20')]);}_0x3fda92[_0x128b('0x61')]=qs['sort'](_0x42cd72[_0x128b('0x3d')][_0x128b('0x45')]);_0x3fda92[_0x128b('0x46')]=qs[_0x128b('0x47')](_['pick'](_0x42cd72[_0x128b('0x3d')],_0x4bcea1['filters']));_0x3fda92['where']['VoiceQueueId']=_0x26a332['id'];if(_0x42cd72[_0x128b('0x3d')][_0x128b('0x2c')]){_0x3fda92[_0x128b('0x46')]=_[_0x128b('0x48')](_0x3fda92[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x3fda92[_0x128b('0x41')],function(_0x1f0cc2){var _0x54c246={};_0x54c246[_0x1f0cc2]={'$like':'%'+_0x42cd72[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x54c246;})});}_0x3fda92=_['merge']({},_0x3fda92,_0x42cd72[_0x128b('0x49')]);return db['CmHopperBlack']['count']({'where':_0x3fda92[_0x128b('0x46')]})['then'](function(_0x2193e5){_0x378b1['count']=_0x2193e5;if(_0x42cd72[_0x128b('0x3d')][_0x128b('0x4a')]){_0x3fda92[_0x128b('0x4b')]=[{'all':!![]}];}return db[_0x128b('0x69')]['findAll'](_0x3fda92);})[_0x128b('0x26')](function(_0x2c6f4b){_0x378b1[_0x128b('0x4d')]=_0x2c6f4b;return _0x378b1;});}})[_0x128b('0x26')](respondWithFilteredResult(_0x3b02fb,_0x3fda92))[_0x128b('0x4e')](handleError(_0x3b02fb,null));};exports[_0x128b('0x6a')]=function(_0x4773c8,_0x4d1bf3,_0x25d3fd){var _0xa226fc={};var _0x315f82={};var _0x2784fa;var _0x3cfe0e;return db['VoiceQueue'][_0x128b('0x5f')]({'where':{'id':_0x4773c8[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x4d1bf3,null))['then'](function(_0x3090b7){if(_0x3090b7){_0x2784fa=_0x3090b7;_0x315f82[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x6b')][_0x128b('0x38')]);_0x315f82[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x4773c8[_0x128b('0x3d')]);_0x315f82[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x315f82[_0x128b('0x3b')],_0x315f82[_0x128b('0x3d')]);_0xa226fc[_0x128b('0x41')]=_[_0x128b('0x3f')](_0x315f82['model'],qs['fields'](_0x4773c8[_0x128b('0x3d')][_0x128b('0x40')]));_0xa226fc['attributes']=_0xa226fc[_0x128b('0x41')][_0x128b('0x42')]?_0xa226fc[_0x128b('0x41')]:_0x315f82[_0x128b('0x3b')];_0xa226fc[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x4773c8[_0x128b('0x3d')][_0x128b('0x45')]);_0xa226fc[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x4773c8[_0x128b('0x3d')],_0x315f82[_0x128b('0x47')]));if(_0x4773c8[_0x128b('0x3d')][_0x128b('0x2c')]){_0xa226fc['where']=_[_0x128b('0x48')](_0xa226fc[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0xa226fc[_0x128b('0x41')],function(_0x28d48e){var _0x5a367f={};_0x5a367f[_0x28d48e]={'$like':'%'+_0x4773c8[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x5a367f;})});}_0xa226fc=_[_0x128b('0x48')]({},_0xa226fc,_0x4773c8[_0x128b('0x49')]);return _0x2784fa[_0x128b('0x6a')](_0xa226fc);}})[_0x128b('0x26')](function(_0x272ed9){if(_0x272ed9){_0x3cfe0e=_0x272ed9[_0x128b('0x42')];if(!_0x4773c8[_0x128b('0x3d')]['hasOwnProperty'](_0x128b('0x44'))){_0xa226fc[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x4773c8[_0x128b('0x3d')][_0x128b('0x21')]);_0xa226fc[_0x128b('0x20')]=qs['offset'](_0x4773c8[_0x128b('0x3d')]['offset']);}return _0x2784fa['getTeams'](_0xa226fc);}})[_0x128b('0x26')](function(_0x55d463){if(_0x55d463){return _0x55d463?{'count':_0x3cfe0e,'rows':_0x55d463}:null;}})[_0x128b('0x26')](respondWithResult(_0x4d1bf3,null))[_0x128b('0x4e')](handleError(_0x4d1bf3,null));};exports['addTeams']=function(_0x29a8cc,_0x3a08bc,_0x1985fe){var _0x501652=_0x29a8cc[_0x128b('0x51')][_0x128b('0x6c')];var _0x1f7b96=_['map'](_0x501652,'id');return db[_0x128b('0x6b')]['findAll']({'where':{'id':_0x1f7b96},'attributes':['id'],'include':[{'model':db[_0x128b('0x6d')],'as':'Agents','attributes':['id',_0x128b('0x34'),_0x128b('0x6e'),_0x128b('0x6f'),_0x128b('0x70')],'raw':!![]}]})[_0x128b('0x26')](function(_0xb4cb90){if(_0xb4cb90){var _0x73ebe=_[_0x128b('0x71')](_0xb4cb90,function(_0x15cebb){var _0xa0e8c1=_0x15cebb[_0x128b('0x52')]({'plain':!![]});_0xa0e8c1['Agents'][_0x128b('0x72')](function(_0x1dd1ff){_0x1dd1ff[_0x128b('0x73')]=_['find'](_0x501652,{'id':_0xa0e8c1['id']})[_0x128b('0x73')];});return _0xa0e8c1[_0x128b('0x74')];});return db[_0x128b('0x37')]['find']({'where':{'id':_0x29a8cc[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(_0xe11802){return db[_0x128b('0x75')][_0x128b('0x76')](function(_0x3d08fc){return _0xe11802[_0x128b('0x77')](_0x1f7b96,{'transaction':_0x3d08fc})['then'](function(){return BPromise[_0x128b('0x78')](_0x73ebe,function(_0x3cc2a1){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3cc2a1['id'],'VoiceQueueId':_0x29a8cc[_0x128b('0x59')]['id']},'defaults':{'penalty':_0x3cc2a1[_0x128b('0x73')]},'transaction':_0x3d08fc});});})[_0x128b('0x26')](function(){return BPromise['each'](_['filter'](_0x73ebe,{'online':!![]}),function(_0x1f0c19){return db[_0x128b('0x79')][_0x128b('0x7a')]({'membername':_0x1f0c19[_0x128b('0x34')],'UserId':_0x1f0c19['id'],'queue_name':_0xe11802[_0x128b('0x34')],'VoiceQueueId':_0xe11802['id'],'interface':_[_0x128b('0x7b')](_0x1f0c19['interface'])?util[_0x128b('0x7c')]('SIP/%s',_0x1f0c19[_0x128b('0x34')]):_0x1f0c19[_0x128b('0x70')],'paused':_0x1f0c19[_0x128b('0x6f')]||![],'penalty':_0x1f0c19[_0x128b('0x73')]},{'transaction':_0x3d08fc});});})[_0x128b('0x26')](function(){_0x73ebe[_0x128b('0x72')](function(_0x55b9df){socket['emit']('userVoiceQueue:save',{'UserId':_0x55b9df['id'],'VoiceQueueId':_0xe11802['id']});});});});});}})[_0x128b('0x26')](respondWithStatusCode(_0x3a08bc,null))[_0x128b('0x4e')](handleError(_0x3a08bc,null));};exports['removeTeams']=function(_0x561782,_0xabfbff,_0x26e7e2){return db[_0x128b('0x6b')][_0x128b('0x4c')]({'where':{'id':_0x561782[_0x128b('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x128b('0x6d')],'as':_0x128b('0x74'),'attributes':['id'],'raw':!![]}]})[_0x128b('0x26')](handleEntityNotFound(_0xabfbff,null))['then'](function(_0x515239){var _0x4808e7=_[_0x128b('0x3c')](_0x515239,'id');var _0x270bc2=[];var _0x3832d2=[];var _0x5aa21a=squel[_0x128b('0x7d')]();_0x5aa21a['field'](_0x128b('0x7e'))[_0x128b('0x7f')](_0x128b('0x80'),'tq')[_0x128b('0x81')](_0x128b('0x82'),'ut',_0x128b('0x83'))[_0x128b('0x46')](_0x128b('0x84'),_0x561782['params']['id']);for(var _0x58aeaf=0x0;_0x58aeaf<_0x515239[_0x128b('0x42')];_0x58aeaf+=0x1){let _0x4c4de6=_0x515239[_0x58aeaf];for(var _0x3dc7e9=0x0;_0x3dc7e9<_0x4c4de6[_0x128b('0x74')][_0x128b('0x42')];_0x3dc7e9+=0x1){let _0x1e3c8e=_0x4c4de6[_0x128b('0x74')][_0x3dc7e9];var _0x470ebb=_0x5aa21a[_0x128b('0x58')]();_0x470ebb[_0x128b('0x46')](_0x128b('0x85'),_0x1e3c8e['id']);_0x3832d2[_0x128b('0x86')](db['sequelize']['query'](_0x470ebb['toString'](),{'type':db['sequelize'][_0x128b('0x87')][_0x128b('0x88')]})[_0x128b('0x26')](function(_0x5751f6){if(_0x5751f6['length']===0x1){return _0x1e3c8e['id'];}else{var _0x3ce92b=_[_0x128b('0x89')](_[_0x128b('0x3c')](_0x5751f6,_0x128b('0x8a')),function(_0x3dc232){return _[_0x128b('0x2e')](_0x4808e7,_0x3dc232);});if(_0x3ce92b){return _0x1e3c8e['id'];}}}));}}return BPromise[_0x128b('0x8b')](_0x3832d2)[_0x128b('0x26')](function(_0x29fe04){_0x270bc2=_(_0x270bc2)['union'](_0x29fe04)[_0x128b('0x8c')]()[_0x128b('0x2d')]();return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x561782[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(_0x1fe425){return db['sequelize'][_0x128b('0x76')](function(_0x2561b7){return _0x1fe425[_0x128b('0x8d')](_0x561782[_0x128b('0x3d')]['ids'],{'transaction':_0x2561b7})[_0x128b('0x26')](function(){if(!_[_0x128b('0x8e')](_0x270bc2)){return _0x1fe425[_0x128b('0x8f')](_0x270bc2,{'transaction':_0x2561b7})['then'](function(){return db[_0x128b('0x79')][_0x128b('0x27')]({'where':{'VoiceQueueId':_0x561782['params']['id'],'UserId':_0x270bc2},'transaction':_0x2561b7});});}})[_0x128b('0x26')](function(){_0x270bc2['forEach'](function(_0x45a3f4){socket[_0x128b('0x90')](_0x128b('0x91'),{'UserId':_0x45a3f4,'VoiceQueueId':_0x1fe425['id']});});});});});});})[_0x128b('0x26')](respondWithStatusCode(_0xabfbff,null))['catch'](handleError(_0xabfbff,null));};exports[_0x128b('0x92')]=function(_0xf181b2,_0xdbee2c,_0x3e7e1b){var _0x2837c8,_0x3e4a54;return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0xf181b2['params']['id']}})['then'](handleEntityNotFound(_0xdbee2c,null))[_0x128b('0x26')](function(_0xd9c243){if(_0xd9c243){_0x3e4a54=_0xd9c243;return _0xd9c243[_0x128b('0x92')](_0xf181b2['body'][_0x128b('0x93')],_[_0x128b('0x5a')](_0xf181b2[_0x128b('0x51')],[_0x128b('0x93'),'id'])||{})[_0x128b('0x94')](function(_0x2cb251){for(var _0x587528=0x0;_0x587528<_0xf181b2[_0x128b('0x51')][_0x128b('0x93')][_0x128b('0x42')];_0x587528+=0x1){socket[_0x128b('0x90')](_0x128b('0x95'),{'UserId':_0xf181b2[_0x128b('0x51')][_0x128b('0x93')][_0x587528],'VoiceQueueId':_0xf181b2['params']['id']});}return _0x2cb251;});}})['then'](function(_0x4966bc){_0x2837c8=_0x4966bc||[];if(_0x3e4a54){return db[_0x128b('0x6d')][_0x128b('0x4c')]({'where':{'id':_0xf181b2[_0x128b('0x51')][_0x128b('0x93')]},'attributes':['id',_0x128b('0x34'),_0x128b('0x6e'),_0x128b('0x6f'),'interface'],'raw':!![]});}})['then'](function(_0x4d9317){if(!_['isEmpty'](_0x4d9317)){var _0x4d32a0=[];for(var _0x1c0392=0x0;_0x1c0392<_0x4d9317[_0x128b('0x42')];_0x1c0392++){if(_0x4d9317[_0x1c0392]['online']){_0x4d32a0[_0x128b('0x86')](db[_0x128b('0x79')]['upsert']({'membername':_0x4d9317[_0x1c0392]['name'],'UserId':_0x4d9317[_0x1c0392]['id'],'queue_name':_0x3e4a54[_0x128b('0x34')],'VoiceQueueId':_0x3e4a54['id'],'interface':_['isNil'](_0x4d9317[_0x1c0392][_0x128b('0x70')])?util['format'](_0x128b('0x96'),_0x4d9317[_0x1c0392][_0x128b('0x34')]):_0x4d9317[_0x1c0392][_0x128b('0x70')],'paused':_0x4d9317[_0x1c0392][_0x128b('0x6f')]||![],'penalty':_0xf181b2[_0x128b('0x51')]['penalty']||0x0}));}}return BPromise[_0x128b('0x8b')](_0x4d32a0);}})[_0x128b('0x26')](function(){return _0x2837c8;})[_0x128b('0x26')](respondWithResult(_0xdbee2c,null))[_0x128b('0x4e')](handleError(_0xdbee2c,null));};exports[_0x128b('0x8f')]=function(_0x44b575,_0x5ca226,_0x57d81f){return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x44b575[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x5ca226,null))[_0x128b('0x26')](function(_0x15f3f1){if(_0x15f3f1){return _0x15f3f1[_0x128b('0x8f')](_0x44b575['query'][_0x128b('0x93')])['then'](function(){if(_['isArray'](_0x44b575[_0x128b('0x3d')][_0x128b('0x93')])){for(var _0x187ef8=0x0;_0x187ef8<_0x44b575[_0x128b('0x3d')]['ids'][_0x128b('0x42')];_0x187ef8+=0x1){socket[_0x128b('0x90')]('userVoiceQueue:remove',{'UserId':Number(_0x44b575['query'][_0x128b('0x93')][_0x187ef8]),'VoiceQueueId':Number(_0x44b575[_0x128b('0x59')]['id'])});}}else{socket[_0x128b('0x90')](_0x128b('0x91'),{'UserId':Number(_0x44b575[_0x128b('0x3d')][_0x128b('0x93')]),'VoiceQueueId':Number(_0x44b575[_0x128b('0x59')]['id'])});}});}})[_0x128b('0x26')](function(_0x4cbf01){return db[_0x128b('0x79')][_0x128b('0x27')]({'where':{'VoiceQueueId':_0x44b575[_0x128b('0x59')]['id'],'UserId':_0x44b575[_0x128b('0x3d')][_0x128b('0x93')]}})[_0x128b('0x26')](function(){return _0x4cbf01;});})[_0x128b('0x26')](respondWithStatusCode(_0x5ca226,null))['catch'](handleError(_0x5ca226,null));};exports[_0x128b('0x97')]=function(_0x4a8c25,_0x345866,_0x250f2f){var _0x408cea={};var _0x2678f3={};var _0x2d1956;var _0x5cb244;return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x4a8c25[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x345866,null))[_0x128b('0x26')](function(_0x3cbc72){if(_0x3cbc72){_0x2d1956=_0x3cbc72;_0x2678f3[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x6d')][_0x128b('0x38')]);_0x2678f3['query']=_[_0x128b('0x3e')](_0x4a8c25[_0x128b('0x3d')]);_0x2678f3[_0x128b('0x47')]=_['intersection'](_0x2678f3[_0x128b('0x3b')],_0x2678f3['query']);_0x408cea['attributes']=_[_0x128b('0x3f')](_0x2678f3[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x4a8c25[_0x128b('0x3d')][_0x128b('0x40')]));_0x408cea[_0x128b('0x41')]=_0x408cea[_0x128b('0x41')][_0x128b('0x42')]?_0x408cea['attributes']:_0x2678f3[_0x128b('0x3b')];_0x408cea['order']=qs[_0x128b('0x45')](_0x4a8c25['query'][_0x128b('0x45')]);_0x408cea['where']=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x4a8c25[_0x128b('0x3d')],_0x2678f3[_0x128b('0x47')]));if(_0x4a8c25[_0x128b('0x3d')][_0x128b('0x2c')]){_0x408cea['where']=_[_0x128b('0x48')](_0x408cea[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x408cea[_0x128b('0x41')],function(_0x2205fc){var _0xa2cdf8={};_0xa2cdf8[_0x2205fc]={'$like':'%'+_0x4a8c25[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0xa2cdf8;})});}_0x408cea=_[_0x128b('0x48')]({},_0x408cea,_0x4a8c25[_0x128b('0x49')]);return _0x2d1956[_0x128b('0x97')](_0x408cea);}})[_0x128b('0x26')](function(_0xb5847c){if(_0xb5847c){_0x5cb244=_0xb5847c[_0x128b('0x42')];if(!_0x4a8c25[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x408cea[_0x128b('0x21')]=qs['limit'](_0x4a8c25[_0x128b('0x3d')][_0x128b('0x21')]);_0x408cea['offset']=qs[_0x128b('0x20')](_0x4a8c25[_0x128b('0x3d')][_0x128b('0x20')]);}return _0x2d1956[_0x128b('0x97')](_0x408cea);}})[_0x128b('0x26')](function(_0xbb6b93){if(_0xbb6b93){return _0xbb6b93?{'count':_0x5cb244,'rows':_0xbb6b93}:null;}})[_0x128b('0x26')](respondWithResult(_0x345866,null))[_0x128b('0x4e')](handleError(_0x345866,null));};exports['getMembers']=function(_0x2a663a,_0x4a7715,_0x10a2e0){var _0x49e238={};var _0x1b0e55={};var _0x212711;var _0x4beb17;return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x2a663a['params']['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x4a7715,null))['then'](function(_0x9c82c3){if(_0x9c82c3){_0x212711=_0x9c82c3;_0x1b0e55[_0x128b('0x3b')]=_['keys'](db[_0x128b('0x79')][_0x128b('0x38')]);_0x1b0e55[_0x128b('0x3d')]=_['keys'](_0x2a663a[_0x128b('0x3d')]);_0x1b0e55[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x1b0e55[_0x128b('0x3b')],_0x1b0e55[_0x128b('0x3d')]);_0x49e238['attributes']=_['intersection'](_0x1b0e55[_0x128b('0x3b')],qs['fields'](_0x2a663a[_0x128b('0x3d')][_0x128b('0x40')]));_0x49e238['attributes']=_0x49e238['attributes'][_0x128b('0x42')]?_0x49e238['attributes']:_0x1b0e55[_0x128b('0x3b')];_0x49e238[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x2a663a[_0x128b('0x3d')][_0x128b('0x45')]);_0x49e238[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x2a663a['query'],_0x1b0e55[_0x128b('0x47')]));if(_0x2a663a[_0x128b('0x3d')][_0x128b('0x2c')]){_0x49e238[_0x128b('0x46')]=_['merge'](_0x49e238[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x49e238[_0x128b('0x41')],function(_0x119d25){var _0x3e50d9={};_0x3e50d9[_0x119d25]={'$like':'%'+_0x2a663a[_0x128b('0x3d')][_0x128b('0x2c')]+'%'};return _0x3e50d9;})});}_0x49e238=_['merge']({},_0x49e238,_0x2a663a['options']);return _0x212711[_0x128b('0x98')](_0x49e238);}})[_0x128b('0x26')](function(_0x386c5e){if(_0x386c5e){_0x4beb17=_0x386c5e['length'];if(!_0x2a663a[_0x128b('0x3d')][_0x128b('0x43')]('nolimit')){_0x49e238[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x2a663a[_0x128b('0x3d')]['limit']);_0x49e238[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x2a663a[_0x128b('0x3d')][_0x128b('0x20')]);}return _0x212711['getMembers'](_0x49e238);}})['then'](function(_0x59e355){return _0x59e355?{'count':_0x4beb17,'rows':_0x59e355}:null;})[_0x128b('0x26')](respondWithResult(_0x4a7715,null))[_0x128b('0x4e')](handleError(_0x4a7715,null));};exports['getLists']=function(_0x5edc7a,_0x5682b3,_0x8a370b){var _0x2d5a20={};var _0x3f5922={};var _0x4518fc;var _0x2249f3;return db['VoiceQueue'][_0x128b('0x5f')]({'where':{'id':_0x5edc7a[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x5682b3,null))['then'](function(_0x414f3f){if(_0x414f3f){_0x4518fc=_0x414f3f;_0x3f5922['model']=_[_0x128b('0x3e')](db[_0x128b('0x99')][_0x128b('0x38')]);_0x3f5922[_0x128b('0x3d')]=_['keys'](_0x5edc7a[_0x128b('0x3d')]);_0x3f5922[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x3f5922[_0x128b('0x3b')],_0x3f5922[_0x128b('0x3d')]);_0x2d5a20[_0x128b('0x41')]=_['intersection'](_0x3f5922[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x5edc7a['query'][_0x128b('0x40')]));_0x2d5a20['attributes']=_0x2d5a20['attributes'][_0x128b('0x42')]?_0x2d5a20[_0x128b('0x41')]:_0x3f5922[_0x128b('0x3b')];_0x2d5a20[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x5edc7a[_0x128b('0x3d')][_0x128b('0x45')]);_0x2d5a20[_0x128b('0x46')]=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x5edc7a[_0x128b('0x3d')],_0x3f5922[_0x128b('0x47')]));if(_0x5edc7a[_0x128b('0x3d')][_0x128b('0x2c')]){_0x2d5a20[_0x128b('0x46')]=_[_0x128b('0x48')](_0x2d5a20[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x2d5a20[_0x128b('0x41')],function(_0x257ea7){var _0x281a9d={};_0x281a9d[_0x257ea7]={'$like':'%'+_0x5edc7a['query'][_0x128b('0x2c')]+'%'};return _0x281a9d;})});}_0x2d5a20=_[_0x128b('0x48')]({},_0x2d5a20,_0x5edc7a[_0x128b('0x49')]);return _0x4518fc['getLists'](_0x2d5a20);}})[_0x128b('0x26')](function(_0x36ebf1){if(_0x36ebf1){_0x2249f3=_0x36ebf1[_0x128b('0x42')];if(!_0x5edc7a[_0x128b('0x3d')][_0x128b('0x43')]('nolimit')){_0x2d5a20['limit']=qs[_0x128b('0x21')](_0x5edc7a[_0x128b('0x3d')][_0x128b('0x21')]);_0x2d5a20['offset']=qs[_0x128b('0x20')](_0x5edc7a['query'][_0x128b('0x20')]);}return _0x4518fc[_0x128b('0x9a')](_0x2d5a20);}})[_0x128b('0x26')](function(_0x1244e4){if(_0x1244e4){return _0x1244e4?{'count':_0x2249f3,'rows':_0x1244e4}:null;}})['then'](respondWithResult(_0x5682b3,null))[_0x128b('0x4e')](handleError(_0x5682b3,null));};exports[_0x128b('0x9b')]=function(_0x5913ee,_0x621568,_0x58b307){var _0x588a9c,_0x206d00;return db[_0x128b('0x37')][_0x128b('0x30')]({'where':{'id':_0x5913ee[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x621568,null))[_0x128b('0x26')](function(_0x3d068f){if(_0x3d068f){_0x206d00=_0x3d068f;return _0x3d068f['addLists'](_0x5913ee[_0x128b('0x51')][_0x128b('0x93')],_[_0x128b('0x5a')](_0x5913ee[_0x128b('0x51')],['ids','id'])||{});}return null;})[_0x128b('0x94')](function(_0x20cd37){var _0x30fe12;_0x588a9c=_0x20cd37||[];var _0xac06e3=[];if(_0x20cd37){for(var _0x5e4c24=0x0;_0x5e4c24<_0x20cd37[_0x128b('0x42')];_0x5e4c24+=0x1){var _0x4391cb=_0x20cd37[_0x5e4c24][_0x128b('0x52')]({'plain':!![]});_0x206d00['dialCheckDuplicateType']=_0x5913ee[_0x128b('0x51')][_0x128b('0x9c')]?_0x5913ee['body'][_0x128b('0x9c')]:_0x206d00[_0x128b('0x9c')];switch(_0x206d00[_0x128b('0x9c')]){case _0x128b('0x9d'):_0x30fe12=squel[_0x128b('0x9e')]()[_0x128b('0x9f')](_0x128b('0xa0'))[_0x128b('0xa1')](['phone',_0x128b('0xa2'),_0x128b('0xa3'),_0x128b('0xa4'),_0x128b('0x63'),_0x128b('0x5b'),_0x128b('0x5c')],squel['select']()['field'](_0x128b('0xa5'),'phone')[_0x128b('0xa6')](_0x128b('0xa7'),'scheduledAt')['field']('id',_0x128b('0xa3'))[_0x128b('0xa6')](_0x4391cb['CmListId']['toString'](),_0x128b('0xa4'))['field'](_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')](),_0x128b('0x63'))[_0x128b('0xa6')](_0x128b('0xa7'),'createdAt')[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5c'))[_0x128b('0x7f')]('cm_contacts')['where'](_0x128b('0xa9'))['where'](_0x128b('0xaa'),_0x4391cb['CmListId'][_0x128b('0xa8')]())[_0x128b('0x46')](_0x128b('0xab'))['where'](_0x128b('0xac'),squel[_0x128b('0x7d')]()['field'](_0x128b('0xad'))['from'](_0x128b('0xae'))['where'](_0x128b('0x84'),_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')]()))[_0x128b('0x46')](_0x128b('0xac'),squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xaf'))['from']('cm_hopper')['where'](_0x128b('0x84'),_0x5913ee['params']['id'][_0x128b('0xa8')]())))['toString']();break;case _0x128b('0xb0'):_0x30fe12=squel['insert']()[_0x128b('0x9f')]('cm_hopper')[_0x128b('0xa1')]([_0x128b('0xa5'),_0x128b('0xa2'),'ContactId',_0x128b('0xa4'),_0x128b('0x63'),_0x128b('0x5b'),_0x128b('0x5c')],squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xa5'),'phone')[_0x128b('0xa6')](_0x128b('0xa7'),'scheduledAt')[_0x128b('0xa6')]('id',_0x128b('0xa3'))[_0x128b('0xa6')](_0x4391cb[_0x128b('0xb1')][_0x128b('0xa8')](),_0x128b('0xa4'))['field'](_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')](),_0x128b('0x63'))[_0x128b('0xa6')](_0x128b('0xa7'),'createdAt')[_0x128b('0xa6')]('NOW()',_0x128b('0x5c'))['from'](_0x128b('0xb2'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x128b('0xaa'),_0x4391cb[_0x128b('0xb1')][_0x128b('0xa8')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x128b('0xac'),squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xaf'))['from'](_0x128b('0xa0'))['where'](_0x128b('0x84'),_0x5913ee[_0x128b('0x59')]['id'][_0x128b('0xa8')]())))[_0x128b('0xa8')]();break;default:_0x30fe12=squel[_0x128b('0x9e')]()[_0x128b('0x9f')]('cm_hopper')[_0x128b('0xa1')]([_0x128b('0xa5'),_0x128b('0xa2'),_0x128b('0xa3'),'ListId',_0x128b('0x63'),_0x128b('0x5b'),_0x128b('0x5c')],squel[_0x128b('0x7d')]()[_0x128b('0xa6')](_0x128b('0xa5'),_0x128b('0xa5'))['field'](_0x128b('0xa7'),_0x128b('0xa2'))[_0x128b('0xa6')]('id',_0x128b('0xa3'))['field'](_0x4391cb[_0x128b('0xb1')][_0x128b('0xa8')](),_0x128b('0xa4'))[_0x128b('0xa6')](_0x5913ee[_0x128b('0x59')]['id']['toString'](),'VoiceQueueId')['field'](_0x128b('0xa7'),_0x128b('0x5b'))[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5c'))['from']('cm_contacts')[_0x128b('0x46')](_0x128b('0xa9'))[_0x128b('0x46')](_0x128b('0xaa'),_0x4391cb['CmListId'][_0x128b('0xa8')]())[_0x128b('0x46')](_0x128b('0xab')))[_0x128b('0xa8')]();}_0xac06e3[_0x128b('0x86')](db[_0x128b('0x75')][_0x128b('0x3d')](_0x30fe12));}return BPromise['all'](_0xac06e3);}})[_0x128b('0x26')](function(){return _0x588a9c;})[_0x128b('0x26')](respondWithResult(_0x621568,null))[_0x128b('0x4e')](handleError(_0x621568,null));};exports[_0x128b('0xb3')]=function(_0x209176,_0x2e8a57,_0x4f68a3){return db[_0x128b('0x37')]['find']({'where':{'id':_0x209176[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x2e8a57,null))[_0x128b('0x26')](function(_0x21540e){if(_0x21540e){return _0x21540e[_0x128b('0xb3')](_0x209176[_0x128b('0x3d')][_0x128b('0x93')]);}})[_0x128b('0x26')](function(_0x3ce20a){if(_0x3ce20a){return db[_0x128b('0x60')][_0x128b('0x27')]({'where':{'ListId':_0x209176[_0x128b('0x3d')][_0x128b('0x93')],'VoiceQueueId':_0x209176[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(){return _0x3ce20a;});}})[_0x128b('0x26')](respondWithStatusCode(_0x2e8a57,null))[_0x128b('0x4e')](handleError(_0x2e8a57,null));};exports[_0x128b('0xb4')]=function(_0x115390,_0x158fed,_0x28c3ee){var _0x5c9cb5={};var _0x308288={};var _0x2b002d;var _0x834f5f;return db[_0x128b('0x37')][_0x128b('0x5f')]({'where':{'id':_0x115390[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x158fed,null))[_0x128b('0x26')](function(_0x4c2b14){if(_0x4c2b14){_0x2b002d=_0x4c2b14;_0x308288[_0x128b('0x3b')]=_[_0x128b('0x3e')](db[_0x128b('0x99')][_0x128b('0x38')]);_0x308288[_0x128b('0x3d')]=_[_0x128b('0x3e')](_0x115390[_0x128b('0x3d')]);_0x308288[_0x128b('0x47')]=_[_0x128b('0x3f')](_0x308288[_0x128b('0x3b')],_0x308288[_0x128b('0x3d')]);_0x5c9cb5['attributes']=_['intersection'](_0x308288[_0x128b('0x3b')],qs[_0x128b('0x40')](_0x115390['query'][_0x128b('0x40')]));_0x5c9cb5[_0x128b('0x41')]=_0x5c9cb5[_0x128b('0x41')][_0x128b('0x42')]?_0x5c9cb5[_0x128b('0x41')]:_0x308288[_0x128b('0x3b')];_0x5c9cb5[_0x128b('0x61')]=qs[_0x128b('0x45')](_0x115390[_0x128b('0x3d')][_0x128b('0x45')]);_0x5c9cb5['where']=qs[_0x128b('0x47')](_[_0x128b('0x62')](_0x115390[_0x128b('0x3d')],_0x308288['filters']));if(_0x115390['query'][_0x128b('0x2c')]){_0x5c9cb5[_0x128b('0x46')]=_[_0x128b('0x48')](_0x5c9cb5[_0x128b('0x46')],{'$or':_[_0x128b('0x3c')](_0x5c9cb5[_0x128b('0x41')],function(_0x16a746){var _0x297f68={};_0x297f68[_0x16a746]={'$like':'%'+_0x115390['query'][_0x128b('0x2c')]+'%'};return _0x297f68;})});}_0x5c9cb5=_['merge']({},_0x5c9cb5,_0x115390[_0x128b('0x49')]);return _0x2b002d[_0x128b('0xb4')](_0x5c9cb5);}})[_0x128b('0x26')](function(_0x499a13){if(_0x499a13){_0x834f5f=_0x499a13['length'];if(!_0x115390[_0x128b('0x3d')][_0x128b('0x43')](_0x128b('0x44'))){_0x5c9cb5[_0x128b('0x21')]=qs[_0x128b('0x21')](_0x115390[_0x128b('0x3d')][_0x128b('0x21')]);_0x5c9cb5[_0x128b('0x20')]=qs[_0x128b('0x20')](_0x115390[_0x128b('0x3d')]['offset']);}return _0x2b002d[_0x128b('0xb4')](_0x5c9cb5);}})[_0x128b('0x26')](function(_0x2ef2a2){if(_0x2ef2a2){return _0x2ef2a2?{'count':_0x834f5f,'rows':_0x2ef2a2}:null;}})['then'](respondWithResult(_0x158fed,null))['catch'](handleError(_0x158fed,null));};exports[_0x128b('0xb5')]=function(_0x1ee231,_0x529be3,_0x264424){var _0x5a5654,_0x424450;return db['VoiceQueue']['find']({'where':{'id':_0x1ee231[_0x128b('0x59')]['id']}})['then'](handleEntityNotFound(_0x529be3,null))[_0x128b('0x26')](function(_0x5e9174){if(_0x5e9174){_0x424450=_0x5e9174;return _0x5e9174[_0x128b('0xb5')](_0x1ee231[_0x128b('0x51')][_0x128b('0x93')],_[_0x128b('0x5a')](_0x1ee231['body'],[_0x128b('0x93'),'id'])||{});}return null;})[_0x128b('0x94')](function(_0x38de5f){var _0x406581;_0x5a5654=_0x38de5f||[];var _0x4c8317=[];if(_0x38de5f){for(var _0xc9eee2=0x0;_0xc9eee2<_0x38de5f[_0x128b('0x42')];_0xc9eee2+=0x1){var _0xe90ffa=_0x38de5f[_0xc9eee2][_0x128b('0x52')]({'plain':!![]});_0x406581=squel[_0x128b('0x9e')]()['into'](_0x128b('0xb6'))[_0x128b('0xa1')]([_0x128b('0xa5'),'ContactId','ListId','VoiceQueueId',_0x128b('0x5b'),_0x128b('0x5c')],squel[_0x128b('0x7d')]()['field'](_0x128b('0xa5'),_0x128b('0xa5'))[_0x128b('0xa6')]('id','ContactId')[_0x128b('0xa6')](_0xe90ffa['CmListId'][_0x128b('0xa8')](),_0x128b('0xa4'))[_0x128b('0xa6')](_0x1ee231[_0x128b('0x59')]['id'][_0x128b('0xa8')](),_0x128b('0x63'))[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5b'))[_0x128b('0xa6')](_0x128b('0xa7'),_0x128b('0x5c'))['from'](_0x128b('0xb2'))[_0x128b('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x128b('0xaa'),_0xe90ffa[_0x128b('0xb1')][_0x128b('0xa8')]())[_0x128b('0x46')](_0x128b('0xab')))[_0x128b('0xa8')]();_0x4c8317[_0x128b('0x86')](db[_0x128b('0x75')]['query'](_0x406581));}return BPromise['all'](_0x4c8317);}})['then'](function(){return _0x5a5654;})[_0x128b('0x26')](respondWithResult(_0x529be3,null))[_0x128b('0x4e')](handleError(_0x529be3,null));};exports[_0x128b('0xb7')]=function(_0x42d8d0,_0x382779,_0x5eba0f){return db[_0x128b('0x37')]['find']({'where':{'id':_0x42d8d0[_0x128b('0x59')]['id']}})[_0x128b('0x26')](handleEntityNotFound(_0x382779,null))['then'](function(_0x511ad5){if(_0x511ad5){return _0x511ad5['removeBlackLists'](_0x42d8d0[_0x128b('0x3d')][_0x128b('0x93')]);}})[_0x128b('0x26')](function(_0x1fd096){if(_0x1fd096){return db[_0x128b('0x69')][_0x128b('0x27')]({'where':{'ListId':_0x42d8d0[_0x128b('0x3d')]['ids'],'VoiceQueueId':_0x42d8d0[_0x128b('0x59')]['id']}})[_0x128b('0x26')](function(){return _0x1fd096;});}})[_0x128b('0x26')](respondWithStatusCode(_0x382779,null))['catch'](handleError(_0x382779,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9db4c58..142411d 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 _0xa053=['hook','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x35440c,_0x534866){var _0xfe556d=function(_0x136465){while(--_0x136465){_0x35440c['push'](_0x35440c['shift']());}};_0xfe556d(++_0x534866);}(_0xa053,0x179));var _0x3a05=function(_0x49c540,_0x256f4b){_0x49c540=_0x49c540-0x0;var _0x4c29cf=_0xa053[_0x49c540];return _0x4c29cf;};'use strict';var EventEmitter=require(_0x3a05('0x0'));var VoiceQueue=require(_0x3a05('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a05('0x2'),'afterUpdate':_0x3a05('0x3'),'afterDestroy':_0x3a05('0x4')};function emitEvent(_0x31be0c){return function(_0x20ad4b,_0x221d1e,_0x3c9a5a){VoiceQueueEvents['emit'](_0x31be0c+':'+_0x20ad4b['id'],_0x20ad4b);VoiceQueueEvents[_0x3a05('0x5')](_0x31be0c,_0x20ad4b);_0x3c9a5a(null);};}for(var e in events){if(events[_0x3a05('0x6')](e)){var event=events[e];VoiceQueue[_0x3a05('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x65d9=['../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x48d5eb,_0x3535cd){var _0x316f9e=function(_0x5dd6c5){while(--_0x5dd6c5){_0x48d5eb['push'](_0x48d5eb['shift']());}};_0x316f9e(++_0x3535cd);}(_0x65d9,0x10d));var _0x965d=function(_0x4598d8,_0xebcd05){_0x4598d8=_0x4598d8-0x0;var _0x57b16f=_0x65d9[_0x4598d8];return _0x57b16f;};'use strict';var EventEmitter=require(_0x965d('0x0'));var VoiceQueue=require(_0x965d('0x1'))['db'][_0x965d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x965d('0x3')](0x0);var events={'afterCreate':_0x965d('0x4'),'afterUpdate':'update','afterDestroy':_0x965d('0x5')};function emitEvent(_0x4f5fea){return function(_0x4ec404,_0x4c58cc,_0x219c4e){VoiceQueueEvents[_0x965d('0x6')](_0x4f5fea+':'+_0x4ec404['id'],_0x4ec404);VoiceQueueEvents[_0x965d('0x6')](_0x4f5fea,_0x4ec404);_0x219c4e(null);};}for(var e in events){if(events[_0x965d('0x7')](e)){var event=events[e];VoiceQueue[_0x965d('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8cbee91..b04c0f5 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 _0x94c2=['rimraf','../../config/environment','./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','bluebird','path'];(function(_0x447038,_0x3358e9){var _0xddd649=function(_0x10d9ab){while(--_0x10d9ab){_0x447038['push'](_0x447038['shift']());}};_0xddd649(++_0x3358e9);}(_0x94c2,0x17c));var _0x294c=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x94c2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x294c('0x0'));var util=require(_0x294c('0x1'));var logger=require(_0x294c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x294c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x294c('0x4'));var rimraf=require(_0x294c('0x5'));var config=require(_0x294c('0x6'));var attributes=require(_0x294c('0x7'));module['exports']=function(_0x51c986,_0x55221a){return _0x51c986[_0x294c('0x8')](_0x294c('0x9'),attributes,{'tableName':_0x294c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x925f=['bluebird','request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x925f,0xa0));var _0xf925=function(_0x1f6fd5,_0x399cb0){_0x1f6fd5=_0x1f6fd5-0x0;var _0x587d12=_0x925f[_0x1f6fd5];return _0x587d12;};'use strict';var _=require('lodash');var util=require(_0xf925('0x0'));var logger=require('../../config/logger')(_0xf925('0x1'));var moment=require('moment');var BPromise=require(_0xf925('0x2'));var rp=require(_0xf925('0x3'));var fs=require('fs');var path=require(_0xf925('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf925('0x5'));module['exports']=function(_0xfa30c5,_0x369940){return _0xfa30c5[_0xf925('0x6')](_0xf925('0x7'),attributes,{'tableName':_0xf925('0x8'),'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 6a5e05d..622ddda 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 _0x1323=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','model','map','find','ShowVoiceQueue','debug','stringify','lodash','util','moment'];(function(_0x290680,_0x146aaf){var _0x3e796a=function(_0xd5cecd){while(--_0xd5cecd){_0x290680['push'](_0x290680['shift']());}};_0x3e796a(++_0x146aaf);}(_0x1323,0x189));var _0x3132=function(_0x264ba4,_0x3dce73){_0x264ba4=_0x264ba4-0x0;var _0x351bf0=_0x1323[_0x264ba4];return _0x351bf0;};'use strict';var _=require(_0x3132('0x0'));var util=require(_0x3132('0x1'));var moment=require(_0x3132('0x2'));var BPromise=require(_0x3132('0x3'));var rs=require(_0x3132('0x4'));var fs=require('fs');var Redis=require(_0x3132('0x5'));var db=require(_0x3132('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3132('0x7'))(_0x3132('0x8'));var config=require(_0x3132('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3132('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3132('0xb'))(new Redis(config[_0x3132('0xa')]));require(_0x3132('0xc'))['register'](socket);function respondWithRpcPromise(_0x3a7575,_0x1c8853,_0x742840){return new BPromise(function(_0x1f6a98,_0x358d91){return client[_0x3132('0xd')](_0x3a7575,_0x742840)[_0x3132('0xe')](function(_0x3dd3f7){logger[_0x3132('0xf')](_0x3132('0x10'),_0x1c8853,_0x3132('0x11'));logger['debug'](_0x3132('0x12'),_0x1c8853,_0x3132('0x11'),JSON['stringify'](_0x3dd3f7));if(_0x3dd3f7['error']){if(_0x3dd3f7[_0x3132('0x13')][_0x3132('0x14')]===0x1f4){logger[_0x3132('0x13')](_0x3132('0x10'),_0x1c8853,_0x3dd3f7['error']['message']);return _0x358d91(_0x3dd3f7['error'][_0x3132('0x15')]);}logger[_0x3132('0x13')](_0x3132('0x10'),_0x1c8853,_0x3dd3f7[_0x3132('0x13')]['message']);return _0x1f6a98(_0x3dd3f7[_0x3132('0x13')][_0x3132('0x15')]);}else{logger[_0x3132('0xf')](_0x3132('0x10'),_0x1c8853,_0x3132('0x11'));_0x1f6a98(_0x3dd3f7['result']['message']);}})[_0x3132('0x16')](function(_0xc2bf76){logger[_0x3132('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x1c8853,_0xc2bf76);_0x358d91(_0xc2bf76);});});}exports[_0x3132('0x17')]=function(_0x366023){var _0x514c77=this;return new Promise(function(_0x1a22bf,_0x807aad){return db[_0x3132('0x18')]['findAll']({'raw':_0x366023[_0x3132('0x19')]?_0x366023['options']['raw']===undefined?!![]:![]:!![],'where':_0x366023[_0x3132('0x19')]?_0x366023[_0x3132('0x19')][_0x3132('0x1a')]||null:null,'attributes':_0x366023[_0x3132('0x19')]?_0x366023['options'][_0x3132('0x1b')]||null:null,'limit':_0x366023[_0x3132('0x19')]?_0x366023[_0x3132('0x19')][_0x3132('0x1c')]||null:null,'include':_0x366023[_0x3132('0x19')]?_0x366023['options'][_0x3132('0x1d')]?_['map'](_0x366023[_0x3132('0x19')][_0x3132('0x1d')],function(_0x33a1b8){return{'model':db[_0x33a1b8[_0x3132('0x1e')]],'as':_0x33a1b8['as'],'attributes':_0x33a1b8[_0x3132('0x1b')],'include':_0x33a1b8[_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x33a1b8[_0x3132('0x1d')],function(_0x184628){return{'model':db[_0x184628[_0x3132('0x1e')]],'as':_0x184628['as'],'attributes':_0x184628[_0x3132('0x1b')],'include':_0x184628[_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x184628[_0x3132('0x1d')],function(_0x282f22){return{'model':db[_0x282f22[_0x3132('0x1e')]],'as':_0x282f22['as'],'attributes':_0x282f22[_0x3132('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3132('0xe')](function(_0x30b8d7){logger[_0x3132('0xf')]('GetVoiceQueue',_0x366023);logger['debug'](_0x3132('0x17'),_0x366023,JSON['stringify'](_0x30b8d7));_0x1a22bf(_0x30b8d7);})[_0x3132('0x16')](function(_0x3853f1){logger[_0x3132('0x13')](_0x3132('0x17'),_0x3853f1[_0x3132('0x15')],_0x366023);_0x807aad(_0x514c77[_0x3132('0x13')](0x1f4,_0x3853f1['message']));});});};exports['ShowVoiceQueue']=function(_0x4a5dae){var _0x510461=this;return new Promise(function(_0x47bf79,_0x8e5e02){return db[_0x3132('0x18')][_0x3132('0x20')]({'raw':_0x4a5dae[_0x3132('0x19')]?_0x4a5dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a5dae['options']?_0x4a5dae[_0x3132('0x19')][_0x3132('0x1a')]||null:null,'attributes':_0x4a5dae[_0x3132('0x19')]?_0x4a5dae[_0x3132('0x19')][_0x3132('0x1b')]||null:null,'include':_0x4a5dae['options']?_0x4a5dae['options'][_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x4a5dae['options']['include'],function(_0x1c15cd){return{'model':db[_0x1c15cd[_0x3132('0x1e')]],'as':_0x1c15cd['as'],'attributes':_0x1c15cd[_0x3132('0x1b')],'include':_0x1c15cd[_0x3132('0x1d')]?_[_0x3132('0x1f')](_0x1c15cd['include'],function(_0x1e1892){return{'model':db[_0x1e1892['model']],'as':_0x1e1892['as'],'attributes':_0x1e1892[_0x3132('0x1b')],'include':_0x1e1892[_0x3132('0x1d')]?_['map'](_0x1e1892[_0x3132('0x1d')],function(_0x45b459){return{'model':db[_0x45b459[_0x3132('0x1e')]],'as':_0x45b459['as'],'attributes':_0x45b459[_0x3132('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3132('0xe')](function(_0xfd19df){logger[_0x3132('0xf')](_0x3132('0x21'),_0x4a5dae);logger[_0x3132('0x22')]('ShowVoiceQueue',_0x4a5dae,JSON[_0x3132('0x23')](_0xfd19df));_0x47bf79(_0xfd19df);})[_0x3132('0x16')](function(_0x362386){logger['error'](_0x3132('0x21'),_0x362386[_0x3132('0x15')],_0x4a5dae);_0x8e5e02(_0x510461['error'](0x1f4,_0x362386[_0x3132('0x15')]));});});}; \ No newline at end of file +var _0x65a2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','info','ShowVoiceQueue','VoiceQueue','lodash','util'];(function(_0x3a82f5,_0x37805a){var _0x1fa056=function(_0x22f83c){while(--_0x22f83c){_0x3a82f5['push'](_0x3a82f5['shift']());}};_0x1fa056(++_0x37805a);}(_0x65a2,0x15d));var _0x265a=function(_0x433e7e,_0xdd0075){_0x433e7e=_0x433e7e-0x0;var _0x145278=_0x65a2[_0x433e7e];return _0x145278;};'use strict';var _=require(_0x265a('0x0'));var util=require(_0x265a('0x1'));var moment=require(_0x265a('0x2'));var BPromise=require(_0x265a('0x3'));var rs=require(_0x265a('0x4'));var fs=require('fs');var Redis=require(_0x265a('0x5'));var db=require(_0x265a('0x6'))['db'];var utils=require(_0x265a('0x7'));var logger=require('../../config/logger')(_0x265a('0x8'));var config=require(_0x265a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x265a('0xa')][_0x265a('0xb')]({'port':0x232a});config[_0x265a('0xc')]=_[_0x265a('0xd')](config['redis'],{'host':_0x265a('0xe'),'port':0x18eb});var socket=require(_0x265a('0xf'))(new Redis(config[_0x265a('0xc')]));require(_0x265a('0x10'))[_0x265a('0x11')](socket);function respondWithRpcPromise(_0x31e969,_0x5145bc,_0x88e820){return new BPromise(function(_0x499ecd,_0x53f29b){return client[_0x265a('0x12')](_0x31e969,_0x88e820)[_0x265a('0x13')](function(_0x21a7ea){logger['info'](_0x265a('0x14'),_0x5145bc,_0x265a('0x15'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5145bc,_0x265a('0x15'),JSON['stringify'](_0x21a7ea));if(_0x21a7ea[_0x265a('0x16')]){if(_0x21a7ea[_0x265a('0x16')]['code']===0x1f4){logger['error'](_0x265a('0x14'),_0x5145bc,_0x21a7ea['error'][_0x265a('0x17')]);return _0x53f29b(_0x21a7ea[_0x265a('0x16')][_0x265a('0x17')]);}logger[_0x265a('0x16')](_0x265a('0x14'),_0x5145bc,_0x21a7ea[_0x265a('0x16')][_0x265a('0x17')]);return _0x499ecd(_0x21a7ea[_0x265a('0x16')]['message']);}else{logger['info'](_0x265a('0x14'),_0x5145bc,_0x265a('0x15'));_0x499ecd(_0x21a7ea[_0x265a('0x18')][_0x265a('0x17')]);}})[_0x265a('0x19')](function(_0x858a0c){logger[_0x265a('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x5145bc,_0x858a0c);_0x53f29b(_0x858a0c);});});}exports[_0x265a('0x1a')]=function(_0x1f4de4){var _0x2bd581=this;return new Promise(function(_0x48d202,_0x232bf0){return db['VoiceQueue'][_0x265a('0x1b')]({'raw':_0x1f4de4['options']?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x1e')]||null:null,'attributes':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x1f')]||null:null,'limit':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')][_0x265a('0x20')]||null:null,'include':_0x1f4de4[_0x265a('0x1c')]?_0x1f4de4[_0x265a('0x1c')]['include']?_[_0x265a('0x21')](_0x1f4de4[_0x265a('0x1c')][_0x265a('0x22')],function(_0x3ce20d){return{'model':db[_0x3ce20d['model']],'as':_0x3ce20d['as'],'attributes':_0x3ce20d[_0x265a('0x1f')],'include':_0x3ce20d[_0x265a('0x22')]?_['map'](_0x3ce20d[_0x265a('0x22')],function(_0x528890){return{'model':db[_0x528890[_0x265a('0x23')]],'as':_0x528890['as'],'attributes':_0x528890[_0x265a('0x1f')],'include':_0x528890[_0x265a('0x22')]?_[_0x265a('0x21')](_0x528890[_0x265a('0x22')],function(_0x324132){return{'model':db[_0x324132[_0x265a('0x23')]],'as':_0x324132['as'],'attributes':_0x324132[_0x265a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x265a('0x13')](function(_0x5c4d01){logger[_0x265a('0x24')](_0x265a('0x1a'),_0x1f4de4);logger['debug']('GetVoiceQueue',_0x1f4de4,JSON['stringify'](_0x5c4d01));_0x48d202(_0x5c4d01);})['catch'](function(_0x40cf60){logger[_0x265a('0x16')](_0x265a('0x1a'),_0x40cf60[_0x265a('0x17')],_0x1f4de4);_0x232bf0(_0x2bd581['error'](0x1f4,_0x40cf60[_0x265a('0x17')]));});});};exports[_0x265a('0x25')]=function(_0x45782d){var _0x306f8a=this;return new Promise(function(_0x2b5933,_0x31b081){return db[_0x265a('0x26')]['find']({'raw':_0x45782d[_0x265a('0x1c')]?_0x45782d[_0x265a('0x1c')][_0x265a('0x1d')]===undefined?!![]:![]:!![],'where':_0x45782d['options']?_0x45782d['options'][_0x265a('0x1e')]||null:null,'attributes':_0x45782d['options']?_0x45782d[_0x265a('0x1c')][_0x265a('0x1f')]||null:null,'include':_0x45782d[_0x265a('0x1c')]?_0x45782d[_0x265a('0x1c')][_0x265a('0x22')]?_[_0x265a('0x21')](_0x45782d[_0x265a('0x1c')]['include'],function(_0x5a0d26){return{'model':db[_0x5a0d26['model']],'as':_0x5a0d26['as'],'attributes':_0x5a0d26[_0x265a('0x1f')],'include':_0x5a0d26[_0x265a('0x22')]?_[_0x265a('0x21')](_0x5a0d26[_0x265a('0x22')],function(_0x3220c0){return{'model':db[_0x3220c0[_0x265a('0x23')]],'as':_0x3220c0['as'],'attributes':_0x3220c0['attributes'],'include':_0x3220c0[_0x265a('0x22')]?_[_0x265a('0x21')](_0x3220c0[_0x265a('0x22')],function(_0x510c0a){return{'model':db[_0x510c0a[_0x265a('0x23')]],'as':_0x510c0a['as'],'attributes':_0x510c0a['attributes']};}):[]};}):[]};}):[]:[]})[_0x265a('0x13')](function(_0x447186){logger['info'](_0x265a('0x25'),_0x45782d);logger['debug'](_0x265a('0x25'),_0x45782d,JSON['stringify'](_0x447186));_0x2b5933(_0x447186);})['catch'](function(_0xf5b998){logger['error'](_0x265a('0x25'),_0xf5b998[_0x265a('0x17')],_0x45782d);_0x31b081(_0x306f8a[_0x265a('0x16')](0x1f4,_0xf5b998['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index be34e0f..7fafb79 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 _0xc13c=['remove','update','removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x849e7c,_0x34014e){var _0x11722f=function(_0x1a3fa3){while(--_0x1a3fa3){_0x849e7c['push'](_0x849e7c['shift']());}};_0x11722f(++_0x34014e);}(_0xc13c,0x155));var _0xcc13=function(_0x377868,_0x1ee796){_0x377868=_0x377868-0x0;var _0x4e6adb=_0xc13c[_0x377868];return _0x4e6adb;};'use strict';var VoiceQueueEvents=require(_0xcc13('0x0'));var events=[_0xcc13('0x1'),_0xcc13('0x2'),_0xcc13('0x3')];function createListener(_0x1fd08d,_0x48afbc){return function(_0x445cc8){_0x48afbc['emit'](_0x1fd08d,_0x445cc8);};}function removeListener(_0x46c3d2,_0x37fa92){return function(){VoiceQueueEvents[_0xcc13('0x4')](_0x46c3d2,_0x37fa92);};}exports['register']=function(_0x5439d9){for(var _0x240d6e=0x0,_0x4fd488=events[_0xcc13('0x5')];_0x240d6e<_0x4fd488;_0x240d6e++){var _0x1adeb7=events[_0x240d6e];var _0x33c1fa=createListener(_0xcc13('0x6')+_0x1adeb7,_0x5439d9);VoiceQueueEvents['on'](_0x1adeb7,_0x33c1fa);}}; \ No newline at end of file +var _0xb74d=['length','voiceQueue:','./voiceQueue.events','remove','emit','removeListener','register'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xb74d,0x16e));var _0xdb74=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb74d[_0x52e68e];return _0x3211a4;};'use strict';var VoiceQueueEvents=require(_0xdb74('0x0'));var events=['save',_0xdb74('0x1'),'update'];function createListener(_0x3f540e,_0x5700f0){return function(_0x1ba155){_0x5700f0[_0xdb74('0x2')](_0x3f540e,_0x1ba155);};}function removeListener(_0x61bd15,_0x4b3b06){return function(){VoiceQueueEvents[_0xdb74('0x3')](_0x61bd15,_0x4b3b06);};}exports[_0xdb74('0x4')]=function(_0xd2d2f0){for(var _0x4dbe91=0x0,_0x5183ae=events[_0xdb74('0x5')];_0x4dbe91<_0x5183ae;_0x4dbe91++){var _0x4bf15e=events[_0x4dbe91];var _0x3e44b7=createListener(_0xdb74('0x6')+_0x4bf15e,_0xd2d2f0);VoiceQueueEvents['on'](_0x4bf15e,_0x3e44b7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 78adcb8..9e530ed 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 _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','show','post','create','put','/:id'];(function(_0x5b9348,_0x5cbf46){var _0x5b1418=function(_0x41d11e){while(--_0x41d11e){_0x5b9348['push'](_0x5b9348['shift']());}};_0x5b1418(++_0x5cbf46);}(_0x0424,0x159));var _0x4042=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x0424[_0x58381c];return _0x1a7440;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4042('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x4042('0x5')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0x7')]);router[_0x4042('0x5')](_0x4042('0x8'),auth[_0x4042('0x6')](),controller[_0x4042('0x9')]);router['get']('/index',auth[_0x4042('0x6')](),controller[_0x4042('0xa')]);router[_0x4042('0x5')]('/:id',auth[_0x4042('0x6')](),controller[_0x4042('0xb')]);router[_0x4042('0xc')]('/',auth[_0x4042('0x6')](),controller[_0x4042('0xd')]);router[_0x4042('0xe')](_0x4042('0xf'),auth[_0x4042('0x6')](),controller['update']);router[_0x4042('0x10')](_0x4042('0xf'),auth['isAuthenticated'](),controller[_0x4042('0x11')]);module[_0x4042('0x12')]=router; \ No newline at end of file +var _0x7ee1=['getVoiceQueuesReport','show','create','put','/:id','update','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index'];(function(_0x48fff1,_0x50c537){var _0x127a1d=function(_0x2abe66){while(--_0x2abe66){_0x48fff1['push'](_0x48fff1['shift']());}};_0x127a1d(++_0x50c537);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2980b6,_0x10f1a7){_0x2980b6=_0x2980b6-0x0;var _0x3c3338=_0x7ee1[_0x2980b6];return _0x3c3338;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var auth=require(_0x17ee('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x17ee('0x4'));var controller=require(_0x17ee('0x5'));router[_0x17ee('0x6')]('/',auth[_0x17ee('0x7')](),controller['index']);router[_0x17ee('0x6')](_0x17ee('0x8'),auth['isAuthenticated'](),controller[_0x17ee('0x9')]);router['get'](_0x17ee('0xa'),auth[_0x17ee('0x7')](),controller[_0x17ee('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x17ee('0xc')]);router['post']('/',auth[_0x17ee('0x7')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')](_0x17ee('0xf'),auth['isAuthenticated'](),controller[_0x17ee('0x10')]);router['delete'](_0x17ee('0xf'),auth[_0x17ee('0x7')](),controller[_0x17ee('0x11')]);module[_0x17ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 954be67..6d0775a 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 _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x368563,_0x1720cb){var _0x50a723=function(_0x28b311){while(--_0x28b311){_0x368563['push'](_0x368563['shift']());}};_0x50a723(++_0x1720cb);}(_0xe706,0xa3));var _0x6e70=function(_0x5c107d,_0x155dbe){_0x5c107d=_0x5c107d-0x0;var _0x3eaf06=_0xe706[_0x5c107d];return _0x3eaf06;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x53e4f8,_0x574f8e){var _0x2549fa=function(_0x3ffaf0){while(--_0x3ffaf0){_0x53e4f8['push'](_0x53e4f8['shift']());}};_0x2549fa(++_0x574f8e);}(_0xe706,0xa3));var _0x6e70=function(_0x1acf4d,_0x271e6b){_0x1acf4d=_0x1acf4d-0x0;var _0x2880a0=_0xe706[_0x1acf4d];return _0x2880a0;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 fc066fa..43ef934 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(_0x431162,_0x52de19){var _0x52b2e5=function(_0x17e8c2){while(--_0x17e8c2){_0x431162['push'](_0x431162['shift']());}};_0x52b2e5(++_0x52de19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0xe2684e,_0x457bd7){var _0x4e4668=function(_0x49131c){while(--_0x49131c){_0xe2684e['push'](_0xe2684e['shift']());}};_0x4e4668(++_0x457bd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 1b4b1dc..7be1b59 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 _0x1c14=['remove','emit','exports','events','save','update'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x1c14,0x1d1));var _0x41c1=function(_0x3baa55,_0xa4eea9){_0x3baa55=_0x3baa55-0x0;var _0x5b532f=_0x1c14[_0x3baa55];return _0x5b532f;};'use strict';var EventEmitter=require(_0x41c1('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x41c1('0x1'),'afterUpdate':_0x41c1('0x2'),'afterDestroy':_0x41c1('0x3')};function emitEvent(_0x55676d){return function(_0x492938,_0x234c4b,_0x3aa46d){VoiceQueueReportEvents[_0x41c1('0x4')](_0x55676d+':'+_0x492938['id'],_0x492938);VoiceQueueReportEvents[_0x41c1('0x4')](_0x55676d,_0x492938);_0x3aa46d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x41c1('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x3882=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','remove'];(function(_0x208718,_0x5cbbc0){var _0x3280e5=function(_0x2fc869){while(--_0x2fc869){_0x208718['push'](_0x208718['shift']());}};_0x3280e5(++_0x5cbbc0);}(_0x3882,0x69));var _0x2388=function(_0x2265c0,_0x24881e){_0x2265c0=_0x2265c0-0x0;var _0x27a246=_0x3882[_0x2265c0];return _0x27a246;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x2388('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2388('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2388('0x2')};function emitEvent(_0x77f567){return function(_0x5542ae,_0x4b0685,_0x388941){VoiceQueueReportEvents[_0x2388('0x3')](_0x77f567+':'+_0x5542ae['id'],_0x5542ae);VoiceQueueReportEvents[_0x2388('0x3')](_0x77f567,_0x5542ae);_0x388941(null);};}for(var e in events){if(events[_0x2388('0x4')](e)){var event=events[e];VoiceQueueReport[_0x2388('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9202972..6d512f5 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 _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0xb10b,0x12a));var _0xbb10=function(_0xeefaee,_0x4c8038){_0xeefaee=_0xeefaee-0x0;var _0x225a0e=_0xb10b[_0xeefaee];return _0x225a0e;};'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')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x1c4e15,_0x1a29b4){var _0x475431=function(_0xad5d66){while(--_0xad5d66){_0x1c4e15['push'](_0x1c4e15['shift']());}};_0x475431(++_0x1a29b4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index abe7286..bcdc639 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 _0x887b=['client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','limit','include','model','attributes','then','create','body','raw','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x887b,0xf9));var _0xb887=function(_0x225a24,_0x1189cf){_0x225a24=_0x225a24-0x0;var _0x4753bf=_0x887b[_0x225a24];return _0x4753bf;};'use strict';var _=require('lodash');var util=require(_0xb887('0x0'));var moment=require(_0xb887('0x1'));var BPromise=require(_0xb887('0x2'));var rs=require(_0xb887('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb887('0x4'));var logger=require(_0xb887('0x5'))(_0xb887('0x6'));var config=require(_0xb887('0x7'));var jayson=require(_0xb887('0x8'));var client=jayson[_0xb887('0x9')]['http']({'port':0x232a});config[_0xb887('0xa')]=_[_0xb887('0xb')](config['redis'],{'host':_0xb887('0xc'),'port':0x18eb});var socket=require(_0xb887('0xd'))(new Redis(config[_0xb887('0xa')]));require(_0xb887('0xe'))['register'](socket);function respondWithRpcPromise(_0x384e18,_0x1d1bd2,_0x4019b5){return new BPromise(function(_0x39f264,_0x40971d){return client[_0xb887('0xf')](_0x384e18,_0x4019b5)['then'](function(_0x21a2c9){logger[_0xb887('0x10')](_0xb887('0x11'),_0x1d1bd2,_0xb887('0x12'));logger[_0xb887('0x13')](_0xb887('0x14'),_0x1d1bd2,_0xb887('0x12'),JSON[_0xb887('0x15')](_0x21a2c9));if(_0x21a2c9[_0xb887('0x16')]){if(_0x21a2c9[_0xb887('0x16')][_0xb887('0x17')]===0x1f4){logger[_0xb887('0x16')](_0xb887('0x11'),_0x1d1bd2,_0x21a2c9[_0xb887('0x16')][_0xb887('0x18')]);return _0x40971d(_0x21a2c9[_0xb887('0x16')][_0xb887('0x18')]);}logger[_0xb887('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1d1bd2,_0x21a2c9[_0xb887('0x16')][_0xb887('0x18')]);return _0x39f264(_0x21a2c9['error'][_0xb887('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1d1bd2,_0xb887('0x12'));_0x39f264(_0x21a2c9[_0xb887('0x19')][_0xb887('0x18')]);}})[_0xb887('0x1a')](function(_0x251e49){logger[_0xb887('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x1d1bd2,_0x251e49);_0x40971d(_0x251e49);});});}exports[_0xb887('0x1b')]=function(_0x52f805){var _0x16ec36=this;return new Promise(function(_0x549a45,_0x4821b8){return db[_0xb887('0x1c')][_0xb887('0x1d')]({'raw':_0x52f805[_0xb887('0x1e')]?_0x52f805[_0xb887('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x52f805[_0xb887('0x1e')]?_0x52f805[_0xb887('0x1e')]['where']||null:null,'attributes':_0x52f805[_0xb887('0x1e')]?_0x52f805['options']['attributes']||null:null,'limit':_0x52f805[_0xb887('0x1e')]?_0x52f805[_0xb887('0x1e')][_0xb887('0x1f')]||null:null,'include':_0x52f805['options']?_0x52f805[_0xb887('0x1e')][_0xb887('0x20')]?_['map'](_0x52f805[_0xb887('0x1e')][_0xb887('0x20')],function(_0x1240c1){return{'model':db[_0x1240c1[_0xb887('0x21')]],'as':_0x1240c1['as'],'attributes':_0x1240c1[_0xb887('0x22')],'include':_0x1240c1[_0xb887('0x20')]?_['map'](_0x1240c1['include'],function(_0x16ef3b){return{'model':db[_0x16ef3b[_0xb887('0x21')]],'as':_0x16ef3b['as'],'attributes':_0x16ef3b[_0xb887('0x22')],'include':_0x16ef3b[_0xb887('0x20')]?_['map'](_0x16ef3b[_0xb887('0x20')],function(_0x97d1){return{'model':db[_0x97d1[_0xb887('0x21')]],'as':_0x97d1['as'],'attributes':_0x97d1[_0xb887('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb887('0x23')](function(_0x24d93e){logger[_0xb887('0x10')](_0xb887('0x1b'),_0x52f805);logger[_0xb887('0x13')](_0xb887('0x1b'),_0x52f805,JSON[_0xb887('0x15')](_0x24d93e));_0x549a45(_0x24d93e);})[_0xb887('0x1a')](function(_0x56becf){logger[_0xb887('0x16')](_0xb887('0x1b'),_0x56becf['message'],_0x52f805);_0x4821b8(_0x16ec36[_0xb887('0x16')](0x1f4,_0x56becf[_0xb887('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x4cb88){var _0x3460f4=this;return new Promise(function(_0x35ca16,_0x49fefa){return db[_0xb887('0x1c')][_0xb887('0x24')](_0x4cb88[_0xb887('0x25')],{'raw':_0x4cb88[_0xb887('0x1e')]?_0x4cb88['options'][_0xb887('0x26')]===undefined?!![]:![]:!![]})[_0xb887('0x23')](function(_0x1de7ee){logger[_0xb887('0x10')]('CreateVoiceQueueReport',_0x4cb88);logger[_0xb887('0x13')](_0xb887('0x27'),_0x4cb88,JSON[_0xb887('0x15')](_0x1de7ee));_0x35ca16(_0x1de7ee);})[_0xb887('0x1a')](function(_0x417257){logger['error'](_0xb887('0x27'),_0x417257['message'],_0x4cb88);_0x49fefa(_0x3460f4[_0xb887('0x16')](0x1f4,_0x417257['message']));});});};exports[_0xb887('0x28')]=function(_0x5db834){var _0x20159f=this;return new Promise(function(_0x2176ae,_0xe4bad2){return db[_0xb887('0x1c')][_0xb887('0x29')](_0x5db834[_0xb887('0x25')],{'raw':_0x5db834['options']?_0x5db834['options'][_0xb887('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db834[_0xb887('0x1e')]?_0x5db834[_0xb887('0x1e')][_0xb887('0x2a')]||null:null,'attributes':_0x5db834['options']?_0x5db834['options'][_0xb887('0x22')]||null:null,'limit':_0x5db834['options']?_0x5db834[_0xb887('0x1e')][_0xb887('0x1f')]||null:null})[_0xb887('0x23')](function(_0x3bad19){logger['info'](_0xb887('0x28'),_0x5db834);logger['debug']('UpdateVoiceQueueReport',_0x5db834,JSON[_0xb887('0x15')](_0x3bad19));_0x2176ae(_0x3bad19);})[_0xb887('0x1a')](function(_0x2a11bd){logger[_0xb887('0x16')](_0xb887('0x28'),_0x2a11bd[_0xb887('0x18')],_0x5db834);_0xe4bad2(_0x20159f[_0xb887('0x16')](0x1f4,_0x2a11bd['message']));});});}; \ No newline at end of file +var _0x8296=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring'];(function(_0x186847,_0x4b823a){var _0x57e29d=function(_0x155ca5){while(--_0x155ca5){_0x186847['push'](_0x186847['shift']());}};_0x57e29d(++_0x4b823a);}(_0x8296,0x1a9));var _0x6829=function(_0x4e806d,_0x4cc01d){_0x4e806d=_0x4e806d-0x0;var _0x20821f=_0x8296[_0x4e806d];return _0x20821f;};'use strict';var _=require(_0x6829('0x0'));var util=require(_0x6829('0x1'));var moment=require(_0x6829('0x2'));var BPromise=require(_0x6829('0x3'));var rs=require(_0x6829('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6829('0x5'))['db'];var utils=require(_0x6829('0x6'));var logger=require(_0x6829('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6829('0x8'));var client=jayson['client'][_0x6829('0x9')]({'port':0x232a});config['redis']=_[_0x6829('0xa')](config[_0x6829('0xb')],{'host':_0x6829('0xc'),'port':0x18eb});var socket=require(_0x6829('0xd'))(new Redis(config[_0x6829('0xb')]));require('./voiceQueueReport.socket')[_0x6829('0xe')](socket);function respondWithRpcPromise(_0x319f48,_0x31b77c,_0x373752){return new BPromise(function(_0x513c13,_0x114f56){return client[_0x6829('0xf')](_0x319f48,_0x373752)[_0x6829('0x10')](function(_0x427b5e){logger[_0x6829('0x11')](_0x6829('0x12'),_0x31b77c,_0x6829('0x13'));logger[_0x6829('0x14')](_0x6829('0x15'),_0x31b77c,_0x6829('0x13'),JSON[_0x6829('0x16')](_0x427b5e));if(_0x427b5e[_0x6829('0x17')]){if(_0x427b5e['error'][_0x6829('0x18')]===0x1f4){logger[_0x6829('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x31b77c,_0x427b5e['error'][_0x6829('0x19')]);return _0x114f56(_0x427b5e[_0x6829('0x17')][_0x6829('0x19')]);}logger[_0x6829('0x17')](_0x6829('0x12'),_0x31b77c,_0x427b5e[_0x6829('0x17')]['message']);return _0x513c13(_0x427b5e[_0x6829('0x17')][_0x6829('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x31b77c,_0x6829('0x13'));_0x513c13(_0x427b5e[_0x6829('0x1a')][_0x6829('0x19')]);}})[_0x6829('0x1b')](function(_0x3e9686){logger[_0x6829('0x17')](_0x6829('0x12'),_0x31b77c,_0x3e9686);_0x114f56(_0x3e9686);});});}exports[_0x6829('0x1c')]=function(_0x63f4c5){var _0x1f4d36=this;return new Promise(function(_0x36253e,_0x55dbe3){return db[_0x6829('0x1d')][_0x6829('0x1e')]({'raw':_0x63f4c5[_0x6829('0x1f')]?_0x63f4c5[_0x6829('0x1f')][_0x6829('0x20')]===undefined?!![]:![]:!![],'where':_0x63f4c5[_0x6829('0x1f')]?_0x63f4c5[_0x6829('0x1f')][_0x6829('0x21')]||null:null,'attributes':_0x63f4c5['options']?_0x63f4c5['options']['attributes']||null:null,'limit':_0x63f4c5['options']?_0x63f4c5['options'][_0x6829('0x22')]||null:null,'include':_0x63f4c5[_0x6829('0x1f')]?_0x63f4c5[_0x6829('0x1f')][_0x6829('0x23')]?_[_0x6829('0x24')](_0x63f4c5[_0x6829('0x1f')]['include'],function(_0x181894){return{'model':db[_0x181894[_0x6829('0x25')]],'as':_0x181894['as'],'attributes':_0x181894[_0x6829('0x26')],'include':_0x181894[_0x6829('0x23')]?_[_0x6829('0x24')](_0x181894['include'],function(_0x300c4e){return{'model':db[_0x300c4e[_0x6829('0x25')]],'as':_0x300c4e['as'],'attributes':_0x300c4e[_0x6829('0x26')],'include':_0x300c4e[_0x6829('0x23')]?_[_0x6829('0x24')](_0x300c4e[_0x6829('0x23')],function(_0x27004b){return{'model':db[_0x27004b[_0x6829('0x25')]],'as':_0x27004b['as'],'attributes':_0x27004b[_0x6829('0x26')]};}):[]};}):[]};}):[]:[]})[_0x6829('0x10')](function(_0x32a932){logger[_0x6829('0x11')](_0x6829('0x1c'),_0x63f4c5);logger[_0x6829('0x14')](_0x6829('0x1c'),_0x63f4c5,JSON['stringify'](_0x32a932));_0x36253e(_0x32a932);})[_0x6829('0x1b')](function(_0x2c0d2c){logger['error'](_0x6829('0x1c'),_0x2c0d2c[_0x6829('0x19')],_0x63f4c5);_0x55dbe3(_0x1f4d36['error'](0x1f4,_0x2c0d2c[_0x6829('0x19')]));});});};exports[_0x6829('0x27')]=function(_0x28980e){var _0x3c0cb8=this;return new Promise(function(_0x529e82,_0x5d62e5){return db['VoiceQueueReport']['create'](_0x28980e[_0x6829('0x28')],{'raw':_0x28980e['options']?_0x28980e[_0x6829('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x6829('0x10')](function(_0x4bed89){logger['info'](_0x6829('0x27'),_0x28980e);logger[_0x6829('0x14')](_0x6829('0x27'),_0x28980e,JSON['stringify'](_0x4bed89));_0x529e82(_0x4bed89);})[_0x6829('0x1b')](function(_0x37ccbf){logger[_0x6829('0x17')]('CreateVoiceQueueReport',_0x37ccbf['message'],_0x28980e);_0x5d62e5(_0x3c0cb8[_0x6829('0x17')](0x1f4,_0x37ccbf[_0x6829('0x19')]));});});};exports[_0x6829('0x29')]=function(_0x3e6513){var _0x4a56a3=this;return new Promise(function(_0x48e5f8,_0x2d206e){return db[_0x6829('0x1d')][_0x6829('0x2a')](_0x3e6513[_0x6829('0x28')],{'raw':_0x3e6513[_0x6829('0x1f')]?_0x3e6513['options'][_0x6829('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6513[_0x6829('0x1f')]?_0x3e6513['options']['where']||null:null,'attributes':_0x3e6513['options']?_0x3e6513[_0x6829('0x1f')]['attributes']||null:null,'limit':_0x3e6513[_0x6829('0x1f')]?_0x3e6513[_0x6829('0x1f')][_0x6829('0x22')]||null:null})[_0x6829('0x10')](function(_0x29f84a){logger[_0x6829('0x11')](_0x6829('0x29'),_0x3e6513);logger[_0x6829('0x14')](_0x6829('0x29'),_0x3e6513,JSON[_0x6829('0x16')](_0x29f84a));_0x48e5f8(_0x29f84a);})['catch'](function(_0x47ebde){logger[_0x6829('0x17')](_0x6829('0x29'),_0x47ebde['message'],_0x3e6513);_0x2d206e(_0x4a56a3[_0x6829('0x17')](0x1f4,_0x47ebde['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 86601e9..69f1939 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 _0x44c5=['emit','length','save','remove'];(function(_0xce2a29,_0x1018b9){var _0x3a1751=function(_0x48956b){while(--_0x48956b){_0xce2a29['push'](_0xce2a29['shift']());}};_0x3a1751(++_0x1018b9);}(_0x44c5,0xee));var _0x544c=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x44c5[_0xac151d];return _0x111dba;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x544c('0x0'),_0x544c('0x1'),'update'];function createListener(_0x947602,_0x3b9f08){return function(_0xf37e1){_0x3b9f08[_0x544c('0x2')](_0x947602,_0xf37e1);};}function removeListener(_0x18405a,_0xcff546){return function(){VoiceQueueReportEvents['removeListener'](_0x18405a,_0xcff546);};}exports['register']=function(_0x4d4614){for(var _0x5a22b4=0x0,_0x392a01=events[_0x544c('0x3')];_0x5a22b4<_0x392a01;_0x5a22b4++){var _0x770f69=events[_0x5a22b4];var _0x19046f=createListener('voiceQueueReport:'+_0x770f69,_0x4d4614);VoiceQueueReportEvents['on'](_0x770f69,_0x19046f);}}; \ No newline at end of file +var _0x1931=['update','emit','removeListener','length','voiceQueueReport:'];(function(_0x7bfab4,_0x92e7b0){var _0x2df1bd=function(_0x2d85f6){while(--_0x2d85f6){_0x7bfab4['push'](_0x7bfab4['shift']());}};_0x2df1bd(++_0x92e7b0);}(_0x1931,0x6e));var _0x1193=function(_0x48ddba,_0x4344c9){_0x48ddba=_0x48ddba-0x0;var _0x260f2f=_0x1931[_0x48ddba];return _0x260f2f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove',_0x1193('0x0')];function createListener(_0x483b55,_0x52d8a4){return function(_0x46c6de){_0x52d8a4[_0x1193('0x1')](_0x483b55,_0x46c6de);};}function removeListener(_0x594fc5,_0x2dab83){return function(){VoiceQueueReportEvents[_0x1193('0x2')](_0x594fc5,_0x2dab83);};}exports['register']=function(_0x16c761){for(var _0x63eaf3=0x0,_0x4eb90d=events[_0x1193('0x3')];_0x63eaf3<_0x4eb90d;_0x63eaf3++){var _0x57b0f8=events[_0x63eaf3];var _0x3ca344=createListener(_0x1193('0x4')+_0x57b0f8,_0x16c761);VoiceQueueReportEvents['on'](_0x57b0f8,_0x3ca344);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c9bd63c..6b7e8cc 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 _0x5b2e=['create','put','update','destroy','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post'];(function(_0x58a239,_0x4b5d29){var _0x3ba432=function(_0xda4381){while(--_0xda4381){_0x58a239['push'](_0x58a239['shift']());}};_0x3ba432(++_0x4b5d29);}(_0x5b2e,0xe5));var _0xe5b2=function(_0x112dc0,_0x593c7d){_0x112dc0=_0x112dc0-0x0;var _0x23afc0=_0x5b2e[_0x112dc0];return _0x23afc0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe5b2('0x0'));var express=require(_0xe5b2('0x1'));var router=express[_0xe5b2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe5b2('0x3'));var config=require(_0xe5b2('0x4'));var controller=require(_0xe5b2('0x5'));router[_0xe5b2('0x6')]('/',auth[_0xe5b2('0x7')](),controller['index']);router[_0xe5b2('0x6')](_0xe5b2('0x8'),auth[_0xe5b2('0x7')](),controller[_0xe5b2('0x9')]);router[_0xe5b2('0xa')]('/',auth['isAuthenticated'](),controller[_0xe5b2('0xb')]);router[_0xe5b2('0xc')](_0xe5b2('0x8'),auth[_0xe5b2('0x7')](),controller[_0xe5b2('0xd')]);router['delete'](_0xe5b2('0x8'),auth['isAuthenticated'](),controller[_0xe5b2('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf2ee=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','multer','util','express','Router','../../components/auth/service'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xf2ee,0x182));var _0xef2e=function(_0x3144d5,_0x56d504){_0x3144d5=_0x3144d5-0x0;var _0x4c0db2=_0xf2ee[_0x3144d5];return _0x4c0db2;};'use strict';var multer=require(_0xef2e('0x0'));var util=require(_0xef2e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xef2e('0x2'));var router=express[_0xef2e('0x3')]();var auth=require(_0xef2e('0x4'));var interaction=require(_0xef2e('0x5'));var config=require(_0xef2e('0x6'));var controller=require(_0xef2e('0x7'));router['get']('/',auth[_0xef2e('0x8')](),controller[_0xef2e('0x9')]);router[_0xef2e('0xa')](_0xef2e('0xb'),auth['isAuthenticated'](),controller[_0xef2e('0xc')]);router['post']('/',auth[_0xef2e('0x8')](),controller[_0xef2e('0xd')]);router[_0xef2e('0xe')](_0xef2e('0xb'),auth['isAuthenticated'](),controller[_0xef2e('0xf')]);router[_0xef2e('0x10')]('/:id',auth[_0xef2e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ef31d4b..3ec3f53 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 _0x67bd=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING','DATE','format'];(function(_0x4851ff,_0x1c9a8d){var _0x26773b=function(_0x26c33e){while(--_0x26c33e){_0x4851ff['push'](_0x4851ff['shift']());}};_0x26773b(++_0x1c9a8d);}(_0x67bd,0x11b));var _0xd67b=function(_0x28bb7d,_0xbcd07f){_0x28bb7d=_0x28bb7d-0x0;var _0x40f4da=_0x67bd[_0x28bb7d];return _0x40f4da;};'use strict';var Sequelize=require(_0xd67b('0x0'));var moment=require(_0xd67b('0x1'));module['exports']={'time':{'type':Sequelize[_0xd67b('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd67b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd67b('0x3')],'allowNull':![],'defaultValue':moment()[_0xd67b('0x4')](_0xd67b('0x5'))}}; \ No newline at end of file +var _0x07ba=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','DATE'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x07ba,0x1ba));var _0xa07b=function(_0x1fe1fe,_0x20f8e5){_0x1fe1fe=_0x1fe1fe-0x0;var _0x574788=_0x07ba[_0x1fe1fe];return _0x574788;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xa07b('0x0')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa07b('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa07b('0x1')],'allowNull':![],'defaultValue':moment()[_0xa07b('0x2')](_0xa07b('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 21c5595..c191ff1 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 _0xdf02=['filters','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xdf02,0xde));var _0x2df0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xdf02[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x2df0('0x0'));var emlformat=require(_0x2df0('0x1'));var rimraf=require(_0x2df0('0x2'));var zipdir=require(_0x2df0('0x3'));var jsonpatch=require(_0x2df0('0x4'));var rp=require(_0x2df0('0x5'));var moment=require(_0x2df0('0x6'));var BPromise=require(_0x2df0('0x7'));var Mustache=require('mustache');var util=require(_0x2df0('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2df0('0x9'));var ejs=require(_0x2df0('0xa'));var fs=require('fs');var _=require(_0x2df0('0xb'));var squel=require(_0x2df0('0xc'));var crypto=require(_0x2df0('0xd'));var jsforce=require(_0x2df0('0xe'));var deskjs=require(_0x2df0('0xf'));var toCsv=require(_0x2df0('0x9'));var querystring=require('querystring');var Papa=require(_0x2df0('0x10'));var Redis=require(_0x2df0('0x11'));var authService=require(_0x2df0('0x12'));var qs=require(_0x2df0('0x13'));var as=require(_0x2df0('0x14'));var hardwareService=require(_0x2df0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2df0('0x16'));var config=require(_0x2df0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2df0('0x18'))['db'];function respondWithStatusCode(_0x29be7b,_0x21b32c){_0x21b32c=_0x21b32c||0xcc;return function(_0x55f8c1){if(_0x55f8c1){return _0x29be7b[_0x2df0('0x19')](_0x21b32c);}return _0x29be7b['status'](_0x21b32c)[_0x2df0('0x1a')]();};}function respondWithResult(_0xafb1cd,_0x2c3da0){_0x2c3da0=_0x2c3da0||0xc8;return function(_0x15d649){if(_0x15d649){return _0xafb1cd[_0x2df0('0x1b')](_0x2c3da0)[_0x2df0('0x1c')](_0x15d649);}};}function respondWithFilteredResult(_0x24ba73,_0xed70c1){return function(_0x2e3d14){if(_0x2e3d14){var _0x2e1202=_0x2e3d14[_0x2df0('0x1d')],_0x57b0b4=_0xed70c1[_0x2df0('0x1e')],_0x5a481b=_0xed70c1[_0x2df0('0x1e')]+_0xed70c1['limit'],_0x5a0978;if(_0x5a481b>=_0x2e1202){_0x5a481b=_0x2e1202;_0x5a0978=0xc8;}else{_0x5a0978=0xce;}_0x24ba73['status'](_0x5a0978);return _0x24ba73[_0x2df0('0x1f')](_0x2df0('0x20'),_0x57b0b4+'-'+_0x5a481b+'/'+_0x2e1202)[_0x2df0('0x1c')](_0x2e3d14);}return null;};}function patchUpdates(_0x396ff3){return function(_0x5a5ef3){try{jsonpatch['apply'](_0x5a5ef3,_0x396ff3,!![]);}catch(_0x41944e){return BPromise['reject'](_0x41944e);}return _0x5a5ef3['save']();};}function saveUpdates(_0x1adad8,_0x193d42){return function(_0x89b69c){if(_0x89b69c){return _0x89b69c['update'](_0x1adad8)[_0x2df0('0x21')](function(_0x49e50c){return _0x49e50c;});}return null;};}function removeEntity(_0x150d8a,_0x2d4f10){return function(_0x1b7802){if(_0x1b7802){return _0x1b7802[_0x2df0('0x22')]()['then'](function(){_0x150d8a[_0x2df0('0x1b')](0xcc)[_0x2df0('0x1a')]();});}};}function handleEntityNotFound(_0x3849bb,_0xaf4f02){return function(_0x5e6c2d){if(!_0x5e6c2d){_0x3849bb[_0x2df0('0x19')](0x194);}return _0x5e6c2d;};}function handleError(_0x21e2a0,_0x473477){_0x473477=_0x473477||0x1f4;return function(_0x5ddd06){logger[_0x2df0('0x23')](_0x5ddd06[_0x2df0('0x24')]);if(_0x5ddd06[_0x2df0('0x25')]){delete _0x5ddd06['name'];}_0x21e2a0[_0x2df0('0x1b')](_0x473477)[_0x2df0('0x26')](_0x5ddd06);};}exports[_0x2df0('0x27')]=function(_0x1c4694,_0x46f437){var _0x3e070d={},_0x498912={},_0x32f32b={'count':0x0,'rows':[]};var _0x3eb1b0=_[_0x2df0('0x28')](db[_0x2df0('0x29')][_0x2df0('0x2a')],function(_0x6065e4){return{'name':_0x6065e4[_0x2df0('0x2b')],'type':_0x6065e4[_0x2df0('0x2c')][_0x2df0('0x2d')]};});_0x498912[_0x2df0('0x2e')]=_[_0x2df0('0x28')](_0x3eb1b0,'name');_0x498912[_0x2df0('0x2f')]=_[_0x2df0('0x30')](_0x1c4694['query']);_0x498912['filters']=_[_0x2df0('0x31')](_0x498912[_0x2df0('0x2e')],_0x498912['query']);_0x3e070d[_0x2df0('0x32')]=_[_0x2df0('0x31')](_0x498912[_0x2df0('0x2e')],qs[_0x2df0('0x33')](_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x33')]));_0x3e070d[_0x2df0('0x32')]=_0x3e070d['attributes'][_0x2df0('0x34')]?_0x3e070d[_0x2df0('0x32')]:_0x498912['model'];if(!_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x35')]('nolimit')){_0x3e070d[_0x2df0('0x36')]=qs[_0x2df0('0x36')](_0x1c4694[_0x2df0('0x2f')]['limit']);_0x3e070d['offset']=qs[_0x2df0('0x1e')](_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x1e')]);}_0x3e070d[_0x2df0('0x37')]=qs[_0x2df0('0x38')](_0x1c4694['query'][_0x2df0('0x38')]);_0x3e070d[_0x2df0('0x39')]=qs['filters'](_[_0x2df0('0x3a')](_0x1c4694[_0x2df0('0x2f')],_0x498912['filters']),_0x3eb1b0);if(_0x1c4694['query'][_0x2df0('0x3b')]){_0x3e070d[_0x2df0('0x39')]=_[_0x2df0('0x3c')](_0x3e070d[_0x2df0('0x39')],{'$or':_[_0x2df0('0x28')](_0x3eb1b0,function(_0x3cb7d7){if(_0x3cb7d7[_0x2df0('0x2c')]!==_0x2df0('0x3d')){var _0x35ff5e={};_0x35ff5e[_0x3cb7d7['name']]={'$like':'%'+_0x1c4694['query']['filter']+'%'};return _0x35ff5e;}})});}_0x3e070d=_['merge']({},_0x3e070d,_0x1c4694['options']);var _0x51fd47={'where':_0x3e070d['where']};return db[_0x2df0('0x29')][_0x2df0('0x1d')](_0x51fd47)[_0x2df0('0x21')](function(_0x1a194e){_0x32f32b['count']=_0x1a194e;if(_0x1c4694[_0x2df0('0x2f')][_0x2df0('0x3e')]){_0x3e070d[_0x2df0('0x3f')]=[{'all':!![]}];}return db[_0x2df0('0x29')][_0x2df0('0x40')](_0x3e070d);})[_0x2df0('0x21')](function(_0xcfadf){_0x32f32b['rows']=_0xcfadf;return _0x32f32b;})[_0x2df0('0x21')](respondWithFilteredResult(_0x46f437,_0x3e070d))['catch'](handleError(_0x46f437,null));};exports[_0x2df0('0x41')]=function(_0x617172,_0xcb2202){var _0x3ecf38={'raw':!![],'where':{'id':_0x617172['params']['id']}},_0x20c478={};_0x20c478[_0x2df0('0x2e')]=_[_0x2df0('0x30')](db[_0x2df0('0x29')][_0x2df0('0x2a')]);_0x20c478[_0x2df0('0x2f')]=_[_0x2df0('0x30')](_0x617172['query']);_0x20c478[_0x2df0('0x42')]=_[_0x2df0('0x31')](_0x20c478[_0x2df0('0x2e')],_0x20c478[_0x2df0('0x2f')]);_0x3ecf38['attributes']=_[_0x2df0('0x31')](_0x20c478[_0x2df0('0x2e')],qs[_0x2df0('0x33')](_0x617172['query'][_0x2df0('0x33')]));_0x3ecf38[_0x2df0('0x32')]=_0x3ecf38['attributes'][_0x2df0('0x34')]?_0x3ecf38[_0x2df0('0x32')]:_0x20c478[_0x2df0('0x2e')];if(_0x617172[_0x2df0('0x2f')][_0x2df0('0x3e')]){_0x3ecf38[_0x2df0('0x3f')]=[{'all':!![]}];}_0x3ecf38=_[_0x2df0('0x3c')]({},_0x3ecf38,_0x617172['options']);return db[_0x2df0('0x29')][_0x2df0('0x43')](_0x3ecf38)['then'](handleEntityNotFound(_0xcb2202,null))[_0x2df0('0x21')](respondWithResult(_0xcb2202,null))[_0x2df0('0x44')](handleError(_0xcb2202,null));};exports['create']=function(_0x1b25b7,_0x4f93b5){return db[_0x2df0('0x29')][_0x2df0('0x45')](_0x1b25b7[_0x2df0('0x46')],{})[_0x2df0('0x21')](respondWithResult(_0x4f93b5,0xc9))[_0x2df0('0x44')](handleError(_0x4f93b5,null));};exports['update']=function(_0x19a3d2,_0x4c5543){if(_0x19a3d2[_0x2df0('0x46')]['id']){delete _0x19a3d2[_0x2df0('0x46')]['id'];}return db['VoiceQueuesLog'][_0x2df0('0x43')]({'where':{'id':_0x19a3d2['params']['id']}})['then'](handleEntityNotFound(_0x4c5543,null))['then'](saveUpdates(_0x19a3d2[_0x2df0('0x46')],null))[_0x2df0('0x21')](respondWithResult(_0x4c5543,null))[_0x2df0('0x44')](handleError(_0x4c5543,null));};exports[_0x2df0('0x22')]=function(_0x51795f,_0xbacf5){return db[_0x2df0('0x29')]['find']({'where':{'id':_0x51795f[_0x2df0('0x47')]['id']}})['then'](handleEntityNotFound(_0xbacf5,null))[_0x2df0('0x21')](removeEntity(_0xbacf5,null))[_0x2df0('0x44')](handleError(_0xbacf5,null));}; \ No newline at end of file +var _0xae5a=['hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1b6264,_0x492f31){var _0x356918=function(_0x2c489d){while(--_0x2c489d){_0x1b6264['push'](_0x1b6264['shift']());}};_0x356918(++_0x492f31);}(_0xae5a,0x189));var _0xaae5=function(_0x2bcf12,_0x4d34d0){_0x2bcf12=_0x2bcf12-0x0;var _0x355afc=_0xae5a[_0x2bcf12];return _0x355afc;};'use strict';var pdf=require(_0xaae5('0x0'));var emlformat=require(_0xaae5('0x1'));var rimraf=require(_0xaae5('0x2'));var zipdir=require(_0xaae5('0x3'));var jsonpatch=require(_0xaae5('0x4'));var rp=require(_0xaae5('0x5'));var moment=require(_0xaae5('0x6'));var BPromise=require(_0xaae5('0x7'));var Mustache=require(_0xaae5('0x8'));var util=require(_0xaae5('0x9'));var path=require('path');var sox=require(_0xaae5('0xa'));var csv=require(_0xaae5('0xb'));var ejs=require(_0xaae5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaae5('0xd'));var crypto=require(_0xaae5('0xe'));var jsforce=require(_0xaae5('0xf'));var deskjs=require(_0xaae5('0x10'));var toCsv=require(_0xaae5('0xb'));var querystring=require(_0xaae5('0x11'));var Papa=require('papaparse');var Redis=require(_0xaae5('0x12'));var authService=require(_0xaae5('0x13'));var qs=require(_0xaae5('0x14'));var as=require(_0xaae5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaae5('0x16'));var utils=require(_0xaae5('0x17'));var config=require(_0xaae5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaae5('0x19'))['db'];function respondWithStatusCode(_0x5bb109,_0x4ae09d){_0x4ae09d=_0x4ae09d||0xcc;return function(_0x29f82c){if(_0x29f82c){return _0x5bb109['sendStatus'](_0x4ae09d);}return _0x5bb109[_0xaae5('0x1a')](_0x4ae09d)['end']();};}function respondWithResult(_0x18f1e3,_0x59eaa1){_0x59eaa1=_0x59eaa1||0xc8;return function(_0x4bd46a){if(_0x4bd46a){return _0x18f1e3['status'](_0x59eaa1)['json'](_0x4bd46a);}};}function respondWithFilteredResult(_0x4c19f1,_0x1311d8){return function(_0x11e53c){if(_0x11e53c){var _0x30e86f=_0x11e53c[_0xaae5('0x1b')],_0x4d9daa=_0x1311d8[_0xaae5('0x1c')],_0x22a759=_0x1311d8[_0xaae5('0x1c')]+_0x1311d8[_0xaae5('0x1d')],_0x4bd879;if(_0x22a759>=_0x30e86f){_0x22a759=_0x30e86f;_0x4bd879=0xc8;}else{_0x4bd879=0xce;}_0x4c19f1[_0xaae5('0x1a')](_0x4bd879);return _0x4c19f1[_0xaae5('0x1e')](_0xaae5('0x1f'),_0x4d9daa+'-'+_0x22a759+'/'+_0x30e86f)['json'](_0x11e53c);}return null;};}function patchUpdates(_0x14b2f2){return function(_0x416829){try{jsonpatch[_0xaae5('0x20')](_0x416829,_0x14b2f2,!![]);}catch(_0x369b92){return BPromise[_0xaae5('0x21')](_0x369b92);}return _0x416829[_0xaae5('0x22')]();};}function saveUpdates(_0x28f04a,_0x6c9048){return function(_0xcb8e47){if(_0xcb8e47){return _0xcb8e47[_0xaae5('0x23')](_0x28f04a)[_0xaae5('0x24')](function(_0x57808d){return _0x57808d;});}return null;};}function removeEntity(_0x5afe4c,_0x126292){return function(_0x569d3b){if(_0x569d3b){return _0x569d3b['destroy']()[_0xaae5('0x24')](function(){_0x5afe4c[_0xaae5('0x1a')](0xcc)[_0xaae5('0x25')]();});}};}function handleEntityNotFound(_0x2c5ce9,_0x125613){return function(_0x3c0575){if(!_0x3c0575){_0x2c5ce9[_0xaae5('0x26')](0x194);}return _0x3c0575;};}function handleError(_0x129185,_0x277b1f){_0x277b1f=_0x277b1f||0x1f4;return function(_0x493593){logger[_0xaae5('0x27')](_0x493593[_0xaae5('0x28')]);if(_0x493593['name']){delete _0x493593[_0xaae5('0x29')];}_0x129185[_0xaae5('0x1a')](_0x277b1f)[_0xaae5('0x2a')](_0x493593);};}exports[_0xaae5('0x2b')]=function(_0xcd6855,_0x3336ee){var _0x115220={},_0x29c324={},_0x17594f={'count':0x0,'rows':[]};var _0x434d34=_[_0xaae5('0x2c')](db[_0xaae5('0x2d')][_0xaae5('0x2e')],function(_0x416145){return{'name':_0x416145['fieldName'],'type':_0x416145[_0xaae5('0x2f')][_0xaae5('0x30')]};});_0x29c324[_0xaae5('0x31')]=_[_0xaae5('0x2c')](_0x434d34,_0xaae5('0x29'));_0x29c324[_0xaae5('0x32')]=_[_0xaae5('0x33')](_0xcd6855[_0xaae5('0x32')]);_0x29c324[_0xaae5('0x34')]=_[_0xaae5('0x35')](_0x29c324[_0xaae5('0x31')],_0x29c324[_0xaae5('0x32')]);_0x115220[_0xaae5('0x36')]=_[_0xaae5('0x35')](_0x29c324[_0xaae5('0x31')],qs['fields'](_0xcd6855[_0xaae5('0x32')][_0xaae5('0x37')]));_0x115220[_0xaae5('0x36')]=_0x115220[_0xaae5('0x36')][_0xaae5('0x38')]?_0x115220[_0xaae5('0x36')]:_0x29c324['model'];if(!_0xcd6855[_0xaae5('0x32')][_0xaae5('0x39')](_0xaae5('0x3a'))){_0x115220[_0xaae5('0x1d')]=qs[_0xaae5('0x1d')](_0xcd6855[_0xaae5('0x32')][_0xaae5('0x1d')]);_0x115220['offset']=qs[_0xaae5('0x1c')](_0xcd6855[_0xaae5('0x32')][_0xaae5('0x1c')]);}_0x115220[_0xaae5('0x3b')]=qs['sort'](_0xcd6855['query']['sort']);_0x115220['where']=qs[_0xaae5('0x34')](_['pick'](_0xcd6855[_0xaae5('0x32')],_0x29c324[_0xaae5('0x34')]),_0x434d34);if(_0xcd6855[_0xaae5('0x32')][_0xaae5('0x3c')]){_0x115220[_0xaae5('0x3d')]=_['merge'](_0x115220[_0xaae5('0x3d')],{'$or':_[_0xaae5('0x2c')](_0x434d34,function(_0x3fe572){if(_0x3fe572[_0xaae5('0x2f')]!==_0xaae5('0x3e')){var _0x229ee4={};_0x229ee4[_0x3fe572[_0xaae5('0x29')]]={'$like':'%'+_0xcd6855[_0xaae5('0x32')][_0xaae5('0x3c')]+'%'};return _0x229ee4;}})});}_0x115220=_[_0xaae5('0x3f')]({},_0x115220,_0xcd6855[_0xaae5('0x40')]);var _0x2b8f24={'where':_0x115220[_0xaae5('0x3d')]};return db[_0xaae5('0x2d')][_0xaae5('0x1b')](_0x2b8f24)['then'](function(_0x5a7379){_0x17594f['count']=_0x5a7379;if(_0xcd6855['query'][_0xaae5('0x41')]){_0x115220['include']=[{'all':!![]}];}return db[_0xaae5('0x2d')][_0xaae5('0x42')](_0x115220);})['then'](function(_0x1a3bd4){_0x17594f[_0xaae5('0x43')]=_0x1a3bd4;return _0x17594f;})[_0xaae5('0x24')](respondWithFilteredResult(_0x3336ee,_0x115220))[_0xaae5('0x44')](handleError(_0x3336ee,null));};exports[_0xaae5('0x45')]=function(_0x64fb8e,_0x893716){var _0x4f8566={'raw':!![],'where':{'id':_0x64fb8e[_0xaae5('0x46')]['id']}},_0x875c96={};_0x875c96[_0xaae5('0x31')]=_['keys'](db[_0xaae5('0x2d')][_0xaae5('0x2e')]);_0x875c96[_0xaae5('0x32')]=_[_0xaae5('0x33')](_0x64fb8e[_0xaae5('0x32')]);_0x875c96[_0xaae5('0x34')]=_[_0xaae5('0x35')](_0x875c96[_0xaae5('0x31')],_0x875c96[_0xaae5('0x32')]);_0x4f8566[_0xaae5('0x36')]=_[_0xaae5('0x35')](_0x875c96[_0xaae5('0x31')],qs['fields'](_0x64fb8e[_0xaae5('0x32')]['fields']));_0x4f8566['attributes']=_0x4f8566['attributes'][_0xaae5('0x38')]?_0x4f8566['attributes']:_0x875c96[_0xaae5('0x31')];if(_0x64fb8e[_0xaae5('0x32')][_0xaae5('0x41')]){_0x4f8566[_0xaae5('0x47')]=[{'all':!![]}];}_0x4f8566=_[_0xaae5('0x3f')]({},_0x4f8566,_0x64fb8e[_0xaae5('0x40')]);return db[_0xaae5('0x2d')][_0xaae5('0x48')](_0x4f8566)[_0xaae5('0x24')](handleEntityNotFound(_0x893716,null))[_0xaae5('0x24')](respondWithResult(_0x893716,null))[_0xaae5('0x44')](handleError(_0x893716,null));};exports['create']=function(_0x2f4b49,_0x36950f){return db[_0xaae5('0x2d')][_0xaae5('0x49')](_0x2f4b49[_0xaae5('0x4a')],{})[_0xaae5('0x24')](respondWithResult(_0x36950f,0xc9))[_0xaae5('0x44')](handleError(_0x36950f,null));};exports[_0xaae5('0x23')]=function(_0x51f273,_0x3b911a){if(_0x51f273[_0xaae5('0x4a')]['id']){delete _0x51f273[_0xaae5('0x4a')]['id'];}return db[_0xaae5('0x2d')][_0xaae5('0x48')]({'where':{'id':_0x51f273['params']['id']}})[_0xaae5('0x24')](handleEntityNotFound(_0x3b911a,null))['then'](saveUpdates(_0x51f273[_0xaae5('0x4a')],null))[_0xaae5('0x24')](respondWithResult(_0x3b911a,null))[_0xaae5('0x44')](handleError(_0x3b911a,null));};exports['destroy']=function(_0x25a908,_0x2fe1e4){return db[_0xaae5('0x2d')]['find']({'where':{'id':_0x25a908[_0xaae5('0x46')]['id']}})[_0xaae5('0x24')](handleEntityNotFound(_0x2fe1e4,null))['then'](removeEntity(_0x2fe1e4,null))[_0xaae5('0x44')](handleError(_0x2fe1e4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9db014a..9ad66f7 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 _0x1c66=['../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xfd4429,_0x1007cf){var _0x33be1f=function(_0x4af17b){while(--_0x4af17b){_0xfd4429['push'](_0xfd4429['shift']());}};_0x33be1f(++_0x1007cf);}(_0x1c66,0x111));var _0x61c6=function(_0xf8bd35,_0x33d303){_0xf8bd35=_0xf8bd35-0x0;var _0x5ce044=_0x1c66[_0xf8bd35];return _0x5ce044;};'use strict';var _=require(_0x61c6('0x0'));var util=require('util');var logger=require(_0x61c6('0x1'))(_0x61c6('0x2'));var moment=require(_0x61c6('0x3'));var BPromise=require('bluebird');var rp=require(_0x61c6('0x4'));var fs=require('fs');var path=require(_0x61c6('0x5'));var rimraf=require(_0x61c6('0x6'));var config=require(_0x61c6('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x61c6('0x8')]=function(_0x36bf54,_0x4e6391){return _0x36bf54[_0x61c6('0x9')](_0x61c6('0xa'),attributes,{'tableName':_0x61c6('0xb'),'paranoid':![],'indexes':[{'name':_0x61c6('0xc'),'fields':['event',_0x61c6('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9f06=['util','api','moment','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','dtm'];(function(_0x459349,_0x2e6797){var _0x35de00=function(_0x1f5a19){while(--_0x1f5a19){_0x459349['push'](_0x459349['shift']());}};_0x35de00(++_0x2e6797);}(_0x9f06,0x6c));var _0x69f0=function(_0x1a68dd,_0x30475d){_0x1a68dd=_0x1a68dd-0x0;var _0x45b421=_0x9f06[_0x1a68dd];return _0x45b421;};'use strict';var _=require('lodash');var util=require(_0x69f0('0x0'));var logger=require('../../config/logger')(_0x69f0('0x1'));var moment=require(_0x69f0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x69f0('0x3'));var rimraf=require(_0x69f0('0x4'));var config=require(_0x69f0('0x5'));var attributes=require(_0x69f0('0x6'));module[_0x69f0('0x7')]=function(_0x1a4cca,_0x2e5695){return _0x1a4cca['define'](_0x69f0('0x8'),attributes,{'tableName':_0x69f0('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x69f0('0xa'),_0x69f0('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fea64b5..9f89034 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 _0xbee3=['error','code','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x3937f7,_0xdc51f){var _0x5327a8=function(_0x1cecdb){while(--_0x1cecdb){_0x3937f7['push'](_0x3937f7['shift']());}};_0x5327a8(++_0xdc51f);}(_0xbee3,0xd5));var _0x3bee=function(_0x32c37e,_0x36bbe2){_0x32c37e=_0x32c37e-0x0;var _0x5dffd5=_0xbee3[_0x32c37e];return _0x5dffd5;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});} \ No newline at end of file +var _0x3de3=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x406ae7,_0x12181b){var _0x5a5b9d=function(_0x3f20c2){while(--_0x3f20c2){_0x406ae7['push'](_0x406ae7['shift']());}};_0x5a5b9d(++_0x12181b);}(_0x3de3,0x1ce));var _0x33de=function(_0x2fcb41,_0x213d5c){_0x2fcb41=_0x2fcb41-0x0;var _0x511678=_0x3de3[_0x2fcb41];return _0x511678;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1dab609..08db049 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 _0x754e=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','download','/:id/downloads','downloadTranscribe','post','/:id/transcribe','runTranscribe','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x57c77d,_0x46f365){var _0x3bf677=function(_0x410ad2){while(--_0x410ad2){_0x57c77d['push'](_0x57c77d['shift']());}};_0x3bf677(++_0x46f365);}(_0x754e,0x170));var _0xe754=function(_0x5cf9af,_0x304bca){_0x5cf9af=_0x5cf9af-0x0;var _0x229e21=_0x754e[_0x5cf9af];return _0x229e21;};'use strict';var multer=require('multer');var util=require(_0xe754('0x0'));var path=require(_0xe754('0x1'));var timeout=require(_0xe754('0x2'));var express=require(_0xe754('0x3'));var router=express[_0xe754('0x4')]();var auth=require(_0xe754('0x5'));var interaction=require(_0xe754('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xe754('0x7')]('/',auth[_0xe754('0x8')](),controller[_0xe754('0x9')]);router[_0xe754('0x7')](_0xe754('0xa'),auth[_0xe754('0x8')](),controller['describe']);router[_0xe754('0x7')](_0xe754('0xb'),auth[_0xe754('0x8')](),controller[_0xe754('0xc')]);router['get']('/:id/download',auth[_0xe754('0x8')](),controller[_0xe754('0xd')]);router[_0xe754('0x7')](_0xe754('0xe'),controller['downloads']);router[_0xe754('0x7')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xe754('0xf')]);router[_0xe754('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe754('0x10')](_0xe754('0x11'),auth[_0xe754('0x8')](),controller[_0xe754('0x12')]);router[_0xe754('0x13')](_0xe754('0xb'),auth[_0xe754('0x8')](),controller[_0xe754('0x14')]);router['delete'](_0xe754('0xb'),auth[_0xe754('0x8')](),controller['destroy']);module[_0xe754('0x15')]=router; \ No newline at end of file +var _0xb81f=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe'];(function(_0x3ae4dc,_0x38dc2e){var _0x24bc2a=function(_0x93c78f){while(--_0x93c78f){_0x3ae4dc['push'](_0x3ae4dc['shift']());}};_0x24bc2a(++_0x38dc2e);}(_0xb81f,0x1e0));var _0xfb81=function(_0x1080a7,_0xf71d1f){_0x1080a7=_0x1080a7-0x0;var _0x42e2fe=_0xb81f[_0x1080a7];return _0x42e2fe;};'use strict';var multer=require(_0xfb81('0x0'));var util=require(_0xfb81('0x1'));var path=require(_0xfb81('0x2'));var timeout=require(_0xfb81('0x3'));var express=require(_0xfb81('0x4'));var router=express[_0xfb81('0x5')]();var auth=require(_0xfb81('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb81('0x7'));var controller=require(_0xfb81('0x8'));router[_0xfb81('0x9')]('/',auth[_0xfb81('0xa')](),controller['index']);router[_0xfb81('0x9')](_0xfb81('0xb'),auth['isAuthenticated'](),controller[_0xfb81('0xc')]);router['get']('/:id',auth[_0xfb81('0xa')](),controller['show']);router[_0xfb81('0x9')](_0xfb81('0xd'),auth[_0xfb81('0xa')](),controller['download']);router[_0xfb81('0x9')](_0xfb81('0xe'),controller[_0xfb81('0xf')]);router['get'](_0xfb81('0x10'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xfb81('0x11')]('/',auth[_0xfb81('0xa')](),controller[_0xfb81('0x12')]);router[_0xfb81('0x11')](_0xfb81('0x10'),auth[_0xfb81('0xa')](),controller[_0xfb81('0x13')]);router[_0xfb81('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfb81('0x15')](_0xfb81('0x16'),auth[_0xfb81('0xa')](),controller[_0xfb81('0x17')]);module[_0xfb81('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 51319b6..16268e7 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 _0xa794=['BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize','exports','value','extname','getDataValue','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','FLOAT'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xa794,0x1d3));var _0x4a79=function(_0x15db23,_0x38bc06){_0x15db23=_0x15db23-0x0;var _0x4ce327=_0xa794[_0x15db23];return _0x4ce327;};'use strict';var Sequelize=require(_0x4a79('0x0'));var moment=require('moment');var path=require('path');module[_0x4a79('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x4a79('0x2'))?path[_0x4a79('0x3')](this[_0x4a79('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4a79('0x5')],'set':function(_0x2b28ec){if(_0x2b28ec){this[_0x4a79('0x6')](_0x4a79('0x7'),_0x2b28ec);this[_0x4a79('0x6')](_0x4a79('0x8'),_0x2b28ec[_0x4a79('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x4a79('0x5')]},'calleridnum':{'type':Sequelize[_0x4a79('0x5')]},'calleridname':{'type':Sequelize[_0x4a79('0x5')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4a79('0x5')]},'accountcode':{'type':Sequelize[_0x4a79('0x5')]},'context':{'type':Sequelize[_0x4a79('0x5')]},'exten':{'type':Sequelize[_0x4a79('0x5')]},'value':{'type':Sequelize[_0x4a79('0x5')]},'type':{'type':Sequelize[_0x4a79('0x5')]},'rating':{'type':Sequelize[_0x4a79('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x4a79('0x5')]},'userDisposition':{'type':Sequelize[_0x4a79('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x4a79('0x5')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x4a79('0xb')]},'transcribeName':{'type':Sequelize[_0x4a79('0x5')]},'transcribeStatus':{'type':Sequelize[_0x4a79('0x5')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x4a79('0xb')]},'fileText':{'type':Sequelize[_0x4a79('0xb')]},'failureReason':{'type':Sequelize[_0x4a79('0xb')]},'sentiment':{'type':Sequelize[_0x4a79('0x5')]},'sPositive':{'type':Sequelize[_0x4a79('0xc')]},'sNegative':{'type':Sequelize[_0x4a79('0xc')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x4a79('0xc')]},'tempSentiment':{'type':Sequelize[_0x4a79('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x4a79('0xe')],'get':function(){return moment(this[_0x4a79('0x4')](_0x4a79('0xf')))['format'](_0x4a79('0x10'))[_0x4a79('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4a79('0xe')],'get':function(){return moment(this[_0x4a79('0x4')](_0x4a79('0x12')))[_0x4a79('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x4a79('0x11')]();}}}; \ No newline at end of file +var _0xe427=['TEXT','FLOAT','DATE','createdAt','format','toString','MM-DD-YYYY\x20HH:mm','sequelize','exports','VIRTUAL','extname','getDataValue','value','STRING','setDataValue','channel','membername'];(function(_0x3b0295,_0x218b0b){var _0x2cdd32=function(_0x266ba0){while(--_0x266ba0){_0x3b0295['push'](_0x3b0295['shift']());}};_0x2cdd32(++_0x218b0b);}(_0xe427,0x1e3));var _0x7e42=function(_0xeaf2ab,_0x59c9b8){_0xeaf2ab=_0xeaf2ab-0x0;var _0x33422a=_0xe427[_0xeaf2ab];return _0x33422a;};'use strict';var Sequelize=require(_0x7e42('0x0'));var moment=require('moment');var path=require('path');module[_0x7e42('0x1')]={'format':{'type':Sequelize[_0x7e42('0x2')],'get':function(){return this['getDataValue']('value')?path[_0x7e42('0x3')](this[_0x7e42('0x4')](_0x7e42('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x7e42('0x6')]},'channel':{'type':Sequelize[_0x7e42('0x6')],'set':function(_0x4861ab){if(_0x4861ab){this[_0x7e42('0x7')](_0x7e42('0x8'),_0x4861ab);this['setDataValue'](_0x7e42('0x9'),_0x4861ab['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x7e42('0x6')]},'calleridnum':{'type':Sequelize[_0x7e42('0x6')]},'calleridname':{'type':Sequelize[_0x7e42('0x6')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7e42('0x6')]},'accountcode':{'type':Sequelize[_0x7e42('0x6')]},'context':{'type':Sequelize[_0x7e42('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7e42('0x6')]},'type':{'type':Sequelize[_0x7e42('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x7e42('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x7e42('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x7e42('0x6')]},'location':{'type':Sequelize[_0x7e42('0xa')]},'transcribeName':{'type':Sequelize[_0x7e42('0x6')]},'transcribeStatus':{'type':Sequelize[_0x7e42('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x7e42('0xa')]},'fileText':{'type':Sequelize[_0x7e42('0xa')]},'failureReason':{'type':Sequelize[_0x7e42('0xa')]},'sentiment':{'type':Sequelize[_0x7e42('0x6')]},'sPositive':{'type':Sequelize[_0x7e42('0xb')]},'sNegative':{'type':Sequelize[_0x7e42('0xb')]},'sNeutral':{'type':Sequelize[_0x7e42('0xb')]},'sMixed':{'type':Sequelize[_0x7e42('0xb')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x7e42('0xc')],'get':function(){return moment(this['getDataValue'](_0x7e42('0xd')))[_0x7e42('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x7e42('0xf')]();}},'updatedAt':{'type':Sequelize[_0x7e42('0xc')],'get':function(){return moment(this[_0x7e42('0x4')]('updatedAt'))[_0x7e42('0xe')](_0x7e42('0x10'))[_0x7e42('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index eac86e5..1516cee 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 _0xddd6=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','differenceBy','map','format','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','VoiceRecording','rows','catch','params','length','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','token','$and','push','Sequelize','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x28df03,_0x4428a3){var _0x66ea03=function(_0x32d567){while(--_0x32d567){_0x28df03['push'](_0x28df03['shift']());}};_0x66ea03(++_0x4428a3);}(_0xddd6,0x84));var _0x6ddd=function(_0xd6acc4,_0x29a17c){_0xd6acc4=_0xd6acc4-0x0;var _0x52ed4a=_0xddd6[_0xd6acc4];return _0x52ed4a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ddd('0x0'));var rp=require('request-promise');var moment=require(_0x6ddd('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ddd('0x2'));var path=require(_0x6ddd('0x3'));var sox=require('sox');var csv=require(_0x6ddd('0x4'));var ejs=require(_0x6ddd('0x5'));var fs=require('fs');var _=require(_0x6ddd('0x6'));var squel=require(_0x6ddd('0x7'));var crypto=require(_0x6ddd('0x8'));var jsforce=require(_0x6ddd('0x9'));var deskjs=require(_0x6ddd('0xa'));var toCsv=require(_0x6ddd('0x4'));var querystring=require(_0x6ddd('0xb'));var Papa=require(_0x6ddd('0xc'));var AWS=require(_0x6ddd('0xd'));var uuidv4=require(_0x6ddd('0xe'));var Redis=require(_0x6ddd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6ddd('0x10'));var as=require(_0x6ddd('0x11'));var hardwareService=require(_0x6ddd('0x12'));var logger=require(_0x6ddd('0x13'))(_0x6ddd('0x14'));var utils=require(_0x6ddd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab7528,_0x51a1f8){_0x51a1f8=_0x51a1f8||0xcc;return function(_0x2ddd04){if(_0x2ddd04){return _0xab7528[_0x6ddd('0x16')](_0x51a1f8);}return _0xab7528[_0x6ddd('0x17')](_0x51a1f8)['end']();};}function respondWithResult(_0x5a7f0c,_0x5d5124){_0x5d5124=_0x5d5124||0xc8;return function(_0x425a01){if(_0x425a01){return _0x5a7f0c[_0x6ddd('0x17')](_0x5d5124)[_0x6ddd('0x18')](_0x425a01);}};}function respondWithFilteredResult(_0x4663fe,_0x2b5a15){return function(_0x34caf9){if(_0x34caf9){var _0xf85329=_0x34caf9[_0x6ddd('0x19')],_0x419127=_0x2b5a15['offset'],_0x2b90cc=_0x2b5a15['offset']+_0x2b5a15[_0x6ddd('0x1a')],_0x17479a;if(_0x2b90cc>=_0xf85329){_0x2b90cc=_0xf85329;_0x17479a=0xc8;}else{_0x17479a=0xce;}_0x4663fe[_0x6ddd('0x17')](_0x17479a);return _0x4663fe['set'](_0x6ddd('0x1b'),_0x419127+'-'+_0x2b90cc+'/'+_0xf85329)['json'](_0x34caf9);}return null;};}function patchUpdates(_0x463e52){return function(_0x55dfc5){try{jsonpatch[_0x6ddd('0x1c')](_0x55dfc5,_0x463e52,!![]);}catch(_0x1d09d9){return BPromise[_0x6ddd('0x1d')](_0x1d09d9);}return _0x55dfc5[_0x6ddd('0x1e')]();};}function saveUpdates(_0x111783,_0x82f4bf){return function(_0x53ae8f){if(_0x53ae8f){return _0x53ae8f[_0x6ddd('0x1f')](_0x111783)[_0x6ddd('0x20')](function(_0x39a0c0){return _0x39a0c0;});}return null;};}function removeEntity(_0x476a8c,_0x27144e){return function(_0x593c21){if(_0x593c21){return _0x593c21[_0x6ddd('0x21')]()[_0x6ddd('0x20')](function(){_0x476a8c[_0x6ddd('0x17')](0xcc)[_0x6ddd('0x22')]();});}};}function handleEntityNotFound(_0xb647af,_0x5c7c71){return function(_0x3d86a0){if(!_0x3d86a0){_0xb647af[_0x6ddd('0x16')](0x194);}return _0x3d86a0;};}function handleError(_0x14ddd1,_0x14dbe1){_0x14dbe1=_0x14dbe1||0x1f4;return function(_0x18e959){logger[_0x6ddd('0x23')](_0x18e959[_0x6ddd('0x24')]);if(_0x18e959['name']){delete _0x18e959[_0x6ddd('0x25')];}_0x14ddd1[_0x6ddd('0x17')](_0x14dbe1)[_0x6ddd('0x26')](_0x18e959);};}exports[_0x6ddd('0x27')]=function(_0x1300a7,_0x7045a0){var _0x2f6c38={},_0x5c6ea9={},_0x474149={'count':0x0,'rows':[]};var _0x3d6926=_['map'](db['VoiceRecording'][_0x6ddd('0x28')],function(_0x123e17){return{'name':_0x123e17[_0x6ddd('0x29')],'type':_0x123e17[_0x6ddd('0x2a')][_0x6ddd('0x2b')]};});_0x5c6ea9['model']=_[_0x6ddd('0x2c')](_[_0x6ddd('0x2d')](_0x3d6926,_0x6ddd('0x25')),[_0x6ddd('0x2e')]);_0x5c6ea9[_0x6ddd('0x2f')]=_[_0x6ddd('0x30')](_0x1300a7[_0x6ddd('0x2f')]);_0x5c6ea9['filters']=_[_0x6ddd('0x31')](_0x5c6ea9[_0x6ddd('0x32')],_0x5c6ea9[_0x6ddd('0x2f')]);_0x2f6c38['attributes']=_[_0x6ddd('0x31')](_0x5c6ea9[_0x6ddd('0x32')],qs[_0x6ddd('0x33')](_0x1300a7['query'][_0x6ddd('0x33')]));_0x2f6c38[_0x6ddd('0x34')]=_0x2f6c38[_0x6ddd('0x34')]['length']?_0x2f6c38['attributes']:_0x5c6ea9[_0x6ddd('0x32')];if(!_0x1300a7['query'][_0x6ddd('0x35')](_0x6ddd('0x36'))){_0x2f6c38[_0x6ddd('0x1a')]=qs[_0x6ddd('0x1a')](_0x1300a7[_0x6ddd('0x2f')][_0x6ddd('0x1a')]);_0x2f6c38[_0x6ddd('0x37')]=qs[_0x6ddd('0x37')](_0x1300a7['query'][_0x6ddd('0x37')]);}_0x2f6c38[_0x6ddd('0x38')]=qs[_0x6ddd('0x39')](_0x1300a7[_0x6ddd('0x2f')][_0x6ddd('0x39')]);_0x2f6c38['where']=qs[_0x6ddd('0x3a')](_[_0x6ddd('0x3b')](_0x1300a7[_0x6ddd('0x2f')],_0x5c6ea9[_0x6ddd('0x3a')]),_0x3d6926);if(_0x1300a7[_0x6ddd('0x2f')][_0x6ddd('0x3c')]){_0x2f6c38[_0x6ddd('0x3d')]=_['merge'](_0x2f6c38[_0x6ddd('0x3d')],{'$or':_['map'](_0x3d6926,function(_0x3c72dc){if(_0x3c72dc['type']!==_0x6ddd('0x3e')){var _0x1c8beb={};_0x1c8beb[_0x3c72dc[_0x6ddd('0x25')]]={'$like':'%'+_0x1300a7[_0x6ddd('0x2f')]['filter']+'%'};return _0x1c8beb;}})});}_0x2f6c38=_[_0x6ddd('0x3f')]({},_0x2f6c38,_0x1300a7[_0x6ddd('0x40')]);var _0x44ebf5={'where':_0x2f6c38[_0x6ddd('0x3d')]};return db[_0x6ddd('0x41')]['count'](_0x44ebf5)[_0x6ddd('0x20')](function(_0xe4416f){_0x474149[_0x6ddd('0x19')]=_0xe4416f;if(_0x1300a7[_0x6ddd('0x2f')]['includeAll']){_0x2f6c38['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x2f6c38);})['then'](function(_0x5bd260){_0x474149[_0x6ddd('0x42')]=_0x5bd260;return _0x474149;})[_0x6ddd('0x20')](respondWithFilteredResult(_0x7045a0,_0x2f6c38))[_0x6ddd('0x43')](handleError(_0x7045a0,null));};exports['show']=function(_0x317676,_0xd8bb9b){var _0x3e08b8={'raw':![],'where':{'id':_0x317676[_0x6ddd('0x44')]['id']}},_0x3a1723={};_0x3a1723[_0x6ddd('0x32')]=_['keys'](db[_0x6ddd('0x41')]['rawAttributes']);_0x3a1723[_0x6ddd('0x2f')]=_[_0x6ddd('0x30')](_0x317676['query']);_0x3a1723[_0x6ddd('0x3a')]=_[_0x6ddd('0x31')](_0x3a1723[_0x6ddd('0x32')],_0x3a1723['query']);_0x3e08b8[_0x6ddd('0x34')]=_[_0x6ddd('0x31')](_0x3a1723[_0x6ddd('0x32')],qs[_0x6ddd('0x33')](_0x317676[_0x6ddd('0x2f')][_0x6ddd('0x33')]));_0x3e08b8['attributes']=_0x3e08b8['attributes'][_0x6ddd('0x45')]?_0x3e08b8[_0x6ddd('0x34')]:_0x3a1723['model'];if(_0x317676[_0x6ddd('0x2f')][_0x6ddd('0x46')]){_0x3e08b8[_0x6ddd('0x47')]=[{'all':!![]}];}_0x3e08b8=_[_0x6ddd('0x3f')]({},_0x3e08b8,_0x317676[_0x6ddd('0x40')]);return db[_0x6ddd('0x41')][_0x6ddd('0x48')](_0x3e08b8)[_0x6ddd('0x20')](handleEntityNotFound(_0xd8bb9b,null))[_0x6ddd('0x20')](respondWithResult(_0xd8bb9b,null))['catch'](handleError(_0xd8bb9b,null));};exports[_0x6ddd('0x49')]=function(_0x12152a,_0x34bba7){return db['VoiceRecording'][_0x6ddd('0x49')](_0x12152a[_0x6ddd('0x4a')],{})[_0x6ddd('0x20')](respondWithResult(_0x34bba7,0xc9))[_0x6ddd('0x43')](handleError(_0x34bba7,null));};exports[_0x6ddd('0x1f')]=function(_0xc2e3c4,_0xda59fb){if(_0xc2e3c4[_0x6ddd('0x4a')]['id']){delete _0xc2e3c4[_0x6ddd('0x4a')]['id'];}return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':{'id':_0xc2e3c4[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](handleEntityNotFound(_0xda59fb,null))['then'](saveUpdates(_0xc2e3c4[_0x6ddd('0x4a')],null))[_0x6ddd('0x20')](respondWithResult(_0xda59fb,null))[_0x6ddd('0x43')](handleError(_0xda59fb,null));};exports[_0x6ddd('0x4b')]=function(_0x47c508,_0x27d5b9){return db['VoiceRecording']['describe']()['then'](respondWithResult(_0x27d5b9,null))[_0x6ddd('0x43')](handleError(_0x27d5b9,null));};exports[_0x6ddd('0x4c')]=function(_0x4342a3,_0x24bc12,_0x2756cf){var _0x2c7b4d=require(_0x6ddd('0x4d'));var _0x54db99=![];var _0x2a83aa={};if(_0x4342a3[_0x6ddd('0x2f')][_0x6ddd('0x2a')]&&_0x4342a3[_0x6ddd('0x2f')]['type']===_0x6ddd('0x4e')){_0x2a83aa['uniqueid']=_0x4342a3[_0x6ddd('0x44')]['id'];}else{_0x2a83aa['id']=_0x4342a3[_0x6ddd('0x44')]['id'];}return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':_0x2a83aa,'attributes':['id',_0x6ddd('0x4f')],'raw':!![]})[_0x6ddd('0x20')](handleEntityNotFound(_0x24bc12,null))['then'](function(_0x50f01d){if(_0x50f01d){var _0x3910da=_0x50f01d[_0x6ddd('0x4f')];var _0x2f732c=util[_0x6ddd('0x2e')](_0x6ddd('0x50'),_0x3910da);if(fs[_0x6ddd('0x51')](_0x2f732c)){_0x54db99=!![];return _0x2c7b4d[_0x6ddd('0x52')](_0x2f732c,_0x3910da,config[_0x6ddd('0x53')][_0x6ddd('0x54')])[_0x6ddd('0x20')](function(){return _0x50f01d;});}return _0x50f01d;}})[_0x6ddd('0x20')](function(_0x228438){if(_0x228438){var _0x471fa3=_0x228438[_0x6ddd('0x4f')];if(!fs['existsSync'](_0x471fa3)){throw new db['Sequelize']['ValidationError'](_0x6ddd('0x55'));}if(_0x228438[_0x6ddd('0x56')]){return _0x24bc12[_0x6ddd('0x4c')](_0x471fa3,_0x228438[_0x6ddd('0x56')]+path[_0x6ddd('0x57')](_0x471fa3),function(){if(_0x54db99){fs[_0x6ddd('0x58')](_0x471fa3);}});}else{return _0x24bc12[_0x6ddd('0x4c')](_0x471fa3,function(_0x3222a7){if(_0x54db99){fs[_0x6ddd('0x58')](_0x471fa3);}});}}})[_0x6ddd('0x43')](function(_0x46ec07){if(_0x46ec07[_0x6ddd('0x59')]==='VoiceRecording\x20not\x20found'){_0x24bc12[_0x6ddd('0x17')](0x194)[_0x6ddd('0x26')](_0x6ddd('0x5a'));}else{return handleError(_0x24bc12,null);}});};exports[_0x6ddd('0x5b')]=function(_0x144d82,_0x4a6911,_0x25df0e){var _0x3d9d5a=require(_0x6ddd('0x4d'));var _0x1f4836=![];var _0x410590={'$and':[db[_0x6ddd('0x5c')][_0x6ddd('0x3d')](db[_0x6ddd('0x5c')]['fn']('MD5',db[_0x6ddd('0x5c')]['col'](_0x6ddd('0x4e'))),_0x144d82[_0x6ddd('0x2f')][_0x6ddd('0x5d')])]};if(_0x144d82[_0x6ddd('0x2f')][_0x6ddd('0x2a')]&&_0x144d82[_0x6ddd('0x2f')][_0x6ddd('0x2a')]===_0x6ddd('0x4e')){_0x410590[_0x6ddd('0x5e')]['push']({'uniqueid':_0x144d82['params']['id']});}else{_0x410590[_0x6ddd('0x5e')][_0x6ddd('0x5f')]({'id':_0x144d82['params']['id']});}return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':_0x410590,'attributes':['id',_0x6ddd('0x4f')],'raw':!![]})[_0x6ddd('0x20')](handleEntityNotFound(_0x4a6911,null))['then'](function(_0x3a8c6e){if(_0x3a8c6e){var _0x40b9d0=util[_0x6ddd('0x2e')](_0x6ddd('0x50'),_0x3a8c6e['value']);if(fs[_0x6ddd('0x51')](_0x40b9d0)){_0x1f4836=!![];return _0x3d9d5a[_0x6ddd('0x52')](_0x40b9d0,_0x3a8c6e[_0x6ddd('0x4f')],config['secrets']['recording'])['then'](function(){return _0x3a8c6e;});}return _0x3a8c6e;}})['then'](function(_0xe3a27b){if(_0xe3a27b){if(!fs[_0x6ddd('0x51')](_0xe3a27b['value'])){throw new db[(_0x6ddd('0x60'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xe3a27b['filename']){return _0x4a6911[_0x6ddd('0x4c')](_0xe3a27b[_0x6ddd('0x4f')],_0xe3a27b[_0x6ddd('0x56')]+path['extname'](_0xe3a27b[_0x6ddd('0x4f')]),function(){if(_0x1f4836){fs[_0x6ddd('0x58')](_0xe3a27b[_0x6ddd('0x4f')]);}});}else{return _0x4a6911[_0x6ddd('0x4c')](_0xe3a27b[_0x6ddd('0x4f')],function(_0xbe32fb){if(_0x1f4836){fs[_0x6ddd('0x58')](_0xe3a27b[_0x6ddd('0x4f')]);}});}}})[_0x6ddd('0x43')](handleError(_0x4a6911,null));};exports[_0x6ddd('0x21')]=function(_0x26dbc6,_0x5ddd31){return db[_0x6ddd('0x41')][_0x6ddd('0x48')]({'where':{'id':_0x26dbc6[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](function(_0x11cea1){if(!_0x11cea1)throw new ReferenceError(_0x6ddd('0x61'));return _0x11cea1;})[_0x6ddd('0x20')](function(_0x90348d){var _0x5c8af2=_0x90348d[_0x6ddd('0x4f')];logger[_0x6ddd('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x5c8af2);if(!_['isNil'](_0x90348d[_0x6ddd('0x4f')])&&fs['existsSync'](_0x5c8af2)){logger['info'](_0x6ddd('0x63')+_0x5c8af2+_0x6ddd('0x64'));fs[_0x6ddd('0x65')](_0x5c8af2);}_0x5c8af2=_0x5c8af2+'.cypher';if(!_['isNil'](_0x90348d['value'])&&fs['existsSync'](_0x5c8af2)){logger['info']('File:\x20\x22'+_0x5c8af2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6ddd('0x65')](_0x5c8af2);}return _0x90348d;})[_0x6ddd('0x20')](function(_0x509f18){if(!_0x509f18)throw new InternalError();return _0x509f18[_0x6ddd('0x21')]();})[_0x6ddd('0x20')](function(){_0x5ddd31[_0x6ddd('0x17')](0xcc)[_0x6ddd('0x22')]();})[_0x6ddd('0x43')](handleError(_0x5ddd31,null));};function getBucketslist(_0xe7ea2e,_0x1ee4d4,_0x589cda){return new Promise(function(_0x2c61db,_0x464343){var _0x3df9b7=new AWS['S3']({'accessKeyId':_0x1ee4d4,'secretAccessKey':_0xe7ea2e,'region':_0x589cda});_0x3df9b7[_0x6ddd('0x66')]({},function(_0x37d7f7,_0x32eb4b){if(_0x37d7f7){return _0x464343(_0x37d7f7);}else{return _0x2c61db(_0x32eb4b);}});});}function createBucket(_0xf9b3be,_0x4a8f1a,_0xc1ba60,_0x21cb1c){return new Promise(function(_0x1a174e,_0x3fbfd5){var _0x5b4bb3=new AWS['S3']({'accessKeyId':_0x4a8f1a,'secretAccessKey':_0xf9b3be,'region':_0xc1ba60});_0x5b4bb3[_0x6ddd('0x67')]({'Bucket':_0x21cb1c},function(_0x1d8b65,_0x4e973d){if(_0x1d8b65){return _0x3fbfd5(_0x1d8b65);}else{return _0x1a174e(_0x4e973d);}});});}function uploadFile(_0x142029,_0x260597,_0x4c89f8,_0x569baa,_0x100161,_0x5d1b13){return new Promise(function(_0xa03169,_0x4eb0f9){var _0x20b747=new AWS['S3']({'accessKeyId':_0x260597,'secretAccessKey':_0x142029,'region':_0x4c89f8});_0x20b747[_0x6ddd('0x68')]({'Bucket':_0x569baa,'Key':_0x100161,'Body':_0x5d1b13},function(_0x4349ad,_0x76e72b){if(_0x4349ad){return _0x4eb0f9(_0x4349ad);}else{return _0xa03169(_0x76e72b);}});});}function startTranscribe(_0x398d75,_0x54c1a3,_0x495393,_0x37a30f,_0x512c8b,_0x119685){return new Promise(function(_0xf55b67,_0x246604){var _0x20403d=new AWS['TranscribeService']({'accessKeyId':_0x54c1a3,'secretAccessKey':_0x398d75,'region':_0x495393});_0x20403d[_0x6ddd('0x69')]({'TranscriptionJobName':_0x37a30f,'LanguageCode':_0x512c8b,'Media':{'MediaFileUri':_0x119685}},function(_0x26cd54,_0x4ac5fa){if(_0x26cd54){return _0x246604(_0x26cd54);}else{return _0xf55b67(_0x4ac5fa);}});});}function transcribe(_0x5817e6,_0x265564,_0x52d00a,_0x3aca3e,_0x1db177,_0x14e154,_0x33a5bb){return new Promise(function(_0x40b41c,_0x1ebc03){var _0x3f79e5={};logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')](_0x6ddd('0x6a'),_0x5817e6,_0x1db177));return uploadFile(_0x265564,_0x52d00a,_0x3aca3e,_0x1db177,path['basename'](_0x14e154),fs['readFileSync'](_0x14e154))[_0x6ddd('0x20')](function(_0x5afc95){logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')](_0x6ddd('0x6b'),_0x5817e6,_0x1db177,_0x5afc95[_0x6ddd('0x6c')]));_0x3f79e5[_0x6ddd('0x6d')]=_0x5afc95['Bucket'];_0x3f79e5[_0x6ddd('0x6e')]=_0x5afc95[_0x6ddd('0x6c')];logger['info'](util[_0x6ddd('0x2e')](_0x6ddd('0x6f'),_0x5817e6));return startTranscribe(_0x265564,_0x52d00a,_0x3aca3e,uuidv4(),_0x33a5bb,_0x5afc95[_0x6ddd('0x6c')]);})[_0x6ddd('0x20')](function(_0x2893da){logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')](_0x6ddd('0x70'),_0x5817e6,_0x2893da[_0x6ddd('0x71')][_0x6ddd('0x72')]));_0x3f79e5[_0x6ddd('0x73')]=_0x2893da['TranscriptionJob'][_0x6ddd('0x72')];_0x3f79e5[_0x6ddd('0x74')]=_0x2893da['TranscriptionJob'][_0x6ddd('0x75')];return _0x40b41c(_0x3f79e5);})['catch'](function(_0x4e65f5){return _0x1ebc03(_0x4e65f5);});});}exports[_0x6ddd('0x76')]=function(_0x663f40,_0x374ac7,_0x26b5df){var _0xfb27f8;var _0xe000e;var _0x4af501;var _0x5ffff6=require('../../components/encryptor');return db[_0x6ddd('0x41')]['findOne']({'where':{'id':_0x663f40[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](function(_0x37a52e){if(_0x37a52e){var _0x2dceeb=util[_0x6ddd('0x2e')](_0x6ddd('0x50'),_0x37a52e[_0x6ddd('0x4f')]);if(fs[_0x6ddd('0x51')](_0x2dceeb)){cypher=!![];return _0x5ffff6[_0x6ddd('0x52')](_0x2dceeb,_0x37a52e[_0x6ddd('0x4f')],config[_0x6ddd('0x53')]['recording'])[_0x6ddd('0x20')](function(){return _0x37a52e;});}return _0x37a52e;}})['then'](function(_0x28c860){if(!_0x28c860){throw new db[(_0x6ddd('0x60'))][(_0x6ddd('0x77'))](_0x6ddd('0x78'));}_0xe000e=_0x28c860;return db[_0x6ddd('0x79')][_0x6ddd('0x7a')]({'where':{'id':0x1}});})[_0x6ddd('0x20')](handleEntityNotFound(_0x374ac7,null))['then'](function(_0x3e8152){if(_0x3e8152){_0xfb27f8=_0x3e8152;if(!_0xfb27f8[_0x6ddd('0x7b')]||!_0xfb27f8[_0x6ddd('0x7c')]||!_0xfb27f8['transcribeRegion']||!_0xfb27f8[_0x6ddd('0x7d')]||!_0xfb27f8[_0x6ddd('0x6d')]){throw new db['Sequelize']['ValidationError'](_0x6ddd('0x7e'));}if(_0x663f40[_0x6ddd('0x4a')][_0x6ddd('0x7f')]&&(!_0xfb27f8['sentiment']||!_0xfb27f8['sentimentAccountId']||!_0xfb27f8['sentimentRegion']||!_0xfb27f8[_0x6ddd('0x7d')]||!_0xfb27f8[_0x6ddd('0x6d')])){throw new db[(_0x6ddd('0x60'))][(_0x6ddd('0x77'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x6ddd('0x80')]['findOne']({'where':{'id':_0xfb27f8[_0x6ddd('0x7c')]}});}})[_0x6ddd('0x20')](function(_0x46d5c7){if(!_0x46d5c7){throw new db['Sequelize'][(_0x6ddd('0x77'))](_0x6ddd('0x81'));}if(!_0x46d5c7[_0x6ddd('0x82')]||!_0x46d5c7[_0x6ddd('0x83')]){throw new db['Sequelize'][(_0x6ddd('0x77'))](_0x6ddd('0x84'));}_0x4af501=_0x46d5c7;return getBucketslist(_0x4af501['data1'],_0x4af501['data2'],_0xfb27f8[_0x6ddd('0x85')]);})[_0x6ddd('0x20')](function(_0x2e5a4c){if(_0x2e5a4c&&_0x2e5a4c[_0x6ddd('0x86')]){var _0x24cfc0=_['find'](_0x2e5a4c[_0x6ddd('0x86')],function(_0x39e6b2){return _0x39e6b2['Name']===_0xfb27f8[_0x6ddd('0x6d')];});if(!_0x24cfc0){logger[_0x6ddd('0x62')](util['format'](_0x6ddd('0x87'),_0x663f40[_0x6ddd('0x44')]['id'],_0xfb27f8[_0x6ddd('0x6d')]));return createBucket(_0x4af501['data1'],_0x4af501['data2'],_0xfb27f8['transcribeRegion'],_0xfb27f8[_0x6ddd('0x6d')]);}logger[_0x6ddd('0x62')](util[_0x6ddd('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x663f40[_0x6ddd('0x44')]['id'],_0xfb27f8[_0x6ddd('0x6d')]));return;}})[_0x6ddd('0x20')](function(_0x4535cd){if(_0xe000e[_0x6ddd('0x74')]===_0x6ddd('0x88')){return transcribe(_0x663f40[_0x6ddd('0x44')]['id'],_0x4af501['data1'],_0x4af501[_0x6ddd('0x83')],_0xfb27f8[_0x6ddd('0x85')],_0xfb27f8[_0x6ddd('0x6d')],_0xe000e[_0x6ddd('0x4f')],_0xfb27f8[_0x6ddd('0x7d')]);}else{logger[_0x6ddd('0x62')](util['format'](_0x6ddd('0x89'),_0x663f40['params']['id']));return{'transcribeStatus':_0x6ddd('0x8a')};}})[_0x6ddd('0x20')](function(_0x31731e){if(_0x31731e){_0x31731e[_0x6ddd('0x8b')]=_0x663f40[_0x6ddd('0x4a')][_0x6ddd('0x7f')];return _0xe000e[_0x6ddd('0x8c')](_0x31731e);}})[_0x6ddd('0x20')](respondWithResult(_0x374ac7,null))[_0x6ddd('0x43')](handleError(_0x374ac7,null));};function writeFile(_0x35ab10,_0x205639){return new Promise(function(_0x20bfab,_0x123a90){fs[_0x6ddd('0x8d')](_0x205639,_0x35ab10,function(_0x25d160,_0x4620ac){if(_0x25d160){return _0x123a90(_0x25d160);}else{return _0x20bfab(_0x4620ac);}});});}exports[_0x6ddd('0x8e')]=function(_0x292d61,_0x1a78b7,_0x45877d){return db['VoiceRecording'][_0x6ddd('0x7a')]({'where':{'id':_0x292d61[_0x6ddd('0x44')]['id']}})[_0x6ddd('0x20')](handleEntityNotFound(_0x1a78b7))['then'](function(_0xbc2c52){if(_0xbc2c52&&_0xbc2c52[_0x6ddd('0x8f')]){var _0x579c4d=_0xbc2c52[_0x6ddd('0x8f')];var _0x26d7c3=config[_0x6ddd('0x90')]+_0x6ddd('0x91')+_0xbc2c52['id']+'.txt';if(fs[_0x6ddd('0x51')](_0x26d7c3)){return _0x26d7c3;}return writeFile(_0x579c4d,_0x26d7c3)[_0x6ddd('0x20')](function(){return _0x26d7c3;});}else{throw new db['Sequelize']['ValidationError'](_0x6ddd('0x92'));}})[_0x6ddd('0x20')](function(_0x3120c9){return _0x1a78b7['download'](_0x3120c9);})[_0x6ddd('0x43')](handleError(_0x1a78b7));}; \ No newline at end of file +var _0x5d81=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','name','send','index','VoiceRecording','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','length','find','create','update','body','describe','catch','download','../../components/encryptor','type','uniqueid','value','format','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','MD5','$and','push','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5d81,0x1b1));var _0x15d8=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x5d81[_0xa60623];return _0x4a6487;};'use strict';var pdf=require(_0x15d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x15d8('0x1'));var zipdir=require(_0x15d8('0x2'));var jsonpatch=require(_0x15d8('0x3'));var rp=require('request-promise');var moment=require(_0x15d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15d8('0x5'));var util=require(_0x15d8('0x6'));var path=require(_0x15d8('0x7'));var sox=require(_0x15d8('0x8'));var csv=require(_0x15d8('0x9'));var ejs=require(_0x15d8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x15d8('0xb'));var crypto=require(_0x15d8('0xc'));var jsforce=require(_0x15d8('0xd'));var deskjs=require(_0x15d8('0xe'));var toCsv=require(_0x15d8('0x9'));var querystring=require('querystring');var Papa=require(_0x15d8('0xf'));var AWS=require(_0x15d8('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x15d8('0x11'));var authService=require(_0x15d8('0x12'));var qs=require(_0x15d8('0x13'));var as=require(_0x15d8('0x14'));var hardwareService=require(_0x15d8('0x15'));var logger=require(_0x15d8('0x16'))(_0x15d8('0x17'));var utils=require(_0x15d8('0x18'));var config=require(_0x15d8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x15d8('0x1a'))['db'];function respondWithStatusCode(_0x35e663,_0xd9f0e2){_0xd9f0e2=_0xd9f0e2||0xcc;return function(_0x469727){if(_0x469727){return _0x35e663['sendStatus'](_0xd9f0e2);}return _0x35e663[_0x15d8('0x1b')](_0xd9f0e2)[_0x15d8('0x1c')]();};}function respondWithResult(_0x6f8afe,_0x2a8f15){_0x2a8f15=_0x2a8f15||0xc8;return function(_0x58d6b9){if(_0x58d6b9){return _0x6f8afe['status'](_0x2a8f15)['json'](_0x58d6b9);}};}function respondWithFilteredResult(_0x2ab224,_0xcc8cff){return function(_0x2129ca){if(_0x2129ca){var _0x5cd2dd=_0x2129ca[_0x15d8('0x1d')],_0x49f3d9=_0xcc8cff['offset'],_0x1011fd=_0xcc8cff[_0x15d8('0x1e')]+_0xcc8cff[_0x15d8('0x1f')],_0x2f20a7;if(_0x1011fd>=_0x5cd2dd){_0x1011fd=_0x5cd2dd;_0x2f20a7=0xc8;}else{_0x2f20a7=0xce;}_0x2ab224[_0x15d8('0x1b')](_0x2f20a7);return _0x2ab224[_0x15d8('0x20')](_0x15d8('0x21'),_0x49f3d9+'-'+_0x1011fd+'/'+_0x5cd2dd)[_0x15d8('0x22')](_0x2129ca);}return null;};}function patchUpdates(_0xa1e774){return function(_0xb42889){try{jsonpatch[_0x15d8('0x23')](_0xb42889,_0xa1e774,!![]);}catch(_0x1723ca){return BPromise[_0x15d8('0x24')](_0x1723ca);}return _0xb42889[_0x15d8('0x25')]();};}function saveUpdates(_0x553362,_0x188196){return function(_0xcbfa7b){if(_0xcbfa7b){return _0xcbfa7b['update'](_0x553362)['then'](function(_0x216bd3){return _0x216bd3;});}return null;};}function removeEntity(_0x2fbc60,_0x1a56fb){return function(_0x24fd5d){if(_0x24fd5d){return _0x24fd5d[_0x15d8('0x26')]()[_0x15d8('0x27')](function(){_0x2fbc60[_0x15d8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x239f36,_0x28e6b7){return function(_0x27035a){if(!_0x27035a){_0x239f36[_0x15d8('0x28')](0x194);}return _0x27035a;};}function handleError(_0x32b195,_0x34521c){_0x34521c=_0x34521c||0x1f4;return function(_0x1c8c00){logger['error'](_0x1c8c00[_0x15d8('0x29')]);if(_0x1c8c00[_0x15d8('0x2a')]){delete _0x1c8c00[_0x15d8('0x2a')];}_0x32b195[_0x15d8('0x1b')](_0x34521c)[_0x15d8('0x2b')](_0x1c8c00);};}exports[_0x15d8('0x2c')]=function(_0x498621,_0x11e6f5){var _0x58b72e={},_0xd0a896={},_0x3d5220={'count':0x0,'rows':[]};var _0x38a1eb=_['map'](db[_0x15d8('0x2d')][_0x15d8('0x2e')],function(_0x20e1dd){return{'name':_0x20e1dd['fieldName'],'type':_0x20e1dd['type'][_0x15d8('0x2f')]};});_0xd0a896[_0x15d8('0x30')]=_['differenceBy'](_[_0x15d8('0x31')](_0x38a1eb,_0x15d8('0x2a')),['format']);_0xd0a896['query']=_['keys'](_0x498621[_0x15d8('0x32')]);_0xd0a896[_0x15d8('0x33')]=_[_0x15d8('0x34')](_0xd0a896[_0x15d8('0x30')],_0xd0a896[_0x15d8('0x32')]);_0x58b72e['attributes']=_[_0x15d8('0x34')](_0xd0a896[_0x15d8('0x30')],qs[_0x15d8('0x35')](_0x498621[_0x15d8('0x32')][_0x15d8('0x35')]));_0x58b72e[_0x15d8('0x36')]=_0x58b72e['attributes']['length']?_0x58b72e[_0x15d8('0x36')]:_0xd0a896[_0x15d8('0x30')];if(!_0x498621[_0x15d8('0x32')][_0x15d8('0x37')](_0x15d8('0x38'))){_0x58b72e[_0x15d8('0x1f')]=qs[_0x15d8('0x1f')](_0x498621[_0x15d8('0x32')][_0x15d8('0x1f')]);_0x58b72e[_0x15d8('0x1e')]=qs['offset'](_0x498621['query'][_0x15d8('0x1e')]);}_0x58b72e[_0x15d8('0x39')]=qs[_0x15d8('0x3a')](_0x498621[_0x15d8('0x32')]['sort']);_0x58b72e[_0x15d8('0x3b')]=qs[_0x15d8('0x33')](_[_0x15d8('0x3c')](_0x498621[_0x15d8('0x32')],_0xd0a896[_0x15d8('0x33')]),_0x38a1eb);if(_0x498621[_0x15d8('0x32')][_0x15d8('0x3d')]){_0x58b72e[_0x15d8('0x3b')]=_[_0x15d8('0x3e')](_0x58b72e[_0x15d8('0x3b')],{'$or':_['map'](_0x38a1eb,function(_0x2baf45){if(_0x2baf45['type']!==_0x15d8('0x3f')){var _0x2692ff={};_0x2692ff[_0x2baf45['name']]={'$like':'%'+_0x498621[_0x15d8('0x32')]['filter']+'%'};return _0x2692ff;}})});}_0x58b72e=_[_0x15d8('0x3e')]({},_0x58b72e,_0x498621[_0x15d8('0x40')]);var _0x40c2c5={'where':_0x58b72e['where']};return db['VoiceRecording'][_0x15d8('0x1d')](_0x40c2c5)[_0x15d8('0x27')](function(_0x9d1204){_0x3d5220[_0x15d8('0x1d')]=_0x9d1204;if(_0x498621[_0x15d8('0x32')][_0x15d8('0x41')]){_0x58b72e[_0x15d8('0x42')]=[{'all':!![]}];}return db[_0x15d8('0x2d')]['findAll'](_0x58b72e);})[_0x15d8('0x27')](function(_0x108b20){_0x3d5220[_0x15d8('0x43')]=_0x108b20;return _0x3d5220;})[_0x15d8('0x27')](respondWithFilteredResult(_0x11e6f5,_0x58b72e))['catch'](handleError(_0x11e6f5,null));};exports['show']=function(_0x540b19,_0x2d812a){var _0xbf57b8={'raw':![],'where':{'id':_0x540b19[_0x15d8('0x44')]['id']}},_0x5857ce={};_0x5857ce[_0x15d8('0x30')]=_[_0x15d8('0x45')](db[_0x15d8('0x2d')][_0x15d8('0x2e')]);_0x5857ce[_0x15d8('0x32')]=_[_0x15d8('0x45')](_0x540b19['query']);_0x5857ce[_0x15d8('0x33')]=_['intersection'](_0x5857ce[_0x15d8('0x30')],_0x5857ce[_0x15d8('0x32')]);_0xbf57b8[_0x15d8('0x36')]=_['intersection'](_0x5857ce[_0x15d8('0x30')],qs[_0x15d8('0x35')](_0x540b19[_0x15d8('0x32')][_0x15d8('0x35')]));_0xbf57b8['attributes']=_0xbf57b8[_0x15d8('0x36')][_0x15d8('0x46')]?_0xbf57b8['attributes']:_0x5857ce[_0x15d8('0x30')];if(_0x540b19['query']['includeAll']){_0xbf57b8[_0x15d8('0x42')]=[{'all':!![]}];}_0xbf57b8=_[_0x15d8('0x3e')]({},_0xbf57b8,_0x540b19['options']);return db[_0x15d8('0x2d')][_0x15d8('0x47')](_0xbf57b8)[_0x15d8('0x27')](handleEntityNotFound(_0x2d812a,null))[_0x15d8('0x27')](respondWithResult(_0x2d812a,null))['catch'](handleError(_0x2d812a,null));};exports[_0x15d8('0x48')]=function(_0x1402d6,_0x572646){return db['VoiceRecording'][_0x15d8('0x48')](_0x1402d6['body'],{})['then'](respondWithResult(_0x572646,0xc9))['catch'](handleError(_0x572646,null));};exports[_0x15d8('0x49')]=function(_0x159a3e,_0x264fb6){if(_0x159a3e[_0x15d8('0x4a')]['id']){delete _0x159a3e[_0x15d8('0x4a')]['id'];}return db[_0x15d8('0x2d')][_0x15d8('0x47')]({'where':{'id':_0x159a3e[_0x15d8('0x44')]['id']}})[_0x15d8('0x27')](handleEntityNotFound(_0x264fb6,null))[_0x15d8('0x27')](saveUpdates(_0x159a3e[_0x15d8('0x4a')],null))[_0x15d8('0x27')](respondWithResult(_0x264fb6,null))['catch'](handleError(_0x264fb6,null));};exports[_0x15d8('0x4b')]=function(_0x245efc,_0x176cc9){return db[_0x15d8('0x2d')][_0x15d8('0x4b')]()['then'](respondWithResult(_0x176cc9,null))[_0x15d8('0x4c')](handleError(_0x176cc9,null));};exports[_0x15d8('0x4d')]=function(_0x1f390b,_0x3791aa,_0x241669){var _0x311d7f=require(_0x15d8('0x4e'));var _0x56055c=![];var _0x47b23f={};if(_0x1f390b[_0x15d8('0x32')][_0x15d8('0x4f')]&&_0x1f390b['query'][_0x15d8('0x4f')]==='uniqueid'){_0x47b23f[_0x15d8('0x50')]=_0x1f390b[_0x15d8('0x44')]['id'];}else{_0x47b23f['id']=_0x1f390b[_0x15d8('0x44')]['id'];}return db['VoiceRecording']['find']({'where':_0x47b23f,'attributes':['id',_0x15d8('0x51')],'raw':!![]})[_0x15d8('0x27')](handleEntityNotFound(_0x3791aa,null))[_0x15d8('0x27')](function(_0x4352a9){if(_0x4352a9){var _0xeb90a1=_0x4352a9[_0x15d8('0x51')];var _0x384693=util[_0x15d8('0x52')]('%s.cypher',_0xeb90a1);if(fs[_0x15d8('0x53')](_0x384693)){_0x56055c=!![];return _0x311d7f[_0x15d8('0x54')](_0x384693,_0xeb90a1,config[_0x15d8('0x55')][_0x15d8('0x56')])[_0x15d8('0x27')](function(){return _0x4352a9;});}return _0x4352a9;}})['then'](function(_0x42ab26){if(_0x42ab26){var _0x1dd182=_0x42ab26['value'];if(!fs[_0x15d8('0x53')](_0x1dd182)){throw new db[(_0x15d8('0x57'))]['ValidationError'](_0x15d8('0x58'));}if(_0x42ab26[_0x15d8('0x59')]){return _0x3791aa[_0x15d8('0x4d')](_0x1dd182,_0x42ab26[_0x15d8('0x59')]+path[_0x15d8('0x5a')](_0x1dd182),function(){if(_0x56055c){fs[_0x15d8('0x5b')](_0x1dd182);}});}else{return _0x3791aa[_0x15d8('0x4d')](_0x1dd182,function(_0x26ed7f){if(_0x56055c){fs[_0x15d8('0x5b')](_0x1dd182);}});}}})[_0x15d8('0x4c')](function(_0x3b7afd){if(_0x3b7afd['message']==='VoiceRecording\x20not\x20found'){_0x3791aa[_0x15d8('0x1b')](0x194)[_0x15d8('0x2b')](_0x15d8('0x5c'));}else{return handleError(_0x3791aa,null);}});};exports['downloads']=function(_0x3de990,_0x142c7f,_0x2b7bfa){var _0x620355=require(_0x15d8('0x4e'));var _0x5550ce=![];var _0x4cd273={'$and':[db['sequelize'][_0x15d8('0x3b')](db['sequelize']['fn'](_0x15d8('0x5d'),db['sequelize']['col']('uniqueid')),_0x3de990[_0x15d8('0x32')]['token'])]};if(_0x3de990[_0x15d8('0x32')][_0x15d8('0x4f')]&&_0x3de990['query'][_0x15d8('0x4f')]===_0x15d8('0x50')){_0x4cd273[_0x15d8('0x5e')][_0x15d8('0x5f')]({'uniqueid':_0x3de990[_0x15d8('0x44')]['id']});}else{_0x4cd273[_0x15d8('0x5e')][_0x15d8('0x5f')]({'id':_0x3de990[_0x15d8('0x44')]['id']});}return db[_0x15d8('0x2d')]['find']({'where':_0x4cd273,'attributes':['id',_0x15d8('0x51')],'raw':!![]})[_0x15d8('0x27')](handleEntityNotFound(_0x142c7f,null))['then'](function(_0x452fc7){if(_0x452fc7){var _0x2a51ff=util[_0x15d8('0x52')]('%s.cypher',_0x452fc7['value']);if(fs[_0x15d8('0x53')](_0x2a51ff)){_0x5550ce=!![];return _0x620355['decryptFile'](_0x2a51ff,_0x452fc7[_0x15d8('0x51')],config[_0x15d8('0x55')]['recording'])[_0x15d8('0x27')](function(){return _0x452fc7;});}return _0x452fc7;}})[_0x15d8('0x27')](function(_0x43b57d){if(_0x43b57d){if(!fs[_0x15d8('0x53')](_0x43b57d[_0x15d8('0x51')])){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x58'));}if(_0x43b57d[_0x15d8('0x59')]){return _0x142c7f[_0x15d8('0x4d')](_0x43b57d[_0x15d8('0x51')],_0x43b57d[_0x15d8('0x59')]+path[_0x15d8('0x5a')](_0x43b57d[_0x15d8('0x51')]),function(){if(_0x5550ce){fs[_0x15d8('0x5b')](_0x43b57d['value']);}});}else{return _0x142c7f[_0x15d8('0x4d')](_0x43b57d[_0x15d8('0x51')],function(_0x3e2ab9){if(_0x5550ce){fs[_0x15d8('0x5b')](_0x43b57d[_0x15d8('0x51')]);}});}}})[_0x15d8('0x4c')](handleError(_0x142c7f,null));};exports['destroy']=function(_0x41f391,_0x4902ec){return db[_0x15d8('0x2d')]['find']({'where':{'id':_0x41f391[_0x15d8('0x44')]['id']}})[_0x15d8('0x27')](function(_0x56ac41){if(!_0x56ac41)throw new ReferenceError(_0x15d8('0x61'));return _0x56ac41;})['then'](function(_0x5657ff){var _0x96030f=_0x5657ff['value'];logger[_0x15d8('0x62')](_0x15d8('0x63'),_0x96030f);if(!_[_0x15d8('0x64')](_0x5657ff[_0x15d8('0x51')])&&fs[_0x15d8('0x53')](_0x96030f)){logger[_0x15d8('0x62')](_0x15d8('0x65')+_0x96030f+_0x15d8('0x66'));fs[_0x15d8('0x67')](_0x96030f);}_0x96030f=_0x96030f+_0x15d8('0x68');if(!_[_0x15d8('0x64')](_0x5657ff[_0x15d8('0x51')])&&fs[_0x15d8('0x53')](_0x96030f)){logger['info'](_0x15d8('0x65')+_0x96030f+_0x15d8('0x66'));fs[_0x15d8('0x67')](_0x96030f);}return _0x5657ff;})[_0x15d8('0x27')](function(_0x3e37c2){if(!_0x3e37c2)throw new InternalError();return _0x3e37c2[_0x15d8('0x26')]();})[_0x15d8('0x27')](function(){_0x4902ec[_0x15d8('0x1b')](0xcc)['end']();})[_0x15d8('0x4c')](handleError(_0x4902ec,null));};function getBucketslist(_0x3d39cc,_0x2013b5,_0x116b89){return new Promise(function(_0x47f245,_0x5c3022){var _0x3c8f1f=new AWS['S3']({'accessKeyId':_0x2013b5,'secretAccessKey':_0x3d39cc,'region':_0x116b89});_0x3c8f1f[_0x15d8('0x69')]({},function(_0x19670a,_0x2f94cd){if(_0x19670a){return _0x5c3022(_0x19670a);}else{return _0x47f245(_0x2f94cd);}});});}function createBucket(_0x54467c,_0x138879,_0x25e62c,_0x569671){return new Promise(function(_0x689bbc,_0x5b457e){var _0x4a1fca=new AWS['S3']({'accessKeyId':_0x138879,'secretAccessKey':_0x54467c,'region':_0x25e62c});_0x4a1fca[_0x15d8('0x6a')]({'Bucket':_0x569671},function(_0x5f049c,_0x26b993){if(_0x5f049c){return _0x5b457e(_0x5f049c);}else{return _0x689bbc(_0x26b993);}});});}function uploadFile(_0x41821f,_0x325cb5,_0x1dcfec,_0x475c85,_0x35dd0f,_0xebb2e1){return new Promise(function(_0x5cc402,_0x2cea22){var _0x553536=new AWS['S3']({'accessKeyId':_0x325cb5,'secretAccessKey':_0x41821f,'region':_0x1dcfec});_0x553536[_0x15d8('0x6b')]({'Bucket':_0x475c85,'Key':_0x35dd0f,'Body':_0xebb2e1},function(_0x23823e,_0x26f082){if(_0x23823e){return _0x2cea22(_0x23823e);}else{return _0x5cc402(_0x26f082);}});});}function startTranscribe(_0x10db40,_0x1b0843,_0x29c6fb,_0x3934a5,_0x71384e,_0x2d8236){return new Promise(function(_0x4f58a2,_0x226a14){var _0x4990b7=new AWS[(_0x15d8('0x6c'))]({'accessKeyId':_0x1b0843,'secretAccessKey':_0x10db40,'region':_0x29c6fb});_0x4990b7[_0x15d8('0x6d')]({'TranscriptionJobName':_0x3934a5,'LanguageCode':_0x71384e,'Media':{'MediaFileUri':_0x2d8236}},function(_0x1e2241,_0x1f3981){if(_0x1e2241){return _0x226a14(_0x1e2241);}else{return _0x4f58a2(_0x1f3981);}});});}function transcribe(_0x3cd595,_0x1e367e,_0x48d3af,_0x5e8fa7,_0x1f1b87,_0x167c5e,_0x14fd95){return new Promise(function(_0x322d72,_0x3d3ae4){var _0x41069d={};logger[_0x15d8('0x62')](util[_0x15d8('0x52')](_0x15d8('0x6e'),_0x3cd595,_0x1f1b87));return uploadFile(_0x1e367e,_0x48d3af,_0x5e8fa7,_0x1f1b87,path['basename'](_0x167c5e),fs[_0x15d8('0x6f')](_0x167c5e))['then'](function(_0x2bf324){logger[_0x15d8('0x62')](util[_0x15d8('0x52')](_0x15d8('0x70'),_0x3cd595,_0x1f1b87,_0x2bf324['Location']));_0x41069d[_0x15d8('0x71')]=_0x2bf324['Bucket'];_0x41069d[_0x15d8('0x72')]=_0x2bf324[_0x15d8('0x73')];logger[_0x15d8('0x62')](util[_0x15d8('0x52')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3cd595));return startTranscribe(_0x1e367e,_0x48d3af,_0x5e8fa7,uuidv4(),_0x14fd95,_0x2bf324['Location']);})[_0x15d8('0x27')](function(_0x50b258){logger[_0x15d8('0x62')](util[_0x15d8('0x52')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x3cd595,_0x50b258[_0x15d8('0x74')][_0x15d8('0x75')]));_0x41069d[_0x15d8('0x76')]=_0x50b258[_0x15d8('0x74')][_0x15d8('0x75')];_0x41069d[_0x15d8('0x77')]=_0x50b258['TranscriptionJob'][_0x15d8('0x78')];return _0x322d72(_0x41069d);})[_0x15d8('0x4c')](function(_0x1c1fde){return _0x3d3ae4(_0x1c1fde);});});}exports[_0x15d8('0x79')]=function(_0x129698,_0x3a2711,_0x4549d7){var _0x3edd29;var _0x56ebe2;var _0x245a70;var _0x4d5433=require(_0x15d8('0x4e'));return db[_0x15d8('0x2d')][_0x15d8('0x7a')]({'where':{'id':_0x129698[_0x15d8('0x44')]['id']}})['then'](function(_0x516791){if(_0x516791){var _0x3c299f=util[_0x15d8('0x52')]('%s.cypher',_0x516791['value']);if(fs[_0x15d8('0x53')](_0x3c299f)){cypher=!![];return _0x4d5433[_0x15d8('0x54')](_0x3c299f,_0x516791[_0x15d8('0x51')],config[_0x15d8('0x55')]['recording'])[_0x15d8('0x27')](function(){return _0x516791;});}return _0x516791;}})[_0x15d8('0x27')](function(_0x50f016){if(!_0x50f016){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x7b'));}_0x56ebe2=_0x50f016;return db[_0x15d8('0x7c')]['findOne']({'where':{'id':0x1}});})[_0x15d8('0x27')](handleEntityNotFound(_0x3a2711,null))[_0x15d8('0x27')](function(_0x2d1a1b){if(_0x2d1a1b){_0x3edd29=_0x2d1a1b;if(!_0x3edd29[_0x15d8('0x7d')]||!_0x3edd29[_0x15d8('0x7e')]||!_0x3edd29[_0x15d8('0x7f')]||!_0x3edd29[_0x15d8('0x80')]||!_0x3edd29[_0x15d8('0x71')]){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x81'));}if(_0x129698[_0x15d8('0x4a')][_0x15d8('0x82')]&&(!_0x3edd29['sentiment']||!_0x3edd29[_0x15d8('0x83')]||!_0x3edd29['sentimentRegion']||!_0x3edd29[_0x15d8('0x80')]||!_0x3edd29['bucket'])){throw new db['Sequelize']['ValidationError'](_0x15d8('0x84'));}return db[_0x15d8('0x85')][_0x15d8('0x7a')]({'where':{'id':_0x3edd29['transcribeAccountId']}});}})['then'](function(_0x15cfc5){if(!_0x15cfc5){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x86'));}if(!_0x15cfc5[_0x15d8('0x87')]||!_0x15cfc5[_0x15d8('0x88')]){throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x89'));}_0x245a70=_0x15cfc5;return getBucketslist(_0x245a70[_0x15d8('0x87')],_0x245a70[_0x15d8('0x88')],_0x3edd29['transcribeRegion']);})['then'](function(_0x4137be){if(_0x4137be&&_0x4137be[_0x15d8('0x8a')]){var _0x3475d1=_['find'](_0x4137be[_0x15d8('0x8a')],function(_0x582365){return _0x582365[_0x15d8('0x8b')]===_0x3edd29['bucket'];});if(!_0x3475d1){logger[_0x15d8('0x62')](util['format'](_0x15d8('0x8c'),_0x129698['params']['id'],_0x3edd29[_0x15d8('0x71')]));return createBucket(_0x245a70[_0x15d8('0x87')],_0x245a70[_0x15d8('0x88')],_0x3edd29[_0x15d8('0x7f')],_0x3edd29['bucket']);}logger[_0x15d8('0x62')](util[_0x15d8('0x52')](_0x15d8('0x8d'),_0x129698[_0x15d8('0x44')]['id'],_0x3edd29[_0x15d8('0x71')]));return;}})[_0x15d8('0x27')](function(_0x3d20ca){if(_0x56ebe2['transcribeStatus']===_0x15d8('0x8e')){return transcribe(_0x129698[_0x15d8('0x44')]['id'],_0x245a70['data1'],_0x245a70[_0x15d8('0x88')],_0x3edd29[_0x15d8('0x7f')],_0x3edd29[_0x15d8('0x71')],_0x56ebe2[_0x15d8('0x51')],_0x3edd29[_0x15d8('0x80')]);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x129698[_0x15d8('0x44')]['id']));return{'transcribeStatus':_0x15d8('0x8f')};}})[_0x15d8('0x27')](function(_0x58b79b){if(_0x58b79b){_0x58b79b[_0x15d8('0x90')]=_0x129698[_0x15d8('0x4a')]['runSentiment'];return _0x56ebe2[_0x15d8('0x91')](_0x58b79b);}})[_0x15d8('0x27')](respondWithResult(_0x3a2711,null))['catch'](handleError(_0x3a2711,null));};function writeFile(_0x208f6c,_0x366fa2){return new Promise(function(_0x6c640,_0x39b212){fs['writeFile'](_0x366fa2,_0x208f6c,function(_0x57ab3a,_0x47a398){if(_0x57ab3a){return _0x39b212(_0x57ab3a);}else{return _0x6c640(_0x47a398);}});});}exports[_0x15d8('0x92')]=function(_0x46ba7,_0xc8c28c,_0x1c874e){return db[_0x15d8('0x2d')][_0x15d8('0x7a')]({'where':{'id':_0x46ba7['params']['id']}})['then'](handleEntityNotFound(_0xc8c28c))['then'](function(_0x447063){if(_0x447063&&_0x447063[_0x15d8('0x93')]){var _0x4de948=_0x447063[_0x15d8('0x93')];var _0x3a79b2=config[_0x15d8('0x94')]+_0x15d8('0x95')+_0x447063['id']+_0x15d8('0x96');if(fs[_0x15d8('0x53')](_0x3a79b2)){return _0x3a79b2;}return writeFile(_0x4de948,_0x3a79b2)[_0x15d8('0x27')](function(){return _0x3a79b2;});}else{throw new db[(_0x15d8('0x57'))][(_0x15d8('0x60'))](_0x15d8('0x97'));}})[_0x15d8('0x27')](function(_0x406dbf){return _0xc8c28c[_0x15d8('0x4d')](_0x406dbf);})[_0x15d8('0x4c')](handleError(_0xc8c28c));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f21538e..3ca2e08 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 _0x3c01=['define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x23808f,_0x17fa1c){var _0x3656c6=function(_0x552abf){while(--_0x552abf){_0x23808f['push'](_0x23808f['shift']());}};_0x3656c6(++_0x17fa1c);}(_0x3c01,0x19a));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x13c0('0x0'));var util=require(_0x13c0('0x1'));var logger=require(_0x13c0('0x2'))(_0x13c0('0x3'));var moment=require(_0x13c0('0x4'));var BPromise=require('bluebird');var rp=require(_0x13c0('0x5'));var fs=require('fs');var path=require(_0x13c0('0x6'));var rimraf=require('rimraf');var config=require(_0x13c0('0x7'));var attributes=require(_0x13c0('0x8'));module[_0x13c0('0x9')]=function(_0xefe4cd,_0x5737b2){return _0xefe4cd[_0x13c0('0xa')](_0x13c0('0xb'),attributes,{'tableName':_0x13c0('0xc'),'paranoid':![],'indexes':[{'name':_0x13c0('0xd'),'fields':[_0x13c0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c57=['moment','bluebird','request-promise','path','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api'];(function(_0x289765,_0x304e33){var _0x10e2df=function(_0x4d3e97){while(--_0x4d3e97){_0x289765['push'](_0x289765['shift']());}};_0x10e2df(++_0x304e33);}(_0x9c57,0x142));var _0x79c5=function(_0x356727,_0x572778){_0x356727=_0x356727-0x0;var _0x10e739=_0x9c57[_0x356727];return _0x10e739;};'use strict';var _=require('lodash');var util=require(_0x79c5('0x0'));var logger=require(_0x79c5('0x1'))(_0x79c5('0x2'));var moment=require(_0x79c5('0x3'));var BPromise=require(_0x79c5('0x4'));var rp=require(_0x79c5('0x5'));var fs=require('fs');var path=require(_0x79c5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79c5('0x7'));module[_0x79c5('0x8')]=function(_0x4a6826,_0x34343c){return _0x4a6826[_0x79c5('0x9')](_0x79c5('0xa'),attributes,{'tableName':_0x79c5('0xb'),'paranoid':![],'indexes':[{'name':_0x79c5('0xc'),'fields':[_0x79c5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 82f38d0..f1b90ce 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(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_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['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(_0x511d17,_0x9ad3ba){var _0x4f42e3=function(_0x5cc40f){while(--_0x5cc40f){_0x511d17['push'](_0x511d17['shift']());}};_0x4f42e3(++_0x9ad3ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 9735b50..e467669 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 _0x4819=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2608ba,_0x495fae){var _0x5dbf3f=function(_0x1b71c3){while(--_0x1b71c3){_0x2608ba['push'](_0x2608ba['shift']());}};_0x5dbf3f(++_0x495fae);}(_0x4819,0xcd));var _0x9481=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0x4819[_0x23b57c];return _0x4c3b1d;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')]('/',auth[_0x9481('0xb')](),controller[_0x9481('0xe')]);router['put'](_0x9481('0xf'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router['delete'](_0x9481('0xf'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);module[_0x9481('0x12')]=router; \ No newline at end of file +var _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x50fa6b,_0x576b70){var _0x295dfa=function(_0x46d878){while(--_0x46d878){_0x50fa6b['push'](_0x50fa6b['shift']());}};_0x295dfa(++_0x576b70);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x306fc7,_0x574e48){_0x306fc7=_0x306fc7-0x0;var _0x1d2f0f=_0xbd51[_0x306fc7];return _0x1d2f0f;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e504f0c..5321629 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 _0x6457=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x24efe1,_0x21f604){var _0x42129=function(_0x3c529f){while(--_0x3c529f){_0x24efe1['push'](_0x24efe1['shift']());}};_0x42129(++_0x21f604);}(_0x6457,0x173));var _0x7645=function(_0x58a22c,_0x3a2ed4){_0x58a22c=_0x58a22c-0x0;var _0x1206d0=_0x6457[_0x58a22c];return _0x1206d0;};'use strict';var Sequelize=require(_0x7645('0x0'));var moment=require(_0x7645('0x1'));module[_0x7645('0x2')]={'type':{'type':Sequelize[_0x7645('0x3')](_0x7645('0x4'),_0x7645('0x5'))},'result':{'type':Sequelize[_0x7645('0x6')]},'transfererchannel':{'type':Sequelize[_0x7645('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7645('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7645('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x7645('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x7645('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7645('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x7645('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x7645('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x7645('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x7645('0x6')]},'transfereecontext':{'type':Sequelize[_0x7645('0x6')]},'transfereeexten':{'type':Sequelize[_0x7645('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7645('0x3')](_0x7645('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x914f=['ENUM','blind','STRING','Yes','moment','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x914f,0x166));var _0xf914=function(_0x2ebeab,_0x2ffe2b){_0x2ebeab=_0x2ebeab-0x0;var _0x2daebd=_0x914f[_0x2ebeab];return _0x2daebd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf914('0x0'));module[_0xf914('0x1')]={'type':{'type':Sequelize[_0xf914('0x2')](_0xf914('0x3'),'attended')},'result':{'type':Sequelize[_0xf914('0x4')]},'transfererchannel':{'type':Sequelize[_0xf914('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf914('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf914('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf914('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xf914('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xf914('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xf914('0x4')]},'transfereechannel':{'type':Sequelize[_0xf914('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xf914('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xf914('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf914('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xf914('0x4')]},'transfereecontext':{'type':Sequelize[_0xf914('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf914('0x2')](_0xf914('0x5'),'No')},'context':{'type':Sequelize[_0xf914('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 990ff21..10ff46c 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 _0x6512=['intersection','include','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceTransferReport','fieldName','type','key','model','keys','filters','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','rawAttributes'];(function(_0x2bb298,_0x4bdefb){var _0x1ef1af=function(_0x590665){while(--_0x590665){_0x2bb298['push'](_0x2bb298['shift']());}};_0x1ef1af(++_0x4bdefb);}(_0x6512,0x1ea));var _0x2651=function(_0x51f807,_0x25b6f9){_0x51f807=_0x51f807-0x0;var _0x19a3f0=_0x6512[_0x51f807];return _0x19a3f0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2651('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2651('0x1'));var jsonpatch=require(_0x2651('0x2'));var rp=require(_0x2651('0x3'));var moment=require(_0x2651('0x4'));var BPromise=require(_0x2651('0x5'));var Mustache=require('mustache');var util=require(_0x2651('0x6'));var path=require('path');var sox=require(_0x2651('0x7'));var csv=require(_0x2651('0x8'));var ejs=require(_0x2651('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2651('0xa'));var crypto=require(_0x2651('0xb'));var jsforce=require(_0x2651('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2651('0x8'));var querystring=require(_0x2651('0xd'));var Papa=require(_0x2651('0xe'));var Redis=require(_0x2651('0xf'));var authService=require(_0x2651('0x10'));var qs=require(_0x2651('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2651('0x12'));var logger=require(_0x2651('0x13'))(_0x2651('0x14'));var utils=require('../../config/utils');var config=require(_0x2651('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52935e,_0x1e8abd){_0x1e8abd=_0x1e8abd||0xcc;return function(_0x4ad3c6){if(_0x4ad3c6){return _0x52935e['sendStatus'](_0x1e8abd);}return _0x52935e[_0x2651('0x16')](_0x1e8abd)[_0x2651('0x17')]();};}function respondWithResult(_0x162d84,_0x3a6f5f){_0x3a6f5f=_0x3a6f5f||0xc8;return function(_0xcfb016){if(_0xcfb016){return _0x162d84[_0x2651('0x16')](_0x3a6f5f)[_0x2651('0x18')](_0xcfb016);}};}function respondWithFilteredResult(_0x367d9f,_0x569f4f){return function(_0xa07808){if(_0xa07808){var _0x307bcf=_0xa07808[_0x2651('0x19')],_0x167d77=_0x569f4f['offset'],_0x2f3595=_0x569f4f[_0x2651('0x1a')]+_0x569f4f[_0x2651('0x1b')],_0x2e3ae3;if(_0x2f3595>=_0x307bcf){_0x2f3595=_0x307bcf;_0x2e3ae3=0xc8;}else{_0x2e3ae3=0xce;}_0x367d9f[_0x2651('0x16')](_0x2e3ae3);return _0x367d9f['set']('Content-Range',_0x167d77+'-'+_0x2f3595+'/'+_0x307bcf)[_0x2651('0x18')](_0xa07808);}return null;};}function patchUpdates(_0x3e9a37){return function(_0x21e28b){try{jsonpatch['apply'](_0x21e28b,_0x3e9a37,!![]);}catch(_0x11ab30){return BPromise[_0x2651('0x1c')](_0x11ab30);}return _0x21e28b[_0x2651('0x1d')]();};}function saveUpdates(_0x296f28,_0x56a2b0){return function(_0x9d1e5b){if(_0x9d1e5b){return _0x9d1e5b[_0x2651('0x1e')](_0x296f28)['then'](function(_0x41945e){return _0x41945e;});}return null;};}function removeEntity(_0x147659,_0x4d3507){return function(_0x346ea4){if(_0x346ea4){return _0x346ea4[_0x2651('0x1f')]()[_0x2651('0x20')](function(){_0x147659[_0x2651('0x16')](0xcc)[_0x2651('0x17')]();});}};}function handleEntityNotFound(_0x13b561,_0x1869bf){return function(_0x2faaed){if(!_0x2faaed){_0x13b561[_0x2651('0x21')](0x194);}return _0x2faaed;};}function handleError(_0x3c9960,_0x20971a){_0x20971a=_0x20971a||0x1f4;return function(_0x16cbea){logger[_0x2651('0x22')](_0x16cbea[_0x2651('0x23')]);if(_0x16cbea[_0x2651('0x24')]){delete _0x16cbea['name'];}_0x3c9960[_0x2651('0x16')](_0x20971a)['send'](_0x16cbea);};}exports[_0x2651('0x25')]=function(_0x134839,_0x59eb21){var _0x34208c={},_0x49c805={},_0x2b9d9b={'count':0x0,'rows':[]};var _0x4bb90f=_[_0x2651('0x26')](db[_0x2651('0x27')]['rawAttributes'],function(_0x34ae41){return{'name':_0x34ae41[_0x2651('0x28')],'type':_0x34ae41[_0x2651('0x29')][_0x2651('0x2a')]};});_0x49c805[_0x2651('0x2b')]=_[_0x2651('0x26')](_0x4bb90f,_0x2651('0x24'));_0x49c805['query']=_[_0x2651('0x2c')](_0x134839['query']);_0x49c805[_0x2651('0x2d')]=_['intersection'](_0x49c805[_0x2651('0x2b')],_0x49c805[_0x2651('0x2e')]);_0x34208c['attributes']=_['intersection'](_0x49c805[_0x2651('0x2b')],qs[_0x2651('0x2f')](_0x134839['query'][_0x2651('0x2f')]));_0x34208c[_0x2651('0x30')]=_0x34208c['attributes'][_0x2651('0x31')]?_0x34208c[_0x2651('0x30')]:_0x49c805[_0x2651('0x2b')];if(!_0x134839[_0x2651('0x2e')][_0x2651('0x32')](_0x2651('0x33'))){_0x34208c[_0x2651('0x1b')]=qs['limit'](_0x134839[_0x2651('0x2e')]['limit']);_0x34208c[_0x2651('0x1a')]=qs[_0x2651('0x1a')](_0x134839[_0x2651('0x2e')][_0x2651('0x1a')]);}_0x34208c['order']=qs[_0x2651('0x34')](_0x134839[_0x2651('0x2e')][_0x2651('0x34')]);_0x34208c[_0x2651('0x35')]=qs['filters'](_[_0x2651('0x36')](_0x134839[_0x2651('0x2e')],_0x49c805[_0x2651('0x2d')]),_0x4bb90f);if(_0x134839['query'][_0x2651('0x37')]){_0x34208c[_0x2651('0x35')]=_[_0x2651('0x38')](_0x34208c[_0x2651('0x35')],{'$or':_[_0x2651('0x26')](_0x4bb90f,function(_0x35a400){if(_0x35a400[_0x2651('0x29')]!==_0x2651('0x39')){var _0x3c7b43={};_0x3c7b43[_0x35a400['name']]={'$like':'%'+_0x134839[_0x2651('0x2e')][_0x2651('0x37')]+'%'};return _0x3c7b43;}})});}_0x34208c=_[_0x2651('0x38')]({},_0x34208c,_0x134839[_0x2651('0x3a')]);var _0x6403ad={'where':_0x34208c[_0x2651('0x35')]};return db[_0x2651('0x27')][_0x2651('0x19')](_0x6403ad)[_0x2651('0x20')](function(_0x2fdf78){_0x2b9d9b[_0x2651('0x19')]=_0x2fdf78;if(_0x134839[_0x2651('0x2e')][_0x2651('0x3b')]){_0x34208c['include']=[{'all':!![]}];}return db[_0x2651('0x27')]['findAll'](_0x34208c);})[_0x2651('0x20')](function(_0x2840a2){_0x2b9d9b['rows']=_0x2840a2;return _0x2b9d9b;})[_0x2651('0x20')](respondWithFilteredResult(_0x59eb21,_0x34208c))['catch'](handleError(_0x59eb21,null));};exports[_0x2651('0x3c')]=function(_0xcf7ba0,_0x5020da){var _0xc25b4e={'raw':!![],'where':{'id':_0xcf7ba0['params']['id']}},_0x3e7001={};_0x3e7001[_0x2651('0x2b')]=_[_0x2651('0x2c')](db[_0x2651('0x27')][_0x2651('0x3d')]);_0x3e7001[_0x2651('0x2e')]=_[_0x2651('0x2c')](_0xcf7ba0[_0x2651('0x2e')]);_0x3e7001['filters']=_[_0x2651('0x3e')](_0x3e7001[_0x2651('0x2b')],_0x3e7001[_0x2651('0x2e')]);_0xc25b4e[_0x2651('0x30')]=_['intersection'](_0x3e7001['model'],qs[_0x2651('0x2f')](_0xcf7ba0[_0x2651('0x2e')][_0x2651('0x2f')]));_0xc25b4e['attributes']=_0xc25b4e[_0x2651('0x30')][_0x2651('0x31')]?_0xc25b4e[_0x2651('0x30')]:_0x3e7001[_0x2651('0x2b')];if(_0xcf7ba0[_0x2651('0x2e')][_0x2651('0x3b')]){_0xc25b4e[_0x2651('0x3f')]=[{'all':!![]}];}_0xc25b4e=_['merge']({},_0xc25b4e,_0xcf7ba0['options']);return db[_0x2651('0x27')][_0x2651('0x40')](_0xc25b4e)[_0x2651('0x20')](handleEntityNotFound(_0x5020da,null))[_0x2651('0x20')](respondWithResult(_0x5020da,null))['catch'](handleError(_0x5020da,null));};exports[_0x2651('0x41')]=function(_0x3296c1,_0x40fb9a){return db['VoiceTransferReport'][_0x2651('0x41')](_0x3296c1[_0x2651('0x42')],{})[_0x2651('0x20')](respondWithResult(_0x40fb9a,0xc9))[_0x2651('0x43')](handleError(_0x40fb9a,null));};exports[_0x2651('0x1e')]=function(_0x1fb928,_0x17d60f){if(_0x1fb928[_0x2651('0x42')]['id']){delete _0x1fb928['body']['id'];}return db['VoiceTransferReport'][_0x2651('0x40')]({'where':{'id':_0x1fb928[_0x2651('0x44')]['id']}})[_0x2651('0x20')](handleEntityNotFound(_0x17d60f,null))[_0x2651('0x20')](saveUpdates(_0x1fb928[_0x2651('0x42')],null))['then'](respondWithResult(_0x17d60f,null))['catch'](handleError(_0x17d60f,null));};exports[_0x2651('0x1f')]=function(_0x374574,_0x5b7d57){return db[_0x2651('0x27')]['find']({'where':{'id':_0x374574[_0x2651('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b7d57,null))[_0x2651('0x20')](removeEntity(_0x5b7d57,null))['catch'](handleError(_0x5b7d57,null));}; \ No newline at end of file +var _0x9040=['mustache','path','sox','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','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','then','stack','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x29bc3a,_0x2904e3){var _0x5677e2=function(_0x5ba99e){while(--_0x5ba99e){_0x29bc3a['push'](_0x29bc3a['shift']());}};_0x5677e2(++_0x2904e3);}(_0x9040,0x170));var _0x0904=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9040[_0xd1d19a];return _0x52a79d;};'use strict';var pdf=require(_0x0904('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0904('0x1'));var zipdir=require(_0x0904('0x2'));var jsonpatch=require(_0x0904('0x3'));var rp=require(_0x0904('0x4'));var moment=require(_0x0904('0x5'));var BPromise=require(_0x0904('0x6'));var Mustache=require(_0x0904('0x7'));var util=require('util');var path=require(_0x0904('0x8'));var sox=require(_0x0904('0x9'));var csv=require('to-csv');var ejs=require(_0x0904('0xa'));var fs=require('fs');var _=require(_0x0904('0xb'));var squel=require(_0x0904('0xc'));var crypto=require(_0x0904('0xd'));var jsforce=require(_0x0904('0xe'));var deskjs=require(_0x0904('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0904('0x10'));var Papa=require(_0x0904('0x11'));var Redis=require(_0x0904('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0904('0x13'));var as=require(_0x0904('0x14'));var hardwareService=require(_0x0904('0x15'));var logger=require('../../config/logger')(_0x0904('0x16'));var utils=require(_0x0904('0x17'));var config=require(_0x0904('0x18'));var licenseUtil=require(_0x0904('0x19'));var db=require(_0x0904('0x1a'))['db'];function respondWithStatusCode(_0x3b2239,_0x46435b){_0x46435b=_0x46435b||0xcc;return function(_0x4fc04b){if(_0x4fc04b){return _0x3b2239[_0x0904('0x1b')](_0x46435b);}return _0x3b2239['status'](_0x46435b)[_0x0904('0x1c')]();};}function respondWithResult(_0x497ab9,_0x5b1895){_0x5b1895=_0x5b1895||0xc8;return function(_0x4cc898){if(_0x4cc898){return _0x497ab9[_0x0904('0x1d')](_0x5b1895)[_0x0904('0x1e')](_0x4cc898);}};}function respondWithFilteredResult(_0x1a6180,_0x59b77e){return function(_0x2af569){if(_0x2af569){var _0x4f7cb7=_0x2af569[_0x0904('0x1f')],_0x3e47c8=_0x59b77e[_0x0904('0x20')],_0x5302e6=_0x59b77e[_0x0904('0x20')]+_0x59b77e['limit'],_0x27d7c1;if(_0x5302e6>=_0x4f7cb7){_0x5302e6=_0x4f7cb7;_0x27d7c1=0xc8;}else{_0x27d7c1=0xce;}_0x1a6180[_0x0904('0x1d')](_0x27d7c1);return _0x1a6180[_0x0904('0x21')](_0x0904('0x22'),_0x3e47c8+'-'+_0x5302e6+'/'+_0x4f7cb7)[_0x0904('0x1e')](_0x2af569);}return null;};}function patchUpdates(_0x32c44b){return function(_0x102854){try{jsonpatch[_0x0904('0x23')](_0x102854,_0x32c44b,!![]);}catch(_0x454a23){return BPromise['reject'](_0x454a23);}return _0x102854['save']();};}function saveUpdates(_0x39298e,_0x2c1750){return function(_0xd00c64){if(_0xd00c64){return _0xd00c64[_0x0904('0x24')](_0x39298e)[_0x0904('0x25')](function(_0x598b65){return _0x598b65;});}return null;};}function removeEntity(_0x37ba56,_0x62e5f2){return function(_0x5b4923){if(_0x5b4923){return _0x5b4923['destroy']()[_0x0904('0x25')](function(){_0x37ba56[_0x0904('0x1d')](0xcc)[_0x0904('0x1c')]();});}};}function handleEntityNotFound(_0x2f607b,_0x3d6b82){return function(_0xee0aa3){if(!_0xee0aa3){_0x2f607b[_0x0904('0x1b')](0x194);}return _0xee0aa3;};}function handleError(_0x53d652,_0x44d434){_0x44d434=_0x44d434||0x1f4;return function(_0x4695de){logger['error'](_0x4695de[_0x0904('0x26')]);if(_0x4695de[_0x0904('0x27')]){delete _0x4695de['name'];}_0x53d652[_0x0904('0x1d')](_0x44d434)[_0x0904('0x28')](_0x4695de);};}exports[_0x0904('0x29')]=function(_0x2de494,_0xfb9863){var _0x589606={},_0x363d17={},_0x2de817={'count':0x0,'rows':[]};var _0x499b70=_['map'](db[_0x0904('0x2a')]['rawAttributes'],function(_0x5134ab){return{'name':_0x5134ab[_0x0904('0x2b')],'type':_0x5134ab[_0x0904('0x2c')][_0x0904('0x2d')]};});_0x363d17[_0x0904('0x2e')]=_[_0x0904('0x2f')](_0x499b70,_0x0904('0x27'));_0x363d17[_0x0904('0x30')]=_[_0x0904('0x31')](_0x2de494[_0x0904('0x30')]);_0x363d17[_0x0904('0x32')]=_[_0x0904('0x33')](_0x363d17[_0x0904('0x2e')],_0x363d17[_0x0904('0x30')]);_0x589606[_0x0904('0x34')]=_[_0x0904('0x33')](_0x363d17[_0x0904('0x2e')],qs[_0x0904('0x35')](_0x2de494[_0x0904('0x30')][_0x0904('0x35')]));_0x589606['attributes']=_0x589606[_0x0904('0x34')][_0x0904('0x36')]?_0x589606[_0x0904('0x34')]:_0x363d17[_0x0904('0x2e')];if(!_0x2de494['query'][_0x0904('0x37')]('nolimit')){_0x589606['limit']=qs[_0x0904('0x38')](_0x2de494[_0x0904('0x30')][_0x0904('0x38')]);_0x589606['offset']=qs[_0x0904('0x20')](_0x2de494[_0x0904('0x30')][_0x0904('0x20')]);}_0x589606[_0x0904('0x39')]=qs[_0x0904('0x3a')](_0x2de494['query'][_0x0904('0x3a')]);_0x589606[_0x0904('0x3b')]=qs['filters'](_[_0x0904('0x3c')](_0x2de494[_0x0904('0x30')],_0x363d17['filters']),_0x499b70);if(_0x2de494[_0x0904('0x30')][_0x0904('0x3d')]){_0x589606[_0x0904('0x3b')]=_['merge'](_0x589606[_0x0904('0x3b')],{'$or':_[_0x0904('0x2f')](_0x499b70,function(_0x345b30){if(_0x345b30[_0x0904('0x2c')]!==_0x0904('0x3e')){var _0x4d553d={};_0x4d553d[_0x345b30[_0x0904('0x27')]]={'$like':'%'+_0x2de494['query']['filter']+'%'};return _0x4d553d;}})});}_0x589606=_[_0x0904('0x3f')]({},_0x589606,_0x2de494[_0x0904('0x40')]);var _0x2d01c4={'where':_0x589606[_0x0904('0x3b')]};return db[_0x0904('0x2a')][_0x0904('0x1f')](_0x2d01c4)[_0x0904('0x25')](function(_0x44dd6a){_0x2de817[_0x0904('0x1f')]=_0x44dd6a;if(_0x2de494[_0x0904('0x30')][_0x0904('0x41')]){_0x589606[_0x0904('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x0904('0x43')](_0x589606);})[_0x0904('0x25')](function(_0x421881){_0x2de817['rows']=_0x421881;return _0x2de817;})[_0x0904('0x25')](respondWithFilteredResult(_0xfb9863,_0x589606))[_0x0904('0x44')](handleError(_0xfb9863,null));};exports[_0x0904('0x45')]=function(_0x3e23ef,_0x1b17dd){var _0x2ffe76={'raw':!![],'where':{'id':_0x3e23ef['params']['id']}},_0x2d9285={};_0x2d9285['model']=_[_0x0904('0x31')](db['VoiceTransferReport'][_0x0904('0x46')]);_0x2d9285[_0x0904('0x30')]=_[_0x0904('0x31')](_0x3e23ef['query']);_0x2d9285[_0x0904('0x32')]=_[_0x0904('0x33')](_0x2d9285['model'],_0x2d9285[_0x0904('0x30')]);_0x2ffe76[_0x0904('0x34')]=_[_0x0904('0x33')](_0x2d9285[_0x0904('0x2e')],qs[_0x0904('0x35')](_0x3e23ef[_0x0904('0x30')][_0x0904('0x35')]));_0x2ffe76['attributes']=_0x2ffe76[_0x0904('0x34')][_0x0904('0x36')]?_0x2ffe76['attributes']:_0x2d9285[_0x0904('0x2e')];if(_0x3e23ef[_0x0904('0x30')][_0x0904('0x41')]){_0x2ffe76[_0x0904('0x42')]=[{'all':!![]}];}_0x2ffe76=_['merge']({},_0x2ffe76,_0x3e23ef['options']);return db[_0x0904('0x2a')][_0x0904('0x47')](_0x2ffe76)[_0x0904('0x25')](handleEntityNotFound(_0x1b17dd,null))[_0x0904('0x25')](respondWithResult(_0x1b17dd,null))[_0x0904('0x44')](handleError(_0x1b17dd,null));};exports[_0x0904('0x48')]=function(_0x101a16,_0x2d6e4b){return db[_0x0904('0x2a')][_0x0904('0x48')](_0x101a16[_0x0904('0x49')],{})[_0x0904('0x25')](respondWithResult(_0x2d6e4b,0xc9))[_0x0904('0x44')](handleError(_0x2d6e4b,null));};exports['update']=function(_0x13f729,_0x2631b7){if(_0x13f729['body']['id']){delete _0x13f729[_0x0904('0x49')]['id'];}return db[_0x0904('0x2a')][_0x0904('0x47')]({'where':{'id':_0x13f729['params']['id']}})[_0x0904('0x25')](handleEntityNotFound(_0x2631b7,null))['then'](saveUpdates(_0x13f729[_0x0904('0x49')],null))[_0x0904('0x25')](respondWithResult(_0x2631b7,null))[_0x0904('0x44')](handleError(_0x2631b7,null));};exports['destroy']=function(_0x4f8812,_0x1ea521){return db[_0x0904('0x2a')][_0x0904('0x47')]({'where':{'id':_0x4f8812[_0x0904('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ea521,null))['then'](removeEntity(_0x1ea521,null))[_0x0904('0x44')](handleError(_0x1ea521,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2ca2d91..cfb38b8 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 _0x1bb5=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','path','./voiceTransferReport.attributes','define'];(function(_0xd5c1e9,_0x333aae){var _0x233872=function(_0xf6f996){while(--_0xf6f996){_0xd5c1e9['push'](_0xd5c1e9['shift']());}};_0x233872(++_0x333aae);}(_0x1bb5,0x82));var _0x51bb=function(_0x39c760,_0x4daa3d){_0x39c760=_0x39c760-0x0;var _0x472eb3=_0x1bb5[_0x39c760];return _0x472eb3;};'use strict';var _=require('lodash');var util=require(_0x51bb('0x0'));var logger=require(_0x51bb('0x1'))(_0x51bb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51bb('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51bb('0x4'));module['exports']=function(_0x118704,_0x12b8c6){return _0x118704[_0x51bb('0x5')](_0x51bb('0x6'),attributes,{'tableName':_0x51bb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe67e=['define','VoiceTransferReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x526d7d,_0x28fafa){var _0xca43d0=function(_0x23def5){while(--_0x23def5){_0x526d7d['push'](_0x526d7d['shift']());}};_0xca43d0(++_0x28fafa);}(_0xe67e,0x1ca));var _0xee67=function(_0x262243,_0x2cba17){_0x262243=_0x262243-0x0;var _0x469f8f=_0xe67e[_0x262243];return _0x469f8f;};'use strict';var _=require(_0xee67('0x0'));var util=require(_0xee67('0x1'));var logger=require(_0xee67('0x2'))('api');var moment=require(_0xee67('0x3'));var BPromise=require(_0xee67('0x4'));var rp=require(_0xee67('0x5'));var fs=require('fs');var path=require(_0xee67('0x6'));var rimraf=require(_0xee67('0x7'));var config=require(_0xee67('0x8'));var attributes=require(_0xee67('0x9'));module['exports']=function(_0x131dcb,_0x28b6e5){return _0x131dcb[_0xee67('0xa')](_0xee67('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 94ce801..d0291a3 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 _0x3b36=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x3b36,0x181));var _0x63b3=function(_0x525a5f,_0x4f9fa1){_0x525a5f=_0x525a5f-0x0;var _0x51d86e=_0x3b36[_0x525a5f];return _0x51d86e;};'use strict';var _=require('lodash');var util=require(_0x63b3('0x0'));var moment=require('moment');var BPromise=require(_0x63b3('0x1'));var rs=require(_0x63b3('0x2'));var fs=require('fs');var Redis=require(_0x63b3('0x3'));var db=require(_0x63b3('0x4'))['db'];var utils=require(_0x63b3('0x5'));var logger=require(_0x63b3('0x6'))(_0x63b3('0x7'));var config=require(_0x63b3('0x8'));var jayson=require(_0x63b3('0x9'));var client=jayson[_0x63b3('0xa')][_0x63b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25d851,_0x298f48,_0x2bd991){return new BPromise(function(_0x408454,_0x284f41){return client[_0x63b3('0xc')](_0x25d851,_0x2bd991)[_0x63b3('0xd')](function(_0xb1016){logger['info'](_0x63b3('0xe'),_0x298f48,'request\x20sent');logger[_0x63b3('0xf')](_0x63b3('0x10'),_0x298f48,_0x63b3('0x11'),JSON[_0x63b3('0x12')](_0xb1016));if(_0xb1016['error']){if(_0xb1016['error'][_0x63b3('0x13')]===0x1f4){logger[_0x63b3('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x298f48,_0xb1016[_0x63b3('0x14')][_0x63b3('0x15')]);return _0x284f41(_0xb1016[_0x63b3('0x14')][_0x63b3('0x15')]);}logger['error'](_0x63b3('0xe'),_0x298f48,_0xb1016['error'][_0x63b3('0x15')]);return _0x408454(_0xb1016[_0x63b3('0x14')][_0x63b3('0x15')]);}else{logger[_0x63b3('0x16')](_0x63b3('0xe'),_0x298f48,_0x63b3('0x11'));_0x408454(_0xb1016['result']['message']);}})[_0x63b3('0x17')](function(_0x55ebce){logger[_0x63b3('0x14')](_0x63b3('0xe'),_0x298f48,_0x55ebce);_0x284f41(_0x55ebce);});});}exports['CreateVoiceTransferReport']=function(_0x3090c0){var _0x346c7c=this;return new Promise(function(_0x1597bf,_0x17001d){return db[_0x63b3('0x18')][_0x63b3('0x19')](_0x3090c0[_0x63b3('0x1a')],{'raw':_0x3090c0['options']?_0x3090c0[_0x63b3('0x1b')][_0x63b3('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x33c02f){logger[_0x63b3('0x16')](_0x63b3('0x1d'),_0x3090c0);logger[_0x63b3('0xf')](_0x63b3('0x1d'),_0x3090c0,JSON[_0x63b3('0x12')](_0x33c02f));_0x1597bf(_0x33c02f);})[_0x63b3('0x17')](function(_0x45ac24){logger['error'](_0x63b3('0x1d'),_0x45ac24[_0x63b3('0x15')],_0x3090c0);_0x17001d(_0x346c7c[_0x63b3('0x14')](0x1f4,_0x45ac24[_0x63b3('0x15')]));});});}; \ No newline at end of file +var _0x5cad=['CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result'];(function(_0x314485,_0x447bd2){var _0x1c4c96=function(_0x535c4b){while(--_0x535c4b){_0x314485['push'](_0x314485['shift']());}};_0x1c4c96(++_0x447bd2);}(_0x5cad,0x8c));var _0xd5ca=function(_0x5636a5,_0x2bb5dc){_0x5636a5=_0x5636a5-0x0;var _0x32c581=_0x5cad[_0x5636a5];return _0x32c581;};'use strict';var _=require(_0xd5ca('0x0'));var util=require(_0xd5ca('0x1'));var moment=require(_0xd5ca('0x2'));var BPromise=require(_0xd5ca('0x3'));var rs=require(_0xd5ca('0x4'));var fs=require('fs');var Redis=require(_0xd5ca('0x5'));var db=require(_0xd5ca('0x6'))['db'];var utils=require(_0xd5ca('0x7'));var logger=require(_0xd5ca('0x8'))(_0xd5ca('0x9'));var config=require(_0xd5ca('0xa'));var jayson=require(_0xd5ca('0xb'));var client=jayson[_0xd5ca('0xc')][_0xd5ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33574c,_0x213303,_0x9cc275){return new BPromise(function(_0x1aa01e,_0x332a9a){return client[_0xd5ca('0xe')](_0x33574c,_0x9cc275)[_0xd5ca('0xf')](function(_0x5cb395){logger[_0xd5ca('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x213303,_0xd5ca('0x11'));logger['debug'](_0xd5ca('0x12'),_0x213303,'request\x20sent',JSON[_0xd5ca('0x13')](_0x5cb395));if(_0x5cb395[_0xd5ca('0x14')]){if(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x15')]===0x1f4){logger[_0xd5ca('0x14')](_0xd5ca('0x16'),_0x213303,_0x5cb395[_0xd5ca('0x14')]['message']);return _0x332a9a(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x17')]);}logger[_0xd5ca('0x14')](_0xd5ca('0x16'),_0x213303,_0x5cb395['error'][_0xd5ca('0x17')]);return _0x1aa01e(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x17')]);}else{logger[_0xd5ca('0x10')](_0xd5ca('0x16'),_0x213303,_0xd5ca('0x11'));_0x1aa01e(_0x5cb395[_0xd5ca('0x18')][_0xd5ca('0x17')]);}})['catch'](function(_0x5dbcaf){logger[_0xd5ca('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x213303,_0x5dbcaf);_0x332a9a(_0x5dbcaf);});});}exports[_0xd5ca('0x19')]=function(_0x23c792){var _0x1d0f57=this;return new Promise(function(_0xdd80f6,_0xc1737c){return db[_0xd5ca('0x1a')][_0xd5ca('0x1b')](_0x23c792[_0xd5ca('0x1c')],{'raw':_0x23c792[_0xd5ca('0x1d')]?_0x23c792[_0xd5ca('0x1d')][_0xd5ca('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x221e5a){logger['info'](_0xd5ca('0x19'),_0x23c792);logger[_0xd5ca('0x1f')](_0xd5ca('0x19'),_0x23c792,JSON[_0xd5ca('0x13')](_0x221e5a));_0xdd80f6(_0x221e5a);})[_0xd5ca('0x20')](function(_0x475a44){logger['error']('CreateVoiceTransferReport',_0x475a44[_0xd5ca('0x17')],_0x23c792);_0xc1737c(_0x1d0f57[_0xd5ca('0x14')](0x1f4,_0x475a44[_0xd5ca('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index fcb623b..5ee7af2 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 _0x142c=['../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','/hangup','/answer','/hold','hold','unhold','/calls','calls','/transfer','transfer','express'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x142c,0x86));var _0xc142=function(_0x3142e7,_0x2bd524){_0x3142e7=_0x3142e7-0x0;var _0x111e5c=_0x142c[_0x3142e7];return _0x111e5c;};'use strict';var express=require(_0xc142('0x0'));var router=express['Router']();var auth=require(_0xc142('0x1'));var controller=require(_0xc142('0x2'));router[_0xc142('0x3')]('/originate',auth[_0xc142('0x4')](),auth[_0xc142('0x5')](),controller['originate']);router['post'](_0xc142('0x6'),auth['isAuthenticated'](),auth[_0xc142('0x5')](),controller['hangup']);router[_0xc142('0x3')](_0xc142('0x7'),auth[_0xc142('0x4')](),auth['canUpdate'](),controller['answer']);router[_0xc142('0x3')](_0xc142('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc142('0x9')]);router[_0xc142('0x3')]('/unhold',auth[_0xc142('0x4')](),auth['canUpdate'](),controller[_0xc142('0xa')]);router['post'](_0xc142('0xb'),auth[_0xc142('0x4')](),auth[_0xc142('0x5')](),controller[_0xc142('0xc')]);router['post'](_0xc142('0xd'),auth[_0xc142('0x4')](),auth['canUpdate'](),controller[_0xc142('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaefc=['transfer','exports','express','Router','../../components/auth/service','post','/originate','originate','canUpdate','hangup','/answer','answer','isAuthenticated','/unhold','unhold','/calls','calls','/transfer'];(function(_0x51734f,_0x139dd4){var _0x5979b4=function(_0x143de6){while(--_0x143de6){_0x51734f['push'](_0x51734f['shift']());}};_0x5979b4(++_0x139dd4);}(_0xaefc,0xc8));var _0xcaef=function(_0x4b8037,_0x42fe4a){_0x4b8037=_0x4b8037-0x0;var _0x121747=_0xaefc[_0x4b8037];return _0x121747;};'use strict';var express=require(_0xcaef('0x0'));var router=express[_0xcaef('0x1')]();var auth=require(_0xcaef('0x2'));var controller=require('./webbar.controller');router[_0xcaef('0x3')](_0xcaef('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcaef('0x5')]);router[_0xcaef('0x3')]('/hangup',auth['isAuthenticated'](),auth[_0xcaef('0x6')](),controller[_0xcaef('0x7')]);router['post'](_0xcaef('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xcaef('0x9')]);router[_0xcaef('0x3')]('/hold',auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller['hold']);router[_0xcaef('0x3')](_0xcaef('0xb'),auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller[_0xcaef('0xc')]);router[_0xcaef('0x3')](_0xcaef('0xd'),auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller[_0xcaef('0xe')]);router['post'](_0xcaef('0xf'),auth[_0xcaef('0xa')](),auth[_0xcaef('0x6')](),controller[_0xcaef('0x10')]);module[_0xcaef('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c350b94..b0c2934 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 _0x2b52=['defaults','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','originate\x20executed!','hangup','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis'];(function(_0x364610,_0x282939){var _0x568a3a=function(_0x3eacb9){while(--_0x3eacb9){_0x364610['push'](_0x364610['shift']());}};_0x568a3a(++_0x282939);}(_0x2b52,0x12a));var _0x22b5=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x2b52[_0x4d613c];return _0x301fe3;};'use strict';var path=require(_0x22b5('0x0'));var fs=require('fs');var _=require(_0x22b5('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x22b5('0x2'));var util=require(_0x22b5('0x3'));var BPromise=require(_0x22b5('0x4'));var jayson=require(_0x22b5('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x22b5('0x6'))(_0x22b5('0x7'));var Redis=require(_0x22b5('0x8'));config[_0x22b5('0x9')]=_[_0x22b5('0xa')](config[_0x22b5('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x22b5('0xb'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x22b5('0xc')]},'callNumber':{'type':_0x22b5('0xd'),'required':[!![],_0x22b5('0xe')]},'callerId':{'type':_0x22b5('0xd')},'callbackUrl':{'type':_0x22b5('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':[!![],_0x22b5('0x10')]},'transferNumber':{'type':_0x22b5('0xd'),'required':[!![],_0x22b5('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]},'sessionId':{'type':_0x22b5('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x22b5('0xf'),'required':[!![],_0x22b5('0xc')]}});function emit(_0x235fba,_0x29ceb1,_0x3f5cf8){logger[_0x22b5('0x12')](_0x235fba,_0x29ceb1,JSON[_0x22b5('0x13')](_0x3f5cf8));io['to'](_0x235fba)[_0x22b5('0x14')](_0x29ceb1,_0x3f5cf8);}function handleError(_0x3decc2){return function(_0x1f41b9){console[_0x22b5('0x15')]('handleError:',_0x1f41b9,_0x1f41b9 instanceof RangeError);logger[_0x22b5('0x16')](_0x1f41b9[_0x22b5('0x17')]);if(_0x1f41b9 instanceof RangeError){if(_0x1f41b9[_0x22b5('0x18')]){delete _0x1f41b9[_0x22b5('0x18')];}_0x3decc2[_0x22b5('0x19')](0x194)['send'](_0x1f41b9);}else{if(_0x1f41b9[_0x22b5('0x18')]){delete _0x1f41b9[_0x22b5('0x18')];}_0x3decc2[_0x22b5('0x19')](0x1f4)['send'](_0x1f41b9);}};}function checkError(){return function(_0x4f6f48){if(!_0x4f6f48){throw new RangeError(_0x22b5('0x1a'));}return _0x4f6f48;};}function respondWithRpcPromise(_0x2ef0df,_0x3ca329){return new BPromise(function(_0x4becc2,_0x3b0c31){var _0x132c88=amiClient;return _0x132c88[_0x22b5('0x1b')](_0x2ef0df,_0x3ca329)[_0x22b5('0x1c')](function(_0x156b50){if(_0x156b50[_0x22b5('0x16')]){if(_0x156b50[_0x22b5('0x16')][_0x22b5('0x1d')]===0x1f4){return _0x3b0c31(_0x156b50[_0x22b5('0x16')]['message']);}return _0x4becc2(_0x156b50['error'][_0x22b5('0x1e')]);}else{_0x4becc2(_0x156b50[_0x22b5('0x1f')]);}})[_0x22b5('0x20')](function(_0x3070b2){_0x3b0c31(_0x3070b2);});});}function getAgent(_0x331012){return db[_0x22b5('0x21')][_0x22b5('0x22')]({'where':{'id':_0x331012,'role':_0x22b5('0x23')}})[_0x22b5('0x1c')](checkError());}function getAgentCheckSession(_0x26b956,_0x3d495f){return new BPromise(function(_0x196953,_0x22f2e8){var _0xc03b6f=respondWithRpcPromise(_0x22b5('0x24'));var _0x516f79=getAgent(_0x26b956);Promise['all']([_0xc03b6f,_0x516f79])[_0x22b5('0x1c')](function(_0x11dfa0){var _0x3ac2f8=_0x11dfa0[0x0];var _0x1e6bec=_0x11dfa0[0x1];var _0x513a5b=_[_0x22b5('0x25')](_0x3ac2f8[_0x22b5('0x26')],function(_0x1f6d09){return _0x1f6d09[_0x22b5('0x27')]==_0x1e6bec['id']&&_0x1f6d09['sessionId']==_0x3d495f;});if(_0x513a5b[_0x22b5('0x28')]==0x1){_0x196953(_0x1e6bec);}else{_0x22f2e8(new RangeError('sessionId\x20'+_0x3d495f+_0x22b5('0x29')));}});});}exports[_0x22b5('0x2a')]=function(_0x2cc80a,_0x96ffee){logger['info'](_0x22b5('0x2b'),_0x2cc80a[_0x22b5('0x2c')]);var _0x1899c1=originateValidation['validate'](_0x2cc80a[_0x22b5('0x2c')]);if(_0x1899c1[_0x22b5('0x28')]>0x0){return _0x96ffee[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x1899c1);}var _0x5df7f9=_0x2cc80a[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x21ab64=_0x2cc80a[_0x22b5('0x2c')][_0x22b5('0x2f')];var _0x1fe1ab=_0x2cc80a['body'][_0x22b5('0x30')];var _0x2008e4=_0x2cc80a[_0x22b5('0x2c')][_0x22b5('0x31')];return getAgent(_0x5df7f9)[_0x22b5('0x1c')](function(_0x50fc9d){logger[_0x22b5('0x12')]('entityFound:',_0x50fc9d[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x50fc9d[_0x22b5('0x18')]),'webbar:originate',{'callNumber':_0x21ab64,'callerId':_0x1fe1ab,'callbackUrl':_0x2008e4});return _0x96ffee['status'](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x34')});})[_0x22b5('0x20')](handleError(_0x96ffee));};exports[_0x22b5('0x35')]=function(_0x7cced9,_0x1997fc){logger[_0x22b5('0x12')]('hangup\x20fired:',_0x7cced9[_0x22b5('0x2c')]);var _0x532a12=hangupValidation['validate'](_0x7cced9['body']);if(_0x532a12['length']>0x0){return _0x1997fc[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x532a12);}var _0x34db2c=_0x7cced9[_0x22b5('0x2c')]['userId'];var _0x3ec27e=_0x7cced9['body'][_0x22b5('0x36')];return getAgent(_0x34db2c)[_0x22b5('0x1c')](function(_0x84d0bc){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x84d0bc[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x84d0bc[_0x22b5('0x18')]),_0x22b5('0x38'),{'sessionId':_0x3ec27e});return _0x1997fc[_0x22b5('0x19')](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x39')});})[_0x22b5('0x20')](handleError(_0x1997fc));};exports[_0x22b5('0x3a')]=function(_0x257d4a,_0x18c231){logger['info'](_0x22b5('0x3b'),_0x257d4a['body']);var _0x2b9da0=answerValidation[_0x22b5('0x3c')](_0x257d4a[_0x22b5('0x2c')]);if(_0x2b9da0['length']>0x0){return _0x18c231[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x2b9da0);}var _0x1aaf43=_0x257d4a[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x2bd24b=_0x257d4a[_0x22b5('0x2c')][_0x22b5('0x36')];return getAgent(_0x1aaf43)[_0x22b5('0x1c')](function(_0x28080e){logger[_0x22b5('0x12')]('entityFound:',_0x28080e[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x28080e[_0x22b5('0x18')]),_0x22b5('0x3d'),{'sessionId':_0x2bd24b});return _0x18c231['status'](0xc8)[_0x22b5('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x22b5('0x20')](handleError(_0x18c231));};exports['hold']=function(_0x20f607,_0x3d64d9){logger['info'](_0x22b5('0x3e'),_0x20f607[_0x22b5('0x2c')]);var _0x3a8df5=holdValidation[_0x22b5('0x3c')](_0x20f607[_0x22b5('0x2c')]);if(_0x3a8df5[_0x22b5('0x28')]>0x0){return _0x3d64d9[_0x22b5('0x19')](0x190)['json'](_0x3a8df5);}var _0xc439e2=_0x20f607[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x3759af=_0x20f607[_0x22b5('0x2c')]['sessionId'];return getAgent(_0xc439e2)[_0x22b5('0x1c')](function(_0x398c8d){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x398c8d[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x398c8d[_0x22b5('0x18')]),_0x22b5('0x3f'),{'sessionId':_0x3759af});return _0x3d64d9[_0x22b5('0x19')](0xc8)['json']({'error':![],'message':_0x22b5('0x40')});})[_0x22b5('0x20')](handleError(_0x3d64d9));};exports[_0x22b5('0x41')]=function(_0x14a8c2,_0x30ab23){logger[_0x22b5('0x12')](_0x22b5('0x42'),_0x14a8c2[_0x22b5('0x2c')]);var _0x2e32b8=unholdValidation[_0x22b5('0x3c')](_0x14a8c2[_0x22b5('0x2c')]);if(_0x2e32b8['length']>0x0){return _0x30ab23[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x2e32b8);}var _0x31faa2=_0x14a8c2['body']['userId'];var _0x46be6e=_0x14a8c2[_0x22b5('0x2c')][_0x22b5('0x36')];return getAgent(_0x31faa2)[_0x22b5('0x1c')](function(_0x4bbc1d){logger[_0x22b5('0x12')]('entityFound:',_0x4bbc1d['name']);emit(util[_0x22b5('0x32')]('user:%s',_0x4bbc1d[_0x22b5('0x18')]),_0x22b5('0x43'),{'sessionId':_0x46be6e});return _0x30ab23[_0x22b5('0x19')](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x44')});})['catch'](handleError(_0x30ab23));};exports[_0x22b5('0x45')]=function(_0x4aa074,_0xd191ae){logger[_0x22b5('0x12')]('calls\x20fired:',_0xd191ae[_0x22b5('0x2c')]);var _0x5006e6=callsValidation[_0x22b5('0x3c')](_0x4aa074[_0x22b5('0x2c')]);if(_0x5006e6['length']>0x0){return _0xd191ae[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x5006e6);}var _0x2fa911=_0x4aa074[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x5657b6=respondWithRpcPromise('VoiceChannels');var _0x54a332=getAgent(_0x2fa911);return Promise['all']([_0x5657b6,_0x54a332])['then'](function(_0x900913){var _0x4707b6=_0x900913[0x0];var _0xbae105=_0x900913[0x1];var _0x27c198=_[_0x22b5('0x25')](_0x4707b6[_0x22b5('0x26')],function(_0x5c6794){return _0x5c6794[_0x22b5('0x27')]==_0xbae105['id'];});return _0xd191ae[_0x22b5('0x19')](0xc8)['json']({'count':_0x27c198['length'],'rows':_0x27c198});})[_0x22b5('0x20')](handleError(_0xd191ae));};exports[_0x22b5('0x46')]=function(_0x594b51,_0x18e345){logger[_0x22b5('0x12')]('conference\x20fired:',_0x594b51[_0x22b5('0x2c')]);var _0x464ec4=conferenceValidation[_0x22b5('0x3c')](_0x594b51['body']);if(_0x464ec4[_0x22b5('0x28')]>0x0){return _0x18e345[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x464ec4);}var _0x3fba9e=_0x594b51[_0x22b5('0x2c')]['userId'];return getAgent(_0x3fba9e)[_0x22b5('0x1c')](function(_0x8a9aef){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x8a9aef[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x8a9aef[_0x22b5('0x18')]),_0x22b5('0x47'));return _0x18e345[_0x22b5('0x19')](0xc8)[_0x22b5('0x2d')]({'error':![],'message':_0x22b5('0x48')});})[_0x22b5('0x20')](handleError(_0x18e345));};exports[_0x22b5('0x49')]=function(_0x30a68a,_0x5b877b){logger[_0x22b5('0x12')](_0x22b5('0x4a'),_0x30a68a[_0x22b5('0x2c')]);var _0x1fdb23=transferValidation['validate'](_0x30a68a[_0x22b5('0x2c')]);if(_0x1fdb23['length']>0x0){return _0x5b877b[_0x22b5('0x19')](0x190)[_0x22b5('0x2d')](_0x1fdb23);}var _0x3e063a=_0x30a68a[_0x22b5('0x2c')][_0x22b5('0x2e')];var _0x5d4895=_0x30a68a[_0x22b5('0x2c')][_0x22b5('0x36')];var _0xc40c33=_0x30a68a['body']['transferNumber'];return getAgent(_0x3e063a)[_0x22b5('0x1c')](function(_0x118e3c){logger[_0x22b5('0x12')](_0x22b5('0x37'),_0x118e3c[_0x22b5('0x18')]);emit(util[_0x22b5('0x32')](_0x22b5('0x33'),_0x118e3c[_0x22b5('0x18')]),_0x22b5('0x4b'),{'sessionId':_0x5d4895,'transferNumber':_0xc40c33});return _0x5b877b[_0x22b5('0x19')](0xc8)['json']({'error':![],'message':_0x22b5('0x4c')});})[_0x22b5('0x20')](handleError(_0x5b877b));}; \ No newline at end of file +var _0x44ae=['sessionId','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold\x20fired:','unhold\x20executed!','calls','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','body','json','userId','callNumber','callerId','callbackUrl','info','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','validate','user:%s','answer','answer\x20fired:'];(function(_0x4f8f18,_0x1a6ab0){var _0x331d0b=function(_0x510c5e){while(--_0x510c5e){_0x4f8f18['push'](_0x4f8f18['shift']());}};_0x331d0b(++_0x1a6ab0);}(_0x44ae,0x17d));var _0xe44a=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x44ae[_0x4164f2];return _0x2575c7;};'use strict';var path=require(_0xe44a('0x0'));var fs=require('fs');var _=require(_0xe44a('0x1'));var db=require(_0xe44a('0x2'))['db'];var config=require(_0xe44a('0x3'));var util=require('util');var BPromise=require(_0xe44a('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xe44a('0x5')][_0xe44a('0x6')]({'port':0x232a});var logger=require(_0xe44a('0x7'))(_0xe44a('0x8'));var Redis=require(_0xe44a('0x9'));config[_0xe44a('0xa')]=_['defaults'](config[_0xe44a('0xa')],{'host':_0xe44a('0xb'),'port':0x18eb});var io=require(_0xe44a('0xc'))(new Redis(config[_0xe44a('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'callNumber':{'type':_0xe44a('0xf'),'required':[!![],_0xe44a('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe44a('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0xe44a('0x11')]},'transferNumber':{'type':_0xe44a('0xf'),'required':[!![],_0xe44a('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]},'sessionId':{'type':_0xe44a('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe44a('0xd'),'required':[!![],_0xe44a('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe44a('0xe')]}});function emit(_0x96dee,_0x51a060,_0x550491){logger['info'](_0x96dee,_0x51a060,JSON['stringify'](_0x550491));io['to'](_0x96dee)[_0xe44a('0x13')](_0x51a060,_0x550491);}function handleError(_0x1b943e){return function(_0x2a33b6){console['log'](_0xe44a('0x14'),_0x2a33b6,_0x2a33b6 instanceof RangeError);logger[_0xe44a('0x15')](_0x2a33b6[_0xe44a('0x16')]);if(_0x2a33b6 instanceof RangeError){if(_0x2a33b6[_0xe44a('0x17')]){delete _0x2a33b6[_0xe44a('0x17')];}_0x1b943e[_0xe44a('0x18')](0x194)['send'](_0x2a33b6);}else{if(_0x2a33b6[_0xe44a('0x17')]){delete _0x2a33b6['name'];}_0x1b943e[_0xe44a('0x18')](0x1f4)[_0xe44a('0x19')](_0x2a33b6);}};}function checkError(){return function(_0x35f878){if(!_0x35f878){throw new RangeError(_0xe44a('0x1a'));}return _0x35f878;};}function respondWithRpcPromise(_0x2e7cb7,_0x333d2d){return new BPromise(function(_0x37992e,_0x4e9bab){var _0x203889=amiClient;return _0x203889['request'](_0x2e7cb7,_0x333d2d)[_0xe44a('0x1b')](function(_0x2b53b9){if(_0x2b53b9[_0xe44a('0x15')]){if(_0x2b53b9[_0xe44a('0x15')][_0xe44a('0x1c')]===0x1f4){return _0x4e9bab(_0x2b53b9[_0xe44a('0x15')][_0xe44a('0x1d')]);}return _0x37992e(_0x2b53b9[_0xe44a('0x15')][_0xe44a('0x1d')]);}else{_0x37992e(_0x2b53b9[_0xe44a('0x1e')]);}})[_0xe44a('0x1f')](function(_0x46c16b){_0x4e9bab(_0x46c16b);});});}function getAgent(_0x12bf7c){return db[_0xe44a('0x20')]['findOne']({'where':{'id':_0x12bf7c,'role':_0xe44a('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x3bed81,_0x18acb6){return new BPromise(function(_0x4910a0,_0x552e3f){var _0x3fc048=respondWithRpcPromise(_0xe44a('0x22'));var _0x4c6690=getAgent(_0x3bed81);Promise[_0xe44a('0x23')]([_0x3fc048,_0x4c6690])['then'](function(_0x1cb6c7){var _0x5e0768=_0x1cb6c7[0x0];var _0x5a57a1=_0x1cb6c7[0x1];var _0x4b436b=_['filter'](_0x5e0768[_0xe44a('0x24')],function(_0x5e00f7){return _0x5e00f7[_0xe44a('0x25')]==_0x5a57a1['id']&&_0x5e00f7['sessionId']==_0x18acb6;});if(_0x4b436b[_0xe44a('0x26')]==0x1){_0x4910a0(_0x5a57a1);}else{_0x552e3f(new RangeError(_0xe44a('0x27')+_0x18acb6+_0xe44a('0x28')));}});});}exports['originate']=function(_0x12af37,_0x98e147){logger['info']('originate\x20fired:',_0x12af37[_0xe44a('0x29')]);var _0x5d102f=originateValidation['validate'](_0x12af37[_0xe44a('0x29')]);if(_0x5d102f[_0xe44a('0x26')]>0x0){return _0x98e147[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x5d102f);}var _0x1cc637=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2b')];var _0x42b698=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2c')];var _0x2ace0f=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2d')];var _0x41aa31=_0x12af37[_0xe44a('0x29')][_0xe44a('0x2e')];return getAgent(_0x1cc637)['then'](function(_0x19e6e8){logger[_0xe44a('0x2f')]('entityFound:',_0x19e6e8[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')]('user:%s',_0x19e6e8['name']),_0xe44a('0x31'),{'callNumber':_0x42b698,'callerId':_0x2ace0f,'callbackUrl':_0x41aa31});return _0x98e147[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':_0xe44a('0x32')});})[_0xe44a('0x1f')](handleError(_0x98e147));};exports[_0xe44a('0x33')]=function(_0x49881c,_0x237502){logger[_0xe44a('0x2f')](_0xe44a('0x34'),_0x49881c[_0xe44a('0x29')]);var _0x44cf8b=hangupValidation[_0xe44a('0x35')](_0x49881c['body']);if(_0x44cf8b[_0xe44a('0x26')]>0x0){return _0x237502['status'](0x190)[_0xe44a('0x2a')](_0x44cf8b);}var _0x152ece=_0x49881c[_0xe44a('0x29')]['userId'];var _0x2c08d7=_0x49881c['body']['sessionId'];return getAgent(_0x152ece)[_0xe44a('0x1b')](function(_0x20a20d){logger['info']('entityFound:',_0x20a20d[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x20a20d[_0xe44a('0x17')]),'webbar:hangup',{'sessionId':_0x2c08d7});return _0x237502['status'](0xc8)[_0xe44a('0x2a')]({'error':![],'message':'hangup\x20executed!'});})[_0xe44a('0x1f')](handleError(_0x237502));};exports[_0xe44a('0x37')]=function(_0x1f6ac4,_0x367dda){logger[_0xe44a('0x2f')](_0xe44a('0x38'),_0x1f6ac4[_0xe44a('0x29')]);var _0x2048a3=answerValidation['validate'](_0x1f6ac4[_0xe44a('0x29')]);if(_0x2048a3['length']>0x0){return _0x367dda[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x2048a3);}var _0x5e66db=_0x1f6ac4['body'][_0xe44a('0x2b')];var _0x380833=_0x1f6ac4[_0xe44a('0x29')][_0xe44a('0x39')];return getAgent(_0x5e66db)['then'](function(_0x49c4ea){logger['info'](_0xe44a('0x3a'),_0x49c4ea[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x49c4ea[_0xe44a('0x17')]),_0xe44a('0x3b'),{'sessionId':_0x380833});return _0x367dda[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':_0xe44a('0x3c')});})[_0xe44a('0x1f')](handleError(_0x367dda));};exports[_0xe44a('0x3d')]=function(_0x3b06d8,_0x1bc7ac){logger[_0xe44a('0x2f')](_0xe44a('0x3e'),_0x3b06d8['body']);var _0x17e4a0=holdValidation[_0xe44a('0x35')](_0x3b06d8[_0xe44a('0x29')]);if(_0x17e4a0[_0xe44a('0x26')]>0x0){return _0x1bc7ac['status'](0x190)['json'](_0x17e4a0);}var _0x760a30=_0x3b06d8[_0xe44a('0x29')][_0xe44a('0x2b')];var _0x33862e=_0x3b06d8['body']['sessionId'];return getAgent(_0x760a30)['then'](function(_0x216344){logger[_0xe44a('0x2f')](_0xe44a('0x3a'),_0x216344[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x216344[_0xe44a('0x17')]),_0xe44a('0x3f'),{'sessionId':_0x33862e});return _0x1bc7ac[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1bc7ac));};exports['unhold']=function(_0x370347,_0x3843fc){logger['info'](_0xe44a('0x40'),_0x370347[_0xe44a('0x29')]);var _0x348644=unholdValidation[_0xe44a('0x35')](_0x370347[_0xe44a('0x29')]);if(_0x348644[_0xe44a('0x26')]>0x0){return _0x3843fc[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x348644);}var _0x1cd90d=_0x370347['body']['userId'];var _0xef56cf=_0x370347[_0xe44a('0x29')]['sessionId'];return getAgent(_0x1cd90d)[_0xe44a('0x1b')](function(_0x84cf3e){logger['info'](_0xe44a('0x3a'),_0x84cf3e[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')]('user:%s',_0x84cf3e['name']),'webbar:unhold',{'sessionId':_0xef56cf});return _0x3843fc[_0xe44a('0x18')](0xc8)['json']({'error':![],'message':_0xe44a('0x41')});})[_0xe44a('0x1f')](handleError(_0x3843fc));};exports[_0xe44a('0x42')]=function(_0x5c9aab,_0x39513f){logger[_0xe44a('0x2f')]('calls\x20fired:',_0x39513f[_0xe44a('0x29')]);var _0x36b4e6=callsValidation['validate'](_0x5c9aab[_0xe44a('0x29')]);if(_0x36b4e6[_0xe44a('0x26')]>0x0){return _0x39513f['status'](0x190)[_0xe44a('0x2a')](_0x36b4e6);}var _0x22a58c=_0x5c9aab['body'][_0xe44a('0x2b')];var _0x3e0616=respondWithRpcPromise(_0xe44a('0x22'));var _0x4fbfd5=getAgent(_0x22a58c);return Promise[_0xe44a('0x23')]([_0x3e0616,_0x4fbfd5])[_0xe44a('0x1b')](function(_0xe4296){var _0x2055e4=_0xe4296[0x0];var _0x255123=_0xe4296[0x1];var _0x39c5d8=_['filter'](_0x2055e4[_0xe44a('0x24')],function(_0x156b49){return _0x156b49[_0xe44a('0x25')]==_0x255123['id'];});return _0x39513f['status'](0xc8)[_0xe44a('0x2a')]({'count':_0x39c5d8[_0xe44a('0x26')],'rows':_0x39c5d8});})[_0xe44a('0x1f')](handleError(_0x39513f));};exports['conference']=function(_0x4ce388,_0xbfef35){logger[_0xe44a('0x2f')](_0xe44a('0x43'),_0x4ce388[_0xe44a('0x29')]);var _0x1895e4=conferenceValidation[_0xe44a('0x35')](_0x4ce388[_0xe44a('0x29')]);if(_0x1895e4[_0xe44a('0x26')]>0x0){return _0xbfef35['status'](0x190)[_0xe44a('0x2a')](_0x1895e4);}var _0x75a578=_0x4ce388[_0xe44a('0x29')]['userId'];return getAgent(_0x75a578)[_0xe44a('0x1b')](function(_0x417976){logger['info'](_0xe44a('0x3a'),_0x417976[_0xe44a('0x17')]);emit(util['format'](_0xe44a('0x36'),_0x417976[_0xe44a('0x17')]),_0xe44a('0x44'));return _0xbfef35[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0xe44a('0x1f')](handleError(_0xbfef35));};exports['transfer']=function(_0x1010b2,_0x193ebd){logger['info'](_0xe44a('0x45'),_0x1010b2['body']);var _0x5d61f9=transferValidation[_0xe44a('0x35')](_0x1010b2[_0xe44a('0x29')]);if(_0x5d61f9[_0xe44a('0x26')]>0x0){return _0x193ebd[_0xe44a('0x18')](0x190)[_0xe44a('0x2a')](_0x5d61f9);}var _0x1f9739=_0x1010b2[_0xe44a('0x29')][_0xe44a('0x2b')];var _0x7d84d2=_0x1010b2[_0xe44a('0x29')][_0xe44a('0x39')];var _0x4f567c=_0x1010b2[_0xe44a('0x29')][_0xe44a('0x46')];return getAgent(_0x1f9739)[_0xe44a('0x1b')](function(_0x481646){logger[_0xe44a('0x2f')](_0xe44a('0x3a'),_0x481646[_0xe44a('0x17')]);emit(util[_0xe44a('0x30')](_0xe44a('0x36'),_0x481646[_0xe44a('0x17')]),_0xe44a('0x47'),{'sessionId':_0x7d84d2,'transferNumber':_0x4f567c});return _0x193ebd[_0xe44a('0x18')](0xc8)[_0xe44a('0x2a')]({'error':![],'message':_0xe44a('0x48')});})[_0xe44a('0x1f')](handleError(_0x193ebd));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 09e548f..441de8f 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 _0xe820=['delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','/:id/dispositions','post','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','destroy'];(function(_0x2b010d,_0x357f85){var _0x2e7627=function(_0x50fdff){while(--_0x50fdff){_0x2b010d['push'](_0x2b010d['shift']());}};_0x2e7627(++_0x357f85);}(_0xe820,0xd2));var _0x0e82=function(_0x405a2a,_0x15b978){_0x405a2a=_0x405a2a-0x0;var _0x3b2603=_0xe820[_0x405a2a];return _0x3b2603;};'use strict';var multer=require(_0x0e82('0x0'));var util=require('util');var path=require(_0x0e82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e82('0x2')]();var auth=require(_0x0e82('0x3'));var interaction=require(_0x0e82('0x4'));var config=require('../../config/environment');var controller=require(_0x0e82('0x5'));router['get']('/',auth[_0x0e82('0x6')](),controller[_0x0e82('0x7')]);router[_0x0e82('0x8')](_0x0e82('0x9'),auth[_0x0e82('0x6')](),controller['describe']);router[_0x0e82('0x8')](_0x0e82('0xa'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xb')]);router[_0x0e82('0x8')]('/:id/dispositions',auth[_0x0e82('0x6')](),controller[_0x0e82('0xc')]);router[_0x0e82('0x8')](_0x0e82('0xd'),auth[_0x0e82('0x6')](),controller[_0x0e82('0xe')]);router[_0x0e82('0x8')]('/:id/users',auth[_0x0e82('0x6')](),controller[_0x0e82('0xf')]);router[_0x0e82('0x8')](_0x0e82('0x10'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x11')]);router['post']('/',auth[_0x0e82('0x6')](),controller['create']);router['post'](_0x0e82('0x12'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x0e82('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x0e82('0x13')]('/:id/users',auth[_0x0e82('0x6')](),controller[_0x0e82('0x14')]);router[_0x0e82('0x13')](_0x0e82('0x10'),auth['isAuthenticated'](),controller[_0x0e82('0x15')]);router[_0x0e82('0x13')](_0x0e82('0x16'),controller[_0x0e82('0x17')]);router[_0x0e82('0x13')](_0x0e82('0x18'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x19')]);router[_0x0e82('0x1a')](_0x0e82('0xa'),auth[_0x0e82('0x6')](),controller['update']);router['delete'](_0x0e82('0xa'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x1b')]);router[_0x0e82('0x1c')](_0x0e82('0x12'),auth[_0x0e82('0x6')](),controller[_0x0e82('0x1d')]);router[_0x0e82('0x1c')]('/:id/canned_answers',auth[_0x0e82('0x6')](),controller[_0x0e82('0x1e')]);router[_0x0e82('0x1c')](_0x0e82('0x1f'),auth['isAuthenticated'](),controller[_0x0e82('0x20')]);module[_0x0e82('0x21')]=router; \ No newline at end of file +var _0xf4f4=['/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','create','addAgents','addApplications'];(function(_0x475c1e,_0x49835e){var _0x15aad7=function(_0x296585){while(--_0x296585){_0x475c1e['push'](_0x475c1e['shift']());}};_0x15aad7(++_0x49835e);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x485f43,_0x174272){_0x485f43=_0x485f43-0x0;var _0x34f68e=_0xf4f4[_0x485f43];return _0x34f68e;};'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('0xa')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0xa')](_0x4f4f('0x11'),auth[_0x4f4f('0x8')](),controller['getAnswers']);router['get'](_0x4f4f('0x12'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);router[_0x4f4f('0xa')](_0x4f4f('0x14'),auth[_0x4f4f('0x8')](),controller['getApplications']);router[_0x4f4f('0x15')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0x16')]);router[_0x4f4f('0x15')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller['addDisposition']);router[_0x4f4f('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x4f4f('0x15')](_0x4f4f('0x12'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x17')]);router[_0x4f4f('0x15')](_0x4f4f('0x14'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x15')](_0x4f4f('0x19'),controller[_0x4f4f('0x1a')]);router[_0x4f4f('0x15')]('/:id/send',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1b')]);router[_0x4f4f('0x1c')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1d')]);router[_0x4f4f('0x1e')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x1f')]);router[_0x4f4f('0x1e')](_0x4f4f('0xf'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x20')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f4f('0x21')]);router[_0x4f4f('0x1e')]('/:id/users',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x22')]);module[_0x4f4f('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 90e747f..32d40ab 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 _0x5f62=['mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x5f62,0x178));var _0x25f6=function(_0x19a2eb,_0x2df439){_0x19a2eb=_0x19a2eb-0x0;var _0x3c8514=_0x5f62[_0x19a2eb];return _0x3c8514;};'use strict';var Sequelize=require(_0x25f6('0x0'));var rs=require(_0x25f6('0x1'));module[_0x25f6('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x25f6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x25f6('0x3')],'defaultValue':function(){return rs[_0x25f6('0x4')]();}},'phone':{'type':Sequelize[_0x25f6('0x3')]},'type':{'type':Sequelize[_0x25f6('0x5')](_0x25f6('0x6'))},'accountSid':{'type':Sequelize[_0x25f6('0x3')]},'authToken':{'type':Sequelize[_0x25f6('0x3')]},'notificationTemplate':{'type':Sequelize[_0x25f6('0x7')],'defaultValue':function(){return _0x25f6('0x8');}},'notificationSound':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x25f6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x25f6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x25f6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x25f6('0xa')],'comment':_0x25f6('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x25f6('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12abf7){if(!_0x12abf7){this[_0x25f6('0xc')](_0x25f6('0xd'),null);}this['setDataValue'](_0x25f6('0xe'),_0x12abf7);}},'description':{'type':Sequelize[_0x25f6('0x3')]}}; \ No newline at end of file +var _0x8e64=['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','twilio'];(function(_0x431aa0,_0x38a17c){var _0x50a459=function(_0xfe761b){while(--_0xfe761b){_0x431aa0['push'](_0x431aa0['shift']());}};_0x50a459(++_0x38a17c);}(_0x8e64,0x193));var _0x48e6=function(_0x117f69,_0x89f2e3){_0x117f69=_0x117f69-0x0;var _0x3cece9=_0x8e64[_0x117f69];return _0x3cece9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x48e6('0x0'));module[_0x48e6('0x1')]={'name':{'type':Sequelize[_0x48e6('0x2')],'unique':_0x48e6('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x48e6('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x48e6('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x48e6('0x2')]},'type':{'type':Sequelize['ENUM'](_0x48e6('0x4'))},'accountSid':{'type':Sequelize[_0x48e6('0x2')]},'authToken':{'type':Sequelize[_0x48e6('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x48e6('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x48e6('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x48e6('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x48e6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x48e6('0x7')],'comment':_0x48e6('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x48e6('0x9'),'set':function(_0x190910){if(!_0x190910){this[_0x48e6('0xa')](_0x48e6('0xb'),null);}this[_0x48e6('0xa')]('mandatoryDisposition',_0x190910);}},'description':{'type':Sequelize[_0x48e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 9d4497c..5836a11 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 _0xf88e=['priority','asc','CmContact','ValidationError','updatedAt','difference','createdAt','CompanyId','mobile','From','replace','whatsapp:','messageId','MessageSid','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','DESC','List','user','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','sort','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','getApplications','whatsapp','Applications','account','applications'];(function(_0x5cbf61,_0x572128){var _0x30680a=function(_0x19faba){while(--_0x19faba){_0x5cbf61['push'](_0x5cbf61['shift']());}};_0x30680a(++_0x572128);}(_0xf88e,0x1b4));var _0xef88=function(_0x48507f,_0xfdb1ca){_0x48507f=_0x48507f-0x0;var _0x36eadb=_0xf88e[_0x48507f];return _0x36eadb;};'use strict';var pdf=require(_0xef88('0x0'));var emlformat=require(_0xef88('0x1'));var rimraf=require(_0xef88('0x2'));var zipdir=require(_0xef88('0x3'));var jsonpatch=require(_0xef88('0x4'));var rp=require(_0xef88('0x5'));var moment=require(_0xef88('0x6'));var BPromise=require(_0xef88('0x7'));var Mustache=require(_0xef88('0x8'));var util=require(_0xef88('0x9'));var path=require(_0xef88('0xa'));var sox=require('sox');var csv=require(_0xef88('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef88('0xc'));var jsforce=require(_0xef88('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef88('0xb'));var querystring=require(_0xef88('0xe'));var Papa=require(_0xef88('0xf'));var Redis=require(_0xef88('0x10'));var authService=require(_0xef88('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xef88('0x12'));var hardwareService=require(_0xef88('0x13'));var logger=require(_0xef88('0x14'))(_0xef88('0x15'));var utils=require(_0xef88('0x16'));var config=require(_0xef88('0x17'));var licenseUtil=require(_0xef88('0x18'));var db=require(_0xef88('0x19'))['db'];config[_0xef88('0x1a')]=_[_0xef88('0x1b')](config[_0xef88('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xef88('0x1c'))(new Redis(config[_0xef88('0x1a')]));require(_0xef88('0x1d'))[_0xef88('0x1e')](socket);var jayson=require(_0xef88('0x1f'));var client=jayson['client'][_0xef88('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1f06b9,_0x5e7236,_0x1da4e4,_0x35d251){return new BPromise(function(_0x4928fe,_0x4601b6){var _0x46eb6e=_0x35d251||client;return _0x46eb6e[_0xef88('0x21')](_0x1f06b9,_0x1da4e4)[_0xef88('0x22')](function(_0x139f9e){logger['info'](_0xef88('0x23'),_0x5e7236,_0xef88('0x24'));logger[_0xef88('0x25')](_0xef88('0x26'),_0x5e7236,_0xef88('0x24'),JSON['stringify'](_0x139f9e));if(_0x139f9e['error']){if(_0x139f9e[_0xef88('0x27')][_0xef88('0x28')]===0x1f4){logger[_0xef88('0x27')](_0xef88('0x23'),_0x5e7236,_0x139f9e['error'][_0xef88('0x29')]);return _0x4601b6(_0x139f9e[_0xef88('0x27')][_0xef88('0x29')]);}logger[_0xef88('0x27')](_0xef88('0x23'),_0x5e7236,_0x139f9e['error'][_0xef88('0x29')]);return _0x4928fe(_0x139f9e['error'][_0xef88('0x29')]);}else{logger[_0xef88('0x2a')](_0xef88('0x23'),_0x5e7236,_0xef88('0x24'));_0x4928fe(_0x139f9e[_0xef88('0x2b')][_0xef88('0x29')]);}})['catch'](function(_0x11eea4){logger[_0xef88('0x27')](_0xef88('0x23'),_0x5e7236,_0x11eea4);_0x4601b6(_0x11eea4);});});}function respondWithStatusCode(_0x43017,_0x355557){_0x355557=_0x355557||0xcc;return function(_0x649e57){if(_0x649e57){return _0x43017[_0xef88('0x2c')](_0x355557);}return _0x43017['status'](_0x355557)[_0xef88('0x2d')]();};}function respondWithResult(_0x2872fd,_0x3920fa){_0x3920fa=_0x3920fa||0xc8;return function(_0x394628){if(_0x394628){return _0x2872fd[_0xef88('0x2e')](_0x3920fa)['json'](_0x394628);}};}function respondWithFilteredResult(_0x125821,_0x5ce0ce){return function(_0x36f4de){if(_0x36f4de){var _0x144407=_0x36f4de[_0xef88('0x2f')],_0x4d408b=_0x5ce0ce[_0xef88('0x30')],_0x769776=_0x5ce0ce[_0xef88('0x30')]+_0x5ce0ce[_0xef88('0x31')],_0x2d245a;if(_0x769776>=_0x144407){_0x769776=_0x144407;_0x2d245a=0xc8;}else{_0x2d245a=0xce;}_0x125821['status'](_0x2d245a);return _0x125821[_0xef88('0x32')](_0xef88('0x33'),_0x4d408b+'-'+_0x769776+'/'+_0x144407)[_0xef88('0x34')](_0x36f4de);}return null;};}function patchUpdates(_0x5092b9){return function(_0x42060f){try{jsonpatch['apply'](_0x42060f,_0x5092b9,!![]);}catch(_0x20a9a2){return BPromise['reject'](_0x20a9a2);}return _0x42060f['save']();};}function saveUpdates(_0x380e1d,_0x2e3515){return function(_0x330a84){if(_0x330a84){return _0x330a84[_0xef88('0x35')](_0x380e1d)['then'](function(_0x1ce746){return _0x1ce746;});}return null;};}function removeEntity(_0x47dbe6,_0x28a634){return function(_0x38ae67){if(_0x38ae67){return _0x38ae67[_0xef88('0x36')]()[_0xef88('0x22')](function(){var _0x15d4d4=_0x38ae67[_0xef88('0x37')]({'plain':!![]});var _0x47722c=_0xef88('0x38');return db[_0xef88('0x39')][_0xef88('0x36')]({'where':{'type':_0x47722c,'resourceId':_0x15d4d4['id']}})[_0xef88('0x22')](function(){return _0x38ae67;});})[_0xef88('0x22')](function(){_0x47dbe6[_0xef88('0x2e')](0xcc)[_0xef88('0x2d')]();});}};}function handleEntityNotFound(_0x1f4c14,_0x180c37){return function(_0x2774b1){if(!_0x2774b1){_0x1f4c14[_0xef88('0x2c')](0x194);}return _0x2774b1;};}function handleError(_0x135a89,_0x34c53a){_0x34c53a=_0x34c53a||0x1f4;return function(_0x31dfac){logger[_0xef88('0x27')](_0x31dfac[_0xef88('0x3a')]);if(_0x31dfac[_0xef88('0x3b')]){delete _0x31dfac[_0xef88('0x3b')];}_0x135a89[_0xef88('0x2e')](_0x34c53a)['send'](_0x31dfac);};}exports[_0xef88('0x3c')]=function(_0x9a619,_0x2b1aad){var _0xb6b7e0={'include':[{'model':db[_0xef88('0x3d')],'as':'mandatoryDispositionPause'}]},_0x50f0db={},_0x10f25b={'count':0x0,'rows':[]};var _0xe00583=_['map'](db[_0xef88('0x3e')][_0xef88('0x3f')],function(_0x1c9a18){return{'name':_0x1c9a18[_0xef88('0x40')],'type':_0x1c9a18[_0xef88('0x41')]['key']};});_0x50f0db[_0xef88('0x42')]=_[_0xef88('0x43')](_0xe00583,_0xef88('0x3b'));_0x50f0db[_0xef88('0x44')]=_[_0xef88('0x45')](_0x9a619[_0xef88('0x44')]);_0x50f0db[_0xef88('0x46')]=_[_0xef88('0x47')](_0x50f0db[_0xef88('0x42')],_0x50f0db[_0xef88('0x44')]);_0xb6b7e0[_0xef88('0x48')]=_['intersection'](_0x50f0db['model'],qs[_0xef88('0x49')](_0x9a619[_0xef88('0x44')]['fields']));_0xb6b7e0[_0xef88('0x48')]=_0xb6b7e0[_0xef88('0x48')]['length']?_0xb6b7e0[_0xef88('0x48')]:_0x50f0db[_0xef88('0x42')];if(!_0x9a619[_0xef88('0x44')][_0xef88('0x4a')](_0xef88('0x4b'))){_0xb6b7e0[_0xef88('0x31')]=qs[_0xef88('0x31')](_0x9a619[_0xef88('0x44')][_0xef88('0x31')]);_0xb6b7e0[_0xef88('0x30')]=qs[_0xef88('0x30')](_0x9a619['query'][_0xef88('0x30')]);}_0xb6b7e0[_0xef88('0x4c')]=qs['sort'](_0x9a619[_0xef88('0x44')]['sort']);_0xb6b7e0[_0xef88('0x4d')]=qs[_0xef88('0x46')](_[_0xef88('0x4e')](_0x9a619[_0xef88('0x44')],_0x50f0db[_0xef88('0x46')]),_0xe00583);if(_0x9a619[_0xef88('0x44')][_0xef88('0x4f')]){_0xb6b7e0[_0xef88('0x4d')]=_[_0xef88('0x50')](_0xb6b7e0['where'],{'$or':_[_0xef88('0x43')](_0xe00583,function(_0xfbf4d9){if(_0xfbf4d9[_0xef88('0x41')]!=='VIRTUAL'){var _0x4ef1ca={};_0x4ef1ca[_0xfbf4d9['name']]={'$like':'%'+_0x9a619[_0xef88('0x44')][_0xef88('0x4f')]+'%'};return _0x4ef1ca;}})});}_0xb6b7e0=_[_0xef88('0x50')]({},_0xb6b7e0,_0x9a619[_0xef88('0x51')]);var _0x23b21d={'where':_0xb6b7e0[_0xef88('0x4d')]};return db[_0xef88('0x3e')]['count'](_0x23b21d)[_0xef88('0x22')](function(_0x2a6073){_0x10f25b[_0xef88('0x2f')]=_0x2a6073;if(_0x9a619[_0xef88('0x44')][_0xef88('0x52')]){_0xb6b7e0[_0xef88('0x53')]=[{'all':!![]}];}return db[_0xef88('0x3e')][_0xef88('0x54')](_0xb6b7e0);})[_0xef88('0x22')](function(_0x41b3c8){_0x10f25b['rows']=_0x41b3c8;return _0x10f25b;})[_0xef88('0x22')](respondWithFilteredResult(_0x2b1aad,_0xb6b7e0))[_0xef88('0x55')](handleError(_0x2b1aad,null));};exports[_0xef88('0x56')]=function(_0xf3d511,_0x376968){var _0x538199={'raw':![],'where':{'id':_0xf3d511[_0xef88('0x57')]['id']},'include':[{'model':db[_0xef88('0x3d')],'as':_0xef88('0x58')}]},_0x36b630={};_0x36b630['model']=_[_0xef88('0x45')](db[_0xef88('0x3e')]['rawAttributes']);_0x36b630[_0xef88('0x44')]=_[_0xef88('0x45')](_0xf3d511[_0xef88('0x44')]);_0x36b630[_0xef88('0x46')]=_[_0xef88('0x47')](_0x36b630[_0xef88('0x42')],_0x36b630['query']);_0x538199[_0xef88('0x48')]=_[_0xef88('0x47')](_0x36b630[_0xef88('0x42')],qs[_0xef88('0x49')](_0xf3d511[_0xef88('0x44')][_0xef88('0x49')]));_0x538199[_0xef88('0x48')]=_0x538199['attributes'][_0xef88('0x59')]?_0x538199[_0xef88('0x48')]:_0x36b630['model'];if(_0xf3d511['query'][_0xef88('0x52')]){_0x538199[_0xef88('0x53')]=[{'all':!![]}];}_0x538199=_[_0xef88('0x50')]({},_0x538199,_0xf3d511[_0xef88('0x51')]);return db[_0xef88('0x3e')]['find'](_0x538199)['then'](handleEntityNotFound(_0x376968,null))['then'](respondWithResult(_0x376968,null))['catch'](handleError(_0x376968,null));};exports[_0xef88('0x5a')]=function(_0x2b20c0,_0x2c17aa){return db[_0xef88('0x3e')]['create'](_0x2b20c0['body'],{})[_0xef88('0x22')](function(_0x3db8eb){var _0x19abe3=_0x2b20c0['user']['get']({'plain':!![]});if(!_0x19abe3)throw new Error(_0xef88('0x5b'));if(_0x19abe3[_0xef88('0x5c')]==='user'){var _0x36e268=_0x3db8eb['get']({'plain':!![]});var _0x200311=_0xef88('0x38');return db[_0xef88('0x5d')][_0xef88('0x5e')]({'where':{'name':_0x200311,'userProfileId':_0x19abe3[_0xef88('0x5f')]},'raw':!![]})[_0xef88('0x22')](function(_0x7623a8){if(_0x7623a8&&_0x7623a8['autoAssociation']===0x0){return db[_0xef88('0x39')][_0xef88('0x5a')]({'name':_0x36e268['name'],'resourceId':_0x36e268['id'],'type':_0x7623a8[_0xef88('0x3b')],'sectionId':_0x7623a8['id']},{})['then'](function(){return _0x3db8eb;});}else{return _0x3db8eb;}})['catch'](function(_0x3ab4ad){logger[_0xef88('0x27')](_0xef88('0x60'),_0x3ab4ad);throw _0x3ab4ad;});}return _0x3db8eb;})['then'](respondWithResult(_0x2c17aa,0xc9))[_0xef88('0x55')](handleError(_0x2c17aa,null));};exports[_0xef88('0x35')]=function(_0x257bf1,_0x5db458){if(_0x257bf1[_0xef88('0x61')]['id']){delete _0x257bf1[_0xef88('0x61')]['id'];}return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x257bf1[_0xef88('0x57')]['id']},'include':[{'model':db[_0xef88('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5db458,null))[_0xef88('0x22')](saveUpdates(_0x257bf1[_0xef88('0x61')],null))[_0xef88('0x22')](respondWithResult(_0x5db458,null))[_0xef88('0x55')](handleError(_0x5db458,null));};exports[_0xef88('0x36')]=function(_0x2ae37f,_0x278c70){return db['WhatsappAccount'][_0xef88('0x5e')]({'where':{'id':_0x2ae37f[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x278c70,null))[_0xef88('0x22')](removeEntity(_0x278c70,null))['catch'](handleError(_0x278c70,null));};exports[_0xef88('0x62')]=function(_0x852dea,_0x1d30fc){return db['WhatsappAccount'][_0xef88('0x62')]()[_0xef88('0x22')](respondWithResult(_0x1d30fc,null))[_0xef88('0x55')](handleError(_0x1d30fc,null));};exports['addDisposition']=function(_0x3cc366,_0x3a54bc,_0x58b750){if(_0x3cc366[_0xef88('0x61')]['id']){delete _0x3cc366[_0xef88('0x61')]['id'];}return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x3cc366['params']['id']}})['then'](handleEntityNotFound(_0x3a54bc,null))[_0xef88('0x22')](function(_0x2a4d89){if(_0x2a4d89){_0x3cc366[_0xef88('0x61')][_0xef88('0x63')]=_0x2a4d89['id'];return db[_0xef88('0x64')]['create'](_0x3cc366['body']);}})[_0xef88('0x22')](respondWithResult(_0x3a54bc,null))[_0xef88('0x55')](handleError(_0x3a54bc,null));};exports[_0xef88('0x65')]=function(_0x8833a4,_0x10f2b7,_0x91bcb4){var _0x38df8b={'raw':![],'where':{}};var _0xf7797d={};var _0x2fedae={'count':0x0,'rows':[]};return db[_0xef88('0x3e')]['findOne']({'where':{'id':_0x8833a4[_0xef88('0x57')]['id']}})['then'](handleEntityNotFound(_0x10f2b7,null))[_0xef88('0x22')](function(_0x3a350e){if(_0x3a350e){_0xf7797d[_0xef88('0x42')]=_[_0xef88('0x45')](db['Disposition'][_0xef88('0x3f')]);_0xf7797d[_0xef88('0x44')]=_[_0xef88('0x45')](_0x8833a4[_0xef88('0x44')]);_0xf7797d['filters']=_['intersection'](_0xf7797d[_0xef88('0x42')],_0xf7797d[_0xef88('0x44')]);_0x38df8b[_0xef88('0x48')]=_['intersection'](_0xf7797d[_0xef88('0x42')],qs['fields'](_0x8833a4[_0xef88('0x44')][_0xef88('0x49')]));_0x38df8b[_0xef88('0x48')]=_0x38df8b['attributes'][_0xef88('0x59')]?_0x38df8b[_0xef88('0x48')]:_0xf7797d[_0xef88('0x42')];if(!_0x8833a4[_0xef88('0x44')]['hasOwnProperty'](_0xef88('0x4b'))){_0x38df8b['limit']=qs[_0xef88('0x31')](_0x8833a4[_0xef88('0x44')][_0xef88('0x31')]);_0x38df8b[_0xef88('0x30')]=qs['offset'](_0x8833a4[_0xef88('0x44')][_0xef88('0x30')]);}_0x38df8b[_0xef88('0x4c')]=qs['sort'](_0x8833a4[_0xef88('0x44')][_0xef88('0x66')]);_0x38df8b['where']=qs[_0xef88('0x46')](_['pick'](_0x8833a4[_0xef88('0x44')],_0xf7797d['filters']));_0x38df8b[_0xef88('0x4d')][_0xef88('0x63')]=_0x3a350e['id'];if(_0x8833a4['query']['filter']){_0x38df8b[_0xef88('0x4d')]=_[_0xef88('0x50')](_0x38df8b[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x38df8b[_0xef88('0x48')],function(_0x107384){var _0x56e89b={};_0x56e89b[_0x107384]={'$like':'%'+_0x8833a4[_0xef88('0x44')]['filter']+'%'};return _0x56e89b;})});}_0x38df8b=_[_0xef88('0x50')]({},_0x38df8b,_0x8833a4['options']);return db[_0xef88('0x64')][_0xef88('0x2f')]({'where':_0x38df8b[_0xef88('0x4d')]})[_0xef88('0x22')](function(_0x5c7935){_0x2fedae[_0xef88('0x2f')]=_0x5c7935;if(_0x8833a4[_0xef88('0x44')][_0xef88('0x52')]){_0x38df8b[_0xef88('0x53')]=[{'all':!![]}];}return db[_0xef88('0x64')][_0xef88('0x54')](_0x38df8b);})[_0xef88('0x22')](function(_0x49da92){_0x2fedae[_0xef88('0x67')]=_0x49da92;return _0x2fedae;});}})[_0xef88('0x22')](respondWithFilteredResult(_0x10f2b7,_0x38df8b))[_0xef88('0x55')](handleError(_0x10f2b7,null));};exports['removeDispositions']=function(_0x4873ef,_0x27b14d,_0x18beb4){return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x4873ef[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x27b14d,null))[_0xef88('0x22')](function(_0x122162){if(_0x122162){return _0x122162[_0xef88('0x68')](_0x4873ef[_0xef88('0x44')][_0xef88('0x69')]);}})[_0xef88('0x22')](respondWithStatusCode(_0x27b14d,null))[_0xef88('0x55')](handleError(_0x27b14d,null));};exports[_0xef88('0x6a')]=function(_0x2f7c0c,_0x93652a,_0x294f88){if(_0x2f7c0c[_0xef88('0x61')]['id']){delete _0x2f7c0c[_0xef88('0x61')]['id'];}return db[_0xef88('0x3e')]['find']({'where':{'id':_0x2f7c0c[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x93652a,null))['then'](function(_0x7707d5){if(_0x7707d5){_0x2f7c0c[_0xef88('0x61')][_0xef88('0x63')]=_0x7707d5['id'];return db['CannedAnswer'][_0xef88('0x5a')](_0x2f7c0c[_0xef88('0x61')]);}})['then'](respondWithResult(_0x93652a,null))[_0xef88('0x55')](handleError(_0x93652a,null));};exports[_0xef88('0x6b')]=function(_0x13be27,_0x3fcf44,_0x53adb4){var _0x580e74={'raw':![],'where':{}};var _0xd3a0b9={};var _0x144b87={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xef88('0x6c')]({'where':{'id':_0x13be27[_0xef88('0x57')]['id']}})['then'](handleEntityNotFound(_0x3fcf44,null))[_0xef88('0x22')](function(_0x5ef249){if(_0x5ef249){_0xd3a0b9['model']=_[_0xef88('0x45')](db['CannedAnswer'][_0xef88('0x3f')]);_0xd3a0b9[_0xef88('0x44')]=_[_0xef88('0x45')](_0x13be27[_0xef88('0x44')]);_0xd3a0b9[_0xef88('0x46')]=_[_0xef88('0x47')](_0xd3a0b9[_0xef88('0x42')],_0xd3a0b9[_0xef88('0x44')]);_0x580e74[_0xef88('0x48')]=_[_0xef88('0x47')](_0xd3a0b9['model'],qs['fields'](_0x13be27[_0xef88('0x44')][_0xef88('0x49')]));_0x580e74['attributes']=_0x580e74[_0xef88('0x48')][_0xef88('0x59')]?_0x580e74[_0xef88('0x48')]:_0xd3a0b9[_0xef88('0x42')];if(!_0x13be27[_0xef88('0x44')][_0xef88('0x4a')](_0xef88('0x4b'))){_0x580e74[_0xef88('0x31')]=qs[_0xef88('0x31')](_0x13be27[_0xef88('0x44')]['limit']);_0x580e74[_0xef88('0x30')]=qs[_0xef88('0x30')](_0x13be27[_0xef88('0x44')][_0xef88('0x30')]);}_0x580e74[_0xef88('0x4c')]=qs[_0xef88('0x66')](_0x13be27[_0xef88('0x44')][_0xef88('0x66')]);_0x580e74[_0xef88('0x4d')]=qs[_0xef88('0x46')](_[_0xef88('0x4e')](_0x13be27[_0xef88('0x44')],_0xd3a0b9['filters']));_0x580e74['where'][_0xef88('0x63')]=_0x5ef249['id'];if(_0x13be27[_0xef88('0x44')][_0xef88('0x4f')]){_0x580e74[_0xef88('0x4d')]=_[_0xef88('0x50')](_0x580e74[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x580e74[_0xef88('0x48')],function(_0x4b9035){var _0x4cece5={};_0x4cece5[_0x4b9035]={'$like':'%'+_0x13be27[_0xef88('0x44')]['filter']+'%'};return _0x4cece5;})});}_0x580e74=_[_0xef88('0x50')]({},_0x580e74,_0x13be27[_0xef88('0x51')]);return db[_0xef88('0x6d')]['count']({'where':_0x580e74[_0xef88('0x4d')]})[_0xef88('0x22')](function(_0xf9f612){_0x144b87[_0xef88('0x2f')]=_0xf9f612;if(_0x13be27[_0xef88('0x44')]['includeAll']){_0x580e74[_0xef88('0x53')]=[{'all':!![]}];}return db[_0xef88('0x6d')][_0xef88('0x54')](_0x580e74);})[_0xef88('0x22')](function(_0x98f217){_0x144b87[_0xef88('0x67')]=_0x98f217;return _0x144b87;});}})[_0xef88('0x22')](respondWithFilteredResult(_0x3fcf44,_0x580e74))[_0xef88('0x55')](handleError(_0x3fcf44,null));};exports[_0xef88('0x6e')]=function(_0x205089,_0x1dc718,_0x213a59){return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x205089['params']['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x1dc718,null))[_0xef88('0x22')](function(_0x46d197){if(_0x46d197){return _0x46d197[_0xef88('0x6e')](_0x205089['query'][_0xef88('0x69')]);}})[_0xef88('0x22')](respondWithStatusCode(_0x1dc718,null))['catch'](handleError(_0x1dc718,null));};exports[_0xef88('0x6f')]=function(_0x33e832,_0x4b9864,_0x4c6921){return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x33e832['params']['id']}})['then'](handleEntityNotFound(_0x4b9864,null))[_0xef88('0x22')](function(_0x4507f0){if(_0x4507f0){return _0x4507f0[_0xef88('0x6f')](_0x33e832[_0xef88('0x61')][_0xef88('0x69')],_['omit'](_0x33e832[_0xef88('0x61')],[_0xef88('0x69'),'id'])||{})[_0xef88('0x70')](function(_0x30e699){for(var _0x21bf24=0x0;_0x21bf24<_0x33e832[_0xef88('0x61')][_0xef88('0x69')][_0xef88('0x59')];_0x21bf24+=0x1){socket[_0xef88('0x71')]('userWhatsappAccount:save',{'UserId':_0x33e832[_0xef88('0x61')][_0xef88('0x69')][_0x21bf24],'WhatsappAccountId':_0x33e832[_0xef88('0x57')]['id']});}return _0x30e699;});}})[_0xef88('0x22')](respondWithResult(_0x4b9864,null))['catch'](handleError(_0x4b9864,null));};exports['removeAgents']=function(_0x58c803,_0x46b142,_0x4f5bdb){return db['WhatsappAccount'][_0xef88('0x5e')]({'where':{'id':_0x58c803[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x46b142,null))[_0xef88('0x22')](function(_0x241335){if(_0x241335){return _0x241335[_0xef88('0x72')](_0x58c803[_0xef88('0x44')]['ids'])[_0xef88('0x22')](function(){if(_[_0xef88('0x73')](_0x58c803[_0xef88('0x44')]['ids'])){for(var _0x4725f1=0x0;_0x4725f1<_0x58c803[_0xef88('0x44')][_0xef88('0x69')][_0xef88('0x59')];_0x4725f1+=0x1){socket[_0xef88('0x71')](_0xef88('0x74'),{'UserId':Number(_0x58c803[_0xef88('0x44')][_0xef88('0x69')][_0x4725f1]),'WhatsappAccountId':Number(_0x58c803['params']['id'])});}}else{socket[_0xef88('0x71')](_0xef88('0x74'),{'UserId':Number(_0x58c803['query'][_0xef88('0x69')]),'WhatsappAccountId':Number(_0x58c803[_0xef88('0x57')]['id'])});}});}})[_0xef88('0x22')](respondWithStatusCode(_0x46b142,null))[_0xef88('0x55')](handleError(_0x46b142,null));};exports['getAgents']=function(_0x4e5d3d,_0x226e33,_0x23a1bd){var _0x1f96e3={};var _0x5620df={};var _0x3ccba5;var _0x91c51c;return db[_0xef88('0x3e')][_0xef88('0x6c')]({'where':{'id':_0x4e5d3d[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x226e33,null))[_0xef88('0x22')](function(_0x1d8ba0){if(_0x1d8ba0){_0x3ccba5=_0x1d8ba0;_0x5620df[_0xef88('0x42')]=_[_0xef88('0x45')](db[_0xef88('0x75')][_0xef88('0x3f')]);_0x5620df[_0xef88('0x44')]=_[_0xef88('0x45')](_0x4e5d3d['query']);_0x5620df['filters']=_[_0xef88('0x47')](_0x5620df[_0xef88('0x42')],_0x5620df[_0xef88('0x44')]);_0x1f96e3['attributes']=_[_0xef88('0x47')](_0x5620df[_0xef88('0x42')],qs[_0xef88('0x49')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x49')]));_0x1f96e3[_0xef88('0x48')]=_0x1f96e3['attributes'][_0xef88('0x59')]?_0x1f96e3[_0xef88('0x48')]:_0x5620df[_0xef88('0x42')];_0x1f96e3['order']=qs[_0xef88('0x66')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x66')]);_0x1f96e3[_0xef88('0x4d')]=qs[_0xef88('0x46')](_[_0xef88('0x4e')](_0x4e5d3d[_0xef88('0x44')],_0x5620df[_0xef88('0x46')]));if(_0x4e5d3d['query']['filter']){_0x1f96e3['where']=_['merge'](_0x1f96e3[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x1f96e3[_0xef88('0x48')],function(_0x54b7db){var _0x1a2091={};_0x1a2091[_0x54b7db]={'$like':'%'+_0x4e5d3d['query'][_0xef88('0x4f')]+'%'};return _0x1a2091;})});}_0x1f96e3=_[_0xef88('0x50')]({},_0x1f96e3,_0x4e5d3d['options']);return _0x3ccba5['getAgents'](_0x1f96e3);}})[_0xef88('0x22')](function(_0x253f60){if(_0x253f60){_0x91c51c=_0x253f60['length'];if(!_0x4e5d3d[_0xef88('0x44')][_0xef88('0x4a')]('nolimit')){_0x1f96e3['limit']=qs[_0xef88('0x31')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x31')]);_0x1f96e3['offset']=qs[_0xef88('0x30')](_0x4e5d3d[_0xef88('0x44')][_0xef88('0x30')]);}return _0x3ccba5[_0xef88('0x76')](_0x1f96e3);}})[_0xef88('0x22')](function(_0x3e8924){if(_0x3e8924){return _0x3e8924?{'count':_0x91c51c,'rows':_0x3e8924}:null;}})[_0xef88('0x22')](respondWithResult(_0x226e33,null))[_0xef88('0x55')](handleError(_0x226e33,null));};exports[_0xef88('0x77')]=function(_0x3d689e,_0x1dd47d,_0x5371d8){return db[_0xef88('0x3e')][_0xef88('0x6c')]({'where':{'id':_0x3d689e[_0xef88('0x57')]['id']}})[_0xef88('0x22')](handleEntityNotFound(_0x1dd47d,null))[_0xef88('0x22')](function(_0x36f394){if(_0x36f394){return db[_0xef88('0x78')]['transaction'](function(_0x518194){return db[_0xef88('0x79')][_0xef88('0x36')]({'where':{'WhatsappAccountId':_0x3d689e[_0xef88('0x57')]['id']},'transaction':_0x518194})['then'](function(_0x209999){var _0x2f7fb6=_[_0xef88('0x43')](_0x3d689e[_0xef88('0x61')],function(_0x4a79c3){_0x4a79c3[_0xef88('0x63')]=_0x3d689e[_0xef88('0x57')]['id'];return _0x4a79c3;});return db[_0xef88('0x79')][_0xef88('0x7a')](_0x2f7fb6,{'transaction':_0x518194});});})[_0xef88('0x22')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x3d689e[_0xef88('0x57')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1dd47d,null))[_0xef88('0x55')](handleError(_0x1dd47d,null));};exports[_0xef88('0x7b')]=function(_0xc677be,_0x31d31a,_0x3d2f42){var _0x5ee844={};var _0x3a84f8={};var _0x55e2fc;var _0x4d2ba2;return db[_0xef88('0x3e')][_0xef88('0x6c')]({'where':{'id':_0xc677be[_0xef88('0x57')]['id']}})['then'](handleEntityNotFound(_0x31d31a,null))[_0xef88('0x22')](function(_0x3ecb6e){if(_0x3ecb6e){_0x55e2fc=_0x3ecb6e;_0x3a84f8['model']=_['keys'](db[_0xef88('0x79')][_0xef88('0x3f')]);_0x3a84f8[_0xef88('0x44')]=_[_0xef88('0x45')](_0xc677be[_0xef88('0x44')]);_0x3a84f8['filters']=_[_0xef88('0x47')](_0x3a84f8[_0xef88('0x42')],_0x3a84f8[_0xef88('0x44')]);_0x5ee844[_0xef88('0x48')]=_[_0xef88('0x47')](_0x3a84f8[_0xef88('0x42')],qs[_0xef88('0x49')](_0xc677be[_0xef88('0x44')][_0xef88('0x49')]));_0x5ee844[_0xef88('0x48')]=_0x5ee844['attributes'][_0xef88('0x59')]?_0x5ee844['attributes']:_0x3a84f8[_0xef88('0x42')];_0x5ee844[_0xef88('0x4c')]=qs[_0xef88('0x66')](_0xc677be['query'][_0xef88('0x66')]);_0x5ee844['where']=qs[_0xef88('0x46')](_['pick'](_0xc677be['query'],_0x3a84f8[_0xef88('0x46')]));if(_0xc677be[_0xef88('0x44')][_0xef88('0x4f')]){_0x5ee844[_0xef88('0x4d')]=_[_0xef88('0x50')](_0x5ee844[_0xef88('0x4d')],{'$or':_[_0xef88('0x43')](_0x5ee844['attributes'],function(_0x25987a){var _0x5ce390={};_0x5ce390[_0x25987a]={'$like':'%'+_0xc677be['query'][_0xef88('0x4f')]+'%'};return _0x5ce390;})});}_0x5ee844=_['merge']({},_0x5ee844,_0xc677be[_0xef88('0x51')]);return _0x55e2fc['getApplications'](_0x5ee844);}})[_0xef88('0x22')](function(_0x5a67d4){if(_0x5a67d4){_0x4d2ba2=_0x5a67d4[_0xef88('0x59')];if(!_0xc677be[_0xef88('0x44')][_0xef88('0x4a')]('nolimit')){_0x5ee844[_0xef88('0x31')]=qs[_0xef88('0x31')](_0xc677be['query'][_0xef88('0x31')]);_0x5ee844[_0xef88('0x30')]=qs[_0xef88('0x30')](_0xc677be['query'][_0xef88('0x30')]);}return _0x55e2fc[_0xef88('0x7b')](_0x5ee844);}})['then'](function(_0x5f3469){if(_0x5f3469){return _0x5f3469?{'count':_0x4d2ba2,'rows':_0x5f3469}:null;}})[_0xef88('0x22')](respondWithResult(_0x31d31a,null))['catch'](handleError(_0x31d31a,null));};exports['notify']=function(_0x2acac0,_0x5a962d,_0x43c05f){var _0x18ea58={'channel':_0xef88('0x7c')};var _0x30c607=[];var _0xf3f8dc=[];var _0x1690d8={};return db[_0xef88('0x3e')]['find']({'where':{'id':_0x2acac0['params']['id']},'include':[{'model':db[_0xef88('0x79')],'as':_0xef88('0x7d')}]})[_0xef88('0x22')](handleEntityNotFound(_0x5a962d,null))['then'](function(_0x3037df){_0x18ea58[_0xef88('0x7e')]=_0x3037df;_0x18ea58[_0xef88('0x7f')]=_['orderBy'](_0x3037df[_0xef88('0x7d')],[_0xef88('0x80')],[_0xef88('0x81')]);if(_0x18ea58['account']['Applications']){delete _0x18ea58[_0xef88('0x7e')]['Applications'];}return db[_0xef88('0x82')][_0xef88('0x62')]();})[_0xef88('0x22')](function(_0x182efc){if(!_0x182efc){throw new db['Sequelize'][(_0xef88('0x83'))]('no\x20available\x20attributes');}_0x30c607=_['difference'](_[_0xef88('0x45')](_0x182efc),['createdAt',_0xef88('0x84')]);_0xf3f8dc=_[_0xef88('0x85')](_['keys'](_0x182efc),[_0xef88('0x86'),'updatedAt',_0xef88('0x87'),'ListId']);_0x18ea58['body']={'mapKey':_0xef88('0x88')};if(_0x18ea58['account'][_0xef88('0x41')]&&_0x18ea58[_0xef88('0x7e')][_0xef88('0x41')]==='twilio'){_0x18ea58[_0xef88('0x61')]['from']=_0x2acac0[_0xef88('0x61')][_0xef88('0x89')][_0xef88('0x8a')](_0xef88('0x8b'),'');_0x18ea58['body'][_0xef88('0x61')]=_0x2acac0[_0xef88('0x61')]['Body'];_0x18ea58[_0xef88('0x61')][_0xef88('0x8c')]=_0x2acac0[_0xef88('0x61')][_0xef88('0x8d')];}if(_0x18ea58['body']['id']){delete _0x18ea58[_0xef88('0x61')]['id'];}if(_[_0xef88('0x8e')](_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')])){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))](_0xef88('0x91'));}if(_[_0xef88('0x8e')](_0x18ea58[_0xef88('0x61')][_0xef88('0x61')])||_0x18ea58[_0xef88('0x61')][_0xef88('0x61')]===''){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))](_0xef88('0x92'));}if(_[_0xef88('0x8e')](_0x18ea58['body'][_0xef88('0x93')])){throw new db['Sequelize'][(_0xef88('0x83'))](_0xef88('0x94')+_0xf3f8dc);}if(!_[_0xef88('0x95')](_0xf3f8dc,_0x18ea58[_0xef88('0x61')][_0xef88('0x93')])){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))](_0xef88('0x96')+_0xf3f8dc);}_0x1690d8[_0x18ea58[_0xef88('0x61')][_0xef88('0x93')]]=_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')];return db[_0xef88('0x97')][_0xef88('0x5e')]({'where':{'id':_0x18ea58['account'][_0xef88('0x98')]},'include':[{'model':db['CmContact'],'as':_0xef88('0x99'),'where':_0x1690d8,'limit':0x1,'order':[[_0xef88('0x84'),'DESC']]}]});})[_0xef88('0x22')](handleEntityNotFound(_0x5a962d,null))[_0xef88('0x22')](function(_0x131734){if(_0x131734){_0x18ea58[_0xef88('0x9a')]=_[_0xef88('0x9b')](_0x131734,[_0xef88('0x99')]);if(_0x131734['Contacts'][_0xef88('0x59')]){return _0x131734['Contacts'][0x0];}var _0x5379c8=_['defaults'](_0x18ea58[_0xef88('0x61')],{'firstName':_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')],'ListId':_0x131734['id']});_0x5379c8[_0x18ea58['body']['mapKey']]=_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')];return db[_0xef88('0x82')][_0xef88('0x5a')](_0x5379c8,{'fields':_0x30c607,'raw':!![]});}})[_0xef88('0x22')](handleEntityNotFound(_0x5a962d,null))[_0xef88('0x22')](function(_0x3e603c){if(_0x3e603c){_0x18ea58[_0xef88('0x9c')]=_0x3e603c;var _0x46a68c={'ContactId':_0x3e603c['id'],'phone':_0x18ea58['body'][_0xef88('0x8f')],'WhatsappAccountId':_0x2acac0[_0xef88('0x57')]['id']};var _0x35ef2d={'ContactId':_0x3e603c['id'],'WhatsappAccountId':_0x2acac0[_0xef88('0x57')]['id'],'closed':![]};return db[_0xef88('0x9d')][_0xef88('0x5e')]({'where':_0x35ef2d})[_0xef88('0x22')](function(_0x4b544b){if(_0x4b544b){return[_0x4b544b,![]];}return db[_0xef88('0x9d')][_0xef88('0x5a')](_0x46a68c)[_0xef88('0x22')](function(_0x203ee6){return[_0x203ee6,!![]];});});}})['spread'](function(_0x4cf92c,_0x455dd9){_0x18ea58[_0xef88('0x9e')]=_0x4cf92c['get']({'plain':!![]});_0x18ea58[_0xef88('0x9e')][_0xef88('0x9f')]=![];if(_0x455dd9){if(_0x18ea58[_0xef88('0x7e')][_0xef88('0xa0')]){_0x18ea58[_0xef88('0x7f')][_0xef88('0xa1')]({'id':0x0,'priority':_0x18ea58[_0xef88('0x7f')][_0xef88('0x59')]+0x1,'app':_0xef88('0xa2'),'appdata':_0xef88('0xa3'),'interval':_0xef88('0xa4')});}_0x18ea58[_0xef88('0x9e')]['created']=!![];}return db['WhatsappMessage'][_0xef88('0x5a')]({'phone':_0x18ea58[_0xef88('0x61')][_0xef88('0x8f')],'messageId':_0x18ea58[_0xef88('0x61')][_0xef88('0x8c')],'body':_0x18ea58[_0xef88('0x61')][_0xef88('0x61')],'WhatsappAccountId':_0x2acac0['params']['id'],'WhatsappInteractionId':_0x4cf92c['id'],'direction':'in','ContactId':_0x4cf92c[_0xef88('0xa5')],'AttachmentId':_0x18ea58[_0xef88('0x61')][_0xef88('0xa6')]});})[_0xef88('0x22')](function(_0x1ed1f5){_0x18ea58['message']=_0x1ed1f5;if(_0x18ea58[_0xef88('0x9e')][_0xef88('0xa7')]){return db['User'][_0xef88('0x5e')]({'attributes':['id',_0xef88('0x3b')],'where':{'id':_0x18ea58[_0xef88('0x9e')][_0xef88('0xa7')]}})['then'](function(_0x156bb7){if(_0x156bb7){_0x18ea58['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xef88('0xa8'),'appdata':_0x156bb7['name']+','+(_0x18ea58[_0xef88('0x7e')][_0xef88('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xef88('0xaa'),_0xef88('0xab'),_0x18ea58);});}return respondWithRpcPromise(_0xef88('0xaa'),_0xef88('0xab'),_0x18ea58);})[_0xef88('0x22')](function(_0x26e923){if(_0x26e923){var _0x342409=0xc8;var _0x6e2ef8=_0xef88('0xac');logger[_0xef88('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x6e2ef8,_0x342409,_0xef88('0xad'));logger[_0xef88('0x25')](_0xef88('0xae'),_0x6e2ef8,_0x342409,_0xef88('0xad'),JSON[_0xef88('0xaf')](_0x26e923));if(_0x18ea58[_0xef88('0x7e')][_0xef88('0x41')]===_0xef88('0xb0')){return _0x5a962d['status'](_0x342409)[_0xef88('0x32')](_0xef88('0xb1'),_0xef88('0xb2'))[_0xef88('0xb3')](_0xef88('0xb4'));}else{return _0x5a962d['status'](_0x342409)['json'](_0x26e923);}}})[_0xef88('0x55')](handleError(_0x5a962d,null));};exports[_0xef88('0xb3')]=function(_0x3a8cd3,_0x1ddfa3,_0x34b058){var _0x2287db,_0x306c59,_0x1fc1d8;if(_[_0xef88('0x8e')](_0x3a8cd3[_0xef88('0x61')][_0xef88('0x61')])||_0x3a8cd3[_0xef88('0x61')][_0xef88('0x61')]===''){throw new db[(_0xef88('0x90'))][(_0xef88('0x83'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xef88('0x8e')](_0x3a8cd3[_0xef88('0x61')]['to'])){throw new db['Sequelize'][(_0xef88('0x83'))](_0xef88('0xb5'));}_0x2287db=_0x3a8cd3[_0xef88('0x61')]['to'];return db[_0xef88('0x3e')][_0xef88('0x5e')]({'where':{'id':_0x3a8cd3[_0xef88('0x57')]['id']},'include':[{'model':db[_0xef88('0x97')],'as':'List','include':[{'model':db['CmContact'],'as':_0xef88('0x99'),'where':{'mobile':_0x2287db},'limit':0x1,'order':[[_0xef88('0x84'),_0xef88('0xb6')]]}]}]})[_0xef88('0x22')](handleEntityNotFound(_0x1ddfa3,null))[_0xef88('0x22')](function(_0x198def){if(_0x198def&&_0x198def[_0xef88('0xb7')]){_0x306c59=_0x198def[_0xef88('0x37')]({'plain':!![]});if(_0x306c59[_0xef88('0xb7')]&&_0x306c59['List'][_0xef88('0x99')][_0xef88('0x59')]){return _0x306c59['List']['Contacts'][0x0];}return db[_0xef88('0x82')][_0xef88('0x5a')](_[_0xef88('0x1b')](_0x3a8cd3[_0xef88('0x61')],{'firstName':_0x2287db,'mobile':_0x2287db,'phone':_0x2287db,'ListId':_0x306c59['ListId']}));}})[_0xef88('0x22')](handleEntityNotFound(_0x1ddfa3,null))[_0xef88('0x22')](function(_0x3b2fe5){if(_0x3b2fe5){_0x1fc1d8=_0x3b2fe5;return db[_0xef88('0x9d')][_0xef88('0x5e')]({'where':{'ContactId':_0x1fc1d8['id'],'closed':![],'WhatsappAccountId':_0x306c59['id']}})[_0xef88('0x22')](function(_0x35f678){if(_0x35f678){return[_0x35f678,![]];}return db[_0xef88('0x9d')]['create']({'UserId':_0x3a8cd3[_0xef88('0xb8')]['id'],'ContactId':_0x1fc1d8['id'],'WhatsappAccountId':_0x306c59['id'],'phone':_0x2287db,'firstMsgDirection':'out','Messages':[_[_0xef88('0x50')](_0x3a8cd3['body'],{'read':![],'body':_0x3a8cd3[_0xef88('0x61')]['body'],'phone':_0x2287db,'WhatsappAccountId':_0x306c59['id'],'UserId':_0x3a8cd3['user']['id'],'ContactId':_0x1fc1d8['id']})]},{'include':[{'model':db[_0xef88('0xb9')],'as':_0xef88('0xba')}]})[_0xef88('0x22')](function(_0x21e0af){return[_0x21e0af,!![]];});});}})[_0xef88('0x70')](function(_0x58fb0c,_0x369dbb){if(_0x369dbb){return _0x58fb0c;}return db[_0xef88('0xb9')][_0xef88('0x5a')](_['merge'](_0x3a8cd3['body'],{'read':![],'body':_0x3a8cd3[_0xef88('0x61')]['body'],'phone':_0x2287db,'WhatsappAccountId':_0x306c59['id'],'WhatsappInteractionId':_0x58fb0c['id'],'UserId':_0x3a8cd3[_0xef88('0xb8')]['id'],'ContactId':_0x1fc1d8['id']}))[_0xef88('0x22')](function(_0x551875){_0x58fb0c[_0xef88('0xbb')][_0xef88('0xba')]=[];_0x58fb0c[_0xef88('0xbb')][_0xef88('0xba')]['push'](_0x551875[_0xef88('0xbb')]);return _0x58fb0c;});})[_0xef88('0x22')](respondWithResult(_0x1ddfa3,null))['catch'](handleError(_0x1ddfa3,null));}; \ No newline at end of file +var _0x0050=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','spread','emit','removeAgents','isArray','getAgents','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','account','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','whatsapp:','MessageSid','isNil','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','limit','set','reject','destroy','get','WhatsappAccounts','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5546dc,_0x51c095){var _0x2a3142=function(_0x393910){while(--_0x393910){_0x5546dc['push'](_0x5546dc['shift']());}};_0x2a3142(++_0x51c095);}(_0x0050,0x1cd));var _0x0005=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0050[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0x0005('0x0'));var emlformat=require(_0x0005('0x1'));var rimraf=require(_0x0005('0x2'));var zipdir=require(_0x0005('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0005('0x4'));var moment=require(_0x0005('0x5'));var BPromise=require(_0x0005('0x6'));var Mustache=require(_0x0005('0x7'));var util=require(_0x0005('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0005('0x9'));var ejs=require(_0x0005('0xa'));var fs=require('fs');var _=require(_0x0005('0xb'));var squel=require('squel');var crypto=require(_0x0005('0xc'));var jsforce=require(_0x0005('0xd'));var deskjs=require(_0x0005('0xe'));var toCsv=require(_0x0005('0x9'));var querystring=require(_0x0005('0xf'));var Papa=require('papaparse');var Redis=require(_0x0005('0x10'));var authService=require(_0x0005('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0005('0x12'));var hardwareService=require(_0x0005('0x13'));var logger=require(_0x0005('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0005('0x15'));var licenseUtil=require(_0x0005('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0005('0x17')](config[_0x0005('0x18')],{'host':_0x0005('0x19'),'port':0x18eb});var socket=require(_0x0005('0x1a'))(new Redis(config[_0x0005('0x18')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x0005('0x1b'));var client=jayson[_0x0005('0x1c')][_0x0005('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x46bc75,_0x5bf4b7,_0x26a37a,_0xa4bd69){return new BPromise(function(_0x1e177d,_0x51fef1){var _0x56b258=_0xa4bd69||client;return _0x56b258[_0x0005('0x1e')](_0x46bc75,_0x26a37a)[_0x0005('0x1f')](function(_0x48209a){logger[_0x0005('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5bf4b7,_0x0005('0x21'));logger['debug'](_0x0005('0x22'),_0x5bf4b7,_0x0005('0x21'),JSON[_0x0005('0x23')](_0x48209a));if(_0x48209a[_0x0005('0x24')]){if(_0x48209a[_0x0005('0x24')][_0x0005('0x25')]===0x1f4){logger[_0x0005('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5bf4b7,_0x48209a['error']['message']);return _0x51fef1(_0x48209a['error'][_0x0005('0x26')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5bf4b7,_0x48209a[_0x0005('0x24')]['message']);return _0x1e177d(_0x48209a[_0x0005('0x24')][_0x0005('0x26')]);}else{logger[_0x0005('0x20')](_0x0005('0x27'),_0x5bf4b7,_0x0005('0x21'));_0x1e177d(_0x48209a[_0x0005('0x28')][_0x0005('0x26')]);}})[_0x0005('0x29')](function(_0x9ae35e){logger[_0x0005('0x24')](_0x0005('0x27'),_0x5bf4b7,_0x9ae35e);_0x51fef1(_0x9ae35e);});});}function respondWithStatusCode(_0x39b9e0,_0x4dd3b1){_0x4dd3b1=_0x4dd3b1||0xcc;return function(_0x381aad){if(_0x381aad){return _0x39b9e0[_0x0005('0x2a')](_0x4dd3b1);}return _0x39b9e0['status'](_0x4dd3b1)[_0x0005('0x2b')]();};}function respondWithResult(_0x169aaa,_0x566bec){_0x566bec=_0x566bec||0xc8;return function(_0x1c2528){if(_0x1c2528){return _0x169aaa[_0x0005('0x2c')](_0x566bec)[_0x0005('0x2d')](_0x1c2528);}};}function respondWithFilteredResult(_0xa6f8c3,_0x9df985){return function(_0x4fe38d){if(_0x4fe38d){var _0xee0d07=_0x4fe38d['count'],_0x635f7c=_0x9df985['offset'],_0x160c16=_0x9df985['offset']+_0x9df985[_0x0005('0x2e')],_0x4b85f8;if(_0x160c16>=_0xee0d07){_0x160c16=_0xee0d07;_0x4b85f8=0xc8;}else{_0x4b85f8=0xce;}_0xa6f8c3[_0x0005('0x2c')](_0x4b85f8);return _0xa6f8c3[_0x0005('0x2f')]('Content-Range',_0x635f7c+'-'+_0x160c16+'/'+_0xee0d07)['json'](_0x4fe38d);}return null;};}function patchUpdates(_0x55c33c){return function(_0x1c6abb){try{jsonpatch['apply'](_0x1c6abb,_0x55c33c,!![]);}catch(_0x37ee39){return BPromise[_0x0005('0x30')](_0x37ee39);}return _0x1c6abb['save']();};}function saveUpdates(_0x9617b0,_0x307692){return function(_0x4fb8e2){if(_0x4fb8e2){return _0x4fb8e2['update'](_0x9617b0)['then'](function(_0x46b487){return _0x46b487;});}return null;};}function removeEntity(_0x1cb4bb,_0x118132){return function(_0x25ae4d){if(_0x25ae4d){return _0x25ae4d[_0x0005('0x31')]()[_0x0005('0x1f')](function(){var _0x286714=_0x25ae4d[_0x0005('0x32')]({'plain':!![]});var _0x293f28=_0x0005('0x33');return db['UserProfileResource'][_0x0005('0x31')]({'where':{'type':_0x293f28,'resourceId':_0x286714['id']}})['then'](function(){return _0x25ae4d;});})['then'](function(){_0x1cb4bb[_0x0005('0x2c')](0xcc)[_0x0005('0x2b')]();});}};}function handleEntityNotFound(_0x15f0d0,_0x3405cf){return function(_0x59cd33){if(!_0x59cd33){_0x15f0d0[_0x0005('0x2a')](0x194);}return _0x59cd33;};}function handleError(_0x353d76,_0x9cddb){_0x9cddb=_0x9cddb||0x1f4;return function(_0x2e9062){logger[_0x0005('0x24')](_0x2e9062['stack']);if(_0x2e9062['name']){delete _0x2e9062['name'];}_0x353d76[_0x0005('0x2c')](_0x9cddb)[_0x0005('0x34')](_0x2e9062);};}exports[_0x0005('0x35')]=function(_0x25312e,_0x5b8c6c){var _0x4165b7={'include':[{'model':db['Pause'],'as':_0x0005('0x36')}]},_0x18e074={},_0xa2315c={'count':0x0,'rows':[]};var _0x30982e=_[_0x0005('0x37')](db[_0x0005('0x38')][_0x0005('0x39')],function(_0x418eff){return{'name':_0x418eff[_0x0005('0x3a')],'type':_0x418eff[_0x0005('0x3b')][_0x0005('0x3c')]};});_0x18e074[_0x0005('0x3d')]=_[_0x0005('0x37')](_0x30982e,_0x0005('0x3e'));_0x18e074[_0x0005('0x3f')]=_[_0x0005('0x40')](_0x25312e['query']);_0x18e074[_0x0005('0x41')]=_[_0x0005('0x42')](_0x18e074[_0x0005('0x3d')],_0x18e074['query']);_0x4165b7[_0x0005('0x43')]=_[_0x0005('0x42')](_0x18e074[_0x0005('0x3d')],qs[_0x0005('0x44')](_0x25312e[_0x0005('0x3f')][_0x0005('0x44')]));_0x4165b7[_0x0005('0x43')]=_0x4165b7[_0x0005('0x43')][_0x0005('0x45')]?_0x4165b7['attributes']:_0x18e074['model'];if(!_0x25312e[_0x0005('0x3f')][_0x0005('0x46')](_0x0005('0x47'))){_0x4165b7['limit']=qs[_0x0005('0x2e')](_0x25312e['query']['limit']);_0x4165b7[_0x0005('0x48')]=qs[_0x0005('0x48')](_0x25312e[_0x0005('0x3f')][_0x0005('0x48')]);}_0x4165b7[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x25312e[_0x0005('0x3f')][_0x0005('0x4a')]);_0x4165b7[_0x0005('0x4b')]=qs['filters'](_[_0x0005('0x4c')](_0x25312e[_0x0005('0x3f')],_0x18e074[_0x0005('0x41')]),_0x30982e);if(_0x25312e[_0x0005('0x3f')][_0x0005('0x4d')]){_0x4165b7[_0x0005('0x4b')]=_['merge'](_0x4165b7[_0x0005('0x4b')],{'$or':_[_0x0005('0x37')](_0x30982e,function(_0x10d184){if(_0x10d184[_0x0005('0x3b')]!==_0x0005('0x4e')){var _0x531de5={};_0x531de5[_0x10d184[_0x0005('0x3e')]]={'$like':'%'+_0x25312e[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x531de5;}})});}_0x4165b7=_[_0x0005('0x4f')]({},_0x4165b7,_0x25312e[_0x0005('0x50')]);var _0x751a57={'where':_0x4165b7[_0x0005('0x4b')]};return db[_0x0005('0x38')][_0x0005('0x51')](_0x751a57)[_0x0005('0x1f')](function(_0x3e1a6d){_0xa2315c['count']=_0x3e1a6d;if(_0x25312e['query'][_0x0005('0x52')]){_0x4165b7[_0x0005('0x53')]=[{'all':!![]}];}return db[_0x0005('0x38')][_0x0005('0x54')](_0x4165b7);})[_0x0005('0x1f')](function(_0x5bd947){_0xa2315c[_0x0005('0x55')]=_0x5bd947;return _0xa2315c;})['then'](respondWithFilteredResult(_0x5b8c6c,_0x4165b7))['catch'](handleError(_0x5b8c6c,null));};exports[_0x0005('0x56')]=function(_0x2e1d31,_0x8900b8){var _0x4974e3={'raw':![],'where':{'id':_0x2e1d31[_0x0005('0x57')]['id']},'include':[{'model':db[_0x0005('0x58')],'as':_0x0005('0x36')}]},_0x7833b5={};_0x7833b5[_0x0005('0x3d')]=_[_0x0005('0x40')](db[_0x0005('0x38')][_0x0005('0x39')]);_0x7833b5[_0x0005('0x3f')]=_['keys'](_0x2e1d31['query']);_0x7833b5[_0x0005('0x41')]=_[_0x0005('0x42')](_0x7833b5[_0x0005('0x3d')],_0x7833b5[_0x0005('0x3f')]);_0x4974e3[_0x0005('0x43')]=_[_0x0005('0x42')](_0x7833b5['model'],qs[_0x0005('0x44')](_0x2e1d31['query'][_0x0005('0x44')]));_0x4974e3['attributes']=_0x4974e3[_0x0005('0x43')][_0x0005('0x45')]?_0x4974e3[_0x0005('0x43')]:_0x7833b5[_0x0005('0x3d')];if(_0x2e1d31[_0x0005('0x3f')][_0x0005('0x52')]){_0x4974e3[_0x0005('0x53')]=[{'all':!![]}];}_0x4974e3=_[_0x0005('0x4f')]({},_0x4974e3,_0x2e1d31[_0x0005('0x50')]);return db['WhatsappAccount'][_0x0005('0x59')](_0x4974e3)[_0x0005('0x1f')](handleEntityNotFound(_0x8900b8,null))[_0x0005('0x1f')](respondWithResult(_0x8900b8,null))[_0x0005('0x29')](handleError(_0x8900b8,null));};exports['create']=function(_0x5d7005,_0xf64eac){return db[_0x0005('0x38')][_0x0005('0x5a')](_0x5d7005[_0x0005('0x5b')],{})['then'](function(_0x3a6499){var _0xe6c3ec=_0x5d7005[_0x0005('0x5c')][_0x0005('0x32')]({'plain':!![]});if(!_0xe6c3ec)throw new Error(_0x0005('0x5d'));if(_0xe6c3ec['role']===_0x0005('0x5c')){var _0x4c09d4=_0x3a6499['get']({'plain':!![]});var _0x1284ee=_0x0005('0x33');return db['UserProfileSection']['find']({'where':{'name':_0x1284ee,'userProfileId':_0xe6c3ec['userProfileId']},'raw':!![]})[_0x0005('0x1f')](function(_0x575a3b){if(_0x575a3b&&_0x575a3b[_0x0005('0x5e')]===0x0){return db[_0x0005('0x5f')][_0x0005('0x5a')]({'name':_0x4c09d4[_0x0005('0x3e')],'resourceId':_0x4c09d4['id'],'type':_0x575a3b[_0x0005('0x3e')],'sectionId':_0x575a3b['id']},{})[_0x0005('0x1f')](function(){return _0x3a6499;});}else{return _0x3a6499;}})[_0x0005('0x29')](function(_0x15be96){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15be96);throw _0x15be96;});}return _0x3a6499;})[_0x0005('0x1f')](respondWithResult(_0xf64eac,0xc9))[_0x0005('0x29')](handleError(_0xf64eac,null));};exports[_0x0005('0x60')]=function(_0x4777a8,_0x1f2b68){if(_0x4777a8[_0x0005('0x5b')]['id']){delete _0x4777a8[_0x0005('0x5b')]['id'];}return db[_0x0005('0x38')]['find']({'where':{'id':_0x4777a8[_0x0005('0x57')]['id']},'include':[{'model':db[_0x0005('0x58')],'as':_0x0005('0x36')}]})[_0x0005('0x1f')](handleEntityNotFound(_0x1f2b68,null))[_0x0005('0x1f')](saveUpdates(_0x4777a8['body'],null))['then'](respondWithResult(_0x1f2b68,null))[_0x0005('0x29')](handleError(_0x1f2b68,null));};exports[_0x0005('0x31')]=function(_0x49d45f,_0x42df44){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x49d45f['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x42df44,null))[_0x0005('0x1f')](removeEntity(_0x42df44,null))[_0x0005('0x29')](handleError(_0x42df44,null));};exports[_0x0005('0x61')]=function(_0x96253f,_0x585b7a){return db[_0x0005('0x38')]['describe']()[_0x0005('0x1f')](respondWithResult(_0x585b7a,null))[_0x0005('0x29')](handleError(_0x585b7a,null));};exports[_0x0005('0x62')]=function(_0x83fcbd,_0x1fb187,_0x2b7c08){if(_0x83fcbd['body']['id']){delete _0x83fcbd[_0x0005('0x5b')]['id'];}return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x83fcbd[_0x0005('0x57')]['id']}})['then'](handleEntityNotFound(_0x1fb187,null))[_0x0005('0x1f')](function(_0x577970){if(_0x577970){_0x83fcbd['body'][_0x0005('0x63')]=_0x577970['id'];return db[_0x0005('0x64')][_0x0005('0x5a')](_0x83fcbd[_0x0005('0x5b')]);}})['then'](respondWithResult(_0x1fb187,null))[_0x0005('0x29')](handleError(_0x1fb187,null));};exports[_0x0005('0x65')]=function(_0x20edb2,_0x531df7,_0x63bdc1){var _0x133178={'raw':![],'where':{}};var _0x266aac={};var _0x5798ad={'count':0x0,'rows':[]};return db[_0x0005('0x38')]['findOne']({'where':{'id':_0x20edb2[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x531df7,null))[_0x0005('0x1f')](function(_0x4b7c7d){if(_0x4b7c7d){_0x266aac[_0x0005('0x3d')]=_[_0x0005('0x40')](db['Disposition'][_0x0005('0x39')]);_0x266aac[_0x0005('0x3f')]=_[_0x0005('0x40')](_0x20edb2[_0x0005('0x3f')]);_0x266aac[_0x0005('0x41')]=_[_0x0005('0x42')](_0x266aac[_0x0005('0x3d')],_0x266aac['query']);_0x133178[_0x0005('0x43')]=_['intersection'](_0x266aac[_0x0005('0x3d')],qs[_0x0005('0x44')](_0x20edb2['query']['fields']));_0x133178['attributes']=_0x133178[_0x0005('0x43')][_0x0005('0x45')]?_0x133178[_0x0005('0x43')]:_0x266aac['model'];if(!_0x20edb2[_0x0005('0x3f')]['hasOwnProperty'](_0x0005('0x47'))){_0x133178[_0x0005('0x2e')]=qs[_0x0005('0x2e')](_0x20edb2[_0x0005('0x3f')][_0x0005('0x2e')]);_0x133178[_0x0005('0x48')]=qs[_0x0005('0x48')](_0x20edb2[_0x0005('0x3f')][_0x0005('0x48')]);}_0x133178[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x20edb2['query'][_0x0005('0x4a')]);_0x133178[_0x0005('0x4b')]=qs[_0x0005('0x41')](_[_0x0005('0x4c')](_0x20edb2[_0x0005('0x3f')],_0x266aac[_0x0005('0x41')]));_0x133178[_0x0005('0x4b')]['WhatsappAccountId']=_0x4b7c7d['id'];if(_0x20edb2['query'][_0x0005('0x4d')]){_0x133178[_0x0005('0x4b')]=_[_0x0005('0x4f')](_0x133178['where'],{'$or':_[_0x0005('0x37')](_0x133178['attributes'],function(_0x284db1){var _0x3ee7e3={};_0x3ee7e3[_0x284db1]={'$like':'%'+_0x20edb2[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x3ee7e3;})});}_0x133178=_['merge']({},_0x133178,_0x20edb2[_0x0005('0x50')]);return db['Disposition']['count']({'where':_0x133178[_0x0005('0x4b')]})[_0x0005('0x1f')](function(_0x120ce0){_0x5798ad['count']=_0x120ce0;if(_0x20edb2[_0x0005('0x3f')][_0x0005('0x52')]){_0x133178['include']=[{'all':!![]}];}return db[_0x0005('0x64')][_0x0005('0x54')](_0x133178);})[_0x0005('0x1f')](function(_0x3ca909){_0x5798ad[_0x0005('0x55')]=_0x3ca909;return _0x5798ad;});}})[_0x0005('0x1f')](respondWithFilteredResult(_0x531df7,_0x133178))[_0x0005('0x29')](handleError(_0x531df7,null));};exports[_0x0005('0x66')]=function(_0x182e85,_0xd20afe,_0x3a4a90){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x182e85[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0xd20afe,null))['then'](function(_0x32cd62){if(_0x32cd62){return _0x32cd62['removeDispositions'](_0x182e85[_0x0005('0x3f')][_0x0005('0x67')]);}})[_0x0005('0x1f')](respondWithStatusCode(_0xd20afe,null))[_0x0005('0x29')](handleError(_0xd20afe,null));};exports[_0x0005('0x68')]=function(_0x3819b5,_0x56b5ef,_0x4621af){if(_0x3819b5[_0x0005('0x5b')]['id']){delete _0x3819b5['body']['id'];}return db[_0x0005('0x38')]['find']({'where':{'id':_0x3819b5[_0x0005('0x57')]['id']}})['then'](handleEntityNotFound(_0x56b5ef,null))[_0x0005('0x1f')](function(_0x595b25){if(_0x595b25){_0x3819b5['body'][_0x0005('0x63')]=_0x595b25['id'];return db[_0x0005('0x69')][_0x0005('0x5a')](_0x3819b5['body']);}})[_0x0005('0x1f')](respondWithResult(_0x56b5ef,null))[_0x0005('0x29')](handleError(_0x56b5ef,null));};exports['getAnswers']=function(_0x450e85,_0x45dcfe,_0x3a9d77){var _0x500aa7={'raw':![],'where':{}};var _0x495cce={};var _0x1be09e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0005('0x6a')]({'where':{'id':_0x450e85['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x45dcfe,null))[_0x0005('0x1f')](function(_0x312d5f){if(_0x312d5f){_0x495cce[_0x0005('0x3d')]=_[_0x0005('0x40')](db[_0x0005('0x69')]['rawAttributes']);_0x495cce['query']=_[_0x0005('0x40')](_0x450e85[_0x0005('0x3f')]);_0x495cce[_0x0005('0x41')]=_[_0x0005('0x42')](_0x495cce[_0x0005('0x3d')],_0x495cce[_0x0005('0x3f')]);_0x500aa7['attributes']=_['intersection'](_0x495cce[_0x0005('0x3d')],qs['fields'](_0x450e85[_0x0005('0x3f')][_0x0005('0x44')]));_0x500aa7[_0x0005('0x43')]=_0x500aa7[_0x0005('0x43')][_0x0005('0x45')]?_0x500aa7[_0x0005('0x43')]:_0x495cce[_0x0005('0x3d')];if(!_0x450e85['query'][_0x0005('0x46')](_0x0005('0x47'))){_0x500aa7[_0x0005('0x2e')]=qs[_0x0005('0x2e')](_0x450e85[_0x0005('0x3f')][_0x0005('0x2e')]);_0x500aa7[_0x0005('0x48')]=qs['offset'](_0x450e85[_0x0005('0x3f')][_0x0005('0x48')]);}_0x500aa7[_0x0005('0x49')]=qs['sort'](_0x450e85[_0x0005('0x3f')][_0x0005('0x4a')]);_0x500aa7[_0x0005('0x4b')]=qs[_0x0005('0x41')](_[_0x0005('0x4c')](_0x450e85['query'],_0x495cce[_0x0005('0x41')]));_0x500aa7[_0x0005('0x4b')]['WhatsappAccountId']=_0x312d5f['id'];if(_0x450e85['query'][_0x0005('0x4d')]){_0x500aa7[_0x0005('0x4b')]=_[_0x0005('0x4f')](_0x500aa7['where'],{'$or':_[_0x0005('0x37')](_0x500aa7[_0x0005('0x43')],function(_0x1cfa08){var _0x5c820d={};_0x5c820d[_0x1cfa08]={'$like':'%'+_0x450e85[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x5c820d;})});}_0x500aa7=_['merge']({},_0x500aa7,_0x450e85[_0x0005('0x50')]);return db[_0x0005('0x69')][_0x0005('0x51')]({'where':_0x500aa7[_0x0005('0x4b')]})[_0x0005('0x1f')](function(_0x3e033b){_0x1be09e['count']=_0x3e033b;if(_0x450e85['query'][_0x0005('0x52')]){_0x500aa7[_0x0005('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x500aa7);})[_0x0005('0x1f')](function(_0x18d408){_0x1be09e[_0x0005('0x55')]=_0x18d408;return _0x1be09e;});}})[_0x0005('0x1f')](respondWithFilteredResult(_0x45dcfe,_0x500aa7))[_0x0005('0x29')](handleError(_0x45dcfe,null));};exports[_0x0005('0x6b')]=function(_0x477412,_0x1aad1c,_0x7db9f1){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x477412[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x1aad1c,null))[_0x0005('0x1f')](function(_0x52a2f1){if(_0x52a2f1){return _0x52a2f1[_0x0005('0x6b')](_0x477412[_0x0005('0x3f')][_0x0005('0x67')]);}})[_0x0005('0x1f')](respondWithStatusCode(_0x1aad1c,null))[_0x0005('0x29')](handleError(_0x1aad1c,null));};exports['addAgents']=function(_0x104317,_0x479cf9,_0x442f3a){return db['WhatsappAccount'][_0x0005('0x59')]({'where':{'id':_0x104317['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x479cf9,null))[_0x0005('0x1f')](function(_0x30d1f5){if(_0x30d1f5){return _0x30d1f5['addAgents'](_0x104317[_0x0005('0x5b')][_0x0005('0x67')],_['omit'](_0x104317[_0x0005('0x5b')],['ids','id'])||{})[_0x0005('0x6c')](function(_0x24be35){for(var _0x2d46f5=0x0;_0x2d46f5<_0x104317[_0x0005('0x5b')][_0x0005('0x67')][_0x0005('0x45')];_0x2d46f5+=0x1){socket[_0x0005('0x6d')]('userWhatsappAccount:save',{'UserId':_0x104317[_0x0005('0x5b')][_0x0005('0x67')][_0x2d46f5],'WhatsappAccountId':_0x104317[_0x0005('0x57')]['id']});}return _0x24be35;});}})[_0x0005('0x1f')](respondWithResult(_0x479cf9,null))[_0x0005('0x29')](handleError(_0x479cf9,null));};exports[_0x0005('0x6e')]=function(_0x43b494,_0x19f022,_0x3d79a1){return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x43b494['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x19f022,null))[_0x0005('0x1f')](function(_0x5a1bbb){if(_0x5a1bbb){return _0x5a1bbb[_0x0005('0x6e')](_0x43b494[_0x0005('0x3f')]['ids'])[_0x0005('0x1f')](function(){if(_[_0x0005('0x6f')](_0x43b494[_0x0005('0x3f')][_0x0005('0x67')])){for(var _0x247953=0x0;_0x247953<_0x43b494[_0x0005('0x3f')]['ids']['length'];_0x247953+=0x1){socket[_0x0005('0x6d')]('userWhatsappAccount:remove',{'UserId':Number(_0x43b494[_0x0005('0x3f')][_0x0005('0x67')][_0x247953]),'WhatsappAccountId':Number(_0x43b494['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x43b494[_0x0005('0x3f')][_0x0005('0x67')]),'WhatsappAccountId':Number(_0x43b494[_0x0005('0x57')]['id'])});}});}})[_0x0005('0x1f')](respondWithStatusCode(_0x19f022,null))['catch'](handleError(_0x19f022,null));};exports[_0x0005('0x70')]=function(_0x4dea2b,_0x3ca63b,_0x4f44de){var _0x213d4b={};var _0x229d9d={};var _0x4d4c65;var _0x3a9717;return db[_0x0005('0x38')][_0x0005('0x6a')]({'where':{'id':_0x4dea2b[_0x0005('0x57')]['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x3ca63b,null))['then'](function(_0x134f42){if(_0x134f42){_0x4d4c65=_0x134f42;_0x229d9d[_0x0005('0x3d')]=_['keys'](db['User'][_0x0005('0x39')]);_0x229d9d['query']=_[_0x0005('0x40')](_0x4dea2b[_0x0005('0x3f')]);_0x229d9d[_0x0005('0x41')]=_['intersection'](_0x229d9d[_0x0005('0x3d')],_0x229d9d[_0x0005('0x3f')]);_0x213d4b[_0x0005('0x43')]=_[_0x0005('0x42')](_0x229d9d[_0x0005('0x3d')],qs['fields'](_0x4dea2b['query']['fields']));_0x213d4b[_0x0005('0x43')]=_0x213d4b[_0x0005('0x43')][_0x0005('0x45')]?_0x213d4b[_0x0005('0x43')]:_0x229d9d[_0x0005('0x3d')];_0x213d4b[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x4dea2b[_0x0005('0x3f')][_0x0005('0x4a')]);_0x213d4b[_0x0005('0x4b')]=qs[_0x0005('0x41')](_[_0x0005('0x4c')](_0x4dea2b[_0x0005('0x3f')],_0x229d9d[_0x0005('0x41')]));if(_0x4dea2b['query'][_0x0005('0x4d')]){_0x213d4b[_0x0005('0x4b')]=_[_0x0005('0x4f')](_0x213d4b[_0x0005('0x4b')],{'$or':_['map'](_0x213d4b[_0x0005('0x43')],function(_0x1a876a){var _0x493e0a={};_0x493e0a[_0x1a876a]={'$like':'%'+_0x4dea2b[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x493e0a;})});}_0x213d4b=_['merge']({},_0x213d4b,_0x4dea2b[_0x0005('0x50')]);return _0x4d4c65[_0x0005('0x70')](_0x213d4b);}})[_0x0005('0x1f')](function(_0x42dd21){if(_0x42dd21){_0x3a9717=_0x42dd21[_0x0005('0x45')];if(!_0x4dea2b[_0x0005('0x3f')][_0x0005('0x46')](_0x0005('0x47'))){_0x213d4b[_0x0005('0x2e')]=qs[_0x0005('0x2e')](_0x4dea2b[_0x0005('0x3f')][_0x0005('0x2e')]);_0x213d4b[_0x0005('0x48')]=qs[_0x0005('0x48')](_0x4dea2b['query'][_0x0005('0x48')]);}return _0x4d4c65['getAgents'](_0x213d4b);}})[_0x0005('0x1f')](function(_0x4fafd2){if(_0x4fafd2){return _0x4fafd2?{'count':_0x3a9717,'rows':_0x4fafd2}:null;}})[_0x0005('0x1f')](respondWithResult(_0x3ca63b,null))['catch'](handleError(_0x3ca63b,null));};exports[_0x0005('0x71')]=function(_0xf25395,_0x322033,_0x476314){return db['WhatsappAccount']['findOne']({'where':{'id':_0xf25395[_0x0005('0x57')]['id']}})['then'](handleEntityNotFound(_0x322033,null))['then'](function(_0x2aaffd){if(_0x2aaffd){return db[_0x0005('0x72')][_0x0005('0x73')](function(_0x4e7855){return db[_0x0005('0x74')][_0x0005('0x31')]({'where':{'WhatsappAccountId':_0xf25395['params']['id']},'transaction':_0x4e7855})[_0x0005('0x1f')](function(_0x3d58d9){var _0x34fe53=_[_0x0005('0x37')](_0xf25395[_0x0005('0x5b')],function(_0x244edd){_0x244edd[_0x0005('0x63')]=_0xf25395[_0x0005('0x57')]['id'];return _0x244edd;});return db[_0x0005('0x74')]['bulkCreate'](_0x34fe53,{'transaction':_0x4e7855});});})[_0x0005('0x1f')](function(){return db[_0x0005('0x74')][_0x0005('0x75')]({'where':{'WhatsappAccountId':_0xf25395[_0x0005('0x57')]['id']},'order':_0x0005('0x76')});});}})[_0x0005('0x1f')](respondWithResult(_0x322033,null))['catch'](handleError(_0x322033,null));};exports['getApplications']=function(_0x23d1bf,_0x3f305c,_0x386a20){var _0x4141fd={};var _0x692431={};var _0x1c92be;var _0x5ca434;return db[_0x0005('0x38')][_0x0005('0x6a')]({'where':{'id':_0x23d1bf['params']['id']}})[_0x0005('0x1f')](handleEntityNotFound(_0x3f305c,null))[_0x0005('0x1f')](function(_0x2c3f18){if(_0x2c3f18){_0x1c92be=_0x2c3f18;_0x692431[_0x0005('0x3d')]=_[_0x0005('0x40')](db[_0x0005('0x74')][_0x0005('0x39')]);_0x692431[_0x0005('0x3f')]=_[_0x0005('0x40')](_0x23d1bf['query']);_0x692431[_0x0005('0x41')]=_['intersection'](_0x692431[_0x0005('0x3d')],_0x692431['query']);_0x4141fd[_0x0005('0x43')]=_[_0x0005('0x42')](_0x692431[_0x0005('0x3d')],qs[_0x0005('0x44')](_0x23d1bf[_0x0005('0x3f')]['fields']));_0x4141fd[_0x0005('0x43')]=_0x4141fd['attributes'][_0x0005('0x45')]?_0x4141fd[_0x0005('0x43')]:_0x692431[_0x0005('0x3d')];_0x4141fd[_0x0005('0x49')]=qs[_0x0005('0x4a')](_0x23d1bf[_0x0005('0x3f')][_0x0005('0x4a')]);_0x4141fd[_0x0005('0x4b')]=qs[_0x0005('0x41')](_['pick'](_0x23d1bf['query'],_0x692431['filters']));if(_0x23d1bf['query']['filter']){_0x4141fd['where']=_[_0x0005('0x4f')](_0x4141fd['where'],{'$or':_[_0x0005('0x37')](_0x4141fd['attributes'],function(_0x19f760){var _0x47c1b2={};_0x47c1b2[_0x19f760]={'$like':'%'+_0x23d1bf[_0x0005('0x3f')][_0x0005('0x4d')]+'%'};return _0x47c1b2;})});}_0x4141fd=_['merge']({},_0x4141fd,_0x23d1bf[_0x0005('0x50')]);return _0x1c92be['getApplications'](_0x4141fd);}})['then'](function(_0x5afd0e){if(_0x5afd0e){_0x5ca434=_0x5afd0e[_0x0005('0x45')];if(!_0x23d1bf['query'][_0x0005('0x46')](_0x0005('0x47'))){_0x4141fd['limit']=qs['limit'](_0x23d1bf['query'][_0x0005('0x2e')]);_0x4141fd['offset']=qs[_0x0005('0x48')](_0x23d1bf[_0x0005('0x3f')][_0x0005('0x48')]);}return _0x1c92be[_0x0005('0x77')](_0x4141fd);}})[_0x0005('0x1f')](function(_0x50159a){if(_0x50159a){return _0x50159a?{'count':_0x5ca434,'rows':_0x50159a}:null;}})[_0x0005('0x1f')](respondWithResult(_0x3f305c,null))[_0x0005('0x29')](handleError(_0x3f305c,null));};exports[_0x0005('0x78')]=function(_0x3153de,_0x560207,_0x4da3a8){var _0x18c75b={'channel':'whatsapp'};var _0x40507f=[];var _0x41a3b8=[];var _0x1f3d27={};return db[_0x0005('0x38')]['find']({'where':{'id':_0x3153de['params']['id']},'include':[{'model':db[_0x0005('0x74')],'as':_0x0005('0x79')}]})[_0x0005('0x1f')](handleEntityNotFound(_0x560207,null))[_0x0005('0x1f')](function(_0x45c2cb){_0x18c75b['account']=_0x45c2cb;_0x18c75b[_0x0005('0x7a')]=_[_0x0005('0x7b')](_0x45c2cb[_0x0005('0x79')],['priority'],['asc']);if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x79')]){delete _0x18c75b[_0x0005('0x7c')]['Applications'];}return db[_0x0005('0x7d')]['describe']();})['then'](function(_0x4ee08f){if(!_0x4ee08f){throw new db['Sequelize']['ValidationError'](_0x0005('0x7e'));}_0x40507f=_[_0x0005('0x7f')](_[_0x0005('0x40')](_0x4ee08f),[_0x0005('0x80'),_0x0005('0x81')]);_0x41a3b8=_['difference'](_[_0x0005('0x40')](_0x4ee08f),[_0x0005('0x80'),_0x0005('0x81'),'CompanyId',_0x0005('0x82')]);_0x18c75b['body']={'mapKey':_0x0005('0x83')};if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x3b')]&&_0x18c75b[_0x0005('0x7c')][_0x0005('0x3b')]==='twilio'){_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')]=_0x3153de[_0x0005('0x5b')]['From']['replace'](_0x0005('0x85'),'');_0x18c75b['body'][_0x0005('0x5b')]=_0x3153de[_0x0005('0x5b')]['Body'];_0x18c75b[_0x0005('0x5b')]['messageId']=_0x3153de[_0x0005('0x5b')][_0x0005('0x86')];}if(_0x18c75b[_0x0005('0x5b')]['id']){delete _0x18c75b[_0x0005('0x5b')]['id'];}if(_[_0x0005('0x87')](_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')])){throw new db[(_0x0005('0x88'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x18c75b[_0x0005('0x5b')][_0x0005('0x5b')])||_0x18c75b[_0x0005('0x5b')][_0x0005('0x5b')]===''){throw new db[(_0x0005('0x88'))][(_0x0005('0x89'))](_0x0005('0x8a'));}if(_[_0x0005('0x87')](_0x18c75b['body'][_0x0005('0x8b')])){throw new db[(_0x0005('0x88'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41a3b8);}if(!_[_0x0005('0x8c')](_0x41a3b8,_0x18c75b[_0x0005('0x5b')][_0x0005('0x8b')])){throw new db[(_0x0005('0x88'))][(_0x0005('0x89'))](_0x0005('0x8d')+_0x41a3b8);}_0x1f3d27[_0x18c75b[_0x0005('0x5b')][_0x0005('0x8b')]]=_0x18c75b['body'][_0x0005('0x84')];return db[_0x0005('0x8e')][_0x0005('0x59')]({'where':{'id':_0x18c75b['account'][_0x0005('0x82')]},'include':[{'model':db[_0x0005('0x7d')],'as':_0x0005('0x8f'),'where':_0x1f3d27,'limit':0x1,'order':[['updatedAt',_0x0005('0x90')]]}]});})[_0x0005('0x1f')](handleEntityNotFound(_0x560207,null))['then'](function(_0x2a78a9){if(_0x2a78a9){_0x18c75b[_0x0005('0x91')]=_[_0x0005('0x92')](_0x2a78a9,[_0x0005('0x8f')]);if(_0x2a78a9['Contacts'][_0x0005('0x45')]){return _0x2a78a9[_0x0005('0x8f')][0x0];}var _0x4005ae=_[_0x0005('0x17')](_0x18c75b['body'],{'firstName':_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')],'ListId':_0x2a78a9['id']});_0x4005ae[_0x18c75b[_0x0005('0x5b')]['mapKey']]=_0x18c75b['body']['from'];return db[_0x0005('0x7d')][_0x0005('0x5a')](_0x4005ae,{'fields':_0x40507f,'raw':!![]});}})['then'](handleEntityNotFound(_0x560207,null))[_0x0005('0x1f')](function(_0x5bc445){if(_0x5bc445){_0x18c75b['contact']=_0x5bc445;var _0x4036d7={'ContactId':_0x5bc445['id'],'phone':_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')],'WhatsappAccountId':_0x3153de[_0x0005('0x57')]['id']};var _0x219320={'ContactId':_0x5bc445['id'],'WhatsappAccountId':_0x3153de[_0x0005('0x57')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x0005('0x59')]({'where':_0x219320})[_0x0005('0x1f')](function(_0x385d42){if(_0x385d42){return[_0x385d42,![]];}return db['WhatsappInteraction']['create'](_0x4036d7)[_0x0005('0x1f')](function(_0x5d9f3d){return[_0x5d9f3d,!![]];});});}})['spread'](function(_0x2d7db1,_0x249ee8){_0x18c75b[_0x0005('0x93')]=_0x2d7db1[_0x0005('0x32')]({'plain':!![]});_0x18c75b[_0x0005('0x93')][_0x0005('0x94')]=![];if(_0x249ee8){if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x95')]){_0x18c75b[_0x0005('0x7a')][_0x0005('0x96')]({'id':0x0,'priority':_0x18c75b[_0x0005('0x7a')][_0x0005('0x45')]+0x1,'app':_0x0005('0x97'),'appdata':_0x0005('0x98'),'interval':_0x0005('0x99')});}_0x18c75b[_0x0005('0x93')][_0x0005('0x94')]=!![];}return db[_0x0005('0x9a')][_0x0005('0x5a')]({'phone':_0x18c75b[_0x0005('0x5b')][_0x0005('0x84')],'messageId':_0x18c75b[_0x0005('0x5b')][_0x0005('0x9b')],'body':_0x18c75b[_0x0005('0x5b')][_0x0005('0x5b')],'WhatsappAccountId':_0x3153de[_0x0005('0x57')]['id'],'WhatsappInteractionId':_0x2d7db1['id'],'direction':'in','ContactId':_0x2d7db1[_0x0005('0x9c')],'AttachmentId':_0x18c75b[_0x0005('0x5b')]['AttachmentId']});})[_0x0005('0x1f')](function(_0x386ad1){_0x18c75b[_0x0005('0x26')]=_0x386ad1;if(_0x18c75b['interaction']['UserId']){return db[_0x0005('0x9d')]['find']({'attributes':['id',_0x0005('0x3e')],'where':{'id':_0x18c75b[_0x0005('0x93')][_0x0005('0x9e')]}})[_0x0005('0x1f')](function(_0x11f799){if(_0x11f799){_0x18c75b[_0x0005('0x7a')][_0x0005('0x9f')]({'id':0x0,'priority':0x0,'app':_0x0005('0xa0'),'appdata':_0x11f799[_0x0005('0x3e')]+','+(_0x18c75b[_0x0005('0x7c')][_0x0005('0xa1')]||0xa),'interval':_0x0005('0x99')});}return respondWithRpcPromise(_0x0005('0xa2'),'startRouting',_0x18c75b);});}return respondWithRpcPromise(_0x0005('0xa2'),_0x0005('0xa3'),_0x18c75b);})[_0x0005('0x1f')](function(_0x365933){if(_0x365933){var _0x57e101=0xc8;var _0x152f23='receiveMessage';logger[_0x0005('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x152f23,_0x57e101,_0x0005('0xa4'));logger[_0x0005('0xa5')](_0x0005('0xa6'),_0x152f23,_0x57e101,_0x0005('0xa4'),JSON[_0x0005('0x23')](_0x365933));if(_0x18c75b[_0x0005('0x7c')][_0x0005('0x3b')]===_0x0005('0xa7')){return _0x560207[_0x0005('0x2c')](_0x57e101)[_0x0005('0x2f')](_0x0005('0xa8'),_0x0005('0xa9'))[_0x0005('0x34')](_0x0005('0xaa'));}else{return _0x560207[_0x0005('0x2c')](_0x57e101)[_0x0005('0x2d')](_0x365933);}}})[_0x0005('0x29')](handleError(_0x560207,null));};exports[_0x0005('0x34')]=function(_0x412659,_0xbaa3ed,_0x3bc863){var _0x34356d,_0x25c1ad,_0x3c8096;if(_['isNil'](_0x412659[_0x0005('0x5b')][_0x0005('0x5b')])||_0x412659[_0x0005('0x5b')][_0x0005('0x5b')]===''){throw new db[(_0x0005('0x88'))][(_0x0005('0x89'))](_0x0005('0x8a'));}if(_[_0x0005('0x87')](_0x412659['body']['to'])){throw new db['Sequelize'][(_0x0005('0x89'))](_0x0005('0xab'));}_0x34356d=_0x412659['body']['to'];return db[_0x0005('0x38')][_0x0005('0x59')]({'where':{'id':_0x412659['params']['id']},'include':[{'model':db[_0x0005('0x8e')],'as':_0x0005('0xac'),'include':[{'model':db['CmContact'],'as':_0x0005('0x8f'),'where':{'mobile':_0x34356d},'limit':0x1,'order':[[_0x0005('0x81'),_0x0005('0x90')]]}]}]})['then'](handleEntityNotFound(_0xbaa3ed,null))[_0x0005('0x1f')](function(_0x45116f){if(_0x45116f&&_0x45116f[_0x0005('0xac')]){_0x25c1ad=_0x45116f[_0x0005('0x32')]({'plain':!![]});if(_0x25c1ad['List']&&_0x25c1ad[_0x0005('0xac')][_0x0005('0x8f')][_0x0005('0x45')]){return _0x25c1ad['List'][_0x0005('0x8f')][0x0];}return db['CmContact']['create'](_[_0x0005('0x17')](_0x412659[_0x0005('0x5b')],{'firstName':_0x34356d,'mobile':_0x34356d,'phone':_0x34356d,'ListId':_0x25c1ad[_0x0005('0x82')]}));}})['then'](handleEntityNotFound(_0xbaa3ed,null))[_0x0005('0x1f')](function(_0x33483b){if(_0x33483b){_0x3c8096=_0x33483b;return db[_0x0005('0xad')][_0x0005('0x59')]({'where':{'ContactId':_0x3c8096['id'],'closed':![],'WhatsappAccountId':_0x25c1ad['id']}})[_0x0005('0x1f')](function(_0x13cb6e){if(_0x13cb6e){return[_0x13cb6e,![]];}return db[_0x0005('0xad')][_0x0005('0x5a')]({'UserId':_0x412659[_0x0005('0x5c')]['id'],'ContactId':_0x3c8096['id'],'WhatsappAccountId':_0x25c1ad['id'],'phone':_0x34356d,'firstMsgDirection':'out','Messages':[_['merge'](_0x412659[_0x0005('0x5b')],{'read':![],'body':_0x412659[_0x0005('0x5b')][_0x0005('0x5b')],'phone':_0x34356d,'WhatsappAccountId':_0x25c1ad['id'],'UserId':_0x412659['user']['id'],'ContactId':_0x3c8096['id']})]},{'include':[{'model':db[_0x0005('0x9a')],'as':'Messages'}]})['then'](function(_0x18e7c4){return[_0x18e7c4,!![]];});});}})['spread'](function(_0x22fb5a,_0x585804){if(_0x585804){return _0x22fb5a;}return db[_0x0005('0x9a')][_0x0005('0x5a')](_[_0x0005('0x4f')](_0x412659[_0x0005('0x5b')],{'read':![],'body':_0x412659['body']['body'],'phone':_0x34356d,'WhatsappAccountId':_0x25c1ad['id'],'WhatsappInteractionId':_0x22fb5a['id'],'UserId':_0x412659[_0x0005('0x5c')]['id'],'ContactId':_0x3c8096['id']}))[_0x0005('0x1f')](function(_0x352663){_0x22fb5a[_0x0005('0xae')]['Messages']=[];_0x22fb5a[_0x0005('0xae')]['Messages'][_0x0005('0x96')](_0x352663[_0x0005('0xae')]);return _0x22fb5a;});})[_0x0005('0x1f')](respondWithResult(_0xbaa3ed,null))[_0x0005('0x29')](handleError(_0xbaa3ed,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4642c7a..b30bfe2 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 _0x5430=['WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2dc89d,_0x1cef93){var _0x294caa=function(_0x3ff818){while(--_0x3ff818){_0x2dc89d['push'](_0x2dc89d['shift']());}};_0x294caa(++_0x1cef93);}(_0x5430,0x10c));var _0x0543=function(_0x1d61c3,_0xbdb02d){_0x1d61c3=_0x1d61c3-0x0;var _0x2ea27f=_0x5430[_0x1d61c3];return _0x2ea27f;};'use strict';var EventEmitter=require(_0x0543('0x0'));var WhatsappAccount=require(_0x0543('0x1'))['db'][_0x0543('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0543('0x3')](0x0);var events={'afterCreate':_0x0543('0x4'),'afterUpdate':_0x0543('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b122c){return function(_0x1c5ab7,_0x4ee416,_0x523f3d){WhatsappAccountEvents[_0x0543('0x6')](_0x5b122c+':'+_0x1c5ab7['id'],_0x1c5ab7);WhatsappAccountEvents[_0x0543('0x6')](_0x5b122c,_0x1c5ab7);_0x523f3d(null);};}for(var e in events){if(events[_0x0543('0x7')](e)){var event=events[e];WhatsappAccount[_0x0543('0x8')](e,emitEvent(event));}}module[_0x0543('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x53b30b,_0x4240cd){var _0xec1d7c=function(_0x8359ae){while(--_0x8359ae){_0x53b30b['push'](_0x53b30b['shift']());}};_0xec1d7c(++_0x4240cd);}(_0x4888,0x198));var _0x8488=function(_0x211158,_0x5edf3c){_0x211158=_0x211158-0x0;var _0x197bef=_0x4888[_0x211158];return _0x197bef;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){WhatsappAccountEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);WhatsappAccountEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];WhatsappAccount[_0x8488('0x8')](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 bd15cb3..f6cef47 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 _0xe0f4=['WhatsappAccount','lodash','util','api','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x19d9a3,_0x37b0c7){var _0x171ae9=function(_0x470d98){while(--_0x470d98){_0x19d9a3['push'](_0x19d9a3['shift']());}};_0x171ae9(++_0x37b0c7);}(_0xe0f4,0x1eb));var _0x4e0f=function(_0x1bbcee,_0x29695e){_0x1bbcee=_0x1bbcee-0x0;var _0x13b7d7=_0xe0f4[_0x1bbcee];return _0x13b7d7;};'use strict';var _=require(_0x4e0f('0x0'));var util=require(_0x4e0f('0x1'));var logger=require('../../config/logger')(_0x4e0f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e0f('0x3'));var fs=require('fs');var path=require(_0x4e0f('0x4'));var rimraf=require(_0x4e0f('0x5'));var config=require(_0x4e0f('0x6'));var attributes=require(_0x4e0f('0x7'));module[_0x4e0f('0x8')]=function(_0x2eea6b,_0x35f829){return _0x2eea6b['define'](_0x4e0f('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d2b=['request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','moment','bluebird'];(function(_0x2a99e2,_0x1803e4){var _0x23fb5f=function(_0x568ec9){while(--_0x568ec9){_0x2a99e2['push'](_0x2a99e2['shift']());}};_0x23fb5f(++_0x1803e4);}(_0x3d2b,0x13c));var _0xb3d2=function(_0xe58e7c,_0x2de554){_0xe58e7c=_0xe58e7c-0x0;var _0x423cc2=_0x3d2b[_0xe58e7c];return _0x423cc2;};'use strict';var _=require(_0xb3d2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb3d2('0x1'));var BPromise=require(_0xb3d2('0x2'));var rp=require(_0xb3d2('0x3'));var fs=require('fs');var path=require(_0xb3d2('0x4'));var rimraf=require('rimraf');var config=require(_0xb3d2('0x5'));var attributes=require(_0xb3d2('0x6'));module[_0xb3d2('0x7')]=function(_0x58bd98,_0x1805fb){return _0x58bd98[_0xb3d2('0x8')](_0xb3d2('0x9'),attributes,{'tableName':_0xb3d2('0xa'),'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 4828493..f5d9eba 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 _0x2697=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowWhatsappAccount','find','options','include','map','model','attributes','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info'];(function(_0x1df35d,_0x5c49c0){var _0xef1546=function(_0x2e091e){while(--_0x2e091e){_0x1df35d['push'](_0x1df35d['shift']());}};_0xef1546(++_0x5c49c0);}(_0x2697,0x120));var _0x7269=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x2697[_0x594ece];return _0x471bc4;};'use strict';var _=require('lodash');var util=require(_0x7269('0x0'));var moment=require(_0x7269('0x1'));var BPromise=require(_0x7269('0x2'));var rs=require(_0x7269('0x3'));var fs=require('fs');var Redis=require(_0x7269('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7269('0x5'));var logger=require('../../config/logger')(_0x7269('0x6'));var config=require(_0x7269('0x7'));var jayson=require(_0x7269('0x8'));var client=jayson[_0x7269('0x9')][_0x7269('0xa')]({'port':0x232a});config[_0x7269('0xb')]=_[_0x7269('0xc')](config[_0x7269('0xb')],{'host':_0x7269('0xd'),'port':0x18eb});var socket=require(_0x7269('0xe'))(new Redis(config[_0x7269('0xb')]));require('./whatsappAccount.socket')[_0x7269('0xf')](socket);function respondWithRpcPromise(_0x1395a1,_0x5c236a,_0x3c21f9){return new BPromise(function(_0x5e1cbf,_0x300f31){return client['request'](_0x1395a1,_0x3c21f9)[_0x7269('0x10')](function(_0x4c18f7){logger[_0x7269('0x11')](_0x7269('0x12'),_0x5c236a,_0x7269('0x13'));logger['debug'](_0x7269('0x14'),_0x5c236a,_0x7269('0x13'),JSON['stringify'](_0x4c18f7));if(_0x4c18f7[_0x7269('0x15')]){if(_0x4c18f7[_0x7269('0x15')][_0x7269('0x16')]===0x1f4){logger['error'](_0x7269('0x12'),_0x5c236a,_0x4c18f7[_0x7269('0x15')][_0x7269('0x17')]);return _0x300f31(_0x4c18f7[_0x7269('0x15')][_0x7269('0x17')]);}logger[_0x7269('0x15')](_0x7269('0x12'),_0x5c236a,_0x4c18f7[_0x7269('0x15')]['message']);return _0x5e1cbf(_0x4c18f7[_0x7269('0x15')][_0x7269('0x17')]);}else{logger[_0x7269('0x11')](_0x7269('0x12'),_0x5c236a,'request\x20sent');_0x5e1cbf(_0x4c18f7['result']['message']);}})[_0x7269('0x18')](function(_0x1c9163){logger[_0x7269('0x15')](_0x7269('0x12'),_0x5c236a,_0x1c9163);_0x300f31(_0x1c9163);});});}exports[_0x7269('0x19')]=function(_0x20bda7){var _0x97598e=this;return new Promise(function(_0x57ecc9,_0x4f0d05){return db['WhatsappAccount'][_0x7269('0x1a')]({'raw':_0x20bda7['options']?_0x20bda7[_0x7269('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x20bda7[_0x7269('0x1b')]?_0x20bda7[_0x7269('0x1b')]['where']||null:null,'attributes':_0x20bda7[_0x7269('0x1b')]?_0x20bda7[_0x7269('0x1b')]['attributes']||null:null,'include':_0x20bda7[_0x7269('0x1b')]?_0x20bda7[_0x7269('0x1b')][_0x7269('0x1c')]?_[_0x7269('0x1d')](_0x20bda7['options'][_0x7269('0x1c')],function(_0x2b8e9e){return{'model':db[_0x2b8e9e[_0x7269('0x1e')]],'as':_0x2b8e9e['as'],'attributes':_0x2b8e9e[_0x7269('0x1f')],'include':_0x2b8e9e[_0x7269('0x1c')]?_[_0x7269('0x1d')](_0x2b8e9e['include'],function(_0x198b59){return{'model':db[_0x198b59[_0x7269('0x1e')]],'as':_0x198b59['as'],'attributes':_0x198b59[_0x7269('0x1f')],'include':_0x198b59[_0x7269('0x1c')]?_[_0x7269('0x1d')](_0x198b59['include'],function(_0x33c43a){return{'model':db[_0x33c43a[_0x7269('0x1e')]],'as':_0x33c43a['as'],'attributes':_0x33c43a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7269('0x10')](function(_0x492e73){logger[_0x7269('0x11')](_0x7269('0x19'),_0x20bda7);logger[_0x7269('0x20')](_0x7269('0x19'),_0x20bda7,JSON[_0x7269('0x21')](_0x492e73));_0x57ecc9(_0x492e73);})['catch'](function(_0x43e363){logger[_0x7269('0x15')](_0x7269('0x19'),_0x43e363[_0x7269('0x17')],_0x20bda7);_0x4f0d05(_0x97598e['error'](0x1f4,_0x43e363[_0x7269('0x17')]));});});}; \ No newline at end of file +var _0xe285=['http','redis','defaults','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','model','include','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe285,0xe5));var _0x5e28=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe285[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5e28('0x0'));var util=require(_0x5e28('0x1'));var moment=require(_0x5e28('0x2'));var BPromise=require(_0x5e28('0x3'));var rs=require(_0x5e28('0x4'));var fs=require('fs');var Redis=require(_0x5e28('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e28('0x6'));var config=require(_0x5e28('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5e28('0x8')][_0x5e28('0x9')]({'port':0x232a});config[_0x5e28('0xa')]=_[_0x5e28('0xb')](config[_0x5e28('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e28('0xa')]));require(_0x5e28('0xc'))['register'](socket);function respondWithRpcPromise(_0x12d02c,_0x9d40bf,_0x8cc84d){return new BPromise(function(_0x5e8aa9,_0x7bb983){return client['request'](_0x12d02c,_0x8cc84d)[_0x5e28('0xd')](function(_0x3657a5){logger[_0x5e28('0xe')](_0x5e28('0xf'),_0x9d40bf,_0x5e28('0x10'));logger['debug'](_0x5e28('0x11'),_0x9d40bf,_0x5e28('0x10'),JSON['stringify'](_0x3657a5));if(_0x3657a5[_0x5e28('0x12')]){if(_0x3657a5[_0x5e28('0x12')][_0x5e28('0x13')]===0x1f4){logger[_0x5e28('0x12')](_0x5e28('0xf'),_0x9d40bf,_0x3657a5[_0x5e28('0x12')][_0x5e28('0x14')]);return _0x7bb983(_0x3657a5['error'][_0x5e28('0x14')]);}logger[_0x5e28('0x12')](_0x5e28('0xf'),_0x9d40bf,_0x3657a5[_0x5e28('0x12')][_0x5e28('0x14')]);return _0x5e8aa9(_0x3657a5[_0x5e28('0x12')]['message']);}else{logger[_0x5e28('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x9d40bf,_0x5e28('0x10'));_0x5e8aa9(_0x3657a5['result']['message']);}})['catch'](function(_0x3a83fc){logger[_0x5e28('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x9d40bf,_0x3a83fc);_0x7bb983(_0x3a83fc);});});}exports[_0x5e28('0x15')]=function(_0x47dc98){var _0x3190e7=this;return new Promise(function(_0x3301ba,_0x515233){return db[_0x5e28('0x16')][_0x5e28('0x17')]({'raw':_0x47dc98['options']?_0x47dc98[_0x5e28('0x18')][_0x5e28('0x19')]===undefined?!![]:![]:!![],'where':_0x47dc98['options']?_0x47dc98[_0x5e28('0x18')][_0x5e28('0x1a')]||null:null,'attributes':_0x47dc98['options']?_0x47dc98[_0x5e28('0x18')][_0x5e28('0x1b')]||null:null,'include':_0x47dc98[_0x5e28('0x18')]?_0x47dc98[_0x5e28('0x18')]['include']?_[_0x5e28('0x1c')](_0x47dc98['options']['include'],function(_0x45ee0c){return{'model':db[_0x45ee0c[_0x5e28('0x1d')]],'as':_0x45ee0c['as'],'attributes':_0x45ee0c[_0x5e28('0x1b')],'include':_0x45ee0c[_0x5e28('0x1e')]?_[_0x5e28('0x1c')](_0x45ee0c[_0x5e28('0x1e')],function(_0x46e0f7){return{'model':db[_0x46e0f7[_0x5e28('0x1d')]],'as':_0x46e0f7['as'],'attributes':_0x46e0f7[_0x5e28('0x1b')],'include':_0x46e0f7[_0x5e28('0x1e')]?_[_0x5e28('0x1c')](_0x46e0f7['include'],function(_0xdfe827){return{'model':db[_0xdfe827[_0x5e28('0x1d')]],'as':_0xdfe827['as'],'attributes':_0xdfe827[_0x5e28('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5e28('0xd')](function(_0x4f9f82){logger[_0x5e28('0xe')](_0x5e28('0x15'),_0x47dc98);logger[_0x5e28('0x1f')](_0x5e28('0x15'),_0x47dc98,JSON[_0x5e28('0x20')](_0x4f9f82));_0x3301ba(_0x4f9f82);})[_0x5e28('0x21')](function(_0x56d127){logger[_0x5e28('0x12')](_0x5e28('0x15'),_0x56d127[_0x5e28('0x14')],_0x47dc98);_0x515233(_0x3190e7[_0x5e28('0x12')](0x1f4,_0x56d127[_0x5e28('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index aa47445..0e5c74d 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 _0xd084=['removeListener','length','whatsappAccount:','./whatsappAccount.events','save','emit'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xd084,0x1dd));var _0x4d08=function(_0x58f8f6,_0x207b30){_0x58f8f6=_0x58f8f6-0x0;var _0x1569dc=_0xd084[_0x58f8f6];return _0x1569dc;};'use strict';var WhatsappAccountEvents=require(_0x4d08('0x0'));var events=[_0x4d08('0x1'),'remove','update'];function createListener(_0x42fe3c,_0x52a548){return function(_0x413b54){_0x52a548[_0x4d08('0x2')](_0x42fe3c,_0x413b54);};}function removeListener(_0x3e531d,_0x2bd065){return function(){WhatsappAccountEvents[_0x4d08('0x3')](_0x3e531d,_0x2bd065);};}exports['register']=function(_0x20c559){for(var _0x253af8=0x0,_0x144cb5=events[_0x4d08('0x4')];_0x253af8<_0x144cb5;_0x253af8++){var _0x35f397=events[_0x253af8];var _0x564a4f=createListener(_0x4d08('0x5')+_0x35f397,_0x20c559);WhatsappAccountEvents['on'](_0x35f397,_0x564a4f);}}; \ No newline at end of file +var _0x932d=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x932d,0x1bb));var _0xd932=function(_0x275cc2,_0x3189e6){_0x275cc2=_0x275cc2-0x0;var _0x1e787d=_0x932d[_0x275cc2];return _0x1e787d;};'use strict';var WhatsappAccountEvents=require(_0xd932('0x0'));var events=[_0xd932('0x1'),_0xd932('0x2'),_0xd932('0x3')];function createListener(_0x4c0e46,_0x4398e7){return function(_0xe04174){_0x4398e7[_0xd932('0x4')](_0x4c0e46,_0xe04174);};}function removeListener(_0x87d6ad,_0x3756f1){return function(){WhatsappAccountEvents[_0xd932('0x5')](_0x87d6ad,_0x3756f1);};}exports[_0xd932('0x6')]=function(_0x7574e){for(var _0xe4dd63=0x0,_0x4e184b=events[_0xd932('0x7')];_0xe4dd63<_0x4e184b;_0xe4dd63++){var _0x57a4f5=events[_0xe4dd63];var _0x174867=createListener(_0xd932('0x8')+_0x57a4f5,_0x7574e);WhatsappAccountEvents['on'](_0x57a4f5,_0x174867);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f3efa7b..201dbf7 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 _0xc41b=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xc41b,0xff));var _0xbc41=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc41b[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xbc41('0x0'));var util=require(_0xbc41('0x1'));var path=require(_0xbc41('0x2'));var timeout=require(_0xbc41('0x3'));var express=require('express');var router=express[_0xbc41('0x4')]();var auth=require(_0xbc41('0x5'));var interaction=require(_0xbc41('0x6'));var config=require('../../config/environment');var controller=require(_0xbc41('0x7'));router[_0xbc41('0x8')]('/',auth[_0xbc41('0x9')](),controller[_0xbc41('0xa')]);router[_0xbc41('0x8')](_0xbc41('0xb'),auth[_0xbc41('0x9')](),controller[_0xbc41('0xc')]);router[_0xbc41('0xd')]('/',auth[_0xbc41('0x9')](),controller['create']);router[_0xbc41('0xe')](_0xbc41('0xb'),auth[_0xbc41('0x9')](),controller['update']);router[_0xbc41('0xf')]('/:id',auth[_0xbc41('0x9')](),controller[_0xbc41('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb200=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x3f4585,_0x2e4839){var _0x46a32d=function(_0x4d007f){while(--_0x4d007f){_0x3f4585['push'](_0x3f4585['shift']());}};_0x46a32d(++_0x2e4839);}(_0xb200,0x1ce));var _0x0b20=function(_0x498834,_0x57c709){_0x498834=_0x498834-0x0;var _0x2fc7ef=_0xb200[_0x498834];return _0x2fc7ef;};'use strict';var multer=require(_0x0b20('0x0'));var util=require(_0x0b20('0x1'));var path=require(_0x0b20('0x2'));var timeout=require(_0x0b20('0x3'));var express=require(_0x0b20('0x4'));var router=express[_0x0b20('0x5')]();var auth=require(_0x0b20('0x6'));var interaction=require(_0x0b20('0x7'));var config=require('../../config/environment');var controller=require(_0x0b20('0x8'));router['get']('/',auth[_0x0b20('0x9')](),controller[_0x0b20('0xa')]);router[_0x0b20('0xb')](_0x0b20('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0b20('0xd')]('/',auth[_0x0b20('0x9')](),controller[_0x0b20('0xe')]);router[_0x0b20('0xf')](_0x0b20('0xc'),auth['isAuthenticated'](),controller[_0x0b20('0x10')]);router[_0x0b20('0x11')](_0x0b20('0xc'),auth[_0x0b20('0x9')](),controller[_0x0b20('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f0ddd55..833a1fa 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 _0xcde1=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xcde1,0x130));var _0x1cde=function(_0x1f48b3,_0x48856f){_0x1f48b3=_0x1f48b3-0x0;var _0x18771f=_0xcde1[_0x1f48b3];return _0x18771f;};'use strict';var Sequelize=require(_0x1cde('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1cde('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1cde('0x2')],'allowNull':![],'defaultValue':_0x1cde('0x3')},'appdata':{'type':Sequelize[_0x1cde('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1cde('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0d2b=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x2e0ab3,_0x160d5b){var _0x5f0f46=function(_0x2743ba){while(--_0x2743ba){_0x2e0ab3['push'](_0x2e0ab3['shift']());}};_0x5f0f46(++_0x160d5b);}(_0x0d2b,0x159));var _0xb0d2=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x0d2b[_0x5c5c52];return _0x4229ff;};'use strict';var Sequelize=require(_0xb0d2('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb0d2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb0d2('0x2')],'allowNull':![],'defaultValue':_0xb0d2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb0d2('0x2')],'defaultValue':_0xb0d2('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c10f632..a7e00f0 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 _0x559d=['include','find','catch','create','body','params','html-pdf','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','then','destroy','sendStatus','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show'];(function(_0x43b92f,_0x41371f){var _0x23cb82=function(_0x241f22){while(--_0x241f22){_0x43b92f['push'](_0x43b92f['shift']());}};_0x23cb82(++_0x41371f);}(_0x559d,0xc0));var _0xd559=function(_0x3c57c7,_0x18e494){_0x3c57c7=_0x3c57c7-0x0;var _0x9c2cbb=_0x559d[_0x3c57c7];return _0x9c2cbb;};'use strict';var pdf=require(_0xd559('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd559('0x2'));var rp=require('request-promise');var moment=require(_0xd559('0x3'));var BPromise=require(_0xd559('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd559('0x5'));var csv=require(_0xd559('0x6'));var ejs=require(_0xd559('0x7'));var fs=require('fs');var _=require(_0xd559('0x8'));var squel=require(_0xd559('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd559('0xa'));var toCsv=require(_0xd559('0x6'));var querystring=require(_0xd559('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd559('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd559('0xd'));var licenseUtil=require(_0xd559('0xe'));var db=require(_0xd559('0xf'))['db'];function respondWithStatusCode(_0x4214cd,_0x262fb7){_0x262fb7=_0x262fb7||0xcc;return function(_0x5c5002){if(_0x5c5002){return _0x4214cd['sendStatus'](_0x262fb7);}return _0x4214cd[_0xd559('0x10')](_0x262fb7)[_0xd559('0x11')]();};}function respondWithResult(_0x48abf1,_0x4e4cb3){_0x4e4cb3=_0x4e4cb3||0xc8;return function(_0x527925){if(_0x527925){return _0x48abf1['status'](_0x4e4cb3)[_0xd559('0x12')](_0x527925);}};}function respondWithFilteredResult(_0x2cc5bc,_0x150b48){return function(_0x168c46){if(_0x168c46){var _0x338ce4=_0x168c46[_0xd559('0x13')],_0x21a145=_0x150b48['offset'],_0xa61036=_0x150b48[_0xd559('0x14')]+_0x150b48[_0xd559('0x15')],_0x13c678;if(_0xa61036>=_0x338ce4){_0xa61036=_0x338ce4;_0x13c678=0xc8;}else{_0x13c678=0xce;}_0x2cc5bc[_0xd559('0x10')](_0x13c678);return _0x2cc5bc['set']('Content-Range',_0x21a145+'-'+_0xa61036+'/'+_0x338ce4)[_0xd559('0x12')](_0x168c46);}return null;};}function patchUpdates(_0x4b4dc8){return function(_0x529497){try{jsonpatch[_0xd559('0x16')](_0x529497,_0x4b4dc8,!![]);}catch(_0x3fb32b){return BPromise[_0xd559('0x17')](_0x3fb32b);}return _0x529497['save']();};}function saveUpdates(_0x38e80c,_0x32abab){return function(_0x3ebba1){if(_0x3ebba1){return _0x3ebba1['update'](_0x38e80c)[_0xd559('0x18')](function(_0x3f1e76){return _0x3f1e76;});}return null;};}function removeEntity(_0x1d3ce3,_0x8c5a19){return function(_0xf69680){if(_0xf69680){return _0xf69680[_0xd559('0x19')]()[_0xd559('0x18')](function(){_0x1d3ce3[_0xd559('0x10')](0xcc)[_0xd559('0x11')]();});}};}function handleEntityNotFound(_0x557c24,_0x175999){return function(_0x55c26c){if(!_0x55c26c){_0x557c24[_0xd559('0x1a')](0x194);}return _0x55c26c;};}function handleError(_0x2fdd45,_0x358371){_0x358371=_0x358371||0x1f4;return function(_0x4c1225){logger[_0xd559('0x1b')](_0x4c1225['stack']);if(_0x4c1225[_0xd559('0x1c')]){delete _0x4c1225[_0xd559('0x1c')];}_0x2fdd45[_0xd559('0x10')](_0x358371)['send'](_0x4c1225);};}exports[_0xd559('0x1d')]=function(_0x2678c5,_0x4755bd){var _0x5a7dfb={},_0x27fb47={},_0x587528={'count':0x0,'rows':[]};var _0x73ef5b=_[_0xd559('0x1e')](db[_0xd559('0x1f')][_0xd559('0x20')],function(_0x3823f4){return{'name':_0x3823f4[_0xd559('0x21')],'type':_0x3823f4[_0xd559('0x22')]['key']};});_0x27fb47[_0xd559('0x23')]=_[_0xd559('0x1e')](_0x73ef5b,'name');_0x27fb47[_0xd559('0x24')]=_[_0xd559('0x25')](_0x2678c5[_0xd559('0x24')]);_0x27fb47[_0xd559('0x26')]=_[_0xd559('0x27')](_0x27fb47[_0xd559('0x23')],_0x27fb47['query']);_0x5a7dfb[_0xd559('0x28')]=_[_0xd559('0x27')](_0x27fb47[_0xd559('0x23')],qs[_0xd559('0x29')](_0x2678c5[_0xd559('0x24')][_0xd559('0x29')]));_0x5a7dfb[_0xd559('0x28')]=_0x5a7dfb[_0xd559('0x28')][_0xd559('0x2a')]?_0x5a7dfb[_0xd559('0x28')]:_0x27fb47[_0xd559('0x23')];if(!_0x2678c5[_0xd559('0x24')][_0xd559('0x2b')](_0xd559('0x2c'))){_0x5a7dfb[_0xd559('0x15')]=qs['limit'](_0x2678c5['query'][_0xd559('0x15')]);_0x5a7dfb[_0xd559('0x14')]=qs[_0xd559('0x14')](_0x2678c5[_0xd559('0x24')][_0xd559('0x14')]);}_0x5a7dfb[_0xd559('0x2d')]=qs['sort'](_0x2678c5[_0xd559('0x24')]['sort']);_0x5a7dfb['where']=qs[_0xd559('0x26')](_[_0xd559('0x2e')](_0x2678c5['query'],_0x27fb47[_0xd559('0x26')]),_0x73ef5b);if(_0x2678c5['query'][_0xd559('0x2f')]){_0x5a7dfb[_0xd559('0x30')]=_[_0xd559('0x31')](_0x5a7dfb['where'],{'$or':_[_0xd559('0x1e')](_0x73ef5b,function(_0x5a77f1){if(_0x5a77f1[_0xd559('0x22')]!==_0xd559('0x32')){var _0x43a050={};_0x43a050[_0x5a77f1[_0xd559('0x1c')]]={'$like':'%'+_0x2678c5[_0xd559('0x24')][_0xd559('0x2f')]+'%'};return _0x43a050;}})});}_0x5a7dfb=_[_0xd559('0x31')]({},_0x5a7dfb,_0x2678c5[_0xd559('0x33')]);var _0x447ef4={'where':_0x5a7dfb[_0xd559('0x30')]};return db[_0xd559('0x1f')][_0xd559('0x13')](_0x447ef4)[_0xd559('0x18')](function(_0x132648){_0x587528[_0xd559('0x13')]=_0x132648;if(_0x2678c5[_0xd559('0x24')][_0xd559('0x34')]){_0x5a7dfb['include']=[{'all':!![]}];}return db[_0xd559('0x1f')][_0xd559('0x35')](_0x5a7dfb);})[_0xd559('0x18')](function(_0x53d1b2){_0x587528[_0xd559('0x36')]=_0x53d1b2;return _0x587528;})[_0xd559('0x18')](respondWithFilteredResult(_0x4755bd,_0x5a7dfb))['catch'](handleError(_0x4755bd,null));};exports[_0xd559('0x37')]=function(_0x3568d6,_0x546a16){var _0x2475bc={'raw':!![],'where':{'id':_0x3568d6['params']['id']}},_0x48fd43={};_0x48fd43['model']=_['keys'](db[_0xd559('0x1f')][_0xd559('0x20')]);_0x48fd43[_0xd559('0x24')]=_[_0xd559('0x25')](_0x3568d6['query']);_0x48fd43['filters']=_[_0xd559('0x27')](_0x48fd43[_0xd559('0x23')],_0x48fd43[_0xd559('0x24')]);_0x2475bc[_0xd559('0x28')]=_[_0xd559('0x27')](_0x48fd43[_0xd559('0x23')],qs[_0xd559('0x29')](_0x3568d6['query'][_0xd559('0x29')]));_0x2475bc['attributes']=_0x2475bc[_0xd559('0x28')][_0xd559('0x2a')]?_0x2475bc[_0xd559('0x28')]:_0x48fd43['model'];if(_0x3568d6[_0xd559('0x24')]['includeAll']){_0x2475bc[_0xd559('0x38')]=[{'all':!![]}];}_0x2475bc=_[_0xd559('0x31')]({},_0x2475bc,_0x3568d6[_0xd559('0x33')]);return db[_0xd559('0x1f')][_0xd559('0x39')](_0x2475bc)['then'](handleEntityNotFound(_0x546a16,null))[_0xd559('0x18')](respondWithResult(_0x546a16,null))[_0xd559('0x3a')](handleError(_0x546a16,null));};exports[_0xd559('0x3b')]=function(_0x1cca09,_0x57fbc6){return db['WhatsappApplication']['create'](_0x1cca09[_0xd559('0x3c')],{})[_0xd559('0x18')](respondWithResult(_0x57fbc6,0xc9))['catch'](handleError(_0x57fbc6,null));};exports['update']=function(_0x308c5c,_0x34242d){if(_0x308c5c[_0xd559('0x3c')]['id']){delete _0x308c5c[_0xd559('0x3c')]['id'];}return db[_0xd559('0x1f')][_0xd559('0x39')]({'where':{'id':_0x308c5c['params']['id']}})['then'](handleEntityNotFound(_0x34242d,null))[_0xd559('0x18')](saveUpdates(_0x308c5c[_0xd559('0x3c')],null))['then'](respondWithResult(_0x34242d,null))[_0xd559('0x3a')](handleError(_0x34242d,null));};exports['destroy']=function(_0x7723c7,_0x1505d3){return db[_0xd559('0x1f')][_0xd559('0x39')]({'where':{'id':_0x7723c7[_0xd559('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1505d3,null))[_0xd559('0x18')](removeEntity(_0x1505d3,null))[_0xd559('0x3a')](handleError(_0x1505d3,null));}; \ No newline at end of file +var _0xd22d=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','merge','create','update','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type'];(function(_0x3f408c,_0x3a6723){var _0x141fd5=function(_0x5ba674){while(--_0x5ba674){_0x3f408c['push'](_0x3f408c['shift']());}};_0x141fd5(++_0x3a6723);}(_0xd22d,0xb2));var _0xdd22=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xd22d[_0x24fa1a];return _0xc5621f;};'use strict';var pdf=require(_0xdd22('0x0'));var emlformat=require(_0xdd22('0x1'));var rimraf=require(_0xdd22('0x2'));var zipdir=require(_0xdd22('0x3'));var jsonpatch=require(_0xdd22('0x4'));var rp=require(_0xdd22('0x5'));var moment=require(_0xdd22('0x6'));var BPromise=require(_0xdd22('0x7'));var Mustache=require(_0xdd22('0x8'));var util=require(_0xdd22('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xdd22('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd22('0xb'));var squel=require(_0xdd22('0xc'));var crypto=require(_0xdd22('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdd22('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd22('0xf'));var authService=require(_0xdd22('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd22('0x11'))(_0xdd22('0x12'));var utils=require('../../config/utils');var config=require(_0xdd22('0x13'));var licenseUtil=require(_0xdd22('0x14'));var db=require(_0xdd22('0x15'))['db'];function respondWithStatusCode(_0x1d9c53,_0x1db482){_0x1db482=_0x1db482||0xcc;return function(_0x54f8fd){if(_0x54f8fd){return _0x1d9c53['sendStatus'](_0x1db482);}return _0x1d9c53['status'](_0x1db482)[_0xdd22('0x16')]();};}function respondWithResult(_0x5db761,_0x57c235){_0x57c235=_0x57c235||0xc8;return function(_0x1bda75){if(_0x1bda75){return _0x5db761[_0xdd22('0x17')](_0x57c235)['json'](_0x1bda75);}};}function respondWithFilteredResult(_0x96540e,_0x220634){return function(_0x58610e){if(_0x58610e){var _0x1344d0=_0x58610e['count'],_0x460c67=_0x220634[_0xdd22('0x18')],_0x24f399=_0x220634[_0xdd22('0x18')]+_0x220634[_0xdd22('0x19')],_0x58cac1;if(_0x24f399>=_0x1344d0){_0x24f399=_0x1344d0;_0x58cac1=0xc8;}else{_0x58cac1=0xce;}_0x96540e[_0xdd22('0x17')](_0x58cac1);return _0x96540e[_0xdd22('0x1a')](_0xdd22('0x1b'),_0x460c67+'-'+_0x24f399+'/'+_0x1344d0)[_0xdd22('0x1c')](_0x58610e);}return null;};}function patchUpdates(_0x5658ee){return function(_0x577834){try{jsonpatch[_0xdd22('0x1d')](_0x577834,_0x5658ee,!![]);}catch(_0x82d810){return BPromise[_0xdd22('0x1e')](_0x82d810);}return _0x577834[_0xdd22('0x1f')]();};}function saveUpdates(_0x10278d,_0x35126d){return function(_0x5da791){if(_0x5da791){return _0x5da791['update'](_0x10278d)[_0xdd22('0x20')](function(_0x2f5d56){return _0x2f5d56;});}return null;};}function removeEntity(_0x50c03d,_0x263a16){return function(_0x4671a8){if(_0x4671a8){return _0x4671a8[_0xdd22('0x21')]()[_0xdd22('0x20')](function(){_0x50c03d[_0xdd22('0x17')](0xcc)[_0xdd22('0x16')]();});}};}function handleEntityNotFound(_0x37aa36,_0x18abde){return function(_0x5cf407){if(!_0x5cf407){_0x37aa36[_0xdd22('0x22')](0x194);}return _0x5cf407;};}function handleError(_0x10b9b5,_0xb90b1d){_0xb90b1d=_0xb90b1d||0x1f4;return function(_0x542e8c){logger['error'](_0x542e8c[_0xdd22('0x23')]);if(_0x542e8c[_0xdd22('0x24')]){delete _0x542e8c[_0xdd22('0x24')];}_0x10b9b5[_0xdd22('0x17')](_0xb90b1d)[_0xdd22('0x25')](_0x542e8c);};}exports[_0xdd22('0x26')]=function(_0x1f69e2,_0x50fe0d){var _0x1c966d={},_0x370652={},_0x4f14b0={'count':0x0,'rows':[]};var _0x28d572=_[_0xdd22('0x27')](db[_0xdd22('0x28')][_0xdd22('0x29')],function(_0x1b0f8b){return{'name':_0x1b0f8b[_0xdd22('0x2a')],'type':_0x1b0f8b[_0xdd22('0x2b')][_0xdd22('0x2c')]};});_0x370652[_0xdd22('0x2d')]=_[_0xdd22('0x27')](_0x28d572,_0xdd22('0x24'));_0x370652['query']=_[_0xdd22('0x2e')](_0x1f69e2[_0xdd22('0x2f')]);_0x370652[_0xdd22('0x30')]=_[_0xdd22('0x31')](_0x370652[_0xdd22('0x2d')],_0x370652['query']);_0x1c966d[_0xdd22('0x32')]=_[_0xdd22('0x31')](_0x370652['model'],qs[_0xdd22('0x33')](_0x1f69e2['query'][_0xdd22('0x33')]));_0x1c966d[_0xdd22('0x32')]=_0x1c966d[_0xdd22('0x32')][_0xdd22('0x34')]?_0x1c966d[_0xdd22('0x32')]:_0x370652[_0xdd22('0x2d')];if(!_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x35')]('nolimit')){_0x1c966d[_0xdd22('0x19')]=qs[_0xdd22('0x19')](_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x19')]);_0x1c966d[_0xdd22('0x18')]=qs['offset'](_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x18')]);}_0x1c966d[_0xdd22('0x36')]=qs['sort'](_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x37')]);_0x1c966d[_0xdd22('0x38')]=qs[_0xdd22('0x30')](_[_0xdd22('0x39')](_0x1f69e2[_0xdd22('0x2f')],_0x370652[_0xdd22('0x30')]),_0x28d572);if(_0x1f69e2[_0xdd22('0x2f')]['filter']){_0x1c966d['where']=_['merge'](_0x1c966d[_0xdd22('0x38')],{'$or':_['map'](_0x28d572,function(_0x5c5327){if(_0x5c5327[_0xdd22('0x2b')]!==_0xdd22('0x3a')){var _0x42700a={};_0x42700a[_0x5c5327[_0xdd22('0x24')]]={'$like':'%'+_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x3b')]+'%'};return _0x42700a;}})});}_0x1c966d=_['merge']({},_0x1c966d,_0x1f69e2[_0xdd22('0x3c')]);var _0x3440c5={'where':_0x1c966d[_0xdd22('0x38')]};return db['WhatsappApplication'][_0xdd22('0x3d')](_0x3440c5)[_0xdd22('0x20')](function(_0x12dc6b){_0x4f14b0[_0xdd22('0x3d')]=_0x12dc6b;if(_0x1f69e2[_0xdd22('0x2f')][_0xdd22('0x3e')]){_0x1c966d[_0xdd22('0x3f')]=[{'all':!![]}];}return db[_0xdd22('0x28')][_0xdd22('0x40')](_0x1c966d);})['then'](function(_0x503914){_0x4f14b0[_0xdd22('0x41')]=_0x503914;return _0x4f14b0;})[_0xdd22('0x20')](respondWithFilteredResult(_0x50fe0d,_0x1c966d))[_0xdd22('0x42')](handleError(_0x50fe0d,null));};exports[_0xdd22('0x43')]=function(_0x1e3ff2,_0x3a5cd6){var _0x3ec0f1={'raw':!![],'where':{'id':_0x1e3ff2[_0xdd22('0x44')]['id']}},_0x1f3a0b={};_0x1f3a0b['model']=_[_0xdd22('0x2e')](db['WhatsappApplication'][_0xdd22('0x29')]);_0x1f3a0b['query']=_[_0xdd22('0x2e')](_0x1e3ff2[_0xdd22('0x2f')]);_0x1f3a0b[_0xdd22('0x30')]=_[_0xdd22('0x31')](_0x1f3a0b[_0xdd22('0x2d')],_0x1f3a0b['query']);_0x3ec0f1['attributes']=_['intersection'](_0x1f3a0b[_0xdd22('0x2d')],qs[_0xdd22('0x33')](_0x1e3ff2[_0xdd22('0x2f')][_0xdd22('0x33')]));_0x3ec0f1[_0xdd22('0x32')]=_0x3ec0f1[_0xdd22('0x32')][_0xdd22('0x34')]?_0x3ec0f1['attributes']:_0x1f3a0b[_0xdd22('0x2d')];if(_0x1e3ff2[_0xdd22('0x2f')]['includeAll']){_0x3ec0f1['include']=[{'all':!![]}];}_0x3ec0f1=_[_0xdd22('0x45')]({},_0x3ec0f1,_0x1e3ff2[_0xdd22('0x3c')]);return db[_0xdd22('0x28')]['find'](_0x3ec0f1)[_0xdd22('0x20')](handleEntityNotFound(_0x3a5cd6,null))['then'](respondWithResult(_0x3a5cd6,null))[_0xdd22('0x42')](handleError(_0x3a5cd6,null));};exports[_0xdd22('0x46')]=function(_0x2fa2c0,_0x37e92e){return db[_0xdd22('0x28')][_0xdd22('0x46')](_0x2fa2c0['body'],{})[_0xdd22('0x20')](respondWithResult(_0x37e92e,0xc9))['catch'](handleError(_0x37e92e,null));};exports[_0xdd22('0x47')]=function(_0x2ab438,_0x3bf82e){if(_0x2ab438[_0xdd22('0x48')]['id']){delete _0x2ab438['body']['id'];}return db[_0xdd22('0x28')][_0xdd22('0x49')]({'where':{'id':_0x2ab438[_0xdd22('0x44')]['id']}})[_0xdd22('0x20')](handleEntityNotFound(_0x3bf82e,null))['then'](saveUpdates(_0x2ab438[_0xdd22('0x48')],null))[_0xdd22('0x20')](respondWithResult(_0x3bf82e,null))[_0xdd22('0x42')](handleError(_0x3bf82e,null));};exports['destroy']=function(_0x393a88,_0x54e3d2){return db[_0xdd22('0x28')][_0xdd22('0x49')]({'where':{'id':_0x393a88['params']['id']}})[_0xdd22('0x20')](handleEntityNotFound(_0x54e3d2,null))[_0xdd22('0x20')](removeEntity(_0x54e3d2,null))[_0xdd22('0x42')](handleError(_0x54e3d2,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index c760eef..2b26b31 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 _0x104d=['define','WhatsappApplication','whatsapp_applications','utf8mb4','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x33eb67,_0x4cb881){var _0x26c9ac=function(_0x33036d){while(--_0x33036d){_0x33eb67['push'](_0x33eb67['shift']());}};_0x26c9ac(++_0x4cb881);}(_0x104d,0x16c));var _0xd104=function(_0x27f39d,_0x5efee5){_0x27f39d=_0x27f39d-0x0;var _0x355e1e=_0x104d[_0x27f39d];return _0x355e1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd104('0x0'));var BPromise=require(_0xd104('0x1'));var rp=require(_0xd104('0x2'));var fs=require('fs');var path=require(_0xd104('0x3'));var rimraf=require(_0xd104('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xd104('0x5')]=function(_0x1338df,_0x4c5b1e){return _0x1338df[_0xd104('0x6')](_0xd104('0x7'),attributes,{'tableName':_0xd104('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd104('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x131c=['moment','bluebird','request-promise','path','exports','whatsapp_applications','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x131c,0x19c));var _0xc131=function(_0x2d5ea2,_0x1b319e){_0x2d5ea2=_0x2d5ea2-0x0;var _0x3e2ecb=_0x131c[_0x2d5ea2];return _0x3e2ecb;};'use strict';var _=require(_0xc131('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc131('0x1'));var BPromise=require(_0xc131('0x2'));var rp=require(_0xc131('0x3'));var fs=require('fs');var path=require(_0xc131('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xc131('0x5')]=function(_0x405c79,_0x275b4e){return _0x405c79['define']('WhatsappApplication',attributes,{'tableName':_0xc131('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index edc0c82..fa48246 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 _0x90ec=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x28a4b5,_0x5468a0){var _0x141f28=function(_0x192d38){while(--_0x192d38){_0x28a4b5['push'](_0x28a4b5['shift']());}};_0x141f28(++_0x5468a0);}(_0x90ec,0x1d4));var _0xc90e=function(_0x5b560a,_0x50f60d){_0x5b560a=_0x5b560a-0x0;var _0x3b9858=_0x90ec[_0x5b560a];return _0x3b9858;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var moment=require('moment');var BPromise=require(_0xc90e('0x2'));var rs=require(_0xc90e('0x3'));var fs=require('fs');var Redis=require(_0xc90e('0x4'));var db=require(_0xc90e('0x5'))['db'];var utils=require(_0xc90e('0x6'));var logger=require('../../config/logger')(_0xc90e('0x7'));var config=require(_0xc90e('0x8'));var jayson=require(_0xc90e('0x9'));var client=jayson['client'][_0xc90e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48bea9,_0x42051a,_0x14311a){return new BPromise(function(_0x48253c,_0x3bc98f){return client[_0xc90e('0xb')](_0x48bea9,_0x14311a)[_0xc90e('0xc')](function(_0x1a02ad){logger[_0xc90e('0xd')](_0xc90e('0xe'),_0x42051a,_0xc90e('0xf'));logger[_0xc90e('0x10')](_0xc90e('0x11'),_0x42051a,'request\x20sent',JSON[_0xc90e('0x12')](_0x1a02ad));if(_0x1a02ad['error']){if(_0x1a02ad['error']['code']===0x1f4){logger['error'](_0xc90e('0xe'),_0x42051a,_0x1a02ad[_0xc90e('0x13')]['message']);return _0x3bc98f(_0x1a02ad[_0xc90e('0x13')][_0xc90e('0x14')]);}logger['error'](_0xc90e('0xe'),_0x42051a,_0x1a02ad[_0xc90e('0x13')][_0xc90e('0x14')]);return _0x48253c(_0x1a02ad[_0xc90e('0x13')][_0xc90e('0x14')]);}else{logger[_0xc90e('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x42051a,_0xc90e('0xf'));_0x48253c(_0x1a02ad[_0xc90e('0x15')]['message']);}})[_0xc90e('0x16')](function(_0x48eac8){logger[_0xc90e('0x13')](_0xc90e('0xe'),_0x42051a,_0x48eac8);_0x3bc98f(_0x48eac8);});});} \ No newline at end of file +var _0xfc65=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x135096,_0x186606){var _0x3b91f0=function(_0x59cc84){while(--_0x59cc84){_0x135096['push'](_0x135096['shift']());}};_0x3b91f0(++_0x186606);}(_0xfc65,0x1e1));var _0x5fc6=function(_0xecac70,_0x5f13a4){_0xecac70=_0xecac70-0x0;var _0x967ee5=_0xfc65[_0xecac70];return _0x967ee5;};'use strict';var _=require(_0x5fc6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5fc6('0x1'));var rs=require(_0x5fc6('0x2'));var fs=require('fs');var Redis=require(_0x5fc6('0x3'));var db=require(_0x5fc6('0x4'))['db'];var utils=require(_0x5fc6('0x5'));var logger=require(_0x5fc6('0x6'))(_0x5fc6('0x7'));var config=require(_0x5fc6('0x8'));var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409c5f,_0x1a9600,_0x572941){return new BPromise(function(_0x3921c5,_0x1f1409){return client[_0x5fc6('0xc')](_0x409c5f,_0x572941)[_0x5fc6('0xd')](function(_0x16c285){logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1a9600,_0x5fc6('0x10'));logger[_0x5fc6('0x11')](_0x5fc6('0x12'),_0x1a9600,'request\x20sent',JSON[_0x5fc6('0x13')](_0x16c285));if(_0x16c285['error']){if(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x15')]===0x1f4){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285['error'][_0x5fc6('0x16')]);return _0x1f1409(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);return _0x3921c5(_0x16c285[_0x5fc6('0x14')][_0x5fc6('0x16')]);}else{logger[_0x5fc6('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1a9600,'request\x20sent');_0x3921c5(_0x16c285[_0x5fc6('0x17')][_0x5fc6('0x16')]);}})['catch'](function(_0x26d2ba){logger[_0x5fc6('0x14')](_0x5fc6('0xf'),_0x1a9600,_0x26d2ba);_0x1f1409(_0x26d2ba);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c54c129..5a23599 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 _0x1eac=['../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','index','/describe','describe','isAuthenticated','show','getMessages','download','post','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','util','express','Router'];(function(_0x5844c3,_0x13fc8c){var _0x3a4d56=function(_0x24328e){while(--_0x24328e){_0x5844c3['push'](_0x5844c3['shift']());}};_0x3a4d56(++_0x13fc8c);}(_0x1eac,0x1b0));var _0xc1ea=function(_0xfdd58,_0x5e560f){_0xfdd58=_0xfdd58-0x0;var _0x390209=_0x1eac[_0xfdd58];return _0x390209;};'use strict';var multer=require('multer');var util=require(_0xc1ea('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc1ea('0x1'));var router=express[_0xc1ea('0x2')]();var auth=require(_0xc1ea('0x3'));var interaction=require(_0xc1ea('0x4'));var config=require('../../config/environment');var controller=require(_0xc1ea('0x5'));router[_0xc1ea('0x6')]('/',auth['isAuthenticated'](),controller[_0xc1ea('0x7')]);router[_0xc1ea('0x6')](_0xc1ea('0x8'),auth['isAuthenticated'](),controller[_0xc1ea('0x9')]);router[_0xc1ea('0x6')]('/:id',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xb')]);router['get']('/:id/messages',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xc')]);router[_0xc1ea('0x6')]('/:id/download',auth[_0xc1ea('0xa')](),controller[_0xc1ea('0xd')]);router[_0xc1ea('0xe')]('/',auth[_0xc1ea('0xa')](),controller['create']);router[_0xc1ea('0xe')](_0xc1ea('0xf'),auth['isAuthenticated'](),controller[_0xc1ea('0x10')]);router[_0xc1ea('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xc1ea('0x11')](_0xc1ea('0x12'),_0xc1ea('0x13')),controller[_0xc1ea('0x14')]);router['put'](_0xc1ea('0x15'),auth[_0xc1ea('0xa')](),interaction['tracked'](_0xc1ea('0x12'),_0xc1ea('0x16')),controller[_0xc1ea('0x17')]);router[_0xc1ea('0x18')]('/:id',auth[_0xc1ea('0xa')](),interaction[_0xc1ea('0x11')](_0xc1ea('0x12'),'whatsappinteraction:destroy'),controller[_0xc1ea('0x19')]);router[_0xc1ea('0x18')](_0xc1ea('0x1a'),auth['isAuthenticated'](),controller[_0xc1ea('0x1b')]);module[_0xc1ea('0x1c')]=router; \ No newline at end of file +var _0x9734=['/:id/messages','getMessages','post','create','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','whatsappinteraction:destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x29c98c,_0x4780bb){var _0x1da0ef=function(_0x3c270f){while(--_0x3c270f){_0x29c98c['push'](_0x29c98c['shift']());}};_0x1da0ef(++_0x4780bb);}(_0x9734,0x144));var _0x4973=function(_0x3d3842,_0x3965d6){_0x3d3842=_0x3d3842-0x0;var _0x580931=_0x9734[_0x3d3842];return _0x580931;};'use strict';var multer=require(_0x4973('0x0'));var util=require(_0x4973('0x1'));var path=require(_0x4973('0x2'));var timeout=require(_0x4973('0x3'));var express=require(_0x4973('0x4'));var router=express[_0x4973('0x5')]();var auth=require(_0x4973('0x6'));var interaction=require(_0x4973('0x7'));var config=require(_0x4973('0x8'));var controller=require(_0x4973('0x9'));router[_0x4973('0xa')]('/',auth[_0x4973('0xb')](),controller[_0x4973('0xc')]);router[_0x4973('0xa')](_0x4973('0xd'),auth[_0x4973('0xb')](),controller[_0x4973('0xe')]);router[_0x4973('0xa')](_0x4973('0xf'),auth[_0x4973('0xb')](),controller[_0x4973('0x10')]);router[_0x4973('0xa')](_0x4973('0x11'),auth['isAuthenticated'](),controller[_0x4973('0x12')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x4973('0x13')]('/',auth[_0x4973('0xb')](),controller[_0x4973('0x14')]);router[_0x4973('0x13')](_0x4973('0x11'),auth[_0x4973('0xb')](),controller[_0x4973('0x15')]);router[_0x4973('0x13')]('/:id/tags',auth[_0x4973('0xb')](),interaction[_0x4973('0x16')]('whatsapp',_0x4973('0x17')),controller[_0x4973('0x18')]);router[_0x4973('0x19')](_0x4973('0xf'),auth['isAuthenticated'](),interaction[_0x4973('0x16')](_0x4973('0x1a'),_0x4973('0x1b')),controller['update']);router['delete'](_0x4973('0xf'),auth[_0x4973('0xb')](),interaction[_0x4973('0x16')]('whatsapp',_0x4973('0x1c')),controller['destroy']);router[_0x4973('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller[_0x4973('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index ee8cf1f..206ca3d 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 _0xd914=['BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xd914,0x17f));var _0x4d91=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xd914[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require(_0x4d91('0x0'));var moment=require(_0x4d91('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4d91('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d91('0x3')]},'disposition':{'type':Sequelize[_0x4d91('0x4')]},'secondDisposition':{'type':Sequelize[_0x4d91('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4d91('0x4')]},'note':{'type':Sequelize[_0x4d91('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4d91('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d91('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4d91('0x6')]('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3a61=['ENUM','out','BOOLEAN','DATE','STRING'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x3a61,0xd4));var _0x13a6=function(_0x258d81,_0x41ebde){_0x258d81=_0x258d81-0x0;var _0x7d0e3c=_0x3a61[_0x258d81];return _0x7d0e3c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x13a6('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x13a6('0x1')]},'disposition':{'type':Sequelize[_0x13a6('0x2')]},'secondDisposition':{'type':Sequelize[_0x13a6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x13a6('0x2')]},'note':{'type':Sequelize[_0x13a6('0x2')]},'phone':{'type':Sequelize[_0x13a6('0x2')]},'read1stAt':{'type':Sequelize[_0x13a6('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x13a6('0x3')]('in',_0x13a6('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x13a6('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x13a6('0x3')]('in',_0x13a6('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b6f6a5e..3c9194b 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 _0x9039=['json','reject','save','then','destroy','sendStatus','error','name','Users','map','Tags','split','push','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','WhatsappAccountId','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','includeAll','include','options','create','update','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','nolimit','YYYY-MM-DD\x20HH:mm:ss','merge','addTags','setTags','spread','Tag','findAll','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','firstName','lastName','Attachment','direction','secret','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','format','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','N.A.','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','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','redis','defaults','localhost','./whatsappInteraction.socket','register','status','end','count','offset','limit','Content-Range'];(function(_0x3f7372,_0x30ad27){var _0x43b414=function(_0x320f23){while(--_0x320f23){_0x3f7372['push'](_0x3f7372['shift']());}};_0x43b414(++_0x30ad27);}(_0x9039,0xd9));var _0x9903=function(_0x51f1a5,_0x4fecc4){_0x51f1a5=_0x51f1a5-0x0;var _0xdcf7f2=_0x9039[_0x51f1a5];return _0xdcf7f2;};'use strict';var pdf=require(_0x9903('0x0'));var emlformat=require(_0x9903('0x1'));var rimraf=require(_0x9903('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9903('0x3'));var rp=require(_0x9903('0x4'));var moment=require(_0x9903('0x5'));var BPromise=require(_0x9903('0x6'));var Mustache=require(_0x9903('0x7'));var util=require(_0x9903('0x8'));var path=require('path');var sox=require(_0x9903('0x9'));var csv=require('to-csv');var ejs=require(_0x9903('0xa'));var fs=require('fs');var _=require(_0x9903('0xb'));var squel=require(_0x9903('0xc'));var crypto=require('crypto');var jsforce=require(_0x9903('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9903('0xe'));var querystring=require(_0x9903('0xf'));var Papa=require('papaparse');var Redis=require(_0x9903('0x10'));var authService=require(_0x9903('0x11'));var qs=require(_0x9903('0x12'));var as=require(_0x9903('0x13'));var hardwareService=require(_0x9903('0x14'));var logger=require(_0x9903('0x15'))(_0x9903('0x16'));var utils=require(_0x9903('0x17'));var config=require(_0x9903('0x18'));var licenseUtil=require(_0x9903('0x19'));var db=require('../../mysqldb')['db'];config[_0x9903('0x1a')]=_[_0x9903('0x1b')](config[_0x9903('0x1a')],{'host':_0x9903('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9903('0x1d'))[_0x9903('0x1e')](socket);function respondWithStatusCode(_0x5ac59a,_0x1d55a4){_0x1d55a4=_0x1d55a4||0xcc;return function(_0x3fa23b){if(_0x3fa23b){return _0x5ac59a['sendStatus'](_0x1d55a4);}return _0x5ac59a[_0x9903('0x1f')](_0x1d55a4)[_0x9903('0x20')]();};}function respondWithResult(_0x1d5d88,_0x339549){_0x339549=_0x339549||0xc8;return function(_0x16770e){if(_0x16770e){return _0x1d5d88[_0x9903('0x1f')](_0x339549)['json'](_0x16770e);}};}function respondWithFilteredResult(_0x1b3e7a,_0x54a4e9){return function(_0x439d6f){if(_0x439d6f){var _0x59b059=_0x439d6f[_0x9903('0x21')],_0x1941f1=_0x54a4e9['offset'],_0x4ee1e2=_0x54a4e9[_0x9903('0x22')]+_0x54a4e9[_0x9903('0x23')],_0x165d5a;if(_0x4ee1e2>=_0x59b059){_0x4ee1e2=_0x59b059;_0x165d5a=0xc8;}else{_0x165d5a=0xce;}_0x1b3e7a[_0x9903('0x1f')](_0x165d5a);return _0x1b3e7a['set'](_0x9903('0x24'),_0x1941f1+'-'+_0x4ee1e2+'/'+_0x59b059)[_0x9903('0x25')](_0x439d6f);}return null;};}function patchUpdates(_0x4251c8){return function(_0x5a5afe){try{jsonpatch['apply'](_0x5a5afe,_0x4251c8,!![]);}catch(_0x327ac0){return BPromise[_0x9903('0x26')](_0x327ac0);}return _0x5a5afe[_0x9903('0x27')]();};}function saveUpdates(_0x51ea52,_0x271540){return function(_0x394cd5){if(_0x394cd5){return _0x394cd5['update'](_0x51ea52)[_0x9903('0x28')](function(_0x3ba497){return _0x3ba497;});}return null;};}function removeEntity(_0x2a5b42,_0x9f9ac8){return function(_0x5202bd){if(_0x5202bd){return _0x5202bd[_0x9903('0x29')]()[_0x9903('0x28')](function(){_0x2a5b42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7e3bc,_0x5cc4b7){return function(_0x17bbeb){if(!_0x17bbeb){_0xb7e3bc[_0x9903('0x2a')](0x194);}return _0x17bbeb;};}function handleError(_0x3f8fc4,_0x1ce14c){_0x1ce14c=_0x1ce14c||0x1f4;return function(_0x2bad1f){logger[_0x9903('0x2b')](_0x2bad1f['stack']);if(_0x2bad1f[_0x9903('0x2c')]){delete _0x2bad1f[_0x9903('0x2c')];}_0x3f8fc4[_0x9903('0x1f')](_0x1ce14c)['send'](_0x2bad1f);};}function getInteractionUsers(_0xbff479,_0x402944){return new BPromise(function(_0x7ce575,_0x5c7786){try{if(_0x402944[_0xbff479['id']]){_0xbff479[_0x9903('0x2d')]=_[_0x9903('0x2e')](_0x402944[_0xbff479['id']],function(_0x280112){return{'id':_0x280112['id'],'fullname':_0x280112['fullname']};});}}catch(_0x1c2e42){_0x5c7786(_0x1c2e42);}_0x7ce575(_0xbff479);});}function getInteractionTags(_0x1a5446,_0x597bbf){return new BPromise(function(_0x18d871,_0x3599b8){try{if(_0x1a5446['TagIds']){_0x1a5446[_0x9903('0x2f')]=[];_0x1a5446['TagIds'][_0x9903('0x30')](',')['forEach'](function(_0x2f46f4){_0x1a5446[_0x9903('0x2f')][_0x9903('0x31')](_0x597bbf[_0x2f46f4]);});}delete _0x1a5446['TagIds'];}catch(_0x4fcfe6){_0x3599b8(_0x4fcfe6);}_0x18d871(_0x1a5446);});}function updateWhatsappInteraction(_0x4ed0bd,_0x3187ad,_0x4fa2bc){return new BPromise(function(_0x4bc3a9,_0x2e9a4){return getInteractionUsers(_0x4ed0bd,_0x4fa2bc)[_0x9903('0x28')](function(_0x247e93){return getInteractionTags(_0x247e93,_0x3187ad);})[_0x9903('0x28')](function(_0x1b1800){_0x4bc3a9(_0x1b1800);})['catch'](function(_0x43045e){_0x2e9a4(_0x43045e);});});}exports[_0x9903('0x32')]=function(_0x576ec4,_0x117e82){var _0x2d89c0={},_0x3fd2a5={},_0xc93dae={'count':0x0,'rows':[]};var _0x5c60d0=_[_0x9903('0x2e')](db[_0x9903('0x33')][_0x9903('0x34')],function(_0x44d81b){return{'name':_0x44d81b[_0x9903('0x35')],'type':_0x44d81b[_0x9903('0x36')][_0x9903('0x37')]};});_0x3fd2a5[_0x9903('0x38')]=_[_0x9903('0x2e')](_0x5c60d0,_0x9903('0x2c'));_0x3fd2a5[_0x9903('0x39')]=_[_0x9903('0x3a')](_0x576ec4[_0x9903('0x39')]);_0x3fd2a5['filters']=_[_0x9903('0x3b')](_0x3fd2a5[_0x9903('0x38')],_0x3fd2a5[_0x9903('0x39')]);_0x2d89c0[_0x9903('0x3c')]=_[_0x9903('0x3b')](_0x3fd2a5[_0x9903('0x38')],qs[_0x9903('0x3d')](_0x576ec4['query']['fields']));_0x2d89c0['attributes']=_0x2d89c0['attributes'][_0x9903('0x3e')]?_0x2d89c0[_0x9903('0x3c')]:_0x3fd2a5[_0x9903('0x38')];if(!_0x576ec4[_0x9903('0x39')]['hasOwnProperty']('nolimit')){_0x2d89c0[_0x9903('0x23')]=qs[_0x9903('0x23')](_0x576ec4['query'][_0x9903('0x23')]);_0x2d89c0[_0x9903('0x22')]=qs[_0x9903('0x22')](_0x576ec4[_0x9903('0x39')][_0x9903('0x22')]);}_0x2d89c0['order']=qs[_0x9903('0x3f')](_0x576ec4[_0x9903('0x39')][_0x9903('0x3f')]);_0x2d89c0[_0x9903('0x40')]=qs[_0x9903('0x41')](_[_0x9903('0x42')](_0x576ec4['query'],_0x3fd2a5[_0x9903('0x41')]),_0x5c60d0);var _0x201c14=[];var _0x365586=squel[_0x9903('0x43')]()[_0x9903('0x44')]('id')[_0x9903('0x44')](_0x9903('0x2c'))[_0x9903('0x44')](_0x9903('0x45'))[_0x9903('0x46')](_0x9903('0x47'));var _0x3e27a5=squel['select']()[_0x9903('0x44')](_0x9903('0x48'))['field'](_0x9903('0x49'))[_0x9903('0x44')](_0x9903('0x4a'))[_0x9903('0x46')](_0x9903('0x4b'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0xa1edbc=squel['select']()[_0x9903('0x46')]('whatsapp_interactions','i')[_0x9903('0x4c')]('cm_contacts','c',_0x9903('0x4d'))[_0x9903('0x4c')](_0x9903('0x4e'),'o',_0x9903('0x4f'))[_0x9903('0x4c')](_0x9903('0x50'),'a',_0x9903('0x51'))['left_join'](_0x9903('0x52'),'me',_0x9903('0x53'))[_0x9903('0x4c')](_0x9903('0x54'),'it',_0x9903('0x55'))[_0x9903('0x4c')](_0x9903('0x47'),'t',_0x9903('0x56'));var _0x1e193b=squel['expr']();var _0x27fb93=[];var _0x4c856b=squel[_0x9903('0x57')]();var _0x439b8a;if(_0x576ec4[_0x9903('0x39')][_0x9903('0x58')]){_0x439b8a=as[_0x9903('0x59')](_0x576ec4[_0x9903('0x39')][_0x9903('0x58')]);var _0x279ffa=_0x439b8a[_0x9903('0x5a')];for(var _0x5d590e=0x0;_0x5d590e<_0x439b8a['conditions'][_0x9903('0x3e')];_0x5d590e++){var _0x1356bd=_0x439b8a[_0x9903('0x5b')][_0x5d590e];var _0x4cc79c='i';var _0x1c2f9d=_['find'](_0x5c60d0,[_0x9903('0x2c'),_0x1356bd[_0x9903('0x44')]]);if(!_0x1c2f9d){switch(_0x1356bd[_0x9903('0x44')]){case _0x9903('0x5c'):if(_0x1356bd[_0x9903('0x5d')]==0x1){_0xa1edbc['having']('`'+_0x1356bd[_0x9903('0x44')]+_0x9903('0x5e'));}else{_0xa1edbc[_0x9903('0x5f')]('`'+_0x1356bd[_0x9903('0x44')]+_0x9903('0x60'));}break;case _0x9903('0x61'):if(_0x1356bd[_0x9903('0x62')]===_0x9903('0x63')){if(_0x1356bd[_0x9903('0x5d')][_0x9903('0x30')]('\x20')[_0x9903('0x3e')]>0x1){_0x1e193b[_0x279ffa](_0x9903('0x64'),qs[_0x9903('0x65')](_0x1356bd['value']),null);}else{var _0x1a4821='%'+_0x1356bd[_0x9903('0x5d')]+'%';_0x1e193b[_0x279ffa](_0x9903('0x66'),_0x1a4821,_0x1a4821,_0x1a4821);}}else{_0x1c2f9d=_[_0x9903('0x67')](_0x5c60d0,['name',_0x9903('0x68')]);_0x1356bd['field']=_0x9903('0x68');_0x2ae443=as[_0x9903('0x69')](_0x4cc79c,_0x1c2f9d[_0x9903('0x36')],_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443[_0x9903('0x6a')],_0x2ae443['value'][_0x9903('0x6b')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);}break;case'Tag':var _0x219f3b=_0x1356bd['value'][_0x9903('0x30')](',')[_0x9903('0x2e')](function(_0x2677ef){return Number(_0x2677ef);});_0x219f3b[_0x9903('0x6c')](function(_0x5b510d){_0x4c856b['or'](_0x9903('0x6d'),'%,'+_0x5b510d+',%');});_0x27fb93=_[_0x9903('0x6e')](_0x27fb93,_0x219f3b);break;case'User':if(_0x1356bd[_0x9903('0x62')]===_0x9903('0x63')){_0x1e193b[_0x279ffa](_0x9903('0x6f'),'%'+_0x1356bd[_0x9903('0x5d')]+'%',null);}else{_0x1c2f9d=_['find'](_0x5c60d0,['name',_0x9903('0x70')]);_0x1356bd[_0x9903('0x44')]='UserId';_0x2ae443=as['buildExpression'](_0x4cc79c,_0x1c2f9d[_0x9903('0x36')],_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443['text'],_0x2ae443[_0x9903('0x5d')][_0x9903('0x6b')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);}break;case _0x9903('0x71'):_0x2ae443=as[_0x9903('0x69')]('me',null,_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443[_0x9903('0x6a')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x6b')],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);break;}}else{var _0x2ae443=as[_0x9903('0x69')](_0x4cc79c,_0x1c2f9d[_0x9903('0x36')],_0x1356bd);_0x1e193b[_0x279ffa](_0x2ae443[_0x9903('0x6a')],_0x2ae443[_0x9903('0x5d')]['start'],_0x2ae443[_0x9903('0x5d')][_0x9903('0x20')]);}}}else{var _0x5b288a=_(_0x576ec4['query'])[_0x9903('0x3a')]()[_0x9903('0x2e')](function(_0x3c938b){return _[_0x9903('0x72')](_0x5c60d0,[_0x9903('0x2c'),_0x3c938b])?_0x3c938b:undefined;})[_0x9903('0x73')]()[_0x9903('0x5d')]();if(!_[_0x9903('0x74')](_0x5b288a)){_0x5b288a[_0x9903('0x6c')](function(_0x1ad22b){if(_0x1ad22b==='WhatsappAccountId'){_0xa1edbc[_0x9903('0x40')](_0x9903('0x75'),[][_0x9903('0x76')](_0x576ec4[_0x9903('0x39')][_0x1ad22b]));}else if(_0x1ad22b===_0x9903('0x77')){var _0x4c450d=JSON[_0x9903('0x78')](_0x576ec4[_0x9903('0x39')][_0x1ad22b])[_0x9903('0x79')];var _0x543135=JSON['parse'](_0x576ec4[_0x9903('0x39')][_0x1ad22b])[_0x9903('0x7a')];_0xa1edbc[_0x9903('0x40')](_0x9903('0x7b'),_0x4c450d,_0x543135);}else{if(_0x576ec4['query'][_0x1ad22b]===_0x9903('0x7c')){_0xa1edbc[_0x9903('0x40')]('i.'+_0x1ad22b+_0x9903('0x7d'));}else{_0xa1edbc[_0x9903('0x40')]('i.'+_0x1ad22b+_0x9903('0x7e'),_0x576ec4[_0x9903('0x39')][_0x1ad22b]);}}});}if(_0x576ec4['query'][_0x9903('0x7f')]){if(_0x576ec4[_0x9903('0x39')]['read']==0x1){_0xa1edbc['having'](_0x9903('0x80'));}else{_0xa1edbc[_0x9903('0x5f')](_0x9903('0x81'));}}if(_0x576ec4[_0x9903('0x39')][_0x9903('0x82')]){_0x27fb93=_[_0x9903('0x83')](_0x576ec4[_0x9903('0x39')]['tag'])?_0x576ec4[_0x9903('0x39')][_0x9903('0x82')]:new Array(_0x576ec4[_0x9903('0x39')][_0x9903('0x82')]);_0x27fb93['forEach'](function(_0x301456){_0x4c856b['or'](_0x9903('0x6d'),'%,'+_0x301456+',%');});}if(_0x576ec4[_0x9903('0x39')]['filter']){var _0x368400=_0x576ec4['query'][_0x9903('0x84')][_0x9903('0x85')]('\x5c','\x5c\x5c')[_0x9903('0x85')](/'/g,'\x27\x27');if(qs[_0x9903('0x86')](_0x368400)){_0x1e193b['or'](_0x9903('0x87'),_0x368400+'%')['or'](_0x9903('0x88'),_0x368400+'%');}else{_0x1e193b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x368400))['or'](_0x9903('0x89'),_0x368400+'%');}}}_0xa1edbc['where'](_0x1e193b);_0xa1edbc[_0x9903('0x8a')](_0x9903('0x8b'));var _0x10169a={'type':db['Sequelize'][_0x9903('0x8c')][_0x9903('0x8d')],'raw':!![]};var _0x5e5397=_0xa1edbc['clone']();_0x5e5397[_0x9903('0x44')](_0x9903('0x8b'));_0x5e5397[_0x9903('0x44')](_0x9903('0x8e'),_0x9903('0x5c'));if(_0x2d89c0[_0x9903('0x8f')]){_0x2d89c0['order'][_0x9903('0x6c')](function(_0x28aeb8){var _0x17eab6=_0x28aeb8[0x0]===_0x9903('0x90')?_0x28aeb8[0x0]:'i.'+_0x28aeb8[0x0];_0xa1edbc[_0x9903('0x8f')](_0x17eab6,_0x28aeb8[0x1]===_0x9903('0x91')?![]:!![]);});}if(!_[_0x9903('0x74')](_0x27fb93)){_0xa1edbc['having'](_0x4c856b);_0x5e5397[_0x9903('0x40')]('t.id\x20IN\x20?',_0x27fb93);}BPromise['resolve']()['then'](function(){if(!_0x439b8a){if(_0x576ec4['query'][_0x9903('0x92')]||_0x576ec4[_0x9903('0x39')][_0x9903('0x93')])return;_0x5e5397[_0x9903('0x40')](_0x9903('0x94'));_0xa1edbc[_0x9903('0x40')](_0x9903('0x94'));return;}if(_0x576ec4[_0x9903('0x95')]['role']!==_0x9903('0x96'))return;return _0x576ec4['user'][_0x9903('0x97')]({'attributes':['id'],'raw':!![]})[_0x9903('0x28')](function(_0x440d0e){if(_[_0x9903('0x74')](_0x440d0e)){_0x5e5397[_0x9903('0x40')](_0x9903('0x98'));_0xa1edbc[_0x9903('0x40')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x5e5397[_0x9903('0x40')](_0x9903('0x75'),_[_0x9903('0x2e')](_0x440d0e,'id'));_0xa1edbc[_0x9903('0x40')]('i.WhatsappAccountId\x20IN\x20?',_[_0x9903('0x2e')](_0x440d0e,'id'));}});})[_0x9903('0x28')](function(){if(_0x576ec4[_0x9903('0x95')]['role']===_0x9903('0x96')&&!_0x439b8a&&!_0x576ec4['query'][_0x9903('0x92')])return[];return db[_0x9903('0x99')][_0x9903('0x39')](_0x5e5397[_0x9903('0x9a')](),_0x10169a);})[_0x9903('0x28')](function(_0xd61314){_0xc93dae[_0x9903('0x21')]=_0xd61314['length'];if(_0xc93dae['count']===0x0)return[];return db['sequelize'][_0x9903('0x39')](_0x365586[_0x9903('0x9a')](),_0x10169a)[_0x9903('0x28')](function(_0x14e21a){_0x201c14=_[_0x9903('0x9b')](_0x14e21a,'id');_0x10169a=_['merge'](_0x10169a,{'model':db[_0x9903('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x576ec4[_0x9903('0x39')][_0x9903('0x3d')]){_0x2d89c0['attributes'][_0x9903('0x6c')](function(_0x3d453a){_0xa1edbc['field']('i.'+_0x3d453a);});}else{_0xa1edbc[_0x9903('0x44')](_0x9903('0x8e'),'unreadMessages');_0xa1edbc[_0x9903('0x44')](_0x9903('0x9c'),'Account.key');_0xa1edbc[_0x9903('0x44')](_0x9903('0x9d'),_0x9903('0x9e'));_0xa1edbc[_0x9903('0x44')](_0x9903('0x9f'),'contactName');_0xa1edbc[_0x9903('0x44')](_0x9903('0xa0'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa1'),_0x9903('0xa2'));_0xa1edbc[_0x9903('0x44')]('c.lastName',_0x9903('0xa3'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa4'),_0x9903('0xa5'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa6'),_0x9903('0xa7'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xa8'),_0x9903('0xa9'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xaa'),'Contact.fax');_0xa1edbc[_0x9903('0x44')](_0x9903('0xab'),_0x9903('0xac'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xad'),_0x9903('0xae'));_0xa1edbc[_0x9903('0x44')](_0x9903('0xaf'),_0x9903('0xb0'));}if(_0x2d89c0['limit'])_0xa1edbc[_0x9903('0x23')](_0x2d89c0[_0x9903('0x23')]);if(_0x2d89c0['offset'])_0xa1edbc[_0x9903('0x22')](_0x2d89c0[_0x9903('0x22')]);return db[_0x9903('0x99')][_0x9903('0x39')](_0xa1edbc[_0x9903('0x9a')](),_0x10169a);})[_0x9903('0x28')](function(_0x417239){_0x3e27a5[_0x9903('0x40')](_0x9903('0xb1'),_[_0x9903('0x2e')](_0x417239,'id'));return db[_0x9903('0x99')][_0x9903('0x39')](_0x3e27a5[_0x9903('0x9a')](),_0x10169a)[_0x9903('0x28')](function(_0x383849){var _0x50dee6=_[_0x9903('0xb2')](_0x383849,_0x9903('0xb3'));var _0x34792d=[];_0x417239['forEach'](function(_0x128d50){_0x34792d[_0x9903('0x31')](updateWhatsappInteraction(_0x128d50,_0x201c14,_0x50dee6));});return BPromise[_0x9903('0xb4')](_0x34792d);});});})[_0x9903('0x28')](function(_0x54a39c){_0xc93dae[_0x9903('0xb5')]=_0x54a39c;return _0xc93dae;})['then'](respondWithFilteredResult(_0x117e82,_0x2d89c0))[_0x9903('0xb6')](handleError(_0x117e82,null));};exports[_0x9903('0xb7')]=function(_0x508305,_0x2cbc89){var _0x5c3e88={'raw':![],'where':{'id':_0x508305['params']['id']}},_0x516ba1={};_0x516ba1[_0x9903('0x38')]=_[_0x9903('0x3a')](db[_0x9903('0x33')][_0x9903('0x34')]);_0x516ba1[_0x9903('0x39')]=_[_0x9903('0x3a')](_0x508305[_0x9903('0x39')]);_0x516ba1[_0x9903('0x41')]=_['intersection'](_0x516ba1['model'],_0x516ba1[_0x9903('0x39')]);_0x5c3e88[_0x9903('0x3c')]=_['intersection'](_0x516ba1[_0x9903('0x38')],qs[_0x9903('0x3d')](_0x508305[_0x9903('0x39')]['fields']));_0x5c3e88['attributes']=_0x5c3e88['attributes'][_0x9903('0x3e')]?_0x5c3e88[_0x9903('0x3c')]:_0x516ba1[_0x9903('0x38')];if(_0x508305[_0x9903('0x39')][_0x9903('0xb8')]){_0x5c3e88[_0x9903('0xb9')]=[{'all':!![]}];}_0x5c3e88=_['merge']({},_0x5c3e88,_0x508305[_0x9903('0xba')]);return db['WhatsappInteraction'][_0x9903('0x67')](_0x5c3e88)[_0x9903('0x28')](handleEntityNotFound(_0x2cbc89,null))[_0x9903('0x28')](respondWithResult(_0x2cbc89,null))['catch'](handleError(_0x2cbc89,null));};exports[_0x9903('0xbb')]=function(_0x3e7093,_0x3160b0){return db[_0x9903('0x33')][_0x9903('0xbb')](_0x3e7093['body'],{})[_0x9903('0x28')](respondWithResult(_0x3160b0,0xc9))[_0x9903('0xb6')](handleError(_0x3160b0,null));};exports[_0x9903('0xbc')]=function(_0x46e1f8,_0x3707ec){if(_0x46e1f8['body']['id']){delete _0x46e1f8[_0x9903('0x71')]['id'];}return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x46e1f8[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x3707ec,null))[_0x9903('0x28')](saveUpdates(_0x46e1f8['body'],null))[_0x9903('0x28')](respondWithResult(_0x3707ec,null))['catch'](handleError(_0x3707ec,null));};exports[_0x9903('0x29')]=function(_0x530a3c,_0xb5f60){return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x530a3c[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0xb5f60,null))[_0x9903('0x28')](removeEntity(_0xb5f60,null))[_0x9903('0xb6')](handleError(_0xb5f60,null));};exports['describe']=function(_0x2e25b2,_0x1c4f34){return db['WhatsappInteraction'][_0x9903('0xbe')]()[_0x9903('0x28')](respondWithResult(_0x1c4f34,null))[_0x9903('0xb6')](handleError(_0x1c4f34,null));};exports[_0x9903('0xbf')]=function(_0x244128,_0x267d68,_0x2cdb74){return db[_0x9903('0xc0')]['find']({'where':{'id':_0x244128['params']['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x267d68,null))[_0x9903('0x28')](function(_0x21c8db){if(_0x21c8db){return _0x21c8db[_0x9903('0xbf')](_0x244128['body'][_0x9903('0xc1')],_[_0x9903('0xc2')](_0x244128['body'],[_0x9903('0xc1'),'id'])||{});}})[_0x9903('0x28')](respondWithResult(_0x267d68,null))[_0x9903('0xb6')](handleError(_0x267d68,null));};exports[_0x9903('0xc3')]=function(_0x1a1c1b,_0x1bbc10,_0x30d708){var _0x96193f={'raw':![],'where':{}};var _0x15cb47={};var _0x45f540={'count':0x0,'rows':[]};return db[_0x9903('0x33')]['findOne']({'where':{'id':_0x1a1c1b[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x1bbc10,null))[_0x9903('0x28')](function(_0x588321){if(_0x588321){_0x15cb47[_0x9903('0x38')]=_[_0x9903('0x3a')](db['WhatsappMessage'][_0x9903('0x34')]);_0x15cb47[_0x9903('0x39')]=_[_0x9903('0x3a')](_0x1a1c1b[_0x9903('0x39')]);_0x15cb47[_0x9903('0x41')]=_['intersection'](_0x15cb47['model'],_0x15cb47[_0x9903('0x39')]);_0x96193f['attributes']=_[_0x9903('0x3b')](_0x15cb47[_0x9903('0x38')],qs[_0x9903('0x3d')](_0x1a1c1b[_0x9903('0x39')]['fields']));_0x96193f[_0x9903('0x3c')]=_0x96193f[_0x9903('0x3c')][_0x9903('0x3e')]?_0x96193f['attributes']:_0x15cb47['model'];if(!_0x1a1c1b['query'][_0x9903('0xc4')](_0x9903('0xc5'))){_0x96193f[_0x9903('0x23')]=qs['limit'](_0x1a1c1b[_0x9903('0x39')][_0x9903('0x23')]);_0x96193f[_0x9903('0x22')]=qs[_0x9903('0x22')](_0x1a1c1b[_0x9903('0x39')][_0x9903('0x22')]);}_0x96193f['order']=qs[_0x9903('0x3f')](_0x1a1c1b['query'][_0x9903('0x3f')]);_0x96193f[_0x9903('0x40')]=qs[_0x9903('0x41')](_[_0x9903('0x42')](_0x1a1c1b[_0x9903('0x39')],_0x15cb47['filters']));_0x96193f[_0x9903('0x40')][_0x9903('0xb3')]=_0x588321['id'];if(_0x1a1c1b[_0x9903('0x39')][_0x9903('0x84')]){_0x96193f['where']=_['merge'](_0x96193f['where'],{'$or':_[_0x9903('0x2e')](_0x96193f['attributes'],function(_0x340bcc){var _0x36a6ab={};_0x36a6ab[_0x340bcc]={'$like':'%'+_0x1a1c1b[_0x9903('0x39')]['filter']+'%'};return _0x36a6ab;})});}if(_0x1a1c1b[_0x9903('0x39')]['$gte']){var _0x3b6d37=_0x1a1c1b[_0x9903('0x39')]['$gte'][_0x9903('0x30')](',');var _0xe51f32={};_0xe51f32[_0x3b6d37[0x0]]={'$gte':moment(_0x3b6d37[0x1])['format'](_0x9903('0xc6'))};_0x96193f[_0x9903('0x40')]=_[_0x9903('0xc7')](_0x96193f[_0x9903('0x40')],_0xe51f32);}_0x96193f=_['merge']({},_0x96193f,_0x1a1c1b['options']);return db['WhatsappMessage'][_0x9903('0x21')]({'where':_0x96193f[_0x9903('0x40')]})[_0x9903('0x28')](function(_0x3454f7){_0x45f540[_0x9903('0x21')]=_0x3454f7;if(_0x1a1c1b['query'][_0x9903('0xb8')]){_0x96193f[_0x9903('0xb9')]=[{'all':!![]}];}return db[_0x9903('0xc0')]['findAll'](_0x96193f);})[_0x9903('0x28')](function(_0x35969e){_0x45f540['rows']=_0x35969e;return _0x45f540;});}})['then'](respondWithFilteredResult(_0x1bbc10,_0x96193f))[_0x9903('0xb6')](handleError(_0x1bbc10,null));};exports[_0x9903('0xc8')]=function(_0x3e5fdb,_0x47b7aa,_0x5ea5a1){return db[_0x9903('0x33')]['find']({'where':{'id':_0x3e5fdb[_0x9903('0xbd')]['id']}})['then'](handleEntityNotFound(_0x47b7aa,null))[_0x9903('0x28')](function(_0x20126f){if(_0x20126f){return _0x20126f[_0x9903('0xc9')](_0x3e5fdb[_0x9903('0x71')][_0x9903('0xc1')],_['omit'](_0x3e5fdb[_0x9903('0x71')],[_0x9903('0xc1'),'id'])||{})[_0x9903('0xca')](function(){return db[_0x9903('0xcb')][_0x9903('0xcc')]({'attributes':['id',_0x9903('0x2c'),'color'],'where':{'id':_0x3e5fdb[_0x9903('0x71')]['ids']}});})['then'](function(_0x42adcf){socket[_0x9903('0xcd')](_0x9903('0xce'),{'id':Number(_0x3e5fdb['params']['id']),'tags':_0x42adcf||[]});return{'id':Number(_0x3e5fdb[_0x9903('0xbd')]['id']),'tags':_0x42adcf||[]};});}})[_0x9903('0x28')](respondWithResult(_0x47b7aa,null))[_0x9903('0xb6')](handleError(_0x47b7aa,null));};exports[_0x9903('0xcf')]=function(_0x3a732f,_0x5e045e,_0x1dd895){return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x3a732f[_0x9903('0xbd')]['id']}})[_0x9903('0x28')](handleEntityNotFound(_0x5e045e,null))[_0x9903('0x28')](function(_0x2792a6){if(_0x2792a6){return _0x2792a6[_0x9903('0xcf')](_0x3a732f[_0x9903('0x39')]['ids']);}})[_0x9903('0x28')](respondWithStatusCode(_0x5e045e,null))[_0x9903('0xb6')](handleError(_0x5e045e,null));};exports['download']=function(_0x4d09e1,_0x29130b){var _0x322ce6=moment()[_0x9903('0xd0')]()['toString']();var _0x32130b=path['join'](config[_0x9903('0xd1')],_0x9903('0xd2'),_0x9903('0xd3'),_0x9903('0xd4'));var _0x2b65f1=path[_0x9903('0xd5')](config[_0x9903('0xd1')],_0x9903('0xd2'),_0x9903('0xd3'),_0x9903('0xd6'));var _0x37566a=path[_0x9903('0xd5')](_0x32130b,_0x322ce6);var _0x544baa=util['format'](_0x9903('0xd7'),_0x4d09e1[_0x9903('0xbd')]['id'],_0x322ce6);var _0x40a723=path['join'](_0x32130b,_0x544baa);var _0x1352a7=[];_0x1352a7[_0x9903('0x31')]({'model':db[_0x9903('0xd8')],'as':_0x9903('0xd8'),'attributes':['id',_0x9903('0xd9')],'raw':!![]});_0x1352a7['push']({'model':db['CmContact'],'as':_0x9903('0x61'),'attributes':['id',_0x9903('0xda'),_0x9903('0xdb')],'raw':!![]});if(_0x4d09e1[_0x9903('0x39')][_0x9903('0xd6')]){_0x1352a7[_0x9903('0x31')]({'model':db[_0x9903('0xdc')],'as':_0x9903('0xdc'),'raw':!![]});}var _0x4c9682=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x9903('0x71'),_0x9903('0x77'),_0x9903('0xdd'),_0x9903('0xde'),_0x9903('0x7f')],'include':_0x1352a7}];_0x4c9682[_0x9903('0x31')]({'model':db['WhatsappAccount'],'as':_0x9903('0xdf'),'attributes':['id',_0x9903('0x2c')]});_0x4c9682[_0x9903('0x31')]({'model':db[_0x9903('0xd8')],'as':_0x9903('0xe0'),'attributes':['id','fullname']});return db[_0x9903('0x33')][_0x9903('0x67')]({'where':{'id':_0x4d09e1['params']['id']},'include':_0x4c9682})[_0x9903('0x28')](handleEntityNotFound(_0x29130b,null))['then'](function(_0x504d46){if(_0x504d46){var _0x20919a=_0x504d46[_0x9903('0xe1')]({'plain':!![]});fs[_0x9903('0xe2')](_0x37566a);var _0x19518c={'format':'A4','border':_0x9903('0xe3'),'header':{'height':_0x9903('0xe4'),'contents':{'first':_0x9903('0xe5')}},'footer':{'height':'30px','contents':{'default':util[_0x9903('0xe6')](_0x9903('0xe7'),util['format']('%s\x20#%d',_0x9903('0xe8'),_0x20919a['id']),moment()[_0x9903('0xe6')](_0x9903('0xe9'))[_0x9903('0x9a')]())}}};var _0xdc79a={'channel':_0x9903('0xe8'),'account':_0x20919a[_0x9903('0xdf')]['name'],'agent':_0x20919a[_0x9903('0xe0')]?_0x20919a[_0x9903('0xe0')]['fullname']:_0x9903('0xea'),'createdAt':moment(_0x20919a[_0x9903('0x77')])[_0x9903('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x20919a['closed']?moment(_0x20919a[_0x9903('0xeb')])['format'](_0x9903('0xc6'))[_0x9903('0x9a')]():'','disposition':_0x20919a[_0x9903('0xec')],'messages':_(_0x20919a[_0x9903('0xed')])[_0x9903('0x84')]({'secret':![]})[_0x9903('0x2e')](function(_0x53bb2f){if(_0x53bb2f[_0x9903('0xdc')]){var _0x4f2a97=path[_0x9903('0xd5')](_0x2b65f1,_0x53bb2f[_0x9903('0xdc')][_0x9903('0xee')]);if(fs[_0x9903('0xef')](_0x4f2a97)){fs[_0x9903('0xf0')](_0x4f2a97)[_0x9903('0xf1')](fs[_0x9903('0xf2')](path[_0x9903('0xd5')](_0x37566a,_0x53bb2f[_0x9903('0xdc')][_0x9903('0xee')])));}}return{'date':moment(_0x53bb2f['createdAt'])[_0x9903('0xe6')](_0x9903('0xc6'))[_0x9903('0x9a')](),'sender':_0x53bb2f[_0x9903('0xdd')]===_0x9903('0xf3')?_0x53bb2f[_0x9903('0xd8')]?_0x53bb2f['User'][_0x9903('0xd9')]:_0x9903('0xf4'):_0x53bb2f[_0x9903('0x61')][_0x9903('0xda')]+(_0x53bb2f['Contact'][_0x9903('0xdb')]?'\x20'+_0x53bb2f[_0x9903('0x61')][_0x9903('0xdb')]:''),'body':_0x53bb2f['Attachment']?_0x53bb2f[_0x9903('0xdc')][_0x9903('0xee')]:_0x53bb2f[_0x9903('0x71')],'direction':_0x53bb2f[_0x9903('0xdd')]===_0x9903('0xf3')?'A':'C','secret':_0x53bb2f[_0x9903('0xde')],'read':_0x53bb2f[_0x9903('0x7f')],'attachment':_0x53bb2f[_0x9903('0xdc')]};})[_0x9903('0x5d')]()};return ejs[_0x9903('0xf5')](path['join'](config[_0x9903('0xd1')],'server',_0x9903('0xf6'),_0x9903('0xf7')),{'interaction':_0xdc79a})[_0x9903('0x28')](function(_0x165bd5){return new BPromise(function(_0x7994ac,_0x222f40){pdf['create'](_0x165bd5,_0x19518c)['toFile'](path[_0x9903('0xd5')](_0x37566a,_0x9903('0xf8')+_0x20919a['id']+'-'+_0x322ce6+_0x9903('0xf9')),function(_0x26b7d0,_0x4ce4dd){if(_0x26b7d0)return _0x222f40(_0x26b7d0);_0x7994ac(_0x4ce4dd);});});})[_0x9903('0x28')](function(){return new BPromise(function(_0x36c7c6,_0xb60318){zipdir(_0x37566a,{'saveTo':_0x40a723},function(_0x41e174,_0x315008){if(_0x41e174)return _0xb60318(_0x41e174);return _0x36c7c6(_0x315008);});})[_0x9903('0x28')](function(){return new BPromise(function(_0x126730,_0x6675f3){rimraf(_0x37566a,function(_0x19afd2){if(_0x19afd2)_0x6675f3(_0x19afd2);return _0x126730();});});})[_0x9903('0x28')](function(){return _0x29130b[_0x9903('0xfa')](_0x40a723,_0x544baa,function(_0x2ffca2){if(_0x2ffca2){console[_0x9903('0xfb')](_0x9903('0xfc'),_0x2ffca2);}else{fs[_0x9903('0xfd')](_0x40a723);}});});});}else{return _0x29130b['sendStatus'](0xc8);}})[_0x9903('0xb6')](handleError(_0x29130b,null));}; \ No newline at end of file +var _0x8e36=['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','Whatsapp','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','pipe','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','status','json','count','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','TagIds','Tags','split','forEach','push','catch','map','WhatsappInteraction','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','format','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','10px'];(function(_0x43f585,_0x3f8ba8){var _0x399005=function(_0x1e0027){while(--_0x1e0027){_0x43f585['push'](_0x43f585['shift']());}};_0x399005(++_0x3f8ba8);}(_0x8e36,0x10c));var _0x68e3=function(_0x17e682,_0x37c2bb){_0x17e682=_0x17e682-0x0;var _0x46d026=_0x8e36[_0x17e682];return _0x46d026;};'use strict';var pdf=require(_0x68e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x68e3('0x1'));var zipdir=require(_0x68e3('0x2'));var jsonpatch=require(_0x68e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68e3('0x4'));var Mustache=require(_0x68e3('0x5'));var util=require('util');var path=require(_0x68e3('0x6'));var sox=require('sox');var csv=require(_0x68e3('0x7'));var ejs=require(_0x68e3('0x8'));var fs=require('fs');var _=require(_0x68e3('0x9'));var squel=require('squel');var crypto=require(_0x68e3('0xa'));var jsforce=require(_0x68e3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x68e3('0x7'));var querystring=require(_0x68e3('0xc'));var Papa=require(_0x68e3('0xd'));var Redis=require(_0x68e3('0xe'));var authService=require(_0x68e3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68e3('0x10'));var hardwareService=require(_0x68e3('0x11'));var logger=require(_0x68e3('0x12'))(_0x68e3('0x13'));var utils=require('../../config/utils');var config=require(_0x68e3('0x14'));var licenseUtil=require(_0x68e3('0x15'));var db=require(_0x68e3('0x16'))['db'];config[_0x68e3('0x17')]=_[_0x68e3('0x18')](config['redis'],{'host':_0x68e3('0x19'),'port':0x18eb});var socket=require(_0x68e3('0x1a'))(new Redis(config[_0x68e3('0x17')]));require(_0x68e3('0x1b'))[_0x68e3('0x1c')](socket);function respondWithStatusCode(_0x42c28c,_0x17c7a5){_0x17c7a5=_0x17c7a5||0xcc;return function(_0x3d9d04){if(_0x3d9d04){return _0x42c28c['sendStatus'](_0x17c7a5);}return _0x42c28c['status'](_0x17c7a5)[_0x68e3('0x1d')]();};}function respondWithResult(_0xd80fcf,_0x36a47c){_0x36a47c=_0x36a47c||0xc8;return function(_0xf6ae1f){if(_0xf6ae1f){return _0xd80fcf[_0x68e3('0x1e')](_0x36a47c)[_0x68e3('0x1f')](_0xf6ae1f);}};}function respondWithFilteredResult(_0x5b9250,_0xed3a55){return function(_0x47d8eb){if(_0x47d8eb){var _0x45d5d9=_0x47d8eb[_0x68e3('0x20')],_0x11ae98=_0xed3a55['offset'],_0x19d768=_0xed3a55['offset']+_0xed3a55['limit'],_0x12c48e;if(_0x19d768>=_0x45d5d9){_0x19d768=_0x45d5d9;_0x12c48e=0xc8;}else{_0x12c48e=0xce;}_0x5b9250[_0x68e3('0x1e')](_0x12c48e);return _0x5b9250['set']('Content-Range',_0x11ae98+'-'+_0x19d768+'/'+_0x45d5d9)['json'](_0x47d8eb);}return null;};}function patchUpdates(_0x58e52b){return function(_0x1e0ddc){try{jsonpatch[_0x68e3('0x21')](_0x1e0ddc,_0x58e52b,!![]);}catch(_0x4cd901){return BPromise[_0x68e3('0x22')](_0x4cd901);}return _0x1e0ddc[_0x68e3('0x23')]();};}function saveUpdates(_0x1091e6,_0x4cdd5e){return function(_0x51f690){if(_0x51f690){return _0x51f690[_0x68e3('0x24')](_0x1091e6)[_0x68e3('0x25')](function(_0x3b8606){return _0x3b8606;});}return null;};}function removeEntity(_0x18dcea,_0x20f3f1){return function(_0x130f2d){if(_0x130f2d){return _0x130f2d['destroy']()['then'](function(){_0x18dcea[_0x68e3('0x1e')](0xcc)[_0x68e3('0x1d')]();});}};}function handleEntityNotFound(_0xc09cd0,_0x44bbdd){return function(_0x4d4cd5){if(!_0x4d4cd5){_0xc09cd0[_0x68e3('0x26')](0x194);}return _0x4d4cd5;};}function handleError(_0x4d4c5b,_0xd66631){_0xd66631=_0xd66631||0x1f4;return function(_0x3ebcdd){logger[_0x68e3('0x27')](_0x3ebcdd[_0x68e3('0x28')]);if(_0x3ebcdd[_0x68e3('0x29')]){delete _0x3ebcdd['name'];}_0x4d4c5b['status'](_0xd66631)[_0x68e3('0x2a')](_0x3ebcdd);};}function getInteractionUsers(_0xe77eb7,_0x2ee36a){return new BPromise(function(_0x4427af,_0x9ae7e0){try{if(_0x2ee36a[_0xe77eb7['id']]){_0xe77eb7[_0x68e3('0x2b')]=_['map'](_0x2ee36a[_0xe77eb7['id']],function(_0x4d5183){return{'id':_0x4d5183['id'],'fullname':_0x4d5183['fullname']};});}}catch(_0x1300be){_0x9ae7e0(_0x1300be);}_0x4427af(_0xe77eb7);});}function getInteractionTags(_0x4de523,_0x1e7a14){return new BPromise(function(_0x1ae085,_0x2d19ca){try{if(_0x4de523[_0x68e3('0x2c')]){_0x4de523[_0x68e3('0x2d')]=[];_0x4de523['TagIds'][_0x68e3('0x2e')](',')[_0x68e3('0x2f')](function(_0x1d7b7b){_0x4de523['Tags'][_0x68e3('0x30')](_0x1e7a14[_0x1d7b7b]);});}delete _0x4de523[_0x68e3('0x2c')];}catch(_0x42e70e){_0x2d19ca(_0x42e70e);}_0x1ae085(_0x4de523);});}function updateWhatsappInteraction(_0x43e6cc,_0x3e87e9,_0x2f830f){return new BPromise(function(_0x6776a6,_0x5a4d10){return getInteractionUsers(_0x43e6cc,_0x2f830f)['then'](function(_0x1cd774){return getInteractionTags(_0x1cd774,_0x3e87e9);})[_0x68e3('0x25')](function(_0x1feeeb){_0x6776a6(_0x1feeeb);})[_0x68e3('0x31')](function(_0x553544){_0x5a4d10(_0x553544);});});}exports['index']=function(_0x7f6714,_0x54cd58){var _0x5e1208={},_0x3a9a33={},_0x1fce33={'count':0x0,'rows':[]};var _0x5d5325=_[_0x68e3('0x32')](db[_0x68e3('0x33')]['rawAttributes'],function(_0x286af0){return{'name':_0x286af0['fieldName'],'type':_0x286af0[_0x68e3('0x34')][_0x68e3('0x35')]};});_0x3a9a33[_0x68e3('0x36')]=_['map'](_0x5d5325,'name');_0x3a9a33[_0x68e3('0x37')]=_[_0x68e3('0x38')](_0x7f6714[_0x68e3('0x37')]);_0x3a9a33[_0x68e3('0x39')]=_['intersection'](_0x3a9a33['model'],_0x3a9a33[_0x68e3('0x37')]);_0x5e1208[_0x68e3('0x3a')]=_[_0x68e3('0x3b')](_0x3a9a33['model'],qs['fields'](_0x7f6714[_0x68e3('0x37')][_0x68e3('0x3c')]));_0x5e1208[_0x68e3('0x3a')]=_0x5e1208[_0x68e3('0x3a')][_0x68e3('0x3d')]?_0x5e1208['attributes']:_0x3a9a33[_0x68e3('0x36')];if(!_0x7f6714[_0x68e3('0x37')][_0x68e3('0x3e')]('nolimit')){_0x5e1208[_0x68e3('0x3f')]=qs[_0x68e3('0x3f')](_0x7f6714['query'][_0x68e3('0x3f')]);_0x5e1208['offset']=qs[_0x68e3('0x40')](_0x7f6714[_0x68e3('0x37')]['offset']);}_0x5e1208[_0x68e3('0x41')]=qs[_0x68e3('0x42')](_0x7f6714[_0x68e3('0x37')][_0x68e3('0x42')]);_0x5e1208[_0x68e3('0x43')]=qs[_0x68e3('0x39')](_[_0x68e3('0x44')](_0x7f6714[_0x68e3('0x37')],_0x3a9a33['filters']),_0x5d5325);var _0x1f1a62=[];var _0x25cd36=squel[_0x68e3('0x45')]()[_0x68e3('0x46')]('id')[_0x68e3('0x46')]('name')[_0x68e3('0x46')](_0x68e3('0x47'))[_0x68e3('0x48')](_0x68e3('0x49'));var _0x1995f6=squel[_0x68e3('0x45')]()['field'](_0x68e3('0x4a'))[_0x68e3('0x46')]('u.fullname')[_0x68e3('0x46')](_0x68e3('0x4b'))[_0x68e3('0x48')](_0x68e3('0x4c'),'ui')[_0x68e3('0x4d')]('users','u',_0x68e3('0x4e'));var _0xddf46=squel['select']()[_0x68e3('0x48')](_0x68e3('0x4f'),'i')[_0x68e3('0x4d')](_0x68e3('0x50'),'c',_0x68e3('0x51'))['left_join'](_0x68e3('0x52'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x68e3('0x53'),'a',_0x68e3('0x54'))['left_join']('whatsapp_messages','me',_0x68e3('0x55'))['left_join'](_0x68e3('0x56'),'it',_0x68e3('0x57'))[_0x68e3('0x4d')](_0x68e3('0x49'),'t',_0x68e3('0x58'));var _0x573d3e=squel[_0x68e3('0x59')]();var _0x3e614c=[];var _0x32156b=squel[_0x68e3('0x59')]();var _0x893ab9;if(_0x7f6714['query']['search']){_0x893ab9=as['parseSearch'](_0x7f6714['query'][_0x68e3('0x5a')]);var _0x5b8a6e=_0x893ab9[_0x68e3('0x5b')];for(var _0x48dfcd=0x0;_0x48dfcd<_0x893ab9[_0x68e3('0x5c')][_0x68e3('0x3d')];_0x48dfcd++){var _0x3e2102=_0x893ab9[_0x68e3('0x5c')][_0x48dfcd];var _0x50198b='i';var _0x11b64f=_[_0x68e3('0x5d')](_0x5d5325,[_0x68e3('0x29'),_0x3e2102[_0x68e3('0x46')]]);if(!_0x11b64f){switch(_0x3e2102['field']){case _0x68e3('0x5e'):if(_0x3e2102[_0x68e3('0x5f')]==0x1){_0xddf46[_0x68e3('0x60')]('`'+_0x3e2102[_0x68e3('0x46')]+_0x68e3('0x61'));}else{_0xddf46[_0x68e3('0x60')]('`'+_0x3e2102[_0x68e3('0x46')]+_0x68e3('0x62'));}break;case _0x68e3('0x63'):if(_0x3e2102[_0x68e3('0x64')]===_0x68e3('0x65')){if(_0x3e2102[_0x68e3('0x5f')]['split']('\x20')[_0x68e3('0x3d')]>0x1){_0x573d3e[_0x5b8a6e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x68e3('0x66')](_0x3e2102[_0x68e3('0x5f')]),null);}else{var _0x4af9d0='%'+_0x3e2102[_0x68e3('0x5f')]+'%';_0x573d3e[_0x5b8a6e](_0x68e3('0x67'),_0x4af9d0,_0x4af9d0,_0x4af9d0);}}else{_0x11b64f=_[_0x68e3('0x5d')](_0x5d5325,[_0x68e3('0x29'),_0x68e3('0x68')]);_0x3e2102[_0x68e3('0x46')]=_0x68e3('0x68');_0x471ff9=as[_0x68e3('0x69')](_0x50198b,_0x11b64f[_0x68e3('0x34')],_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9[_0x68e3('0x6a')],_0x471ff9['value'][_0x68e3('0x6b')],_0x471ff9['value']['end']);}break;case _0x68e3('0x6c'):var _0x2723ba=_0x3e2102[_0x68e3('0x5f')][_0x68e3('0x2e')](',')[_0x68e3('0x32')](function(_0x15ea82){return Number(_0x15ea82);});_0x2723ba['forEach'](function(_0x41846b){_0x32156b['or'](_0x68e3('0x6d'),'%,'+_0x41846b+',%');});_0x3e614c=_[_0x68e3('0x6e')](_0x3e614c,_0x2723ba);break;case _0x68e3('0x6f'):if(_0x3e2102[_0x68e3('0x64')]===_0x68e3('0x65')){_0x573d3e[_0x5b8a6e](_0x68e3('0x70'),'%'+_0x3e2102[_0x68e3('0x5f')]+'%',null);}else{_0x11b64f=_['find'](_0x5d5325,[_0x68e3('0x29'),_0x68e3('0x71')]);_0x3e2102[_0x68e3('0x46')]='UserId';_0x471ff9=as[_0x68e3('0x69')](_0x50198b,_0x11b64f[_0x68e3('0x34')],_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9[_0x68e3('0x6a')],_0x471ff9[_0x68e3('0x5f')]['start'],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x1d')]);}break;case _0x68e3('0x72'):_0x471ff9=as[_0x68e3('0x69')]('me',null,_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9['text'],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x6b')],_0x471ff9[_0x68e3('0x5f')]['end']);break;}}else{var _0x471ff9=as[_0x68e3('0x69')](_0x50198b,_0x11b64f[_0x68e3('0x34')],_0x3e2102);_0x573d3e[_0x5b8a6e](_0x471ff9[_0x68e3('0x6a')],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x6b')],_0x471ff9[_0x68e3('0x5f')][_0x68e3('0x1d')]);}}}else{var _0x31f0ac=_(_0x7f6714[_0x68e3('0x37')])[_0x68e3('0x38')]()[_0x68e3('0x32')](function(_0x50d908){return _[_0x68e3('0x73')](_0x5d5325,['name',_0x50d908])?_0x50d908:undefined;})[_0x68e3('0x74')]()[_0x68e3('0x5f')]();if(!_[_0x68e3('0x75')](_0x31f0ac)){_0x31f0ac[_0x68e3('0x2f')](function(_0x525548){if(_0x525548===_0x68e3('0x76')){_0xddf46[_0x68e3('0x43')](_0x68e3('0x77'),[][_0x68e3('0x78')](_0x7f6714['query'][_0x525548]));}else if(_0x525548===_0x68e3('0x79')){var _0x27d42b=JSON[_0x68e3('0x7a')](_0x7f6714['query'][_0x525548])[_0x68e3('0x7b')];var _0x2ad8c7=JSON[_0x68e3('0x7a')](_0x7f6714[_0x68e3('0x37')][_0x525548])[_0x68e3('0x7c')];_0xddf46['where'](_0x68e3('0x7d'),_0x27d42b,_0x2ad8c7);}else{if(_0x7f6714[_0x68e3('0x37')][_0x525548]==='null'){_0xddf46['where']('i.'+_0x525548+_0x68e3('0x7e'));}else{_0xddf46['where']('i.'+_0x525548+_0x68e3('0x7f'),_0x7f6714[_0x68e3('0x37')][_0x525548]);}}});}if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x80')]){if(_0x7f6714['query'][_0x68e3('0x80')]==0x1){_0xddf46['having'](_0x68e3('0x81'));}else{_0xddf46['having'](_0x68e3('0x82'));}}if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x83')]){_0x3e614c=_['isArray'](_0x7f6714[_0x68e3('0x37')][_0x68e3('0x83')])?_0x7f6714['query'][_0x68e3('0x83')]:new Array(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x83')]);_0x3e614c['forEach'](function(_0x46de8d){_0x32156b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46de8d+',%');});}if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x84')]){var _0x5ee511=_0x7f6714[_0x68e3('0x37')][_0x68e3('0x84')][_0x68e3('0x85')]('\x5c','\x5c\x5c')[_0x68e3('0x85')](/'/g,'\x27\x27');if(qs[_0x68e3('0x86')](_0x5ee511)){_0x573d3e['or']('i.id\x20LIKE\x20?',_0x5ee511+'%')['or']('i.phone\x20LIKE\x20?',_0x5ee511+'%');}else{_0x573d3e['or'](_0x68e3('0x87'),qs[_0x68e3('0x66')](_0x5ee511))['or'](_0x68e3('0x88'),_0x5ee511+'%');}}}_0xddf46[_0x68e3('0x43')](_0x573d3e);_0xddf46[_0x68e3('0x89')](_0x68e3('0x8a'));var _0x5bd49a={'type':db[_0x68e3('0x8b')][_0x68e3('0x8c')][_0x68e3('0x8d')],'raw':!![]};var _0xd64dfb=_0xddf46[_0x68e3('0x8e')]();_0xd64dfb[_0x68e3('0x46')]('i.id');_0xd64dfb[_0x68e3('0x46')](_0x68e3('0x8f'),_0x68e3('0x5e'));if(_0x5e1208[_0x68e3('0x41')]){_0x5e1208['order']['forEach'](function(_0x5c0065){var _0x298029=_0x5c0065[0x0]===_0x68e3('0x90')?_0x5c0065[0x0]:'i.'+_0x5c0065[0x0];_0xddf46['order'](_0x298029,_0x5c0065[0x1]===_0x68e3('0x91')?![]:!![]);});}if(!_[_0x68e3('0x75')](_0x3e614c)){_0xddf46[_0x68e3('0x60')](_0x32156b);_0xd64dfb[_0x68e3('0x43')]('t.id\x20IN\x20?',_0x3e614c);}BPromise[_0x68e3('0x92')]()[_0x68e3('0x25')](function(){if(!_0x893ab9){if(_0x7f6714['query']['WhatsappAccountId']||_0x7f6714[_0x68e3('0x37')][_0x68e3('0x93')])return;_0xd64dfb[_0x68e3('0x43')](_0x68e3('0x94'));_0xddf46[_0x68e3('0x43')](_0x68e3('0x94'));return;}if(_0x7f6714[_0x68e3('0x95')][_0x68e3('0x96')]!=='agent')return;return _0x7f6714[_0x68e3('0x95')][_0x68e3('0x97')]({'attributes':['id'],'raw':!![]})[_0x68e3('0x25')](function(_0x46f3a2){if(_[_0x68e3('0x75')](_0x46f3a2)){_0xd64dfb[_0x68e3('0x43')](_0x68e3('0x98'));_0xddf46[_0x68e3('0x43')](_0x68e3('0x98'));}else{_0xd64dfb['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x46f3a2,'id'));_0xddf46[_0x68e3('0x43')](_0x68e3('0x77'),_[_0x68e3('0x32')](_0x46f3a2,'id'));}});})[_0x68e3('0x25')](function(){if(_0x7f6714['user'][_0x68e3('0x96')]===_0x68e3('0x99')&&!_0x893ab9&&!_0x7f6714[_0x68e3('0x37')]['WhatsappAccountId'])return[];return db[_0x68e3('0x9a')][_0x68e3('0x37')](_0xd64dfb[_0x68e3('0x9b')](),_0x5bd49a);})[_0x68e3('0x25')](function(_0x2b71af){_0x1fce33[_0x68e3('0x20')]=_0x2b71af[_0x68e3('0x3d')];if(_0x1fce33[_0x68e3('0x20')]===0x0)return[];return db['sequelize'][_0x68e3('0x37')](_0x25cd36[_0x68e3('0x9b')](),_0x5bd49a)['then'](function(_0x45a9f2){_0x1f1a62=_[_0x68e3('0x9c')](_0x45a9f2,'id');_0x5bd49a=_['merge'](_0x5bd49a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7f6714[_0x68e3('0x37')][_0x68e3('0x3c')]){_0x5e1208[_0x68e3('0x3a')][_0x68e3('0x2f')](function(_0xa2eaab){_0xddf46[_0x68e3('0x46')]('i.'+_0xa2eaab);});}else{_0xddf46['field'](_0x68e3('0x8f'),_0x68e3('0x5e'));_0xddf46[_0x68e3('0x46')](_0x68e3('0x9d'),'Account.key');_0xddf46[_0x68e3('0x46')](_0x68e3('0x9e'),_0x68e3('0x9f'));_0xddf46[_0x68e3('0x46')]('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');_0xddf46[_0x68e3('0x46')](_0x68e3('0xa0'));_0xddf46[_0x68e3('0x46')]('c.firstName','Contact.firstName');_0xddf46['field'](_0x68e3('0xa1'),'Contact.lastName');_0xddf46[_0x68e3('0x46')](_0x68e3('0xa2'),_0x68e3('0xa3'));_0xddf46[_0x68e3('0x46')](_0x68e3('0xa4'),'Contact.phone');_0xddf46[_0x68e3('0x46')](_0x68e3('0xa5'),'Contact.mobile');_0xddf46[_0x68e3('0x46')]('c.fax',_0x68e3('0xa6'));_0xddf46[_0x68e3('0x46')](_0x68e3('0xa7'),'Owner.fullname');_0xddf46['field'](_0x68e3('0xa8'),_0x68e3('0xa9'));_0xddf46[_0x68e3('0x46')](_0x68e3('0xaa'),_0x68e3('0x2c'));}if(_0x5e1208['limit'])_0xddf46[_0x68e3('0x3f')](_0x5e1208[_0x68e3('0x3f')]);if(_0x5e1208[_0x68e3('0x40')])_0xddf46[_0x68e3('0x40')](_0x5e1208[_0x68e3('0x40')]);return db['sequelize'][_0x68e3('0x37')](_0xddf46[_0x68e3('0x9b')](),_0x5bd49a);})[_0x68e3('0x25')](function(_0x21afa0){_0x1995f6[_0x68e3('0x43')](_0x68e3('0xab'),_[_0x68e3('0x32')](_0x21afa0,'id'));return db[_0x68e3('0x9a')][_0x68e3('0x37')](_0x1995f6[_0x68e3('0x9b')](),_0x5bd49a)[_0x68e3('0x25')](function(_0x48acee){var _0x4aed84=_[_0x68e3('0xac')](_0x48acee,_0x68e3('0xad'));var _0x2a190a=[];_0x21afa0[_0x68e3('0x2f')](function(_0x3be9d5){_0x2a190a[_0x68e3('0x30')](updateWhatsappInteraction(_0x3be9d5,_0x1f1a62,_0x4aed84));});return BPromise[_0x68e3('0xae')](_0x2a190a);});});})[_0x68e3('0x25')](function(_0x37aa2a){_0x1fce33[_0x68e3('0xaf')]=_0x37aa2a;return _0x1fce33;})[_0x68e3('0x25')](respondWithFilteredResult(_0x54cd58,_0x5e1208))['catch'](handleError(_0x54cd58,null));};exports[_0x68e3('0xb0')]=function(_0x20e7ee,_0x3c0eb3){var _0x235074={'raw':![],'where':{'id':_0x20e7ee[_0x68e3('0xb1')]['id']}},_0x38084f={};_0x38084f['model']=_[_0x68e3('0x38')](db[_0x68e3('0x33')]['rawAttributes']);_0x38084f[_0x68e3('0x37')]=_[_0x68e3('0x38')](_0x20e7ee[_0x68e3('0x37')]);_0x38084f[_0x68e3('0x39')]=_[_0x68e3('0x3b')](_0x38084f[_0x68e3('0x36')],_0x38084f[_0x68e3('0x37')]);_0x235074['attributes']=_[_0x68e3('0x3b')](_0x38084f[_0x68e3('0x36')],qs[_0x68e3('0x3c')](_0x20e7ee[_0x68e3('0x37')][_0x68e3('0x3c')]));_0x235074[_0x68e3('0x3a')]=_0x235074['attributes'][_0x68e3('0x3d')]?_0x235074[_0x68e3('0x3a')]:_0x38084f['model'];if(_0x20e7ee[_0x68e3('0x37')][_0x68e3('0xb2')]){_0x235074[_0x68e3('0xb3')]=[{'all':!![]}];}_0x235074=_[_0x68e3('0xb4')]({},_0x235074,_0x20e7ee[_0x68e3('0xb5')]);return db['WhatsappInteraction'][_0x68e3('0x5d')](_0x235074)[_0x68e3('0x25')](handleEntityNotFound(_0x3c0eb3,null))[_0x68e3('0x25')](respondWithResult(_0x3c0eb3,null))['catch'](handleError(_0x3c0eb3,null));};exports[_0x68e3('0xb6')]=function(_0x50ae6b,_0x5bca9e){return db[_0x68e3('0x33')][_0x68e3('0xb6')](_0x50ae6b[_0x68e3('0x72')],{})[_0x68e3('0x25')](respondWithResult(_0x5bca9e,0xc9))[_0x68e3('0x31')](handleError(_0x5bca9e,null));};exports[_0x68e3('0x24')]=function(_0xd53302,_0x5baeb7){if(_0xd53302[_0x68e3('0x72')]['id']){delete _0xd53302['body']['id'];}return db[_0x68e3('0x33')]['find']({'where':{'id':_0xd53302[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x5baeb7,null))[_0x68e3('0x25')](saveUpdates(_0xd53302[_0x68e3('0x72')],null))[_0x68e3('0x25')](respondWithResult(_0x5baeb7,null))['catch'](handleError(_0x5baeb7,null));};exports[_0x68e3('0xb7')]=function(_0x4ad71b,_0x33b000){return db[_0x68e3('0x33')][_0x68e3('0x5d')]({'where':{'id':_0x4ad71b[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x33b000,null))[_0x68e3('0x25')](removeEntity(_0x33b000,null))[_0x68e3('0x31')](handleError(_0x33b000,null));};exports[_0x68e3('0xb8')]=function(_0x272392,_0x1275e9){return db['WhatsappInteraction'][_0x68e3('0xb8')]()['then'](respondWithResult(_0x1275e9,null))['catch'](handleError(_0x1275e9,null));};exports[_0x68e3('0xb9')]=function(_0x2e74e6,_0x271118,_0x1ffbb9){return db[_0x68e3('0xba')][_0x68e3('0x5d')]({'where':{'id':_0x2e74e6[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x271118,null))[_0x68e3('0x25')](function(_0x425494){if(_0x425494){return _0x425494[_0x68e3('0xb9')](_0x2e74e6['body'][_0x68e3('0xbb')],_[_0x68e3('0xbc')](_0x2e74e6[_0x68e3('0x72')],[_0x68e3('0xbb'),'id'])||{});}})[_0x68e3('0x25')](respondWithResult(_0x271118,null))['catch'](handleError(_0x271118,null));};exports[_0x68e3('0xbd')]=function(_0x4e8b4e,_0x339ca7,_0x4fd40c){var _0x26f88a={'raw':![],'where':{}};var _0x38677b={};var _0x1c07ba={'count':0x0,'rows':[]};return db[_0x68e3('0x33')][_0x68e3('0xbe')]({'where':{'id':_0x4e8b4e['params']['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x339ca7,null))[_0x68e3('0x25')](function(_0x58d079){if(_0x58d079){_0x38677b[_0x68e3('0x36')]=_[_0x68e3('0x38')](db['WhatsappMessage']['rawAttributes']);_0x38677b['query']=_[_0x68e3('0x38')](_0x4e8b4e[_0x68e3('0x37')]);_0x38677b[_0x68e3('0x39')]=_[_0x68e3('0x3b')](_0x38677b[_0x68e3('0x36')],_0x38677b['query']);_0x26f88a['attributes']=_['intersection'](_0x38677b[_0x68e3('0x36')],qs[_0x68e3('0x3c')](_0x4e8b4e[_0x68e3('0x37')]['fields']));_0x26f88a[_0x68e3('0x3a')]=_0x26f88a[_0x68e3('0x3a')][_0x68e3('0x3d')]?_0x26f88a[_0x68e3('0x3a')]:_0x38677b[_0x68e3('0x36')];if(!_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x3e')](_0x68e3('0xbf'))){_0x26f88a[_0x68e3('0x3f')]=qs[_0x68e3('0x3f')](_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x3f')]);_0x26f88a[_0x68e3('0x40')]=qs[_0x68e3('0x40')](_0x4e8b4e[_0x68e3('0x37')]['offset']);}_0x26f88a[_0x68e3('0x41')]=qs[_0x68e3('0x42')](_0x4e8b4e['query'][_0x68e3('0x42')]);_0x26f88a[_0x68e3('0x43')]=qs[_0x68e3('0x39')](_['pick'](_0x4e8b4e['query'],_0x38677b[_0x68e3('0x39')]));_0x26f88a[_0x68e3('0x43')][_0x68e3('0xad')]=_0x58d079['id'];if(_0x4e8b4e[_0x68e3('0x37')]['filter']){_0x26f88a['where']=_[_0x68e3('0xb4')](_0x26f88a[_0x68e3('0x43')],{'$or':_['map'](_0x26f88a['attributes'],function(_0x3f4c55){var _0x1e8b36={};_0x1e8b36[_0x3f4c55]={'$like':'%'+_0x4e8b4e['query']['filter']+'%'};return _0x1e8b36;})});}if(_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x7b')]){var _0x4c2625=_0x4e8b4e[_0x68e3('0x37')][_0x68e3('0x7b')][_0x68e3('0x2e')](',');var _0x517c06={};_0x517c06[_0x4c2625[0x0]]={'$gte':moment(_0x4c2625[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x26f88a[_0x68e3('0x43')]=_['merge'](_0x26f88a[_0x68e3('0x43')],_0x517c06);}_0x26f88a=_[_0x68e3('0xb4')]({},_0x26f88a,_0x4e8b4e[_0x68e3('0xb5')]);return db['WhatsappMessage'][_0x68e3('0x20')]({'where':_0x26f88a[_0x68e3('0x43')]})[_0x68e3('0x25')](function(_0x1ca027){_0x1c07ba[_0x68e3('0x20')]=_0x1ca027;if(_0x4e8b4e[_0x68e3('0x37')]['includeAll']){_0x26f88a[_0x68e3('0xb3')]=[{'all':!![]}];}return db[_0x68e3('0xba')][_0x68e3('0xc0')](_0x26f88a);})[_0x68e3('0x25')](function(_0x114cb2){_0x1c07ba[_0x68e3('0xaf')]=_0x114cb2;return _0x1c07ba;});}})[_0x68e3('0x25')](respondWithFilteredResult(_0x339ca7,_0x26f88a))[_0x68e3('0x31')](handleError(_0x339ca7,null));};exports[_0x68e3('0xc1')]=function(_0x30b9c4,_0x387d42,_0x1faee9){return db[_0x68e3('0x33')][_0x68e3('0x5d')]({'where':{'id':_0x30b9c4[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x387d42,null))[_0x68e3('0x25')](function(_0x161443){if(_0x161443){return _0x161443['setTags'](_0x30b9c4[_0x68e3('0x72')][_0x68e3('0xbb')],_[_0x68e3('0xbc')](_0x30b9c4[_0x68e3('0x72')],[_0x68e3('0xbb'),'id'])||{})[_0x68e3('0xc2')](function(){return db[_0x68e3('0x6c')][_0x68e3('0xc0')]({'attributes':['id','name',_0x68e3('0x47')],'where':{'id':_0x30b9c4[_0x68e3('0x72')]['ids']}});})[_0x68e3('0x25')](function(_0x342f3f){socket[_0x68e3('0xc3')](_0x68e3('0xc4'),{'id':Number(_0x30b9c4['params']['id']),'tags':_0x342f3f||[]});return{'id':Number(_0x30b9c4['params']['id']),'tags':_0x342f3f||[]};});}})['then'](respondWithResult(_0x387d42,null))[_0x68e3('0x31')](handleError(_0x387d42,null));};exports[_0x68e3('0xc5')]=function(_0x1851fe,_0x2fd4c7,_0x57624c){return db[_0x68e3('0x33')][_0x68e3('0x5d')]({'where':{'id':_0x1851fe[_0x68e3('0xb1')]['id']}})[_0x68e3('0x25')](handleEntityNotFound(_0x2fd4c7,null))[_0x68e3('0x25')](function(_0x674a9a){if(_0x674a9a){return _0x674a9a['removeTags'](_0x1851fe['query']['ids']);}})[_0x68e3('0x25')](respondWithStatusCode(_0x2fd4c7,null))['catch'](handleError(_0x2fd4c7,null));};exports[_0x68e3('0xc6')]=function(_0x50a3ae,_0x397d73){var _0x5a8fc3=moment()[_0x68e3('0xc7')]()[_0x68e3('0x9b')]();var _0xab93e0=path[_0x68e3('0xc8')](config[_0x68e3('0xc9')],_0x68e3('0xca'),_0x68e3('0xcb'),_0x68e3('0xcc'));var _0x5c6d95=path[_0x68e3('0xc8')](config[_0x68e3('0xc9')],_0x68e3('0xca'),_0x68e3('0xcb'),'attachments');var _0x55b140=path['join'](_0xab93e0,_0x5a8fc3);var _0x5d3c93=util[_0x68e3('0xcd')]('transcript-%d-%s.zip',_0x50a3ae[_0x68e3('0xb1')]['id'],_0x5a8fc3);var _0x1930bc=path[_0x68e3('0xc8')](_0xab93e0,_0x5d3c93);var _0x3d5d14=[];_0x3d5d14[_0x68e3('0x30')]({'model':db['User'],'as':'User','attributes':['id',_0x68e3('0xce')],'raw':!![]});_0x3d5d14[_0x68e3('0x30')]({'model':db[_0x68e3('0xcf')],'as':_0x68e3('0x63'),'attributes':['id',_0x68e3('0xd0'),_0x68e3('0xd1')],'raw':!![]});if(_0x50a3ae['query'][_0x68e3('0xd2')]){_0x3d5d14[_0x68e3('0x30')]({'model':db[_0x68e3('0xd3')],'as':_0x68e3('0xd3'),'raw':!![]});}var _0x35a519=[{'model':db['WhatsappMessage'],'as':_0x68e3('0xd4'),'attributes':['id','body',_0x68e3('0x79'),_0x68e3('0xd5'),_0x68e3('0xd6'),_0x68e3('0x80')],'include':_0x3d5d14}];_0x35a519['push']({'model':db[_0x68e3('0xd7')],'as':_0x68e3('0xd8'),'attributes':['id',_0x68e3('0x29')]});_0x35a519[_0x68e3('0x30')]({'model':db['User'],'as':_0x68e3('0xd9'),'attributes':['id',_0x68e3('0xce')]});return db['WhatsappInteraction'][_0x68e3('0x5d')]({'where':{'id':_0x50a3ae[_0x68e3('0xb1')]['id']},'include':_0x35a519})[_0x68e3('0x25')](handleEntityNotFound(_0x397d73,null))[_0x68e3('0x25')](function(_0x3aeb6d){if(_0x3aeb6d){var _0xd209e2=_0x3aeb6d[_0x68e3('0xda')]({'plain':!![]});fs['mkdirSync'](_0x55b140);var _0x4ba68f={'format':'A4','border':_0x68e3('0xdb'),'header':{'height':_0x68e3('0xdc'),'contents':{'first':_0x68e3('0xdd')}},'footer':{'height':_0x68e3('0xde'),'contents':{'default':util[_0x68e3('0xcd')](_0x68e3('0xdf'),util['format'](_0x68e3('0xe0'),'Whatsapp',_0xd209e2['id']),moment()['format'](_0x68e3('0xe1'))[_0x68e3('0x9b')]())}}};var _0x4c254f={'channel':_0x68e3('0xe2'),'account':_0xd209e2[_0x68e3('0xd8')][_0x68e3('0x29')],'agent':_0xd209e2[_0x68e3('0xd9')]?_0xd209e2[_0x68e3('0xd9')]['fullname']:_0x68e3('0xe3'),'createdAt':moment(_0xd209e2[_0x68e3('0x79')])[_0x68e3('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x68e3('0x9b')](),'closedAt':_0xd209e2[_0x68e3('0xe4')]?moment(_0xd209e2['closedAt'])[_0x68e3('0xcd')](_0x68e3('0xe5'))['toString']():'','disposition':_0xd209e2[_0x68e3('0xe6')],'messages':_(_0xd209e2[_0x68e3('0xd4')])[_0x68e3('0x84')]({'secret':![]})['map'](function(_0x194edd){if(_0x194edd[_0x68e3('0xd3')]){var _0x28737c=path[_0x68e3('0xc8')](_0x5c6d95,_0x194edd[_0x68e3('0xd3')][_0x68e3('0xe7')]);if(fs[_0x68e3('0xe8')](_0x28737c)){fs['createReadStream'](_0x28737c)[_0x68e3('0xe9')](fs['createWriteStream'](path['join'](_0x55b140,_0x194edd[_0x68e3('0xd3')][_0x68e3('0xe7')])));}}return{'date':moment(_0x194edd[_0x68e3('0x79')])[_0x68e3('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x194edd[_0x68e3('0xd5')]===_0x68e3('0xea')?_0x194edd[_0x68e3('0x6f')]?_0x194edd[_0x68e3('0x6f')][_0x68e3('0xce')]:_0x68e3('0xeb'):_0x194edd['Contact'][_0x68e3('0xd0')]+(_0x194edd[_0x68e3('0x63')][_0x68e3('0xd1')]?'\x20'+_0x194edd[_0x68e3('0x63')][_0x68e3('0xd1')]:''),'body':_0x194edd[_0x68e3('0xd3')]?_0x194edd[_0x68e3('0xd3')][_0x68e3('0xe7')]:_0x194edd['body'],'direction':_0x194edd[_0x68e3('0xd5')]==='out'?'A':'C','secret':_0x194edd['secret'],'read':_0x194edd['read'],'attachment':_0x194edd[_0x68e3('0xd3')]};})[_0x68e3('0x5f')]()};return ejs[_0x68e3('0xec')](path[_0x68e3('0xc8')](config['root'],_0x68e3('0xca'),'views',_0x68e3('0xed')),{'interaction':_0x4c254f})[_0x68e3('0x25')](function(_0x6b469f){return new BPromise(function(_0x291835,_0x50dc19){pdf[_0x68e3('0xb6')](_0x6b469f,_0x4ba68f)[_0x68e3('0xee')](path['join'](_0x55b140,_0x68e3('0xef')+_0xd209e2['id']+'-'+_0x5a8fc3+_0x68e3('0xf0')),function(_0x5e0ebf,_0x507408){if(_0x5e0ebf)return _0x50dc19(_0x5e0ebf);_0x291835(_0x507408);});});})['then'](function(){return new BPromise(function(_0x7c4f3,_0x422f00){zipdir(_0x55b140,{'saveTo':_0x1930bc},function(_0x1117b9,_0xe95731){if(_0x1117b9)return _0x422f00(_0x1117b9);return _0x7c4f3(_0xe95731);});})['then'](function(){return new BPromise(function(_0x41cdd0,_0x22d4e2){rimraf(_0x55b140,function(_0x15be09){if(_0x15be09)_0x22d4e2(_0x15be09);return _0x41cdd0();});});})[_0x68e3('0x25')](function(){return _0x397d73[_0x68e3('0xc6')](_0x1930bc,_0x5d3c93,function(_0x5939b8){if(_0x5939b8){console[_0x68e3('0xf1')](_0x68e3('0xf2'),_0x5939b8);}else{fs[_0x68e3('0xf3')](_0x1930bc);}});});});}else{return _0x397d73['sendStatus'](0xc8);}})[_0x68e3('0x31')](handleError(_0x397d73,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index eb97766..84e8ba5 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 _0x17f5=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','map'];(function(_0x331ade,_0x149e32){var _0x495b12=function(_0xc28d12){while(--_0xc28d12){_0x331ade['push'](_0x331ade['shift']());}};_0x495b12(++_0x149e32);}(_0x17f5,0x156));var _0x517f=function(_0x5305d8,_0x2f6547){_0x5305d8=_0x5305d8-0x0;var _0xa80dfb=_0x17f5[_0x5305d8];return _0xa80dfb;};'use strict';var EventEmitter=require(_0x517f('0x0'));var WhatsappInteraction=require(_0x517f('0x1'))['db'][_0x517f('0x2')];var WhatsappMessage=require(_0x517f('0x1'))['db'][_0x517f('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x517f('0x4')](0x0);var events={'afterCreate':_0x517f('0x5'),'afterUpdate':_0x517f('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4ca398){return function(_0x575563,_0x1a258e,_0x4cc27f){_0x575563['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5e576a){_0x575563['setDataValue']('Users',_0x5e576a[_0x517f('0x7')](function(_0x5a8be2){return{'id':_0x5a8be2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x575563['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd2122c){_0x575563[_0x517f('0x8')](_0x517f('0x9'),_0xd2122c[_0x517f('0xa')]);WhatsappInteractionEvents['emit'](_0x4ca398+':'+_0x575563['id'],_0x575563);WhatsappInteractionEvents[_0x517f('0xb')](_0x4ca398,_0x575563);_0x4cc27f(null);})[_0x517f('0xc')](_0x4cc27f(null));};}for(var e in events){if(events[_0x517f('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x8600=['length','emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x38c6a5,_0x3e31fb){var _0x2a841e=function(_0x24bd13){while(--_0x24bd13){_0x38c6a5['push'](_0x38c6a5['shift']());}};_0x2a841e(++_0x3e31fb);}(_0x8600,0xc3));var _0x0860=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x8600[_0x595604];return _0x1466f3;};'use strict';var EventEmitter=require(_0x0860('0x0'));var WhatsappInteraction=require(_0x0860('0x1'))['db'][_0x0860('0x2')];var WhatsappMessage=require(_0x0860('0x1'))['db'][_0x0860('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0860('0x4')](0x0);var events={'afterCreate':_0x0860('0x5'),'afterUpdate':_0x0860('0x6'),'afterDestroy':_0x0860('0x7')};function emitEvent(_0x10a42e){return function(_0x54bf31,_0x529da6,_0x1d4f43){_0x54bf31[_0x0860('0x8')]({'attributes':['id'],'raw':!![]})[_0x0860('0x9')](function(_0x208047){_0x54bf31[_0x0860('0xa')](_0x0860('0xb'),_0x208047[_0x0860('0xc')](function(_0x428c78){return{'id':_0x428c78['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x54bf31['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0860('0x9')](function(_0x729dc3){_0x54bf31[_0x0860('0xa')](_0x0860('0xd'),_0x729dc3[_0x0860('0xe')]);WhatsappInteractionEvents['emit'](_0x10a42e+':'+_0x54bf31['id'],_0x54bf31);WhatsappInteractionEvents[_0x0860('0xf')](_0x10a42e,_0x54bf31);_0x1d4f43(null);})[_0x0860('0x10')](_0x1d4f43(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x0860('0x11')](e,emitEvent(event));}}module[_0x0860('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 5086642..cdf5298 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 _0xb3e8=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','closedAt','format'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xb3e8,0x1a5));var _0x8b3e=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0xb3e8[_0x46ec32];return _0x338f60;};'use strict';var _=require('lodash');var util=require(_0x8b3e('0x0'));var logger=require(_0x8b3e('0x1'))(_0x8b3e('0x2'));var moment=require(_0x8b3e('0x3'));var BPromise=require(_0x8b3e('0x4'));var rp=require(_0x8b3e('0x5'));var fs=require('fs');var path=require(_0x8b3e('0x6'));var rimraf=require('rimraf');var config=require(_0x8b3e('0x7'));var attributes=require(_0x8b3e('0x8'));module[_0x8b3e('0x9')]=function(_0x5a5459,_0x49673f){return _0x5a5459[_0x8b3e('0xa')](_0x8b3e('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x255f45,_0x394655,_0x55dea6){if(_0x255f45['changed']('closed')){_0x255f45[_0x8b3e('0xc')]=moment()[_0x8b3e('0xd')](_0x8b3e('0xe'));}_0x55dea6(null,_0x255f45);}}});}; \ No newline at end of file +var _0xedb4=['changed','closed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','whatsapp_interactions'];(function(_0x5ba4be,_0x1810be){var _0x2e6862=function(_0x9d1bbd){while(--_0x9d1bbd){_0x5ba4be['push'](_0x5ba4be['shift']());}};_0x2e6862(++_0x1810be);}(_0xedb4,0x1c3));var _0x4edb=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xedb4[_0x4c2dfc];return _0xfd728d;};'use strict';var _=require(_0x4edb('0x0'));var util=require('util');var logger=require(_0x4edb('0x1'))(_0x4edb('0x2'));var moment=require(_0x4edb('0x3'));var BPromise=require(_0x4edb('0x4'));var rp=require(_0x4edb('0x5'));var fs=require('fs');var path=require(_0x4edb('0x6'));var rimraf=require(_0x4edb('0x7'));var config=require(_0x4edb('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x7dd1b4,_0x265fea){return _0x7dd1b4[_0x4edb('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x4edb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bfcdf,_0x4016fe,_0x46f9e0){if(_0x4bfcdf[_0x4edb('0xb')](_0x4edb('0xc'))){_0x4bfcdf[_0x4edb('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x46f9e0(null,_0x4bfcdf);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1d62903..37d8876 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 _0x1fd0=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','catch','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5c5e13,_0x4d8d53){var _0x5144d2=function(_0x3345a6){while(--_0x3345a6){_0x5c5e13['push'](_0x5c5e13['shift']());}};_0x5144d2(++_0x4d8d53);}(_0x1fd0,0x139));var _0x01fd=function(_0x18dadd,_0x31a4b6){_0x18dadd=_0x18dadd-0x0;var _0x4c2846=_0x1fd0[_0x18dadd];return _0x4c2846;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var moment=require('moment');var BPromise=require(_0x01fd('0x2'));var rs=require(_0x01fd('0x3'));var fs=require('fs');var Redis=require(_0x01fd('0x4'));var db=require(_0x01fd('0x5'))['db'];var utils=require(_0x01fd('0x6'));var logger=require(_0x01fd('0x7'))(_0x01fd('0x8'));var config=require(_0x01fd('0x9'));var jayson=require(_0x01fd('0xa'));var client=jayson[_0x01fd('0xb')]['http']({'port':0x232a});config[_0x01fd('0xc')]=_['defaults'](config[_0x01fd('0xc')],{'host':_0x01fd('0xd'),'port':0x18eb});var socket=require(_0x01fd('0xe'))(new Redis(config[_0x01fd('0xc')]));require(_0x01fd('0xf'))[_0x01fd('0x10')](socket);function respondWithRpcPromise(_0x378107,_0x41d0b9,_0x1b9407){return new BPromise(function(_0x5167fa,_0x53110a){return client[_0x01fd('0x11')](_0x378107,_0x1b9407)['then'](function(_0x3f83ef){logger[_0x01fd('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x41d0b9,'request\x20sent');logger[_0x01fd('0x13')](_0x01fd('0x14'),_0x41d0b9,_0x01fd('0x15'),JSON[_0x01fd('0x16')](_0x3f83ef));if(_0x3f83ef[_0x01fd('0x17')]){if(_0x3f83ef['error'][_0x01fd('0x18')]===0x1f4){logger[_0x01fd('0x17')](_0x01fd('0x19'),_0x41d0b9,_0x3f83ef[_0x01fd('0x17')][_0x01fd('0x1a')]);return _0x53110a(_0x3f83ef[_0x01fd('0x17')][_0x01fd('0x1a')]);}logger[_0x01fd('0x17')](_0x01fd('0x19'),_0x41d0b9,_0x3f83ef[_0x01fd('0x17')][_0x01fd('0x1a')]);return _0x5167fa(_0x3f83ef[_0x01fd('0x17')]['message']);}else{logger[_0x01fd('0x12')](_0x01fd('0x19'),_0x41d0b9,'request\x20sent');_0x5167fa(_0x3f83ef[_0x01fd('0x1b')][_0x01fd('0x1a')]);}})['catch'](function(_0x56ef1c){logger[_0x01fd('0x17')](_0x01fd('0x19'),_0x41d0b9,_0x56ef1c);_0x53110a(_0x56ef1c);});});}exports[_0x01fd('0x1c')]=function(_0x39657e){var _0x350b0b=this;return new Promise(function(_0x922e67,_0x1ea539){return db[_0x01fd('0x1d')][_0x01fd('0x1e')](_0x39657e[_0x01fd('0x1f')],{'raw':_0x39657e[_0x01fd('0x20')]?_0x39657e[_0x01fd('0x20')][_0x01fd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39657e[_0x01fd('0x20')]?_0x39657e[_0x01fd('0x20')][_0x01fd('0x22')]||null:null,'attributes':_0x39657e['options']?_0x39657e[_0x01fd('0x20')][_0x01fd('0x23')]||null:null,'limit':_0x39657e[_0x01fd('0x20')]?_0x39657e[_0x01fd('0x20')][_0x01fd('0x24')]||null:null})[_0x01fd('0x25')](function(_0x1a063a){logger[_0x01fd('0x12')]('UpdateWhatsappInteraction',_0x39657e);logger['debug'](_0x01fd('0x1c'),_0x39657e,JSON[_0x01fd('0x16')](_0x1a063a));_0x922e67(_0x1a063a);})[_0x01fd('0x26')](function(_0x5b9c43){logger[_0x01fd('0x17')](_0x01fd('0x1c'),_0x5b9c43[_0x01fd('0x1a')],_0x39657e);_0x1ea539(_0x350b0b[_0x01fd('0x17')](0x1f4,_0x5b9c43['message']));});});};exports[_0x01fd('0x27')]=function(_0x520ef8){return new Promise(function(_0x2701e9,_0x41e48c){return db[_0x01fd('0x1d')][_0x01fd('0x28')]({'where':_0x520ef8['options']?_0x520ef8['options']['where']||null:null})[_0x01fd('0x25')](function(_0x245d0c){if(_0x245d0c){return _0x245d0c[_0x01fd('0x29')](_0x520ef8['body'][_0x01fd('0x2a')],_[_0x01fd('0x2b')](_0x520ef8[_0x01fd('0x1f')],['ids','id'])||{});}})[_0x01fd('0x2c')](function(_0x3a21ae){logger[_0x01fd('0x12')](_0x01fd('0x2d'),_0x520ef8);logger[_0x01fd('0x13')](_0x01fd('0x2d'),_0x520ef8,JSON[_0x01fd('0x16')](_0x3a21ae));_0x2701e9(_0x3a21ae);})[_0x01fd('0x26')](function(_0x6812f1){logger[_0x01fd('0x17')](_0x01fd('0x2d'),_0x6812f1[_0x01fd('0x1a')],_0x520ef8);_0x41e48c(_this[_0x01fd('0x17')](0x1f4,_0x6812f1['message']));});});}; \ No newline at end of file +var _0x40a3=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','limit','debug','AddTagsToWhatsappInteraction','find','where','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x40a3,0x1c3));var _0x340a=function(_0x3803dc,_0xd6fee0){_0x3803dc=_0x3803dc-0x0;var _0x1eb3e0=_0x40a3[_0x3803dc];return _0x1eb3e0;};'use strict';var _=require(_0x340a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x340a('0x1'));var rs=require(_0x340a('0x2'));var fs=require('fs');var Redis=require(_0x340a('0x3'));var db=require(_0x340a('0x4'))['db'];var utils=require(_0x340a('0x5'));var logger=require(_0x340a('0x6'))('rpc');var config=require(_0x340a('0x7'));var jayson=require(_0x340a('0x8'));var client=jayson[_0x340a('0x9')][_0x340a('0xa')]({'port':0x232a});config[_0x340a('0xb')]=_[_0x340a('0xc')](config[_0x340a('0xb')],{'host':_0x340a('0xd'),'port':0x18eb});var socket=require(_0x340a('0xe'))(new Redis(config[_0x340a('0xb')]));require('./whatsappInteraction.socket')[_0x340a('0xf')](socket);function respondWithRpcPromise(_0x40804f,_0x5c2abd,_0x59817f){return new BPromise(function(_0x2cc3cc,_0x257fce){return client[_0x340a('0x10')](_0x40804f,_0x59817f)[_0x340a('0x11')](function(_0x59b182){logger[_0x340a('0x12')](_0x340a('0x13'),_0x5c2abd,_0x340a('0x14'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5c2abd,'request\x20sent',JSON[_0x340a('0x15')](_0x59b182));if(_0x59b182['error']){if(_0x59b182[_0x340a('0x16')][_0x340a('0x17')]===0x1f4){logger[_0x340a('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x5c2abd,_0x59b182[_0x340a('0x16')][_0x340a('0x18')]);return _0x257fce(_0x59b182[_0x340a('0x16')][_0x340a('0x18')]);}logger[_0x340a('0x16')](_0x340a('0x13'),_0x5c2abd,_0x59b182[_0x340a('0x16')]['message']);return _0x2cc3cc(_0x59b182[_0x340a('0x16')]['message']);}else{logger[_0x340a('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5c2abd,_0x340a('0x14'));_0x2cc3cc(_0x59b182[_0x340a('0x19')][_0x340a('0x18')]);}})[_0x340a('0x1a')](function(_0x30fe77){logger['error'](_0x340a('0x13'),_0x5c2abd,_0x30fe77);_0x257fce(_0x30fe77);});});}exports[_0x340a('0x1b')]=function(_0x574b11){var _0x5df964=this;return new Promise(function(_0x5d6433,_0x2df38f){return db[_0x340a('0x1c')][_0x340a('0x1d')](_0x574b11[_0x340a('0x1e')],{'raw':_0x574b11[_0x340a('0x1f')]?_0x574b11[_0x340a('0x1f')][_0x340a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x574b11[_0x340a('0x1f')]?_0x574b11['options']['where']||null:null,'attributes':_0x574b11[_0x340a('0x1f')]?_0x574b11['options']['attributes']||null:null,'limit':_0x574b11[_0x340a('0x1f')]?_0x574b11[_0x340a('0x1f')][_0x340a('0x21')]||null:null})[_0x340a('0x11')](function(_0x370c25){logger['info'](_0x340a('0x1b'),_0x574b11);logger[_0x340a('0x22')]('UpdateWhatsappInteraction',_0x574b11,JSON['stringify'](_0x370c25));_0x5d6433(_0x370c25);})['catch'](function(_0x66cab4){logger[_0x340a('0x16')](_0x340a('0x1b'),_0x66cab4[_0x340a('0x18')],_0x574b11);_0x2df38f(_0x5df964[_0x340a('0x16')](0x1f4,_0x66cab4[_0x340a('0x18')]));});});};exports[_0x340a('0x23')]=function(_0x1f9716){return new Promise(function(_0xc54979,_0x366691){return db[_0x340a('0x1c')][_0x340a('0x24')]({'where':_0x1f9716[_0x340a('0x1f')]?_0x1f9716['options'][_0x340a('0x25')]||null:null})[_0x340a('0x11')](function(_0x5f6d66){if(_0x5f6d66){return _0x5f6d66['addTags'](_0x1f9716[_0x340a('0x1e')][_0x340a('0x26')],_[_0x340a('0x27')](_0x1f9716['body'],[_0x340a('0x26'),'id'])||{});}})[_0x340a('0x28')](function(_0xce036b){logger[_0x340a('0x12')]('AddTags',_0x1f9716);logger[_0x340a('0x22')](_0x340a('0x29'),_0x1f9716,JSON[_0x340a('0x15')](_0xce036b));_0xc54979(_0xce036b);})[_0x340a('0x1a')](function(_0x378ab7){logger[_0x340a('0x16')](_0x340a('0x29'),_0x378ab7[_0x340a('0x18')],_0x1f9716);_0x366691(_this[_0x340a('0x16')](0x1f4,_0x378ab7[_0x340a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 554056b..a4c3322 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 _0xd78a=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','removeListener'];(function(_0x2fa06e,_0x228d80){var _0x2df3f2=function(_0xee7f60){while(--_0xee7f60){_0x2fa06e['push'](_0x2fa06e['shift']());}};_0x2df3f2(++_0x228d80);}(_0xd78a,0x158));var _0xad78=function(_0x2118bf,_0x21eea6){_0x2118bf=_0x2118bf-0x0;var _0x2beaca=_0xd78a[_0x2118bf];return _0x2beaca;};'use strict';var WhatsappInteractionEvents=require(_0xad78('0x0'));var events=['save',_0xad78('0x1'),_0xad78('0x2')];function createListener(_0x33d10d,_0x56bb88){return function(_0x34e4a6){_0x56bb88['emit'](_0x33d10d,_0x34e4a6);};}function removeListener(_0x4ad7e9,_0x1b737c){return function(){WhatsappInteractionEvents[_0xad78('0x3')](_0x4ad7e9,_0x1b737c);};}exports['register']=function(_0x44d1f9){for(var _0x5f28e7=0x0,_0x289cc6=events[_0xad78('0x4')];_0x5f28e7<_0x289cc6;_0x5f28e7++){var _0x4a5a74=events[_0x5f28e7];var _0x45c88c=createListener(_0xad78('0x5')+_0x4a5a74,_0x44d1f9);WhatsappInteractionEvents['on'](_0x4a5a74,_0x45c88c);}}; \ No newline at end of file +var _0x37de=['length','./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x37de,0x1c9));var _0xe37d=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x37de[_0x2b31a8];return _0x1175a5;};'use strict';var WhatsappInteractionEvents=require(_0xe37d('0x0'));var events=[_0xe37d('0x1'),_0xe37d('0x2'),_0xe37d('0x3')];function createListener(_0x2a6e4c,_0x1a61ac){return function(_0x203a9c){_0x1a61ac[_0xe37d('0x4')](_0x2a6e4c,_0x203a9c);};}function removeListener(_0xc0f355,_0x20f07f){return function(){WhatsappInteractionEvents[_0xe37d('0x5')](_0xc0f355,_0x20f07f);};}exports[_0xe37d('0x6')]=function(_0x11989e){for(var _0x403a7f=0x0,_0x5549d4=events[_0xe37d('0x7')];_0x403a7f<_0x5549d4;_0x403a7f++){var _0x323f4b=events[_0x403a7f];var _0x28a255=createListener('whatsappInteraction:'+_0x323f4b,_0x11989e);WhatsappInteractionEvents['on'](_0x323f4b,_0x28a255);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3cbf9a6..7f5d0af 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 _0x7075=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','show','tracked','whatsapp','whatsappmessage:create','/:id/status','status','/:id','update','accept','/:id/reject','reject','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7075,0x178));var _0x5707=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7075[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x5707('0x0'));var util=require(_0x5707('0x1'));var path=require(_0x5707('0x2'));var timeout=require(_0x5707('0x3'));var express=require(_0x5707('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5707('0x5'));var config=require(_0x5707('0x6'));var controller=require(_0x5707('0x7'));router['get']('/',auth[_0x5707('0x8')](),controller['index']);router[_0x5707('0x9')](_0x5707('0xa'),auth[_0x5707('0x8')](),controller['describe']);router[_0x5707('0x9')]('/:id',auth[_0x5707('0x8')](),controller[_0x5707('0xb')]);router['post']('/',auth[_0x5707('0x8')](),interaction[_0x5707('0xc')](_0x5707('0xd'),_0x5707('0xe')),controller['create']);router['post'](_0x5707('0xf'),controller[_0x5707('0x10')]);router['put'](_0x5707('0x11'),auth['isAuthenticated'](),controller[_0x5707('0x12')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x5707('0x13')]);router['put'](_0x5707('0x14'),auth[_0x5707('0x8')](),controller[_0x5707('0x15')]);router[_0x5707('0x16')](_0x5707('0x11'),auth[_0x5707('0x8')](),controller[_0x5707('0x17')]);module[_0x5707('0x18')]=router; \ No newline at end of file +var _0x9be7=['/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3d6bd3,_0x1ea55d){var _0x106abe=function(_0x125f4d){while(--_0x125f4d){_0x3d6bd3['push'](_0x3d6bd3['shift']());}};_0x106abe(++_0x1ea55d);}(_0x9be7,0x12b));var _0x79be=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x9be7[_0x86b219];return _0x1f320c;};'use strict';var multer=require(_0x79be('0x0'));var util=require(_0x79be('0x1'));var path=require(_0x79be('0x2'));var timeout=require(_0x79be('0x3'));var express=require(_0x79be('0x4'));var router=express[_0x79be('0x5')]();var auth=require(_0x79be('0x6'));var interaction=require(_0x79be('0x7'));var config=require(_0x79be('0x8'));var controller=require('./whatsappMessage.controller');router[_0x79be('0x9')]('/',auth['isAuthenticated'](),controller[_0x79be('0xa')]);router[_0x79be('0x9')](_0x79be('0xb'),auth[_0x79be('0xc')](),controller[_0x79be('0xd')]);router[_0x79be('0x9')](_0x79be('0xe'),auth[_0x79be('0xc')](),controller[_0x79be('0xf')]);router['post']('/',auth[_0x79be('0xc')](),interaction[_0x79be('0x10')](_0x79be('0x11'),_0x79be('0x12')),controller[_0x79be('0x13')]);router[_0x79be('0x14')](_0x79be('0x15'),controller[_0x79be('0x16')]);router['put'](_0x79be('0xe'),auth[_0x79be('0xc')](),controller[_0x79be('0x17')]);router[_0x79be('0x18')](_0x79be('0x19'),auth[_0x79be('0xc')](),controller[_0x79be('0x1a')]);router[_0x79be('0x18')](_0x79be('0x1b'),auth[_0x79be('0xc')](),controller['reject']);router[_0x79be('0x1c')](_0x79be('0xe'),auth[_0x79be('0xc')](),controller[_0x79be('0x1d')]);module[_0x79be('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 78c2ccc..6e1a67f 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 _0xb67f=['ENUM','out','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xb67f,0xb2));var _0xfb67=function(_0x28b1ff,_0x5ae328){_0x28b1ff=_0x28b1ff-0x0;var _0x4b5834=_0xb67f[_0x28b1ff];return _0x4b5834;};'use strict';var Sequelize=require('sequelize');module[_0xfb67('0x0')]={'body':{'type':Sequelize[_0xfb67('0x1')](_0xfb67('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfb67('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfb67('0x4')]('in',_0xfb67('0x5')),'defaultValue':_0xfb67('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfb67('0x6')](0xbe)},'phone':{'type':Sequelize[_0xfb67('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xfb67('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfb67('0x6')]},'providerResponse':{'type':Sequelize[_0xfb67('0x1')]}}; \ No newline at end of file +var _0xd84d=['DATE','sequelize','exports','TEXT','medium','out','STRING'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0xd84d,0x1eb));var _0xdd84=function(_0x24c9f6,_0x471429){_0x24c9f6=_0x24c9f6-0x0;var _0x1495f0=_0xd84d[_0x24c9f6];return _0x1495f0;};'use strict';var Sequelize=require(_0xdd84('0x0'));module[_0xdd84('0x1')]={'body':{'type':Sequelize[_0xdd84('0x2')](_0xdd84('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdd84('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdd84('0x5')](0xbe)},'phone':{'type':Sequelize[_0xdd84('0x5')]},'readAt':{'type':Sequelize[_0xdd84('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b04209c..f68d467 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 _0x14a0=['RejectMessage','rejectMessage','interface','SIP/%s','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','WhatsappMessage','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contact','WhatsappInteractionId','UserId','isNil','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','manual','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0xaf52f9,_0x3608bc){var _0xd9e03e=function(_0xaf82d3){while(--_0xaf82d3){_0xaf52f9['push'](_0xaf52f9['shift']());}};_0xd9e03e(++_0x3608bc);}(_0x14a0,0x8e));var _0x014a=function(_0x308eb3,_0x4bc21b){_0x308eb3=_0x308eb3-0x0;var _0x2fbf0a=_0x14a0[_0x308eb3];return _0x2fbf0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);var jayson=require(_0x014a('0x1a'));var client=jayson['client'][_0x014a('0x1b')]({'port':0x232c});var client9002=jayson[_0x014a('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a836f,_0x128c46,_0x59a4ea,_0x16e6fc){return new BPromise(function(_0x17e4be,_0x20f148){var _0x12da95=_0x16e6fc||client;return _0x12da95[_0x014a('0x1d')](_0x3a836f,_0x59a4ea)[_0x014a('0x1e')](function(_0x61ec9f){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x128c46,_0x014a('0x21'),JSON[_0x014a('0x24')](_0x61ec9f));if(_0x61ec9f['error']){if(_0x61ec9f[_0x014a('0x25')][_0x014a('0x26')]===0x1f4){logger[_0x014a('0x25')](_0x014a('0x20'),_0x128c46,_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);return _0x20f148(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}logger[_0x014a('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x128c46,_0x61ec9f[_0x014a('0x25')]['message']);return _0x17e4be(_0x61ec9f[_0x014a('0x25')][_0x014a('0x27')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x128c46,_0x014a('0x21'));_0x17e4be(_0x61ec9f[_0x014a('0x28')][_0x014a('0x27')]);}})[_0x014a('0x29')](function(_0x165a42){logger['error'](_0x014a('0x20'),_0x128c46,_0x165a42);_0x20f148(_0x165a42);});});}function respondWithStatusCode(_0x5358e9,_0x39a432){_0x39a432=_0x39a432||0xcc;return function(_0x28701e){if(_0x28701e){return _0x5358e9['sendStatus'](_0x39a432);}return _0x5358e9['status'](_0x39a432)[_0x014a('0x2a')]();};}function respondWithResult(_0x3f9719,_0x143346){_0x143346=_0x143346||0xc8;return function(_0x5ed71b){if(_0x5ed71b){return _0x3f9719[_0x014a('0x2b')](_0x143346)[_0x014a('0x2c')](_0x5ed71b);}};}function respondWithFilteredResult(_0x598179,_0x31dc95){return function(_0x2560a6){if(_0x2560a6){var _0x496040=_0x2560a6[_0x014a('0x2d')],_0x4f9c1c=_0x31dc95[_0x014a('0x2e')],_0x397850=_0x31dc95['offset']+_0x31dc95[_0x014a('0x2f')],_0x3e5a0a;if(_0x397850>=_0x496040){_0x397850=_0x496040;_0x3e5a0a=0xc8;}else{_0x3e5a0a=0xce;}_0x598179[_0x014a('0x2b')](_0x3e5a0a);return _0x598179[_0x014a('0x30')](_0x014a('0x31'),_0x4f9c1c+'-'+_0x397850+'/'+_0x496040)[_0x014a('0x2c')](_0x2560a6);}return null;};}function patchUpdates(_0x1eb007){return function(_0x354f4c){try{jsonpatch[_0x014a('0x32')](_0x354f4c,_0x1eb007,!![]);}catch(_0xc802d5){return BPromise[_0x014a('0x33')](_0xc802d5);}return _0x354f4c[_0x014a('0x34')]();};}function saveUpdates(_0x4ed54e,_0x105d4a){return function(_0x41ead8){if(_0x41ead8){return _0x41ead8[_0x014a('0x35')](_0x4ed54e)[_0x014a('0x1e')](function(_0x5f1022){return _0x5f1022;});}return null;};}function removeEntity(_0x39b3b8,_0x211d18){return function(_0x4dd025){if(_0x4dd025){return _0x4dd025[_0x014a('0x36')]()[_0x014a('0x1e')](function(){_0x39b3b8['status'](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x12de94,_0x40738f){return function(_0x467032){if(!_0x467032){_0x12de94[_0x014a('0x37')](0x194);}return _0x467032;};}function handleError(_0xa8fcfb,_0x26a5e8){_0x26a5e8=_0x26a5e8||0x1f4;return function(_0x1cff0f){logger['error'](_0x1cff0f[_0x014a('0x38')]);if(_0x1cff0f[_0x014a('0x39')]){delete _0x1cff0f[_0x014a('0x39')];}_0xa8fcfb[_0x014a('0x2b')](_0x26a5e8)['send'](_0x1cff0f);};}exports[_0x014a('0x3a')]=function(_0x978870,_0x27ee0c){var _0x157bd0={},_0x35e527={},_0x309925={'count':0x0,'rows':[]};var _0x128fb9=_[_0x014a('0x3b')](db[_0x014a('0x3c')]['rawAttributes'],function(_0x1b34f8){return{'name':_0x1b34f8['fieldName'],'type':_0x1b34f8[_0x014a('0x3d')][_0x014a('0x3e')]};});_0x35e527[_0x014a('0x3f')]=_[_0x014a('0x3b')](_0x128fb9,_0x014a('0x39'));_0x35e527['query']=_[_0x014a('0x40')](_0x978870[_0x014a('0x41')]);_0x35e527['filters']=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],_0x35e527[_0x014a('0x41')]);_0x157bd0[_0x014a('0x43')]=_[_0x014a('0x42')](_0x35e527[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x978870[_0x014a('0x41')][_0x014a('0x44')]));_0x157bd0['attributes']=_0x157bd0[_0x014a('0x43')][_0x014a('0x45')]?_0x157bd0[_0x014a('0x43')]:_0x35e527[_0x014a('0x3f')];if(!_0x978870['query'][_0x014a('0x46')](_0x014a('0x47'))){_0x157bd0[_0x014a('0x2f')]=qs[_0x014a('0x2f')](_0x978870[_0x014a('0x41')][_0x014a('0x2f')]);_0x157bd0['offset']=qs[_0x014a('0x2e')](_0x978870[_0x014a('0x41')]['offset']);}_0x157bd0[_0x014a('0x48')]=qs[_0x014a('0x49')](_0x978870[_0x014a('0x41')]['sort']);_0x157bd0[_0x014a('0x4a')]=qs['filters'](_['pick'](_0x978870[_0x014a('0x41')],_0x35e527[_0x014a('0x4b')]),_0x128fb9);if(_0x978870['query'][_0x014a('0x4c')]){_0x157bd0[_0x014a('0x4a')]=_[_0x014a('0x4d')](_0x157bd0[_0x014a('0x4a')],{'$or':_[_0x014a('0x3b')](_0x128fb9,function(_0xbaf8c6){if(_0xbaf8c6['type']!==_0x014a('0x4e')){var _0xb0d8e0={};_0xb0d8e0[_0xbaf8c6[_0x014a('0x39')]]={'$like':'%'+_0x978870['query']['filter']+'%'};return _0xb0d8e0;}})});}_0x157bd0=_[_0x014a('0x4d')]({},_0x157bd0,_0x978870['options']);var _0x489590={'where':_0x157bd0[_0x014a('0x4a')]};return db['WhatsappMessage'][_0x014a('0x2d')](_0x489590)[_0x014a('0x1e')](function(_0x36372d){_0x309925['count']=_0x36372d;if(_0x978870[_0x014a('0x41')][_0x014a('0x4f')]){_0x157bd0[_0x014a('0x50')]=[{'all':!![]}];}return db[_0x014a('0x3c')][_0x014a('0x51')](_0x157bd0);})[_0x014a('0x1e')](function(_0x559954){_0x309925[_0x014a('0x52')]=_0x559954;return _0x309925;})[_0x014a('0x1e')](respondWithFilteredResult(_0x27ee0c,_0x157bd0))['catch'](handleError(_0x27ee0c,null));};exports[_0x014a('0x53')]=function(_0x29345b,_0x20bb0c){var _0x324df7={'raw':!![],'where':{'id':_0x29345b[_0x014a('0x54')]['id']}},_0x40a9c1={};_0x40a9c1[_0x014a('0x3f')]=_[_0x014a('0x40')](db['WhatsappMessage'][_0x014a('0x55')]);_0x40a9c1[_0x014a('0x41')]=_[_0x014a('0x40')](_0x29345b[_0x014a('0x41')]);_0x40a9c1[_0x014a('0x4b')]=_['intersection'](_0x40a9c1[_0x014a('0x3f')],_0x40a9c1['query']);_0x324df7[_0x014a('0x43')]=_[_0x014a('0x42')](_0x40a9c1[_0x014a('0x3f')],qs[_0x014a('0x44')](_0x29345b[_0x014a('0x41')]['fields']));_0x324df7['attributes']=_0x324df7['attributes']['length']?_0x324df7[_0x014a('0x43')]:_0x40a9c1['model'];if(_0x29345b[_0x014a('0x41')]['includeAll']){_0x324df7['include']=[{'all':!![]}];}_0x324df7=_[_0x014a('0x4d')]({},_0x324df7,_0x29345b['options']);return db[_0x014a('0x3c')][_0x014a('0x56')](_0x324df7)[_0x014a('0x1e')](handleEntityNotFound(_0x20bb0c,null))[_0x014a('0x1e')](respondWithResult(_0x20bb0c,null))[_0x014a('0x29')](handleError(_0x20bb0c,null));};exports[_0x014a('0x57')]=function(_0x35a421,_0x46fa9d){return db[_0x014a('0x3c')][_0x014a('0x57')](_0x35a421['body'],{})['then'](respondWithResult(_0x46fa9d,0xc9))[_0x014a('0x29')](handleError(_0x46fa9d,null));};exports[_0x014a('0x35')]=function(_0x237345,_0x4cc246){if(_0x237345['body']['id']){delete _0x237345[_0x014a('0x58')]['id'];}return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x237345[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x1e')](saveUpdates(_0x237345['body'],null))[_0x014a('0x1e')](respondWithResult(_0x4cc246,null))[_0x014a('0x29')](handleError(_0x4cc246,null));};exports[_0x014a('0x36')]=function(_0x56c09b,_0xbaeb5f){return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x56c09b[_0x014a('0x54')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0xbaeb5f,null))[_0x014a('0x1e')](removeEntity(_0xbaeb5f,null))[_0x014a('0x29')](handleError(_0xbaeb5f,null));};exports[_0x014a('0x59')]=function(_0x4e9260,_0x889080){return db[_0x014a('0x3c')][_0x014a('0x59')]()['then'](respondWithResult(_0x889080,null))[_0x014a('0x29')](handleError(_0x889080,null));};var interaction_log=require(_0x014a('0xf'))(_0x014a('0x5a'));exports[_0x014a('0x5b')]=function(_0x11bf5c,_0x5da1f7,_0x8ac9cd){var _0x46168d={'channel':_0x014a('0x5c')};if(_0x11bf5c[_0x014a('0x58')]['id']){delete _0x11bf5c[_0x014a('0x58')]['id'];}_0x11bf5c[_0x014a('0x58')][_0x014a('0x5d')]=!![];_0x11bf5c[_0x014a('0x58')][_0x014a('0x5e')]=moment()[_0x014a('0x5f')](_0x014a('0x60'));_0x11bf5c[_0x014a('0x58')]['UserId']=_0x11bf5c[_0x014a('0x58')]['UserId']||_0x11bf5c['user']['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x11bf5c['params']['id'],'UserId':null},'include':[{'model':db[_0x014a('0x61')],'as':_0x014a('0x62')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))['then'](saveUpdates(_0x11bf5c[_0x014a('0x58')],null))[_0x014a('0x1e')](function(_0x3071c8){if(_0x3071c8){_0x46168d[_0x014a('0x27')]=_0x3071c8['get']({'plain':!![]});return db['WhatsappInteraction'][_0x014a('0x56')]({'where':{'id':_0x3071c8[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5da1f7,null))[_0x014a('0x1e')](function(_0x34c0b2){if(_0x34c0b2){return _0x34c0b2[_0x014a('0x35')]({'UserId':_0x11bf5c[_0x014a('0x58')][_0x014a('0x64')],'read1stAt':_[_0x014a('0x65')](_0x34c0b2[_0x014a('0x66')])?moment()[_0x014a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x014a('0x1e')](function(_0x25a53b){if(_0x25a53b){_0x46168d['interaction']=_0x25a53b[_0x014a('0x67')]({'plain':!![]});interaction_log[_0x014a('0x1f')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11bf5c[_0x014a('0x68')]['id'],_0x11bf5c['user'][_0x014a('0x39')],_0x11bf5c[_0x014a('0x68')][_0x014a('0x69')],_0x46168d[_0x014a('0x6a')]['id'],_0x11bf5c[_0x014a('0x58')]?JSON['stringify'](_0x11bf5c[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x6c'),_0x014a('0x6d'),_0x46168d);}return null;})[_0x014a('0x1e')](function(_0x52e79e){if(_0x52e79e){if(_0x11bf5c[_0x014a('0x58')][_0x014a('0x6e')]){_0x46168d[_0x014a('0x27')]['interface']=util[_0x014a('0x5f')]('SIP/%s',_0x11bf5c[_0x014a('0x68')][_0x014a('0x39')]);_0x46168d[_0x014a('0x27')][_0x014a('0x6f')]=_0x46168d[_0x014a('0x6f')];_0x46168d[_0x014a('0x27')][_0x014a('0x70')]='accept';return respondWithRpcPromise('EventManager',_0x014a('0x71'),{'event':'acceptmessage','message':_0x46168d[_0x014a('0x27')]},client9002)['then'](function(){return _0x46168d;});}return _0x46168d;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5da1f7,null))[_0x014a('0x29')](handleError(_0x5da1f7,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x014a('0x33')]=function(_0x8234ee,_0x5f391d,_0x882fc9){var _0x42e4e9={'agent':{},'channel':'whatsapp'};if(_0x8234ee['body']['id']){delete _0x8234ee[_0x014a('0x58')]['id'];}_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]=_0x8234ee[_0x014a('0x58')][_0x014a('0x64')]||_0x8234ee[_0x014a('0x68')]['id'];_0x42e4e9['agent']['id']=_0x8234ee[_0x014a('0x58')]['UserId'];return db['WhatsappMessage'][_0x014a('0x56')]({'where':{'id':_0x8234ee[_0x014a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x43165e){if(_0x43165e){_0x42e4e9[_0x014a('0x27')]=_0x43165e[_0x014a('0x67')]({'plain':!![]});return db[_0x014a('0x72')]['find']({'where':{'id':_0x43165e[_0x014a('0x63')]}});}return null;})[_0x014a('0x1e')](handleEntityNotFound(_0x5f391d,null))[_0x014a('0x1e')](function(_0x163fa2){if(_0x163fa2){_0x42e4e9['interaction']=_0x163fa2[_0x014a('0x67')]({'plain':!![]});interaction_log['info'](_0x014a('0x73'),_0x8234ee[_0x014a('0x68')]['id'],_0x8234ee[_0x014a('0x68')][_0x014a('0x39')],_0x8234ee[_0x014a('0x68')][_0x014a('0x69')],_0x42e4e9['interaction']['id'],_0x8234ee[_0x014a('0x58')]?JSON[_0x014a('0x24')](_0x8234ee[_0x014a('0x58')]):_0x014a('0x6b'));return respondWithRpcPromise(_0x014a('0x74'),_0x014a('0x75'),_0x42e4e9);}return null;})[_0x014a('0x1e')](function(_0x28a8a9){if(_0x28a8a9){_0x28a8a9['message'][_0x014a('0x76')]=util[_0x014a('0x5f')](_0x014a('0x77'),_0x8234ee['user'][_0x014a('0x39')]);_0x28a8a9[_0x014a('0x27')][_0x014a('0x6f')]=_0x42e4e9[_0x014a('0x6f')];_0x28a8a9[_0x014a('0x27')][_0x014a('0x70')]=_0x014a('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x28a8a9['message']},client9002);return _0x42e4e9;}return null;})[_0x014a('0x1e')](respondWithResult(_0x5f391d,null))[_0x014a('0x29')](handleError(_0x5f391d,null));};exports[_0x014a('0x2b')]=function(_0x3804e1,_0xe1b5ed,_0x7cd599){if(_0x3804e1[_0x014a('0x58')]['id']){delete _0x3804e1['body']['id'];}var _0x24ffb0;return db[_0x014a('0x3c')][_0x014a('0x56')]({'where':{'id':_0x3804e1[_0x014a('0x54')]['id']}})['then'](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x13e2fc){if(_0x13e2fc){_0x24ffb0=_0x13e2fc;return db[_0x014a('0x78')]['find']({'where':{'id':_0x13e2fc['WhatsappAccountId']}});}})[_0x014a('0x1e')](handleEntityNotFound(_0xe1b5ed,null))['then'](function(_0x5d4099){if(_0x5d4099){logger[_0x014a('0x22')](_0x014a('0x79'),'status',_0x014a('0x7a'),_0x5d4099[_0x014a('0x3d')],util[_0x014a('0x7b')](_0x3804e1[_0x014a('0x58')],{'showHidden':![],'depth':null}));switch(_0x5d4099[_0x014a('0x3d')]){case _0x014a('0x7c'):if(_0x3804e1[_0x014a('0x58')][_0x014a('0x7d')]&&_0x3804e1['body']['MessageSid']===_0x24ffb0[_0x014a('0x7e')]&&_0x3804e1['body']['MessageStatus']&&_0x3804e1['body'][_0x014a('0x7f')]===_0x014a('0x5d')){return _0x24ffb0[_0x014a('0x35')]({'read':!![]});}else{logger['error'](_0x014a('0x80'),_0x014a('0x2b'),_0x014a('0x7c'),util[_0x014a('0x7b')](_0x3804e1['body'],{'showHidden':![],'depth':null}));}break;}return _0x24ffb0;}})[_0x014a('0x1e')](respondWithResult(_0xe1b5ed,null))[_0x014a('0x29')](handleError(_0xe1b5ed,null));}; \ No newline at end of file +var _0x0b0e=['UserId','user','Contact','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','channel','event','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','request\x20sent','sendStatus','status','end','json','count','offset','limit','apply','save','update','destroy','then','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','rawAttributes','create','body','find','params','describe','../../config/logger','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0b0e[_0x469a3c];return _0x968f4;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];config[_0xe0b0('0x18')]=_[_0xe0b0('0x19')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x18')]));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);var jayson=require(_0xe0b0('0x1d'));var client=jayson[_0xe0b0('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xe0b0('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35cb40,_0xadee6e,_0x519ae8,_0x11fdca){return new BPromise(function(_0x4a4cc0,_0x2d6fb6){var _0x100204=_0x11fdca||client;return _0x100204['request'](_0x35cb40,_0x519ae8)['then'](function(_0x46bb44){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xadee6e,'request\x20sent');logger[_0xe0b0('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xadee6e,'request\x20sent',JSON[_0xe0b0('0x20')](_0x46bb44));if(_0x46bb44['error']){if(_0x46bb44[_0xe0b0('0x21')]['code']===0x1f4){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xadee6e,_0x46bb44[_0xe0b0('0x21')][_0xe0b0('0x23')]);return _0x2d6fb6(_0x46bb44[_0xe0b0('0x21')]['message']);}logger['error'](_0xe0b0('0x22'),_0xadee6e,_0x46bb44['error'][_0xe0b0('0x23')]);return _0x4a4cc0(_0x46bb44[_0xe0b0('0x21')]['message']);}else{logger[_0xe0b0('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0xadee6e,_0xe0b0('0x25'));_0x4a4cc0(_0x46bb44['result'][_0xe0b0('0x23')]);}})['catch'](function(_0x3e5c88){logger['error'](_0xe0b0('0x22'),_0xadee6e,_0x3e5c88);_0x2d6fb6(_0x3e5c88);});});}function respondWithStatusCode(_0x4aafbe,_0x3c221d){_0x3c221d=_0x3c221d||0xcc;return function(_0x5c5317){if(_0x5c5317){return _0x4aafbe[_0xe0b0('0x26')](_0x3c221d);}return _0x4aafbe[_0xe0b0('0x27')](_0x3c221d)[_0xe0b0('0x28')]();};}function respondWithResult(_0x1d91ad,_0x3ec2){_0x3ec2=_0x3ec2||0xc8;return function(_0x10745d){if(_0x10745d){return _0x1d91ad['status'](_0x3ec2)[_0xe0b0('0x29')](_0x10745d);}};}function respondWithFilteredResult(_0x1b8aa8,_0x5b7a64){return function(_0x15e13b){if(_0x15e13b){var _0x419b1f=_0x15e13b[_0xe0b0('0x2a')],_0x36d137=_0x5b7a64[_0xe0b0('0x2b')],_0x1d5759=_0x5b7a64['offset']+_0x5b7a64[_0xe0b0('0x2c')],_0x3cdbd5;if(_0x1d5759>=_0x419b1f){_0x1d5759=_0x419b1f;_0x3cdbd5=0xc8;}else{_0x3cdbd5=0xce;}_0x1b8aa8[_0xe0b0('0x27')](_0x3cdbd5);return _0x1b8aa8['set']('Content-Range',_0x36d137+'-'+_0x1d5759+'/'+_0x419b1f)[_0xe0b0('0x29')](_0x15e13b);}return null;};}function patchUpdates(_0x33e672){return function(_0x422575){try{jsonpatch[_0xe0b0('0x2d')](_0x422575,_0x33e672,!![]);}catch(_0x2ab1b1){return BPromise['reject'](_0x2ab1b1);}return _0x422575[_0xe0b0('0x2e')]();};}function saveUpdates(_0x3231fc,_0x7867c4){return function(_0x29d725){if(_0x29d725){return _0x29d725[_0xe0b0('0x2f')](_0x3231fc)['then'](function(_0x3ebf2a){return _0x3ebf2a;});}return null;};}function removeEntity(_0x208945,_0xfc51d3){return function(_0x31c6f5){if(_0x31c6f5){return _0x31c6f5[_0xe0b0('0x30')]()[_0xe0b0('0x31')](function(){_0x208945[_0xe0b0('0x27')](0xcc)[_0xe0b0('0x28')]();});}};}function handleEntityNotFound(_0x2125d5,_0x1dd010){return function(_0xd56467){if(!_0xd56467){_0x2125d5[_0xe0b0('0x26')](0x194);}return _0xd56467;};}function handleError(_0x1d35bc,_0x2a1c44){_0x2a1c44=_0x2a1c44||0x1f4;return function(_0xca25d){logger['error'](_0xca25d[_0xe0b0('0x32')]);if(_0xca25d[_0xe0b0('0x33')]){delete _0xca25d[_0xe0b0('0x33')];}_0x1d35bc[_0xe0b0('0x27')](_0x2a1c44)[_0xe0b0('0x34')](_0xca25d);};}exports[_0xe0b0('0x35')]=function(_0x12024d,_0x533fc7){var _0x521243={},_0x549d9a={},_0x5317df={'count':0x0,'rows':[]};var _0x26137c=_[_0xe0b0('0x36')](db[_0xe0b0('0x37')]['rawAttributes'],function(_0x2dd7e1){return{'name':_0x2dd7e1[_0xe0b0('0x38')],'type':_0x2dd7e1[_0xe0b0('0x39')][_0xe0b0('0x3a')]};});_0x549d9a['model']=_[_0xe0b0('0x36')](_0x26137c,_0xe0b0('0x33'));_0x549d9a[_0xe0b0('0x3b')]=_[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x3b')]);_0x549d9a[_0xe0b0('0x3d')]=_[_0xe0b0('0x3e')](_0x549d9a[_0xe0b0('0x3f')],_0x549d9a[_0xe0b0('0x3b')]);_0x521243['attributes']=_[_0xe0b0('0x3e')](_0x549d9a['model'],qs[_0xe0b0('0x40')](_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x40')]));_0x521243[_0xe0b0('0x41')]=_0x521243['attributes'][_0xe0b0('0x42')]?_0x521243[_0xe0b0('0x41')]:_0x549d9a[_0xe0b0('0x3f')];if(!_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x43')](_0xe0b0('0x44'))){_0x521243[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x12024d['query'][_0xe0b0('0x2c')]);_0x521243[_0xe0b0('0x2b')]=qs['offset'](_0x12024d['query'][_0xe0b0('0x2b')]);}_0x521243[_0xe0b0('0x45')]=qs['sort'](_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x46')]);_0x521243[_0xe0b0('0x47')]=qs[_0xe0b0('0x3d')](_[_0xe0b0('0x48')](_0x12024d['query'],_0x549d9a['filters']),_0x26137c);if(_0x12024d['query'][_0xe0b0('0x49')]){_0x521243[_0xe0b0('0x47')]=_['merge'](_0x521243[_0xe0b0('0x47')],{'$or':_[_0xe0b0('0x36')](_0x26137c,function(_0x14197b){if(_0x14197b[_0xe0b0('0x39')]!==_0xe0b0('0x4a')){var _0x5c6f94={};_0x5c6f94[_0x14197b['name']]={'$like':'%'+_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x49')]+'%'};return _0x5c6f94;}})});}_0x521243=_[_0xe0b0('0x4b')]({},_0x521243,_0x12024d[_0xe0b0('0x4c')]);var _0x1bf77d={'where':_0x521243['where']};return db[_0xe0b0('0x37')][_0xe0b0('0x2a')](_0x1bf77d)['then'](function(_0x50c805){_0x5317df['count']=_0x50c805;if(_0x12024d[_0xe0b0('0x3b')][_0xe0b0('0x4d')]){_0x521243[_0xe0b0('0x4e')]=[{'all':!![]}];}return db[_0xe0b0('0x37')]['findAll'](_0x521243);})[_0xe0b0('0x31')](function(_0x87d8f3){_0x5317df['rows']=_0x87d8f3;return _0x5317df;})['then'](respondWithFilteredResult(_0x533fc7,_0x521243))[_0xe0b0('0x4f')](handleError(_0x533fc7,null));};exports[_0xe0b0('0x50')]=function(_0x497f4f,_0x2b1917){var _0x27fd31={'raw':!![],'where':{'id':_0x497f4f['params']['id']}},_0x504284={};_0x504284[_0xe0b0('0x3f')]=_['keys'](db[_0xe0b0('0x37')][_0xe0b0('0x51')]);_0x504284[_0xe0b0('0x3b')]=_[_0xe0b0('0x3c')](_0x497f4f[_0xe0b0('0x3b')]);_0x504284[_0xe0b0('0x3d')]=_['intersection'](_0x504284['model'],_0x504284[_0xe0b0('0x3b')]);_0x27fd31['attributes']=_['intersection'](_0x504284[_0xe0b0('0x3f')],qs[_0xe0b0('0x40')](_0x497f4f['query']['fields']));_0x27fd31[_0xe0b0('0x41')]=_0x27fd31[_0xe0b0('0x41')][_0xe0b0('0x42')]?_0x27fd31[_0xe0b0('0x41')]:_0x504284[_0xe0b0('0x3f')];if(_0x497f4f[_0xe0b0('0x3b')][_0xe0b0('0x4d')]){_0x27fd31['include']=[{'all':!![]}];}_0x27fd31=_[_0xe0b0('0x4b')]({},_0x27fd31,_0x497f4f['options']);return db[_0xe0b0('0x37')]['find'](_0x27fd31)['then'](handleEntityNotFound(_0x2b1917,null))[_0xe0b0('0x31')](respondWithResult(_0x2b1917,null))[_0xe0b0('0x4f')](handleError(_0x2b1917,null));};exports[_0xe0b0('0x52')]=function(_0x2f1712,_0x3d8013){return db[_0xe0b0('0x37')][_0xe0b0('0x52')](_0x2f1712[_0xe0b0('0x53')],{})[_0xe0b0('0x31')](respondWithResult(_0x3d8013,0xc9))['catch'](handleError(_0x3d8013,null));};exports[_0xe0b0('0x2f')]=function(_0x57ccc9,_0x2b5553){if(_0x57ccc9[_0xe0b0('0x53')]['id']){delete _0x57ccc9[_0xe0b0('0x53')]['id'];}return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x57ccc9[_0xe0b0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b5553,null))[_0xe0b0('0x31')](saveUpdates(_0x57ccc9[_0xe0b0('0x53')],null))[_0xe0b0('0x31')](respondWithResult(_0x2b5553,null))[_0xe0b0('0x4f')](handleError(_0x2b5553,null));};exports[_0xe0b0('0x30')]=function(_0x3b015e,_0x234cb7){return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x3b015e[_0xe0b0('0x55')]['id']}})[_0xe0b0('0x31')](handleEntityNotFound(_0x234cb7,null))[_0xe0b0('0x31')](removeEntity(_0x234cb7,null))[_0xe0b0('0x4f')](handleError(_0x234cb7,null));};exports[_0xe0b0('0x56')]=function(_0xcdf97,_0x34c642){return db[_0xe0b0('0x37')][_0xe0b0('0x56')]()['then'](respondWithResult(_0x34c642,null))[_0xe0b0('0x4f')](handleError(_0x34c642,null));};var interaction_log=require(_0xe0b0('0x57'))(_0xe0b0('0x58'));exports[_0xe0b0('0x59')]=function(_0x3916ab,_0x405d7e,_0x2bdb59){var _0x4f818b={'channel':'whatsapp'};if(_0x3916ab[_0xe0b0('0x53')]['id']){delete _0x3916ab[_0xe0b0('0x53')]['id'];}_0x3916ab[_0xe0b0('0x53')]['read']=!![];_0x3916ab[_0xe0b0('0x53')][_0xe0b0('0x5a')]=moment()[_0xe0b0('0x5b')](_0xe0b0('0x5c'));_0x3916ab[_0xe0b0('0x53')]['UserId']=_0x3916ab[_0xe0b0('0x53')][_0xe0b0('0x5d')]||_0x3916ab[_0xe0b0('0x5e')]['id'];return db['WhatsappMessage'][_0xe0b0('0x54')]({'where':{'id':_0x3916ab[_0xe0b0('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xe0b0('0x5f')}]})['then'](handleEntityNotFound(_0x405d7e,null))['then'](saveUpdates(_0x3916ab[_0xe0b0('0x53')],null))['then'](function(_0x4d75e4){if(_0x4d75e4){_0x4f818b[_0xe0b0('0x23')]=_0x4d75e4[_0xe0b0('0x60')]({'plain':!![]});return db[_0xe0b0('0x61')][_0xe0b0('0x54')]({'where':{'id':_0x4d75e4['WhatsappInteractionId']}});}return null;})[_0xe0b0('0x31')](handleEntityNotFound(_0x405d7e,null))[_0xe0b0('0x31')](function(_0x3e7fb4){if(_0x3e7fb4){return _0x3e7fb4[_0xe0b0('0x2f')]({'UserId':_0x3916ab[_0xe0b0('0x53')][_0xe0b0('0x5d')],'read1stAt':_[_0xe0b0('0x62')](_0x3e7fb4[_0xe0b0('0x63')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe0b0('0x31')](function(_0x35144f){if(_0x35144f){_0x4f818b[_0xe0b0('0x64')]=_0x35144f['get']({'plain':!![]});interaction_log['info'](_0xe0b0('0x65'),_0x3916ab[_0xe0b0('0x5e')]['id'],_0x3916ab['user']['name'],_0x3916ab[_0xe0b0('0x5e')][_0xe0b0('0x66')],_0x4f818b[_0xe0b0('0x64')]['id'],_0x3916ab[_0xe0b0('0x53')]?JSON[_0xe0b0('0x20')](_0x3916ab[_0xe0b0('0x53')]):_0xe0b0('0x67'));return respondWithRpcPromise(_0xe0b0('0x68'),'acceptMessage',_0x4f818b);}return null;})[_0xe0b0('0x31')](function(_0x12e245){if(_0x12e245){if(_0x3916ab[_0xe0b0('0x53')]['manual']){_0x4f818b['message']['interface']=util['format']('SIP/%s',_0x3916ab['user'][_0xe0b0('0x33')]);_0x4f818b['message']['channel']=_0x4f818b[_0xe0b0('0x69')];_0x4f818b[_0xe0b0('0x23')][_0xe0b0('0x6a')]=_0xe0b0('0x59');return respondWithRpcPromise(_0xe0b0('0x6b'),_0xe0b0('0x6b'),{'event':_0xe0b0('0x6c'),'message':_0x4f818b[_0xe0b0('0x23')]},client9002)['then'](function(){return _0x4f818b;});}return _0x4f818b;}return null;})[_0xe0b0('0x31')](respondWithResult(_0x405d7e,null))[_0xe0b0('0x4f')](handleError(_0x405d7e,null));};var interaction_log=require(_0xe0b0('0x57'))(_0xe0b0('0x58'));exports[_0xe0b0('0x6d')]=function(_0x1f70fb,_0x16a2ae,_0x5e3e28){var _0xaf2607={'agent':{},'channel':'whatsapp'};if(_0x1f70fb[_0xe0b0('0x53')]['id']){delete _0x1f70fb[_0xe0b0('0x53')]['id'];}_0x1f70fb[_0xe0b0('0x53')][_0xe0b0('0x5d')]=_0x1f70fb['body'][_0xe0b0('0x5d')]||_0x1f70fb[_0xe0b0('0x5e')]['id'];_0xaf2607['agent']['id']=_0x1f70fb['body'][_0xe0b0('0x5d')];return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x1f70fb[_0xe0b0('0x55')]['id'],'UserId':null}})[_0xe0b0('0x31')](handleEntityNotFound(_0x16a2ae,null))[_0xe0b0('0x31')](function(_0x34f4ff){if(_0x34f4ff){_0xaf2607[_0xe0b0('0x23')]=_0x34f4ff[_0xe0b0('0x60')]({'plain':!![]});return db[_0xe0b0('0x61')]['find']({'where':{'id':_0x34f4ff['WhatsappInteractionId']}});}return null;})[_0xe0b0('0x31')](handleEntityNotFound(_0x16a2ae,null))['then'](function(_0x57d19e){if(_0x57d19e){_0xaf2607['interaction']=_0x57d19e['get']({'plain':!![]});interaction_log[_0xe0b0('0x24')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f70fb[_0xe0b0('0x5e')]['id'],_0x1f70fb[_0xe0b0('0x5e')][_0xe0b0('0x33')],_0x1f70fb[_0xe0b0('0x5e')]['role'],_0xaf2607[_0xe0b0('0x64')]['id'],_0x1f70fb[_0xe0b0('0x53')]?JSON['stringify'](_0x1f70fb[_0xe0b0('0x53')]):_0xe0b0('0x67'));return respondWithRpcPromise(_0xe0b0('0x6e'),_0xe0b0('0x6f'),_0xaf2607);}return null;})[_0xe0b0('0x31')](function(_0x5cc4fc){if(_0x5cc4fc){_0x5cc4fc['message']['interface']=util['format']('SIP/%s',_0x1f70fb[_0xe0b0('0x5e')]['name']);_0x5cc4fc[_0xe0b0('0x23')]['channel']=_0xaf2607[_0xe0b0('0x69')];_0x5cc4fc[_0xe0b0('0x23')][_0xe0b0('0x6a')]=_0xe0b0('0x6d');respondWithRpcPromise(_0xe0b0('0x6b'),_0xe0b0('0x6b'),{'event':'rejectmessage','message':_0x5cc4fc['message']},client9002);return _0xaf2607;}return null;})['then'](respondWithResult(_0x16a2ae,null))['catch'](handleError(_0x16a2ae,null));};exports[_0xe0b0('0x27')]=function(_0x261381,_0x264363,_0x4377f7){if(_0x261381[_0xe0b0('0x53')]['id']){delete _0x261381['body']['id'];}var _0x234716;return db[_0xe0b0('0x37')][_0xe0b0('0x54')]({'where':{'id':_0x261381[_0xe0b0('0x55')]['id']}})[_0xe0b0('0x31')](handleEntityNotFound(_0x264363,null))[_0xe0b0('0x31')](function(_0x3ef24a){if(_0x3ef24a){_0x234716=_0x3ef24a;return db[_0xe0b0('0x70')][_0xe0b0('0x54')]({'where':{'id':_0x3ef24a['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x264363,null))[_0xe0b0('0x31')](function(_0x1f15e4){if(_0x1f15e4){logger['debug'](_0xe0b0('0x71'),_0xe0b0('0x27'),_0xe0b0('0x72'),_0x1f15e4[_0xe0b0('0x39')],util[_0xe0b0('0x73')](_0x261381[_0xe0b0('0x53')],{'showHidden':![],'depth':null}));switch(_0x1f15e4[_0xe0b0('0x39')]){case _0xe0b0('0x74'):if(_0x261381['body']['MessageSid']&&_0x261381['body'][_0xe0b0('0x75')]===_0x234716[_0xe0b0('0x76')]&&_0x261381['body'][_0xe0b0('0x77')]&&_0x261381[_0xe0b0('0x53')][_0xe0b0('0x77')]===_0xe0b0('0x78')){return _0x234716['update']({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe0b0('0x27'),_0xe0b0('0x74'),util['inspect'](_0x261381[_0xe0b0('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x234716;}})[_0xe0b0('0x31')](respondWithResult(_0x264363,null))['catch'](handleError(_0x264363,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ba2720d..c0fc779 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(_0x1c0f7d,_0x3e659a){var _0x322cd5=function(_0x3007f7){while(--_0x3007f7){_0x1c0f7d['push'](_0x1c0f7d['shift']());}};_0x322cd5(++_0x3e659a);}(_0xb10b,0x12a));var _0xbb10=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xb10b[_0x350aeb];return _0x3c5273;};'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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5af300,_0x23d6de){var _0x1feb54=function(_0x3c31aa){while(--_0x3c31aa){_0x5af300['push'](_0x5af300['shift']());}};_0x1feb54(++_0x23d6de);}(_0x7a54,0x106));var _0x47a5=function(_0x27a8e3,_0x3e67bd){_0x27a8e3=_0x27a8e3-0x0;var _0x4451f8=_0x7a54[_0x27a8e3];return _0x4451f8;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 95b1b5b..18bc26b 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 _0x18dc=['api','moment','bluebird','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','findOne','createdAt','catch','error','find','then','type','twilio','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','lodash','util'];(function(_0x16ee48,_0x4e660d){var _0x23f7bf=function(_0x31464e){while(--_0x31464e){_0x16ee48['push'](_0x16ee48['shift']());}};_0x23f7bf(++_0x4e660d);}(_0x18dc,0xcb));var _0xc18d=function(_0x4009c4,_0x3f7222){_0x4009c4=_0x4009c4-0x0;var _0x4e8ef7=_0x18dc[_0x4009c4];return _0x4e8ef7;};'use strict';var _=require(_0xc18d('0x0'));var util=require(_0xc18d('0x1'));var logger=require('../../config/logger')(_0xc18d('0x2'));var moment=require(_0xc18d('0x3'));var BPromise=require(_0xc18d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc18d('0x5'));var attributes=require(_0xc18d('0x6'));module[_0xc18d('0x7')]=function(_0x2e4d8d,_0x162590){return _0x2e4d8d[_0xc18d('0x8')](_0xc18d('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xc18d('0xa'),'fields':[_0xc18d('0xb')],'type':_0xc18d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd89820,_0x7e26a6,_0x137d1d){var _0x4caa2b=_0x2e4d8d['models'];var _0x4c0a63=_0xd89820[_0xc18d('0xd')]({'plain':!![]});if(_0x4c0a63[_0xc18d('0xe')]['toLowerCase']()==='in'||_0x4c0a63['direction'][_0xc18d('0xf')]()===_0xc18d('0x10')&&!_0x4c0a63[_0xc18d('0x11')]&&!_['isNil'](_0x4c0a63[_0xc18d('0x12')])){_0x4caa2b['WhatsappInteraction'][_0xc18d('0x13')]({'where':{'id':_0x4c0a63['WhatsappInteractionId']}})['then'](function(_0xcd7b19){if(_0xcd7b19){_0xcd7b19['update']({'lastMsgAt':_0x4c0a63[_0xc18d('0x14')],'lastMsgDirection':_0x4c0a63[_0xc18d('0xe')][_0xc18d('0xf')]()});}})[_0xc18d('0x15')](function(_0x22d61d){console[_0xc18d('0x16')](_0x22d61d);});}if(_0x4c0a63['direction']===_0xc18d('0x10')&&!_0x4c0a63[_0xc18d('0x11')]){var _0x438dd3;_0x4caa2b['WhatsappAccount'][_0xc18d('0x17')]({'where':{'id':_0x4c0a63['WhatsappAccountId']},'raw':!![]})[_0xc18d('0x18')](function(_0x281cd4){_0x438dd3=_0x281cd4;if(_0x438dd3&&_0x438dd3['type']){switch(_0x438dd3[_0xc18d('0x19')]){case _0xc18d('0x1a'):var _0x17b16b=require('twilio');if(_0x438dd3['accountSid']&&_0x438dd3[_0xc18d('0x1b')]&&_0x438dd3[_0xc18d('0x1c')]){var _0x50eaae=new _0x17b16b(_0x438dd3['accountSid'],_0x438dd3[_0xc18d('0x1b')]);_0x50eaae[_0xc18d('0x1d')][_0xc18d('0x1e')]({'body':_0x4c0a63[_0xc18d('0xb')],'to':_0xc18d('0x1f')+_0x4c0a63[_0xc18d('0x1c')],'from':_0xc18d('0x1f')+_0x438dd3[_0xc18d('0x1c')],'statusCallback':_0x438dd3[_0xc18d('0x20')]+_0xc18d('0x21')+_0x4c0a63['id']+'/status?token='+_0x438dd3[_0xc18d('0x22')]})[_0xc18d('0x18')](function(_0x1e9544){if(_0x1e9544[_0xc18d('0x23')]){return _0xd89820['update']({'messageId':_0x1e9544[_0xc18d('0x23')]});}})[_0xc18d('0x15')](function(_0x5a79e8){logger[_0xc18d('0x16')](_0xc18d('0x24'),_0xc18d('0x25'),_0xc18d('0x1a'),util[_0xc18d('0x26')](_0x5a79e8,{'showHidden':![],'depth':null}));});}else{logger[_0xc18d('0x16')](_0xc18d('0x24'),'afterCreate',_0xc18d('0x1a'),_0xc18d('0x27'));}break;}}})['finally'](function(){_0x137d1d();});}else{_0x137d1d();}}},'charset':_0xc18d('0x28'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe40f=['WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','secret','UserId','WhatsappInteractionId','then','update','createdAt','catch','error','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','inspect'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe40f,0x11f));var _0xfe40=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe40f[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xfe40('0x0'));var util=require(_0xfe40('0x1'));var logger=require(_0xfe40('0x2'))(_0xfe40('0x3'));var moment=require(_0xfe40('0x4'));var BPromise=require(_0xfe40('0x5'));var rp=require(_0xfe40('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe40('0x7'));var config=require(_0xfe40('0x8'));var attributes=require(_0xfe40('0x9'));module[_0xfe40('0xa')]=function(_0x451d37,_0x1e0df2){return _0x451d37[_0xfe40('0xb')](_0xfe40('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xfe40('0xd'),'fields':[_0xfe40('0xd')]},{'name':_0xfe40('0xe'),'fields':[_0xfe40('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4033a3,_0x59018b,_0x2d58d5){var _0x2b977c=_0x451d37['models'];var _0x146b4b=_0x4033a3[_0xfe40('0x10')]({'plain':!![]});if(_0x146b4b[_0xfe40('0x11')][_0xfe40('0x12')]()==='in'||_0x146b4b[_0xfe40('0x11')][_0xfe40('0x12')]()===_0xfe40('0x13')&&!_0x146b4b[_0xfe40('0x14')]&&!_['isNil'](_0x146b4b[_0xfe40('0x15')])){_0x2b977c['WhatsappInteraction']['findOne']({'where':{'id':_0x146b4b[_0xfe40('0x16')]}})[_0xfe40('0x17')](function(_0x2726ad){if(_0x2726ad){_0x2726ad[_0xfe40('0x18')]({'lastMsgAt':_0x146b4b[_0xfe40('0x19')],'lastMsgDirection':_0x146b4b[_0xfe40('0x11')][_0xfe40('0x12')]()});}})[_0xfe40('0x1a')](function(_0x891a82){console[_0xfe40('0x1b')](_0x891a82);});}if(_0x146b4b[_0xfe40('0x11')]==='out'&&!_0x146b4b[_0xfe40('0x14')]){var _0x2fa3ea;_0x2b977c['WhatsappAccount']['find']({'where':{'id':_0x146b4b['WhatsappAccountId']},'raw':!![]})[_0xfe40('0x17')](function(_0x4df390){_0x2fa3ea=_0x4df390;if(_0x2fa3ea&&_0x2fa3ea[_0xfe40('0x1c')]){switch(_0x2fa3ea[_0xfe40('0x1c')]){case _0xfe40('0x1d'):var _0x2a7d78=require(_0xfe40('0x1d'));if(_0x2fa3ea[_0xfe40('0x1e')]&&_0x2fa3ea[_0xfe40('0x1f')]&&_0x2fa3ea[_0xfe40('0x20')]){var _0x2ab936=new _0x2a7d78(_0x2fa3ea[_0xfe40('0x1e')],_0x2fa3ea['authToken']);_0x2ab936[_0xfe40('0x21')][_0xfe40('0x22')]({'body':_0x146b4b[_0xfe40('0xf')],'to':_0xfe40('0x23')+_0x146b4b[_0xfe40('0x20')],'from':_0xfe40('0x23')+_0x2fa3ea[_0xfe40('0x20')],'statusCallback':_0x2fa3ea[_0xfe40('0x24')]+_0xfe40('0x25')+_0x146b4b['id']+_0xfe40('0x26')+_0x2fa3ea['token']})[_0xfe40('0x17')](function(_0x22ba2f){if(_0x22ba2f[_0xfe40('0x27')]){return _0x4033a3[_0xfe40('0x18')]({'messageId':_0x22ba2f['sid']});}})['catch'](function(_0x43f85d){logger[_0xfe40('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfe40('0x28'),'twilio',util[_0xfe40('0x29')](_0x43f85d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfe40('0x2a'),_0xfe40('0x28'),_0xfe40('0x1d'),_0xfe40('0x2b'));}break;}}})[_0xfe40('0x2c')](function(){_0x2d58d5();});}else{_0x2d58d5();}}},'charset':_0xfe40('0x2d'),'collate':_0xfe40('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 13049e5..92bd03b 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 _0x3162=['then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','request'];(function(_0x54e4fd,_0x4059d4){var _0x50cbb2=function(_0x47549d){while(--_0x47549d){_0x54e4fd['push'](_0x54e4fd['shift']());}};_0x50cbb2(++_0x4059d4);}(_0x3162,0xa0));var _0x2316=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x3162[_0x1ceb7b];return _0x57c016;};'use strict';var _=require(_0x2316('0x0'));var util=require(_0x2316('0x1'));var moment=require(_0x2316('0x2'));var BPromise=require(_0x2316('0x3'));var rs=require(_0x2316('0x4'));var fs=require('fs');var Redis=require(_0x2316('0x5'));var db=require(_0x2316('0x6'))['db'];var utils=require(_0x2316('0x7'));var logger=require(_0x2316('0x8'))(_0x2316('0x9'));var config=require(_0x2316('0xa'));var jayson=require(_0x2316('0xb'));var client=jayson[_0x2316('0xc')][_0x2316('0xd')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2316('0xe'),'port':0x18eb});var socket=require(_0x2316('0xf'))(new Redis(config[_0x2316('0x10')]));require(_0x2316('0x11'))[_0x2316('0x12')](socket);function respondWithRpcPromise(_0x389565,_0x5dec72,_0x58ac80){return new BPromise(function(_0x1c6b30,_0x162bcc){return client[_0x2316('0x13')](_0x389565,_0x58ac80)[_0x2316('0x14')](function(_0x6840e9){logger[_0x2316('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5dec72,_0x2316('0x16'));logger[_0x2316('0x17')](_0x2316('0x18'),_0x5dec72,'request\x20sent',JSON[_0x2316('0x19')](_0x6840e9));if(_0x6840e9['error']){if(_0x6840e9['error'][_0x2316('0x1a')]===0x1f4){logger[_0x2316('0x1b')](_0x2316('0x1c'),_0x5dec72,_0x6840e9['error']['message']);return _0x162bcc(_0x6840e9[_0x2316('0x1b')][_0x2316('0x1d')]);}logger[_0x2316('0x1b')](_0x2316('0x1c'),_0x5dec72,_0x6840e9['error'][_0x2316('0x1d')]);return _0x1c6b30(_0x6840e9[_0x2316('0x1b')][_0x2316('0x1d')]);}else{logger[_0x2316('0x15')](_0x2316('0x1c'),_0x5dec72,_0x2316('0x16'));_0x1c6b30(_0x6840e9[_0x2316('0x1e')][_0x2316('0x1d')]);}})[_0x2316('0x1f')](function(_0x5d17f9){logger[_0x2316('0x1b')](_0x2316('0x1c'),_0x5dec72,_0x5d17f9);_0x162bcc(_0x5d17f9);});});}exports[_0x2316('0x20')]=function(_0xa5673a){var _0xabd1de=this;return new Promise(function(_0x463f22,_0x4175ed){return db[_0x2316('0x21')][_0x2316('0x22')](_0xa5673a['body'],{'raw':_0xa5673a[_0x2316('0x23')]?_0xa5673a['options']['raw']===undefined?!![]:![]:!![]})[_0x2316('0x14')](function(_0x194ebe){logger[_0x2316('0x15')](_0x2316('0x20'),_0xa5673a);logger['debug'](_0x2316('0x20'),_0xa5673a,JSON[_0x2316('0x19')](_0x194ebe));_0x463f22(_0x194ebe);})[_0x2316('0x1f')](function(_0x5ae2af){logger['error'](_0x2316('0x20'),_0x5ae2af[_0x2316('0x1d')],_0xa5673a);_0x4175ed(_0xabd1de['error'](0x1f4,_0x5ae2af[_0x2316('0x1d')]));});});}; \ No newline at end of file +var _0x8ca4=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ca4,0x1ba));var _0x48ca=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x8ca4[_0x447ef1];return _0x3d72ec;};'use strict';var _=require(_0x48ca('0x0'));var util=require(_0x48ca('0x1'));var moment=require('moment');var BPromise=require(_0x48ca('0x2'));var rs=require(_0x48ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48ca('0x4'))['db'];var utils=require(_0x48ca('0x5'));var logger=require(_0x48ca('0x6'))(_0x48ca('0x7'));var config=require(_0x48ca('0x8'));var jayson=require(_0x48ca('0x9'));var client=jayson['client'][_0x48ca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x48ca('0xb'))(new Redis(config[_0x48ca('0xc')]));require(_0x48ca('0xd'))[_0x48ca('0xe')](socket);function respondWithRpcPromise(_0x17c23e,_0x2ae5cd,_0x24214d){return new BPromise(function(_0x4035dc,_0x263101){return client[_0x48ca('0xf')](_0x17c23e,_0x24214d)[_0x48ca('0x10')](function(_0x5e57d9){logger[_0x48ca('0x11')](_0x48ca('0x12'),_0x2ae5cd,_0x48ca('0x13'));logger[_0x48ca('0x14')](_0x48ca('0x15'),_0x2ae5cd,_0x48ca('0x13'),JSON[_0x48ca('0x16')](_0x5e57d9));if(_0x5e57d9[_0x48ca('0x17')]){if(_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x18')]===0x1f4){logger[_0x48ca('0x17')](_0x48ca('0x12'),_0x2ae5cd,_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);return _0x263101(_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);}logger['error'](_0x48ca('0x12'),_0x2ae5cd,_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);return _0x4035dc(_0x5e57d9[_0x48ca('0x17')][_0x48ca('0x19')]);}else{logger[_0x48ca('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2ae5cd,_0x48ca('0x13'));_0x4035dc(_0x5e57d9[_0x48ca('0x1a')]['message']);}})[_0x48ca('0x1b')](function(_0x1fb69d){logger['error'](_0x48ca('0x12'),_0x2ae5cd,_0x1fb69d);_0x263101(_0x1fb69d);});});}exports[_0x48ca('0x1c')]=function(_0x1aae47){var _0x455601=this;return new Promise(function(_0x4eb25f,_0x18946d){return db['WhatsappMessage'][_0x48ca('0x1d')](_0x1aae47[_0x48ca('0x1e')],{'raw':_0x1aae47[_0x48ca('0x1f')]?_0x1aae47[_0x48ca('0x1f')][_0x48ca('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x1b95df){logger['info'](_0x48ca('0x1c'),_0x1aae47);logger[_0x48ca('0x14')](_0x48ca('0x1c'),_0x1aae47,JSON['stringify'](_0x1b95df));_0x4eb25f(_0x1b95df);})[_0x48ca('0x1b')](function(_0x1a6d47){logger[_0x48ca('0x17')](_0x48ca('0x1c'),_0x1a6d47[_0x48ca('0x19')],_0x1aae47);_0x18946d(_0x455601[_0x48ca('0x17')](0x1f4,_0x1a6d47['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c08ff88..24b9c48 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 _0x9664=['./whatsappMessage.events','update','emit','removeListener','length','whatsappMessage:'];(function(_0x5bf992,_0x533b26){var _0x288176=function(_0x55cb59){while(--_0x55cb59){_0x5bf992['push'](_0x5bf992['shift']());}};_0x288176(++_0x533b26);}(_0x9664,0x126));var _0x4966=function(_0x5b0fc7,_0x4e34ed){_0x5b0fc7=_0x5b0fc7-0x0;var _0xb806a=_0x9664[_0x5b0fc7];return _0xb806a;};'use strict';var WhatsappMessageEvents=require(_0x4966('0x0'));var events=['save','remove',_0x4966('0x1')];function createListener(_0x996756,_0x454343){return function(_0x26921c){_0x454343[_0x4966('0x2')](_0x996756,_0x26921c);};}function removeListener(_0x41cc95,_0x4a7a22){return function(){WhatsappMessageEvents[_0x4966('0x3')](_0x41cc95,_0x4a7a22);};}exports['register']=function(_0x39b3c0){for(var _0x3d2338=0x0,_0x45613e=events[_0x4966('0x4')];_0x3d2338<_0x45613e;_0x3d2338++){var _0x35be0e=events[_0x3d2338];var _0x468dd4=createListener(_0x4966('0x5')+_0x35be0e,_0x39b3c0);WhatsappMessageEvents['on'](_0x35be0e,_0x468dd4);}}; \ No newline at end of file +var _0x08b3=['emit','register','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x08b3,0x1e3));var _0x308b=function(_0x4602bc,_0x41c46e){_0x4602bc=_0x4602bc-0x0;var _0x2c231f=_0x08b3[_0x4602bc];return _0x2c231f;};'use strict';var WhatsappMessageEvents=require(_0x308b('0x0'));var events=['save',_0x308b('0x1'),_0x308b('0x2')];function createListener(_0x3b68f7,_0x161c61){return function(_0x1d7581){_0x161c61[_0x308b('0x3')](_0x3b68f7,_0x1d7581);};}function removeListener(_0x10e3f4,_0x573544){return function(){WhatsappMessageEvents['removeListener'](_0x10e3f4,_0x573544);};}exports[_0x308b('0x4')]=function(_0x2abc81){for(var _0x3faed4=0x0,_0xedc45c=events['length'];_0x3faed4<_0xedc45c;_0x3faed4++){var _0x47ac2f=events[_0x3faed4];var _0x17d634=createListener(_0x308b('0x5')+_0x47ac2f,_0x2abc81);WhatsappMessageEvents['on'](_0x47ac2f,_0x17d634);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5d626b5..bc90301 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 _0xfef6=['create','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/users','getAgents','post'];(function(_0x5164db,_0x330fc1){var _0x67ec02=function(_0x5c2df9){while(--_0x5c2df9){_0x5164db['push'](_0x5164db['shift']());}};_0x67ec02(++_0x330fc1);}(_0xfef6,0x149));var _0x6fef=function(_0x312cd8,_0x426245){_0x312cd8=_0x312cd8-0x0;var _0x137254=_0xfef6[_0x312cd8];return _0x137254;};'use strict';var multer=require(_0x6fef('0x0'));var util=require(_0x6fef('0x1'));var path=require(_0x6fef('0x2'));var timeout=require(_0x6fef('0x3'));var express=require('express');var router=express[_0x6fef('0x4')]();var auth=require(_0x6fef('0x5'));var interaction=require(_0x6fef('0x6'));var config=require(_0x6fef('0x7'));var controller=require(_0x6fef('0x8'));router[_0x6fef('0x9')]('/',auth['isAuthenticated'](),controller[_0x6fef('0xa')]);router[_0x6fef('0x9')](_0x6fef('0xb'),auth[_0x6fef('0xc')](),controller[_0x6fef('0xd')]);router[_0x6fef('0x9')](_0x6fef('0xe'),auth[_0x6fef('0xc')](),controller['show']);router[_0x6fef('0x9')](_0x6fef('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/teams',auth[_0x6fef('0xc')](),controller['getTeams']);router['get'](_0x6fef('0x10'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x11')]);router[_0x6fef('0x12')]('/',auth['isAuthenticated'](),controller[_0x6fef('0x13')]);router[_0x6fef('0x12')](_0x6fef('0x14'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x15')]);router[_0x6fef('0x12')](_0x6fef('0x10'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x16')]);router[_0x6fef('0x17')]('/:id',auth[_0x6fef('0xc')](),controller[_0x6fef('0x18')]);router['delete'](_0x6fef('0xe'),auth['isAuthenticated'](),controller[_0x6fef('0x19')]);router[_0x6fef('0x1a')](_0x6fef('0x14'),auth[_0x6fef('0xc')](),controller[_0x6fef('0x1b')]);router[_0x6fef('0x1a')](_0x6fef('0x10'),auth[_0x6fef('0xc')](),controller['removeAgents']);module[_0x6fef('0x1c')]=router; \ No newline at end of file +var _0xb75d=['post','put','update','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x28b19f,_0x3c3092){var _0x3e6243=function(_0x4c2aae){while(--_0x4c2aae){_0x28b19f['push'](_0x28b19f['shift']());}};_0x3e6243(++_0x3c3092);}(_0xb75d,0x66));var _0xdb75=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xb75d[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xdb75('0x0'));var util=require('util');var path=require(_0xdb75('0x1'));var timeout=require(_0xdb75('0x2'));var express=require(_0xdb75('0x3'));var router=express[_0xdb75('0x4')]();var auth=require(_0xdb75('0x5'));var interaction=require(_0xdb75('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xdb75('0x7')]('/',auth[_0xdb75('0x8')](),controller['index']);router[_0xdb75('0x7')](_0xdb75('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xdb75('0x7')](_0xdb75('0xa'),auth[_0xdb75('0x8')](),controller[_0xdb75('0xb')]);router[_0xdb75('0x7')](_0xdb75('0xc'),auth[_0xdb75('0x8')](),controller[_0xdb75('0xd')]);router['get'](_0xdb75('0xe'),auth['isAuthenticated'](),controller[_0xdb75('0xf')]);router['get'](_0xdb75('0x10'),auth[_0xdb75('0x8')](),controller[_0xdb75('0x11')]);router[_0xdb75('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdb75('0x12')](_0xdb75('0xe'),auth[_0xdb75('0x8')](),controller['addTeams']);router[_0xdb75('0x12')](_0xdb75('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xdb75('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xdb75('0x14')]);router[_0xdb75('0x15')](_0xdb75('0xa'),auth[_0xdb75('0x8')](),controller['destroy']);router['delete'](_0xdb75('0xe'),auth['isAuthenticated'](),controller[_0xdb75('0x16')]);router['delete'](_0xdb75('0x10'),auth[_0xdb75('0x8')](),controller[_0xdb75('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index b94cd8f..20f449d 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 _0xeca3=['exports','STRING','name','rrmemory','beepall','roundrobin','sequelize'];(function(_0x519413,_0x45d76a){var _0x2bd613=function(_0x41c349){while(--_0x41c349){_0x519413['push'](_0x519413['shift']());}};_0x2bd613(++_0x45d76a);}(_0xeca3,0x99));var _0x3eca=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xeca3[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x3eca('0x0'));module[_0x3eca('0x1')]={'name':{'type':Sequelize[_0x3eca('0x2')],'unique':_0x3eca('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3eca('0x4'),_0x3eca('0x5'),_0x3eca('0x6'))},'description':{'type':Sequelize[_0x3eca('0x2')]}}; \ No newline at end of file +var _0xd217=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5bd2f4,_0x55b797){var _0x4412c0=function(_0x2a3c26){while(--_0x2a3c26){_0x5bd2f4['push'](_0x5bd2f4['shift']());}};_0x4412c0(++_0x55b797);}(_0xd217,0xfd));var _0x7d21=function(_0x230591,_0x4a5f2c){_0x230591=_0x230591-0x0;var _0x45db9e=_0xd217[_0x230591];return _0x45db9e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7d21('0x0')],'unique':_0x7d21('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7d21('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d21('0x3')](_0x7d21('0x4'),_0x7d21('0x5'),_0x7d21('0x6'))},'description':{'type':Sequelize[_0x7d21('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 321a624..b6fd164 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 _0xa0ef=['save','update','destroy','then','WhatsappQueues','UserProfileResource','sendStatus','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','show','params','keys','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','findAll','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','emit','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xa0ef,0x183));var _0xfa0e=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0xa0ef[_0x2cef86];return _0x46dfd6;};'use strict';var pdf=require(_0xfa0e('0x0'));var emlformat=require(_0xfa0e('0x1'));var rimraf=require(_0xfa0e('0x2'));var zipdir=require(_0xfa0e('0x3'));var jsonpatch=require(_0xfa0e('0x4'));var rp=require(_0xfa0e('0x5'));var moment=require(_0xfa0e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xfa0e('0x7'));var util=require(_0xfa0e('0x8'));var path=require('path');var sox=require(_0xfa0e('0x9'));var csv=require(_0xfa0e('0xa'));var ejs=require(_0xfa0e('0xb'));var fs=require('fs');var _=require(_0xfa0e('0xc'));var squel=require(_0xfa0e('0xd'));var crypto=require('crypto');var jsforce=require(_0xfa0e('0xe'));var deskjs=require(_0xfa0e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa0e('0x10'));var Redis=require('ioredis');var authService=require(_0xfa0e('0x11'));var qs=require(_0xfa0e('0x12'));var as=require(_0xfa0e('0x13'));var hardwareService=require(_0xfa0e('0x14'));var logger=require(_0xfa0e('0x15'))(_0xfa0e('0x16'));var utils=require('../../config/utils');var config=require(_0xfa0e('0x17'));var licenseUtil=require(_0xfa0e('0x18'));var db=require(_0xfa0e('0x19'))['db'];config['redis']=_[_0xfa0e('0x1a')](config[_0xfa0e('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa0e('0x1c'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x28eb8f,_0x54a673){_0x54a673=_0x54a673||0xcc;return function(_0x264b07){if(_0x264b07){return _0x28eb8f['sendStatus'](_0x54a673);}return _0x28eb8f[_0xfa0e('0x1d')](_0x54a673)[_0xfa0e('0x1e')]();};}function respondWithResult(_0x2094d8,_0x7141d9){_0x7141d9=_0x7141d9||0xc8;return function(_0x1a1603){if(_0x1a1603){return _0x2094d8[_0xfa0e('0x1d')](_0x7141d9)[_0xfa0e('0x1f')](_0x1a1603);}};}function respondWithFilteredResult(_0x442f97,_0x104c9b){return function(_0x21caa1){if(_0x21caa1){var _0x2827b3=_0x21caa1[_0xfa0e('0x20')],_0x4a7093=_0x104c9b['offset'],_0x5f15ab=_0x104c9b[_0xfa0e('0x21')]+_0x104c9b[_0xfa0e('0x22')],_0x6cb151;if(_0x5f15ab>=_0x2827b3){_0x5f15ab=_0x2827b3;_0x6cb151=0xc8;}else{_0x6cb151=0xce;}_0x442f97[_0xfa0e('0x1d')](_0x6cb151);return _0x442f97[_0xfa0e('0x23')](_0xfa0e('0x24'),_0x4a7093+'-'+_0x5f15ab+'/'+_0x2827b3)[_0xfa0e('0x1f')](_0x21caa1);}return null;};}function patchUpdates(_0x51082c){return function(_0xb46d3e){try{jsonpatch[_0xfa0e('0x25')](_0xb46d3e,_0x51082c,!![]);}catch(_0x3a1224){return BPromise[_0xfa0e('0x26')](_0x3a1224);}return _0xb46d3e[_0xfa0e('0x27')]();};}function saveUpdates(_0x5154af,_0x1ff80a){return function(_0x37bb9f){if(_0x37bb9f){return _0x37bb9f[_0xfa0e('0x28')](_0x5154af)['then'](function(_0x9a5c98){return _0x9a5c98;});}return null;};}function removeEntity(_0x49752c,_0x26cd8e){return function(_0xd525db){if(_0xd525db){return _0xd525db[_0xfa0e('0x29')]()[_0xfa0e('0x2a')](function(){var _0x3e577f=_0xd525db['get']({'plain':!![]});var _0x5b914a=_0xfa0e('0x2b');return db[_0xfa0e('0x2c')][_0xfa0e('0x29')]({'where':{'type':_0x5b914a,'resourceId':_0x3e577f['id']}})[_0xfa0e('0x2a')](function(){return _0xd525db;});})[_0xfa0e('0x2a')](function(){_0x49752c['status'](0xcc)[_0xfa0e('0x1e')]();});}};}function handleEntityNotFound(_0x3a9862,_0x4c4ef1){return function(_0x465bad){if(!_0x465bad){_0x3a9862[_0xfa0e('0x2d')](0x194);}return _0x465bad;};}function handleError(_0x8d77ca,_0x3d570e){_0x3d570e=_0x3d570e||0x1f4;return function(_0x2d5266){logger['error'](_0x2d5266['stack']);if(_0x2d5266['name']){delete _0x2d5266[_0xfa0e('0x2e')];}_0x8d77ca['status'](_0x3d570e)[_0xfa0e('0x2f')](_0x2d5266);};}exports[_0xfa0e('0x30')]=function(_0x354c4b,_0xce8dbe){var _0x158a08={},_0x4386e4={},_0x2c6f44={'count':0x0,'rows':[]};var _0x41afb7=_[_0xfa0e('0x31')](db[_0xfa0e('0x32')][_0xfa0e('0x33')],function(_0x26215b){return{'name':_0x26215b[_0xfa0e('0x34')],'type':_0x26215b['type']['key']};});_0x4386e4[_0xfa0e('0x35')]=_[_0xfa0e('0x31')](_0x41afb7,_0xfa0e('0x2e'));_0x4386e4[_0xfa0e('0x36')]=_['keys'](_0x354c4b[_0xfa0e('0x36')]);_0x4386e4[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x4386e4[_0xfa0e('0x35')],_0x4386e4['query']);_0x158a08[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x4386e4[_0xfa0e('0x35')],qs[_0xfa0e('0x3a')](_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x3a')]));_0x158a08[_0xfa0e('0x39')]=_0x158a08[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x158a08[_0xfa0e('0x39')]:_0x4386e4[_0xfa0e('0x35')];if(!_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x3c')](_0xfa0e('0x3d'))){_0x158a08[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x22')]);_0x158a08[_0xfa0e('0x21')]=qs[_0xfa0e('0x21')](_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x21')]);}_0x158a08[_0xfa0e('0x3e')]=qs[_0xfa0e('0x3f')](_0x354c4b['query']['sort']);_0x158a08[_0xfa0e('0x40')]=qs[_0xfa0e('0x37')](_[_0xfa0e('0x41')](_0x354c4b[_0xfa0e('0x36')],_0x4386e4[_0xfa0e('0x37')]),_0x41afb7);if(_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x42')]){_0x158a08[_0xfa0e('0x40')]=_[_0xfa0e('0x43')](_0x158a08[_0xfa0e('0x40')],{'$or':_[_0xfa0e('0x31')](_0x41afb7,function(_0x5153c3){if(_0x5153c3[_0xfa0e('0x44')]!==_0xfa0e('0x45')){var _0x1ab503={};_0x1ab503[_0x5153c3[_0xfa0e('0x2e')]]={'$like':'%'+_0x354c4b[_0xfa0e('0x36')][_0xfa0e('0x42')]+'%'};return _0x1ab503;}})});}_0x158a08=_[_0xfa0e('0x43')]({},_0x158a08,_0x354c4b['options']);var _0x4d3c74={'where':_0x158a08['where']};return db[_0xfa0e('0x32')][_0xfa0e('0x20')](_0x4d3c74)[_0xfa0e('0x2a')](function(_0x2259a3){_0x2c6f44[_0xfa0e('0x20')]=_0x2259a3;if(_0x354c4b['query'][_0xfa0e('0x46')]){_0x158a08[_0xfa0e('0x47')]=[{'all':!![]}];}return db[_0xfa0e('0x32')]['findAll'](_0x158a08);})[_0xfa0e('0x2a')](function(_0x33308a){_0x2c6f44['rows']=_0x33308a;return _0x2c6f44;})[_0xfa0e('0x2a')](respondWithFilteredResult(_0xce8dbe,_0x158a08))['catch'](handleError(_0xce8dbe,null));};exports[_0xfa0e('0x48')]=function(_0x1e7c01,_0x1f3977){var _0x34e834={'raw':!![],'where':{'id':_0x1e7c01[_0xfa0e('0x49')]['id']}},_0x5e6944={};_0x5e6944[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db['WhatsappQueue'][_0xfa0e('0x33')]);_0x5e6944['query']=_[_0xfa0e('0x4a')](_0x1e7c01['query']);_0x5e6944[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x5e6944[_0xfa0e('0x35')],_0x5e6944['query']);_0x34e834[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x5e6944[_0xfa0e('0x35')],qs[_0xfa0e('0x3a')](_0x1e7c01['query'][_0xfa0e('0x3a')]));_0x34e834[_0xfa0e('0x39')]=_0x34e834[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x34e834[_0xfa0e('0x39')]:_0x5e6944[_0xfa0e('0x35')];if(_0x1e7c01[_0xfa0e('0x36')]['includeAll']){_0x34e834[_0xfa0e('0x47')]=[{'all':!![]}];}_0x34e834=_[_0xfa0e('0x43')]({},_0x34e834,_0x1e7c01['options']);return db[_0xfa0e('0x32')]['find'](_0x34e834)[_0xfa0e('0x2a')](handleEntityNotFound(_0x1f3977,null))[_0xfa0e('0x2a')](respondWithResult(_0x1f3977,null))[_0xfa0e('0x4b')](handleError(_0x1f3977,null));};exports[_0xfa0e('0x4c')]=function(_0x4722e7,_0x4cd496){return db[_0xfa0e('0x32')][_0xfa0e('0x4c')](_0x4722e7[_0xfa0e('0x4d')],{})[_0xfa0e('0x2a')](function(_0x1a318c){var _0x4732cf=_0x4722e7['user']['get']({'plain':!![]});if(!_0x4732cf)throw new Error(_0xfa0e('0x4e'));if(_0x4732cf[_0xfa0e('0x4f')]===_0xfa0e('0x50')){var _0x39bc70=_0x1a318c[_0xfa0e('0x51')]({'plain':!![]});var _0x33bc59=_0xfa0e('0x2b');return db['UserProfileSection'][_0xfa0e('0x52')]({'where':{'name':_0x33bc59,'userProfileId':_0x4732cf[_0xfa0e('0x53')]},'raw':!![]})['then'](function(_0xf0780b){if(_0xf0780b&&_0xf0780b['autoAssociation']===0x0){return db[_0xfa0e('0x2c')][_0xfa0e('0x4c')]({'name':_0x39bc70['name'],'resourceId':_0x39bc70['id'],'type':_0xf0780b['name'],'sectionId':_0xf0780b['id']},{})[_0xfa0e('0x2a')](function(){return _0x1a318c;});}else{return _0x1a318c;}})[_0xfa0e('0x4b')](function(_0x439314){logger[_0xfa0e('0x54')](_0xfa0e('0x55'),_0x439314);throw _0x439314;});}return _0x1a318c;})[_0xfa0e('0x2a')](respondWithResult(_0x4cd496,0xc9))[_0xfa0e('0x4b')](handleError(_0x4cd496,null));};exports[_0xfa0e('0x28')]=function(_0x5d365d,_0x5513f6){if(_0x5d365d[_0xfa0e('0x4d')]['id']){delete _0x5d365d[_0xfa0e('0x4d')]['id'];}return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0x5d365d[_0xfa0e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5513f6,null))[_0xfa0e('0x2a')](saveUpdates(_0x5d365d[_0xfa0e('0x4d')],null))[_0xfa0e('0x2a')](respondWithResult(_0x5513f6,null))[_0xfa0e('0x4b')](handleError(_0x5513f6,null));};exports[_0xfa0e('0x29')]=function(_0xac9895,_0x109b9e){return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0xac9895['params']['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x109b9e,null))[_0xfa0e('0x2a')](removeEntity(_0x109b9e,null))['catch'](handleError(_0x109b9e,null));};exports['describe']=function(_0x1993a8,_0x2eaa21){return db[_0xfa0e('0x32')][_0xfa0e('0x56')]()['then'](respondWithResult(_0x2eaa21,null))[_0xfa0e('0x4b')](handleError(_0x2eaa21,null));};exports[_0xfa0e('0x57')]=function(_0x297973,_0x211579,_0x48e2b4){var _0x3d0a36={'raw':!![],'where':{}},_0x4799a9={},_0x34fe55;return db[_0xfa0e('0x32')][_0xfa0e('0x58')]({'where':{'id':_0x297973[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x211579,null))[_0xfa0e('0x2a')](function(_0xea01e2){if(_0xea01e2){_0x34fe55=_0xea01e2['get']({'plain':!![]});_0x4799a9[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db[_0xfa0e('0x59')][_0xfa0e('0x33')]);_0x4799a9['query']=_[_0xfa0e('0x4a')](_0x297973[_0xfa0e('0x36')]);_0x4799a9[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x4799a9[_0xfa0e('0x35')],_0x4799a9[_0xfa0e('0x36')]);_0x3d0a36['attributes']=_[_0xfa0e('0x38')](_0x4799a9[_0xfa0e('0x35')],qs[_0xfa0e('0x3a')](_0x297973[_0xfa0e('0x36')]['fields']));_0x3d0a36['attributes']=_0x3d0a36[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x3d0a36[_0xfa0e('0x39')]:_0x4799a9[_0xfa0e('0x35')];if(!_0x297973[_0xfa0e('0x36')]['hasOwnProperty'](_0xfa0e('0x3d'))){_0x3d0a36[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0x297973[_0xfa0e('0x36')][_0xfa0e('0x22')]);_0x3d0a36[_0xfa0e('0x21')]=qs['offset'](_0x297973['query']['offset']);}_0x3d0a36['order']=qs[_0xfa0e('0x3f')](_0x297973[_0xfa0e('0x36')][_0xfa0e('0x3f')]);_0x3d0a36[_0xfa0e('0x40')]=qs['filters'](_[_0xfa0e('0x41')](_0x297973['query'],_0x4799a9[_0xfa0e('0x37')]));_0x3d0a36[_0xfa0e('0x40')]['WhatsappQueueId']=_0xea01e2['id'];if(_0x297973[_0xfa0e('0x36')][_0xfa0e('0x42')]){_0x3d0a36['where']=_[_0xfa0e('0x43')](_0x3d0a36[_0xfa0e('0x40')],{'$or':_['map'](_0x3d0a36[_0xfa0e('0x39')],function(_0x1bc0a0){var _0x2e7b84={};_0x2e7b84[_0x1bc0a0]={'$like':'%'+_0x297973[_0xfa0e('0x36')][_0xfa0e('0x42')]+'%'};return _0x2e7b84;})});}_0x3d0a36=_[_0xfa0e('0x43')]({},_0x3d0a36,_0x297973['options']);return db[_0xfa0e('0x59')][_0xfa0e('0x5a')](_0x3d0a36);}})[_0xfa0e('0x2a')](function(_0x4051a9){if(_0x4051a9){return db['User']['findAndCountAll']({'where':{'id':_[_0xfa0e('0x31')](_0x4051a9,'UserId'),'role':'agent'},'attributes':['id',_0xfa0e('0x2e'),_0xfa0e('0x5b'),_0xfa0e('0x5c'),_0xfa0e('0x5d')]});}})['then'](function(_0x200116){if(_0x200116){return{'count':_0x200116['count'],'rows':_['map'](_0x200116['rows'],function(_0x374205){return{'membername':_0x374205[_0xfa0e('0x2e')],'UserId':_0x374205['id'],'queue_name':_0x34fe55[_0xfa0e('0x2e')],'WhatsappQueueId':_0x34fe55['id'],'interface':util[_0xfa0e('0x5e')](_0xfa0e('0x5f'),_0xfa0e('0x60'),_0x374205[_0xfa0e('0x2e')]),'penalty':0x0,'paused':_0x374205[_0xfa0e('0x5b')],'createdAt':_0x374205[_0xfa0e('0x5d')],'updatedAt':_0x374205[_0xfa0e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa0e('0x2a')](respondWithFilteredResult(_0x211579,_0x3d0a36))[_0xfa0e('0x4b')](handleError(_0x211579,null));};exports[_0xfa0e('0x61')]=function(_0x233b31,_0xe37b82,_0x1889f6){var _0xb30f8c={};var _0x84227d={};var _0x1dc264;var _0x5f059a;return db[_0xfa0e('0x32')][_0xfa0e('0x58')]({'where':{'id':_0x233b31[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0xe37b82,null))[_0xfa0e('0x2a')](function(_0x8a9946){if(_0x8a9946){_0x1dc264=_0x8a9946;_0x84227d[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db[_0xfa0e('0x62')][_0xfa0e('0x33')]);_0x84227d['query']=_[_0xfa0e('0x4a')](_0x233b31[_0xfa0e('0x36')]);_0x84227d[_0xfa0e('0x37')]=_['intersection'](_0x84227d[_0xfa0e('0x35')],_0x84227d[_0xfa0e('0x36')]);_0xb30f8c[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x84227d['model'],qs[_0xfa0e('0x3a')](_0x233b31[_0xfa0e('0x36')]['fields']));_0xb30f8c['attributes']=_0xb30f8c[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0xb30f8c['attributes']:_0x84227d['model'];_0xb30f8c[_0xfa0e('0x3e')]=qs['sort'](_0x233b31['query'][_0xfa0e('0x3f')]);_0xb30f8c[_0xfa0e('0x40')]=qs[_0xfa0e('0x37')](_[_0xfa0e('0x41')](_0x233b31[_0xfa0e('0x36')],_0x84227d[_0xfa0e('0x37')]));if(_0x233b31[_0xfa0e('0x36')]['filter']){_0xb30f8c[_0xfa0e('0x40')]=_[_0xfa0e('0x43')](_0xb30f8c[_0xfa0e('0x40')],{'$or':_[_0xfa0e('0x31')](_0xb30f8c['attributes'],function(_0x5ac544){var _0x3f347c={};_0x3f347c[_0x5ac544]={'$like':'%'+_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x42')]+'%'};return _0x3f347c;})});}_0xb30f8c=_[_0xfa0e('0x43')]({},_0xb30f8c,_0x233b31[_0xfa0e('0x63')]);return _0x1dc264[_0xfa0e('0x61')](_0xb30f8c);}})[_0xfa0e('0x2a')](function(_0x1f7646){if(_0x1f7646){_0x5f059a=_0x1f7646[_0xfa0e('0x3b')];if(!_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x3c')]('nolimit')){_0xb30f8c[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x22')]);_0xb30f8c[_0xfa0e('0x21')]=qs['offset'](_0x233b31[_0xfa0e('0x36')][_0xfa0e('0x21')]);}return _0x1dc264[_0xfa0e('0x61')](_0xb30f8c);}})[_0xfa0e('0x2a')](function(_0x3942f8){if(_0x3942f8){return _0x3942f8?{'count':_0x5f059a,'rows':_0x3942f8}:null;}})[_0xfa0e('0x2a')](respondWithResult(_0xe37b82,null))['catch'](handleError(_0xe37b82,null));};exports[_0xfa0e('0x64')]=function(_0x33be72,_0x2d5e1e,_0xddd412){var _0x97e12c=_0x33be72['body'][_0xfa0e('0x65')];return db[_0xfa0e('0x62')][_0xfa0e('0x5a')]({'where':{'id':_0x97e12c},'attributes':['id'],'include':[{'model':db[_0xfa0e('0x66')],'as':_0xfa0e('0x67'),'attributes':['id',_0xfa0e('0x2e'),_0xfa0e('0x68'),_0xfa0e('0x69'),_0xfa0e('0x6a')],'raw':!![]}]})['then'](function(_0x4a15d6){if(_0x4a15d6){var _0xa71690=_['flatMap'](_0x4a15d6,function(_0xe746c3){var _0x3a740d=_0xe746c3[_0xfa0e('0x51')]({'plain':!![]});return _0x3a740d[_0xfa0e('0x67')];});return db[_0xfa0e('0x32')]['find']({'where':{'id':_0x33be72['params']['id']}})[_0xfa0e('0x2a')](function(_0x324a90){return db[_0xfa0e('0x6b')][_0xfa0e('0x6c')](function(_0x35dcea){return _0x324a90[_0xfa0e('0x64')](_0x97e12c,{'transaction':_0x35dcea})[_0xfa0e('0x2a')](function(){return BPromise[_0xfa0e('0x6d')](_0xa71690,function(_0xf3aca){return db[_0xfa0e('0x59')][_0xfa0e('0x6e')]({'where':{'UserId':_0xf3aca['id'],'WhatsappQueueId':_0x33be72[_0xfa0e('0x49')]['id']},'transaction':_0x35dcea});});})['then'](function(){_0xa71690['forEach'](function(_0x216b6f){socket['emit'](_0xfa0e('0x6f'),{'UserId':_0x216b6f['id'],'WhatsappQueueId':_0x324a90['id']});});});});});}})['then'](respondWithStatusCode(_0x2d5e1e,null))['catch'](handleError(_0x2d5e1e,null));};exports['removeTeams']=function(_0xbf7203,_0x44aaaa,_0x425cbc){return db[_0xfa0e('0x62')][_0xfa0e('0x5a')]({'where':{'id':_0xbf7203[_0xfa0e('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfa0e('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfa0e('0x2a')](handleEntityNotFound(_0x44aaaa,null))[_0xfa0e('0x2a')](function(_0x247881){var _0x3e6141=_[_0xfa0e('0x31')](_0x247881,'id');var _0x1c5608=[];var _0x2dfd9d=[];var _0x1a3638=squel[_0xfa0e('0x70')]();_0x1a3638[_0xfa0e('0x71')](_0xfa0e('0x72'))[_0xfa0e('0x73')](_0xfa0e('0x74'),'tq')[_0xfa0e('0x75')](_0xfa0e('0x76'),'ut',_0xfa0e('0x77'))['where'](_0xfa0e('0x78'),_0xbf7203[_0xfa0e('0x49')]['id']);for(var _0x37c166=0x0;_0x37c166<_0x247881[_0xfa0e('0x3b')];_0x37c166+=0x1){let _0x5ea829=_0x247881[_0x37c166];for(var _0x220a05=0x0;_0x220a05<_0x5ea829[_0xfa0e('0x67')][_0xfa0e('0x3b')];_0x220a05+=0x1){let _0x13cb89=_0x5ea829[_0xfa0e('0x67')][_0x220a05];var _0x4513d4=_0x1a3638[_0xfa0e('0x79')]();_0x4513d4['where'](_0xfa0e('0x7a'),_0x13cb89['id']);_0x2dfd9d[_0xfa0e('0x7b')](db[_0xfa0e('0x6b')]['query'](_0x4513d4[_0xfa0e('0x7c')](),{'type':db[_0xfa0e('0x6b')][_0xfa0e('0x7d')][_0xfa0e('0x7e')]})['then'](function(_0x4798b3){if(_0x4798b3['length']===0x1){return _0x13cb89['id'];}else{var _0x344f08=_[_0xfa0e('0x7f')](_[_0xfa0e('0x31')](_0x4798b3,'TeamId'),function(_0x1b630c){return _[_0xfa0e('0x80')](_0x3e6141,_0x1b630c);});if(_0x344f08){return _0x13cb89['id'];}}}));}}return BPromise['all'](_0x2dfd9d)[_0xfa0e('0x2a')](function(_0x28a258){_0x1c5608=_(_0x1c5608)['union'](_0x28a258)[_0xfa0e('0x81')]()[_0xfa0e('0x82')]();return db[_0xfa0e('0x32')]['find']({'where':{'id':_0xbf7203[_0xfa0e('0x49')]['id']}})['then'](function(_0x43a14a){return db[_0xfa0e('0x6b')][_0xfa0e('0x6c')](function(_0x2af07e){return _0x43a14a[_0xfa0e('0x83')](_0xbf7203[_0xfa0e('0x36')]['ids'],{'transaction':_0x2af07e})[_0xfa0e('0x2a')](function(){if(!_[_0xfa0e('0x84')](_0x1c5608)){return _0x43a14a[_0xfa0e('0x85')](_0x1c5608,{'transaction':_0x2af07e});}})['then'](function(){_0x1c5608[_0xfa0e('0x86')](function(_0x51aeef){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x51aeef,'WhatsappQueueId':_0x43a14a['id']});});});});});});})[_0xfa0e('0x2a')](respondWithStatusCode(_0x44aaaa,null))[_0xfa0e('0x4b')](handleError(_0x44aaaa,null));};exports[_0xfa0e('0x87')]=function(_0x58a439,_0x1a1b36,_0x191c8d){return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0x58a439[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x1a1b36,null))[_0xfa0e('0x2a')](function(_0x38efc1){if(_0x38efc1){return _0x38efc1[_0xfa0e('0x87')](_0x58a439['body'][_0xfa0e('0x65')],_[_0xfa0e('0x88')](_0x58a439[_0xfa0e('0x4d')],[_0xfa0e('0x65'),'id'])||{})[_0xfa0e('0x89')](function(_0x1009e3){for(var _0x4a5160=0x0;_0x4a5160<_0x58a439['body'][_0xfa0e('0x65')][_0xfa0e('0x3b')];_0x4a5160+=0x1){socket[_0xfa0e('0x8a')]('userWhatsappQueue:save',{'UserId':_0x58a439['body'][_0xfa0e('0x65')][_0x4a5160],'WhatsappQueueId':_0x58a439[_0xfa0e('0x49')]['id']});}return _0x1009e3;});}})[_0xfa0e('0x2a')](respondWithResult(_0x1a1b36,null))[_0xfa0e('0x4b')](handleError(_0x1a1b36,null));};exports[_0xfa0e('0x85')]=function(_0x567e92,_0x317ec7,_0x4fc4ab){return db[_0xfa0e('0x32')][_0xfa0e('0x52')]({'where':{'id':_0x567e92[_0xfa0e('0x49')]['id']}})[_0xfa0e('0x2a')](handleEntityNotFound(_0x317ec7,null))[_0xfa0e('0x2a')](function(_0x33cfc0){if(_0x33cfc0){return _0x33cfc0[_0xfa0e('0x85')](_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')])[_0xfa0e('0x2a')](function(){if(_[_0xfa0e('0x8b')](_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')])){for(var _0x5ac684=0x0;_0x5ac684<_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')]['length'];_0x5ac684+=0x1){socket['emit'](_0xfa0e('0x8c'),{'UserId':Number(_0x567e92[_0xfa0e('0x36')]['ids'][_0x5ac684]),'WhatsappQueueId':Number(_0x567e92[_0xfa0e('0x49')]['id'])});}}else{socket[_0xfa0e('0x8a')](_0xfa0e('0x8c'),{'UserId':Number(_0x567e92[_0xfa0e('0x36')][_0xfa0e('0x65')]),'WhatsappQueueId':Number(_0x567e92[_0xfa0e('0x49')]['id'])});}});}})[_0xfa0e('0x2a')](respondWithStatusCode(_0x317ec7,null))[_0xfa0e('0x4b')](handleError(_0x317ec7,null));};exports[_0xfa0e('0x8d')]=function(_0xe9d391,_0x16e17f,_0x3cdb10){var _0x440533={};var _0x1faa8a={};var _0x2c4166;var _0x17f5fc;return db[_0xfa0e('0x32')][_0xfa0e('0x58')]({'where':{'id':_0xe9d391['params']['id']}})['then'](handleEntityNotFound(_0x16e17f,null))['then'](function(_0x522732){if(_0x522732){_0x2c4166=_0x522732;_0x1faa8a[_0xfa0e('0x35')]=_[_0xfa0e('0x4a')](db[_0xfa0e('0x66')][_0xfa0e('0x33')]);_0x1faa8a['query']=_[_0xfa0e('0x4a')](_0xe9d391[_0xfa0e('0x36')]);_0x1faa8a[_0xfa0e('0x37')]=_[_0xfa0e('0x38')](_0x1faa8a['model'],_0x1faa8a[_0xfa0e('0x36')]);_0x440533[_0xfa0e('0x39')]=_[_0xfa0e('0x38')](_0x1faa8a[_0xfa0e('0x35')],qs['fields'](_0xe9d391[_0xfa0e('0x36')][_0xfa0e('0x3a')]));_0x440533[_0xfa0e('0x39')]=_0x440533[_0xfa0e('0x39')][_0xfa0e('0x3b')]?_0x440533[_0xfa0e('0x39')]:_0x1faa8a['model'];_0x440533['order']=qs[_0xfa0e('0x3f')](_0xe9d391[_0xfa0e('0x36')][_0xfa0e('0x3f')]);_0x440533['where']=qs[_0xfa0e('0x37')](_[_0xfa0e('0x41')](_0xe9d391['query'],_0x1faa8a[_0xfa0e('0x37')]));if(_0xe9d391[_0xfa0e('0x36')]['filter']){_0x440533['where']=_[_0xfa0e('0x43')](_0x440533[_0xfa0e('0x40')],{'$or':_[_0xfa0e('0x31')](_0x440533[_0xfa0e('0x39')],function(_0x290553){var _0x3f31a9={};_0x3f31a9[_0x290553]={'$like':'%'+_0xe9d391['query'][_0xfa0e('0x42')]+'%'};return _0x3f31a9;})});}_0x440533=_[_0xfa0e('0x43')]({},_0x440533,_0xe9d391[_0xfa0e('0x63')]);return _0x2c4166[_0xfa0e('0x8d')](_0x440533);}})[_0xfa0e('0x2a')](function(_0x9141c7){if(_0x9141c7){_0x17f5fc=_0x9141c7[_0xfa0e('0x3b')];if(!_0xe9d391['query'][_0xfa0e('0x3c')](_0xfa0e('0x3d'))){_0x440533[_0xfa0e('0x22')]=qs[_0xfa0e('0x22')](_0xe9d391['query'][_0xfa0e('0x22')]);_0x440533[_0xfa0e('0x21')]=qs[_0xfa0e('0x21')](_0xe9d391[_0xfa0e('0x36')][_0xfa0e('0x21')]);}return _0x2c4166[_0xfa0e('0x8d')](_0x440533);}})[_0xfa0e('0x2a')](function(_0x1c4b03){if(_0x1c4b03){return _0x1c4b03?{'count':_0x17f5fc,'rows':_0x1c4b03}:null;}})[_0xfa0e('0x2a')](respondWithResult(_0x16e17f,null))[_0xfa0e('0x4b')](handleError(_0x16e17f,null));}; \ No newline at end of file +var _0x277d=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','destroy','WhatsappQueues','UserProfileResource','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','WhatsappQueue','findAll','rows','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','params','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','findAndCountAll','UserId','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeAgents','userWhatsappQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch'];(function(_0x48d704,_0x4a8f22){var _0x37be5c=function(_0x40b2e1){while(--_0x40b2e1){_0x48d704['push'](_0x48d704['shift']());}};_0x37be5c(++_0x4a8f22);}(_0x277d,0x195));var _0xd277=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x277d[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd277('0x0'));var rimraf=require(_0xd277('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd277('0x2'));var rp=require(_0xd277('0x3'));var moment=require(_0xd277('0x4'));var BPromise=require(_0xd277('0x5'));var Mustache=require(_0xd277('0x6'));var util=require(_0xd277('0x7'));var path=require(_0xd277('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd277('0x9'));var fs=require('fs');var _=require(_0xd277('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd277('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd277('0xc'));var querystring=require(_0xd277('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd277('0xe'));var as=require(_0xd277('0xf'));var hardwareService=require(_0xd277('0x10'));var logger=require(_0xd277('0x11'))(_0xd277('0x12'));var utils=require(_0xd277('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd277('0x14'))['db'];config[_0xd277('0x15')]=_[_0xd277('0x16')](config[_0xd277('0x15')],{'host':_0xd277('0x17'),'port':0x18eb});var socket=require(_0xd277('0x18'))(new Redis(config[_0xd277('0x15')]));require(_0xd277('0x19'))[_0xd277('0x1a')](socket);function respondWithStatusCode(_0x4b7cdc,_0x10f969){_0x10f969=_0x10f969||0xcc;return function(_0x3085eb){if(_0x3085eb){return _0x4b7cdc[_0xd277('0x1b')](_0x10f969);}return _0x4b7cdc[_0xd277('0x1c')](_0x10f969)[_0xd277('0x1d')]();};}function respondWithResult(_0x1eb6c9,_0x17e101){_0x17e101=_0x17e101||0xc8;return function(_0x26e587){if(_0x26e587){return _0x1eb6c9['status'](_0x17e101)[_0xd277('0x1e')](_0x26e587);}};}function respondWithFilteredResult(_0x2293f8,_0x40efee){return function(_0x9749d0){if(_0x9749d0){var _0x3cbb77=_0x9749d0[_0xd277('0x1f')],_0x15efc7=_0x40efee[_0xd277('0x20')],_0x89fdeb=_0x40efee[_0xd277('0x20')]+_0x40efee[_0xd277('0x21')],_0xcad62f;if(_0x89fdeb>=_0x3cbb77){_0x89fdeb=_0x3cbb77;_0xcad62f=0xc8;}else{_0xcad62f=0xce;}_0x2293f8['status'](_0xcad62f);return _0x2293f8[_0xd277('0x22')](_0xd277('0x23'),_0x15efc7+'-'+_0x89fdeb+'/'+_0x3cbb77)[_0xd277('0x1e')](_0x9749d0);}return null;};}function patchUpdates(_0xb727f1){return function(_0x22bbec){try{jsonpatch['apply'](_0x22bbec,_0xb727f1,!![]);}catch(_0x377526){return BPromise[_0xd277('0x24')](_0x377526);}return _0x22bbec['save']();};}function saveUpdates(_0x249214,_0x61a44b){return function(_0x5f1b8a){if(_0x5f1b8a){return _0x5f1b8a['update'](_0x249214)[_0xd277('0x25')](function(_0x1d851e){return _0x1d851e;});}return null;};}function removeEntity(_0x297d9a,_0x3e69fc){return function(_0x1a8b9a){if(_0x1a8b9a){return _0x1a8b9a[_0xd277('0x26')]()['then'](function(){var _0x9c23a6=_0x1a8b9a['get']({'plain':!![]});var _0x44ece1=_0xd277('0x27');return db[_0xd277('0x28')][_0xd277('0x26')]({'where':{'type':_0x44ece1,'resourceId':_0x9c23a6['id']}})[_0xd277('0x25')](function(){return _0x1a8b9a;});})[_0xd277('0x25')](function(){_0x297d9a['status'](0xcc)[_0xd277('0x1d')]();});}};}function handleEntityNotFound(_0x4971a3,_0x272f18){return function(_0x3d5fd5){if(!_0x3d5fd5){_0x4971a3[_0xd277('0x1b')](0x194);}return _0x3d5fd5;};}function handleError(_0x453998,_0x48464a){_0x48464a=_0x48464a||0x1f4;return function(_0x2040c1){logger['error'](_0x2040c1[_0xd277('0x29')]);if(_0x2040c1[_0xd277('0x2a')]){delete _0x2040c1[_0xd277('0x2a')];}_0x453998[_0xd277('0x1c')](_0x48464a)[_0xd277('0x2b')](_0x2040c1);};}exports['index']=function(_0x415487,_0x2f3f5e){var _0x2397a1={},_0x361d49={},_0x58f5a7={'count':0x0,'rows':[]};var _0x16379b=_[_0xd277('0x2c')](db['WhatsappQueue']['rawAttributes'],function(_0x39534d){return{'name':_0x39534d[_0xd277('0x2d')],'type':_0x39534d[_0xd277('0x2e')][_0xd277('0x2f')]};});_0x361d49[_0xd277('0x30')]=_['map'](_0x16379b,_0xd277('0x2a'));_0x361d49[_0xd277('0x31')]=_[_0xd277('0x32')](_0x415487['query']);_0x361d49['filters']=_[_0xd277('0x33')](_0x361d49[_0xd277('0x30')],_0x361d49[_0xd277('0x31')]);_0x2397a1['attributes']=_[_0xd277('0x33')](_0x361d49[_0xd277('0x30')],qs[_0xd277('0x34')](_0x415487[_0xd277('0x31')]['fields']));_0x2397a1[_0xd277('0x35')]=_0x2397a1[_0xd277('0x35')][_0xd277('0x36')]?_0x2397a1[_0xd277('0x35')]:_0x361d49['model'];if(!_0x415487[_0xd277('0x31')]['hasOwnProperty'](_0xd277('0x37'))){_0x2397a1[_0xd277('0x21')]=qs[_0xd277('0x21')](_0x415487[_0xd277('0x31')][_0xd277('0x21')]);_0x2397a1[_0xd277('0x20')]=qs[_0xd277('0x20')](_0x415487[_0xd277('0x31')]['offset']);}_0x2397a1['order']=qs[_0xd277('0x38')](_0x415487[_0xd277('0x31')][_0xd277('0x38')]);_0x2397a1[_0xd277('0x39')]=qs['filters'](_[_0xd277('0x3a')](_0x415487['query'],_0x361d49[_0xd277('0x3b')]),_0x16379b);if(_0x415487['query'][_0xd277('0x3c')]){_0x2397a1['where']=_['merge'](_0x2397a1[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x16379b,function(_0x30c5d2){if(_0x30c5d2[_0xd277('0x2e')]!==_0xd277('0x3d')){var _0x1b7f51={};_0x1b7f51[_0x30c5d2[_0xd277('0x2a')]]={'$like':'%'+_0x415487[_0xd277('0x31')][_0xd277('0x3c')]+'%'};return _0x1b7f51;}})});}_0x2397a1=_[_0xd277('0x3e')]({},_0x2397a1,_0x415487[_0xd277('0x3f')]);var _0x346fd9={'where':_0x2397a1[_0xd277('0x39')]};return db['WhatsappQueue'][_0xd277('0x1f')](_0x346fd9)[_0xd277('0x25')](function(_0x2a64d8){_0x58f5a7['count']=_0x2a64d8;if(_0x415487[_0xd277('0x31')][_0xd277('0x40')]){_0x2397a1[_0xd277('0x41')]=[{'all':!![]}];}return db[_0xd277('0x42')][_0xd277('0x43')](_0x2397a1);})[_0xd277('0x25')](function(_0x301f0d){_0x58f5a7[_0xd277('0x44')]=_0x301f0d;return _0x58f5a7;})[_0xd277('0x25')](respondWithFilteredResult(_0x2f3f5e,_0x2397a1))['catch'](handleError(_0x2f3f5e,null));};exports['show']=function(_0x5c12c9,_0x42431c){var _0x3d05e6={'raw':!![],'where':{'id':_0x5c12c9['params']['id']}},_0x33ad51={};_0x33ad51[_0xd277('0x30')]=_[_0xd277('0x32')](db[_0xd277('0x42')][_0xd277('0x45')]);_0x33ad51[_0xd277('0x31')]=_[_0xd277('0x32')](_0x5c12c9[_0xd277('0x31')]);_0x33ad51[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x33ad51[_0xd277('0x30')],_0x33ad51[_0xd277('0x31')]);_0x3d05e6[_0xd277('0x35')]=_[_0xd277('0x33')](_0x33ad51[_0xd277('0x30')],qs[_0xd277('0x34')](_0x5c12c9[_0xd277('0x31')]['fields']));_0x3d05e6[_0xd277('0x35')]=_0x3d05e6[_0xd277('0x35')][_0xd277('0x36')]?_0x3d05e6[_0xd277('0x35')]:_0x33ad51['model'];if(_0x5c12c9[_0xd277('0x31')][_0xd277('0x40')]){_0x3d05e6['include']=[{'all':!![]}];}_0x3d05e6=_['merge']({},_0x3d05e6,_0x5c12c9[_0xd277('0x3f')]);return db[_0xd277('0x42')][_0xd277('0x46')](_0x3d05e6)[_0xd277('0x25')](handleEntityNotFound(_0x42431c,null))[_0xd277('0x25')](respondWithResult(_0x42431c,null))[_0xd277('0x47')](handleError(_0x42431c,null));};exports[_0xd277('0x48')]=function(_0x5d1a6f,_0x1bef2b){return db['WhatsappQueue']['create'](_0x5d1a6f[_0xd277('0x49')],{})[_0xd277('0x25')](function(_0x368e8d){var _0x2b2daf=_0x5d1a6f[_0xd277('0x4a')][_0xd277('0x4b')]({'plain':!![]});if(!_0x2b2daf)throw new Error(_0xd277('0x4c'));if(_0x2b2daf[_0xd277('0x4d')]===_0xd277('0x4a')){var _0x31bf5a=_0x368e8d[_0xd277('0x4b')]({'plain':!![]});var _0x19c81d=_0xd277('0x27');return db[_0xd277('0x4e')][_0xd277('0x46')]({'where':{'name':_0x19c81d,'userProfileId':_0x2b2daf[_0xd277('0x4f')]},'raw':!![]})[_0xd277('0x25')](function(_0x4bbd86){if(_0x4bbd86&&_0x4bbd86[_0xd277('0x50')]===0x0){return db[_0xd277('0x28')][_0xd277('0x48')]({'name':_0x31bf5a[_0xd277('0x2a')],'resourceId':_0x31bf5a['id'],'type':_0x4bbd86['name'],'sectionId':_0x4bbd86['id']},{})['then'](function(){return _0x368e8d;});}else{return _0x368e8d;}})['catch'](function(_0x2a6147){logger[_0xd277('0x51')](_0xd277('0x52'),_0x2a6147);throw _0x2a6147;});}return _0x368e8d;})[_0xd277('0x25')](respondWithResult(_0x1bef2b,0xc9))[_0xd277('0x47')](handleError(_0x1bef2b,null));};exports[_0xd277('0x53')]=function(_0x2ac4aa,_0x4ac32a){if(_0x2ac4aa[_0xd277('0x49')]['id']){delete _0x2ac4aa[_0xd277('0x49')]['id'];}return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x2ac4aa['params']['id']}})['then'](handleEntityNotFound(_0x4ac32a,null))[_0xd277('0x25')](saveUpdates(_0x2ac4aa[_0xd277('0x49')],null))[_0xd277('0x25')](respondWithResult(_0x4ac32a,null))[_0xd277('0x47')](handleError(_0x4ac32a,null));};exports['destroy']=function(_0x4ae4d1,_0x4a6ce4){return db['WhatsappQueue'][_0xd277('0x46')]({'where':{'id':_0x4ae4d1['params']['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x4a6ce4,null))['then'](removeEntity(_0x4a6ce4,null))['catch'](handleError(_0x4a6ce4,null));};exports['describe']=function(_0x5c0862,_0x5edd7a){return db['WhatsappQueue'][_0xd277('0x54')]()[_0xd277('0x25')](respondWithResult(_0x5edd7a,null))[_0xd277('0x47')](handleError(_0x5edd7a,null));};exports['getMembers']=function(_0x3b6c37,_0x4a5159,_0x478e8a){var _0x25e2af={'raw':!![],'where':{}},_0x4f349e={},_0x4bba3f;return db[_0xd277('0x42')][_0xd277('0x55')]({'where':{'id':_0x3b6c37[_0xd277('0x56')]['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x4a5159,null))['then'](function(_0x547994){if(_0x547994){_0x4bba3f=_0x547994[_0xd277('0x4b')]({'plain':!![]});_0x4f349e[_0xd277('0x30')]=_[_0xd277('0x32')](db[_0xd277('0x57')][_0xd277('0x45')]);_0x4f349e['query']=_[_0xd277('0x32')](_0x3b6c37[_0xd277('0x31')]);_0x4f349e[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x4f349e[_0xd277('0x30')],_0x4f349e[_0xd277('0x31')]);_0x25e2af[_0xd277('0x35')]=_[_0xd277('0x33')](_0x4f349e['model'],qs[_0xd277('0x34')](_0x3b6c37[_0xd277('0x31')][_0xd277('0x34')]));_0x25e2af[_0xd277('0x35')]=_0x25e2af['attributes'][_0xd277('0x36')]?_0x25e2af[_0xd277('0x35')]:_0x4f349e[_0xd277('0x30')];if(!_0x3b6c37[_0xd277('0x31')][_0xd277('0x58')](_0xd277('0x37'))){_0x25e2af[_0xd277('0x21')]=qs['limit'](_0x3b6c37[_0xd277('0x31')][_0xd277('0x21')]);_0x25e2af[_0xd277('0x20')]=qs[_0xd277('0x20')](_0x3b6c37[_0xd277('0x31')][_0xd277('0x20')]);}_0x25e2af[_0xd277('0x59')]=qs[_0xd277('0x38')](_0x3b6c37[_0xd277('0x31')]['sort']);_0x25e2af[_0xd277('0x39')]=qs[_0xd277('0x3b')](_[_0xd277('0x3a')](_0x3b6c37[_0xd277('0x31')],_0x4f349e[_0xd277('0x3b')]));_0x25e2af[_0xd277('0x39')][_0xd277('0x5a')]=_0x547994['id'];if(_0x3b6c37[_0xd277('0x31')][_0xd277('0x3c')]){_0x25e2af[_0xd277('0x39')]=_['merge'](_0x25e2af[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x25e2af[_0xd277('0x35')],function(_0x587f9a){var _0x5e2f1a={};_0x5e2f1a[_0x587f9a]={'$like':'%'+_0x3b6c37[_0xd277('0x31')][_0xd277('0x3c')]+'%'};return _0x5e2f1a;})});}_0x25e2af=_[_0xd277('0x3e')]({},_0x25e2af,_0x3b6c37[_0xd277('0x3f')]);return db[_0xd277('0x57')][_0xd277('0x43')](_0x25e2af);}})['then'](function(_0x4b7615){if(_0x4b7615){return db['User'][_0xd277('0x5b')]({'where':{'id':_['map'](_0x4b7615,_0xd277('0x5c')),'role':'agent'},'attributes':['id','name',_0xd277('0x5d'),_0xd277('0x5e'),'createdAt']});}})['then'](function(_0x4191a1){if(_0x4191a1){return{'count':_0x4191a1[_0xd277('0x1f')],'rows':_[_0xd277('0x2c')](_0x4191a1[_0xd277('0x44')],function(_0xcb3fe0){return{'membername':_0xcb3fe0['name'],'UserId':_0xcb3fe0['id'],'queue_name':_0x4bba3f[_0xd277('0x2a')],'WhatsappQueueId':_0x4bba3f['id'],'interface':util[_0xd277('0x5f')](_0xd277('0x60'),_0xd277('0x61'),_0xcb3fe0[_0xd277('0x2a')]),'penalty':0x0,'paused':_0xcb3fe0[_0xd277('0x5d')],'createdAt':_0xcb3fe0[_0xd277('0x62')],'updatedAt':_0xcb3fe0[_0xd277('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd277('0x25')](respondWithFilteredResult(_0x4a5159,_0x25e2af))[_0xd277('0x47')](handleError(_0x4a5159,null));};exports['getTeams']=function(_0x1cd5e1,_0x5c4c4f,_0x302d0d){var _0x5bdb83={};var _0x3ee4fd={};var _0x1c5767;var _0x56c80b;return db[_0xd277('0x42')][_0xd277('0x55')]({'where':{'id':_0x1cd5e1[_0xd277('0x56')]['id']}})['then'](handleEntityNotFound(_0x5c4c4f,null))[_0xd277('0x25')](function(_0x475320){if(_0x475320){_0x1c5767=_0x475320;_0x3ee4fd[_0xd277('0x30')]=_[_0xd277('0x32')](db[_0xd277('0x63')][_0xd277('0x45')]);_0x3ee4fd['query']=_[_0xd277('0x32')](_0x1cd5e1[_0xd277('0x31')]);_0x3ee4fd[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x3ee4fd['model'],_0x3ee4fd[_0xd277('0x31')]);_0x5bdb83['attributes']=_['intersection'](_0x3ee4fd[_0xd277('0x30')],qs[_0xd277('0x34')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x34')]));_0x5bdb83[_0xd277('0x35')]=_0x5bdb83[_0xd277('0x35')][_0xd277('0x36')]?_0x5bdb83[_0xd277('0x35')]:_0x3ee4fd['model'];_0x5bdb83[_0xd277('0x59')]=qs[_0xd277('0x38')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x38')]);_0x5bdb83[_0xd277('0x39')]=qs['filters'](_[_0xd277('0x3a')](_0x1cd5e1[_0xd277('0x31')],_0x3ee4fd[_0xd277('0x3b')]));if(_0x1cd5e1[_0xd277('0x31')]['filter']){_0x5bdb83[_0xd277('0x39')]=_[_0xd277('0x3e')](_0x5bdb83[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x5bdb83[_0xd277('0x35')],function(_0x514115){var _0x3951b5={};_0x3951b5[_0x514115]={'$like':'%'+_0x1cd5e1[_0xd277('0x31')]['filter']+'%'};return _0x3951b5;})});}_0x5bdb83=_[_0xd277('0x3e')]({},_0x5bdb83,_0x1cd5e1[_0xd277('0x3f')]);return _0x1c5767[_0xd277('0x64')](_0x5bdb83);}})[_0xd277('0x25')](function(_0x5a1cc6){if(_0x5a1cc6){_0x56c80b=_0x5a1cc6['length'];if(!_0x1cd5e1[_0xd277('0x31')][_0xd277('0x58')](_0xd277('0x37'))){_0x5bdb83['limit']=qs[_0xd277('0x21')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x21')]);_0x5bdb83[_0xd277('0x20')]=qs[_0xd277('0x20')](_0x1cd5e1[_0xd277('0x31')][_0xd277('0x20')]);}return _0x1c5767[_0xd277('0x64')](_0x5bdb83);}})[_0xd277('0x25')](function(_0x1c389a){if(_0x1c389a){return _0x1c389a?{'count':_0x56c80b,'rows':_0x1c389a}:null;}})[_0xd277('0x25')](respondWithResult(_0x5c4c4f,null))[_0xd277('0x47')](handleError(_0x5c4c4f,null));};exports[_0xd277('0x65')]=function(_0x361365,_0x2b6165,_0x55b450){var _0x5bc51d=_0x361365['body'][_0xd277('0x66')];return db[_0xd277('0x63')][_0xd277('0x43')]({'where':{'id':_0x5bc51d},'attributes':['id'],'include':[{'model':db[_0xd277('0x67')],'as':_0xd277('0x68'),'attributes':['id',_0xd277('0x2a'),_0xd277('0x69'),_0xd277('0x6a'),'interface'],'raw':!![]}]})['then'](function(_0x591cb8){if(_0x591cb8){var _0x176da5=_[_0xd277('0x6b')](_0x591cb8,function(_0x532cc8){var _0x5feb15=_0x532cc8[_0xd277('0x4b')]({'plain':!![]});return _0x5feb15[_0xd277('0x68')];});return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x361365['params']['id']}})[_0xd277('0x25')](function(_0x21c9b6){return db[_0xd277('0x6c')][_0xd277('0x6d')](function(_0x7c5553){return _0x21c9b6[_0xd277('0x65')](_0x5bc51d,{'transaction':_0x7c5553})[_0xd277('0x25')](function(){return BPromise[_0xd277('0x6e')](_0x176da5,function(_0x5e7743){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x5e7743['id'],'WhatsappQueueId':_0x361365[_0xd277('0x56')]['id']},'transaction':_0x7c5553});});})['then'](function(){_0x176da5[_0xd277('0x6f')](function(_0x1c6674){socket[_0xd277('0x70')](_0xd277('0x71'),{'UserId':_0x1c6674['id'],'WhatsappQueueId':_0x21c9b6['id']});});});});});}})[_0xd277('0x25')](respondWithStatusCode(_0x2b6165,null))['catch'](handleError(_0x2b6165,null));};exports[_0xd277('0x72')]=function(_0x12e353,_0x4f08a2,_0x45cb20){return db[_0xd277('0x63')][_0xd277('0x43')]({'where':{'id':_0x12e353[_0xd277('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd277('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f08a2,null))[_0xd277('0x25')](function(_0x327db9){var _0x25a54b=_[_0xd277('0x2c')](_0x327db9,'id');var _0x36c8f4=[];var _0x34bf95=[];var _0x50447a=squel[_0xd277('0x73')]();_0x50447a[_0xd277('0x74')]('tq.TeamId')[_0xd277('0x75')](_0xd277('0x76'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd277('0x39')]('WhatsappQueueId\x20=\x20?',_0x12e353[_0xd277('0x56')]['id']);for(var _0x2f3b42=0x0;_0x2f3b42<_0x327db9['length'];_0x2f3b42+=0x1){let _0x4d659f=_0x327db9[_0x2f3b42];for(var _0x251f29=0x0;_0x251f29<_0x4d659f[_0xd277('0x68')][_0xd277('0x36')];_0x251f29+=0x1){let _0x458861=_0x4d659f[_0xd277('0x68')][_0x251f29];var _0x3c525f=_0x50447a[_0xd277('0x77')]();_0x3c525f[_0xd277('0x39')](_0xd277('0x78'),_0x458861['id']);_0x34bf95[_0xd277('0x79')](db[_0xd277('0x6c')][_0xd277('0x31')](_0x3c525f[_0xd277('0x7a')](),{'type':db[_0xd277('0x6c')][_0xd277('0x7b')][_0xd277('0x7c')]})['then'](function(_0x123583){if(_0x123583['length']===0x1){return _0x458861['id'];}else{var _0x2638a8=_[_0xd277('0x7d')](_[_0xd277('0x2c')](_0x123583,'TeamId'),function(_0x1e299c){return _[_0xd277('0x7e')](_0x25a54b,_0x1e299c);});if(_0x2638a8){return _0x458861['id'];}}}));}}return BPromise['all'](_0x34bf95)[_0xd277('0x25')](function(_0x490bcb){_0x36c8f4=_(_0x36c8f4)[_0xd277('0x7f')](_0x490bcb)[_0xd277('0x80')]()[_0xd277('0x81')]();return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x12e353[_0xd277('0x56')]['id']}})[_0xd277('0x25')](function(_0x5ca501){return db[_0xd277('0x6c')][_0xd277('0x6d')](function(_0x3586fc){return _0x5ca501[_0xd277('0x72')](_0x12e353[_0xd277('0x31')][_0xd277('0x66')],{'transaction':_0x3586fc})[_0xd277('0x25')](function(){if(!_['isEmpty'](_0x36c8f4)){return _0x5ca501[_0xd277('0x82')](_0x36c8f4,{'transaction':_0x3586fc});}})['then'](function(){_0x36c8f4[_0xd277('0x6f')](function(_0x48ee74){socket['emit'](_0xd277('0x83'),{'UserId':_0x48ee74,'WhatsappQueueId':_0x5ca501['id']});});});});});});})[_0xd277('0x25')](respondWithStatusCode(_0x4f08a2,null))['catch'](handleError(_0x4f08a2,null));};exports['addAgents']=function(_0x3cb993,_0x25b14d,_0x120216){return db[_0xd277('0x42')][_0xd277('0x46')]({'where':{'id':_0x3cb993['params']['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x25b14d,null))[_0xd277('0x25')](function(_0x56a148){if(_0x56a148){return _0x56a148['addAgents'](_0x3cb993['body']['ids'],_[_0xd277('0x84')](_0x3cb993['body'],[_0xd277('0x66'),'id'])||{})[_0xd277('0x85')](function(_0x883f6a){for(var _0x4c78dc=0x0;_0x4c78dc<_0x3cb993['body'][_0xd277('0x66')][_0xd277('0x36')];_0x4c78dc+=0x1){socket[_0xd277('0x70')](_0xd277('0x71'),{'UserId':_0x3cb993[_0xd277('0x49')][_0xd277('0x66')][_0x4c78dc],'WhatsappQueueId':_0x3cb993[_0xd277('0x56')]['id']});}return _0x883f6a;});}})[_0xd277('0x25')](respondWithResult(_0x25b14d,null))['catch'](handleError(_0x25b14d,null));};exports['removeAgents']=function(_0x3b3723,_0x51bac5,_0x5cd38a){return db[_0xd277('0x42')]['find']({'where':{'id':_0x3b3723[_0xd277('0x56')]['id']}})['then'](handleEntityNotFound(_0x51bac5,null))[_0xd277('0x25')](function(_0x4659c1){if(_0x4659c1){return _0x4659c1[_0xd277('0x82')](_0x3b3723[_0xd277('0x31')][_0xd277('0x66')])['then'](function(){if(_[_0xd277('0x86')](_0x3b3723[_0xd277('0x31')][_0xd277('0x66')])){for(var _0x2b86d6=0x0;_0x2b86d6<_0x3b3723[_0xd277('0x31')][_0xd277('0x66')][_0xd277('0x36')];_0x2b86d6+=0x1){socket[_0xd277('0x70')](_0xd277('0x83'),{'UserId':Number(_0x3b3723[_0xd277('0x31')][_0xd277('0x66')][_0x2b86d6]),'WhatsappQueueId':Number(_0x3b3723[_0xd277('0x56')]['id'])});}}else{socket[_0xd277('0x70')](_0xd277('0x83'),{'UserId':Number(_0x3b3723[_0xd277('0x31')][_0xd277('0x66')]),'WhatsappQueueId':Number(_0x3b3723['params']['id'])});}});}})['then'](respondWithStatusCode(_0x51bac5,null))[_0xd277('0x47')](handleError(_0x51bac5,null));};exports[_0xd277('0x87')]=function(_0x4c21ea,_0x3e3b58,_0x5ba86f){var _0x406b0d={};var _0x20b314={};var _0x4e654b;var _0x780380;return db[_0xd277('0x42')][_0xd277('0x55')]({'where':{'id':_0x4c21ea[_0xd277('0x56')]['id']}})[_0xd277('0x25')](handleEntityNotFound(_0x3e3b58,null))[_0xd277('0x25')](function(_0x5b69d){if(_0x5b69d){_0x4e654b=_0x5b69d;_0x20b314['model']=_[_0xd277('0x32')](db['User'][_0xd277('0x45')]);_0x20b314[_0xd277('0x31')]=_[_0xd277('0x32')](_0x4c21ea[_0xd277('0x31')]);_0x20b314[_0xd277('0x3b')]=_[_0xd277('0x33')](_0x20b314[_0xd277('0x30')],_0x20b314[_0xd277('0x31')]);_0x406b0d['attributes']=_[_0xd277('0x33')](_0x20b314['model'],qs[_0xd277('0x34')](_0x4c21ea[_0xd277('0x31')][_0xd277('0x34')]));_0x406b0d[_0xd277('0x35')]=_0x406b0d[_0xd277('0x35')][_0xd277('0x36')]?_0x406b0d[_0xd277('0x35')]:_0x20b314['model'];_0x406b0d[_0xd277('0x59')]=qs[_0xd277('0x38')](_0x4c21ea[_0xd277('0x31')][_0xd277('0x38')]);_0x406b0d['where']=qs[_0xd277('0x3b')](_[_0xd277('0x3a')](_0x4c21ea[_0xd277('0x31')],_0x20b314[_0xd277('0x3b')]));if(_0x4c21ea[_0xd277('0x31')][_0xd277('0x3c')]){_0x406b0d[_0xd277('0x39')]=_[_0xd277('0x3e')](_0x406b0d[_0xd277('0x39')],{'$or':_[_0xd277('0x2c')](_0x406b0d['attributes'],function(_0x586c32){var _0x273234={};_0x273234[_0x586c32]={'$like':'%'+_0x4c21ea[_0xd277('0x31')]['filter']+'%'};return _0x273234;})});}_0x406b0d=_[_0xd277('0x3e')]({},_0x406b0d,_0x4c21ea[_0xd277('0x3f')]);return _0x4e654b[_0xd277('0x87')](_0x406b0d);}})[_0xd277('0x25')](function(_0x2269bf){if(_0x2269bf){_0x780380=_0x2269bf[_0xd277('0x36')];if(!_0x4c21ea[_0xd277('0x31')][_0xd277('0x58')](_0xd277('0x37'))){_0x406b0d[_0xd277('0x21')]=qs[_0xd277('0x21')](_0x4c21ea[_0xd277('0x31')]['limit']);_0x406b0d['offset']=qs[_0xd277('0x20')](_0x4c21ea[_0xd277('0x31')]['offset']);}return _0x4e654b[_0xd277('0x87')](_0x406b0d);}})[_0xd277('0x25')](function(_0x2f3940){if(_0x2f3940){return _0x2f3940?{'count':_0x780380,'rows':_0x2f3940}:null;}})[_0xd277('0x25')](respondWithResult(_0x3e3b58,null))[_0xd277('0x47')](handleError(_0x3e3b58,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 57f07af..bcd708a 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 _0xab51=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue'];(function(_0x1578c0,_0x12d552){var _0xa1c914=function(_0x2dfe41){while(--_0x2dfe41){_0x1578c0['push'](_0x1578c0['shift']());}};_0xa1c914(++_0x12d552);}(_0xab51,0xb2));var _0x1ab5=function(_0x152fc1,_0x19c30c){_0x152fc1=_0x152fc1-0x0;var _0x35cc62=_0xab51[_0x152fc1];return _0x35cc62;};'use strict';var EventEmitter=require(_0x1ab5('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x1ab5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ab5('0x2'),'afterUpdate':_0x1ab5('0x3'),'afterDestroy':_0x1ab5('0x4')};function emitEvent(_0x64fe61){return function(_0x14a12f,_0x5b8d8b,_0x4b49b8){WhatsappQueueEvents[_0x1ab5('0x5')](_0x64fe61+':'+_0x14a12f['id'],_0x14a12f);WhatsappQueueEvents['emit'](_0x64fe61,_0x14a12f);_0x4b49b8(null);};}for(var e in events){if(events[_0x1ab5('0x6')](e)){var event=events[e];WhatsappQueue[_0x1ab5('0x7')](e,emitEvent(event));}}module[_0x1ab5('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xfb48=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x2ac622,_0x5a31b9){var _0x500fce=function(_0x18b7ef){while(--_0x18b7ef){_0x2ac622['push'](_0x2ac622['shift']());}};_0x500fce(++_0x5a31b9);}(_0xfb48,0x1f4));var _0x8fb4=function(_0x13b666,_0x2c793e){_0x13b666=_0x13b666-0x0;var _0x5b2273=_0xfb48[_0x13b666];return _0x5b2273;};'use strict';var EventEmitter=require(_0x8fb4('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8fb4('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8fb4('0x2'),'afterDestroy':_0x8fb4('0x3')};function emitEvent(_0x7a7f4e){return function(_0x428170,_0x1442b9,_0x316502){WhatsappQueueEvents[_0x8fb4('0x4')](_0x7a7f4e+':'+_0x428170['id'],_0x428170);WhatsappQueueEvents[_0x8fb4('0x4')](_0x7a7f4e,_0x428170);_0x316502(null);};}for(var e in events){if(events[_0x8fb4('0x5')](e)){var event=events[e];WhatsappQueue[_0x8fb4('0x6')](e,emitEvent(event));}}module[_0x8fb4('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 31c556e..f71014a 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 _0x4cd2=['rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x1aae23,_0x5d956f){var _0xd3b01d=function(_0x4be337){while(--_0x4be337){_0x1aae23['push'](_0x1aae23['shift']());}};_0xd3b01d(++_0x5d956f);}(_0x4cd2,0x89));var _0x24cd=function(_0x4cdae9,_0x14d25e){_0x4cdae9=_0x4cdae9-0x0;var _0x252c23=_0x4cd2[_0x4cdae9];return _0x252c23;};'use strict';var _=require(_0x24cd('0x0'));var util=require(_0x24cd('0x1'));var logger=require('../../config/logger')(_0x24cd('0x2'));var moment=require('moment');var BPromise=require(_0x24cd('0x3'));var rp=require(_0x24cd('0x4'));var fs=require('fs');var path=require(_0x24cd('0x5'));var rimraf=require(_0x24cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x24cd('0x7'));module[_0x24cd('0x8')]=function(_0x34d600,_0x19c75d){return _0x34d600['define'](_0x24cd('0x9'),attributes,{'tableName':_0x24cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f2c=['request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api','moment','bluebird'];(function(_0x335c46,_0x2e3773){var _0x11c433=function(_0x4752d0){while(--_0x4752d0){_0x335c46['push'](_0x335c46['shift']());}};_0x11c433(++_0x2e3773);}(_0x6f2c,0x1e7));var _0xc6f2=function(_0x35e535,_0x4382fc){_0x35e535=_0x35e535-0x0;var _0xbd0a98=_0x6f2c[_0x35e535];return _0xbd0a98;};'use strict';var _=require(_0xc6f2('0x0'));var util=require('util');var logger=require(_0xc6f2('0x1'))(_0xc6f2('0x2'));var moment=require(_0xc6f2('0x3'));var BPromise=require(_0xc6f2('0x4'));var rp=require(_0xc6f2('0x5'));var fs=require('fs');var path=require(_0xc6f2('0x6'));var rimraf=require(_0xc6f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xc6f2('0x8'));module[_0xc6f2('0x9')]=function(_0x4d8cbb,_0x2899e5){return _0x4d8cbb[_0xc6f2('0xa')](_0xc6f2('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index b9c9040..07a213e 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 _0x0ddc=['code','message','result','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','then','GetWhatsappQueue','stringify','catch','find','ShowWhatsappQueue','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x41293b,_0x4e73cd){var _0x8a8ec9=function(_0x5cc114){while(--_0x5cc114){_0x41293b['push'](_0x41293b['shift']());}};_0x8a8ec9(++_0x4e73cd);}(_0x0ddc,0x1f3));var _0xc0dd=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x0ddc[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0xc0dd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0dd('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0dd('0x2'));var logger=require(_0xc0dd('0x3'))('rpc');var config=require(_0xc0dd('0x4'));var jayson=require(_0xc0dd('0x5'));var client=jayson[_0xc0dd('0x6')][_0xc0dd('0x7')]({'port':0x232a});config[_0xc0dd('0x8')]=_[_0xc0dd('0x9')](config['redis'],{'host':_0xc0dd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc0dd('0xb'))[_0xc0dd('0xc')](socket);function respondWithRpcPromise(_0x1023b7,_0x4175f9,_0x58978f){return new BPromise(function(_0x415527,_0x59dd59){return client['request'](_0x1023b7,_0x58978f)['then'](function(_0x1811db){logger[_0xc0dd('0xd')](_0xc0dd('0xe'),_0x4175f9,_0xc0dd('0xf'));logger[_0xc0dd('0x10')](_0xc0dd('0x11'),_0x4175f9,_0xc0dd('0xf'),JSON['stringify'](_0x1811db));if(_0x1811db[_0xc0dd('0x12')]){if(_0x1811db[_0xc0dd('0x12')][_0xc0dd('0x13')]===0x1f4){logger[_0xc0dd('0x12')](_0xc0dd('0xe'),_0x4175f9,_0x1811db['error'][_0xc0dd('0x14')]);return _0x59dd59(_0x1811db[_0xc0dd('0x12')]['message']);}logger['error'](_0xc0dd('0xe'),_0x4175f9,_0x1811db[_0xc0dd('0x12')]['message']);return _0x415527(_0x1811db[_0xc0dd('0x12')][_0xc0dd('0x14')]);}else{logger[_0xc0dd('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x4175f9,_0xc0dd('0xf'));_0x415527(_0x1811db[_0xc0dd('0x15')]['message']);}})['catch'](function(_0x3d835c){logger[_0xc0dd('0x12')](_0xc0dd('0xe'),_0x4175f9,_0x3d835c);_0x59dd59(_0x3d835c);});});}exports['GetWhatsappQueue']=function(_0x288786){var _0x386bee=this;return new Promise(function(_0x17dbb7,_0x202731){return db[_0xc0dd('0x16')][_0xc0dd('0x17')]({'raw':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x19')]===undefined?!![]:![]:!![],'where':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1a')]||null:null,'attributes':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1b')]||null:null,'limit':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')]['limit']||null:null,'include':_0x288786[_0xc0dd('0x18')]?_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x288786[_0xc0dd('0x18')][_0xc0dd('0x1c')],function(_0x253880){return{'model':db[_0x253880[_0xc0dd('0x1e')]],'as':_0x253880['as'],'attributes':_0x253880['attributes'],'include':_0x253880[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x253880[_0xc0dd('0x1c')],function(_0x2feda7){return{'model':db[_0x2feda7[_0xc0dd('0x1e')]],'as':_0x2feda7['as'],'attributes':_0x2feda7[_0xc0dd('0x1b')],'include':_0x2feda7[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x2feda7[_0xc0dd('0x1c')],function(_0x386d26){return{'model':db[_0x386d26['model']],'as':_0x386d26['as'],'attributes':_0x386d26['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0dd('0x1f')](function(_0x4cf86a){logger[_0xc0dd('0xd')]('GetWhatsappQueue',_0x288786);logger[_0xc0dd('0x10')](_0xc0dd('0x20'),_0x288786,JSON[_0xc0dd('0x21')](_0x4cf86a));_0x17dbb7(_0x4cf86a);})[_0xc0dd('0x22')](function(_0x3807fe){logger['error'](_0xc0dd('0x20'),_0x3807fe['message'],_0x288786);_0x202731(_0x386bee[_0xc0dd('0x12')](0x1f4,_0x3807fe[_0xc0dd('0x14')]));});});};exports['ShowWhatsappQueue']=function(_0x1b4789){var _0x2051b2=this;return new Promise(function(_0x113c03,_0x548473){return db[_0xc0dd('0x16')][_0xc0dd('0x23')]({'raw':_0x1b4789[_0xc0dd('0x18')]?_0x1b4789['options'][_0xc0dd('0x19')]===undefined?!![]:![]:!![],'where':_0x1b4789[_0xc0dd('0x18')]?_0x1b4789[_0xc0dd('0x18')][_0xc0dd('0x1a')]||null:null,'attributes':_0x1b4789['options']?_0x1b4789[_0xc0dd('0x18')][_0xc0dd('0x1b')]||null:null,'include':_0x1b4789[_0xc0dd('0x18')]?_0x1b4789['options']['include']?_[_0xc0dd('0x1d')](_0x1b4789[_0xc0dd('0x18')]['include'],function(_0x1ee688){return{'model':db[_0x1ee688[_0xc0dd('0x1e')]],'as':_0x1ee688['as'],'attributes':_0x1ee688[_0xc0dd('0x1b')],'include':_0x1ee688[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x1ee688[_0xc0dd('0x1c')],function(_0x5157f2){return{'model':db[_0x5157f2[_0xc0dd('0x1e')]],'as':_0x5157f2['as'],'attributes':_0x5157f2[_0xc0dd('0x1b')],'include':_0x5157f2[_0xc0dd('0x1c')]?_[_0xc0dd('0x1d')](_0x5157f2[_0xc0dd('0x1c')],function(_0x5b5fb7){return{'model':db[_0x5b5fb7[_0xc0dd('0x1e')]],'as':_0x5b5fb7['as'],'attributes':_0x5b5fb7[_0xc0dd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc0dd('0x1f')](function(_0x3964b3){logger[_0xc0dd('0xd')](_0xc0dd('0x24'),_0x1b4789);logger[_0xc0dd('0x10')](_0xc0dd('0x24'),_0x1b4789,JSON[_0xc0dd('0x21')](_0x3964b3));_0x113c03(_0x3964b3);})['catch'](function(_0x28d0b7){logger[_0xc0dd('0x12')](_0xc0dd('0x24'),_0x28d0b7[_0xc0dd('0x14')],_0x1b4789);_0x548473(_0x2051b2[_0xc0dd('0x12')](0x1f4,_0x28d0b7[_0xc0dd('0x14')]));});});}; \ No newline at end of file +var _0xbcaa=['message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7f30ae,_0xcaeaf3){var _0x4ec1fc=function(_0x550619){while(--_0x550619){_0x7f30ae['push'](_0x7f30ae['shift']());}};_0x4ec1fc(++_0xcaeaf3);}(_0xbcaa,0xb3));var _0xabca=function(_0x305e25,_0x47f621){_0x305e25=_0x305e25-0x0;var _0x1c0b23=_0xbcaa[_0x305e25];return _0x1c0b23;};'use strict';var _=require(_0xabca('0x0'));var util=require(_0xabca('0x1'));var moment=require(_0xabca('0x2'));var BPromise=require('bluebird');var rs=require(_0xabca('0x3'));var fs=require('fs');var Redis=require(_0xabca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xabca('0x5'));var logger=require(_0xabca('0x6'))(_0xabca('0x7'));var config=require(_0xabca('0x8'));var jayson=require(_0xabca('0x9'));var client=jayson[_0xabca('0xa')][_0xabca('0xb')]({'port':0x232a});config[_0xabca('0xc')]=_['defaults'](config[_0xabca('0xc')],{'host':_0xabca('0xd'),'port':0x18eb});var socket=require(_0xabca('0xe'))(new Redis(config[_0xabca('0xc')]));require(_0xabca('0xf'))['register'](socket);function respondWithRpcPromise(_0x590f22,_0x3dac51,_0x22b08b){return new BPromise(function(_0x20b7e5,_0x3915c3){return client[_0xabca('0x10')](_0x590f22,_0x22b08b)[_0xabca('0x11')](function(_0x928ad5){logger[_0xabca('0x12')](_0xabca('0x13'),_0x3dac51,_0xabca('0x14'));logger[_0xabca('0x15')](_0xabca('0x16'),_0x3dac51,_0xabca('0x14'),JSON[_0xabca('0x17')](_0x928ad5));if(_0x928ad5[_0xabca('0x18')]){if(_0x928ad5['error'][_0xabca('0x19')]===0x1f4){logger[_0xabca('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x3dac51,_0x928ad5['error'][_0xabca('0x1a')]);return _0x3915c3(_0x928ad5[_0xabca('0x18')][_0xabca('0x1a')]);}logger[_0xabca('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x3dac51,_0x928ad5[_0xabca('0x18')]['message']);return _0x20b7e5(_0x928ad5['error']['message']);}else{logger[_0xabca('0x12')](_0xabca('0x13'),_0x3dac51,_0xabca('0x14'));_0x20b7e5(_0x928ad5[_0xabca('0x1b')][_0xabca('0x1a')]);}})[_0xabca('0x1c')](function(_0x8bd56b){logger['error'](_0xabca('0x13'),_0x3dac51,_0x8bd56b);_0x3915c3(_0x8bd56b);});});}exports[_0xabca('0x1d')]=function(_0x5a054c){var _0x43079a=this;return new Promise(function(_0x4a4c48,_0x425a3a){return db['WhatsappQueue'][_0xabca('0x1e')]({'raw':_0x5a054c['options']?_0x5a054c[_0xabca('0x1f')][_0xabca('0x20')]===undefined?!![]:![]:!![],'where':_0x5a054c[_0xabca('0x1f')]?_0x5a054c['options'][_0xabca('0x21')]||null:null,'attributes':_0x5a054c[_0xabca('0x1f')]?_0x5a054c[_0xabca('0x1f')][_0xabca('0x22')]||null:null,'limit':_0x5a054c[_0xabca('0x1f')]?_0x5a054c[_0xabca('0x1f')][_0xabca('0x23')]||null:null,'include':_0x5a054c[_0xabca('0x1f')]?_0x5a054c[_0xabca('0x1f')][_0xabca('0x24')]?_[_0xabca('0x25')](_0x5a054c[_0xabca('0x1f')][_0xabca('0x24')],function(_0x44ad07){return{'model':db[_0x44ad07['model']],'as':_0x44ad07['as'],'attributes':_0x44ad07[_0xabca('0x22')],'include':_0x44ad07[_0xabca('0x24')]?_['map'](_0x44ad07[_0xabca('0x24')],function(_0x2a005b){return{'model':db[_0x2a005b['model']],'as':_0x2a005b['as'],'attributes':_0x2a005b[_0xabca('0x22')],'include':_0x2a005b[_0xabca('0x24')]?_[_0xabca('0x25')](_0x2a005b[_0xabca('0x24')],function(_0x4595b2){return{'model':db[_0x4595b2[_0xabca('0x26')]],'as':_0x4595b2['as'],'attributes':_0x4595b2[_0xabca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xabca('0x11')](function(_0xe71eb6){logger['info'](_0xabca('0x1d'),_0x5a054c);logger[_0xabca('0x15')](_0xabca('0x1d'),_0x5a054c,JSON['stringify'](_0xe71eb6));_0x4a4c48(_0xe71eb6);})[_0xabca('0x1c')](function(_0x1e6f68){logger[_0xabca('0x18')](_0xabca('0x1d'),_0x1e6f68[_0xabca('0x1a')],_0x5a054c);_0x425a3a(_0x43079a['error'](0x1f4,_0x1e6f68[_0xabca('0x1a')]));});});};exports[_0xabca('0x27')]=function(_0x467906){var _0x46c71b=this;return new Promise(function(_0x589b5f,_0x1bbe67){return db['WhatsappQueue'][_0xabca('0x28')]({'raw':_0x467906['options']?_0x467906[_0xabca('0x1f')][_0xabca('0x20')]===undefined?!![]:![]:!![],'where':_0x467906['options']?_0x467906[_0xabca('0x1f')][_0xabca('0x21')]||null:null,'attributes':_0x467906[_0xabca('0x1f')]?_0x467906[_0xabca('0x1f')][_0xabca('0x22')]||null:null,'include':_0x467906[_0xabca('0x1f')]?_0x467906[_0xabca('0x1f')][_0xabca('0x24')]?_[_0xabca('0x25')](_0x467906[_0xabca('0x1f')][_0xabca('0x24')],function(_0x163f16){return{'model':db[_0x163f16['model']],'as':_0x163f16['as'],'attributes':_0x163f16[_0xabca('0x22')],'include':_0x163f16['include']?_[_0xabca('0x25')](_0x163f16[_0xabca('0x24')],function(_0xc7f5ae){return{'model':db[_0xc7f5ae[_0xabca('0x26')]],'as':_0xc7f5ae['as'],'attributes':_0xc7f5ae[_0xabca('0x22')],'include':_0xc7f5ae[_0xabca('0x24')]?_[_0xabca('0x25')](_0xc7f5ae[_0xabca('0x24')],function(_0x3eab24){return{'model':db[_0x3eab24[_0xabca('0x26')]],'as':_0x3eab24['as'],'attributes':_0x3eab24[_0xabca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xabca('0x11')](function(_0x59a9c6){logger[_0xabca('0x12')](_0xabca('0x27'),_0x467906);logger[_0xabca('0x15')](_0xabca('0x27'),_0x467906,JSON['stringify'](_0x59a9c6));_0x589b5f(_0x59a9c6);})[_0xabca('0x1c')](function(_0x293281){logger[_0xabca('0x18')](_0xabca('0x27'),_0x293281[_0xabca('0x1a')],_0x467906);_0x1bbe67(_0x46c71b[_0xabca('0x18')](0x1f4,_0x293281['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 25623ff..ac738ff 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 _0x21db=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x364328,_0x19870b){var _0x2ef999=function(_0x460a82){while(--_0x460a82){_0x364328['push'](_0x364328['shift']());}};_0x2ef999(++_0x19870b);}(_0x21db,0x11d));var _0xb21d=function(_0x147266,_0x5d557d){_0x147266=_0x147266-0x0;var _0x4731f5=_0x21db[_0x147266];return _0x4731f5;};'use strict';var WhatsappQueueEvents=require(_0xb21d('0x0'));var events=[_0xb21d('0x1'),_0xb21d('0x2'),_0xb21d('0x3')];function createListener(_0x3fd680,_0x581549){return function(_0x423871){_0x581549[_0xb21d('0x4')](_0x3fd680,_0x423871);};}function removeListener(_0x96df0a,_0x5c2e64){return function(){WhatsappQueueEvents[_0xb21d('0x5')](_0x96df0a,_0x5c2e64);};}exports[_0xb21d('0x6')]=function(_0x4fd7c9){for(var _0x5c2d1f=0x0,_0x12658a=events[_0xb21d('0x7')];_0x5c2d1f<_0x12658a;_0x5c2d1f++){var _0x21b896=events[_0x5c2d1f];var _0x21b6c8=createListener(_0xb21d('0x8')+_0x21b896,_0x4fd7c9);WhatsappQueueEvents['on'](_0x21b896,_0x21b6c8);}}; \ No newline at end of file +var _0xb5f8=['emit','removeListener','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb5f8,0x88));var _0x8b5f=function(_0x4d2767,_0x2ea50a){_0x4d2767=_0x4d2767-0x0;var _0x481f13=_0xb5f8[_0x4d2767];return _0x481f13;};'use strict';var WhatsappQueueEvents=require(_0x8b5f('0x0'));var events=[_0x8b5f('0x1'),_0x8b5f('0x2'),_0x8b5f('0x3')];function createListener(_0x3dd835,_0x5ad302){return function(_0x143dc5){_0x5ad302[_0x8b5f('0x4')](_0x3dd835,_0x143dc5);};}function removeListener(_0x4d24c6,_0x3d1094){return function(){WhatsappQueueEvents[_0x8b5f('0x5')](_0x4d24c6,_0x3d1094);};}exports['register']=function(_0x437371){for(var _0x3f6cc9=0x0,_0x4d3b72=events['length'];_0x3f6cc9<_0x4d3b72;_0x3f6cc9++){var _0x25111a=events[_0x3f6cc9];var _0x1b48e1=createListener(_0x8b5f('0x6')+_0x25111a,_0x437371);WhatsappQueueEvents['on'](_0x25111a,_0x1b48e1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bae6b8d..fbab88e 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 _0x51fe=['/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x1b5639,_0x31ecf5){var _0x402e79=function(_0x24ba6f){while(--_0x24ba6f){_0x1b5639['push'](_0x1b5639['shift']());}};_0x402e79(++_0x31ecf5);}(_0x51fe,0x1d0));var _0xe51f=function(_0x5e413d,_0x51688b){_0x5e413d=_0x5e413d-0x0;var _0x3f11eb=_0x51fe[_0x5e413d];return _0x3f11eb;};'use strict';var multer=require('multer');var util=require(_0xe51f('0x0'));var path=require(_0xe51f('0x1'));var timeout=require(_0xe51f('0x2'));var express=require('express');var router=express[_0xe51f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe51f('0x4'));var config=require(_0xe51f('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0xe51f('0x6')]('/',auth[_0xe51f('0x7')](),controller[_0xe51f('0x8')]);router[_0xe51f('0x6')](_0xe51f('0x9'),auth[_0xe51f('0x7')](),controller[_0xe51f('0xa')]);router[_0xe51f('0x6')](_0xe51f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe51f('0xc')]('/',auth['isAuthenticated'](),controller[_0xe51f('0xd')]);router[_0xe51f('0xe')](_0xe51f('0xb'),auth[_0xe51f('0x7')](),controller[_0xe51f('0xf')]);router[_0xe51f('0x10')]('/:id',auth[_0xe51f('0x7')](),controller[_0xe51f('0x11')]);module[_0xe51f('0x12')]=router; \ No newline at end of file +var _0x2687=['Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x24d22f,_0xfa6241){var _0x33b153=function(_0x28caa6){while(--_0x28caa6){_0x24d22f['push'](_0x24d22f['shift']());}};_0x33b153(++_0xfa6241);}(_0x2687,0x8f));var _0x7268=function(_0x28acd0,_0x387a42){_0x28acd0=_0x28acd0-0x0;var _0x848823=_0x2687[_0x28acd0];return _0x848823;};'use strict';var multer=require(_0x7268('0x0'));var util=require(_0x7268('0x1'));var path=require('path');var timeout=require(_0x7268('0x2'));var express=require(_0x7268('0x3'));var router=express[_0x7268('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7268('0x5'));var config=require(_0x7268('0x6'));var controller=require(_0x7268('0x7'));router['get']('/',auth[_0x7268('0x8')](),controller[_0x7268('0x9')]);router[_0x7268('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x7268('0xb')]);router[_0x7268('0xa')](_0x7268('0xc'),auth[_0x7268('0x8')](),controller[_0x7268('0xd')]);router[_0x7268('0xe')]('/',auth[_0x7268('0x8')](),controller[_0x7268('0xf')]);router[_0x7268('0x10')](_0x7268('0xc'),auth[_0x7268('0x8')](),controller[_0x7268('0x11')]);router[_0x7268('0x12')](_0x7268('0xc'),auth['isAuthenticated'](),controller[_0x7268('0x13')]);module[_0x7268('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3510e4b..5d3420f 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 _0x6aa7=['DATE','sequelize','STRING'];(function(_0x5e4940,_0x3208ae){var _0x297cd4=function(_0x469be2){while(--_0x469be2){_0x5e4940['push'](_0x5e4940['shift']());}};_0x297cd4(++_0x3208ae);}(_0x6aa7,0x178));var _0x76aa=function(_0x356205,_0x4ec598){_0x356205=_0x356205-0x0;var _0x11f3bd=_0x6aa7[_0x356205];return _0x11f3bd;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x4bf095,_0x5b48da){var _0x2c3f7a=function(_0x33239c){while(--_0x33239c){_0x4bf095['push'](_0x4bf095['shift']());}};_0x2c3f7a(++_0x5b48da);}(_0x55ca,0x126));var _0xa55c=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x55ca[_0x403115];return _0x596ef3;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f645ec9..936abee 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 _0xa448=['options','include','WhatsappQueueReport','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x2480b5,_0x1899e9){var _0x108649=function(_0x205847){while(--_0x205847){_0x2480b5['push'](_0x2480b5['shift']());}};_0x108649(++_0x1899e9);}(_0xa448,0xe4));var _0x8a44=function(_0x128c9b,_0x47ca67){_0x128c9b=_0x128c9b-0x0;var _0x3f7a52=_0xa448[_0x128c9b];return _0x3f7a52;};'use strict';var pdf=require(_0x8a44('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a44('0x1'));var jsonpatch=require(_0x8a44('0x2'));var rp=require('request-promise');var moment=require(_0x8a44('0x3'));var BPromise=require(_0x8a44('0x4'));var Mustache=require(_0x8a44('0x5'));var util=require(_0x8a44('0x6'));var path=require(_0x8a44('0x7'));var sox=require('sox');var csv=require(_0x8a44('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a44('0x9'));var squel=require(_0x8a44('0xa'));var crypto=require(_0x8a44('0xb'));var jsforce=require(_0x8a44('0xc'));var deskjs=require(_0x8a44('0xd'));var toCsv=require(_0x8a44('0x8'));var querystring=require(_0x8a44('0xe'));var Papa=require(_0x8a44('0xf'));var Redis=require(_0x8a44('0x10'));var authService=require(_0x8a44('0x11'));var qs=require(_0x8a44('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a44('0x13'))('api');var utils=require(_0x8a44('0x14'));var config=require(_0x8a44('0x15'));var licenseUtil=require(_0x8a44('0x16'));var db=require(_0x8a44('0x17'))['db'];function respondWithStatusCode(_0x4287a1,_0x270f52){_0x270f52=_0x270f52||0xcc;return function(_0x5f1cf3){if(_0x5f1cf3){return _0x4287a1['sendStatus'](_0x270f52);}return _0x4287a1[_0x8a44('0x18')](_0x270f52)[_0x8a44('0x19')]();};}function respondWithResult(_0x23b18b,_0x1bdc62){_0x1bdc62=_0x1bdc62||0xc8;return function(_0x4cc6fd){if(_0x4cc6fd){return _0x23b18b[_0x8a44('0x18')](_0x1bdc62)[_0x8a44('0x1a')](_0x4cc6fd);}};}function respondWithFilteredResult(_0x283ed8,_0x38b2b6){return function(_0x42b564){if(_0x42b564){var _0x4bb2fb=_0x42b564[_0x8a44('0x1b')],_0x1d1e1a=_0x38b2b6['offset'],_0x4b0084=_0x38b2b6[_0x8a44('0x1c')]+_0x38b2b6[_0x8a44('0x1d')],_0x215d67;if(_0x4b0084>=_0x4bb2fb){_0x4b0084=_0x4bb2fb;_0x215d67=0xc8;}else{_0x215d67=0xce;}_0x283ed8[_0x8a44('0x18')](_0x215d67);return _0x283ed8[_0x8a44('0x1e')](_0x8a44('0x1f'),_0x1d1e1a+'-'+_0x4b0084+'/'+_0x4bb2fb)[_0x8a44('0x1a')](_0x42b564);}return null;};}function patchUpdates(_0xed716){return function(_0x95c8c3){try{jsonpatch[_0x8a44('0x20')](_0x95c8c3,_0xed716,!![]);}catch(_0x50e533){return BPromise[_0x8a44('0x21')](_0x50e533);}return _0x95c8c3[_0x8a44('0x22')]();};}function saveUpdates(_0x57400e,_0x2eb87b){return function(_0x5af4c8){if(_0x5af4c8){return _0x5af4c8[_0x8a44('0x23')](_0x57400e)[_0x8a44('0x24')](function(_0x211b8a){return _0x211b8a;});}return null;};}function removeEntity(_0x43b1a8,_0x2f851b){return function(_0x1ff301){if(_0x1ff301){return _0x1ff301[_0x8a44('0x25')]()['then'](function(){_0x43b1a8['status'](0xcc)[_0x8a44('0x19')]();});}};}function handleEntityNotFound(_0x5cab28,_0x2f8fe7){return function(_0x32758f){if(!_0x32758f){_0x5cab28['sendStatus'](0x194);}return _0x32758f;};}function handleError(_0x58296,_0x18cf90){_0x18cf90=_0x18cf90||0x1f4;return function(_0x4addcb){logger[_0x8a44('0x26')](_0x4addcb[_0x8a44('0x27')]);if(_0x4addcb['name']){delete _0x4addcb[_0x8a44('0x28')];}_0x58296[_0x8a44('0x18')](_0x18cf90)['send'](_0x4addcb);};}exports['index']=function(_0x2a5202,_0x125424){var _0x159356={},_0x358ec9={},_0x297adc={'count':0x0,'rows':[]};var _0x27c60f=_[_0x8a44('0x29')](db['WhatsappQueueReport']['rawAttributes'],function(_0x53c8f4){return{'name':_0x53c8f4[_0x8a44('0x2a')],'type':_0x53c8f4[_0x8a44('0x2b')][_0x8a44('0x2c')]};});_0x358ec9['model']=_[_0x8a44('0x29')](_0x27c60f,_0x8a44('0x28'));_0x358ec9[_0x8a44('0x2d')]=_[_0x8a44('0x2e')](_0x2a5202[_0x8a44('0x2d')]);_0x358ec9[_0x8a44('0x2f')]=_[_0x8a44('0x30')](_0x358ec9[_0x8a44('0x31')],_0x358ec9[_0x8a44('0x2d')]);_0x159356[_0x8a44('0x32')]=_[_0x8a44('0x30')](_0x358ec9[_0x8a44('0x31')],qs[_0x8a44('0x33')](_0x2a5202[_0x8a44('0x2d')][_0x8a44('0x33')]));_0x159356[_0x8a44('0x32')]=_0x159356['attributes'][_0x8a44('0x34')]?_0x159356['attributes']:_0x358ec9['model'];if(!_0x2a5202['query'][_0x8a44('0x35')](_0x8a44('0x36'))){_0x159356[_0x8a44('0x1d')]=qs[_0x8a44('0x1d')](_0x2a5202[_0x8a44('0x2d')]['limit']);_0x159356[_0x8a44('0x1c')]=qs[_0x8a44('0x1c')](_0x2a5202[_0x8a44('0x2d')][_0x8a44('0x1c')]);}_0x159356[_0x8a44('0x37')]=qs[_0x8a44('0x38')](_0x2a5202[_0x8a44('0x2d')]['sort']);_0x159356[_0x8a44('0x39')]=qs['filters'](_['pick'](_0x2a5202[_0x8a44('0x2d')],_0x358ec9[_0x8a44('0x2f')]),_0x27c60f);if(_0x2a5202['query'][_0x8a44('0x3a')]){_0x159356[_0x8a44('0x39')]=_[_0x8a44('0x3b')](_0x159356[_0x8a44('0x39')],{'$or':_[_0x8a44('0x29')](_0x27c60f,function(_0x3a0f98){if(_0x3a0f98[_0x8a44('0x2b')]!=='VIRTUAL'){var _0x4ecfa3={};_0x4ecfa3[_0x3a0f98['name']]={'$like':'%'+_0x2a5202[_0x8a44('0x2d')][_0x8a44('0x3a')]+'%'};return _0x4ecfa3;}})});}_0x159356=_[_0x8a44('0x3b')]({},_0x159356,_0x2a5202[_0x8a44('0x3c')]);var _0x39c223={'where':_0x159356[_0x8a44('0x39')]};return db['WhatsappQueueReport']['count'](_0x39c223)[_0x8a44('0x24')](function(_0x26c5c4){_0x297adc[_0x8a44('0x1b')]=_0x26c5c4;if(_0x2a5202[_0x8a44('0x2d')]['includeAll']){_0x159356[_0x8a44('0x3d')]=[{'all':!![]}];}return db[_0x8a44('0x3e')][_0x8a44('0x3f')](_0x159356);})['then'](function(_0x2299ed){_0x297adc[_0x8a44('0x40')]=_0x2299ed;return _0x297adc;})['then'](respondWithFilteredResult(_0x125424,_0x159356))[_0x8a44('0x41')](handleError(_0x125424,null));};exports['show']=function(_0x4b36b4,_0x3b4032){var _0x4acea8={'raw':!![],'where':{'id':_0x4b36b4[_0x8a44('0x42')]['id']}},_0x8d0ba6={};_0x8d0ba6[_0x8a44('0x31')]=_[_0x8a44('0x2e')](db['WhatsappQueueReport'][_0x8a44('0x43')]);_0x8d0ba6['query']=_['keys'](_0x4b36b4['query']);_0x8d0ba6[_0x8a44('0x2f')]=_[_0x8a44('0x30')](_0x8d0ba6['model'],_0x8d0ba6['query']);_0x4acea8[_0x8a44('0x32')]=_['intersection'](_0x8d0ba6[_0x8a44('0x31')],qs['fields'](_0x4b36b4[_0x8a44('0x2d')]['fields']));_0x4acea8['attributes']=_0x4acea8[_0x8a44('0x32')][_0x8a44('0x34')]?_0x4acea8[_0x8a44('0x32')]:_0x8d0ba6[_0x8a44('0x31')];if(_0x4b36b4[_0x8a44('0x2d')]['includeAll']){_0x4acea8['include']=[{'all':!![]}];}_0x4acea8=_[_0x8a44('0x3b')]({},_0x4acea8,_0x4b36b4[_0x8a44('0x3c')]);return db[_0x8a44('0x3e')][_0x8a44('0x44')](_0x4acea8)[_0x8a44('0x24')](handleEntityNotFound(_0x3b4032,null))['then'](respondWithResult(_0x3b4032,null))[_0x8a44('0x41')](handleError(_0x3b4032,null));};exports[_0x8a44('0x45')]=function(_0x3e500d,_0x3e9487){return db['WhatsappQueueReport']['create'](_0x3e500d[_0x8a44('0x46')],{})['then'](respondWithResult(_0x3e9487,0xc9))[_0x8a44('0x41')](handleError(_0x3e9487,null));};exports[_0x8a44('0x23')]=function(_0x457c19,_0x2d591e){if(_0x457c19[_0x8a44('0x46')]['id']){delete _0x457c19[_0x8a44('0x46')]['id'];}return db[_0x8a44('0x3e')][_0x8a44('0x44')]({'where':{'id':_0x457c19[_0x8a44('0x42')]['id']}})[_0x8a44('0x24')](handleEntityNotFound(_0x2d591e,null))['then'](saveUpdates(_0x457c19['body'],null))[_0x8a44('0x24')](respondWithResult(_0x2d591e,null))['catch'](handleError(_0x2d591e,null));};exports[_0x8a44('0x25')]=function(_0x26026,_0x9d6721){return db['WhatsappQueueReport'][_0x8a44('0x44')]({'where':{'id':_0x26026[_0x8a44('0x42')]['id']}})[_0x8a44('0x24')](handleEntityNotFound(_0x9d6721,null))[_0x8a44('0x24')](removeEntity(_0x9d6721,null))[_0x8a44('0x41')](handleError(_0x9d6721,null));};exports[_0x8a44('0x47')]=function(_0x4ffafd,_0x265fa6){return db[_0x8a44('0x3e')][_0x8a44('0x47')]()[_0x8a44('0x24')](respondWithResult(_0x265fa6,null))[_0x8a44('0x41')](handleError(_0x265fa6,null));}; \ No newline at end of file +var _0x492d=['util','path','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','html-pdf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5f1f6c,_0x52664d){var _0x5c3492=function(_0x24282c){while(--_0x24282c){_0x5f1f6c['push'](_0x5f1f6c['shift']());}};_0x5c3492(++_0x52664d);}(_0x492d,0x11e));var _0xd492=function(_0x4d92a7,_0x24c6b3){_0x4d92a7=_0x4d92a7-0x0;var _0x360cc9=_0x492d[_0x4d92a7];return _0x360cc9;};'use strict';var pdf=require(_0xd492('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd492('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd492('0x2'));var moment=require(_0xd492('0x3'));var BPromise=require(_0xd492('0x4'));var Mustache=require(_0xd492('0x5'));var util=require(_0xd492('0x6'));var path=require(_0xd492('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd492('0x8'));var crypto=require(_0xd492('0x9'));var jsforce=require(_0xd492('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd492('0xb'));var querystring=require(_0xd492('0xc'));var Papa=require('papaparse');var Redis=require(_0xd492('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd492('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd492('0xf'));var logger=require(_0xd492('0x10'))(_0xd492('0x11'));var utils=require('../../config/utils');var config=require(_0xd492('0x12'));var licenseUtil=require(_0xd492('0x13'));var db=require(_0xd492('0x14'))['db'];function respondWithStatusCode(_0x49bd06,_0x2c1cb5){_0x2c1cb5=_0x2c1cb5||0xcc;return function(_0x5dab0f){if(_0x5dab0f){return _0x49bd06[_0xd492('0x15')](_0x2c1cb5);}return _0x49bd06['status'](_0x2c1cb5)[_0xd492('0x16')]();};}function respondWithResult(_0x9cc966,_0x461f3a){_0x461f3a=_0x461f3a||0xc8;return function(_0x9f996d){if(_0x9f996d){return _0x9cc966[_0xd492('0x17')](_0x461f3a)[_0xd492('0x18')](_0x9f996d);}};}function respondWithFilteredResult(_0x45adf4,_0x2d4b43){return function(_0x4e72fe){if(_0x4e72fe){var _0x2ec0a6=_0x4e72fe['count'],_0x9d41af=_0x2d4b43[_0xd492('0x19')],_0x2dcf51=_0x2d4b43[_0xd492('0x19')]+_0x2d4b43[_0xd492('0x1a')],_0x52045c;if(_0x2dcf51>=_0x2ec0a6){_0x2dcf51=_0x2ec0a6;_0x52045c=0xc8;}else{_0x52045c=0xce;}_0x45adf4[_0xd492('0x17')](_0x52045c);return _0x45adf4[_0xd492('0x1b')](_0xd492('0x1c'),_0x9d41af+'-'+_0x2dcf51+'/'+_0x2ec0a6)[_0xd492('0x18')](_0x4e72fe);}return null;};}function patchUpdates(_0x4e729b){return function(_0x1031da){try{jsonpatch[_0xd492('0x1d')](_0x1031da,_0x4e729b,!![]);}catch(_0x2de30f){return BPromise[_0xd492('0x1e')](_0x2de30f);}return _0x1031da['save']();};}function saveUpdates(_0x3d63d9,_0x5602d3){return function(_0x6ad730){if(_0x6ad730){return _0x6ad730[_0xd492('0x1f')](_0x3d63d9)['then'](function(_0x4d9e12){return _0x4d9e12;});}return null;};}function removeEntity(_0x30ff6d,_0x7a4b26){return function(_0x28af25){if(_0x28af25){return _0x28af25[_0xd492('0x20')]()[_0xd492('0x21')](function(){_0x30ff6d[_0xd492('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38148f,_0x12bae1){return function(_0x23b948){if(!_0x23b948){_0x38148f[_0xd492('0x15')](0x194);}return _0x23b948;};}function handleError(_0x23357f,_0x4c4a9b){_0x4c4a9b=_0x4c4a9b||0x1f4;return function(_0xfbada2){logger[_0xd492('0x22')](_0xfbada2['stack']);if(_0xfbada2[_0xd492('0x23')]){delete _0xfbada2[_0xd492('0x23')];}_0x23357f[_0xd492('0x17')](_0x4c4a9b)[_0xd492('0x24')](_0xfbada2);};}exports[_0xd492('0x25')]=function(_0xd3ef02,_0x28ec41){var _0x4d4dd3={},_0x57f6f0={},_0x6da835={'count':0x0,'rows':[]};var _0x3ec2ba=_['map'](db[_0xd492('0x26')][_0xd492('0x27')],function(_0x492aa4){return{'name':_0x492aa4[_0xd492('0x28')],'type':_0x492aa4[_0xd492('0x29')][_0xd492('0x2a')]};});_0x57f6f0['model']=_[_0xd492('0x2b')](_0x3ec2ba,_0xd492('0x23'));_0x57f6f0['query']=_[_0xd492('0x2c')](_0xd3ef02['query']);_0x57f6f0[_0xd492('0x2d')]=_[_0xd492('0x2e')](_0x57f6f0[_0xd492('0x2f')],_0x57f6f0[_0xd492('0x30')]);_0x4d4dd3['attributes']=_[_0xd492('0x2e')](_0x57f6f0[_0xd492('0x2f')],qs[_0xd492('0x31')](_0xd3ef02[_0xd492('0x30')][_0xd492('0x31')]));_0x4d4dd3[_0xd492('0x32')]=_0x4d4dd3['attributes'][_0xd492('0x33')]?_0x4d4dd3[_0xd492('0x32')]:_0x57f6f0[_0xd492('0x2f')];if(!_0xd3ef02['query'][_0xd492('0x34')]('nolimit')){_0x4d4dd3['limit']=qs[_0xd492('0x1a')](_0xd3ef02['query'][_0xd492('0x1a')]);_0x4d4dd3[_0xd492('0x19')]=qs['offset'](_0xd3ef02[_0xd492('0x30')][_0xd492('0x19')]);}_0x4d4dd3[_0xd492('0x35')]=qs[_0xd492('0x36')](_0xd3ef02[_0xd492('0x30')]['sort']);_0x4d4dd3['where']=qs[_0xd492('0x2d')](_[_0xd492('0x37')](_0xd3ef02['query'],_0x57f6f0['filters']),_0x3ec2ba);if(_0xd3ef02[_0xd492('0x30')][_0xd492('0x38')]){_0x4d4dd3[_0xd492('0x39')]=_['merge'](_0x4d4dd3[_0xd492('0x39')],{'$or':_[_0xd492('0x2b')](_0x3ec2ba,function(_0x1db996){if(_0x1db996[_0xd492('0x29')]!==_0xd492('0x3a')){var _0x3cf0d6={};_0x3cf0d6[_0x1db996[_0xd492('0x23')]]={'$like':'%'+_0xd3ef02[_0xd492('0x30')][_0xd492('0x38')]+'%'};return _0x3cf0d6;}})});}_0x4d4dd3=_[_0xd492('0x3b')]({},_0x4d4dd3,_0xd3ef02[_0xd492('0x3c')]);var _0x2354d0={'where':_0x4d4dd3[_0xd492('0x39')]};return db['WhatsappQueueReport'][_0xd492('0x3d')](_0x2354d0)[_0xd492('0x21')](function(_0x4e8a0b){_0x6da835['count']=_0x4e8a0b;if(_0xd3ef02[_0xd492('0x30')]['includeAll']){_0x4d4dd3[_0xd492('0x3e')]=[{'all':!![]}];}return db[_0xd492('0x26')][_0xd492('0x3f')](_0x4d4dd3);})[_0xd492('0x21')](function(_0x5c9de3){_0x6da835[_0xd492('0x40')]=_0x5c9de3;return _0x6da835;})[_0xd492('0x21')](respondWithFilteredResult(_0x28ec41,_0x4d4dd3))[_0xd492('0x41')](handleError(_0x28ec41,null));};exports[_0xd492('0x42')]=function(_0x23edc4,_0x262613){var _0x20571c={'raw':!![],'where':{'id':_0x23edc4['params']['id']}},_0x5bee3b={};_0x5bee3b[_0xd492('0x2f')]=_[_0xd492('0x2c')](db['WhatsappQueueReport'][_0xd492('0x27')]);_0x5bee3b[_0xd492('0x30')]=_[_0xd492('0x2c')](_0x23edc4[_0xd492('0x30')]);_0x5bee3b[_0xd492('0x2d')]=_[_0xd492('0x2e')](_0x5bee3b[_0xd492('0x2f')],_0x5bee3b[_0xd492('0x30')]);_0x20571c['attributes']=_[_0xd492('0x2e')](_0x5bee3b[_0xd492('0x2f')],qs[_0xd492('0x31')](_0x23edc4['query']['fields']));_0x20571c[_0xd492('0x32')]=_0x20571c[_0xd492('0x32')][_0xd492('0x33')]?_0x20571c[_0xd492('0x32')]:_0x5bee3b[_0xd492('0x2f')];if(_0x23edc4[_0xd492('0x30')][_0xd492('0x43')]){_0x20571c['include']=[{'all':!![]}];}_0x20571c=_[_0xd492('0x3b')]({},_0x20571c,_0x23edc4['options']);return db[_0xd492('0x26')][_0xd492('0x44')](_0x20571c)[_0xd492('0x21')](handleEntityNotFound(_0x262613,null))['then'](respondWithResult(_0x262613,null))[_0xd492('0x41')](handleError(_0x262613,null));};exports[_0xd492('0x45')]=function(_0x2a3910,_0xcbdc9a){return db['WhatsappQueueReport']['create'](_0x2a3910[_0xd492('0x46')],{})[_0xd492('0x21')](respondWithResult(_0xcbdc9a,0xc9))[_0xd492('0x41')](handleError(_0xcbdc9a,null));};exports[_0xd492('0x1f')]=function(_0x10d7aa,_0x10eda7){if(_0x10d7aa[_0xd492('0x46')]['id']){delete _0x10d7aa[_0xd492('0x46')]['id'];}return db[_0xd492('0x26')]['find']({'where':{'id':_0x10d7aa[_0xd492('0x47')]['id']}})['then'](handleEntityNotFound(_0x10eda7,null))['then'](saveUpdates(_0x10d7aa[_0xd492('0x46')],null))[_0xd492('0x21')](respondWithResult(_0x10eda7,null))['catch'](handleError(_0x10eda7,null));};exports[_0xd492('0x20')]=function(_0x43563f,_0x49909d){return db[_0xd492('0x26')][_0xd492('0x44')]({'where':{'id':_0x43563f[_0xd492('0x47')]['id']}})[_0xd492('0x21')](handleEntityNotFound(_0x49909d,null))['then'](removeEntity(_0x49909d,null))[_0xd492('0x41')](handleError(_0x49909d,null));};exports['describe']=function(_0x1ef710,_0x571ca6){return db['WhatsappQueueReport'][_0xd492('0x48')]()[_0xd492('0x21')](respondWithResult(_0x571ca6,null))['catch'](handleError(_0x571ca6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 010214f..4467218 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 _0xb066=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xb066,0x1c9));var _0x6b06=function(_0x5c15f8,_0xa1d891){_0x5c15f8=_0x5c15f8-0x0;var _0x2847bb=_0xb066[_0x5c15f8];return _0x2847bb;};'use strict';var _=require('lodash');var util=require(_0x6b06('0x0'));var logger=require(_0x6b06('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6b06('0x2'));var rp=require(_0x6b06('0x3'));var fs=require('fs');var path=require(_0x6b06('0x4'));var rimraf=require(_0x6b06('0x5'));var config=require(_0x6b06('0x6'));var attributes=require(_0x6b06('0x7'));module[_0x6b06('0x8')]=function(_0xa85096,_0x1e303d){return _0xa85096[_0x6b06('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x6b06('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2b1=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27ea64,_0x4a42a6){var _0x51c81d=function(_0x521372){while(--_0x521372){_0x27ea64['push'](_0x27ea64['shift']());}};_0x51c81d(++_0x4a42a6);}(_0xf2b1,0x90));var _0x1f2b=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xf2b1[_0x379799];return _0x46e431;};'use strict';var _=require(_0x1f2b('0x0'));var util=require(_0x1f2b('0x1'));var logger=require(_0x1f2b('0x2'))(_0x1f2b('0x3'));var moment=require(_0x1f2b('0x4'));var BPromise=require(_0x1f2b('0x5'));var rp=require(_0x1f2b('0x6'));var fs=require('fs');var path=require(_0x1f2b('0x7'));var rimraf=require(_0x1f2b('0x8'));var config=require(_0x1f2b('0x9'));var attributes=require(_0x1f2b('0xa'));module[_0x1f2b('0xb')]=function(_0x19bfb0,_0x32f6b3){return _0x19bfb0[_0x1f2b('0xc')]('WhatsappQueueReport',attributes,{'tableName':_0x1f2b('0xd'),'paranoid':![],'indexes':[{'name':_0x1f2b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 6b516e3..4bd2193 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 _0x497f=['WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateWhatsappQueueReport'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x497f,0x16a));var _0xf497=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0x497f[_0x4b2cc6];return _0x3e0b08;};'use strict';var _=require(_0xf497('0x0'));var util=require(_0xf497('0x1'));var moment=require(_0xf497('0x2'));var BPromise=require(_0xf497('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf497('0x4'));var logger=require(_0xf497('0x5'))(_0xf497('0x6'));var config=require('../../config/environment');var jayson=require(_0xf497('0x7'));var client=jayson['client'][_0xf497('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3a13,_0x548407,_0x1c2d90){return new BPromise(function(_0x12af97,_0x499734){return client[_0xf497('0x9')](_0x2f3a13,_0x1c2d90)[_0xf497('0xa')](function(_0x17e1a4){logger['info'](_0xf497('0xb'),_0x548407,_0xf497('0xc'));logger[_0xf497('0xd')](_0xf497('0xe'),_0x548407,_0xf497('0xc'),JSON['stringify'](_0x17e1a4));if(_0x17e1a4[_0xf497('0xf')]){if(_0x17e1a4[_0xf497('0xf')][_0xf497('0x10')]===0x1f4){logger[_0xf497('0xf')](_0xf497('0xb'),_0x548407,_0x17e1a4[_0xf497('0xf')][_0xf497('0x11')]);return _0x499734(_0x17e1a4[_0xf497('0xf')]['message']);}logger[_0xf497('0xf')](_0xf497('0xb'),_0x548407,_0x17e1a4['error'][_0xf497('0x11')]);return _0x12af97(_0x17e1a4[_0xf497('0xf')]['message']);}else{logger[_0xf497('0x12')](_0xf497('0xb'),_0x548407,_0xf497('0xc'));_0x12af97(_0x17e1a4[_0xf497('0x13')][_0xf497('0x11')]);}})[_0xf497('0x14')](function(_0x497e1b){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x548407,_0x497e1b);_0x499734(_0x497e1b);});});}exports[_0xf497('0x15')]=function(_0x2f598b){var _0x10559f=this;return new Promise(function(_0x237c52,_0x9383c4){return db[_0xf497('0x16')]['create'](_0x2f598b[_0xf497('0x17')],{'raw':_0x2f598b[_0xf497('0x18')]?_0x2f598b['options'][_0xf497('0x19')]===undefined?!![]:![]:!![]})[_0xf497('0xa')](function(_0x54024a){logger[_0xf497('0x12')](_0xf497('0x15'),_0x2f598b);logger[_0xf497('0xd')](_0xf497('0x15'),_0x2f598b,JSON[_0xf497('0x1a')](_0x54024a));_0x237c52(_0x54024a);})[_0xf497('0x14')](function(_0x22467b){logger[_0xf497('0xf')](_0xf497('0x15'),_0x22467b[_0xf497('0x11')],_0x2f598b);_0x9383c4(_0x10559f['error'](0x1f4,_0x22467b[_0xf497('0x11')]));});});};exports[_0xf497('0x1b')]=function(_0x47ab47){var _0x5dd949=this;return new Promise(function(_0x1d42ac,_0x1e1da0){return db[_0xf497('0x16')][_0xf497('0x1c')](_0x47ab47['body'],{'raw':_0x47ab47[_0xf497('0x18')]?_0x47ab47['options'][_0xf497('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ab47['options']?_0x47ab47[_0xf497('0x18')][_0xf497('0x1d')]||null:null,'attributes':_0x47ab47[_0xf497('0x18')]?_0x47ab47['options'][_0xf497('0x1e')]||null:null,'limit':_0x47ab47[_0xf497('0x18')]?_0x47ab47[_0xf497('0x18')][_0xf497('0x1f')]||null:null})[_0xf497('0xa')](function(_0x54c4cc){logger[_0xf497('0x12')](_0xf497('0x1b'),_0x47ab47);logger[_0xf497('0xd')]('UpdateWhatsappQueueReport',_0x47ab47,JSON[_0xf497('0x1a')](_0x54c4cc));_0x1d42ac(_0x54c4cc);})[_0xf497('0x14')](function(_0x55509e){logger['error'](_0xf497('0x1b'),_0x55509e[_0xf497('0x11')],_0x47ab47);_0x1e1da0(_0x5dd949['error'](0x1f4,_0x55509e[_0xf497('0x11')]));});});}; \ No newline at end of file +var _0x3f99=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','debug','lodash','util'];(function(_0x1d3e43,_0x2502d6){var _0x39e13e=function(_0x111d54){while(--_0x111d54){_0x1d3e43['push'](_0x1d3e43['shift']());}};_0x39e13e(++_0x2502d6);}(_0x3f99,0xa3));var _0x93f9=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x3f99[_0x4605dc];return _0x5d3e81;};'use strict';var _=require(_0x93f9('0x0'));var util=require(_0x93f9('0x1'));var moment=require(_0x93f9('0x2'));var BPromise=require(_0x93f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93f9('0x4'));var db=require(_0x93f9('0x5'))['db'];var utils=require(_0x93f9('0x6'));var logger=require(_0x93f9('0x7'))('rpc');var config=require(_0x93f9('0x8'));var jayson=require(_0x93f9('0x9'));var client=jayson[_0x93f9('0xa')][_0x93f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2739e5,_0x24cf6a,_0x50517b){return new BPromise(function(_0x3355e1,_0xfbc98){return client[_0x93f9('0xc')](_0x2739e5,_0x50517b)[_0x93f9('0xd')](function(_0xbe8599){logger[_0x93f9('0xe')](_0x93f9('0xf'),_0x24cf6a,_0x93f9('0x10'));logger['debug'](_0x93f9('0x11'),_0x24cf6a,_0x93f9('0x10'),JSON[_0x93f9('0x12')](_0xbe8599));if(_0xbe8599[_0x93f9('0x13')]){if(_0xbe8599['error'][_0x93f9('0x14')]===0x1f4){logger[_0x93f9('0x13')](_0x93f9('0xf'),_0x24cf6a,_0xbe8599[_0x93f9('0x13')][_0x93f9('0x15')]);return _0xfbc98(_0xbe8599[_0x93f9('0x13')]['message']);}logger['error'](_0x93f9('0xf'),_0x24cf6a,_0xbe8599['error']['message']);return _0x3355e1(_0xbe8599[_0x93f9('0x13')][_0x93f9('0x15')]);}else{logger[_0x93f9('0xe')](_0x93f9('0xf'),_0x24cf6a,_0x93f9('0x10'));_0x3355e1(_0xbe8599[_0x93f9('0x16')][_0x93f9('0x15')]);}})[_0x93f9('0x17')](function(_0x4bbcb9){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x24cf6a,_0x4bbcb9);_0xfbc98(_0x4bbcb9);});});}exports[_0x93f9('0x18')]=function(_0x2a837b){var _0x2f83bf=this;return new Promise(function(_0x14a91d,_0x883132){return db['WhatsappQueueReport']['create'](_0x2a837b[_0x93f9('0x19')],{'raw':_0x2a837b[_0x93f9('0x1a')]?_0x2a837b[_0x93f9('0x1a')][_0x93f9('0x1b')]===undefined?!![]:![]:!![]})[_0x93f9('0xd')](function(_0x509834){logger[_0x93f9('0xe')]('CreateWhatsappQueueReport',_0x2a837b);logger['debug'](_0x93f9('0x18'),_0x2a837b,JSON[_0x93f9('0x12')](_0x509834));_0x14a91d(_0x509834);})['catch'](function(_0x224f95){logger[_0x93f9('0x13')](_0x93f9('0x18'),_0x224f95[_0x93f9('0x15')],_0x2a837b);_0x883132(_0x2f83bf[_0x93f9('0x13')](0x1f4,_0x224f95['message']));});});};exports[_0x93f9('0x1c')]=function(_0x328baf){var _0x40f0c3=this;return new Promise(function(_0x394efb,_0x4ef728){return db['WhatsappQueueReport'][_0x93f9('0x1d')](_0x328baf['body'],{'raw':_0x328baf[_0x93f9('0x1a')]?_0x328baf[_0x93f9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x328baf[_0x93f9('0x1a')]?_0x328baf[_0x93f9('0x1a')][_0x93f9('0x1e')]||null:null,'attributes':_0x328baf[_0x93f9('0x1a')]?_0x328baf['options'][_0x93f9('0x1f')]||null:null,'limit':_0x328baf[_0x93f9('0x1a')]?_0x328baf[_0x93f9('0x1a')]['limit']||null:null})[_0x93f9('0xd')](function(_0x5b153f){logger[_0x93f9('0xe')](_0x93f9('0x1c'),_0x328baf);logger[_0x93f9('0x20')]('UpdateWhatsappQueueReport',_0x328baf,JSON[_0x93f9('0x12')](_0x5b153f));_0x394efb(_0x5b153f);})[_0x93f9('0x17')](function(_0x3d14f7){logger[_0x93f9('0x13')](_0x93f9('0x1c'),_0x3d14f7[_0x93f9('0x15')],_0x328baf);_0x4ef728(_0x40f0c3[_0x93f9('0x13')](0x1f4,_0x3d14f7[_0x93f9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 130de46..524a49b 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 _0xa5ab=['../../components/auth/service','./whatsappTransferReport.controller','get','index','describe','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x131487,_0x563af6){var _0xe22b46=function(_0x110ea0){while(--_0x110ea0){_0x131487['push'](_0x131487['shift']());}};_0xe22b46(++_0x563af6);}(_0xa5ab,0xf2));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xba5a('0x0'));var util=require(_0xba5a('0x1'));var path=require('path');var timeout=require(_0xba5a('0x2'));var express=require(_0xba5a('0x3'));var router=express[_0xba5a('0x4')]();var auth=require(_0xba5a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xba5a('0x6'));router[_0xba5a('0x7')]('/',auth['isAuthenticated'](),controller[_0xba5a('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xba5a('0x9')]);router[_0xba5a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xba5a('0xa')]);router[_0xba5a('0xb')]('/',auth[_0xba5a('0xc')](),controller['create']);router[_0xba5a('0xd')](_0xba5a('0xe'),auth[_0xba5a('0xc')](),controller[_0xba5a('0xf')]);router[_0xba5a('0x10')]('/:id',auth[_0xba5a('0xc')](),controller[_0xba5a('0x11')]);module[_0xba5a('0x12')]=router; \ No newline at end of file +var _0xe1c0=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1c0,0x120));var _0x0e1c=function(_0x1029d4,_0x20aa9f){_0x1029d4=_0x1029d4-0x0;var _0x168198=_0xe1c0[_0x1029d4];return _0x168198;};'use strict';var multer=require(_0x0e1c('0x0'));var util=require(_0x0e1c('0x1'));var path=require(_0x0e1c('0x2'));var timeout=require(_0x0e1c('0x3'));var express=require(_0x0e1c('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e1c('0x5'));var controller=require(_0x0e1c('0x6'));router[_0x0e1c('0x7')]('/',auth[_0x0e1c('0x8')](),controller[_0x0e1c('0x9')]);router['get']('/describe',auth[_0x0e1c('0x8')](),controller[_0x0e1c('0xa')]);router[_0x0e1c('0x7')](_0x0e1c('0xb'),auth[_0x0e1c('0x8')](),controller[_0x0e1c('0xc')]);router[_0x0e1c('0xd')]('/',auth['isAuthenticated'](),controller[_0x0e1c('0xe')]);router[_0x0e1c('0xf')](_0x0e1c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e1c('0x10')](_0x0e1c('0xb'),auth[_0x0e1c('0x8')](),controller[_0x0e1c('0x11')]);module[_0x0e1c('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 3b99db6..5e90597 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x0b0e[_0x5fe69a];return _0x3f1aee;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x171c66,_0x2d0c23){var _0x5142f9=function(_0x7b354b){while(--_0x7b354b){_0x171c66['push'](_0x171c66['shift']());}};_0x5142f9(++_0x2d0c23);}(_0x2032,0xd9));var _0x2203=function(_0x10d6ee,_0xca51c){_0x10d6ee=_0x10d6ee-0x0;var _0x36f2d8=_0x2032[_0x10d6ee];return _0x36f2d8;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 82f9dcf..67ccc79 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 _0x85da=['nolimit','order','sort','filter','where','options','includeAll','include','rows','params','merge','find','catch','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','then','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x557fe7,_0xcf8dd4){var _0x57b9b7=function(_0x1d213b){while(--_0x1d213b){_0x557fe7['push'](_0x557fe7['shift']());}};_0x57b9b7(++_0xcf8dd4);}(_0x85da,0x1bc));var _0xa85d=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x85da[_0x1762b4];return _0x29beda;};'use strict';var pdf=require(_0xa85d('0x0'));var emlformat=require(_0xa85d('0x1'));var rimraf=require(_0xa85d('0x2'));var zipdir=require(_0xa85d('0x3'));var jsonpatch=require(_0xa85d('0x4'));var rp=require(_0xa85d('0x5'));var moment=require(_0xa85d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa85d('0x7'));var util=require('util');var path=require(_0xa85d('0x8'));var sox=require(_0xa85d('0x9'));var csv=require(_0xa85d('0xa'));var ejs=require(_0xa85d('0xb'));var fs=require('fs');var _=require(_0xa85d('0xc'));var squel=require(_0xa85d('0xd'));var crypto=require(_0xa85d('0xe'));var jsforce=require(_0xa85d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa85d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa85d('0x10'));var authService=require(_0xa85d('0x11'));var qs=require(_0xa85d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa85d('0x13'));var logger=require('../../config/logger')(_0xa85d('0x14'));var utils=require(_0xa85d('0x15'));var config=require(_0xa85d('0x16'));var licenseUtil=require(_0xa85d('0x17'));var db=require(_0xa85d('0x18'))['db'];function respondWithStatusCode(_0x1a2a02,_0x5dae8d){_0x5dae8d=_0x5dae8d||0xcc;return function(_0x27b552){if(_0x27b552){return _0x1a2a02[_0xa85d('0x19')](_0x5dae8d);}return _0x1a2a02[_0xa85d('0x1a')](_0x5dae8d)[_0xa85d('0x1b')]();};}function respondWithResult(_0x46b359,_0x5b3bd5){_0x5b3bd5=_0x5b3bd5||0xc8;return function(_0x5ec700){if(_0x5ec700){return _0x46b359[_0xa85d('0x1a')](_0x5b3bd5)['json'](_0x5ec700);}};}function respondWithFilteredResult(_0x34bfb8,_0x5f20ad){return function(_0x2e8154){if(_0x2e8154){var _0x576a91=_0x2e8154[_0xa85d('0x1c')],_0x434c40=_0x5f20ad[_0xa85d('0x1d')],_0x5109f8=_0x5f20ad[_0xa85d('0x1d')]+_0x5f20ad[_0xa85d('0x1e')],_0x26202b;if(_0x5109f8>=_0x576a91){_0x5109f8=_0x576a91;_0x26202b=0xc8;}else{_0x26202b=0xce;}_0x34bfb8['status'](_0x26202b);return _0x34bfb8[_0xa85d('0x1f')](_0xa85d('0x20'),_0x434c40+'-'+_0x5109f8+'/'+_0x576a91)['json'](_0x2e8154);}return null;};}function patchUpdates(_0x68562d){return function(_0x465b4a){try{jsonpatch['apply'](_0x465b4a,_0x68562d,!![]);}catch(_0x2c38f1){return BPromise[_0xa85d('0x21')](_0x2c38f1);}return _0x465b4a['save']();};}function saveUpdates(_0x3a2563,_0x2b2f73){return function(_0x491daf){if(_0x491daf){return _0x491daf['update'](_0x3a2563)['then'](function(_0x4e3e79){return _0x4e3e79;});}return null;};}function removeEntity(_0x2aa3ad,_0x1589e7){return function(_0x3761b5){if(_0x3761b5){return _0x3761b5['destroy']()[_0xa85d('0x22')](function(){_0x2aa3ad[_0xa85d('0x1a')](0xcc)[_0xa85d('0x1b')]();});}};}function handleEntityNotFound(_0x433ad5,_0x3233ec){return function(_0x3c4ff4){if(!_0x3c4ff4){_0x433ad5[_0xa85d('0x19')](0x194);}return _0x3c4ff4;};}function handleError(_0x3c2bff,_0x3bd898){_0x3bd898=_0x3bd898||0x1f4;return function(_0x1e5022){logger['error'](_0x1e5022[_0xa85d('0x23')]);if(_0x1e5022[_0xa85d('0x24')]){delete _0x1e5022['name'];}_0x3c2bff['status'](_0x3bd898)[_0xa85d('0x25')](_0x1e5022);};}exports[_0xa85d('0x26')]=function(_0x55c692,_0x257354){var _0x48affe={},_0x5e86e7={},_0x4a4566={'count':0x0,'rows':[]};var _0x488f2a=_[_0xa85d('0x27')](db[_0xa85d('0x28')][_0xa85d('0x29')],function(_0x26a2b5){return{'name':_0x26a2b5[_0xa85d('0x2a')],'type':_0x26a2b5['type'][_0xa85d('0x2b')]};});_0x5e86e7[_0xa85d('0x2c')]=_[_0xa85d('0x27')](_0x488f2a,_0xa85d('0x24'));_0x5e86e7[_0xa85d('0x2d')]=_[_0xa85d('0x2e')](_0x55c692['query']);_0x5e86e7[_0xa85d('0x2f')]=_[_0xa85d('0x30')](_0x5e86e7['model'],_0x5e86e7[_0xa85d('0x2d')]);_0x48affe['attributes']=_['intersection'](_0x5e86e7[_0xa85d('0x2c')],qs[_0xa85d('0x31')](_0x55c692['query']['fields']));_0x48affe[_0xa85d('0x32')]=_0x48affe['attributes'][_0xa85d('0x33')]?_0x48affe[_0xa85d('0x32')]:_0x5e86e7[_0xa85d('0x2c')];if(!_0x55c692[_0xa85d('0x2d')][_0xa85d('0x34')](_0xa85d('0x35'))){_0x48affe[_0xa85d('0x1e')]=qs[_0xa85d('0x1e')](_0x55c692['query'][_0xa85d('0x1e')]);_0x48affe[_0xa85d('0x1d')]=qs[_0xa85d('0x1d')](_0x55c692[_0xa85d('0x2d')][_0xa85d('0x1d')]);}_0x48affe[_0xa85d('0x36')]=qs['sort'](_0x55c692[_0xa85d('0x2d')][_0xa85d('0x37')]);_0x48affe['where']=qs[_0xa85d('0x2f')](_['pick'](_0x55c692[_0xa85d('0x2d')],_0x5e86e7[_0xa85d('0x2f')]),_0x488f2a);if(_0x55c692[_0xa85d('0x2d')][_0xa85d('0x38')]){_0x48affe[_0xa85d('0x39')]=_['merge'](_0x48affe[_0xa85d('0x39')],{'$or':_[_0xa85d('0x27')](_0x488f2a,function(_0x2d1ff1){if(_0x2d1ff1['type']!=='VIRTUAL'){var _0x552961={};_0x552961[_0x2d1ff1[_0xa85d('0x24')]]={'$like':'%'+_0x55c692[_0xa85d('0x2d')][_0xa85d('0x38')]+'%'};return _0x552961;}})});}_0x48affe=_['merge']({},_0x48affe,_0x55c692[_0xa85d('0x3a')]);var _0x4d745e={'where':_0x48affe[_0xa85d('0x39')]};return db[_0xa85d('0x28')][_0xa85d('0x1c')](_0x4d745e)['then'](function(_0x1ece15){_0x4a4566[_0xa85d('0x1c')]=_0x1ece15;if(_0x55c692[_0xa85d('0x2d')][_0xa85d('0x3b')]){_0x48affe[_0xa85d('0x3c')]=[{'all':!![]}];}return db[_0xa85d('0x28')]['findAll'](_0x48affe);})[_0xa85d('0x22')](function(_0x4f5cbf){_0x4a4566[_0xa85d('0x3d')]=_0x4f5cbf;return _0x4a4566;})[_0xa85d('0x22')](respondWithFilteredResult(_0x257354,_0x48affe))['catch'](handleError(_0x257354,null));};exports['show']=function(_0x533526,_0x26dfc4){var _0x112f2b={'raw':!![],'where':{'id':_0x533526[_0xa85d('0x3e')]['id']}},_0x4afa56={};_0x4afa56[_0xa85d('0x2c')]=_[_0xa85d('0x2e')](db[_0xa85d('0x28')][_0xa85d('0x29')]);_0x4afa56[_0xa85d('0x2d')]=_[_0xa85d('0x2e')](_0x533526[_0xa85d('0x2d')]);_0x4afa56['filters']=_['intersection'](_0x4afa56[_0xa85d('0x2c')],_0x4afa56[_0xa85d('0x2d')]);_0x112f2b[_0xa85d('0x32')]=_['intersection'](_0x4afa56['model'],qs[_0xa85d('0x31')](_0x533526[_0xa85d('0x2d')][_0xa85d('0x31')]));_0x112f2b[_0xa85d('0x32')]=_0x112f2b[_0xa85d('0x32')]['length']?_0x112f2b[_0xa85d('0x32')]:_0x4afa56[_0xa85d('0x2c')];if(_0x533526[_0xa85d('0x2d')]['includeAll']){_0x112f2b[_0xa85d('0x3c')]=[{'all':!![]}];}_0x112f2b=_[_0xa85d('0x3f')]({},_0x112f2b,_0x533526[_0xa85d('0x3a')]);return db[_0xa85d('0x28')][_0xa85d('0x40')](_0x112f2b)[_0xa85d('0x22')](handleEntityNotFound(_0x26dfc4,null))[_0xa85d('0x22')](respondWithResult(_0x26dfc4,null))[_0xa85d('0x41')](handleError(_0x26dfc4,null));};exports[_0xa85d('0x42')]=function(_0x4fccf5,_0x19df6d){return db[_0xa85d('0x28')][_0xa85d('0x42')](_0x4fccf5[_0xa85d('0x43')],{})[_0xa85d('0x22')](respondWithResult(_0x19df6d,0xc9))[_0xa85d('0x41')](handleError(_0x19df6d,null));};exports[_0xa85d('0x44')]=function(_0x1eab7a,_0x3e2eae){if(_0x1eab7a['body']['id']){delete _0x1eab7a['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x1eab7a[_0xa85d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e2eae,null))[_0xa85d('0x22')](saveUpdates(_0x1eab7a[_0xa85d('0x43')],null))[_0xa85d('0x22')](respondWithResult(_0x3e2eae,null))[_0xa85d('0x41')](handleError(_0x3e2eae,null));};exports[_0xa85d('0x45')]=function(_0x15b2fa,_0x16a117){return db[_0xa85d('0x28')][_0xa85d('0x40')]({'where':{'id':_0x15b2fa[_0xa85d('0x3e')]['id']}})[_0xa85d('0x22')](handleEntityNotFound(_0x16a117,null))[_0xa85d('0x22')](removeEntity(_0x16a117,null))[_0xa85d('0x41')](handleError(_0x16a117,null));};exports['describe']=function(_0x5d5e01,_0x3d99cb){return db[_0xa85d('0x28')][_0xa85d('0x46')]()[_0xa85d('0x22')](respondWithResult(_0x3d99cb,null))[_0xa85d('0x41')](handleError(_0x3d99cb,null));}; \ No newline at end of file +var _0xa8d3=['rows','show','params','include','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x1efa5c,_0x4deafb){var _0x4f8376=function(_0x132a82){while(--_0x132a82){_0x1efa5c['push'](_0x1efa5c['shift']());}};_0x4f8376(++_0x4deafb);}(_0xa8d3,0x121));var _0x3a8d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa8d3[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x3a8d('0x0'));var emlformat=require(_0x3a8d('0x1'));var rimraf=require(_0x3a8d('0x2'));var zipdir=require(_0x3a8d('0x3'));var jsonpatch=require(_0x3a8d('0x4'));var rp=require(_0x3a8d('0x5'));var moment=require(_0x3a8d('0x6'));var BPromise=require(_0x3a8d('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3a8d('0x8'));var sox=require('sox');var csv=require(_0x3a8d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3a8d('0xa'));var squel=require(_0x3a8d('0xb'));var crypto=require(_0x3a8d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3a8d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3a8d('0xe'));var Redis=require('ioredis');var authService=require(_0x3a8d('0xf'));var qs=require(_0x3a8d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3a8d('0x11'));var licenseUtil=require(_0x3a8d('0x12'));var db=require(_0x3a8d('0x13'))['db'];function respondWithStatusCode(_0x7f8e2f,_0x475911){_0x475911=_0x475911||0xcc;return function(_0x23b057){if(_0x23b057){return _0x7f8e2f[_0x3a8d('0x14')](_0x475911);}return _0x7f8e2f[_0x3a8d('0x15')](_0x475911)['end']();};}function respondWithResult(_0x3a73a7,_0x3daa33){_0x3daa33=_0x3daa33||0xc8;return function(_0x2ed069){if(_0x2ed069){return _0x3a73a7[_0x3a8d('0x15')](_0x3daa33)[_0x3a8d('0x16')](_0x2ed069);}};}function respondWithFilteredResult(_0x2473b4,_0x25ebec){return function(_0x8caf7){if(_0x8caf7){var _0x5c376d=_0x8caf7[_0x3a8d('0x17')],_0xaab36a=_0x25ebec['offset'],_0x15639a=_0x25ebec[_0x3a8d('0x18')]+_0x25ebec[_0x3a8d('0x19')],_0x5b8115;if(_0x15639a>=_0x5c376d){_0x15639a=_0x5c376d;_0x5b8115=0xc8;}else{_0x5b8115=0xce;}_0x2473b4[_0x3a8d('0x15')](_0x5b8115);return _0x2473b4[_0x3a8d('0x1a')](_0x3a8d('0x1b'),_0xaab36a+'-'+_0x15639a+'/'+_0x5c376d)['json'](_0x8caf7);}return null;};}function patchUpdates(_0x5bfac5){return function(_0x490a1f){try{jsonpatch[_0x3a8d('0x1c')](_0x490a1f,_0x5bfac5,!![]);}catch(_0x3870dd){return BPromise[_0x3a8d('0x1d')](_0x3870dd);}return _0x490a1f['save']();};}function saveUpdates(_0x359620,_0x31653a){return function(_0xc910cf){if(_0xc910cf){return _0xc910cf[_0x3a8d('0x1e')](_0x359620)['then'](function(_0x3384de){return _0x3384de;});}return null;};}function removeEntity(_0xa196a0,_0x32aaed){return function(_0x9c978e){if(_0x9c978e){return _0x9c978e['destroy']()[_0x3a8d('0x1f')](function(){_0xa196a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa45a,_0x5f19e9){return function(_0x311e96){if(!_0x311e96){_0x3aa45a['sendStatus'](0x194);}return _0x311e96;};}function handleError(_0x2344c0,_0x5ef07b){_0x5ef07b=_0x5ef07b||0x1f4;return function(_0x15179d){logger[_0x3a8d('0x20')](_0x15179d['stack']);if(_0x15179d[_0x3a8d('0x21')]){delete _0x15179d[_0x3a8d('0x21')];}_0x2344c0[_0x3a8d('0x15')](_0x5ef07b)[_0x3a8d('0x22')](_0x15179d);};}exports[_0x3a8d('0x23')]=function(_0x59d864,_0x43e414){var _0x5b6256={},_0x2b56b4={},_0x35dbf8={'count':0x0,'rows':[]};var _0xe2ca02=_[_0x3a8d('0x24')](db[_0x3a8d('0x25')][_0x3a8d('0x26')],function(_0x62b638){return{'name':_0x62b638[_0x3a8d('0x27')],'type':_0x62b638[_0x3a8d('0x28')][_0x3a8d('0x29')]};});_0x2b56b4['model']=_[_0x3a8d('0x24')](_0xe2ca02,_0x3a8d('0x21'));_0x2b56b4[_0x3a8d('0x2a')]=_[_0x3a8d('0x2b')](_0x59d864[_0x3a8d('0x2a')]);_0x2b56b4[_0x3a8d('0x2c')]=_[_0x3a8d('0x2d')](_0x2b56b4[_0x3a8d('0x2e')],_0x2b56b4['query']);_0x5b6256[_0x3a8d('0x2f')]=_[_0x3a8d('0x2d')](_0x2b56b4['model'],qs[_0x3a8d('0x30')](_0x59d864[_0x3a8d('0x2a')]['fields']));_0x5b6256[_0x3a8d('0x2f')]=_0x5b6256['attributes'][_0x3a8d('0x31')]?_0x5b6256[_0x3a8d('0x2f')]:_0x2b56b4[_0x3a8d('0x2e')];if(!_0x59d864['query'][_0x3a8d('0x32')](_0x3a8d('0x33'))){_0x5b6256[_0x3a8d('0x19')]=qs[_0x3a8d('0x19')](_0x59d864['query'][_0x3a8d('0x19')]);_0x5b6256[_0x3a8d('0x18')]=qs[_0x3a8d('0x18')](_0x59d864[_0x3a8d('0x2a')]['offset']);}_0x5b6256[_0x3a8d('0x34')]=qs[_0x3a8d('0x35')](_0x59d864[_0x3a8d('0x2a')][_0x3a8d('0x35')]);_0x5b6256[_0x3a8d('0x36')]=qs[_0x3a8d('0x2c')](_[_0x3a8d('0x37')](_0x59d864[_0x3a8d('0x2a')],_0x2b56b4['filters']),_0xe2ca02);if(_0x59d864[_0x3a8d('0x2a')]['filter']){_0x5b6256[_0x3a8d('0x36')]=_['merge'](_0x5b6256['where'],{'$or':_[_0x3a8d('0x24')](_0xe2ca02,function(_0x3b32af){if(_0x3b32af[_0x3a8d('0x28')]!==_0x3a8d('0x38')){var _0x519493={};_0x519493[_0x3b32af[_0x3a8d('0x21')]]={'$like':'%'+_0x59d864[_0x3a8d('0x2a')]['filter']+'%'};return _0x519493;}})});}_0x5b6256=_[_0x3a8d('0x39')]({},_0x5b6256,_0x59d864[_0x3a8d('0x3a')]);var _0x55cd6b={'where':_0x5b6256[_0x3a8d('0x36')]};return db[_0x3a8d('0x25')][_0x3a8d('0x17')](_0x55cd6b)[_0x3a8d('0x1f')](function(_0x24c0e0){_0x35dbf8['count']=_0x24c0e0;if(_0x59d864['query'][_0x3a8d('0x3b')]){_0x5b6256['include']=[{'all':!![]}];}return db[_0x3a8d('0x25')][_0x3a8d('0x3c')](_0x5b6256);})[_0x3a8d('0x1f')](function(_0x2a8055){_0x35dbf8[_0x3a8d('0x3d')]=_0x2a8055;return _0x35dbf8;})[_0x3a8d('0x1f')](respondWithFilteredResult(_0x43e414,_0x5b6256))['catch'](handleError(_0x43e414,null));};exports[_0x3a8d('0x3e')]=function(_0x206de5,_0x4ef74c){var _0x41dbba={'raw':!![],'where':{'id':_0x206de5[_0x3a8d('0x3f')]['id']}},_0x105546={};_0x105546[_0x3a8d('0x2e')]=_[_0x3a8d('0x2b')](db[_0x3a8d('0x25')][_0x3a8d('0x26')]);_0x105546['query']=_[_0x3a8d('0x2b')](_0x206de5['query']);_0x105546['filters']=_[_0x3a8d('0x2d')](_0x105546[_0x3a8d('0x2e')],_0x105546['query']);_0x41dbba[_0x3a8d('0x2f')]=_[_0x3a8d('0x2d')](_0x105546[_0x3a8d('0x2e')],qs[_0x3a8d('0x30')](_0x206de5[_0x3a8d('0x2a')]['fields']));_0x41dbba['attributes']=_0x41dbba['attributes'][_0x3a8d('0x31')]?_0x41dbba[_0x3a8d('0x2f')]:_0x105546['model'];if(_0x206de5[_0x3a8d('0x2a')]['includeAll']){_0x41dbba[_0x3a8d('0x40')]=[{'all':!![]}];}_0x41dbba=_['merge']({},_0x41dbba,_0x206de5[_0x3a8d('0x3a')]);return db['WhatsappTransferReport'][_0x3a8d('0x41')](_0x41dbba)[_0x3a8d('0x1f')](handleEntityNotFound(_0x4ef74c,null))[_0x3a8d('0x1f')](respondWithResult(_0x4ef74c,null))[_0x3a8d('0x42')](handleError(_0x4ef74c,null));};exports[_0x3a8d('0x43')]=function(_0x2fed08,_0x1911a7){return db[_0x3a8d('0x25')][_0x3a8d('0x43')](_0x2fed08[_0x3a8d('0x44')],{})['then'](respondWithResult(_0x1911a7,0xc9))[_0x3a8d('0x42')](handleError(_0x1911a7,null));};exports[_0x3a8d('0x1e')]=function(_0x4913be,_0x3d8505){if(_0x4913be[_0x3a8d('0x44')]['id']){delete _0x4913be[_0x3a8d('0x44')]['id'];}return db[_0x3a8d('0x25')][_0x3a8d('0x41')]({'where':{'id':_0x4913be['params']['id']}})[_0x3a8d('0x1f')](handleEntityNotFound(_0x3d8505,null))[_0x3a8d('0x1f')](saveUpdates(_0x4913be[_0x3a8d('0x44')],null))[_0x3a8d('0x1f')](respondWithResult(_0x3d8505,null))['catch'](handleError(_0x3d8505,null));};exports['destroy']=function(_0xb52dd5,_0x4fcd17){return db['WhatsappTransferReport'][_0x3a8d('0x41')]({'where':{'id':_0xb52dd5[_0x3a8d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4fcd17,null))['then'](removeEntity(_0x4fcd17,null))[_0x3a8d('0x42')](handleError(_0x4fcd17,null));};exports[_0x3a8d('0x45')]=function(_0x3c8bdc,_0x551a73){return db[_0x3a8d('0x25')]['describe']()[_0x3a8d('0x1f')](respondWithResult(_0x551a73,null))['catch'](handleError(_0x551a73,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ac7df20..2956737 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 _0xeb65=['report_whatsapp_transfer','uniqueid','lodash','api','moment','path','../../config/environment','exports'];(function(_0x30e1a1,_0x4c585f){var _0x2555b8=function(_0x3f9fe5){while(--_0x3f9fe5){_0x30e1a1['push'](_0x30e1a1['shift']());}};_0x2555b8(++_0x4c585f);}(_0xeb65,0x1aa));var _0x5eb6=function(_0x44e17d,_0xfadab4){_0x44e17d=_0x44e17d-0x0;var _0x28a5bb=_0xeb65[_0x44e17d];return _0x28a5bb;};'use strict';var _=require(_0x5eb6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5eb6('0x1'));var moment=require(_0x5eb6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eb6('0x3'));var rimraf=require('rimraf');var config=require(_0x5eb6('0x4'));var attributes=require('./whatsappTransferReport.attributes');module[_0x5eb6('0x5')]=function(_0x5a5b68,_0x1e02d9){return _0x5a5b68['define']('WhatsappTransferReport',attributes,{'tableName':_0x5eb6('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5eb6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7130=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','moment','bluebird','request-promise','path'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x7130,0x74));var _0x0713=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7130[_0x4c445a];return _0x2f611c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0713('0x0'));var BPromise=require(_0x0713('0x1'));var rp=require(_0x0713('0x2'));var fs=require('fs');var path=require(_0x0713('0x3'));var rimraf=require(_0x0713('0x4'));var config=require(_0x0713('0x5'));var attributes=require(_0x0713('0x6'));module['exports']=function(_0x25def6,_0x5cf187){return _0x25def6[_0x0713('0x7')](_0x0713('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0713('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 53de22e..c24dfe5 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(_0x2e42b5,_0x3f947d){var _0x5029dd=function(_0x3978b2){while(--_0x3978b2){_0x2e42b5['push'](_0x2e42b5['shift']());}};_0x5029dd(++_0x3f947d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x2b8fb8,_0x473b5d){var _0x2eef36=function(_0xe27821){while(--_0xe27821){_0x2b8fb8['push'](_0x2b8fb8['shift']());}};_0x2eef36(++_0x473b5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 b48a576..8d798c8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42f4=['map','status','None','seedDB','./config/seedDB','./config/license','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:'];(function(_0x55c49d,_0x454bdb){var _0x15fa49=function(_0x43adb5){while(--_0x43adb5){_0x55c49d['push'](_0x55c49d['shift']());}};_0x15fa49(++_0x454bdb);}(_0x42f4,0x19d));var _0x442f=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x42f4[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x442f('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x442f('0x1'));var config=require(_0x442f('0x2'));var logger=require(_0x442f('0x3'))(_0x442f('0x4'));var pm2=require(_0x442f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0x442f('0x6'));var transcribe=require(_0x442f('0x7'));function main(){return mysqldb['db']['sequelize'][_0x442f('0x8')]()[_0x442f('0x9')](function(){return rpc[_0x442f('0xa')]();})[_0x442f('0x9')](function(_0x6c0b4b){logger[_0x442f('0xb')](_0x6c0b4b);return chat['start']();})[_0x442f('0x9')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x442f('0x9')](function(){return transcribe[_0x442f('0xc')]();})[_0x442f('0x9')](function(_0x86f590){logger[_0x442f('0xb')](_0x86f590);return pm2[_0x442f('0xc')](pm2Config);})[_0x442f('0x9')](function(_0x4780cb){logger[_0x442f('0xb')](_0x442f('0xd'),_['map'](_[_0x442f('0xe')](_0x4780cb,{'status':_0x442f('0xf')}),_0x442f('0x10'))[_0x442f('0x11')]());logger[_0x442f('0xb')](_0x442f('0x12'),_[_0x442f('0x13')](_[_0x442f('0xe')](_0x4780cb,function(_0x21d907){return _0x21d907[_0x442f('0x14')]!==_0x442f('0xf');}),_0x442f('0x10'))[_0x442f('0x11')]()||_0x442f('0x15'));config[_0x442f('0x16')]&&require(_0x442f('0x17'))['default']();require(_0x442f('0x18'))['default']();})['catch'](function(_0x5668e0){logger['error'](_0x442f('0x19'),_0x5668e0);process[_0x442f('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xbc36=['map','online','join','status','name','None','seedDB','./config/seedDB','./config/license','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','listen','then','start','info'];(function(_0x368741,_0x50dd8b){var _0x463dc5=function(_0x5d4761){while(--_0x5d4761){_0x368741['push'](_0x368741['shift']());}};_0x463dc5(++_0x50dd8b);}(_0xbc36,0x169));var _0x6bc3=function(_0x552097,_0x225983){_0x552097=_0x552097-0x0;var _0x2a98a0=_0xbc36[_0x552097];return _0x2a98a0;};'use strict';var _=require(_0x6bc3('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x6bc3('0x1'));var config=require(_0x6bc3('0x2'));var logger=require(_0x6bc3('0x3'))(_0x6bc3('0x4'));var pm2=require(_0x6bc3('0x5'));var pm2Config=require(_0x6bc3('0x6'));var schedule=require(_0x6bc3('0x7'));var chat=require(_0x6bc3('0x8'));var whatsapp=require(_0x6bc3('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x6bc3('0xa')][_0x6bc3('0xb')]()['then'](function(){return rpc[_0x6bc3('0xc')]();})[_0x6bc3('0xd')](function(_0xf07594){logger['info'](_0xf07594);return chat[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(){return whatsapp[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(){return schedule['start']();})[_0x6bc3('0xd')](function(){return transcribe[_0x6bc3('0xe')]();})[_0x6bc3('0xd')](function(_0x3269c2){logger[_0x6bc3('0xf')](_0x3269c2);return pm2[_0x6bc3('0xe')](pm2Config);})[_0x6bc3('0xd')](function(_0x58f5ab){logger[_0x6bc3('0xf')]('Online\x20apps:',_[_0x6bc3('0x10')](_['filter'](_0x58f5ab,{'status':_0x6bc3('0x11')}),'name')[_0x6bc3('0x12')]());logger[_0x6bc3('0xf')]('Offline\x20apps:',_[_0x6bc3('0x10')](_['filter'](_0x58f5ab,function(_0x5872e1){return _0x5872e1[_0x6bc3('0x13')]!==_0x6bc3('0x11');}),_0x6bc3('0x14'))[_0x6bc3('0x12')]()||_0x6bc3('0x15'));config[_0x6bc3('0x16')]&&require(_0x6bc3('0x17'))['default']();require(_0x6bc3('0x18'))[_0x6bc3('0x19')]();})['catch'](function(_0x426a16){logger[_0x6bc3('0x1a')](_0x6bc3('0x1b'),_0x426a16);process[_0x6bc3('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a324e19..51a08fd 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 _0x55d7=['permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isAuthenticated','use','findOne','params','then','closed','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','find','name','json','Wrong\x20credentials.','user','startsWith','Bearer','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','secret','verify','randomBytes','toString','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','composable-middleware','basic-auth','util','moment','secrets','session','role','fullname','email','userpic'];(function(_0x24e87f,_0x255dc9){var _0x5e6dba=function(_0x1039ef){while(--_0x1039ef){_0x24e87f['push'](_0x24e87f['shift']());}};_0x5e6dba(++_0x255dc9);}(_0x55d7,0x1b9));var _0x755d=function(_0x21f3ca,_0x493fa1){_0x21f3ca=_0x21f3ca-0x0;var _0x51e18e=_0x55d7[_0x21f3ca];return _0x51e18e;};'use strict';var db=require(_0x755d('0x0'))['db'];var config=require(_0x755d('0x1'));var hardwareConf=require(_0x755d('0x2'));var licenseUtil=require(_0x755d('0x3'));var encryptor=require(_0x755d('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0x755d('0x5'));var basicAuth=require(_0x755d('0x6'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x755d('0x7'));var moment=require(_0x755d('0x8'));var validateJwt=expressJwt({'secret':config[_0x755d('0x9')][_0x755d('0xa')]});var userAttributes=['id',_0x755d('0xb'),_0x755d('0xc'),'name','internal',_0x755d('0xd'),_0x755d('0xe'),_0x755d('0xf'),_0x755d('0x10'),_0x755d('0x11'),'chatPause','mailPause',_0x755d('0x12'),_0x755d('0x13'),_0x755d('0x14'),'pauseType','showWebBar',_0x755d('0x15'),'lastPauseAt',_0x755d('0x16'),_0x755d('0x17'),_0x755d('0x18'),_0x755d('0x19'),_0x755d('0x1a'),_0x755d('0x1b'),'phoneBarDnd','phoneBarEnableRecording',_0x755d('0x1c'),_0x755d('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0x755d('0x1e'),_0x755d('0x1f'),_0x755d('0x20'),_0x755d('0x21'),_0x755d('0x22'),_0x755d('0x23')];exports['isChatInteractionAuthorized']=function(){return this[_0x755d('0x24')](!![])[_0x755d('0x25')](function(_0x3ae0e8,_0x4cf40c,_0x4bd9a0){if(_0x3ae0e8['user']){_0x4bd9a0();}else{return db['ChatInteraction'][_0x755d('0x26')]({'where':{'id':_0x3ae0e8[_0x755d('0x27')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x755d('0x28')](function(_0x2233e9){if(_0x2233e9&&_0x2233e9[_0x755d('0x29')]){return _0x4cf40c[_0x755d('0x2a')](_0x2233e9[_0x755d('0x2b')]===_0x755d('0x2c')?0x195:0x193)['json']({'message':_0x2233e9['disposition']==='unmanaged'?_0x755d('0x2d'):_0x755d('0x2e')});}else{_0x4bd9a0();}})[_0x755d('0x2f')](function(_0x354e44){_0x4bd9a0(_0x354e44);});}});};exports[_0x755d('0x24')]=function isAuthenticated(_0x43109d){return compose()[_0x755d('0x25')](function(_0x3c39cf,_0x12995c,_0x2b3d4a){var _0x26e746;if(_0x3c39cf[_0x755d('0x30')]['authorization']){if(_['startsWith'](_0x3c39cf[_0x755d('0x30')][_0x755d('0x31')],'Basic')){var _0x4edf56=basicAuth(_0x3c39cf);db[_0x755d('0x32')][_0x755d('0x33')]({'where':{'name':_0x4edf56[_0x755d('0x34')]}})[_0x755d('0x28')](function(_0x1a5f84){if(!_0x1a5f84||!_0x1a5f84['authenticate'](_0x4edf56['pass'])){return _0x12995c['status'](0x191)[_0x755d('0x35')]({'message':_0x755d('0x36')});}_0x3c39cf[_0x755d('0x37')]={'id':_0x1a5f84['id']};_0x2b3d4a();})[_0x755d('0x2f')](function(_0x3b160d){_0x2b3d4a(_0x3b160d);});}else if(_[_0x755d('0x38')](_0x3c39cf[_0x755d('0x30')][_0x755d('0x31')],_0x755d('0x39'))){validateJwt(_0x3c39cf,_0x12995c,_0x2b3d4a);}else{if(_0x43109d){_0x2b3d4a();}else{return _0x12995c[_0x755d('0x2a')](0x193)[_0x755d('0x35')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3c39cf['query'][_0x755d('0x3a')]){try{var _0x4a7161={'audience':hardwareConf[_0x755d('0x3b')](),'issuer':hardwareConf[_0x755d('0x3b')]()};verifyJwt(_0x3c39cf[_0x755d('0x3c')]['apikey'],_0x4a7161)['then'](function(_0x19c092){return db[_0x755d('0x32')][_0x755d('0x33')]({'where':{'id':_0x19c092[_0x755d('0x3d')]}})[_0x755d('0x28')](function(_0x2d078d){_0x26e746=_0x2d078d;return db[_0x755d('0x3e')][_0x755d('0x26')]({'where':{'id':0x1},'attributes':[_0x755d('0x3f'),_0x755d('0x40')],'raw':!![]});})['then'](function(_0x499ab2){if(!_0x26e746||!_['isEqual'](_0x26e746[_0x755d('0x41')],_0x19c092[_0x755d('0x42')])){return _0x12995c[_0x755d('0x2a')](0x191)[_0x755d('0x35')]({'message':_0x755d('0x43')});}if(_0x26e746[_0x755d('0x44')]){return _0x12995c['status'](0x191)[_0x755d('0x35')]({'message':_0x755d('0x45')});}if(_0x26e746[_0x755d('0x46')]){if(_0x499ab2[_0x755d('0x40')]>0x0){if(moment(_0x26e746[_0x755d('0x47')])['add'](_0x499ab2['blockDuration'],_0x755d('0x48'))>moment()){return _0x12995c[_0x755d('0x2a')](0x191)['json']({'message':_0x755d('0x45')});}}else{return _0x12995c['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x3c39cf[_0x755d('0x37')]={'id':_0x26e746['id']};_0x2b3d4a();});})['catch'](function(){return _0x12995c[_0x755d('0x2a')](0x191)[_0x755d('0x35')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x202443){_0x2b3d4a(_0x202443);}}else if(_0x43109d){_0x2b3d4a();}else{return _0x12995c['status'](0x193)['json']({'message':_0x755d('0x49')});}})[_0x755d('0x25')](function(_0x5604af,_0x1ef322,_0x2879d4){if(_0x5604af[_0x755d('0x37')]){db[_0x755d('0x32')][_0x755d('0x33')]({'where':{'id':_0x5604af[_0x755d('0x37')]['id']},'attributes':userAttributes})[_0x755d('0x28')](function(_0x2972b8){if(!_0x2972b8){return _0x1ef322[_0x755d('0x2a')](0x194)[_0x755d('0x35')]({'message':'User\x20not\x20found.'});}_0x5604af[_0x755d('0x37')]=_0x2972b8;_0x2879d4();})[_0x755d('0x2f')](function(_0x4bf1fa){_0x2879d4(_0x4bf1fa);});}else if(_0x43109d){_0x2879d4();}else{return _0x1ef322[_0x755d('0x2a')](0x194)['json']({'message':_0x755d('0x4a')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x755d('0x25')](function(_0x718b48,_0x1751c1,_0x1e2ebd){return licenseUtil[_0x755d('0x4b')]()[_0x755d('0x28')](function(_0x31438f){if(_0x31438f[_0x755d('0x4c')]){_0x1e2ebd();}else{return _0x1751c1[_0x755d('0x2a')](0x193)[_0x755d('0x35')]({'message':_0x755d('0x4d')});}})[_0x755d('0x2f')](function(_0x568934){_0x1e2ebd(_0x568934);});});};exports[_0x755d('0x4e')]=function(_0x1cb478,_0x1151f9,_0x343fd1){_0x1cb478['isMiddleware']=!![];return _0x343fd1();};exports['signToken']=function signToken(_0x28eaec){return signJwt(_0x28eaec);};exports[_0x755d('0x4f')]=function(_0xb41a23,_0x1f21a3){if(!_0xb41a23['user']){return _0x1f21a3['status'](0x194)[_0x755d('0x35')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0xc1a3fa={'payload':{'id':_0xb41a23[_0x755d('0x37')]['id'],'role':_0xb41a23[_0x755d('0x37')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xc1a3fa)[_0x755d('0x28')](function(_0x1ec5ec){_0x1f21a3[_0x755d('0x50')](_0x755d('0x51'),_0x1ec5ec);_0x1f21a3[_0x755d('0x52')](_0x755d('0x53'));})['catch'](function(_0xdf96c4){return _0x1f21a3['status'](0x1f4)[_0x755d('0x54')](_0xdf96c4);});};exports[_0x755d('0x55')]=function(_0x449b81){if(_[_0x755d('0x56')](_0x449b81['apiKeyNonce'])||_[_0x755d('0x56')](_0x449b81[_0x755d('0x57')])){return null;}else{return createJwt(_0x449b81);}};exports[_0x755d('0x58')]=function(_0x5b1dd2){_0x5b1dd2['apiKeyNonce']=generateNonce();_0x5b1dd2[_0x755d('0x57')]=generateIssuedAt();return createJwt(_0x5b1dd2);};exports[_0x755d('0x59')]=function(_0x376e7a,_0x5c260c){var _0x33222e=_0x376e7a['query']['apikey'];if(_0x33222e){var _0x53e6e7={'nonce':_0x5c260c[_0x755d('0x41')],'iat':_0x5c260c[_0x755d('0x57')],'audience':hardwareConf[_0x755d('0x3b')](),'issuer':hardwareConf[_0x755d('0x3b')]()};return verifyJwt(_0x33222e,_0x53e6e7)[_0x755d('0x28')](function(){return generateApiKey(_0x5c260c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x755d('0x5a')]=function(_0x5bf5fe){var _0x1518b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1518b1[_0x755d('0x5b')](_0x5bf5fe))throw new db[(_0x755d('0x5c'))][(_0x755d('0x5d'))](_0x755d('0x5e'));return;};exports[_0x755d('0x5f')]=function(_0x32444c,_0x3381f5,_0x57a452){var _0x44fd40=encryptor[_0x755d('0x60')](_0x3381f5)[_0x755d('0x61')](',');for(var _0x4dc7e9=0x0;_0x4dc7e9<_0x57a452;_0x4dc7e9++){if(!_0x44fd40[_0x4dc7e9])break;if(_0x32444c[_0x755d('0x62')]()===_0x44fd40[_0x4dc7e9][_0x755d('0x62')]()){var _0x4842f3=util[_0x755d('0x63')](_0x755d('0x64'),_0x57a452);if(_0x57a452===0x1){_0x4842f3=_0x755d('0x65');}throw new db[(_0x755d('0x5c'))][(_0x755d('0x5d'))](_0x4842f3);}}return;};exports[_0x755d('0x66')]=function(_0x5a33cf,_0x29aa6d){var _0xed3bee=_0x29aa6d?encryptor[_0x755d('0x60')](_0x29aa6d)[_0x755d('0x61')](','):[];if(_0xed3bee['length']===0x5){_0xed3bee[_0x755d('0x67')](-0x1,0x1);}_0xed3bee[_0x755d('0x68')](_0x5a33cf);return encryptor[_0x755d('0x69')](_0xed3bee[_0x755d('0x6a')](','));};function signJwt(_0x419834){var _0x5d1704=BPromise[_0x755d('0x6b')](jwt[_0x755d('0x6c')],{'context':jwt});var _0x4e434e=_0x419834[_0x755d('0x6d')]||config['secrets'][_0x755d('0xa')];return new BPromise(function(_0x36a1e9,_0x2c19be){_0x5d1704(_0x419834['payload'],_0x4e434e,_0x419834['options'])['then'](function(_0x42d824){_0x36a1e9(_0x42d824);})[_0x755d('0x2f')](function(_0x558d20){_0x2c19be(_0x558d20);});});}function verifyJwt(_0x3b3555,_0x413476,_0x34f522){var _0x19f652=BPromise[_0x755d('0x6b')](jwt[_0x755d('0x6e')],{'context':jwt});var _0x23d363=_0x34f522||config[_0x755d('0x9')]['session'];return new BPromise(function(_0x31d5a6,_0x47ff78){_0x19f652(_0x3b3555,_0x23d363,_0x413476)[_0x755d('0x28')](function(_0x1759ce){_0x31d5a6(_0x1759ce);})[_0x755d('0x2f')](function(_0x5d895a){_0x47ff78(_0x5d895a);});});}function generateNonce(){return crypto[_0x755d('0x6f')](0x10)[_0x755d('0x70')]('hex');}function generateIssuedAt(){return Math[_0x755d('0x71')](Date['now']()/0x3e8)[_0x755d('0x70')]();}function createJwt(_0x36c780){var _0x4b3572={'payload':{'iat':_0x36c780[_0x755d('0x57')],'nonce':_0x36c780[_0x755d('0x41')]},'options':{'algorithm':'HS512','subject':_0x36c780['id']['toString'](),'issuer':hardwareConf[_0x755d('0x3b')](),'audience':hardwareConf[_0x755d('0x3b')]()}};return signJwt(_0x4b3572)['then'](function(_0x5a78b4){return{'iat':_0x36c780[_0x755d('0x57')],'nonce':_0x36c780[_0x755d('0x41')],'token':_0x5a78b4};});} \ No newline at end of file +var _0x2cc9=['toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','join','promisify','sign','secret','payload','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','chatPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','catch','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','signToken','cookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString'];(function(_0x2d7fa1,_0x4cca90){var _0x4dc8cc=function(_0x4bd463){while(--_0x4bd463){_0x2d7fa1['push'](_0x2d7fa1['shift']());}};_0x4dc8cc(++_0x4cca90);}(_0x2cc9,0x176));var _0x92cc=function(_0x53a647,_0x1b9d72){_0x53a647=_0x53a647-0x0;var _0x33dfc6=_0x2cc9[_0x53a647];return _0x33dfc6;};'use strict';var db=require(_0x92cc('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x92cc('0x1'));var licenseUtil=require(_0x92cc('0x2'));var encryptor=require('../encryptor');var _=require(_0x92cc('0x3'));var jwt=require(_0x92cc('0x4'));var expressJwt=require(_0x92cc('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x92cc('0x6'));var crypto=require(_0x92cc('0x7'));var BPromise=require(_0x92cc('0x8'));var util=require(_0x92cc('0x9'));var moment=require(_0x92cc('0xa'));var validateJwt=expressJwt({'secret':config[_0x92cc('0xb')][_0x92cc('0xc')]});var userAttributes=['id',_0x92cc('0xd'),_0x92cc('0xe'),_0x92cc('0xf'),'internal',_0x92cc('0x10'),_0x92cc('0x11'),'permissions','md5secret','voicePause',_0x92cc('0x12'),'mailPause','faxPause','smsPause',_0x92cc('0x13'),_0x92cc('0x14'),_0x92cc('0x15'),_0x92cc('0x16'),_0x92cc('0x17'),'crudPermissions',_0x92cc('0x18'),_0x92cc('0x19'),_0x92cc('0x1a'),_0x92cc('0x1b'),_0x92cc('0x1c'),_0x92cc('0x1d'),_0x92cc('0x1e'),_0x92cc('0x1f'),_0x92cc('0x20'),_0x92cc('0x21'),_0x92cc('0x22'),'phoneBarRemoteControl',_0x92cc('0x23'),_0x92cc('0x24'),'interface',_0x92cc('0x25'),_0x92cc('0x26')];exports[_0x92cc('0x27')]=function(){return this[_0x92cc('0x28')](!![])[_0x92cc('0x29')](function(_0x3b9661,_0x29df7d,_0x5eb250){if(_0x3b9661[_0x92cc('0x2a')]){_0x5eb250();}else{return db[_0x92cc('0x2b')][_0x92cc('0x2c')]({'where':{'id':_0x3b9661[_0x92cc('0x2d')]['id']},'attributes':['id',_0x92cc('0x2e'),_0x92cc('0x2f')],'raw':!![]})['then'](function(_0x16585b){if(_0x16585b&&_0x16585b[_0x92cc('0x2e')]){return _0x29df7d[_0x92cc('0x30')](_0x16585b['disposition']===_0x92cc('0x31')?0x195:0x193)[_0x92cc('0x32')]({'message':_0x16585b[_0x92cc('0x2f')]==='unmanaged'?_0x92cc('0x33'):_0x92cc('0x34')});}else{_0x5eb250();}})['catch'](function(_0x381482){_0x5eb250(_0x381482);});}});};exports[_0x92cc('0x28')]=function isAuthenticated(_0x40f3a0){return compose()[_0x92cc('0x29')](function(_0x4cb0cd,_0x509bc8,_0x26ce28){var _0x12c0ab;if(_0x4cb0cd[_0x92cc('0x35')][_0x92cc('0x36')]){if(_[_0x92cc('0x37')](_0x4cb0cd[_0x92cc('0x35')][_0x92cc('0x36')],_0x92cc('0x38'))){var _0x5e42dc=basicAuth(_0x4cb0cd);db[_0x92cc('0x39')][_0x92cc('0x3a')]({'where':{'name':_0x5e42dc['name']}})[_0x92cc('0x3b')](function(_0x4ed3b0){if(!_0x4ed3b0||!_0x4ed3b0[_0x92cc('0x3c')](_0x5e42dc[_0x92cc('0x3d')])){return _0x509bc8[_0x92cc('0x30')](0x191)[_0x92cc('0x32')]({'message':_0x92cc('0x3e')});}_0x4cb0cd[_0x92cc('0x2a')]={'id':_0x4ed3b0['id']};_0x26ce28();})['catch'](function(_0x21a4cb){_0x26ce28(_0x21a4cb);});}else if(_['startsWith'](_0x4cb0cd['headers']['authorization'],_0x92cc('0x3f'))){validateJwt(_0x4cb0cd,_0x509bc8,_0x26ce28);}else{if(_0x40f3a0){_0x26ce28();}else{return _0x509bc8['status'](0x193)[_0x92cc('0x32')]({'message':_0x92cc('0x40')});}}}else if(_0x4cb0cd[_0x92cc('0x41')][_0x92cc('0x42')]){try{var _0x84c6ed={'audience':hardwareConf[_0x92cc('0x43')](),'issuer':hardwareConf[_0x92cc('0x43')]()};verifyJwt(_0x4cb0cd[_0x92cc('0x41')][_0x92cc('0x42')],_0x84c6ed)['then'](function(_0x13ce7c){return db[_0x92cc('0x39')][_0x92cc('0x3a')]({'where':{'id':_0x13ce7c['sub']}})[_0x92cc('0x3b')](function(_0x806b44){_0x12c0ab=_0x806b44;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x92cc('0x44'),_0x92cc('0x45')],'raw':!![]});})[_0x92cc('0x3b')](function(_0x1e6f17){if(!_0x12c0ab||!_['isEqual'](_0x12c0ab[_0x92cc('0x46')],_0x13ce7c[_0x92cc('0x47')])){return _0x509bc8[_0x92cc('0x30')](0x191)['json']({'message':_0x92cc('0x48')});}if(_0x12c0ab[_0x92cc('0x49')]){return _0x509bc8['status'](0x191)['json']({'message':_0x92cc('0x4a')});}if(_0x12c0ab[_0x92cc('0x4b')]){if(_0x1e6f17[_0x92cc('0x45')]>0x0){if(moment(_0x12c0ab['blockedAt'])[_0x92cc('0x4c')](_0x1e6f17[_0x92cc('0x45')],_0x92cc('0x4d'))>moment()){return _0x509bc8['status'](0x191)['json']({'message':_0x92cc('0x4a')});}}else{return _0x509bc8[_0x92cc('0x30')](0x191)[_0x92cc('0x32')]({'message':_0x92cc('0x4a')});}}_0x4cb0cd[_0x92cc('0x2a')]={'id':_0x12c0ab['id']};_0x26ce28();});})[_0x92cc('0x4e')](function(){return _0x509bc8[_0x92cc('0x30')](0x191)['json']({'message':_0x92cc('0x4a')});});}catch(_0x29356a){_0x26ce28(_0x29356a);}}else if(_0x40f3a0){_0x26ce28();}else{return _0x509bc8[_0x92cc('0x30')](0x193)[_0x92cc('0x32')]({'message':_0x92cc('0x40')});}})[_0x92cc('0x29')](function(_0x3ce211,_0x101501,_0x92d767){if(_0x3ce211['user']){db[_0x92cc('0x39')][_0x92cc('0x3a')]({'where':{'id':_0x3ce211['user']['id']},'attributes':userAttributes})[_0x92cc('0x3b')](function(_0x37fa03){if(!_0x37fa03){return _0x101501['status'](0x194)['json']({'message':_0x92cc('0x4f')});}_0x3ce211[_0x92cc('0x2a')]=_0x37fa03;_0x92d767();})[_0x92cc('0x4e')](function(_0x223894){_0x92d767(_0x223894);});}else if(_0x40f3a0){_0x92d767();}else{return _0x101501[_0x92cc('0x30')](0x194)['json']({'message':_0x92cc('0x50')});}});};exports[_0x92cc('0x51')]=function canUpdate(){return compose()[_0x92cc('0x29')](function(_0x2088fe,_0x2bedd8,_0x150606){return licenseUtil[_0x92cc('0x52')]()[_0x92cc('0x3b')](function(_0x44968a){if(_0x44968a['update']){_0x150606();}else{return _0x2bedd8['status'](0x193)[_0x92cc('0x32')]({'message':'Forbidden'});}})[_0x92cc('0x4e')](function(_0x2a100a){_0x150606(_0x2a100a);});});};exports['isMiddleware']=function(_0x492e6d,_0x18409e,_0x255995){_0x492e6d['isMiddleware']=!![];return _0x255995();};exports[_0x92cc('0x53')]=function signToken(_0x47df3b){return signJwt(_0x47df3b);};exports['setTokenCookie']=function(_0x5359fd,_0x33220d){if(!_0x5359fd['user']){return _0x33220d[_0x92cc('0x30')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x17dd6f={'payload':{'id':_0x5359fd[_0x92cc('0x2a')]['id'],'role':_0x5359fd[_0x92cc('0x2a')][_0x92cc('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x17dd6f)[_0x92cc('0x3b')](function(_0x3e9524){_0x33220d[_0x92cc('0x54')](_0x92cc('0x55'),_0x3e9524);_0x33220d['redirect'](_0x92cc('0x56'));})[_0x92cc('0x4e')](function(_0x294c3c){return _0x33220d[_0x92cc('0x30')](0x1f4)[_0x92cc('0x57')](_0x294c3c);});};exports['retrieveApiKey']=function(_0xc23bbd){if(_[_0x92cc('0x58')](_0xc23bbd[_0x92cc('0x46')])||_[_0x92cc('0x58')](_0xc23bbd[_0x92cc('0x59')])){return null;}else{return createJwt(_0xc23bbd);}};exports[_0x92cc('0x5a')]=function(_0x3ff4e0){_0x3ff4e0[_0x92cc('0x46')]=generateNonce();_0x3ff4e0[_0x92cc('0x59')]=generateIssuedAt();return createJwt(_0x3ff4e0);};exports[_0x92cc('0x5b')]=function(_0x28ca62,_0x4ed590){var _0x19b4e8=_0x28ca62[_0x92cc('0x41')][_0x92cc('0x42')];if(_0x19b4e8){var _0x4335f2={'nonce':_0x4ed590['apiKeyNonce'],'iat':_0x4ed590[_0x92cc('0x59')],'audience':hardwareConf[_0x92cc('0x43')](),'issuer':hardwareConf[_0x92cc('0x43')]()};return verifyJwt(_0x19b4e8,_0x4335f2)['then'](function(){return generateApiKey(_0x4ed590);});}else{throw{'message':_0x92cc('0x5c')};}};exports[_0x92cc('0x5d')]=function(_0x1496b9){var _0xe05dd9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xe05dd9[_0x92cc('0x5e')](_0x1496b9))throw new db[(_0x92cc('0x5f'))][(_0x92cc('0x60'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x379bd7,_0x3f383e,_0x17c2f4){var _0x3c2a79=encryptor[_0x92cc('0x61')](_0x3f383e)['split'](',');for(var _0x1b5275=0x0;_0x1b5275<_0x17c2f4;_0x1b5275++){if(!_0x3c2a79[_0x1b5275])break;if(_0x379bd7[_0x92cc('0x62')]()===_0x3c2a79[_0x1b5275]['toLowerCase']()){var _0x133234=util[_0x92cc('0x63')](_0x92cc('0x64'),_0x17c2f4);if(_0x17c2f4===0x1){_0x133234=_0x92cc('0x65');}throw new db[(_0x92cc('0x5f'))]['ValidationError'](_0x133234);}}return;};exports[_0x92cc('0x66')]=function(_0x117078,_0xec1be8){var _0x356f9b=_0xec1be8?encryptor[_0x92cc('0x61')](_0xec1be8)[_0x92cc('0x67')](','):[];if(_0x356f9b[_0x92cc('0x68')]===0x5){_0x356f9b[_0x92cc('0x69')](-0x1,0x1);}_0x356f9b[_0x92cc('0x6a')](_0x117078);return encryptor['encryptString'](_0x356f9b[_0x92cc('0x6b')](','));};function signJwt(_0x5677e1){var _0x2d0cab=BPromise[_0x92cc('0x6c')](jwt[_0x92cc('0x6d')],{'context':jwt});var _0x47e4fb=_0x5677e1[_0x92cc('0x6e')]||config['secrets'][_0x92cc('0xc')];return new BPromise(function(_0x4ec0e9,_0x159dc6){_0x2d0cab(_0x5677e1[_0x92cc('0x6f')],_0x47e4fb,_0x5677e1['options'])['then'](function(_0x5d4ecc){_0x4ec0e9(_0x5d4ecc);})[_0x92cc('0x4e')](function(_0x580ad2){_0x159dc6(_0x580ad2);});});}function verifyJwt(_0x2b3455,_0x134523,_0x3e0f4a){var _0x333af6=BPromise[_0x92cc('0x6c')](jwt[_0x92cc('0x70')],{'context':jwt});var _0x3d2088=_0x3e0f4a||config[_0x92cc('0xb')][_0x92cc('0xc')];return new BPromise(function(_0x21851a,_0xbe6842){_0x333af6(_0x2b3455,_0x3d2088,_0x134523)['then'](function(_0x25b189){_0x21851a(_0x25b189);})['catch'](function(_0x699ae2){_0xbe6842(_0x699ae2);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x92cc('0x71')](_0x92cc('0x72'));}function generateIssuedAt(){return Math[_0x92cc('0x73')](Date[_0x92cc('0x74')]()/0x3e8)[_0x92cc('0x71')]();}function createJwt(_0x1537ea){var _0x1dd95e={'payload':{'iat':_0x1537ea[_0x92cc('0x59')],'nonce':_0x1537ea[_0x92cc('0x46')]},'options':{'algorithm':_0x92cc('0x75'),'subject':_0x1537ea['id']['toString'](),'issuer':hardwareConf[_0x92cc('0x43')](),'audience':hardwareConf[_0x92cc('0x43')]()}};return signJwt(_0x1dd95e)['then'](function(_0x417cf2){return{'iat':_0x1537ea[_0x92cc('0x59')],'nonce':_0x1537ea['apiKeyNonce'],'token':_0x417cf2};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 742b536..1e07b01 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 _0x0a6b=['close','unlink','base64','decryptString','secret','createDecipher','utf8','crypto','session','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','decryptFile','data'];(function(_0x1c0d79,_0x4b49be){var _0x20c136=function(_0x281a77){while(--_0x281a77){_0x1c0d79['push'](_0x1c0d79['shift']());}};_0x20c136(++_0x4b49be);}(_0x0a6b,0x18e));var _0xb0a6=function(_0xc62435,_0x3584e0){_0xc62435=_0xc62435-0x0;var _0x56b63c=_0x0a6b[_0xc62435];return _0x56b63c;};'use strict';var crypto=require(_0xb0a6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config['secrets'][_0xb0a6('0x1')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xb0a6('0x2')};function combineOptions(_0x13dc41){var _0x1d3b78={};for(var _0x544a64 in fileOptions){if(fileOptions[_0xb0a6('0x3')](_0x544a64)){_0x1d3b78[_0x544a64]=fileOptions[_0x544a64];}}if(_0x13dc41){for(var _0x4cc3ae in _0x13dc41){if(_0x13dc41[_0xb0a6('0x3')](_0x4cc3ae)){_0x1d3b78[_0x4cc3ae]=_0x13dc41[_0x4cc3ae];}}}return _0x1d3b78;}exports[_0xb0a6('0x4')]=function(_0x5e2d2d,_0x11cd5b,_0x24515c,_0x2a8516){return new BPromise(function(_0x530c05,_0x47c553){_0x2a8516=combineOptions(_0x2a8516);var _0x5161af=new Buffer(_0x24515c);var _0x2ded05=fs[_0xb0a6('0x5')](_0x5e2d2d);var _0x34b835=fs[_0xb0a6('0x6')](_0x11cd5b);var _0x5252ed=crypto[_0xb0a6('0x7')](_0x2a8516[_0xb0a6('0x8')],_0x5161af);_0x2ded05['on']('data',function(_0x23eade){var _0x24e4fd=new Buffer(_0x5252ed[_0xb0a6('0x9')](_0x23eade),_0xb0a6('0xa'));_0x34b835[_0xb0a6('0xb')](_0x24e4fd);});_0x2ded05['on'](_0xb0a6('0xc'),function(){try{var _0x3d607f=new Buffer(_0x5252ed[_0xb0a6('0xd')](_0xb0a6('0xa')),_0xb0a6('0xa'));_0x34b835['write'](_0x3d607f);_0x34b835[_0xb0a6('0xc')]();_0x34b835['on']('close',function(){return _0x530c05(_0x11cd5b);});}catch(_0x397c36){fs['unlink'](_0x11cd5b);return _0x47c553(_0x397c36);}});});};exports[_0xb0a6('0xe')]=function(_0x59730e,_0x1d837f,_0x382c2f,_0x93243e){return new BPromise(function(_0x5673ad,_0x56b594){_0x93243e=combineOptions(_0x93243e);var _0x51105b=new Buffer(_0x382c2f);var _0x295b53=fs[_0xb0a6('0x5')](_0x59730e);var _0x18f994=fs[_0xb0a6('0x6')](_0x1d837f);var _0x13a1c8=crypto['createDecipher'](_0x93243e[_0xb0a6('0x8')],_0x51105b);_0x295b53['on'](_0xb0a6('0xf'),function(_0x372457){var _0xdc5de1=new Buffer(_0x13a1c8[_0xb0a6('0x9')](_0x372457),_0xb0a6('0xa'));_0x18f994['write'](_0xdc5de1);});_0x295b53['on'](_0xb0a6('0xc'),function(){try{var _0x6d2003=new Buffer(_0x13a1c8[_0xb0a6('0xd')](_0xb0a6('0xa')),_0xb0a6('0xa'));_0x18f994[_0xb0a6('0xb')](_0x6d2003);_0x18f994[_0xb0a6('0xc')]();_0x18f994['on'](_0xb0a6('0x10'),function(){return _0x5673ad(_0x1d837f);});}catch(_0x4b9a6c){fs[_0xb0a6('0x11')](_0x1d837f);return _0x56b594(_0x4b9a6c);}});});};exports['encryptString']=function(_0x1322ec,_0x2f1e97,_0x4997df){var _0x4aa68d=_0x4997df||stringOptions[_0xb0a6('0x8')];var _0x14993f=_0x2f1e97||stringOptions['secret'];var _0x3ea787=crypto[_0xb0a6('0x7')](_0x4aa68d,_0x14993f);var _0x259f47=_0x3ea787[_0xb0a6('0x9')](_0x1322ec,'utf8','base64');_0x259f47+=_0x3ea787[_0xb0a6('0xd')](_0xb0a6('0x12'));return _0x259f47;};exports[_0xb0a6('0x13')]=function(_0x58d923,_0x23bec3,_0x3347ac){var _0x3edd9a=_0x3347ac||stringOptions[_0xb0a6('0x8')];var _0x10cf86=_0x23bec3||stringOptions[_0xb0a6('0x14')];var _0x94d47f=crypto[_0xb0a6('0x15')](_0x3edd9a,_0x10cf86);var _0x4255b9=_0x94d47f['update'](_0x58d923,_0xb0a6('0x12'),_0xb0a6('0x16'));_0x4255b9+=_0x94d47f[_0xb0a6('0xd')]('utf8');return _0x4255b9;}; \ No newline at end of file +var _0x3c6c=['secrets','session','aes-256-ctr','aes192','encryptFile','createReadStream','createWriteStream','algorithm','data','binary','write','end','final','close','unlink','decryptFile','createDecipher','update','secret','createCipher','base64','decryptString','utf8','crypto','../../config/environment'];(function(_0x4c9142,_0x54d7bb){var _0x14f35a=function(_0x344e25){while(--_0x344e25){_0x4c9142['push'](_0x4c9142['shift']());}};_0x14f35a(++_0x54d7bb);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x40a5c9,_0x49a914){_0x40a5c9=_0x40a5c9-0x0;var _0x231d05=_0x3c6c[_0x40a5c9];return _0x231d05;};'use strict';var crypto=require(_0xc3c6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0xc3c6('0x1'));const stringOptions={'secret':config[_0xc3c6('0x2')][_0xc3c6('0x3')],'algorithm':_0xc3c6('0x4')};const fileOptions={'algorithm':_0xc3c6('0x5')};function combineOptions(_0x37f15a){var _0x65a78={};for(var _0x34db2e in fileOptions){if(fileOptions['hasOwnProperty'](_0x34db2e)){_0x65a78[_0x34db2e]=fileOptions[_0x34db2e];}}if(_0x37f15a){for(var _0x3c630b in _0x37f15a){if(_0x37f15a['hasOwnProperty'](_0x3c630b)){_0x65a78[_0x3c630b]=_0x37f15a[_0x3c630b];}}}return _0x65a78;}exports[_0xc3c6('0x6')]=function(_0x4d7ae6,_0x50cd05,_0x4aed87,_0x5185c3){return new BPromise(function(_0x4f39dd,_0x12fabf){_0x5185c3=combineOptions(_0x5185c3);var _0x1c04d4=new Buffer(_0x4aed87);var _0x5bc1c1=fs[_0xc3c6('0x7')](_0x4d7ae6);var _0x1ba453=fs[_0xc3c6('0x8')](_0x50cd05);var _0x377311=crypto['createCipher'](_0x5185c3[_0xc3c6('0x9')],_0x1c04d4);_0x5bc1c1['on'](_0xc3c6('0xa'),function(_0x1b78ca){var _0x516612=new Buffer(_0x377311['update'](_0x1b78ca),_0xc3c6('0xb'));_0x1ba453[_0xc3c6('0xc')](_0x516612);});_0x5bc1c1['on'](_0xc3c6('0xd'),function(){try{var _0x648a0=new Buffer(_0x377311[_0xc3c6('0xe')](_0xc3c6('0xb')),_0xc3c6('0xb'));_0x1ba453[_0xc3c6('0xc')](_0x648a0);_0x1ba453[_0xc3c6('0xd')]();_0x1ba453['on'](_0xc3c6('0xf'),function(){return _0x4f39dd(_0x50cd05);});}catch(_0x5e42b8){fs[_0xc3c6('0x10')](_0x50cd05);return _0x12fabf(_0x5e42b8);}});});};exports[_0xc3c6('0x11')]=function(_0x25d2bd,_0x283506,_0x42c631,_0x32c52f){return new BPromise(function(_0x181b3b,_0x33920c){_0x32c52f=combineOptions(_0x32c52f);var _0x2d4b3d=new Buffer(_0x42c631);var _0x64c62a=fs[_0xc3c6('0x7')](_0x25d2bd);var _0x26c9b0=fs[_0xc3c6('0x8')](_0x283506);var _0x3003e1=crypto[_0xc3c6('0x12')](_0x32c52f['algorithm'],_0x2d4b3d);_0x64c62a['on'](_0xc3c6('0xa'),function(_0x5a2456){var _0x2150e0=new Buffer(_0x3003e1[_0xc3c6('0x13')](_0x5a2456),_0xc3c6('0xb'));_0x26c9b0[_0xc3c6('0xc')](_0x2150e0);});_0x64c62a['on'](_0xc3c6('0xd'),function(){try{var _0x3490a2=new Buffer(_0x3003e1[_0xc3c6('0xe')](_0xc3c6('0xb')),_0xc3c6('0xb'));_0x26c9b0[_0xc3c6('0xc')](_0x3490a2);_0x26c9b0[_0xc3c6('0xd')]();_0x26c9b0['on'](_0xc3c6('0xf'),function(){return _0x181b3b(_0x283506);});}catch(_0x3d03b0){fs[_0xc3c6('0x10')](_0x283506);return _0x33920c(_0x3d03b0);}});});};exports['encryptString']=function(_0x24fb2d,_0x40893b,_0x2bced6){var _0x565a86=_0x2bced6||stringOptions[_0xc3c6('0x9')];var _0x42438d=_0x40893b||stringOptions[_0xc3c6('0x14')];var _0xfc19be=crypto[_0xc3c6('0x15')](_0x565a86,_0x42438d);var _0x47808f=_0xfc19be[_0xc3c6('0x13')](_0x24fb2d,'utf8',_0xc3c6('0x16'));_0x47808f+=_0xfc19be[_0xc3c6('0xe')]('base64');return _0x47808f;};exports[_0xc3c6('0x17')]=function(_0x3358db,_0x1457f7,_0xdad009){var _0x312539=_0xdad009||stringOptions[_0xc3c6('0x9')];var _0x2b1ae0=_0x1457f7||stringOptions[_0xc3c6('0x14')];var _0x1f1d36=crypto['createDecipher'](_0x312539,_0x2b1ae0);var _0xb047b1=_0x1f1d36[_0xc3c6('0x13')](_0x3358db,_0xc3c6('0x16'),_0xc3c6('0x18'));_0xb047b1+=_0x1f1d36['final'](_0xc3c6('0x18'));return _0xb047b1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 141ca67..8f64ef7 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 _0x55e0=['util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x55e0,0xdc));var _0x055e=function(_0x3e9591,_0x48dd62){_0x3e9591=_0x3e9591-0x0;var _0x294721=_0x55e0[_0x3e9591];return _0x294721;};'use strict';var util=require(_0x055e('0x0'));var path=require(_0x055e('0x1'));var _=require(_0x055e('0x2'));var csv=require(_0x055e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x055e('0x4'));var db=require(_0x055e('0x5'))['db'];var dbH=require(_0x055e('0x5'))[_0x055e('0x6')];var logger=require(_0x055e('0x7'))(_0x055e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x055e('0x9')][0x4];function analyticExtractedReport(_0x4a442e,_0x8e7824){var _0x3c4cf={'status':_0x4a442e};var _0x376618={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7824){_0x3c4cf[_0x055e('0xa')]=_0x8e7824;}return db[_0x055e('0xb')]['update'](_0x3c4cf,_0x376618);}function main(){var _0x40779c=0x1388;var _0xd67814;logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x055e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x055e('0x10')]})[_0x055e('0x11')](function(_0x72d424){if(_0x72d424){_0xd67814=_0x72d424;_0x40779c=_0xd67814[_0x055e('0x10')]||0x1388;}})[_0x055e('0x11')](function(){return dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x14'),QUERY),{'type':dbH[_0x055e('0x12')][_0x055e('0x15')][_0x055e('0x16')]});})[_0x055e('0x11')](function(_0x56af18){if(!_0x56af18[0x0][_0x055e('0x17')]){return analyticExtractedReport(_0x055e('0x18'));}var _0x111cdb=[];var _0x599533=0x0;var _0x3f2d0e=!![];if(_0x56af18&&_0x56af18[_0x055e('0x19')]){var _0xb4e6ca=_0x56af18[0x0][_0x055e('0x17')]%(_0x599533+_0x40779c);if(_0xd67814[_0x055e('0x1a')]){for(;_0x3f2d0e;_0x599533+=_0x40779c,_0xb4e6ca=_0x56af18[0x0]['num']%(_0x599533+_0x40779c)){if(_0xb4e6ca==0x0||_0xb4e6ca==_0x56af18[0x0][_0x055e('0x17')]){_0x3f2d0e=![];}_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x1c'),QUERY,_0x40779c,_0x599533),{'type':dbH[_0x055e('0x12')]['QueryTypes'][_0x055e('0x16')]}));}}else{_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](QUERY,{'type':dbH[_0x055e('0x12')][_0x055e('0x15')]['SELECT']}));}}var _0x31c355=path[_0x055e('0x1d')](PATH);var _0x211594=path['basename'](PATH,_0x055e('0x1e'));var _0x2da6b=_0xd67814[_0x055e('0x1a')]&&_0x111cdb[_0x055e('0x19')]>0x1;var _0x51df23=[];if(!fs[_0x055e('0x1f')](path['join'](_0x31c355,_0x211594))&&_0x2da6b){fs[_0x055e('0x20')](path[_0x055e('0x21')](_0x31c355,_0x211594));}return BPromise[_0x055e('0x22')](_0x111cdb,function(_0x1a76c6){_0x51df23[_0x055e('0x1b')](_0x1a76c6);})[_0x055e('0x11')](function(){for(var _0x58caf9=0x0;_0x58caf9<_0x51df23[_0x055e('0x19')];_0x58caf9+=0x1){var _0x1f90a9;var _0x2a82f8=_0x51df23[_0x58caf9];if(_0x2da6b){_0x1f90a9=path['join'](_0x31c355,_0x211594,util[_0x055e('0xd')](_0x055e('0x23'),_0x211594,_0x58caf9,_0x055e('0x24')));}else{_0x1f90a9=path[_0x055e('0x21')](_0x31c355,util['format'](_0x055e('0x25'),_0x211594,'csv'));}fs[_0x055e('0x26')](_0x1f90a9,csv(_0x2a82f8));}})[_0x055e('0x11')](function(){if(_0x2da6b){zipdir(path[_0x055e('0x21')](_0x31c355,_0x211594),{'saveTo':path[_0x055e('0x21')](_0x31c355,util[_0x055e('0xd')]('%s.%s',_0x211594,_0x055e('0x27')))},function(_0x453e5e,_0x293062){});rimraf(path[_0x055e('0x21')](_0x31c355,_0x211594),function(){});}})[_0x055e('0x11')](function(){logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x055e('0x29'),_0x2da6b?util[_0x055e('0xd')]('%s.%s',_0x211594,_0x2da6b?_0x055e('0x27'):_0x055e('0x24')):null);});})[_0x055e('0x2a')](function(_0x20717b){logger[_0x055e('0xc')](util[_0x055e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x055e('0x2b')](_0x20717b,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xda55=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','split','push'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xda55,0x6d));var _0x5da5=function(_0x73865a,_0x451e72){_0x73865a=_0x73865a-0x0;var _0x47767f=_0xda55[_0x73865a];return _0x47767f;};'use strict';var util=require(_0x5da5('0x0'));var path=require(_0x5da5('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x5da5('0x2'));var zipdir=require(_0x5da5('0x3'));var rimraf=require(_0x5da5('0x4'));var db=require(_0x5da5('0x5'))['db'];var dbH=require(_0x5da5('0x5'))['dbH'];var logger=require(_0x5da5('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5da5('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5da5('0x7')][0x4];function analyticExtractedReport(_0x267469,_0x71b187){var _0x46290d={'status':_0x267469};var _0x3debdf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x71b187){_0x46290d[_0x5da5('0x8')]=_0x71b187;}return db[_0x5da5('0x9')][_0x5da5('0xa')](_0x46290d,_0x3debdf);}function main(){var _0x5c056f=0x1388;var _0x3ed24c;logger[_0x5da5('0xb')](util[_0x5da5('0xc')](_0x5da5('0xd'),EXTRACTED_REPORT_ID,_0x5da5('0xe')));return db[_0x5da5('0xf')][_0x5da5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5da5('0x11')]})[_0x5da5('0x12')](function(_0x4f813b){if(_0x4f813b){_0x3ed24c=_0x4f813b;_0x5c056f=_0x3ed24c[_0x5da5('0x11')]||0x1388;}})[_0x5da5('0x12')](function(){return dbH[_0x5da5('0x13')][_0x5da5('0x14')](util[_0x5da5('0xc')](_0x5da5('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x5da5('0x12')](function(_0x126fc8){if(!_0x126fc8[0x0][_0x5da5('0x16')]){return analyticExtractedReport(_0x5da5('0x17'));}var _0x11bd3=[];var _0x134afa=0x0;var _0x3aff51=!![];if(_0x126fc8&&_0x126fc8['length']){var _0x124dc5=_0x126fc8[0x0][_0x5da5('0x16')]%(_0x134afa+_0x5c056f);if(_0x3ed24c[_0x5da5('0x18')]){for(;_0x3aff51;_0x134afa+=_0x5c056f,_0x124dc5=_0x126fc8[0x0][_0x5da5('0x16')]%(_0x134afa+_0x5c056f)){if(_0x124dc5==0x0||_0x124dc5==_0x126fc8[0x0][_0x5da5('0x16')]){_0x3aff51=![];}_0x11bd3[_0x5da5('0x19')](dbH['sequelize'][_0x5da5('0x14')](util[_0x5da5('0xc')](_0x5da5('0x1a'),QUERY,_0x5c056f,_0x134afa),{'type':dbH[_0x5da5('0x13')][_0x5da5('0x1b')]['SELECT']}));}}else{_0x11bd3[_0x5da5('0x19')](dbH[_0x5da5('0x13')][_0x5da5('0x14')](QUERY,{'type':dbH['sequelize'][_0x5da5('0x1b')][_0x5da5('0x1c')]}));}}var _0x20c8a6=path[_0x5da5('0x1d')](PATH);var _0xec69f2=path[_0x5da5('0x1e')](PATH,'.csv');var _0x1a6bd7=_0x3ed24c['split']&&_0x11bd3[_0x5da5('0x1f')]>0x1;var _0x716ab7=[];if(!fs[_0x5da5('0x20')](path['join'](_0x20c8a6,_0xec69f2))&&_0x1a6bd7){fs[_0x5da5('0x21')](path[_0x5da5('0x22')](_0x20c8a6,_0xec69f2));}return BPromise[_0x5da5('0x23')](_0x11bd3,function(_0x21e795){_0x716ab7['push'](_0x21e795);})['then'](function(){for(var _0x50aadc=0x0;_0x50aadc<_0x716ab7[_0x5da5('0x1f')];_0x50aadc+=0x1){var _0x56d509;var _0x4e8890=_0x716ab7[_0x50aadc];if(_0x1a6bd7){_0x56d509=path[_0x5da5('0x22')](_0x20c8a6,_0xec69f2,util[_0x5da5('0xc')]('%s%d.%s',_0xec69f2,_0x50aadc,_0x5da5('0x24')));}else{_0x56d509=path[_0x5da5('0x22')](_0x20c8a6,util['format'](_0x5da5('0x25'),_0xec69f2,_0x5da5('0x24')));}fs[_0x5da5('0x26')](_0x56d509,csv(_0x4e8890));}})[_0x5da5('0x12')](function(){if(_0x1a6bd7){zipdir(path[_0x5da5('0x22')](_0x20c8a6,_0xec69f2),{'saveTo':path['join'](_0x20c8a6,util[_0x5da5('0xc')](_0x5da5('0x25'),_0xec69f2,_0x5da5('0x27')))},function(_0x15a0c0,_0x55e2bf){});rimraf(path['join'](_0x20c8a6,_0xec69f2),function(){});}})['then'](function(){logger[_0x5da5('0xb')](util[_0x5da5('0xc')](_0x5da5('0x28'),EXTRACTED_REPORT_ID,_0x5da5('0xe')));return analyticExtractedReport('Completed',_0x1a6bd7?util['format'](_0x5da5('0x25'),_0xec69f2,_0x1a6bd7?'zip':'csv'):null);});})[_0x5da5('0x29')](function(_0x4c6cce){logger[_0x5da5('0xb')](util[_0x5da5('0xc')](_0x5da5('0x2a'),EXTRACTED_REPORT_ID,_0x5da5('0xe')),util[_0x5da5('0x2b')](_0x4c6cce,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x5da5('0x2c'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cc9bafb..5ff34b9 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x1abbef,_0x2aa65c){var _0x3bf92f=function(_0xf0a122){while(--_0xf0a122){_0x1abbef['push'](_0x1abbef['shift']());}};_0x3bf92f(++_0x2aa65c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x48153d,_0x2c95ca){var _0x78b11d=function(_0xc7dd70){while(--_0xc7dd70){_0x48153d['push'](_0x48153d['shift']());}};_0x78b11d(++_0x2c95ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x24d92a,_0x5dcc4d){_0x24d92a=_0x24d92a-0x0;var _0x2d5aed=_0xb10b[_0x24d92a];return _0x2d5aed;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3121675..8d089b5 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 _0x86c4=['xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Setting','find','split','then','sequelize','query','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s'];(function(_0x3bd2db,_0xbe4136){var _0x4b9d23=function(_0x2fbb7b){while(--_0x2fbb7b){_0x3bd2db['push'](_0x3bd2db['shift']());}};_0x4b9d23(++_0xbe4136);}(_0x86c4,0x17b));var _0x486c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86c4[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x486c('0x0'));var path=require(_0x486c('0x1'));var _=require(_0x486c('0x2'));var fs=require('fs');var json2xls=require(_0x486c('0x3'));var BPromise=require(_0x486c('0x4'));var zipdir=require(_0x486c('0x5'));var rimraf=require(_0x486c('0x6'));var db=require(_0x486c('0x7'))['db'];var dbH=require(_0x486c('0x7'))[_0x486c('0x8')];var logger=require(_0x486c('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x486c('0xa')][0x4];function analyticExtractedReport(_0x1eece9,_0x3eae5d){var _0x4c6536={'status':_0x1eece9};var _0x438c3f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3eae5d){_0x4c6536[_0x486c('0xb')]=_0x3eae5d;}return db['AnalyticExtractedReport'][_0x486c('0xc')](_0x4c6536,_0x438c3f);}function main(){var _0x27e657=0x1388;var _0x2894f0;logger[_0x486c('0xd')](util[_0x486c('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x486c('0xf')][_0x486c('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x486c('0x11'),'splitSizeXlsx']})[_0x486c('0x12')](function(_0x5a3877){if(_0x5a3877){_0x2894f0=_0x5a3877;_0x27e657=_0x2894f0['splitSizeXlsx']||0x1388;}})[_0x486c('0x12')](function(){return dbH[_0x486c('0x13')][_0x486c('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x486c('0x13')]['QueryTypes']['SELECT']});})[_0x486c('0x12')](function(_0x17eede){if(!_0x17eede[0x0]['num']){return analyticExtractedReport(_0x486c('0x15'));}var _0x38bb55=[];var _0x12f175=0x0;var _0x473394=!![];if(_0x2894f0[_0x486c('0x11')]){if(_0x17eede&&_0x17eede[_0x486c('0x16')]){var _0x1ac23e=_0x17eede[0x0][_0x486c('0x17')]%(_0x12f175+_0x27e657);for(;_0x473394;_0x12f175+=_0x27e657,_0x1ac23e=_0x17eede[0x0][_0x486c('0x17')]%(_0x12f175+_0x27e657)){if(_0x1ac23e==0x0||_0x1ac23e==_0x17eede[0x0][_0x486c('0x17')]){_0x473394=![];}_0x38bb55['push'](dbH[_0x486c('0x13')][_0x486c('0x14')](util[_0x486c('0xe')](_0x486c('0x18'),QUERY,_0x27e657,_0x12f175),{'type':dbH[_0x486c('0x13')][_0x486c('0x19')][_0x486c('0x1a')]}));}}}else{_0x38bb55[_0x486c('0x1b')](dbH[_0x486c('0x13')][_0x486c('0x14')](QUERY,{'type':dbH[_0x486c('0x13')][_0x486c('0x19')][_0x486c('0x1a')]}));}var _0x1f020c=path[_0x486c('0x1c')](PATH);var _0x2bcf65=path[_0x486c('0x1d')](PATH,_0x486c('0x1e'));var _0x36c9af=_0x2894f0['split']&&_0x38bb55['length']>0x1;var _0x418e7b=[];if(!fs[_0x486c('0x1f')](path[_0x486c('0x20')](_0x1f020c,_0x2bcf65))&&_0x36c9af){fs[_0x486c('0x21')](path[_0x486c('0x20')](_0x1f020c,_0x2bcf65));}return BPromise['each'](_0x38bb55,function(_0x2e0cca){_0x418e7b[_0x486c('0x1b')](_0x2e0cca);})[_0x486c('0x12')](function(){for(var _0xc43e36=0x0;_0xc43e36<_0x418e7b[_0x486c('0x16')];_0xc43e36+=0x1){var _0x2460f5;var _0x197a53=_0x418e7b[_0xc43e36];if(_0x36c9af){_0x2460f5=path[_0x486c('0x20')](_0x1f020c,_0x2bcf65,util[_0x486c('0xe')](_0x486c('0x22'),_0x2bcf65,_0xc43e36,_0x486c('0x23')));}else{_0x2460f5=path[_0x486c('0x20')](_0x1f020c,util[_0x486c('0xe')]('%s.%s',_0x2bcf65,_0x486c('0x23')));}fs[_0x486c('0x24')](_0x2460f5,json2xls(_0x197a53),_0x486c('0x25'));}})['then'](function(){if(_0x36c9af){zipdir(path[_0x486c('0x20')](_0x1f020c,_0x2bcf65),{'saveTo':path[_0x486c('0x20')](_0x1f020c,util[_0x486c('0xe')](_0x486c('0x26'),_0x2bcf65,_0x486c('0x27')))},function(_0x57ac0a,_0x39d616){});rimraf(path[_0x486c('0x20')](_0x1f020c,_0x2bcf65),function(){});}})[_0x486c('0x12')](function(){logger[_0x486c('0xd')](util['format'](_0x486c('0x28'),EXTRACTED_REPORT_ID,_0x486c('0x29')));return analyticExtractedReport(_0x486c('0x2a'),_0x36c9af?util['format'](_0x486c('0x26'),_0x2bcf65,_0x36c9af?_0x486c('0x27'):_0x486c('0x23')):null);});})[_0x486c('0x2b')](function(_0x529b79){logger[_0x486c('0xd')](util[_0x486c('0xe')](_0x486c('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x529b79,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x486c('0x2d'));});}main(); \ No newline at end of file +var _0x35ec=['analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Failed','util','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x1568bd,_0x2559e0){var _0x1be0e1=function(_0x37c405){while(--_0x37c405){_0x1568bd['push'](_0x1568bd['shift']());}};_0x1be0e1(++_0x2559e0);}(_0x35ec,0xde));var _0xc35e=function(_0x504a09,_0x8e6e45){_0x504a09=_0x504a09-0x0;var _0x1ae7d8=_0x35ec[_0x504a09];return _0x1ae7d8;};'use strict';var util=require(_0xc35e('0x0'));var path=require('path');var _=require(_0xc35e('0x1'));var fs=require('fs');var json2xls=require(_0xc35e('0x2'));var BPromise=require(_0xc35e('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xc35e('0x4'));var db=require(_0xc35e('0x5'))['db'];var dbH=require(_0xc35e('0x5'))[_0xc35e('0x6')];var logger=require(_0xc35e('0x7'))(_0xc35e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xc35e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xde4328,_0x438ba0){var _0xb0de51={'status':_0xde4328};var _0x3faca9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x438ba0){_0xb0de51[_0xc35e('0xa')]=_0x438ba0;}return db[_0xc35e('0xb')]['update'](_0xb0de51,_0x3faca9);}function main(){var _0x61f872=0x1388;var _0x50dd02;logger[_0xc35e('0xc')](util['format'](_0xc35e('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xc35e('0xe')][_0xc35e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc35e('0x10'),_0xc35e('0x11')]})[_0xc35e('0x12')](function(_0x8049eb){if(_0x8049eb){_0x50dd02=_0x8049eb;_0x61f872=_0x50dd02[_0xc35e('0x11')]||0x1388;}})[_0xc35e('0x12')](function(){return dbH[_0xc35e('0x13')]['query'](util[_0xc35e('0x14')](_0xc35e('0x15'),QUERY),{'type':dbH[_0xc35e('0x13')][_0xc35e('0x16')][_0xc35e('0x17')]});})[_0xc35e('0x12')](function(_0x131836){if(!_0x131836[0x0][_0xc35e('0x18')]){return analyticExtractedReport(_0xc35e('0x19'));}var _0x13a6ab=[];var _0x509710=0x0;var _0x377a1c=!![];if(_0x50dd02[_0xc35e('0x10')]){if(_0x131836&&_0x131836[_0xc35e('0x1a')]){var _0x5894a8=_0x131836[0x0][_0xc35e('0x18')]%(_0x509710+_0x61f872);for(;_0x377a1c;_0x509710+=_0x61f872,_0x5894a8=_0x131836[0x0][_0xc35e('0x18')]%(_0x509710+_0x61f872)){if(_0x5894a8==0x0||_0x5894a8==_0x131836[0x0][_0xc35e('0x18')]){_0x377a1c=![];}_0x13a6ab[_0xc35e('0x1b')](dbH['sequelize']['query'](util['format'](_0xc35e('0x1c'),QUERY,_0x61f872,_0x509710),{'type':dbH[_0xc35e('0x13')][_0xc35e('0x16')]['SELECT']}));}}}else{_0x13a6ab[_0xc35e('0x1b')](dbH[_0xc35e('0x13')][_0xc35e('0x1d')](QUERY,{'type':dbH[_0xc35e('0x13')][_0xc35e('0x16')][_0xc35e('0x17')]}));}var _0x5d67fc=path[_0xc35e('0x1e')](PATH);var _0x4fb00b=path[_0xc35e('0x1f')](PATH,_0xc35e('0x20'));var _0xa8641=_0x50dd02[_0xc35e('0x10')]&&_0x13a6ab[_0xc35e('0x1a')]>0x1;var _0x17b2ee=[];if(!fs['existsSync'](path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b))&&_0xa8641){fs[_0xc35e('0x22')](path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b));}return BPromise[_0xc35e('0x23')](_0x13a6ab,function(_0x24571c){_0x17b2ee[_0xc35e('0x1b')](_0x24571c);})[_0xc35e('0x12')](function(){for(var _0x6e11c3=0x0;_0x6e11c3<_0x17b2ee[_0xc35e('0x1a')];_0x6e11c3+=0x1){var _0x257b96;var _0x3b1551=_0x17b2ee[_0x6e11c3];if(_0xa8641){_0x257b96=path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b,util[_0xc35e('0x14')](_0xc35e('0x24'),_0x4fb00b,_0x6e11c3,_0xc35e('0x25')));}else{_0x257b96=path[_0xc35e('0x21')](_0x5d67fc,util[_0xc35e('0x14')]('%s.%s',_0x4fb00b,_0xc35e('0x25')));}fs[_0xc35e('0x26')](_0x257b96,json2xls(_0x3b1551),'binary');}})[_0xc35e('0x12')](function(){if(_0xa8641){zipdir(path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b),{'saveTo':path[_0xc35e('0x21')](_0x5d67fc,util[_0xc35e('0x14')](_0xc35e('0x27'),_0x4fb00b,_0xc35e('0x28')))},function(_0x3e4bc1,_0x21d6e5){});rimraf(path[_0xc35e('0x21')](_0x5d67fc,_0x4fb00b),function(){});}})[_0xc35e('0x12')](function(){logger['info'](util[_0xc35e('0x14')](_0xc35e('0x29'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0xa8641?util[_0xc35e('0x14')](_0xc35e('0x27'),_0x4fb00b,_0xa8641?_0xc35e('0x28'):_0xc35e('0x25')):null);});})[_0xc35e('0x2a')](function(_0x4da543){logger[_0xc35e('0xc')](util[_0xc35e('0x14')](_0xc35e('0x2b'),EXTRACTED_REPORT_ID,_0xc35e('0x2c')),util['inspect'](_0x4da543,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xc35e('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9d893e0..87af9e0 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 _0x8529=['context','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','VoiceExtensionId','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','interval','IntervalId','tag','ExecIf','$[${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)','indexOf','toLowerCase','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','findAll','then','intervals','models','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','priority','extension','find','push','type','Set','format','CDR(type)=%s'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x8529,0x73));var _0x9852=function(_0x4dcd99,_0xb153b3){_0x4dcd99=_0x4dcd99-0x0;var _0x517e00=_0x8529[_0x4dcd99];return _0x517e00;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x2eb534,_0x22ebdc){var _0x1b8058=this;return _0x2eb534['models']['Interval'][_0x9852('0x0')]({'raw':!![]})[_0x9852('0x1')](function(_0x30a990){_0x1b8058[_0x9852('0x2')]=_0x30a990;return _0x2eb534[_0x9852('0x3')][_0x9852('0x4')]['findAll']({'where':{'IntervalId':_0x22ebdc['IntervalId']},'raw':!![]});})[_0x9852('0x1')](function(_0x46db54){return _0x2eb534['models']['VoiceExtension'][_0x9852('0x0')]({'where':{'exten':{'$in':_[_0x9852('0x5')](_['map'](_0x46db54,_0x9852('0x6')))}},'order':[{'raw':_0x9852('0x7')}],'raw':!![]});})['then'](function(_0x2636a1){var _0x565e1c=_[_0x9852('0x8')](_0x2636a1,{'priority':'1'});var _0x3d9929=_[_0x9852('0x8')](_0x2636a1,{'isApp':0x1});var _0x2c7d26=_['groupBy'](_0x3d9929,_0x9852('0x6'));var _0x3d0649=['queue',_0x9852('0x9')];var _0x1b76d1=[];var _0x154721=[];for(var _0x30d551 in _0x2c7d26){if(_0x2c7d26[_0x9852('0xa')](_0x30d551)){_0x1b8058[_0x9852('0xb')]=0x2;_0x1b8058['extensions']=[];_0x1b8058[_0x9852('0xc')]=_[_0x9852('0xd')](_0x565e1c,{'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')]});_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':util[_0x9852('0x11')](_0x9852('0x12'),_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')]),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});if(_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')]===_0x9852('0x14')){if(_0x1b8058[_0x9852('0xc')]){_0x1b8058[_0x9852('0x15')]['push']({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x16')+(_0x1b8058[_0x9852('0xc')][_0x9852('0x17')]?_0x9852('0x18')+_0x1b8058['extension'][_0x9852('0x17')]+'}':_0x9852('0x19')),'context':_0x2c7d26[_0x30d551][0x0]['context'],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058['priority']++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});}_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x1a')+_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')],'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});var _0x19f8a5=_0x1b8058['priority']++;_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':'ExecIf','appdata':_0x9852('0x1c')+(_0x19f8a5+0x2)+'):Goto('+(_0x19f8a5+0x1)+')','context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x19f8a5,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});if(_0x1b8058[_0x9852('0xc')]){_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x1b8058['extension'][_0x9852('0x17')]?'CDR(prefix)=${EXTEN:0:'+_0x1b8058[_0x9852('0xc')][_0x9852('0x17')]+'}':_0x9852('0x1d'),'context':_0x2c7d26[_0x30d551][0x0]['context'],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});}_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':'Set','appdata':_0x9852('0x1e')+_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')],'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});if(_0x1b8058['extension']&&_0x1b8058[_0x9852('0xc')]['hasOwnProperty'](_0x9852('0x1f'))&&_0x1b8058[_0x9852('0xc')][_0x9852('0x1f')]!==_0x9852('0x20')){_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x21'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x22')+_0x1b8058[_0x9852('0xc')]['recordingFormat']||_0x9852('0x23'),'context':_0x2c7d26[_0x30d551][0x0]['context'],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});}}_0x1b8058['extensions'][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0]['type'],'app':_0x9852('0x10'),'appdata':_0x9852('0x24'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});_0x1b8058[_0x9852('0x15')]['push']({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x25'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0]['exten'],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});_0x1b8058[_0x9852('0x15')][_0x9852('0xe')]({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':_0x9852('0x26'),'context':_0x2c7d26[_0x30d551][0x0][_0x9852('0x13')],'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'priority':_0x1b8058[_0x9852('0xb')]++,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});for(var _0x1ce175=0x0,_0x426108=0x0;_0x1ce175<_0x2c7d26[_0x30d551][_0x9852('0x27')];_0x1ce175+=0x1,_0x426108=0x0){var _0x26a898=_0x2c7d26[_0x30d551][_0x1ce175];if(_0x26a898['type']){_0x26a898[_0x9852('0xf')]=_0x26a898[_0x9852('0xf')]['toLowerCase']();}var _0x1d49f5=[];var _0x33a103=[];delete _0x26a898['id'];delete _0x26a898[_0x9852('0x28')];delete _0x26a898['updatedAt'];var _0x38cf4b=_0x26a898['interval']!==_0x9852('0x29')?[_0x26a898[_0x9852('0x2a')]]:_0x26a898[_0x9852('0x2b')]?_['map'](_[_0x9852('0x8')](_0x1b8058['intervals'],{'IntervalId':_0x26a898[_0x9852('0x2b')]}),_0x9852('0x2a')):[];if(_0x26a898['hasOwnProperty'](_0x9852('0x2c'))){if(_0x26a898[_0x9852('0x2c')]&&_0x26a898[_0x9852('0x2c')]!=='--'){_0x1d49f5['push']({'type':_0x26a898[_0x9852('0xf')],'app':_0x9852('0x10'),'appdata':'CDR(tag)='+_0x26a898[_0x9852('0x2c')],'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}}if(_0x26a898['type']==='outbound'&&_0x26a898[_0x9852('0xa')]('callerID')){if(_0x26a898['callerID']){_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':_0x9852('0x2d'),'appdata':_0x9852('0x2e')+_0x26a898[_0x9852('0x2f')]+')','context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898['exten'],'priority':_0x38cf4b['length']+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}else{_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':'ExecIf','appdata':_0x9852('0x30'),'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058['priority']+_0x426108++,'VoiceExtensionId':_0x26a898['VoiceExtensionId']});}}if(_0x26a898[_0x9852('0xa')]('answer')){if(_0x3d0649[_0x9852('0x31')](_0x26a898['app'][_0x9852('0x32')]())>=0x0&&_0x26a898[_0x9852('0x33')]!==_0x9852('0x34')){if(_0x26a898[_0x9852('0x35')]){_0x1d49f5['push']({'type':_0x26a898['type'],'app':'ExecIf','appdata':_0x9852('0x36'),'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});_0x1d49f5['push']({'type':_0x26a898['type'],'app':_0x9852('0x10'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b[_0x9852('0x27')]+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}else{_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':'ExecIf','appdata':_0x9852('0x37'),'context':_0x26a898[_0x9852('0x13')],'exten':_0x26a898[_0x9852('0x6')],'priority':_0x38cf4b['length']+_0x1b8058[_0x9852('0xb')]+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});_0x1d49f5[_0x9852('0xe')]({'type':_0x26a898[_0x9852('0xf')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x26a898['context'],'exten':_0x26a898['exten'],'priority':_0x38cf4b['length']+_0x1b8058['priority']+_0x426108++,'VoiceExtensionId':_0x26a898[_0x9852('0x1b')]});}}}for(var _0x582c12=0x0;_0x582c12<_0x38cf4b['length'];_0x582c12+=0x1){var _0x1d00bd=_0x1b8058[_0x9852('0xb')]+_0x38cf4b[_0x9852('0x27')];var _0x487009=_0x582c12===_0x38cf4b[_0x9852('0x27')]-0x1?_0x1b8058[_0x9852('0xb')]+_0x1d49f5[_0x9852('0x27')]+_0x33a103[_0x9852('0x27')]+0x2:_0x1b8058['priority']+_0x582c12+0x1;_0x1d49f5[_0x9852('0x38')](_0x582c12,0x0,{'type':_0x26a898[_0x9852('0xf')],'app':_0x9852('0x39'),'appdata':_0x38cf4b[_0x582c12]+'?'+_0x26a898[_0x9852('0x13')]+_0x9852('0x3a')+_0x1d00bd+':'+_0x26a898[_0x9852('0x13')]+_0x9852('0x3a')+_0x487009,'exten':_0x26a898[_0x9852('0x6')],'context':_0x26a898[_0x9852('0x13')],'priority':_0x1b8058[_0x9852('0xb')]+_0x582c12,'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0]['VoiceExtensionId']});}_0x26a898[_0x9852('0xb')]=_0x1d49f5['length']?_[_0x9852('0x3b')](_0x1d49f5)[_0x9852('0xb')]+0x1:_0x1b8058[_0x9852('0xb')];_0x1b8058['priority']=(_0x33a103[_0x9852('0x27')]?_['last'](_0x33a103)[_0x9852('0xb')]:_0x26a898[_0x9852('0xb')])+0x1;_0x1b8058[_0x9852('0x15')]=_[_0x9852('0x3c')](_0x1b8058[_0x9852('0x15')],_0x1d49f5,[_0x26a898],_0x33a103);}_0x1b8058['extensions']['push']({'type':_0x2c7d26[_0x30d551][0x0][_0x9852('0xf')],'app':_0x9852('0x3d'),'exten':_0x2c7d26[_0x30d551][0x0][_0x9852('0x6')],'context':_0x2c7d26[_0x30d551][0x0]['context'],'priority':_0x1b8058[_0x9852('0xb')],'VoiceExtensionId':_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]});_0x1b76d1[_0x9852('0xe')](_0x2c7d26[_0x30d551][0x0][_0x9852('0x1b')]);_0x154721=_[_0x9852('0x3c')](_0x154721,_0x1b8058['extensions']);}}return _0x2eb534['transaction'](function(_0x48893b){return _0x2eb534[_0x9852('0x3')][_0x9852('0x4')][_0x9852('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1b76d1}},'transaction':_0x48893b})[_0x9852('0x1')](function(_0x19107b){return _0x2eb534[_0x9852('0x3')]['VoiceExtension'][_0x9852('0x3f')](_[_0x9852('0x40')](_0x154721,_0x9852('0xb')),{'transaction':_0x48893b});});});})['catch'](function(_0x3ad245){console[_0x9852('0x41')](_0x3ad245);});}exports[_0x9852('0x42')]=rewrite; \ No newline at end of file +var _0x9c54=['XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','then','intervals','findAll','IntervalId','VoiceExtension','uniq','map','exten','filter','playback','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','hasOwnProperty','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x9c54,0x120));var _0x49c5=function(_0x5bfc7a,_0x279099){_0x5bfc7a=_0x5bfc7a-0x0;var _0x129876=_0x9c54[_0x5bfc7a];return _0x129876;};'use strict';var _=require(_0x49c5('0x0'));var util=require('util');function rewrite(_0x5392b1,_0x483d8d){var _0x5518b1=this;return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x2')]['findAll']({'raw':!![]})[_0x49c5('0x3')](function(_0x1bc477){_0x5518b1[_0x49c5('0x4')]=_0x1bc477;return _0x5392b1['models']['VoiceExtension'][_0x49c5('0x5')]({'where':{'IntervalId':_0x483d8d[_0x49c5('0x6')]},'raw':!![]});})[_0x49c5('0x3')](function(_0x1072c5){return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x49c5('0x8')](_[_0x49c5('0x9')](_0x1072c5,_0x49c5('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x2dcce5){var _0x49d5c7=_[_0x49c5('0xb')](_0x2dcce5,{'priority':'1'});var _0x39584f=_[_0x49c5('0xb')](_0x2dcce5,{'isApp':0x1});var _0x39d9b9=_['groupBy'](_0x39584f,_0x49c5('0xa'));var _0x999d43=['queue',_0x49c5('0xc')];var _0x144ef9=[];var _0x5e9898=[];for(var _0x39c82d in _0x39d9b9){if(_0x39d9b9['hasOwnProperty'](_0x39c82d)){_0x5518b1[_0x49c5('0xd')]=0x2;_0x5518b1[_0x49c5('0xe')]=[];_0x5518b1[_0x49c5('0xf')]=_[_0x49c5('0x10')](_0x49d5c7,{'exten':_0x39d9b9[_0x39c82d][0x0]['exten']});_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':util[_0x49c5('0x13')](_0x49c5('0x14'),_0x39d9b9[_0x39c82d][0x0]['type']),'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});if(_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')]==='outbound'){if(_0x5518b1[_0x49c5('0xf')]){_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0]['type'],'app':_0x49c5('0x17'),'appdata':_0x49c5('0x18')+(_0x5518b1[_0x49c5('0xf')][_0x49c5('0x19')]?'${EXTEN:'+_0x5518b1['extension'][_0x49c5('0x19')]+'}':_0x49c5('0x1a')),'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});}_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0]['type'],'app':_0x49c5('0x17'),'appdata':'CDR(routeid)='+_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')],'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});var _0x59e7bc=_0x5518b1[_0x49c5('0xd')]++;_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0]['type'],'app':_0x49c5('0x1b'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x59e7bc+0x2)+_0x49c5('0x1c')+(_0x59e7bc+0x1)+')','context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x59e7bc,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});if(_0x5518b1[_0x49c5('0xf')]){_0x5518b1[_0x49c5('0xe')]['push']({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':_0x5518b1['extension']['cutdigits']?_0x49c5('0x1d')+_0x5518b1[_0x49c5('0xf')]['cutdigits']+'}':_0x49c5('0x1e'),'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});}_0x5518b1['extensions'][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x1f')+_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')],'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1['priority']++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});if(_0x5518b1[_0x49c5('0xf')]&&_0x5518b1['extension']['hasOwnProperty']('recordingFormat')&&_0x5518b1[_0x49c5('0xf')][_0x49c5('0x20')]!==_0x49c5('0x21')){_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x22'),'context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x23')+_0x5518b1['extension']['recordingFormat']||'wav','context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0]['VoiceExtensionId']});}}_0x5518b1['extensions'][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0]['exten'],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0]['VoiceExtensionId']});_0x5518b1[_0x49c5('0xe')]['push']({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'exten':_0x39d9b9[_0x39c82d][0x0]['exten'],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});_0x5518b1[_0x49c5('0xe')]['push']({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':_0x49c5('0x24'),'context':_0x39d9b9[_0x39c82d][0x0]['context'],'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'priority':_0x5518b1[_0x49c5('0xd')]++,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});for(var _0x2fdcfc=0x0,_0x1ae3d0=0x0;_0x2fdcfc<_0x39d9b9[_0x39c82d][_0x49c5('0x25')];_0x2fdcfc+=0x1,_0x1ae3d0=0x0){var _0x3b384d=_0x39d9b9[_0x39c82d][_0x2fdcfc];if(_0x3b384d[_0x49c5('0x12')]){_0x3b384d[_0x49c5('0x12')]=_0x3b384d[_0x49c5('0x12')][_0x49c5('0x26')]();}var _0x34778d=[];var _0x3b7291=[];delete _0x3b384d['id'];delete _0x3b384d[_0x49c5('0x27')];delete _0x3b384d['updatedAt'];var _0x480a72=_0x3b384d[_0x49c5('0x28')]!==_0x49c5('0x29')?[_0x3b384d[_0x49c5('0x28')]]:_0x3b384d[_0x49c5('0x6')]?_[_0x49c5('0x9')](_[_0x49c5('0xb')](_0x5518b1[_0x49c5('0x4')],{'IntervalId':_0x3b384d['IntervalId']}),_0x49c5('0x28')):[];if(_0x3b384d['hasOwnProperty']('tag')){if(_0x3b384d[_0x49c5('0x2a')]&&_0x3b384d['tag']!=='--'){_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':'Set','appdata':_0x49c5('0x2b')+_0x3b384d[_0x49c5('0x2a')],'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72[_0x49c5('0x25')]+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}}if(_0x3b384d['type']===_0x49c5('0x2c')&&_0x3b384d[_0x49c5('0x2d')](_0x49c5('0x2e'))){if(_0x3b384d['callerID']){_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x2f')+_0x3b384d[_0x49c5('0x2e')]+')','context':_0x3b384d['context'],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d[_0x49c5('0x16')]});}else{_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x30'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d['exten'],'priority':_0x480a72[_0x49c5('0x25')]+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}}if(_0x3b384d[_0x49c5('0x2d')](_0x49c5('0x31'))){if(_0x999d43[_0x49c5('0x32')](_0x3b384d[_0x49c5('0x33')][_0x49c5('0x26')]())>=0x0&&_0x3b384d[_0x49c5('0x34')]!==_0x49c5('0x35')){if(_0x3b384d[_0x49c5('0x31')]){_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x36'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d['exten'],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d['type'],'app':'Set','appdata':_0x49c5('0x37'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}else{_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x1b'),'appdata':_0x49c5('0x38'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d['exten'],'priority':_0x480a72['length']+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d[_0x49c5('0x16')]});_0x34778d[_0x49c5('0x11')]({'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x17'),'appdata':_0x49c5('0x39'),'context':_0x3b384d[_0x49c5('0x15')],'exten':_0x3b384d[_0x49c5('0xa')],'priority':_0x480a72[_0x49c5('0x25')]+_0x5518b1[_0x49c5('0xd')]+_0x1ae3d0++,'VoiceExtensionId':_0x3b384d['VoiceExtensionId']});}}}for(var _0xe635c8=0x0;_0xe635c8<_0x480a72['length'];_0xe635c8+=0x1){var _0x542e5a=_0x5518b1[_0x49c5('0xd')]+_0x480a72[_0x49c5('0x25')];var _0x395fc2=_0xe635c8===_0x480a72[_0x49c5('0x25')]-0x1?_0x5518b1[_0x49c5('0xd')]+_0x34778d[_0x49c5('0x25')]+_0x3b7291['length']+0x2:_0x5518b1[_0x49c5('0xd')]+_0xe635c8+0x1;_0x34778d[_0x49c5('0x3a')](_0xe635c8,0x0,{'type':_0x3b384d[_0x49c5('0x12')],'app':_0x49c5('0x3b'),'appdata':_0x480a72[_0xe635c8]+'?'+_0x3b384d['context']+',${EXTEN},'+_0x542e5a+':'+_0x3b384d[_0x49c5('0x15')]+_0x49c5('0x3c')+_0x395fc2,'exten':_0x3b384d['exten'],'context':_0x3b384d[_0x49c5('0x15')],'priority':_0x5518b1[_0x49c5('0xd')]+_0xe635c8,'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0]['VoiceExtensionId']});}_0x3b384d[_0x49c5('0xd')]=_0x34778d[_0x49c5('0x25')]?_[_0x49c5('0x3d')](_0x34778d)['priority']+0x1:_0x5518b1['priority'];_0x5518b1[_0x49c5('0xd')]=(_0x3b7291[_0x49c5('0x25')]?_[_0x49c5('0x3d')](_0x3b7291)['priority']:_0x3b384d[_0x49c5('0xd')])+0x1;_0x5518b1[_0x49c5('0xe')]=_['concat'](_0x5518b1[_0x49c5('0xe')],_0x34778d,[_0x3b384d],_0x3b7291);}_0x5518b1[_0x49c5('0xe')][_0x49c5('0x11')]({'type':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x12')],'app':_0x49c5('0x3e'),'exten':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0xa')],'context':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x15')],'priority':_0x5518b1[_0x49c5('0xd')],'VoiceExtensionId':_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]});_0x144ef9[_0x49c5('0x11')](_0x39d9b9[_0x39c82d][0x0][_0x49c5('0x16')]);_0x5e9898=_[_0x49c5('0x3f')](_0x5e9898,_0x5518b1['extensions']);}}return _0x5392b1['transaction'](function(_0x3ac812){return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x144ef9}},'transaction':_0x3ac812})['then'](function(_0x39775f){return _0x5392b1[_0x49c5('0x1')][_0x49c5('0x7')][_0x49c5('0x40')](_[_0x49c5('0x41')](_0x5e9898,_0x49c5('0xd')),{'transaction':_0x3ac812});});});})[_0x49c5('0x42')](function(_0xd37baa){console[_0x49c5('0x43')](_0xd37baa);});}exports[_0x49c5('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1339725..26a6b02 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x491213,_0x5f0d00){var _0x1a912c=function(_0x5dce1e){while(--_0x5dce1e){_0x491213['push'](_0x491213['shift']());}};_0x1a912c(++_0x5f0d00);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 36d980a..80d86ce 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 _0x1562=['cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','cm_contacts.ListId','insert','cm_hopper_black','createdAt','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','select',')\x20NOT\x20IN\x20?','MIN(id)','group','info','error','message','exit','errors','push','spread','main','stringify','send','binding','root','.csv','header','createReadStream','data','length','rows','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','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','CompanyId','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','each','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone'];(function(_0x1af495,_0x3f7cbe){var _0x437e6d=function(_0x140264){while(--_0x140264){_0x1af495['push'](_0x1af495['shift']());}};_0x437e6d(++_0x3f7cbe);}(_0x1562,0xe5));var _0x2156=function(_0x2f00dd,_0xd659bd){_0x2f00dd=_0x2f00dd-0x0;var _0x1bfa6c=_0x1562[_0x2f00dd];return _0x1bfa6c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x2156('0x0'));var Papa=require(_0x2156('0x1'));var util=require(_0x2156('0x2'));var BPromise=require(_0x2156('0x3'));var moment=require(_0x2156('0x4'));var squel=require(_0x2156('0x5'));var Redis=require(_0x2156('0x6'));var db=require(_0x2156('0x7'))['db'];var config=require(_0x2156('0x8'));var logger=require(_0x2156('0x9'))(_0x2156('0xa'));config[_0x2156('0xb')]=_[_0x2156('0xc')](config[_0x2156('0xb')],{'host':_0x2156('0xd'),'port':0x18eb});var socket=require(_0x2156('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2156('0xf')](_0x2156('0x10'));function isEmail(_0x4c5778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4c5778);}function selectNotIn(_0x107848,_0x118fef,_0x25f6d4,_0x4bc28b,_0x349071){return squel['select']()[_0x2156('0x11')]('phone')[_0x2156('0x12')](_0x4bc28b)[_0x2156('0x13')](_0x118fef,null,_0x118fef+'.id\x20=\x20'+_0x4bc28b+'.'+_0x25f6d4)[_0x2156('0x14')](_0x4bc28b+'.'+_0x25f6d4+'\x20=\x20'+_0x107848+'.'+_0x25f6d4)['where'](_0x118fef+_0x2156('0x15')+_0x349071['join']()+')');}function insertCmHopper(_0x1ccbb1,_0x5b84b8,_0x35d7b4,_0xd984ef,_0x45d059){var _0xbe13a7=[_0x2156('0x16'),_0x2156('0x17'),_0x2156('0x18'),'cm_contacts.ListId',_0x5b84b8+'.'+_0xd984ef,_0x2156('0x19'),_0x2156('0x1a'),_0x2156('0x1b'),_0x2156('0x1c'),'\x22'+_0x45d059+'\x22'];return squel['insert']()[_0x2156('0x1d')]('cm_hopper')[_0x2156('0x1e')]([_0x2156('0x1f'),_0x2156('0x20'),_0x2156('0x21'),_0x2156('0x22'),_0xd984ef,'createdAt',_0x2156('0x23'),'priority',_0x2156('0x24'),_0x2156('0x25')],squel['select']()[_0x2156('0x26')](_0xbe13a7)['from'](_0x5b84b8)[_0x2156('0x13')](_0x2156('0x27'),null,_0x2156('0x28')+_0x5b84b8+_0x2156('0x29'))['join'](_0x35d7b4,null,_0x35d7b4+_0x2156('0x2a')+_0x5b84b8+'.'+_0xd984ef)[_0x2156('0x14')](_0x5b84b8+_0x2156('0x2b'),_0x1ccbb1)[_0x2156('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x2156('0x14')](_0x2156('0x2c'),selectNotIn(_0x5b84b8,_0x35d7b4,_0xd984ef,'cm_hopper',[_0x2156('0x2d'),_0x2156('0x2e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5b84b8,_0x35d7b4,_0xd984ef,_0x2156('0x2f'),[_0x2156('0x2d')])))['toString']();}function insertCmHopperBlack(_0x30a8ac,_0x130687,_0x269dd9,_0xd12a76){var _0x5004e=['cm_contacts.phone',_0x2156('0x18'),_0x2156('0x30'),_0x130687+'.'+_0xd12a76,_0x2156('0x19'),_0x2156('0x1a')];return squel[_0x2156('0x31')]()[_0x2156('0x1d')](_0x2156('0x32'))['fromQuery']([_0x2156('0x1f'),_0x2156('0x21'),_0x2156('0x22'),_0xd12a76,_0x2156('0x33'),'updatedAt'],squel['select']()[_0x2156('0x26')](_0x5004e)[_0x2156('0x12')](_0x130687)[_0x2156('0x13')](_0x2156('0x27'),null,_0x2156('0x28')+_0x130687+_0x2156('0x29'))[_0x2156('0x13')](_0x269dd9,null,_0x269dd9+_0x2156('0x2a')+_0x130687+'.'+_0xd12a76)[_0x2156('0x14')](_0x130687+'.CmListId\x20=\x20?',_0x30a8ac)['where'](_0x2156('0x34'),NOW)[_0x2156('0x14')](_0x2156('0x2c'),squel['select']()[_0x2156('0x11')](_0x2156('0x1f'))['from'](_0x2156('0x32'))[_0x2156('0x14')](_0x2156('0x35'),_0x30a8ac)[_0x2156('0x14')](_0xd12a76+_0x2156('0x36'),_0x130687+'.'+_0xd12a76)))[_0x2156('0x37')]();}function insertCmContact(_0x50b048,_0x174263,_0x7516a9,_0x409b4e){var _0x2c92de=_[_0x2156('0x38')](_[_0x2156('0x39')](_0x409b4e),[_0x2156('0x22'),'CompanyId',_0x2156('0x33'),'updatedAt']);return squel[_0x2156('0x31')]()['into'](_0x2156('0x27'))[_0x2156('0x1e')](_0x2c92de,squel[_0x2156('0x3a')]()[_0x2156('0x26')](_0x2c92de)[_0x2156('0x12')](_0x174263)['where']('('+_0x7516a9[_0x2156('0x13')](',')+_0x2156('0x3b'),squel[_0x2156('0x3a')]()['fields'](_0x7516a9)['from'](_0x2156('0x27'))[_0x2156('0x14')]('ListId\x20=\x20?',_0x50b048)[_0x2156('0x14')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x2156('0x3a')]()['field'](_0x2156('0x3c'),'min_id')['from'](_0x174263)[_0x2156('0x3d')](_0x7516a9[_0x2156('0x13')](','))))[_0x2156('0x37')]();}function handleStop(){logger[_0x2156('0x3e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x233494){logger[_0x2156('0x3f')](_0x233494[_0x2156('0x40')]);process[_0x2156('0x41')](0x1);}function handleError(_0x223294,_0x8c4318){stats[_0x2156('0x42')][_0x2156('0x43')]({'name':_0x8c4318['code'],'message':_0x8c4318[_0x2156('0x40')],'row':_0x223294});}function handleQuery(_0x4764d0){logger[_0x2156('0x3e')](_0x4764d0);return db['sequelize']['query'](_0x4764d0)[_0x2156('0x44')](function(_0x3650ae){results[_0x2156('0x43')](_0x3650ae);})['catch'](function(_0x5827f9){logger[_0x2156('0x3f')](_0x5827f9['message']);});}function main(_0x406daf,_0x41111b,_0x231344,_0x52d3cd){logger[_0x2156('0x3e')](_0x2156('0x45'),_0x406daf,JSON[_0x2156('0x46')](_0x41111b));process[_0x2156('0x47')]('start');var _0x2912cb=_0x41111b[_0x2156('0x48')];var _0x5af672=_0x41111b['socket_timestamp'];var _0x1c9b38=path['join'](config[_0x2156('0x49')],'server/files/tmp',_0x5af672+_0x2156('0x4a'));var _0x112a27=_[_0x2156('0x39')](_0x2912cb)[_0x2156('0x13')]();logger[_0x2156('0x3e')](_0x2156('0x4b'),_0x112a27);fs['writeFileSync'](_0x1c9b38,_0x112a27+'\x0a');Papa['parse'](fs[_0x2156('0x4c')](_0x406daf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e1885,_0x4e0333){try{for(var _0x3d44a2=0x0,_0x44cc40=[];_0x3d44a2<_0x4e1885[_0x2156('0x4d')][_0x2156('0x4e')];_0x3d44a2++){stats[_0x2156('0x4f')]+=0x1;if(_0x4e1885[_0x2156('0x42')][_0x3d44a2]){handleError(_0x4e1885[_0x2156('0x4d')][_0x3d44a2],_0x4e1885[_0x2156('0x42')][_0x3d44a2]);}else{var _0x32680c=[];for(var _0x4a217c in _0x2912cb){if(_0x2912cb[_0x2156('0x50')](_0x4a217c)){if(_0x4e1885[_0x2156('0x4d')][_0x3d44a2][_0x2912cb[_0x4a217c]]){var _0x31e2e5=_['trim'](_0x4e1885[_0x2156('0x4d')][_0x3d44a2][_0x2912cb[_0x4a217c]][_0x2156('0x51')](/"/g,'\x27'));switch(_0x4a217c){case _0x2156('0x20'):var _0x1c53e1=moment(_0x31e2e5,_0x2156('0x10'),!![]);if(_0x1c53e1[_0x2156('0x52')]()){_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}else{_0x32680c[_0x2156('0x43')](_0x2156('0x53'));}break;case _0x2156('0x54'):var _0x1364ee=parseInt(_0x31e2e5);_0x31e2e5=_[_0x2156('0x55')](_0x1364ee)||_0x1364ee<0x0||_0x1364ee>0x4?_0x52d3cd?0x3:0x2:_0x1364ee;_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');break;case _0x2156('0x24'):var _0x5592d8=parseInt(_0x31e2e5);if(_[_0x2156('0x56')](_0x5592d8)&&_[_0x2156('0x57')](_0x231344,_0x5592d8)){_0x44cc40['push']('\x22'+_0x5592d8+'\x22');}else{_0x32680c['push'](_0x2156('0x58'));}break;case _0x2156('0x59'):if(isEmail(_0x31e2e5)){_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}else{_0x32680c['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2ae889=moment(_0x31e2e5,'YYYY-MM-DD',!![]);if(_0x2ae889[_0x2156('0x52')]()){_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}else{_0x32680c[_0x2156('0x43')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x44cc40[_0x2156('0x43')]('\x22'+_0x31e2e5+'\x22');}}else{switch(_0x4a217c){case _0x2156('0x5a'):case _0x2156('0x1f'):_0x32680c[_0x2156('0x43')](_0x4a217c+_0x2156('0x5b'));break;default:_0x44cc40[_0x2156('0x43')]('\x22\x22');}}}}if(_0x32680c['length']){handleError(_0x4e1885[_0x2156('0x4d')][_0x3d44a2],{'code':_0x2156('0x5c'),'message':_0x32680c[_0x2156('0x13')]()});}else{fs[_0x2156('0x5d')](_0x1c9b38,_0x44cc40[_0x2156('0x13')]()+'\x0a');}_0x44cc40=[];}if(!(stats[_0x2156('0x4f')]%0xc8)){socket['emit'](_0x2156('0x5e')+_0x5af672,stats);stats[_0x2156('0x42')]=[];}}if(stopped){logger[_0x2156('0x3e')](_0x2156('0x5f'));_0x4e0333[_0x2156('0x60')]();}}catch(_0x42fce3){handleError(_0x4e1885['data'][_0x3d44a2],{'code':_0x2156('0x61'),'message':_0x42fce3[_0x2156('0x40')]});logger[_0x2156('0x3f')]('step',_0x42fce3['message']);}},'complete':function(){try{var _0x213053=[];var _0x1ed053=_0x2156('0x27');if(_0x41111b['duplicates']&&_0x41111b[_0x2156('0x62')][_0x2156('0x4e')]){_0x1ed053='cm_contacts_'+_0x5af672;_0x213053['push'](_0x2156('0x63')+_0x1ed053+'\x20LIKE\x20cm_contacts;');}var _0x320f7f=util[_0x2156('0xf')](_0x2156('0x64'),_0x1c9b38,_0x1ed053,_0x112a27,_0x41111b[_0x2156('0x22')],_0x41111b[_0x2156('0x65')]||null,NOW,NOW);if(_[_0x2156('0x66')](_0x2912cb[_0x2156('0x20')])){_0x320f7f+=',\x20scheduledAt\x20=\x20NOW()';}_0x213053[_0x2156('0x43')](_0x320f7f);if(_0x41111b['duplicates']&&_0x41111b[_0x2156('0x62')][_0x2156('0x4e')]){_0x213053[_0x2156('0x43')](insertCmContact(_0x41111b[_0x2156('0x22')],_0x1ed053,_0x41111b[_0x2156('0x62')],_0x2912cb));_0x213053[_0x2156('0x43')](_0x2156('0x67')+_0x1ed053+';');}_0x213053[_0x2156('0x43')](insertCmHopper(_0x41111b[_0x2156('0x22')],_0x2156('0x68'),_0x2156('0x69'),_0x2156('0x6a'),_0x52d3cd));_0x213053[_0x2156('0x43')](insertCmHopperBlack(_0x41111b[_0x2156('0x22')],'voice_queues_has_cm_blacklists',_0x2156('0x69'),_0x2156('0x6a')));_0x213053[_0x2156('0x43')](insertCmHopper(_0x41111b['ListId'],'campaigns_has_cm_lists',_0x2156('0x6b'),_0x2156('0x6c'),_0x52d3cd));_0x213053['push'](insertCmHopperBlack(_0x41111b[_0x2156('0x22')],_0x2156('0x6d'),_0x2156('0x6b'),'CampaignId'));BPromise[_0x2156('0x6e')](_0x213053,handleQuery)['then'](function(_0x474f41){stats['finish']=!![];stats[_0x2156('0x6f')]=_0x41111b[_0x2156('0x62')]&&_0x41111b[_0x2156('0x62')][_0x2156('0x4e')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0x5af672,stats);fs[_0x2156('0x70')](_0x406daf);fs[_0x2156('0x70')](_0x1c9b38);process[_0x2156('0x41')](0x0);})[_0x2156('0x71')](function(_0x3992b8){logger[_0x2156('0x3f')](_0x3992b8[_0x2156('0x40')]);process[_0x2156('0x41')](0x1);});}catch(_0x127b44){logger['error']('complete',_0x127b44['message']);process[_0x2156('0x41')](0x1);}},'error':function(_0x5aa0b1,_0x2d96cf,_0x153a53,_0x207ac5){throw new Error(_0x207ac5);}});}function validate(){if(process[_0x2156('0x72')]&&process['argv'][_0x2156('0x4e')]<0x4){throw new Error(_0x2156('0x73'));}var _0x45fb9e=path[_0x2156('0x13')](config[_0x2156('0x49')],_0x2156('0x74'),process[_0x2156('0x72')][0x2]);if(!fs[_0x2156('0x75')](_0x45fb9e)){throw new Error(_0x2156('0x76'));}var _0x3d9096={};try{_0x3d9096=JSON[_0x2156('0x77')](process[_0x2156('0x72')][0x3]);if(!_0x3d9096[_0x2156('0x48')]){throw new Error(_0x2156('0x78'));}if(!_0x3d9096['binding'][_0x2156('0x1f')]){throw new Error(_0x2156('0x79'));}if(!_0x3d9096['binding'][_0x2156('0x5a')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3fbd4e=0x0;if(_0x3d9096['binding'][_0x2156('0x24')]){_0x3fbd4e=0x1;}if(!_0x3d9096[_0x2156('0x22')]){throw new Error(_0x2156('0x7a'));}}catch(_0x4e8e1d){throw new Error(_0x2156('0x7b'));}var _0x5e8503=[];try{_0x5e8503=_['map'](JSON[_0x2156('0x77')](process[_0x2156('0x72')][0x4]),'id');}catch(_0x3b9fbb){logger[_0x2156('0x3e')]('No\x20agent\x20available');}main(_0x45fb9e,_0x3d9096,_0x5e8503,_0x3fbd4e);}validate();process['on'](_0x2156('0x7c'),handleStop);process['on'](_0x2156('0x7d'),handleUncaughtException); \ No newline at end of file +var _0xd0d1=['affectedRows','unlink','complete','argv','existsSync','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','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','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','error','exit','errors','push','message','sequelize','query','spread','catch','main','stringify','send','start','root','server/files/tmp','.csv','header','writeFileSync','parse','length','rows','data','hasOwnProperty','trim','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','format','isNil','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish'];(function(_0xc6afa9,_0x3d98ca){var _0x3085db=function(_0xb36ba9){while(--_0xb36ba9){_0xc6afa9['push'](_0xc6afa9['shift']());}};_0x3085db(++_0x3d98ca);}(_0xd0d1,0x10e));var _0x1d0d=function(_0x34a30c,_0x4adf02){_0x34a30c=_0x34a30c-0x0;var _0x489bc7=_0xd0d1[_0x34a30c];return _0x489bc7;};'use strict';var fs=require('fs');var path=require(_0x1d0d('0x0'));var _=require(_0x1d0d('0x1'));var Papa=require(_0x1d0d('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x1d0d('0x3'));var Redis=require(_0x1d0d('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x1d0d('0x5'));var logger=require(_0x1d0d('0x6'))(_0x1d0d('0x7'));config[_0x1d0d('0x8')]=_[_0x1d0d('0x9')](config[_0x1d0d('0x8')],{'host':_0x1d0d('0xa'),'port':0x18eb});var socket=require(_0x1d0d('0xb'))(new Redis(config[_0x1d0d('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x1d0d('0xc'));function isEmail(_0x292bce){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))*$/[_0x1d0d('0xd')](_0x292bce);}function selectNotIn(_0x19a39e,_0x4ba2f1,_0xd42da6,_0x4b6771,_0x206554){return squel[_0x1d0d('0xe')]()[_0x1d0d('0xf')](_0x1d0d('0x10'))[_0x1d0d('0x11')](_0x4b6771)[_0x1d0d('0x12')](_0x4ba2f1,null,_0x4ba2f1+_0x1d0d('0x13')+_0x4b6771+'.'+_0xd42da6)[_0x1d0d('0x14')](_0x4b6771+'.'+_0xd42da6+_0x1d0d('0x15')+_0x19a39e+'.'+_0xd42da6)['where'](_0x4ba2f1+_0x1d0d('0x16')+_0x206554[_0x1d0d('0x12')]()+')');}function insertCmHopper(_0x4f4043,_0x8e63b9,_0x2741d4,_0x1a2c86,_0x534c98){var _0x4c900c=['cm_contacts.phone',_0x1d0d('0x17'),_0x1d0d('0x18'),_0x1d0d('0x19'),_0x8e63b9+'.'+_0x1a2c86,_0x1d0d('0x1a'),_0x1d0d('0x1b'),_0x1d0d('0x1c'),_0x1d0d('0x1d'),'\x22'+_0x534c98+'\x22'];return squel[_0x1d0d('0x1e')]()[_0x1d0d('0x1f')]('cm_hopper')[_0x1d0d('0x20')]([_0x1d0d('0x10'),_0x1d0d('0x21'),_0x1d0d('0x22'),_0x1d0d('0x23'),_0x1a2c86,_0x1d0d('0x24'),_0x1d0d('0x25'),_0x1d0d('0x26'),_0x1d0d('0x27'),_0x1d0d('0x28')],squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x4c900c)[_0x1d0d('0x11')](_0x8e63b9)[_0x1d0d('0x12')]('cm_contacts',null,_0x1d0d('0x2a')+_0x8e63b9+'.CmListId')[_0x1d0d('0x12')](_0x2741d4,null,_0x2741d4+_0x1d0d('0x13')+_0x8e63b9+'.'+_0x1a2c86)[_0x1d0d('0x14')](_0x8e63b9+_0x1d0d('0x2b'),_0x4f4043)[_0x1d0d('0x14')](_0x1d0d('0x2c'),NOW)['where'](_0x1d0d('0x2d'),selectNotIn(_0x8e63b9,_0x2741d4,_0x1a2c86,_0x1d0d('0x2e'),[_0x1d0d('0x2f'),_0x1d0d('0x30')]))['where'](_0x1d0d('0x2d'),selectNotIn(_0x8e63b9,_0x2741d4,_0x1a2c86,_0x1d0d('0x2e'),[_0x1d0d('0x2f')])))[_0x1d0d('0x31')]();}function insertCmHopperBlack(_0x514176,_0x5c4cd5,_0x264c29,_0x18494b){var _0x14a11f=[_0x1d0d('0x32'),_0x1d0d('0x18'),_0x1d0d('0x19'),_0x5c4cd5+'.'+_0x18494b,_0x1d0d('0x1a'),_0x1d0d('0x1b')];return squel[_0x1d0d('0x1e')]()[_0x1d0d('0x1f')](_0x1d0d('0x33'))[_0x1d0d('0x20')](['phone',_0x1d0d('0x22'),'ListId',_0x18494b,_0x1d0d('0x24'),'updatedAt'],squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x14a11f)[_0x1d0d('0x11')](_0x5c4cd5)[_0x1d0d('0x12')]('cm_contacts',null,_0x1d0d('0x2a')+_0x5c4cd5+'.CmListId')[_0x1d0d('0x12')](_0x264c29,null,_0x264c29+'.id\x20=\x20'+_0x5c4cd5+'.'+_0x18494b)['where'](_0x5c4cd5+_0x1d0d('0x2b'),_0x514176)[_0x1d0d('0x14')](_0x1d0d('0x2c'),NOW)[_0x1d0d('0x14')](_0x1d0d('0x2d'),squel[_0x1d0d('0xe')]()['field'](_0x1d0d('0x10'))[_0x1d0d('0x11')](_0x1d0d('0x33'))[_0x1d0d('0x14')](_0x1d0d('0x34'),_0x514176)[_0x1d0d('0x14')](_0x18494b+_0x1d0d('0x35'),_0x5c4cd5+'.'+_0x18494b)))[_0x1d0d('0x31')]();}function insertCmContact(_0x1ecea5,_0x253eae,_0x4d9d37,_0x51a7a0){var _0x486344=_['concat'](_[_0x1d0d('0x36')](_0x51a7a0),[_0x1d0d('0x23'),_0x1d0d('0x37'),_0x1d0d('0x24'),_0x1d0d('0x25')]);return squel[_0x1d0d('0x1e')]()['into'](_0x1d0d('0x38'))['fromQuery'](_0x486344,squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x486344)['from'](_0x253eae)[_0x1d0d('0x14')]('('+_0x4d9d37['join'](',')+_0x1d0d('0x39'),squel[_0x1d0d('0xe')]()[_0x1d0d('0x29')](_0x4d9d37)[_0x1d0d('0x11')](_0x1d0d('0x38'))['where'](_0x1d0d('0x34'),_0x1ecea5)[_0x1d0d('0x14')](_0x1d0d('0x3a')))[_0x1d0d('0x14')](_0x1d0d('0x3b'),squel[_0x1d0d('0xe')]()[_0x1d0d('0xf')]('MIN(id)',_0x1d0d('0x3c'))[_0x1d0d('0x11')](_0x253eae)['group'](_0x4d9d37['join'](','))))[_0x1d0d('0x31')]();}function handleStop(){logger[_0x1d0d('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5eeacc){logger[_0x1d0d('0x3e')](_0x5eeacc['message']);process[_0x1d0d('0x3f')](0x1);}function handleError(_0x3b35b2,_0x49fef8){stats[_0x1d0d('0x40')][_0x1d0d('0x41')]({'name':_0x49fef8['code'],'message':_0x49fef8[_0x1d0d('0x42')],'row':_0x3b35b2});}function handleQuery(_0x3d5418){logger['info'](_0x3d5418);return db[_0x1d0d('0x43')][_0x1d0d('0x44')](_0x3d5418)[_0x1d0d('0x45')](function(_0x160b99){results[_0x1d0d('0x41')](_0x160b99);})[_0x1d0d('0x46')](function(_0x3b3084){logger[_0x1d0d('0x3e')](_0x3b3084[_0x1d0d('0x42')]);});}function main(_0x3191ab,_0x18cd97,_0x43d6d7,_0x2ec020){logger['info'](_0x1d0d('0x47'),_0x3191ab,JSON[_0x1d0d('0x48')](_0x18cd97));process[_0x1d0d('0x49')](_0x1d0d('0x4a'));var _0x24f077=_0x18cd97['binding'];var _0x3942b6=_0x18cd97['socket_timestamp'];var _0x19b99c=path[_0x1d0d('0x12')](config[_0x1d0d('0x4b')],_0x1d0d('0x4c'),_0x3942b6+_0x1d0d('0x4d'));var _0x1a6f7b=_[_0x1d0d('0x36')](_0x24f077)['join']();logger[_0x1d0d('0x3d')](_0x1d0d('0x4e'),_0x1a6f7b);fs[_0x1d0d('0x4f')](_0x19b99c,_0x1a6f7b+'\x0a');Papa[_0x1d0d('0x50')](fs['createReadStream'](_0x3191ab),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ed5d6,_0x3f2ebd){try{for(var _0x4b7612=0x0,_0x1265d2=[];_0x4b7612<_0x5ed5d6['data'][_0x1d0d('0x51')];_0x4b7612++){stats[_0x1d0d('0x52')]+=0x1;if(_0x5ed5d6['errors'][_0x4b7612]){handleError(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612],_0x5ed5d6[_0x1d0d('0x40')][_0x4b7612]);}else{var _0x192e88=[];for(var _0x5eb28a in _0x24f077){if(_0x24f077[_0x1d0d('0x54')](_0x5eb28a)){if(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612][_0x24f077[_0x5eb28a]]){var _0x327f11=_[_0x1d0d('0x55')](_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612][_0x24f077[_0x5eb28a]]['replace'](/"/g,'\x27'));switch(_0x5eb28a){case _0x1d0d('0x21'):var _0x3bdca6=moment(_0x327f11,_0x1d0d('0xc'),!![]);if(_0x3bdca6[_0x1d0d('0x56')]()){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}else{_0x192e88[_0x1d0d('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3a5a7d=parseInt(_0x327f11);_0x327f11=_[_0x1d0d('0x57')](_0x3a5a7d)||_0x3a5a7d<0x0||_0x3a5a7d>0x4?_0x2ec020?0x3:0x2:_0x3a5a7d;_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');break;case _0x1d0d('0x27'):var _0x3ca315=parseInt(_0x327f11);if(_[_0x1d0d('0x58')](_0x3ca315)&&_[_0x1d0d('0x59')](_0x43d6d7,_0x3ca315)){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x3ca315+'\x22');}else{_0x192e88[_0x1d0d('0x41')](_0x1d0d('0x5a'));}break;case _0x1d0d('0x5b'):if(isEmail(_0x327f11)){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}else{_0x192e88['push'](_0x1d0d('0x5c'));}break;case'dateOfBirth':var _0x4b7d7=moment(_0x327f11,_0x1d0d('0x5d'),!![]);if(_0x4b7d7[_0x1d0d('0x56')]()){_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}else{_0x192e88['push'](_0x1d0d('0x5e'));}break;default:_0x1265d2[_0x1d0d('0x41')]('\x22'+_0x327f11+'\x22');}}else{switch(_0x5eb28a){case'firstName':case'phone':_0x192e88['push'](_0x5eb28a+'\x20not\x20specified');break;default:_0x1265d2[_0x1d0d('0x41')]('\x22\x22');}}}}if(_0x192e88[_0x1d0d('0x51')]){handleError(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612],{'code':'SystemRow','message':_0x192e88[_0x1d0d('0x12')]()});}else{fs[_0x1d0d('0x5f')](_0x19b99c,_0x1265d2[_0x1d0d('0x12')]()+'\x0a');}_0x1265d2=[];}if(!(stats['rows']%0xc8)){socket[_0x1d0d('0x60')](_0x1d0d('0x61')+_0x3942b6,stats);stats[_0x1d0d('0x40')]=[];}}if(stopped){logger[_0x1d0d('0x3d')](_0x1d0d('0x62'));_0x3f2ebd['abort']();}}catch(_0x5d4e6e){handleError(_0x5ed5d6[_0x1d0d('0x53')][_0x4b7612],{'code':_0x1d0d('0x63'),'message':_0x5d4e6e['message']});logger[_0x1d0d('0x3e')](_0x1d0d('0x64'),_0x5d4e6e[_0x1d0d('0x42')]);}},'complete':function(){try{var _0x4dfb45=[];var _0x45f035=_0x1d0d('0x38');if(_0x18cd97['duplicates']&&_0x18cd97[_0x1d0d('0x65')]['length']){_0x45f035=_0x1d0d('0x66')+_0x3942b6;_0x4dfb45[_0x1d0d('0x41')](_0x1d0d('0x67')+_0x45f035+'\x20LIKE\x20cm_contacts;');}var _0x3d499f=util[_0x1d0d('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',_0x19b99c,_0x45f035,_0x1a6f7b,_0x18cd97[_0x1d0d('0x23')],_0x18cd97[_0x1d0d('0x37')]||null,NOW,NOW);if(_[_0x1d0d('0x69')](_0x24f077['scheduledat'])){_0x3d499f+=',\x20scheduledAt\x20=\x20NOW()';}_0x4dfb45[_0x1d0d('0x41')](_0x3d499f);if(_0x18cd97[_0x1d0d('0x65')]&&_0x18cd97[_0x1d0d('0x65')][_0x1d0d('0x51')]){_0x4dfb45[_0x1d0d('0x41')](insertCmContact(_0x18cd97[_0x1d0d('0x23')],_0x45f035,_0x18cd97[_0x1d0d('0x65')],_0x24f077));_0x4dfb45['push']('DROP\x20TABLE\x20'+_0x45f035+';');}_0x4dfb45[_0x1d0d('0x41')](insertCmHopper(_0x18cd97[_0x1d0d('0x23')],_0x1d0d('0x6a'),_0x1d0d('0x6b'),_0x1d0d('0x6c'),_0x2ec020));_0x4dfb45['push'](insertCmHopperBlack(_0x18cd97[_0x1d0d('0x23')],_0x1d0d('0x6d'),_0x1d0d('0x6b'),_0x1d0d('0x6c')));_0x4dfb45[_0x1d0d('0x41')](insertCmHopper(_0x18cd97['ListId'],_0x1d0d('0x6e'),_0x1d0d('0x6f'),_0x1d0d('0x70'),_0x2ec020));_0x4dfb45[_0x1d0d('0x41')](insertCmHopperBlack(_0x18cd97[_0x1d0d('0x23')],_0x1d0d('0x71'),_0x1d0d('0x6f'),_0x1d0d('0x70')));BPromise[_0x1d0d('0x72')](_0x4dfb45,handleQuery)[_0x1d0d('0x73')](function(_0x4dbc38){stats[_0x1d0d('0x74')]=!![];stats[_0x1d0d('0x75')]=_0x18cd97[_0x1d0d('0x65')]&&_0x18cd97['duplicates'][_0x1d0d('0x51')]?results[0x2][_0x1d0d('0x75')]:results[0x0][_0x1d0d('0x75')];socket[_0x1d0d('0x60')]('contact:import:'+_0x3942b6,stats);fs[_0x1d0d('0x76')](_0x3191ab);fs[_0x1d0d('0x76')](_0x19b99c);process[_0x1d0d('0x3f')](0x0);})[_0x1d0d('0x46')](function(_0x5cb9b4){logger[_0x1d0d('0x3e')](_0x5cb9b4[_0x1d0d('0x42')]);process[_0x1d0d('0x3f')](0x1);});}catch(_0x4ab86a){logger[_0x1d0d('0x3e')](_0x1d0d('0x77'),_0x4ab86a[_0x1d0d('0x42')]);process[_0x1d0d('0x3f')](0x1);}},'error':function(_0x52ba2e,_0x453cff,_0x23c8be,_0x47cc79){throw new Error(_0x47cc79);}});}function validate(){if(process[_0x1d0d('0x78')]&&process[_0x1d0d('0x78')][_0x1d0d('0x51')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0xf237db=path[_0x1d0d('0x12')](config[_0x1d0d('0x4b')],_0x1d0d('0x4c'),process[_0x1d0d('0x78')][0x2]);if(!fs[_0x1d0d('0x79')](_0xf237db)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1a81a4={};try{_0x1a81a4=JSON[_0x1d0d('0x50')](process['argv'][0x3]);if(!_0x1a81a4[_0x1d0d('0x7a')]){throw new Error(_0x1d0d('0x7b'));}if(!_0x1a81a4['binding'][_0x1d0d('0x10')]){throw new Error(_0x1d0d('0x7c'));}if(!_0x1a81a4[_0x1d0d('0x7a')][_0x1d0d('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x385872=0x0;if(_0x1a81a4['binding'][_0x1d0d('0x27')]){_0x385872=0x1;}if(!_0x1a81a4[_0x1d0d('0x23')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xc0c9d){throw new Error(_0x1d0d('0x7e'));}var _0x38433e=[];try{_0x38433e=_['map'](JSON[_0x1d0d('0x50')](process[_0x1d0d('0x78')][0x4]),'id');}catch(_0x2f470a){logger[_0x1d0d('0x3d')](_0x1d0d('0x7f'));}main(_0xf237db,_0x1a81a4,_0x38433e,_0x385872);}validate();process['on']('SIGINT',handleStop);process['on'](_0x1d0d('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index bda685d..c83367f 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 _0xe526=['file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','cm_contacts_temp_','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','catch','error','message','split','all','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','CmContact','then','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','from','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(?)','cm_contacts.phone','cm_contacts.createdAt','into','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','toString','concat','keys','CompanyId','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','code','send','start','binding','clone','socket_timestamp','root','.csv','body','findAll','name','header','writeFileSync','rows','errors','data','find','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','replace','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync'];(function(_0x431ac5,_0x5e319f){var _0x235779=function(_0x44cbed){while(--_0x44cbed){_0x431ac5['push'](_0x431ac5['shift']());}};_0x235779(++_0x5e319f);}(_0xe526,0x13f));var _0x6e52=function(_0x6fa1a8,_0x5c1f5b){_0x6fa1a8=_0x6fa1a8-0x0;var _0x2d21db=_0xe526[_0x6fa1a8];return _0x2d21db;};'use strict';var fs=require('fs');var path=require(_0x6e52('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x6e52('0x1'));var BPromise=require('bluebird');var moment=require(_0x6e52('0x2'));var squel=require(_0x6e52('0x3'));var Redis=require(_0x6e52('0x4'));var db=require(_0x6e52('0x5'))['db'];var config=require(_0x6e52('0x6'));var logger=require(_0x6e52('0x7'))(_0x6e52('0x8'));config[_0x6e52('0x9')]=_[_0x6e52('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6e52('0xb'))(new Redis(config[_0x6e52('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x6e52('0xc')+moment()[_0x6e52('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x19e1f3){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))*$/[_0x6e52('0xe')](_0x19e1f3);}function selectNotIn(_0x464ccf,_0x53e25e,_0x448c42,_0x569a66,_0x52c6c7){return squel[_0x6e52('0xf')]()[_0x6e52('0x10')](_0x6e52('0x11'))['from'](_0x569a66)[_0x6e52('0x12')](_0x53e25e,null,_0x53e25e+_0x6e52('0x13')+_0x569a66+'.'+_0x448c42)[_0x6e52('0x14')](_0x569a66+'.'+_0x448c42+_0x6e52('0x15')+_0x464ccf+'.'+_0x448c42)[_0x6e52('0x14')](_0x53e25e+_0x6e52('0x16')+_0x52c6c7[_0x6e52('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3652f8,_0x8ebc1a){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6e52('0x17')][_0x6e52('0x18')](_0x6e52('0x19')+tempTableName)[_0x6e52('0x1a')](function(_0x58819){if(_0x58819!==null){var _0x7420d4=[];for(var _0x512251=0x0;_0x512251<_0x58819[_0x6e52('0x1b')];_0x512251++){var _0x2adc8a=_0x58819[_0x512251];if(!_[_0x6e52('0x1c')](_0x2adc8a[_0x6e52('0x11')])){if(!_['isNil'](_0x2adc8a[_0x6e52('0x1d')]))_0x7420d4['push'](insertAdditionalPhones(_0x2adc8a));promisesContact[_0x6e52('0x1e')]({'contact':_0x2adc8a});}}}Promise['all'](_0x7420d4)['then'](function(){_0x3652f8({'val':0x1});});})[_0x6e52('0x1f')](function(_0x4dc8dc){logger[_0x6e52('0x20')](_0x4dc8dc[_0x6e52('0x21')]);});});}function insertAdditionalPhones(_0x3800fe){return new Promise(function(_0x16b31d,_0x9b6809){var _0x4f1822=_0x3800fe['AdditionalPhones'];if(_[_0x6e52('0x1c')](_0x4f1822))_0x9b6809({'val':0x0});else{var _0x5276b6=_0x4f1822[_0x6e52('0x22')](';');var _0x56b083=[];orderBy=0x0;for(var _0x13b4a9=0x0;_0x13b4a9<_0x5276b6[_0x6e52('0x1b')];_0x13b4a9++){_0x56b083[_0x6e52('0x1e')](splitAdditionalPhone(_0x3800fe['id'],_0x5276b6[_0x13b4a9]));}Promise[_0x6e52('0x23')](_0x56b083)['then'](function(){_0x16b31d({'val':_0x5276b6[_0x6e52('0x1b')]});});}});}function splitAdditionalPhone(_0x423619,_0x16c85b){return new Promise(function(_0x5ebaa1,_0x2c6859){var _0x270ddb=_0x16c85b['split'](':');var _0x5bf822=_0x270ddb[0x0];var _0x335cc3=_0x270ddb[0x1];if(_0x335cc3!==''){var _0x55e012=_0x335cc3[_0x6e52('0x22')]('|');var _0x36b4a2=[];for(var _0x2d49a1=0x0;_0x2d49a1<_0x55e012[_0x6e52('0x1b')];_0x2d49a1++){if(_0x55e012[_0x2d49a1]!==''){var _0x5202af=_[_0x6e52('0x24')](promisesAdditionalPhones,{'contactId':_0x423619,'phone':_0x55e012[_0x2d49a1]});if(_0x5202af[_0x6e52('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x423619,'contactTypeId':_0x5bf822,'phone':_0x55e012[_0x2d49a1],'orderBy':orderBy});}}}_0x5ebaa1({'ok':0x1});}else _0x5ebaa1({'res':0x0});});}function createAdditionalPhone(_0x3433d7,_0x4f8cbc,_0x5b0cc2,_0x297a40){return new Promise(function(_0x35ef37,_0x41c3f4){return db[_0x6e52('0x25')][_0x6e52('0x26')]({'where':{'CmContactId':_0x3433d7,'item':_0x5b0cc2}})['then'](function(_0x515003){if(_0x515003){return db[_0x6e52('0x25')][_0x6e52('0x27')]({'ItemTypeId':_0x4f8cbc,'OrderBy':_0x297a40},{'where':{'CmContactId':_0x3433d7,'item':_0x5b0cc2}})['then'](function(_0x9d8878){_0x35ef37({'res':_0x6e52('0x28')});});}else{return db[_0x6e52('0x25')]['create']({'CmContactId':_0x3433d7,'item':_0x5b0cc2,'ItemTypeId':_0x4f8cbc,'OrderBy':_0x297a40,'ItemClass':_0x6e52('0x29')})['then'](function(_0x402ebc){_0x35ef37({'res':_0x6e52('0x2a')});});}});});}function updateContact(_0x1ab565){return new Promise(function(_0x5d4cb5,_0x24abb5){var _0x1836f5=_0x1ab565['id'];delete _0x1ab565['id'];return db[_0x6e52('0x2b')][_0x6e52('0x27')](_0x1ab565,{'where':{'id':_0x1836f5}})[_0x6e52('0x2c')](function(_0xdfcc1){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x1ab565['phone']},{'where':{'ContactId':_0x1836f5}})[_0x6e52('0x2c')](function(_0x248cc9){_0x5d4cb5({'ret':'OK'});});});});}function insertCmHopper(_0x52813,_0x4f5349,_0x246df6,_0x493f74,_0x5596ee){var _0x5a3c42=['cm_contacts.phone','cm_contacts.scheduledat',_0x6e52('0x2d'),_0x6e52('0x2e'),_0x4f5349+'.'+_0x493f74,'cm_contacts.createdAt',_0x6e52('0x2f'),_0x6e52('0x30'),_0x6e52('0x31'),'\x22'+_0x5596ee+'\x22'];return squel[_0x6e52('0x32')]()['into'](_0x6e52('0x33'))[_0x6e52('0x34')]([_0x6e52('0x11'),_0x6e52('0x35'),_0x6e52('0x36'),_0x6e52('0x37'),_0x493f74,_0x6e52('0x38'),_0x6e52('0x39'),_0x6e52('0x3a'),'UserId',_0x6e52('0x3b')],squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0x5a3c42)[_0x6e52('0x3d')](_0x4f5349)[_0x6e52('0x12')](_0x6e52('0x3e'),null,_0x6e52('0x3f')+_0x4f5349+_0x6e52('0x40'))[_0x6e52('0x12')](_0x246df6,null,_0x246df6+_0x6e52('0x13')+_0x4f5349+'.'+_0x493f74)['where'](_0x4f5349+_0x6e52('0x41'),_0x52813)[_0x6e52('0x14')](_0x6e52('0x42'),NOW)[_0x6e52('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f5349,_0x246df6,_0x493f74,_0x6e52('0x33'),[_0x6e52('0x43'),_0x6e52('0x44')]))[_0x6e52('0x14')](_0x6e52('0x45'),selectNotIn(_0x4f5349,_0x246df6,_0x493f74,_0x6e52('0x33'),[_0x6e52('0x43')])))['toString']();}function insertCmHopperBlack(_0x4945f7,_0x531027,_0x109da5,_0x1cf810){var _0x438943=[_0x6e52('0x46'),_0x6e52('0x2d'),'cm_contacts.ListId',_0x531027+'.'+_0x1cf810,_0x6e52('0x47'),'cm_contacts.updatedAt'];return squel[_0x6e52('0x32')]()[_0x6e52('0x48')]('cm_hopper_black')[_0x6e52('0x34')](['phone',_0x6e52('0x36'),_0x6e52('0x37'),_0x1cf810,'createdAt','updatedAt'],squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0x438943)[_0x6e52('0x3d')](_0x531027)[_0x6e52('0x12')](_0x6e52('0x3e'),null,_0x6e52('0x3f')+_0x531027+_0x6e52('0x40'))[_0x6e52('0x12')](_0x109da5,null,_0x109da5+_0x6e52('0x13')+_0x531027+'.'+_0x1cf810)[_0x6e52('0x14')](_0x531027+_0x6e52('0x41'),_0x4945f7)['where'](_0x6e52('0x42'),NOW)[_0x6e52('0x14')](_0x6e52('0x45'),squel[_0x6e52('0xf')]()[_0x6e52('0x10')]('phone')[_0x6e52('0x3d')](_0x6e52('0x49'))[_0x6e52('0x14')](_0x6e52('0x4a'),_0x4945f7)[_0x6e52('0x14')](_0x1cf810+_0x6e52('0x4b'),_0x531027+'.'+_0x1cf810)))['toString']();}function insertCmHopperAdditionalPhones(_0x1d5125){var _0x13a338=[_0x6e52('0x4c'),_0x6e52('0x4d'),'cm_contact_has_items.OrderBy',_0x6e52('0x4e'),_0x6e52('0x4f')];return squel[_0x6e52('0x32')]()[_0x6e52('0x48')](_0x6e52('0x50'))[_0x6e52('0x34')]([_0x6e52('0x51'),_0x6e52('0x11'),_0x6e52('0x52'),'createdAt',_0x6e52('0x39')],squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0x13a338)[_0x6e52('0x3d')]('cm_hopper')['join'](_0x6e52('0x3e'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x6e52('0x53'),null,_0x6e52('0x54'))[_0x6e52('0x14')](_0x6e52('0x55'),_0x1d5125)[_0x6e52('0x14')](_0x6e52('0x42'),NOW))[_0x6e52('0x56')]();}function insertCmContact(_0x19e2cd,_0x153106,_0x176119,_0x1bf210){var _0xe46cf2=_[_0x6e52('0x57')](_[_0x6e52('0x58')](_0x1bf210),[_0x6e52('0x37'),_0x6e52('0x59'),_0x6e52('0x38'),_0x6e52('0x39')]);return squel['insert']()[_0x6e52('0x48')]('cm_contacts')[_0x6e52('0x34')](_0xe46cf2,squel[_0x6e52('0xf')]()[_0x6e52('0x3c')](_0xe46cf2)['from'](_0x153106)[_0x6e52('0x14')]('('+_0x176119['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x6e52('0x3c')](_0x176119)[_0x6e52('0x3d')](_0x6e52('0x3e'))[_0x6e52('0x14')](_0x6e52('0x4a'),_0x19e2cd))[_0x6e52('0x14')]('id\x20IN\x20?',squel['select']()[_0x6e52('0x10')](_0x6e52('0x5a'),_0x6e52('0x5b'))[_0x6e52('0x3d')](_0x153106)[_0x6e52('0x5c')](_0x176119[_0x6e52('0x12')](','))))['toString']();}function handleStop(){logger[_0x6e52('0x5d')](_0x6e52('0x5e'));stopped=!![];}function handleUncaughtException(_0x5a8690){logger['error'](_0x5a8690[_0x6e52('0x21')]);process[_0x6e52('0x5f')](0x1);}function handleError(_0x328337,_0x2c5083){stats['errors']['push']({'name':_0x2c5083[_0x6e52('0x60')],'message':_0x2c5083[_0x6e52('0x21')],'row':_0x328337});}function handleQuery(_0x4b3588){logger[_0x6e52('0x5d')](_0x4b3588);return db['sequelize'][_0x6e52('0x18')](_0x4b3588)['spread'](function(_0x406609){results['push'](_0x406609);})[_0x6e52('0x1f')](function(_0x19092b){logger['error'](_0x19092b[_0x6e52('0x21')]);});}function main(_0x187eb2,_0x4f7ff6,_0x5aa9c4,_0x3b0a22){logger[_0x6e52('0x5d')]('main',_0x187eb2,JSON['stringify'](_0x4f7ff6));process[_0x6e52('0x61')](_0x6e52('0x62'));var _0x5addc1=_0x4f7ff6[_0x6e52('0x63')];var _0x171533=_[_0x6e52('0x64')](_0x5addc1);var _0x5af20d=_0x4f7ff6[_0x6e52('0x65')];var _0x1d8390=path['join'](config[_0x6e52('0x66')],'server/files/tmp',_0x5af20d+_0x6e52('0x67'));logger[_0x6e52('0x5d')](_0x6e52('0x68'),_0x4f7ff6);db['ContactItemType'][_0x6e52('0x69')]({'raw':!![],'attributes':['id','name']})[_0x6e52('0x2c')](function(_0x4114c6){for(var _0x2b0a29=0x0;_0x2b0a29<_0x4114c6[_0x6e52('0x1b')];_0x2b0a29++){if(_0x4114c6[_0x2b0a29][_0x6e52('0x6a')]in _0x5addc1){contactItemTypes[_0x6e52('0x1e')](_0x4114c6[_0x2b0a29]);delete _0x171533[_0x4114c6[_0x2b0a29]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x171533['AdditionalPhones']='';var _0x377b88=_[_0x6e52('0x58')](_0x171533)[_0x6e52('0x12')]();logger[_0x6e52('0x5d')](_0x6e52('0x6b'),_0x377b88);fs[_0x6e52('0x6c')](_0x1d8390,_0x377b88+'\x0a');Papa['parse'](fs['createReadStream'](_0x187eb2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5a9125,_0x3a3af2){try{for(var _0x155631=0x0,_0x260f41=[];_0x155631<_0x5a9125['data'][_0x6e52('0x1b')];_0x155631++){stats[_0x6e52('0x6d')]+=0x1;if(_0x5a9125[_0x6e52('0x6e')][_0x155631]){handleError(_0x5a9125[_0x6e52('0x6f')][_0x155631],_0x5a9125[_0x6e52('0x6e')][_0x155631]);}else{var _0x85570c=[];var _0x215369=[];for(var _0x34921d in _0x5addc1){let _0x4fd423=contactItemTypes[_0x6e52('0x70')](_0x26988c=>_0x26988c[_0x6e52('0x6a')]===_0x34921d);if(_[_0x6e52('0x1c')](_0x4fd423)){if(_0x5addc1[_0x6e52('0x71')](_0x34921d)){if(_0x5a9125[_0x6e52('0x6f')][_0x155631][_0x5addc1[_0x34921d]]){var _0x2618dd=_['trim'](_0x5a9125[_0x6e52('0x6f')][_0x155631][_0x5addc1[_0x34921d]]['replace'](/"/g,'\x27'));switch(_0x34921d){case _0x6e52('0x35'):var _0x421bce=moment(_0x2618dd,_0x6e52('0x72'),!![]);if(_0x421bce[_0x6e52('0x73')]()){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}else{_0x85570c['push'](_0x6e52('0x74'));}break;case _0x6e52('0x3a'):var _0x15010d=parseInt(_0x2618dd);_0x2618dd=_['isNaN'](_0x15010d)||_0x15010d<0x0||_0x15010d>0x4?_0x3b0a22?0x3:0x2:_0x15010d;_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');break;case _0x6e52('0x75'):var _0x3a92bc=parseInt(_0x2618dd);if(_[_0x6e52('0x76')](_0x3a92bc)&&_[_0x6e52('0x77')](_0x5aa9c4,_0x3a92bc)){_0x260f41['push']('\x22'+_0x3a92bc+'\x22');}else{_0x85570c[_0x6e52('0x1e')](_0x6e52('0x78'));}break;case'email':if(isEmail(_0x2618dd)){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}else{_0x85570c[_0x6e52('0x1e')](_0x6e52('0x79'));}break;case _0x6e52('0x7a'):var _0x4edbb5=moment(_0x2618dd,_0x6e52('0x7b'),!![]);if(_0x4edbb5[_0x6e52('0x73')]()){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}else{_0x85570c[_0x6e52('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x260f41[_0x6e52('0x1e')]('\x22'+_0x2618dd+'\x22');}}else{switch(_0x34921d){case'firstName':case'phone':_0x85570c[_0x6e52('0x1e')](_0x34921d+'\x20not\x20specified');break;default:_0x260f41[_0x6e52('0x1e')]('\x22\x22');}}}}else{var _0x16dac4='';for(var _0x5dc556=0x0;_0x5dc556<_0x5addc1[_0x34921d][_0x6e52('0x1b')];_0x5dc556++){var _0x2618dd=_['trim'](_0x5a9125[_0x6e52('0x6f')][_0x155631][_0x5addc1[_0x34921d][_0x5dc556]][_0x6e52('0x7c')](/"/g,'\x27'));if(_0x16dac4=='')_0x16dac4=_0x2618dd;else _0x16dac4+='|'+_0x2618dd;}_0x215369[_0x6e52('0x1e')](_0x4fd423['id']+':'+_0x16dac4);}}if(hasAdditionalPhones){_0x260f41[_0x6e52('0x1e')]('\x22'+_0x215369[_0x6e52('0x12')](';')+'\x22');}if(_0x85570c[_0x6e52('0x1b')]){handleError(_0x5a9125[_0x6e52('0x6f')][_0x155631],{'code':_0x6e52('0x7d'),'message':_0x85570c[_0x6e52('0x12')]()});}else{fs[_0x6e52('0x7e')](_0x1d8390,_0x260f41[_0x6e52('0x12')]()+'\x0a');}_0x260f41=[];}if(!(stats[_0x6e52('0x6d')]%0xc8)){socket[_0x6e52('0x7f')](_0x6e52('0x80')+_0x5af20d,stats);stats[_0x6e52('0x6e')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x3a3af2[_0x6e52('0x81')]();}}catch(_0x13d953){handleError(_0x5a9125[_0x6e52('0x6f')][_0x155631],{'code':_0x6e52('0x82'),'message':_0x13d953[_0x6e52('0x21')]});logger['error'](_0x6e52('0x83'),_0x13d953[_0x6e52('0x21')]);}},'complete':function(){try{var _0x2c95cc=[];var _0x348466=tempTableName;_0x2c95cc[_0x6e52('0x1e')](_0x6e52('0x84')+_0x348466+_0x6e52('0x85'));logger[_0x6e52('0x5d')](_0x6e52('0x86'),contactItemTypes[_0x6e52('0x1b')]);var _0x48e70a=util[_0x6e52('0xd')](_0x6e52('0x87'),_0x1d8390,_0x348466,_0x377b88,_0x4f7ff6[_0x6e52('0x37')],_0x4f7ff6[_0x6e52('0x59')]||null,NOW,NOW);if(_[_0x6e52('0x1c')](_0x5addc1[_0x6e52('0x35')])){_0x48e70a+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c95cc['push'](_0x48e70a);BPromise[_0x6e52('0x88')](_0x2c95cc,handleQuery)[_0x6e52('0x2c')](function(_0x2e593){BPromise['all']([handleAdditionalPhones()])[_0x6e52('0x2c')](function(){_0x2c95cc=[];for(var _0x1650c3=0x0;_0x1650c3\x20\x20','root','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','phone','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.createdAt','insert','fromQuery','updatedAt','cm_contacts','.CmListId','field','cm_hopper_black','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','message','exit','errors','code','spread','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','name','writeFileSync','parse','data','find','trim','scheduledat','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)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','each','contact','contactId','contactTypeId','DROP\x20TABLE\x20','finish'];(function(_0x2e9ac6,_0x3533bb){var _0x4de1ad=function(_0x296370){while(--_0x296370){_0x2e9ac6['push'](_0x2e9ac6['shift']());}};_0x4de1ad(++_0x3533bb);}(_0xd5a7,0x13a));var _0x7d5a=function(_0xc0997a,_0x208380){_0xc0997a=_0xc0997a-0x0;var _0xb9770d=_0xd5a7[_0xc0997a];return _0xb9770d;};'use strict';var fs=require('fs');var path=require(_0x7d5a('0x0'));var _=require(_0x7d5a('0x1'));var Papa=require(_0x7d5a('0x2'));var util=require(_0x7d5a('0x3'));var BPromise=require(_0x7d5a('0x4'));var moment=require(_0x7d5a('0x5'));var squel=require(_0x7d5a('0x6'));var Redis=require(_0x7d5a('0x7'));var db=require(_0x7d5a('0x8'))['db'];var config=require(_0x7d5a('0x9'));var logger=require('../../../config/logger')('import');config[_0x7d5a('0xa')]=_[_0x7d5a('0xb')](config[_0x7d5a('0xa')],{'host':_0x7d5a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d5a('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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x7d5a('0xd')+moment()[_0x7d5a('0xe')](_0x7d5a('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x21d1c9){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))*$/[_0x7d5a('0x10')](_0x21d1c9);}function selectNotIn(_0x2706e0,_0xa99fe9,_0x404c01,_0x174bf3,_0x9d1d51){return squel[_0x7d5a('0x11')]()['field'](_0x7d5a('0x12'))[_0x7d5a('0x13')](_0x174bf3)['join'](_0xa99fe9,null,_0xa99fe9+_0x7d5a('0x14')+_0x174bf3+'.'+_0x404c01)['where'](_0x174bf3+'.'+_0x404c01+_0x7d5a('0x15')+_0x2706e0+'.'+_0x404c01)[_0x7d5a('0x16')](_0xa99fe9+_0x7d5a('0x17')+_0x9d1d51[_0x7d5a('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x328fe7,_0x45f45f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7d5a('0x19')][_0x7d5a('0x1a')](_0x7d5a('0x1b')+tempTableName)['spread'](function(_0x10dc38){if(_0x10dc38!==null){var _0x16a6d8=[];for(var _0x31d36c=0x0;_0x31d36c<_0x10dc38[_0x7d5a('0x1c')];_0x31d36c++){var _0x983929=_0x10dc38[_0x31d36c];if(!_[_0x7d5a('0x1d')](_0x983929[_0x7d5a('0x12')])){if(!_[_0x7d5a('0x1d')](_0x983929[_0x7d5a('0x1e')]))_0x16a6d8['push'](insertAdditionalPhones(_0x983929));promisesContact[_0x7d5a('0x1f')]({'contact':_0x983929});}}}Promise[_0x7d5a('0x20')](_0x16a6d8)[_0x7d5a('0x21')](function(){_0x328fe7({'val':0x1});});})[_0x7d5a('0x22')](function(_0x56aead){logger[_0x7d5a('0x23')](_0x56aead['message']);});});}function insertAdditionalPhones(_0x4bba2b){return new Promise(function(_0x515a3c,_0x4e350d){var _0x5f1ed3=_0x4bba2b[_0x7d5a('0x1e')];if(_[_0x7d5a('0x1d')](_0x5f1ed3))_0x4e350d({'val':0x0});else{var _0x521a7b=_0x5f1ed3[_0x7d5a('0x24')](';');var _0x1dfbd7=[];orderBy=0x0;for(var _0x1a20fa=0x0;_0x1a20fa<_0x521a7b[_0x7d5a('0x1c')];_0x1a20fa++){_0x1dfbd7['push'](splitAdditionalPhone(_0x4bba2b['id'],_0x521a7b[_0x1a20fa]));}Promise[_0x7d5a('0x20')](_0x1dfbd7)['then'](function(){_0x515a3c({'val':_0x521a7b[_0x7d5a('0x1c')]});});}});}function splitAdditionalPhone(_0x54e1b6,_0xe97454){return new Promise(function(_0x28613e,_0xcfd72d){var _0x4a77e6=_0xe97454[_0x7d5a('0x24')](':');var _0x192195=_0x4a77e6[0x0];var _0x12ec3a=_0x4a77e6[0x1];if(_0x12ec3a!==''){var _0x38c0c3=_0x12ec3a['split']('|');var _0x3e1345=[];for(var _0x199d6f=0x0;_0x199d6f<_0x38c0c3[_0x7d5a('0x1c')];_0x199d6f++){if(_0x38c0c3[_0x199d6f]!==''){var _0x32946a=_[_0x7d5a('0x25')](promisesAdditionalPhones,{'contactId':_0x54e1b6,'phone':_0x38c0c3[_0x199d6f]});if(_0x32946a[_0x7d5a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x7d5a('0x1f')]({'contactId':_0x54e1b6,'contactTypeId':_0x192195,'phone':_0x38c0c3[_0x199d6f],'orderBy':orderBy});}}}_0x28613e({'ok':0x1});}else _0x28613e({'res':0x0});});}function createAdditionalPhone(_0x5e10ae,_0x249913,_0x9449c8,_0x10c9ff){return new Promise(function(_0x3c2133,_0x264e65){return db[_0x7d5a('0x26')]['findOne']({'where':{'CmContactId':_0x5e10ae,'item':_0x9449c8}})[_0x7d5a('0x21')](function(_0x3bad0f){if(_0x3bad0f){return db[_0x7d5a('0x26')][_0x7d5a('0x27')]({'ItemTypeId':_0x249913,'OrderBy':_0x10c9ff},{'where':{'CmContactId':_0x5e10ae,'item':_0x9449c8}})[_0x7d5a('0x21')](function(_0x444ce3){_0x3c2133({'res':_0x7d5a('0x28')});});}else{return db['CmContactHasItem'][_0x7d5a('0x29')]({'CmContactId':_0x5e10ae,'item':_0x9449c8,'ItemTypeId':_0x249913,'OrderBy':_0x10c9ff,'ItemClass':_0x7d5a('0x2a')})[_0x7d5a('0x21')](function(_0x3d8d25){_0x3c2133({'res':_0x7d5a('0x2b')});});}});});}function updateContact(_0x19d82e){return new Promise(function(_0x23382e,_0x52550d){var _0x1c77c8=_0x19d82e['id'];delete _0x19d82e['id'];return db[_0x7d5a('0x2c')][_0x7d5a('0x27')](_0x19d82e,{'where':{'id':_0x1c77c8}})[_0x7d5a('0x21')](function(_0xede688){updatedRows+=0x1;return db[_0x7d5a('0x2d')][_0x7d5a('0x27')]({'phone':_0x19d82e['phone']},{'where':{'ContactId':_0x1c77c8}})[_0x7d5a('0x21')](function(_0x38b7c9){_0x23382e({'ret':'OK'});});});});}function insertCmHopper(_0x397826,_0xdcca51,_0x2560d1,_0x177a56,_0x1e471a){var _0x51af78=[_0x7d5a('0x2e'),_0x7d5a('0x2f'),_0x7d5a('0x30'),_0x7d5a('0x31'),_0xdcca51+'.'+_0x177a56,'cm_contacts.createdAt',_0x7d5a('0x32'),_0x7d5a('0x33'),'cm_contacts.UserId','\x22'+_0x1e471a+'\x22'];return squel['insert']()[_0x7d5a('0x34')](_0x7d5a('0x35'))['fromQuery']([_0x7d5a('0x12'),'scheduledat',_0x7d5a('0x36'),_0x7d5a('0x37'),_0x177a56,_0x7d5a('0x38'),'updatedAt',_0x7d5a('0x39'),_0x7d5a('0x3a'),_0x7d5a('0x3b')],squel[_0x7d5a('0x11')]()[_0x7d5a('0x3c')](_0x51af78)[_0x7d5a('0x13')](_0xdcca51)[_0x7d5a('0x18')]('cm_contacts',null,_0x7d5a('0x3d')+_0xdcca51+'.CmListId')[_0x7d5a('0x18')](_0x2560d1,null,_0x2560d1+'.id\x20=\x20'+_0xdcca51+'.'+_0x177a56)[_0x7d5a('0x16')](_0xdcca51+_0x7d5a('0x3e'),_0x397826)[_0x7d5a('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xdcca51,_0x2560d1,_0x177a56,_0x7d5a('0x35'),[_0x7d5a('0x3f'),_0x7d5a('0x40')]))[_0x7d5a('0x16')](_0x7d5a('0x41'),selectNotIn(_0xdcca51,_0x2560d1,_0x177a56,_0x7d5a('0x35'),[_0x7d5a('0x3f')])))[_0x7d5a('0x42')]();}function insertCmHopperBlack(_0x590045,_0x1edf20,_0x23a294,_0x591be2){var _0x191809=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x1edf20+'.'+_0x591be2,_0x7d5a('0x43'),'cm_contacts.updatedAt'];return squel[_0x7d5a('0x44')]()[_0x7d5a('0x34')]('cm_hopper_black')[_0x7d5a('0x45')]([_0x7d5a('0x12'),_0x7d5a('0x36'),'ListId',_0x591be2,_0x7d5a('0x38'),_0x7d5a('0x46')],squel[_0x7d5a('0x11')]()[_0x7d5a('0x3c')](_0x191809)[_0x7d5a('0x13')](_0x1edf20)[_0x7d5a('0x18')](_0x7d5a('0x47'),null,_0x7d5a('0x3d')+_0x1edf20+_0x7d5a('0x48'))['join'](_0x23a294,null,_0x23a294+'.id\x20=\x20'+_0x1edf20+'.'+_0x591be2)[_0x7d5a('0x16')](_0x1edf20+_0x7d5a('0x3e'),_0x590045)[_0x7d5a('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7d5a('0x16')](_0x7d5a('0x41'),squel[_0x7d5a('0x11')]()[_0x7d5a('0x49')](_0x7d5a('0x12'))[_0x7d5a('0x13')](_0x7d5a('0x4a'))[_0x7d5a('0x16')](_0x7d5a('0x4b'),_0x590045)[_0x7d5a('0x16')](_0x591be2+'\x20=\x20?',_0x1edf20+'.'+_0x591be2)))[_0x7d5a('0x42')]();}function insertCmHopperAdditionalPhones(_0x5b7dd8){var _0x5584f8=['cm_hopper.id',_0x7d5a('0x4c'),_0x7d5a('0x4d'),_0x7d5a('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0x7d5a('0x44')]()[_0x7d5a('0x34')](_0x7d5a('0x4f'))['fromQuery'](['CmHopperId',_0x7d5a('0x12'),_0x7d5a('0x50'),_0x7d5a('0x38'),_0x7d5a('0x46')],squel[_0x7d5a('0x11')]()[_0x7d5a('0x3c')](_0x5584f8)[_0x7d5a('0x13')](_0x7d5a('0x35'))[_0x7d5a('0x18')](_0x7d5a('0x47'),null,_0x7d5a('0x51'))[_0x7d5a('0x18')]('cm_contact_has_items',null,_0x7d5a('0x52'))[_0x7d5a('0x16')](_0x7d5a('0x53'),_0x5b7dd8)[_0x7d5a('0x16')](_0x7d5a('0x54'),NOW))[_0x7d5a('0x42')]();}function insertCmContact(_0x42f6a2,_0x2527d8,_0x59e4fb,_0x43ca5b){var _0x5510d4=_['concat'](_[_0x7d5a('0x55')](_0x43ca5b),[_0x7d5a('0x37'),_0x7d5a('0x56'),_0x7d5a('0x38'),'updatedAt']);return squel[_0x7d5a('0x44')]()['into'](_0x7d5a('0x47'))[_0x7d5a('0x45')](_0x5510d4,squel['select']()['fields'](_0x5510d4)[_0x7d5a('0x13')](_0x2527d8)[_0x7d5a('0x16')]('('+_0x59e4fb[_0x7d5a('0x18')](',')+_0x7d5a('0x57'),squel['select']()[_0x7d5a('0x3c')](_0x59e4fb)[_0x7d5a('0x13')](_0x7d5a('0x47'))[_0x7d5a('0x16')](_0x7d5a('0x4b'),_0x42f6a2))[_0x7d5a('0x16')](_0x7d5a('0x58'),squel[_0x7d5a('0x11')]()['field'](_0x7d5a('0x59'),'min_id')[_0x7d5a('0x13')](_0x2527d8)[_0x7d5a('0x5a')](_0x59e4fb['join'](','))))['toString']();}function handleStop(){logger[_0x7d5a('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x27f509){logger[_0x7d5a('0x23')](_0x27f509[_0x7d5a('0x5c')]);process[_0x7d5a('0x5d')](0x1);}function handleError(_0x5d52b0,_0x2e2953){stats[_0x7d5a('0x5e')][_0x7d5a('0x1f')]({'name':_0x2e2953[_0x7d5a('0x5f')],'message':_0x2e2953[_0x7d5a('0x5c')],'row':_0x5d52b0});}function handleQuery(_0x303255){logger[_0x7d5a('0x5b')](_0x303255);return db[_0x7d5a('0x19')][_0x7d5a('0x1a')](_0x303255)[_0x7d5a('0x60')](function(_0x13d767){results[_0x7d5a('0x1f')](_0x13d767);})[_0x7d5a('0x22')](function(_0xc305a3){logger[_0x7d5a('0x23')](_0xc305a3[_0x7d5a('0x5c')]);});}function main(_0x3708e4,_0x272623,_0xb564f2,_0x446002){logger[_0x7d5a('0x5b')]('main',_0x3708e4,JSON[_0x7d5a('0x61')](_0x272623));process[_0x7d5a('0x62')](_0x7d5a('0x63'));var _0x53f112=_0x272623[_0x7d5a('0x64')];var _0x297d99=_['clone'](_0x53f112);var _0x592e00=_0x272623[_0x7d5a('0x65')];var _0xb0e1bb=path['join'](config['root'],_0x7d5a('0x66'),_0x592e00+_0x7d5a('0x67'));logger[_0x7d5a('0x5b')](_0x7d5a('0x68'),_0x272623);db[_0x7d5a('0x69')]['findAll']({'raw':!![],'attributes':['id',_0x7d5a('0x6a')]})['then'](function(_0x1deeb3){for(var _0x5a0bba=0x0;_0x5a0bba<_0x1deeb3['length'];_0x5a0bba++){if(_0x1deeb3[_0x5a0bba][_0x7d5a('0x6a')]in _0x53f112){contactItemTypes['push'](_0x1deeb3[_0x5a0bba]);delete _0x297d99[_0x1deeb3[_0x5a0bba][_0x7d5a('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x297d99['AdditionalPhones']='';var _0x221578=_[_0x7d5a('0x55')](_0x297d99)[_0x7d5a('0x18')]();logger[_0x7d5a('0x5b')]('header',_0x221578);fs[_0x7d5a('0x6b')](_0xb0e1bb,_0x221578+'\x0a');Papa[_0x7d5a('0x6c')](fs['createReadStream'](_0x3708e4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9378a5,_0x17f1c7){try{for(var _0x47f5f8=0x0,_0x19173a=[];_0x47f5f8<_0x9378a5[_0x7d5a('0x6d')][_0x7d5a('0x1c')];_0x47f5f8++){stats['rows']+=0x1;if(_0x9378a5['errors'][_0x47f5f8]){handleError(_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8],_0x9378a5[_0x7d5a('0x5e')][_0x47f5f8]);}else{var _0x207f3d=[];var _0x187108=[];for(var _0x291432 in _0x53f112){let _0x421949=contactItemTypes[_0x7d5a('0x6e')](_0x2b5cac=>_0x2b5cac[_0x7d5a('0x6a')]===_0x291432);if(_[_0x7d5a('0x1d')](_0x421949)){if(_0x53f112['hasOwnProperty'](_0x291432)){if(_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8][_0x53f112[_0x291432]]){var _0x4ba7b8=_[_0x7d5a('0x6f')](_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8][_0x53f112[_0x291432]]['replace'](/"/g,'\x27'));switch(_0x291432){case _0x7d5a('0x70'):var _0x33c916=moment(_0x4ba7b8,_0x7d5a('0x71'),!![]);if(_0x33c916[_0x7d5a('0x72')]()){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x4ba7b8+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7d5a('0x39'):var _0x135fc2=parseInt(_0x4ba7b8);_0x4ba7b8=_[_0x7d5a('0x73')](_0x135fc2)||_0x135fc2<0x0||_0x135fc2>0x4?_0x446002?0x3:0x2:_0x135fc2;_0x19173a['push']('\x22'+_0x4ba7b8+'\x22');break;case _0x7d5a('0x3a'):var _0x1c7964=parseInt(_0x4ba7b8);if(_[_0x7d5a('0x74')](_0x1c7964)&&_['includes'](_0xb564f2,_0x1c7964)){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x1c7964+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')](_0x7d5a('0x75'));}break;case _0x7d5a('0x76'):if(isEmail(_0x4ba7b8)){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x4ba7b8+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')](_0x7d5a('0x77'));}break;case _0x7d5a('0x78'):var _0x3bd9ea=moment(_0x4ba7b8,_0x7d5a('0x79'),!![]);if(_0x3bd9ea[_0x7d5a('0x72')]()){_0x19173a['push']('\x22'+_0x4ba7b8+'\x22');}else{_0x207f3d[_0x7d5a('0x1f')](_0x7d5a('0x7a'));}break;default:_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x4ba7b8+'\x22');}}else{switch(_0x291432){case _0x7d5a('0x7b'):case _0x7d5a('0x12'):_0x207f3d[_0x7d5a('0x1f')](_0x291432+_0x7d5a('0x7c'));break;default:_0x19173a[_0x7d5a('0x1f')]('\x22\x22');}}}}else{var _0x51a9ae='';for(var _0x7d5c0b=0x0;_0x7d5c0b<_0x53f112[_0x291432][_0x7d5a('0x1c')];_0x7d5c0b++){var _0x4ba7b8=_[_0x7d5a('0x6f')](_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8][_0x53f112[_0x291432][_0x7d5c0b]]['replace'](/"/g,'\x27'));if(_0x51a9ae=='')_0x51a9ae=_0x4ba7b8;else _0x51a9ae+='|'+_0x4ba7b8;}_0x187108[_0x7d5a('0x1f')](_0x421949['id']+':'+_0x51a9ae);}}if(hasAdditionalPhones){_0x19173a[_0x7d5a('0x1f')]('\x22'+_0x187108[_0x7d5a('0x18')](';')+'\x22');}if(_0x207f3d[_0x7d5a('0x1c')]){handleError(_0x9378a5[_0x7d5a('0x6d')][_0x47f5f8],{'code':_0x7d5a('0x7d'),'message':_0x207f3d['join']()});}else{fs[_0x7d5a('0x7e')](_0xb0e1bb,_0x19173a[_0x7d5a('0x18')]()+'\x0a');}_0x19173a=[];}if(!(stats['rows']%0xc8)){socket[_0x7d5a('0x7f')](_0x7d5a('0x80')+_0x592e00,stats);stats['errors']=[];}}if(stopped){logger[_0x7d5a('0x5b')](_0x7d5a('0x81'));_0x17f1c7['abort']();}}catch(_0x374200){handleError(_0x9378a5['data'][_0x47f5f8],{'code':_0x7d5a('0x82'),'message':_0x374200[_0x7d5a('0x5c')]});logger[_0x7d5a('0x23')]('step',_0x374200[_0x7d5a('0x5c')]);}},'complete':function(){try{var _0x18564b=[];var _0x12b9ce=tempTableName;_0x18564b[_0x7d5a('0x1f')](_0x7d5a('0x83')+_0x12b9ce+_0x7d5a('0x84'));logger['info']('CIS\x20len',contactItemTypes[_0x7d5a('0x1c')]);var _0x394636=util[_0x7d5a('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',_0xb0e1bb,_0x12b9ce,_0x221578,_0x272623['ListId'],_0x272623[_0x7d5a('0x56')]||null,NOW,NOW);if(_[_0x7d5a('0x1d')](_0x53f112[_0x7d5a('0x70')])){_0x394636+=',\x20scheduledAt\x20=\x20NOW()';}_0x18564b['push'](_0x394636);BPromise[_0x7d5a('0x85')](_0x18564b,handleQuery)[_0x7d5a('0x21')](function(_0x4cf183){BPromise[_0x7d5a('0x20')]([handleAdditionalPhones()])[_0x7d5a('0x21')](function(){_0x18564b=[];for(var _0x3f02a7=0x0;_0x3f02a7=_0x5742e5){return _0x49765b[_0x3b99('0x15')](0x193)[_0x3b99('0x16')]({'message':util[_0x3b99('0x8')](_0x3b99('0x17'),_0x52661f)});}_0x3ccbd5();})[_0x3b99('0x18')](function(_0x52086a){_0x3ccbd5(_0x52086a);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x3b99('0x19')},{'role':_0x3b99('0x1a')}]}});}exports[_0x3b99('0x1b')]=isUserLimit; \ No newline at end of file +var _0xd1ac=['json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','use','License','findOne','then','count','status'];(function(_0x1b15b8,_0x2483f2){var _0xc3c4c2=function(_0x259e07){while(--_0x259e07){_0x1b15b8['push'](_0x1b15b8['shift']());}};_0xc3c4c2(++_0x2483f2);}(_0xd1ac,0x1d2));var _0xcd1a=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0xd1ac[_0x1f4fe3];return _0xe8dd52;};'use strict';var crypto=require(_0xcd1a('0x0'));var util=require(_0xcd1a('0x1'));var compose=require('composable-middleware');var db=require(_0xcd1a('0x2'))['db'];var config=require(_0xcd1a('0x3'));function getValueFromLicense(_0x41f4ad,_0x445696){if(_0x41f4ad&&_0x445696){if(_0x445696[_0xcd1a('0x4')]&&_0x445696[_0xcd1a('0x5')]){var _0x318a8b=_0x445696[_0xcd1a('0x4')];var _0x4102f8=_0x445696[_0xcd1a('0x5')];var _0x241e51=_0x318a8b['split']('-')[0x4];var _0x4e27d7=_0x318a8b['split']('-')[0x0];var _0x34adf5=crypto[_0xcd1a('0x6')](_0xcd1a('0x7'),util[_0xcd1a('0x8')]('%s:%s:%s',_0x241e51,_0x318a8b,_0x4e27d7));var _0x82f7ae=_0x34adf5[_0xcd1a('0x9')](_0x4102f8,_0xcd1a('0xa'),_0xcd1a('0xb'));_0x82f7ae+=_0x34adf5[_0xcd1a('0xc')](_0xcd1a('0xb'));var _0x1a5c1f=JSON[_0xcd1a('0xd')](_0x82f7ae);return _0x1a5c1f['hasOwnProperty'](_0x41f4ad)?_0x1a5c1f[_0x41f4ad]:null;}}return null;}function isLimit(_0x3ed894,_0xb6306a,_0x53f3fb,_0x5af8e4){var _0x140ec7=_0xb6306a;return compose()[_0xcd1a('0xe')](function(_0x9266eb,_0x4869d7,_0x5ebecb){return db[_0xcd1a('0xf')][_0xcd1a('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xcd1a('0x11')](function(_0x1365a7){var _0x1859d3=getValueFromLicense(_0x3ed894,_0x1365a7);return _0x1859d3?_0x1859d3:_0x140ec7;})[_0xcd1a('0x11')](function(_0x1844c2){_0x140ec7=_0x1844c2;return _0x53f3fb[_0xcd1a('0x12')](_0x5af8e4);})['then'](function(_0x230dfc){if(_0x230dfc>=_0x140ec7){return _0x4869d7[_0xcd1a('0x13')](0x193)[_0xcd1a('0x14')]({'message':util[_0xcd1a('0x8')](_0xcd1a('0x15'),_0x3ed894)});}_0x5ebecb();})[_0xcd1a('0x16')](function(_0x438f62){_0x5ebecb(_0x438f62);});});}function isUserLimit(){return isLimit(_0xcd1a('0x17'),0x1,db[_0xcd1a('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0xcd1a('0x19')}]}});}exports[_0xcd1a('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index badd98e..f62cb3b 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 _0xf363=['$gt','$lte','add','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$between','$in','start','$substring','utcOffset','hours','minutes','[$or]','and','replace','[$and]','slice','forEach','split','shift','filter','indexOf','DATE','operator','$eq','value','includes'];(function(_0x3411a4,_0x60d585){var _0x4eb325=function(_0x2356d4){while(--_0x2356d4){_0x3411a4['push'](_0x3411a4['shift']());}};_0x4eb325(++_0x60d585);}(_0xf363,0x169));var _0x3f36=function(_0x1082eb,_0x1a86c5){_0x1082eb=_0x1082eb-0x0;var _0x5b7a36=_0xf363[_0x1082eb];return _0x5b7a36;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0xc9b0f2){var _0x9027f0={'conditions':[]};_0x9027f0['sqlOperator']=_['startsWith'](_0xc9b0f2,_0x3f36('0x0'))?'or':_0x3f36('0x1');var _0x1c6dc5=_0xc9b0f2[_0x3f36('0x2')](_0x3f36('0x3'),'')[_0x3f36('0x2')]('[$or]','')['split']('||');for(var _0x1ab278=0x0;_0x1ab278<_0x1c6dc5['length'];_0x1ab278++){var _0x17f020=_0x1c6dc5[_0x1ab278]['split'](':=');var _0xab7139=_0x17f020[0x0];var _0x410e35=_0x17f020[_0x3f36('0x4')](0x1);_0x410e35[_0x3f36('0x5')](function(_0x34ebbd){var _0x37b22c=_0x34ebbd[_0x3f36('0x6')]('[')[_0x3f36('0x7')]();var _0x47d4e7=_0x34ebbd['match'](/\[(.*?)\]/g);_0x47d4e7[_0x3f36('0x5')](function(_0x137a5a){var _0x39639f=_0x137a5a['split']('[')[_0x3f36('0x8')](function(_0x3a5819){return _0x3a5819[_0x3f36('0x9')](']')>-0x1;})['map'](function(_0x50e667){return _0x50e667['split'](']')[0x0];})[0x0];_0x9027f0['conditions']['push']({'field':_0xab7139,'operator':_0x37b22c,'value':_0x39639f});});});}return _0x9027f0;};exports['buildExpression']=function(_0x435e70,_0x562bdb,_0x2bdc83){var _0x24fa6c={};if(_0x562bdb===_0x3f36('0xa')){if(_0x2bdc83[_0x3f36('0xb')]===_0x3f36('0xc')){_0x2bdc83[_0x3f36('0xb')]='$between';_0x2bdc83[_0x3f36('0xd')]+=','+_0x2bdc83[_0x3f36('0xd')];}else if(_[_0x3f36('0xe')]([_0x3f36('0xf'),_0x3f36('0x10')],_0x2bdc83[_0x3f36('0xb')])){_0x2bdc83[_0x3f36('0xd')]=moment(_0x2bdc83[_0x3f36('0xd')])[_0x3f36('0x11')](0x1,'days')[_0x3f36('0x12')](_0x3f36('0x13'));}}if(_0x2bdc83[_0x3f36('0x14')]){_0x562bdb=_0x2bdc83['castTo'];_0x24fa6c['text']=_0x3f36('0x15')+_0x435e70+'.'+_0x2bdc83[_0x3f36('0x16')]+_0x3f36('0x17')+_0x2bdc83[_0x3f36('0x14')]+')\x20'+parseOperator(_0x2bdc83[_0x3f36('0xb')]);}else{_0x24fa6c[_0x3f36('0x18')]=_0x435e70+'.'+_0x2bdc83[_0x3f36('0x16')]+'\x20'+parseOperator(_0x2bdc83[_0x3f36('0xb')]);}if(_[_0x3f36('0xe')]([_0x3f36('0x19'),_0x3f36('0x1a')],_0x2bdc83[_0x3f36('0xb')]))_0x24fa6c['text']='('+_0x24fa6c[_0x3f36('0x18')]+_0x3f36('0x1b')+_0x435e70+'.'+_0x2bdc83[_0x3f36('0x16')]+'\x20IS\x20NULL)';_0x24fa6c[_0x3f36('0xd')]=parseValue(_0x562bdb,_0x2bdc83[_0x3f36('0xb')],_0x2bdc83[_0x3f36('0xd')]);return _0x24fa6c;};function parseOperator(_0x1a925e){var _0x4fb77d;switch(_0x1a925e){case'$in':_0x4fb77d=_0x3f36('0x1c');break;case _0x3f36('0x1a'):_0x4fb77d=_0x3f36('0x1d');break;case _0x3f36('0xc'):_0x4fb77d=_0x3f36('0x1e');break;case _0x3f36('0x19'):_0x4fb77d=_0x3f36('0x1f');break;case'$substring':case _0x3f36('0x20'):case _0x3f36('0x21'):_0x4fb77d=_0x3f36('0x22');break;case _0x3f36('0x23'):_0x4fb77d=_0x3f36('0x24');break;case _0x3f36('0xf'):_0x4fb77d=_0x3f36('0x25');break;case _0x3f36('0x10'):_0x4fb77d=_0x3f36('0x26');break;case'$gte':_0x4fb77d=_0x3f36('0x27');break;case _0x3f36('0x28'):_0x4fb77d='BETWEEN\x20?\x20AND\x20?';break;}return _0x4fb77d;}function parseValue(_0x11fb20,_0x5f5d93,_0x398018){var _0x263590={'start':undefined,'end':undefined};switch(_0x5f5d93){case _0x3f36('0x29'):case _0x3f36('0x1a'):_0x263590[_0x3f36('0x2a')]=_0x398018[_0x3f36('0x6')](',');break;case _0x3f36('0x2b'):_0x263590[_0x3f36('0x2a')]='%'+_0x398018+'%';break;case _0x3f36('0x20'):_0x263590[_0x3f36('0x2a')]=_0x398018+'%';break;case _0x3f36('0x21'):_0x263590[_0x3f36('0x2a')]='%'+_0x398018;break;case _0x3f36('0x28'):var _0x232d9c=_0x398018['split'](',');var _0x398018=_0x232d9c['shift']();var _0x5d8f09=_0x232d9c['pop']();if(_0x11fb20==='DATE'){_0x398018=moment(_0x398018)['utcOffset'](0x0,!![])[_0x3f36('0x12')]();_0x5d8f09=moment(_0x5d8f09)[_0x3f36('0x2c')](0x0,!![])[_0x3f36('0x11')](0x17,_0x3f36('0x2d'))[_0x3f36('0x11')](0x3b,_0x3f36('0x2e'))[_0x3f36('0x11')](0x3b,'seconds')[_0x3f36('0x12')]();}_0x263590={'start':_0x398018,'end':_0x5d8f09};break;default:_0x263590[_0x3f36('0x2a')]=_0x398018;break;}return _0x263590;} \ No newline at end of file +var _0x1ea9=['$in','IN\x20?','$notIn','NOT\x20IN\x20?','$substring','$startsWith','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','add','hours','lodash','moment','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','$gt','$lte','operator','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ea9,0x7a));var _0x91ea=function(_0x43a74f,_0x37376a){_0x43a74f=_0x43a74f-0x0;var _0xe84cb=_0x1ea9[_0x43a74f];return _0xe84cb;};'use strict';var _=require(_0x91ea('0x0'));var moment=require(_0x91ea('0x1'));exports['parseSearch']=function(_0x18a14d){var _0x5cd335={'conditions':[]};_0x5cd335[_0x91ea('0x2')]=_[_0x91ea('0x3')](_0x18a14d,_0x91ea('0x4'))?'or':_0x91ea('0x5');var _0x20a391=_0x18a14d['replace'](_0x91ea('0x6'),'')[_0x91ea('0x7')](_0x91ea('0x4'),'')[_0x91ea('0x8')]('||');for(var _0x34e194=0x0;_0x34e194<_0x20a391['length'];_0x34e194++){var _0x2c33e0=_0x20a391[_0x34e194][_0x91ea('0x8')](':=');var _0x2470c0=_0x2c33e0[0x0];var _0x1c16cc=_0x2c33e0[_0x91ea('0x9')](0x1);_0x1c16cc[_0x91ea('0xa')](function(_0x57b12f){var _0x18b3f6=_0x57b12f['split']('[')[_0x91ea('0xb')]();var _0x3363d8=_0x57b12f[_0x91ea('0xc')](/\[(.*?)\]/g);_0x3363d8[_0x91ea('0xa')](function(_0x46668e){var _0xff7b5=_0x46668e[_0x91ea('0x8')]('[')['filter'](function(_0x54a10e){return _0x54a10e[_0x91ea('0xd')](']')>-0x1;})[_0x91ea('0xe')](function(_0xc1e816){return _0xc1e816[_0x91ea('0x8')](']')[0x0];})[0x0];_0x5cd335[_0x91ea('0xf')][_0x91ea('0x10')]({'field':_0x2470c0,'operator':_0x18b3f6,'value':_0xff7b5});});});}return _0x5cd335;};exports[_0x91ea('0x11')]=function(_0xce2d43,_0x5c1146,_0x3e66ba){var _0x3bc18d={};if(_0x5c1146===_0x91ea('0x12')){if(_0x3e66ba['operator']===_0x91ea('0x13')){_0x3e66ba['operator']=_0x91ea('0x14');_0x3e66ba[_0x91ea('0x15')]+=','+_0x3e66ba[_0x91ea('0x15')];}else if(_[_0x91ea('0x16')]([_0x91ea('0x17'),_0x91ea('0x18')],_0x3e66ba[_0x91ea('0x19')])){_0x3e66ba[_0x91ea('0x15')]=moment(_0x3e66ba[_0x91ea('0x15')])['add'](0x1,_0x91ea('0x1a'))[_0x91ea('0x1b')](_0x91ea('0x1c'));}}if(_0x3e66ba[_0x91ea('0x1d')]){_0x5c1146=_0x3e66ba['castTo'];_0x3bc18d[_0x91ea('0x1e')]=_0x91ea('0x1f')+_0xce2d43+'.'+_0x3e66ba[_0x91ea('0x20')]+_0x91ea('0x21')+_0x3e66ba[_0x91ea('0x1d')]+')\x20'+parseOperator(_0x3e66ba[_0x91ea('0x19')]);}else{_0x3bc18d[_0x91ea('0x1e')]=_0xce2d43+'.'+_0x3e66ba[_0x91ea('0x20')]+'\x20'+parseOperator(_0x3e66ba['operator']);}if(_['includes']([_0x91ea('0x22'),'$notIn'],_0x3e66ba[_0x91ea('0x19')]))_0x3bc18d['text']='('+_0x3bc18d['text']+_0x91ea('0x23')+_0xce2d43+'.'+_0x3e66ba['field']+_0x91ea('0x24');_0x3bc18d[_0x91ea('0x15')]=parseValue(_0x5c1146,_0x3e66ba[_0x91ea('0x19')],_0x3e66ba[_0x91ea('0x15')]);return _0x3bc18d;};function parseOperator(_0x4603c8){var _0x2f304f;switch(_0x4603c8){case _0x91ea('0x25'):_0x2f304f=_0x91ea('0x26');break;case _0x91ea('0x27'):_0x2f304f=_0x91ea('0x28');break;case'$eq':_0x2f304f='=\x20?';break;case _0x91ea('0x22'):_0x2f304f='<>\x20?';break;case _0x91ea('0x29'):case _0x91ea('0x2a'):case'$endsWith':_0x2f304f='LIKE\x20?';break;case'$lt':_0x2f304f='<\x20?';break;case _0x91ea('0x17'):_0x2f304f='>\x20?';break;case _0x91ea('0x18'):_0x2f304f=_0x91ea('0x2b');break;case _0x91ea('0x2c'):_0x2f304f=_0x91ea('0x2d');break;case'$between':_0x2f304f=_0x91ea('0x2e');break;}return _0x2f304f;}function parseValue(_0x16a2c5,_0x5d914e,_0xac1b51){var _0x5ae92e={'start':undefined,'end':undefined};switch(_0x5d914e){case _0x91ea('0x25'):case _0x91ea('0x27'):_0x5ae92e[_0x91ea('0x2f')]=_0xac1b51['split'](',');break;case _0x91ea('0x29'):_0x5ae92e['start']='%'+_0xac1b51+'%';break;case _0x91ea('0x2a'):_0x5ae92e['start']=_0xac1b51+'%';break;case _0x91ea('0x30'):_0x5ae92e[_0x91ea('0x2f')]='%'+_0xac1b51;break;case'$between':var _0x16ecb8=_0xac1b51[_0x91ea('0x8')](',');var _0xac1b51=_0x16ecb8[_0x91ea('0xb')]();var _0x142386=_0x16ecb8[_0x91ea('0x31')]();if(_0x16a2c5===_0x91ea('0x12')){_0xac1b51=moment(_0xac1b51)[_0x91ea('0x32')](0x0,!![])[_0x91ea('0x1b')]();_0x142386=moment(_0x142386)[_0x91ea('0x32')](0x0,!![])[_0x91ea('0x33')](0x17,_0x91ea('0x34'))[_0x91ea('0x33')](0x3b,'minutes')['add'](0x3b,'seconds')[_0x91ea('0x1b')]();}_0x5ae92e={'start':_0xac1b51,'end':_0x142386};break;default:_0x5ae92e[_0x91ea('0x2f')]=_0xac1b51;break;}return _0x5ae92e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index cb06099..c38c32d 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 _0x6d1c=['omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','includes','push','lodash','sequelize','split','filters','isEmpty','forOwn','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','sort','indexOf','priority','cast','col','unsigned','substr','ASC'];(function(_0x42ac2e,_0x262d31){var _0x53d56c=function(_0x5e1c13){while(--_0x5e1c13){_0x42ac2e['push'](_0x42ac2e['shift']());}};_0x53d56c(++_0x262d31);}(_0x6d1c,0x15a));var _0xc6d1=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x6d1c[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0xc6d1('0x0'));var sequelize=require(_0xc6d1('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x497a14){var _0x3721f8=null;if(_0x497a14){_0x3721f8=_0x497a14[_0xc6d1('0x2')](',');}return _0x3721f8;};exports[_0xc6d1('0x3')]=function(_0x540e3a,_0x850b9d){var _0x5760a1={};if(!_[_0xc6d1('0x4')](_0x540e3a)){_[_0xc6d1('0x5')](_0x540e3a,function(_0x4da9b9,_0x3e564c){try{if(_0x850b9d){var _0x361d0e=_['find'](_0x850b9d,{'name':_0x3e564c})||{};if(_0x361d0e[_0xc6d1('0x6')]===_0xc6d1('0x7')&&_['isPlainObject'](_0x4da9b9)){var _0x16da56=JSON[_0xc6d1('0x8')](_0x4da9b9);var _0x403df2={'$gte':moment(moment(_0x16da56[_0xc6d1('0x9')])[_0xc6d1('0xa')](_0xc6d1('0xb')))[_0xc6d1('0xc')]()[_0xc6d1('0xa')](),'$lte':moment(moment(_0x16da56[_0xc6d1('0xd')])[_0xc6d1('0xa')](_0xc6d1('0xb')))[_0xc6d1('0xc')]()[_0xc6d1('0xe')](0x1,'s')[_0xc6d1('0xa')]()};_0x5760a1[_0x3e564c]=_0x403df2;}else{_0x5760a1[_0x3e564c]=_['isArray'](_0x4da9b9)?_0x4da9b9:JSON[_0xc6d1('0x8')](_0x4da9b9);}}else{_0x5760a1[_0x3e564c]=_[_0xc6d1('0xf')](_0x4da9b9)?_0x4da9b9:JSON[_0xc6d1('0x8')](_0x4da9b9);}}catch(_0x54f769){_0x5760a1[_0x3e564c]=_0x4da9b9['split'](',');}});}return _0x5760a1;};exports['limit']=function(_0x515ba4){_0x515ba4=parseInt(_0x515ba4,0xa);if(!_0x515ba4||_0x515ba4<0x0){_0x515ba4=LIMIT_VALUE;}return _0x515ba4;};exports['offset']=function(_0x89edd4){_0x89edd4=parseInt(_0x89edd4,0xa);if(!_0x89edd4||_0x89edd4<0x0){_0x89edd4=0x0;}return _0x89edd4;};exports[_0xc6d1('0x10')]=function(_0xb0888c){var _0x3a2544,_0x3dc0e5=null;if(_0xb0888c){_0x3a2544=_0xb0888c['split'](',');_0x3dc0e5=_['map'](_0x3a2544,function(_0xbedee3){if(_0xbedee3[_0xc6d1('0x11')]('-')===0x0){return[_0xbedee3===_0xc6d1('0x12')?sequelize[_0xc6d1('0x13')](sequelize[_0xc6d1('0x14')](_0xc6d1('0x12')),_0xc6d1('0x15')):_0xbedee3[_0xc6d1('0x16')](0x1),'DESC'];}else{return[_0xbedee3===_0xc6d1('0x12')?sequelize[_0xc6d1('0x13')](sequelize[_0xc6d1('0x14')](_0xc6d1('0x12')),_0xc6d1('0x15')):_0xbedee3,_0xc6d1('0x17')];}});}return _0x3dc0e5;};exports[_0xc6d1('0x18')]=function(_0x304fbd,_0xf346b5){if(_[_0xc6d1('0x4')](_0x304fbd)){return _0x304fbd;}if(_['isArray'](_0x304fbd)){for(var _0x369bd8=0x0;_0x369bd8<_0x304fbd[_0xc6d1('0x19')];_0x369bd8+=0x1){_0x304fbd[_0x369bd8]=this[_0xc6d1('0x18')](_0x304fbd[_0x369bd8],_0xf346b5);}return _0x304fbd;}if(!_[_0xc6d1('0x1a')](_0x304fbd)){return _0x304fbd;}if(_[_0xc6d1('0x1b')](_0xf346b5)){_0xf346b5=[_0xf346b5];}if(!_[_0xc6d1('0xf')](_0xf346b5)){return _0x304fbd;}for(var _0x1f8dcb=0x0;_0x1f8dcb<_0xf346b5['length'];_0x1f8dcb+=0x1){_[_0xc6d1('0x1c')](_0x304fbd,_0xf346b5[_0x1f8dcb]);}for(var _0x1d885e in _0x304fbd){if(_0x304fbd[_0xc6d1('0x1d')](_0x1d885e)){_0x304fbd[_0x1d885e]=this[_0xc6d1('0x18')](_0x304fbd[_0x1d885e],_0xf346b5);}}return _0x304fbd;};exports[_0xc6d1('0x1e')]=function(_0x3d4ed9){return _0x3d4ed9[_0xc6d1('0x1f')](RegExp(_0xc6d1('0x20')))?!![]:![];};exports[_0xc6d1('0x21')]=function(_0x4680a4){return _0x4680a4[_0xc6d1('0x1f')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1d93da){var _0x227395=[];_0x1d93da[_0xc6d1('0x2')](/[ ,]+/)['forEach'](function(_0x26d28b){_0x26d28b=_0x26d28b[_0xc6d1('0x22')](/([^:]")"+/g,'$1');_0x26d28b='+'+_0x26d28b+'*';if(_0x26d28b[_0xc6d1('0x23')]('@'))_0x26d28b='\x22'+_0x26d28b+'\x22';_0x227395[_0xc6d1('0x24')](_0x26d28b);});return _0x227395['join']('\x20');}; \ No newline at end of file +var _0x8d19=['isEmail','forEach','replace','includes','push','lodash','sequelize','moment','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','parse','isArray','limit','offset','sort','indexOf','priority','cast','col','substr','DESC','unsigned','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x8d19,0x80));var _0x98d1=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x8d19[_0x149083];return _0x4dc74e;};'use strict';var _=require(_0x98d1('0x0'));var sequelize=require(_0x98d1('0x1'));var moment=require(_0x98d1('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x4dfd23){var _0x393edb=null;if(_0x4dfd23){_0x393edb=_0x4dfd23['split'](',');}return _0x393edb;};exports[_0x98d1('0x3')]=function(_0x1430ae,_0x3f4f3e){var _0x3c467d={};if(!_[_0x98d1('0x4')](_0x1430ae)){_[_0x98d1('0x5')](_0x1430ae,function(_0x2cd366,_0x3808f6){try{if(_0x3f4f3e){var _0x22228f=_[_0x98d1('0x6')](_0x3f4f3e,{'name':_0x3808f6})||{};if(_0x22228f[_0x98d1('0x7')]===_0x98d1('0x8')&&_[_0x98d1('0x9')](_0x2cd366)){var _0x40a6d9=JSON['parse'](_0x2cd366);var _0x369a04={'$gte':moment(moment(_0x40a6d9[_0x98d1('0xa')])[_0x98d1('0xb')](_0x98d1('0xc')))[_0x98d1('0xd')]()[_0x98d1('0xb')](),'$lte':moment(moment(_0x40a6d9[_0x98d1('0xe')])[_0x98d1('0xb')](_0x98d1('0xc')))[_0x98d1('0xd')]()[_0x98d1('0xf')](0x1,'s')['format']()};_0x3c467d[_0x3808f6]=_0x369a04;}else{_0x3c467d[_0x3808f6]=_['isArray'](_0x2cd366)?_0x2cd366:JSON[_0x98d1('0x10')](_0x2cd366);}}else{_0x3c467d[_0x3808f6]=_[_0x98d1('0x11')](_0x2cd366)?_0x2cd366:JSON['parse'](_0x2cd366);}}catch(_0x10c6fc){_0x3c467d[_0x3808f6]=_0x2cd366['split'](',');}});}return _0x3c467d;};exports[_0x98d1('0x12')]=function(_0x4e6dc5){_0x4e6dc5=parseInt(_0x4e6dc5,0xa);if(!_0x4e6dc5||_0x4e6dc5<0x0){_0x4e6dc5=LIMIT_VALUE;}return _0x4e6dc5;};exports[_0x98d1('0x13')]=function(_0x2fc057){_0x2fc057=parseInt(_0x2fc057,0xa);if(!_0x2fc057||_0x2fc057<0x0){_0x2fc057=0x0;}return _0x2fc057;};exports[_0x98d1('0x14')]=function(_0x314d8b){var _0xe1429c,_0x467366=null;if(_0x314d8b){_0xe1429c=_0x314d8b['split'](',');_0x467366=_['map'](_0xe1429c,function(_0x3bae0d){if(_0x3bae0d[_0x98d1('0x15')]('-')===0x0){return[_0x3bae0d===_0x98d1('0x16')?sequelize[_0x98d1('0x17')](sequelize[_0x98d1('0x18')](_0x98d1('0x16')),'unsigned'):_0x3bae0d[_0x98d1('0x19')](0x1),_0x98d1('0x1a')];}else{return[_0x3bae0d==='priority'?sequelize[_0x98d1('0x17')](sequelize['col'](_0x98d1('0x16')),_0x98d1('0x1b')):_0x3bae0d,'ASC'];}});}return _0x467366;};exports[_0x98d1('0x1c')]=function(_0x2261ef,_0x22a1ab){if(_['isEmpty'](_0x2261ef)){return _0x2261ef;}if(_[_0x98d1('0x11')](_0x2261ef)){for(var _0x3ef1b0=0x0;_0x3ef1b0<_0x2261ef[_0x98d1('0x1d')];_0x3ef1b0+=0x1){_0x2261ef[_0x3ef1b0]=this['omit'](_0x2261ef[_0x3ef1b0],_0x22a1ab);}return _0x2261ef;}if(!_[_0x98d1('0x1e')](_0x2261ef)){return _0x2261ef;}if(_[_0x98d1('0x1f')](_0x22a1ab)){_0x22a1ab=[_0x22a1ab];}if(!_['isArray'](_0x22a1ab)){return _0x2261ef;}for(var _0x3a581f=0x0;_0x3a581f<_0x22a1ab['length'];_0x3a581f+=0x1){_[_0x98d1('0x20')](_0x2261ef,_0x22a1ab[_0x3a581f]);}for(var _0x395656 in _0x2261ef){if(_0x2261ef[_0x98d1('0x21')](_0x395656)){_0x2261ef[_0x395656]=this[_0x98d1('0x1c')](_0x2261ef[_0x395656],_0x22a1ab);}}return _0x2261ef;};exports[_0x98d1('0x22')]=function(_0x5dd058){return _0x5dd058['match'](RegExp(_0x98d1('0x23')))?!![]:![];};exports[_0x98d1('0x24')]=function(_0x3cffc2){return _0x3cffc2['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x29b68e){var _0x46b8a3=[];_0x29b68e['split'](/[ ,]+/)[_0x98d1('0x25')](function(_0x3e1242){_0x3e1242=_0x3e1242[_0x98d1('0x26')](/([^:]")"+/g,'$1');_0x3e1242='+'+_0x3e1242+'*';if(_0x3e1242[_0x98d1('0x27')]('@'))_0x3e1242='\x22'+_0x3e1242+'\x22';_0x46b8a3[_0x98d1('0x28')](_0x3e1242);});return _0x46b8a3['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 11bf8fd..64bce27 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe605=['html','ejs','renderFile','view\x20engine','urlencoded','50mb','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','passport','cors','moment','../mysqldb','get','env','production','set','join','root','development','test','appPath','use','json\x20replacer','toISOString','split','static','views','/server/views','engine'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe605,0x126));var _0x5e60=function(_0x2a68bc,_0x369895){_0x2a68bc=_0x2a68bc-0x0;var _0x1ce5ee=_0xe605[_0x2a68bc];return _0x1ce5ee;};'use strict';var express=require('express');var favicon=require(_0x5e60('0x0'));var bodyParser=require(_0x5e60('0x1'));var methodOverride=require(_0x5e60('0x2'));var cookieParser=require(_0x5e60('0x3'));var errorHandler=require(_0x5e60('0x4'));var path=require('path');var passport=require(_0x5e60('0x5'));var cors=require(_0x5e60('0x6'));var moment=require(_0x5e60('0x7'));var config=require('./environment');var db=require(_0x5e60('0x8'))['db'];exports['default']=function(_0x2d0905){var _0x3b11a0=_0x2d0905[_0x5e60('0x9')](_0x5e60('0xa'));if(_0x3b11a0===_0x5e60('0xb')){_0x2d0905[_0x5e60('0xc')]('appPath',path[_0x5e60('0xd')](config[_0x5e60('0xe')],'public'));}if(_0x3b11a0===_0x5e60('0xf')||_0x3b11a0===_0x5e60('0x10')){_0x2d0905[_0x5e60('0xc')](_0x5e60('0x11'),path[_0x5e60('0xd')](config[_0x5e60('0xe')],'client'));_0x2d0905[_0x5e60('0x12')](errorHandler());}_0x2d0905[_0x5e60('0xc')](_0x5e60('0x13'),function(_0x38f56e,_0x2b9578){if(this[_0x38f56e]instanceof Date){_0x2b9578=this[_0x38f56e][_0x5e60('0x14')]()[_0x5e60('0x15')]('.')[0x0]+'Z';}return _0x2b9578;});_0x2d0905[_0x5e60('0x12')](express[_0x5e60('0x16')](_0x2d0905[_0x5e60('0x9')](_0x5e60('0x11'))));_0x2d0905['set'](_0x5e60('0x17'),config[_0x5e60('0xe')]+_0x5e60('0x18'));_0x2d0905[_0x5e60('0x19')](_0x5e60('0x1a'),require(_0x5e60('0x1b'))[_0x5e60('0x1c')]);_0x2d0905[_0x5e60('0xc')](_0x5e60('0x1d'),_0x5e60('0x1a'));_0x2d0905['use'](bodyParser[_0x5e60('0x1e')]({'limit':_0x5e60('0x1f'),'extended':!![]}));_0x2d0905[_0x5e60('0x12')](bodyParser['json']({'limit':_0x5e60('0x1f')}));_0x2d0905[_0x5e60('0x12')](cors());_0x2d0905[_0x5e60('0x12')](methodOverride());_0x2d0905[_0x5e60('0x12')](cookieParser());_0x2d0905[_0x5e60('0x12')](passport['initialize']());}; \ No newline at end of file +var _0x2e57=['moment','./environment','../mysqldb','default','get','production','appPath','join','root','public','development','test','set','use','json\x20replacer','toISOString','split','static','views','engine','renderFile','view\x20engine','html','urlencoded','json','initialize','serve-favicon','body-parser','method-override','path','passport'];(function(_0x36267b,_0x32b9a3){var _0x10b3ea=function(_0x3d83e3){while(--_0x3d83e3){_0x36267b['push'](_0x36267b['shift']());}};_0x10b3ea(++_0x32b9a3);}(_0x2e57,0x1ad));var _0x72e5=function(_0xdb0885,_0x4bb553){_0xdb0885=_0xdb0885-0x0;var _0x15238c=_0x2e57[_0xdb0885];return _0x15238c;};'use strict';var express=require('express');var favicon=require(_0x72e5('0x0'));var bodyParser=require(_0x72e5('0x1'));var methodOverride=require(_0x72e5('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x72e5('0x3'));var passport=require(_0x72e5('0x4'));var cors=require('cors');var moment=require(_0x72e5('0x5'));var config=require(_0x72e5('0x6'));var db=require(_0x72e5('0x7'))['db'];exports[_0x72e5('0x8')]=function(_0x4d3ec4){var _0x553a10=_0x4d3ec4[_0x72e5('0x9')]('env');if(_0x553a10===_0x72e5('0xa')){_0x4d3ec4['set'](_0x72e5('0xb'),path[_0x72e5('0xc')](config[_0x72e5('0xd')],_0x72e5('0xe')));}if(_0x553a10===_0x72e5('0xf')||_0x553a10===_0x72e5('0x10')){_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0xb'),path[_0x72e5('0xc')](config[_0x72e5('0xd')],'client'));_0x4d3ec4[_0x72e5('0x12')](errorHandler());}_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0x13'),function(_0x15e1f6,_0x25246d){if(this[_0x15e1f6]instanceof Date){_0x25246d=this[_0x15e1f6][_0x72e5('0x14')]()[_0x72e5('0x15')]('.')[0x0]+'Z';}return _0x25246d;});_0x4d3ec4[_0x72e5('0x12')](express[_0x72e5('0x16')](_0x4d3ec4[_0x72e5('0x9')](_0x72e5('0xb'))));_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0x17'),config[_0x72e5('0xd')]+'/server/views');_0x4d3ec4[_0x72e5('0x18')]('html',require('ejs')[_0x72e5('0x19')]);_0x4d3ec4[_0x72e5('0x11')](_0x72e5('0x1a'),_0x72e5('0x1b'));_0x4d3ec4[_0x72e5('0x12')](bodyParser[_0x72e5('0x1c')]({'limit':'50mb','extended':!![]}));_0x4d3ec4[_0x72e5('0x12')](bodyParser[_0x72e5('0x1d')]({'limit':'50mb'}));_0x4d3ec4[_0x72e5('0x12')](cors());_0x4d3ec4['use'](methodOverride());_0x4d3ec4[_0x72e5('0x12')](cookieParser());_0x4d3ec4[_0x72e5('0x12')](passport[_0x72e5('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f31a29f..293559b 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 _0x37a7=['head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','update','digest','getUuid','platform','utf8','replace','hostname','ipAddress','substring','lodash','crypto','keys','length','filter','family','IPv4','internal','concat'];(function(_0x481ffc,_0x4acb82){var _0x51d09a=function(_0x2d73e0){while(--_0x2d73e0){_0x481ffc['push'](_0x481ffc['shift']());}};_0x51d09a(++_0x4acb82);}(_0x37a7,0x6f));var _0x737a=function(_0xed1f9b,_0x156335){_0xed1f9b=_0xed1f9b-0x0;var _0x2f16d0=_0x37a7[_0xed1f9b];return _0x2f16d0;};'use strict';var _=require(_0x737a('0x0'));var os=require('os');var crypto=require(_0x737a('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];function getInterfaces(){var _0x2d4b54=[];var _0xc5eaef=os['networkInterfaces']();var _0x524516=_['orderBy'](_[_0x737a('0x2')](_0xc5eaef));for(var _0x477f2f=0x0;_0x477f2f<_0x524516[_0x737a('0x3')];_0x477f2f++){var _0x11109c=_0xc5eaef[_0x524516[_0x477f2f]][_0x737a('0x4')](function(_0x5cc52c){return _0x5cc52c[_0x737a('0x5')]===_0x737a('0x6')&&_0x5cc52c[_0x737a('0x7')]===![];});_0x2d4b54=_0x2d4b54[_0x737a('0x8')](_0x11109c);}return _0x2d4b54;}function getFirstInterface(){var _0x4fb3e0=_[_0x737a('0x9')](getInterfaces());return{'macAddress':_0x4fb3e0&&_0x4fb3e0[_0x737a('0xa')]?_0x4fb3e0['mac']:_0x737a('0xb'),'ipAddress':_0x4fb3e0&&_0x4fb3e0[_0x737a('0xc')]?_0x4fb3e0[_0x737a('0xc')]:_0x737a('0xd')};}exports[_0x737a('0xe')]=getFirstInterface;function getCPUhash(){var _0x27ccd9=_[_0x737a('0xf')](os['cpus']()[_0x737a('0x10')](function(_0x22cc58){return _0x22cc58[_0x737a('0x11')];}))[_0x737a('0x12')](':');return crypto[_0x737a('0x13')](_0x737a('0x14'))[_0x737a('0x15')](_0x27ccd9)[_0x737a('0x16')]('hex');}exports[_0x737a('0x17')]=function(){switch(os[_0x737a('0x18')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x737a('0x19')})[_0x737a('0x1a')]('\x0d\x0a','');default:var _0x64901f=getFirstInterface();var _0xd5dd7c=getCPUhash();var _0x1064c3=_0xd5dd7c+'|'+os[_0x737a('0x1b')]()+'|'+_0x64901f['macAddress']+'|'+_0x64901f[_0x737a('0x1c')];var _0x4a8323=crypto[_0x737a('0x13')](_0x737a('0x14'))['update'](_0x1064c3)[_0x737a('0x16')]('hex');return _0x4a8323['substring'](0x0,0x8)+'-'+_0x4a8323[_0x737a('0x1d')](0x8,0xc)+'-'+_0x4a8323[_0x737a('0x1d')](0xc,0x10)+'-'+_0x4a8323['substring'](0x10,0x14)+'-'+_0x4a8323[_0x737a('0x1d')](0x14);}}; \ No newline at end of file +var _0xdb94=['createHash','md5','digest','hex','getUuid','platform','win32','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','networkInterfaces','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join'];(function(_0x3f512b,_0x1b68f4){var _0x473acb=function(_0x28d346){while(--_0x28d346){_0x3f512b['push'](_0x3f512b['shift']());}};_0x473acb(++_0x1b68f4);}(_0xdb94,0xe5));var _0x4db9=function(_0x21dc06,_0x18a2c6){_0x21dc06=_0x21dc06-0x0;var _0x247a91=_0xdb94[_0x21dc06];return _0x247a91;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x4db9('0x0'));var machine=require(_0x4db9('0x1'));var exec=require('child_process')[_0x4db9('0x2')];function getInterfaces(){var _0x3b24a6=[];var _0x25b510=os[_0x4db9('0x3')]();var _0x1f05d4=_['orderBy'](_[_0x4db9('0x4')](_0x25b510));for(var _0x541226=0x0;_0x541226<_0x1f05d4[_0x4db9('0x5')];_0x541226++){var _0xc76bc1=_0x25b510[_0x1f05d4[_0x541226]][_0x4db9('0x6')](function(_0x3404f6){return _0x3404f6[_0x4db9('0x7')]==='IPv4'&&_0x3404f6[_0x4db9('0x8')]===![];});_0x3b24a6=_0x3b24a6[_0x4db9('0x9')](_0xc76bc1);}return _0x3b24a6;}function getFirstInterface(){var _0x2d1d38=_[_0x4db9('0xa')](getInterfaces());return{'macAddress':_0x2d1d38&&_0x2d1d38[_0x4db9('0xb')]?_0x2d1d38['mac']:_0x4db9('0xc'),'ipAddress':_0x2d1d38&&_0x2d1d38[_0x4db9('0xd')]?_0x2d1d38[_0x4db9('0xd')]:_0x4db9('0xe')};}exports[_0x4db9('0xf')]=getFirstInterface;function getCPUhash(){var _0x3d1b96=_['orderBy'](os[_0x4db9('0x10')]()[_0x4db9('0x11')](function(_0x59f01c){return _0x59f01c['model'];}))[_0x4db9('0x12')](':');return crypto[_0x4db9('0x13')](_0x4db9('0x14'))['update'](_0x3d1b96)[_0x4db9('0x15')](_0x4db9('0x16'));}exports[_0x4db9('0x17')]=function(){switch(os[_0x4db9('0x18')]()){case _0x4db9('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4db9('0x1a')})[_0x4db9('0x1b')]('\x0d\x0a','');default:var _0x5d4d70=getFirstInterface();var _0x27b387=getCPUhash();var _0x7df575=_0x27b387+'|'+os[_0x4db9('0x1c')]()+'|'+_0x5d4d70['macAddress']+'|'+_0x5d4d70[_0x4db9('0x1d')];var _0x3b0863=crypto['createHash']('md5')['update'](_0x7df575)[_0x4db9('0x15')](_0x4db9('0x16'));return _0x3b0863['substring'](0x0,0x8)+'-'+_0x3b0863[_0x4db9('0x1e')](0x8,0xc)+'-'+_0x3b0863[_0x4db9('0x1e')](0xc,0x10)+'-'+_0x3b0863[_0x4db9('0x1e')](0x10,0x14)+'-'+_0x3b0863[_0x4db9('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b700bfa..123b9f7 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 _0x8560=['catch','User','findOne','fullname','email','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','license','data2','info','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','update','error','message','finally','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','../../api/jira/jira.controller','process','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then'];(function(_0xfc31a5,_0x190830){var _0x55949d=function(_0x2263c5){while(--_0x2263c5){_0xfc31a5['push'](_0xfc31a5['shift']());}};_0x55949d(++_0x190830);}(_0x8560,0x92));var _0x0856=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8560[_0x376b45];return _0x2341b3;};'use strict';var util=require('util');var moment=require(_0x0856('0x0'));var rp=require(_0x0856('0x1'));var BPromise=require(_0x0856('0x2'));var pkginfo=require(_0x0856('0x3'))(module,_0x0856('0x4'));var db=require(_0x0856('0x5'))['db'];var encryptor=require(_0x0856('0x6'));var hardware=require('./hardware');var logger=require(_0x0856('0x7'))('license');var jira=require(_0x0856('0x8'));const {config}=require(_0x0856('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2f537d){return new BPromise(function(_0x408c63,_0x4b4a8d){var _0x481da6=util[_0x0856('0xa')](_0x0856('0xb'),HOST,_0x2f537d,module[_0x0856('0xc')][_0x0856('0x4')]);if(oldToken){_0x481da6=util[_0x0856('0xa')](_0x0856('0xd'),HOST,_0x2f537d,module[_0x0856('0xc')][_0x0856('0x4')],oldToken);}var _0x589307={'uri':_0x481da6,'method':_0x0856('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x589307)[_0x0856('0xf')](function(_0x12fd4f){_0x408c63(_0x12fd4f);})[_0x0856('0x10')](function(_0x208693){_0x4b4a8d(_0x208693);});});}function sendJiraAlert(_0x218cc9,_0x1ac502,_0x7881da){var _0x23f1aa='||FIELD||VALUE||\x0a';return db[_0x0856('0x11')][_0x0856('0x12')]({'where':{'role':'admin'},'attributes':[_0x0856('0x13'),_0x0856('0x14')],'raw':!![]})[_0x0856('0xf')](function(_0x2cd6cb){ADMIN=_0x2cd6cb;_0x23f1aa+='|reason|'+_0x7881da+'|\x0a';_0x23f1aa+=_0x0856('0x15')+_0x218cc9+'|\x0a';_0x23f1aa+=_0x0856('0x16')+_0x1ac502+'|\x0a';_0x23f1aa+=_0x0856('0x17')+ADMIN[_0x0856('0x13')]+'|\x0a';_0x23f1aa+=_0x0856('0x18')+ADMIN[_0x0856('0x14')]+'|\x0a';return _0x23f1aa;})[_0x0856('0xf')](function(_0x323f68){var _0x502375=hardware[_0x0856('0x19')]()[_0x0856('0x1a')];return jira[_0x0856('0x1b')]({'key':'MOTLICENSE','summary':_0x0856('0x1c'),'description':_0x323f68,'issuetype':_0x0856('0x1d'),'oldToken':_0x218cc9,'newToken':_0x1ac502,'email':ADMIN[_0x0856('0x14')],'name':ADMIN[_0x0856('0x13')],'reason':GRAY_PERIOD_REASON,'ip':_0x502375});});}function manageLicense(_0x5920a8,_0x4745f5){var _0xbe0cbd=_0x4745f5[_0x0856('0x1e')]({'plain':!![]});httpRequest(_0x5920a8)[_0x0856('0xf')](function(_0x1bfd3b){if(oldToken){oldToken=undefined;}if(_0x1bfd3b['active']){if(!_0xbe0cbd['license']&&_0xbe0cbd[_0x0856('0x1f')]!=_0x1bfd3b['license']||_0xbe0cbd['license']&&_0xbe0cbd[_0x0856('0x20')]){logger[_0x0856('0x21')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xbe0cbd[_0x0856('0x1f')]&&!_0xbe0cbd[_0x0856('0x20')]&&_0xbe0cbd['license']!=_0x1bfd3b[_0x0856('0x1f')]){logger[_0x0856('0x21')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xbe0cbd[_0x0856('0x1f')]&&!_0xbe0cbd[_0x0856('0x20')]&&_0xbe0cbd['license']==_0x1bfd3b['license']){return _0x4745f5;}return _0x4745f5['update']({'data1':_0x5920a8,'data2':null,'license':_0x1bfd3b[_0x0856('0x1f')]});}else{if(_0x1bfd3b[_0x0856('0x1f')]||_0xbe0cbd['license']){if(!_0xbe0cbd[_0x0856('0x20')]){if(_0xbe0cbd[_0x0856('0x22')]==_0x5920a8){GRAY_PERIOD_REASON=_0x0856('0x23');logger['info'](_0x0856('0x24'));}else{GRAY_PERIOD_REASON=_0x0856('0x25');oldToken=_0xbe0cbd[_0x0856('0x22')];logger[_0x0856('0x21')](_0x0856('0x26'),_0xbe0cbd['data1'],_0x5920a8);}sendJiraAlert(_0xbe0cbd[_0x0856('0x22')],_0x1bfd3b['uuid'],GRAY_PERIOD_REASON);logger[_0x0856('0x21')](_0x0856('0x27'),GRAY_PERIOD_REASON[_0x0856('0x28')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x4745f5['update']({'data2':encryptor[_0x0856('0x29')](moment()[_0x0856('0xa')](_0x0856('0x2a')))});}else{if(moment()[_0x0856('0x2b')](encryptor[_0x0856('0x2c')](_0xbe0cbd['data2']),_0x0856('0x2d'))>DAYS){logger[_0x0856('0x21')]('DEMO\x20START\x20AT\x20%s',moment()[_0x0856('0xa')](_0x0856('0x2a')));return _0x4745f5[_0x0856('0x2e')]({'data1':_0x5920a8,'data2':null,'license':null});}}}else{if(_0xbe0cbd['data1']!=_0x5920a8){logger[_0x0856('0x21')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xbe0cbd['data1'],_0x5920a8);return _0x4745f5[_0x0856('0x2e')]({'data1':_0x5920a8,'data2':null,'license':null});}}}return _0x4745f5;})['then'](function(_0x21bfda){_0x4745f5=_0x21bfda;})[_0x0856('0x10')](function(_0x50ba66){logger[_0x0856('0x2f')](_0x50ba66[_0x0856('0x30')]);})[_0x0856('0x31')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4745f5);},TIME);});}function defaultLicense(){var _0x3ad70c=hardware['getUuid']();if(_0x3ad70c){return db['License'][_0x0856('0x32')]({'where':{'id':0x1},'defaults':{'data1':_0x3ad70c}})[_0x0856('0x33')](function(_0x8444a3,_0x3586d2){logger[_0x0856('0x21')](_0x0856('0x34'),_0x3ad70c);manageLicense(_0x3ad70c,_0x8444a3);})['catch'](function(_0x52f8ba){logger['error'](_0x52f8ba[_0x0856('0x30')]);});}}exports[_0x0856('0x35')]=defaultLicense; \ No newline at end of file +var _0xa8c5=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','update','error','message','finally','getUuid','License','findOrCreate','default','util','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','|reason|','|machineUuid|','|name|','fullname','|email|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa8c5,0x165));var _0x5a8c=function(_0x24c9d0,_0x4967b6){_0x24c9d0=_0x24c9d0-0x0;var _0x58c87f=_0xa8c5[_0x24c9d0];return _0x58c87f;};'use strict';var util=require(_0x5a8c('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x5a8c('0x1'))(module,_0x5a8c('0x2'));var db=require(_0x5a8c('0x3'))['db'];var encryptor=require(_0x5a8c('0x4'));var hardware=require(_0x5a8c('0x5'));var logger=require(_0x5a8c('0x6'))(_0x5a8c('0x7'));var jira=require(_0x5a8c('0x8'));const {config}=require('process');var HOST=_0x5a8c('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x64165c){return new BPromise(function(_0x1f4e0c,_0x139916){var _0x3d4c17=util[_0x5a8c('0xa')](_0x5a8c('0xb'),HOST,_0x64165c,module[_0x5a8c('0xc')]['version']);if(oldToken){_0x3d4c17=util['format'](_0x5a8c('0xd'),HOST,_0x64165c,module[_0x5a8c('0xc')]['version'],oldToken);}var _0xfd9db4={'uri':_0x3d4c17,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xfd9db4)[_0x5a8c('0xe')](function(_0xfe1176){_0x1f4e0c(_0xfe1176);})[_0x5a8c('0xf')](function(_0x3687c2){_0x139916(_0x3687c2);});});}function sendJiraAlert(_0x44372c,_0x171a95,_0x3003fe){var _0x8eb601=_0x5a8c('0x10');return db[_0x5a8c('0x11')][_0x5a8c('0x12')]({'where':{'role':_0x5a8c('0x13')},'attributes':['fullname','email'],'raw':!![]})[_0x5a8c('0xe')](function(_0x30d25e){ADMIN=_0x30d25e;_0x8eb601+=_0x5a8c('0x14')+_0x3003fe+'|\x0a';_0x8eb601+='|uuid|'+_0x44372c+'|\x0a';_0x8eb601+=_0x5a8c('0x15')+_0x171a95+'|\x0a';_0x8eb601+=_0x5a8c('0x16')+ADMIN[_0x5a8c('0x17')]+'|\x0a';_0x8eb601+=_0x5a8c('0x18')+ADMIN[_0x5a8c('0x19')]+'|\x0a';return _0x8eb601;})[_0x5a8c('0xe')](function(_0xcdf5d0){var _0x529fda=hardware[_0x5a8c('0x1a')]()[_0x5a8c('0x1b')];return jira[_0x5a8c('0x1c')]({'key':_0x5a8c('0x1d'),'summary':_0x5a8c('0x1e'),'description':_0xcdf5d0,'issuetype':_0x5a8c('0x1f'),'oldToken':_0x44372c,'newToken':_0x171a95,'email':ADMIN[_0x5a8c('0x19')],'name':ADMIN[_0x5a8c('0x17')],'reason':GRAY_PERIOD_REASON,'ip':_0x529fda});});}function manageLicense(_0x206c0e,_0x517110){var _0x2e2bdd=_0x517110[_0x5a8c('0x20')]({'plain':!![]});httpRequest(_0x206c0e)[_0x5a8c('0xe')](function(_0x493f37){if(oldToken){oldToken=undefined;}if(_0x493f37[_0x5a8c('0x21')]){if(!_0x2e2bdd[_0x5a8c('0x7')]&&_0x2e2bdd[_0x5a8c('0x7')]!=_0x493f37[_0x5a8c('0x7')]||_0x2e2bdd[_0x5a8c('0x7')]&&_0x2e2bdd[_0x5a8c('0x22')]){logger['info'](_0x5a8c('0x23'));}if(_0x2e2bdd[_0x5a8c('0x7')]&&!_0x2e2bdd[_0x5a8c('0x22')]&&_0x2e2bdd[_0x5a8c('0x7')]!=_0x493f37[_0x5a8c('0x7')]){logger[_0x5a8c('0x24')](_0x5a8c('0x25'));}if(_0x2e2bdd[_0x5a8c('0x7')]&&!_0x2e2bdd[_0x5a8c('0x22')]&&_0x2e2bdd[_0x5a8c('0x7')]==_0x493f37[_0x5a8c('0x7')]){return _0x517110;}return _0x517110['update']({'data1':_0x206c0e,'data2':null,'license':_0x493f37[_0x5a8c('0x7')]});}else{if(_0x493f37[_0x5a8c('0x7')]||_0x2e2bdd[_0x5a8c('0x7')]){if(!_0x2e2bdd[_0x5a8c('0x22')]){if(_0x2e2bdd[_0x5a8c('0x26')]==_0x206c0e){GRAY_PERIOD_REASON=_0x5a8c('0x27');logger[_0x5a8c('0x24')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x5a8c('0x28');oldToken=_0x2e2bdd['data1'];logger[_0x5a8c('0x24')](_0x5a8c('0x29'),_0x2e2bdd[_0x5a8c('0x26')],_0x206c0e);}sendJiraAlert(_0x2e2bdd[_0x5a8c('0x26')],_0x493f37['uuid'],GRAY_PERIOD_REASON);logger[_0x5a8c('0x24')](_0x5a8c('0x2a'),GRAY_PERIOD_REASON[_0x5a8c('0x2b')](),moment()['format'](_0x5a8c('0x2c')));return _0x517110['update']({'data2':encryptor[_0x5a8c('0x2d')](moment()[_0x5a8c('0xa')](_0x5a8c('0x2c')))});}else{if(moment()['diff'](encryptor[_0x5a8c('0x2e')](_0x2e2bdd[_0x5a8c('0x22')]),_0x5a8c('0x2f'))>DAYS){logger[_0x5a8c('0x24')]('DEMO\x20START\x20AT\x20%s',moment()[_0x5a8c('0xa')](_0x5a8c('0x2c')));return _0x517110[_0x5a8c('0x30')]({'data1':_0x206c0e,'data2':null,'license':null});}}}else{if(_0x2e2bdd[_0x5a8c('0x26')]!=_0x206c0e){logger[_0x5a8c('0x24')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2e2bdd[_0x5a8c('0x26')],_0x206c0e);return _0x517110['update']({'data1':_0x206c0e,'data2':null,'license':null});}}}return _0x517110;})[_0x5a8c('0xe')](function(_0xaf0fd1){_0x517110=_0xaf0fd1;})['catch'](function(_0x32220a){logger[_0x5a8c('0x31')](_0x32220a[_0x5a8c('0x32')]);})[_0x5a8c('0x33')](function(){setTimeout(function(){manageLicense(hardware[_0x5a8c('0x34')](),_0x517110);},TIME);});}function defaultLicense(){var _0x431a29=hardware[_0x5a8c('0x34')]();if(_0x431a29){return db[_0x5a8c('0x35')][_0x5a8c('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x431a29}})['spread'](function(_0x4a2f66,_0x48b51e){logger[_0x5a8c('0x24')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x431a29);manageLicense(_0x431a29,_0x4a2f66);})[_0x5a8c('0xf')](function(_0x42a40c){logger[_0x5a8c('0x31')](_0x42a40c[_0x5a8c('0x32')]);});}}exports[_0x5a8c('0x37')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6cf1803..00a05fc 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 _0x6305=['find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline','add','changed','disabled','message','User','findAll','role','sequelize','admin','telephone','users','telephones','user','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0x6305,0x179));var _0x5630=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6305[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0x5630('0x0'));var _=require(_0x5630('0x1'));var moment=require(_0x5630('0x2'));var BPromise=require(_0x5630('0x3'));var hardware=require('./hardware');var encryptor=require(_0x5630('0x4'));var db=require(_0x5630('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5630('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x5630('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5630('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5630('0x8'),'machineUuid':hardware[_0x5630('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x48dd2b){return new BPromise(function(_0x51447f,_0x406409){return db[_0x5630('0x9')][_0x5630('0xa')](_['defaults'](_0x48dd2b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x41a4a0){return checkLicense(_0x41a4a0,null);})[_0x5630('0xb')](function(_0xc06703){_0x51447f(_0xc06703);return;})[_0x5630('0xc')](function(_0x1e9b64){_0x406409(_0x1e9b64);});});}function checkLicense(_0x533e07,_0x328d8d){if(!_0x533e07){demoLicense[_0x5630('0xd')]=_0x533e07[_0x5630('0xe')];return demoLicense;}try{var _0x55e3c7=_0x328d8d||_0x533e07[_0x5630('0xf')];if(_[_0x5630('0x10')](_0x55e3c7)){throw new Error(_0x5630('0x11'));}var _0x2ec972=_0x533e07[_0x5630('0xe')];var _0x140301=_0x533e07['data2'];var _0x231b2c=_0x2ec972['split']('-')[0x4];var _0x119661=_0x2ec972[_0x5630('0x12')]('-')[0x0];var _0x368ae1=encryptor[_0x5630('0x13')](_0x55e3c7,util[_0x5630('0x14')](_0x5630('0x15'),_0x231b2c,_0x2ec972,_0x119661));var _0x91c189=JSON['parse'](_0x368ae1);_0x91c189[_0x5630('0x16')]=![];_0x91c189[_0x5630('0xd')]=_0x2ec972;_0x91c189[_0x5630('0x17')]=hardware[_0x5630('0x7')]();if(_0x140301){var _0x236c9a=encryptor[_0x5630('0x13')](_0x140301);_0x91c189[_0x5630('0x18')]=_0x236c9a;_0x91c189[_0x5630('0x19')]=moment(_0x236c9a)[_0x5630('0x1a')](0x7,'days')[_0x5630('0x14')]();_0x91c189['grayReason']=_0x91c189[_0x5630('0xd')]!=_0x91c189[_0x5630('0x17')]?_0x5630('0x1b'):_0x5630('0x1c');}return _0x91c189;}catch(_0x2f5dc9){breakingLicense[_0x5630('0xd')]=_0x533e07[_0x5630('0xe')];breakingLicense[_0x5630('0x1d')]=_0x2f5dc9[_0x5630('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x539680,_0x416f65){getLicense()[_0x5630('0xb')](function(_0x2fb00d){return db[_0x5630('0x1e')][_0x5630('0x1f')]({'attributes':[_0x5630('0x20'),[db[_0x5630('0x21')]['fn']('COUNT',db[_0x5630('0x21')]['col']('role')),'count']],'group':_0x5630('0x20'),'where':{'role':{'$or':[_0x5630('0x22'),'user',_0x5630('0x23')]}},'raw':!![]})[_0x5630('0xb')](function(_0x2a86e2){var _0x5b1c34={'user':_0x2fb00d[_0x5630('0x24')]||0x0,'telephone':_0x2fb00d[_0x5630('0x25')]||0x0};_0x2a86e2['forEach'](function(_0x1dd6df){var _0x25c0ce=_0x1dd6df['role']==='admin'?_0x5630('0x26'):_0x1dd6df[_0x5630('0x20')];_0x5b1c34[_0x25c0ce]-=_0x1dd6df['count'];if(_0x5b1c34[_0x25c0ce]<0x0)_0x5b1c34[_0x25c0ce]=0x0;});_0x539680(_0x5b1c34);return;});})['catch'](function(_0x2abd4e){_0x416f65(_0x2abd4e);});});}function checkUserLimits(_0x530641){return new BPromise(function(_0x2bc47d,_0x4dc0c7){getLimits()[_0x5630('0xb')](function(_0x41ad0b){var _0x48fae6=_[_0x5630('0x27')](_['countBy'](_0x530641,_0x5630('0x20')),['admin',_0x5630('0x26'),_0x5630('0x23')]);var _0x4d8a8d=(_0x48fae6[_0x5630('0x22')]||0x0)+(_0x48fae6[_0x5630('0x26')]||0x0);var _0x288d44=_0x48fae6[_0x5630('0x23')]||0x0;if(_0x4d8a8d>_0x41ad0b[_0x5630('0x26')])return _0x4dc0c7(_0x5630('0x28'));if(_0x288d44>_0x41ad0b['telephone'])return _0x4dc0c7(_0x5630('0x29'));return _0x2bc47d();})[_0x5630('0xc')](function(_0x163e86){_0x4dc0c7(_0x163e86);});});}module[_0x5630('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb3dc=['../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','format','grayReason','uuid','machineUuid','changed','disabled','message','User','findAll','role','COUNT','col','count','admin','user','telephone','users','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor'];(function(_0x20d75f,_0x377791){var _0x44d60e=function(_0x3ef1aa){while(--_0x3ef1aa){_0x20d75f['push'](_0x20d75f['shift']());}};_0x44d60e(++_0x377791);}(_0xb3dc,0x8b));var _0xcb3d=function(_0xb200f0,_0x5d9c21){_0xb200f0=_0xb200f0-0x0;var _0x4a699e=_0xb3dc[_0xb200f0];return _0x4a699e;};'use strict';var util=require('util');var _=require(_0xcb3d('0x0'));var moment=require(_0xcb3d('0x1'));var BPromise=require(_0xcb3d('0x2'));var hardware=require(_0xcb3d('0x3'));var encryptor=require(_0xcb3d('0x4'));var db=require(_0xcb3d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcb3d('0x6'),'machineUuid':hardware[_0xcb3d('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcb3d('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcb3d('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4a974b){return new BPromise(function(_0x2b0b28,_0x24890e){return db[_0xcb3d('0xa')][_0xcb3d('0xb')](_['defaults'](_0x4a974b,{'raw':!![],'where':{'id':0x1}}))[_0xcb3d('0xc')](function(_0x4552e1){return checkLicense(_0x4552e1,null);})[_0xcb3d('0xc')](function(_0x17c6f9){_0x2b0b28(_0x17c6f9);return;})[_0xcb3d('0xd')](function(_0x13a7d9){_0x24890e(_0x13a7d9);});});}function checkLicense(_0x5a680d,_0x3365d4){if(!_0x5a680d){demoLicense['uuid']=_0x5a680d[_0xcb3d('0xe')];return demoLicense;}try{var _0x5e8d5e=_0x3365d4||_0x5a680d['license'];if(_[_0xcb3d('0xf')](_0x5e8d5e)){throw new Error(_0xcb3d('0x10'));}var _0x3be594=_0x5a680d['data1'];var _0x4be291=_0x5a680d['data2'];var _0x422ac1=_0x3be594[_0xcb3d('0x11')]('-')[0x4];var _0x1809fd=_0x3be594[_0xcb3d('0x11')]('-')[0x0];var _0x473b04=encryptor[_0xcb3d('0x12')](_0x5e8d5e,util['format'](_0xcb3d('0x13'),_0x422ac1,_0x3be594,_0x1809fd));var _0x479491=JSON[_0xcb3d('0x14')](_0x473b04);_0x479491[_0xcb3d('0x15')]=![];_0x479491['uuid']=_0x3be594;_0x479491['machineUuid']=hardware[_0xcb3d('0x7')]();if(_0x4be291){var _0x64436d=encryptor[_0xcb3d('0x12')](_0x4be291);_0x479491[_0xcb3d('0x16')]=_0x64436d;_0x479491[_0xcb3d('0x17')]=moment(_0x64436d)[_0xcb3d('0x18')](0x7,'days')[_0xcb3d('0x19')]();_0x479491[_0xcb3d('0x1a')]=_0x479491[_0xcb3d('0x1b')]!=_0x479491[_0xcb3d('0x1c')]?_0xcb3d('0x1d'):_0xcb3d('0x1e');}return _0x479491;}catch(_0xf5d6a6){breakingLicense['uuid']=_0x5a680d[_0xcb3d('0xe')];breakingLicense[_0xcb3d('0x1f')]=_0xf5d6a6[_0xcb3d('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x46d098,_0x5dbf3c){getLicense()[_0xcb3d('0xc')](function(_0x4663d4){return db[_0xcb3d('0x20')][_0xcb3d('0x21')]({'attributes':[_0xcb3d('0x22'),[db['sequelize']['fn'](_0xcb3d('0x23'),db['sequelize'][_0xcb3d('0x24')]('role')),_0xcb3d('0x25')]],'group':_0xcb3d('0x22'),'where':{'role':{'$or':[_0xcb3d('0x26'),_0xcb3d('0x27'),_0xcb3d('0x28')]}},'raw':!![]})[_0xcb3d('0xc')](function(_0x315ed6){var _0x19835a={'user':_0x4663d4[_0xcb3d('0x29')]||0x0,'telephone':_0x4663d4['telephones']||0x0};_0x315ed6[_0xcb3d('0x2a')](function(_0x17dcb7){var _0x2d1044=_0x17dcb7[_0xcb3d('0x22')]===_0xcb3d('0x26')?_0xcb3d('0x27'):_0x17dcb7[_0xcb3d('0x22')];_0x19835a[_0x2d1044]-=_0x17dcb7['count'];if(_0x19835a[_0x2d1044]<0x0)_0x19835a[_0x2d1044]=0x0;});_0x46d098(_0x19835a);return;});})[_0xcb3d('0xd')](function(_0x3bee9a){_0x5dbf3c(_0x3bee9a);});});}function checkUserLimits(_0x4c9df1){return new BPromise(function(_0x574106,_0x2525d3){getLimits()['then'](function(_0x2cf172){var _0x373c21=_[_0xcb3d('0x2b')](_[_0xcb3d('0x2c')](_0x4c9df1,_0xcb3d('0x22')),[_0xcb3d('0x26'),_0xcb3d('0x27'),_0xcb3d('0x28')]);var _0x236481=(_0x373c21[_0xcb3d('0x26')]||0x0)+(_0x373c21[_0xcb3d('0x27')]||0x0);var _0x42dd41=_0x373c21[_0xcb3d('0x28')]||0x0;if(_0x236481>_0x2cf172[_0xcb3d('0x27')])return _0x2525d3(_0xcb3d('0x2d'));if(_0x42dd41>_0x2cf172[_0xcb3d('0x28')])return _0x2525d3(_0xcb3d('0x2e'));return _0x574106();})[_0xcb3d('0xd')](function(_0x1fb0b6){_0x2525d3(_0x1fb0b6);});});}module[_0xcb3d('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d9c1176..235be0a 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 _0xfe1b=['app-id','secret','myappanuglar-secret'];(function(_0x43cbc9,_0x789f50){var _0x1c0ec5=function(_0x2fb0f4){while(--_0x2fb0f4){_0x43cbc9['push'](_0x43cbc9['shift']());}};_0x1c0ec5(++_0x789f50);}(_0xfe1b,0x15e));var _0xbfe1=function(_0x1de104,_0x5d7701){_0x1de104=_0x1de104-0x0;var _0x351a5f=_0xfe1b[_0x1de104];return _0x351a5f;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbfe1('0x0'),'GOOGLE_ID':_0xbfe1('0x1'),'GOOGLE_SECRET':_0xbfe1('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x2edc=['secret','exports','myappanuglar-secret','app-id'];(function(_0x275c2b,_0x36eb55){var _0xb9ec67=function(_0x1147b0){while(--_0x1147b0){_0x275c2b['push'](_0x275c2b['shift']());}};_0xb9ec67(++_0x36eb55);}(_0x2edc,0x1d5));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xc2ed('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc2ed('0x1'),'GOOGLE_ID':_0xc2ed('0x2'),'GOOGLE_SECRET':_0xc2ed('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f2b01ab..4cd2415 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94f3=['{{{','replace','}}}','level','toUpperCase','exports','transports','File','error','%s-%s','info','debugLevel','moment','join','xcally','format','%s-%s.log','message'];(function(_0x444c70,_0x58d3d9){var _0x93886f=function(_0x103bd2){while(--_0x103bd2){_0x444c70['push'](_0x444c70['shift']());}};_0x93886f(++_0x58d3d9);}(_0x94f3,0x198));var _0x394f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x94f3[_0x57b54c];return _0x59cc19;};'use strict';var moment=require(_0x394f('0x0'));var winston=require('winston');var util=require('util');var path=require('path');var debugLevel='INFO';function filename(_0x4b2f15,_0x42ddc4){return path[_0x394f('0x1')]('/var','log',_0x394f('0x2'),util[_0x394f('0x3')](_0x394f('0x4'),_0x4b2f15,_0x42ddc4));}function formatter(_0x4b161e,_0x1482c4){_0x1482c4[_0x394f('0x5')]=_0x1482c4['message']['replace'](/@@{/g,_0x394f('0x6'))[_0x394f('0x7')](/}@@/g,_0x394f('0x8'))['replace'](/@{/g,'{{')[_0x394f('0x7')](/}@/g,'}}');return util[_0x394f('0x3')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x394f('0x3')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1482c4[_0x394f('0x9')][_0x394f('0xa')](),_0x4b161e,_0x1482c4[_0x394f('0x5')]);}module[_0x394f('0xb')]=function(_0x140093){return new winston['Logger']({'transports':[new winston[(_0x394f('0xc'))][(_0x394f('0xd'))]({'name':util[_0x394f('0x3')]('%s-%s',_0x140093,_0x394f('0xe')),'filename':filename(_0x140093,'error'),'level':_0x394f('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58ed1f){return formatter(_0x140093,_0x58ed1f);}}),new winston[(_0x394f('0xc'))][(_0x394f('0xd'))]({'name':util[_0x394f('0x3')](_0x394f('0xf'),_0x140093,_0x394f('0x10')),'filename':filename(_0x140093,_0x394f('0x10')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1af953){return formatter(_0x140093,_0x1af953);}}),new winston['transports']['Console']({'level':process['env'][_0x394f('0x11')]||debugLevel,'json':![],'formatter':function(_0xb5732){return formatter(_0x140093,_0xb5732);}})]});}; \ No newline at end of file +var _0xae3c=['File','%s-%s','error','info','env','winston','util','path','INFO','join','/var','log','%s-%s.log','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports'];(function(_0x533bd4,_0x2826d4){var _0x3089f7=function(_0x510a52){while(--_0x510a52){_0x533bd4['push'](_0x533bd4['shift']());}};_0x3089f7(++_0x2826d4);}(_0xae3c,0x8f));var _0xcae3=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xae3c[_0x602ca8];return _0x26e8ab;};'use strict';var moment=require('moment');var winston=require(_0xcae3('0x0'));var util=require(_0xcae3('0x1'));var path=require(_0xcae3('0x2'));var debugLevel=_0xcae3('0x3');function filename(_0x227b6d,_0x279f88){return path[_0xcae3('0x4')](_0xcae3('0x5'),_0xcae3('0x6'),'xcally',util['format'](_0xcae3('0x7'),_0x227b6d,_0x279f88));}function formatter(_0x56de99,_0x2fe7db){_0x2fe7db[_0xcae3('0x8')]=_0x2fe7db[_0xcae3('0x8')][_0xcae3('0x9')](/@@{/g,'{{{')[_0xcae3('0x9')](/}@@/g,'}}}')[_0xcae3('0x9')](/@{/g,'{{')[_0xcae3('0x9')](/}@/g,'}}');return util['format'](_0xcae3('0xa'),moment()[_0xcae3('0xb')](_0xcae3('0xc')),_0x2fe7db[_0xcae3('0xd')][_0xcae3('0xe')](),_0x56de99,_0x2fe7db['message']);}module[_0xcae3('0xf')]=function(_0x3675dc){return new winston[(_0xcae3('0x10'))]({'transports':[new winston[(_0xcae3('0x11'))][(_0xcae3('0x12'))]({'name':util[_0xcae3('0xb')](_0xcae3('0x13'),_0x3675dc,'error'),'filename':filename(_0x3675dc,_0xcae3('0x14')),'level':_0xcae3('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x41a58c){return formatter(_0x3675dc,_0x41a58c);}}),new winston[(_0xcae3('0x11'))][(_0xcae3('0x12'))]({'name':util['format'](_0xcae3('0x13'),_0x3675dc,_0xcae3('0x15')),'filename':filename(_0x3675dc,_0xcae3('0x15')),'level':_0xcae3('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5efb5b){return formatter(_0x3675dc,_0x5efb5b);}}),new winston['transports']['Console']({'level':process[_0xcae3('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x20fbac){return formatter(_0x3675dc,_0x20fbac);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2fa2506..e7674e4 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 _0x2908=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x146a62,_0x27b609){var _0x2c725d=function(_0xe61563){while(--_0xe61563){_0x146a62['push'](_0x146a62['shift']());}};_0x2c725d(++_0x27b609);}(_0x2908,0x1ef));var _0x8290=function(_0x21c324,_0x3d3f82){_0x21c324=_0x21c324-0x0;var _0x52612d=_0x2908[_0x21c324];return _0x52612d;};'use strict';var path=require(_0x8290('0x0'));var os=require('os');var config={'apps':[{'name':_0x8290('0x1'),'script':path[_0x8290('0x2')](__dirname,_0x8290('0x3'))},{'name':_0x8290('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0x8290('0x5'),'script':path['join'](__dirname,_0x8290('0x6'))},{'name':_0x8290('0x7'),'script':path['join'](__dirname,_0x8290('0x8'))},{'name':'routing','script':path[_0x8290('0x2')](__dirname,_0x8290('0x9'))},{'name':'xdr','script':path[_0x8290('0x2')](__dirname,_0x8290('0xa'))}]};module[_0x8290('0xb')]=config; \ No newline at end of file +var _0x27f9=['xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x27f9,0x73));var _0x927f=function(_0x295c29,_0xe406c7){_0x295c29=_0x295c29-0x0;var _0x515488=_0x27f9[_0x295c29];return _0x515488;};'use strict';var path=require(_0x927f('0x0'));var os=require('os');var config={'apps':[{'name':_0x927f('0x1'),'script':path['join'](__dirname,_0x927f('0x2'))},{'name':_0x927f('0x3'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0x5'))},{'name':_0x927f('0x6'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0x7'))},{'name':_0x927f('0x8'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0x9'))},{'name':'routing','script':path[_0x927f('0x4')](__dirname,_0x927f('0xa'))},{'name':_0x927f('0xb'),'script':path[_0x927f('0x4')](__dirname,_0x927f('0xc'))}]};module[_0x927f('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9a5bed8..2ea5746 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 _0xdbb3=['dump','saved','pm2','bluebird','./config','connected','start','then','stop','disconnect','restart','list','describe','delete'];(function(_0x58793b,_0x289a30){var _0x1977a9=function(_0xe2221){while(--_0xe2221){_0x58793b['push'](_0x58793b['shift']());}};_0x1977a9(++_0x289a30);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xdbb3[_0x6cf19c];return _0xce14f3;};'use strict';var pm2=require(_0x3dbb('0x0'));var BPromise=require(_0x3dbb('0x1'));var config=require(_0x3dbb('0x2'));function connect(){return new BPromise(function(_0x3fb380,_0x129124){return pm2['connect'](function(_0x4141ff){if(_0x4141ff){return _0x129124(_0x4141ff);}return _0x3fb380(_0x3dbb('0x3'));});});};exports[_0x3dbb('0x4')]=function(_0x5d4fce){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x3d0be3,_0x433118){return pm2['start'](_0x5d4fce,function(_0x1b72b0,_0x380291){if(_0x1b72b0){return _0x433118(_0x1b72b0);}pm2['disconnect']();return _0x3d0be3(_0x380291);});});});};exports[_0x3dbb('0x6')]=function(_0x4dd7bf){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x1d9a12,_0xa185b4){return pm2[_0x3dbb('0x6')](_0x4dd7bf,function(_0x491c74,_0x312bca){if(_0x491c74){return _0xa185b4(_0x491c74);}pm2[_0x3dbb('0x7')]();return _0x1d9a12(_0x312bca);});});});};exports[_0x3dbb('0x8')]=function(_0xe06a85){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x4bcb19,_0x398886){return pm2[_0x3dbb('0x8')](_0xe06a85,function(_0x5b3107,_0x1743aa){if(_0x5b3107){return _0x398886(_0x5b3107);}pm2['disconnect']();return _0x4bcb19(_0x1743aa);});});});};exports[_0x3dbb('0x9')]=function(){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x466b8c,_0x3bd5ea){return pm2[_0x3dbb('0x9')](function(_0xb0bb4c,_0x1df26b){if(_0xb0bb4c){return _0x3bd5ea(_0xb0bb4c);}pm2[_0x3dbb('0x7')]();return _0x466b8c(_0x1df26b);});});});};exports[_0x3dbb('0xa')]=function(_0x758918){return connect()['then'](function(){return new BPromise(function(_0x3b7b93,_0x171823){return pm2[_0x3dbb('0xa')](_0x758918,function(_0x4b938d,_0x108028){if(_0x4b938d){return _0x171823(_0x4b938d);}pm2[_0x3dbb('0x7')]();return _0x3b7b93(_0x108028);});});});};exports[_0x3dbb('0xb')]=function(_0x290afc){return connect()[_0x3dbb('0x5')](function(){return new BPromise(function(_0x21c12a,_0x3050c1){return pm2[_0x3dbb('0xb')](_0x290afc,function(_0x1141c9,_0x4c9d11){if(_0x1141c9){return _0x3050c1(_0x1141c9);}pm2[_0x3dbb('0x7')]();return _0x21c12a(_0x4c9d11);});});});};exports[_0x3dbb('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x23ded5,_0x19da63){return pm2[_0x3dbb('0xc')](function(_0x5eb635){if(_0x5eb635){return _0x19da63(_0x5eb635);}return _0x23ded5(_0x3dbb('0xd'));});});});}; \ No newline at end of file +var _0xbe2a=['restart','list','describe','delete','saved','pm2','bluebird','./config','connect','start','then','stop','disconnect'];(function(_0x29d750,_0x5cf499){var _0xaa8783=function(_0x1657db){while(--_0x1657db){_0x29d750['push'](_0x29d750['shift']());}};_0xaa8783(++_0x5cf499);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x339594,_0x4a6501){_0x339594=_0x339594-0x0;var _0x105d62=_0xbe2a[_0x339594];return _0x105d62;};'use strict';var pm2=require(_0xabe2('0x0'));var BPromise=require(_0xabe2('0x1'));var config=require(_0xabe2('0x2'));function connect(){return new BPromise(function(_0x101aac,_0x29d9a3){return pm2[_0xabe2('0x3')](function(_0x21e3ad){if(_0x21e3ad){return _0x29d9a3(_0x21e3ad);}return _0x101aac('connected');});});};exports[_0xabe2('0x4')]=function(_0x4f80bf){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x349bfd,_0x2ddf42){return pm2[_0xabe2('0x4')](_0x4f80bf,function(_0x3538a0,_0x138e22){if(_0x3538a0){return _0x2ddf42(_0x3538a0);}pm2['disconnect']();return _0x349bfd(_0x138e22);});});});};exports[_0xabe2('0x6')]=function(_0x1f10d7){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x432061,_0x229ac0){return pm2[_0xabe2('0x6')](_0x1f10d7,function(_0x53a91f,_0x27fbaa){if(_0x53a91f){return _0x229ac0(_0x53a91f);}pm2[_0xabe2('0x7')]();return _0x432061(_0x27fbaa);});});});};exports[_0xabe2('0x8')]=function(_0x546445){return connect()['then'](function(){return new BPromise(function(_0x5742c5,_0x33f1ac){return pm2['restart'](_0x546445,function(_0x10c3f3,_0x26febe){if(_0x10c3f3){return _0x33f1ac(_0x10c3f3);}pm2['disconnect']();return _0x5742c5(_0x26febe);});});});};exports['list']=function(){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x4303eb,_0xc8d55d){return pm2[_0xabe2('0x9')](function(_0x7aaa50,_0xb8343d){if(_0x7aaa50){return _0xc8d55d(_0x7aaa50);}pm2[_0xabe2('0x7')]();return _0x4303eb(_0xb8343d);});});});};exports[_0xabe2('0xa')]=function(_0x4196fd){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x5320d9,_0x3dd6d9){return pm2[_0xabe2('0xa')](_0x4196fd,function(_0x3eb2b2,_0x50f335){if(_0x3eb2b2){return _0x3dd6d9(_0x3eb2b2);}pm2[_0xabe2('0x7')]();return _0x5320d9(_0x50f335);});});});};exports[_0xabe2('0xb')]=function(_0x90ee5e){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x49c4c3,_0x190b08){return pm2[_0xabe2('0xb')](_0x90ee5e,function(_0x50a49a,_0x3e4c85){if(_0x50a49a){return _0x190b08(_0x50a49a);}pm2[_0xabe2('0x7')]();return _0x49c4c3(_0x3e4c85);});});});};exports['dump']=function(){return connect()[_0xabe2('0x5')](function(){return new BPromise(function(_0x3efadc,_0x2906f4){return pm2['dump'](function(_0x2004d4){if(_0x2004d4){return _0x2906f4(_0x2004d4);}return _0x3efadc(_0xabe2('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4c8fb9d..261827c 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 _0x865d=['../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','then','ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','minutes','info','join','update','system','timeout','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment'];(function(_0x119442,_0x1452f0){var _0x3503c8=function(_0x1b36f9){while(--_0x1b36f9){_0x119442['push'](_0x119442['shift']());}};_0x3503c8(++_0x1452f0);}(_0x865d,0x175));var _0xd865=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x865d[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xd865('0x0'));var moment=require('moment');var Redis=require(_0xd865('0x1'));var util=require(_0xd865('0x2'));var config=require(_0xd865('0x3'));var db=require(_0xd865('0x4'))['db'];var logger=require(_0xd865('0x5'))(_0xd865('0x6'));config[_0xd865('0x7')]=_[_0xd865('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd865('0x9'))(new Redis(config[_0xd865('0x7')]));function closeInteractions(){var _0x32bea5=0x0;var _0x4e2c7d=[];return db[_0xd865('0xa')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xd865('0xb')](function(_0xa0d7b1){_0x32bea5=_0xa0d7b1['chatTimeout'];if(_0x32bea5){return db[_0xd865('0xc')][_0xd865('0xd')]({'raw':!![],'attributes':['id',_0xd865('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd865('0xf')](_0xa0d7b1[_0xd865('0x10')],_0xd865('0x11'))}}});}else{return[];}})[_0xd865('0xb')](function(_0x5dec93){if(_0x5dec93&&_0x5dec93['length']){_0x4e2c7d=_['map'](_0x5dec93||[],'id');logger[_0xd865('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x4e2c7d[_0xd865('0x13')]());return db[_0xd865('0xc')][_0xd865('0x14')]({'closeReason':_0xd865('0x15'),'disposition':_0xd865('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4e2c7d}});}})[_0xd865('0xb')](function(){if(_0x4e2c7d&&_0x4e2c7d[_0xd865('0x17')]){logger[_0xd865('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x4e2c7d[_0xd865('0x13')]());for(var _0x5ee619=0x0;_0x5ee619<_0x4e2c7d[_0xd865('0x17')];_0x5ee619++){io['emit'](_0xd865('0x18'),{'id':_0x4e2c7d[_0x5ee619],'closed':!![]});}}})[_0xd865('0x19')](function(_0x313723){logger[_0xd865('0x1a')](_0xd865('0x1b'),_0x313723?util['inspect'](_0x313723,{'showHidden':![],'depth':null}):'');});}exports[_0xd865('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd4c5=['schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','inspect','start','lodash','ioredis','util','../../mysqldb','../logger'];(function(_0x490d5d,_0x40616d){var _0x4ff3b8=function(_0x845278){while(--_0x845278){_0x490d5d['push'](_0x490d5d['shift']());}};_0x4ff3b8(++_0x40616d);}(_0xd4c5,0x83));var _0x5d4c=function(_0x314aec,_0x5e4fdf){_0x314aec=_0x314aec-0x0;var _0x2e334f=_0xd4c5[_0x314aec];return _0x2e334f;};'use strict';var _=require(_0x5d4c('0x0'));var moment=require('moment');var Redis=require(_0x5d4c('0x1'));var util=require(_0x5d4c('0x2'));var config=require('../../config/environment');var db=require(_0x5d4c('0x3'))['db'];var logger=require(_0x5d4c('0x4'))(_0x5d4c('0x5'));config[_0x5d4c('0x6')]=_[_0x5d4c('0x7')](config[_0x5d4c('0x6')],{'host':_0x5d4c('0x8'),'port':0x18eb});var io=require(_0x5d4c('0x9'))(new Redis(config[_0x5d4c('0x6')]));function closeInteractions(){var _0x12300b=0x0;var _0x1f7a66=[];return db[_0x5d4c('0xa')][_0x5d4c('0xb')]({'raw':!![],'attributes':['id',_0x5d4c('0xc')],'where':{'id':0x1}})[_0x5d4c('0xd')](function(_0x5a79ec){_0x12300b=_0x5a79ec[_0x5d4c('0xc')];if(_0x12300b){return db['ChatInteraction'][_0x5d4c('0xe')]({'raw':!![],'attributes':['id',_0x5d4c('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5d4c('0x10')](_0x5a79ec[_0x5d4c('0xc')],_0x5d4c('0x11'))}}});}else{return[];}})[_0x5d4c('0xd')](function(_0x1c028d){if(_0x1c028d&&_0x1c028d[_0x5d4c('0x12')]){_0x1f7a66=_['map'](_0x1c028d||[],'id');logger[_0x5d4c('0x13')](_0x5d4c('0x14'),_0x1f7a66['join']());return db[_0x5d4c('0x15')][_0x5d4c('0x16')]({'closeReason':_0x5d4c('0x17'),'disposition':_0x5d4c('0x18'),'closed':!![],'closedAt':moment()['format'](_0x5d4c('0x19'))},{'where':{'id':_0x1f7a66}});}})[_0x5d4c('0xd')](function(){if(_0x1f7a66&&_0x1f7a66[_0x5d4c('0x12')]){logger[_0x5d4c('0x13')](_0x5d4c('0x1a'),_0x1f7a66[_0x5d4c('0x1b')]());for(var _0x20ce44=0x0;_0x20ce44<_0x1f7a66[_0x5d4c('0x12')];_0x20ce44++){io[_0x5d4c('0x1c')](_0x5d4c('0x1d'),{'id':_0x1f7a66[_0x20ce44],'closed':!![]});}}})[_0x5d4c('0x1e')](function(_0xfbf03f){logger[_0x5d4c('0x1f')]('[CHAT]\x20Error\x20closing\x20interactions',_0xfbf03f?util[_0x5d4c('0x20')](_0xfbf03f,{'showHidden':![],'depth':null}):'');});}exports[_0x5d4c('0x21')]=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 b9b66ae..96f9700 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 _0x7759=['request','SendMail','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','endAt','start','deleteJob','stop\x20cron','startAt','update','update\x20cron','run','util','path','moment','cron-job-manager','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent'];(function(_0x1d8d1a,_0x41fe02){var _0x309480=function(_0x1ff7c3){while(--_0x1ff7c3){_0x1d8d1a['push'](_0x1d8d1a['shift']());}};_0x309480(++_0x41fe02);}(_0x7759,0xda));var _0x9775=function(_0x57a825,_0x4de9d7){_0x57a825=_0x57a825-0x0;var _0x56c597=_0x7759[_0x57a825];return _0x56c597;};'use strict';var fs=require('fs');var util=require(_0x9775('0x0'));var path=require(_0x9775('0x1'));var _=require('lodash');var moment=require(_0x9775('0x2'));var CronJobManager=require(_0x9775('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x9775('0x4'))('schedule');var db=require(_0x9775('0x5'))['db'];var analyticCustomReportController=require(_0x9775('0x6'));var analyticDefaultReportController=require(_0x9775('0x7'));var client=jayson[_0x9775('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x283893,_0x47656c){return function(){logger[_0x9775('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x283893[_0x9775('0xa')]);var _0xcadc31=!![];var _0xb13ca2={'tls':{'rejectUnauthorized':![]}};if(_0x283893[_0x9775('0xb')]['Smtp'][_0x9775('0xc')]){_0xb13ca2[_0x9775('0xc')]=_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0xc')];}else{_0xb13ca2['host']=_0x283893[_0x9775('0xb')]['Smtp'][_0x9775('0xe')];_0xb13ca2['port']=_0x283893['MailAccount'][_0x9775('0xd')][_0x9775('0xf')];_0xb13ca2[_0x9775('0x10')]=_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0x10')];}if(_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0x11')]){_0xb13ca2[_0x9775('0x12')]={'user':_0x283893[_0x9775('0xb')]['Smtp'][_0x9775('0x13')],'pass':_0x283893['MailAccount'][_0x9775('0xd')][_0x9775('0x14')]};}var _0x343371={'account':_0xb13ca2,'message':{'from':util['format'](_0x9775('0x15'),_0x283893[_0x9775('0xb')][_0x9775('0x16')],_0x283893[_0x9775('0xb')]['email']||_0x283893[_0x9775('0xb')][_0x9775('0xd')][_0x9775('0x13')]),'to':_0x283893[_0x9775('0xa')],'cc':_0x283893['cc'],'bcc':_0x283893['bcc'],'subject':util[_0x9775('0x17')](_0x9775('0x18'),_0x47656c[_0x9775('0x16')],_0x283893[_0x9775('0x19')],_0x283893[_0x9775('0x1a')])}};var _0x4ad1e0=path[_0x9775('0x1b')](__dirname,_0x9775('0x1c'));var _0x439e4a=_0x47656c[_0x9775('0x1d')];var _0x21f39d=util[_0x9775('0x17')](_0x9775('0x1e'),path[_0x9775('0x1f')](_0x47656c[_0x9775('0x1d')],path[_0x9775('0x20')](_0x47656c[_0x9775('0x1d')])),'zip');var _0x25dbcc=path[_0x9775('0x1b')](_0x4ad1e0,_0x439e4a);var _0x20a12f=path['join'](_0x4ad1e0,_0x21f39d);if(fs[_0x9775('0x21')](_0x25dbcc)){_0x47656c[_0x9775('0x22')]=_0x9775('0x23');_0x343371[_0x9775('0x24')]['attachments']=[{'filename':_0x439e4a,'path':_0x25dbcc}];_0x343371['message'][_0x9775('0x25')]=util[_0x9775('0x17')](_0x9775('0x26'),JSON[_0x9775('0x27')](_0x47656c,null,0x2));}else if(fs['existsSync'](_0x20a12f)){_0x47656c[_0x9775('0x22')]=_0x9775('0x23');_0x343371['message']['attachments']=[{'filename':_0x21f39d,'path':_0x20a12f}];}else{_0x343371[_0x9775('0x24')][_0x9775('0x25')]=_0x9775('0x28');if(!_0x283893[_0x9775('0x29')]){_0xcadc31=![];logger['info'](_0x9775('0x2a'));}}if(_0xcadc31){return client[_0x9775('0x2b')](_0x9775('0x2c'),_0x343371)['then'](function(_0x4fc50d){if(_0x4fc50d[_0x9775('0x2d')]){return logger[_0x9775('0x2d')](_0x9775('0x2e'),JSON[_0x9775('0x27')](_0x4fc50d));}return logger[_0x9775('0x9')]('email\x20sent');})[_0x9775('0x2f')](function(_0x27311b){return logger[_0x9775('0x2d')](_0x9775('0x2e'),JSON['stringify'](_0x27311b));});}};}function handleError(){return function(_0x1b4b2d){return logger[_0x9775('0x2d')](JSON[_0x9775('0x27')](_0x1b4b2d));};}function handleResult(_0x3c2155){return function(_0x51c83d){logger['info']('data',JSON[_0x9775('0x27')](_0x51c83d));if(_0x3c2155[_0x9775('0xb')]&&_0x3c2155[_0x9775('0xb')][_0x9775('0xd')]&&!_['isNil'](_0x3c2155[_0x9775('0xa')])){setTimeout(handleSendEmail(_0x3c2155,_0x51c83d),0x3c*0x3e8);}};}function handleJob(_0x569759){return function(){try{if(_[_0x9775('0x30')](_0x569759[_0x9775('0x19')])){return logger[_0x9775('0x9')](_0x9775('0x31'));}if(_[_0x9775('0x30')](_0x569759[_0x9775('0x1a')])){return logger[_0x9775('0x9')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5c978d={'startDate':moment()[_0x9775('0x32')](_0x569759['subtractNumber'],_0x569759['subtractUnit'])[_0x9775('0x17')](_0x9775('0x33')),'endDate':moment()['format'](_0x9775('0x33')),'type':_0x9775('0x34'),'output':_0x569759['output'],'name':_0x569759[_0x9775('0x16')]};if(!_[_0x9775('0x30')](_0x569759['DefaultReportId'])){logger['info'](_0x9775('0x35'),_0x569759[_0x9775('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x569759[_0x9775('0x36')]},_0x5c978d)[_0x9775('0x37')](handleResult(_0x569759))[_0x9775('0x2f')](handleError());}if(!_['isNil'](_0x569759[_0x9775('0x38')])){logger['info'](_0x9775('0x39'),_0x569759[_0x9775('0x38')]);return analyticCustomReportController[_0x9775('0x3a')]({'id':_0x569759[_0x9775('0x38')]},_0x5c978d)[_0x9775('0x37')](handleResult(_0x569759))['catch'](handleError());}}catch(_0x3186c1){logger[_0x9775('0x2d')](JSON['stringify'](_0x3186c1));}return logger[_0x9775('0x9')](_0x9775('0x3b'));};}function getJobs(_0x31d497){var _0x175727={};if(_0x31d497){_0x175727['id']=_0x31d497;}return db['Schedule'][_0x9775('0x3c')]({'where':_0x175727,'include':[{'model':db['MailAccount'],'attributes':['id',_0x9775('0x16'),'email'],'include':[{'model':db[_0x9775('0x3d')],'as':'Smtp'}]}]})[_0x9775('0x37')](function(_0x410ffe){var _0x4d9e7a=_['keys'](manager[_0x9775('0x3e')]);var _0x1cbfa3=_[_0x9775('0x3f')](_0x410ffe,function(_0x37f17b){return _0x37f17b['id'][_0x9775('0x40')]();});var _0x1209cd=_[_0x9775('0x41')](_0x410ffe,function(_0x479e8d){return _0x479e8d['id'][_0x9775('0x40')]();});var _0x8eab=_0x31d497?_0x1cbfa3:_[_0x9775('0x42')](_0x1cbfa3,_0x4d9e7a);var _0x4fafe8=_[_0x9775('0x43')](_0x1cbfa3,_0x4d9e7a);var _0x4cec2e=_['difference'](_0x4d9e7a,_0x1cbfa3);var _0x17edad;var _0x227f20;for(_0x17edad=0x0;_0x17edad<_0x4cec2e[_0x9775('0x44')]&&!_0x31d497;_0x17edad+=0x1){_0x227f20=_0x4cec2e[_0x17edad][_0x9775('0x40')]();if(manager[_0x9775('0x45')](_0x227f20)){manager[_0x9775('0x46')](_0x227f20);manager['deleteJob'](_0x227f20);logger[_0x9775('0x9')](_0x9775('0x47'),_0x227f20);}}logger['info'](_0x9775('0x48'),JSON[_0x9775('0x27')](_0x8eab));for(_0x17edad=0x0;_0x17edad<_0x8eab['length'];_0x17edad+=0x1){_0x227f20=_0x8eab[_0x17edad][_0x9775('0x40')]();logger[_0x9775('0x9')](_0x9775('0x49'),_0x227f20);if(_0x31d497){logger[_0x9775('0x9')](_0x9775('0x4a'),_0x31d497);logger['info'](JSON[_0x9775('0x27')](_0x1209cd[_0x227f20]));BPromise[_0x9775('0x4b')]()['then'](handleJob(_0x1209cd[_0x227f20]));logger[_0x9775('0x9')]('run\x20job',_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}else if(_0x1209cd[_0x227f20][_0x9775('0x4c')]&&_0x1209cd[_0x227f20][_0x9775('0x4d')]&&moment()[_0x9775('0x4e')](_0x1209cd[_0x227f20]['startAt'],_0x1209cd[_0x227f20][_0x9775('0x4f')])){manager['add'](_0x227f20,_0x1209cd[_0x227f20][_0x9775('0x4c')],handleJob(_0x1209cd[_0x227f20]));manager[_0x9775('0x50')](_0x227f20);logger[_0x9775('0x9')]('add\x20cron',_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}else if(manager[_0x9775('0x45')](_0x227f20)){manager[_0x9775('0x46')](_0x227f20);manager[_0x9775('0x51')](_0x227f20);logger['info'](_0x9775('0x52'),_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}}for(_0x17edad=0x0,_0x227f20;_0x17edad<_0x4fafe8['length']&&!_0x31d497;_0x17edad+=0x1){_0x227f20=_0x4fafe8[_0x17edad][_0x9775('0x40')]();if(manager['exists'](_0x227f20)){if(_0x1209cd[_0x227f20][_0x9775('0x4c')]&&_0x1209cd[_0x227f20][_0x9775('0x4d')]&&moment()[_0x9775('0x4e')](_0x1209cd[_0x227f20][_0x9775('0x53')],_0x1209cd[_0x227f20][_0x9775('0x4f')])){manager[_0x9775('0x54')](_0x227f20,_0x1209cd[_0x227f20][_0x9775('0x4c')],handleJob(_0x1209cd[_0x227f20]));logger['info'](_0x9775('0x55'),_0x1209cd[_0x227f20]['name'],_0x1209cd[_0x227f20][_0x9775('0x4c')]);}else{manager['stop'](_0x227f20);manager[_0x9775('0x51')](_0x227f20);logger[_0x9775('0x9')](_0x9775('0x52'),_0x1209cd[_0x227f20][_0x9775('0x16')],_0x1209cd[_0x227f20]['cron']);}}}})['catch'](function(_0x4af39e){logger[_0x9775('0x2d')](JSON['stringify'](_0x4af39e));});}exports[_0x9775('0x56')]=function(_0x3cad51){return getJobs(_0x3cad51);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4378=['runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','add','start','add\x20cron','stop','length','endAt','update','update\x20cron','stop\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','MailAccount','service','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','status','message','attachments','text','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x5e4b35,_0x4d0efd){var _0x220bde=function(_0xa4f167){while(--_0xa4f167){_0x5e4b35['push'](_0x5e4b35['shift']());}};_0x220bde(++_0x4d0efd);}(_0x4378,0x7d));var _0x8437=function(_0x25a6c4,_0x13ab61){_0x25a6c4=_0x25a6c4-0x0;var _0x9ae4b4=_0x4378[_0x25a6c4];return _0x9ae4b4;};'use strict';var fs=require('fs');var util=require(_0x8437('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x8437('0x1'));var CronJobManager=require(_0x8437('0x2'));var jayson=require(_0x8437('0x3'));var BPromise=require(_0x8437('0x4'));var logger=require(_0x8437('0x5'))(_0x8437('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x8437('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x8437('0x8')][_0x8437('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x504b7f,_0xf613e){return function(){logger['info'](_0x8437('0xa'),_0x504b7f[_0x8437('0xb')]);var _0x4e1942=!![];var _0x5924a4={'tls':{'rejectUnauthorized':![]}};if(_0x504b7f['MailAccount'][_0x8437('0xc')]['service']){_0x5924a4['service']=_0x504b7f[_0x8437('0xd')]['Smtp'][_0x8437('0xe')];}else{_0x5924a4['host']=_0x504b7f[_0x8437('0xd')]['Smtp']['host'];_0x5924a4['port']=_0x504b7f[_0x8437('0xd')][_0x8437('0xc')][_0x8437('0xf')];_0x5924a4[_0x8437('0x10')]=_0x504b7f['MailAccount'][_0x8437('0xc')][_0x8437('0x10')];}if(_0x504b7f[_0x8437('0xd')][_0x8437('0xc')][_0x8437('0x11')]){_0x5924a4[_0x8437('0x12')]={'user':_0x504b7f[_0x8437('0xd')][_0x8437('0xc')][_0x8437('0x13')],'pass':_0x504b7f[_0x8437('0xd')]['Smtp'][_0x8437('0x14')]};}var _0x185bba={'account':_0x5924a4,'message':{'from':util[_0x8437('0x15')](_0x8437('0x16'),_0x504b7f[_0x8437('0xd')][_0x8437('0x17')],_0x504b7f[_0x8437('0xd')]['email']||_0x504b7f[_0x8437('0xd')]['Smtp'][_0x8437('0x13')]),'to':_0x504b7f[_0x8437('0xb')],'cc':_0x504b7f['cc'],'bcc':_0x504b7f['bcc'],'subject':util[_0x8437('0x15')](_0x8437('0x18'),_0xf613e['name'],_0x504b7f['subtractNumber'],_0x504b7f[_0x8437('0x19')])}};var _0x592264=path[_0x8437('0x1a')](__dirname,_0x8437('0x1b'));var _0x275872=_0xf613e[_0x8437('0x1c')];var _0x4b4263=util[_0x8437('0x15')](_0x8437('0x1d'),path['basename'](_0xf613e[_0x8437('0x1c')],path[_0x8437('0x1e')](_0xf613e[_0x8437('0x1c')])),'zip');var _0x1043ed=path['join'](_0x592264,_0x275872);var _0x373e1d=path[_0x8437('0x1a')](_0x592264,_0x4b4263);if(fs['existsSync'](_0x1043ed)){_0xf613e[_0x8437('0x1f')]='Sent';_0x185bba[_0x8437('0x20')][_0x8437('0x21')]=[{'filename':_0x275872,'path':_0x1043ed}];_0x185bba[_0x8437('0x20')][_0x8437('0x22')]=util[_0x8437('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0xf613e,null,0x2));}else if(fs['existsSync'](_0x373e1d)){_0xf613e['status']=_0x8437('0x23');_0x185bba[_0x8437('0x20')][_0x8437('0x21')]=[{'filename':_0x4b4263,'path':_0x373e1d}];}else{_0x185bba[_0x8437('0x20')]['text']=_0x8437('0x24');if(!_0x504b7f[_0x8437('0x25')]){_0x4e1942=![];logger[_0x8437('0x26')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4e1942){return client[_0x8437('0x27')](_0x8437('0x28'),_0x185bba)[_0x8437('0x29')](function(_0x13d9cc){if(_0x13d9cc[_0x8437('0x2a')]){return logger[_0x8437('0x2a')](_0x8437('0x2b'),JSON[_0x8437('0x2c')](_0x13d9cc));}return logger[_0x8437('0x26')](_0x8437('0x2d'));})[_0x8437('0x2e')](function(_0x3d65f6){return logger[_0x8437('0x2a')]('error\x20mail',JSON[_0x8437('0x2c')](_0x3d65f6));});}};}function handleError(){return function(_0x39c694){return logger[_0x8437('0x2a')](JSON[_0x8437('0x2c')](_0x39c694));};}function handleResult(_0x5dfa2e){return function(_0x30bc01){logger[_0x8437('0x26')](_0x8437('0x2f'),JSON[_0x8437('0x2c')](_0x30bc01));if(_0x5dfa2e[_0x8437('0xd')]&&_0x5dfa2e['MailAccount'][_0x8437('0xc')]&&!_[_0x8437('0x30')](_0x5dfa2e[_0x8437('0xb')])){setTimeout(handleSendEmail(_0x5dfa2e,_0x30bc01),0x3c*0x3e8);}};}function handleJob(_0x4da334){return function(){try{if(_[_0x8437('0x30')](_0x4da334['subtractNumber'])){return logger[_0x8437('0x26')](_0x8437('0x31'));}if(_[_0x8437('0x30')](_0x4da334['subtractUnit'])){return logger[_0x8437('0x26')](_0x8437('0x32'));}var _0x10cf99={'startDate':moment()[_0x8437('0x33')](_0x4da334[_0x8437('0x34')],_0x4da334[_0x8437('0x19')])[_0x8437('0x15')](_0x8437('0x35')),'endDate':moment()[_0x8437('0x15')](_0x8437('0x35')),'type':_0x8437('0x36'),'output':_0x4da334['output'],'name':_0x4da334[_0x8437('0x17')]};if(!_[_0x8437('0x30')](_0x4da334[_0x8437('0x37')])){logger[_0x8437('0x26')](_0x8437('0x38'),_0x4da334[_0x8437('0x37')]);return analyticDefaultReportController[_0x8437('0x39')]({'id':_0x4da334[_0x8437('0x37')]},_0x10cf99)[_0x8437('0x29')](handleResult(_0x4da334))[_0x8437('0x2e')](handleError());}if(!_[_0x8437('0x30')](_0x4da334[_0x8437('0x3a')])){logger[_0x8437('0x26')](_0x8437('0x3b'),_0x4da334[_0x8437('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x4da334[_0x8437('0x3a')]},_0x10cf99)[_0x8437('0x29')](handleResult(_0x4da334))[_0x8437('0x2e')](handleError());}}catch(_0x38be87){logger['error'](JSON['stringify'](_0x38be87));}return logger['info'](_0x8437('0x3c'));};}function getJobs(_0x2d27dc){var _0x31fce={};if(_0x2d27dc){_0x31fce['id']=_0x2d27dc;}return db[_0x8437('0x3d')][_0x8437('0x3e')]({'where':_0x31fce,'include':[{'model':db['MailAccount'],'attributes':['id',_0x8437('0x17'),_0x8437('0xb')],'include':[{'model':db[_0x8437('0x3f')],'as':'Smtp'}]}]})[_0x8437('0x29')](function(_0x7465b){var _0x1aabf0=_[_0x8437('0x40')](manager[_0x8437('0x41')]);var _0x7792db=_[_0x8437('0x42')](_0x7465b,function(_0x12577b){return _0x12577b['id'][_0x8437('0x43')]();});var _0x1144cc=_[_0x8437('0x44')](_0x7465b,function(_0x2659cc){return _0x2659cc['id']['toString']();});var _0xdcb7e9=_0x2d27dc?_0x7792db:_[_0x8437('0x45')](_0x7792db,_0x1aabf0);var _0x3233df=_[_0x8437('0x46')](_0x7792db,_0x1aabf0);var _0x31ad78=_[_0x8437('0x45')](_0x1aabf0,_0x7792db);var _0xd78456;var _0x4e5c82;for(_0xd78456=0x0;_0xd78456<_0x31ad78['length']&&!_0x2d27dc;_0xd78456+=0x1){_0x4e5c82=_0x31ad78[_0xd78456][_0x8437('0x43')]();if(manager[_0x8437('0x47')](_0x4e5c82)){manager['stop'](_0x4e5c82);manager[_0x8437('0x48')](_0x4e5c82);logger[_0x8437('0x26')](_0x8437('0x49'),_0x4e5c82);}}logger['info'](_0x8437('0x4a'),JSON[_0x8437('0x2c')](_0xdcb7e9));for(_0xd78456=0x0;_0xd78456<_0xdcb7e9['length'];_0xd78456+=0x1){_0x4e5c82=_0xdcb7e9[_0xd78456]['toString']();logger[_0x8437('0x26')](_0x8437('0x4b'),_0x4e5c82);if(_0x2d27dc){logger['info'](_0x8437('0x4c'),_0x2d27dc);logger[_0x8437('0x26')](JSON['stringify'](_0x1144cc[_0x4e5c82]));BPromise[_0x8437('0x4d')]()[_0x8437('0x29')](handleJob(_0x1144cc[_0x4e5c82]));logger[_0x8437('0x26')]('run\x20job',_0x1144cc[_0x4e5c82]['name'],_0x1144cc[_0x4e5c82]['cron']);}else if(_0x1144cc[_0x4e5c82][_0x8437('0x4e')]&&_0x1144cc[_0x4e5c82][_0x8437('0x4f')]&&moment()[_0x8437('0x50')](_0x1144cc[_0x4e5c82]['startAt'],_0x1144cc[_0x4e5c82]['endAt'])){manager[_0x8437('0x51')](_0x4e5c82,_0x1144cc[_0x4e5c82][_0x8437('0x4e')],handleJob(_0x1144cc[_0x4e5c82]));manager[_0x8437('0x52')](_0x4e5c82);logger['info'](_0x8437('0x53'),_0x1144cc[_0x4e5c82]['name'],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}else if(manager[_0x8437('0x47')](_0x4e5c82)){manager[_0x8437('0x54')](_0x4e5c82);manager[_0x8437('0x48')](_0x4e5c82);logger['info']('stop\x20cron',_0x1144cc[_0x4e5c82][_0x8437('0x17')],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}}for(_0xd78456=0x0,_0x4e5c82;_0xd78456<_0x3233df[_0x8437('0x55')]&&!_0x2d27dc;_0xd78456+=0x1){_0x4e5c82=_0x3233df[_0xd78456][_0x8437('0x43')]();if(manager[_0x8437('0x47')](_0x4e5c82)){if(_0x1144cc[_0x4e5c82]['cron']&&_0x1144cc[_0x4e5c82][_0x8437('0x4f')]&&moment()[_0x8437('0x50')](_0x1144cc[_0x4e5c82]['startAt'],_0x1144cc[_0x4e5c82][_0x8437('0x56')])){manager[_0x8437('0x57')](_0x4e5c82,_0x1144cc[_0x4e5c82]['cron'],handleJob(_0x1144cc[_0x4e5c82]));logger[_0x8437('0x26')](_0x8437('0x58'),_0x1144cc[_0x4e5c82][_0x8437('0x17')],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}else{manager[_0x8437('0x54')](_0x4e5c82);manager['deleteJob'](_0x4e5c82);logger[_0x8437('0x26')](_0x8437('0x59'),_0x1144cc[_0x4e5c82][_0x8437('0x17')],_0x1144cc[_0x4e5c82][_0x8437('0x4e')]);}}}})['catch'](function(_0x13c67a){logger[_0x8437('0x2a')](JSON[_0x8437('0x2c')](_0x13c67a));});}exports[_0x8437('0x5a')]=function(_0x2e5058){return getJobs(_0x2e5058);};exports[_0x8437('0x52')]=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 664ac3d..9d3431b 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 _0x2d8c=['FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','bucket','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','Negative','Mixed','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','Sequelize','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Neutral','FAILED'];(function(_0x93fb44,_0x1ff4e6){var _0x575c12=function(_0x2f01fe){while(--_0x2f01fe){_0x93fb44['push'](_0x93fb44['shift']());}};_0x575c12(++_0x1ff4e6);}(_0x2d8c,0xf6));var _0xc2d8=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x2d8c[_0x1f36bb];return _0xaf97fa;};var _=require(_0xc2d8('0x0'));var AWS=require('aws-sdk');var rp=require(_0xc2d8('0x1'));var util=require(_0xc2d8('0x2'));var BPromise=require(_0xc2d8('0x3'));var db=require(_0xc2d8('0x4'))['db'];var logger=require('../../config/logger')(_0xc2d8('0x5'));function getTranscriptionJob(_0x3636d7,_0x5be562,_0x33b113,_0x44b794){return new Promise(function(_0x13c26b,_0x3eb85e){var _0x2ecf71=new AWS[(_0xc2d8('0x6'))]({'accessKeyId':_0x5be562,'secretAccessKey':_0x3636d7,'region':_0x33b113});_0x2ecf71['getTranscriptionJob']({'TranscriptionJobName':_0x44b794},function(_0x55aa27,_0x4a3ba6){if(_0x55aa27){return _0x3eb85e(_0x55aa27);}else{return _0x13c26b(_0x4a3ba6);}});});}function sentiment(_0x1082f6,_0x650315,_0x37e3dc,_0x1a02ba,_0x277940){return new Promise(function(_0xe39a09,_0x2d3dc2){var _0x65b7e7=new AWS['Comprehend']({'accessKeyId':_0x650315,'secretAccessKey':_0x1082f6,'region':_0x37e3dc});_0x65b7e7[_0xc2d8('0x7')]({'Text':_0x1a02ba,'LanguageCode':_0x277940[_0xc2d8('0x8')](0x0,0x2)},function(_0x34fa85,_0x5a0278){if(_0x34fa85){return _0x2d3dc2(_0x34fa85);}else{return _0xe39a09(_0x5a0278);}});});}function checkTranscribeJob(_0x4815ff,_0x36c365,_0x2d9cc5){var _0x31ccc6;return new BPromise(function(_0x25eb61,_0x31f842){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0xb'),_0x4815ff['id'],_0x4815ff[_0xc2d8('0xc')]));return getTranscriptionJob(_0x2d9cc5[_0xc2d8('0xd')],_0x2d9cc5['data2'],_0x36c365[_0xc2d8('0xe')],_0x4815ff[_0xc2d8('0xc')])[_0xc2d8('0xf')](function(_0x2f7b68){logger['info'](util[_0xc2d8('0xa')](_0xc2d8('0x10'),_0x4815ff['id'],_0x4815ff[_0xc2d8('0xc')],_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x12')]));if(!_0x4815ff[_0xc2d8('0x13')]){switch(_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x12')]){case'COMPLETED':var _0xb18d34={'transcribeStatus':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x12')],'fileUri':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x14')][_0xc2d8('0x15')]};logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x16'),_0x4815ff['id']));return rp({'uri':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x14')][_0xc2d8('0x15')],'json':!![]})['then'](function(_0x253ce1){logger['info'](util[_0xc2d8('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4815ff['id']));if(_0x253ce1&&_0x253ce1[_0xc2d8('0x17')]&&_0x253ce1[_0xc2d8('0x17')]['transcripts']&&_0x253ce1[_0xc2d8('0x17')][_0xc2d8('0x18')]['length']){_0xb18d34[_0xc2d8('0x13')]='';for(var _0x204ce0=0x0;_0x204ce0<_0x253ce1[_0xc2d8('0x17')][_0xc2d8('0x18')][_0xc2d8('0x19')];_0x204ce0++){_0xb18d34[_0xc2d8('0x13')]+=_0x253ce1[_0xc2d8('0x17')][_0xc2d8('0x18')][_0x204ce0][_0xc2d8('0x1a')]+'';}}return _0x4815ff[_0xc2d8('0x1b')](_0xb18d34);})[_0xc2d8('0xf')](function(){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0x1c'),_0x4815ff['id']));if(!_0x4815ff[_0xc2d8('0x1d')]){throw new db['Sequelize'][(_0xc2d8('0x1e'))](_0xc2d8('0x1f'));}if(!_0x36c365['sentiment']||!_0x36c365['sentimentAccountId']||!_0x36c365[_0xc2d8('0x20')]||!_0x36c365['language']||!_0x36c365['bucket']){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xb18d34['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x36c365[_0xc2d8('0x22')]===_0x2d9cc5['id']){return _0x2d9cc5;}else{return db[_0xc2d8('0x23')][_0xc2d8('0x24')]({'where':{'id':_settings[_0xc2d8('0x22')]}});}})[_0xc2d8('0xf')](function(_0x297653){if(!_0x297653){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x25'));}if(!_0x297653[_0xc2d8('0xd')]||!_0x297653[_0xc2d8('0x26')]){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x31ccc6=_0x297653;logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x27'),_0x4815ff['id']));return sentiment(_0x31ccc6[_0xc2d8('0xd')],_0x31ccc6['data2'],_0x36c365['sentimentRegion'],_0xb18d34[_0xc2d8('0x13')],_0x36c365[_0xc2d8('0x28')]);})[_0xc2d8('0xf')](function(_0x118e1c){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0x29'),_0x4815ff['id']));return _0x4815ff[_0xc2d8('0x1b')]({'sentiment':_0x118e1c[_0xc2d8('0x2a')],'sPositive':_0x118e1c[_0xc2d8('0x2b')]['Positive'],'sNegative':_0x118e1c[_0xc2d8('0x2b')]['Negative'],'sMixed':_0x118e1c[_0xc2d8('0x2b')]['Mixed'],'sNeutral':_0x118e1c['SentimentScore'][_0xc2d8('0x2c')]});})['then'](function(){logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')](_0xc2d8('0x1c'),_0x4815ff['id']));_0x25eb61();});case _0xc2d8('0x2d'):return _0x4815ff['update']({'transcribeStatus':'FAILED','failureReason':_0x2f7b68[_0xc2d8('0x11')][_0xc2d8('0x2e')]})[_0xc2d8('0xf')](function(){logger['info'](util[_0xc2d8('0xa')](_0xc2d8('0x1c'),_0x4815ff['id']));_0x25eb61();});default:logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x2f'),_0x4815ff['id']));break;}}else{return BPromise['resolve']()[_0xc2d8('0xf')](function(){if(!_0x4815ff[_0xc2d8('0x1d')]){throw new db['Sequelize'][(_0xc2d8('0x1e'))](_0xc2d8('0x1f'));}if(!_0x36c365[_0xc2d8('0x30')]||!_0x36c365[_0xc2d8('0x22')]||!_0x36c365[_0xc2d8('0x20')]||!_0x36c365[_0xc2d8('0x28')]||!_0x36c365[_0xc2d8('0x31')]){throw new db[(_0xc2d8('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4815ff['fileText']){throw new Error(_0xc2d8('0x32'));}if(_0x36c365[_0xc2d8('0x22')]===_0x2d9cc5['id']){return _0x2d9cc5;}else{return db[_0xc2d8('0x23')]['findOne']({'where':{'id':_settings[_0xc2d8('0x22')]}});}})[_0xc2d8('0xf')](function(_0x34a0e9){if(!_0x34a0e9){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x34a0e9['data1']||!_0x34a0e9[_0xc2d8('0x26')]){throw new db['Sequelize'][(_0xc2d8('0x1e'))](_0xc2d8('0x33'));}_0x31ccc6=_0x34a0e9;logger[_0xc2d8('0x9')](util[_0xc2d8('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4815ff['id']));return sentiment(_0x31ccc6[_0xc2d8('0xd')],_0x31ccc6[_0xc2d8('0x26')],_0x36c365[_0xc2d8('0x20')],_0x4815ff['fileText'],_0x36c365[_0xc2d8('0x28')]);})[_0xc2d8('0xf')](function(_0x42c2c7){logger[_0xc2d8('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4815ff['id']));return _0x4815ff['update']({'sentiment':_0x42c2c7['Sentiment'],'sPositive':_0x42c2c7[_0xc2d8('0x2b')][_0xc2d8('0x34')],'sNegative':_0x42c2c7[_0xc2d8('0x2b')][_0xc2d8('0x35')],'sMixed':_0x42c2c7[_0xc2d8('0x2b')][_0xc2d8('0x36')],'sNeutral':_0x42c2c7['SentimentScore']['Neutral'],'transcribeStatus':_0xc2d8('0x37')});})[_0xc2d8('0xf')](function(){logger[_0xc2d8('0x9')](util['format'](_0xc2d8('0x1c'),_0x4815ff['id']));_0x25eb61();});}})['catch'](function(_0x2136ab){if(_0x2136ab){if(!_0x2136ab[_0xc2d8('0x38')]||_0x2136ab[_0xc2d8('0x38')]!==_0xc2d8('0x39')){logger[_0xc2d8('0x3a')](util['format'](_0xc2d8('0x3b'),_0x4815ff['id']),util[_0xc2d8('0x3c')](_0x2136ab,{'showHidden':![],'depth':null}));}}_0x25eb61();});});}function checkTranscribe(){var _0xfa7b73;var _0x9291c8;var _0x3fe1be;return db[_0xc2d8('0x3d')][_0xc2d8('0x3e')]({'where':{'transcribeStatus':_0xc2d8('0x3f')}})['then'](function(_0x1e7e71){if(!_0x1e7e71||!_0x1e7e71[_0xc2d8('0x19')]){throw new db[(_0xc2d8('0x21'))]['ValidationError'](_0xc2d8('0x40'));}_0xfa7b73=_0x1e7e71;return db[_0xc2d8('0x41')]['findOne']({'where':{'id':0x1}});})[_0xc2d8('0xf')](function(_0x42f4c0){if(!_0x42f4c0){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x42'));}_0x9291c8=_0x42f4c0;if(!_0x9291c8[_0xc2d8('0x5')]||!_0x9291c8[_0xc2d8('0x43')]||!_0x9291c8[_0xc2d8('0xe')]||!_0x9291c8['language']||!_0x9291c8['bucket']){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x44'));}return db[_0xc2d8('0x23')]['findOne']({'where':{'id':_0x9291c8[_0xc2d8('0x43')]}});})[_0xc2d8('0xf')](function(_0x2f86d2){if(!_0x2f86d2){throw new db[(_0xc2d8('0x21'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2f86d2[_0xc2d8('0xd')]||!_0x2f86d2[_0xc2d8('0x26')]){throw new db[(_0xc2d8('0x21'))][(_0xc2d8('0x1e'))](_0xc2d8('0x33'));}_0x3fe1be=_0x2f86d2;var _0x1230c9=[];_0xfa7b73[_0xc2d8('0x45')](function(_0x4dded9){_0x1230c9[_0xc2d8('0x46')](checkTranscribeJob(_0x4dded9,_0x9291c8,_0x3fe1be));});return BPromise[_0xc2d8('0x47')](_0x1230c9);})['catch'](function(_0x2878de){if(_0x2878de){if(!_0x2878de[_0xc2d8('0x38')]||_0x2878de['name']!=='SequelizeValidationError'){logger['error'](util[_0xc2d8('0x3c')](_0x2878de,{'showHidden':![],'depth':null}));}}});}exports[_0xc2d8('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x6791=['[RECORDING:%d]\x20Get\x20transcript','Transcript','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentimentAccountId','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Negative','Neutral','catch','name','SequelizeValidationError','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','inspect','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','TranscriptFileUri'];(function(_0x29c550,_0x23b16d){var _0x347cd1=function(_0x200f91){while(--_0x200f91){_0x29c550['push'](_0x29c550['shift']());}};_0x347cd1(++_0x23b16d);}(_0x6791,0x15b));var _0x1679=function(_0x1ec8f9,_0x22f5e7){_0x1ec8f9=_0x1ec8f9-0x0;var _0x17cd3d=_0x6791[_0x1ec8f9];return _0x17cd3d;};var _=require('lodash');var AWS=require(_0x1679('0x0'));var rp=require(_0x1679('0x1'));var util=require(_0x1679('0x2'));var BPromise=require(_0x1679('0x3'));var db=require(_0x1679('0x4'))['db'];var logger=require(_0x1679('0x5'))('transcribe');function getTranscriptionJob(_0x3106d0,_0x5b68dd,_0x5c8343,_0x59256c){return new Promise(function(_0xb2683c,_0x1552ca){var _0x40bdc1=new AWS[(_0x1679('0x6'))]({'accessKeyId':_0x5b68dd,'secretAccessKey':_0x3106d0,'region':_0x5c8343});_0x40bdc1[_0x1679('0x7')]({'TranscriptionJobName':_0x59256c},function(_0x495b62,_0x3bac96){if(_0x495b62){return _0x1552ca(_0x495b62);}else{return _0xb2683c(_0x3bac96);}});});}function sentiment(_0x37f26f,_0x5c133a,_0x3d2d70,_0x5a99a8,_0x5cc62f){return new Promise(function(_0x456b0b,_0x391cc2){var _0x2433f3=new AWS['Comprehend']({'accessKeyId':_0x5c133a,'secretAccessKey':_0x37f26f,'region':_0x3d2d70});_0x2433f3[_0x1679('0x8')]({'Text':_0x5a99a8,'LanguageCode':_0x5cc62f[_0x1679('0x9')](0x0,0x2)},function(_0x58320b,_0x1e0814){if(_0x58320b){return _0x391cc2(_0x58320b);}else{return _0x456b0b(_0x1e0814);}});});}function checkTranscribeJob(_0xc85967,_0x5d0394,_0x1a22cd){var _0x3a547f;return new BPromise(function(_0x4856a4,_0x293c8e){logger[_0x1679('0xa')](util['format'](_0x1679('0xb'),_0xc85967['id'],_0xc85967[_0x1679('0xc')]));return getTranscriptionJob(_0x1a22cd[_0x1679('0xd')],_0x1a22cd[_0x1679('0xe')],_0x5d0394[_0x1679('0xf')],_0xc85967[_0x1679('0xc')])[_0x1679('0x10')](function(_0x32a8b8){logger[_0x1679('0xa')](util['format'](_0x1679('0x11'),_0xc85967['id'],_0xc85967[_0x1679('0xc')],_0x32a8b8[_0x1679('0x12')]['TranscriptionJobStatus']));if(!_0xc85967[_0x1679('0x13')]){switch(_0x32a8b8[_0x1679('0x12')][_0x1679('0x14')]){case _0x1679('0x15'):var _0x41df77={'transcribeStatus':_0x32a8b8[_0x1679('0x12')]['TranscriptionJobStatus'],'fileUri':_0x32a8b8[_0x1679('0x12')]['Transcript'][_0x1679('0x16')]};logger[_0x1679('0xa')](util['format'](_0x1679('0x17'),_0xc85967['id']));return rp({'uri':_0x32a8b8[_0x1679('0x12')][_0x1679('0x18')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x278df7){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x1a'),_0xc85967['id']));if(_0x278df7&&_0x278df7[_0x1679('0x1b')]&&_0x278df7[_0x1679('0x1b')]['transcripts']&&_0x278df7[_0x1679('0x1b')][_0x1679('0x1c')][_0x1679('0x1d')]){_0x41df77[_0x1679('0x13')]='';for(var _0x58e296=0x0;_0x58e296<_0x278df7[_0x1679('0x1b')][_0x1679('0x1c')][_0x1679('0x1d')];_0x58e296++){_0x41df77['fileText']+=_0x278df7[_0x1679('0x1b')][_0x1679('0x1c')][_0x58e296][_0x1679('0x1e')]+'';}}return _0xc85967[_0x1679('0x1f')](_0x41df77);})[_0x1679('0x10')](function(){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));if(!_0xc85967[_0x1679('0x21')]){throw new db[(_0x1679('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5d0394['sentiment']||!_0x5d0394[_0x1679('0x23')]||!_0x5d0394['sentimentRegion']||!_0x5d0394[_0x1679('0x24')]||!_0x5d0394[_0x1679('0x25')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x41df77[_0x1679('0x13')]){throw new Error(_0x1679('0x27'));}if(_0x5d0394[_0x1679('0x23')]===_0x1a22cd['id']){return _0x1a22cd;}else{return db[_0x1679('0x28')][_0x1679('0x29')]({'where':{'id':_settings[_0x1679('0x23')]}});}})['then'](function(_0x571f42){if(!_0x571f42){throw new db['Sequelize'][(_0x1679('0x26'))](_0x1679('0x2a'));}if(!_0x571f42['data1']||!_0x571f42[_0x1679('0xe')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x3a547f=_0x571f42;logger[_0x1679('0xa')](util['format'](_0x1679('0x2b'),_0xc85967['id']));return sentiment(_0x3a547f['data1'],_0x3a547f[_0x1679('0xe')],_0x5d0394[_0x1679('0x2c')],_0x41df77[_0x1679('0x13')],_0x5d0394['language']);})['then'](function(_0x585549){logger[_0x1679('0xa')](util['format'](_0x1679('0x2d'),_0xc85967['id']));return _0xc85967[_0x1679('0x1f')]({'sentiment':_0x585549[_0x1679('0x2e')],'sPositive':_0x585549[_0x1679('0x2f')][_0x1679('0x30')],'sNegative':_0x585549[_0x1679('0x2f')]['Negative'],'sMixed':_0x585549[_0x1679('0x2f')][_0x1679('0x31')],'sNeutral':_0x585549['SentimentScore']['Neutral']});})[_0x1679('0x10')](function(){logger['info'](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));_0x4856a4();});case'FAILED':return _0xc85967[_0x1679('0x1f')]({'transcribeStatus':_0x1679('0x32'),'failureReason':_0x32a8b8[_0x1679('0x12')][_0x1679('0x33')]})[_0x1679('0x10')](function(){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));_0x4856a4();});default:logger['info'](util[_0x1679('0x19')](_0x1679('0x34'),_0xc85967['id']));break;}}else{return BPromise[_0x1679('0x35')]()[_0x1679('0x10')](function(){if(!_0xc85967[_0x1679('0x21')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x36'));}if(!_0x5d0394[_0x1679('0x37')]||!_0x5d0394[_0x1679('0x23')]||!_0x5d0394[_0x1679('0x2c')]||!_0x5d0394['language']||!_0x5d0394[_0x1679('0x25')]){throw new db[(_0x1679('0x22'))]['ValidationError'](_0x1679('0x38'));}if(!_0xc85967[_0x1679('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5d0394[_0x1679('0x23')]===_0x1a22cd['id']){return _0x1a22cd;}else{return db['CloudProvider'][_0x1679('0x29')]({'where':{'id':_settings[_0x1679('0x23')]}});}})[_0x1679('0x10')](function(_0x1ec3ff){if(!_0x1ec3ff){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x2a'));}if(!_0x1ec3ff[_0x1679('0xd')]||!_0x1ec3ff['data2']){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x39'));}_0x3a547f=_0x1ec3ff;logger[_0x1679('0xa')](util['format'](_0x1679('0x2b'),_0xc85967['id']));return sentiment(_0x3a547f['data1'],_0x3a547f[_0x1679('0xe')],_0x5d0394[_0x1679('0x2c')],_0xc85967[_0x1679('0x13')],_0x5d0394['language']);})[_0x1679('0x10')](function(_0x390314){logger[_0x1679('0xa')](util['format'](_0x1679('0x2d'),_0xc85967['id']));return _0xc85967[_0x1679('0x1f')]({'sentiment':_0x390314[_0x1679('0x2e')],'sPositive':_0x390314[_0x1679('0x2f')]['Positive'],'sNegative':_0x390314[_0x1679('0x2f')][_0x1679('0x3a')],'sMixed':_0x390314['SentimentScore']['Mixed'],'sNeutral':_0x390314[_0x1679('0x2f')][_0x1679('0x3b')],'transcribeStatus':'COMPLETED'});})[_0x1679('0x10')](function(){logger[_0x1679('0xa')](util[_0x1679('0x19')](_0x1679('0x20'),_0xc85967['id']));_0x4856a4();});}})[_0x1679('0x3c')](function(_0x2b2661){if(_0x2b2661){if(!_0x2b2661[_0x1679('0x3d')]||_0x2b2661['name']!==_0x1679('0x3e')){logger[_0x1679('0x3f')](util[_0x1679('0x19')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xc85967['id']),util['inspect'](_0x2b2661,{'showHidden':![],'depth':null}));}}_0x4856a4();});});}function checkTranscribe(){var _0xd2aab0;var _0x238e82;var _0x3b429d;return db['VoiceRecording'][_0x1679('0x40')]({'where':{'transcribeStatus':_0x1679('0x41')}})[_0x1679('0x10')](function(_0x514132){if(!_0x514132||!_0x514132[_0x1679('0x1d')]){throw new db[(_0x1679('0x22'))]['ValidationError'](_0x1679('0x42'));}_0xd2aab0=_0x514132;return db['Setting'][_0x1679('0x29')]({'where':{'id':0x1}});})[_0x1679('0x10')](function(_0x2f54db){if(!_0x2f54db){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))]('Settings\x20not\x20available');}_0x238e82=_0x2f54db;if(!_0x238e82[_0x1679('0x43')]||!_0x238e82['transcribeAccountId']||!_0x238e82['transcribeRegion']||!_0x238e82[_0x1679('0x24')]||!_0x238e82[_0x1679('0x25')]){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x44'));}return db[_0x1679('0x28')]['findOne']({'where':{'id':_0x238e82[_0x1679('0x45')]}});})[_0x1679('0x10')](function(_0x380a69){if(!_0x380a69){throw new db[(_0x1679('0x22'))][(_0x1679('0x26'))](_0x1679('0x2a'));}if(!_0x380a69[_0x1679('0xd')]||!_0x380a69[_0x1679('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x3b429d=_0x380a69;var _0x4e2c26=[];_0xd2aab0[_0x1679('0x46')](function(_0x148aea){_0x4e2c26[_0x1679('0x47')](checkTranscribeJob(_0x148aea,_0x238e82,_0x3b429d));});return BPromise['all'](_0x4e2c26);})[_0x1679('0x3c')](function(_0x19dae4){if(_0x19dae4){if(!_0x19dae4[_0x1679('0x3d')]||_0x19dae4[_0x1679('0x3d')]!==_0x1679('0x3e')){logger[_0x1679('0x3f')](util[_0x1679('0x48')](_0x19dae4,{'showHidden':![],'depth':null}));}}});}exports[_0x1679('0x49')]=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 c3ad52e..8d315d2 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 _0x560d=['catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update'];(function(_0x94cd8,_0x80691a){var _0x5572f4=function(_0x2cae9b){while(--_0x2cae9b){_0x94cd8['push'](_0x94cd8['shift']());}};_0x5572f4(++_0x80691a);}(_0x560d,0x170));var _0xd560=function(_0x198ed6,_0x383c04){_0x198ed6=_0x198ed6-0x0;var _0x47ddc5=_0x560d[_0x198ed6];return _0x47ddc5;};'use strict';var _=require(_0xd560('0x0'));var moment=require(_0xd560('0x1'));var Redis=require(_0xd560('0x2'));var util=require('util');var config=require(_0xd560('0x3'));var db=require(_0xd560('0x4'))['db'];var logger=require(_0xd560('0x5'))(_0xd560('0x6'));config[_0xd560('0x7')]=_[_0xd560('0x8')](config[_0xd560('0x7')],{'host':_0xd560('0x9'),'port':0x18eb});var io=require(_0xd560('0xa'))(new Redis(config[_0xd560('0x7')]));function closeInteractions(){var _0x2e5356=[];return db['WhatsappInteraction'][_0xd560('0xb')]({'raw':!![],'attributes':['id',_0xd560('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd560('0xd')](0x18,_0xd560('0xe'))}}})[_0xd560('0xf')](function(_0x1f83bb){if(_0x1f83bb&&_0x1f83bb[_0xd560('0x10')]){_0x2e5356=_[_0xd560('0x11')](_0x1f83bb||[],'id');logger[_0xd560('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2e5356[_0xd560('0x13')]());return db[_0xd560('0x14')]['update']({'closeReason':_0xd560('0x15'),'disposition':_0xd560('0x16'),'closed':!![],'closedAt':moment()[_0xd560('0x17')](_0xd560('0x18'))},{'where':{'id':_0x2e5356}});}})[_0xd560('0xf')](function(){if(_0x2e5356&&_0x2e5356[_0xd560('0x10')]){logger[_0xd560('0x12')](_0xd560('0x19'),_0x2e5356[_0xd560('0x13')]());for(var _0x4654bd=0x0;_0x4654bd<_0x2e5356[_0xd560('0x10')];_0x4654bd++){io[_0xd560('0x1a')](_0xd560('0x1b'),{'id':_0x2e5356[_0x4654bd],'closed':!![]});}}})[_0xd560('0x1c')](function(_0x2235e7){logger[_0xd560('0x1d')](_0xd560('0x1e'),_0x2235e7?util[_0xd560('0x1f')](_0x2235e7,{'showHidden':![],'depth':null}):'');});}exports[_0xd560('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb4d7=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update'];(function(_0x5b9ba9,_0x9a608c){var _0x326373=function(_0x107b07){while(--_0x107b07){_0x5b9ba9['push'](_0x5b9ba9['shift']());}};_0x326373(++_0x9a608c);}(_0xb4d7,0x64));var _0x7b4d=function(_0x2d5493,_0x2b87ee){_0x2d5493=_0x2d5493-0x0;var _0x82d3f=_0xb4d7[_0x2d5493];return _0x82d3f;};'use strict';var _=require(_0x7b4d('0x0'));var moment=require(_0x7b4d('0x1'));var Redis=require(_0x7b4d('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x7b4d('0x3'))['db'];var logger=require(_0x7b4d('0x4'))('schedule');config[_0x7b4d('0x5')]=_[_0x7b4d('0x6')](config[_0x7b4d('0x5')],{'host':_0x7b4d('0x7'),'port':0x18eb});var io=require(_0x7b4d('0x8'))(new Redis(config[_0x7b4d('0x5')]));function closeInteractions(){var _0x40a6e1=[];return db[_0x7b4d('0x9')][_0x7b4d('0xa')]({'raw':!![],'attributes':['id',_0x7b4d('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7b4d('0xc')](0x18,'hours')}}})[_0x7b4d('0xd')](function(_0x2b0b79){if(_0x2b0b79&&_0x2b0b79[_0x7b4d('0xe')]){_0x40a6e1=_[_0x7b4d('0xf')](_0x2b0b79||[],'id');logger[_0x7b4d('0x10')](_0x7b4d('0x11'),_0x40a6e1[_0x7b4d('0x12')]());return db['WhatsappInteraction'][_0x7b4d('0x13')]({'closeReason':'system','disposition':_0x7b4d('0x14'),'closed':!![],'closedAt':moment()[_0x7b4d('0x15')](_0x7b4d('0x16'))},{'where':{'id':_0x40a6e1}});}})[_0x7b4d('0xd')](function(){if(_0x40a6e1&&_0x40a6e1[_0x7b4d('0xe')]){logger['info'](_0x7b4d('0x17'),_0x40a6e1[_0x7b4d('0x12')]());for(var _0x48c304=0x0;_0x48c304<_0x40a6e1[_0x7b4d('0xe')];_0x48c304++){io[_0x7b4d('0x18')](_0x7b4d('0x19'),{'id':_0x40a6e1[_0x48c304],'closed':!![]});}}})[_0x7b4d('0x1a')](function(_0x34d03b){logger[_0x7b4d('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x34d03b?util[_0x7b4d('0x1c')](_0x34d03b,{'showHidden':![],'depth':null}):'');});}exports[_0x7b4d('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index eb9966c..65bc6f3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ea=['@xcally.com','now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','bulkCreate','hopper1','contacts2','hopper2','catch','util','push','Biondo'];(function(_0xc1c93f,_0x1fba71){var _0x3f81cb=function(_0x20b66f){while(--_0x20b66f){_0xc1c93f['push'](_0xc1c93f['shift']());}};_0x3f81cb(++_0x1fba71);}(_0x55ea,0xd5));var _0xa55e=function(_0x3730f0,_0x2b3b85){_0x3730f0=_0x3730f0-0x0;var _0x219741=_0x55ea[_0x3730f0];return _0x219741;};'use strict';var util=require(_0xa55e('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa55e('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xa55e('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa55e('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa55e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xa55e('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa55e('0x4')](),'updatedAt':Date[_0xa55e('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa55e('0x1')]({'id':i,'firstName':_0xa55e('0x5')+i,'lastName':_0xa55e('0x2')+i,'phone':0xf879fb460+i,'email':_0xa55e('0x6')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa55e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xa55e('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa55e('0x4')](),'updatedAt':Date['now']()});}db[_0xa55e('0x7')][_0xa55e('0x8')]({'where':{}})[_0xa55e('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0xa55e('0xa')](_0xa55e('0xb'),_0xa55e('0xc'));return db['CmHopper'][_0xa55e('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0xa55e('0xd')](hopper);})[_0xa55e('0x9')](function(){console[_0xa55e('0xa')]('finished\x20populating',_0xa55e('0xe'));return db[_0xa55e('0x7')][_0xa55e('0xd')](contacts2);})['then'](function(){console[_0xa55e('0xa')]('finished\x20populating',_0xa55e('0xf'));return db['CmHopper'][_0xa55e('0xd')](hopper2);})['then'](function(){console[_0xa55e('0xa')](_0xa55e('0xb'),_0xa55e('0x10'));})[_0xa55e('0x11')](function(_0x5b0806){console[_0xa55e('0xa')](_0x5b0806);}); \ No newline at end of file +var _0xafc1=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','catch','../mysqldb','Innocenzo','innocenzo.biondo','push','now','Biondo','@xcally.com','CmContact','destroy','then'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0xafc1,0xf2));var _0x1afc=function(_0x279e1f,_0x2369e9){_0x279e1f=_0x279e1f-0x0;var _0x4360bc=_0xafc1[_0x279e1f];return _0x4360bc;};'use strict';var util=require('util');var db=require(_0x1afc('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1afc('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x1afc('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1afc('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x1afc('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1afc('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1afc('0x3')]({'id':i,'firstName':_0x1afc('0x1')+i,'lastName':_0x1afc('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1afc('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1afc('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x1afc('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1afc('0x4')](),'updatedAt':Date['now']()});}db[_0x1afc('0x7')][_0x1afc('0x8')]({'where':{}})[_0x1afc('0x9')](function(){return db[_0x1afc('0x7')][_0x1afc('0xa')](contacts);})[_0x1afc('0x9')](function(){console[_0x1afc('0xb')](_0x1afc('0xc'),_0x1afc('0xd'));return db[_0x1afc('0xe')][_0x1afc('0x8')]({'where':{}});})[_0x1afc('0x9')](function(){return db[_0x1afc('0xe')][_0x1afc('0xa')](hopper);})['then'](function(){console[_0x1afc('0xb')](_0x1afc('0xc'),_0x1afc('0xf'));return db['CmContact'][_0x1afc('0xa')](contacts2);})[_0x1afc('0x9')](function(){console[_0x1afc('0xb')](_0x1afc('0xc'),'contacts2');return db['CmHopper'][_0x1afc('0xa')](hopper2);})['then'](function(){console[_0x1afc('0xb')]('finished\x20populating',_0x1afc('0x10'));})[_0x1afc('0x11')](function(_0x1adf8a){console[_0x1afc('0xb')](_0x1adf8a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5540afb..beac784 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c31=['udp','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','%s%s@xcally.com','agent','password'];(function(_0x3a1898,_0x35eda2){var _0x2ea51e=function(_0x9e78fa){while(--_0x9e78fa){_0x3a1898['push'](_0x3a1898['shift']());}};_0x2ea51e(++_0x35eda2);}(_0x3c31,0x1e7));var _0x13c3=function(_0x266aa6,_0xeabf3a){_0x266aa6=_0x266aa6-0x0;var _0xc81f99=_0x3c31[_0x266aa6];return _0xc81f99;};'use strict';var util=require(_0x13c3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x13c3('0x1')]({'name':util[_0x13c3('0x2')](_0x13c3('0x3'),'agent',i),'fullname':util[_0x13c3('0x2')](_0x13c3('0x3'),'agent',i),'email':util['format'](_0x13c3('0x4'),_0x13c3('0x5'),i),'role':_0x13c3('0x5'),'password':_0x13c3('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x13c3('0x7'),'ws','wss'],'disallow':[_0x13c3('0x8')],'allow':[_0x13c3('0x9')],'defaultuser':util[_0x13c3('0x2')](_0x13c3('0x3'),'agent',i),'encryption':_0x13c3('0xa'),'avpf':_0x13c3('0xa'),'force_avp':'yes','icesupport':_0x13c3('0xa'),'dtlsenable':_0x13c3('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x13c3('0xb'),'callerid':util[_0x13c3('0x2')](_0x13c3('0xc'),util[_0x13c3('0x2')](_0x13c3('0x3'),_0x13c3('0x5'),i),0xfa0+i)});}db[_0x13c3('0xd')][_0x13c3('0xe')](users)[_0x13c3('0xf')](function(){console[_0x13c3('0x10')](_0x13c3('0x11'));})[_0x13c3('0x12')](function(_0x397bed){console['log'](_0x397bed);}); \ No newline at end of file +var _0x5161=['friend','udp','wss','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','util','../mysqldb','format','agent','%s%s','password'];(function(_0x4badf2,_0x31af5b){var _0x1c9657=function(_0x139c59){while(--_0x139c59){_0x4badf2['push'](_0x4badf2['shift']());}};_0x1c9657(++_0x31af5b);}(_0x5161,0x92));var _0x1516=function(_0x1f8abb,_0x2b232e){_0x1f8abb=_0x1f8abb-0x0;var _0x1b9297=_0x5161[_0x1f8abb];return _0x1b9297;};'use strict';var util=require(_0x1516('0x0'));var db=require(_0x1516('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1516('0x2')]('%s%s',_0x1516('0x3'),i),'fullname':util['format'](_0x1516('0x4'),_0x1516('0x3'),i),'email':util[_0x1516('0x2')]('%s%s@xcally.com','agent',i),'role':_0x1516('0x3'),'password':_0x1516('0x5'),'internal':0xfa0+i,'type':_0x1516('0x6'),'transport':[_0x1516('0x7'),'ws',_0x1516('0x8')],'disallow':['all'],'allow':[_0x1516('0x9')],'defaultuser':util[_0x1516('0x2')](_0x1516('0x4'),'agent',i),'encryption':'yes','avpf':_0x1516('0xa'),'force_avp':_0x1516('0xa'),'icesupport':_0x1516('0xa'),'dtlsenable':_0x1516('0xa'),'dtlsverify':'no','dtlscertfile':_0x1516('0xb'),'dtlsprivatekey':_0x1516('0xc'),'dtlssetup':_0x1516('0xd'),'callerid':util['format'](_0x1516('0xe'),util['format'](_0x1516('0x4'),'agent',i),0xfa0+i)});}db[_0x1516('0xf')][_0x1516('0x10')](users)['then'](function(){console[_0x1516('0x11')](_0x1516('0x12'));})['catch'](function(_0x2153b6){console[_0x1516('0x11')](_0x2153b6);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d08b755..371d20e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57cd=['UserProfileResource','resourceId','map','Campaign','where','ivr','format','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','Trunk','VoiceQueues','ChatQueues','SmsQueue','OpenchannelQueue','WhatsappQueue','IvrCampaigns','agent','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','telephone','type','findOne','then','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks'];(function(_0x2c3a11,_0x35034d){var _0x2da91c=function(_0x5bdd12){while(--_0x5bdd12){_0x2c3a11['push'](_0x2c3a11['shift']());}};_0x2da91c(++_0x35034d);}(_0x57cd,0x121));var _0xd57c=function(_0xe67fe3,_0x14ac43){_0xe67fe3=_0xe67fe3-0x0;var _0x2769af=_0x57cd[_0xe67fe3];return _0x2769af;};'use strict';var _=require(_0xd57c('0x0'));var util=require(_0xd57c('0x1'));var BPromise=require('bluebird');var db=require(_0xd57c('0x2'))['db'];var config=require(_0xd57c('0x3'));var queryQueues={'attributes':['id',_0xd57c('0x4')],'include':[{'as':_0xd57c('0x5'),'model':db[_0xd57c('0x6')],'attributes':['id',_0xd57c('0x4'),_0xd57c('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd57c('0x4')],'where':{'role':_0xd57c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd57c('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xd57c('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xd57c('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x5a9f37,_0x1033df,_0x2fbb8b){return db['UserProfileSection'][_0xd57c('0xa')]({'where':{'name':_0x5a9f37,'userProfileId':_0x1033df},'raw':!![]})[_0xd57c('0xb')](function(_0x204232){if(_0x204232){if(_0x204232['autoAssociation']){switch(_0x5a9f37){case'VoiceQueues':case'ChatQueues':case _0xd57c('0xc'):case _0xd57c('0xd'):case _0xd57c('0xe'):case _0xd57c('0xf'):case _0xd57c('0x10'):return db[_0x2fbb8b]['findAll'](queryQueues);case _0xd57c('0x11'):return db[_0x2fbb8b][_0xd57c('0x12')](queryTelephones);case _0xd57c('0x13'):return db[_0x2fbb8b][_0xd57c('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x2fbb8b][_0xd57c('0x12')](queryCampaigns);}}else{return db[_0xd57c('0x14')][_0xd57c('0x12')]({'attributes':[_0xd57c('0x15')],'where':{'sectionId':_0x204232['id']},'raw':!![]})[_0xd57c('0xb')](function(_0x163540){if(_0x163540){var _0xff0347={'where':{'id':_[_0xd57c('0x16')](_0x163540,_0xd57c('0x15'))},'raw':!![]};switch(_0x2fbb8b){case _0xd57c('0x6'):_0xff0347['where'][_0xd57c('0x7')]='telephone';break;case _0xd57c('0x17'):_0xff0347[_0xd57c('0x18')][_0xd57c('0x9')]=_0xd57c('0x19');break;}return db[_0x2fbb8b][_0xd57c('0x12')](_0xff0347);}else{return[];}});}}else{return[];}})['then'](function(_0x56b42e){return _0x56b42e;});}function joinOrLeaveQueues(_0x558552,_0xc772da,_0x355cc2,_0x5eca4a){_0x558552[_0xc772da](util[_0xd57c('0x1a')](_0xd57c('0x1b'),_0x355cc2,_0x5eca4a[_0xd57c('0x4')]));if(_0x5eca4a[_0xd57c('0x5')]){for(var _0x27dbc3=0x0;_0x27dbc3<_0x5eca4a[_0xd57c('0x5')]['length'];_0x27dbc3+=0x1){_0x558552[_0xc772da](util[_0xd57c('0x1a')](_0xd57c('0x1c'),_0x5eca4a[_0xd57c('0x5')][_0x27dbc3][_0xd57c('0x4')]));}}}function joinOrLeave(_0x39678f,_0x35a7c6,_0xc90181){var _0x38e751;if(_0x39678f[_0xd57c('0x1d')][_0xd57c('0x1e')]['id']){db[_0xd57c('0x6')]['find']({'attributes':['id','name',_0xd57c('0x7'),_0xd57c('0x1f')],'where':{'id':_0x39678f[_0xd57c('0x1d')][_0xd57c('0x1e')]['id']},'include':[{'model':db[_0xd57c('0x20')],'as':_0xd57c('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x22')],'as':_0xd57c('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x24')],'as':_0xd57c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x27')],'as':_0xd57c('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xd57c('0x29')],'as':_0xd57c('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xd57c('0xb')](function(_0xe09df1){if(_0xe09df1){_0x38e751=_0xe09df1;_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')](_0xd57c('0x1c'),_0xe09df1['name']));var _0x4e07ba=[];switch(_0xe09df1[_0xd57c('0x7')]){case _0xd57c('0x2b'):_0x39678f[_0x35a7c6](_0xd57c('0x2c'));_0x39678f[_0x35a7c6](_0xd57c('0x2d'));if(queryQueues[_0xd57c('0x2e')](_0xd57c('0x2f'))){delete queryQueues[_0xd57c('0x2f')];}_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x31')][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x32')][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x33')][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db['SmsQueue']['findAll'](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x34')][_0xd57c('0x12')](queryQueues));_0x4e07ba['push'](db['OpenchannelQueue']['findAll'](queryQueues));_0x4e07ba[_0xd57c('0x30')](db['WhatsappQueue'][_0xd57c('0x12')](queryQueues));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x6')][_0xd57c('0x12')](queryTelephones));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x35')]['findAll'](queryTrunks));_0x4e07ba[_0xd57c('0x30')](db['Campaign'][_0xd57c('0x12')](queryCampaigns));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x6')][_0xd57c('0x12')](queryAgents));break;case'user':_0x39678f[_0x35a7c6](_0xd57c('0x2c'));_0x39678f[_0x35a7c6](_0xd57c('0x2d'));_0x4e07ba['push'](getAssociatedResources(_0xd57c('0x36'),_0xe09df1['userProfileId'],_0xd57c('0x31')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0x37'),_0xe09df1[_0xd57c('0x1f')],'ChatQueue'));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xc'),_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x33')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xd'),_0xe09df1['userProfileId'],_0xd57c('0x38')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xe'),_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x34')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0xf'),_0xe09df1['userProfileId'],_0xd57c('0x39')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0x10'),_0xe09df1['userProfileId'],_0xd57c('0x3a')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources('Telephones',_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x6')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources('Trunks',_0xe09df1[_0xd57c('0x1f')],_0xd57c('0x35')));_0x4e07ba[_0xd57c('0x30')](getAssociatedResources(_0xd57c('0x3b'),_0xe09df1['userProfileId'],_0xd57c('0x17')));_0x4e07ba[_0xd57c('0x30')](db[_0xd57c('0x6')][_0xd57c('0x12')](queryAgents));break;case _0xd57c('0x3c'):_0x39678f[_0x35a7c6](_0xd57c('0x2c'));_0x39678f[_0x35a7c6](_0xd57c('0x2d'));_0x4e07ba[_0xd57c('0x30')](_0xe09df1[_0xd57c('0x3d')]({'attributes':['id',_0xd57c('0x4')]}));_0x4e07ba['push'](_0xe09df1[_0xd57c('0x3e')]({'attributes':['id','name']}));_0x4e07ba[_0xd57c('0x30')](_0xe09df1[_0xd57c('0x3f')]({'attributes':['id',_0xd57c('0x4')]}));_0x4e07ba[_0xd57c('0x30')](_0xe09df1[_0xd57c('0x40')]({'attributes':['id',_0xd57c('0x4')]}));_0x4e07ba['push'](_0xe09df1[_0xd57c('0x41')]({'attributes':['id','name']}));_0x4e07ba['push'](_0xe09df1['getOpenchannelQueues']({'attributes':['id','name']}));_0x4e07ba['push'](_0xe09df1[_0xd57c('0x42')]({'attributes':['id',_0xd57c('0x4')]}));break;}return BPromise[_0xd57c('0x43')](_0x4e07ba);}})['then'](function(_0x273641){if(_0x273641&&_0x273641[_0xd57c('0x44')]){for(var _0x11a14c=0x0;_0x11a14c<_0x273641[_0xd57c('0x44')];_0x11a14c+=0x1){for(var _0xc1f994=0x0;_0xc1f994<_0x273641[_0x11a14c]['length'];_0xc1f994+=0x1){switch(_0x11a14c){case 0x0:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x45'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x1:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x46'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x2:joinOrLeaveQueues(_0x39678f,_0x35a7c6,'fax',_0x273641[_0x11a14c][_0xc1f994]);break;case 0x3:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x47'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x4:joinOrLeaveQueues(_0x39678f,_0x35a7c6,'mail',_0x273641[_0x11a14c][_0xc1f994]);break;case 0x5:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x48'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x6:joinOrLeaveQueues(_0x39678f,_0x35a7c6,_0xd57c('0x49'),_0x273641[_0x11a14c][_0xc1f994]);break;case 0x7:_0x39678f[_0x35a7c6](util['format'](_0xd57c('0x4a'),_0x273641[_0x11a14c][_0xc1f994]['name']));break;case 0x8:_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')](_0xd57c('0x4b'),_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x4')]));break;case 0x9:_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')](_0xd57c('0x4c'),_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x9')],_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x4')]));break;case 0xa:_0x39678f[_0x35a7c6](util[_0xd57c('0x1a')]('user:%s',_0x273641[_0x11a14c][_0xc1f994][_0xd57c('0x4')]));break;}}}}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x1a6bfd=_[_0xd57c('0x16')](_0x38e751[_0xd57c('0x21')],'id');return _0x38e751[_0xd57c('0x4e')](_0x1a6bfd)[_0xd57c('0xb')](function(){for(var _0x34d37a=0x0;_0x34d37a<_0x1a6bfd[_0xd57c('0x44')];_0x34d37a+=0x1){_0xc90181['emit'](_0xd57c('0x4f'),{'ChatInteractionId':Number(_0x1a6bfd[_0x34d37a]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x2e6541=_[_0xd57c('0x16')](_0x38e751[_0xd57c('0x23')],'id');return _0x38e751['removeMailInteractions'](_0x2e6541)[_0xd57c('0xb')](function(){for(var _0xb4aec4=0x0;_0xb4aec4<_0x2e6541[_0xd57c('0x44')];_0xb4aec4+=0x1){_0xc90181[_0xd57c('0x50')](_0xd57c('0x51'),{'MailInteractionId':Number(_0x2e6541[_0xb4aec4]),'UserId':Number(_0x38e751['id'])});}});}})['then'](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x1a5c43=_['map'](_0x38e751[_0xd57c('0x25')],'id');return _0x38e751[_0xd57c('0x52')](_0x1a5c43)['then'](function(){for(var _0x49dfed=0x0;_0x49dfed<_0x1a5c43[_0xd57c('0x44')];_0x49dfed+=0x1){_0xc90181['emit'](_0xd57c('0x53'),{'FaxInteractionId':Number(_0x1a5c43[_0x49dfed]),'UserId':Number(_0x38e751['id'])});}});}})['then'](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0xd84217=_['map'](_0x38e751[_0xd57c('0x54')],'id');return _0x38e751[_0xd57c('0x55')](_0xd84217)[_0xd57c('0xb')](function(){for(var _0x2ec55c=0x0;_0x2ec55c<_0xd84217[_0xd57c('0x44')];_0x2ec55c+=0x1){_0xc90181[_0xd57c('0x50')](_0xd57c('0x56'),{'SmsInteractionId':Number(_0xd84217[_0x2ec55c]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x1b245c=_['map'](_0x38e751[_0xd57c('0x28')],'id');return _0x38e751['removeOpenchannelInteractions'](_0x1b245c)[_0xd57c('0xb')](function(){for(var _0x5a4712=0x0;_0x5a4712<_0x1b245c[_0xd57c('0x44')];_0x5a4712+=0x1){_0xc90181[_0xd57c('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1b245c[_0x5a4712]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0xb')](function(){if(_0x35a7c6===_0xd57c('0x4d')){var _0x298b9b=_[_0xd57c('0x16')](_0x38e751[_0xd57c('0x2a')],'id');return _0x38e751[_0xd57c('0x57')](_0x298b9b)[_0xd57c('0xb')](function(){for(var _0x9e67cf=0x0;_0x9e67cf<_0x298b9b['length'];_0x9e67cf+=0x1){_0xc90181[_0xd57c('0x50')](_0xd57c('0x58'),{'WhatsappInteractionId':Number(_0x298b9b[_0x9e67cf]),'UserId':Number(_0x38e751['id'])});}});}})[_0xd57c('0x59')](function(_0x424d50){_0x39678f['log'](_0x424d50);});}}function onDisconnect(_0x4d584c,_0x2b9f1c){joinOrLeave(_0x4d584c,_0xd57c('0x4d'),_0x2b9f1c);}function onConnect(_0x40564a){joinOrLeave(_0x40564a,_0xd57c('0x5a'));}exports[_0xd57c('0x5b')]=function(_0x285340){_0x285340['on'](_0xd57c('0x5c'),function(_0xdc439){_0xdc439[_0xd57c('0x5d')](0x0);_0xdc439[_0xd57c('0x5e')]=_0xdc439[_0xd57c('0x5f')][_0xd57c('0x5c')][_0xd57c('0x60')]+':'+_0xdc439[_0xd57c('0x5f')][_0xd57c('0x5c')][_0xd57c('0x61')];_0xdc439[_0xd57c('0x62')]=new Date();_0xdc439['log']=function(_0x567cc6){console[_0xd57c('0x63')](_0xd57c('0x64')+_0xdc439['nsp'][_0xd57c('0x4')]+'['+_0xdc439[_0xd57c('0x5e')]+']',_0x567cc6);};_0xdc439['on'](_0xd57c('0x65'),function(){onDisconnect(_0xdc439,_0x285340);_0xdc439['log'](_0xd57c('0x66'));});onConnect(_0xdc439);_0xdc439['log']('CONNECTED');});}; \ No newline at end of file +var _0x5cd8=['SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:outbound','VoiceQueues','ChatQueues','Trunk','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','openchannel','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','type','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x54c0fd,_0x2b2747){_0x54c0fd=_0x54c0fd-0x0;var _0x35fe6b=_0x5cd8[_0x54c0fd];return _0x35fe6b;};'use strict';var _=require(_0x85cd('0x0'));var util=require('util');var BPromise=require(_0x85cd('0x1'));var db=require(_0x85cd('0x2'))['db'];var config=require(_0x85cd('0x3'));var queryQueues={'attributes':['id',_0x85cd('0x4')],'include':[{'as':'Agents','model':db[_0x85cd('0x5')],'attributes':['id','name',_0x85cd('0x6')],'raw':!![],'where':{'role':_0x85cd('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x85cd('0x4')],'where':{'role':_0x85cd('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x85cd('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x85cd('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x85cd('0x4'),'type'],'where':{'type':_0x85cd('0x9')}};function getAssociatedResources(_0x138cf9,_0x318aa7,_0x30204b){return db[_0x85cd('0xa')][_0x85cd('0xb')]({'where':{'name':_0x138cf9,'userProfileId':_0x318aa7},'raw':!![]})[_0x85cd('0xc')](function(_0x13d545){if(_0x13d545){if(_0x13d545[_0x85cd('0xd')]){switch(_0x138cf9){case'VoiceQueues':case'ChatQueues':case _0x85cd('0xe'):case _0x85cd('0xf'):case _0x85cd('0x10'):case _0x85cd('0x11'):case'WhatsappQueues':return db[_0x30204b][_0x85cd('0x12')](queryQueues);case _0x85cd('0x13'):return db[_0x30204b][_0x85cd('0x12')](queryTelephones);case _0x85cd('0x14'):return db[_0x30204b][_0x85cd('0x12')](queryTrunks);case _0x85cd('0x15'):return db[_0x30204b][_0x85cd('0x12')](queryCampaigns);}}else{return db[_0x85cd('0x16')]['findAll']({'attributes':[_0x85cd('0x17')],'where':{'sectionId':_0x13d545['id']},'raw':!![]})[_0x85cd('0xc')](function(_0x208490){if(_0x208490){var _0x424a01={'where':{'id':_[_0x85cd('0x18')](_0x208490,'resourceId')},'raw':!![]};switch(_0x30204b){case _0x85cd('0x5'):_0x424a01['where'][_0x85cd('0x6')]='telephone';break;case _0x85cd('0x19'):_0x424a01['where'][_0x85cd('0x1a')]=_0x85cd('0x9');break;}return db[_0x30204b][_0x85cd('0x12')](_0x424a01);}else{return[];}});}}else{return[];}})[_0x85cd('0xc')](function(_0x23695f){return _0x23695f;});}function joinOrLeaveQueues(_0x1123c0,_0x290ca9,_0x44ba80,_0x515ce1){_0x1123c0[_0x290ca9](util[_0x85cd('0x1b')](_0x85cd('0x1c'),_0x44ba80,_0x515ce1['name']));if(_0x515ce1['Agents']){for(var _0x5c268f=0x0;_0x5c268f<_0x515ce1['Agents'][_0x85cd('0x1d')];_0x5c268f+=0x1){_0x1123c0[_0x290ca9](util['format'](_0x85cd('0x1e'),_0x515ce1[_0x85cd('0x1f')][_0x5c268f][_0x85cd('0x4')]));}}}function joinOrLeave(_0x14ab80,_0x592b77,_0x290b57){var _0x2b00a8;if(_0x14ab80[_0x85cd('0x20')][_0x85cd('0x21')]['id']){db[_0x85cd('0x5')][_0x85cd('0x22')]({'attributes':['id','name',_0x85cd('0x6'),_0x85cd('0x23')],'where':{'id':_0x14ab80[_0x85cd('0x20')][_0x85cd('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x85cd('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x25')],'as':_0x85cd('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x28')],'as':_0x85cd('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x85cd('0x2a')],'as':_0x85cd('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x225802){if(_0x225802){_0x2b00a8=_0x225802;_0x14ab80[_0x592b77](util[_0x85cd('0x1b')](_0x85cd('0x1e'),_0x225802[_0x85cd('0x4')]));var _0x587f02=[];switch(_0x225802[_0x85cd('0x6')]){case _0x85cd('0x2c'):_0x14ab80[_0x592b77](_0x85cd('0x2d'));_0x14ab80[_0x592b77]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x85cd('0x2e'))){delete queryQueues[_0x85cd('0x2e')];}_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x30')][_0x85cd('0x12')](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x31')][_0x85cd('0x12')](queryQueues));_0x587f02['push'](db[_0x85cd('0x32')][_0x85cd('0x12')](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x33')]['findAll'](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x34')][_0x85cd('0x12')](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x35')]['findAll'](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x36')]['findAll'](queryQueues));_0x587f02[_0x85cd('0x2f')](db[_0x85cd('0x5')][_0x85cd('0x12')](queryTelephones));_0x587f02['push'](db['Trunk'][_0x85cd('0x12')](queryTrunks));_0x587f02[_0x85cd('0x2f')](db['Campaign']['findAll'](queryCampaigns));_0x587f02[_0x85cd('0x2f')](db['User']['findAll'](queryAgents));break;case _0x85cd('0x37'):_0x14ab80[_0x592b77](_0x85cd('0x2d'));_0x14ab80[_0x592b77](_0x85cd('0x38'));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x39'),_0x225802[_0x85cd('0x23')],_0x85cd('0x30')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x3a'),_0x225802[_0x85cd('0x23')],_0x85cd('0x31')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0xe'),_0x225802[_0x85cd('0x23')],_0x85cd('0x32')));_0x587f02['push'](getAssociatedResources(_0x85cd('0xf'),_0x225802[_0x85cd('0x23')],_0x85cd('0x33')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x10'),_0x225802[_0x85cd('0x23')],_0x85cd('0x34')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x11'),_0x225802[_0x85cd('0x23')],_0x85cd('0x35')));_0x587f02['push'](getAssociatedResources('WhatsappQueues',_0x225802[_0x85cd('0x23')],_0x85cd('0x36')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x13'),_0x225802['userProfileId'],_0x85cd('0x5')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x14'),_0x225802['userProfileId'],_0x85cd('0x3b')));_0x587f02[_0x85cd('0x2f')](getAssociatedResources(_0x85cd('0x15'),_0x225802[_0x85cd('0x23')],_0x85cd('0x19')));_0x587f02[_0x85cd('0x2f')](db['User']['findAll'](queryAgents));break;case _0x85cd('0x7'):_0x14ab80[_0x592b77](_0x85cd('0x2d'));_0x14ab80[_0x592b77](_0x85cd('0x38'));_0x587f02['push'](_0x225802[_0x85cd('0x3c')]({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802['getChatQueues']({'attributes':['id',_0x85cd('0x4')]}));_0x587f02['push'](_0x225802['getFaxQueues']({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x3d')]({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x3e')]({'attributes':['id','name']}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x3f')]({'attributes':['id',_0x85cd('0x4')]}));_0x587f02[_0x85cd('0x2f')](_0x225802[_0x85cd('0x40')]({'attributes':['id',_0x85cd('0x4')]}));break;}return BPromise[_0x85cd('0x41')](_0x587f02);}})[_0x85cd('0xc')](function(_0x511b2a){if(_0x511b2a&&_0x511b2a['length']){for(var _0x2ae134=0x0;_0x2ae134<_0x511b2a[_0x85cd('0x1d')];_0x2ae134+=0x1){for(var _0x3d7af4=0x0;_0x3d7af4<_0x511b2a[_0x2ae134][_0x85cd('0x1d')];_0x3d7af4+=0x1){switch(_0x2ae134){case 0x0:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x42'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x1:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x43'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x2:joinOrLeaveQueues(_0x14ab80,_0x592b77,'fax',_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x3:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x44'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x4:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x45'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x5:joinOrLeaveQueues(_0x14ab80,_0x592b77,_0x85cd('0x46'),_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x6:joinOrLeaveQueues(_0x14ab80,_0x592b77,'whatsapp',_0x511b2a[_0x2ae134][_0x3d7af4]);break;case 0x7:_0x14ab80[_0x592b77](util['format']('telephone:%s',_0x511b2a[_0x2ae134][_0x3d7af4]['name']));break;case 0x8:_0x14ab80[_0x592b77](util['format'](_0x85cd('0x47'),_0x511b2a[_0x2ae134][_0x3d7af4]['name']));break;case 0x9:_0x14ab80[_0x592b77](util['format'](_0x85cd('0x48'),_0x511b2a[_0x2ae134][_0x3d7af4][_0x85cd('0x1a')],_0x511b2a[_0x2ae134][_0x3d7af4][_0x85cd('0x4')]));break;case 0xa:_0x14ab80[_0x592b77](util[_0x85cd('0x1b')]('user:%s',_0x511b2a[_0x2ae134][_0x3d7af4][_0x85cd('0x4')]));break;}}}}})[_0x85cd('0xc')](function(){if(_0x592b77==='leave'){var _0x58f5ce=_[_0x85cd('0x18')](_0x2b00a8['ChatInteractions'],'id');return _0x2b00a8[_0x85cd('0x49')](_0x58f5ce)['then'](function(){for(var _0x79f956=0x0;_0x79f956<_0x58f5ce[_0x85cd('0x1d')];_0x79f956+=0x1){_0x290b57[_0x85cd('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x58f5ce[_0x79f956]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0xc')](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x36c146=_[_0x85cd('0x18')](_0x2b00a8['MailInteractions'],'id');return _0x2b00a8[_0x85cd('0x4c')](_0x36c146)[_0x85cd('0xc')](function(){for(var _0x4d6aeb=0x0;_0x4d6aeb<_0x36c146[_0x85cd('0x1d')];_0x4d6aeb+=0x1){_0x290b57['emit'](_0x85cd('0x4d'),{'MailInteractionId':Number(_0x36c146[_0x4d6aeb]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0xc')](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x42cf1a=_[_0x85cd('0x18')](_0x2b00a8[_0x85cd('0x4e')],'id');return _0x2b00a8['removeFaxInteractions'](_0x42cf1a)['then'](function(){for(var _0x35b575=0x0;_0x35b575<_0x42cf1a[_0x85cd('0x1d')];_0x35b575+=0x1){_0x290b57[_0x85cd('0x4a')](_0x85cd('0x4f'),{'FaxInteractionId':Number(_0x42cf1a[_0x35b575]),'UserId':Number(_0x2b00a8['id'])});}});}})['then'](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x1afbff=_[_0x85cd('0x18')](_0x2b00a8[_0x85cd('0x50')],'id');return _0x2b00a8[_0x85cd('0x51')](_0x1afbff)[_0x85cd('0xc')](function(){for(var _0x3ab6d4=0x0;_0x3ab6d4<_0x1afbff['length'];_0x3ab6d4+=0x1){_0x290b57['emit'](_0x85cd('0x52'),{'SmsInteractionId':Number(_0x1afbff[_0x3ab6d4]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0xc')](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x349208=_['map'](_0x2b00a8[_0x85cd('0x29')],'id');return _0x2b00a8[_0x85cd('0x53')](_0x349208)['then'](function(){for(var _0x395b9a=0x0;_0x395b9a<_0x349208[_0x85cd('0x1d')];_0x395b9a+=0x1){_0x290b57['emit'](_0x85cd('0x54'),{'OpenchannelInteractionId':Number(_0x349208[_0x395b9a]),'UserId':Number(_0x2b00a8['id'])});}});}})['then'](function(){if(_0x592b77===_0x85cd('0x4b')){var _0x56e747=_[_0x85cd('0x18')](_0x2b00a8[_0x85cd('0x2b')],'id');return _0x2b00a8[_0x85cd('0x55')](_0x56e747)[_0x85cd('0xc')](function(){for(var _0x14179b=0x0;_0x14179b<_0x56e747['length'];_0x14179b+=0x1){_0x290b57['emit'](_0x85cd('0x56'),{'WhatsappInteractionId':Number(_0x56e747[_0x14179b]),'UserId':Number(_0x2b00a8['id'])});}});}})[_0x85cd('0x57')](function(_0x5b1c19){_0x14ab80[_0x85cd('0x58')](_0x5b1c19);});}}function onDisconnect(_0x461038,_0xe1f0bb){joinOrLeave(_0x461038,_0x85cd('0x4b'),_0xe1f0bb);}function onConnect(_0x1f6f18){joinOrLeave(_0x1f6f18,'join');}exports[_0x85cd('0x59')]=function(_0x2c669c){_0x2c669c['on'](_0x85cd('0x5a'),function(_0x680dc9){_0x680dc9[_0x85cd('0x5b')](0x0);_0x680dc9[_0x85cd('0x5c')]=_0x680dc9[_0x85cd('0x5d')][_0x85cd('0x5a')][_0x85cd('0x5e')]+':'+_0x680dc9['request']['connection'][_0x85cd('0x5f')];_0x680dc9[_0x85cd('0x60')]=new Date();_0x680dc9[_0x85cd('0x58')]=function(_0x4525f8){console[_0x85cd('0x58')](_0x85cd('0x61')+_0x680dc9['nsp'][_0x85cd('0x4')]+'['+_0x680dc9[_0x85cd('0x5c')]+']',_0x4525f8);};_0x680dc9['on'](_0x85cd('0x62'),function(){onDisconnect(_0x680dc9,_0x2c669c);_0x680dc9['log'](_0x85cd('0x63'));});onConnect(_0x680dc9);_0x680dc9['log'](_0x85cd('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f33eba9..74a90d5 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 _0x5778=['newinteraction','Chat','afterUpdate','ChatMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','request','then','info','EventManager','error','code','Trigger,\x20%s','channel','event','UserId','User','name','format','SIP/%s','incomingmessage','outgoingmessage','opened','closed','get','catch','hasOwnProperty','callback','toLowerCase','../../mysqldb','client','ChatInteraction','afterCreate'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0x5778,0x137));var _0x8577=function(_0x1b0d65,_0x3deb10){_0x1b0d65=_0x1b0d65-0x0;var _0x2407a1=_0x5778[_0x1b0d65];return _0x2407a1;};'use strict';var util=require('util');var db=require(_0x8577('0x0'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')('triggers');var client=jayson[_0x8577('0x1')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x8577('0x2'),'event':_0x8577('0x3'),'condition':_0x8577('0x4'),'callback':afterCreate},{'channel':_0x8577('0x5'),'model':_0x8577('0x2'),'event':_0x8577('0x6'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8577('0x5'),'model':_0x8577('0x7'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8577('0x8'),'model':_0x8577('0x9'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x8577('0x8'),'model':_0x8577('0x9'),'event':_0x8577('0x6'),'condition':_0x8577('0xa'),'callback':afterUpdate},{'channel':_0x8577('0x8'),'model':_0x8577('0xb'),'event':_0x8577('0x3'),'condition':_0x8577('0xc'),'callback':afterCreateMessage},{'channel':_0x8577('0xd'),'model':_0x8577('0xe'),'event':_0x8577('0x3'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8577('0xd'),'model':'WhatsappInteraction','event':_0x8577('0x6'),'condition':_0x8577('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':'afterCreate','condition':_0x8577('0xc'),'callback':afterCreateMessage},{'channel':_0x8577('0xf'),'model':_0x8577('0x10'),'event':_0x8577('0x3'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0x8577('0x10'),'event':_0x8577('0x6'),'condition':_0x8577('0xa'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x8577('0x3'),'condition':_0x8577('0xc'),'callback':afterCreateMessage},{'channel':_0x8577('0x11'),'model':'MailInteraction','event':_0x8577('0x3'),'condition':_0x8577('0x4'),'callback':afterCreate},{'channel':_0x8577('0x11'),'model':_0x8577('0x12'),'event':_0x8577('0x6'),'condition':_0x8577('0xa'),'callback':afterUpdate},{'channel':_0x8577('0x11'),'model':_0x8577('0x13'),'event':'afterCreate','condition':_0x8577('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x8577('0x14'),'event':_0x8577('0x3'),'condition':_0x8577('0x4'),'callback':afterCreate},{'channel':_0x8577('0x15'),'model':_0x8577('0x14'),'event':_0x8577('0x6'),'condition':_0x8577('0xa'),'callback':afterUpdate},{'channel':_0x8577('0x15'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x8577('0xc'),'callback':afterCreateMessage}];function request(_0x260c51){return client[_0x8577('0x16')]('EventManager',_0x260c51)[_0x8577('0x17')](function(_0x190d7d){logger[_0x8577('0x18')]('Trigger,\x20%s',_0x8577('0x19'),_0x190d7d);if(_0x190d7d['error']){if(_0x190d7d[_0x8577('0x1a')][_0x8577('0x1b')]===0x1f4){logger['error']('Trigger,\x20%s',_0x8577('0x19'),_0x190d7d[_0x8577('0x1a')]);}}})['catch'](function(_0x3554c3){logger[_0x8577('0x1a')](_0x8577('0x1c'),_0x8577('0x19'),_0x3554c3);});}function afterCreateMessage(_0x51dd88,_0x51c527){return function(_0x519024,_0x454d8e){_0x519024=_0x519024['get']({'plain':!![]});_0x519024[_0x8577('0x1d')]=_0x51dd88;_0x519024[_0x8577('0x1e')]=_0x519024['direction'];if(_0x519024[_0x8577('0x1f')]){return db[_0x8577('0x20')]['find']({'where':{'id':_0x519024[_0x8577('0x1f')]},'attributes':['id',_0x8577('0x21')],'raw':!![]})[_0x8577('0x17')](function(_0xffad11){_0x519024['interface']=util[_0x8577('0x22')](_0x8577('0x23'),_0xffad11[_0x8577('0x21')]);_0x519024[_0x8577('0x1d')]=_0x51dd88;return request({'event':_0x8577('0x24'),'message':_0x519024});})['catch'](function(_0x500bf9){console[_0x8577('0x1a')](_0x500bf9);});}else{return request({'event':_0x8577('0x25'),'message':_0x519024});}};}function afterCreate(_0x5326e9,_0x415f6e){return function(_0x558f59,_0x4a2a72){_0x558f59=_0x558f59['get']({'plain':!![]});_0x558f59['channel']=_0x5326e9;_0x558f59[_0x8577('0x1e')]=_0x8577('0x26');return request({'event':_0x415f6e,'message':_0x558f59});};}function afterUpdate(_0x3b7ffc,_0x1314a7){return function(_0x1e2d73,_0x52c4fe){if(_0x1e2d73['changed'](_0x8577('0x27'))&&_0x1e2d73[_0x8577('0x27')]){_0x1e2d73=_0x1e2d73[_0x8577('0x28')]({'plain':!![]});_0x1e2d73[_0x8577('0x1d')]=_0x3b7ffc;_0x1e2d73[_0x8577('0x1e')]=_0x8577('0x27');if(_0x1e2d73[_0x8577('0x1f')]){return db[_0x8577('0x20')]['find']({'where':{'id':_0x1e2d73[_0x8577('0x1f')]},'attributes':['id','name'],'raw':!![]})[_0x8577('0x17')](function(_0x40370f){_0x1e2d73['interface']=util[_0x8577('0x22')](_0x8577('0x23'),_0x40370f['name']);return request({'event':_0x1314a7,'message':_0x1e2d73});})[_0x8577('0x29')](function(_0x12dfc8){console[_0x8577('0x1a')](_0x12dfc8);});}else{return request({'event':_0x1314a7,'message':_0x1e2d73});}}};}exports['default']=function(){for(var _0x547253=0x0;_0x547253=_0xd37534[_0x12b1('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x38f4d6(_0x24f9a8);})[_0x12b1('0x13')](function(_0xc7fdf5){_0x3b91ac(_0xc7fdf5);});});}; \ No newline at end of file +var _0x0956=['chat','fax','sms','getChannels','isValidChannel','includes','isUndefined','blockedAt','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','mail'];(function(_0x2a92ec,_0x14d4e2){var _0x37fabf=function(_0x56fda9){while(--_0x56fda9){_0x2a92ec['push'](_0x2a92ec['shift']());}};_0x37fabf(++_0x14d4e2);}(_0x0956,0xd5));var _0x6095=function(_0x2304de,_0x2cc3d6){_0x2304de=_0x2304de-0x0;var _0x13a802=_0x0956[_0x2304de];return _0x13a802;};'use strict';var _=require(_0x6095('0x0'));var BPromise=require(_0x6095('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0x6095('0x2'),_0x6095('0x3'),_0x6095('0x4'),_0x6095('0x5'),'whatsapp','openchannel'];exports[_0x6095('0x6')]=function(){return channels;};exports[_0x6095('0x7')]=function(_0x27c705){_0x27c705=_0x27c705['toLowerCase']();return _[_0x6095('0x8')](channels,_0x27c705);};exports['clearBlockUser']=function(_0x46da44,_0x6d99b,_0x1b3bec,_0x376874){var _0x58b37f={'loginAttempts':_0x6d99b,'blocked':_0x1b3bec};if(!_[_0x6095('0x9')](_0x376874)){_0x58b37f[_0x6095('0xa')]=_0x376874;}return _0x46da44['updateAttributes'](_0x58b37f);};exports[_0x6095('0xb')]=function(_0x2a3fbf){return new BPromise(function(_0x2d3a10,_0x4e037b){var _0xeeb6c9=0x0;if(_0x2a3fbf[_0x6095('0xc')]!==_0x6095('0xd')){_0x2d3a10(_0x2a3fbf);}db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2a3fbf['id']}}})[_0x6095('0xe')](function(_0x4ab516){_0xeeb6c9=_0x4ab516;return util[_0x6095('0xb')]();})[_0x6095('0xe')](function(_0x3891df){if(_0x3891df&&_0x3891df[_0x6095('0xf')]&&_0xeeb6c9>=_0x3891df[_0x6095('0xf')]){throw Error(_0x6095('0x10'));}_0x2d3a10(_0x2a3fbf);})[_0x6095('0x11')](function(_0x3ef4be){_0x4e037b(_0x3ef4be);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f87b4f3..fa442c2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2853=['404','status','render','json','send'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x2853,0xbe));var _0x3285=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x2853[_0xefd519];return _0x4bb882;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1959a4,_0x1089de){var _0x365630=_0x3285('0x0');var _0x3d8f7a=0x194;var _0x1d8745={'status':_0x3d8f7a};_0x1089de[_0x3285('0x1')](_0x1d8745[_0x3285('0x1')]);_0x1089de[_0x3285('0x2')](_0x365630,{},function(_0x1abad0,_0x397543){if(_0x1abad0){return _0x1089de[_0x3285('0x1')](_0x1d8745[_0x3285('0x1')])[_0x3285('0x3')](_0x1d8745);}_0x1089de[_0x3285('0x4')](_0x397543);});}; \ No newline at end of file +var _0x762f=['send','exports','404','status','render','json'];(function(_0xdb42a7,_0x3ab4d6){var _0x3af197=function(_0x344acd){while(--_0x344acd){_0xdb42a7['push'](_0xdb42a7['shift']());}};_0x3af197(++_0x3ab4d6);}(_0x762f,0x109));var _0xf762=function(_0x21b4a3,_0x41cac8){_0x21b4a3=_0x21b4a3-0x0;var _0x8f6385=_0x762f[_0x21b4a3];return _0x8f6385;};'use strict';module[_0xf762('0x0')][0x194]=function pageNotFound(_0x3f84c2,_0x1adc2){var _0x4af322=_0xf762('0x1');var _0x46c1f2=0x194;var _0x170109={'status':_0x46c1f2};_0x1adc2[_0xf762('0x2')](_0x170109['status']);_0x1adc2[_0xf762('0x3')](_0x4af322,{},function(_0x135af8,_0x2ed7dc){if(_0x135af8){return _0x1adc2[_0xf762('0x2')](_0x170109[_0xf762('0x2')])[_0xf762('0x4')](_0x170109);}_0x1adc2[_0xf762('0x5')](_0x2ed7dc);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index acd52e0..adb14dc 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb078=['../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','cascade','UserId','hasMany','Recordings','Extensions','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','team_has_voice_queues','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Dispositions','MailMessage','Messages','Interactions','List','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','restrict','TagId','MailQueueReport','Items','FaxAccountId','Answers','Exntensions','FaxMessage','ListId','fax_interaction_has_tags','FaxInteractionId','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','mandatoryDispositionPause','SmsQueue','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ProactiveActions','ChatMessage','OpenchannelQueueReport','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','CompanyId','Hoppers','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','Subjects','Descriptions','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskAccount','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','Dynamics365Configuration','FreshsalesField','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAgent','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','user_has_voice_prefixes','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','utf8mb4','name','utf8','sequelizeHistory','mysql','database','username','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','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','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile'];(function(_0x4d4ee4,_0x5b03f9){var _0x2eae51=function(_0x27c9df){while(--_0x27c9df){_0x4d4ee4['push'](_0x4d4ee4['shift']());}};_0x2eae51(++_0x5b03f9);}(_0xb078,0xfa));var _0x8b07=function(_0x252daf,_0x3335f7){_0x252daf=_0x252daf-0x0;var _0x235cc2=_0xb078[_0x252daf];return _0x235cc2;};'use strict';var path=require(_0x8b07('0x0'));var config=require(_0x8b07('0x1'));var Sequelize=require(_0x8b07('0x2'));var _=require(_0x8b07('0x3'));var jstz=require(_0x8b07('0x4'));var timezone=jstz[_0x8b07('0x5')]();config[_0x8b07('0x2')]=_[_0x8b07('0x6')](config['sequelize'],{'database':'motion2','username':_0x8b07('0x7'),'password':_0x8b07('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8b07('0x9')},'logging':![],'timezone':timezone[_0x8b07('0xa')](),'define':{'charset':_0x8b07('0xb'),'collate':'utf8_general_ci'}}});config[_0x8b07('0xc')]=_['defaultsDeep'](config[_0x8b07('0xc')],{'database':'motion2','username':'xcall','password':_0x8b07('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x8b07('0xd'),'dialectOptions':{'charset':_0x8b07('0x9')},'logging':![],'timezone':timezone[_0x8b07('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b07('0x2')][_0x8b07('0xe')],config[_0x8b07('0x2')][_0x8b07('0xf')],config[_0x8b07('0x2')][_0x8b07('0x10')],config[_0x8b07('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8b07('0xc')][_0x8b07('0xe')],config[_0x8b07('0xc')]['username'],config[_0x8b07('0xc')][_0x8b07('0x10')],config[_0x8b07('0xc')]['options'])};db['User']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x12'));db[_0x8b07('0x13')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x14'));db[_0x8b07('0x15')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/voiceContext/voiceContext.model');db[_0x8b07('0x16')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x17'));db['VoiceMusicOnHold']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x18'));db[_0x8b07('0x19')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x1a'));db[_0x8b07('0x1b')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x1c'));db[_0x8b07('0x1d')]=db['sequelize'][_0x8b07('0x11')]('../api/screenRecording/screenRecording.model');db[_0x8b07('0x1e')]=db['sequelize']['import'](_0x8b07('0x1f'));db[_0x8b07('0x20')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8b07('0x21')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x22'));db['VoiceAgentReport']=db['sequelize']['import'](_0x8b07('0x23'));db[_0x8b07('0x24')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x25'));db[_0x8b07('0x26')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x27'));db[_0x8b07('0x28')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x29'));db[_0x8b07('0x2a')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x2b'));db[_0x8b07('0x2c')]=db['sequelize'][_0x8b07('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8b07('0x2d')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x2e'));db[_0x8b07('0x2f')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x30'));db['UserMailQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x31'));db[_0x8b07('0x32')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x33'));db[_0x8b07('0x34')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x35'));db['UserWhatsappQueue']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x36'));db[_0x8b07('0x37')]=db['sequelize'][_0x8b07('0x11')]('../api/mailServerIn/mailServerIn.model');db[_0x8b07('0x38')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x39'));db[_0x8b07('0x3a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x3b'));db[_0x8b07('0x3c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x3d'));db[_0x8b07('0x3e')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x3f'));db[_0x8b07('0x40')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x41'));db['MailMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x42'));db[_0x8b07('0x43')]=db['sequelize']['import'](_0x8b07('0x44'));db['MailQueueReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x45'));db[_0x8b07('0x46')]=db['sequelize'][_0x8b07('0x11')]('../api/dashboard/dashboard.model');db[_0x8b07('0x47')]=db['sequelize']['import'](_0x8b07('0x48'));db[_0x8b07('0x49')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x4a'));db[_0x8b07('0x4b')]=db['sequelize'][_0x8b07('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x4c'));db[_0x8b07('0x4d')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x4e'));db[_0x8b07('0x4f')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x50'));db[_0x8b07('0x51')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x52'));db[_0x8b07('0x53')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x54'));db[_0x8b07('0x55')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x56'));db['SmsQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x57'));db[_0x8b07('0x58')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x59'));db[_0x8b07('0x5a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x5b'));db[_0x8b07('0x5c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x5d'));db[_0x8b07('0x5e')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x5f'));db['OpenchannelQueue']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x60'));db['ChatWebsite']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x61'));db['OpenchannelQueueReport']=db[_0x8b07('0x2')]['import'](_0x8b07('0x62'));db[_0x8b07('0x63')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x64'));db['ChatInteraction']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x65'));db['ChatMessage']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x66'));db[_0x8b07('0x67')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x68'));db[_0x8b07('0x69')]=db['sequelize']['import'](_0x8b07('0x6a'));db[_0x8b07('0x6b')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x6c'));db[_0x8b07('0x6d')]=db[_0x8b07('0x2')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0x8b07('0x2')]['import'](_0x8b07('0x6e'));db[_0x8b07('0x6f')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x70'));db[_0x8b07('0x71')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/cmHopper/cmHopper.model');db[_0x8b07('0x72')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x73'));db[_0x8b07('0x74')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x75'));db[_0x8b07('0x76')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x77'));db[_0x8b07('0x78')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x79'));db[_0x8b07('0x7a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x7b'));db[_0x8b07('0x7c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x7d'));db[_0x8b07('0x7e')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x7f'));db[_0x8b07('0x80')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x81'));db[_0x8b07('0x82')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x83'));db[_0x8b07('0x84')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x85'));db[_0x8b07('0x86')]=db[_0x8b07('0x2')]['import']('../api/interval/interval.model');db[_0x8b07('0x87')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/pause/pause.model');db[_0x8b07('0x88')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x89'));db[_0x8b07('0x8a')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x8b'));db[_0x8b07('0x8c')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x8d'));db[_0x8b07('0x8e')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x8f'));db[_0x8b07('0x90')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x91'));db[_0x8b07('0x92')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/template/template.model');db[_0x8b07('0x93')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x94'));db['Variable']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/variable/variable.model');db[_0x8b07('0x95')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x96'));db['IntegrationReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x97'));db['AnalyticCustomReport']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x8b07('0x98')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0x99'));db[_0x8b07('0x9a')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x8b07('0x9b')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x9c'));db[_0x8b07('0x9d')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x9e'));db['AnalyticTreeReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x9f'));db[_0x8b07('0xa0')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xa1'));db[_0x8b07('0xa2')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x8b07('0xa3')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xa4'));db[_0x8b07('0xa5')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xa6'));db[_0x8b07('0xa7')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x8b07('0xa8')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xa9'));db[_0x8b07('0xaa')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xab'));db[_0x8b07('0xac')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xad'));db[_0x8b07('0xae')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xaf'));db['ZohoAccount']=db[_0x8b07('0x2')]['import'](_0x8b07('0xb0'));db['ZohoConfiguration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb1'));db[_0x8b07('0xb2')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb3'));db[_0x8b07('0xb4')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb5'));db[_0x8b07('0xb6')]=db['sequelize'][_0x8b07('0x11')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb7'));db['FreshdeskConfiguration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xb8'));db[_0x8b07('0xb9')]=db[_0x8b07('0x2')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8b07('0xba')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xbb'));db['VtigerConfiguration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xbc'));db[_0x8b07('0xbd')]=db[_0x8b07('0x2')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x8b07('0x2')]['import'](_0x8b07('0xbe'));db[_0x8b07('0xbf')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xc0'));db[_0x8b07('0xc1')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xc2'));db['Dynamics365Account']=db['sequelize']['import'](_0x8b07('0xc3'));db['Dynamics365Configuration']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xc4'));db[_0x8b07('0xc5')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xc6'));db[_0x8b07('0xc7')]=db[_0x8b07('0x2')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x8b07('0xc8')]=db[_0x8b07('0x2')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xc9'));db[_0x8b07('0x95')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x96'));db['Network']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xca'));db[_0x8b07('0xcb')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xcc'));db[_0x8b07('0xcd')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xce'));db[_0x8b07('0xcf')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xd0'));db[_0x8b07('0xd1')]=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xd2'));db[_0x8b07('0xd3')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xd4'));db['SmsQueueReport']=db['sequelize'][_0x8b07('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0x8b07('0xd5')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xd6'));db[_0x8b07('0xd7')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xd8'));db[_0x8b07('0xd9')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0x8b07('0x11')](_0x8b07('0xda'));db[_0x8b07('0xdb')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/squareOdbc/squareOdbc.model');db[_0x8b07('0xdc')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xdd'));db['SquareRecording']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/squareRecording/squareRecording.model');db[_0x8b07('0xde')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xdf'));db[_0x8b07('0xe0')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe1'));db[_0x8b07('0xe2')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xe3'));db[_0x8b07('0xe4')]=db[_0x8b07('0x2')]['import']('../api/campaign/campaign.model');db['Migration']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/migration/migration.model');db['Attachment']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe5'));db[_0x8b07('0xe6')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe7'));db[_0x8b07('0xe8')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xe9'));db[_0x8b07('0xea')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xeb'));db['FaxTransferReport']=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xec'));db[_0x8b07('0xed')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x8b07('0xee')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/cmList/cmList.model');db[_0x8b07('0xef')]=db[_0x8b07('0x2')]['import'](_0x8b07('0xf0'));db[_0x8b07('0xf1')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf2'));db[_0x8b07('0xf3')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0x8b07('0xf4')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf5'));db[_0x8b07('0xf6')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf7'));db[_0x8b07('0xf8')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xf9'));db[_0x8b07('0xfa')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0xfb'));db['WhatsappInteraction']=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x8b07('0xfc')]=db['sequelize']['import'](_0x8b07('0xfd'));db[_0x8b07('0xfe')]=db[_0x8b07('0x2')][_0x8b07('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x8b07('0xff')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x100'));db[_0x8b07('0x101')]=db[_0x8b07('0x2')]['import'](_0x8b07('0x102'));db[_0x8b07('0x103')]=db[_0x8b07('0x2')][_0x8b07('0x11')](_0x8b07('0x104'));db[_0x8b07('0x105')][_0x8b07('0x106')](db[_0x8b07('0x1e')],{'as':_0x8b07('0x1e'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x1b')],{'as':_0x8b07('0x10a'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x2c')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User'][_0x8b07('0x109')](db['VoiceExtension'],{'as':_0x8b07('0x10b'),'onDelete':_0x8b07('0x107'),'hooks':!![]});db[_0x8b07('0x105')]['hasMany'](db[_0x8b07('0x74')],{'as':'HopperFinals','foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x76')],{'as':_0x8b07('0x10c'),'foreignKey':'UserId'});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x78')],{'as':_0x8b07('0x78'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x5c')],{'as':_0x8b07('0x10d'),'foreignKey':_0x8b07('0x108')});db['User'][_0x8b07('0x109')](db[_0x8b07('0x10e')],{'as':_0x8b07('0x10f'),'foreignKey':'UserId'});db[_0x8b07('0x105')][_0x8b07('0x109')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0x110')],{'as':_0x8b07('0x111'),'foreignKey':'UserId'});db[_0x8b07('0x105')]['hasMany'](db[_0x8b07('0x40')],{'as':'MailInteractions','foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db['WhatsappInteraction'],{'as':_0x8b07('0x112'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x105')][_0x8b07('0x109')](db[_0x8b07('0xf6')],{'as':_0x8b07('0x113'),'foreignKey':_0x8b07('0x114')});db[_0x8b07('0x105')][_0x8b07('0x115')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x8b07('0x116')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x6b')],{'as':'Groups','through':_0x8b07('0x118')});db['User'][_0x8b07('0x117')](db[_0x8b07('0x6f')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x119')],{'as':_0x8b07('0x11a'),'through':_0x8b07('0x11b')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x11c')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x40')],{'as':_0x8b07('0x11d'),'through':_0x8b07('0x11e')});db[_0x8b07('0x105')][_0x8b07('0x117')](db['ChatInteraction'],{'as':_0x8b07('0x10f'),'through':_0x8b07('0x11f')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x110')],{'as':'FaxInteractions','through':_0x8b07('0x120')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x55')],{'as':_0x8b07('0x121'),'through':_0x8b07('0x122')});db['User'][_0x8b07('0x117')](db[_0x8b07('0x5c')],{'as':_0x8b07('0x10d'),'through':_0x8b07('0x123')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x124')],{'as':_0x8b07('0x112'),'through':_0x8b07('0x125')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x19')],{'as':'VoiceQueues','through':_0x8b07('0x2d'),'required':![]});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x3c')],{'as':_0x8b07('0x126'),'through':'UserMailQueue','required':![]});db['User']['belongsToMany'](db['ChatQueue'],{'as':_0x8b07('0x127'),'through':_0x8b07('0x2f'),'required':![],'hooks':!![]});db[_0x8b07('0x105')]['belongsToMany'](db[_0x8b07('0x4d')],{'as':_0x8b07('0x128'),'through':_0x8b07('0x129'),'required':![]});db[_0x8b07('0x105')]['belongsToMany'](db['SmsQueue'],{'as':_0x8b07('0x12a'),'through':_0x8b07('0x32'),'required':![]});db[_0x8b07('0x105')]['belongsToMany'](db[_0x8b07('0x12b')],{'as':_0x8b07('0x12c'),'through':_0x8b07('0x34'),'required':![]});db['User'][_0x8b07('0x117')](db['WhatsappQueue'],{'as':_0x8b07('0x12d'),'through':_0x8b07('0x12e'),'required':![]});db[_0x8b07('0x105')]['belongsToMany'](db[_0x8b07('0x119')],{'through':_0x8b07('0x11b')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0xef')],{'as':_0x8b07('0x12f'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0x8b07('0x117')](db[_0x8b07('0x130')],{'as':_0x8b07('0x131'),'through':_0x8b07('0x132')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x49')],{'as':_0x8b07('0x133'),'through':_0x8b07('0x134')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0x3a')],{'as':'MailAccounts','through':_0x8b07('0x135')});db['User'][_0x8b07('0x117')](db[_0x8b07('0x58')],{'as':_0x8b07('0x136'),'through':_0x8b07('0x137')});db[_0x8b07('0x105')][_0x8b07('0x117')](db['SmsAccount'],{'as':_0x8b07('0x138'),'through':_0x8b07('0x139')});db[_0x8b07('0x105')][_0x8b07('0x117')](db[_0x8b07('0xf8')],{'as':_0x8b07('0x13a'),'through':_0x8b07('0x13b')});db['User'][_0x8b07('0x117')](db['SquareProject'],{'as':'SquareProjects','through':_0x8b07('0x13c')});db[_0x8b07('0x13')][_0x8b07('0x109')](db['VoiceExtension'],{'as':_0x8b07('0x13d'),'onDelete':_0x8b07('0x107'),'foreignKey':'ChanSpyId'});db[_0x8b07('0x15')][_0x8b07('0x109')](db['VoiceExtension'],{'onDelete':_0x8b07('0x107')});db[_0x8b07('0x16')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':_0x8b07('0x13e'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x13f')][_0x8b07('0x117')](db[_0x8b07('0x8e')],{'as':_0x8b07('0x140'),'through':_0x8b07('0x141')});db[_0x8b07('0x19')][_0x8b07('0x109')](db[_0x8b07('0x2c')],{'as':_0x8b07('0x142'),'foreignKey':_0x8b07('0x143')});db[_0x8b07('0x19')][_0x8b07('0x109')](db[_0x8b07('0x71')],{'as':'Hoppers','foreignKey':_0x8b07('0x143')});db['VoiceQueue']['hasMany'](db[_0x8b07('0x74')],{'as':_0x8b07('0x144'),'foreignKey':_0x8b07('0x143')});db['VoiceQueue'][_0x8b07('0x109')](db[_0x8b07('0x76')],{'as':_0x8b07('0x145'),'foreignKey':_0x8b07('0x143')});db['VoiceQueue'][_0x8b07('0x109')](db['ReportAgentPreview'],{'as':_0x8b07('0x78'),'foreignKey':'VoiceQueueId'});db[_0x8b07('0x19')]['hasMany'](db['CmHopperBlack'],{'as':_0x8b07('0x146'),'foreignKey':_0x8b07('0x143')});db['VoiceQueue'][_0x8b07('0x109')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x8b07('0x143')});db[_0x8b07('0x19')][_0x8b07('0x115')](db[_0x8b07('0x28')],{'as':_0x8b07('0x28'),'foreignKey':_0x8b07('0x147')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x8b07('0x148'),'foreignKey':_0x8b07('0x149')});db[_0x8b07('0x19')][_0x8b07('0x115')](db['Interval'],{'as':'Interval','foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x19')]['belongsTo'](db[_0x8b07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b07('0x14b')});db['VoiceQueue'][_0x8b07('0x117')](db['CmList'],{'as':_0x8b07('0x11a'),'through':'voice_queues_has_cm_lists'});db[_0x8b07('0x19')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x8b07('0x19')]['belongsToMany'](db[_0x8b07('0xe0')],{'as':_0x8b07('0x14c'),'through':_0x8b07('0x14d')});db[_0x8b07('0x19')][_0x8b07('0x117')](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x8b07('0x1b')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105'),'foreignKey':'UserId'});db[_0x8b07('0x1d')]['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x105'),'foreignKey':_0x8b07('0x108')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x14e'),'sourceKey':_0x8b07('0x14f')});db[_0x8b07('0x20')]['belongsTo'](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x8b07('0x14f')});db['VoiceCallReport'][_0x8b07('0x109')](db[_0x8b07('0x24')],{'as':_0x8b07('0x150'),'foreignKey':_0x8b07('0x151'),'constraints':![]});db[_0x8b07('0x152')][_0x8b07('0x109')](db[_0x8b07('0x153')],{'as':_0x8b07('0x154'),'foreignKey':_0x8b07('0x151'),'constraints':![]});db[_0x8b07('0x152')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':'User','foreignKey':'UserId'});db[_0x8b07('0x152')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x37')][_0x8b07('0x115')](db[_0x8b07('0x3a')],{'as':_0x8b07('0x3a'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x38')][_0x8b07('0x115')](db[_0x8b07('0x3a')],{'as':_0x8b07('0x3a'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x3a')][_0x8b07('0x106')](db[_0x8b07('0x37')],{'as':'Imap','onDelete':_0x8b07('0x107')});db[_0x8b07('0x3a')][_0x8b07('0x106')](db[_0x8b07('0x38')],{'as':'Smtp','onDelete':_0x8b07('0x107')});db['MailAccount']['hasMany'](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x3a')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x8b07('0x3a')]['hasMany'](db[_0x8b07('0x159')],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x157')});db['MailAccount']['hasMany'](db[_0x8b07('0x40')],{'as':_0x8b07('0x15b')});db[_0x8b07('0x3a')][_0x8b07('0x109')](db[_0x8b07('0x43')],{'as':_0x8b07('0x13e')});db[_0x8b07('0x3a')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db[_0x8b07('0x3a')]['belongsTo'](db[_0x8b07('0x92')],{'as':_0x8b07('0x92'),'foreignKey':'TemplateId'});db[_0x8b07('0x3a')][_0x8b07('0x115')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x8b07('0x105')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x15e'),'as':_0x8b07('0x14c')});db[_0x8b07('0x40')][_0x8b07('0x109')](db['MailMessage'],{'as':_0x8b07('0x15a'),'onDelete':'cascade','foreignKey':_0x8b07('0x15f')});db[_0x8b07('0x40')]['belongsTo'](db[_0x8b07('0x3a')],{'as':_0x8b07('0x160'),'foreignKey':'MailAccountId'});db[_0x8b07('0x40')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x40')]['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x40')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x162'),'as':_0x8b07('0x163')});db[_0x8b07('0x40')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x162'),'as':_0x8b07('0x164')});db['MailInteraction'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':'user_has_mail_interactions','foreignKey':_0x8b07('0x15f')});db[_0x8b07('0x159')][_0x8b07('0x109')](db['Attachment'],{'as':'Attachments','onDelete':_0x8b07('0x107')});db['MailMessage'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105')});db['MailMessage'][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155')});db[_0x8b07('0x159')]['belongsTo'](db[_0x8b07('0x40')],{'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x15f')});db['MailMessage'][_0x8b07('0x115')](db['MailAccount'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x157')});db[_0x8b07('0x43')][_0x8b07('0x115')](db['User'],{'onDelete':'restrict'});db[_0x8b07('0x43')][_0x8b07('0x115')](db[_0x8b07('0x3c')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x43')][_0x8b07('0x115')](db['MailAccount'],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x43')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x14a')});db['MailApplication'][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x168')});db[_0x8b07('0x169')]['belongsTo'](db[_0x8b07('0x3a')],{});db[_0x8b07('0x169')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db['MailQueueReport'][_0x8b07('0x115')](db['CmContact'],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x169')]['belongsTo'](db[_0x8b07('0x40')],{});db[_0x8b07('0x169')][_0x8b07('0x115')](db[_0x8b07('0x159')],{});db[_0x8b07('0x169')][_0x8b07('0x115')](db['User'],{});db['MailQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x3c')],{});db[_0x8b07('0x46')]['hasMany'](db[_0x8b07('0x47')],{'as':_0x8b07('0x16a'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x49')][_0x8b07('0x109')](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x16b')});db[_0x8b07('0x49')][_0x8b07('0x109')](db['CannedAnswer'],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x16b')});db[_0x8b07('0x49')][_0x8b07('0x109')](db[_0x8b07('0x110')],{'as':_0x8b07('0x15b')});db[_0x8b07('0x49')]['hasMany'](db['FaxApplication'],{'as':_0x8b07('0x13e')});db[_0x8b07('0x49')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':_0x8b07('0x16d'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x49')]['hasMany'](db[_0x8b07('0x16e')],{'as':_0x8b07('0x15a')});db[_0x8b07('0x49')][_0x8b07('0x115')](db[_0x8b07('0x28')],{'as':_0x8b07('0x28')});db['FaxAccount']['belongsTo'](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x49')][_0x8b07('0x115')](db[_0x8b07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b07('0x14b')});db[_0x8b07('0x49')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':'user_has_fax_accounts'});db[_0x8b07('0x4b')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x167')});db['FaxApplication'][_0x8b07('0x115')](db[_0x8b07('0x4d')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x4b')][_0x8b07('0x115')](db[_0x8b07('0x49')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x4b')][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':'restrict','foreignKey':_0x8b07('0x168')});db[_0x8b07('0x110')]['hasMany'](db['FaxMessage'],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':'FaxInteractionId'});db[_0x8b07('0x110')][_0x8b07('0x115')](db[_0x8b07('0x49')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x16b')});db[_0x8b07('0x110')]['belongsTo'](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x110')][_0x8b07('0x115')](db['User'],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db['FaxInteraction'][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'fax_interaction_has_tags','as':_0x8b07('0x163')});db[_0x8b07('0x110')][_0x8b07('0x117')](db['Tag'],{'through':_0x8b07('0x170'),'as':_0x8b07('0x164')});db[_0x8b07('0x110')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x120'),'foreignKey':_0x8b07('0x171')});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':_0x8b07('0x107'),'as':'User'});db[_0x8b07('0x16e')][_0x8b07('0x115')](db[_0x8b07('0x110')],{'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x171')});db[_0x8b07('0x16e')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155')});db[_0x8b07('0x16e')][_0x8b07('0x115')](db[_0x8b07('0x172')],{'as':_0x8b07('0x172'),'foreignKey':_0x8b07('0x173')});db[_0x8b07('0x16e')]['belongsTo'](db[_0x8b07('0x49')],{'as':_0x8b07('0x160'),'foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x129')});db[_0x8b07('0x4d')]['belongsToMany'](db[_0x8b07('0xe0')],{'through':_0x8b07('0x174'),'as':'Teams'});db[_0x8b07('0x4f')][_0x8b07('0x115')](db['FaxAccount'],{});db['FaxQueueReport'][_0x8b07('0x115')](db['CmList'],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x4f')]['belongsTo'](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x4f')][_0x8b07('0x115')](db[_0x8b07('0x110')],{});db[_0x8b07('0x4f')]['belongsTo'](db['FaxMessage'],{});db[_0x8b07('0x4f')][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0x4f')][_0x8b07('0x115')](db[_0x8b07('0x4d')],{});db['SmsAccount'][_0x8b07('0x109')](db[_0x8b07('0x82')],{'as':'Dispositions','foreignKey':_0x8b07('0x175')});db[_0x8b07('0x51')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x175')});db[_0x8b07('0x51')][_0x8b07('0x109')](db[_0x8b07('0x176')],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x175')});db['SmsAccount'][_0x8b07('0x109')](db['SmsInteraction'],{'as':'Interactions'});db[_0x8b07('0x51')]['hasMany'](db['SmsApplication'],{'as':'Applications'});db['SmsAccount'][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0x8b07('0x177'),'foreignKey':_0x8b07('0x14b')});db[_0x8b07('0x51')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x139')});db['SmsApplication'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x53')][_0x8b07('0x115')](db[_0x8b07('0x178')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x53')][_0x8b07('0x115')](db['SmsAccount'],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0x53')]['belongsTo'](db[_0x8b07('0x86')],{'onDelete':'restrict','foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x53')][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x168')});db['SmsInteraction']['hasMany'](db['SmsMessage'],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x179')});db[_0x8b07('0x55')]['belongsTo'](db['SmsAccount'],{'as':_0x8b07('0x160'),'foreignKey':'SmsAccountId'});db[_0x8b07('0x55')]['belongsTo'](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b07('0x55')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x55')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction'][_0x8b07('0x117')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8b07('0x164')});db['SmsInteraction'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x122'),'foreignKey':_0x8b07('0x179')});db[_0x8b07('0x176')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105')});db[_0x8b07('0x176')]['belongsTo'](db[_0x8b07('0x6f')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x155')});db['SmsMessage'][_0x8b07('0x115')](db[_0x8b07('0x55')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x179')});db[_0x8b07('0x176')]['belongsTo'](db[_0x8b07('0x51')],{'as':'Account','foreignKey':_0x8b07('0x175')});db['SmsQueue'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x32'),'foreignKey':_0x8b07('0x17a')});db['SmsQueue'][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x17b'),'as':_0x8b07('0x14c')});db[_0x8b07('0x58')]['hasMany'](db[_0x8b07('0x82')],{'as':'Dispositions','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x58')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x8b07('0x58')]['hasMany'](db[_0x8b07('0x5c')],{'as':_0x8b07('0x15b'),'foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x58')][_0x8b07('0x109')](db[_0x8b07('0x5e')],{'as':_0x8b07('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0x8b07('0x58')][_0x8b07('0x109')](db[_0x8b07('0x5a')],{'as':'Applications','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x58')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x58')][_0x8b07('0x115')](db[_0x8b07('0x87')],{'as':_0x8b07('0x177'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x137')});db[_0x8b07('0x5a')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':'restrict'});db[_0x8b07('0x5a')]['belongsTo'](db[_0x8b07('0x12b')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x17d')});db[_0x8b07('0x5a')][_0x8b07('0x115')](db[_0x8b07('0x58')],{'onDelete':'restrict','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x5a')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x14a')});db['OpenchannelApplication'][_0x8b07('0x115')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x8b07('0x168')});db[_0x8b07('0x5c')]['hasMany'](db[_0x8b07('0x5e')],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':'OpenchannelInteractionId'});db[_0x8b07('0x5c')][_0x8b07('0x115')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x8b07('0x17c')});db[_0x8b07('0x5c')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x5c')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x5c')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x17e'),'as':_0x8b07('0x163')});db[_0x8b07('0x5c')][_0x8b07('0x117')](db['Tag'],{'through':_0x8b07('0x17e'),'as':_0x8b07('0x164')});db[_0x8b07('0x5c')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Users','through':_0x8b07('0x123'),'foreignKey':_0x8b07('0x17f')});db[_0x8b07('0x5e')][_0x8b07('0x115')](db['User'],{'onDelete':'cascade','as':_0x8b07('0x105')});db[_0x8b07('0x5e')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x8b07('0x17f')});db[_0x8b07('0x5e')][_0x8b07('0x115')](db[_0x8b07('0x172')],{'as':'Attachment','foreignKey':_0x8b07('0x173')});db[_0x8b07('0x5e')]['belongsTo'](db[_0x8b07('0x58')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x8b07('0x12b')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x8b07('0x12b')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':'team_has_openchannel_queues','as':_0x8b07('0x14c')});db['ChatWebsite'][_0x8b07('0x109')](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':'ChatWebsiteId'});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x180')});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x6d')],{'as':_0x8b07('0x181')});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x10e')],{'as':_0x8b07('0x15b')});db['ChatWebsite'][_0x8b07('0x109')](db[_0x8b07('0x63')],{'as':_0x8b07('0x13e')});db[_0x8b07('0x130')][_0x8b07('0x109')](db[_0x8b07('0x182')],{'as':'Messages'});db[_0x8b07('0x130')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x130')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'as':_0x8b07('0x86'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x130')][_0x8b07('0x115')](db[_0x8b07('0x87')],{'as':_0x8b07('0x177'),'foreignKey':_0x8b07('0x14b')});db[_0x8b07('0x130')]['belongsToMany'](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x132')});db[_0x8b07('0x183')][_0x8b07('0x115')](db['OpenchannelAccount'],{});db[_0x8b07('0x183')]['belongsTo'](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db['OpenchannelQueueReport']['belongsTo'](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8b07('0x183')]['belongsTo'](db[_0x8b07('0x5c')],{});db[_0x8b07('0x183')][_0x8b07('0x115')](db[_0x8b07('0x5e')],{});db[_0x8b07('0x183')][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0x183')][_0x8b07('0x115')](db[_0x8b07('0x12b')],{});db[_0x8b07('0x63')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':'Agent','foreignKey':_0x8b07('0x108'),'onDelete':_0x8b07('0x167')});db[_0x8b07('0x63')]['belongsTo'](db[_0x8b07('0x69')],{'as':_0x8b07('0x184'),'foreignKey':'ChatQueueId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x63')]['belongsTo'](db[_0x8b07('0x130')],{'as':_0x8b07('0x185'),'foreignKey':'ChatWebsiteId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x63')][_0x8b07('0x115')](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':'TagId'});db[_0x8b07('0x10e')]['hasMany'](db['ChatMessage'],{'as':_0x8b07('0x15a'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x186')});db['ChatInteraction'][_0x8b07('0x115')](db[_0x8b07('0x130')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x180')});db['ChatInteraction'][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db['ChatInteraction']['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x10e')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x187'),'as':_0x8b07('0x163')});db[_0x8b07('0x10e')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x187'),'as':_0x8b07('0x164')});db[_0x8b07('0x10e')]['belongsToMany'](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x11f'),'foreignKey':_0x8b07('0x186')});db[_0x8b07('0x182')][_0x8b07('0x115')](db['User'],{'onDelete':'cascade','as':_0x8b07('0x105')});db[_0x8b07('0x182')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':'cascade','as':_0x8b07('0x155'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x8b07('0x10e')],{'onDelete':'cascade','as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x186')});db['ChatMessage'][_0x8b07('0x115')](db[_0x8b07('0x172')],{'as':_0x8b07('0x172'),'foreignKey':_0x8b07('0x173')});db['ChatMessage'][_0x8b07('0x115')](db['ChatWebsite'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x180')});db[_0x8b07('0x67')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db['ChatOfflineMessage'][_0x8b07('0x115')](db[_0x8b07('0x130')],{'as':_0x8b07('0x160'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x8b07('0x117')](db['User'],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x2f'),'hooks':!![]});db[_0x8b07('0x69')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x188'),'as':_0x8b07('0x14c')});db[_0x8b07('0x6b')][_0x8b07('0x109')](db['ChatInternalMessage'],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x189'),'onDelete':'cascade'});db[_0x8b07('0x6b')][_0x8b07('0x117')](db['User'],{'as':'Members','through':'chat_group_has_users'});db[_0x8b07('0x6d')][_0x8b07('0x115')](db['ChatWebsite'],{'as':_0x8b07('0x185'),'foreignKey':'ChatWebsiteId'});db[_0x8b07('0x18a')][_0x8b07('0x109')](db['CmContact'],{'as':_0x8b07('0x18b'),'foreignKey':_0x8b07('0x18c')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x71')],{'as':_0x8b07('0x18d'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x76')],{'as':_0x8b07('0x145'),'foreignKey':_0x8b07('0x156')});db['CmContact'][_0x8b07('0x109')](db[_0x8b07('0x78')],{'as':_0x8b07('0x78'),'foreignKey':_0x8b07('0x156')});db['CmContact'][_0x8b07('0x109')](db[_0x8b07('0xd3')],{'as':'JscriptySessions','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x5c')],{'as':_0x8b07('0x10d'),'foreignKey':_0x8b07('0x156'),'onDelete':'restrict'});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x10e')],{'as':'ChatInteractions','foreignKey':_0x8b07('0x156'),'onDelete':_0x8b07('0x167')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x55')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x110')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x8b07('0x167')});db[_0x8b07('0x6f')][_0x8b07('0x109')](db[_0x8b07('0x40')],{'as':_0x8b07('0x11d'),'foreignKey':'ContactId','onDelete':_0x8b07('0x167')});db['CmContact'][_0x8b07('0x115')](db[_0x8b07('0x18a')],{'as':_0x8b07('0x18e'),'foreignKey':_0x8b07('0x18c')});db['CmContact'][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f'),'onDelete':'cascade'});db[_0x8b07('0x6f')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x18f')});db['CmContact'][_0x8b07('0x117')](db[_0x8b07('0x90')],{'as':'Tags','through':_0x8b07('0x190')});db[_0x8b07('0x6f')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x190'),'as':_0x8b07('0x164')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':'ContactId','onDelete':_0x8b07('0x107')});db[_0x8b07('0x71')][_0x8b07('0x115')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x8b07('0x107')});db['CmHopper'][_0x8b07('0x115')](db['User'],{'as':_0x8b07('0x191'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0x19')],{'as':_0x8b07('0x184'),'foreignKey':_0x8b07('0x143'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0xe4')],{'as':_0x8b07('0xe4'),'foreignKey':_0x8b07('0x192'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x71')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x193')});db[_0x8b07('0x72')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0x72')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':'List','foreignKey':_0x8b07('0x16f'),'onDelete':'cascade'});db[_0x8b07('0x72')][_0x8b07('0x115')](db['VoiceQueue'],{'as':_0x8b07('0x184'),'foreignKey':_0x8b07('0x143'),'onDelete':'cascade'});db[_0x8b07('0x72')][_0x8b07('0x115')](db[_0x8b07('0xe4')],{'as':_0x8b07('0xe4'),'foreignKey':_0x8b07('0x192'),'onDelete':'cascade'});db[_0x8b07('0x7e')][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x194'),'singular':_0x8b07('0x195')},'foreignKey':_0x8b07('0x196'),'onDelete':_0x8b07('0x107'),'hooks':!![]});db['Automation'][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x197'),'singular':_0x8b07('0x198')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x8b07('0x7e')][_0x8b07('0x109')](db[_0x8b07('0x7c')],{'as':'Actions','foreignKey':_0x8b07('0x199'),'onDelete':'cascade','hooks':!![]});db[_0x8b07('0x82')]['hasMany'](db[_0x8b07('0x82')],{'as':_0x8b07('0x158'),'foreignKey':'ParentId','onDelete':_0x8b07('0x107')});db['Interval'][_0x8b07('0x109')](db[_0x8b07('0x86')],{'as':_0x8b07('0x19a'),'foreignKey':'IntervalId','onDelete':_0x8b07('0x107'),'hooks':!![],'required':![]});db[_0x8b07('0x86')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':'Extensions','foreignKey':_0x8b07('0x14a'),'onDelete':_0x8b07('0x167')});db['Interval'][_0x8b07('0x109')](db[_0x8b07('0x43')],{'as':_0x8b07('0x19b'),'foreignKey':'IntervalId'});db[_0x8b07('0x86')][_0x8b07('0x109')](db[_0x8b07('0x63')],{'as':_0x8b07('0x19c'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x86')][_0x8b07('0x109')](db[_0x8b07('0x4b')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0x8b07('0x109')](db['SmsApplication'],{'as':_0x8b07('0x19d'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0x8c')][_0x8b07('0x115')](db['MailAccount'],{});db[_0x8b07('0x8c')]['belongsTo'](db[_0x8b07('0x98')],{'foreignKey':_0x8b07('0x19e')});db[_0x8b07('0x8c')]['belongsTo'](db[_0x8b07('0x19f')],{'foreignKey':_0x8b07('0x1a0')});db[_0x8b07('0x8e')]['belongsToMany'](db[_0x8b07('0x13f')],{'as':_0x8b07('0x1a1'),'through':_0x8b07('0x141'),'onDelete':_0x8b07('0x167')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x6f')],{'through':'cm_contact_has_tags'});db[_0x8b07('0x90')][_0x8b07('0x117')](db['ChatInteraction'],{'through':_0x8b07('0x187')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x8b07('0x117')](db[_0x8b07('0x55')],{'through':_0x8b07('0x1a2')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x110')],{'through':_0x8b07('0x170')});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x8b07('0x90')][_0x8b07('0x117')](db[_0x8b07('0x124')],{'through':_0x8b07('0x1a3')});db[_0x8b07('0x93')][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x1a4'),'singular':_0x8b07('0x1a5')},'foreignKey':'TriggerAllId','onDelete':_0x8b07('0x107'),'hooks':!![]});db['Trigger'][_0x8b07('0x109')](db[_0x8b07('0x84')],{'as':{'plural':_0x8b07('0x1a6'),'singular':_0x8b07('0x1a7')},'foreignKey':'TriggerAnyId','onDelete':_0x8b07('0x107'),'hooks':!![]});db[_0x8b07('0x93')]['hasMany'](db[_0x8b07('0x7c')],{'as':_0x8b07('0x1a8'),'foreignKey':_0x8b07('0x1a9'),'onDelete':_0x8b07('0x107'),'hooks':!![]});db[_0x8b07('0x19f')][_0x8b07('0x109')](db[_0x8b07('0x9d')],{'as':_0x8b07('0x1aa'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1a0'),'hooks':!![]});db[_0x8b07('0x98')][_0x8b07('0x109')](db[_0x8b07('0x9d')],{'as':_0x8b07('0x1aa'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x19e')});db[_0x8b07('0x9b')][_0x8b07('0x109')](db[_0x8b07('0x9d')],{'as':_0x8b07('0x1aa'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ab')});db['AnalyticFieldReport'][_0x8b07('0x115')](db[_0x8b07('0x9b')],{'foreignKey':'MetricId'});db[_0x8b07('0xa0')][_0x8b07('0x109')](db[_0x8b07('0xa2')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa2')][_0x8b07('0x109')](db[_0x8b07('0xa3')],{'as':'Subjects','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xa2')]['hasMany'](db[_0x8b07('0xa3')],{'as':'Descriptions','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db['SalesforceConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xa3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8b07('0x1b0')});db['SalesforceConfiguration'][_0x8b07('0x115')](db[_0x8b07('0xa0')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa3')]['hasMany'](db[_0x8b07('0xa3')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xa3')][_0x8b07('0x109')](db[_0x8b07('0xa3')],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xa3')]['hasMany'](db[_0x8b07('0xa3')],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db['SalesforceField']['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xa5')][_0x8b07('0x109')](db[_0x8b07('0xa7')],{'as':'Configurations','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa7')]['hasMany'](db[_0x8b07('0xa8')],{'as':_0x8b07('0x1b6'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xa7')][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db['SugarcrmConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':'Fields','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xa7')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xa8')][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8b07('0xa8')][_0x8b07('0x109')](db[_0x8b07('0xa8')],{'as':'Description','foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xa8')]['hasMany'](db[_0x8b07('0xa8')],{'as':'Field','foreignKey':'FieldId'});db[_0x8b07('0xa8')][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xaa')]['hasMany'](db[_0x8b07('0xac')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':'AccountId'});db['DeskConfiguration']['hasMany'](db[_0x8b07('0xae')],{'as':_0x8b07('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b07('0x1ae')});db['DeskConfiguration']['hasMany'](db[_0x8b07('0xae')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xac')][_0x8b07('0x109')](db[_0x8b07('0xae')],{'as':'Fields','onDelete':_0x8b07('0x107'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x8b07('0x115')](db[_0x8b07('0xaa')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xac')][_0x8b07('0x117')](db['Tag'],{'through':_0x8b07('0x1b8')});db['DeskField'][_0x8b07('0x109')](db['DeskField'],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xae')]['hasMany'](db[_0x8b07('0xae')],{'as':_0x8b07('0x1b2'),'foreignKey':'DescriptionId'});db[_0x8b07('0xae')]['hasMany'](db['DeskField'],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xae')]['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':'VariableId'});db[_0x8b07('0x1b9')][_0x8b07('0x109')](db[_0x8b07('0x1ba')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1ba')]['hasMany'](db[_0x8b07('0xb2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8b07('0x1ae')});db['ZohoConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1aa'),'onDelete':'cascade','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0x1ba')][_0x8b07('0x115')](db[_0x8b07('0x1b9')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xb2')][_0x8b07('0x109')](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1b1'),'foreignKey':'SubjectId'});db[_0x8b07('0xb2')]['hasMany'](db[_0x8b07('0xb2')],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xb2')][_0x8b07('0x109')](db['ZohoField'],{'as':'Field','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb2')][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db['ZendeskAccount'][_0x8b07('0x109')](db[_0x8b07('0xb4')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xb4')][_0x8b07('0x109')](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xb4')]['hasMany'](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b7'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xb4')][_0x8b07('0x109')](db['ZendeskField'],{'as':_0x8b07('0x1aa'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb4')][_0x8b07('0x115')](db[_0x8b07('0x1bb')],{'as':'Account','foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xb4')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x8b07('0x109')](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b1'),'foreignKey':'SubjectId'});db[_0x8b07('0xb6')][_0x8b07('0x109')](db['ZendeskField'],{'as':_0x8b07('0x1b2'),'foreignKey':'DescriptionId'});db[_0x8b07('0xb6')][_0x8b07('0x109')](db[_0x8b07('0xb6')],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb6')]['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':'VariableId'});db[_0x8b07('0x1bc')][_0x8b07('0x109')](db[_0x8b07('0x1bd')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1bd')][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':_0x8b07('0x1b6'),'onDelete':'cascade','foreignKey':_0x8b07('0x1ae')});db['FreshdeskConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':'Descriptions','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db['FreshdeskConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':'Fields','onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0x1bd')][_0x8b07('0x115')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1bd')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':_0x8b07('0x1be')});db[_0x8b07('0xb9')][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xb9')]['hasMany'](db['FreshdeskField'],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xb9')][_0x8b07('0x109')](db[_0x8b07('0xb9')],{'as':'Field','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xb9')]['belongsTo'](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xba')][_0x8b07('0x109')](db[_0x8b07('0x1bf')],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1bf')][_0x8b07('0x109')](db['VtigerField'],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db['VtigerConfiguration']['hasMany'](db[_0x8b07('0xbd')],{'as':_0x8b07('0x1b7'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x8b07('0x109')](db['VtigerField'],{'as':'Fields','foreignKey':_0x8b07('0x1b0')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db['VtigerField'][_0x8b07('0x109')](db[_0x8b07('0xbd')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xbd')][_0x8b07('0x109')](db['VtigerField'],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xbd')][_0x8b07('0x109')](db[_0x8b07('0xbd')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField'][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8b07('0x1c0')][_0x8b07('0x109')](db[_0x8b07('0xbf')],{'as':_0x8b07('0x1ac'),'onDelete':'cascade','foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xbf')][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db['ServicenowConfiguration'][_0x8b07('0x109')](db['ServicenowField'],{'as':_0x8b07('0x1b7'),'foreignKey':_0x8b07('0x1af')});db['ServicenowConfiguration'][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1aa'),'foreignKey':_0x8b07('0x1b0')});db['ServicenowConfiguration'][_0x8b07('0x115')](db[_0x8b07('0x1c0')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0xc1')][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':'Description','foreignKey':_0x8b07('0x1af')});db['ServicenowField'][_0x8b07('0x109')](db[_0x8b07('0xc1')],{'as':_0x8b07('0x1b3'),'foreignKey':'FieldId'});db[_0x8b07('0xc1')][_0x8b07('0x115')](db['Variable'],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0x1c1')][_0x8b07('0x109')](db['Dynamics365Configuration'],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0x1c2')]['hasMany'](db[_0x8b07('0xc5')],{'as':_0x8b07('0x1b6'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0x1c2')]['hasMany'](db[_0x8b07('0xc5')],{'as':_0x8b07('0x1b7'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1af')});db[_0x8b07('0x1c2')][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x8b07('0x1c2')][_0x8b07('0x115')](db[_0x8b07('0x1c1')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db[_0x8b07('0xc5')][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Subject','foreignKey':_0x8b07('0x1ae')});db['Dynamics365Field'][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Description','foreignKey':_0x8b07('0x1af')});db[_0x8b07('0xc5')][_0x8b07('0x109')](db[_0x8b07('0xc5')],{'as':'Field','foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xc5')][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':'Variable','foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xc7')][_0x8b07('0x109')](db['FreshsalesConfiguration'],{'as':_0x8b07('0x1ac'),'onDelete':_0x8b07('0x107'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x8b07('0x109')](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b6'),'foreignKey':_0x8b07('0x1ae')});db['FreshsalesConfiguration'][_0x8b07('0x109')](db[_0x8b07('0x1c3')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1aa'),'foreignKey':_0x8b07('0x1b0')});db[_0x8b07('0xc8')][_0x8b07('0x115')](db[_0x8b07('0xc7')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1ad')});db['FreshsalesField'][_0x8b07('0x109')](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b1'),'foreignKey':_0x8b07('0x1ae')});db[_0x8b07('0x1c3')]['hasMany'](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b2'),'foreignKey':_0x8b07('0x1af')});db['FreshsalesField']['hasMany'](db[_0x8b07('0x1c3')],{'as':_0x8b07('0x1b3'),'foreignKey':_0x8b07('0x1b0')});db['FreshsalesField'][_0x8b07('0x115')](db[_0x8b07('0x1b4')],{'as':_0x8b07('0x1b4'),'foreignKey':_0x8b07('0x1b5')});db[_0x8b07('0xcb')][_0x8b07('0x115')](db[_0x8b07('0x130')],{});db[_0x8b07('0xcb')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':_0x8b07('0x16f')});db['ChatQueueReport']['belongsTo'](db[_0x8b07('0x6f')],{'as':_0x8b07('0x155'),'foreignKey':_0x8b07('0x156')});db[_0x8b07('0xcb')][_0x8b07('0x115')](db['ChatInteraction'],{});db[_0x8b07('0xcb')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0xcb')][_0x8b07('0x115')](db['ChatQueue'],{});db[_0x8b07('0xcd')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x1c4')});db[_0x8b07('0xcd')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':'cascade','foreignKey':_0x8b07('0x1c5')});db[_0x8b07('0xd3')]['hasMany'](db[_0x8b07('0xd1')],{'foreignKey':'SessionId','onDelete':_0x8b07('0x107')});db[_0x8b07('0xd3')][_0x8b07('0x109')](db[_0x8b07('0xcf')],{'foreignKey':_0x8b07('0x1c6'),'onDelete':_0x8b07('0x107')});db['SmsQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x51')],{});db[_0x8b07('0x1c7')]['belongsTo'](db[_0x8b07('0x119')],{'as':_0x8b07('0x15c'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x8b07('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['SmsQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x55')],{});db[_0x8b07('0x1c7')][_0x8b07('0x115')](db[_0x8b07('0x176')],{});db[_0x8b07('0x1c7')][_0x8b07('0x115')](db[_0x8b07('0x105')],{});db[_0x8b07('0x1c7')][_0x8b07('0x115')](db[_0x8b07('0x178')],{});db[_0x8b07('0xd9')][_0x8b07('0x109')](db['JscriptySessionReport'],{'foreignKey':_0x8b07('0x1c8')});db['JscriptyProject'][_0x8b07('0x109')](db[_0x8b07('0xd1')],{'foreignKey':_0x8b07('0x1c8')});db[_0x8b07('0xd9')][_0x8b07('0x109')](db[_0x8b07('0xcf')],{'foreignKey':_0x8b07('0x1c8')});db[_0x8b07('0xdc')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':'Users','through':_0x8b07('0x13c')});db[_0x8b07('0xe0')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x11c')});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x19')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x3c')],{'through':_0x8b07('0x15e'),'as':_0x8b07('0x126')});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x69')],{'through':_0x8b07('0x188'),'as':_0x8b07('0x127')});db[_0x8b07('0xe0')][_0x8b07('0x117')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0x8b07('0x117')](db[_0x8b07('0x178')],{'through':_0x8b07('0x17b'),'as':'SmsQueues'});db[_0x8b07('0xe0')][_0x8b07('0x117')](db[_0x8b07('0x12b')],{'through':_0x8b07('0x1c9'),'as':_0x8b07('0x12c')});db[_0x8b07('0xe0')][_0x8b07('0x117')](db['WhatsappQueue'],{'through':_0x8b07('0x1ca'),'as':'WhatsappQueues'});db[_0x8b07('0xe4')]['hasMany'](db[_0x8b07('0x71')],{'as':_0x8b07('0x18d'),'foreignKey':'CampaignId'});db[_0x8b07('0xe4')][_0x8b07('0x109')](db[_0x8b07('0x74')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x8b07('0xe4')][_0x8b07('0x109')](db['CmHopperHistory'],{'as':_0x8b07('0x145'),'foreignKey':'CampaignId'});db[_0x8b07('0xe4')][_0x8b07('0x109')](db[_0x8b07('0x72')],{'as':_0x8b07('0x146'),'foreignKey':_0x8b07('0x192')});db[_0x8b07('0xe4')][_0x8b07('0x115')](db['Trunk'],{'as':_0x8b07('0x28'),'foreignKey':_0x8b07('0x147')});db['Campaign'][_0x8b07('0x115')](db['Trunk'],{'as':_0x8b07('0x148'),'foreignKey':_0x8b07('0x149')});db[_0x8b07('0xe4')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'as':_0x8b07('0x86'),'foreignKey':'IntervalId'});db['Campaign'][_0x8b07('0x115')](db[_0x8b07('0xdc')],{'as':_0x8b07('0xdc'),'foreignKey':_0x8b07('0x1cb')});db['Campaign'][_0x8b07('0x117')](db[_0x8b07('0x119')],{'as':_0x8b07('0x11a'),'through':_0x8b07('0x1cc')});db[_0x8b07('0xe4')][_0x8b07('0x117')](db['CmList'],{'as':_0x8b07('0x1cd'),'through':'campaigns_has_cm_blacklists'});db[_0x8b07('0xe8')][_0x8b07('0x115')](db[_0x8b07('0x159')],{});db[_0x8b07('0xe8')][_0x8b07('0x115')](db[_0x8b07('0x40')],{});db[_0x8b07('0xe8')][_0x8b07('0x115')](db['MailAccount'],{'foreignKey':_0x8b07('0x1ce'),'as':_0x8b07('0x1cf')});db[_0x8b07('0xe8')][_0x8b07('0x115')](db['User'],{'foreignKey':_0x8b07('0x1d0'),'as':'FromAgent'});db['MailTransferReport']['belongsTo'](db[_0x8b07('0x105')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8b07('0xe8')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x8b07('0x1d1'),'as':_0x8b07('0x1d2')});db[_0x8b07('0xe8')][_0x8b07('0x115')](db[_0x8b07('0x3a')],{'foreignKey':_0x8b07('0x1d3'),'as':_0x8b07('0x1d4')});db[_0x8b07('0xea')][_0x8b07('0x115')](db['ChatMessage'],{});db['ChatTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x10e')],{});db[_0x8b07('0xea')][_0x8b07('0x115')](db[_0x8b07('0x130')],{'foreignKey':'FromChatWebsiteId','as':_0x8b07('0x1cf')});db[_0x8b07('0xea')]['belongsTo'](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d0'),'as':_0x8b07('0x1d5')});db[_0x8b07('0xea')][_0x8b07('0x115')](db['User'],{'foreignKey':_0x8b07('0x1d6'),'as':_0x8b07('0x1d7')});db[_0x8b07('0xea')][_0x8b07('0x115')](db[_0x8b07('0x69')],{'foreignKey':_0x8b07('0x1d8'),'as':'ToQueue'});db[_0x8b07('0xea')][_0x8b07('0x115')](db[_0x8b07('0x130')],{'foreignKey':_0x8b07('0x1d9'),'as':_0x8b07('0x1d4')});db['FaxTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x16e')],{});db['FaxTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x110')],{});db[_0x8b07('0x1da')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x8b07('0x1db'),'as':_0x8b07('0x1cf')});db[_0x8b07('0x1da')]['belongsTo'](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d0'),'as':_0x8b07('0x1d5')});db[_0x8b07('0x1da')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':'ToUserId','as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0x8b07('0x4d')],{'foreignKey':_0x8b07('0x1dc'),'as':_0x8b07('0x1d2')});db[_0x8b07('0x1da')][_0x8b07('0x115')](db[_0x8b07('0x49')],{'foreignKey':_0x8b07('0x1dd'),'as':'ToAccount'});db[_0x8b07('0xed')][_0x8b07('0x115')](db[_0x8b07('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x8b07('0x5c')],{});db[_0x8b07('0xed')][_0x8b07('0x115')](db[_0x8b07('0x58')],{'foreignKey':_0x8b07('0x1de'),'as':_0x8b07('0x1cf')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8b07('0x1d0'),'as':'FromAgent'});db[_0x8b07('0xed')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':'ToUserId','as':_0x8b07('0x1d7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x8b07('0x12b')],{'foreignKey':_0x8b07('0x1df'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x58')],{'foreignKey':'ToOpenchannelAccountId','as':_0x8b07('0x1d4')});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x176')],{});db[_0x8b07('0xee')]['belongsTo'](db[_0x8b07('0x55')],{});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x51')],{'foreignKey':_0x8b07('0x1e0'),'as':_0x8b07('0x1cf')});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':'FromUserId','as':_0x8b07('0x1d5')});db['SmsTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d6'),'as':_0x8b07('0x1d7')});db['SmsTransferReport'][_0x8b07('0x115')](db['SmsQueue'],{'foreignKey':_0x8b07('0x1e1'),'as':_0x8b07('0x1d2')});db[_0x8b07('0xee')][_0x8b07('0x115')](db[_0x8b07('0x51')],{'foreignKey':'ToSmsAccountId','as':_0x8b07('0x1d4')});db['CmList'][_0x8b07('0x109')](db['Disposition'],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db[_0x8b07('0x7a')],{'as':_0x8b07('0x1e2'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')]['hasMany'](db['CmContact'],{'as':_0x8b07('0x18b'),'onDelete':_0x8b07('0x107'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db[_0x8b07('0x74')],{'as':_0x8b07('0x144'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db['CmHopperHistory'],{'as':_0x8b07('0x10c'),'foreignKey':_0x8b07('0x16f')});db[_0x8b07('0x119')][_0x8b07('0x109')](db['ReportAgentPreview'],{'as':_0x8b07('0x78'),'foreignKey':'ListId'});db[_0x8b07('0x119')][_0x8b07('0x117')](db[_0x8b07('0x19')],{'as':_0x8b07('0x1e3'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x11b')});db[_0x8b07('0xef')][_0x8b07('0x109')](db[_0x8b07('0x16')],{'as':_0x8b07('0x10b'),'onDelete':'cascade'});db['VoicePrefix'][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x1e4')});db[_0x8b07('0xf1')][_0x8b07('0x109')](db[_0x8b07('0x105')],{'as':'Users','foreignKey':_0x8b07('0x116')});db[_0x8b07('0xf1')]['hasMany'](db[_0x8b07('0xf3')],{'as':'UserProfileSections','foreignKey':_0x8b07('0x116'),'onDelete':_0x8b07('0x107')});db['UserProfileSection'][_0x8b07('0x109')](db[_0x8b07('0xf4')],{'as':'Resources','foreignKey':_0x8b07('0x1e5'),'onDelete':_0x8b07('0x107')});db[_0x8b07('0xf8')]['hasMany'](db['Disposition'],{'as':_0x8b07('0x158'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0xf8')][_0x8b07('0x109')](db[_0x8b07('0x80')],{'as':_0x8b07('0x16c'),'foreignKey':_0x8b07('0x1e6')});db['WhatsappAccount']['hasMany'](db[_0x8b07('0xfc')],{'as':_0x8b07('0x15a'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0xf8')][_0x8b07('0x109')](db[_0x8b07('0x124')],{'as':_0x8b07('0x15b')});db[_0x8b07('0xf8')][_0x8b07('0x109')](db[_0x8b07('0xfa')],{'as':'Applications'});db[_0x8b07('0xf8')][_0x8b07('0x115')](db[_0x8b07('0x119')],{'as':'List','foreignKey':_0x8b07('0x16f')});db['WhatsappAccount']['belongsTo'](db[_0x8b07('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x8b07('0x14b')});db[_0x8b07('0xf8')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x15d'),'through':_0x8b07('0x13b')});db['WhatsappApplication'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0xfa')][_0x8b07('0x115')](db['WhatsappQueue'],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0xfa')]['belongsTo'](db[_0x8b07('0xf8')],{'onDelete':_0x8b07('0x167')});db[_0x8b07('0xfa')][_0x8b07('0x115')](db[_0x8b07('0x86')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x14a')});db[_0x8b07('0xfa')]['belongsTo'](db[_0x8b07('0x90')],{'onDelete':_0x8b07('0x167'),'foreignKey':_0x8b07('0x168')});db[_0x8b07('0x124')]['hasMany'](db['WhatsappMessage'],{'as':_0x8b07('0x15a'),'onDelete':'cascade','foreignKey':_0x8b07('0x1e7')});db[_0x8b07('0x124')]['belongsTo'](db[_0x8b07('0xf8')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0x124')][_0x8b07('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0x8b07('0x156')});db[_0x8b07('0x124')]['belongsTo'](db[_0x8b07('0x105')],{'as':_0x8b07('0x161'),'foreignKey':_0x8b07('0x108')});db[_0x8b07('0x124')]['belongsToMany'](db[_0x8b07('0x90')],{'through':_0x8b07('0x1a3'),'as':_0x8b07('0x163')});db[_0x8b07('0x124')][_0x8b07('0x117')](db[_0x8b07('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0x8b07('0x164')});db[_0x8b07('0x124')][_0x8b07('0x117')](db[_0x8b07('0x105')],{'as':_0x8b07('0x165'),'through':_0x8b07('0x125'),'foreignKey':_0x8b07('0x1e7')});db[_0x8b07('0xfc')][_0x8b07('0x115')](db[_0x8b07('0x105')],{'as':_0x8b07('0x105')});db[_0x8b07('0xfc')][_0x8b07('0x115')](db[_0x8b07('0x6f')],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x155')});db['WhatsappMessage'][_0x8b07('0x115')](db['WhatsappInteraction'],{'onDelete':_0x8b07('0x107'),'as':_0x8b07('0x166'),'foreignKey':_0x8b07('0x1e7')});db['WhatsappMessage']['belongsTo'](db[_0x8b07('0xf8')],{'as':_0x8b07('0x160'),'foreignKey':_0x8b07('0x1e6')});db[_0x8b07('0xfe')][_0x8b07('0x115')](db[_0x8b07('0xf8')],{});db[_0x8b07('0xfe')]['belongsTo'](db[_0x8b07('0x119')],{'as':'List','foreignKey':'ListId'});db[_0x8b07('0xfe')][_0x8b07('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0x8b07('0x156')});db[_0x8b07('0xfe')]['belongsTo'](db[_0x8b07('0x124')],{});db['WhatsappQueueReport'][_0x8b07('0x115')](db[_0x8b07('0x101')],{});db[_0x8b07('0xfe')][_0x8b07('0x115')](db[_0x8b07('0xfc')],{});db[_0x8b07('0xfe')]['belongsTo'](db[_0x8b07('0x105')],{});db[_0x8b07('0xff')][_0x8b07('0x115')](db['WhatsappMessage'],{});db[_0x8b07('0xff')][_0x8b07('0x115')](db[_0x8b07('0x124')],{});db[_0x8b07('0xff')][_0x8b07('0x115')](db['WhatsappAccount'],{'foreignKey':_0x8b07('0x1e8'),'as':'FromAccount'});db[_0x8b07('0xff')][_0x8b07('0x115')](db[_0x8b07('0xf8')],{'foreignKey':_0x8b07('0x1e9'),'as':_0x8b07('0x1d4')});db[_0x8b07('0xff')][_0x8b07('0x115')](db[_0x8b07('0x101')],{'foreignKey':'ToQueueId','as':_0x8b07('0x1d2')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x8b07('0x1d0'),'as':_0x8b07('0x1d5')});db['WhatsappTransferReport'][_0x8b07('0x115')](db[_0x8b07('0x105')],{'foreignKey':_0x8b07('0x1d6'),'as':_0x8b07('0x1d7')});db[_0x8b07('0x101')][_0x8b07('0x117')](db['User'],{'as':_0x8b07('0x15d'),'through':'UserWhatsappQueue','foreignKey':_0x8b07('0x1ea')});db[_0x8b07('0x101')][_0x8b07('0x117')](db[_0x8b07('0xe0')],{'through':_0x8b07('0x1ca'),'as':_0x8b07('0x14c')});module[_0x8b07('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa3fe=['../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','Migration','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','VoiceMail','cascade','hasMany','UserVoiceQueueRt','VoiceQueuesRt','UserId','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteraction','MailInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','Dashboard','DashboardItem','Items','FaxAccountId','Exntensions','Agents','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','CompanyId','JscriptySessions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','CustomReportId','MetricId','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','Variable','VariableId','Configurations','Subjects','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ServicenowConfiguration','Dynamics365Configuration','ChatQueueReport','ToId','SmsQueueReport','ProjectId','user_has_square_projects','user_has_teams','team_has_voice_queues','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','path','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','xC@LL1234','mysql','database','username','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xa3fe,0x1b0));var _0xea3f=function(_0x5b8e42,_0x31ced4){_0x5b8e42=_0x5b8e42-0x0;var _0x5f1376=_0xa3fe[_0x5b8e42];return _0x5f1376;};'use strict';var path=require(_0xea3f('0x0'));var config=require('../config/environment');var Sequelize=require(_0xea3f('0x1'));var _=require(_0xea3f('0x2'));var jstz=require(_0xea3f('0x3'));var timezone=jstz['determine']();config[_0xea3f('0x1')]=_[_0xea3f('0x4')](config['sequelize'],{'database':_0xea3f('0x5'),'username':_0xea3f('0x6'),'password':'xC@LL1234','options':{'host':_0xea3f('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xea3f('0x8')},'logging':![],'timezone':timezone[_0xea3f('0x9')](),'define':{'charset':_0xea3f('0xa'),'collate':_0xea3f('0xb')}}});config['sequelizeHistory']=_[_0xea3f('0x4')](config['sequelizeHistory'],{'database':_0xea3f('0x5'),'username':_0xea3f('0x6'),'password':_0xea3f('0xc'),'options':{'host':_0xea3f('0x7'),'port':0xcea,'dialect':_0xea3f('0xd'),'dialectOptions':{'charset':_0xea3f('0x8')},'logging':![],'timezone':timezone[_0xea3f('0x9')](),'define':{'charset':_0xea3f('0xa'),'collate':_0xea3f('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xea3f('0x1')][_0xea3f('0xe')],config[_0xea3f('0x1')][_0xea3f('0xf')],config[_0xea3f('0x1')][_0xea3f('0x10')],config[_0xea3f('0x1')][_0xea3f('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xea3f('0x12')][_0xea3f('0xe')],config[_0xea3f('0x12')][_0xea3f('0xf')],config['sequelizeHistory'][_0xea3f('0x10')],config[_0xea3f('0x12')]['options'])};db[_0xea3f('0x13')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x15'));db[_0xea3f('0x16')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x17'));db[_0xea3f('0x18')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x19'));db[_0xea3f('0x1a')]=db['sequelize']['import'](_0xea3f('0x1b'));db[_0xea3f('0x1c')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x1d'));db[_0xea3f('0x1e')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x1f'));db[_0xea3f('0x20')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x21'));db['ScreenRecording']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x22'));db['VoiceMail']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x23'));db[_0xea3f('0x24')]=db['sequelize'][_0xea3f('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xea3f('0x25')]=db[_0xea3f('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xea3f('0x26')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x27'));db[_0xea3f('0x28')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x29'));db[_0xea3f('0x2a')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x2b'));db[_0xea3f('0x2c')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/memberReport/memberReport.model');db[_0xea3f('0x2d')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x2e'));db['UserVoiceQueueRt']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x2f'));db[_0xea3f('0x30')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x31'));db[_0xea3f('0x32')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x33'));db[_0xea3f('0x34')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x35'));db[_0xea3f('0x36')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0xea3f('0x37')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x38'));db[_0xea3f('0x39')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xea3f('0x3a')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x3b'));db[_0xea3f('0x3c')]=db[_0xea3f('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0xea3f('0x3d')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x3e'));db[_0xea3f('0x3f')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x40'));db[_0xea3f('0x41')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x42'));db[_0xea3f('0x43')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x44'));db[_0xea3f('0x45')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x46'));db[_0xea3f('0x47')]=db['sequelize']['import'](_0xea3f('0x48'));db['Dashboard']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x49'));db['DashboardItem']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x4a'));db[_0xea3f('0x4b')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x4c'));db[_0xea3f('0x4d')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x4e'));db['FaxInteraction']=db['sequelize']['import'](_0xea3f('0x4f'));db[_0xea3f('0x50')]=db[_0xea3f('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0xea3f('0x51')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/faxQueue/faxQueue.model');db[_0xea3f('0x52')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x53'));db[_0xea3f('0x54')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/smsAccount/smsAccount.model');db[_0xea3f('0x55')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x56'));db['SmsInteraction']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x57'));db[_0xea3f('0x58')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x59'));db[_0xea3f('0x5a')]=db['sequelize']['import'](_0xea3f('0x5b'));db[_0xea3f('0x5c')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x5d'));db[_0xea3f('0x5e')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x5f'));db['OpenchannelInteraction']=db['sequelize'][_0xea3f('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x60'));db[_0xea3f('0x61')]=db['sequelize']['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xea3f('0x62')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x63'));db[_0xea3f('0x64')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x65'));db[_0xea3f('0x66')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x67'));db[_0xea3f('0x68')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0xea3f('0x69')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x6a'));db['ChatOfflineMessage']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x6b'));db[_0xea3f('0x6c')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x6d'));db[_0xea3f('0x6e')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x6f'));db[_0xea3f('0x70')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x71'));db[_0xea3f('0x72')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x73'));db[_0xea3f('0x74')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x75'));db[_0xea3f('0x76')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xea3f('0x77')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x78'));db[_0xea3f('0x79')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x7a'));db[_0xea3f('0x7b')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x7c'));db[_0xea3f('0x7d')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x7e'));db['CannedAnswer']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x7f'));db[_0xea3f('0x80')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x81'));db[_0xea3f('0x82')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x83'));db[_0xea3f('0x84')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x85'));db[_0xea3f('0x86')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x87'));db['Cdr']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x88'));db[_0xea3f('0x89')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xea3f('0x8a')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x8b'));db[_0xea3f('0x8c')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x8d'));db['Tag']=db[_0xea3f('0x1')]['import']('../api/tag/tag.model');db['Template']=db[_0xea3f('0x1')]['import'](_0xea3f('0x8e'));db[_0xea3f('0x8f')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x90'));db['Variable']=db[_0xea3f('0x1')]['import'](_0xea3f('0x91'));db['Integration']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x92'));db['IntegrationReport']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x93'));db[_0xea3f('0x94')]=db[_0xea3f('0x1')]['import'](_0xea3f('0x95'));db['AnalyticDefaultReport']=db['sequelize']['import'](_0xea3f('0x96'));db[_0xea3f('0x97')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0x98'));db[_0xea3f('0x99')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9a'));db[_0xea3f('0x9b')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9c'));db['AnalyticTreeReport']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9d'));db[_0xea3f('0x9e')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0x9f'));db[_0xea3f('0xa0')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xa1'));db[_0xea3f('0xa2')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xa3'));db[_0xea3f('0xa4')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xa5'));db[_0xea3f('0xa6')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xa7'));db[_0xea3f('0xa8')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xa9'));db[_0xea3f('0xaa')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xab'));db[_0xea3f('0xac')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xad'));db[_0xea3f('0xae')]=db['sequelize'][_0xea3f('0x14')]('../api/intDeskField/intDeskField.model');db[_0xea3f('0xaf')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xb0'));db[_0xea3f('0xb1')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xea3f('0xb2')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xb3'));db['ZendeskAccount']=db['sequelize'][_0xea3f('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xea3f('0xb4')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xb5'));db[_0xea3f('0xb6')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xb7'));db['FreshdeskAccount']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xea3f('0xb8')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xb9'));db[_0xea3f('0xba')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xbb'));db['VtigerAccount']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xbc'));db['VtigerConfiguration']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xbd'));db[_0xea3f('0xbe')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0xea3f('0xbf')]=db['sequelize'][_0xea3f('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xc0'));db[_0xea3f('0xc1')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xc2'));db['Dynamics365Account']=db['sequelize']['import'](_0xea3f('0xc3'));db['Dynamics365Configuration']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xea3f('0xc4')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xc5'));db[_0xea3f('0xc6')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xc7'));db[_0xea3f('0xc8')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xc9'));db[_0xea3f('0xca')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xcb'));db['Integration']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/integration/integration.model');db['Network']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xcc'));db['ChatQueueReport']=db[_0xea3f('0x1')]['import'](_0xea3f('0xcd'));db[_0xea3f('0xce')]=db[_0xea3f('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xea3f('0xcf')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xd0'));db[_0xea3f('0xd1')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xd2'));db[_0xea3f('0xd3')]=db['sequelize'][_0xea3f('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xea3f('0xd4')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xd5'));db[_0xea3f('0xd6')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xd7'));db[_0xea3f('0xd8')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xd9'));db[_0xea3f('0xda')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xdb'));db[_0xea3f('0xdc')]=db[_0xea3f('0x1')]['import'](_0xea3f('0xdd'));db['SquareProject']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xde'));db['SquareRecording']=db[_0xea3f('0x1')]['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xdf'));db[_0xea3f('0xe0')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe1'));db[_0xea3f('0xe2')]=db[_0xea3f('0x1')]['import']('../api/license/license.model');db[_0xea3f('0xe3')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/campaign/campaign.model');db[_0xea3f('0xe4')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/migration/migration.model');db['Attachment']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe5'));db['Plugin']=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe6'));db[_0xea3f('0xe7')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xe8'));db[_0xea3f('0xe9')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0xea3f('0xea')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xeb'));db[_0xea3f('0xec')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xed'));db[_0xea3f('0xee')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xef'));db[_0xea3f('0xf0')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0xea3f('0xf1')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/userProfile/userProfile.model');db[_0xea3f('0xf2')]=db['sequelize'][_0xea3f('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0xea3f('0xf3')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xf4'));db[_0xea3f('0xf5')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xf6'));db[_0xea3f('0xf7')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xea3f('0xf8')]=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xf9'));db[_0xea3f('0xfa')]=db['sequelize']['import'](_0xea3f('0xfb'));db[_0xea3f('0xfc')]=db[_0xea3f('0x1')][_0xea3f('0x14')](_0xea3f('0xfd'));db[_0xea3f('0xfe')]=db['sequelize'][_0xea3f('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize'][_0xea3f('0x14')](_0xea3f('0xff'));db[_0xea3f('0x100')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/whatsappQueue/whatsappQueue.model');db[_0xea3f('0x101')]=db[_0xea3f('0x1')][_0xea3f('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0xea3f('0x13')]['hasOne'](db[_0xea3f('0x102')],{'as':_0xea3f('0x102'),'onDelete':_0xea3f('0x103'),'foreignKey':'UserId'});db['User'][_0xea3f('0x104')](db[_0xea3f('0x20')],{'as':'Recordings','foreignKey':'UserId'});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x105')],{'as':_0xea3f('0x106'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x108'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x13')]['hasMany'](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':_0xea3f('0x107')});db['User']['hasMany'](db[_0xea3f('0x77')],{'as':_0xea3f('0x10a'),'foreignKey':'UserId'});db[_0xea3f('0x13')][_0xea3f('0x104')](db['ReportAgentPreview'],{'as':_0xea3f('0x79'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x10b')],{'as':'OpenchannelInteractions','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db['ChatInteraction'],{'as':_0xea3f('0x10c'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x10e'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')]['hasMany'](db[_0xea3f('0x10f')],{'as':'FaxInteractions','foreignKey':'UserId'});db['User']['hasMany'](db[_0xea3f('0x41')],{'as':_0xea3f('0x110'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0xfa')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xea3f('0x13')][_0xea3f('0x104')](db[_0xea3f('0xf5')],{'as':'Notifications','foreignKey':'SenderId'});db[_0xea3f('0x13')][_0xea3f('0x111')](db[_0xea3f('0xf1')],{'as':_0xea3f('0xf1'),'foreignKey':_0xea3f('0x112')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x6e')],{'as':_0xea3f('0x114'),'through':_0xea3f('0x115')});db['User'][_0xea3f('0x113')](db[_0xea3f('0x116')],{'as':_0xea3f('0x117'),'through':_0xea3f('0x118')});db['User'][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x119'),'through':_0xea3f('0x11a')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':'user_has_teams'});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x41')],{'as':_0xea3f('0x110'),'through':_0xea3f('0x11b')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x68')],{'as':'ChatInteractions','through':_0xea3f('0x11c')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x10f')],{'as':_0xea3f('0x11d'),'through':_0xea3f('0x11e')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x10e'),'through':'user_has_sms_interactions'});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x10b')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db['User'][_0xea3f('0x113')](db[_0xea3f('0xfa')],{'as':_0xea3f('0x11f'),'through':_0xea3f('0x120')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x1e')],{'as':_0xea3f('0x121'),'through':_0xea3f('0x30'),'required':![]});db['User'][_0xea3f('0x113')](db[_0xea3f('0x3f')],{'as':'MailQueues','through':_0xea3f('0x34'),'required':![]});db['User'][_0xea3f('0x113')](db[_0xea3f('0x6c')],{'as':_0xea3f('0x122'),'through':_0xea3f('0x32'),'required':![],'hooks':!![]});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x51')],{'as':_0xea3f('0x123'),'through':'UserFaxQueue','required':![]});db['User']['belongsToMany'](db[_0xea3f('0x5a')],{'as':_0xea3f('0x124'),'through':_0xea3f('0x125'),'required':![]});db['User'][_0xea3f('0x113')](db[_0xea3f('0x61')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x100')],{'as':_0xea3f('0x126'),'through':'UserWhatsappQueue','required':![]});db[_0xea3f('0x13')][_0xea3f('0x113')](db['CmList'],{'through':_0xea3f('0x11a')});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x127')],{'as':_0xea3f('0x128'),'through':_0xea3f('0x129'),'required':![]});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x62')],{'as':'ChatWebsites','through':_0xea3f('0x12a')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0x4b')],{'as':_0xea3f('0x12b'),'through':'user_has_fax_accounts'});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x3d')],{'as':_0xea3f('0x12c'),'through':_0xea3f('0x12d')});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x5c')],{'as':_0xea3f('0x12e'),'through':'user_has_openchannel_accounts'});db[_0xea3f('0x13')][_0xea3f('0x113')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xea3f('0x12f')});db[_0xea3f('0x13')][_0xea3f('0x113')](db[_0xea3f('0xf7')],{'as':_0xea3f('0x130'),'through':_0xea3f('0x131')});db[_0xea3f('0x13')]['belongsToMany'](db[_0xea3f('0x132')],{'as':_0xea3f('0x133'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x134'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x135')});db[_0xea3f('0x18')]['hasMany'](db[_0xea3f('0x1a')],{'onDelete':_0xea3f('0x103')});db[_0xea3f('0x1a')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x136'),'onDelete':_0xea3f('0x103')});db['VoiceMusicOnHold'][_0xea3f('0x113')](db[_0xea3f('0x8c')],{'as':_0xea3f('0x137'),'through':_0xea3f('0x138')});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x105')],{'as':_0xea3f('0x139'),'foreignKey':_0xea3f('0x13a')});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x13b')],{'as':_0xea3f('0x13c'),'foreignKey':_0xea3f('0x13a')});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':'VoiceQueueId'});db[_0xea3f('0x1e')][_0xea3f('0x104')](db['CmHopperHistory'],{'as':_0xea3f('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x79')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xea3f('0x1e')][_0xea3f('0x104')](db[_0xea3f('0x74')],{'as':_0xea3f('0x13e'),'foreignKey':_0xea3f('0x13a')});db[_0xea3f('0x1e')]['hasMany'](db[_0xea3f('0xd3')],{'as':'JscriptySessions','foreignKey':_0xea3f('0x13a')});db['VoiceQueue'][_0xea3f('0x111')](db[_0xea3f('0x2d')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xea3f('0x1e')][_0xea3f('0x111')](db[_0xea3f('0x2d')],{'as':_0xea3f('0x13f'),'foreignKey':_0xea3f('0x140')});db['VoiceQueue'][_0xea3f('0x111')](db[_0xea3f('0x84')],{'as':'Interval','foreignKey':_0xea3f('0x141')});db[_0xea3f('0x1e')]['belongsTo'](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':_0xea3f('0x143')});db[_0xea3f('0x1e')]['belongsToMany'](db[_0xea3f('0xf0')],{'as':'Lists','through':_0xea3f('0x144')});db[_0xea3f('0x1e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xea3f('0x30')});db[_0xea3f('0x1e')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'as':_0xea3f('0x145'),'through':'team_has_voice_queues'});db[_0xea3f('0x1e')][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':'User','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x146')]['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x13'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x102')][_0xea3f('0x104')](db[_0xea3f('0x24')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x148'),'sourceKey':_0xea3f('0x149')});db[_0xea3f('0x24')][_0xea3f('0x111')](db[_0xea3f('0x102')],{'foreignKey':_0xea3f('0x148'),'targetKey':_0xea3f('0x149')});db[_0xea3f('0x25')]['hasMany'](db[_0xea3f('0x2a')],{'as':_0xea3f('0x14a'),'foreignKey':_0xea3f('0x14b'),'constraints':![]});db[_0xea3f('0x25')][_0xea3f('0x104')](db[_0xea3f('0x28')],{'as':_0xea3f('0x14c'),'foreignKey':_0xea3f('0x14b'),'constraints':![]});db['VoiceCallReport'][_0xea3f('0x111')](db['User'],{'as':'User','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x25')][_0xea3f('0x111')](db['CmContact'],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x3a')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'as':_0xea3f('0x3d'),'foreignKey':_0xea3f('0x14f')});db['MailServerOut'][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'as':_0xea3f('0x3d'),'foreignKey':_0xea3f('0x14f')});db['MailAccount'][_0xea3f('0x150')](db[_0xea3f('0x3a')],{'as':_0xea3f('0x151'),'onDelete':'cascade'});db[_0xea3f('0x3d')][_0xea3f('0x150')](db[_0xea3f('0x3c')],{'as':_0xea3f('0x152'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':_0xea3f('0x14f')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x14f')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x43')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x14f')});db[_0xea3f('0x3d')][_0xea3f('0x104')](db[_0xea3f('0x41')],{'as':_0xea3f('0x156')});db['MailAccount'][_0xea3f('0x104')](db['MailApplication'],{'as':_0xea3f('0x136')});db[_0xea3f('0x3d')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x3d')][_0xea3f('0x111')](db[_0xea3f('0x159')],{'as':_0xea3f('0x159'),'foreignKey':_0xea3f('0x15a')});db['MailAccount'][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xea3f('0x143')});db[_0xea3f('0x3d')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xea3f('0x3f')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':'UserMailQueue'});db[_0xea3f('0x3f')][_0xea3f('0x113')](db['Team'],{'through':_0xea3f('0x15b'),'as':_0xea3f('0x145')});db[_0xea3f('0x41')]['hasMany'](db[_0xea3f('0x43')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x15c')});db[_0xea3f('0x41')][_0xea3f('0x111')](db['MailAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x14f')});db['MailInteraction']['belongsTo'](db[_0xea3f('0x116')],{'as':'Contact','foreignKey':_0xea3f('0x14e')});db['MailInteraction'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db['MailInteraction'][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x160'),'as':_0xea3f('0x161')});db[_0xea3f('0x41')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':'mail_interaction_has_tags','as':_0xea3f('0x162')});db['MailInteraction'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x11b'),'foreignKey':_0xea3f('0x15c')});db['MailMessage'][_0xea3f('0x104')](db[_0xea3f('0x164')],{'as':_0xea3f('0x165'),'onDelete':_0xea3f('0x103')});db['MailMessage']['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x13')});db[_0xea3f('0x43')][_0xea3f('0x111')](db['CmContact'],{'onDelete':'cascade','as':_0xea3f('0x14d')});db[_0xea3f('0x43')]['belongsTo'](db['MailInteraction'],{'as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x15c')});db[_0xea3f('0x43')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'as':_0xea3f('0x15d'),'foreignKey':'MailAccountId'});db['MailApplication'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x45')][_0xea3f('0x111')](db[_0xea3f('0x3f')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x45')][_0xea3f('0x111')](db['MailAccount'],{'onDelete':'restrict'});db[_0xea3f('0x45')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x45')][_0xea3f('0x111')](db[_0xea3f('0x15f')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xea3f('0x47')][_0xea3f('0x111')](db['MailAccount'],{});db['MailQueueReport'][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':'ListId'});db[_0xea3f('0x47')]['belongsTo'](db['CmContact'],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x47')][_0xea3f('0x111')](db[_0xea3f('0x41')],{});db[_0xea3f('0x47')][_0xea3f('0x111')](db['MailMessage'],{});db[_0xea3f('0x47')][_0xea3f('0x111')](db['User'],{});db[_0xea3f('0x47')][_0xea3f('0x111')](db[_0xea3f('0x3f')],{});db[_0xea3f('0x168')][_0xea3f('0x104')](db[_0xea3f('0x169')],{'as':_0xea3f('0x16a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x4b')]['hasMany'](db[_0xea3f('0x80')],{'as':'Dispositions','foreignKey':_0xea3f('0x16b')});db[_0xea3f('0x4b')]['hasMany'](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x16b')});db[_0xea3f('0x4b')][_0xea3f('0x104')](db['FaxInteraction'],{'as':_0xea3f('0x156')});db[_0xea3f('0x4b')]['hasMany'](db[_0xea3f('0x4d')],{'as':_0xea3f('0x136')});db[_0xea3f('0x4b')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x16c'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x4b')][_0xea3f('0x104')](db['FaxMessage'],{'as':_0xea3f('0x147')});db[_0xea3f('0x4b')]['belongsTo'](db['Trunk'],{'as':_0xea3f('0x2d')});db[_0xea3f('0x4b')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':'List','foreignKey':'ListId'});db[_0xea3f('0x4b')][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':_0xea3f('0x143')});db[_0xea3f('0x4b')][_0xea3f('0x113')](db['User'],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x16e')});db[_0xea3f('0x4d')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db['FaxApplication'][_0xea3f('0x111')](db[_0xea3f('0x51')],{'onDelete':_0xea3f('0x167')});db['FaxApplication'][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x4d')][_0xea3f('0x111')](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db['FaxInteraction'][_0xea3f('0x104')](db[_0xea3f('0x50')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x170')});db[_0xea3f('0x10f')][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x16b')});db[_0xea3f('0x10f')]['belongsTo'](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x10f')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':'UserId'});db[_0xea3f('0x10f')]['belongsToMany'](db[_0xea3f('0x15f')],{'through':_0xea3f('0x171'),'as':_0xea3f('0x161')});db[_0xea3f('0x10f')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x171'),'as':'ThroughTags'});db[_0xea3f('0x10f')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x11e'),'foreignKey':'FaxInteractionId'});db[_0xea3f('0x50')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x13')});db['FaxMessage'][_0xea3f('0x111')](db[_0xea3f('0x10f')],{'as':'Interaction','foreignKey':_0xea3f('0x170')});db[_0xea3f('0x50')][_0xea3f('0x111')](db['CmContact'],{'onDelete':_0xea3f('0x103'),'as':'Contact'});db[_0xea3f('0x50')][_0xea3f('0x111')](db['Attachment'],{'as':_0xea3f('0x164'),'foreignKey':_0xea3f('0x172')});db['FaxMessage'][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'as':_0xea3f('0x15d'),'foreignKey':'FaxAccountId'});db[_0xea3f('0x51')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x36')});db[_0xea3f('0x51')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':'team_has_fax_queues','as':_0xea3f('0x145')});db[_0xea3f('0x52')][_0xea3f('0x111')](db['FaxAccount'],{});db[_0xea3f('0x52')]['belongsTo'](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x52')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x52')]['belongsTo'](db[_0xea3f('0x10f')],{});db[_0xea3f('0x52')][_0xea3f('0x111')](db[_0xea3f('0x50')],{});db['FaxQueueReport']['belongsTo'](db[_0xea3f('0x13')],{});db[_0xea3f('0x52')][_0xea3f('0x111')](db[_0xea3f('0x51')],{});db[_0xea3f('0x54')][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':'SmsAccountId'});db[_0xea3f('0x54')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x173')});db[_0xea3f('0x54')]['hasMany'](db[_0xea3f('0x58')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x173')});db[_0xea3f('0x54')][_0xea3f('0x104')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x156')});db[_0xea3f('0x54')]['hasMany'](db[_0xea3f('0x55')],{'as':_0xea3f('0x136')});db['SmsAccount'][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x54')][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xea3f('0x143')});db[_0xea3f('0x54')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x12f')});db[_0xea3f('0x55')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0xea3f('0x55')][_0xea3f('0x111')](db[_0xea3f('0x5a')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x55')]['belongsTo'](db[_0xea3f('0x54')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x55')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x141')});db['SmsApplication']['belongsTo'](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':'TagId'});db[_0xea3f('0x10d')][_0xea3f('0x104')](db[_0xea3f('0x58')],{'as':_0xea3f('0x147'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db[_0xea3f('0x54')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x173')});db[_0xea3f('0x10d')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x10d')]['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x10d')]['belongsToMany'](db['Tag'],{'through':_0xea3f('0x174'),'as':_0xea3f('0x161')});db[_0xea3f('0x10d')][_0xea3f('0x113')](db['Tag'],{'through':_0xea3f('0x174'),'as':_0xea3f('0x162')});db[_0xea3f('0x10d')]['belongsToMany'](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x175'),'foreignKey':'SmsInteractionId'});db[_0xea3f('0x58')][_0xea3f('0x111')](db['User'],{'as':_0xea3f('0x13')});db[_0xea3f('0x58')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x14d')});db[_0xea3f('0x58')]['belongsTo'](db[_0xea3f('0x10d')],{'onDelete':_0xea3f('0x103'),'as':'Interaction','foreignKey':_0xea3f('0x176')});db[_0xea3f('0x58')][_0xea3f('0x111')](db['SmsAccount'],{'as':_0xea3f('0x15d'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x125'),'foreignKey':_0xea3f('0x177')});db[_0xea3f('0x5a')]['belongsToMany'](db[_0xea3f('0xe0')],{'through':_0xea3f('0x178'),'as':_0xea3f('0x145')});db[_0xea3f('0x5c')]['hasMany'](db[_0xea3f('0x80')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId'});db[_0xea3f('0x5c')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x179')});db['OpenchannelAccount']['hasMany'](db[_0xea3f('0x10b')],{'as':_0xea3f('0x156'),'foreignKey':_0xea3f('0x179')});db[_0xea3f('0x5c')][_0xea3f('0x104')](db[_0xea3f('0x17a')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x179')});db['OpenchannelAccount'][_0xea3f('0x104')](db[_0xea3f('0x5e')],{'as':_0xea3f('0x136'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':_0xea3f('0x143')});db[_0xea3f('0x5c')]['belongsToMany'](db['User'],{'as':_0xea3f('0x16d'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0x5e')][_0xea3f('0x111')](db[_0xea3f('0x61')],{'onDelete':'restrict','foreignKey':_0xea3f('0x17b')});db[_0xea3f('0x5e')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'onDelete':'restrict','foreignKey':_0xea3f('0x179')});db[_0xea3f('0x5e')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0xea3f('0x111')](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db[_0xea3f('0x10b')][_0xea3f('0x104')](db[_0xea3f('0x17a')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x17c')});db[_0xea3f('0x10b')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x179')});db[_0xea3f('0x10b')][_0xea3f('0x111')](db['CmContact'],{'as':'Contact','foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x10b')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db[_0xea3f('0x10b')][_0xea3f('0x113')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xea3f('0x161')});db[_0xea3f('0x10b')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x17d'),'as':_0xea3f('0x162')});db[_0xea3f('0x10b')]['belongsToMany'](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x17e'),'foreignKey':_0xea3f('0x17c')});db['OpenchannelMessage'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x13')});db[_0xea3f('0x17a')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'onDelete':'cascade','as':'Contact'});db[_0xea3f('0x17a')][_0xea3f('0x111')](db[_0xea3f('0x10b')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x17c')});db['OpenchannelMessage'][_0xea3f('0x111')](db[_0xea3f('0x164')],{'as':_0xea3f('0x164'),'foreignKey':_0xea3f('0x172')});db[_0xea3f('0x17a')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'as':_0xea3f('0x15d'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':'UserOpenchannelQueue','foreignKey':_0xea3f('0x17b')});db[_0xea3f('0x61')]['belongsToMany'](db[_0xea3f('0xe0')],{'through':_0xea3f('0x17f'),'as':'Teams'});db[_0xea3f('0x62')]['hasMany'](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':_0xea3f('0x180')});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':_0xea3f('0x155'),'foreignKey':_0xea3f('0x180')});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x70')],{'as':_0xea3f('0x181')});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x68')],{'as':'Interactions'});db[_0xea3f('0x62')][_0xea3f('0x104')](db['ChatApplication'],{'as':'Applications'});db[_0xea3f('0x62')][_0xea3f('0x104')](db[_0xea3f('0x69')],{'as':_0xea3f('0x147')});db[_0xea3f('0x62')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':'ListId'});db[_0xea3f('0x62')][_0xea3f('0x111')](db['Interval'],{'as':'Interval','foreignKey':_0xea3f('0x141')});db['ChatWebsite'][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xea3f('0x113')](db['User'],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x12a')});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':'Contact','foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x64')]['belongsTo'](db[_0xea3f('0x10b')],{});db['OpenchannelQueueReport'][_0xea3f('0x111')](db[_0xea3f('0x17a')],{});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x64')][_0xea3f('0x111')](db[_0xea3f('0x61')],{});db['ChatApplication'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x182'),'foreignKey':'UserId','onDelete':_0xea3f('0x167')});db[_0xea3f('0x66')][_0xea3f('0x111')](db['ChatQueue'],{'as':_0xea3f('0x183'),'foreignKey':_0xea3f('0x184'),'onDelete':'restrict'});db[_0xea3f('0x66')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x185'),'foreignKey':_0xea3f('0x180'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db['ChatInteraction'][_0xea3f('0x104')](db[_0xea3f('0x69')],{'as':_0xea3f('0x147'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x186')});db[_0xea3f('0x68')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x180')});db[_0xea3f('0x68')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':'ContactId'});db[_0xea3f('0x68')][_0xea3f('0x111')](db['User'],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x107')});db['ChatInteraction'][_0xea3f('0x113')](db['Tag'],{'through':_0xea3f('0x187'),'as':_0xea3f('0x161')});db['ChatInteraction'][_0xea3f('0x113')](db['Tag'],{'through':_0xea3f('0x187'),'as':_0xea3f('0x162')});db[_0xea3f('0x68')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':'user_has_chat_interactions','foreignKey':_0xea3f('0x186')});db[_0xea3f('0x69')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x13')});db[_0xea3f('0x69')]['belongsTo'](db['CmContact'],{'onDelete':_0xea3f('0x103'),'as':'Contact','foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x69')][_0xea3f('0x111')](db['ChatInteraction'],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x186')});db[_0xea3f('0x69')][_0xea3f('0x111')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xea3f('0x69')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':'Account','foreignKey':_0xea3f('0x180')});db[_0xea3f('0x188')][_0xea3f('0x111')](db['CmContact'],{'onDelete':_0xea3f('0x103'),'as':_0xea3f('0x14d'),'foreignKey':'ContactId'});db[_0xea3f('0x188')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x180')});db['ChatQueue'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x32'),'hooks':!![]});db['ChatQueue'][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':_0xea3f('0x189'),'as':'Teams'});db[_0xea3f('0x6e')]['hasMany'](db[_0xea3f('0xce')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x18a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x6e')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x139'),'through':_0xea3f('0x115')});db['ChatProactiveAction'][_0xea3f('0x111')](db[_0xea3f('0x62')],{'as':_0xea3f('0x185'),'foreignKey':_0xea3f('0x180')});db['CmCompany'][_0xea3f('0x104')](db[_0xea3f('0x116')],{'as':_0xea3f('0x117'),'foreignKey':_0xea3f('0x18b')});db['CmContact'][_0xea3f('0x104')](db[_0xea3f('0x13b')],{'as':_0xea3f('0x13c'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x77')],{'as':_0xea3f('0x13d'),'foreignKey':'ContactId'});db[_0xea3f('0x116')][_0xea3f('0x104')](db['ReportAgentPreview'],{'as':_0xea3f('0x79'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db['JscriptySessionReport'],{'as':_0xea3f('0x18c'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x10b')],{'as':'OpenchannelInteractions','foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x68')],{'as':'ChatInteractions','foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x10d')],{'as':_0xea3f('0x10e'),'foreignKey':'ContactId','onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')][_0xea3f('0x104')](db[_0xea3f('0x10f')],{'as':_0xea3f('0x11d'),'foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x116')]['hasMany'](db[_0xea3f('0x41')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xea3f('0x167')});db['CmContact'][_0xea3f('0x111')](db[_0xea3f('0x72')],{'as':_0xea3f('0x18d'),'foreignKey':'CompanyId'});db[_0xea3f('0x116')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158'),'onDelete':_0xea3f('0x103')});db['CmContact'][_0xea3f('0x113')](db['User'],{'as':_0xea3f('0x163'),'through':_0xea3f('0x118')});db[_0xea3f('0x116')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'as':_0xea3f('0x161'),'through':_0xea3f('0x18e')});db[_0xea3f('0x116')]['belongsToMany'](db[_0xea3f('0x15f')],{'through':_0xea3f('0x18e'),'as':_0xea3f('0x162')});db[_0xea3f('0x13b')][_0xea3f('0x111')](db['CmContact'],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e'),'onDelete':_0xea3f('0x103')});db['CmHopper'][_0xea3f('0x111')](db['CmList'],{'as':_0xea3f('0x157'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0xea3f('0x111')](db['User'],{'as':'Agent','foreignKey':_0xea3f('0x107')});db[_0xea3f('0x13b')]['belongsTo'](db[_0xea3f('0x1e')],{'as':'Queue','foreignKey':_0xea3f('0x13a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x13b')]['belongsTo'](db[_0xea3f('0xe3')],{'as':'Campaign','foreignKey':_0xea3f('0x18f'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x13b')]['belongsTo'](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':_0xea3f('0x190')});db[_0xea3f('0x74')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0xea3f('0x111')](db['CmList'],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158'),'onDelete':_0xea3f('0x103')});db['CmHopperBlack'][_0xea3f('0x111')](db[_0xea3f('0x1e')],{'as':'Queue','foreignKey':_0xea3f('0x13a'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x74')]['belongsTo'](db[_0xea3f('0xe3')],{'as':_0xea3f('0xe3'),'foreignKey':_0xea3f('0x18f'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0x7d')][_0xea3f('0x104')](db[_0xea3f('0x82')],{'as':{'plural':_0xea3f('0x191'),'singular':_0xea3f('0x192')},'foreignKey':_0xea3f('0x193'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x7d')][_0xea3f('0x104')](db[_0xea3f('0x82')],{'as':{'plural':_0xea3f('0x194'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x7d')][_0xea3f('0x104')](db[_0xea3f('0x7b')],{'as':'Actions','foreignKey':_0xea3f('0x195'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x80')][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':_0xea3f('0x196'),'onDelete':'cascade'});db[_0xea3f('0x84')]['hasMany'](db[_0xea3f('0x84')],{'as':_0xea3f('0x197'),'foreignKey':'IntervalId','onDelete':_0xea3f('0x103'),'hooks':!![],'required':![]});db[_0xea3f('0x84')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':_0xea3f('0x108'),'foreignKey':_0xea3f('0x141'),'onDelete':_0xea3f('0x167')});db[_0xea3f('0x84')]['hasMany'](db[_0xea3f('0x45')],{'as':_0xea3f('0x198'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x84')][_0xea3f('0x104')](db['ChatApplication'],{'as':_0xea3f('0x199'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x84')]['hasMany'](db['FaxApplication'],{'as':_0xea3f('0x19a'),'foreignKey':_0xea3f('0x141')});db[_0xea3f('0x84')][_0xea3f('0x104')](db['SmsApplication'],{'as':_0xea3f('0x19b'),'foreignKey':_0xea3f('0x141')});db['Schedule']['belongsTo'](db[_0xea3f('0x3d')],{});db[_0xea3f('0x8a')]['belongsTo'](db[_0xea3f('0x19c')],{'foreignKey':_0xea3f('0x19d')});db[_0xea3f('0x8a')]['belongsTo'](db[_0xea3f('0x94')],{'foreignKey':'CustomReportId'});db[_0xea3f('0x8c')][_0xea3f('0x113')](db[_0xea3f('0x1c')],{'as':_0xea3f('0x19e'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0xea3f('0x15f')][_0xea3f('0x113')](db[_0xea3f('0x116')],{'through':'cm_contact_has_tags'});db[_0xea3f('0x15f')][_0xea3f('0x113')](db[_0xea3f('0x68')],{'through':_0xea3f('0x187')});db[_0xea3f('0x15f')][_0xea3f('0x113')](db[_0xea3f('0x41')],{'through':_0xea3f('0x160')});db['Tag'][_0xea3f('0x113')](db['SmsInteraction'],{'through':_0xea3f('0x174')});db[_0xea3f('0x15f')]['belongsToMany'](db[_0xea3f('0x10f')],{'through':_0xea3f('0x171')});db[_0xea3f('0x15f')][_0xea3f('0x113')](db['OpenchannelInteraction'],{'through':_0xea3f('0x17d')});db['Tag']['belongsToMany'](db[_0xea3f('0xfa')],{'through':_0xea3f('0x19f')});db['Trigger'][_0xea3f('0x104')](db['Condition'],{'as':{'plural':_0xea3f('0x1a0'),'singular':_0xea3f('0x1a1')},'foreignKey':_0xea3f('0x1a2'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x8f')][_0xea3f('0x104')](db[_0xea3f('0x82')],{'as':{'plural':_0xea3f('0x1a3'),'singular':_0xea3f('0x1a4')},'foreignKey':_0xea3f('0x1a5'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db[_0xea3f('0x8f')][_0xea3f('0x104')](db['Action'],{'as':_0xea3f('0x1a6'),'foreignKey':_0xea3f('0x1a7'),'onDelete':_0xea3f('0x103'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xea3f('0x9b')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1a9'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0xea3f('0x9b')],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x19d')});db[_0xea3f('0x99')][_0xea3f('0x104')](db[_0xea3f('0x9b')],{'as':_0xea3f('0x1a8'),'onDelete':'cascade','foreignKey':_0xea3f('0x1aa')});db[_0xea3f('0x9b')][_0xea3f('0x111')](db['AnalyticMetric'],{'foreignKey':_0xea3f('0x1aa')});db[_0xea3f('0x9e')][_0xea3f('0x104')](db[_0xea3f('0xa0')],{'as':'Configurations','onDelete':_0xea3f('0x103'),'foreignKey':'AccountId'});db[_0xea3f('0xa0')][_0xea3f('0x104')](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xa0')][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1ac'),'onDelete':'cascade','foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xa0')][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa0')][_0xea3f('0x111')](db['SalesforceAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xa2')][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db['SalesforceField'][_0xea3f('0x104')](db[_0xea3f('0xa2')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xa2')]['hasMany'](db['SalesforceField'],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa2')]['belongsTo'](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xa4')][_0xea3f('0x104')](db[_0xea3f('0xa6')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xa6')][_0xea3f('0x104')](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b6'),'onDelete':_0xea3f('0x103'),'foreignKey':'SubjectId'});db[_0xea3f('0xa6')]['hasMany'](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1ac'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xa6')]['hasMany'](db[_0xea3f('0xa8')],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa6')]['belongsTo'](db[_0xea3f('0xa4')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xa8')]['hasMany'](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xa8')][_0xea3f('0x104')](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b1'),'foreignKey':'DescriptionId'});db[_0xea3f('0xa8')][_0xea3f('0x104')](db[_0xea3f('0xa8')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xa8')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xaa')]['hasMany'](db[_0xea3f('0xac')],{'as':'Configurations','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xac')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':_0xea3f('0x1b6'),'onDelete':'cascade','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xac')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':_0xea3f('0x1ac'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xac')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db['DeskConfiguration'][_0xea3f('0x111')](db[_0xea3f('0xaa')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xac')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x1b7')});db[_0xea3f('0xae')][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':'Subject','foreignKey':_0xea3f('0x1ab')});db['DeskField'][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db['DeskField'][_0xea3f('0x104')](db[_0xea3f('0xae')],{'as':'Field','foreignKey':_0xea3f('0x1ae')});db['DeskField'][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xaf')][_0xea3f('0x104')](db['ZohoConfiguration'],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xb1')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ab')});db['ZohoConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xb2')],{'as':'Descriptions','onDelete':_0xea3f('0x103'),'foreignKey':'DescriptionId'});db[_0xea3f('0xb1')][_0xea3f('0x104')](db['ZohoField'],{'as':'Fields','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db['ZohoConfiguration']['belongsTo'](db[_0xea3f('0xaf')],{'as':_0xea3f('0x15d'),'foreignKey':'AccountId'});db[_0xea3f('0xb2')][_0xea3f('0x104')](db[_0xea3f('0xb2')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xb2')]['hasMany'](db[_0xea3f('0xb2')],{'as':'Description','foreignKey':_0xea3f('0x1ad')});db['ZohoField'][_0xea3f('0x104')](db['ZohoField'],{'as':_0xea3f('0x1b2'),'foreignKey':'FieldId'});db[_0xea3f('0xb2')]['belongsTo'](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0x1b8')][_0xea3f('0x104')](db[_0xea3f('0xb4')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b6'),'foreignKey':'SubjectId'});db[_0xea3f('0xb4')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1ac'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xb4')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':'Fields','foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xb4')][_0xea3f('0x111')](db[_0xea3f('0x1b8')],{'as':'Account','foreignKey':_0xea3f('0x1af')});db['ZendeskConfiguration']['belongsToMany'](db[_0xea3f('0x15f')],{'through':_0xea3f('0x1b9')});db[_0xea3f('0xb6')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b0'),'foreignKey':'SubjectId'});db[_0xea3f('0xb6')][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b1'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0xea3f('0x104')](db[_0xea3f('0xb6')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xb6')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':'VariableId'});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xb8')]['hasMany'](db[_0xea3f('0xba')],{'as':'Subjects','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xb8')]['hasMany'](db[_0xea3f('0xba')],{'as':'Descriptions','onDelete':_0xea3f('0x103'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db[_0xea3f('0xba')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':'FieldId'});db[_0xea3f('0xb8')][_0xea3f('0x111')](db['FreshdeskAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db['FreshdeskConfiguration'][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xea3f('0xba')][_0xea3f('0x104')](db[_0xea3f('0xba')],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xba')][_0xea3f('0x104')](db[_0xea3f('0xba')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xba')]['hasMany'](db[_0xea3f('0xba')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xba')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0x1ba')][_0xea3f('0x104')](db['VtigerConfiguration'],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db['VtigerConfiguration'][_0xea3f('0x104')](db['VtigerField'],{'as':_0xea3f('0x1b6'),'foreignKey':'SubjectId'});db[_0xea3f('0x1bb')][_0xea3f('0x104')](db[_0xea3f('0xbe')],{'as':_0xea3f('0x1ac'),'foreignKey':_0xea3f('0x1ad')});db['VtigerConfiguration']['hasMany'](db[_0xea3f('0xbe')],{'as':'Fields','foreignKey':_0xea3f('0x1ae')});db['VtigerConfiguration'][_0xea3f('0x111')](db[_0xea3f('0x1ba')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xbe')][_0xea3f('0x104')](db[_0xea3f('0xbe')],{'as':_0xea3f('0x1b0'),'foreignKey':'SubjectId'});db[_0xea3f('0xbe')][_0xea3f('0x104')](db['VtigerField'],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db['VtigerField']['hasMany'](db[_0xea3f('0xbe')],{'as':_0xea3f('0x1b2'),'foreignKey':'FieldId'});db[_0xea3f('0xbe')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':'VariableId'});db[_0xea3f('0xbf')][_0xea3f('0x104')](db[_0xea3f('0x1bc')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0x1bc')]['hasMany'](db[_0xea3f('0xc1')],{'as':'Subjects','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0x1bc')]['hasMany'](db[_0xea3f('0xc1')],{'as':'Descriptions','foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0x1bc')][_0xea3f('0x104')](db[_0xea3f('0xc1')],{'as':'Fields','foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0x1bc')][_0xea3f('0x111')](db[_0xea3f('0xbf')],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db['ServicenowField'][_0xea3f('0x104')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xea3f('0x1ab')});db[_0xea3f('0xc1')][_0xea3f('0x104')](db[_0xea3f('0xc1')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db[_0xea3f('0xc1')]['hasMany'](db[_0xea3f('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0xea3f('0xc1')]['belongsTo'](db['Variable'],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db['Dynamics365Account'][_0xea3f('0x104')](db[_0xea3f('0x1bd')],{'as':'Configurations','onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0x1bd')][_0xea3f('0x104')](db[_0xea3f('0xc4')],{'as':_0xea3f('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xea3f('0x1ac'),'onDelete':'cascade','foreignKey':_0xea3f('0x1ad')});db['Dynamics365Configuration'][_0xea3f('0x104')](db[_0xea3f('0xc4')],{'as':_0xea3f('0x1a8'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0x1bd')]['belongsTo'](db['Dynamics365Account'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xc4')]['hasMany'](db[_0xea3f('0xc4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xea3f('0xc4')][_0xea3f('0x104')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0xea3f('0x1ad')});db['Dynamics365Field']['hasMany'](db[_0xea3f('0xc4')],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xc4')][_0xea3f('0x111')](db[_0xea3f('0x1b3')],{'as':_0xea3f('0x1b3'),'foreignKey':_0xea3f('0x1b4')});db[_0xea3f('0xc6')][_0xea3f('0x104')](db[_0xea3f('0xc8')],{'as':_0xea3f('0x1b5'),'onDelete':_0xea3f('0x103'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xc8')]['hasMany'](db[_0xea3f('0xca')],{'as':'Subjects','foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xca')],{'as':_0xea3f('0x1ac'),'foreignKey':_0xea3f('0x1ad')});db['FreshsalesConfiguration'][_0xea3f('0x104')](db[_0xea3f('0xca')],{'as':_0xea3f('0x1a8'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xc8')][_0xea3f('0x111')](db['FreshsalesAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1af')});db[_0xea3f('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0xea3f('0x1b0'),'foreignKey':_0xea3f('0x1ab')});db['FreshsalesField'][_0xea3f('0x104')](db[_0xea3f('0xca')],{'as':_0xea3f('0x1b1'),'foreignKey':_0xea3f('0x1ad')});db['FreshsalesField'][_0xea3f('0x104')](db['FreshsalesField'],{'as':_0xea3f('0x1b2'),'foreignKey':_0xea3f('0x1ae')});db[_0xea3f('0xca')][_0xea3f('0x111')](db['Variable'],{'as':_0xea3f('0x1b3'),'foreignKey':'VariableId'});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x62')],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x1be')]['belongsTo'](db['ChatInteraction'],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x69')],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x1be')][_0xea3f('0x111')](db[_0xea3f('0x6c')],{});db[_0xea3f('0xce')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x103'),'foreignKey':'FromId'});db[_0xea3f('0xce')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'onDelete':'cascade','foreignKey':_0xea3f('0x1bf')});db[_0xea3f('0xd3')][_0xea3f('0x104')](db[_0xea3f('0xd1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xea3f('0xd3')][_0xea3f('0x104')](db[_0xea3f('0xcf')],{'foreignKey':'SessionId','onDelete':_0xea3f('0x103')});db['SmsQueueReport'][_0xea3f('0x111')](db[_0xea3f('0x54')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':'List','foreignKey':_0xea3f('0x158')});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0x1c0')]['belongsTo'](db[_0xea3f('0x10d')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x58')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x1c0')][_0xea3f('0x111')](db[_0xea3f('0x5a')],{});db[_0xea3f('0xd8')][_0xea3f('0x104')](db[_0xea3f('0xd3')],{'foreignKey':_0xea3f('0x1c1')});db[_0xea3f('0xd8')][_0xea3f('0x104')](db[_0xea3f('0xd1')],{'foreignKey':_0xea3f('0x1c1')});db[_0xea3f('0xd8')][_0xea3f('0x104')](db[_0xea3f('0xcf')],{'foreignKey':_0xea3f('0x1c1')});db[_0xea3f('0x132')]['belongsToMany'](db[_0xea3f('0x13')],{'as':'Users','through':_0xea3f('0x1c2')});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x1c3')});db['Team'][_0xea3f('0x113')](db[_0xea3f('0x1e')],{'through':_0xea3f('0x1c4'),'as':_0xea3f('0x121')});db[_0xea3f('0xe0')]['belongsToMany'](db[_0xea3f('0x3f')],{'through':_0xea3f('0x15b'),'as':_0xea3f('0x1c5')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0xea3f('0x189'),'as':_0xea3f('0x122')});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x51')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x5a')],{'through':_0xea3f('0x178'),'as':_0xea3f('0x124')});db[_0xea3f('0xe0')][_0xea3f('0x113')](db[_0xea3f('0x61')],{'through':'team_has_openchannel_queues','as':_0xea3f('0x1c6')});db['Team'][_0xea3f('0x113')](db['WhatsappQueue'],{'through':_0xea3f('0x1c7'),'as':_0xea3f('0x126')});db['Campaign'][_0xea3f('0x104')](db[_0xea3f('0x13b')],{'as':'Hoppers','foreignKey':_0xea3f('0x18f')});db[_0xea3f('0xe3')]['hasMany'](db[_0xea3f('0x76')],{'as':_0xea3f('0x109'),'foreignKey':_0xea3f('0x18f')});db[_0xea3f('0xe3')][_0xea3f('0x104')](db[_0xea3f('0x77')],{'as':_0xea3f('0x13d'),'foreignKey':'CampaignId'});db[_0xea3f('0xe3')][_0xea3f('0x104')](db[_0xea3f('0x74')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0xea3f('0x1c8')});db[_0xea3f('0xe3')][_0xea3f('0x111')](db['Trunk'],{'as':_0xea3f('0x13f'),'foreignKey':_0xea3f('0x140')});db[_0xea3f('0xe3')][_0xea3f('0x111')](db[_0xea3f('0x84')],{'as':_0xea3f('0x84'),'foreignKey':'IntervalId'});db['Campaign'][_0xea3f('0x111')](db[_0xea3f('0x132')],{'as':_0xea3f('0x132'),'foreignKey':_0xea3f('0x1c9')});db[_0xea3f('0xe3')][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x119'),'through':_0xea3f('0x1ca')});db[_0xea3f('0xe3')][_0xea3f('0x113')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x1cb'),'through':_0xea3f('0x1cc')});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x43')],{});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x41')],{});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'foreignKey':'FromMailAccountId','as':_0xea3f('0x1cd')});db[_0xea3f('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db[_0xea3f('0xe7')][_0xea3f('0x111')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x3f')],{'foreignKey':_0xea3f('0x1d0'),'as':_0xea3f('0x1d1')});db[_0xea3f('0xe7')][_0xea3f('0x111')](db[_0xea3f('0x3d')],{'foreignKey':'ToMailAccountId','as':_0xea3f('0x1d2')});db['ChatTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x69')],{});db['ChatTransferReport'][_0xea3f('0x111')](db['ChatInteraction'],{});db['ChatTransferReport']['belongsTo'](db[_0xea3f('0x62')],{'foreignKey':_0xea3f('0x1d3'),'as':_0xea3f('0x1cd')});db[_0xea3f('0xe9')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db['ChatTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':'ToUserId','as':_0xea3f('0x1d4')});db[_0xea3f('0xe9')][_0xea3f('0x111')](db[_0xea3f('0x6c')],{'foreignKey':_0xea3f('0x1d5'),'as':'ToQueue'});db[_0xea3f('0xe9')][_0xea3f('0x111')](db[_0xea3f('0x62')],{'foreignKey':_0xea3f('0x1d6'),'as':'ToAccount'});db[_0xea3f('0xea')]['belongsTo'](db[_0xea3f('0x50')],{});db[_0xea3f('0xea')][_0xea3f('0x111')](db[_0xea3f('0x10f')],{});db[_0xea3f('0xea')][_0xea3f('0x111')](db[_0xea3f('0x4b')],{'foreignKey':_0xea3f('0x1d7'),'as':'FromAccount'});db[_0xea3f('0xea')][_0xea3f('0x111')](db['User'],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db['FaxTransferReport'][_0xea3f('0x111')](db['User'],{'foreignKey':_0xea3f('0x1d8'),'as':_0xea3f('0x1d4')});db[_0xea3f('0xea')]['belongsTo'](db[_0xea3f('0x51')],{'foreignKey':'ToFaxQueueId','as':_0xea3f('0x1d1')});db[_0xea3f('0xea')]['belongsTo'](db[_0xea3f('0x4b')],{'foreignKey':'ToFaxAccountId','as':_0xea3f('0x1d2')});db['OpenchannelTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x17a')],{});db[_0xea3f('0xec')][_0xea3f('0x111')](db[_0xea3f('0x10b')],{});db[_0xea3f('0xec')]['belongsTo'](db[_0xea3f('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xea3f('0x1cd')});db[_0xea3f('0xec')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1ce'),'as':_0xea3f('0x1cf')});db['OpenchannelTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':'ToUserId','as':_0xea3f('0x1d4')});db['OpenchannelTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x61')],{'foreignKey':_0xea3f('0x1d9'),'as':_0xea3f('0x1d1')});db[_0xea3f('0xec')][_0xea3f('0x111')](db[_0xea3f('0x5c')],{'foreignKey':_0xea3f('0x1da'),'as':_0xea3f('0x1d2')});db[_0xea3f('0xee')]['belongsTo'](db[_0xea3f('0x58')],{});db['SmsTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x10d')],{});db['SmsTransferReport'][_0xea3f('0x111')](db[_0xea3f('0x54')],{'foreignKey':_0xea3f('0x1db'),'as':_0xea3f('0x1cd')});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1ce'),'as':'FromAgent'});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':'ToUserId','as':_0xea3f('0x1d4')});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x5a')],{'foreignKey':'ToSmsQueueId','as':_0xea3f('0x1d1')});db[_0xea3f('0xee')][_0xea3f('0x111')](db[_0xea3f('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0xea3f('0x104')](db[_0xea3f('0x80')],{'as':_0xea3f('0x153'),'foreignKey':'ListId'});db[_0xea3f('0xf0')][_0xea3f('0x104')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xea3f('0x158')});db['CmList'][_0xea3f('0x104')](db['CmContact'],{'as':_0xea3f('0x117'),'onDelete':_0xea3f('0x103'),'foreignKey':'ListId'});db[_0xea3f('0xf0')]['hasMany'](db['CmHopperFinal'],{'as':_0xea3f('0x109'),'foreignKey':'ListId'});db[_0xea3f('0xf0')][_0xea3f('0x104')](db[_0xea3f('0x77')],{'as':_0xea3f('0x10a'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0xf0')][_0xea3f('0x104')](db[_0xea3f('0x79')],{'as':_0xea3f('0x79'),'foreignKey':_0xea3f('0x158')});db[_0xea3f('0xf0')][_0xea3f('0x113')](db[_0xea3f('0x1e')],{'as':'Queues','through':_0xea3f('0x144')});db['CmList'][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':_0xea3f('0x11a')});db[_0xea3f('0x127')][_0xea3f('0x104')](db[_0xea3f('0x1a')],{'as':'Extensions','onDelete':'cascade'});db[_0xea3f('0x127')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':'Agents','through':'user_has_voice_prefixes'});db['UserProfile'][_0xea3f('0x104')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'foreignKey':_0xea3f('0x112')});db['UserProfile'][_0xea3f('0x104')](db[_0xea3f('0xf2')],{'as':'UserProfileSections','foreignKey':_0xea3f('0x112'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0xf2')][_0xea3f('0x104')](db[_0xea3f('0xf3')],{'as':'Resources','foreignKey':_0xea3f('0x1dc'),'onDelete':_0xea3f('0x103')});db[_0xea3f('0xf7')]['hasMany'](db[_0xea3f('0x80')],{'as':'Dispositions','foreignKey':_0xea3f('0x1dd')});db[_0xea3f('0xf7')][_0xea3f('0x104')](db[_0xea3f('0x154')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xea3f('0x104')](db[_0xea3f('0xfc')],{'as':_0xea3f('0x147'),'foreignKey':_0xea3f('0x1dd')});db[_0xea3f('0xf7')][_0xea3f('0x104')](db[_0xea3f('0xfa')],{'as':_0xea3f('0x156')});db[_0xea3f('0xf7')]['hasMany'](db['WhatsappApplication'],{'as':_0xea3f('0x136')});db[_0xea3f('0xf7')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':'List','foreignKey':_0xea3f('0x158')});db[_0xea3f('0xf7')][_0xea3f('0x111')](db[_0xea3f('0x86')],{'as':_0xea3f('0x142'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xea3f('0xf7')]['belongsToMany'](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':'user_has_whatsapp_accounts'});db[_0xea3f('0xf8')]['belongsTo'](db[_0xea3f('0x13')],{'onDelete':_0xea3f('0x167')});db[_0xea3f('0xf8')][_0xea3f('0x111')](db[_0xea3f('0x100')],{'onDelete':'restrict'});db[_0xea3f('0xf8')][_0xea3f('0x111')](db[_0xea3f('0xf7')],{'onDelete':_0xea3f('0x167')});db['WhatsappApplication']['belongsTo'](db[_0xea3f('0x84')],{'onDelete':_0xea3f('0x167'),'foreignKey':'IntervalId'});db[_0xea3f('0xf8')]['belongsTo'](db[_0xea3f('0x15f')],{'onDelete':_0xea3f('0x167'),'foreignKey':_0xea3f('0x16f')});db[_0xea3f('0xfa')][_0xea3f('0x104')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xea3f('0x1de')});db[_0xea3f('0xfa')]['belongsTo'](db['WhatsappAccount'],{'as':_0xea3f('0x15d'),'foreignKey':_0xea3f('0x1dd')});db['WhatsappInteraction']['belongsTo'](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db[_0xea3f('0xfa')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'as':_0xea3f('0x15e'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x19f'),'as':'Tags'});db[_0xea3f('0xfa')][_0xea3f('0x113')](db[_0xea3f('0x15f')],{'through':_0xea3f('0x19f'),'as':_0xea3f('0x162')});db[_0xea3f('0xfa')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x163'),'through':_0xea3f('0x120'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xea3f('0x111')](db['User'],{'as':_0xea3f('0x13')});db[_0xea3f('0xfc')][_0xea3f('0x111')](db[_0xea3f('0x116')],{'onDelete':'cascade','as':'Contact'});db[_0xea3f('0xfc')][_0xea3f('0x111')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xea3f('0x166'),'foreignKey':_0xea3f('0x1de')});db[_0xea3f('0xfc')][_0xea3f('0x111')](db[_0xea3f('0xf7')],{'as':_0xea3f('0x15d'),'foreignKey':'WhatsappAccountId'});db[_0xea3f('0xfe')][_0xea3f('0x111')](db['WhatsappAccount'],{});db[_0xea3f('0xfe')][_0xea3f('0x111')](db[_0xea3f('0xf0')],{'as':_0xea3f('0x157'),'foreignKey':_0xea3f('0x158')});db['WhatsappQueueReport']['belongsTo'](db[_0xea3f('0x116')],{'as':_0xea3f('0x14d'),'foreignKey':_0xea3f('0x14e')});db['WhatsappQueueReport'][_0xea3f('0x111')](db[_0xea3f('0xfa')],{});db[_0xea3f('0xfe')]['belongsTo'](db['WhatsappQueue'],{});db[_0xea3f('0xfe')][_0xea3f('0x111')](db[_0xea3f('0xfc')],{});db['WhatsappQueueReport'][_0xea3f('0x111')](db[_0xea3f('0x13')],{});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0xfc')],{});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0xfa')],{});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0xf7')],{'foreignKey':_0xea3f('0x1e0'),'as':_0xea3f('0x1cd')});db['WhatsappTransferReport']['belongsTo'](db[_0xea3f('0xf7')],{'foreignKey':_0xea3f('0x1e1'),'as':_0xea3f('0x1d2')});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0x100')],{'foreignKey':'ToQueueId','as':_0xea3f('0x1d1')});db['WhatsappTransferReport'][_0xea3f('0x111')](db['User'],{'foreignKey':_0xea3f('0x1ce'),'as':'FromAgent'});db[_0xea3f('0x1df')][_0xea3f('0x111')](db[_0xea3f('0x13')],{'foreignKey':_0xea3f('0x1d8'),'as':'ToAgent'});db[_0xea3f('0x100')][_0xea3f('0x113')](db[_0xea3f('0x13')],{'as':_0xea3f('0x16d'),'through':_0xea3f('0x39'),'foreignKey':_0xea3f('0x1e2')});db[_0xea3f('0x100')][_0xea3f('0x113')](db[_0xea3f('0xe0')],{'through':'team_has_whatsapp_queues','as':_0xea3f('0x145')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 33d5d19..5eaed3e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./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/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','password','newPassword','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','secret','registry','isArray','isPlainObject','isString','replace','@@{','}@@','includes','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./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/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0x3071('0x0'));var ewinston=require(_0x3071('0x1'));var util=require(_0x3071('0x2'));var errors=require(_0x3071('0x3'));var config=require(_0x3071('0x4'));var logger=require('./config/logger')(_0x3071('0x5'));var authLogger=require(_0x3071('0x6'))(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6){_0xabd7b6[_0x3071('0x9')](ewinston[_0x3071('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2f1e87,_0xbd737f){var _0x22274c=_0x3071('0xb');if(!_[_0x3071('0xc')](_0x2f1e87[_0x3071('0xd')])){_0x22274c+='\x20body=%s';var _0x3457cd=_0x2f1e87[_0x3071('0xd')];maskSensitiveData(_0x3457cd);}return util[_0x3071('0xe')](_0x22274c,_0x2f1e87[_0x3071('0xf')],_0x2f1e87[_0x3071('0x10')]['x-forwarded-for']?_0x2f1e87[_0x3071('0x10')][_0x3071('0x11')]:_0x2f1e87[_0x3071('0x12')][_0x3071('0x13')]||_0x2f1e87['ip'],_0x2f1e87[_0x3071('0x14')],_0xbd737f['statusCode'],_0xbd737f['responseTime'],_0x2f1e87[_0x3071('0x15')]?_0x2f1e87['user']['id']:null,_0x2f1e87[_0x3071('0x15')]?_0x2f1e87[_0x3071('0x15')]['name']:null,_0x2f1e87[_0x3071('0x15')]?_0x2f1e87['user'][_0x3071('0x16')]:null,_0x3457cd?util[_0x3071('0x17')](_0x3457cd,![],null):'');}}));_0xabd7b6[_0x3071('0x9')](ewinston[_0x3071('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1caa5d,_0x2a6a4b){var _0x157a47=_0x3071('0x18');if(_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d[_0x3071('0xd')]['device']&&_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]){_0x157a47=_0x3071('0x1a');}return util[_0x3071('0xe')](_0x157a47,_0x1caa5d[_0x3071('0xf')],_0x1caa5d[_0x3071('0x10')][_0x3071('0x11')]?_0x1caa5d[_0x3071('0x10')]['x-forwarded-for']:_0x1caa5d[_0x3071('0x12')][_0x3071('0x13')]||_0x1caa5d['ip'],_0x1caa5d[_0x3071('0x14')],_0x2a6a4b['statusCode'],_0x2a6a4b[_0x3071('0x1b')],_0x1caa5d['user']?_0x1caa5d[_0x3071('0x15')]['id']:null,_0x1caa5d[_0x3071('0x15')]?_0x1caa5d[_0x3071('0x15')][_0x3071('0x1c')]:null,_0x1caa5d[_0x3071('0x15')]?_0x1caa5d[_0x3071('0x15')][_0x3071('0x16')]:null,_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d['body']['device']?_0x1caa5d[_0x3071('0xd')][_0x3071('0x1d')]:_0x3071('0x1e'),_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]?_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]:'',_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d['body'][_0x3071('0x1f')]?_0x1caa5d[_0x3071('0xd')][_0x3071('0x1f')]:'');},'ignoreRoute':function(_0x4d5c4b){var _0x4fb1ca=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4fb1ca[_0x3071('0x20')](_0x4d5c4b[_0x3071('0x14')]);}}));_0xabd7b6[_0x3071('0x9')](_0x3071('0x21'),require(_0x3071('0x22')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x23'),require(_0x3071('0x24')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x25'),require('./api/voiceContext'));_0xabd7b6['use'](_0x3071('0x26'),require(_0x3071('0x27')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x28'),require(_0x3071('0x29')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2a'),require(_0x3071('0x2b')));_0xabd7b6['use']('/api/voice/recordings',require('./api/voiceRecording'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2c'),require('./api/screenRecording'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2d'),require(_0x3071('0x2e')));_0xabd7b6[_0x3071('0x9')]('/api/voice/mails/messages',require(_0x3071('0x2f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x30'),require(_0x3071('0x31')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x32'),require(_0x3071('0x33')));_0xabd7b6[_0x3071('0x9')]('/api/voice/agents/reports',require(_0x3071('0x34')));_0xabd7b6['use']('/api/voice/queues/reports',require(_0x3071('0x35')));_0xabd7b6[_0x3071('0x9')]('/api/members/reports',require(_0x3071('0x36')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x37'),require(_0x3071('0x38')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x39'),require('./api/voiceTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x3a'),require('./api/mailServerOut'));_0xabd7b6[_0x3071('0x9')]('/api/mail/accounts',require(_0x3071('0x3b')));_0xabd7b6[_0x3071('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x3c'),require(_0x3071('0x3d')));_0xabd7b6['use'](_0x3071('0x3e'),require('./api/mailInteraction'));_0xabd7b6[_0x3071('0x9')]('/api/mail/messages',require(_0x3071('0x3f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x40'),require(_0x3071('0x41')));_0xabd7b6[_0x3071('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x42'),require(_0x3071('0x43')));_0xabd7b6[_0x3071('0x9')]('/api/dashboards/items',require(_0x3071('0x44')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x45'),require(_0x3071('0x46')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x47'),require('./api/faxApplication'));_0xabd7b6[_0x3071('0x9')]('/api/fax/interactions',require('./api/faxInteraction'));_0xabd7b6['use']('/api/fax/messages',require(_0x3071('0x48')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x49'),require(_0x3071('0x4a')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x4b'),require(_0x3071('0x4c')));_0xabd7b6[_0x3071('0x9')]('/api/sms/accounts',require(_0x3071('0x4d')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x4e'),require(_0x3071('0x4f')));_0xabd7b6[_0x3071('0x9')]('/api/sms/interactions',require('./api/smsInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x50'),require(_0x3071('0x51')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x52'),require('./api/smsQueue'));_0xabd7b6[_0x3071('0x9')]('/api/openchannel/accounts',require(_0x3071('0x53')));_0xabd7b6['use']('/api/openchannel/applications',require(_0x3071('0x54')));_0xabd7b6['use'](_0x3071('0x55'),require('./api/openchannelInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x56'),require(_0x3071('0x57')));_0xabd7b6[_0x3071('0x9')]('/api/openchannel/queues',require(_0x3071('0x58')));_0xabd7b6['use'](_0x3071('0x59'),require('./api/chatWebsite'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5a'),require('./api/openchannelQueueReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5b'),require(_0x3071('0x5c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5d'),require(_0x3071('0x5e')));_0xabd7b6[_0x3071('0x9')]('/api/chat/messages',require(_0x3071('0x5f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x60'),require(_0x3071('0x61')));_0xabd7b6['use'](_0x3071('0x62'),require(_0x3071('0x63')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x64'),require(_0x3071('0x65')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x66'),require(_0x3071('0x67')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x68'),require(_0x3071('0x69')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6a'),require(_0x3071('0x6b')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6c'),require('./api/cmHopper'));_0xabd7b6['use'](_0x3071('0x6d'),require('./api/cmHopperBlack'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6e'),require(_0x3071('0x6f')));_0xabd7b6['use'](_0x3071('0x70'),require(_0x3071('0x71')));_0xabd7b6['use']('/api/cm/custom_fields',require(_0x3071('0x72')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x73'),require(_0x3071('0x74')));_0xabd7b6['use'](_0x3071('0x75'),require(_0x3071('0x76')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x77'),require(_0x3071('0x78')));_0xabd7b6['use'](_0x3071('0x79'),require(_0x3071('0x7a')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7b'),require(_0x3071('0x7c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7d'),require('./api/interval'));_0xabd7b6['use'](_0x3071('0x7e'),require('./api/pause'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7f'),require('./api/cdr'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x80'),require('./api/voiceQueuesLog'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x81'),require(_0x3071('0x82')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x83'),require('./api/sound'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x84'),require(_0x3071('0x85')));_0xabd7b6['use'](_0x3071('0x86'),require(_0x3071('0x87')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x88'),require(_0x3071('0x89')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8a'),require(_0x3071('0x8b')));_0xabd7b6[_0x3071('0x9')]('/api/integrations',require(_0x3071('0x8c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8d'),require(_0x3071('0x8e')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8f'),require(_0x3071('0x90')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x91'),require(_0x3071('0x92')));_0xabd7b6[_0x3071('0x9')]('/api/analytics/extracted_reports',require(_0x3071('0x93')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x94'),require(_0x3071('0x95')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x96'),require(_0x3071('0x97')));_0xabd7b6[_0x3071('0x9')]('/api/analytics/tree_reports',require(_0x3071('0x98')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x99'),require(_0x3071('0x9a')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xabd7b6[_0x3071('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xabd7b6['use']('/api/integrations/sugarcrm/configurations',require(_0x3071('0x9b')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x9c'),require('./api/intSugarcrmField'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x9d'),require(_0x3071('0x9e')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/desk/configurations',require(_0x3071('0x9f')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/desk/fields',require(_0x3071('0xa0')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa1'),require(_0x3071('0xa2')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa3'),require(_0x3071('0xa4')));_0xabd7b6['use']('/api/integrations/zoho/fields',require(_0x3071('0xa5')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa6'),require('./api/intZendeskAccount'));_0xabd7b6['use'](_0x3071('0xa7'),require(_0x3071('0xa8')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa9'),require(_0x3071('0xaa')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xab'),require(_0x3071('0xac')));_0xabd7b6['use'](_0x3071('0xad'),require('./api/intFreshdeskConfiguration'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xae'),require(_0x3071('0xaf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb0'),require(_0x3071('0xb1')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb2'),require('./api/intVtigerConfiguration'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb3'),require(_0x3071('0xb4')));_0xabd7b6['use'](_0x3071('0xb5'),require(_0x3071('0xb6')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0xabd7b6[_0x3071('0x9')]('/api/integrations/servicenow/fields',require(_0x3071('0xb7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb8'),require(_0x3071('0xb9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xba'),require(_0x3071('0xbb')));_0xabd7b6['use'](_0x3071('0xbc'),require(_0x3071('0xbd')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xbe'),require(_0x3071('0xbf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc0'),require(_0x3071('0xc1')));_0xabd7b6['use'](_0x3071('0xc2'),require('./api/intFreshsalesField'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc3'),require(_0x3071('0xc4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc5'),require(_0x3071('0xc6')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc7'),require(_0x3071('0xc8')));_0xabd7b6[_0x3071('0x9')]('/api/jscripty/answers/reports',require(_0x3071('0xc9')));_0xabd7b6[_0x3071('0x9')]('/api/jscripty/questions/reports',require(_0x3071('0xca')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xcb'),require(_0x3071('0xcc')));_0xabd7b6[_0x3071('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0xabd7b6[_0x3071('0x9')]('/api/square/reports',require(_0x3071('0xcd')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xce'),require(_0x3071('0xcf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd0'),require('./api/jscriptyProject'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd1'),require(_0x3071('0xd2')));_0xabd7b6[_0x3071('0x9')]('/api/square/odbc',require(_0x3071('0xd3')));_0xabd7b6[_0x3071('0x9')]('/api/square/projects',require(_0x3071('0xd4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd5'),require(_0x3071('0xd6')));_0xabd7b6[_0x3071('0x9')]('/api/square/messages',require(_0x3071('0xd7')));_0xabd7b6['use'](_0x3071('0xd8'),require(_0x3071('0xd9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xda'),require(_0x3071('0xdb')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xdc'),require(_0x3071('0xdd')));_0xabd7b6['use'](_0x3071('0xde'),require(_0x3071('0xdf')));_0xabd7b6[_0x3071('0x9')]('/api/attachments',require(_0x3071('0xe0')));_0xabd7b6['use'](_0x3071('0xe1'),require(_0x3071('0xe2')));_0xabd7b6[_0x3071('0x9')]('/api/mail/reports/transfer',require(_0x3071('0xe3')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe4'),require(_0x3071('0xe5')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe6'),require(_0x3071('0xe7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe8'),require('./api/openchannelTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe9'),require(_0x3071('0xea')));_0xabd7b6['use']('/api/cm/lists',require('./api/cmList'));_0xabd7b6['use']('/api/voice/prefixes',require(_0x3071('0xeb')));_0xabd7b6[_0x3071('0x9')]('/api/userProfiles',require(_0x3071('0xec')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xed'),require('./api/userProfileSection'));_0xabd7b6['use'](_0x3071('0xee'),require(_0x3071('0xef')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf0'),require(_0x3071('0xf1')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf2'),require('./api/whatsappAccount'));_0xabd7b6['use'](_0x3071('0xf3'),require(_0x3071('0xf4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf5'),require('./api/whatsappInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf6'),require(_0x3071('0xf7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf8'),require(_0x3071('0xf9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfa'),require('./api/whatsappTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfb'),require(_0x3071('0xfc')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfd'),require('./api/cloudProvider'));_0xabd7b6[_0x3071('0x9')]('/api/auth/local',require('./api/authLocal'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfe'),require(_0x3071('0xff')));_0xabd7b6['use'](_0x3071('0x100'),require(_0x3071('0x101')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x102'),require(_0x3071('0x103')));_0xabd7b6['use']('/api/version',require(_0x3071('0x104')));_0xabd7b6[_0x3071('0x9')]('/api/system',require(_0x3071('0x105')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x106'),require(_0x3071('0x107')));_0xabd7b6[_0x3071('0x9')]('/api/webbar',require(_0x3071('0x108')));_0xabd7b6['use'](_0x3071('0x109'),express[_0x3071('0x10a')](path['join'](config[_0x3071('0x10b')],'/apidoc')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x10c'),express[_0x3071('0x10a')](path[_0x3071('0x10d')](config['root'],_0x3071('0x10c'))));_0xabd7b6['use'](_0x3071('0x10e'),express['static'](path[_0x3071('0x10d')](config[_0x3071('0x10b')],'/demo')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x10f'),express['static'](path[_0x3071('0x10d')](config[_0x3071('0x10b')],_0x3071('0x110'),_0x3071('0x111'))));_0xabd7b6[_0x3071('0x9')](_0x3071('0x112'),express[_0x3071('0x10a')](path[_0x3071('0x10d')](config[_0x3071('0x10b')],_0x3071('0x113'))));_0xabd7b6[_0x3071('0x114')](_0x3071('0x115'))[_0x3071('0x116')](errors[0x194]);_0xabd7b6[_0x3071('0x114')]('/*')[_0x3071('0x116')](function(_0x5128a5,_0x1aff4e){_0x1aff4e[_0x3071('0x117')](path[_0x3071('0x118')](_0xabd7b6[_0x3071('0x116')](_0x3071('0x119'))+'/index.html'));});};var sensitiveFields=['username',_0x3071('0x11a'),_0x3071('0x11b'),'apiKey',_0x3071('0x11c'),_0x3071('0x11d'),'street',_0x3071('0x11e'),_0x3071('0x11f'),_0x3071('0x120'),_0x3071('0x121'),_0x3071('0x122'),_0x3071('0x123'),_0x3071('0x124'),_0x3071('0x125'),_0x3071('0x126'),_0x3071('0x127'),'token',_0x3071('0x128'),'accessToken',_0x3071('0x129'),_0x3071('0x12a'),_0x3071('0x12b'),_0x3071('0x12c'),'membername','calleridname','calleridnum',_0x3071('0x12d'),_0x3071('0x12e'),_0x3071('0x12f'),_0x3071('0x130'),'accesskeyid',_0x3071('0x131'),_0x3071('0x132'),_0x3071('0x15'),'pass','accountSid','localstationid','dsn',_0x3071('0x133'),_0x3071('0x134'),'oldPassword'];function maskSensitiveData(_0x2750c5){var _0x2a2b9d=/(?!^)[\s\S](?!$)/g;for(var _0x22c625 in _0x2750c5){if(_[_0x3071('0x135')](_0x2750c5[_0x22c625])){for(var _0x17186c=0x0;_0x17186c<_0x2750c5[_0x22c625]['length'];_0x17186c++){maskSensitiveData(_0x2750c5[_0x22c625][_0x17186c]);}}else if(_[_0x3071('0x136')](_0x2750c5[_0x22c625])){maskSensitiveData(_0x2750c5[_0x22c625]);}else if(_[_0x3071('0x137')](_0x2750c5[_0x22c625])){_0x2750c5[_0x22c625]=_0x2750c5[_0x22c625][_0x3071('0x138')](/{{{/g,_0x3071('0x139'))['replace'](/}}}/g,_0x3071('0x13a'))['replace'](/{{/g,'@{')[_0x3071('0x138')](/}}/g,'}@');if(_[_0x3071('0x13b')](sensitiveFields,_0x22c625)){_0x2750c5[_0x22c625]=_0x2750c5[_0x22c625][_0x3071('0x138')](_0x2a2b9d,'*');}}}} \ No newline at end of file +var _0xe706=['./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','password','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','role','agent_id','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/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','./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/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/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/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xe706,0xa3));var _0x6e70=function(_0x26462e,_0x416ff7){_0x26462e=_0x26462e-0x0;var _0x31c3f0=_0xe706[_0x26462e];return _0x31c3f0;};'use strict';var _=require(_0x6e70('0x0'));var path=require(_0x6e70('0x1'));var express=require(_0x6e70('0x2'));var ewinston=require('express-winston');var util=require(_0x6e70('0x3'));var errors=require(_0x6e70('0x4'));var config=require(_0x6e70('0x5'));var logger=require(_0x6e70('0x6'))(_0x6e70('0x7'));var authLogger=require(_0x6e70('0x6'))(_0x6e70('0x8'));exports[_0x6e70('0x9')]=function(_0x1b0389){_0x1b0389[_0x6e70('0xa')](ewinston[_0x6e70('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x293ce7,_0x45a2d4){var _0x188ed3=_0x6e70('0xc');if(!_[_0x6e70('0xd')](_0x293ce7[_0x6e70('0xe')])){_0x188ed3+=_0x6e70('0xf');var _0x100eb7=_0x293ce7[_0x6e70('0xe')];maskSensitiveData(_0x100eb7);}return util[_0x6e70('0x10')](_0x188ed3,_0x293ce7[_0x6e70('0x11')],_0x293ce7[_0x6e70('0x12')][_0x6e70('0x13')]?_0x293ce7['headers']['x-forwarded-for']:_0x293ce7[_0x6e70('0x14')][_0x6e70('0x15')]||_0x293ce7['ip'],_0x293ce7[_0x6e70('0x16')],_0x45a2d4[_0x6e70('0x17')],_0x45a2d4[_0x6e70('0x18')],_0x293ce7[_0x6e70('0x19')]?_0x293ce7[_0x6e70('0x19')]['id']:null,_0x293ce7[_0x6e70('0x19')]?_0x293ce7['user']['name']:null,_0x293ce7['user']?_0x293ce7[_0x6e70('0x19')]['role']:null,_0x100eb7?util['inspect'](_0x100eb7,![],null):'');}}));_0x1b0389[_0x6e70('0xa')](ewinston[_0x6e70('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5d9263,_0x24f3ac){var _0x5c3fe7=_0x6e70('0x1a');if(_0x5d9263[_0x6e70('0xe')]&&_0x5d9263['body']['device']&&_0x5d9263[_0x6e70('0xe')]['agent_id']){_0x5c3fe7=_0x6e70('0x1b');}return util[_0x6e70('0x10')](_0x5c3fe7,_0x5d9263['method'],_0x5d9263['headers'][_0x6e70('0x13')]?_0x5d9263[_0x6e70('0x12')][_0x6e70('0x13')]:_0x5d9263[_0x6e70('0x14')][_0x6e70('0x15')]||_0x5d9263['ip'],_0x5d9263[_0x6e70('0x16')],_0x24f3ac[_0x6e70('0x17')],_0x24f3ac[_0x6e70('0x18')],_0x5d9263[_0x6e70('0x19')]?_0x5d9263[_0x6e70('0x19')]['id']:null,_0x5d9263['user']?_0x5d9263[_0x6e70('0x19')][_0x6e70('0x1c')]:null,_0x5d9263[_0x6e70('0x19')]?_0x5d9263['user'][_0x6e70('0x1d')]:null,_0x5d9263[_0x6e70('0xe')]&&_0x5d9263[_0x6e70('0xe')]['device']?_0x5d9263[_0x6e70('0xe')]['device']:'other',_0x5d9263['body']&&_0x5d9263[_0x6e70('0xe')][_0x6e70('0x1e')]?_0x5d9263['body'][_0x6e70('0x1e')]:'',_0x5d9263[_0x6e70('0xe')]&&_0x5d9263['body'][_0x6e70('0x1f')]?_0x5d9263[_0x6e70('0xe')][_0x6e70('0x1f')]:'');},'ignoreRoute':function(_0x4a67ac){var _0x54a5fe=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x54a5fe[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x16')]);}}));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x21'),require(_0x6e70('0x22')));_0x1b0389['use'](_0x6e70('0x23'),require(_0x6e70('0x24')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x25'),require(_0x6e70('0x26')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x27'),require(_0x6e70('0x28')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x29'),require('./api/voiceMusicOnHold'));_0x1b0389[_0x6e70('0xa')]('/api/voice/queues',require(_0x6e70('0x2a')));_0x1b0389['use'](_0x6e70('0x2b'),require(_0x6e70('0x2c')));_0x1b0389[_0x6e70('0xa')]('/api/screen/recordings',require(_0x6e70('0x2d')));_0x1b0389[_0x6e70('0xa')]('/api/voice/mails',require(_0x6e70('0x2e')));_0x1b0389[_0x6e70('0xa')]('/api/voice/mails/messages',require(_0x6e70('0x2f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x30'),require(_0x6e70('0x31')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x32'),require(_0x6e70('0x33')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x34'),require(_0x6e70('0x35')));_0x1b0389['use'](_0x6e70('0x36'),require('./api/voiceQueueReport'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x37'),require(_0x6e70('0x38')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x39'),require(_0x6e70('0x3a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x3b'),require(_0x6e70('0x3c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x3d'),require(_0x6e70('0x3e')));_0x1b0389[_0x6e70('0xa')]('/api/mail/accounts',require('./api/mailAccount'));_0x1b0389['use'](_0x6e70('0x3f'),require(_0x6e70('0x40')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x41'),require(_0x6e70('0x42')));_0x1b0389[_0x6e70('0xa')]('/api/mail/interactions',require(_0x6e70('0x43')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x44'),require(_0x6e70('0x45')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x46'),require(_0x6e70('0x47')));_0x1b0389[_0x6e70('0xa')]('/api/mail/reports/queue',require(_0x6e70('0x48')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x49'),require(_0x6e70('0x4a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4b'),require(_0x6e70('0x4c')));_0x1b0389['use']('/api/fax/accounts',require('./api/faxAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4d'),require(_0x6e70('0x4e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4f'),require('./api/faxInteraction'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x50'),require(_0x6e70('0x51')));_0x1b0389['use']('/api/fax/queues',require('./api/faxQueue'));_0x1b0389[_0x6e70('0xa')]('/api/fax/reports/queue',require(_0x6e70('0x52')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x53'),require(_0x6e70('0x54')));_0x1b0389['use'](_0x6e70('0x55'),require('./api/smsApplication'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x56'),require(_0x6e70('0x57')));_0x1b0389[_0x6e70('0xa')]('/api/sms/messages',require(_0x6e70('0x58')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x59'),require(_0x6e70('0x5a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x5b'),require(_0x6e70('0x5c')));_0x1b0389['use'](_0x6e70('0x5d'),require(_0x6e70('0x5e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x5f'),require(_0x6e70('0x60')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x61'),require('./api/openchannelMessage'));_0x1b0389[_0x6e70('0xa')]('/api/openchannel/queues',require(_0x6e70('0x62')));_0x1b0389[_0x6e70('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x63'),require(_0x6e70('0x64')));_0x1b0389['use']('/api/chat/applications',require(_0x6e70('0x65')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x66'),require(_0x6e70('0x67')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x68'),require('./api/chatMessage'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x69'),require(_0x6e70('0x6a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x6b'),require('./api/chatQueue'));_0x1b0389['use'](_0x6e70('0x6c'),require(_0x6e70('0x6d')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x6e'),require(_0x6e70('0x6f')));_0x1b0389['use'](_0x6e70('0x70'),require(_0x6e70('0x71')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x72'),require(_0x6e70('0x73')));_0x1b0389['use'](_0x6e70('0x74'),require(_0x6e70('0x75')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x76'),require(_0x6e70('0x77')));_0x1b0389[_0x6e70('0xa')]('/api/cm/hopper_final',require(_0x6e70('0x78')));_0x1b0389[_0x6e70('0xa')]('/api/cm/hopper_history',require(_0x6e70('0x79')));_0x1b0389[_0x6e70('0xa')]('/api/cm/custom_fields',require(_0x6e70('0x7a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x7b'),require(_0x6e70('0x7c')));_0x1b0389[_0x6e70('0xa')]('/api/automations',require(_0x6e70('0x7d')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x7e'),require(_0x6e70('0x7f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x80'),require(_0x6e70('0x81')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x82'),require(_0x6e70('0x83')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x84'),require(_0x6e70('0x85')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x86'),require(_0x6e70('0x87')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x88'),require(_0x6e70('0x89')));_0x1b0389[_0x6e70('0xa')]('/api/voiceQueuesLog',require(_0x6e70('0x8a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8b'),require(_0x6e70('0x8c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8d'),require('./api/sound'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8e'),require('./api/tag'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8f'),require(_0x6e70('0x90')));_0x1b0389['use']('/api/triggers',require(_0x6e70('0x91')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x92'),require(_0x6e70('0x93')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x94'),require(_0x6e70('0x95')));_0x1b0389['use']('/api/integrations/reports',require(_0x6e70('0x96')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x97'),require(_0x6e70('0x98')));_0x1b0389['use']('/api/analytics/default_reports',require(_0x6e70('0x99')));_0x1b0389[_0x6e70('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x1b0389[_0x6e70('0xa')]('/api/analytics/metrics',require(_0x6e70('0x9a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x9b'),require(_0x6e70('0x9c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x9d'),require(_0x6e70('0x9e')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/salesforce/accounts',require(_0x6e70('0x9f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa0'),require(_0x6e70('0xa1')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x1b0389['use'](_0x6e70('0xa2'),require(_0x6e70('0xa3')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa4'),require(_0x6e70('0xa5')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa6'),require(_0x6e70('0xa7')));_0x1b0389['use'](_0x6e70('0xa8'),require(_0x6e70('0xa9')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xaa'),require('./api/intDeskField'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xab'),require(_0x6e70('0xac')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xad'),require(_0x6e70('0xae')));_0x1b0389['use'](_0x6e70('0xaf'),require(_0x6e70('0xb0')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb1'),require(_0x6e70('0xb2')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb3'),require(_0x6e70('0xb4')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb5'),require('./api/intFreshdeskAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb6'),require(_0x6e70('0xb7')));_0x1b0389['use']('/api/integrations/freshdesk/fields',require(_0x6e70('0xb8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb9'),require(_0x6e70('0xba')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbb'),require('./api/intVtigerField'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbc'),require(_0x6e70('0xbd')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbe'),require(_0x6e70('0xbf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc0'),require(_0x6e70('0xc1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc2'),require(_0x6e70('0xc3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc4'),require('./api/intDynamics365Configuration'));_0x1b0389['use'](_0x6e70('0xc5'),require('./api/intDynamics365Field'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc6'),require(_0x6e70('0xc7')));_0x1b0389['use']('/api/networks',require('./api/network'));_0x1b0389[_0x6e70('0xa')]('/api/chat/reports/queue',require(_0x6e70('0xc8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc9'),require(_0x6e70('0xca')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xcb'),require(_0x6e70('0xcc')));_0x1b0389['use'](_0x6e70('0xcd'),require(_0x6e70('0xce')));_0x1b0389[_0x6e70('0xa')]('/api/jscripty/sessions/reports',require(_0x6e70('0xcf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd0'),require(_0x6e70('0xd1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd2'),require(_0x6e70('0xd3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd4'),require('./api/squareReportDetail'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd5'),require('./api/jscriptyProject'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd6'),require('./api/setting'));_0x1b0389['use'](_0x6e70('0xd7'),require('./api/squareOdbc'));_0x1b0389[_0x6e70('0xa')]('/api/square/projects',require(_0x6e70('0xd8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd9'),require(_0x6e70('0xda')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xdb'),require(_0x6e70('0xdc')));_0x1b0389['use']('/api/teams',require(_0x6e70('0xdd')));_0x1b0389['use'](_0x6e70('0xde'),require(_0x6e70('0xdf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe0'),require('./api/campaign'));_0x1b0389[_0x6e70('0xa')]('/api/migrations',require(_0x6e70('0xe1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe2'),require(_0x6e70('0xe3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe4'),require(_0x6e70('0xe5')));_0x1b0389['use'](_0x6e70('0xe6'),require('./api/mailTransferReport'));_0x1b0389[_0x6e70('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1b0389['use'](_0x6e70('0xe7'),require(_0x6e70('0xe8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe9'),require(_0x6e70('0xea')));_0x1b0389['use'](_0x6e70('0xeb'),require(_0x6e70('0xec')));_0x1b0389['use'](_0x6e70('0xed'),require('./api/cmList'));_0x1b0389[_0x6e70('0xa')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xee'),require(_0x6e70('0xef')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf0'),require(_0x6e70('0xf1')));_0x1b0389[_0x6e70('0xa')]('/api/userProfile/resources',require(_0x6e70('0xf2')));_0x1b0389['use'](_0x6e70('0xf3'),require(_0x6e70('0xf4')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf5'),require(_0x6e70('0xf6')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf7'),require('./api/whatsappApplication'));_0x1b0389[_0x6e70('0xa')]('/api/whatsapp/interactions',require(_0x6e70('0xf8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf9'),require(_0x6e70('0xfa')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xfb'),require(_0x6e70('0xfc')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xfd'),require(_0x6e70('0xfe')));_0x1b0389['use'](_0x6e70('0xff'),require(_0x6e70('0x100')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x101'),require(_0x6e70('0x102')));_0x1b0389['use']('/api/auth/local',require('./api/authLocal'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x103'),require(_0x6e70('0x104')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x105'),require(_0x6e70('0x106')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x107'),require(_0x6e70('0x108')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x109'),require(_0x6e70('0x10a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x10b'),require(_0x6e70('0x10c')));_0x1b0389['use'](_0x6e70('0x10d'),require(_0x6e70('0x10e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x10f'),require(_0x6e70('0x110')));_0x1b0389[_0x6e70('0xa')]('/apidoc',express['static'](path[_0x6e70('0x111')](config[_0x6e70('0x112')],_0x6e70('0x113'))));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x114'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config['root'],_0x6e70('0x114'))));_0x1b0389['use'](_0x6e70('0x116'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config[_0x6e70('0x112')],'/demo')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x117'),express['static'](path[_0x6e70('0x111')](config['root'],_0x6e70('0x118'),'1.0.16')));_0x1b0389['use'](_0x6e70('0x119'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config['root'],_0x6e70('0x11a'))));_0x1b0389[_0x6e70('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6e70('0x11c')](errors[0x194]);_0x1b0389[_0x6e70('0x11b')]('/*')[_0x6e70('0x11c')](function(_0x2d08f2,_0xb2d064){_0xb2d064[_0x6e70('0x11d')](path[_0x6e70('0x11e')](_0x1b0389[_0x6e70('0x11c')](_0x6e70('0x11f'))+'/index.html'));});};var sensitiveFields=['username',_0x6e70('0x120'),'newPassword',_0x6e70('0x121'),_0x6e70('0x122'),'lastName',_0x6e70('0x123'),_0x6e70('0x124'),_0x6e70('0x125'),'fax',_0x6e70('0x126'),_0x6e70('0x127'),_0x6e70('0x128'),_0x6e70('0x129'),_0x6e70('0x12a'),_0x6e70('0x12b'),_0x6e70('0x12c'),_0x6e70('0x12d'),_0x6e70('0x12e'),_0x6e70('0x12f'),_0x6e70('0x130'),_0x6e70('0x131'),_0x6e70('0x132'),'consumerSecret',_0x6e70('0x133'),_0x6e70('0x134'),_0x6e70('0x135'),_0x6e70('0x136'),_0x6e70('0x137'),'clientEmail',_0x6e70('0x138'),_0x6e70('0x139'),_0x6e70('0x13a'),'key',_0x6e70('0x19'),'pass','accountSid',_0x6e70('0x13b'),_0x6e70('0x13c'),_0x6e70('0x13d'),_0x6e70('0x13e'),'oldPassword'];function maskSensitiveData(_0x39e14f){var _0x41bd51=/(?!^)[\s\S](?!$)/g;for(var _0x5a20ac in _0x39e14f){if(_['isArray'](_0x39e14f[_0x5a20ac])){for(var _0x48571f=0x0;_0x48571f<_0x39e14f[_0x5a20ac][_0x6e70('0x13f')];_0x48571f++){maskSensitiveData(_0x39e14f[_0x5a20ac][_0x48571f]);}}else if(_[_0x6e70('0x140')](_0x39e14f[_0x5a20ac])){maskSensitiveData(_0x39e14f[_0x5a20ac]);}else if(_[_0x6e70('0x141')](_0x39e14f[_0x5a20ac])){_0x39e14f[_0x5a20ac]=_0x39e14f[_0x5a20ac][_0x6e70('0x142')](/{{{/g,_0x6e70('0x143'))[_0x6e70('0x142')](/}}}/g,_0x6e70('0x144'))['replace'](/{{/g,'@{')[_0x6e70('0x142')](/}}/g,'}@');if(_[_0x6e70('0x145')](sensitiveFields,_0x5a20ac)){_0x39e14f[_0x5a20ac]=_0x39e14f[_0x5a20ac][_0x6e70('0x142')](_0x41bd51,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f9c12c5..600e48f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf81=['../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.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/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc'];(function(_0x595ce4,_0x15c2a3){var _0x2319d0=function(_0x3b39d2){while(--_0x3b39d2){_0x595ce4['push'](_0x595ce4['shift']());}};_0x2319d0(++_0x15c2a3);}(_0xbf81,0x1bd));var _0x1bf8=function(_0x58e19c,_0x17b34e){_0x58e19c=_0x58e19c-0x0;var _0x536652=_0xbf81[_0x58e19c];return _0x536652;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require(_0x1bf8('0x0'));var config=require(_0x1bf8('0x1'));exports[_0x1bf8('0x2')]=function(){return new BPromise(function(_0x3398b3,_0x39f19e){var _0x3f02f2={};_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x3')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x4')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x6')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x7')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x8')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x9')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0xa')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/trunk/trunk.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xb')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailServerIn/mailServerIn.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xc')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xd')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0xe')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailMessage/mailMessage.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailApplication/mailApplication.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/faxAccount/faxAccount.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0xf')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/faxInteraction/faxInteraction.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/faxMessage/faxMessage.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x10')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x11')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x12')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x13')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/smsMessage/smsMessage.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x14')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x15')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x16')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x17')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x18')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x19')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1a')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1b')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1c')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/cmHopper/cmHopper.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1d')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1e')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x1f')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x20')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x21')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x22')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/trigger/trigger.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x23')));_0x3f02f2=_['merge'](_0x3f02f2,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x24')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x25')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x26')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x27')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x28')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x29')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x2a')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x2b')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x2c')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x2d')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x2e')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x2f')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x30')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x31')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x32')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require('../api/attachment/attachment.rpc'));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x33')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x34')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x35')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x36')));_0x3f02f2=_['merge'](_0x3f02f2,require(_0x1bf8('0x37')));_0x3f02f2=_[_0x1bf8('0x5')](_0x3f02f2,require(_0x1bf8('0x38')));var _0x56c73f=jayson['server'](_0x3f02f2)[_0x1bf8('0x39')]();var _0x2516c9=config['rpc']['port']||config['port']+0x1;var _0x7a95a8=config[_0x1bf8('0x3a')]['ip']||_0x1bf8('0x3b');_0x56c73f['on'](_0x1bf8('0x3c'),function(_0x202067){return _0x39f19e(_0x202067);});_0x56c73f['listen'](_0x2516c9,_0x7a95a8,function(){console[_0x1bf8('0x3d')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x7a95a8,_0x2516c9);require(_0x1bf8('0x3e'))[_0x1bf8('0x3f')]();return _0x3398b3(_0x1bf8('0x40')+_0x7a95a8+':'+_0x2516c9);});});}; \ No newline at end of file +var _0x254d=['default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.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','rpc','port','localhost','log','../config/triggers'];(function(_0x4a4843,_0xc50562){var _0x53a3e8=function(_0x17de51){while(--_0x17de51){_0x4a4843['push'](_0x4a4843['shift']());}};_0x53a3e8(++_0xc50562);}(_0x254d,0x174));var _0xd254=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x254d[_0x12b683];return _0xfb150b;};'use strict';var jayson=require(_0xd254('0x0'));var BPromise=require(_0xd254('0x1'));var _=require('lodash');var config=require(_0xd254('0x2'));exports[_0xd254('0x3')]=function(){return new BPromise(function(_0x49dc80,_0x5267e2){var _0x43569c={};_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x5')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x6')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/voiceQueue/voiceQueue.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x7')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x8')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x9')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xa')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0xb')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xc')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xd')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xe')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0xf')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x10')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/mailQueue/mailQueue.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x11')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x12')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x13')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x14')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x15')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x16')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/faxInteraction/faxInteraction.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x17')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x18')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x19')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1a')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1b')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/smsMessage/smsMessage.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1c')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1d')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x1e')));_0x43569c=_['merge'](_0x43569c,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x1f')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x20')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/chatMessage/chatMessage.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x21')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x22')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/cmHopper/cmHopper.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x23')));_0x43569c=_['merge'](_0x43569c,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x24')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x25')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x26')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x27')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/sound/sound.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x28')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x29')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/variable/variable.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2a')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2b')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2c')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2d')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2e')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x2f')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x30')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x31')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x32')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x33')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x34')));_0x43569c=_['merge'](_0x43569c,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x35')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x36')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x37')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x38')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x39')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3a')));_0x43569c=_['merge'](_0x43569c,require(_0xd254('0x3b')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3c')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3d')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3e')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x3f')));_0x43569c=_[_0xd254('0x4')](_0x43569c,require(_0xd254('0x40')));var _0x2372a5=jayson[_0xd254('0x41')](_0x43569c)[_0xd254('0x42')]();var _0x37166a=config[_0xd254('0x43')][_0xd254('0x44')]||config['port']+0x1;var _0x797485=config[_0xd254('0x43')]['ip']||_0xd254('0x45');_0x2372a5['on']('error',function(_0x462be5){return _0x5267e2(_0x462be5);});_0x2372a5[_0xd254('0x3')](_0x37166a,_0x797485,function(){console[_0xd254('0x46')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x797485,_0x37166a);require(_0xd254('0x47'))[_0xd254('0x48')]();return _0x49dc80(_0xd254('0x49')+_0x797485+':'+_0x37166a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index bf1b0e3..15c3b91 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 _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','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','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x2407f7,_0x196839){var _0xc02d7c=function(_0x209d8c){while(--_0x209d8c){_0x2407f7['push'](_0x2407f7['shift']());}};_0xc02d7c(++_0x196839);}(_0xe706,0xa3));var _0x6e70=function(_0x5d1df9,_0x4a95bf){_0x5d1df9=_0x5d1df9-0x0;var _0x5d4feb=_0xe706[_0x5d1df9];return _0x5d4feb;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file +var _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 79b7a4b..7f4488d 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 _0x3512=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x537cf0,_0x35a2c8){var _0x326259=function(_0x614ea7){while(--_0x614ea7){_0x537cf0['push'](_0x537cf0['shift']());}};_0x326259(++_0x35a2c8);}(_0x3512,0x13b));var _0x2351=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3512[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x2351('0x0'),'E_AGI_ARGUMENT_PORT':_0x2351('0x1'),'E_AGI_SERVER_ERROR':_0x2351('0x2'),'E_AGI_SERVER_CLOSE':_0x2351('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x2351('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x2351('0x5'),'E_AGI_SOCKET_ERROR':_0x2351('0x6'),'E_AGI_SOCKET_CLOSE':_0x2351('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x2351('0x8'),'E_AGI_COMMAND_EMPTY':_0x2351('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2351('0xa')};function AGIError(_0x24ef90){var _0x24ef90=_0x24ef90||null,_0x34929f=_0x34929f||[],_0x1a809f=0x1,_0x5142f1='';if(!error[_0x24ef90]){_0x24ef90=_0x2351('0xb');}_0x34929f['push'](error[_0x24ef90]);while(arguments[_0x1a809f]){_0x34929f['push'](arguments[_0x1a809f]);_0x1a809f++;}_0x5142f1=util[_0x2351('0xc')][_0x2351('0xd')](util,_0x34929f);this[_0x2351('0xe')]=_0x5142f1;this[_0x2351('0xf')]=_0x24ef90;}module[_0x2351('0x10')]=AGIError; \ No newline at end of file +var _0xb332=['Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x26dfc3,_0x3f2ead){var _0x692db6=function(_0x11ee82){while(--_0x11ee82){_0x26dfc3['push'](_0x26dfc3['shift']());}};_0x692db6(++_0x3f2ead);}(_0xb332,0xd9));var _0x2b33=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xb332[_0x4fbb15];return _0x436338;};'use strict';var util=require(_0x2b33('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x2b33('0x1'),'E_AGI_SERVER_ERROR':_0x2b33('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x2b33('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x2b33('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x2b33('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2b33('0x6'),'E_AGI_IVR_ENTRY':_0x2b33('0x7')};function AGIError(_0x478214){var _0x478214=_0x478214||null,_0x5a7a3f=_0x5a7a3f||[],_0x5ccf2d=0x1,_0x4302b7='';if(!error[_0x478214]){_0x478214='E_AGI_UNDEFINED';}_0x5a7a3f[_0x2b33('0x8')](error[_0x478214]);while(arguments[_0x5ccf2d]){_0x5a7a3f[_0x2b33('0x8')](arguments[_0x5ccf2d]);_0x5ccf2d++;}_0x4302b7=util[_0x2b33('0x9')][_0x2b33('0xa')](util,_0x5a7a3f);this['message']=_0x4302b7;this[_0x2b33('0xb')]=_0x478214;}module[_0x2b33('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index fd05c65..f7ba74e 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 _0x1339=['agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports'];(function(_0xc5bf08,_0x764034){var _0x5d664b=function(_0x5bb856){while(--_0x5bb856){_0xc5bf08['push'](_0xc5bf08['shift']());}};_0x5d664b(++_0x764034);}(_0x1339,0x1ed));var _0x9133=function(_0x2af819,_0x5dd4cd){_0x2af819=_0x2af819-0x0;var _0xd1f574=_0x1339[_0x2af819];return _0xd1f574;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x9133('0x0'));var verticesWithRetry=[_0x9133('0x1'),_0x9133('0x2'),_0x9133('0x3')];var Graph=function(){this[_0x9133('0x4')]={};this[_0x9133('0x5')]={};this[_0x9133('0x6')]=0x0;};Graph[_0x9133('0x7')]['addVertex']=function(_0x578643){this[_0x9133('0x4')][_0x578643['id']]=_0x578643;this[_0x9133('0x5')][_0x578643['id']]=[];};Graph['prototype'][_0x9133('0x8')]=function(_0x334dcd,_0x3059c4,_0x431a55){this[_0x9133('0x5')][_0x334dcd][_0x9133('0x9')]({'target':_0x3059c4,'condition':_0x431a55});this[_0x9133('0x6')]+=0x1;};Graph[_0x9133('0x7')][_0x9133('0xa')]=function(){return _[_0x9133('0xa')](this['vertices']);};Graph[_0x9133('0x7')][_0x9133('0xb')]=function(){return this[_0x9133('0x6')];};Graph[_0x9133('0x7')][_0x9133('0xc')]=function(_0x244ced){return this['vertices'][_0x244ced];};Graph[_0x9133('0x7')][_0x9133('0xd')]=function(_0x4bbfdc,_0x5283a3){if(!this[_0x9133('0x4')][_0x4bbfdc]){return logger['info'](_0x9133('0xe'));}var _0x439e1a=_0x5283a3(this[_0x9133('0x4')][_0x4bbfdc]);if(!_0x439e1a){return logger[_0x9133('0xf')](_0x9133('0x10'));}if(this[_0x9133('0x5')][_0x4bbfdc]['length']===0x0){return logger[_0x9133('0xf')](_0x9133('0x11'));}for(var _0x4f4f14=0x0,_0x28ffcb=[],_0xa46eb1=![];_0x4f4f14\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','agi','../../config/license/util','./rpc','./mailRpc','./graph','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','omit','isArray','length','source','target','addEdge','then','catch','createSquareReport','indexOf','agi_','substring','[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','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x56a4,0x11b));var _0x456a=function(_0xee40b0,_0x1270b8){_0xee40b0=_0xee40b0-0x0;var _0x55e4c1=_0x56a4[_0xee40b0];return _0x55e4c1;};'use strict';var parser=require(_0x456a('0x0'));var _=require(_0x456a('0x1'));var syncho=require('syncho');var util=require(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x456a('0x4'));var utilLicense=require(_0x456a('0x5'));var rpc=require(_0x456a('0x6'));var mailRpc=require(_0x456a('0x7'));var Graph=require(_0x456a('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x456a('0x4')]=_['defaults'](config['agi'],{'ip':_0x456a('0x9'),'port':0x11dd});function connectionHandler(_0x20c8e0){process[_0x456a('0xa')](function(){syncho(function(){try{setChannelVariables(_0x20c8e0);agiHandler(_0x20c8e0);}catch(_0x4c4e05){logger[_0x456a('0xb')](_0x4c4e05['stack']);}});});}function listeningHandler(){console[_0x456a('0xc')](_0x456a('0xd'),config[_0x456a('0x4')][_0x456a('0xe')]);logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x11'),config[_0x456a('0x4')]['ip'],config[_0x456a('0x4')][_0x456a('0xe')]));}function errorHandler(_0x274ee0){if(_0x274ee0&&_0x274ee0['name']&&_0x274ee0[_0x456a('0x12')]){logger['error'](util['format'](_0x456a('0x13'),_0x274ee0[_0x456a('0x14')],_0x274ee0[_0x456a('0x12')]));}else{logger[_0x456a('0xb')](util['format'](_0x456a('0x15'),_0x274ee0[_0x456a('0x16')]));}}function closeHandler(){logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x17'),this[_0x456a('0x18')],this['calleridname'],this[_0x456a('0x19')],this[_0x456a('0x1a')],this[_0x456a('0x1b')]));try{createSquareReport(this);}catch(_0x1d4e7e){logger['error'](_0x1d4e7e[_0x456a('0x16')]);}}function timeoutHandler(){logger[_0x456a('0xf')](util[_0x456a('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x456a('0x18')],this['calleridname'],this['callerid'],this[_0x456a('0x1a')],this['uniqueid']));}function hangupHandler(){logger[_0x456a('0xf')](util['format'](_0x456a('0x1c'),this[_0x456a('0x18')],this['calleridname'],this['callerid'],this['dnid'],this[_0x456a('0x1b')]));this[_0x456a('0x1d')]=!![];}function getRoot(_0xb8d35c){return parser['toJson'](_0xb8d35c,{'object':!![]})[_0x456a('0x1e')]['root'];}function addVertex(_0x5aa5da,_0x59b47e,_0x47747a){_0x59b47e[_0x456a('0x1f')]=_0x47747a;if(_0x59b47e[_0x456a('0x20')]('retry')){_0x59b47e[_0x456a('0x21')]=parseInt(_0x59b47e[_0x456a('0x22')],0xa);}_0x5aa5da['addVertex'](_[_0x456a('0x23')](_0x59b47e,'mxCell'));}function initGraph(_0x493d29,_0xb15319){var _0x5441d1=new Graph();for(var _0x3ec309 in _0x493d29){if(_0x493d29['hasOwnProperty'](_0x3ec309)){if(_[_0x456a('0x24')](_0x493d29[_0x3ec309])){for(var _0x3f312f=0x0;_0x3f312f<_0x493d29[_0x3ec309][_0x456a('0x25')];_0x3f312f+=0x1){addVertex(_0x5441d1,_0x493d29[_0x3ec309][_0x3f312f],_0x3ec309);}}else{addVertex(_0x5441d1,_0x493d29[_0x3ec309],_0x3ec309);}}}for(var _0x2e8005=0x0;_0x2e8005<_0xb15319[_0x456a('0x25')];_0x2e8005+=0x1){if(_0xb15319[_0x2e8005][_0x456a('0x26')]&&_0xb15319[_0x2e8005][_0x456a('0x27')]){_0x5441d1[_0x456a('0x28')](_0xb15319[_0x2e8005]['source'],_0xb15319[_0x2e8005]['target'],_0xb15319[_0x2e8005]['value']);}}return _0x5441d1;}function getSquareProject(_0x38912b,_0x1d7794){rpc['getSquareProject'](_0x38912b)[_0x456a('0x29')](function(_0x374149){_0x1d7794(null,_0x374149);})[_0x456a('0x2a')](function(_0x336993){_0x1d7794(null,_0x336993);});}function createSquareReport(_0x257d18,_0x5db45b){rpc[_0x456a('0x2b')](_0x257d18)[_0x456a('0x29')](function(_0x546513){if(_0x5db45b){_0x5db45b(null,_0x546513);}})['catch'](function(_0x2f5088){if(_0x5db45b){_0x5db45b(null,_0x2f5088);}});}function setChannelVariables(_0x342c76){for(var _0x4f4693 in _0x342c76){if(_0x342c76[_0x456a('0x20')](_0x4f4693)){if(_0x4f4693[_0x456a('0x2c')](_0x456a('0x2d'))===0x0){_0x342c76[_0x4f4693[_0x456a('0x2e')](0x4)]=_0x342c76[_0x4f4693];delete _0x342c76[_0x4f4693];}}}}function getLogFromObject(_0x3e5e59){return util['inspect'](_0x3e5e59,{'showHidden':![],'depth':null});}function agiHandler(_0x37fe88){var _0x2ef52e,_0xd78121,_0x4820f7,_0x5a88ba,_0x44359f;logger['debug']('variables',JSON['stringify'](_0x37fe88,null,0x2));logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x2f'),_0x37fe88[_0x456a('0x18')],_0x37fe88['calleridname'],_0x37fe88[_0x456a('0x19')],_0x37fe88[_0x456a('0x1a')],_0x37fe88['uniqueid']));_0x37fe88['on'](_0x456a('0xb'),errorHandler);_0x37fe88['on'](_0x456a('0x30'),closeHandler);_0x37fe88['on'](_0x456a('0x31'),timeoutHandler);_0x37fe88[_0x456a('0x1d')]=![];_0x37fe88['on'](_0x456a('0x32'),hangupHandler);var _0x5113da=getSquareProject[_0x456a('0x33')](null,_0x37fe88[_0x456a('0x18')]);if(_0x5113da){if(_0x5113da['production']){_0x2ef52e=getRoot(_0x5113da[_0x456a('0x34')]);if(_0x2ef52e&&_0x2ef52e[_0x456a('0x35')]){logger[_0x456a('0x36')](_0x456a('0x37'),JSON[_0x456a('0x38')](_0x2ef52e,null,0x2));_0x37fe88[_0x456a('0x39')]=moment()[_0x456a('0x10')](_0x456a('0x3a'));_0xd78121=initGraph(_['omit'](_0x2ef52e,_0x456a('0x3b')),_0x2ef52e[_0x456a('0x3b')]);_0x4820f7=new Vertices(_0x37fe88,rpc,mailRpc);logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x3c'),_0x37fe88['arg_1'],_0x37fe88[_0x456a('0x3d')],_0x37fe88['callerid'],_0x37fe88[_0x456a('0x1a')],_0x37fe88[_0x456a('0x1b')]));_0xd78121['traverseBFS'](_0x2ef52e[_0x456a('0x35')]['id'],function(_0x3515f5){try{_0x3515f5=_0x4820f7[_0x456a('0x3e')](_0x3515f5);logger['debug'](_0x456a('0x3f'),JSON['stringify'](_0x3515f5,null,0x2));if(_0x3515f5['agicommand']===_0x456a('0x40')){logger['info'](_0x456a('0x41'));_0x37fe88[_0x456a('0x42')]=_0x3515f5['context']||_0x37fe88[_0x456a('0x42')];_0x37fe88[_0x456a('0x43')]=_0x3515f5[_0x456a('0x43')];_0x37fe88[_0x456a('0x44')]=_0x3515f5[_0x456a('0x44')]?_0x3515f5[_0x456a('0x44')]-0x1:0x1;return null;}else if(_0x3515f5&&_0x4820f7[_0x3515f5['agicommand']]){_0x44359f=_0x4820f7[_0x3515f5[_0x456a('0x1f')]](_0x3515f5);logger['info'](_0x456a('0x45'),JSON[_0x456a('0x38')](_0x44359f,null,0x2));if(_0x44359f&&_0x44359f[_0x456a('0x46')]===AGI_CODE_SUCCESS&&_0x44359f[_0x456a('0x47')]!==AGI_RESULT_ERROR&&!_0x37fe88[_0x456a('0x1d')]){logger['debug'](_0x456a('0x45'),getLogFromObject(_0x44359f));return _[_0x456a('0x48')](_0x44359f[_0x456a('0x47')])?null:_0x44359f[_0x456a('0x47')][_0x456a('0x49')]();}else{logger[_0x456a('0xb')](_0x456a('0x45'),getLogFromObject(_0x44359f));return null;}}else{logger['error'](_0x456a('0x4a'));return null;}}catch(_0x28eff9){logger[_0x456a('0xb')](_0x28eff9[_0x456a('0x16')]);return null;}});if(_0x2ef52e[_0x456a('0x4b')]){logger['info'](util[_0x456a('0x10')](_0x456a('0x4c'),_0x37fe88['arg_1'],_0x37fe88['calleridname'],_0x37fe88[_0x456a('0x19')],_0x37fe88['dnid'],_0x37fe88[_0x456a('0x1b')]));_0xd78121['traverseBFS'](_0x2ef52e[_0x456a('0x4b')]['id'],function(_0x17228a){try{_0x17228a=_0x4820f7['clear'](_0x17228a);logger['debug']('vertex',JSON[_0x456a('0x38')](_0x17228a,null,0x2));if(_0x17228a&&_0x4820f7[_0x17228a[_0x456a('0x1f')]]){_0x44359f=_0x4820f7[_0x17228a['agicommand']](_0x17228a);if(_0x44359f){logger['debug'](_0x456a('0x45'),getLogFromObject(_0x44359f));return _['isUndefined'](_0x44359f[_0x456a('0x47')])?null:_0x44359f[_0x456a('0x47')][_0x456a('0x49')]();}else{logger['error']('response',getLogFromObject(_0x44359f));return null;}}else{logger['error'](_0x456a('0x4a'));return null;}}catch(_0x211e91){logger[_0x456a('0xb')](_0x211e91['stack']);return null;}});}logger[_0x456a('0xf')](util[_0x456a('0x10')](_0x456a('0x4d'),_0x37fe88[_0x456a('0x18')],_0x37fe88[_0x456a('0x3d')],_0x37fe88[_0x456a('0x19')],_0x37fe88[_0x456a('0x1a')],_0x37fe88[_0x456a('0x1b')]));logger['info'](util[_0x456a('0x10')](_0x456a('0x4e'),_0x37fe88['context'],_0x37fe88[_0x456a('0x43')],parseInt(_0x37fe88[_0x456a('0x44')],0xa)+0x1));_0x37fe88['continueAt'](_0x37fe88[_0x456a('0x42')],_0x37fe88[_0x456a('0x43')],parseInt(_0x37fe88['priority'],0xa)+0x1);_0x37fe88[_0x456a('0x30')]();}}else{logger[_0x456a('0xb')](util[_0x456a('0x10')](_0x456a('0x4f'),_0x37fe88['arg_1']));_0x37fe88['continueAt'](_0x37fe88[_0x456a('0x42')],_0x37fe88['extension'],parseInt(_0x37fe88[_0x456a('0x44')],0xa)+0x1);_0x37fe88[_0x456a('0x30')]();}}else{logger['error'](util['format'](_0x456a('0x50'),_0x37fe88[_0x456a('0x18')]));_0x37fe88['continueAt'](_0x37fe88[_0x456a('0x42')],_0x37fe88[_0x456a('0x43')],parseInt(_0x37fe88[_0x456a('0x44')],0xa)+0x1);_0x37fe88[_0x456a('0x30')]();}}function main(){var _0x101bc6;return utilLicense[_0x456a('0x51')]()[_0x456a('0x29')](function(_0x5d4f6a){if(_0x5d4f6a){if(_0x5d4f6a[_0x456a('0x52')]){if(_0x5d4f6a[_0x456a('0x53')]&&_0x5d4f6a['callysquare']>0x0){logger['info'](util['format'](_0x456a('0x54'),_0x5d4f6a[_0x456a('0x53')]));_0x101bc6=_0x5d4f6a[_0x456a('0x53')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x456a('0xf')](_0x456a('0x55'));_0x101bc6=-0x1;}}})['catch'](function(_0x560d02){logger[_0x456a('0xb')](_0x456a('0x56'),_0x560d02['stack']);})[_0x456a('0x4b')](function(){var _0xa819a4=require(_0x456a('0x57'))(config['agi'][_0x456a('0xe')],config[_0x456a('0x4')]['ip'],_0x101bc6);_0xa819a4['on'](_0x456a('0xb'),errorHandler);_0xa819a4['on'](_0x456a('0x58'),listeningHandler);_0xa819a4['on'](_0x456a('0x59'),connectionHandler);_0xa819a4['on'](_0x456a('0x30'),closeHandler);});}main(); \ No newline at end of file +var _0xf873=['agi','../../config/license/util','./rpc','./graph','./vertices','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','context','extension','priority','response','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','then','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xf873,0xb2));var _0x3f87=function(_0x490759,_0x514839){_0x490759=_0x490759-0x0;var _0x2b4b41=_0xf873[_0x490759];return _0x2b4b41;};'use strict';var parser=require('xml2json');var _=require(_0x3f87('0x0'));var syncho=require(_0x3f87('0x1'));var util=require(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var config=require(_0x3f87('0x4'));var logger=require(_0x3f87('0x5'))(_0x3f87('0x6'));var utilLicense=require(_0x3f87('0x7'));var rpc=require(_0x3f87('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x3f87('0x9'));var Vertices=require(_0x3f87('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x3f87('0x6')]=_['defaults'](config[_0x3f87('0x6')],{'ip':_0x3f87('0xb'),'port':0x11dd});function connectionHandler(_0x3b8e92){process[_0x3f87('0xc')](function(){syncho(function(){try{setChannelVariables(_0x3b8e92);agiHandler(_0x3b8e92);}catch(_0xd9391d){logger[_0x3f87('0xd')](_0xd9391d['stack']);}});});}function listeningHandler(){console[_0x3f87('0xe')](_0x3f87('0xf'),config[_0x3f87('0x6')][_0x3f87('0x10')]);logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x13'),config[_0x3f87('0x6')]['ip'],config[_0x3f87('0x6')][_0x3f87('0x10')]));}function errorHandler(_0x42fde8){if(_0x42fde8&&_0x42fde8[_0x3f87('0x14')]&&_0x42fde8[_0x3f87('0x15')]){logger[_0x3f87('0xd')](util['format'](_0x3f87('0x16'),_0x42fde8[_0x3f87('0x14')],_0x42fde8['message']));}else{logger[_0x3f87('0xd')](util[_0x3f87('0x12')](_0x3f87('0x17'),_0x42fde8[_0x3f87('0x18')]));}}function closeHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x19'),this[_0x3f87('0x1a')],this['calleridname'],this[_0x3f87('0x1b')],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));try{createSquareReport(this);}catch(_0x4e1df8){logger[_0x3f87('0xd')](_0x4e1df8['stack']);}}function timeoutHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x1e'),this[_0x3f87('0x1a')],this[_0x3f87('0x1f')],this['callerid'],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));}function hangupHandler(){logger[_0x3f87('0x11')](util[_0x3f87('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x3f87('0x1b')],this[_0x3f87('0x1c')],this[_0x3f87('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x17e411){return parser[_0x3f87('0x20')](_0x17e411,{'object':!![]})[_0x3f87('0x21')][_0x3f87('0x22')];}function addVertex(_0x15fad7,_0x46d773,_0x30b061){_0x46d773[_0x3f87('0x23')]=_0x30b061;if(_0x46d773[_0x3f87('0x24')](_0x3f87('0x25'))){_0x46d773[_0x3f87('0x26')]=parseInt(_0x46d773[_0x3f87('0x25')],0xa);}_0x15fad7['addVertex'](_[_0x3f87('0x27')](_0x46d773,_0x3f87('0x28')));}function initGraph(_0x3636b8,_0x5922e9){var _0x49674f=new Graph();for(var _0x41f9e9 in _0x3636b8){if(_0x3636b8[_0x3f87('0x24')](_0x41f9e9)){if(_[_0x3f87('0x29')](_0x3636b8[_0x41f9e9])){for(var _0x15e731=0x0;_0x15e731<_0x3636b8[_0x41f9e9][_0x3f87('0x2a')];_0x15e731+=0x1){addVertex(_0x49674f,_0x3636b8[_0x41f9e9][_0x15e731],_0x41f9e9);}}else{addVertex(_0x49674f,_0x3636b8[_0x41f9e9],_0x41f9e9);}}}for(var _0x148d8e=0x0;_0x148d8e<_0x5922e9[_0x3f87('0x2a')];_0x148d8e+=0x1){if(_0x5922e9[_0x148d8e][_0x3f87('0x2b')]&&_0x5922e9[_0x148d8e][_0x3f87('0x2c')]){_0x49674f[_0x3f87('0x2d')](_0x5922e9[_0x148d8e][_0x3f87('0x2b')],_0x5922e9[_0x148d8e][_0x3f87('0x2c')],_0x5922e9[_0x148d8e][_0x3f87('0x2e')]);}}return _0x49674f;}function getSquareProject(_0x241d88,_0x27f173){rpc[_0x3f87('0x2f')](_0x241d88)['then'](function(_0x150dbb){_0x27f173(null,_0x150dbb);})[_0x3f87('0x30')](function(_0x2546d2){_0x27f173(null,_0x2546d2);});}function createSquareReport(_0x2f0f05,_0x5495ed){rpc['createSquareReport'](_0x2f0f05)['then'](function(_0x221800){if(_0x5495ed){_0x5495ed(null,_0x221800);}})[_0x3f87('0x30')](function(_0x1d90d4){if(_0x5495ed){_0x5495ed(null,_0x1d90d4);}});}function setChannelVariables(_0x1d731a){for(var _0x25e332 in _0x1d731a){if(_0x1d731a['hasOwnProperty'](_0x25e332)){if(_0x25e332[_0x3f87('0x31')]('agi_')===0x0){_0x1d731a[_0x25e332[_0x3f87('0x32')](0x4)]=_0x1d731a[_0x25e332];delete _0x1d731a[_0x25e332];}}}}function getLogFromObject(_0x3ce0a5){return util[_0x3f87('0x33')](_0x3ce0a5,{'showHidden':![],'depth':null});}function agiHandler(_0xbd0201){var _0x20d9e0,_0x1ffcbe,_0x41aa27,_0x581fa1,_0x4c9c87;logger[_0x3f87('0x34')](_0x3f87('0x35'),JSON[_0x3f87('0x36')](_0xbd0201,null,0x2));logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x37'),_0xbd0201[_0x3f87('0x1a')],_0xbd0201['calleridname'],_0xbd0201[_0x3f87('0x1b')],_0xbd0201['dnid'],_0xbd0201[_0x3f87('0x1d')]));_0xbd0201['on'](_0x3f87('0xd'),errorHandler);_0xbd0201['on'](_0x3f87('0x38'),closeHandler);_0xbd0201['on'](_0x3f87('0x39'),timeoutHandler);_0xbd0201['evtHangup']=![];_0xbd0201['on'](_0x3f87('0x3a'),hangupHandler);var _0x54fe61=getSquareProject[_0x3f87('0x3b')](null,_0xbd0201[_0x3f87('0x1a')]);if(_0x54fe61){if(_0x54fe61[_0x3f87('0x3c')]){_0x20d9e0=getRoot(_0x54fe61[_0x3f87('0x3c')]);if(_0x20d9e0&&_0x20d9e0[_0x3f87('0x3d')]){logger['debug']('root',JSON['stringify'](_0x20d9e0,null,0x2));_0xbd0201[_0x3f87('0x3e')]=moment()[_0x3f87('0x12')](_0x3f87('0x3f'));_0x1ffcbe=initGraph(_[_0x3f87('0x27')](_0x20d9e0,_0x3f87('0x28')),_0x20d9e0[_0x3f87('0x28')]);_0x41aa27=new Vertices(_0xbd0201,rpc,mailRpc);logger['info'](util[_0x3f87('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbd0201[_0x3f87('0x1a')],_0xbd0201[_0x3f87('0x1f')],_0xbd0201['callerid'],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));_0x1ffcbe[_0x3f87('0x40')](_0x20d9e0['start']['id'],function(_0x246976){try{_0x246976=_0x41aa27['clear'](_0x246976);logger['debug'](_0x3f87('0x41'),JSON[_0x3f87('0x36')](_0x246976,null,0x2));if(_0x246976[_0x3f87('0x23')]===_0x3f87('0x42')){logger[_0x3f87('0x11')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xbd0201[_0x3f87('0x43')]=_0x246976[_0x3f87('0x43')]||_0xbd0201[_0x3f87('0x43')];_0xbd0201[_0x3f87('0x44')]=_0x246976['extension'];_0xbd0201[_0x3f87('0x45')]=_0x246976[_0x3f87('0x45')]?_0x246976[_0x3f87('0x45')]-0x1:0x1;return null;}else if(_0x246976&&_0x41aa27[_0x246976[_0x3f87('0x23')]]){_0x4c9c87=_0x41aa27[_0x246976[_0x3f87('0x23')]](_0x246976);logger[_0x3f87('0x11')](_0x3f87('0x46'),JSON[_0x3f87('0x36')](_0x4c9c87,null,0x2));if(_0x4c9c87&&_0x4c9c87['code']===AGI_CODE_SUCCESS&&_0x4c9c87['result']!==AGI_RESULT_ERROR&&!_0xbd0201[_0x3f87('0x47')]){logger[_0x3f87('0x34')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return _[_0x3f87('0x48')](_0x4c9c87[_0x3f87('0x49')])?null:_0x4c9c87[_0x3f87('0x49')][_0x3f87('0x4a')]();}else{logger[_0x3f87('0xd')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return null;}}else{logger[_0x3f87('0xd')](_0x3f87('0x4b'));return null;}}catch(_0x4bdd49){logger[_0x3f87('0xd')](_0x4bdd49[_0x3f87('0x18')]);return null;}});if(_0x20d9e0[_0x3f87('0x4c')]){logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x4d'),_0xbd0201[_0x3f87('0x1a')],_0xbd0201[_0x3f87('0x1f')],_0xbd0201[_0x3f87('0x1b')],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));_0x1ffcbe['traverseBFS'](_0x20d9e0[_0x3f87('0x4c')]['id'],function(_0x3e447b){try{_0x3e447b=_0x41aa27[_0x3f87('0x4e')](_0x3e447b);logger['debug'](_0x3f87('0x41'),JSON[_0x3f87('0x36')](_0x3e447b,null,0x2));if(_0x3e447b&&_0x41aa27[_0x3e447b[_0x3f87('0x23')]]){_0x4c9c87=_0x41aa27[_0x3e447b[_0x3f87('0x23')]](_0x3e447b);if(_0x4c9c87){logger[_0x3f87('0x34')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return _[_0x3f87('0x48')](_0x4c9c87['result'])?null:_0x4c9c87[_0x3f87('0x49')][_0x3f87('0x4a')]();}else{logger[_0x3f87('0xd')](_0x3f87('0x46'),getLogFromObject(_0x4c9c87));return null;}}else{logger[_0x3f87('0xd')](_0x3f87('0x4b'));return null;}}catch(_0x227a42){logger[_0x3f87('0xd')](_0x227a42[_0x3f87('0x18')]);return null;}});}logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x4f'),_0xbd0201['arg_1'],_0xbd0201[_0x3f87('0x1f')],_0xbd0201['callerid'],_0xbd0201[_0x3f87('0x1c')],_0xbd0201[_0x3f87('0x1d')]));logger[_0x3f87('0x11')](util[_0x3f87('0x12')](_0x3f87('0x50'),_0xbd0201[_0x3f87('0x43')],_0xbd0201['extension'],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1));_0xbd0201[_0x3f87('0x51')](_0xbd0201[_0x3f87('0x43')],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}else{logger[_0x3f87('0xd')](util[_0x3f87('0x12')](_0x3f87('0x52'),_0xbd0201[_0x3f87('0x1a')]));_0xbd0201[_0x3f87('0x51')](_0xbd0201[_0x3f87('0x43')],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}else{logger[_0x3f87('0xd')](util['format']('Project\x20%s\x20not\x20found',_0xbd0201['arg_1']));_0xbd0201[_0x3f87('0x51')](_0xbd0201['context'],_0xbd0201[_0x3f87('0x44')],parseInt(_0xbd0201[_0x3f87('0x45')],0xa)+0x1);_0xbd0201[_0x3f87('0x38')]();}}function main(){var _0xb2499f;return utilLicense['getLicense']()[_0x3f87('0x53')](function(_0x2265a8){if(_0x2265a8){if(_0x2265a8[_0x3f87('0x54')]){if(_0x2265a8['callysquare']&&_0x2265a8['callysquare']>0x0){logger['info'](util[_0x3f87('0x12')](_0x3f87('0x55'),_0x2265a8['callysquare']));_0xb2499f=_0x2265a8[_0x3f87('0x56')];}else{logger[_0x3f87('0x11')](_0x3f87('0x57'));}}else{logger[_0x3f87('0x11')](_0x3f87('0x58'));_0xb2499f=-0x1;}}})[_0x3f87('0x30')](function(_0x3c84c5){logger[_0x3f87('0xd')](_0x3f87('0x59'),_0x3c84c5[_0x3f87('0x18')]);})[_0x3f87('0x4c')](function(){var _0x1b3ad3=require('./server')(config[_0x3f87('0x6')][_0x3f87('0x10')],config[_0x3f87('0x6')]['ip'],_0xb2499f);_0x1b3ad3['on'](_0x3f87('0xd'),errorHandler);_0x1b3ad3['on'](_0x3f87('0x5a'),listeningHandler);_0x1b3ad3['on'](_0x3f87('0x5b'),connectionHandler);_0x1b3ad3['on'](_0x3f87('0x38'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index d9f0b11..fa3eb25 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(_0x3c9867,_0x161a43){var _0x241d3c=function(_0x17f67f){while(--_0x17f67f){_0x3c9867['push'](_0x3c9867['shift']());}};_0x241d3c(++_0x161a43);}(_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 +var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3e5e0e,_0x29cb46){var _0x33c007=function(_0x2e7c46){while(--_0x2e7c46){_0x3e5e0e['push'](_0x3e5e0e['shift']());}};_0x33c007(++_0x29cb46);}(_0x34e8,0x12c));var _0x834e=function(_0x298cc6,_0x32f283){_0x298cc6=_0x298cc6-0x0;var _0x338ccf=_0x34e8[_0x298cc6];return _0x338ccf;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 5e51df6..8398023 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x5f2f,0x73));var _0xf5f2=function(_0xad7427,_0x317c2f){_0xad7427=_0xad7427-0x0;var _0xae9b8c=_0x5f2f[_0xad7427];return _0xae9b8c;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x13ee16,_0x9b0374){var _0x48a844=function(_0x10bc0e){while(--_0x10bc0e){_0x13ee16['push'](_0x13ee16['shift']());}};_0x48a844(++_0x9b0374);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c2cad,_0x34d3d7){_0x2c2cad=_0x2c2cad-0x0;var _0xc80aae=_0x5f2f[_0x2c2cad];return _0xc80aae;};'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 8d644f3..7268184 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 _0x0965=['Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','then','message','result','catch','getSquareProject','production','getMailAccountById','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById'];(function(_0x23f126,_0x4f9eb8){var _0x3cecdb=function(_0xdbf936){while(--_0xdbf936){_0x23f126['push'](_0x23f126['shift']());}};_0x3cecdb(++_0x4f9eb8);}(_0x0965,0x138));var _0x5096=function(_0x2b9f71,_0x6b9330){_0x2b9f71=_0x2b9f71-0x0;var _0x15fdda=_0x0965[_0x2b9f71];return _0x15fdda;};'use strict';var BPromise=require(_0x5096('0x0'));var moment=require(_0x5096('0x1'));var _=require('lodash');var util=require(_0x5096('0x2'));var jayson=require(_0x5096('0x3'));var client=jayson[_0x5096('0x4')][_0x5096('0x5')]({'port':0x2329});function request(_0x1e9e34,_0x2ed206){return new BPromise(function(_0x17a996,_0x2c39cf){return client['request'](_0x1e9e34,_0x2ed206)[_0x5096('0x6')](function(_0x4a1f97){if(_0x4a1f97['error']){return _0x2c39cf(_0x4a1f97['error'][_0x5096('0x7')]);}else{return _0x17a996(_0x4a1f97[_0x5096('0x8')]);}})[_0x5096('0x9')](function(_0x19cbcd){return _0x2c39cf(_0x19cbcd);});});}exports[_0x5096('0xa')]=function(_0x5cad92){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5cad92},'attributes':[_0x5096('0xb')]}});};exports[_0x5096('0xc')]=function(_0x4fbc1c){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4fbc1c},'include':[{'model':'MailServerOut','as':_0x5096('0xd')}],'attributes':['id',_0x5096('0xe'),_0x5096('0xf')]}});};exports['getSquareProjectById']=function(_0x38576d){return request(_0x5096('0x10'),{'options':{'where':{'id':_0x38576d},'attributes':['name']}});};exports[_0x5096('0x11')]=function(_0x18978c){return request(_0x5096('0x12'),{'options':{'where':{'id':_0x18978c},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x13')]=function(_0x178b4e){return request(_0x5096('0x14'),{'options':{'where':{'id':_0x178b4e},'attributes':['name']}});};exports[_0x5096('0x15')]=function(_0x3b31f1){return request(_0x5096('0x16'),{'options':{'where':{'id':_0x3b31f1},'attributes':[_0x5096('0x17')]}});};exports[_0x5096('0x18')]=function(_0x1dc217){return request('ShowUser',{'options':{'where':{'id':_0x1dc217},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x19')]=function(_0x3cb333){return request('ShowTrunk',{'options':{'where':{'id':_0x3cb333},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x1a')]=function(_0x427729){return request(_0x5096('0x1b'),{'options':{'where':{'id':_0x427729},'attributes':[_0x5096('0x1c')]}});};exports[_0x5096('0x1d')]=function(_0x158ab7){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x158ab7},'include':[{'model':'Interval','as':_0x5096('0x1e')}]}});};exports['getSmsAccountById']=function(_0x4561f0){return request(_0x5096('0x1f'),{'options':{'where':{'id':_0x4561f0},'attributes':['id','name']}});};exports[_0x5096('0x20')]=function(_0xb919e1){return request(_0x5096('0x21'),{'body':_0xb919e1});};exports[_0x5096('0x22')]=function(_0x20b617){return request(_0x5096('0x23'),{'body':_0x20b617});};exports[_0x5096('0x24')]=function(_0x57c177){return request(_0x5096('0x25'),{'body':_[_0x5096('0x26')](_0x57c177,{'project_name':_0x57c177[_0x5096('0x27')],'prev_project_name':_0x57c177[_0x5096('0x28')]||'','is_subproject':_0x57c177[_0x5096('0x28')]?!![]:![],'leaveAt':moment()[_0x5096('0x29')](_0x5096('0x2a'))})});};exports[_0x5096('0x2b')]=function(_0x5c4f7c){return request(_0x5096('0x2c'),{'body':_0x5c4f7c});};exports[_0x5096('0x2d')]=function(_0x1462eb){return request(_0x5096('0x2e'),{'body':_0x1462eb});};exports['createCmContact']=function(_0x4ceea1){return request(_0x5096('0x2f'),{'options':{'raw':![],'where':{'phone':_0x4ceea1[_0x5096('0x30')],'ListId':_0x4ceea1[_0x5096('0x31')]}}})['then'](function(_0xfc76f1){if(_0xfc76f1){return _0xfc76f1;}return request(_0x5096('0x32'),{'body':_0x4ceea1});});};exports[_0x5096('0x33')]=function(_0x2f9552){return request(_0x5096('0x34'),{'options':{'where':{'id':_0x2f9552},'attributes':[_0x5096('0xe')]}});};exports[_0x5096('0x35')]=function(_0x282e8d,_0x35455b){return request('LoginUser',{'body':{'interface':_0x35455b},'options':{'where':_0x282e8d}});};exports[_0x5096('0x36')]=function(_0x4679c2,_0xd4f3f7,_0xb54e7f){return request('PauseUser',{'body':{'type':_0xd4f3f7,'uniqueid':_0xb54e7f},'options':{'where':_0x4679c2}});};exports['agentUnpause']=function(_0x441c6d){return request('UnpauseUser',{'body':{},'options':{'where':_0x441c6d}});};exports[_0x5096('0x37')]=function(_0x21a270){return request(_0x5096('0x38'),{'body':{},'options':{'where':_0x21a270}});}; \ No newline at end of file +var _0x4849=['getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','client','http','request','then','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval'];(function(_0x1d98a3,_0x28e1b8){var _0x4b8246=function(_0x45e768){while(--_0x45e768){_0x1d98a3['push'](_0x1d98a3['shift']());}};_0x4b8246(++_0x28e1b8);}(_0x4849,0xf8));var _0x9484=function(_0x30c80b,_0x42f265){_0x30c80b=_0x30c80b-0x0;var _0x2ffc2c=_0x4849[_0x30c80b];return _0x2ffc2c;};'use strict';var BPromise=require(_0x9484('0x0'));var moment=require(_0x9484('0x1'));var _=require(_0x9484('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x9484('0x3')][_0x9484('0x4')]({'port':0x2329});function request(_0x1faed2,_0x4458a0){return new BPromise(function(_0x268776,_0x9b167e){return client[_0x9484('0x5')](_0x1faed2,_0x4458a0)[_0x9484('0x6')](function(_0xc4337e){if(_0xc4337e['error']){return _0x9b167e(_0xc4337e['error'][_0x9484('0x7')]);}else{return _0x268776(_0xc4337e['result']);}})[_0x9484('0x8')](function(_0xa69d1a){return _0x9b167e(_0xa69d1a);});});}exports[_0x9484('0x9')]=function(_0xe8b216){return request(_0x9484('0xa'),{'options':{'raw':![],'where':{'name':_0xe8b216},'attributes':[_0x9484('0xb')]}});};exports[_0x9484('0xc')]=function(_0x337752){return request(_0x9484('0xd'),{'options':{'raw':![],'where':{'id':_0x337752},'include':[{'model':_0x9484('0xe'),'as':_0x9484('0xf')}],'attributes':['id',_0x9484('0x10'),_0x9484('0x11')]}});};exports[_0x9484('0x12')]=function(_0x3273a8){return request('ShowSquareProject',{'options':{'where':{'id':_0x3273a8},'attributes':[_0x9484('0x10')]}});};exports['getVoiceQueueById']=function(_0x2ec1e2){return request(_0x9484('0x13'),{'options':{'where':{'id':_0x2ec1e2},'attributes':[_0x9484('0x10')]}});};exports[_0x9484('0x14')]=function(_0x446520){return request(_0x9484('0x15'),{'options':{'where':{'id':_0x446520},'attributes':['name']}});};exports[_0x9484('0x16')]=function(_0x4485f9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4485f9},'attributes':['dsn']}});};exports[_0x9484('0x17')]=function(_0x5a58b3){return request(_0x9484('0x18'),{'options':{'where':{'id':_0x5a58b3},'attributes':['name']}});};exports[_0x9484('0x19')]=function(_0x36a439){return request(_0x9484('0x1a'),{'options':{'where':{'id':_0x36a439},'attributes':[_0x9484('0x10')]}});};exports[_0x9484('0x1b')]=function(_0x232694){return request('ShowSound',{'options':{'where':{'id':_0x232694},'attributes':[_0x9484('0x1c')]}});};exports[_0x9484('0x1d')]=function(_0x4ecfa6){return request(_0x9484('0x1e'),{'options':{'raw':![],'where':{'id':_0x4ecfa6},'include':[{'model':_0x9484('0x1f'),'as':'Intervals'}]}});};exports[_0x9484('0x20')]=function(_0x5325e6){return request(_0x9484('0x21'),{'options':{'where':{'id':_0x5325e6},'attributes':['id','name']}});};exports[_0x9484('0x22')]=function(_0x3c30ed){return request(_0x9484('0x23'),{'body':_0x3c30ed});};exports[_0x9484('0x24')]=function(_0x5edcf5){return request('CreateSquareDetailsReport',{'body':_0x5edcf5});};exports[_0x9484('0x25')]=function(_0x483a69){return request(_0x9484('0x26'),{'body':_['merge'](_0x483a69,{'project_name':_0x483a69[_0x9484('0x27')],'prev_project_name':_0x483a69[_0x9484('0x28')]||'','is_subproject':_0x483a69[_0x9484('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x9484('0x29'))})});};exports[_0x9484('0x2a')]=function(_0x2e158e){return request('CreateSquareRecording',{'body':_0x2e158e});};exports['createSquareMessage']=function(_0x4b0666){return request(_0x9484('0x2b'),{'body':_0x4b0666});};exports[_0x9484('0x2c')]=function(_0x4f76f5){return request(_0x9484('0x2d'),{'options':{'raw':![],'where':{'phone':_0x4f76f5[_0x9484('0x2e')],'ListId':_0x4f76f5[_0x9484('0x2f')]}}})['then'](function(_0x282a81){if(_0x282a81){return _0x282a81;}return request('CreateCmContact',{'body':_0x4f76f5});});};exports[_0x9484('0x30')]=function(_0x282998){return request(_0x9484('0x31'),{'options':{'where':{'id':_0x282998},'attributes':[_0x9484('0x10')]}});};exports['agentLogin']=function(_0x5312bd,_0x29654c){return request(_0x9484('0x32'),{'body':{'interface':_0x29654c},'options':{'where':_0x5312bd}});};exports['agentPause']=function(_0x868d7f,_0x27ec16,_0x2d3e4c){return request(_0x9484('0x33'),{'body':{'type':_0x27ec16,'uniqueid':_0x2d3e4c},'options':{'where':_0x868d7f}});};exports[_0x9484('0x34')]=function(_0x4b6a24){return request(_0x9484('0x35'),{'body':{},'options':{'where':_0x4b6a24}});};exports[_0x9484('0x36')]=function(_0x19b5cc){return request(_0x9484('0x37'),{'body':{},'options':{'where':_0x19b5cc}});}; \ 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 3a80342..8b5666f 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 _0xca66=['./polly'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xca66,0x8b));var _0x6ca6=function(_0x1712bf,_0x108510){_0x1712bf=_0x1712bf-0x0;var _0x36d4c4=_0xca66[_0x1712bf];return _0x36d4c4;};var polly=require(_0x6ca6('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xd3d1=['./polly','./lex'];(function(_0x5b66d9,_0x1c8ab5){var _0x2b7f3b=function(_0x5b5644){while(--_0x5b5644){_0x5b66d9['push'](_0x5b66d9['shift']());}};_0x2b7f3b(++_0x1c8ab5);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd3d1[_0x2c91e9];return _0x13f0ff;};var polly=require(_0x1d3d('0x0'));var lex=require(_0x1d3d('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 f74ede6..00557db 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 _0x4b1f=['exports','./lib/api'];(function(_0x308557,_0x5a7a36){var _0xd8d5a8=function(_0x3a4761){while(--_0x3a4761){_0x308557['push'](_0x308557['shift']());}};_0xd8d5a8(++_0x5a7a36);}(_0x4b1f,0x195));var _0xf4b1=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x4b1f[_0x500419];return _0x241c1a;};'use strict';var lex=require(_0xf4b1('0x0'));module[_0xf4b1('0x1')]=function(_0x4c24e7,_0x3012de,_0x10f8e6,_0x33af4b,_0x59d334,_0x19fb44){return lex(_0x4c24e7,_0x3012de,_0x10f8e6,_0x33af4b,_0x59d334,_0x19fb44);}; \ No newline at end of file +var _0x3299=['exports'];(function(_0x2cc26f,_0x285450){var _0x3b9350=function(_0xedfeff){while(--_0xedfeff){_0x2cc26f['push'](_0x2cc26f['shift']());}};_0x3b9350(++_0x285450);}(_0x3299,0x1bc));var _0x9329=function(_0x54455a,_0x499e2f){_0x54455a=_0x54455a-0x0;var _0x599708=_0x3299[_0x54455a];return _0x599708;};'use strict';var lex=require('./lib/api');module[_0x9329('0x0')]=function(_0x280821,_0x221247,_0x221532,_0x253fb,_0x6ebea4,_0x2a092c){return lex(_0x280821,_0x221247,_0x221532,_0x253fb,_0x6ebea4,_0x2a092c);}; \ 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 3c02830..f9c93e4 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 _0xcb48=['slots','hasOwnProperty','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0xcb48,0x1b5));var _0x8cb4=function(_0xcd086b,_0x51cc16){_0xcd086b=_0xcd086b-0x0;var _0x400b95=_0xcb48[_0xcd086b];return _0x400b95;};'use strict';var BPromise=require(_0x8cb4('0x0'));var AWS=require(_0x8cb4('0x1'));function lexResult(_0x5be12c,_0x248352){return new BPromise(function(_0x5517f9,_0x44afe3){_0x5be12c[_0x8cb4('0x2')](_0x248352,function(_0x48a967,_0x40a1e4){if(_0x48a967){_0x44afe3(_0x48a967);}if(_0x40a1e4['slots']){for(const _0x4868cc in _0x40a1e4[_0x8cb4('0x3')]){if(_0x40a1e4[_0x8cb4('0x3')][_0x8cb4('0x4')](_0x4868cc)){var _0x207dce=_0x40a1e4[_0x8cb4('0x3')][_0x4868cc];_0x40a1e4['slot_'+_0x4868cc]=_0x207dce;}}}_0x5517f9(_0x40a1e4);});});}module[_0x8cb4('0x5')]=function(_0x48a631,_0x156958,_0x1adf77,_0x599247,_0x146fd9,_0x271b4e){var _0x12650b=new AWS[(_0x8cb4('0x6'))]({'accessKeyId':_0x156958,'secretAccessKey':_0x1adf77,'region':_0x599247});var _0x4511ec={'botAlias':_0x8cb4('0x7'),'botName':_0x271b4e,'inputText':_0x146fd9,'userId':_0x48a631};return lexResult(_0x12650b,_0x4511ec);}; \ No newline at end of file +var _0xea81=['exports','LexRuntime','$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','slot_'];(function(_0x201613,_0x4f7f59){var _0x3e397b=function(_0x3a33c4){while(--_0x3a33c4){_0x201613['push'](_0x201613['shift']());}};_0x3e397b(++_0x4f7f59);}(_0xea81,0xc3));var _0x1ea8=function(_0x590ed3,_0x4e3dcf){_0x590ed3=_0x590ed3-0x0;var _0x474362=_0xea81[_0x590ed3];return _0x474362;};'use strict';var BPromise=require(_0x1ea8('0x0'));var AWS=require(_0x1ea8('0x1'));function lexResult(_0x54bbff,_0x2fc886){return new BPromise(function(_0x6689e9,_0x26696d){_0x54bbff['postText'](_0x2fc886,function(_0x34abaf,_0x46b246){if(_0x34abaf){_0x26696d(_0x34abaf);}if(_0x46b246[_0x1ea8('0x2')]){for(const _0x15ff43 in _0x46b246[_0x1ea8('0x2')]){if(_0x46b246[_0x1ea8('0x2')][_0x1ea8('0x3')](_0x15ff43)){var _0x22c72d=_0x46b246[_0x1ea8('0x2')][_0x15ff43];_0x46b246[_0x1ea8('0x4')+_0x15ff43]=_0x22c72d;}}}_0x6689e9(_0x46b246);});});}module[_0x1ea8('0x5')]=function(_0x10d6ce,_0x452bf0,_0x32c5e5,_0x3cdfc5,_0x33b656,_0x423399){var _0x7aa6c5=new AWS[(_0x1ea8('0x6'))]({'accessKeyId':_0x452bf0,'secretAccessKey':_0x32c5e5,'region':_0x3cdfc5});var _0x403e0b={'botAlias':_0x1ea8('0x7'),'botName':_0x423399,'inputText':_0x33b656,'userId':_0x10d6ce};return lexResult(_0x7aa6c5,_0x403e0b);}; \ 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 fb7c53e..ec6e76a 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 _0x8c32=['exports','./lib/api'];(function(_0x4bf74a,_0x3d268b){var _0x9f6c0a=function(_0x2ce75e){while(--_0x2ce75e){_0x4bf74a['push'](_0x4bf74a['shift']());}};_0x9f6c0a(++_0x3d268b);}(_0x8c32,0x89));var _0x28c3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8c32[_0x40a045];return _0x1a687c;};'use strict';var polly=require(_0x28c3('0x0'));module[_0x28c3('0x1')]=function(_0x41f3cc,_0x6f7dc9,_0x4f168a,_0x3eb33d,_0x18b898,_0x2dd640,_0x50e6be){return polly(_0x41f3cc,_0x6f7dc9,_0x4f168a,_0x3eb33d,_0x18b898,_0x2dd640,_0x50e6be);}; \ No newline at end of file +var _0x83b4=['./lib/api','exports'];(function(_0x563c9c,_0x3f4699){var _0x3af8d4=function(_0x2d8599){while(--_0x2d8599){_0x563c9c['push'](_0x563c9c['shift']());}};_0x3af8d4(++_0x3f4699);}(_0x83b4,0x94));var _0x483b=function(_0x548c4b,_0x433f8c){_0x548c4b=_0x548c4b-0x0;var _0x298d04=_0x83b4[_0x548c4b];return _0x298d04;};'use strict';var polly=require(_0x483b('0x0'));module[_0x483b('0x1')]=function(_0x1c707c,_0x1203fd,_0x30e4e1,_0x589dd6,_0x170a29,_0x1284dd,_0x515d3f){return polly(_0x1c707c,_0x1203fd,_0x30e4e1,_0x589dd6,_0x170a29,_0x1284dd,_0x515d3f);}; \ 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 bcac959..a31627c 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 _0x288e=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1f625b,_0x276b0e){var _0x748222=function(_0x324a51){while(--_0x324a51){_0x1f625b['push'](_0x1f625b['shift']());}};_0x748222(++_0x276b0e);}(_0x288e,0x12e));var _0xe288=function(_0x453a0f,_0x5a1486){_0x453a0f=_0x453a0f-0x0;var _0x2dbf32=_0x288e[_0x453a0f];return _0x2dbf32;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xe288('0x0'));var rs=require(_0xe288('0x1'));var AWS=require(_0xe288('0x2'));function pollyResult(_0x22536a,_0x3b59aa,_0x2714e8){return new BPromise(function(_0x3a61ef,_0x421907){_0x22536a[_0xe288('0x3')](_0x3b59aa,function(_0x533d36,_0xc9f8dc){if(_0x533d36){_0x421907(_0x533d36);}else if(_0xc9f8dc){if(_0xc9f8dc[_0xe288('0x4')]instanceof Buffer){fs[_0xe288('0x5')](_0x2714e8,_0xc9f8dc[_0xe288('0x4')],function(_0x2e95e9){if(_0x2e95e9){_0x421907(_0x2e95e9);}else{_0x3a61ef();}});}else{_0x421907(new Error(_0xe288('0x6')));}}else{_0x421907(new Error(_0xe288('0x7')));}});});}module[_0xe288('0x8')]=function(_0x195d7b,_0x339c4c,_0x226984,_0x33403f,_0x413afe,_0x4d2c59,_0x5739c0){var _0x32a62f=new AWS['Polly']({'accessKeyId':_0x195d7b,'secretAccessKey':_0x339c4c,'region':_0x226984});var _0xfc7a44={'Text':_0x413afe,'TextType':_0x4d2c59||_0xe288('0x9'),'OutputFormat':_0xe288('0xa'),'VoiceId':_0x33403f};return pollyResult(_0x32a62f,_0xfc7a44,_0x5739c0);}; \ No newline at end of file +var _0x3419=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','bluebird','randomstring'];(function(_0x187f0f,_0x57a37f){var _0x518ffc=function(_0xcd1b10){while(--_0xcd1b10){_0x187f0f['push'](_0x187f0f['shift']());}};_0x518ffc(++_0x57a37f);}(_0x3419,0x13e));var _0x9341=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x3419[_0xf5d71c];return _0x5af672;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9341('0x0'));var rs=require(_0x9341('0x1'));var AWS=require(_0x9341('0x2'));function pollyResult(_0x543242,_0x23559b,_0x3ee3e6){return new BPromise(function(_0x1d702d,_0x790936){_0x543242[_0x9341('0x3')](_0x23559b,function(_0x2e86e0,_0x5d8d0a){if(_0x2e86e0){_0x790936(_0x2e86e0);}else if(_0x5d8d0a){if(_0x5d8d0a['AudioStream']instanceof Buffer){fs[_0x9341('0x4')](_0x3ee3e6,_0x5d8d0a[_0x9341('0x5')],function(_0x5b11e8){if(_0x5b11e8){_0x790936(_0x5b11e8);}else{_0x1d702d();}});}else{_0x790936(new Error(_0x9341('0x6')));}}else{_0x790936(new Error(_0x9341('0x7')));}});});}module['exports']=function(_0xd70e3d,_0x33c23a,_0x47ed69,_0x19e2bc,_0x3993e1,_0xfcec64,_0xd77737){var _0x451890=new AWS[(_0x9341('0x8'))]({'accessKeyId':_0xd70e3d,'secretAccessKey':_0x33c23a,'region':_0x47ed69});var _0x431bcf={'Text':_0x3993e1,'TextType':_0xfcec64||'text','OutputFormat':_0x9341('0x9'),'VoiceId':_0x19e2bc};return pollyResult(_0x451890,_0x431bcf,_0xd77737);}; \ 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 adb2ef7..965ef2c 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 _0xc9e0=['./lib/api'];(function(_0x4a1fa5,_0x251f61){var _0x27fd7c=function(_0x2f9993){while(--_0x2f9993){_0x4a1fa5['push'](_0x4a1fa5['shift']());}};_0x27fd7c(++_0x251f61);}(_0xc9e0,0x16b));var _0x0c9e=function(_0x2bf235,_0x5b2e9b){_0x2bf235=_0x2bf235-0x0;var _0x473e39=_0xc9e0[_0x2bf235];return _0x473e39;};'use strict';var asr=require(_0x0c9e('0x0'));module['exports']=function(_0x4b46ca,_0x3f88ff,_0x8213f2,_0xe94f9f){return asr(_0x4b46ca,_0x3f88ff,_0x8213f2);}; \ No newline at end of file +var _0xa50a=['exports','./lib/api'];(function(_0x292f35,_0x72e859){var _0x288e75=function(_0x1bba68){while(--_0x1bba68){_0x292f35['push'](_0x292f35['shift']());}};_0x288e75(++_0x72e859);}(_0xa50a,0x13b));var _0xaa50=function(_0x3ae516,_0x4b97c5){_0x3ae516=_0x3ae516-0x0;var _0x2b257a=_0xa50a[_0x3ae516];return _0x2b257a;};'use strict';var asr=require(_0xaa50('0x0'));module[_0xaa50('0x1')]=function(_0x5ebea7,_0x38fd81,_0xf8f6e0,_0xb5d891){return asr(_0x5ebea7,_0x38fd81,_0xf8f6e0);}; \ 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 87e7c58..c8632b8 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 _0x7baa=['undefined','length','readFileSync','base64','POST','/v1/speech:recognize?key=','url','bluebird','string'];(function(_0x949e2e,_0x267e46){var _0x40edbb=function(_0x4d7f84){while(--_0x4d7f84){_0x949e2e['push'](_0x949e2e['shift']());}};_0x40edbb(++_0x267e46);}(_0x7baa,0x165));var _0xa7ba=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7baa[_0x138f59];return _0x3d114d;};'use strict';var url=require(_0xa7ba('0x0'));var BPromise=require(_0xa7ba('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x195c36,_0x194930,_0x39955d){return new BPromise(function(_0x2c19fe,_0x161b64){var _0x299a7a;if(typeof _0x195c36!==_0xa7ba('0x2')||_0x195c36['length']===0x0){return _0x161b64('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x194930!=='string'||_0x194930['length']===0x0){return _0x161b64('key\x20should\x20be\x20a\x20string');}if(typeof _0x39955d!==_0xa7ba('0x3')&&(typeof _0x39955d!==_0xa7ba('0x2')||_0x39955d[_0xa7ba('0x4')]===0x0)){return _0x161b64('lang\x20should\x20be\x20a\x20string');}try{_0x299a7a=fs[_0xa7ba('0x5')](_0x195c36)['toString'](_0xa7ba('0x6'));}catch(_0x546fc1){return _0x161b64(_0x546fc1);}return _0x2c19fe({'method':_0xa7ba('0x7'),'uri':host+_0xa7ba('0x8')+_0x194930,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x39955d},'audio':{'content':_0x299a7a}},'json':!![]});});}; \ No newline at end of file +var _0xed7f=['https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xed7f,0x8e));var _0xfed7=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0xed7f[_0x8fb092];return _0xd63883;};'use strict';var url=require('url');var BPromise=require(_0xfed7('0x0'));var fs=require('fs');var host=_0xfed7('0x1');module['exports']=function(_0x294b31,_0xb6bac0,_0x5a594a){return new BPromise(function(_0x386209,_0x23286b){var _0xf4941b;if(typeof _0x294b31!=='string'||_0x294b31[_0xfed7('0x2')]===0x0){return _0x23286b(_0xfed7('0x3'));}if(typeof _0xb6bac0!==_0xfed7('0x4')||_0xb6bac0[_0xfed7('0x2')]===0x0){return _0x23286b(_0xfed7('0x5'));}if(typeof _0x5a594a!=='undefined'&&(typeof _0x5a594a!==_0xfed7('0x4')||_0x5a594a[_0xfed7('0x2')]===0x0)){return _0x23286b('lang\x20should\x20be\x20a\x20string');}try{_0xf4941b=fs[_0xfed7('0x6')](_0x294b31)['toString'](_0xfed7('0x7'));}catch(_0x12effe){return _0x23286b(_0x12effe);}return _0x386209({'method':_0xfed7('0x8'),'uri':host+_0xfed7('0x9')+_0xb6bac0,'body':{'config':{'encoding':_0xfed7('0xa'),'sampleRateHertz':'8000','languageCode':_0x5a594a},'audio':{'content':_0xf4941b}},'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 b1b3168..a79d4a7 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 _0x0c45=['./asr'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0c45,0x1ec));var _0x50c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c45[_0x3dd15e];return _0x231fd0;};var asr=require(_0x50c4('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9bca=['./asr','exports'];(function(_0x489d12,_0x5baaf4){var _0x27a102=function(_0x29475c){while(--_0x29475c){_0x489d12['push'](_0x489d12['shift']());}};_0x27a102(++_0x5baaf4);}(_0x9bca,0x8c));var _0xa9bc=function(_0x798084,_0x566195){_0x798084=_0x798084-0x0;var _0x4f1484=_0x9bca[_0x798084];return _0x4f1484;};var asr=require(_0xa9bc('0x0'));module[_0xa9bc('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 cc44b29..d3aa91b 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 _0x3e3a=['?key=','input','voice','MP3','text:synthesize','POST','.mp3','from','writeFile','tmp','googleCloudTTS\x20path','googleTTS','utf8','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','en-US','null','generic','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','eval\x20RET\x20slic:','ERR','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','REPONSE2','buffer2','filepath','desdt','goggleTTS\x20path','destination\x20ended\x202\x20da\x20gen','asr','uri','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','queryResult','diagnosticInfo','fields','fulfillmentText','intent','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','path','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','request\x20to\x20','data','transcode','error\x20convert','start','resolve','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/'];(function(_0x3dadd4,_0x7d686e){var _0x170539=function(_0x4e70fd){while(--_0x4e70fd){_0x3dadd4['push'](_0x3dadd4['shift']());}};_0x170539(++_0x7d686e);}(_0x3e3a,0x17a));var _0xa3e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3e3a[_0x3bf83f];return _0x22c4a9;};'use strict';var apiai=require(_0xa3e3('0x0'));var BPromise=require(_0xa3e3('0x1'));var dialogflow=require(_0xa3e3('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xa3e3('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0xa3e3('0x4'));var rp=require(_0xa3e3('0x5'));var rs=require(_0xa3e3('0x6'));var sox=require(_0xa3e3('0x7'));var tts=require('google-tts-api');var urlParse=require(_0xa3e3('0x8'))[_0xa3e3('0x9')];var util=require(_0xa3e3('0xa'));var aws=require(_0xa3e3('0xb'));var google=require(_0xa3e3('0xc'));var sestek=require('./sestek');var tilde=require(_0xa3e3('0xd'));var logger=require(_0xa3e3('0xe'))(_0xa3e3('0xf'));var ISPEECH_API=_0xa3e3('0x10');function downloadFile(_0x321686,_0x3f9d36){return new BPromise(function(_0x1e3da8,_0x377093){var _0x59c433=urlParse(_0x321686);var _0x6c9003=_0x59c433['protocol']==='https:'?https:http;var _0x43dfb9={'host':_0x59c433[_0xa3e3('0x11')],'path':_0x59c433[_0xa3e3('0x12')],'headers':{'user-agent':_0xa3e3('0x13')}};_0x6c9003[_0xa3e3('0x14')](_0x43dfb9,function(_0x1c541d){if(_0x1c541d[_0xa3e3('0x15')]!==0xc8){logger[_0xa3e3('0x16')]('request\x20to\x20'+_0x321686+_0xa3e3('0x17')+_0x1c541d[_0xa3e3('0x15')]+'\x20('+_0x1c541d[_0xa3e3('0x18')]+')');_0x377093(new Error('request\x20to\x20'+_0x321686+_0xa3e3('0x17')+_0x1c541d[_0xa3e3('0x15')]+'\x20('+_0x1c541d[_0xa3e3('0x18')]+')'));return;}var _0x565edb=fs['createWriteStream'](_0x3f9d36);_0x565edb['on'](_0xa3e3('0x19'),function(){logger[_0xa3e3('0x1a')](_0xa3e3('0x1b'));_0x565edb[_0xa3e3('0x1c')](_0x1e3da8);});_0x565edb['on']('error',function(_0x2d1a1c){fs[_0xa3e3('0x1d')](_0x3f9d36);logger[_0xa3e3('0x16')](_0xa3e3('0x1e'),_0x2d1a1c);_0x377093(_0x2d1a1c);});_0x1c541d[_0xa3e3('0x1f')](_0x565edb);})['on'](_0xa3e3('0x16'),function(_0x347e2b){logger['error'](_0x347e2b);_0x377093(_0x347e2b);})[_0xa3e3('0x20')]();});}function uploadFile(_0x12a454){return new BPromise(function(_0x2d30cc,_0x11da93){var _0x34bf57=urlParse(_0x12a454);var _0x56e9a1=_0x34bf57['protocol']===_0xa3e3('0x21')?https:http;var _0x3c4597={'host':_0x34bf57[_0xa3e3('0x11')],'path':_0x34bf57[_0xa3e3('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x56e9a1[_0xa3e3('0x14')](_0x3c4597,function(_0x24099d){if(_0x24099d[_0xa3e3('0x15')]!==0xc8){_0x11da93(new Error(_0xa3e3('0x22')+_0x12a454+'\x20failed,\x20status\x20code\x20=\x20'+_0x24099d[_0xa3e3('0x15')]+'\x20('+_0x24099d[_0xa3e3('0x18')]+')'));return;}var _0x2ade24='';_0x24099d['on'](_0xa3e3('0x23'),function(_0x3b9d4c){_0x2ade24+=_0x3b9d4c;});_0x24099d['on'](_0xa3e3('0x20'),function(){_0x2d30cc(_0x2ade24);});})['on'](_0xa3e3('0x16'),function(_0x5b298d){_0x11da93(_0x5b298d);})[_0xa3e3('0x20')]();});}function convertFile(_0x4d5f6c,_0x2c141d){return new BPromise(function(_0x5c9ec9,_0x16ca3b){var _0x1d6559=sox[_0xa3e3('0x24')](_0x4d5f6c,_0x2c141d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d6559['on'](_0xa3e3('0x16'),function(_0x54872b){logger[_0xa3e3('0x16')](_0xa3e3('0x25'),_0x54872b);_0x16ca3b(_0x54872b);});_0x1d6559['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x5c9ec9();});_0x1d6559[_0xa3e3('0x26')]();});}function base64Decode(_0x58836e,_0x47b602){var _0x1d274a=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));fs[_0xa3e3('0x2a')](_0x1d274a,_0x58836e,'base64');return convertFile(_0x1d274a,_0x47b602)[_0xa3e3('0x2b')](function(){try{fs['unlink'](_0x1d274a);fs[_0xa3e3('0x2c')](_0x47b602,_0xa3e3('0x2d'));}catch(_0x4d58b7){logger[_0xa3e3('0x16')](_0x4d58b7);}return _0x47b602[_0xa3e3('0x2e')]('.')[0x0];});}function base64Encode(_0x4b00e4){var _0x58169c=fs[_0xa3e3('0x2f')](_0x4b00e4);return new Buffer(_0x58169c)['toString'](_0xa3e3('0x30'));}exports[_0xa3e3('0x31')]=function(_0x27e41b,_0x3d286a,_0x17dc3d,_0x419134,_0x3077af,_0x1a2ef5){var _0xcd7501,_0x234503;var _0x50c859=_0xa3e3('0x32');var _0x3902aa=_0xa3e3('0x33')+_0x27e41b;var _0x29f7ec={};if(_0x3d286a==='ssml'){_0x29f7ec['input']={'ssml':_0x17dc3d};}else{_0x29f7ec[_0xa3e3('0x34')]={'text':_0x17dc3d};};_0x29f7ec[_0xa3e3('0x35')]={'languageCode':_0x419134,'ssmlGender':_0x3077af};_0x29f7ec['audioConfig']={'audioEncoding':_0xa3e3('0x36'),'sampleRateHertz':0x1f40};var _0x457c8d={'url':_0x50c859+_0xa3e3('0x37')+_0x3902aa,'method':_0xa3e3('0x38'),'json':!![],'body':_0x29f7ec};return rp(_0x457c8d)[_0xa3e3('0x2b')](function(_0x1cae9b){return new BPromise(function(_0x15f84d,_0x4a9d8f){_0xcd7501=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x39'));var _0x2ef97b=Buffer[_0xa3e3('0x3a')](_0x1cae9b['audioContent'],_0xa3e3('0x30'));return fs[_0xa3e3('0x3b')](_0xcd7501,_0x2ef97b,function(_0x23e1f4){_0x4a9d8f(_0x23e1f4);},function(_0x7591dd){fs[_0xa3e3('0x2c')](_0xcd7501,'777');_0x15f84d(_0x7591dd);});});})[_0xa3e3('0x2b')](function(_0x1a4461){_0x234503=path['resolve'](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));return convertFile(_0xcd7501,_0x234503);})['then'](function(){try{fs[_0xa3e3('0x1d')](_0xcd7501);fs['chmodSync'](_0x234503,_0xa3e3('0x2d'));}catch(_0x1024e3){logger[_0xa3e3('0x16')](_0x1024e3);}logger[_0xa3e3('0x1a')](_0xa3e3('0x3d'),_0x234503['split']('.')[0x0]);return _0x234503[_0xa3e3('0x2e')]('.')[0x0];});};exports[_0xa3e3('0x3e')]=function(_0x5d3944,_0x3d2cd7){var _0x374578,_0x4eb5e3;var _0x3ea7cd;var _0x3c39c9={'encoding':_0xa3e3('0x3f'),'method':_0xa3e3('0x38'),'timeout':0x2710,'url':_0xa3e3('0x40'),'headers':{'Content-Type':_0xa3e3('0x41')},'body':_0xa3e3('0x42')+encodeURIComponent(JSON['stringify']([[[_0xa3e3('0x43'),JSON[_0xa3e3('0x44')]([_0x5d3944,_0x3d2cd7||_0xa3e3('0x45'),![],_0xa3e3('0x46')]),null,_0xa3e3('0x47')]]]))};console[_0xa3e3('0x48')](_0xa3e3('0x49'),_0x3c39c9);return rp(_0x3c39c9)[_0xa3e3('0x2b')](function(_0x2e64ec){console[_0xa3e3('0x48')](_0xa3e3('0x4a'),_0x2e64ec);try{console[_0xa3e3('0x48')](_0xa3e3('0x4b'),_0x2e64ec[_0xa3e3('0x4c')](0x5));console[_0xa3e3('0x48')](_0xa3e3('0x4d'),eval(_0x2e64ec[_0xa3e3('0x4c')](0x5))[0x0][0x2]);_0x3ea7cd=eval(_0x2e64ec[_0xa3e3('0x4c')](0x5))[0x0][0x2];console[_0xa3e3('0x48')]('AFTER\x20SLICE',_0x3ea7cd);}catch(_0x380dd5){console[_0xa3e3('0x48')](_0xa3e3('0x4e'),_0x380dd5);throw new Error(_0xa3e3('0x4f')+res[_0xa3e3('0x23')]);}if(!_0x3ea7cd){throw new Error(_0xa3e3('0x50')+lang+_0xa3e3('0x51'));}try{_0x3ea7cd=eval(_0x3ea7cd)[0x0];}catch(_0x45600a){throw new Error(_0xa3e3('0x4f')+res['data']);}console[_0xa3e3('0x48')](_0xa3e3('0x52'),_0x3ea7cd);const _0x1446b4=_0x3ea7cd;console[_0xa3e3('0x48')](_0xa3e3('0x53'),_0x1446b4);_0x374578=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x39'));console['log'](_0xa3e3('0x54'),_0x374578);fs[_0xa3e3('0x2a')](_0x374578,_0x3ea7cd,{'encoding':_0xa3e3('0x30')});_0x4eb5e3=path[_0xa3e3('0x27')](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));console[_0xa3e3('0x48')]('desdt',_0x4eb5e3);return convertFile(_0x374578,_0x4eb5e3);})[_0xa3e3('0x2b')](function(){try{console[_0xa3e3('0x48')](_0xa3e3('0x55'),_0x4eb5e3);fs[_0xa3e3('0x2c')](_0x4eb5e3,_0xa3e3('0x2d'));}catch(_0x30b3b8){logger['error'](_0x30b3b8);}logger[_0xa3e3('0x1a')](_0xa3e3('0x56'),_0x4eb5e3[_0xa3e3('0x2e')]('.')[0x0]);console[_0xa3e3('0x48')](_0xa3e3('0x57'),_0x4eb5e3[_0xa3e3('0x2e')]('.')[0x0]);return _0x4eb5e3[_0xa3e3('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x410507,_0x5f22a5,_0x4f6341){return google[_0xa3e3('0x58')](_0x410507,_0x5f22a5,_0x4f6341)[_0xa3e3('0x2b')](function(_0x268ee2){logger[_0xa3e3('0x1a')](_0x268ee2[_0xa3e3('0x59')]);return rp(_0x268ee2);})['then'](function(_0x350da1){var _0x5db843='';var _0x4d0f8f=0x0;try{fs[_0xa3e3('0x1d')](_0x410507);}catch(_0x471452){logger['error'](_0x471452);}if(_0x350da1&&_0x350da1['results']){_0x5db843=_0x350da1['results'][_0xa3e3('0x5a')](function(_0x32984f){return _0x32984f&&_0x32984f[_0xa3e3('0x5b')][0x0]&&_0x32984f[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5c')]?_0x32984f[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5c')]:'';})[_0xa3e3('0x5d')]('\x0a');_0x4d0f8f=_0x350da1[_0xa3e3('0x5e')][_0xa3e3('0x5a')](function(_0x44ad54){return _0x44ad54&&_0x44ad54[_0xa3e3('0x5b')][0x0]&&_0x44ad54[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5f')]?_0x44ad54[_0xa3e3('0x5b')][0x0][_0xa3e3('0x5f')]:0x0;})[_0xa3e3('0x5d')]('\x0a');}logger[_0xa3e3('0x1a')](_0xa3e3('0x60'),_0x5db843);logger[_0xa3e3('0x1a')](_0xa3e3('0x61'),_0x4d0f8f);return{'transcript':_0x5db843,'confidence':_0x4d0f8f};})[_0xa3e3('0x62')](function(_0x2cf007){logger[_0xa3e3('0x16')]('[%s]\x20%s:%s',_0x2cf007[_0xa3e3('0x15')],_0x2cf007[_0xa3e3('0x63')],_0x2cf007[_0xa3e3('0x64')]);});};exports[_0xa3e3('0x65')]=function(_0x444288,_0x46ff69,_0x39a5b7,_0x1701c7){var _0xb92a08=apiai(_0x46ff69,{'language':_0x1701c7||'en'});return _0xb92a08[_0xa3e3('0x66')](_0x39a5b7,{'sessionId':md5(_0x444288)})['then'](function(_0xce3a18){logger[_0xa3e3('0x1a')](JSON['stringify'](_0xce3a18));return{'source':_0xce3a18['result'][_0xa3e3('0x67')],'resolvedQuery':_0xce3a18[_0xa3e3('0x68')]['resolvedQuery'],'action':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x69')],'actionIncomplete':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6a')],'speech':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6b')]['speech'],'score':_0xce3a18[_0xa3e3('0x68')]['score'],'statusCode':_0xce3a18['status'][_0xa3e3('0x6c')],'endConversation':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6d')][_0xa3e3('0x6e')]||![],'isFallbackIntent':_0xce3a18[_0xa3e3('0x68')][_0xa3e3('0x6d')][_0xa3e3('0x6f')]};});};exports['googleDialogflowV2']=function(_0x44187c,_0x5cbd80,_0x1c8ba3,_0x79f2b1,_0x13973a,_0x398f2e){var _0xa0eb66=_0x79f2b1[_0xa3e3('0x70')](/\\n/g,'\x0a');var _0x40bc34={'credentials':{'private_key':_0xa0eb66,'client_email':_0x1c8ba3}};var _0x5f2aff=new dialogflow[(_0xa3e3('0x71'))](_0x40bc34);var _0x5d74b5=_0x5f2aff[_0xa3e3('0x72')](_0x5cbd80,md5(_0x44187c));var _0x547855={'session':_0x5d74b5,'queryInput':{'text':{'text':_0x13973a,'languageCode':_0x398f2e}}};return _0x5f2aff[_0xa3e3('0x73')](_0x547855)[_0xa3e3('0x2b')](function(_0x5a5818){if(_0x5a5818&&_0x5a5818['length']){logger[_0xa3e3('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0xa3e3('0x44')](_0x5a5818));var _0x1b91bb=_0x5a5818[0x0];if(_0x1b91bb){var _0x55e296={'action':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x69')],'allRequiredParamsPresent':_0x1b91bb[_0xa3e3('0x74')]['allRequiredParamsPresent'],'endConversation':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x75')]&&_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x75')][_0xa3e3('0x76')]?_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x75')][_0xa3e3('0x76')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x1b91bb['queryResult'][_0xa3e3('0x77')],'intentName':_0x1b91bb['queryResult'][_0xa3e3('0x78')][_0xa3e3('0x63')],'intentDisplayName':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x78')]['displayName'],'isFallbackIntent':_0x1b91bb[_0xa3e3('0x74')]['intent'][_0xa3e3('0x79')],'languageCode':_0x1b91bb['queryResult']['languageCode'],'queryText':_0x1b91bb['queryResult'][_0xa3e3('0x7a')],'responseId':_0x1b91bb['responseId'],'score':_0x1b91bb[_0xa3e3('0x74')][_0xa3e3('0x7b')],'speech':_0x1b91bb[_0xa3e3('0x74')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x5a5818)};return _0x55e296;}}});};exports[_0xa3e3('0x7c')]=function(_0x542476,_0x1d97e2,_0x50d3d9,_0x3a127c){return tilde[_0xa3e3('0x58')](_0x542476,_0x1d97e2,_0x50d3d9,_0x3a127c)[_0xa3e3('0x2b')](function(_0x3648ac){try{fs['unlink'](_0x542476);}catch(_0x54a4d9){logger[_0xa3e3('0x16')](_0x54a4d9);}logger[_0xa3e3('0x1a')](_0xa3e3('0x7d'),_0x3648ac[_0xa3e3('0x5c')]);logger['info'](_0xa3e3('0x7e'),_0x3648ac['confidence']);return _0x3648ac;});};exports[_0xa3e3('0x7f')]=function(_0x3dc222,_0x219709,_0x2c4e8a,_0x1405c6,_0x1d3b3b,_0x20e250){var _0x5ad219=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x39'));var _0x24e5db;return aws[_0xa3e3('0x80')](_0x3dc222,_0x219709,_0x2c4e8a,_0x1405c6,_0x1d3b3b,_0x20e250,_0x5ad219)[_0xa3e3('0x2b')](function(){_0x24e5db=path[_0xa3e3('0x27')](__dirname,'tmp',rs[_0xa3e3('0x28')](0x4)+'.wav');return convertFile(_0x5ad219,_0x24e5db);})[_0xa3e3('0x2b')](function(){try{fs[_0xa3e3('0x1d')](_0x5ad219);fs[_0xa3e3('0x2c')](_0x24e5db,_0xa3e3('0x2d'));}catch(_0x122a5f){logger[_0xa3e3('0x16')](_0x122a5f);}return _0x24e5db[_0xa3e3('0x2e')]('.')[0x0];});};exports[_0xa3e3('0x81')]=function(_0x25af6d,_0x332ea1,_0x50a47c,_0x29bef5,_0xb58890,_0x18da96){return aws[_0xa3e3('0x82')](_0x25af6d,_0x332ea1,_0x50a47c,_0x29bef5,_0xb58890,_0x18da96)['then'](function(_0x79ba9d){logger['info'](JSON[_0xa3e3('0x44')](_0x79ba9d));return _0x79ba9d;});};exports[_0xa3e3('0x83')]=function(_0x16bac2,_0x218cfa,_0x107921,_0x378592){var _0x1bd5a9=util[_0xa3e3('0x84')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x16bac2,encodeURIComponent(_0x218cfa),_0x107921,_0x378592);var _0x26d7b8=path['resolve'](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+'.mp3');var _0x16281b;return downloadFile(_0x1bd5a9,_0x26d7b8)['then'](function(){_0x16281b=path[_0xa3e3('0x27')](__dirname,_0xa3e3('0x3c'),rs[_0xa3e3('0x28')](0x4)+_0xa3e3('0x29'));return convertFile(_0x26d7b8,_0x16281b);})[_0xa3e3('0x2b')](function(){try{fs[_0xa3e3('0x1d')](_0x26d7b8);fs['chmodSync'](_0x16281b,'777');}catch(_0x52b791){logger['error'](_0x52b791);}return _0x16281b['split']('.')[0x0];});};exports['ispeechASR']=function(_0x381609,_0x2dce98,_0x31a0c3,_0x102dbc){var _0x3014f2=util[_0xa3e3('0x84')](_0xa3e3('0x85'),ISPEECH_API,_0x2dce98,_0x31a0c3,base64Encode(_0x381609),_0x102dbc?util[_0xa3e3('0x84')]('model=%s',encodeURIComponent(_0x102dbc)):'freeform=3');return uploadFile(_0x3014f2)[_0xa3e3('0x2b')](function(_0x486664){return querystring['parse'](_0x486664);});};exports[_0xa3e3('0x86')]=function(_0x351aa3,_0x3c62f4){return sestek[_0xa3e3('0x87')](_0x351aa3,_0x3c62f4)['then'](function(_0xb04b3d){logger[_0xa3e3('0x1a')](JSON['stringify'](_0xb04b3d));var _0x505cc0={'speech':_0xb04b3d[_0xa3e3('0x88')],'action':_0xb04b3d[_0xa3e3('0x89')]?_0xb04b3d[_0xa3e3('0x89')][_0xa3e3('0x8a')]:undefined,'actiondata':_0xb04b3d[_0xa3e3('0x89')]?_0xb04b3d['channelData'][_0xa3e3('0x8b')]:undefined};if(_0xb04b3d[_0xa3e3('0x89')]&&_0xb04b3d[_0xa3e3('0x89')][_0xa3e3('0x8c')]){return base64Decode(_0xb04b3d[_0xa3e3('0x89')][_0xa3e3('0x8c')][_0xa3e3('0x8d')],path['resolve'](__dirname,_0xa3e3('0x3c'),rs['generate'](0x4)+_0xa3e3('0x29')))[_0xa3e3('0x2b')](function(_0x2b8db3){_0x505cc0[_0xa3e3('0x8e')]=_0x2b8db3;return _0x505cc0;});}return _0x505cc0;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xf81b=['score','metadata','endConversation','googleDialogflowV2','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','protocol','data','end','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','POST','generate','from','writeFile','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','eval\x20RET\x20slic:','AFTER\x20SLICE','ERR','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','buffer2','.mp3','filepath','desdt','goggleTTS\x20path','destination\x20ended\x202\x20da\x20gen','googleASR','asr','results','map','alternatives','transcript','join','confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech'];(function(_0x5b73af,_0x493a6b){var _0x353b8b=function(_0xa34258){while(--_0xa34258){_0x5b73af['push'](_0x5b73af['shift']());}};_0x353b8b(++_0x493a6b);}(_0xf81b,0x1cc));var _0xbf81=function(_0x5c6e86,_0x527295){_0x5c6e86=_0x5c6e86-0x0;var _0x473974=_0xf81b[_0x5c6e86];return _0x473974;};'use strict';var apiai=require(_0xbf81('0x0'));var BPromise=require(_0xbf81('0x1'));var dialogflow=require(_0xbf81('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xbf81('0x3'));var md5=require('md5');var path=require(_0xbf81('0x4'));var querystring=require(_0xbf81('0x5'));var rp=require(_0xbf81('0x6'));var rs=require(_0xbf81('0x7'));var sox=require(_0xbf81('0x8'));var tts=require(_0xbf81('0x9'));var urlParse=require(_0xbf81('0xa'))[_0xbf81('0xb')];var util=require('util');var aws=require(_0xbf81('0xc'));var google=require(_0xbf81('0xd'));var sestek=require(_0xbf81('0xe'));var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xc9c979,_0x5e2502){return new BPromise(function(_0x595537,_0x5cfa5e){var _0x5375ea=urlParse(_0xc9c979);var _0x19da0c=_0x5375ea['protocol']===_0xbf81('0xf')?https:http;var _0x2516a8={'host':_0x5375ea[_0xbf81('0x10')],'path':_0x5375ea[_0xbf81('0x4')],'headers':{'user-agent':_0xbf81('0x11')}};_0x19da0c[_0xbf81('0x12')](_0x2516a8,function(_0x394222){if(_0x394222['statusCode']!==0xc8){logger[_0xbf81('0x13')](_0xbf81('0x14')+_0xc9c979+_0xbf81('0x15')+_0x394222[_0xbf81('0x16')]+'\x20('+_0x394222[_0xbf81('0x17')]+')');_0x5cfa5e(new Error(_0xbf81('0x14')+_0xc9c979+_0xbf81('0x15')+_0x394222[_0xbf81('0x16')]+'\x20('+_0x394222[_0xbf81('0x17')]+')'));return;}var _0x5461c2=fs[_0xbf81('0x18')](_0x5e2502);_0x5461c2['on'](_0xbf81('0x19'),function(){logger[_0xbf81('0x1a')](_0xbf81('0x1b'));_0x5461c2[_0xbf81('0x1c')](_0x595537);});_0x5461c2['on'](_0xbf81('0x13'),function(_0x426877){fs[_0xbf81('0x1d')](_0x5e2502);logger[_0xbf81('0x13')](_0xbf81('0x1e'),_0x426877);_0x5cfa5e(_0x426877);});_0x394222[_0xbf81('0x1f')](_0x5461c2);})['on'](_0xbf81('0x13'),function(_0x3be07f){logger['error'](_0x3be07f);_0x5cfa5e(_0x3be07f);})['end']();});}function uploadFile(_0x53da67){return new BPromise(function(_0x55873a,_0x3e4e43){var _0x10e17e=urlParse(_0x53da67);var _0x55a973=_0x10e17e[_0xbf81('0x20')]===_0xbf81('0xf')?https:http;var _0x1df76f={'host':_0x10e17e['host'],'path':_0x10e17e[_0xbf81('0x4')],'headers':{'user-agent':_0xbf81('0x11')}};_0x55a973[_0xbf81('0x12')](_0x1df76f,function(_0x3b6b96){if(_0x3b6b96[_0xbf81('0x16')]!==0xc8){_0x3e4e43(new Error(_0xbf81('0x14')+_0x53da67+_0xbf81('0x15')+_0x3b6b96[_0xbf81('0x16')]+'\x20('+_0x3b6b96[_0xbf81('0x17')]+')'));return;}var _0x1425f0='';_0x3b6b96['on'](_0xbf81('0x21'),function(_0x3130d8){_0x1425f0+=_0x3130d8;});_0x3b6b96['on'](_0xbf81('0x22'),function(){_0x55873a(_0x1425f0);});})['on']('error',function(_0x1d070e){_0x3e4e43(_0x1d070e);})[_0xbf81('0x22')]();});}function convertFile(_0x4263af,_0x2f637c){return new BPromise(function(_0x38f6fb,_0x4f7e61){var _0x488d3f=sox[_0xbf81('0x23')](_0x4263af,_0x2f637c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x488d3f['on']('error',function(_0x311ab5){logger[_0xbf81('0x13')](_0xbf81('0x24'),_0x311ab5);_0x4f7e61(_0x311ab5);});_0x488d3f['on']('end',function(){logger[_0xbf81('0x1a')](_0xbf81('0x25'));_0x38f6fb();});_0x488d3f['start']();});}function base64Decode(_0x183258,_0x4ec0ce){var _0x46c037=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs['generate'](0x4)+_0xbf81('0x28'));fs[_0xbf81('0x29')](_0x46c037,_0x183258,_0xbf81('0x2a'));return convertFile(_0x46c037,_0x4ec0ce)[_0xbf81('0x2b')](function(){try{fs[_0xbf81('0x1d')](_0x46c037);fs['chmodSync'](_0x4ec0ce,_0xbf81('0x2c'));}catch(_0x1cb38d){logger[_0xbf81('0x13')](_0x1cb38d);}return _0x4ec0ce[_0xbf81('0x2d')]('.')[0x0];});}function base64Encode(_0x4b7551){var _0x57940f=fs[_0xbf81('0x2e')](_0x4b7551);return new Buffer(_0x57940f)['toString'](_0xbf81('0x2a'));}exports[_0xbf81('0x2f')]=function(_0x10c6ee,_0x474cd4,_0x5b091e,_0x1e2f81,_0x3e1beb,_0x20dbc6){var _0x12abda,_0x41c4e7;var _0x1883cb='https://texttospeech.googleapis.com/v1/';var _0x5d2031=_0xbf81('0x30')+_0x10c6ee;var _0x3fc662={};if(_0x474cd4===_0xbf81('0x31')){_0x3fc662[_0xbf81('0x32')]={'ssml':_0x5b091e};}else{_0x3fc662['input']={'text':_0x5b091e};};_0x3fc662[_0xbf81('0x33')]={'languageCode':_0x1e2f81,'ssmlGender':_0x3e1beb};_0x3fc662[_0xbf81('0x34')]={'audioEncoding':_0xbf81('0x35'),'sampleRateHertz':0x1f40};var _0x5cba65={'url':_0x1883cb+'text:synthesize'+_0x5d2031,'method':_0xbf81('0x36'),'json':!![],'body':_0x3fc662};return rp(_0x5cba65)['then'](function(_0x350f1c){return new BPromise(function(_0x54de33,_0x9ba861){_0x12abda=path['resolve'](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+'.mp3');var _0x3e6392=Buffer[_0xbf81('0x38')](_0x350f1c['audioContent'],'base64');return fs[_0xbf81('0x39')](_0x12abda,_0x3e6392,function(_0x1c4891){_0x9ba861(_0x1c4891);},function(_0x2d65bb){fs[_0xbf81('0x3a')](_0x12abda,_0xbf81('0x2c'));_0x54de33(_0x2d65bb);});});})['then'](function(_0x1f313a){_0x41c4e7=path['resolve'](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+'.wav');return convertFile(_0x12abda,_0x41c4e7);})[_0xbf81('0x2b')](function(){try{fs[_0xbf81('0x1d')](_0x12abda);fs[_0xbf81('0x3a')](_0x41c4e7,_0xbf81('0x2c'));}catch(_0x4890ed){logger[_0xbf81('0x13')](_0x4890ed);}logger['info']('googleCloudTTS\x20path',_0x41c4e7[_0xbf81('0x2d')]('.')[0x0]);return _0x41c4e7[_0xbf81('0x2d')]('.')[0x0];});};exports[_0xbf81('0x3b')]=function(_0x34d56f,_0x3d9b8d){var _0x5dbf88,_0x165c4b;var _0x598dc6;var _0x4a318f={'encoding':'utf8','method':_0xbf81('0x36'),'timeout':0x2710,'url':_0xbf81('0x3c'),'headers':{'Content-Type':_0xbf81('0x3d')},'body':_0xbf81('0x3e')+encodeURIComponent(JSON['stringify']([[[_0xbf81('0x3f'),JSON[_0xbf81('0x40')]([_0x34d56f,_0x3d9b8d||'en-US',![],'null']),null,'generic']]]))};console[_0xbf81('0x41')](_0xbf81('0x42'),_0x4a318f);return rp(_0x4a318f)[_0xbf81('0x2b')](function(_0x313a4f){console[_0xbf81('0x41')](_0xbf81('0x43'),_0x313a4f);try{console[_0xbf81('0x41')](_0xbf81('0x44'),_0x313a4f[_0xbf81('0x45')](0x5));console[_0xbf81('0x41')](_0xbf81('0x46'),eval(_0x313a4f[_0xbf81('0x45')](0x5))[0x0][0x2]);_0x598dc6=eval(_0x313a4f[_0xbf81('0x45')](0x5))[0x0][0x2];console[_0xbf81('0x41')](_0xbf81('0x47'),_0x598dc6);}catch(_0x5b8864){console[_0xbf81('0x41')](_0xbf81('0x48'),_0x5b8864);throw new Error(_0xbf81('0x49')+res[_0xbf81('0x21')]);}if(!_0x598dc6){throw new Error(_0xbf81('0x4a')+lang+_0xbf81('0x4b'));}try{_0x598dc6=eval(_0x598dc6)[0x0];}catch(_0x2a204c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xbf81('0x21')]);}console[_0xbf81('0x41')]('REPONSE2',_0x598dc6);const _0x291be6=_0x598dc6;console['log'](_0xbf81('0x4c'),_0x291be6);_0x5dbf88=path[_0xbf81('0x26')](__dirname,'tmp',rs[_0xbf81('0x37')](0x4)+_0xbf81('0x4d'));console['log'](_0xbf81('0x4e'),_0x5dbf88);fs[_0xbf81('0x29')](_0x5dbf88,_0x598dc6,{'encoding':'base64'});_0x165c4b=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+'.wav');console['log'](_0xbf81('0x4f'),_0x165c4b);return convertFile(_0x5dbf88,_0x165c4b);})[_0xbf81('0x2b')](function(){try{console[_0xbf81('0x41')]('desdt',_0x165c4b);fs['chmodSync'](_0x165c4b,'777');}catch(_0x2a7d62){logger['error'](_0x2a7d62);}logger[_0xbf81('0x1a')](_0xbf81('0x50'),_0x165c4b[_0xbf81('0x2d')]('.')[0x0]);console['log'](_0xbf81('0x51'),_0x165c4b[_0xbf81('0x2d')]('.')[0x0]);return _0x165c4b['split']('.')[0x0];});};exports[_0xbf81('0x52')]=function(_0x8af1b3,_0x1dcdc2,_0x376e4d){return google[_0xbf81('0x53')](_0x8af1b3,_0x1dcdc2,_0x376e4d)[_0xbf81('0x2b')](function(_0xc78be4){logger['info'](_0xc78be4['uri']);return rp(_0xc78be4);})['then'](function(_0x327daf){var _0x3c985c='';var _0x24592b=0x0;try{fs[_0xbf81('0x1d')](_0x8af1b3);}catch(_0x41d4bd){logger[_0xbf81('0x13')](_0x41d4bd);}if(_0x327daf&&_0x327daf[_0xbf81('0x54')]){_0x3c985c=_0x327daf[_0xbf81('0x54')][_0xbf81('0x55')](function(_0x1de0df){return _0x1de0df&&_0x1de0df['alternatives'][0x0]&&_0x1de0df[_0xbf81('0x56')][0x0][_0xbf81('0x57')]?_0x1de0df['alternatives'][0x0]['transcript']:'';})[_0xbf81('0x58')]('\x0a');_0x24592b=_0x327daf['results']['map'](function(_0x46e5a9){return _0x46e5a9&&_0x46e5a9['alternatives'][0x0]&&_0x46e5a9['alternatives'][0x0][_0xbf81('0x59')]?_0x46e5a9['alternatives'][0x0]['confidence']:0x0;})[_0xbf81('0x58')]('\x0a');}logger[_0xbf81('0x1a')]('googleASR\x20transcription',_0x3c985c);logger[_0xbf81('0x1a')]('googleASR\x20confidence',_0x24592b);return{'transcript':_0x3c985c,'confidence':_0x24592b};})['catch'](function(_0x39fbd2){logger[_0xbf81('0x13')](_0xbf81('0x5a'),_0x39fbd2[_0xbf81('0x16')],_0x39fbd2[_0xbf81('0x5b')],_0x39fbd2[_0xbf81('0x5c')]);});};exports[_0xbf81('0x5d')]=function(_0x2df6b9,_0x503b06,_0x9c2c9d,_0x3dc7d8){var _0x30a381=apiai(_0x503b06,{'language':_0x3dc7d8||'en'});return _0x30a381[_0xbf81('0x5e')](_0x9c2c9d,{'sessionId':md5(_0x2df6b9)})[_0xbf81('0x2b')](function(_0x1bdae0){logger[_0xbf81('0x1a')](JSON[_0xbf81('0x40')](_0x1bdae0));return{'source':_0x1bdae0[_0xbf81('0x5f')]['source'],'resolvedQuery':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x60')],'action':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x61')],'actionIncomplete':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x62')],'speech':_0x1bdae0['result']['fulfillment'][_0xbf81('0x63')],'score':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x64')],'statusCode':_0x1bdae0['status']['code'],'endConversation':_0x1bdae0[_0xbf81('0x5f')][_0xbf81('0x65')][_0xbf81('0x66')]||![],'isFallbackIntent':_0x1bdae0[_0xbf81('0x5f')]['metadata']['isFallbackIntent']};});};exports[_0xbf81('0x67')]=function(_0x123b16,_0x15259c,_0x43f4f5,_0x50ce97,_0x518757,_0x2077f6){var _0x2a8772=_0x50ce97['replace'](/\\n/g,'\x0a');var _0x551ad2={'credentials':{'private_key':_0x2a8772,'client_email':_0x43f4f5}};var _0x2a40e0=new dialogflow['SessionsClient'](_0x551ad2);var _0x146573=_0x2a40e0[_0xbf81('0x68')](_0x15259c,md5(_0x123b16));var _0x443f7e={'session':_0x146573,'queryInput':{'text':{'text':_0x518757,'languageCode':_0x2077f6}}};return _0x2a40e0[_0xbf81('0x69')](_0x443f7e)[_0xbf81('0x2b')](function(_0xcf47ee){if(_0xcf47ee&&_0xcf47ee[_0xbf81('0x6a')]){logger[_0xbf81('0x1a')]('Dialogflow\x20V2\x20response:',JSON[_0xbf81('0x40')](_0xcf47ee));var _0x5fc19b=_0xcf47ee[0x0];if(_0x5fc19b){var _0x988b1b={'action':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x61')],'allRequiredParamsPresent':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x6c')],'endConversation':_0x5fc19b[_0xbf81('0x6b')]['diagnosticInfo']&&_0x5fc19b[_0xbf81('0x6b')]['diagnosticInfo'][_0xbf81('0x6d')]?_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x6e')][_0xbf81('0x6d')][_0xbf81('0x6f')][_0xbf81('0x70')]:![],'fulfillmentText':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x71')],'intentName':_0x5fc19b[_0xbf81('0x6b')]['intent'][_0xbf81('0x5b')],'intentDisplayName':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x72')][_0xbf81('0x73')],'isFallbackIntent':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x72')][_0xbf81('0x74')],'languageCode':_0x5fc19b['queryResult']['languageCode'],'queryText':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x75')],'responseId':_0x5fc19b[_0xbf81('0x76')],'score':_0x5fc19b['queryResult']['intentDetectionConfidence'],'speech':_0x5fc19b[_0xbf81('0x6b')][_0xbf81('0x71')],'providerResponse':JSON[_0xbf81('0x40')](_0xcf47ee)};return _0x988b1b;}}});};exports[_0xbf81('0x77')]=function(_0xfddf3c,_0x4578c2,_0x588594,_0x30f902){return tilde[_0xbf81('0x53')](_0xfddf3c,_0x4578c2,_0x588594,_0x30f902)[_0xbf81('0x2b')](function(_0x4eaeed){try{fs[_0xbf81('0x1d')](_0xfddf3c);}catch(_0x5aeec2){logger[_0xbf81('0x13')](_0x5aeec2);}logger['info']('Tilde\x20ASR\x20transcription',_0x4eaeed[_0xbf81('0x57')]);logger[_0xbf81('0x1a')](_0xbf81('0x78'),_0x4eaeed[_0xbf81('0x59')]);return _0x4eaeed;});};exports[_0xbf81('0x79')]=function(_0x3a3768,_0x5d5202,_0x494ac7,_0xabd852,_0x118d88,_0x5eb36d){var _0x3b39dc=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x4d'));var _0xafd356;return aws[_0xbf81('0x7a')](_0x3a3768,_0x5d5202,_0x494ac7,_0xabd852,_0x118d88,_0x5eb36d,_0x3b39dc)[_0xbf81('0x2b')](function(){_0xafd356=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x28'));return convertFile(_0x3b39dc,_0xafd356);})['then'](function(){try{fs[_0xbf81('0x1d')](_0x3b39dc);fs[_0xbf81('0x3a')](_0xafd356,_0xbf81('0x2c'));}catch(_0x2787a3){logger[_0xbf81('0x13')](_0x2787a3);}return _0xafd356[_0xbf81('0x2d')]('.')[0x0];});};exports[_0xbf81('0x7b')]=function(_0xa8c980,_0x45ba4f,_0x3da0c2,_0x13bb58,_0x31e31f,_0x1f7ac7){return aws[_0xbf81('0x7c')](_0xa8c980,_0x45ba4f,_0x3da0c2,_0x13bb58,_0x31e31f,_0x1f7ac7)[_0xbf81('0x2b')](function(_0x5431c7){logger[_0xbf81('0x1a')](JSON[_0xbf81('0x40')](_0x5431c7));return _0x5431c7;});};exports[_0xbf81('0x7d')]=function(_0x2e3975,_0x1476c9,_0x2c1d64,_0xec8c1a){var _0xc81d56=util['format'](_0xbf81('0x7e'),ISPEECH_API,_0x2e3975,encodeURIComponent(_0x1476c9),_0x2c1d64,_0xec8c1a);var _0x31555d=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs['generate'](0x4)+'.mp3');var _0x14286c;return downloadFile(_0xc81d56,_0x31555d)['then'](function(){_0x14286c=path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x28'));return convertFile(_0x31555d,_0x14286c);})[_0xbf81('0x2b')](function(){try{fs[_0xbf81('0x1d')](_0x31555d);fs['chmodSync'](_0x14286c,_0xbf81('0x2c'));}catch(_0x316724){logger[_0xbf81('0x13')](_0x316724);}return _0x14286c[_0xbf81('0x2d')]('.')[0x0];});};exports[_0xbf81('0x7f')]=function(_0x5d9d33,_0x47d5bd,_0x2cb53a,_0x18e858){var _0x1189c3=util[_0xbf81('0x80')](_0xbf81('0x81'),ISPEECH_API,_0x47d5bd,_0x2cb53a,base64Encode(_0x5d9d33),_0x18e858?util[_0xbf81('0x80')](_0xbf81('0x82'),encodeURIComponent(_0x18e858)):_0xbf81('0x83'));return uploadFile(_0x1189c3)[_0xbf81('0x2b')](function(_0x4b25c6){return querystring[_0xbf81('0xb')](_0x4b25c6);});};exports[_0xbf81('0x84')]=function(_0x92625d,_0x36bb63){return sestek['nda'](_0x92625d,_0x36bb63)['then'](function(_0x111191){logger[_0xbf81('0x1a')](JSON[_0xbf81('0x40')](_0x111191));var _0x23fbc7={'speech':_0x111191[_0xbf81('0x85')],'action':_0x111191[_0xbf81('0x86')]?_0x111191[_0xbf81('0x86')][_0xbf81('0x87')]:undefined,'actiondata':_0x111191[_0xbf81('0x86')]?_0x111191[_0xbf81('0x86')][_0xbf81('0x88')]:undefined};if(_0x111191['channelData']&&_0x111191[_0xbf81('0x86')][_0xbf81('0x89')]){return base64Decode(_0x111191[_0xbf81('0x86')]['AudioFromTts']['Data'],path[_0xbf81('0x26')](__dirname,_0xbf81('0x27'),rs[_0xbf81('0x37')](0x4)+_0xbf81('0x28')))['then'](function(_0x2f3de9){_0x23fbc7[_0xbf81('0x8a')]=_0x2f3de9;return _0x23fbc7;});}return _0x23fbc7;});};exports[_0xbf81('0x8b')]=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 9267d3b..0f77053 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 _0xbcf1=['exports'];(function(_0x4e01d3,_0x256d92){var _0x266b28=function(_0x100fbd){while(--_0x100fbd){_0x4e01d3['push'](_0x4e01d3['shift']());}};_0x266b28(++_0x256d92);}(_0xbcf1,0x110));var _0x1bcf=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xbcf1[_0x1ab180];return _0xfb2c2d;};var nda=require('./nda');module[_0x1bcf('0x0')]={'nda':nda}; \ No newline at end of file +var _0x6fcf=['exports'];(function(_0x24fa3b,_0x307995){var _0x13ce62=function(_0x128eb5){while(--_0x128eb5){_0x24fa3b['push'](_0x24fa3b['shift']());}};_0x13ce62(++_0x307995);}(_0x6fcf,0x14b));var _0xf6fc=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x6fcf[_0x46a3ff];return _0x404bc2;};var nda=require('./nda');module[_0xf6fc('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 67123da..1d699b6 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 _0x5b6a=['ndassistant_url','ndaactivity_type','message','callerid','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','audio/wav','custom_action','custom_action_data','CustomActionData','info','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x5b6a,0x66));var _0xa5b6=function(_0x1c2bcc,_0x364549){_0x1c2bcc=_0x1c2bcc-0x0;var _0x5b97dc=_0x5b6a[_0x1c2bcc];return _0x5b97dc;};'use strict';var rp=require('request-promise');var url=require(_0xa5b6('0x0'));var logger=require(_0xa5b6('0x1'))(_0xa5b6('0x2'));module[_0xa5b6('0x3')]=function(_0x230bfd,_0x49f0c5){var _0x493df4={'method':_0xa5b6('0x4'),'uri':url[_0xa5b6('0x5')](_0x49f0c5[_0xa5b6('0x6')],'/token'),'form':{'grant_type':_0xa5b6('0x7'),'username':_0x49f0c5[_0xa5b6('0x8')],'password':_0x49f0c5[_0xa5b6('0x7')]},'json':!![]};return rp(_0x493df4)[_0xa5b6('0x9')](function(_0x4f9df2){var _0x4d4ca0={'method':_0xa5b6('0x4'),'uri':url[_0xa5b6('0x5')](_0x49f0c5[_0xa5b6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x49f0c5[_0xa5b6('0xb')]||_0xa5b6('0xc'),'channelId':'Nda','conversation':{'id':_0x230bfd['uniqueid']},'from':{'id':_0x230bfd[_0xa5b6('0xd')],'name':_0x230bfd['calleridname']},'recipient':{'id':_0x230bfd[_0xa5b6('0xe')],'name':_0x230bfd[_0xa5b6('0xf')]},'text':_0x49f0c5[_0xa5b6('0x10')],'channelData':{}},'headers':{'Authorization':_0xa5b6('0x11')+_0x4f9df2[_0xa5b6('0x12')]},'json':!![]};if(_0x49f0c5['project']){_0x4d4ca0[_0xa5b6('0x13')][_0xa5b6('0x14')][_0xa5b6('0x15')]=_0x49f0c5[_0xa5b6('0x16')];}if(_0x49f0c5['ndagenerate_audio']=='1'){_0x4d4ca0[_0xa5b6('0x13')][_0xa5b6('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa5b6('0x17')};}if(_0x49f0c5['custom_action']){_0x4d4ca0[_0xa5b6('0x13')]['channelData']['CustomAction']=_0x49f0c5[_0xa5b6('0x18')];if(_0x49f0c5[_0xa5b6('0x19')]){_0x4d4ca0[_0xa5b6('0x13')][_0xa5b6('0x14')][_0xa5b6('0x1a')]=_0x49f0c5['custom_action_data'];}}logger[_0xa5b6('0x1b')](JSON['stringify'](_0x4d4ca0));return rp(_0x4d4ca0);});}; \ No newline at end of file +var _0x3cbb=['password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','ndauth_url'];(function(_0x2729a0,_0x37c7f1){var _0x512139=function(_0x3ae933){while(--_0x3ae933){_0x2729a0['push'](_0x2729a0['shift']());}};_0x512139(++_0x37c7f1);}(_0x3cbb,0xeb));var _0xb3cb=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x3cbb[_0x2576d7];return _0x16a08c;};'use strict';var rp=require('request-promise');var url=require(_0xb3cb('0x0'));var logger=require('../../../../../config/logger')(_0xb3cb('0x1'));module[_0xb3cb('0x2')]=function(_0x4b02a3,_0x1f8205){var _0x1a64ff={'method':_0xb3cb('0x3'),'uri':url['resolve'](_0x1f8205[_0xb3cb('0x4')],'/token'),'form':{'grant_type':'password','username':_0x1f8205['username'],'password':_0x1f8205[_0xb3cb('0x5')]},'json':!![]};return rp(_0x1a64ff)[_0xb3cb('0x6')](function(_0x153702){var _0x2a7c73={'method':_0xb3cb('0x3'),'uri':url[_0xb3cb('0x7')](_0x1f8205[_0xb3cb('0x8')],_0xb3cb('0x9')),'body':{'type':_0x1f8205[_0xb3cb('0xa')]||_0xb3cb('0xb'),'channelId':_0xb3cb('0xc'),'conversation':{'id':_0x4b02a3[_0xb3cb('0xd')]},'from':{'id':_0x4b02a3[_0xb3cb('0xe')],'name':_0x4b02a3['calleridname']},'recipient':{'id':_0x4b02a3[_0xb3cb('0xf')],'name':_0x4b02a3['extension']},'text':_0x1f8205[_0xb3cb('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x153702[_0xb3cb('0x11')]},'json':!![]};if(_0x1f8205[_0xb3cb('0x12')]){_0x2a7c73['body'][_0xb3cb('0x13')][_0xb3cb('0x14')]=_0x1f8205['project'];}if(_0x1f8205[_0xb3cb('0x15')]=='1'){_0x2a7c73[_0xb3cb('0x16')][_0xb3cb('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb3cb('0x17')};}if(_0x1f8205[_0xb3cb('0x18')]){_0x2a7c73[_0xb3cb('0x16')][_0xb3cb('0x13')][_0xb3cb('0x19')]=_0x1f8205[_0xb3cb('0x18')];if(_0x1f8205[_0xb3cb('0x1a')]){_0x2a7c73[_0xb3cb('0x16')][_0xb3cb('0x13')][_0xb3cb('0x1b')]=_0x1f8205[_0xb3cb('0x1a')];}}logger[_0xb3cb('0x1c')](JSON[_0xb3cb('0x1d')](_0x2a7c73));return rp(_0x2a7c73);});}; \ 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 8a4398d..6f3eff1 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 _0x522a=['./lib/api','exports'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x522a,0x146));var _0xa522=function(_0x188c3d,_0x35d1b7){_0x188c3d=_0x188c3d-0x0;var _0x8bfd13=_0x522a[_0x188c3d];return _0x8bfd13;};'use strict';var asr=require(_0xa522('0x0'));module[_0xa522('0x1')]=function(_0x5261ff,_0xba51be,_0x4f83e8,_0x324d51){return asr(_0x5261ff,_0xba51be,_0x4f83e8,_0x324d51);}; \ No newline at end of file +var _0x0094=['./lib/api'];(function(_0x10637e,_0x1e935f){var _0x2b2ec5=function(_0x14ac84){while(--_0x14ac84){_0x10637e['push'](_0x10637e['shift']());}};_0x2b2ec5(++_0x1e935f);}(_0x0094,0x82));var _0x4009=function(_0x4aa6bc,_0x150a86){_0x4aa6bc=_0x4aa6bc-0x0;var _0x3d86a9=_0x0094[_0x4aa6bc];return _0x3d86a9;};'use strict';var asr=require(_0x4009('0x0'));module['exports']=function(_0x345d84,_0x259827,_0x342c10,_0x465f80){return asr(_0x345d84,_0x259827,_0x342c10,_0x465f80);}; \ 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 696ef6e..e8cc1e0 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 _0x8dfd=['open','message','bluebird','lodash','moment','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','close','send','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject'];(function(_0x482cc1,_0x96a8bd){var _0x29721c=function(_0x541067){while(--_0x541067){_0x482cc1['push'](_0x482cc1['shift']());}};_0x29721c(++_0x96a8bd);}(_0x8dfd,0x1be));var _0xd8df=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x8dfd[_0x79cd47];return _0x3b9484;};'use strict';var BPromise=require(_0xd8df('0x0'));var _=require(_0xd8df('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd8df('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x5dc356,_0x255bb2,_0xcfbf76,_0x51f10e){return new BPromise(function(_0x3decc6,_0x25d66b){logger[_0xd8df('0x3')](_0xd8df('0x4'),_0x51f10e||_0xd8df('0x5'));var _0x1bc80f=new WebSocket(_0x51f10e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x38e024='';var _0x46c5c3='0';var _0x8eff2a='1';var _0x4138db=_0xd8df('0x6');function _0x4fa3f3(_0x335446){var _0x16f0a1=crypto['createHash'](_0xd8df('0x7'));_0x16f0a1[_0xd8df('0x8')](_0x335446);return _0x16f0a1['digest'](_0xd8df('0x9'));}function _0x1b616c(){try{logger[_0xd8df('0x3')](_0xd8df('0xa'));var _0x494435=moment()[_0xd8df('0xb')]();var _0x29c216=_0x4fa3f3(_0x494435+_0x255bb2+_0xcfbf76);_0x1bc80f['send'](JSON[_0xd8df('0xc')]({'appID':_0x255bb2,'timestamp':_0x494435,'appKey':_0x29c216}));var _0x4b85f5=fs['createReadStream'](_0x5dc356);_0x4b85f5['on'](_0xd8df('0xd'),function(_0xe46086){_0x1bc80f['send'](_0xe46086);});_0x4b85f5['on'](_0xd8df('0xe'),function(){_0x1bc80f[_0xd8df('0xf')](_0xd8df('0x10'));});}catch(_0x4fae8a){logger[_0xd8df('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xd8df('0xc')](_0x4fae8a));_0x1bc80f[_0xd8df('0x12')]();}}function _0x34a297(_0x2331c4){try{if(_0x2331c4){var _0x20e6de=JSON[_0xd8df('0x13')](_0x2331c4);switch(_0x20e6de[_0xd8df('0x14')]){case 0x0:if(_0x20e6de[_0xd8df('0x15')]){if(_0x20e6de[_0xd8df('0x15')][_0xd8df('0x16')]){logger[_0xd8df('0x3')](_0xd8df('0x17'),JSON[_0xd8df('0xc')](_0x20e6de['result'][_0xd8df('0x18')]));_0x38e024=_0x20e6de[_0xd8df('0x15')]['hypotheses'][0x0][_0xd8df('0x19')];_0x46c5c3=_0x20e6de[_0xd8df('0x15')][_0xd8df('0x18')][0x0]['likelihood'];_0x8eff2a='0';_0x4138db=_0xd8df('0x1a');_0x1bc80f[_0xd8df('0x12')]();}}break;case 0x1:logger['info'](_0xd8df('0x6'));_0x8eff2a='1';_0x4138db=_0xd8df('0x6');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x8eff2a='2';_0x4138db=_0xd8df('0x1b');break;case 0x9:logger[_0xd8df('0x3')](_0xd8df('0x1c'));_0x8eff2a='9';_0x4138db=_0xd8df('0x1c');break;case 0xa:logger[_0xd8df('0x3')](_0xd8df('0x1d'));_0x8eff2a='10';_0x4138db=_0xd8df('0x1d');break;case 0xb:logger['info'](_0xd8df('0x1e'));_0x8eff2a='11';_0x4138db=_0xd8df('0x1e');}}}catch(_0x17189c){logger[_0xd8df('0x11')](_0xd8df('0x1f'),JSON['stringify'](_0x17189c));_0x1bc80f[_0xd8df('0x12')]();}}function _0x44cef(){logger[_0xd8df('0x3')](_0xd8df('0x20'));_0x3decc6({'transcript':_0x38e024,'confidence':_0x46c5c3,'status':_0x8eff2a,'status_message':_0x4138db});}function _0x37a8d0(_0x2fe557){logger['error'](_0xd8df('0x21'));if(!_['isNil'](_0x2fe557)){logger[_0xd8df('0x11')](_[_0xd8df('0x22')](_0x2fe557)?JSON[_0xd8df('0xc')](_0x2fe557):_0x2fe557);}}_0x1bc80f['on'](_0xd8df('0x23'),_0x1b616c);_0x1bc80f['on'](_0xd8df('0x24'),_0x34a297);_0x1bc80f['on'](_0xd8df('0xe'),_0x44cef);_0x1bc80f['on'](_0xd8df('0x11'),_0x37a8d0);});}; \ No newline at end of file +var _0xb255=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb255,0x79));var _0x5b25=function(_0xf00579,_0x52840d){_0xf00579=_0xf00579-0x0;var _0x318821=_0xb255[_0xf00579];return _0x318821;};'use strict';var BPromise=require(_0x5b25('0x0'));var _=require(_0x5b25('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5b25('0x2'));var crypto=require(_0x5b25('0x3'));var logger=require(_0x5b25('0x4'))('agi');module[_0x5b25('0x5')]=function(_0x3dfb61,_0x682809,_0x55dc83,_0x1b93f6){return new BPromise(function(_0x212b08,_0x3f8b6f){logger[_0x5b25('0x6')](_0x5b25('0x7'),_0x1b93f6||_0x5b25('0x8'));var _0x115943=new WebSocket(_0x1b93f6||_0x5b25('0x8'),{'perMessageDeflate':![]});var _0x5d32dc='';var _0x306a9b='0';var _0x203d6e='1';var _0x10ce87='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x37d6b3(_0x34f3d2){var _0x5175ea=crypto[_0x5b25('0x9')](_0x5b25('0xa'));_0x5175ea[_0x5b25('0xb')](_0x34f3d2);return _0x5175ea[_0x5b25('0xc')](_0x5b25('0xd'));}function _0x498feb(){try{logger['info'](_0x5b25('0xe'));var _0x31ac32=moment()[_0x5b25('0xf')]();var _0x49401=_0x37d6b3(_0x31ac32+_0x682809+_0x55dc83);_0x115943[_0x5b25('0x10')](JSON[_0x5b25('0x11')]({'appID':_0x682809,'timestamp':_0x31ac32,'appKey':_0x49401}));var _0x502b69=fs[_0x5b25('0x12')](_0x3dfb61);_0x502b69['on'](_0x5b25('0x13'),function(_0x7564b9){_0x115943[_0x5b25('0x10')](_0x7564b9);});_0x502b69['on'](_0x5b25('0x14'),function(){_0x115943[_0x5b25('0x10')](_0x5b25('0x15'));});}catch(_0x16f3d3){logger[_0x5b25('0x16')](_0x5b25('0x17'),JSON['stringify'](_0x16f3d3));_0x115943[_0x5b25('0x18')]();}}function _0x8e00a8(_0x2c64f4){try{if(_0x2c64f4){var _0x1c0345=JSON[_0x5b25('0x19')](_0x2c64f4);switch(_0x1c0345[_0x5b25('0x1a')]){case 0x0:if(_0x1c0345['result']){if(_0x1c0345[_0x5b25('0x1b')]['final']){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x5b25('0x11')](_0x1c0345[_0x5b25('0x1b')][_0x5b25('0x1c')]));_0x5d32dc=_0x1c0345[_0x5b25('0x1b')][_0x5b25('0x1c')][0x0][_0x5b25('0x1d')];_0x306a9b=_0x1c0345['result'][_0x5b25('0x1c')][0x0][_0x5b25('0x1e')];_0x203d6e='0';_0x10ce87=_0x5b25('0x1f');_0x115943[_0x5b25('0x18')]();}}break;case 0x1:logger['info'](_0x5b25('0x20'));_0x203d6e='1';_0x10ce87=_0x5b25('0x20');break;case 0x2:logger[_0x5b25('0x6')](_0x5b25('0x21'));_0x203d6e='2';_0x10ce87=_0x5b25('0x21');break;case 0x9:logger[_0x5b25('0x6')](_0x5b25('0x22'));_0x203d6e='9';_0x10ce87=_0x5b25('0x22');break;case 0xa:logger[_0x5b25('0x6')]('Authentication\x20failed.');_0x203d6e='10';_0x10ce87=_0x5b25('0x23');break;case 0xb:logger['info'](_0x5b25('0x24'));_0x203d6e='11';_0x10ce87='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5a8944){logger['error'](_0x5b25('0x25'),JSON['stringify'](_0x5a8944));_0x115943[_0x5b25('0x18')]();}}function _0x6c39aa(){logger[_0x5b25('0x6')](_0x5b25('0x26'));_0x212b08({'transcript':_0x5d32dc,'confidence':_0x306a9b,'status':_0x203d6e,'status_message':_0x10ce87});}function _0x3465f4(_0x41ebfe){logger['error'](_0x5b25('0x27'));if(!_[_0x5b25('0x28')](_0x41ebfe)){logger[_0x5b25('0x16')](_[_0x5b25('0x29')](_0x41ebfe)?JSON[_0x5b25('0x11')](_0x41ebfe):_0x41ebfe);}}_0x115943['on'](_0x5b25('0x2a'),_0x498feb);_0x115943['on']('message',_0x8e00a8);_0x115943['on']('close',_0x6c39aa);_0x115943['on'](_0x5b25('0x16'),_0x3465f4);});}; \ 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 f48937a..3796bb7 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 _0x5453=['exports','./asr'];(function(_0x4ed83a,_0x2a102c){var _0x5e5cb2=function(_0x31c890){while(--_0x31c890){_0x4ed83a['push'](_0x4ed83a['shift']());}};_0x5e5cb2(++_0x2a102c);}(_0x5453,0x18b));var _0x3545=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5453[_0x59ee6f];return _0x4c0979;};var asr=require(_0x3545('0x0'));module[_0x3545('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2802=['exports','./asr'];(function(_0x4ade33,_0x103537){var _0x162cc1=function(_0x1c52ab){while(--_0x1c52ab){_0x4ade33['push'](_0x4ade33['shift']());}};_0x162cc1(++_0x103537);}(_0x2802,0x1b5));var _0x2280=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x2802[_0x47a40b];return _0x19610c;};var asr=require(_0x2280('0x0'));module[_0x2280('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index b8b1aaf..e1f4d75 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c76=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','nextTick','inherits','util','net','events','./error','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','listen','listening'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6c76,0x184));var _0x66c7=function(_0x48cb44,_0x406b00){_0x48cb44=_0x48cb44-0x0;var _0x3cb35b=_0x6c76[_0x48cb44];return _0x3cb35b;};'use strict';var util=require(_0x66c7('0x0'));var net=require(_0x66c7('0x1'));var EventEmitter=require(_0x66c7('0x2'))['EventEmitter'];var AGIError=require(_0x66c7('0x3'));var AGIChannel=require(_0x66c7('0x4'));var AGIServer=function(_0x519756,_0x572a2b,_0x2f6db7){var _0x2b7cf3=this,_0x519756=_0x519756||0x11dd,_0x572a2b=_0x572a2b||_0x66c7('0x5'),_0x45b0a5=null,_0x52f71b=0x0;EventEmitter['call'](_0x2b7cf3);function _0x4fa6ce(){if(!_0x519756){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0x8')));return![];}_0x45b0a5=net['createServer']();_0x45b0a5[_0x66c7('0x9')](_0x519756,_0x572a2b);_0x45b0a5['on'](_0x66c7('0xa'),function(){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0xa'));});_0x45b0a5['on']('connection',function(_0x464085){_0x45b0a5[_0x66c7('0xb')](function(_0x26c9b2,_0x187e00){if(_0x26c9b2){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xc'),_0x26c9b2));}else if(_0x2f6db7&&_0x2f6db7<0x0){_0x2b7cf3['emit'](_0x66c7('0x7'),new AGIError(_0x66c7('0xd')));_0x464085[_0x66c7('0xe')]();}else if(_0x2f6db7&&_0x2f6db7>0x0&&_0x2f6db7<_0x187e00){_0x52f71b+=0x1;_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xf'),_0x52f71b));_0x464085[_0x66c7('0xe')]();}else{var _0xf3b04=new AGIChannel(_0x464085);_0xf3b04['on'](_0x66c7('0x10'),function(){_0x2b7cf3['emit'](_0x66c7('0x11'),_0xf3b04);});}});});_0x45b0a5['on']('error',function(_0x208010){_0x2b7cf3[_0x66c7('0x6')](_0x66c7('0x7'),new AGIError(_0x66c7('0xc'),_0x208010[_0x66c7('0x12')]));});_0x45b0a5['on']('close',function(){_0x2b7cf3['emit']('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x66c7('0x13')](function(){_0x4fa6ce();});};util[_0x66c7('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x524e87,_0x256b0a,_0x9b65cf){return new AGIServer(_0x524e87,_0x256b0a,_0x9b65cf);}; \ No newline at end of file +var _0xa854=['ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','EventEmitter','./error','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x11da3b,_0x3c073a){var _0x30fefc=function(_0x1ce7f4){while(--_0x1ce7f4){_0x11da3b['push'](_0x11da3b['shift']());}};_0x30fefc(++_0x3c073a);}(_0xa854,0x103));var _0x4a85=function(_0x58c257,_0x18bc49){_0x58c257=_0x58c257-0x0;var _0x1b8cd1=_0xa854[_0x58c257];return _0x1b8cd1;};'use strict';var util=require(_0x4a85('0x0'));var net=require(_0x4a85('0x1'));var EventEmitter=require(_0x4a85('0x2'))[_0x4a85('0x3')];var AGIError=require(_0x4a85('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x135ea5,_0x498101,_0x388052){var _0x5bd2dd=this,_0x135ea5=_0x135ea5||0x11dd,_0x498101=_0x498101||_0x4a85('0x5'),_0x494d91=null,_0x445a95=0x0;EventEmitter['call'](_0x5bd2dd);function _0xb1605c(){if(!_0x135ea5){_0x5bd2dd['emit'](_0x4a85('0x6'),new AGIError(_0x4a85('0x7')));return![];}_0x494d91=net[_0x4a85('0x8')]();_0x494d91[_0x4a85('0x9')](_0x135ea5,_0x498101);_0x494d91['on'](_0x4a85('0xa'),function(){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0xa'));});_0x494d91['on'](_0x4a85('0xc'),function(_0x95de02){_0x494d91['getConnections'](function(_0x45cff9,_0x2232dd){if(_0x45cff9){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0x6'),new AGIError(_0x4a85('0xd'),_0x45cff9));}else if(_0x388052&&_0x388052<0x0){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0x6'),new AGIError(_0x4a85('0xe')));_0x95de02[_0x4a85('0xf')]();}else if(_0x388052&&_0x388052>0x0&&_0x388052<_0x2232dd){_0x445a95+=0x1;_0x5bd2dd['emit'](_0x4a85('0x6'),new AGIError(_0x4a85('0x10'),_0x445a95));_0x95de02[_0x4a85('0xf')]();}else{var _0x153d39=new AGIChannel(_0x95de02);_0x153d39['on'](_0x4a85('0x11'),function(){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0xc'),_0x153d39);});}});});_0x494d91['on'](_0x4a85('0x6'),function(_0x1922cb){_0x5bd2dd[_0x4a85('0xb')](_0x4a85('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x1922cb[_0x4a85('0x12')]));});_0x494d91['on'](_0x4a85('0x13'),function(){_0x5bd2dd['emit'](_0x4a85('0x13'),new AGIError(_0x4a85('0x14')));});}process[_0x4a85('0x15')](function(){_0xb1605c();});};util['inherits'](AGIServer,EventEmitter);module[_0x4a85('0x16')]=function(_0x2eb00a,_0x457739,_0x496b8a){return new AGIServer(_0x2eb00a,_0x457739,_0x496b8a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a47d437..320ed84 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 _0xf94f=['getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','getQueryOdbc','error','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','timeout','includes','POST','PUT','method','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','recursiveNodeIndex','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','streamFile','unlink','.wav','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','no\x20trunk\x20selected','getTrunk','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','getData','maxdigit','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','isEmpty','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','pass','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\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','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','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','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','getVariableById','then','name','catch','rpc','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath'];(function(_0x183800,_0x2f969c){var _0x4b603a=function(_0xa885e4){while(--_0xa885e4){_0x183800['push'](_0x183800['shift']());}};_0x4b603a(++_0x2f969c);}(_0xf94f,0x1b1));var _0xff94=function(_0x5ed5de,_0x1ca24f){_0x5ed5de=_0x5ed5de-0x0;var _0x4eef7a=_0xf94f[_0x5ed5de];return _0x4eef7a;};'use strict';var fs=require('fs');var path=require(_0xff94('0x0'));var util=require(_0xff94('0x1'));var _=require(_0xff94('0x2'));var sh=require('shelljs');var odbc=require(_0xff94('0x3'))();var rs=require(_0xff94('0x4'));var moment=require(_0xff94('0x5'));var Mustache=require(_0xff94('0x6'));var rp=require(_0xff94('0x7'));var logger=require(_0xff94('0x8'))(_0xff94('0x9'));var config=require(_0xff94('0xa'));var scripts=require(_0xff94('0xb'));var FILES_PATH=_0xff94('0xc');var recursiveMapAttributes=[_0xff94('0xd'),'rawBody'];var verticesWithRetry=[_0xff94('0xe'),_0xff94('0xf'),_0xff94('0x10')];var AGIVertices=function(_0x1e75ed,_0x4b3ab0,_0x361f38){this[_0xff94('0x11')]=_0x1e75ed;this['rpc']=_0x4b3ab0;this[_0xff94('0x12')]=_0x361f38;};AGIVertices[_0xff94('0x13')][_0xff94('0x14')]=function(_0x196fcd,_0x1387f0){this['rpc'][_0xff94('0x15')](_0x196fcd)[_0xff94('0x16')](function(_0x1a5fef){_0x1387f0(null,_0x1a5fef?_0x1a5fef[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x18be57){_0x1387f0(_0x18be57);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x2e75b8,_0x20a4f2){this[_0xff94('0x19')][_0xff94('0x1a')](_0x2e75b8)[_0xff94('0x16')](function(_0x5dc2e5){_0x20a4f2(null,_0x5dc2e5?_0x5dc2e5[_0xff94('0x17')]:![]);})['catch'](function(_0x344e5f){_0x20a4f2(_0x344e5f);});};AGIVertices[_0xff94('0x13')][_0xff94('0x1b')]=function(_0x40f484,_0x177304){this['rpc']['getSquareProjectById'](_0x40f484)[_0xff94('0x16')](function(_0x4c9778){_0x177304(null,_0x4c9778?_0x4c9778[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x572929){_0x177304(_0x572929);});};AGIVertices[_0xff94('0x13')][_0xff94('0x1c')]=function(_0x4d13ca,_0xb2ae59){this['rpc'][_0xff94('0x1d')](_0x4d13ca)[_0xff94('0x16')](function(_0xa7f9ff){_0xb2ae59(null,_0xa7f9ff?_0xa7f9ff[_0xff94('0x1e')]:![]);})['catch'](function(_0x2961a5){_0xb2ae59(_0x2961a5);});};AGIVertices[_0xff94('0x13')][_0xff94('0x1f')]=function(_0x4c61e1,_0x564863){this[_0xff94('0x19')][_0xff94('0x20')](_0x4c61e1)[_0xff94('0x16')](function(_0x5b4f79){_0x564863(null,_0x5b4f79?_0x5b4f79[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x10f338){_0x564863(_0x10f338);});};AGIVertices[_0xff94('0x13')]['getTrunk']=function(_0x36fa11,_0x5e3513){this[_0xff94('0x19')][_0xff94('0x21')](_0x36fa11)['then'](function(_0x15f87f){_0x5e3513(null,_0x15f87f?_0x15f87f[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0x14f399){_0x5e3513(_0x14f399);});};AGIVertices[_0xff94('0x13')][_0xff94('0x22')]=function(_0x32d90f,_0x20b119){var _0x1c81b4=this;this[_0xff94('0x19')][_0xff94('0x23')](_0x32d90f)[_0xff94('0x16')](function(_0x34450c){_0x20b119(null,_0x34450c?_0x1c81b4[_0xff94('0x24')](_0x34450c['save_name']):![]);})[_0xff94('0x18')](function(_0x20ef28){_0x20b119(_0x20ef28);});};AGIVertices[_0xff94('0x13')][_0xff94('0x25')]=function(_0x2c264f,_0x18e34f){this['rpc'][_0xff94('0x26')](_0x2c264f)[_0xff94('0x16')](function(_0x155add){_0x18e34f(null,_0x155add?_0x155add:![]);})['catch'](function(_0x4ed45b){_0x18e34f(_0x4ed45b);});};AGIVertices[_0xff94('0x13')][_0xff94('0x27')]=function(_0x567f76,_0x5bde29,_0x154722){this['mailRpc']['sendMailMessage'](_0x567f76,_0x5bde29)[_0xff94('0x16')](function(){_0x154722(null);})[_0xff94('0x18')](function(_0x182594){_0x154722(_0x182594);});};AGIVertices['prototype'][_0xff94('0x28')]=function(_0xbd15fd,_0x535f88){this['rpc'][_0xff94('0x29')](_0xbd15fd)['then'](function(_0x66291e){if(_0x66291e){if(_0x66291e[_0xff94('0x2a')]){_0x535f88(null,[_0x66291e[_0xff94('0x2b')]]);}else{_0x535f88(null,_['map'](_0x66291e[_0xff94('0x2c')],_0xff94('0x2b')));}}else{_0x535f88(null,![]);}})[_0xff94('0x18')](function(_0xf34ad5){_0x535f88(_0xf34ad5);});};AGIVertices[_0xff94('0x13')][_0xff94('0x24')]=function(_0x5ca93a){return util[_0xff94('0x2d')]('%s/sounds/converted/%s',FILES_PATH,_0x5ca93a);};AGIVertices[_0xff94('0x13')][_0xff94('0x2e')]=function(_0x5330de,_0x4afb8c,_0x432d60){odbc['open'](_0x5330de,function(_0x526655){if(_0x526655){logger[_0xff94('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x526655);_0x432d60(_0x526655);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xff94('0x30')](_0x4afb8c,function(_0x1b6328,_0x16e1b2){if(_0x1b6328){logger[_0xff94('0x31')](_0xff94('0x32'),_0x4afb8c);_0x432d60(_0x1b6328);}else{logger['info'](_0xff94('0x33'),_0x4afb8c);odbc[_0xff94('0x34')](function(_0x9aa893){if(_0x9aa893){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x9aa893);}_0x432d60(null,_0x16e1b2);});}});}});};AGIVertices[_0xff94('0x13')]['getSmsAccount']=function(_0x13365c,_0x6bcca8){this[_0xff94('0x19')][_0xff94('0x35')](_0x13365c)[_0xff94('0x16')](function(_0x182708){_0x6bcca8(null,_0x182708?_0x182708:![]);})[_0xff94('0x18')](function(_0x51fc31){_0x6bcca8(_0x51fc31);});};AGIVertices[_0xff94('0x13')]['createSmsMessage']=function(_0xcbab23,_0x5cce3f){this[_0xff94('0x19')]['createSmsMessage'](_0xcbab23)[_0xff94('0x16')](function(_0x29e63d){_0x5cce3f(null,_0x29e63d);})['catch'](function(_0x547b92){_0x5cce3f(_0x547b92);});};AGIVertices[_0xff94('0x13')][_0xff94('0x36')]=function(_0x11c39e,_0x2a5eae,_0x19340f){this['rpc'][_0xff94('0x36')]({'uniqueid':this[_0xff94('0x11')][_0xff94('0x37')],'node':_0x11c39e[_0xff94('0x38')],'application':_0x11c39e[_0xff94('0x39')],'data':_0x2a5eae||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xff94('0x11')][_0xff94('0x3a')]})[_0xff94('0x16')](function(_0x4a628e){if(_0x19340f){_0x19340f(null,_0x4a628e);}})['catch'](function(_0x4320b6){if(_0x19340f){_0x19340f(_0x4320b6);}});};AGIVertices[_0xff94('0x13')][_0xff94('0x3b')]=function(_0x142d4c,_0x2d0a0a,_0x4859d0,_0x4d57a2){this[_0xff94('0x19')][_0xff94('0x3b')]({'uniqueid':this[_0xff94('0x11')]['uniqueid'],'callerid':this['channel'][_0xff94('0x3a')],'calleridname':this['channel']['calleridname'],'context':this[_0xff94('0x11')]['context'],'extension':this['channel'][_0xff94('0x3c')],'priority':this[_0xff94('0x11')][_0xff94('0x3d')],'accountcode':this[_0xff94('0x11')][_0xff94('0x3e')],'dnid':this[_0xff94('0x11')][_0xff94('0x3f')],'projectName':this[_0xff94('0x11')]['arg_1'],'saveName':_0x2d0a0a,'filename':_0x142d4c[_0xff94('0x40')]||_0x2d0a0a,'savePath':_0x4859d0})[_0xff94('0x16')](function(_0x270893){_0x4d57a2(null,_0x270893);})[_0xff94('0x18')](function(_0x2fb5a2){_0x4d57a2(_0x2fb5a2);});};AGIVertices[_0xff94('0x13')]['createSquareMessage']=function(_0x48c26a,_0x1ca9a0,_0x438a89,_0x183810,_0x5a3f36){this[_0xff94('0x19')][_0xff94('0x41')]({'uniqueid':this[_0xff94('0x11')][_0xff94('0x37')],'body':_0x48c26a,'direction':_0x1ca9a0,'providerName':_0x438a89,'providerResponse':_0x183810})['then'](function(_0x2bf92a){if(_0x5a3f36){_0x5a3f36(null,_0x2bf92a);}})[_0xff94('0x18')](function(_0x1fcc2b){if(_0x5a3f36){_0x5a3f36(_0x1fcc2b);}});};AGIVertices[_0xff94('0x13')]['createCmContact']=function(_0x44f1ad,_0x9e6360){this[_0xff94('0x19')][_0xff94('0x42')]({'firstName':_['isEmpty'](_0x44f1ad[_0xff94('0x17')])||_[_0xff94('0x43')](_0x44f1ad['name'])?_0xff94('0x44')+Math[_0xff94('0x45')]():_0x44f1ad[_0xff94('0x17')],'lastName':_['isEmpty'](_0x44f1ad[_0xff94('0x46')])||_[_0xff94('0x43')](_0x44f1ad['lastName'])?null:_0x44f1ad[_0xff94('0x46')],'phone':_0x44f1ad[_0xff94('0x47')],'ListId':_0x44f1ad[_0xff94('0x48')],'scheduledat':_0x44f1ad[_0xff94('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xff94('0x4a'),'description':_0xff94('0x4b')+_0x44f1ad[_0xff94('0x49')]['toString'](),'priority':_0x44f1ad[_0xff94('0x4c')]})[_0xff94('0x16')](function(_0x49c8a9){_0x9e6360(null,_0x49c8a9);})[_0xff94('0x18')](function(_0x36175c){_0x9e6360(_0x36175c);});};AGIVertices[_0xff94('0x13')][_0xff94('0x4d')]=function(_0x110f78,_0x21e727){this[_0xff94('0x19')]['getPauseById'](_0x110f78)[_0xff94('0x16')](function(_0x2e2578){_0x21e727(null,_0x2e2578?_0x2e2578[_0xff94('0x17')]:![]);})[_0xff94('0x18')](function(_0xf20613){_0x21e727(_0xf20613);});};AGIVertices[_0xff94('0x13')][_0xff94('0x4e')]=function(_0x1b6d21,_0x20a7ca,_0x27edcc){var _0x1d4962={'role':_0xff94('0x4f')};_0x1d4962[_0x1b6d21]=this[_0xff94('0x11')]['callerid'];this[_0xff94('0x19')]['agentPause'](_0x1d4962,_0x20a7ca,this['channel'][_0xff94('0x37')])[_0xff94('0x16')](function(_0x5f39ab){_0x27edcc(null,_[_0xff94('0x43')](_0x5f39ab)?![]:!![]);})[_0xff94('0x18')](function(_0x5ae1be){logger[_0xff94('0x2f')](_0x5ae1be);_0x27edcc(null,![]);});};AGIVertices['prototype'][_0xff94('0x50')]=function(_0xeef19,_0x1c517d){var _0x56f37b={'role':_0xff94('0x4f')};_0x56f37b[_0xeef19]=this[_0xff94('0x11')][_0xff94('0x3a')];this[_0xff94('0x19')][_0xff94('0x50')](_0x56f37b)[_0xff94('0x16')](function(_0x2b6810){_0x1c517d(null,_[_0xff94('0x43')](_0x2b6810)?![]:!![]);})['catch'](function(_0x4e37af){logger[_0xff94('0x2f')](_0x4e37af);_0x1c517d(null,![]);});};AGIVertices[_0xff94('0x13')][_0xff94('0x51')]=function(_0x2ea98c,_0x4f54aa){var _0x43a498={'role':'agent'};_0x43a498[_0x2ea98c]=this[_0xff94('0x11')]['callerid'];this['rpc'][_0xff94('0x51')](_0x43a498)[_0xff94('0x16')](function(_0x4f75f4){_0x4f54aa(null,_['isNil'](_0x4f75f4)?![]:!![]);})[_0xff94('0x18')](function(_0x331688){logger[_0xff94('0x2f')](_0x331688);_0x4f54aa(null,![]);});};AGIVertices[_0xff94('0x13')]['agentLogin']=function(_0x189a50,_0x2e85c8){var _0x37572e={'role':_0xff94('0x4f')};_0x37572e[_0x189a50]=this['channel'][_0xff94('0x3a')];var _0x29fc55=_0x189a50!=_0xff94('0x52')?util[_0xff94('0x2d')](_0xff94('0x53'),_0xff94('0x54'),this[_0xff94('0x11')]['callerid']):undefined;this[_0xff94('0x19')][_0xff94('0x55')](_0x37572e,_0x29fc55)[_0xff94('0x16')](function(_0x3b3f9a){_0x2e85c8(null,_[_0xff94('0x43')](_0x3b3f9a)?![]:!![]);})[_0xff94('0x18')](function(_0x57070f){logger[_0xff94('0x2f')](_0x57070f);_0x2e85c8(null,![]);});};AGIVertices[_0xff94('0x13')][_0xff94('0x56')]=function(_0x3e1863,_0x4589ac){sh[_0xff94('0x57')](_[_0xff94('0x58')](_0x3e1863),function(_0x3f2129,_0x278710){var _0x21befb=_0x278710[_0xff94('0x59')](/(\r\n|\n|\r)/gm,'');_0x4589ac(null,_0x21befb);});};AGIVertices['prototype'][_0xff94('0x5a')]=function(_0x41b71d,_0x396404){scripts[_0xff94('0x5a')](_0x41b71d[_0xff94('0x5b')],_0x41b71d[_0xff94('0x5c')]||'text',_0x41b71d[_0xff94('0x5d')],_0x41b71d[_0xff94('0x5e')]||_0xff94('0x5f'),_0x41b71d['ssmlGender']||_0xff94('0x60'),_0x41b71d[_0xff94('0x61')]||_0xff94('0x62'))[_0xff94('0x16')](function(_0x23b514){_0x396404(null,_0x23b514);})[_0xff94('0x18')](function(_0x239ffd){_0x396404(_0x239ffd);});};AGIVertices['prototype'][_0xff94('0x63')]=function(_0x453632,_0x10606b){scripts[_0xff94('0x63')](_0x453632['text'],_0x453632[_0xff94('0x64')]||'en',0x1)[_0xff94('0x16')](function(_0x2f4752){_0x10606b(null,_0x2f4752);})[_0xff94('0x18')](function(_0x28fb2b){_0x10606b(_0x28fb2b);});};AGIVertices[_0xff94('0x13')]['restAPI']=function(_0x4b5b71,_0x2ccf38){var _0x491eb4={'uri':_0x4b5b71['url'],'method':_0x4b5b71['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4b5b71['timeout'])==='number'&&parseInt(_0x4b5b71[_0xff94('0x65')])>=0x1?parseInt(_0x4b5b71[_0xff94('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xff94('0x66')]([_0xff94('0x67'),_0xff94('0x68')],_0x491eb4[_0xff94('0x69')][_0xff94('0x6a')]())){try{_0x491eb4[_0xff94('0x6b')]=_0x4b5b71[_0xff94('0x6c')]?JSON['parse'](_0x4b5b71['rawBody']):{};}catch(_0x18e26c){logger[_0xff94('0x2f')](_0xff94('0x6d'),_0x18e26c);}}try{_0x491eb4[_0xff94('0x6e')]=_0x4b5b71['rawHeaders']?JSON[_0xff94('0x6f')](_0x4b5b71['rawHeaders']):{};}catch(_0x2eeca4){logger[_0xff94('0x2f')](_0xff94('0x70'),_0x2eeca4);}if(_0x4b5b71[_0xff94('0x71')]){try{var _0x3e03c1=require(_0x4b5b71['computedVariables'])[_0xff94('0x72')](this,_0x491eb4);_0x491eb4[_0xff94('0x73')]=Mustache[_0xff94('0x74')](_0x4b5b71['url'],_0x3e03c1,{},['$$','$$']);if(_0x491eb4[_0xff94('0x6e')]){_0x491eb4[_0xff94('0x6e')]=JSON[_0xff94('0x6f')](Mustache[_0xff94('0x74')](JSON['stringify'](_0x491eb4[_0xff94('0x6e')]),_0x3e03c1,{},['$$','$$']));}if(_0x491eb4[_0xff94('0x6b')]){_0x491eb4[_0xff94('0x6b')]=JSON['parse'](Mustache['render'](JSON[_0xff94('0x75')](_0x491eb4[_0xff94('0x6b')]),_0x3e03c1,{},['$$','$$']));}}catch(_0xac09c){logger[_0xff94('0x2f')](_0xff94('0x76'),_0xac09c);}}rp(_0x491eb4)['then'](function(_0x20dfe8){var _0x28e9a0={'statusCode':_0x20dfe8['statusCode']||0xc8,'statusMessage':_0x20dfe8[_0xff94('0x77')]||'OK','headers':_0x20dfe8[_0xff94('0x6e')]||{},'body':_0x20dfe8[_0xff94('0x6b')]||{}};_0x2ccf38(null,_0x28e9a0);})[_0xff94('0x18')](function(_0x181518){var _0x4871f0={'statusCode':_0x181518[_0xff94('0x78')]||0x1f4,'statusMessage':_0x181518[_0xff94('0x79')]||_0xff94('0x7a'),'headers':_0x181518[_0xff94('0x7b')][_0xff94('0x6e')]||{},'body':_0x181518[_0xff94('0x7b')][_0xff94('0x6b')]||{}};_0x2ccf38(null,_0x4871f0);});};AGIVertices['prototype'][_0xff94('0x7c')]=function(_0x536971,_0xf5dd86){scripts[_0xff94('0x7c')](this[_0xff94('0x11')]['uniqueid'],_0x536971['key'],_0x536971[_0xff94('0x5d')],_0x536971[_0xff94('0x7d')]||'en')[_0xff94('0x16')](function(_0x558315){_0xf5dd86(null,_0x558315);})[_0xff94('0x18')](function(_0x43bfb6){_0xf5dd86(_0x43bfb6);});};AGIVertices[_0xff94('0x13')][_0xff94('0x7e')]=function(_0x204ecf,_0x2bc264){scripts[_0xff94('0x7e')](this[_0xff94('0x11')]['uniqueid'],_0x204ecf['dialogflowV2_project_id'],_0x204ecf[_0xff94('0x7f')],_0x204ecf[_0xff94('0x80')],_0x204ecf['text'],_0x204ecf[_0xff94('0x81')]||'en')[_0xff94('0x16')](function(_0x2b9a6f){_0x2bc264(null,_0x2b9a6f);})['catch'](function(_0x2367e4){_0x2bc264(_0x2367e4);});};AGIVertices['prototype'][_0xff94('0x82')]=function(_0x1c3330,_0x122886){scripts[_0xff94('0x82')](this[_0xff94('0x11')],_0x1c3330)[_0xff94('0x16')](function(_0x3f5a8e){_0x122886(null,_0x3f5a8e);})[_0xff94('0x18')](function(_0xf3d077){_0x122886(_0xf3d077);});};AGIVertices[_0xff94('0x13')][_0xff94('0x83')]=function(_0x2f3793,_0x44779d){scripts['ispeechTTS'](_0x2f3793[_0xff94('0x84')],_0x2f3793['text'],_0x2f3793[_0xff94('0x85')]||_0xff94('0x5f'),_0x2f3793[_0xff94('0x86')])[_0xff94('0x16')](function(_0xd0fe90){_0x44779d(null,_0xd0fe90);})['catch'](function(_0x2992d8){_0x44779d(_0x2992d8);});};AGIVertices[_0xff94('0x13')][_0xff94('0x87')]=function(_0x2ad0e6,_0x569c2d,_0x6bbecd){scripts[_0xff94('0x87')](_0x569c2d,_0x2ad0e6[_0xff94('0x84')],_0x2ad0e6[_0xff94('0x88')]||'en-US',this[_0xff94('0x89')](_0x2ad0e6[_0xff94('0x8a')])?_0x2ad0e6['model']:undefined)[_0xff94('0x16')](function(_0x1b0184){_0x6bbecd(null,_0x1b0184);})[_0xff94('0x18')](function(_0x3ff78e){_0x6bbecd(_0x3ff78e);});};AGIVertices[_0xff94('0x13')][_0xff94('0x8b')]=function(_0x235b39,_0x240829){scripts[_0xff94('0x8b')](_0x235b39['aws_access_key_id'],_0x235b39[_0xff94('0x8c')],_0x235b39[_0xff94('0x8d')],_0x235b39['aws_polly_voice']||_0xff94('0x8e'),_0x235b39[_0xff94('0x5d')],_0x235b39[_0xff94('0x8f')]||_0xff94('0x5d'))[_0xff94('0x16')](function(_0x60957c){_0x240829(null,_0x60957c);})[_0xff94('0x18')](function(_0x51f36f){_0x240829(_0x51f36f);});};AGIVertices[_0xff94('0x13')][_0xff94('0x90')]=function(_0x5b9fca,_0x83184b){scripts['awsLex'](this[_0xff94('0x11')][_0xff94('0x37')],_0x5b9fca[_0xff94('0x91')],_0x5b9fca[_0xff94('0x8c')],_0x5b9fca['aws_lex_region'],_0x5b9fca[_0xff94('0x5d')],_0x5b9fca[_0xff94('0x92')])[_0xff94('0x16')](function(_0x179eb2){_0x83184b(null,_0x179eb2);})['catch'](function(_0x43f921){_0x83184b(_0x43f921);});};AGIVertices[_0xff94('0x13')][_0xff94('0x93')]=function(_0x4dbd9e,_0x4d4cfe,_0x302f6c){scripts[_0xff94('0x93')](_0x4d4cfe,_0x4dbd9e[_0xff94('0x84')],_0x4dbd9e[_0xff94('0x94')]||_0xff94('0x5f'))[_0xff94('0x16')](function(_0x21143d){_0x302f6c(null,_0x21143d);})[_0xff94('0x18')](function(_0x2df85b){_0x302f6c(_0x2df85b);});};AGIVertices['prototype'][_0xff94('0x95')]=function(_0x3815a4,_0x45a58f,_0x2e7a55){scripts[_0xff94('0x95')](_0x45a58f,_0x3815a4[_0xff94('0x96')],_0x3815a4[_0xff94('0x97')],_0x3815a4[_0xff94('0x73')])[_0xff94('0x16')](function(_0x493eb3){_0x2e7a55(null,_0x493eb3);})[_0xff94('0x18')](function(_0x424c29){_0x2e7a55(_0x424c29);});};AGIVertices['prototype'][_0xff94('0x98')]=function(_0x35a2c5){var _0x2fe967=_[_0xff94('0x66')](verticesWithRetry,_0x35a2c5['agicommand'])?_0x35a2c5:_['clone'](_0x35a2c5);for(var _0x28086e in _0x2fe967){if(_0x2fe967[_0xff94('0x99')](_0x28086e)){if(_0x2fe967[_0x28086e]&&_[_0xff94('0x9a')](_0x2fe967[_0x28086e])){if(_[_0xff94('0x66')](recursiveMapAttributes,_0x28086e)){_0x2fe967[_0x28086e]=this[_0xff94('0x9b')](_0x2fe967[_0x28086e]);}else{_0x2fe967[_0x28086e]=this[_0xff94('0x9c')](_0x2fe967[_0x28086e]);}}}}return _0x2fe967;};AGIVertices[_0xff94('0x13')]['recursiveNodeIndex']=function(_0x55a6c8){for(var _0x3f3491 in _0x55a6c8){if(_0x55a6c8[_0xff94('0x99')](_0x3f3491)){if(_[_0xff94('0x9d')](_0x55a6c8[_0x3f3491])){this['recursiveNodeIndex'](_0x55a6c8[_0x3f3491]);}else if(_[_0xff94('0x9e')](_0x55a6c8[_0x3f3491])){for(var _0x1d42dc=0x0;_0x1d42dc<_0x55a6c8[_0x3f3491]['length'];_0x1d42dc++){this[_0xff94('0x9f')](_0x55a6c8[_0x3f3491][_0x1d42dc]);}}else if(_[_0xff94('0x9a')](_0x55a6c8[_0x3f3491])){_0x55a6c8[_0x3f3491]=this[_0xff94('0x9c')](_0x55a6c8[_0x3f3491]);}}}};AGIVertices[_0xff94('0x13')][_0xff94('0xa0')]=function(_0x3775b5,_0x554567){for(var _0x273cd0 in _0x3775b5){if(_0x3775b5['hasOwnProperty'](_0x273cd0)){if(_[_0xff94('0x9d')](_0x3775b5[_0x273cd0])){if(!_['isEmpty'](_0x3775b5[_0x273cd0])){this[_0xff94('0xa0')](_0x3775b5[_0x273cd0],util['format']('%s.%s',_0x554567,_0x273cd0));}}else if(_[_0xff94('0x9e')](_0x3775b5[_0x273cd0])){for(var _0x297202=0x0;_0x297202<_0x3775b5[_0x273cd0][_0xff94('0xa1')];_0x297202++){this[_0xff94('0xa0')](_0x3775b5[_0x273cd0][_0x297202],util['format'](_0xff94('0xa2'),_0x554567,_0x273cd0+'['+_0x297202+']'));}}else{if(!_[_0xff94('0x43')](_0x3775b5[_0x273cd0])){this[_0xff94('0x11')][_0xff94('0xa3')](util[_0xff94('0x2d')](_0xff94('0xa2'),_0x554567,_0x273cd0),_0x3775b5[_0x273cd0]);}}}}};AGIVertices['prototype'][_0xff94('0x9b')]=function(_0x5f077a){try{var _0x3defc0=JSON[_0xff94('0x6f')](_0x5f077a);this[_0xff94('0x9f')](_0x3defc0);return JSON['stringify'](_0x3defc0);}catch(_0x52a4bb){return this[_0xff94('0x9c')](_0x5f077a);}};AGIVertices[_0xff94('0x13')][_0xff94('0x9c')]=function(_0xdf1399){var _0x3edebb=_0xdf1399[_0xff94('0xa4')]('{');for(var _0x247a59=0x1;_0x247a59<_0x3edebb[_0xff94('0xa1')];_0x247a59+=0x1){var _0xf3d75b=_0x3edebb[_0x247a59][_0xff94('0xa4')]('}');if(_0xf3d75b[_0xff94('0xa1')]>0x1){_0xdf1399=_0xdf1399[_0xff94('0xa5')]('{'+_0xf3d75b[0x0]+'}',this[_0xff94('0x11')]['getVariable'](_0xf3d75b[0x0])[_0xff94('0xa6')]||_0xf3d75b[0x0]);}}if(_0x3edebb[_0xff94('0xa1')]===0x1){return _0xdf1399[_0xff94('0xa7')]();}return this['replaceAllVariables'](_0xdf1399);};AGIVertices[_0xff94('0x13')][_0xff94('0xa8')]=function(_0x6086ae,_0x1d60a3){var _0x477fae=this[_0xff94('0x11')][_0xff94('0x14')](_0x6086ae);if(_0x477fae[_0xff94('0xa9')]===-0x1){return _0x477fae;}logger['info'](util[_0xff94('0x2d')](_0xff94('0xaa'),_0x1d60a3,_0x477fae[_0xff94('0xa6')]));return this[_0xff94('0x11')][_0xff94('0xa3')](_0x1d60a3,_0x477fae[_0xff94('0xa6')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x89')]=function(_0x415043){return _0x415043&&_0x415043!=='0'&&_0x415043!=='-1'&&_0x415043!=='';};AGIVertices[_0xff94('0x13')][_0xff94('0xab')]=function(_0xe43f40){this[_0xff94('0x36')][_0xff94('0x72')](this,_0xe43f40,'-');_0xe43f40[_0xff94('0xac')]=_0xe43f40[_0xff94('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x487fae){logger[_0xff94('0x31')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x487fae[_0xff94('0x38')]));if(!this['isConfigured'](_0x487fae['text'])){return this[_0xff94('0x11')]['noop'](_0xff94('0xad'));}var _0x4f2727='\x22'+_0x487fae[_0xff94('0x5d')]+'\x22';if(this[_0xff94('0x89')](_0x487fae[_0xff94('0x7b')])){_0x4f2727+=','+_0x487fae[_0xff94('0x7b')];}var _0x53e9c6=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xae'),_0x4f2727);if(_0x53e9c6[_0xff94('0xa9')]===-0x1){return _0x53e9c6;}return this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0xb0'),_0x4f2727));};AGIVertices[_0xff94('0x13')][_0xff94('0xb1')]=function(_0x1ba534){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xb2'),_0x1ba534[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x1ba534['grammar'])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20grammar\x20configured');}var _0x1a654a=_0x1ba534[_0xff94('0xb3')];if(this[_0xff94('0x89')](_0x1ba534['options'])){_0x1a654a+=','+_0x1ba534['options'];}var _0x7a8846=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xb4'),_0x1a654a);if(_0x7a8846[_0xff94('0xa9')]===-0x1){return _0x7a8846;}var _0x34061b=this[_0xff94('0xa8')]('RECOG_CONFIDENCE()',_0xff94('0xb5'));if(_0x34061b[_0xff94('0xa9')]===-0x1){return _0x34061b;}var _0x442685=this[_0xff94('0xa8')](_0xff94('0xb6'),_0xff94('0xb7'));if(_0x442685[_0xff94('0xa9')]===-0x1){return _0x442685;}var _0x10e1f0=this[_0xff94('0xa8')]('RECOG_INSTANCE()',_0xff94('0xb8'));if(_0x10e1f0['result']===-0x1){return _0x10e1f0;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1a654a));};AGIVertices[_0xff94('0x13')]['agi']=function(_0x2a1981){logger['info'](util[_0xff94('0x2d')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2a1981[_0xff94('0x38')]));return this[_0xff94('0x11')]['agi']([_0x2a1981[_0xff94('0xb9')],_0x2a1981[_0xff94('0xba')]]);};AGIVertices[_0xff94('0x13')][_0xff94('0xbb')]=function(_0xa4bf16){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xbc'),_0xa4bf16[_0xff94('0x38')]));if(this[_0xff94('0x89')](_0xa4bf16[_0xff94('0x65')])){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xbd'),_0xa4bf16[_0xff94('0x65')]));var _0x44e891=this['channel'][_0xff94('0xbe')](_0xa4bf16['timeout']);if(_0x44e891[_0xff94('0xa9')]===-0x1){return _0x44e891;}}return this['channel'][_0xff94('0xbb')]();};AGIVertices[_0xff94('0x13')]['callback']=function(_0x371b03){logger[_0xff94('0x31')](util['format'](_0xff94('0xbf'),_0x371b03[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x371b03[_0xff94('0x48')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x371b03,_0xff94('0xc0'));}_0x371b03[_0xff94('0x49')]=moment();if(this['isConfigured'](_0x371b03['delay'])){_0x371b03[_0xff94('0x49')]=moment()[_0xff94('0xc1')](_0x371b03[_0xff94('0xc2')],'minutes');}if(!this[_0xff94('0x89')](_0x371b03[_0xff94('0x4c')])){_0x371b03['callback_priority']=0x2;}this[_0xff94('0x42')]['sync'](this,_0x371b03);return this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0xc3'),_0x371b03[_0xff94('0x47')],_0x371b03['list_id'],_0x371b03[_0xff94('0x49')]));};AGIVertices['prototype'][_0xff94('0xc4')]=function(_0x48154e){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xc5'),_0x48154e['label']));var _0x46ba28=this[_0xff94('0x11')]['exec'](_0x48154e[_0xff94('0xc6')],_0x48154e[_0xff94('0x7b')]);if(_0x46ba28[_0xff94('0xa9')]===-0x1){return _0x46ba28;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xc7'),_0x48154e[_0xff94('0xc6')],_0x48154e[_0xff94('0x7b')]));};AGIVertices[_0xff94('0x13')][_0xff94('0xc8')]=function(_0x34bf07){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xc9'),_0x34bf07[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x34bf07[_0xff94('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x5a9a0e='\x22'+_0x34bf07['text']+'\x22';if(this[_0xff94('0x89')](_0x34bf07['options'])){_0x5a9a0e+=','+_0x34bf07[_0xff94('0x7b')];}var _0x461017=this[_0xff94('0x11')]['exec'](_0xff94('0xae'),_0x5a9a0e);if(_0x461017[_0xff94('0xa9')]===-0x1){return _0x461017;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xb0'),_0x5a9a0e));};AGIVertices[_0xff94('0x13')]['sestektts']=function(_0x5a07f3){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xca'),_0x5a07f3[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x5a07f3[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20text\x20configured');}var _0x53317f='\x22'+_0x5a07f3[_0xff94('0x5d')]+'\x22';if(this[_0xff94('0x89')](_0x5a07f3[_0xff94('0x7b')])){_0x53317f+=','+_0x5a07f3[_0xff94('0x7b')];}var _0x3167a7=this['channel'][_0xff94('0x57')](_0xff94('0xae'),_0x53317f);if(_0x3167a7[_0xff94('0xa9')]===-0x1){return _0x3167a7;}return this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0xb0'),_0x53317f));};AGIVertices[_0xff94('0x13')][_0xff94('0xcb')]=function(_0x359d2b){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xcc'),_0x359d2b['label']));if(!this[_0xff94('0x89')](_0x359d2b[_0xff94('0xb3')])){return this['channel'][_0xff94('0xaf')](_0xff94('0xcd'));}var _0x239736=_0x359d2b[_0xff94('0xb3')];if(this['isConfigured'](_0x359d2b[_0xff94('0x7b')])){_0x239736+=','+_0x359d2b[_0xff94('0x7b')];}var _0x476e37=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xb4'),_0x239736);if(_0x476e37[_0xff94('0xa9')]===-0x1){return _0x476e37;}var _0x106835=this['getAndSetVariable'](_0xff94('0xce'),_0xff94('0xcf'));if(_0x106835[_0xff94('0xa9')]===-0x1){return _0x106835;}var _0x5ef947=this[_0xff94('0xa8')](_0xff94('0xb6'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5ef947[_0xff94('0xa9')]===-0x1){return _0x5ef947;}var _0x2070c8=this[_0xff94('0xa8')](_0xff94('0xd0'),'LUMENVOX_ASR_INSTANCE');if(_0x2070c8[_0xff94('0xa9')]===-0x1){return _0x2070c8;}return this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0xd1'),_0x239736));};AGIVertices[_0xff94('0x13')][_0xff94('0xd2')]=function(_0x27af0e){logger['info'](util[_0xff94('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x27af0e['label']));if(!this[_0xff94('0x89')](_0x27af0e[_0xff94('0xb3')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xcd'));}var _0x46e82b=_0x27af0e[_0xff94('0xb3')];if(this[_0xff94('0x89')](_0x27af0e[_0xff94('0x7b')])){_0x46e82b+=','+_0x27af0e[_0xff94('0x7b')];}var _0x44d69b=this[_0xff94('0x11')][_0xff94('0x57')]('MRCPRecog',_0x46e82b);if(_0x44d69b['result']===-0x1){return _0x44d69b;}var _0x5584d9=this[_0xff94('0xa8')]('RECOG_CONFIDENCE()',_0xff94('0xd3'));if(_0x5584d9[_0xff94('0xa9')]===-0x1){return _0x5584d9;}var _0x2b995a=this[_0xff94('0xa8')](_0xff94('0xb6'),_0xff94('0xd4'));if(_0x2b995a[_0xff94('0xa9')]===-0x1){return _0x2b995a;}var _0x222da3=this[_0xff94('0xa8')](_0xff94('0xd0'),_0xff94('0xd5'));if(_0x222da3[_0xff94('0xa9')]===-0x1){return _0x222da3;}return this[_0xff94('0x11')][_0xff94('0xaf')](util['format'](_0xff94('0xd1'),_0x46e82b));};AGIVertices['prototype'][_0xff94('0xd6')]=function(_0x159923){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xd7'),_0x159923[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x159923[_0xff94('0xd8')])){return this['channel'][_0xff94('0x2f')](_0x159923,_0xff94('0xd9'));}var _0xb93a62=this['getSquareOdbc']['sync'](this,_0x159923[_0xff94('0xd8')]);if(!_0xb93a62){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x159923,_0xff94('0xda'));}if(!this[_0xff94('0x89')](_0x159923['query'])){return this['channel']['error'](_0x159923,_0xff94('0xdb'));}var _0x143106=_0x159923[_0xff94('0x30')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xdc'),_0x143106));var _0x5d44f7=this[_0xff94('0x2e')]['sync'](this,_0xb93a62,_0x143106);this['createSquareDetailsReport'][_0xff94('0x72')](this,_0x159923,_0x143106);if(!this['isConfigured'](_0x159923[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4688ec=this[_0xff94('0x14')]['sync'](this,_0x159923[_0xff94('0xdd')]);if(!_0x4688ec){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x159923,_0xff94('0xde'));}var _0xa57609=this;_0x5d44f7[_0xff94('0xdf')](function(_0x4d227f,_0xb64503){Object['keys'](_0x4d227f)[_0xff94('0xdf')](function(_0x32b238){_0xa57609[_0xff94('0x11')]['setVariable'](util[_0xff94('0x2d')](_0xff94('0xe0'),_0x4688ec,_0xb64503,_0x32b238),_0x4d227f[_0x32b238]);});});this[_0xff94('0x11')]['setVariable'](util[_0xff94('0x2d')](_0xff94('0xe1'),_0x4688ec),_0x5d44f7[_0xff94('0xa1')]);return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xe2'),_0x4688ec));};AGIVertices['prototype'][_0xff94('0xe3')]=function(_0x54c0d4){logger['debug'](util[_0xff94('0x2d')](_0xff94('0xe4'),_0x54c0d4[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x54c0d4[_0xff94('0xe5')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x54c0d4,'no\x20user\x20selected');}var _0x2a5571=this[_0xff94('0x1f')][_0xff94('0x72')](this,_0x54c0d4[_0xff94('0xe5')]);if(!_0x2a5571){return this['channel'][_0xff94('0x2f')](_0x54c0d4,_0xff94('0xe6'));}var _0x3c4617=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xe7'),[util[_0xff94('0x2d')](_0xff94('0xe8'),_0x2a5571),_0x54c0d4[_0xff94('0x65')],_0x54c0d4[_0xff94('0xe9')],_0x54c0d4[_0xff94('0xea')]]);if(_0x3c4617['result']===-0x1){return _0x3c4617;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xeb'),'DIAL'));};AGIVertices[_0xff94('0x13')][_0xff94('0xec')]=function(_0x4cd128){logger['info'](util[_0xff94('0x2d')](_0xff94('0xed'),_0x4cd128[_0xff94('0x38')]));if(!this['isConfigured'](_0x4cd128[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xee'));}if(!this[_0xff94('0x89')](_0x4cd128[_0xff94('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xff94('0xef')]=!![];this['createSquareDetailsReport'](_0x4cd128);this[_0xff94('0x41')](_0x4cd128[_0xff94('0x5d')],'in','','');this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xf0'),_0x4cd128[_0xff94('0x5d')]));var _0x5a91e9=this[_0xff94('0x7c')][_0xff94('0x72')](this,_0x4cd128);if(_0x5a91e9){for(var _0x395442 in _0x5a91e9){if(_0x5a91e9[_0xff94('0x99')](_0x395442)){this[_0xff94('0x11')]['setVariable'](util[_0xff94('0x2d')](_0xff94('0xf1'),_0x395442[_0xff94('0x6a')]()),_0x5a91e9[_0x395442]);}}this['createSquareMessage'](_0x5a91e9[_0xff94('0xf2')],_0xff94('0xf3'),_0xff94('0xec'),'');return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xf4'),_0x5a91e9['speech']));}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x4cd128,_0xff94('0xf5'));};AGIVertices[_0xff94('0x13')][_0xff94('0xf6')]=function(_0x60ff08){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x60ff08[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x60ff08[_0xff94('0xf7')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xf8'));}if(!this[_0xff94('0x89')](_0x60ff08['client_email'])){return this[_0xff94('0x11')]['noop'](_0xff94('0xf9'));}if(!this[_0xff94('0x89')](_0x60ff08[_0xff94('0x80')])){return this['channel'][_0xff94('0xaf')](_0xff94('0xfa'));}if(!this[_0xff94('0x89')](_0x60ff08['dialogflowV2_language'])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xfb'));}if(!this[_0xff94('0x89')](_0x60ff08[_0xff94('0x5d')])){return this[_0xff94('0x11')]['noop']('no\x20text\x20configured');}this[_0xff94('0x11')]['bot']=!![];this['createSquareDetailsReport'](_0x60ff08);this['createSquareMessage'](_0x60ff08[_0xff94('0x5d')],'in','','');this['channel']['noop'](util[_0xff94('0x2d')](_0xff94('0xfc'),_0x60ff08[_0xff94('0x5d')]));var _0x306b00=this['googleDialogflowV2']['sync'](this,_0x60ff08);if(_0x306b00){for(var _0x5f57b1 in _0x306b00){if(_0x306b00[_0xff94('0x99')](_0x5f57b1)){if(_0x5f57b1!==_0xff94('0xfd')){this[_0xff94('0x11')][_0xff94('0xa3')](util[_0xff94('0x2d')]('DIALOGFLOW_%s',_0x5f57b1[_0xff94('0x6a')]()),_0x306b00[_0x5f57b1]);}}}this[_0xff94('0x41')](_0x306b00['speech'],_0xff94('0xf3'),_0xff94('0xf6'),_0x306b00[_0xff94('0xfd')]);return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('DialogflowV2\x20Result\x20%s',_0x306b00['speech']));}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x60ff08,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xff94('0x13')]['sesteknda']=function(_0x456f6a){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0xfe'),_0x456f6a['label']));if(!this[_0xff94('0x89')](_0x456f6a[_0xff94('0xff')])){return this[_0xff94('0x11')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xff94('0x89')](_0x456f6a[_0xff94('0x100')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x101'));}if(!this['isConfigured'](_0x456f6a[_0xff94('0x102')])){return this['channel'][_0xff94('0xaf')](_0xff94('0x103'));}if(!this[_0xff94('0x89')](_0x456f6a[_0xff94('0x104')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')][_0xff94('0xef')]=!![];this[_0xff94('0x36')](_0x456f6a);this[_0xff94('0x41')](_0x456f6a[_0xff94('0x5d')],'in','','');this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0x105'),_0x456f6a[_0xff94('0x5d')]));var _0x2d926b=this[_0xff94('0x82')]['sync'](this,_0x456f6a);if(_0x2d926b){for(var _0x1a49f6 in _0x2d926b){if(_0x2d926b['hasOwnProperty'](_0x1a49f6)){this[_0xff94('0x11')][_0xff94('0xa3')](util['format']('SESTEK_NDA_%s',_0x1a49f6[_0xff94('0x6a')]()),_0x2d926b[_0x1a49f6]);}}this[_0xff94('0x41')](_0x2d926b[_0xff94('0xf2')],'out',_0xff94('0x106'),'');if(_0x2d926b[_0xff94('0x107')]){this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x2d926b[_0xff94('0x107')]));var _0x2f3db3=this[_0xff94('0x11')][_0xff94('0x108')](_0x2d926b[_0xff94('0x107')]);try{fs[_0xff94('0x109')](_0x2d926b[_0xff94('0x107')]+_0xff94('0x10a'));}catch(_0x1349c1){logger['error'](_0x1349c1);}return _0x2f3db3;}else{return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x10b'),_0x2d926b[_0xff94('0xf2')]));}}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x456f6a,_0xff94('0x10c'));};AGIVertices['prototype'][_0xff94('0x10d')]=function(_0x227346){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x10e'),_0x227346['label']));return this[_0xff94('0x11')]['noop'](_0xff94('0x10d'));};AGIVertices[_0xff94('0x13')][_0xff94('0x10f')]=function(_0x399dee){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x110'),_0x399dee['label']));var _0x3a9a86='';if(_0x399dee[_0xff94('0x111')]){if(!this['isConfigured'](_0x399dee[_0xff94('0x111')])){return this['channel'][_0xff94('0x2f')](_0x399dee,_0xff94('0x112'));}else{var _0x51fcd3=parseInt(_0x399dee[_0xff94('0x111')],0xa);if(isNaN(_0x51fcd3)){_0x3a9a86=_0x399dee[_0xff94('0x111')];}else{_0x3a9a86=this[_0xff94('0x113')][_0xff94('0x72')](this,_0x399dee['trunk_id']);if(!_0x3a9a86){return this[_0xff94('0x11')]['error'](_0x399dee,_0xff94('0x114'));}}}}else if(_0x399dee['trunk_name']){_0x3a9a86=_0x399dee[_0xff94('0x115')];}else{return this['channel'][_0xff94('0x2f')](_0x399dee,_0xff94('0x112'));}var _0x23127c=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0xe7'),[util[_0xff94('0x2d')](_0xff94('0x116'),_0x3a9a86,_0x399dee['phone']),_0x399dee[_0xff94('0x65')],_0x399dee['opts'],_0x399dee['url']]);if(_0x23127c['result']===-0x1){return _0x23127c;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xeb'),_0xff94('0xe7')));};AGIVertices[_0xff94('0x13')][_0xff94('0x117')]=function(_0x786674){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x118'),_0x786674['label']));return this['channel'][_0xff94('0xaf')]('finally');};AGIVertices[_0xff94('0x13')]['getdigits']=function(_0x2a48b8){logger[_0xff94('0x31')](util['format'](_0xff94('0x119'),_0x2a48b8['label']));if(_0x2a48b8[_0xff94('0xac')]===0x0){return this[_0xff94('0xab')](_0x2a48b8);}_0x2a48b8[_0xff94('0xac')]-=0x1;if(!this[_0xff94('0x89')](_0x2a48b8[_0xff94('0x11a')])){return this[_0xff94('0x11')]['error'](_0x2a48b8,_0xff94('0x11b'));}var _0x5cdc1f=this['getSound'][_0xff94('0x72')](this,_0x2a48b8['file_id']);if(!_0x5cdc1f){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x2a48b8,_0xff94('0x11c'));}if(!this['isConfigured'](_0x2a48b8[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x32d347=this[_0xff94('0x11')][_0xff94('0x11d')](_0x5cdc1f,_0x2a48b8['response'],_0x2a48b8[_0xff94('0x11e')]);var _0x404f65=_0x32d347[_0xff94('0xa9')]?_0x32d347[_0xff94('0xa9')][_0xff94('0xa7')]():'';logger['info']('test',JSON[_0xff94('0x75')](_0x32d347));if(_0x32d347[_0xff94('0xa9')]===-0x1){this[_0xff94('0x36')][_0xff94('0x72')](this,_0x2a48b8,_0x404f65);return _0x32d347;}else if(_0x32d347['extra']==='timeout'){_0x32d347[_0xff94('0xa9')]=_0x404f65[_0xff94('0xa1')]>=parseInt(_0x2a48b8['mindigit'])?'x':'i';}else{_0x32d347[_0xff94('0xa9')]=_0x404f65[_0xff94('0xa1')]>=parseInt(_0x2a48b8[_0xff94('0x11f')])&&_0x404f65[_0xff94('0xa1')]<=parseInt(_0x2a48b8['maxdigit'])?'x':'i';}var _0x24c8be=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x2a48b8[_0xff94('0xdd')]);if(!_0x24c8be){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x2a48b8,'no\x20variable\x20found');}this[_0xff94('0x11')]['setVariable'](_0x24c8be,_0x404f65);if(this[_0xff94('0x89')](_0x2a48b8[_0xff94('0x120')])){var _0x97e18=parseInt(_0x2a48b8[_0xff94('0x120')],0xa);var _0x3a3419=rs[_0xff94('0x121')]({'charset':'*','length':_0x97e18});var _0x3f0606=_0x404f65[_0xff94('0xa1')];if(_0x3f0606>0x0){if(_0x3f0606>_0x97e18){this[_0xff94('0x36')][_0xff94('0x72')](this,_0x2a48b8,_0x2a48b8['hiddendigitspos']===_0xff94('0x122')?_0x3a3419+_0x404f65[_0xff94('0x123')](_0x97e18):_0x404f65[_0xff94('0x123')](0x0,_0x3f0606-_0x97e18)+_0x3a3419);}else{this[_0xff94('0x36')]['sync'](this,_0x2a48b8,rs[_0xff94('0x121')]({'charset':'*','length':_0x3f0606}));}}else{this[_0xff94('0x36')][_0xff94('0x72')](this,_0x2a48b8,'');}}else{this['createSquareDetailsReport'][_0xff94('0x72')](this,_0x2a48b8,_0x404f65);}return _0x32d347;};AGIVertices[_0xff94('0x13')][_0xff94('0x10')]=function(_0x18a1f0){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x124'),_0x18a1f0[_0xff94('0x38')]));return this['getdigits'](_0x18a1f0);};AGIVertices[_0xff94('0x13')][_0xff94('0x125')]=function(_0x5cf0ff){logger['info'](util['format'](_0xff94('0x126'),_0x5cf0ff[_0xff94('0x38')]));this[_0xff94('0x36')][_0xff94('0x72')](this,_0x5cf0ff,_0x5cf0ff[_0xff94('0x127')]);return this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x128'),_0x5cf0ff[_0xff94('0x127')]));};AGIVertices[_0xff94('0x13')][_0xff94('0x129')]=function(_0x4172a5){logger['info'](util[_0xff94('0x2d')](_0xff94('0x12a'),_0x4172a5['label']));if(!this[_0xff94('0x89')](_0x4172a5[_0xff94('0x91')])||!this[_0xff94('0x89')](_0x4172a5['aws_secret_access_key'])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x12b'));}if(!this[_0xff94('0x89')](_0x4172a5[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20text\x20configured');}this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x12c'),_0x4172a5['text']));var _0x14002e=this[_0xff94('0x8b')][_0xff94('0x72')](this,_0x4172a5);if(_0x14002e){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('aws\x20Polly\x20%s\x20file\x20created',_0x14002e));var _0x4e2ee1=this[_0xff94('0x11')][_0xff94('0x108')](_0x14002e);try{fs[_0xff94('0x109')](_0x14002e+'.wav');}catch(_0x2fdd7f){logger[_0xff94('0x2f')](_0x2fdd7f);}return _0x4e2ee1;}return this['channel'][_0xff94('0x2f')](_0x4172a5,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xff94('0x13')][_0xff94('0x12d')]=function(_0x5cb64d){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5cb64d[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x5cb64d['aws_access_key_id'])||!this[_0xff94('0x89')](_0x5cb64d[_0xff94('0x8c')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xff94('0x89')](_0x5cb64d['aws_bot_name'])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20bot\x20name\x20configured');}if(!this[_0xff94('0x89')](_0x5cb64d[_0xff94('0x5d')])){return this['channel'][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')]['bot']=!![];this[_0xff94('0x36')](_0x5cb64d);this[_0xff94('0x41')](_0x5cb64d['text'],'in','','');this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x12e'),_0x5cb64d[_0xff94('0x5d')]));var _0x2e2553=this[_0xff94('0x90')][_0xff94('0x72')](this,_0x5cb64d);if(_0x2e2553){for(var _0x3c5286 in _0x2e2553){if(_0x2e2553[_0xff94('0x99')](_0x3c5286)&&_[_0xff94('0x9a')](_0x2e2553[_0x3c5286])){this[_0xff94('0x11')][_0xff94('0xa3')](util[_0xff94('0x2d')](_0xff94('0x12f'),_0x3c5286[_0xff94('0x6a')]()),_0x2e2553[_0x3c5286]);}}if(_[_0xff94('0x43')](_0x2e2553[_0xff94('0x79')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xff94('0x41')](_0x2e2553[_0xff94('0x79')],_0xff94('0xf3'),_0xff94('0x130'),'');return this[_0xff94('0x11')][_0xff94('0xaf')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x2e2553[_0xff94('0x79')]));}}return this[_0xff94('0x11')]['error'](_0x5cb64d,_0xff94('0x131'));};AGIVertices['prototype'][_0xff94('0x132')]=function(_0x1a58a6){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x133'),_0x1a58a6[_0xff94('0x38')],_0x1a58a6[_0xff94('0x65')]));if(!this['isConfigured'](_0x1a58a6[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xee'));}var _0x386935=_0xff94('0x134');var _0x26d4db=util[_0xff94('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0xff94('0x121')](0x4));var _0x378f26=util['format'](_0xff94('0xa2'),_0x26d4db,_0x386935);var _0x50ef7b=!![];if(_0x1a58a6[_0xff94('0x135')]===_0xff94('0x136')){_0x50ef7b=![];}var _0x5ae675=this[_0xff94('0x11')][_0xff94('0x137')](_0x26d4db,_0x386935,_0x1a58a6[_0xff94('0x138')],_0x1a58a6[_0xff94('0x65')],undefined,_0x50ef7b);if(_0x5ae675[_0xff94('0xa9')]!==-0x1){this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x139'),_0x378f26));var _0x45e0b3=this[_0xff94('0x93')]['sync'](this,_0x1a58a6,_0x378f26);if(_0x45e0b3){for(var _0x1bd4a9 in _0x45e0b3){if(_0x45e0b3[_0xff94('0x99')](_0x1bd4a9)){this['channel']['setVariable'](util[_0xff94('0x2d')](_0xff94('0x13a'),_0x1bd4a9[_0xff94('0x6a')]()),_0x45e0b3[_0x1bd4a9]);}}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x13b'),JSON[_0xff94('0x75')](_0x45e0b3)));}}return _0x5ae675;};AGIVertices['prototype'][_0xff94('0x13c')]=function(_0x566c55){logger['info'](util[_0xff94('0x2d')](_0xff94('0x13d'),_0x566c55[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x566c55[_0xff94('0x96')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x566c55[_0xff94('0x97')])){return this['channel'][_0xff94('0xaf')](_0xff94('0x13e'));}var _0x1f4edf=_0xff94('0x134');var _0x3a3a0d=util['format'](_0xff94('0x13f'),FILES_PATH,rs[_0xff94('0x121')](0x4));var _0x554458=util['format']('%s.%s',_0x3a3a0d,_0x1f4edf);var _0x25da69=!![];if(_0x566c55[_0xff94('0x135')]===_0xff94('0x136')){_0x25da69=![];}var _0x21bed5=this['channel']['recordFile'](_0x3a3a0d,_0x1f4edf,_0x566c55[_0xff94('0x138')],_0x566c55['timeout'],undefined,_0x25da69);if(_0x21bed5['result']!==-0x1){this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x140'),_0x554458));var _0x4814f3=this[_0xff94('0x95')][_0xff94('0x72')](this,_0x566c55,_0x554458);if(_0x4814f3){for(var _0x213dca in _0x4814f3){if(_0x4814f3[_0xff94('0x99')](_0x213dca)){this[_0xff94('0x11')][_0xff94('0xa3')](util['format'](_0xff94('0x141'),_0x213dca[_0xff94('0x6a')]()),_0x4814f3[_0x213dca]);}}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x142'),JSON['stringify'](_0x4814f3)));}}return _0x21bed5;};AGIVertices[_0xff94('0x13')][_0xff94('0x143')]=function(_0x1205e5){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x144'),_0x1205e5[_0xff94('0x38')]));return this[_0xff94('0x11')][_0xff94('0x145')](_0x1205e5[_0xff94('0x146')],_0x1205e5[_0xff94('0x3c')],_0x1205e5[_0xff94('0x3d')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x147')]=function(_0x551ea3){logger[_0xff94('0x31')](util['format'](_0xff94('0x148'),_0x551ea3[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x551ea3[_0xff94('0x149')])){return this[_0xff94('0x11')]['error'](_0x551ea3,'no\x20condition\x20configured');}try{var _0x2ddb78=eval(_0x551ea3[_0xff94('0x149')])?_0xff94('0x14a'):_0xff94('0x14b');this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x551ea3['condition'],_0x2ddb78));return{'code':0xc8,'result':_0x2ddb78};}catch(_0x1eee31){return{'code':0xc8,'result':_0xff94('0x14b')};}};AGIVertices[_0xff94('0x13')][_0xff94('0x14c')]=function(_0x9a161d){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x14d'),_0x9a161d[_0xff94('0x38')]));if(!this['isConfigured'](_0x9a161d[_0xff94('0x14e')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x9a161d,_0xff94('0x14f'));}var _0x53b77e=this[_0xff94('0x28')][_0xff94('0x72')](this,_0x9a161d[_0xff94('0x14e')]);if(!_0x53b77e){return this['channel'][_0xff94('0x2f')](_0x9a161d,'no\x20intervals\x20found');}for(var _0x2c5db8=0x0;_0x2c5db8<_0x53b77e[_0xff94('0xa1')];_0x2c5db8+=0x1){var _0xc10e62=this[_0xff94('0x11')][_0xff94('0x14')](util[_0xff94('0x2d')](_0xff94('0x150'),_0x53b77e[_0x2c5db8]));if(_0xc10e62[_0xff94('0xa9')]===-0x1){return _0xc10e62;}logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x151'),_0x53b77e[_0x2c5db8],_0xc10e62[_0xff94('0xa6')]));if(_0xc10e62['extra']===_0xff94('0x14a')){logger[_0xff94('0x31')](util['format'](_0xff94('0x151'),_0x53b77e[_0x2c5db8],_0xff94('0x14a')));this['channel'][_0xff94('0xaf')](util['format']('IFTIME\x20%s\x20%s',_0x53b77e[_0x2c5db8],_0xff94('0x14a')));return{'code':0xc8,'result':'true'};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x151'),_0x53b77e[_0x2c5db8],_0xff94('0x14b')));this['channel']['noop'](util['format'](_0xff94('0x151'),_0x53b77e[_0x2c5db8],'false'));}}return{'code':0xc8,'result':_0xff94('0x14b')};};AGIVertices[_0xff94('0x13')][_0xff94('0x152')]=function(_0x5c7803){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x153'),_0x5c7803[_0xff94('0x38')]));return this[_0xff94('0x11')]['hangup']();};AGIVertices[_0xff94('0x13')][_0xff94('0x154')]=function(_0x34b777){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x34b777['label']));if(!this[_0xff94('0x89')](_0x34b777[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20key\x20configured');}var _0x250942=_0xff94('0x134');var _0x5bb18=util[_0xff94('0x2d')](_0xff94('0x13f'),FILES_PATH,rs[_0xff94('0x121')](0x4));var _0x3cab1f=util[_0xff94('0x2d')](_0xff94('0xa2'),_0x5bb18,_0x250942);var _0x47ecf7=!![];if(_0x34b777[_0xff94('0x135')]===_0xff94('0x136')){_0x47ecf7=![];}var _0x5bc5ea=this['channel']['recordFile'](_0x5bb18,_0x250942,_0x34b777['intKey'],_0x34b777['timeout'],undefined,_0x47ecf7);if(_0x5bc5ea[_0xff94('0xa9')]!==-0x1){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x155'),_0x3cab1f));var _0xb3403d=this[_0xff94('0x87')][_0xff94('0x72')](this,_0x34b777,_0x3cab1f);if(_0xb3403d){for(var _0x115a80 in _0xb3403d){if(_0xb3403d[_0xff94('0x99')](_0x115a80)){this[_0xff94('0x11')]['setVariable'](util['format'](_0xff94('0x156'),_0x115a80[_0xff94('0x6a')]()),_0xb3403d[_0x115a80]);}}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0xff94('0x75')](_0xb3403d)));}}return _0x5bc5ea;};AGIVertices['prototype'][_0xff94('0x157')]=function(_0xaa34ec){logger['info'](util[_0xff94('0x2d')](_0xff94('0x158'),_0xaa34ec[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0xaa34ec[_0xff94('0x84')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xee'));}if(!this[_0xff94('0x89')](_0xaa34ec[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0xaa34ec['text']));var _0x44165a=this[_0xff94('0x83')][_0xff94('0x72')](this,_0xaa34ec);if(_0x44165a){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('ispeech\x20%s\x20file\x20created',_0x44165a));var _0x14ab4b=this[_0xff94('0x11')]['streamFile'](_0x44165a,_0xaa34ec[_0xff94('0x138')]);try{fs['unlink'](_0x44165a+_0xff94('0x10a'));}catch(_0x506971){logger['error'](_0x506971);}return _0x14ab4b;}return this['channel'][_0xff94('0x2f')](_0xaa34ec,_0xff94('0x159'));};AGIVertices[_0xff94('0x13')][_0xff94('0x15a')]=function(_0x2e46b8){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x15b'),_0x2e46b8[_0xff94('0x38')]));if(!this['isConfigured'](_0x2e46b8[_0xff94('0x15c')])){return this['channel'][_0xff94('0x2f')](_0x2e46b8,_0xff94('0x15d'));}logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x15e'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));var _0x1eba1c=this[_0xff94('0x55')][_0xff94('0x72')](this,_0x2e46b8[_0xff94('0x15c')]);if(_0x1eba1c){logger[_0xff94('0x31')](util['format'](_0xff94('0x15f'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x15f'),this['channel'][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util['format'](_0xff94('0x161'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x161'),this['channel'][_0xff94('0x3a')],_0x2e46b8[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices[_0xff94('0x13')]['logout']=function(_0x41ce4d){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x163'),_0x41ce4d[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x41ce4d['findBy'])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x41ce4d,_0xff94('0x15d'));}logger[_0xff94('0x31')](util['format'](_0xff94('0x15e'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));var _0x3b9599=this[_0xff94('0x51')][_0xff94('0x72')](this,_0x41ce4d['findBy']);if(_0x3b9599){logger[_0xff94('0x31')](util['format'](_0xff94('0x15f'),this['channel'][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x15f'),this['channel'][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x161'),this[_0xff94('0x11')]['callerid'],_0x41ce4d[_0xff94('0x15c')]));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x161'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x41ce4d[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices[_0xff94('0x13')][_0xff94('0x164')]=function(_0x36e105){logger[_0xff94('0x31')](util['format'](_0xff94('0x165'),_0x36e105[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x36e105['operation'])){return this[_0xff94('0x11')]['error'](_0x36e105,_0xff94('0x166'));}this[_0xff94('0x11')][_0xff94('0xaf')](util['format'](_0xff94('0x167'),_0x36e105[_0xff94('0x168')]));var _0x2a6e93=eval(_0x36e105[_0xff94('0x168')]);if(!this[_0xff94('0x89')](_0x36e105['variable_id'])){return this[_0xff94('0x11')]['noop'](_0xff94('0x169'));}var _0x103e32=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x36e105['variable_id']);if(!_0x103e32){return this['channel']['error'](_0x36e105,'no\x20variable\x20found');}if(_[_0xff94('0x9e')](_0x2a6e93)){var _0xb500de=this;_0x2a6e93['forEach'](function(_0x3e47cb,_0x13bc23){_0xb500de['channel'][_0xff94('0xa3')](util[_0xff94('0x2d')](_0xff94('0x16a'),_0x103e32,_0x13bc23),_0x3e47cb);});return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x16b'),_0x103e32));}else{return this['channel'][_0xff94('0xa3')](_0x103e32,_0x2a6e93);}};AGIVertices['prototype']['menu']=function(_0x370f53){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x16c'),_0x370f53[_0xff94('0x38')]));if(_0x370f53[_0xff94('0xac')]===0x0){return this[_0xff94('0xab')](_0x370f53);}_0x370f53[_0xff94('0xac')]-=0x1;if(!this[_0xff94('0x89')](_0x370f53['file_id'])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x370f53,'no\x20file\x20audio\x20selected');}var _0x39665f=this[_0xff94('0x22')][_0xff94('0x72')](this,_0x370f53[_0xff94('0x11a')]);if(!_0x39665f){return this[_0xff94('0x11')]['error'](_0x370f53,_0xff94('0x11c'));}var _0x29a431=this[_0xff94('0x11')][_0xff94('0x11d')](_0x39665f,_0x370f53[_0xff94('0x16d')],_0x370f53['digit']);var _0x2db926=_0x29a431[_0xff94('0xa9')];if(_0x29a431[_0xff94('0xa9')]===-0x1){this[_0xff94('0x36')][_0xff94('0x72')](this,_0x370f53,'-1');return _0x29a431;}else if(_0x29a431[_0xff94('0xa6')]===_0xff94('0x65')){_0x29a431[_0xff94('0xa9')]=_0x29a431[_0xff94('0xa9')][_0xff94('0xa1')]>0x0?_0x29a431[_0xff94('0xa9')]:'t';}else if(_[_0xff94('0x16e')](_0x29a431[_0xff94('0xa9')])){_0x29a431[_0xff94('0xa9')]='#';_0x2db926='#';}if(!this[_0xff94('0x89')](_0x370f53[_0xff94('0xdd')])){this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x169'));}else{var _0x4fa3f5=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x370f53['variable_id']);if(!_0x4fa3f5){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x370f53,_0xff94('0xde'));}this[_0xff94('0x11')][_0xff94('0xa3')](_0x4fa3f5,_0x2db926);}this['createSquareDetailsReport']['sync'](this,_0x370f53,_0x2db926);return _0x29a431;};AGIVertices[_0xff94('0x13')][_0xff94('0xaf')]=function(_0x318d8b){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x318d8b['label']));return this[_0xff94('0x11')][_0xff94('0xaf')](_0x318d8b[_0xff94('0x16f')]||_0x318d8b[_0xff94('0x38')]);};AGIVertices['prototype'][_0xff94('0x170')]=function(_0x4da33d){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x171'),_0x4da33d['label']));if(!this[_0xff94('0x89')](_0x4da33d[_0xff94('0x15c')])){return this['channel']['error'](_0x4da33d,_0xff94('0x15d'));}logger[_0xff94('0x31')](util[_0xff94('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xff94('0x11')]['callerid'],_0x4da33d[_0xff94('0x15c')]));var _0xb9202e=this[_0xff94('0x4d')][_0xff94('0x72')](this,_0x4da33d[_0xff94('0x172')]);var _0x348a6f=this['agentPause']['sync'](this,_0x4da33d[_0xff94('0x15c')],_0xb9202e);if(_0x348a6f){logger['info'](util[_0xff94('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xff94('0x11')]['callerid'],_0x4da33d[_0xff94('0x15c')]));this['channel'][_0xff94('0xaf')](util['format'](_0xff94('0x15f'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x4da33d['findBy']));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x161'),this['channel']['callerid'],_0x4da33d[_0xff94('0x15c')]));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xff94('0x3a')],_0x4da33d[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices[_0xff94('0x13')]['playback']=function(_0x916146){logger['info'](util[_0xff94('0x2d')](_0xff94('0x173'),_0x916146[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x916146['file_id'])){return this['channel'][_0xff94('0x2f')](_0x916146,_0xff94('0x11b'));}var _0x1ae487=this[_0xff94('0x22')][_0xff94('0x72')](this,_0x916146[_0xff94('0x11a')]);if(!_0x1ae487){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x916146,_0xff94('0x11c'));}var _0x1ed6d2=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0x174'),[_0x1ae487,_0x916146[_0xff94('0xe9')]]);if(_0x1ed6d2[_0xff94('0xa9')]===-0x1){return _0x1ed6d2;}return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xc7'),_0xff94('0x174'),_0x1ae487));};AGIVertices['prototype']['queue']=function(_0x3072b3){logger['info'](util[_0xff94('0x2d')](_0xff94('0x175'),_0x3072b3[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x3072b3['queue_id'])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x3072b3,_0xff94('0x176'));}var _0x2bba53='';var _0x21b8a7=parseInt(_0x3072b3[_0xff94('0x177')],0xa);if(isNaN(_0x21b8a7)){_0x2bba53=_0x3072b3[_0xff94('0x177')];}else{_0x2bba53=this[_0xff94('0x178')][_0xff94('0x72')](this,_0x3072b3[_0xff94('0x177')]);if(!_0x2bba53){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x3072b3,_0xff94('0x179'));}}var _0x409f55='';if(this[_0xff94('0x89')](_0x3072b3[_0xff94('0x11a')])){var _0x2ee660=this[_0xff94('0x22')][_0xff94('0x72')](this,_0x3072b3[_0xff94('0x11a')]);if(_0x2ee660){_0x409f55=_0x2ee660;}}this[_0xff94('0x36')][_0xff94('0x72')](this,_0x3072b3,_0x2bba53);if(_0x3072b3[_0xff94('0xe9')]['indexOf']('x')<0x0){_0x3072b3[_0xff94('0xe9')]+='x';}if(_0x3072b3['opts'][_0xff94('0x17a')]('X')<0x0){_0x3072b3[_0xff94('0xe9')]+='X';}this[_0xff94('0x11')][_0xff94('0xa3')](_0xff94('0x17b'),_0x2bba53?_0x2bba53[_0xff94('0x17c')]():'');var _0x5f06be=this['channel'][_0xff94('0x57')](_0xff94('0x17d'),[_0x2bba53,_0x3072b3[_0xff94('0xe9')],_0x3072b3[_0xff94('0xea')],_0x409f55,_0x3072b3['timeout'],_0x3072b3['agi'],_0x3072b3[_0xff94('0x17e')],_0x3072b3[_0xff94('0x17f')],'',_0x3072b3[_0xff94('0x180')]]);if(_0x5f06be['result']===-0x1){return _0x5f06be;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0xc7'),'QUEUE',_0x2bba53));};AGIVertices[_0xff94('0x13')]['record']=function(_0x3d8f9a){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3d8f9a[_0xff94('0x38')]));var _0xe29e76=_0x3d8f9a['recordingFormat']||'wav';var _0x5b8497=util['format'](_0xff94('0x181'),this[_0xff94('0x11')]['uniqueid'],rs[_0xff94('0x121')](0x5));var _0x491d9f=util[_0xff94('0x2d')](_0xff94('0x182'),FILES_PATH,_0x5b8497,_0xe29e76);var _0x4d7fba=util[_0xff94('0x2d')]('%s/recordings/%s',FILES_PATH,_0x5b8497);this[_0xff94('0x3b')][_0xff94('0x72')](this,_0x3d8f9a,_0x5b8497,_0x491d9f);this[_0xff94('0x11')][_0xff94('0xa3')](_0xff94('0x183'),_0x5b8497);logger[_0xff94('0x31')](_0xff94('0x184'),_0x4d7fba,_0xe29e76,_0x3d8f9a[_0xff94('0x185')],_0x3d8f9a[_0xff94('0x65')]);return this['channel'][_0xff94('0x137')](_0x4d7fba,_0xe29e76,_0x3d8f9a[_0xff94('0x185')],_0x3d8f9a[_0xff94('0x65')],undefined,!![]);};AGIVertices[_0xff94('0x13')]['restapi']=function(_0x581b7c){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x581b7c[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x581b7c['url'])){return this[_0xff94('0x11')]['noop']('no\x20url\x20configured');}var _0x4477a1=this['restAPI'][_0xff94('0x72')](this,_0x581b7c);logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Response:',util[_0xff94('0x186')](_0x4477a1,{'showHidden':![],'depth':null})));if(!this[_0xff94('0x89')](_0x581b7c[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1846b3=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x581b7c[_0xff94('0xdd')]);if(!_0x1846b3){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x581b7c,_0xff94('0xde'));}this[_0xff94('0x11')]['setVariable'](util['format'](_0xff94('0x187'),_0x1846b3),_0x4477a1['statusCode']?_0x4477a1[_0xff94('0x78')]:'200');this[_0xff94('0x11')][_0xff94('0xa3')](util['format'](_0xff94('0x188'),_0x1846b3),_0x4477a1['statusMessage']?_0x4477a1[_0xff94('0x77')]:'OK');if(_0x4477a1[_0xff94('0x6b')]){try{this[_0xff94('0xa0')](_0x4477a1[_0xff94('0x6b')],_0x1846b3);}catch(_0x5c176f){logger[_0xff94('0x2f')](util[_0xff94('0x2d')](_0xff94('0x189'),_0x1846b3));}}return this['channel']['noop'](util[_0xff94('0x2d')](_0xff94('0xe2'),_0x1846b3));};AGIVertices[_0xff94('0x13')][_0xff94('0x18a')]=function(_0x15a836){logger['info'](util[_0xff94('0x2d')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x15a836[_0xff94('0x38')]));return this['channel'][_0xff94('0x18b')](_0x15a836['digits'][_0xff94('0x59')](/\s+/g,''),_0x15a836[_0xff94('0x185')]);};AGIVertices['prototype'][_0xff94('0x18c')]=function(_0x570fe3){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x18d'),_0x570fe3[_0xff94('0x38')]));return this[_0xff94('0x11')][_0xff94('0x18e')](_0x570fe3[_0xff94('0x18f')][_0xff94('0x59')](/\s+/g,''),_0x570fe3[_0xff94('0x185')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x190')]=function(_0x393c82){logger[_0xff94('0x31')](util['format'](_0xff94('0x191'),_0x393c82[_0xff94('0x38')]));return this['channel'][_0xff94('0x192')](_0x393c82[_0xff94('0x5d')],_0x393c82[_0xff94('0x185')]);};AGIVertices[_0xff94('0x13')][_0xff94('0x193')]=function(_0x1f089f){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x194'),_0x1f089f[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x1f089f['account_id'])){return this['channel']['noop'](_0xff94('0x195'));}var _0x1b352e=this[_0xff94('0x25')]['sync'](this,_0x1f089f[_0xff94('0x196')]);if(!_0x1b352e||!_0x1b352e[_0xff94('0x197')]){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x1f089f,'no\x20mail\x20account\x20found');}var _0x36e6c2={'from':util[_0xff94('0x2d')](_0xff94('0x198'),_0x1b352e[_0xff94('0x17')],_0x1b352e[_0xff94('0x199')]||_0x1b352e[_0xff94('0x197')]['user']),'to':_0x1f089f['to']||'','cc':_0x1f089f['cc']||'','bcc':_0x1f089f[_0xff94('0x19a')]||'','subject':_0x1f089f[_0xff94('0x19b')],'html':_0x1f089f['text'],'text':_0x1f089f[_0xff94('0x5d')]};var _0x4b13bd={'tls':{'rejectUnauthorized':![]}};if(_0x1b352e[_0xff94('0x197')][_0xff94('0x19c')]){_0x4b13bd[_0xff94('0x19c')]=_0x1b352e[_0xff94('0x197')][_0xff94('0x19c')];}else{_0x4b13bd[_0xff94('0x19d')]=_0x1b352e[_0xff94('0x197')]['host'];_0x4b13bd['port']=_0x1b352e['Smtp'][_0xff94('0x19e')];_0x4b13bd[_0xff94('0x19f')]=_0x1b352e['Smtp'][_0xff94('0x19f')];}if(_0x1b352e['Smtp'][_0xff94('0x1a0')]){_0x4b13bd[_0xff94('0x1a1')]={'user':_0x1b352e['Smtp']['user'],'pass':_0x1b352e[_0xff94('0x197')][_0xff94('0x1a2')]};}if(this[_0xff94('0x89')](_0x1f089f['template_id'])){}logger[_0xff94('0x1a3')](_0xff94('0x1a4'),JSON[_0xff94('0x75')](_0x36e6c2));this[_0xff94('0x36')][_0xff94('0x72')](this,_0x1f089f,_0x1f089f[_0xff94('0x196')]);this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1a5'),_0x1b352e[_0xff94('0x17')]));this[_0xff94('0x27')][_0xff94('0x72')](this,_0x4b13bd,_0x36e6c2);return this['channel'][_0xff94('0xaf')](_0xff94('0x1a6'));};AGIVertices[_0xff94('0x13')][_0xff94('0x1a7')]=function(_0x527334){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x527334[_0xff94('0x38')]));return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0x1a8'));};AGIVertices[_0xff94('0x13')][_0xff94('0x1a9')]=function(_0x285497){logger[_0xff94('0x31')](util['format'](_0xff94('0x1aa'),_0x285497[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x285497[_0xff94('0x1ab')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20sms\x20account\x20configured');}var _0xca53d=this['getSmsAccount'][_0xff94('0x72')](this,_0x285497[_0xff94('0x1ab')]);if(!_0xca53d){return this[_0xff94('0x11')]['error'](_0x285497,_0xff94('0x1ac'));}var _0x1e1782={'body':_0x285497[_0xff94('0x1ad')],'phone':_0x285497['to']||'','SmsAccountId':_0xca53d['id']};logger[_0xff94('0x1a3')](_0xff94('0x1ae'),JSON['stringify'](_0x1e1782));this[_0xff94('0x36')][_0xff94('0x72')](this,_0x285497,_0x285497[_0xff94('0x1ab')]);this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1af'),_0xca53d[_0xff94('0x17')]));this['createSmsMessage']['sync'](this,_0x1e1782);return this[_0xff94('0x11')]['noop'](_0xff94('0x1b0'));};AGIVertices['prototype'][_0xff94('0x1b1')]=function(_0x110ee2){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1b2'),_0x110ee2[_0xff94('0x38')]));if(!this['isConfigured'](_0x110ee2[_0xff94('0xdd')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x110ee2,_0xff94('0x1b3'));}var _0x443d93=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x110ee2[_0xff94('0xdd')]);if(!_0x443d93){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x110ee2,_0xff94('0xde'));}return this[_0xff94('0x11')][_0xff94('0xa3')](_0x443d93,_0x110ee2['variable_value']);};AGIVertices['prototype'][_0xff94('0x1b4')]=function(_0x379034){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1b5'),_0x379034[_0xff94('0x38')]));this['channel']['noop'](_0xff94('0x1b6'));if(_0x379034[_0xff94('0xbb')]===_0xff94('0x1b7')){this['channel'][_0xff94('0xaf')](_0xff94('0x1b8'));return this[_0xff94('0x11')]['answer']();}return this[_0xff94('0x11')][_0xff94('0xaf')]('Skipped\x20Answer');};AGIVertices[_0xff94('0x13')][_0xff94('0x1b9')]=function(_0x5c308e){logger['info'](util[_0xff94('0x2d')](_0xff94('0x1ba'),_0x5c308e[_0xff94('0x38')]));if(!this['isConfigured'](_0x5c308e[_0xff94('0x1bb')])){return this[_0xff94('0x11')]['error'](_0x5c308e,_0xff94('0x1bc'));}var _0x845576=this[_0xff94('0x1b')]['sync'](this,_0x5c308e[_0xff94('0x1bb')]);if(!this[_0xff94('0x89')](_0x845576)){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x5c308e,util['format'](_0xff94('0x1bd'),_0x5c308e['project_id']));}if(_0x845576===this['channel'][_0xff94('0x1be')]){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x5c308e,_0xff94('0x1bf'));}this[_0xff94('0x36')][_0xff94('0x72')](this,_0x5c308e,_0x845576);var _0xfe9ff6=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0x1c0'),util[_0xff94('0x2d')](_0xff94('0x1c1'),config['agi'][_0xff94('0x19d')]||_0xff94('0x1c2'),_0x845576,this['channel'][_0xff94('0x1be')]));if(_0xfe9ff6[_0xff94('0xa9')]===-0x1){return _0xfe9ff6;}return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Executed\x20command\x20%s\x20%s',_0xff94('0x1c0'),_0x845576));};AGIVertices['prototype']['system']=function(_0x1cda3e){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1c3'),_0x1cda3e[_0xff94('0x38')]));var _0x475113=this['shellCommand']['sync'](this,_0x1cda3e[_0xff94('0xb9')]);this[_0xff94('0x36')][_0xff94('0x72')](this,_0x1cda3e,_0x1cda3e['command']);if(this[_0xff94('0x89')](_0x1cda3e[_0xff94('0xdd')])){var _0x294066=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x1cda3e['variable_id']);if(_0x294066){this[_0xff94('0x11')]['setVariable'](_0x294066,_0x475113);return this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1c4'),_0x1cda3e[_0xff94('0xb9')],_0x294066));}}return this['channel'][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1c5'),_0x1cda3e['command']));};AGIVertices[_0xff94('0x13')][_0xff94('0x1c6')]=function(_0x44132){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x44132[_0xff94('0x38')]));_0x44132['text']=_0x44132[_0xff94('0x5d')][_0xff94('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xff94('0x89')](_0x44132['apiKey'])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20apiKey\x20configured');}if(!this[_0xff94('0x89')](_0x44132['text'])){return this[_0xff94('0x11')][_0xff94('0xaf')](_0xff94('0xad'));}this[_0xff94('0x11')][_0xff94('0xaf')](util['format'](_0xff94('0x1c7'),_0x44132[_0xff94('0x5d')]));var _0x5dcbfa=this[_0xff94('0x5a')][_0xff94('0x72')](this,_0x44132);if(_0x5dcbfa){this[_0xff94('0x11')]['noop'](util['format'](_0xff94('0x1c8'),_0x5dcbfa));var _0x4bb19a=this[_0xff94('0x11')]['streamFile'](_0x5dcbfa);try{fs[_0xff94('0x109')](_0x5dcbfa+'.wav');}catch(_0x46dd1c){logger['error'](_0x46dd1c);}return _0x4bb19a;}return this[_0xff94('0x11')][_0xff94('0x2f')](_0x44132,_0xff94('0x1c9'));};AGIVertices[_0xff94('0x13')][_0xff94('0x1ca')]=function(_0xe875cd){logger['info'](util[_0xff94('0x2d')](_0xff94('0x1cb'),_0xe875cd['label']));_0xe875cd[_0xff94('0x5d')]=_0xe875cd['text'][_0xff94('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xff94('0x89')](_0xe875cd[_0xff94('0x5d')])){return this[_0xff94('0x11')][_0xff94('0xaf')]('no\x20text\x20configured');}this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x1cc'),_0xe875cd['text']));var _0x2da0ad=this[_0xff94('0x63')][_0xff94('0x72')](this,_0xe875cd);if(_0x2da0ad){this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')]('Google\x20TTS\x20%s\x20file\x20created',_0x2da0ad));var _0x410c7b=this['channel'][_0xff94('0x108')](_0x2da0ad);try{}catch(_0x4d6570){logger[_0xff94('0x2f')](_0x4d6570);}return _0x410c7b;}return this[_0xff94('0x11')][_0xff94('0x2f')](_0xe875cd,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xff94('0x13')][_0xff94('0x1cd')]=function(_0x323335){logger[_0xff94('0x31')](util['format'](_0xff94('0x1ce'),_0x323335[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x323335[_0xff94('0x15c')])){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x323335,'no\x20find\x20by\x20configured');}logger['info'](util[_0xff94('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xff94('0x11')][_0xff94('0x3a')],_0x323335[_0xff94('0x15c')]));var _0x37615b=this[_0xff94('0x50')][_0xff94('0x72')](this,_0x323335[_0xff94('0x15c')]);if(_0x37615b){logger[_0xff94('0x31')](util[_0xff94('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xff94('0x11')]['callerid'],_0x323335[_0xff94('0x15c')]));this[_0xff94('0x11')]['noop'](util[_0xff94('0x2d')](_0xff94('0x15f'),this['channel']['callerid'],_0x323335[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x160')};}else{logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x161'),this[_0xff94('0x11')][_0xff94('0x3a')],_0x323335['findBy']));this[_0xff94('0x11')][_0xff94('0xaf')](util[_0xff94('0x2d')](_0xff94('0x161'),this['channel'][_0xff94('0x3a')],_0x323335[_0xff94('0x15c')]));return{'code':0xc8,'result':_0xff94('0x162')};}};AGIVertices['prototype']['voicemail']=function(_0x3029c6){logger[_0xff94('0x31')](util[_0xff94('0x2d')](_0xff94('0x1cf'),_0x3029c6['label']));var _0x138122=this[_0xff94('0x11')][_0xff94('0x57')](_0xff94('0x1d0'),[_0x3029c6[_0xff94('0x1d1')],_0x3029c6[_0xff94('0x7b')]]);if(_0x138122[_0xff94('0xa9')]===-0x1){return _0x138122;}return this[_0xff94('0x11')]['noop'](util['format'](_0xff94('0xc7'),_0xff94('0x1d0'),_0x3029c6[_0xff94('0x1d1')]));};AGIVertices[_0xff94('0x13')][_0xff94('0x1d2')]=function(_0x32ee2f){logger['info'](util[_0xff94('0x2d')](_0xff94('0x1d3'),_0x32ee2f[_0xff94('0x38')]));if(!this[_0xff94('0x89')](_0x32ee2f[_0xff94('0xdd')])){return this['channel'][_0xff94('0x2f')](_0x32ee2f,_0xff94('0x1b3'));}var _0x30887d=this[_0xff94('0x14')][_0xff94('0x72')](this,_0x32ee2f['variable_id']);if(!_0x30887d){return this[_0xff94('0x11')][_0xff94('0x2f')](_0x32ee2f,_0xff94('0xde'));}var _0x148ff4=this[_0xff94('0x11')][_0xff94('0x14')](_0x30887d);return{'code':0xc8,'result':_0x148ff4[_0xff94('0xa6')]?_0x148ff4['extra']:'-'};};String['prototype'][_0xff94('0xa5')]=function(_0x576c0b,_0x164ff4){return this[_0xff94('0xa4')](_0x576c0b)[_0xff94('0x1d4')](_0x164ff4);};module[_0xff94('0x1d5')]=AGIVertices; \ No newline at end of file +var _0x8ebe=['aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','getAndSetVariable','result','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','host','Smtp','secure','auth','user','pass','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','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','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','lodash','shelljs','odbc','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','getVariableById','then','name','getVoiceQueue','rpc','getVoiceQueueById','catch','prototype','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','text','google_tts_language','restAPI','url','method','timeout','number','POST','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','model','awsPolly'];(function(_0x3a4a84,_0x5c612a){var _0x245112=function(_0xd5f6a0){while(--_0xd5f6a0){_0x3a4a84['push'](_0x3a4a84['shift']());}};_0x245112(++_0x5c612a);}(_0x8ebe,0x145));var _0xe8eb=function(_0x44a329,_0x45f280){_0x44a329=_0x44a329-0x0;var _0x45f2a3=_0x8ebe[_0x44a329];return _0x45f2a3;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xe8eb('0x0'));var sh=require(_0xe8eb('0x1'));var odbc=require(_0xe8eb('0x2'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xe8eb('0x3'));var logger=require(_0xe8eb('0x4'))(_0xe8eb('0x5'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0xe8eb('0x6');var recursiveMapAttributes=[_0xe8eb('0x7'),_0xe8eb('0x8')];var verticesWithRetry=[_0xe8eb('0x9'),_0xe8eb('0xa'),_0xe8eb('0xb')];var AGIVertices=function(_0x5b3378,_0x5c3d83,_0x51e301){this[_0xe8eb('0xc')]=_0x5b3378;this['rpc']=_0x5c3d83;this[_0xe8eb('0xd')]=_0x51e301;};AGIVertices['prototype'][_0xe8eb('0xe')]=function(_0x3c7a00,_0x56285f){this['rpc'][_0xe8eb('0xf')](_0x3c7a00)[_0xe8eb('0x10')](function(_0x4b435d){_0x56285f(null,_0x4b435d?_0x4b435d[_0xe8eb('0x11')]:![]);})['catch'](function(_0x6aebfd){_0x56285f(_0x6aebfd);});};AGIVertices['prototype'][_0xe8eb('0x12')]=function(_0x33f45e,_0x55e59d){this[_0xe8eb('0x13')][_0xe8eb('0x14')](_0x33f45e)[_0xe8eb('0x10')](function(_0x443cd4){_0x55e59d(null,_0x443cd4?_0x443cd4[_0xe8eb('0x11')]:![]);})[_0xe8eb('0x15')](function(_0x162a00){_0x55e59d(_0x162a00);});};AGIVertices[_0xe8eb('0x16')]['getSquareProject']=function(_0x591c6f,_0x3e0e9){this[_0xe8eb('0x13')][_0xe8eb('0x17')](_0x591c6f)['then'](function(_0x492305){_0x3e0e9(null,_0x492305?_0x492305['name']:![]);})[_0xe8eb('0x15')](function(_0x2c2f4c){_0x3e0e9(_0x2c2f4c);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x18')]=function(_0x1ca72a,_0x297526){this['rpc'][_0xe8eb('0x19')](_0x1ca72a)[_0xe8eb('0x10')](function(_0x9cc501){_0x297526(null,_0x9cc501?_0x9cc501[_0xe8eb('0x1a')]:![]);})[_0xe8eb('0x15')](function(_0x3f1a4c){_0x297526(_0x3f1a4c);});};AGIVertices['prototype'][_0xe8eb('0x1b')]=function(_0xf33cf9,_0x4c3bff){this['rpc'][_0xe8eb('0x1c')](_0xf33cf9)[_0xe8eb('0x10')](function(_0x41867e){_0x4c3bff(null,_0x41867e?_0x41867e[_0xe8eb('0x11')]:![]);})['catch'](function(_0x41aa88){_0x4c3bff(_0x41aa88);});};AGIVertices[_0xe8eb('0x16')]['getTrunk']=function(_0x3a93c8,_0x826760){this[_0xe8eb('0x13')]['getTrunkById'](_0x3a93c8)[_0xe8eb('0x10')](function(_0x406a84){_0x826760(null,_0x406a84?_0x406a84['name']:![]);})['catch'](function(_0xa6a32f){_0x826760(_0xa6a32f);});};AGIVertices['prototype'][_0xe8eb('0x1d')]=function(_0xcb15b6,_0x524a33){var _0x3db027=this;this['rpc']['getSoundById'](_0xcb15b6)[_0xe8eb('0x10')](function(_0x1890d0){_0x524a33(null,_0x1890d0?_0x3db027[_0xe8eb('0x1e')](_0x1890d0['save_name']):![]);})[_0xe8eb('0x15')](function(_0x29e8e4){_0x524a33(_0x29e8e4);});};AGIVertices['prototype'][_0xe8eb('0x1f')]=function(_0xd563ea,_0x38887d){this[_0xe8eb('0x13')][_0xe8eb('0x20')](_0xd563ea)[_0xe8eb('0x10')](function(_0x2c40a4){_0x38887d(null,_0x2c40a4?_0x2c40a4:![]);})[_0xe8eb('0x15')](function(_0x2f65d6){_0x38887d(_0x2f65d6);});};AGIVertices['prototype'][_0xe8eb('0x21')]=function(_0x30ab40,_0x7a3302,_0x5ec750){this[_0xe8eb('0xd')][_0xe8eb('0x21')](_0x30ab40,_0x7a3302)[_0xe8eb('0x10')](function(){_0x5ec750(null);})['catch'](function(_0x5c23c8){_0x5ec750(_0x5c23c8);});};AGIVertices['prototype']['getIntervals']=function(_0x302704,_0x2df79b){this['rpc'][_0xe8eb('0x22')](_0x302704)[_0xe8eb('0x10')](function(_0x346955){if(_0x346955){if(_0x346955[_0xe8eb('0x23')]){_0x2df79b(null,[_0x346955[_0xe8eb('0x24')]]);}else{_0x2df79b(null,_[_0xe8eb('0x25')](_0x346955['Intervals'],_0xe8eb('0x24')));}}else{_0x2df79b(null,![]);}})[_0xe8eb('0x15')](function(_0x39fe3c){_0x2df79b(_0x39fe3c);});};AGIVertices[_0xe8eb('0x16')]['getSoundPath']=function(_0x477574){return util[_0xe8eb('0x26')](_0xe8eb('0x27'),FILES_PATH,_0x477574);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x28')]=function(_0xed2123,_0x55880b,_0x249898){odbc['open'](_0xed2123,function(_0x59522c){if(_0x59522c){logger[_0xe8eb('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x59522c);_0x249898(_0x59522c);}else{logger[_0xe8eb('0x2a')](_0xe8eb('0x2b'));odbc[_0xe8eb('0x2c')](_0x55880b,function(_0x3371c3,_0x345d83){if(_0x3371c3){logger['info'](_0xe8eb('0x2d'),_0x55880b);_0x249898(_0x3371c3);}else{logger[_0xe8eb('0x2a')](_0xe8eb('0x2e'),_0x55880b);odbc[_0xe8eb('0x2f')](function(_0x28cacc){if(_0x28cacc){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x28cacc);}_0x249898(null,_0x345d83);});}});}});};AGIVertices[_0xe8eb('0x16')]['getSmsAccount']=function(_0x24a02f,_0x25298b){this[_0xe8eb('0x13')]['getSmsAccountById'](_0x24a02f)[_0xe8eb('0x10')](function(_0x1b9061){_0x25298b(null,_0x1b9061?_0x1b9061:![]);})[_0xe8eb('0x15')](function(_0x9de97){_0x25298b(_0x9de97);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x30')]=function(_0x481be1,_0x295d50){this[_0xe8eb('0x13')][_0xe8eb('0x30')](_0x481be1)['then'](function(_0x3fdcd2){_0x295d50(null,_0x3fdcd2);})[_0xe8eb('0x15')](function(_0x8a5376){_0x295d50(_0x8a5376);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x31')]=function(_0x16182e,_0x1546bf,_0x22f2b1){this[_0xe8eb('0x13')][_0xe8eb('0x31')]({'uniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'node':_0x16182e[_0xe8eb('0x33')],'application':_0x16182e[_0xe8eb('0x34')],'data':_0x1546bf||null,'project_name':this[_0xe8eb('0xc')][_0xe8eb('0x35')],'callerid':this['channel'][_0xe8eb('0x36')]})[_0xe8eb('0x10')](function(_0x2e8747){if(_0x22f2b1){_0x22f2b1(null,_0x2e8747);}})['catch'](function(_0x39cb01){if(_0x22f2b1){_0x22f2b1(_0x39cb01);}});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x37')]=function(_0x2eeaad,_0x761992,_0x45ee60,_0x27250d){this['rpc'][_0xe8eb('0x37')]({'uniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'callerid':this[_0xe8eb('0xc')]['callerid'],'calleridname':this['channel'][_0xe8eb('0x38')],'context':this['channel'][_0xe8eb('0x39')],'extension':this[_0xe8eb('0xc')][_0xe8eb('0x3a')],'priority':this['channel'][_0xe8eb('0x3b')],'accountcode':this[_0xe8eb('0xc')][_0xe8eb('0x3c')],'dnid':this[_0xe8eb('0xc')][_0xe8eb('0x3d')],'projectName':this[_0xe8eb('0xc')][_0xe8eb('0x35')],'saveName':_0x761992,'filename':_0x2eeaad[_0xe8eb('0x3e')]||_0x761992,'savePath':_0x45ee60})[_0xe8eb('0x10')](function(_0xf3c5c1){_0x27250d(null,_0xf3c5c1);})['catch'](function(_0x442225){_0x27250d(_0x442225);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x3f')]=function(_0x4309d2,_0x526c0a,_0xbf92c9,_0x35f679,_0x361776){this[_0xe8eb('0x13')]['createSquareMessage']({'uniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'body':_0x4309d2,'direction':_0x526c0a,'providerName':_0xbf92c9,'providerResponse':_0x35f679})['then'](function(_0x384411){if(_0x361776){_0x361776(null,_0x384411);}})[_0xe8eb('0x15')](function(_0x37fd9c){if(_0x361776){_0x361776(_0x37fd9c);}});};AGIVertices[_0xe8eb('0x16')]['createCmContact']=function(_0x480c59,_0x69fb7b){this[_0xe8eb('0x13')][_0xe8eb('0x40')]({'firstName':_[_0xe8eb('0x41')](_0x480c59['name'])||_[_0xe8eb('0x42')](_0x480c59[_0xe8eb('0x11')])?'callback_'+Math[_0xe8eb('0x43')]():_0x480c59[_0xe8eb('0x11')],'lastName':_[_0xe8eb('0x41')](_0x480c59[_0xe8eb('0x44')])||_[_0xe8eb('0x42')](_0x480c59[_0xe8eb('0x44')])?null:_0x480c59[_0xe8eb('0x44')],'phone':_0x480c59[_0xe8eb('0x45')],'ListId':_0x480c59[_0xe8eb('0x46')],'scheduledat':_0x480c59['scheduledAt'],'callbackUniqueid':this[_0xe8eb('0xc')][_0xe8eb('0x32')],'tags':_0xe8eb('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x480c59[_0xe8eb('0x48')][_0xe8eb('0x49')](),'priority':_0x480c59[_0xe8eb('0x4a')]})[_0xe8eb('0x10')](function(_0x364f13){_0x69fb7b(null,_0x364f13);})[_0xe8eb('0x15')](function(_0x34f4fe){_0x69fb7b(_0x34f4fe);});};AGIVertices['prototype']['getPause']=function(_0xba79d8,_0x20a80a){this['rpc'][_0xe8eb('0x4b')](_0xba79d8)[_0xe8eb('0x10')](function(_0x40eb97){_0x20a80a(null,_0x40eb97?_0x40eb97[_0xe8eb('0x11')]:![]);})['catch'](function(_0x37142b){_0x20a80a(_0x37142b);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x4c')]=function(_0x2c9744,_0x7d6b95,_0x4677f6){var _0xd3c01e={'role':_0xe8eb('0x4d')};_0xd3c01e[_0x2c9744]=this[_0xe8eb('0xc')][_0xe8eb('0x36')];this[_0xe8eb('0x13')]['agentPause'](_0xd3c01e,_0x7d6b95,this[_0xe8eb('0xc')]['uniqueid'])[_0xe8eb('0x10')](function(_0x3511ac){_0x4677f6(null,_['isNil'](_0x3511ac)?![]:!![]);})[_0xe8eb('0x15')](function(_0x531ce0){logger[_0xe8eb('0x29')](_0x531ce0);_0x4677f6(null,![]);});};AGIVertices['prototype'][_0xe8eb('0x4e')]=function(_0x1b935e,_0x6cd9ed){var _0x493bee={'role':_0xe8eb('0x4d')};_0x493bee[_0x1b935e]=this[_0xe8eb('0xc')][_0xe8eb('0x36')];this['rpc']['agentUnpause'](_0x493bee)[_0xe8eb('0x10')](function(_0x3c2297){_0x6cd9ed(null,_[_0xe8eb('0x42')](_0x3c2297)?![]:!![]);})[_0xe8eb('0x15')](function(_0xa60489){logger['error'](_0xa60489);_0x6cd9ed(null,![]);});};AGIVertices[_0xe8eb('0x16')]['agentLogout']=function(_0x2ca12f,_0x508a25){var _0x380877={'role':_0xe8eb('0x4d')};_0x380877[_0x2ca12f]=this['channel'][_0xe8eb('0x36')];this[_0xe8eb('0x13')][_0xe8eb('0x4f')](_0x380877)[_0xe8eb('0x10')](function(_0x31b01b){_0x508a25(null,_[_0xe8eb('0x42')](_0x31b01b)?![]:!![]);})['catch'](function(_0x20158a){logger[_0xe8eb('0x29')](_0x20158a);_0x508a25(null,![]);});};AGIVertices[_0xe8eb('0x16')]['agentLogin']=function(_0x4bc9e0,_0x35d248){var _0x1ee4d7={'role':_0xe8eb('0x4d')};_0x1ee4d7[_0x4bc9e0]=this[_0xe8eb('0xc')]['callerid'];var _0x1bf90d=_0x4bc9e0!=_0xe8eb('0x50')?util['format'](_0xe8eb('0x51'),_0xe8eb('0x52'),this[_0xe8eb('0xc')]['callerid']):undefined;this['rpc'][_0xe8eb('0x53')](_0x1ee4d7,_0x1bf90d)[_0xe8eb('0x10')](function(_0x43c221){_0x35d248(null,_[_0xe8eb('0x42')](_0x43c221)?![]:!![]);})[_0xe8eb('0x15')](function(_0x11500b){logger[_0xe8eb('0x29')](_0x11500b);_0x35d248(null,![]);});};AGIVertices['prototype'][_0xe8eb('0x54')]=function(_0x2456e2,_0x3816b7){sh[_0xe8eb('0x55')](_[_0xe8eb('0x56')](_0x2456e2),function(_0xbde611,_0x87464e){var _0xa9e6d2=_0x87464e[_0xe8eb('0x57')](/(\r\n|\n|\r)/gm,'');_0x3816b7(null,_0xa9e6d2);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x58')]=function(_0x343987,_0x3aa243){scripts[_0xe8eb('0x58')](_0x343987[_0xe8eb('0x59')],_0x343987[_0xe8eb('0x5a')]||'text',_0x343987['text'],_0x343987[_0xe8eb('0x5b')]||_0xe8eb('0x5c'),_0x343987[_0xe8eb('0x5d')]||_0xe8eb('0x5e'),_0x343987[_0xe8eb('0x5f')]||'MP3')[_0xe8eb('0x10')](function(_0x258f95){_0x3aa243(null,_0x258f95);})[_0xe8eb('0x15')](function(_0x41c8fe){_0x3aa243(_0x41c8fe);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x60')]=function(_0x3736e7,_0x38f339){scripts['googleTTS'](_0x3736e7[_0xe8eb('0x61')],_0x3736e7[_0xe8eb('0x62')]||'en',0x1)['then'](function(_0x42d6cd){_0x38f339(null,_0x42d6cd);})['catch'](function(_0x5940f7){_0x38f339(_0x5940f7);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x63')]=function(_0xc0e30f,_0x1c7324){var _0xdfd61a={'uri':_0xc0e30f[_0xe8eb('0x64')],'method':_0xc0e30f[_0xe8eb('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xc0e30f[_0xe8eb('0x66')])===_0xe8eb('0x67')&&parseInt(_0xc0e30f[_0xe8eb('0x66')])>=0x1?parseInt(_0xc0e30f['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xe8eb('0x68'),'PUT'],_0xdfd61a[_0xe8eb('0x65')][_0xe8eb('0x69')]())){try{_0xdfd61a['body']=_0xc0e30f[_0xe8eb('0x8')]?JSON[_0xe8eb('0x6a')](_0xc0e30f[_0xe8eb('0x8')]):{};}catch(_0x2e5dc4){logger[_0xe8eb('0x29')](_0xe8eb('0x6b'),_0x2e5dc4);}}try{_0xdfd61a[_0xe8eb('0x6c')]=_0xc0e30f['rawHeaders']?JSON[_0xe8eb('0x6a')](_0xc0e30f[_0xe8eb('0x7')]):{};}catch(_0x1a7e07){logger[_0xe8eb('0x29')](_0xe8eb('0x6d'),_0x1a7e07);}if(_0xc0e30f[_0xe8eb('0x6e')]){try{var _0x5101c3=require(_0xc0e30f[_0xe8eb('0x6e')])[_0xe8eb('0x6f')](this,_0xdfd61a);_0xdfd61a[_0xe8eb('0x70')]=Mustache[_0xe8eb('0x71')](_0xc0e30f[_0xe8eb('0x64')],_0x5101c3,{},['$$','$$']);if(_0xdfd61a[_0xe8eb('0x6c')]){_0xdfd61a[_0xe8eb('0x6c')]=JSON['parse'](Mustache[_0xe8eb('0x71')](JSON['stringify'](_0xdfd61a[_0xe8eb('0x6c')]),_0x5101c3,{},['$$','$$']));}if(_0xdfd61a['body']){_0xdfd61a[_0xe8eb('0x72')]=JSON['parse'](Mustache[_0xe8eb('0x71')](JSON[_0xe8eb('0x73')](_0xdfd61a[_0xe8eb('0x72')]),_0x5101c3,{},['$$','$$']));}}catch(_0x3788b4){logger[_0xe8eb('0x29')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3788b4);}}rp(_0xdfd61a)[_0xe8eb('0x10')](function(_0x5d8552){var _0x49da50={'statusCode':_0x5d8552[_0xe8eb('0x74')]||0xc8,'statusMessage':_0x5d8552[_0xe8eb('0x75')]||'OK','headers':_0x5d8552[_0xe8eb('0x6c')]||{},'body':_0x5d8552['body']||{}};_0x1c7324(null,_0x49da50);})[_0xe8eb('0x15')](function(_0x1017f1){var _0x21128a={'statusCode':_0x1017f1[_0xe8eb('0x74')]||0x1f4,'statusMessage':_0x1017f1[_0xe8eb('0x76')]||_0xe8eb('0x77'),'headers':_0x1017f1[_0xe8eb('0x78')][_0xe8eb('0x6c')]||{},'body':_0x1017f1[_0xe8eb('0x78')][_0xe8eb('0x72')]||{}};_0x1c7324(null,_0x21128a);});};AGIVertices['prototype'][_0xe8eb('0x79')]=function(_0x5248b6,_0x3deeb6){scripts[_0xe8eb('0x79')](this[_0xe8eb('0xc')][_0xe8eb('0x32')],_0x5248b6[_0xe8eb('0x7a')],_0x5248b6['text'],_0x5248b6[_0xe8eb('0x7b')]||'en')['then'](function(_0x41f0fc){_0x3deeb6(null,_0x41f0fc);})[_0xe8eb('0x15')](function(_0x1fc761){_0x3deeb6(_0x1fc761);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x7c')]=function(_0x48c99d,_0x29f88a){scripts[_0xe8eb('0x7c')](this[_0xe8eb('0xc')][_0xe8eb('0x32')],_0x48c99d['dialogflowV2_project_id'],_0x48c99d[_0xe8eb('0x7d')],_0x48c99d[_0xe8eb('0x7e')],_0x48c99d[_0xe8eb('0x61')],_0x48c99d[_0xe8eb('0x7f')]||'en')['then'](function(_0x35a38e){_0x29f88a(null,_0x35a38e);})['catch'](function(_0x1777df){_0x29f88a(_0x1777df);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x80')]=function(_0x4207d6,_0xea8491){scripts[_0xe8eb('0x80')](this[_0xe8eb('0xc')],_0x4207d6)[_0xe8eb('0x10')](function(_0x2b016e){_0xea8491(null,_0x2b016e);})[_0xe8eb('0x15')](function(_0x140e5e){_0xea8491(_0x140e5e);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x81')]=function(_0x342e2e,_0x5b2caa){scripts[_0xe8eb('0x81')](_0x342e2e['key'],_0x342e2e[_0xe8eb('0x61')],_0x342e2e['ispeech_tts_language']||_0xe8eb('0x5c'),_0x342e2e[_0xe8eb('0x82')])['then'](function(_0x448e52){_0x5b2caa(null,_0x448e52);})[_0xe8eb('0x15')](function(_0x1d8577){_0x5b2caa(_0x1d8577);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x83')]=function(_0xa6d79e,_0x148158,_0x15fe31){scripts[_0xe8eb('0x83')](_0x148158,_0xa6d79e[_0xe8eb('0x7a')],_0xa6d79e['ispeech_asr_language']||_0xe8eb('0x5c'),this['isConfigured'](_0xa6d79e[_0xe8eb('0x84')])?_0xa6d79e[_0xe8eb('0x84')]:undefined)[_0xe8eb('0x10')](function(_0x51d37a){_0x15fe31(null,_0x51d37a);})[_0xe8eb('0x15')](function(_0x1f8d5c){_0x15fe31(_0x1f8d5c);});};AGIVertices[_0xe8eb('0x16')]['awsPolly']=function(_0xf552e,_0x5e28ab){scripts[_0xe8eb('0x85')](_0xf552e[_0xe8eb('0x86')],_0xf552e[_0xe8eb('0x87')],_0xf552e[_0xe8eb('0x88')],_0xf552e['aws_polly_voice']||_0xe8eb('0x89'),_0xf552e[_0xe8eb('0x61')],_0xf552e['aws_text_type']||_0xe8eb('0x61'))[_0xe8eb('0x10')](function(_0x1377ee){_0x5e28ab(null,_0x1377ee);})['catch'](function(_0x166f20){_0x5e28ab(_0x166f20);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x8a')]=function(_0x558e6a,_0x1a575f){scripts['awsLex'](this[_0xe8eb('0xc')][_0xe8eb('0x32')],_0x558e6a[_0xe8eb('0x86')],_0x558e6a[_0xe8eb('0x87')],_0x558e6a[_0xe8eb('0x8b')],_0x558e6a[_0xe8eb('0x61')],_0x558e6a[_0xe8eb('0x8c')])[_0xe8eb('0x10')](function(_0x23e2ea){_0x1a575f(null,_0x23e2ea);})[_0xe8eb('0x15')](function(_0x304cb3){_0x1a575f(_0x304cb3);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x8d')]=function(_0x329c79,_0x430a76,_0x358dbf){scripts[_0xe8eb('0x8d')](_0x430a76,_0x329c79['key'],_0x329c79[_0xe8eb('0x8e')]||_0xe8eb('0x5c'))['then'](function(_0x19318b){_0x358dbf(null,_0x19318b);})[_0xe8eb('0x15')](function(_0x576a97){_0x358dbf(_0x576a97);});};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x8f')]=function(_0x5bce77,_0x2d134e,_0x561907){scripts[_0xe8eb('0x8f')](_0x2d134e,_0x5bce77[_0xe8eb('0x90')],_0x5bce77['appsecret'],_0x5bce77[_0xe8eb('0x70')])[_0xe8eb('0x10')](function(_0x409bfa){_0x561907(null,_0x409bfa);})['catch'](function(_0x2b96ce){_0x561907(_0x2b96ce);});};AGIVertices['prototype'][_0xe8eb('0x91')]=function(_0x13c917){var _0x69bc8=_[_0xe8eb('0x92')](verticesWithRetry,_0x13c917[_0xe8eb('0x34')])?_0x13c917:_[_0xe8eb('0x93')](_0x13c917);for(var _0x35c94b in _0x69bc8){if(_0x69bc8[_0xe8eb('0x94')](_0x35c94b)){if(_0x69bc8[_0x35c94b]&&_['isString'](_0x69bc8[_0x35c94b])){if(_['includes'](recursiveMapAttributes,_0x35c94b)){_0x69bc8[_0x35c94b]=this[_0xe8eb('0x95')](_0x69bc8[_0x35c94b]);}else{_0x69bc8[_0x35c94b]=this[_0xe8eb('0x96')](_0x69bc8[_0x35c94b]);}}}}return _0x69bc8;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x97')]=function(_0x729b76){for(var _0x4919a1 in _0x729b76){if(_0x729b76['hasOwnProperty'](_0x4919a1)){if(_['isPlainObject'](_0x729b76[_0x4919a1])){this['recursiveNodeIndex'](_0x729b76[_0x4919a1]);}else if(_[_0xe8eb('0x98')](_0x729b76[_0x4919a1])){for(var _0x4d708b=0x0;_0x4d708b<_0x729b76[_0x4919a1][_0xe8eb('0x99')];_0x4d708b++){this['recursiveNodeIndex'](_0x729b76[_0x4919a1][_0x4d708b]);}}else if(_[_0xe8eb('0x9a')](_0x729b76[_0x4919a1])){_0x729b76[_0x4919a1]=this[_0xe8eb('0x96')](_0x729b76[_0x4919a1]);}}}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x9b')]=function(_0x5d491f,_0x31f040){for(var _0x194838 in _0x5d491f){if(_0x5d491f[_0xe8eb('0x94')](_0x194838)){if(_['isPlainObject'](_0x5d491f[_0x194838])){if(!_[_0xe8eb('0x41')](_0x5d491f[_0x194838])){this[_0xe8eb('0x9b')](_0x5d491f[_0x194838],util[_0xe8eb('0x26')](_0xe8eb('0x9c'),_0x31f040,_0x194838));}}else if(_[_0xe8eb('0x98')](_0x5d491f[_0x194838])){for(var _0x5f04e0=0x0;_0x5f04e0<_0x5d491f[_0x194838]['length'];_0x5f04e0++){this['saveRestApiResult'](_0x5d491f[_0x194838][_0x5f04e0],util[_0xe8eb('0x26')](_0xe8eb('0x9c'),_0x31f040,_0x194838+'['+_0x5f04e0+']'));}}else{if(!_[_0xe8eb('0x42')](_0x5d491f[_0x194838])){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')]('%s.%s',_0x31f040,_0x194838),_0x5d491f[_0x194838]);}}}}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x95')]=function(_0x51b259){try{var _0xa07a82=JSON[_0xe8eb('0x6a')](_0x51b259);this['recursiveNodeIndex'](_0xa07a82);return JSON['stringify'](_0xa07a82);}catch(_0x4e93d2){return this['replaceAllVariables'](_0x51b259);}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x96')]=function(_0x34ab78){var _0x29972f=_0x34ab78['split']('{');for(var _0x58985d=0x1;_0x58985d<_0x29972f[_0xe8eb('0x99')];_0x58985d+=0x1){var _0x45da39=_0x29972f[_0x58985d]['split']('}');if(_0x45da39[_0xe8eb('0x99')]>0x1){_0x34ab78=_0x34ab78[_0xe8eb('0x9e')]('{'+_0x45da39[0x0]+'}',this['channel']['getVariable'](_0x45da39[0x0])[_0xe8eb('0x9f')]||_0x45da39[0x0]);}}if(_0x29972f['length']===0x1){return _0x34ab78[_0xe8eb('0x49')]();}return this[_0xe8eb('0x96')](_0x34ab78);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa0')]=function(_0x1a5bbe,_0x421c98){var _0x8f2e0=this[_0xe8eb('0xc')][_0xe8eb('0xe')](_0x1a5bbe);if(_0x8f2e0[_0xe8eb('0xa1')]===-0x1){return _0x8f2e0;}logger[_0xe8eb('0x2a')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x421c98,_0x8f2e0[_0xe8eb('0x9f')]));return this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x421c98,_0x8f2e0[_0xe8eb('0x9f')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa2')]=function(_0x333e3a){return _0x333e3a&&_0x333e3a!=='0'&&_0x333e3a!=='-1'&&_0x333e3a!=='';};AGIVertices['prototype'][_0xe8eb('0xa3')]=function(_0x54293f){this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x54293f,'-');_0x54293f[_0xe8eb('0xa4')]=_0x54293f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa5')]=function(_0x1ceffd){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0xa6'),_0x1ceffd[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x1ceffd[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')]['noop']('no\x20text\x20configured');}var _0x3c3ea3='\x22'+_0x1ceffd['text']+'\x22';if(this[_0xe8eb('0xa2')](_0x1ceffd[_0xe8eb('0x78')])){_0x3c3ea3+=','+_0x1ceffd[_0xe8eb('0x78')];}var _0x28514e=this[_0xe8eb('0xc')][_0xe8eb('0x55')]('MRCPSynth',_0x3c3ea3);if(_0x28514e[_0xe8eb('0xa1')]===-0x1){return _0x28514e;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xa8'),_0x3c3ea3));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xa9')]=function(_0x23d848){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x23d848[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x23d848['grammar'])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0xaa'));}var _0x4f9b1b=_0x23d848[_0xe8eb('0xab')];if(this['isConfigured'](_0x23d848[_0xe8eb('0x78')])){_0x4f9b1b+=','+_0x23d848[_0xe8eb('0x78')];}var _0x351cb9=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xac'),_0x4f9b1b);if(_0x351cb9[_0xe8eb('0xa1')]===-0x1){return _0x351cb9;}var _0x3987d8=this[_0xe8eb('0xa0')](_0xe8eb('0xad'),'MRCP_RECOG_CONFIDENCE');if(_0x3987d8[_0xe8eb('0xa1')]===-0x1){return _0x3987d8;}var _0x52bdd7=this[_0xe8eb('0xa0')]('RECOG_INPUT()',_0xe8eb('0xae'));if(_0x52bdd7['result']===-0x1){return _0x52bdd7;}var _0x31309a=this[_0xe8eb('0xa0')](_0xe8eb('0xaf'),_0xe8eb('0xb0'));if(_0x31309a['result']===-0x1){return _0x31309a;}return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4f9b1b));};AGIVertices[_0xe8eb('0x16')]['agi']=function(_0x267613){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0xb1'),_0x267613[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0x5')]([_0x267613[_0xe8eb('0xb2')],_0x267613[_0xe8eb('0xb3')]]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xb4')]=function(_0xa5b2ea){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0xb5'),_0xa5b2ea[_0xe8eb('0x33')]));if(this[_0xe8eb('0xa2')](_0xa5b2ea['timeout'])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0xa5b2ea['timeout']));var _0x86b17d=this[_0xe8eb('0xc')][_0xe8eb('0xb6')](_0xa5b2ea[_0xe8eb('0x66')]);if(_0x86b17d[_0xe8eb('0xa1')]===-0x1){return _0x86b17d;}}return this['channel'][_0xe8eb('0xb4')]();};AGIVertices['prototype'][_0xe8eb('0x47')]=function(_0x2d593a){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0xb7'),_0x2d593a['label']));if(!this['isConfigured'](_0x2d593a[_0xe8eb('0x46')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x2d593a,_0xe8eb('0xb8'));}_0x2d593a[_0xe8eb('0x48')]=moment();if(this[_0xe8eb('0xa2')](_0x2d593a[_0xe8eb('0xb9')])){_0x2d593a['scheduledAt']=moment()[_0xe8eb('0xba')](_0x2d593a[_0xe8eb('0xb9')],_0xe8eb('0xbb'));}if(!this[_0xe8eb('0xa2')](_0x2d593a[_0xe8eb('0x4a')])){_0x2d593a[_0xe8eb('0x4a')]=0x2;}this['createCmContact'][_0xe8eb('0x6f')](this,_0x2d593a);return this['channel']['noop'](util[_0xe8eb('0x26')](_0xe8eb('0xbc'),_0x2d593a['phone'],_0x2d593a[_0xe8eb('0x46')],_0x2d593a[_0xe8eb('0x48')]));};AGIVertices[_0xe8eb('0x16')]['custom_app']=function(_0x5122e5){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0xbd'),_0x5122e5[_0xe8eb('0x33')]));var _0x22e9cd=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0x5122e5[_0xe8eb('0xbe')],_0x5122e5[_0xe8eb('0x78')]);if(_0x22e9cd[_0xe8eb('0xa1')]===-0x1){return _0x22e9cd;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Executed\x20command\x20%s\x20%s',_0x5122e5[_0xe8eb('0xbe')],_0x5122e5['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x42201f){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x42201f[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x42201f['text'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}var _0x17fb85='\x22'+_0x42201f['text']+'\x22';if(this['isConfigured'](_0x42201f['options'])){_0x17fb85+=','+_0x42201f[_0xe8eb('0x78')];}var _0x26b2c2=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xc0'),_0x17fb85);if(_0x26b2c2[_0xe8eb('0xa1')]===-0x1){return _0x26b2c2;}return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xa8'),_0x17fb85));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xc1')]=function(_0x60355b){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xc2'),_0x60355b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x60355b['text'])){return this['channel'][_0xe8eb('0xa7')]('no\x20text\x20configured');}var _0x52f22b='\x22'+_0x60355b[_0xe8eb('0x61')]+'\x22';if(this[_0xe8eb('0xa2')](_0x60355b[_0xe8eb('0x78')])){_0x52f22b+=','+_0x60355b[_0xe8eb('0x78')];}var _0x1a9978=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xc0'),_0x52f22b);if(_0x1a9978[_0xe8eb('0xa1')]===-0x1){return _0x1a9978;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xa8'),_0x52f22b));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xc3')]=function(_0x5be623){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xc4'),_0x5be623[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5be623[_0xe8eb('0xab')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xaa'));}var _0x279274=_0x5be623['grammar'];if(this[_0xe8eb('0xa2')](_0x5be623[_0xe8eb('0x78')])){_0x279274+=','+_0x5be623[_0xe8eb('0x78')];}var _0x33b536=this['channel']['exec'](_0xe8eb('0xac'),_0x279274);if(_0x33b536[_0xe8eb('0xa1')]===-0x1){return _0x33b536;}var _0x319a83=this[_0xe8eb('0xa0')](_0xe8eb('0xad'),_0xe8eb('0xc5'));if(_0x319a83[_0xe8eb('0xa1')]===-0x1){return _0x319a83;}var _0xd85b47=this[_0xe8eb('0xa0')](_0xe8eb('0xc6'),_0xe8eb('0xc7'));if(_0xd85b47[_0xe8eb('0xa1')]===-0x1){return _0xd85b47;}var _0x2df7ac=this[_0xe8eb('0xa0')](_0xe8eb('0xaf'),_0xe8eb('0xc8'));if(_0x2df7ac[_0xe8eb('0xa1')]===-0x1){return _0x2df7ac;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xc9'),_0x279274));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xca')]=function(_0x31fe5b){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xcb'),_0x31fe5b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x31fe5b['grammar'])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xaa'));}var _0x8b33fa=_0x31fe5b[_0xe8eb('0xab')];if(this[_0xe8eb('0xa2')](_0x31fe5b[_0xe8eb('0x78')])){_0x8b33fa+=','+_0x31fe5b['options'];}var _0x54d687=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xac'),_0x8b33fa);if(_0x54d687[_0xe8eb('0xa1')]===-0x1){return _0x54d687;}var _0x448f2c=this[_0xe8eb('0xa0')](_0xe8eb('0xad'),_0xe8eb('0xcc'));if(_0x448f2c[_0xe8eb('0xa1')]===-0x1){return _0x448f2c;}var _0x2039aa=this[_0xe8eb('0xa0')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x2039aa[_0xe8eb('0xa1')]===-0x1){return _0x2039aa;}var _0x4bb07d=this[_0xe8eb('0xa0')](_0xe8eb('0xaf'),_0xe8eb('0xcd'));if(_0x4bb07d['result']===-0x1){return _0x4bb07d;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0xc9'),_0x8b33fa));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xce')]=function(_0x5c4533){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xcf'),_0x5c4533[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x5c4533[_0xe8eb('0xd0')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c4533,'no\x20database\x20selected');}var _0x5c6347=this[_0xe8eb('0x18')][_0xe8eb('0x6f')](this,_0x5c4533[_0xe8eb('0xd0')]);if(!_0x5c6347){return this['channel'][_0xe8eb('0x29')](_0x5c4533,_0xe8eb('0xd1'));}if(!this[_0xe8eb('0xa2')](_0x5c4533[_0xe8eb('0x2c')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c4533,_0xe8eb('0xd2'));}var _0x517858=_0x5c4533['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xd3'),_0x517858));var _0x4eb8a9=this[_0xe8eb('0x28')]['sync'](this,_0x5c6347,_0x517858);this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x5c4533,_0x517858);if(!this[_0xe8eb('0xa2')](_0x5c4533[_0xe8eb('0xd4')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xd5'));}var _0x1e72f4=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x5c4533['variable_id']);if(!_0x1e72f4){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c4533,_0xe8eb('0xd6'));}var _0x3ef0e0=this;_0x4eb8a9['forEach'](function(_0x4d089f,_0x46a4d1){Object[_0xe8eb('0xd7')](_0x4d089f)[_0xe8eb('0xd8')](function(_0x3490cb){_0x3ef0e0[_0xe8eb('0xc')][_0xe8eb('0x9d')](util['format']('%s[%s][%s]',_0x1e72f4,_0x46a4d1,_0x3490cb),_0x4d089f[_0x3490cb]);});});this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0xd9'),_0x1e72f4),_0x4eb8a9[_0xe8eb('0x99')]);return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xda'),_0x1e72f4));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xdb')]=function(_0x323c87){logger[_0xe8eb('0xdc')](util[_0xe8eb('0x26')](_0xe8eb('0xdd'),_0x323c87[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x323c87[_0xe8eb('0xde')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x323c87,'no\x20user\x20selected');}var _0x4c52fd=this['getUser'][_0xe8eb('0x6f')](this,_0x323c87[_0xe8eb('0xde')]);if(!_0x4c52fd){return this[_0xe8eb('0xc')]['error'](_0x323c87,'no\x20user\x20found');}var _0x16b994=this['channel']['exec']('DIAL',[util[_0xe8eb('0x26')](_0xe8eb('0xdf'),_0x4c52fd),_0x323c87[_0xe8eb('0x66')],_0x323c87['opts'],_0x323c87['url']]);if(_0x16b994[_0xe8eb('0xa1')]===-0x1){return _0x16b994;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0xe0'),_0xe8eb('0xe1')));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xe2')]=function(_0x5b4d6b){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xe3'),_0x5b4d6b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5b4d6b[_0xe8eb('0x7a')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x5b4d6b[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this['channel'][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0x5b4d6b);this[_0xe8eb('0x3f')](_0x5b4d6b['text'],'in','','');this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xe5'),_0x5b4d6b['text']));var _0x3593e9=this[_0xe8eb('0x79')]['sync'](this,_0x5b4d6b);if(_0x3593e9){for(var _0x2483d6 in _0x3593e9){if(_0x3593e9[_0xe8eb('0x94')](_0x2483d6)){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0xe6'),_0x2483d6[_0xe8eb('0x69')]()),_0x3593e9[_0x2483d6]);}}this['createSquareMessage'](_0x3593e9[_0xe8eb('0xe7')],_0xe8eb('0xe8'),_0xe8eb('0xe2'),'');return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Dialogflow\x20Result\x20%s',_0x3593e9[_0xe8eb('0xe7')]));}return this['channel'][_0xe8eb('0x29')](_0x5b4d6b,_0xe8eb('0xe9'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xea')]=function(_0x3f6632){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0xeb'),_0x3f6632[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x3f6632[_0xe8eb('0xec')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xed'));}if(!this[_0xe8eb('0xa2')](_0x3f6632[_0xe8eb('0x7d')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20client_email\x20configured');}if(!this[_0xe8eb('0xa2')](_0x3f6632[_0xe8eb('0x7e')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3f6632['dialogflowV2_language'])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0xee'));}if(!this[_0xe8eb('0xa2')](_0x3f6632[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0x3f6632);this[_0xe8eb('0x3f')](_0x3f6632[_0xe8eb('0x61')],'in','','');this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xef'),_0x3f6632[_0xe8eb('0x61')]));var _0x33edae=this[_0xe8eb('0x7c')][_0xe8eb('0x6f')](this,_0x3f6632);if(_0x33edae){for(var _0x56a788 in _0x33edae){if(_0x33edae[_0xe8eb('0x94')](_0x56a788)){if(_0x56a788!==_0xe8eb('0xf0')){this['channel']['setVariable'](util[_0xe8eb('0x26')](_0xe8eb('0xe6'),_0x56a788[_0xe8eb('0x69')]()),_0x33edae[_0x56a788]);}}}this['createSquareMessage'](_0x33edae[_0xe8eb('0xe7')],_0xe8eb('0xe8'),_0xe8eb('0xea'),_0x33edae[_0xe8eb('0xf0')]);return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('DialogflowV2\x20Result\x20%s',_0x33edae['speech']));}return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x3f6632,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xe8eb('0x16')]['sesteknda']=function(_0x5d474d){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0xf1'),_0x5d474d['label']));if(!this[_0xe8eb('0xa2')](_0x5d474d[_0xe8eb('0xf2')])){return this['channel']['noop'](_0xe8eb('0xf3'));}if(!this[_0xe8eb('0xa2')](_0x5d474d['username'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xf4'));}if(!this['isConfigured'](_0x5d474d[_0xe8eb('0xf5')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x5d474d[_0xe8eb('0xf6')])){return this['channel']['noop'](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0x5d474d);this['createSquareMessage'](_0x5d474d[_0xe8eb('0x61')],'in','','');this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xf7'),_0x5d474d[_0xe8eb('0x61')]));var _0x14fd52=this['sestekNDA'][_0xe8eb('0x6f')](this,_0x5d474d);if(_0x14fd52){for(var _0x53d56e in _0x14fd52){if(_0x14fd52[_0xe8eb('0x94')](_0x53d56e)){this[_0xe8eb('0xc')]['setVariable'](util[_0xe8eb('0x26')](_0xe8eb('0xf8'),_0x53d56e[_0xe8eb('0x69')]()),_0x14fd52[_0x53d56e]);}}this[_0xe8eb('0x3f')](_0x14fd52['speech'],'out',_0xe8eb('0xf9'),'');if(_0x14fd52[_0xe8eb('0xfa')]){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x14fd52[_0xe8eb('0xfa')]));var _0x2b8358=this[_0xe8eb('0xc')]['streamFile'](_0x14fd52[_0xe8eb('0xfa')]);try{fs[_0xe8eb('0xfb')](_0x14fd52['audiofile']+_0xe8eb('0xfc'));}catch(_0x31b7e0){logger[_0xe8eb('0x29')](_0x31b7e0);}return _0x2b8358;}else{return this[_0xe8eb('0xc')]['noop'](util['format'](_0xe8eb('0xfd'),_0x14fd52[_0xe8eb('0xe7')]));}}return this['channel']['error'](_0x5d474d,_0xe8eb('0xfe'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xff')]=function(_0x1fbc0a){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x100'),_0x1fbc0a[_0xe8eb('0x33')]));return this['channel']['noop'](_0xe8eb('0xff'));};AGIVertices['prototype'][_0xe8eb('0x101')]=function(_0x59af0f){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x59af0f[_0xe8eb('0x33')]));var _0x12637e='';if(_0x59af0f[_0xe8eb('0x102')]){if(!this['isConfigured'](_0x59af0f[_0xe8eb('0x102')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x59af0f,_0xe8eb('0x103'));}else{var _0x18b6e9=parseInt(_0x59af0f[_0xe8eb('0x102')],0xa);if(isNaN(_0x18b6e9)){_0x12637e=_0x59af0f[_0xe8eb('0x102')];}else{_0x12637e=this[_0xe8eb('0x104')][_0xe8eb('0x6f')](this,_0x59af0f['trunk_id']);if(!_0x12637e){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x59af0f,_0xe8eb('0x105'));}}}}else if(_0x59af0f[_0xe8eb('0x106')]){_0x12637e=_0x59af0f[_0xe8eb('0x106')];}else{return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x59af0f,_0xe8eb('0x103'));}var _0x3281de=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0xe1'),[util['format']('SIP/%s/%s',_0x12637e,_0x59af0f[_0xe8eb('0x45')]),_0x59af0f['timeout'],_0x59af0f[_0xe8eb('0x107')],_0x59af0f[_0xe8eb('0x64')]]);if(_0x3281de[_0xe8eb('0xa1')]===-0x1){return _0x3281de;}return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0xe0'),_0xe8eb('0xe1')));};AGIVertices['prototype'][_0xe8eb('0x108')]=function(_0x5cb089){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x109'),_0x5cb089['label']));return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x108'));};AGIVertices['prototype'][_0xe8eb('0xa')]=function(_0x216fb6){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x10a'),_0x216fb6[_0xe8eb('0x33')]));if(_0x216fb6[_0xe8eb('0xa4')]===0x0){return this['maxRetry'](_0x216fb6);}_0x216fb6[_0xe8eb('0xa4')]-=0x1;if(!this[_0xe8eb('0xa2')](_0x216fb6[_0xe8eb('0x10b')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x216fb6,_0xe8eb('0x10c'));}var _0x457ffa=this[_0xe8eb('0x1d')]['sync'](this,_0x216fb6[_0xe8eb('0x10b')]);if(!_0x457ffa){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x216fb6,'no\x20file\x20audio\x20found');}if(!this[_0xe8eb('0xa2')](_0x216fb6['variable_id'])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xe8eb('0xd5'));}var _0x4b7757=this[_0xe8eb('0xc')][_0xe8eb('0x10d')](_0x457ffa,_0x216fb6['response'],_0x216fb6[_0xe8eb('0x10e')]);var _0x1dd088=_0x4b7757[_0xe8eb('0xa1')]?_0x4b7757['result'][_0xe8eb('0x49')]():'';logger[_0xe8eb('0x2a')]('test',JSON[_0xe8eb('0x73')](_0x4b7757));if(_0x4b7757[_0xe8eb('0xa1')]===-0x1){this[_0xe8eb('0x31')]['sync'](this,_0x216fb6,_0x1dd088);return _0x4b7757;}else if(_0x4b7757[_0xe8eb('0x9f')]===_0xe8eb('0x66')){_0x4b7757[_0xe8eb('0xa1')]=_0x1dd088['length']>=parseInt(_0x216fb6['mindigit'])?'x':'i';}else{_0x4b7757[_0xe8eb('0xa1')]=_0x1dd088['length']>=parseInt(_0x216fb6[_0xe8eb('0x10f')])&&_0x1dd088[_0xe8eb('0x99')]<=parseInt(_0x216fb6['maxdigit'])?'x':'i';}var _0x145b2b=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x216fb6[_0xe8eb('0xd4')]);if(!_0x145b2b){return this['channel'][_0xe8eb('0x29')](_0x216fb6,'no\x20variable\x20found');}this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x145b2b,_0x1dd088);if(this[_0xe8eb('0xa2')](_0x216fb6[_0xe8eb('0x110')])){var _0x5d9a7e=parseInt(_0x216fb6[_0xe8eb('0x110')],0xa);var _0x3966dd=rs[_0xe8eb('0x111')]({'charset':'*','length':_0x5d9a7e});var _0x360723=_0x1dd088['length'];if(_0x360723>0x0){if(_0x360723>_0x5d9a7e){this['createSquareDetailsReport'][_0xe8eb('0x6f')](this,_0x216fb6,_0x216fb6[_0xe8eb('0x112')]===_0xe8eb('0x113')?_0x3966dd+_0x1dd088['substr'](_0x5d9a7e):_0x1dd088['substr'](0x0,_0x360723-_0x5d9a7e)+_0x3966dd);}else{this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x216fb6,rs[_0xe8eb('0x111')]({'charset':'*','length':_0x360723}));}}else{this['createSquareDetailsReport'][_0xe8eb('0x6f')](this,_0x216fb6,'');}}else{this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x216fb6,_0x1dd088);}return _0x4b7757;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0xb')]=function(_0x4be9ec){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x114'),_0x4be9ec[_0xe8eb('0x33')]));return this[_0xe8eb('0xa')](_0x4be9ec);};AGIVertices['prototype'][_0xe8eb('0x115')]=function(_0x40109a){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x116'),_0x40109a[_0xe8eb('0x33')]));this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x40109a,_0x40109a[_0xe8eb('0x117')]);return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0x118'),_0x40109a[_0xe8eb('0x117')]));};AGIVertices['prototype'][_0xe8eb('0x119')]=function(_0x411031){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x11a'),_0x411031[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x411031[_0xe8eb('0x86')])||!this[_0xe8eb('0xa2')](_0x411031[_0xe8eb('0x87')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x11b'));}if(!this[_0xe8eb('0xa2')](_0x411031[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x11c'),_0x411031[_0xe8eb('0x61')]));var _0x50f955=this[_0xe8eb('0x85')]['sync'](this,_0x411031);if(_0x50f955){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format'](_0xe8eb('0x11d'),_0x50f955));var _0x2670dd=this[_0xe8eb('0xc')][_0xe8eb('0x11e')](_0x50f955);try{fs['unlink'](_0x50f955+_0xe8eb('0xfc'));}catch(_0x35d144){logger[_0xe8eb('0x29')](_0x35d144);}return _0x2670dd;}return this['channel'][_0xe8eb('0x29')](_0x411031,_0xe8eb('0x11f'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x120')]=function(_0xeb65e6){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x121'),_0xeb65e6['label']));if(!this[_0xe8eb('0xa2')](_0xeb65e6[_0xe8eb('0x86')])||!this[_0xe8eb('0xa2')](_0xeb65e6[_0xe8eb('0x87')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe8eb('0xa2')](_0xeb65e6['aws_bot_name'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0xe8eb('0xa2')](_0xeb65e6[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20text\x20configured');}this[_0xe8eb('0xc')][_0xe8eb('0xe4')]=!![];this[_0xe8eb('0x31')](_0xeb65e6);this[_0xe8eb('0x3f')](_0xeb65e6[_0xe8eb('0x61')],'in','','');this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x122'),_0xeb65e6[_0xe8eb('0x61')]));var _0x55b1d5=this['awsLex']['sync'](this,_0xeb65e6);if(_0x55b1d5){for(var _0x51a37a in _0x55b1d5){if(_0x55b1d5[_0xe8eb('0x94')](_0x51a37a)&&_[_0xe8eb('0x9a')](_0x55b1d5[_0x51a37a])){this[_0xe8eb('0xc')]['setVariable'](util['format'](_0xe8eb('0x123'),_0x51a37a[_0xe8eb('0x69')]()),_0x55b1d5[_0x51a37a]);}}if(_[_0xe8eb('0x42')](_0x55b1d5['message'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xe8eb('0x3f')](_0x55b1d5[_0xe8eb('0x76')],_0xe8eb('0xe8'),_0xe8eb('0x124'),'');return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x125'),_0x55b1d5['message']));}}return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xeb65e6,_0xe8eb('0x126'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x127')]=function(_0x458055){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x128'),_0x458055[_0xe8eb('0x33')],_0x458055[_0xe8eb('0x66')]));if(!this[_0xe8eb('0xa2')](_0x458055[_0xe8eb('0x7a')])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x129'));}var _0x24972e=_0xe8eb('0x12a');var _0x5697f0=util[_0xe8eb('0x26')](_0xe8eb('0x12b'),FILES_PATH,rs[_0xe8eb('0x111')](0x4));var _0x4599af=util[_0xe8eb('0x26')](_0xe8eb('0x9c'),_0x5697f0,_0x24972e);var _0x251e53=!![];if(_0x458055['beep']===_0xe8eb('0x12c')){_0x251e53=![];}var _0x4e0b68=this[_0xe8eb('0xc')][_0xe8eb('0x12d')](_0x5697f0,_0x24972e,_0x458055[_0xe8eb('0x12e')],_0x458055[_0xe8eb('0x66')],undefined,_0x251e53);if(_0x4e0b68[_0xe8eb('0xa1')]!==-0x1){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('google\x20%s\x20file\x20created',_0x4599af));var _0xc891e9=this[_0xe8eb('0x8d')][_0xe8eb('0x6f')](this,_0x458055,_0x4599af);if(_0xc891e9){for(var _0x2edf56 in _0xc891e9){if(_0xc891e9[_0xe8eb('0x94')](_0x2edf56)){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')]('GOOGLE_ASR_%s',_0x2edf56[_0xe8eb('0x69')]()),_0xc891e9[_0x2edf56]);}}return this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x12f'),JSON[_0xe8eb('0x73')](_0xc891e9)));}}return _0x4e0b68;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x130')]=function(_0x463242){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x131'),_0x463242[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x463242[_0xe8eb('0x90')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('no\x20appid\x20configured');}if(!this[_0xe8eb('0xa2')](_0x463242[_0xe8eb('0x132')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x133'));}var _0xb90909='wav';var _0xddfd18=util[_0xe8eb('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0xe8eb('0x111')](0x4));var _0x355868=util[_0xe8eb('0x26')]('%s.%s',_0xddfd18,_0xb90909);var _0x34fff2=!![];if(_0x463242[_0xe8eb('0x134')]===_0xe8eb('0x12c')){_0x34fff2=![];}var _0x2b1c92=this['channel'][_0xe8eb('0x12d')](_0xddfd18,_0xb90909,_0x463242[_0xe8eb('0x12e')],_0x463242['timeout'],undefined,_0x34fff2);if(_0x2b1c92['result']!==-0x1){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x135'),_0x355868));var _0x4a31b8=this['tildeASR'][_0xe8eb('0x6f')](this,_0x463242,_0x355868);if(_0x4a31b8){for(var _0x596a39 in _0x4a31b8){if(_0x4a31b8[_0xe8eb('0x94')](_0x596a39)){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0x136'),_0x596a39[_0xe8eb('0x69')]()),_0x4a31b8[_0x596a39]);}}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x137'),JSON['stringify'](_0x4a31b8)));}}return _0x2b1c92;};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x138')]=function(_0x2caac2){logger['info'](util['format'](_0xe8eb('0x139'),_0x2caac2[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0x13a')](_0x2caac2['context'],_0x2caac2[_0xe8eb('0x3a')],_0x2caac2[_0xe8eb('0x3b')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x13b')]=function(_0x4477ad){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x13c'),_0x4477ad[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x4477ad[_0xe8eb('0x13d')])){return this['channel'][_0xe8eb('0x29')](_0x4477ad,_0xe8eb('0x13e'));}try{var _0x39cacf=eval(_0x4477ad[_0xe8eb('0x13d')])?'true':_0xe8eb('0x13f');this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4477ad['condition'],_0x39cacf));return{'code':0xc8,'result':_0x39cacf};}catch(_0x5b7853){return{'code':0xc8,'result':_0xe8eb('0x13f')};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x140')]=function(_0xe14ed4){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x141'),_0xe14ed4['label']));if(!this[_0xe8eb('0xa2')](_0xe14ed4[_0xe8eb('0x142')])){return this['channel'][_0xe8eb('0x29')](_0xe14ed4,_0xe8eb('0x143'));}var _0x39ef23=this[_0xe8eb('0x144')][_0xe8eb('0x6f')](this,_0xe14ed4[_0xe8eb('0x142')]);if(!_0x39ef23){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xe14ed4,_0xe8eb('0x145'));}for(var _0x45f53b=0x0;_0x45f53b<_0x39ef23[_0xe8eb('0x99')];_0x45f53b+=0x1){var _0x5c2971=this[_0xe8eb('0xc')][_0xe8eb('0xe')](util[_0xe8eb('0x26')](_0xe8eb('0x146'),_0x39ef23[_0x45f53b]));if(_0x5c2971[_0xe8eb('0xa1')]===-0x1){return _0x5c2971;}logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0x5c2971[_0xe8eb('0x9f')]));if(_0x5c2971[_0xe8eb('0x9f')]==='true'){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('IFTIME\x20%s\x20%s',_0x39ef23[_0x45f53b],_0xe8eb('0x148')));this['channel']['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0xe8eb('0x148')));return{'code':0xc8,'result':_0xe8eb('0x148')};}else{logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0xe8eb('0x13f')));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x147'),_0x39ef23[_0x45f53b],_0xe8eb('0x13f')));}}return{'code':0xc8,'result':_0xe8eb('0x13f')};};AGIVertices[_0xe8eb('0x16')]['hangup']=function(_0x3b0cfb){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x149'),_0x3b0cfb['label']));return this[_0xe8eb('0xc')]['hangup']();};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x14a')]=function(_0x316041){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x14b'),_0x316041[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x316041[_0xe8eb('0x7a')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0x129'));}var _0x374bd6=_0xe8eb('0x12a');var _0x2337d3=util[_0xe8eb('0x26')](_0xe8eb('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x5217dc=util[_0xe8eb('0x26')]('%s.%s',_0x2337d3,_0x374bd6);var _0x5844b3=!![];if(_0x316041[_0xe8eb('0x134')]===_0xe8eb('0x12c')){_0x5844b3=![];}var _0x517f5c=this[_0xe8eb('0xc')][_0xe8eb('0x12d')](_0x2337d3,_0x374bd6,_0x316041['intKey'],_0x316041['timeout'],undefined,_0x5844b3);if(_0x517f5c[_0xe8eb('0xa1')]!==-0x1){this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x14c'),_0x5217dc));var _0x52f1d6=this['ispeechASR'][_0xe8eb('0x6f')](this,_0x316041,_0x5217dc);if(_0x52f1d6){for(var _0x44fcf9 in _0x52f1d6){if(_0x52f1d6[_0xe8eb('0x94')](_0x44fcf9)){this['channel'][_0xe8eb('0x9d')](util[_0xe8eb('0x26')]('ISPEECH_ASR_%s',_0x44fcf9['toUpperCase']()),_0x52f1d6[_0x44fcf9]);}}return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x14d'),JSON[_0xe8eb('0x73')](_0x52f1d6)));}}return _0x517f5c;};AGIVertices[_0xe8eb('0x16')]['ispeechtts']=function(_0x41f425){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x41f425[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x41f425['key'])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x129'));}if(!this['isConfigured'](_0x41f425[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x14e'),_0x41f425[_0xe8eb('0x61')]));var _0x3548db=this['ispeechTTS']['sync'](this,_0x41f425);if(_0x3548db){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x14c'),_0x3548db));var _0x1e1ca7=this[_0xe8eb('0xc')][_0xe8eb('0x11e')](_0x3548db,_0x41f425[_0xe8eb('0x12e')]);try{fs['unlink'](_0x3548db+_0xe8eb('0xfc'));}catch(_0x47337c){logger[_0xe8eb('0x29')](_0x47337c);}return _0x1e1ca7;}return this['channel'][_0xe8eb('0x29')](_0x41f425,_0xe8eb('0x14f'));};AGIVertices[_0xe8eb('0x16')]['login']=function(_0x28f84a){logger['info'](util['format'](_0xe8eb('0x150'),_0x28f84a[_0xe8eb('0x33')]));if(!this['isConfigured'](_0x28f84a[_0xe8eb('0x151')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x28f84a,_0xe8eb('0x152'));}logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x153'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));var _0x4f950d=this[_0xe8eb('0x53')]['sync'](this,_0x28f84a[_0xe8eb('0x151')]);if(_0x4f950d){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));this['channel'][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x155')};}else{logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this[_0xe8eb('0xc')]['callerid'],_0x28f84a[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x28f84a[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x157')};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x158')]=function(_0x44e13b){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x159'),_0x44e13b[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x44e13b[_0xe8eb('0x151')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x44e13b,_0xe8eb('0x152'));}logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x153'),this['channel'][_0xe8eb('0x36')],_0x44e13b[_0xe8eb('0x151')]));var _0x2970c1=this[_0xe8eb('0x4f')][_0xe8eb('0x6f')](this,_0x44e13b[_0xe8eb('0x151')]);if(_0x2970c1){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x44e13b[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this['channel'][_0xe8eb('0x36')],_0x44e13b['findBy']));return{'code':0xc8,'result':_0xe8eb('0x155')};}else{logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x156'),this[_0xe8eb('0xc')]['callerid'],_0x44e13b[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x44e13b[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x157')};}};AGIVertices['prototype'][_0xe8eb('0x15a')]=function(_0x4f91cf){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4f91cf['label']));if(!this[_0xe8eb('0xa2')](_0x4f91cf[_0xe8eb('0x15b')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x4f91cf,_0xe8eb('0x15c'));}this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x15d'),_0x4f91cf[_0xe8eb('0x15b')]));var _0xfc8b67=eval(_0x4f91cf[_0xe8eb('0x15b')]);if(!this['isConfigured'](_0x4f91cf[_0xe8eb('0xd4')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0xd5'));}var _0x14465c=this['getVariable'][_0xe8eb('0x6f')](this,_0x4f91cf[_0xe8eb('0xd4')]);if(!_0x14465c){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x4f91cf,_0xe8eb('0xd6'));}if(_[_0xe8eb('0x98')](_0xfc8b67)){var _0xaa34b9=this;_0xfc8b67[_0xe8eb('0xd8')](function(_0x5b7886,_0x20feff){_0xaa34b9[_0xe8eb('0xc')][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0x15e'),_0x14465c,_0x20feff),_0x5b7886);});return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')]('variable\x20%s[key]\x20set',_0x14465c));}else{return this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x14465c,_0xfc8b67);}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x9')]=function(_0xadf9cb){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x15f'),_0xadf9cb[_0xe8eb('0x33')]));if(_0xadf9cb[_0xe8eb('0xa4')]===0x0){return this['maxRetry'](_0xadf9cb);}_0xadf9cb['retry']-=0x1;if(!this[_0xe8eb('0xa2')](_0xadf9cb[_0xe8eb('0x10b')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xadf9cb,_0xe8eb('0x10c'));}var _0x4a157f=this[_0xe8eb('0x1d')][_0xe8eb('0x6f')](this,_0xadf9cb[_0xe8eb('0x10b')]);if(!_0x4a157f){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xadf9cb,'no\x20file\x20audio\x20found');}var _0x3077d8=this[_0xe8eb('0xc')][_0xe8eb('0x10d')](_0x4a157f,_0xadf9cb[_0xe8eb('0x160')],_0xadf9cb[_0xe8eb('0x161')]);var _0x3948d2=_0x3077d8[_0xe8eb('0xa1')];if(_0x3077d8[_0xe8eb('0xa1')]===-0x1){this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0xadf9cb,'-1');return _0x3077d8;}else if(_0x3077d8[_0xe8eb('0x9f')]==='timeout'){_0x3077d8[_0xe8eb('0xa1')]=_0x3077d8[_0xe8eb('0xa1')][_0xe8eb('0x99')]>0x0?_0x3077d8[_0xe8eb('0xa1')]:'t';}else if(_['isEmpty'](_0x3077d8[_0xe8eb('0xa1')])){_0x3077d8[_0xe8eb('0xa1')]='#';_0x3948d2='#';}if(!this[_0xe8eb('0xa2')](_0xadf9cb[_0xe8eb('0xd4')])){this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xd5'));}else{var _0x218845=this[_0xe8eb('0xe')]['sync'](this,_0xadf9cb['variable_id']);if(!_0x218845){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0xadf9cb,'no\x20variable\x20found');}this[_0xe8eb('0xc')]['setVariable'](_0x218845,_0x3948d2);}this['createSquareDetailsReport'][_0xe8eb('0x6f')](this,_0xadf9cb,_0x3948d2);return _0x3077d8;};AGIVertices['prototype'][_0xe8eb('0xa7')]=function(_0x4b6f5f){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4b6f5f[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0x4b6f5f[_0xe8eb('0x162')]||_0x4b6f5f[_0xe8eb('0x33')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x163')]=function(_0x3c4f3a){logger['info'](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3c4f3a[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x3c4f3a[_0xe8eb('0x151')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x3c4f3a,'no\x20find\x20by\x20configured');}logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x153'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x3c4f3a['findBy']));var _0x2b2972=this[_0xe8eb('0x164')][_0xe8eb('0x6f')](this,_0x3c4f3a[_0xe8eb('0x165')]);var _0x56a5ca=this[_0xe8eb('0x4c')][_0xe8eb('0x6f')](this,_0x3c4f3a[_0xe8eb('0x151')],_0x2b2972);if(_0x56a5ca){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x3c4f3a[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe8eb('0xc')]['callerid'],_0x3c4f3a[_0xe8eb('0x151')]));return{'code':0xc8,'result':_0xe8eb('0x155')};}else{logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this['channel'][_0xe8eb('0x36')],_0x3c4f3a[_0xe8eb('0x151')]));this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe8eb('0xc')]['callerid'],_0x3c4f3a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x166')]=function(_0x3be43c){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x167'),_0x3be43c[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x3be43c['file_id'])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x3be43c,_0xe8eb('0x10c'));}var _0x5c01ad=this[_0xe8eb('0x1d')][_0xe8eb('0x6f')](this,_0x3be43c['file_id']);if(!_0x5c01ad){return this[_0xe8eb('0xc')]['error'](_0x3be43c,_0xe8eb('0x168'));}var _0x59d759=this[_0xe8eb('0xc')]['exec']('PLAYBACK',[_0x5c01ad,_0x3be43c['opts']]);if(_0x59d759[_0xe8eb('0xa1')]===-0x1){return _0x59d759;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x169'),_0xe8eb('0x16a'),_0x5c01ad));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x16b')]=function(_0x3c66b0){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x16c'),_0x3c66b0['label']));if(!this['isConfigured'](_0x3c66b0[_0xe8eb('0x16d')])){return this[_0xe8eb('0xc')]['error'](_0x3c66b0,_0xe8eb('0x16e'));}var _0x352ffc='';var _0x5146d4=parseInt(_0x3c66b0[_0xe8eb('0x16d')],0xa);if(isNaN(_0x5146d4)){_0x352ffc=_0x3c66b0[_0xe8eb('0x16d')];}else{_0x352ffc=this[_0xe8eb('0x12')][_0xe8eb('0x6f')](this,_0x3c66b0['queue_id']);if(!_0x352ffc){return this['channel'][_0xe8eb('0x29')](_0x3c66b0,_0xe8eb('0x16f'));}}var _0x59a93e='';if(this[_0xe8eb('0xa2')](_0x3c66b0[_0xe8eb('0x10b')])){var _0x1ebadc=this['getSound'][_0xe8eb('0x6f')](this,_0x3c66b0[_0xe8eb('0x10b')]);if(_0x1ebadc){_0x59a93e=_0x1ebadc;}}this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x3c66b0,_0x352ffc);if(_0x3c66b0[_0xe8eb('0x107')]['indexOf']('x')<0x0){_0x3c66b0[_0xe8eb('0x107')]+='x';}if(_0x3c66b0['opts'][_0xe8eb('0x170')]('X')<0x0){_0x3c66b0[_0xe8eb('0x107')]+='X';}this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0xe8eb('0x171'),_0x352ffc?_0x352ffc[_0xe8eb('0x172')]():'');var _0x4dce55=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0x173'),[_0x352ffc,_0x3c66b0[_0xe8eb('0x107')],_0x3c66b0[_0xe8eb('0x64')],_0x59a93e,_0x3c66b0[_0xe8eb('0x66')],_0x3c66b0[_0xe8eb('0x5')],_0x3c66b0[_0xe8eb('0x174')],_0x3c66b0['gosub'],'',_0x3c66b0[_0xe8eb('0x175')]]);if(_0x4dce55[_0xe8eb('0xa1')]===-0x1){return _0x4dce55;}return this['channel']['noop'](util[_0xe8eb('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x352ffc));};AGIVertices['prototype']['record']=function(_0x23caac){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x23caac[_0xe8eb('0x33')]));var _0x4945a8=_0x23caac[_0xe8eb('0x176')]||_0xe8eb('0x12a');var _0x26c424=util['format'](_0xe8eb('0x177'),this[_0xe8eb('0xc')][_0xe8eb('0x32')],rs['generate'](0x5));var _0xc165a8=util[_0xe8eb('0x26')](_0xe8eb('0x178'),FILES_PATH,_0x26c424,_0x4945a8);var _0x7803a6=util['format'](_0xe8eb('0x12b'),FILES_PATH,_0x26c424);this[_0xe8eb('0x37')]['sync'](this,_0x23caac,_0x26c424,_0xc165a8);this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0xe8eb('0x179'),_0x26c424);logger['info'](_0xe8eb('0x17a'),_0x7803a6,_0x4945a8,_0x23caac['escape_digits'],_0x23caac[_0xe8eb('0x66')]);return this[_0xe8eb('0xc')][_0xe8eb('0x12d')](_0x7803a6,_0x4945a8,_0x23caac[_0xe8eb('0x17b')],_0x23caac['timeout'],undefined,!![]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x17c')]=function(_0x270a90){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x270a90['label']));if(!this['isConfigured'](_0x270a90[_0xe8eb('0x64')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0x17d'));}var _0x7d48a0=this[_0xe8eb('0x63')][_0xe8eb('0x6f')](this,_0x270a90);logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Response:',util['inspect'](_0x7d48a0,{'showHidden':![],'depth':null})));if(!this[_0xe8eb('0xa2')](_0x270a90['variable_id'])){return this[_0xe8eb('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x16ebb8=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x270a90[_0xe8eb('0xd4')]);if(!_0x16ebb8){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x270a90,_0xe8eb('0xd6'));}this['channel']['setVariable'](util[_0xe8eb('0x26')](_0xe8eb('0x17e'),_0x16ebb8),_0x7d48a0[_0xe8eb('0x74')]?_0x7d48a0[_0xe8eb('0x74')]:_0xe8eb('0x17f'));this['channel'][_0xe8eb('0x9d')](util[_0xe8eb('0x26')](_0xe8eb('0x180'),_0x16ebb8),_0x7d48a0[_0xe8eb('0x75')]?_0x7d48a0[_0xe8eb('0x75')]:'OK');if(_0x7d48a0['body']){try{this[_0xe8eb('0x9b')](_0x7d48a0[_0xe8eb('0x72')],_0x16ebb8);}catch(_0x5848e5){logger[_0xe8eb('0x29')](util[_0xe8eb('0x26')](_0xe8eb('0x181'),_0x16ebb8));}}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0xda'),_0x16ebb8));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x182')]=function(_0x3e4e71){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x183'),_0x3e4e71['label']));return this[_0xe8eb('0xc')][_0xe8eb('0x184')](_0x3e4e71[_0xe8eb('0x185')][_0xe8eb('0x57')](/\s+/g,''),_0x3e4e71[_0xe8eb('0x17b')]);};AGIVertices[_0xe8eb('0x16')]['saynumber']=function(_0x1113cb){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x186'),_0x1113cb['label']));return this[_0xe8eb('0xc')][_0xe8eb('0x187')](_0x1113cb[_0xe8eb('0x67')][_0xe8eb('0x57')](/\s+/g,''),_0x1113cb[_0xe8eb('0x17b')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x188')]=function(_0x40276c){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x189'),_0x40276c[_0xe8eb('0x33')]));return this[_0xe8eb('0xc')][_0xe8eb('0x18a')](_0x40276c[_0xe8eb('0x61')],_0x40276c[_0xe8eb('0x17b')]);};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x18b')]=function(_0x581faa){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x581faa[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x581faa['account_id'])){return this['channel'][_0xe8eb('0xa7')]('no\x20mail\x20account\x20configured');}var _0x20fe9f=this[_0xe8eb('0x1f')][_0xe8eb('0x6f')](this,_0x581faa['account_id']);if(!_0x20fe9f||!_0x20fe9f['Smtp']){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x581faa,_0xe8eb('0x18c'));}var _0x28b4e0={'from':util['format'](_0xe8eb('0x18d'),_0x20fe9f[_0xe8eb('0x11')],_0x20fe9f[_0xe8eb('0x18e')]||_0x20fe9f['Smtp']['user']),'to':_0x581faa['to']||'','cc':_0x581faa['cc']||'','bcc':_0x581faa[_0xe8eb('0x18f')]||'','subject':_0x581faa[_0xe8eb('0x190')],'html':_0x581faa['text'],'text':_0x581faa[_0xe8eb('0x61')]};var _0x1f8124={'tls':{'rejectUnauthorized':![]}};if(_0x20fe9f['Smtp']['service']){_0x1f8124['service']=_0x20fe9f['Smtp']['service'];}else{_0x1f8124[_0xe8eb('0x191')]=_0x20fe9f[_0xe8eb('0x192')]['host'];_0x1f8124['port']=_0x20fe9f[_0xe8eb('0x192')]['port'];_0x1f8124[_0xe8eb('0x193')]=_0x20fe9f[_0xe8eb('0x192')][_0xe8eb('0x193')];}if(_0x20fe9f['Smtp']['authentication']){_0x1f8124[_0xe8eb('0x194')]={'user':_0x20fe9f['Smtp'][_0xe8eb('0x195')],'pass':_0x20fe9f[_0xe8eb('0x192')][_0xe8eb('0x196')]};}if(this[_0xe8eb('0xa2')](_0x581faa[_0xe8eb('0x197')])){}logger[_0xe8eb('0xdc')](_0xe8eb('0x198'),JSON['stringify'](_0x28b4e0));this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x581faa,_0x581faa[_0xe8eb('0x199')]);this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x19a'),_0x20fe9f['name']));this[_0xe8eb('0x21')]['sync'](this,_0x1f8124,_0x28b4e0);return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x19b'));};AGIVertices['prototype']['sendFax']=function(_0x2c0204){logger[_0xe8eb('0x2a')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2c0204[_0xe8eb('0x33')]));return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x19c'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x19d')]=function(_0x5da528){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x19e'),_0x5da528[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5da528[_0xe8eb('0x19f')])){return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](_0xe8eb('0x1a0'));}var _0xd6b5a0=this[_0xe8eb('0x1a1')][_0xe8eb('0x6f')](this,_0x5da528[_0xe8eb('0x19f')]);if(!_0xd6b5a0){return this['channel'][_0xe8eb('0x29')](_0x5da528,_0xe8eb('0x1a2'));}var _0x38560e={'body':_0x5da528[_0xe8eb('0x1a3')],'phone':_0x5da528['to']||'','SmsAccountId':_0xd6b5a0['id']};logger['debug'](_0xe8eb('0x1a4'),JSON[_0xe8eb('0x73')](_0x38560e));this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x5da528,_0x5da528[_0xe8eb('0x19f')]);this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1a5'),_0xd6b5a0[_0xe8eb('0x11')]));this[_0xe8eb('0x30')]['sync'](this,_0x38560e);return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0x1a6'));};AGIVertices['prototype']['set']=function(_0x4d4cc8){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x1a7'),_0x4d4cc8['label']));if(!this[_0xe8eb('0xa2')](_0x4d4cc8['variable_id'])){return this['channel'][_0xe8eb('0x29')](_0x4d4cc8,_0xe8eb('0x1a8'));}var _0x4c414d=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x4d4cc8[_0xe8eb('0xd4')]);if(!_0x4c414d){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x4d4cc8,_0xe8eb('0xd6'));}return this[_0xe8eb('0xc')]['setVariable'](_0x4c414d,_0x4d4cc8[_0xe8eb('0x1a9')]);};AGIVertices['prototype'][_0xe8eb('0x1aa')]=function(_0x2e6d5f){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1ab'),_0x2e6d5f[_0xe8eb('0x33')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')]('START\x20CALLY\x20SQUARE');if(_0x2e6d5f[_0xe8eb('0xb4')]==='yes'){this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x1ac'));return this['channel']['answer']();}return this['channel'][_0xe8eb('0xa7')]('Skipped\x20Answer');};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1ad')]=function(_0x587b59){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x1ae'),_0x587b59[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x587b59['project_id'])){return this['channel'][_0xe8eb('0x29')](_0x587b59,'no\x20subproject\x20selected');}var _0x60b18f=this[_0xe8eb('0x1af')][_0xe8eb('0x6f')](this,_0x587b59['project_id']);if(!this['isConfigured'](_0x60b18f)){return this['channel'][_0xe8eb('0x29')](_0x587b59,util[_0xe8eb('0x26')](_0xe8eb('0x1b0'),_0x587b59[_0xe8eb('0x1b1')]));}if(_0x60b18f===this[_0xe8eb('0xc')]['arg_1']){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x587b59,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe8eb('0x31')][_0xe8eb('0x6f')](this,_0x587b59,_0x60b18f);var _0x12c1ad=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0x1b2'),util[_0xe8eb('0x26')](_0xe8eb('0x1b3'),config[_0xe8eb('0x5')][_0xe8eb('0x191')]||_0xe8eb('0x1b4'),_0x60b18f,this[_0xe8eb('0xc')][_0xe8eb('0x35')]));if(_0x12c1ad['result']===-0x1){return _0x12c1ad;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x60b18f));};AGIVertices['prototype'][_0xe8eb('0x1b5')]=function(_0x4f2a87){logger['info'](util[_0xe8eb('0x26')](_0xe8eb('0x1b6'),_0x4f2a87[_0xe8eb('0x33')]));var _0x3e7ec8=this[_0xe8eb('0x54')][_0xe8eb('0x6f')](this,_0x4f2a87['command']);this[_0xe8eb('0x31')]['sync'](this,_0x4f2a87,_0x4f2a87['command']);if(this[_0xe8eb('0xa2')](_0x4f2a87[_0xe8eb('0xd4')])){var _0x51893c=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x4f2a87['variable_id']);if(_0x51893c){this[_0xe8eb('0xc')][_0xe8eb('0x9d')](_0x51893c,_0x3e7ec8);return this[_0xe8eb('0xc')]['noop'](util[_0xe8eb('0x26')](_0xe8eb('0x1b7'),_0x4f2a87[_0xe8eb('0xb2')],_0x51893c));}}return this[_0xe8eb('0xc')]['noop'](util['format'](_0xe8eb('0x1b8'),_0x4f2a87['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x11a3bd){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1b9'),_0x11a3bd[_0xe8eb('0x33')]));_0x11a3bd[_0xe8eb('0x61')]=_0x11a3bd[_0xe8eb('0x61')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x11a3bd[_0xe8eb('0x59')])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0x1ba'));}if(!this['isConfigured'](_0x11a3bd[_0xe8eb('0x61')])){return this[_0xe8eb('0xc')]['noop'](_0xe8eb('0xbf'));}this['channel']['noop'](util[_0xe8eb('0x26')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x11a3bd[_0xe8eb('0x61')]));var _0x2df377=this[_0xe8eb('0x58')]['sync'](this,_0x11a3bd);if(_0x2df377){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1bb'),_0x2df377));var _0x49f397=this['channel'][_0xe8eb('0x11e')](_0x2df377);try{fs[_0xe8eb('0xfb')](_0x2df377+_0xe8eb('0xfc'));}catch(_0x5de451){logger['error'](_0x5de451);}return _0x49f397;}return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x11a3bd,_0xe8eb('0x1bc'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1bd')]=function(_0x10dbe0){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1be'),_0x10dbe0['label']));_0x10dbe0[_0xe8eb('0x61')]=_0x10dbe0[_0xe8eb('0x61')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x10dbe0[_0xe8eb('0x61')])){return this['channel'][_0xe8eb('0xa7')](_0xe8eb('0xbf'));}this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1bf'),_0x10dbe0[_0xe8eb('0x61')]));var _0x12e184=this[_0xe8eb('0x60')]['sync'](this,_0x10dbe0);if(_0x12e184){this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x1c0'),_0x12e184));var _0x232af8=this[_0xe8eb('0xc')][_0xe8eb('0x11e')](_0x12e184);try{}catch(_0x219971){logger[_0xe8eb('0x29')](_0x219971);}return _0x232af8;}return this['channel']['error'](_0x10dbe0,_0xe8eb('0x1c1'));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1c2')]=function(_0x428b8c){logger['info'](util[_0xe8eb('0x26')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x428b8c['label']));if(!this[_0xe8eb('0xa2')](_0x428b8c[_0xe8eb('0x151')])){return this['channel'][_0xe8eb('0x29')](_0x428b8c,_0xe8eb('0x152'));}logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));var _0x1a437a=this['agentUnpause'][_0xe8eb('0x6f')](this,_0x428b8c[_0xe8eb('0x151')]);if(_0x1a437a){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this['channel'][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x154'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x156'),this[_0xe8eb('0xc')][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x156'),this['channel'][_0xe8eb('0x36')],_0x428b8c[_0xe8eb('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1c3')]=function(_0x40b02){logger[_0xe8eb('0x2a')](util[_0xe8eb('0x26')](_0xe8eb('0x1c4'),_0x40b02[_0xe8eb('0x33')]));var _0x7ae919=this[_0xe8eb('0xc')][_0xe8eb('0x55')](_0xe8eb('0x1c5'),[_0x40b02['mailbox'],_0x40b02[_0xe8eb('0x78')]]);if(_0x7ae919[_0xe8eb('0xa1')]===-0x1){return _0x7ae919;}return this[_0xe8eb('0xc')][_0xe8eb('0xa7')](util[_0xe8eb('0x26')](_0xe8eb('0x169'),'VOICEMAIL',_0x40b02[_0xe8eb('0x1c6')]));};AGIVertices[_0xe8eb('0x16')][_0xe8eb('0x1c7')]=function(_0x5c94a3){logger[_0xe8eb('0x2a')](util['format'](_0xe8eb('0x1c8'),_0x5c94a3[_0xe8eb('0x33')]));if(!this[_0xe8eb('0xa2')](_0x5c94a3[_0xe8eb('0xd4')])){return this[_0xe8eb('0xc')][_0xe8eb('0x29')](_0x5c94a3,_0xe8eb('0x1a8'));}var _0x1a6525=this[_0xe8eb('0xe')][_0xe8eb('0x6f')](this,_0x5c94a3[_0xe8eb('0xd4')]);if(!_0x1a6525){return this[_0xe8eb('0xc')]['error'](_0x5c94a3,_0xe8eb('0xd6'));}var _0x120111=this[_0xe8eb('0xc')][_0xe8eb('0xe')](_0x1a6525);return{'code':0xc8,'result':_0x120111[_0xe8eb('0x9f')]?_0x120111[_0xe8eb('0x9f')]:'-'};};String[_0xe8eb('0x16')][_0xe8eb('0x9e')]=function(_0x26d8af,_0x3c089e){return this[_0xe8eb('0x1c9')](_0x26d8af)[_0xe8eb('0x1ca')](_0x3c089e);};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 51f5850..17f0fbb 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 _0xf3cd=['../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','stopAcw','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0xf3cd[_0x42c118];return _0x112ebd;};'use strict';var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var ami=require(_0xdf3c('0x3'));var logger=require(_0xdf3c('0x4'))(_0xdf3c('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdf3c('0x6'));function Acw(_0x71b446){this[_0xdf3c('0x7')]=_0x71b446['voiceQueues'];this[_0xdf3c('0x8')]=_0x71b446[_0xdf3c('0x8')];this[_0xdf3c('0x9')]=_0x71b446[_0xdf3c('0x9')];this[_0xdf3c('0xa')]={};ami['on'](_0xdf3c('0xb'),this['syncAgentConnect'][_0xdf3c('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xd'),this['syncHangup'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xe'),this[_0xdf3c('0xf')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x10'),this[_0xdf3c('0x11')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x12'),this['syncBlindTransfer'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x13'),this[_0xdf3c('0x14')][_0xdf3c('0xc')](this));}function getDiff(_0x59e431){var _0x2ae4ad=moment()[_0xdf3c('0x15')](0x0);var _0x13ea5f=moment(_0x59e431)['milliseconds'](0x0);return _0x2ae4ad[_0xdf3c('0x16')](_0x13ea5f,_0xdf3c('0x17'));}Acw[_0xdf3c('0x18')][_0xdf3c('0x19')]=function(_0x21e587){try{var _0x1a7a5a=this;var _0x305ea5=this[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x1a')];var _0x5d3991=this['channels'][_0x21e587][_0xdf3c('0x1b')];var _0x465e7d=this[_0xdf3c('0x7')][_0x5d3991];var _0x18d4ec=![];var _0x1e2690=_0xdf3c('0x1c');if(_0x465e7d[_0xdf3c('0x1d')]){if(_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')]){_0x18d4ec=!![];_0x1e2690=_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')];}}ami[_0xdf3c('0x20')]({'action':_0xdf3c('0x21'),'interface':_0x305ea5,'paused':!![],'reason':_0x1e2690})['then'](function(_0x4d620f){if(_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]){return RpcUser['getAgent'](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]['id'])[_0xdf3c('0x22')](function(_0x36552e){if(_0x36552e&&!_0x36552e[_0xdf3c('0x23')]){logger[_0xdf3c('0x24')](_0xdf3c('0x25'),_0x21e587,_0x305ea5,_0x5d3991);var _0x50d8ca=_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x26')]&&_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]?_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]:_0x21e587;return RpcUser[_0xdf3c('0x28')](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5],_0x1e2690,_0x50d8ca)[_0xdf3c('0x22')](function(_0x1adee4){if(!_0x18d4ec){_0x1a7a5a['timers'][_0x305ea5]={};logger[_0xdf3c('0x24')](_0xdf3c('0x29'),_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);_0x1a7a5a['timers'][_0x305ea5]['timer']=setTimeout(_0x1a7a5a['stopAcw'][_0xdf3c('0xc')](_0x1a7a5a,_0x305ea5),_0x1a7a5a[_0xdf3c('0x7')][_0x5d3991]['acwTimeout']*0x3e8);_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2b')]=moment()[_0xdf3c('0x2c')](_0xdf3c('0x2d'));_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5]['uniqueid']=_0x21e587;_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x1b')]=_0x5d3991;_0x1a7a5a['timers'][_0x305ea5]['updateAcw']=function(){var _0x1f1d8a=getDiff(_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2b')]);clearTimeout(_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2e')]);_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2e')]=![];RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1f1d8a},_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x30')],_0x305ea5)[_0xdf3c('0x22')](function(_0x522e5f){logger[_0xdf3c('0x24')](_0xdf3c('0x31'),_0x21e587,_0x1f1d8a,_0x522e5f);})[_0xdf3c('0x32')](function(_0x2287f){logger['error'](_0xdf3c('0x33'),_0x21e587,_0x2287f);});delete _0x1a7a5a[_0xdf3c('0x9')][_0x305ea5];};}});}else{logger[_0xdf3c('0x24')](_0xdf3c('0x34'),_0x21e587,_0x305ea5,_0x5d3991);}});}})['catch'](function(_0x474564){logger[_0xdf3c('0x35')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);})['finally'](function(){delete _0x1a7a5a[_0xdf3c('0xa')][_0x21e587];});}catch(_0x5e8130){logger['error']('[ACW][START]\x20%s',_0x5e8130[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x37')]=function(_0x29b5b7){try{var _0x54c25f=this;if(_0x54c25f['timers'][_0x29b5b7]){_0x54c25f[_0xdf3c('0x9')][_0x29b5b7]['timer']=![];var _0x46e40f=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x30')];var _0xcdd731=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x1b')];var _0x1c7335=_0x54c25f[_0xdf3c('0x7')][_0xcdd731][_0xdf3c('0x2a')];logger['info'](_0xdf3c('0x38'),_0x29b5b7);RpcUser['saveUnpause'](this['agents'][_0x29b5b7]);RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1c7335,'agentacw':!![]},_0x46e40f,_0x29b5b7)['then'](function(_0xccce51){logger['info'](_0xdf3c('0x31'),_0x46e40f,_0x1c7335,_0xccce51);})[_0xdf3c('0x32')](function(_0x1c6dee){logger[_0xdf3c('0x35')](_0xdf3c('0x33'),_0x46e40f,_0x1c6dee);});}else{logger[_0xdf3c('0x35')](_0xdf3c('0x39'),_0x29b5b7);if(_0x54c25f[_0xdf3c('0x9')]){logger[_0xdf3c('0x24')](_0xdf3c('0x3a'),JSON[_0xdf3c('0x3b')](_0x54c25f[_0xdf3c('0x9')]));}}}catch(_0x57e0ab){logger['error'](_0xdf3c('0x3c'),_0x57e0ab['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3d')]=function(_0x46194d){try{if(this[_0xdf3c('0x7')][_0x46194d['queue']]&&(this['voiceQueues'][_0x46194d[_0xdf3c('0x1b')]][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x46194d['queue']][_0xdf3c('0x1d')])){if(this[_0xdf3c('0x8')][_0x46194d[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x46194d['uniqueid']]={'queue':_0x46194d[_0xdf3c('0x1b')],'interface':_0x46194d[_0xdf3c('0x1a')],'destlinkedid':_0x46194d[_0xdf3c('0x27')]};}}}catch(_0x3f4d7f){logger[_0xdf3c('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x3f4d7f[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x14')]=function(_0x2456cf){try{if(this[_0xdf3c('0x7')][_0x2456cf[_0xdf3c('0x1b')]]&&(this['voiceQueues'][_0x2456cf['queue']][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x2456cf['queue']]['mandatoryDisposition'])){if(this[_0xdf3c('0x8')][_0x2456cf[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x2456cf[_0xdf3c('0x30')]]={'queue':_0x2456cf[_0xdf3c('0x1b')],'interface':_0x2456cf[_0xdf3c('0x1a')]};}}}catch(_0x466ea1){logger[_0xdf3c('0x35')](_0xdf3c('0x3e'),_0x466ea1['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3f')]=function(_0x1c293d){try{if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x30')]]&&_[_0xdf3c('0x40')](this[_0xdf3c('0xa')][_0x1c293d['uniqueid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x41'),_0x1c293d['uniqueid']);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x42')]]&&_['isUndefined'](this['channels'][_0x1c293d['linkedid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x43'),_0x1c293d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x42')]);}}catch(_0x3b17d9){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x3b17d9[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')]['syncHangup']=function(_0x3b215d){try{if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3b215d['uniqueid']);this[_0xdf3c('0x19')](_0x3b215d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')](_0xdf3c('0x44'),_0x3b215d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x3b215d['linkedid']);}}catch(_0x1eebcf){logger['error']('[ACW][syncHangup]\x20%s',_0x1eebcf['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1afc6c){try{if(!_[_0xdf3c('0x45')](this['channels'][_0x1afc6c[_0xdf3c('0x46')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfereeuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]]){this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]]=this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];}}else if(!_['isNil'](this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfertargetuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]]){this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c['transfereeuniqueid']]=this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]];}}}catch(_0x163adc){logger[_0xdf3c('0x35')](_0xdf3c('0x4a'),_0x163adc[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x4b')]=function(_0x2922d8){try{if(this[_0xdf3c('0xa')][_0x2922d8[_0xdf3c('0x4c')]]){logger[_0xdf3c('0x24')](_0xdf3c('0x4d'),JSON[_0xdf3c('0x3b')](_0x2922d8[_0xdf3c('0x4c')]));this[_0xdf3c('0x19')](_0x2922d8[_0xdf3c('0x4c')]);}else if(this['channels'][_0x2922d8['transfererlinkedid']]){logger[_0xdf3c('0x24')](_0xdf3c('0x4e'),JSON[_0xdf3c('0x3b')](_0x2922d8['transfererlinkedid']));this[_0xdf3c('0x19')](_0x2922d8['transfererlinkedid']);}}catch(_0x574852){logger[_0xdf3c('0x35')](_0xdf3c('0x4f'),_0x574852[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0xf')]=function(_0x9b7034){try{if(this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]]&&this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]][_0xdf3c('0x50')]===_0xdf3c('0x51')){if(this[_0xdf3c('0x8')][_0x9b7034['interface']]){logger[_0xdf3c('0x24')](_0xdf3c('0x52'),_0x9b7034[_0xdf3c('0x30')],_0x9b7034[_0xdf3c('0x1a')],_0x9b7034[_0xdf3c('0x1b')]);return RpcUser['savePause'](this[_0xdf3c('0x8')][_0x9b7034[_0xdf3c('0x1a')]],_0xdf3c('0x53'),_0x9b7034[_0xdf3c('0x30')]);}}}catch(_0x1efa9c){logger[_0xdf3c('0x35')](_0xdf3c('0x54'),_0x1efa9c[_0xdf3c('0x36')]);}};module[_0xdf3c('0x55')]=Acw; \ No newline at end of file +var _0xda55=['[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xda55,0x6d));var _0x5da5=function(_0xa62a6b,_0x50f390){_0xa62a6b=_0xa62a6b-0x0;var _0x57380b=_0xda55[_0xa62a6b];return _0x57380b;};'use strict';var util=require(_0x5da5('0x0'));var _=require(_0x5da5('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x5da5('0x2'))(_0x5da5('0x3'));var RpcUser=require(_0x5da5('0x4'));var RpcVoiceAgentReport=require(_0x5da5('0x5'));function Acw(_0x1c3afd){this['voiceQueues']=_0x1c3afd[_0x5da5('0x6')];this['agents']=_0x1c3afd[_0x5da5('0x7')];this['timers']=_0x1c3afd[_0x5da5('0x8')];this[_0x5da5('0x9')]={};ami['on'](_0x5da5('0xa'),this[_0x5da5('0xb')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0xd'),this[_0x5da5('0xe')][_0x5da5('0xc')](this));ami['on']('hangup',this[_0x5da5('0xf')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0x10'),this[_0x5da5('0x11')][_0x5da5('0xc')](this));ami['on'](_0x5da5('0x12'),this[_0x5da5('0x13')]['bind'](this));ami['on'](_0x5da5('0x14'),this[_0x5da5('0x15')]['bind'](this));ami['on'](_0x5da5('0x16'),this[_0x5da5('0x17')][_0x5da5('0xc')](this));}function getDiff(_0x43d526){var _0x1877d4=moment()[_0x5da5('0x18')](0x0);var _0x481562=moment(_0x43d526)['milliseconds'](0x0);return _0x1877d4['diff'](_0x481562,_0x5da5('0x19'));}Acw[_0x5da5('0x1a')][_0x5da5('0x1b')]=function(_0x665ce8){try{var _0x11bd3=this;var _0x134afa=this[_0x5da5('0x9')][_0x665ce8]['interface'];var _0x124dc5=this[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x1c')];var _0x16b11f=this[_0x5da5('0x6')][_0x124dc5];var _0x428b07=![];var _0x547c58=_0x5da5('0x1d');if(_0x16b11f[_0x5da5('0x1e')]){if(_0x16b11f[_0x5da5('0x1f')][_0x5da5('0x20')]){_0x428b07=!![];_0x547c58=_0x16b11f[_0x5da5('0x1f')]['name'];}}ami[_0x5da5('0x21')]({'action':_0x5da5('0x22'),'interface':_0x134afa,'paused':!![],'reason':_0x547c58})[_0x5da5('0x23')](function(_0x560ea7){if(_0x11bd3[_0x5da5('0x7')][_0x134afa]){return RpcUser[_0x5da5('0x24')](_0x11bd3[_0x5da5('0x7')][_0x134afa]['id'])[_0x5da5('0x23')](function(_0xec69f2){if(_0xec69f2&&!_0xec69f2[_0x5da5('0x25')]){logger['info'](_0x5da5('0x26'),_0x665ce8,_0x134afa,_0x124dc5);var _0x568ddf=_0x11bd3[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x27')]&&_0x11bd3[_0x5da5('0x9')][_0x665ce8]['destlinkedid']?_0x11bd3[_0x5da5('0x9')][_0x665ce8][_0x5da5('0x28')]:_0x665ce8;return RpcUser[_0x5da5('0x29')](_0x11bd3[_0x5da5('0x7')][_0x134afa],_0x547c58,_0x568ddf)['then'](function(_0x5b0b43){if(!_0x428b07){_0x11bd3['timers'][_0x134afa]={};logger[_0x5da5('0x2a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x665ce8,_0x11bd3['voiceQueues'][_0x124dc5][_0x5da5('0x2b')],_0x134afa,_0x124dc5);_0x11bd3[_0x5da5('0x8')][_0x134afa]['timer']=setTimeout(_0x11bd3[_0x5da5('0x2c')][_0x5da5('0xc')](_0x11bd3,_0x134afa),_0x11bd3['voiceQueues'][_0x124dc5][_0x5da5('0x2b')]*0x3e8);_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x2d')]=moment()[_0x5da5('0x2e')](_0x5da5('0x2f'));_0x11bd3['timers'][_0x134afa][_0x5da5('0x30')]=_0x665ce8;_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x1c')]=_0x124dc5;_0x11bd3[_0x5da5('0x8')][_0x134afa]['updateAcw']=function(){var _0x5ee7f2=getDiff(_0x11bd3['timers'][_0x134afa][_0x5da5('0x2d')]);clearTimeout(_0x11bd3[_0x5da5('0x8')][_0x134afa][_0x5da5('0x31')]);_0x11bd3[_0x5da5('0x8')][_0x134afa]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5ee7f2},_0x11bd3[_0x5da5('0x8')][_0x134afa]['uniqueid'],_0x134afa)['then'](function(_0x2dd4b6){logger['info'](_0x5da5('0x32'),_0x665ce8,_0x5ee7f2,_0x2dd4b6);})[_0x5da5('0x33')](function(_0x33f138){logger[_0x5da5('0x34')](_0x5da5('0x35'),_0x665ce8,_0x33f138);});delete _0x11bd3[_0x5da5('0x8')][_0x134afa];};}});}else{logger[_0x5da5('0x2a')](_0x5da5('0x36'),_0x665ce8,_0x134afa,_0x124dc5);}});}})['catch'](function(_0x231e8c){logger['error'](_0x5da5('0x37'),_0x665ce8,_0x11bd3[_0x5da5('0x6')][_0x124dc5][_0x5da5('0x2b')],_0x134afa,_0x124dc5);})[_0x5da5('0x38')](function(){delete _0x11bd3[_0x5da5('0x9')][_0x665ce8];});}catch(_0x9aba42){logger[_0x5da5('0x34')](_0x5da5('0x39'),_0x9aba42[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x2c')]=function(_0x33429f){try{var _0x3ba804=this;if(_0x3ba804['timers'][_0x33429f]){_0x3ba804[_0x5da5('0x8')][_0x33429f]['timer']=![];var _0x2d6280=_0x3ba804[_0x5da5('0x8')][_0x33429f][_0x5da5('0x30')];var _0x24842c=_0x3ba804['timers'][_0x33429f][_0x5da5('0x1c')];var _0x2f2596=_0x3ba804[_0x5da5('0x6')][_0x24842c]['acwTimeout'];logger[_0x5da5('0x2a')](_0x5da5('0x3b'),_0x33429f);RpcUser['saveUnpause'](this[_0x5da5('0x7')][_0x33429f]);RpcVoiceAgentReport[_0x5da5('0x3c')]({'acwtime':_0x2f2596,'agentacw':!![]},_0x2d6280,_0x33429f)[_0x5da5('0x23')](function(_0x38a974){logger[_0x5da5('0x2a')](_0x5da5('0x32'),_0x2d6280,_0x2f2596,_0x38a974);})['catch'](function(_0x1ab02){logger[_0x5da5('0x34')](_0x5da5('0x35'),_0x2d6280,_0x1ab02);});}else{logger[_0x5da5('0x34')](_0x5da5('0x3d'),_0x33429f);if(_0x3ba804['timers']){logger[_0x5da5('0x2a')](_0x5da5('0x3e'),JSON['stringify'](_0x3ba804[_0x5da5('0x8')]));}}}catch(_0x5643e7){logger['error'](_0x5da5('0x3f'),_0x5643e7[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0xb')]=function(_0x52b618){try{if(this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]]&&(this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]][_0x5da5('0x3')]||this[_0x5da5('0x6')][_0x52b618[_0x5da5('0x1c')]][_0x5da5('0x1e')])){if(this[_0x5da5('0x7')][_0x52b618[_0x5da5('0x40')]]){this[_0x5da5('0x9')][_0x52b618[_0x5da5('0x30')]]={'queue':_0x52b618[_0x5da5('0x1c')],'interface':_0x52b618[_0x5da5('0x40')],'destlinkedid':_0x52b618[_0x5da5('0x28')]};}}}catch(_0x59acfe){logger['error'](_0x5da5('0x41'),_0x59acfe[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0x17')]=function(_0x1a188b){try{if(this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]]&&(this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]][_0x5da5('0x3')]||this[_0x5da5('0x6')][_0x1a188b[_0x5da5('0x1c')]][_0x5da5('0x1e')])){if(this['agents'][_0x1a188b[_0x5da5('0x40')]]){this['channels'][_0x1a188b['uniqueid']]={'queue':_0x1a188b[_0x5da5('0x1c')],'interface':_0x1a188b[_0x5da5('0x40')]};}}}catch(_0x455caf){logger[_0x5da5('0x34')](_0x5da5('0x42'),_0x455caf[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0xe')]=function(_0x536ca2){try{if(this['channels'][_0x536ca2[_0x5da5('0x30')]]&&_[_0x5da5('0x43')](this['channels'][_0x536ca2[_0x5da5('0x30')]][_0x5da5('0x27')])){logger[_0x5da5('0x2a')](_0x5da5('0x44'),_0x536ca2[_0x5da5('0x30')]);this['startAcw'](_0x536ca2[_0x5da5('0x30')]);}else if(this['channels'][_0x536ca2['linkedid']]&&_[_0x5da5('0x43')](this['channels'][_0x536ca2[_0x5da5('0x45')]][_0x5da5('0x27')])){logger[_0x5da5('0x2a')](_0x5da5('0x46'),_0x536ca2[_0x5da5('0x45')]);this[_0x5da5('0x1b')](_0x536ca2['linkedid']);}}catch(_0x5cb8d8){logger[_0x5da5('0x34')](_0x5da5('0x47'),_0x5cb8d8['message']);}};Acw['prototype'][_0x5da5('0xf')]=function(_0x4c1321){try{if(this[_0x5da5('0x9')][_0x4c1321['uniqueid']]&&this['channels'][_0x4c1321[_0x5da5('0x30')]][_0x5da5('0x27')]){logger[_0x5da5('0x2a')](_0x5da5('0x48'),_0x4c1321['uniqueid']);this[_0x5da5('0x1b')](_0x4c1321[_0x5da5('0x30')]);}else if(this[_0x5da5('0x9')][_0x4c1321['linkedid']]&&this[_0x5da5('0x9')][_0x4c1321[_0x5da5('0x45')]][_0x5da5('0x27')]){logger[_0x5da5('0x2a')](_0x5da5('0x49'),_0x4c1321[_0x5da5('0x45')]);this[_0x5da5('0x1b')](_0x4c1321[_0x5da5('0x45')]);}}catch(_0x3d1a54){logger[_0x5da5('0x34')](_0x5da5('0x4a'),_0x3d1a54[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x13')]=function(_0xb3a0b0){try{if(!_[_0x5da5('0x4b')](this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4c')]])){this[_0x5da5('0x1b')](_0xb3a0b0[_0x5da5('0x4c')]);if(this[_0x5da5('0x9')][_0xb3a0b0['secondtransfereruniqueid']]){this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4d')]]['attended']=!![];this['channels'][_0xb3a0b0['transfertargetuniqueid']]=this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4d')]];delete this[_0x5da5('0x9')][_0xb3a0b0['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4e')]])){this[_0x5da5('0x1b')](_0xb3a0b0[_0x5da5('0x4e')]);if(this['channels'][_0xb3a0b0[_0x5da5('0x4f')]]){this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]]['attended']=!![];this[_0x5da5('0x9')][_0xb3a0b0['transfereeuniqueid']]=this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]];delete this[_0x5da5('0x9')][_0xb3a0b0[_0x5da5('0x4f')]];}}}catch(_0x12c983){logger[_0x5da5('0x34')](_0x5da5('0x50'),_0x12c983[_0x5da5('0x3a')]);}};Acw[_0x5da5('0x1a')][_0x5da5('0x15')]=function(_0x2f9f72){try{if(this[_0x5da5('0x9')][_0x2f9f72[_0x5da5('0x51')]]){logger[_0x5da5('0x2a')](_0x5da5('0x52'),JSON[_0x5da5('0x53')](_0x2f9f72[_0x5da5('0x51')]));this[_0x5da5('0x1b')](_0x2f9f72[_0x5da5('0x51')]);}else if(this[_0x5da5('0x9')][_0x2f9f72[_0x5da5('0x54')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x5da5('0x53')](_0x2f9f72[_0x5da5('0x54')]));this[_0x5da5('0x1b')](_0x2f9f72['transfererlinkedid']);}}catch(_0x2ca7b9){logger[_0x5da5('0x34')](_0x5da5('0x55'),_0x2ca7b9[_0x5da5('0x3a')]);}};Acw['prototype'][_0x5da5('0x11')]=function(_0x5f3753){try{if(this[_0x5da5('0x6')][_0x5f3753[_0x5da5('0x1c')]]&&this[_0x5da5('0x6')][_0x5f3753[_0x5da5('0x1c')]][_0x5da5('0x56')]===_0x5da5('0x57')){if(this[_0x5da5('0x7')][_0x5f3753['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5f3753[_0x5da5('0x30')],_0x5f3753[_0x5da5('0x40')],_0x5f3753[_0x5da5('0x1c')]);return RpcUser[_0x5da5('0x29')](this[_0x5da5('0x7')][_0x5f3753[_0x5da5('0x40')]],_0x5da5('0x58'),_0x5f3753[_0x5da5('0x30')]);}}}catch(_0x5f4529){logger[_0x5da5('0x34')](_0x5da5('0x59'),_0x5f4529['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 a705e31..f39a5ad 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 _0x2935=['info','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','port','asterisk','username','password','Action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x90c363,_0x19a192){var _0x33cbfd=function(_0x47c574){while(--_0x47c574){_0x90c363['push'](_0x90c363['shift']());}};_0x33cbfd(++_0x19a192);}(_0x2935,0x1ed));var _0x5293=function(_0x21324f,_0xb85655){_0x21324f=_0x21324f-0x0;var _0x579ca8=_0x2935[_0x21324f];return _0x579ca8;};'use strict';var Manager=require(_0x5293('0x0'));var BPromise=require(_0x5293('0x1'));var moment=require(_0x5293('0x2'));var util=require(_0x5293('0x3'));var _=require(_0x5293('0x4'));var logger=require('../../config/logger')(_0x5293('0x5'));var config=require(_0x5293('0x6'));var ami=new Manager(config['asterisk'][_0x5293('0x7')],config[_0x5293('0x8')]['ip'],config[_0x5293('0x8')][_0x5293('0x9')],config[_0x5293('0x8')][_0x5293('0xa')],!![]);ami['keepConnected']();ami[_0x5293('0xb')]=BPromise['promisify'](ami['action']);function error(_0x18c4a3){logger[_0x5293('0xc')](util[_0x5293('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5293('0x8')][_0x5293('0x9')],config['asterisk']['ip'],config[_0x5293('0x8')]['port'],util[_0x5293('0xe')](_0x18c4a3,![],null)));}function close(){logger[_0x5293('0xc')](util['format'](_0x5293('0xf'),config[_0x5293('0x8')][_0x5293('0x9')],config['asterisk']['ip'],config['asterisk'][_0x5293('0x7')]));}ami[_0x5293('0x10')]=function(){return function(){return ami[_0x5293('0xb')]({'action':'sipshowregistry'});};};ami[_0x5293('0x11')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x12')});};};ami[_0x5293('0x13')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x14')});};};ami[_0x5293('0x15')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x16')});};};ami[_0x5293('0x17')]=function(){return function(){return ami[_0x5293('0xb')]({'action':_0x5293('0x18')});};};function connect(_0x5c5555){logger[_0x5293('0x19')](util[_0x5293('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x5293('0x8')][_0x5293('0x9')],config[_0x5293('0x8')]['ip'],config[_0x5293('0x8')][_0x5293('0x7')]));ami['once'](_0x5293('0xc'),error);ami[_0x5293('0x1a')](_0x5293('0x1b'),close);}ami['on'](_0x5293('0x1c'),connect);ami['on'](_0x5293('0x1d'),function(_0x27f037){logger[_0x5293('0x19')](util[_0x5293('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5293('0x8')]['username'],config[_0x5293('0x8')]['ip'],config['asterisk'][_0x5293('0x7')],util[_0x5293('0xe')](_0x27f037,![],null)));});ami['on'](_0x5293('0x1e'),function(_0x303f83){logger[_0x5293('0x19')](util[_0x5293('0xd')](_0x5293('0x1f'),config['asterisk'][_0x5293('0x9')],config['asterisk']['ip'],config[_0x5293('0x8')]['port']));return BPromise[_0x5293('0x20')]()['then'](ami[_0x5293('0x10')]())['then'](ami['actionDeviceStateList']())[_0x5293('0x21')](ami['actionSipPeerStatus']())['then'](ami[_0x5293('0x15')]())[_0x5293('0x21')](ami[_0x5293('0x17')]())[_0x5293('0x22')](function(_0x42cdb1){console[_0x5293('0x23')](_0x42cdb1);});});ami['once']('error',error);ami[_0x5293('0x1a')](_0x5293('0x1b'),close);module[_0x5293('0x24')]=ami; \ No newline at end of file +var _0xfaa6=['moment','util','../../config/logger','ami','asterisk','port','username','Action','promisify','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','exports','asterisk-manager','bluebird'];(function(_0x3e2ea4,_0xa590b3){var _0x3369ac=function(_0x24df0c){while(--_0x24df0c){_0x3e2ea4['push'](_0x3e2ea4['shift']());}};_0x3369ac(++_0xa590b3);}(_0xfaa6,0xad));var _0x6faa=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0xfaa6[_0x2f0057];return _0x17f2c3;};'use strict';var Manager=require(_0x6faa('0x0'));var BPromise=require(_0x6faa('0x1'));var moment=require(_0x6faa('0x2'));var util=require(_0x6faa('0x3'));var _=require('lodash');var logger=require(_0x6faa('0x4'))(_0x6faa('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x6faa('0x6')][_0x6faa('0x7')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')][_0x6faa('0x8')],config['asterisk']['password'],!![]);ami['keepConnected']();ami[_0x6faa('0x9')]=BPromise[_0x6faa('0xa')](ami[_0x6faa('0xb')]);function error(_0x3b7b9f){logger[_0x6faa('0xc')](util[_0x6faa('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x6faa('0x6')][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config['asterisk'][_0x6faa('0x7')],util[_0x6faa('0xe')](_0x3b7b9f,![],null)));}function close(){logger[_0x6faa('0xc')](util[_0x6faa('0xd')](_0x6faa('0xf'),config['asterisk'][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')][_0x6faa('0x7')]));}ami[_0x6faa('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x6faa('0x11')]=function(){return function(){return ami[_0x6faa('0x9')]({'action':_0x6faa('0x12')});};};ami[_0x6faa('0x13')]=function(){return function(){return ami[_0x6faa('0x9')]({'action':_0x6faa('0x14')});};};ami[_0x6faa('0x15')]=function(){return function(){return ami[_0x6faa('0x9')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x6faa('0x9')]({'action':_0x6faa('0x16')});};};function connect(_0x127d28){logger[_0x6faa('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6faa('0x6')][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')]['port']));ami[_0x6faa('0x18')](_0x6faa('0xc'),error);ami[_0x6faa('0x18')]('close',close);}ami['on'](_0x6faa('0x19'),connect);ami['on'](_0x6faa('0x1a'),function(_0x3d73d8){logger[_0x6faa('0x17')](util[_0x6faa('0xd')](_0x6faa('0x1b'),config[_0x6faa('0x6')][_0x6faa('0x8')],config['asterisk']['ip'],config['asterisk'][_0x6faa('0x7')],util[_0x6faa('0xe')](_0x3d73d8,![],null)));});ami['on'](_0x6faa('0x1c'),function(_0x48388c){logger[_0x6faa('0x17')](util[_0x6faa('0xd')](_0x6faa('0x1d'),config['asterisk'][_0x6faa('0x8')],config[_0x6faa('0x6')]['ip'],config[_0x6faa('0x6')][_0x6faa('0x7')]));return BPromise[_0x6faa('0x1e')]()[_0x6faa('0x1f')](ami[_0x6faa('0x10')]())['then'](ami['actionDeviceStateList']())[_0x6faa('0x1f')](ami['actionSipPeerStatus']())['then'](ami[_0x6faa('0x15')]())[_0x6faa('0x1f')](ami[_0x6faa('0x20')]())[_0x6faa('0x21')](function(_0x25b99b){console['log'](_0x25b99b);});});ami['once'](_0x6faa('0xc'),error);ami[_0x6faa('0x18')]('close',close);module[_0x6faa('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 065302d..445fbdd 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 _0x8fb8=['../../config/logger','ami','Request','request','then','rpc','memberReport','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x2455c9,_0x4924de){var _0x2af39a=function(_0x597bdd){while(--_0x597bdd){_0x2455c9['push'](_0x2455c9['shift']());}};_0x2af39a(++_0x4924de);}(_0x8fb8,0x108));var _0x88fb=function(_0x53f1de,_0x37d8d3){_0x53f1de=_0x53f1de-0x0;var _0x2fa505=_0x8fb8[_0x53f1de];return _0x2fa505;};'use strict';var jayson=require(_0x88fb('0x0'));var BPromise=require(_0x88fb('0x1'));var logger=require(_0x88fb('0x2'))(_0x88fb('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x88fb('0x4')]=function(_0x5d694c,_0x302790){return new BPromise(function(_0x2a1ab5,_0x135be5){return client[_0x88fb('0x5')](_0x5d694c,_0x302790)[_0x88fb('0x6')](function(_0x767bac){logger['debug'](_0x88fb('0x7'),_0x88fb('0x8'),_0x5d694c,_0x302790,_0x767bac);if(_0x767bac[_0x88fb('0x9')]){logger[_0x88fb('0x9')](_0x88fb('0x7'),_0x88fb('0x8'),_0x5d694c,_0x767bac[_0x88fb('0x9')][_0x88fb('0xa')],_0x302790);return _0x135be5(_0x767bac[_0x88fb('0x9')]['message']);}else{return _0x2a1ab5(_0x767bac[_0x88fb('0xb')]);}})[_0x88fb('0xc')](function(_0x376699){logger[_0x88fb('0x9')](_0x88fb('0x7'),_0x88fb('0x8'),_0x5d694c,_0x376699,_0x302790);return _0x135be5(_0x376699);});});};module[_0x88fb('0xd')]=client; \ No newline at end of file +var _0x1ee5=['message','catch','exports','jayson/promise','bluebird','../../config/logger','ami','then','rpc','memberReport','error'];(function(_0x2e74b6,_0x2cc27d){var _0x19af77=function(_0xcc7b2f){while(--_0xcc7b2f){_0x2e74b6['push'](_0x2e74b6['shift']());}};_0x19af77(++_0x2cc27d);}(_0x1ee5,0xc9));var _0x51ee=function(_0x12e60a,_0x46a07f){_0x12e60a=_0x12e60a-0x0;var _0x15d093=_0x1ee5[_0x12e60a];return _0x15d093;};'use strict';var jayson=require(_0x51ee('0x0'));var BPromise=require(_0x51ee('0x1'));var logger=require(_0x51ee('0x2'))(_0x51ee('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x554fe9,_0x302eef){return new BPromise(function(_0x4e2e8f,_0x52cebb){return client['request'](_0x554fe9,_0x302eef)[_0x51ee('0x4')](function(_0x4632ea){logger['debug'](_0x51ee('0x5'),_0x51ee('0x6'),_0x554fe9,_0x302eef,_0x4632ea);if(_0x4632ea['error']){logger['error'](_0x51ee('0x5'),'memberReport',_0x554fe9,_0x4632ea[_0x51ee('0x7')][_0x51ee('0x8')],_0x302eef);return _0x52cebb(_0x4632ea[_0x51ee('0x7')][_0x51ee('0x8')]);}else{return _0x4e2e8f(_0x4632ea['result']);}})[_0x51ee('0x9')](function(_0x38c052){logger[_0x51ee('0x7')](_0x51ee('0x5'),_0x51ee('0x6'),_0x554fe9,_0x38c052,_0x302eef);return _0x52cebb(_0x38c052);});});};module[_0x51ee('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9481121..385c0cd 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 _0xf9b6=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','recallme','originatecalleridname','name','voiceQueue','dialCutDigit','substring','prototype','getQueue','lodash','moment','isNil','string','uniqueid','Contact','phone','firstName','number','queue','active'];(function(_0x37d9eb,_0x1b6708){var _0x2c9240=function(_0x31e821){while(--_0x31e821){_0x37d9eb['push'](_0x37d9eb['shift']());}};_0x2c9240(++_0x1b6708);}(_0xf9b6,0x114));var _0x6f9b=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0xf9b6[_0x4dcecc];return _0x2aa658;};'use strict';var util=require('util');var _=require(_0x6f9b('0x0'));var moment=require(_0x6f9b('0x1'));function checkNameSurname(_0x54ef92,_0x1f168d,_0x52779e){var _0x37fbf1='';if(!_[_0x6f9b('0x2')](_0x1f168d)&&_0x6f9b('0x3')===typeof _0x1f168d){_0x37fbf1+=_0x1f168d;}if(!_[_0x6f9b('0x2')](_0x52779e)&&'string'===typeof _0x52779e){_0x37fbf1+='\x20'+_0x52779e;}if(_0x37fbf1!==''){return _0x37fbf1;}return _0x54ef92;}function Action(_0x4bb325,_0x58e76a,_0x52a849){this['voiceQueue']=_0x4bb325;this[_0x6f9b('0x4')]=_0x52a849||undefined;this['name']=checkNameSurname(_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x6')],_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x7')],_0x58e76a['Contact']['lastName']);this[_0x6f9b('0x8')]=_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x6')];this[_0x6f9b('0x9')]=_0x4bb325['name'];this[_0x6f9b('0xa')]=_0x58e76a[_0x6f9b('0xa')]||![];this[_0x6f9b('0xb')]=_0x4bb325['type'];this[_0x6f9b('0xc')]=_0x4bb325[_0x6f9b('0xc')]||0x3;this[_0x6f9b('0xd')]=_0x58e76a[_0x6f9b('0xd')];this[_0x6f9b('0xe')]=_0x58e76a['countbusyretry'];this[_0x6f9b('0xf')]=_0x58e76a[_0x6f9b('0xf')];this[_0x6f9b('0x10')]=_0x58e76a[_0x6f9b('0x10')];this['countnosuchnumberretry']=_0x58e76a[_0x6f9b('0x11')];this[_0x6f9b('0x12')]=_0x58e76a[_0x6f9b('0x12')];this[_0x6f9b('0x13')]=_0x58e76a[_0x6f9b('0x13')];this[_0x6f9b('0x14')]=_0x58e76a[_0x6f9b('0x14')];this[_0x6f9b('0x15')]=_0x58e76a['countagentrejectretry'];this[_0x6f9b('0x16')]=_0x58e76a['ContactId'];this[_0x6f9b('0x17')]=_0x58e76a[_0x6f9b('0x17')];this[_0x6f9b('0x18')]=_0x58e76a[_0x6f9b('0x18')];this[_0x6f9b('0x19')]=_0x58e76a['VoiceQueueId'];this['CampaignId']=_0x58e76a[_0x6f9b('0x1a')];this[_0x6f9b('0x1b')]=_0x58e76a['id'];this[_0x6f9b('0x1c')]=_0x58e76a[_0x6f9b('0x5')][_0x6f9b('0x7')]||'';this[_0x6f9b('0x1d')]=moment()[_0x6f9b('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6f9b('0x1f')]=_0x58e76a[_0x6f9b('0x1f')];this['callbackuniqueid']=_0x58e76a[_0x6f9b('0x20')];this['callbackat']=_0x58e76a['callbackat'];this[_0x6f9b('0x21')]=_0x58e76a[_0x6f9b('0x21')];this['originatecalleridnum']='';this[_0x6f9b('0x22')]='';}Action['prototype']['getCaller']=function(){return util[_0x6f9b('0x1e')]('\x22%s\x22\x20<%s>',this[_0x6f9b('0x23')],this[_0x6f9b('0x24')][_0x6f9b('0x25')]>0x0?this[_0x6f9b('0x8')][_0x6f9b('0x26')](this[_0x6f9b('0x24')][_0x6f9b('0x25')]):this[_0x6f9b('0x8')]);};Action[_0x6f9b('0x27')][_0x6f9b('0x28')]=function(){return this[_0x6f9b('0x9')];};module['exports']=Action; \ No newline at end of file +var _0x52c1=['callback','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','isNil','voiceQueue','name','Contact','phone','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1c8255,_0x1ee6b){var _0x13d0e1=function(_0x323623){while(--_0x323623){_0x1c8255['push'](_0x1c8255['shift']());}};_0x13d0e1(++_0x1ee6b);}(_0x52c1,0x1ce));var _0x152c=function(_0x3a2bd4,_0xe533d8){_0x3a2bd4=_0x3a2bd4-0x0;var _0x28f4a8=_0x52c1[_0x3a2bd4];return _0x28f4a8;};'use strict';var util=require(_0x152c('0x0'));var _=require(_0x152c('0x1'));var moment=require(_0x152c('0x2'));function checkNameSurname(_0x11ca60,_0x46fa33,_0x22092b){var _0x521699='';if(!_[_0x152c('0x3')](_0x46fa33)&&'string'===typeof _0x46fa33){_0x521699+=_0x46fa33;}if(!_[_0x152c('0x3')](_0x22092b)&&'string'===typeof _0x22092b){_0x521699+='\x20'+_0x22092b;}if(_0x521699!==''){return _0x521699;}return _0x11ca60;}function Action(_0x17c5f5,_0x56b4d0,_0x58fb2e){this[_0x152c('0x4')]=_0x17c5f5;this['uniqueid']=_0x58fb2e||undefined;this[_0x152c('0x5')]=checkNameSurname(_0x56b4d0[_0x152c('0x6')][_0x152c('0x7')],_0x56b4d0[_0x152c('0x6')]['firstName'],_0x56b4d0[_0x152c('0x6')][_0x152c('0x8')]);this['number']=_0x56b4d0[_0x152c('0x6')][_0x152c('0x7')];this[_0x152c('0x9')]=_0x17c5f5[_0x152c('0x5')];this[_0x152c('0xa')]=_0x56b4d0[_0x152c('0xa')]||![];this[_0x152c('0xb')]=_0x17c5f5[_0x152c('0xb')];this[_0x152c('0xc')]=_0x17c5f5[_0x152c('0xc')]||0x3;this[_0x152c('0xd')]=_0x56b4d0['scheduledat'];this[_0x152c('0xe')]=_0x56b4d0[_0x152c('0xe')];this[_0x152c('0xf')]=_0x56b4d0[_0x152c('0xf')];this[_0x152c('0x10')]=_0x56b4d0[_0x152c('0x10')];this[_0x152c('0x11')]=_0x56b4d0[_0x152c('0x11')];this['countdropretry']=_0x56b4d0[_0x152c('0x12')];this[_0x152c('0x13')]=_0x56b4d0[_0x152c('0x13')];this[_0x152c('0x14')]=_0x56b4d0['countmachineretry'];this[_0x152c('0x15')]=_0x56b4d0[_0x152c('0x15')];this[_0x152c('0x16')]=_0x56b4d0[_0x152c('0x16')];this[_0x152c('0x17')]=_0x56b4d0['ListId'];this[_0x152c('0x18')]=_0x56b4d0[_0x152c('0x18')];this[_0x152c('0x19')]=_0x56b4d0[_0x152c('0x19')];this[_0x152c('0x1a')]=_0x56b4d0[_0x152c('0x1a')];this[_0x152c('0x1b')]=_0x56b4d0['id'];this[_0x152c('0x1c')]=_0x56b4d0[_0x152c('0x6')][_0x152c('0x1d')]||'';this[_0x152c('0x1e')]=moment()[_0x152c('0x1f')](_0x152c('0x20'));this['callback']=_0x56b4d0[_0x152c('0x21')];this['callbackuniqueid']=_0x56b4d0['callbackuniqueid'];this['callbackat']=_0x56b4d0['callbackat'];this[_0x152c('0x22')]=_0x56b4d0[_0x152c('0x22')];this[_0x152c('0x23')]='';this[_0x152c('0x24')]='';}Action[_0x152c('0x25')][_0x152c('0x26')]=function(){return util[_0x152c('0x1f')](_0x152c('0x27'),this['name'],this['voiceQueue'][_0x152c('0x28')]>0x0?this[_0x152c('0x29')][_0x152c('0x2a')](this[_0x152c('0x4')][_0x152c('0x28')]):this[_0x152c('0x29')]);};Action[_0x152c('0x25')][_0x152c('0x2b')]=function(){return this['queue'];};module[_0x152c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 031fd5a..b8e7a2f 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 _0xc0cd=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x5c5e5b,_0x340ddb){var _0x4bbd26=function(_0x675742){while(--_0x675742){_0x5c5e5b['push'](_0x5c5e5b['shift']());}};_0x4bbd26(++_0x340ddb);}(_0xc0cd,0x7b));var _0xdc0c=function(_0x143fd0,_0x3afb81){_0x143fd0=_0x143fd0-0x0;var _0x3e4565=_0xc0cd[_0x143fd0];return _0x3e4565;};'use strict';var util=require(_0xdc0c('0x0'));var _=require(_0xdc0c('0x1'));var moment=require(_0xdc0c('0x2'));function getSeconds(_0x19f4d1,_0x454ab8){var _0x45a3e3=moment(_0x19f4d1)[_0xdc0c('0x3')](0x0);var _0x5be5ac=moment(_0x454ab8)[_0xdc0c('0x3')](0x0);return _0x45a3e3[_0xdc0c('0x4')](_0x5be5ac,_0xdc0c('0x5'));}function AdditionalPhone(_0x597006){this[_0xdc0c('0x6')]=_0x597006[_0xdc0c('0x6')];this[_0xdc0c('0x7')]=_0x597006['scheduledat']||undefined;this[_0xdc0c('0x8')]=_0x597006[_0xdc0c('0x8')];this[_0xdc0c('0x9')]=_0x597006['type']===_0xdc0c('0xa')?_0xdc0c('0xb'):_0x597006[_0xdc0c('0x8')];this[_0xdc0c('0xc')]=_0x597006[_0xdc0c('0xc')];this[_0xdc0c('0xd')]=_0x597006['countcongestionretry'];this[_0xdc0c('0xe')]=_0x597006['countnoanswerretry'];this[_0xdc0c('0xf')]=_0x597006['countbusyretry']+_0x597006[_0xdc0c('0xd')]+_0x597006['countnoanswerretry']+_0x597006[_0xdc0c('0x10')]+_0x597006[_0xdc0c('0x11')]+_0x597006['countabandonedretry']+_0x597006[_0xdc0c('0x12')]+_0x597006[_0xdc0c('0x13')];this[_0xdc0c('0x10')]=_0x597006[_0xdc0c('0x10')];this['countdropretry']=_0x597006['countdropretry'];this[_0xdc0c('0x14')]=_0x597006[_0xdc0c('0x14')];this[_0xdc0c('0x12')]=_0x597006[_0xdc0c('0x12')];this[_0xdc0c('0x13')]=_0x597006['countagentrejectretry'];this[_0xdc0c('0xb')]=_0x597006[_0xdc0c('0xb')];this['calleridname']=_0x597006['name'];this[_0xdc0c('0x15')]=_0x597006['number'];this[_0xdc0c('0x16')]=_0x597006[_0xdc0c('0x16')];this['responsetime']=_0x597006[_0xdc0c('0x17')];this['endtime']=_0x597006[_0xdc0c('0x17')];this[_0xdc0c('0x18')]=getSeconds(_0x597006['responsetime'],_0x597006[_0xdc0c('0x16')]);this[_0xdc0c('0x19')]=0x0;this[_0xdc0c('0x1a')]=0x0;this[_0xdc0c('0x1b')]=_0x597006['callback'];this[_0xdc0c('0x1c')]=_0x597006[_0xdc0c('0x1c')];this[_0xdc0c('0x1d')]=_0x597006[_0xdc0c('0x1d')];this[_0xdc0c('0x1e')]=_0x597006[_0xdc0c('0x1e')];this[_0xdc0c('0x1f')]=_0x597006[_0xdc0c('0x1f')];this[_0xdc0c('0x20')]=_0x597006[_0xdc0c('0x20')];this[_0xdc0c('0x21')]=_0x597006[_0xdc0c('0x21')];this[_0xdc0c('0x22')]=_0x597006['VoiceQueueId'];this[_0xdc0c('0x23')]=_0x597006[_0xdc0c('0x23')];this[_0xdc0c('0x24')]=_0x597006[_0xdc0c('0x24')]||'';this[_0xdc0c('0x25')]=_0x597006[_0xdc0c('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0xb5b8=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridnum','number','starttime','responsetime','endtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x41bd6d,_0x4cba8d){var _0x11d5a5=function(_0x223921){while(--_0x223921){_0x41bd6d['push'](_0x41bd6d['shift']());}};_0x11d5a5(++_0x4cba8d);}(_0xb5b8,0x103));var _0x8b5b=function(_0x16a062,_0xaa8f04){_0x16a062=_0x16a062-0x0;var _0xdc417b=_0xb5b8[_0x16a062];return _0xdc417b;};'use strict';var util=require(_0x8b5b('0x0'));var _=require('lodash');var moment=require(_0x8b5b('0x1'));function getSeconds(_0x443b74,_0x464ecc){var _0x328f51=moment(_0x443b74)[_0x8b5b('0x2')](0x0);var _0x29b475=moment(_0x464ecc)[_0x8b5b('0x2')](0x0);return _0x328f51['diff'](_0x29b475,_0x8b5b('0x3'));}function AdditionalPhone(_0x1509a4){this[_0x8b5b('0x4')]=_0x1509a4['uniqueid'];this[_0x8b5b('0x5')]=_0x1509a4[_0x8b5b('0x5')]||undefined;this['type']=_0x1509a4['type'];this['campaigntype']=_0x1509a4[_0x8b5b('0x6')]===_0x8b5b('0x7')?'queue':_0x1509a4['type'];this[_0x8b5b('0x8')]=_0x1509a4[_0x8b5b('0x8')];this[_0x8b5b('0x9')]=_0x1509a4['countcongestionretry'];this['countnoanswerretry']=_0x1509a4[_0x8b5b('0xa')];this[_0x8b5b('0xb')]=_0x1509a4[_0x8b5b('0x8')]+_0x1509a4[_0x8b5b('0x9')]+_0x1509a4['countnoanswerretry']+_0x1509a4[_0x8b5b('0xc')]+_0x1509a4[_0x8b5b('0xd')]+_0x1509a4[_0x8b5b('0xe')]+_0x1509a4['countmachineretry']+_0x1509a4[_0x8b5b('0xf')];this[_0x8b5b('0xc')]=_0x1509a4[_0x8b5b('0xc')];this[_0x8b5b('0xd')]=_0x1509a4[_0x8b5b('0xd')];this[_0x8b5b('0xe')]=_0x1509a4[_0x8b5b('0xe')];this['countmachineretry']=_0x1509a4[_0x8b5b('0x10')];this[_0x8b5b('0xf')]=_0x1509a4[_0x8b5b('0xf')];this[_0x8b5b('0x11')]=_0x1509a4[_0x8b5b('0x11')];this['calleridname']=_0x1509a4['name'];this[_0x8b5b('0x12')]=_0x1509a4[_0x8b5b('0x13')];this[_0x8b5b('0x14')]=_0x1509a4[_0x8b5b('0x14')];this['responsetime']=_0x1509a4[_0x8b5b('0x15')];this[_0x8b5b('0x16')]=_0x1509a4[_0x8b5b('0x15')];this['ringtime']=getSeconds(_0x1509a4[_0x8b5b('0x15')],_0x1509a4[_0x8b5b('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x8b5b('0x17')]=_0x1509a4[_0x8b5b('0x17')];this[_0x8b5b('0x18')]=_0x1509a4['callbackuniqueid'];this[_0x8b5b('0x19')]=_0x1509a4[_0x8b5b('0x19')];this['recallme']=_0x1509a4['recallme'];this[_0x8b5b('0x1a')]=_0x1509a4[_0x8b5b('0x1a')];this[_0x8b5b('0x1b')]=_0x1509a4[_0x8b5b('0x1b')];this['UserId']=_0x1509a4[_0x8b5b('0x1c')];this[_0x8b5b('0x1d')]=_0x1509a4[_0x8b5b('0x1d')];this[_0x8b5b('0x1e')]=_0x1509a4[_0x8b5b('0x1e')];this[_0x8b5b('0x1f')]=_0x1509a4[_0x8b5b('0x1f')]||'';this[_0x8b5b('0x20')]=_0x1509a4['originatecalleridname']||'';}module[_0x8b5b('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 40e50e8..d43aa62 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 _0x5e18=['exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x279e6a,_0x138d82){var _0x1a423f=function(_0x5a7606){while(--_0x5a7606){_0x279e6a['push'](_0x279e6a['shift']());}};_0x1a423f(++_0x138d82);}(_0x5e18,0x10f));var _0x85e1=function(_0x3aec14,_0x3b6fde){_0x3aec14=_0x3aec14-0x0;var _0x2af7f6=_0x5e18[_0x3aec14];return _0x2af7f6;};'use strict';var util=require(_0x85e1('0x0'));var _=require(_0x85e1('0x1'));var moment=require(_0x85e1('0x2'));function getSeconds(_0x3e1594,_0x4b3f02){var _0x3d70f0=moment(_0x3e1594)[_0x85e1('0x3')](0x0);var _0x26d4e6=moment(_0x4b3f02)[_0x85e1('0x3')](0x0);return _0x3d70f0[_0x85e1('0x4')](_0x26d4e6,_0x85e1('0x5'));}function AgentComplete(_0x542db8,_0x4bf26d){this['state']=0x4;this[_0x85e1('0x6')]='Answer';this[_0x85e1('0x7')]=_0x542db8[_0x85e1('0x7')];this['type']=_0x542db8[_0x85e1('0x8')];this['campaigntype']=_0x542db8[_0x85e1('0x8')]===_0x85e1('0x9')?_0x85e1('0xa'):_0x542db8[_0x85e1('0x8')];this[_0x85e1('0xb')]=_0x542db8[_0x85e1('0xb')];this[_0x85e1('0xc')]=_0x542db8[_0x85e1('0xc')];this[_0x85e1('0xd')]=_0x542db8[_0x85e1('0xd')];this[_0x85e1('0xe')]=_0x542db8[_0x85e1('0xb')]+_0x542db8[_0x85e1('0xc')]+_0x542db8[_0x85e1('0xd')]+_0x542db8[_0x85e1('0xf')]+_0x542db8['countdropretry']+_0x542db8['countabandonedretry']+_0x542db8[_0x85e1('0x10')]+_0x542db8[_0x85e1('0x11')];this[_0x85e1('0xf')]=_0x542db8[_0x85e1('0xf')];this[_0x85e1('0x12')]=_0x542db8[_0x85e1('0x12')];this[_0x85e1('0x13')]=_0x542db8[_0x85e1('0x13')];this[_0x85e1('0x10')]=_0x542db8[_0x85e1('0x10')];this['countagentrejectretry']=_0x542db8['countagentrejectretry'];this['uniqueid']=_0x4bf26d[_0x85e1('0x14')];this[_0x85e1('0x15')]=_0x542db8[_0x85e1('0x16')];this['calleridnum']=_0x542db8[_0x85e1('0x17')];this['starttime']=_0x542db8[_0x85e1('0x18')];this[_0x85e1('0x19')]=_0x542db8[_0x85e1('0x19')];this[_0x85e1('0x1a')]=_0x542db8[_0x85e1('0x1a')];this[_0x85e1('0x1b')]=moment()[_0x85e1('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x85e1('0x1d')]=getSeconds(_0x542db8['responsetime'],_0x542db8[_0x85e1('0x18')]);this[_0x85e1('0x1e')]=getSeconds(_0x542db8[_0x85e1('0x1a')],_0x542db8[_0x85e1('0x19')]);this[_0x85e1('0x1f')]=getSeconds(this[_0x85e1('0x1b')],_0x542db8[_0x85e1('0x1a')]);this[_0x85e1('0xa')]=_0x4bf26d[_0x85e1('0xa')];this[_0x85e1('0x20')]=_0x4bf26d[_0x85e1('0x20')];this['reason']=_0x4bf26d[_0x85e1('0x21')];this['callback']=_0x542db8[_0x85e1('0x22')];this[_0x85e1('0x23')]=_0x542db8['callbackuniqueid'];this[_0x85e1('0x24')]=_0x542db8[_0x85e1('0x24')];this['recallme']=_0x542db8['recallme'];this[_0x85e1('0x25')]=_0x542db8[_0x85e1('0x25')];this[_0x85e1('0x26')]=_0x542db8['ListId'];this[_0x85e1('0x27')]=_0x542db8['UserId'];this[_0x85e1('0x28')]=_0x542db8[_0x85e1('0x28')];this[_0x85e1('0x29')]=_0x542db8[_0x85e1('0x29')];this[_0x85e1('0x2a')]=_0x542db8[_0x85e1('0x2a')]||'';this[_0x85e1('0x2b')]=_0x542db8[_0x85e1('0x2b')]||'';}module[_0x85e1('0x2c')]=AgentComplete; \ No newline at end of file +var _0x5d60=['statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x5d60,0xf7));var _0x05d6=function(_0x43ab69,_0x528f47){_0x43ab69=_0x43ab69-0x0;var _0x5a5975=_0x5d60[_0x43ab69];return _0x5a5975;};'use strict';var util=require(_0x05d6('0x0'));var _=require(_0x05d6('0x1'));var moment=require('moment');function getSeconds(_0x297ef4,_0x455328){var _0x45c37e=moment(_0x297ef4)[_0x05d6('0x2')](0x0);var _0x3bb31d=moment(_0x455328)[_0x05d6('0x2')](0x0);return _0x45c37e[_0x05d6('0x3')](_0x3bb31d,_0x05d6('0x4'));}function AgentComplete(_0x224b6f,_0x45fb0b){this['state']=0x4;this[_0x05d6('0x5')]=_0x05d6('0x6');this[_0x05d6('0x7')]=_0x224b6f[_0x05d6('0x7')];this[_0x05d6('0x8')]=_0x224b6f[_0x05d6('0x8')];this[_0x05d6('0x9')]=_0x224b6f[_0x05d6('0x8')]===_0x05d6('0xa')?'queue':_0x224b6f[_0x05d6('0x8')];this[_0x05d6('0xb')]=_0x224b6f['countbusyretry'];this['countcongestionretry']=_0x224b6f['countcongestionretry'];this[_0x05d6('0xc')]=_0x224b6f[_0x05d6('0xc')];this[_0x05d6('0xd')]=_0x224b6f[_0x05d6('0xb')]+_0x224b6f['countcongestionretry']+_0x224b6f[_0x05d6('0xc')]+_0x224b6f[_0x05d6('0xe')]+_0x224b6f[_0x05d6('0xf')]+_0x224b6f[_0x05d6('0x10')]+_0x224b6f[_0x05d6('0x11')]+_0x224b6f[_0x05d6('0x12')];this[_0x05d6('0xe')]=_0x224b6f['countnosuchnumberretry'];this['countdropretry']=_0x224b6f[_0x05d6('0xf')];this[_0x05d6('0x10')]=_0x224b6f[_0x05d6('0x10')];this[_0x05d6('0x11')]=_0x224b6f['countmachineretry'];this['countagentrejectretry']=_0x224b6f[_0x05d6('0x12')];this[_0x05d6('0x13')]=_0x45fb0b['uniqueid'];this['calleridname']=_0x224b6f[_0x05d6('0x14')];this['calleridnum']=_0x224b6f['number'];this[_0x05d6('0x15')]=_0x224b6f['starttime'];this[_0x05d6('0x16')]=_0x224b6f['responsetime'];this[_0x05d6('0x17')]=_0x224b6f[_0x05d6('0x17')];this[_0x05d6('0x18')]=moment()['format'](_0x05d6('0x19'));this[_0x05d6('0x1a')]=getSeconds(_0x224b6f[_0x05d6('0x16')],_0x224b6f[_0x05d6('0x15')]);this['holdtime']=getSeconds(_0x224b6f[_0x05d6('0x17')],_0x224b6f[_0x05d6('0x16')]);this[_0x05d6('0x1b')]=getSeconds(this[_0x05d6('0x18')],_0x224b6f['answertime']);this[_0x05d6('0x1c')]=_0x45fb0b[_0x05d6('0x1c')];this[_0x05d6('0x1d')]=_0x45fb0b[_0x05d6('0x1d')];this['reason']=_0x45fb0b['reason'];this[_0x05d6('0x1e')]=_0x224b6f[_0x05d6('0x1e')];this[_0x05d6('0x1f')]=_0x224b6f[_0x05d6('0x1f')];this[_0x05d6('0x20')]=_0x224b6f[_0x05d6('0x20')];this[_0x05d6('0x21')]=_0x224b6f['recallme'];this[_0x05d6('0x22')]=_0x224b6f['ContactId'];this[_0x05d6('0x23')]=_0x224b6f[_0x05d6('0x23')];this['UserId']=_0x224b6f[_0x05d6('0x24')];this[_0x05d6('0x25')]=_0x224b6f[_0x05d6('0x25')];this[_0x05d6('0x26')]=_0x224b6f[_0x05d6('0x26')];this[_0x05d6('0x27')]=_0x224b6f[_0x05d6('0x27')]||'';this[_0x05d6('0x28')]=_0x224b6f[_0x05d6('0x28')]||'';}module[_0x05d6('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index bdd9eaf..7d3d329 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 _0x064d=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x1050ba,_0x5ad911){var _0x5a99a5=function(_0x30e240){while(--_0x30e240){_0x1050ba['push'](_0x1050ba['shift']());}};_0x5a99a5(++_0x5ad911);}(_0x064d,0x178));var _0xd064=function(_0x1854ba,_0x109e2){_0x1854ba=_0x1854ba-0x0;var _0xafcdba=_0x064d[_0x1854ba];return _0xafcdba;};'use strict';var util=require(_0xd064('0x0'));var _=require(_0xd064('0x1'));var moment=require(_0xd064('0x2'));function getSeconds(_0x1e912b,_0xd98497){var _0x1a859a=moment(_0x1e912b)[_0xd064('0x3')](0x0);var _0x21a183=moment(_0xd98497)[_0xd064('0x3')](0x0);return _0x1a859a[_0xd064('0x4')](_0x21a183,_0xd064('0x5'));}function Final(_0x57c12a){this[_0xd064('0x6')]=_0x57c12a[_0xd064('0x6')];this[_0xd064('0x7')]=_0x57c12a[_0xd064('0x7')];this[_0xd064('0x8')]=_0x57c12a[_0xd064('0x8')];this[_0xd064('0x9')]=_0x57c12a[_0xd064('0x8')]===_0xd064('0xa')?_0xd064('0xb'):_0x57c12a[_0xd064('0x8')];this[_0xd064('0xc')]=_0x57c12a[_0xd064('0xc')];this[_0xd064('0xd')]=_0x57c12a[_0xd064('0xd')];this['countnoanswerretry']=_0x57c12a[_0xd064('0xe')];this['countglobal']=_0x57c12a[_0xd064('0xc')]+_0x57c12a['countcongestionretry']+_0x57c12a[_0xd064('0xe')]+_0x57c12a[_0xd064('0xf')]+_0x57c12a['countdropretry']+_0x57c12a[_0xd064('0x10')]+_0x57c12a[_0xd064('0x11')]+_0x57c12a[_0xd064('0x12')];this[_0xd064('0xf')]=_0x57c12a[_0xd064('0xf')];this['countdropretry']=_0x57c12a[_0xd064('0x13')];this[_0xd064('0x10')]=_0x57c12a[_0xd064('0x10')];this[_0xd064('0x11')]=_0x57c12a['countmachineretry'];this[_0xd064('0x12')]=_0x57c12a[_0xd064('0x12')];this[_0xd064('0xb')]=_0x57c12a['queue'];this['calleridname']=_0x57c12a[_0xd064('0x14')];this[_0xd064('0x15')]=_0x57c12a[_0xd064('0x15')];this[_0xd064('0x16')]=_0x57c12a['starttime'];this['responsetime']=_0x57c12a[_0xd064('0x17')];this[_0xd064('0x18')]=_0x57c12a[_0xd064('0x17')];this[_0xd064('0x19')]=_0x57c12a[_0xd064('0x19')]||0x0;this[_0xd064('0x1a')]=_0x57c12a[_0xd064('0x1a')]||0x0;this['talktime']=_0x57c12a[_0xd064('0x1b')]||0x0;this[_0xd064('0x1c')]=_0x57c12a[_0xd064('0x1c')];this[_0xd064('0x1d')]=_0x57c12a[_0xd064('0x1d')];this[_0xd064('0x1e')]=_0x57c12a[_0xd064('0x1e')];this['recallme']=_0x57c12a[_0xd064('0x1f')];this[_0xd064('0x20')]=_0x57c12a[_0xd064('0x20')];this[_0xd064('0x21')]=_0x57c12a[_0xd064('0x21')];this[_0xd064('0x22')]=_0x57c12a[_0xd064('0x22')];this[_0xd064('0x23')]=_0x57c12a['VoiceQueueId'];this[_0xd064('0x24')]=_0x57c12a[_0xd064('0x24')];this[_0xd064('0x25')]=_0x57c12a[_0xd064('0x25')]||'';this[_0xd064('0x26')]=_0x57c12a[_0xd064('0x26')]||'';}module[_0xd064('0x27')]=Final; \ No newline at end of file +var _0x5212=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x5052c8,_0x54d98d){var _0xaeb572=function(_0x1cb450){while(--_0x1cb450){_0x5052c8['push'](_0x5052c8['shift']());}};_0xaeb572(++_0x54d98d);}(_0x5212,0x1b0));var _0x2521=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5212[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0x2521('0x0'));var _=require(_0x2521('0x1'));var moment=require(_0x2521('0x2'));function getSeconds(_0x46a362,_0xc7f5e0){var _0x318471=moment(_0x46a362)[_0x2521('0x3')](0x0);var _0x18f11f=moment(_0xc7f5e0)[_0x2521('0x3')](0x0);return _0x318471['diff'](_0x18f11f,_0x2521('0x4'));}function Final(_0x3501cb){this[_0x2521('0x5')]=_0x3501cb[_0x2521('0x5')];this[_0x2521('0x6')]=_0x3501cb[_0x2521('0x6')];this[_0x2521('0x7')]=_0x3501cb[_0x2521('0x7')];this['campaigntype']=_0x3501cb[_0x2521('0x7')]===_0x2521('0x8')?_0x2521('0x9'):_0x3501cb[_0x2521('0x7')];this['countbusyretry']=_0x3501cb['countbusyretry'];this[_0x2521('0xa')]=_0x3501cb[_0x2521('0xa')];this[_0x2521('0xb')]=_0x3501cb[_0x2521('0xb')];this[_0x2521('0xc')]=_0x3501cb[_0x2521('0xd')]+_0x3501cb[_0x2521('0xa')]+_0x3501cb['countnoanswerretry']+_0x3501cb[_0x2521('0xe')]+_0x3501cb[_0x2521('0xf')]+_0x3501cb[_0x2521('0x10')]+_0x3501cb[_0x2521('0x11')]+_0x3501cb[_0x2521('0x12')];this[_0x2521('0xe')]=_0x3501cb[_0x2521('0xe')];this[_0x2521('0xf')]=_0x3501cb['countdropretry'];this[_0x2521('0x10')]=_0x3501cb[_0x2521('0x10')];this[_0x2521('0x11')]=_0x3501cb['countmachineretry'];this[_0x2521('0x12')]=_0x3501cb[_0x2521('0x12')];this[_0x2521('0x9')]=_0x3501cb[_0x2521('0x9')];this[_0x2521('0x13')]=_0x3501cb['calleridname'];this[_0x2521('0x14')]=_0x3501cb[_0x2521('0x14')];this[_0x2521('0x15')]=_0x3501cb[_0x2521('0x15')];this[_0x2521('0x16')]=_0x3501cb[_0x2521('0x16')];this[_0x2521('0x17')]=_0x3501cb[_0x2521('0x16')];this[_0x2521('0x18')]=_0x3501cb[_0x2521('0x18')]||0x0;this[_0x2521('0x19')]=_0x3501cb[_0x2521('0x19')]||0x0;this[_0x2521('0x1a')]=_0x3501cb[_0x2521('0x1a')]||0x0;this[_0x2521('0x1b')]=_0x3501cb[_0x2521('0x1b')];this[_0x2521('0x1c')]=_0x3501cb[_0x2521('0x1c')];this['callbackat']=_0x3501cb[_0x2521('0x1d')];this[_0x2521('0x1e')]=_0x3501cb[_0x2521('0x1e')];this[_0x2521('0x1f')]=_0x3501cb[_0x2521('0x1f')];this[_0x2521('0x20')]=_0x3501cb[_0x2521('0x20')];this[_0x2521('0x21')]=_0x3501cb[_0x2521('0x21')];this[_0x2521('0x22')]=_0x3501cb['VoiceQueueId'];this[_0x2521('0x23')]=_0x3501cb[_0x2521('0x23')];this[_0x2521('0x24')]=_0x3501cb[_0x2521('0x24')]||'';this[_0x2521('0x25')]=_0x3501cb[_0x2521('0x25')]||'';}module[_0x2521('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 92ac6d8..6f471af 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 _0x7420=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','holdtime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0x1daeaa,_0x297e73){var _0x2a6032=function(_0x11897b){while(--_0x11897b){_0x1daeaa['push'](_0x1daeaa['shift']());}};_0x2a6032(++_0x297e73);}(_0x7420,0x13e));var _0x0742=function(_0x3e62a8,_0x1e03a3){_0x3e62a8=_0x3e62a8-0x0;var _0x2a7846=_0x7420[_0x3e62a8];return _0x2a7846;};'use strict';var util=require(_0x0742('0x0'));var _=require(_0x0742('0x1'));var moment=require('moment');function getSeconds(_0x17e8ad,_0x5b45ce){var _0x4c7058=moment(_0x17e8ad)[_0x0742('0x2')](0x0);var _0x338299=moment(_0x5b45ce)[_0x0742('0x2')](0x0);return _0x4c7058[_0x0742('0x3')](_0x338299,_0x0742('0x4'));}function Hangup(_0x39435e,_0x309b24){this[_0x0742('0x5')]=0x4;this[_0x0742('0x6')]=_0x0742('0x7');this[_0x0742('0x8')]=_0x39435e[_0x0742('0x8')];this[_0x0742('0x9')]=_0x39435e[_0x0742('0x9')];this['campaigntype']=_0x39435e[_0x0742('0x9')]==='outbound'?_0x0742('0xa'):_0x39435e[_0x0742('0x9')];this[_0x0742('0xb')]=_0x39435e['countbusyretry'];this[_0x0742('0xc')]=_0x39435e['countcongestionretry'];this[_0x0742('0xd')]=_0x39435e['countnoanswerretry'];this[_0x0742('0xe')]=_0x39435e[_0x0742('0xb')]+_0x39435e['countcongestionretry']+_0x39435e['countnoanswerretry']+_0x39435e[_0x0742('0xf')]+_0x39435e[_0x0742('0x10')]+_0x39435e[_0x0742('0x11')]+_0x39435e['countmachineretry']+_0x39435e[_0x0742('0x12')];this[_0x0742('0xf')]=_0x39435e[_0x0742('0xf')];this['countdropretry']=_0x39435e[_0x0742('0x10')];this[_0x0742('0x11')]=_0x39435e[_0x0742('0x11')];this[_0x0742('0x13')]=_0x39435e[_0x0742('0x13')];this[_0x0742('0x12')]=_0x39435e[_0x0742('0x12')];this['uniqueid']=_0x309b24['uniqueid'];this['calleridname']=_0x39435e[_0x0742('0x14')];this[_0x0742('0x15')]=_0x39435e[_0x0742('0x16')];this[_0x0742('0x17')]=_0x39435e[_0x0742('0x17')];this['responsetime']=_0x39435e['responsetime'];this[_0x0742('0x18')]=moment()[_0x0742('0x19')](_0x0742('0x1a'));this['ringtime']=getSeconds(_0x39435e[_0x0742('0x1b')],_0x39435e['starttime']);this[_0x0742('0x1c')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x39435e['responsetime']);this['queue']=_0x39435e['queue'];this[_0x0742('0x1d')]=_0x0742('0x1e');this[_0x0742('0x1f')]=_0x309b24[_0x0742('0x20')];this[_0x0742('0x21')]=_0x39435e[_0x0742('0x21')];this['callbackuniqueid']=_0x39435e['callbackuniqueid'];this['callbackat']=_0x39435e[_0x0742('0x22')];this[_0x0742('0x23')]=_0x39435e['recallme'];this[_0x0742('0x24')]=_0x39435e['ContactId'];this[_0x0742('0x25')]=_0x39435e['ListId'];this[_0x0742('0x26')]=_0x39435e[_0x0742('0x26')];this['VoiceQueueId']=_0x39435e['VoiceQueueId'];this[_0x0742('0x27')]=_0x39435e[_0x0742('0x27')];}module[_0x0742('0x28')]=Hangup; \ No newline at end of file +var _0xad65=['VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x517c7d,_0x3af8b){var _0x3f64e8=function(_0x6dfe4d){while(--_0x6dfe4d){_0x517c7d['push'](_0x517c7d['shift']());}};_0x3f64e8(++_0x3af8b);}(_0xad65,0x87));var _0x5ad6=function(_0x5e2ffc,_0x167c1e){_0x5e2ffc=_0x5e2ffc-0x0;var _0x499d72=_0xad65[_0x5e2ffc];return _0x499d72;};'use strict';var util=require(_0x5ad6('0x0'));var _=require(_0x5ad6('0x1'));var moment=require(_0x5ad6('0x2'));function getSeconds(_0x3b5a97,_0x299562){var _0x3ed122=moment(_0x3b5a97)[_0x5ad6('0x3')](0x0);var _0x2d0d3a=moment(_0x299562)[_0x5ad6('0x3')](0x0);return _0x3ed122[_0x5ad6('0x4')](_0x2d0d3a,_0x5ad6('0x5'));}function Hangup(_0x561792,_0x2221ca){this[_0x5ad6('0x6')]=0x4;this['statedesc']=_0x5ad6('0x7');this['scheduledat']=_0x561792[_0x5ad6('0x8')];this[_0x5ad6('0x9')]=_0x561792[_0x5ad6('0x9')];this['campaigntype']=_0x561792[_0x5ad6('0x9')]===_0x5ad6('0xa')?_0x5ad6('0xb'):_0x561792[_0x5ad6('0x9')];this[_0x5ad6('0xc')]=_0x561792[_0x5ad6('0xc')];this[_0x5ad6('0xd')]=_0x561792[_0x5ad6('0xd')];this[_0x5ad6('0xe')]=_0x561792['countnoanswerretry'];this[_0x5ad6('0xf')]=_0x561792[_0x5ad6('0xc')]+_0x561792['countcongestionretry']+_0x561792['countnoanswerretry']+_0x561792['countnosuchnumberretry']+_0x561792[_0x5ad6('0x10')]+_0x561792[_0x5ad6('0x11')]+_0x561792[_0x5ad6('0x12')]+_0x561792[_0x5ad6('0x13')];this['countnosuchnumberretry']=_0x561792['countnosuchnumberretry'];this['countdropretry']=_0x561792[_0x5ad6('0x10')];this['countabandonedretry']=_0x561792[_0x5ad6('0x11')];this[_0x5ad6('0x12')]=_0x561792[_0x5ad6('0x12')];this[_0x5ad6('0x13')]=_0x561792[_0x5ad6('0x13')];this[_0x5ad6('0x14')]=_0x2221ca[_0x5ad6('0x14')];this[_0x5ad6('0x15')]=_0x561792['name'];this[_0x5ad6('0x16')]=_0x561792[_0x5ad6('0x17')];this[_0x5ad6('0x18')]=_0x561792[_0x5ad6('0x18')];this[_0x5ad6('0x19')]=_0x561792[_0x5ad6('0x19')];this[_0x5ad6('0x1a')]=moment()[_0x5ad6('0x1b')](_0x5ad6('0x1c'));this['ringtime']=getSeconds(_0x561792[_0x5ad6('0x19')],_0x561792[_0x5ad6('0x18')]);this[_0x5ad6('0x1d')]=0x0;this[_0x5ad6('0x1e')]=getSeconds(this[_0x5ad6('0x1a')],_0x561792[_0x5ad6('0x19')]);this['queue']=_0x561792['queue'];this['membername']=_0x5ad6('0x1f');this[_0x5ad6('0x20')]=_0x2221ca[_0x5ad6('0x21')];this['callback']=_0x561792[_0x5ad6('0x22')];this[_0x5ad6('0x23')]=_0x561792[_0x5ad6('0x23')];this[_0x5ad6('0x24')]=_0x561792['callbackat'];this[_0x5ad6('0x25')]=_0x561792[_0x5ad6('0x25')];this[_0x5ad6('0x26')]=_0x561792[_0x5ad6('0x26')];this[_0x5ad6('0x27')]=_0x561792[_0x5ad6('0x27')];this[_0x5ad6('0x28')]=_0x561792[_0x5ad6('0x28')];this['VoiceQueueId']=_0x561792[_0x5ad6('0x29')];this[_0x5ad6('0x2a')]=_0x561792[_0x5ad6('0x2a')];}module[_0x5ad6('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ee8958e..fee6606 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 _0xe200=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','calleridname','name','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','uniqueid','scheduledat','type'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe200,0x8d));var _0x0e20=function(_0xd7c069,_0x1cc043){_0xd7c069=_0xd7c069-0x0;var _0x4fb3b1=_0xe200[_0xd7c069];return _0x4fb3b1;};'use strict';var util=require(_0x0e20('0x0'));var _=require(_0x0e20('0x1'));var moment=require(_0x0e20('0x2'));function getSeconds(_0x2c1c43,_0x2f2c75){var _0x266e5d=moment(_0x2c1c43)[_0x0e20('0x3')](0x0);var _0x48c9bb=moment(_0x2f2c75)['milliseconds'](0x0);return _0x266e5d['diff'](_0x48c9bb,'seconds');}function History(_0x26079d){this['uniqueid']=_0x26079d[_0x0e20('0x4')];this['scheduledat']=_0x26079d[_0x0e20('0x5')]||undefined;this[_0x0e20('0x6')]=_0x26079d[_0x0e20('0x6')];this[_0x0e20('0x7')]=_0x26079d[_0x0e20('0x6')]===_0x0e20('0x8')?'queue':_0x26079d[_0x0e20('0x6')];this[_0x0e20('0x9')]=_0x26079d[_0x0e20('0x9')];this[_0x0e20('0xa')]=_0x26079d[_0x0e20('0xa')];this[_0x0e20('0xb')]=_0x26079d[_0x0e20('0xb')];this[_0x0e20('0xc')]=_0x26079d[_0x0e20('0x9')]+_0x26079d['countcongestionretry']+_0x26079d[_0x0e20('0xb')]+_0x26079d[_0x0e20('0xd')]+_0x26079d['countdropretry']+_0x26079d['countabandonedretry']+_0x26079d[_0x0e20('0xe')]+_0x26079d[_0x0e20('0xf')];this[_0x0e20('0xd')]=_0x26079d[_0x0e20('0xd')];this[_0x0e20('0x10')]=_0x26079d[_0x0e20('0x10')];this['countabandonedretry']=_0x26079d[_0x0e20('0x11')];this[_0x0e20('0xe')]=_0x26079d['countmachineretry'];this[_0x0e20('0xf')]=_0x26079d[_0x0e20('0xf')];this['queue']=_0x26079d[_0x0e20('0x12')];this[_0x0e20('0x13')]=_0x26079d[_0x0e20('0x14')];this['calleridnum']=_0x26079d[_0x0e20('0x15')];this[_0x0e20('0x16')]=_0x26079d['starttime'];this[_0x0e20('0x17')]=_0x26079d[_0x0e20('0x17')];this['endtime']=_0x26079d['responsetime'];this[_0x0e20('0x18')]=getSeconds(_0x26079d[_0x0e20('0x17')],_0x26079d[_0x0e20('0x16')]);this['holdtime']=0x0;this[_0x0e20('0x19')]=0x0;this[_0x0e20('0x1a')]=_0x26079d[_0x0e20('0x1a')];this[_0x0e20('0x1b')]=_0x26079d[_0x0e20('0x1b')];this[_0x0e20('0x1c')]=_0x26079d[_0x0e20('0x1c')];this['recallme']=_0x26079d[_0x0e20('0x1d')];this[_0x0e20('0x1e')]=_0x26079d[_0x0e20('0x1e')];this[_0x0e20('0x1f')]=_0x26079d[_0x0e20('0x1f')];this[_0x0e20('0x20')]=_0x26079d[_0x0e20('0x20')];this[_0x0e20('0x21')]=_0x26079d['VoiceQueueId'];this[_0x0e20('0x22')]=_0x26079d[_0x0e20('0x22')];this['originatecalleridnum']=_0x26079d[_0x0e20('0x23')]||'';this[_0x0e20('0x24')]=_0x26079d['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0x0dd9=['util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dd9,0x78));var _0x90dd=function(_0x44424a,_0x47a34f){_0x44424a=_0x44424a-0x0;var _0x173e65=_0x0dd9[_0x44424a];return _0x173e65;};'use strict';var util=require(_0x90dd('0x0'));var _=require(_0x90dd('0x1'));var moment=require('moment');function getSeconds(_0x4afbda,_0x3da182){var _0x4381dc=moment(_0x4afbda)[_0x90dd('0x2')](0x0);var _0x4dd1e5=moment(_0x3da182)[_0x90dd('0x2')](0x0);return _0x4381dc['diff'](_0x4dd1e5,_0x90dd('0x3'));}function History(_0x452506){this[_0x90dd('0x4')]=_0x452506[_0x90dd('0x4')];this[_0x90dd('0x5')]=_0x452506['scheduledat']||undefined;this[_0x90dd('0x6')]=_0x452506[_0x90dd('0x6')];this[_0x90dd('0x7')]=_0x452506[_0x90dd('0x6')]===_0x90dd('0x8')?_0x90dd('0x9'):_0x452506[_0x90dd('0x6')];this[_0x90dd('0xa')]=_0x452506[_0x90dd('0xa')];this[_0x90dd('0xb')]=_0x452506[_0x90dd('0xb')];this[_0x90dd('0xc')]=_0x452506['countnoanswerretry'];this[_0x90dd('0xd')]=_0x452506[_0x90dd('0xa')]+_0x452506[_0x90dd('0xb')]+_0x452506[_0x90dd('0xc')]+_0x452506[_0x90dd('0xe')]+_0x452506[_0x90dd('0xf')]+_0x452506['countabandonedretry']+_0x452506[_0x90dd('0x10')]+_0x452506[_0x90dd('0x11')];this[_0x90dd('0xe')]=_0x452506[_0x90dd('0xe')];this['countdropretry']=_0x452506[_0x90dd('0xf')];this['countabandonedretry']=_0x452506[_0x90dd('0x12')];this[_0x90dd('0x10')]=_0x452506[_0x90dd('0x10')];this[_0x90dd('0x11')]=_0x452506['countagentrejectretry'];this[_0x90dd('0x9')]=_0x452506[_0x90dd('0x9')];this[_0x90dd('0x13')]=_0x452506['name'];this[_0x90dd('0x14')]=_0x452506[_0x90dd('0x15')];this['starttime']=_0x452506[_0x90dd('0x16')];this[_0x90dd('0x17')]=_0x452506[_0x90dd('0x17')];this[_0x90dd('0x18')]=_0x452506[_0x90dd('0x17')];this[_0x90dd('0x19')]=getSeconds(_0x452506[_0x90dd('0x17')],_0x452506[_0x90dd('0x16')]);this[_0x90dd('0x1a')]=0x0;this[_0x90dd('0x1b')]=0x0;this[_0x90dd('0x1c')]=_0x452506[_0x90dd('0x1c')];this[_0x90dd('0x1d')]=_0x452506['callbackuniqueid'];this[_0x90dd('0x1e')]=_0x452506[_0x90dd('0x1e')];this[_0x90dd('0x1f')]=_0x452506[_0x90dd('0x1f')];this[_0x90dd('0x20')]=_0x452506[_0x90dd('0x20')];this[_0x90dd('0x21')]=_0x452506[_0x90dd('0x21')];this[_0x90dd('0x22')]=_0x452506[_0x90dd('0x22')];this[_0x90dd('0x23')]=_0x452506[_0x90dd('0x23')];this[_0x90dd('0x24')]=_0x452506['CampaignId'];this[_0x90dd('0x25')]=_0x452506[_0x90dd('0x25')]||'';this[_0x90dd('0x26')]=_0x452506['originatecalleridname']||'';}module[_0x90dd('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 3f1ddd8..4d57d72 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 _0x0b3d=['queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','type','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','diff','startProgressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','stack','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','sequence','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','amd','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','countglobal','[syncAgentComplete][createHistory][0]','countnoanswerretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','[syncHangupIvr]','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','booked','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\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]','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperBlack','./action','./history','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0b3d,0x1e3));var _0xd0b3=function(_0x17925d,_0x46543f){_0x17925d=_0x17925d-0x0;var _0x5492b7=_0x0b3d[_0x17925d];return _0x5492b7;};'use strict';var util=require(_0xd0b3('0x0'));var _=require(_0xd0b3('0x1'));var BPromise=require(_0xd0b3('0x2'));var uuid=require(_0xd0b3('0x3'));var moment=require(_0xd0b3('0x4'));var rr=require('rr');var md5=require(_0xd0b3('0x5'));var Redis=require(_0xd0b3('0x6'));var ut=require('../preview/util/util');var config=require(_0xd0b3('0x7'));var logger=require(_0xd0b3('0x8'))(_0xd0b3('0x9'));var loggerBooked=require(_0xd0b3('0x8'))('booked');var loggerPredictive=require(_0xd0b3('0x8'))(_0xd0b3('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xd0b3('0xb'));var loggerSyncQueueSummary=require(_0xd0b3('0x8'))(_0xd0b3('0xc'));var ami=require(_0xd0b3('0xd'));config[_0xd0b3('0xe')]=_['defaults'](config['redis'],{'host':_0xd0b3('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd0b3('0xe')]));var cmHopper=require(_0xd0b3('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd0b3('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xd0b3('0x12'));var History=require(_0xd0b3('0x13'));var Final=require(_0xd0b3('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xd0b3('0x15'));var Hangup=require(_0xd0b3('0x16'));var ipAgi=process[_0xd0b3('0x17')]['XCALLY_IP_AGI']||_0xd0b3('0x18');var strategy={'rrmemory':_0xd0b3('0x19'),'roundrobin':_0xd0b3('0x1a')};var Sequence=function(){};Sequence[_0xd0b3('0x1b')][_0xd0b3('0x1c')]=function(_0x472956){this[_0xd0b3('0x1d')]=this[_0xd0b3('0x1d')]?this[_0xd0b3('0x1d')][_0xd0b3('0x1e')](_0x472956):_0x472956();};function Dialer(_0x5ed8e7,_0x94a097){this['sequence']=new Sequence();this[_0xd0b3('0x1f')]=_0x94a097;this[_0xd0b3('0x20')]=_0x5ed8e7[_0xd0b3('0x20')];this[_0xd0b3('0x21')]=_0x5ed8e7[_0xd0b3('0x21')];this[_0xd0b3('0x22')]=_0x5ed8e7['agents'];this[_0xd0b3('0x23')]=_0x5ed8e7['trunks'];this[_0xd0b3('0x24')]=config[_0xd0b3('0x24')]||0x2;this[_0xd0b3('0x25')]={};this['actions']={};this[_0xd0b3('0x26')]={};this[_0xd0b3('0x27')]={};this[_0xd0b3('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0xd0b3('0x29')]={};this[_0xd0b3('0x2a')]={};this[_0xd0b3('0x2b')]={};ami['on'](_0xd0b3('0x2c'),this[_0xd0b3('0x2d')][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x2f'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xd0b3('0x30'),this[_0xd0b3('0x31')]['bind'](this));ami['on']('agentcomplete',this[_0xd0b3('0x32')]['bind'](this));ami['on'](_0xd0b3('0x33'),this[_0xd0b3('0xc')]['bind'](this));ami['on'](_0xd0b3('0x34'),this['syncHangup'][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x35'),this[_0xd0b3('0x36')][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x37'),this[_0xd0b3('0x38')][_0xd0b3('0x2e')](this));ami['on']('queuemember',this[_0xd0b3('0x39')][_0xd0b3('0x2e')](this));ami['on'](_0xd0b3('0x3a'),this['syncQueueStatusComplete']['bind'](this));this[_0xd0b3('0x3b')]();this[_0xd0b3('0x3c')]();}function isNotNull(_0x20ee10){return _0x20ee10!==null&&!_[_0xd0b3('0x3d')](_0x20ee10);}function checkIsLoggedIn(_0x2af471,_0x3ce94a){return function(){if(_0x3ce94a<=0x0){_0x2af471[_0xd0b3('0x3e')]='AGENTS_NOT_LOGGED';throw _0x2af471['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x51684d){return _0x51684d;}function checkIsActive(_0x45ff49,_0x257e94){return function(){if(!isActive(_0x257e94)){_0x45ff49[_0xd0b3('0x3e')]=_0xd0b3('0x3f');throw _0x45ff49[_0xd0b3('0x40')]+_0xd0b3('0x41');}};}function checkInterval(_0x4171a2){return function(){if(!isNotNull(_0x4171a2[_0xd0b3('0x42')])){_0x4171a2['message']=_0xd0b3('0x43');throw _0x4171a2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4171a2[_0xd0b3('0x42')][_0xd0b3('0x44')])){_0x4171a2['message']='INTERVAL_IS_NULL';throw _0x4171a2[_0xd0b3('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xd0b3('0x45')](_0x4171a2[_0xd0b3('0x42')][_0xd0b3('0x44')]))){_0x4171a2[_0xd0b3('0x3e')]=_0xd0b3('0x43');throw _0x4171a2[_0xd0b3('0x40')]+_0xd0b3('0x46');}};}function msgResponse(_0x6cf36e,_0x3de40d,_0x5b9991){return{'action':_0x6cf36e,'response':_0x3de40d,'message':_0x5b9991,'stack':_0x5b9991};}function myreject(_0x2649d1){return function(_0x3d69d5){return _0x2649d1(msgResponse(_0xd0b3('0x47'),_0xd0b3('0x48'),JSON[_0xd0b3('0x49')](_0x3d69d5)));};}function getSeconds(_0x9ab278,_0x4430e9){var _0x3352f5=moment(_0x9ab278)[_0xd0b3('0x4a')](0x0);var _0x37adc4=moment(_0x4430e9)[_0xd0b3('0x4a')](0x0);return _0x3352f5['diff'](_0x37adc4,'seconds');}function emit(_0x32ed4c,_0x44f011,_0x105353){io['to'](_0x32ed4c)['emit'](_0x44f011,_0x105353);}function emitVoiceQueueSummary(_0x340962){if(_0x340962[_0xd0b3('0x4b')]==='outbound'){var _0x3e2e08={'id':_0x340962['id'],'name':_0x340962['name'],'strategy':_0x340962[_0xd0b3('0x4c')],'answered':_0x340962['answered'],'available':_0x340962[_0xd0b3('0x4d')],'loggedIn':_0x340962[_0xd0b3('0x4e')],'pTalking':_0x340962[_0xd0b3('0x4f')],'sumBillable':_0x340962[_0xd0b3('0x50')],'sumDuration':_0x340962[_0xd0b3('0x51')],'sumHoldTime':_0x340962['sumHoldTime']||0x0,'talking':_0x340962[_0xd0b3('0x52')],'total':_0x340962['total'],'type':_0x340962[_0xd0b3('0x4b')],'unmanaged':_0x340962[_0xd0b3('0x53')],'abandoned':_0x340962[_0xd0b3('0x54')],'waiting':_0x340962[_0xd0b3('0x55')],'loggedInDb':_0x340962[_0xd0b3('0x56')],'dialActive':_0x340962[_0xd0b3('0x57')],'dialMethod':_0x340962['dialMethod'],'dialOriginateCallerIdName':_0x340962[_0xd0b3('0x58')],'dialOriginateCallerIdNumber':_0x340962[_0xd0b3('0x59')],'dialOriginateTimeout':_0x340962['dialOriginateTimeout'],'dialPrefix':_0x340962['dialPrefix'],'outboundAnswerAgiCallsDay':_0x340962[_0xd0b3('0x5a')],'outboundAnswerCallsDay':_0x340962['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x340962[_0xd0b3('0x5b')],'outboundBusyCallsDay':_0x340962['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x340962[_0xd0b3('0x5c')],'outboundDropCallsDayACS':_0x340962[_0xd0b3('0x5d')],'outboundDropCallsDayCallersExit':_0x340962[_0xd0b3('0x5e')],'outboundDropCallsDayTimeout':_0x340962[_0xd0b3('0x5f')],'outboundNoAnswerCallsDay':_0x340962['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x340962[_0xd0b3('0x60')],'outboundOriginateFailureCallsDay':_0x340962[_0xd0b3('0x61')],'outboundReCallsDay':_0x340962['outboundReCallsDay'],'outboundRejectCallsDay':_0x340962[_0xd0b3('0x62')],'outboundUnknownCallsDay':_0x340962['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x340962[_0xd0b3('0x63')],'predictiveIntervalAvgHoldtime':_0x340962[_0xd0b3('0x64')],'predictiveIntervalAvgTalktime':_0x340962[_0xd0b3('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x340962[_0xd0b3('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x340962[_0xd0b3('0x67')],'predictiveIntervalErlangCalls':_0x340962['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x340962[_0xd0b3('0x68')],'predictiveIntervalHitRate':_0x340962[_0xd0b3('0x69')],'predictiveIntervalMultiplicativeFactor':_0x340962[_0xd0b3('0x6a')],'predictiveIntervalPauses':_0x340962['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x340962[_0xd0b3('0x6b')],'predictiveIntervalTotalCalls':_0x340962[_0xd0b3('0x6c')],'message':_0x340962[_0xd0b3('0x3e')],'originated':_0x340962['originated'],'erlangCalls':_0x340962[_0xd0b3('0x6d')],'erlangCallToSecond':_0x340962['erlangCallToSecond'],'erlangAbandonmentRate':_0x340962[_0xd0b3('0x6e')],'erlangBusyFactor':_0x340962[_0xd0b3('0x6f')],'startPredictive':_0x340962['startPredictive'],'startProgressive':_0x340962['startProgressive']};if(_0x340962['Trunk']){_0x3e2e08['Trunk']={'id':_0x340962['Trunk']['id'],'name':_0x340962[_0xd0b3('0x70')][_0xd0b3('0x40')],'active':_0x340962['Trunk'][_0xd0b3('0x71')],'callerid':_0x340962[_0xd0b3('0x70')][_0xd0b3('0x72')]};}if(_0x340962['Interval']){_0x3e2e08[_0xd0b3('0x42')]={'id':_0x340962[_0xd0b3('0x42')]['id'],'name':_0x340962['Interval'][_0xd0b3('0x40')]};}var _0x1d5e6f=md5(JSON[_0xd0b3('0x49')](_0x3e2e08));if(_0x340962[_0xd0b3('0x5')]!==_0x1d5e6f){_0x340962['md5']=_0x1d5e6f;emit(util[_0xd0b3('0x73')](_0xd0b3('0x74'),_0x3e2e08[_0xd0b3('0x40')]),_0xd0b3('0x75'),_0x3e2e08);}}}function emitCampaignSummary(_0x287bee){if(_0x287bee[_0xd0b3('0x4b')]===_0xd0b3('0x76')){emit(util[_0xd0b3('0x73')]('campaign:ivr:%s',_0x287bee[_0xd0b3('0x40')]),'campaign:save',_0x287bee);}}function checkGetDataPredictive(_0x1b90c8){if(isNotNull(_0x1b90c8)&&!_[_0xd0b3('0x45')](_0x1b90c8)){loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x78'));loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x79'),_0x1b90c8['predictiveIntervalTotalCalls']);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7a'),_0x1b90c8[_0xd0b3('0x63')]);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7b'),_0x1b90c8[_0xd0b3('0x67')]);loggerPredictive[_0xd0b3('0x77')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b90c8[_0xd0b3('0x66')]);loggerPredictive['info'](_0xd0b3('0x7c'),_0x1b90c8[_0xd0b3('0x64')]);loggerPredictive[_0xd0b3('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b90c8[_0xd0b3('0x65')]);loggerPredictive[_0xd0b3('0x77')]('---------------------------');if(_0x1b90c8[_0xd0b3('0x6c')]>0x0){if(!_[_0xd0b3('0x3d')](_0x1b90c8[_0xd0b3('0x65')])&&_0x1b90c8[_0xd0b3('0x65')]>0x0){return!![];}loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7d'));if(!_[_0xd0b3('0x3d')](_0x1b90c8['predictiveIntervalAvgHoldtime'])&&_0x1b90c8[_0xd0b3('0x64')]>0x0){return!![];}loggerPredictive[_0xd0b3('0x77')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7e'));}return![];}function mergeDataErlangB(_0x1bae19){return function(_0xa17be8){loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x7f'));loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x80'),_0xa17be8[_0xd0b3('0x6d')]);loggerPredictive['info'](_0xd0b3('0x81'),_0xa17be8['erlangCallToSecond']);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x82'),_0xa17be8['erlangAbandonmentRate']);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x83'),_0xa17be8[_0xd0b3('0x6f')]);loggerPredictive[_0xd0b3('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa17be8[_0xd0b3('0x6e')]);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x84'));_['merge'](_0x1bae19,_0xa17be8);};}function getDiff(_0x5daddd){var _0x5c5443=moment()[_0xd0b3('0x4a')](0x0);var _0x55e148=moment(_0x5daddd)[_0xd0b3('0x4a')](0x0);return _0x5c5443[_0xd0b3('0x85')](_0x55e148,'seconds');}function ifInterval(_0x382931,_0xe5bf31){if(_['isUndefined'](_0xe5bf31)){return![];}return getDiff(_0xe5bf31)<_0x382931*0x3c;}function freeVariablesPredictive(_0x3bc44b){if(isNotNull(_0x3bc44b)){if(!_[_0xd0b3('0x3d')](_0x3bc44b[_0xd0b3('0x86')])){_0x3bc44b['startProgressive']=undefined;loggerPredictive['info'](_0x3bc44b[_0xd0b3('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xd0b3('0x3d')](_0x3bc44b[_0xd0b3('0x87')])){_0x3bc44b[_0xd0b3('0x87')]=undefined;loggerPredictive['info'](_0x3bc44b['name'],_0xd0b3('0x88'));}if(!_[_0xd0b3('0x3d')](_0x3bc44b[_0xd0b3('0x89')])){clearInterval(_0x3bc44b['handlePredictive']);_0x3bc44b[_0xd0b3('0x89')]=undefined;loggerPredictive['info'](_0x3bc44b[_0xd0b3('0x40')],_0xd0b3('0x8a'));}}}function erlangb(_0x28e0d5,_0x23a79e){if(_0x23a79e===0x0){return 0x0;}var _0x29ebdf=0x1;for(var _0x52de45=0x1;_0x52de45<=_0x23a79e;_0x52de45+=0x1){_0x29ebdf=0x1+_0x29ebdf*_0x52de45/_0x28e0d5;}return 0x1/_0x29ebdf;}function isVoiceQueueOutbound(_0x3b8e9c){return _0x3b8e9c==='outbound';}function isNotPreview(_0x2946f1){return _0x2946f1!==_0xd0b3('0x1f');}function isCampaignIvr(_0x3cf32f){return _0x3cf32f==='ivr';}function getCallerId(_0x10de98,_0x311df6,_0x3bfc78){if(!_[_0xd0b3('0x3d')](_0x3bfc78)&&typeof _0x3bfc78===_0xd0b3('0x8b')&&!_[_0xd0b3('0x45')](_0x3bfc78)){if(!_[_0xd0b3('0x3d')](_0x311df6)&&typeof _0x311df6===_0xd0b3('0x8b')&&!_['isEmpty'](_0x311df6)){return util[_0xd0b3('0x73')](_0xd0b3('0x8c'),_0x311df6,_0x3bfc78);}return util[_0xd0b3('0x73')]('\x22%s\x22\x20<%s>',_0x3bfc78,_0x3bfc78);}if(!_[_0xd0b3('0x3d')](_0x10de98)&&typeof _0x10de98===_0xd0b3('0x8b')&&!_[_0xd0b3('0x45')](_0x10de98)){return _0x10de98;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x5ab12a,_0x4bf62d){return function(_0x107ba8){freeVariablesPredictive(_0x4bf62d);emitVoiceQueueSummary(_0x4bf62d);emitCampaignSummary(_0x4bf62d);loggerSyncQueueSummary[_0xd0b3('0x8d')](_0x5ab12a,util['inspect'](_0x107ba8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x500160,_0x7a4138){return function(_0x4b3acf){loggerPredictive[_0xd0b3('0x8d')](_0x7a4138[_0xd0b3('0x40')],_0x500160);loggerPredictive[_0xd0b3('0x8d')](_0x4b3acf[_0xd0b3('0x8e')]);freeVariablesPredictive(_0x7a4138);};}function loggerCatch(_0x3ae4e5){return function(_0x335dbb){logger[_0xd0b3('0x8d')](_0x3ae4e5,util[_0xd0b3('0x8f')](_0x335dbb,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x12136e){return _0x12136e&&!_[_0xd0b3('0x3d')](_0x12136e)&&_0x12136e[_0xd0b3('0x90')]>0x0;}function decremetOriginate(_0x549f2a){if(!_[_0xd0b3('0x3d')](_0x549f2a)&&_0x549f2a!==null){if(typeof _0x549f2a[_0xd0b3('0x91')]!==_0xd0b3('0x92')){if(_0x549f2a[_0xd0b3('0x91')]>0x0){_0x549f2a['originated']-=0x1;}else{logger['error'](_0xd0b3('0x93'));}}}else{logger[_0xd0b3('0x8d')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x27c634,_0x31a5a,_0xb55f31){if(_0x31a5a>_0xb55f31){for(var _0x33f614=0x0;_0x33f614<_0x31a5a-_0xb55f31;_0x33f614+=0x1){decremetOriginate(_0x27c634);}}}function loggerGetContactDialer(_0x831f06,_0x1984bd,_0xb622ef){return function(_0x273994){checkContactLowerLimitOriginate(_0x1984bd,_0xb622ef,0x0);logger[_0xd0b3('0x8d')](_0x831f06,util['inspect'](_0x273994,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x339076){return function(_0xcfecb3){if(isNotNull(_0xcfecb3)&&isNotNull(_0xcfecb3[0x0])){if(_0xcfecb3[0x0][_0xd0b3('0x94')]>0x0){_0x339076[_0xd0b3('0x3e')]=_0xd0b3('0x95');logger['info'](_0xd0b3('0x96')+_0x339076[_0xd0b3('0x40')],_0xcfecb3[0x0][_0xd0b3('0x94')],_0xd0b3('0x97'));}else{_0x339076[_0xd0b3('0x3e')]=_0xd0b3('0x98');logger['info'](_0xd0b3('0x99')+_0x339076[_0xd0b3('0x40')]);}}};}function notSendMessagesQueue(_0x4e24e6){if(_0x4e24e6[_0xd0b3('0x9a')]){freeVariablesPredictive(_0x4e24e6);if(_0x4e24e6[_0xd0b3('0x91')]===0x0&&_0x4e24e6[_0xd0b3('0x52')]===0x0&&_0x4e24e6['waiting']===0x0&&(_0x4e24e6[_0xd0b3('0x4f')]||0x0)===0x0){_0x4e24e6[_0xd0b3('0x9a')]=![];_0x4e24e6['available']=0x0;_0x4e24e6['message']=_0xd0b3('0x3f');loggerSyncQueueSummary['error'](_0xd0b3('0x9b'),_0x4e24e6[_0xd0b3('0x40')],_0xd0b3('0x9c'));}else{_0x4e24e6[_0xd0b3('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xd0b3('0x8d')](_0xd0b3('0x9b'),_0x4e24e6[_0xd0b3('0x40')],_0xd0b3('0x9d'));}emitVoiceQueueSummary(_0x4e24e6);}}function notSendMessagesCampaign(_0x4050e3){if(_0x4050e3[_0xd0b3('0x9a')]){if(_0x4050e3['originated']===0x0){_0x4050e3[_0xd0b3('0x9a')]=![];_0x4050e3['message']=_0xd0b3('0x3f');loggerSyncQueueSummary[_0xd0b3('0x8d')](_0xd0b3('0x9e'),_0x4050e3[_0xd0b3('0x40')],'is\x20not\x20active');}else{_0x4050e3[_0xd0b3('0x3e')]=_0xd0b3('0x9f');loggerSyncQueueSummary[_0xd0b3('0x8d')](_0xd0b3('0x9e'),_0x4050e3[_0xd0b3('0x40')],'is\x20disactive');}emitCampaignSummary(_0x4050e3);}}function createObjHistory(_0x30b8a0,_0x1f3c10,_0x39f9bb,_0x20058a,_0x396de3){_0x30b8a0[_0xd0b3('0x3e')]=_0x39f9bb;var _0x545d8b=new Action(_0x30b8a0,_0x1f3c10);var _0x1be74a=new History(_0x545d8b);_0x1be74a[_0xd0b3('0xa0')]=_0x20058a;_0x1be74a[_0xd0b3('0xa1')]=_0x396de3;_0x1be74a[_0xd0b3('0xa2')]=_0x545d8b[_0xd0b3('0xa3')];return _0x1be74a;}Dialer[_0xd0b3('0x1b')][_0xd0b3('0x3c')]=function(){var _0x57f2f6=this;setInterval(function(){_0x57f2f6[_0xd0b3('0xa4')](_0x57f2f6[_0xd0b3('0x27')],_0xd0b3('0xa5'));_0x57f2f6[_0xd0b3('0xa4')](_0x57f2f6[_0xd0b3('0xa6')],'[actions]');},0x32c8);};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xa4')]=function(_0x58b523,_0x3b219f){var _0x2145fd=this;for(var _0x5eca4d in _0x58b523){if(typeof _0x58b523[_0x5eca4d]!=='undefined'){this[_0xd0b3('0xa7')][_0xd0b3('0x1c')](function(){if(!_[_0xd0b3('0xa8')](_0x58b523[_0x5eca4d])){return ami[_0xd0b3('0xa9')]({'action':'status','channel':_0x58b523[_0x5eca4d][_0xd0b3('0xaa')]})[_0xd0b3('0xab')](function(_0x3ea315){if(_0x3ea315['message']===_0xd0b3('0xac')){setTimeout(function(){if(_0x58b523[_0x5eca4d]&&_0x58b523[_0x5eca4d][_0xd0b3('0x4b')]!=='ivr'){_0x2145fd[_0xd0b3('0xad')](_0x2145fd['voiceQueues'][_0x58b523[_0x5eca4d][_0xd0b3('0xae')]]);logger['error'](_0xd0b3('0xaf'),_0x3b219f,_0x5eca4d,_0x58b523[_0x5eca4d]['queue']);delete _0x58b523[_0x5eca4d];}if(_0x58b523[_0x5eca4d]&&_0x58b523[_0x5eca4d][_0xd0b3('0x4b')]==='ivr'){_0x2145fd[_0xd0b3('0xad')](_0x2145fd[_0xd0b3('0x21')][_0x58b523[_0x5eca4d]['queue']]);logger[_0xd0b3('0x8d')](_0xd0b3('0xb0'),_0x3b219f,_0x5eca4d,_0x58b523[_0x5eca4d][_0xd0b3('0xae')]);delete _0x58b523[_0x5eca4d];}},0x2328);}});}});}}};Dialer['prototype'][_0xd0b3('0xb1')]=function(_0x1563d0){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xb1')](_0x1563d0))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xb4')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xb5')]=function(_0x395b80){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopperBlack[_0xd0b3('0xb5')](_0x395b80))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xb6')));};Dialer['prototype'][_0xd0b3('0xb7')]=function(_0x47da2b){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopperBlack[_0xd0b3('0xb7')](_0x47da2b))['catch'](loggerCatch(_0xd0b3('0xb8')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xb9')]=function(_0x424d2b){return BPromise['resolve']()[_0xd0b3('0xb3')](cmHopperHistory[_0xd0b3('0xba')](_0x424d2b))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xbb')]=function(_0x55edf0){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xbb')](_0x55edf0))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xbc')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xbd')]=function(_0x124350,_0x28c7a9,_0x2c0301){return BPromise['resolve']()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xbd')](_0x124350,_0x28c7a9,_0x2c0301))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xbe')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xbf')]=function(_0x4edf17,_0x46e63b,_0x2705d0,_0x132326){return BPromise[_0xd0b3('0xb2')]()['then'](cmHopper[_0xd0b3('0xbf')](_0x4edf17,_0x46e63b,_0x2705d0,_0x132326))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc0')));};Dialer['prototype'][_0xd0b3('0xc1')]=function(_0x22bdd6,_0x22add0,_0x34312c){return BPromise[_0xd0b3('0xb2')]()['then'](cmHopper[_0xd0b3('0xc1')](_0x22bdd6,_0x22add0,_0x34312c))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc0')));};Dialer['prototype'][_0xd0b3('0xc2')]=function(_0x1aee8f){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](voiceQueueRt[_0xd0b3('0xc2')](_0x1aee8f))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc3')));};Dialer[_0xd0b3('0x1b')]['moveContactManagedDialer']=function(_0x49c21f){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopper[_0xd0b3('0xc4')](_0x49c21f))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xc5')));};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xc6')]=function(_0x3209cc){return BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](cmHopperHistory[_0xd0b3('0xc6')](_0x3209cc))['catch'](loggerCatch(_0xd0b3('0xc7')));};Dialer[_0xd0b3('0x1b')]['updateOriginated']=function(_0x2e2fc9){if(!_[_0xd0b3('0x3d')](_0x2e2fc9)&&_0x2e2fc9!==null){if(typeof _0x2e2fc9['originated']!==_0xd0b3('0x92')){if(_0x2e2fc9[_0xd0b3('0x91')]>0x0){_0x2e2fc9[_0xd0b3('0x91')]-=0x1;}else{logger[_0xd0b3('0x8d')](_0xd0b3('0xc8'));}}}else{logger[_0xd0b3('0x8d')](_0xd0b3('0xc9'));}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xca')]=function(_0x4c6422,_0x4f68fb){var _0x58ad74=this;return function(_0x490be1){_0x58ad74[_0xd0b3('0xad')](_0x4f68fb);logger[_0xd0b3('0x8d')](_0x4c6422,util['inspect'](_0x490be1,{'showHidden':![],'depth':null}));};};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xcb')]=function(_0x378d41,_0x190152,_0x4acaa0){var _0x58c80d={'state':0x19,'statedesc':_0xd0b3('0xcc')};this[_0xd0b3('0xad')](_0x190152);this[_0xd0b3('0xcd')](_[_0xd0b3('0xce')](_0x58c80d,_[_0xd0b3('0xcf')](_0x4acaa0,[_0xd0b3('0xd0'),_0xd0b3('0xd1'),'UserId','VoiceQueueId',_0xd0b3('0xd2')])),_0xd0b3('0xd3'),'[emptyContact]');logger[_0xd0b3('0x8d')](_0x378d41);};Dialer['prototype'][_0xd0b3('0xd4')]=function(_0xe07c13){return _0xe07c13===_0xd0b3('0xd5');};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xd6')]=function(_0x518273){return!_['isUndefined'](_0x518273)&&_0x518273&&!_[_0xd0b3('0x3d')](_0x518273[_0xd0b3('0x40')])&&!_[_0xd0b3('0x3d')](_0x518273['active'])&&_0x518273['active']&&(this[_0xd0b3('0x23')][util['format'](_0xd0b3('0xd7'),_0x518273['name'])][_0xd0b3('0xd8')]===_0xd0b3('0xd9')||this['trunks'][util[_0xd0b3('0x73')](_0xd0b3('0xd7'),_0x518273[_0xd0b3('0x40')])][_0xd0b3('0xd8')]==='unmonitored');};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xcd')]=function(_0xc70c80,_0x403b77,_0x5b4720){this['createHistory'](_0xc70c80)['catch'](loggerCatch(_0x403b77));this[_0xd0b3('0xc4')](_0xc70c80)[_0xd0b3('0xab')](loggerCatch(_0x5b4720));};Dialer[_0xd0b3('0x1b')]['syncVarSet']=function(_0x4ff325){var _0x314870=this[_0xd0b3('0x27')][_0x4ff325[_0xd0b3('0xda')]];var _0x24273b;if(!_[_0xd0b3('0xa8')](_0x4ff325)&&!_[_0xd0b3('0xa8')](_0x4ff325[_0xd0b3('0xdb')])&&!_[_0xd0b3('0xa8')](_0x4ff325['variable'][_0xd0b3('0xdc')])&&_0x4ff325[_0xd0b3('0xdd')]===_0xd0b3('0xde')&&_0x314870){if(_0x314870['type']!==_0xd0b3('0x76')&&this[_0xd0b3('0x20')][_0x314870['queue']][_0xd0b3('0xdf')]&&_0x4ff325[_0xd0b3('0xe0')]===_0xd0b3('0xe1')){delete this['uniqueId'][_0x4ff325[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]]);this[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;this[_0xd0b3('0x20')][_0x314870['queue']][_0xd0b3('0x5a')]+=0x1;_0x24273b=new Hangup(_0x314870,_0x4ff325);_0x24273b[_0xd0b3('0xa0')]=0x12;_0x24273b[_0xd0b3('0xa1')]=_0xd0b3('0xe3');_0x24273b[_0xd0b3('0xe4')]=_0xd0b3('0xe5');this['saveInDb'](_0x24273b,_0xd0b3('0xe6'),_0xd0b3('0xe7'));}if(_0x314870[_0xd0b3('0x4b')]!==_0xd0b3('0x76')&&this[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xdf')]&&_0x4ff325['value']===_0xd0b3('0xe8')){var _0x4a47d8=this;return new BPromise(function(_0x15825a,_0x34a98c){delete _0x4a47d8[_0xd0b3('0x27')][_0x4ff325[_0xd0b3('0xda')]];_0x4a47d8[_0xd0b3('0xad')](_0x4a47d8[_0xd0b3('0x20')][_0x314870['queue']]);_0x4a47d8[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;_0x4a47d8[_0xd0b3('0x20')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0x5a')]+=0x1;var _0x311234=_0x4a47d8['voiceQueues'][_0x314870[_0xd0b3('0xae')]];var _0x5ce8f5=new Hangup(_0x314870,_0x4ff325);_0x5ce8f5[_0xd0b3('0xa0')]=0x13;_0x5ce8f5[_0xd0b3('0xa1')]=_0xd0b3('0xe9');_0x5ce8f5[_0xd0b3('0xe4')]='AMD';_0x5ce8f5[_0xd0b3('0xea')]+=0x1;_0x5ce8f5['countglobal']+=0x1;_0x5ce8f5[_0xd0b3('0xeb')]=!![];_0x4a47d8[_0xd0b3('0xc6')](_0x5ce8f5)[_0xd0b3('0xab')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5ce8f5[_0xd0b3('0xec')]+_0x5ce8f5['countcongestionretry']+_0x5ce8f5['countnoanswerretry']+_0x5ce8f5[_0xd0b3('0xed')]+_0x5ce8f5[_0xd0b3('0xee')]+_0x5ce8f5[_0xd0b3('0xef')]+_0x5ce8f5[_0xd0b3('0xea')]+_0x5ce8f5[_0xd0b3('0xf0')]>=_0x311234[_0xd0b3('0xf1')]){_0x4a47d8['stateGlobal'](_0x5ce8f5,_0x15825a,_0x34a98c,_0xd0b3('0xf2'));}else{if(_0x5ce8f5[_0xd0b3('0xea')]>=_0x311234[_0xd0b3('0xf3')]){_0x4a47d8[_0xd0b3('0xf4')](_0x5ce8f5,_0x15825a,_0x34a98c,_0xd0b3('0xf5'));}else{_0x4a47d8[_0xd0b3('0xbb')]({'active':![],'countmachineretry':_0x5ce8f5['countmachineretry'],'scheduledat':moment()[_0xd0b3('0xf6')](_0x311234[_0xd0b3('0xf7')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x5ce8f5[_0xd0b3('0xd0')],'ListId':_0x5ce8f5[_0xd0b3('0xd1')],'VoiceQueueId':_0x5ce8f5[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x5ce8f5['CampaignId']||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfb')));_0x15825a({'reschedule':0x1});}}});}if(_0x314870['type']===_0xd0b3('0x76')&&this[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xdf')]&&_0x4ff325['value']===_0xd0b3('0xe1')){delete this['uniqueId'][_0x4ff325[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]]);_0x24273b=new Hangup(_0x314870,_0x4ff325);_0x24273b[_0xd0b3('0xa0')]=0x12;_0x24273b['statedesc']=_0xd0b3('0xe3');_0x24273b['membername']='AMD';this['saveInDb'](_0x24273b,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x314870[_0xd0b3('0x4b')]===_0xd0b3('0x76')&&this[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xdf')]&&_0x4ff325['value']==='MACHINE'){var _0x4a47d8=this;return new BPromise(function(_0x30b287,_0x35ba91){delete _0x4a47d8[_0xd0b3('0x27')][_0x4ff325[_0xd0b3('0xda')]];_0x4a47d8[_0xd0b3('0xad')](_0x4a47d8[_0xd0b3('0x21')][_0x314870['queue']]);_0x4a47d8[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;_0x4a47d8['campaigns'][_0x314870[_0xd0b3('0xae')]][_0xd0b3('0x5a')]+=0x1;var _0x51e7ee=_0x4a47d8[_0xd0b3('0x21')][_0x314870[_0xd0b3('0xae')]];var _0x17dd76=new Hangup(_0x314870,_0x4ff325);_0x17dd76[_0xd0b3('0xa0')]=0x13;_0x17dd76[_0xd0b3('0xa1')]=_0xd0b3('0xe9');_0x17dd76[_0xd0b3('0xe4')]='AMD';_0x17dd76[_0xd0b3('0xea')]+=0x1;_0x17dd76[_0xd0b3('0xfc')]+=0x1;_0x17dd76[_0xd0b3('0xeb')]=!![];_0x4a47d8[_0xd0b3('0xc6')](_0x17dd76)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfd')));if(_0x17dd76[_0xd0b3('0xec')]+_0x17dd76['countcongestionretry']+_0x17dd76[_0xd0b3('0xfe')]+_0x17dd76[_0xd0b3('0xed')]+_0x17dd76[_0xd0b3('0xee')]+_0x17dd76['countabandonedretry']+_0x17dd76[_0xd0b3('0xea')]+_0x17dd76[_0xd0b3('0xf0')]>=_0x51e7ee[_0xd0b3('0xf1')]){_0x4a47d8[_0xd0b3('0xff')](_0x17dd76,_0x30b287,_0x35ba91,_0xd0b3('0xf2'));}else{if(_0x17dd76[_0xd0b3('0xea')]>=_0x51e7ee[_0xd0b3('0xf3')]){_0x4a47d8[_0xd0b3('0xf4')](_0x17dd76,_0x30b287,_0x35ba91,_0xd0b3('0xf5'));}else{_0x4a47d8[_0xd0b3('0xbb')]({'active':![],'countmachineretry':_0x17dd76[_0xd0b3('0xea')],'scheduledat':moment()[_0xd0b3('0xf6')](_0x51e7ee[_0xd0b3('0xf7')],_0xd0b3('0xf8'))[_0xd0b3('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17dd76[_0xd0b3('0xd0')],'ListId':_0x17dd76[_0xd0b3('0xd1')],'VoiceQueueId':_0x17dd76[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x17dd76['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x30b287({'reschedule':0x1});}}});}}};Dialer[_0xd0b3('0x1b')]['syncHangup']=function(_0x15e46a){var _0xcc005a=this['uniqueId'][_0x15e46a[_0xd0b3('0xda')]];var _0x46cd9f=this;var _0x15ecf6;if(_0xcc005a&&_0xcc005a['type']==='ivr'){delete this[_0xd0b3('0x27')][_0x15e46a['uniqueid']];this[_0xd0b3('0xad')](this[_0xd0b3('0x21')][_0xcc005a[_0xd0b3('0xae')]]);this['campaigns'][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0x100')]+=0x1;_0x15ecf6=new Hangup(_0xcc005a,_0x15e46a);this[_0xd0b3('0xc6')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x101')));this[_0xd0b3('0xc4')](_0x15ecf6)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xcc005a&&_0xcc005a[_0xd0b3('0x4b')]!==_0xd0b3('0x76')&&isNotNull(this[_0xd0b3('0x20')][_0xcc005a['queue']][_0xd0b3('0x102')])){delete this[_0xd0b3('0x27')][_0x15e46a[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]]);this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0xe2')]+=0x1;this['voiceQueues'][_0xcc005a[_0xd0b3('0xae')]]['outboundAnswerAgiCallsDay']+=0x1;_0x15ecf6=new Hangup(_0xcc005a,_0x15e46a);_0x15ecf6['state']=0x10;_0x15ecf6[_0xd0b3('0xa1')]=_0xd0b3('0x103');_0x15ecf6[_0xd0b3('0xe4')]='AGI';this[_0xd0b3('0xc6')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x101')));this[_0xd0b3('0xc4')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch('[syncHangupIvr]'));}if(_0xcc005a&&_0xcc005a[_0xd0b3('0x4b')]!==_0xd0b3('0x76')&&!isNotNull(this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0x102')])){delete this[_0xd0b3('0x27')][_0x15e46a[_0xd0b3('0xda')]];this['updateOriginated'](this[_0xd0b3('0x20')][_0xcc005a[_0xd0b3('0xae')]]);this['voiceQueues'][_0xcc005a[_0xd0b3('0xae')]][_0xd0b3('0x104')]+=0x1;_0x15ecf6=new Hangup(_0xcc005a,_0x15e46a);_0x15ecf6[_0xd0b3('0xa0')]=0xc;_0x15ecf6[_0xd0b3('0xa1')]=_0x15e46a[_0xd0b3('0x105')];_0x15ecf6[_0xd0b3('0xe4')]='Unknow';this['createHistory'](_0x15ecf6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd0b3('0xc4')](_0x15ecf6)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x106')));}};Dialer[_0xd0b3('0x1b')]['syncAgentComplete']=function(_0x32f8eb){var _0x55de32=this[_0xd0b3('0x27')][_0x32f8eb[_0xd0b3('0xda')]];var _0x3bfb59=this;if(this[_0xd0b3('0x20')][_0x32f8eb[_0xd0b3('0xae')]]){if(_0x55de32&&_0x55de32[_0xd0b3('0x4b')]!=='ivr'){delete this[_0xd0b3('0x27')][_0x32f8eb[_0xd0b3('0xda')]];this[_0xd0b3('0x20')][_0x32f8eb[_0xd0b3('0xae')]]['outboundAnswerCallsDay']+=0x1;var _0x1bd7ab=new AgentComplete(_0x55de32,_0x32f8eb);if(_0x32f8eb[_0xd0b3('0x107')]==='agent'){_0x1bd7ab['agiafterat']=this['voiceQueues'][_0x32f8eb['queue']][_0xd0b3('0x108')]&&this[_0xd0b3('0x20')][_0x32f8eb[_0xd0b3('0xae')]][_0xd0b3('0x109')]?moment()[_0xd0b3('0x73')](_0xd0b3('0xf9')):undefined;}this[_0xd0b3('0xc6')](_0x1bd7ab)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd0b3('0xc4')](_0x1bd7ab)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x10a')));}}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x2d')]=function(_0xcae93a){if(this['voiceQueues'][_0xcae93a[_0xd0b3('0xae')]]){if(this[_0xd0b3('0x27')][_0xcae93a[_0xd0b3('0xda')]]&&this[_0xd0b3('0x27')][_0xcae93a[_0xd0b3('0xda')]][_0xd0b3('0x4b')]!=='ivr'){this['updateOriginated'](this[_0xd0b3('0x20')][_0xcae93a[_0xd0b3('0xae')]]);this[_0xd0b3('0x27')][_0xcae93a[_0xd0b3('0xda')]][_0xd0b3('0x10b')]=moment()[_0xd0b3('0x73')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xd0b3('0x10c')]=function(_0x11cb39){this[_0xd0b3('0xc6')](_0x11cb39)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x10d')));this[_0xd0b3('0xc4')](_0x11cb39)[_0xd0b3('0xab')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0xd0b3('0x10e')]=function(_0x372839){var _0x7d3726=this[_0xd0b3('0x27')][_0x372839[_0xd0b3('0xda')]];var _0x4dcf32=this;if(this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]]){if(_0x7d3726&&_0x7d3726[_0xd0b3('0x4b')]!==_0xd0b3('0x76')){delete this[_0xd0b3('0x27')][_0x372839[_0xd0b3('0xda')]];this[_0xd0b3('0xad')](this['voiceQueues'][_0x372839['queue']]);_0x7d3726[_0xd0b3('0x10f')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));var _0x369b99=new QueueCallerAbandon(_0x7d3726,_0x372839);if(getSeconds(_0x7d3726[_0xd0b3('0x10f')],_0x7d3726[_0xd0b3('0x110')])>=_0x7d3726[_0xd0b3('0x111')]){this[_0xd0b3('0x20')][_0x372839['queue']][_0xd0b3('0x67')]+=0x1;this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x5f')]+=0x1;this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x68')]+=0x1;_0x369b99[_0xd0b3('0xa0')]=0xa;_0x369b99[_0xd0b3('0xa1')]='Drop';_0x369b99['dropreason']=_0xd0b3('0x112');_0x369b99['agiafterat']=this[_0xd0b3('0x20')][_0x372839['queue']][_0xd0b3('0x108')]?moment()['format'](_0xd0b3('0xf9')):undefined;_0x369b99[_0xd0b3('0xee')]+=0x1;_0x369b99[_0xd0b3('0xfc')]+=0x1;if(_0x369b99[_0xd0b3('0xee')]>=this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x113')]){this[_0xd0b3('0x10c')](_0x369b99);}else{this[_0xd0b3('0xbb')]({'active':![],'countdropretry':_0x369b99[_0xd0b3('0xee')],'scheduledat':moment()[_0xd0b3('0xf6')](this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x114')],'minutes')[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x7d3726[_0xd0b3('0xd0')],'ListId':_0x7d3726[_0xd0b3('0xd1')],'VoiceQueueId':_0x7d3726[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x7d3726['CampaignId']||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x115')));var _0x3987a9=new History(_0x369b99);_0x3987a9[_0xd0b3('0xa0')]=0xa;_0x3987a9[_0xd0b3('0xa1')]=_0xd0b3('0x116');_0x3987a9[_0xd0b3('0xa3')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));_0x3987a9[_0xd0b3('0xa2')]=_0x3987a9[_0xd0b3('0xa3')];_0x3987a9[_0xd0b3('0x117')]=_0x369b99[_0xd0b3('0x117')];_0x3987a9[_0xd0b3('0x118')]=_0x369b99['calleridnum'];this[_0xd0b3('0xc6')](_0x3987a9)[_0xd0b3('0xab')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x66')]+=0x1;this[_0xd0b3('0x20')][_0x372839['queue']][_0xd0b3('0x5e')]+=0x1;_0x369b99[_0xd0b3('0xa0')]=0xb;_0x369b99[_0xd0b3('0xa1')]=_0xd0b3('0x119');_0x369b99['dropreason']='CALLEREXIT';_0x369b99[_0xd0b3('0xef')]+=0x1;_0x369b99[_0xd0b3('0xfc')]+=0x1;if(_0x369b99[_0xd0b3('0xef')]>=this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]][_0xd0b3('0x11a')]){this[_0xd0b3('0x10c')](_0x369b99);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x369b99[_0xd0b3('0xef')],'scheduledat':moment()['add'](this[_0xd0b3('0x20')][_0x372839[_0xd0b3('0xae')]]['dialAbandonedRetryFrequency'],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x7d3726['ContactId'],'ListId':_0x7d3726['ListId'],'VoiceQueueId':_0x7d3726['VoiceQueueId']||undefined,'CampaignId':_0x7d3726[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11b')));var _0x3987a9=new History(_0x369b99);_0x3987a9[_0xd0b3('0xa0')]=0xb;_0x3987a9[_0xd0b3('0xa1')]=_0xd0b3('0x119');_0x3987a9[_0xd0b3('0xa3')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));_0x3987a9[_0xd0b3('0xa2')]=_0x3987a9[_0xd0b3('0xa3')];_0x3987a9[_0xd0b3('0x117')]=_0x369b99[_0xd0b3('0x117')];_0x3987a9['calleridnum']=_0x369b99[_0xd0b3('0x118')];this[_0xd0b3('0xc6')](_0x3987a9)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11c')));}}}}};Dialer['prototype'][_0xd0b3('0x36')]=function(_0xd9e4dd){if(this[_0xd0b3('0xa6')][_0xd9e4dd[_0xd0b3('0xda')]]){this[_0xd0b3('0xa6')][_0xd9e4dd[_0xd0b3('0xda')]][_0xd0b3('0xaa')]=_0xd9e4dd[_0xd0b3('0xaa')];}if(this[_0xd0b3('0x27')][_0xd9e4dd['uniqueid']]){this[_0xd0b3('0x27')][_0xd9e4dd['uniqueid']][_0xd0b3('0xaa')]=_0xd9e4dd[_0xd0b3('0xaa')];}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x39')]=function(_0x3ad957){if(strategy[this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0xae')]][_0xd0b3('0x4c')]]===_0xd0b3('0x1a')){if(this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]&&_[_0xd0b3('0xa8')](this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0x11e')])&&_0x3ad957[_0xd0b3('0xd8')]==='1'&&_0x3ad957[_0xd0b3('0x11f')]==='0'){if(this[_0xd0b3('0x22')][_0x3ad957[_0xd0b3('0x120')]]){if(!this[_0xd0b3('0x22')][_0x3ad957[_0xd0b3('0x120')]][_0xd0b3('0x11e')]){this[_0xd0b3('0x22')][_0x3ad957['stateinterface']][_0xd0b3('0x11e')]=!![];this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0x11e')]=!![];this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]['stateinterface']=_0x3ad957['stateinterface'];}}}}else if((strategy[this[_0xd0b3('0x20')][this['actions'][_0x3ad957['actionid']][_0xd0b3('0xae')]]['strategy']]||_0xd0b3('0x19'))===_0xd0b3('0x19')){if(this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]){if(this[_0xd0b3('0x22')][_0x3ad957[_0xd0b3('0x120')]]){this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]][_0xd0b3('0x120')]=_0x3ad957[_0xd0b3('0x120')];if(_[_0xd0b3('0xa8')](this[_0xd0b3('0x2a')][this['actions'][_0x3ad957['actionid']][_0xd0b3('0xae')]])){this['queueBooked'][this[_0xd0b3('0xa6')][_0x3ad957[_0xd0b3('0x11d')]]['queue']]=[];}this[_0xd0b3('0x2a')][this[_0xd0b3('0xa6')][_0x3ad957['actionid']]['queue']][_0xd0b3('0x121')](_['merge'](_[_0xd0b3('0xcf')](this['actions'][_0x3ad957['actionid']],[_0xd0b3('0x122'),_0xd0b3('0x120')]),{'status':_0x3ad957[_0xd0b3('0xd8')],'paused':_0x3ad957[_0xd0b3('0x11f')]}));}}}};function unlockQueueStatus(_0x356bf8,_0x3a3a93){setTimeout(function(){if(_[_0xd0b3('0x3d')](_0x356bf8[_0xd0b3('0x123')])){loggerBooked[_0xd0b3('0x8d')](_0xd0b3('0x124'),_0x3a3a93);}_0x356bf8[_0xd0b3('0x123')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x3a3a93,JSON['stringify'](_[_0xd0b3('0xcf')](_0x356bf8,['name',_0xd0b3('0x123')])));},0x1f3);}Dialer['prototype'][_0xd0b3('0x125')]=function(_0xea1460){var _0x516c2f=this;var _0x2d58d3=_0x516c2f[_0xd0b3('0x20')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]];if(strategy[this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0xea1460['actionid']]['queue']][_0xd0b3('0x4c')]]===_0xd0b3('0x1a')){if(this[_0xd0b3('0xa6')][_0xea1460['actionid']]&&this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0x120')]){this[_0xd0b3('0x1f')][_0xd0b3('0x126')](this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0x122')],this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0x120')])[_0xd0b3('0xab')](function(_0x16c268){logger[_0xd0b3('0x8d')](_0xd0b3('0x127'),util['inspect'](_0x16c268,{'showHidden':![],'depth':null}));})[_0xd0b3('0x1e')](function(){_0x516c2f['updateOriginated'](_0x516c2f[_0xd0b3('0x20')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]]);_0x516c2f[_0xd0b3('0x22')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0x120')]][_0xd0b3('0x11e')]=![];delete _0x516c2f[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]];unlockQueueStatus(_0x2d58d3);});}else{this[_0xd0b3('0xad')](this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]]['queue']]);this[_0xd0b3('0xbb')]({'active':![],'ContactId':this[_0xd0b3('0xa6')][_0xea1460['actionid']]['ContactId'],'ListId':this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xd1')],'VoiceQueueId':this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xfa')]||undefined,'CampaignId':this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x128')));delete this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]];unlockQueueStatus(_0x2d58d3);}}else if((strategy[this[_0xd0b3('0x20')][this[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xae')]][_0xd0b3('0x4c')]]||'rrmemory')===_0xd0b3('0x19')){var _0x320d09;if(this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]]&&!_[_0xd0b3('0x45')](this[_0xd0b3('0x2a')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]])){if(this[_0xd0b3('0x2b')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460['actionid']]['queue']]){this[_0xd0b3('0x2b')][_0x516c2f[_0xd0b3('0xa6')][_0xea1460['actionid']][_0xd0b3('0xae')]]=this[_0xd0b3('0x2b')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]]?this[_0xd0b3('0x2b')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]]:this[_0xd0b3('0x2a')][this['actions'][_0xea1460[_0xd0b3('0x11d')]]['queue']]?this[_0xd0b3('0x2a')][this['actions'][_0xea1460['actionid']][_0xd0b3('0xae')]][_0xd0b3('0x129')]||0x0:0x0;}this['queueBooked'][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]][_0xd0b3('0x129')]=this[_0xd0b3('0x2b')][this[_0xd0b3('0xa6')][_0xea1460[_0xd0b3('0x11d')]][_0xd0b3('0xae')]];for(var _0x412afd=0x0;_0x412afd=0x0;})[_0xd0b3('0xab')](myreject(_0x3e57cd)));}}else{_0x1bd8a8[_0xd0b3('0x121')](ami[_0xd0b3('0xa9')]({'action':'command','command':util[_0xd0b3('0x73')]('iftime\x20%s,%s',_0x56ea7a,!_[_0xd0b3('0x3d')](config[_0xd0b3('0x139')][_0x20e6e1])?_0x20e6e1:'')})[_0xd0b3('0xb3')](function(_0x1a60c7){return _0x1a60c7['content'][_0xd0b3('0x13f')](_0xd0b3('0x140'))>=0x0;})[_0xd0b3('0xab')](myreject(_0x3e57cd)));}BPromise[_0xd0b3('0x141')](_0x1bd8a8)[_0xd0b3('0xb3')](function(_0x57e64c){var _0x1fcbcb=_[_0xd0b3('0x142')](_0x57e64c);if(_0x1fcbcb){return _0x10b9ca(_0x1fcbcb);}else{_0x90bd43[_0xd0b3('0x3e')]=_0x142acd?_0xd0b3('0x143'):_0xd0b3('0x144');return _0x3e57cd(msgResponse(_0xd0b3('0x145'),'Failure','Global:\x20'+_0x142acd+'\x20'+_0x155c9b+_0xd0b3('0x146')+util[_0xd0b3('0x8f')](_0x56ea7a,{'showHidden':![],'depth':null})+_0xd0b3('0x147')+_0x20e6e1));}})[_0xd0b3('0xab')](function(_0x24cd06){return _0x3e57cd(msgResponse('ifTime',_0xd0b3('0x136'),JSON[_0xd0b3('0x49')](_0x24cd06)));});});};Dialer[_0xd0b3('0x1b')]['checkDialMethod']=function(_0x8e5da6){var _0x466d25=this;return function(){switch(_0x8e5da6[_0xd0b3('0x148')]){case'progressive':freeVariablesPredictive(_0x8e5da6);_0x466d25['handlePower'](_0x8e5da6,0x1);break;case _0xd0b3('0x149'):freeVariablesPredictive(_0x8e5da6);_0x466d25['handlePower'](_0x8e5da6,_0x8e5da6[_0xd0b3('0x14a')]);break;case _0xd0b3('0xa'):_0x466d25[_0xd0b3('0xa')](_0x8e5da6);break;case'booked':freeVariablesPredictive(_0x8e5da6);_0x466d25[_0xd0b3('0x14b')](_0x8e5da6,0x1);break;default:freeVariablesPredictive(_0x8e5da6);logger[_0xd0b3('0x8d')](_0xd0b3('0x14c'),_0x8e5da6[_0xd0b3('0x40')],_0xd0b3('0x14d'));}};};Dialer[_0xd0b3('0x1b')]['launchHandleIvr']=function(_0x51617a){var _0x1f1ef6=this;return function(){_0x1f1ef6['handleIvr'](_0x51617a);};};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xc')]=function(_0x36b5e2){var _0x580e26=this;if(isNotPreview(_0x36b5e2['dialMethod'])){if(isVoiceQueueOutbound(_0x36b5e2['type'])&&isActive(_0x36b5e2[_0xd0b3('0x57')])){_0x36b5e2['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xd0b3('0xb3')](checkIsLoggedIn(_0x36b5e2,_0x36b5e2[_0xd0b3('0x4e')]))[_0xd0b3('0xb3')](checkIsActive(_0x36b5e2,_0x36b5e2[_0xd0b3('0x57')]))['then'](checkInterval(_0x36b5e2))[_0xd0b3('0xb3')](_0x580e26[_0xd0b3('0x14e')](_0x36b5e2))[_0xd0b3('0xb3')](_0x580e26[_0xd0b3('0x133')](_0x36b5e2[_0xd0b3('0x14f')],_0x36b5e2[_0xd0b3('0x150')],_0x36b5e2[_0xd0b3('0x40')],_0x36b5e2))[_0xd0b3('0xb3')](_0x580e26[_0xd0b3('0x135')](_0x36b5e2[_0xd0b3('0x42')],_0x36b5e2['dialTimezone'],_0x36b5e2[_0xd0b3('0x40')],_0x36b5e2))['then'](_0x580e26[_0xd0b3('0x151')](_0x36b5e2))[_0xd0b3('0xab')](loggerCatchQueueSummary(_0xd0b3('0x152'),_0x36b5e2));}else{notSendMessagesQueue(_0x36b5e2);}}else{freeVariablesPredictive(_0x36b5e2);}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x153')]=function(){var _0x1028af=this;var _0x5c7a6d;for(var _0xf7b404 in this['campaigns']){if(typeof this[_0xd0b3('0x21')][_0xf7b404]!==_0xd0b3('0x92')){_0x5c7a6d=this[_0xd0b3('0x21')][_0xf7b404];if(isCampaignIvr(_0x5c7a6d[_0xd0b3('0x4b')])&&isActive(_0x5c7a6d[_0xd0b3('0x71')])){_0x5c7a6d['sendMessageOneNotActive']=!![];BPromise[_0xd0b3('0xb2')]()[_0xd0b3('0xb3')](checkIsActive(_0x5c7a6d,_0x5c7a6d[_0xd0b3('0x71')]))[_0xd0b3('0xb3')](checkInterval(_0x5c7a6d))['then'](_0x1028af[_0xd0b3('0x14e')](_0x5c7a6d))[_0xd0b3('0xb3')](_0x1028af[_0xd0b3('0x133')](_0x5c7a6d[_0xd0b3('0x14f')],_0x5c7a6d[_0xd0b3('0x150')],_0x5c7a6d[_0xd0b3('0x40')],_0x5c7a6d))[_0xd0b3('0xb3')](_0x1028af[_0xd0b3('0x135')](_0x5c7a6d[_0xd0b3('0x42')],_0x5c7a6d[_0xd0b3('0x150')],_0x5c7a6d['name'],_0x5c7a6d))[_0xd0b3('0xb3')](_0x1028af[_0xd0b3('0x154')](_0x5c7a6d))[_0xd0b3('0xab')](loggerCatchQueueSummary(_0xd0b3('0x155'),_0x5c7a6d));}else{notSendMessagesCampaign(_0x5c7a6d);}}}};function getCallerIdRandom(_0x15f841,_0x49d01b){var _0x564fdb;var _0xd87f64;var _0x46fba1;if(_0x49d01b<=0x0){_0x49d01b=0x1;}_0x564fdb=new RegExp('\x5cw{0,'+_0x49d01b+'}$');_0xd87f64=Math[_0xd0b3('0x156')](0xa,_0x49d01b-0x1);_0x46fba1=Math[_0xd0b3('0x156')](0xa,_0x49d01b)-0x1;return util[_0xd0b3('0x73')]('%s',_[_0xd0b3('0x157')](_0x15f841,_0x564fdb,_[_0xd0b3('0x158')](_0xd87f64,_0x46fba1)));}function extractCalleridName(_0x403bad){var _0xc4c4e0=_0x403bad[_0xd0b3('0x159')](/"(.*?)"/);return _0xc4c4e0?_0xc4c4e0[0x1]:_0x403bad;}function extractCalleridNumber(_0x538915){var _0x344295=_0x538915[_0xd0b3('0x159')](/<(.*?)>/);return _0x344295?_0x344295[0x1]:_0x538915;}Dialer[_0xd0b3('0x1b')][_0xd0b3('0x15a')]=function(_0x16fcfa,_0x231d34){var _0x2d4106=this;var _0x3a1d6e=uuid['v4']();this[_0xd0b3('0xa6')][_0x3a1d6e]=new Action(_0x16fcfa,_0x231d34,_0x3a1d6e);return new BPromise(function(_0x42d1aa,_0xcdfdb8){if(_['isUndefined'](_0x16fcfa)&&typeof _0x16fcfa!==_0xd0b3('0x15b')){return _0xcdfdb8(msgResponse(_0xd0b3('0x15c'),_0xd0b3('0x136'),_0xd0b3('0x15d')));}if(_['isUndefined'](_0x231d34[_0xd0b3('0x15e')][_0xd0b3('0x15f')])||_0x231d34['Contact'][_0xd0b3('0x15f')]===null){return _0xcdfdb8(msgResponse(_0xd0b3('0x15c'),_0xd0b3('0x136'),_0xd0b3('0x160')));}var _0x2fefc3={'XMD-CALLERID':_0x2d4106['actions'][_0x3a1d6e][_0xd0b3('0x161')](),'XMD-AGI':_0x16fcfa['dialQueueProject']?util[_0xd0b3('0x73')](_0xd0b3('0x162'),ipAgi,_0x16fcfa[_0xd0b3('0x102')]):'NONE','XMD-AGIAFTER':_0x16fcfa[_0xd0b3('0x108')]?util[_0xd0b3('0x73')](_0xd0b3('0x162'),ipAgi,_0x16fcfa['dialQueueProject2']):_0xd0b3('0x163'),'XMD-QUEUE':_0x16fcfa[_0xd0b3('0x4b')]===_0xd0b3('0x164')?util[_0xd0b3('0x73')](_0xd0b3('0x165'),_0x16fcfa[_0xd0b3('0x40')],_0x16fcfa['dialQueueOptions']||'',_0x16fcfa[_0xd0b3('0x109')]?'c':'',_0x16fcfa[_0xd0b3('0x111')]||0x3):_0xd0b3('0x163'),'XMD-CONTACTID':_0x231d34['ContactId'],'XMD-CDRTYPE':_0xd0b3('0x9'),'CALLERID(all)':_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e][_0xd0b3('0x161')](),'XMD-AMD':_0x16fcfa[_0xd0b3('0xdf')]?_0xd0b3('0x166'):_0xd0b3('0x163'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x16fcfa[_0xd0b3('0xdf')]){_0x2fefc3[_0xd0b3('0x167')]=_0x16fcfa[_0xd0b3('0x168')]||0x9c4;_0x2fefc3[_0xd0b3('0x169')]=_0x16fcfa['dialAMDGreeting']||0x5dc;_0x2fefc3[_0xd0b3('0x16a')]=_0x16fcfa[_0xd0b3('0x16b')]||0x320;_0x2fefc3[_0xd0b3('0x16c')]=_0x16fcfa[_0xd0b3('0x16d')]||0x1388;_0x2fefc3[_0xd0b3('0x16e')]=_0x16fcfa[_0xd0b3('0x16f')]||0x64;_0x2fefc3['XMD-AMDBETWEENWORDSSILENCE']=_0x16fcfa['dialAMDBetweenWordsSilence']||0x32;_0x2fefc3[_0xd0b3('0x170')]=_0x16fcfa[_0xd0b3('0x171')]||0x3;_0x2fefc3[_0xd0b3('0x172')]=_0x16fcfa[_0xd0b3('0x173')]||0x100;_0x2fefc3['XMD-AMDMAXIMUMWORDLENGTH']=_0x16fcfa[_0xd0b3('0x174')]||0x1388;}if(_0x16fcfa[_0xd0b3('0x4b')]===_0xd0b3('0x164')){_0x2fefc3['XMD-VOICEQUEUEID']=_0x231d34[_0xd0b3('0xfa')];}else{_0x2fefc3[_0xd0b3('0x175')]=_0x231d34[_0xd0b3('0xd2')];}for(var _0x3ea281 in _0x231d34[_0xd0b3('0x15e')]){if(typeof _0x231d34[_0xd0b3('0x15e')][_0x3ea281]!=='undefined'){if(isNotNull(_0x231d34[_0xd0b3('0x15e')][_0x3ea281])&&_0x3ea281!=='id'&&_0x3ea281!==_0xd0b3('0x176')&&_0x3ea281!==_0xd0b3('0x177')&&_0x3ea281!=='updatedAt'){_0x2fefc3[util[_0xd0b3('0x73')](_0xd0b3('0x178'),'XMD-',_[_0xd0b3('0x179')](_0x3ea281))]=_0x231d34[_0xd0b3('0x15e')][_0x3ea281];}}}var _0x4b1f2f=_0x2d4106['isTrunkReachable'](_0x16fcfa[_0xd0b3('0x70')])?getCallerId(_0x16fcfa['Trunk'][_0xd0b3('0x72')],_0x16fcfa[_0xd0b3('0x58')],_0x16fcfa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x16fcfa[_0xd0b3('0x59')],_0x16fcfa[_0xd0b3('0x17a')]):_0x16fcfa[_0xd0b3('0x59')]):getCallerId(_[_0xd0b3('0xa8')](_0x16fcfa[_0xd0b3('0x17b')])?_0x16fcfa['Trunk']['callerid']:_0x16fcfa['TrunkBackup']['callerid'],_0x16fcfa[_0xd0b3('0x58')],_0x16fcfa[_0xd0b3('0x17a')]>0x0?getCallerIdRandom(_0x16fcfa[_0xd0b3('0x59')],_0x16fcfa[_0xd0b3('0x17a')]):_0x16fcfa[_0xd0b3('0x59')]);if(_0x4b1f2f){_0x2fefc3[_0xd0b3('0x17c')]=_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e]['originatecalleridname']=extractCalleridName(_0x4b1f2f);_0x2fefc3[_0xd0b3('0x17d')]=_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e][_0xd0b3('0x17e')]=extractCalleridNumber(_0x4b1f2f);}return ami[_0xd0b3('0xa9')]({'actionid':_0x3a1d6e,'action':_0xd0b3('0x15c'),'channel':_0x2d4106[_0xd0b3('0xd6')](_0x16fcfa[_0xd0b3('0x70')])?util[_0xd0b3('0x73')](_0xd0b3('0x17f'),_0x16fcfa[_0xd0b3('0x70')]['name'],isNotNull(_0x16fcfa[_0xd0b3('0x180')])?_0x16fcfa['dialPrefix'][_0xd0b3('0x181')]()||'':'',_0x16fcfa[_0xd0b3('0x182')]>0x0?_0x231d34[_0xd0b3('0x15e')][_0xd0b3('0x15f')][_0xd0b3('0x183')](_0x16fcfa[_0xd0b3('0x182')]):_0x231d34['Contact'][_0xd0b3('0x15f')]):util['format'](_0xd0b3('0x17f'),_['isNil'](_0x16fcfa[_0xd0b3('0x17b')])?_0x16fcfa[_0xd0b3('0x70')][_0xd0b3('0x40')]:_0x16fcfa['TrunkBackup'][_0xd0b3('0x40')],isNotNull(_0x16fcfa['dialPrefix'])?_0x16fcfa['dialPrefix'][_0xd0b3('0x181')]()||'':'',_0x16fcfa[_0xd0b3('0x182')]>0x0?_0x231d34[_0xd0b3('0x15e')]['phone']['substring'](_0x16fcfa[_0xd0b3('0x182')]):_0x231d34['Contact']['phone']),'callerid':_0x4b1f2f,'Exten':_0xd0b3('0xde'),'Context':'from-sip','Priority':'1','variable':_0x2fefc3,'timeout':(_0x16fcfa[_0xd0b3('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3a1d6e})['then'](function(_0x5805e5){return _0x42d1aa(_0x5805e5);})[_0xd0b3('0xab')](function(_0x49749c){_0x16fcfa[_0xd0b3('0x61')]+=0x1;var _0xce6c0f=new History(_0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e]);logger[_0xd0b3('0x8d')](util[_0xd0b3('0x73')](_0xd0b3('0x185'),JSON['stringify'](_0x49749c)));_0xce6c0f[_0xd0b3('0xa0')]=0xe;_0xce6c0f['statedesc']=_0xd0b3('0x186');_0xce6c0f[_0xd0b3('0xa3')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));_0xce6c0f[_0xd0b3('0xa2')]=_0xce6c0f[_0xd0b3('0xa3')];_0x2d4106['createHistory'](_0xce6c0f)[_0xd0b3('0xab')](loggerCatch('[originate][error]'));_0x2d4106[_0xd0b3('0xc4')](_0xce6c0f)['catch'](loggerCatch('[originate][error]'))[_0xd0b3('0x1e')](function(){delete _0x2d4106[_0xd0b3('0xa6')][_0x3a1d6e];return _0xcdfdb8(msgResponse(_0xd0b3('0x15c'),_0xd0b3('0x48'),'originate\x20action\x20Error'));});});});};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x31')]=function(_0x1c90e7){var _0x4b4ad9=this['actions'][_0x1c90e7[_0xd0b3('0x11d')]];if(_0x4b4ad9){delete this['actions'][_0x1c90e7[_0xd0b3('0x11d')]];_0x4b4ad9[_0xd0b3('0x110')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));var _0x552193=_0x4b4ad9['type']==='ivr'?this[_0xd0b3('0x21')][_0x4b4ad9['queue']]:this[_0xd0b3('0x20')][_0x4b4ad9[_0xd0b3('0x187')]()];if(!this['isSuccess'](_0x1c90e7[_0xd0b3('0x188')])){this[_0xd0b3('0xad')](_0x552193);return this[_0xd0b3('0x189')](_0x4b4ad9,_0x552193,_0x1c90e7)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x18a')));}this[_0xd0b3('0x27')][_0x1c90e7[_0xd0b3('0xda')]]=_0x4b4ad9;}};Dialer[_0xd0b3('0x1b')]['checkRetriveMax']=function(_0xab368b,_0x3657fa,_0x58a677){var _0x490691=new History(_0x3657fa);if(_0x490691[_0xd0b3('0xec')]+_0x490691['countcongestionretry']+_0x490691['countnoanswerretry']+_0x490691[_0xd0b3('0xed')]+_0x490691[_0xd0b3('0xee')]+_0x490691['countabandonedretry']+_0x490691[_0xd0b3('0xea')]+_0x490691[_0xd0b3('0xf0')]>=_0x58a677[_0xd0b3('0xf1')]-0x1){return!![];}switch(_0xab368b){case 0x3:if(_0x490691[_0xd0b3('0xfe')]>=_0x58a677[_0xd0b3('0x18b')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countnoanswerretry':_0x490691[_0xd0b3('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x58a677['dialNoAnswerRetryFrequency'],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x490691[_0xd0b3('0xec')]>=_0x58a677[_0xd0b3('0x18c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x490691[_0xd0b3('0xec')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x18d')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691['ContactId'],'ListId':_0x490691['ListId'],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x490691[_0xd0b3('0x18e')]>=_0x58a677['dialCongestionMaxRetry']-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countcongestionretry':_0x490691[_0xd0b3('0x18e')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x18f')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691['VoiceQueueId']||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x190')));break;case 0x0:if(_0x490691[_0xd0b3('0xed')]>=_0x58a677[_0xd0b3('0x191')]-0x1){return!![];}else{this[_0xd0b3('0xbb')]({'active':![],'countnosuchnumberretry':_0x490691['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x192')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691['ContactId'],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x193')));}break;case 0xa:if(_0x490691['countdropretry']>=_0x58a677[_0xd0b3('0x113')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countdropretry':_0x490691['countdropretry']+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x114')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})['catch'](loggerCatch(_0xd0b3('0x115')));break;case 0xb:if(_0x490691[_0xd0b3('0xef')]>=_0x58a677[_0xd0b3('0x11a')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countabandonedretry':_0x490691[_0xd0b3('0xef')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x194')],_0xd0b3('0xf8'))['format'](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691['ListId'],'VoiceQueueId':_0x490691['VoiceQueueId']||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11b')));break;case 0x13:if(_0x490691[_0xd0b3('0xea')]>=_0x58a677[_0xd0b3('0xf3')]-0x1){return!![];}this[_0xd0b3('0xbb')]({'active':![],'countmachineretry':_0x490691[_0xd0b3('0xea')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0xf7')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691[_0xd0b3('0xd0')],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfb')));break;case 0x14:if(_0x490691[_0xd0b3('0xf0')]>=_0x58a677['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x490691[_0xd0b3('0xf0')]+=0x1,'scheduledat':moment()[_0xd0b3('0xf6')](_0x58a677[_0xd0b3('0x195')],_0xd0b3('0xf8'))[_0xd0b3('0x73')](_0xd0b3('0xf9')),'ContactId':_0x490691['ContactId'],'ListId':_0x490691[_0xd0b3('0xd1')],'VoiceQueueId':_0x490691[_0xd0b3('0xfa')]||undefined,'CampaignId':_0x490691[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x196')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x25af49,_0x3b47da,_0x2a610f){var _0x144c29=this;var _0x31ae01=new History(_0x25af49);return new BPromise(function(_0x5e64cb,_0x386113){if(_['isUndefined'](_0x3b47da)&&typeof _0x3b47da!=='object'){return _0x386113(msgResponse(_0xd0b3('0x197'),_0xd0b3('0x136'),_0xd0b3('0x198')));}if(_[_0xd0b3('0x3d')](_0x2a610f)&&typeof _0x2a610f!==_0xd0b3('0x15b')){return _0x386113(msgResponse('[callProgressDetecting]',_0xd0b3('0x136'),_0xd0b3('0x199')));}switch(_0x2a610f[_0xd0b3('0x107')]){case'0':_0x3b47da[_0xd0b3('0x60')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x0;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x19a');_0x31ae01[_0xd0b3('0xed')]+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x19c'),ut[_0xd0b3('0x19d')](_0x25af49,_0xd0b3('0x19e')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xfd')));if(_0x144c29['checkRetriveMax'](0x0,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xed')]>=_0x3b47da[_0xd0b3('0x191')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x19f'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x19f'));}}break;case'3':_0x3b47da[_0xd0b3('0x1a0')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x3;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x1a1');_0x31ae01['countnoanswerretry']+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1a2'),ut[_0xd0b3('0x19d')](_0x25af49,_0xd0b3('0x1a3')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)['catch'](loggerCatch(_0xd0b3('0x1a4')));if(_0x144c29[_0xd0b3('0x1a5')](0x3,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xfe')]>=_0x3b47da[_0xd0b3('0x18b')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1a6'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1a6'));}}break;case'5':_0x3b47da[_0xd0b3('0x1a7')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x5;_0x31ae01['statedesc']=_0xd0b3('0x1a8');_0x31ae01[_0xd0b3('0xec')]+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1a9'),ut['buildObj'](_0x25af49,_0xd0b3('0x1aa')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1ab')));if(_0x144c29['checkRetriveMax'](0x5,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xec')]>=_0x3b47da[_0xd0b3('0x18c')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,'reason\x205\x20busy');}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,'reason\x205\x20busy');}}break;case'8':_0x3b47da[_0xd0b3('0x5c')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x8;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x1ac');_0x31ae01[_0xd0b3('0x18e')]+=0x1;_0x31ae01[_0xd0b3('0xfc')]+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1ad'),ut[_0xd0b3('0x19d')](_0x25af49,_0xd0b3('0x1ae')));_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x144c29[_0xd0b3('0x1a5')](0x8,_0x25af49,_0x3b47da)){if(_0x31ae01['countcongestionretry']>=_0x3b47da[_0xd0b3('0x1af')]){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b0'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b0'));}}break;case'11':_0x3b47da[_0xd0b3('0x1b1')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0xb;_0x31ae01[_0xd0b3('0xa1')]=_0xd0b3('0x119');_0x31ae01[_0xd0b3('0xef')]+=0x1;_0x31ae01['countglobal']+=0x1;_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x11c')));if(_0x144c29[_0xd0b3('0x1a5')](0xb,_0x25af49,_0x3b47da)){if(_0x31ae01['countabandonedretry']>=_0x3b47da['dialAbandonedMaxRetry']){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b2'));}else{_0x144c29['stateGlobal'](_0x31ae01,_0x5e64cb,_0x386113,'reason\x2011\x20abandoned');}}break;case'20':_0x3b47da[_0xd0b3('0x62')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0x14;_0x31ae01['statedesc']=_0xd0b3('0x1b3');_0x31ae01['countagentrejectretry']+=0x1;_0x31ae01['countglobal']+=0x1;ami[_0xd0b3('0x19b')](_0xd0b3('0x1b4'),ut['buildObj'](_0x25af49,_0xd0b3('0x1b5')));_0x144c29['createHistory'](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1b6')));if(_0x144c29[_0xd0b3('0x1a5')](0x14,_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xf0')]>=_0x3b47da['dialAgentRejectMaxRetry']){_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b7'));}else{_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0xd0b3('0x1b7'));}}break;default:_0x3b47da[_0xd0b3('0x104')]+=0x1;_0x31ae01[_0xd0b3('0xa0')]=0xc;_0x31ae01[_0xd0b3('0xa1')]=_0x2a610f[_0xd0b3('0x107')];_0x144c29[_0xd0b3('0xc6')](_0x31ae01)[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1b8')));if(_0x144c29['checkRetriveMax'](_0x2a610f[_0xd0b3('0x107')],_0x25af49,_0x3b47da)){if(_0x31ae01[_0xd0b3('0xec')]+_0x31ae01['countcongestionretry']+_0x31ae01[_0xd0b3('0xfe')]+_0x31ae01[_0xd0b3('0xed')]+_0x31ae01[_0xd0b3('0xee')]+_0x31ae01[_0xd0b3('0xef')]+_0x31ae01[_0xd0b3('0xea')]+_0x31ae01['countagentrejectretry']>=_0x3b47da[_0xd0b3('0xf1')]){_0x144c29[_0xd0b3('0xff')](_0x31ae01,_0x5e64cb,_0x386113,_0x2a610f[_0xd0b3('0x107')]);}else{_0x144c29[_0xd0b3('0xf4')](_0x31ae01,_0x5e64cb,_0x386113,_0x2a610f[_0xd0b3('0x107')]);}}}});};Dialer['prototype'][_0xd0b3('0xff')]=function(_0x18c23d,_0x1ce1b1,_0x12038e,_0x34d02b){var _0x5b69c2=new Final(_0x18c23d);_0x5b69c2[_0xd0b3('0xa0')]=0xf;_0x5b69c2[_0xd0b3('0xa1')]=_0xd0b3('0x1b9');this[_0xd0b3('0xf4')](_0x5b69c2,_0x1ce1b1,_0x12038e,_0x34d02b);};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xf4')]=function(_0x150522,_0x3b1675,_0x32a36a,_0x5cc412){this[_0xd0b3('0xc4')](_0x150522)[_0xd0b3('0xb3')](function(){return _0x3b1675(msgResponse(_0xd0b3('0x197'),_0xd0b3('0xd5'),_0x5cc412));})[_0xd0b3('0xab')](function(){return _0x32a36a(msgResponse(_0xd0b3('0x1ba'),'Failure',_0xd0b3('0x1bb')));});};Dialer[_0xd0b3('0x1b')][_0xd0b3('0xa')]=function(_0x4ffa4c){var _0xc17791=_0x4ffa4c['dialPredictiveOptimizationPercentage']/0x64;var _0x212968=_0x4ffa4c[_0xd0b3('0x5f')]/(_0x4ffa4c['outboundDropCallsDayTimeout']+_0x4ffa4c[_0xd0b3('0xe2')]);var _0x3360a4=Math[_0xd0b3('0x1bc')](_0x4ffa4c[_0xd0b3('0x6b')]*(_0x4ffa4c['predictiveIntervalMaxThreshold']/0x64));var _0xaf562a=Math[_0xd0b3('0x1bc')](_0x4ffa4c[_0xd0b3('0x6b')]*(_0x4ffa4c[_0xd0b3('0x1bd')]/0x64));var _0x32020a=_0x4ffa4c[_0xd0b3('0x4d')]+_0x4ffa4c[_0xd0b3('0x52')];var _0x406cf8=Math[_0xd0b3('0x1be')](_0x4ffa4c[_0xd0b3('0x6d')]*_0x4ffa4c[_0xd0b3('0x6e')]*_0x4ffa4c['predictiveIntervalHitRate']*_0x4ffa4c[_0xd0b3('0x6a')]);if(_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x86')])){if(!_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x87')])){_0x4ffa4c['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xd0b3('0x1bf'));}if(!_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x89')])){loggerPredictive[_0xd0b3('0x8d')]('[startMethodPredictive][StartProgressive]',_0xd0b3('0x1c0'));clearInterval(_0x4ffa4c['handlePredictive']);_0x4ffa4c[_0xd0b3('0x89')]=undefined;}_0x4ffa4c[_0xd0b3('0x86')]=moment()[_0xd0b3('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x4ffa4c['name'],'collection\x20data\x20in\x20progressive\x20at',_0x4ffa4c[_0xd0b3('0x86')]);this[_0xd0b3('0x14b')](_0x4ffa4c,0x1);}else if(ifInterval(_0x4ffa4c[_0xd0b3('0x1c1')],_0x4ffa4c[_0xd0b3('0x86')])){this[_0xd0b3('0x14b')](_0x4ffa4c,0x1);loggerPredictiveCalls[_0xd0b3('0x77')](_0xd0b3('0x1c2'),_0x4ffa4c[_0xd0b3('0x86')],_0x4ffa4c[_0xd0b3('0x40')]);_0x4ffa4c['erlangCalls']=0x0;_0x4ffa4c[_0xd0b3('0x68')]=0x0;}else if(_0xc17791<_0x212968&&_0x4ffa4c['dialPredictiveOptimization']===_0xd0b3('0x1c3')){freeVariablesPredictive(_0x4ffa4c);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x1c4'),_0xd0b3('0x1c5'),_0x212968,_0xd0b3('0x86'),_0x4ffa4c[_0xd0b3('0x40')]);}else if(_0x406cf8<_0x4ffa4c[_0xd0b3('0x68')]&&_0x4ffa4c[_0xd0b3('0x1c6')]===_0xd0b3('0x1c3')){freeVariablesPredictive(_0x4ffa4c);loggerPredictive['info'](_0xd0b3('0x1c7'),'Max\x20Drop\x20',_0x406cf8,_0xd0b3('0x1c8'),_0x4ffa4c[_0xd0b3('0x68')],'startProgressive',_0x4ffa4c['name']);}else if(!ifInterval(_0x4ffa4c[_0xd0b3('0x1c1')],_0x4ffa4c[_0xd0b3('0x86')])&&_[_0xd0b3('0x3d')](_0x4ffa4c[_0xd0b3('0x87')])&&!_['isUndefined'](_0x4ffa4c['startProgressive'])){_0x4ffa4c['startPredictive']=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));loggerPredictive[_0xd0b3('0x77')](_0x4ffa4c[_0xd0b3('0x40')],_0xd0b3('0x1c9'),_0x4ffa4c[_0xd0b3('0x87')]);this[_0xd0b3('0xb9')](_0x4ffa4c[_0xd0b3('0x1c1')])[_0xd0b3('0xb3')](this[_0xd0b3('0x1ca')](_0x4ffa4c))[_0xd0b3('0xb3')](mergeDataErlangB(_0x4ffa4c))[_0xd0b3('0xb3')](this['startMethodPredictive'](_0x4ffa4c))[_0xd0b3('0xab')](loggerCatchPredictive(_0xd0b3('0x1cb'),_0x4ffa4c));}else if(!ifInterval(_0x4ffa4c[_0xd0b3('0x1c1')],_0x4ffa4c[_0xd0b3('0x87')])){_0x4ffa4c[_0xd0b3('0x68')]=0x0;_0x4ffa4c[_0xd0b3('0x87')]=moment()[_0xd0b3('0x73')](_0xd0b3('0xf9'));loggerPredictive[_0xd0b3('0x77')](_0x4ffa4c[_0xd0b3('0x40')],_0xd0b3('0x1cc'),_0x4ffa4c[_0xd0b3('0x87')]);clearInterval(_0x4ffa4c[_0xd0b3('0x89')]);_0x4ffa4c[_0xd0b3('0x89')]=undefined;this[_0xd0b3('0xb9')](_0x4ffa4c[_0xd0b3('0x1c1')])[_0xd0b3('0xb3')](this[_0xd0b3('0x1ca')](_0x4ffa4c))[_0xd0b3('0xb3')](mergeDataErlangB(_0x4ffa4c))[_0xd0b3('0xb3')](this[_0xd0b3('0x1cd')](_0x4ffa4c))[_0xd0b3('0xab')](loggerCatchPredictive(_0xd0b3('0x1ce'),_0x4ffa4c));}else if(_0x4ffa4c[_0xd0b3('0x6b')]&&_0x32020a<_0x4ffa4c['predictiveIntervalAvailable']-_0xaf562a){freeVariablesPredictive(_0x4ffa4c);loggerPredictive['info'](_0x4ffa4c[_0xd0b3('0x40')],_0xd0b3('0x1cf'),_0x32020a,_0xd0b3('0x1d0'),_0x4ffa4c[_0xd0b3('0x6b')],'-',_0xaf562a,'=',_0x4ffa4c[_0xd0b3('0x6b')]-_0xaf562a,')');}else if(_0x4ffa4c[_0xd0b3('0x6b')]&&_0x32020a>_0x4ffa4c[_0xd0b3('0x6b')]+_0x3360a4){freeVariablesPredictive(_0x4ffa4c);loggerPredictive[_0xd0b3('0x77')](_0x4ffa4c['name'],_0xd0b3('0x1cf'),_0x32020a,_0xd0b3('0x1d1'),_0x4ffa4c[_0xd0b3('0x6b')],'+',_0x3360a4,'=',_0x4ffa4c[_0xd0b3('0x6b')]+_0x3360a4,')');}};Dialer['prototype'][_0xd0b3('0x1ca')]=function(_0x6e135a){var _0x118af4=this;return function(_0x47cf21){return new BPromise(function(_0x2a6caa,_0x59f187){_[_0xd0b3('0xce')](_0x6e135a,_0x47cf21[0x0]);if(checkGetDataPredictive(_0x47cf21[0x0])){var _0x369e39=_0x6e135a['predictiveIntervalAvailable']=_0x6e135a[_0xd0b3('0x52')]+_0x6e135a[_0xd0b3('0x4d')];var _0x2dc936=_0x6e135a[_0xd0b3('0x1c1')]*0x3c;var _0x1270fb=_0x47cf21[0x0][_0xd0b3('0x65')]+_0x47cf21[0x0][_0xd0b3('0x64')];var _0x210362=(_0x47cf21[0x0][_0xd0b3('0x63')]+_0x47cf21[0x0][_0xd0b3('0x67')]+_0x47cf21[0x0][_0xd0b3('0x66')])/_0x47cf21[0x0][_0xd0b3('0x6c')];_0x6e135a['predictiveIntervalHitRate']=_0x210362>0x0?_0x210362:0x1;switch(_0x6e135a[_0xd0b3('0x1c6')]){case _0xd0b3('0x1c3'):var _0x386a04=_0x6e135a[_0xd0b3('0x1d2')]/0x64;return _0x118af4[_0xd0b3('0x1d3')](_0x369e39,_0x2dc936,_0x1270fb,_0x210362,_0x386a04)[_0xd0b3('0xb3')](function(_0x2f2761){return _0x2a6caa(_0x2f2761);});case _0xd0b3('0x1d4'):var _0x3a54df=_0x6e135a[_0xd0b3('0x1d2')]/0x64;return _0x118af4[_0xd0b3('0x1d5')](_0x369e39,_0x2dc936,_0x1270fb,_0x210362,_0x3a54df)[_0xd0b3('0xb3')](function(_0xe36851){return _0x2a6caa(_0xe36851);});default:return _0x59f187(msgResponse(_0xd0b3('0x1d6'),_0xd0b3('0x136'),_0xd0b3('0x1d7')));}}else{return _0x59f187(msgResponse(_0xd0b3('0x1d6'),_0xd0b3('0x136'),_0xd0b3('0x1d8')));}});};};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x1d9')]=function(_0x326a9a){var _0xe99928=this;return function(_0x3ec639){return new BPromise(function(_0x1a0455,_0x5a8645){_['merge'](_0x326a9a,_0x3ec639[0x0]);if(checkGetDataPredictive(_0x3ec639[0x0])){loggerPredictive[_0xd0b3('0x77')](JSON[_0xd0b3('0x49')](_0x3ec639[0x0]));if(_0x326a9a[_0xd0b3('0x1c6')]===_0xd0b3('0x1c3')){return _0xe99928[_0xd0b3('0xc2')](_0x326a9a['id'])[_0xd0b3('0xb3')](function(_0x200190){var _0x4a5b48=_0x326a9a[_0xd0b3('0x4e')]-_0x200190[0x0][_0xd0b3('0x1da')];var _0x16fbe7=_0x326a9a[_0xd0b3('0x1c1')]*0x3c;var _0x4f4d1a=_0x3ec639[0x0][_0xd0b3('0x65')]+_0x3ec639[0x0]['predictiveIntervalAvgHoldtime'];var _0x16d017=(_0x3ec639[0x0][_0xd0b3('0x63')]+_0x3ec639[0x0][_0xd0b3('0x67')]+_0x3ec639[0x0][_0xd0b3('0x66')])/_0x3ec639[0x0][_0xd0b3('0x6c')];var _0x1ebcb9=_0x326a9a[_0xd0b3('0x1d2')]/0x64;_0x326a9a[_0xd0b3('0x1db')]=_0x200190[0x0][_0xd0b3('0x1da')]||0x0;_0x326a9a[_0xd0b3('0x69')]=_0x16d017>0x0?_0x16d017:0x1;return _0xe99928[_0xd0b3('0x1d3')](_0x4a5b48,_0x16fbe7,_0x4f4d1a,_0x16d017,_0x1ebcb9);})[_0xd0b3('0xb3')](function(_0x5792d2){return _0x1a0455(_0x5792d2);})['catch'](function(_0x5356e6){return _0x5a8645(msgResponse(_0xd0b3('0x1dc'),_0xd0b3('0x136'),JSON['stringify'](_0x5356e6)));});}if(_0x326a9a[_0xd0b3('0x1c6')]==='agentBusyFactor'){return _0xe99928['getVoiceQueueRtPauses'](_0x326a9a['id'])[_0xd0b3('0xb3')](function(_0x35d6b0){var _0x11242d=_0x326a9a[_0xd0b3('0x4e')]-_0x35d6b0[0x0][_0xd0b3('0x1da')];var _0xc05b3=_0x326a9a[_0xd0b3('0x1c1')]*0x3c;var _0x1ad165=_0x3ec639[0x0][_0xd0b3('0x65')]+_0x3ec639[0x0]['predictiveIntervalAvgHoldtime'];var _0x438025=(_0x3ec639[0x0][_0xd0b3('0x63')]+_0x3ec639[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3ec639[0x0][_0xd0b3('0x66')])/_0x3ec639[0x0][_0xd0b3('0x6c')];var _0x4d9e02=_0x326a9a[_0xd0b3('0x1d2')]/0x64;_0x326a9a[_0xd0b3('0x1db')]=_0x35d6b0[0x0]['outboundQueuePauses']||0x0;_0x326a9a['predictiveIntervalHitRate']=_0x438025>0x0?_0x438025:0x1;return _0xe99928[_0xd0b3('0x1d5')](_0x11242d,_0xc05b3,_0x1ad165,_0x438025,_0x4d9e02);})['then'](function(_0x4ee3bb){return _0x1a0455(_0x4ee3bb);})['catch'](function(_0x29158a){return _0x5a8645(msgResponse(_0xd0b3('0x1dc'),_0xd0b3('0x136'),JSON[_0xd0b3('0x49')](_0x29158a)));});}}else{return _0x5a8645(msgResponse(_0xd0b3('0x1d6'),_0xd0b3('0x136'),_0xd0b3('0x1d8')));}});};};Dialer[_0xd0b3('0x1b')]['startMethodPredictive']=function(_0x646ea6){var _0x2bdfd9=this;return function(){var _0x2a5462=0x0;var _0x14877d=Math[_0xd0b3('0x1be')](_0x646ea6[_0xd0b3('0x1dd')]*0x3e8);if(_0x14877d>0x0){_0x14877d=_0x14877d<0x64?0x64:_0x14877d;loggerPredictive[_0xd0b3('0x77')](_0x646ea6[_0xd0b3('0x40')],_0xd0b3('0x1de'),_0x14877d,_0xd0b3('0x4a'));_0x646ea6[_0xd0b3('0x89')]=setInterval(function(){_0x2bdfd9['handlePredictive'](_0x646ea6);loggerPredictiveCalls['info']('[handlePredictive]',_0x2a5462+=0x1);},_0x14877d);}else{loggerPredictive['info'](_0x646ea6['name'],_0xd0b3('0x1df'));}};};Dialer['prototype'][_0xd0b3('0x1e0')]=function(_0x53b1c2,_0xd469f2){var _0x425c09=this;return function(_0x57050f){if(_[_0xd0b3('0x45')](_0x57050f)){if(_[_0xd0b3('0xa8')](_0xd469f2[_0xd0b3('0x1e1')])||!_0xd469f2[_0xd0b3('0x1e2')]){if(_0x53b1c2['dialMethod']===_0xd0b3('0x1e3')){_0x53b1c2[_0xd0b3('0x123')]=_[_0xd0b3('0x3d')](_0x53b1c2[_0xd0b3('0x123')])?!![]:_0x53b1c2[_0xd0b3('0x123')];var _0x858390=uuid['v4']();_0x425c09[_0xd0b3('0xa6')][_0x858390]=new Action(_0x53b1c2,_0xd469f2,_0x858390);loggerBooked[_0xd0b3('0x77')](_0xd0b3('0x1e4'),_0x858390,'queueStatusComplete:\x20',JSON[_0xd0b3('0x49')](_0x53b1c2[_0xd0b3('0x123')]),_0xd0b3('0x1e5'),_0x53b1c2[_0xd0b3('0x40')]);if(_0x53b1c2[_0xd0b3('0x123')]){_0x53b1c2[_0xd0b3('0x123')]=![];_0x425c09['queueBooked'][_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xae')]]=[];ami[_0xd0b3('0xa9')]({'actionid':_0x858390,'action':_0xd0b3('0x1e6'),'queue':_0x53b1c2['name']})[_0xd0b3('0xab')](function(){_0x425c09[_0xd0b3('0xad')](_0x53b1c2);_0x425c09['rescheduleContact']({'active':![],'ContactId':_0x425c09['actions'][_0x858390][_0xd0b3('0xd0')],'ListId':_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xd1')],'VoiceQueueId':_0x425c09['actions'][_0x858390][_0xd0b3('0xfa')]||undefined,'CampaignId':_0x425c09[_0xd0b3('0xa6')][_0x858390]['CampaignId']||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1e7')));delete _0x425c09[_0xd0b3('0xa6')][_0x858390];});}else{loggerBooked[_0xd0b3('0x77')](_0xd0b3('0x1e8'),JSON['stringify'](_0x53b1c2[_0xd0b3('0x123')]),'Queue:\x20',_0x53b1c2[_0xd0b3('0x40')]);_0x425c09[_0xd0b3('0xad')](_0x53b1c2);_0x425c09[_0xd0b3('0xbb')]({'active':![],'ContactId':_0x425c09[_0xd0b3('0xa6')][_0x858390]['ContactId'],'ListId':_0x425c09[_0xd0b3('0xa6')][_0x858390]['ListId'],'VoiceQueueId':_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xfa')]||undefined,'CampaignId':_0x425c09[_0xd0b3('0xa6')][_0x858390][_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x425c09[_0xd0b3('0xa6')][_0x858390];}}else{return _0x425c09[_0xd0b3('0x15a')](_0x53b1c2,_0xd469f2);}}else{if(getDiff(_0xd469f2[_0xd0b3('0x1e9')])<_0x53b1c2['dialRecallMeTimeout']*0x3c){if(_0xd469f2['Agent']&&!_0xd469f2[_0xd0b3('0x1ea')][_0xd0b3('0x1eb')]){_0x425c09[_0xd0b3('0x1f')][_0xd0b3('0x126')](_0xd469f2['id'])['finally'](function(){_0x425c09[_0xd0b3('0xad')](_0x53b1c2);});}else{_0x425c09[_0xd0b3('0xbd')]({'active':![]},_0xd469f2['id'],0x1)['finally'](function(){_0x425c09[_0xd0b3('0xad')](_0x53b1c2);});}}else{_0x53b1c2['outboundReCallsDay']+=0x1;_0x425c09[_0xd0b3('0xad')](_0x53b1c2);if(_0x53b1c2['dialRecallInQueue']){_0x425c09['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xd469f2[_0xd0b3('0xd0')],'ListId':_0xd469f2[_0xd0b3('0xd1')],'VoiceQueueId':_0xd469f2[_0xd0b3('0xfa')]||undefined,'CampaignId':_0xd469f2[_0xd0b3('0xd2')]||undefined})[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0x1ec')));_0x425c09[_0xd0b3('0xc6')](createObjHistory(_0x53b1c2,_0xd469f2,_0xd0b3('0x1ed'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xd0b3('0x1ee')));}else{_0x425c09[_0xd0b3('0xcd')](createObjHistory(_0x53b1c2,_0xd469f2,_0xd0b3('0x1ef'),0x16,_0xd0b3('0x1f0')),_0xd0b3('0x1f1'),_0xd0b3('0x1f2'));}}}}else{_0x53b1c2['outboundBlacklistCallsDay']+=0x1;_0x425c09[_0xd0b3('0xcd')](createObjHistory(_0x53b1c2,_0xd469f2,_0xd0b3('0x1f3'),0xd,_0xd0b3('0x1f4')),_0xd0b3('0x1f5'),'[Originate][MoveBlacklist]');throw _0xd0b3('0x1f6');}};};Dialer['prototype'][_0xd0b3('0x1f7')]=function(_0x2d0893){var _0x2bde02=this;var _0x750ffa=_0x2d0893['limitCalls']-_0x2d0893[_0xd0b3('0x91')]-_0x2d0893['temp'];emitCampaignSummary(_0x2d0893);if(_0x750ffa>0x0){if(_0x750ffa>this[_0xd0b3('0x24')]){_0x750ffa=this[_0xd0b3('0x24')];}_0x2d0893[_0xd0b3('0x1f8')]+=_0x750ffa;this['getContactDialerIvr'](_0x2d0893['id'],_0x750ffa,_0x2d0893['dialOrderByScheduledAt'])[_0xd0b3('0xb3')](function(_0x4740f0){_0x2d0893[_0xd0b3('0x1f8')]-=_0x750ffa;_0x2d0893[_0xd0b3('0x1f8')]=_0x2d0893['temp']>0x0?_0x2d0893[_0xd0b3('0x1f8')]:0x0;if(!checkContactEmpty(_0x4740f0)){_0x2d0893[_0xd0b3('0x3e')]=_0xd0b3('0x98');logger[_0xd0b3('0x77')](_0xd0b3('0x1f9')+_0x2d0893[_0xd0b3('0x40')]);}else{_0x2d0893['originated']+=_0x4740f0['length'];_0x2d0893['message']=_0xd0b3('0x1fa');for(var _0x29a53a=0x0;_0x29a53a<_0x4740f0[_0xd0b3('0x90')];_0x29a53a+=0x1){_0x2d0893[_0xd0b3('0x1fb')]+=0x1;if(_[_0xd0b3('0xa8')](_0x4740f0[_0x29a53a])||_[_0xd0b3('0xa8')](_0x4740f0[_0x29a53a][_0xd0b3('0x15e')])||_[_0xd0b3('0xa8')](_0x4740f0[_0x29a53a][_0xd0b3('0x15e')][_0xd0b3('0x15f')])){_0x2bde02[_0xd0b3('0xcb')]('[actionOriginate]\x20',_0x2d0893,_0x4740f0[_0x29a53a]);}else{_0x2bde02[_0xd0b3('0xb7')](_[_0xd0b3('0xcf')](_0x4740f0[_0x29a53a],['CampaignId',_0xd0b3('0x1fc')]))[_0xd0b3('0xb3')](_0x2bde02[_0xd0b3('0x1e0')](_0x2d0893,_0x4740f0[_0x29a53a]))[_0xd0b3('0xab')](_0x2bde02[_0xd0b3('0xca')](_0xd0b3('0x1fd'),_0x2d0893));}}}})[_0xd0b3('0xab')](loggerGetContactDialer('[getContactCampaign2]',_0x2d0893,_0x750ffa));}};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x14b')]=function(_0x333b61,_0x41a3c4){var _0x4ed88a=this;var _0x17a4d6=[];var _0x30d124=_0x41a3c4>=0x1?_0x41a3c4:0x1;if(_0x333b61['dialMethod']===_0xd0b3('0x1e3')){_0x30d124=0x1;}var _0x24428e=Math[_0xd0b3('0x1be')](_0x333b61[_0xd0b3('0x4d')]*_0x30d124)-_0x333b61[_0xd0b3('0x91')]-_0x333b61['temp'];emitVoiceQueueSummary(_0x333b61);if(_0x333b61[_0xd0b3('0x1fe')]>0x0){var _0x21753d=_0x333b61[_0xd0b3('0x1fe')]-_0x333b61[_0xd0b3('0x91')]-_0x333b61['talking']-_0x333b61['temp']-_0x333b61[_0xd0b3('0x4f')];if(_0x24428e>_0x21753d){_0x24428e=_0x21753d;}}if(_0x24428e>0x0){if(_0x333b61[_0xd0b3('0x148')]==='booked'){_0x24428e=0x1;}if(_0x24428e>this[_0xd0b3('0x24')]){_0x24428e=this['maxNumberOriginate'];}_0x333b61[_0xd0b3('0x1f8')]+=_0x24428e;for(var _0x1ae1d4 in this['agents']){if(typeof this[_0xd0b3('0x22')][_0x1ae1d4]!==_0xd0b3('0x92')){if(this[_0xd0b3('0x22')][_0x1ae1d4][_0xd0b3('0xa0')]===_0xd0b3('0x1ff')&&this[_0xd0b3('0x22')][_0x1ae1d4][_0xd0b3('0xd8')]==='reachable'){_0x17a4d6[_0xd0b3('0x121')](this[_0xd0b3('0x22')][_0x1ae1d4]['id']);}}}this['getContactDialer'](_0x333b61['id'],_0x17a4d6,_0x24428e,_0x333b61[_0xd0b3('0x200')])['then'](function(_0xb890d0){_0x333b61['temp']-=_0x24428e;_0x333b61['temp']=_0x333b61['temp']>0x0?_0x333b61[_0xd0b3('0x1f8')]:0x0;if(!checkContactEmpty(_0xb890d0)){_0x4ed88a['countReScheduled'](_0x333b61)[_0xd0b3('0xb3')](sendMessageReschedule(_0x333b61))['catch'](loggerCatch(_0xd0b3('0xb4')));}else{_0x333b61[_0xd0b3('0x91')]+=_0xb890d0[_0xd0b3('0x90')];_0x333b61[_0xd0b3('0x3e')]=_0x333b61[_0xd0b3('0x148')]===_0xd0b3('0x1e3')?_0xd0b3('0x166'):_0xd0b3('0x1fa');for(var _0xea49ba=0x0;_0xea49ba<_0xb890d0[_0xd0b3('0x90')];_0xea49ba+=0x1){if(_['isNil'](_0xb890d0[_0xea49ba])||_[_0xd0b3('0xa8')](_0xb890d0[_0xea49ba][_0xd0b3('0x15e')])||_[_0xd0b3('0xa8')](_0xb890d0[_0xea49ba][_0xd0b3('0x15e')][_0xd0b3('0x15f')])){_0x4ed88a['emptyContact']('[actionOriginate]\x20',_0x333b61,_0xb890d0[_0xea49ba]);}else{_0x4ed88a['checkIsBlackList'](_['pick'](_0xb890d0[_0xea49ba],[_0xd0b3('0xfa'),'Contact.phone']))['then'](_0x4ed88a[_0xd0b3('0x1e0')](_0x333b61,_0xb890d0[_0xea49ba]))[_0xd0b3('0xab')](_0x4ed88a['loggerHandler'](_0xd0b3('0x201'),_0x333b61));}}}})[_0xd0b3('0xab')](loggerGetContactDialer(_0xd0b3('0x202'),_0x333b61,_0x24428e));}};Dialer['prototype'][_0xd0b3('0x89')]=function(_0x291efe){if(_0x291efe['dialLimitQueue']>0x0){var _0x3e0c7c=_0x291efe[_0xd0b3('0x1fe')]-_0x291efe[_0xd0b3('0x91')]-_0x291efe['talking'];if(_0x3e0c7c>0x0){this['tryOriginatePredictive'](_0x291efe);}else{loggerPredictiveCalls[_0xd0b3('0x77')](_0xd0b3('0x203'));}}else{this['tryOriginatePredictive'](_0x291efe);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x9bc673){var _0x5cf726=this;var _0x52c069=[];_0x9bc673[_0xd0b3('0x91')]+=0x1;for(var _0xb2e59b in this[_0xd0b3('0x22')]){if(typeof this['agents'][_0xb2e59b]!==_0xd0b3('0x92')){if(this['agents'][_0xb2e59b][_0xd0b3('0xa0')]===_0xd0b3('0x1ff')&&this[_0xd0b3('0x22')][_0xb2e59b]['status']==='reachable'){_0x52c069['push'](this[_0xd0b3('0x22')][_0xb2e59b]['id']);}}}this['getContactDialer'](_0x9bc673['id'],_0x52c069,0x1,_0x9bc673[_0xd0b3('0x200')])[_0xd0b3('0xb3')](function(_0x1a7a35){if(!checkContactEmpty(_0x1a7a35)){checkContactLowerLimitOriginate(_0x9bc673,0x1,0x0);_0x5cf726[_0xd0b3('0xb1')](_0x9bc673)['then'](sendMessageReschedule(_0x9bc673))[_0xd0b3('0xab')](loggerCatch(_0xd0b3('0xb4')));}else{_0x9bc673[_0xd0b3('0x3e')]='RUNNING';if(_['isNil'](_0x1a7a35[0x0])||_[_0xd0b3('0xa8')](_0x1a7a35[0x0][_0xd0b3('0x15e')])||_[_0xd0b3('0xa8')](_0x1a7a35[0x0]['Contact'][_0xd0b3('0x15f')])){_0x5cf726[_0xd0b3('0xcb')](_0xd0b3('0x201'),_0x9bc673,_0x1a7a35[0x0]);}else{_0x5cf726['checkIsBlackList'](_[_0xd0b3('0xcf')](_0x1a7a35[0x0],[_0xd0b3('0xfa'),'Contact.phone']))['then'](_0x5cf726[_0xd0b3('0x1e0')](_0x9bc673,_0x1a7a35[0x0]))['catch'](_0x5cf726[_0xd0b3('0xca')]('[actionOriginatePredictive]\x20',_0x9bc673));}}})[_0xd0b3('0xab')](loggerGetContactDialer(_0xd0b3('0x204'),_0x9bc673,0x1));emitVoiceQueueSummary(_0x9bc673);};Dialer['prototype'][_0xd0b3('0x1d3')]=function(_0x53e141,_0x2499c9,_0x6c25ae,_0x23b850,_0x11704c,_0x1fbeb4){loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x205'));loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x206'),_0x53e141);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x207'),_0x2499c9);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x208'),_0x6c25ae);loggerPredictive['info'](_0xd0b3('0x209'),_0x23b850);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x20a'),_0x11704c);loggerPredictive['info']('---------------------------');return new BPromise(function(_0xe05fef,_0x39a3e9){if(_0x53e141<=0x0||isNaN(_0x53e141)){return _0x39a3e9(msgResponse('[abandonmentRate]','Error',_0xd0b3('0x20b')+_0x53e141));}if(_0x6c25ae<=0x0||isNaN(_0x6c25ae)){return _0x39a3e9(msgResponse(_0xd0b3('0x20c'),_0xd0b3('0x48'),'Ts\x20=\x20'+_0x6c25ae));}if(_0x23b850<=0x0||isNaN(_0x23b850)){return _0x39a3e9(msgResponse(_0xd0b3('0x20c'),_0xd0b3('0x48'),_0xd0b3('0x20d')+_0x23b850));}if(_0x2499c9<=0x0||isNaN(_0x2499c9)){return _0x39a3e9(msgResponse('[abandonmentRate]','Error',_0xd0b3('0x20e')+_0x2499c9));}if(_0x11704c<=0x0||isNaN(_0x11704c)){return _0x39a3e9(msgResponse(_0xd0b3('0x20c'),'Error',_0xd0b3('0x20f')+_0x11704c));}_0x1fbeb4=_0x1fbeb4||0x0;var _0x135a54=0x1/_0x6c25ae;var _0x230bf5=0x0;var _0x11791f=0x0;var _0x301190=0x0;var _0x443082=0x0;for(var _0x2552a1=0x0;_0x301190<_0x11704c;_0x2552a1+=0x1){_0x11791f=_0x2552a1/_0x2499c9;_0x230bf5=(_0x23b850*_0x11791f+_0x1fbeb4)/_0x135a54;_0x301190=erlangb(_0x230bf5,_0x53e141);_0x443082=_0x230bf5/_0x53e141*(0x1-erlangb(_0x230bf5,_0x53e141));}return _0xe05fef({'erlangCalls':_0x2552a1,'erlangCallToSecond':_0x2499c9/_0x2552a1,'erlangAbandonmentRate':_0x301190,'erlangBusyFactor':_0x443082});});};Dialer[_0xd0b3('0x1b')][_0xd0b3('0x1d5')]=function(_0x4cf1f6,_0x53b899,_0x18660f,_0x5202c7,_0x3a09ff,_0x36f038){loggerPredictive[_0xd0b3('0x77')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x206'),_0x4cf1f6);loggerPredictive[_0xd0b3('0x77')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53b899);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x208'),_0x18660f);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x209'),_0x5202c7);loggerPredictive['info'](_0xd0b3('0x210'),_0x3a09ff);loggerPredictive[_0xd0b3('0x77')](_0xd0b3('0x84'));return new BPromise(function(_0x536238,_0x3b8cb5){if(_0x4cf1f6<=0x0||isNaN(_0x4cf1f6)){return _0x3b8cb5(msgResponse(_0xd0b3('0x211'),_0xd0b3('0x48'),'m\x20=\x20'+_0x4cf1f6));}if(_0x18660f<=0x0||isNaN(_0x18660f)){return _0x3b8cb5(msgResponse('[busyFactor]',_0xd0b3('0x48'),'Ts\x20=\x20'+_0x18660f));}if(_0x5202c7<=0x0||isNaN(_0x5202c7)){return _0x3b8cb5(msgResponse(_0xd0b3('0x211'),_0xd0b3('0x48'),_0xd0b3('0x20d')+_0x5202c7));}if(_0x53b899<=0x0||isNaN(_0x53b899)){return _0x3b8cb5(msgResponse('[busyFactor]','Error',_0xd0b3('0x20e')+_0x53b899));}if(_0x3a09ff<=0x0||isNaN(_0x3a09ff)){return _0x3b8cb5(msgResponse(_0xd0b3('0x211'),'Error','Umin\x20=\x20'+_0x3a09ff));}_0x36f038=_0x36f038||0x0;var _0x122dde=0x1/_0x18660f;var _0x11ad33=0x0;var _0x2eead5=0x0;var _0x8a8693=0x0;var _0x13b125=0x0;for(var _0x4d94a3=0x0;_0x13b125<_0x3a09ff;_0x4d94a3+=0x1){_0x2eead5=_0x4d94a3/_0x53b899;_0x11ad33=(_0x5202c7*_0x2eead5+_0x36f038)/_0x122dde;_0x8a8693=erlangb(_0x11ad33,_0x4cf1f6);_0x13b125=_0x11ad33/_0x4cf1f6*(0x1-erlangb(_0x11ad33,_0x4cf1f6));}return _0x536238({'erlangCalls':_0x4d94a3,'erlangCallToSecond':_0x53b899/_0x4d94a3,'erlangAbandonmentRate':_0x8a8693,'erlangBusyFactor':_0x13b125});});};module['exports']=Dialer; \ No newline at end of file +var _0x8563=['isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','uniqueid','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','[syncHangupInAMDIvr]','countabandonedretry','stateGlobal','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','length','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','Queue','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','Predictive\x20after\x20first\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','Contact.phone','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','reachable','dialOrderByScheduledAt','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','voice_queue:save','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalAnsweredCalls','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','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','[uniqueid]','clearZombieChannels','prototype','undefined','Action','status','channel','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','catch','checkIsBlackList','then','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8563,0x138));var _0x3856=function(_0x52ea2e,_0x5b7160){_0x52ea2e=_0x52ea2e-0x0;var _0x188189=_0x8563[_0x52ea2e];return _0x188189;};'use strict';var util=require(_0x3856('0x0'));var _=require('lodash');var BPromise=require(_0x3856('0x1'));var uuid=require(_0x3856('0x2'));var moment=require(_0x3856('0x3'));var rr=require('rr');var md5=require(_0x3856('0x4'));var Redis=require(_0x3856('0x5'));var ut=require('../preview/util/util');var config=require(_0x3856('0x6'));var logger=require(_0x3856('0x7'))(_0x3856('0x8'));var loggerBooked=require(_0x3856('0x7'))(_0x3856('0x9'));var loggerPredictive=require(_0x3856('0x7'))(_0x3856('0xa'));var loggerPredictiveCalls=require(_0x3856('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x3856('0x7'))(_0x3856('0xb'));var ami=require(_0x3856('0xc'));config[_0x3856('0xd')]=_[_0x3856('0xe')](config[_0x3856('0xd')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3856('0xd')]));var cmHopper=require(_0x3856('0xf'));var cmHopperHistory=require(_0x3856('0x10'));var cmHopperBlack=require(_0x3856('0x11'));var voiceQueueRt=require(_0x3856('0x12'));var Action=require(_0x3856('0x13'));var History=require(_0x3856('0x14'));var Final=require(_0x3856('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x3856('0x16'));var Hangup=require('./hangup');var ipAgi=process['env'][_0x3856('0x17')]||'127.0.0.1';var strategy={'rrmemory':_0x3856('0x18'),'roundrobin':_0x3856('0x19')};var Sequence=function(){};Sequence['prototype'][_0x3856('0x1a')]=function(_0x10547e){this['tail']=this['tail']?this['tail'][_0x3856('0x1b')](_0x10547e):_0x10547e();};function Dialer(_0x32ffe8,_0x392921){this[_0x3856('0x1c')]=new Sequence();this[_0x3856('0x1d')]=_0x392921;this[_0x3856('0x1e')]=_0x32ffe8[_0x3856('0x1e')];this[_0x3856('0x1f')]=_0x32ffe8[_0x3856('0x1f')];this[_0x3856('0x20')]=_0x32ffe8[_0x3856('0x20')];this['trunks']=_0x32ffe8[_0x3856('0x21')];this[_0x3856('0x22')]=config['maxNumberOriginate']||0x2;this[_0x3856('0x23')]={};this[_0x3856('0x24')]={};this[_0x3856('0x25')]={};this[_0x3856('0x26')]={};this['optionPredictive']={};this[_0x3856('0x27')]={};this[_0x3856('0x28')]={};this[_0x3856('0x29')]={};this[_0x3856('0x2a')]={};this[_0x3856('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x3856('0x2c')](this));ami['on'](_0x3856('0x2d'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0x3856('0x2e')][_0x3856('0x2c')](this));ami['on'](_0x3856('0x2f'),this[_0x3856('0x30')][_0x3856('0x2c')](this));ami['on'](_0x3856('0x31'),this[_0x3856('0xb')][_0x3856('0x2c')](this));ami['on']('hangup',this[_0x3856('0x32')]['bind'](this));ami['on'](_0x3856('0x33'),this['syncNewExten']['bind'](this));ami['on'](_0x3856('0x34'),this['syncVarSet'][_0x3856('0x2c')](this));ami['on']('queuemember',this[_0x3856('0x35')][_0x3856('0x2c')](this));ami['on'](_0x3856('0x36'),this[_0x3856('0x37')][_0x3856('0x2c')](this));this[_0x3856('0x38')]();this[_0x3856('0x39')]();}function isNotNull(_0xbbf624){return _0xbbf624!==null&&!_[_0x3856('0x3a')](_0xbbf624);}function checkIsLoggedIn(_0x1e0e26,_0x4467d5){return function(){if(_0x4467d5<=0x0){_0x1e0e26[_0x3856('0x3b')]=_0x3856('0x3c');throw _0x1e0e26[_0x3856('0x3d')]+_0x3856('0x3e');}};}function isActive(_0x243c49){return _0x243c49;}function checkIsActive(_0x2dc1b0,_0x162ce4){return function(){if(!isActive(_0x162ce4)){_0x2dc1b0['message']=_0x3856('0x3f');throw _0x2dc1b0[_0x3856('0x3d')]+_0x3856('0x40');}};}function checkInterval(_0x26b7a2){return function(){if(!isNotNull(_0x26b7a2[_0x3856('0x41')])){_0x26b7a2[_0x3856('0x3b')]=_0x3856('0x42');throw _0x26b7a2[_0x3856('0x3d')]+_0x3856('0x43');}if(!isNotNull(_0x26b7a2[_0x3856('0x41')][_0x3856('0x44')])){_0x26b7a2[_0x3856('0x3b')]=_0x3856('0x42');throw _0x26b7a2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x3856('0x45')](_0x26b7a2[_0x3856('0x41')][_0x3856('0x44')]))){_0x26b7a2[_0x3856('0x3b')]=_0x3856('0x42');throw _0x26b7a2[_0x3856('0x3d')]+_0x3856('0x43');}};}function msgResponse(_0x6d05c3,_0x586b06,_0x3c2546){return{'action':_0x6d05c3,'response':_0x586b06,'message':_0x3c2546,'stack':_0x3c2546};}function myreject(_0x26544b){return function(_0x24262d){return _0x26544b(msgResponse(_0x3856('0x46'),_0x3856('0x47'),JSON[_0x3856('0x48')](_0x24262d)));};}function getSeconds(_0x5381a9,_0x181090){var _0xca08f3=moment(_0x5381a9)['milliseconds'](0x0);var _0x51114c=moment(_0x181090)[_0x3856('0x49')](0x0);return _0xca08f3[_0x3856('0x4a')](_0x51114c,'seconds');}function emit(_0x4d2881,_0x25846b,_0x2af329){io['to'](_0x4d2881)['emit'](_0x25846b,_0x2af329);}function emitVoiceQueueSummary(_0x238aac){if(_0x238aac[_0x3856('0x4b')]===_0x3856('0x4c')){var _0xd45d7b={'id':_0x238aac['id'],'name':_0x238aac['name'],'strategy':_0x238aac[_0x3856('0x4d')],'answered':_0x238aac[_0x3856('0x4e')],'available':_0x238aac['available'],'loggedIn':_0x238aac[_0x3856('0x4f')],'pTalking':_0x238aac[_0x3856('0x50')],'sumBillable':_0x238aac['sumBillable'],'sumDuration':_0x238aac[_0x3856('0x51')],'sumHoldTime':_0x238aac[_0x3856('0x52')]||0x0,'talking':_0x238aac[_0x3856('0x53')],'total':_0x238aac[_0x3856('0x54')],'type':_0x238aac[_0x3856('0x4b')],'unmanaged':_0x238aac['unmanaged'],'abandoned':_0x238aac['abandoned'],'waiting':_0x238aac[_0x3856('0x55')],'loggedInDb':_0x238aac[_0x3856('0x56')],'dialActive':_0x238aac[_0x3856('0x57')],'dialMethod':_0x238aac[_0x3856('0x58')],'dialOriginateCallerIdName':_0x238aac[_0x3856('0x59')],'dialOriginateCallerIdNumber':_0x238aac[_0x3856('0x5a')],'dialOriginateTimeout':_0x238aac['dialOriginateTimeout'],'dialPrefix':_0x238aac[_0x3856('0x5b')],'outboundAnswerAgiCallsDay':_0x238aac[_0x3856('0x5c')],'outboundAnswerCallsDay':_0x238aac[_0x3856('0x5d')],'outboundBlacklistCallsDay':_0x238aac['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x238aac[_0x3856('0x5e')],'outboundCongestionCallsDay':_0x238aac['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x238aac[_0x3856('0x5f')],'outboundDropCallsDayCallersExit':_0x238aac[_0x3856('0x60')],'outboundDropCallsDayTimeout':_0x238aac[_0x3856('0x61')],'outboundNoAnswerCallsDay':_0x238aac[_0x3856('0x62')],'outboundNoSuchCallsDay':_0x238aac['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x238aac[_0x3856('0x63')],'outboundReCallsDay':_0x238aac[_0x3856('0x64')],'outboundRejectCallsDay':_0x238aac[_0x3856('0x65')],'outboundUnknownCallsDay':_0x238aac[_0x3856('0x66')],'predictiveIntervalAnsweredCalls':_0x238aac['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x238aac[_0x3856('0x67')],'predictiveIntervalAvgTalktime':_0x238aac[_0x3856('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x238aac[_0x3856('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x238aac['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x238aac[_0x3856('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x238aac['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x238aac[_0x3856('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x238aac[_0x3856('0x6c')],'predictiveIntervalPauses':_0x238aac[_0x3856('0x6d')],'predictiveIntervalAvailable':_0x238aac[_0x3856('0x6e')],'predictiveIntervalTotalCalls':_0x238aac[_0x3856('0x6f')],'message':_0x238aac[_0x3856('0x3b')],'originated':_0x238aac[_0x3856('0x70')],'erlangCalls':_0x238aac['erlangCalls'],'erlangCallToSecond':_0x238aac[_0x3856('0x71')],'erlangAbandonmentRate':_0x238aac[_0x3856('0x72')],'erlangBusyFactor':_0x238aac['erlangBusyFactor'],'startPredictive':_0x238aac[_0x3856('0x27')],'startProgressive':_0x238aac[_0x3856('0x28')]};if(_0x238aac['Trunk']){_0xd45d7b['Trunk']={'id':_0x238aac[_0x3856('0x73')]['id'],'name':_0x238aac['Trunk'][_0x3856('0x3d')],'active':_0x238aac[_0x3856('0x73')][_0x3856('0x74')],'callerid':_0x238aac['Trunk'][_0x3856('0x75')]};}if(_0x238aac[_0x3856('0x41')]){_0xd45d7b['Interval']={'id':_0x238aac[_0x3856('0x41')]['id'],'name':_0x238aac[_0x3856('0x41')]['name']};}var _0x1ccd4a=md5(JSON['stringify'](_0xd45d7b));if(_0x238aac[_0x3856('0x4')]!==_0x1ccd4a){_0x238aac[_0x3856('0x4')]=_0x1ccd4a;emit(util['format']('voice:queue:%s',_0xd45d7b[_0x3856('0x3d')]),_0x3856('0x76'),_0xd45d7b);}}}function emitCampaignSummary(_0x42cf68){if(_0x42cf68[_0x3856('0x4b')]==='ivr'){emit(util[_0x3856('0x77')](_0x3856('0x78'),_0x42cf68[_0x3856('0x3d')]),_0x3856('0x79'),_0x42cf68);}}function checkGetDataPredictive(_0x43c231){if(isNotNull(_0x43c231)&&!_[_0x3856('0x45')](_0x43c231)){loggerPredictive[_0x3856('0x7a')](_0x3856('0x7b'));loggerPredictive[_0x3856('0x7a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43c231[_0x3856('0x6f')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43c231[_0x3856('0x7c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43c231['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x7d'),_0x43c231['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x7e'),_0x43c231[_0x3856('0x67')]);loggerPredictive[_0x3856('0x7a')](_0x3856('0x7f'),_0x43c231['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x80'));if(_0x43c231[_0x3856('0x6f')]>0x0){if(!_['isUndefined'](_0x43c231[_0x3856('0x68')])&&_0x43c231[_0x3856('0x68')]>0x0){return!![];}loggerPredictive[_0x3856('0x7a')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x3856('0x3a')](_0x43c231[_0x3856('0x67')])&&_0x43c231[_0x3856('0x67')]>0x0){return!![];}loggerPredictive[_0x3856('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x3856('0x81'));}}else{loggerPredictive[_0x3856('0x7a')](_0x3856('0x82'));}return![];}function mergeDataErlangB(_0x1d6cf0){return function(_0xca2d98){loggerPredictive[_0x3856('0x7a')](_0x3856('0x83'));loggerPredictive[_0x3856('0x7a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xca2d98[_0x3856('0x84')]);loggerPredictive[_0x3856('0x7a')](_0x3856('0x85'),_0xca2d98['erlangCallToSecond']);loggerPredictive[_0x3856('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xca2d98[_0x3856('0x72')]);loggerPredictive[_0x3856('0x7a')](_0x3856('0x86'),_0xca2d98['erlangBusyFactor']);loggerPredictive[_0x3856('0x7a')](_0x3856('0x87'),_0xca2d98[_0x3856('0x72')]);loggerPredictive['info'](_0x3856('0x80'));_[_0x3856('0x88')](_0x1d6cf0,_0xca2d98);};}function getDiff(_0x5ca49d){var _0x53bcbd=moment()[_0x3856('0x49')](0x0);var _0x48d0c3=moment(_0x5ca49d)['milliseconds'](0x0);return _0x53bcbd[_0x3856('0x4a')](_0x48d0c3,'seconds');}function ifInterval(_0x4ec083,_0x55f321){if(_[_0x3856('0x3a')](_0x55f321)){return![];}return getDiff(_0x55f321)<_0x4ec083*0x3c;}function freeVariablesPredictive(_0x394a36){if(isNotNull(_0x394a36)){if(!_[_0x3856('0x3a')](_0x394a36['startProgressive'])){_0x394a36['startProgressive']=undefined;loggerPredictive['info'](_0x394a36[_0x3856('0x3d')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x3856('0x3a')](_0x394a36[_0x3856('0x27')])){_0x394a36[_0x3856('0x27')]=undefined;loggerPredictive[_0x3856('0x7a')](_0x394a36[_0x3856('0x3d')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x394a36[_0x3856('0x89')])){clearInterval(_0x394a36[_0x3856('0x89')]);_0x394a36[_0x3856('0x89')]=undefined;loggerPredictive[_0x3856('0x7a')](_0x394a36[_0x3856('0x3d')],_0x3856('0x8a'));}}}function erlangb(_0x167db3,_0x343385){if(_0x343385===0x0){return 0x0;}var _0x104b60=0x1;for(var _0x4ae10b=0x1;_0x4ae10b<=_0x343385;_0x4ae10b+=0x1){_0x104b60=0x1+_0x104b60*_0x4ae10b/_0x167db3;}return 0x1/_0x104b60;}function isVoiceQueueOutbound(_0x1b141e){return _0x1b141e===_0x3856('0x4c');}function isNotPreview(_0x29f9d7){return _0x29f9d7!==_0x3856('0x1d');}function isCampaignIvr(_0x5ef101){return _0x5ef101==='ivr';}function getCallerId(_0x1dc4c,_0x27e5dd,_0x2a0d30){if(!_[_0x3856('0x3a')](_0x2a0d30)&&typeof _0x2a0d30===_0x3856('0x8b')&&!_[_0x3856('0x45')](_0x2a0d30)){if(!_['isUndefined'](_0x27e5dd)&&typeof _0x27e5dd===_0x3856('0x8b')&&!_[_0x3856('0x45')](_0x27e5dd)){return util[_0x3856('0x77')](_0x3856('0x8c'),_0x27e5dd,_0x2a0d30);}return util[_0x3856('0x77')](_0x3856('0x8c'),_0x2a0d30,_0x2a0d30);}if(!_[_0x3856('0x3a')](_0x1dc4c)&&typeof _0x1dc4c===_0x3856('0x8b')&&!_[_0x3856('0x45')](_0x1dc4c)){return _0x1dc4c;}return _0x3856('0x8d');}function loggerCatchQueueSummary(_0x48a3cc,_0x5e8b61){return function(_0x2e8c44){freeVariablesPredictive(_0x5e8b61);emitVoiceQueueSummary(_0x5e8b61);emitCampaignSummary(_0x5e8b61);loggerSyncQueueSummary['error'](_0x48a3cc,util['inspect'](_0x2e8c44,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2ddb5d,_0xb0fd3){return function(_0x15ceb7){loggerPredictive['error'](_0xb0fd3[_0x3856('0x3d')],_0x2ddb5d);loggerPredictive[_0x3856('0x8e')](_0x15ceb7['stack']);freeVariablesPredictive(_0xb0fd3);};}function loggerCatch(_0x499749){return function(_0x59d330){logger[_0x3856('0x8e')](_0x499749,util[_0x3856('0x8f')](_0x59d330,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x355afb){return _0x355afb&&!_[_0x3856('0x3a')](_0x355afb)&&_0x355afb['length']>0x0;}function decremetOriginate(_0x37f6f5){if(!_[_0x3856('0x3a')](_0x37f6f5)&&_0x37f6f5!==null){if(typeof _0x37f6f5[_0x3856('0x70')]!=='undefined'){if(_0x37f6f5['originated']>0x0){_0x37f6f5[_0x3856('0x70')]-=0x1;}else{logger['error'](_0x3856('0x90'));}}}else{logger['error'](_0x3856('0x91'));}}function checkContactLowerLimitOriginate(_0xe743a3,_0x3f354a,_0x3a8145){if(_0x3f354a>_0x3a8145){for(var _0x515595=0x0;_0x515595<_0x3f354a-_0x3a8145;_0x515595+=0x1){decremetOriginate(_0xe743a3);}}}function loggerGetContactDialer(_0x119cd1,_0x29c454,_0x30c88f){return function(_0x5e2744){checkContactLowerLimitOriginate(_0x29c454,_0x30c88f,0x0);logger[_0x3856('0x8e')](_0x119cd1,util[_0x3856('0x8f')](_0x5e2744,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x44299b){return function(_0x132ce7){if(isNotNull(_0x132ce7)&&isNotNull(_0x132ce7[0x0])){if(_0x132ce7[0x0][_0x3856('0x92')]>0x0){_0x44299b[_0x3856('0x3b')]=_0x3856('0x93');logger[_0x3856('0x7a')](_0x3856('0x94')+_0x44299b[_0x3856('0x3d')],_0x132ce7[0x0][_0x3856('0x92')],_0x3856('0x95'));}else{_0x44299b['message']=_0x3856('0x96');logger[_0x3856('0x7a')]('[getContactDialer2][Empty]'+_0x44299b[_0x3856('0x3d')]);}}};}function notSendMessagesQueue(_0x298924){if(_0x298924[_0x3856('0x97')]){freeVariablesPredictive(_0x298924);if(_0x298924[_0x3856('0x70')]===0x0&&_0x298924[_0x3856('0x53')]===0x0&&_0x298924[_0x3856('0x55')]===0x0&&(_0x298924['pTalking']||0x0)===0x0){_0x298924[_0x3856('0x97')]=![];_0x298924[_0x3856('0x98')]=0x0;_0x298924[_0x3856('0x3b')]=_0x3856('0x3f');loggerSyncQueueSummary[_0x3856('0x8e')](_0x3856('0x99'),_0x298924[_0x3856('0x3d')],_0x3856('0x9a'));}else{_0x298924[_0x3856('0x3b')]=_0x3856('0x9b');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x298924[_0x3856('0x3d')],'is\x20disactive');}emitVoiceQueueSummary(_0x298924);}}function notSendMessagesCampaign(_0x345249){if(_0x345249['sendMessageOneNotActive']){if(_0x345249['originated']===0x0){_0x345249[_0x3856('0x97')]=![];_0x345249['message']=_0x3856('0x3f');loggerSyncQueueSummary[_0x3856('0x8e')](_0x3856('0x9c'),_0x345249['name'],'is\x20not\x20active');}else{_0x345249['message']=_0x3856('0x9b');loggerSyncQueueSummary[_0x3856('0x8e')](_0x3856('0x9c'),_0x345249[_0x3856('0x3d')],_0x3856('0x9d'));}emitCampaignSummary(_0x345249);}}function createObjHistory(_0x39fac8,_0x1b2f89,_0x918cfb,_0x261a63,_0x3ac85b){_0x39fac8[_0x3856('0x3b')]=_0x918cfb;var _0x5d2024=new Action(_0x39fac8,_0x1b2f89);var _0xe89038=new History(_0x5d2024);_0xe89038[_0x3856('0x9e')]=_0x261a63;_0xe89038['statedesc']=_0x3ac85b;_0xe89038['endtime']=_0x5d2024['starttime'];return _0xe89038;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x50168a=this;setInterval(function(){_0x50168a['clearZombieChannels'](_0x50168a[_0x3856('0x26')],_0x3856('0x9f'));_0x50168a[_0x3856('0xa0')](_0x50168a[_0x3856('0x24')],'[actions]');},0x32c8);};Dialer[_0x3856('0xa1')]['clearZombieChannels']=function(_0x45df67,_0x3a512d){var _0x18dc83=this;for(var _0x1b81c2 in _0x45df67){if(typeof _0x45df67[_0x1b81c2]!==_0x3856('0xa2')){this[_0x3856('0x1c')][_0x3856('0x1a')](function(){if(!_['isNil'](_0x45df67[_0x1b81c2])){return ami[_0x3856('0xa3')]({'action':_0x3856('0xa4'),'channel':_0x45df67[_0x1b81c2][_0x3856('0xa5')]})['catch'](function(_0x335085){if(_0x335085['message']===_0x3856('0xa6')){setTimeout(function(){if(_0x45df67[_0x1b81c2]&&_0x45df67[_0x1b81c2]['type']!==_0x3856('0xa7')){_0x18dc83[_0x3856('0xa8')](_0x18dc83[_0x3856('0x1e')][_0x45df67[_0x1b81c2][_0x3856('0xa9')]]);logger['error'](_0x3856('0xaa'),_0x3a512d,_0x1b81c2,_0x45df67[_0x1b81c2][_0x3856('0xa9')]);delete _0x45df67[_0x1b81c2];}if(_0x45df67[_0x1b81c2]&&_0x45df67[_0x1b81c2][_0x3856('0x4b')]===_0x3856('0xa7')){_0x18dc83[_0x3856('0xa8')](_0x18dc83[_0x3856('0x1f')][_0x45df67[_0x1b81c2][_0x3856('0xa9')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x3a512d,_0x1b81c2,_0x45df67[_0x1b81c2][_0x3856('0xa9')]);delete _0x45df67[_0x1b81c2];}},0x2328);}});}});}}};Dialer['prototype'][_0x3856('0xab')]=function(_0x286801){return BPromise[_0x3856('0xac')]()['then'](cmHopper['countReScheduled'](_0x286801))[_0x3856('0xad')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x3856('0xa1')][_0x3856('0xae')]=function(_0x3108ca){return BPromise['resolve']()[_0x3856('0xaf')](cmHopperBlack[_0x3856('0xae')](_0x3108ca))[_0x3856('0xad')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x3856('0xa1')]['checkIsBlackListIvr']=function(_0x2fef3f){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](cmHopperBlack['checkIsBlackListIvr'](_0x2fef3f))[_0x3856('0xad')](loggerCatch(_0x3856('0xb0')));};Dialer[_0x3856('0xa1')][_0x3856('0xb1')]=function(_0x44f24a){return BPromise[_0x3856('0xac')]()['then'](cmHopperHistory[_0x3856('0xb2')](_0x44f24a))[_0x3856('0xad')](loggerCatch(_0x3856('0xb3')));};Dialer[_0x3856('0xa1')][_0x3856('0xb4')]=function(_0x504340){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](cmHopper['rescheduleContact'](_0x504340))[_0x3856('0xad')](loggerCatch(_0x3856('0xb5')));};Dialer[_0x3856('0xa1')]['unlockContact']=function(_0x416e4c,_0x406992,_0x3f77e4){return BPromise['resolve']()[_0x3856('0xaf')](cmHopper[_0x3856('0xb6')](_0x416e4c,_0x406992,_0x3f77e4))[_0x3856('0xad')](loggerCatch(_0x3856('0xb7')));};Dialer[_0x3856('0xa1')][_0x3856('0xb8')]=function(_0x22b593,_0x343b8c,_0x5893f1,_0x1039ca){return BPromise[_0x3856('0xac')]()['then'](cmHopper[_0x3856('0xb8')](_0x22b593,_0x343b8c,_0x5893f1,_0x1039ca))[_0x3856('0xad')](loggerCatch(_0x3856('0xb9')));};Dialer[_0x3856('0xa1')][_0x3856('0xba')]=function(_0x35a6be,_0x419b10,_0x4ce9d0){return BPromise[_0x3856('0xac')]()['then'](cmHopper[_0x3856('0xba')](_0x35a6be,_0x419b10,_0x4ce9d0))[_0x3856('0xad')](loggerCatch(_0x3856('0xb9')));};Dialer[_0x3856('0xa1')][_0x3856('0xbb')]=function(_0x5f50b){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](voiceQueueRt[_0x3856('0xbb')](_0x5f50b))['catch'](loggerCatch(_0x3856('0xbc')));};Dialer[_0x3856('0xa1')][_0x3856('0xbd')]=function(_0xd97b01){return BPromise[_0x3856('0xac')]()['then'](cmHopper[_0x3856('0xbd')](_0xd97b01))[_0x3856('0xad')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x3856('0xa1')][_0x3856('0xbe')]=function(_0x585a01){return BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](cmHopperHistory[_0x3856('0xbe')](_0x585a01))[_0x3856('0xad')](loggerCatch(_0x3856('0xbf')));};Dialer[_0x3856('0xa1')][_0x3856('0xa8')]=function(_0x3f1ee5){if(!_['isUndefined'](_0x3f1ee5)&&_0x3f1ee5!==null){if(typeof _0x3f1ee5[_0x3856('0x70')]!==_0x3856('0xa2')){if(_0x3f1ee5[_0x3856('0x70')]>0x0){_0x3f1ee5[_0x3856('0x70')]-=0x1;}else{logger[_0x3856('0x8e')](_0x3856('0xc0'));}}}else{logger[_0x3856('0x8e')](_0x3856('0xc1'));}};Dialer[_0x3856('0xa1')][_0x3856('0xc2')]=function(_0x312cbe,_0x5ed4fe){var _0x3b270f=this;return function(_0x43ab6d){_0x3b270f['updateOriginated'](_0x5ed4fe);logger['error'](_0x312cbe,util[_0x3856('0x8f')](_0x43ab6d,{'showHidden':![],'depth':null}));};};Dialer[_0x3856('0xa1')][_0x3856('0xc3')]=function(_0x4ca49d,_0x2518cd,_0x2a1283){var _0x429c41={'state':0x19,'statedesc':_0x3856('0xc4')};this['updateOriginated'](_0x2518cd);this[_0x3856('0xc5')](_[_0x3856('0x88')](_0x429c41,_[_0x3856('0xc6')](_0x2a1283,[_0x3856('0xc7'),_0x3856('0xc8'),_0x3856('0xc9'),_0x3856('0xca'),_0x3856('0xcb')])),_0x3856('0xcc'),'[emptyContact]');logger[_0x3856('0x8e')](_0x4ca49d);};Dialer[_0x3856('0xa1')][_0x3856('0xcd')]=function(_0x52ecdd){return _0x52ecdd===_0x3856('0xce');};Dialer[_0x3856('0xa1')][_0x3856('0xcf')]=function(_0x28b6c9){return!_[_0x3856('0x3a')](_0x28b6c9)&&_0x28b6c9&&!_[_0x3856('0x3a')](_0x28b6c9[_0x3856('0x3d')])&&!_[_0x3856('0x3a')](_0x28b6c9[_0x3856('0x74')])&&_0x28b6c9[_0x3856('0x74')]&&(this[_0x3856('0x21')][util[_0x3856('0x77')](_0x3856('0xd0'),_0x28b6c9[_0x3856('0x3d')])]['status']==='reachable'||this[_0x3856('0x21')][util[_0x3856('0x77')](_0x3856('0xd0'),_0x28b6c9['name'])][_0x3856('0xa4')]===_0x3856('0xd1'));};Dialer[_0x3856('0xa1')]['saveInDb']=function(_0x500eff,_0x545f98,_0x180b21){this[_0x3856('0xbe')](_0x500eff)[_0x3856('0xad')](loggerCatch(_0x545f98));this['moveContactManagedDialer'](_0x500eff)[_0x3856('0xad')](loggerCatch(_0x180b21));};Dialer[_0x3856('0xa1')]['syncVarSet']=function(_0x43f1e6){var _0x2ed96b=this['uniqueId'][_0x43f1e6['uniqueid']];var _0x319b50;if(!_['isNil'](_0x43f1e6)&&!_[_0x3856('0xd2')](_0x43f1e6[_0x3856('0xd3')])&&!_[_0x3856('0xd2')](_0x43f1e6[_0x3856('0xd3')][_0x3856('0xd4')])&&_0x43f1e6[_0x3856('0xd5')]===_0x3856('0xd6')&&_0x2ed96b){if(_0x2ed96b[_0x3856('0x4b')]!==_0x3856('0xa7')&&this[_0x3856('0x1e')][_0x2ed96b['queue']][_0x3856('0xd7')]&&_0x43f1e6[_0x3856('0xd8')]==='HANGUP'){delete this[_0x3856('0x26')][_0x43f1e6[_0x3856('0xd9')]];this[_0x3856('0xa8')](this['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]);this[_0x3856('0x1e')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0x5d')]+=0x1;this['voiceQueues'][_0x2ed96b['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x319b50=new Hangup(_0x2ed96b,_0x43f1e6);_0x319b50['state']=0x12;_0x319b50[_0x3856('0xda')]=_0x3856('0xdb');_0x319b50['membername']=_0x3856('0xdc');this[_0x3856('0xc5')](_0x319b50,_0x3856('0xdd'),_0x3856('0xde'));}if(_0x2ed96b[_0x3856('0x4b')]!=='ivr'&&this[_0x3856('0x1e')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0xd7')]&&_0x43f1e6['value']===_0x3856('0xdf')){var _0x34dfaf=this;return new BPromise(function(_0x5275a9,_0x117d3f){delete _0x34dfaf[_0x3856('0x26')][_0x43f1e6[_0x3856('0xd9')]];_0x34dfaf[_0x3856('0xa8')](_0x34dfaf['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]);_0x34dfaf['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]['outboundAnswerCallsDay']+=0x1;_0x34dfaf['voiceQueues'][_0x2ed96b[_0x3856('0xa9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x12f990=_0x34dfaf[_0x3856('0x1e')][_0x2ed96b[_0x3856('0xa9')]];var _0x4c7ad1=new Hangup(_0x2ed96b,_0x43f1e6);_0x4c7ad1[_0x3856('0x9e')]=0x13;_0x4c7ad1[_0x3856('0xda')]=_0x3856('0xe0');_0x4c7ad1[_0x3856('0xe1')]=_0x3856('0xdc');_0x4c7ad1[_0x3856('0xe2')]+=0x1;_0x4c7ad1[_0x3856('0xe3')]+=0x1;_0x4c7ad1[_0x3856('0xe4')]=!![];_0x34dfaf[_0x3856('0xbe')](_0x4c7ad1)[_0x3856('0xad')](loggerCatch(_0x3856('0xe5')));if(_0x4c7ad1[_0x3856('0xe6')]+_0x4c7ad1[_0x3856('0xe7')]+_0x4c7ad1[_0x3856('0xe8')]+_0x4c7ad1[_0x3856('0xe9')]+_0x4c7ad1[_0x3856('0xea')]+_0x4c7ad1['countabandonedretry']+_0x4c7ad1['countmachineretry']+_0x4c7ad1[_0x3856('0xeb')]>=_0x12f990[_0x3856('0xec')]){_0x34dfaf['stateGlobal'](_0x4c7ad1,_0x5275a9,_0x117d3f,_0x3856('0xed'));}else{if(_0x4c7ad1[_0x3856('0xe2')]>=_0x12f990[_0x3856('0xee')]){_0x34dfaf[_0x3856('0xef')](_0x4c7ad1,_0x5275a9,_0x117d3f,_0x3856('0xf0'));}else{_0x34dfaf[_0x3856('0xb4')]({'active':![],'countmachineretry':_0x4c7ad1[_0x3856('0xe2')],'scheduledat':moment()['add'](_0x12f990[_0x3856('0xf1')],_0x3856('0xf2'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c7ad1[_0x3856('0xc7')],'ListId':_0x4c7ad1['ListId'],'VoiceQueueId':_0x4c7ad1[_0x3856('0xca')]||undefined,'CampaignId':_0x4c7ad1[_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x5275a9({'reschedule':0x1});}}});}if(_0x2ed96b['type']===_0x3856('0xa7')&&this[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0xd7')]&&_0x43f1e6['value']==='HANGUP'){delete this['uniqueId'][_0x43f1e6[_0x3856('0xd9')]];this[_0x3856('0xa8')](this['campaigns'][_0x2ed96b[_0x3856('0xa9')]]);_0x319b50=new Hangup(_0x2ed96b,_0x43f1e6);_0x319b50[_0x3856('0x9e')]=0x12;_0x319b50['statedesc']=_0x3856('0xdb');_0x319b50[_0x3856('0xe1')]=_0x3856('0xdc');this[_0x3856('0xc5')](_0x319b50,'[syncHangupInAMDIvr][createHistory]',_0x3856('0xf3'));}if(_0x2ed96b[_0x3856('0x4b')]==='ivr'&&this[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0xd7')]&&_0x43f1e6[_0x3856('0xd8')]==='MACHINE'){var _0x34dfaf=this;return new BPromise(function(_0x320f88,_0x1cc1a3){delete _0x34dfaf[_0x3856('0x26')][_0x43f1e6[_0x3856('0xd9')]];_0x34dfaf[_0x3856('0xa8')](_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]]);_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]]['outboundAnswerCallsDay']+=0x1;_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]][_0x3856('0x5c')]+=0x1;var _0x228251=_0x34dfaf[_0x3856('0x1f')][_0x2ed96b[_0x3856('0xa9')]];var _0x569293=new Hangup(_0x2ed96b,_0x43f1e6);_0x569293[_0x3856('0x9e')]=0x13;_0x569293[_0x3856('0xda')]=_0x3856('0xe0');_0x569293[_0x3856('0xe1')]='AMD';_0x569293[_0x3856('0xe2')]+=0x1;_0x569293[_0x3856('0xe3')]+=0x1;_0x569293[_0x3856('0xe4')]=!![];_0x34dfaf[_0x3856('0xbe')](_0x569293)[_0x3856('0xad')](loggerCatch(_0x3856('0xe5')));if(_0x569293['countbusyretry']+_0x569293[_0x3856('0xe7')]+_0x569293[_0x3856('0xe8')]+_0x569293[_0x3856('0xe9')]+_0x569293['countdropretry']+_0x569293[_0x3856('0xf4')]+_0x569293['countmachineretry']+_0x569293[_0x3856('0xeb')]>=_0x228251[_0x3856('0xec')]){_0x34dfaf[_0x3856('0xf5')](_0x569293,_0x320f88,_0x1cc1a3,_0x3856('0xed'));}else{if(_0x569293['countmachineretry']>=_0x228251[_0x3856('0xee')]){_0x34dfaf[_0x3856('0xef')](_0x569293,_0x320f88,_0x1cc1a3,_0x3856('0xf0'));}else{_0x34dfaf[_0x3856('0xb4')]({'active':![],'countmachineretry':_0x569293[_0x3856('0xe2')],'scheduledat':moment()[_0x3856('0xf6')](_0x228251[_0x3856('0xf1')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x569293[_0x3856('0xc7')],'ListId':_0x569293['ListId'],'VoiceQueueId':_0x569293[_0x3856('0xca')]||undefined,'CampaignId':_0x569293[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0xf8')));_0x320f88({'reschedule':0x1});}}});}}};Dialer[_0x3856('0xa1')][_0x3856('0x32')]=function(_0x20cfc3){var _0x2ef860=this[_0x3856('0x26')][_0x20cfc3[_0x3856('0xd9')]];var _0x3da3c9=this;var _0x52d747;if(_0x2ef860&&_0x2ef860[_0x3856('0x4b')]===_0x3856('0xa7')){delete this[_0x3856('0x26')][_0x20cfc3[_0x3856('0xd9')]];this[_0x3856('0xa8')](this[_0x3856('0x1f')][_0x2ef860[_0x3856('0xa9')]]);this[_0x3856('0x1f')][_0x2ef860['queue']][_0x3856('0xf9')]+=0x1;_0x52d747=new Hangup(_0x2ef860,_0x20cfc3);this['createHistory'](_0x52d747)['catch'](loggerCatch(_0x3856('0xfa')));this['moveContactManagedDialer'](_0x52d747)['catch'](loggerCatch(_0x3856('0xfb')));}if(_0x2ef860&&_0x2ef860[_0x3856('0x4b')]!==_0x3856('0xa7')&&isNotNull(this[_0x3856('0x1e')][_0x2ef860[_0x3856('0xa9')]][_0x3856('0xfc')])){delete this[_0x3856('0x26')][_0x20cfc3[_0x3856('0xd9')]];this[_0x3856('0xa8')](this['voiceQueues'][_0x2ef860[_0x3856('0xa9')]]);this['voiceQueues'][_0x2ef860['queue']][_0x3856('0x5d')]+=0x1;this['voiceQueues'][_0x2ef860[_0x3856('0xa9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x52d747=new Hangup(_0x2ef860,_0x20cfc3);_0x52d747[_0x3856('0x9e')]=0x10;_0x52d747['statedesc']=_0x3856('0xfd');_0x52d747[_0x3856('0xe1')]=_0x3856('0xfe');this['createHistory'](_0x52d747)[_0x3856('0xad')](loggerCatch(_0x3856('0xfa')));this['moveContactManagedDialer'](_0x52d747)[_0x3856('0xad')](loggerCatch('[syncHangupIvr]'));}if(_0x2ef860&&_0x2ef860[_0x3856('0x4b')]!==_0x3856('0xa7')&&!isNotNull(this[_0x3856('0x1e')][_0x2ef860[_0x3856('0xa9')]][_0x3856('0xfc')])){delete this['uniqueId'][_0x20cfc3[_0x3856('0xd9')]];this[_0x3856('0xa8')](this[_0x3856('0x1e')][_0x2ef860[_0x3856('0xa9')]]);this['voiceQueues'][_0x2ef860[_0x3856('0xa9')]][_0x3856('0x66')]+=0x1;_0x52d747=new Hangup(_0x2ef860,_0x20cfc3);_0x52d747[_0x3856('0x9e')]=0xc;_0x52d747[_0x3856('0xda')]=_0x20cfc3['cause-txt'];_0x52d747[_0x3856('0xe1')]='Unknow';this['createHistory'](_0x52d747)[_0x3856('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3856('0xbd')](_0x52d747)['catch'](loggerCatch(_0x3856('0xfb')));}};Dialer[_0x3856('0xa1')][_0x3856('0x30')]=function(_0x1ef470){var _0x34aa8a=this[_0x3856('0x26')][_0x1ef470[_0x3856('0xd9')]];var _0x10d483=this;if(this[_0x3856('0x1e')][_0x1ef470[_0x3856('0xa9')]]){if(_0x34aa8a&&_0x34aa8a[_0x3856('0x4b')]!==_0x3856('0xa7')){delete this[_0x3856('0x26')][_0x1ef470[_0x3856('0xd9')]];this[_0x3856('0x1e')][_0x1ef470[_0x3856('0xa9')]][_0x3856('0x5d')]+=0x1;var _0x23030c=new AgentComplete(_0x34aa8a,_0x1ef470);if(_0x1ef470['reason']==='agent'){_0x23030c['agiafterat']=this[_0x3856('0x1e')][_0x1ef470[_0x3856('0xa9')]]['dialQueueProject2']&&this['voiceQueues'][_0x1ef470[_0x3856('0xa9')]][_0x3856('0xff')]?moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x23030c)['catch'](loggerCatch(_0x3856('0x100')));this[_0x3856('0xbd')](_0x23030c)[_0x3856('0xad')](loggerCatch(_0x3856('0x101')));}}};Dialer[_0x3856('0xa1')][_0x3856('0x102')]=function(_0x1c16f1){if(this['voiceQueues'][_0x1c16f1[_0x3856('0xa9')]]){if(this[_0x3856('0x26')][_0x1c16f1[_0x3856('0xd9')]]&&this[_0x3856('0x26')][_0x1c16f1['uniqueid']][_0x3856('0x4b')]!==_0x3856('0xa7')){this[_0x3856('0xa8')](this[_0x3856('0x1e')][_0x1c16f1[_0x3856('0xa9')]]);this[_0x3856('0x26')][_0x1c16f1[_0x3856('0xd9')]][_0x3856('0x103')]=moment()[_0x3856('0x77')](_0x3856('0xf7'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x45a5e5){this[_0x3856('0xbe')](_0x45a5e5)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x3856('0xbd')](_0x45a5e5)[_0x3856('0xad')](loggerCatch(_0x3856('0x104')));};Dialer[_0x3856('0xa1')][_0x3856('0x105')]=function(_0xdb90e5){var _0x460f56=this[_0x3856('0x26')][_0xdb90e5[_0x3856('0xd9')]];var _0xb63834=this;if(this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]]){if(_0x460f56&&_0x460f56['type']!=='ivr'){delete this[_0x3856('0x26')][_0xdb90e5['uniqueid']];this[_0x3856('0xa8')](this[_0x3856('0x1e')][_0xdb90e5['queue']]);_0x460f56[_0x3856('0x106')]=moment()['format'](_0x3856('0xf7'));var _0x2c87ce=new QueueCallerAbandon(_0x460f56,_0xdb90e5);if(getSeconds(_0x460f56['droptime'],_0x460f56['responsetime'])>=_0x460f56['dialQueueTimeout']){this[_0x3856('0x1e')][_0xdb90e5['queue']][_0x3856('0x107')]+=0x1;this['voiceQueues'][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x61')]+=0x1;this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x108')]+=0x1;_0x2c87ce[_0x3856('0x9e')]=0xa;_0x2c87ce[_0x3856('0xda')]=_0x3856('0x109');_0x2c87ce['dropreason']=_0x3856('0x10a');_0x2c87ce[_0x3856('0x10b')]=this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]]['dialQueueProject2']?moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2c87ce[_0x3856('0xea')]+=0x1;_0x2c87ce[_0x3856('0xe3')]+=0x1;if(_0x2c87ce[_0x3856('0xea')]>=this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x10c')]){this[_0x3856('0x10d')](_0x2c87ce);}else{this[_0x3856('0xb4')]({'active':![],'countdropretry':_0x2c87ce[_0x3856('0xea')],'scheduledat':moment()[_0x3856('0xf6')](this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x10e')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x460f56[_0x3856('0xc7')],'ListId':_0x460f56['ListId'],'VoiceQueueId':_0x460f56[_0x3856('0xca')]||undefined,'CampaignId':_0x460f56[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x10f')));var _0x5dbade=new History(_0x2c87ce);_0x5dbade[_0x3856('0x9e')]=0xa;_0x5dbade[_0x3856('0xda')]='Drop';_0x5dbade[_0x3856('0x110')]=moment()['format'](_0x3856('0xf7'));_0x5dbade[_0x3856('0x111')]=_0x5dbade[_0x3856('0x110')];_0x5dbade[_0x3856('0x112')]=_0x2c87ce[_0x3856('0x112')];_0x5dbade[_0x3856('0x113')]=_0x2c87ce[_0x3856('0x113')];this[_0x3856('0xbe')](_0x5dbade)[_0x3856('0xad')](loggerCatch(_0x3856('0x114')));}}else{this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x69')]+=0x1;this[_0x3856('0x1e')][_0xdb90e5['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x2c87ce['state']=0xb;_0x2c87ce[_0x3856('0xda')]='Abandoned';_0x2c87ce['dropreason']=_0x3856('0x115');_0x2c87ce[_0x3856('0xf4')]+=0x1;_0x2c87ce[_0x3856('0xe3')]+=0x1;if(_0x2c87ce[_0x3856('0xf4')]>=this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x116')]){this[_0x3856('0x10d')](_0x2c87ce);}else{this[_0x3856('0xb4')]({'active':![],'countabandonedretry':_0x2c87ce['countabandonedretry'],'scheduledat':moment()[_0x3856('0xf6')](this[_0x3856('0x1e')][_0xdb90e5[_0x3856('0xa9')]][_0x3856('0x117')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x460f56[_0x3856('0xc7')],'ListId':_0x460f56[_0x3856('0xc8')],'VoiceQueueId':_0x460f56[_0x3856('0xca')]||undefined,'CampaignId':_0x460f56[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x118')));var _0x5dbade=new History(_0x2c87ce);_0x5dbade['state']=0xb;_0x5dbade[_0x3856('0xda')]=_0x3856('0x119');_0x5dbade[_0x3856('0x110')]=moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dbade['endtime']=_0x5dbade[_0x3856('0x110')];_0x5dbade[_0x3856('0x112')]=_0x2c87ce[_0x3856('0x112')];_0x5dbade['calleridnum']=_0x2c87ce[_0x3856('0x113')];this[_0x3856('0xbe')](_0x5dbade)[_0x3856('0xad')](loggerCatch(_0x3856('0x11a')));}}}}};Dialer['prototype'][_0x3856('0x11b')]=function(_0x15ebf3){if(this[_0x3856('0x24')][_0x15ebf3[_0x3856('0xd9')]]){this['actions'][_0x15ebf3['uniqueid']][_0x3856('0xa5')]=_0x15ebf3['channel'];}if(this[_0x3856('0x26')][_0x15ebf3[_0x3856('0xd9')]]){this[_0x3856('0x26')][_0x15ebf3[_0x3856('0xd9')]]['channel']=_0x15ebf3[_0x3856('0xa5')];}};Dialer['prototype'][_0x3856('0x35')]=function(_0x58763d){if(strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]['queue']][_0x3856('0x4d')]]===_0x3856('0x19')){if(this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]&&_[_0x3856('0xd2')](this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]['locked'])&&_0x58763d['status']==='1'&&_0x58763d[_0x3856('0x11d')]==='0'){if(this['agents'][_0x58763d[_0x3856('0x11e')]]){if(!this[_0x3856('0x20')][_0x58763d[_0x3856('0x11e')]][_0x3856('0x11f')]){this[_0x3856('0x20')][_0x58763d['stateinterface']][_0x3856('0x11f')]=!![];this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]][_0x3856('0x11f')]=!![];this[_0x3856('0x24')][_0x58763d['actionid']][_0x3856('0x11e')]=_0x58763d['stateinterface'];}}}}else if((strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x58763d['actionid']][_0x3856('0xa9')]][_0x3856('0x4d')]]||_0x3856('0x18'))===_0x3856('0x18')){if(this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]]){if(this[_0x3856('0x20')][_0x58763d['stateinterface']]){this['actions'][_0x58763d[_0x3856('0x11c')]]['stateinterface']=_0x58763d[_0x3856('0x11e')];if(_[_0x3856('0xd2')](this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x58763d['actionid']]['queue']])){this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]][_0x3856('0xa9')]]=[];}this[_0x3856('0x2a')][this['actions'][_0x58763d[_0x3856('0x11c')]][_0x3856('0xa9')]][_0x3856('0x120')](_[_0x3856('0x88')](_[_0x3856('0xc6')](this[_0x3856('0x24')][_0x58763d[_0x3856('0x11c')]],[_0x3856('0x121'),_0x3856('0x11e')]),{'status':_0x58763d[_0x3856('0xa4')],'paused':_0x58763d[_0x3856('0x11d')]}));}}}};function unlockQueueStatus(_0x2da965,_0x2b110a){setTimeout(function(){if(_['isUndefined'](_0x2da965['queueStatusComplete'])){loggerBooked[_0x3856('0x8e')]('[unlockQueueStatus][undefined]',_0x2b110a);}_0x2da965[_0x3856('0x122')]=!![];loggerBooked[_0x3856('0x7a')](_0x3856('0x123'),_0x2b110a,JSON[_0x3856('0x48')](_[_0x3856('0xc6')](_0x2da965,['name',_0x3856('0x122')])));},0x1f3);}Dialer[_0x3856('0xa1')][_0x3856('0x37')]=function(_0x316c43){var _0x5e8f0e=this;var _0x1ca7a6=_0x5e8f0e[_0x3856('0x1e')][_0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['queue']];if(strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x316c43['actionid']][_0x3856('0xa9')]][_0x3856('0x4d')]]===_0x3856('0x19')){if(this[_0x3856('0x24')][_0x316c43['actionid']]&&this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['stateinterface']){this[_0x3856('0x1d')]['run'](this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['idHopper'],this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0x11e')])[_0x3856('0xad')](function(_0x449ea3){logger[_0x3856('0x8e')](_0x3856('0x124'),util[_0x3856('0x8f')](_0x449ea3,{'showHidden':![],'depth':null}));})[_0x3856('0x1b')](function(){_0x5e8f0e[_0x3856('0xa8')](_0x5e8f0e[_0x3856('0x1e')][_0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]);_0x5e8f0e[_0x3856('0x20')][_0x5e8f0e['actions'][_0x316c43[_0x3856('0x11c')]][_0x3856('0x11e')]][_0x3856('0x11f')]=![];delete _0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]];unlockQueueStatus(_0x1ca7a6);});}else{this[_0x3856('0xa8')](this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]);this[_0x3856('0xb4')]({'active':![],'ContactId':this['actions'][_0x316c43[_0x3856('0x11c')]][_0x3856('0xc7')],'ListId':this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xc8')],'VoiceQueueId':this['actions'][_0x316c43[_0x3856('0x11c')]][_0x3856('0xca')]||undefined,'CampaignId':this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]];unlockQueueStatus(_0x1ca7a6);}}else if((strategy[this[_0x3856('0x1e')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]][_0x3856('0x4d')]]||'rrmemory')===_0x3856('0x18')){var _0x51c102;if(this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]&&!_[_0x3856('0x45')](this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]])){if(this['queueBookedRR'][_0x5e8f0e[_0x3856('0x24')][_0x316c43['actionid']][_0x3856('0xa9')]]){this[_0x3856('0x2b')][_0x5e8f0e[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['queue']]=this['queueBookedRR'][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]?this[_0x3856('0x2b')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]:this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x316c43['actionid']][_0x3856('0xa9')]]?this[_0x3856('0x2a')][this['actions'][_0x316c43['actionid']][_0x3856('0xa9')]]['_rr']||0x0:0x0;}this[_0x3856('0x2a')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]][_0x3856('0xa9')]]['_rr']=this[_0x3856('0x2b')][this[_0x3856('0x24')][_0x316c43[_0x3856('0x11c')]]['queue']];for(var _0x54715c=0x0;_0x54715c=0x0;})[_0x3856('0xad')](myreject(_0x46fe00)));}}else{_0x4b6f13[_0x3856('0x120')](ami[_0x3856('0xa3')]({'action':_0x3856('0x139'),'command':util['format']('iftime\x20%s,%s',_0x4f179f,!_[_0x3856('0x3a')](config[_0x3856('0x137')][_0x52108c])?_0x52108c:'')})[_0x3856('0xaf')](function(_0x25fb95){return _0x25fb95[_0x3856('0x13c')][_0x3856('0x13d')](_0x3856('0x13e'))>=0x0;})[_0x3856('0xad')](myreject(_0x46fe00)));}BPromise['all'](_0x4b6f13)[_0x3856('0xaf')](function(_0x5aba35){var _0x5e0ae5=_[_0x3856('0x13f')](_0x5aba35);if(_0x5e0ae5){return _0x934911(_0x5e0ae5);}else{_0x3e8a22['message']=_0x127fbc?_0x3856('0x140'):_0x3856('0x141');return _0x46fe00(msgResponse(_0x3856('0x142'),_0x3856('0x134'),'Global:\x20'+_0x127fbc+'\x20'+_0x5c921a+_0x3856('0x143')+util[_0x3856('0x8f')](_0x4f179f,{'showHidden':![],'depth':null})+_0x3856('0x144')+_0x52108c));}})[_0x3856('0xad')](function(_0x4b2ed8){return _0x46fe00(msgResponse(_0x3856('0x133'),_0x3856('0x134'),JSON[_0x3856('0x48')](_0x4b2ed8)));});});};Dialer['prototype'][_0x3856('0x145')]=function(_0x4489e0){var _0x337b26=this;return function(){switch(_0x4489e0[_0x3856('0x58')]){case _0x3856('0x146'):freeVariablesPredictive(_0x4489e0);_0x337b26['handlePower'](_0x4489e0,0x1);break;case _0x3856('0x147'):freeVariablesPredictive(_0x4489e0);_0x337b26[_0x3856('0x148')](_0x4489e0,_0x4489e0['dialPowerLevel']);break;case'predictive':_0x337b26[_0x3856('0xa')](_0x4489e0);break;case _0x3856('0x9'):freeVariablesPredictive(_0x4489e0);_0x337b26[_0x3856('0x148')](_0x4489e0,0x1);break;default:freeVariablesPredictive(_0x4489e0);logger['error'](_0x3856('0x149'),_0x4489e0[_0x3856('0x3d')],'method\x20not\x20recognized');}};};Dialer[_0x3856('0xa1')][_0x3856('0x14a')]=function(_0x34ec05){var _0x180a87=this;return function(){_0x180a87['handleIvr'](_0x34ec05);};};Dialer['prototype'][_0x3856('0xb')]=function(_0x111ba9){var _0x44a04c=this;if(isNotPreview(_0x111ba9[_0x3856('0x58')])){if(isVoiceQueueOutbound(_0x111ba9['type'])&&isActive(_0x111ba9[_0x3856('0x57')])){_0x111ba9[_0x3856('0x97')]=!![];BPromise[_0x3856('0xac')]()['then'](checkIsLoggedIn(_0x111ba9,_0x111ba9[_0x3856('0x4f')]))[_0x3856('0xaf')](checkIsActive(_0x111ba9,_0x111ba9[_0x3856('0x57')]))['then'](checkInterval(_0x111ba9))[_0x3856('0xaf')](_0x44a04c[_0x3856('0x12e')](_0x111ba9))[_0x3856('0xaf')](_0x44a04c['checkIfTime'](_0x111ba9[_0x3856('0x14b')],_0x111ba9[_0x3856('0x14c')],_0x111ba9['name'],_0x111ba9))[_0x3856('0xaf')](_0x44a04c['checkIfTimeIntervals'](_0x111ba9[_0x3856('0x41')],_0x111ba9[_0x3856('0x14c')],_0x111ba9[_0x3856('0x3d')],_0x111ba9))[_0x3856('0xaf')](_0x44a04c[_0x3856('0x145')](_0x111ba9))[_0x3856('0xad')](loggerCatchQueueSummary(_0x3856('0x14d'),_0x111ba9));}else{notSendMessagesQueue(_0x111ba9);}}else{freeVariablesPredictive(_0x111ba9);}};Dialer['prototype'][_0x3856('0x12d')]=function(){var _0x369503=this;var _0x232a05;for(var _0x507395 in this['campaigns']){if(typeof this[_0x3856('0x1f')][_0x507395]!==_0x3856('0xa2')){_0x232a05=this[_0x3856('0x1f')][_0x507395];if(isCampaignIvr(_0x232a05[_0x3856('0x4b')])&&isActive(_0x232a05[_0x3856('0x74')])){_0x232a05[_0x3856('0x97')]=!![];BPromise[_0x3856('0xac')]()[_0x3856('0xaf')](checkIsActive(_0x232a05,_0x232a05[_0x3856('0x74')]))['then'](checkInterval(_0x232a05))[_0x3856('0xaf')](_0x369503[_0x3856('0x12e')](_0x232a05))[_0x3856('0xaf')](_0x369503[_0x3856('0x132')](_0x232a05['dialGlobalInterval'],_0x232a05[_0x3856('0x14c')],_0x232a05[_0x3856('0x3d')],_0x232a05))[_0x3856('0xaf')](_0x369503[_0x3856('0x14e')](_0x232a05[_0x3856('0x41')],_0x232a05['dialTimezone'],_0x232a05['name'],_0x232a05))['then'](_0x369503[_0x3856('0x14a')](_0x232a05))[_0x3856('0xad')](loggerCatchQueueSummary(_0x3856('0x14f'),_0x232a05));}else{notSendMessagesCampaign(_0x232a05);}}}};function getCallerIdRandom(_0x1153e3,_0x56cd29){var _0x2d2787;var _0x386e40;var _0x1edff1;if(_0x56cd29<=0x0){_0x56cd29=0x1;}_0x2d2787=new RegExp(_0x3856('0x150')+_0x56cd29+'}$');_0x386e40=Math[_0x3856('0x151')](0xa,_0x56cd29-0x1);_0x1edff1=Math[_0x3856('0x151')](0xa,_0x56cd29)-0x1;return util[_0x3856('0x77')]('%s',_[_0x3856('0x152')](_0x1153e3,_0x2d2787,_[_0x3856('0x153')](_0x386e40,_0x1edff1)));}function extractCalleridName(_0x4ffa4c){var _0x488788=_0x4ffa4c[_0x3856('0x154')](/"(.*?)"/);return _0x488788?_0x488788[0x1]:_0x4ffa4c;}function extractCalleridNumber(_0x35fe27){var _0x5b0fd3=_0x35fe27[_0x3856('0x154')](/<(.*?)>/);return _0x5b0fd3?_0x5b0fd3[0x1]:_0x35fe27;}Dialer[_0x3856('0xa1')][_0x3856('0x155')]=function(_0x3cbf12,_0x555f53){var _0x43962f=this;var _0xfddbeb=uuid['v4']();this[_0x3856('0x24')][_0xfddbeb]=new Action(_0x3cbf12,_0x555f53,_0xfddbeb);return new BPromise(function(_0x40731e,_0x2736a4){if(_['isUndefined'](_0x3cbf12)&&typeof _0x3cbf12!==_0x3856('0x156')){return _0x2736a4(msgResponse(_0x3856('0x157'),_0x3856('0x134'),_0x3856('0x158')));}if(_['isUndefined'](_0x555f53['Contact']['phone'])||_0x555f53[_0x3856('0x159')][_0x3856('0x15a')]===null){return _0x2736a4(msgResponse('originate',_0x3856('0x134'),_0x3856('0x15b')));}var _0x523bd5={'XMD-CALLERID':_0x43962f[_0x3856('0x24')][_0xfddbeb][_0x3856('0x15c')](),'XMD-AGI':_0x3cbf12[_0x3856('0xfc')]?util['format'](_0x3856('0x15d'),ipAgi,_0x3cbf12[_0x3856('0xfc')]):_0x3856('0x15e'),'XMD-AGIAFTER':_0x3cbf12[_0x3856('0x15f')]?util['format'](_0x3856('0x15d'),ipAgi,_0x3cbf12[_0x3856('0x15f')]):_0x3856('0x15e'),'XMD-QUEUE':_0x3cbf12['type']==='outbound'?util[_0x3856('0x77')](_0x3856('0x160'),_0x3cbf12[_0x3856('0x3d')],_0x3cbf12[_0x3856('0x161')]||'',_0x3cbf12[_0x3856('0xff')]?'c':'',_0x3cbf12[_0x3856('0x162')]||0x3):_0x3856('0x15e'),'XMD-CONTACTID':_0x555f53[_0x3856('0xc7')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x43962f[_0x3856('0x24')][_0xfddbeb][_0x3856('0x15c')](),'XMD-AMD':_0x3cbf12[_0x3856('0xd7')]?_0x3856('0x163'):_0x3856('0x15e'),'XMD-DESTINATION':_0x3856('0xd6')};if(_0x3cbf12['dialAMDActive']){_0x523bd5[_0x3856('0x164')]=_0x3cbf12[_0x3856('0x165')]||0x9c4;_0x523bd5[_0x3856('0x166')]=_0x3cbf12[_0x3856('0x167')]||0x5dc;_0x523bd5[_0x3856('0x168')]=_0x3cbf12[_0x3856('0x169')]||0x320;_0x523bd5['XMD-AMDTOTALANALYSISTIME']=_0x3cbf12[_0x3856('0x16a')]||0x1388;_0x523bd5[_0x3856('0x16b')]=_0x3cbf12[_0x3856('0x16c')]||0x64;_0x523bd5[_0x3856('0x16d')]=_0x3cbf12[_0x3856('0x16e')]||0x32;_0x523bd5[_0x3856('0x16f')]=_0x3cbf12[_0x3856('0x170')]||0x3;_0x523bd5[_0x3856('0x171')]=_0x3cbf12[_0x3856('0x172')]||0x100;_0x523bd5[_0x3856('0x173')]=_0x3cbf12[_0x3856('0x174')]||0x1388;}if(_0x3cbf12['type']==='outbound'){_0x523bd5[_0x3856('0x175')]=_0x555f53[_0x3856('0xca')];}else{_0x523bd5[_0x3856('0x176')]=_0x555f53[_0x3856('0xcb')];}for(var _0x493e40 in _0x555f53[_0x3856('0x159')]){if(typeof _0x555f53[_0x3856('0x159')][_0x493e40]!=='undefined'){if(isNotNull(_0x555f53['Contact'][_0x493e40])&&_0x493e40!=='id'&&_0x493e40!==_0x3856('0x177')&&_0x493e40!=='createdAt'&&_0x493e40!==_0x3856('0x178')){_0x523bd5[util[_0x3856('0x77')](_0x3856('0x179'),_0x3856('0x17a'),_[_0x3856('0x17b')](_0x493e40))]=_0x555f53[_0x3856('0x159')][_0x493e40];}}}var _0x58a0c6=_0x43962f[_0x3856('0xcf')](_0x3cbf12[_0x3856('0x73')])?getCallerId(_0x3cbf12[_0x3856('0x73')][_0x3856('0x75')],_0x3cbf12[_0x3856('0x59')],_0x3cbf12['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3cbf12['dialOriginateCallerIdNumber'],_0x3cbf12['dialRandomLastDigitCallerIdNumber']):_0x3cbf12[_0x3856('0x5a')]):getCallerId(_[_0x3856('0xd2')](_0x3cbf12['TrunkBackup'])?_0x3cbf12[_0x3856('0x73')][_0x3856('0x75')]:_0x3cbf12[_0x3856('0x12f')][_0x3856('0x75')],_0x3cbf12['dialOriginateCallerIdName'],_0x3cbf12[_0x3856('0x17c')]>0x0?getCallerIdRandom(_0x3cbf12[_0x3856('0x5a')],_0x3cbf12[_0x3856('0x17c')]):_0x3cbf12[_0x3856('0x5a')]);if(_0x58a0c6){_0x523bd5[_0x3856('0x17d')]=_0x43962f[_0x3856('0x24')][_0xfddbeb]['originatecalleridname']=extractCalleridName(_0x58a0c6);_0x523bd5[_0x3856('0x17e')]=_0x43962f[_0x3856('0x24')][_0xfddbeb][_0x3856('0x17f')]=extractCalleridNumber(_0x58a0c6);}return ami[_0x3856('0xa3')]({'actionid':_0xfddbeb,'action':'originate','channel':_0x43962f[_0x3856('0xcf')](_0x3cbf12[_0x3856('0x73')])?util[_0x3856('0x77')](_0x3856('0x180'),_0x3cbf12[_0x3856('0x73')][_0x3856('0x3d')],isNotNull(_0x3cbf12[_0x3856('0x5b')])?_0x3cbf12['dialPrefix']['trim']()||'':'',_0x3cbf12[_0x3856('0x181')]>0x0?_0x555f53[_0x3856('0x159')][_0x3856('0x15a')]['substring'](_0x3cbf12[_0x3856('0x181')]):_0x555f53[_0x3856('0x159')][_0x3856('0x15a')]):util[_0x3856('0x77')](_0x3856('0x180'),_['isNil'](_0x3cbf12[_0x3856('0x12f')])?_0x3cbf12[_0x3856('0x73')][_0x3856('0x3d')]:_0x3cbf12[_0x3856('0x12f')][_0x3856('0x3d')],isNotNull(_0x3cbf12[_0x3856('0x5b')])?_0x3cbf12[_0x3856('0x5b')][_0x3856('0x182')]()||'':'',_0x3cbf12[_0x3856('0x181')]>0x0?_0x555f53['Contact']['phone'][_0x3856('0x183')](_0x3cbf12[_0x3856('0x181')]):_0x555f53['Contact']['phone']),'callerid':_0x58a0c6,'Exten':_0x3856('0xd6'),'Context':'from-sip','Priority':'1','variable':_0x523bd5,'timeout':(_0x3cbf12['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xfddbeb})[_0x3856('0xaf')](function(_0x239c96){return _0x40731e(_0x239c96);})['catch'](function(_0x491e21){_0x3cbf12[_0x3856('0x63')]+=0x1;var _0x468f32=new History(_0x43962f['actions'][_0xfddbeb]);logger['error'](util[_0x3856('0x77')]('[originateError]:\x20%s',JSON['stringify'](_0x491e21)));_0x468f32[_0x3856('0x9e')]=0xe;_0x468f32[_0x3856('0xda')]=_0x3856('0x184');_0x468f32[_0x3856('0x110')]=moment()[_0x3856('0x77')](_0x3856('0xf7'));_0x468f32[_0x3856('0x111')]=_0x468f32[_0x3856('0x110')];_0x43962f['createHistory'](_0x468f32)[_0x3856('0xad')](loggerCatch(_0x3856('0x185')));_0x43962f[_0x3856('0xbd')](_0x468f32)['catch'](loggerCatch('[originate][error]'))[_0x3856('0x1b')](function(){delete _0x43962f[_0x3856('0x24')][_0xfddbeb];return _0x2736a4(msgResponse(_0x3856('0x157'),_0x3856('0x47'),_0x3856('0x186')));});});});};Dialer[_0x3856('0xa1')][_0x3856('0x2e')]=function(_0x3cd670){var _0x2d1002=this['actions'][_0x3cd670[_0x3856('0x11c')]];if(_0x2d1002){delete this['actions'][_0x3cd670['actionid']];_0x2d1002[_0x3856('0x187')]=moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1c544a=_0x2d1002[_0x3856('0x4b')]==='ivr'?this[_0x3856('0x1f')][_0x2d1002[_0x3856('0xa9')]]:this['voiceQueues'][_0x2d1002[_0x3856('0x188')]()];if(!this[_0x3856('0xcd')](_0x3cd670[_0x3856('0x189')])){this[_0x3856('0xa8')](_0x1c544a);return this['callProgressDetecting'](_0x2d1002,_0x1c544a,_0x3cd670)['catch'](loggerCatch(_0x3856('0x18a')));}this[_0x3856('0x26')][_0x3cd670[_0x3856('0xd9')]]=_0x2d1002;}};Dialer[_0x3856('0xa1')][_0x3856('0x18b')]=function(_0x41fe50,_0x560ab1,_0x3634f1){var _0x588fba=new History(_0x560ab1);if(_0x588fba[_0x3856('0xe6')]+_0x588fba[_0x3856('0xe7')]+_0x588fba[_0x3856('0xe8')]+_0x588fba[_0x3856('0xe9')]+_0x588fba[_0x3856('0xea')]+_0x588fba[_0x3856('0xf4')]+_0x588fba['countmachineretry']+_0x588fba[_0x3856('0xeb')]>=_0x3634f1[_0x3856('0xec')]-0x1){return!![];}switch(_0x41fe50){case 0x3:if(_0x588fba['countnoanswerretry']>=_0x3634f1[_0x3856('0x18c')]-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countnoanswerretry':_0x588fba[_0x3856('0xe8')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1['dialNoAnswerRetryFrequency'],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x18d')));break;case 0x5:if(_0x588fba['countbusyretry']>=_0x3634f1['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x588fba[_0x3856('0xe6')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1[_0x3856('0x18e')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x18f')));break;case 0x8:if(_0x588fba[_0x3856('0xe7')]>=_0x3634f1['dialCongestionMaxRetry']-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countcongestionretry':_0x588fba[_0x3856('0xe7')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1[_0x3856('0x190')],_0x3856('0xf2'))[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x588fba['countnosuchnumberretry']>=_0x3634f1[_0x3856('0x191')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x588fba[_0x3856('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x3634f1[_0x3856('0x192')],'minutes')['format'](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x193')));}break;case 0xa:if(_0x588fba['countdropretry']>=_0x3634f1[_0x3856('0x10c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x588fba['countdropretry']+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1['dialDropRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x10f')));break;case 0xb:if(_0x588fba[_0x3856('0xf4')]>=_0x3634f1[_0x3856('0x116')]-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countabandonedretry':_0x588fba[_0x3856('0xf4')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1[_0x3856('0x117')],_0x3856('0xf2'))['format'](_0x3856('0xf7')),'ContactId':_0x588fba['ContactId'],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x118')));break;case 0x13:if(_0x588fba[_0x3856('0xe2')]>=_0x3634f1[_0x3856('0xee')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x588fba[_0x3856('0xe2')]+=0x1,'scheduledat':moment()['add'](_0x3634f1[_0x3856('0xf1')],'minutes')[_0x3856('0x77')](_0x3856('0xf7')),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba[_0x3856('0xc8')],'VoiceQueueId':_0x588fba[_0x3856('0xca')]||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x588fba['countagentrejectretry']>=_0x3634f1[_0x3856('0x194')]-0x1){return!![];}this[_0x3856('0xb4')]({'active':![],'countagentrejectretry':_0x588fba[_0x3856('0xeb')]+=0x1,'scheduledat':moment()[_0x3856('0xf6')](_0x3634f1['dialAgentRejectRetryFrequency'],_0x3856('0xf2'))[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x588fba[_0x3856('0xc7')],'ListId':_0x588fba['ListId'],'VoiceQueueId':_0x588fba['VoiceQueueId']||undefined,'CampaignId':_0x588fba[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x195')));break;default:return!![];}};Dialer['prototype'][_0x3856('0x196')]=function(_0x5afc3a,_0x160779,_0xa70cda){var _0x2f67cf=this;var _0x2f6294=new History(_0x5afc3a);return new BPromise(function(_0x33aeb7,_0x3dbc15){if(_[_0x3856('0x3a')](_0x160779)&&typeof _0x160779!==_0x3856('0x156')){return _0x3dbc15(msgResponse('[callProgressDetecting]',_0x3856('0x134'),_0x3856('0x197')));}if(_[_0x3856('0x3a')](_0xa70cda)&&typeof _0xa70cda!==_0x3856('0x156')){return _0x3dbc15(msgResponse('[callProgressDetecting]',_0x3856('0x134'),_0x3856('0x198')));}switch(_0xa70cda[_0x3856('0x199')]){case'0':_0x160779[_0x3856('0x19a')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x0;_0x2f6294[_0x3856('0xda')]=_0x3856('0x19b');_0x2f6294['countnosuchnumberretry']+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami[_0x3856('0x19c')](_0x3856('0x19d'),ut[_0x3856('0x19e')](_0x5afc3a,'nosuchnumber'));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0xe5')));if(_0x2f67cf[_0x3856('0x18b')](0x0,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe9')]>=_0x160779[_0x3856('0x191')]){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x19f'));}else{_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x19f'));}}break;case'3':_0x160779[_0x3856('0x62')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x3;_0x2f6294['statedesc']='NoAnswer';_0x2f6294[_0x3856('0xe8')]+=0x1;_0x2f6294['countglobal']+=0x1;ami[_0x3856('0x19c')](_0x3856('0x1a0'),ut[_0x3856('0x19e')](_0x5afc3a,_0x3856('0x1a1')));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2f67cf[_0x3856('0x18b')](0x3,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe8')]>=_0x160779['dialNoAnswerMaxRetry']){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a2'));}else{_0x2f67cf[_0x3856('0xf5')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a2'));}}break;case'5':_0x160779[_0x3856('0x5e')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x5;_0x2f6294[_0x3856('0xda')]=_0x3856('0x1a3');_0x2f6294[_0x3856('0xe6')]+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami['emit'](_0x3856('0x1a4'),ut[_0x3856('0x19e')](_0x5afc3a,'busy'));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2f67cf['checkRetriveMax'](0x5,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe6')]>=_0x160779['dialBusyMaxRetry']){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a5'));}else{_0x2f67cf[_0x3856('0xf5')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1a5'));}}break;case'8':_0x160779[_0x3856('0x1a6')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x8;_0x2f6294[_0x3856('0xda')]=_0x3856('0x1a7');_0x2f6294['countcongestionretry']+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami['emit'](_0x3856('0x1a8'),ut[_0x3856('0x19e')](_0x5afc3a,_0x3856('0x1a9')));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0x1aa')));if(_0x2f67cf[_0x3856('0x18b')](0x8,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xe7')]>=_0x160779[_0x3856('0x1ab')]){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1ac'));}else{_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1ac'));}}break;case'11':_0x160779[_0x3856('0x1ad')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0xb;_0x2f6294['statedesc']='Abandoned';_0x2f6294['countabandonedretry']+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0x11a')));if(_0x2f67cf[_0x3856('0x18b')](0xb,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xf4')]>=_0x160779[_0x3856('0x116')]){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,'reason\x2011\x20abandoned');}else{_0x2f67cf[_0x3856('0xf5')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1ae'));}}break;case'20':_0x160779[_0x3856('0x65')]+=0x1;_0x2f6294[_0x3856('0x9e')]=0x14;_0x2f6294[_0x3856('0xda')]=_0x3856('0x1af');_0x2f6294[_0x3856('0xeb')]+=0x1;_0x2f6294[_0x3856('0xe3')]+=0x1;ami['emit'](_0x3856('0x1b0'),ut[_0x3856('0x19e')](_0x5afc3a,_0x3856('0x1b1')));_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2f67cf['checkRetriveMax'](0x14,_0x5afc3a,_0x160779)){if(_0x2f6294[_0x3856('0xeb')]>=_0x160779['dialAgentRejectMaxRetry']){_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,'reason\x2020\x20agentreject');}else{_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0x3856('0x1b2'));}}break;default:_0x160779['outboundUnknownCallsDay']+=0x1;_0x2f6294[_0x3856('0x9e')]=0xc;_0x2f6294['statedesc']=_0xa70cda[_0x3856('0x199')];_0x2f67cf[_0x3856('0xbe')](_0x2f6294)[_0x3856('0xad')](loggerCatch(_0x3856('0x1b3')));if(_0x2f67cf['checkRetriveMax'](_0xa70cda[_0x3856('0x199')],_0x5afc3a,_0x160779)){if(_0x2f6294['countbusyretry']+_0x2f6294[_0x3856('0xe7')]+_0x2f6294[_0x3856('0xe8')]+_0x2f6294[_0x3856('0xe9')]+_0x2f6294[_0x3856('0xea')]+_0x2f6294['countabandonedretry']+_0x2f6294[_0x3856('0xe2')]+_0x2f6294[_0x3856('0xeb')]>=_0x160779[_0x3856('0xec')]){_0x2f67cf['stateGlobal'](_0x2f6294,_0x33aeb7,_0x3dbc15,_0xa70cda[_0x3856('0x199')]);}else{_0x2f67cf[_0x3856('0xef')](_0x2f6294,_0x33aeb7,_0x3dbc15,_0xa70cda[_0x3856('0x199')]);}}}});};Dialer[_0x3856('0xa1')]['stateGlobal']=function(_0x1a8d17,_0x49ac92,_0x59092f,_0x3f84a8){var _0x5ca7a7=new Final(_0x1a8d17);_0x5ca7a7['state']=0xf;_0x5ca7a7[_0x3856('0xda')]=_0x3856('0x1b4');this[_0x3856('0xef')](_0x5ca7a7,_0x49ac92,_0x59092f,_0x3f84a8);};Dialer[_0x3856('0xa1')][_0x3856('0xef')]=function(_0x160a4a,_0x4783ea,_0x33b407,_0x4d8ca0){this[_0x3856('0xbd')](_0x160a4a)[_0x3856('0xaf')](function(){return _0x4783ea(msgResponse(_0x3856('0x1b5'),_0x3856('0xce'),_0x4d8ca0));})['catch'](function(){return _0x33b407(msgResponse(_0x3856('0x1b6'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0x3856('0xa')]=function(_0x1dde63){var _0x538730=_0x1dde63[_0x3856('0x1b7')]/0x64;var _0x48bc33=_0x1dde63[_0x3856('0x61')]/(_0x1dde63['outboundDropCallsDayTimeout']+_0x1dde63[_0x3856('0x5d')]);var _0x46be83=Math[_0x3856('0x1b8')](_0x1dde63['predictiveIntervalAvailable']*(_0x1dde63[_0x3856('0x1b9')]/0x64));var _0x5934cd=Math[_0x3856('0x1b8')](_0x1dde63[_0x3856('0x6e')]*(_0x1dde63['predictiveIntervalMinThreshold']/0x64));var _0x22324b=_0x1dde63['available']+_0x1dde63[_0x3856('0x53')];var _0x421b0e=Math['floor'](_0x1dde63[_0x3856('0x84')]*_0x1dde63[_0x3856('0x72')]*_0x1dde63[_0x3856('0x6b')]*_0x1dde63['predictiveIntervalMultiplicativeFactor']);if(_[_0x3856('0x3a')](_0x1dde63['startProgressive'])){if(!_[_0x3856('0x3a')](_0x1dde63[_0x3856('0x27')])){_0x1dde63[_0x3856('0x27')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x3856('0x1ba'));}if(!_['isUndefined'](_0x1dde63['handlePredictive'])){loggerPredictive[_0x3856('0x8e')](_0x3856('0x1bb'),_0x3856('0x1bc'));clearInterval(_0x1dde63[_0x3856('0x89')]);_0x1dde63['handlePredictive']=undefined;}_0x1dde63[_0x3856('0x28')]=moment()[_0x3856('0x77')](_0x3856('0xf7'));loggerPredictive[_0x3856('0x7a')](_0x1dde63['name'],'collection\x20data\x20in\x20progressive\x20at',_0x1dde63['startProgressive']);this[_0x3856('0x148')](_0x1dde63,0x1);}else if(ifInterval(_0x1dde63[_0x3856('0x1bd')],_0x1dde63[_0x3856('0x28')])){this[_0x3856('0x148')](_0x1dde63,0x1);loggerPredictiveCalls['info'](_0x3856('0x1be'),_0x1dde63[_0x3856('0x28')],_0x1dde63['name']);_0x1dde63[_0x3856('0x84')]=0x0;_0x1dde63[_0x3856('0x108')]=0x0;}else if(_0x538730<_0x48bc33&&_0x1dde63[_0x3856('0x1bf')]==='dropRate'){freeVariablesPredictive(_0x1dde63);loggerPredictive['info'](_0x3856('0x1c0'),'Dropped\x20calls\x20day',_0x48bc33,_0x3856('0x28'),_0x1dde63[_0x3856('0x3d')]);}else if(_0x421b0e<_0x1dde63[_0x3856('0x108')]&&_0x1dde63['dialPredictiveOptimization']===_0x3856('0x1c1')){freeVariablesPredictive(_0x1dde63);loggerPredictive[_0x3856('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x3856('0x1c2'),_0x421b0e,_0x3856('0x1c3'),_0x1dde63['predictiveIntervalErlangCallsDroppedCalls'],_0x3856('0x28'),_0x1dde63[_0x3856('0x3d')]);}else if(!ifInterval(_0x1dde63[_0x3856('0x1bd')],_0x1dde63['startProgressive'])&&_[_0x3856('0x3a')](_0x1dde63[_0x3856('0x27')])&&!_[_0x3856('0x3a')](_0x1dde63[_0x3856('0x28')])){_0x1dde63['startPredictive']=moment()['format'](_0x3856('0xf7'));loggerPredictive[_0x3856('0x7a')](_0x1dde63[_0x3856('0x3d')],'started\x20in\x20predictive\x20at',_0x1dde63[_0x3856('0x27')]);this['averageHandleTime'](_0x1dde63[_0x3856('0x1bd')])[_0x3856('0xaf')](this['getDataPredictive'](_0x1dde63))[_0x3856('0xaf')](mergeDataErlangB(_0x1dde63))[_0x3856('0xaf')](this['startMethodPredictive'](_0x1dde63))['catch'](loggerCatchPredictive(_0x3856('0x1c4'),_0x1dde63));}else if(!ifInterval(_0x1dde63[_0x3856('0x1bd')],_0x1dde63[_0x3856('0x27')])){_0x1dde63[_0x3856('0x108')]=0x0;_0x1dde63[_0x3856('0x27')]=moment()[_0x3856('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3856('0x7a')](_0x1dde63['name'],'recalculate\x20predictive\x20at',_0x1dde63['startPredictive']);clearInterval(_0x1dde63[_0x3856('0x89')]);_0x1dde63[_0x3856('0x89')]=undefined;this[_0x3856('0xb1')](_0x1dde63[_0x3856('0x1bd')])['then'](this[_0x3856('0x1c5')](_0x1dde63))[_0x3856('0xaf')](mergeDataErlangB(_0x1dde63))[_0x3856('0xaf')](this[_0x3856('0x1c6')](_0x1dde63))[_0x3856('0xad')](loggerCatchPredictive(_0x3856('0x1c7'),_0x1dde63));}else if(_0x1dde63[_0x3856('0x6e')]&&_0x22324b<_0x1dde63['predictiveIntervalAvailable']-_0x5934cd){freeVariablesPredictive(_0x1dde63);loggerPredictive['info'](_0x1dde63[_0x3856('0x3d')],_0x3856('0x1c8'),_0x22324b,_0x3856('0x1c9'),_0x1dde63['predictiveIntervalAvailable'],'-',_0x5934cd,'=',_0x1dde63[_0x3856('0x6e')]-_0x5934cd,')');}else if(_0x1dde63[_0x3856('0x6e')]&&_0x22324b>_0x1dde63['predictiveIntervalAvailable']+_0x46be83){freeVariablesPredictive(_0x1dde63);loggerPredictive[_0x3856('0x7a')](_0x1dde63[_0x3856('0x3d')],_0x3856('0x1c8'),_0x22324b,_0x3856('0x1ca'),_0x1dde63['predictiveIntervalAvailable'],'+',_0x46be83,'=',_0x1dde63[_0x3856('0x6e')]+_0x46be83,')');}};Dialer[_0x3856('0xa1')][_0x3856('0x1c5')]=function(_0x3d9a02){var _0x5b84c1=this;return function(_0x501d96){return new BPromise(function(_0xc14a6a,_0x59b2a3){_['merge'](_0x3d9a02,_0x501d96[0x0]);if(checkGetDataPredictive(_0x501d96[0x0])){var _0x22dd9a=_0x3d9a02[_0x3856('0x6e')]=_0x3d9a02[_0x3856('0x53')]+_0x3d9a02[_0x3856('0x98')];var _0x486232=_0x3d9a02[_0x3856('0x1bd')]*0x3c;var _0x3302cb=_0x501d96[0x0]['predictiveIntervalAvgTalktime']+_0x501d96[0x0]['predictiveIntervalAvgHoldtime'];var _0x5584c3=(_0x501d96[0x0]['predictiveIntervalAnsweredCalls']+_0x501d96[0x0][_0x3856('0x107')]+_0x501d96[0x0][_0x3856('0x69')])/_0x501d96[0x0][_0x3856('0x6f')];_0x3d9a02[_0x3856('0x6b')]=_0x5584c3>0x0?_0x5584c3:0x1;switch(_0x3d9a02[_0x3856('0x1bf')]){case _0x3856('0x1c1'):var _0x3daf1d=_0x3d9a02[_0x3856('0x1b7')]/0x64;return _0x5b84c1[_0x3856('0x1cb')](_0x22dd9a,_0x486232,_0x3302cb,_0x5584c3,_0x3daf1d)['then'](function(_0x53909e){return _0xc14a6a(_0x53909e);});case _0x3856('0x1cc'):var _0x288a16=_0x3d9a02['dialPredictiveOptimizationPercentage']/0x64;return _0x5b84c1[_0x3856('0x1cd')](_0x22dd9a,_0x486232,_0x3302cb,_0x5584c3,_0x288a16)[_0x3856('0xaf')](function(_0xa4b15){return _0xc14a6a(_0xa4b15);});default:return _0x59b2a3(msgResponse(_0x3856('0x1ce'),_0x3856('0x134'),_0x3856('0x1cf')));}}else{return _0x59b2a3(msgResponse(_0x3856('0x1ce'),_0x3856('0x134'),_0x3856('0x1d0')));}});};};Dialer[_0x3856('0xa1')]['getDataPredictiveOld']=function(_0x56668d){var _0xbff33e=this;return function(_0x141a3a){return new BPromise(function(_0x2f23e8,_0x33b4a1){_[_0x3856('0x88')](_0x56668d,_0x141a3a[0x0]);if(checkGetDataPredictive(_0x141a3a[0x0])){loggerPredictive['info'](JSON[_0x3856('0x48')](_0x141a3a[0x0]));if(_0x56668d[_0x3856('0x1bf')]===_0x3856('0x1c1')){return _0xbff33e[_0x3856('0xbb')](_0x56668d['id'])['then'](function(_0x30f21e){var _0x11c0d1=_0x56668d[_0x3856('0x4f')]-_0x30f21e[0x0][_0x3856('0x1d1')];var _0x2ac03d=_0x56668d[_0x3856('0x1bd')]*0x3c;var _0x42e9aa=_0x141a3a[0x0][_0x3856('0x68')]+_0x141a3a[0x0]['predictiveIntervalAvgHoldtime'];var _0x252cb0=(_0x141a3a[0x0][_0x3856('0x7c')]+_0x141a3a[0x0][_0x3856('0x107')]+_0x141a3a[0x0][_0x3856('0x69')])/_0x141a3a[0x0][_0x3856('0x6f')];var _0x5caf95=_0x56668d[_0x3856('0x1b7')]/0x64;_0x56668d['predictiveIntervalPauses']=_0x30f21e[0x0][_0x3856('0x1d1')]||0x0;_0x56668d['predictiveIntervalHitRate']=_0x252cb0>0x0?_0x252cb0:0x1;return _0xbff33e[_0x3856('0x1cb')](_0x11c0d1,_0x2ac03d,_0x42e9aa,_0x252cb0,_0x5caf95);})[_0x3856('0xaf')](function(_0x442b3d){return _0x2f23e8(_0x442b3d);})[_0x3856('0xad')](function(_0x1f4ce9){return _0x33b4a1(msgResponse(_0x3856('0x1d2'),'Failure',JSON[_0x3856('0x48')](_0x1f4ce9)));});}if(_0x56668d[_0x3856('0x1bf')]===_0x3856('0x1cc')){return _0xbff33e[_0x3856('0xbb')](_0x56668d['id'])['then'](function(_0x4091b2){var _0x279f69=_0x56668d['loggedIn']-_0x4091b2[0x0][_0x3856('0x1d1')];var _0x338c15=_0x56668d[_0x3856('0x1bd')]*0x3c;var _0x589e34=_0x141a3a[0x0][_0x3856('0x68')]+_0x141a3a[0x0][_0x3856('0x67')];var _0x468071=(_0x141a3a[0x0]['predictiveIntervalAnsweredCalls']+_0x141a3a[0x0][_0x3856('0x107')]+_0x141a3a[0x0][_0x3856('0x69')])/_0x141a3a[0x0][_0x3856('0x6f')];var _0x3ed27c=_0x56668d[_0x3856('0x1b7')]/0x64;_0x56668d[_0x3856('0x6d')]=_0x4091b2[0x0]['outboundQueuePauses']||0x0;_0x56668d[_0x3856('0x6b')]=_0x468071>0x0?_0x468071:0x1;return _0xbff33e['busyFactor'](_0x279f69,_0x338c15,_0x589e34,_0x468071,_0x3ed27c);})[_0x3856('0xaf')](function(_0x27841b){return _0x2f23e8(_0x27841b);})[_0x3856('0xad')](function(_0x1e420c){return _0x33b4a1(msgResponse('[CatchErlangB]',_0x3856('0x134'),JSON['stringify'](_0x1e420c)));});}}else{return _0x33b4a1(msgResponse(_0x3856('0x1ce'),_0x3856('0x134'),_0x3856('0x1d0')));}});};};Dialer[_0x3856('0xa1')][_0x3856('0x1c6')]=function(_0xdb1231){var _0x1c3c7f=this;return function(){var _0x521084=0x0;var _0x596b95=Math['floor'](_0xdb1231[_0x3856('0x71')]*0x3e8);if(_0x596b95>0x0){_0x596b95=_0x596b95<0x64?0x64:_0x596b95;loggerPredictive[_0x3856('0x7a')](_0xdb1231[_0x3856('0x3d')],'one\x20call\x20every:',_0x596b95,_0x3856('0x49'));_0xdb1231['handlePredictive']=setInterval(function(){_0x1c3c7f[_0x3856('0x89')](_0xdb1231);loggerPredictiveCalls['info']('[handlePredictive]',_0x521084+=0x1);},_0x596b95);}else{loggerPredictive[_0x3856('0x7a')](_0xdb1231[_0x3856('0x3d')],_0x3856('0x1d3'));}};};Dialer[_0x3856('0xa1')][_0x3856('0x1d4')]=function(_0x468a77,_0x4e214e){var _0x332a7c=this;return function(_0xecf191){if(_[_0x3856('0x45')](_0xecf191)){if(_[_0x3856('0xd2')](_0x4e214e[_0x3856('0xc9')])||!_0x4e214e[_0x3856('0x1d5')]){if(_0x468a77[_0x3856('0x58')]==='booked'){_0x468a77[_0x3856('0x122')]=_[_0x3856('0x3a')](_0x468a77[_0x3856('0x122')])?!![]:_0x468a77['queueStatusComplete'];var _0x1eda2f=uuid['v4']();_0x332a7c[_0x3856('0x24')][_0x1eda2f]=new Action(_0x468a77,_0x4e214e,_0x1eda2f);loggerBooked[_0x3856('0x7a')](_0x3856('0x1d6'),_0x1eda2f,_0x3856('0x1d7'),JSON[_0x3856('0x48')](_0x468a77[_0x3856('0x122')]),_0x3856('0x1d8'),_0x468a77[_0x3856('0x3d')]);if(_0x468a77[_0x3856('0x122')]){_0x468a77[_0x3856('0x122')]=![];_0x332a7c[_0x3856('0x2a')][_0x332a7c['actions'][_0x1eda2f][_0x3856('0xa9')]]=[];ami[_0x3856('0xa3')]({'actionid':_0x1eda2f,'action':'queuestatus','queue':_0x468a77['name']})[_0x3856('0xad')](function(){_0x332a7c[_0x3856('0xa8')](_0x468a77);_0x332a7c[_0x3856('0xb4')]({'active':![],'ContactId':_0x332a7c[_0x3856('0x24')][_0x1eda2f][_0x3856('0xc7')],'ListId':_0x332a7c['actions'][_0x1eda2f][_0x3856('0xc8')],'VoiceQueueId':_0x332a7c['actions'][_0x1eda2f]['VoiceQueueId']||undefined,'CampaignId':_0x332a7c[_0x3856('0x24')][_0x1eda2f][_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x332a7c[_0x3856('0x24')][_0x1eda2f];});}else{loggerBooked[_0x3856('0x7a')]('[booked][checkContactBlack][else]',JSON[_0x3856('0x48')](_0x468a77['queueStatusComplete']),_0x3856('0x1d8'),_0x468a77[_0x3856('0x3d')]);_0x332a7c[_0x3856('0xa8')](_0x468a77);_0x332a7c['rescheduleContact']({'active':![],'ContactId':_0x332a7c['actions'][_0x1eda2f][_0x3856('0xc7')],'ListId':_0x332a7c[_0x3856('0x24')][_0x1eda2f][_0x3856('0xc8')],'VoiceQueueId':_0x332a7c['actions'][_0x1eda2f][_0x3856('0xca')]||undefined,'CampaignId':_0x332a7c[_0x3856('0x24')][_0x1eda2f]['CampaignId']||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x1d9')));delete _0x332a7c[_0x3856('0x24')][_0x1eda2f];}}else{return _0x332a7c[_0x3856('0x155')](_0x468a77,_0x4e214e);}}else{if(getDiff(_0x4e214e[_0x3856('0x1da')])<_0x468a77[_0x3856('0x1db')]*0x3c){if(_0x4e214e[_0x3856('0x1dc')]&&!_0x4e214e[_0x3856('0x1dc')]['voicePause']){_0x332a7c[_0x3856('0x1d')][_0x3856('0x12b')](_0x4e214e['id'])[_0x3856('0x1b')](function(){_0x332a7c[_0x3856('0xa8')](_0x468a77);});}else{_0x332a7c[_0x3856('0xb6')]({'active':![]},_0x4e214e['id'],0x1)[_0x3856('0x1b')](function(){_0x332a7c[_0x3856('0xa8')](_0x468a77);});}}else{_0x468a77['outboundReCallsDay']+=0x1;_0x332a7c[_0x3856('0xa8')](_0x468a77);if(_0x468a77[_0x3856('0x1dd')]){_0x332a7c[_0x3856('0xb4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e214e['ContactId'],'ListId':_0x4e214e[_0x3856('0xc8')],'VoiceQueueId':_0x4e214e[_0x3856('0xca')]||undefined,'CampaignId':_0x4e214e[_0x3856('0xcb')]||undefined})[_0x3856('0xad')](loggerCatch(_0x3856('0x1de')));_0x332a7c[_0x3856('0xbe')](createObjHistory(_0x468a77,_0x4e214e,'RECALLINQUEUE',0x17,_0x3856('0x1df')))['catch'](loggerCatch(_0x3856('0x1e0')));}else{_0x332a7c[_0x3856('0xc5')](createObjHistory(_0x468a77,_0x4e214e,'RECALLFAILEDTIMEOUT',0x16,_0x3856('0x1e1')),'[Originate][HistoryRecallClose][historyCatch]',_0x3856('0x1e2'));}}}}else{_0x468a77[_0x3856('0x1e3')]+=0x1;_0x332a7c[_0x3856('0xc5')](createObjHistory(_0x468a77,_0x4e214e,'BLACKLIST',0xd,_0x3856('0x1e4')),_0x3856('0x1e5'),_0x3856('0x1e6'));throw _0x3856('0x1e7');}};};Dialer['prototype'][_0x3856('0x1e8')]=function(_0x3e441f){var _0x506a47=this;var _0x4698c3=_0x3e441f['limitCalls']-_0x3e441f[_0x3856('0x70')]-_0x3e441f[_0x3856('0x1e9')];emitCampaignSummary(_0x3e441f);if(_0x4698c3>0x0){if(_0x4698c3>this[_0x3856('0x22')]){_0x4698c3=this[_0x3856('0x22')];}_0x3e441f[_0x3856('0x1e9')]+=_0x4698c3;this[_0x3856('0xba')](_0x3e441f['id'],_0x4698c3,_0x3e441f['dialOrderByScheduledAt'])[_0x3856('0xaf')](function(_0x31a82b){_0x3e441f['temp']-=_0x4698c3;_0x3e441f[_0x3856('0x1e9')]=_0x3e441f['temp']>0x0?_0x3e441f['temp']:0x0;if(!checkContactEmpty(_0x31a82b)){_0x3e441f['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x3856('0x1ea')+_0x3e441f[_0x3856('0x3d')]);}else{_0x3e441f[_0x3856('0x70')]+=_0x31a82b[_0x3856('0x125')];_0x3e441f[_0x3856('0x3b')]='RUNNING';for(var _0x475c93=0x0;_0x475c93<_0x31a82b[_0x3856('0x125')];_0x475c93+=0x1){_0x3e441f[_0x3856('0x1eb')]+=0x1;if(_['isNil'](_0x31a82b[_0x475c93])||_[_0x3856('0xd2')](_0x31a82b[_0x475c93][_0x3856('0x159')])||_[_0x3856('0xd2')](_0x31a82b[_0x475c93]['Contact'][_0x3856('0x15a')])){_0x506a47['emptyContact']('[actionOriginate]\x20',_0x3e441f,_0x31a82b[_0x475c93]);}else{_0x506a47[_0x3856('0x1ec')](_[_0x3856('0xc6')](_0x31a82b[_0x475c93],[_0x3856('0xcb'),_0x3856('0x1ed')]))[_0x3856('0xaf')](_0x506a47['checkContactBlack'](_0x3e441f,_0x31a82b[_0x475c93]))[_0x3856('0xad')](_0x506a47[_0x3856('0xc2')]('[actionOriginateIvr]\x20',_0x3e441f));}}}})[_0x3856('0xad')](loggerGetContactDialer(_0x3856('0x1ee'),_0x3e441f,_0x4698c3));}};Dialer[_0x3856('0xa1')]['handlePower']=function(_0x5b629e,_0x700a6d){var _0x365099=this;var _0x3151a2=[];var _0x4ce706=_0x700a6d>=0x1?_0x700a6d:0x1;if(_0x5b629e[_0x3856('0x58')]===_0x3856('0x9')){_0x4ce706=0x1;}var _0x23c38d=Math[_0x3856('0x1ef')](_0x5b629e['available']*_0x4ce706)-_0x5b629e[_0x3856('0x70')]-_0x5b629e['temp'];emitVoiceQueueSummary(_0x5b629e);if(_0x5b629e[_0x3856('0x1f0')]>0x0){var _0x10c781=_0x5b629e[_0x3856('0x1f0')]-_0x5b629e['originated']-_0x5b629e[_0x3856('0x53')]-_0x5b629e[_0x3856('0x1e9')]-_0x5b629e[_0x3856('0x50')];if(_0x23c38d>_0x10c781){_0x23c38d=_0x10c781;}}if(_0x23c38d>0x0){if(_0x5b629e[_0x3856('0x58')]===_0x3856('0x9')){_0x23c38d=0x1;}if(_0x23c38d>this[_0x3856('0x22')]){_0x23c38d=this[_0x3856('0x22')];}_0x5b629e['temp']+=_0x23c38d;for(var _0x2a889c in this[_0x3856('0x20')]){if(typeof this[_0x3856('0x20')][_0x2a889c]!==_0x3856('0xa2')){if(this[_0x3856('0x20')][_0x2a889c][_0x3856('0x9e')]===_0x3856('0x1f1')&&this[_0x3856('0x20')][_0x2a889c]['status']===_0x3856('0x1f2')){_0x3151a2['push'](this['agents'][_0x2a889c]['id']);}}}this[_0x3856('0xb8')](_0x5b629e['id'],_0x3151a2,_0x23c38d,_0x5b629e[_0x3856('0x1f3')])[_0x3856('0xaf')](function(_0x222bee){_0x5b629e['temp']-=_0x23c38d;_0x5b629e[_0x3856('0x1e9')]=_0x5b629e[_0x3856('0x1e9')]>0x0?_0x5b629e[_0x3856('0x1e9')]:0x0;if(!checkContactEmpty(_0x222bee)){_0x365099[_0x3856('0xab')](_0x5b629e)[_0x3856('0xaf')](sendMessageReschedule(_0x5b629e))[_0x3856('0xad')](loggerCatch(_0x3856('0x1f4')));}else{_0x5b629e[_0x3856('0x70')]+=_0x222bee[_0x3856('0x125')];_0x5b629e[_0x3856('0x3b')]=_0x5b629e['dialMethod']===_0x3856('0x9')?_0x3856('0x163'):_0x3856('0x1f5');for(var _0x18c3c3=0x0;_0x18c3c3<_0x222bee[_0x3856('0x125')];_0x18c3c3+=0x1){if(_['isNil'](_0x222bee[_0x18c3c3])||_['isNil'](_0x222bee[_0x18c3c3][_0x3856('0x159')])||_['isNil'](_0x222bee[_0x18c3c3][_0x3856('0x159')][_0x3856('0x15a')])){_0x365099[_0x3856('0xc3')](_0x3856('0x1f6'),_0x5b629e,_0x222bee[_0x18c3c3]);}else{_0x365099[_0x3856('0xae')](_['pick'](_0x222bee[_0x18c3c3],[_0x3856('0xca'),_0x3856('0x1ed')]))['then'](_0x365099[_0x3856('0x1d4')](_0x5b629e,_0x222bee[_0x18c3c3]))[_0x3856('0xad')](_0x365099['loggerHandler'](_0x3856('0x1f6'),_0x5b629e));}}}})[_0x3856('0xad')](loggerGetContactDialer('[getContactDialer2]',_0x5b629e,_0x23c38d));}};Dialer['prototype']['handlePredictive']=function(_0x47f13f){if(_0x47f13f['dialLimitQueue']>0x0){var _0x579cdf=_0x47f13f[_0x3856('0x1f0')]-_0x47f13f['originated']-_0x47f13f['talking'];if(_0x579cdf>0x0){this[_0x3856('0x1f7')](_0x47f13f);}else{loggerPredictiveCalls[_0x3856('0x7a')](_0x3856('0x1f8'));}}else{this[_0x3856('0x1f7')](_0x47f13f);}};Dialer[_0x3856('0xa1')]['tryOriginatePredictive']=function(_0x2adc4a){var _0x4fc9de=this;var _0x157518=[];_0x2adc4a['originated']+=0x1;for(var _0x3704f0 in this['agents']){if(typeof this['agents'][_0x3704f0]!=='undefined'){if(this[_0x3856('0x20')][_0x3704f0][_0x3856('0x9e')]===_0x3856('0x1f1')&&this[_0x3856('0x20')][_0x3704f0][_0x3856('0xa4')]===_0x3856('0x1f2')){_0x157518[_0x3856('0x120')](this['agents'][_0x3704f0]['id']);}}}this[_0x3856('0xb8')](_0x2adc4a['id'],_0x157518,0x1,_0x2adc4a[_0x3856('0x1f3')])[_0x3856('0xaf')](function(_0x19e337){if(!checkContactEmpty(_0x19e337)){checkContactLowerLimitOriginate(_0x2adc4a,0x1,0x0);_0x4fc9de[_0x3856('0xab')](_0x2adc4a)[_0x3856('0xaf')](sendMessageReschedule(_0x2adc4a))[_0x3856('0xad')](loggerCatch(_0x3856('0x1f4')));}else{_0x2adc4a[_0x3856('0x3b')]=_0x3856('0x1f5');if(_[_0x3856('0xd2')](_0x19e337[0x0])||_[_0x3856('0xd2')](_0x19e337[0x0]['Contact'])||_[_0x3856('0xd2')](_0x19e337[0x0][_0x3856('0x159')][_0x3856('0x15a')])){_0x4fc9de[_0x3856('0xc3')](_0x3856('0x1f6'),_0x2adc4a,_0x19e337[0x0]);}else{_0x4fc9de['checkIsBlackList'](_[_0x3856('0xc6')](_0x19e337[0x0],[_0x3856('0xca'),'Contact.phone']))['then'](_0x4fc9de['checkContactBlack'](_0x2adc4a,_0x19e337[0x0]))[_0x3856('0xad')](_0x4fc9de[_0x3856('0xc2')](_0x3856('0x1f9'),_0x2adc4a));}}})[_0x3856('0xad')](loggerGetContactDialer(_0x3856('0x1fa'),_0x2adc4a,0x1));emitVoiceQueueSummary(_0x2adc4a);};Dialer[_0x3856('0xa1')][_0x3856('0x1cb')]=function(_0x50bc88,_0x8d7af5,_0x20e27e,_0x260a77,_0x2e4895,_0xa00c81){loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fb'));loggerPredictive['info'](_0x3856('0x1fc'),_0x50bc88);loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fd'),_0x8d7af5);loggerPredictive[_0x3856('0x7a')]('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',_0x20e27e);loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fe'),_0x260a77);loggerPredictive[_0x3856('0x7a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e4895);loggerPredictive['info'](_0x3856('0x80'));return new BPromise(function(_0x3e4800,_0x344f47){if(_0x50bc88<=0x0||isNaN(_0x50bc88)){return _0x344f47(msgResponse(_0x3856('0x1ff'),_0x3856('0x47'),'m\x20=\x20'+_0x50bc88));}if(_0x20e27e<=0x0||isNaN(_0x20e27e)){return _0x344f47(msgResponse(_0x3856('0x1ff'),_0x3856('0x47'),_0x3856('0x200')+_0x20e27e));}if(_0x260a77<=0x0||isNaN(_0x260a77)){return _0x344f47(msgResponse(_0x3856('0x1ff'),_0x3856('0x47'),_0x3856('0x201')+_0x260a77));}if(_0x8d7af5<=0x0||isNaN(_0x8d7af5)){return _0x344f47(msgResponse('[abandonmentRate]',_0x3856('0x47'),'interval\x20=\x20'+_0x8d7af5));}if(_0x2e4895<=0x0||isNaN(_0x2e4895)){return _0x344f47(msgResponse('[abandonmentRate]',_0x3856('0x47'),_0x3856('0x202')+_0x2e4895));}_0xa00c81=_0xa00c81||0x0;var _0x3c865b=0x1/_0x20e27e;var _0x406be6=0x0;var _0x45db9c=0x0;var _0x42dda6=0x0;var _0xf8da6e=0x0;for(var _0x580a7e=0x0;_0x42dda6<_0x2e4895;_0x580a7e+=0x1){_0x45db9c=_0x580a7e/_0x8d7af5;_0x406be6=(_0x260a77*_0x45db9c+_0xa00c81)/_0x3c865b;_0x42dda6=erlangb(_0x406be6,_0x50bc88);_0xf8da6e=_0x406be6/_0x50bc88*(0x1-erlangb(_0x406be6,_0x50bc88));}return _0x3e4800({'erlangCalls':_0x580a7e,'erlangCallToSecond':_0x8d7af5/_0x580a7e,'erlangAbandonmentRate':_0x42dda6,'erlangBusyFactor':_0xf8da6e});});};Dialer[_0x3856('0xa1')][_0x3856('0x1cd')]=function(_0x37070f,_0x5b5627,_0x444f6d,_0x244214,_0x1f3477,_0x2a5d6b){loggerPredictive[_0x3856('0x7a')](_0x3856('0x203'));loggerPredictive['info'](_0x3856('0x1fc'),_0x37070f);loggerPredictive[_0x3856('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5627);loggerPredictive[_0x3856('0x7a')](_0x3856('0x204'),_0x444f6d);loggerPredictive[_0x3856('0x7a')](_0x3856('0x1fe'),_0x244214);loggerPredictive[_0x3856('0x7a')](_0x3856('0x205'),_0x1f3477);loggerPredictive[_0x3856('0x7a')]('---------------------------');return new BPromise(function(_0x13432d,_0x456415){if(_0x37070f<=0x0||isNaN(_0x37070f)){return _0x456415(msgResponse(_0x3856('0x206'),_0x3856('0x47'),_0x3856('0x207')+_0x37070f));}if(_0x444f6d<=0x0||isNaN(_0x444f6d)){return _0x456415(msgResponse(_0x3856('0x206'),_0x3856('0x47'),'Ts\x20=\x20'+_0x444f6d));}if(_0x244214<=0x0||isNaN(_0x244214)){return _0x456415(msgResponse(_0x3856('0x206'),'Error','p\x20=\x20'+_0x244214));}if(_0x5b5627<=0x0||isNaN(_0x5b5627)){return _0x456415(msgResponse('[busyFactor]',_0x3856('0x47'),_0x3856('0x208')+_0x5b5627));}if(_0x1f3477<=0x0||isNaN(_0x1f3477)){return _0x456415(msgResponse(_0x3856('0x206'),_0x3856('0x47'),_0x3856('0x209')+_0x1f3477));}_0x2a5d6b=_0x2a5d6b||0x0;var _0x477a36=0x1/_0x444f6d;var _0x47d34a=0x0;var _0x484543=0x0;var _0x5c553f=0x0;var _0x7c5612=0x0;for(var _0xaeffcc=0x0;_0x7c5612<_0x1f3477;_0xaeffcc+=0x1){_0x484543=_0xaeffcc/_0x5b5627;_0x47d34a=(_0x244214*_0x484543+_0x2a5d6b)/_0x477a36;_0x5c553f=erlangb(_0x47d34a,_0x37070f);_0x7c5612=_0x47d34a/_0x37070f*(0x1-erlangb(_0x47d34a,_0x37070f));}return _0x13432d({'erlangCalls':_0xaeffcc,'erlangCallToSecond':_0x5b5627/_0xaeffcc,'erlangAbandonmentRate':_0x5c553f,'erlangBusyFactor':_0x7c5612});});};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 81bb9e7..ded6399 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 _0x5699=['reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename'];(function(_0x430d2c,_0x5e62a6){var _0x3dfdb1=function(_0x18abc9){while(--_0x18abc9){_0x430d2c['push'](_0x430d2c['shift']());}};_0x3dfdb1(++_0x5e62a6);}(_0x5699,0x154));var _0x9569=function(_0x379f0c,_0x36f65f){_0x379f0c=_0x379f0c-0x0;var _0xe07df6=_0x5699[_0x379f0c];return _0xe07df6;};'use strict';var util=require('util');var _=require(_0x9569('0x0'));var moment=require(_0x9569('0x1'));function getSeconds(_0x10dae0,_0x478848){var _0x421932=moment(_0x10dae0)[_0x9569('0x2')](0x0);var _0x39c99c=moment(_0x478848)[_0x9569('0x2')](0x0);return _0x421932[_0x9569('0x3')](_0x39c99c,_0x9569('0x4'));}function QueueCallerAbandon(_0x226033,_0x5d3d5e){this[_0x9569('0x5')]=_0x226033[_0x9569('0x5')];this[_0x9569('0x6')]=_0x226033[_0x9569('0x6')];this[_0x9569('0x7')]=_0x226033['type']==='outbound'?_0x9569('0x8'):_0x226033[_0x9569('0x6')];this[_0x9569('0x9')]=_0x226033[_0x9569('0x9')];this['countcongestionretry']=_0x226033['countcongestionretry'];this[_0x9569('0xa')]=_0x226033[_0x9569('0xa')];this[_0x9569('0xb')]=_0x226033[_0x9569('0x9')]+_0x226033[_0x9569('0xc')]+_0x226033[_0x9569('0xa')]+_0x226033[_0x9569('0xd')]+_0x226033[_0x9569('0xe')]+_0x226033[_0x9569('0xf')]+_0x226033[_0x9569('0x10')]+_0x226033[_0x9569('0x11')];this['countnosuchnumberretry']=_0x226033[_0x9569('0xd')];this['countdropretry']=_0x226033['countdropretry'];this[_0x9569('0xf')]=_0x226033['countabandonedretry'];this['countmachineretry']=_0x226033['countmachineretry'];this[_0x9569('0x11')]=_0x226033[_0x9569('0x11')];this['uniqueid']=_0x5d3d5e[_0x9569('0x12')];this['calleridname']=_0x226033[_0x9569('0x13')];this[_0x9569('0x14')]=_0x226033['number'];this[_0x9569('0x15')]=_0x226033[_0x9569('0x15')];this[_0x9569('0x16')]=_0x226033[_0x9569('0x16')];this[_0x9569('0x17')]=_0x226033[_0x9569('0x17')];this['endtime']=this['droptime'];this[_0x9569('0x18')]=getSeconds(_0x226033[_0x9569('0x16')],_0x226033[_0x9569('0x15')]);this[_0x9569('0x19')]=getSeconds(this[_0x9569('0x17')],_0x226033[_0x9569('0x16')]);this[_0x9569('0x1a')]=0x0;this[_0x9569('0x8')]=_0x5d3d5e[_0x9569('0x8')];this[_0x9569('0x1b')]=_0x5d3d5e[_0x9569('0x1c')];this[_0x9569('0x1d')]=_0x5d3d5e[_0x9569('0x1d')];this[_0x9569('0x1e')]=_0x226033[_0x9569('0x1e')];this['callbackuniqueid']=_0x226033['callbackuniqueid'];this['callbackat']=_0x226033[_0x9569('0x1f')];this[_0x9569('0x20')]=_0x226033[_0x9569('0x20')];this['ContactId']=_0x226033[_0x9569('0x21')];this[_0x9569('0x22')]=_0x226033['ListId'];this[_0x9569('0x23')]=_0x226033[_0x9569('0x23')];this[_0x9569('0x24')]=_0x226033[_0x9569('0x24')];this[_0x9569('0x25')]=_0x226033[_0x9569('0x25')];this['originatecalleridnum']=_0x226033[_0x9569('0x26')]||'';this['originatecalleridname']=_0x226033[_0x9569('0x27')]||'';}module[_0x9569('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xe41c=['countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','campaigntype','type','queue'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xe41c,0x6c));var _0xce41=function(_0x166da0,_0x394844){_0x166da0=_0x166da0-0x0;var _0x5c5717=_0xe41c[_0x166da0];return _0x5c5717;};'use strict';var util=require('util');var _=require(_0xce41('0x0'));var moment=require(_0xce41('0x1'));function getSeconds(_0x24cc0e,_0x517d42){var _0xee556a=moment(_0x24cc0e)[_0xce41('0x2')](0x0);var _0x56687f=moment(_0x517d42)[_0xce41('0x2')](0x0);return _0xee556a[_0xce41('0x3')](_0x56687f,_0xce41('0x4'));}function QueueCallerAbandon(_0x308359,_0x31d277){this[_0xce41('0x5')]=_0x308359[_0xce41('0x5')];this['type']=_0x308359['type'];this[_0xce41('0x6')]=_0x308359[_0xce41('0x7')]==='outbound'?_0xce41('0x8'):_0x308359[_0xce41('0x7')];this['countbusyretry']=_0x308359[_0xce41('0x9')];this[_0xce41('0xa')]=_0x308359[_0xce41('0xa')];this['countnoanswerretry']=_0x308359[_0xce41('0xb')];this['countglobal']=_0x308359[_0xce41('0x9')]+_0x308359[_0xce41('0xa')]+_0x308359[_0xce41('0xb')]+_0x308359['countnosuchnumberretry']+_0x308359[_0xce41('0xc')]+_0x308359[_0xce41('0xd')]+_0x308359[_0xce41('0xe')]+_0x308359[_0xce41('0xf')];this[_0xce41('0x10')]=_0x308359[_0xce41('0x10')];this[_0xce41('0xc')]=_0x308359[_0xce41('0xc')];this[_0xce41('0xd')]=_0x308359[_0xce41('0xd')];this[_0xce41('0xe')]=_0x308359[_0xce41('0xe')];this[_0xce41('0xf')]=_0x308359[_0xce41('0xf')];this[_0xce41('0x11')]=_0x31d277[_0xce41('0x11')];this['calleridname']=_0x308359['name'];this[_0xce41('0x12')]=_0x308359[_0xce41('0x13')];this['starttime']=_0x308359[_0xce41('0x14')];this['responsetime']=_0x308359[_0xce41('0x15')];this['droptime']=_0x308359[_0xce41('0x16')];this[_0xce41('0x17')]=this[_0xce41('0x16')];this['ringtime']=getSeconds(_0x308359['responsetime'],_0x308359[_0xce41('0x14')]);this['holdtime']=getSeconds(this['droptime'],_0x308359[_0xce41('0x15')]);this[_0xce41('0x18')]=0x0;this[_0xce41('0x8')]=_0x31d277[_0xce41('0x8')];this['membername']=_0x31d277[_0xce41('0x19')];this[_0xce41('0x1a')]=_0x31d277[_0xce41('0x1a')];this[_0xce41('0x1b')]=_0x308359['callback'];this['callbackuniqueid']=_0x308359[_0xce41('0x1c')];this[_0xce41('0x1d')]=_0x308359[_0xce41('0x1d')];this[_0xce41('0x1e')]=_0x308359[_0xce41('0x1e')];this[_0xce41('0x1f')]=_0x308359['ContactId'];this[_0xce41('0x20')]=_0x308359[_0xce41('0x20')];this[_0xce41('0x21')]=_0x308359[_0xce41('0x21')];this[_0xce41('0x22')]=_0x308359['VoiceQueueId'];this[_0xce41('0x23')]=_0x308359[_0xce41('0x23')];this['originatecalleridnum']=_0x308359[_0xce41('0x24')]||'';this['originatecalleridname']=_0x308359[_0xce41('0x25')]||'';}module[_0xce41('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7b3cba5..d1b589b 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 _0x04ab=['localstationid','headerinfo','path','AttachmentId','util','lodash','channel','format','%s/%s/%s','tech','Trunk','fax'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x04ab,0x118));var _0xb04a=function(_0x3bae71,_0xff59b7){_0x3bae71=_0x3bae71-0x0;var _0x18c770=_0x04ab[_0x3bae71];return _0x18c770;};'use strict';var util=require(_0xb04a('0x0'));var _=require(_0xb04a('0x1'));var moment=require('moment');function Action(_0x562bc4,_0x4eafff,_0x4a3762){this['uniqueid']=_0x562bc4||undefined;this[_0xb04a('0x2')]=util[_0xb04a('0x3')](_0xb04a('0x4'),_0x4eafff[_0xb04a('0x5')],_0x4eafff[_0xb04a('0x6')]['name'],_0x4a3762[_0xb04a('0x7')]);this[_0xb04a('0x8')]=_0x4eafff['localstationid'];this[_0xb04a('0x9')]=_0x4eafff['headerinfo'];this['path']=_0x4a3762[_0xb04a('0xa')];this[_0xb04a('0xb')]=_0x4a3762[_0xb04a('0xb')];}module['exports']=Action; \ No newline at end of file +var _0xf9fd=['channel','format','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid'];(function(_0x3929f8,_0x16f421){var _0xe6a97f=function(_0x21c9a8){while(--_0x21c9a8){_0x3929f8['push'](_0x3929f8['shift']());}};_0xe6a97f(++_0x16f421);}(_0xf9fd,0xa1));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xdf9f('0x0'));var _=require(_0xdf9f('0x1'));var moment=require(_0xdf9f('0x2'));function Action(_0xc3ebc1,_0x1370be,_0x244129){this[_0xdf9f('0x3')]=_0xc3ebc1||undefined;this[_0xdf9f('0x4')]=util[_0xdf9f('0x5')](_0xdf9f('0x6'),_0x1370be[_0xdf9f('0x7')],_0x1370be['Trunk'][_0xdf9f('0x8')],_0x244129[_0xdf9f('0x9')]);this[_0xdf9f('0xa')]=_0x1370be[_0xdf9f('0xa')];this[_0xdf9f('0xb')]=_0x1370be['headerinfo'];this[_0xdf9f('0xc')]=_0x244129['path'];this[_0xdf9f('0xd')]=_0x244129['AttachmentId'];}module[_0xdf9f('0xe')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index aaf7c3a..2b00406 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 _0xe813=['operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','parse','.pdf','application/pdf','fax','catch','error','\x20notify\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','varset','syncVarSet','bind','syncNewState','newexten','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','hasOwnProperty','exten','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','actions','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus'];(function(_0x20d7cd,_0xad7628){var _0x38adaf=function(_0x10a5de){while(--_0x10a5de){_0x20d7cd['push'](_0x20d7cd['shift']());}};_0x38adaf(++_0xad7628);}(_0xe813,0x196));var _0x3e81=function(_0x4fa2da,_0x8ab535){_0x4fa2da=_0x4fa2da-0x0;var _0xd6958a=_0xe813[_0x4fa2da];return _0xd6958a;};'use strict';var util=require('util');var _=require(_0x3e81('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require(_0x3e81('0x1'));var tiff2pdf=require(_0x3e81('0x2'));var gs=require('./util/gs');var logger=require(_0x3e81('0x3'))('fax');var ami=require(_0x3e81('0x4'));var rpcDb=require(_0x3e81('0x5'));var Channel=require('./channel');var ut=require(_0x3e81('0x6'));var Action=require(_0x3e81('0x7'));var faxAccount=require(_0x3e81('0x8'));var attachment=require(_0x3e81('0x9'));var faxMessage=require(_0x3e81('0xa'));function Fax(_0x4e2450){this[_0x3e81('0xb')]={};this[_0x3e81('0xc')]=_0x4e2450['faxAccounts'];this[_0x3e81('0xd')]=_0x4e2450[_0x3e81('0xd')];this['actions']={};ami['on'](_0x3e81('0xe'),this['syncNewchannel']['bind'](this));ami['on'](_0x3e81('0xf'),this[_0x3e81('0x10')][_0x3e81('0x11')](this));ami['on']('newstate',this[_0x3e81('0x12')][_0x3e81('0x11')](this));ami['on'](_0x3e81('0x13'),this['syncNewExten'][_0x3e81('0x11')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x3e81('0x14'),this[_0x3e81('0x15')][_0x3e81('0x11')](this));ami['on'](_0x3e81('0x16'),this[_0x3e81('0x17')][_0x3e81('0x11')](this));ami['on'](_0x3e81('0x18'),this[_0x3e81('0x19')][_0x3e81('0x11')](this));}Fax['prototype']['syncNewchannel']=function(_0x271250){if(_0x271250['context']==='from-voip-provider'){for(var _0x195cd8 in this['faxAccounts']){if(this[_0x3e81('0xc')][_0x3e81('0x1a')](_0x195cd8)){if(_0x271250[_0x3e81('0x1b')]===this[_0x3e81('0xc')][_0x195cd8][_0x3e81('0x1c')]){this[_0x3e81('0xb')][_0x271250['uniqueid']]={};this[_0x3e81('0xb')][_0x271250['uniqueid']][_0x3e81('0x1d')]=_0x271250[_0x3e81('0x1d')];this[_0x3e81('0xb')][_0x271250[_0x3e81('0x1e')]]['id']=this[_0x3e81('0xc')][_0x195cd8]['id'];this[_0x3e81('0xb')][_0x271250['uniqueid']][_0x3e81('0x1f')]=this[_0x3e81('0xc')][_0x195cd8]['name'];logger[_0x3e81('0x20')](_0x271250[_0x3e81('0x1e')],_0x3e81('0x21'));}}}}if(this[_0x3e81('0x22')][_0x271250[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x271250['uniqueid']]={};this[_0x3e81('0xb')][_0x271250[_0x3e81('0x1e')]]['channel']=_0x271250['channel'];logger[_0x3e81('0x20')](_0x271250[_0x3e81('0x1e')],_0x3e81('0x21'));}};Fax[_0x3e81('0x23')][_0x3e81('0x10')]=function(_0xe3c060){if(this['channels'][_0xe3c060[_0x3e81('0x1e')]]){for(var _0x52be13 in _0xe3c060[_0x3e81('0x24')]){if(_0xe3c060[_0x3e81('0x24')][_0x3e81('0x1a')](_0x52be13)){this[_0x3e81('0xb')][_0xe3c060['uniqueid']][_0x52be13]=_0xe3c060[_0x3e81('0x25')];}}}};Fax[_0x3e81('0x23')]['syncNewState']=function(_0x1875a3){if(this[_0x3e81('0xb')][_0x1875a3[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x1875a3[_0x3e81('0x1e')]][_0x3e81('0x26')]=_0x1875a3[_0x3e81('0x26')];this[_0x3e81('0xb')][_0x1875a3[_0x3e81('0x1e')]][_0x3e81('0x27')]=_0x1875a3[_0x3e81('0x27')];}};Fax['prototype'][_0x3e81('0x28')]=function(_0x58977f){if(this[_0x3e81('0xb')][_0x58977f[_0x3e81('0x1e')]]){for(var _0x16836a in _0x58977f[_0x3e81('0x24')]){if(_0x58977f[_0x3e81('0x24')]['hasOwnProperty'](_0x16836a)){this[_0x3e81('0xb')][_0x58977f['uniqueid']][_0x16836a]=_0x58977f[_0x3e81('0x25')];}}}};Fax['prototype'][_0x3e81('0x29')]=function(_0x4fb9a4){if(this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x2a')]=_0x4fb9a4['operation'];this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x2b')]=_0x4fb9a4['status'];this[_0x3e81('0xb')][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x1c')]=_0x4fb9a4[_0x3e81('0x1c')];this['channels'][_0x4fb9a4[_0x3e81('0x1e')]][_0x3e81('0x2c')]=_0x4fb9a4[_0x3e81('0x2c')];logger[_0x3e81('0x20')](_0x4fb9a4[_0x3e81('0x1e')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x3e81('0x15')]=function(_0x44bce1){var _0x15f658=this;if(this['channels'][_0x44bce1[_0x3e81('0x1e')]]){var _0x3829ca=this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]]['id'];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x2d')]=_0x44bce1[_0x3e81('0x2d')];this[_0x3e81('0xb')][_0x44bce1['uniqueid']]['pagestransferred']=_0x44bce1[_0x3e81('0x2e')];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x1c')]=_0x44bce1[_0x3e81('0x1c')];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x2f')]=_0x44bce1['resolution'];this['channels'][_0x44bce1['uniqueid']][_0x3e81('0x30')]=_0x44bce1['transferrate'];this[_0x3e81('0xb')][_0x44bce1[_0x3e81('0x1e')]][_0x3e81('0x2c')]=_0x44bce1[_0x3e81('0x2c')];this[_0x3e81('0xb')][_0x44bce1['uniqueid']][_0x3e81('0x31')]=_0x44bce1[_0x3e81('0x31')];if(this[_0x3e81('0xb')][_0x44bce1['uniqueid']][_0x3e81('0x2e')]>0x0){tiff2pdf(_0x44bce1[_0x3e81('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x2801bb){logger[_0x3e81('0x20')](_0x44bce1[_0x3e81('0x1e')],'\x20result\x20conversion\x20file\x20',_0x2801bb[_0x3e81('0x32')]);attachment['create']({'name':path[_0x3e81('0x33')](_0x44bce1['filename'])[_0x3e81('0x1f')],'basename':path[_0x3e81('0x33')](_0x44bce1[_0x3e81('0x2c')])[_0x3e81('0x1f')]+_0x3e81('0x34'),'type':_0x3e81('0x35')})['then'](function(_0x4b379b){faxAccount['notify'](_0x3829ca,{'from':_0x44bce1[_0x3e81('0x31')],'mapKey':_0x3e81('0x36'),'body':path[_0x3e81('0x33')](_0x44bce1[_0x3e81('0x2c')])[_0x3e81('0x1f')]+_0x3e81('0x34'),'AttachmentId':_0x4b379b['id']})[_0x3e81('0x37')](function(_0xb92510){logger[_0x3e81('0x38')](_0x44bce1['uniqueid'],_0x3e81('0x39'),JSON[_0x3e81('0x3a')](_0xb92510));});})[_0x3e81('0x37')](function(_0x8edc4d){logger[_0x3e81('0x38')](_0x44bce1[_0x3e81('0x1e')],'\x20receiveFax\x20',JSON[_0x3e81('0x3a')](_0x8edc4d));});});}logger['info'](_0x44bce1[_0x3e81('0x1e')],'\x20receiveFax\x20');}};Fax[_0x3e81('0x23')][_0x3e81('0x19')]=function(_0x3b9b85){if(this[_0x3e81('0x22')][_0x3b9b85[_0x3e81('0x1e')]]){_[_0x3e81('0x3b')](this[_0x3e81('0xb')][_0x3b9b85['uniqueid']],_[_0x3e81('0x3c')](_0x3b9b85,['response',_0x3e81('0x3d')]));}};function updateStatus(_0x2b4c69){if(_0x2b4c69[_0x3e81('0x3e')]){faxMessage[_0x3e81('0x3f')](_0x2b4c69[_0x3e81('0x3e')],{'failMessage':_0x3e81('0x40')})[_0x3e81('0x41')](function(_0x40cd11){ut['logger'](_0x3e81('0x42'),_0x40cd11);})[_0x3e81('0x37')](function(_0x49843b){ut[_0x3e81('0x43')]('[Fax][Message][Error][NoUpdate1]',_0x49843b);});}else{ut['logger'](_0x3e81('0x44'));}}Fax[_0x3e81('0x23')][_0x3e81('0x45')]=function(_0x1f52bc,_0x7f99bc,_0x5db4a2){var _0x464bfe=this;var _0x367287={};if(_0x7f99bc){_0x367287={'read':_0x7f99bc};}else{_0x367287={'failMessage':_0x5db4a2};}if(this[_0x3e81('0x22')][_0x1f52bc][_0x3e81('0x3e')]){faxMessage['update'](this[_0x3e81('0x22')][_0x1f52bc][_0x3e81('0x3e')],_0x367287)[_0x3e81('0x41')](function(_0x81fea0){ut['logger'](_0x3e81('0x46'),_0x81fea0);})[_0x3e81('0x37')](function(_0x1d6d1d){ut['logger'](_0x3e81('0x47'),_0x1d6d1d);})[_0x3e81('0x48')](function(){delete _0x464bfe[_0x3e81('0xb')][_0x1f52bc];delete _0x464bfe[_0x3e81('0x22')][_0x1f52bc];});}else{ut[_0x3e81('0x43')]('[Fax][Message][NoUpdate2]');delete this[_0x3e81('0xb')][_0x1f52bc];delete this[_0x3e81('0x22')][_0x1f52bc];}};Fax[_0x3e81('0x23')][_0x3e81('0x17')]=function(_0x558cc9){var _0x499609=this;if(this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]]){if(this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]){this[_0x3e81('0xb')][_0x558cc9['uniqueid']]['id']=this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]['id'];this['channels'][_0x558cc9['uniqueid']][_0x3e81('0x1f')]=this['actions'][_0x558cc9[_0x3e81('0x1e')]][_0x3e81('0x1f')];}logger['info'](_0x558cc9[_0x3e81('0x1e')],this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]?_0x3e81('0x49'):_0x3e81('0x4a'),JSON[_0x3e81('0x3a')](this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]]));if(this[_0x3e81('0x22')][_0x558cc9[_0x3e81('0x1e')]]){if(this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]]['faxpages']>0x0&&this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]][_0x3e81('0x4b')]===_0x3e81('0x4c')){this['updateStatus'](_0x558cc9[_0x3e81('0x1e')],!![]);}else{this[_0x3e81('0x45')](_0x558cc9['uniqueid'],![],this[_0x3e81('0xb')][_0x558cc9['uniqueid']][_0x3e81('0x4d')]?_0x3e81('0x4e')+this[_0x3e81('0xb')][_0x558cc9[_0x3e81('0x1e')]][_0x3e81('0x4d')]:_0x3e81('0x4f'));}}}};Fax[_0x3e81('0x23')]['send']=function(_0x18104c){var _0x56d034=this;return new BPromise(function(_0x3cadf5,_0x2bcec0){_0x56d034[_0x3e81('0x50')](_0x18104c,_0x56d034[_0x3e81('0xc')][_0x18104c['FaxAccountId']])[_0x3e81('0x41')](function(_0x2dad76){ut[_0x3e81('0x43')]('[Fax][execOriginate][success]',_0x2dad76);_0x3cadf5(ut[_0x3e81('0x32')](_0x3e81('0x51')));})[_0x3e81('0x37')](function(_0xd9ba){ut[_0x3e81('0x43')](_0x3e81('0x52'),_0xd9ba);updateStatus(_0x18104c);_0x2bcec0(ut['message'](_0x3e81('0x53')));});});};Fax[_0x3e81('0x23')][_0x3e81('0x54')]=function(_0x3b94d1){var _0x44f4d5=this;return new BPromise(function(_0x1d992c,_0x5834fd){var _0x5cb669=_0x44f4d5[_0x3e81('0x55')](_0x44f4d5[_0x3e81('0xc')][_0x3b94d1[_0x3e81('0x56')]][_0x3e81('0x57')],_0x3b94d1);if(_0x5cb669[_0x3e81('0x58')]){_0x1d992c(ut[_0x3e81('0x32')](_0x3e81('0x59')));}else{_0x5834fd(ut[_0x3e81('0x32')](_0x5cb669[_0x3e81('0x32')]));}});};function originate(_0x2b1e30,_0x33d54a,_0x3a09d8){return new BPromise(function(_0x39b2ec,_0x2c0c7a){if(_0x3a09d8){var _0x25ea5f=util['format'](_0x3e81('0x5a'),path[_0x3e81('0x33')](_0x2b1e30['path'])[_0x3e81('0x1f')],_0x2b1e30[_0x3e81('0x1')]);gs['execute'](_0x25ea5f)[_0x3e81('0x41')](function(){_0x2b1e30[_0x3e81('0x1')]=util[_0x3e81('0x5b')](_0x3e81('0x5c'),path[_0x3e81('0x33')](_0x2b1e30[_0x3e81('0x1')])[_0x3e81('0x5d')],path[_0x3e81('0x33')](_0x2b1e30['path'])[_0x3e81('0x1f')]);_0x33d54a[_0x3e81('0x5e')]=_0x2b1e30[_0x3e81('0x1')];ut[_0x3e81('0x43')](_0x3e81('0x5f'),'');ami[_0x3e81('0x60')](ut[_0x3e81('0x61')](_0x2b1e30,_0x33d54a))[_0x3e81('0x41')](function(_0x5e390b){_0x39b2ec(_0x5e390b);})[_0x3e81('0x37')](function(_0x3c43d2){_0x2c0c7a(_0x3c43d2);});})[_0x3e81('0x37')](function(_0x5dff69){_0x2c0c7a(_0x5dff69);});}else{ami[_0x3e81('0x60')](ut[_0x3e81('0x61')](_0x2b1e30,_0x33d54a))[_0x3e81('0x41')](function(_0x7b9c13){_0x39b2ec(_0x7b9c13);})['catch'](function(_0x53b8ac){_0x2c0c7a(_0x53b8ac);});}});}Fax[_0x3e81('0x23')][_0x3e81('0x50')]=function(_0x19ef08,_0xd1b4b2){var _0x352c58=this;return new BPromise(function(_0x50a12a,_0x285b75){var _0x775a10=uuid['v4']();var _0x410d4a=ut[_0x3e81('0x62')](_0x19ef08,_0xd1b4b2);_0x352c58[_0x3e81('0x22')][_0x775a10]=new Action(_0x775a10,_0xd1b4b2,_0x19ef08);var _0x3bf251=_0x352c58[_0x3e81('0x22')][_0x775a10];if(path[_0x3e81('0x33')](_0x19ef08[_0x3e81('0x1')])[_0x3e81('0x63')]===_0x3e81('0x34')){originate(_0x3bf251,_0x410d4a,!![])[_0x3e81('0x41')](function(_0x2d32bb){_0x50a12a(_0x2d32bb);})[_0x3e81('0x37')](function(_0x1e71e6){_0x285b75(_0x1e71e6);});}else{originate(_0x3bf251,_0x410d4a,![])[_0x3e81('0x41')](function(_0x4142bc){_0x50a12a(_0x4142bc);})[_0x3e81('0x37')](function(_0x4bbf5d){_0x285b75(_0x4bbf5d);});}});};Fax[_0x3e81('0x23')]['isTrunkReachable']=function(_0x1b7816){return!_[_0x3e81('0x64')](_0x1b7816)&&!_[_0x3e81('0x64')](_0x1b7816[_0x3e81('0x1f')])&&!_[_0x3e81('0x64')](_0x1b7816[_0x3e81('0x65')])&&_0x1b7816[_0x3e81('0x65')]&&!_[_0x3e81('0x64')](this[_0x3e81('0xd')][util[_0x3e81('0x5b')](_0x3e81('0x66'),_0x1b7816[_0x3e81('0x1f')])])&&!_[_0x3e81('0x64')](this['trunks'][util[_0x3e81('0x5b')]('SIP/%s',_0x1b7816[_0x3e81('0x1f')])]['status'])&&(this[_0x3e81('0xd')][util[_0x3e81('0x5b')](_0x3e81('0x66'),_0x1b7816[_0x3e81('0x1f')])][_0x3e81('0x2b')]===_0x3e81('0x67')||this['trunks'][util[_0x3e81('0x5b')](_0x3e81('0x66'),_0x1b7816[_0x3e81('0x1f')])][_0x3e81('0x2b')]==='unmonitored');};Fax[_0x3e81('0x23')][_0x3e81('0x55')]=function(_0x2bbdc1,_0x3d0a16){if(!this[_0x3e81('0x68')](_0x2bbdc1)){ut[_0x3e81('0x43')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x2bbdc1)?'':_0x2bbdc1[_0x3e81('0x1f')]+_0x3e81('0x69'));return{'isValid':![],'message':_0x3e81('0x6a')};}if(_[_0x3e81('0x64')](_0x3d0a16[_0x3e81('0x36')])){ut['logger'](_0x3e81('0x6b'),JSON[_0x3e81('0x3a')](_0x3d0a16));return{'isValid':![],'message':_0x3e81('0x6c')};}if(_[_0x3e81('0x64')](_0x3d0a16[_0x3e81('0x1')])){ut[_0x3e81('0x43')](_0x3e81('0x6d'),JSON[_0x3e81('0x3a')](_0x3d0a16));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x3e81('0x6e')};};module[_0x3e81('0x6f')]=Fax; \ No newline at end of file +var _0xade2=['path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/faxMessage','channels','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','logger','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','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','execOriginate','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','moment'];(function(_0x540c78,_0x2127ab){var _0x28c0e2=function(_0xee7c7){while(--_0xee7c7){_0x540c78['push'](_0x540c78['shift']());}};_0x28c0e2(++_0x2127ab);}(_0xade2,0xe9));var _0x2ade=function(_0x4a2c1f,_0x594c92){_0x4a2c1f=_0x4a2c1f-0x0;var _0x2da097=_0xade2[_0x4a2c1f];return _0x2da097;};'use strict';var util=require(_0x2ade('0x0'));var _=require(_0x2ade('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x2ade('0x2'));var path=require(_0x2ade('0x3'));var tiff2pdf=require(_0x2ade('0x4'));var gs=require('./util/gs');var logger=require(_0x2ade('0x5'))(_0x2ade('0x6'));var ami=require(_0x2ade('0x7'));var rpcDb=require(_0x2ade('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x2ade('0x9'));var faxAccount=require(_0x2ade('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x2ade('0xb'));function Fax(_0x127f6a){this[_0x2ade('0xc')]={};this['faxAccounts']=_0x127f6a['faxAccounts'];this[_0x2ade('0xd')]=_0x127f6a[_0x2ade('0xd')];this['actions']={};ami['on'](_0x2ade('0xe'),this['syncNewchannel'][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x10'),this[_0x2ade('0x11')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x12'),this[_0x2ade('0x13')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x14'),this[_0x2ade('0x15')]['bind'](this));ami['on'](_0x2ade('0x16'),this[_0x2ade('0x17')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x18'),this[_0x2ade('0x19')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x1a'),this[_0x2ade('0x1b')][_0x2ade('0xf')](this));ami['on'](_0x2ade('0x1c'),this[_0x2ade('0x1d')]['bind'](this));}Fax[_0x2ade('0x1e')]['syncNewchannel']=function(_0x4bfaf2){if(_0x4bfaf2[_0x2ade('0x1f')]===_0x2ade('0x20')){for(var _0xb1b142 in this[_0x2ade('0x21')]){if(this['faxAccounts'][_0x2ade('0x22')](_0xb1b142)){if(_0x4bfaf2[_0x2ade('0x23')]===this[_0x2ade('0x21')][_0xb1b142][_0x2ade('0x24')]){this['channels'][_0x4bfaf2[_0x2ade('0x25')]]={};this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]][_0x2ade('0x26')]=_0x4bfaf2[_0x2ade('0x26')];this[_0x2ade('0xc')][_0x4bfaf2['uniqueid']]['id']=this[_0x2ade('0x21')][_0xb1b142]['id'];this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]][_0x2ade('0x27')]=this[_0x2ade('0x21')][_0xb1b142]['name'];logger[_0x2ade('0x28')](_0x4bfaf2['uniqueid'],_0x2ade('0x29'));}}}}if(this[_0x2ade('0x2a')][_0x4bfaf2['uniqueid']]){this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]]={};this[_0x2ade('0xc')][_0x4bfaf2[_0x2ade('0x25')]][_0x2ade('0x26')]=_0x4bfaf2[_0x2ade('0x26')];logger[_0x2ade('0x28')](_0x4bfaf2[_0x2ade('0x25')],_0x2ade('0x29'));}};Fax[_0x2ade('0x1e')]['syncVarSet']=function(_0x44e94c){if(this[_0x2ade('0xc')][_0x44e94c['uniqueid']]){for(var _0x1ec295 in _0x44e94c['variable']){if(_0x44e94c[_0x2ade('0x2b')][_0x2ade('0x22')](_0x1ec295)){this[_0x2ade('0xc')][_0x44e94c[_0x2ade('0x25')]][_0x1ec295]=_0x44e94c[_0x2ade('0x2c')];}}}};Fax[_0x2ade('0x1e')]['syncNewState']=function(_0x2db88e){if(this[_0x2ade('0xc')][_0x2db88e['uniqueid']]){this[_0x2ade('0xc')][_0x2db88e['uniqueid']][_0x2ade('0x2d')]=_0x2db88e[_0x2ade('0x2d')];this[_0x2ade('0xc')][_0x2db88e[_0x2ade('0x25')]][_0x2ade('0x2e')]=_0x2db88e[_0x2ade('0x2e')];}};Fax[_0x2ade('0x1e')]['syncNewExten']=function(_0xa7218d){if(this[_0x2ade('0xc')][_0xa7218d[_0x2ade('0x25')]]){for(var _0x3940c8 in _0xa7218d[_0x2ade('0x2b')]){if(_0xa7218d[_0x2ade('0x2b')][_0x2ade('0x22')](_0x3940c8)){this['channels'][_0xa7218d[_0x2ade('0x25')]][_0x3940c8]=_0xa7218d[_0x2ade('0x2c')];}}}};Fax[_0x2ade('0x1e')]['syncFaxStatus']=function(_0x4f49e0){if(this['channels'][_0x4f49e0[_0x2ade('0x25')]]){this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x2f')]=_0x4f49e0[_0x2ade('0x2f')];this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x30')]=_0x4f49e0[_0x2ade('0x30')];this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x24')]=_0x4f49e0[_0x2ade('0x24')];this['channels'][_0x4f49e0[_0x2ade('0x25')]][_0x2ade('0x31')]=_0x4f49e0[_0x2ade('0x31')];logger[_0x2ade('0x28')](_0x4f49e0[_0x2ade('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0x2ade('0x1e')][_0x2ade('0x19')]=function(_0x3f4fc6){var _0x175f90=this;if(this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]]){var _0x39354d=this[_0x2ade('0xc')][_0x3f4fc6['uniqueid']]['id'];this['channels'][_0x3f4fc6[_0x2ade('0x25')]][_0x2ade('0x32')]=_0x3f4fc6['remotestationid'];this['channels'][_0x3f4fc6['uniqueid']][_0x2ade('0x33')]=_0x3f4fc6['pagestransferred'];this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]]['localstationid']=_0x3f4fc6[_0x2ade('0x24')];this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]][_0x2ade('0x34')]=_0x3f4fc6[_0x2ade('0x34')];this[_0x2ade('0xc')][_0x3f4fc6[_0x2ade('0x25')]][_0x2ade('0x35')]=_0x3f4fc6[_0x2ade('0x35')];this['channels'][_0x3f4fc6['uniqueid']][_0x2ade('0x31')]=_0x3f4fc6[_0x2ade('0x31')];this['channels'][_0x3f4fc6['uniqueid']]['calleridnum']=_0x3f4fc6[_0x2ade('0x36')];if(this['channels'][_0x3f4fc6['uniqueid']][_0x2ade('0x33')]>0x0){tiff2pdf(_0x3f4fc6[_0x2ade('0x31')],_0x2ade('0x37'),function(_0x5a1ec4){logger[_0x2ade('0x28')](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x38'),_0x5a1ec4[_0x2ade('0x39')]);attachment['create']({'name':path[_0x2ade('0x3a')](_0x3f4fc6['filename'])[_0x2ade('0x27')],'basename':path['parse'](_0x3f4fc6[_0x2ade('0x31')])['name']+_0x2ade('0x3b'),'type':_0x2ade('0x3c')})[_0x2ade('0x3d')](function(_0xd055fa){faxAccount[_0x2ade('0x3e')](_0x39354d,{'from':_0x3f4fc6[_0x2ade('0x36')],'mapKey':_0x2ade('0x6'),'body':path[_0x2ade('0x3a')](_0x3f4fc6[_0x2ade('0x31')])[_0x2ade('0x27')]+'.pdf','AttachmentId':_0xd055fa['id']})['catch'](function(_0x3abc9c){logger[_0x2ade('0x3f')](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x40'),JSON['stringify'](_0x3abc9c));});})[_0x2ade('0x41')](function(_0x58cb8c){logger['error'](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x42'),JSON[_0x2ade('0x43')](_0x58cb8c));});});}logger[_0x2ade('0x28')](_0x3f4fc6[_0x2ade('0x25')],_0x2ade('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x2b0a11){if(this['actions'][_0x2b0a11[_0x2ade('0x25')]]){_['merge'](this[_0x2ade('0xc')][_0x2b0a11[_0x2ade('0x25')]],_['pick'](_0x2b0a11,[_0x2ade('0x44'),_0x2ade('0x45')]));}};function updateStatus(_0xe2cde7){if(_0xe2cde7['AttachmentId']){faxMessage[_0x2ade('0x46')](_0xe2cde7[_0x2ade('0x47')],{'failMessage':_0x2ade('0x48')})[_0x2ade('0x3d')](function(_0x29407d){ut['logger'](_0x2ade('0x49'),_0x29407d);})[_0x2ade('0x41')](function(_0x534e08){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x534e08);});}else{ut['logger'](_0x2ade('0x4a'));}}Fax['prototype'][_0x2ade('0x4b')]=function(_0x46d4d1,_0x5dba60,_0x30675c){var _0x57c097=this;var _0x383510={};if(_0x5dba60){_0x383510={'read':_0x5dba60};}else{_0x383510={'failMessage':_0x30675c};}if(this[_0x2ade('0x2a')][_0x46d4d1][_0x2ade('0x47')]){faxMessage[_0x2ade('0x46')](this[_0x2ade('0x2a')][_0x46d4d1][_0x2ade('0x47')],_0x383510)['then'](function(_0x34e842){ut[_0x2ade('0x4c')](_0x2ade('0x4d'),_0x34e842);})[_0x2ade('0x41')](function(_0x521965){ut[_0x2ade('0x4c')](_0x2ade('0x4e'),_0x521965);})[_0x2ade('0x4f')](function(){delete _0x57c097[_0x2ade('0xc')][_0x46d4d1];delete _0x57c097['actions'][_0x46d4d1];});}else{ut[_0x2ade('0x4c')](_0x2ade('0x50'));delete this[_0x2ade('0xc')][_0x46d4d1];delete this[_0x2ade('0x2a')][_0x46d4d1];}};Fax[_0x2ade('0x1e')][_0x2ade('0x1b')]=function(_0x2cbdbb){var _0x3b8ae2=this;if(this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]]){if(this['actions'][_0x2cbdbb[_0x2ade('0x25')]]){this['channels'][_0x2cbdbb[_0x2ade('0x25')]]['id']=this[_0x2ade('0x2a')][_0x2cbdbb['uniqueid']]['id'];this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]][_0x2ade('0x27')]=this[_0x2ade('0x2a')][_0x2cbdbb['uniqueid']]['name'];}logger['info'](_0x2cbdbb[_0x2ade('0x25')],this[_0x2ade('0x2a')][_0x2cbdbb[_0x2ade('0x25')]]?_0x2ade('0x51'):_0x2ade('0x52'),JSON[_0x2ade('0x43')](this[_0x2ade('0xc')][_0x2cbdbb['uniqueid']]));if(this[_0x2ade('0x2a')][_0x2cbdbb[_0x2ade('0x25')]]){if(this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]][_0x2ade('0x53')]>0x0&&this['channels'][_0x2cbdbb[_0x2ade('0x25')]]['faxstatus']===_0x2ade('0x54')){this[_0x2ade('0x4b')](_0x2cbdbb['uniqueid'],!![]);}else{this[_0x2ade('0x4b')](_0x2cbdbb[_0x2ade('0x25')],![],this[_0x2ade('0xc')][_0x2cbdbb['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x2ade('0xc')][_0x2cbdbb[_0x2ade('0x25')]][_0x2ade('0x55')]:_0x2ade('0x56'));}}}};Fax[_0x2ade('0x1e')]['send']=function(_0x52d11b){var _0x2e261d=this;return new BPromise(function(_0x4cab56,_0x154097){_0x2e261d['execOriginate'](_0x52d11b,_0x2e261d[_0x2ade('0x21')][_0x52d11b[_0x2ade('0x57')]])[_0x2ade('0x3d')](function(_0x3926e1){ut[_0x2ade('0x4c')](_0x2ade('0x58'),_0x3926e1);_0x4cab56(ut[_0x2ade('0x39')](_0x2ade('0x59')));})[_0x2ade('0x41')](function(_0x1786d5){ut[_0x2ade('0x4c')](_0x2ade('0x5a'),_0x1786d5);updateStatus(_0x52d11b);_0x154097(ut['message'](_0x2ade('0x5b')));});});};Fax[_0x2ade('0x1e')][_0x2ade('0x5c')]=function(_0x4a4880){var _0x5a88bd=this;return new BPromise(function(_0x7df9a0,_0x408e35){var _0x36097f=_0x5a88bd[_0x2ade('0x5d')](_0x5a88bd['faxAccounts'][_0x4a4880[_0x2ade('0x57')]][_0x2ade('0x5e')],_0x4a4880);if(_0x36097f[_0x2ade('0x5f')]){_0x7df9a0(ut[_0x2ade('0x39')](_0x2ade('0x60')));}else{_0x408e35(ut[_0x2ade('0x39')](_0x36097f['message']));}});};function originate(_0x3b3b35,_0x44c730,_0x4dc4c5){return new BPromise(function(_0x1d0ec4,_0x112f79){if(_0x4dc4c5){var _0x407bb6=util[_0x2ade('0x61')](_0x2ade('0x62'),path[_0x2ade('0x3a')](_0x3b3b35['path'])[_0x2ade('0x27')],_0x3b3b35['path']);gs[_0x2ade('0x63')](_0x407bb6)[_0x2ade('0x3d')](function(){_0x3b3b35[_0x2ade('0x3')]=util[_0x2ade('0x61')](_0x2ade('0x64'),path['parse'](_0x3b3b35[_0x2ade('0x3')])['dir'],path[_0x2ade('0x3a')](_0x3b3b35[_0x2ade('0x3')])[_0x2ade('0x27')]);_0x44c730[_0x2ade('0x65')]=_0x3b3b35[_0x2ade('0x3')];ut['logger'](_0x2ade('0x66'),'');ami[_0x2ade('0x67')](ut[_0x2ade('0x68')](_0x3b3b35,_0x44c730))[_0x2ade('0x3d')](function(_0x24aaad){_0x1d0ec4(_0x24aaad);})[_0x2ade('0x41')](function(_0x12f8be){_0x112f79(_0x12f8be);});})['catch'](function(_0x4c13da){_0x112f79(_0x4c13da);});}else{ami[_0x2ade('0x67')](ut[_0x2ade('0x68')](_0x3b3b35,_0x44c730))[_0x2ade('0x3d')](function(_0x4f52d7){_0x1d0ec4(_0x4f52d7);})['catch'](function(_0x1b42e9){_0x112f79(_0x1b42e9);});}});}Fax[_0x2ade('0x1e')][_0x2ade('0x69')]=function(_0x4b6fe4,_0x541098){var _0x11f637=this;return new BPromise(function(_0x3b49f7,_0x4fbf29){var _0x3e770e=uuid['v4']();var _0x33fa02=ut['addVariables'](_0x4b6fe4,_0x541098);_0x11f637[_0x2ade('0x2a')][_0x3e770e]=new Action(_0x3e770e,_0x541098,_0x4b6fe4);var _0x483a51=_0x11f637[_0x2ade('0x2a')][_0x3e770e];if(path['parse'](_0x4b6fe4[_0x2ade('0x3')])['ext']===_0x2ade('0x3b')){originate(_0x483a51,_0x33fa02,!![])['then'](function(_0x51e3df){_0x3b49f7(_0x51e3df);})['catch'](function(_0x20df67){_0x4fbf29(_0x20df67);});}else{originate(_0x483a51,_0x33fa02,![])[_0x2ade('0x3d')](function(_0x262bba){_0x3b49f7(_0x262bba);})[_0x2ade('0x41')](function(_0x167a3){_0x4fbf29(_0x167a3);});}});};Fax[_0x2ade('0x1e')][_0x2ade('0x6a')]=function(_0x5ab004){return!_[_0x2ade('0x6b')](_0x5ab004)&&!_[_0x2ade('0x6b')](_0x5ab004[_0x2ade('0x27')])&&!_[_0x2ade('0x6b')](_0x5ab004[_0x2ade('0x6c')])&&_0x5ab004[_0x2ade('0x6c')]&&!_[_0x2ade('0x6b')](this[_0x2ade('0xd')][util[_0x2ade('0x61')](_0x2ade('0x6d'),_0x5ab004[_0x2ade('0x27')])])&&!_['isNil'](this['trunks'][util[_0x2ade('0x61')](_0x2ade('0x6d'),_0x5ab004[_0x2ade('0x27')])][_0x2ade('0x30')])&&(this[_0x2ade('0xd')][util['format'](_0x2ade('0x6d'),_0x5ab004[_0x2ade('0x27')])][_0x2ade('0x30')]===_0x2ade('0x6e')||this[_0x2ade('0xd')][util[_0x2ade('0x61')]('SIP/%s',_0x5ab004[_0x2ade('0x27')])][_0x2ade('0x30')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x37accb,_0x35ee7a){if(!this[_0x2ade('0x6a')](_0x37accb)){ut['logger'](_0x2ade('0x6f'),_[_0x2ade('0x6b')](_0x37accb)?'':_0x37accb[_0x2ade('0x27')]+_0x2ade('0x70'));return{'isValid':![],'message':_0x2ade('0x71')};}if(_['isNil'](_0x35ee7a[_0x2ade('0x6')])){ut[_0x2ade('0x4c')](_0x2ade('0x72'),JSON['stringify'](_0x35ee7a));return{'isValid':![],'message':_0x2ade('0x73')};}if(_[_0x2ade('0x6b')](_0x35ee7a['path'])){ut['logger'](_0x2ade('0x74'),JSON[_0x2ade('0x43')](_0x35ee7a));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2ade('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 25bc7ed..1bc2344 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 _0x4885=['catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect','notify'];(function(_0x5e570d,_0x1e64c4){var _0x1fa58c=function(_0x1c07fc){while(--_0x1c07fc){_0x5e570d['push'](_0x5e570d['shift']());}};_0x1fa58c(++_0x1e64c4);}(_0x4885,0x1a0));var _0x5488=function(_0x55100,_0x57cc94){_0x55100=_0x55100-0x0;var _0x5b0579=_0x4885[_0x55100];return _0x5b0579;};'use strict';var util=require(_0x5488('0x0'));var BPromise=require(_0x5488('0x1'));var logger=require(_0x5488('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x5488('0x3'));function loggerCatch(_0x388307){return function(_0x1b5704){logger[_0x5488('0x4')](_0x388307,util[_0x5488('0x5')](_0x1b5704,{'showHidden':![],'depth':null}));};}exports[_0x5488('0x6')]=function(_0x6be4b7,_0x507ae8){return BPromise['resolve']()['then'](faxAccount[_0x5488('0x6')](_0x6be4b7,_0x507ae8))[_0x5488('0x7')](loggerCatch(_0x5488('0x8')));}; \ No newline at end of file +var _0x6b49=['util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','catch','[Notify]\x20'];(function(_0x5bb0dd,_0x39ae3b){var _0x3c3df1=function(_0x545001){while(--_0x545001){_0x5bb0dd['push'](_0x5bb0dd['shift']());}};_0x3c3df1(++_0x39ae3b);}(_0x6b49,0xd8));var _0x96b4=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x6b49[_0x28947d];return _0x12d2ee;};'use strict';var util=require(_0x96b4('0x0'));var BPromise=require('bluebird');var logger=require(_0x96b4('0x1'))(_0x96b4('0x2'));var _=require(_0x96b4('0x3'));var faxAccount=require(_0x96b4('0x4'));function loggerCatch(_0x53deed){return function(_0x27b312){logger[_0x96b4('0x5')](_0x53deed,util['inspect'](_0x27b312,{'showHidden':![],'depth':null}));};}exports[_0x96b4('0x6')]=function(_0x542fc8,_0x566529){return BPromise['resolve']()['then'](faxAccount[_0x96b4('0x6')](_0x542fc8,_0x566529))[_0x96b4('0x7')](loggerCatch(_0x96b4('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 053b0ba..b0aacd1 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 _0x42ec=['bluebird','exec','info','\x20Error\x20:','../../../../config/logger'];(function(_0x315cf0,_0x39fea6){var _0x2133cd=function(_0x3592fe){while(--_0x3592fe){_0x315cf0['push'](_0x315cf0['shift']());}};_0x2133cd(++_0x39fea6);}(_0x42ec,0x185));var _0xc42e=function(_0x560878,_0x74152f){_0x560878=_0x560878-0x0;var _0x43572f=_0x42ec[_0x560878];return _0x43572f;};'use strict';var util=require('util');var logger=require(_0xc42e('0x0'))('fax');var BPromise=require(_0xc42e('0x1'));var exec=require('child_process')[_0xc42e('0x2')];exports['execute']=function(_0x588121){return new BPromise(function(_0x255ef1,_0x16db1f){exec(_0x588121,function(_0xdc6d0,_0x50a790,_0x386c64){logger[_0xc42e('0x3')]('Exec\x20gs',_0x50a790);if(_0xdc6d0){logger[_0xc42e('0x3')]('Exec\x20gs',_0xc42e('0x4'),util['inspect'](_0xdc6d0,{'showHidden':![],'depth':null}),_0x50a790,_0x386c64);_0x16db1f(_0xdc6d0);}_0x255ef1(_0x50a790);});});}; \ No newline at end of file +var _0x5c10=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0xd958e0,_0x54deea){var _0x7e2a6=function(_0x429692){while(--_0x429692){_0xd958e0['push'](_0xd958e0['shift']());}};_0x7e2a6(++_0x54deea);}(_0x5c10,0x8b));var _0x05c1=function(_0x36bd2b,_0x209ba6){_0x36bd2b=_0x36bd2b-0x0;var _0x131664=_0x5c10[_0x36bd2b];return _0x131664;};'use strict';var util=require(_0x05c1('0x0'));var logger=require(_0x05c1('0x1'))(_0x05c1('0x2'));var BPromise=require(_0x05c1('0x3'));var exec=require(_0x05c1('0x4'))[_0x05c1('0x5')];exports[_0x05c1('0x6')]=function(_0x28a77f){return new BPromise(function(_0x2d620a,_0xe56267){exec(_0x28a77f,function(_0x1f6ec1,_0x26d50b,_0x2aa419){logger[_0x05c1('0x7')](_0x05c1('0x8'),_0x26d50b);if(_0x1f6ec1){logger[_0x05c1('0x7')]('Exec\x20gs',_0x05c1('0x9'),util[_0x05c1('0xa')](_0x1f6ec1,{'showHidden':![],'depth':null}),_0x26d50b,_0x2aa419);_0xe56267(_0x1f6ec1);}_0x2d620a(_0x26d50b);});});}; \ 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 8b8eead..5b08e7c 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 _0xda55=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','maxrate'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xda55,0x6d));var _0x5da5=function(_0x28896a,_0x4dc100){_0x28896a=_0x28896a-0x0;var _0x5a4f2b=_0xda55[_0x28896a];return _0x5a4f2b;};'use strict';var util=require(_0x5da5('0x0'));var _=require(_0x5da5('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x5da5('0x2'));exports[_0x5da5('0x3')]=function(_0x26a443){return{'message':_0x26a443};};exports[_0x5da5('0x4')]=function(_0x1c3afd,_0x5da254){logger[_0x5da5('0x5')](_0x1c3afd,util['inspect'](_0x5da254,{'showHidden':![],'depth':null}));};exports[_0x5da5('0x6')]=function(_0x58e7b3,_0x2fd877){var _0x267469={'XMF-ECM':_0x2fd877[_0x5da5('0x7')],'XMF-HEADERINFO':_0x2fd877[_0x5da5('0x8')],'XMF-MINRATE':_0x2fd877[_0x5da5('0x9')],'XMF-MAXRATE':_0x2fd877[_0x5da5('0xa')],'XMF-MODEM':util[_0x5da5('0xb')](_0x5da5('0xc'),_0x2fd877['modem']),'XMF-GATEWAY':_0x2fd877[_0x5da5('0xd')],'XMF-FAXDETECT':_0x2fd877[_0x5da5('0xe')],'XMF-T38TIMEOUT':_0x2fd877[_0x5da5('0xf')],'XMF-LOCALSTATIONID':_0x2fd877[_0x5da5('0x10')],'XMF-PATH':_0x58e7b3[_0x5da5('0x11')]};return _0x267469;};exports[_0x5da5('0x12')]=function(_0x33313e,_0x589c14){return{'actionid':_0x33313e[_0x5da5('0x13')],'action':_0x5da5('0x14'),'channel':_0x33313e['channel'],'Exten':_0x5da5('0x15'),'Context':_0x5da5('0x16'),'Priority':'1','callerid':util[_0x5da5('0xb')](_0x5da5('0x17'),_0x33313e[_0x5da5('0x8')]?_0x33313e[_0x5da5('0x8')]:'',_0x33313e['localstationid']),'variable':_0x589c14,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x33313e['uniqueid']};}; \ No newline at end of file +var _0x16d2=['addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x16d2,0x123));var _0x216d=function(_0x4819f4,_0x5c3aac){_0x4819f4=_0x4819f4-0x0;var _0x135bf0=_0x16d2[_0x4819f4];return _0x135bf0;};'use strict';var util=require(_0x216d('0x0'));var _=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var logger=require(_0x216d('0x3'))(_0x216d('0x4'));exports[_0x216d('0x5')]=function(_0x34cf5b){return{'message':_0x34cf5b};};exports[_0x216d('0x6')]=function(_0xfd7306,_0x593bb0){logger[_0x216d('0x7')](_0xfd7306,util[_0x216d('0x8')](_0x593bb0,{'showHidden':![],'depth':null}));};exports[_0x216d('0x9')]=function(_0x205101,_0x1dd8e2){var _0x24c831={'XMF-ECM':_0x1dd8e2[_0x216d('0xa')],'XMF-HEADERINFO':_0x1dd8e2[_0x216d('0xb')],'XMF-MINRATE':_0x1dd8e2['minrate'],'XMF-MAXRATE':_0x1dd8e2[_0x216d('0xc')],'XMF-MODEM':util[_0x216d('0xd')](_0x216d('0xe'),_0x1dd8e2[_0x216d('0xf')]),'XMF-GATEWAY':_0x1dd8e2[_0x216d('0x10')],'XMF-FAXDETECT':_0x1dd8e2[_0x216d('0x11')],'XMF-T38TIMEOUT':_0x1dd8e2['t38timeout'],'XMF-LOCALSTATIONID':_0x1dd8e2[_0x216d('0x12')],'XMF-PATH':_0x205101['path']};return _0x24c831;};exports[_0x216d('0x13')]=function(_0x2e02ce,_0x332e30){return{'actionid':_0x2e02ce[_0x216d('0x14')],'action':_0x216d('0x15'),'channel':_0x2e02ce[_0x216d('0x16')],'Exten':'xcally-motion-fax','Context':_0x216d('0x17'),'Priority':'1','callerid':util['format'](_0x216d('0x18'),_0x2e02ce[_0x216d('0xb')]?_0x2e02ce['headerinfo']:'',_0x2e02ce[_0x216d('0x12')]),'variable':_0x332e30,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2e02ce[_0x216d('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3b45ba1..2c684c7 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 _0xa1ed=['initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./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/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers'];(function(_0x581bc7,_0x2ce3c5){var _0x2d951d=function(_0x263479){while(--_0x263479){_0x581bc7['push'](_0x581bc7['shift']());}};_0x2d951d(++_0x2ce3c5);}(_0xa1ed,0x1b6));var _0xda1e=function(_0x1a8caa,_0x195483){_0x1a8caa=_0x1a8caa-0x0;var _0x9021fe=_0xa1ed[_0x1a8caa];return _0x9021fe;};'use strict';var BPromise=require(_0xda1e('0x0'));var util=require(_0xda1e('0x1'));var moment=require('moment');var server=require(_0xda1e('0x2'));var Realtime=require(_0xda1e('0x3'));var Report=require(_0xda1e('0x4'));var Acw=require(_0xda1e('0x5'));var Trigger=require(_0xda1e('0x6'));var Dialer=require('./dialer');var Preview=require(_0xda1e('0x7'));var Fax=require(_0xda1e('0x8'));var user=require(_0xda1e('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xda1e('0xa'));var trunk=require(_0xda1e('0xb'));var trigger=require('./rpc/trigger');var template=require(_0xda1e('0xc'));var cmHopperHistory=require(_0xda1e('0xd'));var campaign=require(_0xda1e('0xe'));var voiceExtension=require(_0xda1e('0xf'));var faxAccount=require(_0xda1e('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xda1e('0x11'));var sugarcrm=require(_0xda1e('0x12'));var freshdesk=require(_0xda1e('0x13'));var desk=require(_0xda1e('0x14'));var zoho=require(_0xda1e('0x15'));var vtiger=require(_0xda1e('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xda1e('0x17'));var dynamics365=require(_0xda1e('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xda1e('0x19')](_0xda1e('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xda1e('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xda1e('0x1b')]()[_0xda1e('0x1c')](user[_0xda1e('0x1d')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x1e')]())[_0xda1e('0x1c')](user['getTelephones']())[_0xda1e('0x1c')](realtime[_0xda1e('0x1f')]())['then'](trunk[_0xda1e('0x20')]())['then'](realtime[_0xda1e('0x21')]())[_0xda1e('0x1c')](voiceQueue[_0xda1e('0x22')]())['then'](realtime[_0xda1e('0x23')]())[_0xda1e('0x1c')](trigger[_0xda1e('0x24')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x25')]())['then'](template['getTemplates']())[_0xda1e('0x1c')](realtime[_0xda1e('0x26')]())['then'](zendesk[_0xda1e('0x27')]())[_0xda1e('0x1c')](realtime['initZendeskAccounts']())['then'](salesforce[_0xda1e('0x28')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x29')]())[_0xda1e('0x1c')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xda1e('0x2a')]())['then'](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xda1e('0x2b')]())[_0xda1e('0x1c')](desk[_0xda1e('0x2c')]())[_0xda1e('0x1c')](realtime['initDeskAccounts']())['then'](zoho[_0xda1e('0x2d')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x2e')]())[_0xda1e('0x1c')](vtiger[_0xda1e('0x2f')]())[_0xda1e('0x1c')](realtime['initVtigerAccounts']())[_0xda1e('0x1c')](freshsales[_0xda1e('0x30')]())[_0xda1e('0x1c')](realtime['initFreshsalesAccounts']())[_0xda1e('0x1c')](servicenow['getServicenowAccounts']())['then'](realtime[_0xda1e('0x31')]())[_0xda1e('0x1c')](dynamics365[_0xda1e('0x32')]())['then'](realtime[_0xda1e('0x33')]())[_0xda1e('0x1c')](campaign[_0xda1e('0x34')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x35')]())[_0xda1e('0x1c')](voiceExtension[_0xda1e('0x36')]())['then'](realtime[_0xda1e('0x37')]())[_0xda1e('0x1c')](faxAccount[_0xda1e('0x38')]())['then'](realtime['initFaxAccounts']())[_0xda1e('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xda1e('0x1b')]()[_0xda1e('0x1c')](voiceQueueReport[_0xda1e('0x39')]())[_0xda1e('0x1c')](realtime['initVoiceQueueReports']())[_0xda1e('0x1c')](cmHopperHistory[_0xda1e('0x3a')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x3b')]())[_0xda1e('0x1c')](cmHopperHistory[_0xda1e('0x3c')]())[_0xda1e('0x1c')](realtime[_0xda1e('0x3d')]())[_0xda1e('0x1c')](voiceCallReport[_0xda1e('0x3e')]())['then'](realtime[_0xda1e('0x3f')]())[_0xda1e('0x1c')](function(_0x3fc120){})[_0xda1e('0x40')](function(_0x17f927){console[_0xda1e('0x41')](_0x17f927);});}function main(){return server[_0xda1e('0x42')](realtime,preview,fax)['then'](function(_0x445550){return initRealtime();})[_0xda1e('0x1c')](function(){return initParams();})['then'](function(){report[_0xda1e('0x43')]();setInterval(initRealtime,0x1388);})[_0xda1e('0x40')](function(_0x1e2b1a){console[_0xda1e('0x41')](_0x1e2b1a);});}main(); \ No newline at end of file +var _0x7e81=['initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','sync','catch','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/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','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates'];(function(_0x2687ff,_0x190caf){var _0x5a4160=function(_0x2e0160){while(--_0x2e0160){_0x2687ff['push'](_0x2687ff['shift']());}};_0x5a4160(++_0x190caf);}(_0x7e81,0xf6));var _0x17e8=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7e81[_0x5783f4];return _0x28e380;};'use strict';var BPromise=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var moment=require('moment');var server=require(_0x17e8('0x2'));var Realtime=require(_0x17e8('0x3'));var Report=require(_0x17e8('0x4'));var Acw=require(_0x17e8('0x5'));var Trigger=require(_0x17e8('0x6'));var Dialer=require(_0x17e8('0x7'));var Preview=require(_0x17e8('0x8'));var Fax=require(_0x17e8('0x9'));var user=require(_0x17e8('0xa'));var voiceQueue=require(_0x17e8('0xb'));var voiceQueueReport=require(_0x17e8('0xc'));var voiceCallReport=require(_0x17e8('0xd'));var trunk=require('./rpc/trunk');var trigger=require(_0x17e8('0xe'));var template=require(_0x17e8('0xf'));var cmHopperHistory=require(_0x17e8('0x10'));var campaign=require(_0x17e8('0x11'));var voiceExtension=require(_0x17e8('0x12'));var faxAccount=require(_0x17e8('0x13'));var zendesk=require(_0x17e8('0x14'));var salesforce=require(_0x17e8('0x15'));var sugarcrm=require(_0x17e8('0x16'));var freshdesk=require(_0x17e8('0x17'));var desk=require(_0x17e8('0x18'));var zoho=require(_0x17e8('0x19'));var vtiger=require(_0x17e8('0x1a'));var freshsales=require(_0x17e8('0x1b'));var servicenow=require(_0x17e8('0x1c'));var dynamics365=require(_0x17e8('0x1d'));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()[_0x17e8('0x1e')](_0x17e8('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x17e8('0x1e')](_0x17e8('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x17e8('0x20')]()[_0x17e8('0x21')](user[_0x17e8('0x22')]())['then'](realtime[_0x17e8('0x23')]())['then'](user[_0x17e8('0x24')]())[_0x17e8('0x21')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x17e8('0x21')](realtime[_0x17e8('0x25')]())[_0x17e8('0x21')](voiceQueue[_0x17e8('0x26')]())['then'](realtime['initVoiceQueues']())[_0x17e8('0x21')](trigger[_0x17e8('0x27')]())[_0x17e8('0x21')](realtime[_0x17e8('0x28')]())['then'](template['getTemplates']())[_0x17e8('0x21')](realtime[_0x17e8('0x29')]())['then'](zendesk['getZendeskAccounts']())[_0x17e8('0x21')](realtime['initZendeskAccounts']())[_0x17e8('0x21')](salesforce['getSalesforceAccounts']())[_0x17e8('0x21')](realtime[_0x17e8('0x2a')]())['then'](sugarcrm[_0x17e8('0x2b')]())[_0x17e8('0x21')](realtime['initSugarcrmAccounts']())[_0x17e8('0x21')](freshdesk[_0x17e8('0x2c')]())[_0x17e8('0x21')](realtime[_0x17e8('0x2d')]())[_0x17e8('0x21')](desk[_0x17e8('0x2e')]())[_0x17e8('0x21')](realtime[_0x17e8('0x2f')]())[_0x17e8('0x21')](zoho[_0x17e8('0x30')]())['then'](realtime[_0x17e8('0x31')]())[_0x17e8('0x21')](vtiger[_0x17e8('0x32')]())[_0x17e8('0x21')](realtime[_0x17e8('0x33')]())[_0x17e8('0x21')](freshsales[_0x17e8('0x34')]())['then'](realtime[_0x17e8('0x35')]())['then'](servicenow[_0x17e8('0x36')]())[_0x17e8('0x21')](realtime['initServicenowAccounts']())[_0x17e8('0x21')](dynamics365[_0x17e8('0x37')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0x17e8('0x38')]())[_0x17e8('0x21')](realtime[_0x17e8('0x39')]())[_0x17e8('0x21')](voiceExtension[_0x17e8('0x3a')]())['then'](realtime['initVoiceExtensions']())[_0x17e8('0x21')](faxAccount[_0x17e8('0x3b')]())['then'](realtime[_0x17e8('0x3c')]())[_0x17e8('0x21')](function(){return realtime;});}function initParams(){return BPromise[_0x17e8('0x20')]()['then'](voiceQueueReport[_0x17e8('0x3d')]())[_0x17e8('0x21')](realtime[_0x17e8('0x3e')]())[_0x17e8('0x21')](cmHopperHistory[_0x17e8('0x3f')]())[_0x17e8('0x21')](realtime[_0x17e8('0x40')]())[_0x17e8('0x21')](cmHopperHistory[_0x17e8('0x41')]())[_0x17e8('0x21')](realtime[_0x17e8('0x42')]())[_0x17e8('0x21')](voiceCallReport[_0x17e8('0x43')]())[_0x17e8('0x21')](realtime[_0x17e8('0x44')]())[_0x17e8('0x21')](function(_0x2aae25){})['catch'](function(_0x43cbde){console[_0x17e8('0x45')](_0x43cbde);});}function main(){return server['listen'](realtime,preview,fax)[_0x17e8('0x21')](function(_0x43fe07){return initRealtime();})[_0x17e8('0x21')](function(){return initParams();})[_0x17e8('0x21')](function(){report[_0x17e8('0x46')]();setInterval(initRealtime,0x1388);})[_0x17e8('0x47')](function(_0x2769fd){console[_0x17e8('0x45')](_0x2769fd);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index f2f94e9..3880c97 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 _0x7063=['onhold','prototype','toLowerCase','not_inuse','inuse','talking','voiceStatusTime','toNumber','format','address','stringify','user:%s','emit','user:save','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue'];(function(_0x582cc9,_0x411563){var _0x1a0321=function(_0xc7770c){while(--_0xc7770c){_0x582cc9['push'](_0x582cc9['shift']());}};_0x1a0321(++_0x411563);}(_0x7063,0x1cb));var _0x3706=function(_0x35e794,_0xe4473){_0x35e794=_0x35e794-0x0;var _0x5a7900=_0x7063[_0x35e794];return _0x5a7900;};'use strict';var _=require('lodash');var util=require(_0x3706('0x0'));var moment=require(_0x3706('0x1'));var md5=require(_0x3706('0x2'));var Redis=require(_0x3706('0x3'));var config=require('../../../config/environment');config[_0x3706('0x4')]=_[_0x3706('0x5')](config[_0x3706('0x4')],{'host':_0x3706('0x6'),'port':0x18eb});var io=require(_0x3706('0x7'))(new Redis(config[_0x3706('0x4')]));function Agent(_0xceeb8a){this['id']=_0xceeb8a['id']||0x0;this[_0x3706('0x8')]=_0xceeb8a[_0x3706('0x8')]||'';this[_0x3706('0x9')]=_0xceeb8a[_0x3706('0x9')]||'';this[_0x3706('0xa')]=_0xceeb8a[_0x3706('0xa')]||'';this['fullname']=_0xceeb8a[_0x3706('0xb')]||'';this[_0x3706('0xc')]=_0x3706('0xd');this[_0x3706('0xe')]=0x0;this[_0x3706('0xf')]='unknown';this['address']='';this['phone']='';this[_0x3706('0x10')]='';this[_0x3706('0x11')]='';this[_0x3706('0x12')]=_0xceeb8a['online']||![];this[_0x3706('0x13')]='unknown';this['voiceStatusTime']=0x0;this[_0x3706('0x14')]='';this[_0x3706('0x15')]='';this[_0x3706('0x16')]=![];this['local']=![];this[_0x3706('0x2')]='';}Agent[_0x3706('0x17')]['updateStatusRealtime']=function(_0x5989bd){var _0x55718d;if(_0x5989bd&&_0x5989bd['state']){_0x55718d=_0x5989bd[_0x3706('0xc')][_0x3706('0x18')]();switch(_0x55718d){case _0x3706('0x19'):_0x55718d='idle';break;case _0x3706('0x1a'):_0x55718d=_0x3706('0x1b');break;}}if(_0x55718d&&this[_0x3706('0x13')]!==_0x55718d||_0x5989bd['statePause']){this[_0x3706('0x1c')]=_[_0x3706('0x1d')](moment()[_0x3706('0x1e')]('x'));}if(_0x55718d){this[_0x3706('0x13')]=_0x55718d;}var _0x568fbf={'id':this['id'],'name':this[_0x3706('0x8')],'email':this[_0x3706('0x9')],'accountcode':this[_0x3706('0xa')],'fullname':this['fullname'],'state':this[_0x3706('0xc')],'stateTime':this['stateTime'],'status':this[_0x3706('0xf')],'address':this[_0x3706('0x1f')],'online':this[_0x3706('0x12')],'voiceStatus':this[_0x3706('0x13')],'voiceStatusTime':this[_0x3706('0x1c')],'voiceStatusCallerIdNumber':this[_0x3706('0x14')],'voiceStatusQueue':this[_0x3706('0x15')],'interface':this[_0x3706('0x11')],'onhold':this['onhold']};var _0x29f4ff=md5(JSON[_0x3706('0x20')](_0x568fbf));if(this[_0x3706('0x2')]!==_0x29f4ff){this['md5']=_0x29f4ff;io['to'](util[_0x3706('0x1e')](_0x3706('0x21'),_0x568fbf[_0x3706('0x8')]))[_0x3706('0x22')](_0x3706('0x23'),_0x568fbf);}};module[_0x3706('0x24')]=Agent; \ No newline at end of file +var _0x56c2=['local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','format','stringify','emit','user:save','exports','lodash','util','moment','md5','ioredis','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x56c2,0x13d));var _0x256c=function(_0x19c829,_0x468e83){_0x19c829=_0x19c829-0x0;var _0x46be66=_0x56c2[_0x19c829];return _0x46be66;};'use strict';var _=require(_0x256c('0x0'));var util=require(_0x256c('0x1'));var moment=require(_0x256c('0x2'));var md5=require(_0x256c('0x3'));var Redis=require(_0x256c('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0x256c('0x5'),'port':0x18eb});var io=require(_0x256c('0x6'))(new Redis(config[_0x256c('0x7')]));function Agent(_0x3180c6){this['id']=_0x3180c6['id']||0x0;this[_0x256c('0x8')]=_0x3180c6[_0x256c('0x8')]||'';this['email']=_0x3180c6[_0x256c('0x9')]||'';this[_0x256c('0xa')]=_0x3180c6['accountcode']||'';this['fullname']=_0x3180c6[_0x256c('0xb')]||'';this[_0x256c('0xc')]=_0x256c('0xd');this[_0x256c('0xe')]=0x0;this[_0x256c('0xf')]=_0x256c('0xd');this['address']='';this[_0x256c('0x10')]='';this[_0x256c('0x11')]='';this[_0x256c('0x12')]='';this['online']=_0x3180c6[_0x256c('0x13')]||![];this[_0x256c('0x14')]=_0x256c('0xd');this[_0x256c('0x15')]=0x0;this[_0x256c('0x16')]='';this[_0x256c('0x17')]='';this[_0x256c('0x18')]=![];this[_0x256c('0x19')]=![];this['md5']='';}Agent[_0x256c('0x1a')][_0x256c('0x1b')]=function(_0xa1bcee){var _0x40547f;if(_0xa1bcee&&_0xa1bcee[_0x256c('0xc')]){_0x40547f=_0xa1bcee[_0x256c('0xc')][_0x256c('0x1c')]();switch(_0x40547f){case _0x256c('0x1d'):_0x40547f='idle';break;case _0x256c('0x1e'):_0x40547f=_0x256c('0x1f');break;}}if(_0x40547f&&this[_0x256c('0x14')]!==_0x40547f||_0xa1bcee[_0x256c('0x20')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x256c('0x21')]('x'));}if(_0x40547f){this[_0x256c('0x14')]=_0x40547f;}var _0x8f6732={'id':this['id'],'name':this[_0x256c('0x8')],'email':this[_0x256c('0x9')],'accountcode':this[_0x256c('0xa')],'fullname':this[_0x256c('0xb')],'state':this[_0x256c('0xc')],'stateTime':this[_0x256c('0xe')],'status':this[_0x256c('0xf')],'address':this['address'],'online':this[_0x256c('0x13')],'voiceStatus':this[_0x256c('0x14')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x256c('0x16')],'voiceStatusQueue':this[_0x256c('0x17')],'interface':this['interface'],'onhold':this[_0x256c('0x18')]};var _0x369322=md5(JSON[_0x256c('0x22')](_0x8f6732));if(this[_0x256c('0x3')]!==_0x369322){this[_0x256c('0x3')]=_0x369322;io['to'](util['format']('user:%s',_0x8f6732['name']))[_0x256c('0x23')](_0x256c('0x24'),_0x8f6732);}};module[_0x256c('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index d3789df..09639bf 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 _0x570d=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays'];(function(_0x5f4e8d,_0x50740d){var _0x220421=function(_0x45cfa8){while(--_0x45cfa8){_0x5f4e8d['push'](_0x5f4e8d['shift']());}};_0x220421(++_0x50740d);}(_0x570d,0x1bc));var _0xd570=function(_0x125425,_0x4b6bab){_0x125425=_0x125425-0x0;var _0xd04dc4=_0x570d[_0x125425];return _0xd04dc4;};'use strict';function Campaign(_0x589744){this['id']=_0x589744['id']||0x0;this[_0xd570('0x0')]=_0x589744[_0xd570('0x0')]||'';this[_0xd570('0x1')]=_0x589744[_0xd570('0x1')]||_0xd570('0x2');this[_0xd570('0x3')]=0x0;this[_0xd570('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xd570('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x589744['active'];this[_0xd570('0x6')]=_0x589744[_0xd570('0x6')];this[_0xd570('0x7')]=_0x589744[_0xd570('0x7')]||null;this[_0xd570('0x8')]=_0x589744[_0xd570('0x8')]?_0x589744['dialGlobalInterval']:null;this[_0xd570('0x9')]=_0x589744['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x589744[_0xd570('0xa')];this[_0xd570('0xb')]=_0x589744['dialOriginateTimeout']||0x1e;this[_0xd570('0xc')]=_0x589744[_0xd570('0xc')];this['dialCongestionRetryFrequency']=_0x589744[_0xd570('0xd')];this[_0xd570('0xe')]=_0x589744['dialBusyMaxRetry'];this[_0xd570('0xf')]=_0x589744[_0xd570('0xf')];this[_0xd570('0x10')]=_0x589744[_0xd570('0x10')];this[_0xd570('0x11')]=_0x589744['dialNoAnswerRetryFrequency'];this[_0xd570('0x12')]=_0x589744['dialGlobalMaxRetry'];this[_0xd570('0x13')]=_0x589744[_0xd570('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x589744[_0xd570('0x14')]||0x96;this[_0xd570('0x15')]=_0x589744[_0xd570('0x15')]||0x3;this[_0xd570('0x16')]=_0x589744[_0xd570('0x16')]||0x96;this[_0xd570('0x17')]=_0x589744[_0xd570('0x17')]||0x3;this[_0xd570('0x18')]=_0x589744['dialAbandonedRetryFrequency']||0x96;this[_0xd570('0x19')]=_0x589744[_0xd570('0x19')]||0x3;this[_0xd570('0x1a')]=_0x589744[_0xd570('0x1a')]||0x96;this[_0xd570('0x1b')]=_0x589744[_0xd570('0x1b')]||0x3;this[_0xd570('0x1c')]=_0x589744[_0xd570('0x1c')]||0x96;this[_0xd570('0x1d')]=_0x589744['dialOrderByScheduledAt']||_0xd570('0x1e');this[_0xd570('0x1f')]=_0x589744[_0xd570('0x1f')]||undefined;this[_0xd570('0x20')]=_0x589744['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd570('0x21')]=_0x589744[_0xd570('0x21')]||undefined;this[_0xd570('0x22')]=_0x589744[_0xd570('0x22')]?_0x589744[_0xd570('0x22')]:undefined;this['Trunk']=_0x589744[_0xd570('0x23')]?_0x589744[_0xd570('0x23')]:undefined;this[_0xd570('0x24')]=_0x589744[_0xd570('0x24')]?_0x589744[_0xd570('0x24')]:undefined;this[_0xd570('0x25')]=_0x589744[_0xd570('0x25')]?_0x589744[_0xd570('0x25')]:undefined;this[_0xd570('0x26')]=_0x589744[_0xd570('0x25')]?_0x589744[_0xd570('0x25')][_0xd570('0x0')]:undefined;this[_0xd570('0x27')]=_0x589744[_0xd570('0x27')]||![];this['dialAMDInitialSilence']=_0x589744[_0xd570('0x28')];this[_0xd570('0x29')]=_0x589744['dialAMDGreeting'];this[_0xd570('0x2a')]=_0x589744[_0xd570('0x2a')];this['dialAMDTotalAnalysisTime']=_0x589744[_0xd570('0x2b')];this['dialAMDMinWordLength']=_0x589744[_0xd570('0x2c')];this[_0xd570('0x2d')]=_0x589744[_0xd570('0x2d')];this[_0xd570('0x2e')]=_0x589744['dialAMDMaximumNumberOfWords'];this[_0xd570('0x2f')]=_0x589744['dialAMDSilenceThreshold'];this[_0xd570('0x30')]=_0x589744[_0xd570('0x30')];}module[_0xd570('0x31')]=Campaign; \ No newline at end of file +var _0xd6d5=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0xcaec2e,_0x2a2a04){var _0x26ec3d=function(_0x2b3ae7){while(--_0x2b3ae7){_0xcaec2e['push'](_0xcaec2e['shift']());}};_0x26ec3d(++_0x2a2a04);}(_0xd6d5,0x1de));var _0x5d6d=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0xd6d5[_0x1e05c1];return _0x15f1ca;};'use strict';function Campaign(_0x513f32){this['id']=_0x513f32['id']||0x0;this['name']=_0x513f32['name']||'';this[_0x5d6d('0x0')]=_0x513f32[_0x5d6d('0x0')]||'campaign';this[_0x5d6d('0x1')]=0x0;this[_0x5d6d('0x2')]=0x0;this[_0x5d6d('0x3')]=0x0;this[_0x5d6d('0x4')]=0x0;this[_0x5d6d('0x5')]='';this[_0x5d6d('0x6')]=!![];this[_0x5d6d('0x7')]=_0x513f32[_0x5d6d('0x7')];this[_0x5d6d('0x8')]=_0x513f32[_0x5d6d('0x8')];this[_0x5d6d('0x9')]=_0x513f32[_0x5d6d('0x9')]||null;this[_0x5d6d('0xa')]=_0x513f32[_0x5d6d('0xa')]?_0x513f32[_0x5d6d('0xa')]:null;this[_0x5d6d('0xb')]=_0x513f32[_0x5d6d('0xb')];this[_0x5d6d('0xc')]=_0x513f32['dialOriginateCallerIdNumber'];this[_0x5d6d('0xd')]=_0x513f32['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x513f32['dialCongestionMaxRetry'];this[_0x5d6d('0xe')]=_0x513f32[_0x5d6d('0xe')];this[_0x5d6d('0xf')]=_0x513f32[_0x5d6d('0xf')];this[_0x5d6d('0x10')]=_0x513f32[_0x5d6d('0x10')];this['dialNoAnswerMaxRetry']=_0x513f32['dialNoAnswerMaxRetry'];this[_0x5d6d('0x11')]=_0x513f32['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x513f32[_0x5d6d('0x12')];this[_0x5d6d('0x13')]=_0x513f32[_0x5d6d('0x13')]||0x3;this[_0x5d6d('0x14')]=_0x513f32[_0x5d6d('0x14')]||0x96;this[_0x5d6d('0x15')]=_0x513f32['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x513f32[_0x5d6d('0x16')]||0x96;this[_0x5d6d('0x17')]=_0x513f32[_0x5d6d('0x17')]||0x3;this[_0x5d6d('0x18')]=_0x513f32['dialAbandonedRetryFrequency']||0x96;this[_0x5d6d('0x19')]=_0x513f32[_0x5d6d('0x19')]||0x3;this[_0x5d6d('0x1a')]=_0x513f32[_0x5d6d('0x1a')]||0x96;this[_0x5d6d('0x1b')]=_0x513f32[_0x5d6d('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x513f32[_0x5d6d('0x1c')]||0x96;this[_0x5d6d('0x1d')]=_0x513f32[_0x5d6d('0x1d')]||_0x5d6d('0x1e');this[_0x5d6d('0x1f')]=_0x513f32['dialPrefix']||undefined;this[_0x5d6d('0x20')]=_0x513f32[_0x5d6d('0x20')]||undefined;this[_0x5d6d('0x21')]=_0x513f32['dialCutDigit']||undefined;this[_0x5d6d('0x22')]=_0x513f32['TrunkBackup']?_0x513f32[_0x5d6d('0x22')]:undefined;this[_0x5d6d('0x23')]=_0x513f32[_0x5d6d('0x23')]?_0x513f32[_0x5d6d('0x23')]:undefined;this[_0x5d6d('0x24')]=_0x513f32[_0x5d6d('0x24')]?_0x513f32[_0x5d6d('0x24')]:undefined;this['SquareProject']=_0x513f32[_0x5d6d('0x25')]?_0x513f32[_0x5d6d('0x25')]:undefined;this['dialQueueProject']=_0x513f32[_0x5d6d('0x25')]?_0x513f32[_0x5d6d('0x25')]['name']:undefined;this[_0x5d6d('0x26')]=_0x513f32[_0x5d6d('0x26')]||![];this[_0x5d6d('0x27')]=_0x513f32[_0x5d6d('0x27')];this['dialAMDGreeting']=_0x513f32[_0x5d6d('0x28')];this[_0x5d6d('0x29')]=_0x513f32[_0x5d6d('0x29')];this[_0x5d6d('0x2a')]=_0x513f32[_0x5d6d('0x2a')];this[_0x5d6d('0x2b')]=_0x513f32[_0x5d6d('0x2b')];this['dialAMDBetweenWordsSilence']=_0x513f32[_0x5d6d('0x2c')];this[_0x5d6d('0x2d')]=_0x513f32[_0x5d6d('0x2d')];this[_0x5d6d('0x2e')]=_0x513f32['dialAMDSilenceThreshold'];this[_0x5d6d('0x2f')]=_0x513f32[_0x5d6d('0x2f')];}module[_0x5d6d('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 a575ae8..eb6d9de 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 _0x76d0=['type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum','connectedlinename','accountcode','context','uniqueid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x76d0,0x132));var _0x076d=function(_0x518dd9,_0x3c417c){_0x518dd9=_0x518dd9-0x0;var _0x41089f=_0x76d0[_0x518dd9];return _0x41089f;};'use strict';function Channel(){this[_0x076d('0x0')]=null;this[_0x076d('0x1')]='';this[_0x076d('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x076d('0x3')]=undefined;this[_0x076d('0x4')]=undefined;this[_0x076d('0x5')]=0x0;this[_0x076d('0x6')]='';this[_0x076d('0x7')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x076d('0x8')]=![];this[_0x076d('0x9')]=null;this[_0x076d('0xa')]=null;this[_0x076d('0xb')]=![];this[_0x076d('0xc')]=![];this[_0x076d('0xd')]='';this[_0x076d('0xe')]='';this[_0x076d('0xf')]=0x0;this[_0x076d('0x10')]=0x0;this[_0x076d('0x11')]=0x0;this[_0x076d('0x12')]=null;this[_0x076d('0x13')]=null;this[_0x076d('0x14')]=null;this['monitor']=![];this[_0x076d('0x15')]=null;this[_0x076d('0x16')]=null;this[_0x076d('0x17')]=[];this[_0x076d('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x076d('0x19')]=0x0;}module[_0x076d('0x1a')]=Channel; \ No newline at end of file +var _0x8ac5=['starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','mohtime','exports'];(function(_0xadcf36,_0x3b68ec){var _0x59ae6c=function(_0x5ecf65){while(--_0x5ecf65){_0xadcf36['push'](_0xadcf36['shift']());}};_0x59ae6c(++_0x3b68ec);}(_0x8ac5,0x105));var _0x58ac=function(_0x219e3d,_0x5e287e){_0x219e3d=_0x219e3d-0x0;var _0x28474c=_0x8ac5[_0x219e3d];return _0x28474c;};'use strict';function Channel(){this[_0x58ac('0x0')]=null;this[_0x58ac('0x1')]='';this[_0x58ac('0x2')]='';this[_0x58ac('0x3')]=0x0;this[_0x58ac('0x4')]='';this[_0x58ac('0x5')]=undefined;this[_0x58ac('0x6')]=undefined;this[_0x58ac('0x7')]=0x0;this[_0x58ac('0x8')]='';this[_0x58ac('0x9')]=0x0;this['linkedid']=0x0;this[_0x58ac('0xa')]=0x0;this[_0x58ac('0xb')]=![];this[_0x58ac('0xc')]=null;this[_0x58ac('0xd')]=null;this[_0x58ac('0xe')]=![];this[_0x58ac('0xf')]=![];this[_0x58ac('0x10')]='';this[_0x58ac('0x11')]='';this[_0x58ac('0x12')]=0x0;this[_0x58ac('0x13')]=0x0;this[_0x58ac('0x14')]=0x0;this[_0x58ac('0x15')]=null;this[_0x58ac('0x16')]=null;this['disposition']=null;this[_0x58ac('0x17')]=![];this[_0x58ac('0x18')]=null;this['queue']=null;this['monitors']=[];this[_0x58ac('0x19')]=undefined;this[_0x58ac('0x1a')]=undefined;this[_0x58ac('0x1b')]=0x0;}module[_0x58ac('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 3e08de4..f6f9ddd 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 _0x3351=['type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x1f9cbf,_0x17138c){var _0x556003=function(_0x5cffe8){while(--_0x5cffe8){_0x1f9cbf['push'](_0x1f9cbf['shift']());}};_0x556003(++_0x17138c);}(_0x3351,0x1b4));var _0x1335=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x3351[_0x2cf2e9];return _0xd3670d;};'use strict';function DeskAccount(_0x4db616){this['id']=_0x4db616['id']||0x0;this['name']=_0x4db616['name']||'';this[_0x1335('0x0')]=_0x4db616[_0x1335('0x0')]||'';this[_0x1335('0x1')]=_0x4db616[_0x1335('0x1')]||'';this[_0x1335('0x2')]=_0x4db616[_0x1335('0x2')]||'';this[_0x1335('0x3')]=_0x4db616['password']||'';this[_0x1335('0x4')]=_0x4db616[_0x1335('0x4')]||'';this[_0x1335('0x5')]=_0x4db616[_0x1335('0x5')]||'';this[_0x1335('0x6')]=_0x4db616[_0x1335('0x6')]||'';this[_0x1335('0x7')]=_0x4db616[_0x1335('0x7')]||'';this[_0x1335('0x8')]=_0x4db616[_0x1335('0x8')]||'';this[_0x1335('0x9')]=_0x4db616['serverUrl']||'';this[_0x1335('0xa')]=_0x4db616['Configurations']||{};}module[_0x1335('0xb')]=DeskAccount; \ No newline at end of file +var _0x0734=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0x0734,0xba));var _0x4073=function(_0x38c730,_0x12d280){_0x38c730=_0x38c730-0x0;var _0x223cef=_0x0734[_0x38c730];return _0x223cef;};'use strict';function DeskAccount(_0x2f727f){this['id']=_0x2f727f['id']||0x0;this[_0x4073('0x0')]=_0x2f727f[_0x4073('0x0')]||'';this[_0x4073('0x1')]=_0x2f727f[_0x4073('0x1')]||'';this['remoteUri']=_0x2f727f[_0x4073('0x2')]||'';this[_0x4073('0x3')]=_0x2f727f[_0x4073('0x3')]||'';this[_0x4073('0x4')]=_0x2f727f['password']||'';this['consumerKey']=_0x2f727f[_0x4073('0x5')]||'';this['consumerSecret']=_0x2f727f[_0x4073('0x6')]||'';this[_0x4073('0x7')]=_0x2f727f[_0x4073('0x7')]||'';this[_0x4073('0x8')]=_0x2f727f['tokenSecret']||'';this[_0x4073('0x9')]=_0x2f727f['type']||'';this[_0x4073('0xa')]=_0x2f727f[_0x4073('0xa')]||'';this[_0x4073('0xb')]=_0x2f727f[_0x4073('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2ce1d90..c22f4ed 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 _0xb032=['remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name','username','password'];(function(_0x184baf,_0x197780){var _0x5c463c=function(_0x4edc24){while(--_0x4edc24){_0x184baf['push'](_0x184baf['shift']());}};_0x5c463c(++_0x197780);}(_0xb032,0x8d));var _0x2b03=function(_0x133f69,_0x2d4632){_0x133f69=_0x133f69-0x0;var _0x3b67bb=_0xb032[_0x133f69];return _0x3b67bb;};'use strict';function Dynamics365Account(_0xac36c2){this['id']=_0xac36c2['id']||0x0;this[_0x2b03('0x0')]=_0xac36c2[_0x2b03('0x0')]||'';this[_0x2b03('0x1')]=_0xac36c2[_0x2b03('0x1')]||'';this['password']=_0xac36c2[_0x2b03('0x2')]||'';this[_0x2b03('0x3')]=_0xac36c2[_0x2b03('0x3')]||'';this[_0x2b03('0x4')]=_0xac36c2[_0x2b03('0x4')]||'';this[_0x2b03('0x5')]=_0xac36c2[_0x2b03('0x5')]||'';this['clientSecret']=_0xac36c2['clientSecret']||{};this[_0x2b03('0x6')]=_0xac36c2[_0x2b03('0x6')]||'';this['Configurations']=_0xac36c2[_0x2b03('0x7')]||{};}module[_0x2b03('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x07eb=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0xe3b3dd,_0x527bb5){var _0x58a400=function(_0x50d950){while(--_0x50d950){_0xe3b3dd['push'](_0xe3b3dd['shift']());}};_0x58a400(++_0x527bb5);}(_0x07eb,0xb5));var _0xb07e=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x07eb[_0x31b5b2];return _0x364f13;};'use strict';function Dynamics365Account(_0x25b09f){this['id']=_0x25b09f['id']||0x0;this[_0xb07e('0x0')]=_0x25b09f[_0xb07e('0x0')]||'';this[_0xb07e('0x1')]=_0x25b09f[_0xb07e('0x1')]||'';this[_0xb07e('0x2')]=_0x25b09f[_0xb07e('0x2')]||'';this[_0xb07e('0x3')]=_0x25b09f[_0xb07e('0x3')]||'';this[_0xb07e('0x4')]=_0x25b09f[_0xb07e('0x4')]||'';this[_0xb07e('0x5')]=_0x25b09f['clientId']||'';this[_0xb07e('0x6')]=_0x25b09f['clientSecret']||{};this[_0xb07e('0x7')]=_0x25b09f['serverUrl']||'';this[_0xb07e('0x8')]=_0x25b09f[_0xb07e('0x8')]||{};}module[_0xb07e('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 b6b05f5..f2b32dc 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 _0xebaa=['description','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x4f8f27,_0x34cb4b){var _0x2789ff=function(_0x51b461){while(--_0x51b461){_0x4f8f27['push'](_0x4f8f27['shift']());}};_0x2789ff(++_0x34cb4b);}(_0xebaa,0x14f));var _0xaeba=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xebaa[_0x27af45];return _0x18df21;};'use strict';function FaxAccount(_0x41f38f){this['id']=_0x41f38f['id']||0x0;this[_0xaeba('0x0')]=_0x41f38f[_0xaeba('0x0')]||'';this[_0xaeba('0x1')]=_0x41f38f['description'];this['ecm']=_0x41f38f['ecm'];this['headerinfo']=_0x41f38f['headerinfo'];this[_0xaeba('0x2')]=_0x41f38f[_0xaeba('0x2')];this[_0xaeba('0x3')]=_0x41f38f[_0xaeba('0x3')]||0x960;this[_0xaeba('0x4')]=_0x41f38f[_0xaeba('0x4')]||0x3840;this[_0xaeba('0x5')]=_0x41f38f['modem']||_0xaeba('0x6');this[_0xaeba('0x7')]=_0x41f38f['gateway']||'no';this[_0xaeba('0x8')]=_0x41f38f[_0xaeba('0x8')]||'no';this[_0xaeba('0x9')]=_0x41f38f[_0xaeba('0x9')]||0x1388;this[_0xaeba('0xa')]=_0x41f38f[_0xaeba('0xa')]||_0xaeba('0xb');this[_0xaeba('0xc')]=_0x41f38f['Trunk']?_0x41f38f['Trunk']:undefined;this[_0xaeba('0xd')]=_0x41f38f[_0xaeba('0xd')];this[_0xaeba('0xe')]=_0x41f38f[_0xaeba('0xe')];}module[_0xaeba('0xf')]=FaxAccount; \ No newline at end of file +var _0x9527=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','faxdetect','tech'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x9527,0x135));var _0x7952=function(_0x445a48,_0x4fa90b){_0x445a48=_0x445a48-0x0;var _0x3ada70=_0x9527[_0x445a48];return _0x3ada70;};'use strict';function FaxAccount(_0xd1912){this['id']=_0xd1912['id']||0x0;this[_0x7952('0x0')]=_0xd1912[_0x7952('0x0')]||'';this[_0x7952('0x1')]=_0xd1912['description'];this[_0x7952('0x2')]=_0xd1912[_0x7952('0x2')];this[_0x7952('0x3')]=_0xd1912[_0x7952('0x3')];this[_0x7952('0x4')]=_0xd1912['localstationid'];this[_0x7952('0x5')]=_0xd1912[_0x7952('0x5')]||0x960;this['maxrate']=_0xd1912['maxrate']||0x3840;this['modem']=_0xd1912[_0x7952('0x6')]||_0x7952('0x7');this[_0x7952('0x8')]=_0xd1912[_0x7952('0x8')]||'no';this[_0x7952('0x9')]=_0xd1912[_0x7952('0x9')]||'no';this['t38timeout']=_0xd1912['t38timeout']||0x1388;this['tech']=_0xd1912[_0x7952('0xa')]||_0x7952('0xb');this[_0x7952('0xc')]=_0xd1912[_0x7952('0xc')]?_0xd1912[_0x7952('0xc')]:undefined;this['ListId']=_0xd1912[_0x7952('0xd')];this[_0x7952('0xe')]=_0xd1912['key'];}module[_0x7952('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 2797c5a..ca06950 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 _0x77b8=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x77b8,0xc0));var _0x877b=function(_0x41ef2e,_0x2de12c){_0x41ef2e=_0x41ef2e-0x0;var _0x2f0935=_0x77b8[_0x41ef2e];return _0x2f0935;};'use strict';function FreshdeskAccount(_0x53152d){this['id']=_0x53152d['id']||0x0;this['name']=_0x53152d[_0x877b('0x0')]||'';this[_0x877b('0x1')]=_0x53152d['username']||'';this[_0x877b('0x2')]=_0x53152d['token']||'';this[_0x877b('0x3')]=_0x53152d[_0x877b('0x3')]||'';this[_0x877b('0x4')]=_0x53152d[_0x877b('0x4')]||'';this[_0x877b('0x5')]=_0x53152d['Configurations']||{};}module[_0x877b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6cc5=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0xdf3fd0,_0x403c5f){var _0x2ff39e=function(_0x15ea33){while(--_0x15ea33){_0xdf3fd0['push'](_0xdf3fd0['shift']());}};_0x2ff39e(++_0x403c5f);}(_0x6cc5,0x1b0));var _0x56cc=function(_0x332d1e,_0x5f0588){_0x332d1e=_0x332d1e-0x0;var _0x416f93=_0x6cc5[_0x332d1e];return _0x416f93;};'use strict';function FreshdeskAccount(_0x3c8175){this['id']=_0x3c8175['id']||0x0;this[_0x56cc('0x0')]=_0x3c8175[_0x56cc('0x0')]||'';this[_0x56cc('0x1')]=_0x3c8175[_0x56cc('0x1')]||'';this[_0x56cc('0x2')]=_0x3c8175[_0x56cc('0x3')]||'';this[_0x56cc('0x4')]=_0x3c8175['remoteUri']||'';this[_0x56cc('0x5')]=_0x3c8175[_0x56cc('0x5')]||'';this['Configurations']=_0x3c8175[_0x56cc('0x6')]||{};}module[_0x56cc('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 27d52b3..b68ed59 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 _0x4c8f=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4ac271,_0x386c78){var _0x5c92f5=function(_0x101028){while(--_0x101028){_0x4ac271['push'](_0x4ac271['shift']());}};_0x5c92f5(++_0x386c78);}(_0x4c8f,0x133));var _0xf4c8=function(_0x3a9636,_0x20b297){_0x3a9636=_0x3a9636-0x0;var _0x14cec7=_0x4c8f[_0x3a9636];return _0x14cec7;};'use strict';function FreshsalesAccount(_0x35b64b){this['id']=_0x35b64b['id']||0x0;this[_0xf4c8('0x0')]=_0x35b64b['name']||'';this[_0xf4c8('0x1')]=_0x35b64b[_0xf4c8('0x1')]||'';this['apiKey']=_0x35b64b[_0xf4c8('0x2')]||'';this[_0xf4c8('0x3')]=_0x35b64b[_0xf4c8('0x3')]||'';this[_0xf4c8('0x4')]=_0x35b64b[_0xf4c8('0x4')]||'';this[_0xf4c8('0x5')]=_0x35b64b['Configurations']||{};}module[_0xf4c8('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xad4b=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xad4b,0x193));var _0xbad4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xad4b[_0x334841];return _0x5beb4b;};'use strict';function FreshsalesAccount(_0x33a655){this['id']=_0x33a655['id']||0x0;this[_0xbad4('0x0')]=_0x33a655['name']||'';this[_0xbad4('0x1')]=_0x33a655[_0xbad4('0x1')]||'';this[_0xbad4('0x2')]=_0x33a655[_0xbad4('0x3')]||'';this['remoteUri']=_0x33a655[_0xbad4('0x4')]||'';this['serverUrl']=_0x33a655[_0xbad4('0x5')]||'';this[_0xbad4('0x6')]=_0x33a655['Configurations']||{};}module[_0xbad4('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9784bb4..ccaccde 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 _0x3662=['calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','priority','holdtime','assigned','variables','exports','uniqueid','calleridnum'];(function(_0x21e095,_0x5bdf11){var _0x3bdc15=function(_0x52ebb1){while(--_0x52ebb1){_0x21e095['push'](_0x21e095['shift']());}};_0x3bdc15(++_0x5bdf11);}(_0x3662,0x91));var _0x2366=function(_0x27403a,_0x40e4e4){_0x27403a=_0x27403a-0x0;var _0x43be9a=_0x3662[_0x27403a];return _0x43be9a;};'use strict';function QueueReport(){this['type']='inbound';this[_0x2366('0x0')]='';this[_0x2366('0x1')]='';this[_0x2366('0x2')]='';this['queue']='';this[_0x2366('0x3')]=null;this[_0x2366('0x4')]=null;this[_0x2366('0x5')]=0x1;this[_0x2366('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x2366('0x7')]=null;this['queuecallercomplete']=![];this[_0x2366('0x8')]=null;this[_0x2366('0x9')]=![];this[_0x2366('0xa')]=null;this[_0x2366('0xb')]=0x1;this[_0x2366('0xc')]='';this[_0x2366('0xd')]='';this['connectedlinename']='';this['accountcode']='';this[_0x2366('0xe')]='';this[_0x2366('0xf')]='';this[_0x2366('0x10')]='';this[_0x2366('0x11')]=0x0;this[_0x2366('0x12')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x2366('0x13')]={};}module[_0x2366('0x14')]=QueueReport; \ No newline at end of file +var _0x4c3e=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','variables','exports','inbound','calleridnum','calleridname','position'];(function(_0x5f0043,_0x249a1a){var _0x16b65a=function(_0xdd24ff){while(--_0xdd24ff){_0x5f0043['push'](_0x5f0043['shift']());}};_0x16b65a(++_0x249a1a);}(_0x4c3e,0x18b));var _0xe4c3=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4c3e[_0x40ac5e];return _0x2839d6;};'use strict';function QueueReport(){this['type']=_0xe4c3('0x0');this['uniqueid']='';this[_0xe4c3('0x1')]='';this[_0xe4c3('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xe4c3('0x3')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xe4c3('0x4')]=![];this[_0xe4c3('0x5')]=null;this[_0xe4c3('0x6')]=![];this['queuecallerexitAt']=null;this[_0xe4c3('0x7')]=0x1;this[_0xe4c3('0x8')]='';this[_0xe4c3('0x9')]='';this[_0xe4c3('0xa')]='';this[_0xe4c3('0xb')]='';this['context']='';this[_0xe4c3('0xc')]='';this[_0xe4c3('0xd')]='';this[_0xe4c3('0xe')]=0x0;this[_0xe4c3('0xf')]=![];this[_0xe4c3('0x10')]='';this['mohtime']=0x0;this[_0xe4c3('0x11')]={};}module[_0xe4c3('0x12')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 543b81a..df4084f 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 _0xc63c=['clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0xc63c,0x80));var _0xcc63=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xc63c[_0x421cf8];return _0x145c48;};'use strict';function SalesforceAccount(_0x5e570c){this['id']=_0x5e570c['id']||0x0;this[_0xcc63('0x0')]=_0x5e570c[_0xcc63('0x0')]||'';this[_0xcc63('0x1')]=_0x5e570c['username']||'';this[_0xcc63('0x2')]=_0x5e570c[_0xcc63('0x2')]||'';this[_0xcc63('0x3')]=_0x5e570c[_0xcc63('0x3')]||'';this[_0xcc63('0x4')]=_0x5e570c[_0xcc63('0x4')]||'';this[_0xcc63('0x5')]=_0x5e570c[_0xcc63('0x5')]||'';this['securityToken']=_0x5e570c['securityToken']||'';this[_0xcc63('0x6')]=_0x5e570c['type']||_0xcc63('0x7');this[_0xcc63('0x8')]=_0x5e570c['serverUrl']||'';this[_0xcc63('0x9')]=_0x5e570c[_0xcc63('0x9')]||{};}module[_0xcc63('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x9f5e=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9f5e,0x149));var _0xe9f5=function(_0x4aaa91,_0x4fcbb1){_0x4aaa91=_0x4aaa91-0x0;var _0x17eb83=_0x9f5e[_0x4aaa91];return _0x17eb83;};'use strict';function SalesforceAccount(_0xf2d4e2){this['id']=_0xf2d4e2['id']||0x0;this[_0xe9f5('0x0')]=_0xf2d4e2[_0xe9f5('0x0')]||'';this[_0xe9f5('0x1')]=_0xf2d4e2[_0xe9f5('0x1')]||'';this[_0xe9f5('0x2')]=_0xf2d4e2['remoteUri']||'';this['password']=_0xf2d4e2[_0xe9f5('0x3')]||'';this['clientId']=_0xf2d4e2[_0xe9f5('0x4')]||'';this['clientSecret']=_0xf2d4e2[_0xe9f5('0x5')]||'';this['securityToken']=_0xf2d4e2[_0xe9f5('0x6')]||'';this[_0xe9f5('0x7')]=_0xf2d4e2[_0xe9f5('0x7')]||_0xe9f5('0x8');this[_0xe9f5('0x9')]=_0xf2d4e2[_0xe9f5('0x9')]||'';this[_0xe9f5('0xa')]=_0xf2d4e2[_0xe9f5('0xa')]||{};}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 1bcab24..c42c123 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 _0xa8c6=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xa8c6,0x96));var _0x6a8c=function(_0x1556c7,_0x204ce5){_0x1556c7=_0x1556c7-0x0;var _0x825624=_0xa8c6[_0x1556c7];return _0x825624;};'use strict';function ServicenowAccount(_0x1669d3){this['id']=_0x1669d3['id']||0x0;this[_0x6a8c('0x0')]=_0x1669d3[_0x6a8c('0x0')]||'';this[_0x6a8c('0x1')]=_0x1669d3[_0x6a8c('0x1')]||'';this[_0x6a8c('0x2')]=_0x1669d3[_0x6a8c('0x2')]||'';this[_0x6a8c('0x3')]=_0x1669d3[_0x6a8c('0x3')]||'';this['serverUrl']=_0x1669d3[_0x6a8c('0x4')]||'';this[_0x6a8c('0x5')]=_0x1669d3[_0x6a8c('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x8cf2=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3bde7b,_0x1c1cfd){var _0x5b85d6=function(_0x566924){while(--_0x566924){_0x3bde7b['push'](_0x3bde7b['shift']());}};_0x5b85d6(++_0x1c1cfd);}(_0x8cf2,0x108));var _0x28cf=function(_0x1f477b,_0x59b018){_0x1f477b=_0x1f477b-0x0;var _0x2620d9=_0x8cf2[_0x1f477b];return _0x2620d9;};'use strict';function ServicenowAccount(_0x23f68d){this['id']=_0x23f68d['id']||0x0;this[_0x28cf('0x0')]=_0x23f68d[_0x28cf('0x0')]||'';this[_0x28cf('0x1')]=_0x23f68d[_0x28cf('0x1')]||'';this['password']=_0x23f68d[_0x28cf('0x2')]||'';this[_0x28cf('0x3')]=_0x23f68d[_0x28cf('0x3')]||'';this[_0x28cf('0x4')]=_0x23f68d[_0x28cf('0x4')]||'';this[_0x28cf('0x5')]=_0x23f68d[_0x28cf('0x5')]||{};}module[_0x28cf('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 c8d275a..63346dd 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 _0x4a6e=['password','remoteUri','serverUrl','Configurations','username'];(function(_0x179aea,_0x53813d){var _0x19513a=function(_0x3f3d01){while(--_0x3f3d01){_0x179aea['push'](_0x179aea['shift']());}};_0x19513a(++_0x53813d);}(_0x4a6e,0x17b));var _0xe4a6=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x4a6e[_0x1e1965];return _0x1a2e96;};'use strict';function SugarcrmAccount(_0x4afecd){this['id']=_0x4afecd['id']||0x0;this['name']=_0x4afecd['name']||'';this['username']=_0x4afecd[_0xe4a6('0x0')]||'';this[_0xe4a6('0x1')]=_0x4afecd[_0xe4a6('0x1')]||'';this[_0xe4a6('0x2')]=_0x4afecd['remoteUri']||'';this[_0xe4a6('0x3')]=_0x4afecd[_0xe4a6('0x3')]||'';this[_0xe4a6('0x4')]=_0x4afecd[_0xe4a6('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x776e=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x3e4554,_0x27b9ca){var _0x37c433=function(_0x1a5eba){while(--_0x1a5eba){_0x3e4554['push'](_0x3e4554['shift']());}};_0x37c433(++_0x27b9ca);}(_0x776e,0xc9));var _0xe776=function(_0x2f7e50,_0x1053b8){_0x2f7e50=_0x2f7e50-0x0;var _0x59f3cd=_0x776e[_0x2f7e50];return _0x59f3cd;};'use strict';function SugarcrmAccount(_0x3bff96){this['id']=_0x3bff96['id']||0x0;this[_0xe776('0x0')]=_0x3bff96['name']||'';this['username']=_0x3bff96[_0xe776('0x1')]||'';this[_0xe776('0x2')]=_0x3bff96['password']||'';this['remoteUri']=_0x3bff96[_0xe776('0x3')]||'';this[_0xe776('0x4')]=_0x3bff96[_0xe776('0x4')]||'';this['Configurations']=_0x3bff96['Configurations']||{};}module[_0xe776('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 07494b7..54e49a2 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 _0x41f8=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x2d9bb1,_0x43c5ea){var _0xa725f1=function(_0x4b212f){while(--_0x4b212f){_0x2d9bb1['push'](_0x2d9bb1['shift']());}};_0xa725f1(++_0x43c5ea);}(_0x41f8,0x14b));var _0x841f=function(_0x5478cd,_0x1c5e89){_0x5478cd=_0x5478cd-0x0;var _0x1f2099=_0x41f8[_0x5478cd];return _0x1f2099;};'use strict';function Telephone(_0x4fac87){this['id']=_0x4fac87['id']||0x0;this[_0x841f('0x0')]=_0x4fac87[_0x841f('0x0')]||'';this[_0x841f('0x1')]=_0x4fac87[_0x841f('0x1')]||'';this[_0x841f('0x2')]=_0x841f('0x3');this[_0x841f('0x4')]=0x0;this[_0x841f('0x5')]=_0x841f('0x3');this[_0x841f('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xf2d4=['address','accountcode','state','unknown','stateTime','status'];(function(_0x365d3d,_0x2c1c9e){var _0x2fa91a=function(_0x231e41){while(--_0x231e41){_0x365d3d['push'](_0x365d3d['shift']());}};_0x2fa91a(++_0x2c1c9e);}(_0xf2d4,0xcd));var _0x4f2d=function(_0xf72ad4,_0x5721af){_0xf72ad4=_0xf72ad4-0x0;var _0x51d127=_0xf2d4[_0xf72ad4];return _0x51d127;};'use strict';function Telephone(_0x5c6186){this['id']=_0x5c6186['id']||0x0;this['name']=_0x5c6186['name']||'';this[_0x4f2d('0x0')]=_0x5c6186[_0x4f2d('0x0')]||'';this[_0x4f2d('0x1')]=_0x4f2d('0x2');this[_0x4f2d('0x3')]=0x0;this[_0x4f2d('0x4')]=_0x4f2d('0x2');this[_0x4f2d('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 90a13bc..aa71686 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 _0xc0c4=['html','exports','name'];(function(_0x1ce1f7,_0x2930a2){var _0x15ba94=function(_0x2997bd){while(--_0x2997bd){_0x1ce1f7['push'](_0x1ce1f7['shift']());}};_0x15ba94(++_0x2930a2);}(_0xc0c4,0x1a3));var _0x4c0c=function(_0x4fcde8,_0x19b8b3){_0x4fcde8=_0x4fcde8-0x0;var _0x4355ba=_0xc0c4[_0x4fcde8];return _0x4355ba;};'use strict';function template(_0x33c762){this['id']=_0x33c762['id']||0x0;this[_0x4c0c('0x0')]=_0x33c762[_0x4c0c('0x0')]||'';this[_0x4c0c('0x1')]=_0x33c762[_0x4c0c('0x1')]||'';}module[_0x4c0c('0x2')]=template; \ No newline at end of file +var _0x0a16=['name','html'];(function(_0x9f2d59,_0x4ca693){var _0x46a405=function(_0x515834){while(--_0x515834){_0x9f2d59['push'](_0x9f2d59['shift']());}};_0x46a405(++_0x4ca693);}(_0x0a16,0x10e));var _0x60a1=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0x0a16[_0x5ea2f9];return _0x36e586;};'use strict';function template(_0x36520e){this['id']=_0x36520e['id']||0x0;this[_0x60a1('0x0')]=_0x36520e[_0x60a1('0x0')]||'';this[_0x60a1('0x1')]=_0x36520e[_0x60a1('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 18cb57b..aa12247 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 _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x53042a,_0x36cc4d){var _0x321b5f=function(_0x2e8cc9){while(--_0x2e8cc9){_0x53042a['push'](_0x53042a['shift']());}};_0x321b5f(++_0x36cc4d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x4b84[_0x14a0a0];return _0x56b651;};'use strict';function Trigger(_0x90ff31){this['id']=_0x90ff31['id']||0x0;this[_0x44b8('0x0')]=_0x90ff31['name']||'';this['channel']=_0x90ff31[_0x44b8('0x1')]||'voice';this['status']=_0x90ff31[_0x44b8('0x2')]||![];this[_0x44b8('0x3')]=_0x90ff31[_0x44b8('0x3')]||[];this['AnyConditions']=_0x90ff31['AnyConditions']||[];this['Actions']=_0x90ff31[_0x44b8('0x4')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x3379aa,_0x3aba7b){var _0x3da6ef=function(_0x82eda8){while(--_0x82eda8){_0x3379aa['push'](_0x3379aa['shift']());}};_0x3da6ef(++_0x3aba7b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x218c0c,_0x2b21e3){_0x218c0c=_0x218c0c-0x0;var _0xf0347d=_0xf3cd[_0x218c0c];return _0xf0347d;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 993ea5d..4742207 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 _0x2064=['address','active','name','unknown','status','registry','indexOf','split','port','domainport','stateRegistry','registrationtime'];(function(_0x5f05e0,_0x4e3608){var _0x398b07=function(_0x3be311){while(--_0x3be311){_0x5f05e0['push'](_0x5f05e0['shift']());}};_0x398b07(++_0x4e3608);}(_0x2064,0x79));var _0x4206=function(_0x45c1cc,_0x4ff8e7){_0x45c1cc=_0x45c1cc-0x0;var _0x5505c9=_0x2064[_0x45c1cc];return _0x5505c9;};'use strict';function Trunk(_0x463504){this['id']=_0x463504['id']||0x0;this[_0x4206('0x0')]=_0x463504[_0x4206('0x0')]||![];this[_0x4206('0x1')]=_0x463504[_0x4206('0x1')]||'';this['state']=_0x4206('0x2');this['stateTime']=0x0;this[_0x4206('0x3')]=_0x4206('0x2');this[_0x4206('0x4')]=_0x463504[_0x4206('0x4')]&&_0x463504['registry'][_0x4206('0x5')](':')?_0x463504[_0x4206('0x4')][_0x4206('0x6')](':')[0x0]:'';this['host']='';this[_0x4206('0x7')]='';this['domain']='';this[_0x4206('0x8')]='';this['refresh']='';this[_0x4206('0x9')]=_0x4206('0x2');this[_0x4206('0xa')]='';this[_0x4206('0xb')]='';}module['exports']=Trunk; \ No newline at end of file +var _0xcb95=['address','exports','active','state','unknown','stateTime','registry','host','port','domain','domainport','stateRegistry','registrationtime'];(function(_0x44ff41,_0x344caf){var _0x37a1bc=function(_0x42c148){while(--_0x42c148){_0x44ff41['push'](_0x44ff41['shift']());}};_0x37a1bc(++_0x344caf);}(_0xcb95,0xc5));var _0x5cb9=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xcb95[_0x5f0089];return _0x193892;};'use strict';function Trunk(_0x45e782){this['id']=_0x45e782['id']||0x0;this[_0x5cb9('0x0')]=_0x45e782[_0x5cb9('0x0')]||![];this['name']=_0x45e782['name']||'';this[_0x5cb9('0x1')]=_0x5cb9('0x2');this[_0x5cb9('0x3')]=0x0;this['status']=_0x5cb9('0x2');this[_0x5cb9('0x4')]=_0x45e782['registry']&&_0x45e782[_0x5cb9('0x4')]['indexOf'](':')?_0x45e782[_0x5cb9('0x4')]['split'](':')[0x0]:'';this[_0x5cb9('0x5')]='';this[_0x5cb9('0x6')]='';this[_0x5cb9('0x7')]='';this[_0x5cb9('0x8')]='';this['refresh']='';this[_0x5cb9('0x9')]=_0x5cb9('0x2');this[_0x5cb9('0xa')]='';this[_0x5cb9('0xb')]='';}module[_0x5cb9('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ba570b7..621c063 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 _0x272d=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x272d,0x10d));var _0xd272=function(_0x204dc6,_0xf19d46){_0x204dc6=_0x204dc6-0x0;var _0x24a5eb=_0x272d[_0x204dc6];return _0x24a5eb;};'use strict';function voiceExtension(_0x2cce49){this['id']=_0x2cce49['id']||0x0;this[_0xd272('0x0')]=_0x2cce49[_0xd272('0x0')]||'';this[_0xd272('0x1')]=_0x2cce49['recordingFormat']||_0xd272('0x2');this[_0xd272('0x3')]=_0x2cce49[_0xd272('0x3')]||![];}module[_0xd272('0x4')]=voiceExtension; \ No newline at end of file +var _0xb3c7=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xb3c7,0x1c9));var _0x7b3c=function(_0x4fce12,_0x47faae){_0x4fce12=_0x4fce12-0x0;var _0x3e95e6=_0xb3c7[_0x4fce12];return _0x3e95e6;};'use strict';function voiceExtension(_0x4c62e5){this['id']=_0x4c62e5['id']||0x0;this[_0x7b3c('0x0')]=_0x4c62e5['exten']||'';this[_0x7b3c('0x1')]=_0x4c62e5[_0x7b3c('0x1')]||_0x7b3c('0x2');this[_0x7b3c('0x3')]=_0x4c62e5[_0x7b3c('0x3')]||![];}module[_0x7b3c('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index be1a712..c142cd6 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 _0x15fe=['dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber'];(function(_0x485bad,_0x21c418){var _0x523c91=function(_0x7393a4){while(--_0x7393a4){_0x485bad['push'](_0x485bad['shift']());}};_0x523c91(++_0x21c418);}(_0x15fe,0x142));var _0xe15f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15fe[_0x14add3];return _0x4a174f;};'use strict';var statusDesc=[_0xe15f('0x0'),_0xe15f('0x1'),_0xe15f('0x2'),'busy',_0xe15f('0x3'),_0xe15f('0x4'),'ringing',_0xe15f('0x5'),_0xe15f('0x6')];var monitorFormat={'wav':'wav','wav49':_0xe15f('0x7'),'gsm':_0xe15f('0x8')};var strategy={'rrmemory':_0xe15f('0x9'),'roundrobin':_0xe15f('0xa')};function VoiceQueue(_0x351c93){this['id']=_0x351c93['id']||0x0;this[_0xe15f('0xb')]=_0x351c93[_0xe15f('0xb')]||'';this[_0xe15f('0xc')]=_0x351c93['monitor_format']||'';this[_0xe15f('0xd')]=_0x351c93[_0xe15f('0xd')]||_0xe15f('0xe');this[_0xe15f('0xf')]=0x0;this[_0xe15f('0x10')]=0x0;this[_0xe15f('0x11')]=0x0;this[_0xe15f('0x12')]=0x0;this[_0xe15f('0x13')]=0x0;this[_0xe15f('0x14')]=0x0;this[_0xe15f('0x15')]=0x0;this[_0xe15f('0x16')]=0x0;this[_0xe15f('0x17')]=0x0;this[_0xe15f('0x18')]=0x0;this['available']=0x0;this[_0xe15f('0x19')]=_0x351c93['acw']||![];this['acwTimeout']=_0x351c93['acwTimeout']||0xa;this['autopause']=_0x351c93[_0xe15f('0x1a')]||'no';this[_0xe15f('0x1b')]=!![];this[_0xe15f('0x1c')]='';this[_0xe15f('0x1d')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x351c93[_0xe15f('0x1e')]||null;this[_0xe15f('0x1f')]=_0x351c93[_0xe15f('0x1f')]?_0x351c93['dialGlobalInterval']:null;this[_0xe15f('0x20')]=_0x351c93['dialActive'];this[_0xe15f('0x21')]=_0x351c93['dialMethod']||_0xe15f('0x22');this[_0xe15f('0x23')]=_0x351c93['dialLimitChannel']||0x0;this[_0xe15f('0x24')]=_0x351c93[_0xe15f('0x24')]||0x0;this[_0xe15f('0x25')]=_0x351c93[_0xe15f('0x25')]||0x1;this['dialPredictiveOptimization']=_0x351c93[_0xe15f('0x26')]||_0xe15f('0x27');this['dialPredictiveOptimizationPercentage']=_0x351c93['dialPredictiveOptimizationPercentage']||0.03;this[_0xe15f('0x28')]=_0x351c93[_0xe15f('0x28')]||0x258;this[_0xe15f('0x29')]=_0x351c93[_0xe15f('0x29')]||_0xe15f('0x2a');this[_0xe15f('0x2b')]=_0x351c93[_0xe15f('0x2b')]||_0xe15f('0x2a');this[_0xe15f('0x2c')]=_0x351c93['dialOriginateTimeout']||0x1e;this[_0xe15f('0x2d')]=_0x351c93[_0xe15f('0x2d')]||_0xe15f('0x2e');this[_0xe15f('0x2f')]=_0x351c93[_0xe15f('0x2f')]||0x3;this['dialQueueProject']=_0x351c93['dialQueueProject']||undefined;this[_0xe15f('0x30')]=_0x351c93[_0xe15f('0x30')]||0x3;this[_0xe15f('0x31')]=_0x351c93[_0xe15f('0x31')]||0x96;this[_0xe15f('0x32')]=_0x351c93[_0xe15f('0x32')]||0x3;this[_0xe15f('0x33')]=_0x351c93['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x351c93[_0xe15f('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x351c93[_0xe15f('0x35')]||0x96;this[_0xe15f('0x36')]=_0x351c93['dialNoSuchNumberMaxRetry']||0x3;this[_0xe15f('0x37')]=_0x351c93['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe15f('0x38')]=_0x351c93['dialDropMaxRetry']||0x3;this[_0xe15f('0x39')]=_0x351c93[_0xe15f('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x351c93[_0xe15f('0x3a')]||0x3;this[_0xe15f('0x3b')]=_0x351c93[_0xe15f('0x3b')]||0x96;this[_0xe15f('0x3c')]=_0x351c93[_0xe15f('0x3c')]||0x3;this[_0xe15f('0x3d')]=_0x351c93[_0xe15f('0x3d')]||0x96;this[_0xe15f('0x3e')]=_0x351c93[_0xe15f('0x3e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x351c93[_0xe15f('0x3f')]||0x96;this[_0xe15f('0x40')]=_0x351c93[_0xe15f('0x40')]||0x4;this['Trunk']=_0x351c93[_0xe15f('0x41')]?_0x351c93[_0xe15f('0x41')]:undefined;this[_0xe15f('0x42')]=_0x351c93['TrunkBackup']?_0x351c93[_0xe15f('0x42')]:undefined;this[_0xe15f('0x43')]=_0x351c93['dialPrefix']||undefined;this[_0xe15f('0x44')]=_0x351c93[_0xe15f('0x44')]?_0x351c93[_0xe15f('0x44')]:undefined;this[_0xe15f('0x45')]=_0x351c93[_0xe15f('0x45')]||_0xe15f('0x46');this[_0xe15f('0x47')]=_0x351c93[_0xe15f('0x47')]||undefined;this[_0xe15f('0x48')]=_0x351c93[_0xe15f('0x48')]||undefined;this[_0xe15f('0x49')]=strategy[_0x351c93['strategy']]||'rrmemory';this[_0xe15f('0x4a')]=!![];this[_0xe15f('0x4b')]=_0x351c93[_0xe15f('0x4b')]||![];this[_0xe15f('0x4c')]=_0x351c93['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x351c93[_0xe15f('0x4d')];this['dialAMDAfterGreetingSilence']=_0x351c93[_0xe15f('0x4e')];this[_0xe15f('0x4f')]=_0x351c93['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x351c93[_0xe15f('0x50')];this['dialAMDBetweenWordsSilence']=_0x351c93[_0xe15f('0x51')];this[_0xe15f('0x52')]=_0x351c93[_0xe15f('0x52')];this['dialAMDSilenceThreshold']=_0x351c93[_0xe15f('0x53')];this[_0xe15f('0x54')]=_0x351c93[_0xe15f('0x54')];this['outboundRejectCallsDay']=0x0;this[_0xe15f('0x55')]=0x0;this[_0xe15f('0x56')]=_0x351c93[_0xe15f('0x56')];this[_0xe15f('0x57')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xe15f('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xe15f('0x59')]=0x0;this[_0xe15f('0x5a')]=0x0;this[_0xe15f('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xe15f('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xe15f('0x5d')]=0x0;this[_0xe15f('0x5e')]=0x0;this[_0xe15f('0x5f')]=0x0;this[_0xe15f('0x60')]=undefined;this[_0xe15f('0x61')]=undefined;this[_0xe15f('0x62')]=undefined;this[_0xe15f('0x63')]=1.05;this[_0xe15f('0x64')]=0x0;this[_0xe15f('0x65')]=0x0;this[_0xe15f('0x66')]=0x0;this[_0xe15f('0x67')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xe15f('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xe15f('0x69')]=_0x351c93[_0xe15f('0x6a')]||0x14;this[_0xe15f('0x6b')]=_0x351c93[_0xe15f('0x6a')]||0xa;this[_0xe15f('0x6c')]=0x0;this[_0xe15f('0x6d')]=0x0;this[_0xe15f('0x6e')]=0x1;this[_0xe15f('0x6f')]=0x0;this[_0xe15f('0x70')]=0x0;this[_0xe15f('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xe15f('0x72')]=_0x351c93[_0xe15f('0x72')]||0x1e;this[_0xe15f('0x73')]=_0x351c93[_0xe15f('0x73')]||![];this[_0xe15f('0x74')]=_0x351c93[_0xe15f('0x74')]||undefined;this[_0xe15f('0x75')]=_0x351c93[_0xe15f('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x351c93[_0xe15f('0x76')]||![];this[_0xe15f('0xc')]=monitorFormat[_0x351c93[_0xe15f('0xc')]]?monitorFormat[_0x351c93[_0xe15f('0xc')]]:undefined;this[_0xe15f('0x77')]=_0x351c93[_0xe15f('0x77')]||![];this['mandatoryDispositionPause']=_0x351c93[_0xe15f('0x78')]?_0x351c93[_0xe15f('0x78')]:undefined;}module[_0xe15f('0x79')]=VoiceQueue; \ No newline at end of file +var _0xc9e5=['dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','unavailable','ringing','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x14a34f,_0x250eec){var _0x32676c=function(_0x414e9e){while(--_0x414e9e){_0x14a34f['push'](_0x14a34f['shift']());}};_0x32676c(++_0x250eec);}(_0xc9e5,0x1aa));var _0x5c9e=function(_0x256749,_0x58f2b8){_0x256749=_0x256749-0x0;var _0x5b3e19=_0xc9e5[_0x256749];return _0x5b3e19;};'use strict';var statusDesc=[_0x5c9e('0x0'),_0x5c9e('0x1'),'inuse','busy',_0x5c9e('0x2'),_0x5c9e('0x3'),_0x5c9e('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0x5c9e('0x5'),'wav49':_0x5c9e('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0x5c9e('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x4aa7f5){this['id']=_0x4aa7f5['id']||0x0;this[_0x5c9e('0x8')]=_0x4aa7f5[_0x5c9e('0x8')]||'';this[_0x5c9e('0x9')]=_0x4aa7f5[_0x5c9e('0x9')]||'';this[_0x5c9e('0xa')]=_0x4aa7f5[_0x5c9e('0xa')]||_0x5c9e('0xb');this[_0x5c9e('0xc')]=0x0;this[_0x5c9e('0xd')]=0x0;this[_0x5c9e('0xe')]=0x0;this[_0x5c9e('0xf')]=0x0;this[_0x5c9e('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x5c9e('0x11')]=0x0;this['unmanaged']=0x0;this[_0x5c9e('0x12')]=0x0;this['loggedIn']=0x0;this[_0x5c9e('0x13')]=0x0;this[_0x5c9e('0x14')]=_0x4aa7f5[_0x5c9e('0x14')]||![];this[_0x5c9e('0x15')]=_0x4aa7f5[_0x5c9e('0x15')]||0xa;this[_0x5c9e('0x16')]=_0x4aa7f5[_0x5c9e('0x16')]||'no';this[_0x5c9e('0x17')]=!![];this[_0x5c9e('0x18')]='';this[_0x5c9e('0x19')]=0x0;this['temp']=0x0;this[_0x5c9e('0x1a')]=_0x4aa7f5[_0x5c9e('0x1a')]||null;this[_0x5c9e('0x1b')]=_0x4aa7f5[_0x5c9e('0x1b')]?_0x4aa7f5[_0x5c9e('0x1b')]:null;this[_0x5c9e('0x1c')]=_0x4aa7f5['dialActive'];this['dialMethod']=_0x4aa7f5[_0x5c9e('0x1d')]||_0x5c9e('0x1e');this['dialLimitChannel']=_0x4aa7f5['dialLimitChannel']||0x0;this[_0x5c9e('0x1f')]=_0x4aa7f5[_0x5c9e('0x1f')]||0x0;this[_0x5c9e('0x20')]=_0x4aa7f5['dialPowerLevel']||0x1;this[_0x5c9e('0x21')]=_0x4aa7f5[_0x5c9e('0x21')]||_0x5c9e('0x22');this[_0x5c9e('0x23')]=_0x4aa7f5[_0x5c9e('0x23')]||0.03;this['dialPredictiveInterval']=_0x4aa7f5[_0x5c9e('0x24')]||0x258;this[_0x5c9e('0x25')]=_0x4aa7f5['dialOriginateCallerIdName']||_0x5c9e('0x26');this[_0x5c9e('0x27')]=_0x4aa7f5[_0x5c9e('0x27')]||'anonymous';this['dialOriginateTimeout']=_0x4aa7f5[_0x5c9e('0x28')]||0x1e;this[_0x5c9e('0x29')]=_0x4aa7f5[_0x5c9e('0x29')]||'tTxX';this['dialQueueTimeout']=_0x4aa7f5['dialQueueTimeout']||0x3;this[_0x5c9e('0x2a')]=_0x4aa7f5[_0x5c9e('0x2a')]||undefined;this['dialCongestionMaxRetry']=_0x4aa7f5[_0x5c9e('0x2b')]||0x3;this[_0x5c9e('0x2c')]=_0x4aa7f5[_0x5c9e('0x2c')]||0x96;this['dialBusyMaxRetry']=_0x4aa7f5[_0x5c9e('0x2d')]||0x3;this[_0x5c9e('0x2e')]=_0x4aa7f5[_0x5c9e('0x2e')]||0x96;this[_0x5c9e('0x2f')]=_0x4aa7f5['dialNoAnswerMaxRetry']||0x3;this[_0x5c9e('0x30')]=_0x4aa7f5[_0x5c9e('0x30')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4aa7f5['dialNoSuchNumberMaxRetry']||0x3;this[_0x5c9e('0x31')]=_0x4aa7f5[_0x5c9e('0x31')]||0x96;this[_0x5c9e('0x32')]=_0x4aa7f5[_0x5c9e('0x32')]||0x3;this[_0x5c9e('0x33')]=_0x4aa7f5[_0x5c9e('0x33')]||0x96;this['dialAbandonedMaxRetry']=_0x4aa7f5[_0x5c9e('0x34')]||0x3;this[_0x5c9e('0x35')]=_0x4aa7f5[_0x5c9e('0x35')]||0x96;this[_0x5c9e('0x36')]=_0x4aa7f5[_0x5c9e('0x36')]||0x3;this[_0x5c9e('0x37')]=_0x4aa7f5[_0x5c9e('0x37')]||0x96;this[_0x5c9e('0x38')]=_0x4aa7f5['dialAgentRejectMaxRetry']||0x3;this[_0x5c9e('0x39')]=_0x4aa7f5[_0x5c9e('0x39')]||0x96;this[_0x5c9e('0x3a')]=_0x4aa7f5[_0x5c9e('0x3a')]||0x4;this['Trunk']=_0x4aa7f5[_0x5c9e('0x3b')]?_0x4aa7f5['Trunk']:undefined;this['TrunkBackup']=_0x4aa7f5[_0x5c9e('0x3c')]?_0x4aa7f5['TrunkBackup']:undefined;this['dialPrefix']=_0x4aa7f5[_0x5c9e('0x3d')]||undefined;this['Interval']=_0x4aa7f5[_0x5c9e('0x3e')]?_0x4aa7f5[_0x5c9e('0x3e')]:undefined;this[_0x5c9e('0x3f')]=_0x4aa7f5['dialOrderByScheduledAt']||_0x5c9e('0x40');this[_0x5c9e('0x41')]=_0x4aa7f5[_0x5c9e('0x41')]||undefined;this[_0x5c9e('0x42')]=_0x4aa7f5[_0x5c9e('0x42')]||undefined;this[_0x5c9e('0x43')]=strategy[_0x4aa7f5[_0x5c9e('0x43')]]||'rrmemory';this[_0x5c9e('0x44')]=!![];this['dialAMDActive']=_0x4aa7f5[_0x5c9e('0x45')]||![];this[_0x5c9e('0x46')]=_0x4aa7f5['dialAMDInitialSilence'];this[_0x5c9e('0x47')]=_0x4aa7f5[_0x5c9e('0x47')];this[_0x5c9e('0x48')]=_0x4aa7f5['dialAMDAfterGreetingSilence'];this[_0x5c9e('0x49')]=_0x4aa7f5[_0x5c9e('0x49')];this[_0x5c9e('0x4a')]=_0x4aa7f5[_0x5c9e('0x4a')];this[_0x5c9e('0x4b')]=_0x4aa7f5[_0x5c9e('0x4b')];this[_0x5c9e('0x4c')]=_0x4aa7f5[_0x5c9e('0x4c')];this[_0x5c9e('0x4d')]=_0x4aa7f5[_0x5c9e('0x4d')];this[_0x5c9e('0x4e')]=_0x4aa7f5[_0x5c9e('0x4e')];this[_0x5c9e('0x4f')]=0x0;this[_0x5c9e('0x50')]=0x0;this['timeout']=_0x4aa7f5[_0x5c9e('0x51')];this['outboundAnswerCallsDay']=0x0;this[_0x5c9e('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5c9e('0x53')]=0x0;this[_0x5c9e('0x54')]=0x0;this[_0x5c9e('0x55')]=0x0;this[_0x5c9e('0x56')]=0x0;this[_0x5c9e('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x5c9e('0x58')]=0x0;this[_0x5c9e('0x59')]=0x0;this[_0x5c9e('0x5a')]=0x0;this[_0x5c9e('0x5b')]=0x0;this[_0x5c9e('0x5c')]=0x0;this[_0x5c9e('0x5d')]=undefined;this[_0x5c9e('0x5e')]=undefined;this[_0x5c9e('0x5f')]=undefined;this[_0x5c9e('0x60')]=1.05;this[_0x5c9e('0x61')]=0x0;this[_0x5c9e('0x62')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x5c9e('0x63')]=0x0;this[_0x5c9e('0x64')]=0x0;this[_0x5c9e('0x65')]=0x0;this[_0x5c9e('0x66')]=0x0;this[_0x5c9e('0x67')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4aa7f5[_0x5c9e('0x68')]||0x14;this['predictiveIntervalMinThreshold']=_0x4aa7f5[_0x5c9e('0x68')]||0xa;this[_0x5c9e('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x5c9e('0x6a')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x5c9e('0x6b')]=_0x4aa7f5['dialRecallMeTimeout']||0x1e;this[_0x5c9e('0x6c')]=_0x4aa7f5[_0x5c9e('0x6c')]||![];this[_0x5c9e('0x6d')]=_0x4aa7f5[_0x5c9e('0x6d')]||undefined;this[_0x5c9e('0x6e')]=_0x4aa7f5[_0x5c9e('0x6e')]||![];this[_0x5c9e('0x6f')]=_0x4aa7f5[_0x5c9e('0x6f')]||![];this['monitor_format']=monitorFormat[_0x4aa7f5[_0x5c9e('0x9')]]?monitorFormat[_0x4aa7f5[_0x5c9e('0x9')]]:undefined;this[_0x5c9e('0x70')]=_0x4aa7f5[_0x5c9e('0x70')]||![];this[_0x5c9e('0x71')]=_0x4aa7f5[_0x5c9e('0x71')]?_0x4aa7f5[_0x5c9e('0x71')]:undefined;}module[_0x5c9e('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 656aaf4..6190aa3 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 _0x1443=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x23fa4d,_0xea08f2){var _0x1d762a=function(_0x5d50d5){while(--_0x5d50d5){_0x23fa4d['push'](_0x23fa4d['shift']());}};_0x1d762a(++_0xea08f2);}(_0x1443,0x129));var _0x3144=function(_0x5b9bc0,_0x7b32e0){_0x5b9bc0=_0x5b9bc0-0x0;var _0x9cf24f=_0x1443[_0x5b9bc0];return _0x9cf24f;};'use strict';function VtigerAccount(_0x160ed0){this['id']=_0x160ed0['id']||0x0;this[_0x3144('0x0')]=_0x160ed0['name']||'';this['username']=_0x160ed0[_0x3144('0x1')]||'';this['accessKey']=_0x160ed0[_0x3144('0x2')]||'';this['remoteUri']=_0x160ed0[_0x3144('0x3')]||'';this[_0x3144('0x4')]=_0x160ed0[_0x3144('0x4')]||'';this[_0x3144('0x5')]=_0x160ed0['Configurations']||{};}module[_0x3144('0x6')]=VtigerAccount; \ No newline at end of file +var _0x73ea=['remoteUri','serverUrl','Configurations','exports','username','accessKey'];(function(_0x2b3748,_0x4f26ab){var _0x28b3f8=function(_0x56a7d8){while(--_0x56a7d8){_0x2b3748['push'](_0x2b3748['shift']());}};_0x28b3f8(++_0x4f26ab);}(_0x73ea,0xf4));var _0xa73e=function(_0x28cf02,_0x4270c3){_0x28cf02=_0x28cf02-0x0;var _0x336313=_0x73ea[_0x28cf02];return _0x336313;};'use strict';function VtigerAccount(_0x1c14e5){this['id']=_0x1c14e5['id']||0x0;this['name']=_0x1c14e5['name']||'';this['username']=_0x1c14e5[_0xa73e('0x0')]||'';this[_0xa73e('0x1')]=_0x1c14e5['accessKey']||'';this['remoteUri']=_0x1c14e5[_0xa73e('0x2')]||'';this[_0xa73e('0x3')]=_0x1c14e5[_0xa73e('0x3')]||'';this[_0xa73e('0x4')]=_0x1c14e5['Configurations']||{};}module[_0xa73e('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index eb95c2a..e36e825 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 _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x7e2238,_0x7d77d7){var _0x1639a6=function(_0xc7ed9f){while(--_0xc7ed9f){_0x7e2238['push'](_0x7e2238['shift']());}};_0x1639a6(++_0x7d77d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a5afd,_0x4a783e){_0x5a5afd=_0x5a5afd-0x0;var _0x443e10=_0x5f2f[_0x5a5afd];return _0x443e10;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x16034b,_0x690b58){var _0x35fa63=function(_0x1d39b3){while(--_0x1d39b3){_0x16034b['push'](_0x16034b['shift']());}};_0x35fa63(++_0x690b58);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5d5b6ab..5e8ca50 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 _0xeb3f=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x59b1f3,_0x38a596){var _0x52f133=function(_0x92c385){while(--_0x92c385){_0x59b1f3['push'](_0x59b1f3['shift']());}};_0x52f133(++_0x38a596);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb3f[_0x502c7d];return _0x30b7ed;};'use strict';function ZohoAccount(_0x3a4a22){this['id']=_0x3a4a22['id']||0x0;this[_0xfeb3('0x0')]=_0x3a4a22[_0xfeb3('0x0')]||'';this[_0xfeb3('0x1')]=_0x3a4a22[_0xfeb3('0x1')]||'';this[_0xfeb3('0x2')]=_0x3a4a22[_0xfeb3('0x2')]||'';this[_0xfeb3('0x3')]=_0x3a4a22[_0xfeb3('0x3')]||'';this[_0xfeb3('0x4')]=_0x3a4a22[_0xfeb3('0x4')]||'';this[_0xfeb3('0x5')]=_0x3a4a22[_0xfeb3('0x5')]||'';this[_0xfeb3('0x6')]=_0x3a4a22[_0xfeb3('0x6')]||'';this['code']=_0x3a4a22[_0xfeb3('0x7')]||'';this[_0xfeb3('0x8')]=_0x3a4a22[_0xfeb3('0x8')]||'';this[_0xfeb3('0x9')]=_0x3a4a22[_0xfeb3('0x9')]||{};}module[_0xfeb3('0xa')]=ZohoAccount; \ No newline at end of file +var _0x33d2=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x1c6e9e,_0xbe09c7){var _0x5cdfb1=function(_0x37c1b4){while(--_0x37c1b4){_0x1c6e9e['push'](_0x1c6e9e['shift']());}};_0x5cdfb1(++_0xbe09c7);}(_0x33d2,0x7f));var _0x233d=function(_0x593683,_0x2b3213){_0x593683=_0x593683-0x0;var _0x44cc39=_0x33d2[_0x593683];return _0x44cc39;};'use strict';function ZohoAccount(_0x328953){this['id']=_0x328953['id']||0x0;this[_0x233d('0x0')]=_0x328953[_0x233d('0x0')]||'';this['description']=_0x328953[_0x233d('0x1')]||'';this[_0x233d('0x2')]=_0x328953['host']||'';this[_0x233d('0x3')]=_0x328953[_0x233d('0x3')]||'';this[_0x233d('0x4')]=_0x328953[_0x233d('0x4')]||'';this[_0x233d('0x5')]=_0x328953[_0x233d('0x5')]||'';this[_0x233d('0x6')]=_0x328953[_0x233d('0x6')]||'';this['code']=_0x328953[_0x233d('0x7')]||'';this['refreshToken']=_0x328953[_0x233d('0x8')]||'';this[_0x233d('0x9')]=_0x328953[_0x233d('0x9')]||{};}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 45450ea..54f8949 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 _0xebf7=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry'];(function(_0x5bfea1,_0x494abb){var _0x42d2fa=function(_0x33261d){while(--_0x33261d){_0x5bfea1['push'](_0x5bfea1['shift']());}};_0x42d2fa(++_0x494abb);}(_0xebf7,0x1cd));var _0x7ebf=function(_0x541ea9,_0x582004){_0x541ea9=_0x541ea9-0x0;var _0x1685e3=_0xebf7[_0x541ea9];return _0x1685e3;};'use strict';var util=require(_0x7ebf('0x0'));var _=require(_0x7ebf('0x1'));var moment=require(_0x7ebf('0x2'));function checkNameSurname(_0x5c7c28,_0xdc1abe,_0x1daeab){var _0x4bd729='';if(!_[_0x7ebf('0x3')](_0xdc1abe)&&_0x7ebf('0x4')===typeof _0xdc1abe){_0x4bd729+=_0xdc1abe;}if(!_[_0x7ebf('0x3')](_0x1daeab)&&_0x7ebf('0x4')===typeof _0x1daeab){_0x4bd729+='\x20'+_0x1daeab;}if(_0x4bd729!==''){return _0x4bd729;}return _0x5c7c28;}function Action(_0x2ebd26,_0x4fe421,_0x147eae,_0x154d08,_0x134a61){this['uniqueid']=_0x147eae||undefined;this[_0x7ebf('0x5')]=_0x2ebd26['id'];this[_0x7ebf('0x6')]=_0x4fe421[_0x7ebf('0x7')];this[_0x7ebf('0x8')]=_0x4fe421['type'];this[_0x7ebf('0x9')]=_0x7ebf('0x6');this[_0x7ebf('0xa')]=![];this[_0x7ebf('0xb')]=_[_0x7ebf('0x3')](_0x2ebd26[_0x7ebf('0xc')])?undefined:_0x2ebd26[_0x7ebf('0xc')][_0x7ebf('0x7')];this['channelAgent']=this[_0x7ebf('0xb')]?util[_0x7ebf('0xd')](_0x7ebf('0xe'),this['membername']):_0x154d08||undefined;this[_0x7ebf('0xf')]=checkNameSurname(_0x2ebd26[_0x7ebf('0x10')][_0x7ebf('0x11')],_0x2ebd26[_0x7ebf('0x10')][_0x7ebf('0x12')],_0x2ebd26[_0x7ebf('0x10')]['lastName']);this['active']=_0x2ebd26[_0x7ebf('0x13')]||![];this['calleridnum']=_0x2ebd26[_0x7ebf('0x10')][_0x7ebf('0x11')];this['scheduledat']=_0x2ebd26[_0x7ebf('0x14')];this[_0x7ebf('0x15')]=_0x2ebd26[_0x7ebf('0x15')]||0x0;this[_0x7ebf('0x16')]=_0x2ebd26['countcongestionretry']||0x0;this[_0x7ebf('0x17')]=_0x2ebd26['countnoanswerretry']||0x0;this['countglobal']=(_0x2ebd26[_0x7ebf('0x15')]||0x0)+(_0x2ebd26[_0x7ebf('0x16')]||0x0)+(_0x2ebd26[_0x7ebf('0x17')]||0x0)+(_0x2ebd26[_0x7ebf('0x18')]||0x0)+(_0x2ebd26[_0x7ebf('0x19')]||0x0)+(_0x2ebd26[_0x7ebf('0x1a')]||0x0)+(_0x2ebd26[_0x7ebf('0x1b')]||0x0)+(_0x2ebd26[_0x7ebf('0x1c')]||0x0);this[_0x7ebf('0x18')]=_0x2ebd26[_0x7ebf('0x18')]||0x0;this[_0x7ebf('0x19')]=_0x2ebd26[_0x7ebf('0x19')]||0x0;this['countabandonedretry']=_0x2ebd26[_0x7ebf('0x1a')]||0x0;this[_0x7ebf('0x1b')]=_0x2ebd26['countmachineretry']||0x0;this['countagentrejectretry']=_0x2ebd26[_0x7ebf('0x1c')]||0x0;this[_0x7ebf('0x1d')]=_0x2ebd26[_0x7ebf('0x1d')];this[_0x7ebf('0x1e')]=_0x2ebd26[_0x7ebf('0x1e')];this[_0x7ebf('0x1f')]=_0x2ebd26['callbackat'];this[_0x7ebf('0x20')]=_0x2ebd26[_0x7ebf('0x20')];this[_0x7ebf('0x21')]=_0x2ebd26['ContactId'];this['ListId']=_0x2ebd26[_0x7ebf('0x22')];this[_0x7ebf('0x23')]=_['isNil'](_0x2ebd26[_0x7ebf('0xc')])?_0x2ebd26['UserId']:_0x2ebd26[_0x7ebf('0xc')]['id'];this[_0x7ebf('0x24')]=_0x2ebd26[_0x7ebf('0x24')];this[_0x7ebf('0x25')]='';this[_0x7ebf('0x26')]='';}Action[_0x7ebf('0x27')][_0x7ebf('0x28')]=function(){return util['format'](_0x7ebf('0x29'),this['calleridname'],this[_0x7ebf('0x2a')]);};module[_0x7ebf('0x2b')]=Action; \ No newline at end of file +var _0x9f67=['util','lodash','moment','string','isNil','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','number'];(function(_0x43bb06,_0x2f904d){var _0xd1c829=function(_0x1fec8a){while(--_0x1fec8a){_0x43bb06['push'](_0x43bb06['shift']());}};_0xd1c829(++_0x2f904d);}(_0x9f67,0x19a));var _0x79f6=function(_0x550be7,_0x58d911){_0x550be7=_0x550be7-0x0;var _0x1d0b08=_0x9f67[_0x550be7];return _0x1d0b08;};'use strict';var util=require(_0x79f6('0x0'));var _=require(_0x79f6('0x1'));var moment=require(_0x79f6('0x2'));function checkNameSurname(_0x39992f,_0x5d2638,_0x5a07ba){var _0x4f4cd6='';if(!_['isNil'](_0x5d2638)&&_0x79f6('0x3')===typeof _0x5d2638){_0x4f4cd6+=_0x5d2638;}if(!_[_0x79f6('0x4')](_0x5a07ba)&&_0x79f6('0x3')===typeof _0x5a07ba){_0x4f4cd6+='\x20'+_0x5a07ba;}if(_0x4f4cd6!==''){return _0x4f4cd6;}return _0x39992f;}function Action(_0x3eaafe,_0x502cc7,_0x534cba,_0x2eb854,_0x66d93){this['uniqueid']=_0x534cba||undefined;this[_0x79f6('0x5')]=_0x3eaafe['id'];this['queue']=_0x502cc7[_0x79f6('0x6')];this[_0x79f6('0x7')]=_0x502cc7[_0x79f6('0x7')];this[_0x79f6('0x8')]=_0x79f6('0x9');this[_0x79f6('0xa')]=![];this[_0x79f6('0xb')]=_[_0x79f6('0x4')](_0x3eaafe[_0x79f6('0xc')])?undefined:_0x3eaafe[_0x79f6('0xc')]['name'];this[_0x79f6('0xd')]=this[_0x79f6('0xb')]?util[_0x79f6('0xe')]('SIP/%s',this['membername']):_0x2eb854||undefined;this[_0x79f6('0xf')]=checkNameSurname(_0x3eaafe[_0x79f6('0x10')][_0x79f6('0x11')],_0x3eaafe[_0x79f6('0x10')]['firstName'],_0x3eaafe[_0x79f6('0x10')][_0x79f6('0x12')]);this[_0x79f6('0x13')]=_0x3eaafe[_0x79f6('0x13')]||![];this[_0x79f6('0x14')]=_0x3eaafe['Contact'][_0x79f6('0x11')];this['scheduledat']=_0x3eaafe['scheduledat'];this[_0x79f6('0x15')]=_0x3eaafe[_0x79f6('0x15')]||0x0;this[_0x79f6('0x16')]=_0x3eaafe[_0x79f6('0x16')]||0x0;this['countnoanswerretry']=_0x3eaafe[_0x79f6('0x17')]||0x0;this[_0x79f6('0x18')]=(_0x3eaafe['countbusyretry']||0x0)+(_0x3eaafe[_0x79f6('0x16')]||0x0)+(_0x3eaafe[_0x79f6('0x17')]||0x0)+(_0x3eaafe[_0x79f6('0x19')]||0x0)+(_0x3eaafe[_0x79f6('0x1a')]||0x0)+(_0x3eaafe[_0x79f6('0x1b')]||0x0)+(_0x3eaafe[_0x79f6('0x1c')]||0x0)+(_0x3eaafe[_0x79f6('0x1d')]||0x0);this['countnosuchnumberretry']=_0x3eaafe[_0x79f6('0x19')]||0x0;this[_0x79f6('0x1a')]=_0x3eaafe[_0x79f6('0x1a')]||0x0;this['countabandonedretry']=_0x3eaafe[_0x79f6('0x1b')]||0x0;this['countmachineretry']=_0x3eaafe[_0x79f6('0x1c')]||0x0;this['countagentrejectretry']=_0x3eaafe[_0x79f6('0x1d')]||0x0;this[_0x79f6('0x1e')]=_0x3eaafe[_0x79f6('0x1e')];this[_0x79f6('0x1f')]=_0x3eaafe[_0x79f6('0x1f')];this[_0x79f6('0x20')]=_0x3eaafe[_0x79f6('0x20')];this[_0x79f6('0x21')]=_0x3eaafe['recallme'];this[_0x79f6('0x22')]=_0x3eaafe[_0x79f6('0x22')];this[_0x79f6('0x23')]=_0x3eaafe[_0x79f6('0x23')];this[_0x79f6('0x24')]=_['isNil'](_0x3eaafe[_0x79f6('0xc')])?_0x3eaafe[_0x79f6('0x24')]:_0x3eaafe[_0x79f6('0xc')]['id'];this[_0x79f6('0x25')]=_0x3eaafe['VoiceQueueId'];this[_0x79f6('0x26')]='';this[_0x79f6('0x27')]='';}Action['prototype']['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x79f6('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4c43eaf..1f0ab0c 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 _0xd8b0=['[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','decrementTalkink','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','ANSWER','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','execRun','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','channel','actionid','logLookAgent','clone','isFailure','unlockContact','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','outbound','hasOwnProperty','setMessage','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','size','recallMe','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0d8b('0x2'));var Redis=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x0d8b('0x7'));var rpcDb=require(_0x0d8b('0x8'));var Action=require(_0x0d8b('0x9'));var ut=require('./util/util');config[_0x0d8b('0xa')]=_[_0x0d8b('0xb')](config['redis'],{'host':_0x0d8b('0xc'),'port':0x18eb});var io=require(_0x0d8b('0xd'))(new Redis(config[_0x0d8b('0xa')]));var Sequence=function(){};Sequence[_0x0d8b('0xe')][_0x0d8b('0xf')]=function(_0x1cac62){this[_0x0d8b('0x10')]=this[_0x0d8b('0x10')]?this['tail'][_0x0d8b('0x11')](_0x1cac62):_0x1cac62();};function Preview(_0x4e0269){this[_0x0d8b('0x12')]=new Sequence();this[_0x0d8b('0x13')]=_0x4e0269[_0x0d8b('0x14')];this[_0x0d8b('0x15')]=_0x4e0269[_0x0d8b('0x15')];this[_0x0d8b('0x16')]={};this[_0x0d8b('0x17')]=_0x4e0269[_0x0d8b('0x17')];this[_0x0d8b('0x18')]=0x0;ami['on'](_0x0d8b('0x19'),this[_0x0d8b('0x1a')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x1c'),this[_0x0d8b('0x1d')]['bind'](this));ami['on'](_0x0d8b('0x1e'),this[_0x0d8b('0x1f')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x20'),this[_0x0d8b('0x21')]['bind'](this));ami['on'](_0x0d8b('0x22'),this[_0x0d8b('0x23')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x24'),this[_0x0d8b('0x25')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x26'),this[_0x0d8b('0x27')]['bind'](this));ami['on'](_0x0d8b('0x28'),this[_0x0d8b('0x29')][_0x0d8b('0x1b')](this));this[_0x0d8b('0x2a')](this[_0x0d8b('0x13')]);}function emit(_0x5b709c,_0x393beb,_0x352c17){io['to'](_0x5b709c)['emit'](_0x393beb,_0x352c17);}function emitCampaignPreview(_0x4f0a1a){if(_0x4f0a1a[_0x0d8b('0x2b')]==='outbound'){var _0x56c729={'id':_0x4f0a1a['id'],'name':_0x4f0a1a['name'],'strategy':_0x4f0a1a[_0x0d8b('0x2c')],'answered':_0x4f0a1a[_0x0d8b('0x2d')],'available':_0x4f0a1a[_0x0d8b('0x2e')],'loggedIn':_0x4f0a1a[_0x0d8b('0x2f')],'pTalking':_0x4f0a1a[_0x0d8b('0x30')],'sumBillable':_0x4f0a1a[_0x0d8b('0x31')],'sumDuration':_0x4f0a1a[_0x0d8b('0x32')],'sumHoldTime':_0x4f0a1a[_0x0d8b('0x33')]||0x0,'talking':_0x4f0a1a[_0x0d8b('0x34')],'total':_0x4f0a1a['total'],'type':_0x4f0a1a[_0x0d8b('0x2b')],'unmanaged':_0x4f0a1a[_0x0d8b('0x35')],'abandoned':_0x4f0a1a['abandoned'],'waiting':_0x4f0a1a[_0x0d8b('0x36')],'loggedInDb':_0x4f0a1a['loggedInDb'],'dialActive':_0x4f0a1a[_0x0d8b('0x37')],'dialMethod':_0x4f0a1a[_0x0d8b('0x38')],'dialOriginateCallerIdName':_0x4f0a1a[_0x0d8b('0x39')],'dialOriginateCallerIdNumber':_0x4f0a1a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4f0a1a['dialOriginateTimeout'],'dialPrefix':_0x4f0a1a[_0x0d8b('0x3a')],'outboundAnswerAgiCallsDay':_0x4f0a1a[_0x0d8b('0x3b')],'outboundAnswerCallsDay':_0x4f0a1a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4f0a1a[_0x0d8b('0x3c')],'outboundBusyCallsDay':_0x4f0a1a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4f0a1a[_0x0d8b('0x3d')],'outboundDropCallsDayACS':_0x4f0a1a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4f0a1a[_0x0d8b('0x3e')],'outboundDropCallsDayTimeout':_0x4f0a1a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4f0a1a[_0x0d8b('0x3f')],'outboundNoSuchCallsDay':_0x4f0a1a['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4f0a1a[_0x0d8b('0x40')],'outboundReCallsDay':_0x4f0a1a['outboundReCallsDay'],'outboundRejectCallsDay':_0x4f0a1a[_0x0d8b('0x41')],'outboundUnknownCallsDay':_0x4f0a1a[_0x0d8b('0x42')],'outboundAbandonedCallsDay':_0x4f0a1a[_0x0d8b('0x43')],'predictiveIntervalAnsweredCalls':_0x4f0a1a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4f0a1a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4f0a1a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4f0a1a[_0x0d8b('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x4f0a1a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4f0a1a[_0x0d8b('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x4f0a1a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4f0a1a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4f0a1a[_0x0d8b('0x46')],'predictiveIntervalPauses':_0x4f0a1a[_0x0d8b('0x47')],'predictiveIntervalAvailable':_0x4f0a1a[_0x0d8b('0x48')],'predictiveIntervalTotalCalls':_0x4f0a1a[_0x0d8b('0x49')],'message':_0x4f0a1a[_0x0d8b('0x4a')],'originated':_0x4f0a1a[_0x0d8b('0x4b')],'erlangCalls':_0x4f0a1a[_0x0d8b('0x4c')],'erlangCallToSecond':_0x4f0a1a[_0x0d8b('0x4d')],'erlangAbandonmentRate':_0x4f0a1a['erlangAbandonmentRate'],'erlangBusyFactor':_0x4f0a1a[_0x0d8b('0x4e')],'startPredictive':_0x4f0a1a[_0x0d8b('0x4f')],'startProgressive':_0x4f0a1a['startProgressive']};if(_0x4f0a1a[_0x0d8b('0x50')]){_0x56c729[_0x0d8b('0x50')]={'id':_0x4f0a1a[_0x0d8b('0x50')]['id'],'name':_0x4f0a1a['Trunk'][_0x0d8b('0x51')],'active':_0x4f0a1a[_0x0d8b('0x50')][_0x0d8b('0x52')],'callerid':_0x4f0a1a[_0x0d8b('0x50')][_0x0d8b('0x53')]};}if(_0x4f0a1a['Interval']){_0x56c729[_0x0d8b('0x54')]={'id':_0x4f0a1a[_0x0d8b('0x54')]['id'],'name':_0x4f0a1a['Interval'][_0x0d8b('0x51')]};}var _0x3cc3ee=md5(JSON[_0x0d8b('0x55')](_0x56c729));if(_0x4f0a1a[_0x0d8b('0x2')]!==_0x3cc3ee){_0x4f0a1a[_0x0d8b('0x2')]=_0x3cc3ee;emit(util['format']('voice:queue:%s',_0x56c729[_0x0d8b('0x51')]),'voice_queue:save',_0x56c729);}}}function emitVoiceQueueChannelRemove(_0x531c55){logger[_0x0d8b('0x56')](_0x0d8b('0x57'),JSON[_0x0d8b('0x55')](_0x531c55));emit(util[_0x0d8b('0x58')](_0x0d8b('0x59'),_0x531c55[_0x0d8b('0x51')]),'voice_queue_channel:remove',_0x531c55);}function notSendMessagesQueue(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x5a')]){if(_0x6e5bab[_0x0d8b('0x4b')]===0x0&&_0x6e5bab[_0x0d8b('0x30')]===0x0){_0x6e5bab[_0x0d8b('0x5a')]=![];_0x6e5bab[_0x0d8b('0x2e')]=0x0;_0x6e5bab[_0x0d8b('0x5b')]=0x0;_0x6e5bab['message']=_0x0d8b('0x5c');ut[_0x0d8b('0x5d')](_0x0d8b('0x5e'),_0x6e5bab[_0x0d8b('0x51')]+'\x20is\x20not\x20active');}else{_0x6e5bab[_0x0d8b('0x4a')]='IS_DISACTIVED';ut[_0x0d8b('0x5d')](_0x0d8b('0x5e'),_0x6e5bab[_0x0d8b('0x51')]+_0x0d8b('0x5f'));}emitCampaignPreview(_0x6e5bab);}}Preview[_0x0d8b('0xe')][_0x0d8b('0x2a')]=function(){var _0x1ff17d=this;setInterval(function(){_0x1ff17d[_0x0d8b('0x60')]();},0x7cf);};Preview[_0x0d8b('0xe')][_0x0d8b('0x60')]=function(){var _0x482069=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x4d0811 in _0x482069){if(_0x482069['hasOwnProperty'](_0x4d0811)&&(_0x482069[_0x4d0811][_0x0d8b('0x38')]===_0x0d8b('0x6')||_0x482069[_0x4d0811][_0x0d8b('0x38')]==='booked')&&_0x482069[_0x4d0811]['type']===_0x0d8b('0x61')){if(this[_0x0d8b('0x18')]>0x7){this[_0x0d8b('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x482069[_0x0d8b('0x62')](_0x4d0811)&&_0x482069[_0x4d0811][_0x0d8b('0x38')]==='preview'&&_0x482069[_0x4d0811]['type']===_0x0d8b('0x61')){if(_0x482069[_0x4d0811]['dialActive']){this[_0x0d8b('0x63')](_0x482069[_0x4d0811]);this['recallMe'](_0x482069[_0x4d0811]);}else{notSendMessagesQueue(_0x482069[_0x4d0811]);}}}};Preview['prototype'][_0x0d8b('0x64')]=function(_0x194f17){var _0x5a75c7=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x5a75c7[_0x0d8b('0x16')][_0x194f17])){loggerAction[_0x0d8b('0x56')](_0x0d8b('0x65'),_0x194f17,'Queue',_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')],_0x0d8b('0x67'),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]][_0x0d8b('0x4b')]),_0x0d8b('0x68'),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]][_0x0d8b('0x30')]),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x69')]),JSON[_0x0d8b('0x55')](_[_0x0d8b('0x6a')](_0x5a75c7['actions'][_0x194f17],[_0x0d8b('0x6b'),'UserId','VoiceQueueId',_0x0d8b('0x6c')])));return ami[_0x0d8b('0x6d')]({'action':_0x0d8b('0x6e'),'channel':_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['channel']})[_0x0d8b('0x6f')](function(_0x1106d6){if(_0x1106d6[_0x0d8b('0x4a')]===_0x0d8b('0x70')){setTimeout(function(){if(_0x5a75c7[_0x0d8b('0x16')][_0x194f17]){ut['updateOriginated'](_0x5a75c7['campaignsPreview'][_0x5a75c7['actions'][_0x194f17]['queue']],_0x0d8b('0x71'));if(_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['dialAnswer']===!![]){ut['decrementTalkink'](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['queue']],'[clearZombieChannel]');ut[_0x0d8b('0x72')](_0x0d8b('0x73')+_0x194f17,_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]);}ut[_0x0d8b('0x72')]('[Dialer][checkChannel][Preview]'+_0x194f17,_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]);delete _0x5a75c7['actions'][_0x194f17];}},0x2328);}});}});};Preview['prototype'][_0x0d8b('0x74')]=function(){var _0x3f2d95=this;loggerAction['info']('[action]',_[_0x0d8b('0x75')](this[_0x0d8b('0x16')]));for(var _0x377027 in this[_0x0d8b('0x16')]){if(_0x3f2d95['actions'][_0x0d8b('0x62')](_0x377027)){_0x3f2d95['clearZombieChannel'](_0x377027);}}};Preview['prototype'][_0x0d8b('0x76')]=function(_0x44043b){var _0x54aa03=this;rpcDb['getContactRecallMe'](_0x44043b['id'],ut[_0x0d8b('0x77')](this[_0x0d8b('0x17')]))[_0x0d8b('0x78')](function(_0x2c1eb0){if(!_[_0x0d8b('0x79')](_0x2c1eb0)){for(var _0xb66e76=0x0;_0xb66e76<_0x2c1eb0[_0x0d8b('0x7a')];_0xb66e76+=0x1){if(ut[_0x0d8b('0x7b')](_0x2c1eb0[_0xb66e76]['scheduledat'])<_0x44043b[_0x0d8b('0x7c')]*0x3c){if(_0x2c1eb0[_0xb66e76][_0x0d8b('0x7d')]&&!_0x2c1eb0[_0xb66e76][_0x0d8b('0x7d')][_0x0d8b('0x7e')]){_0x54aa03[_0x0d8b('0x7f')](_0x2c1eb0[_0xb66e76]['id'])[_0x0d8b('0x78')](ut[_0x0d8b('0x80')](_0x0d8b('0x81')))[_0x0d8b('0x6f')](ut['logger2'](_0x0d8b('0x81')));}else{rpcDb[_0x0d8b('0x82')](_0x2c1eb0[_0xb66e76]['id']);}}else{var _0x180b7b=new Action(_0x2c1eb0[_0xb66e76],_0x44043b);_0x180b7b[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x44043b[_0x0d8b('0x84')]+=0x1;ut[_0x0d8b('0x85')](_0x180b7b,0x17,_0x0d8b('0x86'));if(_0x44043b[_0x0d8b('0x87')]){rpcDb[_0x0d8b('0x88')](ut['createBody'](_0x2c1eb0[_0xb66e76]));rpcDb['createCustomerHistory'](_0x180b7b,_0x0d8b('0x89'));}else{ut[_0x0d8b('0x85')](_0x180b7b,0x16,_0x0d8b('0x8a'));rpcDb[_0x0d8b('0x8b')](_0x180b7b,'[HistoryRecallClose]');rpcDb[_0x0d8b('0x8c')](_0x180b7b,_0x0d8b('0x8d'));}}}}})[_0x0d8b('0x6f')](ut['logger2'](_0x0d8b('0x8e')));};Preview['prototype'][_0x0d8b('0x63')]=function(_0x3ed63e){_0x3ed63e[_0x0d8b('0x5a')]=!![];if(ut[_0x0d8b('0x8f')](_0x3ed63e[_0x0d8b('0x2f')])){_0x3ed63e[_0x0d8b('0x4a')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0d8b('0x90')](_0x3ed63e['dialActive'])){_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x5c');}else if(!this[_0x0d8b('0x91')](_0x3ed63e[_0x0d8b('0x50')])){if(!this['isTrunkReachable'](_0x3ed63e[_0x0d8b('0x92')])){_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x93');}else{_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x94');}}else{_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x94');}emitCampaignPreview(_0x3ed63e);};Preview[_0x0d8b('0xe')][_0x0d8b('0x95')]=function(_0x34affb,_0x57e39a,_0x4ee1e8){var _0x6388ae=this;var _0x3eb647=this['actions'][_0x57e39a];var _0xb1aa96=this['campaignsPreview'][_0x3eb647['queue']];var _0x22ee20;if(_0xb1aa96){switch(_0x4ee1e8){case'1':_0xb1aa96[_0x0d8b('0x96')]+=0x1;_0x3eb647['countnosuchnumberretry']+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x0,_0x0d8b('0x98'));ami[_0x0d8b('0x99')](_0x0d8b('0x9a'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0x9c')));rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0x9d'));if(ut['totalGlobal'](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3eb647[_0x0d8b('0xa1')]>=_0xb1aa96['dialNoSuchNumberMaxRetry']){rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xa2'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xa1'),_0xb1aa96[_0x0d8b('0xa5')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];break;case'ANSWER':var _0x1436b3=moment()['format'](_0x0d8b('0xa9'));_0x3eb647[_0x0d8b('0xaa')]=_0x1436b3;_0x3eb647['answertime']=_0x1436b3;_0x3eb647[_0x0d8b('0x69')]=!![];_0xb1aa96['pTalking']+=0x1;logger[_0x0d8b('0x56')](_0x0d8b('0xab'),_0x3eb647[_0x0d8b('0xac')],_0x0d8b('0xad'),_0xb1aa96[_0x0d8b('0x51')],_0x0d8b('0x68'),_0xb1aa96[_0x0d8b('0x30')]);ami[_0x0d8b('0x99')]('custom:agentconnect',ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xae'),this['campaignsPreview'][_0x3eb647[_0x0d8b('0x66')]]));if(_0xb1aa96[_0x0d8b('0xaf')]){ami[_0x0d8b('0x99')](_0x0d8b('0xb0'),ut[_0x0d8b('0xb1')](_0x3eb647));}break;case'16':ami[_0x0d8b('0x99')](_0x0d8b('0xb2'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xb3'),this[_0x0d8b('0x13')][_0x3eb647[_0x0d8b('0x66')]]));emitVoiceQueueChannelRemove(ut[_0x0d8b('0x9b')](_0x3eb647,'complete'));_0xb1aa96[_0x0d8b('0xb4')]+=0x1;_0xb1aa96[_0x0d8b('0xb5')]+=0x1;_0xb1aa96[_0x0d8b('0x2d')]+=0x1;ut['decrementTalkink'](_0xb1aa96,'[16]');_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x4,'Answer');rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0xb7'));rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xb8'));rpcDb[_0x0d8b('0xb9')](_0x3eb647);_0xb1aa96[_0x0d8b('0x32')]+=_0x3eb647[_0x0d8b('0xba')];_0xb1aa96[_0x0d8b('0x31')]+=_0x3eb647[_0x0d8b('0xba')];logger[_0x0d8b('0x56')](_0x0d8b('0xbb'),_0x3eb647[_0x0d8b('0xac')],_0x0d8b('0xad'),_0xb1aa96[_0x0d8b('0x51')],'pTalking:\x20',_0xb1aa96[_0x0d8b('0x30')]);delete this[_0x0d8b('0x16')][_0x34affb['linkedid']];break;case'BUSY':_0xb1aa96[_0x0d8b('0xbc')]+=0x1;_0x3eb647[_0x0d8b('0xbd')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x5,_0x0d8b('0xbe'));ami['emit']('custom:agentbusy',ut['buildObj'](_0x3eb647,_0x0d8b('0xbf')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xc0'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xc1'));}else{if(_0x3eb647['countbusyretry']>=_0xb1aa96[_0x0d8b('0xc2')]){rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xc0'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xbd'),_0xb1aa96[_0x0d8b('0xc3')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xc4'):_0xb1aa96[_0x0d8b('0x3f')]+=0x1;_0x3eb647[_0x0d8b('0xc5')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut['logCustomer'](_0x3eb647,0x3,'NoAnswer');ami[_0x0d8b('0x99')](_0x0d8b('0xc6'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xc7')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xc8'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96['dialGlobalMaxRetry']){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3eb647['countnoanswerretry']>=_0xb1aa96[_0x0d8b('0xc9')]){rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xc8'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xc5'),_0xb1aa96[_0x0d8b('0xca')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xcb'):_0xb1aa96[_0x0d8b('0x3d')]+=0x1;_0x3eb647[_0x0d8b('0xcc')]+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x8,_0x0d8b('0xcd'));ami['emit']('custom:agentcongestion',ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xce')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xcf'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut['cloneAction'](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xd0'));}else{if(_0x3eb647[_0x0d8b('0xcc')]>=_0xb1aa96[_0x0d8b('0xd1')]){rpcDb['createCustomerFinal'](_0x3eb647,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xcc'),_0xb1aa96['dialBusyRetryFrequency']),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xd2'):_0xb1aa96['outboundRejectCallsDay']+=0x1;_0x3eb647[_0x0d8b('0xd3')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x14,_0x0d8b('0xd4'));ami[_0x0d8b('0x99')](_0x0d8b('0xd5'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xd6')));rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0xd7'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0x14,_0x0d8b('0xd4'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xd8'));}else{if(_0x3eb647[_0x0d8b('0xd3')]>=_0xb1aa96[_0x0d8b('0xd9')]){rpcDb['createCustomerFinal'](_0x3eb647,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xd3'),_0xb1aa96[_0x0d8b('0xda')]),_0x3eb647['unlockAgent'],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xdb'):_0xb1aa96['outboundAbandonedCallsDay']+=0x1;_0x3eb647[_0x0d8b('0xdc')]+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0xb,_0x0d8b('0xdd'));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xde'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3eb647['countabandonedetry']>=_0xb1aa96[_0x0d8b('0xdf')]){rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xde'));}else{rpcDb[_0x0d8b('0xa3')](ut['scheduledAt'](_0x3eb647,_0x0d8b('0xdc'),_0xb1aa96['dialAbandonedRetryFrequency']),_0x3eb647['unlockAgent'],_0x3eb647[_0x0d8b('0xa7')]);}}break;default:if(_0x3eb647[_0x0d8b('0x69')]){ut[_0x0d8b('0xe0')](_0xb1aa96,_0x0d8b('0xe1'));ut[_0x0d8b('0x72')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xb1aa96['name'],_0x34affb);}_0xb1aa96[_0x0d8b('0x42')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0xc,_0x34affb[_0x0d8b('0xe2')]||_0x34affb[_0x0d8b('0xe3')]);rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xe4'));if(ut['totalGlobal'](_0x3eb647)>=_0xb1aa96['dialGlobalMaxRetry']){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb['createCustomerFinal'](_0x22ee20,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xe5'));}delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];}if(!(_0x3eb647['dialAnswer']&&_0x4ee1e8==='16')){ut[_0x0d8b('0xe6')](_0xb1aa96,_0x0d8b('0xe7'));logger[_0x0d8b('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x3eb647[_0x0d8b('0xac')],'\x20Queue',_0xb1aa96[_0x0d8b('0x51')],'originated:\x20',_0xb1aa96[_0x0d8b('0x4b')]);}if(_0x4ee1e8!==_0x0d8b('0xe8')){delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];delete this[_0x0d8b('0x16')][_0x34affb['destlinkedid']];}}};Preview[_0x0d8b('0xe')]['callProgressDetectingAgent']=function(_0x2d010e,_0x4bd01c,_0x165baa){if(_['isUndefined'](_0x4bd01c)&&'object'!==typeof _0x4bd01c){return;}if(_[_0x0d8b('0xe9')](_0x165baa)&&_0x0d8b('0xea')!==typeof _0x165baa){return;}switch(_0x165baa['reason']){case'0':ut[_0x0d8b('0xeb')](_0x2d010e,0x0,_0x0d8b('0x98'));rpcDb[_0x0d8b('0xec')](_0x2d010e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x2d010e,0x3,'NoAnswer');rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xed'));break;case'5':ut[_0x0d8b('0xeb')](_0x2d010e,0x5,_0x0d8b('0xbe'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xee'));break;case'8':ut[_0x0d8b('0xeb')](_0x2d010e,0x8,_0x0d8b('0xcd'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xef'));break;case'22':ut['logAgent'](_0x2d010e,0x16,_0x0d8b('0xf0'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xf1'));break;default:ut['logAgent'](_0x2d010e,0xc,_0x165baa[_0x0d8b('0xf2')]);rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xef'));}ut[_0x0d8b('0xe6')](_0x4bd01c,_0x0d8b('0xf3'));logger[_0x0d8b('0x56')](_0x0d8b('0xf4'),_0x2d010e[_0x0d8b('0xac')],_0x0d8b('0xad'),_0x4bd01c[_0x0d8b('0x51')],_0x0d8b('0x67'),_0x4bd01c[_0x0d8b('0x4b')]);delete this['actions'][_0x2d010e[_0x0d8b('0xac')]];};Preview[_0x0d8b('0xe')][_0x0d8b('0xf5')]=function(_0x31baaf,_0x590889,_0x55215b,_0x11e5c2,_0x853bee){var _0x222deb=this;return new BPromise(function(_0x59698d,_0x4e2323){if(_['isNil'](_0x590889)||_[_0x0d8b('0x79')](_0x590889['Contact'])||_[_0x0d8b('0x79')](_0x590889[_0x0d8b('0xf6')][_0x0d8b('0xf7')])||_[_0x0d8b('0x79')](_0x590889[_0x0d8b('0xf8')])){_0x4e2323(ut[_0x0d8b('0x4a')](_0x0d8b('0xf9'),_0x11e5c2,_0x853bee));return;}var _0x16994f=uuid['v4']();var _0x5dbe4c=_0x222deb[_0x0d8b('0x13')][_0x590889[_0x0d8b('0xfa')][_0x0d8b('0x51')]];var _0x6b4a65=_0x55215b?_0x222deb['agents'][_0x55215b]['id']:undefined;_0x222deb[_0x0d8b('0x16')][_0x16994f]=new Action(_0x590889,_0x5dbe4c,_0x16994f,_0x55215b,_0x6b4a65);var _0x62fedf=_0x222deb[_0x0d8b('0x16')][_0x16994f];_0x62fedf[_0x0d8b('0xa6')]=_0x11e5c2;_0x62fedf['activeContact']=_0x853bee;_0x62fedf[_0x0d8b('0xfb')]=_0x55215b;if(_[_0x0d8b('0xfc')](_0x31baaf)){_0x222deb[_0x0d8b('0xfd')](_0x62fedf,_0x5dbe4c,_0x590889,_0x55215b)[_0x0d8b('0x78')](function(_0x572329){logger[_0x0d8b('0x56')]('[Preview][execCall][success]',_0x0d8b('0xfe')+_0x62fedf['queue']+_0x0d8b('0xff')+_0x62fedf['idContact'],JSON[_0x0d8b('0x55')](_0x572329));ami['emit'](_0x0d8b('0x100'),ut['buildObj'](_0x62fedf,_0x0d8b('0x101'),_0x222deb['campaignsPreview'][_0x62fedf[_0x0d8b('0x66')]]));_0x59698d(ut['message'](_0x0d8b('0x102')));})[_0x0d8b('0x6f')](function(_0x507587){ut['logger']('[Preview][execCall][failure]',_0x507587);_0x4e2323(ut[_0x0d8b('0x4a')]('Call\x20failed',_0x11e5c2,_0x853bee));});}else{_0x5dbe4c[_0x0d8b('0x3c')]+=0x1;ut['logBlacklist'](_0x62fedf);rpcDb[_0x0d8b('0x103')](_0x62fedf,_0x0d8b('0x104'));delete _0x222deb[_0x0d8b('0x16')][_0x16994f];_0x4e2323(ut[_0x0d8b('0x4a')](_0x0d8b('0x105'),_0x11e5c2,_0x853bee));}});};Preview[_0x0d8b('0xe')]['isTrunkReachable']=function(_0x58d013){return!_[_0x0d8b('0x79')](_0x58d013)&&!_['isNil'](_0x58d013[_0x0d8b('0x51')])&&!_[_0x0d8b('0x79')](_0x58d013[_0x0d8b('0x52')])&&_0x58d013['active']&&!_[_0x0d8b('0x79')](this['trunks'][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])])&&!_[_0x0d8b('0x79')](this['trunks'][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])]['status'])&&(this[_0x0d8b('0x15')][util['format'](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])][_0x0d8b('0x6e')]===_0x0d8b('0x107')||this[_0x0d8b('0x15')][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])][_0x0d8b('0x6e')]===_0x0d8b('0x108'));};Preview[_0x0d8b('0xe')][_0x0d8b('0x7f')]=function(_0x50b987,_0x3c2fb9){var _0xb816d7=this;return new BPromise(function(_0x4f5d39,_0x2cc63a){_0xb816d7['execRun'](_0x50b987,_0x3c2fb9)[_0x0d8b('0x78')](function(_0x4a04c6){_0x4f5d39(_[_0x0d8b('0x6a')](_0x4a04c6,['message']));})['catch'](function(_0x124219){if(_0x124219[_0x0d8b('0x109')]){rpcDb['unlockContact'](_0x50b987);}if(_0x124219['active']){rpcDb['disableContact'](_0x50b987);}_0x2cc63a(_['pick'](_0x124219,[_0x0d8b('0x4a')]));});});};Preview[_0x0d8b('0xe')][_0x0d8b('0x10a')]=function(_0x29e8e6,_0x233ff0){var _0x21329f=this;return new BPromise(function(_0x3d8a14,_0x44ac53){var _0x53de32,_0x19e8d4;rpcDb['getContactPreview'](_0x29e8e6)[_0x0d8b('0x78')](function(_0x4e1f1a){if(!_[_0x0d8b('0x79')](_0x4e1f1a[0x0])){_0x19e8d4=_0x4e1f1a[0x0][_0x0d8b('0x10b')]?![]:!![];_0x53de32=_0x4e1f1a[0x0][_0x0d8b('0x10b')]?!![]:![];_0x53de32=_0x233ff0?!![]:_0x53de32;}var _0x2d90af=_0x21329f[_0x0d8b('0x10c')](_0x4e1f1a);if(_0x2d90af[_0x0d8b('0x10d')]){rpcDb[_0x0d8b('0x10e')](_[_0x0d8b('0x6a')](_0x4e1f1a[0x0],[_0x0d8b('0xf8'),_0x0d8b('0x10f')]))[_0x0d8b('0x78')](function(_0x36527c){_0x21329f[_0x0d8b('0xf5')](_0x36527c,_0x4e1f1a[0x0],_0x233ff0,_0x19e8d4,_0x53de32)['then'](function(_0x479d59){_0x3d8a14(_0x479d59);})['catch'](function(_0x4111e6){_0x44ac53(_0x4111e6);});})[_0x0d8b('0x6f')](function(_0x4c69a3){ut[_0x0d8b('0x5d')]('[Preview][checkIsBlackList]',_0x4c69a3);_0x44ac53(ut[_0x0d8b('0x4a')]('Call\x20unsuccessful',_0x19e8d4,_0x53de32));});}else{_0x44ac53(ut[_0x0d8b('0x4a')](_0x2d90af[_0x0d8b('0x4a')],_0x19e8d4,_0x53de32));}})[_0x0d8b('0x6f')](function(_0x3e7cc7){ut[_0x0d8b('0x5d')](_0x0d8b('0x110'),_0x3e7cc7);_0x44ac53(ut['message'](_0x0d8b('0x111'),![],!![]));});});};Preview['prototype'][_0x0d8b('0x10c')]=function(_0x66040){if(_[_0x0d8b('0x79')](_0x66040)||_[_0x0d8b('0xfc')](_0x66040)||!_[_0x0d8b('0x79')](_0x66040[0x0]['Agent'])&&_[_0x0d8b('0x79')](_0x66040[0x0][_0x0d8b('0x7d')]['name'])){ut[_0x0d8b('0x5d')](_0x0d8b('0x112'),_0x66040);return{'isValid':![],'message':_0x0d8b('0x113')};}var _0x2f90e0=this['campaignsPreview'][_0x66040[0x0][_0x0d8b('0xfa')]['name']];_0x2f90e0[_0x0d8b('0x4a')]='ACTIVE';if(_[_0x0d8b('0x79')](_0x2f90e0)){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f90e0);return{'isValid':![],'message':_0x0d8b('0x114')};}if(!this[_0x0d8b('0x91')](_0x2f90e0[_0x0d8b('0x50')])){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0d8b('0x115')+_0x2f90e0['name']+_0x0d8b('0x116'));if(!this[_0x0d8b('0x91')](_0x2f90e0['TrunkBackup'])){ut[_0x0d8b('0x5d')](_0x0d8b('0x117'),_0x2f90e0[_0x0d8b('0x51')]+_0x0d8b('0x118'));return{'isValid':![],'message':_0x0d8b('0x119')};}}if(!ut[_0x0d8b('0x90')](_0x2f90e0[_0x0d8b('0x37')])){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x2f90e0[_0x0d8b('0x51')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x0d8b('0x115')+_0x2f90e0[_0x0d8b('0x51')]+_0x0d8b('0x11a')};}return{'isValid':!![],'message':_0x0d8b('0x11b')};};Preview[_0x0d8b('0xe')][_0x0d8b('0xfd')]=function(_0x331bc5,_0x1660d5,_0x1a987a,_0x53bfe5){var _0x2f8682=this;return new BPromise(function(_0x3106e9,_0x4cd83e){var _0x2703f1=_0x331bc5[_0x0d8b('0xac')];var _0x4aa208=_0x2f8682[_0x0d8b('0x91')](_0x1660d5[_0x0d8b('0x50')])?util[_0x0d8b('0x58')](_0x0d8b('0x11c'),_0x1660d5[_0x0d8b('0x50')][_0x0d8b('0x51')],_[_0x0d8b('0x79')](_0x1660d5[_0x0d8b('0x3a')])?'':_0x1660d5['dialPrefix'][_0x0d8b('0x11d')]()||'',_0x1660d5[_0x0d8b('0x11e')]>0x0?_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')][_0x0d8b('0x11f')](_0x1660d5[_0x0d8b('0x11e')]):_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')]):util[_0x0d8b('0x58')](_0x0d8b('0x11c'),_[_0x0d8b('0x79')](_0x1660d5['TrunkBackup'])?_0x1660d5['Trunk']['name']:_0x1660d5['TrunkBackup']['name'],_['isNil'](_0x1660d5[_0x0d8b('0x3a')])?'':_0x1660d5['dialPrefix'][_0x0d8b('0x11d')]()||'',_0x1660d5[_0x0d8b('0x11e')]>0x0?_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')][_0x0d8b('0x11f')](_0x1660d5[_0x0d8b('0x11e')]):_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')]);var _0x352485=_0x2f8682[_0x0d8b('0x91')](_0x1660d5[_0x0d8b('0x50')])?ut[_0x0d8b('0x120')](_0x1660d5['Trunk'][_0x0d8b('0x53')],_0x1660d5['dialOriginateCallerIdName'],_0x1660d5[_0x0d8b('0x121')]>0x0?ut['getCallerIdRandom'](_0x1660d5[_0x0d8b('0x122')],_0x1660d5[_0x0d8b('0x121')]):_0x1660d5[_0x0d8b('0x122')]):ut[_0x0d8b('0x120')](_[_0x0d8b('0x79')](_0x1660d5['TrunkBackup'])?_0x1660d5[_0x0d8b('0x50')][_0x0d8b('0x53')]:_0x1660d5['TrunkBackup'][_0x0d8b('0x53')],_0x1660d5['dialOriginateCallerIdName'],_0x1660d5['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0d8b('0x123')](_0x1660d5[_0x0d8b('0x122')],_0x1660d5[_0x0d8b('0x121')]):_0x1660d5[_0x0d8b('0x122')]);if(_0x352485){_0x331bc5[_0x0d8b('0x124')]=ut['extractCalleridName'](_0x352485);_0x331bc5['originatecalleridnum']=ut['extractCalleridNumber'](_0x352485);}var _0x18e6be=ut[_0x0d8b('0x125')](_0x1660d5,_0x1a987a,_0x4aa208,_0x352485,_0x2703f1,_0x331bc5);_[_0x0d8b('0x126')](_0x331bc5,ut[_0x0d8b('0x127')](_0x18e6be));_0x331bc5[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0d8b('0x6d')](ut[_0x0d8b('0x128')](_0x331bc5,_0x1660d5,_0x18e6be,_0x331bc5['activeContact'],_0x53bfe5))[_0x0d8b('0x78')](function(_0x28fa83){_0x1660d5[_0x0d8b('0x4b')]+=0x1;logger[_0x0d8b('0x56')](_0x0d8b('0x129'),_0x2703f1,'\x20Queue',_0x1660d5['name'],_0x0d8b('0x67'),_0x1660d5[_0x0d8b('0x4b')]);_0x3106e9(_0x28fa83);})['catch'](function(_0x3c5a61){ut[_0x0d8b('0xeb')](_0x331bc5,0xe,_0x0d8b('0x12a'));rpcDb['createAgentHistory'](_0x331bc5,'[originateFailure][logOriginateFailure]');_0x4cd83e(_0x3c5a61);});});};Preview[_0x0d8b('0xe')][_0x0d8b('0x23')]=function(_0x598e67){if(this['actions'][_0x598e67[_0x0d8b('0xa8')]]){this['actions'][_0x598e67[_0x0d8b('0xa8')]]['channel']=_0x598e67[_0x0d8b('0x12b')];}};Preview[_0x0d8b('0xe')]['syncOriginateResponse']=function(_0x3411d9){var _0x5d9ab5=this;var _0x31d9fb=this[_0x0d8b('0x16')][_0x3411d9[_0x0d8b('0x12c')]];if(_0x31d9fb){if(_0x31d9fb[_0x0d8b('0xfb')]&&this[_0x0d8b('0x17')][_0x31d9fb['lookAgent']]){ut[_0x0d8b('0x12d')](_0x31d9fb,this[_0x0d8b('0x17')][_0x31d9fb[_0x0d8b('0xfb')]]['name'],this[_0x0d8b('0x17')][_0x31d9fb['lookAgent']]['id']);}var _0x270338=_[_0x0d8b('0x12e')](_0x31d9fb);_0x270338['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x24705e=_0x5d9ab5[_0x0d8b('0x13')][_0x31d9fb['queue']];if(ut[_0x0d8b('0x12f')](_0x3411d9['response'])){if(_0x31d9fb[_0x0d8b('0xa6')]){rpcDb[_0x0d8b('0x130')](_0x31d9fb[_0x0d8b('0x131')]);}if(_0x31d9fb[_0x0d8b('0xa7')]){rpcDb[_0x0d8b('0x82')](_0x31d9fb[_0x0d8b('0x131')]);}ami[_0x0d8b('0x99')](_0x0d8b('0x132'),ut['buildObj'](_0x31d9fb,_0x0d8b('0x133'),this['campaignsPreview'][_0x31d9fb['queue']]));this[_0x0d8b('0x134')](_0x270338,_0x24705e,_0x3411d9);}else{_0x31d9fb[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')](_0x0d8b('0xa9'));ut[_0x0d8b('0xeb')](_0x270338,0x4,_0x0d8b('0x135'));rpcDb[_0x0d8b('0xec')](_0x270338,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x0d8b('0xe')]['syncHangup']=function(_0x5d3cd5){var _0x3bdb03=this;var _0x5f4e06=this[_0x0d8b('0x16')][_0x5d3cd5['linkedid']];var _0x4a9bc0;if(_0x5f4e06){_0x4a9bc0=this[_0x0d8b('0x13')][_0x5f4e06[_0x0d8b('0x66')]];logger[_0x0d8b('0x56')](_0x0d8b('0x136'),_0x5d3cd5[_0x0d8b('0xa8')],_0x0d8b('0xad'),_0x4a9bc0['name'],'pTalking:\x20',_0x4a9bc0[_0x0d8b('0x30')]);}if(this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]]&&_0x5d3cd5[_0x0d8b('0xa8')]!==_0x5d3cd5[_0x0d8b('0xac')]){if(_0x5d3cd5[_0x0d8b('0x137')]==='16'&&this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]][_0x0d8b('0x69')]){this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}else if(this[_0x0d8b('0x16')][_0x5d3cd5['linkedid']]['dialAnswer']){logger['info'](_0x0d8b('0x138'),_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')],_0x0d8b('0xad'),_0x4a9bc0[_0x0d8b('0x51')],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}}else if(_0x5f4e06&&_[_0x0d8b('0x79')](_0x5f4e06[_0x0d8b('0x139')])&&_0x4a9bc0[_0x0d8b('0x13a')]&&_0x5d3cd5[_0x0d8b('0xa8')]===_0x5d3cd5[_0x0d8b('0xac')]&&_[_0x0d8b('0x79')](_0x5d3cd5[_0x0d8b('0xf2')])&&_0x5d3cd5['cause']==='16'&&_0x5d3cd5['channelstate']==='6'&&_[_0x0d8b('0xe9')](_0x5f4e06['transfer'])){if(_0x5f4e06['unlockAgent']){rpcDb['unlockContact'](_0x5f4e06[_0x0d8b('0x131')]);}if(_0x5f4e06[_0x0d8b('0xa7')]){rpcDb[_0x0d8b('0x82')](_0x5f4e06[_0x0d8b('0x131')]);}_0x5d3cd5[_0x0d8b('0xf2')]='22';this['callProgressDetectingAgent'](_0x5f4e06,_0x4a9bc0,_0x5d3cd5);}else if(_0x5f4e06&&_0x5f4e06[_0x0d8b('0x13b')]){if(_0x5d3cd5[_0x0d8b('0x137')]==='16'&&this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]]['dialAnswer']){logger['info'](_0x0d8b('0x13c'),_0x5d3cd5['linkedid'],_0x5d3cd5[_0x0d8b('0x137')],_0x0d8b('0xad'),_0x4a9bc0[_0x0d8b('0x51')],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5['linkedid'],_0x5d3cd5[_0x0d8b('0x137')]);}else if(this['actions'][_0x5d3cd5[_0x0d8b('0xa8')]][_0x0d8b('0x69')]){logger[_0x0d8b('0x56')](_0x0d8b('0x138'),_0x5d3cd5['linkedid'],_0x5d3cd5['cause'],'\x20Queue',_0x4a9bc0['name'],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}}};Preview[_0x0d8b('0xe')]['syncDialEnd']=function(_0x495456){if(this['actions'][_0x495456['destlinkedid']]&&_0x495456[_0x0d8b('0x13d')]!==_0x495456[_0x0d8b('0x13e')]){this['callProgressDetectingCustomer'](_0x495456,_0x495456[_0x0d8b('0x13d')],_0x495456[_0x0d8b('0xe3')]);}};Preview[_0x0d8b('0xe')][_0x0d8b('0x1f')]=function(_0x289b7e){if(this[_0x0d8b('0x16')][_0x289b7e[_0x0d8b('0xa8')]]&&_0x289b7e['linkedid']!==_0x289b7e[_0x0d8b('0xac')]&&!this[_0x0d8b('0x16')][_0x289b7e[_0x0d8b('0xa8')]]['dialAnswer']){if(_0x289b7e[_0x0d8b('0x137')]==='1'){this[_0x0d8b('0x95')](_0x289b7e,_0x289b7e[_0x0d8b('0xa8')],_0x289b7e[_0x0d8b('0x137')]);}}};Preview[_0x0d8b('0xe')][_0x0d8b('0x13f')]=function(_0x2e3310,_0x1742bd,_0x843725){if(this['actions'][_0x2e3310]){if(_['isNil'](this['actions'][_0x2e3310][_0x0d8b('0x140')])){this[_0x0d8b('0x16')][_0x2e3310][_0x0d8b('0x140')]={};}this[_0x0d8b('0x16')][_0x2e3310][_0x0d8b('0x140')][_0x1742bd]=_0x843725;}};Preview[_0x0d8b('0xe')][_0x0d8b('0x25')]=function(_0x1c88ce){try{if(!_[_0x0d8b('0x79')](_0x1c88ce)){if(ut[_0x0d8b('0x141')](_['keys'](_0x1c88ce['variable'])[0x0])){this[_0x0d8b('0x13f')](_0x1c88ce[_0x0d8b('0xac')],_[_0x0d8b('0x142')](_0x1c88ce[_0x0d8b('0x143')])[0x0],_0x1c88ce['value']);}}}catch(_0x5f467e){logger[_0x0d8b('0x144')](_0x0d8b('0x145'),util[_0x0d8b('0x146')](_0x5f467e,{'showHidden':![],'depth':null}));}};Preview[_0x0d8b('0xe')][_0x0d8b('0x27')]=function(_0x51240b){if(_0x51240b){if(this['actions'][_0x51240b[_0x0d8b('0x147')]]){this[_0x0d8b('0x16')][_0x51240b[_0x0d8b('0x147')]][_0x0d8b('0x13b')]=!![];}}};Preview['prototype'][_0x0d8b('0x29')]=function(_0x22e3aa){if(_0x22e3aa){if(this[_0x0d8b('0x16')][_0x22e3aa[_0x0d8b('0x148')]]){this[_0x0d8b('0x16')][_0x22e3aa[_0x0d8b('0x148')]]['transfer']=!![];}}};module[_0x0d8b('0x149')]=Preview; \ No newline at end of file +var _0xe706=['uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','BUSY','outboundBusyCallsDay','countglobal','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','dialstatus','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hanguprequest','syncDialEnd','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','pTalking','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]'];(function(_0x5ac2ff,_0xc342de){var _0x152512=function(_0x416a85){while(--_0x416a85){_0x5ac2ff['push'](_0x5ac2ff['shift']());}};_0x152512(++_0xc342de);}(_0xe706,0xa3));var _0x6e70=function(_0x625a73,_0x50ae08){_0x625a73=_0x625a73-0x0;var _0x3eceb5=_0xe706[_0x625a73];return _0x3eceb5;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var uuid=require('uuid');var moment=require(_0x6e70('0x3'));var md5=require(_0x6e70('0x4'));var Redis=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var loggerAction=require(_0x6e70('0x7'))(_0x6e70('0x9'));var ami=require(_0x6e70('0xa'));var rpcDb=require(_0x6e70('0xb'));var Action=require(_0x6e70('0xc'));var ut=require(_0x6e70('0xd'));config[_0x6e70('0xe')]=_[_0x6e70('0xf')](config[_0x6e70('0xe')],{'host':_0x6e70('0x10'),'port':0x18eb});var io=require(_0x6e70('0x11'))(new Redis(config[_0x6e70('0xe')]));var Sequence=function(){};Sequence[_0x6e70('0x12')][_0x6e70('0x13')]=function(_0x743eb5){this[_0x6e70('0x14')]=this[_0x6e70('0x14')]?this[_0x6e70('0x14')]['finally'](_0x743eb5):_0x743eb5();};function Preview(_0x47f6b2){this[_0x6e70('0x15')]=new Sequence();this[_0x6e70('0x16')]=_0x47f6b2[_0x6e70('0x17')];this[_0x6e70('0x18')]=_0x47f6b2[_0x6e70('0x18')];this[_0x6e70('0x19')]={};this[_0x6e70('0x1a')]=_0x47f6b2[_0x6e70('0x1a')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6e70('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1c'),this['syncHangupRequest'][_0x6e70('0x1b')](this));ami['on']('dialend',this[_0x6e70('0x1d')][_0x6e70('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0x6e70('0x1b')](this));ami['on']('varset',this[_0x6e70('0x1e')][_0x6e70('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1f'),this[_0x6e70('0x20')][_0x6e70('0x1b')](this));this[_0x6e70('0x21')](this[_0x6e70('0x16')]);}function emit(_0x1b2453,_0x44a49f,_0x29326f){io['to'](_0x1b2453)[_0x6e70('0x22')](_0x44a49f,_0x29326f);}function emitCampaignPreview(_0x4a0cfe){if(_0x4a0cfe[_0x6e70('0x23')]===_0x6e70('0x24')){var _0x27b294={'id':_0x4a0cfe['id'],'name':_0x4a0cfe['name'],'strategy':_0x4a0cfe[_0x6e70('0x25')],'answered':_0x4a0cfe[_0x6e70('0x26')],'available':_0x4a0cfe[_0x6e70('0x27')],'loggedIn':_0x4a0cfe['loggedIn'],'pTalking':_0x4a0cfe[_0x6e70('0x28')],'sumBillable':_0x4a0cfe['sumBillable'],'sumDuration':_0x4a0cfe['sumDuration'],'sumHoldTime':_0x4a0cfe['sumHoldTime']||0x0,'talking':_0x4a0cfe[_0x6e70('0x29')],'total':_0x4a0cfe[_0x6e70('0x2a')],'type':_0x4a0cfe['type'],'unmanaged':_0x4a0cfe[_0x6e70('0x2b')],'abandoned':_0x4a0cfe[_0x6e70('0x2c')],'waiting':_0x4a0cfe['waiting'],'loggedInDb':_0x4a0cfe[_0x6e70('0x2d')],'dialActive':_0x4a0cfe[_0x6e70('0x2e')],'dialMethod':_0x4a0cfe[_0x6e70('0x2f')],'dialOriginateCallerIdName':_0x4a0cfe['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4a0cfe['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4a0cfe[_0x6e70('0x30')],'dialPrefix':_0x4a0cfe[_0x6e70('0x31')],'outboundAnswerAgiCallsDay':_0x4a0cfe[_0x6e70('0x32')],'outboundAnswerCallsDay':_0x4a0cfe[_0x6e70('0x33')],'outboundBlacklistCallsDay':_0x4a0cfe[_0x6e70('0x34')],'outboundBusyCallsDay':_0x4a0cfe['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4a0cfe[_0x6e70('0x35')],'outboundDropCallsDayACS':_0x4a0cfe[_0x6e70('0x36')],'outboundDropCallsDayCallersExit':_0x4a0cfe[_0x6e70('0x37')],'outboundDropCallsDayTimeout':_0x4a0cfe[_0x6e70('0x38')],'outboundNoAnswerCallsDay':_0x4a0cfe[_0x6e70('0x39')],'outboundNoSuchCallsDay':_0x4a0cfe[_0x6e70('0x3a')],'outboundOriginateFailureCallsDay':_0x4a0cfe[_0x6e70('0x3b')],'outboundReCallsDay':_0x4a0cfe[_0x6e70('0x3c')],'outboundRejectCallsDay':_0x4a0cfe[_0x6e70('0x3d')],'outboundUnknownCallsDay':_0x4a0cfe[_0x6e70('0x3e')],'outboundAbandonedCallsDay':_0x4a0cfe['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4a0cfe[_0x6e70('0x3f')],'predictiveIntervalAvgHoldtime':_0x4a0cfe['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4a0cfe[_0x6e70('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x4a0cfe['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4a0cfe[_0x6e70('0x41')],'predictiveIntervalErlangCalls':_0x4a0cfe[_0x6e70('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a0cfe[_0x6e70('0x43')],'predictiveIntervalHitRate':_0x4a0cfe['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4a0cfe[_0x6e70('0x44')],'predictiveIntervalPauses':_0x4a0cfe[_0x6e70('0x45')],'predictiveIntervalAvailable':_0x4a0cfe['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4a0cfe[_0x6e70('0x46')],'message':_0x4a0cfe[_0x6e70('0x47')],'originated':_0x4a0cfe['originated'],'erlangCalls':_0x4a0cfe[_0x6e70('0x48')],'erlangCallToSecond':_0x4a0cfe[_0x6e70('0x49')],'erlangAbandonmentRate':_0x4a0cfe[_0x6e70('0x4a')],'erlangBusyFactor':_0x4a0cfe[_0x6e70('0x4b')],'startPredictive':_0x4a0cfe[_0x6e70('0x4c')],'startProgressive':_0x4a0cfe[_0x6e70('0x4d')]};if(_0x4a0cfe[_0x6e70('0x4e')]){_0x27b294[_0x6e70('0x4e')]={'id':_0x4a0cfe[_0x6e70('0x4e')]['id'],'name':_0x4a0cfe[_0x6e70('0x4e')]['name'],'active':_0x4a0cfe[_0x6e70('0x4e')]['active'],'callerid':_0x4a0cfe[_0x6e70('0x4e')][_0x6e70('0x4f')]};}if(_0x4a0cfe[_0x6e70('0x50')]){_0x27b294[_0x6e70('0x50')]={'id':_0x4a0cfe[_0x6e70('0x50')]['id'],'name':_0x4a0cfe[_0x6e70('0x50')][_0x6e70('0x51')]};}var _0xdd0bee=md5(JSON[_0x6e70('0x52')](_0x27b294));if(_0x4a0cfe[_0x6e70('0x4')]!==_0xdd0bee){_0x4a0cfe[_0x6e70('0x4')]=_0xdd0bee;emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x27b294['name']),'voice_queue:save',_0x27b294);}}}function emitVoiceQueueChannelRemove(_0x5424eb){logger[_0x6e70('0x55')](_0x6e70('0x56'),JSON[_0x6e70('0x52')](_0x5424eb));emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x5424eb[_0x6e70('0x51')]),'voice_queue_channel:remove',_0x5424eb);}function notSendMessagesQueue(_0x3b508c){if(_0x3b508c[_0x6e70('0x57')]){if(_0x3b508c[_0x6e70('0x58')]===0x0&&_0x3b508c[_0x6e70('0x28')]===0x0){_0x3b508c[_0x6e70('0x57')]=![];_0x3b508c[_0x6e70('0x27')]=0x0;_0x3b508c[_0x6e70('0x59')]=0x0;_0x3b508c[_0x6e70('0x47')]='NOT_ACTIVE';ut[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x3b508c[_0x6e70('0x51')]+_0x6e70('0x5c'));}else{_0x3b508c[_0x6e70('0x47')]=_0x6e70('0x5d');ut[_0x6e70('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b508c['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x3b508c);}}Preview[_0x6e70('0x12')][_0x6e70('0x21')]=function(){var _0x83847b=this;setInterval(function(){_0x83847b[_0x6e70('0x5e')]();},0x7cf);};Preview[_0x6e70('0x12')]['syncCampaigns']=function(){var _0x225d44=this[_0x6e70('0x16')];this[_0x6e70('0x5f')]+=0x1;for(var _0x52b197 in _0x225d44){if(_0x225d44['hasOwnProperty'](_0x52b197)&&(_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x8')||_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x60'))&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(this[_0x6e70('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6e70('0x61')]();}}if(_0x225d44['hasOwnProperty'](_0x52b197)&&_0x225d44[_0x52b197][_0x6e70('0x2f')]===_0x6e70('0x8')&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(_0x225d44[_0x52b197]['dialActive']){this[_0x6e70('0x62')](_0x225d44[_0x52b197]);this[_0x6e70('0x63')](_0x225d44[_0x52b197]);}else{notSendMessagesQueue(_0x225d44[_0x52b197]);}}}};Preview[_0x6e70('0x12')][_0x6e70('0x64')]=function(_0x8f243d){var _0x3fcb2d=this;this[_0x6e70('0x15')]['enqueue'](function(){if(!_[_0x6e70('0x65')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d])){loggerAction[_0x6e70('0x55')](_0x6e70('0x66'),_0x8f243d,_0x6e70('0x67'),_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')],'originated:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d['campaignsPreview'][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]]['originated']),'pTalking:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']]['pTalking']),JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x69')]),JSON[_0x6e70('0x52')](_[_0x6e70('0x6a')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d],['contactId',_0x6e70('0x6b'),_0x6e70('0x6c'),_0x6e70('0x6d')])));return ami[_0x6e70('0x6e')]({'action':_0x6e70('0x6f'),'channel':_0x3fcb2d['actions'][_0x8f243d]['channel']})[_0x6e70('0x70')](function(_0x2e3ea6){if(_0x2e3ea6[_0x6e70('0x47')]===_0x6e70('0x71')){setTimeout(function(){if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]){ut['updateOriginated'](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['dialAnswer']===!![]){ut[_0x6e70('0x73')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));ut[_0x6e70('0x74')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]);}ut['loggerError'](_0x6e70('0x75')+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']);delete _0x3fcb2d[_0x6e70('0x19')][_0x8f243d];}},0x2328);}});}});};Preview[_0x6e70('0x12')][_0x6e70('0x61')]=function(){var _0x46d536=this;loggerAction[_0x6e70('0x55')]('[action]',_[_0x6e70('0x76')](this[_0x6e70('0x19')]));for(var _0x10d655 in this[_0x6e70('0x19')]){if(_0x46d536[_0x6e70('0x19')][_0x6e70('0x77')](_0x10d655)){_0x46d536[_0x6e70('0x64')](_0x10d655);}}};Preview[_0x6e70('0x12')][_0x6e70('0x63')]=function(_0x344676){var _0x13dd17=this;rpcDb[_0x6e70('0x78')](_0x344676['id'],ut[_0x6e70('0x79')](this[_0x6e70('0x1a')]))[_0x6e70('0x7a')](function(_0x2240a1){if(!_[_0x6e70('0x65')](_0x2240a1)){for(var _0x4329a6=0x0;_0x4329a6<_0x2240a1[_0x6e70('0x7b')];_0x4329a6+=0x1){if(ut[_0x6e70('0x7c')](_0x2240a1[_0x4329a6]['scheduledat'])<_0x344676[_0x6e70('0x7d')]*0x3c){if(_0x2240a1[_0x4329a6][_0x6e70('0x7e')]&&!_0x2240a1[_0x4329a6][_0x6e70('0x7e')][_0x6e70('0x7f')]){_0x13dd17[_0x6e70('0x80')](_0x2240a1[_0x4329a6]['id'])[_0x6e70('0x7a')](ut['logger2'](_0x6e70('0x81')))[_0x6e70('0x70')](ut['logger2'](_0x6e70('0x81')));}else{rpcDb[_0x6e70('0x82')](_0x2240a1[_0x4329a6]['id']);}}else{var _0x459a30=new Action(_0x2240a1[_0x4329a6],_0x344676);_0x459a30['starttime']=moment()['format'](_0x6e70('0x83'));_0x344676[_0x6e70('0x3c')]+=0x1;ut[_0x6e70('0x84')](_0x459a30,0x17,_0x6e70('0x85'));if(_0x344676[_0x6e70('0x86')]){rpcDb[_0x6e70('0x87')](ut[_0x6e70('0x88')](_0x2240a1[_0x4329a6]));rpcDb['createCustomerHistory'](_0x459a30,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6e70('0x84')](_0x459a30,0x16,_0x6e70('0x89'));rpcDb[_0x6e70('0x8a')](_0x459a30,_0x6e70('0x8b'));rpcDb['createCustomerFinal'](_0x459a30,'[HistoryRecallClose]');}}}}})[_0x6e70('0x70')](ut[_0x6e70('0x8c')]('[getContactRecallMe]'));};Preview['prototype'][_0x6e70('0x62')]=function(_0x47fbed){_0x47fbed[_0x6e70('0x57')]=!![];if(ut[_0x6e70('0x8d')](_0x47fbed[_0x6e70('0x8e')])){_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x8f');}else if(!ut[_0x6e70('0x90')](_0x47fbed[_0x6e70('0x2e')])){_0x47fbed[_0x6e70('0x47')]='NOT_ACTIVE';}else if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x4e')])){if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x92')])){_0x47fbed[_0x6e70('0x47')]='TRUNK_IS_NOT_REACHABLE';}else{_0x47fbed['message']='ACTIVE';}}else{_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x93');}emitCampaignPreview(_0x47fbed);};Preview[_0x6e70('0x12')]['callProgressDetectingCustomer']=function(_0x58cf1c,_0x2fc2a2,_0x3dae08){var _0x3c2830=this;var _0x195166=this[_0x6e70('0x19')][_0x2fc2a2];var _0x32b884=this['campaignsPreview'][_0x195166[_0x6e70('0x68')]];var _0x3f5896;if(_0x32b884){switch(_0x3dae08){case'1':_0x32b884[_0x6e70('0x3a')]+=0x1;_0x195166[_0x6e70('0x94')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x0,'NoSuchNumber');ami[_0x6e70('0x22')](_0x6e70('0x96'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0x98')));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0x99'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0x9e'));}else{if(_0x195166[_0x6e70('0x94')]>=_0x32b884[_0x6e70('0x9f')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0x9e'));}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0x94'),_0x32b884[_0x6e70('0xa1')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xa4'):var _0x25e685=moment()[_0x6e70('0x53')](_0x6e70('0x83'));_0x195166['responsetime']=_0x25e685;_0x195166['answertime']=_0x25e685;_0x195166[_0x6e70('0x69')]=!![];_0x32b884[_0x6e70('0x28')]+=0x1;logger['info'](_0x6e70('0xa5'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);ami[_0x6e70('0x22')](_0x6e70('0xa9'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0xaa'),this[_0x6e70('0x16')][_0x195166[_0x6e70('0x68')]]));if(_0x32b884[_0x6e70('0xab')]){ami[_0x6e70('0x22')]('custom:agentConnectPreview',ut['buildAcw'](_0x195166));}break;case'16':ami[_0x6e70('0x22')]('custom:agentcomplete',ut[_0x6e70('0x97')](_0x195166,'complete',this['campaignsPreview'][_0x195166[_0x6e70('0x68')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x195166,'complete'));_0x32b884[_0x6e70('0x33')]+=0x1;_0x32b884[_0x6e70('0x2a')]+=0x1;_0x32b884[_0x6e70('0x26')]+=0x1;ut['decrementTalkink'](_0x32b884,'[16]');_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xad'));rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xae'));rpcDb[_0x6e70('0xaf')](_0x195166);_0x32b884[_0x6e70('0xb0')]+=_0x195166['talktime'];_0x32b884[_0x6e70('0xb1')]+=_0x195166[_0x6e70('0xb2')];logger[_0x6e70('0x55')]('[syncHangup][talking][decrement]',_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xb3'):_0x32b884[_0x6e70('0xb4')]+=0x1;_0x195166['countbusyretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x5,_0x6e70('0xb6'));ami[_0x6e70('0x22')]('custom:agentbusy',ut['buildObj'](_0x195166,_0x6e70('0xb7')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xb8'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xb9'));}else{if(_0x195166[_0x6e70('0xba')]>=_0x32b884[_0x6e70('0xbb')]){rpcDb['createCustomerFinal'](_0x195166,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0xba'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case'NOANSWER':_0x32b884[_0x6e70('0x39')]+=0x1;_0x195166['countnoanswerretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x3,_0x6e70('0xbe'));ami[_0x6e70('0x22')](_0x6e70('0xbf'),ut[_0x6e70('0x97')](_0x195166,'noanswer'));rpcDb[_0x6e70('0x8a')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884['dialGlobalMaxRetry']){_0x3f5896=ut['cloneAction'](_0x195166,0xf,'Global');rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xc0'));}else{if(_0x195166[_0x6e70('0xc1')]>=_0x32b884[_0x6e70('0xc2')]){rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countnoanswerretry',_0x32b884[_0x6e70('0xc4')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case'CONGESTION':_0x32b884['outboundCongestionCallsDay']+=0x1;_0x195166[_0x6e70('0xc5')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x8,_0x6e70('0xc6'));ami[_0x6e70('0x22')](_0x6e70('0xc7'),ut['buildObj'](_0x195166,_0x6e70('0xc8')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xc9'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xca'));}else{if(_0x195166['countcongestionretry']>=_0x32b884[_0x6e70('0xcb')]){rpcDb['createCustomerFinal'](_0x195166,_0x6e70('0xc9'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xc5'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xcc'):_0x32b884[_0x6e70('0x3d')]+=0x1;_0x195166[_0x6e70('0xcd')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x14,_0x6e70('0xce'));ami[_0x6e70('0x22')](_0x6e70('0xcf'),ut['buildObj'](_0x195166,'agentreject'));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xd0'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0x14,_0x6e70('0xce'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xd1'));}else{if(_0x195166[_0x6e70('0xcd')]>=_0x32b884[_0x6e70('0xd2')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd1'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xcd'),_0x32b884[_0x6e70('0xd3')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xd4'):_0x32b884[_0x6e70('0xd5')]+=0x1;_0x195166[_0x6e70('0xd6')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0xb,'Abandoned');rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xd7'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x195166[_0x6e70('0xd8')]>=_0x32b884['dialAbandonedMaxRety']){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd7'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countabandonedretry',_0x32b884[_0x6e70('0xd9')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}break;default:if(_0x195166[_0x6e70('0x69')]){ut['decrementTalkink'](_0x32b884,_0x6e70('0xda'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x32b884[_0x6e70('0x51')],_0x58cf1c);}_0x32b884[_0x6e70('0x3e')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut['totalGlobal'](_0x195166);ut[_0x6e70('0x84')](_0x195166,0xc,_0x58cf1c[_0x6e70('0xdb')]||_0x58cf1c['dialstatus']);rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xdc'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xdd'));}else{rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];}if(!(_0x195166['dialAnswer']&&_0x3dae08==='16')){ut[_0x6e70('0xde')](_0x32b884,_0x6e70('0xdf'));logger['info'](_0x6e70('0xe0'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884['name'],_0x6e70('0xe1'),_0x32b884[_0x6e70('0x58')]);}if(_0x3dae08!==_0x6e70('0xa4')){delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xe2')]];}}};Preview[_0x6e70('0x12')][_0x6e70('0xe3')]=function(_0x33a93c,_0x273ed6,_0x41b70a){if(_[_0x6e70('0xe4')](_0x273ed6)&&'object'!==typeof _0x273ed6){return;}if(_[_0x6e70('0xe4')](_0x41b70a)&&_0x6e70('0xe5')!==typeof _0x41b70a){return;}switch(_0x41b70a[_0x6e70('0xe6')]){case'0':ut[_0x6e70('0xe7')](_0x33a93c,0x0,_0x6e70('0xe8'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xe9'));break;case'3':ut[_0x6e70('0xe7')](_0x33a93c,0x3,_0x6e70('0xbe'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xea'));break;case'5':ut['logAgent'](_0x33a93c,0x5,'Busy');rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xec'));break;case'8':ut[_0x6e70('0xe7')](_0x33a93c,0x8,_0x6e70('0xc6'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xed'));break;case'22':ut[_0x6e70('0xe7')](_0x33a93c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x33a93c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6e70('0xe7')](_0x33a93c,0xc,_0x41b70a[_0x6e70('0xe6')]);rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xed'));}ut[_0x6e70('0xde')](_0x273ed6,_0x6e70('0xee'));logger[_0x6e70('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x33a93c[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x273ed6[_0x6e70('0x51')],_0x6e70('0xe1'),_0x273ed6[_0x6e70('0x58')]);delete this[_0x6e70('0x19')][_0x33a93c[_0x6e70('0xa6')]];};Preview[_0x6e70('0x12')][_0x6e70('0xef')]=function(_0x541c25,_0x1a2a44,_0x321da8,_0x5b4a66,_0x2a1205){var _0x1f1b96=this;return new BPromise(function(_0x397289,_0x551c7e){if(_[_0x6e70('0x65')](_0x1a2a44)||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')])||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')][_0x6e70('0xf1')])||_['isNil'](_0x1a2a44['VoiceQueueId'])){_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0xf2'),_0x5b4a66,_0x2a1205));return;}var _0xc93d60=uuid['v4']();var _0x432794=_0x1f1b96[_0x6e70('0x16')][_0x1a2a44[_0x6e70('0x67')]['name']];var _0x3df7bd=_0x321da8?_0x1f1b96[_0x6e70('0x1a')][_0x321da8]['id']:undefined;_0x1f1b96[_0x6e70('0x19')][_0xc93d60]=new Action(_0x1a2a44,_0x432794,_0xc93d60,_0x321da8,_0x3df7bd);var _0x154697=_0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x154697[_0x6e70('0xa2')]=_0x5b4a66;_0x154697[_0x6e70('0xbd')]=_0x2a1205;_0x154697[_0x6e70('0xf3')]=_0x321da8;if(_[_0x6e70('0xf4')](_0x541c25)){_0x1f1b96[_0x6e70('0xf5')](_0x154697,_0x432794,_0x1a2a44,_0x321da8)[_0x6e70('0x7a')](function(_0x8b237a){logger[_0x6e70('0x55')](_0x6e70('0xf6'),_0x6e70('0xf7')+_0x154697[_0x6e70('0x68')]+_0x6e70('0xf8')+_0x154697['idContact'],JSON['stringify'](_0x8b237a));ami[_0x6e70('0x22')](_0x6e70('0xf9'),ut[_0x6e70('0x97')](_0x154697,_0x6e70('0xfa'),_0x1f1b96[_0x6e70('0x16')][_0x154697[_0x6e70('0x68')]]));_0x397289(ut['message'](_0x6e70('0xfb')));})['catch'](function(_0x2f05b2){ut['logger'](_0x6e70('0xfc'),_0x2f05b2);_0x551c7e(ut['message'](_0x6e70('0xfd'),_0x5b4a66,_0x2a1205));});}else{_0x432794[_0x6e70('0x34')]+=0x1;ut[_0x6e70('0xfe')](_0x154697);rpcDb['createHistory'](_0x154697,_0x6e70('0xff'));delete _0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0x100'),_0x5b4a66,_0x2a1205));}});};Preview[_0x6e70('0x12')][_0x6e70('0x91')]=function(_0x1e8bfd){return!_['isNil'](_0x1e8bfd)&&!_[_0x6e70('0x65')](_0x1e8bfd[_0x6e70('0x51')])&&!_['isNil'](_0x1e8bfd[_0x6e70('0x101')])&&_0x1e8bfd[_0x6e70('0x101')]&&!_['isNil'](this['trunks'][util[_0x6e70('0x53')]('SIP/%s',_0x1e8bfd[_0x6e70('0x51')])])&&!_[_0x6e70('0x65')](this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')])&&(this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x103')||this['trunks'][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x104'));};Preview[_0x6e70('0x12')][_0x6e70('0x80')]=function(_0xac161,_0x44ebd6){var _0x568799=this;return new BPromise(function(_0x4bdcc,_0xa512d1){_0x568799[_0x6e70('0x105')](_0xac161,_0x44ebd6)['then'](function(_0x88522){_0x4bdcc(_[_0x6e70('0x6a')](_0x88522,[_0x6e70('0x47')]));})[_0x6e70('0x70')](function(_0x4af0bc){if(_0x4af0bc['unlock']){rpcDb[_0x6e70('0x106')](_0xac161);}if(_0x4af0bc['active']){rpcDb['disableContact'](_0xac161);}_0xa512d1(_[_0x6e70('0x6a')](_0x4af0bc,[_0x6e70('0x47')]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x105')]=function(_0x3bc12b,_0x22827){var _0xf7e813=this;return new BPromise(function(_0x3fef9d,_0x20fe70){var _0x41df1b,_0x484806;rpcDb[_0x6e70('0x107')](_0x3bc12b)[_0x6e70('0x7a')](function(_0xad1b46){if(!_[_0x6e70('0x65')](_0xad1b46[0x0])){_0x484806=_0xad1b46[0x0][_0x6e70('0x108')]?![]:!![];_0x41df1b=_0xad1b46[0x0][_0x6e70('0x108')]?!![]:![];_0x41df1b=_0x22827?!![]:_0x41df1b;}var _0x2033fa=_0xf7e813[_0x6e70('0x109')](_0xad1b46);if(_0x2033fa[_0x6e70('0x10a')]){rpcDb[_0x6e70('0x10b')](_['pick'](_0xad1b46[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2198fa){_0xf7e813[_0x6e70('0xef')](_0x2198fa,_0xad1b46[0x0],_0x22827,_0x484806,_0x41df1b)[_0x6e70('0x7a')](function(_0x596bbd){_0x3fef9d(_0x596bbd);})[_0x6e70('0x70')](function(_0x5c8b78){_0x20fe70(_0x5c8b78);});})[_0x6e70('0x70')](function(_0x59e8bf){ut['logger'](_0x6e70('0x10c'),_0x59e8bf);_0x20fe70(ut[_0x6e70('0x47')](_0x6e70('0x10d'),_0x484806,_0x41df1b));});}else{_0x20fe70(ut[_0x6e70('0x47')](_0x2033fa[_0x6e70('0x47')],_0x484806,_0x41df1b));}})[_0x6e70('0x70')](function(_0x2cfb23){ut['logger'](_0x6e70('0x10e'),_0x2cfb23);_0x20fe70(ut[_0x6e70('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x109')]=function(_0x151c30){if(_['isNil'](_0x151c30)||_[_0x6e70('0xf4')](_0x151c30)||!_[_0x6e70('0x65')](_0x151c30[0x0]['Agent'])&&_['isNil'](_0x151c30[0x0][_0x6e70('0x7e')][_0x6e70('0x51')])){ut[_0x6e70('0x5a')](_0x6e70('0x10f'),_0x151c30);return{'isValid':![],'message':_0x6e70('0x110')};}var _0x48556b=this['campaignsPreview'][_0x151c30[0x0][_0x6e70('0x67')][_0x6e70('0x51')]];_0x48556b[_0x6e70('0x47')]='ACTIVE';if(_[_0x6e70('0x65')](_0x48556b)){ut[_0x6e70('0x5a')](_0x6e70('0x111'),_0x48556b);return{'isValid':![],'message':_0x6e70('0x112')};}if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x4e')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x6e70('0x114')+_0x48556b[_0x6e70('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x92')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x48556b['name']+_0x6e70('0x115'));return{'isValid':![],'message':_0x6e70('0x116')};}}if(!ut[_0x6e70('0x90')](_0x48556b['dialActive'])){ut[_0x6e70('0x5a')](_0x6e70('0x117'),_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118')};}return{'isValid':!![],'message':_0x6e70('0x119')};};Preview[_0x6e70('0x12')][_0x6e70('0xf5')]=function(_0x24ebf4,_0xa08f5,_0x28bc96,_0x2eb49f){var _0x46a4c2=this;return new BPromise(function(_0x4e0788,_0x53f283){var _0x11b784=_0x24ebf4[_0x6e70('0xa6')];var _0x323887=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?util[_0x6e70('0x53')](_0x6e70('0x11a'),_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x31')])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')]['phone'][_0x6e70('0x11d')](_0xa08f5[_0x6e70('0x11c')]):_0x28bc96[_0x6e70('0xf0')]['phone']):util[_0x6e70('0x53')](_0x6e70('0x11a'),_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')]:_0xa08f5['TrunkBackup'][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5['dialPrefix'])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')][_0x6e70('0xf1')]['substring'](_0xa08f5['dialCutDigit']):_0x28bc96[_0x6e70('0xf0')]['phone']);var _0x337b18=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?ut[_0x6e70('0x11e')](_0xa08f5[_0x6e70('0x4e')]['callerid'],_0xa08f5[_0x6e70('0x11f')],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5[_0x6e70('0x122')],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]):ut['getCallerId'](_['isNil'](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x4f')]:_0xa08f5[_0x6e70('0x92')]['callerid'],_0xa08f5['dialOriginateCallerIdName'],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5['dialOriginateCallerIdNumber'],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]);if(_0x337b18){_0x24ebf4[_0x6e70('0x123')]=ut['extractCalleridName'](_0x337b18);_0x24ebf4[_0x6e70('0x124')]=ut[_0x6e70('0x125')](_0x337b18);}var _0x4b28d2=ut[_0x6e70('0x126')](_0xa08f5,_0x28bc96,_0x323887,_0x337b18,_0x11b784,_0x24ebf4);_['merge'](_0x24ebf4,ut[_0x6e70('0x127')](_0x4b28d2));_0x24ebf4[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6e70('0x6e')](ut[_0x6e70('0x129')](_0x24ebf4,_0xa08f5,_0x4b28d2,_0x24ebf4[_0x6e70('0xbd')],_0x2eb49f))[_0x6e70('0x7a')](function(_0x1da95e){_0xa08f5['originated']+=0x1;logger[_0x6e70('0x55')]('[originated][increment]',_0x11b784,_0x6e70('0xa7'),_0xa08f5[_0x6e70('0x51')],_0x6e70('0xe1'),_0xa08f5[_0x6e70('0x58')]);_0x4e0788(_0x1da95e);})[_0x6e70('0x70')](function(_0x26a56c){ut[_0x6e70('0xe7')](_0x24ebf4,0xe,_0x6e70('0x12a'));rpcDb['createAgentHistory'](_0x24ebf4,_0x6e70('0x12b'));_0x53f283(_0x26a56c);});});};Preview['prototype'][_0x6e70('0x12c')]=function(_0x35e889){if(this[_0x6e70('0x19')][_0x35e889[_0x6e70('0xa3')]]){this['actions'][_0x35e889[_0x6e70('0xa3')]]['channel']=_0x35e889['channel'];}};Preview[_0x6e70('0x12')]['syncOriginateResponse']=function(_0x114df8){var _0x19cc83=this;var _0x14bdfb=this['actions'][_0x114df8['actionid']];if(_0x14bdfb){if(_0x14bdfb[_0x6e70('0xf3')]&&this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]){ut[_0x6e70('0x12d')](_0x14bdfb,this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]['name'],this[_0x6e70('0x1a')][_0x14bdfb['lookAgent']]['id']);}var _0x5771e5=_['clone'](_0x14bdfb);_0x5771e5[_0x6e70('0x12e')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e479d=_0x19cc83['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]];if(ut[_0x6e70('0x12f')](_0x114df8[_0x6e70('0x130')])){if(_0x14bdfb[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x14bdfb[_0x6e70('0x131')]);}if(_0x14bdfb[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x14bdfb[_0x6e70('0x131')]);}ami[_0x6e70('0x22')](_0x6e70('0x132'),ut[_0x6e70('0x97')](_0x14bdfb,'rejected',this['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]]));this[_0x6e70('0xe3')](_0x5771e5,_0x1e479d,_0x114df8);}else{_0x14bdfb[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x5771e5,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0xeb')](_0x5771e5,_0x6e70('0x133'));}}};Preview[_0x6e70('0x12')]['syncHangup']=function(_0x25b5ce){var _0x4a7ce3=this;var _0x44799d=this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]];var _0x4605e5;if(_0x44799d){_0x4605e5=this[_0x6e70('0x16')][_0x44799d['queue']];logger[_0x6e70('0x55')](_0x6e70('0x134'),_0x25b5ce[_0x6e70('0xa3')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);}if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]&&_0x25b5ce[_0x6e70('0xa3')]!==_0x25b5ce[_0x6e70('0xa6')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){this[_0x6e70('0x136')](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],'pTalking:\x20',_0x4605e5['pTalking']);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}}else if(_0x44799d&&_[_0x6e70('0x65')](_0x44799d[_0x6e70('0x138')])&&_0x4605e5[_0x6e70('0x139')]&&_0x25b5ce[_0x6e70('0xa3')]===_0x25b5ce[_0x6e70('0xa6')]&&_[_0x6e70('0x65')](_0x25b5ce['reason'])&&_0x25b5ce[_0x6e70('0x135')]==='16'&&_0x25b5ce[_0x6e70('0x13a')]==='6'&&_['isUndefined'](_0x44799d['transfer'])){if(_0x44799d[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x44799d[_0x6e70('0x131')]);}if(_0x44799d[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x44799d['idContact']);}_0x25b5ce['reason']='22';this[_0x6e70('0xe3')](_0x44799d,_0x4605e5,_0x25b5ce);}else if(_0x44799d&&_0x44799d[_0x6e70('0x13b')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this['actions'][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')]('[syncHangup][talking][transfer]',_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')],_0x6e70('0xa7'),_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]['dialAnswer']){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce['cause'],_0x6e70('0xa7'),_0x4605e5['name'],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}}};Preview['prototype'][_0x6e70('0x1d')]=function(_0x2e8a43){if(this[_0x6e70('0x19')][_0x2e8a43[_0x6e70('0xe2')]]&&_0x2e8a43[_0x6e70('0xe2')]!==_0x2e8a43[_0x6e70('0x13c')]){this[_0x6e70('0x136')](_0x2e8a43,_0x2e8a43[_0x6e70('0xe2')],_0x2e8a43[_0x6e70('0x13d')]);}};Preview[_0x6e70('0x12')]['syncHangupRequest']=function(_0x52ce1a){if(this[_0x6e70('0x19')][_0x52ce1a['linkedid']]&&_0x52ce1a[_0x6e70('0xa3')]!==_0x52ce1a[_0x6e70('0xa6')]&&!this[_0x6e70('0x19')][_0x52ce1a[_0x6e70('0xa3')]][_0x6e70('0x69')]){if(_0x52ce1a[_0x6e70('0x135')]==='1'){this[_0x6e70('0x136')](_0x52ce1a,_0x52ce1a[_0x6e70('0xa3')],_0x52ce1a[_0x6e70('0x135')]);}}};Preview['prototype']['addVariable']=function(_0x4f8e39,_0x2bab68,_0x5f208c){if(this[_0x6e70('0x19')][_0x4f8e39]){if(_[_0x6e70('0x65')](this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')])){this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')]={};}this['actions'][_0x4f8e39][_0x6e70('0x13e')][_0x2bab68]=_0x5f208c;}};Preview[_0x6e70('0x12')][_0x6e70('0x1e')]=function(_0x2bafad){try{if(!_[_0x6e70('0x65')](_0x2bafad)){if(ut[_0x6e70('0x13f')](_[_0x6e70('0x140')](_0x2bafad['variable'])[0x0])){this[_0x6e70('0x141')](_0x2bafad[_0x6e70('0xa6')],_['keys'](_0x2bafad[_0x6e70('0x142')])[0x0],_0x2bafad[_0x6e70('0x143')]);}}}catch(_0x5734d6){logger['error'](_0x6e70('0x144'),util[_0x6e70('0x145')](_0x5734d6,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x6e70('0x146')]=function(_0x1bc156){if(_0x1bc156){if(this[_0x6e70('0x19')][_0x1bc156[_0x6e70('0x147')]]){this[_0x6e70('0x19')][_0x1bc156['transfertargetlinkedid']][_0x6e70('0x13b')]=!![];}}};Preview[_0x6e70('0x12')]['syncBlindTransfer']=function(_0x2e7e4a){if(_0x2e7e4a){if(this['actions'][_0x2e7e4a['transfererlinkedid']]){this['actions'][_0x2e7e4a[_0x6e70('0x148')]][_0x6e70('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7c2369e..ecd716b 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 _0xf69d=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xf69d,0xd3));var _0xdf69=function(_0x5a5756,_0x520698){_0x5a5756=_0x5a5756-0x0;var _0x3c161a=_0xf69d[_0x5a5756];return _0x3c161a;};'use strict';var util=require(_0xdf69('0x0'));var BPromise=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var _=require(_0xdf69('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xdf69('0x5'));var cmHopperHistory=require(_0xdf69('0x6'));var cmHopperBlack=require(_0xdf69('0x7'));var voiceQueueRt=require(_0xdf69('0x8'));var agentReportPreview=require(_0xdf69('0x9'));var voiceQueueReport=require(_0xdf69('0xa'));function loggerCatch(_0x2d456f){return function(_0x465b1b){logger[_0xdf69('0xb')](_0x2d456f,util[_0xdf69('0xc')](_0x465b1b,{'showHidden':![],'depth':null}));};}function create(_0x18a08e){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopperHistory[_0xdf69('0xf')](_0x18a08e))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x11')));}function createAgent(_0x1e0e8d){return BPromise['resolve']()[_0xdf69('0xe')](agentReportPreview[_0xdf69('0xf')](_0x1e0e8d))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x11')));}function moveContact(_0x43ce3d){return BPromise[_0xdf69('0xd')]()['then'](cmHopper['moveContactManagedDialer'](_0x43ce3d,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xdf69('0x12')]=function(_0xbacdc6){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopperBlack[_0xdf69('0x12')](_0xbacdc6))[_0xdf69('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xdf69('0x13')]=function(_0x42d448){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopper['getContactPreview'](_0x42d448))[_0xdf69('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xdf69('0xf')]=function(_0x1899a2,_0x5263a4){create(_0x1899a2)[_0xdf69('0x10')](loggerCatch(_0x5263a4));moveContact(_0x1899a2)[_0xdf69('0x10')](loggerCatch(_0x5263a4));};exports[_0xdf69('0x14')]=function(_0x85d1d,_0x59bfd2){createAgent(_0x85d1d)['catch'](loggerCatch(_0x59bfd2));};exports[_0xdf69('0x15')]=function(_0x15e73a,_0x54df73){create(_0x15e73a)[_0xdf69('0x10')](loggerCatch(_0x54df73));};exports[_0xdf69('0x16')]=function(_0x68fa80,_0x526cbc){moveContact(_0x68fa80)[_0xdf69('0x10')](loggerCatch(_0x526cbc));};exports[_0xdf69('0x17')]=function(_0x4d09d5,_0x56647c,_0x32505a){if(_0x56647c){_0x4d09d5[_0xdf69('0x18')]=null;}if(_0x32505a){_0x4d09d5[_0xdf69('0x19')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x4d09d5))[_0xdf69('0x10')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xdf69('0x1a')]=function(_0x311534){return BPromise[_0xdf69('0xd')]()['then'](cmHopper['countReScheduled'](_0x311534))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x1b')));};exports[_0xdf69('0x1c')]=function(_0x3fd933){return BPromise['resolve']()[_0xdf69('0xe')](cmHopper[_0xdf69('0x1c')]({'UserId':null},_0x3fd933,0x1))[_0xdf69('0x10')](loggerCatch('[unlockContact]\x20'));};exports[_0xdf69('0x1d')]=function(_0x5cfba9){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x5cfba9,0x1))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x1e')));};exports['crateCustomerReportQueue']=function(_0x301bd2){var _0xd81d0a={};_0xd81d0a[_0xdf69('0x1f')]=_0x301bd2[_0xdf69('0x1f')];_0xd81d0a[_0xdf69('0x20')]=_0x301bd2[_0xdf69('0x20')];_0xd81d0a[_0xdf69('0x21')]=_0x301bd2[_0xdf69('0x21')];_0xd81d0a[_0xdf69('0x22')]=_0x301bd2[_0xdf69('0x22')];_0xd81d0a[_0xdf69('0x23')]=_0x301bd2[_0xdf69('0x23')];_0xd81d0a[_0xdf69('0x24')]=_0x301bd2[_0xdf69('0x25')];_0xd81d0a[_0xdf69('0x26')]=_0x301bd2[_0xdf69('0x25')];_0xd81d0a[_0xdf69('0x27')]=0x1;_0xd81d0a['queuecallercompleteAt']=_0x301bd2[_0xdf69('0x28')];_0xd81d0a[_0xdf69('0x29')]=_0x301bd2[_0xdf69('0x2a')];_0xd81d0a[_0xdf69('0x2b')]=_0xdf69('0x2c');_0xd81d0a['exten']=_0xdf69('0x2d');_0xd81d0a['holdtime']=0x0;_0xd81d0a[_0xdf69('0x2e')]=0x1;_0xd81d0a[_0xdf69('0x2f')]=_0x301bd2['membername'];_0xd81d0a[_0xdf69('0x30')]='COMPLETED';return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](voiceQueueReport[_0xdf69('0x31')](_0xd81d0a))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x32')));};exports['getContactRecallMe']=function(_0x175d5a,_0x50250a){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopper[_0xdf69('0x33')](_0x175d5a,_0x50250a))[_0xdf69('0x10')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xdf69('0x34')]=function(_0x51f996){return BPromise[_0xdf69('0xd')]()['then'](cmHopper[_0xdf69('0x17')](_0x51f996,!![],!![]))['catch'](loggerCatch(_0xdf69('0x35')));}; \ No newline at end of file +var _0x9c5a=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten'];(function(_0x1422fd,_0x238c93){var _0x255c69=function(_0x473e58){while(--_0x473e58){_0x1422fd['push'](_0x1422fd['shift']());}};_0x255c69(++_0x238c93);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4ec76d,_0x274480){_0x4ec76d=_0x4ec76d-0x0;var _0xce7d64=_0x9c5a[_0x4ec76d];return _0xce7d64;};'use strict';var util=require(_0xa9c5('0x0'));var BPromise=require(_0xa9c5('0x1'));var logger=require('../../../config/logger')(_0xa9c5('0x2'));var _=require(_0xa9c5('0x3'));var cmHopper=require(_0xa9c5('0x4'));var cmHopperFinal=require(_0xa9c5('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa9c5('0x6'));var voiceQueueRt=require(_0xa9c5('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xa9c5('0x8'));function loggerCatch(_0x4d9c7a){return function(_0x394d84){logger[_0xa9c5('0x9')](_0x4d9c7a,util['inspect'](_0x394d84,{'showHidden':![],'depth':null}));};}function create(_0x4b6db6){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopperHistory['createHistory'](_0x4b6db6))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0xd')));}function createAgent(_0x51c14c){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](agentReportPreview['createHistory'](_0x51c14c))['catch'](loggerCatch(_0xa9c5('0xd')));}function moveContact(_0x11421c){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0xe')](_0x11421c,!![]))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0xf')));}exports[_0xa9c5('0x10')]=function(_0x3c5ac7){return BPromise[_0xa9c5('0xa')]()['then'](cmHopperBlack[_0xa9c5('0x10')](_0x3c5ac7))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x11')));};exports[_0xa9c5('0x12')]=function(_0x418ca5){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x12')](_0x418ca5))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x13')));};exports['createHistory']=function(_0x2b0d73,_0xd85c32){create(_0x2b0d73)[_0xa9c5('0xc')](loggerCatch(_0xd85c32));moveContact(_0x2b0d73)['catch'](loggerCatch(_0xd85c32));};exports[_0xa9c5('0x14')]=function(_0x1142d9,_0x2b9ac5){createAgent(_0x1142d9)[_0xa9c5('0xc')](loggerCatch(_0x2b9ac5));};exports[_0xa9c5('0x15')]=function(_0x349f27,_0x3b8d4d){create(_0x349f27)[_0xa9c5('0xc')](loggerCatch(_0x3b8d4d));};exports[_0xa9c5('0x16')]=function(_0x36c486,_0x113c8f){moveContact(_0x36c486)[_0xa9c5('0xc')](loggerCatch(_0x113c8f));};exports['rescheduleContact']=function(_0x1115ad,_0x21ab50,_0x541c77){if(_0x21ab50){_0x1115ad['UserId']=null;}if(_0x541c77){_0x1115ad[_0xa9c5('0x17')]=![];}return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x18')](_0x1115ad))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x19')));};exports['countReScheduled']=function(_0x4fa280){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper['countReScheduled'](_0x4fa280))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x1a')));};exports[_0xa9c5('0x1b')]=function(_0x32fc7d){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x1b')]({'UserId':null},_0x32fc7d,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0xa9c5('0x1c')]=function(_0x4cd5e6){return BPromise[_0xa9c5('0xa')]()[_0xa9c5('0xb')](cmHopper['unlockContact']({'active':![]},_0x4cd5e6,0x1))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x1d')));};exports['crateCustomerReportQueue']=function(_0x413edf){var _0x32baf9={};_0x32baf9[_0xa9c5('0x1e')]=_0x413edf[_0xa9c5('0x1e')];_0x32baf9[_0xa9c5('0x1f')]=_0x413edf['uniqueid'];_0x32baf9[_0xa9c5('0x20')]=_0x413edf['calleridnum'];_0x32baf9[_0xa9c5('0x21')]=_0x413edf[_0xa9c5('0x21')];_0x32baf9[_0xa9c5('0x22')]=_0x413edf['queue'];_0x32baf9[_0xa9c5('0x23')]=_0x413edf[_0xa9c5('0x24')];_0x32baf9['queuecallerleaveAt']=_0x413edf[_0xa9c5('0x24')];_0x32baf9[_0xa9c5('0x25')]=0x1;_0x32baf9[_0xa9c5('0x26')]=_0x413edf[_0xa9c5('0x27')];_0x32baf9[_0xa9c5('0x28')]=_0x413edf[_0xa9c5('0x29')];_0x32baf9[_0xa9c5('0x2a')]='from-sip';_0x32baf9[_0xa9c5('0x2b')]=_0xa9c5('0x2c');_0x32baf9[_0xa9c5('0x2d')]=0x0;_0x32baf9[_0xa9c5('0x2e')]=0x1;_0x32baf9[_0xa9c5('0x2f')]=_0x413edf[_0xa9c5('0x29')];_0x32baf9[_0xa9c5('0x30')]=_0xa9c5('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0xa9c5('0x32')](_0x32baf9))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x33')));};exports[_0xa9c5('0x34')]=function(_0x296116,_0x25121e){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x296116,_0x25121e))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x35')));};exports['rescheduleContactInQueue']=function(_0x13a1f5){return BPromise['resolve']()[_0xa9c5('0xb')](cmHopper[_0xa9c5('0x18')](_0x13a1f5,!![],!![]))[_0xa9c5('0xc')](loggerCatch(_0xa9c5('0x36')));}; \ 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 057af5d..b7580f1 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 _0x43b4=['XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','milliseconds','createBody','CampaignId','idContact','type','dialAnswer','membername','countcongestionretry','countglobal','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','updatedAt','%s%s'];(function(_0x86d985,_0x1e738d){var _0xdbac2f=function(_0x3dd4de){while(--_0x3dd4de){_0x86d985['push'](_0x86d985['shift']());}};_0xdbac2f(++_0x1e738d);}(_0x43b4,0xe1));var _0x443b=function(_0x55dcdb,_0x2f4f85){_0x55dcdb=_0x55dcdb-0x0;var _0x3be5e5=_0x43b4[_0x55dcdb];return _0x3be5e5;};'use strict';var util=require(_0x443b('0x0'));var _=require(_0x443b('0x1'));var moment=require(_0x443b('0x2'));var logger=require(_0x443b('0x3'))(_0x443b('0x4'));var ipAgi=process[_0x443b('0x5')][_0x443b('0x6')]||_0x443b('0x7');function getSeconds(_0x394e4d,_0x4a1eaf){var _0x28b36c=moment(_0x394e4d)['milliseconds'](0x0);var _0x545664=moment(_0x4a1eaf)['milliseconds'](0x0);return _0x28b36c[_0x443b('0x8')](_0x545664,'seconds');}exports['loggerCatch']=function(_0x4c0c4e){return function(_0x5db1da){logger[_0x443b('0x9')](_0x4c0c4e,util[_0x443b('0xa')](_0x5db1da,{'showHidden':![],'depth':null}));};};exports[_0x443b('0xb')]=function(_0x4a2f1b,_0x566467){logger[_0x443b('0xc')](_0x4a2f1b,util[_0x443b('0xa')](_0x566467,{'showHidden':![],'depth':null}));};exports[_0x443b('0xd')]=function(_0x375740,_0x528bb8){logger['error'](_0x375740,util[_0x443b('0xa')](_0x528bb8,{'showHidden':![],'depth':null}));};exports[_0x443b('0xe')]=function(_0x39a603){return function(_0x3fc3f0){logger[_0x443b('0xc')](_0x39a603,util['inspect'](_0x3fc3f0,{'showHidden':![],'depth':null}));};};exports[_0x443b('0xf')]=function(_0x31c97,_0x58d985,_0x167956){return{'message':_0x31c97,'unlock':_0x58d985,'active':_0x167956};};exports[_0x443b('0x10')]=function(_0x45b3ae,_0x1567f6,_0x31ee1c){if(!_[_0x443b('0x11')](_0x31ee1c)&&_0x443b('0x12')===typeof _0x31ee1c&&!_[_0x443b('0x13')](_0x31ee1c)){if(!_['isUndefined'](_0x1567f6)&&_0x443b('0x12')===typeof _0x1567f6&&!_['isEmpty'](_0x1567f6)){return util['format']('\x22%s\x22\x20<%s>',_0x1567f6,_0x31ee1c);}return util[_0x443b('0x14')](_0x443b('0x15'),_0x31ee1c,_0x31ee1c);}if(!_[_0x443b('0x11')](_0x45b3ae)&&_0x443b('0x12')===typeof _0x45b3ae&&!_['isEmpty'](_0x45b3ae)){return _0x45b3ae;}return _0x443b('0x16');};exports['isActive']=function(_0x4ff69a){if(_['isNil'](_0x4ff69a)){return![];}return _0x4ff69a;};exports[_0x443b('0x17')]=function(_0x548281,_0xcf2b9a,_0x752ac4,_0x4f263a,_0x1db050,_0x57de1d){var _0x2eadd1={'XMD-QUEUE':_0xcf2b9a[_0x443b('0x18')]?_0xcf2b9a['Queue']['name']:'','XMD-CALLERID':_0x4f263a,'XMD-CALLERID-PREVIEW':_0x57de1d?util[_0x443b('0x14')](_0x443b('0x15'),_0x57de1d[_0x443b('0x19')],_0x57de1d[_0x443b('0x1a')]):_0x4f263a,'XMD-DIALID':_0x1db050,'XMD-CONTACTID':_0xcf2b9a[_0x443b('0x1b')],'XMD-CDRTYPE':_0x443b('0x1c'),'CALLERID(all)':_0x4f263a,'XMD-VOICEQUEUEID':_0xcf2b9a[_0x443b('0x1d')],'XMD-DIALCHANNEL':_0x752ac4,'XMD-DIALTIMEOUT':_0x548281[_0x443b('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x443b('0x14')](_0x443b('0x1f'),_0x548281[_0x443b('0x20')]?'g':'',_[_0x443b('0x13')](_0x548281['monitor_format'])?'':_0x443b('0x21')),'XMD-DIALURL':_0x548281[_0x443b('0x22')]||'','XMD-AGI':_0x548281[_0x443b('0x23')]?util['format'](_0x443b('0x24'),ipAgi,_0x548281['dialQueueProject']):_0x443b('0x25'),'XMD-AGIAFTER':_0x548281[_0x443b('0x20')]?util[_0x443b('0x14')](_0x443b('0x24'),ipAgi,_0x548281[_0x443b('0x20')]):_0x443b('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x57de1d?_0x57de1d[_0x443b('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x57de1d?_0x57de1d['originatecalleridname']:'','XMD-DESTINATION':_0x443b('0x27')};if(!_[_0x443b('0x13')](_0x548281[_0x443b('0x28')])){_0x2eadd1[util[_0x443b('0x14')]('%s',_0x443b('0x29'))]=_0x548281[_0x443b('0x28')];_0x2eadd1[util[_0x443b('0x14')]('%s',_0x443b('0x2a'))]=_0x1db050;}if(_0xcf2b9a&&_0xcf2b9a['Contact']){for(var _0x476f1e in _0xcf2b9a['Contact']){if(_0xcf2b9a[_0x443b('0x2b')][_0x443b('0x2c')](_0x476f1e)){if(!_[_0x443b('0x2d')](_0xcf2b9a[_0x443b('0x2b')][_0x476f1e])&&_0x476f1e!=='id'&&_0x476f1e!=='tags'&&_0x476f1e!==_0x443b('0x2e')&&_0x476f1e!==_0x443b('0x2f')){_0x2eadd1[util[_0x443b('0x14')](_0x443b('0x30'),_0x443b('0x31'),_[_0x443b('0x32')](_0x476f1e))]=_0xcf2b9a[_0x443b('0x2b')][_0x476f1e];}}}}return _0x2eadd1;};exports['toLowerVariables']=function(_0x340825){var _0x569273={};for(var _0x94fbca in _0x340825){if(_0x340825[_0x443b('0x2c')](_0x94fbca)){_0x569273[util[_0x443b('0x14')]('%s',_['toLower'](_0x94fbca))]=_0x340825[_0x94fbca];}}return{'variables':_0x569273};};exports[_0x443b('0x33')]=function(_0x3d524c,_0x5b2458){if(!_[_0x443b('0x2d')](_0x3d524c)){if(_0x3d524c[_0x443b('0x2c')](_0x443b('0x34'))){if(_0x3d524c[_0x443b('0x34')]>0x0){_0x3d524c[_0x443b('0x34')]-=0x1;}else{logger[_0x443b('0x9')](_0x443b('0x35'),_0x5b2458);}}}else{logger[_0x443b('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5b2458);}};exports['logBlacklist']=function(_0x5c178e){var _0x5a0a32=moment()[_0x443b('0x14')](_0x443b('0x36'));_0x5c178e[_0x443b('0x37')]=0xd;_0x5c178e[_0x443b('0x38')]=_0x443b('0x39');_0x5c178e[_0x443b('0x3a')]=_0x5a0a32;_0x5c178e[_0x443b('0x3b')]=_0x5a0a32;_0x5c178e[_0x443b('0x3c')]=_0x5a0a32;};exports[_0x443b('0x3d')]=function(_0x1b0d98,_0x30a349,_0x419489){var _0x3e2aba=moment()[_0x443b('0x14')](_0x443b('0x36'));_0x1b0d98[_0x443b('0x37')]=_0x30a349;_0x1b0d98['statedesc']=_0x419489;_0x1b0d98[_0x443b('0x3b')]=_0x3e2aba;_0x1b0d98[_0x443b('0x3e')]=getSeconds(_0x1b0d98['responsetime'],_0x1b0d98[_0x443b('0x3a')]);};exports[_0x443b('0x3f')]=function(_0x1f08df,_0x5a694f,_0x480134){_0x1f08df['membername']=_0x5a694f;_0x1f08df[_0x443b('0x40')]=_0x480134;};exports[_0x443b('0x41')]=function(_0x29f7a6,_0x6a71bf,_0x3c03dc){var _0xda389d=moment()[_0x443b('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x29f7a6[_0x443b('0x37')]=_0x6a71bf;_0x29f7a6[_0x443b('0x38')]=_0x3c03dc;_0x29f7a6[_0x443b('0x3b')]=_0x29f7a6['responsetime']?_0x29f7a6[_0x443b('0x3b')]:_0xda389d;_0x29f7a6['endtime']=_0x29f7a6[_0x443b('0x3c')]?_0x29f7a6['endtime']:_0xda389d;_0x29f7a6[_0x443b('0x3e')]=getSeconds(_0x29f7a6[_0x443b('0x3b')]||0x0,_0x29f7a6[_0x443b('0x3a')]||0x0);_0x29f7a6[_0x443b('0x42')]=_0x29f7a6[_0x443b('0x43')]?getSeconds(_0x29f7a6[_0x443b('0x3c')],_0x29f7a6[_0x443b('0x43')]):0x0;};exports['isFailure']=function(_0x27fa83){return _0x27fa83===_0x443b('0x44');};exports[_0x443b('0x45')]=function(_0x1c8741,_0x6c72f9,_0x56ca59,_0x26f2a0,_0x500b92){var _0x162fec=_0x26f2a0?_0x443b('0x46'):_0x1c8741[_0x443b('0x19')];_0x162fec=_0x500b92?_0x443b('0x47'):_0x162fec;return{'actionid':_0x1c8741[_0x443b('0x48')],'action':_0x443b('0x49'),'channel':_0x1c8741[_0x443b('0x4a')],'callerid':util[_0x443b('0x14')](_0x443b('0x15'),_0x162fec,_0x1c8741[_0x443b('0x1a')]),'Exten':_0x443b('0x27'),'Context':'from-sip','Priority':'1','variable':_0x56ca59,'timeout':(_0x6c72f9[_0x443b('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1c8741[_0x443b('0x48')]};};exports[_0x443b('0x4c')]=function(_0x3677e2){return _0x3677e2[_0x443b('0x4d')]+_0x3677e2['countcongestionretry']+_0x3677e2[_0x443b('0x4e')]+_0x3677e2[_0x443b('0x4f')]+_0x3677e2[_0x443b('0x50')];};exports['cloneAction']=function(_0x4dc8eb){var _0xa16617=_[_0x443b('0x51')](_0x4dc8eb);_0xa16617['state']=0xf;_0xa16617[_0x443b('0x38')]=_0x443b('0x52');return _0xa16617;};exports['scheduledAt']=function(_0x5b6fc5,_0x371942,_0x406754){var _0x4df802={};_0x4df802[_0x371942]=_0x5b6fc5[_0x371942];_0x4df802[_0x443b('0x53')]=![];_0x4df802[_0x443b('0x54')]=moment()['add'](_0x406754,_0x443b('0x55'))[_0x443b('0x14')](_0x443b('0x36'));_0x4df802[_0x443b('0x1b')]=_0x5b6fc5['ContactId'];_0x4df802[_0x443b('0x56')]=_0x5b6fc5[_0x443b('0x56')];_0x4df802['VoiceQueueId']=_0x5b6fc5[_0x443b('0x1d')]||undefined;return _0x4df802;};exports[_0x443b('0x57')]=function(_0x375538,_0x247db7){if(!_[_0x443b('0x2d')](_0x375538)){if(_0x375538[_0x443b('0x58')]>0x0){_0x375538[_0x443b('0x58')]-=0x1;}else{logger[_0x443b('0x9')](_0x247db7,_0x443b('0x59'));}}else{logger['error'](_0x247db7,_0x443b('0x5a'));}};exports[_0x443b('0x5b')]=function(_0x4570a8){if(_0x4570a8<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2df002,_0x5a28d1,_0x12eab6){_0x2df002[_0x443b('0x5c')]=_0x5a28d1;_0x2df002['name']=_0x2df002[_0x443b('0x5d')];_0x2df002['interface']=_0x2df002[_0x443b('0x4a')];if(_0x12eab6){_0x2df002[_0x443b('0x5e')]=_0x12eab6[_0x443b('0x5e')];}return _0x2df002;};exports[_0x443b('0x5f')]=function(_0xa5cc0f){var _0x4129b3={};_0x4129b3['queue']=_0xa5cc0f[_0x443b('0x5d')];_0x4129b3['interface']=_0xa5cc0f[_0x443b('0x4a')];_0x4129b3['uniqueid']=_0xa5cc0f[_0x443b('0x48')];return _0x4129b3;};exports[_0x443b('0x60')]=function(_0x44ca87){var _0x41eeee=[];for(var _0x585eeb in _0x44ca87){if(_0x44ca87[_0x443b('0x2c')](_0x585eeb)){if(!_[_0x443b('0x2d')](_0x44ca87[_0x585eeb])&&_0x44ca87[_0x585eeb][_0x443b('0x37')]===_0x443b('0x61')&&_0x44ca87[_0x585eeb][_0x443b('0x62')]==='reachable'){_0x41eeee[_0x443b('0x63')](_0x44ca87[_0x585eeb]['id']);}}}return _0x41eeee;};exports['getDiff']=function(_0x367116){var _0x4f9812=moment()['milliseconds'](0x0);var _0x12221e=moment(_0x367116)[_0x443b('0x64')](0x0);return _0x4f9812[_0x443b('0x8')](_0x12221e,'seconds');};exports[_0x443b('0x65')]=function(_0x412843){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x412843[_0x443b('0x1b')],'ListId':_0x412843['ListId'],'VoiceQueueId':_0x412843['VoiceQueueId']||undefined,'CampaignId':_0x412843[_0x443b('0x66')]||undefined};};exports['filterKey']=function(_0x4fc85c){if(_0x4fc85c===_0x443b('0x48')||_0x4fc85c===_0x443b('0x67')||_0x4fc85c===_0x443b('0x5d')||_0x4fc85c===_0x443b('0x68')||_0x4fc85c==='campaigntype'||_0x4fc85c===_0x443b('0x69')||_0x4fc85c===_0x443b('0x6a')||_0x4fc85c==='channelAgent'||_0x4fc85c===_0x443b('0x19')||_0x4fc85c===_0x443b('0x53')||_0x4fc85c===_0x443b('0x1a')||_0x4fc85c===_0x443b('0x54')||_0x4fc85c===_0x443b('0x4d')||_0x4fc85c===_0x443b('0x6b')||_0x4fc85c===_0x443b('0x4e')||_0x4fc85c===_0x443b('0x6c')||_0x4fc85c==='callback'||_0x4fc85c==='callbackuniqueid'||_0x4fc85c===_0x443b('0x6d')||_0x4fc85c===_0x443b('0x6e')||_0x4fc85c===_0x443b('0x1b')||_0x4fc85c==='ListId'||_0x4fc85c==='UserId'||_0x4fc85c===_0x443b('0x1d')||_0x4fc85c===_0x443b('0x6f')||_0x4fc85c==='xmd-voicequeueid'||_0x4fc85c===_0x443b('0x70')||_0x4fc85c===_0x443b('0x71')||_0x4fc85c===_0x443b('0x72')||_0x4fc85c===_0x443b('0x73')||_0x4fc85c===_0x443b('0x74')||_0x4fc85c===_0x443b('0x75')||_0x4fc85c===_0x443b('0x76')||_0x4fc85c==='xmd-dialchannel'||_0x4fc85c===_0x443b('0x77')||_0x4fc85c==='xmd-cdrtype'||_0x4fc85c===_0x443b('0x78')||_0x4fc85c==='xmd-agiafter'||_0x4fc85c==='xmd-agi'||_0x4fc85c===_0x443b('0x79')||_0x4fc85c===_0x443b('0x7a')||_0x4fc85c==='rtpaudioqosjitter'||_0x4fc85c===_0x443b('0x7b')||_0x4fc85c===_0x443b('0x7c')||_0x4fc85c===_0x443b('0x7d')||_0x4fc85c==='rtpaudioqosrtt'||_0x4fc85c===_0x443b('0x7e')||_0x4fc85c===_0x443b('0x79')||_0x4fc85c===_0x443b('0x7a')||_0x4fc85c===_0x443b('0x7f')||_0x4fc85c===_0x443b('0x7b')||_0x4fc85c==='rtpaudioqosloss'||_0x4fc85c==='rtpaudioqoslossbridged'||_0x4fc85c===_0x443b('0x80')||_0x4fc85c===_0x443b('0x7e')||_0x4fc85c===_0x443b('0x81')||_0x4fc85c===_0x443b('0x82')||_0x4fc85c===_0x443b('0x37')||_0x4fc85c==='statedesc'){return![];}return!![];};exports[_0x443b('0x83')]=function(_0x1ede2f,_0x8d66e4){var _0xac2368,_0xba858d,_0x293b08;if(_0x8d66e4<=0x0){_0x8d66e4=0x1;}_0xac2368=new RegExp(_0x443b('0x84')+_0x8d66e4+'}$');_0xba858d=Math[_0x443b('0x85')](0xa,_0x8d66e4-0x1);_0x293b08=Math[_0x443b('0x85')](0xa,_0x8d66e4)-0x1;return util['format']('%s',_['replace'](_0x1ede2f,_0xac2368,_[_0x443b('0x86')](_0xba858d,_0x293b08)));};exports[_0x443b('0x87')]=function(_0x469761){var _0x89da91=_0x469761[_0x443b('0x88')](/"(.*?)"/);return _0x89da91?_0x89da91[0x1]:_0x469761;};exports['extractCalleridNumber']=function(_0x270985){var _0x28e316=_0x270985[_0x443b('0x88')](/<(.*?)>/);return _0x28e316?_0x28e316[0x1]:_0x270985;}; \ No newline at end of file +var _0x5f97=['Queue','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','endtime','logAgent','statedesc','responsetime','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','active','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','name','queue','mandatoryDisposition','interface','channelAgent','agentReadyId','not_inuse','status','reachable','push','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil'];(function(_0x3e6acc,_0x38bccc){var _0x115e08=function(_0x2e8661){while(--_0x2e8661){_0x3e6acc['push'](_0x3e6acc['shift']());}};_0x115e08(++_0x38bccc);}(_0x5f97,0x192));var _0x75f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f97[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x75f9('0x0'));var _=require(_0x75f9('0x1'));var moment=require(_0x75f9('0x2'));var logger=require(_0x75f9('0x3'))(_0x75f9('0x4'));var ipAgi=process[_0x75f9('0x5')][_0x75f9('0x6')]||_0x75f9('0x7');function getSeconds(_0x1fd101,_0x1d36df){var _0x318eb3=moment(_0x1fd101)['milliseconds'](0x0);var _0x72e216=moment(_0x1d36df)[_0x75f9('0x8')](0x0);return _0x318eb3['diff'](_0x72e216,_0x75f9('0x9'));}exports[_0x75f9('0xa')]=function(_0x4ccf46){return function(_0x32deb0){logger[_0x75f9('0xb')](_0x4ccf46,util[_0x75f9('0xc')](_0x32deb0,{'showHidden':![],'depth':null}));};};exports[_0x75f9('0xd')]=function(_0x43c67c,_0x170cd3){logger[_0x75f9('0xe')](_0x43c67c,util['inspect'](_0x170cd3,{'showHidden':![],'depth':null}));};exports[_0x75f9('0xf')]=function(_0x4f1e8f,_0x3b0474){logger[_0x75f9('0xb')](_0x4f1e8f,util[_0x75f9('0xc')](_0x3b0474,{'showHidden':![],'depth':null}));};exports[_0x75f9('0x10')]=function(_0x4710a9){return function(_0x505d12){logger[_0x75f9('0xe')](_0x4710a9,util[_0x75f9('0xc')](_0x505d12,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2d69d1,_0x434d6a,_0x180df0){return{'message':_0x2d69d1,'unlock':_0x434d6a,'active':_0x180df0};};exports[_0x75f9('0x11')]=function(_0x3ef52f,_0x46d179,_0x34ec83){if(!_['isUndefined'](_0x34ec83)&&_0x75f9('0x12')===typeof _0x34ec83&&!_['isEmpty'](_0x34ec83)){if(!_['isUndefined'](_0x46d179)&&_0x75f9('0x12')===typeof _0x46d179&&!_[_0x75f9('0x13')](_0x46d179)){return util[_0x75f9('0x14')](_0x75f9('0x15'),_0x46d179,_0x34ec83);}return util['format'](_0x75f9('0x15'),_0x34ec83,_0x34ec83);}if(!_['isUndefined'](_0x3ef52f)&&_0x75f9('0x12')===typeof _0x3ef52f&&!_[_0x75f9('0x13')](_0x3ef52f)){return _0x3ef52f;}return _0x75f9('0x16');};exports['isActive']=function(_0x470574){if(_[_0x75f9('0x17')](_0x470574)){return![];}return _0x470574;};exports['addVariables']=function(_0x27cbb1,_0x454fb0,_0x36101b,_0x16deb7,_0xe5e1,_0x30e5b9){var _0x2f61d3={'XMD-QUEUE':_0x454fb0[_0x75f9('0x18')]?_0x454fb0[_0x75f9('0x18')]['name']:'','XMD-CALLERID':_0x16deb7,'XMD-CALLERID-PREVIEW':_0x30e5b9?util['format'](_0x75f9('0x15'),_0x30e5b9['calleridname'],_0x30e5b9[_0x75f9('0x19')]):_0x16deb7,'XMD-DIALID':_0xe5e1,'XMD-CONTACTID':_0x454fb0['ContactId'],'XMD-CDRTYPE':_0x75f9('0x1a'),'CALLERID(all)':_0x16deb7,'XMD-VOICEQUEUEID':_0x454fb0[_0x75f9('0x1b')],'XMD-DIALCHANNEL':_0x36101b,'XMD-DIALTIMEOUT':_0x27cbb1['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x75f9('0x1c'),_0x27cbb1[_0x75f9('0x1d')]?'g':'',_['isEmpty'](_0x27cbb1[_0x75f9('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x27cbb1['dialPreviewUrl']||'','XMD-AGI':_0x27cbb1['dialQueueProject']?util['format'](_0x75f9('0x1f'),ipAgi,_0x27cbb1[_0x75f9('0x20')]):'NONE','XMD-AGIAFTER':_0x27cbb1['dialQueueProject2']?util[_0x75f9('0x14')](_0x75f9('0x1f'),ipAgi,_0x27cbb1[_0x75f9('0x1d')]):_0x75f9('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x30e5b9?_0x30e5b9[_0x75f9('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x30e5b9?_0x30e5b9[_0x75f9('0x23')]:'','XMD-DESTINATION':_0x75f9('0x24')};if(!_[_0x75f9('0x13')](_0x27cbb1[_0x75f9('0x1e')])){_0x2f61d3[util['format']('%s',_0x75f9('0x25'))]=_0x27cbb1[_0x75f9('0x1e')];_0x2f61d3[util[_0x75f9('0x14')]('%s',_0x75f9('0x26'))]=_0xe5e1;}if(_0x454fb0&&_0x454fb0[_0x75f9('0x27')]){for(var _0x1f2bde in _0x454fb0[_0x75f9('0x27')]){if(_0x454fb0['Contact'][_0x75f9('0x28')](_0x1f2bde)){if(!_[_0x75f9('0x17')](_0x454fb0[_0x75f9('0x27')][_0x1f2bde])&&_0x1f2bde!=='id'&&_0x1f2bde!==_0x75f9('0x29')&&_0x1f2bde!==_0x75f9('0x2a')&&_0x1f2bde!==_0x75f9('0x2b')){_0x2f61d3[util['format'](_0x75f9('0x2c'),_0x75f9('0x2d'),_[_0x75f9('0x2e')](_0x1f2bde))]=_0x454fb0[_0x75f9('0x27')][_0x1f2bde];}}}}return _0x2f61d3;};exports['toLowerVariables']=function(_0x1661d8){var _0x51d869={};for(var _0x159190 in _0x1661d8){if(_0x1661d8[_0x75f9('0x28')](_0x159190)){_0x51d869[util[_0x75f9('0x14')]('%s',_[_0x75f9('0x2f')](_0x159190))]=_0x1661d8[_0x159190];}}return{'variables':_0x51d869};};exports['updateOriginated']=function(_0x104fb8,_0x59e63b){if(!_['isNil'](_0x104fb8)){if(_0x104fb8[_0x75f9('0x28')](_0x75f9('0x30'))){if(_0x104fb8['originated']>0x0){_0x104fb8['originated']-=0x1;}else{logger[_0x75f9('0xb')](_0x75f9('0x31'),_0x59e63b);}}}else{logger[_0x75f9('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x59e63b);}};exports[_0x75f9('0x32')]=function(_0x35dca8){var _0x2427a7=moment()['format'](_0x75f9('0x33'));_0x35dca8[_0x75f9('0x34')]=0xd;_0x35dca8['statedesc']=_0x75f9('0x35');_0x35dca8[_0x75f9('0x36')]=_0x2427a7;_0x35dca8['responsetime']=_0x2427a7;_0x35dca8[_0x75f9('0x37')]=_0x2427a7;};exports[_0x75f9('0x38')]=function(_0x623a96,_0x129f1f,_0x44f459){var _0x121a08=moment()[_0x75f9('0x14')](_0x75f9('0x33'));_0x623a96[_0x75f9('0x34')]=_0x129f1f;_0x623a96[_0x75f9('0x39')]=_0x44f459;_0x623a96[_0x75f9('0x3a')]=_0x121a08;_0x623a96[_0x75f9('0x3b')]=getSeconds(_0x623a96['responsetime'],_0x623a96[_0x75f9('0x36')]);};exports[_0x75f9('0x3c')]=function(_0x5da9d9,_0x44b398,_0x4206c1){_0x5da9d9[_0x75f9('0x3d')]=_0x44b398;_0x5da9d9[_0x75f9('0x3e')]=_0x4206c1;};exports['logCustomer']=function(_0x4697bd,_0x144950,_0xb0203e){var _0x4d6992=moment()['format'](_0x75f9('0x33'));_0x4697bd[_0x75f9('0x34')]=_0x144950;_0x4697bd[_0x75f9('0x39')]=_0xb0203e;_0x4697bd[_0x75f9('0x3a')]=_0x4697bd['responsetime']?_0x4697bd['responsetime']:_0x4d6992;_0x4697bd[_0x75f9('0x37')]=_0x4697bd['endtime']?_0x4697bd[_0x75f9('0x37')]:_0x4d6992;_0x4697bd['ringtime']=getSeconds(_0x4697bd[_0x75f9('0x3a')]||0x0,_0x4697bd[_0x75f9('0x36')]||0x0);_0x4697bd[_0x75f9('0x3f')]=_0x4697bd[_0x75f9('0x40')]?getSeconds(_0x4697bd[_0x75f9('0x37')],_0x4697bd[_0x75f9('0x40')]):0x0;};exports[_0x75f9('0x41')]=function(_0x39665e){return _0x39665e===_0x75f9('0x42');};exports[_0x75f9('0x43')]=function(_0x35c6b8,_0x1f3189,_0x324d35,_0xa98c4b,_0x33960c){var _0x44a411=_0xa98c4b?'RECALL':_0x35c6b8[_0x75f9('0x44')];_0x44a411=_0x33960c?_0x75f9('0x45'):_0x44a411;return{'actionid':_0x35c6b8['uniqueid'],'action':_0x75f9('0x46'),'channel':_0x35c6b8['channelAgent'],'callerid':util[_0x75f9('0x14')](_0x75f9('0x15'),_0x44a411,_0x35c6b8['calleridnum']),'Exten':_0x75f9('0x24'),'Context':_0x75f9('0x47'),'Priority':'1','variable':_0x324d35,'timeout':(_0x1f3189[_0x75f9('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35c6b8[_0x75f9('0x49')]};};exports[_0x75f9('0x4a')]=function(_0x1382c9){return _0x1382c9[_0x75f9('0x4b')]+_0x1382c9[_0x75f9('0x4c')]+_0x1382c9[_0x75f9('0x4d')]+_0x1382c9[_0x75f9('0x4e')]+_0x1382c9[_0x75f9('0x4f')];};exports['cloneAction']=function(_0x112f80){var _0x41c7b0=_['clone'](_0x112f80);_0x41c7b0[_0x75f9('0x34')]=0xf;_0x41c7b0[_0x75f9('0x39')]=_0x75f9('0x50');return _0x41c7b0;};exports['scheduledAt']=function(_0x4ea836,_0x31c06f,_0x4dd721){var _0x26830c={};_0x26830c[_0x31c06f]=_0x4ea836[_0x31c06f];_0x26830c[_0x75f9('0x51')]=![];_0x26830c['scheduledat']=moment()[_0x75f9('0x52')](_0x4dd721,_0x75f9('0x53'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x26830c['ContactId']=_0x4ea836[_0x75f9('0x54')];_0x26830c[_0x75f9('0x55')]=_0x4ea836[_0x75f9('0x55')];_0x26830c[_0x75f9('0x1b')]=_0x4ea836[_0x75f9('0x1b')]||undefined;return _0x26830c;};exports['decrementTalkink']=function(_0x1ae6b2,_0x5808a9){if(!_['isNil'](_0x1ae6b2)){if(_0x1ae6b2[_0x75f9('0x56')]>0x0){_0x1ae6b2[_0x75f9('0x56')]-=0x1;}else{logger[_0x75f9('0xb')](_0x5808a9,_0x75f9('0x57'));}}else{logger[_0x75f9('0xb')](_0x5808a9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x75f9('0x58')]=function(_0x244242){if(_0x244242<=0x0){return!![];}return![];};exports[_0x75f9('0x59')]=function(_0x525528,_0x1ea14c,_0x11653c){_0x525528[_0x75f9('0x5a')]=_0x1ea14c;_0x525528[_0x75f9('0x5b')]=_0x525528[_0x75f9('0x5c')];_0x525528['interface']=_0x525528['channelAgent'];if(_0x11653c){_0x525528[_0x75f9('0x5d')]=_0x11653c[_0x75f9('0x5d')];}return _0x525528;};exports['buildAcw']=function(_0x2a37c9){var _0x177133={};_0x177133['queue']=_0x2a37c9[_0x75f9('0x5c')];_0x177133[_0x75f9('0x5e')]=_0x2a37c9[_0x75f9('0x5f')];_0x177133[_0x75f9('0x49')]=_0x2a37c9[_0x75f9('0x49')];return _0x177133;};exports[_0x75f9('0x60')]=function(_0x38999d){var _0x14fdc6=[];for(var _0x21dd38 in _0x38999d){if(_0x38999d[_0x75f9('0x28')](_0x21dd38)){if(!_[_0x75f9('0x17')](_0x38999d[_0x21dd38])&&_0x38999d[_0x21dd38][_0x75f9('0x34')]===_0x75f9('0x61')&&_0x38999d[_0x21dd38][_0x75f9('0x62')]===_0x75f9('0x63')){_0x14fdc6[_0x75f9('0x64')](_0x38999d[_0x21dd38]['id']);}}}return _0x14fdc6;};exports['getDiff']=function(_0x143ffc){var _0x4f4d14=moment()[_0x75f9('0x8')](0x0);var _0x3f0970=moment(_0x143ffc)[_0x75f9('0x8')](0x0);return _0x4f4d14[_0x75f9('0x65')](_0x3f0970,_0x75f9('0x9'));};exports[_0x75f9('0x66')]=function(_0x1a0e70){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a0e70[_0x75f9('0x54')],'ListId':_0x1a0e70[_0x75f9('0x55')],'VoiceQueueId':_0x1a0e70[_0x75f9('0x1b')]||undefined,'CampaignId':_0x1a0e70[_0x75f9('0x67')]||undefined};};exports[_0x75f9('0x68')]=function(_0x765a3e){if(_0x765a3e===_0x75f9('0x49')||_0x765a3e===_0x75f9('0x69')||_0x765a3e==='queue'||_0x765a3e===_0x75f9('0x6a')||_0x765a3e===_0x75f9('0x6b')||_0x765a3e===_0x75f9('0x6c')||_0x765a3e==='membername'||_0x765a3e===_0x75f9('0x5f')||_0x765a3e===_0x75f9('0x44')||_0x765a3e==='active'||_0x765a3e===_0x75f9('0x19')||_0x765a3e===_0x75f9('0x6d')||_0x765a3e==='countbusyretry'||_0x765a3e===_0x75f9('0x4c')||_0x765a3e===_0x75f9('0x4d')||_0x765a3e===_0x75f9('0x6e')||_0x765a3e===_0x75f9('0x6f')||_0x765a3e===_0x75f9('0x70')||_0x765a3e===_0x75f9('0x71')||_0x765a3e===_0x75f9('0x72')||_0x765a3e===_0x75f9('0x54')||_0x765a3e==='ListId'||_0x765a3e===_0x75f9('0x3e')||_0x765a3e===_0x75f9('0x1b')||_0x765a3e===_0x75f9('0x73')||_0x765a3e===_0x75f9('0x74')||_0x765a3e==='xmd-queue'||_0x765a3e===_0x75f9('0x75')||_0x765a3e===_0x75f9('0x76')||_0x765a3e==='xmd-dialurl'||_0x765a3e===_0x75f9('0x77')||_0x765a3e===_0x75f9('0x78')||_0x765a3e===_0x75f9('0x79')||_0x765a3e===_0x75f9('0x7a')||_0x765a3e==='xmd-contactid'||_0x765a3e===_0x75f9('0x7b')||_0x765a3e===_0x75f9('0x7c')||_0x765a3e===_0x75f9('0x7d')||_0x765a3e===_0x75f9('0x7e')||_0x765a3e===_0x75f9('0x7f')||_0x765a3e==='rtpaudioqosbridged'||_0x765a3e===_0x75f9('0x80')||_0x765a3e===_0x75f9('0x81')||_0x765a3e==='rtpaudioqosloss'||_0x765a3e===_0x75f9('0x82')||_0x765a3e==='rtpaudioqosrtt'||_0x765a3e===_0x75f9('0x83')||_0x765a3e===_0x75f9('0x7f')||_0x765a3e==='rtpaudioqosbridged'||_0x765a3e===_0x75f9('0x80')||_0x765a3e===_0x75f9('0x81')||_0x765a3e===_0x75f9('0x84')||_0x765a3e===_0x75f9('0x82')||_0x765a3e===_0x75f9('0x85')||_0x765a3e===_0x75f9('0x83')||_0x765a3e===_0x75f9('0x86')||_0x765a3e===_0x75f9('0x87')||_0x765a3e===_0x75f9('0x34')||_0x765a3e===_0x75f9('0x39')){return![];}return!![];};exports[_0x75f9('0x88')]=function(_0x3a51b7,_0x23986f){var _0x793e4d,_0x4efb2b,_0x534907;if(_0x23986f<=0x0){_0x23986f=0x1;}_0x793e4d=new RegExp('\x5cw{0,'+_0x23986f+'}$');_0x4efb2b=Math[_0x75f9('0x89')](0xa,_0x23986f-0x1);_0x534907=Math['pow'](0xa,_0x23986f)-0x1;return util[_0x75f9('0x14')]('%s',_['replace'](_0x3a51b7,_0x793e4d,_[_0x75f9('0x8a')](_0x4efb2b,_0x534907)));};exports[_0x75f9('0x8b')]=function(_0xb74f73){var _0x3ecb56=_0xb74f73['match'](/"(.*?)"/);return _0x3ecb56?_0x3ecb56[0x1]:_0xb74f73;};exports[_0x75f9('0x8c')]=function(_0x491f0f){var _0x529f04=_0x491f0f[_0x75f9('0x8d')](/<(.*?)>/);return _0x529f04?_0x529f04[0x1]:_0x491f0f;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a3a44f2..517885d 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x51e32a,_0x381508){var _0x330db4=function(_0x1c1f0f){while(--_0x1c1f0f){_0x51e32a['push'](_0x51e32a['shift']());}};_0x330db4(++_0x381508);}(_0x7a54,0x106));var _0x47a5=function(_0x12ebcf,_0x4a8488){_0x12ebcf=_0x12ebcf-0x0;var _0x23c9aa=_0x7a54[_0x12ebcf];return _0x23c9aa;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0xb02dae,_0x313b4d){var _0x10bc17=function(_0x26fdcd){while(--_0x26fdcd){_0xb02dae['push'](_0xb02dae['shift']());}};_0x10bc17(++_0x313b4d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11e5ff,_0x411ff2){_0x11e5ff=_0x11e5ff-0x0;var _0x15a333=_0x5f2f[_0x11e5ff];return _0x15a333;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b9faedb..6a9e051 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 _0x7f28=['queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','answered','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','total','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','salesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','servicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue'];(function(_0x4c4d65,_0x2baa9a){var _0x29ff3a=function(_0x52ccd3){while(--_0x52ccd3){_0x4c4d65['push'](_0x4c4d65['shift']());}};_0x29ff3a(++_0x2baa9a);}(_0x7f28,0x84));var _0x87f2=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7f28[_0x138adb];return _0x1b27f2;};'use strict';var BPromise=require(_0x87f2('0x0'));var util=require('util');var _=require(_0x87f2('0x1'));var moment=require(_0x87f2('0x2'));var Agent=require(_0x87f2('0x3'));var Telephone=require(_0x87f2('0x4'));var Trunk=require(_0x87f2('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x87f2('0x6'));var Template=require('../model/template');var Campaign=require(_0x87f2('0x7'));var VoiceExtension=require(_0x87f2('0x8'));var ZendeskAccount=require(_0x87f2('0x9'));var SalesforceAccount=require(_0x87f2('0xa'));var FreshdeskAccount=require(_0x87f2('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x87f2('0xc'));var DeskAccount=require(_0x87f2('0xd'));var VtigerAccount=require(_0x87f2('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x87f2('0xf')]={};this[_0x87f2('0x10')]={};this[_0x87f2('0x11')]={};this[_0x87f2('0x12')]={};this[_0x87f2('0x13')]={};this['campaigns']={};this[_0x87f2('0x14')]={};this[_0x87f2('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x87f2('0x16')]={};this['channels']={};this[_0x87f2('0x17')]={};this[_0x87f2('0x18')]={};this[_0x87f2('0x19')]={};this[_0x87f2('0x1a')]={};this['salesforceAccounts']={};this[_0x87f2('0x1b')]={};this[_0x87f2('0x1c')]={};this['zohoAccounts']={};this[_0x87f2('0x1d')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x87f2('0x1e')]={};this[_0x87f2('0x1f')]={};this[_0x87f2('0x20')]={};};function freeIsNotKey(_0xc5c1c2,_0xf6064b,_0x13a942){var _0x2a2c65=_[_0x87f2('0x21')](_0xc5c1c2,function(_0x2186ad,_0x184870){return _0x2186ad[_0x13a942];});for(var _0x454eae in _0xf6064b){if(_0xf6064b['hasOwnProperty'](_0x454eae)){if(!_0x2a2c65[_0x454eae]){delete _0xf6064b[_0x454eae];}}}}function freeIsNotKeySip(_0x12813f,_0x54bc14){var _0x58a9ba=_['mapKeys'](_0x12813f,function(_0x26aaee,_0x1b9b99){return util[_0x87f2('0x22')](_0x87f2('0x23'),_0x26aaee[_0x87f2('0x24')]);});for(var _0x5ee3e0 in _0x54bc14){if(_0x54bc14['hasOwnProperty'](_0x5ee3e0)){if(!_0x58a9ba[_0x5ee3e0]){delete _0x54bc14[_0x5ee3e0];}}}}function freeIsNotKeyAgent(_0x528c9c,_0x3c9f94){var _0x596931=_['mapKeys'](_0x528c9c,function(_0xf18431,_0x29ad27){var _0x5e68d4=_[_0x87f2('0x25')](_0xf18431[_0x87f2('0x26')])?util[_0x87f2('0x22')](_0x87f2('0x23'),_0xf18431[_0x87f2('0x24')]):_0xf18431[_0x87f2('0x26')];return _0x5e68d4;});for(var _0x1845d8 in _0x3c9f94){if(_0x3c9f94[_0x87f2('0x27')](_0x1845d8)){if(!_0x596931[_0x1845d8]){delete _0x3c9f94[_0x1845d8];}}}}function clearVoiceCallReports(_0xb36ad7){_0xb36ad7['total']=0x0;_0xb36ad7[_0x87f2('0x28')]=0x0;_0xb36ad7['sumHoldTime']=0x0;_0xb36ad7[_0x87f2('0x29')]=0x0;_0xb36ad7[_0x87f2('0x2a')]=0x0;}function clearCampaigns(_0x595f6e){if(!_['isEmpty'](_0x595f6e)){for(var _0x243f33 in _0x595f6e){if(_0x595f6e['hasOwnProperty'](_0x243f33)){_0x595f6e[_0x243f33][_0x87f2('0x2b')]=0x0;_0x595f6e[_0x243f33][_0x87f2('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x55e246){if(!_[_0x87f2('0x2d')](_0x55e246)){for(var _0x4e883c in _0x55e246){if(_0x55e246[_0x87f2('0x27')](_0x4e883c)){_0x55e246[_0x4e883c][_0x87f2('0x2e')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x28')]=0x0;_0x55e246[_0x4e883c]['unmanaged']=0x0;_0x55e246[_0x4e883c]['abandoned']=0x0;_0x55e246[_0x4e883c][_0x87f2('0x2f')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x29')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x2a')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x30')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x31')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x32')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x33')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x34')]=0x0;_0x55e246[_0x4e883c]['outboundUnknownCallsDay']=0x0;_0x55e246[_0x4e883c][_0x87f2('0x35')]=0x0;_0x55e246[_0x4e883c]['outboundDropCallsDayCallersExit']=0x0;_0x55e246[_0x4e883c][_0x87f2('0x36')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x37')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x38')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x39')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x30')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x3a')]=0x0;_0x55e246[_0x4e883c][_0x87f2('0x3b')]=!![];}}}}Realtime[_0x87f2('0x3c')][_0x87f2('0x3d')]=function(_0x314f52,_0x27f9a9){for(var _0xf6f8e5 in _0x27f9a9){if(_0x314f52['hasOwnProperty'](_0xf6f8e5)){_0x314f52[_0xf6f8e5]=_0x27f9a9[_0xf6f8e5];}}};Realtime['prototype'][_0x87f2('0x3e')]=function(){var _0x41348c=this;return function(_0x3a239a){if(_0x3a239a){freeIsNotKeyAgent(_0x3a239a,_0x41348c['agents']);for(var _0x218148=0x0,_0x4956dc={},_0x1709bb={};_0x218148<_0x3a239a['length'];_0x218148+=0x1){_0x4956dc=_0x3a239a[_0x218148];var _0x4dcc53=_[_0x87f2('0x25')](_0x4956dc[_0x87f2('0x26')])?util['format'](_0x87f2('0x23'),_0x4956dc[_0x87f2('0x24')]):_0x4956dc[_0x87f2('0x26')];if(_[_0x87f2('0x3f')](_0x41348c[_0x87f2('0xf')][_0x4dcc53])){_0x41348c[_0x87f2('0xf')][_0x4dcc53]=new Agent(_0x4956dc);}else{_0x41348c[_0x87f2('0x3d')](_0x41348c[_0x87f2('0xf')][_0x4dcc53],_0x4956dc);}}}return _0x41348c[_0x87f2('0xf')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x40')]=function(){var _0x1b9a0f=this;return function(_0x12c016){if(_0x12c016){freeIsNotKeySip(_0x12c016,_0x1b9a0f[_0x87f2('0x10')]);for(var _0x149ed4=0x0,_0x550dd8={},_0x57d3c4={};_0x149ed4<_0x12c016[_0x87f2('0x41')];_0x149ed4+=0x1){_0x550dd8=_0x12c016[_0x149ed4];if(_[_0x87f2('0x3f')](_0x1b9a0f[_0x87f2('0x10')][util['format'](_0x87f2('0x23'),_0x550dd8['name'])])){_0x1b9a0f[_0x87f2('0x10')][util[_0x87f2('0x22')](_0x87f2('0x23'),_0x550dd8[_0x87f2('0x24')])]=new Telephone(_0x550dd8);}else{_0x1b9a0f[_0x87f2('0x3d')](_0x1b9a0f[_0x87f2('0x10')][util['format'](_0x87f2('0x23'),_0x550dd8[_0x87f2('0x24')])],_0x550dd8);}}}return _0x1b9a0f['telephones'];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x42')]=function(){var _0x15cd4c=this;return function(_0x5d6166){if(_0x5d6166){freeIsNotKeySip(_0x5d6166,_0x15cd4c[_0x87f2('0x11')]);for(var _0x50bda3=0x0,_0x13277b={},_0x24c753={};_0x50bda3<_0x5d6166[_0x87f2('0x41')];_0x50bda3+=0x1){_0x13277b=_0x5d6166[_0x50bda3];if(_[_0x87f2('0x3f')](_0x15cd4c[_0x87f2('0x11')][util[_0x87f2('0x22')](_0x87f2('0x23'),_0x13277b[_0x87f2('0x24')])])){_0x15cd4c[_0x87f2('0x11')][util['format'](_0x87f2('0x23'),_0x13277b[_0x87f2('0x24')])]=new Trunk(_0x13277b);}else{_0x15cd4c['mergeFromDatabase'](_0x15cd4c[_0x87f2('0x11')][util[_0x87f2('0x22')](_0x87f2('0x23'),_0x13277b['name'])],_0x13277b);}}}return _0x15cd4c[_0x87f2('0x11')];};};Realtime['prototype'][_0x87f2('0x43')]=function(){var _0x6453bb=this;return function(_0x259165){if(_0x259165){freeIsNotKey(_0x259165,_0x6453bb[_0x87f2('0x12')],_0x87f2('0x24'));for(var _0x7f06cc=0x0,_0x1c41cf={},_0x387272={};_0x7f06cc<_0x259165[_0x87f2('0x41')];_0x7f06cc+=0x1){_0x1c41cf=_0x259165[_0x7f06cc];if(_[_0x87f2('0x3f')](_0x6453bb[_0x87f2('0x12')][_0x1c41cf[_0x87f2('0x24')]])){_0x6453bb['voiceQueues'][_0x1c41cf[_0x87f2('0x24')]]=new VoiceQueue(_0x1c41cf);}else{_0x6453bb[_0x87f2('0x3d')](_0x6453bb[_0x87f2('0x12')][_0x1c41cf[_0x87f2('0x24')]],_0x1c41cf);}}}return _0x6453bb[_0x87f2('0x12')];};};Realtime['prototype'][_0x87f2('0x44')]=function(){var _0xdf8d72=this;return function(_0x43e975){if(_0x43e975){freeIsNotKey(_0x43e975,_0xdf8d72[_0x87f2('0x13')],'id');for(var _0xf74e35=0x0,_0x112f06={},_0x151f0d={};_0xf74e35<_0x43e975[_0x87f2('0x41')];_0xf74e35+=0x1){_0x112f06=_0x43e975[_0xf74e35];if(_[_0x87f2('0x3f')](_0xdf8d72[_0x87f2('0x13')][_0x112f06['id']])){_0xdf8d72[_0x87f2('0x13')][_0x112f06['id']]=new Trigger(_0x112f06);}else{_0xdf8d72[_0x87f2('0x3d')](_0xdf8d72[_0x87f2('0x13')][_0x112f06['id']],_0x112f06);}}}return _0xdf8d72[_0x87f2('0x13')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x45')]=function(){var _0x5e8a89=this;return function(_0x473d80){if(_0x473d80){freeIsNotKey(_0x473d80,_0x5e8a89[_0x87f2('0x14')],'id');for(var _0x428524=0x0,_0x1be754={},_0x2459d3={};_0x428524<_0x473d80['length'];_0x428524+=0x1){_0x1be754=_0x473d80[_0x428524];if(_[_0x87f2('0x3f')](_0x5e8a89[_0x87f2('0x14')][_0x1be754['id']])){_0x5e8a89['templates'][_0x1be754['id']]=new Template(_0x1be754);}else{_0x5e8a89['mergeFromDatabase'](_0x5e8a89[_0x87f2('0x14')][_0x1be754['id']],_0x1be754);}}}return _0x5e8a89[_0x87f2('0x14')];};};Realtime['prototype'][_0x87f2('0x46')]=function(){var _0x5ee7cf=this;return function(_0x460358){if(_0x460358){freeIsNotKey(_0x460358,_0x5ee7cf[_0x87f2('0x1a')],'id');for(var _0x4ad335=0x0,_0x292f0f={},_0x527460={};_0x4ad335<_0x460358[_0x87f2('0x41')];_0x4ad335+=0x1){_0x292f0f=_0x460358[_0x4ad335];if(_[_0x87f2('0x3f')](_0x5ee7cf['zendeskAccounts'][_0x292f0f['id']])){_0x5ee7cf[_0x87f2('0x1a')][_0x292f0f['id']]=new ZendeskAccount(_0x292f0f);}else{_0x5ee7cf[_0x87f2('0x3d')](_0x5ee7cf[_0x87f2('0x1a')][_0x292f0f['id']],_0x292f0f);}}}return _0x5ee7cf[_0x87f2('0x1a')];};};Realtime[_0x87f2('0x3c')]['initSalesforceAccounts']=function(){var _0x565c9f=this;return function(_0x3dd2f6){if(_0x3dd2f6){freeIsNotKey(_0x3dd2f6,_0x565c9f[_0x87f2('0x47')],'id');for(var _0x6acd10=0x0,_0x35ef52={},_0x4de943={};_0x6acd10<_0x3dd2f6[_0x87f2('0x41')];_0x6acd10+=0x1){_0x35ef52=_0x3dd2f6[_0x6acd10];if(_[_0x87f2('0x3f')](_0x565c9f[_0x87f2('0x47')][_0x35ef52['id']])){_0x565c9f['salesforceAccounts'][_0x35ef52['id']]=new SalesforceAccount(_0x35ef52);}else{_0x565c9f[_0x87f2('0x3d')](_0x565c9f[_0x87f2('0x47')][_0x35ef52['id']],_0x35ef52);}}}return _0x565c9f[_0x87f2('0x47')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x48')]=function(){var _0x43bb76=this;return function(_0x34ea83){if(_0x34ea83){freeIsNotKey(_0x34ea83,_0x43bb76['freshdeskAccounts'],'id');for(var _0x38fb72=0x0,_0x38283a={},_0x38a5fa={};_0x38fb72<_0x34ea83[_0x87f2('0x41')];_0x38fb72+=0x1){_0x38283a=_0x34ea83[_0x38fb72];if(_[_0x87f2('0x3f')](_0x43bb76[_0x87f2('0x1c')][_0x38283a['id']])){_0x43bb76['freshdeskAccounts'][_0x38283a['id']]=new FreshdeskAccount(_0x38283a);}else{_0x43bb76[_0x87f2('0x3d')](_0x43bb76[_0x87f2('0x1c')][_0x38283a['id']],_0x38283a);}}}return _0x43bb76[_0x87f2('0x1c')];};};Realtime[_0x87f2('0x3c')]['initZohoAccounts']=function(){var _0x2a050f=this;return function(_0x3f9c56){if(_0x3f9c56){freeIsNotKey(_0x3f9c56,_0x2a050f['zohoAccounts'],'id');for(var _0x4fddff=0x0,_0x348661={},_0x210b8c={};_0x4fddff<_0x3f9c56[_0x87f2('0x41')];_0x4fddff+=0x1){_0x348661=_0x3f9c56[_0x4fddff];if(_['isUndefined'](_0x2a050f[_0x87f2('0x49')][_0x348661['id']])){_0x2a050f['zohoAccounts'][_0x348661['id']]=new ZohoAccount(_0x348661);}else{_0x2a050f['mergeFromDatabase'](_0x2a050f[_0x87f2('0x49')][_0x348661['id']],_0x348661);}}}return _0x2a050f['zohoAccounts'];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4a')]=function(){var _0x51d18f=this;return function(_0x3e2161){if(_0x3e2161){freeIsNotKey(_0x3e2161,_0x51d18f[_0x87f2('0x1d')],'id');for(var _0x3d3b79=0x0,_0x17df6a={},_0x2068b8={};_0x3d3b79<_0x3e2161['length'];_0x3d3b79+=0x1){_0x17df6a=_0x3e2161[_0x3d3b79];if(_[_0x87f2('0x3f')](_0x51d18f[_0x87f2('0x1d')][_0x17df6a['id']])){_0x51d18f[_0x87f2('0x1d')][_0x17df6a['id']]=new DeskAccount(_0x17df6a);}else{_0x51d18f[_0x87f2('0x3d')](_0x51d18f[_0x87f2('0x1d')][_0x17df6a['id']],_0x17df6a);}}}return _0x51d18f['deskAccounts'];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4b')]=function(){var _0x9bbdd9=this;return function(_0xa82e96){if(_0xa82e96){freeIsNotKey(_0xa82e96,_0x9bbdd9[_0x87f2('0x1b')],'id');for(var _0x5073f0=0x0,_0x38e935={},_0x3b8f25={};_0x5073f0<_0xa82e96[_0x87f2('0x41')];_0x5073f0+=0x1){_0x38e935=_0xa82e96[_0x5073f0];if(_[_0x87f2('0x3f')](_0x9bbdd9[_0x87f2('0x1b')][_0x38e935['id']])){_0x9bbdd9[_0x87f2('0x1b')][_0x38e935['id']]=new SugarcrmAccount(_0x38e935);}else{_0x9bbdd9['mergeFromDatabase'](_0x9bbdd9[_0x87f2('0x1b')][_0x38e935['id']],_0x38e935);}}}return _0x9bbdd9[_0x87f2('0x1b')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4c')]=function(){var _0x2bcbf6=this;return function(_0x31abb6){if(_0x31abb6){freeIsNotKey(_0x31abb6,_0x2bcbf6[_0x87f2('0x4d')],'id');for(var _0x221b49=0x0,_0x320048={},_0x5aad41={};_0x221b49<_0x31abb6[_0x87f2('0x41')];_0x221b49+=0x1){_0x320048=_0x31abb6[_0x221b49];if(_[_0x87f2('0x3f')](_0x2bcbf6[_0x87f2('0x4d')][_0x320048['id']])){_0x2bcbf6['vtigerAccounts'][_0x320048['id']]=new VtigerAccount(_0x320048);}else{_0x2bcbf6[_0x87f2('0x3d')](_0x2bcbf6[_0x87f2('0x4d')][_0x320048['id']],_0x320048);}}}return _0x2bcbf6[_0x87f2('0x4d')];};};Realtime[_0x87f2('0x3c')]['initServicenowAccounts']=function(){var _0x5067b2=this;return function(_0x9087a9){if(_0x9087a9){freeIsNotKey(_0x9087a9,_0x5067b2['servicenowAccounts'],'id');for(var _0xdf094d=0x0,_0x134df8={},_0x43c23b={};_0xdf094d<_0x9087a9[_0x87f2('0x41')];_0xdf094d+=0x1){_0x134df8=_0x9087a9[_0xdf094d];if(_[_0x87f2('0x3f')](_0x5067b2[_0x87f2('0x4e')][_0x134df8['id']])){_0x5067b2['servicenowAccounts'][_0x134df8['id']]=new ServicenowAccount(_0x134df8);}else{_0x5067b2['mergeFromDatabase'](_0x5067b2[_0x87f2('0x4e')][_0x134df8['id']],_0x134df8);}}}return _0x5067b2[_0x87f2('0x4e')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x4f')]=function(){var _0x44e370=this;return function(_0x49545d){if(_0x49545d){freeIsNotKey(_0x49545d,_0x44e370[_0x87f2('0x1e')],'id');for(var _0x1d82ca=0x0,_0x274f64={},_0x3f84a5={};_0x1d82ca<_0x49545d['length'];_0x1d82ca+=0x1){_0x274f64=_0x49545d[_0x1d82ca];if(_['isUndefined'](_0x44e370[_0x87f2('0x1e')][_0x274f64['id']])){_0x44e370[_0x87f2('0x1e')][_0x274f64['id']]=new Dynamics365Account(_0x274f64);}else{_0x44e370[_0x87f2('0x3d')](_0x44e370[_0x87f2('0x1e')][_0x274f64['id']],_0x274f64);}}}return _0x44e370[_0x87f2('0x1e')];};};Realtime[_0x87f2('0x3c')]['initFreshsalesAccounts']=function(){var _0x9ca583=this;return function(_0x2423f3){if(_0x2423f3){freeIsNotKey(_0x2423f3,_0x9ca583[_0x87f2('0x1f')],'id');for(var _0x3bde69=0x0,_0x2c002d={},_0xbee3c8={};_0x3bde69<_0x2423f3['length'];_0x3bde69+=0x1){_0x2c002d=_0x2423f3[_0x3bde69];if(_[_0x87f2('0x3f')](_0x9ca583['freshsalesAccounts'][_0x2c002d['id']])){_0x9ca583[_0x87f2('0x1f')][_0x2c002d['id']]=new FreshsalesAccount(_0x2c002d);}else{_0x9ca583['mergeFromDatabase'](_0x9ca583['freshsalesAccounts'][_0x2c002d['id']],_0x2c002d);}}}return _0x9ca583[_0x87f2('0x1f')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x50')]=function(){var _0x2abdbc=this;return function(_0x534878){for(var _0x40497a=0x0;_0x40497a<_0x534878[_0x87f2('0x41')];_0x40497a+=0x1){_['merge'](_0x2abdbc[_0x87f2('0x12')][_0x534878[_0x40497a]['name']],_0x534878[_0x40497a]);}return _0x2abdbc[_0x87f2('0x12')];};};Realtime['prototype'][_0x87f2('0x51')]=function(){var _0x4ea6ae=this;return function(_0x1d78ec){clearVoiceQueues(_0x4ea6ae[_0x87f2('0x12')]);if(_0x1d78ec){_0x1d78ec=_['groupBy'](_0x1d78ec,_0x87f2('0x52'));for(var _0xd1930d in _0x1d78ec){if(_0x1d78ec[_0x87f2('0x27')](_0xd1930d)){var _0x5f380a={};for(var _0x16c731=0x0;_0x16c731<_0x1d78ec[_0xd1930d][_0x87f2('0x41')];_0x16c731+=0x1){var _0x571ae6=_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x53')];if(_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]){if(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x54')]){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]['unmanaged']+=0x1;}if(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x55')]){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x56')]+=0x1;}_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x2f')]+=moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x57')])[_0x87f2('0x58')](moment(_0x1d78ec[_0xd1930d][_0x16c731]['queuecallerjoinAt']),_0x87f2('0x59'))||0x0;if(_0x16c731===_0x1d78ec[_0xd1930d][_0x87f2('0x41')]-0x1){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x29')]+=moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5a')]||_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5b')]||_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5c')])[_0x87f2('0x58')](moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5d')]),'seconds')||0x0;_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]['total']+=0x1;if(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x5e')]){_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x28')]+=0x1;_0x4ea6ae[_0x87f2('0x12')][_0x571ae6][_0x87f2('0x2a')]+=moment(_0x1d78ec[_0xd1930d][_0x16c731]['queuecallercompleteAt'])[_0x87f2('0x58')](moment(_0x1d78ec[_0xd1930d][_0x16c731][_0x87f2('0x57')]),_0x87f2('0x59'))||0x0;}}else{_0x4ea6ae['voiceQueues'][_0x571ae6][_0x87f2('0x29')]+=_0x4ea6ae[_0x87f2('0x12')][_0x571ae6]['sumHoldTime']||0x0;}}}}}}return _0x4ea6ae[_0x87f2('0x12')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x5f')]=function(){var _0x12e42b=this;return function(_0x4b0966){clearVoiceCallReports(_0x12e42b['outbound']);if(_0x4b0966){for(var _0x3a6fad=0x0;_0x3a6fad<_0x4b0966['length'];_0x3a6fad+=0x1){_0x12e42b[_0x87f2('0x15')][_0x87f2('0x2e')]+=0x1;_0x12e42b['outbound'][_0x87f2('0x29')]+=_0x4b0966[_0x3a6fad]['duration'];if(_0x4b0966[_0x3a6fad][_0x87f2('0x60')]===_0x87f2('0x61')){_0x12e42b['outbound'][_0x87f2('0x28')]+=0x1;_0x12e42b[_0x87f2('0x15')][_0x87f2('0x2f')]+=_0x4b0966[_0x3a6fad][_0x87f2('0x62')]-_0x4b0966[_0x3a6fad][_0x87f2('0x63')]||0x0;_0x12e42b[_0x87f2('0x15')][_0x87f2('0x2a')]+=_0x4b0966[_0x3a6fad][_0x87f2('0x63')];}}}return _0x12e42b['outbound'];};};Realtime['prototype']['initCampaigns']=function(){var _0x184003=this;return function(_0x4eaa0b){if(_0x4eaa0b){freeIsNotKey(_0x4eaa0b,_0x184003['campaigns'],'name');for(var _0x2b0db5=0x0,_0x748ab1={};_0x2b0db5<_0x4eaa0b[_0x87f2('0x41')];_0x2b0db5+=0x1){_0x748ab1=_0x4eaa0b[_0x2b0db5];if(_[_0x87f2('0x3f')](_0x184003[_0x87f2('0x64')][_0x748ab1[_0x87f2('0x24')]])){_0x184003[_0x87f2('0x64')][_0x748ab1[_0x87f2('0x24')]]=new Campaign(_0x748ab1);}else{_0x184003[_0x87f2('0x3d')](_0x184003[_0x87f2('0x64')][_0x748ab1[_0x87f2('0x24')]],_0x748ab1);_0x184003['campaigns'][_0x748ab1[_0x87f2('0x24')]][_0x87f2('0x65')]=_0x748ab1[_0x87f2('0x66')]?_0x748ab1[_0x87f2('0x66')][_0x87f2('0x24')]:undefined;}}}return _0x184003[_0x87f2('0x64')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x67')]=function(){var _0x1f051d=this;return function(_0x274479){if(_0x274479){freeIsNotKey(_0x274479,_0x1f051d[_0x87f2('0x16')],'id');for(var _0x5a55b2=0x0,_0x3f131d={};_0x5a55b2<_0x274479[_0x87f2('0x41')];_0x5a55b2+=0x1){_0x3f131d=_0x274479[_0x5a55b2];if(_[_0x87f2('0x3f')](_0x1f051d[_0x87f2('0x16')][_0x3f131d['id']])){_0x1f051d[_0x87f2('0x16')][_0x3f131d['id']]=new VoiceExtension(_0x3f131d);}else{_0x1f051d[_0x87f2('0x3d')](_0x1f051d[_0x87f2('0x16')][_0x3f131d['id']],_0x3f131d);}}}return _0x1f051d[_0x87f2('0x16')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x68')]=function(){var _0x2aca9a=this;return function(_0x166c4e){clearCampaigns(_0x2aca9a[_0x87f2('0x64')]);for(var _0xe7057e=0x0;_0xe7057e<_0x166c4e['length'];_0xe7057e+=0x1){_[_0x87f2('0x69')](_0x2aca9a[_0x87f2('0x64')][_0x166c4e[_0xe7057e]['name']],_0x166c4e[_0xe7057e]);}return _0x2aca9a[_0x87f2('0x64')];};};Realtime[_0x87f2('0x3c')][_0x87f2('0x6a')]=function(){var _0x15dbf2=this;return function(_0x54f426){if(_0x54f426){freeIsNotKey(_0x54f426,_0x15dbf2[_0x87f2('0x20')],'id');for(var _0x1a83ef=0x0,_0x77c4da={},_0x525bc0={};_0x1a83ef<_0x54f426[_0x87f2('0x41')];_0x1a83ef+=0x1){_0x77c4da=_0x54f426[_0x1a83ef];if(_[_0x87f2('0x3f')](_0x15dbf2[_0x87f2('0x20')][_0x77c4da['id']])){_0x15dbf2['faxAccounts'][_0x77c4da['id']]=new FaxAccount(_0x77c4da);}else{_0x15dbf2[_0x87f2('0x3d')](_0x15dbf2[_0x87f2('0x20')][_0x77c4da['id']],_0x77c4da);}}}return _0x15dbf2[_0x87f2('0x20')];};};module[_0x87f2('0x6b')]=Realtime; \ No newline at end of file +var _0x3233=['campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','initTelephones','length','initTrunks','trunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','queuecallercompleteAt','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','merge','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','triggers'];(function(_0x5bf241,_0x30c0b1){var _0x46c6de=function(_0x3e512a){while(--_0x3e512a){_0x5bf241['push'](_0x5bf241['shift']());}};_0x46c6de(++_0x30c0b1);}(_0x3233,0xc5));var _0x3323=function(_0x12e414,_0x4a9d37){_0x12e414=_0x12e414-0x0;var _0x32624d=_0x3233[_0x12e414];return _0x32624d;};'use strict';var BPromise=require(_0x3323('0x0'));var util=require(_0x3323('0x1'));var _=require(_0x3323('0x2'));var moment=require(_0x3323('0x3'));var Agent=require(_0x3323('0x4'));var Telephone=require(_0x3323('0x5'));var Trunk=require(_0x3323('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x3323('0x7'));var Template=require(_0x3323('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x3323('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x3323('0xa'));var FreshdeskAccount=require(_0x3323('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x3323('0xc'));var DeskAccount=require(_0x3323('0xd'));var VtigerAccount=require(_0x3323('0xe'));var ServicenowAccount=require(_0x3323('0xf'));var Dynamics365Account=require(_0x3323('0x10'));var FreshsalesAccount=require(_0x3323('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x3323('0x12')]={};this[_0x3323('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0x3323('0x14')]={};this[_0x3323('0x15')]={};this[_0x3323('0x16')]={};this[_0x3323('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3323('0x18')]={};this[_0x3323('0x19')]={};this[_0x3323('0x1a')]={};this['outboundChannels']={};this[_0x3323('0x1b')]={};this[_0x3323('0x1c')]={};this[_0x3323('0x1d')]={};this[_0x3323('0x1e')]={};this[_0x3323('0x1f')]={};this[_0x3323('0x20')]={};this[_0x3323('0x21')]={};this[_0x3323('0x22')]={};this[_0x3323('0x23')]={};this['dynamics365Accounts']={};this[_0x3323('0x24')]={};this[_0x3323('0x25')]={};};function freeIsNotKey(_0x45751a,_0x3e7d8b,_0x10f76e){var _0x5366ff=_[_0x3323('0x26')](_0x45751a,function(_0x18c5a9,_0x344c6b){return _0x18c5a9[_0x10f76e];});for(var _0x5e78a0 in _0x3e7d8b){if(_0x3e7d8b[_0x3323('0x27')](_0x5e78a0)){if(!_0x5366ff[_0x5e78a0]){delete _0x3e7d8b[_0x5e78a0];}}}}function freeIsNotKeySip(_0x5a6d14,_0x446b53){var _0x2b80a6=_[_0x3323('0x26')](_0x5a6d14,function(_0xd5fb2e,_0x161a87){return util[_0x3323('0x28')](_0x3323('0x29'),_0xd5fb2e['name']);});for(var _0x1778a0 in _0x446b53){if(_0x446b53[_0x3323('0x27')](_0x1778a0)){if(!_0x2b80a6[_0x1778a0]){delete _0x446b53[_0x1778a0];}}}}function freeIsNotKeyAgent(_0x5c476e,_0x43c348){var _0x32a9d6=_[_0x3323('0x26')](_0x5c476e,function(_0x1f8f13,_0x3fca35){var _0x4f236d=_['isNil'](_0x1f8f13['interface'])?util['format'](_0x3323('0x29'),_0x1f8f13[_0x3323('0x2a')]):_0x1f8f13[_0x3323('0x2b')];return _0x4f236d;});for(var _0x58b710 in _0x43c348){if(_0x43c348[_0x3323('0x27')](_0x58b710)){if(!_0x32a9d6[_0x58b710]){delete _0x43c348[_0x58b710];}}}}function clearVoiceCallReports(_0x4294b7){_0x4294b7[_0x3323('0x2c')]=0x0;_0x4294b7[_0x3323('0x2d')]=0x0;_0x4294b7[_0x3323('0x2e')]=0x0;_0x4294b7[_0x3323('0x2f')]=0x0;_0x4294b7['sumBillable']=0x0;}function clearCampaigns(_0x26edf5){if(!_[_0x3323('0x30')](_0x26edf5)){for(var _0x5e83f3 in _0x26edf5){if(_0x26edf5[_0x3323('0x27')](_0x5e83f3)){_0x26edf5[_0x5e83f3]['ivrTotalCallsDays']=0x0;_0x26edf5[_0x5e83f3][_0x3323('0x31')]=0x0;}}}}function clearVoiceQueues(_0x21bb53){if(!_[_0x3323('0x30')](_0x21bb53)){for(var _0x458775 in _0x21bb53){if(_0x21bb53['hasOwnProperty'](_0x458775)){_0x21bb53[_0x458775]['total']=0x0;_0x21bb53[_0x458775][_0x3323('0x2d')]=0x0;_0x21bb53[_0x458775][_0x3323('0x32')]=0x0;_0x21bb53[_0x458775]['abandoned']=0x0;_0x21bb53[_0x458775][_0x3323('0x2e')]=0x0;_0x21bb53[_0x458775]['sumDuration']=0x0;_0x21bb53[_0x458775]['sumBillable']=0x0;_0x21bb53[_0x458775][_0x3323('0x33')]=0x0;_0x21bb53[_0x458775]['outboundNoAnswerCallsDay']=0x0;_0x21bb53[_0x458775][_0x3323('0x34')]=0x0;_0x21bb53[_0x458775][_0x3323('0x35')]=0x0;_0x21bb53[_0x458775][_0x3323('0x36')]=0x0;_0x21bb53[_0x458775][_0x3323('0x37')]=0x0;_0x21bb53[_0x458775][_0x3323('0x38')]=0x0;_0x21bb53[_0x458775][_0x3323('0x39')]=0x0;_0x21bb53[_0x458775][_0x3323('0x3a')]=0x0;_0x21bb53[_0x458775]['outboundOriginateFailureCallsDay']=0x0;_0x21bb53[_0x458775][_0x3323('0x3b')]=0x0;_0x21bb53[_0x458775][_0x3323('0x3c')]=0x0;_0x21bb53[_0x458775][_0x3323('0x33')]=0x0;_0x21bb53[_0x458775]['outboundAnswerCallsDay']=0x0;_0x21bb53[_0x458775][_0x3323('0x3d')]=!![];}}}}Realtime[_0x3323('0x3e')][_0x3323('0x3f')]=function(_0x4b0408,_0x466a93){for(var _0x55ff11 in _0x466a93){if(_0x4b0408[_0x3323('0x27')](_0x55ff11)){_0x4b0408[_0x55ff11]=_0x466a93[_0x55ff11];}}};Realtime[_0x3323('0x3e')]['initAgents']=function(){var _0x27005e=this;return function(_0xfeba46){if(_0xfeba46){freeIsNotKeyAgent(_0xfeba46,_0x27005e['agents']);for(var _0x139fbe=0x0,_0x1de96f={},_0x25580f={};_0x139fbe<_0xfeba46['length'];_0x139fbe+=0x1){_0x1de96f=_0xfeba46[_0x139fbe];var _0x223154=_['isNil'](_0x1de96f[_0x3323('0x2b')])?util['format'](_0x3323('0x29'),_0x1de96f[_0x3323('0x2a')]):_0x1de96f[_0x3323('0x2b')];if(_[_0x3323('0x40')](_0x27005e[_0x3323('0x12')][_0x223154])){_0x27005e[_0x3323('0x12')][_0x223154]=new Agent(_0x1de96f);}else{_0x27005e[_0x3323('0x3f')](_0x27005e['agents'][_0x223154],_0x1de96f);}}}return _0x27005e[_0x3323('0x12')];};};Realtime[_0x3323('0x3e')][_0x3323('0x41')]=function(){var _0x476ded=this;return function(_0x248c54){if(_0x248c54){freeIsNotKeySip(_0x248c54,_0x476ded[_0x3323('0x13')]);for(var _0x48e38d=0x0,_0x3de42a={},_0x5c2343={};_0x48e38d<_0x248c54[_0x3323('0x42')];_0x48e38d+=0x1){_0x3de42a=_0x248c54[_0x48e38d];if(_[_0x3323('0x40')](_0x476ded[_0x3323('0x13')][util[_0x3323('0x28')](_0x3323('0x29'),_0x3de42a[_0x3323('0x2a')])])){_0x476ded[_0x3323('0x13')][util[_0x3323('0x28')](_0x3323('0x29'),_0x3de42a[_0x3323('0x2a')])]=new Telephone(_0x3de42a);}else{_0x476ded[_0x3323('0x3f')](_0x476ded[_0x3323('0x13')][util[_0x3323('0x28')](_0x3323('0x29'),_0x3de42a['name'])],_0x3de42a);}}}return _0x476ded[_0x3323('0x13')];};};Realtime[_0x3323('0x3e')][_0x3323('0x43')]=function(){var _0x3b5057=this;return function(_0x922c72){if(_0x922c72){freeIsNotKeySip(_0x922c72,_0x3b5057[_0x3323('0x44')]);for(var _0x4cec13=0x0,_0x3f371d={},_0xd4217b={};_0x4cec13<_0x922c72['length'];_0x4cec13+=0x1){_0x3f371d=_0x922c72[_0x4cec13];if(_['isUndefined'](_0x3b5057['trunks'][util[_0x3323('0x28')]('SIP/%s',_0x3f371d[_0x3323('0x2a')])])){_0x3b5057['trunks'][util[_0x3323('0x28')](_0x3323('0x29'),_0x3f371d['name'])]=new Trunk(_0x3f371d);}else{_0x3b5057[_0x3323('0x3f')](_0x3b5057['trunks'][util[_0x3323('0x28')](_0x3323('0x29'),_0x3f371d[_0x3323('0x2a')])],_0x3f371d);}}}return _0x3b5057[_0x3323('0x44')];};};Realtime['prototype'][_0x3323('0x45')]=function(){var _0x55d841=this;return function(_0x194365){if(_0x194365){freeIsNotKey(_0x194365,_0x55d841[_0x3323('0x46')],_0x3323('0x2a'));for(var _0xf25f80=0x0,_0x597744={},_0x5626c1={};_0xf25f80<_0x194365[_0x3323('0x42')];_0xf25f80+=0x1){_0x597744=_0x194365[_0xf25f80];if(_['isUndefined'](_0x55d841[_0x3323('0x46')][_0x597744['name']])){_0x55d841[_0x3323('0x46')][_0x597744[_0x3323('0x2a')]]=new VoiceQueue(_0x597744);}else{_0x55d841[_0x3323('0x3f')](_0x55d841[_0x3323('0x46')][_0x597744[_0x3323('0x2a')]],_0x597744);}}}return _0x55d841[_0x3323('0x46')];};};Realtime['prototype'][_0x3323('0x47')]=function(){var _0x33d093=this;return function(_0x57c167){if(_0x57c167){freeIsNotKey(_0x57c167,_0x33d093['triggers'],'id');for(var _0x331bce=0x0,_0x5570f3={},_0x506d3a={};_0x331bce<_0x57c167[_0x3323('0x42')];_0x331bce+=0x1){_0x5570f3=_0x57c167[_0x331bce];if(_[_0x3323('0x40')](_0x33d093['triggers'][_0x5570f3['id']])){_0x33d093['triggers'][_0x5570f3['id']]=new Trigger(_0x5570f3);}else{_0x33d093[_0x3323('0x3f')](_0x33d093[_0x3323('0x14')][_0x5570f3['id']],_0x5570f3);}}}return _0x33d093['triggers'];};};Realtime[_0x3323('0x3e')][_0x3323('0x48')]=function(){var _0x329658=this;return function(_0x5d79d3){if(_0x5d79d3){freeIsNotKey(_0x5d79d3,_0x329658['templates'],'id');for(var _0x3d7d93=0x0,_0x345b55={},_0x498d2e={};_0x3d7d93<_0x5d79d3[_0x3323('0x42')];_0x3d7d93+=0x1){_0x345b55=_0x5d79d3[_0x3d7d93];if(_[_0x3323('0x40')](_0x329658[_0x3323('0x16')][_0x345b55['id']])){_0x329658[_0x3323('0x16')][_0x345b55['id']]=new Template(_0x345b55);}else{_0x329658[_0x3323('0x3f')](_0x329658['templates'][_0x345b55['id']],_0x345b55);}}}return _0x329658[_0x3323('0x16')];};};Realtime[_0x3323('0x3e')][_0x3323('0x49')]=function(){var _0x1279c8=this;return function(_0x1a603a){if(_0x1a603a){freeIsNotKey(_0x1a603a,_0x1279c8[_0x3323('0x1c')],'id');for(var _0x10e51c=0x0,_0x2275e1={},_0x580dbc={};_0x10e51c<_0x1a603a[_0x3323('0x42')];_0x10e51c+=0x1){_0x2275e1=_0x1a603a[_0x10e51c];if(_['isUndefined'](_0x1279c8[_0x3323('0x1c')][_0x2275e1['id']])){_0x1279c8['zendeskAccounts'][_0x2275e1['id']]=new ZendeskAccount(_0x2275e1);}else{_0x1279c8['mergeFromDatabase'](_0x1279c8[_0x3323('0x1c')][_0x2275e1['id']],_0x2275e1);}}}return _0x1279c8[_0x3323('0x1c')];};};Realtime[_0x3323('0x3e')][_0x3323('0x4a')]=function(){var _0x1153de=this;return function(_0x2950d7){if(_0x2950d7){freeIsNotKey(_0x2950d7,_0x1153de[_0x3323('0x1d')],'id');for(var _0x3e8e76=0x0,_0x1e6276={},_0x61b621={};_0x3e8e76<_0x2950d7[_0x3323('0x42')];_0x3e8e76+=0x1){_0x1e6276=_0x2950d7[_0x3e8e76];if(_[_0x3323('0x40')](_0x1153de[_0x3323('0x1d')][_0x1e6276['id']])){_0x1153de['salesforceAccounts'][_0x1e6276['id']]=new SalesforceAccount(_0x1e6276);}else{_0x1153de['mergeFromDatabase'](_0x1153de[_0x3323('0x1d')][_0x1e6276['id']],_0x1e6276);}}}return _0x1153de[_0x3323('0x1d')];};};Realtime[_0x3323('0x3e')][_0x3323('0x4b')]=function(){var _0x45a658=this;return function(_0x1a0f39){if(_0x1a0f39){freeIsNotKey(_0x1a0f39,_0x45a658[_0x3323('0x1f')],'id');for(var _0x4171e1=0x0,_0x3c2c37={},_0x24b6bf={};_0x4171e1<_0x1a0f39[_0x3323('0x42')];_0x4171e1+=0x1){_0x3c2c37=_0x1a0f39[_0x4171e1];if(_[_0x3323('0x40')](_0x45a658[_0x3323('0x1f')][_0x3c2c37['id']])){_0x45a658['freshdeskAccounts'][_0x3c2c37['id']]=new FreshdeskAccount(_0x3c2c37);}else{_0x45a658[_0x3323('0x3f')](_0x45a658[_0x3323('0x1f')][_0x3c2c37['id']],_0x3c2c37);}}}return _0x45a658['freshdeskAccounts'];};};Realtime[_0x3323('0x3e')][_0x3323('0x4c')]=function(){var _0xbe6445=this;return function(_0x44440f){if(_0x44440f){freeIsNotKey(_0x44440f,_0xbe6445[_0x3323('0x20')],'id');for(var _0x35a041=0x0,_0x2af067={},_0x43c7f6={};_0x35a041<_0x44440f[_0x3323('0x42')];_0x35a041+=0x1){_0x2af067=_0x44440f[_0x35a041];if(_[_0x3323('0x40')](_0xbe6445[_0x3323('0x20')][_0x2af067['id']])){_0xbe6445[_0x3323('0x20')][_0x2af067['id']]=new ZohoAccount(_0x2af067);}else{_0xbe6445['mergeFromDatabase'](_0xbe6445['zohoAccounts'][_0x2af067['id']],_0x2af067);}}}return _0xbe6445[_0x3323('0x20')];};};Realtime['prototype'][_0x3323('0x4d')]=function(){var _0x5efff3=this;return function(_0x4d721c){if(_0x4d721c){freeIsNotKey(_0x4d721c,_0x5efff3[_0x3323('0x21')],'id');for(var _0x2cac7e=0x0,_0x2de73c={},_0x1b3478={};_0x2cac7e<_0x4d721c[_0x3323('0x42')];_0x2cac7e+=0x1){_0x2de73c=_0x4d721c[_0x2cac7e];if(_[_0x3323('0x40')](_0x5efff3[_0x3323('0x21')][_0x2de73c['id']])){_0x5efff3[_0x3323('0x21')][_0x2de73c['id']]=new DeskAccount(_0x2de73c);}else{_0x5efff3[_0x3323('0x3f')](_0x5efff3[_0x3323('0x21')][_0x2de73c['id']],_0x2de73c);}}}return _0x5efff3[_0x3323('0x21')];};};Realtime['prototype'][_0x3323('0x4e')]=function(){var _0x3623df=this;return function(_0x44e621){if(_0x44e621){freeIsNotKey(_0x44e621,_0x3623df[_0x3323('0x1e')],'id');for(var _0x5afa94=0x0,_0x4e407d={},_0x3a9b6b={};_0x5afa94<_0x44e621['length'];_0x5afa94+=0x1){_0x4e407d=_0x44e621[_0x5afa94];if(_[_0x3323('0x40')](_0x3623df[_0x3323('0x1e')][_0x4e407d['id']])){_0x3623df[_0x3323('0x1e')][_0x4e407d['id']]=new SugarcrmAccount(_0x4e407d);}else{_0x3623df[_0x3323('0x3f')](_0x3623df[_0x3323('0x1e')][_0x4e407d['id']],_0x4e407d);}}}return _0x3623df[_0x3323('0x1e')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x4691ac=this;return function(_0x3974a5){if(_0x3974a5){freeIsNotKey(_0x3974a5,_0x4691ac[_0x3323('0x22')],'id');for(var _0x579e2e=0x0,_0x4ef23c={},_0x5a9265={};_0x579e2e<_0x3974a5[_0x3323('0x42')];_0x579e2e+=0x1){_0x4ef23c=_0x3974a5[_0x579e2e];if(_[_0x3323('0x40')](_0x4691ac[_0x3323('0x22')][_0x4ef23c['id']])){_0x4691ac['vtigerAccounts'][_0x4ef23c['id']]=new VtigerAccount(_0x4ef23c);}else{_0x4691ac[_0x3323('0x3f')](_0x4691ac['vtigerAccounts'][_0x4ef23c['id']],_0x4ef23c);}}}return _0x4691ac[_0x3323('0x22')];};};Realtime[_0x3323('0x3e')][_0x3323('0x4f')]=function(){var _0x53f6ce=this;return function(_0x2436e3){if(_0x2436e3){freeIsNotKey(_0x2436e3,_0x53f6ce[_0x3323('0x23')],'id');for(var _0x1cf3ec=0x0,_0x25a66c={},_0x56657b={};_0x1cf3ec<_0x2436e3[_0x3323('0x42')];_0x1cf3ec+=0x1){_0x25a66c=_0x2436e3[_0x1cf3ec];if(_[_0x3323('0x40')](_0x53f6ce[_0x3323('0x23')][_0x25a66c['id']])){_0x53f6ce[_0x3323('0x23')][_0x25a66c['id']]=new ServicenowAccount(_0x25a66c);}else{_0x53f6ce['mergeFromDatabase'](_0x53f6ce[_0x3323('0x23')][_0x25a66c['id']],_0x25a66c);}}}return _0x53f6ce['servicenowAccounts'];};};Realtime[_0x3323('0x3e')][_0x3323('0x50')]=function(){var _0x53a046=this;return function(_0x52beb1){if(_0x52beb1){freeIsNotKey(_0x52beb1,_0x53a046[_0x3323('0x51')],'id');for(var _0x5700af=0x0,_0x3189a4={},_0x74df14={};_0x5700af<_0x52beb1[_0x3323('0x42')];_0x5700af+=0x1){_0x3189a4=_0x52beb1[_0x5700af];if(_[_0x3323('0x40')](_0x53a046[_0x3323('0x51')][_0x3189a4['id']])){_0x53a046[_0x3323('0x51')][_0x3189a4['id']]=new Dynamics365Account(_0x3189a4);}else{_0x53a046[_0x3323('0x3f')](_0x53a046[_0x3323('0x51')][_0x3189a4['id']],_0x3189a4);}}}return _0x53a046[_0x3323('0x51')];};};Realtime[_0x3323('0x3e')][_0x3323('0x52')]=function(){var _0x5baf86=this;return function(_0xb44442){if(_0xb44442){freeIsNotKey(_0xb44442,_0x5baf86['freshsalesAccounts'],'id');for(var _0x41b25d=0x0,_0x1dfb3d={},_0x446cd4={};_0x41b25d<_0xb44442['length'];_0x41b25d+=0x1){_0x1dfb3d=_0xb44442[_0x41b25d];if(_['isUndefined'](_0x5baf86[_0x3323('0x24')][_0x1dfb3d['id']])){_0x5baf86[_0x3323('0x24')][_0x1dfb3d['id']]=new FreshsalesAccount(_0x1dfb3d);}else{_0x5baf86[_0x3323('0x3f')](_0x5baf86[_0x3323('0x24')][_0x1dfb3d['id']],_0x1dfb3d);}}}return _0x5baf86[_0x3323('0x24')];};};Realtime[_0x3323('0x3e')][_0x3323('0x53')]=function(){var _0xb607c0=this;return function(_0x2934f8){for(var _0x9fe7e3=0x0;_0x9fe7e3<_0x2934f8[_0x3323('0x42')];_0x9fe7e3+=0x1){_['merge'](_0xb607c0[_0x3323('0x46')][_0x2934f8[_0x9fe7e3]['name']],_0x2934f8[_0x9fe7e3]);}return _0xb607c0[_0x3323('0x46')];};};Realtime[_0x3323('0x3e')]['initVoiceQueueReports']=function(){var _0x3abecb=this;return function(_0x1b4f2a){clearVoiceQueues(_0x3abecb[_0x3323('0x46')]);if(_0x1b4f2a){_0x1b4f2a=_[_0x3323('0x54')](_0x1b4f2a,_0x3323('0x55'));for(var _0x3c950c in _0x1b4f2a){if(_0x1b4f2a['hasOwnProperty'](_0x3c950c)){var _0xba4c18={};for(var _0x442975=0x0;_0x442975<_0x1b4f2a[_0x3c950c][_0x3323('0x42')];_0x442975+=0x1){var _0x16e517=_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x56')];if(_0x3abecb[_0x3323('0x46')][_0x16e517]){if(_0x1b4f2a[_0x3c950c][_0x442975]['queuecallerexit']){_0x3abecb[_0x3323('0x46')][_0x16e517]['unmanaged']+=0x1;}if(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x57')]){_0x3abecb['voiceQueues'][_0x16e517][_0x3323('0x58')]+=0x1;}_0x3abecb[_0x3323('0x46')][_0x16e517]['sumHoldTime']+=moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x59')])[_0x3323('0x5a')](moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5b')]),_0x3323('0x5c'))||0x0;if(_0x442975===_0x1b4f2a[_0x3c950c]['length']-0x1){_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2f')]+=moment(_0x1b4f2a[_0x3c950c][_0x442975]['queuecallercompleteAt']||_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5d')]||_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5e')])[_0x3323('0x5a')](moment(_0x1b4f2a[_0x3c950c][_0x442975]['queuecallerjoinAt']),'seconds')||0x0;_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2c')]+=0x1;if(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x5f')]){_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2d')]+=0x1;_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x60')]+=moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x61')])[_0x3323('0x5a')](moment(_0x1b4f2a[_0x3c950c][_0x442975][_0x3323('0x59')]),'seconds')||0x0;}}else{_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2f')]+=_0x3abecb[_0x3323('0x46')][_0x16e517][_0x3323('0x2e')]||0x0;}}}}}}return _0x3abecb['voiceQueues'];};};Realtime[_0x3323('0x3e')]['initVoiceCallReports']=function(){var _0x3b9ac2=this;return function(_0x21f19a){clearVoiceCallReports(_0x3b9ac2['outbound']);if(_0x21f19a){for(var _0x44712d=0x0;_0x44712d<_0x21f19a[_0x3323('0x42')];_0x44712d+=0x1){_0x3b9ac2[_0x3323('0x17')]['total']+=0x1;_0x3b9ac2[_0x3323('0x17')][_0x3323('0x2f')]+=_0x21f19a[_0x44712d][_0x3323('0x62')];if(_0x21f19a[_0x44712d][_0x3323('0x63')]===_0x3323('0x64')){_0x3b9ac2[_0x3323('0x17')][_0x3323('0x2d')]+=0x1;_0x3b9ac2[_0x3323('0x17')][_0x3323('0x2e')]+=_0x21f19a[_0x44712d][_0x3323('0x62')]-_0x21f19a[_0x44712d][_0x3323('0x65')]||0x0;_0x3b9ac2['outbound'][_0x3323('0x60')]+=_0x21f19a[_0x44712d][_0x3323('0x65')];}}}return _0x3b9ac2[_0x3323('0x17')];};};Realtime[_0x3323('0x3e')][_0x3323('0x66')]=function(){var _0x47c2ed=this;return function(_0x1e444b){if(_0x1e444b){freeIsNotKey(_0x1e444b,_0x47c2ed[_0x3323('0x15')],'name');for(var _0x5259a4=0x0,_0x3d3963={};_0x5259a4<_0x1e444b['length'];_0x5259a4+=0x1){_0x3d3963=_0x1e444b[_0x5259a4];if(_[_0x3323('0x40')](_0x47c2ed['campaigns'][_0x3d3963[_0x3323('0x2a')]])){_0x47c2ed[_0x3323('0x15')][_0x3d3963['name']]=new Campaign(_0x3d3963);}else{_0x47c2ed[_0x3323('0x3f')](_0x47c2ed['campaigns'][_0x3d3963[_0x3323('0x2a')]],_0x3d3963);_0x47c2ed[_0x3323('0x15')][_0x3d3963[_0x3323('0x2a')]][_0x3323('0x67')]=_0x3d3963['SquareProject']?_0x3d3963[_0x3323('0x68')]['name']:undefined;}}}return _0x47c2ed[_0x3323('0x15')];};};Realtime[_0x3323('0x3e')]['initVoiceExtensions']=function(){var _0x17acce=this;return function(_0x49a034){if(_0x49a034){freeIsNotKey(_0x49a034,_0x17acce[_0x3323('0x18')],'id');for(var _0x1a4004=0x0,_0xaed88d={};_0x1a4004<_0x49a034[_0x3323('0x42')];_0x1a4004+=0x1){_0xaed88d=_0x49a034[_0x1a4004];if(_[_0x3323('0x40')](_0x17acce['voiceExtensions'][_0xaed88d['id']])){_0x17acce['voiceExtensions'][_0xaed88d['id']]=new VoiceExtension(_0xaed88d);}else{_0x17acce[_0x3323('0x3f')](_0x17acce[_0x3323('0x18')][_0xaed88d['id']],_0xaed88d);}}}return _0x17acce['voiceExtensions'];};};Realtime[_0x3323('0x3e')][_0x3323('0x69')]=function(){var _0x2648db=this;return function(_0x5abed0){clearCampaigns(_0x2648db[_0x3323('0x15')]);for(var _0xd591bb=0x0;_0xd591bb<_0x5abed0[_0x3323('0x42')];_0xd591bb+=0x1){_[_0x3323('0x6a')](_0x2648db[_0x3323('0x15')][_0x5abed0[_0xd591bb]['name']],_0x5abed0[_0xd591bb]);}return _0x2648db['campaigns'];};};Realtime[_0x3323('0x3e')][_0x3323('0x6b')]=function(){var _0x45b74b=this;return function(_0x1a781e){if(_0x1a781e){freeIsNotKey(_0x1a781e,_0x45b74b[_0x3323('0x25')],'id');for(var _0x777ff4=0x0,_0x1b1f29={},_0x3b4613={};_0x777ff4<_0x1a781e[_0x3323('0x42')];_0x777ff4+=0x1){_0x1b1f29=_0x1a781e[_0x777ff4];if(_[_0x3323('0x40')](_0x45b74b['faxAccounts'][_0x1b1f29['id']])){_0x45b74b[_0x3323('0x25')][_0x1b1f29['id']]=new FaxAccount(_0x1b1f29);}else{_0x45b74b[_0x3323('0x3f')](_0x45b74b[_0x3323('0x25')][_0x1b1f29['id']],_0x1b1f29);}}}return _0x45b74b[_0x3323('0x25')];};};module[_0x3323('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8c495a8..b360588 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 _0xaa06=['voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','custom:voiceQueueReport','voiceCallReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','accountcode','interface','format'];(function(_0x420501,_0x4f5374){var _0x303742=function(_0x193c1a){while(--_0x193c1a){_0x420501['push'](_0x420501['shift']());}};_0x303742(++_0x4f5374);}(_0xaa06,0xd7));var _0x6aa0=function(_0x14ab2e,_0x72d1f9){_0x14ab2e=_0x14ab2e-0x0;var _0xcb22a=_0xaa06[_0x14ab2e];return _0xcb22a;};'use strict';var _=require('lodash');var moment=require(_0x6aa0('0x0'));var util=require(_0x6aa0('0x1'));var config=require(_0x6aa0('0x2'));var ami=require(_0x6aa0('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x6aa0('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x6aa0('0x5'));var RpcVoiceRecording=require(_0x6aa0('0x6'));var RpcVoiceTransferReport=require(_0x6aa0('0x7'));var VoiceQueueReport=require(_0x6aa0('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x6aa0('0x9'));var VoiceDialReport=require(_0x6aa0('0xa'));var UserReport=require(_0x6aa0('0xb'));function Report(_0x5e17c7){this['realtime']=_0x5e17c7;this[_0x6aa0('0xc')]=_0x5e17c7['agents'];this[_0x6aa0('0xd')]=_0x5e17c7[_0x6aa0('0xd')];}Report[_0x6aa0('0xe')]['sync']=function(_0x5b57d7){var _0x552f8a=new VoiceQueueReport(this[_0x6aa0('0xf')]);var _0x571caa=new VoiceAgentReport(this['realtime']);var _0x54f296=new VoiceDialReport(this[_0x6aa0('0xf')]);var _0x508944=new VoiceCallReport(this['realtime']);var _0x40171f=new UserReport(this['realtime']);if(config[_0x6aa0('0x10')]&&config[_0x6aa0('0x10')]['disabled']){ami['on'](_0x6aa0('0x11'),this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this[_0x6aa0('0x12')][_0x6aa0('0x13')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0x6aa0('0x14'),this['voiceDialReport']['bind'](this));ami['on'](_0x6aa0('0x15'),this[_0x6aa0('0x16')][_0x6aa0('0x13')](this));ami['on'](_0x6aa0('0x17'),this[_0x6aa0('0x18')]['bind'](this));}};Report['prototype'][_0x6aa0('0x19')]=function(_0x2916f7){var _0xc40094;_0xc40094=_[_0x6aa0('0x1a')](this[_0x6aa0('0xc')],function(_0x1e90f8){return _0x1e90f8['accountcode']==_0x2916f7||_0x1e90f8[_0x6aa0('0x1b')]==_0x2916f7;});if(_['isNil'](_0xc40094)){var _0x1f1e5c=_[_0x6aa0('0x1a')](this['telephones'],function(_0x18c9bf){return _0x18c9bf[_0x6aa0('0x1c')]==_0x2916f7||_0x18c9bf[_0x6aa0('0x1b')]==_0x2916f7;});if(_0x1f1e5c){_0xc40094=_[_0x6aa0('0x1a')](this[_0x6aa0('0xc')],function(_0x6fd9a5){return _0x6fd9a5[_0x6aa0('0x1d')]==util[_0x6aa0('0x1e')]('SIP/%s',_0x1f1e5c[_0x6aa0('0x1b')]);});}}return _0xc40094;};Report['prototype'][_0x6aa0('0x1f')]=function(_0x123421){for(var _0x308576=0x0;_0x308576<_0x123421[_0x6aa0('0x20')];_0x308576+=0x1){var _0xff181f=this['findAgent'](_0x123421[_0x308576][_0x6aa0('0x21')]);if(_0xff181f){_0x123421[_0x308576][_0x6aa0('0x1c')]=_0xff181f[_0x6aa0('0x1c')];_0x123421[_0x308576][_0x6aa0('0x22')]=!![];_0x123421[_0x308576][_0x6aa0('0x23')]=_0xff181f[_0x6aa0('0x1b')];_0x123421[_0x308576][_0x6aa0('0x1d')]=_[_0x6aa0('0x24')](_0xff181f[_0x6aa0('0x1d')])?util[_0x6aa0('0x1e')](_0x6aa0('0x25'),_0xff181f[_0x6aa0('0x1b')]):_0xff181f['interface'];if(_0x123421[_0x308576]['queuecallercomplete']){_0x123421[_0x308576]['queuecallercompleteAt']=moment()[_0x6aa0('0x1e')](_0x6aa0('0x26'));}if(_0x123421[_0x308576][_0x6aa0('0x27')]){_0x123421[_0x308576][_0x6aa0('0x28')]=moment()[_0x6aa0('0x1e')](_0x6aa0('0x26'));}RpcMemberReport['voiceQueueReport'](_0x123421[_0x308576]);}RpcVoiceQueueReport[_0x6aa0('0x29')](_0x123421[_0x308576]);}};function extractCalleridNumber(_0x20ab22){var _0x2d7349=_0x20ab22[_0x6aa0('0x2a')](/<(.*?)>/);return _0x2d7349?_0x2d7349[0x1]:_0x20ab22;}Report[_0x6aa0('0xe')]['voiceCallReport']=function(_0x18363e){_0x18363e[_0x6aa0('0x2b')]=_0x18363e['destination']||_0x18363e[_0x6aa0('0x2c')];if(_0x18363e[_0x6aa0('0x2d')]==_0x6aa0('0x2e')){_0x18363e[_0x6aa0('0x2f')]=_0x6aa0('0x30');_0x18363e[_0x6aa0('0x31')]=_0x18363e[_0x6aa0('0x30')];if(_0x18363e[_0x6aa0('0x32')]==_0x6aa0('0x33')){_0x18363e[_0x6aa0('0x1c')]='';_0x18363e[_0x6aa0('0x2b')]=extractCalleridNumber(_0x18363e[_0x6aa0('0x34')]);}else if(_0x18363e[_0x6aa0('0x32')]=='from-sip'){if(_0x18363e['destination']==_0x6aa0('0x35')){_0x18363e[_0x6aa0('0x2b')]=extractCalleridNumber(_0x18363e[_0x6aa0('0x36')]);_0x18363e[_0x6aa0('0x37')]=_0x18363e['originatecalleridnum'];_0x18363e['destinationchannel']=[_0x18363e['channel'],_0x18363e[_0x6aa0('0x38')]=_0x18363e[_0x6aa0('0x39')]][0x0];_0x18363e[_0x6aa0('0x34')]=_0x18363e[_0x6aa0('0x36')];}else{_0x18363e[_0x6aa0('0x2b')]=_0x18363e[_0x6aa0('0x37')];_0x18363e['calleridnum']=_0x18363e[_0x6aa0('0x3a')];if(_0x18363e[_0x6aa0('0x3b')]==_0x6aa0('0x3c')){_0x18363e['accountcode']=_0x18363e[_0x6aa0('0x21')];}else{_0x18363e[_0x6aa0('0x1c')]='';}}}}else{_0x18363e['callerid']=util[_0x6aa0('0x1e')](_0x6aa0('0x3d'),_0x18363e[_0x6aa0('0x3e')],_0x18363e[_0x6aa0('0x37')]);}if(RpcVoiceTransferReport[_0x6aa0('0x3f')][_0x18363e['linkedid']]){var _0x3d8cd5=RpcVoiceTransferReport['transfers'][_0x18363e[_0x6aa0('0x40')]];_0x3d8cd5[_0x6aa0('0x41')]=_0x18363e[_0x6aa0('0x42')];RpcVoiceTransferReport['blindTransfer'](_0x3d8cd5);delete RpcVoiceTransferReport[_0x6aa0('0x3f')][_0x18363e[_0x6aa0('0x40')]];}RpcVoiceCallReport['create'](_0x18363e);if(_0x18363e[_0x6aa0('0x43')]){for(var _0x43860c=0x0;_0x43860c<_0x18363e[_0x6aa0('0x44')][_0x6aa0('0x20')];_0x43860c+=0x1){_0x18363e[_0x6aa0('0x45')]=_0x18363e['monitors'][_0x43860c]['filename'];_0x18363e[_0x6aa0('0x46')]=_0x18363e[_0x6aa0('0x44')][_0x43860c]['createdAt'];if(_0x18363e[_0x6aa0('0x2c')]==_0x6aa0('0x35')){_0x18363e[_0x6aa0('0x37')]=_0x18363e[_0x6aa0('0x21')];_0x18363e[_0x6aa0('0x3e')]=_0x18363e[_0x6aa0('0x47')];_0x18363e[_0x6aa0('0x21')]=_0x18363e[_0x6aa0('0x1c')];_0x18363e['connectedlinename']=_0x18363e['membername'];_0x18363e['exten']=_0x18363e[_0x6aa0('0x3a')];}else if(_0x18363e[_0x6aa0('0x2c')]==_0x6aa0('0x48')){_0x18363e[_0x6aa0('0x37')]=_0x18363e[_0x6aa0('0x2b')];_0x18363e[_0x6aa0('0x2c')]=_0x18363e[_0x6aa0('0x3a')];}RpcVoiceRecording[_0x6aa0('0x29')](_0x18363e);}}};Report[_0x6aa0('0xe')]['voiceAgentReport']=function(_0x5e353c){if(_[_0x6aa0('0x49')](_0x5e353c)){_0x5e353c['forEach'](function(_0x28277e){RpcVoiceAgentReport[_0x6aa0('0x29')](_0x28277e);});}else{RpcVoiceAgentReport[_0x6aa0('0x29')](_0x5e353c);}};Report['prototype']['voiceDialReport']=function(_0x1b4c4e){RpcVoiceDialReport[_0x6aa0('0x29')](_0x1b4c4e);var _0x198cd3;var _0x4715b2;var _0x12c395=_0x1b4c4e['channel'];if(_[_0x6aa0('0x4a')](_0x12c395,_0x6aa0('0x4b'))){_0x4715b2=_0x12c395[_0x6aa0('0x4c')](_0x12c395[_0x6aa0('0x4d')]('/')+0x1,_0x12c395['indexOf']('@'));_0x198cd3=_[_0x6aa0('0x1a')](this[_0x6aa0('0xc')],function(_0x496c1b){return _0x496c1b['mobile']==_0x4715b2||_0x496c1b[_0x6aa0('0x4e')]==_0x4715b2||_0x496c1b['accountcode']==_0x4715b2;});}else{_0x4715b2=_0x12c395[_0x6aa0('0x4c')](_0x12c395[_0x6aa0('0x4d')]('/')+0x1,_0x12c395[_0x6aa0('0x4f')]('-'));_0x198cd3=this[_0x6aa0('0x19')](_0x4715b2);}if(_0x198cd3){_0x1b4c4e[_0x6aa0('0x1d')]=_['isNil'](_0x198cd3[_0x6aa0('0x1d')])?util[_0x6aa0('0x1e')](_0x6aa0('0x25'),_0x198cd3[_0x6aa0('0x1b')]):_0x198cd3[_0x6aa0('0x1d')];_0x1b4c4e['membername']=_0x198cd3[_0x6aa0('0x1b')];_0x1b4c4e['accountcode']=_0x198cd3[_0x6aa0('0x1c')];RpcMemberReport['voiceDialReport'](_0x1b4c4e);}};Report[_0x6aa0('0xe')][_0x6aa0('0x16')]=function(_0x2edcf7){RpcVoiceTransferReport[_0x6aa0('0x3f')][_0x2edcf7[_0x6aa0('0x50')]]=_0x2edcf7;};Report[_0x6aa0('0xe')]['attendedTransfer']=function(_0x338fa7){RpcVoiceTransferReport[_0x6aa0('0x18')](_0x338fa7);};module[_0x6aa0('0x51')]=Report; \ No newline at end of file +var _0x2b59=['lastAssignedTo','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceCallReport','exten','type','lastapplication','queue','lastdata','context','destination','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','uniqueid','monitors','length','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','create','startsWith','indexOf','find','phone','substring','membername','transfererlinkedid','attendedTransfer','exports','util','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','accountcode','isNil','name','interface','SIP/%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b59,0x1b5));var _0x92b5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b59[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x92b5('0x0'));var config=require('../../../config/environment');var ami=require(_0x92b5('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x92b5('0x2'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x92b5('0x3'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x92b5('0x4'));var RpcVoiceTransferReport=require(_0x92b5('0x5'));var VoiceQueueReport=require(_0x92b5('0x6'));var VoiceCallReport=require(_0x92b5('0x7'));var VoiceAgentReport=require(_0x92b5('0x8'));var VoiceDialReport=require(_0x92b5('0x9'));var UserReport=require(_0x92b5('0xa'));function Report(_0x712ce4){this['realtime']=_0x712ce4;this[_0x92b5('0xb')]=_0x712ce4[_0x92b5('0xb')];this['telephones']=_0x712ce4['telephones'];}Report[_0x92b5('0xc')][_0x92b5('0xd')]=function(_0x23b25b){var _0x130f54=new VoiceQueueReport(this[_0x92b5('0xe')]);var _0x47dc2f=new VoiceAgentReport(this[_0x92b5('0xe')]);var _0x1e0052=new VoiceDialReport(this[_0x92b5('0xe')]);var _0x374b9a=new VoiceCallReport(this[_0x92b5('0xe')]);var _0x408589=new UserReport(this[_0x92b5('0xe')]);if(config[_0x92b5('0xf')]&&config[_0x92b5('0xf')][_0x92b5('0x10')]){ami['on']('custom:voiceQueueReport',this[_0x92b5('0x11')][_0x92b5('0x12')](this));ami['on'](_0x92b5('0x13'),this['voiceCallReport'][_0x92b5('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0x92b5('0x14')]['bind'](this));ami['on'](_0x92b5('0x15'),this[_0x92b5('0x16')][_0x92b5('0x12')](this));ami['on'](_0x92b5('0x17'),this[_0x92b5('0x18')][_0x92b5('0x12')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x92b5('0x12')](this));}};Report[_0x92b5('0xc')][_0x92b5('0x19')]=function(_0x50a9bc){var _0x4d621f;_0x4d621f=_['find'](this[_0x92b5('0xb')],function(_0x16b741){return _0x16b741[_0x92b5('0x1a')]==_0x50a9bc||_0x16b741['name']==_0x50a9bc;});if(_[_0x92b5('0x1b')](_0x4d621f)){var _0x4b51eb=_['find'](this['telephones'],function(_0x516086){return _0x516086['accountcode']==_0x50a9bc||_0x516086[_0x92b5('0x1c')]==_0x50a9bc;});if(_0x4b51eb){_0x4d621f=_['find'](this[_0x92b5('0xb')],function(_0x4d9cbc){return _0x4d9cbc[_0x92b5('0x1d')]==util['format'](_0x92b5('0x1e'),_0x4b51eb[_0x92b5('0x1c')]);});}}return _0x4d621f;};Report['prototype'][_0x92b5('0x11')]=function(_0x2a76b2){for(var _0x4a6414=0x0;_0x4a6414<_0x2a76b2['length'];_0x4a6414+=0x1){var _0x3f3e5b=this[_0x92b5('0x19')](_0x2a76b2[_0x4a6414]['connectedlinenum']);if(_0x3f3e5b){_0x2a76b2[_0x4a6414][_0x92b5('0x1a')]=_0x3f3e5b[_0x92b5('0x1a')];_0x2a76b2[_0x4a6414]['assigned']=!![];_0x2a76b2[_0x4a6414][_0x92b5('0x1f')]=_0x3f3e5b[_0x92b5('0x1c')];_0x2a76b2[_0x4a6414][_0x92b5('0x1d')]=_[_0x92b5('0x1b')](_0x3f3e5b[_0x92b5('0x1d')])?util[_0x92b5('0x20')]('SIP/%s',_0x3f3e5b[_0x92b5('0x1c')]):_0x3f3e5b['interface'];if(_0x2a76b2[_0x4a6414][_0x92b5('0x21')]){_0x2a76b2[_0x4a6414]['queuecallercompleteAt']=moment()[_0x92b5('0x20')](_0x92b5('0x22'));}if(_0x2a76b2[_0x4a6414][_0x92b5('0x23')]){_0x2a76b2[_0x4a6414][_0x92b5('0x24')]=moment()[_0x92b5('0x20')](_0x92b5('0x22'));}RpcMemberReport[_0x92b5('0x11')](_0x2a76b2[_0x4a6414]);}RpcVoiceQueueReport['create'](_0x2a76b2[_0x4a6414]);}};function extractCalleridNumber(_0x14dbe0){var _0x120864=_0x14dbe0['match'](/<(.*?)>/);return _0x120864?_0x120864[0x1]:_0x14dbe0;}Report[_0x92b5('0xc')][_0x92b5('0x25')]=function(_0x222f78){_0x222f78['destination']=_0x222f78['destination']||_0x222f78[_0x92b5('0x26')];if(_0x222f78[_0x92b5('0x27')]=='dialer'){_0x222f78[_0x92b5('0x28')]=_0x92b5('0x29');_0x222f78[_0x92b5('0x2a')]=_0x222f78[_0x92b5('0x29')];if(_0x222f78[_0x92b5('0x2b')]=='from-voip-provider'){_0x222f78['accountcode']='';_0x222f78[_0x92b5('0x2c')]=extractCalleridNumber(_0x222f78[_0x92b5('0x2d')]);}else if(_0x222f78[_0x92b5('0x2b')]==_0x92b5('0x2e')){if(_0x222f78['destination']==_0x92b5('0x2f')){_0x222f78['destination']=extractCalleridNumber(_0x222f78[_0x92b5('0x30')]);_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x32')];_0x222f78[_0x92b5('0x33')]=[_0x222f78[_0x92b5('0x34')],_0x222f78[_0x92b5('0x34')]=_0x222f78[_0x92b5('0x33')]][0x0];_0x222f78['callerid']=_0x222f78[_0x92b5('0x30')];}else{_0x222f78[_0x92b5('0x2c')]=_0x222f78[_0x92b5('0x31')];_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x32')];if(_0x222f78['disposition']==_0x92b5('0x35')){_0x222f78[_0x92b5('0x1a')]=_0x222f78[_0x92b5('0x36')];}else{_0x222f78['accountcode']='';}}}}else{_0x222f78[_0x92b5('0x2d')]=util[_0x92b5('0x20')]('\x22%s\x22\x20<%s>',_0x222f78[_0x92b5('0x37')],_0x222f78[_0x92b5('0x31')]);}if(RpcVoiceTransferReport[_0x92b5('0x38')][_0x222f78[_0x92b5('0x39')]]){var _0x3824c0=RpcVoiceTransferReport['transfers'][_0x222f78[_0x92b5('0x39')]];_0x3824c0['transfereelinkedid']=_0x222f78[_0x92b5('0x3a')];RpcVoiceTransferReport[_0x92b5('0x18')](_0x3824c0);delete RpcVoiceTransferReport[_0x92b5('0x38')][_0x222f78[_0x92b5('0x39')]];}RpcVoiceCallReport['create'](_0x222f78);if(_0x222f78['monitor']){for(var _0x545712=0x0;_0x545712<_0x222f78[_0x92b5('0x3b')][_0x92b5('0x3c')];_0x545712+=0x1){_0x222f78[_0x92b5('0x3d')]=_0x222f78[_0x92b5('0x3b')][_0x545712][_0x92b5('0x3e')];_0x222f78[_0x92b5('0x3f')]=_0x222f78['monitors'][_0x545712][_0x92b5('0x3f')];if(_0x222f78[_0x92b5('0x26')]==_0x92b5('0x2f')){_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x36')];_0x222f78[_0x92b5('0x37')]=_0x222f78[_0x92b5('0x40')];_0x222f78['connectedlinenum']=_0x222f78[_0x92b5('0x1a')];_0x222f78[_0x92b5('0x40')]=_0x222f78['membername'];_0x222f78[_0x92b5('0x26')]=_0x222f78['originatecalleridnum'];}else if(_0x222f78[_0x92b5('0x26')]==_0x92b5('0x41')){_0x222f78[_0x92b5('0x31')]=_0x222f78[_0x92b5('0x2c')];_0x222f78['exten']=_0x222f78[_0x92b5('0x32')];}RpcVoiceRecording['create'](_0x222f78);}}};Report[_0x92b5('0xc')][_0x92b5('0x14')]=function(_0x2162e3){if(_[_0x92b5('0x42')](_0x2162e3)){_0x2162e3[_0x92b5('0x43')](function(_0x409986){RpcVoiceAgentReport[_0x92b5('0x44')](_0x409986);});}else{RpcVoiceAgentReport[_0x92b5('0x44')](_0x2162e3);}};Report['prototype']['voiceDialReport']=function(_0x5c2c89){RpcVoiceDialReport[_0x92b5('0x44')](_0x5c2c89);var _0x3b5ee3;var _0x36940b;var _0x11bb21=_0x5c2c89['channel'];if(_[_0x92b5('0x45')](_0x11bb21,'Local')){_0x36940b=_0x11bb21['substring'](_0x11bb21[_0x92b5('0x46')]('/')+0x1,_0x11bb21[_0x92b5('0x46')]('@'));_0x3b5ee3=_[_0x92b5('0x47')](this[_0x92b5('0xb')],function(_0x5e3913){return _0x5e3913['mobile']==_0x36940b||_0x5e3913[_0x92b5('0x48')]==_0x36940b||_0x5e3913[_0x92b5('0x1a')]==_0x36940b;});}else{_0x36940b=_0x11bb21[_0x92b5('0x49')](_0x11bb21['indexOf']('/')+0x1,_0x11bb21['lastIndexOf']('-'));_0x3b5ee3=this[_0x92b5('0x19')](_0x36940b);}if(_0x3b5ee3){_0x5c2c89[_0x92b5('0x1d')]=_[_0x92b5('0x1b')](_0x3b5ee3[_0x92b5('0x1d')])?util['format'](_0x92b5('0x1e'),_0x3b5ee3['name']):_0x3b5ee3['interface'];_0x5c2c89[_0x92b5('0x4a')]=_0x3b5ee3[_0x92b5('0x1c')];_0x5c2c89[_0x92b5('0x1a')]=_0x3b5ee3[_0x92b5('0x1a')];RpcMemberReport[_0x92b5('0x16')](_0x5c2c89);}};Report['prototype'][_0x92b5('0x18')]=function(_0x508aeb){RpcVoiceTransferReport[_0x92b5('0x38')][_0x508aeb[_0x92b5('0x4b')]]=_0x508aeb;};Report[_0x92b5('0xc')][_0x92b5('0x4c')]=function(_0x81882a){RpcVoiceTransferReport[_0x92b5('0x4c')](_0x81882a);};module[_0x92b5('0x4d')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 0606903..6f86c9a 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 _0x260d=['actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','agents','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','telephone:%s','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','mobile','local','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','ioredis','../../../config/logger','ami','redis','defaults','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x260d,0xc4));var _0xd260=function(_0x37e5ec,_0x22010f){_0x37e5ec=_0x37e5ec-0x0;var _0x1a1d4a=_0x260d[_0x37e5ec];return _0x1a1d4a;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xd260('0x0'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0xd260('0x1'))(_0xd260('0x2'));var ami=require('../ami');config[_0xd260('0x3')]=_[_0xd260('0x4')](config[_0xd260('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xd260('0x5'))(new Redis(config[_0xd260('0x3')]));function UserReport(_0x5d9982){this[_0xd260('0x6')]=_0x5d9982['trunks'];this['agents']=_0x5d9982['agents'];this[_0xd260('0x7')]=_0x5d9982[_0xd260('0x7')];ami['on'](_0xd260('0x8'),this[_0xd260('0x9')][_0xd260('0xa')](this));ami['on'](_0xd260('0xb'),this[_0xd260('0x9')][_0xd260('0xa')](this));ami['on']('devicestatechange',this['syncDeviceState'][_0xd260('0xa')](this));ami['on'](_0xd260('0xc'),this[_0xd260('0xd')][_0xd260('0xa')](this));return this[_0xd260('0xe')]();}function showSipRegistrations(){Promise[_0xd260('0xf')]()[_0xd260('0x10')](ami[_0xd260('0x11')]())[_0xd260('0x12')](function(_0x13027e){logger[_0xd260('0x13')]('[userReport][sipshowregistry]',util[_0xd260('0x14')](_0x13027e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd260('0xf')]()[_0xd260('0x10')](ami[_0xd260('0x15')]())[_0xd260('0x12')](function(_0x39641f){logger[_0xd260('0x13')](_0xd260('0x16'),util[_0xd260('0x14')](_0x39641f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd260('0xf')]()[_0xd260('0x10')](ami[_0xd260('0x17')]())['catch'](function(_0x40a4bf){logger[_0xd260('0x13')](_0xd260('0x18'),util[_0xd260('0x14')](_0x40a4bf,{'showHidden':![],'depth':null}));});}UserReport[_0xd260('0x19')][_0xd260('0xe')]=function(){setInterval(function(){BPromise[_0xd260('0xf')]()[_0xd260('0x10')](showSipRegistrations())['then'](listDeviceStates())[_0xd260('0x10')](showPeersStatus());},0x32c8);};UserReport[_0xd260('0x19')][_0xd260('0x1a')]=function(_0x3c2640){return _0x3c2640!==null&&!_[_0xd260('0x1b')](_0x3c2640);};UserReport['prototype'][_0xd260('0x1c')]=function(_0x1366a8,_0x304cce,_0x3f35a9){io['to'](_0x1366a8)['emit'](_0x304cce,_0x3f35a9);};UserReport[_0xd260('0x19')][_0xd260('0x9')]=function(_0x4267b1){try{if(this[_0xd260('0x1a')](_0x4267b1)){logger[_0xd260('0x1d')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x4267b1[_0xd260('0x1e')],_0x4267b1[_0xd260('0x1f')]);logger[_0xd260('0x20')](_0xd260('0x21'),util[_0xd260('0x14')](_0x4267b1,{'showHidden':![],'depth':null}));var _0x1a6fc1=_[_0xd260('0x22')](this[_0xd260('0x6')],{'registry':_0x4267b1['username']});if(_0x1a6fc1){_0x4267b1[_0xd260('0x23')]=_0x4267b1[_0xd260('0x1f')];_[_0xd260('0x24')](_0x1a6fc1,_[_0xd260('0x25')](_0x4267b1,[_0xd260('0x26'),_0xd260('0x27'),'username','state']));logger[_0xd260('0x20')](_0xd260('0x28'),util[_0xd260('0x14')](_0x1a6fc1,{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x2a'),_0x1a6fc1['name']),_0xd260('0x2b'),_0x1a6fc1);}}}catch(_0x11f6b1){logger['error'](_0xd260('0x21'),util[_0xd260('0x14')](_0x11f6b1,{'showHidden':![],'depth':null}));}};UserReport[_0xd260('0x19')][_0xd260('0x2c')]=function(_0x266b7e){try{if(this[_0xd260('0x1a')](_0x266b7e)){logger[_0xd260('0x1d')](_0xd260('0x2d'),_0x266b7e[_0xd260('0x2e')],_0x266b7e['state']);logger['debug']('[userReport][devicestatechange]',util['inspect'](_0x266b7e,{'showHidden':![],'depth':null}));if(this['agents'][_0x266b7e[_0xd260('0x2e')]]){if(!this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['local']||_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]()==_0xd260('0x31')){this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['local']=![];if(this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x1f')]!==_0x266b7e[_0xd260('0x1f')]['toLowerCase']()){this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['stateTime']=_[_0xd260('0x32')](moment()[_0xd260('0x29')]('x'));}this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]]['state']=_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]();this[_0xd260('0x2f')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x33')](_0x266b7e);}}else if(this[_0xd260('0x7')][_0x266b7e[_0xd260('0x2e')]]){if(this['telephones'][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x1f')]!==_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]()){this['telephones'][_0x266b7e['device']][_0xd260('0x34')]=_[_0xd260('0x32')](moment()['format']('x'));}this[_0xd260('0x7')][_0x266b7e['device']][_0xd260('0x1f')]=_0x266b7e[_0xd260('0x1f')]['toLowerCase']();logger[_0xd260('0x20')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xd260('0x14')](this['telephones'][_0x266b7e['device']],{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x35'),this[_0xd260('0x7')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x36')]),_0xd260('0x37'),this['telephones'][_0x266b7e[_0xd260('0x2e')]]);}else if(this[_0xd260('0x6')][_0x266b7e[_0xd260('0x2e')]]){if(this['trunks'][_0x266b7e['device']]['state']!==_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]()){this['trunks'][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x34')]=_['toNumber'](moment()[_0xd260('0x29')]('x'));}this[_0xd260('0x6')][_0x266b7e[_0xd260('0x2e')]][_0xd260('0x1f')]=_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]();logger[_0xd260('0x20')](_0xd260('0x38'),util[_0xd260('0x14')](this[_0xd260('0x6')][_0x266b7e[_0xd260('0x2e')]],{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x2a'),this[_0xd260('0x6')][_0x266b7e['device']][_0xd260('0x36')]),_0xd260('0x2b'),this[_0xd260('0x6')][_0x266b7e['device']]);}else if(_['startsWith'](_0x266b7e[_0xd260('0x2e')],_0xd260('0x39'))){var _0x2cdbd8=_0x266b7e[_0xd260('0x2e')];var _0x4b3efc=_0x2cdbd8[_0xd260('0x3a')](_0x2cdbd8[_0xd260('0x3b')]('/')+0x1,_0x2cdbd8[_0xd260('0x3b')]('@'));var _0x27105e=_['find'](this[_0xd260('0x2f')],function(_0x32edb0){return _0x32edb0[_0xd260('0x3c')]==_0x4b3efc||_0x32edb0['phone']==_0x4b3efc||_0x32edb0['accountcode']==_0x4b3efc;});if(_0x27105e){if(_0x27105e[_0xd260('0x1f')]!==_0x266b7e[_0xd260('0x1f')]['toLowerCase']()){_0x27105e[_0xd260('0x34')]=_[_0xd260('0x32')](moment()[_0xd260('0x29')]('x'));}_0x27105e[_0xd260('0x1f')]=_0x266b7e[_0xd260('0x1f')][_0xd260('0x30')]();_0x27105e[_0xd260('0x3d')]=!![];_0x27105e[_0xd260('0x33')](_0x266b7e);}}}}catch(_0x49db7c){logger[_0xd260('0x13')]('[userReport][devicestatechange]',util[_0xd260('0x14')](_0x49db7c,{'showHidden':![],'depth':null}));}};UserReport[_0xd260('0x19')]['syncPeerStatus']=function(_0x1baf2f){try{if(this[_0xd260('0x1a')](_0x1baf2f)&&this[_0xd260('0x1a')](_0x1baf2f[_0xd260('0xc')])){logger[_0xd260('0x1d')](_0xd260('0x3e'),_0x1baf2f[_0xd260('0x3f')],_0x1baf2f['address'],_0x1baf2f[_0xd260('0xc')]);logger[_0xd260('0x20')](_0xd260('0x40'),util[_0xd260('0x14')](_0x1baf2f,{'showHidden':![],'depth':null}));if(this[_0xd260('0x2f')][_0x1baf2f['peer']]){if(!this[_0xd260('0x2f')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x3d')]||_0x1baf2f[_0xd260('0xc')][_0xd260('0x30')]()==_0xd260('0x41')){this[_0xd260('0x2f')][_0x1baf2f['peer']]['local']=![];this[_0xd260('0x2f')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x42')]=_0x1baf2f[_0xd260('0xc')]['toLowerCase']();this['agents'][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x43')]=_0x1baf2f[_0xd260('0x43')];this[_0xd260('0x2f')][_0x1baf2f['peer']][_0xd260('0x33')](_0x1baf2f);}}else if(this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]]){this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x42')]=_0x1baf2f[_0xd260('0xc')][_0xd260('0x30')]();this['telephones'][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x43')]=_0x1baf2f[_0xd260('0x43')];logger[_0xd260('0x20')](_0xd260('0x44'),util['inspect'](this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]],{'showHidden':![],'depth':null}));this[_0xd260('0x1c')](util[_0xd260('0x29')](_0xd260('0x35'),this['telephones'][_0x1baf2f[_0xd260('0x3f')]]['name']),'telephone:save',this[_0xd260('0x7')][_0x1baf2f[_0xd260('0x3f')]]);}else if(this[_0xd260('0x6')][_0x1baf2f[_0xd260('0x3f')]]){this['trunks'][_0x1baf2f['peer']][_0xd260('0x42')]=_0x1baf2f[_0xd260('0xc')][_0xd260('0x30')]();this[_0xd260('0x6')][_0x1baf2f[_0xd260('0x3f')]][_0xd260('0x43')]=_0x1baf2f['address'];logger[_0xd260('0x20')](_0xd260('0x45'),util[_0xd260('0x14')](this[_0xd260('0x6')][_0x1baf2f['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xd260('0x29')](_0xd260('0x2a'),this['trunks'][_0x1baf2f['peer']][_0xd260('0x36')]),_0xd260('0x2b'),this[_0xd260('0x6')][_0x1baf2f[_0xd260('0x3f')]]);}}}catch(_0x5eb5a4){logger[_0xd260('0x13')](_0xd260('0x40'),util[_0xd260('0x14')](_0x5eb5a4,{'showHidden':![],'depth':null}));}};module[_0xd260('0x46')]=UserReport; \ No newline at end of file +var _0x7409=['[userReport][registry]','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:save','startsWith','Local','indexOf','find','mobile','accountcode','syncPeerStatus','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','catch','[userReport][sipshowregistry]','resolve','then','actionDeviceStateList','error','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug'];(function(_0x3be3f7,_0x22fff7){var _0x28205b=function(_0x35bc16){while(--_0x35bc16){_0x3be3f7['push'](_0x3be3f7['shift']());}};_0x28205b(++_0x22fff7);}(_0x7409,0x6e));var _0x9740=function(_0x3938d2,_0x8e9793){_0x3938d2=_0x3938d2-0x0;var _0x45513c=_0x7409[_0x3938d2];return _0x45513c;};'use strict';var _=require(_0x9740('0x0'));var moment=require(_0x9740('0x1'));var util=require('util');var Redis=require(_0x9740('0x2'));var BPromise=require(_0x9740('0x3'));var config=require(_0x9740('0x4'));var logger=require(_0x9740('0x5'))(_0x9740('0x6'));var ami=require(_0x9740('0x7'));config[_0x9740('0x8')]=_[_0x9740('0x9')](config[_0x9740('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9740('0xa'))(new Redis(config[_0x9740('0x8')]));function UserReport(_0x2929cd){this['trunks']=_0x2929cd[_0x9740('0xb')];this[_0x9740('0xc')]=_0x2929cd[_0x9740('0xc')];this['telephones']=_0x2929cd[_0x9740('0xd')];ami['on']('registryentry',this[_0x9740('0xe')][_0x9740('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0x9740('0x10'),this[_0x9740('0x11')][_0x9740('0xf')](this));ami['on']('peerstatus',this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x9740('0x12')](function(_0x4d50ad){logger['error'](_0x9740('0x13'),util['inspect'](_0x4d50ad,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9740('0x14')]()[_0x9740('0x15')](ami[_0x9740('0x16')]())[_0x9740('0x12')](function(_0x480af9){logger[_0x9740('0x17')]('[userReport][devicestatelist]',util[_0x9740('0x18')](_0x480af9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9740('0x14')]()[_0x9740('0x15')](ami[_0x9740('0x19')]())[_0x9740('0x12')](function(_0xa6cedd){logger[_0x9740('0x17')](_0x9740('0x1a'),util[_0x9740('0x18')](_0xa6cedd,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x9740('0x1b')]=function(){setInterval(function(){BPromise[_0x9740('0x14')]()[_0x9740('0x15')](showSipRegistrations())[_0x9740('0x15')](listDeviceStates())[_0x9740('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x9740('0x1c')][_0x9740('0x1d')]=function(_0x146070){return _0x146070!==null&&!_['isUndefined'](_0x146070);};UserReport[_0x9740('0x1c')]['emit']=function(_0x1f8a78,_0x46d768,_0x1af88e){io['to'](_0x1f8a78)[_0x9740('0x1e')](_0x46d768,_0x1af88e);};UserReport[_0x9740('0x1c')][_0x9740('0xe')]=function(_0x4e4627){try{if(this[_0x9740('0x1d')](_0x4e4627)){logger[_0x9740('0x1f')](_0x9740('0x20'),_0x4e4627[_0x9740('0x21')],_0x4e4627[_0x9740('0x22')]);logger[_0x9740('0x23')](_0x9740('0x24'),util[_0x9740('0x18')](_0x4e4627,{'showHidden':![],'depth':null}));var _0x11ee90=_['find'](this[_0x9740('0xb')],{'registry':_0x4e4627['username']});if(_0x11ee90){_0x4e4627['stateRegistry']=_0x4e4627['state'];_['merge'](_0x11ee90,_[_0x9740('0x25')](_0x4e4627,[_0x9740('0x26'),_0x9740('0x27'),'username',_0x9740('0x22')]));logger[_0x9740('0x23')](_0x9740('0x28'),util[_0x9740('0x18')](_0x11ee90,{'showHidden':![],'depth':null}));this['emit'](util[_0x9740('0x29')](_0x9740('0x2a'),_0x11ee90[_0x9740('0x2b')]),'trunk:save',_0x11ee90);}}}catch(_0x248577){logger[_0x9740('0x17')](_0x9740('0x24'),util[_0x9740('0x18')](_0x248577,{'showHidden':![],'depth':null}));}};UserReport[_0x9740('0x1c')][_0x9740('0x11')]=function(_0xe05d10){try{if(this[_0x9740('0x1d')](_0xe05d10)){logger[_0x9740('0x1f')](_0x9740('0x2c'),_0xe05d10['device'],_0xe05d10[_0x9740('0x22')]);logger[_0x9740('0x23')](_0x9740('0x2d'),util[_0x9740('0x18')](_0xe05d10,{'showHidden':![],'depth':null}));if(this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]]){if(!this['agents'][_0xe05d10[_0x9740('0x2e')]]['local']||_0xe05d10['state'][_0x9740('0x2f')]()==_0x9740('0x30')){this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x31')]=![];if(this['agents'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]!==_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]()){this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]=_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]();this[_0x9740('0xc')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x34')](_0xe05d10);}}else if(this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]]){if(this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]!==_0xe05d10['state'][_0x9740('0x2f')]()){this['telephones'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]=_0xe05d10['state']['toLowerCase']();logger['debug'](_0x9740('0x35'),util[_0x9740('0x18')](this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]],{'showHidden':![],'depth':null}));this[_0x9740('0x1e')](util['format'](_0x9740('0x36'),this[_0x9740('0xd')][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x2b')]),_0x9740('0x37'),this[_0x9740('0xd')][_0xe05d10['device']]);}else if(this[_0x9740('0xb')][_0xe05d10[_0x9740('0x2e')]]){if(this[_0x9740('0xb')][_0xe05d10['device']]['state']!==_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]()){this[_0x9740('0xb')][_0xe05d10['device']][_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}this['trunks'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x22')]=_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]();logger[_0x9740('0x23')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x9740('0x18')](this[_0x9740('0xb')][_0xe05d10[_0x9740('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9740('0x29')](_0x9740('0x2a'),this['trunks'][_0xe05d10[_0x9740('0x2e')]][_0x9740('0x2b')]),_0x9740('0x38'),this[_0x9740('0xb')][_0xe05d10['device']]);}else if(_[_0x9740('0x39')](_0xe05d10[_0x9740('0x2e')],_0x9740('0x3a'))){var _0xa7ee56=_0xe05d10[_0x9740('0x2e')];var _0x1141c3=_0xa7ee56['substring'](_0xa7ee56[_0x9740('0x3b')]('/')+0x1,_0xa7ee56[_0x9740('0x3b')]('@'));var _0x3a8935=_[_0x9740('0x3c')](this['agents'],function(_0x16d114){return _0x16d114[_0x9740('0x3d')]==_0x1141c3||_0x16d114['phone']==_0x1141c3||_0x16d114[_0x9740('0x3e')]==_0x1141c3;});if(_0x3a8935){if(_0x3a8935[_0x9740('0x22')]!==_0xe05d10[_0x9740('0x22')]['toLowerCase']()){_0x3a8935[_0x9740('0x32')]=_[_0x9740('0x33')](moment()[_0x9740('0x29')]('x'));}_0x3a8935[_0x9740('0x22')]=_0xe05d10[_0x9740('0x22')][_0x9740('0x2f')]();_0x3a8935['local']=!![];_0x3a8935[_0x9740('0x34')](_0xe05d10);}}}}catch(_0x373ecc){logger[_0x9740('0x17')](_0x9740('0x2d'),util['inspect'](_0x373ecc,{'showHidden':![],'depth':null}));}};UserReport[_0x9740('0x1c')][_0x9740('0x3f')]=function(_0x41f7cb){try{if(this['isNotNull'](_0x41f7cb)&&this['isNotNull'](_0x41f7cb[_0x9740('0x40')])){logger[_0x9740('0x1f')](_0x9740('0x41'),_0x41f7cb['peer'],_0x41f7cb[_0x9740('0x42')],_0x41f7cb['peerstatus']);logger[_0x9740('0x23')](_0x9740('0x43'),util[_0x9740('0x18')](_0x41f7cb,{'showHidden':![],'depth':null}));if(this[_0x9740('0xc')][_0x41f7cb[_0x9740('0x44')]]){if(!this[_0x9740('0xc')][_0x41f7cb['peer']][_0x9740('0x31')]||_0x41f7cb[_0x9740('0x40')][_0x9740('0x2f')]()==_0x9740('0x45')){this[_0x9740('0xc')][_0x41f7cb['peer']][_0x9740('0x31')]=![];this['agents'][_0x41f7cb['peer']]['status']=_0x41f7cb[_0x9740('0x40')][_0x9740('0x2f')]();this[_0x9740('0xc')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x42')]=_0x41f7cb[_0x9740('0x42')];this[_0x9740('0xc')][_0x41f7cb['peer']][_0x9740('0x34')](_0x41f7cb);}}else if(this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]]){this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x46')]=_0x41f7cb[_0x9740('0x40')]['toLowerCase']();this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]]['address']=_0x41f7cb[_0x9740('0x42')];logger['debug'](_0x9740('0x47'),util[_0x9740('0x18')](this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]],{'showHidden':![],'depth':null}));this[_0x9740('0x1e')](util['format'](_0x9740('0x36'),this[_0x9740('0xd')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x2b')]),_0x9740('0x37'),this[_0x9740('0xd')][_0x41f7cb['peer']]);}else if(this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]]){this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x46')]=_0x41f7cb[_0x9740('0x40')][_0x9740('0x2f')]();this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]][_0x9740('0x42')]=_0x41f7cb[_0x9740('0x42')];logger[_0x9740('0x23')](_0x9740('0x48'),util[_0x9740('0x18')](this['trunks'][_0x41f7cb['peer']],{'showHidden':![],'depth':null}));this[_0x9740('0x1e')](util[_0x9740('0x29')](_0x9740('0x2a'),this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]]['name']),'trunk:save',this[_0x9740('0xb')][_0x41f7cb[_0x9740('0x44')]]);}}}catch(_0x4daf9d){logger[_0x9740('0x17')](_0x9740('0x43'),util[_0x9740('0x18')](_0x4daf9d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7e02121..d9a6c63 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 _0x7f96=['[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','moment','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','interface','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:'];(function(_0x4af23c,_0x50e294){var _0x194b63=function(_0x44f871){while(--_0x44f871){_0x4af23c['push'](_0x4af23c['shift']());}};_0x194b63(++_0x50e294);}(_0x7f96,0x8e));var _0x67f9=function(_0x3721d5,_0x42464b){_0x3721d5=_0x3721d5-0x0;var _0x102217=_0x7f96[_0x3721d5];return _0x102217;};'use strict';var _=require('lodash');var moment=require(_0x67f9('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x67f9('0x1'));var logger=require(_0x67f9('0x2'))('ami');var ami=require(_0x67f9('0x3'));config[_0x67f9('0x4')]=_['defaults'](config[_0x67f9('0x4')],{'host':_0x67f9('0x5'),'port':0x18eb});var io=require(_0x67f9('0x6'))(new Redis(config[_0x67f9('0x4')]));function VoiceAgentReport(_0x289355){this[_0x67f9('0x7')]={};this['voiceQueues']=_0x289355[_0x67f9('0x8')];this[_0x67f9('0x9')]=_0x289355[_0x67f9('0x9')];this[_0x67f9('0xa')]={};ami['on']('agentcalled',this[_0x67f9('0xb')][_0x67f9('0xc')](this));ami['on'](_0x67f9('0xd'),this[_0x67f9('0xe')][_0x67f9('0xc')](this));ami['on'](_0x67f9('0xf'),this['syncAgentRingNoAnswer'][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x10'),this[_0x67f9('0x11')][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x12'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this[_0x67f9('0x13')][_0x67f9('0xc')](this));ami['on']('hangup',this['syncHangup'][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x14'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x67f9('0x15'),this[_0x67f9('0x16')][_0x67f9('0xc')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x67f9('0xc')](this));ami['on'](_0x67f9('0x17'),this[_0x67f9('0x18')][_0x67f9('0xc')](this));}VoiceAgentReport[_0x67f9('0x19')]['emit']=function(_0x61cab8,_0x4c9f2f,_0x22779c){io['to'](_0x61cab8)[_0x67f9('0x1a')](_0x4c9f2f,_0x22779c);};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x1b')]=function(_0xa9c4fa){return _0xa9c4fa!==null&&!_[_0x67f9('0x1c')](_0xa9c4fa);};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0xb')]=function(_0x1d7b19){try{if(this[_0x67f9('0x1b')](_0x1d7b19)){logger[_0x67f9('0x1d')](_0x67f9('0x1e'),_0x1d7b19[_0x67f9('0x1f')],_0x1d7b19[_0x67f9('0x20')],_0x1d7b19[_0x67f9('0x21')]);logger['debug'](_0x67f9('0x22'),_0x1d7b19[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x1d7b19,{'showHidden':![],'depth':null}));if(_[_0x67f9('0x1c')](this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]])){this[_0x67f9('0x7')][_0x1d7b19['uniqueid']]={};}if(_['isUndefined'](this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]][_0x1d7b19['destuniqueid']])){this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]][_0x1d7b19[_0x67f9('0x21')]]={'agentcalledAt':moment()['format'](_0x67f9('0x24')),'lastevent':_0x67f9('0x25'),'mandatoryDisposition':this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]]?this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]][_0x67f9('0x27')]||![]:![],'type':this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]]?this[_0x67f9('0x8')][_0x1d7b19[_0x67f9('0x26')]][_0x67f9('0x28')]||_0x67f9('0x29'):_0x67f9('0x29'),'variables':this[_0x67f9('0xa')][_0x1d7b19[_0x67f9('0x1f')]]};}_[_0x67f9('0x2a')](this[_0x67f9('0x7')][_0x1d7b19['uniqueid']][_0x1d7b19['destuniqueid']],_[_0x67f9('0x2b')](_0x1d7b19,[_0x67f9('0x2c'),_0x67f9('0x2d')]));logger[_0x67f9('0x2e')](_0x67f9('0x2f'),_0x1d7b19[_0x67f9('0x1f')],util[_0x67f9('0x23')](this['channels'][_0x1d7b19['uniqueid']][_0x1d7b19[_0x67f9('0x21')]],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:agentcalled',this['channels'][_0x1d7b19['uniqueid']][_0x1d7b19[_0x67f9('0x21')]]);logger[_0x67f9('0x2e')](_0x67f9('0x30'),_0x1d7b19['uniqueid'],util[_0x67f9('0x23')](this[_0x67f9('0x7')][_0x1d7b19[_0x67f9('0x1f')]][_0x1d7b19[_0x67f9('0x21')]],{'showHidden':![],'depth':null}));this[_0x67f9('0x1a')](util[_0x67f9('0x31')](_0x67f9('0x32'),_0x1d7b19['membername']),_0x67f9('0x33'),this['channels'][_0x1d7b19['uniqueid']][_0x1d7b19[_0x67f9('0x21')]]);}}catch(_0x16f8ec){logger[_0x67f9('0x34')](_0x67f9('0x35'),_0x1d7b19[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x16f8ec,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0xe')]=function(_0x18a63a){try{if(this[_0x67f9('0x1b')](_0x18a63a)){if(this['channels'][_0x18a63a[_0x67f9('0x1f')]]){logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x18a63a[_0x67f9('0x1f')],util['inspect'](_0x18a63a,{'showHidden':![],'depth':null}));for(var _0x574995 in this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]]){if(this[_0x67f9('0x7')][_0x18a63a['uniqueid']][_0x67f9('0x36')](_0x574995)){if(_0x18a63a[_0x67f9('0x21')]===_0x574995){logger['info'](_0x67f9('0x37'),_0x18a63a[_0x67f9('0x1f')],_0x18a63a[_0x67f9('0x20')],_0x18a63a[_0x67f9('0x21')]);this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x38')]=moment()['format'](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['connectedlinename']=_0x18a63a[_0x67f9('0x39')];this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x3a')]=_0x18a63a['connectedlinenum'];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['destchannelstate']=_0x18a63a['destchannelstate'];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x3b')]=_0x18a63a[_0x67f9('0x3b')];this['channels'][_0x18a63a['uniqueid']][_0x574995][_0x67f9('0x3c')]=_0x18a63a['holdtime'];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x3d')]='connect';_[_0x67f9('0x2a')](this[_0x67f9('0x9')][_0x18a63a['interface']],_[_0x67f9('0x3e')](_0x18a63a,['queue','destconnectedlinenum']));logger[_0x67f9('0x2e')](_0x67f9('0x3f'),_0x18a63a[_0x67f9('0x1f')],util[_0x67f9('0x23')](this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x18a63a[_0x67f9('0x21')]],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:agentconnect',this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x18a63a[_0x67f9('0x21')]]);logger[_0x67f9('0x2e')](_0x67f9('0x40'),_0x18a63a[_0x67f9('0x1f')],util['inspect'](this[_0x67f9('0x7')][_0x18a63a['uniqueid']][_0x18a63a['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x67f9('0x1a')](util[_0x67f9('0x31')](_0x67f9('0x32'),_0x18a63a[_0x67f9('0x20')]),'user:agentconnect',this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x18a63a[_0x67f9('0x21')]]);}else if(!this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0xf')]&&!this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['agentcomplete']){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x18a63a[_0x67f9('0x1f')],this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x20')],_0x574995);this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0xf')]=!![];this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x41')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x18a63a['uniqueid']][_0x574995]['answeredelsewheredestinationuniqueid']=_0x18a63a['destuniqueid'];this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x42')]=_0x18a63a[_0x67f9('0x20')];this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]['lastevent']=_0x67f9('0x43');this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995][_0x67f9('0x44')]=_0x67f9('0x43');logger[_0x67f9('0x2e')](_0x67f9('0x45'),_0x18a63a[_0x67f9('0x1f')],util['inspect'](this['channels'][_0x18a63a[_0x67f9('0x1f')]][_0x574995],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')](_0x67f9('0x46'),this[_0x67f9('0x7')][_0x18a63a[_0x67f9('0x1f')]][_0x574995]);}}}}}}catch(_0x470bd6){logger['error'](_0x67f9('0x47'),_0x18a63a[_0x67f9('0x1f')],util['inspect'](_0x470bd6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')]['syncAgentRingNoAnswer']=function(_0xea4d6){try{if(this[_0x67f9('0x1b')](_0xea4d6)){logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0xea4d6[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0xea4d6,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]]&&this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]]){logger[_0x67f9('0x1d')](_0x67f9('0x48'),_0xea4d6[_0x67f9('0x1f')],_0xea4d6['membername'],_0xea4d6[_0x67f9('0x21')]);this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]][_0x67f9('0xf')]=!![];this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6['destuniqueid']][_0x67f9('0x41')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]][_0x67f9('0x3d')]='rejected';this[_0x67f9('0x7')][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6[_0x67f9('0x21')]][_0x67f9('0x44')]=_0x67f9('0x49');logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xea4d6[_0x67f9('0x1f')],util[_0x67f9('0x23')](this['channels'][_0xea4d6[_0x67f9('0x1f')]][_0xea4d6['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')](_0x67f9('0x4a'),this[_0x67f9('0x7')][_0xea4d6['uniqueid']][_0xea4d6[_0x67f9('0x21')]]);}}}catch(_0x4bfdc7){logger[_0x67f9('0x34')](_0x67f9('0x4b'),_0xea4d6[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x4bfdc7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')]['syncQueueCallerAbandon']=function(_0x51a4f9){try{if(this[_0x67f9('0x1b')](_0x51a4f9)){logger[_0x67f9('0x2e')](_0x67f9('0x4c'),_0x51a4f9['uniqueid'],util[_0x67f9('0x23')](_0x51a4f9,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]]){for(var _0x37bfa6 in this[_0x67f9('0x7')][_0x51a4f9['uniqueid']]){if(this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x67f9('0x36')](_0x37bfa6)&&!this['channels'][_0x51a4f9['uniqueid']][_0x37bfa6]['agentringnoanswer']&&!this[_0x67f9('0x7')][_0x51a4f9['uniqueid']][_0x37bfa6]['agentcomplete']){logger[_0x67f9('0x1d')](_0x67f9('0x4d'),_0x51a4f9[_0x67f9('0x1f')],this['channels'][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6][_0x67f9('0x20')],_0x37bfa6);this[_0x67f9('0x7')][_0x51a4f9['uniqueid']][_0x37bfa6]['agentringnoanswer']=!![];this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6][_0x67f9('0x41')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6]['lastevent']=_0x67f9('0x4e');this[_0x67f9('0x7')][_0x51a4f9['uniqueid']][_0x37bfa6]['reason']='abandoned';logger[_0x67f9('0x2e')](_0x67f9('0x4f'),_0x51a4f9['uniqueid'],util['inspect'](this[_0x67f9('0x7')][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6],{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:agentqueuecallerabandon',this['channels'][_0x51a4f9[_0x67f9('0x1f')]][_0x37bfa6]);}}}}}catch(_0x2dce85){logger['error'](_0x67f9('0x50'),_0x51a4f9[_0x67f9('0x1f')],util['inspect'](_0x2dce85,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')]['syncAgentComplete']=function(_0x130856){try{if(this[_0x67f9('0x1b')](_0x130856)){logger['debug'](_0x67f9('0x51'),_0x130856[_0x67f9('0x1f')],util['inspect'](_0x130856,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]]){for(var _0x338092 in this['channels'][_0x130856[_0x67f9('0x1f')]]){if(this['channels'][_0x130856[_0x67f9('0x1f')]][_0x67f9('0x36')](_0x338092)){if(this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x38')]&&!this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x12')]){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x130856[_0x67f9('0x1f')],this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x20')],_0x338092);this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x12')]=!![];this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x52')]=moment()['format'](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x3d')]=_0x67f9('0x53');this['channels'][_0x130856['uniqueid']][_0x338092][_0x67f9('0x44')]=_0x130856[_0x67f9('0x44')]==_0x67f9('0x54')?_0x67f9('0x55'):_0x130856['reason'];this['channels'][_0x130856[_0x67f9('0x1f')]][_0x338092][_0x67f9('0x56')]=_0x130856[_0x67f9('0x56')];if(this[_0x67f9('0x8')][_0x130856[_0x67f9('0x26')]]&&this[_0x67f9('0x8')][_0x130856[_0x67f9('0x26')]][_0x67f9('0x57')]){this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]['acwtime']=this[_0x67f9('0x8')][_0x130856[_0x67f9('0x26')]]['acwTimeout'];this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]['agentacw']=!![];}this[_0x67f9('0x9')][_0x130856[_0x67f9('0x58')]]=_[_0x67f9('0x2b')](this[_0x67f9('0x9')][_0x130856['interface']],['queue','destconnectedlinenum']);logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x130856[_0x67f9('0x1f')],util['inspect'](this[_0x67f9('0x7')][_0x130856['uniqueid']][_0x338092],{'showHidden':![],'depth':null}));ami['emit'](_0x67f9('0x59'),this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]);logger[_0x67f9('0x2e')](_0x67f9('0x5a'),_0x130856['uniqueid'],util[_0x67f9('0x23')](this[_0x67f9('0x7')][_0x130856['uniqueid']][_0x338092],{'showHidden':![],'depth':null}));this[_0x67f9('0x1a')](util[_0x67f9('0x31')]('user:%s',_0x130856[_0x67f9('0x20')]),_0x67f9('0x5b'),this[_0x67f9('0x7')][_0x130856[_0x67f9('0x1f')]][_0x338092]);}}}}}}catch(_0x106180){logger[_0x67f9('0x34')]('[%s][voiceAgentReport][agentcomplete]',_0x130856[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x106180,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x13')]=function(_0x5dbf8c){try{if(this['isNotNull'](_0x5dbf8c)){logger[_0x67f9('0x2e')]('[%s][voiceAgentReport][varset]\x20event:',_0x5dbf8c[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x5dbf8c,{'showHidden':![],'depth':null}));this[_0x67f9('0x5c')](_0x5dbf8c[_0x67f9('0x1f')],_[_0x67f9('0x5d')](_0x5dbf8c[_0x67f9('0x5e')])[0x0],_0x5dbf8c[_0x67f9('0x5f')]);if(this[_0x67f9('0x7')][_0x5dbf8c['uniqueid']]){for(var _0x595b4d in this[_0x67f9('0x7')][_0x5dbf8c[_0x67f9('0x1f')]]){if(this[_0x67f9('0x7')][_0x5dbf8c[_0x67f9('0x1f')]][_0x67f9('0x36')](_0x595b4d)){logger[_0x67f9('0x1d')](_0x67f9('0x60'),_0x5dbf8c[_0x67f9('0x1f')],_0x595b4d,_['keys'](_0x5dbf8c['variable'])[0x0],_0x5dbf8c[_0x67f9('0x5f')]);if(_[_0x67f9('0x1c')](this[_0x67f9('0x7')][_0x5dbf8c['uniqueid']][_0x595b4d][_0x67f9('0xa')])){this[_0x67f9('0x7')][_0x5dbf8c['uniqueid']][_0x595b4d][_0x67f9('0xa')]={};}this[_0x67f9('0x7')][_0x5dbf8c[_0x67f9('0x1f')]][_0x595b4d][_0x67f9('0xa')]=this[_0x67f9('0xa')][_0x5dbf8c[_0x67f9('0x1f')]];}}}}}catch(_0x5f4f38){logger[_0x67f9('0x34')](_0x67f9('0x61'),_0x5dbf8c[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x5f4f38,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x5c')]=function(_0x47e838,_0x9ac780,_0x3c4bc4){var _0xd59a62=['rtpaudioqos','rtpaudioqosbridged',_0x67f9('0x62'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x67f9('0x63'),_0x67f9('0x64'),_0x67f9('0x65'),_0x67f9('0x66'),_0x67f9('0x67'),_0x67f9('0x68'),_0x67f9('0x69'),_0x67f9('0x6a'),_0x67f9('0x6b'),_0x67f9('0x6c'),_0x67f9('0x6d'),'membername','memberpenalty',_0x67f9('0x6e')];if(!_[_0x67f9('0x6f')](_0x9ac780)&&!_['includes'](_0xd59a62,_0x9ac780)){if(_['isUndefined'](this[_0x67f9('0xa')][_0x47e838])){this['variables'][_0x47e838]={};}this[_0x67f9('0xa')][_0x47e838][_0x9ac780]=_0x3c4bc4;}};VoiceAgentReport[_0x67f9('0x19')]['syncHangup']=function(_0x79ebe2){try{if(this[_0x67f9('0x1b')](_0x79ebe2)){logger[_0x67f9('0x2e')](_0x67f9('0x70'),_0x79ebe2[_0x67f9('0x1f')],util['inspect'](_0x79ebe2,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]]){for(var _0x3a42b7 in this['channels'][_0x79ebe2[_0x67f9('0x1f')]]){if(this[_0x67f9('0x7')][_0x79ebe2['uniqueid']]['hasOwnProperty'](_0x3a42b7)){if(this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]][_0x3a42b7][_0x67f9('0x44')]==_0x67f9('0x54')&&this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]][_0x3a42b7][_0x67f9('0x12')]){logger['info'](_0x67f9('0x71'),_0x79ebe2[_0x67f9('0x1f')],_0x3a42b7);this[_0x67f9('0x7')][_0x79ebe2['uniqueid']][_0x3a42b7][_0x67f9('0x52')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));}}}logger[_0x67f9('0x2e')](_0x67f9('0x72'),_0x79ebe2[_0x67f9('0x1f')],util[_0x67f9('0x23')](_['values'](this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]]),{'showHidden':![],'depth':null}));ami[_0x67f9('0x1a')]('custom:voiceAgentReport',_[_0x67f9('0x73')](this[_0x67f9('0x7')][_0x79ebe2['uniqueid']]));delete this[_0x67f9('0x7')][_0x79ebe2[_0x67f9('0x1f')]];}if(this[_0x67f9('0xa')][_0x79ebe2[_0x67f9('0x1f')]]){delete this['variables'][_0x79ebe2['uniqueid']];}}}catch(_0xd643c0){logger[_0x67f9('0x34')]('[%s][voiceAgentReport][hangup]',_0x79ebe2[_0x67f9('0x1f')],util['inspect'](_0xd643c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67f9('0x74')]=function(_0x369fae){try{if(this[_0x67f9('0x1b')](_0x369fae)){logger[_0x67f9('0x2e')](_0x67f9('0x75'),_0x369fae[_0x67f9('0x1f')],util['inspect'](_0x369fae,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]]){for(var _0x22b68c in this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]]){if(this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x67f9('0x36')](_0x22b68c)){if(_0x369fae[_0x67f9('0x77')]===_0x22b68c){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x369fae[_0x67f9('0x1f')],this[_0x67f9('0x7')][_0x369fae['transfereeuniqueid']][_0x22b68c]['membername'],_0x22b68c);var _0x5802b6=moment();this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x12')]=!![];this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x52')]=moment()[_0x67f9('0x31')](_0x67f9('0x24'));this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c]['lastevent']=_0x67f9('0x53');this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x44')]=_0x67f9('0x54');this[_0x67f9('0x7')][_0x369fae['transfereeuniqueid']][_0x22b68c][_0x67f9('0x56')]=_0x5802b6[_0x67f9('0x78')](this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x76')]][_0x22b68c][_0x67f9('0x38')],_0x67f9('0x79'));}}}}if(this[_0x67f9('0x7')][_0x369fae['secondtransfereruniqueid']]){var _0x5363de=this[_0x67f9('0x7')][_0x369fae[_0x67f9('0x7a')]];this['channels'][_0x369fae[_0x67f9('0x7a')]]=this[_0x67f9('0x7')][_0x369fae['transfereeuniqueid']];this['channels'][_0x369fae[_0x67f9('0x76')]]=_0x5363de;}}}catch(_0x2217ba){logger[_0x67f9('0x34')](_0x67f9('0x7b'),_0x369fae[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x2217ba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67f9('0x19')][_0x67f9('0x18')]=function(_0x1aada2){try{if(this['isNotNull'](_0x1aada2)){logger[_0x67f9('0x2e')](_0x67f9('0x7c'),_0x1aada2[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x1aada2,{'showHidden':![],'depth':null}));if(this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]]){for(var _0xad2920 in this['channels'][_0x1aada2[_0x67f9('0x76')]]){if(this[_0x67f9('0x7')][_0x1aada2['transfereeuniqueid']][_0x67f9('0x36')](_0xad2920)){if(_0x1aada2[_0x67f9('0x7d')]===_0xad2920){logger[_0x67f9('0x1d')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1aada2[_0x67f9('0x1f')],this['channels'][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x20')],_0xad2920);var _0x3529ec=moment();this[_0x67f9('0x7')][_0x1aada2['transfereeuniqueid']][_0xad2920][_0x67f9('0x12')]=!![];this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920]['agentcompleteAt']=_0x3529ec;this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x3d')]='complete';this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x44')]=_0x67f9('0x54');this['channels'][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x56')]=_0x3529ec['diff'](this[_0x67f9('0x7')][_0x1aada2[_0x67f9('0x76')]][_0xad2920][_0x67f9('0x38')],'seconds');}}}}}}catch(_0x3c03d4){logger[_0x67f9('0x34')](_0x67f9('0x7e'),_0x1aada2[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x3c03d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67f9('0x7f')]=function(_0x1b8315){var _0x374b73='';try{if(this[_0x67f9('0x1b')](_0x1b8315)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1b8315[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x1b8315,{'showHidden':![],'depth':null}));if(_0x1b8315['channel']){_0x374b73=_0x1b8315[_0x67f9('0x80')][_0x67f9('0x81')](0x0,_0x1b8315['channel'][_0x67f9('0x82')]('-'));if(this[_0x67f9('0x9')][_0x374b73]){logger[_0x67f9('0x1d')](_0x67f9('0x83'),_0x1b8315[_0x67f9('0x1f')],_0x374b73);this[_0x67f9('0x9')][_0x374b73]['onhold']=!![];}}}}catch(_0x15a347){logger[_0x67f9('0x34')](_0x67f9('0x84'),_0x1b8315[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0x15a347,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67f9('0x16')]=function(_0xbc4e4f){var _0x195456='';try{if(this[_0x67f9('0x1b')](_0xbc4e4f)){logger['debug'](_0x67f9('0x85'),_0xbc4e4f[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0xbc4e4f,{'showHidden':![],'depth':null}));if(_0xbc4e4f[_0x67f9('0x80')]){_0x195456=_0xbc4e4f[_0x67f9('0x80')][_0x67f9('0x81')](0x0,_0xbc4e4f['channel'][_0x67f9('0x82')]('-'));if(this['agents'][_0x195456]){logger[_0x67f9('0x1d')](_0x67f9('0x86'),_0xbc4e4f[_0x67f9('0x1f')],_0x195456);this[_0x67f9('0x9')][_0x195456][_0x67f9('0x87')]=![];}}}}catch(_0xe2ffd6){logger['error'](_0x67f9('0x88'),_0xbc4e4f[_0x67f9('0x1f')],util[_0x67f9('0x23')](_0xe2ffd6,{'showHidden':![],'depth':null}));}};module[_0x67f9('0x89')]=VoiceAgentReport; \ No newline at end of file +var _0xb611=['agentringnoanswerAt','answeredelsewheredestinationuniqueid','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','transfereruniqueid','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','voiceQueues','agents','variables','agentcalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','called','queue','mandatoryDisposition','type','inbound','omit','privilege','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete'];(function(_0x2a1fd6,_0xc8e818){var _0x186896=function(_0x30bbd5){while(--_0x30bbd5){_0x2a1fd6['push'](_0x2a1fd6['shift']());}};_0x186896(++_0xc8e818);}(_0xb611,0x171));var _0x1b61=function(_0x209302,_0x5826ac){_0x209302=_0x209302-0x0;var _0x1df8e9=_0xb611[_0x209302];return _0x1df8e9;};'use strict';var _=require(_0x1b61('0x0'));var moment=require(_0x1b61('0x1'));var util=require(_0x1b61('0x2'));var Redis=require(_0x1b61('0x3'));var config=require(_0x1b61('0x4'));var logger=require(_0x1b61('0x5'))(_0x1b61('0x6'));var ami=require(_0x1b61('0x7'));config[_0x1b61('0x8')]=_[_0x1b61('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1b61('0xa'))(new Redis(config[_0x1b61('0x8')]));function VoiceAgentReport(_0x49e76d){this['channels']={};this[_0x1b61('0xb')]=_0x49e76d['voiceQueues'];this[_0x1b61('0xc')]=_0x49e76d['agents'];this[_0x1b61('0xd')]={};ami['on'](_0x1b61('0xe'),this['syncAgentCalled']['bind'](this));ami['on'](_0x1b61('0xf'),this[_0x1b61('0x10')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x12'),this[_0x1b61('0x13')][_0x1b61('0x11')](this));ami['on']('queuecallerabandon',this[_0x1b61('0x14')][_0x1b61('0x11')](this));ami['on']('agentcomplete',this[_0x1b61('0x15')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x16'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x1b61('0x17')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x18'),this[_0x1b61('0x19')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x1a'),this[_0x1b61('0x1b')][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x1c'),this['syncAttendedTransfer'][_0x1b61('0x11')](this));ami['on'](_0x1b61('0x1d'),this[_0x1b61('0x1e')][_0x1b61('0x11')](this));}VoiceAgentReport['prototype'][_0x1b61('0x1f')]=function(_0x5aad01,_0x3d1eca,_0x35aa3a){io['to'](_0x5aad01)[_0x1b61('0x1f')](_0x3d1eca,_0x35aa3a);};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x21')]=function(_0x4e69a0){return _0x4e69a0!==null&&!_[_0x1b61('0x22')](_0x4e69a0);};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x23')]=function(_0x1bbe4a){try{if(this[_0x1b61('0x21')](_0x1bbe4a)){logger[_0x1b61('0x24')](_0x1b61('0x25'),_0x1bbe4a[_0x1b61('0x26')],_0x1bbe4a[_0x1b61('0x27')],_0x1bbe4a[_0x1b61('0x28')]);logger[_0x1b61('0x29')](_0x1b61('0x2a'),_0x1bbe4a['uniqueid'],util[_0x1b61('0x2b')](_0x1bbe4a,{'showHidden':![],'depth':null}));if(_[_0x1b61('0x22')](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]])){this['channels'][_0x1bbe4a[_0x1b61('0x26')]]={};}if(_['isUndefined'](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a['destuniqueid']])){this['channels'][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1b61('0x2d'),'mandatoryDisposition':this['voiceQueues'][_0x1bbe4a[_0x1b61('0x2e')]]?this[_0x1b61('0xb')][_0x1bbe4a[_0x1b61('0x2e')]][_0x1b61('0x2f')]||![]:![],'type':this[_0x1b61('0xb')][_0x1bbe4a[_0x1b61('0x2e')]]?this['voiceQueues'][_0x1bbe4a[_0x1b61('0x2e')]][_0x1b61('0x30')]||_0x1b61('0x31'):_0x1b61('0x31'),'variables':this[_0x1b61('0xd')][_0x1bbe4a['uniqueid']]};}_['merge'](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]],_[_0x1b61('0x32')](_0x1bbe4a,['event',_0x1b61('0x33')]));logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x1bbe4a[_0x1b61('0x26')],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x34'),this[_0x1b61('0x2c')][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]]);logger[_0x1b61('0x29')](_0x1b61('0x35'),_0x1bbe4a['uniqueid'],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0x1bbe4a['uniqueid']][_0x1bbe4a['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x1b61('0x1f')](util[_0x1b61('0x36')](_0x1b61('0x37'),_0x1bbe4a[_0x1b61('0x27')]),'user:called',this['channels'][_0x1bbe4a[_0x1b61('0x26')]][_0x1bbe4a[_0x1b61('0x28')]]);}}catch(_0x1a8135){logger['error'](_0x1b61('0x38'),_0x1bbe4a[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x1a8135,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x10')]=function(_0x41256b){try{if(this[_0x1b61('0x21')](_0x41256b)){if(this['channels'][_0x41256b[_0x1b61('0x26')]]){logger[_0x1b61('0x29')](_0x1b61('0x39'),_0x41256b[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x41256b,{'showHidden':![],'depth':null}));for(var _0x5dae85 in this['channels'][_0x41256b[_0x1b61('0x26')]]){if(this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x1b61('0x3a')](_0x5dae85)){if(_0x41256b[_0x1b61('0x28')]===_0x5dae85){logger[_0x1b61('0x24')](_0x1b61('0x3b'),_0x41256b[_0x1b61('0x26')],_0x41256b['membername'],_0x41256b[_0x1b61('0x28')]);this[_0x1b61('0x2c')][_0x41256b['uniqueid']][_0x5dae85][_0x1b61('0x3c')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x3e')]=_0x41256b[_0x1b61('0x3e')];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x3f')]=_0x41256b[_0x1b61('0x3f')];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['destchannelstate']=_0x41256b[_0x1b61('0x40')];this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x41')]=_0x41256b['destchannelstatedesc'];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x42')]=_0x41256b['holdtime'];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['lastevent']=_0x1b61('0x43');_['merge'](this[_0x1b61('0xc')][_0x41256b[_0x1b61('0x44')]],_[_0x1b61('0x45')](_0x41256b,[_0x1b61('0x2e'),_0x1b61('0x46')]));logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x41256b['uniqueid'],util[_0x1b61('0x2b')](this['channels'][_0x41256b['uniqueid']][_0x41256b[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x47'),this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x41256b[_0x1b61('0x28')]]);logger[_0x1b61('0x29')](_0x1b61('0x48'),_0x41256b['uniqueid'],util['inspect'](this[_0x1b61('0x2c')][_0x41256b['uniqueid']][_0x41256b[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));this[_0x1b61('0x1f')](util[_0x1b61('0x36')](_0x1b61('0x37'),_0x41256b[_0x1b61('0x27')]),_0x1b61('0x49'),this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x41256b[_0x1b61('0x28')]]);}else if(!this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x12')]&&!this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x4a')]){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x41256b[_0x1b61('0x26')],this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['membername'],_0x5dae85);this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['agentringnoanswer']=!![];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x4b')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85][_0x1b61('0x4c')]=_0x41256b['destuniqueid'];this[_0x1b61('0x2c')][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['answeredelsewheremembername']=_0x41256b[_0x1b61('0x27')];this[_0x1b61('0x2c')][_0x41256b['uniqueid']][_0x5dae85][_0x1b61('0x4d')]=_0x1b61('0x4e');this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85]['reason']=_0x1b61('0x4e');logger['debug'](_0x1b61('0x4f'),_0x41256b[_0x1b61('0x26')],util[_0x1b61('0x2b')](this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85],{'showHidden':![],'depth':null}));ami['emit'](_0x1b61('0x50'),this['channels'][_0x41256b[_0x1b61('0x26')]][_0x5dae85]);}}}}}}catch(_0x49389e){logger[_0x1b61('0x51')](_0x1b61('0x52'),_0x41256b['uniqueid'],util[_0x1b61('0x2b')](_0x49389e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')]['syncAgentRingNoAnswer']=function(_0xf414d5){try{if(this['isNotNull'](_0xf414d5)){logger[_0x1b61('0x29')](_0x1b61('0x53'),_0xf414d5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0xf414d5,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]]&&this['channels'][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]]){logger[_0x1b61('0x24')](_0x1b61('0x54'),_0xf414d5[_0x1b61('0x26')],_0xf414d5[_0x1b61('0x27')],_0xf414d5['destuniqueid']);this['channels'][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]][_0x1b61('0x12')]=!![];this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]][_0x1b61('0x4b')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]][_0x1b61('0x4d')]=_0x1b61('0x55');this[_0x1b61('0x2c')][_0xf414d5['uniqueid']][_0xf414d5['destuniqueid']][_0x1b61('0x56')]='rejected';logger[_0x1b61('0x29')](_0x1b61('0x57'),_0xf414d5[_0x1b61('0x26')],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x58'),this[_0x1b61('0x2c')][_0xf414d5[_0x1b61('0x26')]][_0xf414d5[_0x1b61('0x28')]]);}}}catch(_0x256a5d){logger[_0x1b61('0x51')]('[%s][voiceAgentReport][agentringnoanswer]',_0xf414d5[_0x1b61('0x26')],util['inspect'](_0x256a5d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0xaba407){try{if(this[_0x1b61('0x21')](_0xaba407)){logger[_0x1b61('0x29')](_0x1b61('0x59'),_0xaba407[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0xaba407,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0xaba407[_0x1b61('0x26')]]){for(var _0x3c4f02 in this['channels'][_0xaba407[_0x1b61('0x26')]]){if(this['channels'][_0xaba407[_0x1b61('0x26')]][_0x1b61('0x3a')](_0x3c4f02)&&!this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x12')]&&!this[_0x1b61('0x2c')][_0xaba407[_0x1b61('0x26')]][_0x3c4f02][_0x1b61('0x4a')]){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xaba407['uniqueid'],this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x27')],_0x3c4f02);this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02][_0x1b61('0x12')]=!![];this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x4b')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02][_0x1b61('0x4d')]=_0x1b61('0x5a');this[_0x1b61('0x2c')][_0xaba407['uniqueid']][_0x3c4f02][_0x1b61('0x56')]='abandoned';logger[_0x1b61('0x29')](_0x1b61('0x5b'),_0xaba407[_0x1b61('0x26')],util[_0x1b61('0x2b')](this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')]('custom:agentqueuecallerabandon',this['channels'][_0xaba407[_0x1b61('0x26')]][_0x3c4f02]);}}}}}catch(_0x51c06a){logger['error'](_0x1b61('0x5c'),_0xaba407[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x51c06a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x15')]=function(_0x2a5ec6){try{if(this[_0x1b61('0x21')](_0x2a5ec6)){logger['debug'](_0x1b61('0x5d'),_0x2a5ec6['uniqueid'],util[_0x1b61('0x2b')](_0x2a5ec6,{'showHidden':![],'depth':null}));if(this['channels'][_0x2a5ec6['uniqueid']]){for(var _0x24ff69 in this['channels'][_0x2a5ec6['uniqueid']]){if(this['channels'][_0x2a5ec6['uniqueid']][_0x1b61('0x3a')](_0x24ff69)){if(this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69]['agentconnectAt']&&!this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x4a')]){logger[_0x1b61('0x24')](_0x1b61('0x5e'),_0x2a5ec6[_0x1b61('0x26')],this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x27')],_0x24ff69);this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x4a')]=!![];this['channels'][_0x2a5ec6['uniqueid']][_0x24ff69][_0x1b61('0x5f')]=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x4d')]=_0x1b61('0x60');this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x56')]=_0x2a5ec6[_0x1b61('0x56')]==_0x1b61('0x61')?_0x1b61('0x62'):_0x2a5ec6[_0x1b61('0x56')];this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69][_0x1b61('0x63')]=_0x2a5ec6[_0x1b61('0x63')];if(this[_0x1b61('0xb')][_0x2a5ec6['queue']]&&this[_0x1b61('0xb')][_0x2a5ec6['queue']][_0x1b61('0x64')]){this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69]['acwtime']=this[_0x1b61('0xb')][_0x2a5ec6[_0x1b61('0x2e')]][_0x1b61('0x65')];this[_0x1b61('0x2c')][_0x2a5ec6['uniqueid']][_0x24ff69][_0x1b61('0x66')]=!![];}this[_0x1b61('0xc')][_0x2a5ec6[_0x1b61('0x44')]]=_[_0x1b61('0x32')](this[_0x1b61('0xc')][_0x2a5ec6[_0x1b61('0x44')]],[_0x1b61('0x2e'),_0x1b61('0x46')]);logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x2a5ec6[_0x1b61('0x26')],util[_0x1b61('0x2b')](this['channels'][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69],{'showHidden':![],'depth':null}));ami[_0x1b61('0x1f')](_0x1b61('0x67'),this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69]);logger[_0x1b61('0x29')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2a5ec6[_0x1b61('0x26')],util[_0x1b61('0x2b')](this[_0x1b61('0x2c')][_0x2a5ec6[_0x1b61('0x26')]][_0x24ff69],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1b61('0x37'),_0x2a5ec6[_0x1b61('0x27')]),'user:agentcomplete',this[_0x1b61('0x2c')][_0x2a5ec6['uniqueid']][_0x24ff69]);}}}}}}catch(_0x51ece5){logger['error'](_0x1b61('0x68'),_0x2a5ec6['uniqueid'],util[_0x1b61('0x2b')](_0x51ece5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x69')]=function(_0x3d1d01){try{if(this[_0x1b61('0x21')](_0x3d1d01)){logger[_0x1b61('0x29')](_0x1b61('0x6a'),_0x3d1d01[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x3d1d01,{'showHidden':![],'depth':null}));this['addVariable'](_0x3d1d01[_0x1b61('0x26')],_[_0x1b61('0x6b')](_0x3d1d01[_0x1b61('0x6c')])[0x0],_0x3d1d01[_0x1b61('0x6d')]);if(this[_0x1b61('0x2c')][_0x3d1d01[_0x1b61('0x26')]]){for(var _0x3acd44 in this['channels'][_0x3d1d01[_0x1b61('0x26')]]){if(this['channels'][_0x3d1d01[_0x1b61('0x26')]][_0x1b61('0x3a')](_0x3acd44)){logger[_0x1b61('0x24')](_0x1b61('0x6e'),_0x3d1d01[_0x1b61('0x26')],_0x3acd44,_[_0x1b61('0x6b')](_0x3d1d01['variable'])[0x0],_0x3d1d01[_0x1b61('0x6d')]);if(_[_0x1b61('0x22')](this[_0x1b61('0x2c')][_0x3d1d01[_0x1b61('0x26')]][_0x3acd44][_0x1b61('0xd')])){this[_0x1b61('0x2c')][_0x3d1d01['uniqueid']][_0x3acd44][_0x1b61('0xd')]={};}this[_0x1b61('0x2c')][_0x3d1d01[_0x1b61('0x26')]][_0x3acd44][_0x1b61('0xd')]=this[_0x1b61('0xd')][_0x3d1d01[_0x1b61('0x26')]];}}}}}catch(_0x4ee2a0){logger['error'](_0x1b61('0x6f'),_0x3d1d01[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x4ee2a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x70')]=function(_0x36a121,_0x57baee,_0x3a7456){var _0x1699b2=[_0x1b61('0x71'),'rtpaudioqosbridged',_0x1b61('0x72'),_0x1b61('0x73'),'rtpaudioqosloss',_0x1b61('0x74'),_0x1b61('0x75'),_0x1b61('0x76'),'sipcallid',_0x1b61('0x77'),'bridgepeer',_0x1b61('0x78'),'membercalls',_0x1b61('0x79'),_0x1b61('0x7a'),'memberlastcall',_0x1b61('0x27'),'memberpenalty',_0x1b61('0x7b')];if(!_[_0x1b61('0x7c')](_0x57baee)&&!_['includes'](_0x1699b2,_0x57baee)){if(_['isUndefined'](this[_0x1b61('0xd')][_0x36a121])){this[_0x1b61('0xd')][_0x36a121]={};}this[_0x1b61('0xd')][_0x36a121][_0x57baee]=_0x3a7456;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x464cd5){try{if(this[_0x1b61('0x21')](_0x464cd5)){logger[_0x1b61('0x29')](_0x1b61('0x7d'),_0x464cd5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x464cd5,{'showHidden':![],'depth':null}));if(this['channels'][_0x464cd5[_0x1b61('0x26')]]){for(var _0x538159 in this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]]){if(this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]]['hasOwnProperty'](_0x538159)){if(this[_0x1b61('0x2c')][_0x464cd5['uniqueid']][_0x538159][_0x1b61('0x56')]==_0x1b61('0x61')&&this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]][_0x538159]['agentcomplete']){logger[_0x1b61('0x24')](_0x1b61('0x7e'),_0x464cd5[_0x1b61('0x26')],_0x538159);this['channels'][_0x464cd5[_0x1b61('0x26')]][_0x538159]['agentcompleteAt']=moment()[_0x1b61('0x36')](_0x1b61('0x3d'));}}}logger[_0x1b61('0x29')](_0x1b61('0x7f'),_0x464cd5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_[_0x1b61('0x80')](this[_0x1b61('0x2c')][_0x464cd5[_0x1b61('0x26')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0x1b61('0x80')](this['channels'][_0x464cd5[_0x1b61('0x26')]]));delete this['channels'][_0x464cd5[_0x1b61('0x26')]];}if(this[_0x1b61('0xd')][_0x464cd5['uniqueid']]){delete this['variables'][_0x464cd5[_0x1b61('0x26')]];}}}catch(_0x10eda8){logger[_0x1b61('0x51')]('[%s][voiceAgentReport][hangup]',_0x464cd5[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x10eda8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x81')]=function(_0x2d8977){try{if(this[_0x1b61('0x21')](_0x2d8977)){logger[_0x1b61('0x29')](_0x1b61('0x82'),_0x2d8977[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x2d8977,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0x2d8977['transfereeuniqueid']]){for(var _0x485def in this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]]){if(this['channels'][_0x2d8977[_0x1b61('0x83')]]['hasOwnProperty'](_0x485def)){if(_0x2d8977[_0x1b61('0x84')]===_0x485def){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2d8977['uniqueid'],this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x27')],_0x485def);var _0x5e1e8f=moment();this['channels'][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x4a')]=!![];this[_0x1b61('0x2c')][_0x2d8977['transfereeuniqueid']][_0x485def]['agentcompleteAt']=moment()['format'](_0x1b61('0x3d'));this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x4d')]=_0x1b61('0x60');this[_0x1b61('0x2c')][_0x2d8977['transfereeuniqueid']][_0x485def][_0x1b61('0x56')]='transfer';this['channels'][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x63')]=_0x5e1e8f[_0x1b61('0x85')](this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]][_0x485def][_0x1b61('0x3c')],'seconds');}}}}if(this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x86')]]){var _0x417730=this['channels'][_0x2d8977[_0x1b61('0x86')]];this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x86')]]=this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]];this[_0x1b61('0x2c')][_0x2d8977[_0x1b61('0x83')]]=_0x417730;}}}catch(_0x5d89e7){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x2d8977[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x5d89e7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x4aa68b){try{if(this[_0x1b61('0x21')](_0x4aa68b)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x4aa68b[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x4aa68b,{'showHidden':![],'depth':null}));if(this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]]){for(var _0x284175 in this[_0x1b61('0x2c')][_0x4aa68b['transfereeuniqueid']]){if(this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x1b61('0x3a')](_0x284175)){if(_0x4aa68b[_0x1b61('0x87')]===_0x284175){logger[_0x1b61('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4aa68b[_0x1b61('0x26')],this['channels'][_0x4aa68b['transfereeuniqueid']][_0x284175][_0x1b61('0x27')],_0x284175);var _0x5c5a6e=moment();this['channels'][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x4a')]=!![];this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x5f')]=_0x5c5a6e;this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175]['lastevent']='complete';this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x56')]=_0x1b61('0x61');this[_0x1b61('0x2c')][_0x4aa68b['transfereeuniqueid']][_0x284175]['talktime']=_0x5c5a6e[_0x1b61('0x85')](this[_0x1b61('0x2c')][_0x4aa68b[_0x1b61('0x83')]][_0x284175][_0x1b61('0x3c')],_0x1b61('0x88'));}}}}}}catch(_0x57b64a){logger[_0x1b61('0x51')](_0x1b61('0x89'),_0x4aa68b[_0x1b61('0x26')],util['inspect'](_0x57b64a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x19')]=function(_0x1c3578){var _0x3e6151='';try{if(this['isNotNull'](_0x1c3578)){logger[_0x1b61('0x29')](_0x1b61('0x8a'),_0x1c3578[_0x1b61('0x26')],util['inspect'](_0x1c3578,{'showHidden':![],'depth':null}));if(_0x1c3578['channel']){_0x3e6151=_0x1c3578[_0x1b61('0x8b')][_0x1b61('0x8c')](0x0,_0x1c3578[_0x1b61('0x8b')][_0x1b61('0x8d')]('-'));if(this[_0x1b61('0xc')][_0x3e6151]){logger['info'](_0x1b61('0x8e'),_0x1c3578[_0x1b61('0x26')],_0x3e6151);this['agents'][_0x3e6151][_0x1b61('0x8f')]=!![];}}}}catch(_0x3f0d82){logger[_0x1b61('0x51')](_0x1b61('0x90'),_0x1c3578[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x3f0d82,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1b61('0x20')][_0x1b61('0x1b')]=function(_0x1ab534){var _0x33912b='';try{if(this['isNotNull'](_0x1ab534)){logger[_0x1b61('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x1ab534[_0x1b61('0x26')],util[_0x1b61('0x2b')](_0x1ab534,{'showHidden':![],'depth':null}));if(_0x1ab534[_0x1b61('0x8b')]){_0x33912b=_0x1ab534[_0x1b61('0x8b')][_0x1b61('0x8c')](0x0,_0x1ab534[_0x1b61('0x8b')][_0x1b61('0x8d')]('-'));if(this[_0x1b61('0xc')][_0x33912b]){logger[_0x1b61('0x24')](_0x1b61('0x91'),_0x1ab534[_0x1b61('0x26')],_0x33912b);this[_0x1b61('0xc')][_0x33912b][_0x1b61('0x8f')]=![];}}}}catch(_0x54d210){logger[_0x1b61('0x51')](_0x1b61('0x92'),_0x1ab534['uniqueid'],util[_0x1b61('0x2b')](_0x54d210,{'showHidden':![],'depth':null}));}};module[_0x1b61('0x93')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ecca794..819707b 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 _0x4421=['defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','from-sip','split','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','appdata','applicationdata','subtract','duration','seconds','application','lastapplication','lastdata','startsWith','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','origtransferercalleridnum','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','syncBlindTransfer','transfereecalleridnum','extension','transfererchannel','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','inuse','invalid','ringing','ringinuse','onhold','set','agi','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis'];(function(_0x2a12a4,_0x21ec2e){var _0x17b1fa=function(_0x509437){while(--_0x509437){_0x2a12a4['push'](_0x2a12a4['shift']());}};_0x17b1fa(++_0x21ec2e);}(_0x4421,0xa3));var _0x1442=function(_0xe171ab,_0x3b5ee1){_0xe171ab=_0xe171ab-0x0;var _0x17d4b9=_0x4421[_0xe171ab];return _0x17d4b9;};'use strict';var BPromise=require(_0x1442('0x0'));var _=require(_0x1442('0x1'));var moment=require(_0x1442('0x2'));var util=require(_0x1442('0x3'));var path=require('path');var Redis=require(_0x1442('0x4'));var config=require(_0x1442('0x5'));var logger=require(_0x1442('0x6'))(_0x1442('0x7'));var ami=require(_0x1442('0x8'));var Channel=require(_0x1442('0x9'));var statusDesc=['unknown','not_inuse',_0x1442('0xa'),'busy',_0x1442('0xb'),'unavailable',_0x1442('0xc'),_0x1442('0xd'),_0x1442('0xe')];var applications=[_0x1442('0xf'),'queue',_0x1442('0x10'),_0x1442('0x11'),'playback',_0x1442('0x12')];var dispositions=['NO\x20ANSWER',_0x1442('0x13'),_0x1442('0x13'),_0x1442('0x14'),_0x1442('0x14'),_0x1442('0x14'),_0x1442('0x15'),_0x1442('0x16'),_0x1442('0x13'),'FAILED',_0x1442('0x13')];var actions={};config[_0x1442('0x17')]=_[_0x1442('0x18')](config['redis'],{'host':_0x1442('0x19'),'port':0x18eb});var io=require(_0x1442('0x1a'))(new Redis(config[_0x1442('0x17')]));function VoiceCallReport(_0x454293){this[_0x1442('0x1b')]=_0x454293['channels'];this[_0x1442('0x1c')]=_0x454293[_0x1442('0x1c')];this['blindTransfers']={};ami['on'](_0x1442('0x1d'),this[_0x1442('0x1e')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x20'),this['syncNewExten'][_0x1442('0x1f')](this));ami['on'](_0x1442('0x21'),this[_0x1442('0x22')]['bind'](this));ami['on'](_0x1442('0x23'),this[_0x1442('0x24')]['bind'](this));ami['on'](_0x1442('0x25'),this['syncVarSet']['bind'](this));ami['on'](_0x1442('0x26'),this['syncHangup'][_0x1442('0x1f')](this));ami['on']('newcallerid',this[_0x1442('0x27')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x28'),this[_0x1442('0x29')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x2a'),this['syncBlindTransfer'][_0x1442('0x1f')](this));ami['on'](_0x1442('0x2b'),this[_0x1442('0x2c')][_0x1442('0x1f')](this));ami['on'](_0x1442('0x2d'),this[_0x1442('0x2e')][_0x1442('0x1f')](this));try{logger[_0x1442('0x2f')](_0x1442('0x30'));ami[_0x1442('0x31')]();}catch(_0xa8a818){logger[_0x1442('0x32')]('[voiceCallReport][coreshowchannels]',util[_0x1442('0x33')](_0xa8a818,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1442('0x34')][_0x1442('0x35')]=function(_0x1eab67){return _0x1eab67!==null&&!_[_0x1442('0x36')](_0x1eab67);};VoiceCallReport[_0x1442('0x34')][_0x1442('0x37')]=function(_0xec1fe0,_0x5022a2,_0x5b93da){io['to'](_0xec1fe0)[_0x1442('0x37')](_0x5022a2,_0x5b93da);};VoiceCallReport[_0x1442('0x34')][_0x1442('0x27')]=function(_0x37333b){try{if(this[_0x1442('0x35')](_0x37333b)){logger[_0x1442('0x2f')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x37333b['uniqueid'],_0x37333b[_0x1442('0x38')],_0x37333b[_0x1442('0x39')]);logger[_0x1442('0x3a')](_0x1442('0x3b'),_0x37333b[_0x1442('0x3c')],util['inspect'](_0x37333b,{'showHidden':![],'depth':null}));if(_0x37333b[_0x1442('0x3c')]===_0x37333b[_0x1442('0x3d')]){if(!_[_0x1442('0x36')](this['channels'][_0x37333b[_0x1442('0x3c')]])){_[_0x1442('0x3e')](this['channels'][_0x37333b[_0x1442('0x3c')]],_[_0x1442('0x3f')](_0x37333b,_[_0x1442('0x40')](this[_0x1442('0x1b')][_0x37333b[_0x1442('0x3c')]])));}}}}catch(_0x5f77ec){logger[_0x1442('0x32')](_0x1442('0x41'),_0x37333b['uniqueid'],util[_0x1442('0x33')](_0x5f77ec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncNewChannel']=function(_0x38ef2f){try{if(this[_0x1442('0x35')](_0x38ef2f)){logger[_0x1442('0x3a')](_0x1442('0x42'),_0x38ef2f[_0x1442('0x3c')],util[_0x1442('0x33')](_0x38ef2f,{'showHidden':![],'depth':null}));if(_0x38ef2f['uniqueid']===_0x38ef2f[_0x1442('0x3d')]&&_0x38ef2f[_0x1442('0x43')]!='OutgoingSpoolFailed'){if(_[_0x1442('0x36')](this['channels'][_0x38ef2f[_0x1442('0x3c')]])){logger[_0x1442('0x2f')](_0x1442('0x44'),_0x38ef2f[_0x1442('0x3c')],_0x38ef2f[_0x1442('0x45')],_0x38ef2f['exten']);this['channels'][_0x38ef2f[_0x1442('0x3c')]]=new Channel();this[_0x1442('0x1b')][_0x38ef2f[_0x1442('0x3c')]][_0x1442('0x46')]=moment()[_0x1442('0x47')](_0x1442('0x48'));this[_0x1442('0x1b')][_0x38ef2f['uniqueid']][_0x1442('0x49')]=dispositions[_['toNumber'](_0x38ef2f[_0x1442('0x4a')])];_[_0x1442('0x3e')](this[_0x1442('0x1b')][_0x38ef2f[_0x1442('0x3c')]],_[_0x1442('0x3f')](_0x38ef2f,_[_0x1442('0x40')](this[_0x1442('0x1b')][_0x38ef2f[_0x1442('0x3c')]])));if(_0x38ef2f['context']===_0x1442('0x4b')){if(this[_0x1442('0x1c')][_0x38ef2f[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1c')][_0x38ef2f[_0x1442('0x43')]['split']('-')[0x0]]['destconnectedlinenum']=_0x38ef2f[_0x1442('0x4d')];logger[_0x1442('0x3a')](_0x1442('0x4e'),_0x38ef2f[_0x1442('0x3c')],util[_0x1442('0x33')]({'destaccountcode':this['agents'][_0x38ef2f[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x4f')],'destconnectedlinenum':_0x38ef2f[_0x1442('0x4d')]},{'showHidden':![],'depth':null}));this[_0x1442('0x37')](util[_0x1442('0x47')]('user:%s',this[_0x1442('0x1c')][_0x38ef2f[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x50')]),_0x1442('0x51'),{'destaccountcode':this['agents'][_0x38ef2f['channel'][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x4f')],'destconnectedlinenum':_0x38ef2f['exten']});}}}}}}catch(_0xe22a9f){logger[_0x1442('0x32')](_0x1442('0x52'),_0x38ef2f[_0x1442('0x3c')],util[_0x1442('0x33')](_0xe22a9f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x1e')]=function(_0x165766){try{if(this[_0x1442('0x35')](_0x165766)){logger[_0x1442('0x3a')](_0x1442('0x53'),_0x165766['uniqueid'],util[_0x1442('0x33')](_0x165766,{'showHidden':![],'depth':null}));if(_0x165766['uniqueid']===_0x165766['linkedid']&&_0x165766[_0x1442('0x4d')]!='h'&&_0x165766[_0x1442('0x43')]!='OutgoingSpoolFailed'){_0x165766['application']=_0x165766['application'][_0x1442('0x54')]();_0x165766['applicationdata']=(_0x165766[_0x1442('0x55')]||_0x165766[_0x1442('0x56')])[_0x1442('0x54')]();logger[_0x1442('0x2f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x165766[_0x1442('0x3c')],_0x165766['application'],_0x165766['applicationdata']);if(_[_0x1442('0x36')](this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]])){this[_0x1442('0x1b')][_0x165766['uniqueid']]=new Channel();this['channels'][_0x165766[_0x1442('0x3c')]]['starttime']=_0x165766['duration']?moment()[_0x1442('0x57')](moment[_0x1442('0x58')](_0x165766['duration'])[_0x1442('0x59')](),_0x1442('0x59'))[_0x1442('0x47')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x1442('0x47')](_0x1442('0x48'));this['channels'][_0x165766[_0x1442('0x3c')]][_0x1442('0x49')]=_0x1442('0x14');}_[_0x1442('0x3e')](this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]],_[_0x1442('0x3f')](_0x165766,_['keys'](this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]])));if(_['includes'](applications,_0x165766[_0x1442('0x5a')])){this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]][_0x1442('0x5b')]=_0x165766[_0x1442('0x5a')];this[_0x1442('0x1b')][_0x165766[_0x1442('0x3c')]][_0x1442('0x5c')]=_0x165766[_0x1442('0x56')];if(_0x165766[_0x1442('0x5a')]==='set'&&_[_0x1442('0x5d')](_0x165766[_0x1442('0x56')],'cdr(')){var _0x384f17=_0x165766[_0x1442('0x56')][_0x1442('0x4c')]('=');var _0x34b28c=_0x384f17[0x0][_0x1442('0x5e')](/cdr\((.*)\)/);if(_0x34b28c){this['channels'][_0x165766[_0x1442('0x3c')]][_0x34b28c[0x1]]=_0x384f17[0x1];}}else if(_0x165766['application']===_0x1442('0x5f')){this[_0x1442('0x1b')][_0x165766['uniqueid']][_0x1442('0x5f')]=_0x165766['applicationdata']['split'](',')[0x0];}}}}}catch(_0x137c75){logger[_0x1442('0x32')](_0x1442('0x60'),_0x165766['uniqueid'],util[_0x1442('0x33')](_0x137c75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncNewState']=function(_0x202707){try{if(this[_0x1442('0x35')](_0x202707)){logger[_0x1442('0x2f')](_0x1442('0x61'),_0x202707[_0x1442('0x3c')],_0x202707[_0x1442('0x3d')],_0x202707[_0x1442('0x38')],_0x202707[_0x1442('0x39')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x202707[_0x1442('0x3c')],util[_0x1442('0x33')](_0x202707,{'showHidden':![],'depth':null}));if(_0x202707[_0x1442('0x3c')]!==_0x202707[_0x1442('0x3d')]){if(this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]]){if(_0x202707['channelstate']==='6'){if(!this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x62')]){var _0x2fb5cc=moment();this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x62')]=!![];this[_0x1442('0x1b')][_0x202707['linkedid']][_0x1442('0x63')]=_0x2fb5cc['format'](_0x1442('0x48'));if(this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x46')]){this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x64')]=_0x2fb5cc[_0x1442('0x65')](this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x46')],_0x1442('0x59'));}}this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x3d')]=_0x202707['uniqueid'];if(_0x202707[_0x1442('0x39')]!==_0x1442('0x66')){this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x67')]=_0x202707['calleridnum'];}this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x68')]=_0x202707['calleridname'];this['channels'][_0x202707[_0x1442('0x3d')]][_0x1442('0x69')]=_0x202707[_0x1442('0x43')];this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x49')]=dispositions[_[_0x1442('0x6a')](_0x202707[_0x1442('0x4a')])];if(this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x6b')]=this[_0x1442('0x1c')][_0x202707['channel'][_0x1442('0x4c')]('-')[0x0]]['id'];this[_0x1442('0x1b')][_0x202707[_0x1442('0x3d')]][_0x1442('0x6c')]=this['agents'][_0x202707['channel']['split']('-')[0x0]][_0x1442('0x50')];}}}}else{if(this[_0x1442('0x1b')][_0x202707[_0x1442('0x3c')]]){if(_0x202707[_0x1442('0x4a')]==='6'){if(this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1b')][_0x202707[_0x1442('0x3c')]][_0x1442('0x6b')]=this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')]['split']('-')[0x0]]['id'];this[_0x1442('0x1b')][_0x202707[_0x1442('0x3c')]]['membername']=this[_0x1442('0x1c')][_0x202707[_0x1442('0x43')]['split']('-')[0x0]][_0x1442('0x50')];}}}}}}catch(_0x934809){logger[_0x1442('0x32')](_0x1442('0x6d'),_0x202707['uniqueid'],util[_0x1442('0x33')](_0x934809,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x6e')]=function(_0x2bde67,_0x15d4cc){try{if(this[_0x1442('0x1b')][_0x2bde67]){logger[_0x1442('0x2f')](_0x1442('0x6f'),_0x2bde67,_0x15d4cc);this[_0x1442('0x1b')][_0x2bde67][_0x1442('0x70')]=!![];if(_['endsWith'](_0x15d4cc,_0x1442('0x71'))){_0x15d4cc=_0x15d4cc['replace']('.wav49','.WAV');}this[_0x1442('0x1b')][_0x2bde67][_0x1442('0x72')]=_0x15d4cc;var _0x4bcabb=_[_0x1442('0x73')](this[_0x1442('0x1b')][_0x2bde67]['monitors'],{'filename':_0x15d4cc});if(_['isNil'](_0x4bcabb)){this[_0x1442('0x1b')][_0x2bde67][_0x1442('0x74')][_0x1442('0x75')]({'filename':_0x15d4cc,'createdAt':moment()[_0x1442('0x47')](_0x1442('0x48')),'mixmonitorid':'','status':_0x1442('0x76')});}}}catch(_0x551ce4){logger[_0x1442('0x32')](_0x1442('0x77'),_0x2bde67,util[_0x1442('0x33')](_0x551ce4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x78')]=function(_0x4cfb7f){try{if(this[_0x1442('0x35')](_0x4cfb7f)){logger[_0x1442('0x3a')](_0x1442('0x79'),_0x4cfb7f['uniqueid'],util[_0x1442('0x33')](_0x4cfb7f,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x4cfb7f['uniqueid']]&&_0x4cfb7f[_0x1442('0x43')]!=_0x1442('0x7a')){if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')])){if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x7c')])){logger[_0x1442('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x6e')](_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x7e')])){logger[_0x1442('0x2f')](_0x1442('0x7f'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value']);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x39')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x80')])){logger[_0x1442('0x2f')](_0x1442('0x81'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this['channels'][_0x4cfb7f['uniqueid']][_0x1442('0x82')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f['variable'][_0x1442('0x83')])){logger[_0x1442('0x2f')](_0x1442('0x84'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x85')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x86')])){logger[_0x1442('0x2f')](_0x1442('0x87'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value'][_0x1442('0x4c')](',')[0x0]);this['channels'][_0x4cfb7f['uniqueid']][_0x1442('0x5f')]=_0x4cfb7f[_0x1442('0x7d')][_0x1442('0x4c')](',')[0x0];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x88')])){logger[_0x1442('0x2f')](_0x1442('0x89'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f['uniqueid']][_0x1442('0x8a')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f['variable'][_0x1442('0x8b')])){logger[_0x1442('0x2f')](_0x1442('0x8c'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x8d')]=_0x4cfb7f[_0x1442('0x7d')];}else if(this['isNotNull'](_0x4cfb7f[_0x1442('0x7b')]['xmd-callerid-preview'])){logger['info'](_0x1442('0x8e'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value']);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x8f')]=_0x4cfb7f['value'];}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')]['xmcs-queue'])){logger['info'](_0x1442('0x90'),_0x4cfb7f[_0x1442('0x3c')],_0x4cfb7f['value']);this[_0x1442('0x1b')][_0x4cfb7f['uniqueid']]['queue']=_0x4cfb7f[_0x1442('0x7d')];}else if(this[_0x1442('0x35')](_0x4cfb7f['variable']['sipcallid'])){logger[_0x1442('0x2f')](_0x1442('0x91'),_0x4cfb7f['uniqueid'],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f[_0x1442('0x3c')]][_0x1442('0x92')]=_0x4cfb7f[_0x1442('0x7d')];}}}else if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')][_0x1442('0x7c')])){if(_0x4cfb7f['value']){var _0x47c0c6=path[_0x1442('0x93')](_0x4cfb7f['value'])[_0x1442('0x50')];logger[_0x1442('0x2f')](_0x1442('0x94'),_0x47c0c6,_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x6e')](_0x47c0c6,_0x4cfb7f[_0x1442('0x7d')]);}}else if(this['channels'][_0x4cfb7f[_0x1442('0x3d')]]){if(this[_0x1442('0x35')](_0x4cfb7f[_0x1442('0x7b')])){if(this[_0x1442('0x35')](_0x4cfb7f['variable'][_0x1442('0x95')])){logger[_0x1442('0x2f')](_0x1442('0x91'),_0x4cfb7f[_0x1442('0x3d')],_0x4cfb7f[_0x1442('0x7d')]);this[_0x1442('0x1b')][_0x4cfb7f['linkedid']][_0x1442('0x96')]=_0x4cfb7f['value'];}}}}}catch(_0x25148c){logger[_0x1442('0x32')](_0x1442('0x97'),_0x4cfb7f[_0x1442('0x3c')],util[_0x1442('0x33')](_0x25148c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x98')]=function(_0x53add0){try{if(this['isNotNull'](_0x53add0)){logger[_0x1442('0x3a')]('[%s][voiceCallReport][hangup]\x20event:',_0x53add0[_0x1442('0x3c')],util[_0x1442('0x33')](_0x53add0,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]]){logger[_0x1442('0x2f')](_0x1442('0x99'),_0x53add0['uniqueid'],_0x53add0['cause-txt']);var _0x433d50=moment();this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x9a')]=_0x433d50[_0x1442('0x47')](_0x1442('0x48'));this['channels'][_0x53add0[_0x1442('0x3c')]][_0x1442('0x58')]=_0x433d50[_0x1442('0x65')](this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x46')],_0x1442('0x59'));if(this['channels'][_0x53add0[_0x1442('0x3c')]]['answered']){this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x9b')]=_0x433d50[_0x1442('0x65')](this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x63')],_0x1442('0x59'));this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x64')]=this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x58')]-this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x9b')];}if(_0x53add0[_0x1442('0x45')]==='from-sip'){if(this['agents'][_0x53add0[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]){this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]]=_[_0x1442('0x9c')](this['agents'][_0x53add0['channel'][_0x1442('0x4c')]('-')[0x0]],[_0x1442('0x9d')]);logger[_0x1442('0x3a')](_0x1442('0x9e'),_0x53add0[_0x1442('0x3c')],util['inspect']({'destaccountcode':this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')]['split']('-')[0x0]][_0x1442('0x4f')]},{'showHidden':![],'depth':null}));this[_0x1442('0x37')](util[_0x1442('0x47')]('user:%s',this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')][_0x1442('0x4c')]('-')[0x0]][_0x1442('0x50')]),_0x1442('0x9f'),{'destaccountcode':this[_0x1442('0x1c')][_0x53add0[_0x1442('0x43')]['split']('-')[0x0]][_0x1442('0x4f')]});}}if(_0x53add0[_0x1442('0xa0')]===_0x1442('0xa1')){this[_0x1442('0xa2')][_0x53add0[_0x1442('0x3c')]]=this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]];}else{if(this[_0x1442('0x1b')][_0x53add0['uniqueid']][_0x1442('0x85')]===_0x1442('0xa3')&&this[_0x1442('0xa2')][_0x53add0[_0x1442('0x3c')]]){this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]][_0x1442('0x3c')]=[this['channels'][_0x53add0[_0x1442('0x3c')]][_0x1442('0x3d')],this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]]['linkedid']=this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]]['uniqueid']][0x0];delete this[_0x1442('0xa2')][_0x53add0[_0x1442('0x3c')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x53add0[_0x1442('0x3c')],util[_0x1442('0x33')](this['channels'][_0x53add0['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',this[_0x1442('0x1b')][_0x53add0['uniqueid']]);delete this[_0x1442('0x1b')][_0x53add0[_0x1442('0x3c')]];}}}catch(_0x26dbad){logger[_0x1442('0x32')](_0x1442('0xa4'),_0x53add0[_0x1442('0x3c')],util['inspect'](_0x26dbad,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0x29')]=function(_0x2eb40e){try{if(this['isNotNull'](_0x2eb40e)){logger['info'](_0x1442('0xa5'),_0x2eb40e[_0x1442('0x3c')],_0x2eb40e['origtransferercalleridnum'],_0x2eb40e[_0x1442('0xa6')]);logger[_0x1442('0x3a')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x2eb40e[_0x1442('0x3c')],util[_0x1442('0x33')](_0x2eb40e,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa7')]]){this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa7')]][_0x1442('0xa8')]=_0x2eb40e['origtransferercalleridnum'];this[_0x1442('0x1b')][_0x2eb40e['transfereeuniqueid']]['transferconnectedlinenum']=_0x2eb40e[_0x1442('0xa6')];if(this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa9')]]){var _0x16b055=this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa9')]];this['channels'][_0x2eb40e[_0x1442('0xa9')]]=this[_0x1442('0x1b')][_0x2eb40e['transfereeuniqueid']];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xa7')]]=_0x16b055;}}else if(this[_0x1442('0x1b')][_0x2eb40e['transfertargetuniqueid']]){this[_0x1442('0x1b')][_0x2eb40e['transfertargetuniqueid']][_0x1442('0xa8')]=_0x2eb40e[_0x1442('0xaa')];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xab')]][_0x1442('0xac')]=_0x2eb40e['transfertargetcalleridnum'];if(this[_0x1442('0x1b')][_0x2eb40e['origtransfereruniqueid']]){var _0x16b055=this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xad')]];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xad')]]=this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xab')]];this[_0x1442('0x1b')][_0x2eb40e[_0x1442('0xab')]]=_0x16b055;}}}}catch(_0x497eba){logger[_0x1442('0x32')]('[%s][voiceCallReport][attendedtransfer]',_0x2eb40e[_0x1442('0x3c')],util[_0x1442('0x33')](_0x497eba,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')][_0x1442('0xae')]=function(_0x48e332){try{if(this['isNotNull'](_0x48e332)){logger[_0x1442('0x2f')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x48e332[_0x1442('0x3c')],_0x48e332[_0x1442('0xaf')],_0x48e332[_0x1442('0xb0')]);logger['debug']('[%s][voiceCallReport][blindtransfer]\x20event:',_0x48e332['uniqueid'],util[_0x1442('0x33')](_0x48e332,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x48e332[_0x1442('0xa7')]]){this['channels'][_0x48e332[_0x1442('0xa7')]]['transfercalleridnum']=_0x48e332[_0x1442('0xaf')];this[_0x1442('0x1b')][_0x48e332[_0x1442('0xa7')]]['transferconnectedlinenum']=_0x48e332[_0x1442('0xb0')];this[_0x1442('0x98')]({'event':_0x1442('0xa1'),'uniqueid':_0x48e332[_0x1442('0xa7')],'context':_0x48e332[_0x1442('0x45')],'channel':_0x48e332[_0x1442('0xb1')]});}}}catch(_0x1d5e77){logger[_0x1442('0x32')](_0x1442('0xb2'),_0x48e332[_0x1442('0x3c')],util[_0x1442('0x33')](_0x1d5e77,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncMusicOnHoldStart']=function(_0x39d630){try{if(this[_0x1442('0x35')](_0x39d630)){logger[_0x1442('0x3a')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x39d630['uniqueid'],util[_0x1442('0x33')](_0x39d630,{'showHidden':![],'depth':null}));if(this[_0x1442('0x1b')][_0x39d630[_0x1442('0x3c')]]){if(!_[_0x1442('0xb3')](this[_0x1442('0x1b')][_0x39d630[_0x1442('0x3c')]][_0x1442('0x63')])){this['channels'][_0x39d630['uniqueid']]['mohstarttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x1442('0x2f')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x39d630[_0x1442('0x3c')],this[_0x1442('0x1b')][_0x39d630[_0x1442('0x3c')]][_0x1442('0xb4')]);}}}}catch(_0x583c82){logger['error'](_0x1442('0xb5'),_0x39d630['uniqueid'],util[_0x1442('0x33')](_0x583c82,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1442('0x34')]['syncMusicOnHoldStop']=function(_0x343b19){try{if(this[_0x1442('0x35')](_0x343b19)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x343b19[_0x1442('0x3c')],util[_0x1442('0x33')](_0x343b19,{'showHidden':![],'depth':null}));if(this['channels'][_0x343b19['uniqueid']]){if(!_[_0x1442('0xb3')](this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb4')])){this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb6')]+=moment()[_0x1442('0xb7')](0x0)[_0x1442('0x65')](this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb4')],_0x1442('0x59'));logger['info'](_0x1442('0xb8'),_0x343b19['uniqueid'],this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]]['mohtime']);delete this[_0x1442('0x1b')][_0x343b19[_0x1442('0x3c')]][_0x1442('0xb4')];}}}}catch(_0x22fc80){logger['error'](_0x1442('0xb9'),_0x343b19[_0x1442('0x3c')],util[_0x1442('0x33')](_0x22fc80,{'showHidden':![],'depth':null}));}};module[_0x1442('0xba')]=VoiceCallReport; \ No newline at end of file +var _0x482d=['[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','blindTransfers','outbound','emit','[%s][voiceCallReport][hangup]','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','answertime','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../model/channel','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newchannel','syncNewChannel','bind','newstate','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','keys','[%s][voiceCallReport][newcallerid]','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','application','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','duration','subtract','seconds','pick','includes','lastdata','set','startsWith','cdr('];(function(_0x373423,_0x3a67cd){var _0x59a10f=function(_0x2409da){while(--_0x2409da){_0x373423['push'](_0x373423['shift']());}};_0x59a10f(++_0x3a67cd);}(_0x482d,0x1b4));var _0xd482=function(_0x5a1ae8,_0x438c49){_0x5a1ae8=_0x5a1ae8-0x0;var _0x3fa1e6=_0x482d[_0x5a1ae8];return _0x3fa1e6;};'use strict';var BPromise=require(_0xd482('0x0'));var _=require(_0xd482('0x1'));var moment=require(_0xd482('0x2'));var util=require(_0xd482('0x3'));var path=require(_0xd482('0x4'));var Redis=require('ioredis');var config=require(_0xd482('0x5'));var logger=require(_0xd482('0x6'))(_0xd482('0x7'));var ami=require('../ami');var Channel=require(_0xd482('0x8'));var statusDesc=['unknown',_0xd482('0x9'),_0xd482('0xa'),'busy',_0xd482('0xb'),_0xd482('0xc'),_0xd482('0xd'),_0xd482('0xe'),_0xd482('0xf')];var applications=['set',_0xd482('0x10'),_0xd482('0x11'),_0xd482('0x12'),_0xd482('0x13'),_0xd482('0x14')];var dispositions=['NO\x20ANSWER',_0xd482('0x15'),'FAILED',_0xd482('0x16'),_0xd482('0x16'),_0xd482('0x16'),_0xd482('0x17'),'BUSY',_0xd482('0x15'),_0xd482('0x15'),_0xd482('0x15')];var actions={};config[_0xd482('0x18')]=_['defaults'](config[_0xd482('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0xd482('0x19'))(new Redis(config[_0xd482('0x18')]));function VoiceCallReport(_0x39a316){this[_0xd482('0x1a')]=_0x39a316[_0xd482('0x1a')];this[_0xd482('0x1b')]=_0x39a316['agents'];this['blindTransfers']={};ami['on'](_0xd482('0x1c'),this[_0xd482('0x1d')]['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xd482('0x1e'),this[_0xd482('0x1f')][_0xd482('0x20')](this));ami['on'](_0xd482('0x21'),this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet'][_0xd482('0x20')](this));ami['on']('hangup',this[_0xd482('0x22')][_0xd482('0x20')](this));ami['on'](_0xd482('0x23'),this[_0xd482('0x24')][_0xd482('0x20')](this));ami['on'](_0xd482('0x25'),this[_0xd482('0x26')][_0xd482('0x20')](this));ami['on'](_0xd482('0x27'),this['syncBlindTransfer'][_0xd482('0x20')](this));ami['on'](_0xd482('0x28'),this[_0xd482('0x29')][_0xd482('0x20')](this));ami['on'](_0xd482('0x2a'),this[_0xd482('0x2b')][_0xd482('0x20')](this));try{logger[_0xd482('0x2c')](_0xd482('0x2d'));ami['actionCoreShowChannels']();}catch(_0x11f854){logger[_0xd482('0x2e')](_0xd482('0x2f'),util[_0xd482('0x30')](_0x11f854,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xd482('0x31')]=function(_0x2cf0ff){return _0x2cf0ff!==null&&!_[_0xd482('0x32')](_0x2cf0ff);};VoiceCallReport[_0xd482('0x33')]['emit']=function(_0x31e681,_0x5d1e4b,_0x3b7bc9){io['to'](_0x31e681)['emit'](_0x5d1e4b,_0x3b7bc9);};VoiceCallReport['prototype'][_0xd482('0x24')]=function(_0x489879){try{if(this[_0xd482('0x31')](_0x489879)){logger[_0xd482('0x2c')](_0xd482('0x34'),_0x489879['uniqueid'],_0x489879[_0xd482('0x35')],_0x489879[_0xd482('0x36')]);logger[_0xd482('0x37')](_0xd482('0x38'),_0x489879[_0xd482('0x39')],util['inspect'](_0x489879,{'showHidden':![],'depth':null}));if(_0x489879[_0xd482('0x39')]===_0x489879[_0xd482('0x3a')]){if(!_[_0xd482('0x32')](this[_0xd482('0x1a')][_0x489879['uniqueid']])){_[_0xd482('0x3b')](this['channels'][_0x489879[_0xd482('0x39')]],_['pick'](_0x489879,_[_0xd482('0x3c')](this[_0xd482('0x1a')][_0x489879[_0xd482('0x39')]])));}}}}catch(_0x566c44){logger[_0xd482('0x2e')](_0xd482('0x3d'),_0x489879[_0xd482('0x39')],util[_0xd482('0x30')](_0x566c44,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd482('0x1f')]=function(_0x2faff7){try{if(this['isNotNull'](_0x2faff7)){logger[_0xd482('0x37')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2faff7[_0xd482('0x39')],util[_0xd482('0x30')](_0x2faff7,{'showHidden':![],'depth':null}));if(_0x2faff7[_0xd482('0x39')]===_0x2faff7['linkedid']&&_0x2faff7[_0xd482('0x3e')]!=_0xd482('0x3f')){if(_[_0xd482('0x32')](this[_0xd482('0x1a')][_0x2faff7[_0xd482('0x39')]])){logger[_0xd482('0x2c')](_0xd482('0x40'),_0x2faff7[_0xd482('0x39')],_0x2faff7[_0xd482('0x41')],_0x2faff7['exten']);this[_0xd482('0x1a')][_0x2faff7['uniqueid']]=new Channel();this[_0xd482('0x1a')][_0x2faff7[_0xd482('0x39')]][_0xd482('0x42')]=moment()[_0xd482('0x43')](_0xd482('0x44'));this[_0xd482('0x1a')][_0x2faff7['uniqueid']][_0xd482('0x45')]=dispositions[_[_0xd482('0x46')](_0x2faff7[_0xd482('0x47')])];_['merge'](this[_0xd482('0x1a')][_0x2faff7['uniqueid']],_['pick'](_0x2faff7,_[_0xd482('0x3c')](this['channels'][_0x2faff7[_0xd482('0x39')]])));if(_0x2faff7[_0xd482('0x41')]===_0xd482('0x48')){if(this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]){this['agents'][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]][_0xd482('0x4a')]=_0x2faff7[_0xd482('0x4b')];logger['debug'](_0xd482('0x4c'),_0x2faff7[_0xd482('0x39')],util['inspect']({'destaccountcode':this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2faff7[_0xd482('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xd482('0x4d'),this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')]['split']('-')[0x0]][_0xd482('0x4e')]),_0xd482('0x4f'),{'destaccountcode':this[_0xd482('0x1b')][_0x2faff7[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]][_0xd482('0x50')],'destconnectedlinenum':_0x2faff7[_0xd482('0x4b')]});}}}}}}catch(_0x2419e9){logger[_0xd482('0x2e')](_0xd482('0x51'),_0x2faff7[_0xd482('0x39')],util[_0xd482('0x30')](_0x2419e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x1d')]=function(_0x48d766){try{if(this[_0xd482('0x31')](_0x48d766)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x48d766[_0xd482('0x39')],util['inspect'](_0x48d766,{'showHidden':![],'depth':null}));if(_0x48d766[_0xd482('0x39')]===_0x48d766[_0xd482('0x3a')]&&_0x48d766[_0xd482('0x4b')]!='h'&&_0x48d766[_0xd482('0x3e')]!=_0xd482('0x3f')){_0x48d766[_0xd482('0x52')]=_0x48d766[_0xd482('0x52')]['toLowerCase']();_0x48d766['applicationdata']=(_0x48d766['appdata']||_0x48d766['applicationdata'])[_0xd482('0x53')]();logger['info'](_0xd482('0x54'),_0x48d766[_0xd482('0x39')],_0x48d766[_0xd482('0x52')],_0x48d766[_0xd482('0x55')]);if(_[_0xd482('0x32')](this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]])){this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]]=new Channel();this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0xd482('0x42')]=_0x48d766[_0xd482('0x56')]?moment()[_0xd482('0x57')](moment[_0xd482('0x56')](_0x48d766[_0xd482('0x56')])[_0xd482('0x58')](),_0xd482('0x58'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xd482('0x43')](_0xd482('0x44'));this['channels'][_0x48d766[_0xd482('0x39')]][_0xd482('0x45')]=_0xd482('0x16');}_[_0xd482('0x3b')](this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]],_[_0xd482('0x59')](_0x48d766,_[_0xd482('0x3c')](this['channels'][_0x48d766[_0xd482('0x39')]])));if(_[_0xd482('0x5a')](applications,_0x48d766['application'])){this['channels'][_0x48d766[_0xd482('0x39')]]['lastapplication']=_0x48d766['application'];this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0xd482('0x5b')]=_0x48d766['applicationdata'];if(_0x48d766[_0xd482('0x52')]===_0xd482('0x5c')&&_[_0xd482('0x5d')](_0x48d766[_0xd482('0x55')],_0xd482('0x5e'))){var _0x53fa29=_0x48d766[_0xd482('0x55')][_0xd482('0x49')]('=');var _0x45b498=_0x53fa29[0x0]['match'](/cdr\((.*)\)/);if(_0x45b498){this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0x45b498[0x1]]=_0x53fa29[0x1];}}else if(_0x48d766['application']===_0xd482('0x10')){this[_0xd482('0x1a')][_0x48d766[_0xd482('0x39')]][_0xd482('0x10')]=_0x48d766[_0xd482('0x55')]['split'](',')[0x0];}}}}}catch(_0x17ec54){logger[_0xd482('0x2e')](_0xd482('0x5f'),_0x48d766[_0xd482('0x39')],util[_0xd482('0x30')](_0x17ec54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x60')]=function(_0x3b7c78){try{if(this['isNotNull'](_0x3b7c78)){logger[_0xd482('0x2c')](_0xd482('0x61'),_0x3b7c78[_0xd482('0x39')],_0x3b7c78[_0xd482('0x3a')],_0x3b7c78[_0xd482('0x35')],_0x3b7c78['calleridnum']);logger[_0xd482('0x37')]('[%s][voiceCallReport][newstate]\x20event:',_0x3b7c78[_0xd482('0x39')],util[_0xd482('0x30')](_0x3b7c78,{'showHidden':![],'depth':null}));if(_0x3b7c78['uniqueid']!==_0x3b7c78[_0xd482('0x3a')]){if(this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]){if(_0x3b7c78['channelstate']==='6'){if(!this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x62')]){var _0xe2acc0=moment();this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['answered']=!![];this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['answertime']=_0xe2acc0[_0xd482('0x43')](_0xd482('0x44'));if(this[_0xd482('0x1a')][_0x3b7c78['linkedid']][_0xd482('0x42')]){this['channels'][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x63')]=_0xe2acc0[_0xd482('0x64')](this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['starttime'],_0xd482('0x58'));}}this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x3a')]=_0x3b7c78[_0xd482('0x39')];if(_0x3b7c78[_0xd482('0x36')]!=='xcally-motion-preview'){this['channels'][_0x3b7c78['linkedid']][_0xd482('0x65')]=_0x3b7c78[_0xd482('0x36')];}this['channels'][_0x3b7c78['linkedid']][_0xd482('0x66')]=_0x3b7c78[_0xd482('0x35')];this['channels'][_0x3b7c78[_0xd482('0x3a')]][_0xd482('0x67')]=_0x3b7c78[_0xd482('0x3e')];this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x3a')]]['disposition']=dispositions[_[_0xd482('0x46')](_0x3b7c78[_0xd482('0x47')])];if(this['agents'][_0x3b7c78['channel'][_0xd482('0x49')]('-')[0x0]]){this[_0xd482('0x1a')][_0x3b7c78['linkedid']][_0xd482('0x68')]=this[_0xd482('0x1b')][_0x3b7c78[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]['id'];this[_0xd482('0x1a')][_0x3b7c78['linkedid']][_0xd482('0x69')]=this['agents'][_0x3b7c78['channel']['split']('-')[0x0]][_0xd482('0x4e')];}}}}else{if(this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x39')]]){if(_0x3b7c78[_0xd482('0x47')]==='6'){if(this[_0xd482('0x1b')][_0x3b7c78[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]){this['channels'][_0x3b7c78[_0xd482('0x39')]]['UserId']=this[_0xd482('0x1b')][_0x3b7c78['channel']['split']('-')[0x0]]['id'];this[_0xd482('0x1a')][_0x3b7c78[_0xd482('0x39')]][_0xd482('0x69')]=this['agents'][_0x3b7c78['channel'][_0xd482('0x49')]('-')[0x0]]['name'];}}}}}}catch(_0x35d354){logger[_0xd482('0x2e')](_0xd482('0x6a'),_0x3b7c78[_0xd482('0x39')],util['inspect'](_0x35d354,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x6b')]=function(_0xad2e10,_0x1e864c){try{if(this[_0xd482('0x1a')][_0xad2e10]){logger[_0xd482('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0xad2e10,_0x1e864c);this['channels'][_0xad2e10][_0xd482('0x6c')]=!![];if(_[_0xd482('0x6d')](_0x1e864c,_0xd482('0x6e'))){_0x1e864c=_0x1e864c[_0xd482('0x6f')](_0xd482('0x6e'),'.WAV');}this[_0xd482('0x1a')][_0xad2e10][_0xd482('0x70')]=_0x1e864c;var _0x330c0e=_[_0xd482('0x71')](this[_0xd482('0x1a')][_0xad2e10][_0xd482('0x72')],{'filename':_0x1e864c});if(_['isNil'](_0x330c0e)){this[_0xd482('0x1a')][_0xad2e10][_0xd482('0x72')][_0xd482('0x73')]({'filename':_0x1e864c,'createdAt':moment()[_0xd482('0x43')](_0xd482('0x44')),'mixmonitorid':'','status':_0xd482('0x74')});}}}catch(_0x53537f){logger['error'](_0xd482('0x75'),_0xad2e10,util[_0xd482('0x30')](_0x53537f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd482('0x76')]=function(_0x4deb9f){try{if(this[_0xd482('0x31')](_0x4deb9f)){logger[_0xd482('0x37')]('[%s][voiceCallReport][varset]\x20event:',_0x4deb9f[_0xd482('0x39')],util['inspect'](_0x4deb9f,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]]&&_0x4deb9f[_0xd482('0x3e')]!=_0xd482('0x3f')){if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')])){if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x78')])){logger[_0xd482('0x2c')](_0xd482('0x79'),_0x4deb9f['uniqueid'],_0x4deb9f['value']);this[_0xd482('0x6b')](_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);}else if(this['isNotNull'](_0x4deb9f['variable'][_0xd482('0x7b')])){logger[_0xd482('0x2c')](_0xd482('0x7c'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x36')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')]['xmd-callerid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x7d')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x7e')])){logger[_0xd482('0x2c')](_0xd482('0x7f'),_0x4deb9f['uniqueid'],_0x4deb9f[_0xd482('0x7a')]);this['channels'][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x80')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x81')])){logger[_0xd482('0x2c')](_0xd482('0x82'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')][_0xd482('0x49')](',')[0x0]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x10')]=_0x4deb9f['value']['split'](',')[0x0];}else if(this['isNotNull'](_0x4deb9f[_0xd482('0x77')][_0xd482('0x83')])){logger[_0xd482('0x2c')](_0xd482('0x84'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]]['originatecalleridnum']=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f['variable'][_0xd482('0x85')])){logger['info'](_0xd482('0x86'),_0x4deb9f['uniqueid'],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]]['destination']=_0x4deb9f[_0xd482('0x7a')];}else if(this['isNotNull'](_0x4deb9f[_0xd482('0x77')][_0xd482('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x88')]=_0x4deb9f[_0xd482('0x7a')];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x89')])){logger['info'](_0xd482('0x8a'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x10')]=_0x4deb9f['value'];}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')]['sipcallid'])){logger[_0xd482('0x2c')](_0xd482('0x8b'),_0x4deb9f[_0xd482('0x39')],_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x39')]][_0xd482('0x8c')]=_0x4deb9f[_0xd482('0x7a')];}}}else if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')][_0xd482('0x78')])){if(_0x4deb9f['value']){var _0x19ff0d=path[_0xd482('0x8d')](_0x4deb9f[_0xd482('0x7a')])['name'];logger[_0xd482('0x2c')](_0xd482('0x79'),_0x19ff0d,_0x4deb9f[_0xd482('0x7a')]);this[_0xd482('0x6b')](_0x19ff0d,_0x4deb9f[_0xd482('0x7a')]);}}else if(this[_0xd482('0x1a')][_0x4deb9f[_0xd482('0x3a')]]){if(this[_0xd482('0x31')](_0x4deb9f[_0xd482('0x77')])){if(this[_0xd482('0x31')](_0x4deb9f['variable'][_0xd482('0x8e')])){logger[_0xd482('0x2c')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4deb9f['linkedid'],_0x4deb9f[_0xd482('0x7a')]);this['channels'][_0x4deb9f['linkedid']][_0xd482('0x8f')]=_0x4deb9f[_0xd482('0x7a')];}}}}}catch(_0xecc8ee){logger['error'](_0xd482('0x90'),_0x4deb9f['uniqueid'],util[_0xd482('0x30')](_0xecc8ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')]['syncHangup']=function(_0x35a971){try{if(this[_0xd482('0x31')](_0x35a971)){logger[_0xd482('0x37')](_0xd482('0x91'),_0x35a971[_0xd482('0x39')],util['inspect'](_0x35a971,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]]){logger[_0xd482('0x2c')](_0xd482('0x92'),_0x35a971[_0xd482('0x39')],_0x35a971[_0xd482('0x93')]);var _0x249412=moment();this['channels'][_0x35a971[_0xd482('0x39')]]['endtime']=_0x249412[_0xd482('0x43')](_0xd482('0x44'));this['channels'][_0x35a971[_0xd482('0x39')]][_0xd482('0x56')]=_0x249412['diff'](this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x42')],_0xd482('0x58'));if(this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x62')]){this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x94')]=_0x249412['diff'](this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]]['answertime'],_0xd482('0x58'));this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x63')]=this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]]['duration']-this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x94')];}if(_0x35a971[_0xd482('0x41')]===_0xd482('0x48')){if(this['agents'][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]){this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]]=_['omit'](this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]],[_0xd482('0x4a')]);logger[_0xd482('0x37')](_0xd482('0x95'),_0x35a971[_0xd482('0x39')],util[_0xd482('0x30')]({'destaccountcode':this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')][_0xd482('0x49')]('-')[0x0]][_0xd482('0x50')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xd482('0x43')](_0xd482('0x4d'),this['agents'][_0x35a971[_0xd482('0x3e')]['split']('-')[0x0]]['name']),_0xd482('0x96'),{'destaccountcode':this[_0xd482('0x1b')][_0x35a971[_0xd482('0x3e')]['split']('-')[0x0]][_0xd482('0x50')]});}}if(_0x35a971['event']==='BlindTransfer'){this[_0xd482('0x97')][_0x35a971[_0xd482('0x39')]]=this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]];}else{if(this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x80')]===_0xd482('0x98')&&this['blindTransfers'][_0x35a971[_0xd482('0x39')]]){this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x39')]=[this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x3a')],this['channels'][_0x35a971[_0xd482('0x39')]][_0xd482('0x3a')]=this[_0xd482('0x1a')][_0x35a971[_0xd482('0x39')]][_0xd482('0x39')]][0x0];delete this['blindTransfers'][_0x35a971[_0xd482('0x39')]];}}logger[_0xd482('0x37')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x35a971[_0xd482('0x39')],util[_0xd482('0x30')](this[_0xd482('0x1a')][_0x35a971['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd482('0x99')]('custom:voiceCallReport',this[_0xd482('0x1a')][_0x35a971['uniqueid']]);delete this['channels'][_0x35a971['uniqueid']];}}}catch(_0x378fd1){logger[_0xd482('0x2e')](_0xd482('0x9a'),_0x35a971[_0xd482('0x39')],util[_0xd482('0x30')](_0x378fd1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd482('0x26')]=function(_0x5a9d07){try{if(this[_0xd482('0x31')](_0x5a9d07)){logger[_0xd482('0x2c')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5a9d07[_0xd482('0x39')],_0x5a9d07['origtransferercalleridnum'],_0x5a9d07[_0xd482('0x9b')]);logger[_0xd482('0x37')](_0xd482('0x9c'),_0x5a9d07[_0xd482('0x39')],util[_0xd482('0x30')](_0x5a9d07,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0x9d')]]){this[_0xd482('0x1a')][_0x5a9d07['transfereeuniqueid']][_0xd482('0x9e')]=_0x5a9d07[_0xd482('0x9f')];this['channels'][_0x5a9d07[_0xd482('0x9d')]][_0xd482('0xa0')]=_0x5a9d07[_0xd482('0x9b')];if(this['channels'][_0x5a9d07[_0xd482('0xa1')]]){var _0x5e3cfe=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa1')]];this[_0xd482('0x1a')][_0x5a9d07['secondtransfereruniqueid']]=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0x9d')]];this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0x9d')]]=_0x5e3cfe;}}else if(this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]]){this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]][_0xd482('0x9e')]=_0x5a9d07['origtransferercalleridnum'];this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]][_0xd482('0xa0')]=_0x5a9d07[_0xd482('0x9b')];if(this['channels'][_0x5a9d07[_0xd482('0xa3')]]){var _0x5e3cfe=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa3')]];this['channels'][_0x5a9d07[_0xd482('0xa3')]]=this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]];this[_0xd482('0x1a')][_0x5a9d07[_0xd482('0xa2')]]=_0x5e3cfe;}}}}catch(_0x326755){logger[_0xd482('0x2e')](_0xd482('0xa4'),_0x5a9d07[_0xd482('0x39')],util[_0xd482('0x30')](_0x326755,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0xa5')]=function(_0x1017ed){try{if(this[_0xd482('0x31')](_0x1017ed)){logger[_0xd482('0x2c')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1017ed['uniqueid'],_0x1017ed['transfereecalleridnum'],_0x1017ed['extension']);logger[_0xd482('0x37')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1017ed[_0xd482('0x39')],util[_0xd482('0x30')](_0x1017ed,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x1017ed[_0xd482('0x9d')]]){this[_0xd482('0x1a')][_0x1017ed[_0xd482('0x9d')]]['transfercalleridnum']=_0x1017ed[_0xd482('0xa6')];this['channels'][_0x1017ed[_0xd482('0x9d')]][_0xd482('0xa0')]=_0x1017ed['extension'];this[_0xd482('0x22')]({'event':'BlindTransfer','uniqueid':_0x1017ed['transfereeuniqueid'],'context':_0x1017ed[_0xd482('0x41')],'channel':_0x1017ed['transfererchannel']});}}}catch(_0x224b3e){logger['error'](_0xd482('0xa7'),_0x1017ed[_0xd482('0x39')],util[_0xd482('0x30')](_0x224b3e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x29')]=function(_0x44ed3){try{if(this[_0xd482('0x31')](_0x44ed3)){logger['debug'](_0xd482('0xa8'),_0x44ed3[_0xd482('0x39')],util[_0xd482('0x30')](_0x44ed3,{'showHidden':![],'depth':null}));if(this['channels'][_0x44ed3[_0xd482('0x39')]]){if(!_[_0xd482('0xa9')](this[_0xd482('0x1a')][_0x44ed3[_0xd482('0x39')]][_0xd482('0xaa')])){this['channels'][_0x44ed3[_0xd482('0x39')]][_0xd482('0xab')]=moment()[_0xd482('0x43')](_0xd482('0x44'));logger[_0xd482('0x2c')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x44ed3[_0xd482('0x39')],this[_0xd482('0x1a')][_0x44ed3[_0xd482('0x39')]][_0xd482('0xab')]);}}}}catch(_0x3d5d60){logger[_0xd482('0x2e')]('[%s][voiceCallReport][musiconholdstart]',_0x44ed3[_0xd482('0x39')],util[_0xd482('0x30')](_0x3d5d60,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd482('0x33')][_0xd482('0x2b')]=function(_0x166fe7){try{if(this[_0xd482('0x31')](_0x166fe7)){logger['debug'](_0xd482('0xac'),_0x166fe7[_0xd482('0x39')],util[_0xd482('0x30')](_0x166fe7,{'showHidden':![],'depth':null}));if(this[_0xd482('0x1a')][_0x166fe7[_0xd482('0x39')]]){if(!_[_0xd482('0xa9')](this[_0xd482('0x1a')][_0x166fe7[_0xd482('0x39')]]['mohstarttime'])){this['channels'][_0x166fe7[_0xd482('0x39')]]['mohtime']+=moment()[_0xd482('0xad')](0x0)[_0xd482('0x64')](this[_0xd482('0x1a')][_0x166fe7[_0xd482('0x39')]][_0xd482('0xab')],_0xd482('0x58'));logger[_0xd482('0x2c')](_0xd482('0xae'),_0x166fe7[_0xd482('0x39')],this['channels'][_0x166fe7[_0xd482('0x39')]][_0xd482('0xaf')]);delete this[_0xd482('0x1a')][_0x166fe7['uniqueid']][_0xd482('0xab')];}}}}catch(_0x4c7516){logger[_0xd482('0x2e')]('[%s][voiceCallReport][musiconholdstop]',_0x166fe7[_0xd482('0x39')],util[_0xd482('0x30')](_0x4c7516,{'showHidden':![],'depth':null}));}};module[_0xd482('0xb0')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 0b1c1d7..dac0ce4 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 _0x1dca=['channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%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]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','addVariable','variable','value','outboundrouteid','info','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','memberdynamic','memberinterface','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','answertime','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called'];(function(_0xda6d80,_0x29d67f){var _0x24e778=function(_0x1d5d5e){while(--_0x1d5d5e){_0xda6d80['push'](_0xda6d80['shift']());}};_0x24e778(++_0x29d67f);}(_0x1dca,0x17a));var _0xa1dc=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x1dca[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0xa1dc('0x0'));var moment=require(_0xa1dc('0x1'));var util=require('util');var Redis=require(_0xa1dc('0x2'));var config=require(_0xa1dc('0x3'));var logger=require(_0xa1dc('0x4'))(_0xa1dc('0x5'));var ami=require(_0xa1dc('0x6'));config[_0xa1dc('0x7')]=_[_0xa1dc('0x8')](config[_0xa1dc('0x7')],{'host':_0xa1dc('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x6eda90){this[_0xa1dc('0xa')]=_0x6eda90[_0xa1dc('0xb')];this[_0xa1dc('0xc')]=_0x6eda90['outbound'];this[_0xa1dc('0xd')]={};ami['on'](_0xa1dc('0xe'),this[_0xa1dc('0xf')][_0xa1dc('0x10')](this));ami['on']('dialend',this[_0xa1dc('0x11')][_0xa1dc('0x10')](this));ami['on'](_0xa1dc('0x12'),this[_0xa1dc('0x13')][_0xa1dc('0x10')](this));ami['on'](_0xa1dc('0x14'),this[_0xa1dc('0x15')][_0xa1dc('0x10')](this));}VoiceDialReport['prototype'][_0xa1dc('0x16')]=function(_0x29f99c){return _0x29f99c!==null&&!_[_0xa1dc('0x17')](_0x29f99c);};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x19')]=function(_0x452b92,_0x458087,_0x1b7312){io['to'](_0x452b92)[_0xa1dc('0x19')](_0x458087,_0x1b7312);};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0xf')]=function(_0x49bd91){try{if(this['isNotNull'](_0x49bd91)){logger[_0xa1dc('0x1a')](_0xa1dc('0x1b'),_0x49bd91[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x49bd91,{'showHidden':![],'depth':null}));if(this['channels'][_0x49bd91[_0xa1dc('0x1c')]]){_[_0xa1dc('0x1e')](this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]],{'starttime':moment()[_0xa1dc('0x1f')](_0xa1dc('0x20')),'lastevent':_0xa1dc('0x21'),'interface':_0x49bd91[_0xa1dc('0x22')]['substring'](0x0,_0x49bd91[_0xa1dc('0x22')]['lastIndexOf']('-')),'membername':_0x49bd91['channel'][_0xa1dc('0x23')](_0x49bd91['channel']['lastIndexOf']('/')+0x1,_0x49bd91['channel'][_0xa1dc('0x24')]('-'))},_[_0xa1dc('0x25')](_0x49bd91,[_0xa1dc('0x26'),_0xa1dc('0x27')]));logger['info'](_0xa1dc('0x28'),_0x49bd91[_0xa1dc('0x1c')],this[_0xa1dc('0xa')][_0x49bd91['uniqueid']][_0xa1dc('0x29')],this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]][_0xa1dc('0x2a')]);logger[_0xa1dc('0x1a')](_0xa1dc('0x2b'),_0x49bd91[_0xa1dc('0x1c')],util['inspect'](this['channels'][_0x49bd91[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),_0xa1dc('0x2d'),this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]]);logger[_0xa1dc('0x1a')](_0xa1dc('0x2e'),_0x49bd91[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x2f'),this[_0xa1dc('0xa')][_0x49bd91[_0xa1dc('0x1c')]]);}}}catch(_0x146b93){logger[_0xa1dc('0x30')](_0xa1dc('0x31'),_0x49bd91[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x146b93,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x11')]=function(_0x450953){try{if(this[_0xa1dc('0x16')](_0x450953)){logger['debug'](_0xa1dc('0x32'),_0x450953['uniqueid'],util[_0xa1dc('0x1d')](_0x450953,{'showHidden':![],'depth':null}));if(this['channels'][_0x450953[_0xa1dc('0x1c')]]){this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]]['dialstatus']=_0x450953[_0xa1dc('0x33')];if(_0x450953['dialstatus']===_0xa1dc('0x34')){this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]][_0xa1dc('0x35')]=_0x450953[_0xa1dc('0x35')];this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]][_0xa1dc('0x36')]=_0x450953[_0xa1dc('0x36')];this['channels'][_0x450953[_0xa1dc('0x1c')]]['answertime']=moment()[_0xa1dc('0x1f')](_0xa1dc('0x20'));this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]][_0xa1dc('0x37')]=_0xa1dc('0x38');logger['info'](_0xa1dc('0x39'),_0x450953[_0xa1dc('0x1c')],_0x450953[_0xa1dc('0x22')][_0xa1dc('0x23')](_0x450953[_0xa1dc('0x22')]['lastIndexOf']('/')+0x1,_0x450953[_0xa1dc('0x22')][_0xa1dc('0x24')]('-')));logger[_0xa1dc('0x1a')](_0xa1dc('0x3a'),_0x450953['uniqueid'],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x3b'),this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]]);}logger[_0xa1dc('0x1a')](_0xa1dc('0x3c'),_0x450953[_0xa1dc('0x1c')],util['inspect'](this[_0xa1dc('0xa')][_0x450953['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),_0xa1dc('0x2d'),this[_0xa1dc('0xa')][_0x450953[_0xa1dc('0x1c')]]);}}}catch(_0x35c7a7){logger[_0xa1dc('0x30')](_0xa1dc('0x3d'),_0x450953[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x35c7a7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x13')]=function(_0x512131){try{if(this[_0xa1dc('0x16')](_0x512131)){logger[_0xa1dc('0x1a')]('[%s][voiceDialReport][varset]\x20event:',_0x512131[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x512131,{'showHidden':![],'depth':null}));this[_0xa1dc('0x3e')](_0x512131[_0xa1dc('0x1c')],_['keys'](_0x512131[_0xa1dc('0x3f')])[0x0],_0x512131[_0xa1dc('0x40')]);if(this[_0xa1dc('0x16')](_0x512131[_0xa1dc('0x3f')])&&this[_0xa1dc('0x16')](_0x512131['variable'][_0xa1dc('0x41')])){if(_[_0xa1dc('0x17')](this[_0xa1dc('0xa')][_0x512131[_0xa1dc('0x1c')]])){this[_0xa1dc('0xa')][_0x512131[_0xa1dc('0x1c')]]={'routeId':_0x512131[_0xa1dc('0x40')],'variables':this[_0xa1dc('0xd')][_0x512131[_0xa1dc('0x1c')]]};logger[_0xa1dc('0x42')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x512131[_0xa1dc('0x1c')],_0x512131['variable']['outboundrouteid'],_[_0xa1dc('0x43')](_0x512131[_0xa1dc('0x3f')])[0x0],_0x512131['value']);logger[_0xa1dc('0x1a')](_0xa1dc('0x44'),_0x512131[_0xa1dc('0x1c')],util['inspect'](this[_0xa1dc('0xa')][_0x512131['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x512131[_0xa1dc('0x1c')]]);}}}}catch(_0x562994){logger[_0xa1dc('0x30')](_0xa1dc('0x45'),_0x512131[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](_0x562994,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa1dc('0x18')]['addVariable']=function(_0x3c1729,_0x256414,_0x59d7bd){var _0x360ea5=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xa1dc('0x46'),'rtpaudioqoslossbridged',_0xa1dc('0x47'),_0xa1dc('0x48'),_0xa1dc('0x49'),_0xa1dc('0x4a'),'bridgepeer','bridgepvtcallid','membercalls',_0xa1dc('0x4b'),_0xa1dc('0x4c'),'memberlastcall',_0xa1dc('0x29'),'memberpenalty',_0xa1dc('0x4d')];if(!_['isNil'](_0x256414)&&!_[_0xa1dc('0x4e')](_0x360ea5,_0x256414)){if(_[_0xa1dc('0x17')](this[_0xa1dc('0xd')][_0x3c1729])){this[_0xa1dc('0xd')][_0x3c1729]={};}this[_0xa1dc('0xd')][_0x3c1729][_0x256414]=_0x59d7bd;}};VoiceDialReport[_0xa1dc('0x18')][_0xa1dc('0x15')]=function(_0x56ca63){try{if(this[_0xa1dc('0x16')](_0x56ca63)){logger[_0xa1dc('0x1a')](_0xa1dc('0x4f'),_0x56ca63['uniqueid'],util[_0xa1dc('0x1d')](_0x56ca63,{'showHidden':![],'depth':null}));if(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]){logger[_0xa1dc('0x42')](_0xa1dc('0x50'),_0x56ca63[_0xa1dc('0x1c')],_0x56ca63[_0xa1dc('0x51')]);this['channels'][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x52')]=moment()['format'](_0xa1dc('0x20'));this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x53')]=moment(this['channels'][_0x56ca63['uniqueid']]['endtime'])[_0xa1dc('0x54')](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x55')],_0xa1dc('0x56'));this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x37')]=_0xa1dc('0x57');this[_0xa1dc('0xc')][_0xa1dc('0x58')]+=0x1;if(this[_0xa1dc('0xa')][_0x56ca63['uniqueid']]['answertime']){this[_0xa1dc('0xc')][_0xa1dc('0x59')]+=0x1;this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['holdtime']=moment(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x5a')])[_0xa1dc('0x54')](this['channels'][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x55')],_0xa1dc('0x56'));this['channels'][_0x56ca63[_0xa1dc('0x1c')]]['billableseconds']=moment(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['endtime'])['diff'](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x5a')],'seconds');this[_0xa1dc('0xc')][_0xa1dc('0x5b')]+=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]][_0xa1dc('0x5c')]||0x0;this[_0xa1dc('0xc')][_0xa1dc('0x5d')]+=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['billableseconds'];}this[_0xa1dc('0xc')][_0xa1dc('0x5e')]+=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]['duration'];logger[_0xa1dc('0x1a')](_0xa1dc('0x5f'),_0x56ca63[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this['channels'][_0x56ca63[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x60'),this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]);logger['debug'](_0xa1dc('0x61'),_0x56ca63[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x56ca63['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa1dc('0x19')](_0xa1dc('0x62'),this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]);logger[_0xa1dc('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x56ca63['uniqueid'],util[_0xa1dc('0x1d')](this['channels'][_0x56ca63['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),'voice_outbound:save',this[_0xa1dc('0xc')]);logger[_0xa1dc('0x42')](_0xa1dc('0x63'),JSON['stringify'](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]]));logger[_0xa1dc('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x56ca63[_0xa1dc('0x1c')],util[_0xa1dc('0x1d')](this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x1c')]],{'showHidden':![],'depth':null}));this[_0xa1dc('0x19')](_0xa1dc('0x2c'),'voice_outbound_channel:remove',this[_0xa1dc('0xa')][_0x56ca63['uniqueid']]);delete this['channels'][_0x56ca63[_0xa1dc('0x1c')]];}else if(this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x64')]]){this['channels'][_0x56ca63[_0xa1dc('0x64')]][_0xa1dc('0x1c')]=this[_0xa1dc('0xa')][_0x56ca63[_0xa1dc('0x64')]][_0xa1dc('0x65')];}if(this[_0xa1dc('0xd')][_0x56ca63[_0xa1dc('0x1c')]]){delete this[_0xa1dc('0xd')][_0x56ca63[_0xa1dc('0x1c')]];}}}catch(_0xcc5126){logger[_0xa1dc('0x30')](_0xa1dc('0x66'),_0x56ca63[_0xa1dc('0x1c')],util['inspect'](_0xcc5126,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x07e7=['variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberrealtime','isNil','includes','isUndefined','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','outbound','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','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','debug','uniqueid','merge','format','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice:outbound','[%s][voiceDialReport][varset]\x20event:','addVariable','keys'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x07e7,0x1e2));var _0x707e=function(_0x2b1a2b,_0x31cdda){_0x2b1a2b=_0x2b1a2b-0x0;var _0x31422a=_0x07e7[_0x2b1a2b];return _0x31422a;};'use strict';var _=require(_0x707e('0x0'));var moment=require(_0x707e('0x1'));var util=require(_0x707e('0x2'));var Redis=require(_0x707e('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x707e('0x4'));var ami=require(_0x707e('0x5'));config['redis']=_['defaults'](config[_0x707e('0x6')],{'host':_0x707e('0x7'),'port':0x18eb});var io=require(_0x707e('0x8'))(new Redis(config[_0x707e('0x6')]));function VoiceDialReport(_0x1ef2da){this[_0x707e('0x9')]=_0x1ef2da[_0x707e('0xa')];this['outbound']=_0x1ef2da['outbound'];this['variables']={};ami['on'](_0x707e('0xb'),this[_0x707e('0xc')][_0x707e('0xd')](this));ami['on'](_0x707e('0xe'),this['syncDialEnd']['bind'](this));ami['on'](_0x707e('0xf'),this[_0x707e('0x10')][_0x707e('0xd')](this));ami['on'](_0x707e('0x11'),this[_0x707e('0x12')][_0x707e('0xd')](this));}VoiceDialReport[_0x707e('0x13')][_0x707e('0x14')]=function(_0x33688c){return _0x33688c!==null&&!_['isUndefined'](_0x33688c);};VoiceDialReport[_0x707e('0x13')][_0x707e('0x15')]=function(_0xa15bc4,_0xd86f74,_0x4f09b5){io['to'](_0xa15bc4)[_0x707e('0x15')](_0xd86f74,_0x4f09b5);};VoiceDialReport[_0x707e('0x13')][_0x707e('0xc')]=function(_0x15cc02){try{if(this[_0x707e('0x14')](_0x15cc02)){logger[_0x707e('0x16')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x15cc02[_0x707e('0x17')],util['inspect'](_0x15cc02,{'showHidden':![],'depth':null}));if(this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]]){_[_0x707e('0x18')](this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]],{'starttime':moment()[_0x707e('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x15cc02[_0x707e('0x1a')][_0x707e('0x1b')](0x0,_0x15cc02[_0x707e('0x1a')][_0x707e('0x1c')]('-')),'membername':_0x15cc02[_0x707e('0x1a')]['substring'](_0x15cc02[_0x707e('0x1a')]['lastIndexOf']('/')+0x1,_0x15cc02[_0x707e('0x1a')][_0x707e('0x1c')]('-'))},_[_0x707e('0x1d')](_0x15cc02,[_0x707e('0x1e'),'privilege']));logger[_0x707e('0x1f')](_0x707e('0x20'),_0x15cc02['uniqueid'],this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]][_0x707e('0x21')],this[_0x707e('0x9')][_0x15cc02['uniqueid']][_0x707e('0x22')]);logger[_0x707e('0x16')](_0x707e('0x23'),_0x15cc02[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x15cc02['uniqueid']],{'showHidden':![],'depth':null}));this[_0x707e('0x15')]('voice:outbound','voice_outbound_channel:save',this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]]);logger[_0x707e('0x16')](_0x707e('0x25'),_0x15cc02[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]],{'showHidden':![],'depth':null}));ami['emit'](_0x707e('0x26'),this[_0x707e('0x9')][_0x15cc02[_0x707e('0x17')]]);}}}catch(_0x3282bf){logger[_0x707e('0x27')](_0x707e('0x28'),_0x15cc02[_0x707e('0x17')],util[_0x707e('0x24')](_0x3282bf,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x707e('0x13')][_0x707e('0x29')]=function(_0x391eb6){try{if(this[_0x707e('0x14')](_0x391eb6)){logger[_0x707e('0x16')](_0x707e('0x2a'),_0x391eb6[_0x707e('0x17')],util[_0x707e('0x24')](_0x391eb6,{'showHidden':![],'depth':null}));if(this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]]){this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]][_0x707e('0x2b')]=_0x391eb6[_0x707e('0x2b')];if(_0x391eb6[_0x707e('0x2b')]===_0x707e('0x2c')){this['channels'][_0x391eb6[_0x707e('0x17')]][_0x707e('0x2d')]=_0x391eb6[_0x707e('0x2d')];this[_0x707e('0x9')][_0x391eb6['uniqueid']][_0x707e('0x2e')]=_0x391eb6[_0x707e('0x2e')];this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]][_0x707e('0x2f')]=moment()['format'](_0x707e('0x30'));this['channels'][_0x391eb6['uniqueid']][_0x707e('0x31')]=_0x707e('0x32');logger['info'](_0x707e('0x33'),_0x391eb6[_0x707e('0x17')],_0x391eb6[_0x707e('0x1a')]['substring'](_0x391eb6[_0x707e('0x1a')][_0x707e('0x1c')]('/')+0x1,_0x391eb6['channel'][_0x707e('0x1c')]('-')));logger[_0x707e('0x16')](_0x707e('0x34'),_0x391eb6[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x391eb6['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x707e('0x15')](_0x707e('0x35'),this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]]);}logger[_0x707e('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x391eb6[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]],{'showHidden':![],'depth':null}));this[_0x707e('0x15')](_0x707e('0x36'),'voice_outbound_channel:save',this[_0x707e('0x9')][_0x391eb6[_0x707e('0x17')]]);}}}catch(_0x142566){logger[_0x707e('0x27')]('[%s][voiceDialReport][dialend]',_0x391eb6['uniqueid'],util[_0x707e('0x24')](_0x142566,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x4d397d){try{if(this[_0x707e('0x14')](_0x4d397d)){logger[_0x707e('0x16')](_0x707e('0x37'),_0x4d397d[_0x707e('0x17')],util[_0x707e('0x24')](_0x4d397d,{'showHidden':![],'depth':null}));this[_0x707e('0x38')](_0x4d397d[_0x707e('0x17')],_[_0x707e('0x39')](_0x4d397d[_0x707e('0x3a')])[0x0],_0x4d397d[_0x707e('0x3b')]);if(this[_0x707e('0x14')](_0x4d397d[_0x707e('0x3a')])&&this[_0x707e('0x14')](_0x4d397d[_0x707e('0x3a')][_0x707e('0x3c')])){if(_['isUndefined'](this[_0x707e('0x9')][_0x4d397d[_0x707e('0x17')]])){this['channels'][_0x4d397d[_0x707e('0x17')]]={'routeId':_0x4d397d[_0x707e('0x3b')],'variables':this[_0x707e('0x3d')][_0x4d397d[_0x707e('0x17')]]};logger[_0x707e('0x1f')](_0x707e('0x3e'),_0x4d397d['uniqueid'],_0x4d397d[_0x707e('0x3a')][_0x707e('0x3c')],_['keys'](_0x4d397d[_0x707e('0x3a')])[0x0],_0x4d397d[_0x707e('0x3b')]);logger['debug'](_0x707e('0x3f'),_0x4d397d[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x4d397d[_0x707e('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x707e('0x36'),'voice_outbound_channel:save',this[_0x707e('0x9')][_0x4d397d[_0x707e('0x17')]]);}}}}catch(_0x52841f){logger['error'](_0x707e('0x40'),_0x4d397d[_0x707e('0x17')],util[_0x707e('0x24')](_0x52841f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x707e('0x13')][_0x707e('0x38')]=function(_0x5af60e,_0x324dfe,_0xa2792b){var _0x2f6e39=[_0x707e('0x41'),'rtpaudioqosbridged',_0x707e('0x42'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x707e('0x43'),_0x707e('0x44'),_0x707e('0x45'),_0x707e('0x46'),_0x707e('0x47'),'bridgepeer',_0x707e('0x48'),_0x707e('0x49'),_0x707e('0x4a'),_0x707e('0x4b'),'memberlastcall',_0x707e('0x21'),'memberpenalty',_0x707e('0x4c')];if(!_[_0x707e('0x4d')](_0x324dfe)&&!_[_0x707e('0x4e')](_0x2f6e39,_0x324dfe)){if(_[_0x707e('0x4f')](this['variables'][_0x5af60e])){this[_0x707e('0x3d')][_0x5af60e]={};}this[_0x707e('0x3d')][_0x5af60e][_0x324dfe]=_0xa2792b;}};VoiceDialReport['prototype'][_0x707e('0x12')]=function(_0x56a971){try{if(this[_0x707e('0x14')](_0x56a971)){logger[_0x707e('0x16')](_0x707e('0x50'),_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](_0x56a971,{'showHidden':![],'depth':null}));if(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]){logger['info'](_0x707e('0x51'),_0x56a971['uniqueid'],_0x56a971[_0x707e('0x52')]);this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x53')]=moment()[_0x707e('0x19')](_0x707e('0x30'));this[_0x707e('0x9')][_0x56a971['uniqueid']][_0x707e('0x54')]=moment(this[_0x707e('0x9')][_0x56a971['uniqueid']][_0x707e('0x53')])[_0x707e('0x55')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x56')],_0x707e('0x57'));this[_0x707e('0x9')][_0x56a971['uniqueid']]['lastevent']=_0x707e('0x58');this['outbound'][_0x707e('0x59')]+=0x1;if(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x2f')]){this[_0x707e('0x5a')]['answered']+=0x1;this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x5b')]=moment(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x2f')])[_0x707e('0x55')](this['channels'][_0x56a971[_0x707e('0x17')]][_0x707e('0x56')],_0x707e('0x57'));this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x5c')]=moment(this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]['endtime'])[_0x707e('0x55')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]][_0x707e('0x2f')],_0x707e('0x57'));this[_0x707e('0x5a')][_0x707e('0x5d')]+=this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]['holdtime']||0x0;this['outbound'][_0x707e('0x5e')]+=this[_0x707e('0x9')][_0x56a971['uniqueid']]['billableseconds'];}this[_0x707e('0x5a')][_0x707e('0x5f')]+=this[_0x707e('0x9')][_0x56a971['uniqueid']]['duration'];logger[_0x707e('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x56a971['uniqueid'],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]],{'showHidden':![],'depth':null}));ami[_0x707e('0x15')](_0x707e('0x60'),this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]);logger['debug'](_0x707e('0x61'),_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]],{'showHidden':![],'depth':null}));ami[_0x707e('0x15')](_0x707e('0x62'),this['channels'][_0x56a971[_0x707e('0x17')]]);logger[_0x707e('0x16')](_0x707e('0x63'),_0x56a971['uniqueid'],util[_0x707e('0x24')](this['channels'][_0x56a971[_0x707e('0x17')]],{'showHidden':![],'depth':null}));this[_0x707e('0x15')](_0x707e('0x36'),_0x707e('0x64'),this[_0x707e('0x5a')]);logger['info'](_0x707e('0x65'),JSON[_0x707e('0x66')](this[_0x707e('0x9')][_0x56a971['uniqueid']]));logger[_0x707e('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](this[_0x707e('0x9')][_0x56a971['uniqueid']],{'showHidden':![],'depth':null}));this[_0x707e('0x15')](_0x707e('0x36'),_0x707e('0x67'),this[_0x707e('0x9')][_0x56a971[_0x707e('0x17')]]);delete this[_0x707e('0x9')][_0x56a971['uniqueid']];}else if(this['channels'][_0x56a971['linkedid']]){this[_0x707e('0x9')][_0x56a971[_0x707e('0x68')]][_0x707e('0x17')]=this[_0x707e('0x9')][_0x56a971['linkedid']][_0x707e('0x69')];}if(this[_0x707e('0x3d')][_0x56a971[_0x707e('0x17')]]){delete this[_0x707e('0x3d')][_0x56a971['uniqueid']];}}}catch(_0x31169a){logger['error'](_0x707e('0x6a'),_0x56a971[_0x707e('0x17')],util[_0x707e('0x24')](_0x31169a,{'showHidden':![],'depth':null}));}};module[_0x707e('0x6b')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 64cdf6b..ddc603a 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 _0xb98e=['originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save','emitVoiceQueueChannelRemove','name','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','queue','toNumber','callers','loggedin','queuesummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexit','add','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','reason','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','queuestatus','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceQueueReport][hangup]','length','milliseconds','diff','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][blindtransfer]','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','socket.io-emitter','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty'];(function(_0x59fa57,_0xde765f){var _0x5ef51c=function(_0x560042){while(--_0x560042){_0x59fa57['push'](_0x59fa57['shift']());}};_0x5ef51c(++_0xde765f);}(_0xb98e,0x184));var _0xeb98=function(_0x1c025d,_0x94d7cb){_0x1c025d=_0x1c025d-0x0;var _0x138538=_0xb98e[_0x1c025d];return _0x138538;};'use strict';var _=require(_0xeb98('0x0'));var moment=require(_0xeb98('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0xeb98('0x2'));var config=require(_0xeb98('0x3'));var logger=require(_0xeb98('0x4'))('ami');var ami=require(_0xeb98('0x5'));var QueueReport=require(_0xeb98('0x6'));config[_0xeb98('0x7')]=_['defaults'](config[_0xeb98('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb98('0x8'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xeb98('0x9')][_0xeb98('0xa')]=function(_0x3ca112){this[_0xeb98('0xb')]=this[_0xeb98('0xb')]?this[_0xeb98('0xb')][_0xeb98('0xc')](_0x3ca112):_0x3ca112();};function VoiceQueueReport(_0x23edb5){this['sequence']=new Sequence();this[_0xeb98('0xd')]={};this[_0xeb98('0xe')]=_0x23edb5[_0xeb98('0xe')];this[_0xeb98('0xf')]=_0x23edb5[_0xeb98('0x10')];this[_0xeb98('0x11')]=_0x23edb5[_0xeb98('0x11')];this[_0xeb98('0x12')]=!![];this[_0xeb98('0x13')]=_0x23edb5[_0xeb98('0x13')];this[_0xeb98('0x14')]={};ami['on']('queuesummary',this[_0xeb98('0x15')][_0xeb98('0x16')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x17'),this[_0xeb98('0x18')][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x19'),this[_0xeb98('0x1a')][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x1b'),this[_0xeb98('0x1c')][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x1d'),this[_0xeb98('0x1e')][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x1f'),this[_0xeb98('0x20')][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x21'),this[_0xeb98('0x22')][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x23'),this['syncHangup'][_0xeb98('0x16')](this));ami['on'](_0xeb98('0x24'),this['syncFullyBooted']['bind'](this));ami['on'](_0xeb98('0x25'),this[_0xeb98('0x26')]['bind'](this));ami['on']('musiconholdstop',this[_0xeb98('0x27')]['bind'](this));ami['on'](_0xeb98('0x28'),this[_0xeb98('0x29')]['bind'](this));ami['on'](_0xeb98('0x2a'),this[_0xeb98('0x2b')][_0xeb98('0x16')](this));this[_0xeb98('0x2c')]();this[_0xeb98('0x2d')]();}function clearChannels(_0x1fa721){if(!_[_0xeb98('0x2e')](_0x1fa721)){for(var _0x31928e in _0x1fa721){if(_0x1fa721[_0xeb98('0x2f')](_0x31928e)){delete _0x1fa721[_0x31928e];}}}}function clearCampaigns(_0x378284){if(!_[_0xeb98('0x2e')](_0x378284)){for(var _0x499ae8 in _0x378284){if(_0x378284[_0xeb98('0x2f')](_0x499ae8)){_0x378284[_0x499ae8][_0xeb98('0x30')]=0x0;}}}}function clearVoiceQueues(_0x45afdc){if(!_[_0xeb98('0x2e')](_0x45afdc)){for(var _0x296f65 in _0x45afdc){if(_0x45afdc[_0xeb98('0x2f')](_0x296f65)){_0x45afdc[_0x296f65][_0xeb98('0x30')]=0x0;_0x45afdc[_0x296f65][_0xeb98('0x31')]=0x0;_0x45afdc[_0x296f65][_0xeb98('0x32')]=0x0;_0x45afdc[_0x296f65][_0xeb98('0x33')]=0x0;_0x45afdc[_0x296f65][_0xeb98('0x34')]=!![];}}}}function clearAgentBooked(_0x37fdd6){if(!_['isEmpty'](_0x37fdd6)){for(var _0x23dc9f in _0x37fdd6){if(_0x37fdd6[_0xeb98('0x2f')](_0x23dc9f)){_0x37fdd6[_0x23dc9f][_0xeb98('0x35')]=!![];}}}}VoiceQueueReport[_0xeb98('0x9')]['clearZombieChannels']=function(){var _0x3d0f80=this;for(var _0x3998f0 in this[_0xeb98('0xf')]){if(this[_0xeb98('0xf')][_0xeb98('0x2f')](_0x3998f0)&&!this[_0xeb98('0xf')][_0x3998f0]['switch']){this['sequence'][_0xeb98('0xa')](function(){if(!_[_0xeb98('0x36')](_0x3d0f80[_0xeb98('0xf')][_0x3998f0])){return ami[_0xeb98('0x37')]({'action':_0xeb98('0x38'),'channel':_0x3d0f80[_0xeb98('0xf')][_0x3998f0][_0xeb98('0x39')]})[_0xeb98('0x3a')](function(_0x159bbb){if(_0x159bbb[_0xeb98('0x3b')]===_0xeb98('0x3c')){setTimeout(function(){if(_0x3d0f80[_0xeb98('0xf')][_0x3998f0]){delete _0x3d0f80[_0xeb98('0xf')][_0x3998f0];logger[_0xeb98('0x3d')](_0xeb98('0x3e'),_0x3998f0,util['inspect'](_0x159bbb,{'showHidden':![],'depth':null}));}if(_0x3d0f80[_0xeb98('0xd')][_0x3998f0]){delete _0x3d0f80[_0xeb98('0xd')][_0x3998f0];logger[_0xeb98('0x3d')]('[%s][voiceQueueReport][checkQueueReport]',_0x3998f0,util[_0xeb98('0x3f')](_0x159bbb,{'showHidden':![],'depth':null}));}if(_0x3d0f80[_0xeb98('0x14')][_0x3998f0]){delete _0x3d0f80['variables'][_0x3998f0];logger[_0xeb98('0x3d')](_0xeb98('0x40'),_0x3998f0,util[_0xeb98('0x3f')](_0x159bbb,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xeb98('0x3d')](_0xeb98('0x41'));clearChannels(this[_0xeb98('0xf')]);this[_0xeb98('0x42')](this['queueReports']);clearAgentBooked(this[_0xeb98('0xe')]);clearVoiceQueues(this[_0xeb98('0x11')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xeb98('0x9')]['clearQueueReport']=function(_0x166673){var _0x88a737=this;if(!_[_0xeb98('0x2e')](_0x166673)){for(var _0xcd1930 in _0x166673){if(_0x166673[_0xeb98('0x2f')](_0xcd1930)){_0x88a737['emitVoiceQueueChannelRemove'](_0x166673[_0xcd1930],'clearqueuereport');delete _0x166673[_0xcd1930];}}}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x43')]=function(_0x1ae437,_0xa4d8aa,_0x1b5ed2){io['to'](_0x1ae437)[_0xeb98('0x43')](_0xa4d8aa,_0x1b5ed2);};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x44')]=function(_0x300792,_0x341f50){logger[_0xeb98('0x45')](_0xeb98('0x46')+_0x341f50+_0xeb98('0x47'),_0x300792[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x300792,{'showHidden':![],'depth':null}));this['emit'](util[_0xeb98('0x49')](_0xeb98('0x4a'),_0x300792['name']),_0xeb98('0x4b'),_0x300792);};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x4c')]=function(_0x3e48ee,_0x212c31){logger[_0xeb98('0x45')]('[%s][voiceQueueReport]['+_0x212c31+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x3e48ee[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x3e48ee,{'showHidden':![],'depth':null}));this[_0xeb98('0x43')](util['format'](_0xeb98('0x4a'),_0x3e48ee[_0xeb98('0x4d')]),'voice_queue_channel:remove',_0x3e48ee);};VoiceQueueReport['prototype'][_0xeb98('0x4e')]=function(_0x43c065,_0x14c664){if(_0x43c065[_0xeb98('0x4f')]===_0xeb98('0x50')){var _0x599b32={'id':_0x43c065['id'],'name':_0x43c065[_0xeb98('0x4d')],'strategy':_0x43c065[_0xeb98('0x51')],'answered':_0x43c065[_0xeb98('0x52')],'available':_0x43c065[_0xeb98('0x53')],'loggedIn':_0x43c065[_0xeb98('0x54')],'pTalking':_0x43c065[_0xeb98('0x32')],'sumBillable':_0x43c065[_0xeb98('0x55')],'sumDuration':_0x43c065[_0xeb98('0x56')],'sumHoldTime':_0x43c065[_0xeb98('0x57')]||0x0,'talking':_0x43c065[_0xeb98('0x31')],'total':_0x43c065[_0xeb98('0x58')],'type':_0x43c065[_0xeb98('0x4f')],'unmanaged':_0x43c065[_0xeb98('0x59')],'abandoned':_0x43c065[_0xeb98('0x5a')],'waiting':_0x43c065[_0xeb98('0x33')]};if(_0x43c065[_0xeb98('0x5b')]){_0x599b32[_0xeb98('0x5b')]={'id':_0x43c065['Trunk']['id'],'name':_0x43c065[_0xeb98('0x5b')][_0xeb98('0x4d')],'active':_0x43c065['Trunk']['active'],'callerid':_0x43c065[_0xeb98('0x5b')]['callerid']};}if(_0x43c065['Interval']){_0x599b32['Interval']={'id':_0x43c065['Interval']['id'],'name':_0x43c065[_0xeb98('0x5c')][_0xeb98('0x4d')]};}var _0x248456=md5(JSON[_0xeb98('0x5d')](_0x599b32));if(_0x43c065[_0xeb98('0x5e')]!==_0x248456){_0x43c065[_0xeb98('0x5e')]=_0x248456;logger[_0xeb98('0x45')](_0xeb98('0x5f')+_0x14c664+_0xeb98('0x60'),util[_0xeb98('0x3f')](_0x599b32,{'showHidden':![],'depth':null}));this[_0xeb98('0x43')](util[_0xeb98('0x49')](_0xeb98('0x4a'),_0x599b32[_0xeb98('0x4d')]),_0xeb98('0x61'),_0x599b32);}}};VoiceQueueReport['prototype'][_0xeb98('0x62')]=function(_0x42289e){return _0x42289e!==null&&!_[_0xeb98('0x63')](_0x42289e);};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x2d')]=function(){var _0x27bf6c=this;setInterval(function(){_0x27bf6c[_0xeb98('0x64')]();ami[_0xeb98('0x37')]({'action':'queues'})['catch'](function(_0x1480ba){logger['error'](_0xeb98('0x65'),util[_0xeb98('0x3f')](_0x1480ba,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0xeb98('0x2c')]=function(){var _0x45e739=this;setInterval(function(){if(_0x45e739[_0xeb98('0x12')]){return ami[_0xeb98('0x37')]({'action':'queuesummary'})[_0xeb98('0x66')](function(_0x1eb002){_0x45e739[_0xeb98('0x12')]=![];})[_0xeb98('0x3a')](function(_0x4af6fd){logger['error'](_0xeb98('0x67'),util['inspect'](_0x4af6fd,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x15')]=function(_0x223d8e){try{if(this[_0xeb98('0x62')](_0x223d8e)&&this[_0xeb98('0x62')](_0x223d8e['queue'])){logger[_0xeb98('0x45')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xeb98('0x3f')](_0x223d8e,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x223d8e['queue']]){logger[_0xeb98('0x68')](_0xeb98('0x69'),_0x223d8e['queue']);var _0xb7aab6=_[_0xeb98('0x6a')](this[_0xeb98('0xf')],_0xeb98('0x6b'))[_0x223d8e['queue']]||0x0;var _0x2f5315=_0xb7aab6-_0x223d8e['callers'];if(this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]['waiting']!==_[_0xeb98('0x6c')](_0x223d8e[_0xeb98('0x6d')])||this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]][_0xeb98('0x54')]!==_['toNumber'](_0x223d8e[_0xeb98('0x6e')])||this['voiceQueues'][_0x223d8e[_0xeb98('0x6b')]]['available']!==_['toNumber'](_0x223d8e[_0xeb98('0x53')])||this[_0xeb98('0x11')][_0x223d8e['queue']][_0xeb98('0x31')]!==_0x2f5315){this['voiceQueues'][_0x223d8e['queue']][_0xeb98('0x33')]=_['toNumber'](_0x223d8e[_0xeb98('0x6d')]);this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]['loggedIn']=_[_0xeb98('0x6c')](_0x223d8e[_0xeb98('0x6e')]);this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]['available']=_['toNumber'](_0x223d8e[_0xeb98('0x53')]);this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]][_0xeb98('0x31')]=_0x2f5315>0x0?_0x2f5315:0x0;this['voiceQueues'][_0x223d8e[_0xeb98('0x6b')]][_0xeb98('0x31')]=this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]][_0xeb98('0x31')]>_[_0xeb98('0x6c')](_0x223d8e['loggedin'])?_[_0xeb98('0x6c')](_0x223d8e['loggedin']):this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]['talking'];this[_0xeb98('0x4e')](this[_0xeb98('0x11')][_0x223d8e['queue']],_0xeb98('0x6f'));}logger[_0xeb98('0x45')](_0xeb98('0x70'),util['inspect'](this[_0xeb98('0x11')][_0x223d8e['queue']],{'showHidden':![],'depth':null}));ami[_0xeb98('0x43')](_0xeb98('0x71'),this[_0xeb98('0x11')][_0x223d8e[_0xeb98('0x6b')]]);}}}catch(_0x27b9d3){logger[_0xeb98('0x3d')]('[voiceQueueReport][queuesummary]',util[_0xeb98('0x3f')](_0x27b9d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x72')]=function(_0x278149){logger[_0xeb98('0x45')](_0xeb98('0x73'),util[_0xeb98('0x3f')](_0x278149,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x18')]=function(_0x473c20){try{if(this[_0xeb98('0x62')](_0x473c20)){logger[_0xeb98('0x45')](_0xeb98('0x74'),_0x473c20['uniqueid'],util[_0xeb98('0x3f')](_0x473c20,{'showHidden':![],'depth':null}));if(_[_0xeb98('0x63')](this[_0xeb98('0xd')][_0x473c20['uniqueid']])){this[_0xeb98('0xd')][_0x473c20['uniqueid']]=[];this['channels'][_0x473c20['uniqueid']]={};}var _0x1377a5=new QueueReport();_0x1377a5[_0xeb98('0x4d')]=_0x473c20[_0xeb98('0x6b')];_0x1377a5['type']=this[_0xeb98('0x11')][_0x1377a5[_0xeb98('0x4d')]]&&this[_0xeb98('0x11')][_0x1377a5[_0xeb98('0x4d')]][_0xeb98('0x4f')]?this[_0xeb98('0x11')][_0x1377a5[_0xeb98('0x4d')]]['type']||_0xeb98('0x50'):_0xeb98('0x50');_0x1377a5[_0xeb98('0x6b')]=_0x473c20[_0xeb98('0x6b')];_0x1377a5[_0xeb98('0x75')]=moment()['format'](_0xeb98('0x76'));_0x1377a5['position']=_0x473c20[_0xeb98('0x77')];_0x1377a5[_0xeb98('0x78')]=_0x473c20[_0xeb98('0x78')];_0x1377a5[_0xeb98('0x48')]=_0x473c20[_0xeb98('0x48')];logger['info'](_0xeb98('0x79'),_0x1377a5[_0xeb98('0x4d')],_0x1377a5[_0xeb98('0x4f')]);_['merge'](_0x1377a5,_['pick'](_0x473c20,_['keys'](_0x1377a5)));this[_0xeb98('0xd')][_0x473c20['uniqueid']]['push'](_0x1377a5);this['channels'][_0x473c20[_0xeb98('0x48')]]=_0x1377a5;this[_0xeb98('0x44')](_0x1377a5,_0xeb98('0x17'));}}catch(_0x2696ae){logger[_0xeb98('0x3d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x473c20[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x2696ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x1a')]=function(_0xa4273e){try{if(this[_0xeb98('0x62')](_0xa4273e)){logger[_0xeb98('0x45')](_0xeb98('0x7a'),_0xa4273e[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0xa4273e,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0xa4273e['uniqueid']]){var _0x59323d=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0xa4273e[_0xeb98('0x48')]]);_0x59323d[_0xeb98('0x7c')]=![];_0x59323d[_0xeb98('0x7d')]=null;_0x59323d[_0xeb98('0x7e')]=_0xa4273e['holdtime'];_0x59323d[_0xeb98('0x7f')]=_0xa4273e['originalposition'];_0x59323d['queuecallerabandon']=!![];_0x59323d[_0xeb98('0x80')]=moment()['format'](_0xeb98('0x76'));_0x59323d[_0xeb98('0x81')]=_0xeb98('0x82');_0x59323d[_0xeb98('0x83')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x59323d[_0xeb98('0x4d')],_0x59323d[_0xeb98('0x4f')]);this[_0xeb98('0xf')][_0xa4273e[_0xeb98('0x48')]]=_0x59323d;this[_0xeb98('0x4c')](_0x59323d,_0xeb98('0x19'));}}}catch(_0x1521ad){logger[_0xeb98('0x3d')](_0xeb98('0x7a'),_0xa4273e[_0xeb98('0x48')],util['inspect'](_0x1521ad,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')]['syncQueueCallerLeave']=function(_0x3c9d1b){try{if(this[_0xeb98('0x62')](_0x3c9d1b)){logger[_0xeb98('0x45')](_0xeb98('0x84'),_0x3c9d1b[_0xeb98('0x48')],util['inspect'](_0x3c9d1b,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x3c9d1b['uniqueid']]){var _0x404ff6=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x3c9d1b[_0xeb98('0x48')]]);_0x404ff6[_0xeb98('0x85')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x404ff6[_0xeb98('0x86')]=_0x3c9d1b[_0xeb98('0x86')];_0x404ff6[_0xeb98('0x87')]=_0x3c9d1b['connectedlinename'];logger[_0xeb98('0x68')](_0xeb98('0x88'),_0x404ff6[_0xeb98('0x4d')],_0x404ff6[_0xeb98('0x4f')],_0x3c9d1b['connectedlinenum'],_0x3c9d1b[_0xeb98('0x87')]);this['channels'][_0x3c9d1b[_0xeb98('0x48')]]=_0x404ff6;this[_0xeb98('0x44')](_0x404ff6,'queuecallerleave');}}}catch(_0x458ea1){logger[_0xeb98('0x3d')](_0xeb98('0x84'),_0x3c9d1b[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x458ea1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x20')]=function(_0x9f8edb){try{if(this[_0xeb98('0x62')](_0x9f8edb)){logger[_0xeb98('0x45')](_0xeb98('0x89'),_0x9f8edb[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x9f8edb,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x9f8edb[_0xeb98('0x48')]]){var _0x2c52a9=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x9f8edb[_0xeb98('0x48')]]);_0x2c52a9[_0xeb98('0x7c')]=!![];_0x2c52a9['queuecallerexitreason']=_0xeb98('0x8a');logger[_0xeb98('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2c52a9[_0xeb98('0x4d')],_0x2c52a9[_0xeb98('0x4f')]);}}}catch(_0x5b6374){logger[_0xeb98('0x3d')]('[%s][voiceQueueReport][agentconnect]',_0x9f8edb[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x5b6374,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')]['syncAgentComplete']=function(_0x12a42e){try{if(this['isNotNull'](_0x12a42e)){logger[_0xeb98('0x45')](_0xeb98('0x8b'),_0x12a42e[_0xeb98('0x48')],util['inspect'](_0x12a42e,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x12a42e[_0xeb98('0x48')]]){var _0x54a372=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x12a42e['uniqueid']]);_0x54a372[_0xeb98('0x19')]=![];_0x54a372[_0xeb98('0x80')]=null;_0x54a372[_0xeb98('0x8c')]=!![];_0x54a372[_0xeb98('0x83')]=_0x12a42e[_0xeb98('0x8d')];_0x54a372[_0xeb98('0x7e')]=_0x12a42e[_0xeb98('0x7e')];_0x54a372[_0xeb98('0x7c')]=!![];_0x54a372['queuecallerexit']=![];_0x54a372[_0xeb98('0x8e')]=null;if(!_0x54a372[_0xeb98('0x8f')]){if(_0x12a42e['reason']==_0xeb98('0x8f')){_0x54a372[_0xeb98('0x81')]='COMPLETED';logger[_0xeb98('0x68')](_0xeb98('0x90'),_0x54a372[_0xeb98('0x4d')],_0x54a372['type']);}else{if(_[_0xeb98('0x91')](_0x12a42e[_0xeb98('0x39')][_0xeb98('0x92')](),_0xeb98('0x93'))){if(this['queueReports'][_0x12a42e['linkedid']]){var _0x563ea9=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x12a42e[_0xeb98('0x94')]]);_0x563ea9[_0xeb98('0x7c')]=![];_0x563ea9[_0xeb98('0x95')]=!![];_0x563ea9[_0xeb98('0x8e')]=moment(_0x54a372[_0xeb98('0x75')])[_0xeb98('0x96')](_0x12a42e['holdtime'],_0xeb98('0x97'))[_0xeb98('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x563ea9[_0xeb98('0x81')]=_0xeb98('0x98');_0x563ea9[_0xeb98('0x8f')]=!![];_0x563ea9[_0xeb98('0x99')]='FORWARD';_0x563ea9[_0xeb98('0x9a')]=_0x12a42e[_0xeb98('0x9b')];_0x563ea9[_0xeb98('0x9c')]=_0x12a42e[_0xeb98('0x48')];logger[_0xeb98('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x563ea9[_0xeb98('0x4d')],_0x563ea9['type']);var _0x3d5ac0=this['queueReports'][_0x12a42e[_0xeb98('0x94')]];this[_0xeb98('0xd')][_0x12a42e[_0xeb98('0x94')]]=this['queueReports'][_0x12a42e[_0xeb98('0x48')]];this[_0xeb98('0xd')][_0x12a42e['uniqueid']]=_0x3d5ac0;}}else{_0x54a372['queuecallerexitreason']=_0xeb98('0x9d')+_0x12a42e[_0xeb98('0x9e')]['toUpperCase']();logger[_0xeb98('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x54a372[_0xeb98('0x4d')],_0x54a372[_0xeb98('0x4f')],_0x54a372[_0xeb98('0x81')]);}}}this[_0xeb98('0xf')][_0x12a42e[_0xeb98('0x48')]]=_0x54a372;this['emitVoiceQueueChannelRemove'](_0x54a372,_0xeb98('0x1d'));}}}catch(_0x50432f){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x12a42e[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x50432f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')][_0xeb98('0x22')]=function(_0x41dca2){try{if(this['isNotNull'](_0x41dca2)){logger[_0xeb98('0x45')](_0xeb98('0x9f'),_0x41dca2[_0xeb98('0x48')],util['inspect'](_0x41dca2,{'showHidden':![],'depth':null}));this[_0xeb98('0xa0')](_0x41dca2[_0xeb98('0x48')],_[_0xeb98('0xa1')](_0x41dca2[_0xeb98('0xa2')])[0x0],_0x41dca2[_0xeb98('0xa3')]);if(this['queueReports'][_0x41dca2[_0xeb98('0x48')]]){var _0x441abe=_[_0xeb98('0x7b')](this[_0xeb98('0xd')][_0x41dca2['uniqueid']]);if(_0x441abe){if(this[_0xeb98('0x62')](_0x41dca2[_0xeb98('0xa2')])&&this[_0xeb98('0x62')](_0x41dca2[_0xeb98('0xa2')][_0xeb98('0xa4')])){switch(_0x41dca2[_0xeb98('0xa3')]){case _0xeb98('0xa5'):_0x441abe['queuecallerexit']=![];_0x441abe[_0xeb98('0x8e')]=null;break;case'TIMEOUT':_0x441abe[_0xeb98('0xa6')]=_0xeb98('0xa7');_0x441abe[_0xeb98('0x95')]=!![];_0x441abe[_0xeb98('0x8e')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x441abe['queuecallerleaveAt']=moment()[_0xeb98('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xeb98('0xa8'),_0x41dca2['uniqueid'],util['inspect'](_0x441abe,{'showHidden':![],'depth':null}));ami['emit'](_0xeb98('0xa9'),_0x441abe);break;default:_0x441abe[_0xeb98('0x95')]=!![];_0x441abe[_0xeb98('0x8e')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x441abe[_0xeb98('0x85')]=moment()[_0xeb98('0x49')](_0xeb98('0x76'));}_0x441abe[_0xeb98('0x19')]=![];_0x441abe['queuecallerabandonAt']=null;_0x441abe[_0xeb98('0x81')]=_0x41dca2[_0xeb98('0xa3')];this['channels'][_0x41dca2[_0xeb98('0x48')]]=_0x441abe;this[_0xeb98('0x4c')](_0x441abe,_0xeb98('0x21'));}else if(this[_0xeb98('0x62')](_0x41dca2['variable'])&&this[_0xeb98('0x62')](_0x41dca2[_0xeb98('0xa2')][_0xeb98('0xaa')])){if(!_0x441abe[_0xeb98('0x19')]){_0x441abe[_0xeb98('0x95')]=!![];_0x441abe['queuecallerexitAt']=moment()[_0xeb98('0x49')](_0xeb98('0x76'));_0x441abe[_0xeb98('0x81')]=_0xeb98('0xab');_0x441abe[_0xeb98('0x85')]=moment()['format'](_0xeb98('0x76'));this['channels'][_0x41dca2[_0xeb98('0x48')]]=_0x441abe;}}logger[_0xeb98('0x68')](_0xeb98('0xac'),_0x41dca2[_0xeb98('0x48')],_0x441abe[_0xeb98('0x4d')],_0x441abe['type'],_[_0xeb98('0xa1')](_0x41dca2['variable'])[0x0],_0x41dca2[_0xeb98('0xa3')]);_0x441abe[_0xeb98('0x14')]=this[_0xeb98('0x14')][_0x41dca2[_0xeb98('0x48')]];}}}}catch(_0x1184d4){logger['error'](_0xeb98('0x9f'),_0x41dca2[_0xeb98('0x48')],util[_0xeb98('0x3f')](_0x1184d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xeb98('0x9')]['addVariable']=function(_0x3a31dd,_0x8197c1,_0x4f48b0){var _0x581130=[_0xeb98('0xad'),'rtpaudioqosbridged',_0xeb98('0xae'),'rtpaudioqosjitterbridged',_0xeb98('0xaf'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xeb98('0xb0'),_0xeb98('0xb1'),_0xeb98('0xb2'),_0xeb98('0xb3'),_0xeb98('0xb4'),_0xeb98('0xb5'),_0xeb98('0xb6'),'memberinterface','memberlastcall',_0xeb98('0x8d'),_0xeb98('0xb7'),_0xeb98('0xb8')];if(!_['isNil'](_0x8197c1)&&!_[_0xeb98('0xb9')](_0x581130,_0x8197c1)){if(_[_0xeb98('0x63')](this[_0xeb98('0x14')][_0x3a31dd])){this[_0xeb98('0x14')][_0x3a31dd]={};}this[_0xeb98('0x14')][_0x3a31dd][_0x8197c1]=_0x4f48b0;}};VoiceQueueReport['prototype'][_0xeb98('0xba')]=function(_0x15da8d){try{if(this[_0xeb98('0x62')](_0x15da8d)){logger[_0xeb98('0x45')](_0xeb98('0xbb'),_0x15da8d[_0xeb98('0x48')],util['inspect'](_0x15da8d,{'showHidden':![],'depth':null}));if(this[_0xeb98('0xd')][_0x15da8d[_0xeb98('0x48')]]){for(var _0x1d16e3=0x0,_0x276edc={};_0x1d16e30x0?_0xad9e4a:0x0;this[_0x7dac('0x3c')][_0xbac1b['queue']]['talking']=this[_0x7dac('0x3c')][_0xbac1b['queue']]['talking']>_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x68')])?_[_0x7dac('0x67')](_0xbac1b[_0x7dac('0x68')]):this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]]['talking'];this[_0x7dac('0x49')](this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]],_0x7dac('0x11'));}logger[_0x7dac('0x46')](_0x7dac('0x6b'),util['inspect'](this['voiceQueues'][_0xbac1b[_0x7dac('0x63')]],{'showHidden':![],'depth':null}));ami[_0x7dac('0x3f')](_0x7dac('0x6c'),this[_0x7dac('0x3c')][_0xbac1b[_0x7dac('0x63')]]);}}}catch(_0xb54ef9){logger[_0x7dac('0x35')]('[voiceQueueReport][queuesummary]',util[_0x7dac('0x36')](_0xb54ef9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x15')]=function(_0x30ca59){logger['debug'](_0x7dac('0x6d'),util[_0x7dac('0x36')](_0x30ca59,{'showHidden':![],'depth':null}));this[_0x7dac('0xf')]=!![];};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x6e')]=function(_0x215972){try{if(this['isNotNull'](_0x215972)){logger[_0x7dac('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x215972['uniqueid'],util[_0x7dac('0x36')](_0x215972,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7dac('0xc')][_0x215972['uniqueid']])){this['queueReports'][_0x215972[_0x7dac('0x42')]]=[];this[_0x7dac('0xe')][_0x215972[_0x7dac('0x42')]]={};}var _0xfe88bc=new QueueReport();_0xfe88bc[_0x7dac('0x4c')]=_0x215972['queue'];_0xfe88bc[_0x7dac('0x4a')]=this[_0x7dac('0x3c')][_0xfe88bc[_0x7dac('0x4c')]]&&this['voiceQueues'][_0xfe88bc[_0x7dac('0x4c')]][_0x7dac('0x4a')]?this[_0x7dac('0x3c')][_0xfe88bc[_0x7dac('0x4c')]]['type']||_0x7dac('0x4b'):_0x7dac('0x4b');_0xfe88bc[_0x7dac('0x63')]=_0x215972[_0x7dac('0x63')];_0xfe88bc[_0x7dac('0x6f')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0xfe88bc[_0x7dac('0x71')]=_0x215972['position'];_0xfe88bc[_0x7dac('0x72')]=_0x215972[_0x7dac('0x72')];_0xfe88bc[_0x7dac('0x42')]=_0x215972[_0x7dac('0x42')];logger[_0x7dac('0x64')](_0x7dac('0x73'),_0xfe88bc['name'],_0xfe88bc['type']);_[_0x7dac('0x74')](_0xfe88bc,_[_0x7dac('0x75')](_0x215972,_[_0x7dac('0x76')](_0xfe88bc)));this['queueReports'][_0x215972[_0x7dac('0x42')]]['push'](_0xfe88bc);this['channels'][_0x215972[_0x7dac('0x42')]]=_0xfe88bc;this[_0x7dac('0x40')](_0xfe88bc,_0x7dac('0x16'));}}catch(_0x42e988){logger[_0x7dac('0x35')](_0x7dac('0x77'),_0x215972[_0x7dac('0x42')],util['inspect'](_0x42e988,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x78')]=function(_0x2f48be){try{if(this['isNotNull'](_0x2f48be)){logger[_0x7dac('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2f48be['uniqueid'],util[_0x7dac('0x36')](_0x2f48be,{'showHidden':![],'depth':null}));if(this[_0x7dac('0xc')][_0x2f48be[_0x7dac('0x42')]]){var _0x2302e=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x2f48be['uniqueid']]);_0x2302e[_0x7dac('0x7a')]=![];_0x2302e[_0x7dac('0x7b')]=null;_0x2302e[_0x7dac('0x7c')]=_0x2f48be[_0x7dac('0x7c')];_0x2302e[_0x7dac('0x7d')]=_0x2f48be[_0x7dac('0x7d')];_0x2302e[_0x7dac('0x7e')]=!![];_0x2302e[_0x7dac('0x7f')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0x2302e[_0x7dac('0x80')]=_0x7dac('0x81');_0x2302e['lastAssignedTo']=null;logger[_0x7dac('0x64')](_0x7dac('0x82'),_0x2302e[_0x7dac('0x4c')],_0x2302e[_0x7dac('0x4a')]);this[_0x7dac('0xe')][_0x2f48be[_0x7dac('0x42')]]=_0x2302e;this[_0x7dac('0x3d')](_0x2302e,_0x7dac('0x7e'));}}}catch(_0x4eaf8f){logger[_0x7dac('0x35')]('[%s][voiceQueueReport][queuecallerabandon]',_0x2f48be['uniqueid'],util['inspect'](_0x4eaf8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')][_0x7dac('0x18')]=function(_0x44da17){try{if(this[_0x7dac('0x5c')](_0x44da17)){logger[_0x7dac('0x46')](_0x7dac('0x83'),_0x44da17[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x44da17,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44da17[_0x7dac('0x42')]]){var _0x440bf3=_['last'](this[_0x7dac('0xc')][_0x44da17[_0x7dac('0x42')]]);_0x440bf3[_0x7dac('0x84')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0x440bf3[_0x7dac('0x85')]=_0x44da17[_0x7dac('0x85')];_0x440bf3['connectedlinename']=_0x44da17[_0x7dac('0x86')];logger[_0x7dac('0x64')](_0x7dac('0x87'),_0x440bf3[_0x7dac('0x4c')],_0x440bf3['type'],_0x44da17[_0x7dac('0x85')],_0x44da17[_0x7dac('0x86')]);this['channels'][_0x44da17[_0x7dac('0x42')]]=_0x440bf3;this['emitVoiceQueueChannelSave'](_0x440bf3,_0x7dac('0x17'));}}}catch(_0x366a6a){logger[_0x7dac('0x35')]('[%s][voiceQueueReport][queuecallerleave]',_0x44da17[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x366a6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')]['syncAgentConnect']=function(_0x5cec6b){try{if(this[_0x7dac('0x5c')](_0x5cec6b)){logger[_0x7dac('0x46')](_0x7dac('0x88'),_0x5cec6b['uniqueid'],util[_0x7dac('0x36')](_0x5cec6b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5cec6b[_0x7dac('0x42')]]){var _0xd96311=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x5cec6b[_0x7dac('0x42')]]);_0xd96311[_0x7dac('0x7a')]=!![];_0xd96311[_0x7dac('0x80')]=_0x7dac('0x89');logger[_0x7dac('0x64')](_0x7dac('0x8a'),_0xd96311[_0x7dac('0x4c')],_0xd96311['type']);}}}catch(_0x8eea79){logger[_0x7dac('0x35')](_0x7dac('0x88'),_0x5cec6b[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x8eea79,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7dac('0x8b')]=function(_0x75dc3a){try{if(this[_0x7dac('0x5c')](_0x75dc3a)){logger[_0x7dac('0x46')](_0x7dac('0x8c'),_0x75dc3a[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x75dc3a,{'showHidden':![],'depth':null}));if(this[_0x7dac('0xc')][_0x75dc3a[_0x7dac('0x42')]]){var _0x4c3803=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x75dc3a['uniqueid']]);_0x4c3803[_0x7dac('0x7e')]=![];_0x4c3803[_0x7dac('0x7f')]=null;_0x4c3803[_0x7dac('0x8d')]=!![];_0x4c3803['lastAssignedTo']=_0x75dc3a[_0x7dac('0x8e')];_0x4c3803[_0x7dac('0x7c')]=_0x75dc3a[_0x7dac('0x7c')];_0x4c3803['queuecallercomplete']=!![];_0x4c3803[_0x7dac('0x8f')]=![];_0x4c3803[_0x7dac('0x90')]=null;if(!_0x4c3803[_0x7dac('0x91')]){if(_0x75dc3a[_0x7dac('0x92')]==_0x7dac('0x91')){_0x4c3803[_0x7dac('0x80')]='COMPLETED';logger[_0x7dac('0x64')](_0x7dac('0x93'),_0x4c3803[_0x7dac('0x4c')],_0x4c3803[_0x7dac('0x4a')]);}else{if(_[_0x7dac('0x94')](_0x75dc3a[_0x7dac('0x95')][_0x7dac('0x96')](),_0x7dac('0x97'))){if(this[_0x7dac('0xc')][_0x75dc3a['linkedid']]){var _0x25f93f=_[_0x7dac('0x79')](this[_0x7dac('0xc')][_0x75dc3a[_0x7dac('0x98')]]);_0x25f93f['queuecallercomplete']=![];_0x25f93f['queuecallerexit']=!![];_0x25f93f[_0x7dac('0x90')]=moment(_0x4c3803['queuecallerjoinAt'])[_0x7dac('0x99')](_0x75dc3a[_0x7dac('0x7c')],_0x7dac('0x9a'))[_0x7dac('0x43')](_0x7dac('0x70'));_0x25f93f[_0x7dac('0x80')]='FORWARDTRANSFER';_0x25f93f[_0x7dac('0x91')]=!![];_0x25f93f[_0x7dac('0x9b')]=_0x7dac('0x9c');_0x25f93f['transferexten']=_0x75dc3a['destexten'];_0x25f93f[_0x7dac('0x9d')]=_0x75dc3a[_0x7dac('0x42')];logger[_0x7dac('0x64')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x25f93f['name'],_0x25f93f[_0x7dac('0x4a')]);var _0xc386b1=this['queueReports'][_0x75dc3a[_0x7dac('0x98')]];this[_0x7dac('0xc')][_0x75dc3a['linkedid']]=this[_0x7dac('0xc')][_0x75dc3a['uniqueid']];this[_0x7dac('0xc')][_0x75dc3a[_0x7dac('0x42')]]=_0xc386b1;}}else{_0x4c3803[_0x7dac('0x80')]=_0x7dac('0x9e')+_0x75dc3a[_0x7dac('0x92')][_0x7dac('0x9f')]();logger[_0x7dac('0x64')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4c3803[_0x7dac('0x4c')],_0x4c3803[_0x7dac('0x4a')],_0x4c3803[_0x7dac('0x80')]);}}}this['channels'][_0x75dc3a['uniqueid']]=_0x4c3803;this['emitVoiceQueueChannelRemove'](_0x4c3803,_0x7dac('0x19'));}}}catch(_0x385e0d){logger[_0x7dac('0x35')](_0x7dac('0x8c'),_0x75dc3a[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x385e0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')]['syncVarSet']=function(_0x38f35e){try{if(this[_0x7dac('0x5c')](_0x38f35e)){logger[_0x7dac('0x46')](_0x7dac('0xa0'),_0x38f35e[_0x7dac('0x42')],util[_0x7dac('0x36')](_0x38f35e,{'showHidden':![],'depth':null}));this[_0x7dac('0xa1')](_0x38f35e[_0x7dac('0x42')],_[_0x7dac('0x76')](_0x38f35e[_0x7dac('0xa2')])[0x0],_0x38f35e[_0x7dac('0xa3')]);if(this['queueReports'][_0x38f35e[_0x7dac('0x42')]]){var _0x1cbb3f=_[_0x7dac('0x79')](this['queueReports'][_0x38f35e[_0x7dac('0x42')]]);if(_0x1cbb3f){if(this[_0x7dac('0x5c')](_0x38f35e['variable'])&&this[_0x7dac('0x5c')](_0x38f35e[_0x7dac('0xa2')]['queuestatus'])){switch(_0x38f35e[_0x7dac('0xa3')]){case _0x7dac('0xa4'):_0x1cbb3f['queuecallerexit']=![];_0x1cbb3f[_0x7dac('0x90')]=null;break;case'TIMEOUT':_0x1cbb3f[_0x7dac('0xa5')]=_0x7dac('0xa6');_0x1cbb3f[_0x7dac('0x8f')]=!![];_0x1cbb3f[_0x7dac('0x90')]=moment()[_0x7dac('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cbb3f['queuecallerleaveAt']=moment()[_0x7dac('0x43')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x7dac('0x46')](_0x7dac('0xa7'),_0x38f35e['uniqueid'],util[_0x7dac('0x36')](_0x1cbb3f,{'showHidden':![],'depth':null}));ami[_0x7dac('0x3f')]('custom:timeout',_0x1cbb3f);break;default:_0x1cbb3f[_0x7dac('0x8f')]=!![];_0x1cbb3f[_0x7dac('0x90')]=moment()[_0x7dac('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cbb3f[_0x7dac('0x84')]=moment()['format'](_0x7dac('0x70'));}_0x1cbb3f[_0x7dac('0x7e')]=![];_0x1cbb3f[_0x7dac('0x7f')]=null;_0x1cbb3f[_0x7dac('0x80')]=_0x38f35e[_0x7dac('0xa3')];this['channels'][_0x38f35e[_0x7dac('0x42')]]=_0x1cbb3f;this[_0x7dac('0x3d')](_0x1cbb3f,_0x7dac('0x1b'));}else if(this[_0x7dac('0x5c')](_0x38f35e[_0x7dac('0xa2')])&&this['isNotNull'](_0x38f35e[_0x7dac('0xa2')]['queueposition'])){if(!_0x1cbb3f[_0x7dac('0x7e')]){_0x1cbb3f[_0x7dac('0x8f')]=!![];_0x1cbb3f['queuecallerexitAt']=moment()[_0x7dac('0x43')](_0x7dac('0x70'));_0x1cbb3f['queuecallerexitreason']='EXITWITHKEY';_0x1cbb3f[_0x7dac('0x84')]=moment()[_0x7dac('0x43')](_0x7dac('0x70'));this[_0x7dac('0xe')][_0x38f35e[_0x7dac('0x42')]]=_0x1cbb3f;}}logger[_0x7dac('0x64')](_0x7dac('0xa8'),_0x38f35e[_0x7dac('0x42')],_0x1cbb3f[_0x7dac('0x4c')],_0x1cbb3f['type'],_[_0x7dac('0x76')](_0x38f35e[_0x7dac('0xa2')])[0x0],_0x38f35e['value']);_0x1cbb3f[_0x7dac('0x37')]=this['variables'][_0x38f35e[_0x7dac('0x42')]];}}}}catch(_0x541eca){logger['error'](_0x7dac('0xa0'),_0x38f35e[_0x7dac('0x42')],util['inspect'](_0x541eca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7dac('0x39')]['addVariable']=function(_0x39d238,_0xff215,_0xf4dbe9){var _0xb4ade9=[_0x7dac('0xa9'),'rtpaudioqosbridged',_0x7dac('0xaa'),'rtpaudioqosjitterbridged',_0x7dac('0xab'),'rtpaudioqoslossbridged',_0x7dac('0xac'),'rtpaudioqosrttbridged','sipcallid',_0x7dac('0xad'),_0x7dac('0xae'),_0x7dac('0xaf'),'membercalls',_0x7dac('0xb0'),_0x7dac('0xb1'),_0x7dac('0xb2'),_0x7dac('0x8e'),_0x7dac('0xb3'),_0x7dac('0xb4')];if(!_[_0x7dac('0x2f')](_0xff215)&&!_[_0x7dac('0xb5')](_0xb4ade9,_0xff215)){if(_[_0x7dac('0x5d')](this[_0x7dac('0x37')][_0x39d238])){this[_0x7dac('0x37')][_0x39d238]={};}this[_0x7dac('0x37')][_0x39d238][_0xff215]=_0xf4dbe9;}};VoiceQueueReport['prototype'][_0x7dac('0x1e')]=function(_0x5d45a6){try{if(this[_0x7dac('0x5c')](_0x5d45a6)){logger['debug'](_0x7dac('0xb6'),_0x5d45a6[_0x7dac('0x42')],util['inspect'](_0x5d45a6,{'showHidden':![],'depth':null}));if(this[_0x7dac('0xc')][_0x5d45a6['uniqueid']]){for(var _0x596dc7=0x0,_0x5d6409={};_0x596dc7=0x0?moment(_0x69a7bd[_0x1781('0x1a')])[_0x1781('0xf')](_0x69a7bd[_0x1781('0x19')],_0x1781('0x10')):null,'data1':_0x1781('0x1b'),'data2':_0x69a7bd[_0x1781('0x15')],'data3':_0x69a7bd[_0x1781('0x13')],'data4':_0x69a7bd[_0x1781('0x1c')]||null,'role':_0x1781('0x14'),'internal':_0x69a7bd[_0x1781('0x15')]?_[_0x1781('0x1d')](_0x69a7bd[_0x1781('0x15')]):undefined,'uniqueid':_0x69a7bd['uniqueid']},'log':_0x1781('0x7')});}; \ No newline at end of file +var _0xc0b9=['moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','interface','starttime','endtime','dialstring'];(function(_0x195b5e,_0x8545ca){var _0x26a4ee=function(_0x47ec7d){while(--_0x47ec7d){_0x195b5e['push'](_0x195b5e['shift']());}};_0x26a4ee(++_0x8545ca);}(_0xc0b9,0xfc));var _0x9c0b=function(_0x25c9f2,_0x524545){_0x25c9f2=_0x25c9f2-0x0;var _0x24442e=_0xc0b9[_0x25c9f2];return _0x24442e;};'use strict';var moment=require(_0x9c0b('0x0'));var _=require('lodash');var util=require(_0x9c0b('0x1'));var client=require('../client');exports[_0x9c0b('0x2')]=function(_0xf86a26){var _0x5ed290=_0xf86a26[_0x9c0b('0x3')]||_0xf86a26[_0x9c0b('0x4')];return client[_0x9c0b('0x5')](_0x9c0b('0x6'),{'body':{'channel':_0x9c0b('0x7'),'membername':_0xf86a26[_0x9c0b('0x8')],'interface':_[_0x9c0b('0x9')](_0xf86a26['interface'])?util[_0x9c0b('0xa')](_0x9c0b('0xb'),_0xf86a26[_0x9c0b('0x8')]):_0xf86a26['interface'],'type':_0x9c0b('0xc'),'enterAt':_0xf86a26[_0x9c0b('0xd')],'exitAt':_0x5ed290,'duration':moment(_0x5ed290)[_0x9c0b('0xe')](_0xf86a26[_0x9c0b('0xd')],_0x9c0b('0xf')),'data1':_0x9c0b('0x10'),'data2':_0xf86a26[_0x9c0b('0x11')],'data3':_0xf86a26['exten'],'data4':null,'data5':_0xf86a26[_0x9c0b('0x12')],'role':_0x9c0b('0x13'),'internal':_0xf86a26[_0x9c0b('0x14')]?_[_0x9c0b('0x15')](_0xf86a26[_0x9c0b('0x14')]):undefined,'uniqueid':_0xf86a26[_0x9c0b('0x16')]},'log':_0x9c0b('0x6')});};exports[_0x9c0b('0x17')]=function(_0x5862a2){return client[_0x9c0b('0x5')]('CreateMemberReport',{'body':{'channel':_0x9c0b('0x7'),'membername':_0x5862a2['membername'],'interface':_0x5862a2[_0x9c0b('0x18')],'type':'TALKING','enterAt':_0x5862a2[_0x9c0b('0x19')],'exitAt':_0x5862a2['endtime'],'duration':moment(_0x5862a2[_0x9c0b('0x1a')])[_0x9c0b('0xe')](_0x5862a2[_0x9c0b('0x19')],_0x9c0b('0xf'))>=0x0?moment(_0x5862a2[_0x9c0b('0x1a')])[_0x9c0b('0xe')](_0x5862a2['starttime'],'seconds'):null,'data1':'outbound','data2':_0x5862a2[_0x9c0b('0x14')],'data3':_0x5862a2['exten'],'data4':_0x5862a2[_0x9c0b('0x1b')]||null,'role':'agent','internal':_0x5862a2[_0x9c0b('0x14')]?_[_0x9c0b('0x15')](_0x5862a2[_0x9c0b('0x14')]):undefined,'uniqueid':_0x5862a2[_0x9c0b('0x16')]},'log':_0x9c0b('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4bdf910..08e400d 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 _0x4746=['GetTemplate','name','html','../client','getTemplates'];(function(_0x248476,_0x216cad){var _0x3c126a=function(_0x5e1879){while(--_0x5e1879){_0x248476['push'](_0x248476['shift']());}};_0x3c126a(++_0x216cad);}(_0x4746,0xc6));var _0x6474=function(_0x521b5e,_0x28e147){_0x521b5e=_0x521b5e-0x0;var _0x2b9ded=_0x4746[_0x521b5e];return _0x2b9ded;};'use strict';var client=require(_0x6474('0x0'));exports[_0x6474('0x1')]=function(_0x5b12a8){return function(_0x20751a){return client['Request'](_0x6474('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6474('0x3'),_0x6474('0x4')]},'log':_0x6474('0x2')});};}; \ No newline at end of file +var _0x34b7=['name','html','Request','GetTemplate'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x34b7,0x196));var _0x734b=function(_0x3055ab,_0x4d1f74){_0x3055ab=_0x3055ab-0x0;var _0x31d336=_0x34b7[_0x3055ab];return _0x31d336;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x43a5f1){return function(_0x1aedd0){return client[_0x734b('0x0')](_0x734b('0x1'),{'options':{'raw':!![],'attributes':['id',_0x734b('0x2'),_0x734b('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c935821..e63ca83 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 _0x6fbe=['Request','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data3','data4','data5','data7','GetTrigger','../client','getTriggers'];(function(_0x5d325a,_0x3e9be8){var _0x262ba7=function(_0x42943e){while(--_0x42943e){_0x5d325a['push'](_0x5d325a['shift']());}};_0x262ba7(++_0x3e9be8);}(_0x6fbe,0xd0));var _0xe6fb=function(_0x20e5aa,_0x453a69){_0x20e5aa=_0x20e5aa-0x0;var _0x4fb35d=_0x6fbe[_0x20e5aa];return _0x4fb35d;};'use strict';var client=require(_0xe6fb('0x0'));exports[_0xe6fb('0x1')]=function(_0x3cfd6d){return function(_0x19529c){return client[_0xe6fb('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xe6fb('0x3'),_0xe6fb('0x4'),_0xe6fb('0x5')],'include':[{'model':_0xe6fb('0x6'),'as':_0xe6fb('0x7'),'attributes':['id',_0xe6fb('0x8'),_0xe6fb('0x9'),_0xe6fb('0xa')]},{'model':_0xe6fb('0x6'),'as':_0xe6fb('0xb'),'attributes':['id',_0xe6fb('0x8'),_0xe6fb('0x9'),_0xe6fb('0xa')]},{'model':_0xe6fb('0xc'),'as':_0xe6fb('0xd'),'attributes':['id',_0xe6fb('0xe'),_0xe6fb('0xf'),'data2',_0xe6fb('0x10'),_0xe6fb('0x11'),_0xe6fb('0x12'),'data6',_0xe6fb('0x13')]}]},'log':_0xe6fb('0x14')});};}; \ No newline at end of file +var _0x0063=['data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','AnyConditions','field','Actions','data3','data4','data5'];(function(_0x207832,_0x2fbd09){var _0x57cfcb=function(_0x53bd96){while(--_0x53bd96){_0x207832['push'](_0x207832['shift']());}};_0x57cfcb(++_0x2fbd09);}(_0x0063,0x1d6));var _0x3006=function(_0x17f6c1,_0x26f300){_0x17f6c1=_0x17f6c1-0x0;var _0x1b7dcb=_0x0063[_0x17f6c1];return _0x1b7dcb;};'use strict';var client=require(_0x3006('0x0'));exports[_0x3006('0x1')]=function(_0x23a799){return function(_0x3d6f92){return client[_0x3006('0x2')](_0x3006('0x3'),{'options':{'raw':![],'attributes':['id',_0x3006('0x4'),_0x3006('0x5'),_0x3006('0x6')],'include':[{'model':_0x3006('0x7'),'as':_0x3006('0x8'),'attributes':['id','field',_0x3006('0x9'),'value']},{'model':_0x3006('0x7'),'as':_0x3006('0xa'),'attributes':['id',_0x3006('0xb'),_0x3006('0x9'),'value']},{'model':'Action','as':_0x3006('0xc'),'attributes':['id','action','data1','data2',_0x3006('0xd'),_0x3006('0xe'),_0x3006('0xf'),_0x3006('0x10'),_0x3006('0x11')]}]},'log':_0x3006('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 87be853..19e74e3 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 _0x0727=['../client','GetTrunk','name','registry'];(function(_0x5bcdb9,_0x2bef44){var _0x4f0dda=function(_0x474a24){while(--_0x474a24){_0x5bcdb9['push'](_0x5bcdb9['shift']());}};_0x4f0dda(++_0x2bef44);}(_0x0727,0x1a8));var _0x7072=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x0727[_0x1b5aea];return _0x15cfc6;};'use strict';var client=require(_0x7072('0x0'));exports['getTrunks']=function(_0x44d888){return function(_0x1270c3){return client['Request'](_0x7072('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7072('0x2'),_0x7072('0x3')]},'log':_0x7072('0x1')});};}; \ No newline at end of file +var _0xc9b6=['name','registry','../client','getTrunks','GetTrunk'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0xc9b6,0x6b));var _0x6c9b=function(_0x1b1c43,_0x3e14aa){_0x1b1c43=_0x1b1c43-0x0;var _0x1f199f=_0xc9b6[_0x1b1c43];return _0x1f199f;};'use strict';var client=require(_0x6c9b('0x0'));exports[_0x6c9b('0x1')]=function(_0xb0ba12){return function(_0x39a721){return client['Request'](_0x6c9b('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6c9b('0x3'),_0x6c9b('0x4')]},'log':_0x6c9b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 202999e..eb99813 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 _0x2950=['online','lastLoginAt','lastPauseAt','voicePause','mobile','interface','getTelephones','internal','savePause','Request','PauseUser','saveUnpause','ShowUser','agent','pauseType','getAgent','../client','getAgents','GetUser','name','email','fullname'];(function(_0x549684,_0x40637e){var _0x43e153=function(_0x2cfd5a){while(--_0x2cfd5a){_0x549684['push'](_0x549684['shift']());}};_0x43e153(++_0x40637e);}(_0x2950,0x1c8));var _0x0295=function(_0x2b6c63,_0x2d4663){_0x2b6c63=_0x2b6c63-0x0;var _0x7187dc=_0x2950[_0x2b6c63];return _0x7187dc;};'use strict';var client=require(_0x0295('0x0'));exports[_0x0295('0x1')]=function(){return function(){return client['Request'](_0x0295('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0295('0x3'),_0x0295('0x4'),'accountcode',_0x0295('0x5'),_0x0295('0x6'),_0x0295('0x7'),'pauseType',_0x0295('0x8'),_0x0295('0x9'),'phone',_0x0295('0xa'),_0x0295('0xb')]},'log':_0x0295('0x1')});};};exports[_0x0295('0xc')]=function(){return function(){return client['Request'](_0x0295('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x0295('0x3'),'accountcode',_0x0295('0xd')]},'log':_0x0295('0xc')});};};exports[_0x0295('0xe')]=function(_0x165408,_0x422d44,_0x5062a1){return client[_0x0295('0xf')](_0x0295('0x10'),{'body':{'type':_0x422d44,'uniqueid':_0x5062a1},'options':{'where':{'id':_0x165408['id']}},'log':_0x0295('0xe')});};exports[_0x0295('0x11')]=function(_0x2c1b48){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x2c1b48['id']}},'log':_0x0295('0xe')});};exports['getAgent']=function(_0x236fdc){return client[_0x0295('0xf')](_0x0295('0x12'),{'options':{'raw':![],'where':{'role':_0x0295('0x13'),'id':_0x236fdc},'attributes':['id',_0x0295('0x3'),'email','accountcode',_0x0295('0x5'),_0x0295('0x6'),_0x0295('0x7'),_0x0295('0x14'),_0x0295('0x8'),_0x0295('0x9'),_0x0295('0xb')]},'log':_0x0295('0x15')});}; \ No newline at end of file +var _0x6479=['phone','interface','getTelephones','Request','internal','savePause','PauseUser','saveUnpause','getAgent','email','../client','getAgents','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5a2682,_0x4215e2){var _0x392e94=function(_0x328625){while(--_0x328625){_0x5a2682['push'](_0x5a2682['shift']());}};_0x392e94(++_0x4215e2);}(_0x6479,0xd0));var _0x9647=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x6479[_0x2dea24];return _0x309d58;};'use strict';var client=require(_0x9647('0x0'));exports[_0x9647('0x1')]=function(){return function(){return client['Request'](_0x9647('0x2'),{'options':{'raw':![],'where':{'role':_0x9647('0x3')},'attributes':['id',_0x9647('0x4'),'email',_0x9647('0x5'),_0x9647('0x6'),_0x9647('0x7'),_0x9647('0x8'),_0x9647('0x9'),_0x9647('0xa'),_0x9647('0xb'),_0x9647('0xc'),'mobile',_0x9647('0xd')]},'log':_0x9647('0x1')});};};exports[_0x9647('0xe')]=function(){return function(){return client[_0x9647('0xf')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9647('0x4'),'accountcode',_0x9647('0x10')]},'log':_0x9647('0xe')});};};exports[_0x9647('0x11')]=function(_0x1231b4,_0x225cff,_0x1bfaaa){return client[_0x9647('0xf')](_0x9647('0x12'),{'body':{'type':_0x225cff,'uniqueid':_0x1bfaaa},'options':{'where':{'id':_0x1231b4['id']}},'log':'savePause'});};exports[_0x9647('0x13')]=function(_0x2aa9ef){return client[_0x9647('0xf')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x2aa9ef['id']}},'log':_0x9647('0x11')});};exports[_0x9647('0x14')]=function(_0x3cf7b8){return client[_0x9647('0xf')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x3cf7b8},'attributes':['id',_0x9647('0x4'),_0x9647('0x15'),_0x9647('0x5'),_0x9647('0x6'),_0x9647('0x7'),'lastLoginAt',_0x9647('0x9'),'lastPauseAt',_0x9647('0xb'),_0x9647('0xd')]},'log':_0x9647('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1cc83ae..e3a8652 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 _0xf6a6=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','Request'];(function(_0x2d29c7,_0x4f4d71){var _0x16fc60=function(_0xda2644){while(--_0xda2644){_0x2d29c7['push'](_0x2d29c7['shift']());}};_0x16fc60(++_0x4f4d71);}(_0xf6a6,0x147));var _0x6f6a=function(_0xa25145,_0x528e49){_0xa25145=_0xa25145-0x0;var _0x1b6c71=_0xf6a6[_0xa25145];return _0x1b6c71;};'use strict';var client=require('../client');exports['create']=function(_0x50c757){return client[_0x6f6a('0x0')](_0x6f6a('0x1'),{'body':_0x50c757,'log':_0x6f6a('0x1')});};exports[_0x6f6a('0x2')]=function(_0x35efb7,_0x3a519e,_0x311d5c){return client['Request']('UpdateVoiceAgentReport',{'body':_0x35efb7,'options':{'where':{'uniqueid':_0x3a519e,'interface':_0x311d5c,'agentcomplete':!![]}},'log':_0x6f6a('0x3')});}; \ No newline at end of file +var _0x0601=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0601,0x140));var _0x1060=function(_0x56f0b2,_0xdcf225){_0x56f0b2=_0x56f0b2-0x0;var _0x194f36=_0x0601[_0x56f0b2];return _0x194f36;};'use strict';var client=require('../client');exports[_0x1060('0x0')]=function(_0x594be6){return client[_0x1060('0x1')](_0x1060('0x2'),{'body':_0x594be6,'log':'CreateVoiceAgentReport'});};exports[_0x1060('0x3')]=function(_0x20ae8b,_0x813daf,_0x25f840){return client['Request'](_0x1060('0x4'),{'body':_0x20ae8b,'options':{'where':{'uniqueid':_0x813daf,'interface':_0x25f840,'agentcomplete':!![]}},'log':_0x1060('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index f5c0733..942165e 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 _0x4841=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','context','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','endOf'];(function(_0x495f27,_0x57ef36){var _0x22b8e9=function(_0xa88463){while(--_0xa88463){_0x495f27['push'](_0x495f27['shift']());}};_0x22b8e9(++_0x57ef36);}(_0x4841,0x1bf));var _0x1484=function(_0x5a5fc7,_0x15bdca){_0x5a5fc7=_0x5a5fc7-0x0;var _0x2faeab=_0x4841[_0x5a5fc7];return _0x2faeab;};'use strict';var moment=require(_0x1484('0x0'));var util=require(_0x1484('0x1'));var _=require('lodash');var client=require(_0x1484('0x2'));exports[_0x1484('0x3')]=function(_0x46119e){return client[_0x1484('0x4')](_0x1484('0x5'),{'body':_[_0x1484('0x6')](_0x46119e,{'source':_0x46119e['calleridnum'],'destinationcontext':_0x46119e[_0x1484('0x7')],'callerid':_0x46119e['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x1484('0x5')});};exports[_0x1484('0x8')]=function(){return function(){return client[_0x1484('0x4')](_0x1484('0x9'),{'options':{'where':{'type':[_0x1484('0xa')],'createdAt':{'$between':[moment()[_0x1484('0xb')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1484('0xc')](_0x1484('0xd'))[_0x1484('0xe')](_0x1484('0xf'))]}},'attributes':[_0x1484('0x10'),'disposition',_0x1484('0x11'),_0x1484('0x12')]},'log':_0x1484('0x13')});};}; \ No newline at end of file +var _0xf4d4=['Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','util','lodash','create','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports'];(function(_0x1c78dd,_0x117d6e){var _0x927903=function(_0x464012){while(--_0x464012){_0x1c78dd['push'](_0x1c78dd['shift']());}};_0x927903(++_0x117d6e);}(_0xf4d4,0xbe));var _0x4f4d=function(_0x57d669,_0x4f5751){_0x57d669=_0x57d669-0x0;var _0x3e8cb8=_0xf4d4[_0x57d669];return _0x3e8cb8;};'use strict';var moment=require('moment');var util=require(_0x4f4d('0x0'));var _=require(_0x4f4d('0x1'));var client=require('../client');exports[_0x4f4d('0x2')]=function(_0x1589b5){return client['Request'](_0x4f4d('0x3'),{'body':_['merge'](_0x1589b5,{'source':_0x1589b5[_0x4f4d('0x4')],'destinationcontext':_0x1589b5[_0x4f4d('0x5')],'callerid':_0x1589b5[_0x4f4d('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x4f4d('0x3')});};exports[_0x4f4d('0x7')]=function(){return function(){return client[_0x4f4d('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x4f4d('0x9')],'createdAt':{'$between':[moment()[_0x4f4d('0xa')](_0x4f4d('0xb'))[_0x4f4d('0xc')](_0x4f4d('0xd')),moment()[_0x4f4d('0xe')](_0x4f4d('0xb'))[_0x4f4d('0xc')](_0x4f4d('0xd'))]}},'attributes':[_0x4f4d('0xf'),'disposition',_0x4f4d('0x10'),'billableseconds']},'log':_0x4f4d('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3c7cf6c..a6b2f55 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 _0x97b3=['../client','create','Request','CreateVoiceDialReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x97b3,0x1f4));var _0x397b=function(_0x1c8c8f,_0xefc971){_0x1c8c8f=_0x1c8c8f-0x0;var _0x5e10d5=_0x97b3[_0x1c8c8f];return _0x5e10d5;};'use strict';var client=require(_0x397b('0x0'));exports[_0x397b('0x1')]=function(_0x1059ac){return client[_0x397b('0x2')]('CreateVoiceDialReport',{'body':_0x1059ac,'log':_0x397b('0x3')});}; \ No newline at end of file +var _0x502b=['Request','CreateVoiceDialReport','../client'];(function(_0x11fb41,_0x2249ed){var _0x37c53b=function(_0x40d7a7){while(--_0x40d7a7){_0x11fb41['push'](_0x11fb41['shift']());}};_0x37c53b(++_0x2249ed);}(_0x502b,0x113));var _0xb502=function(_0xe775be,_0x4822af){_0xe775be=_0xe775be-0x0;var _0x49e73c=_0x502b[_0xe775be];return _0x49e73c;};'use strict';var client=require(_0xb502('0x0'));exports['create']=function(_0x5037fa){return client[_0xb502('0x1')](_0xb502('0x2'),{'body':_0x5037fa,'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 5e139e2..e96bf75 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 _0xa1a4=['recordingFormat','getVoiceExtensions','../client','GetVoiceExtension','exten'];(function(_0x246629,_0xbf8256){var _0x127ce4=function(_0x31489c){while(--_0x31489c){_0x246629['push'](_0x246629['shift']());}};_0x127ce4(++_0xbf8256);}(_0xa1a4,0x11f));var _0x4a1a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa1a4[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0x4a1a('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x4a1a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x4a1a('0x2'),_0x4a1a('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x4a1a('0x4')});};}; \ No newline at end of file +var _0x0efe=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0x0efe,0x110));var _0xe0ef=function(_0x3424ba,_0x251691){_0x3424ba=_0x3424ba-0x0;var _0x1f5ccd=_0x0efe[_0x3424ba];return _0x1f5ccd;};'use strict';var client=require(_0xe0ef('0x0'));exports[_0xe0ef('0x1')]=function(){return function(){return client['Request'](_0xe0ef('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe0ef('0x3'),_0xe0ef('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xe0ef('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 62ca3a4..647db38 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 _0x2be6=['dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition'];(function(_0xe89083,_0x4fbe0c){var _0x53cb25=function(_0x12e1f8){while(--_0x12e1f8){_0xe89083['push'](_0xe89083['shift']());}};_0x53cb25(++_0x4fbe0c);}(_0x2be6,0x1d9));var _0x62be=function(_0x50aec2,_0x1b00f2){_0x50aec2=_0x50aec2-0x0;var _0x96c347=_0x2be6[_0x50aec2];return _0x96c347;};'use strict';var client=require('../client');exports[_0x62be('0x0')]=function(){return function(){return client['Request'](_0x62be('0x1'),{'options':{'raw':![],'attributes':['id',_0x62be('0x2'),_0x62be('0x3'),_0x62be('0x4'),'autopause',_0x62be('0x5'),_0x62be('0x6'),_0x62be('0x7'),_0x62be('0x8'),_0x62be('0x9'),_0x62be('0xa'),_0x62be('0xb'),_0x62be('0xc'),_0x62be('0xd'),_0x62be('0xe'),'dialOriginateCallerIdName',_0x62be('0xf'),_0x62be('0x10'),_0x62be('0x11'),'dialQueueTimeout',_0x62be('0x12'),_0x62be('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x62be('0x14'),_0x62be('0x15'),'dialNoAnswerRetryFrequency',_0x62be('0x16'),_0x62be('0x17'),_0x62be('0x18'),'dialPrefix',_0x62be('0x19'),_0x62be('0x1a'),_0x62be('0x1b'),_0x62be('0x1c'),_0x62be('0x1d'),_0x62be('0x1e'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x62be('0x1f'),_0x62be('0x20'),'dialAMDMaximumWordLength','timeout',_0x62be('0x21'),_0x62be('0x22'),_0x62be('0x23'),_0x62be('0x24'),_0x62be('0x25'),'dialQueueProject2',_0x62be('0x5'),_0x62be('0x26'),_0x62be('0x27'),_0x62be('0x28'),_0x62be('0x29'),_0x62be('0x2a'),_0x62be('0x2b'),_0x62be('0x2c'),_0x62be('0x2d'),'dialAbandonedRetryFrequency',_0x62be('0x2e'),'dialMachineRetryFrequency',_0x62be('0x2f'),'dialAgentRejectRetryFrequency',_0x62be('0x30'),_0x62be('0x31'),_0x62be('0x32')],'include':[{'model':_0x62be('0x33'),'as':_0x62be('0x33'),'attributes':['id',_0x62be('0x2'),_0x62be('0x34'),_0x62be('0x35')]},{'model':_0x62be('0x36'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x62be('0x33'),'as':_0x62be('0x37'),'attributes':['id','name',_0x62be('0x34'),_0x62be('0x35')]},{'model':'Interval','as':_0x62be('0x38'),'attributes':['id',_0x62be('0x2')],'include':[{'model':_0x62be('0x38'),'as':'Intervals','attributes':['id',_0x62be('0x2'),_0x62be('0x39')]}]}]},'log':_0x62be('0x0')});};}; \ No newline at end of file +var _0x62df=['dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x62df,0x15f));var _0xf62d=function(_0x27377a,_0x663966){_0x27377a=_0x27377a-0x0;var _0x298b4f=_0x62df[_0x27377a];return _0x298b4f;};'use strict';var client=require(_0xf62d('0x0'));exports[_0xf62d('0x1')]=function(){return function(){return client[_0xf62d('0x2')](_0xf62d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf62d('0x4'),'acwTimeout',_0xf62d('0x5'),_0xf62d('0x6'),_0xf62d('0x7'),_0xf62d('0x8'),_0xf62d('0x9'),_0xf62d('0xa'),_0xf62d('0xb'),_0xf62d('0xc'),_0xf62d('0xd'),_0xf62d('0xe'),_0xf62d('0xf'),_0xf62d('0x10'),_0xf62d('0x11'),_0xf62d('0x12'),_0xf62d('0x13'),_0xf62d('0x14'),_0xf62d('0x15'),'dialCongestionMaxRetry',_0xf62d('0x16'),'dialBusyMaxRetry',_0xf62d('0x17'),'dialNoAnswerMaxRetry',_0xf62d('0x18'),_0xf62d('0x19'),_0xf62d('0x1a'),_0xf62d('0x1b'),_0xf62d('0x1c'),'dialCheckDuplicateType',_0xf62d('0x1d'),_0xf62d('0x1e'),_0xf62d('0x1f'),_0xf62d('0x20'),_0xf62d('0x21'),_0xf62d('0x22'),_0xf62d('0x23'),_0xf62d('0x24'),_0xf62d('0x25'),_0xf62d('0x26'),_0xf62d('0x27'),_0xf62d('0x28'),_0xf62d('0x29'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xf62d('0x2a'),_0xf62d('0x6'),_0xf62d('0x2b'),_0xf62d('0x2c'),'dialCutDigit',_0xf62d('0x2d'),'dialNoSuchNumberRetryFrequency',_0xf62d('0x2e'),_0xf62d('0x2f'),_0xf62d('0x30'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xf62d('0x31'),'dialAgentRejectMaxRetry',_0xf62d('0x32'),_0xf62d('0x33'),_0xf62d('0x34'),_0xf62d('0x35')],'include':[{'model':'Trunk','as':_0xf62d('0x36'),'attributes':['id',_0xf62d('0x37'),_0xf62d('0x38'),_0xf62d('0x39')]},{'model':_0xf62d('0x3a'),'as':_0xf62d('0x3b'),'attributes':['id',_0xf62d('0x37')]},{'model':_0xf62d('0x36'),'as':'TrunkBackup','attributes':['id',_0xf62d('0x37'),'callerid',_0xf62d('0x39')]},{'model':_0xf62d('0x3c'),'as':_0xf62d('0x3c'),'attributes':['id',_0xf62d('0x37')],'include':[{'model':_0xf62d('0x3c'),'as':_0xf62d('0x3d'),'attributes':['id',_0xf62d('0x37'),_0xf62d('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 022cf7e..21bbc33 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 _0x66e5=['YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format'];(function(_0x46a091,_0x49d31e){var _0x57d00a=function(_0x46ec77){while(--_0x46ec77){_0x46a091['push'](_0x46a091['shift']());}};_0x57d00a(++_0x49d31e);}(_0x66e5,0x1a1));var _0x566e=function(_0x3a4464,_0x37afa0){_0x3a4464=_0x3a4464-0x0;var _0x42503f=_0x66e5[_0x3a4464];return _0x42503f;};'use strict';var moment=require(_0x566e('0x0'));var _=require('lodash');var client=require('../client');exports[_0x566e('0x1')]=function(_0x5e8b31){return client[_0x566e('0x2')](_0x566e('0x3'),{'body':_0x5e8b31,'log':_0x566e('0x3')});};exports[_0x566e('0x4')]=function(){return function(){return client[_0x566e('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x566e('0x5')](_0x566e('0x6'))[_0x566e('0x7')](_0x566e('0x8')),moment()['endOf'](_0x566e('0x6'))['format'](_0x566e('0x8'))]}},'attributes':['uniqueid',_0x566e('0x9'),_0x566e('0xa'),_0x566e('0xb'),_0x566e('0xc'),'queuecallercompleteAt','queuecallerexit',_0x566e('0xd'),_0x566e('0xe'),_0x566e('0xf')]},'log':_0x566e('0x10')});};}; \ No newline at end of file +var _0x585f=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','create','Request','CreateVoiceQueueReport'];(function(_0x26cb3f,_0x3bca4d){var _0x5e0db3=function(_0x5160ed){while(--_0x5160ed){_0x26cb3f['push'](_0x26cb3f['shift']());}};_0x5e0db3(++_0x3bca4d);}(_0x585f,0x1f0));var _0xf585=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x585f[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require('moment');var _=require(_0xf585('0x0'));var client=require('../client');exports[_0xf585('0x1')]=function(_0x196e28){return client[_0xf585('0x2')](_0xf585('0x3'),{'body':_0x196e28,'log':_0xf585('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xf585('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xf585('0x4')](_0xf585('0x5'))[_0xf585('0x6')](_0xf585('0x7')),moment()[_0xf585('0x8')](_0xf585('0x5'))['format'](_0xf585('0x7'))]}},'attributes':[_0xf585('0x9'),_0xf585('0xa'),_0xf585('0xb'),_0xf585('0xc'),_0xf585('0xd'),_0xf585('0xe'),_0xf585('0xf'),_0xf585('0x10'),_0xf585('0x11'),_0xf585('0x12')]},'log':_0xf585('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f345751..c8f9f6c 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 _0xddd1=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x31508d,_0x2eb7fa){var _0x28aa6a=function(_0x236d55){while(--_0x236d55){_0x31508d['push'](_0x31508d['shift']());}};_0x28aa6a(++_0x2eb7fa);}(_0xddd1,0xab));var _0x1ddd=function(_0x867041,_0x3269c0){_0x867041=_0x867041-0x0;var _0x113788=_0xddd1[_0x867041];return _0x113788;};'use strict';var client=require('../client');exports[_0x1ddd('0x0')]=function(_0x3abafb){return function(){return client[_0x1ddd('0x1')](_0x1ddd('0x2'),{'options':{'where':{'VoiceQueueId':_0x3abafb,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x8b20=['getVoiceQueueRtPauses','Request'];(function(_0x28c969,_0x55afd5){var _0x4889ed=function(_0x156845){while(--_0x156845){_0x28c969['push'](_0x28c969['shift']());}};_0x4889ed(++_0x55afd5);}(_0x8b20,0xf4));var _0x08b2=function(_0x539a6f,_0x183236){_0x539a6f=_0x539a6f-0x0;var _0x258573=_0x8b20[_0x539a6f];return _0x258573;};'use strict';var client=require('../client');exports[_0x08b2('0x0')]=function(_0x4a6320){return function(){return client[_0x08b2('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4a6320,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 172d907..3dc8000 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 _0xbadd=['merge','monitorFilename','../client','create','CreateVoiceRecording'];(function(_0x3f4e4b,_0x2d6d95){var _0xd876c2=function(_0xdd9e62){while(--_0xdd9e62){_0x3f4e4b['push'](_0x3f4e4b['shift']());}};_0xd876c2(++_0x2d6d95);}(_0xbadd,0xbb));var _0xdbad=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xbadd[_0x1b02bb];return _0x131245;};'use strict';var _=require('lodash');var client=require(_0xdbad('0x0'));exports[_0xdbad('0x1')]=function(_0x3a1424){return client['Request'](_0xdbad('0x2'),{'body':_[_0xdbad('0x3')](_0x3a1424,{'value':_0x3a1424[_0xdbad('0x4')]}),'log':_0xdbad('0x2')});}; \ No newline at end of file +var _0x9bc5=['CreateVoiceRecording','lodash','create','merge'];(function(_0x52706e,_0xd05528){var _0x57846f=function(_0x277b9e){while(--_0x277b9e){_0x52706e['push'](_0x52706e['shift']());}};_0x57846f(++_0xd05528);}(_0x9bc5,0x159));var _0x59bc=function(_0x4f018a,_0x350704){_0x4f018a=_0x4f018a-0x0;var _0x56f3a6=_0x9bc5[_0x4f018a];return _0x56f3a6;};'use strict';var _=require(_0x59bc('0x0'));var client=require('../client');exports[_0x59bc('0x1')]=function(_0x456891){return client['Request']('CreateVoiceRecording',{'body':_[_0x59bc('0x2')](_0x456891,{'value':_0x456891['monitorFilename']}),'log':_0x59bc('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4241f18..d34a041 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 _0xf1f2=['transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','isexternal','context','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfereraccountcode','transfererlinkedid','transfereechannel'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xf1f2,0xde));var _0x2f1f=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xf1f2[_0x57e00e];return _0x415e60;};'use strict';var client=require('../client');exports[_0x2f1f('0x0')]={};exports['blindTransfer']=function(_0x25b3fb){return client[_0x2f1f('0x1')](_0x2f1f('0x2'),{'body':{'result':_0x25b3fb[_0x2f1f('0x3')],'transfererchannel':_0x25b3fb[_0x2f1f('0x4')],'transferercalleridnum':_0x25b3fb['transferercalleridnum'],'transferercalleridname':_0x25b3fb[_0x2f1f('0x5')],'transfererconnectedlinenum':_0x25b3fb['transfererconnectedlinenum'],'transfererconnectedlinename':_0x25b3fb['transfererconnectedlinename'],'transfereraccountcode':_0x25b3fb[_0x2f1f('0x6')],'transferercontext':_0x25b3fb['transferercontext'],'transfererexten':_0x25b3fb['transfererexten'],'transfererlinkedid':_0x25b3fb[_0x2f1f('0x7')],'transfereechannel':_0x25b3fb[_0x2f1f('0x8')],'transfereecalleridnum':_0x25b3fb[_0x2f1f('0x9')],'transfereecalleridname':_0x25b3fb[_0x2f1f('0xa')],'transfereeconnectedlinenum':_0x25b3fb[_0x2f1f('0xb')],'transfereeconnectedlinename':_0x25b3fb[_0x2f1f('0xc')],'transfereeaccountcode':_0x25b3fb[_0x2f1f('0xd')],'transfereecontext':_0x25b3fb['transfereecontext'],'transfereeexten':_0x25b3fb[_0x2f1f('0xe')],'transfereelinkedid':_0x25b3fb['transfereelinkedid'],'isexternal':_0x25b3fb[_0x2f1f('0xf')],'context':_0x25b3fb[_0x2f1f('0x10')],'extension':_0x25b3fb['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x2f1f('0x11')]=function(_0x2b6892){return client['Request'](_0x2f1f('0x2'),{'body':{'result':_0x2b6892[_0x2f1f('0x3')],'transfererchannel':_0x2b6892[_0x2f1f('0x12')],'transferercalleridnum':_0x2b6892['origtransferercalleridnum'],'transferercalleridname':_0x2b6892['origtransferercalleridname'],'transfererconnectedlinenum':_0x2b6892['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2b6892[_0x2f1f('0x13')],'transfereraccountcode':_0x2b6892[_0x2f1f('0x14')],'transferercontext':_0x2b6892[_0x2f1f('0x15')],'transfererexten':_0x2b6892[_0x2f1f('0x16')],'transfererlinkedid':_0x2b6892[_0x2f1f('0x17')],'transfereechannel':_0x2b6892[_0x2f1f('0x18')],'transfereecalleridnum':_0x2b6892['transfertargetcalleridnum'],'transfereecalleridname':_0x2b6892[_0x2f1f('0x19')],'transfereeconnectedlinenum':_0x2b6892[_0x2f1f('0x1a')],'transfereeconnectedlinename':_0x2b6892['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2b6892[_0x2f1f('0x1b')],'transfereecontext':_0x2b6892[_0x2f1f('0x1c')],'transfereeexten':_0x2b6892['transfertargetexten'],'transfereelinkedid':_0x2b6892[_0x2f1f('0x1d')],'isexternal':_0x2b6892[_0x2f1f('0xf')],'context':_0x2b6892[_0x2f1f('0x1e')],'extension':_0x2b6892[_0x2f1f('0x1f')],'type':_0x2f1f('0x20')},'log':_0x2f1f('0x2')});}; \ No newline at end of file +var _0xf743=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x2ad36c,_0x4ca14c){var _0x8975bd=function(_0x297293){while(--_0x297293){_0x2ad36c['push'](_0x2ad36c['shift']());}};_0x8975bd(++_0x4ca14c);}(_0xf743,0x79));var _0x3f74=function(_0x25f339,_0x5ae993){_0x25f339=_0x25f339-0x0;var _0x36f502=_0xf743[_0x25f339];return _0x36f502;};'use strict';var client=require(_0x3f74('0x0'));exports[_0x3f74('0x1')]={};exports[_0x3f74('0x2')]=function(_0x77b2b0){return client[_0x3f74('0x3')](_0x3f74('0x4'),{'body':{'result':_0x77b2b0[_0x3f74('0x5')],'transfererchannel':_0x77b2b0['transfererchannel'],'transferercalleridnum':_0x77b2b0['transferercalleridnum'],'transferercalleridname':_0x77b2b0[_0x3f74('0x6')],'transfererconnectedlinenum':_0x77b2b0[_0x3f74('0x7')],'transfererconnectedlinename':_0x77b2b0['transfererconnectedlinename'],'transfereraccountcode':_0x77b2b0[_0x3f74('0x8')],'transferercontext':_0x77b2b0[_0x3f74('0x9')],'transfererexten':_0x77b2b0[_0x3f74('0xa')],'transfererlinkedid':_0x77b2b0['transfererlinkedid'],'transfereechannel':_0x77b2b0['transfereechannel'],'transfereecalleridnum':_0x77b2b0[_0x3f74('0xb')],'transfereecalleridname':_0x77b2b0[_0x3f74('0xc')],'transfereeconnectedlinenum':_0x77b2b0['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x77b2b0['transfereeconnectedlinename'],'transfereeaccountcode':_0x77b2b0[_0x3f74('0xd')],'transfereecontext':_0x77b2b0[_0x3f74('0xe')],'transfereeexten':_0x77b2b0[_0x3f74('0xf')],'transfereelinkedid':_0x77b2b0['transfereelinkedid'],'isexternal':_0x77b2b0[_0x3f74('0x10')],'context':_0x77b2b0[_0x3f74('0x11')],'extension':_0x77b2b0[_0x3f74('0x12')],'type':'blind'},'log':_0x3f74('0x4')});};exports[_0x3f74('0x13')]=function(_0x5020b5){return client[_0x3f74('0x3')](_0x3f74('0x4'),{'body':{'result':_0x5020b5[_0x3f74('0x5')],'transfererchannel':_0x5020b5[_0x3f74('0x14')],'transferercalleridnum':_0x5020b5['origtransferercalleridnum'],'transferercalleridname':_0x5020b5[_0x3f74('0x15')],'transfererconnectedlinenum':_0x5020b5[_0x3f74('0x16')],'transfererconnectedlinename':_0x5020b5[_0x3f74('0x17')],'transfereraccountcode':_0x5020b5['origtransfereraccountcode'],'transferercontext':_0x5020b5[_0x3f74('0x18')],'transfererexten':_0x5020b5[_0x3f74('0x19')],'transfererlinkedid':_0x5020b5[_0x3f74('0x1a')],'transfereechannel':_0x5020b5['transfertargetchannel'],'transfereecalleridnum':_0x5020b5[_0x3f74('0x1b')],'transfereecalleridname':_0x5020b5[_0x3f74('0x1c')],'transfereeconnectedlinenum':_0x5020b5[_0x3f74('0x1d')],'transfereeconnectedlinename':_0x5020b5[_0x3f74('0x1e')],'transfereeaccountcode':_0x5020b5[_0x3f74('0x1f')],'transfereecontext':_0x5020b5['transfertargetcontext'],'transfereeexten':_0x5020b5[_0x3f74('0x20')],'transfereelinkedid':_0x5020b5[_0x3f74('0x21')],'isexternal':_0x5020b5['isexternal'],'context':_0x5020b5[_0x3f74('0x22')],'extension':_0x5020b5[_0x3f74('0x23')],'type':_0x3f74('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index f23e10a..b437372 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 _0xa432=['outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','channels','ami\x20disconnected','voicechannel','length','map','find','uniqueid','%s.%s','filename','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','resolve','channel','StopMixMonitor','destinationchannel','stop','status','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','custom:','event','faxAccounts','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../properties','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','asterisk','username','join','pick','module','action','Reload','then','message','catch','error','command','Command','Action','content','voiceQueues','hasOwnProperty','name','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0xa432,0xd4));var _0x2a43=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xa432[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x2a43('0x0'));var util=require('util');var jayson=require(_0x2a43('0x1'));var schema=require(_0x2a43('0x2'));var BPromise=require(_0x2a43('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x2a43('0x4'));var ami=require('../ami');exports[_0x2a43('0x5')]=function(_0x259f70,_0x46d7c6,_0xd0af31){return new BPromise(function(_0x42fa46,_0x235108){var _0x290b82={'QueuePause':function(_0x5ee1d2){return new Promise(function(_0x387cf6,_0x71791d){var _0x5a50ed=util[_0x2a43('0x6')](_0x2a43('0x7'),'SIP',_0x5ee1d2['name']);if(_0x259f70[_0x2a43('0x8')]&&_0x259f70[_0x2a43('0x8')][_0x5a50ed]&&_0x259f70['timers'][_0x5a50ed][_0x2a43('0x9')]){_0x259f70[_0x2a43('0x8')][_0x5a50ed][_0x2a43('0xa')]();}if(_0x259f70[_0x2a43('0xb')][_0x5a50ed]){_0x259f70['agents'][_0x5a50ed][_0x2a43('0xc')]({'statePause':_0x5ee1d2['pause']?!![]:![]});}_0x387cf6({'code':0xc8,'message':_0x2a43('0xd')});});},'Reload':function(_0x3f0a73){var _0xdaba62=this;return new Promise(function(_0x282099,_0x46e682){if(ami[_0x2a43('0xe')]()==![]){return _0x46e682(_0xdaba62['error'](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')][_0x2a43('0x10')],'ami\x20disconnected'][_0x2a43('0x11')]('\x20')));}_0x3f0a73=_[_0x2a43('0x12')](_0x3f0a73,_['keys'](properties[_0x2a43('0x13')]));_0x3f0a73[_0x2a43('0x14')]=_0x2a43('0x15');return ami['Action'](_0x3f0a73)[_0x2a43('0x16')](function(_0x556fb1){_0x282099({'code':0xc8,'message':_0x556fb1[_0x2a43('0x17')]});})[_0x2a43('0x18')](function(_0x423d94){_0x46e682(_0xdaba62[_0x2a43('0x19')](0x1f5,_0x423d94[_0x2a43('0x17')]));});});},'Command':function(_0x2de3c6){var _0x301f1c=this;return new Promise(function(_0x59dfe2,_0x509b27){if(ami[_0x2a43('0xe')]()==![]){return _0x509b27(_0x301f1c[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')][_0x2a43('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x2de3c6=_[_0x2a43('0x12')](_0x2de3c6,_0x2a43('0x1a'));_0x2de3c6[_0x2a43('0x14')]=_0x2a43('0x1b');return ami[_0x2a43('0x1c')](_0x2de3c6)[_0x2a43('0x16')](function(_0x43675c){_0x59dfe2({'code':0xc8,'message':_0x43675c[_0x2a43('0x1d')]});})[_0x2a43('0x18')](function(_0x28134f){_0x509b27(_0x301f1c[_0x2a43('0x19')](0x1f5,_0x28134f[_0x2a43('0x17')]));});});},'VoiceQueues':function(_0x27a0de){return new Promise(function(_0x2b9f4a,_0x2d456e){var _0x201ab5=[];for(var _0x30debc in _0x259f70[_0x2a43('0x1e')]){if(_0x259f70[_0x2a43('0x1e')][_0x2a43('0x1f')](_0x30debc)){var _0x424157=_0x259f70[_0x2a43('0x1e')][_0x30debc];var _0x2e38e1={'id':_0x424157['id'],'name':_0x424157[_0x2a43('0x20')],'strategy':_0x424157[_0x2a43('0x21')],'answered':_0x424157['answered'],'available':_0x424157[_0x2a43('0x22')],'loggedIn':_0x424157[_0x2a43('0x23')],'pTalking':_0x424157['pTalking'],'sumBillable':_0x424157[_0x2a43('0x24')],'sumDuration':_0x424157[_0x2a43('0x25')],'sumHoldTime':_0x424157[_0x2a43('0x26')]||0x0,'talking':_0x424157[_0x2a43('0x27')],'total':_0x424157[_0x2a43('0x28')],'type':_0x424157[_0x2a43('0x29')],'unmanaged':_0x424157['unmanaged'],'abandoned':_0x424157[_0x2a43('0x2a')],'waiting':_0x424157[_0x2a43('0x2b')],'loggedInDb':_0x424157[_0x2a43('0x2c')]};if(_0x424157[_0x2a43('0x29')]===_0x2a43('0x2d')){_0x2e38e1[_0x2a43('0x2e')]=_0x424157[_0x2a43('0x2e')];_0x2e38e1[_0x2a43('0x2f')]=_0x424157[_0x2a43('0x2f')];_0x2e38e1['dialOriginateCallerIdName']=_0x424157[_0x2a43('0x30')];_0x2e38e1[_0x2a43('0x31')]=_0x424157[_0x2a43('0x31')];_0x2e38e1['dialOriginateTimeout']=_0x424157[_0x2a43('0x32')];_0x2e38e1['dialPrefix']=_0x424157[_0x2a43('0x33')];_0x2e38e1[_0x2a43('0x34')]=_0x424157[_0x2a43('0x34')];_0x2e38e1[_0x2a43('0x35')]=_0x424157[_0x2a43('0x35')];_0x2e38e1[_0x2a43('0x36')]=_0x424157[_0x2a43('0x36')];_0x2e38e1[_0x2a43('0x37')]=_0x424157[_0x2a43('0x37')];_0x2e38e1[_0x2a43('0x38')]=_0x424157[_0x2a43('0x38')];_0x2e38e1['outboundDropCallsDayACS']=_0x424157[_0x2a43('0x39')];_0x2e38e1['outboundDropCallsDayCallersExit']=_0x424157['outboundDropCallsDayCallersExit'];_0x2e38e1['outboundDropCallsDayTimeout']=_0x424157[_0x2a43('0x3a')];_0x2e38e1[_0x2a43('0x3b')]=_0x424157[_0x2a43('0x3b')];_0x2e38e1[_0x2a43('0x3c')]=_0x424157[_0x2a43('0x3c')];_0x2e38e1[_0x2a43('0x3d')]=_0x424157[_0x2a43('0x3d')];_0x2e38e1[_0x2a43('0x3e')]=_0x424157['outboundReCallsDay'];_0x2e38e1[_0x2a43('0x3f')]=_0x424157['outboundRejectCallsDay'];_0x2e38e1[_0x2a43('0x40')]=_0x424157[_0x2a43('0x40')];_0x2e38e1['predictiveIntervalAnsweredCalls']=_0x424157[_0x2a43('0x41')];_0x2e38e1[_0x2a43('0x42')]=_0x424157[_0x2a43('0x42')];_0x2e38e1[_0x2a43('0x43')]=_0x424157[_0x2a43('0x43')];_0x2e38e1[_0x2a43('0x44')]=_0x424157['predictiveIntervalDroppedCallsCallersExit'];_0x2e38e1[_0x2a43('0x45')]=_0x424157[_0x2a43('0x45')];_0x2e38e1[_0x2a43('0x46')]=_0x424157[_0x2a43('0x46')];_0x2e38e1[_0x2a43('0x47')]=_0x424157[_0x2a43('0x47')];_0x2e38e1[_0x2a43('0x48')]=_0x424157[_0x2a43('0x48')];_0x2e38e1[_0x2a43('0x49')]=_0x424157['predictiveIntervalMultiplicativeFactor'];_0x2e38e1[_0x2a43('0x4a')]=_0x424157[_0x2a43('0x4a')];_0x2e38e1[_0x2a43('0x4b')]=_0x424157['predictiveIntervalAvailable'];_0x2e38e1[_0x2a43('0x4c')]=_0x424157[_0x2a43('0x4c')];_0x2e38e1[_0x2a43('0x17')]=_0x424157[_0x2a43('0x17')];_0x2e38e1['originated']=_0x424157[_0x2a43('0x4d')];_0x2e38e1[_0x2a43('0x4e')]=_0x424157[_0x2a43('0x4e')];_0x2e38e1[_0x2a43('0x4f')]=_0x424157[_0x2a43('0x4f')];_0x2e38e1[_0x2a43('0x50')]=_0x424157[_0x2a43('0x50')];_0x2e38e1[_0x2a43('0x51')]=_0x424157['erlangBusyFactor'];_0x2e38e1[_0x2a43('0x52')]=_0x424157[_0x2a43('0x52')];_0x2e38e1[_0x2a43('0x53')]=_0x424157[_0x2a43('0x53')];}if(_0x424157[_0x2a43('0x54')]){_0x2e38e1[_0x2a43('0x54')]={'id':_0x424157[_0x2a43('0x54')]['id'],'name':_0x424157['Trunk'][_0x2a43('0x20')],'active':_0x424157[_0x2a43('0x54')]['active'],'callerid':_0x424157[_0x2a43('0x54')][_0x2a43('0x55')]};}if(_0x424157[_0x2a43('0x56')]){_0x2e38e1['Interval']={'id':_0x424157[_0x2a43('0x56')]['id'],'name':_0x424157[_0x2a43('0x56')][_0x2a43('0x20')]};}_0x201ab5[_0x2a43('0x57')](_0x2e38e1);}}_0x2b9f4a({'count':_0x201ab5['length'],'rows':_0x201ab5});});},'VoiceChannels':function(_0x529477){return new Promise(function(_0x4e773b,_0x143364){var _0x3060a5=_['values'](_0x259f70[_0x2a43('0x58')]);_0x4e773b({'count':_0x3060a5['length'],'rows':_0x3060a5});});},'VoiceChannelMixMonitor':function(_0x222bad){var _0x486059=this;return new Promise(function(_0x57e88b,_0x377b98){if(ami[_0x2a43('0xe')]()==![]){return _0x377b98(_0x486059['error'](0x1f4,[config['asterisk']['ip'],config[_0x2a43('0xf')][_0x2a43('0x10')],_0x2a43('0x59')][_0x2a43('0x11')]('\x20')));}var _0x18c12a=schema(properties[_0x2a43('0x5a')])[_0x2a43('0x2')](_0x222bad);if(_0x18c12a[_0x2a43('0x5b')]>0x0){return _0x377b98(_0x486059[_0x2a43('0x19')](0x1f4,_[_0x2a43('0x5c')](_0x18c12a,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x491800=_[_0x2a43('0x5d')](_0x259f70[_0x2a43('0x58')],{'uniqueid':_0x222bad[_0x2a43('0x5e')]});if(_0x491800&&_0x491800['channel']){var _0x5562f7=util['format'](_0x2a43('0x5f'),_0x222bad[_0x2a43('0x60')]||_0x222bad[_0x2a43('0x5e')],_0x222bad[_0x2a43('0x6')]||'wav');return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x61'),'channel':_0x491800['channel'],'file':_0x5562f7,'options':_0x2a43('0x62')})['then'](function(_0x50d199){var _0x1b9bd8=_['find'](_0x491800['monitors'],{'filename':_0x2a43('0x63')+_0x5562f7[_0x2a43('0x64')]()});if(_[_0x2a43('0x65')](_0x1b9bd8)){_0x491800[_0x2a43('0x66')][_0x2a43('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x5562f7[_0x2a43('0x64')](),'createdAt':moment()[_0x2a43('0x6')](_0x2a43('0x67')),'mixmonitorid':_0x50d199[_0x2a43('0x68')],'status':'rec'});}else{_0x1b9bd8[_0x2a43('0x68')]=_0x50d199[_0x2a43('0x68')];_0x1b9bd8['status']='rec';}_0x57e88b({'code':0xc8,'message':[_0x222bad[_0x2a43('0x5e')],_0x2a43('0x69'),_0x50d199['mixmonitorid']][_0x2a43('0x11')]('\x20'),'mixmonitorid':_0x50d199[_0x2a43('0x68')]});})[_0x2a43('0x18')](function(_0x89e9c6){_0x377b98(_0x486059[_0x2a43('0x19')](0x1f5,[_0x222bad['uniqueid'],_0x89e9c6[_0x2a43('0x17')][_0x2a43('0x64')]()]['join']('\x20')));});}else{return _0x377b98(_0x486059[_0x2a43('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2cc624){var _0x2c6200=this;return new Promise(function(_0x25eee3,_0x3111ed){if(ami['isConnected']()==![]){return _0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')]['username'],_0x2a43('0x59')]['join']('\x20')));}var _0x172d1d=schema(properties['voicechannel'])[_0x2a43('0x2')](_0x2cc624);if(_0x172d1d[_0x2a43('0x5b')]>0x0){return _0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f4,_[_0x2a43('0x5c')](_0x172d1d,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x1d4412=_['find'](_0x259f70['channels'],{'uniqueid':_0x2cc624[_0x2a43('0x5e')]});if(_0x1d4412){return BPromise[_0x2a43('0x6a')]()['then'](function(){if(_0x1d4412[_0x2a43('0x6b')]){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x6c'),'channel':_0x1d4412[_0x2a43('0x6b')],'mixmonitorid':_0x2cc624[_0x2a43('0x68')]})[_0x2a43('0x18')](function(_0x426b56){});}})[_0x2a43('0x16')](function(){if(_0x1d4412['destinationchannel']){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x6c'),'channel':_0x1d4412[_0x2a43('0x6d')],'mixmonitorid':_0x2cc624[_0x2a43('0x68')]})[_0x2a43('0x18')](function(_0xdc55df){});}})['then'](function(_0x14d94b){var _0x93d3a7=_[_0x2a43('0x5d')](_0x1d4412[_0x2a43('0x66')],{'mixmonitorid':_0x2cc624[_0x2a43('0x68')]});if(_0x93d3a7){_0x93d3a7['status']=_0x2a43('0x6e');}})[_0x2a43('0x16')](function(){var _0x1ece61=util['format'](_0x2a43('0x5f'),_0x2cc624[_0x2a43('0x60')]||_0x2cc624[_0x2a43('0x5e')],_0x2cc624[_0x2a43('0x6')]||'wav');var _0x3c1a00=_[_0x2a43('0x5d')](_0x1d4412[_0x2a43('0x66')],{'filename':_0x2a43('0x63')+_0x1ece61[_0x2a43('0x64')]()});if(_0x3c1a00){_0x3c1a00[_0x2a43('0x6f')]=_0x2a43('0x6e');}})[_0x2a43('0x16')](function(){_0x25eee3({'code':0xc8,'message':[_0x2cc624[_0x2a43('0x5e')],_0x2a43('0x70')][_0x2a43('0x11')]('\x20')});})[_0x2a43('0x18')](function(_0x249032){_0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f5,[_0x2cc624[_0x2a43('0x5e')],_0x249032[_0x2a43('0x17')][_0x2a43('0x64')]()]['join']('\x20')));});}else{return _0x3111ed(_0x2c6200[_0x2a43('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1e2f22){return new Promise(function(_0x5d2d5b,_0x24e037){var _0x5c724c=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x72')]);_0x5d2d5b({'count':_0x5c724c[_0x2a43('0x5b')],'rows':_0x5c724c});});},'VoiceQueuesChannel':function(_0x28eb5d){var _0x355ad9=this;return new Promise(function(_0xe44c44,_0x4cf6af){var _0x4cfd05=schema(properties[_0x2a43('0x73')])['validate'](_0x28eb5d);if(_0x4cfd05[_0x2a43('0x5b')]>0x0){return _0x4cf6af(_0x355ad9['error'](0x1f4,_[_0x2a43('0x5c')](_0x4cfd05,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x477f24=_[_0x2a43('0x5d')](_0x259f70[_0x2a43('0x72')],{'uniqueid':_0x28eb5d[_0x2a43('0x5e')]});if(_0x477f24){_0xe44c44(_0x477f24);}else{return _0x4cf6af(_0x355ad9[_0x2a43('0x19')](0x1f5,_0x2a43('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x1cb543){var _0x3609b6=this;return new Promise(function(_0x12e1c0,_0x308721){if(ami[_0x2a43('0xe')]()==![]){return _0x308721(_0x3609b6[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config[_0x2a43('0xf')]['username'],_0x2a43('0x59')][_0x2a43('0x11')]('\x20')));}var _0x3c0f36=schema(properties[_0x2a43('0x75')])[_0x2a43('0x2')](_0x1cb543);if(_0x3c0f36['length']>0x0){return _0x308721(_0x3609b6['error'](0x1f4,_[_0x2a43('0x5c')](_0x3c0f36,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x4ced19=_['find'](_0x259f70[_0x2a43('0x72')],{'uniqueid':_0x1cb543['uniqueid']});if(_0x4ced19&&_0x4ced19['channel']){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x76'),'channel':_0x4ced19[_0x2a43('0x6b')]})['then'](function(_0x11daed){_0x12e1c0({'code':0xc8,'message':[_0x1cb543['uniqueid'],_0x11daed['message'][_0x2a43('0x64')]()][_0x2a43('0x11')]('\x20')});})[_0x2a43('0x18')](function(_0x1daa66){_0x308721(_0x3609b6['error'](0x1f5,[_0x1cb543[_0x2a43('0x5e')],_0x1daa66[_0x2a43('0x17')][_0x2a43('0x64')]()][_0x2a43('0x11')]('\x20')));});}else{return _0x308721(_0x3609b6[_0x2a43('0x19')](0x1f5,_0x2a43('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x138dac){var _0x25c524=this;return new Promise(function(_0xb5279c,_0x3d8728){if(ami[_0x2a43('0xe')]()==![]){return _0x3d8728(_0x25c524[_0x2a43('0x19')](0x1f4,[config[_0x2a43('0xf')]['ip'],config['asterisk'][_0x2a43('0x10')],_0x2a43('0x59')][_0x2a43('0x11')]('\x20')));}var _0x57ea39=schema(properties[_0x2a43('0x77')])[_0x2a43('0x2')](_0x138dac);if(_0x57ea39['length']>0x0){return _0x3d8728(_0x25c524[_0x2a43('0x19')](0x1f4,_['map'](_0x57ea39,_0x2a43('0x17'))[_0x2a43('0x11')](',\x20')));}var _0x365fc1=_[_0x2a43('0x5d')](_0x259f70[_0x2a43('0x72')],{'uniqueid':_0x138dac['uniqueid']});if(_0x365fc1&&_0x365fc1[_0x2a43('0x6b')]){return ami[_0x2a43('0x1c')]({'action':_0x2a43('0x78'),'channel':_0x365fc1[_0x2a43('0x6b')],'exten':_0x138dac[_0x2a43('0x79')],'context':_0x138dac[_0x2a43('0x7a')]||_0x365fc1['context'],'priority':0x1})['then'](function(_0x1f9e11){_0xb5279c({'code':0xc8,'message':[_0x138dac[_0x2a43('0x5e')],_0x1f9e11[_0x2a43('0x17')][_0x2a43('0x64')]()][_0x2a43('0x11')]('\x20')});})[_0x2a43('0x18')](function(_0x313b6c){_0x3d8728(_0x25c524[_0x2a43('0x19')](0x1f5,[_0x138dac[_0x2a43('0x5e')],_0x313b6c[_0x2a43('0x17')][_0x2a43('0x64')]()]['join']('\x20')));});}else{return _0x3d8728(_0x25c524['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3e50d6){return new Promise(function(_0x120884,_0x4cfa66){var _0x28cfcb=_[_0x2a43('0x71')](_0x259f70['agents']);_0x120884({'count':_0x28cfcb[_0x2a43('0x5b')],'rows':_0x28cfcb});});},'Telephones':function(_0xeb7100){return new Promise(function(_0x5f17b4,_0x5a1264){var _0x534126=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7b')]);_0x5f17b4({'count':_0x534126[_0x2a43('0x5b')],'rows':_0x534126});});},'Trunks':function(_0x17cdbe){return new Promise(function(_0x5ed9ca,_0x41e905){var _0x316d37=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7c')]);_0x5ed9ca({'count':_0x316d37['length'],'rows':_0x316d37});});},'OutboundChannels':function(_0x1b328f){return new Promise(function(_0x51dacf,_0x1c3eda){var _0x442175=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7d')]);_0x51dacf({'count':_0x442175[_0x2a43('0x5b')],'rows':_0x442175});});},'Outbound':function(_0x46f4c1){return new Promise(function(_0x11cfc9,_0x244ba4){_0x11cfc9(_0x259f70[_0x2a43('0x2d')]);});},'Campaigns':function(_0x1174bf){return new Promise(function(_0x115dda,_0x3b0ece){var _0x3abfe7=_[_0x2a43('0x71')](_0x259f70[_0x2a43('0x7e')]);_0x115dda({'count':_0x3abfe7[_0x2a43('0x5b')],'rows':_0x3abfe7});});},'VoiceQueuesPreview':function(_0x3e5bd9){var _0x20cd78=this;return new Promise(function(_0x7e2d3,_0x117a69){_0x46d7c6[_0x2a43('0x7f')](_0x3e5bd9['id'])[_0x2a43('0x16')](function(_0x305792){_0x7e2d3({'code':0xc8,'message':_0x305792[_0x2a43('0x17')]});})[_0x2a43('0x18')](function(_0x9207d0){_0x117a69(_0x20cd78[_0x2a43('0x19')](0x1f4,_0x9207d0[_0x2a43('0x17')]));});});},'EventManager':function(_0x69f438){var _0x4806dc=this;return new Promise(function(_0x55e800,_0x5afe6d){if(!_0x69f438['event']){return _0x5afe6d(_0x4806dc[_0x2a43('0x19')](0x1f4,_0x2a43('0x80')));}ami['emit'](_0x2a43('0x81')+_0x69f438[_0x2a43('0x82')],_0x69f438[_0x2a43('0x17')]);_0x55e800({'code':0xc8,'message':_0x69f438});});},'FaxAccounts':function(_0x441468){return new Promise(function(_0xb7a644,_0x7137af){var _0x10da9f=_['values'](_0x259f70[_0x2a43('0x83')]);_0xb7a644({'count':_0x10da9f[_0x2a43('0x5b')],'rows':_0x10da9f});});},'SendFax':function(_0x24f58c){var _0x361779=this;return new Promise(function(_0x1bd89b,_0x47d641){_0xd0af31['send'](_0x24f58c)[_0x2a43('0x16')](function(_0x1ab3de){_0x1bd89b({'code':0xc8,'message':_0x1ab3de['message']});})[_0x2a43('0x18')](function(_0x7629c2){_0x47d641(_0x361779[_0x2a43('0x19')](0x1f4,_0x7629c2[_0x2a43('0x17')]));});});},'CheckAfterSend':function(_0x56de7d){var _0xac68f=this;return new Promise(function(_0x5a2b3c,_0x296d8d){_0xd0af31['checkAfterSend'](_0x56de7d)['then'](function(_0x126f82){_0x5a2b3c({'code':0xc8,'message':_0x126f82[_0x2a43('0x17')]});})[_0x2a43('0x18')](function(_0x19f293){_0x296d8d(_0xac68f['error'](0x1f4,_0x19f293[_0x2a43('0x17')]));});});}};var _0x13706b=jayson['server'](_0x290b82)[_0x2a43('0x84')]();_0x13706b['on'](_0x2a43('0x19'),function(_0x28548c){return _0x235108(_0x28548c);});_0x13706b['listen'](0x232a,_0x2a43('0x85'),function(){console[_0x2a43('0x86')](_0x2a43('0x87'),0x232a);return _0x42fa46(_0x2a43('0x88')+0x232a);});});}; \ No newline at end of file +var _0x3384=['../ami','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','Action','then','message','command','Command','content','catch','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','values','channels','voicechannel','find','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','filename','StopMixMonitor\x20Success','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate'];(function(_0x501a04,_0xacaf19){var _0x69bf75=function(_0x11f5df){while(--_0x11f5df){_0x501a04['push'](_0x501a04['shift']());}};_0x69bf75(++_0xacaf19);}(_0x3384,0x10c));var _0x4338=function(_0x10cd68,_0x5e7125){_0x10cd68=_0x10cd68-0x0;var _0x5894e9=_0x3384[_0x10cd68];return _0x5894e9;};'use strict';var _=require(_0x4338('0x0'));var util=require(_0x4338('0x1'));var jayson=require(_0x4338('0x2'));var schema=require(_0x4338('0x3'));var BPromise=require('bluebird');var moment=require('moment');var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x4338('0x4'));exports[_0x4338('0x5')]=function(_0x780825,_0x17774f,_0x78533c){return new BPromise(function(_0x1c41cd,_0x55d571){var _0x238484={'QueuePause':function(_0x38f38a){return new Promise(function(_0x33ecd3,_0x58986c){var _0xc566cc=util[_0x4338('0x6')]('%s/%s',_0x4338('0x7'),_0x38f38a[_0x4338('0x8')]);if(_0x780825['timers']&&_0x780825[_0x4338('0x9')][_0xc566cc]&&_0x780825['timers'][_0xc566cc][_0x4338('0xa')]){_0x780825[_0x4338('0x9')][_0xc566cc][_0x4338('0xb')]();}if(_0x780825['agents'][_0xc566cc]){_0x780825[_0x4338('0xc')][_0xc566cc][_0x4338('0xd')]({'statePause':_0x38f38a[_0x4338('0xe')]?!![]:![]});}_0x33ecd3({'code':0xc8,'message':_0x4338('0xf')});});},'Reload':function(_0x402f01){var _0x2ba177=this;return new Promise(function(_0x239475,_0x4d83b7){if(ami[_0x4338('0x10')]()==![]){return _0x4d83b7(_0x2ba177[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}_0x402f01=_[_0x4338('0x16')](_0x402f01,_['keys'](properties[_0x4338('0x17')]));_0x402f01[_0x4338('0x18')]=_0x4338('0x19');return ami[_0x4338('0x1a')](_0x402f01)[_0x4338('0x1b')](function(_0x50894b){_0x239475({'code':0xc8,'message':_0x50894b['message']});})['catch'](function(_0x3f57f9){_0x4d83b7(_0x2ba177[_0x4338('0x11')](0x1f5,_0x3f57f9[_0x4338('0x1c')]));});});},'Command':function(_0x598c18){var _0x468d39=this;return new Promise(function(_0x3b3b28,_0x404826){if(ami[_0x4338('0x10')]()==![]){return _0x404826(_0x468d39['error'](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}_0x598c18=_[_0x4338('0x16')](_0x598c18,_0x4338('0x1d'));_0x598c18[_0x4338('0x18')]=_0x4338('0x1e');return ami[_0x4338('0x1a')](_0x598c18)['then'](function(_0x3c0bc6){_0x3b3b28({'code':0xc8,'message':_0x3c0bc6[_0x4338('0x1f')]});})[_0x4338('0x20')](function(_0xf7b008){_0x404826(_0x468d39['error'](0x1f5,_0xf7b008[_0x4338('0x1c')]));});});},'VoiceQueues':function(_0x1ace9c){return new Promise(function(_0x51f36e,_0x2dfe1c){var _0x2b57c4=[];for(var _0x327349 in _0x780825['voiceQueues']){if(_0x780825['voiceQueues'][_0x4338('0x21')](_0x327349)){var _0x4a77b2=_0x780825[_0x4338('0x22')][_0x327349];var _0x2f131f={'id':_0x4a77b2['id'],'name':_0x4a77b2[_0x4338('0x8')],'strategy':_0x4a77b2[_0x4338('0x23')],'answered':_0x4a77b2[_0x4338('0x24')],'available':_0x4a77b2[_0x4338('0x25')],'loggedIn':_0x4a77b2[_0x4338('0x26')],'pTalking':_0x4a77b2[_0x4338('0x27')],'sumBillable':_0x4a77b2['sumBillable'],'sumDuration':_0x4a77b2[_0x4338('0x28')],'sumHoldTime':_0x4a77b2[_0x4338('0x29')]||0x0,'talking':_0x4a77b2[_0x4338('0x2a')],'total':_0x4a77b2[_0x4338('0x2b')],'type':_0x4a77b2[_0x4338('0x2c')],'unmanaged':_0x4a77b2[_0x4338('0x2d')],'abandoned':_0x4a77b2['abandoned'],'waiting':_0x4a77b2[_0x4338('0x2e')],'loggedInDb':_0x4a77b2['loggedInDb']};if(_0x4a77b2[_0x4338('0x2c')]===_0x4338('0x2f')){_0x2f131f[_0x4338('0x30')]=_0x4a77b2[_0x4338('0x30')];_0x2f131f[_0x4338('0x31')]=_0x4a77b2[_0x4338('0x31')];_0x2f131f[_0x4338('0x32')]=_0x4a77b2[_0x4338('0x32')];_0x2f131f[_0x4338('0x33')]=_0x4a77b2[_0x4338('0x33')];_0x2f131f[_0x4338('0x34')]=_0x4a77b2['dialOriginateTimeout'];_0x2f131f[_0x4338('0x35')]=_0x4a77b2[_0x4338('0x35')];_0x2f131f['outboundAnswerAgiCallsDay']=_0x4a77b2[_0x4338('0x36')];_0x2f131f[_0x4338('0x37')]=_0x4a77b2['outboundAnswerCallsDay'];_0x2f131f['outboundBlacklistCallsDay']=_0x4a77b2['outboundBlacklistCallsDay'];_0x2f131f[_0x4338('0x38')]=_0x4a77b2[_0x4338('0x38')];_0x2f131f[_0x4338('0x39')]=_0x4a77b2[_0x4338('0x39')];_0x2f131f[_0x4338('0x3a')]=_0x4a77b2['outboundDropCallsDayACS'];_0x2f131f[_0x4338('0x3b')]=_0x4a77b2[_0x4338('0x3b')];_0x2f131f[_0x4338('0x3c')]=_0x4a77b2[_0x4338('0x3c')];_0x2f131f[_0x4338('0x3d')]=_0x4a77b2[_0x4338('0x3d')];_0x2f131f[_0x4338('0x3e')]=_0x4a77b2[_0x4338('0x3e')];_0x2f131f[_0x4338('0x3f')]=_0x4a77b2[_0x4338('0x3f')];_0x2f131f[_0x4338('0x40')]=_0x4a77b2[_0x4338('0x40')];_0x2f131f[_0x4338('0x41')]=_0x4a77b2[_0x4338('0x41')];_0x2f131f[_0x4338('0x42')]=_0x4a77b2[_0x4338('0x42')];_0x2f131f['predictiveIntervalAnsweredCalls']=_0x4a77b2[_0x4338('0x43')];_0x2f131f['predictiveIntervalAvgHoldtime']=_0x4a77b2[_0x4338('0x44')];_0x2f131f[_0x4338('0x45')]=_0x4a77b2[_0x4338('0x45')];_0x2f131f[_0x4338('0x46')]=_0x4a77b2[_0x4338('0x46')];_0x2f131f['predictiveIntervalDroppedCallsTimeout']=_0x4a77b2['predictiveIntervalDroppedCallsTimeout'];_0x2f131f[_0x4338('0x47')]=_0x4a77b2[_0x4338('0x47')];_0x2f131f[_0x4338('0x48')]=_0x4a77b2[_0x4338('0x48')];_0x2f131f[_0x4338('0x49')]=_0x4a77b2[_0x4338('0x49')];_0x2f131f[_0x4338('0x4a')]=_0x4a77b2[_0x4338('0x4a')];_0x2f131f[_0x4338('0x4b')]=_0x4a77b2[_0x4338('0x4b')];_0x2f131f[_0x4338('0x4c')]=_0x4a77b2[_0x4338('0x4c')];_0x2f131f['predictiveIntervalTotalCalls']=_0x4a77b2['predictiveIntervalTotalCalls'];_0x2f131f['message']=_0x4a77b2[_0x4338('0x1c')];_0x2f131f['originated']=_0x4a77b2[_0x4338('0x4d')];_0x2f131f[_0x4338('0x4e')]=_0x4a77b2[_0x4338('0x4e')];_0x2f131f[_0x4338('0x4f')]=_0x4a77b2[_0x4338('0x4f')];_0x2f131f[_0x4338('0x50')]=_0x4a77b2[_0x4338('0x50')];_0x2f131f['erlangBusyFactor']=_0x4a77b2[_0x4338('0x51')];_0x2f131f[_0x4338('0x52')]=_0x4a77b2['startPredictive'];_0x2f131f[_0x4338('0x53')]=_0x4a77b2['startProgressive'];}if(_0x4a77b2['Trunk']){_0x2f131f[_0x4338('0x54')]={'id':_0x4a77b2[_0x4338('0x54')]['id'],'name':_0x4a77b2[_0x4338('0x54')][_0x4338('0x8')],'active':_0x4a77b2[_0x4338('0x54')]['active'],'callerid':_0x4a77b2['Trunk'][_0x4338('0x55')]};}if(_0x4a77b2[_0x4338('0x56')]){_0x2f131f[_0x4338('0x56')]={'id':_0x4a77b2[_0x4338('0x56')]['id'],'name':_0x4a77b2[_0x4338('0x56')]['name']};}_0x2b57c4[_0x4338('0x57')](_0x2f131f);}}_0x51f36e({'count':_0x2b57c4[_0x4338('0x58')],'rows':_0x2b57c4});});},'VoiceChannels':function(_0x135fd9){return new Promise(function(_0x8d31f1,_0x292ba3){var _0x42bbc1=_[_0x4338('0x59')](_0x780825[_0x4338('0x5a')]);_0x8d31f1({'count':_0x42bbc1['length'],'rows':_0x42bbc1});});},'VoiceChannelMixMonitor':function(_0x375fac){var _0xdb8296=this;return new Promise(function(_0x54fd35,_0x1ce63e){if(ami[_0x4338('0x10')]()==![]){return _0x1ce63e(_0xdb8296[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config['asterisk'][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0x17fd01=schema(properties[_0x4338('0x5b')])[_0x4338('0x3')](_0x375fac);if(_0x17fd01[_0x4338('0x58')]>0x0){return _0x1ce63e(_0xdb8296[_0x4338('0x11')](0x1f4,_['map'](_0x17fd01,_0x4338('0x1c'))[_0x4338('0x15')](',\x20')));}var _0xf973f0=_[_0x4338('0x5c')](_0x780825[_0x4338('0x5a')],{'uniqueid':_0x375fac[_0x4338('0x5d')]});if(_0xf973f0&&_0xf973f0[_0x4338('0x5e')]){var _0x1fa46a=util[_0x4338('0x6')]('%s.%s',_0x375fac['filename']||_0x375fac['uniqueid'],_0x375fac[_0x4338('0x6')]||_0x4338('0x5f'));return ami[_0x4338('0x1a')]({'action':_0x4338('0x60'),'channel':_0xf973f0[_0x4338('0x5e')],'file':_0x1fa46a,'options':_0x4338('0x61')})[_0x4338('0x1b')](function(_0x3222cc){var _0x38d0ac=_[_0x4338('0x5c')](_0xf973f0[_0x4338('0x62')],{'filename':_0x4338('0x63')+_0x1fa46a[_0x4338('0x64')]()});if(_[_0x4338('0x65')](_0x38d0ac)){_0xf973f0['monitors'][_0x4338('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x1fa46a[_0x4338('0x64')](),'createdAt':moment()[_0x4338('0x6')](_0x4338('0x66')),'mixmonitorid':_0x3222cc[_0x4338('0x67')],'status':'rec'});}else{_0x38d0ac[_0x4338('0x67')]=_0x3222cc[_0x4338('0x67')];_0x38d0ac[_0x4338('0x68')]=_0x4338('0x69');}_0x54fd35({'code':0xc8,'message':[_0x375fac['uniqueid'],_0x4338('0x6a'),_0x3222cc[_0x4338('0x67')]][_0x4338('0x15')]('\x20'),'mixmonitorid':_0x3222cc['mixmonitorid']});})[_0x4338('0x20')](function(_0x195ac4){_0x1ce63e(_0xdb8296[_0x4338('0x11')](0x1f5,[_0x375fac[_0x4338('0x5d')],_0x195ac4[_0x4338('0x1c')][_0x4338('0x64')]()][_0x4338('0x15')]('\x20')));});}else{return _0x1ce63e(_0xdb8296['error'](0x1f5,_0x4338('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x382d23){var _0x5b406f=this;return new Promise(function(_0x46c18d,_0x56b3a0){if(ami[_0x4338('0x10')]()==![]){return _0x56b3a0(_0x5b406f[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0xc2b8a0=schema(properties['voicechannel'])[_0x4338('0x3')](_0x382d23);if(_0xc2b8a0['length']>0x0){return _0x56b3a0(_0x5b406f[_0x4338('0x11')](0x1f4,_[_0x4338('0x6c')](_0xc2b8a0,_0x4338('0x1c'))['join'](',\x20')));}var _0x24af69=_['find'](_0x780825['channels'],{'uniqueid':_0x382d23[_0x4338('0x5d')]});if(_0x24af69){return BPromise[_0x4338('0x6d')]()[_0x4338('0x1b')](function(){if(_0x24af69[_0x4338('0x5e')]){return ami[_0x4338('0x1a')]({'action':_0x4338('0x6e'),'channel':_0x24af69['channel'],'mixmonitorid':_0x382d23[_0x4338('0x67')]})[_0x4338('0x20')](function(_0x4f610a){});}})[_0x4338('0x1b')](function(){if(_0x24af69[_0x4338('0x6f')]){return ami[_0x4338('0x1a')]({'action':_0x4338('0x6e'),'channel':_0x24af69[_0x4338('0x6f')],'mixmonitorid':_0x382d23[_0x4338('0x67')]})[_0x4338('0x20')](function(_0x543bca){});}})[_0x4338('0x1b')](function(_0x1449ad){var _0x29f081=_[_0x4338('0x5c')](_0x24af69[_0x4338('0x62')],{'mixmonitorid':_0x382d23[_0x4338('0x67')]});if(_0x29f081){_0x29f081[_0x4338('0x68')]=_0x4338('0x70');}})[_0x4338('0x1b')](function(){var _0x279a02=util[_0x4338('0x6')](_0x4338('0x71'),_0x382d23[_0x4338('0x72')]||_0x382d23[_0x4338('0x5d')],_0x382d23[_0x4338('0x6')]||_0x4338('0x5f'));var _0x3d09c4=_[_0x4338('0x5c')](_0x24af69[_0x4338('0x62')],{'filename':_0x4338('0x63')+_0x279a02[_0x4338('0x64')]()});if(_0x3d09c4){_0x3d09c4[_0x4338('0x68')]=_0x4338('0x70');}})['then'](function(){_0x46c18d({'code':0xc8,'message':[_0x382d23[_0x4338('0x5d')],_0x4338('0x73')][_0x4338('0x15')]('\x20')});})[_0x4338('0x20')](function(_0x3a3a88){_0x56b3a0(_0x5b406f['error'](0x1f5,[_0x382d23[_0x4338('0x5d')],_0x3a3a88[_0x4338('0x1c')][_0x4338('0x64')]()]['join']('\x20')));});}else{return _0x56b3a0(_0x5b406f[_0x4338('0x11')](0x1f5,_0x4338('0x6b')));}});},'VoiceQueuesChannels':function(_0x237e8e){return new Promise(function(_0x50c573,_0x295a76){var _0x34bc87=_[_0x4338('0x59')](_0x780825['queueChannels']);_0x50c573({'count':_0x34bc87[_0x4338('0x58')],'rows':_0x34bc87});});},'VoiceQueuesChannel':function(_0x1c0a44){var _0x1214d9=this;return new Promise(function(_0x6ba716,_0x54b95e){var _0x2a144f=schema(properties['voicequeuechannel'])['validate'](_0x1c0a44);if(_0x2a144f[_0x4338('0x58')]>0x0){return _0x54b95e(_0x1214d9[_0x4338('0x11')](0x1f4,_['map'](_0x2a144f,_0x4338('0x1c'))[_0x4338('0x15')](',\x20')));}var _0x56d1d5=_['find'](_0x780825['queueChannels'],{'uniqueid':_0x1c0a44[_0x4338('0x5d')]});if(_0x56d1d5){_0x6ba716(_0x56d1d5);}else{return _0x54b95e(_0x1214d9[_0x4338('0x11')](0x1f5,_0x4338('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x3458f1){var _0x5eaf1f=this;return new Promise(function(_0x631fc4,_0x3fb37d){if(ami[_0x4338('0x10')]()==![]){return _0x3fb37d(_0x5eaf1f[_0x4338('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0x2d154e=schema(properties['voicequeuechannelhangup'])[_0x4338('0x3')](_0x3458f1);if(_0x2d154e[_0x4338('0x58')]>0x0){return _0x3fb37d(_0x5eaf1f[_0x4338('0x11')](0x1f4,_[_0x4338('0x6c')](_0x2d154e,_0x4338('0x1c'))['join'](',\x20')));}var _0x10512c=_['find'](_0x780825[_0x4338('0x74')],{'uniqueid':_0x3458f1[_0x4338('0x5d')]});if(_0x10512c&&_0x10512c['channel']){return ami[_0x4338('0x1a')]({'action':_0x4338('0x75'),'channel':_0x10512c['channel']})['then'](function(_0x31437a){_0x631fc4({'code':0xc8,'message':[_0x3458f1[_0x4338('0x5d')],_0x31437a['message'][_0x4338('0x64')]()]['join']('\x20')});})[_0x4338('0x20')](function(_0x2c6502){_0x3fb37d(_0x5eaf1f['error'](0x1f5,[_0x3458f1['uniqueid'],_0x2c6502[_0x4338('0x1c')][_0x4338('0x64')]()][_0x4338('0x15')]('\x20')));});}else{return _0x3fb37d(_0x5eaf1f[_0x4338('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1dd7cf){var _0x135a03=this;return new Promise(function(_0x4ae1af,_0x3e3fdb){if(ami[_0x4338('0x10')]()==![]){return _0x3e3fdb(_0x135a03[_0x4338('0x11')](0x1f4,[config[_0x4338('0x12')]['ip'],config[_0x4338('0x12')][_0x4338('0x13')],_0x4338('0x14')][_0x4338('0x15')]('\x20')));}var _0x1a81ed=schema(properties[_0x4338('0x76')])[_0x4338('0x3')](_0x1dd7cf);if(_0x1a81ed[_0x4338('0x58')]>0x0){return _0x3e3fdb(_0x135a03[_0x4338('0x11')](0x1f4,_[_0x4338('0x6c')](_0x1a81ed,'message')[_0x4338('0x15')](',\x20')));}var _0x142944=_[_0x4338('0x5c')](_0x780825[_0x4338('0x74')],{'uniqueid':_0x1dd7cf['uniqueid']});if(_0x142944&&_0x142944[_0x4338('0x5e')]){return ami[_0x4338('0x1a')]({'action':_0x4338('0x77'),'channel':_0x142944[_0x4338('0x5e')],'exten':_0x1dd7cf[_0x4338('0x78')],'context':_0x1dd7cf[_0x4338('0x79')]||_0x142944['context'],'priority':0x1})[_0x4338('0x1b')](function(_0x161aef){_0x4ae1af({'code':0xc8,'message':[_0x1dd7cf[_0x4338('0x5d')],_0x161aef[_0x4338('0x1c')][_0x4338('0x64')]()]['join']('\x20')});})[_0x4338('0x20')](function(_0x25040d){_0x3e3fdb(_0x135a03[_0x4338('0x11')](0x1f5,[_0x1dd7cf[_0x4338('0x5d')],_0x25040d[_0x4338('0x1c')][_0x4338('0x64')]()][_0x4338('0x15')]('\x20')));});}else{return _0x3e3fdb(_0x135a03['error'](0x1f5,_0x4338('0x6b')));}});},'Agents':function(_0x5f144d){return new Promise(function(_0x4d1ae2,_0x3b2245){var _0x1cd30e=_[_0x4338('0x59')](_0x780825[_0x4338('0xc')]);_0x4d1ae2({'count':_0x1cd30e[_0x4338('0x58')],'rows':_0x1cd30e});});},'Telephones':function(_0x4666cb){return new Promise(function(_0x416902,_0x29d7b2){var _0x2d3d7e=_[_0x4338('0x59')](_0x780825[_0x4338('0x7a')]);_0x416902({'count':_0x2d3d7e['length'],'rows':_0x2d3d7e});});},'Trunks':function(_0x5f3bc8){return new Promise(function(_0x5a17fb,_0x32c034){var _0x492372=_[_0x4338('0x59')](_0x780825[_0x4338('0x7b')]);_0x5a17fb({'count':_0x492372[_0x4338('0x58')],'rows':_0x492372});});},'OutboundChannels':function(_0x46813c){return new Promise(function(_0x4d6eed,_0x1d93ba){var _0x4973c0=_[_0x4338('0x59')](_0x780825[_0x4338('0x7c')]);_0x4d6eed({'count':_0x4973c0[_0x4338('0x58')],'rows':_0x4973c0});});},'Outbound':function(_0x7b8ec){return new Promise(function(_0x3aae04,_0x3a3bf1){_0x3aae04(_0x780825[_0x4338('0x2f')]);});},'Campaigns':function(_0x3e5209){return new Promise(function(_0x1a3ea6,_0x4f715a){var _0x1fc5c4=_['values'](_0x780825[_0x4338('0x7d')]);_0x1a3ea6({'count':_0x1fc5c4[_0x4338('0x58')],'rows':_0x1fc5c4});});},'VoiceQueuesPreview':function(_0x42f8b8){var _0x5dbe65=this;return new Promise(function(_0x2f72c2,_0x3782bd){_0x17774f['run'](_0x42f8b8['id'])['then'](function(_0x100293){_0x2f72c2({'code':0xc8,'message':_0x100293[_0x4338('0x1c')]});})['catch'](function(_0x3e649e){_0x3782bd(_0x5dbe65[_0x4338('0x11')](0x1f4,_0x3e649e['message']));});});},'EventManager':function(_0xb776f6){var _0x3245c7=this;return new Promise(function(_0x5a77a1,_0x1e719c){if(!_0xb776f6[_0x4338('0x7e')]){return _0x1e719c(_0x3245c7[_0x4338('0x11')](0x1f4,_0x4338('0x7f')));}ami['emit'](_0x4338('0x80')+_0xb776f6[_0x4338('0x7e')],_0xb776f6['message']);_0x5a77a1({'code':0xc8,'message':_0xb776f6});});},'FaxAccounts':function(_0x1bd6a9){return new Promise(function(_0x365bf9,_0x928dd2){var _0x25a7a3=_[_0x4338('0x59')](_0x780825['faxAccounts']);_0x365bf9({'count':_0x25a7a3[_0x4338('0x58')],'rows':_0x25a7a3});});},'SendFax':function(_0x2cdef5){var _0x133024=this;return new Promise(function(_0x335bf6,_0x5bf201){_0x78533c['send'](_0x2cdef5)[_0x4338('0x1b')](function(_0x1928f6){_0x335bf6({'code':0xc8,'message':_0x1928f6['message']});})[_0x4338('0x20')](function(_0x2f228c){_0x5bf201(_0x133024[_0x4338('0x11')](0x1f4,_0x2f228c[_0x4338('0x1c')]));});});},'CheckAfterSend':function(_0x1cb3d9){var _0x42f5f3=this;return new Promise(function(_0x2993b0,_0x16dd8f){_0x78533c[_0x4338('0x81')](_0x1cb3d9)[_0x4338('0x1b')](function(_0x53f696){_0x2993b0({'code':0xc8,'message':_0x53f696[_0x4338('0x1c')]});})[_0x4338('0x20')](function(_0x2f0294){_0x16dd8f(_0x42f5f3[_0x4338('0x11')](0x1f4,_0x2f0294[_0x4338('0x1c')]));});});}};var _0x48b19f=jayson[_0x4338('0x82')](_0x238484)[_0x4338('0x83')]();_0x48b19f['on'](_0x4338('0x11'),function(_0x1345cb){return _0x55d571(_0x1345cb);});_0x48b19f[_0x4338('0x5')](0x232a,_0x4338('0x84'),function(){console[_0x4338('0x85')](_0x4338('0x86'),0x232a);return _0x1c41cd(_0x4338('0x87')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 500dc6a..5ca5afe 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 _0x32f6=['fax','createdAt','scheduledAt','updatedAt','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','redis','defaults','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','firstName','mobile'];(function(_0xcdabd0,_0x45b3df){var _0x436a2f=function(_0x251b29){while(--_0x251b29){_0xcdabd0['push'](_0xcdabd0['shift']());}};_0x436a2f(++_0x45b3df);}(_0x32f6,0xc7));var _0x632f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x32f6[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x632f('0x0'));var BPromise=require(_0x632f('0x1'));var Redis=require(_0x632f('0x2'));var util=require(_0x632f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x632f('0x4'))(_0x632f('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x632f('0x6')]=_[_0x632f('0x7')](config[_0x632f('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x632f('0x6')]));function emit(_0x47f652,_0x3e94e6,_0x359fc6,_0x458672,_0x54bf68){logger[_0x632f('0x8')](_0x632f('0x9'),_0x47f652,_0x3e94e6['id'],_0x359fc6,_0x458672,JSON[_0x632f('0xa')](_0x54bf68));io['to'](_0x359fc6)[_0x632f('0xb')](_0x458672,_0x54bf68);}exports[_0x632f('0xc')]=function(_0x49dfb3,_0x200e07,_0x18aea8,_0x3e45a3){var _0x27cfe9,_0x26cd13;var _0xf64f72={};var _0x106fd9=Number(_0x18aea8[_0x632f('0xd')]);var _0x43ddbd=_0x18aea8['data2']?Boolean(Number(_0x18aea8[_0x632f('0xe')])):![];var _0x5aa30c;if(_0x3e45a3[_0x632f('0xf')]){_0xf64f72['id']=_0x3e45a3[_0x632f('0xf')];}if(!_0xf64f72['id']){_0xf64f72[_0x632f('0x10')]=_0x106fd9;_0x5aa30c=_0x18aea8[_0x632f('0x11')]&&_0x18aea8[_0x632f('0x11')]!=='0'?_0x18aea8['data3'][_0x632f('0x12')](','):[_0x632f('0x13')];_0xf64f72[_0x632f('0x14')]=_['map'](_0x5aa30c,function(_0x2ee959){var _0x3a1d62={};_0x3a1d62[_0x2ee959]=_0x3e45a3['routeId']?_0x3e45a3[_0x632f('0x15')]:_0x3e45a3[_0x632f('0x16')];return _0x3a1d62;});}var _0x1c184c=['id',_0x632f('0x17'),'lastName',_0x632f('0x13'),_0x632f('0x18'),_0x632f('0x19'),_0x632f('0x10'),_0x632f('0x1a'),_0x632f('0x1b'),_0x632f('0x1c')];var _0x14c2bc=_['union'](_0x1c184c,_0x5aa30c);BPromise['resolve']()['then'](cmContactRpc[_0x632f('0x1d')]({'attributes':_0x14c2bc,'where':_0xf64f72}))[_0x632f('0x1e')](function(_0x364f77){_0x26cd13=_0x364f77;if(!_[_0x632f('0x1f')](_0x26cd13)){if(_0x26cd13[_0x632f('0x20')]===0x1){_0x27cfe9=_0x26cd13[0x0];logger[_0x632f('0x8')](_0x632f('0x21'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id'],_0x27cfe9['id']);}else{logger[_0x632f('0x8')](_0x632f('0x23'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id'],_[_0x632f('0x24')](_0x26cd13,'id')[_0x632f('0x25')](','));}return;}else{logger[_0x632f('0x8')](_0x632f('0x26'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id']);var _0x49b01e={'ListId':_0x106fd9};var _0x345274=_0x18aea8[_0x632f('0x27')]&&_0x18aea8[_0x632f('0x27')]!=='0'?_0x18aea8['data4']:'phone';if(_0x43ddbd){logger['info'](_0x632f('0x28'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id']);_0x49b01e[_0x345274]=_[_0x632f('0x29')](_0x3e45a3[_0x632f('0x2a')])?_0x3e45a3[_0x632f('0x16')]:_0x3e45a3['destcalleridnum'];if(_[_0x632f('0x29')](_0x3e45a3['routeId'])){_0x49b01e['firstName']=_0x3e45a3[_0x632f('0x2b')]&&_0x3e45a3[_0x632f('0x2b')]!==''?_0x3e45a3[_0x632f('0x2b')]:_0x632f('0x2c');}else{_0x49b01e[_0x632f('0x17')]=_0x3e45a3[_0x632f('0x2d')]&&_0x3e45a3[_0x632f('0x2d')]!==''?_0x3e45a3['destcalleridname']:_0x632f('0x2c');}return BPromise['resolve']()[_0x632f('0x1e')](cmContactRpc[_0x632f('0x2e')](_0x49b01e))[_0x632f('0x1e')](function(_0x1fc07e){_0x27cfe9=_0x1fc07e;_0x26cd13[_0x632f('0x2f')](_0x1fc07e);if(_0x27cfe9){logger[_0x632f('0x8')](_0x632f('0x30'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id'],_0x27cfe9['id']);}return;});}else{logger[_0x632f('0x8')](_0x632f('0x31'),_0x3e45a3[_0x632f('0x22')],_0x200e07['id']);_0x49b01e[_0x345274]=_[_0x632f('0x29')](_0x3e45a3[_0x632f('0x2a')])?_0x3e45a3[_0x632f('0x16')]:_0x3e45a3['destcalleridnum'];if(_[_0x632f('0x29')](_0x3e45a3[_0x632f('0x2a')])){_0x49b01e[_0x632f('0x17')]=_0x3e45a3['calleridname']&&_0x3e45a3[_0x632f('0x2b')]!==_0x632f('0x32')?_0x3e45a3[_0x632f('0x2b')]:_0x632f('0x2c');}else{_0x49b01e['firstName']=_0x3e45a3['destcalleridname']&&_0x3e45a3[_0x632f('0x2d')]!==_0x632f('0x32')?_0x3e45a3[_0x632f('0x2d')]:_0x632f('0x2c');}_0x27cfe9=_0x49b01e;_0x26cd13[_0x632f('0x2f')](_0x49b01e);return;}}})[_0x632f('0x1e')](function(){if(_0x49dfb3){emit(_0x3e45a3['uniqueid'],_0x200e07,util[_0x632f('0x33')]('user:%s',_0x49dfb3[_0x632f('0x34')]),util[_0x632f('0x33')](_0x632f('0x35'),_0x18aea8[_0x632f('0x36')][_0x632f('0x37')]()),{'evt':_['merge'](_0x3e45a3,{'autoCreate':_0x43ddbd}),'contact':_0x27cfe9===undefined?{}:_0x27cfe9,'contacts':_0x26cd13[_0x632f('0x20')]===0x0?undefined:_0x26cd13});}});}; \ No newline at end of file +var _0x5427=['[CM][%s][%s]','exec','data1','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','firstName','phone','mobile','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','info'];(function(_0x4a86a0,_0xefcfc2){var _0x500eb0=function(_0x3415db){while(--_0x3415db){_0x4a86a0['push'](_0x4a86a0['shift']());}};_0x500eb0(++_0xefcfc2);}(_0x5427,0xbf));var _0x7542=function(_0x3c30be,_0x3a44df){_0x3c30be=_0x3c30be-0x0;var _0x241da5=_0x5427[_0x3c30be];return _0x241da5;};'use strict';var _=require('lodash');var BPromise=require(_0x7542('0x0'));var Redis=require(_0x7542('0x1'));var util=require('util');var config=require(_0x7542('0x2'));var logger=require(_0x7542('0x3'))('trigger');var cmContactRpc=require(_0x7542('0x4'));config[_0x7542('0x5')]=_[_0x7542('0x6')](config[_0x7542('0x5')],{'host':_0x7542('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7542('0x5')]));function emit(_0x52c496,_0x45588e,_0x7f1d24,_0x5785f8,_0x38f9a5){logger[_0x7542('0x8')](_0x7542('0x9'),_0x52c496,_0x45588e['id'],_0x7f1d24,_0x5785f8,JSON['stringify'](_0x38f9a5));io['to'](_0x7f1d24)['emit'](_0x5785f8,_0x38f9a5);}exports[_0x7542('0xa')]=function(_0x31cbfc,_0x3a4573,_0x3fa570,_0x1f60fc){var _0x40d882,_0x38f445;var _0x14f657={};var _0x3dab2a=Number(_0x3fa570[_0x7542('0xb')]);var _0x189eaf=_0x3fa570['data2']?Boolean(Number(_0x3fa570['data2'])):![];var _0x1f3e51;if(_0x1f60fc[_0x7542('0xc')]){_0x14f657['id']=_0x1f60fc[_0x7542('0xc')];}if(!_0x14f657['id']){_0x14f657[_0x7542('0xd')]=_0x3dab2a;_0x1f3e51=_0x3fa570[_0x7542('0xe')]&&_0x3fa570[_0x7542('0xe')]!=='0'?_0x3fa570[_0x7542('0xe')]['split'](','):['phone'];_0x14f657[_0x7542('0xf')]=_[_0x7542('0x10')](_0x1f3e51,function(_0x1dc0e4){var _0x798e20={};_0x798e20[_0x1dc0e4]=_0x1f60fc[_0x7542('0x11')]?_0x1f60fc[_0x7542('0x12')]:_0x1f60fc['calleridnum'];return _0x798e20;});}var _0x52dd78=['id',_0x7542('0x13'),'lastName',_0x7542('0x14'),_0x7542('0x15'),'fax',_0x7542('0xd'),'createdAt','scheduledAt',_0x7542('0x16')];var _0x48f4d9=_[_0x7542('0x17')](_0x52dd78,_0x1f3e51);BPromise[_0x7542('0x18')]()[_0x7542('0x19')](cmContactRpc['getContacts']({'attributes':_0x48f4d9,'where':_0x14f657}))[_0x7542('0x19')](function(_0x5c4400){_0x38f445=_0x5c4400;if(!_[_0x7542('0x1a')](_0x38f445)){if(_0x38f445[_0x7542('0x1b')]===0x1){_0x40d882=_0x38f445[0x0];logger[_0x7542('0x8')](_0x7542('0x1c'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id'],_0x40d882['id']);}else{logger[_0x7542('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id'],_[_0x7542('0x10')](_0x38f445,'id')[_0x7542('0x1e')](','));}return;}else{logger[_0x7542('0x8')](_0x7542('0x1f'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id']);var _0x1dcc2e={'ListId':_0x3dab2a};var _0x2958da=_0x3fa570[_0x7542('0x20')]&&_0x3fa570[_0x7542('0x20')]!=='0'?_0x3fa570[_0x7542('0x20')]:_0x7542('0x14');if(_0x189eaf){logger[_0x7542('0x8')](_0x7542('0x21'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id']);_0x1dcc2e[_0x2958da]=_[_0x7542('0x22')](_0x1f60fc['routeId'])?_0x1f60fc[_0x7542('0x23')]:_0x1f60fc[_0x7542('0x12')];if(_[_0x7542('0x22')](_0x1f60fc[_0x7542('0x11')])){_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x24')]&&_0x1f60fc[_0x7542('0x24')]!==_0x7542('0x25')?_0x1f60fc['calleridname']:_0x7542('0x26');}else{_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x27')]&&_0x1f60fc[_0x7542('0x27')]!==_0x7542('0x25')?_0x1f60fc[_0x7542('0x27')]:_0x7542('0x26');}return BPromise['resolve']()[_0x7542('0x19')](cmContactRpc[_0x7542('0x28')](_0x1dcc2e))[_0x7542('0x19')](function(_0x277cc0){_0x40d882=_0x277cc0;_0x38f445[_0x7542('0x29')](_0x277cc0);if(_0x40d882){logger[_0x7542('0x8')](_0x7542('0x2a'),_0x1f60fc[_0x7542('0x1d')],_0x3a4573['id'],_0x40d882['id']);}return;});}else{logger[_0x7542('0x8')](_0x7542('0x2b'),_0x1f60fc['uniqueid'],_0x3a4573['id']);_0x1dcc2e[_0x2958da]=_[_0x7542('0x22')](_0x1f60fc[_0x7542('0x11')])?_0x1f60fc['calleridnum']:_0x1f60fc[_0x7542('0x12')];if(_[_0x7542('0x22')](_0x1f60fc[_0x7542('0x11')])){_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x24')]&&_0x1f60fc[_0x7542('0x24')]!==_0x7542('0x25')?_0x1f60fc[_0x7542('0x24')]:'Unknown';}else{_0x1dcc2e[_0x7542('0x13')]=_0x1f60fc[_0x7542('0x27')]&&_0x1f60fc['destcalleridname']!==_0x7542('0x25')?_0x1f60fc['destcalleridname']:_0x7542('0x26');}_0x40d882=_0x1dcc2e;_0x38f445[_0x7542('0x29')](_0x1dcc2e);return;}}})[_0x7542('0x19')](function(){if(_0x31cbfc){emit(_0x1f60fc[_0x7542('0x1d')],_0x3a4573,util['format']('user:%s',_0x31cbfc[_0x7542('0x2c')]),util[_0x7542('0x2d')](_0x7542('0x2e'),_0x3fa570[_0x7542('0x2f')][_0x7542('0x30')]()),{'evt':_[_0x7542('0x31')](_0x1f60fc,{'autoCreate':_0x189eaf}),'contact':_0x40d882===undefined?{}:_0x40d882,'contacts':_0x38f445[_0x7542('0x1b')]===0x0?undefined:_0x38f445});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f612b4c..6f6d5aa 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 _0x7376=['uri','buildUri','data3','isNil','data4','location','uriLocation','data5','800','windowHeight','600','data6','winapp','winApplication','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','exec','queue','routeId','urlforward','script','parse','query','search','replace','checkTrigger','length','every','AllConditions','checkConditions','channel','AnyConditions','some','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/logger','../ami','redis','defaults','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','prototype','interface','checkTriggers','hasOwnProperty','merge','variables','Actions','action','toLowerCase','motionbar','data1','data2','render','html','template\x20not\x20found'];(function(_0x1815ce,_0x477d98){var _0x185c05=function(_0x27f098){while(--_0x27f098){_0x1815ce['push'](_0x1815ce['shift']());}};_0x185c05(++_0x477d98);}(_0x7376,0xa8));var _0x6737=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7376[_0x5d6456];return _0x4d66c1;};'use strict';var util=require('util');var _=require(_0x6737('0x0'));var url=require(_0x6737('0x1'));var Mustache=require(_0x6737('0x2'));var Redis=require(_0x6737('0x3'));var urlforward=require(_0x6737('0x4'));var integration=require(_0x6737('0x5'));var cmContact=require(_0x6737('0x6'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x6737('0x7'))('trigger');var ami=require(_0x6737('0x8'));config[_0x6737('0x9')]=_[_0x6737('0xa')](config[_0x6737('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x6737('0xb'))(new Redis(config[_0x6737('0x9')]));var operators={'equals':function(_0x27c65f,_0x3eb1aa){return _0x27c65f==_0x3eb1aa;},'not_equals':function(_0x7b9603,_0x18a6dd){return _0x7b9603!=_0x18a6dd;}};var barAndWebActions=[_0x6737('0xc'),_0x6737('0x1'),'winapp'];function Trigger(_0xa318f9){this[_0x6737('0xd')]=_0xa318f9[_0x6737('0xd')];this[_0x6737('0xe')]=_0xa318f9[_0x6737('0xe')];this[_0x6737('0xf')]=_0xa318f9['voiceQueues'];this[_0x6737('0x10')]=_0xa318f9['templates'];this[_0x6737('0x11')]=_0xa318f9['voiceExtensions'];this[_0x6737('0x12')]=_0xa318f9['zendeskAccounts'];this[_0x6737('0x13')]=_0xa318f9[_0x6737('0x13')];this[_0x6737('0x14')]=_0xa318f9[_0x6737('0x14')];this[_0x6737('0x15')]=_0xa318f9[_0x6737('0x15')];this[_0x6737('0x16')]=_0xa318f9[_0x6737('0x16')];this[_0x6737('0x17')]=_0xa318f9['deskAccounts'];this[_0x6737('0x18')]=_0xa318f9[_0x6737('0x18')];this['servicenowAccounts']=_0xa318f9[_0x6737('0x19')];this['dynamics365Accounts']=_0xa318f9[_0x6737('0x1a')];this[_0x6737('0x1b')]=_0xa318f9[_0x6737('0x1b')];this[_0x6737('0x1c')]={'zendesk':this[_0x6737('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6737('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0x6737('0x18')],'dynamics365':this[_0x6737('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6737('0x19')]};ami['on'](_0x6737('0x1d'),this['syncCustomEvent'][_0x6737('0x1e')](this));ami['on'](_0x6737('0x1f'),this['syncCustomEvent'][_0x6737('0x1e')](this));ami['on']('custom:agentringnoanswer',this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x21'),this['syncCustomEvent'][_0x6737('0x1e')](this));ami['on'](_0x6737('0x22'),this['syncCustomEvent'][_0x6737('0x1e')](this));ami['on'](_0x6737('0x23'),this['syncCustomEvent'][_0x6737('0x1e')](this));ami['on']('custom:agentbusy',this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on']('custom:agentcongestion',this[_0x6737('0x20')]['bind'](this));ami['on'](_0x6737('0x24'),this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x25'),this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x26'),this[_0x6737('0x20')]['bind'](this));ami['on'](_0x6737('0x27'),this[_0x6737('0x28')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x29'),this[_0x6737('0x28')][_0x6737('0x1e')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0x6737('0x1e')](this));ami['on'](_0x6737('0x2a'),this['syncCustomEvent'][_0x6737('0x1e')](this));ami['on'](_0x6737('0x2b'),this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x2c'),this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x2d'),this[_0x6737('0x20')]['bind'](this));ami['on'](_0x6737('0x2e'),this[_0x6737('0x20')][_0x6737('0x1e')](this));ami['on'](_0x6737('0x2f'),this[_0x6737('0x20')]['bind'](this));}Trigger['prototype'][_0x6737('0x30')]=function(_0x19e412,_0x5b1c34,_0x24738d){logger[_0x6737('0x31')](_0x19e412,_0x5b1c34,JSON[_0x6737('0x32')](_0x24738d));io['to'](_0x19e412)['emit'](_0x5b1c34,_0x24738d);};Trigger['prototype'][_0x6737('0x20')]=function(_0x200039){var _0x19de65=_['clone'](_0x200039);this['checkTriggers'](_0x19de65);};Trigger[_0x6737('0x33')]['syncAgentDial']=function(_0xdead17){if(this[_0x6737('0xe')][_0xdead17[_0x6737('0x34')]]){this[_0x6737('0x20')](_0xdead17);}};Trigger[_0x6737('0x33')][_0x6737('0x35')]=function(_0xd8a8dd){var _0x3efab0;for(var _0x1491fb in this[_0x6737('0xd')]){if(this[_0x6737('0xd')][_0x6737('0x36')](_0x1491fb)){if(this['triggers'][_0x1491fb]['status']){_0x3efab0=this['checkTrigger'](this[_0x6737('0xd')][_0x1491fb],_0xd8a8dd);if(_0x3efab0){_[_0x6737('0x37')](_0xd8a8dd,_0xd8a8dd[_0x6737('0x38')]);for(var _0x51eb79=0x0,_0x4a6726,_0xb838d5,_0x5b32da;_0x51eb790x0){_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(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 37f3b01..6e518cc 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 _0x0f87=['/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','outbound','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Descriptions','Fields','ticketType','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','email','length','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','catch','toLowerCase','destcalleridnum','calleridnum','contacts'];(function(_0x51be6e,_0x52350f){var _0x69efe=function(_0x465d62){while(--_0x465d62){_0x51be6e['push'](_0x51be6e['shift']());}};_0x69efe(++_0x52350f);}(_0x0f87,0x1bc));var _0x70f8=function(_0x57e13c,_0x4ded5b){_0x57e13c=_0x57e13c-0x0;var _0x31140b=_0x0f87[_0x57e13c];return _0x31140b;};'use strict';var _=require('lodash');var BPromise=require(_0x70f8('0x0'));var rp=require(_0x70f8('0x1'));var util=require('util');var intUtil=require(_0x70f8('0x2'));var md5=require('md5');var Redis=require(_0x70f8('0x3'));var logger=require(_0x70f8('0x4'))(_0x70f8('0x5'));var config=require(_0x70f8('0x6'));config['redis']=_[_0x70f8('0x7')](config[_0x70f8('0x8')],{'host':_0x70f8('0x9'),'port':0x18eb});var io=require(_0x70f8('0xa'))(new Redis(config['redis']));function getAuthToken(_0x41f164,_0xd148e4,_0x570c12){var _0x80790c={'method':_0x70f8('0xb'),'uri':_0xd148e4,'form':{'client_id':_0x41f164[_0x70f8('0xc')],'resource':_0x41f164[_0x70f8('0xd')],'username':_0x41f164[_0x70f8('0xe')],'password':_0x41f164[_0x70f8('0xf')],'grant_type':'password','client_secret':_0x41f164[_0x70f8('0x10')]},'json':!![]};return rp(_0x80790c)[_0x70f8('0x11')](function(_0x48a348){return _0x48a348[_0x70f8('0x12')];})['catch'](function(_0x510d16){logger[_0x70f8('0x13')]('['+[_0x570c12[_0x70f8('0x14')]()]+_0x70f8('0x15'));return _0x510d16[_0x70f8('0x16')];});}function getUser(_0x544069,_0x1cae8f,_0x57e244,_0x59428c,_0x5e78e1,_0x4ca8f0){return new BPromise(function(_0x277d13,_0x3dff6b){return getAuthToken(_0x1cae8f,_0x59428c,_0x4ca8f0)['then'](function(_0xc68278){var _0x34952c={'method':_0x70f8('0x17'),'uri':_0x5e78e1+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x70f8('0x18')+_0xc68278,'OData-Version':_0x70f8('0x19')},'json':!![]};return rp(_0x34952c);})[_0x70f8('0x11')](function(_0x4571c4){var _0x4274cc=_0x4571c4[_0x70f8('0x1a')];var _0x58201e=![];var _0x5f5790=null;if(!_[_0x70f8('0x1b')](_0x57e244)){if(intUtil['validateEmail'](_0x57e244[_0x70f8('0x1c')])){_0x544069['userEmail']=_0x57e244[_0x70f8('0x1c')];for(_0x5f5790=0x0;_0x5f5790<_0x4274cc[_0x70f8('0x1d')];_0x5f5790++){if(_0x4274cc[_0x5f5790]['internalemailaddress']===_0x57e244[_0x70f8('0x1c')]&&!_0x4274cc[_0x5f5790]['isdisabled']){_0x58201e=!![];logger[_0x70f8('0x1e')]('['+[_0x4ca8f0[_0x70f8('0x14')]()]+_0x70f8('0x1f')+_0x4274cc[_0x5f5790][_0x70f8('0x20')]+'!');_0x544069[_0x70f8('0x21')]=_0x4274cc[_0x5f5790]['systemuserid'];}}}}if(!_0x58201e){logger[_0x70f8('0x1e')]('['+[_0x4ca8f0[_0x70f8('0x14')]()]+_0x70f8('0x22'));_0x544069[_0x70f8('0x23')]=_0x1cae8f[_0x70f8('0xe')];for(_0x5f5790=0x0;_0x5f5790<_0x4274cc['length'];_0x5f5790++){if(_0x4274cc[_0x5f5790]['internalemailaddress']===_0x1cae8f[_0x70f8('0xe')]){_0x544069['userId']=_0x4274cc[_0x5f5790][_0x70f8('0x20')];}}}_0x277d13(_0x544069);})[_0x70f8('0x24')](function(_0x53ec6e){_0x3dff6b(_0x53ec6e[_0x70f8('0x16')]);});});}function createEndUser(_0x24ecf6,_0x2f714b,_0x185cc4,_0xf0eb8c,_0x11fee6,_0x1c3d73){return new BPromise(function(_0x3eac72,_0x3a6864){return getAuthToken(_0x2f714b,_0x185cc4,_0x1c3d73)[_0x70f8('0x11')](function(_0x2d76af){var _0x55f378=_0x1c3d73[_0x70f8('0x25')]()==='outbound'?_0x11fee6[_0x70f8('0x26')]:_0x11fee6[_0x70f8('0x27')];var _0x5cf1c4={'method':_0x70f8('0xb'),'uri':_0xf0eb8c+_0x70f8('0x28'),'body':{'telephone1':_0x55f378,'fullname':_0x55f378,'firstname':_0x55f378,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x70f8('0x29')+_0x24ecf6[_0x70f8('0x21')]+')'},'headers':{'Authorization':_0x70f8('0x18')+_0x2d76af,'OData-Version':_0x70f8('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5cf1c4);})['then'](function(_0x217357){var _0x351066=_0x217357['headers'][_0x70f8('0x2a')];var _0x11f3ab=_0x351066[_0x70f8('0x2b')](_0x351066[_0x70f8('0x2c')]('(')+0x1,_0x351066['lastIndexOf'](')'));_0x24ecf6[_0x70f8('0x2d')]=_0x11f3ab;_0x3eac72(_0x24ecf6);})['catch'](function(_0x3187f7){_0x3a6864(_0x3187f7['message']);});});}function getEndUser(_0x52204c,_0x419e38,_0x3f6a1e,_0x35474e,_0x4905bb,_0x6f2850){return new BPromise(function(_0x1760e1,_0x2911a7){return getAuthToken(_0x419e38,_0x3f6a1e,_0x6f2850)[_0x70f8('0x11')](function(_0x1c30ed){var _0x1c8936={'method':_0x70f8('0x17'),'uri':_0x35474e+_0x70f8('0x2e'),'headers':{'Authorization':_0x70f8('0x18')+_0x1c30ed,'If-None-Match':null,'OData-Version':_0x70f8('0x19')},'json':!![]};return rp(_0x1c8936);})[_0x70f8('0x11')](function(_0x22bc0c){var _0x56e652=null;if(_0x22bc0c){var _0x20f568=_0x22bc0c[_0x70f8('0x1a')];var _0x5b6891=![];for(_0x56e652=0x0;_0x56e652<_0x20f568[_0x70f8('0x1d')];_0x56e652++){var _0x2feac3=_0x6f2850['toLowerCase']()===_0x70f8('0x2f')?_0x4905bb['destcalleridnum']:_0x4905bb['calleridnum'];if(_0x20f568[_0x56e652]['telephone1']===_0x2feac3){_0x5b6891=!![];_0x52204c[_0x70f8('0x2d')]=_0x20f568[_0x56e652][_0x70f8('0x30')];}}if(_0x5b6891){_0x1760e1(_0x52204c);}else{return createEndUser(_0x52204c,_0x419e38,_0x3f6a1e,_0x35474e,_0x4905bb,_0x6f2850)[_0x70f8('0x11')](function(_0x2abbe4){logger[_0x70f8('0x1e')]('['+[_0x6f2850[_0x70f8('0x14')]()]+_0x70f8('0x31'),_0x2abbe4[_0x70f8('0x2d')]);_0x1760e1(_0x2abbe4);});}}else{return createEndUser(_0x52204c,_0x419e38,_0x3f6a1e,_0x35474e,_0x4905bb,_0x6f2850)[_0x70f8('0x11')](function(_0x546191){logger[_0x70f8('0x1e')]('['+[_0x6f2850[_0x70f8('0x14')]()]+_0x70f8('0x32'),_0x546191['enduserId']);_0x1760e1(_0x546191);});}});});}function getCustomFields(_0x279c00,_0x27093b,_0x3a319d){var _0x170b1a={};if(_0x279c00[_0x70f8('0x1d')]>0x0){_[_0x70f8('0x33')](_0x279c00,function(_0x261b39){if(_0x261b39[_0x70f8('0x34')]==='string'&&_0x261b39[_0x70f8('0x35')]&&!_0x261b39[_0x70f8('0x36')]){var _0x16a891=_0x261b39[_0x70f8('0x37')]['toLowerCase']();var _0x3b8bc4=_0x16a891[_0x70f8('0x2b')](0x0,_0x16a891['indexOf']('_'));var _0x1bd194=_0x16a891[_0x70f8('0x2b')](_0x16a891[_0x70f8('0x38')]('_')+0x1);if(_0x3b8bc4===_0x3a319d){_0x170b1a[_0x1bd194]=_0x261b39[_0x70f8('0x39')];}}});}return _0x170b1a;}function getTicket(_0x245d1f,_0x87f3e1,_0x1601e2,_0x269619,_0x2f3ec1,_0x1f0432,_0x4209fc){return new BPromise(function(_0x3d1caf,_0x4cdfe9){var _0x5aa6ed;return getAuthToken(_0x87f3e1,_0x1601e2,_0x4209fc)['then'](function(_0x407ab9){if(_0x1f0432['ticketType']===_0x70f8('0x3a')){_0x5aa6ed={'method':'POST','uri':_0x269619+_0x70f8('0x3b'),'body':Object[_0x70f8('0x3c')]({},{'title':intUtil[_0x70f8('0x3d')](_0x1f0432['Subjects'],_0x2f3ec1,'\x20'),'description':intUtil[_0x70f8('0x3d')](_0x1f0432[_0x70f8('0x3e')],_0x2f3ec1,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x245d1f[_0x70f8('0x2d')]+')','ownerid@odata.bind':_0x70f8('0x29')+_0x245d1f[_0x70f8('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x1f0432[_0x70f8('0x3f')],_0x2f3ec1,_0x1f0432['ticketType'])),'headers':{'Authorization':_0x70f8('0x18')+_0x407ab9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1f0432[_0x70f8('0x40')]===_0x70f8('0x41')){_0x5aa6ed={'method':'POST','uri':_0x269619+_0x70f8('0x42'),'body':Object[_0x70f8('0x3c')]({},{'subject':intUtil[_0x70f8('0x3d')](_0x1f0432[_0x70f8('0x43')],_0x2f3ec1,'\x20'),'phonenumber':String(_0x2f3ec1[_0x70f8('0x27')]),'description':intUtil[_0x70f8('0x3d')](_0x1f0432['Descriptions'],_0x2f3ec1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x70f8('0x44')+_0x245d1f[_0x70f8('0x2d')]+')','ownerid@odata.bind':_0x70f8('0x29')+_0x245d1f[_0x70f8('0x21')]+')','directioncode':_0x245d1f['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x70f8('0x29')+_0x245d1f[_0x70f8('0x21')]+')','participationtypemask':_0x245d1f[_0x70f8('0x45')]===_0x70f8('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x70f8('0x44')+_0x245d1f[_0x70f8('0x2d')]+')','participationtypemask':_0x245d1f['callDirection']===_0x70f8('0x46')?0x1:0x2}]},getCustomFields(_0x1f0432[_0x70f8('0x3f')],_0x2f3ec1,_0x1f0432[_0x70f8('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x407ab9,'OData-Version':_0x70f8('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5aa6ed);})['then'](function(_0x3590b2){var _0x59db64=_0x3590b2['headers'][_0x70f8('0x2a')];var _0x4ffc17=_0x59db64[_0x70f8('0x2b')](_0x59db64['lastIndexOf']('(')+0x1,_0x59db64[_0x70f8('0x2c')](')'));_0x245d1f['ticketId']=_0x4ffc17;_0x3d1caf(_0x245d1f);})[_0x70f8('0x24')](function(_0x21eab9){_0x4cdfe9(_0x21eab9[_0x70f8('0x16')]);});});}function emit(_0x4e8d66,_0x4cd7e3,_0x151b87,_0x200b50){var _0x31fba7={'uri':util[_0x70f8('0x47')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4e8d66,_0x151b87,_0x200b50)};io['to'](util[_0x70f8('0x47')](_0x70f8('0x48'),_0x4cd7e3))[_0x70f8('0x49')](_0x70f8('0x4a'),_0x31fba7);}exports['cs']=function(_0x175d4f,_0x12fa7e,_0x187176,_0x48b6c3,_0x3cf793,_0xab7627,_0x232a53,_0x420bc8){var _0x119282={};_0xab7627[_0x70f8('0xd')]=intUtil[_0x70f8('0x4b')](_0xab7627[_0x70f8('0xd')]);_0xab7627['serverUrl']=intUtil[_0x70f8('0x4b')](_0xab7627[_0x70f8('0x4c')]);_0x119282[_0x70f8('0x45')]=_0x420bc8===_0x70f8('0x46')||_0x420bc8===_0x70f8('0x4d')?_0x70f8('0x46'):'outbound';var _0x3f8ca3=util[_0x70f8('0x47')](_0x70f8('0x4e'),_0xab7627[_0x70f8('0xd')]);var _0x152c8e=util[_0x70f8('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0xab7627[_0x70f8('0x4f')]);var _0xee74ca=util[_0x70f8('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xab7627['serverUrl'],_0x12fa7e['uniqueid'],md5(_0x12fa7e[_0x70f8('0x50')]));if(_0x3cf793&&_0x3cf793[_0x70f8('0x51')]){logger[_0x70f8('0x1e')]('[QUEUE]',_0x70f8('0x52'));_0x12fa7e[_0x70f8('0x53')]=_0xee74ca;}else if(_0x232a53&&_0x232a53[_0x70f8('0x54')]&&_0x232a53['recordingFormat']!==_0x70f8('0x55')){logger['info'](_0x70f8('0x56'),'Recording\x20is\x20enabled!');_0x12fa7e['recordingURL']=_0xee74ca;}else{_0x12fa7e[_0x70f8('0x53')]='';}return getUser(_0x119282,_0xab7627,_0x48b6c3,_0x152c8e,_0x3f8ca3,_0x420bc8)[_0x70f8('0x11')](function(_0x48605e){logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x57'),_0x48605e[_0x70f8('0x21')]);logger[_0x70f8('0x1e')]('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x58'),_0x48605e[_0x70f8('0x23')]);return getEndUser(_0x48605e,_0xab7627,_0x152c8e,_0x3f8ca3,_0x12fa7e,_0x420bc8);})[_0x70f8('0x11')](function(_0x4e9d9d){logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x59'),_0x4e9d9d[_0x70f8('0x2d')]);logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x5a'),_0x12fa7e[_0x70f8('0x27')]);return getTicket(_0x4e9d9d,_0xab7627,_0x152c8e,_0x3f8ca3,_0x12fa7e,_0x187176,_0x420bc8);})[_0x70f8('0x11')](function(_0x111ccb){logger['info'](util[_0x70f8('0x47')]('['+_0x420bc8[_0x70f8('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x187176['ticketType'],_0x111ccb[_0x70f8('0x5b')]));logger[_0x70f8('0x1e')](util[_0x70f8('0x47')]('['+_0x420bc8['toUpperCase']()+_0x70f8('0x5c'),_0x420bc8));if(_0x420bc8!==_0x70f8('0x4d')){logger['info']('['+_0x420bc8[_0x70f8('0x14')]()+']',_0x70f8('0x5d'));emit(_0xab7627[_0x70f8('0xd')],_0x48b6c3[_0x70f8('0x5e')],_0x187176['ticketType'],_0x111ccb[_0x70f8('0x5b')]);}})[_0x70f8('0x24')](function(_0x238423){logger[_0x70f8('0x13')]('['+_0x420bc8[_0x70f8('0x14')]()+_0x70f8('0x5f'),util[_0x70f8('0x60')](_0x238423,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf782=[']\x20The\x20Enduser\x20phone\x20is:','calleridnum',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value','destcalleridnum','telephone1',']\x20Enduser\x20created!','type','string','nameField','customField','idField','toLowerCase','indexOf','content','ticketType','incident','assign','getString','Descriptions','Fields','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:'];(function(_0x444127,_0x27d1e9){var _0x5855c0=function(_0x143f95){while(--_0x143f95){_0x444127['push'](_0x444127['shift']());}};_0x5855c0(++_0x27d1e9);}(_0xf782,0xcd));var _0x2f78=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xf782[_0x548627];return _0x844a84;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x2f78('0x0'));var util=require(_0x2f78('0x1'));var intUtil=require(_0x2f78('0x2'));var md5=require(_0x2f78('0x3'));var Redis=require(_0x2f78('0x4'));var logger=require(_0x2f78('0x5'))('dynamics365');var config=require(_0x2f78('0x6'));config['redis']=_[_0x2f78('0x7')](config[_0x2f78('0x8')],{'host':_0x2f78('0x9'),'port':0x18eb});var io=require(_0x2f78('0xa'))(new Redis(config[_0x2f78('0x8')]));function getAuthToken(_0x490418,_0x180f85,_0x5e6ee3){var _0x4f0c71={'method':_0x2f78('0xb'),'uri':_0x180f85,'form':{'client_id':_0x490418[_0x2f78('0xc')],'resource':_0x490418[_0x2f78('0xd')],'username':_0x490418[_0x2f78('0xe')],'password':_0x490418[_0x2f78('0xf')],'grant_type':_0x2f78('0xf'),'client_secret':_0x490418[_0x2f78('0x10')]},'json':!![]};return rp(_0x4f0c71)[_0x2f78('0x11')](function(_0x34e86d){return _0x34e86d[_0x2f78('0x12')];})[_0x2f78('0x13')](function(_0x4d35b9){logger['error']('['+[_0x5e6ee3[_0x2f78('0x14')]()]+_0x2f78('0x15'));return _0x4d35b9[_0x2f78('0x16')];});}function getUser(_0x5df4c7,_0x1b061d,_0x2f841a,_0x55e78b,_0x585652,_0x173f1e){return new BPromise(function(_0x44a25f,_0x75b6b7){return getAuthToken(_0x1b061d,_0x55e78b,_0x173f1e)[_0x2f78('0x11')](function(_0x44328c){var _0x20d79d={'method':'GET','uri':_0x585652+_0x2f78('0x17'),'headers':{'Authorization':_0x2f78('0x18')+_0x44328c,'OData-Version':_0x2f78('0x19')},'json':!![]};return rp(_0x20d79d);})['then'](function(_0x23cc5d){var _0x151d38=_0x23cc5d['value'];var _0x5457e2=![];var _0x2ba2d5=null;if(!_['isNil'](_0x2f841a)){if(intUtil[_0x2f78('0x1a')](_0x2f841a[_0x2f78('0x1b')])){_0x5df4c7[_0x2f78('0x1c')]=_0x2f841a['email'];for(_0x2ba2d5=0x0;_0x2ba2d5<_0x151d38[_0x2f78('0x1d')];_0x2ba2d5++){if(_0x151d38[_0x2ba2d5][_0x2f78('0x1e')]===_0x2f841a['email']&&!_0x151d38[_0x2ba2d5][_0x2f78('0x1f')]){_0x5457e2=!![];logger['info']('['+[_0x173f1e['toUpperCase']()]+_0x2f78('0x20')+_0x151d38[_0x2ba2d5][_0x2f78('0x21')]+'!');_0x5df4c7[_0x2f78('0x22')]=_0x151d38[_0x2ba2d5][_0x2f78('0x21')];}}}}if(!_0x5457e2){logger[_0x2f78('0x23')]('['+[_0x173f1e[_0x2f78('0x14')]()]+_0x2f78('0x24'));_0x5df4c7['userEmail']=_0x1b061d['username'];for(_0x2ba2d5=0x0;_0x2ba2d5<_0x151d38[_0x2f78('0x1d')];_0x2ba2d5++){if(_0x151d38[_0x2ba2d5][_0x2f78('0x1e')]===_0x1b061d[_0x2f78('0xe')]){_0x5df4c7[_0x2f78('0x22')]=_0x151d38[_0x2ba2d5][_0x2f78('0x21')];}}}_0x44a25f(_0x5df4c7);})[_0x2f78('0x13')](function(_0x323e9d){_0x75b6b7(_0x323e9d[_0x2f78('0x16')]);});});}function createEndUser(_0x59872f,_0x278ee7,_0x3ed5e4,_0x489cea,_0x16b2a4,_0x33ecab){return new BPromise(function(_0x3e8f0d,_0x42fcde){return getAuthToken(_0x278ee7,_0x3ed5e4,_0x33ecab)[_0x2f78('0x11')](function(_0x56551f){var _0x284706=_0x33ecab['toLowerCase']()===_0x2f78('0x25')?_0x16b2a4['destcalleridnum']:_0x16b2a4['calleridnum'];var _0x5569c1={'method':_0x2f78('0xb'),'uri':_0x489cea+_0x2f78('0x26'),'body':{'telephone1':_0x284706,'fullname':_0x284706,'firstname':_0x284706,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2f78('0x27')+_0x59872f[_0x2f78('0x22')]+')'},'headers':{'Authorization':_0x2f78('0x18')+_0x56551f,'OData-Version':_0x2f78('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5569c1);})[_0x2f78('0x11')](function(_0x2b46cc){var _0x2ffaa1=_0x2b46cc[_0x2f78('0x28')][_0x2f78('0x29')];var _0x48a352=_0x2ffaa1[_0x2f78('0x2a')](_0x2ffaa1[_0x2f78('0x2b')]('(')+0x1,_0x2ffaa1[_0x2f78('0x2b')](')'));_0x59872f[_0x2f78('0x2c')]=_0x48a352;_0x3e8f0d(_0x59872f);})[_0x2f78('0x13')](function(_0x3b6f43){_0x42fcde(_0x3b6f43[_0x2f78('0x16')]);});});}function getEndUser(_0x178df4,_0xef6081,_0x2a65f0,_0xdc208f,_0x24fba0,_0x2fac1c){return new BPromise(function(_0x578946,_0x1fe053){return getAuthToken(_0xef6081,_0x2a65f0,_0x2fac1c)[_0x2f78('0x11')](function(_0x20c63f){var _0x32592b={'method':'GET','uri':_0xdc208f+_0x2f78('0x2d'),'headers':{'Authorization':_0x2f78('0x18')+_0x20c63f,'If-None-Match':null,'OData-Version':_0x2f78('0x19')},'json':!![]};return rp(_0x32592b);})[_0x2f78('0x11')](function(_0x10e110){var _0x473cc1=null;if(_0x10e110){var _0x2d3367=_0x10e110[_0x2f78('0x2e')];var _0x8d5c4=![];for(_0x473cc1=0x0;_0x473cc1<_0x2d3367['length'];_0x473cc1++){var _0x20c465=_0x2fac1c['toLowerCase']()==='outbound'?_0x24fba0[_0x2f78('0x2f')]:_0x24fba0['calleridnum'];if(_0x2d3367[_0x473cc1][_0x2f78('0x30')]===_0x20c465){_0x8d5c4=!![];_0x178df4[_0x2f78('0x2c')]=_0x2d3367[_0x473cc1]['contactid'];}}if(_0x8d5c4){_0x578946(_0x178df4);}else{return createEndUser(_0x178df4,_0xef6081,_0x2a65f0,_0xdc208f,_0x24fba0,_0x2fac1c)['then'](function(_0x32d971){logger[_0x2f78('0x23')]('['+[_0x2fac1c['toUpperCase']()]+_0x2f78('0x31'),_0x32d971[_0x2f78('0x2c')]);_0x578946(_0x32d971);});}}else{return createEndUser(_0x178df4,_0xef6081,_0x2a65f0,_0xdc208f,_0x24fba0,_0x2fac1c)['then'](function(_0x385b46){logger[_0x2f78('0x23')]('['+[_0x2fac1c['toUpperCase']()]+']\x20Enduser\x20Created!',_0x385b46['enduserId']);_0x578946(_0x385b46);});}});});}function getCustomFields(_0x58c3c6,_0x290568,_0xca860d){var _0x4099e3={};if(_0x58c3c6['length']>0x0){_['forEach'](_0x58c3c6,function(_0x292e06){if(_0x292e06[_0x2f78('0x32')]===_0x2f78('0x33')&&_0x292e06[_0x2f78('0x34')]&&!_0x292e06[_0x2f78('0x35')]){var _0x1628a2=_0x292e06[_0x2f78('0x36')][_0x2f78('0x37')]();var _0x2e58a9=_0x1628a2[_0x2f78('0x2a')](0x0,_0x1628a2[_0x2f78('0x38')]('_'));var _0x353fa4=_0x1628a2[_0x2f78('0x2a')](_0x1628a2[_0x2f78('0x38')]('_')+0x1);if(_0x2e58a9===_0xca860d){_0x4099e3[_0x353fa4]=_0x292e06[_0x2f78('0x39')];}}});}return _0x4099e3;}function getTicket(_0xd18186,_0x5a8b28,_0x1bc103,_0xadd27c,_0x92033d,_0x338438,_0x14aebf){return new BPromise(function(_0x54bd73,_0x6f0dcc){var _0x3350d2;return getAuthToken(_0x5a8b28,_0x1bc103,_0x14aebf)[_0x2f78('0x11')](function(_0x18d784){if(_0x338438[_0x2f78('0x3a')]===_0x2f78('0x3b')){_0x3350d2={'method':'POST','uri':_0xadd27c+'incidents','body':Object[_0x2f78('0x3c')]({},{'title':intUtil[_0x2f78('0x3d')](_0x338438['Subjects'],_0x92033d,'\x20'),'description':intUtil[_0x2f78('0x3d')](_0x338438[_0x2f78('0x3e')],_0x92033d,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xd18186['enduserId']+')','ownerid@odata.bind':_0x2f78('0x27')+_0xd18186[_0x2f78('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x338438[_0x2f78('0x3f')],_0x92033d,_0x338438[_0x2f78('0x3a')])),'headers':{'Authorization':_0x2f78('0x18')+_0x18d784,'OData-Version':_0x2f78('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x338438[_0x2f78('0x3a')]===_0x2f78('0x40')){_0x3350d2={'method':'POST','uri':_0xadd27c+_0x2f78('0x41'),'body':Object[_0x2f78('0x3c')]({},{'subject':intUtil[_0x2f78('0x3d')](_0x338438[_0x2f78('0x42')],_0x92033d,'\x20'),'phonenumber':String(_0x92033d['calleridnum']),'description':intUtil[_0x2f78('0x3d')](_0x338438[_0x2f78('0x3e')],_0x92033d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2f78('0x43')+_0xd18186[_0x2f78('0x2c')]+')','ownerid@odata.bind':_0x2f78('0x27')+_0xd18186[_0x2f78('0x22')]+')','directioncode':_0xd18186[_0x2f78('0x44')]===_0x2f78('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x2f78('0x27')+_0xd18186[_0x2f78('0x22')]+')','participationtypemask':_0xd18186[_0x2f78('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x2f78('0x43')+_0xd18186[_0x2f78('0x2c')]+')','participationtypemask':_0xd18186[_0x2f78('0x44')]===_0x2f78('0x45')?0x1:0x2}]},getCustomFields(_0x338438[_0x2f78('0x3f')],_0x92033d,_0x338438[_0x2f78('0x3a')])),'headers':{'Authorization':'Bearer\x20'+_0x18d784,'OData-Version':_0x2f78('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3350d2);})['then'](function(_0x300609){var _0x54c133=_0x300609[_0x2f78('0x28')][_0x2f78('0x29')];var _0x43abca=_0x54c133['substring'](_0x54c133['lastIndexOf']('(')+0x1,_0x54c133[_0x2f78('0x2b')](')'));_0xd18186[_0x2f78('0x46')]=_0x43abca;_0x54bd73(_0xd18186);})[_0x2f78('0x13')](function(_0x3d6794){_0x6f0dcc(_0x3d6794[_0x2f78('0x16')]);});});}function emit(_0x21540f,_0x233ef3,_0x2c275c,_0x3db8d6){var _0x2e2196={'uri':util[_0x2f78('0x47')](_0x2f78('0x48'),_0x21540f,_0x2c275c,_0x3db8d6)};io['to'](util[_0x2f78('0x47')](_0x2f78('0x49'),_0x233ef3))['emit'](_0x2f78('0x4a'),_0x2e2196);}exports['cs']=function(_0x9dfab3,_0x350cd7,_0xd5bd,_0x546cb8,_0x597b7a,_0x1e2123,_0x1322ad,_0x20ae84){var _0x3589c9={};_0x1e2123[_0x2f78('0xd')]=intUtil['stripTrailingSlash'](_0x1e2123[_0x2f78('0xd')]);_0x1e2123[_0x2f78('0x4b')]=intUtil['stripTrailingSlash'](_0x1e2123[_0x2f78('0x4b')]);_0x3589c9['callDirection']=_0x20ae84==='queue'||_0x20ae84===_0x2f78('0x4c')?_0x2f78('0x45'):_0x2f78('0x25');var _0x30a764=util[_0x2f78('0x47')](_0x2f78('0x4d'),_0x1e2123[_0x2f78('0xd')]);var _0x42d552=util[_0x2f78('0x47')](_0x2f78('0x4e'),_0x1e2123[_0x2f78('0x4f')]);var _0x1537d9=util['format'](_0x2f78('0x50'),_0x1e2123['serverUrl'],_0x350cd7[_0x2f78('0x51')],md5(_0x350cd7['uniqueid']));if(_0x597b7a&&_0x597b7a['monitor_format']){logger[_0x2f78('0x23')](_0x2f78('0x52'),_0x2f78('0x53'));_0x350cd7[_0x2f78('0x54')]=_0x1537d9;}else if(_0x1322ad&&_0x1322ad['recordingFormat']&&_0x1322ad['recordingFormat']!==_0x2f78('0x55')){logger[_0x2f78('0x23')](_0x2f78('0x56'),'Recording\x20is\x20enabled!');_0x350cd7[_0x2f78('0x54')]=_0x1537d9;}else{_0x350cd7[_0x2f78('0x54')]='';}return getUser(_0x3589c9,_0x1e2123,_0x546cb8,_0x42d552,_0x30a764,_0x20ae84)[_0x2f78('0x11')](function(_0x4b5ee5){logger[_0x2f78('0x23')]('['+_0x20ae84[_0x2f78('0x14')]()+_0x2f78('0x57'),_0x4b5ee5[_0x2f78('0x22')]);logger[_0x2f78('0x23')]('['+_0x20ae84['toUpperCase']()+_0x2f78('0x58'),_0x4b5ee5[_0x2f78('0x1c')]);return getEndUser(_0x4b5ee5,_0x1e2123,_0x42d552,_0x30a764,_0x350cd7,_0x20ae84);})[_0x2f78('0x11')](function(_0x538c18){logger[_0x2f78('0x23')]('['+_0x20ae84[_0x2f78('0x14')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x538c18[_0x2f78('0x2c')]);logger[_0x2f78('0x23')]('['+_0x20ae84[_0x2f78('0x14')]()+_0x2f78('0x59'),_0x350cd7[_0x2f78('0x5a')]);return getTicket(_0x538c18,_0x1e2123,_0x42d552,_0x30a764,_0x350cd7,_0xd5bd,_0x20ae84);})[_0x2f78('0x11')](function(_0xdca5a9){logger['info'](util['format']('['+_0x20ae84[_0x2f78('0x14')]()+_0x2f78('0x5b'),_0xd5bd[_0x2f78('0x3a')],_0xdca5a9[_0x2f78('0x46')]));logger[_0x2f78('0x23')](util[_0x2f78('0x47')]('['+_0x20ae84['toUpperCase']()+_0x2f78('0x5c'),_0x20ae84));if(_0x20ae84!==_0x2f78('0x4c')){logger[_0x2f78('0x23')]('['+_0x20ae84['toUpperCase']()+']',_0x2f78('0x5d'));emit(_0x1e2123['remoteUri'],_0x546cb8[_0x2f78('0x5e')],_0xd5bd[_0x2f78('0x3a')],_0xdca5a9['ticketId']);}})['catch'](function(_0x4d15ad){logger[_0x2f78('0x5f')]('['+_0x20ae84['toUpperCase']()+_0x2f78('0x60'),util[_0x2f78('0x61')](_0x4d15ad,{'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 8bfd4b0..40a7aec 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 _0xb135=['name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','[HTTP]','stringify','GET','type','string','nameField','customField','toLowerCase','idField','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','user:%s','error','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x25e5d1,_0x11e5b9){var _0x4e7d24=function(_0x5774e3){while(--_0x5774e3){_0x25e5d1['push'](_0x25e5d1['shift']());}};_0x4e7d24(++_0x11e5b9);}(_0xb135,0x1b2));var _0x5b13=function(_0x1f83ad,_0x30d5da){_0x1f83ad=_0x1f83ad-0x0;var _0x56a67a=_0xb135[_0x1f83ad];return _0x56a67a;};'use strict';var _=require(_0x5b13('0x0'));var rp=require('request-promise');var md5=require(_0x5b13('0x1'));var util=require(_0x5b13('0x2'));var Redis=require(_0x5b13('0x3'));var intUtil=require(_0x5b13('0x4'));var config=require(_0x5b13('0x5'));var logger=require('../../../../config/logger')('freshdesk');config[_0x5b13('0x6')]=_[_0x5b13('0x7')](config['redis'],{'host':_0x5b13('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x5b13('0x9'),'Accept':'application/json'};function emit(_0x5e3a0a,_0x74793b,_0x2a7806){io['to'](_0x5e3a0a)[_0x5b13('0xa')](_0x74793b,_0x2a7806);}function getTicket(_0x2d2b9c,_0x353336,_0x1b7f1b,_0x316a48,_0xc90669){logger[_0x5b13('0xb')](_0x5b13('0xc'));var _0x3d5cb4=_[_0x5b13('0xd')]({'responder_id':_0x353336['id'],'requester_id':_0x1b7f1b['id'],'name':util['format'](_0x5b13('0xe'),_0xc90669[_0x5b13('0xf')]),'phone':_0xc90669[_0x5b13('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5b13('0x11')](_0x316a48[_0x5b13('0x12')],_0xc90669,'\x20'),'description':intUtil[_0x5b13('0x11')](_0x316a48[_0x5b13('0x13')],_0xc90669,_0x5b13('0x14')),'tags':getTags(_0x316a48['Tags'],_0x5b13('0x15'))},getCustomFields(_0x316a48[_0x5b13('0x16')],_0xc90669));_0x3d5cb4[_0x5b13('0x17')]=_[_0x5b13('0x18')](_[_0x5b13('0x19')](_0x3d5cb4[_0x5b13('0x17')],'id'),_0x5b13('0x1a'));return request({'uri':util[_0x5b13('0x1b')](_0x5b13('0x1c'),_0x2d2b9c[_0x5b13('0x1d')]),'method':_0x5b13('0x1e'),'body':_0x3d5cb4})[_0x5b13('0x1f')](function(_0x3bb4b9){logger[_0x5b13('0xb')]('Ticket\x20created!');return _0x3bb4b9;});}function getUser(_0x305871,_0x46da8a){if(intUtil[_0x5b13('0x20')](_0x46da8a)){return request({'uri':util[_0x5b13('0x1b')]('%s/api/v2/agents',_0x305871['remoteUri']),'qs':{'email':_0x46da8a}})[_0x5b13('0x1f')](function(_0x282084){if(_0x282084[_0x5b13('0x21')]){logger[_0x5b13('0xb')](_0x5b13('0x22'));return _[_0x5b13('0x23')](_0x282084,function(_0x3a16f3){return _0x3a16f3[_0x5b13('0x24')][_0x5b13('0x25')]===_0x46da8a;});}else{logger[_0x5b13('0xb')](_0x5b13('0x26'));return request({'uri':util[_0x5b13('0x1b')](_0x5b13('0x27'),_0x305871[_0x5b13('0x1d')])})[_0x5b13('0x1f')](function(_0x2ed418){logger[_0x5b13('0xb')]('Admin\x20account\x20selected.');return _0x2ed418;});}});}else{logger[_0x5b13('0xb')](_0x5b13('0x28'));return request({'uri':util[_0x5b13('0x1b')](_0x5b13('0x27'),_0x305871[_0x5b13('0x1d')])})['then'](function(_0xac6f0f){logger[_0x5b13('0xb')](_0x5b13('0x29'));return _0xac6f0f;});}}function getEndUser(_0xfac6,_0x4a0aa5,_0x2356d5){logger[_0x5b13('0xb')]('Searching\x20enduser\x20with\x20phone',_0x2356d5);return request({'uri':util['format'](_0x5b13('0x2a'),_0xfac6[_0x5b13('0x1d')]),'qs':{'phone':_0x2356d5}})[_0x5b13('0x1f')](function(_0xb0d1d){if(_0xb0d1d[_0x5b13('0x21')]){logger[_0x5b13('0xb')](_0x5b13('0x2b'));return _[_0x5b13('0x23')](_0xb0d1d,{'phone':_0x2356d5});}else{logger[_0x5b13('0xb')](_0x5b13('0x2c'));return request({'uri':util['format']('%s/api/v2/contacts',_0xfac6[_0x5b13('0x1d')]),'method':_0x5b13('0x1e'),'body':{'name':_0x4a0aa5,'phone':_0x2356d5}})[_0x5b13('0x1f')](function(_0x3886ce){logger[_0x5b13('0xb')](_0x5b13('0x2d'));return _0x3886ce;});}});}function getAuth(_0x15c3f8){return util[_0x5b13('0x1b')]('Basic\x20%s',new Buffer(_0x15c3f8[_0x5b13('0x2e')]+':X')[_0x5b13('0x2f')]('base64'));}function request(_0x422636){logger['debug'](_0x5b13('0x30'),JSON[_0x5b13('0x31')](_0x422636));return rp(_[_0x5b13('0x7')](_0x422636,{'method':_0x5b13('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x38bc21,_0x1a0075){var _0x1d5574=[];if(_0x38bc21&&_0x38bc21['length']>0x0){_0x1d5574=_['map'](_0x38bc21,_0x1a0075);}return _0x1d5574;}function getCustomFields(_0x28d3af,_0x28d972){var _0xf47ec1=[];var _0x2d44b5={'custom_fields':[]};if(_0x28d3af[_0x5b13('0x21')]>0x0){_['forEach'](_0x28d3af,function(_0x3dba9b){if(_0x3dba9b[_0x5b13('0x33')]===_0x5b13('0x34')&&_0x3dba9b[_0x5b13('0x35')]&&!_0x3dba9b[_0x5b13('0x36')]){_0x2d44b5[_0x3dba9b[_0x5b13('0x35')][_0x5b13('0x37')]()]=_0x3dba9b['content'][_0x5b13('0x2f')]();}else if(_0x3dba9b[_0x5b13('0x33')]==='string'&&_0x3dba9b[_0x5b13('0x38')]&&_0x3dba9b[_0x5b13('0x36')]){_0x2d44b5[_0x5b13('0x17')][_0x5b13('0x39')]({'id':_0x3dba9b['idField'],'value':_0x3dba9b[_0x5b13('0x3a')][_0x5b13('0x2f')]()});}else if(_0x3dba9b['type']===_0x5b13('0x3b')&&_0x3dba9b[_0x5b13('0x3c')]&&_0x3dba9b[_0x5b13('0x38')]&&_0x3dba9b[_0x5b13('0x36')]){_0x28d972[_0x3dba9b['variableName']]&&_0x2d44b5['custom_fields'][_0x5b13('0x39')]({'id':_0x3dba9b[_0x5b13('0x38')],'value':_0x28d972[_0x3dba9b['variableName']]['toString']()});}else if(_0x3dba9b[_0x5b13('0x33')]===_0x5b13('0x3d')&&_0x3dba9b[_0x5b13('0x3e')]&&_0x3dba9b['Variable'][_0x5b13('0x15')]&&_0x3dba9b[_0x5b13('0x38')]&&_0x3dba9b['customField']){_0x28d972[_0x3dba9b['Variable']['name'][_0x5b13('0x37')]()]&&_0x2d44b5[_0x5b13('0x17')][_0x5b13('0x39')]({'id':_0x3dba9b[_0x5b13('0x38')],'value':_0x28d972[_0x3dba9b[_0x5b13('0x3e')][_0x5b13('0x15')]['toLowerCase']()][_0x5b13('0x2f')]()});}});}return _0x2d44b5;}exports[_0x5b13('0x3f')]=function(_0x524eab,_0x1ef26c,_0x582f98,_0x5b5b73,_0x5709a5,_0x54638b){var _0x1920f7,_0x286e12;_0x54638b['remoteUri']=intUtil[_0x5b13('0x40')](_0x54638b['remoteUri']);_0x54638b[_0x5b13('0x41')]=intUtil[_0x5b13('0x40')](_0x54638b[_0x5b13('0x41')]);if(_0x5709a5&&_0x5709a5[_0x5b13('0x42')]){logger[_0x5b13('0xb')]('[QUEUE]',_0x5b13('0x43'));_0x1ef26c[_0x5b13('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54638b[_0x5b13('0x41')],_0x1ef26c[_0x5b13('0x45')],md5(_0x1ef26c['uniqueid']));}else{_0x1ef26c[_0x5b13('0x44')]='';}headers[_0x5b13('0x46')]=getAuth(_0x54638b);return getUser(_0x54638b,_0x5b5b73[_0x5b13('0x25')])[_0x5b13('0x1f')](function(_0x5edeb7){_0x1920f7=_0x5edeb7;logger[_0x5b13('0xb')]('The\x20User\x20ID\x20is:',_0x1920f7['id']);return getEndUser(_0x54638b,_0x1ef26c[_0x5b13('0xf')],_0x1ef26c['calleridnum']);})[_0x5b13('0x1f')](function(_0x565f60){_0x286e12=_0x565f60;logger[_0x5b13('0xb')](_0x5b13('0x47'),_0x286e12['id']);return getTicket(_0x54638b,_0x1920f7,_0x286e12,_0x582f98,_0x1ef26c);})[_0x5b13('0x1f')](function(_0x3701b3){if(_0x3701b3&&_0x3701b3['id']){logger['info'](_0x5b13('0x48'));logger[_0x5b13('0xb')](_0x5b13('0x49'),_0x3701b3['id']);logger[_0x5b13('0xb')](_0x5b13('0x4a'),_0x5b13('0x4b'));emit(util[_0x5b13('0x1b')]('user:%s',_0x5b5b73[_0x5b13('0x15')]),_0x5b13('0x4c'),{'uri':util[_0x5b13('0x1b')](_0x5b13('0x4d'),_0x54638b[_0x5b13('0x1d')],_0x3701b3['id'])});}})[_0x5b13('0x4e')](function(_0x3ee413){logger['error'](_0x5b13('0x4a'),JSON[_0x5b13('0x31')](_0x3ee413));});};exports[_0x5b13('0x4f')]=function(_0xfdd9df,_0x37eb29,_0x43bad5,_0x43ad38,_0x172f42,_0x19ce5c,_0x1f7900){var _0x337ff7,_0x57df33;_0x19ce5c['remoteUri']=intUtil['stripTrailingSlash'](_0x19ce5c[_0x5b13('0x1d')]);_0x19ce5c[_0x5b13('0x41')]=intUtil['stripTrailingSlash'](_0x19ce5c[_0x5b13('0x41')]);if(_0x1f7900&&_0x1f7900['recordingFormat']&&_0x1f7900[_0x5b13('0x50')]!=='none'){logger[_0x5b13('0xb')](_0x5b13('0x51'),'Recording\x20is\x20enabled!');_0x37eb29[_0x5b13('0x44')]=util['format'](_0x5b13('0x52'),_0x19ce5c['serverUrl'],_0x37eb29[_0x5b13('0x45')],md5(_0x37eb29[_0x5b13('0x45')]));}headers[_0x5b13('0x46')]=getAuth(_0x19ce5c);return getUser(_0x19ce5c,_0x43ad38[_0x5b13('0x25')])[_0x5b13('0x1f')](function(_0x15f293){_0x337ff7=_0x15f293;logger[_0x5b13('0xb')]('The\x20User\x20ID\x20is:',_0x337ff7['id']);return getEndUser(_0x19ce5c,_0x37eb29[_0x5b13('0x53')],_0x37eb29[_0x5b13('0x54')]);})[_0x5b13('0x1f')](function(_0x1216c8){_0x57df33=_0x1216c8;logger['info'](_0x5b13('0x47'),_0x57df33['id']);return getTicket(_0x19ce5c,_0x337ff7,_0x57df33,_0x43bad5,_0x37eb29);})[_0x5b13('0x1f')](function(_0x538155){if(_0x538155&&_0x538155['id']){logger[_0x5b13('0xb')](_0x5b13('0x48'));logger[_0x5b13('0xb')]('The\x20Ticket\x20ID\x20is:',_0x538155['id']);logger[_0x5b13('0xb')](_0x5b13('0x51'),_0x5b13('0x4b'));emit(util[_0x5b13('0x1b')](_0x5b13('0x55'),_0x43ad38[_0x5b13('0x15')]),_0x5b13('0x4c'),{'uri':util[_0x5b13('0x1b')](_0x5b13('0x4d'),_0x19ce5c[_0x5b13('0x1d')],_0x538155['id'])});}})['catch'](function(_0x4a5886){logger[_0x5b13('0x56')](_0x5b13('0x51'),JSON['stringify'](_0x4a5886));});};exports[_0x5b13('0x57')]=function(_0x271377,_0x231f9a,_0x16f7f2,_0x31d84f,_0x34e0e8,_0x8bd956){var _0x2f8a05,_0x3940c0;_0x8bd956[_0x5b13('0x1d')]=intUtil['stripTrailingSlash'](_0x8bd956['remoteUri']);_0x8bd956[_0x5b13('0x41')]=intUtil['stripTrailingSlash'](_0x8bd956[_0x5b13('0x41')]);if(_0x34e0e8&&_0x34e0e8[_0x5b13('0x42')]){logger[_0x5b13('0xb')]('['+_0x231f9a[_0x5b13('0x58')]['toUpperCase']()+']',_0x5b13('0x43'));_0x231f9a[_0x5b13('0x44')]=util[_0x5b13('0x1b')](_0x5b13('0x52'),_0x8bd956[_0x5b13('0x41')],_0x231f9a['uniqueid'],md5(_0x231f9a['uniqueid']));}else{_0x231f9a['recordingURL']='';}headers['Authorization']=getAuth(_0x8bd956);return getUser(_0x8bd956,'')[_0x5b13('0x1f')](function(_0x48a162){_0x2f8a05=_0x48a162;logger[_0x5b13('0xb')](_0x5b13('0x59'),_0x2f8a05['id']);return getEndUser(_0x8bd956,_0x231f9a[_0x5b13('0xf')],_0x231f9a[_0x5b13('0x10')]);})['then'](function(_0x227394){_0x3940c0=_0x227394;logger[_0x5b13('0xb')](_0x5b13('0x47'),_0x3940c0['id']);return getTicket(_0x8bd956,_0x2f8a05,_0x3940c0,_0x16f7f2,_0x231f9a);})[_0x5b13('0x1f')](function(_0x2b07a9){if(_0x2b07a9){logger[_0x5b13('0xb')]('Ticket\x20created!');logger['info'](_0x5b13('0x49'),_0x2b07a9['id']);}})[_0x5b13('0x4e')](function(_0x24aaae){logger[_0x5b13('0x56')]('['+_0x231f9a['lastevent'][_0x5b13('0x5a')]()+']',JSON['stringify'](_0x24aaae));});}; \ No newline at end of file +var _0xedcb=['length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','toString','[HTTP]','stringify','defaults','GET','map','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','Tags','Fields','custom_fields','keyBy','value','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xedcb,0x153));var _0xbedc=function(_0x110988,_0xcdd538){_0x110988=_0x110988-0x0;var _0x2e2b17=_0xedcb[_0x110988];return _0x2e2b17;};'use strict';var _=require(_0xbedc('0x0'));var rp=require(_0xbedc('0x1'));var md5=require(_0xbedc('0x2'));var util=require(_0xbedc('0x3'));var Redis=require(_0xbedc('0x4'));var intUtil=require(_0xbedc('0x5'));var config=require(_0xbedc('0x6'));var logger=require('../../../../config/logger')(_0xbedc('0x7'));config[_0xbedc('0x8')]=_['defaults'](config[_0xbedc('0x8')],{'host':_0xbedc('0x9'),'port':0x18eb});var io=require(_0xbedc('0xa'))(new Redis(config[_0xbedc('0x8')]));var headers={'Content-Type':_0xbedc('0xb'),'Accept':'application/json'};function emit(_0x125bf5,_0x2777f3,_0x1003f5){io['to'](_0x125bf5)[_0xbedc('0xc')](_0x2777f3,_0x1003f5);}function getTicket(_0x13db31,_0x438ee2,_0x280edd,_0x120d5d,_0x10abd8){logger[_0xbedc('0xd')](_0xbedc('0xe'));var _0x3dffa5=_[_0xbedc('0xf')]({'responder_id':_0x438ee2['id'],'requester_id':_0x280edd['id'],'name':util[_0xbedc('0x10')](_0xbedc('0x11'),_0x10abd8[_0xbedc('0x12')]),'phone':_0x10abd8['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbedc('0x13')](_0x120d5d[_0xbedc('0x14')],_0x10abd8,'\x20'),'description':intUtil[_0xbedc('0x13')](_0x120d5d[_0xbedc('0x15')],_0x10abd8,'
'),'tags':getTags(_0x120d5d[_0xbedc('0x16')],'name')},getCustomFields(_0x120d5d[_0xbedc('0x17')],_0x10abd8));_0x3dffa5[_0xbedc('0x18')]=_['mapValues'](_[_0xbedc('0x19')](_0x3dffa5['custom_fields'],'id'),_0xbedc('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x13db31['remoteUri']),'method':_0xbedc('0x1b'),'body':_0x3dffa5})[_0xbedc('0x1c')](function(_0x31bcd8){logger['info'](_0xbedc('0x1d'));return _0x31bcd8;});}function getUser(_0x4f7602,_0x43670a){if(intUtil[_0xbedc('0x1e')](_0x43670a)){return request({'uri':util[_0xbedc('0x10')](_0xbedc('0x1f'),_0x4f7602[_0xbedc('0x20')]),'qs':{'email':_0x43670a}})[_0xbedc('0x1c')](function(_0x5d84ed){if(_0x5d84ed[_0xbedc('0x21')]){logger[_0xbedc('0xd')](_0xbedc('0x22'));return _[_0xbedc('0x23')](_0x5d84ed,function(_0x52777d){return _0x52777d[_0xbedc('0x24')][_0xbedc('0x25')]===_0x43670a;});}else{logger[_0xbedc('0xd')](_0xbedc('0x26'));return request({'uri':util['format'](_0xbedc('0x27'),_0x4f7602['remoteUri'])})[_0xbedc('0x1c')](function(_0x4f722c){logger[_0xbedc('0xd')](_0xbedc('0x28'));return _0x4f722c;});}});}else{logger['info'](_0xbedc('0x29'));return request({'uri':util[_0xbedc('0x10')](_0xbedc('0x27'),_0x4f7602[_0xbedc('0x20')])})[_0xbedc('0x1c')](function(_0x4d6dbb){logger[_0xbedc('0xd')](_0xbedc('0x28'));return _0x4d6dbb;});}}function getEndUser(_0x56e10d,_0x488831,_0x5a2b7c){logger[_0xbedc('0xd')](_0xbedc('0x2a'),_0x5a2b7c);return request({'uri':util['format']('%s/api/v2/contacts',_0x56e10d[_0xbedc('0x20')]),'qs':{'phone':_0x5a2b7c}})[_0xbedc('0x1c')](function(_0x119975){if(_0x119975[_0xbedc('0x21')]){logger[_0xbedc('0xd')](_0xbedc('0x2b'));return _['find'](_0x119975,{'phone':_0x5a2b7c});}else{logger['info'](_0xbedc('0x2c'));return request({'uri':util[_0xbedc('0x10')](_0xbedc('0x2d'),_0x56e10d[_0xbedc('0x20')]),'method':_0xbedc('0x1b'),'body':{'name':_0x488831,'phone':_0x5a2b7c}})[_0xbedc('0x1c')](function(_0x1bb82a){logger[_0xbedc('0xd')](_0xbedc('0x2e'));return _0x1bb82a;});}});}function getAuth(_0x23ed0c){return util[_0xbedc('0x10')]('Basic\x20%s',new Buffer(_0x23ed0c['apiKey']+':X')[_0xbedc('0x2f')]('base64'));}function request(_0x2537ad){logger['debug'](_0xbedc('0x30'),JSON[_0xbedc('0x31')](_0x2537ad));return rp(_[_0xbedc('0x32')](_0x2537ad,{'method':_0xbedc('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x446b9d,_0x53f5ec){var _0x2e0ba0=[];if(_0x446b9d&&_0x446b9d[_0xbedc('0x21')]>0x0){_0x2e0ba0=_[_0xbedc('0x34')](_0x446b9d,_0x53f5ec);}return _0x2e0ba0;}function getCustomFields(_0x539f30,_0x19843f){var _0xeb0d7c=[];var _0x297dcd={'custom_fields':[]};if(_0x539f30[_0xbedc('0x21')]>0x0){_['forEach'](_0x539f30,function(_0x126526){if(_0x126526[_0xbedc('0x35')]===_0xbedc('0x36')&&_0x126526[_0xbedc('0x37')]&&!_0x126526[_0xbedc('0x38')]){_0x297dcd[_0x126526[_0xbedc('0x37')][_0xbedc('0x39')]()]=_0x126526[_0xbedc('0x3a')][_0xbedc('0x2f')]();}else if(_0x126526[_0xbedc('0x35')]===_0xbedc('0x36')&&_0x126526[_0xbedc('0x3b')]&&_0x126526[_0xbedc('0x38')]){_0x297dcd[_0xbedc('0x18')][_0xbedc('0x3c')]({'id':_0x126526[_0xbedc('0x3b')],'value':_0x126526['content'][_0xbedc('0x2f')]()});}else if(_0x126526['type']===_0xbedc('0x3d')&&_0x126526[_0xbedc('0x3e')]&&_0x126526[_0xbedc('0x3b')]&&_0x126526[_0xbedc('0x38')]){_0x19843f[_0x126526[_0xbedc('0x3e')]]&&_0x297dcd[_0xbedc('0x18')][_0xbedc('0x3c')]({'id':_0x126526['idField'],'value':_0x19843f[_0x126526[_0xbedc('0x3e')]][_0xbedc('0x2f')]()});}else if(_0x126526['type']===_0xbedc('0x3f')&&_0x126526[_0xbedc('0x40')]&&_0x126526[_0xbedc('0x40')][_0xbedc('0x41')]&&_0x126526[_0xbedc('0x3b')]&&_0x126526['customField']){_0x19843f[_0x126526[_0xbedc('0x40')][_0xbedc('0x41')][_0xbedc('0x39')]()]&&_0x297dcd[_0xbedc('0x18')][_0xbedc('0x3c')]({'id':_0x126526[_0xbedc('0x3b')],'value':_0x19843f[_0x126526[_0xbedc('0x40')][_0xbedc('0x41')][_0xbedc('0x39')]()][_0xbedc('0x2f')]()});}});}return _0x297dcd;}exports[_0xbedc('0x42')]=function(_0x4dedc9,_0x3ca81f,_0x1d7d96,_0x4273af,_0x26e51e,_0xb2d6f0){var _0x5314ad,_0x594049;_0xb2d6f0[_0xbedc('0x20')]=intUtil[_0xbedc('0x43')](_0xb2d6f0['remoteUri']);_0xb2d6f0['serverUrl']=intUtil[_0xbedc('0x43')](_0xb2d6f0[_0xbedc('0x44')]);if(_0x26e51e&&_0x26e51e[_0xbedc('0x45')]){logger['info'](_0xbedc('0x46'),'Recording\x20is\x20enabled!');_0x3ca81f['recordingURL']=util[_0xbedc('0x10')](_0xbedc('0x47'),_0xb2d6f0[_0xbedc('0x44')],_0x3ca81f[_0xbedc('0x48')],md5(_0x3ca81f[_0xbedc('0x48')]));}else{_0x3ca81f[_0xbedc('0x49')]='';}headers[_0xbedc('0x4a')]=getAuth(_0xb2d6f0);return getUser(_0xb2d6f0,_0x4273af[_0xbedc('0x25')])[_0xbedc('0x1c')](function(_0x4f208a){_0x5314ad=_0x4f208a;logger['info'](_0xbedc('0x4b'),_0x5314ad['id']);return getEndUser(_0xb2d6f0,_0x3ca81f[_0xbedc('0x12')],_0x3ca81f[_0xbedc('0x4c')]);})['then'](function(_0x276729){_0x594049=_0x276729;logger[_0xbedc('0xd')](_0xbedc('0x4d'),_0x594049['id']);return getTicket(_0xb2d6f0,_0x5314ad,_0x594049,_0x1d7d96,_0x3ca81f);})[_0xbedc('0x1c')](function(_0x1fb561){if(_0x1fb561&&_0x1fb561['id']){logger[_0xbedc('0xd')](_0xbedc('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1fb561['id']);logger['info'](_0xbedc('0x46'),_0xbedc('0x4e'));emit(util['format'](_0xbedc('0x4f'),_0x4273af[_0xbedc('0x41')]),_0xbedc('0x50'),{'uri':util[_0xbedc('0x10')](_0xbedc('0x51'),_0xb2d6f0[_0xbedc('0x20')],_0x1fb561['id'])});}})[_0xbedc('0x52')](function(_0xbc713d){logger[_0xbedc('0x53')]('[QUEUE]',JSON['stringify'](_0xbc713d));});};exports[_0xbedc('0x54')]=function(_0x32f378,_0xdc0614,_0x5d805e,_0x3cd019,_0x161f3d,_0x320329,_0xaba44){var _0x3d580e,_0x407a6e;_0x320329[_0xbedc('0x20')]=intUtil[_0xbedc('0x43')](_0x320329[_0xbedc('0x20')]);_0x320329['serverUrl']=intUtil[_0xbedc('0x43')](_0x320329[_0xbedc('0x44')]);if(_0xaba44&&_0xaba44['recordingFormat']&&_0xaba44[_0xbedc('0x55')]!=='none'){logger[_0xbedc('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xdc0614[_0xbedc('0x49')]=util[_0xbedc('0x10')](_0xbedc('0x47'),_0x320329[_0xbedc('0x44')],_0xdc0614[_0xbedc('0x48')],md5(_0xdc0614['uniqueid']));}headers[_0xbedc('0x4a')]=getAuth(_0x320329);return getUser(_0x320329,_0x3cd019['email'])['then'](function(_0x200cff){_0x3d580e=_0x200cff;logger[_0xbedc('0xd')]('The\x20User\x20ID\x20is:',_0x3d580e['id']);return getEndUser(_0x320329,_0xdc0614['destcalleridname'],_0xdc0614[_0xbedc('0x56')]);})[_0xbedc('0x1c')](function(_0x3780f5){_0x407a6e=_0x3780f5;logger[_0xbedc('0xd')](_0xbedc('0x4d'),_0x407a6e['id']);return getTicket(_0x320329,_0x3d580e,_0x407a6e,_0x5d805e,_0xdc0614);})[_0xbedc('0x1c')](function(_0x55d382){if(_0x55d382&&_0x55d382['id']){logger['info'](_0xbedc('0x1d'));logger[_0xbedc('0xd')](_0xbedc('0x57'),_0x55d382['id']);logger[_0xbedc('0xd')](_0xbedc('0x58'),_0xbedc('0x4e'));emit(util[_0xbedc('0x10')](_0xbedc('0x4f'),_0x3cd019[_0xbedc('0x41')]),'trigger:browser:url',{'uri':util[_0xbedc('0x10')](_0xbedc('0x51'),_0x320329['remoteUri'],_0x55d382['id'])});}})[_0xbedc('0x52')](function(_0x34ecb9){logger[_0xbedc('0x53')](_0xbedc('0x58'),JSON[_0xbedc('0x31')](_0x34ecb9));});};exports[_0xbedc('0x59')]=function(_0x47cc14,_0x592c6f,_0x50ed9d,_0x2e08b9,_0x29c5c6,_0x2797b3){var _0x516793,_0x3358f9;_0x2797b3[_0xbedc('0x20')]=intUtil[_0xbedc('0x43')](_0x2797b3[_0xbedc('0x20')]);_0x2797b3[_0xbedc('0x44')]=intUtil['stripTrailingSlash'](_0x2797b3['serverUrl']);if(_0x29c5c6&&_0x29c5c6[_0xbedc('0x45')]){logger[_0xbedc('0xd')]('['+_0x592c6f[_0xbedc('0x5a')][_0xbedc('0x5b')]()+']',_0xbedc('0x5c'));_0x592c6f['recordingURL']=util[_0xbedc('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2797b3[_0xbedc('0x44')],_0x592c6f[_0xbedc('0x48')],md5(_0x592c6f[_0xbedc('0x48')]));}else{_0x592c6f[_0xbedc('0x49')]='';}headers['Authorization']=getAuth(_0x2797b3);return getUser(_0x2797b3,'')[_0xbedc('0x1c')](function(_0x36f2ca){_0x516793=_0x36f2ca;logger[_0xbedc('0xd')](_0xbedc('0x4b'),_0x516793['id']);return getEndUser(_0x2797b3,_0x592c6f[_0xbedc('0x12')],_0x592c6f['calleridnum']);})[_0xbedc('0x1c')](function(_0x4da5d0){_0x3358f9=_0x4da5d0;logger['info'](_0xbedc('0x4d'),_0x3358f9['id']);return getTicket(_0x2797b3,_0x516793,_0x3358f9,_0x50ed9d,_0x592c6f);})[_0xbedc('0x1c')](function(_0x390417){if(_0x390417){logger[_0xbedc('0xd')](_0xbedc('0x1d'));logger[_0xbedc('0xd')](_0xbedc('0x57'),_0x390417['id']);}})['catch'](function(_0x1d1d0d){logger['error']('['+_0x592c6f['lastevent'][_0xbedc('0x5b')]()+']',JSON['stringify'](_0x1d1d0d));});}; \ 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 60e577a..14548f4 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 _0xea81=['./util','../../../../config/environment','../../../../config/logger','freshsales','localhost','socket.io-emitter','redis','GET','headers','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','error','/api/lookup?q=','&f=','find','contacts','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','getString','Subjects','Contact','format','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','ioredis'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xea81,0x1ed));var _0x1ea8=function(_0x13987f,_0x4efcc9){_0x13987f=_0x13987f-0x0;var _0x49f679=_0xea81[_0x13987f];return _0x49f679;};'use strict';var _=require(_0x1ea8('0x0'));var rp=require(_0x1ea8('0x1'));var md5=require(_0x1ea8('0x2'));var util=require(_0x1ea8('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0x1ea8('0x4'));var intUtil=require(_0x1ea8('0x5'));var config=require(_0x1ea8('0x6'));var logger=require(_0x1ea8('0x7'))(_0x1ea8('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x1ea8('0x9'),'port':0x18eb});var io=require(_0x1ea8('0xa'))(new Redis(config[_0x1ea8('0xb')]));function getAdminId(_0x2140e8,_0x4ec13b,_0x1e2577,_0x2c48ce){return new Promise(function(_0x35160b,_0x432447){var _0x495092=![];var _0x5732b5={'method':_0x1ea8('0xc'),'uri':_0x2c48ce+'/api/selector/owners','json':!![]};_0x5732b5[_0x1ea8('0xd')]=_0x1e2577;logger[_0x1ea8('0xe')](_0x1ea8('0xf'));return rp(_0x5732b5)[_0x1ea8('0x10')](function(_0x90eccb){if(_0x90eccb){var _0x5b35ea=_0x90eccb['users'];var _0x2e2c66=null;for(_0x2e2c66=0x0;_0x2e2c66<_0x5b35ea[_0x1ea8('0x11')];_0x2e2c66++){if(_0x5b35ea[_0x2e2c66]['email']===_0x2140e8[_0x1ea8('0x12')]){_0x2140e8[_0x1ea8('0x13')]=_0x5b35ea[_0x2e2c66]['id'];_0x495092=!![];}}if(_0x495092){logger[_0x1ea8('0xe')](_0x1ea8('0x14'),_0x2140e8[_0x1ea8('0x13')]);_0x35160b(_0x2140e8);}else{_0x432447({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x432447({'statusCode':0x194,'message':_0x1ea8('0x15')});}})[_0x1ea8('0x16')](function(_0x3e072d){logger['error']('['+[_0x4ec13b[_0x1ea8('0x17')]()]+']',_0x3e072d[_0x1ea8('0x18')]);_0x432447(_0x3e072d);});});}function getUser(_0x4c8228,_0x5c053a,_0x3292bc){return function(_0x4b80f9){return new Promise(function(_0x46c78a,_0x4cf432){var _0x239c3d={'method':_0x1ea8('0xc'),'uri':_0x3292bc+_0x1ea8('0x19'),'json':!![]};_0x239c3d[_0x1ea8('0xd')]=_0x5c053a;logger[_0x1ea8('0xe')](_0x1ea8('0x1a'));return rp(_0x239c3d)[_0x1ea8('0x10')](function(_0x346a1e){if(_0x346a1e){var _0x5344ca=_0x346a1e[_0x1ea8('0x1b')];var _0x2a3b4c=![];var _0x1b0148=null;if(_0x4b80f9[_0x1ea8('0x1c')]!==null){logger[_0x1ea8('0xe')](_0x1ea8('0x1d'),_0x4b80f9[_0x1ea8('0x1c')]);_0x4b80f9[_0x1ea8('0x1e')]=_0x4b80f9[_0x1ea8('0x1c')];for(_0x1b0148=0x0;_0x1b0148<_0x5344ca[_0x1ea8('0x11')];_0x1b0148++){if(_0x5344ca[_0x1b0148]['email']===_0x4b80f9[_0x1ea8('0x1c')]){_0x2a3b4c=!![];_0x4b80f9['userId']=_0x5344ca[_0x1b0148]['id'];logger[_0x1ea8('0xe')]('User\x20found:',_0x4b80f9[_0x1ea8('0x1f')]);}}}if(!_0x2a3b4c){logger['info'](_0x1ea8('0x20'));_0x4b80f9['userEmail']=_0x4b80f9['adminEmail'];_0x4b80f9[_0x1ea8('0x1f')]=_0x4b80f9[_0x1ea8('0x13')];_0x2a3b4c=!![];}if(_0x2a3b4c){_0x46c78a(_0x4b80f9);}else{_0x4cf432({'statusCode':0x194,'message':_0x1ea8('0x15')});}}else{_0x4cf432({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x3a79bf){logger[_0x1ea8('0x21')]('['+[_0x4c8228[_0x1ea8('0x17')]()]+']',_0x3a79bf[_0x1ea8('0x18')]);_0x4cf432(_0x3a79bf);});});};}function searchContact(_0x2e3fe6,_0x140092,_0x3c8059,_0x482b9e){return new Promise(function(_0x22a6a2,_0x4b293f){var _0x6129d4={'method':'GET','headers':_0x140092,'uri':_0x2e3fe6+_0x1ea8('0x22')+_0x482b9e+_0x1ea8('0x23')+_0x3c8059+'&entities=contact','json':!![]};rp(_0x6129d4)[_0x1ea8('0x10')](function(_0x2dfb00){var _0x3cb0bb=_[_0x1ea8('0x24')](_0x2dfb00[_0x1ea8('0x25')][_0x1ea8('0x25')],[_0x3c8059,_0x482b9e]);_0x22a6a2(_0x3cb0bb);})[_0x1ea8('0x16')](function(_0x33d7c8){_0x4b293f(_0x33d7c8);});});}function getEndUser(_0x1091c2,_0x2e56f1,_0x3e236e){return function(_0x39eb2d){return new Promise(function(_0x752060,_0x113216){logger[_0x1ea8('0xe')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x39eb2d[_0x1ea8('0x26')]));searchContact(_0x3e236e,_0x2e56f1,'mobile_number',_0x39eb2d[_0x1ea8('0x26')])[_0x1ea8('0x10')](function(_0x123790){if(_0x123790){_0x39eb2d[_0x1ea8('0x27')]=_0x123790['id'];logger['info'](_0x1ea8('0x28'),_0x39eb2d['endUserId']);return _0x752060(_0x39eb2d);}searchContact(_0x3e236e,_0x2e56f1,'work_number',_0x39eb2d[_0x1ea8('0x26')])[_0x1ea8('0x10')](function(_0x2d4b16){if(_0x2d4b16){_0x39eb2d[_0x1ea8('0x27')]=_0x2d4b16['id'];logger[_0x1ea8('0xe')](_0x1ea8('0x29'),_0x39eb2d[_0x1ea8('0x27')]);return _0x752060(_0x39eb2d);}createEndUser(_0x39eb2d,_0x1091c2,_0x2e56f1,_0x3e236e)['then'](function(_0x2eebfe){logger[_0x1ea8('0xe')](_0x1ea8('0x2a'),_0x2eebfe['endUserId']);return _0x752060(_0x2eebfe);});});})['catch'](function(_0x3a7fc6){_0x113216(_0x3a7fc6);});});};}function createEndUser(_0x29a02c,_0x6e90d0,_0x554c36,_0x3e023e){return new Promise(function(_0x363872,_0x41e623){var _0x3b400c=moment();var _0x3a14af={'method':'POST','uri':_0x3e023e+_0x1ea8('0x2b'),'body':{'contact':{'last_name':_0x29a02c[_0x1ea8('0x26')],'work_number':_0x29a02c['contactNumber'],'mobile_number':_0x29a02c[_0x1ea8('0x26')],'owner_id':_0x29a02c[_0x1ea8('0x1f')],'created_at':_0x3b400c['format'](_0x1ea8('0x2c'))}},'json':!![]};_0x3a14af[_0x1ea8('0xd')]=_0x554c36;logger['info'](_0x1ea8('0x2d'));return rp(_0x3a14af)[_0x1ea8('0x10')](function(_0x516a81){_0x29a02c['endUserId']=_0x516a81[_0x1ea8('0x2e')]['id'];_0x363872(_0x29a02c);})[_0x1ea8('0x16')](function(_0xd6ba1f){logger['error']('['+[_0x6e90d0[_0x1ea8('0x17')]()]+']',_0xd6ba1f['message']);_0x41e623(_0xd6ba1f[_0x1ea8('0x18')]);});});}function getTicket(_0x230650,_0x55423f,_0x47a4b4,_0x4368db,_0x4118cf){return function(_0x39259f){logger[_0x1ea8('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x51d606,_0x36fc6d){var _0x4b9157=moment();var _0x12b70e={'method':_0x1ea8('0x2f'),'uri':_0x47a4b4+'/api/tasks','body':{'title':intUtil[_0x1ea8('0x30')](_0x4368db[_0x1ea8('0x31')],_0x4118cf,'\x20'),'description':intUtil[_0x1ea8('0x30')](_0x4368db['Descriptions'],_0x4118cf,'\x0a'),'owner_id':_0x39259f[_0x1ea8('0x1f')],'creater_id':_0x39259f[_0x1ea8('0x13')],'targetable_id':_0x39259f[_0x1ea8('0x27')],'targetable_type':_0x1ea8('0x32'),'created_at':_0x4b9157[_0x1ea8('0x33')](_0x1ea8('0x2c')),'due_date':_0x4b9157[_0x1ea8('0x34')](0x1e,'m')[_0x1ea8('0x33')](_0x1ea8('0x2c'))},'json':!![]};_0x12b70e[_0x1ea8('0xd')]=_0x55423f;return rp(_0x12b70e)['then'](function(_0xcbda23){_0x39259f[_0x1ea8('0x35')]=_0xcbda23[_0x1ea8('0x36')]['id'];logger['info'](_0x1ea8('0x37'),_0x39259f['ticketId']);_0x51d606(_0x39259f);})[_0x1ea8('0x16')](function(_0x181bc5){logger[_0x1ea8('0x21')]('['+[_0x230650[_0x1ea8('0x17')]()]+']',_0x181bc5[_0x1ea8('0x18')]);_0x36fc6d(_0x181bc5[_0x1ea8('0x18')]);});});};}function emit(_0xa042f8,_0x1e80c3,_0x2cd772){var _0x499e47={'uri':_0xa042f8+'/contacts/'+_0x2cd772};io['to'](util[_0x1ea8('0x33')](_0x1ea8('0x38'),_0x1e80c3))[_0x1ea8('0x39')](_0x1ea8('0x3a'),_0x499e47);}exports['cs']=function(_0x30284c,_0x5e2415,_0x1a832a,_0x37af09,_0x37c61c,_0x1d2530,_0x1607ec,_0x1d4e1e){var _0x1d1f66={};var _0x127de7={'Authorization':'Token\x20token='+_0x1d2530[_0x1ea8('0x3b')]};_0x1d2530['remoteUri']=intUtil[_0x1ea8('0x3c')](_0x1d2530[_0x1ea8('0x3d')]);_0x1d2530[_0x1ea8('0x3e')]=intUtil['stripTrailingSlash'](_0x1d2530['serverUrl']);var _0x5dad4c=_0x1d2530[_0x1ea8('0x3d')];_0x1d1f66[_0x1ea8('0x12')]=_0x1d2530[_0x1ea8('0x3f')];_0x1d1f66['contactNumber']=_0x1d4e1e[_0x1ea8('0x40')]()===_0x1ea8('0x41')?_0x5e2415['destcalleridnum']:_0x5e2415[_0x1ea8('0x42')];_0x1d1f66[_0x1ea8('0x43')]=_0x1d4e1e===_0x1ea8('0x44')||_0x1d4e1e===_0x1ea8('0x45')?_0x1ea8('0x44'):_0x1ea8('0x41');if(_0x37af09){_0x1d1f66[_0x1ea8('0x1c')]=_0x37af09[_0x1ea8('0x46')];}var _0x2bada5=util[_0x1ea8('0x33')](_0x1ea8('0x47'),_0x1d2530[_0x1ea8('0x3e')],_0x5e2415[_0x1ea8('0x48')],md5(_0x5e2415[_0x1ea8('0x48')]));if(_0x37c61c&&_0x37c61c[_0x1ea8('0x49')]){logger['info']('[QUEUE]',_0x1ea8('0x4a'));_0x5e2415['recordingURL']=_0x2bada5;}else if(_0x1607ec&&_0x1607ec[_0x1ea8('0x4b')]&&_0x1607ec[_0x1ea8('0x4b')]!==_0x1ea8('0x4c')){logger[_0x1ea8('0xe')](_0x1ea8('0x4d'),_0x1ea8('0x4a'));_0x5e2415[_0x1ea8('0x4e')]=_0x2bada5;}else{_0x5e2415[_0x1ea8('0x4e')]='';}return getAdminId(_0x1d1f66,_0x1d4e1e,_0x127de7,_0x5dad4c)[_0x1ea8('0x10')](getUser(_0x1d4e1e,_0x127de7,_0x5dad4c))[_0x1ea8('0x10')](getEndUser(_0x1d4e1e,_0x127de7,_0x5dad4c))[_0x1ea8('0x10')](getTicket(_0x1d4e1e,_0x127de7,_0x5dad4c,_0x1a832a,_0x5e2415))['then'](function(_0x3e337c){logger[_0x1ea8('0xe')](util['format'](_0x1ea8('0x4f'),_0x3e337c[_0x1ea8('0x35')]));if(_0x1d4e1e!==_0x1ea8('0x45')){logger['info']('['+[_0x1d4e1e[_0x1ea8('0x17')]()]+']',_0x1ea8('0x50'));emit(_0x5dad4c,_0x37af09['name'],_0x3e337c[_0x1ea8('0x27')]);}})[_0x1ea8('0x16')](function(_0x3fca13){logger['error']('['+[_0x1d4e1e[_0x1ea8('0x17')]()]+_0x1ea8('0x51'),util[_0x1ea8('0x52')](_0x3fca13,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaeab=['email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length'];(function(_0x5ce17e,_0xb0b208){var _0x6e971c=function(_0x441b8f){while(--_0x441b8f){_0x5ce17e['push'](_0x5ce17e['shift']());}};_0x6e971c(++_0xb0b208);}(_0xaeab,0x91));var _0xbaea=function(_0x584177,_0x46e23b){_0x584177=_0x584177-0x0;var _0x57f394=_0xaeab[_0x584177];return _0x57f394;};'use strict';var _=require(_0xbaea('0x0'));var rp=require('request-promise');var md5=require(_0xbaea('0x1'));var util=require('util');var moment=require(_0xbaea('0x2'));var Promise=require(_0xbaea('0x3'));var Redis=require(_0xbaea('0x4'));var intUtil=require(_0xbaea('0x5'));var config=require(_0xbaea('0x6'));var logger=require(_0xbaea('0x7'))(_0xbaea('0x8'));config[_0xbaea('0x9')]=_[_0xbaea('0xa')](config[_0xbaea('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbaea('0xb'))(new Redis(config[_0xbaea('0x9')]));function getAdminId(_0x202d96,_0x2136d5,_0x1340c7,_0x1031ad){return new Promise(function(_0x1439b0,_0x1ac9ba){var _0x57f8c1=![];var _0x1a7cde={'method':_0xbaea('0xc'),'uri':_0x1031ad+_0xbaea('0xd'),'json':!![]};_0x1a7cde[_0xbaea('0xe')]=_0x1340c7;logger[_0xbaea('0xf')]('Getting\x20admin\x20information');return rp(_0x1a7cde)[_0xbaea('0x10')](function(_0x264a7e){if(_0x264a7e){var _0x4c7215=_0x264a7e[_0xbaea('0x11')];var _0x3d85f5=null;for(_0x3d85f5=0x0;_0x3d85f5<_0x4c7215[_0xbaea('0x12')];_0x3d85f5++){if(_0x4c7215[_0x3d85f5][_0xbaea('0x13')]===_0x202d96[_0xbaea('0x14')]){_0x202d96[_0xbaea('0x15')]=_0x4c7215[_0x3d85f5]['id'];_0x57f8c1=!![];}}if(_0x57f8c1){logger['info']('Admin\x20found:',_0x202d96[_0xbaea('0x15')]);_0x1439b0(_0x202d96);}else{_0x1ac9ba({'statusCode':0x194,'message':_0xbaea('0x16')});}}else{_0x1ac9ba({'statusCode':0x194,'message':_0xbaea('0x16')});}})[_0xbaea('0x17')](function(_0x3c7ee7){logger['error']('['+[_0x2136d5['toUpperCase']()]+']',_0x3c7ee7[_0xbaea('0x18')]);_0x1ac9ba(_0x3c7ee7);});});}function getUser(_0x18c259,_0x550e66,_0xd90639){return function(_0x385382){return new Promise(function(_0x28e71c,_0x20078e){var _0x33fa58={'method':_0xbaea('0xc'),'uri':_0xd90639+'/api/selector/owners','json':!![]};_0x33fa58['headers']=_0x550e66;logger['info']('Getting\x20user\x20list');return rp(_0x33fa58)[_0xbaea('0x10')](function(_0x258498){if(_0x258498){var _0x114b7f=_0x258498[_0xbaea('0x11')];var _0x1962d9=![];var _0x57adc2=null;if(_0x385382[_0xbaea('0x19')]!==null){logger[_0xbaea('0xf')](_0xbaea('0x1a'),_0x385382[_0xbaea('0x19')]);_0x385382[_0xbaea('0x1b')]=_0x385382[_0xbaea('0x19')];for(_0x57adc2=0x0;_0x57adc2<_0x114b7f[_0xbaea('0x12')];_0x57adc2++){if(_0x114b7f[_0x57adc2][_0xbaea('0x13')]===_0x385382['agentEmail']){_0x1962d9=!![];_0x385382[_0xbaea('0x1c')]=_0x114b7f[_0x57adc2]['id'];logger['info'](_0xbaea('0x1d'),_0x385382[_0xbaea('0x1c')]);}}}if(!_0x1962d9){logger['info']('Admin\x20selected');_0x385382['userEmail']=_0x385382[_0xbaea('0x14')];_0x385382[_0xbaea('0x1c')]=_0x385382[_0xbaea('0x15')];_0x1962d9=!![];}if(_0x1962d9){_0x28e71c(_0x385382);}else{_0x20078e({'statusCode':0x194,'message':_0xbaea('0x16')});}}else{_0x20078e({'statusCode':0x194,'message':_0xbaea('0x16')});}})[_0xbaea('0x17')](function(_0x5c8e10){logger[_0xbaea('0x1e')]('['+[_0x18c259[_0xbaea('0x1f')]()]+']',_0x5c8e10['message']);_0x20078e(_0x5c8e10);});});};}function searchContact(_0x2785bb,_0x2378f8,_0x8566e8,_0x35db11){return new Promise(function(_0x2ad9c9,_0x2228c){var _0x86d381={'method':_0xbaea('0xc'),'headers':_0x2378f8,'uri':_0x2785bb+_0xbaea('0x20')+_0x35db11+_0xbaea('0x21')+_0x8566e8+_0xbaea('0x22'),'json':!![]};rp(_0x86d381)[_0xbaea('0x10')](function(_0x538112){var _0x2c3048=_[_0xbaea('0x23')](_0x538112[_0xbaea('0x24')][_0xbaea('0x24')],[_0x8566e8,_0x35db11]);_0x2ad9c9(_0x2c3048);})[_0xbaea('0x17')](function(_0x1553aa){_0x2228c(_0x1553aa);});});}function getEndUser(_0x4bb167,_0x2ec083,_0x47b18b){return function(_0x120b6a){return new Promise(function(_0xc6c0d,_0x44d4d4){logger[_0xbaea('0xf')](util[_0xbaea('0x25')](_0xbaea('0x26'),_0x120b6a[_0xbaea('0x27')]));searchContact(_0x47b18b,_0x2ec083,_0xbaea('0x28'),_0x120b6a[_0xbaea('0x27')])[_0xbaea('0x10')](function(_0x2bfff6){if(_0x2bfff6){_0x120b6a[_0xbaea('0x29')]=_0x2bfff6['id'];logger[_0xbaea('0xf')]('Contact\x20found\x20mobile_number:',_0x120b6a[_0xbaea('0x29')]);return _0xc6c0d(_0x120b6a);}searchContact(_0x47b18b,_0x2ec083,'work_number',_0x120b6a[_0xbaea('0x27')])[_0xbaea('0x10')](function(_0x4ed438){if(_0x4ed438){_0x120b6a[_0xbaea('0x29')]=_0x4ed438['id'];logger[_0xbaea('0xf')]('Contact\x20found\x20work_number:',_0x120b6a['endUserId']);return _0xc6c0d(_0x120b6a);}createEndUser(_0x120b6a,_0x4bb167,_0x2ec083,_0x47b18b)[_0xbaea('0x10')](function(_0x2b639d){logger[_0xbaea('0xf')](_0xbaea('0x2a'),_0x2b639d[_0xbaea('0x29')]);return _0xc6c0d(_0x2b639d);});});})[_0xbaea('0x17')](function(_0x55b8f8){_0x44d4d4(_0x55b8f8);});});};}function createEndUser(_0x5abda6,_0x6cc624,_0x14a3dd,_0x3a672f){return new Promise(function(_0x37b765,_0x7bd5af){var _0x58f138=moment();var _0x248b85={'method':_0xbaea('0x2b'),'uri':_0x3a672f+_0xbaea('0x2c'),'body':{'contact':{'last_name':_0x5abda6['contactNumber'],'work_number':_0x5abda6[_0xbaea('0x27')],'mobile_number':_0x5abda6[_0xbaea('0x27')],'owner_id':_0x5abda6[_0xbaea('0x1c')],'created_at':_0x58f138[_0xbaea('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x248b85[_0xbaea('0xe')]=_0x14a3dd;logger[_0xbaea('0xf')](_0xbaea('0x2d'));return rp(_0x248b85)[_0xbaea('0x10')](function(_0x526928){_0x5abda6[_0xbaea('0x29')]=_0x526928[_0xbaea('0x2e')]['id'];_0x37b765(_0x5abda6);})[_0xbaea('0x17')](function(_0x5925e1){logger[_0xbaea('0x1e')]('['+[_0x6cc624[_0xbaea('0x1f')]()]+']',_0x5925e1[_0xbaea('0x18')]);_0x7bd5af(_0x5925e1[_0xbaea('0x18')]);});});}function getTicket(_0x33b350,_0xfb2c85,_0x4efba4,_0x3703c9,_0x4ca155){return function(_0x100a5a){logger[_0xbaea('0xf')](_0xbaea('0x2f'));return new Promise(function(_0x3a60de,_0x126e4f){var _0x3b3ba7=moment();var _0x3b147c={'method':'POST','uri':_0x4efba4+_0xbaea('0x30'),'body':{'title':intUtil[_0xbaea('0x31')](_0x3703c9['Subjects'],_0x4ca155,'\x20'),'description':intUtil['getString'](_0x3703c9[_0xbaea('0x32')],_0x4ca155,'\x0a'),'owner_id':_0x100a5a[_0xbaea('0x1c')],'creater_id':_0x100a5a[_0xbaea('0x15')],'targetable_id':_0x100a5a[_0xbaea('0x29')],'targetable_type':_0xbaea('0x33'),'created_at':_0x3b3ba7[_0xbaea('0x25')](_0xbaea('0x34')),'due_date':_0x3b3ba7[_0xbaea('0x35')](0x1e,'m')[_0xbaea('0x25')](_0xbaea('0x34'))},'json':!![]};_0x3b147c[_0xbaea('0xe')]=_0xfb2c85;return rp(_0x3b147c)[_0xbaea('0x10')](function(_0x452a31){_0x100a5a[_0xbaea('0x36')]=_0x452a31['task']['id'];logger[_0xbaea('0xf')]('Task\x20created:',_0x100a5a['ticketId']);_0x3a60de(_0x100a5a);})[_0xbaea('0x17')](function(_0x574028){logger['error']('['+[_0x33b350['toUpperCase']()]+']',_0x574028[_0xbaea('0x18')]);_0x126e4f(_0x574028[_0xbaea('0x18')]);});});};}function emit(_0x464736,_0x3096e9,_0x39c2d4){var _0xc9f3a1={'uri':_0x464736+_0xbaea('0x37')+_0x39c2d4};io['to'](util[_0xbaea('0x25')](_0xbaea('0x38'),_0x3096e9))[_0xbaea('0x39')](_0xbaea('0x3a'),_0xc9f3a1);}exports['cs']=function(_0x52c096,_0x25e385,_0x1808f0,_0x98de1f,_0x3a393c,_0x2b6fa1,_0x16382a,_0x5e1efe){var _0x5f2e8d={};var _0x412595={'Authorization':_0xbaea('0x3b')+_0x2b6fa1[_0xbaea('0x3c')]};_0x2b6fa1[_0xbaea('0x3d')]=intUtil[_0xbaea('0x3e')](_0x2b6fa1[_0xbaea('0x3d')]);_0x2b6fa1[_0xbaea('0x3f')]=intUtil[_0xbaea('0x3e')](_0x2b6fa1['serverUrl']);var _0x32c96c=_0x2b6fa1[_0xbaea('0x3d')];_0x5f2e8d[_0xbaea('0x14')]=_0x2b6fa1['username'];_0x5f2e8d[_0xbaea('0x27')]=_0x5e1efe['toLowerCase']()===_0xbaea('0x40')?_0x25e385[_0xbaea('0x41')]:_0x25e385[_0xbaea('0x42')];_0x5f2e8d[_0xbaea('0x43')]=_0x5e1efe===_0xbaea('0x44')||_0x5e1efe==='unmanaged'?_0xbaea('0x44'):_0xbaea('0x40');if(_0x98de1f){_0x5f2e8d[_0xbaea('0x19')]=_0x98de1f['email'];}var _0x22d609=util[_0xbaea('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b6fa1['serverUrl'],_0x25e385[_0xbaea('0x45')],md5(_0x25e385[_0xbaea('0x45')]));if(_0x3a393c&&_0x3a393c[_0xbaea('0x46')]){logger[_0xbaea('0xf')](_0xbaea('0x47'),_0xbaea('0x48'));_0x25e385['recordingURL']=_0x22d609;}else if(_0x16382a&&_0x16382a[_0xbaea('0x49')]&&_0x16382a[_0xbaea('0x49')]!==_0xbaea('0x4a')){logger[_0xbaea('0xf')](_0xbaea('0x4b'),_0xbaea('0x48'));_0x25e385['recordingURL']=_0x22d609;}else{_0x25e385[_0xbaea('0x4c')]='';}return getAdminId(_0x5f2e8d,_0x5e1efe,_0x412595,_0x32c96c)[_0xbaea('0x10')](getUser(_0x5e1efe,_0x412595,_0x32c96c))[_0xbaea('0x10')](getEndUser(_0x5e1efe,_0x412595,_0x32c96c))[_0xbaea('0x10')](getTicket(_0x5e1efe,_0x412595,_0x32c96c,_0x1808f0,_0x25e385))[_0xbaea('0x10')](function(_0x53ec05){logger[_0xbaea('0xf')](util[_0xbaea('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x53ec05[_0xbaea('0x36')]));if(_0x5e1efe!==_0xbaea('0x4d')){logger['info']('['+[_0x5e1efe[_0xbaea('0x1f')]()]+']',_0xbaea('0x4e'));emit(_0x32c96c,_0x98de1f[_0xbaea('0x4f')],_0x53ec05[_0xbaea('0x29')]);}})['catch'](function(_0x3fce94){logger[_0xbaea('0x1e')]('['+[_0x5e1efe[_0xbaea('0x1f')]()]+_0xbaea('0x50'),util[_0xbaea('0x51')](_0x3fce94,{'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 93e3496..9c00897 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 _0x3266=['salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','freshdesk','desk','log','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk'];(function(_0x3bb954,_0x5173dd){var _0x3d96a3=function(_0x16688c){while(--_0x16688c){_0x3bb954['push'](_0x3bb954['shift']());}};_0x3d96a3(++_0x5173dd);}(_0x3266,0x6a));var _0x6326=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x3266[_0x237546];return _0x233e29;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var zendesk=require(_0x6326('0x2'));var salesforce=require(_0x6326('0x3'));var sugarcrm=require(_0x6326('0x4'));var freshdesk=require(_0x6326('0x5'));var zoho=require(_0x6326('0x6'));var desk=require(_0x6326('0x7'));var vtiger=require(_0x6326('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x6326('0x9'));var freshsales=require('./freshsales');var integrations=[_0x6326('0xa'),_0x6326('0xb'),_0x6326('0xc'),'freshdesk',_0x6326('0xd'),'desk',_0x6326('0xe'),_0x6326('0xf'),_0x6326('0x10'),_0x6326('0x11')];exports[_0x6326('0x12')]=function(_0x53c3e1,_0x1b45a7,_0x464a36,_0x3590ab,_0x1e6909,_0x416844){if(_0x464a36){if(_[_0x6326('0x13')](integrations,_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]())){try{var _0x40a68a=null;var _0x379358='';var _0x5c07e1=_0x464a36[_0x53c3e1['data1'][_0x6326('0x15')]()];if(_0x5c07e1){var _0x136946=_0x5c07e1[_0x53c3e1['data2']];if(_0x136946){var _0x425878=_['find'](_0x136946[_0x6326('0x16')],{'id':parseInt(_0x53c3e1[_0x6326('0x17')],0xa)});if(_0x425878){if(_0x3590ab){if(_0x1e6909&&_0x1b45a7[_0x6326('0x18')]){_0x379358=_0x6326('0x18');}else if(_0x1b45a7[_0x6326('0x19')]){_0x379358=_0x6326('0x1a');}else{console['log'](_0x6326('0x1b'),_0x1b45a7);}}else{_0x379358='unmanaged';}switch(_0x53c3e1['data1']['toLowerCase']()){case'zendesk':zendesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'salesforce':salesforce[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'sugarcrm':sugarcrm[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1c'):freshdesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0xd'):zoho[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1d'):desk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'vtiger':vtiger[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'freshsales':freshsales['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0x11'):servicenow['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0xf'):dynamics365['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;default:console[_0x6326('0x1e')](_0x6326('0x1f'));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a['error'](_0x6326('0x21'),util['format'](_0x6326('0x22'),_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x17')]));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a[_0x6326('0x23')](_0x6326('0x21'),util[_0x6326('0x24')](_0x6326('0x25'),_0x53c3e1['data1'][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x26')]));}}else{}}catch(_0x575701){console['error'](_0x575701);}}}}; \ No newline at end of file +var _0x8f4c=['zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','unmanaged','zendesk','salesforce','sugarcrm'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3be379,_0x3b33cf){_0x3be379=_0x3be379-0x0;var _0xf389d=_0x8f4c[_0x3be379];return _0xf389d;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var zendesk=require(_0xc8f4('0x2'));var salesforce=require(_0xc8f4('0x3'));var sugarcrm=require(_0xc8f4('0x4'));var freshdesk=require(_0xc8f4('0x5'));var zoho=require('./zoho');var desk=require(_0xc8f4('0x6'));var vtiger=require(_0xc8f4('0x7'));var servicenow=require(_0xc8f4('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc8f4('0x9'));var integrations=['zendesk','salesforce','sugarcrm',_0xc8f4('0xa'),'zoho',_0xc8f4('0xb'),_0xc8f4('0xc'),_0xc8f4('0xd'),_0xc8f4('0xe'),_0xc8f4('0xf')];exports['exec']=function(_0x38c41b,_0x191b92,_0x2fba62,_0x3a2f8a,_0x4fd453,_0x26f83){if(_0x2fba62){if(_['includes'](integrations,_0x38c41b[_0xc8f4('0x10')][_0xc8f4('0x11')]())){try{var _0x45ed6b=null;var _0x729f8f='';var _0x39b785=_0x2fba62[_0x38c41b['data1'][_0xc8f4('0x11')]()];if(_0x39b785){var _0x377c2b=_0x39b785[_0x38c41b[_0xc8f4('0x12')]];if(_0x377c2b){var _0x14bc11=_[_0xc8f4('0x13')](_0x377c2b[_0xc8f4('0x14')],{'id':parseInt(_0x38c41b['data3'],0xa)});if(_0x14bc11){if(_0x3a2f8a){if(_0x4fd453&&_0x191b92[_0xc8f4('0x15')]){_0x729f8f=_0xc8f4('0x15');}else if(_0x191b92[_0xc8f4('0x16')]){_0x729f8f=_0xc8f4('0x17');}else{console[_0xc8f4('0x18')]('EVENT\x20UNKNOWN',_0x191b92);}}else{_0x729f8f=_0xc8f4('0x19');}switch(_0x38c41b['data1']['toLowerCase']()){case _0xc8f4('0x1a'):zendesk[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0x1b'):salesforce[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0x1c'):sugarcrm[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xa'):freshdesk[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0x1d'):zoho[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xb'):desk[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xc'):vtiger[_0x729f8f](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83);break;case _0xc8f4('0xe'):freshsales['cs'](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83,_0x729f8f);break;case _0xc8f4('0xf'):servicenow['cs'](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83,_0x729f8f);break;case _0xc8f4('0xd'):dynamics365['cs'](_0x38c41b,_0x191b92,_0x14bc11,_0x3a2f8a,_0x4fd453,_0x377c2b,_0x26f83,_0x729f8f);break;default:console[_0xc8f4('0x18')](_0xc8f4('0x1e'));}}else{_0x45ed6b=require(_0xc8f4('0x1f'))(_0x38c41b['data1'][_0xc8f4('0x11')]());_0x45ed6b[_0xc8f4('0x20')](_0xc8f4('0x21'),util[_0xc8f4('0x22')](_0xc8f4('0x23'),_0x38c41b[_0xc8f4('0x10')][_0xc8f4('0x11')](),_0x38c41b[_0xc8f4('0x24')]));}}else{_0x45ed6b=require('../../../../config/logger')(_0x38c41b[_0xc8f4('0x10')][_0xc8f4('0x11')]());_0x45ed6b[_0xc8f4('0x20')](_0xc8f4('0x21'),util['format'](_0xc8f4('0x25'),_0x38c41b['data1'][_0xc8f4('0x11')](),_0x38c41b['data2']));}}else{}}catch(_0x177a44){console[_0xc8f4('0x20')](_0x177a44);}}}}; \ 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 c63a392..9f14eb5 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 _0xa99d=['forEach','type','string','idField','content','toString','variable','variableName','customVariable','name','Variable','toLowerCase','password','concat','securityToken','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','isNil','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','validateEmail','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','Contact','Lead','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst'];(function(_0x464047,_0x406cbd){var _0x906907=function(_0x4fb8d3){while(--_0x4fb8d3){_0x464047['push'](_0x464047['shift']());}};_0x906907(++_0x406cbd);}(_0xa99d,0x123));var _0xda99=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0xa99d[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0xda99('0x0'));var rp=require(_0xda99('0x1'));var moment=require('moment');var BPromise=require(_0xda99('0x2'));var md5=require(_0xda99('0x3'));var jsforce=require('jsforce');var util=require(_0xda99('0x4'));var Redis=require(_0xda99('0x5'));var intUtil=require(_0xda99('0x6'));var config=require(_0xda99('0x7'));var logger=require(_0xda99('0x8'))(_0xda99('0x9'));config[_0xda99('0xa')]=_[_0xda99('0xb')](config[_0xda99('0xa')],{'host':_0xda99('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda99('0xa')]));function emit(_0x4b95e2,_0x218672,_0x10f1cd){io['to'](_0x4b95e2)[_0xda99('0xd')](_0x218672,_0x10f1cd);}function getTicket(_0x5bd05b,_0x4b1f9f,_0x4ce624,_0x10014b,_0x22cd58,_0x28a8be,_0x7fcd0a,_0x3ec2cb){var _0x50631f={};if(_0x10014b[_0xda99('0xe')]===_0xda99('0xf')){_0x50631f=Object[_0xda99('0x10')]({},{'OwnerId':_0x4b1f9f['id'],'ActivityDate':moment[_0xda99('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xda99('0x12')](_0x10014b[_0xda99('0x13')],_0x22cd58,'\x20'),'Description':intUtil[_0xda99('0x12')](_0x10014b[_0xda99('0x14')],_0x22cd58,'\x0a')},getCustomFields(_0x28a8be,_0x22cd58));if(_0x4ce624){_0x50631f[_0xda99('0x15')]=_0x4ce624['id'];}}else if(_0x10014b[_0xda99('0xe')]===_0xda99('0x16')){_0x50631f=Object[_0xda99('0x10')]({},{'OwnerId':_0x4b1f9f['id'],'Subject':intUtil[_0xda99('0x12')](_0x10014b[_0xda99('0x13')],_0x22cd58,'\x20'),'Description':intUtil[_0xda99('0x12')](_0x10014b['Descriptions'],_0x22cd58,'\x0a')},getCustomFields(_0x28a8be,_0x22cd58));if(_0x4ce624){_0x50631f[_0xda99('0x17')]=_0x4ce624['id'];}}return _0x7fcd0a[_0xda99('0x18')](_0x10014b['ticketType'])[_0xda99('0x19')](_0x50631f);}function getUser(_0x3485aa,_0x15c62f,_0x1e32ac){if(!_['isNil'](_0x15c62f)&&intUtil[_0xda99('0x1a')](_0x15c62f)){var _0x24193d={'Email':_0x15c62f};var _0x5b69d3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1e32ac[_0xda99('0x18')](_0xda99('0x1b'))[_0xda99('0x1c')](_0x24193d,_0x5b69d3)[_0xda99('0x1d')]()[_0xda99('0x1e')](function(_0x118dc8){if(_0x118dc8[_0xda99('0x1f')]){var _0x8274b1=_['find'](_0x118dc8,function(_0x56dd2e){return _0x56dd2e[_0xda99('0x20')]===_0x15c62f;});if(_0x8274b1){logger[_0xda99('0x21')](_0xda99('0x22'),_0x15c62f);return BPromise[_0xda99('0x23')]({'id':_0x8274b1['Id'],'name':_0x8274b1[_0xda99('0x24')]});}}else{logger[_0xda99('0x21')](_0xda99('0x25'),_0x15c62f);return _0x1e32ac[_0xda99('0x26')]()[_0xda99('0x1e')](function(_0x1e58da){return BPromise[_0xda99('0x23')]({'id':_0x1e58da[_0xda99('0x27')],'name':_0x1e58da['display_name']});});}});}else{logger[_0xda99('0x21')](_0xda99('0x25'),_0x15c62f);return _0x1e32ac[_0xda99('0x26')]()[_0xda99('0x1e')](function(_0x379281){return BPromise['resolve']({'id':_0x379281[_0xda99('0x27')],'name':_0x379281[_0xda99('0x28')]});});}}function getEndUser(_0x27ef1c,_0x387a17,_0x33573b,_0x5863d0,_0x57d6a3){var _0x1cc98f={'Phone':_0x5863d0};var _0x3ad338={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xda99('0x23')]()[_0xda99('0x1e')](function(){if(_0x387a17['ticketType']==='Task'){logger[_0xda99('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5863d0,_0x387a17[_0xda99('0x29')]);switch(_0x387a17['moduleSearch']){case _0xda99('0x2a'):return _0x57d6a3['sobject'](_0xda99('0x2b'))['find'](_0x1cc98f,_0x3ad338)[_0xda99('0x1d')]()[_0xda99('0x1e')](function(_0x2bdcba){if(_0x2bdcba&&_0x2bdcba[_0xda99('0x1f')]){return _0x2bdcba;}else{return _0x57d6a3[_0xda99('0x18')](_0xda99('0x2c'))[_0xda99('0x1c')](_0x1cc98f,_0x3ad338);}});case'contact':return _0x57d6a3[_0xda99('0x18')]('Contact')[_0xda99('0x1c')](_0x1cc98f,_0x3ad338)[_0xda99('0x1d')]();case _0xda99('0x2d'):return _0x57d6a3[_0xda99('0x18')](_0xda99('0x2c'))[_0xda99('0x1c')](_0x1cc98f,_0x3ad338);default:return null;}}else if(_0x387a17[_0xda99('0xe')]===_0xda99('0x16')){logger[_0xda99('0x21')](_0xda99('0x2e'),_0x5863d0,_0xda99('0x2f'));return _0x57d6a3[_0xda99('0x18')](_0xda99('0x2b'))['find'](_0x1cc98f,_0x3ad338)[_0xda99('0x1d')]();}})['then'](function(_0x4a9b09){if(_0x4a9b09&&_0x4a9b09[_0xda99('0x1f')]){var _0x2c726e=_[_0xda99('0x1c')](_0x4a9b09,function(_0x3f3c2b){return _0x3f3c2b[_0xda99('0x30')]===_0x5863d0;});if(_0x2c726e){return BPromise[_0xda99('0x23')]({'id':_0x2c726e['Id'],'name':_0x2c726e[_0xda99('0x24')],'phone':_0x2c726e[_0xda99('0x30')]});}}})[_0xda99('0x1e')](function(_0x6498d6){if(_0x6498d6){logger[_0xda99('0x21')](_0xda99('0x31'),_0x5863d0);return BPromise[_0xda99('0x23')](_0x6498d6);}else{logger[_0xda99('0x21')](_0xda99('0x32'),_0x5863d0);var _0x235787={'LastName':_0x33573b!==''?_0x33573b:util[_0xda99('0x33')]('Caller\x20-\x20%s',_0x5863d0),'Phone':_0x5863d0};if(_0x387a17[_0xda99('0x34')]){if(_0x387a17['moduleCreate']===_0xda99('0x2f')){logger[_0xda99('0x21')](_0xda99('0x35'),_0x5863d0,_0x387a17[_0xda99('0x34')]);}else if(_0x387a17['moduleCreate']==='lead'&&_0x387a17[_0xda99('0xe')]===_0xda99('0xf')){logger[_0xda99('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5863d0,_0x387a17[_0xda99('0x34')]);_0x235787[_0xda99('0x36')]=_0xda99('0x37');}else{return null;}}return _0x57d6a3['sobject'](_[_0xda99('0x38')](_0x387a17['moduleCreate']))[_0xda99('0x19')](_0x235787);}});}function getCustomFields(_0x255bef,_0x2fc95d){var _0x39ca72={};if(_0x255bef[_0xda99('0x1f')]>0x0){_[_0xda99('0x39')](_0x255bef,function(_0x1be3db){if(_0x1be3db[_0xda99('0x3a')]===_0xda99('0x3b')&&_0x1be3db[_0xda99('0x3c')]){_0x39ca72[_0x1be3db[_0xda99('0x3c')]]=_0x1be3db[_0xda99('0x3d')][_0xda99('0x3e')]();}else if(_0x1be3db['type']===_0xda99('0x3f')&&_0x1be3db[_0xda99('0x40')]&&_0x1be3db[_0xda99('0x3c')]){_0x2fc95d[_0x1be3db[_0xda99('0x40')]]&&(_0x39ca72[_0x1be3db[_0xda99('0x3c')]]=_0x2fc95d[_0x1be3db[_0xda99('0x40')]]['toString']());}else if(_0x1be3db[_0xda99('0x3a')]===_0xda99('0x41')&&_0x1be3db['Variable']&&_0x1be3db['Variable'][_0xda99('0x42')]&&_0x1be3db[_0xda99('0x3c')]){_0x2fc95d[_0x1be3db[_0xda99('0x43')][_0xda99('0x42')][_0xda99('0x44')]()]&&(_0x39ca72[_0x1be3db[_0xda99('0x3c')]]=_0x2fc95d[_0x1be3db[_0xda99('0x43')][_0xda99('0x42')][_0xda99('0x44')]()][_0xda99('0x3e')]());}});}return _0x39ca72;}function getConnection(_0x244fce){var _0x2d4ac7=_0x244fce[_0xda99('0x45')][_0xda99('0x46')](_0x244fce[_0xda99('0x47')]);var _0x5f1caf=new jsforce['Connection']({'oauth2':{'loginUrl':_0x244fce['remoteUri']||'https://login.salesforce.com','clientId':_0x244fce[_0xda99('0x48')],'clientSecret':_0x244fce[_0xda99('0x49')]}});return _0x5f1caf[_0xda99('0x4a')](_0x244fce[_0xda99('0x4b')],_0x2d4ac7)['then'](function(){logger['info'](_0xda99('0x4c'));return _0x5f1caf;});}exports[_0xda99('0x4d')]=function(_0x1a1d13,_0x2f4181,_0x1ec581,_0x29db5e,_0x698533,_0x18dcb4){var _0x461f76,_0x3bae2c,_0x37ce62,_0x27debb;_0x18dcb4[_0xda99('0x4e')]=intUtil['stripTrailingSlash'](_0x18dcb4['serverUrl']);_0x18dcb4[_0xda99('0x4f')]=intUtil[_0xda99('0x50')](_0x18dcb4[_0xda99('0x4f')]);if(_0x698533&&_0x698533[_0xda99('0x51')]){logger['info'](_0xda99('0x52'),'Recording\x20is\x20enabled!');_0x2f4181['recordingURL']=util[_0xda99('0x33')](_0xda99('0x53'),_0x18dcb4[_0xda99('0x4e')],_0x2f4181[_0xda99('0x54')],md5(_0x2f4181[_0xda99('0x54')]));}else{_0x2f4181[_0xda99('0x55')]='';}return getConnection(_0x18dcb4)[_0xda99('0x1e')](function(_0x33a291){_0x27debb=_0x33a291;return getUser(_0x18dcb4,_0x29db5e[_0xda99('0x56')],_0x27debb);})[_0xda99('0x1e')](function(_0x28a493){_0x461f76=_0x28a493;return getEndUser(_0x18dcb4,_0x1ec581,_0x2f4181['calleridname'],_0x2f4181[_0xda99('0x57')],_0x27debb);})[_0xda99('0x1e')](function(_0x387764){_0x3bae2c=_0x387764;return getTicket(_0x18dcb4,_0x461f76,_0x3bae2c,_0x1ec581,_0x2f4181,_0x1ec581[_0xda99('0x58')],_0x27debb,_0xda99('0x4d'));})[_0xda99('0x1e')](function(_0x335844){_0x37ce62=_0x335844;logger[_0xda99('0x21')](_0xda99('0x59'),_0x37ce62['id']);logger[_0xda99('0x21')](_0xda99('0x5a'),_0x37ce62['id'],_0x29db5e[_0xda99('0x42')],_0x18dcb4[_0xda99('0x3a')]);switch(_0x18dcb4[_0xda99('0x3a')]){case'integrationTab':emit(util['format']('user:%s',_0x29db5e[_0xda99('0x42')]),_0xda99('0x5b'),{'recordId':_0x37ce62['id']});break;case _0xda99('0x5c'):emit(util['format'](_0xda99('0x5d'),_0x29db5e[_0xda99('0x42')]),_0xda99('0x5e'),{'uri':util[_0xda99('0x33')](_0xda99('0x5f'),_0x27debb[_0xda99('0x60')],_0x37ce62['id'])});break;default:logger[_0xda99('0x61')](_0xda99('0x62'));}})[_0xda99('0x63')](function(_0x29b32c){logger[_0xda99('0x61')](_0xda99('0x52'),JSON[_0xda99('0x64')](_0x29b32c));});};exports['outbound']=function(_0x3622b7,_0x3930f1,_0x4604a8,_0x1a2610,_0xd5f6b8,_0x2c80ea,_0x53eb28){var _0x13eaf1,_0x1a7c3d,_0x4aefc3,_0x3a71da;_0x2c80ea[_0xda99('0x4e')]=intUtil[_0xda99('0x50')](_0x2c80ea['serverUrl']);_0x2c80ea[_0xda99('0x4f')]=intUtil[_0xda99('0x50')](_0x2c80ea['remoteUri']);if(_0x53eb28&&_0x53eb28[_0xda99('0x65')]&&_0x53eb28[_0xda99('0x65')]!==_0xda99('0x66')){logger[_0xda99('0x21')](_0xda99('0x67'),_0xda99('0x68'));_0x3930f1[_0xda99('0x55')]=util[_0xda99('0x33')](_0xda99('0x53'),_0x2c80ea['serverUrl'],_0x3930f1[_0xda99('0x54')],md5(_0x3930f1[_0xda99('0x54')]));}return getConnection(_0x2c80ea)[_0xda99('0x1e')](function(_0x28ab05){_0x3a71da=_0x28ab05;return getUser(_0x2c80ea,_0x1a2610[_0xda99('0x56')],_0x3a71da);})[_0xda99('0x1e')](function(_0x174cef){_0x13eaf1=_0x174cef;return getEndUser(_0x2c80ea,_0x4604a8,_0x3930f1[_0xda99('0x69')],_0x3930f1[_0xda99('0x6a')],_0x3a71da);})['then'](function(_0xe294b8){_0x1a7c3d=_0xe294b8;return getTicket(_0x2c80ea,_0x13eaf1,_0x1a7c3d,_0x4604a8,_0x3930f1,_0x4604a8[_0xda99('0x58')],_0x3a71da,_0xda99('0x6b'));})['then'](function(_0x12e26a){_0x4aefc3=_0x12e26a;logger['info'](_0xda99('0x6c'),_0x4aefc3['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4aefc3['id'],_0x1a2610['name'],_0x2c80ea[_0xda99('0x3a')]);switch(_0x2c80ea[_0xda99('0x3a')]){case _0xda99('0x6d'):emit(util[_0xda99('0x33')](_0xda99('0x5d'),_0x1a2610[_0xda99('0x42')]),'trigger:salesforce:display',{'recordId':_0x4aefc3['id']});break;case'newTab':emit(util['format']('user:%s',_0x1a2610[_0xda99('0x42')]),_0xda99('0x5e'),{'uri':util[_0xda99('0x33')](_0xda99('0x5f'),_0x3a71da['instanceUrl'],_0x4aefc3['id'])});break;default:logger[_0xda99('0x61')](_0xda99('0x67'),_0xda99('0x6e'));}})[_0xda99('0x63')](function(_0x21f70a){logger[_0xda99('0x61')]('[OUTBOUND]',JSON[_0xda99('0x64')](_0x21f70a));});};exports[_0xda99('0x6f')]=function(_0x14b815,_0x209974,_0x1c66e7,_0x66f10,_0xe2adbc,_0x298a42){var _0x1b20d6,_0x4e7016,_0xe3d7c6,_0x34660b;_0x298a42['serverUrl']=intUtil[_0xda99('0x50')](_0x298a42[_0xda99('0x4e')]);_0x298a42[_0xda99('0x4f')]=intUtil[_0xda99('0x50')](_0x298a42['remoteUri']);if(_0xe2adbc&&_0xe2adbc[_0xda99('0x51')]){logger[_0xda99('0x21')]('['+_0x209974['lastevent'][_0xda99('0x70')]()+']',_0xda99('0x68'));_0x209974[_0xda99('0x55')]=util[_0xda99('0x33')](_0xda99('0x53'),_0x298a42[_0xda99('0x4e')],_0x209974[_0xda99('0x54')],md5(_0x209974[_0xda99('0x54')]));}else{_0x209974['recordingURL']='';}return getConnection(_0x298a42)['then'](function(_0x18374d){_0x34660b=_0x18374d;if(!_[_0xda99('0x71')](_0x66f10)){return getUser(_0x298a42,_0x66f10[_0xda99('0x42')],_0x34660b);}else{return getUser(_0x298a42,null,_0x34660b);}})[_0xda99('0x1e')](function(_0x47c8fb){_0x1b20d6=_0x47c8fb;return getEndUser(_0x298a42,_0x1c66e7,_0x209974['calleridname'],_0x209974['calleridnum'],_0x34660b);})['then'](function(_0x421f8d){_0x4e7016=_0x421f8d;return getTicket(_0x298a42,_0x1b20d6,_0x4e7016,_0x1c66e7,_0x209974,_0x1c66e7['Fields'],_0x34660b);})['then'](function(_0x3596d2){_0xe3d7c6=_0x3596d2;logger[_0xda99('0x21')]('['+_0x209974['lastevent'][_0xda99('0x70')]()+']\x20Ticket\x20%s\x20created.',_0xe3d7c6['id']);logger[_0xda99('0x21')]('['+_0x209974[_0xda99('0x72')]['toUpperCase']()+_0xda99('0x73'),_0x298a42['type']);})['catch'](function(_0x387fd9){logger['error']('['+_0x209974[_0xda99('0x72')][_0xda99('0x70')]()+']',JSON[_0xda99('0x64')](_0x387fd9));});}; \ No newline at end of file +var _0xc330=['request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','ticketType','assign','utc','getString','Subjects','Descriptions','Case','sobject','create','isNil','validateEmail','find','execute','length','Email','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','resolve','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','format','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x3c12f5,_0x2dd4b9){var _0x40fcad=function(_0x46b9f6){while(--_0x46b9f6){_0x3c12f5['push'](_0x3c12f5['shift']());}};_0x40fcad(++_0x2dd4b9);}(_0xc330,0xe2));var _0x0c33=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc330[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var rp=require(_0x0c33('0x0'));var moment=require(_0x0c33('0x1'));var BPromise=require(_0x0c33('0x2'));var md5=require('md5');var jsforce=require(_0x0c33('0x3'));var util=require('util');var Redis=require(_0x0c33('0x4'));var intUtil=require(_0x0c33('0x5'));var config=require(_0x0c33('0x6'));var logger=require(_0x0c33('0x7'))(_0x0c33('0x8'));config[_0x0c33('0x9')]=_['defaults'](config[_0x0c33('0x9')],{'host':_0x0c33('0xa'),'port':0x18eb});var io=require(_0x0c33('0xb'))(new Redis(config[_0x0c33('0x9')]));function emit(_0x36ad9f,_0x4e15c3,_0x308e32){io['to'](_0x36ad9f)[_0x0c33('0xc')](_0x4e15c3,_0x308e32);}function getTicket(_0x1befd2,_0x3dde79,_0x5a6bae,_0x2bf539,_0x5ef6c5,_0x5d3384,_0x4a0e6d,_0x268146){var _0x2f1273={};if(_0x2bf539[_0x0c33('0xd')]==='Task'){_0x2f1273=Object[_0x0c33('0xe')]({},{'OwnerId':_0x3dde79['id'],'ActivityDate':moment[_0x0c33('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0c33('0x10')](_0x2bf539[_0x0c33('0x11')],_0x5ef6c5,'\x20'),'Description':intUtil[_0x0c33('0x10')](_0x2bf539[_0x0c33('0x12')],_0x5ef6c5,'\x0a')},getCustomFields(_0x5d3384,_0x5ef6c5));if(_0x5a6bae){_0x2f1273['WhoId']=_0x5a6bae['id'];}}else if(_0x2bf539[_0x0c33('0xd')]===_0x0c33('0x13')){_0x2f1273=Object[_0x0c33('0xe')]({},{'OwnerId':_0x3dde79['id'],'Subject':intUtil['getString'](_0x2bf539[_0x0c33('0x11')],_0x5ef6c5,'\x20'),'Description':intUtil['getString'](_0x2bf539[_0x0c33('0x12')],_0x5ef6c5,'\x0a')},getCustomFields(_0x5d3384,_0x5ef6c5));if(_0x5a6bae){_0x2f1273['ContactId']=_0x5a6bae['id'];}}return _0x4a0e6d[_0x0c33('0x14')](_0x2bf539[_0x0c33('0xd')])[_0x0c33('0x15')](_0x2f1273);}function getUser(_0x55e995,_0x329a51,_0x45cc69){if(!_[_0x0c33('0x16')](_0x329a51)&&intUtil[_0x0c33('0x17')](_0x329a51)){var _0x30c059={'Email':_0x329a51};var _0x34ae47={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x45cc69[_0x0c33('0x14')]('User')[_0x0c33('0x18')](_0x30c059,_0x34ae47)[_0x0c33('0x19')]()['then'](function(_0x55af0e){if(_0x55af0e[_0x0c33('0x1a')]){var _0x395bf0=_['find'](_0x55af0e,function(_0x49d80a){return _0x49d80a[_0x0c33('0x1b')]===_0x329a51;});if(_0x395bf0){logger['info']('Agent\x20%s\x20found.',_0x329a51);return BPromise['resolve']({'id':_0x395bf0['Id'],'name':_0x395bf0[_0x0c33('0x1c')]});}}else{logger[_0x0c33('0x1d')](_0x0c33('0x1e'),_0x329a51);return _0x45cc69[_0x0c33('0x1f')]()[_0x0c33('0x20')](function(_0x247b9b){return BPromise['resolve']({'id':_0x247b9b[_0x0c33('0x21')],'name':_0x247b9b['display_name']});});}});}else{logger['info'](_0x0c33('0x1e'),_0x329a51);return _0x45cc69[_0x0c33('0x1f')]()['then'](function(_0x2a28b7){return BPromise[_0x0c33('0x22')]({'id':_0x2a28b7[_0x0c33('0x21')],'name':_0x2a28b7['display_name']});});}}function getEndUser(_0x1d12a8,_0x6582b7,_0x2c6fd1,_0x1db6bf,_0x517fba){var _0x36280f={'Phone':_0x1db6bf};var _0x5e821f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x0c33('0x20')](function(){if(_0x6582b7[_0x0c33('0xd')]===_0x0c33('0x23')){logger[_0x0c33('0x1d')](_0x0c33('0x24'),_0x1db6bf,_0x6582b7[_0x0c33('0x25')]);switch(_0x6582b7['moduleSearch']){case _0x0c33('0x26'):return _0x517fba['sobject'](_0x0c33('0x27'))['find'](_0x36280f,_0x5e821f)[_0x0c33('0x19')]()[_0x0c33('0x20')](function(_0x1c4485){if(_0x1c4485&&_0x1c4485[_0x0c33('0x1a')]){return _0x1c4485;}else{return _0x517fba['sobject'](_0x0c33('0x28'))['find'](_0x36280f,_0x5e821f);}});case _0x0c33('0x29'):return _0x517fba['sobject'](_0x0c33('0x27'))['find'](_0x36280f,_0x5e821f)[_0x0c33('0x19')]();case _0x0c33('0x2a'):return _0x517fba[_0x0c33('0x14')](_0x0c33('0x28'))[_0x0c33('0x18')](_0x36280f,_0x5e821f);default:return null;}}else if(_0x6582b7['ticketType']==='Case'){logger['info'](_0x0c33('0x24'),_0x1db6bf,_0x0c33('0x29'));return _0x517fba['sobject'](_0x0c33('0x27'))[_0x0c33('0x18')](_0x36280f,_0x5e821f)[_0x0c33('0x19')]();}})['then'](function(_0x17d3b7){if(_0x17d3b7&&_0x17d3b7['length']){var _0x4c931b=_['find'](_0x17d3b7,function(_0x2aee1a){return _0x2aee1a['Phone']===_0x1db6bf;});if(_0x4c931b){return BPromise['resolve']({'id':_0x4c931b['Id'],'name':_0x4c931b[_0x0c33('0x1c')],'phone':_0x4c931b[_0x0c33('0x2b')]});}}})[_0x0c33('0x20')](function(_0x254d9a){if(_0x254d9a){logger[_0x0c33('0x1d')](_0x0c33('0x2c'),_0x1db6bf);return BPromise[_0x0c33('0x22')](_0x254d9a);}else{logger[_0x0c33('0x1d')](_0x0c33('0x2d'),_0x1db6bf);var _0x4c4740={'LastName':_0x2c6fd1!==_0x0c33('0x2e')?_0x2c6fd1:util['format'](_0x0c33('0x2f'),_0x1db6bf),'Phone':_0x1db6bf};if(_0x6582b7[_0x0c33('0x30')]){if(_0x6582b7['moduleCreate']===_0x0c33('0x29')){logger['info'](_0x0c33('0x31'),_0x1db6bf,_0x6582b7[_0x0c33('0x30')]);}else if(_0x6582b7['moduleCreate']===_0x0c33('0x2a')&&_0x6582b7['ticketType']===_0x0c33('0x23')){logger[_0x0c33('0x1d')](_0x0c33('0x31'),_0x1db6bf,_0x6582b7[_0x0c33('0x30')]);_0x4c4740[_0x0c33('0x32')]=_0x0c33('0x33');}else{return null;}}return _0x517fba[_0x0c33('0x14')](_[_0x0c33('0x34')](_0x6582b7[_0x0c33('0x30')]))[_0x0c33('0x15')](_0x4c4740);}});}function getCustomFields(_0x52e4b4,_0x197655){var _0xed2a93={};if(_0x52e4b4[_0x0c33('0x1a')]>0x0){_[_0x0c33('0x35')](_0x52e4b4,function(_0x5c9559){if(_0x5c9559['type']===_0x0c33('0x36')&&_0x5c9559[_0x0c33('0x37')]){_0xed2a93[_0x5c9559['idField']]=_0x5c9559[_0x0c33('0x38')]['toString']();}else if(_0x5c9559[_0x0c33('0x39')]===_0x0c33('0x3a')&&_0x5c9559['variableName']&&_0x5c9559[_0x0c33('0x37')]){_0x197655[_0x5c9559[_0x0c33('0x3b')]]&&(_0xed2a93[_0x5c9559[_0x0c33('0x37')]]=_0x197655[_0x5c9559[_0x0c33('0x3b')]][_0x0c33('0x3c')]());}else if(_0x5c9559[_0x0c33('0x39')]===_0x0c33('0x3d')&&_0x5c9559[_0x0c33('0x3e')]&&_0x5c9559['Variable'][_0x0c33('0x3f')]&&_0x5c9559[_0x0c33('0x37')]){_0x197655[_0x5c9559[_0x0c33('0x3e')]['name'][_0x0c33('0x40')]()]&&(_0xed2a93[_0x5c9559['idField']]=_0x197655[_0x5c9559[_0x0c33('0x3e')][_0x0c33('0x3f')][_0x0c33('0x40')]()][_0x0c33('0x3c')]());}});}return _0xed2a93;}function getConnection(_0x29a28c){var _0x289115=_0x29a28c[_0x0c33('0x41')][_0x0c33('0x42')](_0x29a28c[_0x0c33('0x43')]);var _0x858649=new jsforce[(_0x0c33('0x44'))]({'oauth2':{'loginUrl':_0x29a28c[_0x0c33('0x45')]||_0x0c33('0x46'),'clientId':_0x29a28c[_0x0c33('0x47')],'clientSecret':_0x29a28c[_0x0c33('0x48')]}});return _0x858649[_0x0c33('0x49')](_0x29a28c['username'],_0x289115)[_0x0c33('0x20')](function(){logger['info'](_0x0c33('0x4a'));return _0x858649;});}exports[_0x0c33('0x4b')]=function(_0x12b21a,_0x5628da,_0xdaf425,_0x1e5e0a,_0x5648a0,_0x4607c6){var _0x2c7e9e,_0xbf2660,_0x355488,_0x5a77d8;_0x4607c6[_0x0c33('0x4c')]=intUtil[_0x0c33('0x4d')](_0x4607c6[_0x0c33('0x4c')]);_0x4607c6[_0x0c33('0x45')]=intUtil[_0x0c33('0x4d')](_0x4607c6[_0x0c33('0x45')]);if(_0x5648a0&&_0x5648a0[_0x0c33('0x4e')]){logger[_0x0c33('0x1d')](_0x0c33('0x4f'),_0x0c33('0x50'));_0x5628da['recordingURL']=util[_0x0c33('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4607c6[_0x0c33('0x4c')],_0x5628da['uniqueid'],md5(_0x5628da[_0x0c33('0x52')]));}else{_0x5628da[_0x0c33('0x53')]='';}return getConnection(_0x4607c6)['then'](function(_0x5f34f0){_0x5a77d8=_0x5f34f0;return getUser(_0x4607c6,_0x1e5e0a[_0x0c33('0x54')],_0x5a77d8);})[_0x0c33('0x20')](function(_0x1649d6){_0x2c7e9e=_0x1649d6;return getEndUser(_0x4607c6,_0xdaf425,_0x5628da[_0x0c33('0x55')],_0x5628da[_0x0c33('0x56')],_0x5a77d8);})[_0x0c33('0x20')](function(_0xe71fb8){_0xbf2660=_0xe71fb8;return getTicket(_0x4607c6,_0x2c7e9e,_0xbf2660,_0xdaf425,_0x5628da,_0xdaf425[_0x0c33('0x57')],_0x5a77d8,_0x0c33('0x4b'));})[_0x0c33('0x20')](function(_0xe80642){_0x355488=_0xe80642;logger['info'](_0x0c33('0x58'),_0x355488['id']);logger[_0x0c33('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x355488['id'],_0x1e5e0a['name'],_0x4607c6[_0x0c33('0x39')]);switch(_0x4607c6[_0x0c33('0x39')]){case'integrationTab':emit(util[_0x0c33('0x51')](_0x0c33('0x59'),_0x1e5e0a[_0x0c33('0x3f')]),_0x0c33('0x5a'),{'recordId':_0x355488['id']});break;case _0x0c33('0x5b'):emit(util[_0x0c33('0x51')](_0x0c33('0x59'),_0x1e5e0a[_0x0c33('0x3f')]),_0x0c33('0x5c'),{'uri':util['format'](_0x0c33('0x5d'),_0x5a77d8[_0x0c33('0x5e')],_0x355488['id'])});break;default:logger[_0x0c33('0x5f')](_0x0c33('0x60'));}})[_0x0c33('0x61')](function(_0x5cdaa4){logger[_0x0c33('0x5f')](_0x0c33('0x4f'),JSON[_0x0c33('0x62')](_0x5cdaa4));});};exports[_0x0c33('0x63')]=function(_0x2b999c,_0x479851,_0x40f44b,_0x359fb1,_0x330fec,_0x36b63f,_0x1daa51){var _0x464654,_0x43eb4e,_0x3ebc4b,_0x3d474e;_0x36b63f[_0x0c33('0x4c')]=intUtil['stripTrailingSlash'](_0x36b63f['serverUrl']);_0x36b63f[_0x0c33('0x45')]=intUtil['stripTrailingSlash'](_0x36b63f[_0x0c33('0x45')]);if(_0x1daa51&&_0x1daa51[_0x0c33('0x64')]&&_0x1daa51[_0x0c33('0x64')]!==_0x0c33('0x65')){logger[_0x0c33('0x1d')](_0x0c33('0x66'),_0x0c33('0x50'));_0x479851[_0x0c33('0x53')]=util[_0x0c33('0x51')](_0x0c33('0x67'),_0x36b63f[_0x0c33('0x4c')],_0x479851[_0x0c33('0x52')],md5(_0x479851[_0x0c33('0x52')]));}return getConnection(_0x36b63f)[_0x0c33('0x20')](function(_0x5e9f90){_0x3d474e=_0x5e9f90;return getUser(_0x36b63f,_0x359fb1[_0x0c33('0x54')],_0x3d474e);})[_0x0c33('0x20')](function(_0x36a38c){_0x464654=_0x36a38c;return getEndUser(_0x36b63f,_0x40f44b,_0x479851[_0x0c33('0x68')],_0x479851['destcalleridnum'],_0x3d474e);})['then'](function(_0x2b4ff1){_0x43eb4e=_0x2b4ff1;return getTicket(_0x36b63f,_0x464654,_0x43eb4e,_0x40f44b,_0x479851,_0x40f44b[_0x0c33('0x57')],_0x3d474e,_0x0c33('0x63'));})[_0x0c33('0x20')](function(_0x187906){_0x3ebc4b=_0x187906;logger[_0x0c33('0x1d')](_0x0c33('0x69'),_0x3ebc4b['id']);logger[_0x0c33('0x1d')](_0x0c33('0x6a'),_0x3ebc4b['id'],_0x359fb1[_0x0c33('0x3f')],_0x36b63f['type']);switch(_0x36b63f[_0x0c33('0x39')]){case _0x0c33('0x6b'):emit(util['format'](_0x0c33('0x59'),_0x359fb1[_0x0c33('0x3f')]),'trigger:salesforce:display',{'recordId':_0x3ebc4b['id']});break;case _0x0c33('0x5b'):emit(util[_0x0c33('0x51')]('user:%s',_0x359fb1[_0x0c33('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0x0c33('0x5d'),_0x3d474e[_0x0c33('0x5e')],_0x3ebc4b['id'])});break;default:logger[_0x0c33('0x5f')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x18a34c){logger[_0x0c33('0x5f')](_0x0c33('0x66'),JSON[_0x0c33('0x62')](_0x18a34c));});};exports[_0x0c33('0x6c')]=function(_0x2de199,_0x28b3c0,_0x28c2ee,_0x1ea193,_0x5aed99,_0x20b5de){var _0x182441,_0x2b5312,_0x374234,_0x4b093e;_0x20b5de[_0x0c33('0x4c')]=intUtil[_0x0c33('0x4d')](_0x20b5de[_0x0c33('0x4c')]);_0x20b5de['remoteUri']=intUtil['stripTrailingSlash'](_0x20b5de['remoteUri']);if(_0x5aed99&&_0x5aed99[_0x0c33('0x4e')]){logger[_0x0c33('0x1d')]('['+_0x28b3c0[_0x0c33('0x6d')][_0x0c33('0x6e')]()+']',_0x0c33('0x50'));_0x28b3c0[_0x0c33('0x53')]=util[_0x0c33('0x51')](_0x0c33('0x67'),_0x20b5de[_0x0c33('0x4c')],_0x28b3c0[_0x0c33('0x52')],md5(_0x28b3c0[_0x0c33('0x52')]));}else{_0x28b3c0[_0x0c33('0x53')]='';}return getConnection(_0x20b5de)[_0x0c33('0x20')](function(_0x4acd36){_0x4b093e=_0x4acd36;if(!_[_0x0c33('0x16')](_0x1ea193)){return getUser(_0x20b5de,_0x1ea193[_0x0c33('0x3f')],_0x4b093e);}else{return getUser(_0x20b5de,null,_0x4b093e);}})[_0x0c33('0x20')](function(_0x445a38){_0x182441=_0x445a38;return getEndUser(_0x20b5de,_0x28c2ee,_0x28b3c0['calleridname'],_0x28b3c0['calleridnum'],_0x4b093e);})[_0x0c33('0x20')](function(_0x5e2525){_0x2b5312=_0x5e2525;return getTicket(_0x20b5de,_0x182441,_0x2b5312,_0x28c2ee,_0x28b3c0,_0x28c2ee[_0x0c33('0x57')],_0x4b093e);})[_0x0c33('0x20')](function(_0x1c3674){_0x374234=_0x1c3674;logger[_0x0c33('0x1d')]('['+_0x28b3c0[_0x0c33('0x6d')][_0x0c33('0x6e')]()+_0x0c33('0x6f'),_0x374234['id']);logger[_0x0c33('0x1d')]('['+_0x28b3c0[_0x0c33('0x6d')][_0x0c33('0x6e')]()+_0x0c33('0x70'),_0x20b5de[_0x0c33('0x39')]);})[_0x0c33('0x61')](function(_0x135a10){logger[_0x0c33('0x5f')]('['+_0x28b3c0['lastevent'][_0x0c33('0x6e')]()+']',JSON[_0x0c33('0x62')](_0x135a10));});}; \ 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 443b15e..966dacb 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x51cc19,_0x3fc632){var _0x101c66=function(_0x4274e7){while(--_0x4274e7){_0x51cc19['push'](_0x51cc19['shift']());}};_0x101c66(++_0x3fc632);}(_0x5fc3,0xa8));var _0x35fc=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x5fc3[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x5cff32,_0x371623){var _0x5af039=function(_0x3326c8){while(--_0x3326c8){_0x5cff32['push'](_0x5cff32['shift']());}};_0x5af039(++_0x371623);}(_0x5fc3,0xa8));var _0x35fc=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x5fc3[_0x491cbe];return _0x59449d;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 82a66fb..e72895c 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 _0x775e=['JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','content','idField','custom_fields','variable','customVariable','Variable','toLowerCase','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','version','unmanaged','monitor_format','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_type','parent_name','name','direction','variableName','push'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x775e,0xda));var _0xe775=function(_0x395f5f,_0x10a8f8){_0x395f5f=_0x395f5f-0x0;var _0x2a7cb5=_0x775e[_0x395f5f];return _0x2a7cb5;};'use strict';var _=require(_0xe775('0x0'));var rp=require('request-promise');var BPromise=require(_0xe775('0x1'));var md5=require(_0xe775('0x2'));var util=require(_0xe775('0x3'));var Redis=require(_0xe775('0x4'));var intUtil=require('./util');var config=require(_0xe775('0x5'));var logger=require(_0xe775('0x6'))(_0xe775('0x7'));config['redis']=_[_0xe775('0x8')](config[_0xe775('0x9')],{'host':_0xe775('0xa'),'port':0x18eb});var io=require(_0xe775('0xb'))(new Redis(config['redis']));var def={'method':_0xe775('0xc'),'json':!![]};function emit(_0x526fa7,_0x2b7999,_0x3759fc){io['to'](_0x526fa7)[_0xe775('0xd')](_0x2b7999,_0x3759fc);}function getTicket(_0xe71e89,_0xad9cf4,_0x2b9a5b,_0x58c160,_0x5cf8ba,_0x1f3e1c,_0x420616,_0x54fc4){logger[_0xe775('0xe')](_0xe775('0xf'));var _0x9325d=new Date();var _0x18f5ad=[{'name':'name','value':intUtil[_0xe775('0x10')](_0x58c160[_0xe775('0x11')],_0x5cf8ba,'\x20')},{'name':_0xe775('0x12'),'value':_0xad9cf4['id']},{'name':_0xe775('0x13'),'value':_0xad9cf4['id']},{'name':_0xe775('0x14'),'value':intUtil['getString'](_0x58c160['Descriptions'],_0x5cf8ba,'\x0a')},{'name':_0xe775('0x15'),'value':_0x9325d[_0xe775('0x16')]()[_0xe775('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0xe775('0x18'),'value':'0'},{'name':_0xe775('0x19'),'value':'15'},{'name':'parent_id','value':_0x2b9a5b['id']},{'name':_0xe775('0x1a'),'value':'Contacts'},{'name':_0xe775('0x1b'),'value':_0x2b9a5b[_0xe775('0x1c')]},{'name':_0xe775('0x1d'),'value':_0x54fc4}];if(_0x1f3e1c['length']){_['forEach'](_0x1f3e1c,function(_0x476214){if(_0x5cf8ba[_0x476214[_0xe775('0x1e')]]){_0x18f5ad[_0xe775('0x1f')]({'name':_0x476214['idField'],'value':_0x5cf8ba[_0x476214[_0xe775('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xe775('0x20'),'response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0x420616['id'],'module_name':_0xe775('0x22'),'name_value_list':_0x18f5ad})}});}function getAuth(_0xc9919){return util[_0xe775('0x23')](_0xe775('0x24'),new Buffer(_0xc9919[_0xe775('0x25')]+':X')[_0xe775('0x26')](_0xe775('0x27')));}function getServerInfo(_0xfdf957){return request({'form':{'method':_0xe775('0x28'),'input_type':_0xe775('0x20'),'response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0xfdf957['id']})}});}function getUser(_0x26c771,_0x56a781,_0x12ca00){if(!_[_0xe775('0x29')](_0x56a781)){logger[_0xe775('0xe')](_0xe775('0x2a'),_0x56a781);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xe775('0x20'),'rest_data':JSON['stringify']({'session':_0x12ca00['id'],'module_name':'Employees','query':util[_0xe775('0x23')](_0xe775('0x2b'),_0x56a781),'order_by':'','offset':'0','select_fields':['id',_0xe775('0x1c'),_0xe775('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe775('0x2d')](function(_0x52f782){if(_0x52f782[_0xe775('0x2e')][_0xe775('0x2f')]){var _0xc02980=_['find'](_0x52f782[_0xe775('0x2e')],function(_0xce176){return _0xce176[_0xe775('0x30')][_0xe775('0x2c')][_0xe775('0x31')]===_0x56a781;});if(_0xc02980){logger[_0xe775('0xe')](_0xe775('0x32'));return BPromise['resolve']({'id':_0xc02980[_0xe775('0x30')]['id']['value'],'name':_0xc02980[_0xe775('0x30')][_0xe775('0x1c')]['value']});}}logger[_0xe775('0xe')](_0xe775('0x33'));return BPromise[_0xe775('0x34')]({'id':_0x12ca00[_0xe775('0x30')][_0xe775('0x35')][_0xe775('0x31')],'name':_0x12ca00['name_value_list']['user_name'][_0xe775('0x31')]});});}else{logger['info'](_0xe775('0x36'));return BPromise[_0xe775('0x34')]({'id':_0x12ca00[_0xe775('0x30')][_0xe775('0x35')][_0xe775('0x31')],'name':_0x12ca00['name_value_list'][_0xe775('0x2c')][_0xe775('0x31')]});}}function getEndUser(_0x23c3c7,_0x1bc7a1,_0x430a18,_0x7e5fc6){logger[_0xe775('0xe')]('Searching\x20enduser\x20with\x20phone',_0x430a18);return request({'form':{'method':_0xe775('0x37'),'input_type':_0xe775('0x20'),'response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0x7e5fc6['id'],'module_name':_0xe775('0x38'),'query':util[_0xe775('0x23')](_0xe775('0x39'),_0x430a18),'order_by':'','offset':'0','select_fields':['id',_0xe775('0x1c'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe775('0x2d')](function(_0x22e706){if(_0x22e706['entry_list']['length']){var _0x35636c=_[_0xe775('0x3a')](_0x22e706[_0xe775('0x2e')],function(_0x58875b){return _0x58875b['name_value_list'][_0xe775('0x3b')][_0xe775('0x31')]===_0x430a18;});if(_0x35636c){logger[_0xe775('0xe')](_0xe775('0x3c'));return BPromise['resolve']({'id':_0x35636c[_0xe775('0x30')]['id']['value'],'name':_0x35636c[_0xe775('0x30')]['name']['value'],'phone':_0x35636c[_0xe775('0x30')][_0xe775('0x3b')][_0xe775('0x31')]});}}else{logger[_0xe775('0xe')](_0xe775('0x3d'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xe775('0x20'),'rest_data':JSON[_0xe775('0x21')]({'session':_0x7e5fc6['id'],'module_name':_0xe775('0x38'),'name_value_list':[{'name':_0xe775('0x3e'),'value':_0x1bc7a1!==_0xe775('0x3f')?_0x1bc7a1:util[_0xe775('0x23')]('Caller\x20-\x20%s',_0x430a18)},{'name':'phone_home','value':_0x430a18}]})}})[_0xe775('0x2d')](function(_0x5d5d82){logger[_0xe775('0xe')](_0xe775('0x40'));return BPromise[_0xe775('0x34')]({'id':_0x5d5d82['id'],'name':_0x5d5d82[_0xe775('0x2e')][_0xe775('0x3e')]['value'],'phone':_0x5d5d82['entry_list'][_0xe775('0x3b')][_0xe775('0x31')]});});}});}function request(_0x3a85de){logger[_0xe775('0x41')](_0xe775('0x42'),JSON['stringify'](_0x3a85de));return rp(_[_0xe775('0x43')](def,_0x3a85de));}function getTags(_0xdc6dda,_0x405ab9){var _0x3cf6c2=[];if(_0xdc6dda&&_0xdc6dda['length']>0x0){_0x3cf6c2=_[_0xe775('0x44')](_0xdc6dda,_0x405ab9);}return _0x3cf6c2;}function getCustomFields(_0x36783f,_0x138864){var _0x106860=[];var _0x5d47b4={'custom_fields':[]};if(_0x36783f[_0xe775('0x2f')]>0x0){_['forEach'](_0x36783f,function(_0x4cb4ae){if(_0x4cb4ae[_0xe775('0x45')]===_0xe775('0x46')&&_0x4cb4ae['nameField']&&!_0x4cb4ae[_0xe775('0x47')]){_0x5d47b4[_0x4cb4ae[_0xe775('0x48')]['toLowerCase']()]=_0x4cb4ae[_0xe775('0x49')][_0xe775('0x26')]();}else if(_0x4cb4ae[_0xe775('0x45')]===_0xe775('0x46')&&_0x4cb4ae[_0xe775('0x4a')]&&_0x4cb4ae[_0xe775('0x47')]){_0x5d47b4[_0xe775('0x4b')][_0xe775('0x1f')]({'id':_0x4cb4ae[_0xe775('0x4a')],'value':_0x4cb4ae[_0xe775('0x49')]['toString']()});}else if(_0x4cb4ae['type']===_0xe775('0x4c')&&_0x4cb4ae[_0xe775('0x1e')]&&_0x4cb4ae[_0xe775('0x4a')]&&_0x4cb4ae[_0xe775('0x47')]){_0x138864[_0x4cb4ae['variableName']]&&_0x5d47b4['custom_fields'][_0xe775('0x1f')]({'id':_0x4cb4ae[_0xe775('0x4a')],'value':_0x138864[_0x4cb4ae['variableName']][_0xe775('0x26')]()});}else if(_0x4cb4ae[_0xe775('0x45')]===_0xe775('0x4d')&&_0x4cb4ae[_0xe775('0x4e')]&&_0x4cb4ae[_0xe775('0x4e')][_0xe775('0x1c')]&&_0x4cb4ae['idField']&&_0x4cb4ae[_0xe775('0x47')]){_0x138864[_0x4cb4ae[_0xe775('0x4e')]['name'][_0xe775('0x4f')]()]&&_0x5d47b4[_0xe775('0x4b')][_0xe775('0x1f')]({'id':_0x4cb4ae[_0xe775('0x4a')],'value':_0x138864[_0x4cb4ae[_0xe775('0x4e')][_0xe775('0x1c')]['toLowerCase']()][_0xe775('0x26')]()});}});}return _0x5d47b4;}function getConnection(_0x4e0040){return request({'method':_0xe775('0xc'),'form':{'method':_0xe775('0x50'),'input_type':_0xe775('0x20'),'response_type':'JSON','rest_data':JSON[_0xe775('0x21')]({'user_auth':{'user_name':_0x4e0040['username'],'password':_0x4e0040['password'],'encryption':_0xe775('0x51')},'application':_0xe775('0x52')})}})[_0xe775('0x2d')](function(_0xc8f67){var _0x22d45b=_0xc8f67;if(_0x22d45b['id']){def[_0xe775('0x53')]=_0x22d45b['id'];return BPromise[_0xe775('0x34')](_0x22d45b);}else{throw new Error(util[_0xe775('0x23')](_0xe775('0x54'),_0x4e0040['id']));}});}function setRelationship(_0x3eafec,_0xe4c4,_0x4e7ea1,_0x206641){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xe775('0x20'),'rest_data':JSON['stringify']({'session':_0x3eafec['id'],'module_name':_0xe775('0x22'),'module_id':_0x4e7ea1['id'],'link_field_name':_0x206641,'related_ids':[_0xe4c4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe775('0x55')]=function(_0x21cac6,_0x573d3e,_0xefd5d9,_0x396ec1,_0x534282,_0xb89e33){var _0x45ade8,_0x17251f,_0x2bfcc4,_0x5e4fc8;_0xb89e33[_0xe775('0x56')]=intUtil['stripTrailingSlash'](_0xb89e33['remoteUri']);_0xb89e33[_0xe775('0x57')]=intUtil[_0xe775('0x58')](_0xb89e33['serverUrl']);def[_0xe775('0x59')]=util['format'](_0xe775('0x5a'),_0xb89e33[_0xe775('0x56')]);if(_0x534282&&_0x534282['monitor_format']){logger[_0xe775('0xe')](_0xe775('0x5b'),'Recording\x20is\x20enabled!');_0x573d3e['recordingURL']=util[_0xe775('0x23')](_0xe775('0x5c'),_0xb89e33[_0xe775('0x57')],_0x573d3e[_0xe775('0x5d')],md5(_0x573d3e[_0xe775('0x5d')]));}else{_0x573d3e[_0xe775('0x5e')]='';}return getConnection(_0xb89e33)[_0xe775('0x2d')](function(_0x49ef6d){_0x5e4fc8=_0x49ef6d;return getUser(_0xb89e33,_0x396ec1['name'],_0x5e4fc8);})[_0xe775('0x2d')](function(_0x33430d){_0x45ade8=_0x33430d;logger[_0xe775('0xe')](_0xe775('0x5f'),_0x45ade8['id']);return getEndUser(_0xb89e33,_0x573d3e[_0xe775('0x60')],_0x573d3e[_0xe775('0x61')],_0x5e4fc8);})[_0xe775('0x2d')](function(_0x3a3da7){_0x17251f=_0x3a3da7;logger[_0xe775('0xe')](_0xe775('0x62'),_0x17251f['id']);return getTicket(_0xb89e33,_0x45ade8,_0x17251f,_0xefd5d9,_0x573d3e,_0xefd5d9[_0xe775('0x63')],_0x5e4fc8,_0xe775('0x64'));})[_0xe775('0x2d')](function(_0x325ad5){_0x2bfcc4=_0x325ad5;logger['info'](_0xe775('0x65'));logger[_0xe775('0xe')](_0xe775('0x66'),_0x2bfcc4['id']);return setRelationship(_0x5e4fc8,_0x45ade8,_0x2bfcc4,_0xe775('0x67'));})[_0xe775('0x2d')](function(){return setRelationship(_0x5e4fc8,_0x17251f,_0x2bfcc4,_0xe775('0x68'));})[_0xe775('0x2d')](function(){return getServerInfo(_0x5e4fc8);})[_0xe775('0x2d')](function(_0x2d94b2){var _0x362e6f=parseInt(_0x2d94b2['version'][_0xe775('0x69')](0x0));var _0x4862b4=util[_0xe775('0x23')](_0xe775('0x6a'),_0xb89e33[_0xe775('0x56')],_0x2bfcc4['id']);if(_0x362e6f>0x6){_0x4862b4=util[_0xe775('0x23')](_0xe775('0x6b'),_0xb89e33[_0xe775('0x56')],_0x2bfcc4['id']);}logger[_0xe775('0xe')]('[QUEUE]',_0xe775('0x6c'));emit(util['format']('user:%s',_0x396ec1[_0xe775('0x1c')]),_0xe775('0x6d'),{'uri':_0x4862b4});})[_0xe775('0x6e')](function(_0x50aad9){logger[_0xe775('0x6f')](_0xe775('0x5b'),JSON[_0xe775('0x21')](_0x50aad9));});};exports[_0xe775('0x70')]=function(_0x2b28aa,_0x4f8fff,_0x4a8506,_0x2082db,_0xa5d07c,_0x2988ae,_0x9f97fa){var _0x567ceb,_0xdc9b3c,_0x28c02f,_0x238baf;_0x2988ae['remoteUri']=intUtil['stripTrailingSlash'](_0x2988ae[_0xe775('0x56')]);_0x2988ae[_0xe775('0x57')]=intUtil[_0xe775('0x58')](_0x2988ae[_0xe775('0x57')]);def[_0xe775('0x59')]=util[_0xe775('0x23')](_0xe775('0x5a'),_0x2988ae[_0xe775('0x56')]);if(_0x9f97fa&&_0x9f97fa[_0xe775('0x71')]&&_0x9f97fa['recordingFormat']!==_0xe775('0x72')){logger[_0xe775('0xe')](_0xe775('0x73'),_0xe775('0x74'));_0x4f8fff[_0xe775('0x5e')]=util[_0xe775('0x23')](_0xe775('0x5c'),_0x2988ae[_0xe775('0x57')],_0x4f8fff['uniqueid'],md5(_0x4f8fff[_0xe775('0x5d')]));}return getConnection(_0x2988ae)[_0xe775('0x2d')](function(_0x2b6795){_0x238baf=_0x2b6795;return getUser(_0x2988ae,_0x2082db['name'],_0x238baf);})[_0xe775('0x2d')](function(_0x48f303){_0x567ceb=_0x48f303;logger[_0xe775('0xe')](_0xe775('0x5f'),_0x567ceb['id']);return getEndUser(_0x2988ae,_0x4f8fff[_0xe775('0x75')],_0x4f8fff[_0xe775('0x76')],_0x238baf);})['then'](function(_0x5914f5){_0xdc9b3c=_0x5914f5;logger[_0xe775('0xe')](_0xe775('0x62'),_0xdc9b3c['id']);return getTicket(_0x2988ae,_0x567ceb,_0xdc9b3c,_0x4a8506,_0x4f8fff,_0x4a8506['Fields'],_0x238baf,_0xe775('0x77'));})['then'](function(_0x1fe184){_0x28c02f=_0x1fe184;logger[_0xe775('0xe')]('Ticket\x20created!');logger[_0xe775('0xe')](_0xe775('0x66'),_0x28c02f['id']);return setRelationship(_0x238baf,_0x567ceb,_0x28c02f,'users');})[_0xe775('0x2d')](function(){return setRelationship(_0x238baf,_0xdc9b3c,_0x28c02f,_0xe775('0x68'));})[_0xe775('0x2d')](function(){return getServerInfo(_0x238baf);})[_0xe775('0x2d')](function(_0x1f993c){var _0x6001a0=parseInt(_0x1f993c[_0xe775('0x78')][_0xe775('0x69')](0x0));var _0x526550=util[_0xe775('0x23')](_0xe775('0x6a'),_0x2988ae[_0xe775('0x56')],_0x28c02f['id']);if(_0x6001a0>0x6){_0x526550=util[_0xe775('0x23')](_0xe775('0x6b'),_0x2988ae[_0xe775('0x56')],_0x28c02f['id']);}logger[_0xe775('0xe')](_0xe775('0x73'),_0xe775('0x6c'));emit(util[_0xe775('0x23')]('user:%s',_0x2082db[_0xe775('0x1c')]),'trigger:browser:url',{'uri':_0x526550});})[_0xe775('0x6e')](function(_0x4a43a8){logger[_0xe775('0x6f')]('[OUTBOUND]',JSON[_0xe775('0x21')](_0x4a43a8));});};exports[_0xe775('0x79')]=function(_0x418db3,_0x4b4539,_0x51b896,_0x21326a,_0x3c6d60,_0x38cb75){var _0x255449,_0x31ea03,_0x310964,_0x51087b;_0x38cb75[_0xe775('0x56')]=intUtil['stripTrailingSlash'](_0x38cb75['remoteUri']);_0x38cb75[_0xe775('0x57')]=intUtil[_0xe775('0x58')](_0x38cb75[_0xe775('0x57')]);def[_0xe775('0x59')]=util[_0xe775('0x23')](_0xe775('0x5a'),_0x38cb75[_0xe775('0x56')]);if(_0x3c6d60&&_0x3c6d60[_0xe775('0x7a')]){logger[_0xe775('0xe')]('['+_0x4b4539[_0xe775('0x7b')][_0xe775('0x7c')]()+']',_0xe775('0x74'));_0x4b4539[_0xe775('0x5e')]=util[_0xe775('0x23')](_0xe775('0x5c'),_0x38cb75[_0xe775('0x57')],_0x4b4539[_0xe775('0x5d')],md5(_0x4b4539[_0xe775('0x5d')]));}else{_0x4b4539['recordingURL']='';}return getConnection(_0x38cb75)['then'](function(_0x252b5e){_0x51087b=_0x252b5e;if(!_[_0xe775('0x29')](_0x21326a)){return getUser(_0x38cb75,_0x21326a[_0xe775('0x1c')],_0x51087b);}else{return getUser(_0x38cb75,null,_0x51087b);}})[_0xe775('0x2d')](function(_0x1e9815){_0x255449=_0x1e9815;logger['info'](_0xe775('0x5f'),_0x255449['id']);return getEndUser(_0x38cb75,_0x4b4539[_0xe775('0x60')],_0x4b4539[_0xe775('0x61')],_0x51087b);})[_0xe775('0x2d')](function(_0x185236){_0x31ea03=_0x185236;logger[_0xe775('0xe')](_0xe775('0x62'),_0x31ea03['id']);return getTicket(_0x38cb75,_0x255449,_0x31ea03,_0x51b896,_0x4b4539,_0x51b896[_0xe775('0x63')],_0x51087b,_0xe775('0x64'));})[_0xe775('0x2d')](function(_0x49af4a){_0x310964=_0x49af4a;logger[_0xe775('0xe')](_0xe775('0x65'));logger[_0xe775('0xe')](_0xe775('0x66'),_0x310964['id']);return setRelationship(_0x51087b,_0x255449,_0x310964,_0xe775('0x67'));})[_0xe775('0x2d')](function(){return setRelationship(_0x51087b,_0x31ea03,_0x310964,'contacts');})[_0xe775('0x2d')](function(){return getServerInfo(_0x51087b);})[_0xe775('0x6e')](function(_0x1d5591){logger[_0xe775('0x6f')]('['+_0x4b4539[_0xe775('0x7b')]['toUpperCase']()+']',JSON[_0xe775('0x21')](_0x1d5591));});}; \ No newline at end of file +var _0x8101=['value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','format','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','trigger:browser:url','unmanaged','uri','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','Descriptions','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','push','idField','variableName','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','name_value_list'];(function(_0x4ffe82,_0x162d5f){var _0x4b6169=function(_0x51c8f3){while(--_0x51c8f3){_0x4ffe82['push'](_0x4ffe82['shift']());}};_0x4b6169(++_0x162d5f);}(_0x8101,0xc0));var _0x1810=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0x8101[_0x171fdc];return _0x3782ea;};'use strict';var _=require(_0x1810('0x0'));var rp=require(_0x1810('0x1'));var BPromise=require(_0x1810('0x2'));var md5=require(_0x1810('0x3'));var util=require(_0x1810('0x4'));var Redis=require(_0x1810('0x5'));var intUtil=require(_0x1810('0x6'));var config=require(_0x1810('0x7'));var logger=require(_0x1810('0x8'))('sugarcrm');config['redis']=_[_0x1810('0x9')](config[_0x1810('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x1810('0xb'))(new Redis(config[_0x1810('0xa')]));var def={'method':_0x1810('0xc'),'json':!![]};function emit(_0x33d690,_0x312a3c,_0x271738){io['to'](_0x33d690)[_0x1810('0xd')](_0x312a3c,_0x271738);}function getTicket(_0x2dde85,_0xaa4b05,_0x1e732c,_0x419324,_0x5126d2,_0x3a664b,_0x18bb2d,_0x4f4f4a){logger[_0x1810('0xe')]('Creating\x20new\x20ticket...');var _0x4ee397=new Date();var _0x3c8a9f=[{'name':_0x1810('0xf'),'value':intUtil[_0x1810('0x10')](_0x419324[_0x1810('0x11')],_0x5126d2,'\x20')},{'name':_0x1810('0x12'),'value':_0xaa4b05['id']},{'name':_0x1810('0x13'),'value':_0xaa4b05['id']},{'name':'description','value':intUtil[_0x1810('0x10')](_0x419324[_0x1810('0x14')],_0x5126d2,'\x0a')},{'name':'date_start','value':_0x4ee397['toISOString']()[_0x1810('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1810('0x16'),'value':'0'},{'name':_0x1810('0x17'),'value':'15'},{'name':_0x1810('0x18'),'value':_0x1e732c['id']},{'name':_0x1810('0x19'),'value':_0x1810('0x1a')},{'name':_0x1810('0x1b'),'value':_0x1e732c[_0x1810('0xf')]},{'name':'direction','value':_0x4f4f4a}];if(_0x3a664b['length']){_['forEach'](_0x3a664b,function(_0x3491d8){if(_0x5126d2[_0x3491d8['variableName']]){_0x3c8a9f[_0x1810('0x1c')]({'name':_0x3491d8[_0x1810('0x1d')],'value':_0x5126d2[_0x3491d8[_0x1810('0x1e')]]});}});}return request({'form':{'method':_0x1810('0x1f'),'input_type':'JSON','response_type':_0x1810('0x20'),'rest_data':JSON['stringify']({'session':_0x18bb2d['id'],'module_name':_0x1810('0x21'),'name_value_list':_0x3c8a9f})}});}function getAuth(_0x116ea0){return util['format'](_0x1810('0x22'),new Buffer(_0x116ea0[_0x1810('0x23')]+':X')[_0x1810('0x24')](_0x1810('0x25')));}function getServerInfo(_0xe66600){return request({'form':{'method':_0x1810('0x26'),'input_type':'JSON','response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0xe66600['id']})}});}function getUser(_0x254062,_0x77b5ed,_0x53ca63){if(!_[_0x1810('0x28')](_0x77b5ed)){logger['info']('Getting\x20agent\x20with\x20name',_0x77b5ed);return request({'form':{'method':_0x1810('0x29'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0x53ca63['id'],'module_name':_0x1810('0x2a'),'query':util['format'](_0x1810('0x2b'),_0x77b5ed),'order_by':'','offset':'0','select_fields':['id',_0x1810('0xf'),_0x1810('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1810('0x2d')](function(_0x523bb2){if(_0x523bb2['entry_list'][_0x1810('0x2e')]){var _0x33f077=_[_0x1810('0x2f')](_0x523bb2[_0x1810('0x30')],function(_0x2d387a){return _0x2d387a[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]===_0x77b5ed;});if(_0x33f077){logger[_0x1810('0xe')](_0x1810('0x33'));return BPromise[_0x1810('0x34')]({'id':_0x33f077[_0x1810('0x31')]['id'][_0x1810('0x32')],'name':_0x33f077['name_value_list'][_0x1810('0xf')][_0x1810('0x32')]});}}logger[_0x1810('0xe')](_0x1810('0x35'));return BPromise[_0x1810('0x34')]({'id':_0x53ca63[_0x1810('0x31')]['user_id'][_0x1810('0x32')],'name':_0x53ca63[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]});});}else{logger[_0x1810('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1810('0x34')]({'id':_0x53ca63[_0x1810('0x31')][_0x1810('0x36')]['value'],'name':_0x53ca63[_0x1810('0x31')][_0x1810('0x2c')][_0x1810('0x32')]});}}function getEndUser(_0xb46b04,_0x3c3d0a,_0x287181,_0xaecd29){logger[_0x1810('0xe')](_0x1810('0x37'),_0x287181);return request({'form':{'method':_0x1810('0x29'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0xaecd29['id'],'module_name':_0x1810('0x1a'),'query':util[_0x1810('0x38')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x287181),'order_by':'','offset':'0','select_fields':['id',_0x1810('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xbb39c2){if(_0xbb39c2[_0x1810('0x30')]['length']){var _0x284b30=_[_0x1810('0x2f')](_0xbb39c2[_0x1810('0x30')],function(_0x345da0){return _0x345da0[_0x1810('0x31')][_0x1810('0x39')][_0x1810('0x32')]===_0x287181;});if(_0x284b30){logger['info'](_0x1810('0x3a'));return BPromise[_0x1810('0x34')]({'id':_0x284b30['name_value_list']['id']['value'],'name':_0x284b30[_0x1810('0x31')]['name'][_0x1810('0x32')],'phone':_0x284b30[_0x1810('0x31')][_0x1810('0x39')][_0x1810('0x32')]});}}else{logger[_0x1810('0xe')](_0x1810('0x3b'));return request({'form':{'method':_0x1810('0x1f'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON['stringify']({'session':_0xaecd29['id'],'module_name':_0x1810('0x1a'),'name_value_list':[{'name':'first_name','value':_0x3c3d0a!==_0x1810('0x3c')?_0x3c3d0a:util[_0x1810('0x38')](_0x1810('0x3d'),_0x287181)},{'name':_0x1810('0x39'),'value':_0x287181}]})}})[_0x1810('0x2d')](function(_0x41c0ab){logger[_0x1810('0xe')](_0x1810('0x3e'));return BPromise[_0x1810('0x34')]({'id':_0x41c0ab['id'],'name':_0x41c0ab[_0x1810('0x30')]['first_name'][_0x1810('0x32')],'phone':_0x41c0ab[_0x1810('0x30')][_0x1810('0x39')]['value']});});}});}function request(_0x368a37){logger[_0x1810('0x3f')](_0x1810('0x40'),JSON[_0x1810('0x27')](_0x368a37));return rp(_[_0x1810('0x41')](def,_0x368a37));}function getTags(_0x378582,_0x4d1de7){var _0x30372a=[];if(_0x378582&&_0x378582[_0x1810('0x2e')]>0x0){_0x30372a=_[_0x1810('0x42')](_0x378582,_0x4d1de7);}return _0x30372a;}function getCustomFields(_0x171190,_0x459570){var _0x4e63d9=[];var _0x358eda={'custom_fields':[]};if(_0x171190[_0x1810('0x2e')]>0x0){_[_0x1810('0x43')](_0x171190,function(_0x15ce70){if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x45')&&_0x15ce70[_0x1810('0x46')]&&!_0x15ce70[_0x1810('0x47')]){_0x358eda[_0x15ce70[_0x1810('0x46')][_0x1810('0x48')]()]=_0x15ce70[_0x1810('0x49')]['toString']();}else if(_0x15ce70[_0x1810('0x44')]==='string'&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70['customField']){_0x358eda[_0x1810('0x4a')][_0x1810('0x1c')]({'id':_0x15ce70[_0x1810('0x1d')],'value':_0x15ce70[_0x1810('0x49')][_0x1810('0x24')]()});}else if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x4b')&&_0x15ce70[_0x1810('0x1e')]&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70[_0x1810('0x47')]){_0x459570[_0x15ce70[_0x1810('0x1e')]]&&_0x358eda[_0x1810('0x4a')]['push']({'id':_0x15ce70['idField'],'value':_0x459570[_0x15ce70[_0x1810('0x1e')]]['toString']()});}else if(_0x15ce70[_0x1810('0x44')]===_0x1810('0x4c')&&_0x15ce70['Variable']&&_0x15ce70['Variable'][_0x1810('0xf')]&&_0x15ce70[_0x1810('0x1d')]&&_0x15ce70[_0x1810('0x47')]){_0x459570[_0x15ce70[_0x1810('0x4d')][_0x1810('0xf')]['toLowerCase']()]&&_0x358eda[_0x1810('0x4a')][_0x1810('0x1c')]({'id':_0x15ce70[_0x1810('0x1d')],'value':_0x459570[_0x15ce70[_0x1810('0x4d')][_0x1810('0xf')][_0x1810('0x48')]()][_0x1810('0x24')]()});}});}return _0x358eda;}function getConnection(_0x25d609){return request({'method':_0x1810('0xc'),'form':{'method':_0x1810('0x4e'),'input_type':_0x1810('0x20'),'response_type':'JSON','rest_data':JSON[_0x1810('0x27')]({'user_auth':{'user_name':_0x25d609[_0x1810('0x4f')],'password':_0x25d609[_0x1810('0x50')],'encryption':_0x1810('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x1810('0x2d')](function(_0x126b0c){var _0x5f5763=_0x126b0c;if(_0x5f5763['id']){def[_0x1810('0x52')]=_0x5f5763['id'];return BPromise['resolve'](_0x5f5763);}else{throw new Error(util['format'](_0x1810('0x53'),_0x25d609['id']));}});}function setRelationship(_0x5f2735,_0x4207c4,_0x4628a7,_0xf895b1){return request({'form':{'method':_0x1810('0x54'),'input_type':_0x1810('0x20'),'response_type':_0x1810('0x20'),'rest_data':JSON[_0x1810('0x27')]({'session':_0x5f2735['id'],'module_name':_0x1810('0x21'),'module_id':_0x4628a7['id'],'link_field_name':_0xf895b1,'related_ids':[_0x4207c4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1810('0x55')]=function(_0x2c4c00,_0x73fef8,_0x4a71a8,_0x4f0f76,_0x498213,_0x3c51ec){var _0x1f2974,_0x358d17,_0x53bec7,_0x3337e2;_0x3c51ec[_0x1810('0x56')]=intUtil['stripTrailingSlash'](_0x3c51ec[_0x1810('0x56')]);_0x3c51ec[_0x1810('0x57')]=intUtil[_0x1810('0x58')](_0x3c51ec['serverUrl']);def['uri']=util[_0x1810('0x38')](_0x1810('0x59'),_0x3c51ec[_0x1810('0x56')]);if(_0x498213&&_0x498213[_0x1810('0x5a')]){logger[_0x1810('0xe')]('[QUEUE]',_0x1810('0x5b'));_0x73fef8['recordingURL']=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c51ec[_0x1810('0x57')],_0x73fef8[_0x1810('0x5c')],md5(_0x73fef8['uniqueid']));}else{_0x73fef8[_0x1810('0x5d')]='';}return getConnection(_0x3c51ec)['then'](function(_0x3b636e){_0x3337e2=_0x3b636e;return getUser(_0x3c51ec,_0x4f0f76[_0x1810('0xf')],_0x3337e2);})[_0x1810('0x2d')](function(_0x4638d2){_0x1f2974=_0x4638d2;logger[_0x1810('0xe')]('The\x20User\x20ID\x20is:',_0x1f2974['id']);return getEndUser(_0x3c51ec,_0x73fef8[_0x1810('0x5e')],_0x73fef8[_0x1810('0x5f')],_0x3337e2);})['then'](function(_0x37dbe1){_0x358d17=_0x37dbe1;logger['info'](_0x1810('0x60'),_0x358d17['id']);return getTicket(_0x3c51ec,_0x1f2974,_0x358d17,_0x4a71a8,_0x73fef8,_0x4a71a8[_0x1810('0x61')],_0x3337e2,_0x1810('0x62'));})[_0x1810('0x2d')](function(_0x1949a6){_0x53bec7=_0x1949a6;logger['info'](_0x1810('0x63'));logger[_0x1810('0xe')]('The\x20Ticket\x20ID\x20is:',_0x53bec7['id']);return setRelationship(_0x3337e2,_0x1f2974,_0x53bec7,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x3337e2,_0x358d17,_0x53bec7,_0x1810('0x65'));})[_0x1810('0x2d')](function(){return getServerInfo(_0x3337e2);})[_0x1810('0x2d')](function(_0x17e12b){var _0x40deb3=parseInt(_0x17e12b[_0x1810('0x66')][_0x1810('0x67')](0x0));var _0x41eaef=util[_0x1810('0x38')](_0x1810('0x68'),_0x3c51ec[_0x1810('0x56')],_0x53bec7['id']);if(_0x40deb3>0x6){_0x41eaef=util[_0x1810('0x38')](_0x1810('0x69'),_0x3c51ec['remoteUri'],_0x53bec7['id']);}logger[_0x1810('0xe')](_0x1810('0x6a'),_0x1810('0x6b'));emit(util[_0x1810('0x38')](_0x1810('0x6c'),_0x4f0f76[_0x1810('0xf')]),'trigger:browser:url',{'uri':_0x41eaef});})[_0x1810('0x6d')](function(_0x35c92a){logger[_0x1810('0x6e')]('[QUEUE]',JSON[_0x1810('0x27')](_0x35c92a));});};exports['outbound']=function(_0x27d55d,_0x4a13df,_0x425f4c,_0x24f731,_0x4b9858,_0x39051b,_0x771847){var _0x34fa25,_0x1346ed,_0x26af3a,_0x4264b4;_0x39051b[_0x1810('0x56')]=intUtil['stripTrailingSlash'](_0x39051b[_0x1810('0x56')]);_0x39051b['serverUrl']=intUtil['stripTrailingSlash'](_0x39051b[_0x1810('0x57')]);def['uri']=util[_0x1810('0x38')](_0x1810('0x59'),_0x39051b[_0x1810('0x56')]);if(_0x771847&&_0x771847[_0x1810('0x6f')]&&_0x771847[_0x1810('0x6f')]!=='none'){logger['info'](_0x1810('0x70'),_0x1810('0x5b'));_0x4a13df[_0x1810('0x5d')]=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39051b[_0x1810('0x57')],_0x4a13df[_0x1810('0x5c')],md5(_0x4a13df['uniqueid']));}return getConnection(_0x39051b)[_0x1810('0x2d')](function(_0x5c5761){_0x4264b4=_0x5c5761;return getUser(_0x39051b,_0x24f731[_0x1810('0xf')],_0x4264b4);})[_0x1810('0x2d')](function(_0x5c5efa){_0x34fa25=_0x5c5efa;logger['info']('The\x20User\x20ID\x20is:',_0x34fa25['id']);return getEndUser(_0x39051b,_0x4a13df[_0x1810('0x71')],_0x4a13df['destcalleridnum'],_0x4264b4);})[_0x1810('0x2d')](function(_0x57b877){_0x1346ed=_0x57b877;logger['info'](_0x1810('0x60'),_0x1346ed['id']);return getTicket(_0x39051b,_0x34fa25,_0x1346ed,_0x425f4c,_0x4a13df,_0x425f4c[_0x1810('0x61')],_0x4264b4,_0x1810('0x72'));})[_0x1810('0x2d')](function(_0x316b0b){_0x26af3a=_0x316b0b;logger[_0x1810('0xe')](_0x1810('0x63'));logger[_0x1810('0xe')]('The\x20Ticket\x20ID\x20is:',_0x26af3a['id']);return setRelationship(_0x4264b4,_0x34fa25,_0x26af3a,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x4264b4,_0x1346ed,_0x26af3a,'contacts');})[_0x1810('0x2d')](function(){return getServerInfo(_0x4264b4);})[_0x1810('0x2d')](function(_0x396601){var _0x24f812=parseInt(_0x396601['version'][_0x1810('0x67')](0x0));var _0x52928b=util[_0x1810('0x38')](_0x1810('0x68'),_0x39051b[_0x1810('0x56')],_0x26af3a['id']);if(_0x24f812>0x6){_0x52928b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39051b[_0x1810('0x56')],_0x26af3a['id']);}logger[_0x1810('0xe')](_0x1810('0x70'),_0x1810('0x6b'));emit(util[_0x1810('0x38')](_0x1810('0x6c'),_0x24f731[_0x1810('0xf')]),_0x1810('0x73'),{'uri':_0x52928b});})[_0x1810('0x6d')](function(_0x17e02b){logger['error'](_0x1810('0x70'),JSON['stringify'](_0x17e02b));});};exports[_0x1810('0x74')]=function(_0xeb72e7,_0x26eb0e,_0x2525b0,_0x22d588,_0x2b1abe,_0x49df55){var _0xf6c9b7,_0x260cfc,_0x3b4bd1,_0x1bb59a;_0x49df55[_0x1810('0x56')]=intUtil[_0x1810('0x58')](_0x49df55[_0x1810('0x56')]);_0x49df55[_0x1810('0x57')]=intUtil[_0x1810('0x58')](_0x49df55[_0x1810('0x57')]);def[_0x1810('0x75')]=util[_0x1810('0x38')](_0x1810('0x59'),_0x49df55[_0x1810('0x56')]);if(_0x2b1abe&&_0x2b1abe[_0x1810('0x5a')]){logger[_0x1810('0xe')]('['+_0x26eb0e[_0x1810('0x76')][_0x1810('0x77')]()+']','Recording\x20is\x20enabled!');_0x26eb0e[_0x1810('0x5d')]=util[_0x1810('0x38')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49df55[_0x1810('0x57')],_0x26eb0e[_0x1810('0x5c')],md5(_0x26eb0e[_0x1810('0x5c')]));}else{_0x26eb0e['recordingURL']='';}return getConnection(_0x49df55)[_0x1810('0x2d')](function(_0x55b6b4){_0x1bb59a=_0x55b6b4;if(!_['isNil'](_0x22d588)){return getUser(_0x49df55,_0x22d588[_0x1810('0xf')],_0x1bb59a);}else{return getUser(_0x49df55,null,_0x1bb59a);}})[_0x1810('0x2d')](function(_0x53256c){_0xf6c9b7=_0x53256c;logger[_0x1810('0xe')]('The\x20User\x20ID\x20is:',_0xf6c9b7['id']);return getEndUser(_0x49df55,_0x26eb0e[_0x1810('0x5e')],_0x26eb0e[_0x1810('0x5f')],_0x1bb59a);})[_0x1810('0x2d')](function(_0x52da7b){_0x260cfc=_0x52da7b;logger['info'](_0x1810('0x60'),_0x260cfc['id']);return getTicket(_0x49df55,_0xf6c9b7,_0x260cfc,_0x2525b0,_0x26eb0e,_0x2525b0['Fields'],_0x1bb59a,_0x1810('0x62'));})[_0x1810('0x2d')](function(_0x5d578d){_0x3b4bd1=_0x5d578d;logger[_0x1810('0xe')](_0x1810('0x63'));logger[_0x1810('0xe')](_0x1810('0x78'),_0x3b4bd1['id']);return setRelationship(_0x1bb59a,_0xf6c9b7,_0x3b4bd1,_0x1810('0x64'));})[_0x1810('0x2d')](function(){return setRelationship(_0x1bb59a,_0x260cfc,_0x3b4bd1,'contacts');})[_0x1810('0x2d')](function(){return getServerInfo(_0x1bb59a);})[_0x1810('0x6d')](function(_0xfa6d8c){logger[_0x1810('0x6e')]('['+_0x26eb0e[_0x1810('0x76')][_0x1810('0x77')]()+']',JSON[_0x1810('0x27')](_0xfa6d8c));});}; \ 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 2a14af2..ae43abd 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 _0xc74b=['substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','string','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash'];(function(_0x1d006a,_0x2812b5){var _0x20a76b=function(_0x15953f){while(--_0x15953f){_0x1d006a['push'](_0x1d006a['shift']());}};_0x20a76b(++_0x2812b5);}(_0xc74b,0x148));var _0xbc74=function(_0x567301,_0x2532cb){_0x567301=_0x567301-0x0;var _0x597492=_0xc74b[_0x567301];return _0x597492;};'use strict';var _=require(_0xbc74('0x0'));var util=require(_0xbc74('0x1'));exports[_0xbc74('0x2')]=function(_0x41ec10,_0x1677c0,_0x1a957e){var _0x44b0ef=[];if(_0x41ec10[_0xbc74('0x3')]>0x0){var _0x4fa6ac=_[_0xbc74('0x4')](_0x41ec10,['id']);for(var _0xab08dd=0x0;_0xab08dd<_0x4fa6ac[_0xbc74('0x3')];_0xab08dd++){var _0x50e4b7=_0x4fa6ac[_0xab08dd];if(_0x50e4b7['type']==='string'){_0x44b0ef[_0xbc74('0x5')](_0x50e4b7[_0xbc74('0x6')]);}else if(_0x50e4b7[_0xbc74('0x7')]===_0xbc74('0x8')&&_0x50e4b7[_0xbc74('0x9')]){_0x1677c0[_0x50e4b7[_0xbc74('0x9')]]&&_0x44b0ef['push'](_0x1677c0[_0x50e4b7['variableName']][_0xbc74('0xa')]());}else if(_0x50e4b7[_0xbc74('0x7')]===_0xbc74('0xb')&&_0x50e4b7[_0xbc74('0xc')]&&_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')]){_0x1677c0[_0x50e4b7['Variable'][_0xbc74('0xd')][_0xbc74('0xe')]()]&&_0x44b0ef[_0xbc74('0x5')](_0x1677c0[_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')][_0xbc74('0xe')]()][_0xbc74('0xa')]());}else if(_0x50e4b7['type']==='keyValue'){if(_0x50e4b7[_0xbc74('0xf')]===_0xbc74('0x10')&&_0x50e4b7['key']){_0x44b0ef['push'](util[_0xbc74('0x11')](_0xbc74('0x12'),_0x50e4b7[_0xbc74('0x13')],_0x50e4b7[_0xbc74('0x14')]));}else if(_0x50e4b7['keyType']===_0xbc74('0x8')&&_0x50e4b7[_0xbc74('0x9')]&&_0x50e4b7['key']){_0x1677c0[_0x50e4b7[_0xbc74('0x9')]]&&_0x44b0ef[_0xbc74('0x5')](util['format']('%s:\x20%s',_0x50e4b7[_0xbc74('0x13')],_0x1677c0[_0x50e4b7['variableName']]));}else if(_0x50e4b7[_0xbc74('0xf')]===_0xbc74('0xb')&&_0x50e4b7[_0xbc74('0xc')]&&_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')]&&_0x50e4b7[_0xbc74('0x13')]){_0x1677c0[_0x50e4b7[_0xbc74('0xc')][_0xbc74('0xd')]['toLowerCase']()]&&_0x44b0ef[_0xbc74('0x5')](util[_0xbc74('0x11')](_0xbc74('0x12'),_0x50e4b7[_0xbc74('0x13')],_0x1677c0[_0x50e4b7[_0xbc74('0xc')]['name'][_0xbc74('0xe')]()]));}}}}return _0x44b0ef[_0xbc74('0x15')](_0x1a957e);};exports[_0xbc74('0x16')]=function(_0xfd9625){var _0x1c1040=_0xfd9625['slice'](-0x1);if(_0x1c1040==='/'){_0xfd9625=_0xfd9625[_0xbc74('0x17')](0x0,_0xfd9625[_0xbc74('0x18')](_0x1c1040));}return _0xfd9625;};exports['validateEmail']=function(_0x4e0760){if(!_[_0xbc74('0x19')](_0x4e0760)&&_0x4e0760!==''){var _0x5c1522=/^(([^<>()\[\]\\.,;:\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 _0x5c1522[_0xbc74('0x1a')](String(_0x4e0760)[_0xbc74('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x801e=['customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','variable','variableName','push','toString'];(function(_0x1711fa,_0xcc2e28){var _0x4c615c=function(_0x138f60){while(--_0x138f60){_0x1711fa['push'](_0x1711fa['shift']());}};_0x4c615c(++_0xcc2e28);}(_0x801e,0x13b));var _0xe801=function(_0x520557,_0x249a78){_0x520557=_0x520557-0x0;var _0x37a49a=_0x801e[_0x520557];return _0x37a49a;};'use strict';var _=require(_0xe801('0x0'));var util=require(_0xe801('0x1'));exports[_0xe801('0x2')]=function(_0x317844,_0x6ed08c,_0x1eb180){var _0x2d6d6a=[];if(_0x317844[_0xe801('0x3')]>0x0){var _0x339c62=_['sortBy'](_0x317844,['id']);for(var _0x3d9dd3=0x0;_0x3d9dd3<_0x339c62[_0xe801('0x3')];_0x3d9dd3++){var _0x547049=_0x339c62[_0x3d9dd3];if(_0x547049[_0xe801('0x4')]===_0xe801('0x5')){_0x2d6d6a['push'](_0x547049['content']);}else if(_0x547049[_0xe801('0x4')]===_0xe801('0x6')&&_0x547049[_0xe801('0x7')]){_0x6ed08c[_0x547049[_0xe801('0x7')]]&&_0x2d6d6a[_0xe801('0x8')](_0x6ed08c[_0x547049[_0xe801('0x7')]][_0xe801('0x9')]());}else if(_0x547049[_0xe801('0x4')]===_0xe801('0xa')&&_0x547049[_0xe801('0xb')]&&_0x547049[_0xe801('0xb')]['name']){_0x6ed08c[_0x547049[_0xe801('0xb')][_0xe801('0xc')][_0xe801('0xd')]()]&&_0x2d6d6a['push'](_0x6ed08c[_0x547049[_0xe801('0xb')]['name'][_0xe801('0xd')]()][_0xe801('0x9')]());}else if(_0x547049[_0xe801('0x4')]===_0xe801('0xe')){if(_0x547049[_0xe801('0xf')]===_0xe801('0x5')&&_0x547049[_0xe801('0x10')]){_0x2d6d6a[_0xe801('0x8')](util['format'](_0xe801('0x11'),_0x547049['key'],_0x547049['keyContent']));}else if(_0x547049[_0xe801('0xf')]===_0xe801('0x6')&&_0x547049['variableName']&&_0x547049[_0xe801('0x10')]){_0x6ed08c[_0x547049[_0xe801('0x7')]]&&_0x2d6d6a[_0xe801('0x8')](util[_0xe801('0x12')](_0xe801('0x11'),_0x547049[_0xe801('0x10')],_0x6ed08c[_0x547049[_0xe801('0x7')]]));}else if(_0x547049[_0xe801('0xf')]===_0xe801('0xa')&&_0x547049['Variable']&&_0x547049['Variable'][_0xe801('0xc')]&&_0x547049['key']){_0x6ed08c[_0x547049['Variable'][_0xe801('0xc')][_0xe801('0xd')]()]&&_0x2d6d6a[_0xe801('0x8')](util[_0xe801('0x12')](_0xe801('0x11'),_0x547049[_0xe801('0x10')],_0x6ed08c[_0x547049[_0xe801('0xb')][_0xe801('0xc')]['toLowerCase']()]));}}}}return _0x2d6d6a['join'](_0x1eb180);};exports[_0xe801('0x13')]=function(_0x8916f5){var _0x4455c8=_0x8916f5[_0xe801('0x14')](-0x1);if(_0x4455c8==='/'){_0x8916f5=_0x8916f5[_0xe801('0x15')](0x0,_0x8916f5[_0xe801('0x16')](_0x4455c8));}return _0x8916f5;};exports[_0xe801('0x17')]=function(_0x4003c3){if(!_[_0xe801('0x18')](_0x4003c3)&&_0x4003c3!==''){var _0x41dd97=/^(([^<>()\[\]\\.,;:\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 _0x41dd97['test'](String(_0x4003c3)[_0xe801('0xd')]());}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 a9b9bf0..be3ab8f 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 _0x7528=['none','[OUTBOUND]','recordingURL','destcalleridname','user:%s','trigger:browser:url','unmanaged','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','defaults','redis','localhost','socket.io-emitter','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','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;','length','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','getEndUser','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','outbound','recordingFormat'];(function(_0x4a71ef,_0x5f033c){var _0x262d89=function(_0x1a4e8a){while(--_0x1a4e8a){_0x4a71ef['push'](_0x4a71ef['shift']());}};_0x262d89(++_0x5f033c);}(_0x7528,0xd9));var _0x8752=function(_0xdffb85,_0x4a49a1){_0xdffb85=_0xdffb85-0x0;var _0x15f522=_0x7528[_0xdffb85];return _0x15f522;};'use strict';var _=require(_0x8752('0x0'));var rp=require(_0x8752('0x1'));var BPromise=require(_0x8752('0x2'));var md5=require(_0x8752('0x3'));var util=require(_0x8752('0x4'));var Redis=require(_0x8752('0x5'));var intUtil=require(_0x8752('0x6'));var config=require('../../../../config/environment');var logger=require(_0x8752('0x7'))(_0x8752('0x8'));config['redis']=_[_0x8752('0x9')](config[_0x8752('0xa')],{'host':_0x8752('0xb'),'port':0x18eb});var io=require(_0x8752('0xc'))(new Redis(config[_0x8752('0xa')]));function emit(_0x5a4609,_0x206f3b,_0x2fcfd9){io['to'](_0x5a4609)['emit'](_0x206f3b,_0x2fcfd9);}function getCustomFields(_0x481c9f,_0x4c1043){var _0x2e755e={};if(_0x481c9f['length']>0x0){_['forEach'](_0x481c9f,function(_0x4784b9){if(_0x4784b9['type']===_0x8752('0xd')&&_0x4784b9[_0x8752('0xe')]){_0x2e755e[_0x4784b9[_0x8752('0xe')]]=_0x4784b9[_0x8752('0xf')]['toString']();}else if(_0x4784b9[_0x8752('0x10')]===_0x8752('0x11')&&_0x4784b9[_0x8752('0x12')]&&_0x4784b9[_0x8752('0xe')]&&_0x4c1043[_0x4784b9[_0x8752('0x12')]]){_0x2e755e[_0x4784b9[_0x8752('0xe')]]=_0x4c1043[_0x4784b9['variableName']][_0x8752('0x13')]();}else if(_0x4784b9['type']===_0x8752('0x14')&&_0x4784b9[_0x8752('0x15')]&&_0x4784b9[_0x8752('0x15')][_0x8752('0x16')]&&_0x4784b9[_0x8752('0xe')]&&_0x4c1043[_0x4784b9[_0x8752('0x15')][_0x8752('0x16')][_0x8752('0x17')]()]){_0x2e755e[_0x4784b9[_0x8752('0xe')]]=_0x4c1043[_0x4784b9[_0x8752('0x15')]['name']['toLowerCase']()][_0x8752('0x13')]();}});}return _0x2e755e;}function createTicket(_0x48305b,_0x52da6d,_0x5144ae,_0x22d23c,_0x48fe7f,_0x40a6d9,_0x436747){logger[_0x8752('0x18')](_0x8752('0x19'));var _0x360e86=_[_0x8752('0x1a')]({'parent_id':'','assigned_user_id':_0x52da6d['id'],'ticketpriorities':_0x8752('0x1b'),'ticketstatus':_0x8752('0x1c'),'ticket_title':intUtil['getString'](_0x22d23c['Subjects'],_0x48fe7f,'\x20'),'description':intUtil[_0x8752('0x1d')](_0x22d23c[_0x8752('0x1e')],_0x48fe7f,'\x0a'),'contact_id':_0x5144ae['id']},getCustomFields(_0x40a6d9,_0x48fe7f));var _0x250559={'method':'POST','uri':util['format'](_0x8752('0x1f'),_0x48305b[_0x8752('0x20')]),'form':{'operation':_0x8752('0x21'),'username':_0x48305b['username'],'sessionName':_0x436747[_0x8752('0x22')],'elementType':_0x8752('0x23'),'element':JSON[_0x8752('0x24')](_0x360e86)},'json':!![]};return request(_0x250559)[_0x8752('0x25')](function(_0x173826){if(_0x173826[_0x8752('0x26')]){return BPromise[_0x8752('0x27')]({'id':_0x173826[_0x8752('0x28')]['id']});}else{throw new Error(util[_0x8752('0x29')](_0x8752('0x2a'),JSON[_0x8752('0x24')](_0x173826['error'])));}})[_0x8752('0x2b')](function(_0xe1f41c){var _0x59f8ad=_0xe1f41c[_0x8752('0x2c')]||0x1f4;logger[_0x8752('0x2d')](_0x8752('0x2e'),_0x8752('0x2f'),_0x59f8ad,JSON[_0x8752('0x24')](_0xe1f41c));});}function getUser(_0x45f39d,_0xbe2cc4,_0x816e60){if(intUtil[_0x8752('0x30')](_0xbe2cc4)){logger[_0x8752('0x18')]('Getting\x20agent\x20with\x20email',_0xbe2cc4);return request({'method':_0x8752('0x31'),'uri':util[_0x8752('0x29')](_0x8752('0x1f'),_0x45f39d['remoteUri']),'qs':{'operation':_0x8752('0x32'),'username':_0x45f39d[_0x8752('0x33')],'sessionName':_0x816e60['sessionName'],'query':util['format'](_0x8752('0x34'),_0xbe2cc4)},'json':!![]})[_0x8752('0x25')](function(_0x5d71c4){if(_0x5d71c4[_0x8752('0x26')]&&_0x5d71c4['result']['length']){logger[_0x8752('0x18')](_0x8752('0x35'));return BPromise[_0x8752('0x27')]({'id':_0x5d71c4[_0x8752('0x28')][0x0]['id'],'email':_0x5d71c4['result'][0x0][_0x8752('0x36')],'name':_0x5d71c4[_0x8752('0x28')][0x0]['first_name']+'\x20'+_0x5d71c4[_0x8752('0x28')][_0x8752('0x37')]});}else{logger['info'](_0x8752('0x38'));return BPromise[_0x8752('0x27')]({'id':_0x816e60[_0x8752('0x39')],'email':_0x45f39d[_0x8752('0x33')],'name':_0x8752('0x3a')});}})[_0x8752('0x2b')](function(_0x1de8e3){var _0x106641=_0x1de8e3['statusCode']||0x1f4;logger['error'](_0x8752('0x2e'),'getUser',_0x106641,JSON['stringify'](_0x1de8e3));});}else{logger[_0x8752('0x18')](_0x8752('0x38'));return BPromise['resolve']({'id':_0x816e60[_0x8752('0x39')],'email':_0x45f39d['username'],'name':'admin'})['catch'](function(_0x19bbfe){var _0x583f1b=_0x19bbfe[_0x8752('0x2c')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x8752('0x3b'),_0x583f1b,JSON[_0x8752('0x24')](_0x19bbfe));});}}function getEndUser(_0x295f04,_0x5e74fe,_0x43e8b4,_0x31923b){logger[_0x8752('0x18')](_0x8752('0x3c'),_0x43e8b4);return request({'method':'GET','uri':util[_0x8752('0x29')](_0x8752('0x1f'),_0x295f04[_0x8752('0x20')]),'qs':{'operation':_0x8752('0x32'),'username':_0x295f04['username'],'sessionName':_0x31923b[_0x8752('0x22')],'query':util[_0x8752('0x29')](_0x8752('0x3d'),_0x43e8b4,_0x43e8b4,_0x43e8b4,_0x43e8b4,_0x43e8b4)},'json':!![]})[_0x8752('0x25')](function(_0x437f06){if(_0x437f06['success']&&_0x437f06['result'][_0x8752('0x3e')]){logger['info'](_0x8752('0x3f'));return BPromise['resolve']({'id':_0x437f06[_0x8752('0x28')][0x0]['id'],'name':_0x437f06[_0x8752('0x28')][0x0]['firstname']+'\x20'+_0x437f06[_0x8752('0x28')][0x0][_0x8752('0x40')],'phone':_0x43e8b4});}else{logger['info'](_0x8752('0x41'));return request({'method':_0x8752('0x42'),'uri':util[_0x8752('0x29')](_0x8752('0x1f'),_0x295f04[_0x8752('0x20')]),'form':{'operation':_0x8752('0x21'),'sessionName':_0x31923b[_0x8752('0x22')],'elementType':_0x8752('0x43'),'element':JSON[_0x8752('0x24')]({'lastname':_0x5e74fe,'phone':_0x43e8b4,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x70f4fe){logger[_0x8752('0x18')](_0x8752('0x44'));return BPromise[_0x8752('0x27')]({'id':_0x70f4fe['result']['id'],'name':_0x70f4fe[_0x8752('0x28')][_0x8752('0x40')],'phone':_0x70f4fe['result'][_0x8752('0x45')]});})['catch'](function(_0x8f333b){var _0x48c5ef=_0x8f333b[_0x8752('0x2c')]||0x1f4;logger[_0x8752('0x2d')](_0x8752('0x2e'),_0x8752('0x46'),_0x48c5ef,JSON[_0x8752('0x24')](_0x8f333b));});}});}function getConnection(_0x2b655e){var _0x5d6330=_0x2b655e[_0x8752('0x33')];var _0x43aba4=_0x2b655e['accessKey'];return request({'method':_0x8752('0x31'),'uri':util['format'](_0x8752('0x1f'),_0x2b655e[_0x8752('0x20')]),'qs':{'operation':_0x8752('0x47'),'username':_0x5d6330},'json':!![]})[_0x8752('0x25')](function(_0x23aa74){if(_0x23aa74[_0x8752('0x26')]){return request({'method':_0x8752('0x42'),'uri':util[_0x8752('0x29')]('%s/webservice.php',_0x2b655e['remoteUri']),'form':{'operation':_0x8752('0x48'),'username':_0x5d6330,'accessKey':md5(_0x23aa74['result']['token']+_0x43aba4)},'json':!![]});}})[_0x8752('0x25')](function(_0x529d97){if(_0x529d97[_0x8752('0x26')]){return BPromise[_0x8752('0x27')](_0x529d97['result']);}else{throw new Error(util['format'](_0x8752('0x49'),_0x2b655e['id']));}})[_0x8752('0x2b')](function(_0x6836b9){var _0x33e6ed=_0x6836b9['statusCode']||0x1f4;logger[_0x8752('0x2d')](_0x8752('0x2e'),_0x8752('0x4a'),_0x33e6ed,JSON[_0x8752('0x24')](_0x6836b9));});}function request(_0x4876dd){logger[_0x8752('0x18')]('[HTTP]',JSON[_0x8752('0x24')](_0x4876dd));return rp(_0x4876dd);}exports[_0x8752('0x4b')]=function(_0x3b53af,_0x2fcabd,_0x5ecfbb,_0x501309,_0x259e75,_0x437dda){var _0x17e1cc,_0x30d925,_0x21ea87,_0x562803;_0x437dda[_0x8752('0x20')]=intUtil[_0x8752('0x4c')](_0x437dda[_0x8752('0x20')]);if(_0x259e75&&_0x259e75[_0x8752('0x4d')]){logger['info'](_0x8752('0x4e'),_0x8752('0x4f'));_0x2fcabd['recordingURL']=util[_0x8752('0x29')](_0x8752('0x50'),_0x437dda[_0x8752('0x51')],_0x2fcabd[_0x8752('0x52')],md5(_0x2fcabd[_0x8752('0x52')]));}else{_0x2fcabd['recordingURL']='';}return getConnection(_0x437dda)[_0x8752('0x25')](function(_0x3684b9){_0x562803=_0x3684b9;return getUser(_0x437dda,_0x501309[_0x8752('0x53')],_0x562803);})[_0x8752('0x25')](function(_0x250931){_0x17e1cc=_0x250931;logger['info'](_0x8752('0x54'),_0x17e1cc['id']);return getEndUser(_0x437dda,_0x2fcabd[_0x8752('0x55')],_0x2fcabd[_0x8752('0x56')],_0x562803);})[_0x8752('0x25')](function(_0x312220){_0x30d925=_0x312220;logger[_0x8752('0x18')](_0x8752('0x57'),_0x30d925['id']);return createTicket(_0x437dda,_0x17e1cc,_0x30d925,_0x5ecfbb,_0x2fcabd,_0x5ecfbb[_0x8752('0x58')],_0x562803);})[_0x8752('0x25')](function(_0x4ec3dc){_0x21ea87=_0x4ec3dc;logger[_0x8752('0x18')](_0x8752('0x59'));logger[_0x8752('0x18')](_0x8752('0x5a'),_0x21ea87['id']);var _0xab156c=util[_0x8752('0x29')](_0x8752('0x5b'),_0x437dda[_0x8752('0x20')],_['split'](_0x21ea87['id'],'x')[0x1]);logger['info']('[QUEUE]',_0x8752('0x5c'));emit(util[_0x8752('0x29')]('user:%s',_0x501309['name']),'trigger:browser:url',{'uri':_0xab156c});})[_0x8752('0x2b')](function(_0xf10784){logger[_0x8752('0x2d')]('[QUEUE]',JSON[_0x8752('0x24')](_0xf10784));});};exports[_0x8752('0x5d')]=function(_0x315ff0,_0x7ffe32,_0x2c1c43,_0xf6a0f8,_0x1a61a4,_0x9b0965,_0x2325dd){var _0x326d50,_0x5647e1,_0x5afe91,_0x329314;_0x9b0965[_0x8752('0x20')]=intUtil[_0x8752('0x4c')](_0x9b0965[_0x8752('0x20')]);_0x9b0965[_0x8752('0x51')]=intUtil[_0x8752('0x4c')](_0x9b0965[_0x8752('0x51')]);if(_0x2325dd&&_0x2325dd[_0x8752('0x5e')]&&_0x2325dd[_0x8752('0x5e')]!==_0x8752('0x5f')){logger['info'](_0x8752('0x60'),_0x8752('0x4f'));_0x7ffe32[_0x8752('0x61')]=util['format'](_0x8752('0x50'),_0x9b0965[_0x8752('0x51')],_0x7ffe32[_0x8752('0x52')],md5(_0x7ffe32['uniqueid']));}return getConnection(_0x9b0965)[_0x8752('0x25')](function(_0x3273ac){_0x329314=_0x3273ac;return getUser(_0x9b0965,_0xf6a0f8['email'],_0x329314);})['then'](function(_0x447d82){_0x326d50=_0x447d82;logger[_0x8752('0x18')]('The\x20User\x20ID\x20is:',_0x326d50['id']);return getEndUser(_0x9b0965,_0x7ffe32[_0x8752('0x62')],_0x7ffe32['destcalleridnum'],_0x329314);})[_0x8752('0x25')](function(_0x3cdc74){_0x5647e1=_0x3cdc74;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5647e1['id']);return createTicket(_0x9b0965,_0x326d50,_0x5647e1,_0x2c1c43,_0x7ffe32,_0x2c1c43[_0x8752('0x58')],_0x329314);})['then'](function(_0x4b774c){_0x5afe91=_0x4b774c;logger[_0x8752('0x18')](_0x8752('0x59'));logger[_0x8752('0x18')](_0x8752('0x5a'),_0x5afe91['id']);var _0x2910d6=util[_0x8752('0x29')](_0x8752('0x5b'),_0x9b0965[_0x8752('0x20')],_['split'](_0x5afe91['id'],'x')[0x1]);logger[_0x8752('0x18')](_0x8752('0x60'),_0x8752('0x5c'));emit(util[_0x8752('0x29')](_0x8752('0x63'),_0xf6a0f8[_0x8752('0x16')]),_0x8752('0x64'),{'uri':_0x2910d6});})[_0x8752('0x2b')](function(_0x395f72){logger[_0x8752('0x2d')]('[OUTBOUND]',JSON[_0x8752('0x24')](_0x395f72));});};exports[_0x8752('0x65')]=function(_0x3074f8,_0x51aff0,_0x483482,_0x2b3626,_0x225efa,_0x133804){var _0x11d0a6,_0x377ae5,_0x10826a,_0x5a77d6;_0x133804['remoteUri']=intUtil[_0x8752('0x4c')](_0x133804[_0x8752('0x20')]);_0x133804[_0x8752('0x51')]=intUtil[_0x8752('0x4c')](_0x133804[_0x8752('0x51')]);if(_0x225efa&&_0x225efa[_0x8752('0x4d')]){logger[_0x8752('0x18')]('['+_0x51aff0['lastevent'][_0x8752('0x66')]()+']',_0x8752('0x4f'));_0x51aff0[_0x8752('0x61')]=util['format'](_0x8752('0x50'),_0x133804[_0x8752('0x51')],_0x51aff0[_0x8752('0x52')],md5(_0x51aff0[_0x8752('0x52')]));}else{_0x51aff0[_0x8752('0x61')]='';}return getConnection(_0x133804)[_0x8752('0x25')](function(_0x50bf70){_0x5a77d6=_0x50bf70;return getUser(_0x133804,'',_0x5a77d6);})[_0x8752('0x25')](function(_0x203f3f){_0x11d0a6=_0x203f3f;logger[_0x8752('0x18')](_0x8752('0x54'),_0x11d0a6['id']);return getEndUser(_0x133804,_0x51aff0['calleridname'],_0x51aff0[_0x8752('0x56')],_0x5a77d6);})[_0x8752('0x25')](function(_0x9dd90e){_0x377ae5=_0x9dd90e;logger['info'](_0x8752('0x57'),_0x377ae5['id']);return createTicket(_0x133804,_0x11d0a6,_0x377ae5,_0x483482,_0x51aff0,_0x483482[_0x8752('0x58')],_0x5a77d6);})[_0x8752('0x25')](function(_0xa60228){_0x10826a=_0xa60228;logger[_0x8752('0x18')]('Ticket\x20created!');logger[_0x8752('0x18')](_0x8752('0x5a'),_0x10826a['id']);})['catch'](function(_0x4d864){logger[_0x8752('0x2d')]('['+_0x51aff0[_0x8752('0x67')]['toUpperCase']()+']',JSON[_0x8752('0x24')](_0x4d864));});}; \ No newline at end of file +var _0xde1a=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','toUpperCase','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Open','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x3a6f2a,_0x4fe258){var _0x5c3430=function(_0x360e92){while(--_0x360e92){_0x3a6f2a['push'](_0x3a6f2a['shift']());}};_0x5c3430(++_0x4fe258);}(_0xde1a,0x74));var _0xade1=function(_0xa9111b,_0x405a1a){_0xa9111b=_0xa9111b-0x0;var _0x5f5067=_0xde1a[_0xa9111b];return _0x5f5067;};'use strict';var _=require(_0xade1('0x0'));var rp=require(_0xade1('0x1'));var BPromise=require(_0xade1('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0xade1('0x3'));var intUtil=require('./util');var config=require(_0xade1('0x4'));var logger=require('../../../../config/logger')(_0xade1('0x5'));config[_0xade1('0x6')]=_[_0xade1('0x7')](config[_0xade1('0x6')],{'host':_0xade1('0x8'),'port':0x18eb});var io=require(_0xade1('0x9'))(new Redis(config[_0xade1('0x6')]));function emit(_0x478fd5,_0x3bd4a9,_0x1cd361){io['to'](_0x478fd5)['emit'](_0x3bd4a9,_0x1cd361);}function getCustomFields(_0x25a033,_0xc66051){var _0x517e6c={};if(_0x25a033[_0xade1('0xa')]>0x0){_[_0xade1('0xb')](_0x25a033,function(_0x428544){if(_0x428544[_0xade1('0xc')]===_0xade1('0xd')&&_0x428544[_0xade1('0xe')]){_0x517e6c[_0x428544[_0xade1('0xe')]]=_0x428544['content'][_0xade1('0xf')]();}else if(_0x428544[_0xade1('0xc')]===_0xade1('0x10')&&_0x428544[_0xade1('0x11')]&&_0x428544[_0xade1('0xe')]&&_0xc66051[_0x428544[_0xade1('0x11')]]){_0x517e6c[_0x428544[_0xade1('0xe')]]=_0xc66051[_0x428544['variableName']]['toString']();}else if(_0x428544[_0xade1('0xc')]===_0xade1('0x12')&&_0x428544[_0xade1('0x13')]&&_0x428544[_0xade1('0x13')][_0xade1('0x14')]&&_0x428544[_0xade1('0xe')]&&_0xc66051[_0x428544[_0xade1('0x13')][_0xade1('0x14')][_0xade1('0x15')]()]){_0x517e6c[_0x428544[_0xade1('0xe')]]=_0xc66051[_0x428544[_0xade1('0x13')][_0xade1('0x14')][_0xade1('0x15')]()][_0xade1('0xf')]();}});}return _0x517e6c;}function createTicket(_0x4c5c0e,_0x1877c1,_0x15760e,_0x567698,_0x115b54,_0x42d104,_0x2f5895){logger[_0xade1('0x16')]('Creating\x20new\x20ticket...');var _0x270cbd=_[_0xade1('0x17')]({'parent_id':'','assigned_user_id':_0x1877c1['id'],'ticketpriorities':'Normal','ticketstatus':_0xade1('0x18'),'ticket_title':intUtil['getString'](_0x567698[_0xade1('0x19')],_0x115b54,'\x20'),'description':intUtil['getString'](_0x567698[_0xade1('0x1a')],_0x115b54,'\x0a'),'contact_id':_0x15760e['id']},getCustomFields(_0x42d104,_0x115b54));var _0x40f05c={'method':_0xade1('0x1b'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0x4c5c0e[_0xade1('0x1e')]),'form':{'operation':_0xade1('0x1f'),'username':_0x4c5c0e[_0xade1('0x20')],'sessionName':_0x2f5895[_0xade1('0x21')],'elementType':_0xade1('0x22'),'element':JSON[_0xade1('0x23')](_0x270cbd)},'json':!![]};return request(_0x40f05c)[_0xade1('0x24')](function(_0xbe97bc){if(_0xbe97bc[_0xade1('0x25')]){return BPromise[_0xade1('0x26')]({'id':_0xbe97bc[_0xade1('0x27')]['id']});}else{throw new Error(util['format'](_0xade1('0x28'),JSON[_0xade1('0x23')](_0xbe97bc[_0xade1('0x29')])));}})[_0xade1('0x2a')](function(_0x56d5b1){var _0x1bbccf=_0x56d5b1[_0xade1('0x2b')]||0x1f4;logger['error'](_0xade1('0x2c'),'createTicket',_0x1bbccf,JSON[_0xade1('0x23')](_0x56d5b1));});}function getUser(_0xb8919,_0x10e83a,_0x544c1b){if(intUtil[_0xade1('0x2d')](_0x10e83a)){logger[_0xade1('0x16')](_0xade1('0x2e'),_0x10e83a);return request({'method':_0xade1('0x2f'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0xb8919[_0xade1('0x1e')]),'qs':{'operation':_0xade1('0x30'),'username':_0xb8919[_0xade1('0x20')],'sessionName':_0x544c1b['sessionName'],'query':util[_0xade1('0x1c')](_0xade1('0x31'),_0x10e83a)},'json':!![]})[_0xade1('0x24')](function(_0x1d1fd0){if(_0x1d1fd0[_0xade1('0x25')]&&_0x1d1fd0[_0xade1('0x27')][_0xade1('0xa')]){logger[_0xade1('0x16')](_0xade1('0x32'));return BPromise[_0xade1('0x26')]({'id':_0x1d1fd0[_0xade1('0x27')][0x0]['id'],'email':_0x1d1fd0[_0xade1('0x27')][0x0]['email1'],'name':_0x1d1fd0[_0xade1('0x27')][0x0]['first_name']+'\x20'+_0x1d1fd0['result'][_0xade1('0x33')]});}else{logger['info'](_0xade1('0x34'));return BPromise['resolve']({'id':_0x544c1b[_0xade1('0x35')],'email':_0xb8919[_0xade1('0x20')],'name':_0xade1('0x36')});}})[_0xade1('0x2a')](function(_0x427a30){var _0x11d77c=_0x427a30['statusCode']||0x1f4;logger[_0xade1('0x29')](_0xade1('0x2c'),_0xade1('0x37'),_0x11d77c,JSON[_0xade1('0x23')](_0x427a30));});}else{logger[_0xade1('0x16')](_0xade1('0x34'));return BPromise['resolve']({'id':_0x544c1b[_0xade1('0x35')],'email':_0xb8919[_0xade1('0x20')],'name':_0xade1('0x36')})[_0xade1('0x2a')](function(_0x451a35){var _0x5ec68a=_0x451a35[_0xade1('0x2b')]||0x1f4;logger['error'](_0xade1('0x2c'),_0xade1('0x37'),_0x5ec68a,JSON['stringify'](_0x451a35));});}}function getEndUser(_0x219836,_0xc7b5cd,_0x4a7375,_0x2121f8){logger[_0xade1('0x16')](_0xade1('0x38'),_0x4a7375);return request({'method':_0xade1('0x2f'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0x219836[_0xade1('0x1e')]),'qs':{'operation':_0xade1('0x30'),'username':_0x219836['username'],'sessionName':_0x2121f8[_0xade1('0x21')],'query':util[_0xade1('0x1c')](_0xade1('0x39'),_0x4a7375,_0x4a7375,_0x4a7375,_0x4a7375,_0x4a7375)},'json':!![]})[_0xade1('0x24')](function(_0x511487){if(_0x511487['success']&&_0x511487[_0xade1('0x27')][_0xade1('0xa')]){logger[_0xade1('0x16')](_0xade1('0x3a'));return BPromise[_0xade1('0x26')]({'id':_0x511487['result'][0x0]['id'],'name':_0x511487[_0xade1('0x27')][0x0][_0xade1('0x3b')]+'\x20'+_0x511487['result'][0x0][_0xade1('0x3c')],'phone':_0x4a7375});}else{logger['info'](_0xade1('0x3d'));return request({'method':_0xade1('0x1b'),'uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0x219836['remoteUri']),'form':{'operation':'create','sessionName':_0x2121f8[_0xade1('0x21')],'elementType':_0xade1('0x3e'),'element':JSON['stringify']({'lastname':_0xc7b5cd,'phone':_0x4a7375,'assigned_user_id':'\x20'})},'json':!![]})[_0xade1('0x24')](function(_0x3b0abc){logger['info'](_0xade1('0x3f'));return BPromise[_0xade1('0x26')]({'id':_0x3b0abc['result']['id'],'name':_0x3b0abc[_0xade1('0x27')][_0xade1('0x3c')],'phone':_0x3b0abc[_0xade1('0x27')][_0xade1('0x40')]});})[_0xade1('0x2a')](function(_0x23a36b){var _0x41884a=_0x23a36b[_0xade1('0x2b')]||0x1f4;logger[_0xade1('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xade1('0x41'),_0x41884a,JSON[_0xade1('0x23')](_0x23a36b));});}});}function getConnection(_0xa3fc28){var _0x1a4c6f=_0xa3fc28['username'];var _0x2a3249=_0xa3fc28[_0xade1('0x42')];return request({'method':'GET','uri':util[_0xade1('0x1c')](_0xade1('0x1d'),_0xa3fc28[_0xade1('0x1e')]),'qs':{'operation':_0xade1('0x43'),'username':_0x1a4c6f},'json':!![]})['then'](function(_0x3d7378){if(_0x3d7378[_0xade1('0x25')]){return request({'method':_0xade1('0x1b'),'uri':util[_0xade1('0x1c')]('%s/webservice.php',_0xa3fc28[_0xade1('0x1e')]),'form':{'operation':_0xade1('0x44'),'username':_0x1a4c6f,'accessKey':md5(_0x3d7378[_0xade1('0x27')]['token']+_0x2a3249)},'json':!![]});}})[_0xade1('0x24')](function(_0x48b5e5){if(_0x48b5e5[_0xade1('0x25')]){return BPromise[_0xade1('0x26')](_0x48b5e5[_0xade1('0x27')]);}else{throw new Error(util[_0xade1('0x1c')]('Account\x20%d\x20is\x20not\x20valid',_0xa3fc28['id']));}})[_0xade1('0x2a')](function(_0x5f04cb){var _0x569a1e=_0x5f04cb[_0xade1('0x2b')]||0x1f4;logger[_0xade1('0x29')](_0xade1('0x2c'),_0xade1('0x45'),_0x569a1e,JSON['stringify'](_0x5f04cb));});}function request(_0x1160e9){logger['info'](_0xade1('0x46'),JSON['stringify'](_0x1160e9));return rp(_0x1160e9);}exports[_0xade1('0x47')]=function(_0x2e4dec,_0x2959ba,_0x5eafac,_0x47998b,_0x581825,_0x5072fe){var _0x1d01b6,_0x48f1ad,_0x2b74b6,_0x6a199c;_0x5072fe[_0xade1('0x1e')]=intUtil[_0xade1('0x48')](_0x5072fe[_0xade1('0x1e')]);if(_0x581825&&_0x581825['monitor_format']){logger['info'](_0xade1('0x49'),_0xade1('0x4a'));_0x2959ba[_0xade1('0x4b')]=util[_0xade1('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5072fe[_0xade1('0x4c')],_0x2959ba[_0xade1('0x4d')],md5(_0x2959ba['uniqueid']));}else{_0x2959ba[_0xade1('0x4b')]='';}return getConnection(_0x5072fe)[_0xade1('0x24')](function(_0x4adb93){_0x6a199c=_0x4adb93;return getUser(_0x5072fe,_0x47998b[_0xade1('0x4e')],_0x6a199c);})['then'](function(_0x171ca6){_0x1d01b6=_0x171ca6;logger[_0xade1('0x16')](_0xade1('0x4f'),_0x1d01b6['id']);return getEndUser(_0x5072fe,_0x2959ba['calleridname'],_0x2959ba[_0xade1('0x50')],_0x6a199c);})[_0xade1('0x24')](function(_0xc1f047){_0x48f1ad=_0xc1f047;logger[_0xade1('0x16')](_0xade1('0x51'),_0x48f1ad['id']);return createTicket(_0x5072fe,_0x1d01b6,_0x48f1ad,_0x5eafac,_0x2959ba,_0x5eafac['Fields'],_0x6a199c);})[_0xade1('0x24')](function(_0x4fb8c5){_0x2b74b6=_0x4fb8c5;logger[_0xade1('0x16')](_0xade1('0x52'));logger[_0xade1('0x16')](_0xade1('0x53'),_0x2b74b6['id']);var _0x28b00b=util[_0xade1('0x1c')](_0xade1('0x54'),_0x5072fe['remoteUri'],_[_0xade1('0x55')](_0x2b74b6['id'],'x')[0x1]);logger[_0xade1('0x16')](_0xade1('0x49'),_0xade1('0x56'));emit(util['format'](_0xade1('0x57'),_0x47998b[_0xade1('0x14')]),_0xade1('0x58'),{'uri':_0x28b00b});})[_0xade1('0x2a')](function(_0x453c24){logger[_0xade1('0x29')](_0xade1('0x49'),JSON[_0xade1('0x23')](_0x453c24));});};exports[_0xade1('0x59')]=function(_0x92bb29,_0x29797d,_0x4a03c2,_0x249c09,_0x535c7f,_0x168f79,_0x533f5d){var _0x14dcc8,_0x2842b8,_0x589fb3,_0x2c93de;_0x168f79[_0xade1('0x1e')]=intUtil[_0xade1('0x48')](_0x168f79['remoteUri']);_0x168f79[_0xade1('0x4c')]=intUtil[_0xade1('0x48')](_0x168f79[_0xade1('0x4c')]);if(_0x533f5d&&_0x533f5d[_0xade1('0x5a')]&&_0x533f5d[_0xade1('0x5a')]!==_0xade1('0x5b')){logger['info'](_0xade1('0x5c'),'Recording\x20is\x20enabled!');_0x29797d['recordingURL']=util[_0xade1('0x1c')](_0xade1('0x5d'),_0x168f79[_0xade1('0x4c')],_0x29797d[_0xade1('0x4d')],md5(_0x29797d[_0xade1('0x4d')]));}return getConnection(_0x168f79)[_0xade1('0x24')](function(_0x3ba6f7){_0x2c93de=_0x3ba6f7;return getUser(_0x168f79,_0x249c09['email'],_0x2c93de);})[_0xade1('0x24')](function(_0x7605aa){_0x14dcc8=_0x7605aa;logger[_0xade1('0x16')](_0xade1('0x4f'),_0x14dcc8['id']);return getEndUser(_0x168f79,_0x29797d[_0xade1('0x5e')],_0x29797d[_0xade1('0x5f')],_0x2c93de);})[_0xade1('0x24')](function(_0x3d071c){_0x2842b8=_0x3d071c;logger[_0xade1('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2842b8['id']);return createTicket(_0x168f79,_0x14dcc8,_0x2842b8,_0x4a03c2,_0x29797d,_0x4a03c2[_0xade1('0x60')],_0x2c93de);})[_0xade1('0x24')](function(_0x41f808){_0x589fb3=_0x41f808;logger['info'](_0xade1('0x52'));logger['info'](_0xade1('0x53'),_0x589fb3['id']);var _0x3c5267=util[_0xade1('0x1c')](_0xade1('0x54'),_0x168f79['remoteUri'],_[_0xade1('0x55')](_0x589fb3['id'],'x')[0x1]);logger[_0xade1('0x16')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xade1('0x1c')](_0xade1('0x57'),_0x249c09[_0xade1('0x14')]),_0xade1('0x58'),{'uri':_0x3c5267});})[_0xade1('0x2a')](function(_0x257e78){logger['error']('[OUTBOUND]',JSON['stringify'](_0x257e78));});};exports['unmanaged']=function(_0xbb312c,_0x41ee98,_0x1cc867,_0x5edc9f,_0x32f857,_0x3f6d3f){var _0x2f1c26,_0x52ece2,_0x3ed11f,_0xde158f;_0x3f6d3f['remoteUri']=intUtil[_0xade1('0x48')](_0x3f6d3f[_0xade1('0x1e')]);_0x3f6d3f[_0xade1('0x4c')]=intUtil[_0xade1('0x48')](_0x3f6d3f[_0xade1('0x4c')]);if(_0x32f857&&_0x32f857['monitor_format']){logger[_0xade1('0x16')]('['+_0x41ee98['lastevent'][_0xade1('0x61')]()+']','Recording\x20is\x20enabled!');_0x41ee98[_0xade1('0x4b')]=util[_0xade1('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f6d3f['serverUrl'],_0x41ee98['uniqueid'],md5(_0x41ee98[_0xade1('0x4d')]));}else{_0x41ee98['recordingURL']='';}return getConnection(_0x3f6d3f)['then'](function(_0x514ae9){_0xde158f=_0x514ae9;return getUser(_0x3f6d3f,'',_0xde158f);})['then'](function(_0x358eb0){_0x2f1c26=_0x358eb0;logger[_0xade1('0x16')]('The\x20User\x20ID\x20is:',_0x2f1c26['id']);return getEndUser(_0x3f6d3f,_0x41ee98['calleridname'],_0x41ee98['calleridnum'],_0xde158f);})[_0xade1('0x24')](function(_0x289ac2){_0x52ece2=_0x289ac2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x52ece2['id']);return createTicket(_0x3f6d3f,_0x2f1c26,_0x52ece2,_0x1cc867,_0x41ee98,_0x1cc867[_0xade1('0x60')],_0xde158f);})[_0xade1('0x24')](function(_0x29f057){_0x3ed11f=_0x29f057;logger[_0xade1('0x16')](_0xade1('0x52'));logger[_0xade1('0x16')]('The\x20Ticket\x20ID\x20is:',_0x3ed11f['id']);})[_0xade1('0x2a')](function(_0x1031cb){logger[_0xade1('0x29')]('['+_0x41ee98[_0xade1('0x62')]['toUpperCase']()+']',JSON[_0xade1('0x23')](_0x1031cb));});}; \ 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 6345b3f..0d885dc 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 _0x4685=['emit','application/json','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','type:user\x20role:end-user\x20phone:%s','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','custom_fields','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x4a269e,_0x2ea315){var _0x5c1c30=function(_0x5b6346){while(--_0x5b6346){_0x4a269e['push'](_0x4a269e['shift']());}};_0x5c1c30(++_0x2ea315);}(_0x4685,0x6a));var _0x5468=function(_0x24bd05,_0x1e9f80){_0x24bd05=_0x24bd05-0x0;var _0x142073=_0x4685[_0x24bd05];return _0x142073;};'use strict';var _=require(_0x5468('0x0'));var rp=require(_0x5468('0x1'));var md5=require(_0x5468('0x2'));var util=require(_0x5468('0x3'));var Redis=require(_0x5468('0x4'));var intUtil=require('./util');var config=require(_0x5468('0x5'));var logger=require(_0x5468('0x6'))('zendesk');config[_0x5468('0x7')]=_[_0x5468('0x8')](config['redis'],{'host':_0x5468('0x9'),'port':0x18eb});var io=require(_0x5468('0xa'))(new Redis(config[_0x5468('0x7')]));function emit(_0x2c8c51,_0x33c933,_0x5ada72){io['to'](_0x2c8c51)[_0x5468('0xb')](_0x33c933,_0x5ada72);}var headers={'Content-Type':_0x5468('0xc'),'Accept':_0x5468('0xc')};function getTicket(_0x2a0f01,_0x1428b9,_0x29a78d,_0x2684f2,_0x55180e){logger['info'](_0x5468('0xd'));return request({'uri':util[_0x5468('0xe')]('%s/tickets.json',_0x2a0f01['remoteUri']),'method':_0x5468('0xf'),'body':{'ticket':_[_0x5468('0x10')]({'requester_id':_0x29a78d['id'],'submitter_id':_0x1428b9?_0x1428b9['id']:undefined,'assignee_id':_0x1428b9?_0x1428b9['id']:undefined,'tags':getTags(_0x2684f2[_0x5468('0x11')],_0x5468('0x12')),'subject':intUtil[_0x5468('0x13')](_0x2684f2[_0x5468('0x14')],_0x55180e,'\x20'),'description':intUtil[_0x5468('0x13')](_0x2684f2[_0x5468('0x15')],_0x55180e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5468('0x13')](_0x2684f2['Descriptions'],_0x55180e,'\x0a')}},getCustomFields(_0x2684f2[_0x5468('0x16')],_0x55180e))}})[_0x5468('0x17')](function(_0x4451d4){logger[_0x5468('0x18')](_0x5468('0x19'));return _0x4451d4['ticket'];});}function getUser(_0x49c73c,_0x4b855d){if(intUtil[_0x5468('0x1a')](_0x4b855d)){logger[_0x5468('0x18')](_0x5468('0x1b'),_0x4b855d);return request({'uri':util[_0x5468('0xe')](_0x5468('0x1c'),_0x49c73c[_0x5468('0x1d')]),'qs':{'query':util[_0x5468('0xe')](_0x5468('0x1e'),_0x4b855d)}})['then'](function(_0x380d6e){if(_0x380d6e[_0x5468('0x1f')]){logger[_0x5468('0x18')](_0x5468('0x20'));return _[_0x5468('0x21')](_0x380d6e[_0x5468('0x22')],{'email':_0x4b855d,'role':_0x5468('0x23')});}else{logger[_0x5468('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5468('0xe')](_0x5468('0x24'),_0x49c73c[_0x5468('0x1d')])})['then'](function(_0x4d6a1b){logger['info'](_0x5468('0x25'));return _0x4d6a1b['user'];});}});}else{logger[_0x5468('0x18')](_0x5468('0x26'));return request({'uri':util[_0x5468('0xe')](_0x5468('0x24'),_0x49c73c[_0x5468('0x1d')])})[_0x5468('0x17')](function(_0x2e4345){logger[_0x5468('0x18')]('Admin\x20account\x20selected.');return _0x2e4345[_0x5468('0x27')];});}}function getEndUser(_0x1ff967,_0xe8dab8,_0x3122f3){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3122f3);return request({'uri':util[_0x5468('0xe')](_0x5468('0x1c'),_0x1ff967['remoteUri']),'qs':{'query':util[_0x5468('0xe')](_0x5468('0x28'),_0x3122f3)}})[_0x5468('0x17')](function(_0x44b2c1){var _0x513d56;if(_0x44b2c1[_0x5468('0x22')]['length']){_0x44b2c1[_0x5468('0x22')]=_['filter'](_0x44b2c1[_0x5468('0x22')],{'suspended':![],'role':_0x5468('0x29')});if(_0x44b2c1[_0x5468('0x22')][_0x5468('0x2a')]){_0x513d56=_[_0x5468('0x2b')](_0x44b2c1['results']);}}if(_0x513d56){logger[_0x5468('0x18')](_0x5468('0x2c'));return _0x513d56;}else{logger['info'](_0x5468('0x2d'));return request({'uri':util[_0x5468('0xe')](_0x5468('0x2e'),_0x1ff967[_0x5468('0x1d')]),'method':'POST','body':{'user':{'role':'end-user','name':util['format'](_0x5468('0x2f'),_0xe8dab8||_0x3122f3),'phone':_0x3122f3}}})[_0x5468('0x17')](function(_0x302870){logger[_0x5468('0x18')](_0x5468('0x30'));return _0x302870[_0x5468('0x27')];});}});}function getAuth(_0x5c3f25){var _0x16ed7f;if(_0x5c3f25[_0x5468('0x31')]===_0x5468('0x32')){_0x16ed7f=util[_0x5468('0xe')](_0x5468('0x33'),_0x5c3f25['username'],_0x5c3f25['password']);}else if(_0x5c3f25['authType']===_0x5468('0x34')){_0x16ed7f=util[_0x5468('0xe')](_0x5468('0x35'),_0x5c3f25[_0x5468('0x36')],_0x5c3f25[_0x5468('0x34')]);}return util[_0x5468('0xe')](_0x5468('0x37'),new Buffer(_0x16ed7f)[_0x5468('0x38')](_0x5468('0x39')));}function request(_0x5339fd){logger[_0x5468('0x3a')](_0x5468('0x3b'),JSON[_0x5468('0x3c')](_0x5339fd));return rp(_['defaults'](_0x5339fd,{'method':_0x5468('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x546291,_0x2cc70f){var _0x82a477=[];if(_0x546291&&_0x546291[_0x5468('0x2a')]>0x0){_0x82a477=_[_0x5468('0x3e')](_0x546291,_0x2cc70f);}return _0x82a477;}function getCustomFields(_0x5e942e,_0x2fd650){var _0x285ced=[];var _0x32538a={'custom_fields':[]};if(_0x5e942e[_0x5468('0x2a')]>0x0){_[_0x5468('0x3f')](_0x5e942e,function(_0x1eb98e){if(_0x1eb98e[_0x5468('0x40')]===_0x5468('0x41')&&_0x1eb98e[_0x5468('0x42')]&&!_0x1eb98e[_0x5468('0x43')]){_0x32538a[_0x1eb98e[_0x5468('0x42')][_0x5468('0x44')]()]=_0x1eb98e[_0x5468('0x45')]['toString']();}else if(_0x1eb98e[_0x5468('0x40')]==='string'&&_0x1eb98e[_0x5468('0x46')]&&_0x1eb98e[_0x5468('0x43')]){_0x32538a['custom_fields'][_0x5468('0x47')]({'id':_0x1eb98e[_0x5468('0x46')],'value':_0x1eb98e[_0x5468('0x45')]['toString']()});}else if(_0x1eb98e[_0x5468('0x40')]===_0x5468('0x48')&&_0x1eb98e['variableName']&&_0x1eb98e[_0x5468('0x46')]&&_0x1eb98e[_0x5468('0x43')]){_0x2fd650[_0x1eb98e['variableName']]&&_0x32538a[_0x5468('0x49')][_0x5468('0x47')]({'id':_0x1eb98e[_0x5468('0x46')],'value':_0x2fd650[_0x1eb98e[_0x5468('0x4a')]]['toString']()});}else if(_0x1eb98e[_0x5468('0x40')]===_0x5468('0x4b')&&_0x1eb98e[_0x5468('0x4c')]&&_0x1eb98e['Variable'][_0x5468('0x12')]&&_0x1eb98e['idField']&&_0x1eb98e['customField']){_0x2fd650[_0x1eb98e[_0x5468('0x4c')][_0x5468('0x12')][_0x5468('0x44')]()]&&_0x32538a[_0x5468('0x49')][_0x5468('0x47')]({'id':_0x1eb98e['idField'],'value':_0x2fd650[_0x1eb98e['Variable'][_0x5468('0x12')][_0x5468('0x44')]()][_0x5468('0x38')]()});}});}return _0x32538a;}exports[_0x5468('0x4d')]=function(_0x52b163,_0xc319f1,_0x3f1436,_0x3ecc54,_0x1c967e,_0x57baf5){var _0x3ac90a,_0x1cb1be;_0x57baf5[_0x5468('0x1d')]=intUtil[_0x5468('0x4e')](_0x57baf5[_0x5468('0x1d')]);_0x57baf5[_0x5468('0x4f')]=intUtil[_0x5468('0x4e')](_0x57baf5[_0x5468('0x4f')]);if(_0x1c967e&&_0x1c967e[_0x5468('0x50')]){logger['info'](_0x5468('0x51'),'Recording\x20is\x20enabled!');_0xc319f1[_0x5468('0x52')]=util[_0x5468('0xe')](_0x5468('0x53'),_0x57baf5[_0x5468('0x4f')],_0xc319f1['uniqueid'],md5(_0xc319f1['uniqueid']));}else{_0xc319f1[_0x5468('0x52')]='';}headers[_0x5468('0x54')]=getAuth(_0x57baf5);return getUser(_0x57baf5,_0x3ecc54[_0x5468('0x55')])['then'](function(_0x5ab6a3){_0x3ac90a=_0x5ab6a3;logger[_0x5468('0x18')](_0x5468('0x56'),_0x3ac90a['id']);return getEndUser(_0x57baf5,_0xc319f1[_0x5468('0x57')],_0xc319f1[_0x5468('0x58')]);})[_0x5468('0x17')](function(_0xa2eec4){_0x1cb1be=_0xa2eec4;logger['info'](_0x5468('0x59'),_0x1cb1be['id']);return getTicket(_0x57baf5,_0x3ac90a,_0x1cb1be,_0x3f1436,_0xc319f1);})[_0x5468('0x17')](function(_0x3a252e){if(_0x3a252e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3a252e['id']);switch(_0x57baf5[_0x5468('0x40')]){case _0x5468('0x5a'):logger[_0x5468('0x18')](_0x5468('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x5468('0x5b'),_0x57baf5[_0x5468('0x1d')],_0x3ac90a['id'],_0x3a252e['id']),'method':_0x5468('0xf')});case _0x5468('0x5c'):logger[_0x5468('0x18')](_0x5468('0x51'),_0x5468('0x5d'));emit(util[_0x5468('0xe')]('user:%s',_0x3ecc54[_0x5468('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x5468('0x5e'),_0x57baf5[_0x5468('0x1d')][_0x5468('0x5f')](_0x5468('0x60'),''),_0x3a252e['id'])});break;default:logger[_0x5468('0x61')](_0x5468('0x51'),_0x5468('0x62'));}}})[_0x5468('0x63')](function(_0x576868){logger[_0x5468('0x61')](_0x5468('0x64'),util[_0x5468('0x65')](_0x576868,{'showHidden':!![],'depth':null}));});};exports[_0x5468('0x66')]=function(_0xf447ea,_0x576384,_0x386a26,_0x4c752c,_0x1d8de0,_0x5baee0,_0x51ddc3){var _0x37c9c9,_0x52d72c;_0x5baee0[_0x5468('0x1d')]=intUtil[_0x5468('0x4e')](_0x5baee0[_0x5468('0x1d')]);_0x5baee0['serverUrl']=intUtil[_0x5468('0x4e')](_0x5baee0[_0x5468('0x4f')]);if(_0x51ddc3&&_0x51ddc3[_0x5468('0x67')]&&_0x51ddc3['recordingFormat']!=='none'){logger['info'](_0x5468('0x68'),_0x5468('0x69'));_0x576384[_0x5468('0x52')]=util[_0x5468('0xe')](_0x5468('0x53'),_0x5baee0[_0x5468('0x4f')],_0x576384[_0x5468('0x6a')],md5(_0x576384[_0x5468('0x6a')]));}headers[_0x5468('0x54')]=getAuth(_0x5baee0);return getUser(_0x5baee0,_0x4c752c['email'])[_0x5468('0x17')](function(_0x4e5962){_0x37c9c9=_0x4e5962;logger['info']('The\x20User\x20ID\x20is:',_0x37c9c9['id']);return getEndUser(_0x5baee0,_0x576384[_0x5468('0x6b')],_0x576384[_0x5468('0x6c')]);})[_0x5468('0x17')](function(_0x1b7532){_0x52d72c=_0x1b7532;logger[_0x5468('0x18')](_0x5468('0x59'),_0x52d72c['id']);return getTicket(_0x5baee0,_0x37c9c9,_0x52d72c,_0x386a26,_0x576384);})['then'](function(_0x30de2c){if(_0x30de2c){logger[_0x5468('0x18')](_0x5468('0x6d'),_0x30de2c['id']);switch(_0x5baee0[_0x5468('0x40')]){case _0x5468('0x5a'):logger[_0x5468('0x18')]('[OUTBOUND]',_0x5468('0x6e'));return request({'uri':util[_0x5468('0xe')](_0x5468('0x5b'),_0x5baee0[_0x5468('0x1d')],_0x37c9c9['id'],_0x30de2c['id']),'method':'POST'});case _0x5468('0x5c'):logger['info'](_0x5468('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5468('0xe')]('user:%s',_0x4c752c[_0x5468('0x12')]),_0x5468('0x6f'),{'uri':util[_0x5468('0xe')](_0x5468('0x5e'),_0x5baee0['remoteUri'][_0x5468('0x5f')](_0x5468('0x60'),''),_0x30de2c['id'])});break;default:logger[_0x5468('0x61')](_0x5468('0x68'),_0x5468('0x62'));}}})[_0x5468('0x63')](function(_0x454c3e){logger['error'](_0x5468('0x70'),util[_0x5468('0x65')](_0x454c3e,{'showHidden':!![],'depth':null}));});};exports[_0x5468('0x71')]=function(_0x1b7343,_0x42c42b,_0x35d81b,_0x4a65e8,_0x38cb65,_0x5dbb12){var _0x16b1ff,_0x46ff68;_0x5dbb12[_0x5468('0x1d')]=intUtil['stripTrailingSlash'](_0x5dbb12['remoteUri']);_0x5dbb12[_0x5468('0x4f')]=intUtil[_0x5468('0x4e')](_0x5dbb12['serverUrl']);if(_0x38cb65&&_0x38cb65['monitor_format']){logger[_0x5468('0x18')]('['+_0x42c42b[_0x5468('0x72')][_0x5468('0x73')]()+']','Recording\x20is\x20enabled!');_0x42c42b[_0x5468('0x52')]=util[_0x5468('0xe')](_0x5468('0x53'),_0x5dbb12[_0x5468('0x4f')],_0x42c42b['uniqueid'],md5(_0x42c42b[_0x5468('0x6a')]));}else{_0x42c42b[_0x5468('0x52')]='';}headers[_0x5468('0x54')]=getAuth(_0x5dbb12);return getUser(_0x5dbb12)[_0x5468('0x17')](function(_0x1a51d6){_0x16b1ff=_0x1a51d6;logger[_0x5468('0x18')]('The\x20User\x20ID\x20is:',_0x16b1ff['id']);return getEndUser(_0x5dbb12,_0x42c42b[_0x5468('0x57')],_0x42c42b[_0x5468('0x58')]);})[_0x5468('0x17')](function(_0xbcb0d7){_0x46ff68=_0xbcb0d7;logger[_0x5468('0x18')](_0x5468('0x59'),_0x46ff68['id']);return getTicket(_0x5dbb12,_0x16b1ff,_0x46ff68,_0x35d81b,_0x42c42b);})[_0x5468('0x17')](function(_0x1bfa38){if(_0x1bfa38){logger[_0x5468('0x18')]('The\x20Ticket\x20ID\x20is:',_0x1bfa38['id']);}})[_0x5468('0x63')](function(_0x4a1b47){logger['error']('['+_0x42c42b[_0x5468('0x72')][_0x5468('0x73')]()+']'+_0x5468('0x74'),util[_0x5468('0x65')](_0x4a1b47,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcb6a=['merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','nameField','toLowerCase','content','type','string','idField','customField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','calleridnum','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST'];(function(_0x30eefa,_0x31c8e3){var _0x33d130=function(_0x4edf14){while(--_0x4edf14){_0x30eefa['push'](_0x30eefa['shift']());}};_0x33d130(++_0x31c8e3);}(_0xcb6a,0x1b1));var _0xacb6=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xcb6a[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0xacb6('0x0'));var rp=require(_0xacb6('0x1'));var md5=require(_0xacb6('0x2'));var util=require('util');var Redis=require(_0xacb6('0x3'));var intUtil=require(_0xacb6('0x4'));var config=require(_0xacb6('0x5'));var logger=require(_0xacb6('0x6'))(_0xacb6('0x7'));config[_0xacb6('0x8')]=_[_0xacb6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xacb6('0xa'))(new Redis(config[_0xacb6('0x8')]));function emit(_0x1efe14,_0x2fd79b,_0x45e398){io['to'](_0x1efe14)[_0xacb6('0xb')](_0x2fd79b,_0x45e398);}var headers={'Content-Type':'application/json','Accept':_0xacb6('0xc')};function getTicket(_0x491707,_0x346e6e,_0x189407,_0x218d73,_0x509cbb){logger[_0xacb6('0xd')](_0xacb6('0xe'));return request({'uri':util[_0xacb6('0xf')](_0xacb6('0x10'),_0x491707[_0xacb6('0x11')]),'method':_0xacb6('0x12'),'body':{'ticket':_[_0xacb6('0x13')]({'requester_id':_0x189407['id'],'submitter_id':_0x346e6e?_0x346e6e['id']:undefined,'assignee_id':_0x346e6e?_0x346e6e['id']:undefined,'tags':getTags(_0x218d73['Tags'],_0xacb6('0x14')),'subject':intUtil[_0xacb6('0x15')](_0x218d73[_0xacb6('0x16')],_0x509cbb,'\x20'),'description':intUtil[_0xacb6('0x15')](_0x218d73[_0xacb6('0x17')],_0x509cbb,'\x0a'),'comment':{'public':![],'body':intUtil[_0xacb6('0x15')](_0x218d73[_0xacb6('0x17')],_0x509cbb,'\x0a')}},getCustomFields(_0x218d73['Fields'],_0x509cbb))}})[_0xacb6('0x18')](function(_0x1164f5){logger[_0xacb6('0xd')](_0xacb6('0x19'));return _0x1164f5[_0xacb6('0x1a')];});}function getUser(_0x213ec4,_0x4702da){if(intUtil[_0xacb6('0x1b')](_0x4702da)){logger['info'](_0xacb6('0x1c'),_0x4702da);return request({'uri':util[_0xacb6('0xf')](_0xacb6('0x1d'),_0x213ec4[_0xacb6('0x11')]),'qs':{'query':util['format'](_0xacb6('0x1e'),_0x4702da)}})[_0xacb6('0x18')](function(_0x6c5332){if(_0x6c5332[_0xacb6('0x1f')]){logger['info'](_0xacb6('0x20'));return _['find'](_0x6c5332[_0xacb6('0x21')],{'email':_0x4702da,'role':_0xacb6('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xacb6('0x23'),_0x213ec4[_0xacb6('0x11')])})['then'](function(_0x42433d){logger[_0xacb6('0xd')](_0xacb6('0x24'));return _0x42433d[_0xacb6('0x25')];});}});}else{logger[_0xacb6('0xd')](_0xacb6('0x26'));return request({'uri':util['format'](_0xacb6('0x23'),_0x213ec4['remoteUri'])})[_0xacb6('0x18')](function(_0x5585ef){logger['info'](_0xacb6('0x24'));return _0x5585ef[_0xacb6('0x25')];});}}function getEndUser(_0x15fc9,_0x470dba,_0x408be3){logger[_0xacb6('0xd')](_0xacb6('0x27'),_0x408be3);return request({'uri':util['format']('%s/search.json',_0x15fc9['remoteUri']),'qs':{'query':util['format'](_0xacb6('0x28'),_0x408be3)}})[_0xacb6('0x18')](function(_0x4aba66){var _0x352402;if(_0x4aba66[_0xacb6('0x21')][_0xacb6('0x29')]){_0x4aba66[_0xacb6('0x21')]=_[_0xacb6('0x2a')](_0x4aba66[_0xacb6('0x21')],{'suspended':![],'role':'end-user'});if(_0x4aba66[_0xacb6('0x21')][_0xacb6('0x29')]){_0x352402=_[_0xacb6('0x2b')](_0x4aba66[_0xacb6('0x21')]);}}if(_0x352402){logger[_0xacb6('0xd')](_0xacb6('0x2c'));return _0x352402;}else{logger[_0xacb6('0xd')](_0xacb6('0x2d'));return request({'uri':util[_0xacb6('0xf')]('%s/users.json',_0x15fc9[_0xacb6('0x11')]),'method':_0xacb6('0x12'),'body':{'user':{'role':_0xacb6('0x2e'),'name':util['format'](_0xacb6('0x2f'),_0x470dba||_0x408be3),'phone':_0x408be3}}})[_0xacb6('0x18')](function(_0x505c8){logger[_0xacb6('0xd')](_0xacb6('0x30'));return _0x505c8['user'];});}});}function getAuth(_0x513eaa){var _0x38d89b;if(_0x513eaa['authType']==='password'){_0x38d89b=util[_0xacb6('0xf')]('%s:%s',_0x513eaa['username'],_0x513eaa['password']);}else if(_0x513eaa[_0xacb6('0x31')]===_0xacb6('0x32')){_0x38d89b=util[_0xacb6('0xf')](_0xacb6('0x33'),_0x513eaa[_0xacb6('0x34')],_0x513eaa[_0xacb6('0x32')]);}return util[_0xacb6('0xf')](_0xacb6('0x35'),new Buffer(_0x38d89b)[_0xacb6('0x36')](_0xacb6('0x37')));}function request(_0x5153ea){logger['debug'](_0xacb6('0x38'),JSON[_0xacb6('0x39')](_0x5153ea));return rp(_[_0xacb6('0x9')](_0x5153ea,{'method':_0xacb6('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x5e77d9,_0x42de52){var _0x491a8f=[];if(_0x5e77d9&&_0x5e77d9[_0xacb6('0x29')]>0x0){_0x491a8f=_[_0xacb6('0x3b')](_0x5e77d9,_0x42de52);}return _0x491a8f;}function getCustomFields(_0x24be59,_0x3afaa6){var _0x2492eb=[];var _0x4fc2f7={'custom_fields':[]};if(_0x24be59[_0xacb6('0x29')]>0x0){_[_0xacb6('0x3c')](_0x24be59,function(_0x5caafa){if(_0x5caafa['type']==='string'&&_0x5caafa[_0xacb6('0x3d')]&&!_0x5caafa['customField']){_0x4fc2f7[_0x5caafa[_0xacb6('0x3d')][_0xacb6('0x3e')]()]=_0x5caafa[_0xacb6('0x3f')][_0xacb6('0x36')]();}else if(_0x5caafa[_0xacb6('0x40')]===_0xacb6('0x41')&&_0x5caafa[_0xacb6('0x42')]&&_0x5caafa[_0xacb6('0x43')]){_0x4fc2f7[_0xacb6('0x44')]['push']({'id':_0x5caafa['idField'],'value':_0x5caafa['content']['toString']()});}else if(_0x5caafa['type']===_0xacb6('0x45')&&_0x5caafa['variableName']&&_0x5caafa[_0xacb6('0x42')]&&_0x5caafa[_0xacb6('0x43')]){_0x3afaa6[_0x5caafa[_0xacb6('0x46')]]&&_0x4fc2f7[_0xacb6('0x44')][_0xacb6('0x47')]({'id':_0x5caafa['idField'],'value':_0x3afaa6[_0x5caafa[_0xacb6('0x46')]]['toString']()});}else if(_0x5caafa[_0xacb6('0x40')]===_0xacb6('0x48')&&_0x5caafa['Variable']&&_0x5caafa[_0xacb6('0x49')][_0xacb6('0x14')]&&_0x5caafa[_0xacb6('0x42')]&&_0x5caafa['customField']){_0x3afaa6[_0x5caafa[_0xacb6('0x49')][_0xacb6('0x14')]['toLowerCase']()]&&_0x4fc2f7[_0xacb6('0x44')][_0xacb6('0x47')]({'id':_0x5caafa['idField'],'value':_0x3afaa6[_0x5caafa[_0xacb6('0x49')][_0xacb6('0x14')][_0xacb6('0x3e')]()][_0xacb6('0x36')]()});}});}return _0x4fc2f7;}exports[_0xacb6('0x4a')]=function(_0x463431,_0x96058c,_0xc364d4,_0xbc2dca,_0x59a57e,_0x229556){var _0x149b26,_0x30a010;_0x229556['remoteUri']=intUtil[_0xacb6('0x4b')](_0x229556[_0xacb6('0x11')]);_0x229556['serverUrl']=intUtil[_0xacb6('0x4b')](_0x229556[_0xacb6('0x4c')]);if(_0x59a57e&&_0x59a57e[_0xacb6('0x4d')]){logger['info'](_0xacb6('0x4e'),_0xacb6('0x4f'));_0x96058c['recordingURL']=util[_0xacb6('0xf')](_0xacb6('0x50'),_0x229556['serverUrl'],_0x96058c[_0xacb6('0x51')],md5(_0x96058c[_0xacb6('0x51')]));}else{_0x96058c[_0xacb6('0x52')]='';}headers[_0xacb6('0x53')]=getAuth(_0x229556);return getUser(_0x229556,_0xbc2dca[_0xacb6('0x54')])[_0xacb6('0x18')](function(_0x5d0d0f){_0x149b26=_0x5d0d0f;logger[_0xacb6('0xd')]('The\x20User\x20ID\x20is:',_0x149b26['id']);return getEndUser(_0x229556,_0x96058c[_0xacb6('0x55')],_0x96058c['calleridnum']);})[_0xacb6('0x18')](function(_0x3fed27){_0x30a010=_0x3fed27;logger['info'](_0xacb6('0x56'),_0x30a010['id']);return getTicket(_0x229556,_0x149b26,_0x30a010,_0xc364d4,_0x96058c);})['then'](function(_0x1fbcfb){if(_0x1fbcfb){logger[_0xacb6('0xd')](_0xacb6('0x57'),_0x1fbcfb['id']);switch(_0x229556['type']){case _0xacb6('0x58'):logger['info'](_0xacb6('0x4e'),_0xacb6('0x59'));return request({'uri':util[_0xacb6('0xf')](_0xacb6('0x5a'),_0x229556['remoteUri'],_0x149b26['id'],_0x1fbcfb['id']),'method':'POST'});case _0xacb6('0x5b'):logger[_0xacb6('0xd')](_0xacb6('0x4e'),_0xacb6('0x5c'));emit(util[_0xacb6('0xf')](_0xacb6('0x5d'),_0xbc2dca[_0xacb6('0x14')]),_0xacb6('0x5e'),{'uri':util[_0xacb6('0xf')](_0xacb6('0x5f'),_0x229556[_0xacb6('0x11')][_0xacb6('0x60')](_0xacb6('0x61'),''),_0x1fbcfb['id'])});break;default:logger[_0xacb6('0x62')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xacb6('0x63')](function(_0x22ddf5){logger[_0xacb6('0x62')](_0xacb6('0x64'),util['inspect'](_0x22ddf5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x261a72,_0x43677a,_0x395766,_0x9e74f1,_0x5e53bf,_0xe33968,_0x5879c2){var _0xb6fa3e,_0x132462;_0xe33968[_0xacb6('0x11')]=intUtil['stripTrailingSlash'](_0xe33968[_0xacb6('0x11')]);_0xe33968[_0xacb6('0x4c')]=intUtil[_0xacb6('0x4b')](_0xe33968[_0xacb6('0x4c')]);if(_0x5879c2&&_0x5879c2[_0xacb6('0x65')]&&_0x5879c2['recordingFormat']!==_0xacb6('0x66')){logger['info'](_0xacb6('0x67'),_0xacb6('0x4f'));_0x43677a[_0xacb6('0x52')]=util[_0xacb6('0xf')](_0xacb6('0x50'),_0xe33968['serverUrl'],_0x43677a['uniqueid'],md5(_0x43677a[_0xacb6('0x51')]));}headers[_0xacb6('0x53')]=getAuth(_0xe33968);return getUser(_0xe33968,_0x9e74f1['email'])[_0xacb6('0x18')](function(_0x5c8fdf){_0xb6fa3e=_0x5c8fdf;logger[_0xacb6('0xd')](_0xacb6('0x68'),_0xb6fa3e['id']);return getEndUser(_0xe33968,_0x43677a[_0xacb6('0x69')],_0x43677a[_0xacb6('0x6a')]);})[_0xacb6('0x18')](function(_0xcecac4){_0x132462=_0xcecac4;logger[_0xacb6('0xd')](_0xacb6('0x56'),_0x132462['id']);return getTicket(_0xe33968,_0xb6fa3e,_0x132462,_0x395766,_0x43677a);})[_0xacb6('0x18')](function(_0x40d527){if(_0x40d527){logger[_0xacb6('0xd')](_0xacb6('0x57'),_0x40d527['id']);switch(_0xe33968[_0xacb6('0x40')]){case _0xacb6('0x58'):logger[_0xacb6('0xd')](_0xacb6('0x67'),_0xacb6('0x59'));return request({'uri':util['format'](_0xacb6('0x5a'),_0xe33968[_0xacb6('0x11')],_0xb6fa3e['id'],_0x40d527['id']),'method':_0xacb6('0x12')});case'newTab':logger['info'](_0xacb6('0x67'),_0xacb6('0x5c'));emit(util[_0xacb6('0xf')](_0xacb6('0x5d'),_0x9e74f1[_0xacb6('0x14')]),_0xacb6('0x5e'),{'uri':util[_0xacb6('0xf')](_0xacb6('0x5f'),_0xe33968[_0xacb6('0x11')][_0xacb6('0x60')](_0xacb6('0x61'),''),_0x40d527['id'])});break;default:logger[_0xacb6('0x62')]('[OUTBOUND]',_0xacb6('0x6b'));}}})[_0xacb6('0x63')](function(_0x2d2a3f){logger[_0xacb6('0x62')](_0xacb6('0x6c'),util[_0xacb6('0x6d')](_0x2d2a3f,{'showHidden':!![],'depth':null}));});};exports[_0xacb6('0x6e')]=function(_0x5096d3,_0x38956d,_0x16aa5c,_0x1bada0,_0x20c9ec,_0x2fc51e){var _0x452d1a,_0x595172;_0x2fc51e[_0xacb6('0x11')]=intUtil[_0xacb6('0x4b')](_0x2fc51e[_0xacb6('0x11')]);_0x2fc51e[_0xacb6('0x4c')]=intUtil['stripTrailingSlash'](_0x2fc51e['serverUrl']);if(_0x20c9ec&&_0x20c9ec[_0xacb6('0x4d')]){logger[_0xacb6('0xd')]('['+_0x38956d[_0xacb6('0x6f')]['toUpperCase']()+']',_0xacb6('0x4f'));_0x38956d[_0xacb6('0x52')]=util['format'](_0xacb6('0x50'),_0x2fc51e[_0xacb6('0x4c')],_0x38956d['uniqueid'],md5(_0x38956d['uniqueid']));}else{_0x38956d[_0xacb6('0x52')]='';}headers[_0xacb6('0x53')]=getAuth(_0x2fc51e);return getUser(_0x2fc51e)[_0xacb6('0x18')](function(_0x1a70ac){_0x452d1a=_0x1a70ac;logger[_0xacb6('0xd')]('The\x20User\x20ID\x20is:',_0x452d1a['id']);return getEndUser(_0x2fc51e,_0x38956d[_0xacb6('0x55')],_0x38956d[_0xacb6('0x70')]);})['then'](function(_0x2025f1){_0x595172=_0x2025f1;logger[_0xacb6('0xd')](_0xacb6('0x56'),_0x595172['id']);return getTicket(_0x2fc51e,_0x452d1a,_0x595172,_0x16aa5c,_0x38956d);})[_0xacb6('0x18')](function(_0x1e504d){if(_0x1e504d){logger[_0xacb6('0xd')](_0xacb6('0x57'),_0x1e504d['id']);}})['catch'](function(_0x2d3d45){logger['error']('['+_0x38956d['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xacb6('0x6d')](_0x2d3d45,{'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 c787778..e413cf3 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 _0x4f9a=['endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','stack','log','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','destcalleridnum','Outbound','unmanaged','toUpperCase','request-promise','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','string','idField','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','moduleCreate','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','Owner','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime'];(function(_0x2351ab,_0x5680f0){var _0x428ca4=function(_0x3016ee){while(--_0x3016ee){_0x2351ab['push'](_0x2351ab['shift']());}};_0x428ca4(++_0x5680f0);}(_0x4f9a,0xd1));var _0xa4f9=function(_0x17df72,_0x2cf032){_0x17df72=_0x17df72-0x0;var _0x1b6ec9=_0x4f9a[_0x17df72];return _0x1b6ec9;};'use strict';var _=require('lodash');var rp=require(_0xa4f9('0x0'));var md5=require(_0xa4f9('0x1'));var util=require(_0xa4f9('0x2'));var intUtil=require(_0xa4f9('0x3'));var moment=require('moment');var Redis=require(_0xa4f9('0x4'));var BPromise=require('bluebird');var config=require(_0xa4f9('0x5'));var logger=require(_0xa4f9('0x6'))(_0xa4f9('0x7'));config[_0xa4f9('0x8')]=_[_0xa4f9('0x9')](config[_0xa4f9('0x8')],{'host':_0xa4f9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4f9('0x8')]));function emit(_0x2f5b76,_0x316d3a,_0x54046f){io['to'](_0x2f5b76)[_0xa4f9('0xb')](_0x316d3a,_0x54046f);}function request(_0x2ae5d9){logger[_0xa4f9('0xc')](_0xa4f9('0xd'),JSON[_0xa4f9('0xe')](_0x2ae5d9));return rp(_0x2ae5d9);}function getCustomFields(_0x1ef617,_0x435e23){var _0x247232={};if(_0x1ef617[_0xa4f9('0xf')]>0x0){_[_0xa4f9('0x10')](_0x1ef617,function(_0xc55e97){if(_0xc55e97['type']===_0xa4f9('0x11')&&_0xc55e97[_0xa4f9('0x12')]){_0x247232[_0xc55e97[_0xa4f9('0x12')]]=_0xc55e97['content'][_0xa4f9('0x13')]();}else if(_0xc55e97[_0xa4f9('0x14')]===_0xa4f9('0x15')&&_0xc55e97[_0xa4f9('0x16')]&&_0xc55e97['idField']&&_0x435e23[_0xc55e97[_0xa4f9('0x16')]]){_0x247232[_0xc55e97[_0xa4f9('0x12')]]=_0x435e23[_0xc55e97[_0xa4f9('0x16')]][_0xa4f9('0x13')]();}else if(_0xc55e97[_0xa4f9('0x14')]==='customVariable'&&_0xc55e97['Variable']&&_0xc55e97[_0xa4f9('0x17')]['name']&&_0xc55e97[_0xa4f9('0x12')]&&_0x435e23[_0xc55e97[_0xa4f9('0x17')][_0xa4f9('0x18')][_0xa4f9('0x19')]()]){_0x247232[_0xc55e97[_0xa4f9('0x12')]]=_0x435e23[_0xc55e97['Variable'][_0xa4f9('0x18')][_0xa4f9('0x19')]()][_0xa4f9('0x13')]();}});}return _0x247232;}function getName(_0x1c72cd){if(_0x1c72cd[_0xa4f9('0x1a')]('\x20')>0x0){var _0xab102f=_0x1c72cd[_0xa4f9('0x1b')](/ (.+)/);if(_0xab102f[0x1]){return _0xab102f;}}return[_0x1c72cd,_0x1c72cd];}var accountsTokens={};function getAccessToken(_0x243168){return new Promise(function(_0x1908b6,_0x306ffe){if(!_[_0xa4f9('0x1c')](accountsTokens[_0x243168['id']])&&!_[_0xa4f9('0x1c')](accountsTokens[_0x243168['id']][_0xa4f9('0x1d')])){if(moment()[_0xa4f9('0x1e')](accountsTokens[_0x243168['id']][_0xa4f9('0x1f')])){_0x1908b6(accountsTokens[_0x243168['id']]['access_token']);}}var _0x3f5854;switch(_0x243168[_0xa4f9('0x20')]){case'US':_0x3f5854=_0xa4f9('0x21');break;case'AU':_0x3f5854=_0xa4f9('0x22');break;case'EU':_0x3f5854=_0xa4f9('0x23');break;case'IN':_0x3f5854='https://accounts.zoho.in';break;case'CN':_0x3f5854='https://accounts.zoho.com.cn';break;default:_0x3f5854=_0xa4f9('0x23');break;}var _0x4c42f4={'method':_0xa4f9('0x24'),'uri':_0x3f5854+_0xa4f9('0x25'),'qs':{'refresh_token':_0x243168[_0xa4f9('0x26')],'client_id':_0x243168[_0xa4f9('0x27')],'client_secret':_0x243168[_0xa4f9('0x28')],'grant_type':_0xa4f9('0x29')},'json':!![]};return rp(_0x4c42f4)[_0xa4f9('0x2a')](function(_0xebfb32){accountsTokens[_0x243168['id']]={'access_token':_0xebfb32[_0xa4f9('0x1d')],'expires_in':moment()['add'](_0xebfb32[_0xa4f9('0x1f')],_0xa4f9('0x2b'))};_0x1908b6(_0xebfb32[_0xa4f9('0x1d')]);})[_0xa4f9('0x2c')](function(_0x41cbed){logger['error'](_0xa4f9('0x2d'),_0x41cbed['stack']);_0x306ffe(_0x41cbed);});});}function getUser(_0x2eace7,_0x3c8303,_0x1054bd,_0x348f11){logger['info']('Search\x20user');return request({'method':_0xa4f9('0x2e'),'uri':util[_0xa4f9('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x3c8303),'qs':{'type':_0xa4f9('0x30')},'headers':{'Authorization':_0xa4f9('0x31')+_0x2eace7},'json':!![]})[_0xa4f9('0x2a')](function(_0x5e89dc){if(_0x5e89dc[_0xa4f9('0x32')]){var _0x122be0=-0x1;if(_[_0xa4f9('0x33')](_0x5e89dc['users'])){if(!_[_0xa4f9('0x1c')](_0x348f11)){_0x122be0=_[_0xa4f9('0x34')](_0x5e89dc[_0xa4f9('0x32')],function(_0x3b6707){return _0x3b6707[_0xa4f9('0x35')]===_0x348f11;});}if(_0x122be0>=0x0){logger[_0xa4f9('0x36')](_0xa4f9('0x37'));}else{logger[_0xa4f9('0x36')](_0xa4f9('0x38'));_0x122be0=_[_0xa4f9('0x34')](_0x5e89dc[_0xa4f9('0x32')],function(_0x39eec5){return _0x39eec5[_0xa4f9('0x39')]['name']===_0xa4f9('0x3a');});}return _0x5e89dc[_0xa4f9('0x32')][_0x122be0];}else{if(_0x5e89dc[_0xa4f9('0x3b')][_0xa4f9('0x39')][_0xa4f9('0x18')]===_0xa4f9('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x5e89dc['user'];return user;}else{logger[_0xa4f9('0x3c')](_0xa4f9('0x3d'),JSON[_0xa4f9('0xe')](_0x5e89dc));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa4f9('0xe')](_0x5e89dc));}}}else{logger['error'](_0xa4f9('0x3d'),JSON[_0xa4f9('0xe')](_0x5e89dc));throw new Error(_0xa4f9('0x3e')+JSON[_0xa4f9('0xe')](_0x5e89dc));}})['catch'](function(_0x416c9a){console[_0xa4f9('0x3c')](_0x416c9a);});}function getZohoUser(_0x3ac5e9,_0x5ebe55){return new BPromise(function(_0x46e396,_0x56c2db){request(_0x3ac5e9)[_0xa4f9('0x2a')](function(_0x717466){var _0x2b69f6=null;if(_0x717466){_0x2b69f6=_0x717466[_0xa4f9('0x3f')][0x0];_0x2b69f6[_0xa4f9('0x40')]=_0x5ebe55;}_0x46e396(_0x2b69f6);})['catch'](function(_0x3fbbd7){_0x56c2db(_0x3fbbd7);});});}function createEndUser(_0x138eb2,_0x5130d9,_0x468099,_0x1c63c7,_0x2a12e3,_0xd41e11){var _0x468099=getName(_0x468099);return request({'method':_0xa4f9('0x24'),'uri':_0xa4f9('0x41')+_0x5130d9+_0xa4f9('0x42')+_[_0xa4f9('0x43')](_0xd41e11['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x468099[0x1],'First_Name':_0x468099[0x0],'Phone':_0x1c63c7,'Owner':{'name':!_[_0xa4f9('0x1c')](_0x2a12e3[_0xa4f9('0x44')]['name'])?_0x2a12e3['role'][_0xa4f9('0x18')]:!_[_0xa4f9('0x1c')](_0x2a12e3[_0xa4f9('0x45')])?_0x2a12e3[_0xa4f9('0x45')]+'\x20'+_0x2a12e3[_0xa4f9('0x46')]:_0x2a12e3[_0xa4f9('0x46')],'id':_0x2a12e3['id']}}]},'headers':{'Authorization':_0xa4f9('0x31')+_0x138eb2},'json':!![]})[_0xa4f9('0x2a')](function(_0x44523f){if(_0x44523f&&_0x44523f['data'][0x0][_0xa4f9('0x47')]==='SUCCESS'){var _0x5e5630=_0x44523f[_0xa4f9('0x3f')][0x0][_0xa4f9('0x48')];_0x5e5630[_0xa4f9('0x40')]=_['startCase'](_0xd41e11[_0xa4f9('0x49')])+'s';return _0x5e5630;}logger['error'](_0xa4f9('0x3d'),JSON[_0xa4f9('0xe')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xa4f9('0x2c')](function(_0x319cbc){console['log'](_0xa4f9('0x4a'),_0x319cbc);});}function getEndUser(_0x1f3d9a,_0x57c5b0,_0x2e7fcd,_0x5bab63,_0x5ab407,_0xd5197,_0x330656){var _0x115053={'method':'GET','uri':'','headers':{'Authorization':_0xa4f9('0x31')+_0x1f3d9a},'json':!![]};switch(_0x330656[_0xa4f9('0x4b')]){case _0xa4f9('0x4c'):_0x115053[_0xa4f9('0x4d')]=_0xa4f9('0x41')+_0x57c5b0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x4e'))[_0xa4f9('0x2a')](function(_0x560a24){if(_0x560a24)return _0x560a24;_0x115053['uri']='https://www.zohoapis.'+_0x57c5b0+_0xa4f9('0x4f')+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x50'))['then'](function(_0x163b02){if(_0x163b02)return _0x163b02;if(_0x330656[_0xa4f9('0x49')]!='nothing'){return createEndUser(_0x1f3d9a,_0x57c5b0,_0x5bab63,_0x5ab407,_0xd5197,_0x330656);}else{return{};}});});break;case _0xa4f9('0x51'):_0x115053[_0xa4f9('0x4d')]=_0xa4f9('0x41')+_0x57c5b0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x4e'))[_0xa4f9('0x2a')](function(_0x55c03d){if(_0x55c03d)return _0x55c03d;if(_0x330656[_0xa4f9('0x49')]!=_0xa4f9('0x52')){return createEndUser(_0x1f3d9a,_0x57c5b0,_0x5bab63,_0x5ab407,_0xd5197,_0x330656);}else{return{};}});break;case'lead':_0x115053[_0xa4f9('0x4d')]=_0xa4f9('0x41')+_0x57c5b0+_0xa4f9('0x4f')+_0x5ab407+'))';return getZohoUser(_0x115053,_0xa4f9('0x50'))[_0xa4f9('0x2a')](function(_0x4ce606){if(_0x4ce606)return _0x4ce606;if(_0x330656[_0xa4f9('0x49')]!=_0xa4f9('0x52')){return createEndUser(_0x1f3d9a,_0x57c5b0,_0x5bab63,_0x5ab407,_0xd5197,_0x330656);}else{return{};}});break;}}function getCall(_0x22d4a2,_0x115cc6,_0x3bebc2,_0x1c36cd,_0x52370f,_0x2080df,_0x2652d5,_0x25df6d){logger[_0xa4f9('0x36')](_0xa4f9('0x53'));var _0xcc43da={};_0xcc43da[_0xa4f9('0x54')]={'name':!_[_0xa4f9('0x1c')](_0x1c36cd[_0xa4f9('0x44')][_0xa4f9('0x18')])&&!_[_0xa4f9('0x1c')](_0x1c36cd['profile'][_0xa4f9('0x18')])&&_0x1c36cd[_0xa4f9('0x39')]['name']==='administrator'?_0x1c36cd[_0xa4f9('0x44')][_0xa4f9('0x18')]:!_[_0xa4f9('0x1c')](_0x1c36cd['first_name'])?_0x1c36cd[_0xa4f9('0x45')]+'\x20'+_0x1c36cd[_0xa4f9('0x46')]:_0x1c36cd['last_name'],'id':_0x1c36cd['id']};_0xcc43da[_0xa4f9('0x55')]=intUtil[_0xa4f9('0x56')](_0x2080df['Subjects'],_0x2652d5,'\x20');_0xcc43da[_0xa4f9('0x57')]=intUtil[_0xa4f9('0x56')](_0x2080df[_0xa4f9('0x58')],_0x2652d5,'\x0a');if(_0x52370f[_0xa4f9('0x40')]===_0xa4f9('0x4e')){_0xcc43da['Who_Id']={'name':!_['isNil'](_0x52370f[_0xa4f9('0x59')])?_0x52370f[_0xa4f9('0x59')]:!_['isNil'](_0x52370f[_0xa4f9('0x5a')])?_0x52370f[_0xa4f9('0x5a')]+'\x20'+_0x52370f[_0xa4f9('0x5b')]:_0x52370f[_0xa4f9('0x5b')],'id':_0x52370f['id']};}if(_0x52370f[_0xa4f9('0x40')]===_0xa4f9('0x50')){_0xcc43da[_0xa4f9('0x5c')]={'name':!_['isNil'](_0x52370f[_0xa4f9('0x59')])?_0x52370f[_0xa4f9('0x59')]:!_[_0xa4f9('0x1c')](_0x52370f[_0xa4f9('0x5a')])?_0x52370f[_0xa4f9('0x5a')]+'\x20'+_0x52370f[_0xa4f9('0x5b')]:_0x52370f[_0xa4f9('0x5b')],'id':_0x52370f['id']};_0xcc43da[_0xa4f9('0x5d')]=_[_0xa4f9('0x43')](_0x52370f[_0xa4f9('0x40')]);}if(_0x2652d5[_0xa4f9('0x5e')]){_0xcc43da[_0xa4f9('0x5f')]=moment[_0xa4f9('0x60')](parseInt(_0x2652d5['talktime'])*0x3e8)[_0xa4f9('0x2f')](_0xa4f9('0x61'));}else if(_0x2652d5[_0xa4f9('0x62')]&&_0x2652d5[_0xa4f9('0x63')]){_0xcc43da[_0xa4f9('0x5f')]=moment[_0xa4f9('0x60')](moment(_0x2652d5[_0xa4f9('0x63')],_0xa4f9('0x64'))[_0xa4f9('0x65')](moment(_0x2652d5[_0xa4f9('0x66')],_0xa4f9('0x64'))))[_0xa4f9('0x2f')](_0xa4f9('0x61'));}switch(_0x2652d5[_0xa4f9('0x67')]){case _0xa4f9('0x68'):_0xcc43da[_0xa4f9('0x69')]=_0xa4f9('0x6a');break;case'complete':case _0xa4f9('0x6b'):_0xcc43da[_0xa4f9('0x69')]=_0xa4f9('0x6c');break;case _0xa4f9('0x6d'):_0xcc43da['Call_Result']='Rejected';break;case _0xa4f9('0x6e'):_0xcc43da[_0xa4f9('0x69')]=_0xa4f9('0x6f');break;case _0xa4f9('0x70'):_0xcc43da['Call_Result']=_0xa4f9('0x71');default:}_0xcc43da[_0xa4f9('0x72')]=(_0x25df6d===_0xa4f9('0x73')?moment(_0x2652d5[_0xa4f9('0x66')])[_0xa4f9('0x2f')](_0xa4f9('0x64')):moment(_0x2652d5[_0xa4f9('0x74')])[_0xa4f9('0x2f')](_0xa4f9('0x64')))||moment()[_0xa4f9('0x2f')](_0xa4f9('0x64'));_0xcc43da[_0xa4f9('0x75')]=_0x25df6d||_0xa4f9('0x76');_0xcc43da=_['merge'](_0xcc43da,getCustomFields(_0x2080df[_0xa4f9('0x77')],_0x2652d5));return request({'method':_0xa4f9('0x24'),'uri':_0xa4f9('0x41')+_0x115cc6+_0xa4f9('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x22d4a2},'body':{'data':[_0xcc43da]},'json':!![]})[_0xa4f9('0x2a')](function(_0x2c1a7d){if(_0x2c1a7d&&_0x2c1a7d[_0xa4f9('0x3f')][0x0][_0xa4f9('0x47')]===_0xa4f9('0x79')){logger['info'](_0xa4f9('0x7a'));return{'id':_0x2c1a7d[_0xa4f9('0x3f')][0x0][_0xa4f9('0x48')]['id']};}})[_0xa4f9('0x2c')](function(_0x2bf576){logger[_0xa4f9('0x36')]('err',_0x2bf576[_0xa4f9('0x7b')]);console[_0xa4f9('0x7c')]('err',_0x2bf576);});}exports[_0xa4f9('0x7d')]=function(_0x29e7a4,_0x365434,_0x46f5df,_0x5b634e,_0x1a5f7f,_0x4ef7e9){var _0x3a72de,_0x191db2,_0x1b99fd;_0x4ef7e9['host']=intUtil[_0xa4f9('0x7e')](_0x4ef7e9[_0xa4f9('0x7f')]);_0x4ef7e9[_0xa4f9('0x80')]=intUtil[_0xa4f9('0x7e')](_0x4ef7e9[_0xa4f9('0x80')]);if(_0x1a5f7f&&_0x1a5f7f[_0xa4f9('0x81')]){logger[_0xa4f9('0x36')](_0xa4f9('0x82'),_0xa4f9('0x83'));_0x365434['recordingURL']=_0x4ef7e9[_0xa4f9('0x80')]+'/api/voice/recordings/'+_0x365434[_0xa4f9('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x365434[_0xa4f9('0x84')]);}else{_0x365434[_0xa4f9('0x85')]='';}var _0x1bfb27=_0x4ef7e9[_0xa4f9('0x7f')]===_0xa4f9('0x86')?'eu':'com';return getAccessToken(_0x4ef7e9)[_0xa4f9('0x2a')](function(_0x2dd204){_0x1b99fd=_0x2dd204;return getUser(_0x1b99fd,_0x1bfb27,_0x4ef7e9,_0x5b634e[_0xa4f9('0x35')]);})[_0xa4f9('0x2a')](function(_0x55ca5e){_0x3a72de=_0x55ca5e;logger[_0xa4f9('0x36')](_0xa4f9('0x87'),_0x3a72de['id']);return getEndUser(_0x1b99fd,_0x1bfb27,_0x4ef7e9,_0x365434[_0xa4f9('0x88')],_0x365434[_0xa4f9('0x89')],_0x3a72de,_0x46f5df);})[_0xa4f9('0x2a')](function(_0x2876bb){_0x191db2=_0x2876bb;return getCall(_0x1b99fd,_0x1bfb27,_0x4ef7e9,_0x3a72de,_0x191db2,_0x46f5df,_0x365434,_0xa4f9('0x76'));})['then'](function(_0x1cd0a8){if(_0x1cd0a8){logger['info'](_0xa4f9('0x8a'),_0x1cd0a8['id']);logger[_0xa4f9('0x36')](_0xa4f9('0x82'),_0xa4f9('0x8b'));emit(util[_0xa4f9('0x2f')](_0xa4f9('0x8c'),_0x5b634e[_0xa4f9('0x18')]),_0xa4f9('0x8d'),{'uri':_0xa4f9('0x8e')+_0x4ef7e9['host']+_0xa4f9('0x8f')+_0x1cd0a8['id']});}})['catch'](function(_0x344ab0){logger[_0xa4f9('0x3c')](_0xa4f9('0x82'),JSON[_0xa4f9('0xe')](_0x344ab0));});};exports[_0xa4f9('0x73')]=function(_0x1af8fa,_0x1490f6,_0x512e63,_0x3de33f,_0x12b194,_0x7f80ca,_0x492027){var _0x1160bc,_0x579fa4,_0x4804e7;_0x7f80ca[_0xa4f9('0x7f')]=intUtil[_0xa4f9('0x7e')](_0x7f80ca['host']);_0x7f80ca[_0xa4f9('0x80')]=intUtil[_0xa4f9('0x7e')](_0x7f80ca[_0xa4f9('0x80')]);if(_0x492027&&_0x492027[_0xa4f9('0x90')]&&_0x492027[_0xa4f9('0x90')]!==_0xa4f9('0x91')){logger[_0xa4f9('0x36')](_0xa4f9('0x92'),_0xa4f9('0x83'));_0x1490f6[_0xa4f9('0x85')]=_0x7f80ca[_0xa4f9('0x80')]+_0xa4f9('0x93')+_0x1490f6[_0xa4f9('0x84')]+_0xa4f9('0x94')+md5(_0x1490f6[_0xa4f9('0x84')]);}var _0x180dc5=_0x7f80ca[_0xa4f9('0x7f')]===_0xa4f9('0x86')?'eu':_0xa4f9('0x95');return getAccessToken(_0x7f80ca)['then'](function(_0x2c0b74){_0x4804e7=_0x2c0b74;return getUser(_0x4804e7,_0x180dc5,_0x7f80ca,_0x3de33f[_0xa4f9('0x35')]);})['then'](function(_0x28ebb0){_0x1160bc=_0x28ebb0;logger[_0xa4f9('0x36')](_0xa4f9('0x87'),_0x1160bc['id']);return getEndUser(_0x4804e7,_0x180dc5,_0x7f80ca,_0x1490f6['destcalleridname'],_0x1490f6[_0xa4f9('0x96')],_0x1160bc,_0x512e63);})[_0xa4f9('0x2a')](function(_0x21d3a0){_0x579fa4=_0x21d3a0;return getCall(_0x4804e7,_0x180dc5,_0x7f80ca,_0x1160bc,_0x579fa4,_0x512e63,_0x1490f6,_0xa4f9('0x97'));})[_0xa4f9('0x2a')](function(_0x470e0d){if(_0x470e0d){logger['info'](_0xa4f9('0x8a'),_0x470e0d['id']);logger[_0xa4f9('0x36')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa4f9('0x8c'),_0x3de33f[_0xa4f9('0x18')]),_0xa4f9('0x8d'),{'uri':_0xa4f9('0x8e')+_0x7f80ca[_0xa4f9('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x470e0d['id']});}})[_0xa4f9('0x2c')](function(_0x58516a){logger['error'](_0xa4f9('0x92'),JSON[_0xa4f9('0xe')](_0x58516a));});};exports[_0xa4f9('0x98')]=function(_0x30c7a8,_0x214f63,_0x4f7d74,_0x46bae2,_0x2a6029,_0x1e8718){var _0x32ec43,_0x487b86,_0x2fde46;_0x1e8718[_0xa4f9('0x7f')]=intUtil[_0xa4f9('0x7e')](_0x1e8718[_0xa4f9('0x7f')]);_0x1e8718[_0xa4f9('0x80')]=intUtil[_0xa4f9('0x7e')](_0x1e8718[_0xa4f9('0x80')]);if(_0x2a6029&&_0x2a6029[_0xa4f9('0x81')]){logger[_0xa4f9('0x36')]('['+_0x214f63[_0xa4f9('0x67')][_0xa4f9('0x99')]()+']',_0xa4f9('0x83'));_0x214f63['recordingURL']=_0x1e8718['serverUrl']+_0xa4f9('0x93')+_0x214f63[_0xa4f9('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x214f63[_0xa4f9('0x84')]);}else{_0x214f63[_0xa4f9('0x85')]='';}var _0x80dc41=_0x1e8718[_0xa4f9('0x7f')]==='zoho.eu'?'eu':_0xa4f9('0x95');return getAccessToken(_0x1e8718)[_0xa4f9('0x2a')](function(_0x26f4b0){_0x2fde46=_0x26f4b0;return getUser(_0x2fde46,_0x80dc41,_0x1e8718);})[_0xa4f9('0x2a')](function(_0x4d5522){_0x32ec43=_0x4d5522;logger[_0xa4f9('0x36')](_0xa4f9('0x87'),_0x32ec43['id']);return getEndUser(_0x2fde46,_0x80dc41,_0x1e8718,_0x214f63[_0xa4f9('0x88')],_0x214f63[_0xa4f9('0x89')],_0x32ec43,_0x4f7d74);})[_0xa4f9('0x2a')](function(_0x21185d){_0x487b86=_0x21185d;return getCall(_0x2fde46,_0x80dc41,_0x1e8718,_0x32ec43,_0x487b86,_0x4f7d74,_0x214f63,_0xa4f9('0x76'));})[_0xa4f9('0x2a')](function(_0x3b3244){if(_0x3b3244){logger['info']('The\x20Call\x20ID\x20is:',_0x3b3244['id']);}})['catch'](function(_0x47aaea){logger[_0xa4f9('0x3c')]('['+_0x214f63[_0xa4f9('0x67')][_0xa4f9('0x99')]()+']',JSON[_0xa4f9('0xe')](_0x47aaea));});}; \ No newline at end of file +var _0x47c5=['mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','[OUTBOUND]','/api/voice/recordings/','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x47c5,0x165));var _0x547c=function(_0x4d7285,_0x49c65f){_0x4d7285=_0x4d7285-0x0;var _0x2dac6c=_0x47c5[_0x4d7285];return _0x2dac6c;};'use strict';var _=require(_0x547c('0x0'));var rp=require(_0x547c('0x1'));var md5=require(_0x547c('0x2'));var util=require(_0x547c('0x3'));var intUtil=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var Redis=require('ioredis');var BPromise=require(_0x547c('0x6'));var config=require(_0x547c('0x7'));var logger=require('../../../../config/logger')(_0x547c('0x8'));config[_0x547c('0x9')]=_['defaults'](config[_0x547c('0x9')],{'host':_0x547c('0xa'),'port':0x18eb});var io=require(_0x547c('0xb'))(new Redis(config[_0x547c('0x9')]));function emit(_0x12fb7d,_0x4ef079,_0x3e2279){io['to'](_0x12fb7d)[_0x547c('0xc')](_0x4ef079,_0x3e2279);}function request(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),JSON[_0x547c('0xf')](_0x10dec9));return rp(_0x10dec9);}function getCustomFields(_0x111457,_0x2455e9){var _0x386e2c={};if(_0x111457[_0x547c('0x10')]>0x0){_[_0x547c('0x11')](_0x111457,function(_0x549bf0){if(_0x549bf0[_0x547c('0x12')]===_0x547c('0x13')&&_0x549bf0['idField']){_0x386e2c[_0x549bf0[_0x547c('0x14')]]=_0x549bf0[_0x547c('0x15')][_0x547c('0x16')]();}else if(_0x549bf0[_0x547c('0x12')]===_0x547c('0x17')&&_0x549bf0[_0x547c('0x18')]&&_0x549bf0[_0x547c('0x14')]&&_0x2455e9[_0x549bf0[_0x547c('0x18')]]){_0x386e2c[_0x549bf0[_0x547c('0x14')]]=_0x2455e9[_0x549bf0[_0x547c('0x18')]][_0x547c('0x16')]();}else if(_0x549bf0[_0x547c('0x12')]===_0x547c('0x19')&&_0x549bf0[_0x547c('0x1a')]&&_0x549bf0[_0x547c('0x1a')][_0x547c('0x1b')]&&_0x549bf0[_0x547c('0x14')]&&_0x2455e9[_0x549bf0[_0x547c('0x1a')]['name']['toLowerCase']()]){_0x386e2c[_0x549bf0[_0x547c('0x14')]]=_0x2455e9[_0x549bf0[_0x547c('0x1a')][_0x547c('0x1b')]['toLowerCase']()][_0x547c('0x16')]();}});}return _0x386e2c;}function getName(_0x18ef77){if(_0x18ef77[_0x547c('0x1c')]('\x20')>0x0){var _0x58ddc9=_0x18ef77[_0x547c('0x1d')](/ (.+)/);if(_0x58ddc9[0x1]){return _0x58ddc9;}}return[_0x18ef77,_0x18ef77];}var accountsTokens={};function getAccessToken(_0x41149f){return new Promise(function(_0x496c38,_0x5453f9){if(!_[_0x547c('0x1e')](accountsTokens[_0x41149f['id']])&&!_[_0x547c('0x1e')](accountsTokens[_0x41149f['id']]['access_token'])){if(moment()[_0x547c('0x1f')](accountsTokens[_0x41149f['id']][_0x547c('0x20')])){_0x496c38(accountsTokens[_0x41149f['id']]['access_token']);}}var _0x2e317a;switch(_0x41149f[_0x547c('0x21')]){case'US':_0x2e317a=_0x547c('0x22');break;case'AU':_0x2e317a='https://accounts.zoho.com.au';break;case'EU':_0x2e317a=_0x547c('0x23');break;case'IN':_0x2e317a=_0x547c('0x24');break;case'CN':_0x2e317a=_0x547c('0x25');break;default:_0x2e317a=_0x547c('0x23');break;}var _0x1f3581={'method':_0x547c('0x26'),'uri':_0x2e317a+_0x547c('0x27'),'qs':{'refresh_token':_0x41149f[_0x547c('0x28')],'client_id':_0x41149f['clientId'],'client_secret':_0x41149f[_0x547c('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1f3581)['then'](function(_0x4855fd){accountsTokens[_0x41149f['id']]={'access_token':_0x4855fd['access_token'],'expires_in':moment()[_0x547c('0x2a')](_0x4855fd['expires_in'],_0x547c('0x2b'))};_0x496c38(_0x4855fd['access_token']);})[_0x547c('0x2c')](function(_0x486216){logger[_0x547c('0x2d')](_0x547c('0x2e'),_0x486216[_0x547c('0x2f')]);_0x5453f9(_0x486216);});});}function getUser(_0x30a96c,_0x198afb,_0x569924,_0x575c74){logger[_0x547c('0x30')]('Search\x20user');return request({'method':_0x547c('0x31'),'uri':util[_0x547c('0x32')](_0x547c('0x33'),_0x198afb),'qs':{'type':_0x547c('0x34')},'headers':{'Authorization':_0x547c('0x35')+_0x30a96c},'json':!![]})[_0x547c('0x36')](function(_0x342c10){if(_0x342c10['users']){var _0x54f6a8=-0x1;if(_[_0x547c('0x37')](_0x342c10[_0x547c('0x38')])){if(!_[_0x547c('0x1e')](_0x575c74)){_0x54f6a8=_[_0x547c('0x39')](_0x342c10[_0x547c('0x38')],function(_0x18d7c1){return _0x18d7c1[_0x547c('0x3a')]===_0x575c74;});}if(_0x54f6a8>=0x0){logger[_0x547c('0x30')](_0x547c('0x3b'));}else{logger[_0x547c('0x30')](_0x547c('0x3c'));_0x54f6a8=_[_0x547c('0x39')](_0x342c10[_0x547c('0x38')],function(_0x385275){return _0x385275['profile'][_0x547c('0x1b')]==='Administrator';});}return _0x342c10['users'][_0x54f6a8];}else{if(_0x342c10['user'][_0x547c('0x3d')][_0x547c('0x1b')]===_0x547c('0x3e')){logger[_0x547c('0x30')](_0x547c('0x3c'));user=_0x342c10[_0x547c('0x3f')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x342c10));throw new Error(_0x547c('0x40')+JSON[_0x547c('0xf')](_0x342c10));}}}else{logger[_0x547c('0x2d')](_0x547c('0x41'),JSON[_0x547c('0xf')](_0x342c10));throw new Error(_0x547c('0x40')+JSON['stringify'](_0x342c10));}})[_0x547c('0x2c')](function(_0x4e2e52){console[_0x547c('0x2d')](_0x4e2e52);});}function getZohoUser(_0x18fcc5,_0x5b80f4){return new BPromise(function(_0x380705,_0x5c57ae){request(_0x18fcc5)['then'](function(_0x3137e0){var _0x281d52=null;if(_0x3137e0){_0x281d52=_0x3137e0[_0x547c('0x42')][0x0];_0x281d52[_0x547c('0x43')]=_0x5b80f4;}_0x380705(_0x281d52);})['catch'](function(_0x52b962){_0x5c57ae(_0x52b962);});});}function createEndUser(_0xe5f1b9,_0x1e8dd0,_0x411c6f,_0x5c8ed0,_0x3886ae,_0x21838a){var _0x411c6f=getName(_0x411c6f);return request({'method':'POST','uri':_0x547c('0x44')+_0x1e8dd0+_0x547c('0x45')+_[_0x547c('0x46')](_0x21838a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x411c6f[0x1],'First_Name':_0x411c6f[0x0],'Phone':_0x5c8ed0,'Owner':{'name':!_[_0x547c('0x1e')](_0x3886ae[_0x547c('0x47')]['name'])?_0x3886ae[_0x547c('0x47')][_0x547c('0x1b')]:!_[_0x547c('0x1e')](_0x3886ae['first_name'])?_0x3886ae[_0x547c('0x48')]+'\x20'+_0x3886ae['last_name']:_0x3886ae[_0x547c('0x49')],'id':_0x3886ae['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xe5f1b9},'json':!![]})[_0x547c('0x36')](function(_0x414b9d){if(_0x414b9d&&_0x414b9d[_0x547c('0x42')][0x0][_0x547c('0x4a')]===_0x547c('0x4b')){var _0x3a2508=_0x414b9d['data'][0x0]['details'];_0x3a2508[_0x547c('0x43')]=_[_0x547c('0x46')](_0x21838a[_0x547c('0x4c')])+'s';return _0x3a2508;}logger['error'](_0x547c('0x41'),JSON[_0x547c('0xf')](data));throw new Error(_0x547c('0x4d')+JSON[_0x547c('0xf')](data));})[_0x547c('0x2c')](function(_0x41ca7f){console['log'](_0x547c('0x4e'),_0x41ca7f);});}function getEndUser(_0x3ae2c2,_0x3d7088,_0x4c4287,_0x291302,_0x478320,_0xebf295,_0x3167d0){var _0x5f40eb={'method':_0x547c('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3ae2c2},'json':!![]};switch(_0x3167d0[_0x547c('0x4f')]){case'contact_lead':_0x5f40eb[_0x547c('0x50')]=_0x547c('0x44')+_0x3d7088+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x478320+'))';return getZohoUser(_0x5f40eb,_0x547c('0x51'))[_0x547c('0x36')](function(_0xa005cc){if(_0xa005cc)return _0xa005cc;_0x5f40eb[_0x547c('0x50')]='https://www.zohoapis.'+_0x3d7088+_0x547c('0x52')+_0x478320+'))';return getZohoUser(_0x5f40eb,'Leads')['then'](function(_0x4d4a92){if(_0x4d4a92)return _0x4d4a92;if(_0x3167d0[_0x547c('0x4c')]!=_0x547c('0x53')){return createEndUser(_0x3ae2c2,_0x3d7088,_0x291302,_0x478320,_0xebf295,_0x3167d0);}else{return{};}});});break;case _0x547c('0x54'):_0x5f40eb[_0x547c('0x50')]=_0x547c('0x44')+_0x3d7088+_0x547c('0x55')+_0x478320+'))';return getZohoUser(_0x5f40eb,_0x547c('0x51'))[_0x547c('0x36')](function(_0x31a262){if(_0x31a262)return _0x31a262;if(_0x3167d0[_0x547c('0x4c')]!=_0x547c('0x53')){return createEndUser(_0x3ae2c2,_0x3d7088,_0x291302,_0x478320,_0xebf295,_0x3167d0);}else{return{};}});break;case'lead':_0x5f40eb['uri']=_0x547c('0x44')+_0x3d7088+_0x547c('0x52')+_0x478320+'))';return getZohoUser(_0x5f40eb,'Leads')[_0x547c('0x36')](function(_0x3e42a2){if(_0x3e42a2)return _0x3e42a2;if(_0x3167d0[_0x547c('0x4c')]!=_0x547c('0x53')){return createEndUser(_0x3ae2c2,_0x3d7088,_0x291302,_0x478320,_0xebf295,_0x3167d0);}else{return{};}});break;}}function getCall(_0x30680d,_0x2bb808,_0x4d4cf9,_0x152982,_0x5258cf,_0x2e5c9f,_0x1c40e2,_0x1bdaf0){logger['info'](_0x547c('0x56'));var _0x5abce0={};_0x5abce0[_0x547c('0x57')]={'name':!_[_0x547c('0x1e')](_0x152982['role'][_0x547c('0x1b')])&&!_[_0x547c('0x1e')](_0x152982[_0x547c('0x3d')][_0x547c('0x1b')])&&_0x152982[_0x547c('0x3d')][_0x547c('0x1b')]===_0x547c('0x58')?_0x152982['role'][_0x547c('0x1b')]:!_['isNil'](_0x152982[_0x547c('0x48')])?_0x152982[_0x547c('0x48')]+'\x20'+_0x152982[_0x547c('0x49')]:_0x152982[_0x547c('0x49')],'id':_0x152982['id']};_0x5abce0[_0x547c('0x59')]=intUtil['getString'](_0x2e5c9f[_0x547c('0x5a')],_0x1c40e2,'\x20');_0x5abce0['Description']=intUtil[_0x547c('0x5b')](_0x2e5c9f[_0x547c('0x5c')],_0x1c40e2,'\x0a');if(_0x5258cf[_0x547c('0x43')]===_0x547c('0x51')){_0x5abce0[_0x547c('0x5d')]={'name':!_['isNil'](_0x5258cf[_0x547c('0x5e')])?_0x5258cf[_0x547c('0x5e')]:!_['isNil'](_0x5258cf[_0x547c('0x5f')])?_0x5258cf[_0x547c('0x5f')]+'\x20'+_0x5258cf[_0x547c('0x60')]:_0x5258cf[_0x547c('0x60')],'id':_0x5258cf['id']};}if(_0x5258cf['enduserType']==='Leads'){_0x5abce0['What_Id']={'name':!_[_0x547c('0x1e')](_0x5258cf[_0x547c('0x5e')])?_0x5258cf['Full_Name']:!_[_0x547c('0x1e')](_0x5258cf['First_Name'])?_0x5258cf[_0x547c('0x5f')]+'\x20'+_0x5258cf[_0x547c('0x60')]:_0x5258cf[_0x547c('0x60')],'id':_0x5258cf['id']};_0x5abce0[_0x547c('0x61')]=_[_0x547c('0x46')](_0x5258cf[_0x547c('0x43')]);}if(_0x1c40e2[_0x547c('0x62')]){_0x5abce0['Call_Duration']=moment['utc'](parseInt(_0x1c40e2[_0x547c('0x62')])*0x3e8)[_0x547c('0x32')](_0x547c('0x63'));}else if(_0x1c40e2[_0x547c('0x64')]&&_0x1c40e2[_0x547c('0x65')]){_0x5abce0['Call_Duration']=moment['utc'](moment(_0x1c40e2['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x1c40e2[_0x547c('0x66')],_0x547c('0x67'))))[_0x547c('0x32')]('mm:ss');}switch(_0x1c40e2[_0x547c('0x68')]){case _0x547c('0x69'):_0x5abce0[_0x547c('0x6a')]=_0x547c('0x6b');break;case'complete':case'connect':_0x5abce0['Call_Result']=_0x547c('0x6c');break;case _0x547c('0x6d'):_0x5abce0[_0x547c('0x6a')]=_0x547c('0x6e');break;case _0x547c('0x6f'):_0x5abce0['Call_Result']='Abandoned';break;case _0x547c('0x70'):_0x5abce0[_0x547c('0x6a')]=_0x547c('0x71');default:}_0x5abce0[_0x547c('0x72')]=(_0x1bdaf0===_0x547c('0x73')?moment(_0x1c40e2['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x1c40e2[_0x547c('0x74')])['format'](_0x547c('0x67')))||moment()[_0x547c('0x32')](_0x547c('0x67'));_0x5abce0['Call_Type']=_0x1bdaf0||'Inbound';_0x5abce0=_[_0x547c('0x75')](_0x5abce0,getCustomFields(_0x2e5c9f[_0x547c('0x76')],_0x1c40e2));return request({'method':_0x547c('0x26'),'uri':_0x547c('0x44')+_0x2bb808+_0x547c('0x77'),'headers':{'Authorization':_0x547c('0x35')+_0x30680d},'body':{'data':[_0x5abce0]},'json':!![]})[_0x547c('0x36')](function(_0x5e2e8c){if(_0x5e2e8c&&_0x5e2e8c[_0x547c('0x42')][0x0][_0x547c('0x4a')]===_0x547c('0x4b')){logger[_0x547c('0x30')](_0x547c('0x78'));return{'id':_0x5e2e8c[_0x547c('0x42')][0x0][_0x547c('0x79')]['id']};}})[_0x547c('0x2c')](function(_0x49dc3c){logger[_0x547c('0x30')](_0x547c('0x7a'),_0x49dc3c[_0x547c('0x2f')]);console[_0x547c('0x7b')]('err',_0x49dc3c);});}exports[_0x547c('0x7c')]=function(_0x14f39c,_0xf343a9,_0x4e2acc,_0x52cccd,_0x52ea50,_0xd2c027){var _0x42a2a0,_0x2648bc,_0x5d6d46;_0xd2c027[_0x547c('0x7d')]=intUtil[_0x547c('0x7e')](_0xd2c027[_0x547c('0x7d')]);_0xd2c027[_0x547c('0x7f')]=intUtil['stripTrailingSlash'](_0xd2c027['serverUrl']);if(_0x52ea50&&_0x52ea50[_0x547c('0x80')]){logger['info'](_0x547c('0x81'),_0x547c('0x82'));_0xf343a9['recordingURL']=_0xd2c027[_0x547c('0x7f')]+'/api/voice/recordings/'+_0xf343a9[_0x547c('0x83')]+_0x547c('0x84')+md5(_0xf343a9['uniqueid']);}else{_0xf343a9[_0x547c('0x85')]='';}var _0x1b3f94=_0xd2c027[_0x547c('0x7d')]===_0x547c('0x86')?'eu':'com';return getAccessToken(_0xd2c027)['then'](function(_0xa222f4){_0x5d6d46=_0xa222f4;return getUser(_0x5d6d46,_0x1b3f94,_0xd2c027,_0x52cccd[_0x547c('0x3a')]);})[_0x547c('0x36')](function(_0x3378a3){_0x42a2a0=_0x3378a3;logger['info']('The\x20User\x20ID\x20is:',_0x42a2a0['id']);return getEndUser(_0x5d6d46,_0x1b3f94,_0xd2c027,_0xf343a9[_0x547c('0x87')],_0xf343a9[_0x547c('0x88')],_0x42a2a0,_0x4e2acc);})[_0x547c('0x36')](function(_0x43d9a2){_0x2648bc=_0x43d9a2;return getCall(_0x5d6d46,_0x1b3f94,_0xd2c027,_0x42a2a0,_0x2648bc,_0x4e2acc,_0xf343a9,_0x547c('0x89'));})[_0x547c('0x36')](function(_0x1e9026){if(_0x1e9026){logger[_0x547c('0x30')](_0x547c('0x8a'),_0x1e9026['id']);logger[_0x547c('0x30')](_0x547c('0x81'),_0x547c('0x8b'));emit(util[_0x547c('0x32')]('user:%s',_0x52cccd['name']),'trigger:browser:url',{'uri':_0x547c('0x8c')+_0xd2c027['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1e9026['id']});}})[_0x547c('0x2c')](function(_0x5cbef2){logger['error'](_0x547c('0x81'),JSON[_0x547c('0xf')](_0x5cbef2));});};exports[_0x547c('0x73')]=function(_0x1c8fcd,_0x500ab7,_0x28213b,_0xf9c96,_0x480c8a,_0x5c4907,_0x33262e){var _0x1a5128,_0x2fecce,_0x38a01a;_0x5c4907[_0x547c('0x7d')]=intUtil[_0x547c('0x7e')](_0x5c4907[_0x547c('0x7d')]);_0x5c4907[_0x547c('0x7f')]=intUtil['stripTrailingSlash'](_0x5c4907[_0x547c('0x7f')]);if(_0x33262e&&_0x33262e[_0x547c('0x8d')]&&_0x33262e[_0x547c('0x8d')]!=='none'){logger[_0x547c('0x30')](_0x547c('0x8e'),_0x547c('0x82'));_0x500ab7[_0x547c('0x85')]=_0x5c4907[_0x547c('0x7f')]+_0x547c('0x8f')+_0x500ab7[_0x547c('0x83')]+_0x547c('0x84')+md5(_0x500ab7[_0x547c('0x83')]);}var _0x7a72fd=_0x5c4907[_0x547c('0x7d')]===_0x547c('0x86')?'eu':_0x547c('0x90');return getAccessToken(_0x5c4907)[_0x547c('0x36')](function(_0x5146a6){_0x38a01a=_0x5146a6;return getUser(_0x38a01a,_0x7a72fd,_0x5c4907,_0xf9c96[_0x547c('0x3a')]);})[_0x547c('0x36')](function(_0x133724){_0x1a5128=_0x133724;logger['info'](_0x547c('0x91'),_0x1a5128['id']);return getEndUser(_0x38a01a,_0x7a72fd,_0x5c4907,_0x500ab7[_0x547c('0x92')],_0x500ab7[_0x547c('0x93')],_0x1a5128,_0x28213b);})[_0x547c('0x36')](function(_0x427358){_0x2fecce=_0x427358;return getCall(_0x38a01a,_0x7a72fd,_0x5c4907,_0x1a5128,_0x2fecce,_0x28213b,_0x500ab7,_0x547c('0x94'));})[_0x547c('0x36')](function(_0x8dd0f9){if(_0x8dd0f9){logger[_0x547c('0x30')](_0x547c('0x8a'),_0x8dd0f9['id']);logger[_0x547c('0x30')](_0x547c('0x8e'),_0x547c('0x8b'));emit(util['format']('user:%s',_0xf9c96['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x5c4907['host']+_0x547c('0x95')+_0x8dd0f9['id']});}})[_0x547c('0x2c')](function(_0x813437){logger[_0x547c('0x2d')]('[OUTBOUND]',JSON[_0x547c('0xf')](_0x813437));});};exports[_0x547c('0x96')]=function(_0x27410e,_0x507ecb,_0x4607f4,_0x3ac70e,_0x387fa7,_0x53a0a7){var _0x51f200,_0x571c95,_0x1a5445;_0x53a0a7['host']=intUtil[_0x547c('0x7e')](_0x53a0a7[_0x547c('0x7d')]);_0x53a0a7['serverUrl']=intUtil[_0x547c('0x7e')](_0x53a0a7[_0x547c('0x7f')]);if(_0x387fa7&&_0x387fa7[_0x547c('0x80')]){logger[_0x547c('0x30')]('['+_0x507ecb[_0x547c('0x68')]['toUpperCase']()+']',_0x547c('0x82'));_0x507ecb['recordingURL']=_0x53a0a7[_0x547c('0x7f')]+_0x547c('0x8f')+_0x507ecb[_0x547c('0x83')]+_0x547c('0x84')+md5(_0x507ecb['uniqueid']);}else{_0x507ecb[_0x547c('0x85')]='';}var _0x53d6d9=_0x53a0a7[_0x547c('0x7d')]===_0x547c('0x86')?'eu':'com';return getAccessToken(_0x53a0a7)[_0x547c('0x36')](function(_0x542c3c){_0x1a5445=_0x542c3c;return getUser(_0x1a5445,_0x53d6d9,_0x53a0a7);})[_0x547c('0x36')](function(_0x1057f9){_0x51f200=_0x1057f9;logger[_0x547c('0x30')](_0x547c('0x91'),_0x51f200['id']);return getEndUser(_0x1a5445,_0x53d6d9,_0x53a0a7,_0x507ecb['calleridname'],_0x507ecb[_0x547c('0x88')],_0x51f200,_0x4607f4);})[_0x547c('0x36')](function(_0xea441b){_0x571c95=_0xea441b;return getCall(_0x1a5445,_0x53d6d9,_0x53a0a7,_0x51f200,_0x571c95,_0x4607f4,_0x507ecb,_0x547c('0x89'));})[_0x547c('0x36')](function(_0x4b8286){if(_0x4b8286){logger[_0x547c('0x30')](_0x547c('0x8a'),_0x4b8286['id']);}})[_0x547c('0x2c')](function(_0x5337d5){logger[_0x547c('0x2d')]('['+_0x507ecb[_0x547c('0x68')][_0x547c('0x97')]()+']',JSON[_0x547c('0xf')](_0x5337d5));});}; \ 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 096f7e1..3d80aac 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(_0x370fc3,_0x2da901){var _0x5759ae=function(_0x320eb5){while(--_0x320eb5){_0x370fc3['push'](_0x370fc3['shift']());}};_0x5759ae(++_0x2da901);}(_0x7a54,0x106));var _0x47a5=function(_0x29bd81,_0x5df81f){_0x29bd81=_0x29bd81-0x0;var _0x56a846=_0x7a54[_0x29bd81];return _0x56a846;};'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(_0x1aec2f,_0x58c67a){var _0xfe3d9e=function(_0x1d59fb){while(--_0x1d59fb){_0x1aec2f['push'](_0x1aec2f['shift']());}};_0xfe3d9e(++_0x58c67a);}(_0x7a54,0x106));var _0x47a5=function(_0x18840f,_0x44a12d){_0x18840f=_0x18840f-0x0;var _0x53f0c4=_0x7a54[_0x18840f];return _0x53f0c4;};'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 20ba172..ec4bf56 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 _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(_0x45a8b1,_0x50901f){var _0x25adec=function(_0x2b2777){while(--_0x2b2777){_0x45a8b1['push'](_0x45a8b1['shift']());}};_0x25adec(++_0x50901f);}(_0xb10b,0x12a));var _0xbb10=function(_0x54cfa4,_0x2d41ac){_0x54cfa4=_0x54cfa4-0x0;var _0x26ecf5=_0xb10b[_0x54cfa4];return _0x26ecf5;};'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 +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x106819,_0x24f9ef){var _0xb44208=function(_0x8c688a){while(--_0x8c688a){_0x106819['push'](_0x106819['shift']());}};_0xb44208(++_0x24f9ef);}(_0x7a54,0x106));var _0x47a5=function(_0x241369,_0x11d952){_0x241369=_0x241369-0x0;var _0x22a020=_0x7a54[_0x241369];return _0x22a020;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index cd79f8d..7fb04dd 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 _0xeddd=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x2fc5e2,_0x353d84){var _0x8a38cb=function(_0x92813d){while(--_0x92813d){_0x2fc5e2['push'](_0x2fc5e2['shift']());}};_0x8a38cb(++_0x353d84);}(_0xeddd,0x69));var _0xdedd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xeddd[_0x19950b];return _0x3c6b41;};'use strict';var jayson=require(_0xdedd('0x0'));var BPromise=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var client=jayson['client'][_0xdedd('0x4')]({'port':0x2329});client['Request']=function(_0x10de65,_0xd2ff49){return new BPromise(function(_0x56e22a,_0x37b819){return client[_0xdedd('0x5')](_0x10de65,_0xd2ff49)[_0xdedd('0x6')](function(_0x3e6b5a){logger[_0xdedd('0x7')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0xd2ff49,_0x3e6b5a);if(_0x3e6b5a[_0xdedd('0x9')]){logger[_0xdedd('0x9')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0x3e6b5a[_0xdedd('0x9')]['message'],_0xd2ff49);return _0x37b819(_0x3e6b5a[_0xdedd('0x9')][_0xdedd('0xa')]);}else{return _0x56e22a(_0x3e6b5a[_0xdedd('0xb')]);}})[_0xdedd('0xc')](function(_0x5db016){logger[_0xdedd('0x9')](_0xdedd('0x8'),_0xdedd('0x3'),_0x10de65,_0x5db016,_0xd2ff49);return _0x37b819(_0x5db016);});});};module[_0xdedd('0xd')]=client; \ No newline at end of file +var _0x3685=['exports','jayson/promise','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result'];(function(_0x19c7cc,_0x2a61b7){var _0x482a72=function(_0xf413fd){while(--_0xf413fd){_0x19c7cc['push'](_0x19c7cc['shift']());}};_0x482a72(++_0x2a61b7);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x5368('0x0'));var BPromise=require('bluebird');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var client=jayson[_0x5368('0x3')][_0x5368('0x4')]({'port':0x2329});client[_0x5368('0x5')]=function(_0xf0428a,_0x271e21){return new BPromise(function(_0x2c9c35,_0x3bf968){return client[_0x5368('0x6')](_0xf0428a,_0x271e21)['then'](function(_0x1a4450){logger[_0x5368('0x7')](_0x5368('0x8'),_0x5368('0x2'),_0xf0428a,_0x271e21,_0x1a4450);if(_0x1a4450['error']){logger[_0x5368('0x9')](_0x5368('0x8'),_0x5368('0x2'),_0xf0428a,_0x1a4450[_0x5368('0x9')][_0x5368('0xa')],_0x271e21);return _0x3bf968(_0x1a4450[_0x5368('0x9')][_0x5368('0xa')]);}else{return _0x2c9c35(_0x1a4450[_0x5368('0xb')]);}})['catch'](function(_0x3d9625){logger[_0x5368('0x9')](_0x5368('0x8'),'routing',_0xf0428a,_0x3d9625,_0x271e21);return _0x3bf968(_0x3d9625);});});};module[_0x5368('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 36bd857..d005c2c 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 _0x8375=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting'];(function(_0xcbd283,_0xa3a41a){var _0x4047f3=function(_0xc13ca9){while(--_0xc13ca9){_0xcbd283['push'](_0xcbd283['shift']());}};_0x4047f3(++_0xa3a41a);}(_0x8375,0xa8));var _0x5837=function(_0xc6033a,_0xa7f79e){_0xc6033a=_0xc6033a-0x0;var _0x512521=_0x8375[_0xc6033a];return _0x512521;};'use strict';var BPromise=require(_0x5837('0x0'));var server=require(_0x5837('0x1'));var Realtime=require(_0x5837('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x5837('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5837('0x4'))['db'];function initRealtime(){return BPromise[_0x5837('0x5')]()[_0x5837('0x6')](mailAccount[_0x5837('0x7')]())[_0x5837('0x6')](realtime['initMailAccounts']())[_0x5837('0x6')](function(){email[_0x5837('0x8')](realtime[_0x5837('0x9')]);return realtime;});}function main(){return server[_0x5837('0xa')](realtime,email)[_0x5837('0x6')](function(_0x5bc421){return initRealtime();})['then'](function(_0x1e44c4){return db[_0x5837('0xb')]['findOne']({'attributes':['id',_0x5837('0xc')],'raw':!![]});})['then'](function(_0x4556fd){return setInterval(initRealtime,_0x4556fd[_0x5837('0xc')]*0x3e8);})[_0x5837('0xd')](function(_0xc6c6c9){console[_0x5837('0xe')](_0xc6c6c9);});}main(); \ No newline at end of file +var _0xb7b6=['log','bluebird','./server','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x2f1adb,_0x5c1ce0){var _0x52fbd8=function(_0x595f17){while(--_0x595f17){_0x2f1adb['push'](_0x2f1adb['shift']());}};_0x52fbd8(++_0x5c1ce0);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x5b6011,_0x3e94f0){_0x5b6011=_0x5b6011-0x0;var _0x5ad7e4=_0xb7b6[_0x5b6011];return _0x5ad7e4;};'use strict';var BPromise=require(_0x6b7b('0x0'));var server=require(_0x6b7b('0x1'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x6b7b('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6b7b('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0x6b7b('0x4')](mailAccount[_0x6b7b('0x5')]())['then'](realtime['initMailAccounts']())[_0x6b7b('0x4')](function(){email[_0x6b7b('0x6')](realtime[_0x6b7b('0x7')]);return realtime;});}function main(){return server[_0x6b7b('0x8')](realtime,email)[_0x6b7b('0x4')](function(_0x483b9c){return initRealtime();})['then'](function(_0x2bb86d){return db[_0x6b7b('0x9')][_0x6b7b('0xa')]({'attributes':['id',_0x6b7b('0xb')],'raw':!![]});})['then'](function(_0x4ac78d){return setInterval(initRealtime,_0x4ac78d['loginMailFrequency']*0x3e8);})[_0x6b7b('0xc')](function(_0x4223d9){console[_0x6b7b('0xd')](_0x4223d9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 523fc99..6cb4493 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 _0xd783=['active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','catch','lastSync','send','verifySmtp','Smtp','verify','then','verified','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x59c73b,_0x4d4988){var _0x45906c=function(_0x26f326){while(--_0x26f326){_0x59c73b['push'](_0x59c73b['shift']());}};_0x45906c(++_0x4d4988);}(_0xd783,0xb8));var _0x3d78=function(_0x3e01c8,_0x30ec78){_0x3e01c8=_0x3e01c8-0x0;var _0x2a6804=_0xd783[_0x3e01c8];return _0x2a6804;};'use strict';var _=require('lodash');var moment=require(_0x3d78('0x0'));var BPromise=require(_0x3d78('0x1'));var md5=require(_0x3d78('0x2'));var Redis=require('ioredis');var config=require(_0x3d78('0x3'));var logger=require(_0x3d78('0x4'))(_0x3d78('0x5'));config[_0x3d78('0x6')]=_['defaults'](config[_0x3d78('0x6')],{'host':_0x3d78('0x7'),'port':0x18eb});var io=require(_0x3d78('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x3d78('0x9'));var EmailSmtp=require(_0x3d78('0xa'));var mailAccount=require(_0x3d78('0xb'));var md5Accounts={};function EmailChannel(_0x12e74e){logger[_0x3d78('0xc')](_0x3d78('0xd'));this[_0x3d78('0xe')]=_0x12e74e[_0x3d78('0xe')];this[_0x3d78('0xf')]={};this[_0x3d78('0x10')]=new EmailSmtp();}EmailChannel[_0x3d78('0x11')][_0x3d78('0x12')]=function(_0x57aa1d){var _0x4d62b2=this[_0x3d78('0xe')][_0x57aa1d];var _0x52aa68={'id':_0x4d62b2['id'],'name':_0x4d62b2[_0x3d78('0x13')],'key':_0x4d62b2['key'],'active':_0x4d62b2[_0x3d78('0x14')],'Imap':{'status':_0x4d62b2[_0x3d78('0x15')][_0x3d78('0x16')],'messageStatus':_0x4d62b2[_0x3d78('0x15')][_0x3d78('0x17')],'total':_0x4d62b2['Imap'][_0x3d78('0x18')]}};if(_['isNil'](md5Accounts[_0x57aa1d])){md5Accounts[_0x57aa1d]={};}var _0x1c3f84=md5(JSON[_0x3d78('0x19')](_0x52aa68));if(md5Accounts[_0x57aa1d][_0x3d78('0x2')]!==_0x1c3f84){md5Accounts[_0x57aa1d][_0x3d78('0x2')]=_0x1c3f84;io[_0x3d78('0x12')](_0x3d78('0x1a'),_0x52aa68);}};EmailChannel[_0x3d78('0x11')][_0x3d78('0x1b')]=function(_0x3f7fb5){for(var _0xe4874b in _0x3f7fb5){if(_0x3f7fb5[_0x3d78('0x1c')](_0xe4874b)){if(_0x3f7fb5[_0xe4874b][_0x3d78('0x15')]&&_0x3f7fb5[_0xe4874b][_0x3d78('0x14')]){var _0x3fb030=_0x3f7fb5[_0xe4874b][_0x3d78('0x15')];if(!this[_0x3d78('0xf')][_0x3d78('0x1c')](_0x3fb030['id'])){this[_0x3d78('0xf')][_0x3fb030['id']]=new EmailImap(_0x3fb030,_0x3f7fb5[_0xe4874b]['email']);this[_0x3d78('0xf')][_0x3fb030['id']]['on']('box',this['handleImapBox'][_0x3d78('0x1d')](this,_0xe4874b));this[_0x3d78('0xf')][_0x3fb030['id']]['on'](_0x3d78('0x5'),this[_0x3d78('0x1e')]['bind'](this,_0xe4874b));this['imapAccounts'][_0x3fb030['id']]['on'](_0x3d78('0x1f'),this[_0x3d78('0x20')][_0x3d78('0x1d')](this,_0xe4874b));this[_0x3d78('0xf')][_0x3fb030['id']]['on'](_0x3d78('0x21'),this[_0x3d78('0x22')][_0x3d78('0x1d')](this,_0xe4874b));}}else{if(_[_0x3d78('0x23')](this[_0x3d78('0xe')][_0xe4874b][_0x3d78('0x15')])){this['mailAccounts'][_0xe4874b][_0x3d78('0x15')]={};}this['mailAccounts'][_0xe4874b]['Imap']['status']='disabled';this['mailAccounts'][_0xe4874b][_0x3d78('0x15')][_0x3d78('0x17')]='';this['emit'](_0xe4874b);}}}};EmailChannel[_0x3d78('0x11')]['handleImapBox']=function(_0x4520cf,_0x1dc5f6){if(this[_0x3d78('0xe')][_0x4520cf]){this[_0x3d78('0xe')][_0x4520cf][_0x3d78('0x15')][_0x3d78('0x16')]=_0x3d78('0x24');this[_0x3d78('0xe')][_0x4520cf][_0x3d78('0x15')]['messageStatus']=_0x1dc5f6[_0x3d78('0x13')];if(_0x1dc5f6[_0x3d78('0x25')]){this[_0x3d78('0xe')][_0x4520cf]['Imap'][_0x3d78('0x18')]=_0x1dc5f6[_0x3d78('0x25')][_0x3d78('0x18')];}return this[_0x3d78('0x12')](_0x4520cf);}};EmailChannel['prototype'][_0x3d78('0x1e')]=function(_0x49c863,_0x440342){logger[_0x3d78('0xc')](_0x3d78('0x26'),_0x440342[_0x3d78('0x27')],_0x440342[_0x3d78('0x28')],_0x440342[_0x3d78('0x29')],_0x49c863);if(this[_0x3d78('0xe')][_0x49c863]){return mailAccount['notify'](_0x49c863,_0x440342)['then'](function(_0x234b98){if(_0x234b98){logger[_0x3d78('0xc')](_0x3d78('0x2a'));}})[_0x3d78('0x2b')](function(_0x5adac1){logger[_0x3d78('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x3d78('0x19')](_0x5adac1));});}};EmailChannel['prototype'][_0x3d78('0x20')]=function(_0x109ce8){if(this[_0x3d78('0xe')][_0x109ce8]&&this['mailAccounts'][_0x109ce8][_0x3d78('0x15')]){if(this[_0x3d78('0xf')][this[_0x3d78('0xe')][_0x109ce8][_0x3d78('0x15')]['id']]){delete this['imapAccounts'][this[_0x3d78('0xe')][_0x109ce8][_0x3d78('0x15')]['id']];}this['mailAccounts'][_0x109ce8][_0x3d78('0x15')][_0x3d78('0x2c')]=moment();this[_0x3d78('0x12')](_0x109ce8);}};EmailChannel['prototype']['handleImapError']=function(_0x1972d6,_0x507882){if(this[_0x3d78('0xe')][_0x1972d6]){this['mailAccounts'][_0x1972d6]['Imap']['status']=_0x3d78('0x21');this[_0x3d78('0xe')][_0x1972d6][_0x3d78('0x15')][_0x3d78('0x17')]=_0x507882;return this['emit'](_0x1972d6);}};EmailChannel[_0x3d78('0x11')]['sendMail']=function(_0xb76497,_0x5eccca){return this[_0x3d78('0x10')][_0x3d78('0x2d')](_0xb76497,_0x5eccca);};EmailChannel[_0x3d78('0x11')][_0x3d78('0x2e')]=function(_0x7603d4){var _0x5bcc9f=this;if(this[_0x3d78('0xe')][_0x7603d4['id']]){if(_['isNil'](this[_0x3d78('0xe')][_0x7603d4['id']]['Smtp'])){this[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')]={};}this[_0x3d78('0xe')][_0x7603d4['id']]['Smtp'][_0x3d78('0x2c')]=moment();return new BPromise(function(_0xf3396f,_0x52c760){return _0x5bcc9f[_0x3d78('0x10')][_0x3d78('0x30')](_0x7603d4)[_0x3d78('0x31')](function(_0x5f0989){_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')][_0x3d78('0x16')]=_0x3d78('0x32');_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')][_0x3d78('0x17')]='';_0x5bcc9f['emit'](_0x7603d4['id']);_0xf3396f(_0x5f0989);})[_0x3d78('0x2b')](function(_0x14828f){_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']][_0x3d78('0x2f')][_0x3d78('0x16')]=_0x3d78('0x21');_0x5bcc9f[_0x3d78('0xe')][_0x7603d4['id']]['Smtp'][_0x3d78('0x17')]=_0x14828f;_0x5bcc9f[_0x3d78('0x12')](_0x7603d4['id']);_0x52c760(_0x14828f);});});}return this['smtp'][_0x3d78('0x30')](_0x7603d4);};module['exports']=EmailChannel; \ No newline at end of file +var _0x7b9b=['info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','active','status','Imap','total','isNil','emit','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','moment','bluebird','md5','ioredis','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter'];(function(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0x7b9b,0xeb));var _0xb7b9=function(_0x21bdd9,_0x48e25b){_0x21bdd9=_0x21bdd9-0x0;var _0x46a9fa=_0x7b9b[_0x21bdd9];return _0x46a9fa;};'use strict';var _=require('lodash');var moment=require(_0xb7b9('0x0'));var BPromise=require(_0xb7b9('0x1'));var md5=require(_0xb7b9('0x2'));var Redis=require(_0xb7b9('0x3'));var config=require('../../../config/environment');var logger=require(_0xb7b9('0x4'))(_0xb7b9('0x5'));config['redis']=_[_0xb7b9('0x6')](config[_0xb7b9('0x7')],{'host':_0xb7b9('0x8'),'port':0x18eb});var io=require(_0xb7b9('0x9'))(new Redis(config[_0xb7b9('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x140477){logger[_0xb7b9('0xa')](_0xb7b9('0xb'));this[_0xb7b9('0xc')]=_0x140477[_0xb7b9('0xc')];this['imapAccounts']={};this[_0xb7b9('0xd')]=new EmailSmtp();}EmailChannel[_0xb7b9('0xe')]['emit']=function(_0xe0d934){var _0x2f4c25=this[_0xb7b9('0xc')][_0xe0d934];var _0x47d633={'id':_0x2f4c25['id'],'name':_0x2f4c25[_0xb7b9('0xf')],'key':_0x2f4c25['key'],'active':_0x2f4c25[_0xb7b9('0x10')],'Imap':{'status':_0x2f4c25['Imap'][_0xb7b9('0x11')],'messageStatus':_0x2f4c25[_0xb7b9('0x12')]['messageStatus'],'total':_0x2f4c25[_0xb7b9('0x12')][_0xb7b9('0x13')]}};if(_[_0xb7b9('0x14')](md5Accounts[_0xe0d934])){md5Accounts[_0xe0d934]={};}var _0x4bf8f6=md5(JSON['stringify'](_0x47d633));if(md5Accounts[_0xe0d934][_0xb7b9('0x2')]!==_0x4bf8f6){md5Accounts[_0xe0d934][_0xb7b9('0x2')]=_0x4bf8f6;io[_0xb7b9('0x15')](_0xb7b9('0x16'),_0x47d633);}};EmailChannel[_0xb7b9('0xe')][_0xb7b9('0x17')]=function(_0x381037){for(var _0x2e5843 in _0x381037){if(_0x381037[_0xb7b9('0x18')](_0x2e5843)){if(_0x381037[_0x2e5843][_0xb7b9('0x12')]&&_0x381037[_0x2e5843][_0xb7b9('0x10')]){var _0x7668e9=_0x381037[_0x2e5843][_0xb7b9('0x12')];if(!this['imapAccounts'][_0xb7b9('0x18')](_0x7668e9['id'])){this['imapAccounts'][_0x7668e9['id']]=new EmailImap(_0x7668e9,_0x381037[_0x2e5843]['email']);this[_0xb7b9('0x19')][_0x7668e9['id']]['on'](_0xb7b9('0x1a'),this[_0xb7b9('0x1b')][_0xb7b9('0x1c')](this,_0x2e5843));this[_0xb7b9('0x19')][_0x7668e9['id']]['on']('email',this['handleImapEmail'][_0xb7b9('0x1c')](this,_0x2e5843));this['imapAccounts'][_0x7668e9['id']]['on'](_0xb7b9('0x1d'),this[_0xb7b9('0x1e')][_0xb7b9('0x1c')](this,_0x2e5843));this[_0xb7b9('0x19')][_0x7668e9['id']]['on'](_0xb7b9('0x1f'),this[_0xb7b9('0x20')][_0xb7b9('0x1c')](this,_0x2e5843));}}else{if(_[_0xb7b9('0x14')](this[_0xb7b9('0xc')][_0x2e5843][_0xb7b9('0x12')])){this['mailAccounts'][_0x2e5843][_0xb7b9('0x12')]={};}this[_0xb7b9('0xc')][_0x2e5843][_0xb7b9('0x12')][_0xb7b9('0x11')]=_0xb7b9('0x21');this['mailAccounts'][_0x2e5843][_0xb7b9('0x12')][_0xb7b9('0x22')]='';this[_0xb7b9('0x15')](_0x2e5843);}}}};EmailChannel[_0xb7b9('0xe')][_0xb7b9('0x1b')]=function(_0x51796d,_0x124e7d){if(this[_0xb7b9('0xc')][_0x51796d]){this[_0xb7b9('0xc')][_0x51796d][_0xb7b9('0x12')]['status']=_0xb7b9('0x23');this['mailAccounts'][_0x51796d][_0xb7b9('0x12')][_0xb7b9('0x22')]=_0x124e7d[_0xb7b9('0xf')];if(_0x124e7d[_0xb7b9('0x24')]){this[_0xb7b9('0xc')][_0x51796d]['Imap']['total']=_0x124e7d[_0xb7b9('0x24')][_0xb7b9('0x13')];}return this['emit'](_0x51796d);}};EmailChannel['prototype']['handleImapEmail']=function(_0x1aaebd,_0x3d2537){logger[_0xb7b9('0xa')](_0xb7b9('0x25'),_0x3d2537['firstName'],_0x3d2537['lastName'],_0x3d2537['from'],_0x1aaebd);if(this[_0xb7b9('0xc')][_0x1aaebd]){return mailAccount['notify'](_0x1aaebd,_0x3d2537)[_0xb7b9('0x26')](function(_0x1d9ac5){if(_0x1d9ac5){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x3b5d4a){logger[_0xb7b9('0x1f')](_0xb7b9('0x27'),JSON[_0xb7b9('0x28')](_0x3b5d4a));});}};EmailChannel[_0xb7b9('0xe')]['handleImapEnd']=function(_0x53bb0e){if(this[_0xb7b9('0xc')][_0x53bb0e]&&this['mailAccounts'][_0x53bb0e][_0xb7b9('0x12')]){if(this[_0xb7b9('0x19')][this[_0xb7b9('0xc')][_0x53bb0e][_0xb7b9('0x12')]['id']]){delete this[_0xb7b9('0x19')][this[_0xb7b9('0xc')][_0x53bb0e][_0xb7b9('0x12')]['id']];}this['mailAccounts'][_0x53bb0e][_0xb7b9('0x12')][_0xb7b9('0x29')]=moment();this[_0xb7b9('0x15')](_0x53bb0e);}};EmailChannel[_0xb7b9('0xe')]['handleImapError']=function(_0x5d7209,_0x18bd50){if(this[_0xb7b9('0xc')][_0x5d7209]){this[_0xb7b9('0xc')][_0x5d7209][_0xb7b9('0x12')][_0xb7b9('0x11')]=_0xb7b9('0x1f');this['mailAccounts'][_0x5d7209][_0xb7b9('0x12')][_0xb7b9('0x22')]=_0x18bd50;return this[_0xb7b9('0x15')](_0x5d7209);}};EmailChannel[_0xb7b9('0xe')][_0xb7b9('0x2a')]=function(_0x440f34,_0x3930a1){return this[_0xb7b9('0xd')][_0xb7b9('0x2b')](_0x440f34,_0x3930a1);};EmailChannel['prototype'][_0xb7b9('0x2c')]=function(_0x133cc2){var _0x51870b=this;if(this[_0xb7b9('0xc')][_0x133cc2['id']]){if(_[_0xb7b9('0x14')](this[_0xb7b9('0xc')][_0x133cc2['id']][_0xb7b9('0x2d')])){this[_0xb7b9('0xc')][_0x133cc2['id']]['Smtp']={};}this[_0xb7b9('0xc')][_0x133cc2['id']]['Smtp'][_0xb7b9('0x29')]=moment();return new BPromise(function(_0x366688,_0x282e13){return _0x51870b[_0xb7b9('0xd')][_0xb7b9('0x2e')](_0x133cc2)[_0xb7b9('0x26')](function(_0x1ce669){_0x51870b['mailAccounts'][_0x133cc2['id']][_0xb7b9('0x2d')][_0xb7b9('0x11')]=_0xb7b9('0x2f');_0x51870b['mailAccounts'][_0x133cc2['id']][_0xb7b9('0x2d')][_0xb7b9('0x22')]='';_0x51870b['emit'](_0x133cc2['id']);_0x366688(_0x1ce669);})[_0xb7b9('0x30')](function(_0x2ff291){_0x51870b['mailAccounts'][_0x133cc2['id']]['Smtp'][_0xb7b9('0x11')]=_0xb7b9('0x1f');_0x51870b[_0xb7b9('0xc')][_0x133cc2['id']][_0xb7b9('0x2d')][_0xb7b9('0x22')]=_0x2ff291;_0x51870b[_0xb7b9('0x15')](_0x133cc2['id']);_0x282e13(_0x2ff291);});});}return this['smtp'][_0xb7b9('0x2e')](_0x133cc2);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ebc8a15..4da56ed 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 _0x25b6=['emit','readUnseen','handleCloseBox','search','UNSEEN','length','fetch','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','closeBox','handleFetchError','textCode','upperFirst','path','util','imap','lodash','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','password','host','port','tls','autotls','required','user','getHost','service','prototype','openBox','handleOpenBox'];(function(_0x4ad743,_0x3efe65){var _0x32e948=function(_0x51b2e6){while(--_0x51b2e6){_0x4ad743['push'](_0x4ad743['shift']());}};_0x32e948(++_0x3efe65);}(_0x25b6,0xc8));var _0x625b=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0x25b6[_0x1138c4];return _0x200cc1;};'use strict';var fs=require('fs');var path=require(_0x625b('0x0'));var util=require(_0x625b('0x1'));var Imap=require(_0x625b('0x2'));var _=require(_0x625b('0x3'));var rs=require(_0x625b('0x4'));var simpleParser=require('mailparser')[_0x625b('0x5')];var Iconv=require(_0x625b('0x6'))[_0x625b('0x7')];var EventEmitter=require(_0x625b('0x8'))[_0x625b('0x9')];var utils=require(_0x625b('0xa'));var logger=require('../../../config/logger')(_0x625b('0xb'));function EmailImap(_0x22f758,_0x2f476b){this[_0x625b('0xc')]=_0x625b('0xd');this[_0x625b('0xe')]=this[_0x625b('0xf')](_0x22f758,_0x2f476b);this[_0x625b('0x2')]=new Imap(this[_0x625b('0xe')]);this['imap'][_0x625b('0x10')]('ready',this[_0x625b('0x11')]['bind'](this));this[_0x625b('0x2')][_0x625b('0x10')](_0x625b('0x12'),this[_0x625b('0x13')][_0x625b('0x14')](this));this['imap']['on'](_0x625b('0x15'),this[_0x625b('0x16')]['bind'](this));this[_0x625b('0x2')][_0x625b('0x17')]();}util[_0x625b('0x18')](EmailImap,EventEmitter);EmailImap['prototype'][_0x625b('0xf')]=function(_0x4b6b55,_0x5ef90c){var _0x588a9c={'connTimeout':_0x4b6b55[_0x625b('0x19')]?_0x4b6b55[_0x625b('0x19')]*0x3e8:0x2710,'authTimeout':_0x4b6b55[_0x625b('0x1a')]?_0x4b6b55[_0x625b('0x1a')]*0x3e8:0x1388};if(_[_0x625b('0x1b')](_0x4b6b55['service'])){if(_0x4b6b55['authentication']){_0x588a9c['user']=_0x4b6b55['user'];_0x588a9c[_0x625b('0x1c')]=_0x4b6b55['password'];}_0x588a9c[_0x625b('0x1d')]=_0x4b6b55[_0x625b('0x1d')];_0x588a9c[_0x625b('0x1e')]=_0x4b6b55['port']||0x3e1;if(_0x4b6b55['tls']){_0x588a9c[_0x625b('0x1f')]=!![];}else{_0x588a9c['tls']=![];_0x588a9c[_0x625b('0x20')]=_0x625b('0x21');}}else{_0x588a9c[_0x625b('0x22')]=_0x4b6b55[_0x625b('0x22')];_0x588a9c[_0x625b('0x1c')]=_0x4b6b55[_0x625b('0x1c')];_0x588a9c[_0x625b('0x1d')]=utils[_0x625b('0x23')](_0x4b6b55[_0x625b('0x24')]);_0x588a9c[_0x625b('0x1e')]=0x3e1;_0x588a9c['tls']=!![];}_0x588a9c[_0x625b('0xb')]=_0x5ef90c||_0x4b6b55['user']||'anonymous@xcally.com';return _0x588a9c;};EmailImap[_0x625b('0x25')][_0x625b('0x11')]=function(){this[_0x625b('0x2')][_0x625b('0x26')](this[_0x625b('0xc')],![],this[_0x625b('0x27')][_0x625b('0x14')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x1aaf5a,_0x48231f){if(_0x1aaf5a){this[_0x625b('0x16')](_0x1aaf5a,!![]);}else{this[_0x625b('0x28')]('box',_0x48231f);this[_0x625b('0x29')]();}};EmailImap[_0x625b('0x25')][_0x625b('0x2a')]=function(_0x4a38e3){if(_0x4a38e3){this[_0x625b('0x16')](_0x4a38e3,!![]);}else{this[_0x625b('0x2')][_0x625b('0x12')]();}};EmailImap[_0x625b('0x25')][_0x625b('0x29')]=function(){this['imap'][_0x625b('0x2b')]([_0x625b('0x2c')],this['handleReadUnseen'][_0x625b('0x14')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4cf200,_0x3b49c8){if(_0x4cf200){this['handleError'](_0x4cf200,!![]);}else{if(_0x3b49c8[_0x625b('0x2d')]){try{var _0x2245db=this[_0x625b('0x2')][_0x625b('0x2e')](_0x3b49c8,{'bodies':'','markSeen':!![]});_0x2245db['on']('message',this[_0x625b('0x2f')][_0x625b('0x14')](this));_0x2245db['once'](_0x625b('0x15'),this['handleFetchError'][_0x625b('0x14')](this));_0x2245db[_0x625b('0x10')]('end',this[_0x625b('0x30')][_0x625b('0x14')](this));}catch(_0x19234a){logger[_0x625b('0x15')](_0x19234a);}}else{this[_0x625b('0x2')]['closeBox'](!![],this[_0x625b('0x2a')][_0x625b('0x14')](this));}}};EmailImap[_0x625b('0x25')][_0x625b('0x2f')]=function(_0x578e95,_0x104004){_0x578e95['on'](_0x625b('0x31'),this[_0x625b('0x32')][_0x625b('0x14')](this));_0x578e95[_0x625b('0x10')](_0x625b('0x33'),this[_0x625b('0x34')][_0x625b('0x14')](this));_0x578e95[_0x625b('0x10')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0x625b('0x25')][_0x625b('0x32')]=function(_0x3d8e68,_0x2ab408){simpleParser(_0x3d8e68,{'Iconv':Iconv},this[_0x625b('0x35')][_0x625b('0x14')](this));};EmailImap['prototype'][_0x625b('0x34')]=function(_0x1c307b){};EmailImap['prototype'][_0x625b('0x36')]=function(){};EmailImap['prototype'][_0x625b('0x35')]=function(_0x2a1f2a,_0x40b55b){if(_0x2a1f2a){logger[_0x625b('0x15')](_0x2a1f2a);}else{var _0x2f29ff=this;utils[_0x625b('0x37')](this[_0x625b('0xe')],_0x40b55b,function(_0x33c513){_0x2f29ff['emit'](_0x625b('0xb'),_0x33c513);});}};EmailImap[_0x625b('0x25')][_0x625b('0x30')]=function(){this[_0x625b('0x2')][_0x625b('0x38')](!![],this[_0x625b('0x2a')][_0x625b('0x14')](this));};EmailImap[_0x625b('0x25')][_0x625b('0x39')]=function(_0x3992aa){this[_0x625b('0x16')](_0x3992aa);this[_0x625b('0x2')][_0x625b('0x38')](!![],this[_0x625b('0x2a')][_0x625b('0x14')](this));};EmailImap[_0x625b('0x25')]['handleEnd']=function(){this[_0x625b('0x28')]('end');};EmailImap[_0x625b('0x25')]['handleError']=function(_0x545331,_0x58e941){logger[_0x625b('0x15')](_0x625b('0x16'),this[_0x625b('0xe')][_0x625b('0xb')],JSON['stringify'](_0x545331));var _0x3e6932='';if(_0x545331){if(_0x545331[_0x625b('0x3a')]){_0x3e6932=_0x545331[_0x625b('0x3a')];}else{for(var _0x360871 in _0x545331){if(_0x545331['hasOwnProperty'](_0x360871)){_0x3e6932+=_[_0x625b('0x3b')](_0x360871)+':\x20'+_0x545331[_0x360871]+'\x0a';}}}}if(_0x58e941){this[_0x625b('0x2')][_0x625b('0x12')]();}else{this['emit']('error',_0x3e6932);this[_0x625b('0x28')](_0x625b('0x12'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x2a58=['randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','openBox','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','account','emit','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','lodash'];(function(_0x21c926,_0x563c30){var _0x2a46ed=function(_0x24aff8){while(--_0x24aff8){_0x21c926['push'](_0x21c926['shift']());}};_0x2a46ed(++_0x563c30);}(_0x2a58,0x102));var _0x82a5=function(_0x4c4959,_0x342e6a){_0x4c4959=_0x4c4959-0x0;var _0x5a6582=_0x2a58[_0x4c4959];return _0x5a6582;};'use strict';var fs=require('fs');var path=require(_0x82a5('0x0'));var util=require('util');var Imap=require('imap');var _=require(_0x82a5('0x1'));var rs=require(_0x82a5('0x2'));var simpleParser=require(_0x82a5('0x3'))[_0x82a5('0x4')];var Iconv=require('iconv')[_0x82a5('0x5')];var EventEmitter=require(_0x82a5('0x6'))[_0x82a5('0x7')];var utils=require(_0x82a5('0x8'));var logger=require(_0x82a5('0x9'))(_0x82a5('0xa'));function EmailImap(_0x4f0031,_0x2a8867){this[_0x82a5('0xb')]=_0x82a5('0xc');this['account']=this['getAccount'](_0x4f0031,_0x2a8867);this[_0x82a5('0xd')]=new Imap(this['account']);this[_0x82a5('0xd')]['once'](_0x82a5('0xe'),this[_0x82a5('0xf')][_0x82a5('0x10')](this));this[_0x82a5('0xd')][_0x82a5('0x11')](_0x82a5('0x12'),this[_0x82a5('0x13')][_0x82a5('0x10')](this));this['imap']['on'](_0x82a5('0x14'),this[_0x82a5('0x15')][_0x82a5('0x10')](this));this['imap'][_0x82a5('0x16')]();}util[_0x82a5('0x17')](EmailImap,EventEmitter);EmailImap[_0x82a5('0x18')][_0x82a5('0x19')]=function(_0x4ba5b0,_0x35333b){var _0x4e1343={'connTimeout':_0x4ba5b0[_0x82a5('0x1a')]?_0x4ba5b0[_0x82a5('0x1a')]*0x3e8:0x2710,'authTimeout':_0x4ba5b0[_0x82a5('0x1b')]?_0x4ba5b0['authTimeout']*0x3e8:0x1388};if(_[_0x82a5('0x1c')](_0x4ba5b0['service'])){if(_0x4ba5b0[_0x82a5('0x1d')]){_0x4e1343[_0x82a5('0x1e')]=_0x4ba5b0[_0x82a5('0x1e')];_0x4e1343[_0x82a5('0x1f')]=_0x4ba5b0[_0x82a5('0x1f')];}_0x4e1343[_0x82a5('0x20')]=_0x4ba5b0[_0x82a5('0x20')];_0x4e1343[_0x82a5('0x21')]=_0x4ba5b0['port']||0x3e1;if(_0x4ba5b0[_0x82a5('0x22')]){_0x4e1343[_0x82a5('0x22')]=!![];}else{_0x4e1343[_0x82a5('0x22')]=![];_0x4e1343[_0x82a5('0x23')]=_0x82a5('0x24');}}else{_0x4e1343[_0x82a5('0x1e')]=_0x4ba5b0['user'];_0x4e1343[_0x82a5('0x1f')]=_0x4ba5b0[_0x82a5('0x1f')];_0x4e1343[_0x82a5('0x20')]=utils[_0x82a5('0x25')](_0x4ba5b0[_0x82a5('0x26')]);_0x4e1343['port']=0x3e1;_0x4e1343[_0x82a5('0x22')]=!![];}_0x4e1343[_0x82a5('0xa')]=_0x35333b||_0x4ba5b0[_0x82a5('0x1e')]||_0x82a5('0x27');return _0x4e1343;};EmailImap['prototype'][_0x82a5('0xf')]=function(){this['imap'][_0x82a5('0x28')](this[_0x82a5('0xb')],![],this['handleOpenBox'][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')]['handleOpenBox']=function(_0x4d3c2b,_0x466929){if(_0x4d3c2b){this[_0x82a5('0x15')](_0x4d3c2b,!![]);}else{this['emit']('box',_0x466929);this[_0x82a5('0x29')]();}};EmailImap[_0x82a5('0x18')][_0x82a5('0x2a')]=function(_0x422e58){if(_0x422e58){this[_0x82a5('0x15')](_0x422e58,!![]);}else{this[_0x82a5('0xd')][_0x82a5('0x12')]();}};EmailImap[_0x82a5('0x18')][_0x82a5('0x29')]=function(){this['imap']['search']([_0x82a5('0x2b')],this[_0x82a5('0x2c')][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x2c')]=function(_0xf2f980,_0x3e6470){if(_0xf2f980){this[_0x82a5('0x15')](_0xf2f980,!![]);}else{if(_0x3e6470[_0x82a5('0x2d')]){try{var _0x479bfd=this[_0x82a5('0xd')][_0x82a5('0x2e')](_0x3e6470,{'bodies':'','markSeen':!![]});_0x479bfd['on'](_0x82a5('0x2f'),this['handleFetchMessage'][_0x82a5('0x10')](this));_0x479bfd[_0x82a5('0x11')]('error',this[_0x82a5('0x30')][_0x82a5('0x10')](this));_0x479bfd[_0x82a5('0x11')](_0x82a5('0x12'),this['handleFetchEnd']['bind'](this));}catch(_0x2af823){logger['error'](_0x2af823);}}else{this[_0x82a5('0xd')][_0x82a5('0x31')](!![],this[_0x82a5('0x2a')][_0x82a5('0x10')](this));}}};EmailImap[_0x82a5('0x18')][_0x82a5('0x32')]=function(_0x1a5f81,_0x300288){_0x1a5f81['on'](_0x82a5('0x33'),this[_0x82a5('0x34')][_0x82a5('0x10')](this));_0x1a5f81['once'](_0x82a5('0x35'),this[_0x82a5('0x36')][_0x82a5('0x10')](this));_0x1a5f81[_0x82a5('0x11')](_0x82a5('0x12'),this[_0x82a5('0x37')]['bind'](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x34')]=function(_0x49f099,_0xb2a40a){simpleParser(_0x49f099,{'Iconv':Iconv},this[_0x82a5('0x38')][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x36')]=function(_0x2f9804){};EmailImap[_0x82a5('0x18')][_0x82a5('0x37')]=function(){};EmailImap[_0x82a5('0x18')][_0x82a5('0x38')]=function(_0x2f6af9,_0x3328ac){if(_0x2f6af9){logger[_0x82a5('0x14')](_0x2f6af9);}else{var _0x4b9662=this;utils['parser'](this[_0x82a5('0x39')],_0x3328ac,function(_0x23823a){_0x4b9662[_0x82a5('0x3a')](_0x82a5('0xa'),_0x23823a);});}};EmailImap[_0x82a5('0x18')][_0x82a5('0x3b')]=function(){this['imap'][_0x82a5('0x31')](!![],this[_0x82a5('0x2a')][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')][_0x82a5('0x30')]=function(_0x26fef5){this['handleError'](_0x26fef5);this['imap'][_0x82a5('0x31')](!![],this['handleCloseBox'][_0x82a5('0x10')](this));};EmailImap[_0x82a5('0x18')]['handleEnd']=function(){this[_0x82a5('0x3a')](_0x82a5('0x12'));};EmailImap['prototype'][_0x82a5('0x15')]=function(_0x216b2c,_0x58c7f5){logger[_0x82a5('0x14')](_0x82a5('0x15'),this[_0x82a5('0x39')][_0x82a5('0xa')],JSON[_0x82a5('0x3c')](_0x216b2c));var _0x2a22d0='';if(_0x216b2c){if(_0x216b2c[_0x82a5('0x3d')]){_0x2a22d0=_0x216b2c[_0x82a5('0x3d')];}else{for(var _0x344587 in _0x216b2c){if(_0x216b2c[_0x82a5('0x3e')](_0x344587)){_0x2a22d0+=_[_0x82a5('0x3f')](_0x344587)+':\x20'+_0x216b2c[_0x344587]+'\x0a';}}}}if(_0x58c7f5){this[_0x82a5('0xd')]['end']();}else{this['emit']('error',_0x2a22d0);this['emit'](_0x82a5('0x12'));}};module[_0x82a5('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b56b114..98fb8dd 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 _0x098e=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString'];(function(_0x240d1c,_0xb0c3d7){var _0x42a5ba=function(_0x4efbfe){while(--_0x4efbfe){_0x240d1c['push'](_0x240d1c['shift']());}};_0x42a5ba(++_0xb0c3d7);}(_0x098e,0x137));var _0xe098=function(_0x15224a,_0x272911){_0x15224a=_0x15224a-0x0;var _0x533a9f=_0x098e[_0x15224a];return _0x533a9f;};'use strict';var nodemailer=require(_0xe098('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xe098('0x1'));function EmailSmtp(){}EmailSmtp[_0xe098('0x2')][_0xe098('0x3')]=function(_0x768922,_0x56d831){return new BPromise(function(_0x471d0f,_0x3d3d4a){var _0x143793=nodemailer[_0xe098('0x4')](_0x768922);_0x143793[_0xe098('0x5')](_0xe098('0x6'),inlineBase64());_0x143793['sendMail'](_0x56d831,function(_0x2da5d6,_0x429037){if(_0x2da5d6){_0x3d3d4a(_0x2da5d6[_0xe098('0x7')]());}else{_0x471d0f(_0x429037);}});});};EmailSmtp['prototype'][_0xe098('0x8')]=function(_0x181910){return new BPromise(function(_0x14a50f,_0x1136b8){var _0x50e07e=nodemailer['createTransport'](_0x181910);_0x50e07e[_0xe098('0x8')](function(_0x423779,_0x3f5edb){if(_0x423779){_0x1136b8(_0x423779[_0xe098('0x7')]());}else{if(_0x3f5edb){_0x14a50f(_0x3f5edb);}else{_0x1136b8(_0xe098('0x9'));}}});});};module[_0xe098('0xa')]=EmailSmtp; \ No newline at end of file +var _0x10a2=['verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','send','createTransport','use','sendMail','toString','prototype'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x10a2,0x137));var _0x210a=function(_0x128346,_0x2f3d43){_0x128346=_0x128346-0x0;var _0xd9e2e3=_0x10a2[_0x128346];return _0xd9e2e3;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x210a('0x0'));var inlineBase64=require(_0x210a('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x210a('0x2')]=function(_0x5d3cc9,_0x32259a){return new BPromise(function(_0x21407e,_0x325350){var _0xed5264=nodemailer[_0x210a('0x3')](_0x5d3cc9);_0xed5264[_0x210a('0x4')]('compile',inlineBase64());_0xed5264[_0x210a('0x5')](_0x32259a,function(_0x2ffbe8,_0x210a25){if(_0x2ffbe8){_0x325350(_0x2ffbe8[_0x210a('0x6')]());}else{_0x21407e(_0x210a25);}});});};EmailSmtp[_0x210a('0x7')][_0x210a('0x8')]=function(_0xf869f5){return new BPromise(function(_0x35eab5,_0x1b81ad){var _0x6f1400=nodemailer['createTransport'](_0xf869f5);_0x6f1400[_0x210a('0x8')](function(_0x218d07,_0x1e42eb){if(_0x218d07){_0x1b81ad(_0x218d07[_0x210a('0x6')]());}else{if(_0x1e42eb){_0x35eab5(_0x1e42eb);}else{_0x1b81ad(_0x210a('0x9'));}}});});};module[_0x210a('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 e26ea33..252b835 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 _0xbeb9=['value','address','anonymous','generate','@xcally.com','name','split','slice','Anonymous','pop','length','isEmpty','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','moment','randomstring','path','node-tnef','email','../../../config/environment','head'];(function(_0x3c3f4f,_0x55d53e){var _0x28b0d5=function(_0x279e46){while(--_0x279e46){_0x3c3f4f['push'](_0x3c3f4f['shift']());}};_0x28b0d5(++_0x55d53e);}(_0xbeb9,0x1d9));var _0x9beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x9beb('0x0'));var random=require(_0x9beb('0x1'));var fs=require('fs');var path=require(_0x9beb('0x2'));var util=require('util');var tnef=require(_0x9beb('0x3'));var logger=require('../../../config/logger')(_0x9beb('0x4'));var config=require(_0x9beb('0x5'));function getAddress(_0xaccf68){var _0x9bda47=_[_0x9beb('0x6')](_0xaccf68[_0x9beb('0x7')]);return _0x9bda47&&_0x9bda47[_0x9beb('0x8')]?_0x9bda47[_0x9beb('0x8')]:_0x9beb('0x9')+random[_0x9beb('0xa')](0x6)+_0x9beb('0xb');}function getFirstName(_0x1bcbc5){var _0x172a9a=_[_0x9beb('0x6')](_0x1bcbc5[_0x9beb('0x7')]);if(_0x172a9a&&_0x172a9a[_0x9beb('0xc')]){var _0x4006a4=_0x172a9a[_0x9beb('0xc')][_0x9beb('0xd')](/\s+/);return _0x4006a4['length']?_0x4006a4[_0x9beb('0xe')](0x0,-0x1)['join']('\x20'):_0x172a9a[_0x9beb('0xc')];}return _0x9beb('0xf');}function getLastName(_0x1df953){var _0x59e270=_[_0x9beb('0x6')](_0x1df953[_0x9beb('0x7')]);if(_0x59e270&&_0x59e270[_0x9beb('0xc')]){var _0x972f89=_0x59e270['name'][_0x9beb('0xd')](/\s+/);return _0x972f89['length']>0x1?_0x972f89[_0x9beb('0x10')]():'';}return'';}function getMails(_0x47793a,_0x3f5edb){var _0x4d9ef8='';for(var _0x2ebb8f=0x0;_0x2ebb8f<_0x3f5edb[_0x9beb('0x7')][_0x9beb('0x11')];_0x2ebb8f+=0x1){if(_0x3f5edb[_0x9beb('0x7')][_0x2ebb8f][_0x9beb('0x8')]!==_0x47793a){if(!_[_0x9beb('0x12')](_0x4d9ef8)){_0x4d9ef8+=',';}_0x4d9ef8+=_0x3f5edb['value'][_0x2ebb8f]['name']||_0x3f5edb['value'][_0x2ebb8f][_0x9beb('0x8')]||'';_0x4d9ef8+='\x20<';_0x4d9ef8+=_0x3f5edb[_0x9beb('0x7')][_0x2ebb8f][_0x9beb('0x8')]?_0x3f5edb[_0x9beb('0x7')][_0x2ebb8f][_0x9beb('0x8')]:'anonymous'+random[_0x9beb('0xa')](0x6)+_0x9beb('0xb');_0x4d9ef8+='>';}}return _0x4d9ef8;}function parseEmail(_0x5d4f18,_0x11edb5,_0xddc7cf){if(_0x11edb5[_0x9beb('0x13')]){var _0x45de07=/)<[^<]*)*<\/script>/gi;while(_0x45de07['test'](_0x11edb5[_0x9beb('0x13')])){_0x11edb5[_0x9beb('0x13')]=_0x11edb5[_0x9beb('0x13')][_0x9beb('0x14')](_0x45de07,'');}_0xddc7cf[_0x9beb('0x15')]=_0x11edb5['html'];}else{_0xddc7cf[_0x9beb('0x15')]=_0x11edb5[_0x9beb('0x16')];}if(_0xddc7cf['body']){_0xddc7cf[_0x9beb('0x15')]=_0xddc7cf[_0x9beb('0x15')][_0x9beb('0x14')](/Empty\x20message

','Attachments','push','Title','Data','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','127.0.0.1','lodash','moment','path','node-tnef','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','slice','join','Anonymous','length','pop','isEmpty','html','body','textAsHtml','replace','0x1?_0x17591d[_0xfda0('0x11')]():'';}return'';}function getMails(_0x24632d,_0x94e8f5){var _0x4021cc='';for(var _0x3b8d69=0x0;_0x3b8d69<_0x94e8f5[_0xfda0('0x5')]['length'];_0x3b8d69+=0x1){if(_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]!==_0x24632d){if(!_[_0xfda0('0x12')](_0x4021cc)){_0x4021cc+=',';}_0x4021cc+=_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0xb')]||_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]||'';_0x4021cc+='\x20<';_0x4021cc+=_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]?_0x94e8f5[_0xfda0('0x5')][_0x3b8d69][_0xfda0('0x6')]:_0xfda0('0x7')+random[_0xfda0('0x8')](0x6)+_0xfda0('0x9');_0x4021cc+='>';}}return _0x4021cc;}function parseEmail(_0x1d438f,_0x39ef23,_0x58f731){if(_0x39ef23[_0xfda0('0x13')]){var _0x5338ac=/)<[^<]*)*<\/script>/gi;while(_0x5338ac['test'](_0x39ef23['html'])){_0x39ef23[_0xfda0('0x13')]=_0x39ef23['html']['replace'](_0x5338ac,'');}_0x58f731['body']=_0x39ef23[_0xfda0('0x13')];}else{_0x58f731[_0xfda0('0x14')]=_0x39ef23[_0xfda0('0x15')];}if(_0x58f731['body']){_0x58f731[_0xfda0('0x14')]=_0x58f731[_0xfda0('0x14')][_0xfda0('0x16')](/0x0){if(this[_0x424aa8+'Capacity']>0x0&&this[_0x424aa8+_0xe486('0x28')]>=this[_0x424aa8+'Capacity']){return _0xe486('0x29');}else{return'working';}}else{return _0xe486('0x2a');}};Agent['prototype'][_0xe486('0x25')]=function(){var _0x1f48c7=[_0xe486('0x2b'),_0xe486('0x2c'),'openchannel',_0xe486('0x2d'),_0xe486('0x2e'),_0xe486('0x2f')];for(var _0x2a92b7=0x0;_0x2a92b7<_0x1f48c7[_0xe486('0x30')];_0x2a92b7+=0x1){var _0x6cf927=this['getChannelStatus'](_0x1f48c7[_0x2a92b7]);if(this[_0x1f48c7[_0x2a92b7]+_0xe486('0x31')]!==_0x6cf927){this[_0x1f48c7[_0x2a92b7]+_0xe486('0x32')]=_['toNumber'](moment()[_0xe486('0x33')]('x'));}this[_0x1f48c7[_0x2a92b7]+'Status']=_0x6cf927;}var _0x48ab9f={'id':this['id'],'name':this['name'],'online':this[_0xe486('0x9')],'voicePause':this[_0xe486('0xa')],'chatPause':this[_0xe486('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xe486('0xe')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xe486('0x10')],'chatStatusTime':this[_0xe486('0x12')],'chatCapacity':this[_0xe486('0x13')],'chatCurrentCapacity':this[_0xe486('0x14')],'mailStatus':this[_0xe486('0x34')],'mailStatusTime':this[_0xe486('0x15')],'mailCapacity':this[_0xe486('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xe486('0x35')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe486('0x18')],'smsStatus':this[_0xe486('0x19')],'smsStatusTime':this[_0xe486('0x36')],'smsCapacity':this[_0xe486('0x1a')],'smsCurrentCapacity':this[_0xe486('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xe486('0x1c')],'whatsappCapacity':this[_0xe486('0x1d')],'whatsappCurrentCapacity':this[_0xe486('0x1e')],'openchannelStatus':this[_0xe486('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xe486('0x21')],'openchannelCurrentCapacity':this[_0xe486('0x38')],'busy':this[_0xe486('0x22')],'busyQueue':this['busyQueue']};var _0x19779f=md5(JSON[_0xe486('0x39')](_0x48ab9f));if(this[_0xe486('0x24')]!==_0x19779f){this[_0xe486('0x24')]=_0x19779f;io['emit'](_0xe486('0x3a'),_0x48ab9f);}};module[_0xe486('0x3b')]=Agent; \ No newline at end of file +var _0x7072=['faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','whatsappStatusTime','stringify','emit','user:save','moment','md5','ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0x7072,0x138));var _0x2707=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x7072[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var moment=require(_0x2707('0x0'));var md5=require(_0x2707('0x1'));var Redis=require(_0x2707('0x2'));var config=require(_0x2707('0x3'));config[_0x2707('0x4')]=_['defaults'](config['redis'],{'host':_0x2707('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2707('0x4')]));function Agent(_0x3572cf){this['id']=_0x3572cf['id']||0x0;this[_0x2707('0x6')]=_0x3572cf[_0x2707('0x6')]||'';this[_0x2707('0x7')]=_0x3572cf[_0x2707('0x7')]||!![];this[_0x2707('0x8')]=_0x3572cf[_0x2707('0x8')]||![];this[_0x2707('0x9')]=_0x3572cf[_0x2707('0x9')]||![];this['mailPause']=_0x3572cf['mailPause']||![];this[_0x2707('0xa')]=_0x3572cf[_0x2707('0xa')]||![];this[_0x2707('0xb')]=_0x3572cf[_0x2707('0xb')]||![];this[_0x2707('0xc')]=_0x3572cf[_0x2707('0xc')]||![];this[_0x2707('0xd')]=_0x2707('0xe');this[_0x2707('0xf')]=0x0;this[_0x2707('0x10')]=_0x3572cf[_0x2707('0x10')]||0x0;this[_0x2707('0x11')]=0x0;this[_0x2707('0x12')]='unknown';this[_0x2707('0x13')]=0x0;this['mailCapacity']=_0x3572cf[_0x2707('0x14')]||0x0;this[_0x2707('0x15')]=0x0;this[_0x2707('0x16')]=_0x2707('0xe');this[_0x2707('0x17')]=0x0;this['faxCapacity']=_0x3572cf[_0x2707('0x18')]||0x0;this[_0x2707('0x19')]=0x0;this[_0x2707('0x1a')]='unknown';this[_0x2707('0x1b')]=0x0;this[_0x2707('0x1c')]=_0x3572cf[_0x2707('0x1c')]||0x0;this[_0x2707('0x1d')]=0x0;this[_0x2707('0x1e')]=_0x2707('0xe');this['whatsappStatusTime']=0x0;this[_0x2707('0x1f')]=_0x3572cf[_0x2707('0x1f')]||0x0;this[_0x2707('0x20')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x2707('0x21')]=_0x3572cf[_0x2707('0x21')]||0x0;this[_0x2707('0x22')]=0x0;this[_0x2707('0x23')]=![];this[_0x2707('0x24')]=undefined;this[_0x2707('0x1')]='';this[_0x2707('0x25')]();}Agent[_0x2707('0x26')][_0x2707('0x27')]=function(_0x2c0cb7){if(this[_0x2c0cb7+_0x2707('0x28')]>0x0){if(this[_0x2c0cb7+_0x2707('0x29')]>0x0&&this[_0x2c0cb7+_0x2707('0x28')]>=this[_0x2c0cb7+_0x2707('0x29')]){return'maxcapacity';}else{return _0x2707('0x2a');}}else{return _0x2707('0x2b');}};Agent[_0x2707('0x26')][_0x2707('0x25')]=function(){var _0x378ca4=[_0x2707('0x2c'),'chat',_0x2707('0x2d'),_0x2707('0x2e'),_0x2707('0x2f'),_0x2707('0x30')];for(var _0x5b763f=0x0;_0x5b763f<_0x378ca4['length'];_0x5b763f+=0x1){var _0x2dce16=this['getChannelStatus'](_0x378ca4[_0x5b763f]);if(this[_0x378ca4[_0x5b763f]+_0x2707('0x31')]!==_0x2dce16){this[_0x378ca4[_0x5b763f]+_0x2707('0x32')]=_[_0x2707('0x33')](moment()['format']('x'));}this[_0x378ca4[_0x5b763f]+_0x2707('0x31')]=_0x2dce16;}var _0x14daf8={'id':this['id'],'name':this[_0x2707('0x6')],'online':this['online'],'voicePause':this[_0x2707('0x8')],'chatPause':this[_0x2707('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x2707('0xb')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x2707('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x2707('0x10')],'chatCurrentCapacity':this[_0x2707('0x11')],'mailStatus':this[_0x2707('0x12')],'mailStatusTime':this[_0x2707('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2707('0x15')],'faxStatus':this[_0x2707('0x16')],'faxStatusTime':this[_0x2707('0x17')],'faxCapacity':this[_0x2707('0x18')],'faxCurrentCapacity':this[_0x2707('0x19')],'smsStatus':this[_0x2707('0x1a')],'smsStatusTime':this[_0x2707('0x1b')],'smsCapacity':this[_0x2707('0x1c')],'smsCurrentCapacity':this[_0x2707('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x2707('0x34')],'whatsappCapacity':this[_0x2707('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2707('0x23')],'busyQueue':this['busyQueue']};var _0x56280c=md5(JSON[_0x2707('0x35')](_0x14daf8));if(this[_0x2707('0x1')]!==_0x56280c){this['md5']=_0x56280c;io[_0x2707('0x36')](_0x2707('0x37'),_0x14daf8);}};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 f50bd83..e5c2a2d 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 _0xf46b=['socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','updateRealtime','updateRouting','_rr','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x18fd0b,_0xe0f9ed){var _0x3b19a3=function(_0xde37ae){while(--_0xde37ae){_0x18fd0b['push'](_0x18fd0b['shift']());}};_0x3b19a3(++_0xe0f9ed);}(_0xf46b,0x1c5));var _0xbf46=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xf46b[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xbf46('0x0'));var md5=require(_0xbf46('0x1'));var util=require('util');var Redis=require(_0xbf46('0x2'));var config=require(_0xbf46('0x3'));config[_0xbf46('0x4')]=_[_0xbf46('0x5')](config[_0xbf46('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf46('0x6'))(new Redis(config[_0xbf46('0x4')]));function ChatQueue(_0x52ce40){this['id']=_0x52ce40['id']||0x0;this[_0xbf46('0x7')]=_0x52ce40[_0xbf46('0x7')]||'';this['timeout']=_0x52ce40['timeout']||0xa;this[_0xbf46('0x8')]=_0x52ce40[_0xbf46('0x8')]||_0xbf46('0x9');this[_0xbf46('0xa')]=_0x52ce40[_0xbf46('0xa')];this[_0xbf46('0xb')]={};this['waiting']=0x0;this[_0xbf46('0x1')]='';this['updateRouting']();this[_0xbf46('0xc')]();}ChatQueue['prototype'][_0xbf46('0xd')]=function(){var _0x51a2c3=this[_0xbf46('0xb')][_0xbf46('0xe')];this[_0xbf46('0xb')]=_[_0xbf46('0xf')](this[_0xbf46('0xa')],'id');this[_0xbf46('0xb')][_0xbf46('0xe')]=_0x51a2c3;};ChatQueue['prototype'][_0xbf46('0xc')]=function(){this[_0xbf46('0x10')]=0x0;this[_0xbf46('0x11')]=0x0;for(var _0x2117ef=0x0;_0x2117ef=0x0?this['available']:0x0;var _0x2c1972={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbf46('0x10')],'name':this[_0xbf46('0x7')],'paused':this[_0xbf46('0x11')],'waiting':this['waiting']};var _0x34ac48=md5(JSON[_0xbf46('0x15')](_0x2c1972));if(this['md5']!==_0x34ac48){this['md5']=_0x34ac48;io['to'](util[_0xbf46('0x16')](_0xbf46('0x17'),_0x2c1972[_0xbf46('0x7')]))[_0xbf46('0x18')](_0xbf46('0x19'),_0x2c1972);}};module[_0xbf46('0x1a')]=ChatQueue; \ No newline at end of file +var _0x3152=['online','paused','available','name','stringify','format','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','loggedIn','length'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x3152,0x1c9));var _0x2315=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x3152[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x2315('0x0'));var md5=require('md5');var util=require(_0x2315('0x1'));var Redis=require(_0x2315('0x2'));var config=require(_0x2315('0x3'));config['redis']=_[_0x2315('0x4')](config[_0x2315('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2315('0x5')]));function ChatQueue(_0x3206b5){this['id']=_0x3206b5['id']||0x0;this['name']=_0x3206b5['name']||'';this['timeout']=_0x3206b5[_0x2315('0x6')]||0xa;this[_0x2315('0x7')]=_0x3206b5['strategy']||_0x2315('0x8');this[_0x2315('0x9')]=_0x3206b5[_0x2315('0x9')];this[_0x2315('0xa')]={};this[_0x2315('0xb')]=0x0;this[_0x2315('0xc')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x2315('0xd')][_0x2315('0xe')]=function(){var _0x3e1ff3=this[_0x2315('0xa')][_0x2315('0xf')];this[_0x2315('0xa')]=_[_0x2315('0x10')](this[_0x2315('0x9')],'id');this['mapAgentsId'][_0x2315('0xf')]=_0x3e1ff3;};ChatQueue[_0x2315('0xd')]['updateRealtime']=function(){this[_0x2315('0x11')]=0x0;this['paused']=0x0;for(var _0x158520=0x0;_0x158520=0x0?this[_0x2315('0x15')]:0x0;var _0x30881e={'id':this['id'],'available':this[_0x2315('0x15')],'loggedIn':this[_0x2315('0x11')],'name':this[_0x2315('0x16')],'paused':this[_0x2315('0x14')],'waiting':this[_0x2315('0xb')]};var _0x4f08ca=md5(JSON[_0x2315('0x17')](_0x30881e));if(this[_0x2315('0xc')]!==_0x4f08ca){this[_0x2315('0xc')]=_0x4f08ca;io['to'](util[_0x2315('0x18')]('chat:queue:%s',_0x30881e[_0x2315('0x16')]))[_0x2315('0x19')](_0x2315('0x1a'),_0x30881e);}};module[_0x2315('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 0b19753..175edd2 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(_0x1dea30,_0xa8fe09){var _0x51799f=function(_0xbbd744){while(--_0xbbd744){_0x1dea30['push'](_0x1dea30['shift']());}};_0x51799f(++_0xa8fe09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x225891,_0x1b4e69){var _0x279ddf=function(_0xff4ac5){while(--_0xff4ac5){_0x225891['push'](_0x225891['shift']());}};_0x279ddf(++_0x1b4e69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 efb136e..bfe44b9 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 _0x4991=['exports','name','Intervals'];(function(_0x2f71c1,_0x319017){var _0x411bb7=function(_0x4e69b5){while(--_0x4e69b5){_0x2f71c1['push'](_0x2f71c1['shift']());}};_0x411bb7(++_0x319017);}(_0x4991,0x6a));var _0x1499=function(_0xde79e0,_0x119bb8){_0xde79e0=_0xde79e0-0x0;var _0x3efc2=_0x4991[_0xde79e0];return _0x3efc2;};'use strict';function Interval(_0x48b4ca){this['id']=_0x48b4ca['id']||0x0;this['name']=_0x48b4ca[_0x1499('0x0')]||'';this['Intervals']=_0x48b4ca[_0x1499('0x1')]||{};}module[_0x1499('0x2')]=Interval; \ No newline at end of file +var _0xb350=['exports','name'];(function(_0x314b9d,_0x1e8c96){var _0x1cb731=function(_0x37055c){while(--_0x37055c){_0x314b9d['push'](_0x314b9d['shift']());}};_0x1cb731(++_0x1e8c96);}(_0xb350,0x143));var _0x0b35=function(_0x231cf4,_0x59464f){_0x231cf4=_0x231cf4-0x0;var _0x2ed93f=_0xb350[_0x231cf4];return _0x2ed93f;};'use strict';function Interval(_0x1de81c){this['id']=_0x1de81c['id']||0x0;this[_0x0b35('0x0')]=_0x1de81c[_0x0b35('0x0')]||'';this['Intervals']=_0x1de81c['Intervals']||{};}module[_0x0b35('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 3a3fb6c..e18c13f 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 _0x9048=['beepall','Agents','mapAgentsId','waiting','updateRealtime','map','_rr','prototype','loggedIn','paused','online','mailPause','available','md5','format','mail:queue:%s','mail_queue:save','lodash','util','defaults','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0x9048,0xf2));var _0x8904=function(_0x2b8502,_0x1d8ed1){_0x2b8502=_0x2b8502-0x0;var _0x31736b=_0x9048[_0x2b8502];return _0x31736b;};'use strict';var _=require(_0x8904('0x0'));var md5=require('md5');var util=require(_0x8904('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x8904('0x2')](config[_0x8904('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8904('0x4'))(new Redis(config[_0x8904('0x3')]));function MailQueue(_0x1e09e1){this['id']=_0x1e09e1['id']||0x0;this[_0x8904('0x5')]=_0x1e09e1[_0x8904('0x5')]||'';this[_0x8904('0x6')]=_0x1e09e1[_0x8904('0x6')]||0xa;this[_0x8904('0x7')]=_0x1e09e1[_0x8904('0x7')]||_0x8904('0x8');this[_0x8904('0x9')]=_0x1e09e1[_0x8904('0x9')];this[_0x8904('0xa')]={};this[_0x8904('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x8904('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4c3937=this[_0x8904('0xa')]['_rr'];this[_0x8904('0xa')]=_[_0x8904('0xd')](this[_0x8904('0x9')],'id');this[_0x8904('0xa')][_0x8904('0xe')]=_0x4c3937;};MailQueue[_0x8904('0xf')][_0x8904('0xc')]=function(){this[_0x8904('0x10')]=0x0;this[_0x8904('0x11')]=0x0;for(var _0x487be9=0x0;_0x487be9=0x0?this['available']:0x0;var _0x2fbc00={'id':this['id'],'available':this[_0x8904('0x14')],'loggedIn':this[_0x8904('0x10')],'name':this[_0x8904('0x5')],'paused':this[_0x8904('0x11')],'waiting':this[_0x8904('0xb')]};var _0x5b52d6=md5(JSON['stringify'](_0x2fbc00));if(this[_0x8904('0x15')]!==_0x5b52d6){this[_0x8904('0x15')]=_0x5b52d6;io['to'](util[_0x8904('0x16')](_0x8904('0x17'),_0x2fbc00['name']))['emit'](_0x8904('0x18'),_0x2fbc00);}};module['exports']=MailQueue; \ No newline at end of file +var _0x8861=['defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','mailPause','available','loggedIn','name','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis'];(function(_0x26bb62,_0x1db96b){var _0xfe1168=function(_0x5a32d4){while(--_0x5a32d4){_0x26bb62['push'](_0x26bb62['shift']());}};_0xfe1168(++_0x1db96b);}(_0x8861,0x1eb));var _0x1886=function(_0xb59078,_0x2aff7a){_0xb59078=_0xb59078-0x0;var _0x26e5b3=_0x8861[_0xb59078];return _0x26e5b3;};'use strict';var _=require(_0x1886('0x0'));var md5=require(_0x1886('0x1'));var util=require(_0x1886('0x2'));var Redis=require(_0x1886('0x3'));var config=require('../../../config/environment');config[_0x1886('0x4')]=_[_0x1886('0x5')](config['redis'],{'host':_0x1886('0x6'),'port':0x18eb});var io=require(_0x1886('0x7'))(new Redis(config['redis']));function MailQueue(_0x146095){this['id']=_0x146095['id']||0x0;this['name']=_0x146095['name']||'';this[_0x1886('0x8')]=_0x146095[_0x1886('0x8')]||0xa;this[_0x1886('0x9')]=_0x146095[_0x1886('0x9')]||_0x1886('0xa');this['Agents']=_0x146095[_0x1886('0xb')];this[_0x1886('0xc')]={};this[_0x1886('0xd')]=0x0;this['md5']='';this[_0x1886('0xe')]();this[_0x1886('0xf')]();}MailQueue[_0x1886('0x10')][_0x1886('0xe')]=function(){var _0x3c2ce2=this[_0x1886('0xc')]['_rr'];this[_0x1886('0xc')]=_['map'](this['Agents'],'id');this[_0x1886('0xc')][_0x1886('0x11')]=_0x3c2ce2;};MailQueue['prototype'][_0x1886('0xf')]=function(){this['loggedIn']=0x0;this[_0x1886('0x12')]=0x0;for(var _0x129ef7=0x0;_0x129ef7=0x0?this[_0x1886('0x16')]:0x0;var _0x2e714a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1886('0x17')],'name':this[_0x1886('0x18')],'paused':this[_0x1886('0x12')],'waiting':this[_0x1886('0xd')]};var _0xfe42fa=md5(JSON[_0x1886('0x19')](_0x2e714a));if(this[_0x1886('0x1')]!==_0xfe42fa){this['md5']=_0xfe42fa;io['to'](util[_0x1886('0x1a')](_0x1886('0x1b'),_0x2e714a[_0x1886('0x18')]))[_0x1886('0x1c')](_0x1886('0x1d'),_0x2e714a);}};module[_0x1886('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5645edc..32b5597 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 _0x8e9d=['emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','openchannelPause','available','stringify','openchannel:queue:%s'];(function(_0x45977c,_0x7eaed0){var _0x399413=function(_0x41cc76){while(--_0x41cc76){_0x45977c['push'](_0x45977c['shift']());}};_0x399413(++_0x7eaed0);}(_0x8e9d,0x8e));var _0xd8e9=function(_0x40f12e,_0x26102d){_0x40f12e=_0x40f12e-0x0;var _0xda42af=_0x8e9d[_0x40f12e];return _0xda42af;};'use strict';var _=require(_0xd8e9('0x0'));var md5=require(_0xd8e9('0x1'));var util=require(_0xd8e9('0x2'));var Redis=require(_0xd8e9('0x3'));var config=require(_0xd8e9('0x4'));config[_0xd8e9('0x5')]=_[_0xd8e9('0x6')](config[_0xd8e9('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd8e9('0x5')]));function OpenchannelQueue(_0x19f93e){this['id']=_0x19f93e['id']||0x0;this[_0xd8e9('0x7')]=_0x19f93e[_0xd8e9('0x7')]||'';this[_0xd8e9('0x8')]=_0x19f93e['timeout']||0xa;this[_0xd8e9('0x9')]=_0x19f93e[_0xd8e9('0x9')]||_0xd8e9('0xa');this[_0xd8e9('0xb')]=_0x19f93e[_0xd8e9('0xb')];this[_0xd8e9('0xc')]={};this[_0xd8e9('0xd')]=0x0;this[_0xd8e9('0x1')]='';this[_0xd8e9('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0xd8e9('0xf')][_0xd8e9('0xe')]=function(){var _0x183362=this['mapAgentsId'][_0xd8e9('0x10')];this[_0xd8e9('0xc')]=_[_0xd8e9('0x11')](this[_0xd8e9('0xb')],'id');this[_0xd8e9('0xc')][_0xd8e9('0x10')]=_0x183362;};OpenchannelQueue['prototype'][_0xd8e9('0x12')]=function(){this[_0xd8e9('0x13')]=0x0;this[_0xd8e9('0x14')]=0x0;for(var _0x1034d6=0x0;_0x1034d6=0x0?this[_0xd8e9('0x17')]:0x0;var _0x3415cf={'id':this['id'],'available':this[_0xd8e9('0x17')],'loggedIn':this[_0xd8e9('0x13')],'name':this['name'],'paused':this[_0xd8e9('0x14')],'waiting':this[_0xd8e9('0xd')]};var _0x1e60fc=md5(JSON[_0xd8e9('0x18')](_0x3415cf));if(this['md5']!==_0x1e60fc){this['md5']=_0x1e60fc;io['to'](util['format'](_0xd8e9('0x19'),_0x3415cf[_0xd8e9('0x7')]))[_0xd8e9('0x1a')]('openchannel_queue:save',_0x3415cf);}};module[_0xd8e9('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x5dcc=['openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','paused','length','online','loggedIn','openchannelPause','available','waiting','stringify','format','openchannel:queue:%s','emit'];(function(_0xf7d47e,_0x7222c8){var _0x31733c=function(_0x1efa27){while(--_0x1efa27){_0xf7d47e['push'](_0xf7d47e['shift']());}};_0x31733c(++_0x7222c8);}(_0x5dcc,0x7a));var _0xc5dc=function(_0x5d56df,_0x5830d0){_0x5d56df=_0x5d56df-0x0;var _0x1fed50=_0x5dcc[_0x5d56df];return _0x1fed50;};'use strict';var _=require(_0xc5dc('0x0'));var md5=require(_0xc5dc('0x1'));var util=require('util');var Redis=require(_0xc5dc('0x2'));var config=require(_0xc5dc('0x3'));config['redis']=_[_0xc5dc('0x4')](config[_0xc5dc('0x5')],{'host':_0xc5dc('0x6'),'port':0x18eb});var io=require(_0xc5dc('0x7'))(new Redis(config[_0xc5dc('0x5')]));function OpenchannelQueue(_0x559323){this['id']=_0x559323['id']||0x0;this[_0xc5dc('0x8')]=_0x559323[_0xc5dc('0x8')]||'';this[_0xc5dc('0x9')]=_0x559323[_0xc5dc('0x9')]||0xa;this['strategy']=_0x559323['strategy']||_0xc5dc('0xa');this[_0xc5dc('0xb')]=_0x559323[_0xc5dc('0xb')];this[_0xc5dc('0xc')]={};this['waiting']=0x0;this[_0xc5dc('0x1')]='';this[_0xc5dc('0xd')]();this['updateRealtime']();}OpenchannelQueue[_0xc5dc('0xe')][_0xc5dc('0xd')]=function(){var _0x52d35d=this[_0xc5dc('0xc')]['_rr'];this['mapAgentsId']=_[_0xc5dc('0xf')](this[_0xc5dc('0xb')],'id');this[_0xc5dc('0xc')]['_rr']=_0x52d35d;};OpenchannelQueue[_0xc5dc('0xe')][_0xc5dc('0x10')]=function(){this['loggedIn']=0x0;this[_0xc5dc('0x11')]=0x0;for(var _0x36239b=0x0;_0x36239b=0x0?this[_0xc5dc('0x16')]:0x0;var _0x56d926={'id':this['id'],'available':this[_0xc5dc('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xc5dc('0x8')],'paused':this[_0xc5dc('0x11')],'waiting':this[_0xc5dc('0x17')]};var _0x4c7470=md5(JSON[_0xc5dc('0x18')](_0x56d926));if(this[_0xc5dc('0x1')]!==_0x4c7470){this[_0xc5dc('0x1')]=_0x4c7470;io['to'](util[_0xc5dc('0x19')](_0xc5dc('0x1a'),_0x56d926[_0xc5dc('0x8')]))[_0xc5dc('0x1b')](_0xc5dc('0x1c'),_0x56d926);}};module[_0xc5dc('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e9f6df1..a1d8e90 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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1d547a,_0x4c8260){var _0xbbe97a=function(_0xf42ac4){while(--_0xf42ac4){_0x1d547a['push'](_0x1d547a['shift']());}};_0xbbe97a(++_0x4c8260);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x1fbb15,_0x52da6c){var _0x54b3dd=function(_0x4cc802){while(--_0x4cc802){_0x1fbb15['push'](_0x1fbb15['shift']());}};_0x54b3dd(++_0x52da6c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 9990cce..dc71546 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 _0xaf0d=['mapAgentsId','_rr','map','prototype','loggedIn','paused','available','waiting','stringify','format','whatsapp:queue:%s','emit','exports','md5','util','localhost','socket.io-emitter','redis','name','strategy','beepall','Agents','updateRouting','updateRealtime'];(function(_0x27d68d,_0x114956){var _0x2c2f48=function(_0x2207df){while(--_0x2207df){_0x27d68d['push'](_0x27d68d['shift']());}};_0x2c2f48(++_0x114956);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x327e13,_0x3b42b5){_0x327e13=_0x327e13-0x0;var _0x43b43e=_0xaf0d[_0x327e13];return _0x43b43e;};'use strict';var _=require('lodash');var md5=require(_0xdaf0('0x0'));var util=require(_0xdaf0('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xdaf0('0x2'),'port':0x18eb});var io=require(_0xdaf0('0x3'))(new Redis(config[_0xdaf0('0x4')]));function WhatsappQueue(_0x569146){this['id']=_0x569146['id']||0x0;this[_0xdaf0('0x5')]=_0x569146[_0xdaf0('0x5')]||'';this['timeout']=_0x569146['timeout']||0xa;this[_0xdaf0('0x6')]=_0x569146[_0xdaf0('0x6')]||_0xdaf0('0x7');this[_0xdaf0('0x8')]=_0x569146['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xdaf0('0x9')]();this[_0xdaf0('0xa')]();}WhatsappQueue['prototype'][_0xdaf0('0x9')]=function(){var _0x187d90=this[_0xdaf0('0xb')][_0xdaf0('0xc')];this['mapAgentsId']=_[_0xdaf0('0xd')](this[_0xdaf0('0x8')],'id');this[_0xdaf0('0xb')]['_rr']=_0x187d90;};WhatsappQueue[_0xdaf0('0xe')][_0xdaf0('0xa')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48ea31=0x0;_0x48ea31=0x0?this[_0xdaf0('0x11')]:0x0;var _0x4b8588={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdaf0('0xf')],'name':this[_0xdaf0('0x5')],'paused':this[_0xdaf0('0x10')],'waiting':this[_0xdaf0('0x12')]};var _0x1ce5aa=md5(JSON[_0xdaf0('0x13')](_0x4b8588));if(this[_0xdaf0('0x0')]!==_0x1ce5aa){this['md5']=_0x1ce5aa;io['to'](util[_0xdaf0('0x14')](_0xdaf0('0x15'),_0x4b8588[_0xdaf0('0x5')]))[_0xdaf0('0x16')]('whatsapp_queue:save',_0x4b8588);}};module[_0xdaf0('0x17')]=WhatsappQueue; \ No newline at end of file +var _0x4a7c=['md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','length','online','loggedIn','whatsappPause','paused','available','format','whatsapp:queue:%s','emit'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x4a7c,0x12c));var _0xc4a7=function(_0x46519f,_0x1126d2){_0x46519f=_0x46519f-0x0;var _0x3944f2=_0x4a7c[_0x46519f];return _0x3944f2;};'use strict';var _=require('lodash');var md5=require(_0xc4a7('0x0'));var util=require(_0xc4a7('0x1'));var Redis=require(_0xc4a7('0x2'));var config=require('../../../config/environment');config[_0xc4a7('0x3')]=_[_0xc4a7('0x4')](config['redis'],{'host':_0xc4a7('0x5'),'port':0x18eb});var io=require(_0xc4a7('0x6'))(new Redis(config[_0xc4a7('0x3')]));function WhatsappQueue(_0x18a9f6){this['id']=_0x18a9f6['id']||0x0;this[_0xc4a7('0x7')]=_0x18a9f6[_0xc4a7('0x7')]||'';this['timeout']=_0x18a9f6[_0xc4a7('0x8')]||0xa;this[_0xc4a7('0x9')]=_0x18a9f6['strategy']||'beepall';this[_0xc4a7('0xa')]=_0x18a9f6[_0xc4a7('0xa')];this[_0xc4a7('0xb')]={};this[_0xc4a7('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xc4a7('0xd')]();}WhatsappQueue[_0xc4a7('0xe')]['updateRouting']=function(){var _0x3f8e9b=this[_0xc4a7('0xb')][_0xc4a7('0xf')];this['mapAgentsId']=_['map'](this[_0xc4a7('0xa')],'id');this['mapAgentsId'][_0xc4a7('0xf')]=_0x3f8e9b;};WhatsappQueue[_0xc4a7('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3c19ef=0x0;_0x3c19ef=0x0?this[_0xc4a7('0x15')]:0x0;var _0x3bdb3c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc4a7('0x7')],'paused':this[_0xc4a7('0x14')],'waiting':this[_0xc4a7('0xc')]};var _0x41ffd7=md5(JSON['stringify'](_0x3bdb3c));if(this[_0xc4a7('0x0')]!==_0x41ffd7){this[_0xc4a7('0x0')]=_0x41ffd7;io['to'](util[_0xc4a7('0x16')](_0xc4a7('0x17'),_0x3bdb3c[_0xc4a7('0x7')]))[_0xc4a7('0x18')]('whatsapp_queue:save',_0x3bdb3c);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 794cc42..d7207ca 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 _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x506f73,_0x542190){_0x506f73=_0x506f73-0x0;var _0x20a9e4=_0x1cb9[_0x506f73];return _0x20a9e4;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file +var _0xa41a=['../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','chatQueues','initSmsQueues','updateRouting','updateRealtime','initFaxQueues','faxQueues','bluebird','util','moment','../model/agent'];(function(_0x259ad3,_0x5ef775){var _0x2fa2a9=function(_0x2f7997){while(--_0x2f7997){_0x259ad3['push'](_0x259ad3['shift']());}};_0x2fa2a9(++_0x5ef775);}(_0xa41a,0x6b));var _0xaa41=function(_0x1e8c6a,_0x1666c3){_0x1e8c6a=_0x1e8c6a-0x0;var _0x51806f=_0xa41a[_0x1e8c6a];return _0x51806f;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Interval=require(_0xaa41('0x4'));var OpenchannelQueue=require(_0xaa41('0x5'));var ChatQueue=require(_0xaa41('0x6'));var SmsQueue=require(_0xaa41('0x7'));var MailQueue=require(_0xaa41('0x8'));var FaxQueue=require(_0xaa41('0x9'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0xaa41('0xa')]={};this[_0xaa41('0xb')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0xaa41('0xc')]={};this[_0xaa41('0xd')]={};this['faxQueues']={};this[_0xaa41('0xe')]={};this[_0xaa41('0xf')]={};this[_0xaa41('0x10')]={};this[_0xaa41('0x11')]={};this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};};function freeIsNotKey(_0x423a19,_0x1c291e,_0x5c9fc7){var _0x1d3aac=_[_0xaa41('0x15')](_0x423a19,function(_0x524cab,_0x54827c){return _0x524cab[_0x5c9fc7];});for(var _0x1d0a54 in _0x1c291e){if(_0x1c291e['hasOwnProperty'](_0x1d0a54)){if(!_0x1d3aac[_0x1d0a54]){delete _0x1c291e[_0x1d0a54];}}}}Realtime[_0xaa41('0x16')][_0xaa41('0x17')]=function(_0x2f64bc,_0x889d44){for(var _0x6f9ade in _0x889d44){if(_0x2f64bc['hasOwnProperty'](_0x6f9ade)){_0x2f64bc[_0x6f9ade]=_0x889d44[_0x6f9ade];}}};Realtime[_0xaa41('0x16')][_0xaa41('0x18')]=function(){var _0x1934e9=this;return function(_0x1ef7d9){if(_0x1ef7d9){freeIsNotKey(_0x1ef7d9,_0x1934e9[_0xaa41('0xa')],'id');for(var _0x2005ae=0x0,_0x1e1e02={},_0x550ad5={};_0x2005ae<_0x1ef7d9[_0xaa41('0x19')];_0x2005ae+=0x1){_0x1e1e02=_0x1ef7d9[_0x2005ae];if(_[_0xaa41('0x1a')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']])){_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']]=new Agent(_0x1e1e02);}else{_0x1934e9[_0xaa41('0x17')](_0x1934e9[_0xaa41('0xa')][_0x1e1e02['id']],_0x1e1e02);}}}return _0x1934e9[_0xaa41('0xa')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1b')]=function(){var _0x4fe1a4=this;return function(_0x5cd936){if(_0x5cd936){freeIsNotKey(_0x5cd936,_0x4fe1a4[_0xaa41('0xb')],'id');for(var _0x22de55=0x0,_0x35c753={},_0x54c488={};_0x22de55<_0x5cd936[_0xaa41('0x19')];_0x22de55+=0x1){_0x35c753=_0x5cd936[_0x22de55];if(_[_0xaa41('0x1a')](_0x4fe1a4['intervals'][_0x35c753['id']])){_0x4fe1a4['intervals'][_0x35c753['id']]=new Interval(_0x35c753);}else{_0x4fe1a4[_0xaa41('0x17')](_0x4fe1a4['intervals'][_0x35c753['id']],_0x35c753);}}}return _0x4fe1a4[_0xaa41('0xb')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1c')]=function(){var _0x1f27f3=this;return function(_0x1d623c){if(_0x1d623c){freeIsNotKey(_0x1d623c,_0x1f27f3['openchannelQueues'],'id');for(var _0x43c430=0x0,_0x43a85c={},_0x448a21={};_0x43c430<_0x1d623c[_0xaa41('0x19')];_0x43c430+=0x1){_0x43a85c=_0x1d623c[_0x43c430];if(_[_0xaa41('0x1a')](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']])){_0x1f27f3['openchannelQueues'][_0x43a85c['id']]=new OpenchannelQueue(_0x43a85c);}else{_0x1f27f3['mergeFromDatabase'](_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']],_0x43a85c);}_0x1f27f3['openchannelQueues'][_0x43a85c['id']]['updateRouting']();_0x1f27f3[_0xaa41('0x1d')][_0x43a85c['id']]['updateRealtime']();}}return _0x1f27f3['openchannelQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x1e')]=function(){var _0x392214=this;return function(_0x632fd2){if(_0x632fd2){freeIsNotKey(_0x632fd2,_0x392214[_0xaa41('0x1f')],'id');for(var _0xa7269f=0x0,_0x57ef96={},_0x30a174={};_0xa7269f<_0x632fd2[_0xaa41('0x19')];_0xa7269f+=0x1){_0x57ef96=_0x632fd2[_0xa7269f];if(_[_0xaa41('0x1a')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']])){_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]=new ChatQueue(_0x57ef96);}else{_0x392214[_0xaa41('0x17')](_0x392214[_0xaa41('0x1f')][_0x57ef96['id']],_0x57ef96);}_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRouting']();_0x392214[_0xaa41('0x1f')][_0x57ef96['id']]['updateRealtime']();}}return _0x392214['chatQueues'];};};Realtime[_0xaa41('0x16')][_0xaa41('0x20')]=function(){var _0x534a85=this;return function(_0x392b5d){if(_0x392b5d){freeIsNotKey(_0x392b5d,_0x534a85[_0xaa41('0xc')],'id');for(var _0x4e3b44=0x0,_0x5022fb={},_0x5c25fb={};_0x4e3b44<_0x392b5d[_0xaa41('0x19')];_0x4e3b44+=0x1){_0x5022fb=_0x392b5d[_0x4e3b44];if(_[_0xaa41('0x1a')](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']])){_0x534a85[_0xaa41('0xc')][_0x5022fb['id']]=new SmsQueue(_0x5022fb);}else{_0x534a85['mergeFromDatabase'](_0x534a85[_0xaa41('0xc')][_0x5022fb['id']],_0x5022fb);}_0x534a85[_0xaa41('0xc')][_0x5022fb['id']][_0xaa41('0x21')]();_0x534a85['smsQueues'][_0x5022fb['id']][_0xaa41('0x22')]();}}return _0x534a85[_0xaa41('0xc')];};};Realtime[_0xaa41('0x16')]['initMailQueues']=function(){var _0x252c62=this;return function(_0x374117){if(_0x374117){freeIsNotKey(_0x374117,_0x252c62['mailQueues'],'id');for(var _0x23eb50=0x0,_0x13b6d4={},_0x2298ed={};_0x23eb50<_0x374117['length'];_0x23eb50+=0x1){_0x13b6d4=_0x374117[_0x23eb50];if(_[_0xaa41('0x1a')](_0x252c62['mailQueues'][_0x13b6d4['id']])){_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']]=new MailQueue(_0x13b6d4);}else{_0x252c62[_0xaa41('0x17')](_0x252c62[_0xaa41('0xd')][_0x13b6d4['id']],_0x13b6d4);}_0x252c62['mailQueues'][_0x13b6d4['id']]['updateRouting']();_0x252c62['mailQueues'][_0x13b6d4['id']][_0xaa41('0x22')]();}}return _0x252c62[_0xaa41('0xd')];};};Realtime[_0xaa41('0x16')][_0xaa41('0x23')]=function(){var _0x4fbb92=this;return function(_0x53a2e4){if(_0x53a2e4){freeIsNotKey(_0x53a2e4,_0x4fbb92[_0xaa41('0x24')],'id');for(var _0x5673c=0x0,_0x951e52={},_0x4e8d2e={};_0x5673c<_0x53a2e4[_0xaa41('0x19')];_0x5673c+=0x1){_0x951e52=_0x53a2e4[_0x5673c];if(_[_0xaa41('0x1a')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']])){_0x4fbb92['faxQueues'][_0x951e52['id']]=new FaxQueue(_0x951e52);}else{_0x4fbb92[_0xaa41('0x17')](_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']],_0x951e52);}_0x4fbb92[_0xaa41('0x24')][_0x951e52['id']][_0xaa41('0x21')]();_0x4fbb92['faxQueues'][_0x951e52['id']]['updateRealtime']();}}return _0x4fbb92[_0xaa41('0x24')];};};Realtime[_0xaa41('0x16')]['initWhatsappQueues']=function(){var _0x4101ab=this;return function(_0x563687){if(_0x563687){freeIsNotKey(_0x563687,_0x4101ab[_0xaa41('0xe')],'id');for(var _0x25f2df=0x0,_0x1a2d11={},_0x466eee={};_0x25f2df<_0x563687[_0xaa41('0x19')];_0x25f2df+=0x1){_0x1a2d11=_0x563687[_0x25f2df];if(_[_0xaa41('0x1a')](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']])){_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']]=new WhatsappQueue(_0x1a2d11);}else{_0x4101ab['mergeFromDatabase'](_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']],_0x1a2d11);}_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x21')]();_0x4101ab[_0xaa41('0xe')][_0x1a2d11['id']][_0xaa41('0x22')]();}}return _0x4101ab[_0xaa41('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 32e4a35..2abcb46 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 _0x1725=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x1725,0x17d));var _0x5172=function(_0x5de693,_0x3c7e12){_0x5de693=_0x5de693-0x0;var _0x13610c=_0x1725[_0x5de693];return _0x13610c;};'use strict';var client=require(_0x5172('0x0'));exports[_0x5172('0x1')]=function(_0x376054,_0x413460){return client['Request'](_0x5172('0x2'),{'body':_0x413460,'options':{'where':{'id':_0x376054}},'log':_0x5172('0x3')});};exports[_0x5172('0x4')]=function(_0x5792b7,_0x117bfa){return client[_0x5172('0x5')](_0x5172('0x6'),{'body':_0x117bfa,'options':{'where':{'id':_0x5792b7}},'log':_0x5172('0x7')});}; \ No newline at end of file +var _0xa5b2=['addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x31b137,_0xa54c07){var _0x35a4f8=function(_0x28e248){while(--_0x28e248){_0x31b137['push'](_0x31b137['shift']());}};_0x35a4f8(++_0xa54c07);}(_0xa5b2,0x129));var _0x2a5b=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xa5b2[_0x4ea413];return _0x51cf25;};'use strict';var client=require('../client');exports['update']=function(_0x465b99,_0x2d1d46){return client[_0x2a5b('0x0')](_0x2a5b('0x1'),{'body':_0x2d1d46,'options':{'where':{'id':_0x465b99}},'log':_0x2a5b('0x2')});};exports['addTags']=function(_0x3b92e9,_0x178c8d){return client[_0x2a5b('0x0')]('AddTagsToChatInteraction',{'body':_0x178c8d,'options':{'where':{'id':_0x3b92e9}},'log':_0x2a5b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index da14138..2bfce86 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 _0xc23e=['Request','CreateChatMessage','createChatMessage'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xc23e,0xea));var _0xec23=function(_0x10e7b1,_0x1964d3){_0x10e7b1=_0x10e7b1-0x0;var _0x23c093=_0xc23e[_0x10e7b1];return _0x23c093;};'use strict';var client=require('../client');exports['create']=function(_0x2cf835){return client[_0xec23('0x0')](_0xec23('0x1'),{'body':_0x2cf835,'log':_0xec23('0x2')});}; \ No newline at end of file +var _0xab16=['Request','CreateChatMessage','../client'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xab16,0x158));var _0x6ab1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab16[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x6ab1('0x0'));exports['create']=function(_0x1b9dc4){return client[_0x6ab1('0x1')](_0x6ab1('0x2'),{'body':_0x1b9dc4,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a4926e9..40f218b 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 _0xb9c4=['name','strategy','User','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x45de1c,_0x3559d5){var _0xebc059=function(_0x5347bc){while(--_0x5347bc){_0x45de1c['push'](_0x45de1c['shift']());}};_0xebc059(++_0x3559d5);}(_0xb9c4,0xcd));var _0x4b9c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xb9c4[_0x87b0ff];return _0x3bc0b2;};'use strict';var client=require(_0x4b9c('0x0'));exports[_0x4b9c('0x1')]=function(){return function(){return client['Request'](_0x4b9c('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b9c('0x3'),'timeout',_0x4b9c('0x4')],'include':[{'model':_0x4b9c('0x5'),'as':'Agents','attributes':['id',_0x4b9c('0x3'),_0x4b9c('0x6'),_0x4b9c('0x7')]}]},'log':_0x4b9c('0x1')});};}; \ No newline at end of file +var _0x266c=['User','Agents','online','getChatQueues','Request','name','timeout'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x266c,0x1f4));var _0xc266=function(_0x575b2b,_0x56d131){_0x575b2b=_0x575b2b-0x0;var _0x107020=_0x266c[_0x575b2b];return _0x107020;};'use strict';var client=require('../client');exports[_0xc266('0x0')]=function(){return function(){return client[_0xc266('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xc266('0x2'),_0xc266('0x3'),'strategy'],'include':[{'model':_0xc266('0x4'),'as':_0xc266('0x5'),'attributes':['id',_0xc266('0x2'),_0xc266('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ede5dcc..57c5312 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 _0xb492=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb492,0x172));var _0x2b49=function(_0xd6f844,_0x2d5ce6){_0xd6f844=_0xd6f844-0x0;var _0x14ba30=_0xb492[_0xd6f844];return _0x14ba30;};'use strict';var client=require('../client');exports[_0x2b49('0x0')]=function(_0x32fdad){return client[_0x2b49('0x1')](_0x2b49('0x2'),{'body':_0x32fdad,'log':'CreateChatQueueReport'});};exports['update']=function(_0x31a7e5,_0x340296){return client[_0x2b49('0x1')](_0x2b49('0x3'),{'body':_0x340296,'options':{'where':{'uniqueid':_0x31a7e5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x3c7b=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x10fcc2,_0x39be04){_0x10fcc2=_0x10fcc2-0x0;var _0x31ee73=_0x3c7b[_0x10fcc2];return _0x31ee73;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(_0xc43ced){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'body':_0xc43ced,'log':'CreateChatQueueReport'});};exports['update']=function(_0x500bea,_0x5b34ef){return client[_0xb3c7('0x2')](_0xb3c7('0x4'),{'body':_0x5b34ef,'options':{'where':{'uniqueid':_0x500bea},'order':[['id','DESC']],'limit':0x1},'log':_0xb3c7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4557bbd..c21b055 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 _0x783d=['updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update'];(function(_0x2ee4ca,_0x568fad){var _0x1c4647=function(_0x407937){while(--_0x407937){_0x2ee4ca['push'](_0x2ee4ca['shift']());}};_0x1c4647(++_0x568fad);}(_0x783d,0x12b));var _0xd783=function(_0x452881,_0x57eeec){_0x452881=_0x452881-0x0;var _0x25d680=_0x783d[_0x452881];return _0x25d680;};'use strict';var client=require(_0xd783('0x0'));exports[_0xd783('0x1')]=function(_0x1c2a38,_0x17d927){return client['Request']('UpdateFaxInteraction',{'body':_0x17d927,'options':{'where':{'id':_0x1c2a38}},'log':_0xd783('0x2')});};exports[_0xd783('0x3')]=function(_0x48042d,_0x41eaad){return client[_0xd783('0x4')](_0xd783('0x5'),{'body':_0x41eaad,'options':{'where':{'id':_0x48042d}},'log':_0xd783('0x6')});}; \ No newline at end of file +var _0x5de0=['addTagsToFaxInteraction','update','UpdateFaxInteraction','updateFaxInteraction','Request'];(function(_0x5a532a,_0x3eaad1){var _0x41a89b=function(_0x2f6dfe){while(--_0x2f6dfe){_0x5a532a['push'](_0x5a532a['shift']());}};_0x41a89b(++_0x3eaad1);}(_0x5de0,0x1aa));var _0x05de=function(_0x1c28a6,_0xda987){_0x1c28a6=_0x1c28a6-0x0;var _0x46a76a=_0x5de0[_0x1c28a6];return _0x46a76a;};'use strict';var client=require('../client');exports[_0x05de('0x0')]=function(_0x378dba,_0x129afa){return client['Request'](_0x05de('0x1'),{'body':_0x129afa,'options':{'where':{'id':_0x378dba}},'log':_0x05de('0x2')});};exports['addTags']=function(_0x3dc42f,_0x40694e){return client[_0x05de('0x3')]('AddTagsToFaxInteraction',{'body':_0x40694e,'options':{'where':{'id':_0x3dc42f}},'log':_0x05de('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3d1c982..b2fd4a2 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 _0x11f9=['CreateFaxMessage','createFaxMessage','Request'];(function(_0x1486af,_0x43fc96){var _0x41a52e=function(_0x5c6a28){while(--_0x5c6a28){_0x1486af['push'](_0x1486af['shift']());}};_0x41a52e(++_0x43fc96);}(_0x11f9,0xb9));var _0x911f=function(_0x494173,_0x42721d){_0x494173=_0x494173-0x0;var _0x2f4883=_0x11f9[_0x494173];return _0x2f4883;};'use strict';var client=require('../client');exports['create']=function(_0x35a8d8){return client[_0x911f('0x0')](_0x911f('0x1'),{'body':_0x35a8d8,'log':_0x911f('0x2')});}; \ No newline at end of file +var _0xd069=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x2e7ba5,_0x4d6b62){var _0x346b05=function(_0x57302d){while(--_0x57302d){_0x2e7ba5['push'](_0x2e7ba5['shift']());}};_0x346b05(++_0x4d6b62);}(_0xd069,0x1cc));var _0x9d06=function(_0x59659b,_0x38a9a7){_0x59659b=_0x59659b-0x0;var _0x5db166=_0xd069[_0x59659b];return _0x5db166;};'use strict';var client=require(_0x9d06('0x0'));exports['create']=function(_0x464f6f){return client[_0x9d06('0x1')](_0x9d06('0x2'),{'body':_0x464f6f,'log':_0x9d06('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 58ff10a..f171088 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 _0x7034=['timeout','strategy','User','Agents','online','../client','name'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7034,0x108));var _0x4703=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x7034[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0x4703('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4703('0x1'),_0x4703('0x2'),_0x4703('0x3')],'include':[{'model':_0x4703('0x4'),'as':_0x4703('0x5'),'attributes':['id','name',_0x4703('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xae52=['User','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0xae52,0xca));var _0x2ae5=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xae52[_0x37a79c];return _0x561d89;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x2ae5('0x0')](_0x2ae5('0x1'),{'options':{'raw':![],'attributes':['id',_0x2ae5('0x2'),_0x2ae5('0x3'),_0x2ae5('0x4')],'include':[{'model':_0x2ae5('0x5'),'as':'Agents','attributes':['id',_0x2ae5('0x2'),_0x2ae5('0x6'),_0x2ae5('0x7')]}]},'log':_0x2ae5('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index fff85c5..57d5136 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 _0x120b=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x56e362,_0x6779cc){var _0x4a752c=function(_0x4256fb){while(--_0x4256fb){_0x56e362['push'](_0x56e362['shift']());}};_0x4a752c(++_0x6779cc);}(_0x120b,0x8f));var _0xb120=function(_0x44471c,_0x5f1e2e){_0x44471c=_0x44471c-0x0;var _0x5efbb3=_0x120b[_0x44471c];return _0x5efbb3;};'use strict';var client=require(_0xb120('0x0'));exports[_0xb120('0x1')]=function(_0x4db2ac){return client[_0xb120('0x2')](_0xb120('0x3'),{'body':_0x4db2ac,'log':_0xb120('0x3')});};exports[_0xb120('0x4')]=function(_0x2f5e7a,_0xe1d9d1){return client[_0xb120('0x2')](_0xb120('0x5'),{'body':_0xe1d9d1,'options':{'where':{'uniqueid':_0x2f5e7a},'order':[['id',_0xb120('0x6')]],'limit':0x1},'log':_0xb120('0x5')});}; \ No newline at end of file +var _0xfeb3=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','Request'];(function(_0x201aa6,_0x387b57){var _0x2b7323=function(_0x39c9b2){while(--_0x39c9b2){_0x201aa6['push'](_0x201aa6['shift']());}};_0x2b7323(++_0x387b57);}(_0xfeb3,0x11c));var _0x3feb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfeb3[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports['create']=function(_0x29b795){return client[_0x3feb('0x0')](_0x3feb('0x1'),{'body':_0x29b795,'log':_0x3feb('0x1')});};exports[_0x3feb('0x2')]=function(_0x390ebf,_0x384288){return client[_0x3feb('0x0')](_0x3feb('0x3'),{'body':_0x384288,'options':{'where':{'uniqueid':_0x390ebf},'order':[['id',_0x3feb('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 0957bfd..2c8c731 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 _0x9c9b=['Interval','interval','getIntervals','Request','GetInterval','name'];(function(_0x302faa,_0x129477){var _0x412a49=function(_0x213fa4){while(--_0x213fa4){_0x302faa['push'](_0x302faa['shift']());}};_0x412a49(++_0x129477);}(_0x9c9b,0x194));var _0xb9c9=function(_0x12740c,_0x1da26a){_0x12740c=_0x12740c-0x0;var _0x5509dd=_0x9c9b[_0x12740c];return _0x5509dd;};'use strict';var client=require('../client');exports[_0xb9c9('0x0')]=function(){return function(){return client[_0xb9c9('0x1')](_0xb9c9('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb9c9('0x3')],'include':[{'model':_0xb9c9('0x4'),'as':'Intervals','attributes':['id',_0xb9c9('0x3'),_0xb9c9('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x6017=['getIntervals','Request','name','Interval','../client'];(function(_0x183d0e,_0x1f520f){var _0x278ff8=function(_0x49b6d1){while(--_0x49b6d1){_0x183d0e['push'](_0x183d0e['shift']());}};_0x278ff8(++_0x1f520f);}(_0x6017,0xae));var _0x7601=function(_0x1a7b57,_0x58320e){_0x1a7b57=_0x1a7b57-0x0;var _0x217b5c=_0x6017[_0x1a7b57];return _0x217b5c;};'use strict';var client=require(_0x7601('0x0'));exports[_0x7601('0x1')]=function(){return function(){return client[_0x7601('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7601('0x3')],'include':[{'model':_0x7601('0x4'),'as':'Intervals','attributes':['id',_0x7601('0x3'),'interval']}]},'log':_0x7601('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d1ef545..034d398 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 _0xd81d=['updateMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction'];(function(_0x443f85,_0x1c2f84){var _0x40d7fe=function(_0x3e7a75){while(--_0x3e7a75){_0x443f85['push'](_0x443f85['shift']());}};_0x40d7fe(++_0x1c2f84);}(_0xd81d,0x1a1));var _0xdd81=function(_0x16812f,_0x27e01b){_0x16812f=_0x16812f-0x0;var _0x1715b3=_0xd81d[_0x16812f];return _0x1715b3;};'use strict';var client=require('../client');exports[_0xdd81('0x0')]=function(_0x5de05f,_0x23c1ec){return client[_0xdd81('0x1')](_0xdd81('0x2'),{'body':_0x23c1ec,'options':{'where':{'id':_0x5de05f}},'log':_0xdd81('0x3')});};exports['addTags']=function(_0x166696,_0x48a25a){return client['Request']('AddTagsToMailInteraction',{'body':_0x48a25a,'options':{'where':{'id':_0x166696}},'log':_0xdd81('0x4')});}; \ No newline at end of file +var _0x6b37=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','../client'];(function(_0x3d95dd,_0xe01cf3){var _0x53632c=function(_0x23424a){while(--_0x23424a){_0x3d95dd['push'](_0x3d95dd['shift']());}};_0x53632c(++_0xe01cf3);}(_0x6b37,0xa7));var _0x76b3=function(_0x3593aa,_0x2c44fe){_0x3593aa=_0x3593aa-0x0;var _0x3f2dd5=_0x6b37[_0x3593aa];return _0x3f2dd5;};'use strict';var client=require(_0x76b3('0x0'));exports[_0x76b3('0x1')]=function(_0x3e1b74,_0x3e59be){return client[_0x76b3('0x2')](_0x76b3('0x3'),{'body':_0x3e59be,'options':{'where':{'id':_0x3e1b74}},'log':_0x76b3('0x4')});};exports['addTags']=function(_0x463428,_0x581dfa){return client['Request'](_0x76b3('0x5'),{'body':_0x581dfa,'options':{'where':{'id':_0x463428}},'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 6765d80..2273ea3 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 _0xed31=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x344b5c,_0x6fe280){var _0xd29b16=function(_0x14e90d){while(--_0x14e90d){_0x344b5c['push'](_0x344b5c['shift']());}};_0xd29b16(++_0x6fe280);}(_0xed31,0xc0));var _0x1ed3=function(_0x3f37f1,_0x199544){_0x3f37f1=_0x3f37f1-0x0;var _0x216258=_0xed31[_0x3f37f1];return _0x216258;};'use strict';var client=require(_0x1ed3('0x0'));exports[_0x1ed3('0x1')]=function(_0x2969bf){return client[_0x1ed3('0x2')](_0x1ed3('0x3'),{'body':_0x2969bf,'log':_0x1ed3('0x4')});}; \ No newline at end of file +var _0xf3e1=['create','createMailMessage','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3e1,0x83));var _0x1f3e=function(_0x57d311,_0x1d4157){_0x57d311=_0x57d311-0x0;var _0x23ae1b=_0xf3e1[_0x57d311];return _0x23ae1b;};'use strict';var client=require(_0x1f3e('0x0'));exports[_0x1f3e('0x1')]=function(_0x5eaa2b){return client['Request']('CreateMailMessage',{'body':_0x5eaa2b,'log':_0x1f3e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0f4e47c..7988509 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 _0x2f03=['mailPause','getMailQueues','GetMailQueue','name','timeout','User','Agents','online'];(function(_0x42ad15,_0xc29504){var _0x187ecd=function(_0x2f8574){while(--_0x2f8574){_0x42ad15['push'](_0x42ad15['shift']());}};_0x187ecd(++_0xc29504);}(_0x2f03,0x1f1));var _0x32f0=function(_0x456970,_0x4a254e){_0x456970=_0x456970-0x0;var _0x1bf80d=_0x2f03[_0x456970];return _0x1bf80d;};'use strict';var client=require('../client');exports[_0x32f0('0x0')]=function(){return function(){return client['Request'](_0x32f0('0x1'),{'options':{'raw':![],'attributes':['id',_0x32f0('0x2'),_0x32f0('0x3'),'strategy'],'include':[{'model':_0x32f0('0x4'),'as':_0x32f0('0x5'),'attributes':['id',_0x32f0('0x2'),_0x32f0('0x6'),_0x32f0('0x7')]}]},'log':_0x32f0('0x0')});};}; \ No newline at end of file +var _0x0593=['name','timeout','mailPause','../client','getMailQueues','Request'];(function(_0x1b2a77,_0x312098){var _0x4d78b6=function(_0x27da8a){while(--_0x27da8a){_0x1b2a77['push'](_0x1b2a77['shift']());}};_0x4d78b6(++_0x312098);}(_0x0593,0x189));var _0x3059=function(_0x2addec,_0x469ad0){_0x2addec=_0x2addec-0x0;var _0x361042=_0x0593[_0x2addec];return _0x361042;};'use strict';var client=require(_0x3059('0x0'));exports[_0x3059('0x1')]=function(){return function(){return client[_0x3059('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x3059('0x3'),_0x3059('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x3059('0x3'),'online',_0x3059('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7061b89..702f864 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 _0x10b8=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x13a4ff,_0x53e3ca){var _0x61bd30=function(_0x3fe209){while(--_0x3fe209){_0x13a4ff['push'](_0x13a4ff['shift']());}};_0x61bd30(++_0x53e3ca);}(_0x10b8,0x14e));var _0x810b=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x10b8[_0x11c573];return _0x6b72de;};'use strict';var client=require('../client');exports['create']=function(_0x4183ac){return client[_0x810b('0x0')]('CreateMailQueueReport',{'body':_0x4183ac,'log':_0x810b('0x1')});};exports[_0x810b('0x2')]=function(_0xb30506,_0x2f62d5){return client['Request'](_0x810b('0x3'),{'body':_0x2f62d5,'options':{'where':{'uniqueid':_0xb30506},'order':[['id',_0x810b('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xcfa3=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xcfa3,0x112));var _0x3cfa=function(_0x219297,_0x32b851){_0x219297=_0x219297-0x0;var _0x1a1a85=_0xcfa3[_0x219297];return _0x1a1a85;};'use strict';var client=require(_0x3cfa('0x0'));exports[_0x3cfa('0x1')]=function(_0x2e1989){return client[_0x3cfa('0x2')]('CreateMailQueueReport',{'body':_0x2e1989,'log':_0x3cfa('0x3')});};exports[_0x3cfa('0x4')]=function(_0x2bd33c,_0x56300d){return client[_0x3cfa('0x2')](_0x3cfa('0x5'),{'body':_0x56300d,'options':{'where':{'uniqueid':_0x2bd33c},'order':[['id',_0x3cfa('0x6')]],'limit':0x1},'log':_0x3cfa('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9ac9eb6..e8c01d6 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 _0x568e=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x11bb17,_0x590d0f){var _0x44a838=function(_0x3a1bd4){while(--_0x3a1bd4){_0x11bb17['push'](_0x11bb17['shift']());}};_0x44a838(++_0x590d0f);}(_0x568e,0x1e2));var _0xe568=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x568e[_0x3d42d8];return _0x27fc41;};'use strict';var client=require(_0xe568('0x0'));exports[_0xe568('0x1')]=function(_0xf541fe,_0x131ded){return client[_0xe568('0x2')](_0xe568('0x3'),{'body':_0x131ded,'options':{'where':{'id':_0xf541fe}},'log':_0xe568('0x4')});};exports[_0xe568('0x5')]=function(_0x4a01f7,_0x3572ce){return client[_0xe568('0x2')](_0xe568('0x6'),{'body':_0x3572ce,'options':{'where':{'id':_0x4a01f7}},'log':_0xe568('0x7')});}; \ No newline at end of file +var _0x990d=['../client','update','UpdateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x990d,0x16c));var _0xd990=function(_0xe326ae,_0x49dd64){_0xe326ae=_0xe326ae-0x0;var _0x2bde3c=_0x990d[_0xe326ae];return _0x2bde3c;};'use strict';var client=require(_0xd990('0x0'));exports[_0xd990('0x1')]=function(_0x1b6648,_0x18e8b4){return client['Request'](_0xd990('0x2'),{'body':_0x18e8b4,'options':{'where':{'id':_0x1b6648}},'log':'updateOpenchannelInteraction'});};exports[_0xd990('0x3')]=function(_0x2cd5da,_0x4e3ee4){return client[_0xd990('0x4')](_0xd990('0x5'),{'body':_0x4e3ee4,'options':{'where':{'id':_0x2cd5da}},'log':_0xd990('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2a0512d..06b5cfc 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 _0xb43b=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5a05c6,_0x47510b){_0x5a05c6=_0x5a05c6-0x0;var _0x29f374=_0xb43b[_0x5a05c6];return _0x29f374;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(_0x5c45dd){return client[_0xbb43('0x2')](_0xbb43('0x3'),{'body':_0x5c45dd,'log':_0xbb43('0x4')});}; \ No newline at end of file +var _0x5b02=['create','Request','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x558d3c,_0xe9e9f8){_0x558d3c=_0x558d3c-0x0;var _0x1d7694=_0x5b02[_0x558d3c];return _0x1d7694;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateOpenchannelMessage',{'body':_0x428458,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 97e4621..bfd8637 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 _0xb71e=['strategy','Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb71e,0xac));var _0xeb71=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xb71e[_0x411017];return _0x2adeea;};'use strict';var client=require('../client');exports[_0xeb71('0x0')]=function(){return function(){return client['Request'](_0xeb71('0x1'),{'options':{'raw':![],'attributes':['id',_0xeb71('0x2'),'timeout',_0xeb71('0x3')],'include':[{'model':'User','as':_0xeb71('0x4'),'attributes':['id',_0xeb71('0x2'),_0xeb71('0x5'),_0xeb71('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x757e=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x40ac95,_0x3ddaf7){var _0x3b1c1c=function(_0x5054a4){while(--_0x5054a4){_0x40ac95['push'](_0x40ac95['shift']());}};_0x3b1c1c(++_0x3ddaf7);}(_0x757e,0xf0));var _0xe757=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x757e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe757('0x0'));exports[_0xe757('0x1')]=function(){return function(){return client[_0xe757('0x2')](_0xe757('0x3'),{'options':{'raw':![],'attributes':['id',_0xe757('0x4'),_0xe757('0x5'),_0xe757('0x6')],'include':[{'model':_0xe757('0x7'),'as':_0xe757('0x8'),'attributes':['id',_0xe757('0x4'),_0xe757('0x9'),_0xe757('0xa')]}]},'log':_0xe757('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 15a38f2..9961cfb 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 _0xaac9=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x2ae15f,_0x3e1860){var _0x42a3d3=function(_0xcd0e60){while(--_0xcd0e60){_0x2ae15f['push'](_0x2ae15f['shift']());}};_0x42a3d3(++_0x3e1860);}(_0xaac9,0x1a4));var _0x9aac=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xaac9[_0x58b301];return _0x2171b3;};'use strict';var client=require(_0x9aac('0x0'));exports[_0x9aac('0x1')]=function(_0x59eaf2){return client[_0x9aac('0x2')](_0x9aac('0x3'),{'body':_0x59eaf2,'log':'CreateOpenchannelQueueReport'});};exports[_0x9aac('0x4')]=function(_0x4cb941,_0x4c7605){return client[_0x9aac('0x2')](_0x9aac('0x5'),{'body':_0x4c7605,'options':{'where':{'uniqueid':_0x4cb941},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x1359=['update','UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1359,0x1e9));var _0x9135=function(_0x1b7a1e,_0x5306ac){_0x1b7a1e=_0x1b7a1e-0x0;var _0x146d2e=_0x1359[_0x1b7a1e];return _0x146d2e;};'use strict';var client=require('../client');exports[_0x9135('0x0')]=function(_0x2bff72){return client[_0x9135('0x1')](_0x9135('0x2'),{'body':_0x2bff72,'log':_0x9135('0x2')});};exports[_0x9135('0x3')]=function(_0x5c6e3f,_0x511b01){return client['Request'](_0x9135('0x4'),{'body':_0x511b01,'options':{'where':{'uniqueid':_0x5c6e3f},'order':[['id',_0x9135('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index afe1cbd..74822ec 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 _0x44f2=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x5b7802,_0x2a1194){var _0x239c45=function(_0x4337f2){while(--_0x4337f2){_0x5b7802['push'](_0x5b7802['shift']());}};_0x239c45(++_0x2a1194);}(_0x44f2,0xc4));var _0x244f=function(_0xaa1cab,_0x5f54b2){_0xaa1cab=_0xaa1cab-0x0;var _0x48cbeb=_0x44f2[_0xaa1cab];return _0x48cbeb;};'use strict';var client=require(_0x244f('0x0'));exports[_0x244f('0x1')]=function(_0x2aabd2,_0x4b0c64){return client[_0x244f('0x2')](_0x244f('0x3'),{'body':_0x4b0c64,'options':{'where':{'id':_0x2aabd2}},'log':_0x244f('0x4')});};exports[_0x244f('0x5')]=function(_0x519e1a,_0x40ae1a){return client[_0x244f('0x2')](_0x244f('0x6'),{'body':_0x40ae1a,'options':{'where':{'id':_0x519e1a}},'log':_0x244f('0x7')});}; \ No newline at end of file +var _0xc023=['updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc023,0x162));var _0x3c02=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0xc023[_0x1a7edf];return _0x56c1d9;};'use strict';var client=require('../client');exports['update']=function(_0x185088,_0x44bea7){return client['Request']('UpdateSmsInteraction',{'body':_0x44bea7,'options':{'where':{'id':_0x185088}},'log':_0x3c02('0x0')});};exports[_0x3c02('0x1')]=function(_0x2808d1,_0xd7ca63){return client['Request']('AddTagsToSmsInteraction',{'body':_0xd7ca63,'options':{'where':{'id':_0x2808d1}},'log':_0x3c02('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 6620473..6a63cea 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 _0x6443=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6443,0xda));var _0x3644=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0x6443[_0x1b1f88];return _0x5045b9;};'use strict';var client=require(_0x3644('0x0'));exports[_0x3644('0x1')]=function(_0x49429d){return client[_0x3644('0x2')](_0x3644('0x3'),{'body':_0x49429d,'log':_0x3644('0x4')});}; \ No newline at end of file +var _0x28a1=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x304107,_0xa47eaf){var _0x43d4af=function(_0x1d88b8){while(--_0x1d88b8){_0x304107['push'](_0x304107['shift']());}};_0x43d4af(++_0xa47eaf);}(_0x28a1,0x7b));var _0x128a=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x28a1[_0x2ca616];return _0x53155f;};'use strict';var client=require(_0x128a('0x0'));exports[_0x128a('0x1')]=function(_0x4decd1){return client['Request'](_0x128a('0x2'),{'body':_0x4decd1,'log':_0x128a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 038db48..2dbe836 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 _0x33d0=['strategy','User','Agents','online','../client','getSmsQueues','Request','name'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x33d0,0x144));var _0x033d=function(_0x5d9d60,_0x27d60e){_0x5d9d60=_0x5d9d60-0x0;var _0x2c81a0=_0x33d0[_0x5d9d60];return _0x2c81a0;};'use strict';var client=require(_0x033d('0x0'));exports[_0x033d('0x1')]=function(){return function(){return client[_0x033d('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x033d('0x3'),'timeout',_0x033d('0x4')],'include':[{'model':_0x033d('0x5'),'as':_0x033d('0x6'),'attributes':['id','name',_0x033d('0x7'),'smsPause']}]},'log':_0x033d('0x1')});};}; \ No newline at end of file +var _0x0a9f=['name','strategy','online','smsPause','../client','getSmsQueues','GetSmsQueue'];(function(_0x200d3e,_0x34149b){var _0x2dc8b4=function(_0x311d2e){while(--_0x311d2e){_0x200d3e['push'](_0x200d3e['shift']());}};_0x2dc8b4(++_0x34149b);}(_0x0a9f,0x169));var _0xf0a9=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x0a9f[_0x68c979];return _0x4f0001;};'use strict';var client=require(_0xf0a9('0x0'));exports[_0xf0a9('0x1')]=function(){return function(){return client['Request'](_0xf0a9('0x2'),{'options':{'raw':![],'attributes':['id',_0xf0a9('0x3'),'timeout',_0xf0a9('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xf0a9('0x5'),_0xf0a9('0x6')]}]},'log':_0xf0a9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1a1a6fc..f85c4a9 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 _0x8a21=['UpdateSmsQueueReport','DESC','../client','Request','CreateSmsQueueReport'];(function(_0x3f5217,_0xc26207){var _0x466723=function(_0x4a4e31){while(--_0x4a4e31){_0x3f5217['push'](_0x3f5217['shift']());}};_0x466723(++_0xc26207);}(_0x8a21,0x1d8));var _0x18a2=function(_0x3a924d,_0x1f0870){_0x3a924d=_0x3a924d-0x0;var _0x2f9f0b=_0x8a21[_0x3a924d];return _0x2f9f0b;};'use strict';var client=require(_0x18a2('0x0'));exports['create']=function(_0x5a8f1f){return client[_0x18a2('0x1')](_0x18a2('0x2'),{'body':_0x5a8f1f,'log':_0x18a2('0x2')});};exports['update']=function(_0x5a8a45,_0x42b942){return client[_0x18a2('0x1')](_0x18a2('0x3'),{'body':_0x42b942,'options':{'where':{'uniqueid':_0x5a8a45},'order':[['id',_0x18a2('0x4')]],'limit':0x1},'log':_0x18a2('0x3')});}; \ No newline at end of file +var _0x68a5=['update','UpdateSmsQueueReport','../client','Request','CreateSmsQueueReport'];(function(_0x2ffee5,_0x4ce03c){var _0x41ee45=function(_0x4a3b44){while(--_0x4a3b44){_0x2ffee5['push'](_0x2ffee5['shift']());}};_0x41ee45(++_0x4ce03c);}(_0x68a5,0xfc));var _0x568a=function(_0x145a90,_0x3e5817){_0x145a90=_0x145a90-0x0;var _0x1ae743=_0x68a5[_0x145a90];return _0x1ae743;};'use strict';var client=require(_0x568a('0x0'));exports['create']=function(_0x21e4e6){return client[_0x568a('0x1')]('CreateSmsQueueReport',{'body':_0x21e4e6,'log':_0x568a('0x2')});};exports[_0x568a('0x3')]=function(_0x2f3a02,_0x2d4dce){return client['Request'](_0x568a('0x4'),{'body':_0x2d4dce,'options':{'where':{'uniqueid':_0x2f3a02},'order':[['id','DESC']],'limit':0x1},'log':_0x568a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 7730a3b..5c5b942 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 _0x81de=['faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','name','online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','chatCapacity','mailCapacity'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0x81de,0x1c4));var _0xe81d=function(_0x4b7ccb,_0x5ab4bd){_0x4b7ccb=_0x4b7ccb-0x0;var _0x41aa57=_0x81de[_0x4b7ccb];return _0x41aa57;};'use strict';var client=require('../client');exports[_0xe81d('0x0')]=function(){return function(){return client[_0xe81d('0x1')](_0xe81d('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xe81d('0x3'),_0xe81d('0x4'),_0xe81d('0x5'),_0xe81d('0x6'),_0xe81d('0x7'),'chatPause',_0xe81d('0x8'),_0xe81d('0x9'),'smsPause','whatsappPause','openchannelPause',_0xe81d('0xa'),_0xe81d('0xb'),_0xe81d('0xc'),_0xe81d('0xd'),_0xe81d('0xe'),_0xe81d('0xf')]},'log':_0xe81d('0x0')});};}; \ No newline at end of file +var _0x7211=['online','lastPauseAt','chatPause','faxPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','GetUser','agent','name'];(function(_0x59f977,_0x43a7c2){var _0x372f8a=function(_0x53e42c){while(--_0x53e42c){_0x59f977['push'](_0x59f977['shift']());}};_0x372f8a(++_0x43a7c2);}(_0x7211,0xbe));var _0x1721=function(_0x2df20f,_0x3b2c0e){_0x2df20f=_0x2df20f-0x0;var _0x4fa98b=_0x7211[_0x2df20f];return _0x4fa98b;};'use strict';var client=require(_0x1721('0x0'));exports[_0x1721('0x1')]=function(){return function(){return client['Request'](_0x1721('0x2'),{'options':{'raw':!![],'where':{'role':_0x1721('0x3')},'attributes':['id',_0x1721('0x4'),_0x1721('0x5'),'pauseType',_0x1721('0x6'),'voicePause',_0x1721('0x7'),'mailPause',_0x1721('0x8'),'smsPause',_0x1721('0x9'),_0x1721('0xa'),_0x1721('0xb'),'mailCapacity',_0x1721('0xc'),'smsCapacity',_0x1721('0xd'),_0x1721('0xe')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ad2541e..43a8d46 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 _0x5d55=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x413645,_0x25f334){var _0x13ab91=function(_0x286406){while(--_0x286406){_0x413645['push'](_0x413645['shift']());}};_0x13ab91(++_0x25f334);}(_0x5d55,0x1a4));var _0x55d5=function(_0x4d8b68,_0x3697b8){_0x4d8b68=_0x4d8b68-0x0;var _0x3da45c=_0x5d55[_0x4d8b68];return _0x3da45c;};'use strict';var client=require('../client');exports[_0x55d5('0x0')]=function(_0x4cd0e2,_0x1de575){return client[_0x55d5('0x1')]('UpdateWhatsappInteraction',{'body':_0x1de575,'options':{'where':{'id':_0x4cd0e2}},'log':_0x55d5('0x2')});};exports[_0x55d5('0x3')]=function(_0x3bca0b,_0x546e6c){return client[_0x55d5('0x1')](_0x55d5('0x4'),{'body':_0x546e6c,'options':{'where':{'id':_0x3bca0b}},'log':_0x55d5('0x5')});}; \ No newline at end of file +var _0xb0d9=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x26a1dc,_0x380fb3){var _0x529678=function(_0x2c8c14){while(--_0x2c8c14){_0x26a1dc['push'](_0x26a1dc['shift']());}};_0x529678(++_0x380fb3);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x255e48,_0x26f5b8){_0x255e48=_0x255e48-0x0;var _0x11c1a1=_0xb0d9[_0x255e48];return _0x11c1a1;};'use strict';var client=require(_0x9b0d('0x0'));exports[_0x9b0d('0x1')]=function(_0x42b875,_0x36bf09){return client[_0x9b0d('0x2')](_0x9b0d('0x3'),{'body':_0x36bf09,'options':{'where':{'id':_0x42b875}},'log':'updateWhatsappInteraction'});};exports[_0x9b0d('0x4')]=function(_0x5dd128,_0x4d327a){return client['Request'](_0x9b0d('0x5'),{'body':_0x4d327a,'options':{'where':{'id':_0x5dd128}},'log':_0x9b0d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 9c5ec17..701ce44 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 _0xc17e=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x53e6fe,_0x3236cf){var _0x1e75b4=function(_0x18d3dd){while(--_0x18d3dd){_0x53e6fe['push'](_0x53e6fe['shift']());}};_0x1e75b4(++_0x3236cf);}(_0xc17e,0x1ad));var _0xec17=function(_0x2f6e47,_0x40ba6b){_0x2f6e47=_0x2f6e47-0x0;var _0x29c331=_0xc17e[_0x2f6e47];return _0x29c331;};'use strict';var client=require(_0xec17('0x0'));exports[_0xec17('0x1')]=function(_0x369226){return client[_0xec17('0x2')](_0xec17('0x3'),{'body':_0x369226,'log':_0xec17('0x4')});}; \ No newline at end of file +var _0x16da=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0xdfcb16,_0x5ef1fb){var _0x2d1f6d=function(_0x456e7a){while(--_0x456e7a){_0xdfcb16['push'](_0xdfcb16['shift']());}};_0x2d1f6d(++_0x5ef1fb);}(_0x16da,0x7b));var _0xa16d=function(_0x1c09c3,_0xe71cf0){_0x1c09c3=_0x1c09c3-0x0;var _0x5be371=_0x16da[_0x1c09c3];return _0x5be371;};'use strict';var client=require('../client');exports[_0xa16d('0x0')]=function(_0x3afb30){return client[_0xa16d('0x1')](_0xa16d('0x2'),{'body':_0x3afb30,'log':_0xa16d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8ad8ac6..4bb9825 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 _0x3266=['name','timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x445239,_0xfedccf){var _0xa6f4d5=function(_0x1f57b4){while(--_0x1f57b4){_0x445239['push'](_0x445239['shift']());}};_0xa6f4d5(++_0xfedccf);}(_0x3266,0x6a));var _0x6326=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x3266[_0x5ddaac];return _0x2a9c58;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(){return function(){return client[_0x6326('0x2')](_0x6326('0x3'),{'options':{'raw':![],'attributes':['id',_0x6326('0x4'),_0x6326('0x5'),_0x6326('0x6')],'include':[{'model':_0x6326('0x7'),'as':_0x6326('0x8'),'attributes':['id','name',_0x6326('0x9'),'whatsappPause']}]},'log':_0x6326('0x1')});};}; \ No newline at end of file +var _0xe1e3=['name','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','strategy','Agents'];(function(_0xface3,_0x2dc754){var _0x554771=function(_0x529416){while(--_0x529416){_0xface3['push'](_0xface3['shift']());}};_0x554771(++_0x2dc754);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x2938c9,_0x1ccaa2){_0x2938c9=_0x2938c9-0x0;var _0x38937c=_0xe1e3[_0x2938c9];return _0x38937c;};'use strict';var client=require(_0x3e1e('0x0'));exports[_0x3e1e('0x1')]=function(){return function(){return client['Request'](_0x3e1e('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x3e1e('0x3')],'include':[{'model':'User','as':_0x3e1e('0x4'),'attributes':['id',_0x3e1e('0x5'),_0x3e1e('0x6'),_0x3e1e('0x7')]}]},'log':_0x3e1e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 643bcd7..c9eff34 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 _0xcc53=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x4a0dc8,_0x460c4f){var _0x4b2392=function(_0x7264e9){while(--_0x7264e9){_0x4a0dc8['push'](_0x4a0dc8['shift']());}};_0x4b2392(++_0x460c4f);}(_0xcc53,0xcc));var _0x3cc5=function(_0x21b6c0,_0x9b7744){_0x21b6c0=_0x21b6c0-0x0;var _0x3ca321=_0xcc53[_0x21b6c0];return _0x3ca321;};'use strict';var client=require(_0x3cc5('0x0'));exports[_0x3cc5('0x1')]=function(_0x5ada52){return client[_0x3cc5('0x2')](_0x3cc5('0x3'),{'body':_0x5ada52,'log':_0x3cc5('0x3')});};exports[_0x3cc5('0x4')]=function(_0x46e111,_0x2b9d83){return client['Request'](_0x3cc5('0x5'),{'body':_0x2b9d83,'options':{'where':{'uniqueid':_0x46e111},'order':[['id','DESC']],'limit':0x1},'log':_0x3cc5('0x5')});}; \ No newline at end of file +var _0xf2ac=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0xf2ac,0x9e));var _0xcf2a=function(_0x30f47f,_0x4a77b4){_0x30f47f=_0x30f47f-0x0;var _0x14af65=_0xf2ac[_0x30f47f];return _0x14af65;};'use strict';var client=require(_0xcf2a('0x0'));exports[_0xcf2a('0x1')]=function(_0x283d53){return client[_0xcf2a('0x2')](_0xcf2a('0x3'),{'body':_0x283d53,'log':_0xcf2a('0x3')});};exports[_0xcf2a('0x4')]=function(_0x392593,_0x82f9bb){return client[_0xcf2a('0x2')](_0xcf2a('0x5'),{'body':_0x82f9bb,'options':{'where':{'uniqueid':_0x392593},'order':[['id',_0xcf2a('0x6')]],'limit':0x1},'log':_0xcf2a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 8b84a2c..2ecb8c5 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 _0xcdd9=['toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','routing','./strategy','string','number','info','format','name'];(function(_0xa96b73,_0x5d4c0c){var _0x4aacc7=function(_0x2b4e29){while(--_0x2b4e29){_0xa96b73['push'](_0xa96b73['shift']());}};_0x4aacc7(++_0x5d4c0c);}(_0xcdd9,0xc3));var _0x9cdd=function(_0x5b59f5,_0x36bf1a){_0x5b59f5=_0x5b59f5-0x0;var _0x484a52=_0xcdd9[_0x5b59f5];return _0x484a52;};'use strict';var schema=require('validate');var _=require(_0x9cdd('0x0'));var util=require(_0x9cdd('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x9cdd('0x2'));var strategy=require(_0x9cdd('0x3'));var queue=schema({'name':{'type':_0x9cdd('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9cdd('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x498284,_0x52c8c,_0x3f2c10){return logger[_0x9cdd('0x6')](util[_0x9cdd('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x498284,_0x52c8c[_0x9cdd('0x8')],_0x3f2c10));}function handleFindAgent(_0x4dd1c1){return function(_0x4c99){return _0x4c99['name'][_0x9cdd('0x9')]()===_0x4dd1c1[_0x9cdd('0x9')]();};}exports[_0x9cdd('0xa')]=function(_0x2abee5,_0xbd08f5,_0x41dedf,_0x2669b2){return function(_0x579375){try{var _0xdb4990={'name':_0xbd08f5[0x0],'timeout':_0xbd08f5[0x1]};var _0x1e77b4=queue[_0x9cdd('0xb')](_0xdb4990,{'typecast':!![]});if(_0x1e77b4['length']){logger[_0x9cdd('0xc')](_0x9cdd('0xd'),_0x2abee5,_[_0x9cdd('0xe')](_0x1e77b4,_0x9cdd('0xf'))[_0x9cdd('0x10')](',\x20'));_0x579375[_0x9cdd('0x11')]();}else{var _0x4b996c=_[_0x9cdd('0x12')](_0x41dedf[_0x9cdd('0x13')],handleFindAgent(_0xdb4990[_0x9cdd('0x8')]));if(_0x4b996c){var _0x3cd5e9=(_0xdb4990[_0x9cdd('0x14')]||0xa)*0x3e8;var _0xfab48d,_0x2b8762;var _0x1f8dd4=seqqueue[_0x9cdd('0x15')](_0x3cd5e9);_0x1f8dd4['id']=_0x2abee5;_0x1f8dd4[_0x9cdd('0x16')]=_0x3cd5e9;_0x1f8dd4[_0x9cdd('0x17')]=_0x2669b2[_0x9cdd('0x17')];writeLog(_0x2abee5,_0x4b996c,util[_0x9cdd('0x7')](_0x9cdd('0x18'),_0x3cd5e9));_0x41dedf['rules'][_0x2abee5]['on']('end',function(){logger[_0x9cdd('0x6')](_0x9cdd('0x19'),_0x2abee5);clearTimeout(_0x2b8762);_0x2b8762=undefined;_0x1f8dd4[_0x9cdd('0x1a')]();if(_0x41dedf[_0x9cdd('0x1b')][_0x2abee5]){delete _0x41dedf[_0x9cdd('0x1b')][_0x2abee5];}_0x579375[_0x9cdd('0x11')]();});_0x41dedf[_0x9cdd('0x1b')][_0x2abee5]['on']('complete',function(){if(_0x41dedf[_0x9cdd('0x1b')][_0x2abee5]){delete _0x41dedf[_0x9cdd('0x1b')][_0x2abee5];}});_0x2b8762=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x2abee5);clearTimeout(_0x2b8762);_0x1f8dd4['close']();_0x579375[_0x9cdd('0x1c')]();},_0x3cd5e9);strategy[_0x9cdd('0x1d')](_0x1f8dd4,_0x4b996c,_0x41dedf,_0x2669b2);}else{logger['error'](_0x9cdd('0x1e'),_0x2abee5,_0xdb4990[_0x9cdd('0x8')]);_0x579375['stop']();}}}catch(_0xc73f1){console[_0x9cdd('0x1f')](_0xc73f1);logger[_0x9cdd('0xc')](_0x9cdd('0x20'),_0x2abee5,_0xc73f1[_0x9cdd('0x21')]);_0x579375['stop']();}};}; \ No newline at end of file +var _0xd4ef=['validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','find','agents','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','info','[%s][AGENT]\x20ROUTING\x20END','agent','log','[%s][QUEUE]\x20%s','stack'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4ef,0xfc));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xfd4e('0x0'));var _=require(_0xfd4e('0x1'));var util=require('util');var seqqueue=require(_0xfd4e('0x2'));var logger=require(_0xfd4e('0x3'))(_0xfd4e('0x4'));var strategy=require(_0xfd4e('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xfd4e('0x6')},'timeout':{'type':_0xfd4e('0x7'),'message':_0xfd4e('0x8')}});function writeLog(_0x2f7f04,_0x37460d,_0x259026){return logger['info'](util[_0xfd4e('0x9')](_0xfd4e('0xa'),_0x2f7f04,_0x37460d[_0xfd4e('0xb')],_0x259026));}function handleFindAgent(_0x3fb509){return function(_0x30985d){return _0x30985d[_0xfd4e('0xb')][_0xfd4e('0xc')]()===_0x3fb509[_0xfd4e('0xc')]();};}exports['consequence']=function(_0x202bfe,_0x224c1a,_0x56423e,_0x454b45){return function(_0x128e65){try{var _0x36d037={'name':_0x224c1a[0x0],'timeout':_0x224c1a[0x1]};var _0x5165da=queue['validate'](_0x36d037,{'typecast':!![]});if(_0x5165da[_0xfd4e('0xd')]){logger['error'](_0xfd4e('0xe'),_0x202bfe,_[_0xfd4e('0xf')](_0x5165da,_0xfd4e('0x10'))[_0xfd4e('0x11')](',\x20'));_0x128e65['stop']();}else{var _0x526275=_[_0xfd4e('0x12')](_0x56423e[_0xfd4e('0x13')],handleFindAgent(_0x36d037[_0xfd4e('0xb')]));if(_0x526275){var _0x45c5d5=(_0x36d037['timeout']||0xa)*0x3e8;var _0x32cd33,_0xa63981;var _0x2c7b6f=seqqueue[_0xfd4e('0x14')](_0x45c5d5);_0x2c7b6f['id']=_0x202bfe;_0x2c7b6f[_0xfd4e('0x15')]=_0x45c5d5;_0x2c7b6f[_0xfd4e('0x16')]=_0x454b45['channel'];writeLog(_0x202bfe,_0x526275,util[_0xfd4e('0x9')](_0xfd4e('0x17'),_0x45c5d5));_0x56423e['rules'][_0x202bfe]['on'](_0xfd4e('0x18'),function(){logger['info'](_0xfd4e('0x19'),_0x202bfe);clearTimeout(_0xa63981);_0xa63981=undefined;_0x2c7b6f[_0xfd4e('0x1a')]();if(_0x56423e[_0xfd4e('0x1b')][_0x202bfe]){delete _0x56423e['rules'][_0x202bfe];}_0x128e65[_0xfd4e('0x1c')]();});_0x56423e[_0xfd4e('0x1b')][_0x202bfe]['on'](_0xfd4e('0x1d'),function(){if(_0x56423e['rules'][_0x202bfe]){delete _0x56423e[_0xfd4e('0x1b')][_0x202bfe];}});_0xa63981=setTimeout(function(){logger[_0xfd4e('0x1e')](_0xfd4e('0x1f'),_0x202bfe);clearTimeout(_0xa63981);_0x2c7b6f[_0xfd4e('0x1a')]();_0x128e65['next']();},_0x45c5d5);strategy[_0xfd4e('0x20')](_0x2c7b6f,_0x526275,_0x56423e,_0x454b45);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x202bfe,_0x36d037[_0xfd4e('0xb')]);_0x128e65[_0xfd4e('0x1c')]();}}}catch(_0x13996c){console[_0xfd4e('0x21')](_0x13996c);logger['error'](_0xfd4e('0x22'),_0x202bfe,_0x13996c[_0xfd4e('0x23')]);_0x128e65[_0xfd4e('0x1c')]();}};}; \ 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 46a8c48..96ae4da 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 _0xd009=['message','toString','postText','next','amazonlex','providerResponse','dialogState','Failed','stringify','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0xd009,0x191));var _0x9d00=function(_0x31d794,_0x160894){_0x31d794=_0x31d794-0x0;var _0x325661=_0xd009[_0x31d794];return _0x325661;};'use strict';var _=require(_0x9d00('0x0'));var moment=require(_0x9d00('0x1'));var AWS=require('aws-sdk');var utils=require(_0x9d00('0x2'));var logger=require(_0x9d00('0x3'))('routing');var rpc={'chatMessage':require(_0x9d00('0x4')),'openchannelMessage':require(_0x9d00('0x5')),'mailMessage':require(_0x9d00('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9d00('0x7')),'whatsappMessage':require(_0x9d00('0x8'))};exports[_0x9d00('0x9')]=function(_0x1bf149,_0x522b4c){return function(_0x19bdfa){try{if(!_[_0x9d00('0xa')](this[_0x9d00('0xb')][_0x9d00('0xc')])){logger['info'](_0x9d00('0xd'),_0x1bf149,_0x9d00('0xe'));return _0x19bdfa['next']();}var _0x59eab0={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9d00('0xf')](_0x9d00('0x10')),'direction':_0x9d00('0x11')};if(this[_0x9d00('0x12')]===_0x9d00('0x13')||this['channel']===_0x9d00('0x14')){_0x59eab0['phone']=this[_0x9d00('0xb')]['phone'];}var _0x371270=this[_0x9d00('0x12')];if(_0x371270===_0x9d00('0x15')){_0x59eab0[_0x9d00('0x16')]=this[_0x9d00('0x17')]['id'];}else{_0x59eab0[_[_0x9d00('0x18')](_0x371270)+_0x9d00('0x19')]=this[_0x9d00('0x17')]['id'];}_0x59eab0[_[_0x9d00('0x18')](_0x371270)+'InteractionId']=this[_0x9d00('0xb')]['id'];if(this['interaction'][_0x9d00('0x1a')]){var _0x3326c3=_0x522b4c[0x4];if(!_[_0x9d00('0x1b')](_0x3326c3)){_0x59eab0[_0x9d00('0x1c')]=utils[_0x9d00('0x1d')](_0x3326c3,this);return rpc[_0x371270+_0x9d00('0x1e')][_0x9d00('0x1f')](_0x59eab0)[_0x9d00('0x20')](function(_0x16bc09){logger['info'](_0x9d00('0xd'),_0x1bf149,_0x59eab0[_0x9d00('0x1c')]);})[_0x9d00('0x21')](function(_0x5dc4bc){logger[_0x9d00('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1bf149,JSON['stringify'](_0x5dc4bc));})[_0x9d00('0x23')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1bf149);_0x19bdfa['stop']();});}else{logger[_0x9d00('0x24')](_0x9d00('0x25'),_0x1bf149);_0x19bdfa[_0x9d00('0x26')]();}}else{var _0x179ac4=this;var _0x36fc02=new AWS['LexRuntime']({'accessKeyId':_0x522b4c[0x0],'secretAccessKey':_0x522b4c[0x1],'region':_0x522b4c[0x2]});var _0x145458={'botAlias':_0x9d00('0x27'),'botName':_0x522b4c[0x3],'inputText':this[_0x9d00('0x28')]['body'],'userId':this[_0x9d00('0x12')]+':'+this[_0x9d00('0xb')]['id'][_0x9d00('0x29')]()};_0x36fc02[_0x9d00('0x2a')](_0x145458,function(_0x3d630b,_0x3390b2){if(_0x3d630b){logger['error'](_0x9d00('0xd'),_0x1bf149,_0x3d630b[_0x9d00('0x28')]);_0x19bdfa[_0x9d00('0x2b')]();}else if(_0x3390b2&&_0x3390b2['message']){_0x179ac4[_0x9d00('0x1c')][_0x9d00('0x2c')]=_0x3390b2;_0x59eab0[_0x9d00('0x1c')]=_0x3390b2['message'];_0x59eab0['providerName']=_0x9d00('0x2c');_0x59eab0[_0x9d00('0x2d')]=JSON['stringify'](_0x3390b2);return rpc[_0x371270+_0x9d00('0x1e')]['create'](_0x59eab0)[_0x9d00('0x20')](function(_0x4330a8){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1bf149,_0x59eab0['body']);if(_0x3390b2[_0x9d00('0x2e')]==_0x9d00('0x2f')){_0x19bdfa[_0x9d00('0x2b')]();}else{_0x19bdfa['stop']();}})['catch'](function(_0x558c48){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1bf149,JSON[_0x9d00('0x30')](_0x558c48));_0x19bdfa[_0x9d00('0x2b')]();});}else{_0x19bdfa[_0x9d00('0x2b')]();}});}}catch(_0x2d58bc){logger[_0x9d00('0x22')](_0x9d00('0xd'),_0x1bf149,JSON['stringify'](_0x2d58bc));_0x19bdfa[_0x9d00('0x26')]();}};}; \ No newline at end of file +var _0x6acd=['interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','AccountId','InteractionId','created','isEmpty','body','Message','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','error','message','amazonlex','providerName','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0xd0758d,_0x4f18ce){var _0x4cb907=function(_0x3c2edd){while(--_0x3c2edd){_0xd0758d['push'](_0xd0758d['shift']());}};_0x4cb907(++_0x4f18ce);}(_0x6acd,0x1bf));var _0xd6ac=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6acd[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd6ac('0x0'));var moment=require(_0xd6ac('0x1'));var AWS=require(_0xd6ac('0x2'));var utils=require(_0xd6ac('0x3'));var logger=require('../../../../config/logger')(_0xd6ac('0x4'));var rpc={'chatMessage':require(_0xd6ac('0x5')),'openchannelMessage':require(_0xd6ac('0x6')),'mailMessage':require(_0xd6ac('0x7')),'smsMessage':require(_0xd6ac('0x8')),'faxMessage':require(_0xd6ac('0x9')),'whatsappMessage':require(_0xd6ac('0xa'))};exports[_0xd6ac('0xb')]=function(_0x5b7a07,_0x2c9a7a){return function(_0x5e3460){try{if(!_['isNil'](this[_0xd6ac('0xc')][_0xd6ac('0xd')])){logger[_0xd6ac('0xe')](_0xd6ac('0xf'),_0x5b7a07,_0xd6ac('0x10'));return _0x5e3460[_0xd6ac('0x11')]();}var _0x362dc5={'ContactId':this[_0xd6ac('0x12')]['id'],'sentAt':moment()[_0xd6ac('0x13')](_0xd6ac('0x14')),'direction':_0xd6ac('0x15')};if(this[_0xd6ac('0x16')]===_0xd6ac('0x17')||this['channel']===_0xd6ac('0x18')){_0x362dc5[_0xd6ac('0x19')]=this['interaction'][_0xd6ac('0x19')];}var _0x2fc80c=this[_0xd6ac('0x16')];if(_0x2fc80c===_0xd6ac('0x1a')){_0x362dc5['ChatWebsiteId']=this[_0xd6ac('0x1b')]['id'];}else{_0x362dc5[_['upperFirst'](_0x2fc80c)+_0xd6ac('0x1c')]=this['account']['id'];}_0x362dc5[_['upperFirst'](_0x2fc80c)+_0xd6ac('0x1d')]=this[_0xd6ac('0xc')]['id'];if(this['interaction'][_0xd6ac('0x1e')]){var _0x4d22b1=_0x2c9a7a[0x4];if(!_[_0xd6ac('0x1f')](_0x4d22b1)){_0x362dc5[_0xd6ac('0x20')]=utils['getMustacheRender'](_0x4d22b1,this);return rpc[_0x2fc80c+_0xd6ac('0x21')][_0xd6ac('0x22')](_0x362dc5)[_0xd6ac('0x23')](function(_0x474c52){logger['info'](_0xd6ac('0xf'),_0x5b7a07,_0x362dc5[_0xd6ac('0x20')]);})[_0xd6ac('0x24')](function(_0x306a85){logger['error'](_0xd6ac('0xf'),_0x5b7a07,JSON[_0xd6ac('0x25')](_0x306a85));})['finally'](function(){logger[_0xd6ac('0xe')](_0xd6ac('0x26'),_0x5b7a07);_0x5e3460[_0xd6ac('0x27')]();});}else{logger[_0xd6ac('0xe')](_0xd6ac('0x28'),_0x5b7a07);_0x5e3460[_0xd6ac('0x27')]();}}else{var _0x2aa848=this;var _0x323682=new AWS[(_0xd6ac('0x29'))]({'accessKeyId':_0x2c9a7a[0x0],'secretAccessKey':_0x2c9a7a[0x1],'region':_0x2c9a7a[0x2]});var _0xd7a6fd={'botAlias':_0xd6ac('0x2a'),'botName':_0x2c9a7a[0x3],'inputText':this['message']['body'],'userId':this[_0xd6ac('0x16')]+':'+this['interaction']['id'][_0xd6ac('0x2b')]()};_0x323682[_0xd6ac('0x2c')](_0xd7a6fd,function(_0x112350,_0x381f7f){if(_0x112350){logger[_0xd6ac('0x2d')](_0xd6ac('0xf'),_0x5b7a07,_0x112350['message']);_0x5e3460[_0xd6ac('0x11')]();}else if(_0x381f7f&&_0x381f7f[_0xd6ac('0x2e')]){_0x2aa848[_0xd6ac('0x20')][_0xd6ac('0x2f')]=_0x381f7f;_0x362dc5[_0xd6ac('0x20')]=_0x381f7f['message'];_0x362dc5[_0xd6ac('0x30')]=_0xd6ac('0x2f');_0x362dc5['providerResponse']=JSON[_0xd6ac('0x25')](_0x381f7f);return rpc[_0x2fc80c+_0xd6ac('0x21')][_0xd6ac('0x22')](_0x362dc5)['then'](function(_0x106d9f){logger['info'](_0xd6ac('0xf'),_0x5b7a07,_0x362dc5[_0xd6ac('0x20')]);if(_0x381f7f[_0xd6ac('0x31')]==_0xd6ac('0x32')){_0x5e3460[_0xd6ac('0x11')]();}else{_0x5e3460['stop']();}})['catch'](function(_0x12f662){logger[_0xd6ac('0x2d')](_0xd6ac('0xf'),_0x5b7a07,JSON[_0xd6ac('0x25')](_0x12f662));_0x5e3460[_0xd6ac('0x11')]();});}else{_0x5e3460[_0xd6ac('0x11')]();}});}}catch(_0x42d27e){logger['error'](_0xd6ac('0xf'),_0x5b7a07,JSON[_0xd6ac('0x25')](_0x42d27e));_0x5e3460[_0xd6ac('0x27')]();}};}; \ 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 5e8073d..f2d20d5 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 _0x875b=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:\x20','channel','chat','ChatWebsiteId','upperFirst','account','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','replace','','headers','auto-replied','All','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','finally','body','next','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x875b,0x197));var _0xb875=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x875b[_0x25248b];return _0x509939;};'use strict';var _=require(_0xb875('0x0'));var moment=require(_0xb875('0x1'));var utils=require(_0xb875('0x2'));var logger=require('../../../../config/logger')(_0xb875('0x3'));var rpc={'chatMessage':require(_0xb875('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb875('0x5')),'faxMessage':require(_0xb875('0x6')),'whatsappMessage':require(_0xb875('0x7'))};var mailRpc=require('../../mailRpc');exports[_0xb875('0x8')]=function(_0x5d5557,_0x297b2f){return function(_0x5b5b3c){try{if(_0x297b2f[0x0]==='1'&&(_[_0xb875('0x9')](this['interaction']['created'])||!this[_0xb875('0xa')][_0xb875('0xb')])){logger['info'](_0xb875('0xc'),_0x5d5557,_0xb875('0xd'));return _0x5b5b3c['next']();}var _0x1300cb=this['channel'];var _0x281044={'body':utils['getMustacheRender'](_0x297b2f[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0xb875('0xe')](_0xb875('0xf')),'direction':'out'};if(this['message']){_0x281044['to']=this[_0xb875('0x10')][_0xb875('0x11')]||'';_0x281044['cc']=this['message']['cc']||'';_0x281044['from']=this[_0xb875('0x10')]['to']||'';_0x281044[_0xb875('0x12')]=this[_0xb875('0x10')][_0xb875('0x12')]||'';_0x281044[_0xb875('0x13')]=!![];if(this[_0xb875('0x10')][_0xb875('0x14')]){_0x281044['subject']='';_0x281044[_0xb875('0x14')]+=_[_0xb875('0x15')](this[_0xb875('0x10')][_0xb875('0x14')],'Re:')?'':_0xb875('0x16');_0x281044['subject']+=this[_0xb875('0x10')][_0xb875('0x14')];}}if(this[_0xb875('0x17')]===_0xb875('0x18')){_0x281044[_0xb875('0x19')]=this['account']['id'];}else{_0x281044[_[_0xb875('0x1a')](this['channel'])+'AccountId']=this[_0xb875('0x1b')]['id'];}_0x281044[_[_0xb875('0x1a')](this['channel'])+'InteractionId']=this[_0xb875('0xa')]['id'];if(rpc[this[_0xb875('0x17')]+_0xb875('0x1c')]){if(this[_0xb875('0x17')]===_0xb875('0x1d')){var _0x49eecb={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xb875('0x1e')][_0xb875('0x1f')]){_0x49eecb[_0xb875('0x1f')]=this['account']['Smtp'][_0xb875('0x1f')];}else{_0x49eecb[_0xb875('0x20')]=this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x20')];_0x49eecb['port']=this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x21')];_0x49eecb[_0xb875('0x22')]=this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x22')];}if(this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x23')]){_0x49eecb[_0xb875('0x24')]={'user':this[_0xb875('0x1b')][_0xb875('0x1e')][_0xb875('0x25')],'pass':this['account'][_0xb875('0x1e')][_0xb875('0x26')]};}_0x281044[_0xb875('0x27')]=this['message']['messageId'];_0x281044['html']=''+_[_0xb875('0x28')](_0x281044['body'],_0xb875('0x29'),_0xb875('0x2a'))+_0xb875('0x2b');_0x281044[_0xb875('0x2c')]={'Auto-Submitted':_0xb875('0x2d'),'X-Auto-Response-Suppress':_0xb875('0x2e'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x49eecb,_0x281044)[_0xb875('0x2f')](function(_0x2eef03){logger[_0xb875('0x30')](_0xb875('0x31'),_0x5d5557);_0x281044[_0xb875('0x32')]=_0x2eef03[_0xb875('0x10')][_0xb875('0x32')];return rpc[_0x1300cb+_0xb875('0x1c')][_0xb875('0x33')](_0x281044);})['then'](function(_0x4d5fd5){logger[_0xb875('0x30')](_0xb875('0xc'),_0x5d5557,JSON[_0xb875('0x34')](_0x4d5fd5));})[_0xb875('0x35')](function(_0x1f0bc4){logger[_0xb875('0x36')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5d5557,JSON[_0xb875('0x34')](_0x1f0bc4));})[_0xb875('0x37')](function(){_0x5b5b3c['next']();});}else{return rpc[this[_0xb875('0x17')]+'Message'][_0xb875('0x33')](_0x281044)[_0xb875('0x2f')](function(_0x67d778){logger[_0xb875('0x30')]('[%s][AUTOREPLY]\x20%s',_0x5d5557,_0x281044[_0xb875('0x38')]);})['catch'](function(_0x246cbd){logger[_0xb875('0x36')](_0xb875('0xc'),_0x5d5557,JSON[_0xb875('0x34')](_0x246cbd));})[_0xb875('0x37')](function(){_0x5b5b3c[_0xb875('0x39')]();});}}}catch(_0x5aa614){logger['error']('[%s][AUTOREPLY]\x20%s',_0x5d5557,JSON[_0xb875('0x34')](_0x5aa614));_0x5b5b3c[_0xb875('0x3a')]();}};}; \ No newline at end of file +var _0xcd58=['../../mailRpc','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:\x20','chat','upperFirst','account','InteractionId','Message','mail','Smtp','service','host','secure','authentication','auth','user','inReplyTo','messageId','html','replace','body','','headers','auto-replied','All','auto_reply','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcd58,0x125));var _0x8cd5=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xcd58[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0x8cd5('0x0'));var moment=require(_0x8cd5('0x1'));var utils=require(_0x8cd5('0x2'));var logger=require('../../../../config/logger')(_0x8cd5('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8cd5('0x4')),'faxMessage':require(_0x8cd5('0x5')),'whatsappMessage':require(_0x8cd5('0x6'))};var mailRpc=require(_0x8cd5('0x7'));exports[_0x8cd5('0x8')]=function(_0x47ca4a,_0x24a8f6){return function(_0x1c43a1){try{if(_0x24a8f6[0x0]==='1'&&(_[_0x8cd5('0x9')](this[_0x8cd5('0xa')][_0x8cd5('0xb')])||!this[_0x8cd5('0xa')][_0x8cd5('0xb')])){logger['info'](_0x8cd5('0xc'),_0x47ca4a,_0x8cd5('0xd'));return _0x1c43a1[_0x8cd5('0xe')]();}var _0x4199a9=this[_0x8cd5('0xf')];var _0x2d9dca={'body':utils['getMustacheRender'](_0x24a8f6[0x1],this),'ContactId':this[_0x8cd5('0x10')]['id'],'sentAt':moment()[_0x8cd5('0x11')](_0x8cd5('0x12')),'direction':_0x8cd5('0x13')};if(this[_0x8cd5('0x14')]){_0x2d9dca['to']=this[_0x8cd5('0x14')]['from']||'';_0x2d9dca['cc']=this[_0x8cd5('0x14')]['cc']||'';_0x2d9dca[_0x8cd5('0x15')]=this[_0x8cd5('0x14')]['to']||'';_0x2d9dca[_0x8cd5('0x16')]=this[_0x8cd5('0x14')]['phone']||'';_0x2d9dca['read']=!![];if(this[_0x8cd5('0x14')]['subject']){_0x2d9dca[_0x8cd5('0x17')]='';_0x2d9dca[_0x8cd5('0x17')]+=_['startsWith'](this[_0x8cd5('0x14')][_0x8cd5('0x17')],'Re:')?'':_0x8cd5('0x18');_0x2d9dca['subject']+=this[_0x8cd5('0x14')][_0x8cd5('0x17')];}}if(this[_0x8cd5('0xf')]===_0x8cd5('0x19')){_0x2d9dca['ChatWebsiteId']=this['account']['id'];}else{_0x2d9dca[_[_0x8cd5('0x1a')](this[_0x8cd5('0xf')])+'AccountId']=this[_0x8cd5('0x1b')]['id'];}_0x2d9dca[_[_0x8cd5('0x1a')](this[_0x8cd5('0xf')])+_0x8cd5('0x1c')]=this[_0x8cd5('0xa')]['id'];if(rpc[this[_0x8cd5('0xf')]+_0x8cd5('0x1d')]){if(this['channel']===_0x8cd5('0x1e')){var _0x48a1c7={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x8cd5('0x1f')][_0x8cd5('0x20')]){_0x48a1c7[_0x8cd5('0x20')]=this['account']['Smtp'][_0x8cd5('0x20')];}else{_0x48a1c7[_0x8cd5('0x21')]=this[_0x8cd5('0x1b')]['Smtp'][_0x8cd5('0x21')];_0x48a1c7['port']=this['account']['Smtp']['port'];_0x48a1c7[_0x8cd5('0x22')]=this[_0x8cd5('0x1b')]['Smtp'][_0x8cd5('0x22')];}if(this[_0x8cd5('0x1b')][_0x8cd5('0x1f')][_0x8cd5('0x23')]){_0x48a1c7[_0x8cd5('0x24')]={'user':this[_0x8cd5('0x1b')][_0x8cd5('0x1f')][_0x8cd5('0x25')],'pass':this[_0x8cd5('0x1b')][_0x8cd5('0x1f')]['pass']};}_0x2d9dca[_0x8cd5('0x26')]=this[_0x8cd5('0x14')][_0x8cd5('0x27')];_0x2d9dca[_0x8cd5('0x28')]=''+_[_0x8cd5('0x29')](_0x2d9dca[_0x8cd5('0x2a')],']+(>|$)/g,''),'priorityTrue':_0x3ad786[0x1],'priorityFalse':_0x3ad786[0x2]};var _0x3cecf0=gotoif[_0x1fb7('0x0')](_0x432340,{'typecast':!![]});if(_0x3cecf0[_0x1fb7('0xb')]){logger['error'](_0x1fb7('0xc'),_0x34e491,_[_0x1fb7('0xd')](_0x3cecf0,_0x1fb7('0xe'))[_0x1fb7('0xf')](',\x20'));_0x5019d8['stop']();}else{try{var _0x38fc87=eval('('+_0x432340[_0x1fb7('0x10')]+')');var _0x3cffea=_0x38fc87?_0x432340['priorityTrue']:_0x432340['priorityFalse'];logger[_0x1fb7('0x11')](_0x1fb7('0x12'),_0x34e491,_0x432340[_0x1fb7('0x10')],_0x38fc87,_0x3cffea||'next');if(_0x3cffea){var _0x34b9af=_[_0x1fb7('0x13')](_0x5019d8[_0x1fb7('0x14')](),{'p':_0x3cffea});if(_0x34b9af>=0x0){logger[_0x1fb7('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x34e491,_0x3cffea||'next',_0x34b9af);_0x5019d8[_0x1fb7('0x15')](_0x34b9af);}else{logger[_0x1fb7('0x11')](_0x1fb7('0x16'),_0x34e491,_0x3cffea||'next');_0x5019d8[_0x1fb7('0x17')]();}}else{_0x5019d8[_0x1fb7('0x15')]();}}catch(_0x4c3d36){logger[_0x1fb7('0x18')](_0x1fb7('0x19'),_0x34e491,_0x4c3d36[_0x1fb7('0xe')]);_0x5019d8[_0x1fb7('0x17')]();}}}catch(_0x5a9727){logger[_0x1fb7('0x18')]('[%s][GOTOIF]\x20%s',_0x34e491,JSON[_0x1fb7('0x1a')](_0x5a9727));_0x5019d8['stop']();}};}; \ No newline at end of file +var _0x5ffe=['priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5ffe,0x1a0));var _0xe5ff=function(_0x5b5aa7,_0x485bbe){_0x5b5aa7=_0x5b5aa7-0x0;var _0x522e7e=_0x5ffe[_0x5b5aa7];return _0x522e7e;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0xe5ff('0x0'));var utils=require(_0xe5ff('0x1'));var logger=require(_0xe5ff('0x2'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xe5ff('0x3')},'priorityTrue':{'type':_0xe5ff('0x4'),'message':_0xe5ff('0x5')},'priorityFalse':{'type':_0xe5ff('0x4'),'message':_0xe5ff('0x6')}});exports['consequence']=function(_0x43d0bf,_0x239010){return function(_0x469f04){try{var _0x1ab8b5={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x239010[0x0],this),{'wordwrap':![]})[_0xe5ff('0x7')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x239010[0x1],'priorityFalse':_0x239010[0x2]};var _0x1d0d2f=gotoif[_0xe5ff('0x8')](_0x1ab8b5,{'typecast':!![]});if(_0x1d0d2f[_0xe5ff('0x9')]){logger[_0xe5ff('0xa')](_0xe5ff('0xb'),_0x43d0bf,_[_0xe5ff('0xc')](_0x1d0d2f,_0xe5ff('0xd'))[_0xe5ff('0xe')](',\x20'));_0x469f04[_0xe5ff('0xf')]();}else{try{var _0x285057=eval('('+_0x1ab8b5['condition']+')');var _0x578f72=_0x285057?_0x1ab8b5[_0xe5ff('0x10')]:_0x1ab8b5[_0xe5ff('0x11')];logger['info'](_0xe5ff('0x12'),_0x43d0bf,_0x1ab8b5[_0xe5ff('0x13')],_0x285057,_0x578f72||_0xe5ff('0x14'));if(_0x578f72){var _0x1ec69b=_['findIndex'](_0x469f04[_0xe5ff('0x15')](),{'p':_0x578f72});if(_0x1ec69b>=0x0){logger[_0xe5ff('0x16')](_0xe5ff('0x17'),_0x43d0bf,_0x578f72||_0xe5ff('0x14'),_0x1ec69b);_0x469f04['next'](_0x1ec69b);}else{logger[_0xe5ff('0x16')](_0xe5ff('0x18'),_0x43d0bf,_0x578f72||_0xe5ff('0x14'));_0x469f04[_0xe5ff('0xf')]();}}else{_0x469f04[_0xe5ff('0x14')]();}}catch(_0x4bb8ce){logger['error'](_0xe5ff('0x19'),_0x43d0bf,_0x4bb8ce['message']);_0x469f04['stop']();}}}catch(_0x305980){logger[_0xe5ff('0xa')](_0xe5ff('0xb'),_0x43d0bf,JSON[_0xe5ff('0x1a')](_0x305980));_0x469f04[_0xe5ff('0xf')]();}};}; \ 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 3432da1..22df080 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 _0xda90=['error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','priority'];(function(_0x384319,_0x2e0250){var _0x497e8c=function(_0x4c8a50){while(--_0x4c8a50){_0x384319['push'](_0x384319['shift']());}};_0x497e8c(++_0x2e0250);}(_0xda90,0xb6));var _0x0da9=function(_0x33493f,_0x9c3a8e){_0x33493f=_0x33493f-0x0;var _0x567c42=_0xda90[_0x33493f];return _0x567c42;};'use strict';var schema=require(_0x0da9('0x0'));var _=require('lodash');var logger=require(_0x0da9('0x1'))(_0x0da9('0x2'));var gotop=schema({'priority':{'type':_0x0da9('0x3'),'required':!![],'message':_0x0da9('0x4')}});exports[_0x0da9('0x5')]=function(_0x4ccb8d,_0x29f90e){return function(_0x1ce847){try{var _0x5d30c4={'priority':_0x29f90e[0x0]};var _0x395656=gotop[_0x0da9('0x0')](_0x5d30c4,{'typecast':!![]});if(_0x395656[_0x0da9('0x6')]){logger['error'](_0x0da9('0x7'),_0x4ccb8d,_['map'](_0x395656,_0x0da9('0x8'))[_0x0da9('0x9')](',\x20'));_0x1ce847[_0x0da9('0xa')]();}else{logger[_0x0da9('0xb')](_0x0da9('0xc'),_0x4ccb8d,_0x5d30c4['priority']);if(_0x5d30c4['priority']){var _0x17ed5e=_[_0x0da9('0xd')](_0x1ce847['rules'](),{'p':_0x5d30c4['priority']});if(_0x17ed5e>=0x0){logger[_0x0da9('0xb')](_0x0da9('0xe'),_0x4ccb8d,_0x5d30c4['priority']||_0x0da9('0xf'),_0x17ed5e);_0x1ce847['next'](_0x17ed5e);}else{logger['info'](_0x0da9('0x10'),_0x4ccb8d,_0x5d30c4[_0x0da9('0x11')]||_0x0da9('0xf'));_0x1ce847[_0x0da9('0xa')]();}}else{_0x1ce847['next']();}}}catch(_0x3689ff){logger[_0x0da9('0x12')]('[%s][GOTOP]\x20%s',_0x4ccb8d,JSON[_0x0da9('0x13')](_0x3689ff));_0x1ce847[_0x0da9('0xa')]();}};}; \ No newline at end of file +var _0xca9d=['lodash','../../../../config/logger','routing','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x1c0a79,_0x3494dd){var _0x16d4b4=function(_0x3b6505){while(--_0x3b6505){_0x1c0a79['push'](_0x1c0a79['shift']());}};_0x16d4b4(++_0x3494dd);}(_0xca9d,0xbb));var _0xdca9=function(_0x518de4,_0x25a6ba){_0x518de4=_0x518de4-0x0;var _0x56cc8d=_0xca9d[_0x518de4];return _0x56cc8d;};'use strict';var schema=require('validate');var _=require(_0xdca9('0x0'));var logger=require(_0xdca9('0x1'))(_0xdca9('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xdca9('0x3')]=function(_0x21d4ef,_0x358d9d){return function(_0x1db9af){try{var _0x1f67ed={'priority':_0x358d9d[0x0]};var _0x570e94=gotop['validate'](_0x1f67ed,{'typecast':!![]});if(_0x570e94[_0xdca9('0x4')]){logger[_0xdca9('0x5')](_0xdca9('0x6'),_0x21d4ef,_[_0xdca9('0x7')](_0x570e94,'message')[_0xdca9('0x8')](',\x20'));_0x1db9af[_0xdca9('0x9')]();}else{logger[_0xdca9('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x21d4ef,_0x1f67ed['priority']);if(_0x1f67ed[_0xdca9('0xb')]){var _0xe9a68e=_[_0xdca9('0xc')](_0x1db9af[_0xdca9('0xd')](),{'p':_0x1f67ed[_0xdca9('0xb')]});if(_0xe9a68e>=0x0){logger[_0xdca9('0xa')](_0xdca9('0xe'),_0x21d4ef,_0x1f67ed[_0xdca9('0xb')]||_0xdca9('0xf'),_0xe9a68e);_0x1db9af[_0xdca9('0xf')](_0xe9a68e);}else{logger['info'](_0xdca9('0x10'),_0x21d4ef,_0x1f67ed[_0xdca9('0xb')]||_0xdca9('0xf'));_0x1db9af[_0xdca9('0x9')]();}}else{_0x1db9af[_0xdca9('0xf')]();}}}catch(_0x494434){logger[_0xdca9('0x5')](_0xdca9('0x6'),_0x21d4ef,JSON['stringify'](_0x494434));_0x1db9af[_0xdca9('0x9')]();}};}; \ 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 35e0667..6e71833 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 _0x78da=['upperFirst','channel','InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','body','error','stringify','stop','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','ChatWebsiteId','account','AccountId'];(function(_0x19ebc9,_0x2a8bcd){var _0x54bb42=function(_0x2d3ee4){while(--_0x2d3ee4){_0x19ebc9['push'](_0x19ebc9['shift']());}};_0x54bb42(++_0x2a8bcd);}(_0x78da,0x1d9));var _0xa78d=function(_0x392128,_0x45bedd){_0x392128=_0x392128-0x0;var _0x2368f7=_0x78da[_0x392128];return _0x2368f7;};'use strict';var _=require('lodash');var utils=require(_0xa78d('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xa78d('0x1')),'openchannelMessage':require(_0xa78d('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa78d('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa78d('0x4'))};exports['consequence']=function(_0x5d0bd9,_0x4384b9){return function(_0x5446ab){try{var _0xc15056={'body':utils[_0xa78d('0x5')](_0x4384b9[0x0],this),'ContactId':this[_0xa78d('0x6')]['id']};if(this['channel']==='chat'){_0xc15056[_0xa78d('0x7')]=this[_0xa78d('0x8')]['id'];}else{_0xc15056[_['upperFirst'](this['channel'])+_0xa78d('0x9')]=this['account']['id'];}_0xc15056[_[_0xa78d('0xa')](this[_0xa78d('0xb')])+_0xa78d('0xc')]=this['interaction']['id'];if(rpc[this[_0xa78d('0xb')]+_0xa78d('0xd')]){return rpc[this['channel']+'Message']['create'](_0xc15056)[_0xa78d('0xe')](function(_0x3023b9){logger[_0xa78d('0xf')](_0xa78d('0x10'),_0x5d0bd9,_0xc15056[_0xa78d('0x11')]);_0x5446ab['next']();})['catch'](function(_0x2ff9b3){logger[_0xa78d('0x12')](_0xa78d('0x10'),_0x5d0bd9,JSON[_0xa78d('0x13')](_0x2ff9b3));_0x5446ab[_0xa78d('0x14')]();});}}catch(_0x3c46ba){logger[_0xa78d('0x12')](_0xa78d('0x10'),_0x5d0bd9,JSON['stringify'](_0x3c46ba));_0x5446ab[_0xa78d('0x14')]();}};}; \ No newline at end of file +var _0xdcb3=['next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','account','upperFirst','channel','Message','create','info','body'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xdcb3,0x6a));var _0x3dcb=function(_0x10a622,_0x1804be){_0x10a622=_0x10a622-0x0;var _0x707210=_0xdcb3[_0x10a622];return _0x707210;};'use strict';var _=require(_0x3dcb('0x0'));var utils=require(_0x3dcb('0x1'));var logger=require(_0x3dcb('0x2'))(_0x3dcb('0x3'));var rpc={'chatMessage':require(_0x3dcb('0x4')),'openchannelMessage':require(_0x3dcb('0x5')),'mailMessage':require(_0x3dcb('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3dcb('0x7'))};exports[_0x3dcb('0x8')]=function(_0x4e2b4e,_0xea9d6a){return function(_0x588ec9){try{var _0x410a13={'body':utils[_0x3dcb('0x9')](_0xea9d6a[0x0],this),'ContactId':this[_0x3dcb('0xa')]['id']};if(this['channel']===_0x3dcb('0xb')){_0x410a13['ChatWebsiteId']=this[_0x3dcb('0xc')]['id'];}else{_0x410a13[_[_0x3dcb('0xd')](this['channel'])+'AccountId']=this[_0x3dcb('0xc')]['id'];}_0x410a13[_['upperFirst'](this[_0x3dcb('0xe')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x3dcb('0xe')]+'Message']){return rpc[this['channel']+_0x3dcb('0xf')][_0x3dcb('0x10')](_0x410a13)['then'](function(_0x295093){logger[_0x3dcb('0x11')]('[%s][MESSAGE]\x20%s',_0x4e2b4e,_0x410a13[_0x3dcb('0x12')]);_0x588ec9[_0x3dcb('0x13')]();})[_0x3dcb('0x14')](function(_0xdd3bdd){logger[_0x3dcb('0x15')](_0x3dcb('0x16'),_0x4e2b4e,JSON['stringify'](_0xdd3bdd));_0x588ec9[_0x3dcb('0x17')]();});}}catch(_0x221eb8){logger[_0x3dcb('0x15')]('[%s][MESSAGE]\x20%s',_0x4e2b4e,JSON[_0x3dcb('0x18')](_0x221eb8));_0x588ec9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 0c5ad0b..a721120 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 _0xfc6d=['getMustacheRender','next','error','stop','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x21d31f,_0x3e06c7){var _0x238e0f=function(_0x51d15e){while(--_0x51d15e){_0x21d31f['push'](_0x21d31f['shift']());}};_0x238e0f(++_0x3e06c7);}(_0xfc6d,0x184));var _0xdfc6=function(_0x15ec12,_0x23d8ee){_0x15ec12=_0x15ec12-0x0;var _0x1b6747=_0xfc6d[_0x15ec12];return _0x1b6747;};'use strict';var utils=require('./utils');var logger=require(_0xdfc6('0x0'))(_0xdfc6('0x1'));exports[_0xdfc6('0x2')]=function(_0x3c6289,_0x790cf6){return function(_0x5ceb84){try{logger['info'](_0xdfc6('0x3'),_0x3c6289,utils[_0xdfc6('0x4')](_0x790cf6[0x0],this));_0x5ceb84[_0xdfc6('0x5')]();}catch(_0x30aacb){logger[_0xdfc6('0x6')](_0xdfc6('0x3'),_0x3c6289,JSON['stringify'](_0x30aacb));_0x5ceb84[_0xdfc6('0x7')]();}};}; \ No newline at end of file +var _0xfda1=['./utils','info','[%s][NOOP]\x20%s','next','stop'];(function(_0x4237fa,_0x4e4e43){var _0x24a1e7=function(_0x412952){while(--_0x412952){_0x4237fa['push'](_0x4237fa['shift']());}};_0x24a1e7(++_0x4e4e43);}(_0xfda1,0x11d));var _0x1fda=function(_0x47e36f,_0x2079f2){_0x47e36f=_0x47e36f-0x0;var _0x5ddd14=_0xfda1[_0x47e36f];return _0x5ddd14;};'use strict';var utils=require(_0x1fda('0x0'));var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x2fe245,_0x27e0ac){return function(_0x5a18ac){try{logger[_0x1fda('0x1')](_0x1fda('0x2'),_0x2fe245,utils['getMustacheRender'](_0x27e0ac[0x0],this));_0x5a18ac[_0x1fda('0x3')]();}catch(_0x2ad416){logger['error'](_0x1fda('0x2'),_0x2fe245,JSON['stringify'](_0x2ad416));_0x5a18ac[_0x1fda('0x4')]();}};}; \ 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 32c7f63..2dafb7f 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(_0xb8dd84,_0x33bcf0){var _0x50a459=function(_0x14e12c){while(--_0x14e12c){_0xb8dd84['push'](_0xb8dd84['shift']());}};_0x50a459(++_0x33bcf0);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'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 _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x4d3cce,_0x22aeee){var _0x2a3e5e=function(_0x218c7c){while(--_0x218c7c){_0x4d3cce['push'](_0x4d3cce['shift']());}};_0x2a3e5e(++_0x22aeee);}(_0x34e8,0x12c));var _0x834e=function(_0x2386fa,_0x395dab){_0x2386fa=_0x2386fa-0x0;var _0x10eb7c=_0x34e8[_0x2386fa];return _0x10eb7c;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ 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 789a060..acddbae 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 _0xb73c=['bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','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','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','handleTimeout'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xb73c,0x175));var _0xcb73=function(_0x3ccbb1,_0x481890){_0x3ccbb1=_0x3ccbb1-0x0;var _0x507304=_0xb73c[_0x3ccbb1];return _0x507304;};'use strict';var _=require(_0xcb73('0x0'));var uuid=require(_0xcb73('0x1'));var util=require(_0xcb73('0x2'));var logger=require(_0xcb73('0x3'))('routing');var Agent=function(_0x2ef655,_0x12ac57,_0x2d2e3e,_0xafe9bb){this[_0xcb73('0x4')]=uuid['v4']();this[_0xcb73('0x5')]=_0x2ef655;this[_0xcb73('0x6')]=_0x12ac57;this[_0xcb73('0x7')]=_0x2d2e3e;this[_0xcb73('0x8')]=_0xafe9bb;this[_0xcb73('0x5')][_0xcb73('0x9')](this[_0xcb73('0xa')]['bind'](this),this[_0xcb73('0xb')][_0xcb73('0xc')](this));this['squeue']['on']('timeout',this[_0xcb73('0xb')][_0xcb73('0xc')](this));this[_0xcb73('0x5')]['on'](_0xcb73('0xd'),this[_0xcb73('0xe')]['bind'](this));};Agent[_0xcb73('0xf')]['push']=function(){this[_0xcb73('0x5')][_0xcb73('0x9')](this[_0xcb73('0xa')][_0xcb73('0xc')](this),this[_0xcb73('0xb')]['bind'](this));};Agent['prototype'][_0xcb73('0xe')]=function(){this[_0xcb73('0xb')](!![]);};Agent[_0xcb73('0xf')][_0xcb73('0xa')]=function(_0x23a76f){logger[_0xcb73('0x10')](_0xcb73('0x11'),this['squeue']['id'],this[_0xcb73('0x6')]['id']);if(_[_0xcb73('0x12')](this['realtime'][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']])){logger[_0xcb73('0x10')](_0xcb73('0x14'),this['squeue']['id'],this[_0xcb73('0x6')]['id']);setTimeout(this[_0xcb73('0x9')]['bind'](this),0x3e8);}else{if(this[_0xcb73('0x8')][_0xcb73('0x15')]||util[_0xcb73('0x16')](this[_0xcb73('0x5')]['id'],this['realtime'][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],this[_0xcb73('0x5')][_0xcb73('0x17')],![])){this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']][_0xcb73('0x18')]=!![];this[_0xcb73('0x7')][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']][_0xcb73('0x19')]=undefined;util[_0xcb73('0x1a')](this[_0xcb73('0x4')],this[_0xcb73('0x5')]['id'],this[_0xcb73('0x7')][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],null,this['routing']);util[_0xcb73('0x1b')](this[_0xcb73('0x5')]['id'],this['realtime'][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],_0xcb73('0x1c')+(this['routing'][_0xcb73('0x15')]?_0xcb73('0x1d'):''));}else{logger[_0xcb73('0x10')](_0xcb73('0x1e'),this['squeue']['id'],this[_0xcb73('0x6')]['id']);setTimeout(this['push'][_0xcb73('0xc')](this),0x3e8);}}};Agent[_0xcb73('0xf')]['handleTimeout']=function(_0x5eb71d){if(_[_0xcb73('0x12')](this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']])){return logger[_0xcb73('0x10')](_0xcb73('0x14'),this[_0xcb73('0x5')]['id'],this[_0xcb73('0x6')]['id']);}else{logger[_0xcb73('0x10')](_0xcb73('0x1f'),this[_0xcb73('0x5')]['id'],this[_0xcb73('0x6')]['id']);util[_0xcb73('0x20')](this[_0xcb73('0x4')],this['squeue']['id'],this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']],null,this[_0xcb73('0x8')]);this[_0xcb73('0x7')]['agents'][this[_0xcb73('0x6')]['id']][_0xcb73('0x18')]=![];this[_0xcb73('0x7')][_0xcb73('0x13')][this['agent']['id']][_0xcb73('0x19')]=undefined;util[_0xcb73('0x1b')](this[_0xcb73('0x5')]['id'],this[_0xcb73('0x7')][_0xcb73('0x13')][this[_0xcb73('0x6')]['id']],_0x5eb71d?_0xcb73('0x21'):_0xcb73('0x22'));}if(!_0x5eb71d){setTimeout(this[_0xcb73('0x9')][_0xcb73('0xc')](this),0x3e8);}};function agent(_0x3c0ddb,_0x298b8e,_0x2f273d,_0x46b437){return new Agent(_0x3c0ddb,_0x298b8e,_0x2f273d,_0x46b437);}module['exports']=agent; \ No newline at end of file +var _0xe6ce=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents'];(function(_0x5d84e2,_0x281f7e){var _0x4c789c=function(_0x1e8d72){while(--_0x1e8d72){_0x5d84e2['push'](_0x5d84e2['shift']());}};_0x4c789c(++_0x281f7e);}(_0xe6ce,0xe7));var _0xee6c=function(_0x29f0b4,_0x131d67){_0x29f0b4=_0x29f0b4-0x0;var _0x50451e=_0xe6ce[_0x29f0b4];return _0x50451e;};'use strict';var _=require('lodash');var uuid=require(_0xee6c('0x0'));var util=require('./util');var logger=require(_0xee6c('0x1'))(_0xee6c('0x2'));var Agent=function(_0x384ba9,_0x33ef6e,_0xfb9eab,_0x5aaecc){this[_0xee6c('0x3')]=uuid['v4']();this[_0xee6c('0x4')]=_0x384ba9;this[_0xee6c('0x5')]=_0x33ef6e;this['realtime']=_0xfb9eab;this[_0xee6c('0x2')]=_0x5aaecc;this[_0xee6c('0x4')][_0xee6c('0x6')](this[_0xee6c('0x7')]['bind'](this),this[_0xee6c('0x8')][_0xee6c('0x9')](this));this[_0xee6c('0x4')]['on']('timeout',this[_0xee6c('0x8')][_0xee6c('0x9')](this));this[_0xee6c('0x4')]['on'](_0xee6c('0xa'),this[_0xee6c('0xb')][_0xee6c('0x9')](this));};Agent[_0xee6c('0xc')][_0xee6c('0x6')]=function(){this['squeue']['push'](this['handleRun'][_0xee6c('0x9')](this),this[_0xee6c('0x8')][_0xee6c('0x9')](this));};Agent[_0xee6c('0xc')][_0xee6c('0xb')]=function(){this[_0xee6c('0x8')](!![]);};Agent[_0xee6c('0xc')][_0xee6c('0x7')]=function(_0x5f544c){logger[_0xee6c('0xd')](_0xee6c('0xe'),this[_0xee6c('0x4')]['id'],this[_0xee6c('0x5')]['id']);if(_[_0xee6c('0xf')](this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']])){logger['info'](_0xee6c('0x11'),this[_0xee6c('0x4')]['id'],this[_0xee6c('0x5')]['id']);setTimeout(this[_0xee6c('0x6')][_0xee6c('0x9')](this),0x3e8);}else{if(this[_0xee6c('0x2')][_0xee6c('0x12')]||util[_0xee6c('0x13')](this[_0xee6c('0x4')]['id'],this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],this[_0xee6c('0x4')][_0xee6c('0x15')],![])){this['realtime']['agents'][this[_0xee6c('0x5')]['id']][_0xee6c('0x16')]=!![];this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']][_0xee6c('0x17')]=undefined;util['showNotification'](this[_0xee6c('0x3')],this[_0xee6c('0x4')]['id'],this[_0xee6c('0x14')][_0xee6c('0x10')][this['agent']['id']],null,this[_0xee6c('0x2')]);util[_0xee6c('0x18')](this[_0xee6c('0x4')]['id'],this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],_0xee6c('0x19')+(this[_0xee6c('0x2')][_0xee6c('0x12')]?_0xee6c('0x1a'):''));}else{logger[_0xee6c('0xd')](_0xee6c('0x1b'),this[_0xee6c('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xee6c('0x6')][_0xee6c('0x9')](this),0x3e8);}}};Agent[_0xee6c('0xc')][_0xee6c('0x8')]=function(_0x22c6d2){if(_[_0xee6c('0xf')](this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']])){return logger[_0xee6c('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xee6c('0x4')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xee6c('0x4')]['id'],this[_0xee6c('0x5')]['id']);util[_0xee6c('0x1c')](this[_0xee6c('0x3')],this['squeue']['id'],this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],null,this[_0xee6c('0x2')]);this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']]['busy']=![];this[_0xee6c('0x14')][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']][_0xee6c('0x17')]=undefined;util[_0xee6c('0x18')](this[_0xee6c('0x4')]['id'],this['realtime'][_0xee6c('0x10')][this[_0xee6c('0x5')]['id']],_0x22c6d2?'STOP':_0xee6c('0x1d'));}if(!_0x22c6d2){setTimeout(this['push'][_0xee6c('0x9')](this),0x3e8);}};function agent(_0x32697d,_0x349b19,_0x34560d,_0x575b9a){return new Agent(_0x32697d,_0x349b19,_0x34560d,_0x575b9a);}module[_0xee6c('0x1e')]=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 a71ebc9..dd14232 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 _0x8ea9=['prototype','push','handleRun','handleDrained','isNil','Agents','length','info','isAgentAvailable','realtime','channel','writeLog','agents','RINGING','busy','name','notificationId','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','busyQueue','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue','handleTimeout','bind','drained'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x8ea9,0x76));var _0x98ea=function(_0x350a4b,_0x14fceb){_0x350a4b=_0x350a4b-0x0;var _0x4082e9=_0x8ea9[_0x350a4b];return _0x4082e9;};'use strict';var _=require(_0x98ea('0x0'));var uuid=require(_0x98ea('0x1'));var util=require(_0x98ea('0x2'));var logger=require(_0x98ea('0x3'))(_0x98ea('0x4'));var Beepall=function(_0x36e99a,_0x48ab0c,_0x3afd41,_0x34f12d){this['notificationId']=uuid['v4']();this[_0x98ea('0x5')]=_0x36e99a;this[_0x98ea('0x6')]=_0x48ab0c;this['realtime']=_0x3afd41;this['routing']=_0x34f12d;this[_0x98ea('0x5')]['push'](this['handleRun']['bind'](this),this[_0x98ea('0x7')][_0x98ea('0x8')](this));this['squeue']['on']('timeout',this['handleTimeout'][_0x98ea('0x8')](this));this[_0x98ea('0x5')]['on'](_0x98ea('0x9'),this['handleDrained'][_0x98ea('0x8')](this));};Beepall[_0x98ea('0xa')][_0x98ea('0xb')]=function(){this[_0x98ea('0x5')][_0x98ea('0xb')](this[_0x98ea('0xc')][_0x98ea('0x8')](this),this[_0x98ea('0x7')][_0x98ea('0x8')](this));};Beepall[_0x98ea('0xa')][_0x98ea('0xd')]=function(_0x3efb42){this[_0x98ea('0x7')](!![]);};Beepall[_0x98ea('0xa')]['handleRun']=function(_0x4a1675){var _0x59809b=!![];if(!_['isNil'](this[_0x98ea('0x6')])&&!_[_0x98ea('0xe')](this[_0x98ea('0x6')][_0x98ea('0xf')])&&this['queue'][_0x98ea('0xf')][_0x98ea('0x10')]>0x0){for(var _0x1c8cab=0x0,_0x5e3ac2;_0x1c8cab0x0){for(var _0x1565a1=0x0,_0x532a8a;_0x1565a10x0&&_0x27dfa1[_0x4947a3+_0x2218('0x26')]>=_0x27dfa1[_0x4947a3+_0x2218('0x25')]){writeLog(_0x26bb3f,_0x27dfa1,_0x4947a3['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x2218('0x27')]=function(_0x316651,_0xcbe144,_0x193ecf,_0x5037b5,_0x5acd05){return sendNotification(!![],_0x316651,_0xcbe144,_0x193ecf,_0x5037b5,_0x5acd05);};exports['hideNotification']=function(_0x535e71,_0x141d9c,_0x31e28a,_0xac2931,_0xb60a01){return sendNotification(![],_0x535e71,_0x141d9c,_0x31e28a,_0xac2931,_0xb60a01);};exports[_0x2218('0x28')]=writeLog; \ No newline at end of file +var _0x0f92=['emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter'];(function(_0x4c09fa,_0xcfcdaf){var _0x43487a=function(_0x3f5aa4){while(--_0x3f5aa4){_0x4c09fa['push'](_0x4c09fa['shift']());}};_0x43487a(++_0xcfcdaf);}(_0x0f92,0xfd));var _0x20f9=function(_0x321bd1,_0xd5a2be){_0x321bd1=_0x321bd1-0x0;var _0x54943a=_0x0f92[_0x321bd1];return _0x54943a;};'use strict';var _=require(_0x20f9('0x0'));var util=require(_0x20f9('0x1'));var utils=require(_0x20f9('0x2'));var Mustache=require('mustache');var Redis=require(_0x20f9('0x3'));var config=require(_0x20f9('0x4'));var logger=require(_0x20f9('0x5'))(_0x20f9('0x6'));config[_0x20f9('0x7')]=_[_0x20f9('0x8')](config[_0x20f9('0x7')],{'host':_0x20f9('0x9'),'port':0x18eb});var io=require(_0x20f9('0xa'))(new Redis(config[_0x20f9('0x7')]));function emit(_0x3801f5,_0x484b65,_0x29b5cc){io['to'](_0x3801f5)[_0x20f9('0xb')](_0x484b65,_0x29b5cc);}function sendNotification(_0x13ac9e,_0x1d2e93,_0x7d87e4,_0x4a374b,_0x38462d,_0x35323c){io['to'](util[_0x20f9('0xc')](_0x20f9('0xd'),_0x4a374b[_0x20f9('0xe')]))['emit'](_0x20f9('0xf'),_0x4a374b);var _0x74bca=_0x35323c||{};var _0x3d348d=_0x7d87e4[_0x20f9('0x10')]('.');var _0x266a6f={'uniqueid':_0x1d2e93,'channel':_0x3d348d[0x0],'id':_0x3d348d[0x1],'title':_0x3d348d[0x0]+_0x20f9('0x11'),'interactionId':_0x3d348d[0x2],'queue':_0x38462d?_0x38462d[_0x20f9('0xe')]:null,'sound':_0x74bca[_0x20f9('0x12')][_0x20f9('0x13')],'shake':_0x74bca[_0x20f9('0x12')][_0x20f9('0x14')]};try{if(!_0x74bca['body']){_0x74bca['body']={};}if(_0x38462d){_0x74bca['body']['queue']=_0x38462d;}else if(_0x74bca[_0x20f9('0x15')][_0x20f9('0x16')]){delete _0x74bca['body']['queue'];}_0x266a6f[_0x20f9('0x17')]=utils[_0x20f9('0x18')](_0x74bca['account'][_0x20f9('0x19')],_0x74bca);}catch(_0x4b5653){_0x266a6f[_0x20f9('0x17')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x20f9('0x1a')](util[_0x20f9('0xc')]('[%s][QUEUE]\x20%s',_0x1d2e93,_0x4b5653[_0x20f9('0x1b')]));}io['to'](util[_0x20f9('0xc')](_0x20f9('0xd'),_0x4a374b[_0x20f9('0xe')]))[_0x20f9('0xb')](util[_0x20f9('0xc')](_0x20f9('0x1c'),_0x13ac9e?_0x20f9('0x1d'):_0x20f9('0x1e')),_0x266a6f);}function writeLog(_0x7bece3,_0x17e484,_0x3e3768){return logger[_0x20f9('0x1f')](util['format'](_0x20f9('0x20'),_0x7bece3,_0x17e484[_0x20f9('0xe')],_0x3e3768));}exports['isAgentAvailable']=function(_0x27fa4e,_0x53c7de,_0x4497d4,_0x525aaa){if(_0x53c7de[_0x20f9('0x21')]){writeLog(_0x27fa4e,_0x53c7de,'BUSY');return![];}if(!_0x53c7de[_0x20f9('0x22')]){writeLog(_0x27fa4e,_0x53c7de,_0x20f9('0x23'));return![];}if(_0x53c7de[_0x4497d4+_0x20f9('0x24')]){writeLog(_0x27fa4e,_0x53c7de,_0x20f9('0x25'));return![];}if(_0x525aaa&&_0x53c7de[_0x20f9('0x26')](_0x4497d4+_0x20f9('0x27'))&&_0x53c7de[_0x20f9('0x26')](_0x4497d4+'CurrentCapacity')){if(_0x53c7de[_0x4497d4+_0x20f9('0x27')]>0x0&&_0x53c7de[_0x4497d4+'CurrentCapacity']>=_0x53c7de[_0x4497d4+'Capacity']){writeLog(_0x27fa4e,_0x53c7de,_0x4497d4[_0x20f9('0x28')]()+_0x20f9('0x29'));return![];}}return!![];};exports[_0x20f9('0x2a')]=function(_0x3b94e3,_0x11d2ed,_0x190cc8,_0x64e240,_0x21bf24){return sendNotification(!![],_0x3b94e3,_0x11d2ed,_0x190cc8,_0x64e240,_0x21bf24);};exports['hideNotification']=function(_0x4c1109,_0x3604af,_0x57999e,_0x419dc6,_0x262dc4){return sendNotification(![],_0x4c1109,_0x3604af,_0x57999e,_0x419dc6,_0x262dc4);};exports[_0x20f9('0x2b')]=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 5f9b7fb..729e424 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 _0xa872=['info','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','next','validate','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender'];(function(_0x1dd583,_0x439967){var _0xbf6aea=function(_0x1290cf){while(--_0x1290cf){_0x1dd583['push'](_0x1dd583['shift']());}};_0xbf6aea(++_0x439967);}(_0xa872,0x1d6));var _0x2a87=function(_0x19f55e,_0xd4ffc3){_0x19f55e=_0x19f55e-0x0;var _0x44cfee=_0xa872[_0x19f55e];return _0x44cfee;};'use strict';var schema=require(_0x2a87('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x2a87('0x1'));var logger=require(_0x2a87('0x2'))(_0x2a87('0x3'));var system=schema({'command':{'type':_0x2a87('0x4'),'required':!![],'message':_0x2a87('0x5')}});exports[_0x2a87('0x6')]=function(_0x3cd0e8,_0x486de8){return function(_0x2ff946){try{var _0xc47edb={'command':_0x486de8[0x0]};var _0x1ed30d=system[_0x2a87('0x0')](_0xc47edb,{'typecast':!![]});if(_0x1ed30d['length']){logger[_0x2a87('0x7')](_0x2a87('0x8'),_0x3cd0e8,_['map'](_0x1ed30d,_0x2a87('0x9'))[_0x2a87('0xa')](',\x20'));logger['info'](_0x2a87('0xb'),_0x3cd0e8);_0x2ff946['next']();}else{var _0x5ca279=this;var _0x392c12=utils[_0x2a87('0xc')](_0x486de8[0x0],this);logger[_0x2a87('0xd')](_0x2a87('0xe'),_0x3cd0e8,_0x392c12);sh['exec'](_[_0x2a87('0xf')](_0x392c12),function(_0x1b56fd,_0x561400){logger[_0x2a87('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3cd0e8,_0x1b56fd);if(_0x1b56fd==0x0){var _0x1c9d1c=_0x561400[_0x2a87('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x2a87('0x11')](_0x486de8[0x1])||_['isEmpty'](_0x486de8[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x3cd0e8);_0x5ca279[_0x2a87('0x12')][_0x486de8[0x1]]=_0x1c9d1c;}else{logger[_0x2a87('0xd')](_0x2a87('0x13'),_0x3cd0e8,_0x486de8[0x1],_0x1c9d1c);_0x5ca279['body'][_0x486de8[0x1]]=_0x1c9d1c;}}_0x2ff946['next']();});}}catch(_0x3be9c1){logger[_0x2a87('0x7')](_0x2a87('0x8'),_0x3cd0e8,_[_0x2a87('0x14')](_0x3be9c1)?JSON[_0x2a87('0x15')](_0x3be9c1):_0x3be9c1);logger[_0x2a87('0xd')](_0x2a87('0xb'),_0x3cd0e8);_0x2ff946[_0x2a87('0x16')]();}};}; \ No newline at end of file +var _0xd081=['../../../../config/logger','routing','string','consequence','length','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','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs'];(function(_0xee3846,_0x107485){var _0x3f65e3=function(_0x1d29a8){while(--_0x1d29a8){_0xee3846['push'](_0xee3846['shift']());}};_0x3f65e3(++_0x107485);}(_0xd081,0xa0));var _0x1d08=function(_0x250ef6,_0x5826c3){_0x250ef6=_0x250ef6-0x0;var _0x5628c0=_0xd081[_0x250ef6];return _0x5628c0;};'use strict';var schema=require(_0x1d08('0x0'));var sh=require(_0x1d08('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x1d08('0x2'))(_0x1d08('0x3'));var system=schema({'command':{'type':_0x1d08('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1d08('0x5')]=function(_0x34b01b,_0xc26dbf){return function(_0x87f759){try{var _0x31346d={'command':_0xc26dbf[0x0]};var _0x256ecf=system['validate'](_0x31346d,{'typecast':!![]});if(_0x256ecf[_0x1d08('0x6')]){logger[_0x1d08('0x7')](_0x1d08('0x8'),_0x34b01b,_['map'](_0x256ecf,_0x1d08('0x9'))[_0x1d08('0xa')](',\x20'));logger[_0x1d08('0xb')](_0x1d08('0xc'),_0x34b01b);_0x87f759[_0x1d08('0xd')]();}else{var _0x18569a=this;var _0x1e70e5=utils[_0x1d08('0xe')](_0xc26dbf[0x0],this);logger[_0x1d08('0xb')](_0x1d08('0xf'),_0x34b01b,_0x1e70e5);sh[_0x1d08('0x10')](_[_0x1d08('0x11')](_0x1e70e5),function(_0x2aae9e,_0x3d9cd7){logger[_0x1d08('0xb')](_0x1d08('0x12'),_0x34b01b,_0x2aae9e);if(_0x2aae9e==0x0){var _0x2f504a=_0x3d9cd7[_0x1d08('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x1d08('0x14')](_0xc26dbf[0x1])||_[_0x1d08('0x15')](_0xc26dbf[0x1])){logger[_0x1d08('0xb')](_0x1d08('0x16'),_0x34b01b);_0x18569a[_0x1d08('0x17')][_0xc26dbf[0x1]]=_0x2f504a;}else{logger['info'](_0x1d08('0x18'),_0x34b01b,_0xc26dbf[0x1],_0x2f504a);_0x18569a[_0x1d08('0x17')][_0xc26dbf[0x1]]=_0x2f504a;}}_0x87f759[_0x1d08('0xd')]();});}}catch(_0x2e4ac3){logger[_0x1d08('0x7')](_0x1d08('0x8'),_0x34b01b,_[_0x1d08('0x19')](_0x2e4ac3)?JSON[_0x1d08('0x1a')](_0x2e4ac3):_0x2e4ac3);logger[_0x1d08('0xb')](_0x1d08('0xc'),_0x34b01b);_0x87f759[_0x1d08('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index fedd1f6..90831a8 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 _0x5e3c=['Interaction','addTags','interaction','then','catch','[%s][TAG]\x20%s','stringify','finally','next','error','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel'];(function(_0x530ca0,_0x375094){var _0x2ebd52=function(_0x2ac103){while(--_0x2ac103){_0x530ca0['push'](_0x530ca0['shift']());}};_0x2ebd52(++_0x375094);}(_0x5e3c,0x169));var _0xc5e3=function(_0x30195a,_0x9aafa1){_0x30195a=_0x30195a-0x0;var _0x4ddeb2=_0x5e3c[_0x30195a];return _0x4ddeb2;};'use strict';var schema=require(_0xc5e3('0x0'));var _=require(_0xc5e3('0x1'));var rpc={'chatInteraction':require(_0xc5e3('0x2')),'openchannelInteraction':require(_0xc5e3('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xc5e3('0x4')),'faxInteraction':require(_0xc5e3('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xc5e3('0x6'))(_0xc5e3('0x7'));var tag=schema({'tag':{'type':_0xc5e3('0x8'),'required':!![],'message':_0xc5e3('0x9')}});exports['consequence']=function(_0x5bbf12,_0x4fab90,_0x1736ec,_0x40a10c){return function(_0x576353){try{var _0x5b8cd4={'tag':_0x4fab90[0x0]};var _0x36f573=tag[_0xc5e3('0x0')](_0x5b8cd4,{'typecast':!![]});if(_0x36f573[_0xc5e3('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x5bbf12,_[_0xc5e3('0xb')](_0x36f573,_0xc5e3('0xc'))[_0xc5e3('0xd')](',\x20'));logger[_0xc5e3('0xe')](_0xc5e3('0xf'),_0x5bbf12);_0x576353['next']();}else{var _0x2a3bfc={'ids':[_0x4fab90[0x0]]};if(rpc[_0x40a10c[_0xc5e3('0x10')]+_0xc5e3('0x11')]){rpc[_0x40a10c[_0xc5e3('0x10')]+_0xc5e3('0x11')][_0xc5e3('0x12')](_0x40a10c[_0xc5e3('0x13')]['id'],_0x2a3bfc)[_0xc5e3('0x14')](function(_0x1fef66){logger[_0xc5e3('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5bbf12,_0x4fab90[0x1],_0x40a10c[_0xc5e3('0x10')],_0x40a10c[_0xc5e3('0x13')]['id']);})[_0xc5e3('0x15')](function(_0x53aaab){logger['error'](_0xc5e3('0x16'),_0x5bbf12,JSON[_0xc5e3('0x17')](_0x53aaab));logger[_0xc5e3('0xe')](_0xc5e3('0xf'),_0x5bbf12);})[_0xc5e3('0x18')](function(){_0x576353[_0xc5e3('0x19')]();});}}}catch(_0x53b4ef){logger[_0xc5e3('0x1a')](_0xc5e3('0x16'),_0x5bbf12,_['isObject'](_0x53b4ef)?JSON['stringify'](_0x53b4ef):_0x53b4ef);logger['info'](_0xc5e3('0xf'),_0x5bbf12);_0x576353[_0xc5e3('0x19')]();}};}; \ No newline at end of file +var _0x880a=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','error','isObject','stringify','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','map','message','join','info','next','Interaction','addTags','interaction','channel','catch','[%s][TAG]\x20%s'];(function(_0x21e2ba,_0x398f94){var _0xd398a8=function(_0x1233a3){while(--_0x1233a3){_0x21e2ba['push'](_0x21e2ba['shift']());}};_0xd398a8(++_0x398f94);}(_0x880a,0x17c));var _0xa880=function(_0x2f0c25,_0x2ac930){_0x2f0c25=_0x2f0c25-0x0;var _0xf374f2=_0x880a[_0x2f0c25];return _0xf374f2;};'use strict';var schema=require('validate');var _=require(_0xa880('0x0'));var rpc={'chatInteraction':require(_0xa880('0x1')),'openchannelInteraction':require(_0xa880('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xa880('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa880('0x4'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xa880('0x5'),'required':!![],'message':_0xa880('0x6')}});exports[_0xa880('0x7')]=function(_0x3a3643,_0x4d73ec,_0x2497dd,_0x1eb7fb){return function(_0x5b1692){try{var _0x3cc73c={'tag':_0x4d73ec[0x0]};var _0x4d76f0=tag[_0xa880('0x8')](_0x3cc73c,{'typecast':!![]});if(_0x4d76f0['length']){logger['error']('[%s][TAG]\x20%s',_0x3a3643,_[_0xa880('0x9')](_0x4d76f0,_0xa880('0xa'))[_0xa880('0xb')](',\x20'));logger[_0xa880('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a3643);_0x5b1692[_0xa880('0xd')]();}else{var _0x83c8e2={'ids':[_0x4d73ec[0x0]]};if(rpc[_0x1eb7fb['channel']+_0xa880('0xe')]){rpc[_0x1eb7fb['channel']+_0xa880('0xe')][_0xa880('0xf')](_0x1eb7fb[_0xa880('0x10')]['id'],_0x83c8e2)['then'](function(_0x5707f5){logger[_0xa880('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3a3643,_0x4d73ec[0x1],_0x1eb7fb[_0xa880('0x11')],_0x1eb7fb['interaction']['id']);})[_0xa880('0x12')](function(_0x5bc5d1){logger['error'](_0xa880('0x13'),_0x3a3643,JSON['stringify'](_0x5bc5d1));logger['info'](_0xa880('0x14'),_0x3a3643);})[_0xa880('0x15')](function(){_0x5b1692[_0xa880('0xd')]();});}}}catch(_0xffcaf2){logger[_0xa880('0x16')](_0xa880('0x13'),_0x3a3643,_[_0xa880('0x17')](_0xffcaf2)?JSON[_0xa880('0x18')](_0xffcaf2):_0xffcaf2);logger[_0xa880('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a3643);_0x5b1692[_0xa880('0xd')]();}};}; \ 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 3b30ffd..74546f6 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 _0x616c=['render','merge','body','account','interaction','list','lodash','exports'];(function(_0x58d912,_0x11795e){var _0x1f94fe=function(_0x227012){while(--_0x227012){_0x58d912['push'](_0x58d912['shift']());}};_0x1f94fe(++_0x11795e);}(_0x616c,0x1b6));var _0xc616=function(_0x2cc4cd,_0x4c8378){_0x2cc4cd=_0x2cc4cd-0x0;var _0x493e7e=_0x616c[_0x2cc4cd];return _0x493e7e;};'use strict';var Mustache=require('mustache');var _=require(_0xc616('0x0'));module[_0xc616('0x1')]={'getMustacheRender':function(_0x5a267e,_0x16e652){return Mustache[_0xc616('0x2')](_0x5a267e,_[_0xc616('0x3')](_0x16e652[_0xc616('0x4')],{'contact':_0x16e652['contact'],'message':_0x16e652['message'],'account':_0x16e652[_0xc616('0x5')],'interaction':_0x16e652[_0xc616('0x6')],'list':_0x16e652[_0xc616('0x7')]}))||'';}}; \ No newline at end of file +var _0x5ed2=['contact','message','account','interaction','mustache','exports','render','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ed2,0x114));var _0x25ed=function(_0xfbceb4,_0x392f3b){_0xfbceb4=_0xfbceb4-0x0;var _0x563dbe=_0x5ed2[_0xfbceb4];return _0x563dbe;};'use strict';var Mustache=require(_0x25ed('0x0'));var _=require('lodash');module[_0x25ed('0x1')]={'getMustacheRender':function(_0x106489,_0x5330f1){return Mustache[_0x25ed('0x2')](_0x106489,_[_0x25ed('0x3')](_0x5330f1['body'],{'contact':_0x5330f1[_0x25ed('0x4')],'message':_0x5330f1[_0x25ed('0x5')],'account':_0x5330f1[_0x25ed('0x6')],'interaction':_0x5330f1[_0x25ed('0x7')],'list':_0x5330f1['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index a8810da..909d374 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 _0x7052=['../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','.js','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','%s:%s:%s','app','./interval','condition','./applications/','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','emit','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid'];(function(_0xaa2aac,_0x32e1e9){var _0xde946c=function(_0x352cbe){while(--_0x352cbe){_0xaa2aac['push'](_0xaa2aac['shift']());}};_0xde946c(++_0x32e1e9);}(_0x7052,0x1df));var _0x2705=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x7052[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0x2705('0x0'));var util=require(_0x2705('0x1'));var path=require(_0x2705('0x2'));var fs=require('fs');var jayson=require(_0x2705('0x3'));var BPromise=require(_0x2705('0x4'));var uuid=require(_0x2705('0x5'));var config=require(_0x2705('0x6'));var logger=require(_0x2705('0x7'))(_0x2705('0x8'));var rpc={'openchannelQueueReport':require(_0x2705('0x9')),'mailQueueReport':require(_0x2705('0xa')),'chatQueueReport':require(_0x2705('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x2705('0xc'))};var RuleEngine=require(_0x2705('0xd'));function getId(_0x2ce51e,_0x56fb5c,_0x21bf4c){return util[_0x2705('0xe')](_0x2705('0xf'),_0x2ce51e,_0x56fb5c||0x0,_0x21bf4c||0x0);}function getIntervals(_0x5bd74c,_0x5df96b){var _0x1871a2=[];if(!_[_0x2705('0x10')](_0x5df96b[_0x2705('0x11')])&&!_['isNil'](_0x5bd74c[_0x5df96b['IntervalId']])&&!_['isNil'](_0x5bd74c[_0x5df96b['IntervalId']][_0x2705('0x12')])){_0x1871a2=_[_0x2705('0x13')](_0x5bd74c[_0x5df96b[_0x2705('0x11')]][_0x2705('0x12')],_0x2705('0x14'));}else if(!_[_0x2705('0x10')](_0x5df96b['interval'])){_0x1871a2=[_0x5df96b['interval']];}return _0x1871a2;}exports['listen']=function(_0x3b2d89){_0x3b2d89[_0x2705('0x15')]={};return new BPromise(function(_0x101ce7,_0x21896e){var _0x5aec1b={'Start':function(_0x28be9d){var _0x331efa=this;return new Promise(function(_0x3516fa,_0x4f6e07){if(_0x28be9d){try{var _0x346d63=[];var _0x3754b2=getId(_0x28be9d[_0x2705('0x16')],_0x28be9d[_0x2705('0x17')]?_0x28be9d[_0x2705('0x17')]['id']:0x0,_0x28be9d[_0x2705('0x18')]?_0x28be9d[_0x2705('0x18')]['id']:0x0);if(_0x28be9d['applications']&&_[_0x2705('0x19')](_0x28be9d[_0x2705('0x1a')])&&_0x28be9d[_0x2705('0x1a')][_0x2705('0x1b')]){for(var _0x204de1=0x0;_0x204de1<_0x28be9d[_0x2705('0x1a')][_0x2705('0x1b')];_0x204de1+=0x1){var _0x1d45cd=_0x28be9d[_0x2705('0x1a')][_0x204de1];if(fs[_0x2705('0x1c')](path[_0x2705('0x1d')](__dirname,'applications',_0x1d45cd['app']+_0x2705('0x1e')))){var _0x84b20b=[];switch(_0x1d45cd['app']['toLowerCase']()){case _0x2705('0x1f'):var _0x906adb=_0x1d45cd[_0x2705('0x20')][_0x2705('0x21')](',');_0x84b20b['push'](_0x906adb[0x0]);_0x84b20b[_0x2705('0x22')](_0x906adb[_0x2705('0x23')](0x1,_0x906adb[_0x2705('0x1b')])[_0x2705('0x1d')](','));break;case _0x2705('0x24'):var _0x2f6302=_0x1d45cd[_0x2705('0x20')]['split'](',');_0x84b20b[_0x2705('0x22')](_0x2f6302[0x0]);_0x84b20b[_0x2705('0x22')](_0x2f6302[0x1]);_0x84b20b[_0x2705('0x22')](_0x2f6302[_0x2705('0x23')](0x2,_0x2f6302[_0x2705('0x1b')])[_0x2705('0x1d')](','));break;case _0x2705('0x25'):var _0x529c82=_0x1d45cd[_0x2705('0x20')][_0x2705('0x21')](',');_0x84b20b[_0x2705('0x22')](_0x529c82[0x0]);_0x84b20b[_0x2705('0x22')](_0x529c82[0x1]);_0x84b20b['push'](_0x529c82[0x2]);_0x84b20b[_0x2705('0x22')](_0x529c82[0x3]);_0x84b20b[_0x2705('0x22')](_0x529c82[_0x2705('0x23')](0x4,_0x529c82['length'])[_0x2705('0x1d')](','));break;case _0x2705('0x26'):var _0x4b7548=_0x1d45cd['appdata'][_0x2705('0x21')](',');_0x84b20b[_0x2705('0x22')](_0x4b7548[0x0]);_0x84b20b['push'](_0x4b7548[0x1]);_0x84b20b[_0x2705('0x22')](_0x4b7548[0x2]);_0x84b20b['push'](_0x4b7548[0x3]);_0x84b20b[_0x2705('0x22')](_0x4b7548[_0x2705('0x23')](0x4,_0x4b7548[_0x2705('0x1b')])['join'](','));break;case _0x2705('0x17'):_0x84b20b[_0x2705('0x22')](_0x1d45cd[_0x2705('0x20')]);break;case'tag':_0x84b20b[_0x2705('0x22')](_0x1d45cd[_0x2705('0x27')]);_0x84b20b['push'](_0x1d45cd[_0x2705('0x20')]);break;default:_0x84b20b=_['isNil'](_0x1d45cd[_0x2705('0x20')])?[]:_0x1d45cd[_0x2705('0x20')]['split'](',');}var _0x3475ab={'id':util[_0x2705('0xe')](_0x2705('0x28'),_0x3754b2,_0x1d45cd['id'],_0x1d45cd[_0x2705('0x29')]),'condition':require(_0x2705('0x2a'))[_0x2705('0x2b')](_0x3754b2,getIntervals(_0x3b2d89['intervals'],_0x1d45cd),_0x3b2d89),'consequence':require(_0x2705('0x2c')+_0x1d45cd[_0x2705('0x29')])['consequence'](_0x3754b2,_0x84b20b,_0x3b2d89,_0x28be9d),'p':_0x1d45cd[_0x2705('0x2d')]||0x0};logger['info'](_0x2705('0x2e'),_0x3475ab['id'],_0x2705('0x2f'),getIntervals(_0x3b2d89[_0x2705('0x30')],_0x1d45cd)[_0x2705('0x1d')](_0x2705('0x31')));_0x346d63[_0x2705('0x22')](_0x3475ab);}else{logger[_0x2705('0x32')](_0x2705('0x33'),path[_0x2705('0x1d')](__dirname,_0x2705('0x1a'),_0x1d45cd[_0x2705('0x29')]+'.js'));}}_0x3b2d89[_0x2705('0x15')][_0x3754b2]=new RuleEngine(_0x346d63);_0x3b2d89['rules'][_0x3754b2][_0x2705('0x34')](_0x28be9d,function(_0x3911de){logger[_0x2705('0x35')]('Applications\x20executed',JSON[_0x2705('0x36')](_0x3911de[_0x2705('0x37')]));if(_0x3b2d89[_0x2705('0x15')][_0x3754b2]){_0x3b2d89[_0x2705('0x15')][_0x3754b2]['emit']('complete');}});return _0x3516fa({'code':0xc8,'message':_0x28be9d});}else{logger[_0x2705('0x35')](_0x2705('0x38'));return _0x3516fa({'code':0xc8,'message':_0x28be9d});}}catch(_0x4cc0ff){logger['error'](_0x4cc0ff[_0x2705('0x39')]);return _0x4f6e07(_0x331efa[_0x2705('0x32')](0x1f4,_0x4cc0ff));}}return _0x4f6e07(_0x2705('0x3a'));});},'AcceptMessage':function(_0xf68499){var _0x39c795=this;return new Promise(function(_0xf4d545,_0x26492d){if(_0xf68499[_0x2705('0x17')]&&_0xf68499[_0x2705('0x17')]['id']){try{var _0x25c829=getId(_0xf68499[_0x2705('0x16')],_0xf68499[_0x2705('0x17')]?_0xf68499['message']['id']:0x0,_0xf68499[_0x2705('0x18')]?_0xf68499['interaction']['id']:0x0);if(_0x3b2d89[_0x2705('0x15')][_0x25c829]){_0x3b2d89['rules'][_0x25c829]['emit'](_0x2705('0x3b'));if(rpc[_0xf68499[_0x2705('0x16')]+_0x2705('0x3c')]){rpc[_0xf68499[_0x2705('0x16')]+_0x2705('0x3c')][_0x2705('0x3d')](_0x25c829,{'UserId':_0xf68499[_0x2705('0x17')][_0x2705('0x3e')]})['catch'](function(_0x12b52d){logger[_0x2705('0x32')](_0x2705('0x3f'));});}}return _0xf4d545({'code':0xc8,'message':_0xf68499});}catch(_0x2867c7){logger[_0x2705('0x32')](_0x2867c7[_0x2705('0x39')]);return _0x26492d(_0x39c795[_0x2705('0x32')](0x1f4,_0x2867c7));}}logger[_0x2705('0x32')](_0x2705('0x40'));return _0x26492d(_0x39c795['error'](0x1f4,_0x2705('0x40')));});},'RejectMessage':function(_0x47a723){var _0x59836f=this;return new Promise(function(_0x4dfcd5,_0x268bcd){if(_0x47a723[_0x2705('0x41')]&&_0x47a723[_0x2705('0x41')]['id']){try{if(_0x3b2d89[_0x2705('0x42')][_0x47a723['agent']['id']]){_0x3b2d89[_0x2705('0x42')][_0x47a723[_0x2705('0x41')]['id']][_0x2705('0x43')]=![];_0x3b2d89[_0x2705('0x42')][_0x47a723[_0x2705('0x41')]['id']][_0x2705('0x44')]=undefined;}return _0x4dfcd5({'code':0xc8,'message':_0x47a723});}catch(_0x5b48df){logger['error'](_0x5b48df[_0x2705('0x39')]);return _0x268bcd(_0x59836f[_0x2705('0x32')](0x1f4,_0x5b48df));}}logger[_0x2705('0x32')]('message\x20is\x20empty');return _0x268bcd(_0x59836f[_0x2705('0x32')](0x1f4,_0x2705('0x40')));});},'AbandonInteraction':function(_0xb5d8d6){var _0x42ea8c=this;return new Promise(function(_0x416a4f,_0x1f562c){if(_0xb5d8d6['channel']&&_0xb5d8d6[_0x2705('0x18')]&&_0xb5d8d6[_0x2705('0x18')]['id']){try{var _0x5a11dc=getId(_0xb5d8d6[_0x2705('0x16')],_0xb5d8d6['message']?_0xb5d8d6['message']['id']:0x0,_0xb5d8d6[_0x2705('0x18')]?_0xb5d8d6[_0x2705('0x18')]['id']:0x0);if(_0x3b2d89[_0x2705('0x15')][_0x5a11dc]){_0x3b2d89[_0x2705('0x15')][_0x5a11dc][_0x2705('0x45')](_0x2705('0x3b'));}return _0x416a4f({'code':0xc8,'message':_0xb5d8d6});}catch(_0x6097c8){logger['error'](_0x6097c8[_0x2705('0x39')]);return _0x1f562c(_0x42ea8c['error'](0x1f4,_0x6097c8));}}logger['error'](_0x2705('0x40'));return _0x1f562c(_0x42ea8c[_0x2705('0x32')](0x1f4,_0x2705('0x40')));});},'AgentCapacity':function(_0x1a42ed){var _0x12482b=this;return new Promise(function(_0x328113,_0x2d4aae){if(_0x3b2d89['agents']['hasOwnProperty'](_0x1a42ed['id'])){for(var _0x196f6d in _0x1a42ed[_0x2705('0x46')]){if(_0x1a42ed[_0x2705('0x46')]['hasOwnProperty'](_0x196f6d)){if(_0x3b2d89['agents'][_0x1a42ed['id']][_0x2705('0x47')](_0x196f6d+_0x2705('0x48'))){_0x3b2d89['agents'][_0x1a42ed['id']][_0x196f6d+_0x2705('0x48')]=parseInt(_0x1a42ed[_0x2705('0x46')][_0x196f6d],0xa);}}}_0x3b2d89[_0x2705('0x42')][_0x1a42ed['id']]['updateRealtime']();return _0x328113({'code':0xc8,'message':_0x3b2d89[_0x2705('0x42')][_0x1a42ed['id']]});}else{return _0x2d4aae(_0x12482b[_0x2705('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x271eb8){return new Promise(function(_0x1f8429,_0x2a30e2){var _0xaf52fd=_[_0x2705('0x49')](_0x3b2d89['agents']);_0x1f8429({'count':_0xaf52fd[_0x2705('0x1b')],'rows':_0xaf52fd});});},'ChatQueues':function(_0x1da6f5){return new Promise(function(_0x5ddbb0,_0xdb5eb9){var _0x12ae02=[];for(var _0x297320 in _0x3b2d89[_0x2705('0x4a')]){if(_0x3b2d89[_0x2705('0x4a')][_0x2705('0x47')](_0x297320)){var _0x1bd7b8=_0x3b2d89['chatQueues'][_0x297320];var _0x5a8189={'id':_0x1bd7b8['id'],'available':_0x1bd7b8[_0x2705('0x4b')],'loggedIn':_0x1bd7b8['loggedIn'],'name':_0x1bd7b8[_0x2705('0x4c')],'paused':_0x1bd7b8[_0x2705('0x4d')],'waiting':_0x1bd7b8[_0x2705('0x4e')]};_0x12ae02['push'](_0x5a8189);}}_0x5ddbb0({'count':_0x12ae02[_0x2705('0x1b')],'rows':_0x12ae02});});},'MailQueues':function(_0x4c0896){return new Promise(function(_0x4802da,_0x4a2e7b){var _0x4b489b=[];for(var _0xc5418f in _0x3b2d89[_0x2705('0x4f')]){if(_0x3b2d89[_0x2705('0x4f')][_0x2705('0x47')](_0xc5418f)){var _0x4f766b=_0x3b2d89[_0x2705('0x4f')][_0xc5418f];var _0x4f8a72={'id':_0x4f766b['id'],'available':_0x4f766b[_0x2705('0x4b')],'loggedIn':_0x4f766b[_0x2705('0x50')],'name':_0x4f766b[_0x2705('0x4c')],'paused':_0x4f766b[_0x2705('0x4d')],'waiting':_0x4f766b['waiting']};_0x4b489b[_0x2705('0x22')](_0x4f8a72);}}_0x4802da({'count':_0x4b489b[_0x2705('0x1b')],'rows':_0x4b489b});});},'OpenchannelQueues':function(_0x582b95){return new Promise(function(_0x2b4021,_0x166a25){var _0x44994b=[];for(var _0x45bb3f in _0x3b2d89[_0x2705('0x51')]){if(_0x3b2d89[_0x2705('0x51')][_0x2705('0x47')](_0x45bb3f)){var _0x152fbb=_0x3b2d89[_0x2705('0x51')][_0x45bb3f];var _0x34ae13={'id':_0x152fbb['id'],'available':_0x152fbb[_0x2705('0x4b')],'loggedIn':_0x152fbb[_0x2705('0x50')],'name':_0x152fbb[_0x2705('0x4c')],'paused':_0x152fbb[_0x2705('0x4d')],'waiting':_0x152fbb[_0x2705('0x4e')]};_0x44994b[_0x2705('0x22')](_0x34ae13);}}_0x2b4021({'count':_0x44994b[_0x2705('0x1b')],'rows':_0x44994b});});},'SmsQueues':function(_0x45b1f3){return new Promise(function(_0x39791d,_0x425df8){var _0x390817=[];for(var _0x201e28 in _0x3b2d89[_0x2705('0x52')]){if(_0x3b2d89[_0x2705('0x52')]['hasOwnProperty'](_0x201e28)){var _0x3a3476=_0x3b2d89[_0x2705('0x52')][_0x201e28];var _0x1837fb={'id':_0x3a3476['id'],'available':_0x3a3476[_0x2705('0x4b')],'loggedIn':_0x3a3476[_0x2705('0x50')],'name':_0x3a3476['name'],'paused':_0x3a3476[_0x2705('0x4d')],'waiting':_0x3a3476['waiting']};_0x390817[_0x2705('0x22')](_0x1837fb);}}_0x39791d({'count':_0x390817[_0x2705('0x1b')],'rows':_0x390817});});},'FaxQueues':function(_0xfdac94){return new Promise(function(_0x4917c6,_0x2e3fed){var _0x145cce=[];for(var _0x1624aa in _0x3b2d89['faxQueues']){if(_0x3b2d89[_0x2705('0x53')][_0x2705('0x47')](_0x1624aa)){var _0x42c8d7=_0x3b2d89[_0x2705('0x53')][_0x1624aa];var _0x4a098d={'id':_0x42c8d7['id'],'available':_0x42c8d7['available'],'loggedIn':_0x42c8d7[_0x2705('0x50')],'name':_0x42c8d7['name'],'paused':_0x42c8d7['paused'],'waiting':_0x42c8d7[_0x2705('0x4e')]};_0x145cce[_0x2705('0x22')](_0x4a098d);}}_0x4917c6({'count':_0x145cce[_0x2705('0x1b')],'rows':_0x145cce});});},'WhatsappQueues':function(_0x2a3ffe){return new Promise(function(_0x43c90c,_0x120b85){var _0x10e24b=[];for(var _0x2da318 in _0x3b2d89[_0x2705('0x54')]){if(_0x3b2d89['whatsappQueues'][_0x2705('0x47')](_0x2da318)){var _0x19ffd1=_0x3b2d89['whatsappQueues'][_0x2da318];var _0x21ae12={'id':_0x19ffd1['id'],'available':_0x19ffd1[_0x2705('0x4b')],'loggedIn':_0x19ffd1['loggedIn'],'name':_0x19ffd1['name'],'paused':_0x19ffd1['paused'],'waiting':_0x19ffd1[_0x2705('0x4e')]};_0x10e24b[_0x2705('0x22')](_0x21ae12);}}_0x43c90c({'count':_0x10e24b[_0x2705('0x1b')],'rows':_0x10e24b});});},'ChatQueuesWaitingInteractions':function(_0x43719f){return new Promise(function(_0x21040c,_0x5f4e2c){var _0x3f7628=_[_0x2705('0x49')](_0x3b2d89[_0x2705('0x55')]);_0x21040c({'count':_0x3f7628['length'],'rows':_0x3f7628});});},'MailQueuesWaitingInteractions':function(_0x5d541d){return new Promise(function(_0x1b7871,_0x26aa8e){var _0x3d6e57=_[_0x2705('0x49')](_0x3b2d89[_0x2705('0x56')]);_0x1b7871({'count':_0x3d6e57[_0x2705('0x1b')],'rows':_0x3d6e57});});},'OpenchannelQueuesWaitingInteractions':function(_0x4e319e){return new Promise(function(_0x4ffb49,_0x440a3a){var _0x1201d4=_['values'](_0x3b2d89[_0x2705('0x57')]);_0x4ffb49({'count':_0x1201d4[_0x2705('0x1b')],'rows':_0x1201d4});});},'SmsQueuesWaitingInteractions':function(_0x3994c2){return new Promise(function(_0x5e1d3e,_0x27518d){var _0x43e9e0=_['values'](_0x3b2d89[_0x2705('0x58')]);_0x5e1d3e({'count':_0x43e9e0[_0x2705('0x1b')],'rows':_0x43e9e0});});},'FaxQueuesWaitingInteractions':function(_0x44b38f){return new Promise(function(_0x1b477d,_0x43a632){var _0x55d1b0=_[_0x2705('0x49')](_0x3b2d89[_0x2705('0x59')]);_0x1b477d({'count':_0x55d1b0[_0x2705('0x1b')],'rows':_0x55d1b0});});},'WhatsappQueuesWaitingInteractions':function(_0x12e5aa){return new Promise(function(_0x15d1a5,_0x2890c5){var _0x2bd828=_['values'](_0x3b2d89[_0x2705('0x5a')]);_0x15d1a5({'count':_0x2bd828[_0x2705('0x1b')],'rows':_0x2bd828});});}};var _0x2ca397=jayson[_0x2705('0x5b')](_0x5aec1b)[_0x2705('0x5c')]();_0x2ca397['on'](_0x2705('0x32'),function(_0x5c40f0){logger['error'](JSON[_0x2705('0x36')](_0x5c40f0));return _0x21896e(_0x5c40f0);});_0x2ca397[_0x2705('0x5d')](0x232c,_0x2705('0x5e'),function(){console[_0x2705('0x5f')](_0x2705('0x60'),0x232c);return _0x101ce7('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xce7c=['error','info','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','format','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval'];(function(_0x40d054,_0x2ec708){var _0xc4626b=function(_0x93a3f6){while(--_0x93a3f6){_0x40d054['push'](_0x40d054['shift']());}};_0xc4626b(++_0x2ec708);}(_0xce7c,0x85));var _0xcce7=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0xce7c[_0x238bce];return _0x127fc9;};'use strict';var _=require(_0xcce7('0x0'));var util=require(_0xcce7('0x1'));var path=require(_0xcce7('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xcce7('0x3'));var uuid=require(_0xcce7('0x4'));var config=require(_0xcce7('0x5'));var logger=require(_0xcce7('0x6'))(_0xcce7('0x7'));var rpc={'openchannelQueueReport':require(_0xcce7('0x8')),'mailQueueReport':require(_0xcce7('0x9')),'chatQueueReport':require(_0xcce7('0xa')),'smsQueueReport':require(_0xcce7('0xb')),'faxQueueReport':require(_0xcce7('0xc')),'whatsappQueueReport':require(_0xcce7('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3d57fc,_0x50da60,_0x55e33c){return util['format'](_0xcce7('0xe'),_0x3d57fc,_0x50da60||0x0,_0x55e33c||0x0);}function getIntervals(_0x46d1c4,_0xb367cf){var _0x2e4389=[];if(!_[_0xcce7('0xf')](_0xb367cf[_0xcce7('0x10')])&&!_['isNil'](_0x46d1c4[_0xb367cf['IntervalId']])&&!_[_0xcce7('0xf')](_0x46d1c4[_0xb367cf['IntervalId']][_0xcce7('0x11')])){_0x2e4389=_[_0xcce7('0x12')](_0x46d1c4[_0xb367cf[_0xcce7('0x10')]][_0xcce7('0x11')],'interval');}else if(!_[_0xcce7('0xf')](_0xb367cf[_0xcce7('0x13')])){_0x2e4389=[_0xb367cf[_0xcce7('0x13')]];}return _0x2e4389;}exports[_0xcce7('0x14')]=function(_0x5ca488){_0x5ca488[_0xcce7('0x15')]={};return new BPromise(function(_0x2f722a,_0xfa0468){var _0x3232ad={'Start':function(_0xcb42b1){var _0x3c4454=this;return new Promise(function(_0x25dab9,_0x3200f9){if(_0xcb42b1){try{var _0x2c2b55=[];var _0x52aa17=getId(_0xcb42b1[_0xcce7('0x16')],_0xcb42b1[_0xcce7('0x17')]?_0xcb42b1[_0xcce7('0x17')]['id']:0x0,_0xcb42b1['interaction']?_0xcb42b1[_0xcce7('0x18')]['id']:0x0);if(_0xcb42b1[_0xcce7('0x19')]&&_[_0xcce7('0x1a')](_0xcb42b1[_0xcce7('0x19')])&&_0xcb42b1['applications'][_0xcce7('0x1b')]){for(var _0x4020e5=0x0;_0x4020e5<_0xcb42b1[_0xcce7('0x19')][_0xcce7('0x1b')];_0x4020e5+=0x1){var _0x790daa=_0xcb42b1[_0xcce7('0x19')][_0x4020e5];if(fs[_0xcce7('0x1c')](path[_0xcce7('0x1d')](__dirname,_0xcce7('0x19'),_0x790daa['app']+_0xcce7('0x1e')))){var _0x258442=[];switch(_0x790daa[_0xcce7('0x1f')][_0xcce7('0x20')]()){case _0xcce7('0x21'):var _0x514652=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x514652[0x0]);_0x258442[_0xcce7('0x24')](_0x514652[_0xcce7('0x25')](0x1,_0x514652[_0xcce7('0x1b')])[_0xcce7('0x1d')](','));break;case _0xcce7('0x26'):var _0x304b24=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x304b24[0x0]);_0x258442[_0xcce7('0x24')](_0x304b24[0x1]);_0x258442[_0xcce7('0x24')](_0x304b24[_0xcce7('0x25')](0x2,_0x304b24[_0xcce7('0x1b')])['join'](','));break;case'dialogflowv2':var _0x1e205c=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x1e205c[0x0]);_0x258442[_0xcce7('0x24')](_0x1e205c[0x1]);_0x258442['push'](_0x1e205c[0x2]);_0x258442[_0xcce7('0x24')](_0x1e205c[0x3]);_0x258442['push'](_0x1e205c[_0xcce7('0x25')](0x4,_0x1e205c[_0xcce7('0x1b')])['join'](','));break;case _0xcce7('0x27'):var _0x32ea66=_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');_0x258442[_0xcce7('0x24')](_0x32ea66[0x0]);_0x258442[_0xcce7('0x24')](_0x32ea66[0x1]);_0x258442[_0xcce7('0x24')](_0x32ea66[0x2]);_0x258442[_0xcce7('0x24')](_0x32ea66[0x3]);_0x258442[_0xcce7('0x24')](_0x32ea66[_0xcce7('0x25')](0x4,_0x32ea66[_0xcce7('0x1b')])[_0xcce7('0x1d')](','));break;case _0xcce7('0x17'):_0x258442[_0xcce7('0x24')](_0x790daa[_0xcce7('0x22')]);break;case _0xcce7('0x28'):_0x258442[_0xcce7('0x24')](_0x790daa['TagId']);_0x258442[_0xcce7('0x24')](_0x790daa[_0xcce7('0x22')]);break;default:_0x258442=_[_0xcce7('0xf')](_0x790daa[_0xcce7('0x22')])?[]:_0x790daa[_0xcce7('0x22')][_0xcce7('0x23')](',');}var _0x13caf7={'id':util[_0xcce7('0x29')]('%s:%s:%s',_0x52aa17,_0x790daa['id'],_0x790daa[_0xcce7('0x1f')]),'condition':require(_0xcce7('0x2a'))[_0xcce7('0x2b')](_0x52aa17,getIntervals(_0x5ca488[_0xcce7('0x2c')],_0x790daa),_0x5ca488),'consequence':require(_0xcce7('0x2d')+_0x790daa['app'])['consequence'](_0x52aa17,_0x258442,_0x5ca488,_0xcb42b1),'p':_0x790daa[_0xcce7('0x2e')]||0x0};logger['info'](_0xcce7('0x2f'),_0x13caf7['id'],_0xcce7('0x30'),getIntervals(_0x5ca488[_0xcce7('0x2c')],_0x790daa)[_0xcce7('0x1d')]('\x20|\x20'));_0x2c2b55[_0xcce7('0x24')](_0x13caf7);}else{logger[_0xcce7('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xcce7('0x1d')](__dirname,_0xcce7('0x19'),_0x790daa[_0xcce7('0x1f')]+_0xcce7('0x1e')));}}_0x5ca488['rules'][_0x52aa17]=new RuleEngine(_0x2c2b55);_0x5ca488[_0xcce7('0x15')][_0x52aa17]['execute'](_0xcb42b1,function(_0x502cca){logger[_0xcce7('0x32')]('Applications\x20executed',JSON[_0xcce7('0x33')](_0x502cca[_0xcce7('0x34')]));if(_0x5ca488[_0xcce7('0x15')][_0x52aa17]){_0x5ca488[_0xcce7('0x15')][_0x52aa17][_0xcce7('0x35')](_0xcce7('0x36'));}});return _0x25dab9({'code':0xc8,'message':_0xcb42b1});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x25dab9({'code':0xc8,'message':_0xcb42b1});}}catch(_0x58969b){logger[_0xcce7('0x31')](_0x58969b[_0xcce7('0x37')]);return _0x3200f9(_0x3c4454['error'](0x1f4,_0x58969b));}}return _0x3200f9(_0xcce7('0x38'));});},'AcceptMessage':function(_0x5e1a37){var _0x1fb3c3=this;return new Promise(function(_0x2d3e2b,_0x13a97c){if(_0x5e1a37['message']&&_0x5e1a37[_0xcce7('0x17')]['id']){try{var _0x227791=getId(_0x5e1a37[_0xcce7('0x16')],_0x5e1a37[_0xcce7('0x17')]?_0x5e1a37[_0xcce7('0x17')]['id']:0x0,_0x5e1a37[_0xcce7('0x18')]?_0x5e1a37[_0xcce7('0x18')]['id']:0x0);if(_0x5ca488[_0xcce7('0x15')][_0x227791]){_0x5ca488['rules'][_0x227791][_0xcce7('0x35')](_0xcce7('0x39'));if(rpc[_0x5e1a37[_0xcce7('0x16')]+_0xcce7('0x3a')]){rpc[_0x5e1a37[_0xcce7('0x16')]+_0xcce7('0x3a')][_0xcce7('0x3b')](_0x227791,{'UserId':_0x5e1a37[_0xcce7('0x17')][_0xcce7('0x3c')]})[_0xcce7('0x3d')](function(_0xfb3348){logger[_0xcce7('0x31')]('error\x20update\x20queue\x20report');});}}return _0x2d3e2b({'code':0xc8,'message':_0x5e1a37});}catch(_0x224b69){logger[_0xcce7('0x31')](_0x224b69[_0xcce7('0x37')]);return _0x13a97c(_0x1fb3c3[_0xcce7('0x31')](0x1f4,_0x224b69));}}logger['error']('message\x20is\x20empty');return _0x13a97c(_0x1fb3c3['error'](0x1f4,_0xcce7('0x3e')));});},'RejectMessage':function(_0x4fd16e){var _0x238240=this;return new Promise(function(_0x30d3fd,_0x497f16){if(_0x4fd16e[_0xcce7('0x3f')]&&_0x4fd16e['agent']['id']){try{if(_0x5ca488[_0xcce7('0x40')][_0x4fd16e['agent']['id']]){_0x5ca488['agents'][_0x4fd16e[_0xcce7('0x3f')]['id']]['busy']=![];_0x5ca488['agents'][_0x4fd16e[_0xcce7('0x3f')]['id']][_0xcce7('0x41')]=undefined;}return _0x30d3fd({'code':0xc8,'message':_0x4fd16e});}catch(_0x449a58){logger['error'](_0x449a58['stack']);return _0x497f16(_0x238240[_0xcce7('0x31')](0x1f4,_0x449a58));}}logger[_0xcce7('0x31')](_0xcce7('0x3e'));return _0x497f16(_0x238240['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1a2c54){var _0x1b1c84=this;return new Promise(function(_0x2280c6,_0x470489){if(_0x1a2c54['channel']&&_0x1a2c54[_0xcce7('0x18')]&&_0x1a2c54[_0xcce7('0x18')]['id']){try{var _0x195a9d=getId(_0x1a2c54['channel'],_0x1a2c54['message']?_0x1a2c54[_0xcce7('0x17')]['id']:0x0,_0x1a2c54[_0xcce7('0x18')]?_0x1a2c54[_0xcce7('0x18')]['id']:0x0);if(_0x5ca488[_0xcce7('0x15')][_0x195a9d]){_0x5ca488[_0xcce7('0x15')][_0x195a9d][_0xcce7('0x35')](_0xcce7('0x39'));}return _0x2280c6({'code':0xc8,'message':_0x1a2c54});}catch(_0x1c7cde){logger[_0xcce7('0x31')](_0x1c7cde[_0xcce7('0x37')]);return _0x470489(_0x1b1c84[_0xcce7('0x31')](0x1f4,_0x1c7cde));}}logger[_0xcce7('0x31')]('message\x20is\x20empty');return _0x470489(_0x1b1c84[_0xcce7('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5bd7fa){var _0x1305a7=this;return new Promise(function(_0x30246c,_0x2376ba){if(_0x5ca488[_0xcce7('0x40')][_0xcce7('0x42')](_0x5bd7fa['id'])){for(var _0x5abf7d in _0x5bd7fa[_0xcce7('0x43')]){if(_0x5bd7fa[_0xcce7('0x43')][_0xcce7('0x42')](_0x5abf7d)){if(_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']][_0xcce7('0x42')](_0x5abf7d+_0xcce7('0x44'))){_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']][_0x5abf7d+_0xcce7('0x44')]=parseInt(_0x5bd7fa[_0xcce7('0x43')][_0x5abf7d],0xa);}}}_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']][_0xcce7('0x45')]();return _0x30246c({'code':0xc8,'message':_0x5ca488[_0xcce7('0x40')][_0x5bd7fa['id']]});}else{return _0x2376ba(_0x1305a7['error'](0x1f4,_0xcce7('0x46')));}});},'Agents':function(_0x702dbe){return new Promise(function(_0x50085e,_0x32b35e){var _0x279c4a=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x40')]);_0x50085e({'count':_0x279c4a[_0xcce7('0x1b')],'rows':_0x279c4a});});},'ChatQueues':function(_0x4f4021){return new Promise(function(_0x4a6768,_0x5e0da7){var _0x55ef38=[];for(var _0x333eb5 in _0x5ca488['chatQueues']){if(_0x5ca488[_0xcce7('0x48')]['hasOwnProperty'](_0x333eb5)){var _0x108f83=_0x5ca488[_0xcce7('0x48')][_0x333eb5];var _0x1d1773={'id':_0x108f83['id'],'available':_0x108f83[_0xcce7('0x49')],'loggedIn':_0x108f83['loggedIn'],'name':_0x108f83[_0xcce7('0x4a')],'paused':_0x108f83[_0xcce7('0x4b')],'waiting':_0x108f83[_0xcce7('0x4c')]};_0x55ef38[_0xcce7('0x24')](_0x1d1773);}}_0x4a6768({'count':_0x55ef38[_0xcce7('0x1b')],'rows':_0x55ef38});});},'MailQueues':function(_0x130eed){return new Promise(function(_0x3bf668,_0x25db98){var _0x5129ba=[];for(var _0x1f779f in _0x5ca488[_0xcce7('0x4d')]){if(_0x5ca488['mailQueues'][_0xcce7('0x42')](_0x1f779f)){var _0x5a925f=_0x5ca488[_0xcce7('0x4d')][_0x1f779f];var _0x520334={'id':_0x5a925f['id'],'available':_0x5a925f[_0xcce7('0x49')],'loggedIn':_0x5a925f[_0xcce7('0x4e')],'name':_0x5a925f[_0xcce7('0x4a')],'paused':_0x5a925f['paused'],'waiting':_0x5a925f[_0xcce7('0x4c')]};_0x5129ba[_0xcce7('0x24')](_0x520334);}}_0x3bf668({'count':_0x5129ba['length'],'rows':_0x5129ba});});},'OpenchannelQueues':function(_0x57e651){return new Promise(function(_0x2ab645,_0x33f48a){var _0x1cd3e7=[];for(var _0x22ae47 in _0x5ca488[_0xcce7('0x4f')]){if(_0x5ca488[_0xcce7('0x4f')][_0xcce7('0x42')](_0x22ae47)){var _0x10db9b=_0x5ca488[_0xcce7('0x4f')][_0x22ae47];var _0x476895={'id':_0x10db9b['id'],'available':_0x10db9b[_0xcce7('0x49')],'loggedIn':_0x10db9b[_0xcce7('0x4e')],'name':_0x10db9b[_0xcce7('0x4a')],'paused':_0x10db9b[_0xcce7('0x4b')],'waiting':_0x10db9b[_0xcce7('0x4c')]};_0x1cd3e7[_0xcce7('0x24')](_0x476895);}}_0x2ab645({'count':_0x1cd3e7[_0xcce7('0x1b')],'rows':_0x1cd3e7});});},'SmsQueues':function(_0x32fd47){return new Promise(function(_0x2f5d5e,_0x263df6){var _0x21b707=[];for(var _0x5b3af3 in _0x5ca488['smsQueues']){if(_0x5ca488['smsQueues'][_0xcce7('0x42')](_0x5b3af3)){var _0x58d67c=_0x5ca488['smsQueues'][_0x5b3af3];var _0x5ea273={'id':_0x58d67c['id'],'available':_0x58d67c[_0xcce7('0x49')],'loggedIn':_0x58d67c['loggedIn'],'name':_0x58d67c[_0xcce7('0x4a')],'paused':_0x58d67c[_0xcce7('0x4b')],'waiting':_0x58d67c[_0xcce7('0x4c')]};_0x21b707['push'](_0x5ea273);}}_0x2f5d5e({'count':_0x21b707['length'],'rows':_0x21b707});});},'FaxQueues':function(_0x5a5f89){return new Promise(function(_0x5876c3,_0x51f28d){var _0x48ecbd=[];for(var _0x3688d3 in _0x5ca488[_0xcce7('0x50')]){if(_0x5ca488['faxQueues'][_0xcce7('0x42')](_0x3688d3)){var _0x3622f6=_0x5ca488[_0xcce7('0x50')][_0x3688d3];var _0x3d18c3={'id':_0x3622f6['id'],'available':_0x3622f6[_0xcce7('0x49')],'loggedIn':_0x3622f6['loggedIn'],'name':_0x3622f6[_0xcce7('0x4a')],'paused':_0x3622f6[_0xcce7('0x4b')],'waiting':_0x3622f6[_0xcce7('0x4c')]};_0x48ecbd[_0xcce7('0x24')](_0x3d18c3);}}_0x5876c3({'count':_0x48ecbd[_0xcce7('0x1b')],'rows':_0x48ecbd});});},'WhatsappQueues':function(_0xaf3670){return new Promise(function(_0x57cb3c,_0xf4faee){var _0x2e59fe=[];for(var _0x407160 in _0x5ca488[_0xcce7('0x51')]){if(_0x5ca488['whatsappQueues'][_0xcce7('0x42')](_0x407160)){var _0x11bc12=_0x5ca488[_0xcce7('0x51')][_0x407160];var _0x51773d={'id':_0x11bc12['id'],'available':_0x11bc12[_0xcce7('0x49')],'loggedIn':_0x11bc12[_0xcce7('0x4e')],'name':_0x11bc12[_0xcce7('0x4a')],'paused':_0x11bc12[_0xcce7('0x4b')],'waiting':_0x11bc12['waiting']};_0x2e59fe['push'](_0x51773d);}}_0x57cb3c({'count':_0x2e59fe[_0xcce7('0x1b')],'rows':_0x2e59fe});});},'ChatQueuesWaitingInteractions':function(_0x36d66e){return new Promise(function(_0x52d752,_0x1e1000){var _0x2e23ae=_['values'](_0x5ca488[_0xcce7('0x52')]);_0x52d752({'count':_0x2e23ae['length'],'rows':_0x2e23ae});});},'MailQueuesWaitingInteractions':function(_0x327722){return new Promise(function(_0x9f5094,_0x4bbaa7){var _0x5169a0=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x53')]);_0x9f5094({'count':_0x5169a0['length'],'rows':_0x5169a0});});},'OpenchannelQueuesWaitingInteractions':function(_0x5e32c8){return new Promise(function(_0x3c90b2,_0x3a54c3){var _0x43a3b9=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x54')]);_0x3c90b2({'count':_0x43a3b9['length'],'rows':_0x43a3b9});});},'SmsQueuesWaitingInteractions':function(_0x1b1b64){return new Promise(function(_0x2c9000,_0xf9c8f3){var _0x17c5a4=_[_0xcce7('0x47')](_0x5ca488[_0xcce7('0x55')]);_0x2c9000({'count':_0x17c5a4[_0xcce7('0x1b')],'rows':_0x17c5a4});});},'FaxQueuesWaitingInteractions':function(_0x5f3be2){return new Promise(function(_0x4b1f9e,_0x2df512){var _0x56677d=_[_0xcce7('0x47')](_0x5ca488['faxQueuesWaitingInteractions']);_0x4b1f9e({'count':_0x56677d['length'],'rows':_0x56677d});});},'WhatsappQueuesWaitingInteractions':function(_0x19317d){return new Promise(function(_0x54c14d,_0x17a3c5){var _0x296adb=_['values'](_0x5ca488[_0xcce7('0x56')]);_0x54c14d({'count':_0x296adb[_0xcce7('0x1b')],'rows':_0x296adb});});}};var _0xcc015e=jayson[_0xcce7('0x57')](_0x3232ad)[_0xcce7('0x58')]();_0xcc015e['on'](_0xcce7('0x31'),function(_0x350173){logger['error'](JSON[_0xcce7('0x33')](_0x350173));return _0xfa0468(_0x350173);});_0xcc015e['listen'](0x232c,'127.0.0.1',function(){console[_0xcce7('0x59')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2f722a(_0xcce7('0x5a')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 12be152..9647db5 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 _0x2fed=['Command','format','then','indexOf','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','jayson/promise','lodash','../../../config/logger','routing','http','request','error','message','result','catch','condition','rules','info','stop','length','push'];(function(_0x31ed1d,_0x16cada){var _0x5601f9=function(_0x17454e){while(--_0x17454e){_0x31ed1d['push'](_0x31ed1d['shift']());}};_0x5601f9(++_0x16cada);}(_0x2fed,0x14c));var _0xd2fe=function(_0x141f9b,_0x20f4e5){_0x141f9b=_0x141f9b-0x0;var _0x1e7f08=_0x2fed[_0x141f9b];return _0x1e7f08;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xd2fe('0x0'));var _=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var client=jayson['client'][_0xd2fe('0x4')]({'port':0x232a});function request(_0xe10b2b,_0x470c52){return new BPromise(function(_0x20830f,_0x325133){return client[_0xd2fe('0x5')](_0xe10b2b,_0x470c52)['then'](function(_0x1a9341){if(_0x1a9341[_0xd2fe('0x6')]){return _0x325133(_0x1a9341[_0xd2fe('0x6')][_0xd2fe('0x7')]);}else{return _0x20830f(_0x1a9341[_0xd2fe('0x8')]);}})[_0xd2fe('0x9')](function(_0xb36e8c){return _0x325133(_0xb36e8c);});});}exports[_0xd2fe('0xa')]=function(_0x111556,_0x44602f,_0x4cedda){return function(_0x2f6a47){if(_0x4cedda[_0xd2fe('0xb')]&&!_0x4cedda[_0xd2fe('0xb')][_0x111556]){logger[_0xd2fe('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x111556);return _0x2f6a47[_0xd2fe('0xd')]();}var _0x3b318d=[];for(var _0x4de67c=0x0;_0x4de67c<_0x44602f[_0xd2fe('0xe')];_0x4de67c+=0x1){_0x3b318d[_0xd2fe('0xf')](request(_0xd2fe('0x10'),{'command':util[_0xd2fe('0x11')]('iftime\x20%s',_0x44602f[_0x4de67c])})[_0xd2fe('0x12')](function(_0x2c4ccc){return _0x2c4ccc&&_0x2c4ccc[_0xd2fe('0x7')]&&_0x2c4ccc[_0xd2fe('0x7')][_0xd2fe('0x13')]('true')>=0x0?!![]:![];})[_0xd2fe('0x9')](function(_0x2639fe){logger[_0xd2fe('0x6')](_0xd2fe('0x14'),_0x111556,_0x44602f[_0x4de67c]);}));}BPromise[_0xd2fe('0x15')](_0x3b318d)[_0xd2fe('0x12')](function(_0x293fcc){var _0x5cfbf6=_[_0xd2fe('0x16')](_0x293fcc);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x111556,_0x44602f[_0xd2fe('0x17')](_0xd2fe('0x18')),_0x5cfbf6);_0x2f6a47[_0xd2fe('0x19')](_0x5cfbf6);})[_0xd2fe('0x9')](function(_0x992364){console[_0xd2fe('0x1a')](_0x992364);logger[_0xd2fe('0x6')](_0xd2fe('0x1b'),_0x111556,_0x44602f['join'](_0xd2fe('0x18')),_0x992364[_0xd2fe('0x1c')]);_0x2f6a47[_0xd2fe('0xd')]();});};}; \ No newline at end of file +var _0x8251=['log','stack','util','bluebird','jayson/promise','lodash','routing','client','http','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','iftime\x20%s','then','message','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x1076c0,_0x172051){var _0x47881b=function(_0x4d9a70){while(--_0x4d9a70){_0x1076c0['push'](_0x1076c0['shift']());}};_0x47881b(++_0x172051);}(_0x8251,0x107));var _0x1825=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8251[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0x1825('0x0'));var BPromise=require(_0x1825('0x1'));var jayson=require(_0x1825('0x2'));var _=require(_0x1825('0x3'));var logger=require('../../../config/logger')(_0x1825('0x4'));var client=jayson[_0x1825('0x5')][_0x1825('0x6')]({'port':0x232a});function request(_0x2b86fa,_0x1920ce){return new BPromise(function(_0xffed9,_0x1b676f){return client['request'](_0x2b86fa,_0x1920ce)['then'](function(_0x153f41){if(_0x153f41[_0x1825('0x7')]){return _0x1b676f(_0x153f41[_0x1825('0x7')]['message']);}else{return _0xffed9(_0x153f41[_0x1825('0x8')]);}})[_0x1825('0x9')](function(_0x55644d){return _0x1b676f(_0x55644d);});});}exports['condition']=function(_0x4a4126,_0x62d6f0,_0x155352){return function(_0xa28205){if(_0x155352[_0x1825('0xa')]&&!_0x155352['rules'][_0x4a4126]){logger[_0x1825('0xb')](_0x1825('0xc'),_0x4a4126);return _0xa28205[_0x1825('0xd')]();}var _0x11003d=[];for(var _0x46509a=0x0;_0x46509a<_0x62d6f0['length'];_0x46509a+=0x1){_0x11003d[_0x1825('0xe')](request('Command',{'command':util[_0x1825('0xf')](_0x1825('0x10'),_0x62d6f0[_0x46509a])})[_0x1825('0x11')](function(_0x43006b){return _0x43006b&&_0x43006b[_0x1825('0x12')]&&_0x43006b[_0x1825('0x12')][_0x1825('0x13')]('true')>=0x0?!![]:![];})[_0x1825('0x9')](function(_0x407f53){logger[_0x1825('0x7')](_0x1825('0x14'),_0x4a4126,_0x62d6f0[_0x46509a]);}));}BPromise[_0x1825('0x15')](_0x11003d)[_0x1825('0x11')](function(_0x387719){var _0x218d01=_[_0x1825('0x16')](_0x387719);logger['info'](_0x1825('0x17'),_0x4a4126,_0x62d6f0[_0x1825('0x18')](_0x1825('0x19')),_0x218d01);_0xa28205[_0x1825('0x1a')](_0x218d01);})[_0x1825('0x9')](function(_0x97828){console[_0x1825('0x1b')](_0x97828);logger[_0x1825('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x4a4126,_0x62d6f0['join']('\x20|\x20'),_0x97828[_0x1825('0x1c')]);_0xa28205[_0x1825('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b48361a..34392f2 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 _0x8116=['splice','agentconnectAt','agent','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','connectedlinename','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','now','timeout','reason','holdtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','ringtime','lastevent','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf'];(function(_0x158b04,_0x18099a){var _0x4210c0=function(_0x3abda6){while(--_0x3abda6){_0x158b04['push'](_0x158b04['shift']());}};_0x4210c0(++_0x18099a);}(_0x8116,0x1b1));var _0x6811=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8116[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x6811('0x0'));var utils=require(_0x6811('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1df873,_0x51446d){utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x4'),_0x1df873[_0x6811('0x5')],_0x1df873[_0x6811('0x6')],_0x1df873[_0x6811('0x7')],_0x1df873[_0x6811('0x8')],_0x1df873['interface'],_0x1df873[_0x6811('0x9')],_0x1df873[_0x6811('0xa')],_0x1df873['lastevent']));if(_0x1df873[_0x6811('0x7')]){utils['getVoiceQueueByName'](_0x1df873[_0x6811('0x7')])['then'](function(_0x120b95){if(_0x120b95){_0x1df873[_0x6811('0xb')]=_0x120b95[_0x6811('0xb')];_0x1df873[_0x6811('0xc')]=_0x1df873['agentcomplete']?_0x120b95['acw']:![];_0x1df873[_0x6811('0xd')]=_0x1df873['agentacw']?_0x120b95[_0x6811('0xe')]:0x0;}utils[_0x6811('0xf')](_0x6811('0x10'),_0x1df873);});}else{utils[_0x6811('0xf')]('CreateVoiceAgentReport',_0x1df873);}if(_0x51446d){delete transfers[_0x1df873['uniqueid']];}else{delete agents[_0x1df873[_0x6811('0x11')]];}}exports[_0x6811('0x12')]=function(_0x210c35){try{utils['debug'](util[_0x6811('0x3')]('[%s][agents][agentcalled]',_0x210c35[_0x6811('0x5')]),_0x210c35);agents[_0x210c35[_0x6811('0x11')]]=_0x210c35;agents[_0x210c35[_0x6811('0x11')]][_0x6811('0x13')]=utils['now']();agents[_0x210c35[_0x6811('0x11')]]['lastevent']='called';agents[_0x210c35[_0x6811('0x11')]][_0x6811('0xa')]=null;agents[_0x210c35['destuniqueid']][_0x6811('0x14')]=null;utils[_0x6811('0x2')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x210c35['uniqueid'],agents[_0x210c35[_0x6811('0x11')]][_0x6811('0x8')],_0x210c35[_0x6811('0x11')]));}catch(_0x4c9ca2){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x16'),_0x210c35[_0x6811('0x5')]),_0x4c9ca2);}};exports[_0x6811('0x17')]=function(_0x43961c){try{if(!_[_0x6811('0x18')](agents[_0x43961c[_0x6811('0x11')]])){utils['debug'](util['format'](_0x6811('0x19'),_0x43961c[_0x6811('0x5')]),_0x43961c);utils[_0x6811('0x2')](util[_0x6811('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x43961c['uniqueid'],agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x8')],_0x43961c[_0x6811('0x11')]));agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x17')]=!![];agents[_0x43961c['destuniqueid']][_0x6811('0x1a')]=utils[_0x6811('0x1b')]();agents[_0x43961c[_0x6811('0x11')]]['lastevent']=_0x6811('0x1c');agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x1d')]=_0x6811('0x1c');agents[_0x43961c['destuniqueid']][_0x6811('0x1e')]=_0x43961c['ringtime']?parseInt(_0x43961c['ringtime'])/0x3e8:0x0;agents[_0x43961c[_0x6811('0x11')]][_0x6811('0x1f')]=0x0;unanswered[_0x6811('0x20')](_0x43961c[_0x6811('0x11')]);}}catch(_0x2fab42){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x19'),_0x43961c['uniqueid']),_0x2fab42);}};exports[_0x6811('0x21')]=function(_0x26228a){try{_[_0x6811('0x22')](agents,function(_0x645737,_0x1a1444){if(_0x645737[_0x6811('0x5')]==_0x26228a[_0x6811('0x5')]&&!_[_0x6811('0x23')](unanswered,_0x645737[_0x6811('0x11')])){utils[_0x6811('0x24')](util[_0x6811('0x3')]('[%s][agents][queuecallerabandon]',_0x26228a['uniqueid']),_0x26228a);utils['info'](util[_0x6811('0x3')](_0x6811('0x25'),_0x26228a[_0x6811('0x5')],_0x645737['membername'],_0x645737[_0x6811('0x11')]));_0x645737['agentringnoanswer']=!![];_0x645737[_0x6811('0x1a')]=utils['now']();_0x645737['lastevent']=_0x6811('0x26');_0x645737['reason']='abandoned';_0x645737[_0x6811('0x1e')]=_0x26228a[_0x6811('0x1e')];_0x645737[_0x6811('0x1f')]=0x0;writeDB(_0x645737);}});}catch(_0x31b37b){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x27'),_0x26228a['uniqueid']),_0x31b37b);}};exports['agentconnect']=function(_0x4d42ec){try{if(agents[_0x4d42ec[_0x6811('0x11')]]){utils[_0x6811('0x24')](util[_0x6811('0x3')]('[%s][agents][agentconnect]',_0x4d42ec[_0x6811('0x5')]),_0x4d42ec);utils[_0x6811('0x2')](util[_0x6811('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4d42ec[_0x6811('0x5')],agents[_0x4d42ec[_0x6811('0x11')]][_0x6811('0x8')],_0x4d42ec[_0x6811('0x11')]));agents[_0x4d42ec[_0x6811('0x11')]]['agentconnectAt']=utils[_0x6811('0x1b')]();agents[_0x4d42ec[_0x6811('0x11')]]['connectedlinenum']=_0x4d42ec[_0x6811('0xa')];agents[_0x4d42ec[_0x6811('0x11')]][_0x6811('0x14')]=_0x4d42ec[_0x6811('0x14')];agents[_0x4d42ec[_0x6811('0x11')]][_0x6811('0x1e')]=_0x4d42ec[_0x6811('0x28')];agents[_0x4d42ec['destuniqueid']][_0x6811('0x29')]=_0x6811('0x2a');_[_0x6811('0x22')](agents,function(_0x273ec1,_0x3ca06e){if(_0x273ec1[_0x6811('0x11')]!=_0x4d42ec['destuniqueid']&&_0x273ec1['uniqueid']==_0x4d42ec[_0x6811('0x5')]){_0x273ec1[_0x6811('0x1f')]=0x0;_0x273ec1[_0x6811('0x1e')]=_0x4d42ec[_0x6811('0x28')];_0x273ec1['agentringnoanswer']=!![];_0x273ec1[_0x6811('0x1a')]=utils[_0x6811('0x1b')]();_0x273ec1[_0x6811('0x29')]=_0x6811('0x2b');_0x273ec1[_0x6811('0x1d')]=_0x6811('0x2b');_0x273ec1[_0x6811('0x2c')]=_0x4d42ec[_0x6811('0x11')];_0x273ec1[_0x6811('0x2d')]=_0x4d42ec[_0x6811('0x8')];writeDB(_0x273ec1);}});}}catch(_0x393a4e){utils['error'](util[_0x6811('0x3')](_0x6811('0x2e'),_0x4d42ec[_0x6811('0x5')]),_0x393a4e);}};exports[_0x6811('0x2f')]=function(_0x5af41b){try{if(!_[_0x6811('0x18')](agents[_0x5af41b[_0x6811('0x11')]])){utils[_0x6811('0x24')](util['format'](_0x6811('0x30'),_0x5af41b['uniqueid']),_0x5af41b);utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x31'),_0x5af41b[_0x6811('0x5')],agents[_0x5af41b['destuniqueid']][_0x6811('0x8')],_0x5af41b['destuniqueid']));agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x2f')]=!![];agents[_0x5af41b['destuniqueid']][_0x6811('0x32')]=utils[_0x6811('0x1b')]();agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x1f')]=utils['diffTime'](agents[_0x5af41b['destuniqueid']][_0x6811('0x32')],agents[_0x5af41b[_0x6811('0x11')]]['agentconnectAt']);agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x1d')]=_0x5af41b[_0x6811('0x1d')];agents[_0x5af41b[_0x6811('0x11')]][_0x6811('0x29')]=_0x6811('0x33');writeDB(agents[_0x5af41b['destuniqueid']]);}}catch(_0x26cc72){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x30'),_0x5af41b[_0x6811('0x5')]),_0x26cc72);}};exports[_0x6811('0x34')]=function(_0x18987e){try{if(!_[_0x6811('0x18')](agents[_0x18987e[_0x6811('0x35')]])){utils[_0x6811('0x24')](util[_0x6811('0x3')](_0x6811('0x36'),_0x18987e[_0x6811('0x5')]),_0x18987e);utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x37'),_0x18987e[_0x6811('0x5')],agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x8')],agents[_0x18987e['transfereruniqueid']][_0x6811('0x5')]));agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x38')]=!![];agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x39')]=_0x6811('0x3a');agents[_0x18987e['transfereruniqueid']][_0x6811('0x3b')]=_0x18987e[_0x6811('0x3c')];agents[_0x18987e[_0x6811('0x35')]]['transferuniqueid']=agents[_0x18987e[_0x6811('0x35')]][_0x6811('0x5')];}}catch(_0x41c68d){utils[_0x6811('0x15')](util[_0x6811('0x3')]('[%s][agents][blindtransfer]',_0x18987e[_0x6811('0x5')]),_0x41c68d);}};exports[_0x6811('0x3d')]=function(_0x5d1e88){try{utils[_0x6811('0x24')](util[_0x6811('0x3')](_0x6811('0x3e'),_0x5d1e88[_0x6811('0x3f')]),_0x5d1e88);if(_0x5d1e88[_0x6811('0x3f')]==_0x5d1e88[_0x6811('0x40')]){if(!_[_0x6811('0x18')](agents[_0x5d1e88[_0x6811('0x41')]])){utils['info'](util[_0x6811('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5d1e88[_0x6811('0x3f')],agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x8')]));agents[_0x5d1e88[_0x6811('0x41')]]['transfer']=!![];agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x39')]=_0x6811('0x42');agents[_0x5d1e88['secondtransfereruniqueid']][_0x6811('0x3b')]=_0x5d1e88[_0x6811('0x43')];agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x44')]=_0x5d1e88[_0x6811('0x3f')];}if(_0x5d1e88[_0x6811('0x45')]&&agents[_0x5d1e88[_0x6811('0x45')]]){agents[_0x5d1e88['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x5d1e88['transfereeuniqueid']]=_[_0x6811('0x46')](agents[_0x5d1e88[_0x6811('0x45')]]);transfers[_0x5d1e88['transfereeuniqueid']][_0x6811('0x9')]=agents[_0x5d1e88[_0x6811('0x41')]][_0x6811('0x9')];transfers[_0x5d1e88[_0x6811('0x45')]]['calleridname']=agents[_0x5d1e88['secondtransfereruniqueid']][_0x6811('0x47')];transfers[_0x5d1e88['transfereeuniqueid']][_0x6811('0x13')]=utils['now']();transfers[_0x5d1e88[_0x6811('0x45')]]['agentconnectAt']=utils[_0x6811('0x1b')]();transfers[_0x5d1e88['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x5d1e88[_0x6811('0x45')]][_0x6811('0x48')]=0x2;}}else if(_0x5d1e88[_0x6811('0x41')]==_0x5d1e88[_0x6811('0x49')]){if(!_[_0x6811('0x18')](agents[_0x5d1e88[_0x6811('0x3f')]])){utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x4a'),_0x5d1e88['origtransfereruniqueid'],agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x8')]));agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x38')]=!![];agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x39')]=_0x6811('0x42');agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x3b')]=_0x5d1e88[_0x6811('0x4b')];agents[_0x5d1e88['origtransfereruniqueid']][_0x6811('0x44')]=_0x5d1e88['secondtransfereruniqueid'];}if(_0x5d1e88[_0x6811('0x4c')]&&agents[_0x5d1e88[_0x6811('0x4c')]]){agents[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x48')]=0x1;transfers[_0x5d1e88[_0x6811('0x4c')]]=_['clone'](agents[_0x5d1e88[_0x6811('0x4c')]]);transfers[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x9')]=agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x9')];transfers[_0x5d1e88[_0x6811('0x4c')]]['calleridname']=agents[_0x5d1e88[_0x6811('0x3f')]][_0x6811('0x47')];transfers[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x13')]=utils[_0x6811('0x1b')]();transfers[_0x5d1e88[_0x6811('0x4c')]]['agentconnectAt']=utils['now']();transfers[_0x5d1e88['transfertargetuniqueid']][_0x6811('0x1e')]=0x0;transfers[_0x5d1e88[_0x6811('0x4c')]][_0x6811('0x48')]=0x2;}}}catch(_0x4995e8){utils[_0x6811('0x15')](util['format'](_0x6811('0x3e'),_0x5d1e88[_0x6811('0x3f')]),_0x4995e8);}};exports[_0x6811('0x4d')]=function(_0x10dd58){try{utils[_0x6811('0x24')](util[_0x6811('0x3')](_0x6811('0x4e'),_0x10dd58[_0x6811('0x5')]),_0x10dd58);if(agents[_0x10dd58[_0x6811('0x5')]]&&agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')]===_0x6811('0x1c')){if(_0x10dd58[_0x6811('0x4f')]==='21'){agents[_0x10dd58[_0x6811('0x5')]]['reason']='rejected';agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]=_0x6811('0x50');}utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x51'),_0x10dd58[_0x6811('0x5')],agents[_0x10dd58['uniqueid']]['membername'],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]));writeDB(agents[_0x10dd58[_0x6811('0x5')]]);var _0x25272a=unanswered[_0x6811('0x52')](_0x10dd58[_0x6811('0x5')]);if(_0x25272a>-0x1){unanswered[_0x6811('0x53')](_0x25272a,0x1);}}if(transfers[_0x10dd58[_0x6811('0x5')]]){transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x2f')]=!![];transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x32')]=utils[_0x6811('0x1b')]();transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1f')]=utils['diffTime'](transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x32')],transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x54')]);transfers[_0x10dd58[_0x6811('0x5')]]['reason']='agent';transfers[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]=_0x6811('0x33');utils['info'](util['format'](_0x6811('0x51'),_0x10dd58[_0x6811('0x5')],transfers[_0x10dd58[_0x6811('0x5')]]['membername'],transfers[_0x10dd58['uniqueid']][_0x6811('0x1d')],transfers[_0x10dd58[_0x6811('0x5')]]['lastevent']));writeDB(transfers[_0x10dd58[_0x6811('0x5')]],!![]);}if(agents[_0x10dd58[_0x6811('0x5')]]&&agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x54')]){agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x2f')]=!![];agents[_0x10dd58[_0x6811('0x5')]]['agentcompleteAt']=utils[_0x6811('0x1b')]();agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1f')]=utils['diffTime'](agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x32')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x54')]);agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')]=agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x38')]?_0x6811('0x38'):_0x6811('0x55');agents[_0x10dd58['uniqueid']][_0x6811('0x29')]='complete';utils[_0x6811('0x2')](util[_0x6811('0x3')](_0x6811('0x51'),_0x10dd58[_0x6811('0x5')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x8')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x1d')],agents[_0x10dd58[_0x6811('0x5')]][_0x6811('0x29')]));writeDB(agents[_0x10dd58[_0x6811('0x5')]]);}}catch(_0x535d65){utils[_0x6811('0x15')](util[_0x6811('0x3')](_0x6811('0x4e'),_0x10dd58[_0x6811('0x5')]),_0x535d65);}}; \ No newline at end of file +var _0x14b4=['debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','push','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','reason','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertype','transferexten','secondtransfererexten','transfertargetuniqueid','calleridnum','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','complete','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','type','agentacw','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','agentcalled'];(function(_0xfd3e58,_0x2276f0){var _0x5aac07=function(_0x5d5b67){while(--_0x5d5b67){_0xfd3e58['push'](_0xfd3e58['shift']());}};_0x5aac07(++_0x2276f0);}(_0x14b4,0x97));var _0x414b=function(_0x275e03,_0x49e067){_0x275e03=_0x275e03-0x0;var _0x2ea2b0=_0x14b4[_0x275e03];return _0x2ea2b0;};'use strict';var _=require(_0x414b('0x0'));var util=require(_0x414b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1f23d7,_0x44c0ff){utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x4'),_0x1f23d7['uniqueid'],_0x1f23d7['channel'],_0x1f23d7[_0x414b('0x5')],_0x1f23d7[_0x414b('0x6')],_0x1f23d7[_0x414b('0x7')],_0x1f23d7['calleridnum'],_0x1f23d7[_0x414b('0x8')],_0x1f23d7['lastevent']));if(_0x1f23d7[_0x414b('0x5')]){utils['getVoiceQueueByName'](_0x1f23d7['queue'])['then'](function(_0x487de2){if(_0x487de2){_0x1f23d7[_0x414b('0x9')]=_0x487de2['type'];_0x1f23d7[_0x414b('0xa')]=_0x1f23d7['agentcomplete']?_0x487de2[_0x414b('0xb')]:![];_0x1f23d7[_0x414b('0xc')]=_0x1f23d7[_0x414b('0xa')]?_0x487de2['acwTimeout']:0x0;}utils[_0x414b('0xd')](_0x414b('0xe'),_0x1f23d7);});}else{utils['request'](_0x414b('0xe'),_0x1f23d7);}if(_0x44c0ff){delete transfers[_0x1f23d7[_0x414b('0xf')]];}else{delete agents[_0x1f23d7['destuniqueid']];}}exports[_0x414b('0x10')]=function(_0x236e62){try{utils[_0x414b('0x11')](util[_0x414b('0x3')](_0x414b('0x12'),_0x236e62[_0x414b('0xf')]),_0x236e62);agents[_0x236e62[_0x414b('0x13')]]=_0x236e62;agents[_0x236e62[_0x414b('0x13')]][_0x414b('0x14')]=utils[_0x414b('0x15')]();agents[_0x236e62[_0x414b('0x13')]][_0x414b('0x16')]=_0x414b('0x17');agents[_0x236e62['destuniqueid']][_0x414b('0x8')]=null;agents[_0x236e62['destuniqueid']]['connectedlinename']=null;utils[_0x414b('0x2')](util[_0x414b('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x236e62[_0x414b('0xf')],agents[_0x236e62[_0x414b('0x13')]][_0x414b('0x6')],_0x236e62[_0x414b('0x13')]));}catch(_0xab516e){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x12'),_0x236e62[_0x414b('0xf')]),_0xab516e);}};exports['agentringnoanswer']=function(_0x2fa240){try{if(!_[_0x414b('0x19')](agents[_0x2fa240[_0x414b('0x13')]])){utils[_0x414b('0x11')](util[_0x414b('0x3')](_0x414b('0x1a'),_0x2fa240['uniqueid']),_0x2fa240);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x1b'),_0x2fa240[_0x414b('0xf')],agents[_0x2fa240[_0x414b('0x13')]]['membername'],_0x2fa240[_0x414b('0x13')]));agents[_0x2fa240[_0x414b('0x13')]][_0x414b('0x1c')]=!![];agents[_0x2fa240['destuniqueid']][_0x414b('0x1d')]=utils[_0x414b('0x15')]();agents[_0x2fa240[_0x414b('0x13')]][_0x414b('0x16')]=_0x414b('0x1e');agents[_0x2fa240[_0x414b('0x13')]]['reason']=_0x414b('0x1e');agents[_0x2fa240[_0x414b('0x13')]][_0x414b('0x1f')]=_0x2fa240[_0x414b('0x20')]?parseInt(_0x2fa240[_0x414b('0x20')])/0x3e8:0x0;agents[_0x2fa240[_0x414b('0x13')]]['talktime']=0x0;unanswered[_0x414b('0x21')](_0x2fa240[_0x414b('0x13')]);}}catch(_0x4228dc){utils['error'](util[_0x414b('0x3')](_0x414b('0x1a'),_0x2fa240[_0x414b('0xf')]),_0x4228dc);}};exports['queuecallerabandon']=function(_0x4c59b2){try{_['forIn'](agents,function(_0x299355,_0x349454){if(_0x299355['uniqueid']==_0x4c59b2['uniqueid']&&!_[_0x414b('0x22')](unanswered,_0x299355[_0x414b('0x13')])){utils['debug'](util[_0x414b('0x3')](_0x414b('0x23'),_0x4c59b2[_0x414b('0xf')]),_0x4c59b2);utils[_0x414b('0x2')](util['format'](_0x414b('0x24'),_0x4c59b2[_0x414b('0xf')],_0x299355['membername'],_0x299355[_0x414b('0x13')]));_0x299355['agentringnoanswer']=!![];_0x299355[_0x414b('0x1d')]=utils[_0x414b('0x15')]();_0x299355[_0x414b('0x16')]='abandoned';_0x299355['reason']=_0x414b('0x25');_0x299355[_0x414b('0x1f')]=_0x4c59b2['holdtime'];_0x299355[_0x414b('0x26')]=0x0;writeDB(_0x299355);}});}catch(_0xc486d1){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x23'),_0x4c59b2['uniqueid']),_0xc486d1);}};exports[_0x414b('0x27')]=function(_0x37eec3){try{if(agents[_0x37eec3[_0x414b('0x13')]]){utils[_0x414b('0x11')](util['format'](_0x414b('0x28'),_0x37eec3[_0x414b('0xf')]),_0x37eec3);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x29'),_0x37eec3[_0x414b('0xf')],agents[_0x37eec3['destuniqueid']][_0x414b('0x6')],_0x37eec3['destuniqueid']));agents[_0x37eec3['destuniqueid']][_0x414b('0x2a')]=utils['now']();agents[_0x37eec3[_0x414b('0x13')]]['connectedlinenum']=_0x37eec3['connectedlinenum'];agents[_0x37eec3['destuniqueid']][_0x414b('0x2b')]=_0x37eec3[_0x414b('0x2b')];agents[_0x37eec3[_0x414b('0x13')]][_0x414b('0x1f')]=_0x37eec3[_0x414b('0x20')];agents[_0x37eec3[_0x414b('0x13')]][_0x414b('0x16')]='connect';_[_0x414b('0x2c')](agents,function(_0x4b53e7,_0x19e232){if(_0x4b53e7[_0x414b('0x13')]!=_0x37eec3['destuniqueid']&&_0x4b53e7[_0x414b('0xf')]==_0x37eec3['uniqueid']){_0x4b53e7[_0x414b('0x26')]=0x0;_0x4b53e7['holdtime']=_0x37eec3[_0x414b('0x20')];_0x4b53e7['agentringnoanswer']=!![];_0x4b53e7['agentringnoanswerAt']=utils[_0x414b('0x15')]();_0x4b53e7[_0x414b('0x16')]=_0x414b('0x2d');_0x4b53e7['reason']=_0x414b('0x2d');_0x4b53e7[_0x414b('0x2e')]=_0x37eec3['destuniqueid'];_0x4b53e7['answeredelsewheremembername']=_0x37eec3[_0x414b('0x6')];writeDB(_0x4b53e7);}});}}catch(_0x563e6f){utils['error'](util['format']('[%s][agents][agentconnect]',_0x37eec3['uniqueid']),_0x563e6f);}};exports[_0x414b('0x2f')]=function(_0x5df450){try{if(!_[_0x414b('0x19')](agents[_0x5df450[_0x414b('0x13')]])){utils[_0x414b('0x11')](util['format'](_0x414b('0x30'),_0x5df450[_0x414b('0xf')]),_0x5df450);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x31'),_0x5df450['uniqueid'],agents[_0x5df450['destuniqueid']]['membername'],_0x5df450[_0x414b('0x13')]));agents[_0x5df450[_0x414b('0x13')]]['agentcomplete']=!![];agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x32')]=utils[_0x414b('0x15')]();agents[_0x5df450[_0x414b('0x13')]]['talktime']=utils['diffTime'](agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x32')],agents[_0x5df450[_0x414b('0x13')]]['agentconnectAt']);agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x33')]=_0x5df450['reason'];agents[_0x5df450[_0x414b('0x13')]][_0x414b('0x16')]='complete';writeDB(agents[_0x5df450[_0x414b('0x13')]]);}}catch(_0xfa4e1f){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x30'),_0x5df450['uniqueid']),_0xfa4e1f);}};exports[_0x414b('0x34')]=function(_0x32674a){try{if(!_[_0x414b('0x19')](agents[_0x32674a[_0x414b('0x35')]])){utils[_0x414b('0x11')](util['format'](_0x414b('0x36'),_0x32674a[_0x414b('0xf')]),_0x32674a);utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x37'),_0x32674a[_0x414b('0xf')],agents[_0x32674a['transfereruniqueid']]['membername'],agents[_0x32674a[_0x414b('0x35')]][_0x414b('0xf')]));agents[_0x32674a[_0x414b('0x35')]]['transfer']=!![];agents[_0x32674a[_0x414b('0x35')]]['transfertype']='blind';agents[_0x32674a[_0x414b('0x35')]]['transferexten']=_0x32674a[_0x414b('0x38')];agents[_0x32674a['transfereruniqueid']][_0x414b('0x39')]=agents[_0x32674a[_0x414b('0x35')]][_0x414b('0xf')];}}catch(_0x1f9ccb){utils['error'](util['format']('[%s][agents][blindtransfer]',_0x32674a[_0x414b('0xf')]),_0x1f9ccb);}};exports[_0x414b('0x3a')]=function(_0x23cfba){try{utils[_0x414b('0x11')](util[_0x414b('0x3')]('[%s][agents][attendedtransfer]',_0x23cfba[_0x414b('0x3b')]),_0x23cfba);if(_0x23cfba[_0x414b('0x3b')]==_0x23cfba['origtransfererlinkedid']){if(!_[_0x414b('0x19')](agents[_0x23cfba[_0x414b('0x3c')]])){utils['info'](util[_0x414b('0x3')](_0x414b('0x3d'),_0x23cfba[_0x414b('0x3b')],agents[_0x23cfba['secondtransfereruniqueid']][_0x414b('0x6')]));agents[_0x23cfba[_0x414b('0x3c')]][_0x414b('0x3e')]=!![];agents[_0x23cfba[_0x414b('0x3c')]]['transfertype']=_0x414b('0x3f');agents[_0x23cfba[_0x414b('0x3c')]]['transferexten']=_0x23cfba[_0x414b('0x40')];agents[_0x23cfba[_0x414b('0x3c')]]['transferuniqueid']=_0x23cfba['origtransfereruniqueid'];}if(_0x23cfba[_0x414b('0x41')]&&agents[_0x23cfba[_0x414b('0x41')]]){agents[_0x23cfba['transfereeuniqueid']][_0x414b('0x42')]=0x1;transfers[_0x23cfba[_0x414b('0x41')]]=_[_0x414b('0x43')](agents[_0x23cfba[_0x414b('0x41')]]);transfers[_0x23cfba[_0x414b('0x41')]]['calleridnum']=agents[_0x23cfba[_0x414b('0x3c')]]['calleridnum'];transfers[_0x23cfba[_0x414b('0x41')]][_0x414b('0x44')]=agents[_0x23cfba['secondtransfereruniqueid']][_0x414b('0x44')];transfers[_0x23cfba[_0x414b('0x41')]][_0x414b('0x14')]=utils[_0x414b('0x15')]();transfers[_0x23cfba['transfereeuniqueid']]['agentconnectAt']=utils[_0x414b('0x15')]();transfers[_0x23cfba[_0x414b('0x41')]][_0x414b('0x1f')]=0x0;transfers[_0x23cfba['transfereeuniqueid']][_0x414b('0x42')]=0x2;}}else if(_0x23cfba['secondtransfereruniqueid']==_0x23cfba['secondtransfererlinkedid']){if(!_[_0x414b('0x19')](agents[_0x23cfba[_0x414b('0x3b')]])){utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x3d'),_0x23cfba[_0x414b('0x3b')],agents[_0x23cfba['origtransfereruniqueid']]['membername']));agents[_0x23cfba['origtransfereruniqueid']][_0x414b('0x3e')]=!![];agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x45')]=_0x414b('0x3f');agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x46')]=_0x23cfba[_0x414b('0x47')];agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x39')]=_0x23cfba[_0x414b('0x3c')];}if(_0x23cfba['transfertargetuniqueid']&&agents[_0x23cfba[_0x414b('0x48')]]){agents[_0x23cfba[_0x414b('0x48')]][_0x414b('0x42')]=0x1;transfers[_0x23cfba['transfertargetuniqueid']]=_[_0x414b('0x43')](agents[_0x23cfba['transfertargetuniqueid']]);transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x49')]=agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x49')];transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x44')]=agents[_0x23cfba[_0x414b('0x3b')]][_0x414b('0x44')];transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x14')]=utils['now']();transfers[_0x23cfba['transfertargetuniqueid']]['agentconnectAt']=utils[_0x414b('0x15')]();transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x1f')]=0x0;transfers[_0x23cfba[_0x414b('0x48')]][_0x414b('0x42')]=0x2;}}}catch(_0x20c328){utils['error'](util[_0x414b('0x3')](_0x414b('0x4a'),_0x23cfba[_0x414b('0x3b')]),_0x20c328);}};exports[_0x414b('0x4b')]=function(_0x49eb8c){try{utils[_0x414b('0x11')](util['format'](_0x414b('0x4c'),_0x49eb8c[_0x414b('0xf')]),_0x49eb8c);if(agents[_0x49eb8c[_0x414b('0xf')]]&&agents[_0x49eb8c['uniqueid']][_0x414b('0x33')]==='timeout'){if(_0x49eb8c[_0x414b('0x4d')]==='21'){agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')]=_0x414b('0x4e');agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]=_0x414b('0x4e');}utils[_0x414b('0x2')](util['format'](_0x414b('0x4f'),_0x49eb8c[_0x414b('0xf')],agents[_0x49eb8c[_0x414b('0xf')]]['membername'],agents[_0x49eb8c['uniqueid']][_0x414b('0x33')],agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]));writeDB(agents[_0x49eb8c[_0x414b('0xf')]]);var _0x2e4a7a=unanswered[_0x414b('0x50')](_0x49eb8c[_0x414b('0xf')]);if(_0x2e4a7a>-0x1){unanswered['splice'](_0x2e4a7a,0x1);}}if(transfers[_0x49eb8c[_0x414b('0xf')]]){transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x2f')]=!![];transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x32')]=utils[_0x414b('0x15')]();transfers[_0x49eb8c['uniqueid']][_0x414b('0x26')]=utils[_0x414b('0x51')](transfers[_0x49eb8c['uniqueid']]['agentcompleteAt'],transfers[_0x49eb8c[_0x414b('0xf')]]['agentconnectAt']);transfers[_0x49eb8c['uniqueid']][_0x414b('0x33')]=_0x414b('0x52');transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]=_0x414b('0x53');utils[_0x414b('0x2')](util[_0x414b('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x49eb8c[_0x414b('0xf')],transfers[_0x49eb8c['uniqueid']][_0x414b('0x6')],transfers[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')],transfers[_0x49eb8c['uniqueid']][_0x414b('0x16')]));writeDB(transfers[_0x49eb8c[_0x414b('0xf')]],!![]);}if(agents[_0x49eb8c[_0x414b('0xf')]]&&agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x2a')]){agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x2f')]=!![];agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x32')]=utils['now']();agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x26')]=utils[_0x414b('0x51')](agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x32')],agents[_0x49eb8c['uniqueid']][_0x414b('0x2a')]);agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')]=agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x3e')]?_0x414b('0x3e'):_0x414b('0x52');agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]='complete';utils[_0x414b('0x2')](util[_0x414b('0x3')](_0x414b('0x4f'),_0x49eb8c[_0x414b('0xf')],agents[_0x49eb8c[_0x414b('0xf')]]['membername'],agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x33')],agents[_0x49eb8c[_0x414b('0xf')]][_0x414b('0x16')]));writeDB(agents[_0x49eb8c[_0x414b('0xf')]]);}}catch(_0x47f9ba){utils[_0x414b('0x18')](util[_0x414b('0x3')](_0x414b('0x4c'),_0x49eb8c['uniqueid']),_0x47f9ba);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 5515b22..4fc8fbc 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 _0x1e3d=['mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','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-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','application','util','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]'];(function(_0x3c9e30,_0x4db9f9){var _0xbddb66=function(_0x4c8ad1){while(--_0x4c8ad1){_0x3c9e30['push'](_0x3c9e30['shift']());}};_0xbddb66(++_0x4db9f9);}(_0x1e3d,0x171));var _0xd1e3=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1e3d[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0xd1e3('0x0'));var utils=require('./utils');var dispositions=[_0xd1e3('0x1'),_0xd1e3('0x2'),_0xd1e3('0x2'),_0xd1e3('0x1'),_0xd1e3('0x1'),'NO\x20ANSWER',_0xd1e3('0x3'),'BUSY',_0xd1e3('0x2'),_0xd1e3('0x2'),_0xd1e3('0x2')];var channels={};function writeDB(_0xfcdee6){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x6'),_0xfcdee6[_0xd1e3('0x7')],_0xfcdee6[_0xd1e3('0x8')],_0xfcdee6[_0xd1e3('0x9')],_0xfcdee6[_0xd1e3('0xa')],_0xfcdee6[_0xd1e3('0xb')],_0xfcdee6[_0xd1e3('0xc')],_0xfcdee6[_0xd1e3('0xd')],_0xfcdee6['lastevent']));if(_0xfcdee6[_0xd1e3('0xe')]){utils[_0xd1e3('0xf')](_0xfcdee6['accountcode'])[_0xd1e3('0x10')](function(_0x5004f7){if(_0x5004f7){_0xfcdee6[_0xd1e3('0x11')]=_0x5004f7['id'];}utils[_0xd1e3('0x12')](_0xd1e3('0x13'),_0xfcdee6);});}else{utils[_0xd1e3('0x12')](_0xd1e3('0x13'),_0xfcdee6);}if(channels[_0xfcdee6[_0xd1e3('0x7')]]){delete channels[_0xfcdee6['uniqueid']];}}exports[_0xd1e3('0x14')]=function(_0x3aa925){try{utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x16'),_0x3aa925[_0xd1e3('0x7')]),_0x3aa925);if(_0x3aa925[_0xd1e3('0x7')]==_0x3aa925[_0xd1e3('0x17')]&&_0x3aa925['channel']!=_0xd1e3('0x18')){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3aa925[_0xd1e3('0x7')],_0x3aa925[_0xd1e3('0x19')],_0x3aa925[_0xd1e3('0x1a')]));channels[_0x3aa925[_0xd1e3('0x7')]]={'uniqueid':_0x3aa925[_0xd1e3('0x7')],'accountcode':_0x3aa925[_0xd1e3('0xe')],'source':_0x3aa925[_0xd1e3('0xc')],'destination':_0x3aa925['exten'],'destinationcontext':_0x3aa925['context'],'channel':_0x3aa925[_0xd1e3('0x8')],'starttime':utils[_0xd1e3('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd1e3('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x597989){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x16'),_0x3aa925['uniqueid']),_0x597989);}};exports[_0xd1e3('0x1d')]=function(_0x44b53e){try{utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x1e'),_0x44b53e[_0xd1e3('0x7')]),_0x44b53e);if(!_['isNil'](channels[_0x44b53e[_0xd1e3('0x7')]])&&_0x44b53e[_0xd1e3('0x1f')]==0x6){utils[_0xd1e3('0x4')](util['format'](_0xd1e3('0x20'),_0x44b53e['uniqueid'],_0x44b53e[_0xd1e3('0x19')],_0x44b53e['channel']));if(_[_0xd1e3('0x21')](channels[_0x44b53e[_0xd1e3('0x7')]][_0xd1e3('0x22')])){channels[_0x44b53e['uniqueid']]['systemanswertime']=utils[_0xd1e3('0x1b')]();}}else if(!_['isNil'](channels[_0x44b53e[_0xd1e3('0x17')]])&&_0x44b53e[_0xd1e3('0x1f')]==0x6&&_0x44b53e[_0xd1e3('0x19')]!=_0xd1e3('0x23')){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x24'),_0x44b53e[_0xd1e3('0x7')],_0x44b53e['linkedid'],_0x44b53e[_0xd1e3('0x19')],_0x44b53e[_0xd1e3('0x8')]));channels[_0x44b53e['linkedid']]['accountcode']=_0x44b53e['accountcode'];channels[_0x44b53e[_0xd1e3('0x17')]][_0xd1e3('0x25')]=_0x44b53e[_0xd1e3('0x8')];if(_[_0xd1e3('0x21')](channels[_0x44b53e[_0xd1e3('0x17')]][_0xd1e3('0x26')])){channels[_0x44b53e[_0xd1e3('0x17')]]['answertime']=utils['now']();}channels[_0x44b53e['linkedid']]['disposition']=dispositions[_[_0xd1e3('0x27')](_0x44b53e[_0xd1e3('0x1f')])]||'ANSWERED';}}catch(_0x359607){utils['error'](util[_0xd1e3('0x5')](_0xd1e3('0x1e'),_0x44b53e[_0xd1e3('0x7')]),_0x359607);}};exports['hangup']=function(_0x107f98){try{if(!_['isNil'](channels[_0x107f98[_0xd1e3('0x7')]])){utils[_0xd1e3('0x15')](util['format'](_0xd1e3('0x28'),_0x107f98[_0xd1e3('0x7')]),_0x107f98);if(_[_0xd1e3('0x21')](channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x29')])){channels[_0x107f98['uniqueid']][_0xd1e3('0x29')]=_0x107f98[_0xd1e3('0x2a')]+'\x20<'+_0x107f98[_0xd1e3('0xc')]+'>';}utils['info'](util[_0xd1e3('0x5')](_0xd1e3('0x2b'),_0x107f98[_0xd1e3('0x7')],channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x29')],_0x107f98[_0xd1e3('0x2c')]));channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x2d')]=utils['now']();channels[_0x107f98['uniqueid']][_0xd1e3('0x2e')]=utils[_0xd1e3('0x2f')](channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x2d')],channels[_0x107f98['uniqueid']][_0xd1e3('0x30')]);channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x31')]=channels[_0x107f98['uniqueid']]['answertime']?utils['diffTime'](channels[_0x107f98['uniqueid']][_0xd1e3('0x2d')],channels[_0x107f98[_0xd1e3('0x7')]][_0xd1e3('0x26')]):0x0;writeDB(channels[_0x107f98[_0xd1e3('0x7')]]);}}catch(_0x3179e1){utils['error'](util['format']('[%s][calls][hangup]',_0x107f98[_0xd1e3('0x7')]),_0x3179e1);}};exports['attendedtransfer']=function(_0x561d17){try{if(!_[_0xd1e3('0x21')](channels[_0x561d17[_0xd1e3('0x32')]])){utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x33'),_0x561d17[_0xd1e3('0x34')]),_0x561d17);if(channels[_0x561d17[_0xd1e3('0x32')]]['channel']==_0x561d17[_0xd1e3('0x35')]){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x561d17[_0xd1e3('0x34')],_0x561d17[_0xd1e3('0x32')],_0x561d17[_0xd1e3('0x36')]));channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x25')]=_0x561d17['secondtransfererchannel'];channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x37')]='_attended';}else if(channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x8')]=_0x561d17['transfertargetchannel']){utils['info'](util[_0xd1e3('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x561d17[_0xd1e3('0x34')],_0x561d17[_0xd1e3('0x32')],_0x561d17[_0xd1e3('0x38')]));channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x25')]=_0x561d17[_0xd1e3('0x38')];channels[_0x561d17[_0xd1e3('0x32')]][_0xd1e3('0x37')]='_attended';}}}catch(_0x5d8b34){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x33'),_0x561d17['origtransfereruniqueid']),_0x5d8b34);}};exports[_0xd1e3('0x39')]=function(_0x304ad0){try{if(!_['isNil'](channels[_0x304ad0['uniqueid']])){utils[_0xd1e3('0x15')](util['format']('[%s][calls][musiconholdstart]',_0x304ad0['uniqueid']),_0x304ad0);channels[_0x304ad0['uniqueid']][_0xd1e3('0x3a')]=utils[_0xd1e3('0x1b')]();utils['info'](util['format'](_0xd1e3('0x3b'),_0x304ad0[_0xd1e3('0x7')],channels[_0x304ad0['uniqueid']][_0xd1e3('0x3a')]));}}catch(_0x293b0d){utils[_0xd1e3('0x1c')](util['format'](_0xd1e3('0x3c'),_0x304ad0[_0xd1e3('0x7')]),_0x293b0d);}};exports[_0xd1e3('0x3d')]=function(_0x31a536){try{if(!_[_0xd1e3('0x21')](channels[_0x31a536['uniqueid']])){utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')](_0xd1e3('0x3e'),_0x31a536[_0xd1e3('0x7')]),_0x31a536);if(!_[_0xd1e3('0x21')](channels[_0x31a536['uniqueid']][_0xd1e3('0x3a')])){channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3f')]+=utils[_0xd1e3('0x2f')](utils['now'](),channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3a')]);utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x40'),_0x31a536['uniqueid'],channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3f')]));delete channels[_0x31a536[_0xd1e3('0x7')]][_0xd1e3('0x3a')];}}}catch(_0x57f1eb){utils[_0xd1e3('0x1c')](util['format'](_0xd1e3('0x3e'),_0x31a536[_0xd1e3('0x7')]),_0x57f1eb);}};exports[_0xd1e3('0x41')]=function(_0x196c5e){try{if(!_[_0xd1e3('0x21')](channels[_0x196c5e[_0xd1e3('0x7')]])){utils[_0xd1e3('0x15')](util[_0xd1e3('0x5')]('[%s][calls][varset]',_0x196c5e[_0xd1e3('0x7')]),_0x196c5e);if(!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x43')])){utils['info'](util[_0xd1e3('0x5')](_0xd1e3('0x44'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x46')]=_0x196c5e['value'];}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x47')])){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x48'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e['uniqueid']][_0xd1e3('0x49')]=_0x196c5e['value'];channels[_0x196c5e['uniqueid']][_0xd1e3('0x29')]='\x22'+_0x196c5e[_0xd1e3('0x45')]+_0xd1e3('0x4a')+_0x196c5e['value']+'>';}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4b')])||!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4c')])){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x4d'),_0x196c5e[_0xd1e3('0x7')],!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4b')])?_0xd1e3('0x4b'):_0xd1e3('0x4c'),_0x196c5e['value']));channels[_0x196c5e['uniqueid']][_0xd1e3('0x29')]=_0x196c5e['value'];}if(!_[_0xd1e3('0x21')](_0x196c5e['variable']['xmd-queue'])||!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x4e')])){utils['info'](util['format'](_0xd1e3('0x4d'),_0x196c5e[_0xd1e3('0x7')],!_['isNil'](_0x196c5e[_0xd1e3('0x42')]['xmd-queue'])?'xmd-queue':_0xd1e3('0x4e'),_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x4f')]=_0xd1e3('0x50');channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x51')]=_0x196c5e[_0xd1e3('0x45')];channels[_0x196c5e['uniqueid']][_0xd1e3('0x9')]=!![];}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x52')])){utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x53'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x54')]=_0x196c5e[_0xd1e3('0x45')];}if(!_[_0xd1e3('0x21')](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x55')])){utils[_0xd1e3('0x4')](util['format'](_0xd1e3('0x56'),_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x57')]=_0x196c5e[_0xd1e3('0x45')];}if(!_['isNil'](_0x196c5e[_0xd1e3('0x42')][_0xd1e3('0x58')])){utils['info'](util[_0xd1e3('0x5')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x196c5e['uniqueid'],_0x196c5e['value']));channels[_0x196c5e[_0xd1e3('0x7')]][_0xd1e3('0x59')]=_0x196c5e[_0xd1e3('0x45')];}if(!_['isNil'](_0x196c5e['variable'][_0xd1e3('0x5a')])){utils['info'](util[_0xd1e3('0x5')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x196c5e[_0xd1e3('0x7')],_0x196c5e[_0xd1e3('0x45')]));channels[_0x196c5e[_0xd1e3('0x7')]]['sipcallid']=_0x196c5e[_0xd1e3('0x45')];}}}catch(_0x47fce4){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x5b'),_0x196c5e['uniqueid']),_0x47fce4);}};exports[_0xd1e3('0x5c')]=function(_0x3c8a97){try{if(!_['isNil'](channels[_0x3c8a97['uniqueid']])){utils[_0xd1e3('0x15')](util['format'](_0xd1e3('0x5d'),_0x3c8a97[_0xd1e3('0x7')]),_0x3c8a97);utils[_0xd1e3('0x4')](util[_0xd1e3('0x5')](_0xd1e3('0x5e'),_0x3c8a97[_0xd1e3('0x7')],_0x3c8a97['application'],_0x3c8a97['appdata']));if(_0x3c8a97['application'][_0xd1e3('0x5f')]()==_0xd1e3('0x60')&&_[_0xd1e3('0x61')](_0x3c8a97[_0xd1e3('0x62')]['toLowerCase'](),'cdr')){var _0x42e9fe=_0x3c8a97[_0xd1e3('0x62')][_0xd1e3('0x63')]('=');var _0x19707d=_0x42e9fe[0x0][_0xd1e3('0x64')](_0x42e9fe[0x0][_0xd1e3('0x65')]('(')+0x1,_0x42e9fe[0x0][_0xd1e3('0x65')](')'));var _0x267637=_0x42e9fe[0x1];channels[_0x3c8a97[_0xd1e3('0x7')]][_0x19707d]=_0x267637;}if(!_[_0xd1e3('0x66')]([_0xd1e3('0x67'),_0xd1e3('0x68'),_0xd1e3('0x69'),_0xd1e3('0x60'),_0xd1e3('0x6a')],_0x3c8a97['application'][_0xd1e3('0x5f')]())){channels[_0x3c8a97[_0xd1e3('0x7')]][_0xd1e3('0x4f')]=_0x3c8a97[_0xd1e3('0x6b')];channels[_0x3c8a97[_0xd1e3('0x7')]][_0xd1e3('0x51')]=_0x3c8a97[_0xd1e3('0x62')];}}}catch(_0x335e16){utils[_0xd1e3('0x1c')](util[_0xd1e3('0x5')](_0xd1e3('0x5d'),_0x3c8a97[_0xd1e3('0x7')]),_0x335e16);}}; \ No newline at end of file +var _0x5129=['ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','gotoif','lastdata','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','diffTime','billableseconds','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-phone','value','destination','\x22\x20<','xmd-callerid-preview','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','xmd-contactid'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5129,0x1b2));var _0x9512=function(_0x35ad2a,_0x3dcca){_0x35ad2a=_0x35ad2a-0x0;var _0x4b618a=_0x5129[_0x35ad2a];return _0x4b618a;};'use strict';var _=require(_0x9512('0x0'));var util=require(_0x9512('0x1'));var utils=require('./utils');var dispositions=[_0x9512('0x2'),_0x9512('0x3'),_0x9512('0x3'),'NO\x20ANSWER',_0x9512('0x2'),'NO\x20ANSWER',_0x9512('0x4'),_0x9512('0x5'),'FAILED',_0x9512('0x3'),_0x9512('0x3')];var channels={};function writeDB(_0x5cafc5){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x8'),_0x5cafc5[_0x9512('0x9')],_0x5cafc5[_0x9512('0xa')],_0x5cafc5[_0x9512('0xb')],_0x5cafc5[_0x9512('0xc')],_0x5cafc5[_0x9512('0xd')],_0x5cafc5[_0x9512('0xe')],_0x5cafc5[_0x9512('0xf')],_0x5cafc5['lastevent']));if(_0x5cafc5[_0x9512('0x10')]){utils['getUserByInternal'](_0x5cafc5[_0x9512('0x10')])[_0x9512('0x11')](function(_0x402a2e){if(_0x402a2e){_0x5cafc5[_0x9512('0x12')]=_0x402a2e['id'];}utils[_0x9512('0x13')](_0x9512('0x14'),_0x5cafc5);});}else{utils[_0x9512('0x13')](_0x9512('0x14'),_0x5cafc5);}if(channels[_0x5cafc5['uniqueid']]){delete channels[_0x5cafc5['uniqueid']];}}exports[_0x9512('0x15')]=function(_0x4e8db9){try{utils['debug'](util[_0x9512('0x7')](_0x9512('0x16'),_0x4e8db9['uniqueid']),_0x4e8db9);if(_0x4e8db9[_0x9512('0x9')]==_0x4e8db9[_0x9512('0x17')]&&_0x4e8db9[_0x9512('0xa')]!=_0x9512('0x18')){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x19'),_0x4e8db9[_0x9512('0x9')],_0x4e8db9[_0x9512('0x1a')],_0x4e8db9[_0x9512('0x1b')]));channels[_0x4e8db9[_0x9512('0x9')]]={'uniqueid':_0x4e8db9[_0x9512('0x9')],'accountcode':_0x4e8db9[_0x9512('0x10')],'source':_0x4e8db9[_0x9512('0xe')],'destination':_0x4e8db9['exten'],'destinationcontext':_0x4e8db9[_0x9512('0x1a')],'channel':_0x4e8db9[_0x9512('0xa')],'starttime':utils[_0x9512('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9512('0x2'),'amaflags':_0x9512('0x1d')};}}catch(_0x22f18a){utils[_0x9512('0x1e')](util[_0x9512('0x7')]('[%s][calls][newchannel]',_0x4e8db9[_0x9512('0x9')]),_0x22f18a);}};exports[_0x9512('0x1f')]=function(_0x3510fe){try{utils[_0x9512('0x20')](util['format'](_0x9512('0x21'),_0x3510fe[_0x9512('0x9')]),_0x3510fe);if(!_[_0x9512('0x22')](channels[_0x3510fe[_0x9512('0x9')]])&&_0x3510fe['channelstate']==0x6){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3510fe[_0x9512('0x9')],_0x3510fe[_0x9512('0x1a')],_0x3510fe[_0x9512('0xa')]));if(_['isNil'](channels[_0x3510fe[_0x9512('0x9')]][_0x9512('0x23')])){channels[_0x3510fe[_0x9512('0x9')]][_0x9512('0x23')]=utils[_0x9512('0x1c')]();}}else if(!_['isNil'](channels[_0x3510fe[_0x9512('0x17')]])&&_0x3510fe[_0x9512('0x24')]==0x6&&_0x3510fe['context']!='transfer'){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x25'),_0x3510fe[_0x9512('0x9')],_0x3510fe[_0x9512('0x17')],_0x3510fe[_0x9512('0x1a')],_0x3510fe[_0x9512('0xa')]));channels[_0x3510fe['linkedid']][_0x9512('0x10')]=_0x3510fe[_0x9512('0x10')];channels[_0x3510fe[_0x9512('0x17')]][_0x9512('0x26')]=_0x3510fe[_0x9512('0xa')];if(_['isNil'](channels[_0x3510fe[_0x9512('0x17')]]['answertime'])){channels[_0x3510fe['linkedid']][_0x9512('0x27')]=utils[_0x9512('0x1c')]();}channels[_0x3510fe['linkedid']]['disposition']=dispositions[_[_0x9512('0x28')](_0x3510fe[_0x9512('0x24')])]||_0x9512('0x4');}}catch(_0x368279){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x21'),_0x3510fe[_0x9512('0x9')]),_0x368279);}};exports[_0x9512('0x29')]=function(_0x1e9716){try{if(!_[_0x9512('0x22')](channels[_0x1e9716['uniqueid']])){utils['debug'](util[_0x9512('0x7')](_0x9512('0x2a'),_0x1e9716[_0x9512('0x9')]),_0x1e9716);if(_[_0x9512('0x22')](channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x2b')])){channels[_0x1e9716[_0x9512('0x9')]]['callerid']=_0x1e9716[_0x9512('0x2c')]+'\x20<'+_0x1e9716[_0x9512('0xe')]+'>';}utils[_0x9512('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1e9716[_0x9512('0x9')],channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x2b')],_0x1e9716[_0x9512('0x2d')]));channels[_0x1e9716[_0x9512('0x9')]]['endtime']=utils['now']();channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x2e')]=utils[_0x9512('0x2f')](channels[_0x1e9716[_0x9512('0x9')]]['endtime'],channels[_0x1e9716['uniqueid']]['starttime']);channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x30')]=channels[_0x1e9716[_0x9512('0x9')]][_0x9512('0x27')]?utils[_0x9512('0x2f')](channels[_0x1e9716[_0x9512('0x9')]]['endtime'],channels[_0x1e9716['uniqueid']][_0x9512('0x27')]):0x0;writeDB(channels[_0x1e9716[_0x9512('0x9')]]);}}catch(_0x53efa0){utils[_0x9512('0x1e')](util['format'](_0x9512('0x2a'),_0x1e9716[_0x9512('0x9')]),_0x53efa0);}};exports['attendedtransfer']=function(_0x2bb1bf){try{if(!_[_0x9512('0x22')](channels[_0x2bb1bf['localtwolinkedid']])){utils['debug'](util[_0x9512('0x7')](_0x9512('0x31'),_0x2bb1bf['origtransfereruniqueid']),_0x2bb1bf);if(channels[_0x2bb1bf[_0x9512('0x32')]]['channel']==_0x2bb1bf[_0x9512('0x33')]){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x34'),_0x2bb1bf[_0x9512('0x35')],_0x2bb1bf[_0x9512('0x32')],_0x2bb1bf['secondtransfererchannel']));channels[_0x2bb1bf[_0x9512('0x32')]]['destinationchannel']=_0x2bb1bf[_0x9512('0x36')];channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0x37')]=_0x9512('0x38');}else if(channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0xa')]=_0x2bb1bf[_0x9512('0x39')]){utils[_0x9512('0x6')](util['format'](_0x9512('0x34'),_0x2bb1bf[_0x9512('0x35')],_0x2bb1bf['localtwolinkedid'],_0x2bb1bf[_0x9512('0x3a')]));channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0x26')]=_0x2bb1bf[_0x9512('0x3a')];channels[_0x2bb1bf[_0x9512('0x32')]][_0x9512('0x37')]=_0x9512('0x38');}}}catch(_0x3cc5ca){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x31'),_0x2bb1bf['origtransfereruniqueid']),_0x3cc5ca);}};exports['musiconholdstart']=function(_0x30307d){try{if(!_['isNil'](channels[_0x30307d[_0x9512('0x9')]])){utils[_0x9512('0x20')](util[_0x9512('0x7')](_0x9512('0x3b'),_0x30307d[_0x9512('0x9')]),_0x30307d);channels[_0x30307d[_0x9512('0x9')]][_0x9512('0x3c')]=utils[_0x9512('0x1c')]();utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x3d'),_0x30307d[_0x9512('0x9')],channels[_0x30307d[_0x9512('0x9')]]['musiconholdstartAt']));}}catch(_0x53780f){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x3b'),_0x30307d['uniqueid']),_0x53780f);}};exports[_0x9512('0x3e')]=function(_0x1dd602){try{if(!_['isNil'](channels[_0x1dd602['uniqueid']])){utils[_0x9512('0x20')](util[_0x9512('0x7')]('[%s][calls][musiconholdstop]',_0x1dd602[_0x9512('0x9')]),_0x1dd602);if(!_['isNil'](channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3c')])){channels[_0x1dd602[_0x9512('0x9')]]['mohtime']+=utils[_0x9512('0x2f')](utils[_0x9512('0x1c')](),channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3c')]);utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1dd602[_0x9512('0x9')],channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3f')]));delete channels[_0x1dd602[_0x9512('0x9')]][_0x9512('0x3c')];}}}catch(_0x40376f){utils[_0x9512('0x1e')](util[_0x9512('0x7')](_0x9512('0x40'),_0x1dd602[_0x9512('0x9')]),_0x40376f);}};exports[_0x9512('0x41')]=function(_0xcaf2cc){try{if(!_['isNil'](channels[_0xcaf2cc[_0x9512('0x9')]])){utils[_0x9512('0x20')](util[_0x9512('0x7')]('[%s][calls][varset]',_0xcaf2cc[_0x9512('0x9')]),_0xcaf2cc);if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x42')])){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x43'),_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc['value']));channels[_0xcaf2cc['uniqueid']]['source']=_0xcaf2cc['value'];}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x44')])){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc['uniqueid']][_0x9512('0x46')]=_0xcaf2cc['value'];channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x2b')]='\x22'+_0xcaf2cc[_0x9512('0x45')]+_0x9512('0x47')+_0xcaf2cc[_0x9512('0x45')]+'>';}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x48')])||!_['isNil'](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x4a')])){utils[_0x9512('0x6')](util['format'](_0x9512('0x4b'),_0xcaf2cc[_0x9512('0x9')],!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x48')])?'xmd-callerid-preview':'xmd-callerid',_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x2b')]=_0xcaf2cc[_0x9512('0x45')];}if(!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')]['xmd-queue'])||!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x4c')])){utils[_0x9512('0x6')](util['format'](_0x9512('0x4b'),_0xcaf2cc[_0x9512('0x9')],!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x4d')])?_0x9512('0x4d'):_0x9512('0x4c'),_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x4e')]=_0x9512('0x4f');channels[_0xcaf2cc['uniqueid']]['lastdata']=_0xcaf2cc[_0x9512('0x45')];channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0xb')]=!![];}if(!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x50')])){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xcaf2cc['uniqueid'],_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x51')]=_0xcaf2cc['value'];}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x52')])){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x53'),_0xcaf2cc['uniqueid'],_0xcaf2cc['value']));channels[_0xcaf2cc['uniqueid']]['type']=_0xcaf2cc['value'];}if(!_[_0x9512('0x22')](_0xcaf2cc['variable'][_0x9512('0x54')])){utils[_0x9512('0x6')](util[_0x9512('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc[_0x9512('0x45')]));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x55')]=_0xcaf2cc[_0x9512('0x45')];}if(!_[_0x9512('0x22')](_0xcaf2cc[_0x9512('0x49')][_0x9512('0x56')])){utils[_0x9512('0x6')](util[_0x9512('0x7')](_0x9512('0x57'),_0xcaf2cc[_0x9512('0x9')],_0xcaf2cc['value']));channels[_0xcaf2cc[_0x9512('0x9')]][_0x9512('0x56')]=_0xcaf2cc[_0x9512('0x45')];}}}catch(_0x55686c){utils[_0x9512('0x1e')](util[_0x9512('0x7')]('[%s][calls][varset]',_0xcaf2cc[_0x9512('0x9')]),_0x55686c);}};exports[_0x9512('0x58')]=function(_0x1f00a4){try{if(!_['isNil'](channels[_0x1f00a4[_0x9512('0x9')]])){utils['debug'](util[_0x9512('0x7')](_0x9512('0x59'),_0x1f00a4['uniqueid']),_0x1f00a4);utils['info'](util[_0x9512('0x7')](_0x9512('0x5a'),_0x1f00a4[_0x9512('0x9')],_0x1f00a4[_0x9512('0x5b')],_0x1f00a4['appdata']));if(_0x1f00a4[_0x9512('0x5b')][_0x9512('0x5c')]()==_0x9512('0x5d')&&_[_0x9512('0x5e')](_0x1f00a4[_0x9512('0x5f')][_0x9512('0x5c')](),_0x9512('0x60'))){var _0x4a7a2c=_0x1f00a4[_0x9512('0x5f')]['split']('=');var _0x221ef4=_0x4a7a2c[0x0][_0x9512('0x61')](_0x4a7a2c[0x0][_0x9512('0x62')]('(')+0x1,_0x4a7a2c[0x0][_0x9512('0x62')](')'));var _0x401556=_0x4a7a2c[0x1];channels[_0x1f00a4[_0x9512('0x9')]][_0x221ef4]=_0x401556;}if(!_[_0x9512('0x63')]([_0x9512('0x29'),_0x9512('0x64'),'execif',_0x9512('0x5d'),_0x9512('0x65')],_0x1f00a4['application']['toLowerCase']())){channels[_0x1f00a4[_0x9512('0x9')]]['lastapplication']=_0x1f00a4[_0x9512('0x5b')];channels[_0x1f00a4[_0x9512('0x9')]][_0x9512('0x66')]=_0x1f00a4[_0x9512('0x5f')];}}}catch(_0x18bfa8){utils['error'](util[_0x9512('0x7')](_0x9512('0x59'),_0x1f00a4[_0x9512('0x9')]),_0x18bfa8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index fa57044..d5fff9b 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 _0x0f95=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect','info','[core]\x20connected'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f95,0xfa));var _0x50f9=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0x0f95[_0x3d13bb];return _0x4b5a1b;};'use strict';var utils=require('./utils');exports[_0x50f9('0x0')]=function(){utils[_0x50f9('0x1')](_0x50f9('0x2'));};exports[_0x50f9('0x3')]=function(){utils[_0x50f9('0x1')](_0x50f9('0x4'));};exports[_0x50f9('0x5')]=function(){utils[_0x50f9('0x1')](_0x50f9('0x6'));};exports[_0x50f9('0x7')]=function(_0x36cab2){utils['error'](_0x50f9('0x8'),_0x36cab2);};exports[_0x50f9('0x9')]=function(){utils[_0x50f9('0x1')]('[core]\x20close');};exports[_0x50f9('0xa')]=function(_0x3f8317){}; \ No newline at end of file +var _0xb4c7=['[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','[core]\x20connected','shutdown','info'];(function(_0x5df0af,_0x5ecc92){var _0x1ce467=function(_0x32cf3c){while(--_0x32cf3c){_0x5df0af['push'](_0x5df0af['shift']());}};_0x1ce467(++_0x5ecc92);}(_0xb4c7,0x7e));var _0x7b4c=function(_0x5f4483,_0x346fbb){_0x5f4483=_0x5f4483-0x0;var _0x315e80=_0xb4c7[_0x5f4483];return _0x315e80;};'use strict';var utils=require(_0x7b4c('0x0'));exports['connect']=function(){utils['info'](_0x7b4c('0x1'));};exports[_0x7b4c('0x2')]=function(){utils[_0x7b4c('0x3')](_0x7b4c('0x4'));};exports[_0x7b4c('0x5')]=function(){utils[_0x7b4c('0x3')]('[core]\x20fullybooted');};exports[_0x7b4c('0x6')]=function(_0xa31892){utils[_0x7b4c('0x6')](_0x7b4c('0x7'),_0xa31892);};exports[_0x7b4c('0x8')]=function(){utils['info'](_0x7b4c('0x9'));};exports['managerevent']=function(_0x234345){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d99fcab..f8e039c 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 _0xdfcf=['[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','error','varset','isNil','variable','outboundrouteid','info','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','duration','diffTime','endtime','holdtime','./utils','format','channel','calleridnum','newexten','debug','[%s][dials][newexten]','uniqueid'];(function(_0x8e094c,_0x3bcd7f){var _0x3c0374=function(_0x5f1e9a){while(--_0x5f1e9a){_0x8e094c['push'](_0x8e094c['shift']());}};_0x3c0374(++_0x3bcd7f);}(_0xdfcf,0x73));var _0xfdfc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdfcf[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xfdfc('0x0'));var dials={};function writeDB(_0x2f94af){utils['info'](util[_0xfdfc('0x1')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2f94af['uniqueid'],_0x2f94af[_0xfdfc('0x2')],_0x2f94af['dialstring'],_0x2f94af[_0xfdfc('0x3')],_0x2f94af['connectedlinenum'],_0x2f94af['dialstatus']));utils['request']('CreateVoiceDialReport',_0x2f94af);delete dials[_0x2f94af['uniqueid']];}exports[_0xfdfc('0x4')]=function(_0x36fa7d){try{utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')](_0xfdfc('0x6'),_0x36fa7d[_0xfdfc('0x7')]),_0x36fa7d);utils['info'](util[_0xfdfc('0x1')](_0xfdfc('0x8'),_0x36fa7d[_0xfdfc('0x7')],_0x36fa7d[_0xfdfc('0x9')],_0x36fa7d[_0xfdfc('0xa')]));if(_0x36fa7d[_0xfdfc('0x9')][_0xfdfc('0xb')]()=='set'&&_[_0xfdfc('0xc')](_0x36fa7d[_0xfdfc('0xa')]['toLowerCase'](),'cdr(routeid)')){var _0x2337bc=_0x36fa7d[_0xfdfc('0xa')][_0xfdfc('0xd')]('=');dials[_0x36fa7d[_0xfdfc('0x7')]]={'routeId':_0x2337bc[0x1]};}}catch(_0x253bf1){utils[_0xfdfc('0xe')](util[_0xfdfc('0x1')](_0xfdfc('0x6'),_0x36fa7d[_0xfdfc('0x7')]),_0x253bf1);}};exports[_0xfdfc('0xf')]=function(_0x527f5e){try{utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')]('[%s][dials][varset]',_0x527f5e['uniqueid']),_0x527f5e);if(!_[_0xfdfc('0x10')](_0x527f5e[_0xfdfc('0x11')][_0xfdfc('0x12')])){utils[_0xfdfc('0x13')](util[_0xfdfc('0x1')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x527f5e[_0xfdfc('0x7')],_0x527f5e[_0xfdfc('0x14')]));dials[_0x527f5e[_0xfdfc('0x7')]]={'routeId':_0x527f5e['value']};}}catch(_0x24e701){utils[_0xfdfc('0xe')](util[_0xfdfc('0x1')]('[%s][dials][varset]',_0x527f5e[_0xfdfc('0x7')]),_0x24e701);}};exports['dialbegin']=function(_0x55438f){try{if(!_[_0xfdfc('0x10')](dials[_0x55438f['uniqueid']])){utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')](_0xfdfc('0x15'),_0x55438f[_0xfdfc('0x7')]),_0x55438f);dials[_0x55438f[_0xfdfc('0x7')]]=_[_0xfdfc('0x16')](dials[_0x55438f['uniqueid']],_0x55438f);dials[_0x55438f['uniqueid']][_0xfdfc('0x17')]=utils[_0xfdfc('0x18')]();dials[_0x55438f['uniqueid']][_0xfdfc('0x19')]=_0xfdfc('0x1a');utils[_0xfdfc('0x13')](util['format'](_0xfdfc('0x1b'),_0x55438f[_0xfdfc('0x7')],dials[_0x55438f[_0xfdfc('0x7')]][_0xfdfc('0x17')]));}}catch(_0x41ebc2){utils[_0xfdfc('0xe')](util[_0xfdfc('0x1')](_0xfdfc('0x15'),_0x55438f['uniqueid']),_0x41ebc2);}};exports[_0xfdfc('0x1c')]=function(_0x395dd9){try{if(!_[_0xfdfc('0x10')](dials[_0x395dd9['uniqueid']])){utils['debug'](util[_0xfdfc('0x1')](_0xfdfc('0x1d'),_0x395dd9[_0xfdfc('0x7')]),_0x395dd9);dials[_0x395dd9[_0xfdfc('0x7')]][_0xfdfc('0x1e')]=_0x395dd9['dialstatus'];if(_0x395dd9['dialstatus']==_0xfdfc('0x1f')){dials[_0x395dd9[_0xfdfc('0x7')]]=_['assign'](dials[_0x395dd9[_0xfdfc('0x7')]],_0x395dd9);dials[_0x395dd9[_0xfdfc('0x7')]][_0xfdfc('0x20')]=utils[_0xfdfc('0x18')]();dials[_0x395dd9[_0xfdfc('0x7')]]['lastevent']='connect';utils['info'](util[_0xfdfc('0x1')](_0xfdfc('0x21'),_0x395dd9[_0xfdfc('0x7')],_0x395dd9[_0xfdfc('0x1e')],dials[_0x395dd9[_0xfdfc('0x7')]][_0xfdfc('0x20')]));}else{utils[_0xfdfc('0x13')](util['format'](_0xfdfc('0x22'),_0x395dd9[_0xfdfc('0x7')],_0x395dd9['dialstatus']));}}}catch(_0x4764a8){utils['error'](util['format']('[%s][dials][dialend]',_0x395dd9['uniqueid']),_0x4764a8);}};exports['hangup']=function(_0x3e778a){try{if(!_[_0xfdfc('0x10')](dials[_0x3e778a[_0xfdfc('0x7')]])){utils[_0xfdfc('0x5')](util[_0xfdfc('0x1')](_0xfdfc('0x23'),_0x3e778a[_0xfdfc('0x7')]),_0x3e778a);utils[_0xfdfc('0x13')](util[_0xfdfc('0x1')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3e778a['uniqueid'],_0x3e778a[_0xfdfc('0x3')],_0x3e778a[_0xfdfc('0x24')],_0x3e778a['cause-txt']));dials[_0x3e778a['uniqueid']]=_[_0xfdfc('0x16')](dials[_0x3e778a[_0xfdfc('0x7')]],{'endtime':utils[_0xfdfc('0x18')](),'lastevent':'complete'});dials[_0x3e778a['uniqueid']][_0xfdfc('0x25')]=utils[_0xfdfc('0x26')](dials[_0x3e778a[_0xfdfc('0x7')]][_0xfdfc('0x27')],dials[_0x3e778a['uniqueid']][_0xfdfc('0x17')]);dials[_0x3e778a['uniqueid']][_0xfdfc('0x28')]=utils[_0xfdfc('0x26')](dials[_0x3e778a['uniqueid']][_0xfdfc('0x20')]||dials[_0x3e778a[_0xfdfc('0x7')]]['endtime'],dials[_0x3e778a[_0xfdfc('0x7')]]['starttime']);dials[_0x3e778a[_0xfdfc('0x7')]]['billableseconds']=dials[_0x3e778a[_0xfdfc('0x7')]][_0xfdfc('0x20')]?utils[_0xfdfc('0x26')](dials[_0x3e778a[_0xfdfc('0x7')]][_0xfdfc('0x27')],dials[_0x3e778a[_0xfdfc('0x7')]]['answertime']):0x0;writeDB(dials[_0x3e778a['uniqueid']]);}}catch(_0x11c6b7){utils['error'](util[_0xfdfc('0x1')](_0xfdfc('0x23'),_0x3e778a[_0xfdfc('0x7')]),_0x11c6b7);}}; \ No newline at end of file +var _0x30ae=['answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','billableseconds','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','format','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','error','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','assign'];(function(_0x2fb2d6,_0x1b28c1){var _0x1600df=function(_0xdfae86){while(--_0xdfae86){_0x2fb2d6['push'](_0x2fb2d6['shift']());}};_0x1600df(++_0x1b28c1);}(_0x30ae,0x1b4));var _0xe30a=function(_0x4c8ed4,_0x109424){_0x4c8ed4=_0x4c8ed4-0x0;var _0x1ed21d=_0x30ae[_0x4c8ed4];return _0x1ed21d;};'use strict';var _=require(_0xe30a('0x0'));var util=require('util');var utils=require(_0xe30a('0x1'));var dials={};function writeDB(_0x23ee19){utils[_0xe30a('0x2')](util['format'](_0xe30a('0x3'),_0x23ee19[_0xe30a('0x4')],_0x23ee19[_0xe30a('0x5')],_0x23ee19[_0xe30a('0x6')],_0x23ee19[_0xe30a('0x7')],_0x23ee19[_0xe30a('0x8')],_0x23ee19[_0xe30a('0x9')]));utils[_0xe30a('0xa')](_0xe30a('0xb'),_0x23ee19);delete dials[_0x23ee19[_0xe30a('0x4')]];}exports[_0xe30a('0xc')]=function(_0x5563cf){try{utils[_0xe30a('0xd')](util['format'](_0xe30a('0xe'),_0x5563cf[_0xe30a('0x4')]),_0x5563cf);utils['info'](util['format'](_0xe30a('0xf'),_0x5563cf[_0xe30a('0x4')],_0x5563cf[_0xe30a('0x10')],_0x5563cf[_0xe30a('0x11')]));if(_0x5563cf[_0xe30a('0x10')][_0xe30a('0x12')]()==_0xe30a('0x13')&&_['startsWith'](_0x5563cf[_0xe30a('0x11')][_0xe30a('0x12')](),'cdr(routeid)')){var _0x2e7c04=_0x5563cf[_0xe30a('0x11')][_0xe30a('0x14')]('=');dials[_0x5563cf[_0xe30a('0x4')]]={'routeId':_0x2e7c04[0x1]};}}catch(_0x28a716){utils['error'](util[_0xe30a('0x15')]('[%s][dials][newexten]',_0x5563cf[_0xe30a('0x4')]),_0x28a716);}};exports[_0xe30a('0x16')]=function(_0x4e0ea2){try{utils[_0xe30a('0xd')](util['format'](_0xe30a('0x17'),_0x4e0ea2[_0xe30a('0x4')]),_0x4e0ea2);if(!_[_0xe30a('0x18')](_0x4e0ea2[_0xe30a('0x19')][_0xe30a('0x1a')])){utils[_0xe30a('0x2')](util['format'](_0xe30a('0x1b'),_0x4e0ea2[_0xe30a('0x4')],_0x4e0ea2[_0xe30a('0x1c')]));dials[_0x4e0ea2['uniqueid']]={'routeId':_0x4e0ea2[_0xe30a('0x1c')]};}}catch(_0x3a4d5a){utils['error'](util['format']('[%s][dials][varset]',_0x4e0ea2[_0xe30a('0x4')]),_0x3a4d5a);}};exports[_0xe30a('0x1d')]=function(_0x45db68){try{if(!_[_0xe30a('0x18')](dials[_0x45db68[_0xe30a('0x4')]])){utils[_0xe30a('0xd')](util['format']('[%s][dials][dialbegin]',_0x45db68[_0xe30a('0x4')]),_0x45db68);dials[_0x45db68[_0xe30a('0x4')]]=_['assign'](dials[_0x45db68['uniqueid']],_0x45db68);dials[_0x45db68[_0xe30a('0x4')]]['starttime']=utils[_0xe30a('0x1e')]();dials[_0x45db68['uniqueid']][_0xe30a('0x1f')]=_0xe30a('0x20');utils[_0xe30a('0x2')](util[_0xe30a('0x15')](_0xe30a('0x21'),_0x45db68['uniqueid'],dials[_0x45db68[_0xe30a('0x4')]][_0xe30a('0x22')]));}}catch(_0x10afd0){utils[_0xe30a('0x23')](util[_0xe30a('0x15')](_0xe30a('0x24'),_0x45db68[_0xe30a('0x4')]),_0x10afd0);}};exports[_0xe30a('0x25')]=function(_0x48c442){try{if(!_['isNil'](dials[_0x48c442['uniqueid']])){utils[_0xe30a('0xd')](util[_0xe30a('0x15')](_0xe30a('0x26'),_0x48c442[_0xe30a('0x4')]),_0x48c442);dials[_0x48c442[_0xe30a('0x4')]][_0xe30a('0x9')]=_0x48c442[_0xe30a('0x9')];if(_0x48c442[_0xe30a('0x9')]==_0xe30a('0x27')){dials[_0x48c442[_0xe30a('0x4')]]=_[_0xe30a('0x28')](dials[_0x48c442[_0xe30a('0x4')]],_0x48c442);dials[_0x48c442[_0xe30a('0x4')]][_0xe30a('0x29')]=utils[_0xe30a('0x1e')]();dials[_0x48c442[_0xe30a('0x4')]][_0xe30a('0x1f')]=_0xe30a('0x2a');utils[_0xe30a('0x2')](util[_0xe30a('0x15')](_0xe30a('0x2b'),_0x48c442[_0xe30a('0x4')],_0x48c442[_0xe30a('0x9')],dials[_0x48c442['uniqueid']]['answertime']));}else{utils['info'](util[_0xe30a('0x15')]('[%s][dials][dialend]\x20dialstatus:%s',_0x48c442[_0xe30a('0x4')],_0x48c442['dialstatus']));}}}catch(_0x214a5f){utils['error'](util[_0xe30a('0x15')](_0xe30a('0x26'),_0x48c442[_0xe30a('0x4')]),_0x214a5f);}};exports[_0xe30a('0x2c')]=function(_0x21bd78){try{if(!_['isNil'](dials[_0x21bd78[_0xe30a('0x4')]])){utils[_0xe30a('0xd')](util[_0xe30a('0x15')](_0xe30a('0x2d'),_0x21bd78[_0xe30a('0x4')]),_0x21bd78);utils[_0xe30a('0x2')](util['format'](_0xe30a('0x2e'),_0x21bd78[_0xe30a('0x4')],_0x21bd78[_0xe30a('0x7')],_0x21bd78[_0xe30a('0x2f')],_0x21bd78[_0xe30a('0x30')]));dials[_0x21bd78[_0xe30a('0x4')]]=_[_0xe30a('0x28')](dials[_0x21bd78['uniqueid']],{'endtime':utils[_0xe30a('0x1e')](),'lastevent':_0xe30a('0x31')});dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x32')]=utils['diffTime'](dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x33')],dials[_0x21bd78[_0xe30a('0x4')]]['starttime']);dials[_0x21bd78[_0xe30a('0x4')]]['holdtime']=utils['diffTime'](dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x29')]||dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x33')],dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x22')]);dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x34')]=dials[_0x21bd78['uniqueid']][_0xe30a('0x29')]?utils['diffTime'](dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x33')],dials[_0x21bd78[_0xe30a('0x4')]][_0xe30a('0x29')]):0x0;writeDB(dials[_0x21bd78[_0xe30a('0x4')]]);}}catch(_0xa4fed6){utils[_0xe30a('0x23')](util[_0xe30a('0x15')]('[%s][dials][hangup]',_0x21bd78[_0xe30a('0x4')]),_0xa4fed6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8be2ebe..e5bc69d 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 _0x2e40=['origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','device','[%s][index][devicestatechange]','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][newstate]','newstate','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]'];(function(_0x57cfa1,_0x174f6e){var _0x397d18=function(_0x21347e){while(--_0x21347e){_0x57cfa1['push'](_0x57cfa1['shift']());}};_0x397d18(++_0x174f6e);}(_0x2e40,0x155));var _0x02e4=function(_0x1aa5d1,_0x52245e){_0x1aa5d1=_0x1aa5d1-0x0;var _0x3d2b3e=_0x2e40[_0x1aa5d1];return _0x3d2b3e;};var AsteriskManager=require(_0x02e4('0x0'));var config=require(_0x02e4('0x1'));var utils=require(_0x02e4('0x2'));var util=require(_0x02e4('0x3'));var ami=new AsteriskManager(config[_0x02e4('0x4')][_0x02e4('0x5')],config[_0x02e4('0x4')]['ip'],config[_0x02e4('0x4')][_0x02e4('0x6')],config[_0x02e4('0x4')][_0x02e4('0x7')],!![]);ami[_0x02e4('0x8')]();if(config[_0x02e4('0x9')]&&config['xdr']['disabled']){utils[_0x02e4('0xa')](_0x02e4('0xb'));}else{var agents=require(_0x02e4('0xc'));var calls=require(_0x02e4('0xd'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x02e4('0xe'));var dials=require(_0x02e4('0xf'));var transfers=require(_0x02e4('0x10'));var core=require('./core.controller');ami['on'](_0x02e4('0x11'),core[_0x02e4('0x11')]);ami['on'](_0x02e4('0x12'),core[_0x02e4('0x12')]);ami['on'](_0x02e4('0x13'),core[_0x02e4('0x13')]);ami['on']('error',core[_0x02e4('0x14')]);ami['on'](_0x02e4('0x15'),core[_0x02e4('0x15')]);ami['on'](_0x02e4('0x16'),core['managerevent']);ami['on'](_0x02e4('0x17'),function(_0x1039d5){try{utils['debug'](util[_0x02e4('0x18')]('[%s][index][devicestatechange]',_0x1039d5[_0x02e4('0x19')]),_0x1039d5);members[_0x02e4('0x17')](_0x1039d5);}catch(_0x43264c){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x1a'),_0x1039d5['device']),_0x43264c);}});ami['on']('agentcalled',function(_0x89418d){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x1c'),_0x89418d[_0x02e4('0x1d')]),_0x89418d);agents[_0x02e4('0x1e')](_0x89418d);}catch(_0x23173b){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x1c'),_0x89418d[_0x02e4('0x1d')]),_0x23173b);}});ami['on'](_0x02e4('0x1f'),function(_0x32842b){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x20'),_0x32842b[_0x02e4('0x1d')]),_0x32842b);agents[_0x02e4('0x1f')](_0x32842b);}catch(_0x4e8264){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x20'),_0x32842b[_0x02e4('0x1d')]),_0x4e8264);}});ami['on'](_0x02e4('0x21'),function(_0x232054){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x22'),_0x232054[_0x02e4('0x1d')]),_0x232054);agents[_0x02e4('0x21')](_0x232054);queues[_0x02e4('0x21')](_0x232054);}catch(_0x512886){utils[_0x02e4('0x14')](util['format'](_0x02e4('0x22'),_0x232054['uniqueid']),_0x512886);}});ami['on'](_0x02e4('0x23'),function(_0x362f99){try{utils['debug'](util[_0x02e4('0x18')](_0x02e4('0x24'),_0x362f99[_0x02e4('0x1d')]),_0x362f99);agents['agentcomplete'](_0x362f99);queues['agentcomplete'](_0x362f99);members[_0x02e4('0x23')](_0x362f99);}catch(_0x4453bd){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x24'),_0x362f99[_0x02e4('0x1d')]),_0x4453bd);}});ami['on'](_0x02e4('0x25'),function(_0x8fe3f2){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][queuecallerabandon]',_0x8fe3f2['uniqueid']),_0x8fe3f2);agents['queuecallerabandon'](_0x8fe3f2);queues['queuecallerabandon'](_0x8fe3f2);}catch(_0x5cf1d9){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x26'),_0x8fe3f2[_0x02e4('0x1d')]),_0x5cf1d9);}});ami['on'](_0x02e4('0x27'),function(_0x4bf5bb){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x28'),_0x4bf5bb[_0x02e4('0x1d')]),_0x4bf5bb);queues['queuecallerjoin'](_0x4bf5bb);recordings[_0x02e4('0x27')](_0x4bf5bb);}catch(_0x1e98e5){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x28'),_0x4bf5bb[_0x02e4('0x1d')]),_0x1e98e5);}});ami['on'](_0x02e4('0x29'),function(_0x4b87a5){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x2a'),_0x4b87a5['uniqueid']),_0x4b87a5);queues[_0x02e4('0x29')](_0x4b87a5);}catch(_0x159de1){utils['error'](util['format'](_0x02e4('0x2a'),_0x4b87a5[_0x02e4('0x1d')]),_0x159de1);}});ami['on']('musiconholdstart',function(_0x19a059){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x2b'),_0x19a059[_0x02e4('0x1d')]),_0x19a059);queues['musiconholdstart'](_0x19a059);calls[_0x02e4('0x2c')](_0x19a059);}catch(_0x48658c){utils[_0x02e4('0x14')](util['format'](_0x02e4('0x2b'),_0x19a059[_0x02e4('0x1d')]),_0x48658c);}});ami['on']('musiconholdstop',function(_0x5bd911){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][musiconholdstop]',_0x5bd911[_0x02e4('0x1d')]),_0x5bd911);queues[_0x02e4('0x2d')](_0x5bd911);calls[_0x02e4('0x2d')](_0x5bd911);}catch(_0x13590c){utils['error'](util[_0x02e4('0x18')]('[%s][index][musiconholdstop]',_0x5bd911[_0x02e4('0x1d')]),_0x13590c);}});ami['on']('newstate',function(_0x48c2a1){try{utils['debug'](util['format'](_0x02e4('0x2e'),_0x48c2a1[_0x02e4('0x1d')]),_0x48c2a1);calls[_0x02e4('0x2f')](_0x48c2a1);recordings['newstate'](_0x48c2a1);}catch(_0x162cdf){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x2e'),_0x48c2a1['uniqueid']),_0x162cdf);}});ami['on'](_0x02e4('0x30'),function(_0xea00cc){try{utils[_0x02e4('0x1b')](util['format']('[%s][index][hangup]',_0xea00cc[_0x02e4('0x1d')]),_0xea00cc);calls[_0x02e4('0x30')](_0xea00cc);recordings['hangup'](_0xea00cc);dials[_0x02e4('0x30')](_0xea00cc);agents[_0x02e4('0x30')](_0xea00cc);queues[_0x02e4('0x30')](_0xea00cc);}catch(_0x5080d4){utils[_0x02e4('0x14')](util[_0x02e4('0x18')]('[%s][index][hangup]',_0xea00cc[_0x02e4('0x1d')]),_0x5080d4);}});ami['on'](_0x02e4('0x31'),function(_0x558bc9){try{utils['debug'](util[_0x02e4('0x18')](_0x02e4('0x32'),_0x558bc9['uniqueid']),_0x558bc9);members['cdr'](_0x558bc9);}catch(_0x26c3e4){utils[_0x02e4('0x14')](util[_0x02e4('0x18')]('[%s][index][cdr]',_0x558bc9['uniqueid']),_0x26c3e4);}});ami['on'](_0x02e4('0x33'),function(_0x2272ca){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x34'),_0x2272ca[_0x02e4('0x1d')]),_0x2272ca);queues['blindtransfer'](_0x2272ca);agents['blindtransfer'](_0x2272ca);transfers[_0x02e4('0x33')](_0x2272ca);}catch(_0x32aef7){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x34'),_0x2272ca[_0x02e4('0x1d')]),_0x32aef7);}});ami['on'](_0x02e4('0x35'),function(_0x4c16b6){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x36'),_0x4c16b6[_0x02e4('0x37')]),_0x4c16b6);queues['attendedtransfer'](_0x4c16b6);transfers[_0x02e4('0x35')](_0x4c16b6);agents[_0x02e4('0x35')](_0x4c16b6);calls[_0x02e4('0x35')](_0x4c16b6);}catch(_0x1e6311){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x36'),_0x4c16b6['origtransfereruniqueid']),_0x1e6311);}});ami['on'](_0x02e4('0x38'),function(_0x1970fc){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')](_0x02e4('0x39'),_0x1970fc['uniqueid']),_0x1970fc);queues[_0x02e4('0x38')](_0x1970fc);recordings['varset'](_0x1970fc);calls[_0x02e4('0x38')](_0x1970fc);dials['varset'](_0x1970fc);}catch(_0x22c78f){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x39'),_0x1970fc[_0x02e4('0x1d')]),_0x22c78f);}});ami['on'](_0x02e4('0x3a'),function(_0x407f6b){try{utils['debug'](util['format'](_0x02e4('0x3b'),_0x407f6b['uniqueid']),_0x407f6b);calls['newexten'](_0x407f6b);recordings['newexten'](_0x407f6b);dials[_0x02e4('0x3a')](_0x407f6b);}catch(_0x1ee81d){utils[_0x02e4('0x14')](util[_0x02e4('0x18')]('[%s][index][newexten]',_0x407f6b[_0x02e4('0x1d')]),_0x1ee81d);}});ami['on'](_0x02e4('0x3c'),function(_0x3cada0){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][newchannel]',_0x3cada0[_0x02e4('0x1d')]),_0x3cada0);calls['newchannel'](_0x3cada0);recordings[_0x02e4('0x3c')](_0x3cada0);}catch(_0x17abe6){utils['error'](util['format'](_0x02e4('0x3d'),_0x3cada0['uniqueid']),_0x17abe6);}});ami['on']('dialbegin',function(_0x32185e){try{utils[_0x02e4('0x1b')](util[_0x02e4('0x18')]('[%s][index][dialbegin]',_0x32185e[_0x02e4('0x1d')]),_0x32185e);dials[_0x02e4('0x3e')](_0x32185e);}catch(_0x43c9da){utils[_0x02e4('0x14')](util[_0x02e4('0x18')](_0x02e4('0x3f'),_0x32185e['uniqueid']),_0x43c9da);}});ami['on'](_0x02e4('0x40'),function(_0x2055ca){try{utils[_0x02e4('0x1b')](util['format'](_0x02e4('0x41'),_0x2055ca[_0x02e4('0x1d')]),_0x2055ca);dials[_0x02e4('0x40')](_0x2055ca);}catch(_0x30a0d5){utils['error'](util[_0x02e4('0x18')](_0x02e4('0x41'),_0x2055ca[_0x02e4('0x1d')]),_0x30a0d5);}});} \ No newline at end of file +var _0x09d1=['./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED'];(function(_0x30f8a2,_0x23b1f7){var _0x38b4d7=function(_0x22dec6){while(--_0x22dec6){_0x30f8a2['push'](_0x30f8a2['shift']());}};_0x38b4d7(++_0x23b1f7);}(_0x09d1,0xb2));var _0x109d=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x09d1[_0x4ca333];return _0x13b2e1;};var AsteriskManager=require(_0x109d('0x0'));var config=require(_0x109d('0x1'));var utils=require(_0x109d('0x2'));var util=require(_0x109d('0x3'));var ami=new AsteriskManager(config[_0x109d('0x4')]['port'],config[_0x109d('0x4')]['ip'],config[_0x109d('0x4')][_0x109d('0x5')],config[_0x109d('0x4')][_0x109d('0x6')],!![]);ami[_0x109d('0x7')]();if(config['xdr']&&config[_0x109d('0x8')][_0x109d('0x9')]){utils['info'](_0x109d('0xa'));}else{var agents=require(_0x109d('0xb'));var calls=require(_0x109d('0xc'));var queues=require(_0x109d('0xd'));var recordings=require(_0x109d('0xe'));var members=require(_0x109d('0xf'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x109d('0x10'));ami['on'](_0x109d('0x11'),core['connect']);ami['on']('shutdown',core['shutdown']);ami['on'](_0x109d('0x12'),core[_0x109d('0x12')]);ami['on'](_0x109d('0x13'),core['error']);ami['on'](_0x109d('0x14'),core[_0x109d('0x14')]);ami['on'](_0x109d('0x15'),core['managerevent']);ami['on'](_0x109d('0x16'),function(_0x3c4902){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x18'),_0x3c4902[_0x109d('0x19')]),_0x3c4902);members[_0x109d('0x16')](_0x3c4902);}catch(_0x1599f0){utils['error'](util[_0x109d('0x1a')](_0x109d('0x18'),_0x3c4902[_0x109d('0x19')]),_0x1599f0);}});ami['on'](_0x109d('0x1b'),function(_0x560fce){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')]('[%s][index][agentcalled]',_0x560fce['uniqueid']),_0x560fce);agents[_0x109d('0x1b')](_0x560fce);}catch(_0x20993b){utils[_0x109d('0x13')](util['format'](_0x109d('0x1c'),_0x560fce['uniqueid']),_0x20993b);}});ami['on']('agentringnoanswer',function(_0x27d966){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x1d'),_0x27d966[_0x109d('0x1e')]),_0x27d966);agents[_0x109d('0x1f')](_0x27d966);}catch(_0x787d1c){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x1d'),_0x27d966[_0x109d('0x1e')]),_0x787d1c);}});ami['on'](_0x109d('0x20'),function(_0xb2c4c9){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x21'),_0xb2c4c9[_0x109d('0x1e')]),_0xb2c4c9);agents[_0x109d('0x20')](_0xb2c4c9);queues['agentconnect'](_0xb2c4c9);}catch(_0xcb3dd0){utils['error'](util[_0x109d('0x1a')](_0x109d('0x21'),_0xb2c4c9[_0x109d('0x1e')]),_0xcb3dd0);}});ami['on'](_0x109d('0x22'),function(_0x4a013e){try{utils['debug'](util[_0x109d('0x1a')](_0x109d('0x23'),_0x4a013e[_0x109d('0x1e')]),_0x4a013e);agents[_0x109d('0x22')](_0x4a013e);queues[_0x109d('0x22')](_0x4a013e);members[_0x109d('0x22')](_0x4a013e);}catch(_0x805124){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x23'),_0x4a013e[_0x109d('0x1e')]),_0x805124);}});ami['on'](_0x109d('0x24'),function(_0x373664){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x25'),_0x373664[_0x109d('0x1e')]),_0x373664);agents['queuecallerabandon'](_0x373664);queues[_0x109d('0x24')](_0x373664);}catch(_0x41e149){utils['error'](util['format'](_0x109d('0x25'),_0x373664[_0x109d('0x1e')]),_0x41e149);}});ami['on'](_0x109d('0x26'),function(_0x924e5d){try{utils['debug'](util[_0x109d('0x1a')]('[%s][index][queuecallerjoin]',_0x924e5d['uniqueid']),_0x924e5d);queues['queuecallerjoin'](_0x924e5d);recordings[_0x109d('0x26')](_0x924e5d);}catch(_0x2e5778){utils['error'](util['format']('[%s][index][queuecallerjoin]',_0x924e5d[_0x109d('0x1e')]),_0x2e5778);}});ami['on'](_0x109d('0x27'),function(_0x296a03){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x28'),_0x296a03[_0x109d('0x1e')]),_0x296a03);queues[_0x109d('0x27')](_0x296a03);}catch(_0x2db3ce){utils[_0x109d('0x13')](util[_0x109d('0x1a')]('[%s][index][queuecallerleave]',_0x296a03['uniqueid']),_0x2db3ce);}});ami['on'](_0x109d('0x29'),function(_0x36279b){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x2a'),_0x36279b[_0x109d('0x1e')]),_0x36279b);queues[_0x109d('0x29')](_0x36279b);calls[_0x109d('0x29')](_0x36279b);}catch(_0x4ea931){utils['error'](util[_0x109d('0x1a')](_0x109d('0x2a'),_0x36279b[_0x109d('0x1e')]),_0x4ea931);}});ami['on']('musiconholdstop',function(_0x4c2f83){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x2b'),_0x4c2f83[_0x109d('0x1e')]),_0x4c2f83);queues[_0x109d('0x2c')](_0x4c2f83);calls['musiconholdstop'](_0x4c2f83);}catch(_0x1b9008){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x2b'),_0x4c2f83['uniqueid']),_0x1b9008);}});ami['on'](_0x109d('0x2d'),function(_0x5c1b4b){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x2e'),_0x5c1b4b[_0x109d('0x1e')]),_0x5c1b4b);calls[_0x109d('0x2d')](_0x5c1b4b);recordings['newstate'](_0x5c1b4b);}catch(_0x20431e){utils['error'](util[_0x109d('0x1a')](_0x109d('0x2e'),_0x5c1b4b[_0x109d('0x1e')]),_0x20431e);}});ami['on'](_0x109d('0x2f'),function(_0x8818a){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')]('[%s][index][hangup]',_0x8818a[_0x109d('0x1e')]),_0x8818a);calls[_0x109d('0x2f')](_0x8818a);recordings[_0x109d('0x2f')](_0x8818a);dials[_0x109d('0x2f')](_0x8818a);agents['hangup'](_0x8818a);queues[_0x109d('0x2f')](_0x8818a);}catch(_0x28bd28){utils[_0x109d('0x13')](util['format'](_0x109d('0x30'),_0x8818a[_0x109d('0x1e')]),_0x28bd28);}});ami['on']('cdr',function(_0x2f552f){try{utils['debug'](util[_0x109d('0x1a')]('[%s][index][cdr]',_0x2f552f[_0x109d('0x1e')]),_0x2f552f);members['cdr'](_0x2f552f);}catch(_0x278f4b){utils[_0x109d('0x13')](util[_0x109d('0x1a')]('[%s][index][cdr]',_0x2f552f[_0x109d('0x1e')]),_0x278f4b);}});ami['on'](_0x109d('0x31'),function(_0x4527e1){try{utils[_0x109d('0x17')](util['format'](_0x109d('0x32'),_0x4527e1[_0x109d('0x1e')]),_0x4527e1);queues[_0x109d('0x31')](_0x4527e1);agents['blindtransfer'](_0x4527e1);transfers['blindtransfer'](_0x4527e1);}catch(_0x49e232){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x32'),_0x4527e1['uniqueid']),_0x49e232);}});ami['on'](_0x109d('0x33'),function(_0x4cd055){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x34'),_0x4cd055[_0x109d('0x35')]),_0x4cd055);queues[_0x109d('0x33')](_0x4cd055);transfers['attendedtransfer'](_0x4cd055);agents[_0x109d('0x33')](_0x4cd055);calls[_0x109d('0x33')](_0x4cd055);}catch(_0x35642c){utils['error'](util[_0x109d('0x1a')](_0x109d('0x34'),_0x4cd055['origtransfereruniqueid']),_0x35642c);}});ami['on'](_0x109d('0x36'),function(_0x4b2ba1){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x37'),_0x4b2ba1[_0x109d('0x1e')]),_0x4b2ba1);queues['varset'](_0x4b2ba1);recordings[_0x109d('0x36')](_0x4b2ba1);calls['varset'](_0x4b2ba1);dials[_0x109d('0x36')](_0x4b2ba1);}catch(_0xc9735c){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x37'),_0x4b2ba1['uniqueid']),_0xc9735c);}});ami['on'](_0x109d('0x38'),function(_0x3eb191){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x39'),_0x3eb191[_0x109d('0x1e')]),_0x3eb191);calls[_0x109d('0x38')](_0x3eb191);recordings[_0x109d('0x38')](_0x3eb191);dials['newexten'](_0x3eb191);}catch(_0x2e9dde){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x39'),_0x3eb191[_0x109d('0x1e')]),_0x2e9dde);}});ami['on']('newchannel',function(_0x1fc0bd){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x3a'),_0x1fc0bd[_0x109d('0x1e')]),_0x1fc0bd);calls['newchannel'](_0x1fc0bd);recordings[_0x109d('0x3b')](_0x1fc0bd);}catch(_0x5d3aaa){utils[_0x109d('0x13')](util[_0x109d('0x1a')]('[%s][index][newchannel]',_0x1fc0bd[_0x109d('0x1e')]),_0x5d3aaa);}});ami['on']('dialbegin',function(_0x7e3587){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')](_0x109d('0x3c'),_0x7e3587[_0x109d('0x1e')]),_0x7e3587);dials['dialbegin'](_0x7e3587);}catch(_0x481104){utils[_0x109d('0x13')](util[_0x109d('0x1a')](_0x109d('0x3d'),_0x7e3587[_0x109d('0x1e')]),_0x481104);}});ami['on'](_0x109d('0x3e'),function(_0x489d4c){try{utils[_0x109d('0x17')](util[_0x109d('0x1a')]('[%s][index][dialend]',_0x489d4c[_0x109d('0x1e')]),_0x489d4c);dials[_0x109d('0x3e')](_0x489d4c);}catch(_0x5ca589){utils['error'](util[_0x109d('0x1a')]('[%s][index][dialend]',_0x489d4c[_0x109d('0x1e')]),_0x5ca589);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3d84751..313f180 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 _0x01bb=['internal','request','getUserByName','split','then','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','name'];(function(_0x460399,_0x5d2cfd){var _0x276cf4=function(_0x212c50){while(--_0x212c50){_0x460399['push'](_0x460399['shift']());}};_0x276cf4(++_0x5d2cfd);}(_0x01bb,0x8b));var _0xb01b=function(_0x25b25f,_0x1b2795){_0x25b25f=_0x25b25f-0x0;var _0x301d15=_0x01bb[_0x25b25f];return _0x301d15;};'use strict';var _=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x21d430){utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x4'),_0x21d430['uniqueid'],_0x21d430[_0xb01b('0x5')],_0x21d430[_0xb01b('0x6')],_0x21d430[_0xb01b('0x7')],_0x21d430[_0xb01b('0x8')],_0x21d430[_0xb01b('0x9')]));if(_0x21d430[_0xb01b('0x5')]){utils['getUserByInterface'](_0x21d430[_0xb01b('0x5')])['then'](function(_0x542b7d){if(_0x542b7d){_0x21d430[_0xb01b('0x8')]=_0x542b7d[_0xb01b('0xa')];_0x21d430[_0xb01b('0xb')]=_0x542b7d[_0xb01b('0xb')];utils[_0xb01b('0xc')]('CreateMemberReport',_0x21d430);}else{utils[_0xb01b('0xd')](_0x21d430['interface'][_0xb01b('0xe')]('/')[0x1])[_0xb01b('0xf')](function(_0x2c04bb){if(_0x2c04bb){_0x21d430[_0xb01b('0x8')]=_0x2c04bb[_0xb01b('0xa')];_0x21d430[_0xb01b('0xb')]=_0x2c04bb['internal'];utils[_0xb01b('0xc')]('CreateMemberReport',_0x21d430);}});}})['catch'](function(_0x17ccef){utils[_0xb01b('0x10')](util[_0xb01b('0x3')](_0xb01b('0x11'),_0x21d430[_0xb01b('0x12')]),_0x17ccef);});}delete members[_0x21d430[_0xb01b('0x5')]];}function startsWith(_0x479327,_0x54332d){return _[_0xb01b('0x13')](_0x479327,function(_0x58b1b2){return _[_0xb01b('0x14')](_0x54332d,_0x58b1b2);});}exports[_0xb01b('0x15')]=function(_0x78a414){try{utils[_0xb01b('0x16')](util[_0xb01b('0x3')]('[%s][members][devicestatechange]',members[_0x78a414[_0xb01b('0x17')]]?members[_0x78a414[_0xb01b('0x17')]]['uniqueid']:_0x78a414[_0xb01b('0x17')]),_0x78a414);utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x18'),members[_0x78a414[_0xb01b('0x17')]]?members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x12')]:_0x78a414[_0xb01b('0x17')],_0x78a414['state'],_0x78a414[_0xb01b('0x17')]));switch(_0x78a414['state']){case _0xb01b('0x19'):case _0xb01b('0x1a'):if(!startsWith(exclude,_0x78a414[_0xb01b('0x17')])){members[_0x78a414['device']]={'channel':_0xb01b('0x1b'),'interface':_0x78a414[_0xb01b('0x17')],'type':'TALKING','enterAt':utils[_0xb01b('0x1c')](),'role':_0xb01b('0x1d')};}break;case _0xb01b('0x1e'):if(!_['isNil'](members[_0x78a414[_0xb01b('0x17')]])){members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x1f')]=utils[_0xb01b('0x1c')]();members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x20')]=utils[_0xb01b('0x21')](members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x1f')],members[_0x78a414['device']][_0xb01b('0x22')]);if(members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x12')]){writeDB(members[_0x78a414[_0xb01b('0x17')]]);}}break;default:break;}}catch(_0x404591){utils[_0xb01b('0x10')](util['format'](_0xb01b('0x23'),members[_0x78a414['device']]?members[_0x78a414[_0xb01b('0x17')]][_0xb01b('0x12')]:_0x78a414[_0xb01b('0x17')]),_0x404591);}};exports[_0xb01b('0x24')]=function(_0x5cd2c4){try{if(!_[_0xb01b('0x25')](members[_0x5cd2c4[_0xb01b('0x5')]])){utils[_0xb01b('0x16')](util[_0xb01b('0x3')](_0xb01b('0x26'),_0x5cd2c4['uniqueid']),_0x5cd2c4);utils['info'](util['format'](_0xb01b('0x27'),_0x5cd2c4[_0xb01b('0x12')],_0x5cd2c4['interface'],_0x5cd2c4[_0xb01b('0x28')]));members[_0x5cd2c4[_0xb01b('0x5')]]=_[_0xb01b('0x29')](members[_0x5cd2c4[_0xb01b('0x5')]],{'data4':_0x5cd2c4[_0xb01b('0x28')],'uniqueid':_0x5cd2c4['uniqueid']});}}catch(_0x2e3a5a){utils[_0xb01b('0x10')](util[_0xb01b('0x3')]('[%s][members][agentcomplete]',_0x5cd2c4[_0xb01b('0x12')]),_0x2e3a5a);}};exports[_0xb01b('0x2a')]=function(_0x3d65be){try{utils[_0xb01b('0x16')](util[_0xb01b('0x3')]('[%s][members][cdr]',_0x3d65be[_0xb01b('0x12')]),_0x3d65be);if(_0x3d65be['channel']){var _0xd53b61=_0x3d65be[_0xb01b('0x6')]['split']('-')[0x0];if(!_[_0xb01b('0x25')](members[_0xd53b61])){members[_0xd53b61]=_[_0xb01b('0x29')](members[_0xd53b61],{'data1':members[_0xd53b61][_0xb01b('0x2b')]||_0x3d65be[_0xb01b('0x9')],'data2':members[_0xd53b61][_0xb01b('0x7')]||_0x3d65be[_0xb01b('0x2c')],'data3':members[_0xd53b61][_0xb01b('0x2d')]||_0x3d65be[_0xb01b('0x2e')],'uniqueid':members[_0xd53b61]['uniqueid']||_0x3d65be['uniqueid']});utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x2f'),_0x3d65be[_0xb01b('0x12')],members[_0xd53b61][_0xb01b('0x2b')],members[_0xd53b61][_0xb01b('0x7')],members[_0xd53b61][_0xb01b('0x2d')]));if(members[_0xd53b61][_0xb01b('0x1f')]){writeDB(members[_0xd53b61]);}}}if(_0x3d65be[_0xb01b('0x30')]){var _0x52e3c9=_0x3d65be[_0xb01b('0x30')][_0xb01b('0xe')]('-')[0x0];if(!_[_0xb01b('0x25')](members[_0x52e3c9])){members[_0x52e3c9]=_[_0xb01b('0x29')](members[_0x52e3c9],{'data1':members[_0x52e3c9][_0xb01b('0x2b')]||_0x3d65be[_0xb01b('0x9')],'data2':members[_0x52e3c9][_0xb01b('0x7')]||_0x3d65be['source'],'data3':members[_0x52e3c9]['data3']||_0x3d65be['destination'],'uniqueid':members[_0x52e3c9]['uniqueid']||_0x3d65be[_0xb01b('0x12')]});utils[_0xb01b('0x2')](util[_0xb01b('0x3')](_0xb01b('0x2f'),_0x3d65be[_0xb01b('0x12')],members[_0x52e3c9]['data1'],members[_0x52e3c9]['data2'],members[_0x52e3c9][_0xb01b('0x2d')]));if(members[_0x52e3c9]['exitAt']){writeDB(members[_0x52e3c9]);}}}}catch(_0x500f2f){utils[_0xb01b('0x10')](util[_0xb01b('0x3')](_0xb01b('0x31'),_0x3d65be[_0xb01b('0x12')]),_0x500f2f);}}; \ No newline at end of file +var _0x7eaf=['channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','split','catch','error','[%s][members][writeDB]','startsWith','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','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','format','uniqueid'];(function(_0x5ab81a,_0x2aa55c){var _0x526e2c=function(_0x5e5bf9){while(--_0x5e5bf9){_0x5ab81a['push'](_0x5ab81a['shift']());}};_0x526e2c(++_0x2aa55c);}(_0x7eaf,0x189));var _0xf7ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eaf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf7ea('0x0'));var util=require(_0xf7ea('0x1'));var utils=require(_0xf7ea('0x2'));var members={};var exclude=[_0xf7ea('0x3'),'Queue:'];function writeDB(_0x49f78e){utils[_0xf7ea('0x4')](util[_0xf7ea('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x49f78e[_0xf7ea('0x6')],_0x49f78e['interface'],_0x49f78e[_0xf7ea('0x7')],_0x49f78e[_0xf7ea('0x8')],_0x49f78e[_0xf7ea('0x9')],_0x49f78e[_0xf7ea('0xa')]));if(_0x49f78e[_0xf7ea('0xb')]){utils[_0xf7ea('0xc')](_0x49f78e[_0xf7ea('0xb')])[_0xf7ea('0xd')](function(_0x368ecd){if(_0x368ecd){_0x49f78e[_0xf7ea('0x9')]=_0x368ecd[_0xf7ea('0xe')];_0x49f78e['internal']=_0x368ecd[_0xf7ea('0xf')];utils[_0xf7ea('0x10')]('CreateMemberReport',_0x49f78e);}else{utils['getUserByName'](_0x49f78e[_0xf7ea('0xb')][_0xf7ea('0x11')]('/')[0x1])[_0xf7ea('0xd')](function(_0x19d1ae){if(_0x19d1ae){_0x49f78e['membername']=_0x19d1ae[_0xf7ea('0xe')];_0x49f78e[_0xf7ea('0xf')]=_0x19d1ae['internal'];utils[_0xf7ea('0x10')]('CreateMemberReport',_0x49f78e);}});}})[_0xf7ea('0x12')](function(_0x485e87){utils[_0xf7ea('0x13')](util['format'](_0xf7ea('0x14'),_0x49f78e['uniqueid']),_0x485e87);});}delete members[_0x49f78e[_0xf7ea('0xb')]];}function startsWith(_0x229da8,_0x34ec63){return _['some'](_0x229da8,function(_0x9563b6){return _[_0xf7ea('0x15')](_0x34ec63,_0x9563b6);});}exports['devicestatechange']=function(_0x44b164){try{utils[_0xf7ea('0x16')](util[_0xf7ea('0x5')](_0xf7ea('0x17'),members[_0x44b164[_0xf7ea('0x18')]]?members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x6')]:_0x44b164[_0xf7ea('0x18')]),_0x44b164);utils['info'](util[_0xf7ea('0x5')](_0xf7ea('0x19'),members[_0x44b164['device']]?members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x6')]:_0x44b164['device'],_0x44b164[_0xf7ea('0x1a')],_0x44b164[_0xf7ea('0x18')]));switch(_0x44b164[_0xf7ea('0x1a')]){case _0xf7ea('0x1b'):case _0xf7ea('0x1c'):if(!startsWith(exclude,_0x44b164[_0xf7ea('0x18')])){members[_0x44b164[_0xf7ea('0x18')]]={'channel':'voice','interface':_0x44b164[_0xf7ea('0x18')],'type':_0xf7ea('0x1d'),'enterAt':utils[_0xf7ea('0x1e')](),'role':_0xf7ea('0x1f')};}break;case _0xf7ea('0x20'):if(!_[_0xf7ea('0x21')](members[_0x44b164[_0xf7ea('0x18')]])){members[_0x44b164['device']][_0xf7ea('0x22')]=utils[_0xf7ea('0x1e')]();members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x23')]=utils[_0xf7ea('0x24')](members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x22')],members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x25')]);if(members[_0x44b164[_0xf7ea('0x18')]]['uniqueid']){writeDB(members[_0x44b164[_0xf7ea('0x18')]]);}}break;default:break;}}catch(_0x3c59e2){utils[_0xf7ea('0x13')](util[_0xf7ea('0x5')](_0xf7ea('0x17'),members[_0x44b164[_0xf7ea('0x18')]]?members[_0x44b164[_0xf7ea('0x18')]][_0xf7ea('0x6')]:_0x44b164[_0xf7ea('0x18')]),_0x3c59e2);}};exports['agentcomplete']=function(_0x43da67){try{if(!_[_0xf7ea('0x21')](members[_0x43da67[_0xf7ea('0xb')]])){utils[_0xf7ea('0x16')](util[_0xf7ea('0x5')](_0xf7ea('0x26'),_0x43da67[_0xf7ea('0x6')]),_0x43da67);utils['info'](util[_0xf7ea('0x5')](_0xf7ea('0x27'),_0x43da67[_0xf7ea('0x6')],_0x43da67[_0xf7ea('0xb')],_0x43da67[_0xf7ea('0x28')]));members[_0x43da67[_0xf7ea('0xb')]]=_['assign'](members[_0x43da67[_0xf7ea('0xb')]],{'data4':_0x43da67[_0xf7ea('0x28')],'uniqueid':_0x43da67['uniqueid']});}}catch(_0x2edf01){utils[_0xf7ea('0x13')](util[_0xf7ea('0x5')](_0xf7ea('0x26'),_0x43da67[_0xf7ea('0x6')]),_0x2edf01);}};exports[_0xf7ea('0x29')]=function(_0x2e6344){try{utils[_0xf7ea('0x16')](util['format'](_0xf7ea('0x2a'),_0x2e6344[_0xf7ea('0x6')]),_0x2e6344);if(_0x2e6344[_0xf7ea('0x7')]){var _0x227715=_0x2e6344['channel'][_0xf7ea('0x11')]('-')[0x0];if(!_[_0xf7ea('0x21')](members[_0x227715])){members[_0x227715]=_[_0xf7ea('0x2b')](members[_0x227715],{'data1':members[_0x227715][_0xf7ea('0x2c')]||_0x2e6344[_0xf7ea('0xa')],'data2':members[_0x227715][_0xf7ea('0x8')]||_0x2e6344[_0xf7ea('0x2d')],'data3':members[_0x227715]['data3']||_0x2e6344[_0xf7ea('0x2e')],'uniqueid':members[_0x227715]['uniqueid']||_0x2e6344[_0xf7ea('0x6')]});utils[_0xf7ea('0x4')](util['format'](_0xf7ea('0x2f'),_0x2e6344['uniqueid'],members[_0x227715]['data1'],members[_0x227715][_0xf7ea('0x8')],members[_0x227715][_0xf7ea('0x30')]));if(members[_0x227715][_0xf7ea('0x22')]){writeDB(members[_0x227715]);}}}if(_0x2e6344[_0xf7ea('0x31')]){var _0x5d327e=_0x2e6344['destinationchannel'][_0xf7ea('0x11')]('-')[0x0];if(!_[_0xf7ea('0x21')](members[_0x5d327e])){members[_0x5d327e]=_[_0xf7ea('0x2b')](members[_0x5d327e],{'data1':members[_0x5d327e][_0xf7ea('0x2c')]||_0x2e6344[_0xf7ea('0xa')],'data2':members[_0x5d327e]['data2']||_0x2e6344[_0xf7ea('0x2d')],'data3':members[_0x5d327e]['data3']||_0x2e6344[_0xf7ea('0x2e')],'uniqueid':members[_0x5d327e][_0xf7ea('0x6')]||_0x2e6344[_0xf7ea('0x6')]});utils[_0xf7ea('0x4')](util['format'](_0xf7ea('0x2f'),_0x2e6344[_0xf7ea('0x6')],members[_0x5d327e][_0xf7ea('0x2c')],members[_0x5d327e][_0xf7ea('0x8')],members[_0x5d327e]['data3']));if(members[_0x5d327e]['exitAt']){writeDB(members[_0x5d327e]);}}}}catch(_0x424916){utils['error'](util[_0xf7ea('0x5')](_0xf7ea('0x2a'),_0x2e6344[_0xf7ea('0x6')]),_0x424916);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 1e767d7..74f13c5 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 _0x1c01=['accountcode','type','request','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','position','assign','now','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitreason','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','queuecallerexitAt','EXITWITHKEY','[%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','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','[%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','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x1c01,0x190));var _0x11c0=function(_0x3fbc3e,_0x359a26){_0x3fbc3e=_0x3fbc3e-0x0;var _0x11f21c=_0x1c01[_0x3fbc3e];return _0x11f21c;};'use strict';var _=require(_0x11c0('0x0'));var util=require(_0x11c0('0x1'));var utils=require(_0x11c0('0x2'));var queues={};function writeDB(_0x17900e){utils['info'](util[_0x11c0('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x17900e['uniqueid'],_0x17900e[_0x11c0('0x4')],_0x17900e[_0x11c0('0x5')],_0x17900e[_0x11c0('0x6')],_0x17900e[_0x11c0('0x7')],_0x17900e[_0x11c0('0x8')],_0x17900e['queuecallerexitreason']));if(_0x17900e[_0x11c0('0x5')]){utils['getVoiceQueueByName'](_0x17900e[_0x11c0('0x5')])['then'](function(_0x127b2f){if(_0x127b2f){_0x17900e['type']=_0x127b2f[_0x11c0('0x9')];}utils['request']('CreateVoiceQueueReport',_0x17900e);});}else{utils[_0x11c0('0xa')]('CreateVoiceQueueReport',_0x17900e);}if(_0x17900e[_0x11c0('0xb')]){delete queues[_0x17900e[_0x11c0('0xb')]];}else{delete queues[_0x17900e[_0x11c0('0xc')]];}}exports[_0x11c0('0xd')]=function(_0x3cc04b){try{utils['debug'](util[_0x11c0('0x3')](_0x11c0('0xe'),_0x3cc04b[_0x11c0('0xc')]),_0x3cc04b);utils[_0x11c0('0xf')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3cc04b[_0x11c0('0xc')],_0x3cc04b[_0x11c0('0x5')],_0x3cc04b[_0x11c0('0x10')]));queues[_0x3cc04b[_0x11c0('0xc')]]=_[_0x11c0('0x11')](_0x3cc04b,{'originalposition':_0x3cc04b[_0x11c0('0x10')],'queuecallerjoinAt':utils[_0x11c0('0x12')](),'mohtime':0x0});}catch(_0x51e830){utils[_0x11c0('0x13')](util['format'](_0x11c0('0xe'),_0x3cc04b['uniqueid']),_0x51e830);}};exports[_0x11c0('0x14')]=function(_0x45131a){try{if(!_[_0x11c0('0x15')](queues[_0x45131a['uniqueid']])){utils[_0x11c0('0x16')](util[_0x11c0('0x3')](_0x11c0('0x17'),_0x45131a[_0x11c0('0xc')]),_0x45131a);if(queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x18')]){if(!queues[_0x45131a['uniqueid']]['queuecallerabandon']&&!queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x19')]){queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x1a')]=!![];queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x1b')]=utils[_0x11c0('0x12')]();queues[_0x45131a[_0x11c0('0xc')]]['queuecallerexitreason']=_0x11c0('0x1c');}utils[_0x11c0('0xf')](util['format'](_0x11c0('0x1d'),_0x45131a[_0x11c0('0xc')],queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0x1e')],queues[_0x45131a[_0x11c0('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x45131a[_0x11c0('0xc')]]);}else if(queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0xb')]){utils[_0x11c0('0xf')](util['format'](_0x11c0('0x1f'),_0x45131a[_0x11c0('0xc')],queues[_0x45131a[_0x11c0('0xc')]]['name'],queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0xb')]));queues[queues[_0x45131a['uniqueid']]['transfereduniqueid']]=queues[_0x45131a['uniqueid']];queues[queues[_0x45131a[_0x11c0('0xc')]][_0x11c0('0xb')]][_0x11c0('0x20')]=0x2;delete queues[_0x45131a[_0x11c0('0xc')]];}}}catch(_0x41837d){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x17'),_0x45131a[_0x11c0('0xc')]),_0x41837d);}};exports['varset']=function(_0x1b9316){try{utils[_0x11c0('0x16')](util['format'](_0x11c0('0x21'),_0x1b9316[_0x11c0('0xc')]),_0x1b9316);if(!_[_0x11c0('0x15')](_0x1b9316['variable']['queuestatus'])&&_0x1b9316[_0x11c0('0x22')][_0x11c0('0x23')]()!==_0x11c0('0x24')){if(!_[_0x11c0('0x15')](queues[_0x1b9316['uniqueid']])){queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerabandon']=![];queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x25')]=null;queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerexit']=!![];queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerexitAt']=utils[_0x11c0('0x12')]();queues[_0x1b9316['uniqueid']][_0x11c0('0x26')]=_0x1b9316[_0x11c0('0x22')][_0x11c0('0x23')]();utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x27'),_0x1b9316['uniqueid'],queues[_0x1b9316[_0x11c0('0xc')]]['name'],_0x1b9316[_0x11c0('0x22')],queues[_0x1b9316['uniqueid']][_0x11c0('0x26')]));writeDB(queues[_0x1b9316[_0x11c0('0xc')]]);}}else if(!_['isNil'](_0x1b9316['variable'][_0x11c0('0x28')])){if(!_['isNil'](queues[_0x1b9316[_0x11c0('0xc')]])&&!queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x29')]){queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x29')]=![];queues[_0x1b9316['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x19')]=!![];queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x2a')]=utils[_0x11c0('0x12')]();queues[_0x1b9316[_0x11c0('0xc')]][_0x11c0('0x26')]=_0x11c0('0x2b');utils['info'](util[_0x11c0('0x3')](_0x11c0('0x2c'),_0x1b9316['uniqueid'],queues[_0x1b9316[_0x11c0('0xc')]]['name'],_0x1b9316[_0x11c0('0x22')],queues[_0x1b9316[_0x11c0('0xc')]]['queuecallerexitreason']));}}}catch(_0x250893){utils[_0x11c0('0x13')](util['format'](_0x11c0('0x21'),_0x1b9316[_0x11c0('0xc')]),_0x250893);}};exports[_0x11c0('0x29')]=function(_0x59b6e4){try{if(!_[_0x11c0('0x15')](queues[_0x59b6e4['uniqueid']])){utils[_0x11c0('0x16')](util['format']('[%s][queues][queuecallerabandon]',_0x59b6e4[_0x11c0('0xc')]),_0x59b6e4);queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x19')]=![];queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x2a')]=null;queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x29')]=!![];queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x25')]=utils['now']();queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x26')]=_0x11c0('0x2d');utils[_0x11c0('0xf')](util['format'](_0x11c0('0x2e'),_0x59b6e4[_0x11c0('0xc')],queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x1e')],queues[_0x59b6e4[_0x11c0('0xc')]][_0x11c0('0x26')]));}}catch(_0xc29b4d){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x2f'),_0x59b6e4[_0x11c0('0xc')]),_0xc29b4d);}};exports[_0x11c0('0x30')]=function(_0x3c45b2){try{if(!_[_0x11c0('0x15')](queues[_0x3c45b2[_0x11c0('0xc')]])){utils[_0x11c0('0x16')](util[_0x11c0('0x3')](_0x11c0('0x31'),_0x3c45b2['uniqueid']),_0x3c45b2);utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x32'),_0x3c45b2['uniqueid'],queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x1e')],_0x3c45b2[_0x11c0('0x33')],_0x3c45b2[_0x11c0('0x34')]));queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x30')]=!![];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x18')]=utils[_0x11c0('0x12')]();queues[_0x3c45b2['uniqueid']]['holdtime']=utils[_0x11c0('0x35')](queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x18')],queues[_0x3c45b2['uniqueid']][_0x11c0('0x36')]);queues[_0x3c45b2[_0x11c0('0xc')]]['position']=_0x3c45b2['position'];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x37')]=_0x3c45b2['count'];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x33')]=_0x3c45b2[_0x11c0('0x33')];queues[_0x3c45b2[_0x11c0('0xc')]][_0x11c0('0x34')]=_0x3c45b2[_0x11c0('0x34')];}}catch(_0x278405){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x31'),_0x3c45b2[_0x11c0('0xc')]),_0x278405);}};exports['agentconnect']=function(_0x1b4549){try{if(!_[_0x11c0('0x15')](queues[_0x1b4549[_0x11c0('0xc')]])){utils['debug'](util[_0x11c0('0x3')]('[%s][queues][agentconnect]',_0x1b4549[_0x11c0('0xc')]),_0x1b4549);utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x38'),_0x1b4549[_0x11c0('0xc')],queues[_0x1b4549['uniqueid']]['name'],_0x1b4549[_0x11c0('0x39')],_0x1b4549[_0x11c0('0x3a')]));queues[_0x1b4549['uniqueid']][_0x11c0('0x29')]=![];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x29')]=![];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x25')]=null;queues[_0x1b4549['uniqueid']][_0x11c0('0x19')]=![];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x26')]=null;queues[_0x1b4549['uniqueid']][_0x11c0('0x2a')]=null;queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x3b')]=!![];queues[_0x1b4549[_0x11c0('0xc')]]['accountcode']=_0x1b4549[_0x11c0('0x3a')];queues[_0x1b4549[_0x11c0('0xc')]][_0x11c0('0x6')]=_0x1b4549['membername'];}}catch(_0x38e0d9){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x3c'),_0x1b4549['uniqueid']),_0x38e0d9);}};exports[_0x11c0('0x3d')]=function(_0x37428a){try{if(!_['isNil'](queues[_0x37428a['uniqueid']])){if(queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x18')]){utils[_0x11c0('0x16')](util['format'](_0x11c0('0x3e'),_0x37428a[_0x11c0('0xc')]),_0x37428a);queues[_0x37428a['uniqueid']]['queuecallerabandon']=![];queues[_0x37428a[_0x11c0('0xc')]]['queuecallerabandon']=![];queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x25')]=null;queues[_0x37428a[_0x11c0('0xc')]]['queuecallerexit']=![];queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x2a')]=null;queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x3b')]=!![];queues[_0x37428a[_0x11c0('0xc')]]['lastAssignedTo']=_0x37428a[_0x11c0('0x39')];queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x1a')]=!![];queues[_0x37428a['uniqueid']][_0x11c0('0x1b')]=utils['now']();if(_0x37428a[_0x11c0('0x3f')]==_0x11c0('0x40')){if(!queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x40')]){queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x26')]=_0x11c0('0x41');}}else{queues[_0x37428a[_0x11c0('0xc')]]['queuecallerexitreason']=_0x11c0('0x42')+_0x37428a[_0x11c0('0x3f')]['toUpperCase']();}utils['info'](util[_0x11c0('0x3')](_0x11c0('0x43'),_0x37428a['uniqueid'],queues[_0x37428a[_0x11c0('0xc')]]['name'],_0x37428a[_0x11c0('0x39')],queues[_0x37428a[_0x11c0('0xc')]][_0x11c0('0x26')]));writeDB(queues[_0x37428a['uniqueid']]);}}}catch(_0x4c9bf6){utils['error'](util[_0x11c0('0x3')](_0x11c0('0x3e'),_0x37428a[_0x11c0('0xc')]),_0x4c9bf6);}};exports[_0x11c0('0x44')]=function(_0x54ee15){try{if(!_[_0x11c0('0x15')](queues[_0x54ee15[_0x11c0('0x45')]])){utils[_0x11c0('0x16')](util[_0x11c0('0x3')](_0x11c0('0x46'),_0x54ee15[_0x11c0('0xc')]),_0x54ee15);queues[_0x54ee15[_0x11c0('0x45')]]['transfer']=!![];queues[_0x54ee15[_0x11c0('0x45')]][_0x11c0('0x47')]='BLIND';queues[_0x54ee15[_0x11c0('0x45')]]['transferexten']=_0x54ee15[_0x11c0('0x48')];queues[_0x54ee15[_0x11c0('0x45')]][_0x11c0('0x49')]=_0x54ee15[_0x11c0('0x45')];queues[_0x54ee15['transfereeuniqueid']][_0x11c0('0x26')]='BLINDTRANSFER';utils['info'](util[_0x11c0('0x3')](_0x11c0('0x4a'),_0x54ee15['uniqueid'],queues[_0x54ee15[_0x11c0('0x45')]]['name'],_0x54ee15[_0x11c0('0x45')],_0x54ee15[_0x11c0('0x48')]));}}catch(_0x5bc9cc){utils['error'](util[_0x11c0('0x3')](_0x11c0('0x46'),_0x54ee15[_0x11c0('0xc')]),_0x5bc9cc);}};exports[_0x11c0('0x4b')]=function(_0x98288c){try{utils['debug'](util[_0x11c0('0x3')]('[%s][queues][attendedtransfer]',_0x98288c[_0x11c0('0x4c')]),_0x98288c);if(_0x98288c[_0x11c0('0x4c')]==_0x98288c[_0x11c0('0x4d')]){if(!_['isNil'](queues[_0x98288c[_0x11c0('0x4e')]])){utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x4f'),_0x98288c['origtransfereruniqueid'],queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x50')]));queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x40')]=!![];queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x47')]=_0x11c0('0x51');queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x52')]=_0x98288c[_0x11c0('0x50')];queues[_0x98288c['secondtransfererlinkedid']][_0x11c0('0x49')]=_0x98288c['origtransfereruniqueid'];queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x26')]=_0x11c0('0x53');}if(!_['isNil'](queues[_0x98288c['origtransfererlinkedid']])){if(_0x98288c[_0x11c0('0x54')]&&queues[_0x98288c['transfereelinkedid']]){queues[_0x98288c[_0x11c0('0x54')]][_0x11c0('0x20')]=0x1;queues[_0x98288c[_0x11c0('0x45')]]=_[_0x11c0('0x55')](queues[_0x98288c['transfereelinkedid']]);queues[_0x98288c['transfereeuniqueid']][_0x11c0('0xb')]=_0x98288c[_0x11c0('0x56')];queues[_0x98288c[_0x11c0('0x45')]]['queuecallerenterreason']=0x2;queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x7')]=queues[_0x98288c['secondtransfererlinkedid']][_0x11c0('0x7')];queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x57')]=queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0x57')];queues[_0x98288c[_0x11c0('0x45')]]['queuecallerjoinAt']=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x45')]]['queuecallerleaveAt']=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x58')]=0x0;queues[_0x98288c['transfereeuniqueid']]['mohtime']=0x0;utils[_0x11c0('0xf')](util['format'](_0x11c0('0x59'),_0x98288c[_0x11c0('0x4c')],queues[_0x98288c[_0x11c0('0x45')]]['name'],queues[_0x98288c[_0x11c0('0x45')]][_0x11c0('0x7')],queues[_0x98288c['transfereeuniqueid']]['calleridname']));}else{utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x5a'),_0x98288c[_0x11c0('0x4c')],queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x4e')]));queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0xb')]=_0x98288c['secondtransfererlinkedid'];}}}else if(_0x98288c['secondtransfereruniqueid']==_0x98288c[_0x11c0('0x4e')]){if(!_[_0x11c0('0x15')](queues[_0x98288c[_0x11c0('0x4d')]])){utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x5b'),_0x98288c[_0x11c0('0x4c')],queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x5c')],_0x98288c[_0x11c0('0x5d')]));queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x40')]=!![];queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x47')]=_0x11c0('0x51');queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x52')]=_0x98288c[_0x11c0('0x5d')];queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x49')]=_0x98288c[_0x11c0('0x5c')];queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x26')]=_0x11c0('0x53');}if(!_[_0x11c0('0x15')](queues[_0x98288c['secondtransfererlinkedid']])){if(_0x98288c[_0x11c0('0x5e')]&&queues[_0x98288c[_0x11c0('0x5e')]]){queues[_0x98288c[_0x11c0('0x5e')]][_0x11c0('0x20')]=0x1;queues[_0x98288c['transfertargetuniqueid']]=_[_0x11c0('0x55')](queues[_0x98288c['transfertargetlinkedid']]);queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0xb')]=_0x98288c[_0x11c0('0x56')];queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0x20')]=0x2;queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x7')]=queues[_0x98288c[_0x11c0('0x4d')]][_0x11c0('0x7')];queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x57')]=queues[_0x98288c['origtransfererlinkedid']][_0x11c0('0x57')];queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x36')]=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x18')]=utils[_0x11c0('0x12')]();queues[_0x98288c[_0x11c0('0x56')]]['holdtime']=0x0;queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x5f')]=0x0;utils['info'](util[_0x11c0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x98288c[_0x11c0('0x4c')],queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x1e')],queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0xb')],queues[_0x98288c[_0x11c0('0x56')]][_0x11c0('0x7')],queues[_0x98288c['transfertargetuniqueid']][_0x11c0('0x57')]));}else{utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x5a'),_0x98288c['origtransfereruniqueid'],queues[_0x98288c['secondtransfererlinkedid']][_0x11c0('0x1e')],_0x98288c[_0x11c0('0x4d')]));queues[_0x98288c[_0x11c0('0x4e')]][_0x11c0('0xb')]=_0x98288c['origtransfererlinkedid'];}}}}catch(_0x18caa9){utils['error'](util[_0x11c0('0x3')]('[%s][queues][attendedtransfer]',_0x98288c[_0x11c0('0x4c')]),_0x18caa9);}};exports['musiconholdstart']=function(_0x3e4740){try{if(!_['isNil'](queues[_0x3e4740[_0x11c0('0xc')]])){utils['debug'](util['format'](_0x11c0('0x60'),_0x3e4740[_0x11c0('0xc')]),_0x3e4740);queues[_0x3e4740['uniqueid']]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x11c0('0x3')](_0x11c0('0x61'),_0x3e4740[_0x11c0('0xc')],queues[_0x3e4740['uniqueid']][_0x11c0('0x1e')],queues[_0x3e4740[_0x11c0('0xc')]][_0x11c0('0x62')]));}}catch(_0x56698b){utils[_0x11c0('0x13')](util[_0x11c0('0x3')](_0x11c0('0x60'),_0x3e4740[_0x11c0('0xc')]),_0x56698b);}};exports[_0x11c0('0x63')]=function(_0x3bd223){try{if(!_['isNil'](queues[_0x3bd223[_0x11c0('0xc')]])){if(!_['isNil'](queues[_0x3bd223[_0x11c0('0xc')]]['musiconholdstartAt'])){utils[_0x11c0('0x16')](util['format'](_0x11c0('0x64'),_0x3bd223['uniqueid']),_0x3bd223);queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x5f')]+=utils[_0x11c0('0x35')](utils[_0x11c0('0x12')](),queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x62')]);utils[_0x11c0('0xf')](util[_0x11c0('0x3')](_0x11c0('0x65'),_0x3bd223[_0x11c0('0xc')],queues[_0x3bd223['uniqueid']][_0x11c0('0x1e')],queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x5f')]));delete queues[_0x3bd223[_0x11c0('0xc')]][_0x11c0('0x62')];}}}catch(_0x1c5604){utils[_0x11c0('0x13')](util['format'](_0x11c0('0x64'),_0x3bd223[_0x11c0('0xc')]),_0x1c5604);}}; \ No newline at end of file +var _0x5713=['EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','count','connectedlinename','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentconnect]','reason','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfer','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','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]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','variable','value','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5713,0x1c7));var _0x3571=function(_0x40dc32,_0x1e8034){_0x40dc32=_0x40dc32-0x0;var _0x2bfb0=_0x5713[_0x40dc32];return _0x2bfb0;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x2d28f5){utils['info'](util[_0x3571('0x2')](_0x3571('0x3'),_0x2d28f5[_0x3571('0x4')],_0x2d28f5[_0x3571('0x5')],_0x2d28f5['queue'],_0x2d28f5['lastAssignedTo'],_0x2d28f5[_0x3571('0x6')],_0x2d28f5[_0x3571('0x7')],_0x2d28f5[_0x3571('0x8')]));if(_0x2d28f5[_0x3571('0x9')]){utils[_0x3571('0xa')](_0x2d28f5[_0x3571('0x9')])['then'](function(_0x358ba1){if(_0x358ba1){_0x2d28f5[_0x3571('0xb')]=_0x358ba1[_0x3571('0xb')];}utils[_0x3571('0xc')](_0x3571('0xd'),_0x2d28f5);});}else{utils['request']('CreateVoiceQueueReport',_0x2d28f5);}if(_0x2d28f5[_0x3571('0xe')]){delete queues[_0x2d28f5[_0x3571('0xe')]];}else{delete queues[_0x2d28f5[_0x3571('0x4')]];}}exports['queuecallerjoin']=function(_0x57573f){try{utils['debug'](util['format'](_0x3571('0xf'),_0x57573f[_0x3571('0x4')]),_0x57573f);utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x11'),_0x57573f[_0x3571('0x4')],_0x57573f[_0x3571('0x9')],_0x57573f[_0x3571('0x12')]));queues[_0x57573f[_0x3571('0x4')]]=_[_0x3571('0x13')](_0x57573f,{'originalposition':_0x57573f[_0x3571('0x12')],'queuecallerjoinAt':utils[_0x3571('0x14')](),'mohtime':0x0});}catch(_0x17cf63){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0xf'),_0x57573f['uniqueid']),_0x17cf63);}};exports['hangup']=function(_0x48c77e){try{if(!_[_0x3571('0x16')](queues[_0x48c77e['uniqueid']])){utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][hangup]',_0x48c77e[_0x3571('0x4')]),_0x48c77e);if(queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x18')]){if(!queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x19')]&&!queues[_0x48c77e[_0x3571('0x4')]]['queuecallerexit']){queues[_0x48c77e[_0x3571('0x4')]]['queuecallercomplete']=!![];queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x1a')]=utils['now']();queues[_0x48c77e['uniqueid']]['queuecallerexitreason']=_0x3571('0x1b');}utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x1c'),_0x48c77e[_0x3571('0x4')],queues[_0x48c77e['uniqueid']][_0x3571('0x1d')],queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0x8')]));writeDB(queues[_0x48c77e[_0x3571('0x4')]]);}else if(queues[_0x48c77e[_0x3571('0x4')]]['transfereduniqueid']){utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x48c77e[_0x3571('0x4')],queues[_0x48c77e['uniqueid']][_0x3571('0x1d')],queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0xe')]));queues[queues[_0x48c77e[_0x3571('0x4')]][_0x3571('0xe')]]=queues[_0x48c77e[_0x3571('0x4')]];queues[queues[_0x48c77e[_0x3571('0x4')]]['transfereduniqueid']][_0x3571('0x1e')]=0x2;delete queues[_0x48c77e[_0x3571('0x4')]];}}}catch(_0x7341f0){utils['error'](util['format']('[%s][queues][hangup]',_0x48c77e[_0x3571('0x4')]),_0x7341f0);}};exports['varset']=function(_0x288191){try{utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][varset]',_0x288191['uniqueid']),_0x288191);if(!_[_0x3571('0x16')](_0x288191[_0x3571('0x1f')]['queuestatus'])&&_0x288191[_0x3571('0x20')]['toUpperCase']()!==_0x3571('0x21')){if(!_[_0x3571('0x16')](queues[_0x288191[_0x3571('0x4')]])){queues[_0x288191[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x288191[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x288191['uniqueid']][_0x3571('0x23')]=!![];queues[_0x288191[_0x3571('0x4')]][_0x3571('0x24')]=utils[_0x3571('0x14')]();queues[_0x288191['uniqueid']][_0x3571('0x8')]=_0x288191['value'][_0x3571('0x25')]();utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x26'),_0x288191[_0x3571('0x4')],queues[_0x288191['uniqueid']]['name'],_0x288191['value'],queues[_0x288191['uniqueid']][_0x3571('0x8')]));writeDB(queues[_0x288191['uniqueid']]);}}else if(!_[_0x3571('0x16')](_0x288191[_0x3571('0x1f')][_0x3571('0x27')])){if(!_[_0x3571('0x16')](queues[_0x288191[_0x3571('0x4')]])&&!queues[_0x288191[_0x3571('0x4')]][_0x3571('0x19')]){queues[_0x288191['uniqueid']][_0x3571('0x19')]=![];queues[_0x288191[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x288191[_0x3571('0x4')]][_0x3571('0x23')]=!![];queues[_0x288191['uniqueid']][_0x3571('0x24')]=utils[_0x3571('0x14')]();queues[_0x288191[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x28');utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x288191[_0x3571('0x4')],queues[_0x288191['uniqueid']][_0x3571('0x1d')],_0x288191[_0x3571('0x20')],queues[_0x288191[_0x3571('0x4')]][_0x3571('0x8')]));}}}catch(_0x22c207){utils[_0x3571('0x15')](util['format'](_0x3571('0x29'),_0x288191[_0x3571('0x4')]),_0x22c207);}};exports['queuecallerabandon']=function(_0x4a7d4e){try{if(!_[_0x3571('0x16')](queues[_0x4a7d4e[_0x3571('0x4')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')](_0x3571('0x2a'),_0x4a7d4e[_0x3571('0x4')]),_0x4a7d4e);queues[_0x4a7d4e['uniqueid']][_0x3571('0x23')]=![];queues[_0x4a7d4e[_0x3571('0x4')]][_0x3571('0x24')]=null;queues[_0x4a7d4e['uniqueid']][_0x3571('0x19')]=!![];queues[_0x4a7d4e['uniqueid']][_0x3571('0x22')]=utils['now']();queues[_0x4a7d4e[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x2b');utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x2c'),_0x4a7d4e[_0x3571('0x4')],queues[_0x4a7d4e[_0x3571('0x4')]]['name'],queues[_0x4a7d4e['uniqueid']][_0x3571('0x8')]));}}catch(_0x4091c2){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x2a'),_0x4a7d4e[_0x3571('0x4')]),_0x4091c2);}};exports[_0x3571('0x2d')]=function(_0x48813c){try{if(!_['isNil'](queues[_0x48813c[_0x3571('0x4')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')](_0x3571('0x2e'),_0x48813c[_0x3571('0x4')]),_0x48813c);utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x2f'),_0x48813c[_0x3571('0x4')],queues[_0x48813c[_0x3571('0x4')]]['name'],_0x48813c[_0x3571('0x30')],_0x48813c['connectedlinename']));queues[_0x48813c[_0x3571('0x4')]][_0x3571('0x2d')]=!![];queues[_0x48813c[_0x3571('0x4')]]['queuecallerleaveAt']=utils[_0x3571('0x14')]();queues[_0x48813c[_0x3571('0x4')]][_0x3571('0x31')]=utils[_0x3571('0x32')](queues[_0x48813c[_0x3571('0x4')]][_0x3571('0x18')],queues[_0x48813c[_0x3571('0x4')]]['queuecallerjoinAt']);queues[_0x48813c[_0x3571('0x4')]]['position']=_0x48813c[_0x3571('0x12')];queues[_0x48813c['uniqueid']][_0x3571('0x33')]=_0x48813c[_0x3571('0x33')];queues[_0x48813c['uniqueid']][_0x3571('0x30')]=_0x48813c[_0x3571('0x30')];queues[_0x48813c['uniqueid']]['connectedlinename']=_0x48813c[_0x3571('0x34')];}}catch(_0x311834){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x2e'),_0x48813c[_0x3571('0x4')]),_0x311834);}};exports['agentconnect']=function(_0x382d88){try{if(!_[_0x3571('0x16')](queues[_0x382d88[_0x3571('0x4')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][agentconnect]',_0x382d88[_0x3571('0x4')]),_0x382d88);utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x35'),_0x382d88[_0x3571('0x4')],queues[_0x382d88[_0x3571('0x4')]]['name'],_0x382d88[_0x3571('0x36')],_0x382d88[_0x3571('0x37')]));queues[_0x382d88[_0x3571('0x4')]]['queuecallerabandon']=![];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x382d88['uniqueid']]['queuecallerexit']=![];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x8')]=null;queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x24')]=null;queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x38')]=!![];queues[_0x382d88['uniqueid']]['accountcode']=_0x382d88[_0x3571('0x37')];queues[_0x382d88[_0x3571('0x4')]][_0x3571('0x39')]=_0x382d88[_0x3571('0x36')];}}catch(_0x3d6e18){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x3a'),_0x382d88[_0x3571('0x4')]),_0x3d6e18);}};exports['agentcomplete']=function(_0x1e35c8){try{if(!_[_0x3571('0x16')](queues[_0x1e35c8[_0x3571('0x4')]])){if(queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x18')]){utils[_0x3571('0x17')](util['format']('[%s][queues][agentcomplete]',_0x1e35c8['uniqueid']),_0x1e35c8);queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x19')]=![];queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x22')]=null;queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x23')]=![];queues[_0x1e35c8['uniqueid']][_0x3571('0x24')]=null;queues[_0x1e35c8['uniqueid']]['assigned']=!![];queues[_0x1e35c8[_0x3571('0x4')]]['lastAssignedTo']=_0x1e35c8['membername'];queues[_0x1e35c8[_0x3571('0x4')]]['queuecallercomplete']=!![];queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x1a')]=utils[_0x3571('0x14')]();if(_0x1e35c8[_0x3571('0x3b')]=='transfer'){if(!queues[_0x1e35c8[_0x3571('0x4')]]['transfer']){queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x3c');}}else{queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x8')]=_0x3571('0x3d')+_0x1e35c8[_0x3571('0x3b')][_0x3571('0x25')]();}utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1e35c8[_0x3571('0x4')],queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x1d')],_0x1e35c8[_0x3571('0x36')],queues[_0x1e35c8[_0x3571('0x4')]][_0x3571('0x8')]));writeDB(queues[_0x1e35c8['uniqueid']]);}}}catch(_0x1a5b29){utils['error'](util[_0x3571('0x2')](_0x3571('0x3e'),_0x1e35c8[_0x3571('0x4')]),_0x1a5b29);}};exports[_0x3571('0x3f')]=function(_0x1c817a){try{if(!_['isNil'](queues[_0x1c817a[_0x3571('0x40')]])){utils[_0x3571('0x17')](util[_0x3571('0x2')]('[%s][queues][blindtransfer]',_0x1c817a[_0x3571('0x4')]),_0x1c817a);queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x41')]=!![];queues[_0x1c817a[_0x3571('0x40')]]['transfertype']=_0x3571('0x42');queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x43')]=_0x1c817a[_0x3571('0x44')];queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x45')]=_0x1c817a[_0x3571('0x40')];queues[_0x1c817a[_0x3571('0x40')]][_0x3571('0x8')]=_0x3571('0x46');utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x47'),_0x1c817a[_0x3571('0x4')],queues[_0x1c817a[_0x3571('0x40')]]['name'],_0x1c817a[_0x3571('0x40')],_0x1c817a['extension']));}}catch(_0x1b6021){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x48'),_0x1c817a[_0x3571('0x4')]),_0x1b6021);}};exports[_0x3571('0x49')]=function(_0x5429ac){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x5429ac['origtransfereruniqueid']),_0x5429ac);if(_0x5429ac[_0x3571('0x4a')]==_0x5429ac['origtransfererlinkedid']){if(!_['isNil'](queues[_0x5429ac[_0x3571('0x4b')]])){utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x4c'),_0x5429ac['origtransfereruniqueid'],queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x1d')],_0x5429ac['origtransfererexten']));queues[_0x5429ac['secondtransfererlinkedid']][_0x3571('0x41')]=!![];queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x4d')]=_0x3571('0x4e');queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x43')]=_0x5429ac['origtransfererexten'];queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x45')]=_0x5429ac['origtransfereruniqueid'];queues[_0x5429ac['secondtransfererlinkedid']]['queuecallerexitreason']=_0x3571('0x4f');}if(!_[_0x3571('0x16')](queues[_0x5429ac[_0x3571('0x50')]])){if(_0x5429ac[_0x3571('0x51')]&&queues[_0x5429ac['transfereelinkedid']]){queues[_0x5429ac[_0x3571('0x51')]]['queuecallerenterreason']=0x1;queues[_0x5429ac['transfereeuniqueid']]=_[_0x3571('0x52')](queues[_0x5429ac['transfereelinkedid']]);queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0xe')]=_0x5429ac[_0x3571('0x53')];queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x1e')]=0x2;queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x6')]=queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x6')];queues[_0x5429ac['transfereeuniqueid']]['calleridname']=queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0x54')];queues[_0x5429ac['transfereeuniqueid']][_0x3571('0x55')]=utils[_0x3571('0x14')]();queues[_0x5429ac['transfereeuniqueid']][_0x3571('0x18')]=utils['now']();queues[_0x5429ac['transfereeuniqueid']]['holdtime']=0x0;queues[_0x5429ac['transfereeuniqueid']][_0x3571('0x56')]=0x0;utils[_0x3571('0x10')](util[_0x3571('0x2')](_0x3571('0x57'),_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x1d')],queues[_0x5429ac[_0x3571('0x40')]]['calleridnum'],queues[_0x5429ac[_0x3571('0x40')]][_0x3571('0x54')]));}else{utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x1d')],_0x5429ac[_0x3571('0x4b')]));queues[_0x5429ac['origtransfererlinkedid']][_0x3571('0xe')]=_0x5429ac[_0x3571('0x4b')];}}}else if(_0x5429ac[_0x3571('0x58')]==_0x5429ac[_0x3571('0x4b')]){if(!_[_0x3571('0x16')](queues[_0x5429ac['origtransfererlinkedid']])){utils[_0x3571('0x10')](util['format'](_0x3571('0x59'),_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x1d')],_0x5429ac['secondtransfereruniqueid'],_0x5429ac[_0x3571('0x5a')]));queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x41')]=!![];queues[_0x5429ac['origtransfererlinkedid']][_0x3571('0x4d')]='ATTENDED';queues[_0x5429ac[_0x3571('0x50')]]['transferexten']=_0x5429ac[_0x3571('0x5a')];queues[_0x5429ac[_0x3571('0x50')]]['transferuniqueid']=_0x5429ac['secondtransfereruniqueid'];queues[_0x5429ac['origtransfererlinkedid']][_0x3571('0x8')]=_0x3571('0x4f');}if(!_['isNil'](queues[_0x5429ac[_0x3571('0x4b')]])){if(_0x5429ac[_0x3571('0x5b')]&&queues[_0x5429ac[_0x3571('0x5b')]]){queues[_0x5429ac[_0x3571('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x5429ac[_0x3571('0x53')]]=_['clone'](queues[_0x5429ac[_0x3571('0x5b')]]);queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0xe')]=_0x5429ac[_0x3571('0x53')];queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x1e')]=0x2;queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x6')]=queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x6')];queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x54')]=queues[_0x5429ac[_0x3571('0x50')]][_0x3571('0x54')];queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x55')]=utils[_0x3571('0x14')]();queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x18')]=utils[_0x3571('0x14')]();queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x31')]=0x0;queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x56')]=0x0;utils[_0x3571('0x10')](util[_0x3571('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac['transfertargetuniqueid']][_0x3571('0x1d')],queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0xe')],queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x6')],queues[_0x5429ac[_0x3571('0x53')]][_0x3571('0x54')]));}else{utils[_0x3571('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5429ac[_0x3571('0x4a')],queues[_0x5429ac[_0x3571('0x4b')]]['name'],_0x5429ac[_0x3571('0x50')]));queues[_0x5429ac[_0x3571('0x4b')]][_0x3571('0xe')]=_0x5429ac[_0x3571('0x50')];}}}}catch(_0x39b950){utils['error'](util['format'](_0x3571('0x5c'),_0x5429ac[_0x3571('0x4a')]),_0x39b950);}};exports[_0x3571('0x5d')]=function(_0x4496a7){try{if(!_[_0x3571('0x16')](queues[_0x4496a7['uniqueid']])){utils[_0x3571('0x17')](util['format'](_0x3571('0x5e'),_0x4496a7[_0x3571('0x4')]),_0x4496a7);queues[_0x4496a7['uniqueid']][_0x3571('0x5f')]=utils[_0x3571('0x14')]();utils['info'](util[_0x3571('0x2')](_0x3571('0x60'),_0x4496a7[_0x3571('0x4')],queues[_0x4496a7['uniqueid']][_0x3571('0x1d')],queues[_0x4496a7['uniqueid']][_0x3571('0x5f')]));}}catch(_0x3ac00f){utils['error'](util['format'](_0x3571('0x5e'),_0x4496a7['uniqueid']),_0x3ac00f);}};exports[_0x3571('0x61')]=function(_0x4e4cab){try{if(!_['isNil'](queues[_0x4e4cab[_0x3571('0x4')]])){if(!_[_0x3571('0x16')](queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x5f')])){utils[_0x3571('0x17')](util['format'](_0x3571('0x62'),_0x4e4cab[_0x3571('0x4')]),_0x4e4cab);queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x56')]+=utils[_0x3571('0x32')](utils[_0x3571('0x14')](),queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x5f')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4e4cab['uniqueid'],queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x1d')],queues[_0x4e4cab['uniqueid']][_0x3571('0x56')]));delete queues[_0x4e4cab[_0x3571('0x4')]][_0x3571('0x5f')];}}}catch(_0x580f66){utils[_0x3571('0x15')](util[_0x3571('0x2')](_0x3571('0x62'),_0x4e4cab[_0x3571('0x4')]),_0x580f66);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 805df71..6b137e2 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 _0x2394=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','channel','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','clone','[%s][recordings][newexten]','application','set','appdata','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','lodash','info','format','[%s][recordings][writeDB]','getUserByInternal','accountcode','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x2394,0x1f4));var _0x4239=function(_0x8929a1,_0x25516b){_0x8929a1=_0x8929a1-0x0;var _0x5102cc=_0x2394[_0x8929a1];return _0x5102cc;};'use strict';var _=require(_0x4239('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x257e2a){utils[_0x4239('0x1')](util[_0x4239('0x2')](_0x4239('0x3'),_0x257e2a['uniqueid']));if(_0x257e2a['accountcode']){utils[_0x4239('0x4')](_0x257e2a[_0x4239('0x5')])['then'](function(_0x3d6d9e){if(_0x3d6d9e){_0x257e2a[_0x4239('0x6')]=_0x3d6d9e[_0x4239('0x7')];_0x257e2a['UserId']=_0x3d6d9e['id'];}utils[_0x4239('0x8')](_0x4239('0x9'),_0x257e2a);});}else{utils[_0x4239('0x8')](_0x4239('0x9'),_0x257e2a);}}exports[_0x4239('0xa')]=function(_0x2cd5b4){try{utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0xc'),_0x2cd5b4['uniqueid']),_0x2cd5b4);if(_0x2cd5b4[_0x4239('0xd')]==_0x2cd5b4['linkedid']){utils[_0x4239('0x1')](util['format'](_0x4239('0xe'),_0x2cd5b4[_0x4239('0xd')],_0x2cd5b4['context'],_0x2cd5b4[_0x4239('0xf')]));recordings[_0x2cd5b4[_0x4239('0xd')]]={'uniqueid':_0x2cd5b4[_0x4239('0xd')],'accountcode':_0x2cd5b4['accountcode'],'exten':_0x2cd5b4[_0x4239('0xf')],'context':_0x2cd5b4['context'],'channel':_0x2cd5b4['channel'],'monitors':[]};}}catch(_0x5656ac){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0xc'),_0x2cd5b4[_0x4239('0xd')]),_0x5656ac);}};exports['newstate']=function(_0x3a21c4){try{utils['debug'](util[_0x4239('0x2')](_0x4239('0x11'),_0x3a21c4[_0x4239('0xd')]),_0x3a21c4);if(!_[_0x4239('0x12')](recordings[_0x3a21c4['uniqueid']])&&_0x3a21c4[_0x4239('0x13')]==0x6){utils['info'](util[_0x4239('0x2')](_0x4239('0x14'),_0x3a21c4[_0x4239('0xd')],_0x3a21c4[_0x4239('0x15')],_0x3a21c4['channel']));}else if(!_[_0x4239('0x12')](recordings[_0x3a21c4['linkedid']])&&_0x3a21c4[_0x4239('0x13')]==0x6&&_0x3a21c4[_0x4239('0x15')]!=_0x4239('0x16')){utils[_0x4239('0x1')](util['format'](_0x4239('0x17'),_0x3a21c4[_0x4239('0xd')],_0x3a21c4[_0x4239('0x18')],_0x3a21c4[_0x4239('0x15')],_0x3a21c4[_0x4239('0x19')]));recordings[_0x3a21c4[_0x4239('0x18')]]['accountcode']=_0x3a21c4[_0x4239('0x5')];}}catch(_0x18f10d){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0x11'),_0x3a21c4[_0x4239('0xd')]),_0x18f10d);}};exports[_0x4239('0x1a')]=function(_0x48dc28){try{if(!_[_0x4239('0x12')](_0x48dc28['variable'])&&!_[_0x4239('0x12')](_0x48dc28[_0x4239('0x1b')][_0x4239('0x1c')])){utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0x1d'),_0x48dc28[_0x4239('0xd')]),_0x48dc28);utils[_0x4239('0x1')](util[_0x4239('0x2')](_0x4239('0x1e'),_0x48dc28[_0x4239('0xd')],_0x48dc28[_0x4239('0x1b')],_0x48dc28['value']));if(_[_0x4239('0x1f')](_0x48dc28[_0x4239('0x20')],_0x4239('0x21'))){_0x48dc28[_0x4239('0x20')]=_0x48dc28[_0x4239('0x20')][_0x4239('0x22')](_0x4239('0x21'),_0x4239('0x23'));}if(recordings[_0x48dc28[_0x4239('0x18')]]){var _0x3312d8=_[_0x4239('0x24')](recordings[_0x48dc28[_0x4239('0x18')]]['monitors'],{'value':_0x48dc28[_0x4239('0x20')]});if(_[_0x4239('0x12')](_0x3312d8)){recordings[_0x48dc28[_0x4239('0x18')]]['monitors'][_0x4239('0x25')]({'value':_0x48dc28['value']});}}}}catch(_0x431289){utils[_0x4239('0x10')](util['format'](_0x4239('0x1d'),_0x48dc28[_0x4239('0xd')]),_0x431289);}};exports['hangup']=function(_0x27b830){try{if(!_[_0x4239('0x12')](recordings[_0x27b830[_0x4239('0xd')]])){utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0x26'),_0x27b830[_0x4239('0xd')]),_0x27b830);utils[_0x4239('0x1')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x27b830[_0x4239('0xd')],_0x27b830[_0x4239('0x27')],_0x27b830[_0x4239('0x28')],_0x27b830[_0x4239('0x29')]));recordings[_0x27b830[_0x4239('0xd')]]['calleridnum']=_0x27b830[_0x4239('0x27')];recordings[_0x27b830[_0x4239('0xd')]][_0x4239('0x28')]=_0x27b830[_0x4239('0x28')];recordings[_0x27b830['uniqueid']][_0x4239('0x2a')]=_0x27b830[_0x4239('0x2a')];recordings[_0x27b830['uniqueid']][_0x4239('0x2b')]=_0x27b830['connectedlinename'];if(recordings[_0x27b830['uniqueid']][_0x4239('0x2c')]==_0x4239('0x2d')&&recordings[_0x27b830[_0x4239('0xd')]][_0x4239('0x5')]){recordings[_0x27b830[_0x4239('0xd')]]['connectedlinenum']=recordings[_0x27b830['uniqueid']]['accountcode'];recordings[_0x27b830[_0x4239('0xd')]][_0x4239('0x2b')]='';}recordings[_0x27b830['uniqueid']][_0x4239('0x2e')][_0x4239('0x2f')](function(_0xa866ef){var _0x37b8c9=_[_0x4239('0x30')](recordings[_0x27b830['uniqueid']]);_0x37b8c9['value']=_0xa866ef['value'];writeDB(_0x37b8c9);});delete recordings[_0x27b830[_0x4239('0xd')]];}}catch(_0x555b16){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0x26'),_0x27b830[_0x4239('0xd')]),_0x555b16);}};exports['newexten']=function(_0x338095){try{if(!_[_0x4239('0x12')](recordings[_0x338095[_0x4239('0xd')]])){utils[_0x4239('0xb')](util['format'](_0x4239('0x31'),_0x338095[_0x4239('0xd')]),_0x338095);utils[_0x4239('0x1')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x338095[_0x4239('0xd')],_0x338095['application'],_0x338095['appdata']));if(_0x338095[_0x4239('0x32')]['toLowerCase']()==_0x4239('0x33')&&_['startsWith'](_0x338095[_0x4239('0x34')]['toLowerCase'](),_0x4239('0x35'))){var _0x1f6322=_0x338095[_0x4239('0x34')][_0x4239('0x36')]('=');var _0x110295=_0x1f6322[0x0]['substring'](_0x1f6322[0x0]['lastIndexOf']('(')+0x1,_0x1f6322[0x0][_0x4239('0x37')](')'));var _0x1f63b1=_0x1f6322[0x1];recordings[_0x338095['uniqueid']][_0x110295]=_0x1f63b1;}}}catch(_0x54c36b){utils[_0x4239('0x10')](util['format'](_0x4239('0x31'),_0x338095['uniqueid']),_0x54c36b);}};exports['queuecallerjoin']=function(_0x4ccd90){try{if(!_[_0x4239('0x12')](recordings[_0x4ccd90[_0x4239('0xd')]])){utils[_0x4239('0xb')](util[_0x4239('0x2')](_0x4239('0x38'),_0x4ccd90['uniqueid']),_0x4ccd90);utils[_0x4239('0x1')](util[_0x4239('0x2')](_0x4239('0x39'),_0x4ccd90[_0x4239('0xd')],_0x4ccd90['queue']));recordings[_0x4ccd90['uniqueid']]['queue']=_0x4ccd90['queue'];}}catch(_0x1c98a6){utils[_0x4239('0x10')](util[_0x4239('0x2')](_0x4239('0x38'),_0x4ccd90[_0x4239('0xd')]),_0x1c98a6);}}; \ No newline at end of file +var _0x9ddd=['util','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','format','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','application','appdata','set','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash'];(function(_0x2445f4,_0x5bc366){var _0x3e5674=function(_0x411653){while(--_0x411653){_0x2445f4['push'](_0x2445f4['shift']());}};_0x3e5674(++_0x5bc366);}(_0x9ddd,0xbc));var _0xd9dd=function(_0x5e9792,_0xf4b6b){_0x5e9792=_0x5e9792-0x0;var _0x1134dc=_0x9ddd[_0x5e9792];return _0x1134dc;};'use strict';var _=require(_0xd9dd('0x0'));var util=require(_0xd9dd('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x1cf37d){utils[_0xd9dd('0x2')](util['format'](_0xd9dd('0x3'),_0x1cf37d['uniqueid']));if(_0x1cf37d[_0xd9dd('0x4')]){utils[_0xd9dd('0x5')](_0x1cf37d[_0xd9dd('0x4')])[_0xd9dd('0x6')](function(_0x18dc2b){if(_0x18dc2b){_0x1cf37d[_0xd9dd('0x7')]=_0x18dc2b[_0xd9dd('0x8')];_0x1cf37d[_0xd9dd('0x9')]=_0x18dc2b['id'];}utils['request'](_0xd9dd('0xa'),_0x1cf37d);});}else{utils[_0xd9dd('0xb')](_0xd9dd('0xa'),_0x1cf37d);}}exports[_0xd9dd('0xc')]=function(_0x412b94){try{utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0xf'),_0x412b94[_0xd9dd('0x10')]),_0x412b94);if(_0x412b94[_0xd9dd('0x10')]==_0x412b94['linkedid']){utils['info'](util['format'](_0xd9dd('0x11'),_0x412b94[_0xd9dd('0x10')],_0x412b94[_0xd9dd('0x12')],_0x412b94[_0xd9dd('0x13')]));recordings[_0x412b94[_0xd9dd('0x10')]]={'uniqueid':_0x412b94[_0xd9dd('0x10')],'accountcode':_0x412b94['accountcode'],'exten':_0x412b94[_0xd9dd('0x13')],'context':_0x412b94[_0xd9dd('0x12')],'channel':_0x412b94[_0xd9dd('0x14')],'monitors':[]};}}catch(_0x4d8a5e){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')]('[%s][recordings][newchannel]',_0x412b94['uniqueid']),_0x4d8a5e);}};exports[_0xd9dd('0x16')]=function(_0x141190){try{utils['debug'](util[_0xd9dd('0xe')](_0xd9dd('0x17'),_0x141190['uniqueid']),_0x141190);if(!_[_0xd9dd('0x18')](recordings[_0x141190[_0xd9dd('0x10')]])&&_0x141190[_0xd9dd('0x19')]==0x6){utils[_0xd9dd('0x2')](util['format'](_0xd9dd('0x1a'),_0x141190[_0xd9dd('0x10')],_0x141190[_0xd9dd('0x12')],_0x141190[_0xd9dd('0x14')]));}else if(!_['isNil'](recordings[_0x141190[_0xd9dd('0x1b')]])&&_0x141190['channelstate']==0x6&&_0x141190[_0xd9dd('0x12')]!=_0xd9dd('0x1c')){utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x1d'),_0x141190['uniqueid'],_0x141190[_0xd9dd('0x1b')],_0x141190[_0xd9dd('0x12')],_0x141190['channel']));recordings[_0x141190[_0xd9dd('0x1b')]]['accountcode']=_0x141190[_0xd9dd('0x4')];}}catch(_0x5f5091){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')]('[%s][recordings][newstate]',_0x141190[_0xd9dd('0x10')]),_0x5f5091);}};exports[_0xd9dd('0x1e')]=function(_0x5a2938){try{if(!_['isNil'](_0x5a2938[_0xd9dd('0x1f')])&&!_['isNil'](_0x5a2938[_0xd9dd('0x1f')][_0xd9dd('0x20')])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0x21'),_0x5a2938[_0xd9dd('0x10')]),_0x5a2938);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x22'),_0x5a2938[_0xd9dd('0x10')],_0x5a2938[_0xd9dd('0x1f')],_0x5a2938[_0xd9dd('0x23')]));if(_[_0xd9dd('0x24')](_0x5a2938[_0xd9dd('0x23')],_0xd9dd('0x25'))){_0x5a2938['value']=_0x5a2938[_0xd9dd('0x23')]['replace'](_0xd9dd('0x25'),_0xd9dd('0x26'));}if(recordings[_0x5a2938[_0xd9dd('0x1b')]]){var _0x3ed9c1=_[_0xd9dd('0x27')](recordings[_0x5a2938['linkedid']][_0xd9dd('0x28')],{'value':_0x5a2938[_0xd9dd('0x23')]});if(_[_0xd9dd('0x18')](_0x3ed9c1)){recordings[_0x5a2938[_0xd9dd('0x1b')]][_0xd9dd('0x28')][_0xd9dd('0x29')]({'value':_0x5a2938['value']});}}}}catch(_0x4aa64e){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')](_0xd9dd('0x21'),_0x5a2938['uniqueid']),_0x4aa64e);}};exports[_0xd9dd('0x2a')]=function(_0x530bbd){try{if(!_[_0xd9dd('0x18')](recordings[_0x530bbd['uniqueid']])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0x2b'),_0x530bbd[_0xd9dd('0x10')]),_0x530bbd);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x2c'),_0x530bbd['uniqueid'],_0x530bbd['calleridnum'],_0x530bbd[_0xd9dd('0x2d')],_0x530bbd['cause-txt']));recordings[_0x530bbd['uniqueid']][_0xd9dd('0x2e')]=_0x530bbd['calleridnum'];recordings[_0x530bbd['uniqueid']][_0xd9dd('0x2d')]=_0x530bbd[_0xd9dd('0x2d')];recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x2f')]=_0x530bbd[_0xd9dd('0x2f')];recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x30')]=_0x530bbd[_0xd9dd('0x30')];if(recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x31')]==_0xd9dd('0x32')&&recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x4')]){recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x2f')]=recordings[_0x530bbd[_0xd9dd('0x10')]]['accountcode'];recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x30')]='';}recordings[_0x530bbd[_0xd9dd('0x10')]][_0xd9dd('0x28')][_0xd9dd('0x33')](function(_0x11157b){var _0x1bdd03=_[_0xd9dd('0x34')](recordings[_0x530bbd[_0xd9dd('0x10')]]);_0x1bdd03[_0xd9dd('0x23')]=_0x11157b[_0xd9dd('0x23')];writeDB(_0x1bdd03);});delete recordings[_0x530bbd[_0xd9dd('0x10')]];}}catch(_0x2828bb){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')](_0xd9dd('0x2b'),_0x530bbd[_0xd9dd('0x10')]),_0x2828bb);}};exports[_0xd9dd('0x35')]=function(_0x137495){try{if(!_[_0xd9dd('0x18')](recordings[_0x137495['uniqueid']])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')]('[%s][recordings][newexten]',_0x137495['uniqueid']),_0x137495);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x137495[_0xd9dd('0x10')],_0x137495[_0xd9dd('0x36')],_0x137495[_0xd9dd('0x37')]));if(_0x137495[_0xd9dd('0x36')]['toLowerCase']()==_0xd9dd('0x38')&&_['startsWith'](_0x137495['appdata']['toLowerCase'](),'cdr')){var _0x3dbc5e=_0x137495[_0xd9dd('0x37')]['split']('=');var _0x5b2e43=_0x3dbc5e[0x0][_0xd9dd('0x39')](_0x3dbc5e[0x0]['lastIndexOf']('(')+0x1,_0x3dbc5e[0x0][_0xd9dd('0x3a')](')'));var _0xa0e39d=_0x3dbc5e[0x1];recordings[_0x137495[_0xd9dd('0x10')]][_0x5b2e43]=_0xa0e39d;}}}catch(_0xf9faf9){utils[_0xd9dd('0x15')](util[_0xd9dd('0xe')](_0xd9dd('0x3b'),_0x137495['uniqueid']),_0xf9faf9);}};exports['queuecallerjoin']=function(_0xe76b48){try{if(!_[_0xd9dd('0x18')](recordings[_0xe76b48[_0xd9dd('0x10')]])){utils[_0xd9dd('0xd')](util[_0xd9dd('0xe')](_0xd9dd('0x3c'),_0xe76b48['uniqueid']),_0xe76b48);utils[_0xd9dd('0x2')](util[_0xd9dd('0xe')](_0xd9dd('0x3d'),_0xe76b48[_0xd9dd('0x10')],_0xe76b48[_0xd9dd('0x3e')]));recordings[_0xe76b48['uniqueid']]['queue']=_0xe76b48[_0xd9dd('0x3e')];}}catch(_0x123ff2){utils[_0xd9dd('0x15')](util['format']('[%s][recordings][queuecallerjoin]',_0xe76b48['uniqueid']),_0x123ff2);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f0a50d2..c638faf 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 _0xcd76=['blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport'];(function(_0x11fbaa,_0x52dc16){var _0x1831fd=function(_0x2bbced){while(--_0x2bbced){_0x11fbaa['push'](_0x11fbaa['shift']());}};_0x1831fd(++_0x52dc16);}(_0xcd76,0x1a2));var _0x6cd7=function(_0x155c6d,_0x3f202d){_0x155c6d=_0x155c6d-0x0;var _0x5970f0=_0xcd76[_0x155c6d];return _0x5970f0;};'use strict';var _=require(_0x6cd7('0x0'));var util=require(_0x6cd7('0x1'));var utils=require(_0x6cd7('0x2'));function writeDB(_0x2a65ac){utils[_0x6cd7('0x3')](util[_0x6cd7('0x4')](_0x6cd7('0x5'),_0x2a65ac[_0x6cd7('0x6')]===_0x6cd7('0x7')?_0x2a65ac[_0x6cd7('0x8')]:_0x2a65ac[_0x6cd7('0x9')],_0x2a65ac[_0x6cd7('0x6')]));utils[_0x6cd7('0xa')](_0x6cd7('0xb'),_0x2a65ac);}exports[_0x6cd7('0xc')]=function(_0x45ee69){try{utils[_0x6cd7('0xd')](util[_0x6cd7('0x4')](_0x6cd7('0xe'),_0x45ee69[_0x6cd7('0x9')]),_0x45ee69);utils[_0x6cd7('0x3')](util[_0x6cd7('0x4')](_0x6cd7('0xf'),_0x45ee69['uniqueid'],_0x45ee69[_0x6cd7('0x10')],_0x45ee69[_0x6cd7('0x11')],_0x45ee69[_0x6cd7('0x12')],_0x45ee69[_0x6cd7('0x13')]));_0x45ee69[_0x6cd7('0x6')]=_0x6cd7('0x14');writeDB(_0x45ee69);}catch(_0x169cc2){utils[_0x6cd7('0x15')](util['format'](_0x6cd7('0xe'),_0x45ee69['uniqueid']),_0x169cc2);}};exports[_0x6cd7('0x16')]=function(_0x33ef79){try{utils[_0x6cd7('0xd')](util[_0x6cd7('0x4')](_0x6cd7('0x17'),_0x33ef79[_0x6cd7('0x8')]),_0x33ef79);utils['info'](util['format'](_0x6cd7('0x18'),_0x33ef79[_0x6cd7('0x8')],_0x33ef79[_0x6cd7('0x19')],_0x33ef79[_0x6cd7('0x1a')],_0x33ef79[_0x6cd7('0x1b')],_0x33ef79[_0x6cd7('0x1c')]));_0x33ef79=_[_0x6cd7('0x1d')](_0x33ef79,{'transfererchannel':_0x33ef79[_0x6cd7('0x1e')],'transferercalleridnum':_0x33ef79[_0x6cd7('0x19')],'transferercalleridname':_0x33ef79[_0x6cd7('0x1a')],'transfererconnectedlinenum':_0x33ef79[_0x6cd7('0x1f')],'transfererconnectedlinename':_0x33ef79['secondtransfererconnectedlinename'],'transfereraccountcode':_0x33ef79[_0x6cd7('0x20')],'transferercontext':_0x33ef79[_0x6cd7('0x21')],'transfererexten':_0x33ef79['secondtransfererexten'],'transfererlinkedid':_0x33ef79[_0x6cd7('0x22')],'context':_0x33ef79[_0x6cd7('0x23')],'extension':_0x33ef79[_0x6cd7('0x24')],'type':_0x6cd7('0x7')});if(_[_0x6cd7('0x25')](_0x33ef79[_0x6cd7('0x26')])){_0x33ef79=_['assign'](_0x33ef79,{'transfereechannel':_0x33ef79[_0x6cd7('0x27')],'transfereecalleridnum':_0x33ef79['transfertargetcalleridnum'],'transfereecalleridname':_0x33ef79[_0x6cd7('0x1c')],'transfereeconnectedlinenum':_0x33ef79[_0x6cd7('0x28')],'transfereeconnectedlinename':_0x33ef79[_0x6cd7('0x29')],'transfereeaccountcode':_0x33ef79['transfertargetaccountcode'],'transfereecontext':_0x33ef79['transfertargetcontext'],'transfereeexten':_0x33ef79[_0x6cd7('0x2a')],'transfereelinkedid':_0x33ef79['transfertargetlinkedid']});}writeDB(_0x33ef79);}catch(_0x3cfe5d){utils[_0x6cd7('0x15')](util[_0x6cd7('0x4')](_0x6cd7('0x17'),_0x33ef79[_0x6cd7('0x8')]),_0x3cfe5d);}}; \ No newline at end of file +var _0x3813=['blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetexten','error','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','format','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname'];(function(_0xbafd8c,_0x4c1145){var _0xae7c95=function(_0x2c1361){while(--_0x2c1361){_0xbafd8c['push'](_0xbafd8c['shift']());}};_0xae7c95(++_0x4c1145);}(_0x3813,0xa2));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3381('0x0'));var util=require('util');var utils=require(_0x3381('0x1'));function writeDB(_0x2d1aad){utils[_0x3381('0x2')](util['format'](_0x3381('0x3'),_0x2d1aad['type']===_0x3381('0x4')?_0x2d1aad[_0x3381('0x5')]:_0x2d1aad[_0x3381('0x6')],_0x2d1aad[_0x3381('0x7')]));utils[_0x3381('0x8')](_0x3381('0x9'),_0x2d1aad);}exports[_0x3381('0xa')]=function(_0x46578a){try{utils[_0x3381('0xb')](util['format'](_0x3381('0xc'),_0x46578a[_0x3381('0x6')]),_0x46578a);utils[_0x3381('0x2')](util[_0x3381('0xd')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x46578a[_0x3381('0x6')],_0x46578a[_0x3381('0xe')],_0x46578a[_0x3381('0xf')],_0x46578a[_0x3381('0x10')],_0x46578a[_0x3381('0x11')]));_0x46578a[_0x3381('0x7')]=_0x3381('0x12');writeDB(_0x46578a);}catch(_0x160e0e){utils['error'](util[_0x3381('0xd')](_0x3381('0xc'),_0x46578a[_0x3381('0x6')]),_0x160e0e);}};exports[_0x3381('0x13')]=function(_0x1ccaf7){try{utils[_0x3381('0xb')](util[_0x3381('0xd')](_0x3381('0x14'),_0x1ccaf7[_0x3381('0x5')]),_0x1ccaf7);utils[_0x3381('0x2')](util[_0x3381('0xd')](_0x3381('0x15'),_0x1ccaf7[_0x3381('0x5')],_0x1ccaf7[_0x3381('0x16')],_0x1ccaf7[_0x3381('0x17')],_0x1ccaf7[_0x3381('0x18')],_0x1ccaf7['transfertargetcalleridname']));_0x1ccaf7=_[_0x3381('0x19')](_0x1ccaf7,{'transfererchannel':_0x1ccaf7['origtransfererchannel'],'transferercalleridnum':_0x1ccaf7['origtransferercalleridnum'],'transferercalleridname':_0x1ccaf7[_0x3381('0x17')],'transfererconnectedlinenum':_0x1ccaf7['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1ccaf7[_0x3381('0x1a')],'transfereraccountcode':_0x1ccaf7['origtransfereraccountcode'],'transferercontext':_0x1ccaf7[_0x3381('0x1b')],'transfererexten':_0x1ccaf7[_0x3381('0x1c')],'transfererlinkedid':_0x1ccaf7[_0x3381('0x1d')],'context':_0x1ccaf7[_0x3381('0x1e')],'extension':_0x1ccaf7[_0x3381('0x1f')],'type':_0x3381('0x4')});if(_['isNil'](_0x1ccaf7['transfereechannel'])){_0x1ccaf7=_[_0x3381('0x19')](_0x1ccaf7,{'transfereechannel':_0x1ccaf7[_0x3381('0x20')],'transfereecalleridnum':_0x1ccaf7[_0x3381('0x18')],'transfereecalleridname':_0x1ccaf7[_0x3381('0x21')],'transfereeconnectedlinenum':_0x1ccaf7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1ccaf7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1ccaf7['transfertargetaccountcode'],'transfereecontext':_0x1ccaf7['transfertargetcontext'],'transfereeexten':_0x1ccaf7[_0x3381('0x22')],'transfereelinkedid':_0x1ccaf7['transfertargetlinkedid']});}writeDB(_0x1ccaf7);}catch(_0x34c736){utils[_0x3381('0x23')](util[_0x3381('0xd')](_0x3381('0x14'),_0x1ccaf7['origtransfereruniqueid']),_0x34c736);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 739b159..723fe28 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(_0x2ef2b6,_0x4814cb){var _0x5b4794=function(_0x255dc2){while(--_0x255dc2){_0x2ef2b6['push'](_0x2ef2b6['shift']());}};_0x5b4794(++_0x4814cb);}(_0x7a54,0x106));var _0x47a5=function(_0x1803d0,_0x19845b){_0x1803d0=_0x1803d0-0x0;var _0x16f62c=_0x7a54[_0x1803d0];return _0x16f62c;};'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(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x7a54,0x106));var _0x47a5=function(_0x108317,_0xc8c3a8){_0x108317=_0x108317-0x0;var _0x25634d=_0x7a54[_0x108317];return _0x25634d;};'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